diff --git a/README.md b/README.md index c100fde..94d2073 100644 --- a/README.md +++ b/README.md @@ -37,19 +37,67 @@ lanes=false script=lua/script.lua ``` -# Building the plugin +# Building the Plugin ## Windows -To build on Windows, just download the repository and run the win-build.bat file in the premake folder. You should be getting a Visual Studio 2019 solution file +To build on Windows, download the repository and run the `win-build.bat` file located in the `premake` folder. This will generate a Visual Studio 2022 solution file in the main folder. Open it with Visual Studio and compile using the appropriate configuration: -**NOTE: You can only build x64 of Lua plugin on Windows for now. Why? Cuz I'm too lazy to setup my environment to compile mariadb for x32 :D** +- **Release32 + Win32** → produces `LuaPlugin_x32.dll` +- **Release + x64** → produces `LuaPlugin_x64.dll` + +--- ## Linux -To build on Linux: +### 1. Install Required Dependencies + +Run the following command to install the base build tools and libraries: + +```bash +sudo apt install -y build-essential gcc g++ make gcc-multilib g++-multilib \ + libc6-dev libc6-dev-i386 zlib1g-dev zlib1g:i386 \ + libncurses6:i386 libtinfo6:i386 libssl-dev rpm +``` + +Then, install `libpq-dev` according to your **target architecture**: + +> ⚠️ **Important:** `libpq-dev` and `libpq-dev:i386` conflict with each other. Install only the one that matches your desired target before compiling. + +- For **x86 (32-bit)**: +```bash + sudo apt install -y libpq-dev:i386 +``` + +- For **x64 (64-bit)**: +```bash + sudo apt install -y libpq-dev +``` + +--- + +### 2. Install Premake5 + +```bash +cd ~ +wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta8/premake-5.0.0-beta8-linux.tar.gz +tar -xzf premake-5.0.0-beta8-linux.tar.gz +sudo mv premake5 /usr/local/bin/premake5 +sudo chmod +x /usr/local/bin/premake5 +``` + +--- + +### 3. Clone and Build the Repository + +Clone the repository and navigate into the plugin directory. Then run the appropriate command based on your target architecture: + +- For **x86 (32-bit)** *(requires `libpq-dev:i386`)*: +```bash + premake5 gmake && make config=release32 +``` -- Download/Clone the repository -- Download premake and build it -- Inside the repository, call premake: `path/to/premake5 gmake` -- Now use `make` with your desired `config`: `make config=release` OR `make config=release32` +- For **x64 (64-bit)** *(requires `libpq-dev`)*: +```bash + premake5 gmake && make config=release +``` \ No newline at end of file diff --git a/VCMP-LUA/Core.cpp b/VCMP-LUA/Core.cpp index 57a188b..818d42f 100644 --- a/VCMP-LUA/Core.cpp +++ b/VCMP-LUA/Core.cpp @@ -34,10 +34,14 @@ extern "C" EXPORT unsigned int VcmpPluginInit(PluginFuncs* pluginFuncs, PluginCa g_Calls = pluginCalls; g_Info = pluginInfo; - pluginInfo->pluginVersion = 0x2600; + pluginInfo->pluginVersion = 0x2900; pluginInfo->apiMajorVersion = PLUGIN_API_MAJOR; pluginInfo->apiMinorVersion = PLUGIN_API_MINOR; + spdlog::info("[LuaPlugin] v{}.{}.{} initialized", (pluginInfo->pluginVersion >> 12) & 0xF, (pluginInfo->pluginVersion >> 8) & 0xF, (pluginInfo->pluginVersion >> 4) & 0xF); + spdlog::info("[LuaPlugin] Supported Lua runtime: {}", LUA_VERSION); + spdlog::info("[LuaPlugin] VCMP API version: {}.{}", PLUGIN_API_MAJOR, PLUGIN_API_MINOR); + CSimpleIni conf(false, true, false); SI_Error ini_ret = conf.LoadFile("luaconfig.ini"); @@ -176,4 +180,9 @@ void LoadLuaModule(std::string name) { luaopen_lanes_embedded(Lua.lua_state(), NULL); break; } +} + +// This makes the Lua state visible to other plugins. +extern "C" EXPORT lua_State* GetLuaState() { + return Lua.lua_state(); } \ No newline at end of file diff --git a/VCMP-LUA/Makefile b/VCMP-LUA/Makefile deleted file mode 100644 index 9e3b144..0000000 --- a/VCMP-LUA/Makefile +++ /dev/null @@ -1,270 +0,0 @@ -# GNU Make project makefile autogenerated by Premake - -ifndef config - config=release32 -endif - -ifndef verbose - SILENT = @ -endif - -.PHONY: clean prebuild prelink - -ifeq ($(config),release32) - RESCOMP = windres - TARGETDIR = ../bin/Release32-windows-x86/LuaPlugin - TARGET = $(TARGETDIR)/LuaPlugin_x86.dll - OBJDIR = ../bin/interm/Release32-windows-x86/LuaPlugin - DEFINES += -D_x32 -DLIBASYNC_STATIC -DWIN32 - INCLUDES += -I. -Iinclude -IvcmpWrap -Ivendor -Ivendor/Lua -Ivendor/sol -Ivendor/spdlog/include -Ivendor/asyncplusplus/include -Imodules/sqlite3/sqliteCpp/include -Imodules/requests/cpr/include -Imodules/mariadb/include -Imodules/mariadb/include/mysql - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += ../bin/Release32-windows-x86/spdlog/spdlog_x86.lib ../bin/Release32-windows-x86/Lua/Lua_x86.lib ../bin/Release32-windows-x86/asyncplusplus/asyncplusplus_x86.lib ../bin/Release32-windows-x86/module-crypto/module-crypto_x86.lib ../bin/Release32-windows-x86/module-sqliteCpp/module-sqliteCpp_x86.lib ../bin/Release32-windows-x86/module-cpr/module-cpr_x86.lib - LDDEPS += ../bin/Release32-windows-x86/spdlog/spdlog_x86.lib ../bin/Release32-windows-x86/Lua/Lua_x86.lib ../bin/Release32-windows-x86/asyncplusplus/asyncplusplus_x86.lib ../bin/Release32-windows-x86/module-crypto/module-crypto_x86.lib ../bin/Release32-windows-x86/module-sqliteCpp/module-sqliteCpp_x86.lib ../bin/Release32-windows-x86/module-cpr/module-cpr_x86.lib - ALL_LDFLAGS += $(LDFLAGS) -Lmodules/mariadb/lib -L/usr/lib32 -m32 -shared -Wl,--out-implib="../bin/Release32-windows-x86/LuaPlugin/LuaPlugin_x86.lib" -s - LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -ifeq ($(config),release) - RESCOMP = windres - TARGETDIR = ../bin/Release-windows-x86_64/LuaPlugin - TARGET = $(TARGETDIR)/LuaPlugin_x64.dll - OBJDIR = ../bin/interm/Release-windows-x86_64/LuaPlugin - DEFINES += -DLIBASYNC_STATIC -DWIN32 -D_RELEASE - INCLUDES += -I. -Iinclude -IvcmpWrap -Ivendor -Ivendor/Lua -Ivendor/sol -Ivendor/spdlog/include -Ivendor/asyncplusplus/include -Imodules/sqlite3/sqliteCpp/include -Imodules/requests/cpr/include -Imodules/mariadb/include -Imodules/mariadb/include/mysql - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += ../bin/Release-windows-x86_64/spdlog/spdlog_x64.lib ../bin/Release-windows-x86_64/Lua/Lua_x64.lib ../bin/Release-windows-x86_64/asyncplusplus/asyncplusplus_x64.lib ../bin/Release-windows-x86_64/module-crypto/module-crypto_x64.lib ../bin/Release-windows-x86_64/module-sqliteCpp/module-sqliteCpp_x64.lib ../bin/Release-windows-x86_64/module-cpr/module-cpr_x64.lib -lmysqlclient.lib - LDDEPS += ../bin/Release-windows-x86_64/spdlog/spdlog_x64.lib ../bin/Release-windows-x86_64/Lua/Lua_x64.lib ../bin/Release-windows-x86_64/asyncplusplus/asyncplusplus_x64.lib ../bin/Release-windows-x86_64/module-crypto/module-crypto_x64.lib ../bin/Release-windows-x86_64/module-sqliteCpp/module-sqliteCpp_x64.lib ../bin/Release-windows-x86_64/module-cpr/module-cpr_x64.lib - ALL_LDFLAGS += $(LDFLAGS) -Lmodules/mariadb/lib -L/usr/lib64 -m64 -shared -Wl,--out-implib="../bin/Release-windows-x86_64/LuaPlugin/LuaPlugin_x64.lib" -s - LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -OBJECTS := \ - $(OBJDIR)/Core.o \ - $(OBJDIR)/ConvertUTF.o \ - $(OBJDIR)/account.o \ - $(OBJDIR)/bind.o \ - $(OBJDIR)/concurrency.o \ - $(OBJDIR)/connection.o \ - $(OBJDIR)/date_time.o \ - $(OBJDIR)/exceptions.o \ - $(OBJDIR)/last_error.o \ - $(OBJDIR)/result_set.o \ - $(OBJDIR)/save_point.o \ - $(OBJDIR)/statement.o \ - $(OBJDIR)/time.o \ - $(OBJDIR)/time_span.o \ - $(OBJDIR)/transaction.o \ - $(OBJDIR)/worker.o \ - $(OBJDIR)/pch.o \ - $(OBJDIR)/Bind1.o \ - $(OBJDIR)/Checkpoint.o \ - $(OBJDIR)/Object.o \ - $(OBJDIR)/Pickup.o \ - $(OBJDIR)/Player.o \ - $(OBJDIR)/Server.o \ - $(OBJDIR)/Stream.o \ - $(OBJDIR)/Vehicle.o \ - $(OBJDIR)/EventManager.o \ - $(OBJDIR)/Remote.o \ - $(OBJDIR)/Hash.o \ - $(OBJDIR)/MySQL.o \ - $(OBJDIR)/MySQLAccount.o \ - $(OBJDIR)/MySQLConnection.o \ - $(OBJDIR)/SqLite.o \ - $(OBJDIR)/Thread.o \ - $(OBJDIR)/TimerManager.o \ - $(OBJDIR)/vcmpTimer.o \ - -RESOURCES := \ - -CUSTOMFILES := \ - -SHELLTYPE := posix -ifeq (.exe,$(findstring .exe,$(ComSpec))) - SHELLTYPE := msdos -endif - -$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR) - @echo Linking LuaPlugin - $(SILENT) $(LINKCMD) - $(POSTBUILDCMDS) - -$(CUSTOMFILES): | $(OBJDIR) - -$(TARGETDIR): - @echo Creating $(TARGETDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(TARGETDIR) -else - $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) -endif - -$(OBJDIR): - @echo Creating $(OBJDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(OBJDIR) -else - $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) -endif - -clean: - @echo Cleaning LuaPlugin -ifeq (posix,$(SHELLTYPE)) - $(SILENT) rm -f $(TARGET) - $(SILENT) rm -rf $(OBJDIR) -else - $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) - $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) -endif - -prebuild: - $(PREBUILDCMDS) - -prelink: - $(PRELINKCMDS) - -ifneq (,$(PCH)) -$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) -$(GCH): $(PCH) | $(OBJDIR) - @echo $(notdir $<) - $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" -else -$(OBJECTS): | $(OBJDIR) -endif - -$(OBJDIR)/Core.o: Core.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/ConvertUTF.o: include/ConvertUTF.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/account.o: modules/mariadb/src/account.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/bind.o: modules/mariadb/src/bind.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/concurrency.o: modules/mariadb/src/concurrency.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/connection.o: modules/mariadb/src/connection.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/date_time.o: modules/mariadb/src/date_time.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/exceptions.o: modules/mariadb/src/exceptions.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/last_error.o: modules/mariadb/src/last_error.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/result_set.o: modules/mariadb/src/result_set.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/save_point.o: modules/mariadb/src/save_point.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/statement.o: modules/mariadb/src/statement.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/time.o: modules/mariadb/src/time.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/time_span.o: modules/mariadb/src/time_span.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/transaction.o: modules/mariadb/src/transaction.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/worker.o: modules/mariadb/src/worker.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/pch.o: pch.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Bind1.o: vcmpWrap/Classes/Bind.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Checkpoint.o: vcmpWrap/Classes/Checkpoint.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Object.o: vcmpWrap/Classes/Object.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Pickup.o: vcmpWrap/Classes/Pickup.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Player.o: vcmpWrap/Classes/Player.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Server.o: vcmpWrap/Classes/Server.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Stream.o: vcmpWrap/Classes/Stream.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Vehicle.o: vcmpWrap/Classes/Vehicle.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/EventManager.o: vcmpWrap/EventManager/EventManager.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Remote.o: vcmpWrap/Modules/CPR/Remote.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Hash.o: vcmpWrap/Modules/Crypto/Hash.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/MySQL.o: vcmpWrap/Modules/MariaDB/MySQL.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/MySQLAccount.o: vcmpWrap/Modules/MariaDB/MySQLAccount.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/MySQLConnection.o: vcmpWrap/Modules/MariaDB/MySQLConnection.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/SqLite.o: vcmpWrap/Modules/SqLite3/SqLite.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Thread.o: vcmpWrap/Modules/Thread/Thread.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/TimerManager.o: vcmpWrap/Timer/TimerManager.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/vcmpTimer.o: vcmpWrap/Timer/vcmpTimer.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" - --include $(OBJECTS:%.o=%.d) -ifneq (,$(PCH)) - -include $(OBJDIR)/$(notdir $(PCH)).d -endif \ No newline at end of file diff --git a/VCMP-LUA/modules/crypto/Makefile b/VCMP-LUA/modules/crypto/Makefile deleted file mode 100644 index 783617e..0000000 --- a/VCMP-LUA/modules/crypto/Makefile +++ /dev/null @@ -1,134 +0,0 @@ -# GNU Make project makefile autogenerated by Premake - -ifndef config - config=release32 -endif - -ifndef verbose - SILENT = @ -endif - -.PHONY: clean prebuild prelink - -ifeq ($(config),release32) - RESCOMP = windres - TARGETDIR = ../../../bin/Release32-windows-x86/module-crypto - TARGET = $(TARGETDIR)/module-crypto_x86.lib - OBJDIR = ../../../bin/interm/Release32-windows-x86/module-crypto - DEFINES += -D_x32 - INCLUDES += -Iinclude - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -ifeq ($(config),release) - RESCOMP = windres - TARGETDIR = ../../../bin/Release-windows-x86_64/module-crypto - TARGET = $(TARGETDIR)/module-crypto_x64.lib - OBJDIR = ../../../bin/interm/Release-windows-x86_64/module-crypto - DEFINES += - INCLUDES += -Iinclude - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -OBJECTS := \ - $(OBJDIR)/src.o \ - -RESOURCES := \ - -CUSTOMFILES := \ - -SHELLTYPE := posix -ifeq (.exe,$(findstring .exe,$(ComSpec))) - SHELLTYPE := msdos -endif - -$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR) - @echo Linking module-crypto - $(SILENT) $(LINKCMD) - $(POSTBUILDCMDS) - -$(CUSTOMFILES): | $(OBJDIR) - -$(TARGETDIR): - @echo Creating $(TARGETDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(TARGETDIR) -else - $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) -endif - -$(OBJDIR): - @echo Creating $(OBJDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(OBJDIR) -else - $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) -endif - -clean: - @echo Cleaning module-crypto -ifeq (posix,$(SHELLTYPE)) - $(SILENT) rm -f $(TARGET) - $(SILENT) rm -rf $(OBJDIR) -else - $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) - $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) -endif - -prebuild: - $(PREBUILDCMDS) - -prelink: - $(PRELINKCMDS) - -ifneq (,$(PCH)) -$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) -$(GCH): $(PCH) | $(OBJDIR) - @echo $(notdir $<) - $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" -else -$(OBJECTS): | $(OBJDIR) -endif - -$(OBJDIR)/src.o: src/src.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" - --include $(OBJECTS:%.o=%.d) -ifneq (,$(PCH)) - -include $(OBJDIR)/$(notdir $(PCH)).d -endif \ No newline at end of file diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/account.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/account.hpp deleted file mode 100644 index 0088676..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/account.hpp +++ /dev/null @@ -1,239 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_ACCOUNT_HPP_ -#define _MARIADB_ACCOUNT_HPP_ - -#include -#include -#include -#include - -namespace mariadb { -class account; -typedef std::shared_ptr account_ref; - -class option_arg { - public: - virtual ~option_arg() = default; - virtual const void *value() = 0; -}; - -#define MAKE_OPTION_ARG(name, type, return_value) \ -class option_arg_##name : public option_arg { \ - public: \ - explicit option_arg_##name(const type &arg) : m_value(arg) { } \ - const void *value() override { return return_value; } \ - protected: \ - type m_value; \ -} - -MAKE_OPTION_ARG(bool, bool, &m_value); -MAKE_OPTION_ARG(int, int, &m_value); -MAKE_OPTION_ARG(string, std::string, m_value.c_str()); - -/** - * Class used to store account and connection information used by mariadb::connection when - * connecting. - * Note that modifying an account after the connection was established is useless. - */ -class account { - public: - typedef std::map map_options_t; - typedef std::map> map_connect_options_t; - - public: - /** - * Destructs the account - */ - virtual ~account() {} - - /** - * Gets the name of the host to connect to - */ - const std::string &host_name() const; - - /** - * Gets the username to log in with - */ - const std::string &user_name() const; - - /** - * Gets the password of the user to log in with - */ - const std::string &password() const; - - /** - * Gets the unix socket path to connect to. - * If this option is set, host and port will be ignored - */ - const std::string &unix_socket() const; - - /** - * Gets the path to the key file - */ - const std::string &ssl_key() const; - - /** - * Gets the path to the certificate file - */ - const std::string &ssl_certificate() const; - - /** - * Gets the path to the certificate authority file - */ - const std::string &ssl_ca() const; - - /** - * Gets the path to the directory containing CA files - */ - const std::string &ssl_ca_path() const; - - /** - * Gets the list of allowed SSL ciphers - */ - const std::string &ssl_cipher() const; - - /** - * Gets the port to connect to - */ - u32 port() const; - - /** - * Gets the name of the database to open on connect - */ - const std::string &schema() const; - - /** - * Sets the name of the database to open on connect - */ - void set_schema(const std::string &schema); - - /** - * Set SSL options. All files should be PEM format - * - * @param key Path to the key file - * @param certificate Path to the certificate file - * @param ca Path to the certificate authority file - * @param ca_path Path to a directory containing CA files - * @param cipher List of allowed SSL ciphers. See MariaDB manual for possible values - */ - void set_ssl(const std::string &key, const std::string &certificate, const std::string &ca, - const std::string &ca_path, const std::string &cipher); - - /** - * Gets the current state of the auto_commit option. This option is turned on by default. - */ - bool auto_commit() const; - - /** - * Sets the state of the auto_commit option. - */ - void set_auto_commit(bool auto_commit); - - /** - * Gets the current state of the store_result option. When set, the connection uses buffered store - * (mysql_store_result) instead of unbuffered store (mysql_use_result). This option is turned on by default. - * - * Note: Unbuffered store has some restrictions and might lead to unexpected behavior. See the documentation - * (https://mariadb.com/kb/en/library/mysql_use_result/) for more information. - */ - bool store_result() const; - - /** - * Sets the state of the store_result option. - */ - void set_store_result(bool store_result); - - /** - * Gets the current value of any named option that was previously set - * - * @return Value of the found option or empty string if not found - */ - const std::string option(const std::string &name) const; - - /** - * Gets a map of all option key/value pairs previously set - */ - const map_options_t &options() const; - - /** - * Sets a named option key/value pair - */ - void set_option(const std::string &name, const std::string &value); - - /** - * Deletes all stored key/value pairs of named options - */ - void clear_options(); - - /** - * Gets a map of all connect option key/value pairs previously set - */ - const map_connect_options_t &connect_options() const; - - /** - * Sets a connect option key/value pair with bool argument - */ - void set_connect_option(mysql_option option, bool arg); - /** - * Sets a connect option key/value pair with int argument - */ - void set_connect_option(mysql_option option, int arg); - /** - * Sets a connect option key/value pair with string argument - */ - void set_connect_option(mysql_option option, const std::string &arg); - - /** - * Deletes all stored key/value pairs of named options - */ - void clear_connect_options(); - - /** - * Create an account - * - * @param host_name Hostname to connect to - * @param user_name Username to log in with - * @param password Password for the user to log in with (may be empty) - * @param schema Database name to select on connect. Can also be set after connecting - * @param port Port of host to connect to (defaults to 3306) - * @param unix_sock Path of unix socket to connect to. If specified, host and port will be - * ignored - */ - static account_ref create(const std::string &host_name, const std::string &user_name, - const std::string &password, const std::string &schema = "", - u32 port = 3306, const std::string &unix_socket = ""); - - private: - /** - * Private account constructor - */ - account(const std::string &host_name, const std::string &user_name, const std::string &password, - const std::string &schema, u32 port, const std::string &unix_sock); - - bool m_auto_commit = true; - bool m_store_result = true; - u32 m_port; - std::string m_host_name; - std::string m_user_name; - std::string m_password; - std::string m_schema; - std::string m_unix_socket; - std::string m_ssl_key; - std::string m_ssl_certificate; - std::string m_ssl_ca; - std::string m_ssl_ca_path; - std::string m_ssl_cipher; - map_options_t m_options; - map_connect_options_t m_connect_options; -}; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/bind.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/bind.hpp deleted file mode 100644 index 58f8937..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/bind.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_BIND_HPP_ -#define _MARIADB_BIND_HPP_ - -#include -#include -#include - -namespace mariadb { -class statement; -class result_set; -class bind { - friend class statement; - friend class result_set; - - public: - /** - * Construct a parameter bind - */ - explicit bind(MYSQL_BIND *mysql_bind); - - /** - * Construct a result bind for given field type - */ - bind(MYSQL_BIND *mysql_bind, MYSQL_FIELD *mysql_field); - - /* - * Disallow copying and moving of a bind: - * As the bind can set its union as the bind "buffer", copying the bind would change the address of the union - */ - bind(const bind &) = delete; - bind(bind &&) = delete; - bind &operator=(const bind &) = delete; - bind &operator=(bind &&) = delete; - - char* buffer() const; - - long unsigned int length() const; - - bool is_null() const; - - void set(enum_field_types type, const char* buffer = nullptr, unsigned long length = 0, bool us = false); - - private: - MYSQL_BIND* m_bind; - MYSQL_TIME m_time; - - my_bool m_is_null; - my_bool m_error; - - data_ref m_data; - - union { - u64 m_unsigned64; - s64 m_signed64; - s32 m_signed32[2]; - f64 m_double64; - f32 m_float32[2]; - u8 m_uchar8[4]; - }; -}; - - using bind_ref = std::unique_ptr; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/concurrency.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/concurrency.hpp deleted file mode 100644 index a928855..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/concurrency.hpp +++ /dev/null @@ -1,84 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_CONCURRENCY_HPP_ -#define _MARIADB_CONCURRENCY_HPP_ - -#include -#include -#include - -namespace mariadb { -namespace concurrency { - namespace status { - enum type { waiting, executing, succeed, failed, removed }; - } - - // - // Set account for connection - // - extern void set_account(account_ref& account); - - // - // Query status - // - extern status::type worker_status(handle h); - - // - // Execute a query - // Note: the void overloads are needed because it was too easy to "forget" passing keep_handle - // and getting an invalid handle, instead we now return void when no handle is needed - // - extern handle execute(const std::string& query, bool keep_handle); - inline void execute(const std::string& squery) { execute(squery, false); } - - extern handle insert(const std::string& query, bool keep_handle); - inline void insert(const std::string& squery) { insert(squery, false); } - - extern handle query(const std::string& query, bool keep_handle); - inline void query(const std::string& squery) { query(squery, false); } - - // - // Execute a query using a statement - // Note: the void overloads are needed because it was too easy to "forget" passing keep_handle - // and getting an invalid handle, instead we now return void when no handle is needed - // - extern statement_ref create_statement(const std::string& query); - extern handle execute(statement_ref& statement, bool keep_handle); - inline void execute(statement_ref& statement) { execute(statement, false); } - - extern handle insert(statement_ref& statement, bool keep_handle); - inline void insert(statement_ref& statement) { insert(statement, false); } - - extern handle query(statement_ref& statement, bool keep_handle); - inline void query(statement_ref& statement) { query(statement, false); } - - // - // Query executed, result ready to be used - // - extern u64 get_execute_result(handle h); - extern u64 get_insert_result(handle h); - extern result_set_ref get_query_result(handle h); - - // - // Remove a query - // - // Please note, if a result_set is used, it must be done after the result_set is used... - // - extern void release_handle(handle h); - - // - // Wait for a handle to signal - // - extern bool wait_handle(handle h, u64 wait_time_ms = 100); -} -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/connection.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/connection.hpp deleted file mode 100644 index 0de839e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/connection.hpp +++ /dev/null @@ -1,204 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_CONNECTION_HPP_ -#define _MARIADB_CONNECTION_HPP_ - -#include -#include -#include -#include -#include -#include - -#include - -namespace mariadb { -/** - * Wraps a Database connection. - */ -class connection : public last_error { - friend class result_set; - friend class statement; - friend class transaction; - friend class save_point; - - public: - /** - * Destroys connection and automatically disconnects - */ - virtual ~connection(); - - /** - * Actually connects to the database using given account, sets SSL and additional options as - * well as auto commit - * - * @return True on success - */ - bool connect(); - - /** - * Disconnects from the database - */ - void disconnect(); - - /** - * Indicates whether the connection is active. Also detects stale connections - * - * @return True on active connection - */ - bool connected() const; - - /** - * Gets the account associated with this connection - * - * @return Reference to the account - */ - account_ref account() const; - - /** - * Gets the schema (database name) - * - * @return String containing the schema - */ - const std::string& schema() const; - - /** - * Sets the schema (database name). - * The connection needs to be already established - * - * @param schema The new schema name - * @return True on success - */ - bool set_schema(const std::string& schema); - - /** - * Gets the charset associated with this connection - * - * @return String containg the charset (see documentation of MariaDB for possible values) - */ - const std::string& charset() const; - - /** - * Sets the charset. - * The connection needs to be already established - * - * @param value The new charset - * @return True on success - */ - bool set_charset(const std::string& value); - - /** - * Execute a query without interest in a result. - * The connection needs to be established. - * - * @param query SQL query to execute - * @return The number of actually affected rows. 0 on error - */ - u64 execute(const std::string& query); - - /** - * Execute a query (usually, but not limited to INSERT) with interest for the last row id. - * The connection needs to be established. - * - * @param query SQL query to execute - * @return Last row id of the inserted row. 0 on error - */ - u64 insert(const std::string& query); - - /** - * Execute a query with an result (if no result is returned, the result_set will be empty). - * The connection needs to be established. - * Note: The result is only valid as long as the connection is valid. - * - * @param query SQL query to execute - * @return Result of the query as result_set. - */ - result_set_ref query(const std::string& query); - - /** - * Gets the status of the auto_commit setting. - * - * @return True if auto_commit is enabled - */ - bool auto_commit() const; - - /** - * Sets the auto_commit setting. Default MariaDB setting is TRUE. - * The connection needs to be established. - * This setting controls the default behavior of holding all changes back until a COMMIT is - * issued. - * See MariaDB documentation for further information on this setting. - * - * @return True on success - */ - bool set_auto_commit(bool auto_commit); - - /** - * Create a prepared statement. Use "?" to issue bindings in the query which can then be filled - * in. - * For information on how to properly use prepared statements please refer to the MariaDB - * manual. - * The connection needs to be established. - * Note that "?" bindings can only be established at certain locations in a SQL statement. - * A misplaced "?" will result in an error when executing the statement. - * The statement is only valid as long as the connection is valid. - * - * @return Reference to the created statement. - */ - statement_ref create_statement(const std::string& query); - - /** - * Create a transaction. Any change to the database will be held back until you COMMIT the - * transaction. - * A not committed transaction automatically rolls all changes back on destruction. - * Note: the transaction is only valid as long as this connection is valid. - * - * @param level The level of isolation to set while using this transaction. Defaults to - * repeatable read - * @param consistent_snapshot Indicates whether to require a consistent snapshot before entering - * the transaction. - * Note: refer to MariaDB manual for further information - * - * @return Reference to the created transaction. - */ - transaction_ref create_transaction(isolation::level level = isolation::repeatable_read, - bool consistent_snapshot = true); - - /** - * Creates a new connection using the given account - * - * @param account The account used to provide the connection information - * @return Reference to the newly created connection - */ - static connection_ref create(const account_ref& account); - - private: - /** - * Private constructor used to create a connection with the given account - */ - connection(const account_ref& account); - - private: - // internal database connection pointer - MYSQL* m_mysql; - - // state of auto_commit setting - bool m_auto_commit; - // name of current schema - std::string m_schema; - // current charset - std::string m_charset; - // currently used account - account_ref m_account; -}; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/conversion_helper.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/conversion_helper.hpp deleted file mode 100644 index 03342bf..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/conversion_helper.hpp +++ /dev/null @@ -1,104 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef MARIADBCLIENTPP_CONVERSION_HELPER_H -#define MARIADBCLIENTPP_CONVERSION_HELPER_H - -#include -#include - -#ifdef WIN32 -#undef max -#undef min -#endif - -template -inline T checked_cast(K value) { - if (value < std::numeric_limits::lowest() || value > std::numeric_limits::max()) return T(); - - return static_cast(value); -} - -template -inline T string_cast(const std::string &str) { - size_t endPos; - int parsedNumber = std::stoi(str, &endPos); - - if (endPos != str.size()) return T(); - - return checked_cast(parsedNumber); -} - -template <> -inline unsigned long string_cast(const std::string &str) { - size_t endPos; - unsigned long parsedNumber = std::stoul(str, &endPos); - - if (endPos != str.size()) return 0; - - return parsedNumber; -} - -template <> -inline unsigned int string_cast(const std::string &str) { - unsigned long parsedNumber = string_cast(str); - - return checked_cast(parsedNumber); -} - -template <> -inline unsigned long long string_cast(const std::string &str) { - size_t endPos; - unsigned long long parsedNumber = std::stoull(str, &endPos); - - if (endPos != str.size()) return 0; - - return parsedNumber; -} - -template <> -inline long long string_cast(const std::string &str) { - size_t endPos; - long long parsedNumber = std::stoll(str, &endPos); - - if (endPos != str.size()) return 0; - - return parsedNumber; -} - -template <> -inline double string_cast(const std::string &str) { - size_t endPos; - try { - double parsedNumber = std::stod(str, &endPos); - - if (endPos != str.size()) return 0; - - return parsedNumber; - } catch (std::out_of_range &) { - // Not a Number double - return std::numeric_limits::quiet_NaN(); - } -} - -template <> -inline float string_cast(const std::string &str) { - size_t endPos; - try { - float parsedNumber = std::stof(str, &endPos); - - if (endPos != str.size()) return 0; - - return parsedNumber; - } catch (std::out_of_range &) { - // Not a Number float - return std::numeric_limits::quiet_NaN(); - } -} - -#endif // MARIADBCLIENTPP_CONVERSION_HELPER_H diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/data.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/data.hpp deleted file mode 100644 index f9848ff..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/data.hpp +++ /dev/null @@ -1,174 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_DATA_HPP_ -#define _MARIADB_DATA_HPP_ - -#include -#include -#include - -namespace mariadb { -template -class data { - public: - typedef Type char_type; - - // - // Constructor - // - data() : m_count(0), m_size(0), m_data(0) {} - - data(u32 count) : m_count(0), m_size(0), m_data(0) { create(count); } - - data(const Type* data, size_t count) : m_count(0), m_size(0), m_data(0) { - create(data, static_cast(count)); - } - - // - // Destructor - // - virtual ~data() { destroy(); } - - // - // Create the data - // - bool create(u32 count) { - if (m_data) destroy(); - - m_data = new Type[count]; - - if (m_data == 0) return false; - - m_count = count; - m_size = sizeof(Type) * count; - m_position = 0; - - return true; - } - - bool create(const Type* data, u32 count) { - if (create(count)) { - memcpy(m_data, data, m_size); - return true; - } - - return false; - } - - bool resize(u32 count) { - if (count > m_count) { - Type* data = new Type[count]; - - if (data == 0) return false; - - memcpy(data, m_data, m_size); - delete[] m_data; - m_data = data; - } - - m_count = count; - m_size = sizeof(Type) * count; - - return true; - } - - // - // Destroy - // - void destroy() { - if (m_data) delete[] m_data; - - m_data = NULL; - m_size = 0; - m_count = 0; - m_position = 0; - } - - // - // Convert data to a valid string - // - std::string string() const { - std::string str; - if (m_size) str.append(reinterpret_cast(m_data), m_size); - return str; - } - - // - // Get data / size - // - inline u32 size() const { return m_size; } - inline Type* get() const { return m_data; } - - // - // Operator to access the base directly - // - inline operator Type*() { return m_data; } - inline operator Type*() const { return m_data; } - - // - // Stream methods - // - std::streamsize read(char_type* buffer, std::streamsize size) { - const std::streamsize amount = static_cast(m_size - m_position); - const std::streamsize result = std::min(size, amount); - - if (result != 0) { - std::copy(m_data + m_position, m_data + m_position + result, buffer); - m_position += result; - return result; - } - - return size ? -1 : 0; - } - - std::streamsize write(char_type* buffer, std::streamsize size) { - const std::streamsize amount = static_cast(m_size - m_position); - const std::streamsize result = std::min(size, amount); - - if (result != 0) { - std::copy(buffer, buffer + result, m_data + m_position); - m_position += result; - return result; - } - - return size ? -1 : 0; - } - - std::streampos seek(std::streampos offset, std::ios_base::seekdir seekdir) { - std::streampos pos; - - if (seekdir == std::ios_base::beg) - pos = offset; - else if (seekdir == std::ios_base::cur) - pos = m_position + offset; - else if (seekdir == std::ios_base::end) - pos = m_size + offset; - else - throw std::ios_base::failure("Bad seek direction"); - - if (pos < 0 || pos > m_size) throw std::ios_base::failure("Bad seek offset"); - - m_position = static_cast(pos); - return pos; - } - - protected: - u32 m_count; - u32 m_size; - u32 m_position; - Type* m_data; -}; - -typedef std::shared_ptr< ::mariadb::data > data_ref; -typedef std::basic_iostream< ::mariadb::data > data_stream; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/date_time.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/date_time.hpp deleted file mode 100644 index dad8ba6..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/date_time.hpp +++ /dev/null @@ -1,410 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2020. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_DATE_TIME_HPP_ -#define _MARIADB_DATE_TIME_HPP_ - -#include -#include - -namespace mariadb { -/** - * Class used to represent SQL date_time - */ -class date_time : public time { - public: - /** - * Construct date_time from given data. An exception will be thrown on invalid data. - * - * @param year The year to set. - * @param month The month to set. [1-12] - * @param day The day to set. Make sure it exists in the month. [1-28/39/30/31] - * @param hour The hour to set. [0-23} - * @param minute The minute to set. [0-59] - * @param second The second to set. [0-60] - * @param millisecond The millisecond to set. [0-999] - */ - date_time(u16 year = 1970, u8 month = 1, u8 day = 1, u8 hour = 0, u8 minute = 0, u8 second = 0, - u16 millisecond = 0); - - /** - * Copy constructor - * - * @param dt Datetime to copy from - */ - date_time(const date_time& dt); - - /** - * Construct date_time with given time. Sets the date to Jan, 1st of 1900 - * - * @param t Time to copy from - */ - date_time(const time& t); - - /** - * Construct date_time from tm struct. Since tm cannot represent milliseconds, none will be set. - * - * @param time_struct Struct to copy from - */ - date_time(const tm& time_struct); - - /** - * Construct date_time from given time_t. Converts the time to local timezone before setting it. - * Note that no milliseconds will be set. - * - * @param time Timetype to set. - */ - date_time(const time_t& time); - - /** - * Construct date_time from MYSQL_TIME. No milliseconds will be set. - * - * @param time MYSQL_TIME to copy from. - */ - date_time(const MYSQL_TIME& time); - - /** - * Construct date_time from ISO yyyy-mm-dd hh:mm:ss.nnn date format. Throws an exception on - * invalid input - * - * @param dt String containing ISO date - */ - date_time(const std::string& dt); - - // - // Operators - // - int compare(const date_time& dt) const; - date_time& operator=(const date_time& dt); - bool operator==(const date_time& dt) const; - bool operator!=(const date_time& dt) const; - bool operator<(const date_time& dt) const; - bool operator<=(const date_time& dt) const; - bool operator>(const date_time& dt) const; - bool operator>=(const date_time& dt) const; - - /** - * Get currently set year - * - * @return Current year - */ - u16 year() const; - - /** - * Set current year. If date becomes invalid, month and day will be reset to 1-1 - * - * @param year Year to set - * @return Newly set year - */ - u16 year(u16 year); - - /** - * Get currently set month - * - * @return Current month - */ - u8 month() const; - - /** - * Set current month. If date becomes invalid, day will be reset to 1 - * - * @param month Month to set - * @return Newly set month - */ - u8 month(u8 month); - - /** - * Get currently set day of month - * - * @return Current day - */ - u8 day() const; - - /** - * Set current day. If date becomes invalid, an exception will be thrown - * - * @param day Day to set - * @return Newly set day - */ - u8 day(u8 day); - - /** - * Calculates the day of year from current date. - * - * @return Day of year - */ - u16 day_of_year() const; - - /** - * Sets the date by calculating which date the day_of_year corresponds to. - * - * @return Day of year that was set - */ - u16 day_of_year(u16 day_of_year); - - /** - * Set only date part. Invalid dates will throw an exception - * - * @param year Year to set. - * @param month Month to set. [1-12] - * @param day Day to set. [1-28/29/30/31] - * @return True on success - */ - bool set(u16 year, u8 month, u8 day); - - /** - * Set date and time part. Invalid dates will throw an exception - * - * @param year Year to set. - * @param month Month to set. [1-12] - * @param day Day to set. [1-28/29/30/31] - * @param hour The hour to set. [0-23} - * @param minute The minute to set. [0-59] - * @param second The second to set. [0-60] - * @param millisecond The millisecond to set. [0-999] - * @return True on success - */ - bool set(u16 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond); - - /** - * Set date and time to ISO yyyy-mm-dd hh:mm:ss.nnn date format. - * Throws an exception on invalid input - * - * @param dt String containing ISO date - * @return True on success - */ - bool set(const std::string& dt) override; - - /** - * Add years to current date. - * - * @param years Number of years to add - * @return Newly created date_time containing result - */ - date_time add_years(s32 years) const; - - /** - * Add months to current date with year wrapping. - * - * @param months Number of months to add - * @return Newly created date_time containing result - */ - date_time add_months(s32 months) const; - - /** - * Add days to current date with month wrapping. - * - * @param days Number of days to add - * @return Newly created date_time containing result - */ - date_time add_days(s32 days) const; - - /** - * Add hours to current date with day wrapping. - * - * @param hours Number of hours to add - * @return Newly created date_time containing result - */ - date_time add_hours(s32 hours) const; - - /** - * Add minutes to current date with hour wrapping. - * - * @param minutes Number of minutes to add - * @return Newly created date_time containing result - */ - date_time add_minutes(s32 minutes) const; - - /** - * Add seconds to current date with minute wrapping. - * - * @param seconds Number of seconds to add - * @return Newly created date_time containing result - */ - date_time add_seconds(s32 seconds) const; - - /** - * Add milliseconds to current date with second wrapping. - * - * @param milliseconds Number of milliseconds to add - * @return Newly created date_time containing result - */ - date_time add_milliseconds(s32 milliseconds) const; - - /** - * Adds a timespan to the date_time. - * - * @param dur The duration to add - * @return Newly created date_time containing result - */ - date_time add(const time_span& dur) const; - - /** - * Subtracts a timespan from the date_time. - * - * @param dur The duration to subtract - * @return Newly created date_time containing result - */ - date_time subtract(const time_span& dur) const; - - /** - * Adds a mariadb::time to the date_time. - * - * @param t Time to add - * @return Newly created date_time containing result - */ - date_time add(const time& t) const; - - /** - * Substract a mariadb::time from the date_time. - * - * @param t Time to subtract - * @return Newly created date_time containing result - */ - date_time substract(const time& t) const; - - /** - * Calculates the time_span between this date_time and dt. If dt > this the time_span will be - * negative - * - * @param dt Datetime to calculate the timespan to - * @return Timespan representing the time between this and dt - */ - time_span time_between(const date_time& dt) const; - - /** - * Indicates whether this date is considered valid - * - * @return True if date is valid - */ - bool is_valid() const override; - - /** - * Indicates whether a given year is leap according to gregorian calendar - * - * @param year The year to check - * @return True if year is leap - */ - static bool is_leap_year(u16 year); - - /** - * Indicates whether a given date is valid in terms of existing month and day in month. Accounts - * for leap years - * - * @param year Year to check - * @param month Month to check - * @param day Day to check - * @return True if date is valid - */ - static bool valid_date(u16 year, u8 month, u8 day); - - /** - * Gets the number of days in a given year. Accounts for leap years - * - * @param year Year to check - * @return Number of days in year - */ - static u16 days_in_year(u16 year); - - /** - * Gets the number of days in a given month of a given year. Accounts for leap years - * - * @param year Year to check - * @param month Month to check - * @return Number of days in month of year - */ - static u8 days_in_month(u16 year, u8 month); - - /** - * Gets the day of year for given date. Accounts for leap years - * - * @param year Year of date - * @param month Month of date - * @param day Day of date - * @return Day of year of given date - */ - static u16 day_of_year(u16 year, u8 month, u8 day); - - /** - * Gets the date from given year and day of year - * - * @param year Year in which to position day_of_year - * @param day_of_year Position of day within the year - * @return Datetime representing the exact date - */ - static date_time reverse_day_of_year(u16 year, u16 day_of_year); - - /** - * Convert the date_time to a time_t. Precision is limited to seconds - * - * @return Timetype representing the date_time - */ - time_t mktime() const; - - /** - * Uses ::difftime to calculate number of seconds between two dates - * - * @param dt Datetime to calculate difference to - * @return Number of seconds with fractions between the two dates - */ - double diff_time(const date_time& dt) const; - - /** - * Gets only the date part of this date_time - * - * @return Datetime representing only the date part - */ - date_time date() const; - - /** - * Converts the date_time to a MYSQL_TIME. Precision is limited to seconds - * - * @return MYSQL_TIME representing this date_time - */ - MYSQL_TIME mysql_time() const; - - /** - * Gets the current date and time as date_time. Does not set milliseconds - * - * @return Current date and time in local timezone - */ - static date_time now(); - - /** - * Gets the current date and time as date_time. Does not set milliseconds - * - * @return Current date and time in UTC - */ - static date_time now_utc(); - - /** - * Converts the date and time to ISO 8601 string yyyy-mm-dd hh:mm:ss[.nnn] - * - * @param with_millisecond Controls whether or not to print optional .nnn part - * @return String containing ISO date and time - */ - const std::string str(bool with_millisecond = false) const; - - /** - * Converts only the date part of this date_time to ISO 8601 date string yyyy-mm-dd - * - * @return String containing ISO date - */ - const std::string str_date() const; - - private: - u16 m_year; - u8 m_month; - u8 m_day; -}; - -std::ostream& operator<<(std::ostream& os, const date_time& ddt); -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/decimal.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/decimal.hpp deleted file mode 100644 index e7b753f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/decimal.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_DECIMAL_HPP_ -#define _MARIADB_DECIMAL_HPP_ - -#include -#include -#include - -namespace mariadb { -class decimal { -public: - explicit decimal(std::string str = "") : mStr(std::move(str)) { } - - std::string str() const { - return mStr; - } - - f32 float32() const { - return string_cast(mStr); - } - - f64 double64() const { - return string_cast(mStr); - } - -private: - std::string mStr; -}; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/exceptions.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/exceptions.hpp deleted file mode 100644 index 81c76f1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/exceptions.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_EXCEPTIONS_HPP_ -#define _MARIADB_EXCEPTIONS_HPP_ - -#include -#include - -namespace mariadb { -namespace exception { -class base : public std::exception { - public: - // - // Constructor - // - base() throw() : std::exception(), m_error_id(0), m_error("Exception not defined") {} - - base(u32 error_id, const std::string& error) throw() - : std::exception(), m_error_id(error_id), m_error(error) {} - - base(const std::string& error) throw() : std::exception(), m_error_id(0), m_error(error) {} - - // - // Destructor - // - virtual ~base() throw() {} - - // - // Methods - // - virtual const char* what() const throw() { return m_error.c_str(); } - - u32 error_id() const throw() { return m_error_id; } - - protected: - u32 m_error_id; - std::string m_error; -}; - -class date_time : public base { - public: - // - // Constructors - // - date_time(u16 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond) throw(); -}; - -class time : public base { - public: - // - // Constructors - // - time(u8 hour, u8 minute, u8 second, u16 millisecond) throw(); -}; - -class connection : public base { - public: - // - // Constructor - // - connection(u32 error_id, const std::string& error) throw() : base(error_id, error) {} -}; -} -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/last_error.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/last_error.hpp deleted file mode 100644 index fe81b79..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/last_error.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_LAST_ERROR_HPP_ -#define _MARIADB_LAST_ERROR_HPP_ - -#include -#include "types.hpp" - -namespace mariadb { -class last_error { - public: - // - // Constructor - // - last_error(); - - // - // Get last error - // - u32 error_no() const; - const std::string& error() const; - - protected: - u32 m_last_error_no; - std::string m_last_error; -}; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/result_set.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/result_set.hpp deleted file mode 100644 index d3baf70..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/result_set.hpp +++ /dev/null @@ -1,222 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_RESULT_SET_HPP_ -#define _MARIADB_RESULT_SET_HPP_ - -#include -#include -#include -#include -#include -#include -#include - -#define MAKE_GETTER_SIG_STR(nm, rtype, fq) rtype fq get_##nm(const std::string& name) const -#define MAKE_GETTER_SIG_INT(nm, rtype, fq) rtype fq get_##nm(u32 index) const - -#define MAKE_GETTER_DECL(nm, rtype) \ - MAKE_GETTER_SIG_STR(nm, rtype, ); \ - MAKE_GETTER_SIG_INT(nm, rtype, ) - -#define MAKE_GETTER(nm, rtype, vtype) \ - MAKE_GETTER_SIG_STR(nm, rtype, result_set::) { return get_##nm(column_index(name)); } \ - MAKE_GETTER_SIG_INT(nm, rtype, result_set::) { \ - check_row_fetched(); \ - check_type(index, vtype); \ - \ - if (index >= m_field_count) throw std::out_of_range("Column index out of range"); - -namespace mariadb { -class connection; -class statement; - -/* - * This data is shared between a statement and its result_set, - * therefore it needs to be destroyed only when - * - the statement is freed - * - all of the result_sets are freed - * - * A shared_ptr is used to keep the data alive in the statement and the result_set. - */ -struct statement_data { - explicit statement_data(MYSQL_STMT* stmt) : m_statement(stmt) {} - - ~statement_data(); - - // number of binds in this query - unsigned long m_bind_count = 0; - // pointer to underlying statement - MYSQL_STMT* m_statement; - // pointer to raw binds - MYSQL_BIND* m_raw_binds = nullptr; - // pointer to managed binds - std::vector m_binds; -}; - -typedef std::shared_ptr statement_data_ref; - -/** - * Class used to store query and statement results - */ -class result_set : public last_error { - friend class connection; - friend class statement; - - typedef std::map map_indexes_t; - - public: - /** - * Destructs the result_set and frees all result data - */ - virtual ~result_set(); - - /** - * Get the count of columns contained in this result_set - * - * @return Count of columns - */ - u32 column_count() const; - - /** - * Get the index of a column by column-name (case sensitive) - * - * @param name Name of column to look up - * @return Index of column if found, maximum uint32 if not found - */ - u32 column_index(const std::string& name) const; - - /** - * Gets the type of a column by index - * - * @param index Index of the column to examine - * @return Type enum indicating column type - */ - value::type column_type(u32 index) const; - - /** - * Gets the name of a column by index - * - * @param index Index of the column to get the name for - * @return String representing column name - */ - const std::string column_name(u32 index); - - /** - * Gets the size of the data contained in the column at index - * - * @param index Index of the column to get the size for - * @return Size of the column contents for the currently active row - */ - unsigned long column_size(u32 index) const; - - /** - * Gets the row index of the currently selected row - * - * @return Index of current row - */ - u64 row_index() const; - - /** - * Gets the number of rows in this result - * - * @return Number of rows in result_set - */ - u64 row_count() const; - - /** - * Fetch next row from result_set - * - * @return True if next row exists - */ - bool next(); - - /** - * Set the current row index in result_set (seek to result). - * Also immediately fetches the selected row. - * - * @param index Index of row to select - * @return True if row could be seeked to and fetched. - */ - bool set_row_index(u64 index); - - // declare all getters - MAKE_GETTER_DECL(blob, stream_ref); - MAKE_GETTER_DECL(data, data_ref); - MAKE_GETTER_DECL(date, date_time); - MAKE_GETTER_DECL(date_time, date_time); - MAKE_GETTER_DECL(time, time); - MAKE_GETTER_DECL(decimal, decimal); - MAKE_GETTER_DECL(string, std::string); - MAKE_GETTER_DECL(boolean, bool); - MAKE_GETTER_DECL(unsigned8, u8); - MAKE_GETTER_DECL(signed8, s8); - MAKE_GETTER_DECL(unsigned16, u16); - MAKE_GETTER_DECL(signed16, s16); - MAKE_GETTER_DECL(unsigned32, u32); - MAKE_GETTER_DECL(signed32, s32); - MAKE_GETTER_DECL(unsigned64, u64); - MAKE_GETTER_DECL(signed64, s64); - MAKE_GETTER_DECL(float, f32); - MAKE_GETTER_DECL(double, f64); - MAKE_GETTER_DECL(is_null, bool); - - private: - /** - * Create result_set from connection - */ - explicit result_set(connection* conn); - - /** - * Create result_set from statement - */ - explicit result_set(connection* conn, const statement_data_ref& stmt); - - /** - * Throws if the result set was created, but no row was ever fetched (using next()) - */ - void check_row_fetched() const; - - /** - * Throws if the actual type of column at index cannot be converted to the requested type - * - * @param index Index of column to check - * @param requested Requested type - */ - void check_type(u32 index, value::type requested) const; - - // pointer to result set - MYSQL_RES* m_result_set; - // pointer to array of fields - MYSQL_FIELD* m_fields; - // pointer to current row - MYSQL_ROW m_row; - // pointer to raw binds - MYSQL_BIND* m_raw_binds; - - // vector of managed binds - std::vector m_binds; - // optional pointer to statement - statement_data_ref m_stmt_data; - // map caching column name by index - map_indexes_t m_indexes; - // array of content lengths for the columns of current row - long unsigned int* m_lengths; - - // count of fields per row - u32 m_field_count; - // indicates if a row was fetched using next() - bool m_was_fetched; -}; - -typedef std::shared_ptr result_set_ref; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/save_point.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/save_point.hpp deleted file mode 100644 index 9c0be61..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/save_point.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_SAVE_POINT_HPP_ -#define _MARIADB_SAVE_POINT_HPP_ - -#include - -namespace mariadb { -class connection; -class transaction; - -/** - * Class used to represent a MariaDB savepoint having automatic rollback functionality - */ -class save_point { - friend class connection; - friend class transaction; - - public: - /** - * Destructor initiates automatic rollback if changes were not committed - */ - virtual ~save_point(); - - /** - * Commits the changes and releases savepoint - */ - void commit(); - - private: - /** - * Create save_point with given transaction - */ - save_point(transaction* trans); - - private: - // internal transaction pointer - transaction* m_transaction; - // distinct name of the current save_pointS - std::string m_name; -}; - -typedef std::shared_ptr save_point_ref; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/statement.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/statement.hpp deleted file mode 100644 index 09f421f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/statement.hpp +++ /dev/null @@ -1,112 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_STATEMENT_HPP_ -#define _MARIADB_STATEMENT_HPP_ - -#include -#include - -#define MAKE_SETTER_SIG(nm, type, fq) void fq set_##nm(u32 index, type value) - -#define MAKE_SETTER_DECL(nm, type) MAKE_SETTER_SIG(nm, type, ) - -#define MAKE_SETTER_BODY \ - if (index >= m_data->m_bind_count) throw std::out_of_range("Field index out of range"); \ - \ - bind& bind = *m_data->m_binds.at(index); - -#define MAKE_SETTER(nm, type) \ - MAKE_SETTER_SIG(nm, type, statement::) { \ - MAKE_SETTER_BODY - -namespace mariadb { -class connection; -class worker; -class result_set; -typedef std::shared_ptr connection_ref; - -/** - * Class representing a prepared statement with binding functionality - */ -class statement : public last_error { - friend class connection; - friend class result_set; - friend class worker; - - public: - statement() = delete; - - /** - * Execute the query and return the number of rows affected - * - * @return Number of rows affected or zero on error - */ - u64 execute(); - - /** - * Execute the query and return the last insert id - * - * @return Last insert ID or zero on error - */ - u64 insert(); - - /** - * Execute the query and return a result set - * - * @return Result set containing a result or an empty set on error - */ - result_set_ref query(); - - /** - * Set connection ref, used by concurrency - */ - void set_connection(connection_ref& connection); - - // declare all setters - MAKE_SETTER_DECL(blob, stream_ref); - MAKE_SETTER_DECL(date_time, const date_time&); - MAKE_SETTER_DECL(date, const date_time&); - MAKE_SETTER_DECL(time, const time&); - MAKE_SETTER_DECL(data, const data_ref&); - MAKE_SETTER_DECL(decimal, const decimal&); - MAKE_SETTER_DECL(string, const std::string&); - MAKE_SETTER_DECL(boolean, bool); - MAKE_SETTER_DECL(unsigned8, u8); - MAKE_SETTER_DECL(signed8, s8); - MAKE_SETTER_DECL(unsigned16, u16); - MAKE_SETTER_DECL(signed16, s16); - MAKE_SETTER_DECL(unsigned32, u32); - MAKE_SETTER_DECL(signed32, s32); - MAKE_SETTER_DECL(unsigned64, u64); - MAKE_SETTER_DECL(signed64, s64); - MAKE_SETTER_DECL(float, f32); - MAKE_SETTER_DECL(double, f64); - void set_null(u32 index); - - private: - /** - * Private constructor used by connection - */ - statement(connection* conn, const std::string& query); - - private: - // reference to parent connection - connection_ref m_connection; - // non-owning pointer to parent connection - connection *m_parent; - // reference to internal data, shared with all results - statement_data_ref m_data; -}; - -typedef std::shared_ptr statement_ref; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/time.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/time.hpp deleted file mode 100644 index c0f83e1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/time.hpp +++ /dev/null @@ -1,316 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2020. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_TIME_HPP_ -#define _MARIADB_TIME_HPP_ - -#include -#include - -#include - -namespace mariadb { -/** - * Class representing SQL time - */ -class time { - public: - /** - * Construct time using given values - * - * @param hour Hours 0-23 - * @param minute Minutes 0-59 - * @param second Seconds 0-61 (for leap seconds) - * @param millisecond Milliseconds 0-999 - */ - time(u8 hour = 0, u8 minute = 0, u8 second = 0, u16 millisecond = 0); - - /** - * Copy constructor - * - * @param t Time to copy from - */ - time(const time& t); - - /** - * Construct time from time.h functions - * - * @param time_struct Timestruct to copy from - */ - time(const tm& time_struct); - - /** - * Construct time from time.h functions - * - * @param time Timestruct to copy from - */ - time(const time_t& time); - - /** - * Construct time from SQL time - * - * @param time SQL time to copy from - */ - time(const MYSQL_TIME& time); - - /** - * Construct time from string - * The format needs to be hh[:mm][:ss][:nnn] - * where less digits are possible and the delimiter may be any non digit - * - * @param t String containing time representation - */ - time(const std::string& t); - - /** - * Allow proper destruction in derived classes - */ - virtual ~time() = default; - - /** - * Compare this instance to given instance - * - * @param t Time to compare to - * @return 1 if this instance is greater, -1 if t is greater, 0 on equality - */ - int compare(const time& t) const; - - /** - * Assigns a value to this instance - */ - time& operator=(const time& t); - - /** - * Checks for equality - */ - bool operator==(const time& t) const; - - /** - * Checks for unequality - */ - bool operator!=(const time& t) const; - - /** - * Checks if this instance is lesser than t - */ - bool operator<(const time& t) const; - - /** - * Checks if this instance is lesser or equal to t - */ - bool operator<=(const time& t) const; - - /** - * Checks if this instance is greater than t - */ - bool operator>(const time& t) const; - - /** - * Checks if this instance is greater or equal to t - */ - bool operator>=(const time& t) const; - - /** - * Get the current hour 0-23 - */ - u8 hour() const; - - /** - * Set the current hour 0-23 - */ - u8 hour(u8 hour); - - /** - * Get the current minute 0-59 - */ - u8 minute() const; - - /** - * Set the current minute 0-59 - */ - u8 minute(u8 minute); - - /** - * Get the current second 0-61 (leap second possible) - */ - u8 second() const; - - /** - * Set the current second 0-61 (leap second possible) - */ - u8 second(u8 second); - - /** - * Get the current millisecond 0-999 - */ - u16 millisecond() const; - - /** - * Set the current millisecond 0-999 - */ - u16 millisecond(u16 millisecond); - - /** - * Set the time from string - * The format needs to be hh[:mm][:ss][.nnn] - * where less digits are possible and the delimiter may be any non digit - * - * Examples: - * h - * h:mm.s?n - * hh,mm!ss-n - * - * @return True on success - */ - virtual bool set(const std::string& t); - - /** - * Set the time from given values - * - * @param hour Hour to set - * @param minute Minute to set - * @param second Second to set - * @param millisecond Milliseconds to set - * @return True on success - */ - bool set(u8 hour, u8 minute, u8 second, u16 millisecond); - - /** - * Adds a certain amount of hours to the current time. Negative values subtract hours - * - * @param hours Number of hours to add - * @return Time containing sum - */ - time add_hours(s32 hours) const; - - /** - * Adds a certain amount of minutes to the current time. Negative values subtract minutes - * - * @param minutes Number of minutes to add - * @return Time containing sum - */ - time add_minutes(s32 minutes) const; - - /** - * Adds a certain amount of seconds to the current time. Negative values subtract seconds - * - * @param minutes Number of seconds to add - * @return Time containing sum - */ - time add_seconds(s32 seconds) const; - - /** - * Adds a certain amount of milliseconds to the current time. Negative values subtract - * milliseconds - * - * @param minutes Number of milliseconds to add - * @return Time containing sum - */ - time add_milliseconds(s32 milliseconds) const; - - /** - * Subtracts the given timespan from the current time - * - * @param dur A duration to subtract - * @return Time containing result - */ - time subtract(const time_span& dur) const; - - /** - * Adds the given timespan to the current time - * - * @param dur A duration to add - * @return Time containing sum - */ - time add(const time_span& dur) const; - - /** - * Calculates the timespan between the current time instance and given instance t - * - * @param t Time to calculate the duration between - * @return Timespan containing the duration - */ - time_span time_between(const time& t) const; - - /** - * Converts the time to time_t (time.h representation) - * - * @return Time as time.h time_t - */ - time_t mktime() const; - - /** - * Calculates the time difference using ::difftime. - * Calculates (this - t) - * - * @return Difference in seconds as double - */ - double diff_time(const time& t) const; - - /** - * Indicates whether this time is considered valid - * - * @return True if time is valid - */ - virtual bool is_valid() const; - - /** - * Indicates whether a given time is valid in terms of limits. Accounts for leap seconds - * - * @param hour Hour to check - * @param minute Minute to check - * @param second Second to check - * @param millisecond Milliseconds to check - * @return True if valid - */ - static bool valid_time(u8 hour, u8 minute, u8 second, u16 millisecond); - - /** - * Converts the time to MySQL time representation. Note that MySQL time does not support - * milliseconds - * - * @return Time as MYSQL_TIME with no milliseconds - */ - MYSQL_TIME mysql_time() const; - - /** - * Converts the time to a string with the format hh:mm:ss[.nnn] - * - * @param with_millisecond Indicates if milliseconds should be printed or not. - * - * @return String representing time with optional milliseconds - */ - const std::string str_time(bool with_millisecond = false) const; - - /** - * Uses time.h to determine the current time in the local timezone. - * - * @return Time representing now - */ - static time now(); - - /** - * Uses time.h to determine the current time in UTC timezone. - * - * @return Time representing now in UTC - */ - static time now_utc(); - - protected: - u8 m_hour; - u8 m_minute; - u8 m_second; - u16 m_millisecond; -}; - -std::ostream& operator<<(std::ostream& os, const time& t); -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/time_span.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/time_span.hpp deleted file mode 100644 index bbbb5f1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/time_span.hpp +++ /dev/null @@ -1,204 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_TIME_SPAN_HPP_ -#define _MARIADB_TIME_SPAN_HPP_ - -#include -#include - -namespace mariadb { -class time_span { - public: - /** - * Construct time_span from given data. Note that a time_span can span one day at most. - * - * @param hours Number of hours 0-23 - * @param minutes Number of minutes 0-59 - * @param seconds Number of seconds 0-59 - * @param milliseconds Number of milliseconds 0-999 - * @param negative Indicates negative timespan - */ - time_span(u32 days = 0, u8 hours = 0, u8 minutes = 0, u8 seconds = 0, u16 milliseconds = 0, - bool negative = false); - - /** - * Copy constructor - * - * @param dur Timespan to copy from - */ - time_span(const time_span& dur); - - /** - * Compares this timespan with the given timespan. - * - * @param rhs Timespan to compare this to - * @return 1 if this is greater, 0 if equal, -1 if this is smaller - */ - int compare(const time_span& rhs) const; - - time_span& operator=(const time_span& rhs); - bool operator==(const time_span& rhs) const; - bool operator!=(const time_span& rhs) const; - bool operator<(const time_span& rhs) const; - bool operator<=(const time_span& rhs) const; - bool operator>(const time_span& rhs) const; - bool operator>=(const time_span& rhs) const; - - /** - * Set the value of this time_span to given values - * - * @param days Any number of days - * @param hours Number of hours 0-23 - * @param minutes Number of minutes 0-59 - * @param seconds Number of seconds 0-59 - * @param milliseconds Number of milliseconds 0-999 - * @param negative Indicates negative timespan - */ - void set(u32 days = 0, u8 hours = 0, u8 minutes = 0, u8 seconds = 0, u16 milliseconds = 0, - bool negative = false); - - /** - * Indicates whether this time_span is zero. That is only true if all components are zero - * - * @return True if zero - */ - bool zero() const; - - /** - * Indicates whether this time_span is negative. - * - * @return True if negative - */ - bool negative() const; - - /** - * Sets negative flag on this time_span - * - * @param negative Value to set - * @return Newly set value - */ - bool negative(bool negative); - - /** - * Get number of days - * - * @return Number of days - */ - u32 days() const; - - /** - * Sets the number of days - * - * @param hour Number of days to set - * @return Newly set value - */ - u32 days(u32 day); - - /** - * Get number of hours - * - * @return Number of hours - */ - u8 hours() const; - - /** - * Sets the number of hours - * - * @param hour Number of hours to set - * @return Newly set value - */ - u8 hours(u8 hour); - - /** - * Get number of hours - * - * @return Number of hours - */ - u8 minutes() const; - - /** - * Sets the number of minutes - * - * @param minute Number of minutes to set - * @return Newly set value - */ - u8 minutes(u8 minute); - - /** - * Get number of seconds - * - * @return Number of seconds - */ - u8 seconds() const; - - /** - * Sets the number of seconds - * - * @param second Number of seconds to set - * @return Newly set value - */ - u8 seconds(u8 second); - - /** - * Get number of milliseconds - * - * @return Number of milliseconds - */ - u16 milliseconds() const; - - /** - * Sets the number of milliseconds - * - * @param millisecond Number of milliseconds to set - * @return Newly set value - */ - u16 milliseconds(u16 millisecond); - - /** - * Converts the time_span to minutes - * - * @return Total number of minutes in this time_span - */ - u64 total_hours() const; - - /** - * Converts the time_span to minutes - * - * @return Total number of minutes in this time_span - */ - u64 total_minutes() const; - - /** - * Converts the time_span to seconds - * - * @return Total number of seconds in this time_span - */ - u64 total_seconds() const; - - /** - * Converts the time_span to milliseconds - * - * @return Total number of milliseconds in this time_span - */ - u64 total_milliseconds() const; - - private: - bool m_negative = false; - u32 m_days = 0; - u8 m_hours = 0; - u8 m_minutes = 0; - u8 m_seconds = 0; - u16 m_milliseconds = 0; -}; - -std::ostream& operator<<(std::ostream& os, const time_span& ts); -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/transaction.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/transaction.hpp deleted file mode 100644 index f44b875..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/transaction.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_TRANSACTION_HPP_ -#define _MARIADB_TRANSACTION_HPP_ - -#include -#include -#include -#include - -namespace mariadb { -class connection; -class save_point; - -/** - * Class representing a SQL transaction having automatic rollback functionality - */ -class transaction { - friend class connection; - friend class save_point; - - public: - /** - * Destructor initiates automatic rollback if changes were not committed - */ - virtual ~transaction(); - - /** - * Commits the changes, releases all savepoints - */ - void commit(); - - /** - * Create named savepoint - * Note: only valid until the transaction is destroyed or committed - * - * @return Reference to a unique new savepoint - */ - save_point_ref create_save_point(); - - private: - /** - * Create a transaction with given isolation level and snapshot setting - * - * @param conn Connection to start transaction on - * @param level Level of database isolation to use - * @param consistent_snapshot Controls whether the transaction needs a consistent snapshot on - * creation - */ - transaction(connection* conn, isolation::level level, bool consistent_snapshot); - - /** - * Removes a savepoint from the list of savepoints - * - * @param sv_point savepoint to remove - */ - void remove_save_point(save_point* sv_point); - - /** - * Cleans up the transaction, releases all savepoints - */ - void cleanup(); - - private: - // parent connection pointer - connection* m_connection; - // list of created savepoints for this transaction - std::vector m_save_points; -}; - -typedef std::shared_ptr transaction_ref; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mariadb++/types.hpp b/VCMP-LUA/modules/mariadb/include/mariadb++/types.hpp deleted file mode 100644 index 2abe393..0000000 --- a/VCMP-LUA/modules/mariadb/include/mariadb++/types.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_TYPES_HPP_ -#define _MARIADB_TYPES_HPP_ - -#include -#include - -namespace mariadb { - // - // Default types - // - typedef unsigned char u8; - typedef unsigned short u16; - typedef unsigned int u32; - typedef signed char s8; - typedef signed short s16; - typedef signed int s32; - typedef float f32; - typedef double f64; - typedef long double f128; - - #if defined(_MSC_VER) || defined(__BORLANDC__) - typedef unsigned __int64 u64; - typedef signed __int64 s64; - #else - typedef unsigned long long u64; - typedef signed long long s64; - #endif - - typedef u64 handle; - - // - // Value type - // - namespace value { - enum type { - null = 0, - blob, - data, - date, - date_time, - time, - string, - boolean, - decimal, - unsigned8, - signed8, - unsigned16, - signed16, - unsigned32, - signed32, - unsigned64, - signed64, - float32, - double64, - enumeration - }; - } - - // - // Isolation level - // - namespace isolation { - enum level { repeatable_read = 0, read_committed, read_uncommitted, serializable }; - } - - // - // Stream - // - typedef std::shared_ptr stream_ref; -} - -#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID > 80000 -// Assume MySQL Community 8.0+ -typedef bool my_bool; -#endif - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/errmsg.h b/VCMP-LUA/modules/mariadb/include/mysql/errmsg.h deleted file mode 100644 index 7ca3238..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/errmsg.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - 2012-2016 SkySQL AB, MariaDB Corporation AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02111-1301, USA */ - -/* Error messages for mysql clients */ -/* error messages for the demon is in share/language/errmsg.sys */ -#ifndef _errmsg_h_ -#define _errmsg_h_ - -#ifdef __cplusplus -extern "C" { -#endif -void init_client_errs(void); -extern const char *client_errors[]; /* Error messages */ -extern const char *mariadb_client_errors[]; /* Error messages */ -#ifdef __cplusplus -} -#endif - - - -#define CR_MIN_ERROR 2000 /* For easier client code */ -#define CR_MAX_ERROR 2999 -#define CER_MIN_ERROR 5000 -#define CER_MAX_ERROR 5999 -#define CER(X) mariadb_client_errors[(X)-CER_MIN_ERROR] -#define ER(X) client_errors[(X)-CR_MIN_ERROR] -#define CLIENT_ERRMAP 2 /* Errormap used by ma_error() */ - -#define CR_UNKNOWN_ERROR 2000 -#define CR_SOCKET_CREATE_ERROR 2001 -#define CR_CONNECTION_ERROR 2002 -#define CR_CONN_HOST_ERROR 2003 /* never sent to a client, message only */ -#define CR_IPSOCK_ERROR 2004 -#define CR_UNKNOWN_HOST 2005 -#define CR_SERVER_GONE_ERROR 2006 /* disappeared _between_ queries */ -#define CR_VERSION_ERROR 2007 -#define CR_OUT_OF_MEMORY 2008 -#define CR_WRONG_HOST_INFO 2009 -#define CR_LOCALHOST_CONNECTION 2010 -#define CR_TCP_CONNECTION 2011 -#define CR_SERVER_HANDSHAKE_ERR 2012 -#define CR_SERVER_LOST 2013 /* disappeared _during_ a query */ -#define CR_COMMANDS_OUT_OF_SYNC 2014 -#define CR_NAMEDPIPE_CONNECTION 2015 -#define CR_NAMEDPIPEWAIT_ERROR 2016 -#define CR_NAMEDPIPEOPEN_ERROR 2017 -#define CR_NAMEDPIPESETSTATE_ERROR 2018 -#define CR_CANT_READ_CHARSET 2019 -#define CR_NET_PACKET_TOO_LARGE 2020 -#define CR_SSL_CONNECTION_ERROR 2026 -#define CR_MALFORMED_PACKET 2027 -#define CR_NO_PREPARE_STMT 2030 -#define CR_PARAMS_NOT_BOUND 2031 -#define CR_INVALID_PARAMETER_NO 2034 -#define CR_INVALID_BUFFER_USE 2035 -#define CR_UNSUPPORTED_PARAM_TYPE 2036 - -#define CR_SHARED_MEMORY_CONNECTION 2037 -#define CR_SHARED_MEMORY_CONNECT_ERROR 2038 - -#define CR_CONN_UNKNOWN_PROTOCOL 2047 -#define CR_SECURE_AUTH 2049 -#define CR_NO_DATA 2051 -#define CR_NO_STMT_METADATA 2052 -#define CR_NOT_IMPLEMENTED 2054 -#define CR_SERVER_LOST_EXTENDED 2055 /* never sent to a client, message only */ -#define CR_STMT_CLOSED 2056 -#define CR_NEW_STMT_METADATA 2057 -#define CR_ALREADY_CONNECTED 2058 -#define CR_AUTH_PLUGIN_CANNOT_LOAD 2059 -#define CR_DUPLICATE_CONNECTION_ATTR 2060 -#define CR_AUTH_PLUGIN_ERR 2061 -/* Always last, if you add new error codes please update the - value for CR_MYSQL_LAST_ERROR */ -#define CR_MYSQL_LAST_ERROR CR_AUTH_PLUGIN_ERR - -/* - * MariaDB Connector/C errors: - */ -#define CR_EVENT_CREATE_FAILED 5000 -#define CR_BIND_ADDR_FAILED 5001 -#define CR_ASYNC_NOT_SUPPORTED 5002 -#define CR_FUNCTION_NOT_SUPPORTED 5003 -#define CR_FILE_NOT_FOUND 5004 -#define CR_FILE_READ 5005 -#define CR_BULK_WITHOUT_PARAMETERS 5006 -#define CR_INVALID_STMT 5007 -#define CR_VERSION_MISMATCH 5008 -/* Always last, if you add new error codes please update the - value for CR_MARIADB_LAST_ERROR */ -#define CR_MARIADB_LAST_ERROR CR_VERSION_MISMATCH -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/ma_list.h b/VCMP-LUA/modules/mariadb/include/mysql/ma_list.h deleted file mode 100644 index ccd2bbd..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/ma_list.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02111-1301, USA */ - -#ifndef _list_h_ -#define _list_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct st_list { - struct st_list *prev,*next; - void *data; -} LIST; - -typedef int (*list_walk_action)(void *,void *); - -extern LIST *list_add(LIST *root,LIST *element); -extern LIST *list_delete(LIST *root,LIST *element); -extern LIST *list_cons(void *data,LIST *root); -extern LIST *list_reverse(LIST *root); -extern void list_free(LIST *root,unsigned int free_data); -extern unsigned int list_length(LIST *list); -extern int list_walk(LIST *list,list_walk_action action,char * argument); - -#define list_rest(a) ((a)->next) -#define list_push(a,b) (a)=list_cons((b),(a)) -#define list_pop(A) do {LIST *old=(A); (A)=list_delete(old,old) ; ma_free((char *) old,MYF(MY_FAE)); } while(0) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/ma_pvio.h b/VCMP-LUA/modules/mariadb/include/mysql/ma_pvio.h deleted file mode 100644 index 05a0748..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/ma_pvio.h +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef _ma_pvio_h_ -#define _ma_pvio_h_ -#define cio_defined - -#ifdef HAVE_TLS -#include -#else -#define MARIADB_TLS void -#endif - -/* CONC-492: Allow to buuld plugins outside of MariaDB Connector/C - source tree wnen ma_global.h was not included. */ -#if !defined(_global_h) && !defined(MY_GLOBAL_INCLUDED) -typedef unsigned char uchar; -#endif - -#define PVIO_SET_ERROR if (pvio->set_error) \ - pvio->set_error - -#define PVIO_READ_AHEAD_CACHE_SIZE 16384 -#define PVIO_READ_AHEAD_CACHE_MIN_SIZE 2048 -#define PVIO_EINTR_TRIES 2 - -struct st_ma_pvio_methods; -typedef struct st_ma_pvio_methods PVIO_METHODS; - -#define IS_PVIO_ASYNC(a) \ - ((a)->mysql && (a)->mysql->options.extension && (a)->mysql->options.extension->async_context) - -#define IS_PVIO_ASYNC_ACTIVE(a) \ - (IS_PVIO_ASYNC(a)&& (a)->mysql->options.extension->async_context->active) - -#define IS_MYSQL_ASYNC(a) \ - ((a)->options.extension && (a)->options.extension->async_context) - -#define IS_MYSQL_ASYNC_ACTIVE(a) \ - (IS_MYSQL_ASYNC(a)&& (a)->options.extension->async_context->active) - -enum enum_pvio_timeout { - PVIO_CONNECT_TIMEOUT= 0, - PVIO_READ_TIMEOUT, - PVIO_WRITE_TIMEOUT -}; - -enum enum_pvio_io_event -{ - VIO_IO_EVENT_READ, - VIO_IO_EVENT_WRITE, - VIO_IO_EVENT_CONNECT -}; - -enum enum_pvio_type { - PVIO_TYPE_UNIXSOCKET= 0, - PVIO_TYPE_SOCKET, - PVIO_TYPE_NAMEDPIPE, - PVIO_TYPE_SHAREDMEM, -}; - -enum enum_pvio_operation { - PVIO_READ= 0, - PVIO_WRITE=1 -}; - -#define SHM_DEFAULT_NAME "MYSQL" - -struct st_pvio_callback; - -typedef struct st_pvio_callback { - void (*callback)(MYSQL *mysql, uchar *buffer, size_t size); - struct st_pvio_callback *next; -} PVIO_CALLBACK; - -struct st_ma_pvio { - void *data; - /* read ahead cache */ - uchar *cache; - uchar *cache_pos; - size_t cache_size; - enum enum_pvio_type type; - int timeout[3]; - int ssl_type; /* todo: change to enum (ssl plugins) */ - MARIADB_TLS *ctls; - MYSQL *mysql; - PVIO_METHODS *methods; - void (*set_error)(MYSQL *mysql, unsigned int error_nr, const char *sqlstate, const char *format, ...); - void (*callback)(MARIADB_PVIO *pvio, my_bool is_read, const uchar *buffer, size_t length); -}; - -typedef struct st_ma_pvio_cinfo -{ - const char *host; - const char *unix_socket; - int port; - enum enum_pvio_type type; - MYSQL *mysql; -} MA_PVIO_CINFO; - -struct st_ma_pvio_methods -{ - my_bool (*set_timeout)(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout); - int (*get_timeout)(MARIADB_PVIO *pvio, enum enum_pvio_timeout type); - ssize_t (*read)(MARIADB_PVIO *pvio, uchar *buffer, size_t length); - ssize_t (*async_read)(MARIADB_PVIO *pvio, uchar *buffer, size_t length); - ssize_t (*write)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); - ssize_t (*async_write)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); - int (*wait_io_or_timeout)(MARIADB_PVIO *pvio, my_bool is_read, int timeout); - int (*blocking)(MARIADB_PVIO *pvio, my_bool value, my_bool *old_value); - my_bool (*connect)(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo); - my_bool (*close)(MARIADB_PVIO *pvio); - int (*fast_send)(MARIADB_PVIO *pvio); - int (*keepalive)(MARIADB_PVIO *pvio); - my_bool (*get_handle)(MARIADB_PVIO *pvio, void *handle); - my_bool (*is_blocking)(MARIADB_PVIO *pvio); - my_bool (*is_alive)(MARIADB_PVIO *pvio); - my_bool (*has_data)(MARIADB_PVIO *pvio, ssize_t *data_len); - int(*shutdown)(MARIADB_PVIO *pvio); -}; - -/* Function prototypes */ -MARIADB_PVIO *ma_pvio_init(MA_PVIO_CINFO *cinfo); -void ma_pvio_close(MARIADB_PVIO *pvio); -ssize_t ma_pvio_cache_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length); -ssize_t ma_pvio_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length); -ssize_t ma_pvio_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); -int ma_pvio_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type); -my_bool ma_pvio_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout); -int ma_pvio_fast_send(MARIADB_PVIO *pvio); -int ma_pvio_keepalive(MARIADB_PVIO *pvio); -my_socket ma_pvio_get_socket(MARIADB_PVIO *pvio); -my_bool ma_pvio_is_blocking(MARIADB_PVIO *pvio); -my_bool ma_pvio_blocking(MARIADB_PVIO *pvio, my_bool block, my_bool *previous_mode); -my_bool ma_pvio_is_blocking(MARIADB_PVIO *pvio); -int ma_pvio_wait_io_or_timeout(MARIADB_PVIO *pvio, my_bool is_read, int timeout); -my_bool ma_pvio_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo); -my_bool ma_pvio_is_alive(MARIADB_PVIO *pvio); -my_bool ma_pvio_get_handle(MARIADB_PVIO *pvio, void *handle); -my_bool ma_pvio_has_data(MARIADB_PVIO *pvio, ssize_t *length); - -#endif /* _ma_pvio_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/ma_tls.h b/VCMP-LUA/modules/mariadb/include/mysql/ma_tls.h deleted file mode 100644 index 9ce49e7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/ma_tls.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef _ma_tls_h_ -#define _ma_tls_h_ - -enum enum_pvio_tls_type { - SSL_TYPE_DEFAULT=0, -#ifdef _WIN32 - SSL_TYPE_SCHANNEL, -#endif - SSL_TYPE_OPENSSL, - SSL_TYPE_GNUTLS -}; - -#define PROTOCOL_SSLV3 0 -#define PROTOCOL_TLS_1_0 1 -#define PROTOCOL_TLS_1_1 2 -#define PROTOCOL_TLS_1_2 3 -#define PROTOCOL_TLS_1_3 4 -#define PROTOCOL_UNKNOWN 5 -#define PROTOCOL_MAX PROTOCOL_TLS_1_3 - -#define TLS_VERSION_LENGTH 64 -extern char tls_library_version[TLS_VERSION_LENGTH]; - -typedef struct st_ma_pvio_tls { - void *data; - MARIADB_PVIO *pvio; - void *ssl; -} MARIADB_TLS; - -/* Function prototypes */ - -/* ma_tls_start - initializes the ssl library - Parameter: - errmsg pointer to error message buffer - errmsg_len length of error message buffer - Returns: - 0 success - 1 if an error occurred - Notes: - On success the global variable ma_tls_initialized will be set to 1 -*/ -int ma_tls_start(char *errmsg, size_t errmsg_len); - -/* ma_tls_end - unloads/deinitializes ssl library and unsets global variable - ma_tls_initialized -*/ -void ma_tls_end(void); - -/* ma_tls_init - creates a new SSL structure for a SSL connection and loads - client certificates - - Parameters: - MYSQL a mysql structure - Returns: - void * a pointer to internal SSL structure -*/ -void * ma_tls_init(MYSQL *mysql); - -/* ma_tls_connect - performs SSL handshake - Parameters: - MARIADB_TLS MariaDB SSL container - Returns: - 0 success - 1 error -*/ -my_bool ma_tls_connect(MARIADB_TLS *ctls); - -/* ma_tls_read - reads up to length bytes from socket - Parameters: - ctls MariaDB SSL container - buffer read buffer - length buffer length - Returns: - 0-n bytes read - -1 if an error occurred -*/ -ssize_t ma_tls_read(MARIADB_TLS *ctls, const uchar* buffer, size_t length); - -/* ma_tls_write - write buffer to socket - Parameters: - ctls MariaDB SSL container - buffer write buffer - length buffer length - Returns: - 0-n bytes written - -1 if an error occurred -*/ -ssize_t ma_tls_write(MARIADB_TLS *ctls, const uchar* buffer, size_t length); - -/* ma_tls_close - closes SSL connection and frees SSL structure which was previously - created by ma_tls_init call - Parameters: - MARIADB_TLS MariaDB SSL container - Returns: - 0 success - 1 error -*/ -my_bool ma_tls_close(MARIADB_TLS *ctls); - -/* ma_tls_verify_server_cert - validation check of server certificate - Parameter: - MARIADB_TLS MariaDB SSL container - Returns: - ß success - 1 error -*/ -int ma_tls_verify_server_cert(MARIADB_TLS *ctls); - -/* ma_tls_get_cipher - returns cipher for current ssl connection - Parameter: - MARIADB_TLS MariaDB SSL container - Returns: - cipher in use or - NULL on error -*/ -const char *ma_tls_get_cipher(MARIADB_TLS *ssl); - -/* ma_tls_get_finger_print - returns SHA1 finger print of server certificate - Parameter: - MARIADB_TLS MariaDB SSL container - fp buffer for fingerprint - fp_len buffer length - Returns: - actual size of finger print -*/ -unsigned int ma_tls_get_finger_print(MARIADB_TLS *ctls, char *fp, unsigned int fp_len); - -/* ma_tls_get_protocol_version - returns protocol version number in use - Parameter: - MARIADB_TLS MariaDB SSL container - Returns: - protocol number -*/ -int ma_tls_get_protocol_version(MARIADB_TLS *ctls); -const char *ma_pvio_tls_get_protocol_version(MARIADB_TLS *ctls); -int ma_pvio_tls_get_protocol_version_id(MARIADB_TLS *ctls); - -/* Function prototypes */ -MARIADB_TLS *ma_pvio_tls_init(MYSQL *mysql); -my_bool ma_pvio_tls_connect(MARIADB_TLS *ctls); -ssize_t ma_pvio_tls_read(MARIADB_TLS *ctls, const uchar *buffer, size_t length); -ssize_t ma_pvio_tls_write(MARIADB_TLS *ctls, const uchar *buffer, size_t length); -my_bool ma_pvio_tls_close(MARIADB_TLS *ctls); -int ma_pvio_tls_verify_server_cert(MARIADB_TLS *ctls); -const char *ma_pvio_tls_cipher(MARIADB_TLS *ctls); -my_bool ma_pvio_tls_check_fp(MARIADB_TLS *ctls, const char *fp, const char *fp_list); -my_bool ma_pvio_start_ssl(MARIADB_PVIO *pvio); -void ma_pvio_tls_end(); - -#endif /* _ma_tls_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mariadb/ma_io.h b/VCMP-LUA/modules/mariadb/include/mysql/mariadb/ma_io.h deleted file mode 100644 index d39fc06..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mariadb/ma_io.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 2015 MariaDB Corporation AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02111-1301, USA */ - -#ifndef _ma_io_h_ -#define _ma_io_h_ - - -#ifdef HAVE_REMOTEIO -#include -#endif - -enum enum_file_type { - MA_FILE_NONE=0, - MA_FILE_LOCAL=1, - MA_FILE_REMOTE=2 -}; - -typedef struct -{ - enum enum_file_type type; - void *ptr; -} MA_FILE; - -#ifdef HAVE_REMOTEIO -struct st_rio_methods { - MA_FILE *(*mopen)(const char *url, const char *mode); - int (*mclose)(MA_FILE *ptr); - int (*mfeof)(MA_FILE *file); - size_t (*mread)(void *ptr, size_t size, size_t nmemb, MA_FILE *file); - char * (*mgets)(char *ptr, size_t size, MA_FILE *file); -}; -#endif - -/* function prototypes */ -MA_FILE *ma_open(const char *location, const char *mode, MYSQL *mysql); -int ma_close(MA_FILE *file); -int ma_feof(MA_FILE *file); -size_t ma_read(void *ptr, size_t size, size_t nmemb, MA_FILE *file); -char *ma_gets(char *ptr, size_t size, MA_FILE *file); - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_com.h b/VCMP-LUA/modules/mariadb/include/mysql/mariadb_com.h deleted file mode 100644 index a1b99a8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_com.h +++ /dev/null @@ -1,466 +0,0 @@ -/************************************************************************************ - Copyright (C) 2000, 2012 MySQL AB & MySQL Finland AB & TCX DataKonsult AB, - Monty Program AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not see - or write to the Free Software Foundation, Inc., - 51 Franklin St., Fifth Floor, Boston, MA 02110, USA - - Part of this code includes code from the PHP project which - is freely available from http://www.php.net -*************************************************************************************/ - -/* -** Common definition between mysql server & client -*/ - -#ifndef _mysql_com_h -#define _mysql_com_h - - -#define NAME_CHAR_LEN 64 -#define NAME_LEN 256 /* Field/table name length */ -#define HOSTNAME_LENGTH 60 -#define SYSTEM_MB_MAX_CHAR_LENGTH 4 -#define USERNAME_CHAR_LENGTH 128 -#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH * SYSTEM_MB_MAX_CHAR_LENGTH) -#define SERVER_VERSION_LENGTH 60 -#define SQLSTATE_LENGTH 5 -#define SCRAMBLE_LENGTH 20 -#define SCRAMBLE_LENGTH_323 8 - -#define LOCAL_HOST "localhost" -#define LOCAL_HOST_NAMEDPIPE "." - -#if defined(_WIN32) && !defined( _CUSTOMCONFIG_) -#define MARIADB_NAMEDPIPE "MySQL" -#define MYSQL_SERVICENAME "MySql" -#endif /* _WIN32 */ - -/* for use in mysql client tools only */ -#define MYSQL_AUTODETECT_CHARSET_NAME "auto" -#define BINCMP_FLAG 131072 - -enum mysql_enum_shutdown_level -{ - SHUTDOWN_DEFAULT = 0, - KILL_QUERY= 254, - KILL_CONNECTION= 255 -}; - -enum enum_server_command -{ - COM_SLEEP = 0, - COM_QUIT, - COM_INIT_DB, - COM_QUERY, - COM_FIELD_LIST, - COM_CREATE_DB, - COM_DROP_DB, - COM_REFRESH, - COM_SHUTDOWN, - COM_STATISTICS, - COM_PROCESS_INFO, - COM_CONNECT, - COM_PROCESS_KILL, - COM_DEBUG, - COM_PING, - COM_TIME = 15, - COM_DELAYED_INSERT, - COM_CHANGE_USER, - COM_BINLOG_DUMP, - COM_TABLE_DUMP, - COM_CONNECT_OUT = 20, - COM_REGISTER_SLAVE, - COM_STMT_PREPARE = 22, - COM_STMT_EXECUTE = 23, - COM_STMT_SEND_LONG_DATA = 24, - COM_STMT_CLOSE = 25, - COM_STMT_RESET = 26, - COM_SET_OPTION = 27, - COM_STMT_FETCH = 28, - COM_DAEMON= 29, - COM_UNSUPPORTED= 30, - COM_RESET_CONNECTION = 31, - COM_STMT_BULK_EXECUTE = 250, - COM_RESERVED_1 = 254, /* former COM_MULTI, now removed */ - COM_END -}; - - -#define NOT_NULL_FLAG 1 /* Field can't be NULL */ -#define PRI_KEY_FLAG 2 /* Field is part of a primary key */ -#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */ -#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */ -#define BLOB_FLAG 16 /* Field is a blob */ -#define UNSIGNED_FLAG 32 /* Field is unsigned */ -#define ZEROFILL_FLAG 64 /* Field is zerofill */ -#define BINARY_FLAG 128 -/* The following are only sent to new clients */ -#define ENUM_FLAG 256 /* field is an enum */ -#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ -#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ -#define SET_FLAG 2048 /* field is a set */ -/* new since 3.23.58 */ -#define NO_DEFAULT_VALUE_FLAG 4096 /* Field doesn't have default value */ -#define ON_UPDATE_NOW_FLAG 8192 /* Field is set to NOW on UPDATE */ -/* end new */ -#define NUM_FLAG 32768 /* Field is num (for clients) */ -#define PART_KEY_FLAG 16384 /* Intern; Part of some key */ -#define GROUP_FLAG 32768 /* Intern: Group field */ -#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */ - -#define REFRESH_GRANT 1 /* Refresh grant tables */ -#define REFRESH_LOG 2 /* Start on new log file */ -#define REFRESH_TABLES 4 /* close all tables */ -#define REFRESH_HOSTS 8 /* Flush host cache */ -#define REFRESH_STATUS 16 /* Flush status variables */ -#define REFRESH_THREADS 32 /* Flush thread cache */ -#define REFRESH_SLAVE 64 /* Reset master info and restart slave - thread */ -#define REFRESH_MASTER 128 /* Remove all bin logs in the index - and truncate the index */ - -/* The following can't be set with mysql_refresh() */ -#define REFRESH_READ_LOCK 16384 /* Lock tables for read */ -#define REFRESH_FAST 32768 /* Intern flag */ - -#define CLIENT_MYSQL 1 -#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ -#define CLIENT_LONG_FLAG 4 /* Get all column flags */ -#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ -#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ -#define CLIENT_COMPRESS 32 /* Can use compression protocol */ -#define CLIENT_ODBC 64 /* Odbc client */ -#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ -#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ -#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ -#define CLIENT_SSL 2048 /* Switch to SSL after handshake */ -#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ -#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ -/* added in 4.x */ -#define CLIENT_PROTOCOL_41 512 -#define CLIENT_RESERVED 16384 -#define CLIENT_SECURE_CONNECTION 32768 -#define CLIENT_MULTI_STATEMENTS (1UL << 16) -#define CLIENT_MULTI_RESULTS (1UL << 17) -#define CLIENT_PS_MULTI_RESULTS (1UL << 18) -#define CLIENT_PLUGIN_AUTH (1UL << 19) -#define CLIENT_CONNECT_ATTRS (1UL << 20) -#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21) -#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) -#define CLIENT_SESSION_TRACKING (1UL << 23) -#define CLIENT_PROGRESS (1UL << 29) /* client supports progress indicator */ -#define CLIENT_PROGRESS_OBSOLETE CLIENT_PROGRESS -#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) -#define CLIENT_REMEMBER_OPTIONS (1UL << 31) - -/* MariaDB specific capabilities */ -#define MARIADB_CLIENT_FLAGS 0xFFFFFFFF00000000ULL -#define MARIADB_CLIENT_PROGRESS (1ULL << 32) -#define MARIADB_CLIENT_RESERVED_1 (1ULL << 33) /* Former COM_MULTI, don't use */ -#define MARIADB_CLIENT_STMT_BULK_OPERATIONS (1ULL << 34) -/* support of extended data type/format information, since 10.5.0 */ -#define MARIADB_CLIENT_EXTENDED_METADATA (1ULL << 35) - -#define IS_MARIADB_EXTENDED_SERVER(mysql)\ - (!(mysql->server_capabilities & CLIENT_MYSQL)) - -#define MARIADB_CLIENT_SUPPORTED_FLAGS (MARIADB_CLIENT_PROGRESS |\ - MARIADB_CLIENT_STMT_BULK_OPERATIONS|\ - MARIADB_CLIENT_EXTENDED_METADATA) - -#define CLIENT_SUPPORTED_FLAGS (CLIENT_MYSQL |\ - CLIENT_FOUND_ROWS |\ - CLIENT_LONG_FLAG |\ - CLIENT_CONNECT_WITH_DB |\ - CLIENT_NO_SCHEMA |\ - CLIENT_COMPRESS |\ - CLIENT_ODBC |\ - CLIENT_LOCAL_FILES |\ - CLIENT_IGNORE_SPACE |\ - CLIENT_INTERACTIVE |\ - CLIENT_SSL |\ - CLIENT_IGNORE_SIGPIPE |\ - CLIENT_TRANSACTIONS |\ - CLIENT_PROTOCOL_41 |\ - CLIENT_RESERVED |\ - CLIENT_SECURE_CONNECTION |\ - CLIENT_MULTI_STATEMENTS |\ - CLIENT_MULTI_RESULTS |\ - CLIENT_PROGRESS |\ - CLIENT_SSL_VERIFY_SERVER_CERT |\ - CLIENT_REMEMBER_OPTIONS |\ - CLIENT_PLUGIN_AUTH |\ - CLIENT_SESSION_TRACKING |\ - CLIENT_CONNECT_ATTRS) -#define CLIENT_CAPABILITIES (CLIENT_MYSQL | \ - CLIENT_LONG_FLAG |\ - CLIENT_TRANSACTIONS |\ - CLIENT_SECURE_CONNECTION |\ - CLIENT_MULTI_RESULTS | \ - CLIENT_PS_MULTI_RESULTS |\ - CLIENT_PROTOCOL_41 |\ - CLIENT_PLUGIN_AUTH |\ - CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \ - CLIENT_SESSION_TRACKING |\ - CLIENT_CONNECT_ATTRS) - -#define CLIENT_DEFAULT_FLAGS ((CLIENT_SUPPORTED_FLAGS & ~CLIENT_COMPRESS)\ - & ~CLIENT_SSL) - -#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ -#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ -#define SERVER_MORE_RESULTS_EXIST 8 -#define SERVER_QUERY_NO_GOOD_INDEX_USED 16 -#define SERVER_QUERY_NO_INDEX_USED 32 -#define SERVER_STATUS_CURSOR_EXISTS 64 -#define SERVER_STATUS_LAST_ROW_SENT 128 -#define SERVER_STATUS_DB_DROPPED 256 -#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512 -#define SERVER_STATUS_METADATA_CHANGED 1024 -#define SERVER_QUERY_WAS_SLOW 2048 -#define SERVER_PS_OUT_PARAMS 4096 -#define SERVER_STATUS_IN_TRANS_READONLY 8192 -#define SERVER_SESSION_STATE_CHANGED 16384 -#define SERVER_STATUS_ANSI_QUOTES 32768 - -#define MYSQL_ERRMSG_SIZE 512 -#define NET_READ_TIMEOUT 30 /* Timeout on read */ -#define NET_WRITE_TIMEOUT 60 /* Timeout on write */ -#define NET_WAIT_TIMEOUT (8*60*60) /* Wait for new query */ - -/* for server integration (mysqlbinlog) */ -#define LIST_PROCESS_HOST_LEN 64 -#define MYSQL50_TABLE_NAME_PREFIX "#mysql50#" -#define MYSQL50_TABLE_NAME_PREFIX_LENGTH (sizeof(MYSQL50_TABLE_NAME_PREFIX)-1) -#define SAFE_NAME_LEN (NAME_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH) - -struct st_ma_pvio; -typedef struct st_ma_pvio MARIADB_PVIO; - -#define MAX_CHAR_WIDTH 255 /* Max length for a CHAR column */ -#define MAX_BLOB_WIDTH 8192 /* Default width for blob */ - -/* the following defines were added for PHP's mysqli and pdo extensions: - see: CONC-56 -*/ -#define MAX_TINYINT_WIDTH 3 -#define MAX_SMALLINT_WIDTH 5 -#define MAX_MEDIUMINT_WIDTH 8 -#define MAX_INT_WIDTH 10 -#define MAX_BIGINT_WIDTH 20 - -struct st_ma_connection_plugin; - - -typedef struct st_net { - MARIADB_PVIO *pvio; - unsigned char *buff; - unsigned char *buff_end,*write_pos,*read_pos; - my_socket fd; /* For Perl DBI/dbd */ - unsigned long remain_in_buf,length; - unsigned long buf_length, where_b; - unsigned long max_packet, max_packet_size; - unsigned int pkt_nr, compress_pkt_nr; - unsigned int write_timeout, read_timeout, retry_count; - int fcntl; - unsigned int *return_status; - unsigned char reading_or_writing; - char save_char; - char unused_1; - my_bool unused_2; - my_bool compress; - my_bool unused_3; - void *unused_4; - unsigned int last_errno; - unsigned char error; - my_bool unused_5; - my_bool unused_6; - char last_error[MYSQL_ERRMSG_SIZE]; - char sqlstate[SQLSTATE_LENGTH+1]; - struct st_mariadb_net_extension *extension; -} NET; - -#define packet_error ((unsigned int) -1) - -/* used by mysql_set_server_option */ -enum enum_mysql_set_option -{ - MYSQL_OPTION_MULTI_STATEMENTS_ON, - MYSQL_OPTION_MULTI_STATEMENTS_OFF -}; - -enum enum_session_state_type -{ - SESSION_TRACK_SYSTEM_VARIABLES= 0, - SESSION_TRACK_SCHEMA, - SESSION_TRACK_STATE_CHANGE, - /* currently not supported by MariaDB Server */ - SESSION_TRACK_GTIDS, - SESSION_TRACK_TRANSACTION_CHARACTERISTICS, - SESSION_TRACK_TRANSACTION_STATE /* make sure that SESSION_TRACK_END always points - to last element of enum !! */ -}; - -#define SESSION_TRACK_BEGIN 0 -#define SESSION_TRACK_END SESSION_TRACK_TRANSACTION_STATE -#define SESSION_TRACK_TYPES (SESSION_TRACK_END + 1) - -/* SESSION_TRACK_TRANSACTION_TYPE was renamed to SESSION_TRACK_TRANSACTION_STATE - in 3e699a1738cdfb0a2c5b8eabfa8301b8d11cf711. - This is a workaround to prevent breaking of travis and buildbot tests. - TODO: Remove this after server fixes */ -#define SESSION_TRACK_TRANSACTION_TYPE SESSION_TRACK_TRANSACTION_STATE - -enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, - MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, - MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, - MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, - MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, - MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, - MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, - MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, - MYSQL_TYPE_BIT, - /* - the following types are not used by client, - only for mysqlbinlog!! - */ - MYSQL_TYPE_TIMESTAMP2, - MYSQL_TYPE_DATETIME2, - MYSQL_TYPE_TIME2, - /* --------------------------------------------- */ - MYSQL_TYPE_JSON=245, - MYSQL_TYPE_NEWDECIMAL=246, - MYSQL_TYPE_ENUM=247, - MYSQL_TYPE_SET=248, - MYSQL_TYPE_TINY_BLOB=249, - MYSQL_TYPE_MEDIUM_BLOB=250, - MYSQL_TYPE_LONG_BLOB=251, - MYSQL_TYPE_BLOB=252, - MYSQL_TYPE_VAR_STRING=253, - MYSQL_TYPE_STRING=254, - MYSQL_TYPE_GEOMETRY=255, - MAX_NO_FIELD_TYPES }; - -#define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compatibility */ -#define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compatibility */ -#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL -#define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL -#define FIELD_TYPE_TINY MYSQL_TYPE_TINY -#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT -#define FIELD_TYPE_LONG MYSQL_TYPE_LONG -#define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT -#define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE -#define FIELD_TYPE_NULL MYSQL_TYPE_NULL -#define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP -#define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG -#define FIELD_TYPE_INT24 MYSQL_TYPE_INT24 -#define FIELD_TYPE_DATE MYSQL_TYPE_DATE -#define FIELD_TYPE_TIME MYSQL_TYPE_TIME -#define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME -#define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR -#define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE -#define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM -#define FIELD_TYPE_SET MYSQL_TYPE_SET -#define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB -#define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB -#define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB -#define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB -#define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING -#define FIELD_TYPE_STRING MYSQL_TYPE_STRING -#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY -#define FIELD_TYPE_BIT MYSQL_TYPE_BIT - -extern unsigned long max_allowed_packet; -extern unsigned long net_buffer_length; - -#define net_new_transaction(net) ((net)->pkt_nr=0) - -int ma_net_init(NET *net, MARIADB_PVIO *pvio); -void ma_net_end(NET *net); -void ma_net_clear(NET *net); -int ma_net_flush(NET *net); -int ma_net_write(NET *net,const unsigned char *packet, size_t len); -int ma_net_write_command(NET *net,unsigned char command,const char *packet, - size_t len, my_bool disable_flush); -int ma_net_real_write(NET *net,const char *packet, size_t len); -extern unsigned long ma_net_read(NET *net); - -struct rand_struct { - unsigned long seed1,seed2,max_value; - double max_value_dbl; -}; - - /* The following is for user defined functions */ - -enum Item_result {STRING_RESULT,REAL_RESULT,INT_RESULT,ROW_RESULT,DECIMAL_RESULT}; - -typedef struct st_udf_args -{ - unsigned int arg_count; /* Number of arguments */ - enum Item_result *arg_type; /* Pointer to item_results */ - char **args; /* Pointer to argument */ - unsigned long *lengths; /* Length of string arguments */ - char *maybe_null; /* Set to 1 for all maybe_null args */ -} UDF_ARGS; - - /* This holds information about the result */ - -typedef struct st_udf_init -{ - my_bool maybe_null; /* 1 if function can return NULL */ - unsigned int decimals; /* for real functions */ - unsigned int max_length; /* For string functions */ - char *ptr; /* free pointer for function data */ - my_bool const_item; /* 0 if result is independent of arguments */ -} UDF_INIT; - -/* Connection types */ -#define MARIADB_CONNECTION_UNIXSOCKET 0 -#define MARIADB_CONNECTION_TCP 1 -#define MARIADB_CONNECTION_NAMEDPIPE 2 -#define MARIADB_CONNECTION_SHAREDMEM 3 - - /* Constants when using compression */ -#define NET_HEADER_SIZE 4 /* standard header size */ -#define COMP_HEADER_SIZE 3 /* compression header extra size */ - - /* Prototypes to password functions */ -#define native_password_plugin_name "mysql_native_password" -#define old_password_plugin_name "mysql_old_password" - -#ifdef __cplusplus -extern "C" { -#endif - -char *ma_scramble_323(char *to,const char *message,const char *password); -void ma_scramble_41(const unsigned char *buffer, const char *scramble, const char *password); -void ma_hash_password(unsigned long *result, const char *password, size_t len); -void ma_make_scrambled_password(char *to,const char *password); - -/* Some other useful functions */ - -void mariadb_load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv); -my_bool ma_thread_init(void); -void ma_thread_end(void); - -#ifdef __cplusplus -} -#endif - -#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_ctype.h b/VCMP-LUA/modules/mariadb/include/mysql/mariadb_ctype.h deleted file mode 100644 index bc65fcd..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_ctype.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02111-1301, USA */ - -/* - A better inplementation of the UNIX ctype(3) library. - Notes: my_global.h should be included before ctype.h -*/ - -#ifndef _mariadb_ctype_h -#define _mariadb_ctype_h - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define CHARSET_DIR "charsets/" -#define MY_CS_NAME_SIZE 32 - -#define MADB_DEFAULT_CHARSET_NAME "latin1" -#define MADB_DEFAULT_COLLATION_NAME "latin1_swedish_ci" -#define MADB_AUTODETECT_CHARSET_NAME "auto" - -/* we use the mysqlnd implementation */ -typedef struct ma_charset_info_st -{ - unsigned int nr; /* so far only 1 byte for charset */ - unsigned int state; - const char *csname; - const char *name; - const char *dir; - unsigned int codepage; - const char *encoding; - unsigned int char_minlen; - unsigned int char_maxlen; - unsigned int (*mb_charlen)(unsigned int c); - unsigned int (*mb_valid)(const char *start, const char *end); -} MARIADB_CHARSET_INFO; - -extern const MARIADB_CHARSET_INFO mariadb_compiled_charsets[]; -extern MARIADB_CHARSET_INFO *ma_default_charset_info; -extern MARIADB_CHARSET_INFO *ma_charset_bin; -extern MARIADB_CHARSET_INFO *ma_charset_latin1; -extern MARIADB_CHARSET_INFO *ma_charset_utf8_general_ci; -extern MARIADB_CHARSET_INFO *ma_charset_utf16le_general_ci; - -MARIADB_CHARSET_INFO *find_compiled_charset(unsigned int cs_number); -MARIADB_CHARSET_INFO *find_compiled_charset_by_name(const char *name); - -size_t mysql_cset_escape_quotes(const MARIADB_CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len); -size_t mysql_cset_escape_slashes(const MARIADB_CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len); -const char* madb_get_os_character_set(void); -#ifdef _WIN32 -int madb_get_windows_cp(const char *charset); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_dyncol.h b/VCMP-LUA/modules/mariadb/include/mysql/mariadb_dyncol.h deleted file mode 100644 index 216431a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_dyncol.h +++ /dev/null @@ -1,259 +0,0 @@ -/* Copyright (c) 2011, Monty Program Ab - Copyright (c) 2011, Oleksandr Byelkin - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -#ifndef ma_dyncol_h -#define ma_dyncol_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef LIBMARIADB -#include -#include -#endif -#include - -#ifndef longlong_defined -#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8 -typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ -typedef long long int longlong; -#else -typedef unsigned long ulonglong; /* ulong or unsigned long long */ -typedef long longlong; -#endif -#define longlong_defined -#endif - - -#ifndef _my_sys_h -typedef struct st_dynamic_string -{ - char *str; - size_t length,max_length,alloc_increment; -} DYNAMIC_STRING; -#endif - -struct st_mysql_lex_string -{ - char *str; - size_t length; -}; -typedef struct st_mysql_lex_string MYSQL_LEX_STRING; -typedef struct st_mysql_lex_string LEX_STRING; -/* - Limits of implementation -*/ -#define MAX_TOTAL_NAME_LENGTH 65535 -#define MAX_NAME_LENGTH (MAX_TOTAL_NAME_LENGTH/4) - -/* NO and OK is the same used just to show semantics */ -#define ER_DYNCOL_NO ER_DYNCOL_OK - -enum enum_dyncol_func_result -{ - ER_DYNCOL_OK= 0, - ER_DYNCOL_YES= 1, /* For functions returning 0/1 */ - ER_DYNCOL_FORMAT= -1, /* Wrong format of the encoded string */ - ER_DYNCOL_LIMIT= -2, /* Some limit reached */ - ER_DYNCOL_RESOURCE= -3, /* Out of resourses */ - ER_DYNCOL_DATA= -4, /* Incorrect input data */ - ER_DYNCOL_UNKNOWN_CHARSET= -5, /* Unknown character set */ - ER_DYNCOL_TRUNCATED= 2 /* OK, but data was truncated */ -}; - -typedef DYNAMIC_STRING DYNAMIC_COLUMN; - -enum enum_dynamic_column_type -{ - DYN_COL_NULL= 0, - DYN_COL_INT, - DYN_COL_UINT, - DYN_COL_DOUBLE, - DYN_COL_STRING, - DYN_COL_DECIMAL, - DYN_COL_DATETIME, - DYN_COL_DATE, - DYN_COL_TIME, - DYN_COL_DYNCOL -}; - -typedef enum enum_dynamic_column_type DYNAMIC_COLUMN_TYPE; - -struct st_dynamic_column_value -{ - DYNAMIC_COLUMN_TYPE type; - union - { - long long long_value; - unsigned long long ulong_value; - double double_value; - struct { - MYSQL_LEX_STRING value; - MARIADB_CHARSET_INFO *charset; - } string; -#ifndef LIBMARIADB - struct { - decimal_digit_t buffer[DECIMAL_BUFF_LENGTH]; - decimal_t value; - } decimal; -#endif - MYSQL_TIME time_value; - } x; -}; - -typedef struct st_dynamic_column_value DYNAMIC_COLUMN_VALUE; - -#ifdef MADYNCOL_DEPRECATED -enum enum_dyncol_func_result -dynamic_column_create(DYNAMIC_COLUMN *str, - uint column_nr, DYNAMIC_COLUMN_VALUE *value); - -enum enum_dyncol_func_result -dynamic_column_create_many(DYNAMIC_COLUMN *str, - uint column_count, - uint *column_numbers, - DYNAMIC_COLUMN_VALUE *values); -enum enum_dyncol_func_result -dynamic_column_update(DYNAMIC_COLUMN *org, uint column_nr, - DYNAMIC_COLUMN_VALUE *value); -enum enum_dyncol_func_result -dynamic_column_update_many(DYNAMIC_COLUMN *str, - uint add_column_count, - uint *column_numbers, - DYNAMIC_COLUMN_VALUE *values); - -enum enum_dyncol_func_result -dynamic_column_exists(DYNAMIC_COLUMN *org, uint column_nr); - -enum enum_dyncol_func_result -dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint); - -enum enum_dyncol_func_result -dynamic_column_get(DYNAMIC_COLUMN *org, uint column_nr, - DYNAMIC_COLUMN_VALUE *store_it_here); -#endif - -/* new functions */ -enum enum_dyncol_func_result -mariadb_dyncol_create_many_num(DYNAMIC_COLUMN *str, - uint column_count, - uint *column_numbers, - DYNAMIC_COLUMN_VALUE *values, - my_bool new_string); -enum enum_dyncol_func_result -mariadb_dyncol_create_many_named(DYNAMIC_COLUMN *str, - uint column_count, - MYSQL_LEX_STRING *column_keys, - DYNAMIC_COLUMN_VALUE *values, - my_bool new_string); - - -enum enum_dyncol_func_result -mariadb_dyncol_update_many_num(DYNAMIC_COLUMN *str, - uint add_column_count, - uint *column_keys, - DYNAMIC_COLUMN_VALUE *values); -enum enum_dyncol_func_result -mariadb_dyncol_update_many_named(DYNAMIC_COLUMN *str, - uint add_column_count, - MYSQL_LEX_STRING *column_keys, - DYNAMIC_COLUMN_VALUE *values); - - -enum enum_dyncol_func_result -mariadb_dyncol_exists_num(DYNAMIC_COLUMN *org, uint column_nr); -enum enum_dyncol_func_result -mariadb_dyncol_exists_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name); - -/* List of not NULL columns */ -enum enum_dyncol_func_result -mariadb_dyncol_list_num(DYNAMIC_COLUMN *str, uint *count, uint **nums); -enum enum_dyncol_func_result -mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count, - MYSQL_LEX_STRING **names); - -/* - if the column do not exists it is NULL -*/ -enum enum_dyncol_func_result -mariadb_dyncol_get_num(DYNAMIC_COLUMN *org, uint column_nr, - DYNAMIC_COLUMN_VALUE *store_it_here); -enum enum_dyncol_func_result -mariadb_dyncol_get_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name, - DYNAMIC_COLUMN_VALUE *store_it_here); - -my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str); - -enum enum_dyncol_func_result -mariadb_dyncol_check(DYNAMIC_COLUMN *str); - -enum enum_dyncol_func_result -mariadb_dyncol_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json); - -void mariadb_dyncol_free(DYNAMIC_COLUMN *str); - -#define mariadb_dyncol_init(A) memset((A), 0, sizeof(DYNAMIC_COLUMN)) -#define dynamic_column_initialize(A) mariadb_dyncol_init((A)) -#define dynamic_column_column_free(A) mariadb_dyncol_free((A)) - -/* conversion of values to 3 base types */ -enum enum_dyncol_func_result -mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, - MARIADB_CHARSET_INFO *cs, char quote); -enum enum_dyncol_func_result -mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val); -enum enum_dyncol_func_result -mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val); - -enum enum_dyncol_func_result -mariadb_dyncol_unpack(DYNAMIC_COLUMN *str, - uint *count, - MYSQL_LEX_STRING **names, DYNAMIC_COLUMN_VALUE **vals); - -int mariadb_dyncol_column_cmp_named(const MYSQL_LEX_STRING *s1, - const MYSQL_LEX_STRING *s2); - -enum enum_dyncol_func_result -mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count); - -#define mariadb_dyncol_value_init(V) \ -do {\ - (V)->type= DYN_COL_NULL;\ -} while(0) - -/* - Prepare value for using as decimal -*/ -void mariadb_dyncol_prepare_decimal(DYNAMIC_COLUMN_VALUE *value); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_rpl.h b/VCMP-LUA/modules/mariadb/include/mysql/mariadb_rpl.h deleted file mode 100644 index 315543f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_rpl.h +++ /dev/null @@ -1,305 +0,0 @@ -/* Copyright (C) 2018 MariaDB Corporation AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02111-1301, USA */ -#ifndef _mariadb_rpl_h_ -#define _mariadb_rpl_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define MARIADB_RPL_VERSION 0x0001 -#define MARIADB_RPL_REQUIRED_VERSION 0x0001 - -/* Protocol flags */ -#define MARIADB_RPL_BINLOG_DUMP_NON_BLOCK 1 -#define MARIADB_RPL_BINLOG_SEND_ANNOTATE_ROWS 2 -#define MARIADB_RPL_IGNORE_HEARTBEAT (1 << 17) - -#define EVENT_HEADER_OFS 20 - -#define FL_GROUP_COMMIT_ID 2 -#define FL_STMT_END 1 - -#define LOG_EVENT_ARTIFICIAL_F 0x20 - - -/* Options */ -enum mariadb_rpl_option { - MARIADB_RPL_FILENAME, /* Filename and length */ - MARIADB_RPL_START, /* Start position */ - MARIADB_RPL_SERVER_ID, /* Server ID */ - MARIADB_RPL_FLAGS, /* Protocol flags */ - MARIADB_RPL_GTID_CALLBACK, /* GTID callback function */ - MARIADB_RPL_GTID_DATA, /* GTID data */ - MARIADB_RPL_BUFFER -}; - -/* Event types: From MariaDB Server sql/log_event.h */ -enum mariadb_rpl_event { - UNKNOWN_EVENT= 0, - START_EVENT_V3= 1, - QUERY_EVENT= 2, - STOP_EVENT= 3, - ROTATE_EVENT= 4, - INTVAR_EVENT= 5, - LOAD_EVENT= 6, - SLAVE_EVENT= 7, - CREATE_FILE_EVENT= 8, - APPEND_BLOCK_EVENT= 9, - EXEC_LOAD_EVENT= 10, - DELETE_FILE_EVENT= 11, - NEW_LOAD_EVENT= 12, - RAND_EVENT= 13, - USER_VAR_EVENT= 14, - FORMAT_DESCRIPTION_EVENT= 15, - XID_EVENT= 16, - BEGIN_LOAD_QUERY_EVENT= 17, - EXECUTE_LOAD_QUERY_EVENT= 18, - TABLE_MAP_EVENT = 19, - - PRE_GA_WRITE_ROWS_EVENT = 20, /* deprecated */ - PRE_GA_UPDATE_ROWS_EVENT = 21, /* deprecated */ - PRE_GA_DELETE_ROWS_EVENT = 22, /* deprecated */ - - WRITE_ROWS_EVENT_V1 = 23, - UPDATE_ROWS_EVENT_V1 = 24, - DELETE_ROWS_EVENT_V1 = 25, - INCIDENT_EVENT= 26, - HEARTBEAT_LOG_EVENT= 27, - IGNORABLE_LOG_EVENT= 28, - ROWS_QUERY_LOG_EVENT= 29, - WRITE_ROWS_EVENT = 30, - UPDATE_ROWS_EVENT = 31, - DELETE_ROWS_EVENT = 32, - GTID_LOG_EVENT= 33, - ANONYMOUS_GTID_LOG_EVENT= 34, - PREVIOUS_GTIDS_LOG_EVENT= 35, - TRANSACTION_CONTEXT_EVENT= 36, - VIEW_CHANGE_EVENT= 37, - XA_PREPARE_LOG_EVENT= 38, - - /* - Add new events here - right above this comment! - Existing events (except ENUM_END_EVENT) should never change their numbers - */ - - /* New MySQL/Sun events are to be added right above this comment */ - MYSQL_EVENTS_END, - - MARIA_EVENTS_BEGIN= 160, - ANNOTATE_ROWS_EVENT= 160, - BINLOG_CHECKPOINT_EVENT= 161, - GTID_EVENT= 162, - GTID_LIST_EVENT= 163, - START_ENCRYPTION_EVENT= 164, - QUERY_COMPRESSED_EVENT = 165, - WRITE_ROWS_COMPRESSED_EVENT_V1 = 166, - UPDATE_ROWS_COMPRESSED_EVENT_V1 = 167, - DELETE_ROWS_COMPRESSED_EVENT_V1 = 168, - WRITE_ROWS_COMPRESSED_EVENT = 169, - UPDATE_ROWS_COMPRESSED_EVENT = 170, - DELETE_ROWS_COMPRESSED_EVENT = 171, - - /* Add new MariaDB events here - right above this comment! */ - - ENUM_END_EVENT /* end marker */ -}; - -typedef struct { - char *str; - size_t length; -} MARIADB_STRING; - -enum mariadb_row_event_type { - WRITE_ROWS= 0, - UPDATE_ROWS= 1, - DELETE_ROWS= 2 -}; - -/* Global transaction id */ -typedef struct st_mariadb_gtid { - unsigned int domain_id; - unsigned int server_id; - unsigned long long sequence_nr; -} MARIADB_GTID; - -/* Generic replication handle */ -typedef struct st_mariadb_rpl { - unsigned int version; - MYSQL *mysql; - char *filename; - uint32_t filename_length; - unsigned char *buffer; - unsigned long buffer_size; - uint32_t server_id; - unsigned long start_position; - uint32_t flags; - uint8_t fd_header_len; /* header len from last format description event */ - uint8_t use_checksum; -} MARIADB_RPL; - -/* Event header */ -struct st_mariadb_rpl_rotate_event { - unsigned long long position; - MARIADB_STRING filename; -}; - -struct st_mariadb_rpl_query_event { - uint32_t thread_id; - uint32_t seconds; - MARIADB_STRING database; - uint32_t errornr; - MARIADB_STRING status; - MARIADB_STRING statement; -}; - -struct st_mariadb_rpl_gtid_list_event { - uint32_t gtid_cnt; - MARIADB_GTID *gtid; -}; - -struct st_mariadb_rpl_format_description_event -{ - uint16_t format; - char *server_version; - uint32_t timestamp; - uint8_t header_len; -}; - -struct st_mariadb_rpl_checkpoint_event { - MARIADB_STRING filename; -}; - -struct st_mariadb_rpl_xid_event { - uint64_t transaction_nr; -}; - -struct st_mariadb_rpl_gtid_event { - uint64_t sequence_nr; - uint32_t domain_id; - uint8_t flags; - uint64_t commit_id; -}; - -struct st_mariadb_rpl_annotate_rows_event { - MARIADB_STRING statement; -}; - -struct st_mariadb_rpl_table_map_event { - unsigned long long table_id; - MARIADB_STRING database; - MARIADB_STRING table; - unsigned int column_count; - MARIADB_STRING column_types; - MARIADB_STRING metadata; - char *null_indicator; -}; - -struct st_mariadb_rpl_rand_event { - unsigned long long first_seed; - unsigned long long second_seed; -}; - -struct st_mariadb_rpl_encryption_event { - char scheme; - unsigned int key_version; - char *nonce; -}; - -struct st_mariadb_rpl_intvar_event { - char type; - unsigned long long value; -}; - -struct st_mariadb_rpl_uservar_event { - MARIADB_STRING name; - uint8_t is_null; - uint8_t type; - uint32_t charset_nr; - MARIADB_STRING value; - uint8_t flags; -}; - -struct st_mariadb_rpl_rows_event { - enum mariadb_row_event_type type; - uint64_t table_id; - uint16_t flags; - uint32_t column_count; - char *column_bitmap; - char *column_update_bitmap; - size_t row_data_size; - void *row_data; -}; - -struct st_mariadb_rpl_heartbeat_event { - uint32_t timestamp; - uint32_t next_position; - uint8_t type; - uint16_t flags; -}; - -typedef struct st_mariadb_rpl_event -{ - /* common header */ - MA_MEM_ROOT memroot; - unsigned int checksum; - char ok; - enum mariadb_rpl_event event_type; - unsigned int timestamp; - unsigned int server_id; - unsigned int event_length; - unsigned int next_event_pos; - unsigned short flags; - /****************/ - union { - struct st_mariadb_rpl_rotate_event rotate; - struct st_mariadb_rpl_query_event query; - struct st_mariadb_rpl_format_description_event format_description; - struct st_mariadb_rpl_gtid_list_event gtid_list; - struct st_mariadb_rpl_checkpoint_event checkpoint; - struct st_mariadb_rpl_xid_event xid; - struct st_mariadb_rpl_gtid_event gtid; - struct st_mariadb_rpl_annotate_rows_event annotate_rows; - struct st_mariadb_rpl_table_map_event table_map; - struct st_mariadb_rpl_rand_event rand; - struct st_mariadb_rpl_encryption_event encryption; - struct st_mariadb_rpl_intvar_event intvar; - struct st_mariadb_rpl_uservar_event uservar; - struct st_mariadb_rpl_rows_event rows; - struct st_mariadb_rpl_heartbeat_event heartbeat; - } event; -} MARIADB_RPL_EVENT; - -#define mariadb_rpl_init(a) mariadb_rpl_init_ex((a), MARIADB_RPL_VERSION) - -/* Function prototypes */ -MARIADB_RPL * STDCALL mariadb_rpl_init_ex(MYSQL *mysql, unsigned int version); - -int mariadb_rpl_optionsv(MARIADB_RPL *rpl, enum mariadb_rpl_option, ...); -int mariadb_rpl_get_optionsv(MARIADB_RPL *rpl, enum mariadb_rpl_option, ...); - -int STDCALL mariadb_rpl_open(MARIADB_RPL *rpl); -void STDCALL mariadb_rpl_close(MARIADB_RPL *rpl); -MARIADB_RPL_EVENT * STDCALL mariadb_rpl_fetch(MARIADB_RPL *rpl, MARIADB_RPL_EVENT *event); -void STDCALL mariadb_free_rpl_event(MARIADB_RPL_EVENT *event); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_stmt.h b/VCMP-LUA/modules/mariadb/include/mysql/mariadb_stmt.h deleted file mode 100644 index d07540e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_stmt.h +++ /dev/null @@ -1,298 +0,0 @@ -/************************************************************************ - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02111-1301, USA - - Part of this code includes code from PHP's mysqlnd extension - (written by Andrey Hristov, Georg Richter and Ulf Wendel), freely - available from http://www.php.net/software - -*************************************************************************/ - -#define MYSQL_NO_DATA 100 -#define MYSQL_DATA_TRUNCATED 101 -#define MYSQL_DEFAULT_PREFETCH_ROWS (unsigned long) 1 - -/* Bind flags */ -#define MADB_BIND_DUMMY 1 - -#define MARIADB_STMT_BULK_SUPPORTED(stmt)\ - ((stmt)->mysql && \ - (!((stmt)->mysql->server_capabilities & CLIENT_MYSQL) &&\ - ((stmt)->mysql->extension->mariadb_server_capabilities & \ - (MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32)))) - -#define SET_CLIENT_STMT_ERROR(a, b, c, d) \ -do { \ - (a)->last_errno= (b);\ - strncpy((a)->sqlstate, (c), SQLSTATE_LENGTH);\ - (a)->sqlstate[SQLSTATE_LENGTH]= 0;\ - strncpy((a)->last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE);\ - (a)->last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\ -} while (0) - -#define CLEAR_CLIENT_STMT_ERROR(a) \ -do { \ - (a)->last_errno= 0;\ - strcpy((a)->sqlstate, "00000");\ - (a)->last_error[0]= 0;\ -} while (0) - -#define MYSQL_PS_SKIP_RESULT_W_LEN -1 -#define MYSQL_PS_SKIP_RESULT_STR -2 -#define STMT_ID_LENGTH 4 - - -typedef struct st_mysql_stmt MYSQL_STMT; - -typedef MYSQL_RES* (*mysql_stmt_use_or_store_func)(MYSQL_STMT *); - -enum enum_stmt_attr_type -{ - STMT_ATTR_UPDATE_MAX_LENGTH, - STMT_ATTR_CURSOR_TYPE, - STMT_ATTR_PREFETCH_ROWS, - - /* MariaDB only */ - STMT_ATTR_PREBIND_PARAMS=200, - STMT_ATTR_ARRAY_SIZE, - STMT_ATTR_ROW_SIZE, - STMT_ATTR_STATE, - STMT_ATTR_CB_USER_DATA, - STMT_ATTR_CB_PARAM, - STMT_ATTR_CB_RESULT -}; - -enum enum_cursor_type -{ - CURSOR_TYPE_NO_CURSOR= 0, - CURSOR_TYPE_READ_ONLY= 1, - CURSOR_TYPE_FOR_UPDATE= 2, - CURSOR_TYPE_SCROLLABLE= 4 -}; - -enum enum_indicator_type -{ - STMT_INDICATOR_NTS=-1, - STMT_INDICATOR_NONE=0, - STMT_INDICATOR_NULL=1, - STMT_INDICATOR_DEFAULT=2, - STMT_INDICATOR_IGNORE=3, - STMT_INDICATOR_IGNORE_ROW=4 -}; - -/* - bulk PS flags -*/ -#define STMT_BULK_FLAG_CLIENT_SEND_TYPES 128 -#define STMT_BULK_FLAG_INSERT_ID_REQUEST 64 - -typedef enum mysql_stmt_state -{ - MYSQL_STMT_INITTED = 0, - MYSQL_STMT_PREPARED, - MYSQL_STMT_EXECUTED, - MYSQL_STMT_WAITING_USE_OR_STORE, - MYSQL_STMT_USE_OR_STORE_CALLED, - MYSQL_STMT_USER_FETCHING, /* fetch_row_buff or fetch_row_unbuf */ - MYSQL_STMT_FETCH_DONE -} enum_mysqlnd_stmt_state; - -typedef struct st_mysql_bind -{ - unsigned long *length; /* output length pointer */ - my_bool *is_null; /* Pointer to null indicator */ - void *buffer; /* buffer to get/put data */ - /* set this if you want to track data truncations happened during fetch */ - my_bool *error; - union { - unsigned char *row_ptr; /* for the current data position */ - char *indicator; /* indicator variable */ - } u; - void (*store_param_func)(NET *net, struct st_mysql_bind *param); - void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *, - unsigned char **row); - void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *, - unsigned char **row); - /* output buffer length, must be set when fetching str/binary */ - unsigned long buffer_length; - unsigned long offset; /* offset position for char/binary fetch */ - unsigned long length_value; /* Used if length is 0 */ - unsigned int flags; /* special flags, e.g. for dummy bind */ - unsigned int pack_length; /* Internal length for packed data */ - enum enum_field_types buffer_type; /* buffer type */ - my_bool error_value; /* used if error is 0 */ - my_bool is_unsigned; /* set if integer type is unsigned */ - my_bool long_data_used; /* If used with mysql_send_long_data */ - my_bool is_null_value; /* Used if is_null is 0 */ - void *extension; -} MYSQL_BIND; - -typedef struct st_mysqlnd_upsert_result -{ - unsigned int warning_count; - unsigned int server_status; - unsigned long long affected_rows; - unsigned long long last_insert_id; -} mysql_upsert_status; - -typedef struct st_mysql_cmd_buffer -{ - unsigned char *buffer; - size_t length; -} MYSQL_CMD_BUFFER; - -typedef struct st_mysql_error_info -{ - unsigned int error_no; - char error[MYSQL_ERRMSG_SIZE+1]; - char sqlstate[SQLSTATE_LENGTH + 1]; -} mysql_error_info; - - -struct st_mysqlnd_stmt_methods -{ - my_bool (*prepare)(const MYSQL_STMT * stmt, const char * const query, size_t query_len); - my_bool (*execute)(const MYSQL_STMT * stmt); - MYSQL_RES * (*use_result)(const MYSQL_STMT * stmt); - MYSQL_RES * (*store_result)(const MYSQL_STMT * stmt); - MYSQL_RES * (*get_result)(const MYSQL_STMT * stmt); - my_bool (*free_result)(const MYSQL_STMT * stmt); - my_bool (*seek_data)(const MYSQL_STMT * stmt, unsigned long long row); - my_bool (*reset)(const MYSQL_STMT * stmt); - my_bool (*close)(const MYSQL_STMT * stmt); /* private */ - my_bool (*dtor)(const MYSQL_STMT * stmt); /* use this for mysqlnd_stmt_close */ - - my_bool (*fetch)(const MYSQL_STMT * stmt, my_bool * const fetched_anything); - - my_bool (*bind_param)(const MYSQL_STMT * stmt, const MYSQL_BIND bind); - my_bool (*refresh_bind_param)(const MYSQL_STMT * stmt); - my_bool (*bind_result)(const MYSQL_STMT * stmt, const MYSQL_BIND *bind); - my_bool (*send_long_data)(const MYSQL_STMT * stmt, unsigned int param_num, - const char * const data, size_t length); - MYSQL_RES *(*get_parameter_metadata)(const MYSQL_STMT * stmt); - MYSQL_RES *(*get_result_metadata)(const MYSQL_STMT * stmt); - unsigned long long (*get_last_insert_id)(const MYSQL_STMT * stmt); - unsigned long long (*get_affected_rows)(const MYSQL_STMT * stmt); - unsigned long long (*get_num_rows)(const MYSQL_STMT * stmt); - - unsigned int (*get_param_count)(const MYSQL_STMT * stmt); - unsigned int (*get_field_count)(const MYSQL_STMT * stmt); - unsigned int (*get_warning_count)(const MYSQL_STMT * stmt); - - unsigned int (*get_error_no)(const MYSQL_STMT * stmt); - const char * (*get_error_str)(const MYSQL_STMT * stmt); - const char * (*get_sqlstate)(const MYSQL_STMT * stmt); - - my_bool (*get_attribute)(const MYSQL_STMT * stmt, enum enum_stmt_attr_type attr_type, const void * value); - my_bool (*set_attribute)(const MYSQL_STMT * stmt, enum enum_stmt_attr_type attr_type, const void * value); - void (*set_error)(MYSQL_STMT *stmt, unsigned int error_nr, const char *sqlstate, const char *format, ...); -}; - -typedef int (*mysql_stmt_fetch_row_func)(MYSQL_STMT *stmt, unsigned char **row); -typedef void (*ps_result_callback)(void *data, unsigned int column, unsigned char **row); -typedef my_bool *(*ps_param_callback)(void *data, MYSQL_BIND *bind, unsigned int row_nr); - -struct st_mysql_stmt -{ - MA_MEM_ROOT mem_root; - MYSQL *mysql; - unsigned long stmt_id; - unsigned long flags;/* cursor is set here */ - enum_mysqlnd_stmt_state state; - MYSQL_FIELD *fields; - unsigned int field_count; - unsigned int param_count; - unsigned char send_types_to_server; - MYSQL_BIND *params; - MYSQL_BIND *bind; - MYSQL_DATA result; /* we don't use mysqlnd's result set logic */ - MYSQL_ROWS *result_cursor; - my_bool bind_result_done; - my_bool bind_param_done; - - mysql_upsert_status upsert_status; - - unsigned int last_errno; - char last_error[MYSQL_ERRMSG_SIZE+1]; - char sqlstate[SQLSTATE_LENGTH + 1]; - - my_bool update_max_length; - unsigned long prefetch_rows; - LIST list; - - my_bool cursor_exists; - - void *extension; - mysql_stmt_fetch_row_func fetch_row_func; - unsigned int execute_count;/* count how many times the stmt was executed */ - mysql_stmt_use_or_store_func default_rset_handler; - struct st_mysqlnd_stmt_methods *m; - unsigned int array_size; - size_t row_size; - unsigned int prebind_params; - void *user_data; - ps_result_callback result_callback; - ps_param_callback param_callback; -}; - -typedef void (*ps_field_fetch_func)(MYSQL_BIND *r_param, const MYSQL_FIELD * field, unsigned char **row); -typedef struct st_mysql_perm_bind { - ps_field_fetch_func func; - /* should be signed int */ - int pack_len; - unsigned long max_len; -} MYSQL_PS_CONVERSION; - -extern MYSQL_PS_CONVERSION mysql_ps_fetch_functions[MYSQL_TYPE_GEOMETRY + 1]; -unsigned long ma_net_safe_read(MYSQL *mysql); -void mysql_init_ps_subsystem(void); -unsigned long net_field_length(unsigned char **packet); -int ma_simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, - size_t length, my_bool skipp_check, void *opt_arg); -/* - * function prototypes - */ -MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql); -int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, unsigned long length); -int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt); -int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt); -int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, unsigned int column, unsigned long offset); -int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt); -unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt); -my_bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr); -my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, void *attr); -my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd); -my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd); -my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt); -my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt); -my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt); -my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, unsigned int param_number, const char *data, unsigned long length); -MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt); -MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt); -unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt); -const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt); -const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt); -MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset); -MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt); -void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, unsigned long long offset); -unsigned long long STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt); -unsigned long long STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt); -unsigned long long STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt); -unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt); -int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt); -my_bool STDCALL mysql_stmt_more_results(MYSQL_STMT *stmt); -int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt, const char *stmt_str, size_t length); -MYSQL_FIELD * STDCALL mariadb_stmt_fetch_fields(MYSQL_STMT *stmt); diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_version.h b/VCMP-LUA/modules/mariadb/include/mysql/mariadb_version.h deleted file mode 100644 index f6843de..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mariadb_version.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright Abandoned 1996, 1999, 2001 MySQL AB - This file is public domain and comes with NO WARRANTY of any kind */ - -/* Version numbers for protocol & mysqld */ - -#ifndef _mariadb_version_h_ -#define _mariadb_version_h_ - -#ifdef _CUSTOMCONFIG_ -#include -#else -#define PROTOCOL_VERSION 10 -#define MARIADB_CLIENT_VERSION_STR "10.5.7" -#define MARIADB_BASE_VERSION "mariadb-10.5" -#define MARIADB_VERSION_ID 100507 -#define MARIADB_PORT 3306 -#define MARIADB_UNIX_ADDR "/tmp/mysql.sock" -#ifndef MYSQL_UNIX_ADDR -#define MYSQL_UNIX_ADDR MARIADB_UNIX_ADDR -#endif -#ifndef MYSQL_PORT -#define MYSQL_PORT MARIADB_PORT -#endif - -#define MYSQL_CONFIG_NAME "my" -#define MYSQL_VERSION_ID 100507 -#define MYSQL_SERVER_VERSION "10.5.7-MariaDB" - -#define MARIADB_PACKAGE_VERSION "3.1.11" -#define MARIADB_PACKAGE_VERSION_ID 30111 -#define MARIADB_SYSTEM_TYPE "Windows" -#define MARIADB_MACHINE_TYPE "AMD64" -#define MARIADB_PLUGINDIR "C:/Program Files (x86)/MySQL/lib/plugin" - -/* mysqld compile time options */ -#ifndef MYSQL_CHARSET -#define MYSQL_CHARSET "" -#endif -#endif - -/* Source information */ -#define CC_SOURCE_REVISION "" - -#endif /* _mariadb_version_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/my_config.h b/VCMP-LUA/modules/mariadb/include/mysql/my_config.h deleted file mode 100644 index fc62b0b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/my_config.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Do not edit this file directly, it was auto-generated by cmake */ - -#warning This file should not be included by clients, include only - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/my_global.h b/VCMP-LUA/modules/mariadb/include/mysql/my_global.h deleted file mode 100644 index fc62b0b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/my_global.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Do not edit this file directly, it was auto-generated by cmake */ - -#warning This file should not be included by clients, include only - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/my_sys.h b/VCMP-LUA/modules/mariadb/include/mysql/my_sys.h deleted file mode 100644 index fc62b0b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/my_sys.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Do not edit this file directly, it was auto-generated by cmake */ - -#warning This file should not be included by clients, include only - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mysql.h b/VCMP-LUA/modules/mariadb/include/mysql/mysql.h deleted file mode 100644 index 5174e07..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mysql.h +++ /dev/null @@ -1,891 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - 2012 by MontyProgram AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02111-1301, USA */ - -/* defines for the libmariadb library */ - -#ifndef _mysql_h -#define _mysql_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef LIBMARIADB -#define LIBMARIADB -#endif -#ifndef MYSQL_CLIENT -#define MYSQL_CLIENT -#endif - -#include - -#if !defined (_global_h) && !defined (MY_GLOBAL_INCLUDED) /* If not standard header */ -#include -typedef char my_bool; -typedef unsigned long long my_ulonglong; - -#if !defined(_WIN32) -#define STDCALL -#else -#define STDCALL __stdcall -#endif - -#ifndef my_socket_defined -#define my_socket_defined -#if defined(_WIN64) -#define my_socket unsigned long long -#elif defined(_WIN32) -#define my_socket unsigned int -#else -typedef int my_socket; -#endif -#endif -#endif -#include "mariadb_com.h" -#include "mariadb_version.h" -#include "ma_list.h" -#include "mariadb_ctype.h" - - -typedef struct st_ma_const_string -{ - const char *str; - size_t length; -} MARIADB_CONST_STRING; - - -#ifndef ST_MA_USED_MEM_DEFINED -#define ST_MA_USED_MEM_DEFINED - typedef struct st_ma_used_mem { /* struct for once_alloc */ - struct st_ma_used_mem *next; /* Next block in use */ - size_t left; /* memory left in block */ - size_t size; /* Size of block */ - } MA_USED_MEM; - - typedef struct st_ma_mem_root { - MA_USED_MEM *free; - MA_USED_MEM *used; - MA_USED_MEM *pre_alloc; - size_t min_malloc; - size_t block_size; - unsigned int block_num; - unsigned int first_block_usage; - void (*error_handler)(void); - } MA_MEM_ROOT; -#endif - -extern unsigned int mysql_port; -extern char *mysql_unix_port; -extern unsigned int mariadb_deinitialize_ssl; - -#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) -#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) -#define IS_BLOB(n) ((n) & BLOB_FLAG) -#define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) -#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG) -#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR || (f)->type == MYSQL_TYPE_NEWDECIMAL || (f)->type == MYSQL_TYPE_DECIMAL) - - typedef struct st_mysql_field { - char *name; /* Name of column */ - char *org_name; /* Name of original column (added after 3.23.58) */ - char *table; /* Table of column if column was a field */ - char *org_table; /* Name of original table (added after 3.23.58 */ - char *db; /* table schema (added after 3.23.58) */ - char *catalog; /* table catalog (added after 3.23.58) */ - char *def; /* Default value (set by mysql_list_fields) */ - unsigned long length; /* Width of column */ - unsigned long max_length; /* Max width of selected set */ - /* added after 3.23.58 */ - unsigned int name_length; - unsigned int org_name_length; - unsigned int table_length; - unsigned int org_table_length; - unsigned int db_length; - unsigned int catalog_length; - unsigned int def_length; - /***********************/ - unsigned int flags; /* Div flags */ - unsigned int decimals; /* Number of decimals in field */ - unsigned int charsetnr; /* char set number (added in 4.1) */ - enum enum_field_types type; /* Type of field. Se mysql_com.h for types */ - void *extension; /* added in 4.1 */ - } MYSQL_FIELD; - - typedef char **MYSQL_ROW; /* return data as array of strings */ - typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ - -#define SET_CLIENT_ERROR(a, b, c, d) \ - do { \ - (a)->net.last_errno= (b);\ - strncpy((a)->net.sqlstate, (c), SQLSTATE_LENGTH);\ - (a)->net.sqlstate[SQLSTATE_LENGTH]= 0;\ - strncpy((a)->net.last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE - 1);\ - (a)->net.last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\ - } while(0) - -/* For mysql_async.c */ -#define set_mariadb_error(A,B,C) SET_CLIENT_ERROR((A),(B),(C),0) -extern const char *SQLSTATE_UNKNOWN; -#define unknown_sqlstate SQLSTATE_UNKNOWN - -#define CLEAR_CLIENT_ERROR(a) \ - do { \ - (a)->net.last_errno= 0;\ - strcpy((a)->net.sqlstate, "00000");\ - (a)->net.last_error[0]= '\0';\ - if ((a)->net.extension)\ - (a)->net.extension->extended_errno= 0;\ - } while (0) - -#define MYSQL_COUNT_ERROR (~(unsigned long long) 0) - - - typedef struct st_mysql_rows { - struct st_mysql_rows *next; /* list of rows */ - MYSQL_ROW data; - unsigned long length; - } MYSQL_ROWS; - - typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ - - typedef struct st_mysql_data { - MYSQL_ROWS *data; - void *embedded_info; - MA_MEM_ROOT alloc; - unsigned long long rows; - unsigned int fields; - void *extension; - } MYSQL_DATA; - - enum mysql_option - { - MYSQL_OPT_CONNECT_TIMEOUT, - MYSQL_OPT_COMPRESS, - MYSQL_OPT_NAMED_PIPE, - MYSQL_INIT_COMMAND, - MYSQL_READ_DEFAULT_FILE, - MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, - MYSQL_SET_CHARSET_NAME, - MYSQL_OPT_LOCAL_INFILE, - MYSQL_OPT_PROTOCOL, - MYSQL_SHARED_MEMORY_BASE_NAME, - MYSQL_OPT_READ_TIMEOUT, - MYSQL_OPT_WRITE_TIMEOUT, - MYSQL_OPT_USE_RESULT, - MYSQL_OPT_USE_REMOTE_CONNECTION, - MYSQL_OPT_USE_EMBEDDED_CONNECTION, - MYSQL_OPT_GUESS_CONNECTION, - MYSQL_SET_CLIENT_IP, - MYSQL_SECURE_AUTH, - MYSQL_REPORT_DATA_TRUNCATION, - MYSQL_OPT_RECONNECT, - MYSQL_OPT_SSL_VERIFY_SERVER_CERT, - MYSQL_PLUGIN_DIR, - MYSQL_DEFAULT_AUTH, - MYSQL_OPT_BIND, - MYSQL_OPT_SSL_KEY, - MYSQL_OPT_SSL_CERT, - MYSQL_OPT_SSL_CA, - MYSQL_OPT_SSL_CAPATH, - MYSQL_OPT_SSL_CIPHER, - MYSQL_OPT_SSL_CRL, - MYSQL_OPT_SSL_CRLPATH, - /* Connection attribute options */ - MYSQL_OPT_CONNECT_ATTR_RESET, - MYSQL_OPT_CONNECT_ATTR_ADD, - MYSQL_OPT_CONNECT_ATTR_DELETE, - MYSQL_SERVER_PUBLIC_KEY, - MYSQL_ENABLE_CLEARTEXT_PLUGIN, - MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, - MYSQL_OPT_SSL_ENFORCE, - MYSQL_OPT_MAX_ALLOWED_PACKET, - MYSQL_OPT_NET_BUFFER_LENGTH, - MYSQL_OPT_TLS_VERSION, - - /* MariaDB specific */ - MYSQL_PROGRESS_CALLBACK=5999, - MYSQL_OPT_NONBLOCK, - /* MariaDB Connector/C specific */ - MYSQL_DATABASE_DRIVER=7000, - MARIADB_OPT_SSL_FP, /* deprecated, use MARIADB_OPT_TLS_PEER_FP instead */ - MARIADB_OPT_SSL_FP_LIST, /* deprecated, use MARIADB_OPT_TLS_PEER_FP_LIST instead */ - MARIADB_OPT_TLS_PASSPHRASE, /* passphrase for encrypted certificates */ - MARIADB_OPT_TLS_CIPHER_STRENGTH, - MARIADB_OPT_TLS_VERSION, - MARIADB_OPT_TLS_PEER_FP, /* single finger print for server certificate verification */ - MARIADB_OPT_TLS_PEER_FP_LIST, /* finger print white list for server certificate verification */ - MARIADB_OPT_CONNECTION_READ_ONLY, - MYSQL_OPT_CONNECT_ATTRS, /* for mysql_get_optionv */ - MARIADB_OPT_USERDATA, - MARIADB_OPT_CONNECTION_HANDLER, - MARIADB_OPT_PORT, - MARIADB_OPT_UNIXSOCKET, - MARIADB_OPT_PASSWORD, - MARIADB_OPT_HOST, - MARIADB_OPT_USER, - MARIADB_OPT_SCHEMA, - MARIADB_OPT_DEBUG, - MARIADB_OPT_FOUND_ROWS, - MARIADB_OPT_MULTI_RESULTS, - MARIADB_OPT_MULTI_STATEMENTS, - MARIADB_OPT_INTERACTIVE, - MARIADB_OPT_PROXY_HEADER, - MARIADB_OPT_IO_WAIT - }; - - enum mariadb_value { - MARIADB_CHARSET_ID, - MARIADB_CHARSET_NAME, - MARIADB_CLIENT_ERRORS, - MARIADB_CLIENT_VERSION, - MARIADB_CLIENT_VERSION_ID, - MARIADB_CONNECTION_ASYNC_TIMEOUT, - MARIADB_CONNECTION_ASYNC_TIMEOUT_MS, - MARIADB_CONNECTION_MARIADB_CHARSET_INFO, - MARIADB_CONNECTION_ERROR, - MARIADB_CONNECTION_ERROR_ID, - MARIADB_CONNECTION_HOST, - MARIADB_CONNECTION_INFO, - MARIADB_CONNECTION_PORT, - MARIADB_CONNECTION_PROTOCOL_VERSION_ID, - MARIADB_CONNECTION_PVIO_TYPE, - MARIADB_CONNECTION_SCHEMA, - MARIADB_CONNECTION_SERVER_TYPE, - MARIADB_CONNECTION_SERVER_VERSION, - MARIADB_CONNECTION_SERVER_VERSION_ID, - MARIADB_CONNECTION_SOCKET, - MARIADB_CONNECTION_SQLSTATE, - MARIADB_CONNECTION_SSL_CIPHER, - MARIADB_TLS_LIBRARY, - MARIADB_CONNECTION_TLS_VERSION, - MARIADB_CONNECTION_TLS_VERSION_ID, - MARIADB_CONNECTION_TYPE, - MARIADB_CONNECTION_UNIX_SOCKET, - MARIADB_CONNECTION_USER, - MARIADB_MAX_ALLOWED_PACKET, - MARIADB_NET_BUFFER_LENGTH, - MARIADB_CONNECTION_SERVER_STATUS, - MARIADB_CONNECTION_SERVER_CAPABILITIES, - MARIADB_CONNECTION_EXTENDED_SERVER_CAPABILITIES, - MARIADB_CONNECTION_CLIENT_CAPABILITIES - }; - - enum mysql_status { MYSQL_STATUS_READY, - MYSQL_STATUS_GET_RESULT, - MYSQL_STATUS_USE_RESULT, - MYSQL_STATUS_QUERY_SENT, - MYSQL_STATUS_SENDING_LOAD_DATA, - MYSQL_STATUS_FETCHING_DATA, - MYSQL_STATUS_NEXT_RESULT_PENDING, - MYSQL_STATUS_QUIT_SENT, /* object is "destroyed" at this stage */ - MYSQL_STATUS_STMT_RESULT - }; - - enum mysql_protocol_type - { - MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, - MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY - }; - -struct st_mysql_options { - unsigned int connect_timeout, read_timeout, write_timeout; - unsigned int port, protocol; - unsigned long client_flag; - char *host,*user,*password,*unix_socket,*db; - struct st_dynamic_array *init_command; - char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; - char *ssl_key; /* PEM key file */ - char *ssl_cert; /* PEM cert file */ - char *ssl_ca; /* PEM CA file */ - char *ssl_capath; /* PEM directory of CA-s? */ - char *ssl_cipher; - char *shared_memory_base_name; - unsigned long max_allowed_packet; - my_bool use_ssl; /* if to use SSL or not */ - my_bool compress,named_pipe; - my_bool reconnect, unused_1, unused_2, unused_3; - enum mysql_option methods_to_use; - char *bind_address; - my_bool secure_auth; - my_bool report_data_truncation; - /* function pointers for local infile support */ - int (*local_infile_init)(void **, const char *, void *); - int (*local_infile_read)(void *, char *, unsigned int); - void (*local_infile_end)(void *); - int (*local_infile_error)(void *, char *, unsigned int); - void *local_infile_userdata; - struct st_mysql_options_extension *extension; -}; - - typedef struct st_mysql { - NET net; /* Communication parameters */ - void *unused_0; - char *host,*user,*passwd,*unix_socket,*server_version,*host_info; - char *info,*db; - const struct ma_charset_info_st *charset; /* character set */ - MYSQL_FIELD *fields; - MA_MEM_ROOT field_alloc; - unsigned long long affected_rows; - unsigned long long insert_id; /* id if insert on table with NEXTNR */ - unsigned long long extra_info; /* Used by mysqlshow */ - unsigned long thread_id; /* Id for connection in server */ - unsigned long packet_length; - unsigned int port; - unsigned long client_flag; - unsigned long server_capabilities; - unsigned int protocol_version; - unsigned int field_count; - unsigned int server_status; - unsigned int server_language; - unsigned int warning_count; /* warning count, added in 4.1 protocol */ - struct st_mysql_options options; - enum mysql_status status; - my_bool free_me; /* If free in mysql_close */ - my_bool unused_1; - char scramble_buff[20+ 1]; - /* madded after 3.23.58 */ - my_bool unused_2; - void *unused_3, *unused_4, *unused_5, *unused_6; - LIST *stmts; - const struct st_mariadb_methods *methods; - void *thd; - my_bool *unbuffered_fetch_owner; - char *info_buffer; - struct st_mariadb_extension *extension; -} MYSQL; - -typedef struct st_mysql_res { - unsigned long long row_count; - unsigned int field_count, current_field; - MYSQL_FIELD *fields; - MYSQL_DATA *data; - MYSQL_ROWS *data_cursor; - MA_MEM_ROOT field_alloc; - MYSQL_ROW row; /* If unbuffered read */ - MYSQL_ROW current_row; /* buffer to current row */ - unsigned long *lengths; /* column lengths of current row */ - MYSQL *handle; /* for unbuffered reads */ - my_bool eof; /* Used my mysql_fetch_row */ - my_bool is_ps; -} MYSQL_RES; - -typedef struct -{ - unsigned long *p_max_allowed_packet; - unsigned long *p_net_buffer_length; - void *extension; -} MYSQL_PARAMETERS; - - -enum mariadb_field_attr_t -{ - MARIADB_FIELD_ATTR_DATA_TYPE_NAME= 0, - MARIADB_FIELD_ATTR_FORMAT_NAME= 1 -}; - -#define MARIADB_FIELD_ATTR_LAST MARIADB_FIELD_ATTR_FORMAT_NAME - - -int STDCALL mariadb_field_attr(MARIADB_CONST_STRING *attr, - const MYSQL_FIELD *field, - enum mariadb_field_attr_t type); - -#ifndef _mysql_time_h_ -enum enum_mysql_timestamp_type -{ - MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1, - MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2 -}; - -typedef struct st_mysql_time -{ - unsigned int year, month, day, hour, minute, second; - unsigned long second_part; - my_bool neg; - enum enum_mysql_timestamp_type time_type; -} MYSQL_TIME; -#define AUTO_SEC_PART_DIGITS 39 -#endif - -#define SEC_PART_DIGITS 6 -#define MARIADB_INVALID_SOCKET -1 - -/* Ansynchronous API constants */ -#define MYSQL_WAIT_READ 1 -#define MYSQL_WAIT_WRITE 2 -#define MYSQL_WAIT_EXCEPT 4 -#define MYSQL_WAIT_TIMEOUT 8 - -typedef struct character_set -{ - unsigned int number; /* character set number */ - unsigned int state; /* character set state */ - const char *csname; /* character set name */ - const char *name; /* collation name */ - const char *comment; /* comment */ - const char *dir; /* character set directory */ - unsigned int mbminlen; /* min. length for multibyte strings */ - unsigned int mbmaxlen; /* max. length for multibyte strings */ -} MY_CHARSET_INFO; - -/* Local infile support functions */ -#define LOCAL_INFILE_ERROR_LEN 512 - -#include "mariadb_stmt.h" - -#ifndef MYSQL_CLIENT_PLUGIN_HEADER -#define MYSQL_CLIENT_PLUGIN_HEADER \ - 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 *); -struct st_mysql_client_plugin -{ - MYSQL_CLIENT_PLUGIN_HEADER -}; - -struct st_mysql_client_plugin * -mysql_load_plugin(struct st_mysql *mysql, const char *name, int type, - int argc, ...); -struct st_mysql_client_plugin * STDCALL -mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type, - int argc, va_list args); -struct st_mysql_client_plugin * STDCALL -mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type); -struct st_mysql_client_plugin * STDCALL -mysql_client_register_plugin(struct st_mysql *mysql, - struct st_mysql_client_plugin *plugin); -#endif - - -void STDCALL mysql_set_local_infile_handler(MYSQL *mysql, - int (*local_infile_init)(void **, const char *, void *), - int (*local_infile_read)(void *, char *, unsigned int), - void (*local_infile_end)(void *), - int (*local_infile_error)(void *, char*, unsigned int), - void *); - -void mysql_set_local_infile_default(MYSQL *mysql); - -void my_set_error(MYSQL *mysql, unsigned int error_nr, - const char *sqlstate, const char *format, ...); -/* Functions to get information from the MYSQL and MYSQL_RES structures */ -/* Should definitely be used if one uses shared libraries */ - -my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); -unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); -my_bool STDCALL mysql_eof(MYSQL_RES *res); -MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, - unsigned int fieldnr); -MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res); -MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res); -unsigned int STDCALL mysql_field_tell(MYSQL_RES *res); - -unsigned int STDCALL mysql_field_count(MYSQL *mysql); -my_bool STDCALL mysql_more_results(MYSQL *mysql); -int STDCALL mysql_next_result(MYSQL *mysql); -my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); -my_bool STDCALL mysql_autocommit(MYSQL *mysql, my_bool mode); -my_bool STDCALL mysql_commit(MYSQL *mysql); -my_bool STDCALL mysql_rollback(MYSQL *mysql); -my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); -unsigned int STDCALL mysql_errno(MYSQL *mysql); -const char * STDCALL mysql_error(MYSQL *mysql); -const char * STDCALL mysql_info(MYSQL *mysql); -unsigned long STDCALL mysql_thread_id(MYSQL *mysql); -const char * STDCALL mysql_character_set_name(MYSQL *mysql); -void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs); -int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname); - -my_bool mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *arg, ...); -my_bool STDCALL mariadb_get_info(MYSQL *mysql, enum mariadb_value value, void *arg); -MYSQL * STDCALL mysql_init(MYSQL *mysql); -int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, - const char *cert, const char *ca, - const char *capath, const char *cipher); -const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql); -my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, - const char *passwd, const char *db); -MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, - const char *user, - const char *passwd, - const char *db, - unsigned int port, - const char *unix_socket, - unsigned long clientflag); -void STDCALL mysql_close(MYSQL *sock); -int STDCALL mysql_select_db(MYSQL *mysql, const char *db); -int STDCALL mysql_query(MYSQL *mysql, const char *q); -int STDCALL mysql_send_query(MYSQL *mysql, const char *q, - unsigned long length); -my_bool STDCALL mysql_read_query_result(MYSQL *mysql); -int STDCALL mysql_real_query(MYSQL *mysql, const char *q, - unsigned long length); -int STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level); -int STDCALL mysql_dump_debug_info(MYSQL *mysql); -int STDCALL mysql_refresh(MYSQL *mysql, - unsigned int refresh_options); -int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid); -int STDCALL mysql_ping(MYSQL *mysql); -char * STDCALL mysql_stat(MYSQL *mysql); -char * STDCALL mysql_get_server_info(MYSQL *mysql); -unsigned long STDCALL mysql_get_server_version(MYSQL *mysql); -char * STDCALL mysql_get_host_info(MYSQL *mysql); -unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild); -MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); -MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, - const char *wild); -MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); -int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, - const void *arg); -int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option, - const void *arg1, const void *arg2); -void STDCALL mysql_free_result(MYSQL_RES *result); -void STDCALL mysql_data_seek(MYSQL_RES *result, - unsigned long long offset); -MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET); -MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, - MYSQL_FIELD_OFFSET offset); -MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); -unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); -MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); -unsigned long STDCALL mysql_escape_string(char *to,const char *from, - unsigned long from_length); -unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, - char *to,const char *from, - unsigned long length); -unsigned int STDCALL mysql_thread_safe(void); -unsigned int STDCALL mysql_warning_count(MYSQL *mysql); -const char * STDCALL mysql_sqlstate(MYSQL *mysql); -int STDCALL mysql_server_init(int argc, char **argv, char **groups); -void STDCALL mysql_server_end(void); -void STDCALL mysql_thread_end(void); -my_bool STDCALL mysql_thread_init(void); -int STDCALL mysql_set_server_option(MYSQL *mysql, - enum enum_mysql_set_option option); -const char * STDCALL mysql_get_client_info(void); -unsigned long STDCALL mysql_get_client_version(void); -my_bool STDCALL mariadb_connection(MYSQL *mysql); -const char * STDCALL mysql_get_server_name(MYSQL *mysql); -MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname); -MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr); -size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs, - char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode); -int mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...); -int mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...); -int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg); -unsigned long STDCALL mysql_hex_string(char *to, const char *from, unsigned long len); -my_socket STDCALL mysql_get_socket(MYSQL *mysql); -unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql); -unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql); -my_bool STDCALL mariadb_reconnect(MYSQL *mysql); -int STDCALL mariadb_cancel(MYSQL *mysql); -void STDCALL mysql_debug(const char *debug); -unsigned long STDCALL mysql_net_read_packet(MYSQL *mysql); -unsigned long STDCALL mysql_net_field_length(unsigned char **packet); -my_bool STDCALL mysql_embedded(void); -MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void); - -/* Async API */ -int STDCALL mysql_close_start(MYSQL *sock); -int STDCALL mysql_close_cont(MYSQL *sock, int status); -int STDCALL mysql_commit_start(my_bool *ret, MYSQL * mysql); -int STDCALL mysql_commit_cont(my_bool *ret, MYSQL * mysql, int status); -int STDCALL mysql_dump_debug_info_cont(int *ret, MYSQL *mysql, int ready_status); -int STDCALL mysql_dump_debug_info_start(int *ret, MYSQL *mysql); -int STDCALL mysql_rollback_start(my_bool *ret, MYSQL * mysql); -int STDCALL mysql_rollback_cont(my_bool *ret, MYSQL * mysql, int status); -int STDCALL mysql_autocommit_start(my_bool *ret, MYSQL * mysql, - my_bool auto_mode); -int STDCALL mysql_list_fields_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status); -int STDCALL mysql_list_fields_start(MYSQL_RES **ret, MYSQL *mysql, const char *table, - const char *wild); -int STDCALL mysql_autocommit_cont(my_bool *ret, MYSQL * mysql, int status); -int STDCALL mysql_next_result_start(int *ret, MYSQL *mysql); -int STDCALL mysql_next_result_cont(int *ret, MYSQL *mysql, int status); -int STDCALL mysql_select_db_start(int *ret, MYSQL *mysql, const char *db); -int STDCALL mysql_select_db_cont(int *ret, MYSQL *mysql, int ready_status); -int STDCALL mysql_stmt_warning_count(MYSQL_STMT *stmt); -int STDCALL mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int status); - -int STDCALL mysql_set_character_set_start(int *ret, MYSQL *mysql, - const char *csname); -int STDCALL mysql_set_character_set_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_change_user_start(my_bool *ret, MYSQL *mysql, - const char *user, - const char *passwd, - const char *db); -int STDCALL mysql_change_user_cont(my_bool *ret, MYSQL *mysql, - int status); -int STDCALL mysql_real_connect_start(MYSQL **ret, MYSQL *mysql, - const char *host, - const char *user, - const char *passwd, - const char *db, - unsigned int port, - const char *unix_socket, - unsigned long clientflag); -int STDCALL mysql_real_connect_cont(MYSQL **ret, MYSQL *mysql, - int status); -int STDCALL mysql_query_start(int *ret, MYSQL *mysql, - const char *q); -int STDCALL mysql_query_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_send_query_start(int *ret, MYSQL *mysql, - const char *q, - unsigned long length); -int STDCALL mysql_send_query_cont(int *ret, MYSQL *mysql, int status); -int STDCALL mysql_real_query_start(int *ret, MYSQL *mysql, - const char *q, - unsigned long length); -int STDCALL mysql_real_query_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_store_result_start(MYSQL_RES **ret, MYSQL *mysql); -int STDCALL mysql_store_result_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -int STDCALL mysql_shutdown_start(int *ret, MYSQL *mysql, - enum mysql_enum_shutdown_level - shutdown_level); -int STDCALL mysql_shutdown_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_refresh_start(int *ret, MYSQL *mysql, - unsigned int refresh_options); -int STDCALL mysql_refresh_cont(int *ret, MYSQL *mysql, int status); -int STDCALL mysql_kill_start(int *ret, MYSQL *mysql, - unsigned long pid); -int STDCALL mysql_kill_cont(int *ret, MYSQL *mysql, int status); -int STDCALL mysql_set_server_option_start(int *ret, MYSQL *mysql, - enum enum_mysql_set_option - option); -int STDCALL mysql_set_server_option_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_ping_start(int *ret, MYSQL *mysql); -int STDCALL mysql_ping_cont(int *ret, MYSQL *mysql, int status); -int STDCALL mysql_stat_start(const char **ret, MYSQL *mysql); -int STDCALL mysql_stat_cont(const char **ret, MYSQL *mysql, - int status); -int STDCALL mysql_free_result_start(MYSQL_RES *result); -int STDCALL mysql_free_result_cont(MYSQL_RES *result, int status); -int STDCALL mysql_fetch_row_start(MYSQL_ROW *ret, - MYSQL_RES *result); -int STDCALL mysql_fetch_row_cont(MYSQL_ROW *ret, MYSQL_RES *result, - int status); -int STDCALL mysql_read_query_result_start(my_bool *ret, - MYSQL *mysql); -int STDCALL mysql_read_query_result_cont(my_bool *ret, - MYSQL *mysql, int status); -int STDCALL mysql_reset_connection_start(int *ret, MYSQL *mysql); -int STDCALL mysql_reset_connection_cont(int *ret, MYSQL *mysql, int status); -int STDCALL mysql_session_track_get_next(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length); -int STDCALL mysql_session_track_get_first(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length); -int STDCALL mysql_stmt_prepare_start(int *ret, MYSQL_STMT *stmt,const char *query, unsigned long length); -int STDCALL mysql_stmt_prepare_cont(int *ret, MYSQL_STMT *stmt, int status); -int STDCALL mysql_stmt_execute_start(int *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_execute_cont(int *ret, MYSQL_STMT *stmt, int status); -int STDCALL mysql_stmt_fetch_start(int *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_fetch_cont(int *ret, MYSQL_STMT *stmt, int status); -int STDCALL mysql_stmt_store_result_start(int *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_store_result_cont(int *ret, MYSQL_STMT *stmt,int status); -int STDCALL mysql_stmt_close_start(my_bool *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_close_cont(my_bool *ret, MYSQL_STMT * stmt, int status); -int STDCALL mysql_stmt_reset_start(my_bool *ret, MYSQL_STMT * stmt); -int STDCALL mysql_stmt_reset_cont(my_bool *ret, MYSQL_STMT *stmt, int status); -int STDCALL mysql_stmt_free_result_start(my_bool *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_free_result_cont(my_bool *ret, MYSQL_STMT *stmt, - int status); -int STDCALL mysql_stmt_send_long_data_start(my_bool *ret, MYSQL_STMT *stmt, - unsigned int param_number, - const char *data, - unsigned long len); -int STDCALL mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt, - int status); -int STDCALL mysql_reset_connection(MYSQL *mysql); - -/* API function calls (used by dynmic plugins) */ -struct st_mariadb_api { - unsigned long long (STDCALL *mysql_num_rows)(MYSQL_RES *res); - unsigned int (STDCALL *mysql_num_fields)(MYSQL_RES *res); - my_bool (STDCALL *mysql_eof)(MYSQL_RES *res); - MYSQL_FIELD *(STDCALL *mysql_fetch_field_direct)(MYSQL_RES *res, unsigned int fieldnr); - MYSQL_FIELD * (STDCALL *mysql_fetch_fields)(MYSQL_RES *res); - MYSQL_ROWS * (STDCALL *mysql_row_tell)(MYSQL_RES *res); - unsigned int (STDCALL *mysql_field_tell)(MYSQL_RES *res); - unsigned int (STDCALL *mysql_field_count)(MYSQL *mysql); - my_bool (STDCALL *mysql_more_results)(MYSQL *mysql); - int (STDCALL *mysql_next_result)(MYSQL *mysql); - unsigned long long (STDCALL *mysql_affected_rows)(MYSQL *mysql); - my_bool (STDCALL *mysql_autocommit)(MYSQL *mysql, my_bool mode); - my_bool (STDCALL *mysql_commit)(MYSQL *mysql); - my_bool (STDCALL *mysql_rollback)(MYSQL *mysql); - unsigned long long (STDCALL *mysql_insert_id)(MYSQL *mysql); - unsigned int (STDCALL *mysql_errno)(MYSQL *mysql); - const char * (STDCALL *mysql_error)(MYSQL *mysql); - const char * (STDCALL *mysql_info)(MYSQL *mysql); - unsigned long (STDCALL *mysql_thread_id)(MYSQL *mysql); - const char * (STDCALL *mysql_character_set_name)(MYSQL *mysql); - void (STDCALL *mysql_get_character_set_info)(MYSQL *mysql, MY_CHARSET_INFO *cs); - int (STDCALL *mysql_set_character_set)(MYSQL *mysql, const char *csname); - my_bool (*mariadb_get_infov)(MYSQL *mysql, enum mariadb_value value, void *arg, ...); - my_bool (STDCALL *mariadb_get_info)(MYSQL *mysql, enum mariadb_value value, void *arg); - MYSQL * (STDCALL *mysql_init)(MYSQL *mysql); - int (STDCALL *mysql_ssl_set)(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher); - const char * (STDCALL *mysql_get_ssl_cipher)(MYSQL *mysql); - my_bool (STDCALL *mysql_change_user)(MYSQL *mysql, const char *user, const char *passwd, const char *db); - MYSQL * (STDCALL *mysql_real_connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag); - void (STDCALL *mysql_close)(MYSQL *sock); - int (STDCALL *mysql_select_db)(MYSQL *mysql, const char *db); - int (STDCALL *mysql_query)(MYSQL *mysql, const char *q); - int (STDCALL *mysql_send_query)(MYSQL *mysql, const char *q, unsigned long length); - my_bool (STDCALL *mysql_read_query_result)(MYSQL *mysql); - int (STDCALL *mysql_real_query)(MYSQL *mysql, const char *q, unsigned long length); - int (STDCALL *mysql_shutdown)(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level); - int (STDCALL *mysql_dump_debug_info)(MYSQL *mysql); - int (STDCALL *mysql_refresh)(MYSQL *mysql, unsigned int refresh_options); - int (STDCALL *mysql_kill)(MYSQL *mysql,unsigned long pid); - int (STDCALL *mysql_ping)(MYSQL *mysql); - char * (STDCALL *mysql_stat)(MYSQL *mysql); - char * (STDCALL *mysql_get_server_info)(MYSQL *mysql); - unsigned long (STDCALL *mysql_get_server_version)(MYSQL *mysql); - char * (STDCALL *mysql_get_host_info)(MYSQL *mysql); - unsigned int (STDCALL *mysql_get_proto_info)(MYSQL *mysql); - MYSQL_RES * (STDCALL *mysql_list_dbs)(MYSQL *mysql,const char *wild); - MYSQL_RES * (STDCALL *mysql_list_tables)(MYSQL *mysql,const char *wild); - MYSQL_RES * (STDCALL *mysql_list_fields)(MYSQL *mysql, const char *table, const char *wild); - MYSQL_RES * (STDCALL *mysql_list_processes)(MYSQL *mysql); - MYSQL_RES * (STDCALL *mysql_store_result)(MYSQL *mysql); - MYSQL_RES * (STDCALL *mysql_use_result)(MYSQL *mysql); - int (STDCALL *mysql_options)(MYSQL *mysql,enum mysql_option option, const void *arg); - void (STDCALL *mysql_free_result)(MYSQL_RES *result); - void (STDCALL *mysql_data_seek)(MYSQL_RES *result, unsigned long long offset); - MYSQL_ROW_OFFSET (STDCALL *mysql_row_seek)(MYSQL_RES *result, MYSQL_ROW_OFFSET); - MYSQL_FIELD_OFFSET (STDCALL *mysql_field_seek)(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset); - MYSQL_ROW (STDCALL *mysql_fetch_row)(MYSQL_RES *result); - unsigned long * (STDCALL *mysql_fetch_lengths)(MYSQL_RES *result); - MYSQL_FIELD * (STDCALL *mysql_fetch_field)(MYSQL_RES *result); - unsigned long (STDCALL *mysql_escape_string)(char *to,const char *from, unsigned long from_length); - unsigned long (STDCALL *mysql_real_escape_string)(MYSQL *mysql, char *to,const char *from, unsigned long length); - unsigned int (STDCALL *mysql_thread_safe)(void); - unsigned int (STDCALL *mysql_warning_count)(MYSQL *mysql); - const char * (STDCALL *mysql_sqlstate)(MYSQL *mysql); - int (STDCALL *mysql_server_init)(int argc, char **argv, char **groups); - void (STDCALL *mysql_server_end)(void); - void (STDCALL *mysql_thread_end)(void); - my_bool (STDCALL *mysql_thread_init)(void); - int (STDCALL *mysql_set_server_option)(MYSQL *mysql, enum enum_mysql_set_option option); - const char * (STDCALL *mysql_get_client_info)(void); - unsigned long (STDCALL *mysql_get_client_version)(void); - my_bool (STDCALL *mariadb_connection)(MYSQL *mysql); - const char * (STDCALL *mysql_get_server_name)(MYSQL *mysql); - MARIADB_CHARSET_INFO * (STDCALL *mariadb_get_charset_by_name)(const char *csname); - MARIADB_CHARSET_INFO * (STDCALL *mariadb_get_charset_by_nr)(unsigned int csnr); - size_t (STDCALL *mariadb_convert_string)(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs, char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode); - int (*mysql_optionsv)(MYSQL *mysql,enum mysql_option option, ...); - int (*mysql_get_optionv)(MYSQL *mysql, enum mysql_option option, void *arg, ...); - int (STDCALL *mysql_get_option)(MYSQL *mysql, enum mysql_option option, void *arg); - unsigned long (STDCALL *mysql_hex_string)(char *to, const char *from, unsigned long len); - my_socket (STDCALL *mysql_get_socket)(MYSQL *mysql); - unsigned int (STDCALL *mysql_get_timeout_value)(const MYSQL *mysql); - unsigned int (STDCALL *mysql_get_timeout_value_ms)(const MYSQL *mysql); - my_bool (STDCALL *mariadb_reconnect)(MYSQL *mysql); - MYSQL_STMT * (STDCALL *mysql_stmt_init)(MYSQL *mysql); - int (STDCALL *mysql_stmt_prepare)(MYSQL_STMT *stmt, const char *query, unsigned long length); - int (STDCALL *mysql_stmt_execute)(MYSQL_STMT *stmt); - int (STDCALL *mysql_stmt_fetch)(MYSQL_STMT *stmt); - int (STDCALL *mysql_stmt_fetch_column)(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, unsigned int column, unsigned long offset); - int (STDCALL *mysql_stmt_store_result)(MYSQL_STMT *stmt); - unsigned long (STDCALL *mysql_stmt_param_count)(MYSQL_STMT * stmt); - my_bool (STDCALL *mysql_stmt_attr_set)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr); - my_bool (STDCALL *mysql_stmt_attr_get)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, void *attr); - my_bool (STDCALL *mysql_stmt_bind_param)(MYSQL_STMT * stmt, MYSQL_BIND * bnd); - my_bool (STDCALL *mysql_stmt_bind_result)(MYSQL_STMT * stmt, MYSQL_BIND * bnd); - my_bool (STDCALL *mysql_stmt_close)(MYSQL_STMT * stmt); - my_bool (STDCALL *mysql_stmt_reset)(MYSQL_STMT * stmt); - my_bool (STDCALL *mysql_stmt_free_result)(MYSQL_STMT *stmt); - my_bool (STDCALL *mysql_stmt_send_long_data)(MYSQL_STMT *stmt, unsigned int param_number, const char *data, unsigned long length); - MYSQL_RES *(STDCALL *mysql_stmt_result_metadata)(MYSQL_STMT *stmt); - MYSQL_RES *(STDCALL *mysql_stmt_param_metadata)(MYSQL_STMT *stmt); - unsigned int (STDCALL *mysql_stmt_errno)(MYSQL_STMT * stmt); - const char *(STDCALL *mysql_stmt_error)(MYSQL_STMT * stmt); - const char *(STDCALL *mysql_stmt_sqlstate)(MYSQL_STMT * stmt); - MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_seek)(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset); - MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_tell)(MYSQL_STMT *stmt); - void (STDCALL *mysql_stmt_data_seek)(MYSQL_STMT *stmt, unsigned long long offset); - unsigned long long (STDCALL *mysql_stmt_num_rows)(MYSQL_STMT *stmt); - unsigned long long (STDCALL *mysql_stmt_affected_rows)(MYSQL_STMT *stmt); - unsigned long long (STDCALL *mysql_stmt_insert_id)(MYSQL_STMT *stmt); - unsigned int (STDCALL *mysql_stmt_field_count)(MYSQL_STMT *stmt); - int (STDCALL *mysql_stmt_next_result)(MYSQL_STMT *stmt); - my_bool (STDCALL *mysql_stmt_more_results)(MYSQL_STMT *stmt); - int (STDCALL *mariadb_stmt_execute_direct)(MYSQL_STMT *stmt, const char *stmtstr, size_t length); - int (STDCALL *mysql_reset_connection)(MYSQL *mysql); -}; - -/* these methods can be overwritten by db plugins */ -struct st_mariadb_methods { - MYSQL *(*db_connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd, - const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag); - void (*db_close)(MYSQL *mysql); - int (*db_command)(MYSQL *mysql,enum enum_server_command command, const char *arg, - size_t length, my_bool skipp_check, void *opt_arg); - void (*db_skip_result)(MYSQL *mysql); - int (*db_read_query_result)(MYSQL *mysql); - MYSQL_DATA *(*db_read_rows)(MYSQL *mysql,MYSQL_FIELD *fields, unsigned int field_count); - int (*db_read_one_row)(MYSQL *mysql,unsigned int fields,MYSQL_ROW row, unsigned long *lengths); - /* prepared statements */ - my_bool (*db_supported_buffer_type)(enum enum_field_types type); - my_bool (*db_read_prepare_response)(MYSQL_STMT *stmt); - int (*db_read_stmt_result)(MYSQL *mysql); - my_bool (*db_stmt_get_result_metadata)(MYSQL_STMT *stmt); - my_bool (*db_stmt_get_param_metadata)(MYSQL_STMT *stmt); - int (*db_stmt_read_all_rows)(MYSQL_STMT *stmt); - int (*db_stmt_fetch)(MYSQL_STMT *stmt, unsigned char **row); - int (*db_stmt_fetch_to_bind)(MYSQL_STMT *stmt, unsigned char *row); - void (*db_stmt_flush_unbuffered)(MYSQL_STMT *stmt); - void (*set_error)(MYSQL *mysql, unsigned int error_nr, const char *sqlstate, const char *format, ...); - void (*invalidate_stmts)(MYSQL *mysql, const char *function_name); - struct st_mariadb_api *api; -}; - -/* synonyms/aliases functions */ -#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) -#define mysql_library_init mysql_server_init -#define mysql_library_end mysql_server_end - -/* new api functions */ - -#define HAVE_MYSQL_REAL_CONNECT - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mysql/client_plugin.h b/VCMP-LUA/modules/mariadb/include/mysql/mysql/client_plugin.h deleted file mode 100644 index 72939d2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mysql/client_plugin.h +++ /dev/null @@ -1,244 +0,0 @@ -/* Copyright (C) 2010 - 2012 Sergei Golubchik and Monty Program Ab - 2014 MariaDB Corporation AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not see - or write to the Free Software Foundation, Inc., - 51 Franklin St., Fifth Floor, Boston, MA 02110, USA */ - -/** - @file - - MySQL Client Plugin API - - This file defines the API for plugins that work on the client side -*/ -#ifndef MYSQL_CLIENT_PLUGIN_INCLUDED -#define MYSQL_CLIENT_PLUGIN_INCLUDED - -#ifndef MYSQL_ABI_CHECK -#include -#include -#endif - - -#ifndef PLUGINDIR -#define PLUGINDIR "lib/plugin" -#endif - -#define plugin_declarations_sym "_mysql_client_plugin_declaration_" - -/* known plugin types */ -#define MYSQL_CLIENT_PLUGIN_RESERVED 0 -#define MYSQL_CLIENT_PLUGIN_RESERVED2 1 -#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2 /* authentication */ - -#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0100 -#define MYSQL_CLIENT_MAX_PLUGINS 3 - -/* Connector/C specific plugin types */ -#define MARIADB_CLIENT_REMOTEIO_PLUGIN 100 /* communication IO */ -#define MARIADB_CLIENT_PVIO_PLUGIN 101 -#define MARIADB_CLIENT_TRACE_PLUGIN 102 -#define MARIADB_CLIENT_CONNECTION_PLUGIN 103 - -#define MARIADB_CLIENT_REMOTEIO_PLUGIN_INTERFACE_VERSION 0x0100 -#define MARIADB_CLIENT_PVIO_PLUGIN_INTERFACE_VERSION 0x0100 -#define MARIADB_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION 0x0100 -#define MARIADB_CLIENT_CONNECTION_PLUGIN_INTERFACE_VERSION 0x0100 - -#define MARIADB_CLIENT_MAX_PLUGINS 4 - -#define mysql_declare_client_plugin(X) \ - struct st_mysql_client_plugin_ ## X \ - _mysql_client_plugin_declaration_ = { \ - MYSQL_CLIENT_ ## X ## _PLUGIN, \ - MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION, -#define mysql_end_client_plugin } - -/* generic plugin header structure */ -#ifndef MYSQL_CLIENT_PLUGIN_HEADER -#define MYSQL_CLIENT_PLUGIN_HEADER \ - 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 *); -struct st_mysql_client_plugin -{ - MYSQL_CLIENT_PLUGIN_HEADER -}; -#endif - -struct st_mysql; - -/********* connection handler plugin specific declarations **********/ - -typedef struct st_ma_connection_plugin -{ - MYSQL_CLIENT_PLUGIN_HEADER - /* functions */ - MYSQL *(*connect)(MYSQL *mysql, const char *host, - const char *user, const char *passwd, - const char *db, unsigned int port, - const char *unix_socket, unsigned long clientflag); - void (*close)(MYSQL *mysql); - int (*set_optionsv)(MYSQL *mysql, unsigned int option, ...); - int (*set_connection)(MYSQL *mysql,enum enum_server_command command, - const char *arg, - size_t length, my_bool skipp_check, void *opt_arg); - my_bool (*reconnect)(MYSQL *mysql); - int (*reset)(MYSQL *mysql); -} MARIADB_CONNECTION_PLUGIN; - -#define MARIADB_DB_DRIVER(a) ((a)->ext_db) - -/******************* Communication IO plugin *****************/ -#include - -typedef struct st_mariadb_client_plugin_PVIO -{ - MYSQL_CLIENT_PLUGIN_HEADER - struct st_ma_pvio_methods *methods; -} MARIADB_PVIO_PLUGIN; - -/******** authentication plugin specific declarations *********/ -#include - -struct st_mysql_client_plugin_AUTHENTICATION -{ - MYSQL_CLIENT_PLUGIN_HEADER - int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql); -}; - -/******** trace plugin *******/ -struct st_mysql_client_plugin_TRACE -{ - MYSQL_CLIENT_PLUGIN_HEADER -}; - -/** - type of the mysql_authentication_dialog_ask function - - @param mysql mysql - @param type type of the input - 1 - ordinary string input - 2 - password string - @param prompt prompt - @param buf a buffer to store the use input - @param buf_len the length of the buffer - - @retval a pointer to the user input string. - It may be equal to 'buf' or to 'mysql->password'. - In all other cases it is assumed to be an allocated - string, and the "dialog" plugin will free() it. -*/ -typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql, - int type, const char *prompt, char *buf, int buf_len); - -/********************** remote IO plugin **********************/ -#ifdef HAVE_REMOTEIO -#include - -/* Remote IO plugin */ -typedef struct st_mysql_client_plugin_REMOTEIO -{ - MYSQL_CLIENT_PLUGIN_HEADER - struct st_rio_methods *methods; -} MARIADB_REMOTEIO_PLUGIN; -#endif - -/******** using plugins ************/ - -/** - loads a plugin and initializes it - - @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used, - and last_errno/last_error, for error reporting - @param name a name of the plugin to load - @param type type of plugin that should be loaded, -1 to disable type check - @param argc number of arguments to pass to the plugin initialization - function - @param ... arguments for the plugin initialization function - - @retval - a pointer to the loaded plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * -mysql_load_plugin(struct st_mysql *mysql, const char *name, int type, - int argc, ...); - -/** - loads a plugin and initializes it, taking va_list as an argument - - This is the same as mysql_load_plugin, but take va_list instead of - a list of arguments. - - @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used, - and last_errno/last_error, for error reporting - @param name a name of the plugin to load - @param type type of plugin that should be loaded, -1 to disable type check - @param argc number of arguments to pass to the plugin initialization - function - @param args arguments for the plugin initialization function - - @retval - a pointer to the loaded plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * STDCALL -mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type, - int argc, va_list args); - -/** - finds an already loaded plugin by name, or loads it, if necessary - - @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used, - and last_errno/last_error, for error reporting - @param name a name of the plugin to load - @param type type of plugin that should be loaded - - @retval - a pointer to the plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * STDCALL -mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type); - -/** - adds a plugin structure to the list of loaded plugins - - This is useful if an application has the necessary functionality - (for example, a special load data handler) statically linked into - the application binary. It can use this function to register the plugin - directly, avoiding the need to factor it out into a shared object. - - @param mysql MYSQL structure. It is only used for error reporting - @param plugin an st_mysql_client_plugin structure to register - - @retval - a pointer to the plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * STDCALL -mysql_client_register_plugin(struct st_mysql *mysql, - struct st_mysql_client_plugin *plugin); - -extern struct st_mysql_client_plugin *mysql_client_builtins[]; - -#endif - - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mysql/plugin_auth.h b/VCMP-LUA/modules/mariadb/include/mysql/mysql/plugin_auth.h deleted file mode 100644 index 2be64a6..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mysql/plugin_auth.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED -/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02111-1301, USA */ - -/** - @file - - This file defines constants and data structures that are the same for - both client- and server-side authentication plugins. -*/ -#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED - -/** the max allowed length for a user name */ -#define MYSQL_USERNAME_LENGTH 512 - -/** - return values of the plugin authenticate_user() method. -*/ - -/** - Authentication failed. Additionally, all other CR_xxx values - (libmariadb error code) can be used too. - - The client plugin may set the error code and the error message directly - in the MYSQL structure and return CR_ERROR. If a CR_xxx specific error - code was returned, an error message in the MYSQL structure will be - overwritten. If CR_ERROR is returned without setting the error in MYSQL, - CR_UNKNOWN_ERROR will be user. -*/ -#define CR_ERROR 0 -/** - Authentication (client part) was successful. It does not mean that the - authentication as a whole was successful, usually it only means - that the client was able to send the user name and the password to the - server. If CR_OK is returned, the libmariadb reads the next packet expecting - it to be one of OK, ERROR, or CHANGE_PLUGIN packets. -*/ -#define CR_OK -1 -/** - Authentication was successful. - It means that the client has done its part successfully and also that - a plugin has read the last packet (one of OK, ERROR, CHANGE_PLUGIN). - In this case, libmariadb will not read a packet from the server, - but it will use the data at mysql->net.read_pos. - - A plugin may return this value if the number of roundtrips in the - authentication protocol is not known in advance, and the client plugin - needs to read one packet more to determine if the authentication is finished - or not. -*/ -#define CR_OK_HANDSHAKE_COMPLETE -2 - -typedef struct st_plugin_vio_info -{ - enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, - MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol; - int socket; /**< it's set, if the protocol is SOCKET or TCP */ -#ifdef _WIN32 - HANDLE handle; /**< it's set, if the protocol is PIPE or MEMORY */ -#endif -} MYSQL_PLUGIN_VIO_INFO; - -/** - Provides plugin access to communication channel -*/ -typedef struct st_plugin_vio -{ - /** - Plugin provides a pointer reference and this function sets it to the - contents of any incoming packet. Returns the packet length, or -1 if - the plugin should terminate. - */ - int (*read_packet)(struct st_plugin_vio *vio, - unsigned char **buf); - - /** - Plugin provides a buffer with data and the length and this - function sends it as a packet. Returns 0 on success, 1 on failure. - */ - int (*write_packet)(struct st_plugin_vio *vio, - const unsigned char *packet, - int packet_len); - - /** - Fills in a st_plugin_vio_info structure, providing the information - about the connection. - */ - void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info); - -} MYSQL_PLUGIN_VIO; - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mysql/plugin_auth_common.h b/VCMP-LUA/modules/mariadb/include/mysql/mysql/plugin_auth_common.h deleted file mode 100644 index ee4b8b9..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mysql/plugin_auth_common.h +++ /dev/null @@ -1,110 +0,0 @@ -/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02111-1301, USA */ - - -#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED -/** - @file - - This file defines constants and data structures that are the same for - both client- and server-side authentication plugins. -*/ -#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED - -/** the max allowed length for a user name */ -#define MYSQL_USERNAME_LENGTH 512 - -/** - return values of the plugin authenticate_user() method. -*/ - -/** - Authentication failed. Additionally, all other CR_xxx values - (libmariadb error code) can be used too. - - The client plugin may set the error code and the error message directly - in the MYSQL structure and return CR_ERROR. If a CR_xxx specific error - code was returned, an error message in the MYSQL structure will be - overwritten. If CR_ERROR is returned without setting the error in MYSQL, - CR_UNKNOWN_ERROR will be user. -*/ -#define CR_ERROR 0 -/** - Authentication (client part) was successful. It does not mean that the - authentication as a whole was successful, usually it only means - that the client was able to send the user name and the password to the - server. If CR_OK is returned, the libmariadb reads the next packet expecting - it to be one of OK, ERROR, or CHANGE_PLUGIN packets. -*/ -#define CR_OK -1 -/** - Authentication was successful. - It means that the client has done its part successfully and also that - a plugin has read the last packet (one of OK, ERROR, CHANGE_PLUGIN). - In this case, libmariadb will not read a packet from the server, - but it will use the data at mysql->net.read_pos. - - A plugin may return this value if the number of roundtrips in the - authentication protocol is not known in advance, and the client plugin - needs to read one packet more to determine if the authentication is finished - or not. -*/ -#define CR_OK_HANDSHAKE_COMPLETE -2 - -typedef struct st_plugin_vio_info -{ - enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, - MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol; -#ifndef _WIN32 - int socket; /**< it's set, if the protocol is SOCKET or TCP */ -#else - SOCKET socket; /**< it's set, if the protocol is SOCKET or TCP */ - HANDLE handle; /**< it's set, if the protocol is PIPE or MEMORY */ -#endif -} MYSQL_PLUGIN_VIO_INFO; - -/** - Provides plugin access to communication channel -*/ -typedef struct st_plugin_vio -{ - /** - Plugin provides a pointer reference and this function sets it to the - contents of any incoming packet. Returns the packet length, or -1 if - the plugin should terminate. - */ - int (*read_packet)(struct st_plugin_vio *vio, - unsigned char **buf); - - /** - Plugin provides a buffer with data and the length and this - function sends it as a packet. Returns 0 on success, 1 on failure. - */ - int (*write_packet)(struct st_plugin_vio *vio, - const unsigned char *packet, - int packet_len); - - /** - Fills in a st_plugin_vio_info structure, providing the information - about the connection. - */ - void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info); - -} MYSQL_PLUGIN_VIO; - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mysql_com.h b/VCMP-LUA/modules/mariadb/include/mysql/mysql_com.h deleted file mode 100644 index 09ed396..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mysql_com.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Do not edit this file directly, it was auto-generated by cmake */ - -#warning This file should not be included by clients, include only - -#include - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mysql_version.h b/VCMP-LUA/modules/mariadb/include/mysql/mysql_version.h deleted file mode 100644 index ada3c0d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mysql_version.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Do not edit this file directly, it was auto-generated by cmake */ - -#warning This file should not be included by clients, include only - -#include -#define LIBMYSQL_VERSION MARIADB_CLIENT_VERSION_STR - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/mysqld_error.h b/VCMP-LUA/modules/mariadb/include/mysql/mysqld_error.h deleted file mode 100644 index 04ec2da..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/mysqld_error.h +++ /dev/null @@ -1,1225 +0,0 @@ -/* Autogenerated file, please don't edit */ - -#ifndef ER_ERROR_FIRST -#define ER_ERROR_FIRST 1000 -#define ER_HASHCHK 1000 -#define ER_NISAMCHK 1001 -#define ER_NO 1002 -#define ER_YES 1003 -#define ER_CANT_CREATE_FILE 1004 -#define ER_CANT_CREATE_TABLE 1005 -#define ER_CANT_CREATE_DB 1006 -#define ER_DB_CREATE_EXISTS 1007 -#define ER_DB_DROP_EXISTS 1008 -#define ER_DB_DROP_DELETE 1009 -#define ER_DB_DROP_RMDIR 1010 -#define ER_CANT_DELETE_FILE 1011 -#define ER_CANT_FIND_SYSTEM_REC 1012 -#define ER_CANT_GET_STAT 1013 -#define ER_CANT_GET_WD 1014 -#define ER_CANT_LOCK 1015 -#define ER_CANT_OPEN_FILE 1016 -#define ER_FILE_NOT_FOUND 1017 -#define ER_CANT_READ_DIR 1018 -#define ER_CANT_SET_WD 1019 -#define ER_CHECKREAD 1020 -#define ER_DISK_FULL 1021 -#define ER_DUP_KEY 1022 -#define ER_ERROR_ON_CLOSE 1023 -#define ER_ERROR_ON_READ 1024 -#define ER_ERROR_ON_RENAME 1025 -#define ER_ERROR_ON_WRITE 1026 -#define ER_FILE_USED 1027 -#define ER_FILSORT_ABORT 1028 -#define ER_FORM_NOT_FOUND 1029 -#define ER_GET_ERRNO 1030 -#define ER_ILLEGAL_HA 1031 -#define ER_KEY_NOT_FOUND 1032 -#define ER_NOT_FORM_FILE 1033 -#define ER_NOT_KEYFILE 1034 -#define ER_OLD_KEYFILE 1035 -#define ER_OPEN_AS_READONLY 1036 -#define ER_OUTOFMEMORY 1037 -#define ER_OUT_OF_SORTMEMORY 1038 -#define ER_UNEXPECTED_EOF 1039 -#define ER_CON_COUNT_ERROR 1040 -#define ER_OUT_OF_RESOURCES 1041 -#define ER_BAD_HOST_ERROR 1042 -#define ER_HANDSHAKE_ERROR 1043 -#define ER_DBACCESS_DENIED_ERROR 1044 -#define ER_ACCESS_DENIED_ERROR 1045 -#define ER_NO_DB_ERROR 1046 -#define ER_UNKNOWN_COM_ERROR 1047 -#define ER_BAD_NULL_ERROR 1048 -#define ER_BAD_DB_ERROR 1049 -#define ER_TABLE_EXISTS_ERROR 1050 -#define ER_BAD_TABLE_ERROR 1051 -#define ER_NON_UNIQ_ERROR 1052 -#define ER_SERVER_SHUTDOWN 1053 -#define ER_BAD_FIELD_ERROR 1054 -#define ER_WRONG_FIELD_WITH_GROUP 1055 -#define ER_WRONG_GROUP_FIELD 1056 -#define ER_WRONG_SUM_SELECT 1057 -#define ER_WRONG_VALUE_COUNT 1058 -#define ER_TOO_LONG_IDENT 1059 -#define ER_DUP_FIELDNAME 1060 -#define ER_DUP_KEYNAME 1061 -#define ER_DUP_ENTRY 1062 -#define ER_WRONG_FIELD_SPEC 1063 -#define ER_PARSE_ERROR 1064 -#define ER_EMPTY_QUERY 1065 -#define ER_NONUNIQ_TABLE 1066 -#define ER_INVALID_DEFAULT 1067 -#define ER_MULTIPLE_PRI_KEY 1068 -#define ER_TOO_MANY_KEYS 1069 -#define ER_TOO_MANY_KEY_PARTS 1070 -#define ER_TOO_LONG_KEY 1071 -#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072 -#define ER_BLOB_USED_AS_KEY 1073 -#define ER_TOO_BIG_FIELDLENGTH 1074 -#define ER_WRONG_AUTO_KEY 1075 -#define ER_BINLOG_CANT_DELETE_GTID_DOMAIN 1076 -#define ER_NORMAL_SHUTDOWN 1077 -#define ER_GOT_SIGNAL 1078 -#define ER_SHUTDOWN_COMPLETE 1079 -#define ER_FORCING_CLOSE 1080 -#define ER_IPSOCK_ERROR 1081 -#define ER_NO_SUCH_INDEX 1082 -#define ER_WRONG_FIELD_TERMINATORS 1083 -#define ER_BLOBS_AND_NO_TERMINATED 1084 -#define ER_TEXTFILE_NOT_READABLE 1085 -#define ER_FILE_EXISTS_ERROR 1086 -#define ER_LOAD_INFO 1087 -#define ER_ALTER_INFO 1088 -#define ER_WRONG_SUB_KEY 1089 -#define ER_CANT_REMOVE_ALL_FIELDS 1090 -#define ER_CANT_DROP_FIELD_OR_KEY 1091 -#define ER_INSERT_INFO 1092 -#define ER_UPDATE_TABLE_USED 1093 -#define ER_NO_SUCH_THREAD 1094 -#define ER_KILL_DENIED_ERROR 1095 -#define ER_NO_TABLES_USED 1096 -#define ER_TOO_BIG_SET 1097 -#define ER_NO_UNIQUE_LOGFILE 1098 -#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099 -#define ER_TABLE_NOT_LOCKED 1100 -#define ER_UNUSED_17 1101 -#define ER_WRONG_DB_NAME 1102 -#define ER_WRONG_TABLE_NAME 1103 -#define ER_TOO_BIG_SELECT 1104 -#define ER_UNKNOWN_ERROR 1105 -#define ER_UNKNOWN_PROCEDURE 1106 -#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107 -#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108 -#define ER_UNKNOWN_TABLE 1109 -#define ER_FIELD_SPECIFIED_TWICE 1110 -#define ER_INVALID_GROUP_FUNC_USE 1111 -#define ER_UNSUPPORTED_EXTENSION 1112 -#define ER_TABLE_MUST_HAVE_COLUMNS 1113 -#define ER_RECORD_FILE_FULL 1114 -#define ER_UNKNOWN_CHARACTER_SET 1115 -#define ER_TOO_MANY_TABLES 1116 -#define ER_TOO_MANY_FIELDS 1117 -#define ER_TOO_BIG_ROWSIZE 1118 -#define ER_STACK_OVERRUN 1119 -#define ER_WRONG_OUTER_JOIN 1120 -#define ER_NULL_COLUMN_IN_INDEX 1121 -#define ER_CANT_FIND_UDF 1122 -#define ER_CANT_INITIALIZE_UDF 1123 -#define ER_UDF_NO_PATHS 1124 -#define ER_UDF_EXISTS 1125 -#define ER_CANT_OPEN_LIBRARY 1126 -#define ER_CANT_FIND_DL_ENTRY 1127 -#define ER_FUNCTION_NOT_DEFINED 1128 -#define ER_HOST_IS_BLOCKED 1129 -#define ER_HOST_NOT_PRIVILEGED 1130 -#define ER_PASSWORD_ANONYMOUS_USER 1131 -#define ER_PASSWORD_NOT_ALLOWED 1132 -#define ER_PASSWORD_NO_MATCH 1133 -#define ER_UPDATE_INFO 1134 -#define ER_CANT_CREATE_THREAD 1135 -#define ER_WRONG_VALUE_COUNT_ON_ROW 1136 -#define ER_CANT_REOPEN_TABLE 1137 -#define ER_INVALID_USE_OF_NULL 1138 -#define ER_REGEXP_ERROR 1139 -#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140 -#define ER_NONEXISTING_GRANT 1141 -#define ER_TABLEACCESS_DENIED_ERROR 1142 -#define ER_COLUMNACCESS_DENIED_ERROR 1143 -#define ER_ILLEGAL_GRANT_FOR_TABLE 1144 -#define ER_GRANT_WRONG_HOST_OR_USER 1145 -#define ER_NO_SUCH_TABLE 1146 -#define ER_NONEXISTING_TABLE_GRANT 1147 -#define ER_NOT_ALLOWED_COMMAND 1148 -#define ER_SYNTAX_ERROR 1149 -#define ER_DELAYED_CANT_CHANGE_LOCK 1150 -#define ER_TOO_MANY_DELAYED_THREADS 1151 -#define ER_ABORTING_CONNECTION 1152 -#define ER_NET_PACKET_TOO_LARGE 1153 -#define ER_NET_READ_ERROR_FROM_PIPE 1154 -#define ER_NET_FCNTL_ERROR 1155 -#define ER_NET_PACKETS_OUT_OF_ORDER 1156 -#define ER_NET_UNCOMPRESS_ERROR 1157 -#define ER_NET_READ_ERROR 1158 -#define ER_NET_READ_INTERRUPTED 1159 -#define ER_NET_ERROR_ON_WRITE 1160 -#define ER_NET_WRITE_INTERRUPTED 1161 -#define ER_TOO_LONG_STRING 1162 -#define ER_TABLE_CANT_HANDLE_BLOB 1163 -#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164 -#define ER_DELAYED_INSERT_TABLE_LOCKED 1165 -#define ER_WRONG_COLUMN_NAME 1166 -#define ER_WRONG_KEY_COLUMN 1167 -#define ER_WRONG_MRG_TABLE 1168 -#define ER_DUP_UNIQUE 1169 -#define ER_BLOB_KEY_WITHOUT_LENGTH 1170 -#define ER_PRIMARY_CANT_HAVE_NULL 1171 -#define ER_TOO_MANY_ROWS 1172 -#define ER_REQUIRES_PRIMARY_KEY 1173 -#define ER_NO_RAID_COMPILED 1174 -#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175 -#define ER_KEY_DOES_NOT_EXISTS 1176 -#define ER_CHECK_NO_SUCH_TABLE 1177 -#define ER_CHECK_NOT_IMPLEMENTED 1178 -#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 -#define ER_ERROR_DURING_COMMIT 1180 -#define ER_ERROR_DURING_ROLLBACK 1181 -#define ER_ERROR_DURING_FLUSH_LOGS 1182 -#define ER_ERROR_DURING_CHECKPOINT 1183 -#define ER_NEW_ABORTING_CONNECTION 1184 -#define ER_UNUSED_10 1185 -#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186 -#define ER_INDEX_REBUILD 1187 -#define ER_MASTER 1188 -#define ER_MASTER_NET_READ 1189 -#define ER_MASTER_NET_WRITE 1190 -#define ER_FT_MATCHING_KEY_NOT_FOUND 1191 -#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192 -#define ER_UNKNOWN_SYSTEM_VARIABLE 1193 -#define ER_CRASHED_ON_USAGE 1194 -#define ER_CRASHED_ON_REPAIR 1195 -#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196 -#define ER_TRANS_CACHE_FULL 1197 -#define ER_SLAVE_MUST_STOP 1198 -#define ER_SLAVE_NOT_RUNNING 1199 -#define ER_BAD_SLAVE 1200 -#define ER_MASTER_INFO 1201 -#define ER_SLAVE_THREAD 1202 -#define ER_TOO_MANY_USER_CONNECTIONS 1203 -#define ER_SET_CONSTANTS_ONLY 1204 -#define ER_LOCK_WAIT_TIMEOUT 1205 -#define ER_LOCK_TABLE_FULL 1206 -#define ER_READ_ONLY_TRANSACTION 1207 -#define ER_DROP_DB_WITH_READ_LOCK 1208 -#define ER_CREATE_DB_WITH_READ_LOCK 1209 -#define ER_WRONG_ARGUMENTS 1210 -#define ER_NO_PERMISSION_TO_CREATE_USER 1211 -#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 -#define ER_LOCK_DEADLOCK 1213 -#define ER_TABLE_CANT_HANDLE_FT 1214 -#define ER_CANNOT_ADD_FOREIGN 1215 -#define ER_NO_REFERENCED_ROW 1216 -#define ER_ROW_IS_REFERENCED 1217 -#define ER_CONNECT_TO_MASTER 1218 -#define ER_QUERY_ON_MASTER 1219 -#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220 -#define ER_WRONG_USAGE 1221 -#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222 -#define ER_CANT_UPDATE_WITH_READLOCK 1223 -#define ER_MIXING_NOT_ALLOWED 1224 -#define ER_DUP_ARGUMENT 1225 -#define ER_USER_LIMIT_REACHED 1226 -#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 -#define ER_LOCAL_VARIABLE 1228 -#define ER_GLOBAL_VARIABLE 1229 -#define ER_NO_DEFAULT 1230 -#define ER_WRONG_VALUE_FOR_VAR 1231 -#define ER_WRONG_TYPE_FOR_VAR 1232 -#define ER_VAR_CANT_BE_READ 1233 -#define ER_CANT_USE_OPTION_HERE 1234 -#define ER_NOT_SUPPORTED_YET 1235 -#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 -#define ER_SLAVE_IGNORED_TABLE 1237 -#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238 -#define ER_WRONG_FK_DEF 1239 -#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240 -#define ER_OPERAND_COLUMNS 1241 -#define ER_SUBQUERY_NO_1_ROW 1242 -#define ER_UNKNOWN_STMT_HANDLER 1243 -#define ER_CORRUPT_HELP_DB 1244 -#define ER_CYCLIC_REFERENCE 1245 -#define ER_AUTO_CONVERT 1246 -#define ER_ILLEGAL_REFERENCE 1247 -#define ER_DERIVED_MUST_HAVE_ALIAS 1248 -#define ER_SELECT_REDUCED 1249 -#define ER_TABLENAME_NOT_ALLOWED_HERE 1250 -#define ER_NOT_SUPPORTED_AUTH_MODE 1251 -#define ER_SPATIAL_CANT_HAVE_NULL 1252 -#define ER_COLLATION_CHARSET_MISMATCH 1253 -#define ER_SLAVE_WAS_RUNNING 1254 -#define ER_SLAVE_WAS_NOT_RUNNING 1255 -#define ER_TOO_BIG_FOR_UNCOMPRESS 1256 -#define ER_ZLIB_Z_MEM_ERROR 1257 -#define ER_ZLIB_Z_BUF_ERROR 1258 -#define ER_ZLIB_Z_DATA_ERROR 1259 -#define ER_CUT_VALUE_GROUP_CONCAT 1260 -#define ER_WARN_TOO_FEW_RECORDS 1261 -#define ER_WARN_TOO_MANY_RECORDS 1262 -#define ER_WARN_NULL_TO_NOTNULL 1263 -#define ER_WARN_DATA_OUT_OF_RANGE 1264 -#define WARN_DATA_TRUNCATED 1265 -#define ER_WARN_USING_OTHER_HANDLER 1266 -#define ER_CANT_AGGREGATE_2COLLATIONS 1267 -#define ER_DROP_USER 1268 -#define ER_REVOKE_GRANTS 1269 -#define ER_CANT_AGGREGATE_3COLLATIONS 1270 -#define ER_CANT_AGGREGATE_NCOLLATIONS 1271 -#define ER_VARIABLE_IS_NOT_STRUCT 1272 -#define ER_UNKNOWN_COLLATION 1273 -#define ER_SLAVE_IGNORED_SSL_PARAMS 1274 -#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275 -#define ER_WARN_FIELD_RESOLVED 1276 -#define ER_BAD_SLAVE_UNTIL_COND 1277 -#define ER_MISSING_SKIP_SLAVE 1278 -#define ER_UNTIL_COND_IGNORED 1279 -#define ER_WRONG_NAME_FOR_INDEX 1280 -#define ER_WRONG_NAME_FOR_CATALOG 1281 -#define ER_WARN_QC_RESIZE 1282 -#define ER_BAD_FT_COLUMN 1283 -#define ER_UNKNOWN_KEY_CACHE 1284 -#define ER_WARN_HOSTNAME_WONT_WORK 1285 -#define ER_UNKNOWN_STORAGE_ENGINE 1286 -#define ER_WARN_DEPRECATED_SYNTAX 1287 -#define ER_NON_UPDATABLE_TABLE 1288 -#define ER_FEATURE_DISABLED 1289 -#define ER_OPTION_PREVENTS_STATEMENT 1290 -#define ER_DUPLICATED_VALUE_IN_TYPE 1291 -#define ER_TRUNCATED_WRONG_VALUE 1292 -#define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293 -#define ER_INVALID_ON_UPDATE 1294 -#define ER_UNSUPPORTED_PS 1295 -#define ER_GET_ERRMSG 1296 -#define ER_GET_TEMPORARY_ERRMSG 1297 -#define ER_UNKNOWN_TIME_ZONE 1298 -#define ER_WARN_INVALID_TIMESTAMP 1299 -#define ER_INVALID_CHARACTER_STRING 1300 -#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 -#define ER_CONFLICTING_DECLARATIONS 1302 -#define ER_SP_NO_RECURSIVE_CREATE 1303 -#define ER_SP_ALREADY_EXISTS 1304 -#define ER_SP_DOES_NOT_EXIST 1305 -#define ER_SP_DROP_FAILED 1306 -#define ER_SP_STORE_FAILED 1307 -#define ER_SP_LILABEL_MISMATCH 1308 -#define ER_SP_LABEL_REDEFINE 1309 -#define ER_SP_LABEL_MISMATCH 1310 -#define ER_SP_UNINIT_VAR 1311 -#define ER_SP_BADSELECT 1312 -#define ER_SP_BADRETURN 1313 -#define ER_SP_BADSTATEMENT 1314 -#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1315 -#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1316 -#define ER_QUERY_INTERRUPTED 1317 -#define ER_SP_WRONG_NO_OF_ARGS 1318 -#define ER_SP_COND_MISMATCH 1319 -#define ER_SP_NORETURN 1320 -#define ER_SP_NORETURNEND 1321 -#define ER_SP_BAD_CURSOR_QUERY 1322 -#define ER_SP_BAD_CURSOR_SELECT 1323 -#define ER_SP_CURSOR_MISMATCH 1324 -#define ER_SP_CURSOR_ALREADY_OPEN 1325 -#define ER_SP_CURSOR_NOT_OPEN 1326 -#define ER_SP_UNDECLARED_VAR 1327 -#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1328 -#define ER_SP_FETCH_NO_DATA 1329 -#define ER_SP_DUP_PARAM 1330 -#define ER_SP_DUP_VAR 1331 -#define ER_SP_DUP_COND 1332 -#define ER_SP_DUP_CURS 1333 -#define ER_SP_CANT_ALTER 1334 -#define ER_SP_SUBSELECT_NYI 1335 -#define ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 1336 -#define ER_SP_VARCOND_AFTER_CURSHNDLR 1337 -#define ER_SP_CURSOR_AFTER_HANDLER 1338 -#define ER_SP_CASE_NOT_FOUND 1339 -#define ER_FPARSER_TOO_BIG_FILE 1340 -#define ER_FPARSER_BAD_HEADER 1341 -#define ER_FPARSER_EOF_IN_COMMENT 1342 -#define ER_FPARSER_ERROR_IN_PARAMETER 1343 -#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1344 -#define ER_VIEW_NO_EXPLAIN 1345 -#define ER_FRM_UNKNOWN_TYPE 1346 -#define ER_WRONG_OBJECT 1347 -#define ER_NONUPDATEABLE_COLUMN 1348 -#define ER_VIEW_SELECT_DERIVED 1349 -#define ER_VIEW_SELECT_CLAUSE 1350 -#define ER_VIEW_SELECT_VARIABLE 1351 -#define ER_VIEW_SELECT_TMPTABLE 1352 -#define ER_VIEW_WRONG_LIST 1353 -#define ER_WARN_VIEW_MERGE 1354 -#define ER_WARN_VIEW_WITHOUT_KEY 1355 -#define ER_VIEW_INVALID 1356 -#define ER_SP_NO_DROP_SP 1357 -#define ER_SP_GOTO_IN_HNDLR 1358 -#define ER_TRG_ALREADY_EXISTS 1359 -#define ER_TRG_DOES_NOT_EXIST 1360 -#define ER_TRG_ON_VIEW_OR_TEMP_TABLE 1361 -#define ER_TRG_CANT_CHANGE_ROW 1362 -#define ER_TRG_NO_SUCH_ROW_IN_TRG 1363 -#define ER_NO_DEFAULT_FOR_FIELD 1364 -#define ER_DIVISION_BY_ZERO 1365 -#define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366 -#define ER_ILLEGAL_VALUE_FOR_TYPE 1367 -#define ER_VIEW_NONUPD_CHECK 1368 -#define ER_VIEW_CHECK_FAILED 1369 -#define ER_PROCACCESS_DENIED_ERROR 1370 -#define ER_RELAY_LOG_FAIL 1371 -#define ER_PASSWD_LENGTH 1372 -#define ER_UNKNOWN_TARGET_BINLOG 1373 -#define ER_IO_ERR_LOG_INDEX_READ 1374 -#define ER_BINLOG_PURGE_PROHIBITED 1375 -#define ER_FSEEK_FAIL 1376 -#define ER_BINLOG_PURGE_FATAL_ERR 1377 -#define ER_LOG_IN_USE 1378 -#define ER_LOG_PURGE_UNKNOWN_ERR 1379 -#define ER_RELAY_LOG_INIT 1380 -#define ER_NO_BINARY_LOGGING 1381 -#define ER_RESERVED_SYNTAX 1382 -#define ER_WSAS_FAILED 1383 -#define ER_DIFF_GROUPS_PROC 1384 -#define ER_NO_GROUP_FOR_PROC 1385 -#define ER_ORDER_WITH_PROC 1386 -#define ER_LOGGING_PROHIBIT_CHANGING_OF 1387 -#define ER_NO_FILE_MAPPING 1388 -#define ER_WRONG_MAGIC 1389 -#define ER_PS_MANY_PARAM 1390 -#define ER_KEY_PART_0 1391 -#define ER_VIEW_CHECKSUM 1392 -#define ER_VIEW_MULTIUPDATE 1393 -#define ER_VIEW_NO_INSERT_FIELD_LIST 1394 -#define ER_VIEW_DELETE_MERGE_VIEW 1395 -#define ER_CANNOT_USER 1396 -#define ER_XAER_NOTA 1397 -#define ER_XAER_INVAL 1398 -#define ER_XAER_RMFAIL 1399 -#define ER_XAER_OUTSIDE 1400 -#define ER_XAER_RMERR 1401 -#define ER_XA_RBROLLBACK 1402 -#define ER_NONEXISTING_PROC_GRANT 1403 -#define ER_PROC_AUTO_GRANT_FAIL 1404 -#define ER_PROC_AUTO_REVOKE_FAIL 1405 -#define ER_DATA_TOO_LONG 1406 -#define ER_SP_BAD_SQLSTATE 1407 -#define ER_STARTUP 1408 -#define ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR 1409 -#define ER_CANT_CREATE_USER_WITH_GRANT 1410 -#define ER_WRONG_VALUE_FOR_TYPE 1411 -#define ER_TABLE_DEF_CHANGED 1412 -#define ER_SP_DUP_HANDLER 1413 -#define ER_SP_NOT_VAR_ARG 1414 -#define ER_SP_NO_RETSET 1415 -#define ER_CANT_CREATE_GEOMETRY_OBJECT 1416 -#define ER_FAILED_ROUTINE_BREAK_BINLOG 1417 -#define ER_BINLOG_UNSAFE_ROUTINE 1418 -#define ER_BINLOG_CREATE_ROUTINE_NEED_SUPER 1419 -#define ER_EXEC_STMT_WITH_OPEN_CURSOR 1420 -#define ER_STMT_HAS_NO_OPEN_CURSOR 1421 -#define ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG 1422 -#define ER_NO_DEFAULT_FOR_VIEW_FIELD 1423 -#define ER_SP_NO_RECURSION 1424 -#define ER_TOO_BIG_SCALE 1425 -#define ER_TOO_BIG_PRECISION 1426 -#define ER_M_BIGGER_THAN_D 1427 -#define ER_WRONG_LOCK_OF_SYSTEM_TABLE 1428 -#define ER_CONNECT_TO_FOREIGN_DATA_SOURCE 1429 -#define ER_QUERY_ON_FOREIGN_DATA_SOURCE 1430 -#define ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST 1431 -#define ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE 1432 -#define ER_FOREIGN_DATA_STRING_INVALID 1433 -#define ER_CANT_CREATE_FEDERATED_TABLE 1434 -#define ER_TRG_IN_WRONG_SCHEMA 1435 -#define ER_STACK_OVERRUN_NEED_MORE 1436 -#define ER_TOO_LONG_BODY 1437 -#define ER_WARN_CANT_DROP_DEFAULT_KEYCACHE 1438 -#define ER_TOO_BIG_DISPLAYWIDTH 1439 -#define ER_XAER_DUPID 1440 -#define ER_DATETIME_FUNCTION_OVERFLOW 1441 -#define ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG 1442 -#define ER_VIEW_PREVENT_UPDATE 1443 -#define ER_PS_NO_RECURSION 1444 -#define ER_SP_CANT_SET_AUTOCOMMIT 1445 -#define ER_MALFORMED_DEFINER 1446 -#define ER_VIEW_FRM_NO_USER 1447 -#define ER_VIEW_OTHER_USER 1448 -#define ER_NO_SUCH_USER 1449 -#define ER_FORBID_SCHEMA_CHANGE 1450 -#define ER_ROW_IS_REFERENCED_2 1451 -#define ER_NO_REFERENCED_ROW_2 1452 -#define ER_SP_BAD_VAR_SHADOW 1453 -#define ER_TRG_NO_DEFINER 1454 -#define ER_OLD_FILE_FORMAT 1455 -#define ER_SP_RECURSION_LIMIT 1456 -#define ER_SP_PROC_TABLE_CORRUPT 1457 -#define ER_SP_WRONG_NAME 1458 -#define ER_TABLE_NEEDS_UPGRADE 1459 -#define ER_SP_NO_AGGREGATE 1460 -#define ER_MAX_PREPARED_STMT_COUNT_REACHED 1461 -#define ER_VIEW_RECURSIVE 1462 -#define ER_NON_GROUPING_FIELD_USED 1463 -#define ER_TABLE_CANT_HANDLE_SPKEYS 1464 -#define ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA 1465 -#define ER_REMOVED_SPACES 1466 -#define ER_AUTOINC_READ_FAILED 1467 -#define ER_USERNAME 1468 -#define ER_HOSTNAME 1469 -#define ER_WRONG_STRING_LENGTH 1470 -#define ER_NON_INSERTABLE_TABLE 1471 -#define ER_ADMIN_WRONG_MRG_TABLE 1472 -#define ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT 1473 -#define ER_NAME_BECOMES_EMPTY 1474 -#define ER_AMBIGUOUS_FIELD_TERM 1475 -#define ER_FOREIGN_SERVER_EXISTS 1476 -#define ER_FOREIGN_SERVER_DOESNT_EXIST 1477 -#define ER_ILLEGAL_HA_CREATE_OPTION 1478 -#define ER_PARTITION_REQUIRES_VALUES_ERROR 1479 -#define ER_PARTITION_WRONG_VALUES_ERROR 1480 -#define ER_PARTITION_MAXVALUE_ERROR 1481 -#define ER_PARTITION_SUBPARTITION_ERROR 1482 -#define ER_PARTITION_SUBPART_MIX_ERROR 1483 -#define ER_PARTITION_WRONG_NO_PART_ERROR 1484 -#define ER_PARTITION_WRONG_NO_SUBPART_ERROR 1485 -#define ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR 1486 -#define ER_NOT_CONSTANT_EXPRESSION 1487 -#define ER_FIELD_NOT_FOUND_PART_ERROR 1488 -#define ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR 1489 -#define ER_INCONSISTENT_PARTITION_INFO_ERROR 1490 -#define ER_PARTITION_FUNC_NOT_ALLOWED_ERROR 1491 -#define ER_PARTITIONS_MUST_BE_DEFINED_ERROR 1492 -#define ER_RANGE_NOT_INCREASING_ERROR 1493 -#define ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR 1494 -#define ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR 1495 -#define ER_PARTITION_ENTRY_ERROR 1496 -#define ER_MIX_HANDLER_ERROR 1497 -#define ER_PARTITION_NOT_DEFINED_ERROR 1498 -#define ER_TOO_MANY_PARTITIONS_ERROR 1499 -#define ER_SUBPARTITION_ERROR 1500 -#define ER_CANT_CREATE_HANDLER_FILE 1501 -#define ER_BLOB_FIELD_IN_PART_FUNC_ERROR 1502 -#define ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF 1503 -#define ER_NO_PARTS_ERROR 1504 -#define ER_PARTITION_MGMT_ON_NONPARTITIONED 1505 -#define ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING 1506 -#define ER_DROP_PARTITION_NON_EXISTENT 1507 -#define ER_DROP_LAST_PARTITION 1508 -#define ER_COALESCE_ONLY_ON_HASH_PARTITION 1509 -#define ER_REORG_HASH_ONLY_ON_SAME_NO 1510 -#define ER_REORG_NO_PARAM_ERROR 1511 -#define ER_ONLY_ON_RANGE_LIST_PARTITION 1512 -#define ER_ADD_PARTITION_SUBPART_ERROR 1513 -#define ER_ADD_PARTITION_NO_NEW_PARTITION 1514 -#define ER_COALESCE_PARTITION_NO_PARTITION 1515 -#define ER_REORG_PARTITION_NOT_EXIST 1516 -#define ER_SAME_NAME_PARTITION 1517 -#define ER_NO_BINLOG_ERROR 1518 -#define ER_CONSECUTIVE_REORG_PARTITIONS 1519 -#define ER_REORG_OUTSIDE_RANGE 1520 -#define ER_PARTITION_FUNCTION_FAILURE 1521 -#define ER_PART_STATE_ERROR 1522 -#define ER_LIMITED_PART_RANGE 1523 -#define ER_PLUGIN_IS_NOT_LOADED 1524 -#define ER_WRONG_VALUE 1525 -#define ER_NO_PARTITION_FOR_GIVEN_VALUE 1526 -#define ER_FILEGROUP_OPTION_ONLY_ONCE 1527 -#define ER_CREATE_FILEGROUP_FAILED 1528 -#define ER_DROP_FILEGROUP_FAILED 1529 -#define ER_TABLESPACE_AUTO_EXTEND_ERROR 1530 -#define ER_WRONG_SIZE_NUMBER 1531 -#define ER_SIZE_OVERFLOW_ERROR 1532 -#define ER_ALTER_FILEGROUP_FAILED 1533 -#define ER_BINLOG_ROW_LOGGING_FAILED 1534 -#define ER_BINLOG_ROW_WRONG_TABLE_DEF 1535 -#define ER_BINLOG_ROW_RBR_TO_SBR 1536 -#define ER_EVENT_ALREADY_EXISTS 1537 -#define ER_EVENT_STORE_FAILED 1538 -#define ER_EVENT_DOES_NOT_EXIST 1539 -#define ER_EVENT_CANT_ALTER 1540 -#define ER_EVENT_DROP_FAILED 1541 -#define ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG 1542 -#define ER_EVENT_ENDS_BEFORE_STARTS 1543 -#define ER_EVENT_EXEC_TIME_IN_THE_PAST 1544 -#define ER_EVENT_OPEN_TABLE_FAILED 1545 -#define ER_EVENT_NEITHER_M_EXPR_NOR_M_AT 1546 -#define ER_UNUSED_2 1547 -#define ER_UNUSED_3 1548 -#define ER_EVENT_CANNOT_DELETE 1549 -#define ER_EVENT_COMPILE_ERROR 1550 -#define ER_EVENT_SAME_NAME 1551 -#define ER_EVENT_DATA_TOO_LONG 1552 -#define ER_DROP_INDEX_FK 1553 -#define ER_WARN_DEPRECATED_SYNTAX_WITH_VER 1554 -#define ER_CANT_WRITE_LOCK_LOG_TABLE 1555 -#define ER_CANT_LOCK_LOG_TABLE 1556 -#define ER_UNUSED_4 1557 -#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE 1558 -#define ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR 1559 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT 1560 -#define ER_UNUSED_13 1561 -#define ER_PARTITION_NO_TEMPORARY 1562 -#define ER_PARTITION_CONST_DOMAIN_ERROR 1563 -#define ER_PARTITION_FUNCTION_IS_NOT_ALLOWED 1564 -#define ER_DDL_LOG_ERROR 1565 -#define ER_NULL_IN_VALUES_LESS_THAN 1566 -#define ER_WRONG_PARTITION_NAME 1567 -#define ER_CANT_CHANGE_TX_CHARACTERISTICS 1568 -#define ER_DUP_ENTRY_AUTOINCREMENT_CASE 1569 -#define ER_EVENT_MODIFY_QUEUE_ERROR 1570 -#define ER_EVENT_SET_VAR_ERROR 1571 -#define ER_PARTITION_MERGE_ERROR 1572 -#define ER_CANT_ACTIVATE_LOG 1573 -#define ER_RBR_NOT_AVAILABLE 1574 -#define ER_BASE64_DECODE_ERROR 1575 -#define ER_EVENT_RECURSION_FORBIDDEN 1576 -#define ER_EVENTS_DB_ERROR 1577 -#define ER_ONLY_INTEGERS_ALLOWED 1578 -#define ER_UNSUPORTED_LOG_ENGINE 1579 -#define ER_BAD_LOG_STATEMENT 1580 -#define ER_CANT_RENAME_LOG_TABLE 1581 -#define ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 1582 -#define ER_WRONG_PARAMETERS_TO_NATIVE_FCT 1583 -#define ER_WRONG_PARAMETERS_TO_STORED_FCT 1584 -#define ER_NATIVE_FCT_NAME_COLLISION 1585 -#define ER_DUP_ENTRY_WITH_KEY_NAME 1586 -#define ER_BINLOG_PURGE_EMFILE 1587 -#define ER_EVENT_CANNOT_CREATE_IN_THE_PAST 1588 -#define ER_EVENT_CANNOT_ALTER_IN_THE_PAST 1589 -#define ER_SLAVE_INCIDENT 1590 -#define ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT 1591 -#define ER_BINLOG_UNSAFE_STATEMENT 1592 -#define ER_SLAVE_FATAL_ERROR 1593 -#define ER_SLAVE_RELAY_LOG_READ_FAILURE 1594 -#define ER_SLAVE_RELAY_LOG_WRITE_FAILURE 1595 -#define ER_SLAVE_CREATE_EVENT_FAILURE 1596 -#define ER_SLAVE_MASTER_COM_FAILURE 1597 -#define ER_BINLOG_LOGGING_IMPOSSIBLE 1598 -#define ER_VIEW_NO_CREATION_CTX 1599 -#define ER_VIEW_INVALID_CREATION_CTX 1600 -#define ER_SR_INVALID_CREATION_CTX 1601 -#define ER_TRG_CORRUPTED_FILE 1602 -#define ER_TRG_NO_CREATION_CTX 1603 -#define ER_TRG_INVALID_CREATION_CTX 1604 -#define ER_EVENT_INVALID_CREATION_CTX 1605 -#define ER_TRG_CANT_OPEN_TABLE 1606 -#define ER_CANT_CREATE_SROUTINE 1607 -#define ER_UNUSED_11 1608 -#define ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT 1609 -#define ER_SLAVE_CORRUPT_EVENT 1610 -#define ER_LOAD_DATA_INVALID_COLUMN 1611 -#define ER_LOG_PURGE_NO_FILE 1612 -#define ER_XA_RBTIMEOUT 1613 -#define ER_XA_RBDEADLOCK 1614 -#define ER_NEED_REPREPARE 1615 -#define ER_DELAYED_NOT_SUPPORTED 1616 -#define WARN_NO_MASTER_INFO 1617 -#define WARN_OPTION_IGNORED 1618 -#define ER_PLUGIN_DELETE_BUILTIN 1619 -#define WARN_PLUGIN_BUSY 1620 -#define ER_VARIABLE_IS_READONLY 1621 -#define ER_WARN_ENGINE_TRANSACTION_ROLLBACK 1622 -#define ER_SLAVE_HEARTBEAT_FAILURE 1623 -#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE 1624 -#define ER_UNUSED_14 1625 -#define ER_CONFLICT_FN_PARSE_ERROR 1626 -#define ER_EXCEPTIONS_WRITE_ERROR 1627 -#define ER_TOO_LONG_TABLE_COMMENT 1628 -#define ER_TOO_LONG_FIELD_COMMENT 1629 -#define ER_FUNC_INEXISTENT_NAME_COLLISION 1630 -#define ER_DATABASE_NAME 1631 -#define ER_TABLE_NAME 1632 -#define ER_PARTITION_NAME 1633 -#define ER_SUBPARTITION_NAME 1634 -#define ER_TEMPORARY_NAME 1635 -#define ER_RENAMED_NAME 1636 -#define ER_TOO_MANY_CONCURRENT_TRXS 1637 -#define WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED 1638 -#define ER_DEBUG_SYNC_TIMEOUT 1639 -#define ER_DEBUG_SYNC_HIT_LIMIT 1640 -#define ER_DUP_SIGNAL_SET 1641 -#define ER_SIGNAL_WARN 1642 -#define ER_SIGNAL_NOT_FOUND 1643 -#define ER_SIGNAL_EXCEPTION 1644 -#define ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER 1645 -#define ER_SIGNAL_BAD_CONDITION_TYPE 1646 -#define WARN_COND_ITEM_TRUNCATED 1647 -#define ER_COND_ITEM_TOO_LONG 1648 -#define ER_UNKNOWN_LOCALE 1649 -#define ER_SLAVE_IGNORE_SERVER_IDS 1650 -#define ER_QUERY_CACHE_DISABLED 1651 -#define ER_SAME_NAME_PARTITION_FIELD 1652 -#define ER_PARTITION_COLUMN_LIST_ERROR 1653 -#define ER_WRONG_TYPE_COLUMN_VALUE_ERROR 1654 -#define ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR 1655 -#define ER_MAXVALUE_IN_VALUES_IN 1656 -#define ER_TOO_MANY_VALUES_ERROR 1657 -#define ER_ROW_SINGLE_PARTITION_FIELD_ERROR 1658 -#define ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD 1659 -#define ER_PARTITION_FIELDS_TOO_LONG 1660 -#define ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE 1661 -#define ER_BINLOG_ROW_MODE_AND_STMT_ENGINE 1662 -#define ER_BINLOG_UNSAFE_AND_STMT_ENGINE 1663 -#define ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE 1664 -#define ER_BINLOG_STMT_MODE_AND_ROW_ENGINE 1665 -#define ER_BINLOG_ROW_INJECTION_AND_STMT_MODE 1666 -#define ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1667 -#define ER_BINLOG_UNSAFE_LIMIT 1668 -#define ER_BINLOG_UNSAFE_INSERT_DELAYED 1669 -#define ER_BINLOG_UNSAFE_SYSTEM_TABLE 1670 -#define ER_BINLOG_UNSAFE_AUTOINC_COLUMNS 1671 -#define ER_BINLOG_UNSAFE_UDF 1672 -#define ER_BINLOG_UNSAFE_SYSTEM_VARIABLE 1673 -#define ER_BINLOG_UNSAFE_SYSTEM_FUNCTION 1674 -#define ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS 1675 -#define ER_MESSAGE_AND_STATEMENT 1676 -#define ER_SLAVE_CONVERSION_FAILED 1677 -#define ER_SLAVE_CANT_CREATE_CONVERSION 1678 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT 1679 -#define ER_PATH_LENGTH 1680 -#define ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT 1681 -#define ER_WRONG_NATIVE_TABLE_STRUCTURE 1682 -#define ER_WRONG_PERFSCHEMA_USAGE 1683 -#define ER_WARN_I_S_SKIPPED_TABLE 1684 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT 1685 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT 1686 -#define ER_SPATIAL_MUST_HAVE_GEOM_COL 1687 -#define ER_TOO_LONG_INDEX_COMMENT 1688 -#define ER_LOCK_ABORTED 1689 -#define ER_DATA_OUT_OF_RANGE 1690 -#define ER_WRONG_SPVAR_TYPE_IN_LIMIT 1691 -#define ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1692 -#define ER_BINLOG_UNSAFE_MIXED_STATEMENT 1693 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN 1694 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN 1695 -#define ER_FAILED_READ_FROM_PAR_FILE 1696 -#define ER_VALUES_IS_NOT_INT_TYPE_ERROR 1697 -#define ER_ACCESS_DENIED_NO_PASSWORD_ERROR 1698 -#define ER_SET_PASSWORD_AUTH_PLUGIN 1699 -#define ER_GRANT_PLUGIN_USER_EXISTS 1700 -#define ER_TRUNCATE_ILLEGAL_FK 1701 -#define ER_PLUGIN_IS_PERMANENT 1702 -#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN 1703 -#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX 1704 -#define ER_STMT_CACHE_FULL 1705 -#define ER_MULTI_UPDATE_KEY_CONFLICT 1706 -#define ER_TABLE_NEEDS_REBUILD 1707 -#define WARN_OPTION_BELOW_LIMIT 1708 -#define ER_INDEX_COLUMN_TOO_LONG 1709 -#define ER_ERROR_IN_TRIGGER_BODY 1710 -#define ER_ERROR_IN_UNKNOWN_TRIGGER_BODY 1711 -#define ER_INDEX_CORRUPT 1712 -#define ER_UNDO_RECORD_TOO_BIG 1713 -#define ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT 1714 -#define ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE 1715 -#define ER_BINLOG_UNSAFE_REPLACE_SELECT 1716 -#define ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT 1717 -#define ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT 1718 -#define ER_BINLOG_UNSAFE_UPDATE_IGNORE 1719 -#define ER_UNUSED_15 1720 -#define ER_UNUSED_16 1721 -#define ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT 1722 -#define ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC 1723 -#define ER_BINLOG_UNSAFE_INSERT_TWO_KEYS 1724 -#define ER_TABLE_IN_FK_CHECK 1725 -#define ER_UNUSED_1 1726 -#define ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST 1727 -#define ER_CANNOT_LOAD_FROM_TABLE_V2 1728 -#define ER_MASTER_DELAY_VALUE_OUT_OF_RANGE 1729 -#define ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT 1730 -#define ER_PARTITION_EXCHANGE_DIFFERENT_OPTION 1731 -#define ER_PARTITION_EXCHANGE_PART_TABLE 1732 -#define ER_PARTITION_EXCHANGE_TEMP_TABLE 1733 -#define ER_PARTITION_INSTEAD_OF_SUBPARTITION 1734 -#define ER_UNKNOWN_PARTITION 1735 -#define ER_TABLES_DIFFERENT_METADATA 1736 -#define ER_ROW_DOES_NOT_MATCH_PARTITION 1737 -#define ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX 1738 -#define ER_WARN_INDEX_NOT_APPLICABLE 1739 -#define ER_PARTITION_EXCHANGE_FOREIGN_KEY 1740 -#define ER_NO_SUCH_KEY_VALUE 1741 -#define ER_VALUE_TOO_LONG 1742 -#define ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE 1743 -#define ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE 1744 -#define ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX 1745 -#define ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT 1746 -#define ER_PARTITION_CLAUSE_ON_NONPARTITIONED 1747 -#define ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET 1748 -#define ER_UNUSED_5 1749 -#define ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE 1750 -#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE 1751 -#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE 1752 -#define ER_MTS_FEATURE_IS_NOT_SUPPORTED 1753 -#define ER_MTS_UPDATED_DBS_GREATER_MAX 1754 -#define ER_MTS_CANT_PARALLEL 1755 -#define ER_MTS_INCONSISTENT_DATA 1756 -#define ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING 1757 -#define ER_DA_INVALID_CONDITION_NUMBER 1758 -#define ER_INSECURE_PLAIN_TEXT 1759 -#define ER_INSECURE_CHANGE_MASTER 1760 -#define ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO 1761 -#define ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO 1762 -#define ER_SQLTHREAD_WITH_SECURE_SLAVE 1763 -#define ER_TABLE_HAS_NO_FT 1764 -#define ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER 1765 -#define ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION 1766 -#define ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST 1767 -#define ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL 1768 -#define ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION 1769 -#define ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL 1770 -#define ER_SKIPPING_LOGGED_TRANSACTION 1771 -#define ER_MALFORMED_GTID_SET_SPECIFICATION 1772 -#define ER_MALFORMED_GTID_SET_ENCODING 1773 -#define ER_MALFORMED_GTID_SPECIFICATION 1774 -#define ER_GNO_EXHAUSTED 1775 -#define ER_BAD_SLAVE_AUTO_POSITION 1776 -#define ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON 1777 -#define ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET 1778 -#define ER_GTID_MODE_2_OR_3_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON 1779 -#define ER_GTID_MODE_REQUIRES_BINLOG 1780 -#define ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF 1781 -#define ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON 1782 -#define ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF 1783 -#define ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF 1784 -#define ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE 1785 -#define ER_GTID_UNSAFE_CREATE_SELECT 1786 -#define ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION 1787 -#define ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME 1788 -#define ER_MASTER_HAS_PURGED_REQUIRED_GTIDS 1789 -#define ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID 1790 -#define ER_UNKNOWN_EXPLAIN_FORMAT 1791 -#define ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION 1792 -#define ER_TOO_LONG_TABLE_PARTITION_COMMENT 1793 -#define ER_SLAVE_CONFIGURATION 1794 -#define ER_INNODB_FT_LIMIT 1795 -#define ER_INNODB_NO_FT_TEMP_TABLE 1796 -#define ER_INNODB_FT_WRONG_DOCID_COLUMN 1797 -#define ER_INNODB_FT_WRONG_DOCID_INDEX 1798 -#define ER_INNODB_ONLINE_LOG_TOO_BIG 1799 -#define ER_UNKNOWN_ALTER_ALGORITHM 1800 -#define ER_UNKNOWN_ALTER_LOCK 1801 -#define ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS 1802 -#define ER_MTS_RECOVERY_FAILURE 1803 -#define ER_MTS_RESET_WORKERS 1804 -#define ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 1805 -#define ER_SLAVE_SILENT_RETRY_TRANSACTION 1806 -#define ER_UNUSED_22 1807 -#define ER_TABLE_SCHEMA_MISMATCH 1808 -#define ER_TABLE_IN_SYSTEM_TABLESPACE 1809 -#define ER_IO_READ_ERROR 1810 -#define ER_IO_WRITE_ERROR 1811 -#define ER_TABLESPACE_MISSING 1812 -#define ER_TABLESPACE_EXISTS 1813 -#define ER_TABLESPACE_DISCARDED 1814 -#define ER_INTERNAL_ERROR 1815 -#define ER_INNODB_IMPORT_ERROR 1816 -#define ER_INNODB_INDEX_CORRUPT 1817 -#define ER_INVALID_YEAR_COLUMN_LENGTH 1818 -#define ER_NOT_VALID_PASSWORD 1819 -#define ER_MUST_CHANGE_PASSWORD 1820 -#define ER_FK_NO_INDEX_CHILD 1821 -#define ER_FK_NO_INDEX_PARENT 1822 -#define ER_FK_FAIL_ADD_SYSTEM 1823 -#define ER_FK_CANNOT_OPEN_PARENT 1824 -#define ER_FK_INCORRECT_OPTION 1825 -#define ER_DUP_CONSTRAINT_NAME 1826 -#define ER_PASSWORD_FORMAT 1827 -#define ER_FK_COLUMN_CANNOT_DROP 1828 -#define ER_FK_COLUMN_CANNOT_DROP_CHILD 1829 -#define ER_FK_COLUMN_NOT_NULL 1830 -#define ER_DUP_INDEX 1831 -#define ER_FK_COLUMN_CANNOT_CHANGE 1832 -#define ER_FK_COLUMN_CANNOT_CHANGE_CHILD 1833 -#define ER_FK_CANNOT_DELETE_PARENT 1834 -#define ER_MALFORMED_PACKET 1835 -#define ER_READ_ONLY_MODE 1836 -#define ER_GTID_NEXT_TYPE_UNDEFINED_GROUP 1837 -#define ER_VARIABLE_NOT_SETTABLE_IN_SP 1838 -#define ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF 1839 -#define ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY 1840 -#define ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY 1841 -#define ER_GTID_PURGED_WAS_CHANGED 1842 -#define ER_GTID_EXECUTED_WAS_CHANGED 1843 -#define ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES 1844 -#define ER_ALTER_OPERATION_NOT_SUPPORTED 1845 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON 1846 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY 1847 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION 1848 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME 1849 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE 1850 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK 1851 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_IGNORE 1852 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK 1853 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC 1854 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS 1855 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS 1856 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS 1857 -#define ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE 1858 -#define ER_DUP_UNKNOWN_IN_INDEX 1859 -#define ER_IDENT_CAUSES_TOO_LONG_PATH 1860 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL 1861 -#define ER_MUST_CHANGE_PASSWORD_LOGIN 1862 -#define ER_ROW_IN_WRONG_PARTITION 1863 -#define ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX 1864 -#define ER_INNODB_NO_FT_USES_PARSER 1865 -#define ER_BINLOG_LOGICAL_CORRUPTION 1866 -#define ER_WARN_PURGE_LOG_IN_USE 1867 -#define ER_WARN_PURGE_LOG_IS_ACTIVE 1868 -#define ER_AUTO_INCREMENT_CONFLICT 1869 -#define WARN_ON_BLOCKHOLE_IN_RBR 1870 -#define ER_SLAVE_MI_INIT_REPOSITORY 1871 -#define ER_SLAVE_RLI_INIT_REPOSITORY 1872 -#define ER_ACCESS_DENIED_CHANGE_USER_ERROR 1873 -#define ER_INNODB_READ_ONLY 1874 -#define ER_STOP_SLAVE_SQL_THREAD_TIMEOUT 1875 -#define ER_STOP_SLAVE_IO_THREAD_TIMEOUT 1876 -#define ER_TABLE_CORRUPT 1877 -#define ER_TEMP_FILE_WRITE_FAILURE 1878 -#define ER_INNODB_FT_AUX_NOT_HEX_ID 1879 -#define ER_LAST_MYSQL_ERROR_MESSAGE 1880 -#define ER_ERROR_LAST_SECTION_1 1880 - -/* New section */ - -#define ER_ERROR_FIRST_SECTION_2 1900 -#define ER_UNUSED_18 1900 -#define ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED 1901 -#define ER_UNUSED_19 1902 -#define ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN 1903 -#define ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN 1904 -#define ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN 1905 -#define ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN 1906 -#define ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN 1907 -#define ER_UNUSED_20 1908 -#define ER_UNUSED_21 1909 -#define ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS 1910 -#define ER_UNKNOWN_OPTION 1911 -#define ER_BAD_OPTION_VALUE 1912 -#define ER_UNUSED_6 1913 -#define ER_UNUSED_7 1914 -#define ER_UNUSED_8 1915 -#define ER_DATA_OVERFLOW 1916 -#define ER_DATA_TRUNCATED 1917 -#define ER_BAD_DATA 1918 -#define ER_DYN_COL_WRONG_FORMAT 1919 -#define ER_DYN_COL_IMPLEMENTATION_LIMIT 1920 -#define ER_DYN_COL_DATA 1921 -#define ER_DYN_COL_WRONG_CHARSET 1922 -#define ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES 1923 -#define ER_QUERY_CACHE_IS_DISABLED 1924 -#define ER_QUERY_CACHE_IS_GLOBALY_DISABLED 1925 -#define ER_VIEW_ORDERBY_IGNORED 1926 -#define ER_CONNECTION_KILLED 1927 -#define ER_UNUSED_12 1928 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION 1929 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION 1930 -#define ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT 1931 -#define ER_NO_SUCH_TABLE_IN_ENGINE 1932 -#define ER_TARGET_NOT_EXPLAINABLE 1933 -#define ER_CONNECTION_ALREADY_EXISTS 1934 -#define ER_MASTER_LOG_PREFIX 1935 -#define ER_CANT_START_STOP_SLAVE 1936 -#define ER_SLAVE_STARTED 1937 -#define ER_SLAVE_STOPPED 1938 -#define ER_SQL_DISCOVER_ERROR 1939 -#define ER_FAILED_GTID_STATE_INIT 1940 -#define ER_INCORRECT_GTID_STATE 1941 -#define ER_CANNOT_UPDATE_GTID_STATE 1942 -#define ER_DUPLICATE_GTID_DOMAIN 1943 -#define ER_GTID_OPEN_TABLE_FAILED 1944 -#define ER_GTID_POSITION_NOT_FOUND_IN_BINLOG 1945 -#define ER_CANNOT_LOAD_SLAVE_GTID_STATE 1946 -#define ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG 1947 -#define ER_MASTER_GTID_POS_MISSING_DOMAIN 1948 -#define ER_UNTIL_REQUIRES_USING_GTID 1949 -#define ER_GTID_STRICT_OUT_OF_ORDER 1950 -#define ER_GTID_START_FROM_BINLOG_HOLE 1951 -#define ER_SLAVE_UNEXPECTED_MASTER_SWITCH 1952 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO 1953 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO 1954 -#define ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2 1955 -#define ER_BINLOG_MUST_BE_EMPTY 1956 -#define ER_NO_SUCH_QUERY 1957 -#define ER_BAD_BASE64_DATA 1958 -#define ER_INVALID_ROLE 1959 -#define ER_INVALID_CURRENT_USER 1960 -#define ER_CANNOT_GRANT_ROLE 1961 -#define ER_CANNOT_REVOKE_ROLE 1962 -#define ER_CHANGE_SLAVE_PARALLEL_THREADS_ACTIVE 1963 -#define ER_PRIOR_COMMIT_FAILED 1964 -#define ER_IT_IS_A_VIEW 1965 -#define ER_SLAVE_SKIP_NOT_IN_GTID 1966 -#define ER_TABLE_DEFINITION_TOO_BIG 1967 -#define ER_PLUGIN_INSTALLED 1968 -#define ER_STATEMENT_TIMEOUT 1969 -#define ER_SUBQUERIES_NOT_SUPPORTED 1970 -#define ER_SET_STATEMENT_NOT_SUPPORTED 1971 -#define ER_UNUSED_9 1972 -#define ER_USER_CREATE_EXISTS 1973 -#define ER_USER_DROP_EXISTS 1974 -#define ER_ROLE_CREATE_EXISTS 1975 -#define ER_ROLE_DROP_EXISTS 1976 -#define ER_CANNOT_CONVERT_CHARACTER 1977 -#define ER_INVALID_DEFAULT_VALUE_FOR_FIELD 1978 -#define ER_KILL_QUERY_DENIED_ERROR 1979 -#define ER_NO_EIS_FOR_FIELD 1980 -#define ER_WARN_AGGFUNC_DEPENDENCE 1981 -#define WARN_INNODB_PARTITION_OPTION_IGNORED 1982 -#define ER_ERROR_LAST_SECTION_2 1982 - -/* New section */ - -#define ER_ERROR_FIRST_SECTION_3 2000 -#define ER_ERROR_LAST_SECTION_3 2000 - -/* New section */ - -#define ER_ERROR_FIRST_SECTION_4 3000 -#define ER_FILE_CORRUPT 3000 -#define ER_ERROR_ON_MASTER 3001 -#define ER_INCONSISTENT_ERROR 3002 -#define ER_STORAGE_ENGINE_NOT_LOADED 3003 -#define ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 3004 -#define ER_WARN_LEGACY_SYNTAX_CONVERTED 3005 -#define ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN 3006 -#define ER_CANNOT_DISCARD_TEMPORARY_TABLE 3007 -#define ER_FK_DEPTH_EXCEEDED 3008 -#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 3009 -#define ER_WARN_TRIGGER_DOESNT_HAVE_CREATED 3010 -#define ER_REFERENCED_TRG_DOES_NOT_EXIST_MYSQL 3011 -#define ER_EXPLAIN_NOT_SUPPORTED 3012 -#define ER_INVALID_FIELD_SIZE 3013 -#define ER_MISSING_HA_CREATE_OPTION 3014 -#define ER_ENGINE_OUT_OF_MEMORY 3015 -#define ER_PASSWORD_EXPIRE_ANONYMOUS_USER 3016 -#define ER_SLAVE_SQL_THREAD_MUST_STOP 3017 -#define ER_NO_FT_MATERIALIZED_SUBQUERY 3018 -#define ER_INNODB_UNDO_LOG_FULL 3019 -#define ER_INVALID_ARGUMENT_FOR_LOGARITHM 3020 -#define ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP 3021 -#define ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO 3022 -#define ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS 3023 -#define ER_QUERY_TIMEOUT 3024 -#define ER_NON_RO_SELECT_DISABLE_TIMER 3025 -#define ER_DUP_LIST_ENTRY 3026 -#define ER_SQL_MODE_NO_EFFECT 3027 -#define ER_AGGREGATE_ORDER_FOR_UNION 3028 -#define ER_AGGREGATE_ORDER_NON_AGG_QUERY 3029 -#define ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR 3030 -#define ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER 3031 -#define ER_SERVER_OFFLINE_MODE 3032 -#define ER_GIS_DIFFERENT_SRIDS 3033 -#define ER_GIS_UNSUPPORTED_ARGUMENT 3034 -#define ER_GIS_UNKNOWN_ERROR 3035 -#define ER_GIS_UNKNOWN_EXCEPTION 3036 -#define ER_GIS_INVALID_DATA 3037 -#define ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION 3038 -#define ER_BOOST_GEOMETRY_CENTROID_EXCEPTION 3039 -#define ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION 3040 -#define ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION 3041 -#define ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION 3042 -#define ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION 3043 -#define ER_STD_BAD_ALLOC_ERROR 3044 -#define ER_STD_DOMAIN_ERROR 3045 -#define ER_STD_LENGTH_ERROR 3046 -#define ER_STD_INVALID_ARGUMENT 3047 -#define ER_STD_OUT_OF_RANGE_ERROR 3048 -#define ER_STD_OVERFLOW_ERROR 3049 -#define ER_STD_RANGE_ERROR 3050 -#define ER_STD_UNDERFLOW_ERROR 3051 -#define ER_STD_LOGIC_ERROR 3052 -#define ER_STD_RUNTIME_ERROR 3053 -#define ER_STD_UNKNOWN_EXCEPTION 3054 -#define ER_GIS_DATA_WRONG_ENDIANESS 3055 -#define ER_CHANGE_MASTER_PASSWORD_LENGTH 3056 -#define ER_USER_LOCK_WRONG_NAME 3057 -#define ER_USER_LOCK_DEADLOCK 3058 -#define ER_REPLACE_INACCESSIBLE_ROWS 3059 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS 3060 -#define ER_ERROR_LAST_SECTION_4 3060 - -/* New section */ - -#define ER_ERROR_FIRST_SECTION_5 4000 -#define ER_COMMULTI_BADCONTEXT 4000 -#define ER_BAD_COMMAND_IN_MULTI 4001 -#define ER_WITH_COL_WRONG_LIST 4002 -#define ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE 4003 -#define ER_DUP_QUERY_NAME 4004 -#define ER_RECURSIVE_WITHOUT_ANCHORS 4005 -#define ER_UNACCEPTABLE_MUTUAL_RECURSION 4006 -#define ER_REF_TO_RECURSIVE_WITH_TABLE_IN_DERIVED 4007 -#define ER_NOT_STANDARD_COMPLIANT_RECURSIVE 4008 -#define ER_WRONG_WINDOW_SPEC_NAME 4009 -#define ER_DUP_WINDOW_NAME 4010 -#define ER_PARTITION_LIST_IN_REFERENCING_WINDOW_SPEC 4011 -#define ER_ORDER_LIST_IN_REFERENCING_WINDOW_SPEC 4012 -#define ER_WINDOW_FRAME_IN_REFERENCED_WINDOW_SPEC 4013 -#define ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS 4014 -#define ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION 4015 -#define ER_WINDOW_FUNCTION_IN_WINDOW_SPEC 4016 -#define ER_NOT_ALLOWED_WINDOW_FRAME 4017 -#define ER_NO_ORDER_LIST_IN_WINDOW_SPEC 4018 -#define ER_RANGE_FRAME_NEEDS_SIMPLE_ORDERBY 4019 -#define ER_WRONG_TYPE_FOR_ROWS_FRAME 4020 -#define ER_WRONG_TYPE_FOR_RANGE_FRAME 4021 -#define ER_FRAME_EXCLUSION_NOT_SUPPORTED 4022 -#define ER_WINDOW_FUNCTION_DONT_HAVE_FRAME 4023 -#define ER_INVALID_NTILE_ARGUMENT 4024 -#define ER_CONSTRAINT_FAILED 4025 -#define ER_EXPRESSION_IS_TOO_BIG 4026 -#define ER_ERROR_EVALUATING_EXPRESSION 4027 -#define ER_CALCULATING_DEFAULT_VALUE 4028 -#define ER_EXPRESSION_REFERS_TO_UNINIT_FIELD 4029 -#define ER_PARTITION_DEFAULT_ERROR 4030 -#define ER_REFERENCED_TRG_DOES_NOT_EXIST 4031 -#define ER_INVALID_DEFAULT_PARAM 4032 -#define ER_BINLOG_NON_SUPPORTED_BULK 4033 -#define ER_BINLOG_UNCOMPRESS_ERROR 4034 -#define ER_JSON_BAD_CHR 4035 -#define ER_JSON_NOT_JSON_CHR 4036 -#define ER_JSON_EOS 4037 -#define ER_JSON_SYNTAX 4038 -#define ER_JSON_ESCAPING 4039 -#define ER_JSON_DEPTH 4040 -#define ER_JSON_PATH_EOS 4041 -#define ER_JSON_PATH_SYNTAX 4042 -#define ER_JSON_PATH_DEPTH 4043 -#define ER_JSON_PATH_NO_WILDCARD 4044 -#define ER_JSON_PATH_ARRAY 4045 -#define ER_JSON_ONE_OR_ALL 4046 -#define ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE 4047 -#define ER_GEOJSON_INCORRECT 4048 -#define ER_GEOJSON_TOO_FEW_POINTS 4049 -#define ER_GEOJSON_NOT_CLOSED 4050 -#define ER_JSON_PATH_EMPTY 4051 -#define ER_SLAVE_SAME_ID 4052 -#define ER_FLASHBACK_NOT_SUPPORTED 4053 -#define ER_KEYS_OUT_OF_ORDER 4054 -#define ER_OVERLAPPING_KEYS 4055 -#define ER_REQUIRE_ROW_BINLOG_FORMAT 4056 -#define ER_ISOLATION_MODE_NOT_SUPPORTED 4057 -#define ER_ON_DUPLICATE_DISABLED 4058 -#define ER_UPDATES_WITH_CONSISTENT_SNAPSHOT 4059 -#define ER_ROLLBACK_ONLY 4060 -#define ER_ROLLBACK_TO_SAVEPOINT 4061 -#define ER_ISOLATION_LEVEL_WITH_CONSISTENT_SNAPSHOT 4062 -#define ER_UNSUPPORTED_COLLATION 4063 -#define ER_METADATA_INCONSISTENCY 4064 -#define ER_CF_DIFFERENT 4065 -#define ER_RDB_TTL_DURATION_FORMAT 4066 -#define ER_RDB_STATUS_GENERAL 4067 -#define ER_RDB_STATUS_MSG 4068 -#define ER_RDB_TTL_UNSUPPORTED 4069 -#define ER_RDB_TTL_COL_FORMAT 4070 -#define ER_PER_INDEX_CF_DEPRECATED 4071 -#define ER_KEY_CREATE_DURING_ALTER 4072 -#define ER_SK_POPULATE_DURING_ALTER 4073 -#define ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG 4074 -#define ER_NET_OK_PACKET_TOO_LARGE 4075 -#define ER_GEOJSON_EMPTY_COORDINATES 4076 -#define ER_MYROCKS_CANT_NOPAD_COLLATION 4077 -#define ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION 4078 -#define ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION 4079 -#define ER_WRONG_PARAMCOUNT_TO_CURSOR 4080 -#define ER_UNKNOWN_STRUCTURED_VARIABLE 4081 -#define ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD 4082 -#define ER_END_IDENTIFIER_DOES_NOT_MATCH 4083 -#define ER_SEQUENCE_RUN_OUT 4084 -#define ER_SEQUENCE_INVALID_DATA 4085 -#define ER_SEQUENCE_INVALID_TABLE_STRUCTURE 4086 -#define ER_SEQUENCE_ACCESS_ERROR 4087 -#define ER_SEQUENCE_BINLOG_FORMAT 4088 -#define ER_NOT_SEQUENCE 4089 -#define ER_NOT_SEQUENCE2 4090 -#define ER_UNKNOWN_SEQUENCES 4091 -#define ER_UNKNOWN_VIEW 4092 -#define ER_WRONG_INSERT_INTO_SEQUENCE 4093 -#define ER_SP_STACK_TRACE 4094 -#define ER_PACKAGE_ROUTINE_IN_SPEC_NOT_DEFINED_IN_BODY 4095 -#define ER_PACKAGE_ROUTINE_FORWARD_DECLARATION_NOT_DEFINED 4096 -#define ER_COMPRESSED_COLUMN_USED_AS_KEY 4097 -#define ER_UNKNOWN_COMPRESSION_METHOD 4098 -#define ER_WRONG_NUMBER_OF_VALUES_IN_TVC 4099 -#define ER_FIELD_REFERENCE_IN_TVC 4100 -#define ER_WRONG_TYPE_FOR_PERCENTILE_FUNC 4101 -#define ER_ARGUMENT_NOT_CONSTANT 4102 -#define ER_ARGUMENT_OUT_OF_RANGE 4103 -#define ER_WRONG_TYPE_OF_ARGUMENT 4104 -#define ER_NOT_AGGREGATE_FUNCTION 4105 -#define ER_INVALID_AGGREGATE_FUNCTION 4106 -#define ER_INVALID_VALUE_TO_LIMIT 4107 -#define ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT 4108 -#define ER_UPDATE_INFO_WITH_SYSTEM_VERSIONING 4109 -#define ER_VERS_FIELD_WRONG_TYPE 4110 -#define ER_VERS_ENGINE_UNSUPPORTED 4111 -#define ER_UNUSED_23 4112 -#define ER_PARTITION_WRONG_TYPE 4113 -#define WARN_VERS_PART_FULL 4114 -#define WARN_VERS_PARAMETERS 4115 -#define ER_VERS_DROP_PARTITION_INTERVAL 4116 -#define ER_UNUSED_25 4117 -#define WARN_VERS_PART_NON_HISTORICAL 4118 -#define ER_VERS_ALTER_NOT_ALLOWED 4119 -#define ER_VERS_ALTER_ENGINE_PROHIBITED 4120 -#define ER_VERS_RANGE_PROHIBITED 4121 -#define ER_CONFLICTING_FOR_SYSTEM_TIME 4122 -#define ER_VERS_TABLE_MUST_HAVE_COLUMNS 4123 -#define ER_VERS_NOT_VERSIONED 4124 -#define ER_MISSING 4125 -#define ER_VERS_PERIOD_COLUMNS 4126 -#define ER_PART_WRONG_VALUE 4127 -#define ER_VERS_WRONG_PARTS 4128 -#define ER_VERS_NO_TRX_ID 4129 -#define ER_VERS_ALTER_SYSTEM_FIELD 4130 -#define ER_DROP_VERSIONING_SYSTEM_TIME_PARTITION 4131 -#define ER_VERS_DB_NOT_SUPPORTED 4132 -#define ER_VERS_TRT_IS_DISABLED 4133 -#define ER_VERS_DUPLICATE_ROW_START_END 4134 -#define ER_VERS_ALREADY_VERSIONED 4135 -#define ER_UNUSED_24 4136 -#define ER_VERS_NOT_SUPPORTED 4137 -#define ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED 4138 -#define ER_INDEX_FILE_FULL 4139 -#define ER_UPDATED_COLUMN_ONLY_ONCE 4140 -#define ER_EMPTY_ROW_IN_TVC 4141 -#define ER_VERS_QUERY_IN_PARTITION 4142 -#define ER_KEY_DOESNT_SUPPORT 4143 -#define ER_ALTER_OPERATION_TABLE_OPTIONS_NEED_REBUILD 4144 -#define ER_BACKUP_LOCK_IS_ACTIVE 4145 -#define ER_BACKUP_NOT_RUNNING 4146 -#define ER_BACKUP_WRONG_STAGE 4147 -#define ER_BACKUP_STAGE_FAILED 4148 -#define ER_BACKUP_UNKNOWN_STAGE 4149 -#define ER_USER_IS_BLOCKED 4150 -#define ER_ACCOUNT_HAS_BEEN_LOCKED 4151 -#define ER_PERIOD_TEMPORARY_NOT_ALLOWED 4152 -#define ER_PERIOD_TYPES_MISMATCH 4153 -#define ER_MORE_THAN_ONE_PERIOD 4154 -#define ER_PERIOD_FIELD_WRONG_ATTRIBUTES 4155 -#define ER_PERIOD_NOT_FOUND 4156 -#define ER_PERIOD_COLUMNS_UPDATED 4157 -#define ER_PERIOD_CONSTRAINT_DROP 4158 -#define ER_TOO_LONG_KEYPART 4159 -#define ER_TOO_LONG_DATABASE_COMMENT 4160 -#define ER_UNKNOWN_DATA_TYPE 4161 -#define ER_UNKNOWN_OPERATOR 4162 -#define ER_WARN_HISTORY_ROW_START_TIME 4163 -#define ER_PART_STARTS_BEYOND_INTERVAL 4164 -#define ER_GALERA_REPLICATION_NOT_SUPPORTED 4165 -#define ER_LOAD_INFILE_CAPABILITY_DISABLED 4166 -#define ER_NO_SECURE_TRANSPORTS_CONFIGURED 4167 -#define ER_SLAVE_IGNORED_SHARED_TABLE 4168 -#define ER_NO_AUTOINCREMENT_WITH_UNIQUE 4169 -#define ER_KEY_CONTAINS_PERIOD_FIELDS 4170 -#define ER_KEY_CANT_HAVE_WITHOUT_OVERLAPS 4171 -#define ER_NOT_ALLOWED_IN_THIS_CONTEXT 4172 -#define ER_DATA_WAS_COMMITED_UNDER_ROLLBACK 4173 -#define ER_ERROR_LAST 4173 -#endif /* ER_ERROR_FIRST */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/big_endian.h b/VCMP-LUA/modules/mariadb/include/mysql/server/big_endian.h deleted file mode 100644 index 6487f82..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/big_endian.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Data in big-endian format. -*/ -#define float4store(T,A) do { *(T)= ((uchar *) &A)[3];\ - *((T)+1)=(char) ((uchar *) &A)[2];\ - *((T)+2)=(char) ((uchar *) &A)[1];\ - *((T)+3)=(char) ((uchar *) &A)[0]; } while(0) - -#define float4get(V,M) do { float def_temp;\ - ((uchar*) &def_temp)[0]=(M)[3];\ - ((uchar*) &def_temp)[1]=(M)[2];\ - ((uchar*) &def_temp)[2]=(M)[1];\ - ((uchar*) &def_temp)[3]=(M)[0];\ - (V)=def_temp; } while(0) - -#define float8store(T,V) do { *(T)= ((uchar *) &V)[7];\ - *((T)+1)=(char) ((uchar *) &V)[6];\ - *((T)+2)=(char) ((uchar *) &V)[5];\ - *((T)+3)=(char) ((uchar *) &V)[4];\ - *((T)+4)=(char) ((uchar *) &V)[3];\ - *((T)+5)=(char) ((uchar *) &V)[2];\ - *((T)+6)=(char) ((uchar *) &V)[1];\ - *((T)+7)=(char) ((uchar *) &V)[0]; } while(0) - -#define float8get(V,M) do { double def_temp;\ - ((uchar*) &def_temp)[0]=(M)[7];\ - ((uchar*) &def_temp)[1]=(M)[6];\ - ((uchar*) &def_temp)[2]=(M)[5];\ - ((uchar*) &def_temp)[3]=(M)[4];\ - ((uchar*) &def_temp)[4]=(M)[3];\ - ((uchar*) &def_temp)[5]=(M)[2];\ - ((uchar*) &def_temp)[6]=(M)[1];\ - ((uchar*) &def_temp)[7]=(M)[0];\ - (V) = def_temp; } while(0) - -#define ushortget(V,M) do { V = (uint16) (((uint16) ((uchar) (M)[1]))+\ - ((uint16) ((uint16) (M)[0]) << 8)); } while(0) -#define shortget(V,M) do { V = (short) (((short) ((uchar) (M)[1]))+\ - ((short) ((short) (M)[0]) << 8)); } while(0) -#define longget(V,M) do { int32 def_temp;\ - ((uchar*) &def_temp)[0]=(M)[0];\ - ((uchar*) &def_temp)[1]=(M)[1];\ - ((uchar*) &def_temp)[2]=(M)[2];\ - ((uchar*) &def_temp)[3]=(M)[3];\ - (V)=def_temp; } while(0) -#define ulongget(V,M) do { uint32 def_temp;\ - ((uchar*) &def_temp)[0]=(M)[0];\ - ((uchar*) &def_temp)[1]=(M)[1];\ - ((uchar*) &def_temp)[2]=(M)[2];\ - ((uchar*) &def_temp)[3]=(M)[3];\ - (V)=def_temp; } while(0) -#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\ - *(((char*)T)+1)=(char)(def_temp); \ - *(((char*)T)+0)=(char)(def_temp >> 8); } while(0) -#define longstore(T,A) do { *(((char*)T)+3)=((A));\ - *(((char*)T)+2)=(((A) >> 8));\ - *(((char*)T)+1)=(((A) >> 16));\ - *(((char*)T)+0)=(((A) >> 24)); } while(0) - -#define floatget(V,M) memcpy(&V, (M), sizeof(float)) -/* Cast away type qualifiers (necessary as macro takes argument by value). */ -#define floatstore(T,V) memcpy((T), (void*) (&V), sizeof(float)) -#define doubleget(V,M) memcpy(&V, (M), sizeof(double)) -/* Cast away type qualifiers (necessary as macro takes argument by value). */ -#define doublestore(T,V) memcpy((T), (void*) &V, sizeof(double)) -#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong)) -#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong)) diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/byte_order_generic.h b/VCMP-LUA/modules/mariadb/include/mysql/server/byte_order_generic.h deleted file mode 100644 index 8381941..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/byte_order_generic.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Endianness-independent definitions for architectures other - than the x86 architecture. -*/ -#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) |\ - ((int16) ((int16) (A)[1]) << 8)) -#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ - (((uint32) 255L << 24) | \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0])) : \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0]))) -#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) |\ - (((int32) ((uchar) (A)[1]) << 8)) |\ - (((int32) ((uchar) (A)[2]) << 16)) |\ - (((int32) ((int16) (A)[3]) << 24))) -#define sint8korr(A) (longlong) uint8korr(A) -#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) |\ - ((uint16) ((uchar) (A)[1]) << 8)) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ - (((uint32) ((uchar) (A)[1])) << 8) |\ - (((uint32) ((uchar) (A)[2])) << 16)) -#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ - (((uint32) ((uchar) (A)[1])) << 8) |\ - (((uint32) ((uchar) (A)[2])) << 16) |\ - (((uint32) ((uchar) (A)[3])) << 24)) -#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\ - (((uint32) ((uchar) (A)[1])) << 8) |\ - (((uint32) ((uchar) (A)[2])) << 16) |\ - (((uint32) ((uchar) (A)[3])) << 24)) |\ - (((ulonglong) ((uchar) (A)[4])) << 32)) -#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \ - (((uint32) ((uchar) (A)[1])) << 8) | \ - (((uint32) ((uchar) (A)[2])) << 16) | \ - (((uint32) ((uchar) (A)[3])) << 24)) | \ - (((ulonglong) ((uchar) (A)[4])) << 32) | \ - (((ulonglong) ((uchar) (A)[5])) << 40)) -#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\ - (((uint32) ((uchar) (A)[1])) << 8) |\ - (((uint32) ((uchar) (A)[2])) << 16) |\ - (((uint32) ((uchar) (A)[3])) << 24)) |\ - (((ulonglong) (((uint32) ((uchar) (A)[4])) |\ - (((uint32) ((uchar) (A)[5])) << 8) |\ - (((uint32) ((uchar) (A)[6])) << 16) |\ - (((uint32) ((uchar) (A)[7])) << 24))) <<\ - 32)) -#define int2store(T,A) do { uint def_temp= (uint) (A) ;\ - *((uchar*) (T))= (uchar)(def_temp); \ - *((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \ - } while(0) -#define int3store(T,A) do { /*lint -save -e734 */\ - *((uchar*)(T))=(uchar) ((A));\ - *((uchar*) (T)+1)=(uchar) (((A) >> 8));\ - *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \ - /*lint -restore */} while(0) -#define int4store(T,A) do { *((char *)(T))=(char) ((A));\ - *(((char *)(T))+1)=(char) (((A) >> 8));\ - *(((char *)(T))+2)=(char) (((A) >> 16));\ - *(((char *)(T))+3)=(char) (((A) >> 24));\ - } while(0) -#define int5store(T,A) do { *((char *)(T))= (char)((A)); \ - *(((char *)(T))+1)= (char)(((A) >> 8)); \ - *(((char *)(T))+2)= (char)(((A) >> 16)); \ - *(((char *)(T))+3)= (char)(((A) >> 24)); \ - *(((char *)(T))+4)= (char)(((A) >> 32)); \ - } while(0) -#define int6store(T,A) do { *((char *)(T))= (char)((A)); \ - *(((char *)(T))+1)= (char)(((A) >> 8)); \ - *(((char *)(T))+2)= (char)(((A) >> 16)); \ - *(((char *)(T))+3)= (char)(((A) >> 24)); \ - *(((char *)(T))+4)= (char)(((A) >> 32)); \ - *(((char *)(T))+5)= (char)(((A) >> 40)); \ - } while(0) -#define int8store(T,A) do { uint def_temp= (uint) (A), \ - def_temp2= (uint) ((A) >> 32); \ - int4store((T),def_temp); \ - int4store((T+4),def_temp2);\ - } while(0) diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/byte_order_generic_x86.h b/VCMP-LUA/modules/mariadb/include/mysql/server/byte_order_generic_x86.h deleted file mode 100644 index 72e00be..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/byte_order_generic_x86.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Optimized function-like macros for the x86 architecture (_WIN32 included). -*/ -#define sint2korr(A) (*((const int16 *) (A))) -#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ - (((uint32) 255L << 24) | \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0])) : \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0]))) -#define sint4korr(A) (*((const long *) (A))) -#define uint2korr(A) (*((const uint16 *) (A))) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ - (((uint32) ((uchar) (A)[1])) << 8) |\ - (((uint32) ((uchar) (A)[2])) << 16)) -#define uint4korr(A) (*((const uint32 *) (A))) -#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\ - (((uint32) ((uchar) (A)[1])) << 8) |\ - (((uint32) ((uchar) (A)[2])) << 16) |\ - (((uint32) ((uchar) (A)[3])) << 24)) |\ - (((ulonglong) ((uchar) (A)[4])) << 32)) -#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \ - (((uint32) ((uchar) (A)[1])) << 8) | \ - (((uint32) ((uchar) (A)[2])) << 16) | \ - (((uint32) ((uchar) (A)[3])) << 24)) | \ - (((ulonglong) ((uchar) (A)[4])) << 32) | \ - (((ulonglong) ((uchar) (A)[5])) << 40)) -#define uint8korr(A) (*((const ulonglong *) (A))) -#define sint8korr(A) (*((const longlong *) (A))) - -#define int2store(T,A) *((uint16*) (T))= (uint16) (A) -#define int3store(T,A) do { *(T)= (uchar) ((A));\ - *(T+1)=(uchar) (((uint) (A) >> 8));\ - *(T+2)=(uchar) (((A) >> 16));\ - } while (0) -#define int4store(T,A) *((long *) (T))= (long) (A) -#define int5store(T,A) do { *(T)= (uchar)((A));\ - *((T)+1)=(uchar) (((A) >> 8));\ - *((T)+2)=(uchar) (((A) >> 16));\ - *((T)+3)=(uchar) (((A) >> 24));\ - *((T)+4)=(uchar) (((A) >> 32));\ - } while(0) -#define int6store(T,A) do { *(T)= (uchar)((A)); \ - *((T)+1)=(uchar) (((A) >> 8)); \ - *((T)+2)=(uchar) (((A) >> 16)); \ - *((T)+3)=(uchar) (((A) >> 24)); \ - *((T)+4)=(uchar) (((A) >> 32)); \ - *((T)+5)=(uchar) (((A) >> 40)); \ - } while(0) -#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) -typedef union { - double v; - long m[2]; -} doubleget_union; -#define doubleget(V,M) \ -do { doubleget_union _tmp; \ - _tmp.m[0] = *((const long*)(M)); \ - _tmp.m[1] = *(((const long*) (M))+1); \ - (V) = _tmp.v; } while(0) -#define doublestore(T,V) \ -do { *((long *) T) = ((const doubleget_union *)&V)->m[0]; \ - *(((long *) T)+1) = ((const doubleget_union *)&V)->m[1]; \ - } while (0) -#define float4get(V,M) \ -do { *((float *) &(V)) = *((const float*) (M)); } while(0) -#define float8get(V,M) doubleget((V),(M)) -#define float4store(V,M) memcpy((uchar*)(V), (uchar*)(&M), sizeof(float)) -#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V), sizeof(float)) -#define floatget(V,M) memcpy((uchar*)(&V),(uchar*) (M), sizeof(float)) -#define float8store(V,M) doublestore((V),(M)) diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/byte_order_generic_x86_64.h b/VCMP-LUA/modules/mariadb/include/mysql/server/byte_order_generic_x86_64.h deleted file mode 100644 index a25e6a2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/byte_order_generic_x86_64.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Optimized function-like macros for the x86 architecture (_WIN32 included). -*/ - -#define sint2korr(A) (int16) (*((int16 *) (A))) -#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ - (((uint32) 255L << 24) | \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0])) : \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0]))) -#define sint4korr(A) (int32) (*((int32 *) (A))) -#define uint2korr(A) (uint16) (*((uint16 *) (A))) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ - (((uint32) ((uchar) (A)[1])) << 8) |\ - (((uint32) ((uchar) (A)[2])) << 16)) -#define uint4korr(A) (uint32) (*((uint32 *) (A))) - - -static inline ulonglong uint5korr(const void *p) -{ - ulonglong a= *(uint32 *) p; - ulonglong b= *(4 + (uchar *) p); - return a | (b << 32); -} -static inline ulonglong uint6korr(const void *p) -{ - ulonglong a= *(uint32 *) p; - ulonglong b= *(uint16 *) (4 + (char *) p); - return a | (b << 32); -} - -#define uint8korr(A) (ulonglong) (*((ulonglong *) (A))) -#define sint8korr(A) (longlong) (*((longlong *) (A))) - -#define int2store(T,A) do { uchar *pT= (uchar*)(T);\ - *((uint16*)(pT))= (uint16) (A);\ - } while (0) - -#define int3store(T,A) do { *(T)= (uchar) ((A));\ - *(T+1)=(uchar) (((uint) (A) >> 8));\ - *(T+2)=(uchar) (((A) >> 16));\ - } while (0) - -#define int4store(T,A) do { uchar *pT= (uchar*)(T);\ - *((uint32 *) (pT))= (uint32) (A); \ - } while (0) - -#define int5store(T,A) do { uchar *pT= (uchar*)(T);\ - *((uint32 *) (pT))= (uint32) (A); \ - *((pT)+4)=(uchar) (((A) >> 32));\ - } while (0) - -#define int6store(T,A) do { uchar *pT= (uchar*)(T);\ - *((uint32 *) (pT))= (uint32) (A); \ - *((uint16*)(pT+4))= (uint16) (A >> 32);\ - } while (0) - -#define int8store(T,A) do { uchar *pT= (uchar*)(T);\ - *((ulonglong *) (pT))= (ulonglong) (A);\ - } while(0) - -#if defined(__GNUC__) - -#define HAVE_mi_uint5korr -#define HAVE_mi_uint6korr -#define HAVE_mi_uint7korr -#define HAVE_mi_uint78orr - -/* Read numbers stored in high-bytes-first order */ - -static inline ulonglong mi_uint5korr(const void *p) -{ - ulonglong a= *(uint32 *) p; - ulonglong b= *(4 + (uchar *) p); - ulonglong v= (a | (b << 32)) << 24; - asm ("bswapq %0" : "=r" (v) : "0" (v)); - return v; -} - -static inline ulonglong mi_uint6korr(const void *p) -{ - ulonglong a= *(uint32 *) p; - ulonglong b= *(uint16 *) (4 + (char *) p); - ulonglong v= (a | (b << 32)) << 16; - asm ("bswapq %0" : "=r" (v) : "0" (v)); - return v; -} - -static inline ulonglong mi_uint7korr(const void *p) -{ - ulonglong a= *(uint32 *) p; - ulonglong b= *(uint16 *) (4 + (char *) p); - ulonglong c= *(6 + (uchar *) p); - ulonglong v= (a | (b << 32) | (c << 48)) << 8; - asm ("bswapq %0" : "=r" (v) : "0" (v)); - return v; -} - -static inline ulonglong mi_uint8korr(const void *p) -{ - ulonglong v= *(ulonglong *) p; - asm ("bswapq %0" : "=r" (v) : "0" (v)); - return v; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/decimal.h b/VCMP-LUA/modules/mariadb/include/mysql/server/decimal.h deleted file mode 100644 index cab18f9..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/decimal.h +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _decimal_h -#define _decimal_h - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum -{TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} - decimal_round_mode; -typedef int32 decimal_digit_t; - -/** - intg is the number of *decimal* digits (NOT number of decimal_digit_t's !) - before the point - frac is the number of decimal digits after the point - len is the length of buf (length of allocated space) in decimal_digit_t's, - not in bytes - sign false means positive, true means negative - buf is an array of decimal_digit_t's - */ -typedef struct st_decimal_t { - int intg, frac, len; - my_bool sign; - decimal_digit_t *buf; -} decimal_t; - -int internal_str2dec(const char *from, decimal_t *to, char **end, - my_bool fixed); -int decimal2string(const decimal_t *from, char *to, int *to_len, - int fixed_precision, int fixed_decimals, - char filler); -int decimal2ulonglong(const decimal_t *from, ulonglong *to); -int ulonglong2decimal(ulonglong from, decimal_t *to); -int decimal2longlong(const decimal_t *from, longlong *to); -int longlong2decimal(longlong from, decimal_t *to); -int decimal2double(const decimal_t *from, double *to); -int double2decimal(double from, decimal_t *to); -int decimal_actual_fraction(const decimal_t *from); -int decimal2bin(const decimal_t *from, uchar *to, int precision, int scale); -int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale); - -int decimal_size(int precision, int scale); -int decimal_bin_size(int precision, int scale); -int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, - int param); - -int decimal_intg(const decimal_t *from); -int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to); -int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to); -int decimal_cmp(const decimal_t *from1, const decimal_t *from2); -int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to); -int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to, - int scale_incr); -int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to); -int decimal_round(const decimal_t *from, decimal_t *to, int new_scale, - decimal_round_mode mode); -int decimal_is_zero(const decimal_t *from); -void max_decimal(int precision, int frac, decimal_t *to); - -#define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0) -#define string2decimal_fixed(A,B,C) internal_str2dec((A), (B), (C), 1) - -/* set a decimal_t to zero */ - -#define decimal_make_zero(dec) do { \ - (dec)->buf[0]=0; \ - (dec)->intg=1; \ - (dec)->frac=0; \ - (dec)->sign=0; \ - } while(0) - -/* - returns the length of the buffer to hold string representation - of the decimal (including decimal dot, possible sign and \0) -*/ - -#define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \ - (dec)->frac + ((dec)->frac > 0) + 2) - -/* negate a decimal */ -#define decimal_neg(dec) do { (dec)->sign^=1; } while(0) - -/* - conventions: - - decimal_smth() == 0 -- everything's ok - decimal_smth() <= 1 -- result is usable, but precision loss is possible - decimal_smth() <= 2 -- result can be unusable, most significant digits - could've been lost - decimal_smth() > 2 -- no result was generated -*/ - -#define E_DEC_OK 0 -#define E_DEC_TRUNCATED 1 -#define E_DEC_OVERFLOW 2 -#define E_DEC_DIV_ZERO 4 -#define E_DEC_BAD_NUM 8 -#define E_DEC_OOM 16 - -#define E_DEC_ERROR 31 -#define E_DEC_FATAL_ERROR 30 - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/errmsg.h b/VCMP-LUA/modules/mariadb/include/mysql/server/errmsg.h deleted file mode 100644 index c0c4cfc..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/errmsg.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef ERRMSG_INCLUDED -#define ERRMSG_INCLUDED - -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Error messages numbers for MySQL clients. - The error messages itself are in libmysql/errmsg.c - - Error messages for the mysqld daemon are in sql/share/errmsg.txt -*/ - -#ifdef __cplusplus -extern "C" { -#endif -void init_client_errs(void); -void finish_client_errs(void); -extern const char *client_errors[]; /* Error messages */ -#ifdef __cplusplus -} -#endif - -#define CR_MIN_ERROR 2000 /* For easier client code */ -#define CR_MAX_ERROR 2999 -#if !defined(ER) -#define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \ - client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR]) - -#endif -#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ - -/* Do not add error numbers before CR_ERROR_FIRST. */ -/* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */ -#define CR_ERROR_FIRST 2000 /*Copy first error nr.*/ -#define CR_UNKNOWN_ERROR 2000 -#define CR_SOCKET_CREATE_ERROR 2001 -#define CR_CONNECTION_ERROR 2002 -#define CR_CONN_HOST_ERROR 2003 -#define CR_IPSOCK_ERROR 2004 -#define CR_UNKNOWN_HOST 2005 -#define CR_SERVER_GONE_ERROR 2006 -#define CR_VERSION_ERROR 2007 -#define CR_OUT_OF_MEMORY 2008 -#define CR_WRONG_HOST_INFO 2009 -#define CR_LOCALHOST_CONNECTION 2010 -#define CR_TCP_CONNECTION 2011 -#define CR_SERVER_HANDSHAKE_ERR 2012 -#define CR_SERVER_LOST 2013 -#define CR_COMMANDS_OUT_OF_SYNC 2014 -#define CR_NAMEDPIPE_CONNECTION 2015 -#define CR_NAMEDPIPEWAIT_ERROR 2016 -#define CR_NAMEDPIPEOPEN_ERROR 2017 -#define CR_NAMEDPIPESETSTATE_ERROR 2018 -#define CR_CANT_READ_CHARSET 2019 -#define CR_NET_PACKET_TOO_LARGE 2020 -#define CR_EMBEDDED_CONNECTION 2021 -#define CR_PROBE_SLAVE_STATUS 2022 -#define CR_PROBE_SLAVE_HOSTS 2023 -#define CR_PROBE_SLAVE_CONNECT 2024 -#define CR_PROBE_MASTER_CONNECT 2025 -#define CR_SSL_CONNECTION_ERROR 2026 -#define CR_MALFORMED_PACKET 2027 -#define CR_WRONG_LICENSE 2028 - -/* new 4.1 error codes */ -#define CR_NULL_POINTER 2029 -#define CR_NO_PREPARE_STMT 2030 -#define CR_PARAMS_NOT_BOUND 2031 -#define CR_DATA_TRUNCATED 2032 -#define CR_NO_PARAMETERS_EXISTS 2033 -#define CR_INVALID_PARAMETER_NO 2034 -#define CR_INVALID_BUFFER_USE 2035 -#define CR_UNSUPPORTED_PARAM_TYPE 2036 - -#define CR_SHARED_MEMORY_CONNECTION 2037 -#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2038 -#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2039 -#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2040 -#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2041 -#define CR_SHARED_MEMORY_FILE_MAP_ERROR 2042 -#define CR_SHARED_MEMORY_MAP_ERROR 2043 -#define CR_SHARED_MEMORY_EVENT_ERROR 2044 -#define CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR 2045 -#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046 -#define CR_CONN_UNKNOW_PROTOCOL 2047 -#define CR_INVALID_CONN_HANDLE 2048 -#define CR_SECURE_AUTH 2049 -#define CR_FETCH_CANCELED 2050 -#define CR_NO_DATA 2051 -#define CR_NO_STMT_METADATA 2052 -#define CR_NO_RESULT_SET 2053 -#define CR_NOT_IMPLEMENTED 2054 -#define CR_SERVER_LOST_EXTENDED 2055 -#define CR_STMT_CLOSED 2056 -#define CR_NEW_STMT_METADATA 2057 -#define CR_ALREADY_CONNECTED 2058 -#define CR_AUTH_PLUGIN_CANNOT_LOAD 2059 -#define CR_DUPLICATE_CONNECTION_ATTR 2060 -#define CR_AUTH_PLUGIN_ERR 2061 -#define CR_ERROR_LAST /*Copy last error nr:*/ 2061 -/* Add error numbers before CR_ERROR_LAST and change it accordingly. */ - -#endif /* ERRMSG_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/handler_ername.h b/VCMP-LUA/modules/mariadb/include/mysql/server/handler_ername.h deleted file mode 100644 index fe55062..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/handler_ername.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (c) 2013 SkySQL Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Names of all handler error numbers. Used by mysqltest */ - -{ "HA_ERR_KEY_NOT_FOUND", HA_ERR_KEY_NOT_FOUND, "" }, -{ "HA_ERR_FOUND_DUPP_KEY", HA_ERR_FOUND_DUPP_KEY, "" }, -{ "HA_ERR_INTERNAL_ERROR", HA_ERR_INTERNAL_ERROR, "" }, -{ "HA_ERR_RECORD_CHANGED", HA_ERR_RECORD_CHANGED, "" }, -{ "HA_ERR_WRONG_INDEX", HA_ERR_WRONG_INDEX, "" }, -{ "HA_ERR_CRASHED", HA_ERR_CRASHED, "" }, -{ "HA_ERR_WRONG_IN_RECORD", HA_ERR_WRONG_IN_RECORD, "" }, -{ "HA_ERR_OUT_OF_MEM", HA_ERR_OUT_OF_MEM, "" }, -{ "HA_ERR_NOT_A_TABLE", HA_ERR_NOT_A_TABLE, "" }, -{ "HA_ERR_WRONG_COMMAND", HA_ERR_WRONG_COMMAND, "" }, -{ "HA_ERR_OLD_FILE", HA_ERR_OLD_FILE, "" }, -{ "HA_ERR_NO_ACTIVE_RECORD", HA_ERR_NO_ACTIVE_RECORD, "" }, -{ "HA_ERR_RECORD_DELETED", HA_ERR_RECORD_DELETED, "" }, -{ "HA_ERR_RECORD_FILE_FULL", HA_ERR_RECORD_FILE_FULL, "" }, -{ "HA_ERR_INDEX_FILE_FULL", HA_ERR_INDEX_FILE_FULL, "" }, -{ "HA_ERR_END_OF_FILE", HA_ERR_END_OF_FILE, "" }, -{ "HA_ERR_UNSUPPORTED", HA_ERR_UNSUPPORTED, "" }, -{ "HA_ERR_TO_BIG_ROW", HA_ERR_TO_BIG_ROW, "" }, -{ "HA_WRONG_CREATE_OPTION", HA_WRONG_CREATE_OPTION, "" }, -{ "HA_ERR_FOUND_DUPP_UNIQUE", HA_ERR_FOUND_DUPP_UNIQUE, "" }, -{ "HA_ERR_UNKNOWN_CHARSET", HA_ERR_UNKNOWN_CHARSET, "" }, -{ "HA_ERR_WRONG_MRG_TABLE_DEF", HA_ERR_WRONG_MRG_TABLE_DEF, "" }, -{ "HA_ERR_CRASHED_ON_REPAIR", HA_ERR_CRASHED_ON_REPAIR, "" }, -{ "HA_ERR_CRASHED_ON_USAGE", HA_ERR_CRASHED_ON_USAGE, "" }, -{ "HA_ERR_LOCK_WAIT_TIMEOUT", HA_ERR_LOCK_WAIT_TIMEOUT, "" }, -{ "HA_ERR_LOCK_TABLE_FULL", HA_ERR_LOCK_TABLE_FULL, "" }, -{ "HA_ERR_READ_ONLY_TRANSACTION", HA_ERR_READ_ONLY_TRANSACTION, "" }, -{ "HA_ERR_LOCK_DEADLOCK", HA_ERR_LOCK_DEADLOCK, "" }, -{ "HA_ERR_CANNOT_ADD_FOREIGN", HA_ERR_CANNOT_ADD_FOREIGN, "" }, -{ "HA_ERR_NO_REFERENCED_ROW", HA_ERR_NO_REFERENCED_ROW, "" }, -{ "HA_ERR_ROW_IS_REFERENCED", HA_ERR_ROW_IS_REFERENCED, "" }, -{ "HA_ERR_NO_SAVEPOINT", HA_ERR_NO_SAVEPOINT, "" }, -{ "HA_ERR_NON_UNIQUE_BLOCK_SIZE", HA_ERR_NON_UNIQUE_BLOCK_SIZE, "" }, -{ "HA_ERR_NO_SUCH_TABLE", HA_ERR_NO_SUCH_TABLE, "" }, -{ "HA_ERR_TABLE_EXIST", HA_ERR_TABLE_EXIST, "" }, -{ "HA_ERR_NO_CONNECTION", HA_ERR_NO_CONNECTION, "" }, -{ "HA_ERR_NULL_IN_SPATIAL", HA_ERR_NULL_IN_SPATIAL, "" }, -{ "HA_ERR_TABLE_DEF_CHANGED", HA_ERR_TABLE_DEF_CHANGED, "" }, -{ "HA_ERR_NO_PARTITION_FOUND", HA_ERR_NO_PARTITION_FOUND, "" }, -{ "HA_ERR_RBR_LOGGING_FAILED", HA_ERR_RBR_LOGGING_FAILED, "" }, -{ "HA_ERR_DROP_INDEX_FK", HA_ERR_DROP_INDEX_FK, "" }, -{ "HA_ERR_FOREIGN_DUPLICATE_KEY", HA_ERR_FOREIGN_DUPLICATE_KEY, "" }, -{ "HA_ERR_TABLE_NEEDS_UPGRADE", HA_ERR_TABLE_NEEDS_UPGRADE, "" }, -{ "HA_ERR_TABLE_READONLY", HA_ERR_TABLE_READONLY, "" }, -{ "HA_ERR_AUTOINC_READ_FAILED", HA_ERR_AUTOINC_READ_FAILED, "" }, -{ "HA_ERR_AUTOINC_ERANGE", HA_ERR_AUTOINC_ERANGE, "" }, -{ "HA_ERR_GENERIC", HA_ERR_GENERIC, "" }, -{ "HA_ERR_RECORD_IS_THE_SAME", HA_ERR_RECORD_IS_THE_SAME, "" }, -{ "HA_ERR_LOGGING_IMPOSSIBLE", HA_ERR_LOGGING_IMPOSSIBLE, "" }, -{ "HA_ERR_CORRUPT_EVENT", HA_ERR_CORRUPT_EVENT, "" }, -{ "HA_ERR_NEW_FILE", HA_ERR_NEW_FILE, "" }, -{ "HA_ERR_ROWS_EVENT_APPLY", HA_ERR_ROWS_EVENT_APPLY, "" }, -{ "HA_ERR_INITIALIZATION", HA_ERR_INITIALIZATION, "" }, -{ "HA_ERR_FILE_TOO_SHORT", HA_ERR_FILE_TOO_SHORT, "" }, -{ "HA_ERR_WRONG_CRC", HA_ERR_WRONG_CRC, "" }, -{ "HA_ERR_TOO_MANY_CONCURRENT_TRXS", HA_ERR_TOO_MANY_CONCURRENT_TRXS, "" }, -{ "HA_ERR_INDEX_COL_TOO_LONG", HA_ERR_INDEX_COL_TOO_LONG, "" }, -{ "HA_ERR_INDEX_CORRUPT", HA_ERR_INDEX_CORRUPT, "" }, -{ "HA_ERR_UNDO_REC_TOO_BIG", HA_ERR_UNDO_REC_TOO_BIG, "" }, -{ "HA_ERR_TABLE_IN_FK_CHECK", HA_ERR_TABLE_IN_FK_CHECK, "" }, -{ "HA_ERR_ROW_NOT_VISIBLE", HA_ERR_ROW_NOT_VISIBLE, "" }, -{ "HA_ERR_ABORTED_BY_USER", HA_ERR_ABORTED_BY_USER, "" }, -{ "HA_ERR_DISK_FULL", HA_ERR_DISK_FULL, "" }, -{ "HA_ERR_INCOMPATIBLE_DEFINITION", HA_ERR_INCOMPATIBLE_DEFINITION, "" }, diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/handler_state.h b/VCMP-LUA/modules/mariadb/include/mysql/server/handler_state.h deleted file mode 100644 index 65604a6..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/handler_state.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - Map handler error message to sql states. Note that this list MUST be in - increasing order! - See sql_state.c for usage -*/ - -{ HA_ERR_KEY_NOT_FOUND, "02000", "" }, -{ HA_ERR_FOUND_DUPP_KEY, "23000", "" }, -{ HA_ERR_WRONG_COMMAND, "0A000", "" }, -{ HA_ERR_UNSUPPORTED, "0A000", "" }, -{ HA_WRONG_CREATE_OPTION, "0A000", "" }, -{ HA_ERR_FOUND_DUPP_UNIQUE, "23000", "" }, -{ HA_ERR_UNKNOWN_CHARSET, "0A000", "" }, -{ HA_ERR_READ_ONLY_TRANSACTION, "25000", "" }, -{ HA_ERR_LOCK_DEADLOCK, "40001", "" }, -{ HA_ERR_NO_REFERENCED_ROW, "23000", "" }, -{ HA_ERR_ROW_IS_REFERENCED, "23000", "" }, -{ HA_ERR_TABLE_EXIST, "42S01", "" }, -{ HA_ERR_FOREIGN_DUPLICATE_KEY, "23000", "" }, -{ HA_ERR_TABLE_READONLY, "25000", "" }, -{ HA_ERR_AUTOINC_ERANGE, "22003", "" }, diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/json_lib.h b/VCMP-LUA/modules/mariadb/include/mysql/server/json_lib.h deleted file mode 100644 index b6add6d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/json_lib.h +++ /dev/null @@ -1,437 +0,0 @@ -#ifndef JSON_LIB_INCLUDED -#define JSON_LIB_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -#define JSON_DEPTH_LIMIT 32 - -/* - When error happens, the c_next of the JSON engine contains the - character that caused the error, and the c_str is the position - in string where the error occurs. -*/ -enum json_errors { - JE_BAD_CHR= -1, /* Invalid character, charset handler cannot read it. */ - - JE_NOT_JSON_CHR= -2, /* Character met not used in JSON. */ - /* ASCII 00-08 for instance. */ - - JE_EOS= -3, /* Unexpected end of string. */ - - JE_SYN= -4, /* The next character breaks the JSON syntax. */ - - JE_STRING_CONST= -5, /* Character disallowed in string constant. */ - - JE_ESCAPING= -6, /* Error in the escaping. */ - - JE_DEPTH= -7, /* The limit on the JSON depth was overrun. */ -}; - - -typedef struct st_json_string_t -{ - const uchar *c_str; /* Current position in JSON string */ - const uchar *str_end; /* The end on the string. */ - my_wc_t c_next; /* UNICODE of the last read character */ - int error; /* error code. */ - - CHARSET_INFO *cs; /* Character set of the JSON string. */ - - my_charset_conv_mb_wc wc; /* UNICODE conversion function. */ - /* It's taken out of the cs just to speed calls. */ -} json_string_t; - - -void json_string_set_cs(json_string_t *s, CHARSET_INFO *i_cs); -void json_string_set_str(json_string_t *s, - const uchar *str, const uchar *end); -#define json_next_char(j) \ - (j)->wc((j)->cs, &(j)->c_next, (j)->c_str, (j)->str_end) -#define json_eos(j) ((j)->c_str >= (j)->str_end) -/* - read_string_const_chr() reads the next character of the string constant - and saves it to the js->c_next. - It takes into account possible escapings, so if for instance - the string is '\b', the read_string_const_chr() sets 8. -*/ -int json_read_string_const_chr(json_string_t *js); - - -/* - Various JSON-related operations expect JSON path as a parameter. - The path is a string like this "$.keyA[2].*" - The path itself is a number of steps specifying either a key or a position - in an array. Some of them can be wildcards. - So the representation of the JSON path is the json_path_t class - containing an array of json_path_step_t objects. -*/ - - -/* Path step types - actually bitmasks to let '&' or '|' operations. */ -enum json_path_step_types -{ - JSON_PATH_KEY_NULL=0, - JSON_PATH_KEY=1, /* Must be equal to JSON_VALUE_OBJECT. */ - JSON_PATH_ARRAY=2, /* Must be equal to JSON_VALUE_ARRAY. */ - JSON_PATH_KEY_OR_ARRAY=3, - JSON_PATH_WILD=4, /* Step like .* or [*] */ - JSON_PATH_DOUBLE_WILD=8, /* Step like **.k or **[1] */ - JSON_PATH_KEY_WILD= 1+4, - JSON_PATH_KEY_DOUBLEWILD= 1+8, - JSON_PATH_ARRAY_WILD= 2+4, - JSON_PATH_ARRAY_DOUBLEWILD= 2+8 -}; - - -typedef struct st_json_path_step_t -{ - enum json_path_step_types type; /* The type of the step - */ - /* see json_path_step_types */ - const uchar *key; /* Pointer to the beginning of the key. */ - const uchar *key_end; /* Pointer to the end of the key. */ - uint n_item; /* Item number in an array. No meaning for the key step. */ -} json_path_step_t; - - -typedef struct st_json_path_t -{ - json_string_t s; /* The string to be parsed. */ - json_path_step_t steps[JSON_DEPTH_LIMIT]; /* Steps of the path. */ - json_path_step_t *last_step; /* Points to the last step. */ - - int mode_strict; /* TRUE if the path specified as 'strict' */ - enum json_path_step_types types_used; /* The '|' of all step's 'type'-s */ -} json_path_t; - - -int json_path_setup(json_path_t *p, - CHARSET_INFO *i_cs, const uchar *str, const uchar *end); - - -/* - The set of functions and structures below provides interface - to the JSON text parser. - Running the parser normally goes like this: - - json_engine_t j_eng; // structure keeps parser's data - json_scan_start(j_eng) // begin the parsing - - do - { - // The parser has read next piece of JSON - // and set fields of j_eng structure accordingly. - // So let's see what we have: - switch (j_eng.state) - { - case JST_KEY: - // Handle key name. See the json_read_keyname_chr() - // Probably compare it with the keyname we're looking for - case JST_VALUE: - // Handle value. It is either value of the key or an array item. - // see the json_read_value() - case JST_OBJ_START: - // parser found an object (the '{' in JSON) - case JST_OBJ_END: - // parser found the end of the object (the '}' in JSON) - case JST_ARRAY_START: - // parser found an array (the '[' in JSON) - case JST_ARRAY_END: - // parser found the end of the array (the ']' in JSON) - - }; - } while (json_scan_next() == 0); // parse next structure - - - if (j_eng.s.error) // we need to check why the loop ended. - // Did we get to the end of JSON, or came upon error. - { - signal_error_in_JSON() - } - - - Parts of JSON can be quickly skipped. If we are not interested - in a particular key, we can just skip it with json_skip_key() call. - Similarly json_skip_level() goes right to the end of an object - or an array. -*/ - - -/* These are JSON parser states that user can expect and handle. */ -enum json_states { - JST_VALUE, /* value found */ - JST_KEY, /* key found */ - JST_OBJ_START, /* object */ - JST_OBJ_END, /* object ended */ - JST_ARRAY_START, /* array */ - JST_ARRAY_END, /* array ended */ - NR_JSON_USER_STATES -}; - - -enum json_value_types -{ - JSON_VALUE_OBJECT=1, - JSON_VALUE_ARRAY=2, - JSON_VALUE_STRING=3, - JSON_VALUE_NUMBER=4, - JSON_VALUE_TRUE=5, - JSON_VALUE_FALSE=6, - JSON_VALUE_NULL=7 -}; - - -enum json_num_flags -{ - JSON_NUM_NEG=1, /* Number is negative. */ - JSON_NUM_FRAC_PART=2, /* The fractional part is not empty. */ - JSON_NUM_EXP=4, /* The number has the 'e' part. */ -}; - - -typedef struct st_json_engine_t -{ - json_string_t s; /* String to parse. */ - int sav_c_len; /* Length of the current character. - Can be more than 1 for multibyte charsets */ - - int state; /* The state of the parser. One of 'enum json_states'. - It tells us what construction of JSON we've just read. */ - - /* These values are only set after the json_read_value() call. */ - enum json_value_types value_type; /* type of the value.*/ - const uchar *value; /* Points to the value. */ - const uchar *value_begin;/* Points to where the value starts in the JSON. */ - int value_escaped; /* Flag telling if the string value has escaping.*/ - uint num_flags; /* the details of the JSON_VALUE_NUMBER, is it negative, - or if it has the fractional part. - See the enum json_num_flags. */ - - /* - In most cases the 'value' and 'value_begin' are equal. - They only differ if the value is a string constants. Then 'value_begin' - points to the starting quotation mark, while the 'value' - to - the first character of the string. - */ - - const uchar *value_end; /* Points to the next character after the value. */ - int value_len; /* The length of the value. Does not count quotations for */ - /* string constants. */ - - int stack[JSON_DEPTH_LIMIT]; /* Keeps the stack of nested JSON structures. */ - int stack_p; /* The 'stack' pointer. */ -} json_engine_t; - - -int json_scan_start(json_engine_t *je, - CHARSET_INFO *i_cs, const uchar *str, const uchar *end); -int json_scan_next(json_engine_t *j); - - -/* - json_read_keyname_chr() function assists parsing the name of an JSON key. - It only can be called when the json_engine is in JST_KEY. - The json_read_keyname_chr() reads one character of the name of the key, - and puts it in j_eng.s.next_c. - Typical usage is like this: - - if (j_eng.state == JST_KEY) - { - while (json_read_keyname_chr(&j) == 0) - { - //handle next character i.e. match it against the pattern - } - } -*/ - -int json_read_keyname_chr(json_engine_t *j); - - -/* - Check if the name of the current JSON key matches - the step of the path. -*/ -int json_key_matches(json_engine_t *je, json_string_t *k); - - -/* - json_read_value() function parses the JSON value syntax, - so that we can handle the value of a key or an array item. - It only returns meaningful result when the engine is in - the JST_VALUE state. - - Typical usage is like this: - - if (j_eng.state == JST_VALUE) - { - json_read_value(&j_eng); - switch(j_eng.value_type) - { - case JSON_VALUE_STRING: - // get the string - str= j_eng.value; - str_length= j_eng.value_len; - case JSON_VALUE_NUMBER: - // get the number - ... etc - } -*/ -int json_read_value(json_engine_t *j); - - -/* - json_skip_key() makes parser skip the content of the current - JSON key quickly. - It can be called only when the json_engine state is JST_KEY. - Typical usage is: - - if (j_eng.state == JST_KEY) - { - if (key_does_not_match(j_eng)) - json_skip_key(j_eng); - } -*/ - -int json_skip_key(json_engine_t *j); - - -typedef const int *json_level_t; - -/* - json_skip_to_level() makes parser quickly get out of nested - loops and arrays. It is used when we're not interested in what is - there in the rest of these structures. - The 'level' should be remembered in advance. - json_level_t level= json_get_level(j); - .... // getting into the nested JSON structures - json_skip_to_level(j, level); -*/ -#define json_get_level(j) (j->stack_p) - -int json_skip_to_level(json_engine_t *j, int level); - -/* - json_skip_level() works as above with just current structure. - So it gets to the end of the current JSON array or object. -*/ -#define json_skip_level(json_engine) \ - json_skip_to_level((json_engine), (json_engine)->stack_p) - - -/* - works as json_skip_level() but also counts items on the current - level skipped. -*/ -int json_skip_level_and_count(json_engine_t *j, int *n_items_skipped); - -#define json_skip_array_item json_skip_key - -/* - Checks if the current value is of scalar type - - not an OBJECT nor ARRAY. -*/ -#define json_value_scalar(je) ((je)->value_type > JSON_VALUE_ARRAY) - - -/* - Look for the JSON PATH in the json string. - Function can be called several times with same JSON/PATH to - find multiple matches. - On the first call, the json_engine_t parameter should be - initialized with the JSON string, and the json_path_t with the JSON path - appropriately. The 'p_cur_step' should point at the first - step of the path. - The 'array_counters' is the array of JSON_DEPTH_LIMIT size. - It stores the array counters of the parsed JSON. - If function returns 0, it means it found the match. The position of - the match is je->s.c_str. Then we can call the json_find_path() - with same engine/path/p_cur_step to get the next match. - Non-zero return means no matches found. - Check je->s.error to see if there was an error in JSON. -*/ -int json_find_path(json_engine_t *je, - json_path_t *p, json_path_step_t **p_cur_step, - uint *array_counters); - - -typedef struct st_json_find_paths_t -{ - uint n_paths; - json_path_t *paths; - uint cur_depth; - uint *path_depths; - uint array_counters[JSON_DEPTH_LIMIT]; -} json_find_paths_t; - - -int json_find_paths_first(json_engine_t *je, json_find_paths_t *state, - uint n_paths, json_path_t *paths, uint *path_depths); -int json_find_paths_next(json_engine_t *je, json_find_paths_t *state); - - -/* - Converst JSON string constant into ordinary string constant - which can involve unpacking json escapes and changing character set. - Returns negative integer in the case of an error, - the length of the result otherwise. -*/ -int json_unescape(CHARSET_INFO *json_cs, - const uchar *json_str, const uchar *json_end, - CHARSET_INFO *res_cs, - uchar *res, uchar *res_end); - -/* - Converst ordinary string constant into JSON string constant. - which can involve appropriate escaping and changing character set. - Returns negative integer in the case of an error, - the length of the result otherwise. -*/ -int json_escape(CHARSET_INFO *str_cs, const uchar *str, const uchar *str_end, - CHARSET_INFO *json_cs, uchar *json, uchar *json_end); - - -/* - Appends the ASCII string to the json with the charset conversion. -*/ -int json_append_ascii(CHARSET_INFO *json_cs, - uchar *json, uchar *json_end, - const uchar *ascii, const uchar *ascii_end); - - -/* - Scan the JSON and return paths met one-by-one. - json_get_path_start(&p) - while (json_get_path_next(&p)) - { - handle_the_next_path(); - } -*/ - -int json_get_path_start(json_engine_t *je, CHARSET_INFO *i_cs, - const uchar *str, const uchar *end, - json_path_t *p); - - -int json_get_path_next(json_engine_t *je, json_path_t *p); - - -int json_path_parts_compare( - const json_path_step_t *a, const json_path_step_t *a_end, - const json_path_step_t *b, const json_path_step_t *b_end, - enum json_value_types vt); -int json_path_compare(const json_path_t *a, const json_path_t *b, - enum json_value_types vt); - -int json_valid(const char *js, size_t js_len, CHARSET_INFO *cs); - -int json_locate_key(const char *js, const char *js_end, - const char *kname, - const char **key_start, const char **key_end, - int *comma_pos); - -#ifdef __cplusplus -} -#endif - -#endif /* JSON_LIB_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/keycache.h b/VCMP-LUA/modules/mariadb/include/mysql/server/keycache.h deleted file mode 100644 index 14fd9c8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/keycache.h +++ /dev/null @@ -1,212 +0,0 @@ -/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Key cache variable structures */ - -#ifndef _keycache_h -#define _keycache_h - -#include "my_sys.h" /* flush_type */ - -C_MODE_START - -/* - Currently the default key cache is created as non-partitioned at - the start of the server unless the server is started with the parameter - --key-cache-partitions that is greater than 0 -*/ - -#define DEFAULT_KEY_CACHE_PARTITIONS 0 - -/* - MAX_KEY_CACHE_PARTITIONS cannot be greater than - sizeof(MYISAM_SHARE::dirty_part_map) - Currently sizeof(MYISAM_SHARE::dirty_part_map)=sizeof(ulonglong) -*/ - -#define MAX_KEY_CACHE_PARTITIONS 64 - -/* The structure to get statistical data about a key cache */ - -typedef struct st_key_cache_statistics -{ - ulonglong mem_size; /* memory for cache buffers/auxiliary structures */ - ulonglong block_size; /* size of the each buffers in the key cache */ - ulonglong blocks_used; /* maximum number of used blocks/buffers */ - ulonglong blocks_unused; /* number of currently unused blocks */ - ulonglong blocks_changed; /* number of currently dirty blocks */ - ulonglong blocks_warm; /* number of blocks in warm sub-chain */ - ulonglong read_requests; /* number of read requests (read hits) */ - ulonglong reads; /* number of actual reads from files into buffers */ - ulonglong write_requests; /* number of write requests (write hits) */ - ulonglong writes; /* number of actual writes from buffers into files */ -} KEY_CACHE_STATISTICS; - -#define NUM_LONG_KEY_CACHE_STAT_VARIABLES 3 - -/* The type of a key cache object */ -typedef enum key_cache_type -{ - SIMPLE_KEY_CACHE, - PARTITIONED_KEY_CACHE -} KEY_CACHE_TYPE; - - -typedef - int (*INIT_KEY_CACHE) - (void *, uint key_cache_block_size, - size_t use_mem, uint division_limit, uint age_threshold, - uint changed_blocks_hash_size); -typedef - int (*RESIZE_KEY_CACHE) - (void *, uint key_cache_block_size, - size_t use_mem, uint division_limit, uint age_threshold, - uint changed_blocks_hash_size); -typedef - void (*CHANGE_KEY_CACHE_PARAM) - (void *keycache_cb, - uint division_limit, uint age_threshold); -typedef - uchar* (*KEY_CACHE_READ) - (void *keycache_cb, - File file, my_off_t filepos, int level, - uchar *buff, uint length, - uint block_length, int return_buffer); -typedef - int (*KEY_CACHE_INSERT) - (void *keycache_cb, - File file, my_off_t filepos, int level, - uchar *buff, uint length); -typedef - int (*KEY_CACHE_WRITE) - (void *keycache_cb, - File file, void *file_extra, - my_off_t filepos, int level, - uchar *buff, uint length, - uint block_length, int force_write); -typedef - int (*FLUSH_KEY_BLOCKS) - (void *keycache_cb, - int file, void *file_extra, - enum flush_type type); -typedef - int (*RESET_KEY_CACHE_COUNTERS) - (const char *name, void *keycache_cb); -typedef - void (*END_KEY_CACHE) - (void *keycache_cb, my_bool cleanup); -typedef - void (*GET_KEY_CACHE_STATISTICS) - (void *keycache_cb, uint partition_no, - KEY_CACHE_STATISTICS *key_cache_stats); - -/* - An object of the type KEY_CACHE_FUNCS contains pointers to all functions - from the key cache interface. - Currently a key cache can be of two types: simple and partitioned. - For each of them its own static structure of the type KEY_CACHE_FUNCS is - defined . The structures contain the pointers to the implementations of - the interface functions used by simple key caches and partitioned key - caches respectively. Pointers to these structures are assigned to key cache - objects at the time of their creation. -*/ - -typedef struct st_key_cache_funcs -{ - INIT_KEY_CACHE init; - RESIZE_KEY_CACHE resize; - CHANGE_KEY_CACHE_PARAM change_param; - KEY_CACHE_READ read; - KEY_CACHE_INSERT insert; - KEY_CACHE_WRITE write; - FLUSH_KEY_BLOCKS flush; - RESET_KEY_CACHE_COUNTERS reset_counters; - END_KEY_CACHE end; - GET_KEY_CACHE_STATISTICS get_stats; -} KEY_CACHE_FUNCS; - - -typedef struct st_key_cache -{ - KEY_CACHE_TYPE key_cache_type; /* type of the key cache used for debugging */ - void *keycache_cb; /* control block of the used key cache */ - KEY_CACHE_FUNCS *interface_funcs; /* interface functions of the key cache */ - ulonglong param_buff_size; /* size the memory allocated for the cache */ - ulonglong param_block_size; /* size of the blocks in the key cache */ - ulonglong param_division_limit;/* min. percentage of warm blocks */ - ulonglong param_age_threshold; /* determines when hot block is downgraded */ - ulonglong param_partitions; /* number of the key cache partitions */ - ulonglong changed_blocks_hash_size; /* number of hash buckets for changed files */ - my_bool key_cache_inited; /* <=> key cache has been created */ - my_bool can_be_used; /* usage of cache for read/write is allowed */ - my_bool in_init; /* set to 1 in MySQL during init/resize */ - uint partitions; /* actual number of partitions */ - size_t key_cache_mem_size; /* specified size of the cache memory */ - pthread_mutex_t op_lock; /* to serialize operations like 'resize' */ -} KEY_CACHE; - - -/* The default key cache */ -extern KEY_CACHE dflt_key_cache_var, *dflt_key_cache; - -extern int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, - size_t use_mem, uint division_limit, - uint age_threshold, uint changed_blocks_hash_size, - uint partitions); -extern int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, - size_t use_mem, uint division_limit, - uint age_threshold, uint changed_blocks_hash_size); -extern void change_key_cache_param(KEY_CACHE *keycache, uint division_limit, - uint age_threshold); -extern uchar *key_cache_read(KEY_CACHE *keycache, - File file, my_off_t filepos, int level, - uchar *buff, uint length, - uint block_length,int return_buffer); -extern int key_cache_insert(KEY_CACHE *keycache, - File file, my_off_t filepos, int level, - uchar *buff, uint length); -extern int key_cache_write(KEY_CACHE *keycache, - File file, void *file_extra, - my_off_t filepos, int level, - uchar *buff, uint length, - uint block_length, int force_write); -extern int flush_key_blocks(KEY_CACHE *keycache, - int file, void *file_extra, - enum flush_type type); -extern void end_key_cache(KEY_CACHE *keycache, my_bool cleanup); -extern void get_key_cache_statistics(KEY_CACHE *keycache, - uint partition_no, - KEY_CACHE_STATISTICS *key_cache_stats); - -/* Functions to handle multiple key caches */ -extern my_bool multi_keycache_init(void); -extern void multi_keycache_free(void); -extern KEY_CACHE *multi_key_cache_search(uchar *key, uint length, - KEY_CACHE *def); -extern my_bool multi_key_cache_set(const uchar *key, uint length, - KEY_CACHE *key_cache); -extern void multi_key_cache_change(KEY_CACHE *old_data, - KEY_CACHE *new_data); -extern int reset_key_cache_counters(const char *name, - KEY_CACHE *key_cache, void *); -extern int repartition_key_cache(KEY_CACHE *keycache, - uint key_cache_block_size, - size_t use_mem, - uint division_limit, - uint age_threshold, - uint changed_blocks_hash_size, - uint partitions); -C_MODE_END -#endif /* _keycache_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/little_endian.h b/VCMP-LUA/modules/mariadb/include/mysql/server/little_endian.h deleted file mode 100644 index dcddbdd..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/little_endian.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Data in little-endian format. -*/ - -#ifndef MY_BYTE_ORDER_ARCH_OPTIMIZED -#define float4get(V,M) memcpy(&V, (M), sizeof(float)) -#define float4store(V,M) memcpy(V, (&M), sizeof(float)) -#define float8get(V,M) doubleget((V),(M)) -#define float8store(V,M) doublestore((V),(M)) - -/* Bi-endian hardware.... */ -#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) -#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\ - *(((char*)T)+1)=(char) ((uchar *) &V)[5];\ - *(((char*)T)+2)=(char) ((uchar *) &V)[6];\ - *(((char*)T)+3)=(char) ((uchar *) &V)[7];\ - *(((char*)T)+4)=(char) ((uchar *) &V)[0];\ - *(((char*)T)+5)=(char) ((uchar *) &V)[1];\ - *(((char*)T)+6)=(char) ((uchar *) &V)[2];\ - *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\ - while(0) -#define doubleget(V,M) do { double def_temp;\ - ((uchar*) &def_temp)[0]=(M)[4];\ - ((uchar*) &def_temp)[1]=(M)[5];\ - ((uchar*) &def_temp)[2]=(M)[6];\ - ((uchar*) &def_temp)[3]=(M)[7];\ - ((uchar*) &def_temp)[4]=(M)[0];\ - ((uchar*) &def_temp)[5]=(M)[1];\ - ((uchar*) &def_temp)[6]=(M)[2];\ - ((uchar*) &def_temp)[7]=(M)[3];\ - (V) = def_temp; } while(0) -#else /* Bi-endian hardware.... */ - -/* Cast away type qualifiers (necessary as macro takes argument by value). */ -#define doublestore(T,V) memcpy((T), (void*) &V, sizeof(double)) -#define doubleget(V,M) memcpy(&V, (M), sizeof(double)) - -#endif /* Bi-endian hardware.... */ - -#endif /* !MY_BYTE_ORDER_ARCH_OPTIMIZED */ - -#define ushortget(V,M) do { uchar *pM= (uchar*)(M);V = uint2korr(pM);} while(0) -#define shortget(V,M) do { uchar *pM= (uchar*)(M);V = sint2korr(pM);} while(0) -#define longget(V,M) do { uchar *pM= (uchar*)(M);V = sint4korr(pM);} while(0) -#define ulongget(V,M) do { uchar *pM= (uchar*)(M);V = uint4korr(pM);} while(0) -#define shortstore(T,V) int2store(T,V) -#define longstore(T,V) int4store(T,V) - -#ifndef floatstore -/* Cast away type qualifiers (necessary as macro takes argument by value). */ -#define floatstore(T,V) memcpy((T), (void*) (&V), sizeof(float)) -#define floatget(V,M) memcpy(&V, (M), sizeof(float)) -#endif -#ifndef doubleget -#define doubleget(V,M) memcpy(&V, (M), sizeof(double)) -#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double)) -#endif /* doubleget */ - -#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong)) -#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong)) diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/m_ctype.h b/VCMP-LUA/modules/mariadb/include/mysql/server/m_ctype.h deleted file mode 100644 index 5fa8f28..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/m_ctype.h +++ /dev/null @@ -1,1602 +0,0 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - A better inplementation of the UNIX ctype(3) library. -*/ - -#ifndef _m_ctype_h -#define _m_ctype_h - -#include - -enum loglevel { - ERROR_LEVEL= 0, - WARNING_LEVEL= 1, - INFORMATION_LEVEL= 2 -}; - -#ifdef __cplusplus -extern "C" { -#endif - -#define MY_CS_NAME_SIZE 32 -#define MY_CS_CTYPE_TABLE_SIZE 257 -#define MY_CS_TO_LOWER_TABLE_SIZE 256 -#define MY_CS_TO_UPPER_TABLE_SIZE 256 -#define MY_CS_SORT_ORDER_TABLE_SIZE 256 -#define MY_CS_TO_UNI_TABLE_SIZE 256 - -#define CHARSET_DIR "charsets/" - -#define my_wc_t ulong - -#define MY_CS_REPLACEMENT_CHARACTER 0xFFFD - -/** - Maximum character length of a string produced by wc_to_printable(). - Note, wc_to_printable() is currently limited to BMP. - One non-printable or non-convertable character can produce a string - with at most 5 characters: \hhhh. - If we ever modify wc_to_printable() to support supplementary characters, - e.g. \+hhhhhh, this constant should be changed to 8. - Note, maximum octet length of a wc_to_printable() result can be calculated - as: (MY_CS_PRINTABLE_CHAR_LENGTH*cs->mbminlen). -*/ -#define MY_CS_PRINTABLE_CHAR_LENGTH 5 - - -/* - On i386 we store Unicode->CS conversion tables for - some character sets using Big-endian order, - to copy two bytes at once. - This gives some performance improvement. -*/ -#ifdef __i386__ -#define MB2(x) (((x) >> 8) + (((x) & 0xFF) << 8)) -#define MY_PUT_MB2(s, code) { *((uint16*)(s))= (code); } -#else -#define MB2(x) (x) -#define MY_PUT_MB2(s, code) { (s)[0]= code >> 8; (s)[1]= code & 0xFF; } -#endif - -typedef const struct my_charset_handler_st MY_CHARSET_HANDLER; -typedef const struct my_collation_handler_st MY_COLLATION_HANDLER; - -typedef const struct unicase_info_st MY_UNICASE_INFO; -typedef const struct uni_ctype_st MY_UNI_CTYPE; -typedef const struct my_uni_idx_st MY_UNI_IDX; - -typedef struct unicase_info_char_st -{ - uint32 toupper; - uint32 tolower; - uint32 sort; -} MY_UNICASE_CHARACTER; - - -struct unicase_info_st -{ - my_wc_t maxchar; - MY_UNICASE_CHARACTER **page; -}; - - -extern MY_UNICASE_INFO my_unicase_default; -extern MY_UNICASE_INFO my_unicase_turkish; -extern MY_UNICASE_INFO my_unicase_mysql500; -extern MY_UNICASE_INFO my_unicase_unicode520; - -#define MY_UCA_MAX_CONTRACTION 6 -/* - The DUCET tables in ctype-uca.c are dumped with a limit of 8 weights - per character. cs->strxfrm_multiply is set to 8 for all UCA based collations. - - In language-specific UCA collations (with tailorings) we also do not allow - a single character to have more than 8 weights to stay with the same - strxfrm_multiply limit. Note, contractions are allowed to have twice longer - weight strings (up to 16 weights). As a contraction consists of at - least 2 characters, this makes sure that strxfrm_multiply ratio of 8 - is respected. -*/ -#define MY_UCA_MAX_WEIGHT_SIZE (8+1) /* Including 0 terminator */ -#define MY_UCA_CONTRACTION_MAX_WEIGHT_SIZE (2*8+1) /* Including 0 terminator */ -#define MY_UCA_WEIGHT_LEVELS 2 - -typedef struct my_contraction_t -{ - my_wc_t ch[MY_UCA_MAX_CONTRACTION]; /* Character sequence */ - uint16 weight[MY_UCA_CONTRACTION_MAX_WEIGHT_SIZE];/* Its weight string, 0-terminated */ - my_bool with_context; -} MY_CONTRACTION; - - -typedef struct my_contraction_list_t -{ - size_t nitems; /* Number of items in the list */ - MY_CONTRACTION *item; /* List of contractions */ - char *flags; /* Character flags, e.g. "is contraction head") */ -} MY_CONTRACTIONS; - -my_bool my_uca_can_be_contraction_head(const MY_CONTRACTIONS *c, my_wc_t wc); -my_bool my_uca_can_be_contraction_tail(const MY_CONTRACTIONS *c, my_wc_t wc); -uint16 *my_uca_contraction2_weight(const MY_CONTRACTIONS *c, - my_wc_t wc1, my_wc_t wc2); - - -/* Collation weights on a single level (e.g. primary, secondary, tertiarty) */ -typedef struct my_uca_level_info_st -{ - my_wc_t maxchar; - uchar *lengths; - uint16 **weights; - MY_CONTRACTIONS contractions; - uint levelno; -} MY_UCA_WEIGHT_LEVEL; - - -typedef struct uca_info_st -{ - MY_UCA_WEIGHT_LEVEL level[MY_UCA_WEIGHT_LEVELS]; - - /* Logical positions */ - my_wc_t first_non_ignorable; - my_wc_t last_non_ignorable; - my_wc_t first_primary_ignorable; - my_wc_t last_primary_ignorable; - my_wc_t first_secondary_ignorable; - my_wc_t last_secondary_ignorable; - my_wc_t first_tertiary_ignorable; - my_wc_t last_tertiary_ignorable; - my_wc_t first_trailing; - my_wc_t last_trailing; - my_wc_t first_variable; - my_wc_t last_variable; - -} MY_UCA_INFO; - - - -extern MY_UCA_INFO my_uca_v400; - - -struct uni_ctype_st -{ - uchar pctype; - const uchar *ctype; -}; - -extern MY_UNI_CTYPE my_uni_ctype[256]; - -/* wm_wc and wc_mb return codes */ -#define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */ -#define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */ -#define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */ -#define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */ -#define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */ -/* These following three are currently not really used */ -#define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */ -#define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */ -#define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */ -/* A helper macros for "need at least n bytes" */ -#define MY_CS_TOOSMALLN(n) (-100-(n)) - -#define MY_CS_MBMAXLEN 6 /* Maximum supported mbmaxlen */ -#define MY_CS_IS_TOOSMALL(rc) ((rc) >= MY_CS_TOOSMALL6 && (rc) <= MY_CS_TOOSMALL) - -#define MY_SEQ_INTTAIL 1 -#define MY_SEQ_SPACES 2 -#define MY_SEQ_NONSPACES 3 /* Skip non-space characters, including bad bytes */ - - /* My charsets_list flags */ -#define MY_CS_COMPILED 1 /* compiled-in sets */ -#define MY_CS_CONFIG 2 /* sets that have a *.conf file */ -#define MY_CS_INDEX 4 /* sets listed in the Index file */ -#define MY_CS_LOADED 8 /* sets that are currently loaded */ -#define MY_CS_BINSORT 16 /* if binary sort order */ -#define MY_CS_PRIMARY 32 /* if primary collation */ -#define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */ -#define MY_CS_UNICODE 128 /* is a charset is BMP Unicode */ -#define MY_CS_READY 256 /* if a charset is initialized */ -#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/ -#define MY_CS_CSSORT 1024 /* if case sensitive sort order */ -#define MY_CS_HIDDEN 2048 /* don't display in SHOW */ -#define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */ -#define MY_CS_NONASCII 8192 /* if not ASCII-compatible */ -#define MY_CS_UNICODE_SUPPLEMENT 16384 /* Non-BMP Unicode characters */ -#define MY_CS_LOWER_SORT 32768 /* If use lower case as weight */ -#define MY_CS_STRNXFRM_BAD_NWEIGHTS 0x10000 /* strnxfrm ignores "nweights" */ -#define MY_CS_NOPAD 0x20000 /* if does not ignore trailing spaces */ -#define MY_CS_NON1TO1 0x40000 /* Has a complex mapping from characters - to weights, e.g. contractions, expansions, - ignorable characters */ -#define MY_CHARSET_UNDEFINED 0 - -/* Character repertoire flags */ -typedef enum enum_repertoire_t -{ - MY_REPERTOIRE_NONE= 0, - MY_REPERTOIRE_ASCII= 1, /* Pure ASCII U+0000..U+007F */ - MY_REPERTOIRE_EXTENDED= 2, /* Extended characters: U+0080..U+FFFF */ - MY_REPERTOIRE_UNICODE30= 3 /* ASCII | EXTENDED: U+0000..U+FFFF */ -} my_repertoire_t; - - -/* Flags for strxfrm */ -#define MY_STRXFRM_LEVEL1 0x00000001 /* for primary weights */ -#define MY_STRXFRM_LEVEL2 0x00000002 /* for secondary weights */ -#define MY_STRXFRM_LEVEL3 0x00000004 /* for tertiary weights */ -#define MY_STRXFRM_LEVEL4 0x00000008 /* fourth level weights */ -#define MY_STRXFRM_LEVEL5 0x00000010 /* fifth level weights */ -#define MY_STRXFRM_LEVEL6 0x00000020 /* sixth level weights */ -#define MY_STRXFRM_LEVEL_ALL 0x0000003F /* Bit OR for the above six */ -#define MY_STRXFRM_NLEVELS 6 /* Number of possible levels*/ - -#define MY_STRXFRM_PAD_WITH_SPACE 0x00000040 /* if pad result with spaces */ -#define MY_STRXFRM_PAD_TO_MAXLEN 0x00000080 /* if pad tail(for filesort) */ - -#define MY_STRXFRM_DESC_LEVEL1 0x00000100 /* if desc order for level1 */ -#define MY_STRXFRM_DESC_LEVEL2 0x00000200 /* if desc order for level2 */ -#define MY_STRXFRM_DESC_LEVEL3 0x00000300 /* if desc order for level3 */ -#define MY_STRXFRM_DESC_LEVEL4 0x00000800 /* if desc order for level4 */ -#define MY_STRXFRM_DESC_LEVEL5 0x00001000 /* if desc order for level5 */ -#define MY_STRXFRM_DESC_LEVEL6 0x00002000 /* if desc order for level6 */ -#define MY_STRXFRM_DESC_SHIFT 8 - -#define MY_STRXFRM_UNUSED_00004000 0x00004000 /* for future extensions */ -#define MY_STRXFRM_UNUSED_00008000 0x00008000 /* for future extensions */ - -#define MY_STRXFRM_REVERSE_LEVEL1 0x00010000 /* if reverse order for level1 */ -#define MY_STRXFRM_REVERSE_LEVEL2 0x00020000 /* if reverse order for level2 */ -#define MY_STRXFRM_REVERSE_LEVEL3 0x00040000 /* if reverse order for level3 */ -#define MY_STRXFRM_REVERSE_LEVEL4 0x00080000 /* if reverse order for level4 */ -#define MY_STRXFRM_REVERSE_LEVEL5 0x00100000 /* if reverse order for level5 */ -#define MY_STRXFRM_REVERSE_LEVEL6 0x00200000 /* if reverse order for level6 */ -#define MY_STRXFRM_REVERSE_SHIFT 16 - -/* - Collation IDs for MariaDB that should not conflict with MySQL. - We reserve 256..511, because MySQL will most likely use this range - when the range 0..255 is full. - - We use the next 256 IDs starting from 512 and divide - them into 8 chunks, 32 collations each, as follows: - - 512 + (0..31) for single byte collations (e.g. latin9) - 512 + (32..63) reserved (e.g. for utf32le, or more single byte collations) - 512 + (64..95) for utf8 - 512 + (96..127) for utf8mb4 - 512 + (128..159) for ucs2 - 512 + (160..192) for utf16 - 512 + (192..223) for utf16le - 512 + (224..255) for utf32 -*/ -#define MY_PAGE2_COLLATION_ID_8BIT 0x200 -#define MY_PAGE2_COLLATION_ID_RESERVED 0x220 -#define MY_PAGE2_COLLATION_ID_UTF8 0x240 -#define MY_PAGE2_COLLATION_ID_UTF8MB4 0x260 -#define MY_PAGE2_COLLATION_ID_UCS2 0x280 -#define MY_PAGE2_COLLATION_ID_UTF16 0x2A0 -#define MY_PAGE2_COLLATION_ID_UTF16LE 0x2C0 -#define MY_PAGE2_COLLATION_ID_UTF32 0x2E0 - -struct my_uni_idx_st -{ - uint16 from; - uint16 to; - const uchar *tab; -}; - -typedef struct -{ - uint beg; - uint end; - uint mb_len; -} my_match_t; - -enum my_lex_states -{ - MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT, - MY_LEX_IDENT_SEP, MY_LEX_IDENT_START, - MY_LEX_REAL, MY_LEX_HEX_NUMBER, MY_LEX_BIN_NUMBER, - MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END, - MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL, - MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE, - MY_LEX_LONG_COMMENT, MY_LEX_END_LONG_COMMENT, MY_LEX_SEMICOLON, - MY_LEX_SET_VAR, MY_LEX_USER_END, MY_LEX_HOSTNAME, MY_LEX_SKIP, - MY_LEX_USER_VARIABLE_DELIMITER, MY_LEX_SYSTEM_VAR, - MY_LEX_IDENT_OR_KEYWORD, - MY_LEX_IDENT_OR_HEX, MY_LEX_IDENT_OR_BIN, MY_LEX_IDENT_OR_NCHAR, - MY_LEX_STRING_OR_DELIMITER, MY_LEX_MINUS_OR_COMMENT, MY_LEX_PLACEHOLDER, - MY_LEX_COMMA -}; - -struct charset_info_st; - -typedef struct my_charset_loader_st -{ - char error[128]; - void *(*once_alloc)(size_t); - void *(*malloc)(size_t); - void *(*realloc)(void *, size_t); - void (*free)(void *); - void (*reporter)(enum loglevel, const char *format, ...); - int (*add_collation)(struct charset_info_st *cs); -} MY_CHARSET_LOADER; - - -extern int (*my_string_stack_guard)(int); - -/* See strings/CHARSET_INFO.txt for information about this structure */ -struct my_collation_handler_st -{ - my_bool (*init)(struct charset_info_st *, MY_CHARSET_LOADER *); - /* Collation routines */ - int (*strnncoll)(CHARSET_INFO *, - const uchar *, size_t, const uchar *, size_t, my_bool); - int (*strnncollsp)(CHARSET_INFO *, - const uchar *, size_t, const uchar *, size_t); - size_t (*strnxfrm)(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); - size_t (*strnxfrmlen)(CHARSET_INFO *, size_t); - my_bool (*like_range)(CHARSET_INFO *, - const char *s, size_t s_length, - pchar w_prefix, pchar w_one, pchar w_many, - size_t res_length, - char *min_str, char *max_str, - size_t *min_len, size_t *max_len); - int (*wildcmp)(CHARSET_INFO *, - const char *str,const char *str_end, - const char *wildstr,const char *wildend, - int escape,int w_one, int w_many); - - int (*strcasecmp)(CHARSET_INFO *, const char *, const char *); - - uint (*instr)(CHARSET_INFO *, - const char *b, size_t b_length, - const char *s, size_t s_length, - my_match_t *match, uint nmatch); - - /* Hash calculation */ - void (*hash_sort)(CHARSET_INFO *cs, const uchar *key, size_t len, - ulong *nr1, ulong *nr2); - my_bool (*propagate)(CHARSET_INFO *cs, const uchar *str, size_t len); -}; - -extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; -extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; -extern MY_COLLATION_HANDLER my_collation_8bit_nopad_bin_handler; -extern MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler; - -/* Some typedef to make it easy for C++ to make function pointers */ -typedef int (*my_charset_conv_mb_wc)(CHARSET_INFO *, my_wc_t *, - const uchar *, const uchar *); -typedef int (*my_charset_conv_wc_mb)(CHARSET_INFO *, my_wc_t, - uchar *, uchar *); -typedef size_t (*my_charset_conv_case)(CHARSET_INFO *, - const char *, size_t, char *, size_t); - -/* - A structure to return the statistics of a native string copying, - when no Unicode conversion is involved. - - The structure is OK to be uninitialized before calling a copying routine. - A copying routine must populate the structure as follows: - - m_source_end_pos must be set by to a non-NULL value - in the range of the input string. - - m_well_formed_error_pos must be set to NULL if the string was - well formed, or to the position of the leftmost bad byte sequence. -*/ -typedef struct -{ - const char *m_source_end_pos; /* Position where reading stopped */ - const char *m_well_formed_error_pos; /* Position where a bad byte was found*/ -} MY_STRCOPY_STATUS; - - -/* - A structure to return the statistics of a Unicode string conversion. -*/ -typedef struct -{ - const char *m_cannot_convert_error_pos; -} MY_STRCONV_STATUS; - - -/* See strings/CHARSET_INFO.txt about information on this structure */ -struct my_charset_handler_st -{ - my_bool (*init)(struct charset_info_st *, MY_CHARSET_LOADER *loader); - /* Multibyte routines */ - size_t (*numchars)(CHARSET_INFO *, const char *b, const char *e); - size_t (*charpos)(CHARSET_INFO *, const char *b, const char *e, - size_t pos); - size_t (*lengthsp)(CHARSET_INFO *, const char *ptr, size_t length); - size_t (*numcells)(CHARSET_INFO *, const char *b, const char *e); - - /* Unicode conversion */ - my_charset_conv_mb_wc mb_wc; - my_charset_conv_wc_mb wc_mb; - - /* CTYPE scanner */ - int (*ctype)(CHARSET_INFO *cs, int *ctype, - const uchar *s, const uchar *e); - - /* Functions for case and sort conversion */ - size_t (*caseup_str)(CHARSET_INFO *, char *); - size_t (*casedn_str)(CHARSET_INFO *, char *); - - my_charset_conv_case caseup; - my_charset_conv_case casedn; - - /* Charset dependent snprintf() */ - size_t (*snprintf)(CHARSET_INFO *, char *to, size_t n, - const char *fmt, - ...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5); - size_t (*long10_to_str)(CHARSET_INFO *, char *to, size_t n, - int radix, long int val); - size_t (*longlong10_to_str)(CHARSET_INFO *, char *to, size_t n, - int radix, longlong val); - - void (*fill)(CHARSET_INFO *, char *to, size_t len, int fill); - - /* String-to-number conversion routines */ - long (*strntol)(CHARSET_INFO *, const char *s, size_t l, - int base, char **e, int *err); - ulong (*strntoul)(CHARSET_INFO *, const char *s, size_t l, - int base, char **e, int *err); - longlong (*strntoll)(CHARSET_INFO *, const char *s, size_t l, - int base, char **e, int *err); - ulonglong (*strntoull)(CHARSET_INFO *, const char *s, size_t l, - int base, char **e, int *err); - double (*strntod)(CHARSET_INFO *, char *s, size_t l, char **e, - int *err); - longlong (*strtoll10)(CHARSET_INFO *cs, - const char *nptr, char **endptr, int *error); - ulonglong (*strntoull10rnd)(CHARSET_INFO *cs, - const char *str, size_t length, - int unsigned_fl, - char **endptr, int *error); - size_t (*scan)(CHARSET_INFO *, const char *b, const char *e, - int sq); - - /* String copying routines and helpers for them */ - /* - charlen() - calculate length of the left-most character in bytes. - @param cs Character set - @param str The beginning of the string - @param end The end of the string - - @return MY_CS_ILSEQ if a bad byte sequence was found. - @return MY_CS_TOOSMALLN(x) if the string ended unexpectedly. - @return a positive number in the range 1..mbmaxlen, - if a valid character was found. - */ - int (*charlen)(CHARSET_INFO *cs, const uchar *str, const uchar *end); - /* - well_formed_char_length() - returns character length of a string. - - @param cs Character set - @param str The beginning of the string - @param end The end of the string - @param nchars Not more than "nchars" left-most characters are checked. - @param status[OUT] Additional statistics is returned here. - "status" can be uninitialized before the call, - and it is fully initialized after the call. - - status->m_source_end_pos is set to the position where reading stopped. - - If a bad byte sequence is found, the function returns immediately and - status->m_well_formed_error_pos is set to the position where a bad byte - sequence was found. - - status->m_well_formed_error_pos is set to NULL if no bad bytes were found. - If status->m_well_formed_error_pos is NULL after the call, that means: - - either the function reached the end of the string, - - or all "nchars" characters were read. - The caller can check status->m_source_end_pos to detect which of these two - happened. - */ - size_t (*well_formed_char_length)(CHARSET_INFO *cs, - const char *str, const char *end, - size_t nchars, - MY_STRCOPY_STATUS *status); - - /* - copy_fix() - copy a string, replace bad bytes to '?'. - Not more than "nchars" characters are copied. - - status->m_source_end_pos is set to a position in the range - between "src" and "src + src_length", where reading stopped. - - status->m_well_formed_error_pos is set to NULL if the string - in the range "src" and "status->m_source_end_pos" was well formed, - or is set to a position between "src" and "src + src_length" where - the leftmost bad byte sequence was found. - */ - size_t (*copy_fix)(CHARSET_INFO *, - char *dst, size_t dst_length, - const char *src, size_t src_length, - size_t nchars, MY_STRCOPY_STATUS *status); - /** - Write a character to the target string, using its native code. - For Unicode character sets (utf8, ucs2, utf16, utf16le, utf32, filename) - native codes are equivalent to Unicode code points. - For 8bit character sets the native code is just the byte value. - For Asian characters sets: - - MB1 native code is just the byte value (e.g. on the ASCII range) - - MB2 native code is ((b0 << 8) + b1). - - MB3 native code is ((b0 <<16) + (b1 << 8) + b2) - Note, CHARSET_INFO::min_sort_char and CHARSET_INFO::max_sort_char - are defined in native notation and should be written using - my_ci_native_to_mb() rather than my_ci_wc_mb(). - */ - my_charset_conv_wc_mb native_to_mb; - my_charset_conv_wc_mb wc_to_printable; -}; - -extern MY_CHARSET_HANDLER my_charset_8bit_handler; -extern MY_CHARSET_HANDLER my_charset_ucs2_handler; -extern MY_CHARSET_HANDLER my_charset_utf8mb3_handler; - - -/* - We define this CHARSET_INFO_DEFINED here to prevent a repeat of the - typedef in hash.c, which will cause a compiler error. -*/ -#define CHARSET_INFO_DEFINED - - -/* See strings/CHARSET_INFO.txt about information on this structure */ -struct charset_info_st -{ - uint number; - uint primary_number; - uint binary_number; - uint state; - const char *csname; - const char *name; - const char *comment; - const char *tailoring; - const uchar *m_ctype; - const uchar *to_lower; - const uchar *to_upper; - const uchar *sort_order; - MY_UCA_INFO *uca; - const uint16 *tab_to_uni; - MY_UNI_IDX *tab_from_uni; - MY_UNICASE_INFO *caseinfo; - const uchar *state_map; - const uchar *ident_map; - uint strxfrm_multiply; - uchar caseup_multiply; - uchar casedn_multiply; - uint mbminlen; - uint mbmaxlen; - my_wc_t min_sort_char; - my_wc_t max_sort_char; /* For LIKE optimization */ - uchar pad_char; - my_bool escape_with_backslash_is_dangerous; - uchar levels_for_order; - - MY_CHARSET_HANDLER *cset; - MY_COLLATION_HANDLER *coll; - -#ifdef __cplusplus - /* Character set routines */ - bool use_mb() const - { - return mbmaxlen > 1; - } - - size_t numchars(const char *b, const char *e) const - { - return (cset->numchars)(this, b, e); - } - - size_t charpos(const char *b, const char *e, size_t pos) const - { - return (cset->charpos)(this, b, e, pos); - } - size_t charpos(const uchar *b, const uchar *e, size_t pos) const - { - return (cset->charpos)(this, (const char *) b, (const char*) e, pos); - } - - size_t lengthsp(const char *str, size_t length) const - { - return (cset->lengthsp)(this, str, length); - } - - size_t numcells(const char *b, const char *e) const - { - return (cset->numcells)(this, b, e); - } - - size_t caseup(const char *src, size_t srclen, - char *dst, size_t dstlen) const - { - return (cset->caseup)(this, src, srclen, dst, dstlen); - } - - size_t casedn(const char *src, size_t srclen, - char *dst, size_t dstlen) const - { - return (cset->casedn)(this, src, srclen, dst, dstlen); - } - - size_t long10_to_str(char *dst, size_t dstlen, - int radix, long int val) const - { - return (cset->long10_to_str)(this, dst, dstlen, radix, val); - } - - size_t (longlong10_to_str)(char *dst, size_t dstlen, - int radix, longlong val) const - { - return (cset->longlong10_to_str)(this, dst, dstlen, radix, val); - } - - int mb_wc(my_wc_t *wc, const uchar *b, const uchar *e) const - { - return (cset->mb_wc)(this, wc, b, e); - } - - int wc_mb(my_wc_t wc, uchar *s, uchar *e) const - { - return (cset->wc_mb)(this, wc, s, e); - } - - int native_to_mb(my_wc_t wc, uchar *s, uchar *e) const - { - return (cset->native_to_mb)(this, wc, s, e); - } - - int wc_to_printable(my_wc_t wc, uchar *s, uchar *e) const - { - return (cset->wc_to_printable)(this, wc, s, e); - } - - int ctype(int *to, const uchar *s, const uchar *e) const - { - return (cset->ctype)(this, to, s, e); - } - - void fill(char *to, size_t len, int ch) const - { - (cset->fill)(this, to, len, ch); - } - - long strntol(const char *str, size_t length, - int base, char **endptr, int *error) const - { - return (cset->strntol)(this, str, length, base, endptr, error); - } - - ulong strntoul(const char *str, size_t length, - int base, char **endptr, int *error) const - { - return (cset->strntoul)(this, str, length, base, endptr, error); - } - - longlong strntoll(const char *str, size_t length, - int base, char **endptr, int *error) const - { - return (cset->strntoll)(this, str, length, base, endptr, error); - } - - ulonglong strntoull(const char *str, size_t length, - int base, char **endptr, int *error) const - { - return (cset->strntoull)(this, str, length, base, endptr, error); - } - - double strntod(char *str, size_t length, - char **endptr, int *error) const - { - return (cset->strntod)(this, str, length, endptr, error); - } - - longlong strtoll10(const char *str, char **endptr, int *error) const - { - return (cset->strtoll10)(this, str, endptr, error); - } - - ulonglong strntoull10rnd(const char *str, size_t length, int unsigned_fl, - char **endptr, int *error) const - { - return (cset->strntoull10rnd)(this, str, length, unsigned_fl, endptr, error); - } - - size_t scan(const char *b, const char *e, int seq) const - { - return (cset->scan)(this, b, e, seq); - } - - int charlen(const uchar *str, const uchar *end) const - { - return (cset->charlen)(this, str, end); - } - int charlen(const char *str, const char *end) const - { - return (cset->charlen)(this, (const uchar *) str, (const uchar *) end); - } - - uint charlen_fix(const uchar *str, const uchar *end) const - { - int char_length= (cset->charlen)(this, str, end); - DBUG_ASSERT(str < end); - return char_length > 0 ? (uint) char_length : (uint) 1U; - } - uint charlen_fix(const char *str, const char *end) const - { - return charlen_fix((const uchar *) str, (const uchar *) end); - } - - size_t well_formed_char_length(const char *str, const char *end, - size_t nchars, - MY_STRCOPY_STATUS *status) const - { - return (cset->well_formed_char_length)(this, str, end, nchars, status); - } - - size_t copy_fix(char *dst, size_t dst_length, - const char *src, size_t src_length, - size_t nchars, MY_STRCOPY_STATUS *status) const - { - return (cset->copy_fix)(this, dst, dst_length, src, src_length, nchars, - status); - } - - /* Collation routines */ - int strnncoll(const uchar *a, size_t alen, - const uchar *b, size_t blen, my_bool b_is_prefix= FALSE) const - { - return (coll->strnncoll)(this, a, alen, b, blen, b_is_prefix); - } - int strnncoll(const char *a, size_t alen, - const char *b, size_t blen, my_bool b_is_prefix= FALSE) const - { - return (coll->strnncoll)(this, - (const uchar *) a, alen, - (const uchar *) b, blen, b_is_prefix); - } - - int strnncollsp(const uchar *a, size_t alen, - const uchar *b, size_t blen) const - { - return (coll->strnncollsp)(this, a, alen, b, blen); - } - int strnncollsp(const char *a, size_t alen, - const char *b, size_t blen) const - { - return (coll->strnncollsp)(this, (uchar *) a, alen, (uchar *) b, blen); - } - - size_t strnxfrm(char *dst, size_t dstlen, uint nweights, - const char *src, size_t srclen, uint flags) const - { - return (coll->strnxfrm)(this, - (uchar *) dst, dstlen, nweights, - (const uchar *) src, srclen, flags); - } - size_t strnxfrm(uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags) const - { - return (coll->strnxfrm)(this, - dst, dstlen, nweights, - src, srclen, flags); - } - size_t strnxfrm(uchar *dst, size_t dstlen, - const uchar *src, size_t srclen) const - { - return (coll->strnxfrm)(this, - dst, dstlen, (uint) dstlen, - src, srclen, MY_STRXFRM_PAD_WITH_SPACE); - } - - size_t strnxfrmlen(size_t length) const - { - return (coll->strnxfrmlen)(this, length); - } - - my_bool like_range(const char *s, size_t s_length, - pchar w_prefix, pchar w_one, pchar w_many, - size_t res_length, - char *min_str, char *max_str, - size_t *min_len, size_t *max_len) const - { - return (coll->like_range)(this, s, s_length, - w_prefix, w_one, w_many, - res_length, min_str, max_str, - min_len, max_len); - } - - int wildcmp(const char *str,const char *str_end, - const char *wildstr,const char *wildend, - int escape,int w_one, int w_many) const - { - return (coll->wildcmp)(this, str, str_end, wildstr, wildend, escape, w_one, w_many); - } - - uint instr(const char *b, size_t b_length, - const char *s, size_t s_length, - my_match_t *match, uint nmatch) const - { - return (coll->instr)(this, b, b_length, s, s_length, match, nmatch); - } - - void hash_sort(const uchar *key, size_t len, ulong *nr1, ulong *nr2) const - { - (coll->hash_sort)(this, key, len, nr1, nr2); - } - - my_bool propagate(const uchar *str, size_t len) const - { - return (coll->propagate)(this, str, len); - } - -#endif /* __cplusplus */ -}; - - -/* Character set routines */ - -static inline my_bool -my_ci_init_charset(struct charset_info_st *ci, MY_CHARSET_LOADER *loader) -{ - if (!ci->cset->init) - return FALSE; - return (ci->cset->init)(ci, loader); -} - - -static inline my_bool -my_ci_use_mb(CHARSET_INFO *ci) -{ - return ci->mbmaxlen > 1 ? TRUE : FALSE; -} - -static inline size_t -my_ci_numchars(CHARSET_INFO *cs, const char *b, const char *e) -{ - return (cs->cset->numchars)(cs, b, e); -} - -static inline size_t -my_ci_charpos(CHARSET_INFO *cs, const char *b, const char *e, size_t pos) -{ - return (cs->cset->charpos)(cs, b, e, pos); -} - -static inline size_t -my_ci_lengthsp(CHARSET_INFO *cs, const char *str, size_t length) -{ - return (cs->cset->lengthsp)(cs, str, length); -} - -static inline size_t -my_ci_numcells(CHARSET_INFO *cs, const char *b, const char *e) -{ - return (cs->cset->numcells)(cs, b, e); -} - -static inline size_t -my_ci_caseup(CHARSET_INFO *ci, - const char *src, size_t srclen, - char *dst, size_t dstlen) -{ - return (ci->cset->caseup)(ci, src, srclen, dst, dstlen); -} - -static inline size_t -my_ci_casedn(CHARSET_INFO *ci, - const char *src, size_t srclen, - char *dst, size_t dstlen) -{ - return (ci->cset->casedn)(ci, src, srclen, dst, dstlen); -} - -static inline size_t -my_ci_long10_to_str(CHARSET_INFO *cs, char *dst, size_t dstlen, - int radix, long int val) -{ - return (cs->cset->long10_to_str)(cs, dst, dstlen, radix, val); -} - -static inline size_t -my_ci_longlong10_to_str(CHARSET_INFO *cs, char *dst, size_t dstlen, - int radix, longlong val) -{ - return (cs->cset->longlong10_to_str)(cs, dst, dstlen, radix, val); -} - -#define my_ci_mb_wc(s, pwc, b, e) ((s)->cset->mb_wc)(s, pwc, b, e) -#define my_ci_wc_mb(s, wc, b, e) ((s)->cset->wc_mb)(s, wc, b, e) -#define my_ci_native_to_mb(s, wc, b, e) ((s)->cset->native_to_mb)(s, wc, b, e) -#define my_ci_ctype(s, pctype, b, e) ((s)->cset->ctype)(s, pctype, b, e) - -static inline void -my_ci_fill(CHARSET_INFO *cs, char *to, size_t len, int ch) -{ - (cs->cset->fill)(cs, to, len, ch); -} - -static inline long -my_ci_strntol(CHARSET_INFO *cs, const char *str, size_t length, - int base, char **endptr, int *error) -{ - return (cs->cset->strntol)(cs, str, length, base, endptr, error); -} - -static inline ulong -my_ci_strntoul(CHARSET_INFO *cs, const char *str, size_t length, - int base, char **endptr, int *error) -{ - return (cs->cset->strntoul)(cs, str, length, base, endptr, error); -} - -static inline longlong -my_ci_strntoll(CHARSET_INFO *cs, const char *str, size_t length, - int base, char **endptr, int *error) -{ - return (cs->cset->strntoll)(cs, str, length, base, endptr, error); -} - -static inline ulonglong -my_ci_strntoull(CHARSET_INFO *cs, const char *str, size_t length, - int base, char **endptr, int *error) -{ - return (cs->cset->strntoull)(cs, str, length, base, endptr, error); -} - -static inline double -my_ci_strntod(CHARSET_INFO *cs, char *str, size_t length, - char **endptr, int *error) -{ - return (cs->cset->strntod)(cs, str, length, endptr, error); -} - -static inline longlong -my_ci_strtoll10(CHARSET_INFO *cs, const char *str, char **endptr, int *error) -{ - return (cs->cset->strtoll10)(cs, str, endptr, error); -} - -static inline ulonglong -my_ci_strntoull10rnd(CHARSET_INFO *cs, - const char *str, size_t length, int unsigned_fl, - char **endptr, int *error) -{ - return (cs->cset->strntoull10rnd)(cs, str, length, unsigned_fl, endptr, error); -} - - -static inline size_t -my_ci_scan(CHARSET_INFO *cs, const char *b, const char *e, int seq) -{ - return (cs->cset->scan)(cs, b, e, seq); -} - - -/** - Return length of the leftmost character in a string. - @param cs - character set - @param str - the beginning of the string - @param end - the string end (the next byte after the string) - @return <=0 on errors (EOL, wrong byte sequence) - @return 1 on a single byte character - @return >1 on a multi-byte character - - Note, inlike my_ismbchar(), 1 is returned for a single byte character. -*/ - -static inline int -my_ci_charlen(CHARSET_INFO *cs, const uchar *str, const uchar *end) -{ - return (cs->cset->charlen)(cs, str, end); -} - - -static inline size_t -my_ci_well_formed_char_length(CHARSET_INFO *cs, - const char *str, const char *end, - size_t nchars, - MY_STRCOPY_STATUS *status) -{ - return (cs->cset->well_formed_char_length)(cs, str, end, nchars, status); -} - - -static inline size_t -my_ci_copy_fix(CHARSET_INFO *cs, - char *dst, size_t dst_length, - const char *src, size_t src_length, - size_t nchars, MY_STRCOPY_STATUS *status) -{ - return (cs->cset->copy_fix)(cs, dst, dst_length, src, src_length, nchars, - status); -} - - -/* Collation routines */ - -static inline my_bool -my_ci_init_collation(struct charset_info_st *ci, MY_CHARSET_LOADER *loader) -{ - if (!ci->coll->init) - return FALSE; - return (ci->coll->init)(ci, loader); -} - - -static inline int -my_ci_strnncoll(CHARSET_INFO *ci, - const uchar *a, size_t alen, - const uchar *b, size_t blen, - my_bool b_is_prefix) -{ - return (ci->coll->strnncoll)(ci, a, alen, b, blen, b_is_prefix); -} - -static inline int -my_ci_strnncollsp(CHARSET_INFO *ci, - const uchar *a, size_t alen, - const uchar *b, size_t blen) -{ - return (ci->coll->strnncollsp)(ci, a, alen, b, blen); -} - - -static inline my_bool -my_ci_like_range(CHARSET_INFO *ci, - const char *s, size_t s_length, - pchar w_prefix, pchar w_one, pchar w_many, - size_t res_length, - char *min_str, char *max_str, - size_t *min_len, size_t *max_len) -{ - return (ci->coll->like_range)(ci, s, s_length, - w_prefix, w_one, w_many, - res_length, min_str, max_str, - min_len, max_len); -} - - -static inline uint -my_ci_instr(CHARSET_INFO *ci, - const char *b, size_t b_length, - const char *s, size_t s_length, - my_match_t *match, uint nmatch) -{ - return (ci->coll->instr)(ci, b, b_length, s, s_length, match, nmatch); -} - - -static inline void -my_ci_hash_sort(CHARSET_INFO *ci, - const uchar *key, size_t len, - ulong *nr1, ulong *nr2) -{ - (ci->coll->hash_sort)(ci, key, len, nr1, nr2); -} - - -#define ILLEGAL_CHARSET_INFO_NUMBER (~0U) - -extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_bin; -extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1; -extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad; -extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_filename; -extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb3_general_ci; - -extern struct charset_info_st my_charset_big5_bin; -extern struct charset_info_st my_charset_big5_chinese_ci; -extern struct charset_info_st my_charset_big5_nopad_bin; -extern struct charset_info_st my_charset_big5_chinese_nopad_ci; -extern struct charset_info_st my_charset_cp1250_czech_ci; -extern struct charset_info_st my_charset_cp932_bin; -extern struct charset_info_st my_charset_cp932_japanese_ci; -extern struct charset_info_st my_charset_cp932_nopad_bin; -extern struct charset_info_st my_charset_cp932_japanese_nopad_ci; -extern struct charset_info_st my_charset_eucjpms_bin; -extern struct charset_info_st my_charset_eucjpms_japanese_ci; -extern struct charset_info_st my_charset_eucjpms_nopad_bin; -extern struct charset_info_st my_charset_eucjpms_japanese_nopad_ci; -extern struct charset_info_st my_charset_euckr_bin; -extern struct charset_info_st my_charset_euckr_korean_ci; -extern struct charset_info_st my_charset_euckr_nopad_bin; -extern struct charset_info_st my_charset_euckr_korean_nopad_ci; -extern struct charset_info_st my_charset_gb2312_bin; -extern struct charset_info_st my_charset_gb2312_chinese_ci; -extern struct charset_info_st my_charset_gb2312_nopad_bin; -extern struct charset_info_st my_charset_gb2312_chinese_nopad_ci; -extern struct charset_info_st my_charset_gbk_bin; -extern struct charset_info_st my_charset_gbk_chinese_ci; -extern struct charset_info_st my_charset_gbk_nopad_bin; -extern struct charset_info_st my_charset_gbk_chinese_nopad_ci; -extern struct charset_info_st my_charset_latin1_bin; -extern struct charset_info_st my_charset_latin1_nopad_bin; -extern struct charset_info_st my_charset_latin1_german2_ci; -extern struct charset_info_st my_charset_latin2_czech_ci; -extern struct charset_info_st my_charset_sjis_bin; -extern struct charset_info_st my_charset_sjis_japanese_ci; -extern struct charset_info_st my_charset_sjis_nopad_bin; -extern struct charset_info_st my_charset_sjis_japanese_nopad_ci; -extern struct charset_info_st my_charset_tis620_bin; -extern struct charset_info_st my_charset_tis620_thai_ci; -extern struct charset_info_st my_charset_tis620_nopad_bin; -extern struct charset_info_st my_charset_tis620_thai_nopad_ci; -extern struct charset_info_st my_charset_ucs2_bin; -extern struct charset_info_st my_charset_ucs2_general_ci; -extern struct charset_info_st my_charset_ucs2_nopad_bin; -extern struct charset_info_st my_charset_ucs2_general_nopad_ci; -extern struct charset_info_st my_charset_ucs2_general_mysql500_ci; -extern struct charset_info_st my_charset_ucs2_unicode_ci; -extern struct charset_info_st my_charset_ucs2_unicode_nopad_ci; -extern struct charset_info_st my_charset_ucs2_general_mysql500_ci; -extern struct charset_info_st my_charset_ujis_bin; -extern struct charset_info_st my_charset_ujis_japanese_ci; -extern struct charset_info_st my_charset_ujis_nopad_bin; -extern struct charset_info_st my_charset_ujis_japanese_nopad_ci; -extern struct charset_info_st my_charset_utf16_bin; -extern struct charset_info_st my_charset_utf16_general_ci; -extern struct charset_info_st my_charset_utf16_unicode_ci; -extern struct charset_info_st my_charset_utf16_unicode_nopad_ci; -extern struct charset_info_st my_charset_utf16le_bin; -extern struct charset_info_st my_charset_utf16le_general_ci; -extern struct charset_info_st my_charset_utf16_general_nopad_ci; -extern struct charset_info_st my_charset_utf16_nopad_bin; -extern struct charset_info_st my_charset_utf16le_nopad_bin; -extern struct charset_info_st my_charset_utf16le_general_nopad_ci; -extern struct charset_info_st my_charset_utf32_bin; -extern struct charset_info_st my_charset_utf32_general_ci; -extern struct charset_info_st my_charset_utf32_unicode_ci; -extern struct charset_info_st my_charset_utf32_unicode_nopad_ci; -extern struct charset_info_st my_charset_utf32_nopad_bin; -extern struct charset_info_st my_charset_utf32_general_nopad_ci; -extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb3_bin; -extern struct charset_info_st my_charset_utf8mb3_nopad_bin; -extern struct charset_info_st my_charset_utf8mb3_general_nopad_ci; -extern struct charset_info_st my_charset_utf8mb3_general_mysql500_ci; -extern struct charset_info_st my_charset_utf8mb3_unicode_ci; -extern struct charset_info_st my_charset_utf8mb3_unicode_nopad_ci; -extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_bin; -extern struct charset_info_st my_charset_utf8mb4_general_ci; -extern struct charset_info_st my_charset_utf8mb4_nopad_bin; -extern struct charset_info_st my_charset_utf8mb4_general_nopad_ci; -extern struct charset_info_st my_charset_utf8mb4_unicode_ci; -extern struct charset_info_st my_charset_utf8mb4_unicode_nopad_ci; - -#define MY_UTF8MB3 "utf8" -#define MY_UTF8MB4 "utf8mb4" - -my_bool my_cs_have_contractions(CHARSET_INFO *cs); -my_bool my_cs_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc); -my_bool my_cs_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc); -const uint16 *my_cs_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, - my_wc_t wc2); - -/* declarations for simple charsets */ -extern size_t my_strnxfrm_simple(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); -size_t my_strnxfrmlen_simple(CHARSET_INFO *, size_t); -extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, size_t, - const uchar *, size_t, my_bool); - -extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t, - const uchar *, size_t); - -extern void my_hash_sort_simple(CHARSET_INFO *cs, - const uchar *key, size_t len, - ulong *nr1, ulong *nr2); - -extern void my_hash_sort_simple_nopad(CHARSET_INFO *cs, - const uchar *key, size_t len, - ulong *nr1, ulong *nr2); - -extern void my_hash_sort_bin(CHARSET_INFO *cs, - const uchar *key, size_t len, ulong *nr1, - ulong *nr2); - -/** - Compare a string to an array of spaces, for PAD SPACE comparison. - The function iterates through the string and compares every byte to 0x20. - @param - the string - @param - its length - @return <0 - if a byte less than 0x20 was found in the string. - @return 0 - if all bytes in the string were 0x20, or if length was 0. - @return >0 - if a byte greater than 0x20 was found in the string. -*/ -extern int my_strnncollsp_padspace_bin(const uchar *str, size_t length); - -extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length); - -extern uint my_instr_simple(CHARSET_INFO *, - const char *b, size_t b_length, - const char *s, size_t s_length, - my_match_t *match, uint nmatch); - -size_t my_copy_8bit(CHARSET_INFO *, - char *dst, size_t dst_length, - const char *src, size_t src_length, - size_t nchars, MY_STRCOPY_STATUS *); -size_t my_copy_fix_mb(CHARSET_INFO *cs, - char *dst, size_t dst_length, - const char *src, size_t src_length, - size_t nchars, MY_STRCOPY_STATUS *); - -/* Functions for 8bit */ -extern size_t my_caseup_str_8bit(CHARSET_INFO *, char *); -extern size_t my_casedn_str_8bit(CHARSET_INFO *, char *); -extern size_t my_caseup_8bit(CHARSET_INFO *, - const char *src, size_t srclen, - char *dst, size_t dstlen); -extern size_t my_casedn_8bit(CHARSET_INFO *, - const char *src, size_t srclen, - char *dst, size_t dstlen); - -extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *); - -int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); -int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); -int my_wc_mb_bin(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); - -int my_mb_ctype_8bit(CHARSET_INFO *,int *, const uchar *,const uchar *); -int my_mb_ctype_mb(CHARSET_INFO *,int *, const uchar *,const uchar *); - -size_t my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq); - -size_t my_snprintf_8bit(CHARSET_INFO *, char *to, size_t n, - const char *fmt, ...) - ATTRIBUTE_FORMAT(printf, 4, 5); - -long my_strntol_8bit(CHARSET_INFO *, const char *s, size_t l, int base, - char **e, int *err); -ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, size_t l, int base, - char **e, int *err); -longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, size_t l, int base, - char **e, int *err); -ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, size_t l, int base, - char **e, int *err); -double my_strntod_8bit(CHARSET_INFO *, char *s, size_t l,char **e, - int *err); -size_t my_long10_to_str_8bit(CHARSET_INFO *, char *to, size_t l, int radix, - long int val); -size_t my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, size_t l, int radix, - longlong val); - -longlong my_strtoll10_8bit(CHARSET_INFO *cs, - const char *nptr, char **endptr, int *error); -longlong my_strtoll10_ucs2(CHARSET_INFO *cs, - const char *nptr, char **endptr, int *error); - -ulonglong my_strntoull10rnd_8bit(CHARSET_INFO *cs, - const char *str, size_t length, int - unsigned_fl, char **endptr, int *error); -ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs, - const char *str, size_t length, - int unsigned_fl, char **endptr, int *error); - -void my_fill_8bit(CHARSET_INFO *cs, char* to, size_t l, int fill); - -/* For 8-bit character set */ -my_bool my_like_range_simple(CHARSET_INFO *cs, - const char *ptr, size_t ptr_length, - pbool escape, pbool w_one, pbool w_many, - size_t res_length, - char *min_str, char *max_str, - size_t *min_length, size_t *max_length); - -/* For ASCII-based multi-byte character sets with mbminlen=1 */ -my_bool my_like_range_mb(CHARSET_INFO *cs, - const char *ptr, size_t ptr_length, - pbool escape, pbool w_one, pbool w_many, - size_t res_length, - char *min_str, char *max_str, - size_t *min_length, size_t *max_length); - -/* For other character sets, with arbitrary mbminlen and mbmaxlen numbers */ -my_bool my_like_range_generic(CHARSET_INFO *cs, - const char *ptr, size_t ptr_length, - pbool escape, pbool w_one, pbool w_many, - size_t res_length, - char *min_str, char *max_str, - size_t *min_length, size_t *max_length); - -int my_wildcmp_8bit(CHARSET_INFO *, - const char *str,const char *str_end, - const char *wildstr,const char *wildend, - int escape, int w_one, int w_many); - -int my_wildcmp_bin(CHARSET_INFO *, - const char *str,const char *str_end, - const char *wildstr,const char *wildend, - int escape, int w_one, int w_many); - -size_t my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e); -size_t my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e); -size_t my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, size_t pos); -size_t my_well_formed_char_length_8bit(CHARSET_INFO *cs, - const char *b, const char *e, - size_t nchars, - MY_STRCOPY_STATUS *status); -int my_charlen_8bit(CHARSET_INFO *, const uchar *str, const uchar *end); - - -/* Functions for multibyte charsets */ -extern size_t my_caseup_str_mb(CHARSET_INFO *, char *); -extern size_t my_casedn_str_mb(CHARSET_INFO *, char *); -extern size_t my_caseup_mb(CHARSET_INFO *, - const char *src, size_t srclen, - char *dst, size_t dstlen); -extern size_t my_casedn_mb(CHARSET_INFO *, - const char *src, size_t srclen, - char *dst, size_t dstlen); -extern size_t my_caseup_ujis(CHARSET_INFO *, - const char *src, size_t srclen, - char *dst, size_t dstlen); -extern size_t my_casedn_ujis(CHARSET_INFO *, - const char *src, size_t srclen, - char *dst, size_t dstlen); -extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *); - -int my_wildcmp_mb(CHARSET_INFO *, - const char *str,const char *str_end, - const char *wildstr,const char *wildend, - int escape, int w_one, int w_many); -size_t my_numchars_mb(CHARSET_INFO *, const char *b, const char *e); -size_t my_numcells_mb(CHARSET_INFO *, const char *b, const char *e); -size_t my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, size_t pos); -uint my_instr_mb(CHARSET_INFO *, - const char *b, size_t b_length, - const char *s, size_t s_length, - my_match_t *match, uint nmatch); - -int my_wildcmp_mb_bin(CHARSET_INFO *cs, - const char *str,const char *str_end, - const char *wildstr,const char *wildend, - int escape, int w_one, int w_many); - -int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), - const char *s, const char *t); - -void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, size_t len,ulong *nr1, ulong *nr2); - -void my_hash_sort_mb_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, size_t len, - ulong *nr1, ulong *nr2); - -size_t my_strnxfrm_mb(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); - -size_t my_strnxfrm_mb_nopad(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); - -size_t my_strnxfrmlen_unicode(CHARSET_INFO *, size_t); - -size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *, - uchar *dst, size_t dstlen, - uint nweights, const uchar *src, - size_t srclen, uint flags); - -size_t my_strnxfrm_unicode_full_nopad_bin(CHARSET_INFO *, - uchar *dst, size_t dstlen, - uint nweights, const uchar *src, - size_t srclen, uint flags); - -size_t my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *, size_t); - -int my_wildcmp_unicode(CHARSET_INFO *cs, - const char *str, const char *str_end, - const char *wildstr, const char *wildend, - int escape, int w_one, int w_many, - MY_UNICASE_INFO *weights); - -extern my_bool my_parse_charset_xml(MY_CHARSET_LOADER *loader, - const char *buf, size_t buflen); -extern char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end, - pchar c); -extern size_t my_strcspn(CHARSET_INFO *cs, const char *str, const char *end, - const char *accept); - -my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, size_t len); -my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, size_t len); - - -typedef struct -{ - size_t char_length; - my_repertoire_t repertoire; -} MY_STRING_METADATA; - -void my_string_metadata_get(MY_STRING_METADATA *metadata, - CHARSET_INFO *cs, const char *str, size_t len); -my_repertoire_t my_string_repertoire(CHARSET_INFO *cs, - const char *str, size_t len); -my_bool my_charset_is_ascii_based(CHARSET_INFO *cs); -my_repertoire_t my_charset_repertoire(CHARSET_INFO *cs); - -uint my_strxfrm_flag_normalize(uint flags, uint nlevels); -void my_strxfrm_desc_and_reverse(uchar *str, uchar *strend, - uint flags, uint level); -size_t my_strxfrm_pad_desc_and_reverse(CHARSET_INFO *cs, - uchar *str, uchar *frmend, uchar *strend, - uint nweights, uint flags, uint level); -size_t my_strxfrm_pad_desc_and_reverse_nopad(CHARSET_INFO *cs, - uchar *str, uchar *frmend, - uchar *strend, uint nweights, - uint flags, uint level); - -const MY_CONTRACTIONS *my_charset_get_contractions(CHARSET_INFO *cs, - int level); - -extern size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n, - const char* fmt, va_list ap); - -/* - Convert a string between two character sets. - Bad byte sequences as well as characters that cannot be - encoded in the destination character set are replaced to '?'. -*/ -uint32 my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, - const char *from, uint32 from_length, - CHARSET_INFO *from_cs, uint *errors); - -/** - An extended version of my_convert(), to pass non-default mb_wc() and wc_mb(). - For example, String::copy_printable() which is used in - Protocol::store_warning() uses this to escape control - and non-convertable characters. -*/ -uint32 my_convert_using_func(char *to, size_t to_length, CHARSET_INFO *to_cs, - my_charset_conv_wc_mb mb_wc, - const char *from, size_t from_length, - CHARSET_INFO *from_cs, - my_charset_conv_mb_wc wc_mb, - uint *errors); -/* - Convert a string between two character sets. - Bad byte sequences as well as characters that cannot be - encoded in the destination character set are replaced to '?'. - Not more than "nchars" characters are copied. - Conversion statistics is returned in "status" and is set as follows: - - status->m_native_copy_status.m_source_end_pos - to the position - between (src) and (src+src_length), where the function stopped reading - the source string. - - status->m_native_copy_status.m_well_formed_error_pos - to the position - between (src) and (src+src_length), where the first badly formed byte - sequence was found, or to NULL if the string was well formed in the - given range. - - status->m_cannot_convert_error_pos - to the position - between (src) and (src+src_length), where the first character that - cannot be represented in the destination character set was found, - or to NULL if all characters in the given range were successfully - converted. - - "src" is allowed to be a NULL pointer. In this case "src_length" must - be equal to 0. All "status" members are initialized to NULL, and 0 is - returned. -*/ -size_t my_convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length, - CHARSET_INFO *srccs, const char *src, size_t src_length, - size_t nchars, - MY_STRCOPY_STATUS *copy_status, - MY_STRCONV_STATUS *conv_status); - -#define _MY_U 01 /* Upper case */ -#define _MY_L 02 /* Lower case */ -#define _MY_NMR 04 /* Numeral (digit) */ -#define _MY_SPC 010 /* Spacing character */ -#define _MY_PNT 020 /* Punctuation */ -#define _MY_CTR 040 /* Control character */ -#define _MY_B 0100 /* Blank */ -#define _MY_X 0200 /* heXadecimal digit */ - - -#define my_isascii(c) (!((c) & ~0177)) -#define my_toascii(c) ((c) & 0177) -#define my_tocntrl(c) ((c) & 31) -#define my_toprint(c) ((c) | 64) -#define my_toupper(s,c) (char) ((s)->to_upper[(uchar) (c)]) -#define my_tolower(s,c) (char) ((s)->to_lower[(uchar) (c)]) -#define my_isalpha(s, c) (((s)->m_ctype+1)[(uchar) (c)] & (_MY_U | _MY_L)) -#define my_isupper(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_U) -#define my_islower(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_L) -#define my_isdigit(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_NMR) -#define my_isxdigit(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_X) -#define my_isalnum(s, c) (((s)->m_ctype+1)[(uchar) (c)] & (_MY_U | _MY_L | _MY_NMR)) -#define my_isspace(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_SPC) -#define my_ispunct(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_PNT) -#define my_isprint(s, c) (((s)->m_ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B)) -#define my_isgraph(s, c) (((s)->m_ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR)) -#define my_iscntrl(s, c) (((s)->m_ctype+1)[(uchar) (c)] & _MY_CTR) - -/* Some macros that should be cleaned up a little */ -#define my_isvar(s,c) (my_isalnum(s,c) || (c) == '_') -#define my_isvar_start(s,c) (my_isalpha(s,c) || (c) == '_') - -#define my_binary_compare(s) ((s)->state & MY_CS_BINSORT) -#define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM) -#define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0)) -#define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b))) - -/** - Detect if the leftmost character in a string is a valid multi-byte character - and return its length, or return 0 otherwise. - @param cs - character set - @param str - the beginning of the string - @param end - the string end (the next byte after the string) - @return >0, for a multi-byte character - @rerurn 0, for a single byte character, broken sequence, empty string. -*/ -static inline -uint my_ismbchar(CHARSET_INFO *cs, const char *str, const char *end) -{ - int char_length= (cs->cset->charlen)(cs, (const uchar *) str, - (const uchar *) end); - return char_length > 1 ? (uint) char_length : 0U; -} - - -/** - Convert broken and incomplete byte sequences to 1 byte. -*/ -static inline -uint my_ci_charlen_fix(CHARSET_INFO *cs, const uchar *str, const uchar *end) -{ - int char_length= my_ci_charlen(cs, str, end); - DBUG_ASSERT(str < end); - return char_length > 0 ? (uint) char_length : (uint) 1U; -} - - -/* - A compatibility replacement pure C function for the former - cs->cset->well_formed_len(). - In C++ code please use Well_formed_prefix::length() instead. -*/ -static inline size_t -my_well_formed_length(CHARSET_INFO *cs, const char *b, const char *e, - size_t nchars, int *error) -{ - MY_STRCOPY_STATUS status; - (void) my_ci_well_formed_char_length(cs, b, e, nchars, &status); - *error= status.m_well_formed_error_pos == NULL ? 0 : 1; - return (size_t) (status.m_source_end_pos - b); -} - - -#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a))) -#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a))) - -/* XXX: still need to take care of this one */ -#ifdef MY_CHARSET_TIS620 -#error The TIS620 charset is broken at the moment. Tell tim to fix it. -#define USE_TIS620 -#include "t_ctype.h" -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _m_ctype_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/m_string.h b/VCMP-LUA/modules/mariadb/include/mysql/server/m_string.h deleted file mode 100644 index e4c11d2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/m_string.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* There may be problems included in all of these. Try to test in - configure which ones are needed? */ - -/* This is needed for the definitions of strchr... on solaris */ - -#ifndef _m_string_h -#define _m_string_h - -#include "my_decimal_limits.h" - -#ifndef __USE_GNU -#define __USE_GNU /* We want to use stpcpy */ -#endif -#if defined(HAVE_STRINGS_H) -#include -#endif -#if defined(HAVE_STRING_H) -#include -#endif - -/* This is needed for the definitions of memcpy... on solaris */ -#if defined(HAVE_MEMORY_H) && !defined(__cplusplus) -#include -#endif - -#if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE) -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memset(A,C,B) bfill((A),(B),(C)) -# define memmove(d, s, n) bmove ((d), (s), (n)) -#elif defined(HAVE_MEMMOVE) -# define bmove(d, s, n) memmove((d), (s), (n)) -#endif - -/* Unixware 7 */ -#if !defined(HAVE_BFILL) -# define bfill(A,B,C) memset((A),(C),(B)) -#endif - -# define bmove_align(A,B,C) memcpy((A),(B),(C)) - -# define bcmp(A,B,C) memcmp((A),(B),(C)) - -#if !defined(bzero) -# define bzero(A,B) memset((A),0,(B)) -#endif - -#if defined(__cplusplus) -extern "C" { -#endif - -#ifdef DBUG_OFF -#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER) -#define strmov(A,B) __builtin_stpcpy((A),(B)) -#elif defined(HAVE_STPCPY) -#define strmov(A,B) stpcpy((A),(B)) -#endif -#endif - -/* Declared in int2str() */ -extern const char _dig_vec_upper[]; -extern const char _dig_vec_lower[]; - -extern char *strmov_overlapp(char *dest, const char *src); - -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) -#define LINT_INIT_STRUCT(var) bzero(&var, sizeof(var)) /* No uninitialize-warning */ -#else -#define LINT_INIT_STRUCT(var) -#endif - -/* Prototypes for string functions */ - -extern void bmove_upp(uchar *dst,const uchar *src,size_t len); -extern void bchange(uchar *dst,size_t old_len,const uchar *src, - size_t new_len,size_t tot_len); -extern void strappend(char *s,size_t len,pchar fill); -extern char *strend(const char *s); -extern char *strcend(const char *, pchar); -extern char *strfill(char * s,size_t len,pchar fill); -extern char *strmake(char *dst,const char *src,size_t length); - -#if !defined(__GNUC__) || (__GNUC__ < 4) -#define strmake_buf(D,S) strmake(D, S, sizeof(D) - 1) -#else -#define strmake_buf(D,S) ({ \ - __typeof__ (D) __x __attribute__((unused)) = { 2 }; \ - strmake(D, S, sizeof(D) - 1); \ - }) -#endif - -#ifndef strmov -extern char *strmov(char *dst,const char *src); -#endif -extern char *strnmov(char *dst, const char *src, size_t n); -extern char *strcont(const char *src, const char *set); -extern char *strxmov(char *dst, const char *src, ...); -extern char *strxnmov(char *dst, size_t len, const char *src, ...); - -/* Prototypes of normal stringfunctions (with may ours) */ -#ifndef HAVE_STRNLEN -extern size_t strnlen(const char *s, size_t n); -#endif - -extern int is_prefix(const char *, const char *); - -/* Conversion routines */ -typedef enum { - MY_GCVT_ARG_FLOAT, - MY_GCVT_ARG_DOUBLE -} my_gcvt_arg_type; - -double my_strtod(const char *str, char **end, int *error); -double my_atof(const char *nptr); -size_t my_fcvt(double x, int precision, char *to, my_bool *error); -size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to, - my_bool *error); - -/* - The longest string my_fcvt can return is 311 + "precision" bytes. - Here we assume that we never cal my_fcvt() with - precision >= DECIMAL_NOT_SPECIFIED - (+ 1 byte for the terminating '\0'). -*/ -#define FLOATING_POINT_BUFFER (311 + DECIMAL_NOT_SPECIFIED) - -/* - We want to use the 'e' format in some cases even if we have enough space - for the 'f' one just to mimic sprintf("%.15g") behavior for large integers, - and to improve it for numbers < 10^(-4). - That is, for |x| < 1 we require |x| >= 10^(-15), and for |x| > 1 we require - it to be integer and be <= 10^DBL_DIG for the 'f' format to be used. - We don't lose precision, but make cases like "1e200" or "0.00001" look nicer. -*/ -#define MAX_DECPT_FOR_F_FORMAT DBL_DIG - -/* - The maximum possible field width for my_gcvt() conversion. - (DBL_DIG + 2) significant digits + sign + "." + ("e-NNN" or - MAX_DECPT_FOR_F_FORMAT zeros for cases when |x|<1 and the 'f' format is used). -*/ -#define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + MY_MAX(5, MAX_DECPT_FOR_F_FORMAT)) \ - -extern char *llstr(longlong value,char *buff); -extern char *ullstr(longlong value,char *buff); -#ifndef HAVE_STRTOUL -extern long strtol(const char *str, char **ptr, int base); -extern ulong strtoul(const char *str, char **ptr, int base); -#endif - -extern char *int2str(long val, char *dst, int radix, int upcase); -extern char *int10_to_str(long val,char *dst,int radix); -extern char *str2int(const char *src,int radix,long lower,long upper, - long *val); -longlong my_strtoll10(const char *nptr, char **endptr, int *error); -#if SIZEOF_LONG == SIZEOF_LONG_LONG -#define ll2str(A,B,C,D) int2str((A),(B),(C),(D)) -#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C)) -#undef strtoll -#define strtoll(A,B,C) strtol((A),(B),(C)) -#define strtoull(A,B,C) strtoul((A),(B),(C)) -#ifndef HAVE_STRTOULL -#define HAVE_STRTOULL -#endif -#ifndef HAVE_STRTOLL -#define HAVE_STRTOLL -#endif -#else -#ifdef HAVE_LONG_LONG -extern char *ll2str(longlong val,char *dst,int radix, int upcase); -extern char *longlong10_to_str(longlong val,char *dst,int radix); -#if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO)) -extern longlong strtoll(const char *str, char **ptr, int base); -extern ulonglong strtoull(const char *str, char **ptr, int base); -#endif -#endif -#endif -#define longlong2str(A,B,C) ll2str((A),(B),(C),1) - -#if defined(__cplusplus) -} -#endif - -#include - -#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1)) -#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1)) -#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1)) -#define LEX_STRING_WITH_LEN(X) (X).str, (X).length - -typedef struct st_mysql_const_lex_string LEX_CSTRING; - -/* A variant with const and unsigned */ -struct st_mysql_const_unsigned_lex_string -{ - const uchar *str; - size_t length; -}; -typedef struct st_mysql_const_unsigned_lex_string LEX_CUSTRING; - -static inline void lex_string_set(LEX_CSTRING *lex_str, const char *c_str) -{ - lex_str->str= c_str; - lex_str->length= strlen(c_str); -} -static inline void lex_string_set3(LEX_CSTRING *lex_str, const char *c_str, - size_t len) -{ - lex_str->str= c_str; - lex_str->length= len; -} - -#ifdef __cplusplus -static inline char *safe_str(char *str) -{ return str ? str : const_cast(""); } -#endif - -static inline const char *safe_str(const char *str) -{ return str ? str : ""; } - -static inline size_t safe_strlen(const char *str) -{ return str ? strlen(str) : 0; } - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/ma_dyncol.h b/VCMP-LUA/modules/mariadb/include/mysql/server/ma_dyncol.h deleted file mode 100644 index 833a25b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/ma_dyncol.h +++ /dev/null @@ -1,251 +0,0 @@ -/* Copyright (c) 2011, Monty Program Ab - Copyright (c) 2011, Oleksandr Byelkin - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -#ifndef ma_dyncol_h -#define ma_dyncol_h -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#ifndef _my_sys_h -typedef struct st_dynamic_string -{ - char *str; - size_t length,max_length,alloc_increment; -} DYNAMIC_STRING; -#endif - -#ifndef MY_GLOBAL_INCLUDED -struct st_mysql_lex_string -{ - char *str; - size_t length; -}; -typedef struct st_mysql_lex_string MYSQL_LEX_STRING; -typedef struct st_mysql_lex_string LEX_STRING; -#endif - -/* - Limits of implementation -*/ -#define MAX_TOTAL_NAME_LENGTH 65535 -#define MAX_NAME_LENGTH (MAX_TOTAL_NAME_LENGTH/4) - -/* NO and OK is the same used just to show semantics */ -#define ER_DYNCOL_NO ER_DYNCOL_OK - -#ifdef HAVE_CHARSET_utf8mb4 -#define DYNCOL_UTF (&my_charset_utf8mb4_general_ci) -#else -#define DYNCOL_UTF (&my_charset_utf8mb3_general_ci) -#endif - -/* escape json strings */ -#define DYNCOL_JSON_ESC ((char)1) - -enum enum_dyncol_func_result -{ - ER_DYNCOL_OK= 0, - ER_DYNCOL_YES= 1, /* For functions returning 0/1 */ - ER_DYNCOL_FORMAT= -1, /* Wrong format of the encoded string */ - ER_DYNCOL_LIMIT= -2, /* Some limit reached */ - ER_DYNCOL_RESOURCE= -3, /* Out of resourses */ - ER_DYNCOL_DATA= -4, /* Incorrect input data */ - ER_DYNCOL_UNKNOWN_CHARSET= -5, /* Unknown character set */ - ER_DYNCOL_TRUNCATED= 2 /* OK, but data was truncated */ -}; - -typedef DYNAMIC_STRING DYNAMIC_COLUMN; - -enum enum_dynamic_column_type -{ - DYN_COL_NULL= 0, - DYN_COL_INT, - DYN_COL_UINT, - DYN_COL_DOUBLE, - DYN_COL_STRING, - DYN_COL_DECIMAL, - DYN_COL_DATETIME, - DYN_COL_DATE, - DYN_COL_TIME, - DYN_COL_DYNCOL -}; - -typedef enum enum_dynamic_column_type DYNAMIC_COLUMN_TYPE; - -struct st_dynamic_column_value -{ - DYNAMIC_COLUMN_TYPE type; - union - { - long long long_value; - unsigned long long ulong_value; - double double_value; - struct { - MYSQL_LEX_STRING value; - CHARSET_INFO *charset; - } string; - struct { - decimal_digit_t buffer[DECIMAL_BUFF_LENGTH]; - decimal_t value; - } decimal; - MYSQL_TIME time_value; - } x; -}; - -typedef struct st_dynamic_column_value DYNAMIC_COLUMN_VALUE; - -#ifdef MADYNCOL_DEPRECATED -enum enum_dyncol_func_result -dynamic_column_create(DYNAMIC_COLUMN *str, - uint column_nr, DYNAMIC_COLUMN_VALUE *value); - -enum enum_dyncol_func_result -dynamic_column_create_many(DYNAMIC_COLUMN *str, - uint column_count, - uint *column_numbers, - DYNAMIC_COLUMN_VALUE *values); -enum enum_dyncol_func_result -dynamic_column_update(DYNAMIC_COLUMN *org, uint column_nr, - DYNAMIC_COLUMN_VALUE *value); -enum enum_dyncol_func_result -dynamic_column_update_many(DYNAMIC_COLUMN *str, - uint add_column_count, - uint *column_numbers, - DYNAMIC_COLUMN_VALUE *values); - -enum enum_dyncol_func_result -dynamic_column_exists(DYNAMIC_COLUMN *org, uint column_nr); - -enum enum_dyncol_func_result -dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint); - -enum enum_dyncol_func_result -dynamic_column_get(DYNAMIC_COLUMN *org, uint column_nr, - DYNAMIC_COLUMN_VALUE *store_it_here); -#endif - -/* new functions */ -enum enum_dyncol_func_result -mariadb_dyncol_create_many_num(DYNAMIC_COLUMN *str, - uint column_count, - uint *column_numbers, - DYNAMIC_COLUMN_VALUE *values, - my_bool new_string); -enum enum_dyncol_func_result -mariadb_dyncol_create_many_named(DYNAMIC_COLUMN *str, - uint column_count, - MYSQL_LEX_STRING *column_keys, - DYNAMIC_COLUMN_VALUE *values, - my_bool new_string); - - -enum enum_dyncol_func_result -mariadb_dyncol_update_many_num(DYNAMIC_COLUMN *str, - uint add_column_count, - uint *column_keys, - DYNAMIC_COLUMN_VALUE *values); -enum enum_dyncol_func_result -mariadb_dyncol_update_many_named(DYNAMIC_COLUMN *str, - uint add_column_count, - MYSQL_LEX_STRING *column_keys, - DYNAMIC_COLUMN_VALUE *values); - - -enum enum_dyncol_func_result -mariadb_dyncol_exists_num(DYNAMIC_COLUMN *org, uint column_nr); -enum enum_dyncol_func_result -mariadb_dyncol_exists_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name); - -/* List of not NULL columns */ -enum enum_dyncol_func_result -mariadb_dyncol_list_num(DYNAMIC_COLUMN *str, uint *count, uint **nums); -enum enum_dyncol_func_result -mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count, - MYSQL_LEX_STRING **names); - -/* - if the column do not exists it is NULL -*/ -enum enum_dyncol_func_result -mariadb_dyncol_get_num(DYNAMIC_COLUMN *org, uint column_nr, - DYNAMIC_COLUMN_VALUE *store_it_here); -enum enum_dyncol_func_result -mariadb_dyncol_get_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name, - DYNAMIC_COLUMN_VALUE *store_it_here); - -my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str); - -enum enum_dyncol_func_result -mariadb_dyncol_check(DYNAMIC_COLUMN *str); - -enum enum_dyncol_func_result -mariadb_dyncol_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json); - -#define mariadb_dyncol_init(A) memset((A), 0, sizeof(*(A))) -void mariadb_dyncol_free(DYNAMIC_COLUMN *str); - -/* conversion of values to 3 base types */ -enum enum_dyncol_func_result -mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, - CHARSET_INFO *cs, my_bool quote); -enum enum_dyncol_func_result -mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val); -enum enum_dyncol_func_result -mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val); - - -enum enum_dyncol_func_result -mariadb_dyncol_unpack(DYNAMIC_COLUMN *str, - uint *count, - MYSQL_LEX_STRING **names, DYNAMIC_COLUMN_VALUE **vals); - -void mariadb_dyncol_unpack_free(MYSQL_LEX_STRING *names, - DYNAMIC_COLUMN_VALUE *vals); - -int mariadb_dyncol_column_cmp_named(const MYSQL_LEX_STRING *s1, - const MYSQL_LEX_STRING *s2); - -enum enum_dyncol_func_result -mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count); - -#define mariadb_dyncol_value_init(V) (V)->type= DYN_COL_NULL - -/* - Prepare value for using as decimal -*/ -void mariadb_dyncol_prepare_decimal(DYNAMIC_COLUMN_VALUE *value); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_alloc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_alloc.h deleted file mode 100644 index 181f637..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_alloc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Data structures for mysys/my_alloc.c (root memory allocator) -*/ - -#ifndef _my_alloc_h -#define _my_alloc_h - -#include - -#define ALLOC_MAX_BLOCK_TO_DROP 4096 -#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct st_used_mem -{ /* struct for once_alloc (block) */ - struct st_used_mem *next; /* Next block in use */ - size_t left; /* memory left in block */ - size_t size; /* size of block */ -} USED_MEM; - - -typedef struct st_mem_root -{ - USED_MEM *free; /* blocks with free memory in it */ - USED_MEM *used; /* blocks almost without free memory */ - USED_MEM *pre_alloc; /* preallocated block */ - /* if block have less memory it will be put in 'used' list */ - size_t min_malloc; - size_t block_size; /* initial block size */ - unsigned int block_num; /* allocated blocks counter */ - /* - first free block in queue test counter (if it exceed - MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list) - */ - unsigned int first_block_usage; - - void (*error_handler)(void); - - PSI_memory_key m_psi_key; -} MEM_ROOT; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_attribute.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_attribute.h deleted file mode 100644 index c8e9807..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_attribute.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Helper macros used for setting different __attributes__ - on functions in a portable fashion -*/ - -#ifndef _my_attribute_h -#define _my_attribute_h - -#if defined(__GNUC__) -# ifndef GCC_VERSION -# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -# endif -#endif - -/* - Disable __attribute__() on gcc < 2.7, g++ < 3.4, and non-gcc compilers. - Some forms of __attribute__ are actually supported in earlier versions of - g++, but we just disable them all because we only use them to generate - compilation warnings. -*/ -#ifndef __attribute__ -# if !defined(__GNUC__) && !defined(__clang__) -# define __attribute__(A) -# elif defined(__GNUC__) -# ifndef GCC_VERSION -# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -# endif -# if GCC_VERSION < 2008 -# define __attribute__(A) -# elif defined(__cplusplus) && GCC_VERSION < 3004 -# define __attribute__(A) -# endif -# endif -#endif - -/* - __attribute__((format(...))) is only supported in gcc >= 2.8 and g++ >= 3.4 - But that's already covered by the __attribute__ tests above, so this is - just a convenience macro. -*/ -#ifndef ATTRIBUTE_FORMAT -# define ATTRIBUTE_FORMAT(style, m, n) __attribute__((format(style, m, n))) -#endif - -/* - - __attribute__((format(...))) on a function pointer is not supported - until gcc 3.1 -*/ -#ifndef ATTRIBUTE_FORMAT_FPTR -# if (GCC_VERSION >= 3001) -# define ATTRIBUTE_FORMAT_FPTR(style, m, n) ATTRIBUTE_FORMAT(style, m, n) -# else -# define ATTRIBUTE_FORMAT_FPTR(style, m, n) -# endif /* GNUC >= 3.1 */ -#endif - - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_byteorder.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_byteorder.h deleted file mode 100644 index c302781..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_byteorder.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef MY_BYTEORDER_INCLUDED -#define MY_BYTEORDER_INCLUDED - -/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* - Macro for reading 32-bit integer from network byte order (big-endian) - from an unaligned memory location. -*/ -#define int4net(A) (int32) (((uint32) ((uchar) (A)[3])) | \ - (((uint32) ((uchar) (A)[2])) << 8) | \ - (((uint32) ((uchar) (A)[1])) << 16) | \ - (((uint32) ((uchar) (A)[0])) << 24)) - -/* - Function-like macros for reading and storing in machine independent - format (low byte first). There are 'korr' (assume 'corrector') variants - for integer types, but 'get' (assume 'getter') for floating point types. -*/ -#if defined(__i386__) || defined(_WIN32) -#define MY_BYTE_ORDER_ARCH_OPTIMIZED -#include "byte_order_generic_x86.h" -#elif defined(__x86_64__) -#include "byte_order_generic_x86_64.h" -#else -#include "byte_order_generic.h" -#endif - -/* - Function-like macros for reading and storing in machine format from/to - short/long to/from some place in memory V should be a variable (not on - a register) and M a pointer to byte. -*/ -#ifdef WORDS_BIGENDIAN -#include "big_endian.h" -#else -#include "little_endian.h" -#endif - -#endif /* MY_BYTEORDER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_compiler.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_compiler.h deleted file mode 100644 index d35a910..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_compiler.h +++ /dev/null @@ -1,186 +0,0 @@ -#ifndef MY_COMPILER_INCLUDED -#define MY_COMPILER_INCLUDED - -/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - Header for compiler-dependent features. - - Intended to contain a set of reusable wrappers for preprocessor - macros, attributes, pragmas, and any other features that are - specific to a target compiler. -*/ - -/** - Compiler-dependent internal convenience macros. -*/ - -/* C vs C++ */ -#ifdef __cplusplus -#define CONSTEXPR constexpr -#else -#define CONSTEXPR -#endif /* __cplusplus */ - - -/* GNU C/C++ */ -#if defined __GNUC__ -/* Convenience macro to test the minimum required GCC version. */ -# define MY_GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -/* Any after 2.95... */ -# define MY_ALIGN_EXT -/* Comunicate to the compiler the unreachability of the code. */ -# if MY_GNUC_PREREQ(4,5) -# define MY_ASSERT_UNREACHABLE() __builtin_unreachable() -# endif - -/* Microsoft Visual C++ */ -#elif defined _MSC_VER -# define MY_ALIGNOF(type) __alignof(type) -# define MY_ALIGNED(n) __declspec(align(n)) - -/* Oracle Solaris Studio */ -#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) -# if __SUNPRO_C >= 0x590 -# define MY_ALIGN_EXT -# endif - -/* IBM XL C/C++ */ -#elif defined __xlC__ -# if __xlC__ >= 0x0600 -# define MY_ALIGN_EXT -# endif - -/* HP aCC */ -#elif defined(__HP_aCC) || defined(__HP_cc) -# if (__HP_aCC >= 60000) || (__HP_cc >= 60000) -# define MY_ALIGN_EXT -# endif -#endif - -#ifdef MY_ALIGN_EXT -/** Specifies the minimum alignment of a type. */ -# define MY_ALIGNOF(type) __alignof__(type) -/** Determine the alignment requirement of a type. */ -# define MY_ALIGNED(n) __attribute__((__aligned__((n)))) -#endif - -/** - Generic (compiler-independent) features. -*/ - -#ifndef MY_GNUC_PREREQ -# define MY_GNUC_PREREQ(maj, min) (0) -#endif - -#ifndef MY_ALIGNOF -# ifdef __cplusplus - template struct my_alignof_helper { char m1; type m2; }; - /* Invalid for non-POD types, but most compilers give the right answer. */ -# define MY_ALIGNOF(type) offsetof(my_alignof_helper, m2) -# else -# define MY_ALIGNOF(type) offsetof(struct { char m1; type m2; }, m2) -# endif -#endif - -#ifndef MY_ASSERT_UNREACHABLE -# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0) -#endif - -/** - C++ Type Traits -*/ - -#ifdef __cplusplus - -/** - Opaque storage with a particular alignment. -*/ -# if defined(MY_ALIGNED) -/* Partial specialization used due to MSVC++. */ -template struct my_alignment_imp; -template<> struct MY_ALIGNED(1) my_alignment_imp<1> {}; -template<> struct MY_ALIGNED(2) my_alignment_imp<2> {}; -template<> struct MY_ALIGNED(4) my_alignment_imp<4> {}; -template<> struct MY_ALIGNED(8) my_alignment_imp<8> {}; -template<> struct MY_ALIGNED(16) my_alignment_imp<16> {}; -/* ... expand as necessary. */ -# else -template -struct my_alignment_imp { double m1; }; -# endif - -/** - A POD type with a given size and alignment. - - @remark If the compiler does not support a alignment attribute - (MY_ALIGN macro), the default alignment of a double is - used instead. - - @tparam size The minimum size. - @tparam alignment The desired alignment: 1, 2, 4, 8 or 16. -*/ -template -struct my_aligned_storage -{ - union - { - char data[size]; - my_alignment_imp align; - }; -}; - -#endif /* __cplusplus */ - -# ifndef MY_ALIGNED -/* - Make sure MY_ALIGNED can be used also on platforms where we don't - have a way of aligning data structures. -*/ -#define MY_ALIGNED(size) -#endif - -#ifdef __GNUC__ -# define ATTRIBUTE_NORETURN __attribute__((noreturn)) -# define ATTRIBUTE_NOINLINE __attribute__((noinline)) -# if MY_GNUC_PREREQ(4,3) -/** Starting with GCC 4.3, the "cold" attribute is used to inform the -compiler that a function is unlikely executed. The function is -optimized for size rather than speed and on many targets it is placed -into special subsection of the text section so all cold functions -appears close together improving code locality of non-cold parts of -program. The paths leading to call of cold functions within code are -marked as unlikely by the branch prediction mechanism. optimize a -rarely invoked function for size instead for speed. */ -# define ATTRIBUTE_COLD __attribute__((cold)) -# endif -#elif defined _MSC_VER -# define ATTRIBUTE_NORETURN __declspec(noreturn) -# define ATTRIBUTE_NOINLINE __declspec(noinline) -#else -# define ATTRIBUTE_NORETURN /* empty */ -# define ATTRIBUTE_NOINLINE /* empty */ -#endif - -#ifndef ATTRIBUTE_COLD -# define ATTRIBUTE_COLD /* empty */ -#endif - -#include - -#endif /* MY_COMPILER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_config.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_config.h deleted file mode 100644 index 22f5893..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_config.h +++ /dev/null @@ -1,558 +0,0 @@ -/* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MY_CONFIG_H -#define MY_CONFIG_H -#define DOT_FRM_VERSION 6 -/* Headers we may want to use. */ -#define STDC_HEADERS 1 -/* #undef _GNU_SOURCE */ -/* #undef HAVE_ALLOCA_H */ -/* #undef HAVE_ARPA_INET_H */ -/* #undef HAVE_ASM_TERMBITS_H */ -/* #undef HAVE_CRYPT_H */ -/* #undef HAVE_CURSES_H */ -/* #undef HAVE_BFD_H */ -/* #undef HAVE_NDIR_H */ -/* #undef HAVE_DIRENT_H */ -/* #undef HAVE_DLFCN_H */ -/* #undef HAVE_EXECINFO_H */ -#define HAVE_FCNTL_H 1 -/* #undef HAVE_FENV_H */ -#define HAVE_FLOAT_H 1 -/* #undef HAVE_FNMATCH_H */ -/* #undef HAVE_FPU_CONTROL_H */ -/* #undef HAVE_GRP_H */ -/* #undef HAVE_IA64INTRIN_H */ -/* #undef HAVE_IEEEFP_H */ -/* #undef HAVE_INTTYPES_H */ -/* #undef HAVE_KQUEUE */ -#define HAVE_LIMITS_H 1 -/* #undef HAVE_LINK_H */ -/* #undef HAVE_LINUX_UNISTD_H */ -#define HAVE_LOCALE_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -/* #undef HAVE_NETINET_IN_H */ -/* #undef HAVE_PATHS_H */ -/* #undef HAVE_POLL_H */ -/* #undef HAVE_PWD_H */ -/* #undef HAVE_SCHED_H */ -/* #undef HAVE_SELECT_H */ -/* #undef HAVE_SOLARIS_LARGE_PAGES */ -#define HAVE_STDDEF_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STDARG_H 1 -/* #undef HAVE_STRINGS_H */ -#define HAVE_STRING_H 1 -/* #undef HAVE_STDINT_H */ -/* #undef HAVE_SYNCH_H */ -/* #undef HAVE_SYSENT_H */ -/* #undef HAVE_SYS_DIR_H */ -/* #undef HAVE_SYS_FILE_H */ -/* #undef HAVE_SYS_FPU_H */ -/* #undef HAVE_SYS_IOCTL_H */ -/* #undef HAVE_SYS_MALLOC_H */ -/* #undef HAVE_SYS_MMAN_H */ -/* #undef HAVE_SYS_NDIR_H */ -/* #undef HAVE_SYS_PTE_H */ -/* #undef HAVE_SYS_PTEM_H */ -/* #undef HAVE_SYS_PRCTL_H */ -/* #undef HAVE_SYS_RESOURCE_H */ -/* #undef HAVE_SYS_SELECT_H */ -/* #undef HAVE_SYS_SOCKET_H */ -/* #undef HAVE_SYS_SOCKIO_H */ -/* #undef HAVE_SYS_UTSNAME_H */ -#define HAVE_SYS_STAT_H 1 -/* #undef HAVE_SYS_STREAM_H */ -/* #undef HAVE_SYS_SYSCALL_H */ -#define HAVE_SYS_TIMEB_H 1 -/* #undef HAVE_SYS_TIMES_H */ -/* #undef HAVE_SYS_TIME_H */ -#define HAVE_SYS_TYPES_H 1 -/* #undef HAVE_SYS_UN_H */ -/* #undef HAVE_SYS_VADVISE_H */ -/* #undef HAVE_SYS_STATVFS_H */ -/* #undef HAVE_UCONTEXT_H */ -/* #undef HAVE_TERM_H */ -/* #undef HAVE_TERMBITS_H */ -/* #undef HAVE_TERMIOS_H */ -/* #undef HAVE_TERMIO_H */ -/* #undef HAVE_TERMCAP_H */ -#define HAVE_TIME_H 1 -/* #undef HAVE_UNISTD_H */ -/* #undef HAVE_UTIME_H */ -#define HAVE_VARARGS_H 1 -#define HAVE_SYS_UTIME_H 1 -/* #undef HAVE_SYS_WAIT_H */ -/* #undef HAVE_SYS_PARAM_H */ - -/* Libraries */ -/* #undef HAVE_LIBWRAP */ -/* #undef HAVE_SYSTEMD */ - -/* Does "struct timespec" have a "sec" and "nsec" field? */ -/* #undef HAVE_TIMESPEC_TS_SEC */ - -/* Readline */ -/* #undef HAVE_HIST_ENTRY */ -/* #undef USE_LIBEDIT_INTERFACE */ -/* #undef USE_NEW_READLINE_INTERFACE */ - -/* #undef FIONREAD_IN_SYS_IOCTL */ -/* #undef GWINSZ_IN_SYS_IOCTL */ -/* #undef TIOCSTAT_IN_SYS_IOCTL */ -/* #undef FIONREAD_IN_SYS_FILIO */ - -/* Functions we may want to use. */ -/* #undef HAVE_ACCEPT4 */ -#define HAVE_ACCESS 1 -/* #undef HAVE_ALARM */ -#define HAVE_ALLOCA 1 -/* #undef HAVE_BFILL */ -/* #undef HAVE_INDEX */ -/* #undef HAVE_CLOCK_GETTIME */ -/* #undef HAVE_CRYPT */ -/* #undef HAVE_CUSERID */ -/* #undef HAVE_DLADDR */ -/* #undef HAVE_DLERROR */ -/* #undef HAVE_DLOPEN */ -/* #undef HAVE_FCHMOD */ -/* #undef HAVE_FCNTL */ -/* #undef HAVE_FDATASYNC */ -/* #undef HAVE_DECL_FDATASYNC */ -/* #undef HAVE_FEDISABLEEXCEPT */ -/* #undef HAVE_FESETROUND */ -/* #undef HAVE_FP_EXCEPT */ -/* #undef HAVE_FSEEKO */ -/* #undef HAVE_FSYNC */ -#define HAVE_FTIME 1 -/* #undef HAVE_GETIFADDRS */ -#define HAVE_GETCWD 1 -/* #undef HAVE_GETHOSTBYADDR_R */ -/* #undef HAVE_GETHRTIME */ -/* #undef HAVE_GETPAGESIZE */ -/* #undef HAVE_GETPAGESIZES */ -/* #undef HAVE_GETPASS */ -/* #undef HAVE_GETPASSPHRASE */ -/* #undef HAVE_GETPWNAM */ -/* #undef HAVE_GETPWUID */ -/* #undef HAVE_GETRLIMIT */ -/* #undef HAVE_GETRUSAGE */ -/* #undef HAVE_GETTIMEOFDAY */ -/* #undef HAVE_GETWD */ -#define HAVE_GMTIME_R 1 -/* #undef gmtime_r */ -/* #undef HAVE_IN_ADDR_T */ -/* #undef HAVE_INITGROUPS */ -#define HAVE_LDIV 1 -/* #undef HAVE_LRAND48 */ -#define HAVE_LOCALTIME_R 1 -/* #undef HAVE_LSTAT */ -/* #undef HAVE_MEMALIGN */ -/* #undef HAVE_MLOCK */ -/* #undef HAVE_NL_LANGINFO */ -/* #undef HAVE_MADVISE */ -/* #undef HAVE_DECL_MADVISE */ -/* #undef HAVE_DECL_MHA_MAPSIZE_VA */ -/* #undef HAVE_MALLINFO */ -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -/* #undef HAVE_MKSTEMP */ -/* #undef HAVE_MKOSTEMP */ -/* #undef HAVE_MLOCKALL */ -/* #undef HAVE_MMAP */ -/* #undef HAVE_MMAP64 */ -#define HAVE_PERROR 1 -/* #undef HAVE_POLL */ -/* #undef HAVE_POSIX_FALLOCATE */ -/* #undef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */ -/* #undef HAVE_PREAD */ -/* #undef HAVE_READ_REAL_TIME */ -/* #undef HAVE_PTHREAD_ATTR_CREATE */ -/* #undef HAVE_PTHREAD_ATTR_GETGUARDSIZE */ -/* #undef HAVE_PTHREAD_ATTR_GETSTACKSIZE */ -/* #undef HAVE_PTHREAD_ATTR_SETSCOPE */ -/* #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE */ -/* #undef HAVE_PTHREAD_CONDATTR_CREATE */ -/* #undef HAVE_PTHREAD_GETAFFINITY_NP */ -/* #undef HAVE_PTHREAD_KEY_DELETE */ -/* #undef HAVE_PTHREAD_KILL */ -/* #undef HAVE_PTHREAD_RWLOCK_RDLOCK */ -/* #undef HAVE_PTHREAD_SIGMASK */ -/* #undef HAVE_PTHREAD_YIELD_NP */ -/* #undef HAVE_PTHREAD_YIELD_ZERO_ARG */ -/* #undef PTHREAD_ONCE_INITIALIZER */ -#define HAVE_PUTENV 1 -/* #undef HAVE_READDIR_R */ -/* #undef HAVE_READLINK */ -/* #undef HAVE_REALPATH */ -#define HAVE_RENAME 1 -/* #undef HAVE_RWLOCK_INIT */ -/* #undef HAVE_SCHED_YIELD */ -#define HAVE_SELECT 1 -/* #undef HAVE_SETENV */ -#define HAVE_SETLOCALE 1 -/* #undef HAVE_SETUPTERM */ -/* #undef HAVE_SIGSET */ -/* #undef HAVE_SIGACTION */ -/* #undef HAVE_SIGTHREADMASK */ -/* #undef HAVE_SIGWAIT */ -/* #undef HAVE_SIGWAITINFO */ -/* #undef HAVE_SLEEP */ -#define HAVE_SNPRINTF 1 -/* #undef HAVE_STPCPY */ -#define HAVE_STRERROR 1 -#define HAVE_STRCOLL 1 -#define HAVE_STRNLEN 1 -#define HAVE_STRPBRK 1 -#define HAVE_STRTOK_R 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOULL 1 -#define HAVE_TELL 1 -/* #undef HAVE_THR_SETCONCURRENCY */ -/* #undef HAVE_THR_YIELD */ -#define HAVE_TIME 1 -/* #undef HAVE_TIMES */ -/* #undef HAVE_VIDATTR */ -#define HAVE_VIO_READ_BUFF 1 -/* #undef HAVE_VASPRINTF */ -#define HAVE_VSNPRINTF 1 -/* #undef HAVE_FTRUNCATE */ -#define HAVE_TZNAME 1 -/* Symbols we may use */ -/* #undef HAVE_SYS_ERRLIST */ -/* used by stacktrace functions */ -/* #undef HAVE_BACKTRACE */ -/* #undef HAVE_BACKTRACE_SYMBOLS */ -/* #undef HAVE_BACKTRACE_SYMBOLS_FD */ -/* #undef HAVE_PRINTSTACK */ -#define HAVE_IPV6 1 -/* #undef ss_family */ -/* #undef HAVE_SOCKADDR_IN_SIN_LEN */ -/* #undef HAVE_SOCKADDR_IN6_SIN6_LEN */ -#define STRUCT_TIMESPEC_HAS_TV_SEC 1 -#define STRUCT_TIMESPEC_HAS_TV_NSEC 1 - -#define USE_MB 1 -#define USE_MB_IDENT 1 - -/* this means that valgrind headers and macros are available */ -/* #undef HAVE_VALGRIND_MEMCHECK_H */ - -/* this means WITH_VALGRIND - we change some code paths for valgrind */ -/* #undef HAVE_valgrind */ - -/* Types we may use */ -#ifdef __APPLE__ - /* - Special handling required for OSX to support universal binaries that - mix 32 and 64 bit architectures. - */ - #if(__LP64__) - #define SIZEOF_LONG 8 - #else - #define SIZEOF_LONG 4 - #endif - #define SIZEOF_VOIDP SIZEOF_LONG - #define SIZEOF_CHARP SIZEOF_LONG - #define SIZEOF_SIZE_T SIZEOF_LONG -#else -/* No indentation, to fetch the lines from verification scripts */ -#define SIZEOF_LONG 4 -#define SIZEOF_VOIDP 8 -#define SIZEOF_CHARP 8 -#define SIZEOF_SIZE_T 8 -#endif - -#define HAVE_LONG 1 -#define HAVE_CHARP 1 -#define SIZEOF_INT 4 -#define HAVE_INT 1 -#define SIZEOF_LONG_LONG 8 -#define HAVE_LONG_LONG 1 -#define SIZEOF_OFF_T 4 -#define HAVE_OFF_T 1 -/* #undef SIZEOF_UCHAR */ -/* #undef HAVE_UCHAR */ -/* #undef SIZEOF_UINT */ -/* #undef HAVE_UINT */ -/* #undef SIZEOF_ULONG */ -/* #undef HAVE_ULONG */ -/* #undef SIZEOF_INT8 */ -/* #undef HAVE_INT8 */ -/* #undef SIZEOF_UINT8 */ -/* #undef HAVE_UINT8 */ -/* #undef SIZEOF_INT16 */ -/* #undef HAVE_INT16 */ -/* #undef SIZEOF_UINT16 */ -/* #undef HAVE_UINT16 */ -/* #undef SIZEOF_INT32 */ -/* #undef HAVE_INT32 */ -/* #undef SIZEOF_UINT32 */ -/* #undef HAVE_UINT32 */ -/* #undef SIZEOF_INT64 */ -/* #undef HAVE_INT64 */ -/* #undef SIZEOF_UINT64 */ -/* #undef HAVE_UINT64 */ - -#define SOCKET_SIZE_TYPE int - -/* #undef HAVE_MBSTATE_T */ - -#define MAX_INDEXES 64 - -#define QSORT_TYPE_IS_VOID 1 -#define RETQSORTTYPE void - -#define RETSIGTYPE void -#define VOID_SIGHANDLER 1 -/* #undef HAVE_SIGHANDLER_T */ -#define STRUCT_RLIMIT struct rlimit - -#ifdef __APPLE__ - #if __BIG_ENDIAN - #define WORDS_BIGENDIAN 1 - #endif -#else -/* #undef WORDS_BIGENDIAN */ -#endif - -/* Define to `__inline__' or `__inline' if that's what the C compiler calls - it, or to nothing if 'inline' is not supported under any name. */ -/* #undef C_HAS_inline */ -#if !(C_HAS_inline) -#ifndef __cplusplus -# define inline __inline -#endif -#endif - - -/* #undef TARGET_OS_LINUX */ - -#define HAVE_WCTYPE_H 1 -#define HAVE_WCHAR_H 1 -/* #undef HAVE_LANGINFO_H */ -/* #undef HAVE_MBRLEN */ -/* #undef HAVE_MBSRTOWCS */ -/* #undef HAVE_MBRTOWC */ -/* #undef HAVE_WCWIDTH */ -/* #undef HAVE_ISWLOWER */ -/* #undef HAVE_ISWUPPER */ -/* #undef HAVE_TOWLOWER */ -/* #undef HAVE_TOWUPPER */ -/* #undef HAVE_ISWCTYPE */ -/* #undef HAVE_WCHAR_T */ - - -#define HAVE_STRCASECMP 1 -/* #undef HAVE_TCGETATTR */ - -/* #undef HAVE_WEAK_SYMBOL */ -/* #undef HAVE_ABI_CXA_DEMANGLE */ -/* #undef HAVE_ATTRIBUTE_CLEANUP */ - -/* #undef HAVE_POSIX_SIGNALS */ -/* #undef HAVE_BSD_SIGNALS */ - -/* #undef HAVE_SVR3_SIGNALS */ -/* #undef HAVE_V7_SIGNALS */ -#define HAVE_ERR_remove_thread_state 1 -#define HAVE_X509_check_host 1 - -/* #undef HAVE_SOLARIS_STYLE_GETHOST */ - -/* #undef HAVE_GCC_C11_ATOMICS */ -/* #undef HAVE_SOLARIS_ATOMIC */ -#define NO_FCNTL_NONBLOCK 1 -#define NO_ALARM 1 - -/* #undef _LARGE_FILES */ -#define _LARGEFILE_SOURCE 1 -/* #undef _LARGEFILE64_SOURCE */ - -/* #undef TIME_WITH_SYS_TIME */ - -#define STACK_DIRECTION -1 - -#define SYSTEM_TYPE "Win64" -#define MACHINE_TYPE "AMD64" -#define DEFAULT_MACHINE "x64" -/* #undef HAVE_DTRACE */ - -#define SIGNAL_WITH_VIO_CLOSE 1 - -/* Windows stuff, mostly functions, that have Posix analogs but named differently */ -#define S_IROTH _S_IREAD -#define S_IFIFO _S_IFIFO -/* #undef IPPROTO_IPV6 */ -/* #undef IPV6_V6ONLY */ -#define sigset_t int -#define mode_t int -#define SIGQUIT SIGTERM -#define SIGPIPE SIGINT -#define popen _popen -#define pclose _pclose -#define ssize_t SSIZE_T -#define strcasecmp _stricmp -#define strncasecmp _strnicmp -/* #undef snprintf */ -#define strtok_r strtok_s -#define strtoll _strtoi64 -#define strtoull _strtoui64 -/* #undef vsnprintf */ -#if defined(_MSC_VER) && (_MSC_VER > 1800) -#define tzname _tzname -#define P_tmpdir "C:\\TEMP" -#endif -#if defined(_MSC_VER) && (_MSC_VER > 1310) -# define HAVE_SETENV -#define setenv(a,b,c) _putenv_s(a,b) -#endif -#define PSAPI_VERSION 1 /* for GetProcessMemoryInfo() */ - -/* We don't want the min/max macros */ -#ifdef __WIN__ -#define NOMINMAX 1 -#endif - -/* - MySQL features -*/ -#define LOCAL_INFILE_MODE_OFF 0 -#define LOCAL_INFILE_MODE_ON 1 -#define LOCAL_INFILE_MODE_AUTO 2 -#define ENABLED_LOCAL_INFILE LOCAL_INFILE_MODE_AUTO - -#define ENABLED_PROFILING 1 -/* #undef EXTRA_DEBUG */ -#define USE_SYMDIR 1 - -/* Character sets and collations */ -#define MYSQL_DEFAULT_CHARSET_NAME "latin1" -#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" - -#define USE_MB 1 -#define USE_MB_IDENT 1 - -/* This should mean case insensitive file system */ -#define FN_NO_CASE_SENSE 1 - -#define HAVE_CHARSET_armscii8 1 -#define HAVE_CHARSET_ascii 1 -#define HAVE_CHARSET_big5 1 -#define HAVE_CHARSET_cp1250 1 -#define HAVE_CHARSET_cp1251 1 -#define HAVE_CHARSET_cp1256 1 -#define HAVE_CHARSET_cp1257 1 -#define HAVE_CHARSET_cp850 1 -#define HAVE_CHARSET_cp852 1 -#define HAVE_CHARSET_cp866 1 -#define HAVE_CHARSET_cp932 1 -#define HAVE_CHARSET_dec8 1 -#define HAVE_CHARSET_eucjpms 1 -#define HAVE_CHARSET_euckr 1 -#define HAVE_CHARSET_gb2312 1 -#define HAVE_CHARSET_gbk 1 -#define HAVE_CHARSET_geostd8 1 -#define HAVE_CHARSET_greek 1 -#define HAVE_CHARSET_hebrew 1 -#define HAVE_CHARSET_hp8 1 -#define HAVE_CHARSET_keybcs2 1 -#define HAVE_CHARSET_koi8r 1 -#define HAVE_CHARSET_koi8u 1 -#define HAVE_CHARSET_latin1 1 -#define HAVE_CHARSET_latin2 1 -#define HAVE_CHARSET_latin5 1 -#define HAVE_CHARSET_latin7 1 -#define HAVE_CHARSET_macce 1 -#define HAVE_CHARSET_macroman 1 -#define HAVE_CHARSET_sjis 1 -#define HAVE_CHARSET_swe7 1 -#define HAVE_CHARSET_tis620 1 -#define HAVE_CHARSET_ucs2 1 -#define HAVE_CHARSET_ujis 1 -#define HAVE_CHARSET_utf8mb4 1 -#define HAVE_CHARSET_utf8mb3 1 -#define HAVE_CHARSET_utf16 1 -#define HAVE_CHARSET_utf32 1 -#define HAVE_UCA_COLLATIONS 1 -#define HAVE_COMPRESS 1 -/* #undef HAVE_EncryptAes128Ctr */ -/* #undef HAVE_EncryptAes128Gcm */ - -/* - Stuff that always need to be defined (compile breaks without it) -*/ -#define HAVE_SPATIAL 1 -#define HAVE_RTREE_KEYS 1 -#define HAVE_QUERY_CACHE 1 -#define BIG_TABLES 1 - -/* - Important storage engines (those that really need define - WITH__STORAGE_ENGINE for the whole server) -*/ -#define WITH_INNOBASE_STORAGE_ENGINE 1 -#define WITH_PARTITION_STORAGE_ENGINE 1 -#define WITH_PERFSCHEMA_STORAGE_ENGINE 1 -#define WITH_ARIA_STORAGE_ENGINE 1 -#define USE_ARIA_FOR_TMP_TABLES 1 - -#define DEFAULT_MYSQL_HOME "C:/Program Files/MariaDB 10.5" -#define SHAREDIR "share" -#define DEFAULT_BASEDIR "C:/Program Files/MariaDB 10.5" -#define MYSQL_DATADIR "C:/Program Files/MariaDB 10.5/data" -#define DEFAULT_CHARSET_HOME "C:/Program Files/MariaDB 10.5" -#define PLUGINDIR "C:/Program Files/MariaDB 10.5/lib/plugin" -/* #undef DEFAULT_SYSCONFDIR */ -#define DEFAULT_TMPDIR P_tmpdir - -/* #undef SO_EXT */ - -#define MYSQL_VERSION_MAJOR 10 -#define MYSQL_VERSION_MINOR 5 -#define MYSQL_VERSION_PATCH 7 -#define MYSQL_VERSION_EXTRA "" - -#define PACKAGE "mysql" -#define PACKAGE_BUGREPORT "" -#define PACKAGE_NAME "MySQL Server" -#define PACKAGE_STRING "MySQL Server 10.5.7" -#define PACKAGE_TARNAME "mysql" -#define PACKAGE_VERSION "10.5.7" -#define VERSION "10.5.7" -#define PROTOCOL_VERSION 10 -#define PCRE2_CODE_UNIT_WIDTH 8 - -#define MALLOC_LIBRARY "system" - -/* time_t related defines */ - -#define SIZEOF_TIME_T 8 -#define TIME_T_UNSIGNED 1 - -#ifndef EMBEDDED_LIBRARY -/* #undef WSREP_INTERFACE_VERSION */ -/* #undef WITH_WSREP */ -/* #undef WSREP_PROC_INFO */ -#endif - -#if !defined(__STDC_FORMAT_MACROS) -#define __STDC_FORMAT_MACROS -#endif // !defined(__STDC_FORMAT_MACROS) - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_dbug.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_dbug.h deleted file mode 100644 index fa5b4c1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_dbug.h +++ /dev/null @@ -1,248 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. - Copyright (C) 2000, 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_dbug_h -#define _my_dbug_h - -#ifndef __WIN__ -#include -#endif /* not __WIN__ */ - -#ifdef __cplusplus -extern "C" { -#endif -#if !defined(DBUG_OFF) && !defined(_lint) - -struct _db_stack_frame_ { - const char *func; /* function name of the previous stack frame */ - const char *file; /* filename of the function of previous frame */ - uint level; /* this nesting level, highest bit enables tracing */ - int line; /* line of DBUG_RETURN */ - struct _db_stack_frame_ *prev; /* pointer to the previous frame */ -}; - -struct _db_code_state_; -extern my_bool _dbug_on_; -extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int); -extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len); -extern int _db_explain_init_(char *buf, size_t len); -extern int _db_is_pushed_(void); -extern void _db_setjmp_(void); -extern void _db_longjmp_(void); -extern void _db_process_(const char *name); -extern void _db_push_(const char *control); -extern void _db_pop_(void); -extern void _db_set_(const char *control); -extern void _db_set_init_(const char *control); -extern void _db_enter_(const char *_func_, const char *_file_, uint _line_, - struct _db_stack_frame_ *_stack_frame_); -extern void _db_return_(struct _db_stack_frame_ *_stack_frame_); -extern int _db_pargs_(uint _line_,const char *keyword); -extern void _db_doprnt_(const char *format,...) -#ifdef WAITING_FOR_BUGFIX_TO_VSPRINTF - ATTRIBUTE_FORMAT(printf, 1, 2) -#endif - ; -extern void _db_dump_(uint _line_,const char *keyword, - const unsigned char *memory, size_t length); -extern void _db_end_(void); -extern void _db_lock_file_(void); -extern void _db_unlock_file_(void); -ATTRIBUTE_COLD -extern my_bool _db_my_assert(const char *file, int line, const char *msg); -extern FILE *_db_fp_(void); -extern void _db_flush_(void); -extern void dbug_swap_code_state(void **code_state_store); -extern void dbug_free_code_state(void **code_state_store); -extern const char* _db_get_func_(void); -extern int (*dbug_sanity)(void); - -#ifdef DBUG_TRACE -#define DBUG_LEAVE do { \ - _db_stack_frame_.line= __LINE__; \ - _db_return_ (&_db_stack_frame_); \ - _db_stack_frame_.line= 0; \ - } while(0) - -#ifdef HAVE_ATTRIBUTE_CLEANUP -#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_ __attribute__((cleanup(_db_return_))); \ - _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_) -#define DBUG_RETURN(a1) do { _db_stack_frame_.line=__LINE__; return(a1);} while(0) -#define DBUG_VOID_RETURN do { _db_stack_frame_.line=__LINE__; return;} while(0) -#else -#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \ - _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_) -#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0) -#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) -#endif - -#else -#define DBUG_LEAVE -#define DBUG_ENTER(a) -#define DBUG_RETURN(a1) return(a1) -#define DBUG_VOID_RETURN return -#endif - -#define DBUG_EXECUTE(keyword,a1) \ - do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0) -#define DBUG_EXECUTE_IF(keyword,a1) \ - do {if (_db_keyword_(0, (keyword), 1)) { a1 }} while(0) -#define DBUG_EVALUATE(keyword,a1,a2) \ - (_db_keyword_(0,(keyword), 0) ? (a1) : (a2)) -#define DBUG_EVALUATE_IF(keyword,a1,a2) \ - (_db_keyword_(0,(keyword), 1) ? (a1) : (a2)) -#define DBUG_PRINT(keyword,arglist) \ - do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0) - -#define DBUG_PUSH_EMPTY if (_dbug_on_) { DBUG_PUSH(""); } -#define DBUG_POP_EMPTY if (_dbug_on_) { DBUG_POP(); } -#define DBUG_PUSH(a1) _db_push_ (a1) -#define DBUG_POP() _db_pop_ () -#define DBUG_SET(a1) _db_set_ (a1) -#define DBUG_SET_INITIAL(a1) _db_set_init_ (a1) -#define DBUG_PROCESS(a1) _db_process_(a1) -#define DBUG_FILE _db_fp_() -#define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) -#define DBUG_END() _db_end_ () -#define DBUG_LOCK_FILE _db_lock_file_() -#define DBUG_UNLOCK_FILE _db_unlock_file_() -#define DBUG_ASSERT(A) do { \ - if (unlikely(!(A)) && _db_my_assert(__FILE__, __LINE__, #A)) assert(A); \ -} while (0) -#define DBUG_SLOW_ASSERT(A) DBUG_ASSERT(A) -#define DBUG_ASSERT_EXISTS -#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len)) -#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len)) -#define DEBUGGER_OFF do { _dbug_on_= 0; } while(0) -#define DEBUGGER_ON do { _dbug_on_= 1; } while(0) -#define IF_DBUG(A,B) A -#define IF_DBUG_ASSERT(A,B) A -#define DBUG_SWAP_CODE_STATE(arg) dbug_swap_code_state(arg) -#define DBUG_FREE_CODE_STATE(arg) dbug_free_code_state(arg) -#undef DBUG_ASSERT_AS_PRINTF - -#ifndef __WIN__ -#define DBUG_ABORT() (_db_flush_(), abort()) -#else -/* - Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can - call abort() instead of _exit(3) (now it would cause a "test signal" popup). -*/ -#include -#define DBUG_ABORT() (_db_flush_(),\ - (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\ - (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\ - TerminateProcess(GetCurrentProcess(),3)) -#endif - -/* - Make the program fail, without creating a core file. - abort() will send SIGABRT which (most likely) generates core. - Use SIGKILL instead, which cannot be caught. - We also pause the current thread, until the signal is actually delivered. - An alternative would be to use _exit(EXIT_FAILURE), - but then valgrind would report lots of memory leaks. - */ -#ifdef __WIN__ -#define DBUG_SUICIDE() DBUG_ABORT() -#else -extern void _db_suicide_(void); -#define DBUG_SUICIDE() (_db_flush_(), _db_suicide_()) -#endif /* __WIN__ */ - -#else /* No debugger */ - -#define DBUG_ENTER(a1) -#define DBUG_VIOLATION_HELPER_LEAVE do { } while(0) -#define DBUG_LEAVE -#define DBUG_RETURN(a1) do { return(a1); } while(0) -#define DBUG_VOID_RETURN do { return; } while(0) -#define DBUG_EXECUTE(keyword,a1) do { } while(0) -#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0) -#define DBUG_EVALUATE(keyword,a1,a2) (a2) -#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2) -#define DBUG_PRINT(keyword,arglist) do { } while(0) -#define DBUG_PUSH_EMPTY do { } while(0) -#define DBUG_POP_EMPTY do { } while(0) -#define DBUG_PUSH(a1) do { } while(0) -#define DBUG_SET(a1) do { } while(0) -#define DBUG_SET_INITIAL(a1) do { } while(0) -#define DBUG_POP() do { } while(0) -#define DBUG_PROCESS(a1) do { } while(0) -#define DBUG_DUMP(keyword,a1,a2) do { } while(0) -#define DBUG_END() do { } while(0) -#define DBUG_SLOW_ASSERT(A) do { } while(0) -#define DBUG_LOCK_FILE do { } while(0) -#define DBUG_FILE (stderr) -#define DBUG_UNLOCK_FILE do { } while(0) -#define DBUG_EXPLAIN(buf,len) -#define DBUG_EXPLAIN_INITIAL(buf,len) -#define DEBUGGER_OFF do { } while(0) -#define DEBUGGER_ON do { } while(0) -#define IF_DBUG(A,B) B -#define DBUG_SWAP_CODE_STATE(arg) do { } while(0) -#define DBUG_FREE_CODE_STATE(arg) do { } while(0) -#define DBUG_ABORT() do { } while(0) -#define DBUG_CRASH_ENTER(func) -#define DBUG_CRASH_RETURN(val) do { return(val); } while(0) -#define DBUG_CRASH_VOID_RETURN do { return; } while(0) -#define DBUG_SUICIDE() do { } while(0) - -#ifdef DBUG_ASSERT_AS_PRINTF -extern void (*my_dbug_assert_failed)(const char *assert_expr, const char* file, unsigned long line); -#define DBUG_ASSERT(assert_expr) do { if (!(assert_expr)) { my_dbug_assert_failed(#assert_expr, __FILE__, __LINE__); }} while (0) -#define DBUG_ASSERT_EXISTS -#define IF_DBUG_ASSERT(A,B) A -#else -#define DBUG_ASSERT(A) do { } while(0) -#define IF_DBUG_ASSERT(A,B) B -#endif /* DBUG_ASSERT_AS_PRINTF */ -#endif /* !defined(DBUG_OFF) && !defined(_lint) */ - -#ifdef EXTRA_DEBUG -/** - Sync points allow us to force the server to reach a certain line of code - and block there until the client tells the server it is ok to go on. - The client tells the server to block with SELECT GET_LOCK() - and unblocks it with SELECT RELEASE_LOCK(). Used for debugging difficult - concurrency problems -*/ -#define DBUG_SYNC_POINT(lock_name,lock_timeout) \ - debug_sync_point(lock_name,lock_timeout) -void debug_sync_point(const char* lock_name, uint lock_timeout); -#else -#define DBUG_SYNC_POINT(lock_name,lock_timeout) -#endif /* EXTRA_DEBUG */ - -#ifdef __cplusplus -} -/* - DBUG_LOG() was initially intended for InnoDB. To be able to use it elsewhere - one should #include . We intentionally avoid including it here to save - compilation time. -*/ -# ifdef DBUG_OFF -# define DBUG_LOG(keyword, v) do {} while (0) -# else -# define DBUG_LOG(keyword, v) do { \ - if (_db_pargs_(__LINE__, keyword)) { \ - std::ostringstream _db_s; _db_s << v; \ - _db_doprnt_("%s", _db_s.str().c_str()); \ - }} while (0) -# endif -#endif - -#endif /* _my_dbug_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_decimal_limits.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_decimal_limits.h deleted file mode 100644 index ac1df83..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_decimal_limits.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef MY_DECIMAL_LIMITS_INCLUDED -#define MY_DECIMAL_LIMITS_INCLUDED -/* Copyright (c) 2011 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#define DECIMAL_LONGLONG_DIGITS 22 -#define DECIMAL_LONG_DIGITS 10 -#define DECIMAL_LONG3_DIGITS 8 - -/** maximum length of buffer in our big digits (uint32). */ -#define DECIMAL_BUFF_LENGTH 9 - -/* the number of digits that my_decimal can possibly contain */ -#define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9) - - -/** - maximum guaranteed precision of number in decimal digits (number of our - digits * number of decimal digits in one our big digit - number of decimal - digits in one our big digit decreased by 1 (because we always put decimal - point on the border of our big digits)) - - With normal precession we can handle 65 digits. MariaDB can store in - the .frm up to 63 digits. By default we use DECIMAL_NOT_SPECIFIED digits - when converting strings to decimal, so we don't want to set this too high. - To not use up all digits for the scale we limit the number of decimals to - 38. -*/ -#define DECIMAL_MAX_PRECISION (DECIMAL_MAX_POSSIBLE_PRECISION - 8*2) -#define DECIMAL_MAX_SCALE 38 -#define DECIMAL_NOT_SPECIFIED 39 - -/** - maximum length of string representation (number of maximum decimal - digits + 1 position for sign + 1 position for decimal point, no terminator) -*/ -#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2) - -#endif /* MY_DECIMAL_LIMITS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_dir.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_dir.h deleted file mode 100644 index 930d54c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_dir.h +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MY_DIR_H -#define MY_DIR_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - /* Defines for my_dir and my_stat */ - -#define MY_S_IFMT S_IFMT /* type of file */ -#define MY_S_IFDIR S_IFDIR /* directory */ -#define MY_S_IFCHR S_IFCHR /* character special */ -#define MY_S_IFBLK S_IFBLK /* block special */ -#define MY_S_IFREG S_IFREG /* regular */ -#define MY_S_IFIFO S_IFIFO /* fifo */ -#define MY_S_ISUID S_ISUID /* set user id on execution */ -#define MY_S_ISGID S_ISGID /* set group id on execution */ -#define MY_S_ISVTX S_ISVTX /* save swapped text even after use */ - -#ifndef S_IREAD -#define MY_S_IREAD S_IRUSR /* read permission, owner */ -#define MY_S_IWRITE S_IWUSR /* write permission, owner */ -#define MY_S_IEXEC S_IXUSR /* execute/search permission, owner */ -#else -#define MY_S_IREAD S_IREAD /* read permission, owner */ -#define MY_S_IWRITE S_IWRITE /* write permission, owner */ -#define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */ -#endif - -#define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR) -#define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR) -#define MY_S_ISBLK(m) (((m) & MY_S_IFMT) == MY_S_IFBLK) -#define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG) -#define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO) - -/* Ensure these doesn't clash with anything in my_sys.h */ -#define MY_WANT_SORT 8192 /* my_lib; sort files */ -#define MY_WANT_STAT 16384 /* my_lib; stat files */ -#define MY_DONT_SORT 0 - - /* typedefs for my_dir & my_stat */ - -#ifdef USE_MY_STAT_STRUCT - -typedef struct my_stat -{ - dev_t st_dev; /* major & minor device numbers */ - ino_t st_ino; /* inode number */ - ushort st_mode; /* file permissions (& suid sgid .. bits) */ - short st_nlink; /* number of links to file */ - ushort st_uid; /* user id */ - ushort st_gid; /* group id */ - dev_t st_rdev; /* more major & minor device numbers (???) */ - off_t st_size; /* size of file */ - time_t st_atime; /* time for last read */ - time_t st_mtime; /* time for last contens modify */ - time_t st_ctime; /* time for last inode or contents modify */ -} MY_STAT; - -#else - -#if defined(_MSC_VER) -#define MY_STAT struct _stati64 /* 64 bit file size */ -#else -#define MY_STAT struct stat /* Original struct has what we need */ -#endif - -#endif /* USE_MY_STAT_STRUCT */ - -/* Struct describing one file returned from my_dir */ -typedef struct fileinfo -{ - char *name; - MY_STAT *mystat; -} FILEINFO; - -typedef struct st_my_dir /* Struct returned from my_dir */ -{ - /* - These members are just copies of parts of DYNAMIC_ARRAY structure, - which is allocated right after the end of MY_DIR structure (MEM_ROOT - for storing names is also resides there). We've left them here because - we don't want to change code that uses my_dir. - */ - struct fileinfo *dir_entry; - uint number_of_files; -} MY_DIR; - -extern MY_DIR *my_dir(const char *path,myf MyFlags); -extern void my_dirend(MY_DIR *buffer); -extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags); -extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags); - -#ifdef __cplusplus -} -#endif - -#endif /* MY_DIR_H */ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_getopt.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_getopt.h deleted file mode 100644 index 642fb34..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_getopt.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (c) 2002, 2013, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_getopt_h -#define _my_getopt_h - -#include "my_sys.h" /* loglevel */ -/* my_getopt and my_default are almost always used together */ -#include - -C_MODE_START - -#define GET_NO_ARG 1 -#define GET_BOOL 2 -#define GET_INT 3 -#define GET_UINT 4 -#define GET_LONG 5 -#define GET_ULONG 6 -#define GET_LL 7 -#define GET_ULL 8 -#define GET_STR 9 -#define GET_STR_ALLOC 10 -#define GET_DISABLED 11 -#define GET_ENUM 12 -#define GET_SET 13 -#define GET_DOUBLE 14 -#define GET_FLAGSET 15 -#define GET_BIT 16 - -#define GET_ASK_ADDR 128 -#define GET_AUTO 64 -#define GET_TYPE_MASK 63 - -/** - Enumeration of the my_option::arg_type attributes. - It should be noted that for historical reasons variables with the combination - arg_type=NO_ARG, my_option::var_type=GET_BOOL still accepts - arguments. This is someone counter intuitive and care should be taken - if the code is refactored. -*/ -enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG }; - -struct st_typelib; - -struct my_option -{ - const char *name; /**< Name of the option. name=NULL - marks the end of the my_option[] - array. - */ - int id; /**< For 0255 no short option - is created, but a long option still - can be identified uniquely in the - my_get_one_option() callback. - If an opton needs neither special - treatment in the my_get_one_option() - nor one-letter short equivalent - use id=0 - */ - const char *comment; /**< option comment, for autom. --help. - if it's NULL the option is not - visible in --help. - */ - void *value; /**< A pointer to the variable value */ - void *u_max_value; /**< The user def. max variable value */ - struct st_typelib *typelib; /**< Pointer to possible values */ - ulong var_type; /**< GET_BOOL, GET_ULL, etc */ - enum get_opt_arg_type arg_type; /**< e.g. REQUIRED_ARG or OPT_ARG */ - longlong def_value; /**< Default value */ - longlong min_value; /**< Min allowed value (for numbers) */ - ulonglong max_value; /**< Max allowed value (for numbers) */ - longlong sub_size; /**< Unused */ - long block_size; /**< Value should be a mult. of this (for numbers) */ - void *app_type; /**< To be used by an application */ -}; - -typedef my_bool (*my_get_one_option)(const struct my_option *, char *, const char *); - -/** - Used to retrieve a reference to the object (variable) that holds the value - for the given option. For example, if var_type is GET_UINT, the function - must return a pointer to a variable of type uint. A argument is stored in - the location pointed to by the returned pointer. -*/ -typedef void *(*my_getopt_value)(const char *, uint, const struct my_option *, - int *); - - -extern char *disabled_my_option; -extern char *autoset_my_option; -extern my_bool my_getopt_print_errors; -extern my_bool my_getopt_skip_unknown; -extern my_bool my_getopt_prefix_matching; -extern my_bool my_handle_options_init_variables; -extern my_error_reporter my_getopt_error_reporter; -extern my_getopt_value my_getopt_get_addr; - -extern int handle_options (int *argc, char ***argv, - const struct my_option *longopts, my_get_one_option) - __attribute__((nonnull)); -extern void my_cleanup_options(const struct my_option *options); -extern void my_print_help(const struct my_option *options); -extern void my_print_variables(const struct my_option *options); - -ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, - my_bool *fix); -longlong getopt_ll_limit_value(longlong, const struct my_option *, - my_bool *fix); -double getopt_double_limit_value(double num, const struct my_option *optp, - my_bool *fix); - -ulonglong getopt_double2ulonglong(double); -double getopt_ulonglong2double(ulonglong); - -C_MODE_END - -#endif /* _my_getopt_h */ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_global.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_global.h deleted file mode 100644 index 86ef5f8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_global.h +++ /dev/null @@ -1,1232 +0,0 @@ -/* - Copyright (c) 2001, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* This is the include file that should be included 'first' in every C file. */ - -#ifndef MY_GLOBAL_INCLUDED -#define MY_GLOBAL_INCLUDED - -/* Client library users on Windows need this macro defined here. */ -#if !defined(__WIN__) && defined(_WIN32) -#define __WIN__ -#endif - -/* - InnoDB depends on some MySQL internals which other plugins should not - need. This is because of InnoDB's foreign key support, "safe" binlog - truncation, and other similar legacy features. - - We define accessors for these internals unconditionally, but do not - expose them in mysql/plugin.h. They are declared in ha_innodb.h for - InnoDB's use. -*/ -#define INNODB_COMPATIBILITY_HOOKS - -#ifdef __CYGWIN__ -/* We use a Unix API, so pretend it's not Windows */ -#undef WIN -#undef WIN32 -#undef _WIN -#undef _WIN32 -#undef _WIN64 -#undef __WIN__ -#undef __WIN32__ -#define HAVE_ERRNO_AS_DEFINE -#define _POSIX_MONOTONIC_CLOCK -#define _POSIX_THREAD_CPUTIME -#endif /* __CYGWIN__ */ - -#if defined(__OpenBSD__) && (OpenBSD >= 200411) -#define HAVE_ERRNO_AS_DEFINE -#endif - -#if defined(i386) && !defined(__i386__) -#define __i386__ -#endif - -/* Macros to make switching between C and C++ mode easier */ -#ifdef __cplusplus -#define C_MODE_START extern "C" { -#define C_MODE_END } -#else -#define C_MODE_START -#define C_MODE_END -#endif - -#ifdef __cplusplus -#define CPP_UNNAMED_NS_START namespace { -#define CPP_UNNAMED_NS_END } -#endif - -#include - -#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE -#define HAVE_PSI_INTERFACE -#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ - -/* Make it easier to add conditional code in _expressions_ */ -#ifdef __WIN__ -#define IF_WIN(A,B) A -#else -#define IF_WIN(A,B) B -#endif - -#ifdef EMBEDDED_LIBRARY -#define IF_EMBEDDED(A,B) A -#else -#define IF_EMBEDDED(A,B) B -#endif - -#ifdef WITH_PARTITION_STORAGE_ENGINE -#define IF_PARTITIONING(A,B) A -#else -#define IF_PARTITIONING(A,B) B -#endif - -#if defined (_WIN32) -/* - off_t is 32 bit long. We do not use C runtime functions - with off_t but native Win32 file IO APIs, that work with - 64 bit offsets. -*/ -#undef SIZEOF_OFF_T -#define SIZEOF_OFF_T 8 - -/* - Prevent inclusion of Windows GDI headers - they define symbol - ERROR that conflicts with mysql headers. -*/ -#ifndef NOGDI -#define NOGDI -#endif - -/* Include common headers.*/ -#include -#include /* SOCKET */ -#include /* access(), chmod() */ -#include /* getpid() */ - -#define sleep(a) Sleep((a)*1000) - -/* Define missing access() modes. */ -#define F_OK 0 -#define W_OK 2 -#define R_OK 4 /* Test for read permission. */ - -/* Define missing file locking constants. */ -#define F_RDLCK 1 -#define F_WRLCK 2 -#define F_UNLCK 3 -#define F_TO_EOF 0x3FFFFFFF - -#endif /* _WIN32*/ - - -/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */ -#if defined(_AIX) && defined(_LARGE_FILE_API) -#undef _LARGE_FILE_API -#undef __GNUG__ -#endif - -/* - The macros below are used to allow build of Universal/fat binaries of - MySQL and MySQL applications under darwin. -*/ -#if defined(__APPLE__) && defined(__MACH__) -# undef SIZEOF_CHARP -# undef SIZEOF_INT -# undef SIZEOF_LONG -# undef SIZEOF_LONG_LONG -# undef SIZEOF_OFF_T -# undef WORDS_BIGENDIAN -# define SIZEOF_INT 4 -# define SIZEOF_LONG_LONG 8 -# define SIZEOF_OFF_T 8 -# if defined(__i386__) || defined(__ppc__) -# define SIZEOF_CHARP 4 -# define SIZEOF_LONG 4 -# elif defined(__x86_64__) || defined(__ppc64__) -# define SIZEOF_CHARP 8 -# define SIZEOF_LONG 8 -# else -# error Building FAT binary for an unknown architecture. -# endif -# if defined(__ppc__) || defined(__ppc64__) -# define WORDS_BIGENDIAN -# endif -#endif /* defined(__APPLE__) && defined(__MACH__) */ - - -/* - The macros below are borrowed from include/linux/compiler.h in the - Linux kernel. Use them to indicate the likelihood of the truthfulness - of a condition. This serves two purposes - newer versions of gcc will be - able to optimize for branch predication, which could yield siginficant - performance gains in frequently executed sections of the code, and the - other reason to use them is for documentation -*/ - -#if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) -#define __builtin_expect(x, expected_value) (x) -#endif - -/* Fix problem with S_ISLNK() on Linux */ -#if defined(TARGET_OS_LINUX) || defined(__GLIBC__) -#undef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -/* - Temporary solution to solve bug#7156. Include "sys/types.h" before - the thread headers, else the function madvise() will not be defined -*/ -#if defined(HAVE_SYS_TYPES_H) && ( defined(sun) || defined(__sun) ) -#include -#endif - -#define __EXTENSIONS__ 1 /* We want some extension */ -#ifndef __STDC_EXT__ -#define __STDC_EXT__ 1 /* To get large file support on hpux */ -#endif - -/* - Solaris 9 include file refers to X/Open document - - System Interfaces and Headers, Issue 5 - - saying we should define _XOPEN_SOURCE=500 to get POSIX.1c prototypes, - but apparently other systems (namely FreeBSD) don't agree. - - On a newer Solaris 10, the above file recognizes also _XOPEN_SOURCE=600. - Furthermore, it tests that if a program requires older standard - (_XOPEN_SOURCE<600 or _POSIX_C_SOURCE<200112L) it cannot be - run on a new compiler (that defines _STDC_C99) and issues an #error. - It's also an #error if a program requires new standard (_XOPEN_SOURCE=600 - or _POSIX_C_SOURCE=200112L) and a compiler does not define _STDC_C99. - - To add more to this mess, Sun Studio C compiler defines _STDC_C99 while - C++ compiler does not! - - So, in a desperate attempt to get correct prototypes for both - C and C++ code, we define either _XOPEN_SOURCE=600 or _XOPEN_SOURCE=500 - depending on the compiler's announced C standard support. - - Cleaner solutions are welcome. -*/ -#ifdef __sun -#if __STDC_VERSION__ - 0 >= 199901L -#define _XOPEN_SOURCE 600 -#else -#define _XOPEN_SOURCE 500 -#endif -#endif - - -#ifdef _AIX -/* - AIX includes inttypes.h from sys/types.h - Explicitly request format macros before the first inclusion of inttypes.h -*/ -#if !defined(__STDC_FORMAT_MACROS) -#define __STDC_FORMAT_MACROS -#endif // !defined(__STDC_FORMAT_MACROS) -#endif - - -#if !defined(__WIN__) -#ifndef _POSIX_PTHREAD_SEMANTICS -#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ -#endif - -#if !defined(SCO) -#define _REENTRANT 1 /* Some thread libraries require this */ -#endif -#if !defined(_THREAD_SAFE) && !defined(_AIX) -#define _THREAD_SAFE /* Required for OSF1 */ -#endif -#if defined(HPUX10) || defined(HPUX11) -C_MODE_START /* HPUX needs this, signal.h bug */ -#include -C_MODE_END -#else -#include /* AIX must have this included first */ -#endif -#if !defined(SCO) && !defined(_REENTRANT) -#define _REENTRANT 1 /* Threads requires reentrant code */ -#endif -#endif /* !defined(__WIN__) */ - -/* Go around some bugs in different OS and compilers */ -#ifdef _AIX /* By soren@t.dk */ -#define _H_STRINGS -#define _SYS_STREAM_H -/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */ -#define ulonglong2double(A) my_ulonglong2double(A) -#define my_off_t2double(A) my_ulonglong2double(A) -C_MODE_START -inline double my_ulonglong2double(unsigned long long A) { return (double)A; } -C_MODE_END -#endif /* _AIX */ - -#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */ -#undef HAVE_INITGROUPS -#endif - -/* gcc/egcs issues */ - -#if defined(__GNUC) && defined(__EXCEPTIONS) -#error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile" -#endif - -#if defined(_lint) && !defined(lint) -#define lint -#endif -#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG) -#define _LONG_LONG 1 /* For AIX string library */ -#endif - -/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */ -#if defined(_AIX) && defined(_LARGE_FILE_API) -#undef _LARGE_FILE_API -#undef __GNUG__ -#endif - - -#ifndef stdin -#include -#endif -#include -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STDDEF_H -#include -#endif - -#include -#ifdef HAVE_LIMITS_H -#include -#endif -#ifdef HAVE_FLOAT_H -#include -#endif -#ifdef HAVE_FENV_H -#include /* For fesetround() */ -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */ -#if defined(_AIX) && defined(_LARGE_FILE_API) -#undef _LARGE_FILE_API -#undef __GNUG__ -#endif - - -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif /* TIME_WITH_SYS_TIME */ -#ifdef HAVE_UNISTD_H -#include -#endif -#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA) -#undef HAVE_ALLOCA -#undef HAVE_ALLOCA_H -#endif -#ifdef HAVE_ALLOCA_H -#include -#endif - -#include /* Recommended by debian */ -/* We need the following to go around a problem with openssl on solaris */ -#if defined(HAVE_CRYPT_H) -#include -#endif - -/* Add checking if we are using likely/unlikely wrong */ -#ifdef CHECK_UNLIKELY -C_MODE_START -extern void init_my_likely(), end_my_likely(FILE *); -extern int my_likely_ok(const char *file_name, uint line); -extern int my_likely_fail(const char *file_name, uint line); -C_MODE_END - -#define likely(A) ((A) ? (my_likely_ok(__FILE__, __LINE__),1) : (my_likely_fail(__FILE__, __LINE__), 0)) -#define unlikely(A) ((A) ? (my_likely_fail(__FILE__, __LINE__),1) : (my_likely_ok(__FILE__, __LINE__), 0)) -/* - These macros should be used when the check fails often when running benchmarks but - we know for sure that the check is correct in a production environment -*/ -#define checked_likely(A) (A) -#define checked_unlikely(A) (A) -#else -/** - The semantics of builtin_expect() are that - 1) its two arguments are long - 2) it's likely that they are == - Those of our likely(x) are that x can be bool/int/longlong/pointer. -*/ - -#define likely(x) __builtin_expect(((x) != 0),1) -#define unlikely(x) __builtin_expect(((x) != 0),0) -#define checked_likely(x) likely(x) -#define checked_unlikely(x) unlikely(x) -#endif /* CHECK_UNLIKELY */ - -/* - A lot of our programs uses asserts, so better to always include it - This also fixes a problem when people uses DBUG_ASSERT without including - assert.h -*/ -#include - -/* an assert that works at compile-time. only for constant expression */ -#ifdef _some_old_compiler_that_does_not_understand_the_construct_below_ -#define compile_time_assert(X) do { } while(0) -#else -#define compile_time_assert(X) \ - do \ - { \ - typedef char compile_time_assert[(X) ? 1 : -1] __attribute__((unused)); \ - } while(0) -#endif - -/* Go around some bugs in different OS and compilers */ -#if defined (HPUX11) && defined(_LARGEFILE_SOURCE) -#ifndef _LARGEFILE64_SOURCE -#define _LARGEFILE64_SOURCE -#endif -#endif - -#if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H) -#include /* HPUX 10.20 defines ulong here. UGLY !!! */ -#define HAVE_ULONG -#endif -#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) -/* Fix bug in setrlimit */ -#undef setrlimit -#define setrlimit cma_setrlimit64 -#endif -/* Declare madvise where it is not declared for C++, like Solaris */ -#if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus) -extern "C" int madvise(void *addr, size_t len, int behav); -#endif -#ifdef HAVE_SYS_MMAN_H -#include -#endif -/** FreeBSD equivalent */ -#if defined(MADV_CORE) && !defined(MADV_DODUMP) -#define MADV_DODUMP MADV_CORE -#define MADV_DONTDUMP MADV_NOCORE -#define DODUMP_STR "MADV_CORE" -#define DONTDUMP_STR "MADV_NOCORE" -#else -#define DODUMP_STR "MADV_DODUMP" -#define DONTDUMP_STR "MADV_DONTDUMP" -#endif - - -#define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ -#define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ - -/* Paranoid settings. Define I_AM_PARANOID if you are paranoid */ -#ifdef I_AM_PARANOID -#define DONT_ALLOW_USER_CHANGE 1 -#define DONT_USE_MYSQL_PWD 1 -#endif - -/* Does the system remember a signal handler after a signal ? */ -#if !defined(HAVE_BSD_SIGNALS) && !defined(HAVE_SIGACTION) -#define SIGNAL_HANDLER_RESET_ON_DELIVERY -#endif - -/* don't assume that STDERR_FILENO is 2, mysqld can freopen */ -#undef STDERR_FILENO - -#ifndef SO_EXT -#ifdef _WIN32 -#define SO_EXT ".dll" -#else -#define SO_EXT ".so" -#endif -#endif - -/* - Suppress uninitialized variable warning without generating code. -*/ -#if defined(__GNUC__) -/* GCC specific self-initialization which inhibits the warning. */ -#define UNINIT_VAR(x) x= x -#elif defined(_lint) || defined(FORCE_INIT_OF_VARS) -#define UNINIT_VAR(x) x= 0 -#else -#define UNINIT_VAR(x) x -#endif - -/* This is only to be used when resetting variables in a class constructor */ -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) -#define LINT_INIT(x) x= 0 -#else -#define LINT_INIT(x) -#endif - -#if !defined(HAVE_UINT) -#undef HAVE_UINT -#define HAVE_UINT -typedef unsigned int uint; -typedef unsigned short ushort; -#endif - -#define swap_variables(t, a, b) do { t dummy; dummy= a; a= b; b= dummy; } while(0) -#define MY_TEST(a) ((a) ? 1 : 0) -#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) -#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) -#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) -#define test_all_bits(a,b) (((a) & (b)) == (b)) -#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) - -/* Define some general constants */ -#ifndef TRUE -#define TRUE (1) /* Logical true */ -#define FALSE (0) /* Logical false */ -#endif - -#include - -/* - Wen using the embedded library, users might run into link problems, - duplicate declaration of __cxa_pure_virtual, solved by declaring it a - weak symbol. -*/ -#if defined(USE_MYSYS_NEW) && ! defined(DONT_DECLARE_CXA_PURE_VIRTUAL) -C_MODE_START -int __cxa_pure_virtual () __attribute__ ((weak)); -C_MODE_END -#endif - -/* The DBUG_ON flag always takes precedence over default DBUG_OFF */ -#if defined(DBUG_ON) && defined(DBUG_OFF) -#undef DBUG_OFF -#endif - -/* We might be forced to turn debug off, if not turned off already */ -#if (defined(FORCE_DBUG_OFF) || defined(_lint)) && !defined(DBUG_OFF) -# define DBUG_OFF -# ifdef DBUG_ON -# undef DBUG_ON -# endif -#endif - -#ifdef DBUG_OFF -#undef EXTRA_DEBUG -#endif - -/* Some types that is different between systems */ - -typedef int File; /* File descriptor */ -#ifdef _WIN32 -typedef SOCKET my_socket; -#else -typedef int my_socket; /* File descriptor for sockets */ -#define INVALID_SOCKET -1 -#endif -/* Type for functions that handles signals */ -#define sig_handler RETSIGTYPE -#if defined(__GNUC__) && !defined(_lint) -typedef char pchar; /* Mixed prototypes can take char */ -typedef char puchar; /* Mixed prototypes can take char */ -typedef char pbool; /* Mixed prototypes can take char */ -typedef short pshort; /* Mixed prototypes can take short int */ -typedef float pfloat; /* Mixed prototypes can take float */ -#else -typedef int pchar; /* Mixed prototypes can't take char */ -typedef uint puchar; /* Mixed prototypes can't take char */ -typedef int pbool; /* Mixed prototypes can't take char */ -typedef int pshort; /* Mixed prototypes can't take short int */ -typedef double pfloat; /* Mixed prototypes can't take float */ -#endif -C_MODE_START -typedef int (*qsort_cmp)(const void *,const void *); -typedef int (*qsort_cmp2)(void*, const void *,const void *); -C_MODE_END -#define qsort_t RETQSORTTYPE /* Broken GCC can't handle typedef !!!! */ -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -typedef SOCKET_SIZE_TYPE size_socket; - -#ifndef SOCKOPT_OPTLEN_TYPE -#define SOCKOPT_OPTLEN_TYPE size_socket -#endif - -/* file create flags */ - -#ifndef O_SHARE /* Probably not windows */ -#define O_SHARE 0 /* Flag to my_open for shared files */ -#ifndef O_BINARY -#define O_BINARY 0 /* Flag to my_open for binary files */ -#endif -#ifndef FILE_BINARY -#define FILE_BINARY O_BINARY /* Flag to my_fopen for binary streams */ -#endif -#ifdef HAVE_FCNTL -#define HAVE_FCNTL_LOCK -#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */ -#endif -#endif /* O_SHARE */ - -#ifndef O_SEQUENTIAL -#define O_SEQUENTIAL 0 -#endif -#ifndef O_SHORT_LIVED -#define O_SHORT_LIVED 0 -#endif -#ifndef O_NOFOLLOW -#define O_NOFOLLOW 0 -#endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif -#ifdef __GLIBC__ -#define STR_O_CLOEXEC "e" -#else -#define STR_O_CLOEXEC "" -#endif -#ifndef SOCK_CLOEXEC -#define SOCK_CLOEXEC 0 -#else -#define HAVE_SOCK_CLOEXEC -#endif - -/* additional file share flags for win32 */ -#ifdef __WIN__ -#define _SH_DENYRWD 0x110 /* deny read/write mode & delete */ -#define _SH_DENYWRD 0x120 /* deny write mode & delete */ -#define _SH_DENYRDD 0x130 /* deny read mode & delete */ -#define _SH_DENYDEL 0x140 /* deny delete only */ -#endif /* __WIN__ */ - - -/* General constants */ -#define FN_LEN 256 /* Max file name len */ -#define FN_HEADLEN 253 /* Max length of filepart of file name */ -#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */ -#define FN_REFLEN 512 /* Max length of full path-name */ -#define FN_EXTCHAR '.' -#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */ -#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */ -#define FN_PARENTDIR ".." /* Parent directory; Must be a string */ - -#ifdef _WIN32 -#define FN_LIBCHAR '\\' -#define FN_LIBCHAR2 '/' -#define FN_DIRSEP "/\\" /* Valid directory separators */ -#define FN_EXEEXT ".exe" -#define FN_SOEXT ".dll" -#define FN_ROOTDIR "\\" -#define FN_DEVCHAR ':' -#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ -#define FN_NO_CASE_SENCE /* Files are not case-sensitive */ -#else -#define FN_LIBCHAR '/' -#define FN_LIBCHAR2 '/' -#define FN_DIRSEP "/" /* Valid directory separators */ -#define FN_EXEEXT "" -#define FN_SOEXT ".so" -#define FN_ROOTDIR "/" -#endif - -/* - MY_FILE_MIN is Windows speciality and is used to quickly detect - the mismatch of CRT and mysys file IO usage on Windows at runtime. - CRT file descriptors can be in the range 0-2047, whereas descriptors returned - by my_open() will start with 2048. If a file descriptor with value less then - MY_FILE_MIN is passed to mysys IO function, chances are it stemms from - open()/fileno() and not my_open()/my_fileno. - - For Posix, mysys functions are light wrappers around libc, and MY_FILE_MIN - is logically 0. -*/ - -#ifdef _WIN32 -#define MY_FILE_MIN 2048 -#else -#define MY_FILE_MIN 0 -#endif - -/* - MY_NFILE is the default size of my_file_info array. - - It is larger on Windows, because it all file handles are stored in my_file_info - Default size is 16384 and this should be enough for most cases.If it is not - enough, --max-open-files with larger value can be used. - - For Posix , my_file_info array is only used to store filenames for - error reporting and its size is not a limitation for number of open files. -*/ -#ifdef _WIN32 -#define MY_NFILE (16384 + MY_FILE_MIN) -#else -#define MY_NFILE 64 -#endif - -#ifndef OS_FILE_LIMIT -#define OS_FILE_LIMIT UINT_MAX -#endif - -/* - Io buffer size; Must be a power of 2 and a multiple of 512. May be - smaller what the disk page size. This influences the speed of the - isam btree library. eg to big to slow. -*/ -#define IO_SIZE 4096U -/* - How much overhead does malloc have. The code often allocates - something like 1024-MALLOC_OVERHEAD bytes -*/ -#define MALLOC_OVERHEAD 8 - - /* get memory in huncs */ -#define ONCE_ALLOC_INIT (uint) 4096 - /* Typical record cache */ -#define RECORD_CACHE_SIZE (uint) (128*1024) - /* Typical key cache */ -#define KEY_CACHE_SIZE (uint) (128L*1024L*1024L) - /* Default size of a key cache block */ -#define KEY_CACHE_BLOCK_SIZE (uint) 1024 - - /* Some things that this system doesn't have */ - -#ifdef _WIN32 -#define NO_DIR_LIBRARY /* Not standard dir-library */ -#endif - -/* Some defines of functions for portability */ - -#undef remove /* Crashes MySQL on SCO 5.0.0 */ -#ifndef __WIN__ -#define closesocket(A) close(A) -#endif - -#if defined(_MSC_VER) -#if !defined(_WIN64) -inline double my_ulonglong2double(unsigned long long value) -{ - long long nr=(long long) value; - if (nr >= 0) - return (double) nr; - return (18446744073709551616.0 + (double) nr); -} -#define ulonglong2double my_ulonglong2double -#define my_off_t2double my_ulonglong2double -#endif /* _WIN64 */ -inline unsigned long long my_double2ulonglong(double d) -{ - double t= d - (double) 0x8000000000000000ULL; - - if (t >= 0) - return ((unsigned long long) t) + 0x8000000000000000ULL; - return (unsigned long long) d; -} -#define double2ulonglong my_double2ulonglong -#endif - -#ifndef ulonglong2double -#define ulonglong2double(A) ((double) (ulonglong) (A)) -#define my_off_t2double(A) ((double) (my_off_t) (A)) -#endif -#ifndef double2ulonglong -#define double2ulonglong(A) ((ulonglong) (double) (A)) -#endif - -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif -#define ulong_to_double(X) ((double) (ulong) (X)) - -#ifndef STACK_DIRECTION -#error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS" -#endif - -#if !defined(HAVE_STRTOK_R) -#define strtok_r(A,B,C) strtok((A),(B)) -#endif - -#if SIZEOF_LONG_LONG >= 8 -#define HAVE_LONG_LONG 1 -#else -#error WHAT? sizeof(long long) < 8 ??? -#endif - -/* - Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define - ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined. -*/ - -#if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN) -#define LONGLONG_MIN ((long long) 0x8000000000000000LL) -#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL) -#endif -/* Max length needed for a buffer to hold a longlong or ulonglong + end \0 */ -#define LONGLONG_BUFFER_SIZE 21 - -#if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX) -/* First check for ANSI C99 definition: */ -#ifdef ULLONG_MAX -#define ULONGLONG_MAX ULLONG_MAX -#else -#define ULONGLONG_MAX ((unsigned long long)(~0ULL)) -#endif -#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/ - -#define INT_MIN64 (~0x7FFFFFFFFFFFFFFFLL) -#define INT_MAX64 0x7FFFFFFFFFFFFFFFLL -#define INT_MIN32 (~0x7FFFFFFFL) -#define INT_MAX32 0x7FFFFFFFL -#define UINT_MAX32 0xFFFFFFFFL -#define INT_MIN24 (~0x007FFFFF) -#define INT_MAX24 0x007FFFFF -#define UINT_MAX24 0x00FFFFFF -#define INT_MIN16 (~0x7FFF) -#define INT_MAX16 0x7FFF -#define UINT_MAX16 0xFFFF -#define INT_MIN8 (~0x7F) -#define INT_MAX8 0x7F -#define UINT_MAX8 0xFF - -/* From limits.h instead */ -#ifndef DBL_MIN -#define DBL_MIN 4.94065645841246544e-324 -#define FLT_MIN ((float)1.40129846432481707e-45) -#endif -#ifndef DBL_MAX -#define DBL_MAX 1.79769313486231470e+308 -#define FLT_MAX ((float)3.40282346638528860e+38) -#endif -#ifndef SIZE_T_MAX -#define SIZE_T_MAX (~((size_t) 0)) -#endif - -/* Define missing math constants. */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#ifndef M_E -#define M_E 2.7182818284590452354 -#endif -#ifndef M_LN2 -#define M_LN2 0.69314718055994530942 -#endif - -/* - Max size that must be added to a so that we know Size to make - addressable obj. -*/ -#if SIZEOF_CHARP == 4 -typedef long my_ptrdiff_t; -#else -typedef long long my_ptrdiff_t; -#endif - -#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1)) -#define MY_ALIGN_DOWN(A,L) ((A) & ~((L) - 1)) -#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double)) -#define ALIGN_MAX_UNIT (sizeof(double)) -/* Size to make addressable obj. */ -#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A), sizeof(double))) -#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) -#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) -#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1)) - -/* - Custom version of standard offsetof() macro which can be used to get - offsets of members in class for non-POD types (according to the current - version of C++ standard offsetof() macro can't be used in such cases and - attempt to do so causes warnings to be emitted, OTOH in many cases it is - still OK to assume that all instances of the class has the same offsets - for the same members). - - This is temporary solution which should be removed once File_parser class - and related routines are refactored. -*/ - -#define my_offsetof(TYPE, MEMBER) PTR_BYTE_DIFF(&((TYPE *)0x10)->MEMBER, 0x10) - -#define NullS (char *) 0 - -#ifdef STDCALL -#undef STDCALL -#endif - -#ifdef _WIN32 -#define STDCALL __stdcall -#else -#define STDCALL -#endif - -/* Typdefs for easyier portability */ - -#ifndef HAVE_UCHAR -typedef unsigned char uchar; /* Short for unsigned char */ -#endif - -#ifndef HAVE_INT8 -typedef signed char int8; /* Signed integer >= 8 bits */ -#endif -#ifndef HAVE_UINT8 -typedef unsigned char uint8; /* Unsigned integer >= 8 bits */ -#endif -#ifndef HAVE_INT16 -typedef short int16; -#endif -#ifndef HAVE_UINT16 -typedef unsigned short uint16; -#endif -#if SIZEOF_INT == 4 -#ifndef HAVE_INT32 -typedef int int32; -#endif -#ifndef HAVE_UINT32 -typedef unsigned int uint32; -#endif -#elif SIZEOF_LONG == 4 -#ifndef HAVE_INT32 -typedef long int32; -#endif -#ifndef HAVE_UINT32 -typedef unsigned long uint32; -#endif -#else -#error Neither int or long is of 4 bytes width -#endif - -#if !defined(HAVE_ULONG) && !defined(__USE_MISC) -typedef unsigned long ulong; /* Short for unsigned long */ -#endif -#ifndef longlong_defined -/* - Using [unsigned] long long is preferable as [u]longlong because we use - [unsigned] long long unconditionally in many places, - for example in constants with [U]LL suffix. -*/ -#if defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8 -typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ -typedef long long int longlong; -#else -typedef unsigned long ulonglong; /* ulong or unsigned long long */ -typedef long longlong; -#endif -#endif -#ifndef HAVE_INT64 -typedef longlong int64; -#endif -#ifndef HAVE_UINT64 -typedef ulonglong uint64; -#endif - -#if defined(NO_CLIENT_LONG_LONG) -typedef unsigned long my_ulonglong; -#elif defined (__WIN__) -typedef unsigned __int64 my_ulonglong; -#else -typedef unsigned long long my_ulonglong; -#endif - -#if SIZEOF_CHARP == SIZEOF_INT -typedef unsigned int intptr; -#elif SIZEOF_CHARP == SIZEOF_LONG -typedef unsigned long intptr; -#elif SIZEOF_CHARP == SIZEOF_LONG_LONG -typedef unsigned long long intptr; -#else -#error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(long long) -#endif - -#define MY_ERRPTR ((void*)(intptr)1) - -#if defined(_WIN32) -typedef unsigned long long my_off_t; -typedef unsigned long long os_off_t; -#else -typedef off_t os_off_t; -#if SIZEOF_OFF_T > 4 -typedef ulonglong my_off_t; -#else -typedef unsigned long my_off_t; -#endif -#endif /*_WIN32*/ -#define MY_FILEPOS_ERROR (~(my_off_t) 0) - -/* - TODO Convert these to use Bitmap class. - */ -typedef ulonglong table_map; /* Used for table bits in join */ - -/* often used type names - opaque declarations */ -typedef const struct charset_info_st CHARSET_INFO; -typedef struct st_mysql_lex_string LEX_STRING; - -#if defined(__WIN__) -#define socket_errno WSAGetLastError() -#define SOCKET_EINTR WSAEINTR -#define SOCKET_ETIMEDOUT WSAETIMEDOUT -#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK -#define SOCKET_EADDRINUSE WSAEADDRINUSE -#define SOCKET_ECONNRESET WSAECONNRESET -#define SOCKET_ENFILE ENFILE -#define SOCKET_EMFILE EMFILE -#else /* Unix */ -#define socket_errno errno -#define closesocket(A) close(A) -#define SOCKET_EINTR EINTR -#define SOCKET_EAGAIN EAGAIN -#define SOCKET_EWOULDBLOCK EWOULDBLOCK -#define SOCKET_EADDRINUSE EADDRINUSE -#define SOCKET_ETIMEDOUT ETIMEDOUT -#define SOCKET_ECONNRESET ECONNRESET -#define SOCKET_ENFILE ENFILE -#define SOCKET_EMFILE EMFILE -#endif - -#include /* my_bool */ - -typedef ulong myf; /* Type of MyFlags in my_funcs */ - -#define MYF(v) (myf) (v) - -/* - Defines to make it possible to prioritize register assignments. No - longer that important with modern compilers. -*/ -#ifndef USING_X -#define reg1 register -#define reg2 register -#define reg3 register -#define reg4 register -#define reg5 register -#define reg6 register -#define reg7 register -#define reg8 register -#define reg9 register -#define reg10 register -#define reg11 register -#define reg12 register -#define reg13 register -#define reg14 register -#define reg15 register -#define reg16 register -#endif - -/* - MYSQL_PLUGIN_IMPORT macro is used to export mysqld data - (i.e variables) for usage in storage engine loadable plugins. - Outside of Windows, it is dummy. -*/ -#ifndef MYSQL_PLUGIN_IMPORT -#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN)) -#define MYSQL_PLUGIN_IMPORT __declspec(dllimport) -#else -#define MYSQL_PLUGIN_IMPORT -#endif -#endif - -#include - -/* Some helper macros */ -#define YESNO(X) ((X) ? "yes" : "no") - -#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */ -#define MY_HOW_OFTEN_TO_WRITE 10000 /* How often we want info on screen */ - -#include - -#ifdef HAVE_CHARSET_utf8mb4 -#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8mb4" -#elif defined(HAVE_CHARSET_utf8mb3) -#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8mb3" -#else -#define MYSQL_UNIVERSAL_CLIENT_CHARSET MYSQL_DEFAULT_CHARSET_NAME -#endif - -#if defined(EMBEDDED_LIBRARY) && !defined(HAVE_EMBEDDED_PRIVILEGE_CONTROL) -#define NO_EMBEDDED_ACCESS_CHECKS -#endif - -#ifdef _WIN32 -#define dlsym(lib, name) (void*)GetProcAddress((HMODULE)lib, name) -#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0) -#define RTLD_DEFAULT GetModuleHandle(NULL) -#define dlclose(lib) FreeLibrary((HMODULE)lib) -static inline char *dlerror(void) -{ - static char win_errormsg[2048]; - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, - 0, GetLastError(), 0, win_errormsg, 2048, NULL); - return win_errormsg; -} -#define HAVE_DLOPEN 1 -#define HAVE_DLERROR 1 -#endif - -#ifdef HAVE_DLFCN_H -#include -#endif - -#ifdef HAVE_DLOPEN -#ifndef HAVE_DLERROR -#define dlerror() "" -#endif -#ifndef HAVE_DLADDR -#define dladdr(A, B) 0 -/* Dummy definition in case we're missing dladdr() */ -typedef struct { const char *dli_fname, dli_fbase; } Dl_info; -#endif -#else -#define dlerror() "No support for dynamic loading (static build?)" -#define dlopen(A,B) 0 -#define dlsym(A,B) 0 -#define dlclose(A) 0 -#define dladdr(A, B) 0 -/* Dummy definition in case we're missing dladdr() */ -typedef struct { const char *dli_fname, dli_fbase; } Dl_info; -#endif - -/* - * Include standard definitions of operator new and delete. - */ -#ifdef __cplusplus -#include -#endif - -/* Length of decimal number represented by INT32. */ -#define MY_INT32_NUM_DECIMAL_DIGITS 11 - -/* Length of decimal number represented by INT64. */ -#define MY_INT64_NUM_DECIMAL_DIGITS 21 - -#ifdef __cplusplus -#include /* should be included before min/max macros */ -#endif - -/* Define some useful general macros (should be done after all headers). */ -#define MY_MAX(a, b) ((a) > (b) ? (a) : (b)) -#define MY_MIN(a, b) ((a) < (b) ? (a) : (b)) - -#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) - -/* - Only Linux is known to need an explicit sync of the directory to make sure a - file creation/deletion/renaming in(from,to) this directory durable. -*/ -#ifdef TARGET_OS_LINUX -#define NEED_EXPLICIT_SYNC_DIR 1 -#else -/* - On linux default rwlock scheduling policy is good enough for - waiting_threads.c, on other systems use our special implementation - (which is slower). - - QQ perhaps this should be tested in configure ? how ? -*/ -#define WT_RWLOCKS_USE_MUTEXES 1 -#endif - -#if !defined(__cplusplus) && !defined(bool) -#define bool In_C_you_should_use_my_bool_instead() -#endif - -/* Provide __func__ macro definition for platforms that miss it. */ -#if !defined (__func__) -#if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L -# if __GNUC__ >= 2 -# define __func__ __FUNCTION__ -# else -# define __func__ "" -# endif -#elif defined(_MSC_VER) -# if _MSC_VER < 1300 -# define __func__ "" -# else -# define __func__ __FUNCTION__ -# endif -#elif defined(__BORLANDC__) -# define __func__ __FUNC__ -#else -# define __func__ "" -#endif -#endif /* !defined(__func__) */ - -/* Defines that are unique to the embedded version of MySQL */ - -#ifdef EMBEDDED_LIBRARY - -/* Things we don't need in the embedded version of MySQL */ -/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ - -#else -#define HAVE_REPLICATION -#define HAVE_EXTERNAL_CLIENT -#endif /* EMBEDDED_LIBRARY */ - -/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */ -#if defined(_AIX) && defined(_LARGE_FILE_API) -#undef _LARGE_FILE_API -#undef __GNUG__ -#endif - -/* - Provide defaults for the CPU cache line size, if it has not been detected by - CMake using getconf -*/ -#if !defined(CPU_LEVEL1_DCACHE_LINESIZE) || CPU_LEVEL1_DCACHE_LINESIZE == 0 - #if defined(CPU_LEVEL1_DCACHE_LINESIZE) && CPU_LEVEL1_DCACHE_LINESIZE == 0 - #undef CPU_LEVEL1_DCACHE_LINESIZE - #endif - - #if defined(__s390__) - #define CPU_LEVEL1_DCACHE_LINESIZE 256 - #elif defined(__powerpc__) || defined(__aarch64__) - #define CPU_LEVEL1_DCACHE_LINESIZE 128 - #else - #define CPU_LEVEL1_DCACHE_LINESIZE 64 - #endif -#endif - -#define FLOATING_POINT_DECIMALS 31 - -/* Keep client compatible with earlier versions */ -#ifdef MYSQL_SERVER -#define NOT_FIXED_DEC DECIMAL_NOT_SPECIFIED -#else -#define NOT_FIXED_DEC FLOATING_POINT_DECIMALS -#endif -#endif /* my_global_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_list.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_list.h deleted file mode 100644 index 0bb785b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_list.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _list_h_ -#define _list_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct st_list { - struct st_list *prev,*next; - void *data; -} LIST; - -typedef int (*list_walk_action)(void *,void *); - -extern LIST *list_add(LIST *root,LIST *element); -extern LIST *list_delete(LIST *root,LIST *element); -extern LIST *list_cons(void *data,LIST *root); -extern LIST *list_reverse(LIST *root); -extern void list_free(LIST *root,unsigned int free_data); -extern unsigned int list_length(LIST *); -extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); - -#define list_rest(a) ((a)->next) -#define list_push(a,b) (a)=list_cons((b),(a)) -#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); } - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_net.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_net.h deleted file mode 100644 index 9a4f2f4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_net.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - This file is also used to make handling of sockets and ioctl() - portable across systems. - -*/ - -#ifndef _my_net_h -#define _my_net_h - -C_MODE_START - -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#if defined(HAVE_POLL_H) -#include -#elif defined(HAVE_SYS_POLL_H) -#include -#endif /* defined(HAVE_POLL_H) */ -#ifdef HAVE_SYS_IOCTL_H -#include -#endif - -#if !defined(__WIN__) -#include -#include -#include -#if !defined(alpha_linux_port) -#include -#endif -#endif - -#if defined(__WIN__) -#define O_NONBLOCK 1 /* For emulation of fcntl() */ - -/* - SHUT_RDWR is called SD_BOTH in windows and - is defined to 2 in winsock2.h - #define SD_BOTH 0x02 -*/ -#define SHUT_RDWR 0x02 -#else -#include /* getaddrinfo() & co */ -#endif - -/* - On OSes which don't have the in_addr_t, we guess that using uint32 - is the best possible choice. We guess this from the fact that on - HP-UX64bit & FreeBSD64bit & Solaris64bit, in_addr_t is equivalent to - uint32. And on Linux32bit too. -*/ -#ifndef HAVE_IN_ADDR_T -#define in_addr_t uint32 -#endif - - -C_MODE_END -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_pthread.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_pthread.h deleted file mode 100644 index 6687603..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_pthread.h +++ /dev/null @@ -1,809 +0,0 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Defines to make different thread packages compatible */ - -#ifndef _my_pthread_h -#define _my_pthread_h - -#ifndef ETIME -#define ETIME ETIMEDOUT /* For FreeBSD */ -#endif - -#ifdef __cplusplus -#define EXTERNC extern "C" -extern "C" { -#else -#define EXTERNC -#endif /* __cplusplus */ - -#if defined(__WIN__) -typedef CRITICAL_SECTION pthread_mutex_t; -typedef DWORD pthread_t; -typedef struct thread_attr { - DWORD dwStackSize ; - DWORD dwCreatingFlag ; -} pthread_attr_t ; - -typedef struct { int dummy; } pthread_condattr_t; - -/* Implementation of posix conditions */ - -typedef struct st_pthread_link { - DWORD thread_id; - struct st_pthread_link *next; -} pthread_link; - -/** - Implementation of Windows condition variables. - We use native conditions on Vista and later, and fallback to own - implementation on earlier OS version. -*/ -typedef CONDITION_VARIABLE pthread_cond_t; - - -typedef int pthread_mutexattr_t; -#define pthread_self() GetCurrentThreadId() -#define pthread_handler_t EXTERNC void * __cdecl -typedef void * (__cdecl *pthread_handler)(void *); - -typedef INIT_ONCE my_pthread_once_t; -#define MY_PTHREAD_ONCE_INIT INIT_ONCE_STATIC_INIT; - -#if !STRUCT_TIMESPEC_HAS_TV_SEC || !STRUCT_TIMESPEC_HAS_TV_NSEC -struct timespec { - time_t tv_sec; - long tv_nsec; -}; -#endif - -int win_pthread_mutex_trylock(pthread_mutex_t *mutex); -int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *); -int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr); -int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); -int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime); -int pthread_cond_signal(pthread_cond_t *cond); -int pthread_cond_broadcast(pthread_cond_t *cond); -int pthread_cond_destroy(pthread_cond_t *cond); -int pthread_attr_init(pthread_attr_t *connect_att); -int pthread_attr_setstacksize(pthread_attr_t *connect_att,size_t stack); -int pthread_attr_destroy(pthread_attr_t *connect_att); -int my_pthread_once(my_pthread_once_t *once_control,void (*init_routine)(void)); - -static inline struct tm *localtime_r(const time_t *timep, struct tm *tmp) -{ - localtime_s(tmp, timep); - return tmp; -} - -static inline struct tm *gmtime_r(const time_t *clock, struct tm *res) -{ - gmtime_s(res, clock); - return res; -} - -void pthread_exit(void *a); -int pthread_join(pthread_t thread, void **value_ptr); -int pthread_cancel(pthread_t thread); - -#ifndef ETIMEDOUT -#define ETIMEDOUT 145 /* Win32 doesn't have this */ -#endif - -#define getpid() GetCurrentThreadId() -#define HAVE_LOCALTIME_R 1 -#define _REENTRANT 1 -#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 - -#undef SAFE_MUTEX /* This will cause conflicts */ -#define pthread_key(T,V) DWORD V -#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF) -#define pthread_key_delete(A) TlsFree(A) -#define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V))) -#define pthread_setspecific(A,B) (!TlsSetValue((A),(LPVOID)(B))) -#define pthread_getspecific(A) (TlsGetValue(A)) -#define my_pthread_getspecific(T,A) ((T) TlsGetValue(A)) -#define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V)) - -#define pthread_equal(A,B) ((A) == (B)) -#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0) -#define pthread_mutex_lock(A) (EnterCriticalSection(A),0) -#define pthread_mutex_trylock(A) win_pthread_mutex_trylock((A)) -#define pthread_mutex_unlock(A) (LeaveCriticalSection(A), 0) -#define pthread_mutex_destroy(A) (DeleteCriticalSection(A), 0) -#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) - - -/* Dummy defines for easier code */ -#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) -#define pthread_attr_setscope(A,B) -#define pthread_detach_this_thread() -#define pthread_condattr_init(A) -#define pthread_condattr_destroy(A) -#define pthread_yield() SwitchToThread() -#define my_sigset(A,B) signal(A,B) - -#else /* Normal threads */ - -#ifdef HAVE_rts_threads -#define sigwait org_sigwait -#include -#undef sigwait -#endif -#include -#ifndef _REENTRANT -#define _REENTRANT -#endif -#ifdef HAVE_THR_SETCONCURRENCY -#include /* Probably solaris */ -#endif -#ifdef HAVE_SCHED_H -#include -#endif -#ifdef HAVE_SYNCH_H -#include -#endif - -#define pthread_key(T,V) pthread_key_t V -#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V)) -#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) -#define pthread_detach_this_thread() -#define pthread_handler_t EXTERNC void * -typedef void *(* pthread_handler)(void *); - -#define my_pthread_once_t pthread_once_t -#if defined(PTHREAD_ONCE_INITIALIZER) -#define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INITIALIZER -#else -#define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT -#endif -#define my_pthread_once(C,F) pthread_once(C,F) - -/* Test first for RTS or FSU threads */ - -#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) -#define HAVE_rts_threads -extern int my_pthread_create_detached; -#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) -#define PTHREAD_CREATE_DETACHED &my_pthread_create_detached -#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL -#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL -#define USE_ALARM_THREAD -#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */ - -#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199910 -int sigwait(sigset_t *set, int *sig); -#endif - -static inline int my_sigwait(sigset_t *set, int *sig, int *code) -{ -#ifdef HAVE_SIGWAITINFO - siginfo_t siginfo; - *sig= sigwaitinfo(set, &siginfo); - *code= siginfo.si_code; - return *sig < 0 ? errno : 0; -#else -#define SI_KERNEL 128 - *code= 0; - return sigwait(set, sig); -#endif -} - -#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK) -#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C)) -#endif - -#if !defined(HAVE_SIGWAIT) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(_AIX) -int sigwait(sigset_t *setp, int *sigp); /* Use our implementation */ -#endif - - -/* - We define my_sigset() and use that instead of the system sigset() so that - we can favor an implementation based on sigaction(). On some systems, such - as Mac OS X, sigset() results in flags such as SA_RESTART being set, and - we want to make sure that no such flags are set. -*/ -#if defined(HAVE_SIGACTION) && !defined(my_sigset) -#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; \ - DBUG_ASSERT((A) != 0); \ - sigemptyset(&l_set); \ - l_s.sa_handler = (B); \ - l_s.sa_mask = l_set; \ - l_s.sa_flags = 0; \ - sigaction((A), &l_s, NULL); \ - } while (0) -#elif defined(HAVE_SIGSET) && !defined(my_sigset) -#define my_sigset(A,B) sigset((A),(B)) -#elif !defined(my_sigset) -#define my_sigset(A,B) signal((A),(B)) -#endif - -#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) -#define pthread_attr_setscope(A,B) -#undef HAVE_GETHOSTBYADDR_R /* No definition */ -#endif - -#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B)) - -#ifndef HAVE_LOCALTIME_R -struct tm *localtime_r(const time_t *clock, struct tm *res); -#endif - -#ifndef HAVE_GMTIME_R -struct tm *gmtime_r(const time_t *clock, struct tm *res); -#endif - -#ifdef HAVE_PTHREAD_CONDATTR_CREATE -/* DCE threads on HPUX 10.20 */ -#define pthread_condattr_init pthread_condattr_create -#define pthread_condattr_destroy pthread_condattr_delete -#endif - -/* FSU THREADS */ -#if !defined(HAVE_PTHREAD_KEY_DELETE) && !defined(pthread_key_delete) -#define pthread_key_delete(A) pthread_dummy(0) -#endif - -#if defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT) -/* This is set on AIX_3_2 and Siemens unix (and DEC OSF/1 3.2 too) */ -#define pthread_key_create(A,B) \ - pthread_keycreate(A,(B) ?\ - (pthread_destructor_t) (B) :\ - (pthread_destructor_t) pthread_dummy) -#define pthread_attr_init(A) pthread_attr_create(A) -#define pthread_attr_destroy(A) pthread_attr_delete(A) -#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) -#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D)) -#ifndef pthread_sigmask -#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) -#endif -#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) -#undef pthread_detach_this_thread -#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } -#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ -#define HAVE_PTHREAD_KILL 1 -#endif - -#endif /* defined(__WIN__) */ - -#if defined(HPUX10) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) -#undef pthread_cond_timedwait -#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c)) -int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - struct timespec *abstime); -#endif - -#if defined(HPUX10) -#define pthread_attr_getstacksize(A,B) my_pthread_attr_getstacksize(A,B) -void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size); -#endif - -#if defined(HAVE_POSIX1003_4a_MUTEX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) -#undef pthread_mutex_trylock -#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a)) -int my_pthread_mutex_trylock(pthread_mutex_t *mutex); -#endif - -#if !defined(HAVE_PTHREAD_YIELD_ZERO_ARG) -/* no pthread_yield() available */ -#ifdef HAVE_SCHED_YIELD -#define pthread_yield() sched_yield() -#elif defined(HAVE_PTHREAD_YIELD_NP) /* can be Mac OS X */ -#define pthread_yield() pthread_yield_np() -#elif defined(HAVE_THR_YIELD) -#define pthread_yield() thr_yield() -#endif -#endif - -size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize); - -/* - The defines set_timespec and set_timespec_nsec should be used - for calculating an absolute time at which - pthread_cond_timedwait should timeout -*/ -#define set_timespec(ABSTIME,SEC) set_timespec_nsec((ABSTIME),(SEC)*1000000000ULL) - -#ifndef set_timespec_nsec -#define set_timespec_nsec(ABSTIME,NSEC) \ - set_timespec_time_nsec((ABSTIME), my_hrtime_coarse().val*1000 + (NSEC)) -#endif /* !set_timespec_nsec */ - -/* adapt for two different flavors of struct timespec */ -#ifdef HAVE_TIMESPEC_TS_SEC -#define MY_tv_sec ts_sec -#define MY_tv_nsec ts_nsec -#else -#define MY_tv_sec tv_sec -#define MY_tv_nsec tv_nsec -#endif /* HAVE_TIMESPEC_TS_SEC */ - -/** - Compare two timespec structs. - - @retval 1 If TS1 ends after TS2. - - @retval 0 If TS1 is equal to TS2. - - @retval -1 If TS1 ends before TS2. -*/ -#ifndef cmp_timespec -#define cmp_timespec(TS1, TS2) \ - ((TS1.MY_tv_sec > TS2.MY_tv_sec || \ - (TS1.MY_tv_sec == TS2.MY_tv_sec && TS1.MY_tv_nsec > TS2.MY_tv_nsec)) ? 1 : \ - ((TS1.MY_tv_sec < TS2.MY_tv_sec || \ - (TS1.MY_tv_sec == TS2.MY_tv_sec && TS1.MY_tv_nsec < TS2.MY_tv_nsec)) ? -1 : 0)) -#endif /* !cmp_timespec */ - -#ifndef set_timespec_time_nsec -#define set_timespec_time_nsec(ABSTIME,NSEC) do { \ - ulonglong _now_= (NSEC); \ - (ABSTIME).MY_tv_sec= (time_t) (_now_ / 1000000000ULL); \ - (ABSTIME).MY_tv_nsec= (ulong) (_now_ % 1000000000UL); \ -} while(0) -#endif /* !set_timespec_time_nsec */ - -#ifdef MYSQL_CLIENT -#define _current_thd() NULL -#else -MYSQL_THD _current_thd(); -#endif - -/* safe_mutex adds checking to mutex for easier debugging */ -struct st_hash; -typedef struct st_safe_mutex_t -{ - pthread_mutex_t global,mutex; - const char *file, *name; - uint line,count; - myf create_flags, active_flags; - ulong id; - pthread_t thread; - struct st_hash *locked_mutex, *used_mutex; - struct st_safe_mutex_t *prev, *next; -#ifdef SAFE_MUTEX_DETECT_DESTROY - struct st_safe_mutex_info_t *info; /* to track destroying of mutexes */ -#endif -} safe_mutex_t; - -typedef struct st_safe_mutex_deadlock_t -{ - const char *file, *name; - safe_mutex_t *mutex; - uint line; - ulong count; - ulong id; - my_bool warning_only; -} safe_mutex_deadlock_t; - -#ifdef SAFE_MUTEX_DETECT_DESTROY -/* - Used to track the destroying of mutexes. This needs to be a separate - structure because the safe_mutex_t structure could be freed before - the mutexes are destroyed. -*/ - -typedef struct st_safe_mutex_info_t -{ - struct st_safe_mutex_info_t *next; - struct st_safe_mutex_info_t *prev; - const char *init_file; - uint32 init_line; -} safe_mutex_info_t; -#endif /* SAFE_MUTEX_DETECT_DESTROY */ - -int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr, - const char *name, const char *file, uint line); -int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file, - uint line); -int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line); -int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line); -int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file, - uint line); -int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, - const struct timespec *abstime, - const char *file, uint line); -void safe_mutex_global_init(void); -void safe_mutex_end(FILE *file); -void safe_mutex_free_deadlock_data(safe_mutex_t *mp); - - /* Wrappers if safe mutex is actually used */ -#define MYF_TRY_LOCK 1 -#define MYF_NO_DEADLOCK_DETECTION 2 - -#ifdef SAFE_MUTEX -#define safe_mutex_is_owner(mp) ((mp)->count > 0 && \ - pthread_equal(pthread_self(), (mp)->thread)) -#define safe_mutex_assert_owner(mp) DBUG_ASSERT(safe_mutex_is_owner(mp)) -#define safe_mutex_assert_not_owner(mp) DBUG_ASSERT(!safe_mutex_is_owner(mp)) -#define safe_mutex_setflags(mp, F) do { (mp)->create_flags|= (F); } while (0) -#define my_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__) -#define my_cond_wait(A,B) safe_cond_wait((A), (B), __FILE__, __LINE__) -#else - -#define safe_mutex_assert_owner(mp) do {} while (0) -#define safe_mutex_assert_not_owner(mp) do {} while (0) -#define safe_mutex_setflags(mp, F) do {} while (0) - -#define my_cond_timedwait(A,B,C) pthread_cond_timedwait((A),(B),(C)) -#define my_cond_wait(A,B) pthread_cond_wait((A), (B)) -#endif /* !SAFE_MUTEX */ - - /* READ-WRITE thread locking */ - -#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS) -/* use these defs for simple mutex locking */ -#define rw_lock_t pthread_mutex_t -#define my_rwlock_init(A,B) pthread_mutex_init((A),(B)) -#define rw_rdlock(A) pthread_mutex_lock((A)) -#define rw_wrlock(A) pthread_mutex_lock((A)) -#define rw_tryrdlock(A) pthread_mutex_trylock((A)) -#define rw_trywrlock(A) pthread_mutex_trylock((A)) -#define rw_unlock(A) pthread_mutex_unlock((A)) -#define rwlock_destroy(A) pthread_mutex_destroy((A)) -#elif defined(HAVE_PTHREAD_RWLOCK_RDLOCK) -#define rw_lock_t pthread_rwlock_t -#define my_rwlock_init(A,B) pthread_rwlock_init((A),(B)) -#define rw_rdlock(A) pthread_rwlock_rdlock(A) -#define rw_wrlock(A) pthread_rwlock_wrlock(A) -#define rw_tryrdlock(A) pthread_rwlock_tryrdlock((A)) -#define rw_trywrlock(A) pthread_rwlock_trywrlock((A)) -#define rw_unlock(A) pthread_rwlock_unlock(A) -#define rwlock_destroy(A) pthread_rwlock_destroy(A) -#elif defined(HAVE_RWLOCK_INIT) -#ifdef HAVE_RWLOCK_T /* For example Solaris 2.6-> */ -#define rw_lock_t rwlock_t -#endif -#define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0) -#else -/* Use our own version of read/write locks */ -#define NEED_MY_RW_LOCK 1 -#define rw_lock_t my_rw_lock_t -#define my_rwlock_init(A,B) my_rw_init((A)) -#define rw_rdlock(A) my_rw_rdlock((A)) -#define rw_wrlock(A) my_rw_wrlock((A)) -#define rw_tryrdlock(A) my_rw_tryrdlock((A)) -#define rw_trywrlock(A) my_rw_trywrlock((A)) -#define rw_unlock(A) my_rw_unlock((A)) -#define rwlock_destroy(A) my_rw_destroy((A)) -#define rw_lock_assert_write_owner(A) my_rw_lock_assert_write_owner((A)) -#define rw_lock_assert_not_write_owner(A) my_rw_lock_assert_not_write_owner((A)) -#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */ - - -/** - Portable implementation of special type of read-write locks. - - These locks have two properties which are unusual for rwlocks: - 1) They "prefer readers" in the sense that they do not allow - situations in which rwlock is rd-locked and there is a - pending rd-lock which is blocked (e.g. due to pending - request for wr-lock). - This is a stronger guarantee than one which is provided for - PTHREAD_RWLOCK_PREFER_READER_NP rwlocks in Linux. - MDL subsystem deadlock detector relies on this property for - its correctness. - 2) They are optimized for uncontended wr-lock/unlock case. - This is a scenario in which they are most often used - within MDL subsystem. Optimizing for it gives significant - performance improvements in some of the tests involving many - connections. - - Another important requirement imposed on this type of rwlock - by the MDL subsystem is that it should be OK to destroy rwlock - object which is in unlocked state even though some threads might - have not yet fully left unlock operation for it (of course there - is an external guarantee that no thread will try to lock rwlock - which is destroyed). - Putting it another way the unlock operation should not access - rwlock data after changing its state to unlocked. - - TODO/FIXME: We should consider alleviating this requirement as - it blocks us from doing certain performance optimizations. -*/ - -typedef struct st_rw_pr_lock_t { - /** - Lock which protects the structure. - Also held for the duration of wr-lock. - */ - pthread_mutex_t lock; - /** - Condition variable which is used to wake-up - writers waiting for readers to go away. - */ - pthread_cond_t no_active_readers; - /** Number of active readers. */ - uint active_readers; - /** Number of writers waiting for readers to go away. */ - uint writers_waiting_readers; - /** Indicates whether there is an active writer. */ - my_bool active_writer; -#ifdef SAFE_MUTEX - /** Thread holding wr-lock (for debug purposes only). */ - pthread_t writer_thread; -#endif -} rw_pr_lock_t; - -extern int rw_pr_init(rw_pr_lock_t *); -extern int rw_pr_rdlock(rw_pr_lock_t *); -extern int rw_pr_wrlock(rw_pr_lock_t *); -extern int rw_pr_unlock(rw_pr_lock_t *); -extern int rw_pr_destroy(rw_pr_lock_t *); -#ifdef SAFE_MUTEX -#define rw_pr_lock_assert_write_owner(A) \ - DBUG_ASSERT((A)->active_writer && pthread_equal(pthread_self(), \ - (A)->writer_thread)) -#define rw_pr_lock_assert_not_write_owner(A) \ - DBUG_ASSERT(! (A)->active_writer || ! pthread_equal(pthread_self(), \ - (A)->writer_thread)) -#else -#define rw_pr_lock_assert_write_owner(A) -#define rw_pr_lock_assert_not_write_owner(A) -#endif /* SAFE_MUTEX */ - - -#ifdef NEED_MY_RW_LOCK - -#ifdef _WIN32 - -/** - Implementation of Windows rwlock. - - We use native (slim) rwlocks on Windows, which requires Win7 - or later. -*/ -typedef struct _my_rwlock_t -{ - SRWLOCK srwlock; /* native reader writer lock */ - BOOL have_exclusive_srwlock; /* used for unlock */ -} my_rw_lock_t; - - -#else /* _WIN32 */ - -/* - On systems which don't support native read/write locks we have - to use own implementation. -*/ -typedef struct st_my_rw_lock_t { - pthread_mutex_t lock; /* lock for structure */ - pthread_cond_t readers; /* waiting readers */ - pthread_cond_t writers; /* waiting writers */ - int state; /* -1:writer,0:free,>0:readers */ - int waiters; /* number of waiting writers */ -#ifdef SAFE_MUTEX - pthread_t write_thread; -#endif -} my_rw_lock_t; - -#endif /*! _WIN32 */ - -extern int my_rw_init(my_rw_lock_t *); -extern int my_rw_destroy(my_rw_lock_t *); -extern int my_rw_rdlock(my_rw_lock_t *); -extern int my_rw_wrlock(my_rw_lock_t *); -extern int my_rw_unlock(my_rw_lock_t *); -extern int my_rw_tryrdlock(my_rw_lock_t *); -extern int my_rw_trywrlock(my_rw_lock_t *); -#ifdef SAFE_MUTEX -#define my_rw_lock_assert_write_owner(A) \ - DBUG_ASSERT((A)->state == -1 && pthread_equal(pthread_self(), \ - (A)->write_thread)) -#define my_rw_lock_assert_not_write_owner(A) \ - DBUG_ASSERT((A)->state >= 0 || ! pthread_equal(pthread_self(), \ - (A)->write_thread)) -#else -#define my_rw_lock_assert_write_owner(A) -#define my_rw_lock_assert_not_write_owner(A) -#endif -#endif /* NEED_MY_RW_LOCK */ - - -#define GETHOSTBYADDR_BUFF_SIZE 2048 - -#ifndef HAVE_THR_SETCONCURRENCY -#define thr_setconcurrency(A) pthread_dummy(0) -#endif -#if !defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && ! defined(pthread_attr_setstacksize) -#define pthread_attr_setstacksize(A,B) pthread_dummy(0) -#endif - -/* Define mutex types, see my_thr_init.c */ -#define MY_MUTEX_INIT_SLOW NULL -#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP -extern pthread_mutexattr_t my_fast_mutexattr; -#define MY_MUTEX_INIT_FAST &my_fast_mutexattr -#else -#define MY_MUTEX_INIT_FAST NULL -#endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP -extern pthread_mutexattr_t my_errorcheck_mutexattr; -#define MY_MUTEX_INIT_ERRCHK &my_errorcheck_mutexattr -#else -#define MY_MUTEX_INIT_ERRCHK NULL -#endif - -#ifndef ESRCH -/* Define it to something */ -#define ESRCH 1 -#endif - -typedef uint64 my_thread_id; - -extern void my_threadattr_global_init(void); -extern my_bool my_thread_global_init(void); -extern void my_thread_global_reinit(void); -extern void my_thread_global_end(void); -extern my_bool my_thread_init(void); -extern void my_thread_end(void); -extern const char *my_thread_name(void); -extern my_thread_id my_thread_dbug_id(void); -extern int pthread_dummy(int); -extern void my_mutex_init(void); -extern void my_mutex_end(void); - -/* All thread specific variables are in the following struct */ - -#define THREAD_NAME_SIZE 10 -#ifndef DEFAULT_THREAD_STACK -/* - We need to have at least 256K stack to handle calls to myisamchk_init() - with the current number of keys and key parts. -*/ -#if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN) -#define DEFAULT_THREAD_STACK (383*1024L) /* 392192 */ -#else -#define DEFAULT_THREAD_STACK (292*1024L) /* 299008 */ -#endif -#endif - -#define MY_PTHREAD_LOCK_READ 0 -#define MY_PTHREAD_LOCK_WRITE 1 - -#include - -#define INSTRUMENT_ME 0 - -/* - Thread specific variables - - Aria key cache is using the following variables for keeping track of - state: - suspend, next, prev, keycache_link, keycache_file, suspend, lock_type - - MariaDB uses the following to - mutex, current_mutex, current_cond, abort -*/ - -struct st_my_thread_var -{ - int thr_errno; - mysql_cond_t suspend; - mysql_mutex_t mutex; - struct st_my_thread_var *next,**prev; - mysql_mutex_t * volatile current_mutex; - mysql_cond_t * volatile current_cond; - void *keycache_link; - void *keycache_file; - void *stack_ends_here; - safe_mutex_t *mutex_in_use; - pthread_t pthread_self; - my_thread_id id, dbug_id; - int volatile abort; - uint lock_type; /* used by conditional release the queue */ - my_bool init; -#ifndef DBUG_OFF - void *dbug; - char name[THREAD_NAME_SIZE+1]; -#endif -}; - -struct st_my_thread_var *_my_thread_var(void); -extern void **my_thread_var_dbug(void); -extern safe_mutex_t **my_thread_var_mutex_in_use(void); -extern uint my_thread_end_wait_time; -extern my_bool safe_mutex_deadlock_detector; -#define my_thread_var (_my_thread_var()) -#define my_errno my_thread_var->thr_errno -int set_mysys_var(struct st_my_thread_var *mysys_var); - - -/* - thread_safe_xxx functions are for critical statistic or counters. - The implementation is guaranteed to be thread safe, on all platforms. - Note that the calling code should *not* assume the counter is protected - by the mutex given, as the implementation of these helpers may change - to use my_atomic operations instead. -*/ - -#ifndef thread_safe_increment -#ifdef _WIN32 -#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) -#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) -#else -#define thread_safe_increment(V,L) \ - (mysql_mutex_lock((L)), (V)++, mysql_mutex_unlock((L))) -#define thread_safe_decrement(V,L) \ - (mysql_mutex_lock((L)), (V)--, mysql_mutex_unlock((L))) -#endif -#endif - -#ifndef thread_safe_add -#ifdef _WIN32 -#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) -#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C)) -#else -#define thread_safe_add(V,C,L) \ - (mysql_mutex_lock((L)), (V)+=(C), mysql_mutex_unlock((L))) -#define thread_safe_sub(V,C,L) \ - (mysql_mutex_lock((L)), (V)-=(C), mysql_mutex_unlock((L))) -#endif -#endif - - -/* - statistics_xxx functions are for non critical statistic, - maintained in global variables. - When compiling with SAFE_STATISTICS: - - race conditions can not occur. - - some locking occurs, which may cause performance degradation. - - When compiling without SAFE_STATISTICS: - - race conditions can occur, making the result slightly inaccurate. - - the lock given is not honored. -*/ -#ifdef SAFE_STATISTICS -#define statistic_increment(V,L) thread_safe_increment((V),(L)) -#define statistic_decrement(V,L) thread_safe_decrement((V),(L)) -#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) -#define statistic_sub(V,C,L) thread_safe_sub((V),(C),(L)) -#else -#define statistic_decrement(V,L) (V)-- -#define statistic_increment(V,L) (V)++ -#define statistic_add(V,C,L) (V)+=(C) -#define statistic_sub(V,C,L) (V)-=(C) -#endif /* SAFE_STATISTICS */ - -/* - No locking needed, the counter is owned by the thread -*/ -#define status_var_increment(V) (V)++ -#define status_var_decrement(V) (V)-- -#define status_var_add(V,C) (V)+=(C) -#define status_var_sub(V,C) (V)-=(C) - -#ifdef SAFE_MUTEX -#define mysql_mutex_record_order(A,B) \ - do { \ - mysql_mutex_lock(A); mysql_mutex_lock(B); \ - mysql_mutex_unlock(B); mysql_mutex_unlock(A); \ - } while(0) -#else -#define mysql_mutex_record_order(A,B) do { } while(0) -#endif - -/* At least Windows and NetBSD do not have this definition */ -#ifndef PTHREAD_STACK_MIN -#define PTHREAD_STACK_MIN 65536 -#endif - -#ifdef __cplusplus -} -#endif -#endif /* _my_ptread_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_sys.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_sys.h deleted file mode 100644 index a66bfd8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_sys.h +++ /dev/null @@ -1,1089 +0,0 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_sys_h -#define _my_sys_h - -#include -#include - -C_MODE_START - - -#include -#include -#include /* for CHARSET_INFO */ -#include -#include -#ifdef _WIN32 -#include /*for alloca*/ -#endif -#include -#include - -#define MY_INIT(name) { my_progname= name; my_init(); } - -/** - Max length of an error message generated by mysys utilities. - Some mysys functions produce error messages. These mostly go - to stderr. - This constant defines the size of the buffer used to format - the message. It should be kept in sync with MYSQL_ERRMSG_SIZE, - since sometimes mysys errors are stored in the server diagnostics - area, and we would like to avoid unexpected truncation. -*/ -#define MYSYS_ERRMSG_SIZE (512) -#define MYSYS_STRERROR_SIZE (128) - -#define MY_FILE_ERROR ((size_t) -1) - - /* General bitmaps for my_func's */ -#define MY_FFNF 1U /* Fatal if file not found */ -#define MY_FNABP 2U /* Fatal if not all bytes read/written */ -#define MY_NABP 4U /* Error if not all bytes read/written */ -#define MY_FAE 8U /* Fatal if any error */ -#define MY_WME 16U /* Write message on error */ -#define MY_WAIT_IF_FULL 32U /* Wait and try again if disk full error */ -#define MY_IGNORE_BADFD 32U /* my_sync(): ignore 'bad descriptor' errors */ -#define MY_IGNORE_ENOENT 32U /* my_delete() ignores ENOENT (no such file) */ -#define MY_ENCRYPT 64U /* Encrypt IO_CACHE temporary files */ -#define MY_TEMPORARY 64U /* create_temp_file(): delete file at once */ -#define MY_NOSYMLINKS 512U /* my_open(): don't follow symlinks */ -#define MY_FULL_IO 512U /* my_read(): loop until I/O is complete */ -#define MY_DONT_CHECK_FILESIZE 128U /* Option to init_io_cache() */ -#define MY_LINK_WARNING 32U /* my_redel() gives warning if links */ -#define MY_COPYTIME 64U /* my_redel() copies time */ -#define MY_DELETE_OLD 256U /* my_create_with_symlink() */ -#define MY_RESOLVE_LINK 128U /* my_realpath(); Only resolve links */ -#define MY_HOLD_ORIGINAL_MODES 128U /* my_copy() holds to file modes */ -#define MY_REDEL_MAKE_BACKUP 256U -#define MY_SEEK_NOT_DONE 32U /* my_lock may have to do a seek */ -#define MY_SHORT_WAIT 64U /* my_lock() don't wait if can't lock */ -#define MY_FORCE_LOCK 128U /* use my_lock() even if disable_locking */ -#define MY_NO_WAIT 256U /* my_lock() don't wait at all */ -/* - init_dynamic_array() has init buffer; Internal flag, not to be used by - caller. -*/ -#define MY_INIT_BUFFER_USED 256U -#define MY_ZEROFILL 32U /* my_malloc(), fill array with zero */ -#define MY_ALLOW_ZERO_PTR 64U /* my_realloc() ; zero ptr -> malloc */ -#define MY_FREE_ON_ERROR 128U /* my_realloc() ; Free old ptr on error */ -#define MY_DONT_OVERWRITE_FILE 2048U /* my_copy: Don't overwrite file */ -#define MY_THREADSAFE 2048U /* my_seek(): lock fd mutex */ -#define MY_SYNC 4096U /* my_copy(): sync dst file */ -#define MY_SYNC_DIR 32768U /* my_create/delete/rename: sync directory */ -#define MY_SYNC_FILESIZE 65536U /* my_sync(): safe sync when file is extended */ -#define MY_THREAD_SPECIFIC 0x10000U /* my_malloc(): thread specific */ -/* Tree that should delete things automatically */ -#define MY_TREE_WITH_DELETE 0x40000U - -#define MY_CHECK_ERROR 1U /* Params to my_end; Check open-close */ -#define MY_GIVE_INFO 2U /* Give time info about process*/ -#define MY_DONT_FREE_DBUG 4U /* Do not call DBUG_END() in my_end() */ - -#define ME_BELL 4U /* Ring bell then printing message */ -#define ME_ERROR_LOG 64 /**< write the error message to error log */ -#define ME_ERROR_LOG_ONLY 128 /**< write the error message to error log only */ -#define ME_NOTE 1024 /**< not error but just info */ -#define ME_WARNING 2048 /**< not error but just warning */ -#define ME_FATAL 4096 /**< fatal statement error */ - - /* Bits in last argument to fn_format */ -#define MY_REPLACE_DIR 1U /* replace dir in name with 'dir' */ -#define MY_REPLACE_EXT 2U /* replace extension with 'ext' */ -#define MY_UNPACK_FILENAME 4U /* Unpack name (~ -> home) */ -#define MY_PACK_FILENAME 8U /* Pack name (home -> ~) */ -#define MY_RESOLVE_SYMLINKS 16U /* Resolve all symbolic links */ -#define MY_RETURN_REAL_PATH 32U /* return full path for file */ -#define MY_SAFE_PATH 64U /* Return NULL if too long path */ -#define MY_RELATIVE_PATH 128U /* name is relative to 'dir' */ -#define MY_APPEND_EXT 256U /* add 'ext' as additional extension*/ - - - /* My seek flags */ -#define MY_SEEK_SET 0 -#define MY_SEEK_CUR 1 -#define MY_SEEK_END 2 - - /* Some constants */ -#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */ -#define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */ -#define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */ -#define DFLT_INIT_HITS 3 - - /* root_alloc flags */ -#define MY_KEEP_PREALLOC 1U -#define MY_MARK_BLOCKS_FREE 2U /* move used to free list and reuse them */ - - /* Internal error numbers (for assembler functions) */ -#define MY_ERRNO_EDOM 33 -#define MY_ERRNO_ERANGE 34 - - /* Bits for get_date timeflag */ -#define GETDATE_DATE_TIME 1U -#define GETDATE_SHORT_DATE 2U -#define GETDATE_HHMMSSTIME 4U -#define GETDATE_GMT 8U -#define GETDATE_FIXEDLENGTH 16U - -/* Extra length needed for filename if one calls my_create_backup_name */ -#define MY_BACKUP_NAME_EXTRA_LENGTH 17 - -char *guess_malloc_library(); - -/* If we have our own safemalloc (for debugging) */ -#if defined(SAFEMALLOC) -void sf_report_leaked_memory(my_thread_id id); -int sf_sanity(); -extern my_thread_id (*sf_malloc_dbug_id)(void); -#define SAFEMALLOC_REPORT_MEMORY(X) sf_report_leaked_memory(X) -#else -#define SAFEMALLOC_REPORT_MEMORY(X) do {} while(0) -#endif - -typedef void (*MALLOC_SIZE_CB) (long long size, my_bool is_thread_specific); -extern void set_malloc_size_cb(MALLOC_SIZE_CB func); - - /* defines when allocating data */ -extern void *my_malloc(PSI_memory_key key, size_t size, myf MyFlags); -extern void *my_multi_malloc(PSI_memory_key key, myf MyFlags, ...); -extern void *my_multi_malloc_large(PSI_memory_key key, myf MyFlags, ...); -extern void *my_realloc(PSI_memory_key key, void *ptr, size_t size, myf MyFlags); -extern void my_free(void *ptr); -extern void *my_memdup(PSI_memory_key key, const void *from,size_t length,myf MyFlags); -extern char *my_strdup(PSI_memory_key key, const char *from,myf MyFlags); -extern char *my_strndup(PSI_memory_key key, const char *from, size_t length, myf MyFlags); - -int my_init_large_pages(my_bool super_large_pages); -uchar *my_large_malloc(size_t *size, myf my_flags); -void my_large_free(void *ptr, size_t size); - -#ifdef _WIN32 -extern BOOL my_obtain_privilege(LPCSTR lpPrivilege); -#endif - -void my_init_atomic_write(void); -#ifdef __linux__ -my_bool my_test_if_atomic_write(File handle, int pagesize); -#else -#define my_test_if_atomic_write(A, B) 0 -#endif /* __linux__ */ -extern my_bool my_may_have_atomic_write; - -#if defined(HAVE_ALLOCA) && !defined(HAVE_valgrind) -#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43) -#pragma alloca -#endif /* _AIX */ -#if defined(__MWERKS__) -#undef alloca -#define alloca _alloca -#endif /* __MWERKS__ */ -#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca) -#define alloca __builtin_alloca -#endif /* GNUC */ -#define my_alloca(SZ) alloca((size_t) (SZ)) -#define my_afree(PTR) ((void)0) -#define MAX_ALLOCA_SZ 4096 -#define my_safe_alloca(size) (((size) <= MAX_ALLOCA_SZ) ? \ - my_alloca(size) : \ - my_malloc(PSI_NOT_INSTRUMENTED, (size), MYF(MY_THREAD_SPECIFIC|MY_WME))) -#define my_safe_afree(ptr, size) \ - do { if ((size) > MAX_ALLOCA_SZ) my_free(ptr); } while(0) -#else -#define my_alloca(SZ) my_malloc(PSI_NOT_INSTRUMENTED, SZ,MYF(MY_FAE)) -#define my_afree(PTR) my_free(PTR) -#define my_safe_alloca(size) my_alloca(size) -#define my_safe_afree(ptr, size) my_afree(ptr) -#endif /* HAVE_ALLOCA */ - -#ifndef errno /* did we already get it? */ -#ifdef HAVE_ERRNO_AS_DEFINE -#include /* errno is a define */ -#else -extern int errno; /* declare errno */ -#endif -#endif /* #ifndef errno */ -extern char *home_dir; /* Home directory for user */ -extern MYSQL_PLUGIN_IMPORT char *mysql_data_home; -extern const char *my_progname; /* program-name (printed in errors) */ -extern const char *my_progname_short; /* like above but without directory */ -extern char curr_dir[]; /* Current directory for user */ -extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); -extern void (*fatal_error_handler_hook)(uint my_err, const char *str, - myf MyFlags); -extern uint my_file_limit; -extern ulonglong my_thread_stack_size; -extern int sf_leaking_memory; /* set to 1 to disable memleak detection */ - -extern void (*proc_info_hook)(void *, const PSI_stage_info *, PSI_stage_info *, - const char *, const char *, const unsigned int); - -/* charsets */ -#define MY_ALL_CHARSETS_SIZE 2048 -extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; -extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE]; -extern struct charset_info_st compiled_charsets[]; - -/* Collation properties and use statistics */ -extern my_bool my_collation_is_known_id(uint id); -extern ulonglong my_collation_statistics_get_use_count(uint id); -extern const char *my_collation_get_tailoring(uint id); - -/* statistics */ -extern ulong my_stream_opened, my_tmp_file_created; -extern ulong my_file_total_opened; -extern ulong my_sync_count; -extern uint mysys_usage_id; -extern int32 my_file_opened; -extern my_bool my_init_done, my_thr_key_mysys_exists; -extern my_bool my_assert; -extern my_bool my_assert_on_error; -extern myf my_global_flags; /* Set to MY_WME for more error messages */ - /* Point to current my_message() */ -extern void (*my_sigtstp_cleanup)(void), - /* Executed before jump to shell */ - (*my_sigtstp_restart)(void); - /* Executed when coming from shell */ -extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */ -extern int my_umask_dir, - my_recived_signals, /* Signals we have got */ - my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ - my_dont_interrupt; /* call remember_intr when set */ -extern my_bool my_use_symdir; - -extern ulong my_default_record_cache_size; -extern my_bool my_disable_locking, my_disable_async_io, - my_disable_flush_key_blocks, my_disable_symlinks; -extern my_bool my_disable_sync, my_disable_copystat_in_redel; -extern char wild_many,wild_one,wild_prefix; -extern const char *charsets_dir; - -enum cache_type -{ - TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE, - SEQ_READ_APPEND /* sequential read or append */, - READ_FIFO, READ_NET}; - -enum flush_type -{ - FLUSH_KEEP, /* flush block and keep it in the cache */ - FLUSH_RELEASE, /* flush block and remove it from the cache */ - FLUSH_IGNORE_CHANGED, /* remove block from the cache */ - /* - As my_disable_flush_pagecache_blocks is always 0, the following option - is strictly equivalent to FLUSH_KEEP - */ - FLUSH_FORCE_WRITE, - /** - @brief like FLUSH_KEEP but return immediately if file is already being - flushed (even partially) by another thread; only for page cache, - forbidden for key cache. - */ - FLUSH_KEEP_LAZY -}; - -typedef struct st_record_cache /* Used when caching records */ -{ - File file; - int rc_seek,error,inited; - uint rc_length,read_length,reclength; - my_off_t rc_record_pos,end_of_file; - uchar *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos; - enum cache_type type; -} RECORD_CACHE; - -enum file_type -{ - UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE, STREAM_BY_FOPEN, STREAM_BY_FDOPEN, - FILE_BY_O_TMPFILE, FILE_BY_MKSTEMP, FILE_BY_DUP -}; - -struct st_my_file_info -{ - char *name; -#ifdef _WIN32 - HANDLE fhandle; /* win32 file handle */ - int oflag; /* open flags, e.g O_APPEND */ -#endif - enum file_type type; -}; - -extern struct st_my_file_info *my_file_info; - -/* Free function pointer */ -typedef void (*FREE_FUNC)(void *); - -typedef struct st_dynamic_array -{ - uchar *buffer; - uint elements,max_element; - uint alloc_increment; - uint size_of_element; - PSI_memory_key m_psi_key; - myf malloc_flags; -} DYNAMIC_ARRAY; - -typedef struct st_my_tmpdir -{ - DYNAMIC_ARRAY full_list; - char **list; - uint cur, max; - mysql_mutex_t mutex; -} MY_TMPDIR; - -typedef struct st_dynamic_string -{ - char *str; - size_t length,max_length,alloc_increment; -} DYNAMIC_STRING; - -struct st_io_cache; - -typedef struct st_io_cache_share -{ - mysql_mutex_t mutex; /* To sync on reads into buffer. */ - mysql_cond_t cond; /* To wait for signals. */ - mysql_cond_t cond_writer; /* For a synchronized writer. */ - /* Offset in file corresponding to the first byte of buffer. */ - my_off_t pos_in_file; - /* If a synchronized write cache is the source of the data. */ - struct st_io_cache *source_cache; - uchar *buffer; /* The read buffer. */ - uchar *read_end; /* Behind last valid byte of buffer. */ - int running_threads; /* threads not in lock. */ - int total_threads; /* threads sharing the cache. */ - int error; /* Last error. */ -#ifdef NOT_YET_IMPLEMENTED - /* whether the structure should be free'd */ - my_bool alloced; -#endif -} IO_CACHE_SHARE; - -typedef struct st_io_cache /* Used when caching files */ -{ - /* Offset in file corresponding to the first byte of uchar* buffer. */ - my_off_t pos_in_file; - /* - The offset of end of file for READ_CACHE and WRITE_CACHE. - For SEQ_READ_APPEND it the maximum of the actual end of file and - the position represented by read_end. - */ - my_off_t end_of_file; - /* Points to current read position in the buffer */ - uchar *read_pos; - /* the non-inclusive boundary in the buffer for the currently valid read */ - uchar *read_end; - uchar *buffer; /* The read buffer */ - /* Used in ASYNC_IO */ - uchar *request_pos; - - /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */ - uchar *write_buffer; - /* - Only used in SEQ_READ_APPEND, and points to the current read position - in the write buffer. Note that reads in SEQ_READ_APPEND caches can - happen from both read buffer (uchar* buffer) and write buffer - (uchar* write_buffer). - */ - uchar *append_read_pos; - /* Points to current write position in the write buffer */ - uchar *write_pos; - /* The non-inclusive boundary of the valid write area */ - uchar *write_end; - - /* - The lock is for append buffer used in SEQ_READ_APPEND cache - need mutex copying from append buffer to read buffer. - */ - mysql_mutex_t append_buffer_lock; - /* - The following is used when several threads are reading the - same file in parallel. They are synchronized on disk - accesses reading the cached part of the file asynchronously. - It should be set to NULL to disable the feature. Only - READ_CACHE mode is supported. - */ - IO_CACHE_SHARE *share; - - /* - A caller will use my_b_read() macro to read from the cache - if the data is already in cache, it will be simply copied with - memcpy() and internal variables will be accordinging updated with - no functions invoked. However, if the data is not fully in the cache, - my_b_read() will call read_function to fetch the data. read_function - must never be invoked directly. - */ - int (*read_function)(struct st_io_cache *,uchar *,size_t); - /* - Same idea as in the case of read_function, except my_b_write() needs to - be replaced with my_b_append() for a SEQ_READ_APPEND cache - */ - int (*write_function)(struct st_io_cache *,const uchar *,size_t); - /* - Specifies the type of the cache. Depending on the type of the cache - certain operations might not be available and yield unpredicatable - results. Details to be documented later - */ - enum cache_type type; - /* - Counts the number of times, when we were forced to use disk. We use it to - increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status - variables. - */ - ulong disk_writes; - char *file_name; /* if used with 'open_cached_file' */ - const char *dir; - char prefix[3]; - File file; /* file descriptor */ - - struct st_io_cache *next_file_user; - /* - seek_not_done is set by my_b_seek() to inform the upcoming read/write - operation that a seek needs to be preformed prior to the actual I/O - error is 0 if the cache operation was successful, -1 if there was a - "hard" error, and the actual number of I/O-ed bytes if the read/write was - partial. - */ - int seek_not_done,error; - /* length of the buffer used for storing un-encrypted data */ - size_t buffer_length; - /* read_length is the same as buffer_length except when we use async io */ - size_t read_length; - myf myflags; /* Flags used to my_read/my_write */ - /* - alloced_buffer is set to the size of the buffer allocated for the IO_CACHE. - Includes the overhead(storing key to ecnrypt and decrypt) for encryption. - Set to 0 if nothing is allocated. - Currently READ_NET is the only one that will use a buffer allocated - somewhere else - */ - size_t alloced_buffer; -} IO_CACHE; - -typedef int (*qsort2_cmp)(const void *, const void *, const void *); - -typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...) - ATTRIBUTE_FORMAT_FPTR(printf, 2, 3); - -extern my_error_reporter my_charset_error_reporter; - -extern PSI_file_key key_file_io_cache; - -/* inline functions for mf_iocache */ - -extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock); -extern int _my_b_get(IO_CACHE *info); -extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count); -extern int _my_b_write(IO_CACHE *info,const uchar *Buffer,size_t Count); - -/* Test if buffer is inited */ -static inline void my_b_clear(IO_CACHE *info) { info->buffer= 0; } -static inline int my_b_inited(IO_CACHE *info) { return MY_TEST(info->buffer); } -#define my_b_EOF INT_MIN - -static inline int my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count) -{ - if (info->read_pos + Count <= info->read_end) - { - memcpy(Buffer, info->read_pos, Count); - info->read_pos+= Count; - return 0; - } - return _my_b_read(info, Buffer, Count); -} - -static inline int my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count) -{ - MEM_CHECK_DEFINED(Buffer, Count); - if (info->write_pos + Count <= info->write_end) - { - memcpy(info->write_pos, Buffer, Count); - info->write_pos+= Count; - return 0; - } - return _my_b_write(info, Buffer, Count); -} - -static inline int my_b_get(IO_CACHE *info) -{ - if (info->read_pos != info->read_end) - { - info->read_pos++; - return info->read_pos[-1]; - } - return _my_b_get(info); -} - -static inline my_bool my_b_write_byte(IO_CACHE *info, uchar chr) -{ - MEM_CHECK_DEFINED(&chr, 1); - if (info->write_pos >= info->write_end) - if (my_b_flush_io_cache(info, 1)) - return 1; - *info->write_pos++= chr; - return 0; -} - -/** - Fill buffer of the cache. - - @note It assumes that you have already used all characters in the CACHE, - independent of the read_pos value! - - @returns - 0 On error or EOF (info->error = -1 on error) - # Number of characters -*/ -static inline size_t my_b_fill(IO_CACHE *info) -{ - info->read_pos= info->read_end; - return _my_b_read(info,0,0) ? 0 : (size_t) (info->read_end - info->read_pos); -} - -static inline my_off_t my_b_tell(const IO_CACHE *info) -{ - if (info->type == WRITE_CACHE) { - return info->pos_in_file + (my_off_t)(info->write_pos - info->request_pos); - - } - return info->pos_in_file + (my_off_t) (info->read_pos - info->request_pos); -} - -static inline my_off_t my_b_write_tell(const IO_CACHE *info) -{ - return info->pos_in_file + (my_off_t) (info->write_pos - info->write_buffer); -} - -static inline uchar* my_b_get_buffer_start(const IO_CACHE *info) -{ - return info->request_pos; -} - -static inline size_t my_b_get_bytes_in_buffer(const IO_CACHE *info) -{ - return (size_t) (info->read_end - info->request_pos); -} - -static inline my_off_t my_b_get_pos_in_file(const IO_CACHE *info) -{ - return info->pos_in_file; -} - -static inline size_t my_b_bytes_in_cache(const IO_CACHE *info) -{ - if (info->type == WRITE_CACHE) { - return (size_t) (info->write_end - info->write_pos); - } - return (size_t) (info->read_end - info->read_pos); -} - -int my_b_copy_to_file (IO_CACHE *cache, FILE *file, size_t count); -int my_b_copy_all_to_file(IO_CACHE *cache, FILE *file); - -my_off_t my_b_append_tell(IO_CACHE* info); -my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */ -int my_b_pread(IO_CACHE *info, uchar *Buffer, size_t Count, my_off_t pos); - -typedef uint32 ha_checksum; - -extern int (*mysys_test_invalid_symlink)(const char *filename); -#include - - /* Prototypes for mysys and my_func functions */ - -extern int my_copy(const char *from,const char *to,myf MyFlags); -extern int my_delete(const char *name,myf MyFlags); -extern int my_rmtree(const char *name, myf Myflags); -extern int my_getwd(char * buf,size_t size,myf MyFlags); -extern int my_setwd(const char *dir,myf MyFlags); -extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags); -extern void *my_once_alloc(size_t Size,myf MyFlags); -extern void my_once_free(void); -extern char *my_once_strdup(const char *src,myf myflags); -extern void *my_once_memdup(const void *src, size_t len, myf myflags); -extern File my_open(const char *FileName,int Flags,myf MyFlags); -extern File my_register_filename(File fd, const char *FileName, - enum file_type type_of_file, - uint error_message_number, myf MyFlags); -extern File my_create(const char *FileName,int CreateFlags, - int AccessFlags, myf MyFlags); -extern int my_close(File Filedes,myf MyFlags); -extern int my_mkdir(const char *dir, int Flags, myf MyFlags); -extern int my_readlink(char *to, const char *filename, myf MyFlags); -extern int my_is_symlink(const char *filename); -extern int my_realpath(char *to, const char *filename, myf MyFlags); -extern File my_create_with_symlink(const char *linkname, const char *filename, - int createflags, int access_flags, - myf MyFlags); -extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); -extern int my_symlink(const char *content, const char *linkname, myf MyFlags); -extern int my_handler_delete_with_symlink(const char *filename, myf sync_dir); - -extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags); -extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset, - myf MyFlags); -extern int my_rename(const char *from,const char *to,myf MyFlags); -extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags); -extern my_off_t my_tell(File fd,myf MyFlags); -extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count, - myf MyFlags); -extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count, - my_off_t offset,myf MyFlags); -extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags); -extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count, - myf MyFlags); -extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); -extern my_off_t my_ftell(FILE *stream,myf MyFlags); - -/* implemented in my_memmem.c */ -extern void *my_memmem(const void *haystack, size_t haystacklen, - const void *needle, size_t needlelen); - - -#ifdef _WIN32 -extern int my_access(const char *path, int amode); -#define my_check_user(A,B) (NULL) -#define my_set_user(A,B,C) (0) -#else -#define my_access access -struct passwd *my_check_user(const char *user, myf MyFlags); -int my_set_user(const char *user, struct passwd *user_info, myf MyFlags); -#endif - -extern int check_if_legal_filename(const char *path); -extern int check_if_legal_tablename(const char *path); - -#ifdef _WIN32 -extern my_bool is_filename_allowed(const char *name, size_t length, - my_bool allow_current_dir); -#else /* _WIN32 */ -# define is_filename_allowed(name, length, allow_cwd) (TRUE) -#endif /* _WIN32 */ - -#ifdef _WIN32 -/* Windows-only functions (CRT equivalents)*/ -extern HANDLE my_get_osfhandle(File fd); -extern File my_win_handle2File(HANDLE hFile); -extern void my_osmaperr(unsigned long last_error); -#endif - -extern void init_glob_errs(void); -extern const char** get_global_errmsgs(int nr); -extern void wait_for_free_space(const char *filename, int errors); -extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); -extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); -extern FILE *my_freopen(const char *path, const char *mode, FILE *stream); -extern int my_fclose(FILE *fd,myf MyFlags); -extern int my_vfprintf(FILE *stream, const char* format, va_list args); -extern const char* my_strerror(char *buf, size_t len, int nr); -extern int my_fprintf(FILE *stream, const char* format, ...); -extern File my_fileno(FILE *fd); -extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); -extern int my_chmod(const char *name, mode_t mode, myf my_flags); -extern const char *my_basename(const char *filename); -extern void thr_set_sync_wait_callback(void (*before_sync)(void), - void (*after_sync)(void)); -extern int my_sync(File fd, myf my_flags); -extern int my_sync_dir(const char *dir_name, myf my_flags); -extern int my_sync_dir_by_file(const char *file_name, myf my_flags); -extern const char *my_get_err_msg(uint nr); -extern int my_error_register(const char** (*get_errmsgs) (int nr), - uint first, uint last); -extern my_bool my_error_unregister(uint first, uint last); -extern void my_message(uint my_err, const char *str,myf MyFlags); -extern void my_message_stderr(uint my_err, const char *str, myf MyFlags); -extern my_bool my_init(void); -extern void my_end(int infoflag); -extern int my_redel(const char *from, const char *to, time_t backup_time_stamp, - myf MyFlags); -void my_create_backup_name(char *to, const char *from, - time_t backup_time_stamp); -extern int my_copystat(const char *from, const char *to, int MyFlags); -extern char * my_filename(File fd); - -extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist); -extern char *my_tmpdir(MY_TMPDIR *tmpdir); -extern void free_tmpdir(MY_TMPDIR *tmpdir); - -extern void my_remember_signal(int signal_number,sig_handler (*func)(int)); -extern size_t dirname_part(char * to,const char *name, size_t *to_res_length); -extern size_t dirname_length(const char *name); -#define base_name(A) (A+dirname_length(A)) -extern int test_if_hard_path(const char *dir_name); -extern my_bool has_path(const char *name); -extern char *convert_dirname(char *to, const char *from, const char *from_end); -extern void to_unix_path(char * name); -extern char * fn_ext(const char *name); -extern char * fn_ext2(const char *name); -extern char * fn_same(char * toname,const char *name,int flag); -extern char * fn_format(char * to,const char *name,const char *dir, - const char *form, uint flag); -extern size_t strlength(const char *str); -extern void pack_dirname(char * to,const char *from); -extern size_t normalize_dirname(char * to, const char *from); -extern size_t unpack_dirname(char * to,const char *from); -extern size_t cleanup_dirname(char * to,const char *from); -extern size_t system_filename(char * to,const char *from); -extern size_t unpack_filename(char * to,const char *from); -extern char * intern_filename(char * to,const char *from); -extern int pack_filename(char * to, const char *name, size_t max_length); -extern char * my_path(char * to,const char *progname, - const char *own_pathname_part); -extern char * my_load_path(char * to, const char *path, - const char *own_path_prefix); -extern int wild_compare(const char *str,const char *wildstr, - pbool str_is_pattern); -extern my_bool array_append_string_unique(const char *str, - const char **array, size_t size); -extern void get_date(char * to,int timeflag,time_t use_time); -extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr, - pbool remove_garbage); -extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file, - size_t reclength,enum cache_type type, - pbool use_async_io); -extern int read_cache_record(RECORD_CACHE *info,uchar *to); -extern int end_record_cache(RECORD_CACHE *info); -extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos, - const uchar *record,size_t length); -extern int flush_write_cache(RECORD_CACHE *info); -extern void handle_recived_signals(void); - -extern sig_handler my_set_alarm_variable(int signo); -extern my_bool radixsort_is_appliccable(uint n_items, size_t size_of_element); -extern void my_string_ptr_sort(uchar *base,uint items,size_t size); -extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, - size_t size_of_element,uchar *buffer[]); -extern qsort_t my_qsort(void *base_ptr, size_t total_elems, size_t size, - qsort_cmp cmp); -extern qsort_t my_qsort2(void *base_ptr, size_t total_elems, size_t size, - qsort2_cmp cmp, void *cmp_argument); -extern qsort2_cmp get_ptr_compare(size_t); -void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos); -my_off_t my_get_ptr(uchar *ptr, size_t pack_length); -extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize, - enum cache_type type,my_off_t seek_offset, - my_bool use_async_io, myf cache_myflags); -extern int init_io_cache_ext(IO_CACHE *info, File file, size_t cachesize, - enum cache_type type, my_off_t seek_offset, - pbool use_async_io, myf cache_myflags, - PSI_file_key file_key); -extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type, - my_off_t seek_offset, my_bool use_async_io, - my_bool clear_cache); -extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, - IO_CACHE *write_cache, uint num_threads); - -extern int init_slave_io_cache(IO_CACHE *master, IO_CACHE *slave); -void end_slave_io_cache(IO_CACHE *cache); -void seek_io_cache(IO_CACHE *cache, my_off_t needed_offset); - -extern void remove_io_thread(IO_CACHE *info); -extern int my_b_append(IO_CACHE *info,const uchar *Buffer,size_t Count); -extern int my_b_safe_write(IO_CACHE *info,const uchar *Buffer,size_t Count); - -extern int my_block_write(IO_CACHE *info, const uchar *Buffer, - size_t Count, my_off_t pos); - -#define flush_io_cache(info) my_b_flush_io_cache((info),1) - -extern int end_io_cache(IO_CACHE *info); -extern void my_b_seek(IO_CACHE *info,my_off_t pos); -extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length); -extern my_off_t my_b_filelength(IO_CACHE *info); -extern my_bool my_b_write_backtick_quote(IO_CACHE *info, const char *str, - size_t len); -extern my_bool my_b_printf(IO_CACHE *info, const char* fmt, ...); -extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); -extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, - const char *prefix, size_t cache_size, - myf cache_myflags); -extern my_bool real_open_cached_file(IO_CACHE *cache); -extern void close_cached_file(IO_CACHE *cache); -File create_temp_file(char *to, const char *dir, const char *pfx, - int mode, myf MyFlags); -#define my_init_dynamic_array(A,B,C,D,E,F) init_dynamic_array2(A,B,C,NULL,D,E,F) -#define my_init_dynamic_array2(A,B,C,D,E,F,G) init_dynamic_array2(A,B,C,D,E,F,G) -extern my_bool init_dynamic_array2(PSI_memory_key psi_key, DYNAMIC_ARRAY *array, - uint element_size, void *init_buffer, - uint init_alloc, uint alloc_increment, - myf my_flags); -extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void* element); -extern void *alloc_dynamic(DYNAMIC_ARRAY *array); -extern void *pop_dynamic(DYNAMIC_ARRAY*); -extern my_bool set_dynamic(DYNAMIC_ARRAY *array, const void *element, - uint array_index); -extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements); -extern void get_dynamic(DYNAMIC_ARRAY *array, void *element, uint array_index); -extern void delete_dynamic(DYNAMIC_ARRAY *array); -extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index); -extern void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f); -extern void freeze_size(DYNAMIC_ARRAY *array); -extern int get_index_dynamic(DYNAMIC_ARRAY *array, void *element); -#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element) -#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index)) -#define push_dynamic(A,B) insert_dynamic((A),(B)) -#define reset_dynamic(array) ((array)->elements= 0) -#define sort_dynamic(A,cmp) my_qsort((A)->buffer, (A)->elements, (A)->size_of_element, (cmp)) - -extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, - size_t init_alloc,size_t alloc_increment); -extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append); -my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, - size_t length); -extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, - ...); -extern my_bool dynstr_append_quoted(DYNAMIC_STRING *str, - const char *append, size_t len, - char quote); -extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); -extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size); -extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); -extern void dynstr_free(DYNAMIC_STRING *str); -extern uint32 copy_and_convert_extended(char *to, uint32 to_length, - CHARSET_INFO *to_cs, - const char *from, uint32 from_length, - CHARSET_INFO *from_cs, uint *errors); -extern void dynstr_reassociate(DYNAMIC_STRING *str, char **res, size_t *length, - size_t *alloc_length); -extern uint32 copy_and_convert_extended(char *to, uint32 to_length, - CHARSET_INFO *to_cs, - const char *from, uint32 from_length, - CHARSET_INFO *from_cs, uint *errors); -#ifdef HAVE_MLOCK -extern void *my_malloc_lock(size_t length,myf flags); -extern void my_free_lock(void *ptr); -#else -#define my_malloc_lock(A,B) my_malloc(PSI_INSTRUMENT_ME, (A),(B)) -#define my_free_lock(A) my_free((A)) -#endif -#define root_name(A) "" -#define alloc_root_inited(A) ((A)->min_malloc != 0) -#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) -#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0) -extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root, - size_t block_size, size_t pre_alloc_size, - myf my_flags); -extern void *alloc_root(MEM_ROOT *mem_root, size_t Size); -extern void *multi_alloc_root(MEM_ROOT *mem_root, ...); -extern void free_root(MEM_ROOT *root, myf MyFLAGS); -extern void set_prealloc_root(MEM_ROOT *root, char *ptr); -extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, - size_t prealloc_size); -extern char *strdup_root(MEM_ROOT *root,const char *str); -static inline char *safe_strdup_root(MEM_ROOT *root, const char *str) -{ - return str ? strdup_root(root, str) : 0; -} -extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len); -extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); -extern LEX_CSTRING safe_lexcstrdup_root(MEM_ROOT *root, const LEX_CSTRING str); -extern my_bool my_compress(uchar *, size_t *, size_t *); -extern my_bool my_uncompress(uchar *, size_t , size_t *); -extern uchar *my_compress_alloc(const uchar *packet, size_t *len, - size_t *complen); -extern void *my_az_allocator(void *dummy, unsigned int items, unsigned int size); -extern void my_az_free(void *dummy, void *address); -extern int my_compress_buffer(uchar *dest, size_t *destLen, - const uchar *source, size_t sourceLen); -extern int packfrm(const uchar *, size_t, uchar **, size_t *); -extern int unpackfrm(uchar **, size_t *, const uchar *); - -extern uint32 my_checksum(uint32, const void *, size_t); -extern uint32 my_crc32c(uint32, const void *, size_t); - -extern const char *my_crc32c_implementation(); - -#ifdef DBUG_ASSERT_EXISTS -extern void my_debug_put_break_here(void); -#else -#define my_debug_put_break_here() do {} while(0) -#endif - -extern void my_sleep(ulong m_seconds); -extern uint my_set_max_open_files(uint files); -void my_free_open_file_info(void); - -extern my_bool my_gethwaddr(uchar *to); -extern int my_getncpus(void); - -#define HRTIME_RESOLUTION 1000000ULL /* microseconds */ -typedef struct {ulonglong val;} my_hrtime_t; -void my_time_init(void); -extern my_hrtime_t my_hrtime(void); - -#ifdef _WIN32 -extern my_hrtime_t my_hrtime_coarse(); -#else -#define my_hrtime_coarse() my_hrtime() -#endif - -extern ulonglong my_interval_timer(void); -extern ulonglong my_getcputime(void); - -#define microsecond_interval_timer() (my_interval_timer()/1000) -#define hrtime_to_time(X) ((time_t)((X).val/HRTIME_RESOLUTION)) -#define hrtime_from_time(X) ((ulonglong)((X)*HRTIME_RESOLUTION)) -#define hrtime_to_double(X) ((X).val/(double)HRTIME_RESOLUTION) -#define hrtime_sec_part(X) ((ulong)((X).val % HRTIME_RESOLUTION)) -#define my_time(X) hrtime_to_time(my_hrtime_coarse()) - -#if STACK_DIRECTION < 0 -#define available_stack_size(CUR,END) (long) ((char*)(CUR) - (char*)(END)) -#else -#define available_stack_size(CUR,END) (long) ((char*)(END) - (char*)(CUR)) -#endif - -#ifndef MAP_SYNC -#define MAP_SYNC 0x80000 -#endif -#ifndef MAP_SHARED_VALIDATE -#define MAP_SHARED_VALIDATE 0x03 -#endif - -#ifdef HAVE_SYS_MMAN_H -#ifndef MAP_NOSYNC -#define MAP_NOSYNC 0 -#endif -#ifndef MAP_NORESERVE -#define MAP_NORESERVE 0 /* For irix and AIX */ -#endif - -/* Compatibility with pre linux 3.8 distributions */ -#ifdef __linux__ -#define MAP_HUGE_SHIFT 26 -#define MAP_HUGETLB 0x40000 -#endif - -#ifdef HAVE_MMAP64 -#define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f) -#else -#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) -#endif -#define my_munmap(a,b) munmap((a),(b)) - -#else -/* not a complete set of mmap() flags, but only those that nesessary */ -#define PROT_READ 1 -#define PROT_WRITE 2 -#define MAP_NORESERVE 0 -#define MAP_SHARED 0x0001 -#define MAP_PRIVATE 0x0002 -#define MAP_NOSYNC 0x0800 -#define MAP_FAILED ((void *)-1) -#define MS_SYNC 0x0000 - -#define HAVE_MMAP -void *my_mmap(void *, size_t, int, int, int, my_off_t); -int my_munmap(void *, size_t); -#endif - -#ifdef _WIN32 -extern FILE* my_win_popen(const char*, const char*); -extern int my_win_pclose(FILE*); -#define my_popen(A,B) my_win_popen(A,B) -#define my_pclose(A) my_win_pclose(A) -#else -#define my_popen(A,B) popen(A,B) -#define my_pclose(A) pclose(A) -#endif - -/* my_getpagesize */ -#ifdef HAVE_GETPAGESIZE -#define my_getpagesize() getpagesize() -#else -int my_getpagesize(void); -#endif - -int my_msync(int, void *, size_t, int); - -#define MY_UUID_SIZE 16 -#define MY_UUID_STRING_LENGTH (8+1+4+1+4+1+4+1+12) - -void my_uuid_init(ulong seed1, ulong seed2); -void my_uuid(uchar *guid); -void my_uuid2str(const uchar *guid, char *s); -void my_uuid_end(void); - -const char *my_dlerror(const char *dlpath); - -/* character sets */ -extern void my_charset_loader_init_mysys(MY_CHARSET_LOADER *loader); -extern uint get_charset_number(const char *cs_name, uint cs_flags); -extern uint get_collation_number(const char *name); -extern const char *get_charset_name(uint cs_number); - -extern CHARSET_INFO *get_charset(uint cs_number, myf flags); -extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); -extern CHARSET_INFO *my_collation_get_by_name(MY_CHARSET_LOADER *loader, - const char *name, myf flags); -extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, - uint cs_flags, myf my_flags); -extern CHARSET_INFO *my_charset_get_by_name(MY_CHARSET_LOADER *loader, - const char *name, - uint cs_flags, myf my_flags); -extern my_bool resolve_charset(const char *cs_name, - CHARSET_INFO *default_cs, - CHARSET_INFO **cs); -extern my_bool resolve_collation(const char *cl_name, - CHARSET_INFO *default_cl, - CHARSET_INFO **cl); -extern void free_charsets(void); -extern char *get_charsets_dir(char *buf); -static inline my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2) -{ - return (cs1->csname == cs2->csname); -} -extern my_bool init_compiled_charsets(myf flags); -extern void add_compiled_collation(struct charset_info_st *cs); -extern void add_compiled_extra_collation(struct charset_info_st *cs); -extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info, - char *to, size_t to_length, - const char *from, size_t length); -extern char *get_tty_password(const char *opt_message); -#ifdef _WIN32 -#define BACKSLASH_MBTAIL -/* File system character set */ -extern CHARSET_INFO *fs_character_set(void); -#endif -extern const char *my_default_csname(void); -extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, - char *to, size_t to_length, - const char *from, size_t length); - -extern void thd_increment_bytes_sent(void *thd, size_t length); -extern void thd_increment_bytes_received(void *thd, size_t length); -extern void thd_increment_net_big_packet_count(void *thd, size_t length); - -#ifdef _WIN32 - -/* implemented in my_conio.c */ -char* my_cgets(char *string, size_t clen, size_t* plen); - -#endif - -#include - -#ifdef HAVE_PSI_INTERFACE -extern MYSQL_PLUGIN_IMPORT struct PSI_bootstrap *PSI_hook; -extern void set_psi_server(PSI *psi); -void my_init_mysys_psi_keys(void); -#endif - -struct st_mysql_file; -extern struct st_mysql_file *mysql_stdin; -C_MODE_END -#endif /* _my_sys_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_valgrind.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_valgrind.h deleted file mode 100644 index 62794a2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_valgrind.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (C) 2010, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MY_VALGRIND_INCLUDED -#define MY_VALGRIND_INCLUDED - -/* clang -> gcc */ -#ifndef __has_feature -# define __has_feature(x) 0 -#endif -#if __has_feature(address_sanitizer) -# define __SANITIZE_ADDRESS__ 1 -#endif - -#if __has_feature(memory_sanitizer) -# include -# define HAVE_valgrind -# define MEM_UNDEFINED(a,len) __msan_allocated_memory(a,len) -# define MEM_MAKE_ADDRESSABLE(a,len) MEM_UNDEFINED(a,len) -# define MEM_MAKE_DEFINED(a,len) __msan_unpoison(a,len) -# define MEM_NOACCESS(a,len) ((void) 0) -# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) -# define MEM_CHECK_DEFINED(a,len) __msan_check_mem_is_initialized(a,len) -# define MEM_GET_VBITS(a,b,len) __msan_copy_shadow(b,a,len) -# define MEM_SET_VBITS(a,b,len) __msan_copy_shadow(a,b,len) -# define REDZONE_SIZE 8 -#elif defined(HAVE_VALGRIND_MEMCHECK_H) && defined(HAVE_valgrind) -# include -# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len) -# define MEM_MAKE_ADDRESSABLE(a,len) MEM_UNDEFINED(a,len) -# define MEM_MAKE_DEFINED(a,len) VALGRIND_MAKE_MEM_DEFINED(a,len) -# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len) -# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len) -# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len) -# define MEM_GET_VBITS(a,b,len) VALGRIND_GET_VBITS(a,b,len) -# define MEM_SET_VBITS(a,b,len) VALGRIND_SET_VBITS(a,b,len) -# define REDZONE_SIZE 8 -#elif defined(__SANITIZE_ADDRESS__) -# include -/* How to do manual poisoning: -https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */ -# define MEM_UNDEFINED(a,len) ((void) 0) -# define MEM_MAKE_ADDRESSABLE(a,len) ASAN_UNPOISON_MEMORY_REGION(a,len) -# define MEM_MAKE_DEFINED(a,len) ((void) 0) -# define MEM_NOACCESS(a,len) ASAN_POISON_MEMORY_REGION(a,len) -# define MEM_CHECK_ADDRESSABLE(a,len) \ - assert(!__asan_region_is_poisoned((void*) a,len)) -# define MEM_CHECK_DEFINED(a,len) ((void) 0) -# define MEM_GET_VBITS(a,b,len) ((void) 0) -# define MEM_SET_VBITS(a,b,len) ((void) 0) -# define REDZONE_SIZE 8 -#else -# define MEM_UNDEFINED(a,len) ((void) 0) -# define MEM_MAKE_ADDRESSABLE(a,len) ((void) 0) -# define MEM_MAKE_DEFINED(a,len) ((void) 0) -# define MEM_NOACCESS(a,len) ((void) 0) -# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) -# define MEM_CHECK_DEFINED(a,len) ((void) 0) -# define MEM_GET_VBITS(a,b,len) ((void) 0) -# define MEM_SET_VBITS(a,b,len) ((void) 0) -# define REDZONE_SIZE 0 -#endif /* __has_feature(memory_sanitizer) */ - -#ifdef HAVE_valgrind -#define IF_VALGRIND(A,B) A -#else -#define IF_VALGRIND(A,B) B -#endif - -#ifdef TRASH_FREED_MEMORY -/* - _TRASH_FILL() has to call MEM_MAKE_ADDRESSABLE() to cancel any effect of - TRASH_FREE(). - This can happen in the case one does - TRASH_ALLOC(A,B) ; TRASH_FREE(A,B) ; TRASH_ALLOC(A,B) - to reuse the same memory in an internal memory allocator like MEM_ROOT. - _TRASH_FILL() is an internal function and should not be used externally. -*/ -#define _TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_MAKE_ADDRESSABLE(A, trash_tmp); memset(A, C, trash_tmp); } while (0) -#else -#define _TRASH_FILL(A,B,C) do { MEM_UNDEFINED((A), (B)); } while (0) -#endif -/** Note that some memory became allocated and/or uninitialized. */ -#define TRASH_ALLOC(A,B) do { _TRASH_FILL(A,B,0xA5); MEM_MAKE_ADDRESSABLE(A,B); } while(0) -/** Note that some memory became freed. (Prohibit further access to it.) */ -#define TRASH_FREE(A,B) do { _TRASH_FILL(A,B,0x8F); MEM_NOACCESS(A,B); } while(0) - -#endif /* MY_VALGRIND_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/my_xml.h b/VCMP-LUA/modules/mariadb/include/mysql/server/my_xml.h deleted file mode 100644 index 846448a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/my_xml.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright (c) 2000, 2002, 2003, 2005, 2007 MySQL AB - Use is subject to license terms - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef _my_xml_h -#define _my_xml_h - -#ifdef __cplusplus -extern "C" { -#endif - - -#define MY_XML_OK 0 -#define MY_XML_ERROR 1 - -/* - A flag whether to use absolute tag names in call-back functions, - like "a", "a.b" and "a.b.c" (used in character set file parser), - or relative names like "a", "b" and "c". -*/ -#define MY_XML_FLAG_RELATIVE_NAMES 1 - -/* - A flag whether to skip normilization of text values before calling - call-back functions: i.e. skip leading/trailing spaces, - \r, \n, \t characters. -*/ -#define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2 - -enum my_xml_node_type -{ - MY_XML_NODE_TAG, /* can have TAG, ATTR and TEXT children */ - MY_XML_NODE_ATTR, /* can have TEXT children */ - MY_XML_NODE_TEXT /* cannot have children */ -}; - -typedef struct xml_stack_st -{ - int flags; - enum my_xml_node_type current_node_type; - char errstr[128]; - - struct { - char static_buffer[128]; - char *buffer; - size_t buffer_size; - char *start; - char *end; - } attr; - - const char *beg; - const char *cur; - const char *end; - void *user_data; - int (*enter)(struct xml_stack_st *st,const char *val, size_t len); - int (*value)(struct xml_stack_st *st,const char *val, size_t len); - int (*leave_xml)(struct xml_stack_st *st,const char *val, size_t len); -} MY_XML_PARSER; - -void my_xml_parser_create(MY_XML_PARSER *st); -void my_xml_parser_free(MY_XML_PARSER *st); -int my_xml_parse(MY_XML_PARSER *st,const char *str, size_t len); - -void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, - const char *, - size_t len)); -void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, - const char *, - size_t len)); -void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, - const char *, - size_t len)); -void my_xml_set_user_data(MY_XML_PARSER *st, void *); - -size_t my_xml_error_pos(MY_XML_PARSER *st); -uint my_xml_error_lineno(MY_XML_PARSER *st); - -const char *my_xml_error_string(MY_XML_PARSER *st); - -#ifdef __cplusplus -} -#endif - -#endif /* _my_xml_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql.h deleted file mode 100644 index 6ff4c6d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql.h +++ /dev/null @@ -1,913 +0,0 @@ -/* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2012, Monty Program Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - This file defines the client API to MySQL and also the ABI of the - dynamically linked libmysqlclient. - - The ABI should never be changed in a released product of MySQL, - thus you need to take great care when changing the file. In case - the file is changed so the ABI is broken, you must also update - the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake -*/ - -#ifndef _mysql_h -#define _mysql_h - -#ifdef _AIX /* large-file support will break without this */ -#include -#endif - -#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ -#undef WIN -#undef _WIN -#undef _WIN32 -#undef _WIN64 -#undef __WIN__ -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MY_GLOBAL_INCLUDED /* If not standard header */ -#ifndef MYSQL_ABI_CHECK -#include -#endif - -#ifndef MYSQL_PLUGIN_INCLUDED -typedef char my_bool; -#endif - -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) -#define __WIN__ -#endif -#if !defined(__WIN__) -#define STDCALL -#else -#define STDCALL __stdcall -#endif - -#ifndef my_socket_defined -#if defined (_WIN64) -#define my_socket unsigned long long -#elif defined (_WIN32) -#define my_socket unsigned int -#else -typedef int my_socket; -#endif /* _WIN64 */ -#endif /* my_socket_defined */ -#endif /* MY_GLOBAL_INCLUDED */ - -#include "mysql_version.h" -#include "mysql_com.h" -#include "mysql_time.h" - -#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */ - -extern unsigned int mariadb_deinitialize_ssl; -extern unsigned int mysql_port; -extern char *mysql_unix_port; - -#define CLIENT_NET_READ_TIMEOUT (365*24*3600) /* Timeout on read */ -#define CLIENT_NET_WRITE_TIMEOUT (365*24*3600) /* Timeout on write */ - -#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) -#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) -#define IS_BLOB(n) ((n) & BLOB_FLAG) -/** - Returns true if the value is a number which does not need quotes for - the sql_lex.cc parser to parse correctly. -*/ -#define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) -#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING) - - -typedef struct st_mysql_const_lex_string MARIADB_CONST_STRING; - - -typedef struct st_mysql_field { - char *name; /* Name of column */ - char *org_name; /* Original column name, if an alias */ - char *table; /* Table of column if column was a field */ - char *org_table; /* Org table name, if table was an alias */ - char *db; /* Database for table */ - char *catalog; /* Catalog for table */ - char *def; /* Default value (set by mysql_list_fields) */ - unsigned long length; /* Width of column (create length) */ - unsigned long max_length; /* Max width for selected set */ - unsigned int name_length; - unsigned int org_name_length; - unsigned int table_length; - unsigned int org_table_length; - unsigned int db_length; - unsigned int catalog_length; - unsigned int def_length; - unsigned int flags; /* Div flags */ - unsigned int decimals; /* Number of decimals in field */ - unsigned int charsetnr; /* Character set */ - enum enum_field_types type; /* Type of field. See mysql_com.h for types */ - void *extension; -} MYSQL_FIELD; - -typedef char **MYSQL_ROW; /* return data as array of strings */ -typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ - -#ifndef MY_GLOBAL_INCLUDED -#if defined(NO_CLIENT_LONG_LONG) -typedef unsigned long my_ulonglong; -#elif defined (__WIN__) -typedef unsigned __int64 my_ulonglong; -#else -typedef unsigned long long my_ulonglong; -#endif -#endif - -#include "typelib.h" - -#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0) - -/* backward compatibility define - to be removed eventually */ -#define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED -#define WARN_PLUGIN_DELETE_BUILTIN ER_PLUGIN_DELETE_BUILTIN -#define ER_FK_DUP_NAME ER_DUP_CONSTRAINT_NAME -#define ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED -#define ER_PRIMARY_KEY_BASED_ON_VIRTUAL_COLUMN ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN -#define ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN -#define ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN -#define ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS - -typedef struct st_mysql_rows { - struct st_mysql_rows *next; /* list of rows */ - MYSQL_ROW data; - unsigned long length; -} MYSQL_ROWS; - -typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ - -#include "my_alloc.h" - -typedef struct embedded_query_result EMBEDDED_QUERY_RESULT; -typedef struct st_mysql_data { - MYSQL_ROWS *data; - struct embedded_query_result *embedded_info; - MEM_ROOT alloc; - my_ulonglong rows; - unsigned int fields; - /* extra info for embedded library */ - void *extension; -} MYSQL_DATA; - -enum mysql_option -{ - MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, - MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, - MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT, - MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT, - MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION, - MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, - MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, - MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH, - MYSQL_OPT_BIND, - MYSQL_OPT_SSL_KEY, MYSQL_OPT_SSL_CERT, - MYSQL_OPT_SSL_CA, MYSQL_OPT_SSL_CAPATH, MYSQL_OPT_SSL_CIPHER, - MYSQL_OPT_SSL_CRL, MYSQL_OPT_SSL_CRLPATH, - MYSQL_OPT_CONNECT_ATTR_RESET, MYSQL_OPT_CONNECT_ATTR_ADD, - MYSQL_OPT_CONNECT_ATTR_DELETE, - MYSQL_SERVER_PUBLIC_KEY, - MYSQL_ENABLE_CLEARTEXT_PLUGIN, - MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, - - /* MariaDB options */ - MYSQL_PROGRESS_CALLBACK=5999, - MYSQL_OPT_NONBLOCK, - MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY -}; - -/** - @todo remove the "extension", move st_mysql_options completely - out of mysql.h -*/ -struct st_mysql_options_extention; - -struct st_mysql_options { - unsigned int connect_timeout, read_timeout, write_timeout; - unsigned int port, protocol; - unsigned long client_flag; - char *host,*user,*password,*unix_socket,*db; - struct st_dynamic_array *init_commands; - char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; - char *ssl_key; /* PEM key file */ - char *ssl_cert; /* PEM cert file */ - char *ssl_ca; /* PEM CA file */ - char *ssl_capath; /* PEM directory of CA-s? */ - char *ssl_cipher; /* cipher to use */ - char *shared_memory_base_name; - unsigned long max_allowed_packet; - my_bool use_ssl; /* if to use SSL or not */ - my_bool compress,named_pipe; - my_bool use_thread_specific_memory; - my_bool unused2; - my_bool unused3; - my_bool unused4; - enum mysql_option methods_to_use; - char *client_ip; - /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */ - my_bool secure_auth; - /* 0 - never report, 1 - always report (default) */ - my_bool report_data_truncation; - - /* function pointers for local infile support */ - int (*local_infile_init)(void **, const char *, void *); - int (*local_infile_read)(void *, char *, unsigned int); - void (*local_infile_end)(void *); - int (*local_infile_error)(void *, char *, unsigned int); - void *local_infile_userdata; - struct st_mysql_options_extention *extension; -}; - -enum mysql_status -{ - MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT, - MYSQL_STATUS_STATEMENT_GET_RESULT -}; - -enum mysql_protocol_type -{ - MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, - MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY -}; - -typedef struct character_set -{ - unsigned int number; /* character set number */ - unsigned int state; /* character set state */ - const char *csname; /* collation name */ - const char *name; /* character set name */ - const char *comment; /* comment */ - const char *dir; /* character set directory */ - unsigned int mbminlen; /* min. length for multibyte strings */ - unsigned int mbmaxlen; /* max. length for multibyte strings */ -} MY_CHARSET_INFO; - -struct st_mysql_methods; -struct st_mysql_stmt; - -typedef struct st_mysql -{ - NET net; /* Communication parameters */ - unsigned char *connector_fd; /* ConnectorFd for SSL */ - char *host,*user,*passwd,*unix_socket,*server_version,*host_info; - char *info, *db; - const struct charset_info_st *charset; - MYSQL_FIELD *fields; - MEM_ROOT field_alloc; - my_ulonglong affected_rows; - my_ulonglong insert_id; /* id if insert on table with NEXTNR */ - my_ulonglong extra_info; /* Not used */ - unsigned long thread_id; /* Id for connection in server */ - unsigned long packet_length; - unsigned int port; - unsigned long client_flag,server_capabilities; - unsigned int protocol_version; - unsigned int field_count; - unsigned int server_status; - unsigned int server_language; - unsigned int warning_count; - struct st_mysql_options options; - enum mysql_status status; - my_bool free_me; /* If free in mysql_close */ - my_bool reconnect; /* set to 1 if automatic reconnect */ - - /* session-wide random string */ - char scramble[SCRAMBLE_LENGTH+1]; - my_bool auto_local_infile; - void *unused2, *unused3, *unused4, *unused5; - - LIST *stmts; /* list of all statements */ - const struct st_mysql_methods *methods; - void *thd; - /* - Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag - from mysql_stmt_close if close had to cancel result set of this object. - */ - my_bool *unbuffered_fetch_owner; - /* needed for embedded server - no net buffer to store the 'info' */ - char *info_buffer; - void *extension; -} MYSQL; - - -typedef struct st_mysql_res { - my_ulonglong row_count; - MYSQL_FIELD *fields; - MYSQL_DATA *data; - MYSQL_ROWS *data_cursor; - unsigned long *lengths; /* column lengths of current row */ - MYSQL *handle; /* for unbuffered reads */ - const struct st_mysql_methods *methods; - MYSQL_ROW row; /* If unbuffered read */ - MYSQL_ROW current_row; /* buffer to current row */ - MEM_ROOT field_alloc; - unsigned int field_count, current_field; - my_bool eof; /* Used by mysql_fetch_row */ - /* mysql_stmt_close() had to cancel this result */ - my_bool unbuffered_fetch_cancelled; - void *extension; -} MYSQL_RES; - - -#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) -#define MYSQL_CLIENT -#endif - - -typedef struct st_mysql_parameters -{ - unsigned long *p_max_allowed_packet; - unsigned long *p_net_buffer_length; - void *extension; -} MYSQL_PARAMETERS; - -/* - Flag bits, the asynchronous methods return a combination of these ORed - together to let the application know when to resume the suspended operation. -*/ - -/* - Wait for data to be available on socket to read. - mysql_get_socket_fd() will return socket descriptor. -*/ -#define MYSQL_WAIT_READ 1 -/* Wait for socket to be ready to write data. */ -#define MYSQL_WAIT_WRITE 2 -/* Wait for select() to mark exception on socket. */ -#define MYSQL_WAIT_EXCEPT 4 -/* - Wait until timeout occurs. Value of timeout can be obtained from - mysql_get_timeout_value(). -*/ -#define MYSQL_WAIT_TIMEOUT 8 - -#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY) -#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet) -#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length) -#endif - -/* - Set up and bring down the server; to ensure that applications will - work when linked against either the standard client library or the - embedded server library, these functions should be called. -*/ -int STDCALL mysql_server_init(int argc, char **argv, char **groups); -void STDCALL mysql_server_end(void); - -/* - mysql_server_init/end need to be called when using libmysqld or - libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so - you don't need to call it explicitly; but you need to call - mysql_server_end() to free memory). The names are a bit misleading - (mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general - names which suit well whether you're using libmysqld or libmysqlclient. We - intend to promote these aliases over the mysql_server* ones. -*/ -#define mysql_library_init mysql_server_init -#define mysql_library_end mysql_server_end - -MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void); - -/* - Set up and bring down a thread; these function should be called - for each thread in an application which opens at least one MySQL - connection. All uses of the connection(s) should be between these - function calls. -*/ -my_bool STDCALL mysql_thread_init(void); -void STDCALL mysql_thread_end(void); - -/* - Functions to get information from the MYSQL and MYSQL_RES structures - Should definitely be used if one uses shared libraries. -*/ - -my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); -unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); -my_bool STDCALL mysql_eof(MYSQL_RES *res); -MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, - unsigned int fieldnr); -MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res); -MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res); -MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res); - - - - -int STDCALL mariadb_field_attr(MARIADB_CONST_STRING *attr, - const MYSQL_FIELD *field, - enum mariadb_field_attr_t type); - - -unsigned int STDCALL mysql_field_count(MYSQL *mysql); -my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); -my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); -unsigned int STDCALL mysql_errno(MYSQL *mysql); -const char * STDCALL mysql_error(MYSQL *mysql); -const char *STDCALL mysql_sqlstate(MYSQL *mysql); -unsigned int STDCALL mysql_warning_count(MYSQL *mysql); -const char * STDCALL mysql_info(MYSQL *mysql); -unsigned long STDCALL mysql_thread_id(MYSQL *mysql); -const char * STDCALL mysql_character_set_name(MYSQL *mysql); -int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname); -int STDCALL mysql_set_character_set_start(int *ret, MYSQL *mysql, - const char *csname); -int STDCALL mysql_set_character_set_cont(int *ret, MYSQL *mysql, - int status); - -MYSQL * STDCALL mysql_init(MYSQL *mysql); -my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, - const char *cert, const char *ca, - const char *capath, const char *cipher); -const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql); -my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, - const char *passwd, const char *db); -int STDCALL mysql_change_user_start(my_bool *ret, MYSQL *mysql, - const char *user, - const char *passwd, - const char *db); -int STDCALL mysql_change_user_cont(my_bool *ret, MYSQL *mysql, - int status); -MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, - const char *user, - const char *passwd, - const char *db, - unsigned int port, - const char *unix_socket, - unsigned long clientflag); -int STDCALL mysql_real_connect_start(MYSQL **ret, MYSQL *mysql, - const char *host, - const char *user, - const char *passwd, - const char *db, - unsigned int port, - const char *unix_socket, - unsigned long clientflag); -int STDCALL mysql_real_connect_cont(MYSQL **ret, MYSQL *mysql, - int status); -int STDCALL mysql_select_db(MYSQL *mysql, const char *db); -int STDCALL mysql_select_db_start(int *ret, MYSQL *mysql, - const char *db); -int STDCALL mysql_select_db_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_query(MYSQL *mysql, const char *q); -int STDCALL mysql_query_start(int *ret, MYSQL *mysql, - const char *q); -int STDCALL mysql_query_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_send_query(MYSQL *mysql, const char *q, - unsigned long length); -int STDCALL mysql_send_query_start(int *ret, MYSQL *mysql, - const char *q, - unsigned long length); -int STDCALL mysql_send_query_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_real_query(MYSQL *mysql, const char *q, - unsigned long length); -int STDCALL mysql_real_query_start(int *ret, MYSQL *mysql, - const char *q, - unsigned long length); -int STDCALL mysql_real_query_cont(int *ret, MYSQL *mysql, - int status); -MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); -int STDCALL mysql_store_result_start(MYSQL_RES **ret, MYSQL *mysql); -int STDCALL mysql_store_result_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); - -void STDCALL mysql_get_character_set_info(MYSQL *mysql, - MY_CHARSET_INFO *charset); - -/* local infile support */ - -#define LOCAL_INFILE_ERROR_LEN 512 - -void -mysql_set_local_infile_handler(MYSQL *mysql, - int (*local_infile_init)(void **, const char *, - void *), - int (*local_infile_read)(void *, char *, - unsigned int), - void (*local_infile_end)(void *), - int (*local_infile_error)(void *, char*, - unsigned int), - void *); - -void -mysql_set_local_infile_default(MYSQL *mysql); - -int STDCALL mysql_shutdown(MYSQL *mysql, - enum mysql_enum_shutdown_level - shutdown_level); -int STDCALL mysql_shutdown_start(int *ret, MYSQL *mysql, - enum mysql_enum_shutdown_level - shutdown_level); -int STDCALL mysql_shutdown_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_dump_debug_info(MYSQL *mysql); -int STDCALL mysql_dump_debug_info_start(int *ret, MYSQL *mysql); -int STDCALL mysql_dump_debug_info_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_refresh(MYSQL *mysql, - unsigned int refresh_options); -int STDCALL mysql_refresh_start(int *ret, MYSQL *mysql, - unsigned int refresh_options); -int STDCALL mysql_refresh_cont(int *ret, MYSQL *mysql, int status); -int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid); -int STDCALL mysql_kill_start(int *ret, MYSQL *mysql, - unsigned long pid); -int STDCALL mysql_kill_cont(int *ret, MYSQL *mysql, int status); -int STDCALL mysql_set_server_option(MYSQL *mysql, - enum enum_mysql_set_option - option); -int STDCALL mysql_set_server_option_start(int *ret, MYSQL *mysql, - enum enum_mysql_set_option - option); -int STDCALL mysql_set_server_option_cont(int *ret, MYSQL *mysql, - int status); -int STDCALL mysql_ping(MYSQL *mysql); -int STDCALL mysql_ping_start(int *ret, MYSQL *mysql); -int STDCALL mysql_ping_cont(int *ret, MYSQL *mysql, int status); -const char * STDCALL mysql_stat(MYSQL *mysql); -int STDCALL mysql_stat_start(const char **ret, MYSQL *mysql); -int STDCALL mysql_stat_cont(const char **ret, MYSQL *mysql, - int status); -const char * STDCALL mysql_get_server_info(MYSQL *mysql); -const char * STDCALL mysql_get_server_name(MYSQL *mysql); -const char * STDCALL mysql_get_client_info(void); -unsigned long STDCALL mysql_get_client_version(void); -const char * STDCALL mysql_get_host_info(MYSQL *mysql); -unsigned long STDCALL mysql_get_server_version(MYSQL *mysql); -unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild); -int STDCALL mysql_list_dbs_start(MYSQL_RES **ret, MYSQL *mysql, - const char *wild); -int STDCALL mysql_list_dbs_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); -int STDCALL mysql_list_tables_start(MYSQL_RES **ret, MYSQL *mysql, - const char *wild); -int STDCALL mysql_list_tables_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); -int STDCALL mysql_list_processes_start(MYSQL_RES **ret, - MYSQL *mysql); -int STDCALL mysql_list_processes_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, - const void *arg); -int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option, - const void *arg1, const void *arg2); -void STDCALL mysql_free_result(MYSQL_RES *result); -int STDCALL mysql_free_result_start(MYSQL_RES *result); -int STDCALL mysql_free_result_cont(MYSQL_RES *result, int status); -void STDCALL mysql_data_seek(MYSQL_RES *result, - my_ulonglong offset); -MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, - MYSQL_ROW_OFFSET offset); -MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, - MYSQL_FIELD_OFFSET offset); -MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); -int STDCALL mysql_fetch_row_start(MYSQL_ROW *ret, - MYSQL_RES *result); -int STDCALL mysql_fetch_row_cont(MYSQL_ROW *ret, MYSQL_RES *result, - int status); -unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); -MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); -MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, - const char *wild); -int STDCALL mysql_list_fields_start(MYSQL_RES **ret, MYSQL *mysql, - const char *table, - const char *wild); -int STDCALL mysql_list_fields_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -unsigned long STDCALL mysql_escape_string(char *to,const char *from, - unsigned long from_length); -unsigned long STDCALL mysql_hex_string(char *to,const char *from, - unsigned long from_length); -unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, - char *to,const char *from, - unsigned long length); -void STDCALL mysql_debug(const char *debug); -void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); -unsigned int STDCALL mysql_thread_safe(void); -my_bool STDCALL mysql_embedded(void); -my_bool STDCALL mariadb_connection(MYSQL *mysql); -my_bool STDCALL mysql_read_query_result(MYSQL *mysql); -int STDCALL mysql_read_query_result_start(my_bool *ret, - MYSQL *mysql); -int STDCALL mysql_read_query_result_cont(my_bool *ret, - MYSQL *mysql, int status); - - -/* - The following definitions are added for the enhanced - client-server protocol -*/ - -/* statement state */ -enum enum_mysql_stmt_state -{ - MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE, - MYSQL_STMT_FETCH_DONE -}; - - -/* - This structure is used to define bind information, and - internally by the client library. - Public members with their descriptions are listed below - (conventionally `On input' refers to the binds given to - mysql_stmt_bind_param, `On output' refers to the binds given - to mysql_stmt_bind_result): - - buffer_type - One of the MYSQL_* types, used to describe - the host language type of buffer. - On output: if column type is different from - buffer_type, column value is automatically converted - to buffer_type before it is stored in the buffer. - buffer - On input: points to the buffer with input data. - On output: points to the buffer capable to store - output data. - The type of memory pointed by buffer must correspond - to buffer_type. See the correspondence table in - the comment to mysql_stmt_bind_param. - - The two above members are mandatory for any kind of bind. - - buffer_length - the length of the buffer. You don't have to set - it for any fixed length buffer: float, double, - int, etc. It must be set however for variable-length - types, such as BLOBs or STRINGs. - - length - On input: in case when lengths of input values - are different for each execute, you can set this to - point at a variable containining value length. This - way the value length can be different in each execute. - If length is not NULL, buffer_length is not used. - Note, length can even point at buffer_length if - you keep bind structures around while fetching: - this way you can change buffer_length before - each execution, everything will work ok. - On output: if length is set, mysql_stmt_fetch will - write column length into it. - - is_null - On input: points to a boolean variable that should - be set to TRUE for NULL values. - This member is useful only if your data may be - NULL in some but not all cases. - If your data is never NULL, is_null should be set to 0. - If your data is always NULL, set buffer_type - to MYSQL_TYPE_NULL, and is_null will not be used. - - is_unsigned - On input: used to signify that values provided for one - of numeric types are unsigned. - On output describes signedness of the output buffer. - If, taking into account is_unsigned flag, column data - is out of range of the output buffer, data for this column - is regarded truncated. Note that this has no correspondence - to the sign of result set column, if you need to find it out - use mysql_stmt_result_metadata. - error - where to write a truncation error if it is present. - possible error value is: - 0 no truncation - 1 value is out of range or buffer is too small - - Please note that MYSQL_BIND also has internals members. -*/ - -typedef struct st_mysql_bind -{ - unsigned long *length; /* output length pointer */ - my_bool *is_null; /* Pointer to null indicator */ - void *buffer; /* buffer to get/put data */ - /* set this if you want to track data truncations happened during fetch */ - my_bool *error; - unsigned char *row_ptr; /* for the current data position */ - void (*store_param_func)(NET *net, struct st_mysql_bind *param); - void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *, - unsigned char **row); - void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *, - unsigned char **row); - /* output buffer length, must be set when fetching str/binary */ - unsigned long buffer_length; - unsigned long offset; /* offset position for char/binary fetch */ - unsigned long length_value; /* Used if length is 0 */ - unsigned int param_number; /* For null count and error messages */ - unsigned int pack_length; /* Internal length for packed data */ - enum enum_field_types buffer_type; /* buffer type */ - my_bool error_value; /* used if error is 0 */ - my_bool is_unsigned; /* set if integer type is unsigned */ - my_bool long_data_used; /* If used with mysql_send_long_data */ - my_bool is_null_value; /* Used if is_null is 0 */ - void *extension; -} MYSQL_BIND; - - -struct st_mysql_stmt_extension; - -/* statement handler */ -typedef struct st_mysql_stmt -{ - MEM_ROOT mem_root; /* root allocations */ - LIST list; /* list to keep track of all stmts */ - MYSQL *mysql; /* connection handle */ - MYSQL_BIND *params; /* input parameters */ - MYSQL_BIND *bind; /* output parameters */ - MYSQL_FIELD *fields; /* result set metadata */ - MYSQL_DATA result; /* cached result set */ - MYSQL_ROWS *data_cursor; /* current row in cached result */ - /* - mysql_stmt_fetch() calls this function to fetch one row (it's different - for buffered, unbuffered and cursor fetch). - */ - int (*read_row_func)(struct st_mysql_stmt *stmt, - unsigned char **row); - /* copy of mysql->affected_rows after statement execution */ - my_ulonglong affected_rows; - my_ulonglong insert_id; /* copy of mysql->insert_id */ - unsigned long stmt_id; /* Id for prepared statement */ - unsigned long flags; /* i.e. type of cursor to open */ - unsigned long prefetch_rows; /* number of rows per one COM_FETCH */ - /* - Copied from mysql->server_status after execute/fetch to know - server-side cursor status for this statement. - */ - unsigned int server_status; - unsigned int last_errno; /* error code */ - unsigned int param_count; /* input parameter count */ - unsigned int field_count; /* number of columns in result set */ - enum enum_mysql_stmt_state state; /* statement state */ - char last_error[MYSQL_ERRMSG_SIZE]; /* error message */ - char sqlstate[SQLSTATE_LENGTH+1]; - /* Types of input parameters should be sent to server */ - my_bool send_types_to_server; - my_bool bind_param_done; /* input buffers were supplied */ - unsigned char bind_result_done; /* output buffers were supplied */ - /* mysql_stmt_close() had to cancel this result */ - my_bool unbuffered_fetch_cancelled; - /* - Is set to true if we need to calculate field->max_length for - metadata fields when doing mysql_stmt_store_result. - */ - my_bool update_max_length; - struct st_mysql_stmt_extension *extension; -} MYSQL_STMT; - -enum enum_stmt_attr_type -{ - /* - When doing mysql_stmt_store_result calculate max_length attribute - of statement metadata. This is to be consistent with the old API, - where this was done automatically. - In the new API we do that only by request because it slows down - mysql_stmt_store_result sufficiently. - */ - STMT_ATTR_UPDATE_MAX_LENGTH, - /* - unsigned long with combination of cursor flags (read only, for update, - etc) - */ - STMT_ATTR_CURSOR_TYPE, - /* - Amount of rows to retrieve from server per one fetch if using cursors. - Accepts unsigned long attribute in the range 1 - ulong_max - */ - STMT_ATTR_PREFETCH_ROWS -}; - -MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql); -int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, - unsigned long length); -int STDCALL mysql_stmt_prepare_start(int *ret, MYSQL_STMT *stmt, - const char *query, unsigned long length); -int STDCALL mysql_stmt_prepare_cont(int *ret, MYSQL_STMT *stmt, int status); -int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt); -int STDCALL mysql_stmt_execute_start(int *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_execute_cont(int *ret, MYSQL_STMT *stmt, int status); -int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt); -int STDCALL mysql_stmt_fetch_start(int *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_fetch_cont(int *ret, MYSQL_STMT *stmt, int status); -int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, - unsigned int column, - unsigned long offset); -int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt); -int STDCALL mysql_stmt_store_result_start(int *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_store_result_cont(int *ret, MYSQL_STMT *stmt, - int status); -unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt); -my_bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt, - enum enum_stmt_attr_type attr_type, - const void *attr); -my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt, - enum enum_stmt_attr_type attr_type, - void *attr); -my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd); -my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd); -my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt); -int STDCALL mysql_stmt_close_start(my_bool *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_close_cont(my_bool *ret, MYSQL_STMT * stmt, int status); -my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt); -int STDCALL mysql_stmt_reset_start(my_bool *ret, MYSQL_STMT * stmt); -int STDCALL mysql_stmt_reset_cont(my_bool *ret, MYSQL_STMT *stmt, int status); -my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt); -int STDCALL mysql_stmt_free_result_start(my_bool *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_free_result_cont(my_bool *ret, MYSQL_STMT *stmt, - int status); -my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, - unsigned int param_number, - const char *data, - unsigned long length); -int STDCALL mysql_stmt_send_long_data_start(my_bool *ret, MYSQL_STMT *stmt, - unsigned int param_number, - const char *data, - unsigned long len); -int STDCALL mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt, - int status); -MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt); -MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt); -unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt); -const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt); -const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt); -MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, - MYSQL_ROW_OFFSET offset); -MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt); -void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset); -my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt); -my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt); -my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt); -unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt); - -my_bool STDCALL mysql_commit(MYSQL * mysql); -int STDCALL mysql_commit_start(my_bool *ret, MYSQL * mysql); -int STDCALL mysql_commit_cont(my_bool *ret, MYSQL * mysql, int status); -my_bool STDCALL mysql_rollback(MYSQL * mysql); -int STDCALL mysql_rollback_start(my_bool *ret, MYSQL * mysql); -int STDCALL mysql_rollback_cont(my_bool *ret, MYSQL * mysql, int status); -my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode); -int STDCALL mysql_autocommit_start(my_bool *ret, MYSQL * mysql, - my_bool auto_mode); -int STDCALL mysql_autocommit_cont(my_bool *ret, MYSQL * mysql, int status); -my_bool STDCALL mysql_more_results(MYSQL *mysql); -int STDCALL mysql_next_result(MYSQL *mysql); -int STDCALL mysql_next_result_start(int *ret, MYSQL *mysql); -int STDCALL mysql_next_result_cont(int *ret, MYSQL *mysql, int status); -int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt); -int STDCALL mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt); -int STDCALL mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int status); -void STDCALL mysql_close_slow_part(MYSQL *mysql); -void STDCALL mysql_close(MYSQL *sock); -int STDCALL mysql_close_start(MYSQL *sock); -int STDCALL mysql_close_cont(MYSQL *sock, int status); -my_socket STDCALL mysql_get_socket(const MYSQL *mysql); -unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql); -unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql); - -/******************************************************************** - mysql_net_ functions - low-level API to MySQL protocol -*********************************************************************/ -unsigned long STDCALL mysql_net_read_packet(MYSQL *mysql); -unsigned long STDCALL mysql_net_field_length(unsigned char **packet); - -/* status return codes */ -#define MYSQL_NO_DATA 100 -#define MYSQL_DATA_TRUNCATED 101 - -#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) - -#ifdef USE_OLD_FUNCTIONS -MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, - const char *user, const char *passwd); -int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); -int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); -#endif -#define HAVE_MYSQL_REAL_CONNECT - -#ifdef __cplusplus -} -#endif - -#endif /* _mysql_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/auth_dialog_client.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/auth_dialog_client.h deleted file mode 100644 index f1ad3e6..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/auth_dialog_client.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef MYSQL_AUTH_DIALOG_CLIENT_INCLUDED -/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - Definitions needed to use Dialog client authentication plugin -*/ - -struct st_mysql; - -#define MYSQL_AUTH_DIALOG_CLIENT_INCLUDED - -/** - type of the mysql_authentication_dialog_ask function - - @param mysql mysql - @param type type of the input - 1 - ordinary string input - 2 - password string - @param prompt prompt - @param buf a buffer to store the use input - @param buf_len the length of the buffer - - @retval a pointer to the user input string. - It may be equal to 'buf' or to 'mysql->password'. - In all other cases it is assumed to be an allocated - string, and the "dialog" plugin will free() it. -*/ -typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql, - int type, const char *prompt, char *buf, int buf_len); - -/** - first byte of the question string is the question "type". - It can be an "ordinary" or a "password" question. - The last bit set marks a last question in the authentication exchange. -*/ -#define ORDINARY_QUESTION "\2" -#define LAST_QUESTION "\3" -#define PASSWORD_QUESTION "\4" -#define LAST_PASSWORD "\5" - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/client_plugin.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/client_plugin.h deleted file mode 100644 index 990cecc..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/client_plugin.h +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef MYSQL_CLIENT_PLUGIN_INCLUDED -/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab - Copyright (c) 2010, 2011, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - MySQL Client Plugin API - - This file defines the API for plugins that work on the client side -*/ -#define MYSQL_CLIENT_PLUGIN_INCLUDED - -/* - On Windows, exports from DLL need to be declared - Also, plugin needs to be declared as extern "C" because MSVC - unlike other compilers, uses C++ mangling for variables not only - for functions. -*/ -#undef MYSQL_PLUGIN_EXPORT -#if defined(_MSC_VER) - #define MYSQL_PLUGIN_EXPORT_C __declspec(dllexport) -#else /*_MSC_VER */ - #define MYSQL_PLUGIN_EXPORT_C -#endif -#ifdef __cplusplus -#define MYSQL_PLUGIN_EXPORT extern "C" MYSQL_PLUGIN_EXPORT_C -#define C_MODE_START extern "C" { -#define C_MODE_END } -#else -#define MYSQL_PLUGIN_EXPORT MYSQL_PLUGIN_EXPORT_C -#define C_MODE_START -#define C_MODE_END -#endif - -#ifndef MYSQL_ABI_CHECK -#include -#include -#endif - -/* known plugin types */ -#define MYSQL_CLIENT_reserved1 0 -#define MYSQL_CLIENT_reserved2 1 -#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2 - -#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0100 - -#define MYSQL_CLIENT_MAX_PLUGINS 3 - -#define mysql_declare_client_plugin(X) \ - C_MODE_START MYSQL_PLUGIN_EXPORT_C \ - struct st_mysql_client_plugin_ ## X \ - _mysql_client_plugin_declaration_ = { \ - MYSQL_CLIENT_ ## X ## _PLUGIN, \ - MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION, -#define mysql_end_client_plugin }; C_MODE_END - -/* generic plugin header structure */ -#define MYSQL_CLIENT_PLUGIN_HEADER \ - 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)(); \ - int (*options)(const char *option, const void *); - -struct st_mysql_client_plugin -{ - MYSQL_CLIENT_PLUGIN_HEADER -}; - -struct st_mysql; - -/******** authentication plugin specific declarations *********/ -#include - -struct st_mysql_client_plugin_AUTHENTICATION -{ - MYSQL_CLIENT_PLUGIN_HEADER - int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql); -}; - -#include - -/******** using plugins ************/ - -/** - loads a plugin and initializes it - - @param mysql MYSQL structure. - @param name a name of the plugin to load - @param type type of plugin that should be loaded, -1 to disable type check - @param argc number of arguments to pass to the plugin initialization - function - @param ... arguments for the plugin initialization function - - @retval - a pointer to the loaded plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * -mysql_load_plugin(struct st_mysql *mysql, const char *name, int type, - int argc, ...); - -/** - loads a plugin and initializes it, taking va_list as an argument - - This is the same as mysql_load_plugin, but take va_list instead of - a list of arguments. - - @param mysql MYSQL structure. - @param name a name of the plugin to load - @param type type of plugin that should be loaded, -1 to disable type check - @param argc number of arguments to pass to the plugin initialization - function - @param args arguments for the plugin initialization function - - @retval - a pointer to the loaded plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * -mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type, - int argc, va_list args); - -/** - finds an already loaded plugin by name, or loads it, if necessary - - @param mysql MYSQL structure. - @param name a name of the plugin to load - @param type type of plugin that should be loaded - - @retval - a pointer to the plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * -mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type); - -/** - adds a plugin structure to the list of loaded plugins - - This is useful if an application has the necessary functionality - (for example, a special load data handler) statically linked into - the application binary. It can use this function to register the plugin - directly, avoiding the need to factor it out into a shared object. - - @param mysql MYSQL structure. It is only used for error reporting - @param plugin an st_mysql_client_plugin structure to register - - @retval - a pointer to the plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * -mysql_client_register_plugin(struct st_mysql *mysql, - struct st_mysql_client_plugin *plugin); - -/** - set plugin options - - Can be used to set extra options and affect behavior for a plugin. - This function may be called multiple times to set several options - - @param plugin an st_mysql_client_plugin structure - @param option a string which specifies the option to set - @param value value for the option. - - @retval 0 on success, 1 in case of failure -**/ -int mysql_plugin_options(struct st_mysql_client_plugin *plugin, - const char *option, const void *value); -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin.h deleted file mode 100644 index 07e7597..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin.h +++ /dev/null @@ -1,767 +0,0 @@ -/* Copyright (c) 2005, 2013, Oracle and/or its affiliates - Copyright (C) 2009, 2017, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_PLUGIN_INCLUDED -#define MYSQL_PLUGIN_INCLUDED - -/* - On Windows, exports from DLL need to be declared - Also, plugin needs to be declared as extern "C" because MSVC - unlike other compilers, uses C++ mangling for variables not only - for functions. -*/ -#ifdef MYSQL_DYNAMIC_PLUGIN - #ifdef _MSC_VER - #define MYSQL_DLLEXPORT _declspec(dllexport) - #else - #define MYSQL_DLLEXPORT - #endif -#else - #define MYSQL_DLLEXPORT -#endif - -#ifdef __cplusplus - #define MYSQL_PLUGIN_EXPORT extern "C" MYSQL_DLLEXPORT -#else - #define MYSQL_PLUGIN_EXPORT MYSQL_DLLEXPORT -#endif - -#ifdef __cplusplus -class THD; -class Item; -#define MYSQL_THD THD* -#else -#define MYSQL_THD void* -#endif - -typedef char my_bool; -typedef void * MYSQL_PLUGIN; - -#include - -#define MYSQL_XIDDATASIZE 128 -/** - struct st_mysql_xid is binary compatible with the XID structure as - in the X/Open CAE Specification, Distributed Transaction Processing: - The XA Specification, X/Open Company Ltd., 1991. - http://www.opengroup.org/bookstore/catalog/c193.htm - - @see XID in sql/handler.h -*/ -struct st_mysql_xid { - long formatID; - long gtrid_length; - long bqual_length; - char data[MYSQL_XIDDATASIZE]; /* Not \0-terminated */ -}; -typedef struct st_mysql_xid MYSQL_XID; - -/************************************************************************* - Plugin API. Common for all plugin types. -*/ - -/* MySQL plugin interface version */ -#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104 - -/* MariaDB plugin interface version */ -#define MARIA_PLUGIN_INTERFACE_VERSION 0x010e - -/* - The allowable types of plugins -*/ -#define MYSQL_UDF_PLUGIN 0 /* not implemented */ -#define MYSQL_STORAGE_ENGINE_PLUGIN 1 -#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */ -#define MYSQL_DAEMON_PLUGIN 3 -#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 -#define MYSQL_AUDIT_PLUGIN 5 -#define MYSQL_REPLICATION_PLUGIN 6 -#define MYSQL_AUTHENTICATION_PLUGIN 7 -#define MYSQL_MAX_PLUGIN_TYPE_NUM 12 /* The number of plugin types */ - -/* MariaDB plugin types */ -#define MariaDB_PASSWORD_VALIDATION_PLUGIN 8 -#define MariaDB_ENCRYPTION_PLUGIN 9 -#define MariaDB_DATA_TYPE_PLUGIN 10 -#define MariaDB_FUNCTION_PLUGIN 11 - -/* We use the following strings to define licenses for plugins */ -#define PLUGIN_LICENSE_PROPRIETARY 0 -#define PLUGIN_LICENSE_GPL 1 -#define PLUGIN_LICENSE_BSD 2 - -#define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY" -#define PLUGIN_LICENSE_GPL_STRING "GPL" -#define PLUGIN_LICENSE_BSD_STRING "BSD" - -/* definitions of code maturity for plugins */ -#define MariaDB_PLUGIN_MATURITY_UNKNOWN 0 -#define MariaDB_PLUGIN_MATURITY_EXPERIMENTAL 1 -#define MariaDB_PLUGIN_MATURITY_ALPHA 2 -#define MariaDB_PLUGIN_MATURITY_BETA 3 -#define MariaDB_PLUGIN_MATURITY_GAMMA 4 -#define MariaDB_PLUGIN_MATURITY_STABLE 5 - -/* - Macros for beginning and ending plugin declarations. Between - mysql_declare_plugin and mysql_declare_plugin_end there should - be a st_mysql_plugin struct for each plugin to be declared. -*/ - - -#ifndef MYSQL_DYNAMIC_PLUGIN -#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ -int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \ -int PSIZE= sizeof(struct st_mysql_plugin); \ -struct st_mysql_plugin DECLS[]= { - -#define MARIA_DECLARE_PLUGIN__(NAME, VERSION, PSIZE, DECLS) \ -MYSQL_PLUGIN_EXPORT int VERSION; \ -int VERSION= MARIA_PLUGIN_INTERFACE_VERSION; \ -MYSQL_PLUGIN_EXPORT int PSIZE; \ -int PSIZE= sizeof(struct st_maria_plugin); \ -MYSQL_PLUGIN_EXPORT struct st_maria_plugin DECLS[]; \ -struct st_maria_plugin DECLS[]= { -#else - -#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ -MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_; \ -int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \ -MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_; \ -int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \ -MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[]; \ -struct st_mysql_plugin _mysql_plugin_declarations_[]= { - -#define MARIA_DECLARE_PLUGIN__(NAME, VERSION, PSIZE, DECLS) \ -MYSQL_PLUGIN_EXPORT int _maria_plugin_interface_version_; \ -int _maria_plugin_interface_version_= MARIA_PLUGIN_INTERFACE_VERSION; \ -MYSQL_PLUGIN_EXPORT int _maria_sizeof_struct_st_plugin_; \ -int _maria_sizeof_struct_st_plugin_= sizeof(struct st_maria_plugin); \ -MYSQL_PLUGIN_EXPORT struct st_maria_plugin _maria_plugin_declarations_[]; \ -struct st_maria_plugin _maria_plugin_declarations_[]= { - -#endif - -#define mysql_declare_plugin(NAME) \ -__MYSQL_DECLARE_PLUGIN(NAME, \ - builtin_ ## NAME ## _plugin_interface_version, \ - builtin_ ## NAME ## _sizeof_struct_st_plugin, \ - builtin_ ## NAME ## _plugin) - -#define maria_declare_plugin(NAME) \ -MARIA_DECLARE_PLUGIN__(NAME, \ - builtin_maria_ ## NAME ## _plugin_interface_version, \ - builtin_maria_ ## NAME ## _sizeof_struct_st_plugin, \ - builtin_maria_ ## NAME ## _plugin) - -#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}} -#define maria_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}} - -/* - declarations for SHOW STATUS support in plugins -*/ -enum enum_mysql_show_type -{ - SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG, - SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, - SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE, - SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC, - SHOW_SIZE_T, SHOW_always_last -}; - -/* backward compatibility mapping. */ -#define SHOW_INT SHOW_UINT -#define SHOW_LONG SHOW_ULONG -#define SHOW_LONGLONG SHOW_ULONGLONG - -enum enum_var_type -{ - SHOW_OPT_DEFAULT= 0, SHOW_OPT_SESSION, SHOW_OPT_GLOBAL -}; - -struct st_mysql_show_var { - const char *name; - void *value; - enum enum_mysql_show_type type; -}; - -struct system_status_var; - -#define SHOW_VAR_FUNC_BUFF_SIZE (256 * sizeof(void*)) -typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); - - -/* - Constants for plugin flags. - */ - -#define PLUGIN_OPT_NO_INSTALL 1UL /* Not dynamically loadable */ -#define PLUGIN_OPT_NO_UNINSTALL 2UL /* Not dynamically unloadable */ - - -/* - declarations for server variables and command line options -*/ - - -#define PLUGIN_VAR_BOOL 0x0001 -#define PLUGIN_VAR_INT 0x0002 -#define PLUGIN_VAR_LONG 0x0003 -#define PLUGIN_VAR_LONGLONG 0x0004 -#define PLUGIN_VAR_STR 0x0005 -#define PLUGIN_VAR_ENUM 0x0006 -#define PLUGIN_VAR_SET 0x0007 -#define PLUGIN_VAR_DOUBLE 0x0008 -#define PLUGIN_VAR_UNSIGNED 0x0080 -#define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */ -#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */ -#define PLUGIN_VAR_NOSYSVAR 0x0400 /* Not a server variable */ -#define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */ -#define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */ -#define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */ -#define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */ -#define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */ - -struct st_mysql_sys_var; -struct st_mysql_value; - -/* - SYNOPSIS - (*mysql_var_check_func)() - thd thread handle - var dynamic variable being altered - save pointer to temporary storage - value user provided value - RETURN - 0 user provided value is OK and the update func may be called. - any other value indicates error. - - This function should parse the user provided value and store in the - provided temporary storage any data as required by the update func. - There is sufficient space in the temporary storage to store a double. - Note that the update func may not be called if any other error occurs - so any memory allocated should be thread-local so that it may be freed - automatically at the end of the statement. -*/ - -typedef int (*mysql_var_check_func)(MYSQL_THD thd, - struct st_mysql_sys_var *var, - void *save, struct st_mysql_value *value); - -/* - SYNOPSIS - (*mysql_var_update_func)() - thd thread handle - var dynamic variable being altered - var_ptr pointer to dynamic variable - save pointer to temporary storage - RETURN - NONE - - This function should use the validated value stored in the temporary store - and persist it in the provided pointer to the dynamic variable. - For example, strings may require memory to be allocated. -*/ -typedef void (*mysql_var_update_func)(MYSQL_THD thd, - struct st_mysql_sys_var *var, - void *var_ptr, const void *save); - - -/* the following declarations are for internal use only */ - - -#define PLUGIN_VAR_MASK \ - (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \ - PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \ - PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC) - -#define MYSQL_PLUGIN_VAR_HEADER \ - int flags; \ - const char *name; \ - const char *comment; \ - mysql_var_check_func check; \ - mysql_var_update_func update - -#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name -#define MYSQL_SYSVAR(name) \ - ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name))) - -/* - for global variables, the value pointer is the first - element after the header, the default value is the second. - for thread variables, the value offset is the first - element after the header, the default value is the second. -*/ - - -#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - type *value; \ - const type def_val; \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - type *value; type def_val; \ - type min_val; type max_val; \ - type blk_sz; \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - type *value; type def_val; \ - TYPELIB *typelib; \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_THDVAR_FUNC(type) \ - type *(*resolve)(MYSQL_THD thd, int offset) - -#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - int offset; \ - const type def_val; \ - DECLARE_THDVAR_FUNC(type); \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - int offset; \ - type def_val; type min_val; \ - type max_val; type blk_sz; \ - DECLARE_THDVAR_FUNC(type); \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - int offset; \ - const type def_val; \ - DECLARE_THDVAR_FUNC(type); \ - TYPELIB *typelib; \ -} MYSQL_SYSVAR_NAME(name) - - -/* - the following declarations are for use by plugin implementors -*/ - -#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \ -DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \ - PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def} - -#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \ -DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \ - PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def} - -#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \ - PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \ - PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \ - PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \ - PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \ - PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_UINT64_T(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, uint64_t) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#ifdef _WIN64 -#define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } -#else -#define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \ - PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } -#endif - -#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \ -DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \ - PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, typelib } - -#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \ -DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \ - PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, typelib } - -#define MYSQL_SYSVAR_DOUBLE(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, double) = { \ - PLUGIN_VAR_DOUBLE | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \ -DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \ - PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, NULL} - -#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \ -DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \ - PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, NULL} - -#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \ - PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \ - PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \ - PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \ - PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \ -DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \ - PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, NULL, typelib } - -#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \ -DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \ - PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, NULL, typelib } - -#define MYSQL_THDVAR_DOUBLE(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, double) = { \ - PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -/* accessor macros */ - -#define SYSVAR(name) \ - (*(MYSQL_SYSVAR_NAME(name).value)) - -/* when thd == null, result points to global value */ -#define THDVAR(thd, name) \ - (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset))) - - -/* - Plugin description structure. -*/ - -struct st_mysql_plugin -{ - int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - void *info; /* pointer to type-specific plugin descriptor */ - const char *name; /* plugin name */ - const char *author; /* plugin author (for I_S.PLUGINS) */ - const char *descr; /* general descriptive text (for I_S.PLUGINS) */ - int license; /* the plugin license (PLUGIN_LICENSE_XXX) */ - int (*init)(void *); /* the function to invoke when plugin is loaded */ - int (*deinit)(void *);/* the function to invoke when plugin is unloaded */ - unsigned int version; /* plugin version (for I_S.PLUGINS) */ - struct st_mysql_show_var *status_vars; - struct st_mysql_sys_var **system_vars; - void * __reserved1; /* reserved for dependency checking */ - unsigned long flags; /* flags for plugin */ -}; - -/* - MariaDB extension for plugins declaration structure. - - It also copy current MySQL plugin fields to have more independency - in plugins extension -*/ - -struct st_maria_plugin -{ - int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - void *info; /* pointer to type-specific plugin descriptor */ - const char *name; /* plugin name */ - const char *author; /* plugin author (for SHOW PLUGINS) */ - const char *descr; /* general descriptive text (for SHOW PLUGINS ) */ - int license; /* the plugin license (PLUGIN_LICENSE_XXX) */ - int (*init)(void *); /* the function to invoke when plugin is loaded */ - int (*deinit)(void *);/* the function to invoke when plugin is unloaded */ - unsigned int version; /* plugin version (for SHOW PLUGINS) */ - struct st_mysql_show_var *status_vars; - struct st_mysql_sys_var **system_vars; - const char *version_info; /* plugin version string */ - unsigned int maturity; /* MariaDB_PLUGIN_MATURITY_XXX */ -}; - -/************************************************************************* - API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) -*/ -#include "plugin_ftparser.h" - -/************************************************************************* - API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN) -*/ - -/* handlertons of different MySQL releases are incompatible */ -#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) - -/* - Here we define only the descriptor structure, that is referred from - st_mysql_plugin. -*/ - -struct st_mysql_daemon -{ - int interface_version; -}; - - -/************************************************************************* - API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN) -*/ - -/* handlertons of different MySQL releases are incompatible */ -#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) - -/* - Here we define only the descriptor structure, that is referred from - st_mysql_plugin. -*/ - -struct st_mysql_information_schema -{ - int interface_version; -}; - - -/************************************************************************* - API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN) -*/ - -/* handlertons of different MySQL releases are incompatible */ -#define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) - -/* - The real API is in the sql/handler.h - Here we define only the descriptor structure, that is referred from - st_mysql_plugin. -*/ - -struct st_mysql_storage_engine -{ - int interface_version; -}; - -struct handlerton; - - -/* - API for Replication plugin. (MYSQL_REPLICATION_PLUGIN) -*/ - #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0200 - - /** - Replication plugin descriptor - */ - struct Mysql_replication { - int interface_version; - }; - -/************************************************************************* - st_mysql_value struct for reading values from mysqld. - Used by server variables framework to parse user-provided values. - Will be used for arguments when implementing UDFs. - - Note that val_str() returns a string in temporary memory - that will be freed at the end of statement. Copy the string - if you need it to persist. -*/ - -#define MYSQL_VALUE_TYPE_STRING 0 -#define MYSQL_VALUE_TYPE_REAL 1 -#define MYSQL_VALUE_TYPE_INT 2 - -struct st_mysql_value -{ - int (*value_type)(struct st_mysql_value *); - const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); - int (*val_real)(struct st_mysql_value *, double *realbuf); - int (*val_int)(struct st_mysql_value *, long long *intbuf); - int (*is_unsigned)(struct st_mysql_value *); -}; - - -/************************************************************************* - Miscellaneous functions for plugin implementors -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -int thd_in_lock_tables(const MYSQL_THD thd); -int thd_tablespace_op(const MYSQL_THD thd); -long long thd_test_options(const MYSQL_THD thd, long long test_options); -int thd_sql_command(const MYSQL_THD thd); -void thd_storage_lock_wait(MYSQL_THD thd, long long value); -int thd_tx_isolation(const MYSQL_THD thd); -int thd_tx_is_read_only(const MYSQL_THD thd); -/** - Create a temporary file. - - @details - The temporary file is created in a location specified by the mysql - server configuration (--tmpdir option). The caller does not need to - delete the file, it will be deleted automatically. - - @param prefix prefix for temporary file name - @retval -1 error - @retval >= 0 a file handle that can be passed to dup or my_close -*/ -int mysql_tmpfile(const char *prefix); - -/** - Return the thread id of a user thread - - @param thd user thread connection handle - @return thread id -*/ -unsigned long thd_get_thread_id(const MYSQL_THD thd); - -/** - Get the XID for this connection's transaction - - @param thd user thread connection handle - @param xid location where identifier is stored -*/ -void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid); - -/** - Invalidate the query cache for a given table. - - @param thd user thread connection handle - @param key databasename\\0tablename\\0 - @param key_length length of key in bytes, including the NUL bytes - @param using_trx flag: TRUE if using transactions, FALSE otherwise -*/ -void mysql_query_cache_invalidate4(MYSQL_THD thd, - const char *key, unsigned int key_length, - int using_trx); - - -/** - Provide a handler data getter to simplify coding -*/ -void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton); - - -/** - Provide a handler data setter to simplify coding - - @details - Set ha_data pointer (storage engine per-connection information). - - To avoid unclean deactivation (uninstall) of storage engine plugin - in the middle of transaction, additional storage engine plugin - lock is acquired. - - If ha_data is not null and storage engine plugin was not locked - by thd_set_ha_data() in this connection before, storage engine - plugin gets locked. - - If ha_data is null and storage engine plugin was locked by - thd_set_ha_data() in this connection before, storage engine - plugin lock gets released. - - If handlerton::close_connection() didn't reset ha_data, server does - it immediately after calling handlerton::close_connection(). -*/ -void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton, - const void *ha_data); - - -/** - Signal that the first part of handler commit is finished, and that the - committed transaction is now visible and has fixed commit ordering with - respect to other transactions. The commit need _not_ be durable yet, and - typically will not be when this call makes sense. - - This call is optional, if the storage engine does not call it the upper - layer will after the handler commit() method is done. However, the storage - engine may choose to call it itself to increase the possibility for group - commit. - - In-order parallel replication uses this to apply different transaction in - parallel, but delay the commits of later transactions until earlier - transactions have committed first, thus achieving increased performance on - multi-core systems while still preserving full transaction consistency. - - The storage engine can call this from within the commit() method, typically - after the commit record has been written to the transaction log, but before - the log has been fsync()'ed. This will allow the next replicated transaction - to proceed to commit before the first one has done fsync() or similar. Thus, - it becomes possible for multiple sequential replicated transactions to share - a single fsync() inside the engine in group commit. - - Note that this method should _not_ be called from within the commit_ordered() - method, or any other place in the storage engine. When commit_ordered() is - used (typically when binlog is enabled), the transaction coordinator takes - care of this and makes group commit in the storage engine possible without - any other action needed on the part of the storage engine. This function - thd_wakeup_subsequent_commits() is only needed when no transaction - coordinator is used, meaning a single storage engine and no binary log. -*/ -void thd_wakeup_subsequent_commits(MYSQL_THD thd, int wakeup_error); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_audit.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_audit.h deleted file mode 100644 index e99c013..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_audit.h +++ /dev/null @@ -1,180 +0,0 @@ -/* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_audit_h -#define _my_audit_h - -/************************************************************************* - API for Audit plugin. (MYSQL_AUDIT_PLUGIN) -*/ - -#include "plugin.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define MYSQL_AUDIT_CLASS_MASK_SIZE 1 - -#define MYSQL_AUDIT_INTERFACE_VERSION 0x0302 - - -/************************************************************************* - AUDIT CLASS : GENERAL - - LOG events occurs before emitting to the general query log. - ERROR events occur before transmitting errors to the user. - RESULT events occur after transmitting a resultset to the user. - STATUS events occur after transmitting a resultset or errors - to the user. -*/ - -#define MYSQL_AUDIT_GENERAL_CLASS 0 -#define MYSQL_AUDIT_GENERAL_CLASSMASK (1 << MYSQL_AUDIT_GENERAL_CLASS) -#define MYSQL_AUDIT_GENERAL_LOG 0 -#define MYSQL_AUDIT_GENERAL_ERROR 1 -#define MYSQL_AUDIT_GENERAL_RESULT 2 -#define MYSQL_AUDIT_GENERAL_STATUS 3 - -struct mysql_event_general -{ - unsigned int event_subclass; - int general_error_code; - unsigned long general_thread_id; - const char *general_user; - unsigned int general_user_length; - const char *general_command; - unsigned int general_command_length; - const char *general_query; - unsigned int general_query_length; - const struct charset_info_st *general_charset; - unsigned long long general_time; - unsigned long long general_rows; - /* Added in version 0x302 */ - unsigned long long query_id; - MYSQL_CONST_LEX_STRING database; -}; - - -/* - AUDIT CLASS : CONNECTION - - CONNECT occurs after authentication phase is completed. - DISCONNECT occurs after connection is terminated. - CHANGE_USER occurs after COM_CHANGE_USER RPC is completed. -*/ - -#define MYSQL_AUDIT_CONNECTION_CLASS 1 -#define MYSQL_AUDIT_CONNECTION_CLASSMASK (1 << MYSQL_AUDIT_CONNECTION_CLASS) -#define MYSQL_AUDIT_CONNECTION_CONNECT 0 -#define MYSQL_AUDIT_CONNECTION_DISCONNECT 1 -#define MYSQL_AUDIT_CONNECTION_CHANGE_USER 2 - -struct mysql_event_connection -{ - unsigned int event_subclass; - int status; - unsigned long thread_id; - const char *user; - unsigned int user_length; - const char *priv_user; - unsigned int priv_user_length; - const char *external_user; - unsigned int external_user_length; - const char *proxy_user; - unsigned int proxy_user_length; - const char *host; - unsigned int host_length; - const char *ip; - unsigned int ip_length; - MYSQL_CONST_LEX_STRING database; -}; - -/* - AUDIT CLASS : TABLE - - LOCK occurs when a connection "locks" (this does not necessarily mean a table - lock and also happens for row-locking engines) the table at the beginning of - a statement. This event is generated at the beginning of every statement for - every affected table, unless there's a LOCK TABLES statement in effect (in - which case it is generated once for LOCK TABLES and then is suppressed until - the tables are unlocked). - - CREATE/DROP/RENAME occur when a table is created, dropped, or renamed. -*/ - -#define MYSQL_AUDIT_TABLE_CLASS 15 -#define MYSQL_AUDIT_TABLE_CLASSMASK (1 << MYSQL_AUDIT_TABLE_CLASS) -#define MYSQL_AUDIT_TABLE_LOCK 0 -#define MYSQL_AUDIT_TABLE_CREATE 1 -#define MYSQL_AUDIT_TABLE_DROP 2 -#define MYSQL_AUDIT_TABLE_RENAME 3 -#define MYSQL_AUDIT_TABLE_ALTER 4 - -struct mysql_event_table -{ - unsigned int event_subclass; - unsigned long thread_id; - const char *user; - const char *priv_user; - const char *priv_host; - const char *external_user; - const char *proxy_user; - const char *host; - const char *ip; - MYSQL_CONST_LEX_STRING database; - MYSQL_CONST_LEX_STRING table; - /* for MYSQL_AUDIT_TABLE_RENAME */ - MYSQL_CONST_LEX_STRING new_database; - MYSQL_CONST_LEX_STRING new_table; - /* for MYSQL_AUDIT_TABLE_LOCK, true if read-only, false if read/write */ - int read_only; - /* Added in version 0x302 */ - unsigned long long query_id; -}; - -/************************************************************************* - Here we define the descriptor structure, that is referred from - st_mysql_plugin. - - release_thd() event occurs when the event class consumer is to be - disassociated from the specified THD. This would typically occur - before some operation which may require sleeping - such as when - waiting for the next query from the client. - - event_notify() is invoked whenever an event occurs which is of any - class for which the plugin has interest. The second argument - indicates the specific event class and the third argument is data - as required for that class. - - class_mask is an array of bits used to indicate what event classes - that this plugin wants to receive. -*/ - -struct st_mysql_audit -{ - int interface_version; - void (*release_thd)(MYSQL_THD); - void (*event_notify)(MYSQL_THD, unsigned int, const void *); - unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE]; -}; - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_auth.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_auth.h deleted file mode 100644 index ae9c936..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_auth.h +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef MYSQL_PLUGIN_AUTH_INCLUDED -/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab - Copyright (c) 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - Authentication Plugin API. - - This file defines the API for server authentication plugins. -*/ - -#define MYSQL_PLUGIN_AUTH_INCLUDED - -#include - -#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0202 - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* defines for MYSQL_SERVER_AUTH_INFO.password_used */ - -#define PASSWORD_USED_NO 0 -#define PASSWORD_USED_YES 1 -#define PASSWORD_USED_NO_MENTION 2 - - -/** - Provides server plugin access to authentication information -*/ -typedef struct st_mysql_server_auth_info -{ - /** - User name as sent by the client and shown in USER(). - NULL if the client packet with the user name was not received yet. - */ - const char *user_name; - - /** - Length of user_name - */ - unsigned int user_name_length; - - /** - A corresponding column value from the mysql.user table for the - matching account name or the preprocessed value, if preprocess_hash - method is not NULL - */ - const char *auth_string; - - /** - Length of auth_string - */ - unsigned long auth_string_length; - - /** - Matching account name as found in the mysql.user table. - A plugin can override it with another name that will be - used by MySQL for authorization, and shown in CURRENT_USER() - */ - char authenticated_as[MYSQL_USERNAME_LENGTH+1]; - - - /** - The unique user name that was used by the plugin to authenticate. - Not used by the server. - Available through the @@EXTERNAL_USER variable. - */ - char external_user[MYSQL_USERNAME_LENGTH+1]; - - /** - This only affects the "Authentication failed. Password used: %s" - error message. has the following values : - 0 : %s will be NO. - 1 : %s will be YES. - 2 : there will be no %s. - Set it as appropriate or ignore at will. - */ - int password_used; - - /** - Set to the name of the connected client host, if it can be resolved, - or to its IP address otherwise. - */ - const char *host_or_ip; - - /** - Length of host_or_ip - */ - unsigned int host_or_ip_length; - - /** - Current THD pointer (to use with various services) - */ - MYSQL_THD thd; - -} MYSQL_SERVER_AUTH_INFO; - -/** - Server authentication plugin descriptor -*/ -struct st_mysql_auth -{ - int interface_version; /**< version plugin uses */ - /** - A plugin that a client must use for authentication with this server - plugin. Can be NULL to mean "any plugin". - */ - const char *client_auth_plugin; - /** - Function provided by the plugin which should perform authentication (using - the vio functions if necessary) and return 0 if successful. The plugin can - also fill the info.authenticated_as field if a different username should be - used for authorization. - */ - int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); - /** - Create a password hash (or digest) out of a plain-text password - - Used in SET PASSWORD, GRANT, and CREATE USER to convert user specified - plain-text password into a value that will be stored in mysql.user table. - - @see preprocess_hash - - @param password plain-text password - @param password_length plain-text password length - @param hash the digest will be stored there - @param hash_length in: hash buffer size - out: the actual length of the hash - - @return 0 for ok, 1 for error - - Can be NULL. - */ - int (*hash_password)(const char *password, size_t password_length, - char *hash, size_t *hash_length); - - /** - Prepare the password hash for authentication. - - Password hash is stored in the authentication_string column of the - mysql.user table in a text form. If a plugin needs to preprocess the - value somehow before the authentication (e.g. convert from hex or base64 - to binary), it can do it in this method. This way the conversion - will happen only once, not for every authentication attempt. - - The value written to the out buffer will be cached and later made - available to the authenticate_user() method in the - MYSQL_SERVER_AUTH_INFO::auth_string[] buffer. - - @return 0 for ok, 1 for error - - Can be NULL, in this case the mysql.user.authentication_string value will - be given to the authenticate_user() method as is, unconverted. - */ - int (*preprocess_hash)(const char *hash, size_t hash_length, - unsigned char *out, size_t *out_length); -}; - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_auth_common.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_auth_common.h deleted file mode 100644 index 8edd712..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_auth_common.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED -/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab - Copyright (c) 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef _WIN32 -#include -#endif - -/** - @file - - This file defines constants and data structures that are the same for - both client- and server-side authentication plugins. -*/ -#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED - -/** the max allowed length for a user name */ -#define MYSQL_USERNAME_LENGTH 512 - -/** - return values of the plugin authenticate_user() method. -*/ - - /** - Authentication failed, plugin internal error. - An error occurred in the authentication plugin itself. - These errors are reported in table performance_schema.host_cache, - column COUNT_AUTH_PLUGIN_ERRORS. -*/ -#define CR_AUTH_PLUGIN_ERROR 3 -/** - Authentication failed, client server handshake. - An error occurred during the client server handshake. - These errors are reported in table performance_schema.host_cache, - column COUNT_HANDSHAKE_ERRORS. -*/ -#define CR_AUTH_HANDSHAKE 2 -/** - Authentication failed, user credentials. - For example, wrong passwords. - These errors are reported in table performance_schema.host_cache, - column COUNT_AUTHENTICATION_ERRORS. -*/ -#define CR_AUTH_USER_CREDENTIALS 1 -/** - Authentication failed. Additionally, all other CR_xxx values - (libmysql error code) can be used too. - - The client plugin may set the error code and the error message directly - in the MYSQL structure and return CR_ERROR. If a CR_xxx specific error - code was returned, an error message in the MYSQL structure will be - overwritten. If CR_ERROR is returned without setting the error in MYSQL, - CR_UNKNOWN_ERROR will be user. -*/ -#define CR_ERROR 0 -/** - Authentication (client part) was successful. It does not mean that the - authentication as a whole was successful, usually it only means - that the client was able to send the user name and the password to the - server. If CR_OK is returned, the libmysql reads the next packet expecting - it to be one of OK, ERROR, or CHANGE_PLUGIN packets. -*/ -#define CR_OK -1 -/** - Authentication was successful. - It means that the client has done its part successfully and also that - a plugin has read the last packet (one of OK, ERROR, CHANGE_PLUGIN). - In this case, libmysql will not read a packet from the server, - but it will use the data at mysql->net.read_pos. - - A plugin may return this value if the number of roundtrips in the - authentication protocol is not known in advance, and the client plugin - needs to read one packet more to determine if the authentication is finished - or not. -*/ -#define CR_OK_HANDSHAKE_COMPLETE -2 - -typedef struct st_plugin_vio_info -{ - enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, - MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol; - int socket; /**< it's set, if the protocol is SOCKET or TCP */ -#ifdef _WIN32 - HANDLE handle; /**< it's set, if the protocol is PIPE or MEMORY */ -#endif -} MYSQL_PLUGIN_VIO_INFO; - -/** - Provides plugin access to communication channel -*/ -typedef struct st_plugin_vio -{ - /** - Plugin provides a pointer reference and this function sets it to the - contents of any incoming packet. Returns the packet length, or -1 if - the plugin should terminate. - */ - int (*read_packet)(struct st_plugin_vio *vio, - unsigned char **buf); - - /** - Plugin provides a buffer with data and the length and this - function sends it as a packet. Returns 0 on success, 1 on failure. - */ - int (*write_packet)(struct st_plugin_vio *vio, - const unsigned char *packet, - int packet_len); - - /** - Fills in a st_plugin_vio_info structure, providing the information - about the connection. - */ - void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info); - -} MYSQL_PLUGIN_VIO; - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_data_type.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_data_type.h deleted file mode 100644 index 77aa9fb..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_data_type.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef MARIADB_PLUGIN_DATA_TYPE_INCLUDED -#define MARIADB_PLUGIN_DATA_TYPE_INCLUDED -/* Copyright (C) 2019, Alexander Barkov and MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - Data Type Plugin API. - - This file defines the API for server plugins that manage data types. -*/ - -#ifdef __cplusplus - -#include - -/* - API for data type plugins. (MariaDB_DATA_TYPE_PLUGIN) -*/ -#define MariaDB_DATA_TYPE_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) - - -struct st_mariadb_data_type -{ - int interface_version; - class Type_handler *type_handler; -}; - - -/** - Data type plugin descriptor -*/ - -#endif /* __cplusplus */ - -#endif /* MARIADB_PLUGIN_DATA_TYPE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_encryption.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_encryption.h deleted file mode 100644 index 3c574aa..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_encryption.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef MYSQL_PLUGIN_ENCRYPTION_INCLUDED -/* Copyright (C) 2014, 2015 Sergei Golubchik and MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - Encryption Plugin API. - - This file defines the API for server plugins that manage encryption - keys for MariaDB on-disk data encryption. -*/ - -#define MYSQL_PLUGIN_ENCRYPTION_INCLUDED - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define MariaDB_ENCRYPTION_INTERFACE_VERSION 0x0300 - -/** - Encryption plugin descriptor -*/ -struct st_mariadb_encryption -{ - int interface_version; /**< version plugin uses */ - - /*********** KEY MANAGEMENT ********************************************/ - - /** - function returning latest key version for a given key id - - @return a version or ENCRYPTION_KEY_VERSION_INVALID to indicate an error. - */ - unsigned int (*get_latest_key_version)(unsigned int key_id); - - /** - function returning a key for a key version - - @param version the requested key version - @param key the key will be stored there. Can be NULL - - in which case no key will be returned - @param key_length in: key buffer size - out: the actual length of the key - - This method can be used to query the key length - the required - buffer size - by passing key==NULL. - - If the buffer size is less than the key length the content of the - key buffer is undefined (the plugin is free to partially fill it with - the key data or leave it untouched). - - @return 0 on success, or - ENCRYPTION_KEY_VERSION_INVALID, ENCRYPTION_KEY_BUFFER_TOO_SMALL - or any other non-zero number for errors - */ - unsigned int (*get_key)(unsigned int key_id, unsigned int version, - unsigned char *key, unsigned int *key_length); - - /*********** ENCRYPTION ************************************************/ - /* - the caller uses encryption as follows: - 1. create the encryption context object of the crypt_ctx_size() bytes. - 2. initialize it with crypt_ctx_init(). - 3. repeat crypt_ctx_update() until there are no more data to encrypt. - 4. write the remaining output bytes and destroy the context object - with crypt_ctx_finish(). - */ - - /** - returns the size of the encryption context object in bytes - */ - unsigned int (*crypt_ctx_size)(unsigned int key_id, unsigned int key_version); - /** - initializes the encryption context object. - */ - int (*crypt_ctx_init)(void *ctx, const unsigned char* key, unsigned int klen, - const unsigned char* iv, unsigned int ivlen, - int flags, unsigned int key_id, - unsigned int key_version); - /** - processes (encrypts or decrypts) a chunk of data - - writes the output to th dst buffer. note that it might write - more bytes that were in the input. or less. or none at all. - */ - int (*crypt_ctx_update)(void *ctx, const unsigned char* src, unsigned int slen, - unsigned char* dst, unsigned int* dlen); - /** - writes the remaining output bytes and destroys the encryption context - - crypt_ctx_update might've cached part of the output in the context, - this method will flush these data out. - */ - int (*crypt_ctx_finish)(void *ctx, unsigned char* dst, unsigned int* dlen); - /** - returns the length of the encrypted data - - it returns the exact length, given only the source length. - which means, this API only supports encryption algorithms where - the length of the encrypted data only depends on the length of the - input (a.k.a. compression is not supported). - */ - unsigned int (*encrypted_length)(unsigned int slen, unsigned int key_id, unsigned int key_version); -}; - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_ftparser.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_ftparser.h deleted file mode 100644 index 99bb6b2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_ftparser.h +++ /dev/null @@ -1,220 +0,0 @@ -/* Copyright (c) 2005 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_plugin_ftparser_h -#define _my_plugin_ftparser_h -#include "plugin.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/************************************************************************* - API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) -*/ - -#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0100 - -/* Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode */ -enum enum_ftparser_mode -{ -/* - Fast and simple mode. This mode is used for indexing, and natural - language queries. - - The parser is expected to return only those words that go into the - index. Stopwords or too short/long words should not be returned. The - 'boolean_info' argument of mysql_add_word() does not have to be set. -*/ - MYSQL_FTPARSER_SIMPLE_MODE= 0, - -/* - Parse with stopwords mode. This mode is used in boolean searches for - "phrase matching." - - The parser is not allowed to ignore words in this mode. Every word - should be returned, including stopwords and words that are too short - or long. The 'boolean_info' argument of mysql_add_word() does not - have to be set. -*/ - MYSQL_FTPARSER_WITH_STOPWORDS= 1, - -/* - Parse in boolean mode. This mode is used to parse a boolean query string. - - The parser should provide a valid MYSQL_FTPARSER_BOOLEAN_INFO - structure in the 'boolean_info' argument to mysql_add_word(). - Usually that means that the parser should recognize boolean operators - in the parsing stream and set appropriate fields in - MYSQL_FTPARSER_BOOLEAN_INFO structure accordingly. As for - MYSQL_FTPARSER_WITH_STOPWORDS mode, no word should be ignored. - Instead, use FT_TOKEN_STOPWORD for the token type of such a word. -*/ - MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2 -}; - -/* - Token types for boolean mode searching (used for the type member of - MYSQL_FTPARSER_BOOLEAN_INFO struct) - - FT_TOKEN_EOF: End of data. - FT_TOKEN_WORD: Regular word. - FT_TOKEN_LEFT_PAREN: Left parenthesis (start of group/sub-expression). - FT_TOKEN_RIGHT_PAREN: Right parenthesis (end of group/sub-expression). - FT_TOKEN_STOPWORD: Stopword. -*/ - -enum enum_ft_token_type -{ - FT_TOKEN_EOF= 0, - FT_TOKEN_WORD= 1, - FT_TOKEN_LEFT_PAREN= 2, - FT_TOKEN_RIGHT_PAREN= 3, - FT_TOKEN_STOPWORD= 4 -}; - -/* - This structure is used in boolean search mode only. It conveys - boolean-mode metadata to the MySQL search engine for every word in - the search query. A valid instance of this structure must be filled - in by the plugin parser and passed as an argument in the call to - mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM - structure) when a query is parsed in boolean mode. - - type: The token type. Should be one of the enum_ft_token_type values. - - yesno: Whether the word must be present for a match to occur: - >0 Must be present - <0 Must not be present - 0 Neither; the word is optional but its presence increases the relevance - With the default settings of the ft_boolean_syntax system variable, - >0 corresponds to the '+' operator, <0 corrresponds to the '-' operator, - and 0 means neither operator was used. - - weight_adjust: A weighting factor that determines how much a match - for the word counts. Positive values increase, negative - decrease the - relative word's importance in the query. - - wasign: The sign of the word's weight in the query. If it's non-negative - the match for the word will increase document relevance, if it's - negative - decrease (the word becomes a "noise word", the less of it the - better). - - trunc: Corresponds to the '*' operator in the default setting of the - ft_boolean_syntax system variable. -*/ - -typedef struct st_mysql_ftparser_boolean_info -{ - enum enum_ft_token_type type; - int yesno; - int weight_adjust; - char wasign; - char trunc; - /* These are parser state and must be removed. */ - char prev; - char *quot; -} MYSQL_FTPARSER_BOOLEAN_INFO; - -/* - The following flag means that buffer with a string (document, word) - may be overwritten by the caller before the end of the parsing (that is - before st_mysql_ftparser::deinit() call). If one needs the string - to survive between two successive calls of the parsing function, she - needs to save a copy of it. The flag may be set by MySQL before calling - st_mysql_ftparser::parse(), or it may be set by a plugin before calling - st_mysql_ftparser_param::mysql_parse() or - st_mysql_ftparser_param::mysql_add_word(). -*/ -#define MYSQL_FTFLAGS_NEED_COPY 1 - -/* - An argument of the full-text parser plugin. This structure is - filled in by MySQL server and passed to the parsing function of the - plugin as an in/out parameter. - - mysql_parse: A pointer to the built-in parser implementation of the - server. It's set by the server and can be used by the parser plugin - to invoke the MySQL default parser. If plugin's role is to extract - textual data from .doc, .pdf or .xml content, it might extract - plaintext from the content, and then pass the text to the default - MySQL parser to be parsed. - - mysql_add_word: A server callback to add a new word. When parsing - a document, the server sets this to point at a function that adds - the word to MySQL full-text index. When parsing a search query, - this function will add the new word to the list of words to search - for. The boolean_info argument can be NULL for all cases except - when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO. - - ftparser_state: A generic pointer. The plugin can set it to point - to information to be used internally for its own purposes. - - mysql_ftparam: This is set by the server. It is used by MySQL functions - called via mysql_parse() and mysql_add_word() callback. The plugin - should not modify it. - - cs: Information about the character set of the document or query string. - - doc: A pointer to the document or query string to be parsed. - - length: Length of the document or query string, in bytes. - - flags: See MYSQL_FTFLAGS_* constants above. - - mode: The parsing mode. With boolean operators, with stopwords, or - nothing. See enum_ftparser_mode above. -*/ - -typedef struct st_mysql_ftparser_param -{ - int (*mysql_parse)(struct st_mysql_ftparser_param *, - const char *doc, int doc_len); - int (*mysql_add_word)(struct st_mysql_ftparser_param *, - const char *word, int word_len, - MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info); - void *ftparser_state; - void *mysql_ftparam; - const struct charset_info_st *cs; - const char *doc; - int length; - unsigned int flags; - enum enum_ftparser_mode mode; -} MYSQL_FTPARSER_PARAM; - -/* - Full-text parser descriptor. - - interface_version is, e.g., MYSQL_FTPARSER_INTERFACE_VERSION. - The parsing, initialization, and deinitialization functions are - invoked per SQL statement for which the parser is used. -*/ - -struct st_mysql_ftparser -{ - int interface_version; - int (*parse)(MYSQL_FTPARSER_PARAM *param); - int (*init)(MYSQL_FTPARSER_PARAM *param); - int (*deinit)(MYSQL_FTPARSER_PARAM *param); -}; - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_function.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_function.h deleted file mode 100644 index 117acd4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_function.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef MARIADB_PLUGIN_FUNCTION_INCLUDED -#define MARIADB_PLUGIN_FUNCTION_INCLUDED -/* Copyright (C) 2019, Alexander Barkov and MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - Function Plugin API. - - This file defines the API for server plugins that manage functions. -*/ - -#ifdef __cplusplus - -#include - -/* - API for function plugins. (MariaDB_FUNCTION_PLUGIN) -*/ -#define MariaDB_FUNCTION_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) - - -class Plugin_function -{ - int m_interface_version; - Create_func *m_builder; -public: - Plugin_function(Create_func *builder) - :m_interface_version(MariaDB_FUNCTION_INTERFACE_VERSION), - m_builder(builder) - { } - Create_func *create_func() - { - return m_builder; - } -}; - - -#endif /* __cplusplus */ - -#endif /* MARIADB_PLUGIN_FUNCTION_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_password_validation.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_password_validation.h deleted file mode 100644 index 23d2c88..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/plugin_password_validation.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef MYSQL_PLUGIN_PASSWORD_VALIDATION_INCLUDED -/* Copyright (C) 2014 Sergei Golubchik and MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - Password Validation Plugin API. - - This file defines the API for server password validation plugins. -*/ - -#define MYSQL_PLUGIN_PASSWORD_VALIDATION_INCLUDED - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION 0x0100 - -/** - Password validation plugin descriptor -*/ -struct st_mariadb_password_validation -{ - int interface_version; /**< version plugin uses */ - /** - Function provided by the plugin which should perform password validation - and return 0 if the password has passed the validation. - */ - int (*validate_password)(const MYSQL_CONST_LEX_STRING *username, - const MYSQL_CONST_LEX_STRING *password); -}; - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_file.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_file.h deleted file mode 100644 index 761482d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_file.h +++ /dev/null @@ -1,1454 +0,0 @@ -/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_FILE_H -#define MYSQL_FILE_H - -/* For strlen() */ -#include -/* For MY_STAT */ -#include -/* For my_chsize */ -#include - -/** - @file mysql/psi/mysql_file.h - Instrumentation helpers for mysys file io. - This header file provides the necessary declarations - to use the mysys file API with the performance schema instrumentation. - In some compilers (SunStudio), 'static inline' functions, when declared - but not used, are not optimized away (because they are unused) by default, - so that including a static inline function from a header file does - create unwanted dependencies, causing unresolved symbols at link time. - Other compilers, like gcc, optimize these dependencies by default. - - Since the instrumented APIs declared here are wrapper on top - of mysys file io APIs, including mysql/psi/mysql_file.h assumes that - the dependency on my_sys already exists. -*/ - -#include "mysql/psi/psi.h" - -#ifndef PSI_FILE_CALL -#define PSI_FILE_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -/** - @defgroup File_instrumentation File Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -/** - @def mysql_file_register(P1, P2, P3) - File registration. -*/ -#define mysql_file_register(P1, P2, P3) \ - inline_mysql_file_register(P1, P2, P3) - -/** - @def mysql_file_fgets(P1, P2, F) - Instrumented fgets. - @c mysql_file_fgets is a replacement for @c fgets. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fgets(P1, P2, F) \ - inline_mysql_file_fgets(__FILE__, __LINE__, P1, P2, F) -#else - #define mysql_file_fgets(P1, P2, F) \ - inline_mysql_file_fgets(P1, P2, F) -#endif - -/** - @def mysql_file_fgetc(F) - Instrumented fgetc. - @c mysql_file_fgetc is a replacement for @c fgetc. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fgetc(F) inline_mysql_file_fgetc(__FILE__, __LINE__, F) -#else - #define mysql_file_fgetc(F) inline_mysql_file_fgetc(F) -#endif - -/** - @def mysql_file_fputs(P1, F) - Instrumented fputs. - @c mysql_file_fputs is a replacement for @c fputs. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fputs(P1, F) \ - inline_mysql_file_fputs(__FILE__, __LINE__, P1, F) -#else - #define mysql_file_fputs(P1, F)\ - inline_mysql_file_fputs(P1, F) -#endif - -/** - @def mysql_file_fputc(P1, F) - Instrumented fputc. - @c mysql_file_fputc is a replacement for @c fputc. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fputc(P1, F) \ - inline_mysql_file_fputc(__FILE__, __LINE__, P1, F) -#else - #define mysql_file_fputc(P1, F) \ - inline_mysql_file_fputc(P1, F) -#endif - -/** - @def mysql_file_fprintf - Instrumented fprintf. - @c mysql_file_fprintf is a replacement for @c fprintf. -*/ -#define mysql_file_fprintf inline_mysql_file_fprintf - -/** - @def mysql_file_vfprintf(F, P1, P2) - Instrumented vfprintf. - @c mysql_file_vfprintf is a replacement for @c vfprintf. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_vfprintf(F, P1, P2) \ - inline_mysql_file_vfprintf(__FILE__, __LINE__, F, P1, P2) -#else - #define mysql_file_vfprintf(F, P1, P2) \ - inline_mysql_file_vfprintf(F, P1, P2) -#endif - -/** - @def mysql_file_fflush(F, P1, P2) - Instrumented fflush. - @c mysql_file_fflush is a replacement for @c fflush. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fflush(F) \ - inline_mysql_file_fflush(__FILE__, __LINE__, F) -#else - #define mysql_file_fflush(F) \ - inline_mysql_file_fflush(F) -#endif - -/** - @def mysql_file_feof(F) - Instrumented feof. - @c mysql_file_feof is a replacement for @c feof. -*/ -#define mysql_file_feof(F) inline_mysql_file_feof(F) - -/** - @def mysql_file_fstat(FN, S, FL) - Instrumented fstat. - @c mysql_file_fstat is a replacement for @c my_fstat. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fstat(FN, S, FL) \ - inline_mysql_file_fstat(__FILE__, __LINE__, FN, S, FL) -#else - #define mysql_file_fstat(FN, S, FL) \ - inline_mysql_file_fstat(FN, S, FL) -#endif - -/** - @def mysql_file_stat(K, FN, S, FL) - Instrumented stat. - @c mysql_file_stat is a replacement for @c my_stat. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_stat(K, FN, S, FL) \ - inline_mysql_file_stat(K, __FILE__, __LINE__, FN, S, FL) -#else - #define mysql_file_stat(K, FN, S, FL) \ - inline_mysql_file_stat(FN, S, FL) -#endif - -/** - @def mysql_file_chsize(F, P1, P2, P3) - Instrumented chsize. - @c mysql_file_chsize is a replacement for @c my_chsize. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_chsize(F, P1, P2, P3) \ - inline_mysql_file_chsize(__FILE__, __LINE__, F, P1, P2, P3) -#else - #define mysql_file_chsize(F, P1, P2, P3) \ - inline_mysql_file_chsize(F, P1, P2, P3) -#endif - -/** - @def mysql_file_fopen(K, N, F1, F2) - Instrumented fopen. - @c mysql_file_fopen is a replacement for @c my_fopen. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fopen(K, N, F1, F2) \ - inline_mysql_file_fopen(K, __FILE__, __LINE__, N, F1, F2) -#else - #define mysql_file_fopen(K, N, F1, F2) \ - inline_mysql_file_fopen(N, F1, F2) -#endif - -/** - @def mysql_file_fclose(FD, FL) - Instrumented fclose. - @c mysql_file_fclose is a replacement for @c my_fclose. - Without the instrumentation, this call will have the same behavior as the - undocumented and possibly platform specific my_fclose(NULL, ...) behavior. - With the instrumentation, mysql_fclose(NULL, ...) will safely return 0, - which is an extension compared to my_fclose and is therefore compliant. - mysql_fclose is on purpose *not* implementing - @code DBUG_ASSERT(file != NULL) @endcode, - since doing so could introduce regressions. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fclose(FD, FL) \ - inline_mysql_file_fclose(__FILE__, __LINE__, FD, FL) -#else - #define mysql_file_fclose(FD, FL) \ - inline_mysql_file_fclose(FD, FL) -#endif - -/** - @def mysql_file_fread(FD, P1, P2, P3) - Instrumented fread. - @c mysql_file_fread is a replacement for @c my_fread. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fread(FD, P1, P2, P3) \ - inline_mysql_file_fread(__FILE__, __LINE__, FD, P1, P2, P3) -#else - #define mysql_file_fread(FD, P1, P2, P3) \ - inline_mysql_file_fread(FD, P1, P2, P3) -#endif - -/** - @def mysql_file_fwrite(FD, P1, P2, P3) - Instrumented fwrite. - @c mysql_file_fwrite is a replacement for @c my_fwrite. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fwrite(FD, P1, P2, P3) \ - inline_mysql_file_fwrite(__FILE__, __LINE__, FD, P1, P2, P3) -#else - #define mysql_file_fwrite(FD, P1, P2, P3) \ - inline_mysql_file_fwrite(FD, P1, P2, P3) -#endif - -/** - @def mysql_file_fseek(FD, P, W, F) - Instrumented fseek. - @c mysql_file_fseek is a replacement for @c my_fseek. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_fseek(FD, P, W, F) \ - inline_mysql_file_fseek(__FILE__, __LINE__, FD, P, W, F) -#else - #define mysql_file_fseek(FD, P, W, F) \ - inline_mysql_file_fseek(FD, P, W, F) -#endif - -/** - @def mysql_file_ftell(FD, F) - Instrumented ftell. - @c mysql_file_ftell is a replacement for @c my_ftell. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_ftell(FD, F) \ - inline_mysql_file_ftell(__FILE__, __LINE__, FD, F) -#else - #define mysql_file_ftell(FD, F) \ - inline_mysql_file_ftell(FD, F) -#endif - -/** - @def mysql_file_create(K, N, F1, F2, F3) - Instrumented create. - @c mysql_file_create is a replacement for @c my_create. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_create(K, N, F1, F2, F3) \ - inline_mysql_file_create(K, __FILE__, __LINE__, N, F1, F2, F3) -#else - #define mysql_file_create(K, N, F1, F2, F3) \ - inline_mysql_file_create(N, F1, F2, F3) -#endif - -/** - @def mysql_file_create_temp(K, T, D, P, M, F) - Instrumented create_temp_file. - @c mysql_file_create_temp is a replacement for @c create_temp_file. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_create_temp(K, T, D, P, M, F) \ - inline_mysql_file_create_temp(K, __FILE__, __LINE__, T, D, P, M, F) -#else - #define mysql_file_create_temp(K, T, D, P, M, F) \ - inline_mysql_file_create_temp(T, D, P, M, F) -#endif - -/** - @def mysql_file_open(K, N, F1, F2) - Instrumented open. - @c mysql_file_open is a replacement for @c my_open. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_open(K, N, F1, F2) \ - inline_mysql_file_open(K, __FILE__, __LINE__, N, F1, F2) -#else - #define mysql_file_open(K, N, F1, F2) \ - inline_mysql_file_open(N, F1, F2) -#endif - -/** - @def mysql_file_close(FD, F) - Instrumented close. - @c mysql_file_close is a replacement for @c my_close. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_close(FD, F) \ - inline_mysql_file_close(__FILE__, __LINE__, FD, F) -#else - #define mysql_file_close(FD, F) \ - inline_mysql_file_close(FD, F) -#endif - -/** - @def mysql_file_read(FD, B, S, F) - Instrumented read. - @c mysql_read is a replacement for @c my_read. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_read(FD, B, S, F) \ - inline_mysql_file_read(__FILE__, __LINE__, FD, B, S, F) -#else - #define mysql_file_read(FD, B, S, F) \ - inline_mysql_file_read(FD, B, S, F) -#endif - -/** - @def mysql_file_write(FD, B, S, F) - Instrumented write. - @c mysql_file_write is a replacement for @c my_write. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_write(FD, B, S, F) \ - inline_mysql_file_write(__FILE__, __LINE__, FD, B, S, F) -#else - #define mysql_file_write(FD, B, S, F) \ - inline_mysql_file_write(FD, B, S, F) -#endif - -/** - @def mysql_file_pread(FD, B, S, O, F) - Instrumented pread. - @c mysql_pread is a replacement for @c my_pread. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_pread(FD, B, S, O, F) \ - inline_mysql_file_pread(__FILE__, __LINE__, FD, B, S, O, F) -#else - #define mysql_file_pread(FD, B, S, O, F) \ - inline_mysql_file_pread(FD, B, S, O, F) -#endif - -/** - @def mysql_file_pwrite(FD, B, S, O, F) - Instrumented pwrite. - @c mysql_file_pwrite is a replacement for @c my_pwrite. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_pwrite(FD, B, S, O, F) \ - inline_mysql_file_pwrite(__FILE__, __LINE__, FD, B, S, O, F) -#else - #define mysql_file_pwrite(FD, B, S, O, F) \ - inline_mysql_file_pwrite(FD, B, S, O, F) -#endif - -/** - @def mysql_file_seek(FD, P, W, F) - Instrumented seek. - @c mysql_file_seek is a replacement for @c my_seek. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_seek(FD, P, W, F) \ - inline_mysql_file_seek(__FILE__, __LINE__, FD, P, W, F) -#else - #define mysql_file_seek(FD, P, W, F) \ - inline_mysql_file_seek(FD, P, W, F) -#endif - -/** - @def mysql_file_tell(FD, F) - Instrumented tell. - @c mysql_file_tell is a replacement for @c my_tell. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_tell(FD, F) \ - inline_mysql_file_tell(__FILE__, __LINE__, FD, F) -#else - #define mysql_file_tell(FD, F) \ - inline_mysql_file_tell(FD, F) -#endif - -/** - @def mysql_file_delete(K, P1, P2) - Instrumented delete. - @c mysql_file_delete is a replacement for @c my_delete. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_delete(K, P1, P2) \ - inline_mysql_file_delete(K, __FILE__, __LINE__, P1, P2) -#else - #define mysql_file_delete(K, P1, P2) \ - inline_mysql_file_delete(P1, P2) -#endif - -/** - @def mysql_file_rename(K, P1, P2, P3) - Instrumented rename. - @c mysql_file_rename is a replacement for @c my_rename. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_rename(K, P1, P2, P3) \ - inline_mysql_file_rename(K, __FILE__, __LINE__, P1, P2, P3) -#else - #define mysql_file_rename(K, P1, P2, P3) \ - inline_mysql_file_rename(P1, P2, P3) -#endif - -/** - @def mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) - Instrumented create with symbolic link. - @c mysql_file_create_with_symlink is a replacement - for @c my_create_with_symlink. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \ - inline_mysql_file_create_with_symlink(K, __FILE__, __LINE__, \ - P1, P2, P3, P4, P5) -#else - #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \ - inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5) -#endif - -/** - @def mysql_file_delete_with_symlink(K, P1, P2, P3) - Instrumented delete with symbolic link. - @c mysql_file_delete_with_symlink is a replacement - for @c my_handler_delete_with_symlink. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_delete_with_symlink(K, P1, P2, P3) \ - inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2, P3) -#else - #define mysql_file_delete_with_symlink(K, P1, P2, P3) \ - inline_mysql_file_delete_with_symlink(P1, P2, P3) -#endif - -/** - @def mysql_file_rename_with_symlink(K, P1, P2, P3) - Instrumented rename with symbolic link. - @c mysql_file_rename_with_symlink is a replacement - for @c my_rename_with_symlink. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_rename_with_symlink(K, P1, P2, P3) \ - inline_mysql_file_rename_with_symlink(K, __FILE__, __LINE__, P1, P2, P3) -#else - #define mysql_file_rename_with_symlink(K, P1, P2, P3) \ - inline_mysql_file_rename_with_symlink(P1, P2, P3) -#endif - -/** - @def mysql_file_sync(P1, P2) - Instrumented file sync. - @c mysql_file_sync is a replacement for @c my_sync. -*/ -#ifdef HAVE_PSI_FILE_INTERFACE - #define mysql_file_sync(P1, P2) \ - inline_mysql_file_sync(__FILE__, __LINE__, P1, P2) -#else - #define mysql_file_sync(P1, P2) \ - inline_mysql_file_sync(P1, P2) -#endif - -/** - An instrumented FILE structure. - @sa MYSQL_FILE -*/ -struct st_mysql_file -{ - /** The real file. */ - FILE *m_file; - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c MYSQL_FILE interface. - */ - struct PSI_file *m_psi; -}; - -/** - Type of an instrumented file. - @c MYSQL_FILE is a drop-in replacement for @c FILE. - @sa mysql_file_open -*/ -typedef struct st_mysql_file MYSQL_FILE; - -static inline void inline_mysql_file_register( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *category, - PSI_file_info *info, - int count -#else - const char *category __attribute__ ((unused)), - void *info __attribute__ ((unused)), - int count __attribute__ ((unused)) -#endif -) -{ -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_FILE_CALL(register_file)(category, info, count); -#endif -} - -static inline char * -inline_mysql_file_fgets( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - char *str, int size, MYSQL_FILE *file) -{ - char *result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_READ); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line); - result= fgets(str, size, file->m_file); - PSI_FILE_CALL(end_file_wait)(locker, result ? strlen(result) : 0); - return result; - } - } -#endif - - result= fgets(str, size, file->m_file); - return result; -} - -static inline int -inline_mysql_file_fgetc( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi, PSI_FILE_READ); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line); - result= fgetc(file->m_file); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1); - return result; - } - } -#endif - - result= fgetc(file->m_file); - return result; -} - -static inline int -inline_mysql_file_fputs( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - const char *str, MYSQL_FILE *file) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - size_t bytes; - locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_WRITE); - if (likely(locker != NULL)) - { - bytes= str ? strlen(str) : 0; - PSI_FILE_CALL(start_file_wait)(locker, bytes, src_file, src_line); - result= fputs(str, file->m_file); - PSI_FILE_CALL(end_file_wait)(locker, bytes); - return result; - } - } -#endif - - result= fputs(str, file->m_file); - return result; -} - -static inline int -inline_mysql_file_fputc( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - char c, MYSQL_FILE *file) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_WRITE); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line); - result= fputc(c, file->m_file); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1); - return result; - } - } -#endif - - result= fputc(c, file->m_file); - return result; -} - -static inline int -inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...) -{ - /* - TODO: figure out how to pass src_file and src_line from the caller. - */ - int result; - va_list args; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_WRITE); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__); - va_start(args, format); - result= vfprintf(file->m_file, format, args); - va_end(args); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) result); - return result; - } - } -#endif - - va_start(args, format); - result= vfprintf(file->m_file, format, args); - va_end(args); - return result; -} - -static inline int -inline_mysql_file_vfprintf( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, const char *format, va_list args) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_WRITE); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= vfprintf(file->m_file, format, args); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) result); - return result; - } - } -#endif - - result= vfprintf(file->m_file, format, args); - return result; -} - -static inline int -inline_mysql_file_fflush( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi, PSI_FILE_FLUSH); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= fflush(file->m_file); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); - return result; - } - } -#endif - - result= fflush(file->m_file); - return result; -} - -static inline int inline_mysql_file_feof(MYSQL_FILE *file) -{ - /* Not instrumented, there is no wait involved */ - return feof(file->m_file); -} - -static inline int -inline_mysql_file_fstat( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - int filenr, MY_STAT *stat_area, myf flags) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, filenr, PSI_FILE_FSTAT); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= my_fstat(filenr, stat_area, flags); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); - return result; - } -#endif - - result= my_fstat(filenr, stat_area, flags); - return result; -} - -static inline MY_STAT * -inline_mysql_file_stat( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *path, MY_STAT *stat_area, myf flags) -{ - MY_STAT *result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_STAT, path, &locker); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); - result= my_stat(path, stat_area, flags); - PSI_FILE_CALL(end_file_open_wait)(locker, result); - return result; - } -#endif - - result= my_stat(path, stat_area, flags); - return result; -} - -static inline int -inline_mysql_file_chsize( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - File file, my_off_t newlength, int filler, myf flags) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_CHSIZE); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) newlength, src_file, - src_line); - result= my_chsize(file, newlength, filler, flags); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) newlength); - return result; - } -#endif - - result= my_chsize(file, newlength, filler, flags); - return result; -} - -static inline MYSQL_FILE* -inline_mysql_file_fopen( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *filename, int flags, myf myFlags) -{ - MYSQL_FILE *that; - that= (MYSQL_FILE*) my_malloc(PSI_NOT_INSTRUMENTED, - sizeof(MYSQL_FILE), MYF(MY_WME)); - if (likely(that != NULL)) - { -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_STREAM_OPEN, - filename, that); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); - that->m_file= my_fopen(filename, flags, myFlags); - that->m_psi= PSI_FILE_CALL(end_file_open_wait)(locker, that->m_file); - if (unlikely(that->m_file == NULL)) - { - my_free(that); - return NULL; - } - return that; - } -#endif - - that->m_psi= NULL; - that->m_file= my_fopen(filename, flags, myFlags); - if (unlikely(that->m_file == NULL)) - { - my_free(that); - return NULL; - } - } - return that; -} - -static inline int -inline_mysql_file_fclose( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, myf flags) -{ - int result= 0; - if (likely(file != NULL)) - { -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi, - PSI_FILE_STREAM_CLOSE); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); - result= my_fclose(file->m_file, flags); - PSI_FILE_CALL(end_file_close_wait)(locker, result); - my_free(file); - return result; - } - } -#endif - - result= my_fclose(file->m_file, flags); - my_free(file); - } - return result; -} - -static inline size_t -inline_mysql_file_fread( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, uchar *buffer, size_t count, myf flags) -{ - size_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - size_t bytes_read; - locker= PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi, PSI_FILE_READ); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); - result= my_fread(file->m_file, buffer, count, flags); - if (flags & (MY_NABP | MY_FNABP)) - bytes_read= (result == 0) ? count : 0; - else - bytes_read= (result != MY_FILE_ERROR) ? result : 0; - PSI_FILE_CALL(end_file_wait)(locker, bytes_read); - return result; - } - } -#endif - - result= my_fread(file->m_file, buffer, count, flags); - return result; -} - -static inline size_t -inline_mysql_file_fwrite( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags) -{ - size_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - size_t bytes_written; - locker= PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi, PSI_FILE_WRITE); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); - result= my_fwrite(file->m_file, buffer, count, flags); - if (flags & (MY_NABP | MY_FNABP)) - bytes_written= (result == 0) ? count : 0; - else - bytes_written= (result != MY_FILE_ERROR) ? result : 0; - PSI_FILE_CALL(end_file_wait)(locker, bytes_written); - return result; - } - } -#endif - - result= my_fwrite(file->m_file, buffer, count, flags); - return result; -} - -static inline my_off_t -inline_mysql_file_fseek( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, my_off_t pos, int whence, myf flags) -{ - my_off_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi, PSI_FILE_SEEK); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= my_fseek(file->m_file, pos, whence, flags); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); - return result; - } - } -#endif - - result= my_fseek(file->m_file, pos, whence, flags); - return result; -} - -static inline my_off_t -inline_mysql_file_ftell( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, myf flags) -{ - my_off_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - if (psi_likely(file->m_psi)) - { - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi, PSI_FILE_TELL); - if (likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= my_ftell(file->m_file, flags); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); - return result; - } - } -#endif - - result= my_ftell(file->m_file, flags); - return result; -} - -static inline File -inline_mysql_file_create( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *filename, int create_flags, int access_flags, myf myFlags) -{ - File file; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE, filename, - &locker); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); - file= my_create(filename, create_flags, access_flags, myFlags); - PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file); - return file; - } -#endif - - file= my_create(filename, create_flags, access_flags, myFlags); - return file; -} - -static inline File -inline_mysql_file_create_temp( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - char *to, const char *dir, const char *pfx, int mode, myf myFlags) -{ - File file; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker) - (&state, key, PSI_FILE_CREATE, NULL, &locker); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); - /* The file name is generated by create_temp_file(). */ - file= create_temp_file(to, dir, pfx, mode, myFlags); - PSI_FILE_CALL(end_temp_file_open_wait_and_bind_to_descriptor)(locker, file, (const char*)to); - return file; - } -#endif - - file= create_temp_file(to, dir, pfx, mode, myFlags); - return file; -} - -static inline File -inline_mysql_file_open( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *filename, int flags, myf myFlags) -{ - File file; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_OPEN, filename, - &locker); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); - file= my_open(filename, flags, myFlags); - PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file); - return file; - } -#endif - - file= my_open(filename, flags, myFlags); - return file; -} - -static inline int -inline_mysql_file_close( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - File file, myf flags) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_CLOSE); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); - result= my_close(file, flags); - PSI_FILE_CALL(end_file_close_wait)(locker, result); - return result; - } -#endif - - result= my_close(file, flags); - return result; -} - -static inline size_t -inline_mysql_file_read( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - File file, uchar *buffer, size_t count, myf flags) -{ - size_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - size_t bytes_read; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_READ); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); - result= my_read(file, buffer, count, flags); - if (flags & (MY_NABP | MY_FNABP)) - bytes_read= (result == 0) ? count : 0; - else - bytes_read= (result != MY_FILE_ERROR) ? result : 0; - PSI_FILE_CALL(end_file_wait)(locker, bytes_read); - return result; - } -#endif - - result= my_read(file, buffer, count, flags); - return result; -} - -static inline size_t -inline_mysql_file_write( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - File file, const uchar *buffer, size_t count, myf flags) -{ - size_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - size_t bytes_written; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_WRITE); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); - result= my_write(file, buffer, count, flags); - if (flags & (MY_NABP | MY_FNABP)) - bytes_written= (result == 0) ? count : 0; - else - bytes_written= (result != MY_FILE_ERROR) ? result : 0; - PSI_FILE_CALL(end_file_wait)(locker, bytes_written); - return result; - } -#endif - - result= my_write(file, buffer, count, flags); - return result; -} - -static inline size_t -inline_mysql_file_pread( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - File file, uchar *buffer, size_t count, my_off_t offset, myf flags) -{ - size_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - size_t bytes_read; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_READ); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); - result= my_pread(file, buffer, count, offset, flags); - if (flags & (MY_NABP | MY_FNABP)) - bytes_read= (result == 0) ? count : 0; - else - bytes_read= (result != MY_FILE_ERROR) ? result : 0; - PSI_FILE_CALL(end_file_wait)(locker, bytes_read); - return result; - } -#endif - - result= my_pread(file, buffer, count, offset, flags); - return result; -} - -static inline size_t -inline_mysql_file_pwrite( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - File file, const uchar *buffer, size_t count, my_off_t offset, myf flags) -{ - size_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - size_t bytes_written; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_WRITE); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); - result= my_pwrite(file, buffer, count, offset, flags); - if (flags & (MY_NABP | MY_FNABP)) - bytes_written= (result == 0) ? count : 0; - else - bytes_written= (result != MY_FILE_ERROR) ? result : 0; - PSI_FILE_CALL(end_file_wait)(locker, bytes_written); - return result; - } -#endif - - result= my_pwrite(file, buffer, count, offset, flags); - return result; -} - -static inline my_off_t -inline_mysql_file_seek( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - File file, my_off_t pos, int whence, myf flags) -{ - my_off_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_SEEK); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= my_seek(file, pos, whence, flags); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); - return result; - } -#endif - - result= my_seek(file, pos, whence, flags); - return result; -} - -static inline my_off_t -inline_mysql_file_tell( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - File file, myf flags) -{ - my_off_t result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_TELL); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= my_tell(file, flags); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); - return result; - } -#endif - - result= my_tell(file, flags); - return result; -} - -static inline int -inline_mysql_file_delete( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *name, myf flags) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE, name, &locker); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); - result= my_delete(name, flags); - PSI_FILE_CALL(end_file_close_wait)(locker, result); - return result; - } -#endif - - result= my_delete(name, flags); - return result; -} - -static inline int -inline_mysql_file_rename( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *from, const char *to, myf flags) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker) - (&state, key, PSI_FILE_RENAME, from, &locker); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= my_rename(from, to, flags); - PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result); - return result; - } -#endif - - result= my_rename(from, to, flags); - return result; -} - - -static inline File -inline_mysql_file_create_with_symlink( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *linkname, const char *filename, int create_flags, - int access_flags, myf flags) -{ - File file; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE, filename, - &locker); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); - file= my_create_with_symlink(linkname, filename, create_flags, access_flags, - flags); - PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file); - return file; - } -#endif - - file= my_create_with_symlink(linkname, filename, create_flags, access_flags, - flags); - return file; -} - - -static inline int -inline_mysql_file_delete_with_symlink( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *name, const char *ext, myf flags) -{ - int result; - char buf[FN_REFLEN]; - char *fullname= fn_format(buf, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT); -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE, fullname, - &locker); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); - result= my_handler_delete_with_symlink(fullname, flags); - PSI_FILE_CALL(end_file_close_wait)(locker, result); - return result; - } -#endif - - result= my_handler_delete_with_symlink(fullname, flags); - return result; -} - - -static inline int -inline_mysql_file_rename_with_symlink( -#ifdef HAVE_PSI_FILE_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *from, const char *to, myf flags) -{ - int result; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_name_locker) - (&state, key, PSI_FILE_RENAME, from, &locker); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= my_rename_with_symlink(from, to, flags); - PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result); - return result; - } -#endif - - result= my_rename_with_symlink(from, to, flags); - return result; -} - -static inline int -inline_mysql_file_sync( -#ifdef HAVE_PSI_FILE_INTERFACE - const char *src_file, uint src_line, -#endif - File fd, myf flags) -{ - int result= 0; -#ifdef HAVE_PSI_FILE_INTERFACE - struct PSI_file_locker *locker; - PSI_file_locker_state state; - locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, fd, PSI_FILE_SYNC); - if (psi_likely(locker != NULL)) - { - PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); - result= my_sync(fd, flags); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); - return result; - } -#endif - - result= my_sync(fd, flags); - return result; -} - -/** @} (end of group File_instrumentation) */ - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_idle.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_idle.h deleted file mode 100644 index f808507..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_idle.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_IDLE_H -#define MYSQL_IDLE_H - -/** - @file mysql/psi/mysql_idle.h - Instrumentation helpers for idle waits. -*/ - -#include "mysql/psi/psi.h" - -#ifndef PSI_IDLE_CALL -#define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -/** - @defgroup Idle_instrumentation Idle Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -/** - @def MYSQL_START_IDLE_WAIT - Instrumentation helper for table io_waits. - This instrumentation marks the start of a wait event. - @param LOCKER the locker - @param STATE the locker state - @sa MYSQL_END_IDLE_WAIT. -*/ -#ifdef HAVE_PSI_IDLE_INTERFACE - #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \ - LOCKER= inline_mysql_start_idle_wait(STATE, __FILE__, __LINE__) -#else - #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \ - do {} while (0) -#endif - -/** - @def MYSQL_END_IDLE_WAIT - Instrumentation helper for idle waits. - This instrumentation marks the end of a wait event. - @param LOCKER the locker - @sa MYSQL_START_IDLE_WAIT. -*/ -#ifdef HAVE_PSI_IDLE_INTERFACE - #define MYSQL_END_IDLE_WAIT(LOCKER) \ - inline_mysql_end_idle_wait(LOCKER) -#else - #define MYSQL_END_IDLE_WAIT(LOCKER) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_IDLE_INTERFACE -/** - Instrumentation calls for MYSQL_START_IDLE_WAIT. - @sa MYSQL_END_IDLE_WAIT. -*/ -static inline struct PSI_idle_locker * -inline_mysql_start_idle_wait(PSI_idle_locker_state *state, - const char *src_file, uint src_line) -{ - struct PSI_idle_locker *locker; - locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line); - return locker; -} - -/** - Instrumentation calls for MYSQL_END_IDLE_WAIT. - @sa MYSQL_START_IDLE_WAIT. -*/ -static inline void -inline_mysql_end_idle_wait(struct PSI_idle_locker *locker) -{ - if (psi_likely(locker != NULL)) - PSI_IDLE_CALL(end_idle_wait)(locker); -} -#endif - -/** @} (end of group Idle_instrumentation) */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_mdl.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_mdl.h deleted file mode 100644 index 20d6c94..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_mdl.h +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_MDL_H -#define MYSQL_MDL_H - -/** - @file mysql/psi/mysql_mdl.h - Instrumentation helpers for metadata locks. -*/ - -#include "mysql/psi/psi.h" - -#ifdef HAVE_PSI_METADATA_INTERFACE - -#ifndef PSI_METADATA_CALL -#define PSI_METADATA_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -#define PSI_CALL_start_metadata_wait(A,B,C,D) PSI_METADATA_CALL(start_metadata_wait)(A,B,C,D) -#define PSI_CALL_end_metadata_wait(A,B) PSI_METADATA_CALL(end_metadata_wait)(A,B) -#define PSI_CALL_create_metadata_lock(A,B,C,D,E,F,G) PSI_METADATA_CALL(create_metadata_lock)(A,B,C,D,E,F,G) -#define PSI_CALL_set_metadata_lock_status(A,B) PSI_METADATA_CALL(set_metadata_lock_status)(A,B) -#define PSI_CALL_destroy_metadata_lock(A) PSI_METADATA_CALL(destroy_metadata_lock)(A) -#else -#define PSI_CALL_start_metadata_wait(A,B,C,D) 0 -#define PSI_CALL_end_metadata_wait(A,B) do { } while(0) -#define PSI_CALL_create_metadata_lock(A,B,C,D,E,F,G) 0 -#define PSI_CALL_set_metadata_lock_status(A,B) do {} while(0) -#define PSI_CALL_destroy_metadata_lock(A) do {} while(0) -#endif - -/** - @defgroup Thread_instrumentation Metadata Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -/** - @def mysql_mdl_create(K, M, A) - Instrumented metadata lock creation. - @param I Metadata lock identity - @param K Metadata key - @param T Metadata lock type - @param D Metadata lock duration - @param S Metadata lock status - @param F request source file - @param L request source line -*/ - -#ifdef HAVE_PSI_METADATA_INTERFACE - #define mysql_mdl_create(I, K, T, D, S, F, L) \ - inline_mysql_mdl_create(I, K, T, D, S, F, L) -#else - #define mysql_mdl_create(I, K, T, D, S, F, L) NULL -#endif - -#ifdef HAVE_PSI_METADATA_INTERFACE - #define mysql_mdl_set_status(L, S) \ - inline_mysql_mdl_set_status(L, S) -#else - #define mysql_mdl_set_status(L, S) \ - do {} while (0) -#endif - - -/** - @def mysql_mdl_destroy(M) - Instrumented metadata lock destruction. - @param M Metadata lock -*/ -#ifdef HAVE_PSI_METADATA_INTERFACE - #define mysql_mdl_destroy(M) \ - inline_mysql_mdl_destroy(M, __FILE__, __LINE__) -#else - #define mysql_mdl_destroy(M) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_METADATA_INTERFACE - -static inline PSI_metadata_lock * -inline_mysql_mdl_create(void *identity, - const MDL_key *mdl_key, - enum_mdl_type mdl_type, - enum_mdl_duration mdl_duration, - MDL_ticket::enum_psi_status mdl_status, - const char *src_file, uint src_line) -{ - PSI_metadata_lock *result; - - /* static_cast: Fit a round C++ enum peg into a square C int hole ... */ - result= PSI_METADATA_CALL(create_metadata_lock) - (identity, - mdl_key, - static_cast (mdl_type), - static_cast (mdl_duration), - static_cast (mdl_status), - src_file, src_line); - - return result; -} - -static inline void inline_mysql_mdl_set_status( - PSI_metadata_lock *psi, - MDL_ticket::enum_psi_status mdl_status) -{ - if (psi != NULL) - PSI_METADATA_CALL(set_metadata_lock_status)(psi, mdl_status); -} - -static inline void inline_mysql_mdl_destroy( - PSI_metadata_lock *psi, - const char *src_file, uint src_line) -{ - if (psi != NULL) - PSI_METADATA_CALL(destroy_metadata_lock)(psi); -} -#endif /* HAVE_PSI_METADATA_INTERFACE */ - -/** @} (end of group Metadata_instrumentation) */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_memory.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_memory.h deleted file mode 100644 index a79579c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_memory.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_MEMORY_H -#define MYSQL_MEMORY_H - -/** - @file mysql/psi/mysql_memory.h - Instrumentation helpers for memory allocation. -*/ - -#include "mysql/psi/psi.h" - -#ifdef HAVE_PSI_MEMORY_INTERFACE -#define PSI_CALL_memory_alloc(A1,A2,A3) PSI_MEMORY_CALL(memory_alloc)(A1,A2,A3) -#define PSI_CALL_memory_free(A1,A2,A3) PSI_MEMORY_CALL(memory_free)(A1,A2,A3) -#define PSI_CALL_memory_realloc(A1,A2,A3,A4) PSI_MEMORY_CALL(memory_realloc)(A1,A2,A3,A4) -#define PSI_CALL_register_memory(A1,A2,A3) PSI_MEMORY_CALL(register_memory)(A1,A2,A3) -#else -#define PSI_CALL_memory_alloc(A1,A2,A3) 0 -#define PSI_CALL_memory_free(A1,A2,A3) do { } while(0) -#define PSI_CALL_memory_realloc(A1,A2,A3,A4) 0 -#define PSI_CALL_register_memory(A1,A2,A3) do { } while(0) -#endif - -#ifndef PSI_MEMORY_CALL -#define PSI_MEMORY_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -/** - @defgroup Memory_instrumentation Memory Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -/** - @def mysql_memory_register(P1, P2, P3) - Memory registration. -*/ -#define mysql_memory_register(P1, P2, P3) \ - inline_mysql_memory_register(P1, P2, P3) - -static inline void inline_mysql_memory_register( -#ifdef HAVE_PSI_MEMORY_INTERFACE - const char *category, - PSI_memory_info *info, - int count) -#else - const char *category __attribute__((unused)), - void *info __attribute__((unused)), - int count __attribute__((unused))) -#endif -{ - PSI_CALL_register_memory(category, info, count); -} - -/** @} (end of group Memory_instrumentation) */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_ps.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_ps.h deleted file mode 100644 index f0b2733..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_ps.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef MYSQL_PS_H -#define MYSQL_PS_H - -/** - @file mysql/psi/mysql_ps.h - Instrumentation helpers for prepared statements. -*/ - -#include "mysql/psi/psi.h" - -#ifndef PSI_PS_CALL -#define PSI_PS_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -#ifdef HAVE_PSI_PS_INTERFACE - #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH) \ - inline_mysql_create_prepared_stmt(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH) - #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \ - inline_mysql_execute_prepared_stmt(LOCKER, PREPARED_STMT) - #define MYSQL_DESTROY_PS(PREPARED_STMT) \ - inline_mysql_destroy_prepared_stmt(PREPARED_STMT) - #define MYSQL_REPREPARE_PS(PREPARED_STMT) \ - inline_mysql_reprepare_prepared_stmt(PREPARED_STMT) - #define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \ - inline_mysql_set_prepared_stmt_text(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) -#else - #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH) \ - NULL - #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \ - do {} while (0) - #define MYSQL_DESTROY_PS(PREPARED_STMT) \ - do {} while (0) - #define MYSQL_REPREPARE_PS(PREPARED_STMT) \ - do {} while (0) - #define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_PS_INTERFACE -static inline struct PSI_prepared_stmt* -inline_mysql_create_prepared_stmt(void *identity, uint stmt_id, - PSI_statement_locker *locker, - const char *stmt_name, size_t stmt_name_length) -{ - if (locker == NULL) - return NULL; - return PSI_PS_CALL(create_prepared_stmt)(identity, stmt_id, - locker, - stmt_name, stmt_name_length); -} - -static inline void -inline_mysql_execute_prepared_stmt(PSI_statement_locker *locker, - PSI_prepared_stmt* prepared_stmt) -{ - if (prepared_stmt != NULL && locker != NULL) - PSI_PS_CALL(execute_prepared_stmt)(locker, prepared_stmt); -} - -static inline void -inline_mysql_destroy_prepared_stmt(PSI_prepared_stmt *prepared_stmt) -{ - if (prepared_stmt != NULL) - PSI_PS_CALL(destroy_prepared_stmt)(prepared_stmt); -} - -static inline void -inline_mysql_reprepare_prepared_stmt(PSI_prepared_stmt *prepared_stmt) -{ - if (prepared_stmt != NULL) - PSI_PS_CALL(reprepare_prepared_stmt)(prepared_stmt); -} - -static inline void -inline_mysql_set_prepared_stmt_text(PSI_prepared_stmt *prepared_stmt, - const char *text, - uint text_len) -{ - if (prepared_stmt != NULL) - { - PSI_PS_CALL(set_prepared_stmt_text)(prepared_stmt, text, text_len); - } -} -#endif - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_socket.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_socket.h deleted file mode 100644 index aa85daa..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_socket.h +++ /dev/null @@ -1,1295 +0,0 @@ -/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License, version 2.0, -as published by the Free Software Foundation. - -This program is also distributed with certain software (including -but not limited to OpenSSL) that is licensed under separate terms, -as designated in a particular file or component or in included license -documentation. The authors of MySQL hereby grant you an additional -permission to link the program and your derivative works with the -separately licensed software that they have included with MySQL. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License, version 2.0, for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -02110-1335 USA -*/ - -#ifndef MYSQL_SOCKET_H -#define MYSQL_SOCKET_H - -/* For MY_STAT */ -#include -/* For my_chsize */ -#include -/* For socket api */ -#ifdef _WIN32 - #include - #include - #include - #define SOCKBUF_T char -#else - #include - #define SOCKBUF_T void -#endif -/** - @file mysql/psi/mysql_socket.h -[...] -*/ - -#include "mysql/psi/psi.h" - -#ifndef PSI_SOCKET_CALL -#define PSI_SOCKET_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -/** - @defgroup Socket_instrumentation Socket Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -/** - @def mysql_socket_register(P1, P2, P3) - Socket registration. -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_register(P1, P2, P3) \ - inline_mysql_socket_register(P1, P2, P3) -#else - #define mysql_socket_register(P1, P2, P3) \ - do {} while (0) -#endif - -/** An instrumented socket. */ -struct st_mysql_socket -{ - /** The real socket descriptor. */ - my_socket fd; - - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c MYSQL_SOCKET interface. - */ - struct PSI_socket *m_psi; -}; - -/** - An instrumented socket. - @c MYSQL_SOCKET is a replacement for @c my_socket. -*/ -typedef struct st_mysql_socket MYSQL_SOCKET; - - -/** - @def MYSQL_INVALID_SOCKET - MYSQL_SOCKET initial value. -*/ -//MYSQL_SOCKET MYSQL_INVALID_SOCKET= {INVALID_SOCKET, NULL}; -#define MYSQL_INVALID_SOCKET mysql_socket_invalid() - -/** - MYSQL_SOCKET helper. Initialize instrumented socket. - @sa mysql_socket_getfd - @sa mysql_socket_setfd -*/ -static inline MYSQL_SOCKET -mysql_socket_invalid() -{ - MYSQL_SOCKET mysql_socket= {INVALID_SOCKET, NULL}; - return mysql_socket; -} - -/** - Set socket descriptor and address. - @param socket nstrumented socket - @param addr unformatted socket address - @param addr_len length of socket address -*/ - -static inline void -mysql_socket_set_address( -#ifdef HAVE_PSI_SOCKET_INTERFACE - MYSQL_SOCKET socket, - const struct sockaddr *addr, - socklen_t addr_len -#else - MYSQL_SOCKET socket __attribute__ ((unused)), - const struct sockaddr *addr __attribute__ ((unused)), - socklen_t addr_len __attribute__ ((unused)) -#endif -) -{ -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (socket.m_psi != NULL) - PSI_SOCKET_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len); -#endif -} - -/** - Set socket descriptor and address. - @param socket instrumented socket -*/ -static inline void -mysql_socket_set_thread_owner( -#ifdef HAVE_PSI_SOCKET_INTERFACE -MYSQL_SOCKET socket -#else -MYSQL_SOCKET socket __attribute__ ((unused)) -#endif -) -{ -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (socket.m_psi != NULL) - PSI_SOCKET_CALL(set_socket_thread_owner)(socket.m_psi); -#endif -} - -/** - MYSQL_SOCKET helper. Get socket descriptor. - @param mysql_socket Instrumented socket - @sa mysql_socket_getfd -*/ -static inline my_socket -mysql_socket_getfd(MYSQL_SOCKET mysql_socket) -{ - return mysql_socket.fd; -} - -/** - MYSQL_SOCKET helper. Set socket descriptor. - @param mysql_socket Instrumented socket - @param fd Socket descriptor - @sa mysql_socket_setfd -*/ -static inline void -mysql_socket_setfd(MYSQL_SOCKET *mysql_socket, my_socket fd) -{ - if (likely(mysql_socket != NULL)) - mysql_socket->fd= fd; -} - -/** - @def MYSQL_SOCKET_WAIT_VARIABLES - Instrumentation helper for socket waits. - This instrumentation declares local variables. - Do not use a ';' after this macro - @param LOCKER locker - @param STATE locker state - @sa MYSQL_START_SOCKET_WAIT. - @sa MYSQL_END_SOCKET_WAIT. -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE) \ - struct PSI_socket_locker* LOCKER; \ - PSI_socket_locker_state STATE; -#else - #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE) -#endif - -/** - @def MYSQL_START_SOCKET_WAIT - Instrumentation helper for socket waits. - This instrumentation marks the start of a wait event. - @param LOCKER locker - @param STATE locker state - @param SOCKET instrumented socket - @param OP The socket operation to be performed - @param COUNT bytes to be written/read - @sa MYSQL_END_SOCKET_WAIT. -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, SOCKET, OP, COUNT) \ - LOCKER= inline_mysql_start_socket_wait(STATE, SOCKET, OP, COUNT,\ - __FILE__, __LINE__) -#else - #define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, SOCKET, OP, COUNT) \ - do {} while (0) -#endif - -/** - @def MYSQL_END_SOCKET_WAIT - Instrumentation helper for socket waits. - This instrumentation marks the end of a wait event. - @param LOCKER locker - @param COUNT actual bytes written/read, or -1 - @sa MYSQL_START_SOCKET_WAIT. -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \ - inline_mysql_end_socket_wait(LOCKER, COUNT) -#else - #define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \ - do {} while (0) -#endif - -/** - @def MYSQL_SOCKET_SET_STATE - Set the state (IDLE, ACTIVE) of an instrumented socket. - @param SOCKET the instrumented socket - @param STATE the new state - @sa PSI_socket_state -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ - inline_mysql_socket_set_state(SOCKET, STATE) -#else - #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_SOCKET_INTERFACE -/** - Instrumentation calls for MYSQL_START_SOCKET_WAIT. - @sa MYSQL_START_SOCKET_WAIT. -*/ -static inline struct PSI_socket_locker* -inline_mysql_start_socket_wait(PSI_socket_locker_state *state, - MYSQL_SOCKET mysql_socket, - enum PSI_socket_operation op, - size_t byte_count, - const char *src_file, uint src_line) -{ - struct PSI_socket_locker *locker; - if (psi_likely(mysql_socket.m_psi != NULL)) - { - locker= PSI_SOCKET_CALL(start_socket_wait) - (state, mysql_socket.m_psi, op, byte_count, src_file, src_line); - } - else - locker= NULL; - return locker; -} - -/** - Instrumentation calls for MYSQL_END_SOCKET_WAIT. - @sa MYSQL_END_SOCKET_WAIT. -*/ -static inline void -inline_mysql_end_socket_wait(struct PSI_socket_locker *locker, size_t byte_count) -{ - if (psi_likely(locker != NULL)) - PSI_SOCKET_CALL(end_socket_wait)(locker, byte_count); -} - -/** - Set the state (IDLE, ACTIVE) of an instrumented socket. - @param socket the instrumented socket - @param state the new state - @sa PSI_socket_state -*/ -static inline void -inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state) -{ - if (socket.m_psi != NULL) - PSI_SOCKET_CALL(set_socket_state)(socket.m_psi, state); -} -#endif /* HAVE_PSI_SOCKET_INTERFACE */ - -/** - @def mysql_socket_socket(K, D, T, P) - Create a socket. - @c mysql_socket_socket is a replacement for @c socket. - @param K PSI_socket_key for this instrumented socket - @param D Socket domain - @param T Protocol type - @param P Transport protocol -*/ - -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_socket(K, D, T, P) \ - inline_mysql_socket_socket(K, D, T, P) -#else - #define mysql_socket_socket(K, D, T, P) \ - inline_mysql_socket_socket(D, T, P) -#endif - -/** - @def mysql_socket_bind(FD, AP, L) - Bind a socket to a local port number and IP address - @c mysql_socket_bind is a replacement for @c bind. - @param FD Instrumented socket descriptor returned by socket() - @param AP Pointer to local port number and IP address in sockaddr structure - @param L Length of sockaddr structure -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_bind(FD, AP, L) \ - inline_mysql_socket_bind(__FILE__, __LINE__, FD, AP, L) -#else - #define mysql_socket_bind(FD, AP, L) \ - inline_mysql_socket_bind(FD, AP, L) -#endif - -/** - @def mysql_socket_getsockname(FD, AP, LP) - Return port number and IP address of the local host - @c mysql_socket_getsockname is a replacement for @c getsockname. - @param FD Instrumented socket descriptor returned by socket() - @param AP Pointer to returned address of local host in @c sockaddr structure - @param LP Pointer to length of @c sockaddr structure -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_getsockname(FD, AP, LP) \ - inline_mysql_socket_getsockname(__FILE__, __LINE__, FD, AP, LP) -#else - #define mysql_socket_getsockname(FD, AP, LP) \ - inline_mysql_socket_getsockname(FD, AP, LP) -#endif - -/** - @def mysql_socket_connect(FD, AP, L) - Establish a connection to a remote host. - @c mysql_socket_connect is a replacement for @c connect. - @param FD Instrumented socket descriptor returned by socket() - @param AP Pointer to target address in sockaddr structure - @param L Length of sockaddr structure -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_connect(FD, AP, L) \ - inline_mysql_socket_connect(__FILE__, __LINE__, FD, AP, L) -#else - #define mysql_socket_connect(FD, AP, L) \ - inline_mysql_socket_connect(FD, AP, L) -#endif - -/** - @def mysql_socket_getpeername(FD, AP, LP) - Get port number and IP address of remote host that a socket is connected to. - @c mysql_socket_getpeername is a replacement for @c getpeername. - @param FD Instrumented socket descriptor returned by socket() or accept() - @param AP Pointer to returned address of remote host in sockaddr structure - @param LP Pointer to length of sockaddr structure -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_getpeername(FD, AP, LP) \ - inline_mysql_socket_getpeername(__FILE__, __LINE__, FD, AP, LP) -#else - #define mysql_socket_getpeername(FD, AP, LP) \ - inline_mysql_socket_getpeername(FD, AP, LP) -#endif - -/** - @def mysql_socket_send(FD, B, N, FL) - Send data from the buffer, B, to a connected socket. - @c mysql_socket_send is a replacement for @c send. - @param FD Instrumented socket descriptor returned by socket() or accept() - @param B Buffer to send - @param N Number of bytes to send - @param FL Control flags -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_send(FD, B, N, FL) \ - inline_mysql_socket_send(__FILE__, __LINE__, FD, B, N, FL) -#else - #define mysql_socket_send(FD, B, N, FL) \ - inline_mysql_socket_send(FD, B, N, FL) -#endif - -/** - @def mysql_socket_recv(FD, B, N, FL) - Receive data from a connected socket. - @c mysql_socket_recv is a replacement for @c recv. - @param FD Instrumented socket descriptor returned by socket() or accept() - @param B Buffer to receive to - @param N Maximum bytes to receive - @param FL Control flags -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_recv(FD, B, N, FL) \ - inline_mysql_socket_recv(__FILE__, __LINE__, FD, B, N, FL) -#else - #define mysql_socket_recv(FD, B, N, FL) \ - inline_mysql_socket_recv(FD, B, N, FL) -#endif - -/** - @def mysql_socket_sendto(FD, B, N, FL, AP, L) - Send data to a socket at the specified address. - @c mysql_socket_sendto is a replacement for @c sendto. - @param FD Instrumented socket descriptor returned by socket() - @param B Buffer to send - @param N Number of bytes to send - @param FL Control flags - @param AP Pointer to destination sockaddr structure - @param L Size of sockaddr structure -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_sendto(FD, B, N, FL, AP, L) \ - inline_mysql_socket_sendto(__FILE__, __LINE__, FD, B, N, FL, AP, L) -#else - #define mysql_socket_sendto(FD, B, N, FL, AP, L) \ - inline_mysql_socket_sendto(FD, B, N, FL, AP, L) -#endif - -/** - @def mysql_socket_recvfrom(FD, B, N, FL, AP, L) - Receive data from a socket and return source address information - @c mysql_socket_recvfrom is a replacement for @c recvfrom. - @param FD Instrumented socket descriptor returned by socket() - @param B Buffer to receive to - @param N Maximum bytes to receive - @param FL Control flags - @param AP Pointer to source address in sockaddr_storage structure - @param LP Size of sockaddr_storage structure -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \ - inline_mysql_socket_recvfrom(__FILE__, __LINE__, FD, B, N, FL, AP, LP) -#else - #define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \ - inline_mysql_socket_recvfrom(FD, B, N, FL, AP, LP) -#endif - -/** - @def mysql_socket_getsockopt(FD, LV, ON, OP, OL) - Get a socket option for the specified socket. - @c mysql_socket_getsockopt is a replacement for @c getsockopt. - @param FD Instrumented socket descriptor returned by socket() - @param LV Protocol level - @param ON Option to query - @param OP Buffer which will contain the value for the requested option - @param OL Pointer to length of OP -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \ - inline_mysql_socket_getsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL) -#else - #define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \ - inline_mysql_socket_getsockopt(FD, LV, ON, OP, OL) -#endif - -/** - @def mysql_socket_setsockopt(FD, LV, ON, OP, OL) - Set a socket option for the specified socket. - @c mysql_socket_setsockopt is a replacement for @c setsockopt. - @param FD Instrumented socket descriptor returned by socket() - @param LV Protocol level - @param ON Option to modify - @param OP Buffer containing the value for the specified option - @param OL Pointer to length of OP -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \ - inline_mysql_socket_setsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL) -#else - #define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \ - inline_mysql_socket_setsockopt(FD, LV, ON, OP, OL) -#endif - -/** - @def mysql_sock_set_nonblocking - Set socket to non-blocking. - @param FD instrumented socket descriptor -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_sock_set_nonblocking(FD) \ - inline_mysql_sock_set_nonblocking(__FILE__, __LINE__, FD) -#else - #define mysql_sock_set_nonblocking(FD) \ - inline_mysql_sock_set_nonblocking(FD) -#endif - -/** - @def mysql_socket_listen(FD, N) - Set socket state to listen for an incoming connection. - @c mysql_socket_listen is a replacement for @c listen. - @param FD Instrumented socket descriptor, bound and connected - @param N Maximum number of pending connections allowed. -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_listen(FD, N) \ - inline_mysql_socket_listen(__FILE__, __LINE__, FD, N) -#else - #define mysql_socket_listen(FD, N) \ - inline_mysql_socket_listen(FD, N) -#endif - -/** - @def mysql_socket_accept(K, FD, AP, LP) - Accept a connection from any remote host; TCP only. - @c mysql_socket_accept is a replacement for @c accept. - @param K PSI_socket_key for this instrumented socket - @param FD Instrumented socket descriptor, bound and placed in a listen state - @param AP Pointer to sockaddr structure with returned IP address and port of connected host - @param LP Pointer to length of valid information in AP -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_accept(K, FD, AP, LP) \ - inline_mysql_socket_accept(__FILE__, __LINE__, K, FD, AP, LP) -#else - #define mysql_socket_accept(K, FD, AP, LP) \ - inline_mysql_socket_accept(FD, AP, LP) -#endif - -/** - @def mysql_socket_close(FD) - Close a socket and sever any connections. - @c mysql_socket_close is a replacement for @c close. - @param FD Instrumented socket descriptor returned by socket() or accept() -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_close(FD) \ - inline_mysql_socket_close(__FILE__, __LINE__, FD) -#else - #define mysql_socket_close(FD) \ - inline_mysql_socket_close(FD) -#endif - -/** - @def mysql_socket_shutdown(FD, H) - Disable receives and/or sends on a socket. - @c mysql_socket_shutdown is a replacement for @c shutdown. - @param FD Instrumented socket descriptor returned by socket() or accept() - @param H Specifies which operations to shutdown -*/ -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define mysql_socket_shutdown(FD, H) \ - inline_mysql_socket_shutdown(__FILE__, __LINE__, FD, H) -#else - #define mysql_socket_shutdown(FD, H) \ - inline_mysql_socket_shutdown(FD, H) -#endif - -#ifdef HAVE_PSI_SOCKET_INTERFACE -static inline void inline_mysql_socket_register( - const char *category, - PSI_socket_info *info, - int count) -{ - PSI_SOCKET_CALL(register_socket)(category, info, count); -} -#endif - -/** mysql_socket_socket */ - -static inline MYSQL_SOCKET -inline_mysql_socket_socket -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - PSI_socket_key key, -#endif - int domain, int type, int protocol) -{ - MYSQL_SOCKET mysql_socket= MYSQL_INVALID_SOCKET; - mysql_socket.fd= socket(domain, type | SOCK_CLOEXEC, protocol); - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (likely(mysql_socket.fd != INVALID_SOCKET)) - { - mysql_socket.m_psi= PSI_SOCKET_CALL(init_socket) - (key, (const my_socket*)&mysql_socket.fd, NULL, 0); - } -#endif - - /* SOCK_CLOEXEC isn't always a number - can't preprocessor compare */ -#if defined(HAVE_FCNTL) && defined(FD_CLOEXEC) && !defined(HAVE_SOCK_CLOEXEC) - (void) fcntl(mysql_socket.fd, F_SETFD, FD_CLOEXEC); -#endif - - return mysql_socket; -} - -/** mysql_socket_bind */ - -static inline int -inline_mysql_socket_bind -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, size_t len) -{ - int result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker_state state; - PSI_socket_locker *locker; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= bind(mysql_socket.fd, addr, (int)len); - - /* Instrumentation end */ - if (result == 0) - PSI_SOCKET_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, (socklen_t)len); - - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - - return result; - } -#endif - - /* Non instrumented code */ - result= bind(mysql_socket.fd, addr, (int)len); - return result; -} - -/** mysql_socket_getsockname */ - -static inline int -inline_mysql_socket_getsockname -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len) -{ - int result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= getsockname(mysql_socket.fd, addr, len); - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - - return result; - } -#endif - - /* Non instrumented code */ - result= getsockname(mysql_socket.fd, addr, len); - - return result; -} - -/** mysql_socket_connect */ - -static inline int -inline_mysql_socket_connect -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len) -{ - int result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= connect(mysql_socket.fd, addr, len); - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - - return result; - } -#endif - - /* Non instrumented code */ - result= connect(mysql_socket.fd, addr, len); - - return result; -} - -/** mysql_socket_getpeername */ - -static inline int -inline_mysql_socket_getpeername -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len) -{ - int result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= getpeername(mysql_socket.fd, addr, len); - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - - return result; - } -#endif - - /* Non instrumented code */ - result= getpeername(mysql_socket.fd, addr, len); - - return result; -} - -/** mysql_socket_send */ - -static inline ssize_t -inline_mysql_socket_send -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags) -{ - ssize_t result; - DBUG_ASSERT(mysql_socket.fd != INVALID_SOCKET); -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line); - - /* Instrumented code */ - result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); - - /* Instrumentation end */ - if (locker != NULL) - { - size_t bytes_written= (result > 0) ? (size_t) result : 0; - PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written); - } - - return result; - } -#endif - - /* Non instrumented code */ - result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); - - return result; -} - -/** mysql_socket_recv */ - -static inline ssize_t -inline_mysql_socket_recv -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags) -{ - ssize_t result; - DBUG_ASSERT(mysql_socket.fd != INVALID_SOCKET); -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags); - - /* Instrumentation end */ - if (locker != NULL) - { - size_t bytes_read= (result > 0) ? (size_t) result : 0; - PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read); - } - - return result; - } -#endif - - /* Non instrumented code */ - result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags); - - return result; -} - -/** mysql_socket_sendto */ - -static inline ssize_t -inline_mysql_socket_sendto -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags, const struct sockaddr *addr, socklen_t addr_len) -{ - ssize_t result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line); - - /* Instrumented code */ - result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); - - /* Instrumentation end */ - if (locker != NULL) - { - size_t bytes_written = (result > 0) ? (size_t) result : 0; - PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written); - } - - return result; - } -#endif - - /* Non instrumented code */ - result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); - - return result; -} - -/** mysql_socket_recvfrom */ - -static inline ssize_t -inline_mysql_socket_recvfrom -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags, - struct sockaddr *addr, socklen_t *addr_len) -{ - ssize_t result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); - - /* Instrumentation end */ - if (locker != NULL) - { - size_t bytes_read= (result > 0) ? (size_t) result : 0; - PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read); - } - - return result; - } -#endif - - /* Non instrumented code */ - result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); - - return result; -} - -/** mysql_socket_getsockopt */ - -static inline int -inline_mysql_socket_getsockopt -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, int level, int optname, SOCKBUF_T *optval, socklen_t *optlen) -{ - int result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= getsockopt(mysql_socket.fd, level, optname, optval, optlen); - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - - return result; - } -#endif - - /* Non instrumented code */ - result= getsockopt(mysql_socket.fd, level, optname, optval, optlen); - - return result; -} - -/** mysql_socket_setsockopt */ - -static inline int -inline_mysql_socket_setsockopt -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, int level, int optname, const SOCKBUF_T *optval, - socklen_t optlen) -{ - int result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= setsockopt(mysql_socket.fd, level, optname, optval, optlen); - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - - return result; - } -#endif - - /* Non instrumented code */ - result= setsockopt(mysql_socket.fd, level, optname, optval, optlen); - - return result; -} - -/** set_socket_nonblock */ -static inline int -set_socket_nonblock(my_socket fd) -{ - int ret= 0; -#ifdef _WIN32 - { - u_long nonblocking= 1; - ret= ioctlsocket(fd, FIONBIO, &nonblocking); - } -#else - { - int fd_flags; - fd_flags= fcntl(fd, F_GETFL, 0); - if (fd_flags < 0) - return errno; -#if defined(O_NONBLOCK) - fd_flags |= O_NONBLOCK; -#elif defined(O_NDELAY) - fd_flags |= O_NDELAY; -#elif defined(O_FNDELAY) - fd_flags |= O_FNDELAY; -#else -#error "No definition of non-blocking flag found." -#endif /* O_NONBLOCK */ - if (fcntl(fd, F_SETFL, fd_flags) == -1) - ret= errno; - } -#endif /* _WIN32 */ - return ret; -} - -/** mysql_socket_set_nonblocking */ - -static inline int -inline_mysql_sock_set_nonblocking -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket -) -{ - int result= 0; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (mysql_socket.m_psi) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, - (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= set_socket_nonblock(mysql_socket.fd); - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - - return result; - } -#endif - - /* Non instrumented code */ - result= set_socket_nonblock(mysql_socket.fd); - - return result; -} - -/** mysql_socket_listen */ - -static inline int -inline_mysql_socket_listen -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, int backlog) -{ - int result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= listen(mysql_socket.fd, backlog); - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - - return result; - } -#endif - - /* Non instrumented code */ - result= listen(mysql_socket.fd, backlog); - - return result; -} - -/** mysql_socket_accept */ - -static inline MYSQL_SOCKET -inline_mysql_socket_accept -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, PSI_socket_key key, -#endif - MYSQL_SOCKET socket_listen, struct sockaddr *addr, socklen_t *addr_len) -{ -#ifdef FD_CLOEXEC - int flags __attribute__ ((unused)); -#endif - - MYSQL_SOCKET socket_accept; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (socket_listen.m_psi != NULL) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, socket_listen.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); - - /* Instrumented code */ -#ifdef HAVE_ACCEPT4 - socket_accept.fd= accept4(socket_listen.fd, addr, addr_len, SOCK_CLOEXEC); -#else - socket_accept.fd= accept(socket_listen.fd, addr, addr_len); -#ifdef FD_CLOEXEC - if (socket_accept.fd != INVALID_SOCKET) - { - flags= fcntl(socket_accept.fd, F_GETFD); - if (flags != -1) - { - flags |= FD_CLOEXEC; - fcntl(socket_accept.fd, F_SETFD, flags); - } - } -#endif -#endif - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - } - else -#endif - { - /* Non instrumented code */ -#ifdef HAVE_ACCEPT4 - socket_accept.fd= accept4(socket_listen.fd, addr, addr_len, SOCK_CLOEXEC); -#else - socket_accept.fd= accept(socket_listen.fd, addr, addr_len); -#ifdef FD_CLOEXEC - if (socket_accept.fd != INVALID_SOCKET) - { - flags= fcntl(socket_accept.fd, F_GETFD); - if (flags != -1) - { - flags |= FD_CLOEXEC; - fcntl(socket_accept.fd, F_SETFD, flags); - } - } -#endif -#endif - } - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (likely(socket_accept.fd != INVALID_SOCKET)) - { - /* Initialize the instrument with the new socket descriptor and address */ - socket_accept.m_psi= PSI_SOCKET_CALL(init_socket) - (key, (const my_socket*)&socket_accept.fd, addr, *addr_len); - } -#endif - - return socket_accept; -} - -/** mysql_socket_close */ - -static inline int -inline_mysql_socket_close -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket) -{ - int result; - -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - /* Instrumentation start */ - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE, (size_t)0, src_file, src_line); - - /* Instrumented code */ - result= closesocket(mysql_socket.fd); - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - /* Remove the instrumentation for this socket. */ - if (mysql_socket.m_psi != NULL) - PSI_SOCKET_CALL(destroy_socket)(mysql_socket.m_psi); - - return result; - } -#endif - - /* Non instrumented code */ - result= closesocket(mysql_socket.fd); - - return result; -} - -/** mysql_socket_shutdown */ - -static inline int -inline_mysql_socket_shutdown -( -#ifdef HAVE_PSI_SOCKET_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_SOCKET mysql_socket, int how) -{ - int result; - -#ifdef _WIN32 - static LPFN_DISCONNECTEX DisconnectEx = NULL; - if (DisconnectEx == NULL) - { - DWORD dwBytesReturned; - GUID guidDisconnectEx = WSAID_DISCONNECTEX; - WSAIoctl(mysql_socket.fd, SIO_GET_EXTENSION_FUNCTION_POINTER, - &guidDisconnectEx, sizeof(GUID), - &DisconnectEx, sizeof(DisconnectEx), - &dwBytesReturned, NULL, NULL); - } -#endif - -/* Instrumentation start */ -#ifdef HAVE_PSI_SOCKET_INTERFACE - if (psi_likely(mysql_socket.m_psi != NULL)) - { - PSI_socket_locker *locker; - PSI_socket_locker_state state; - locker= PSI_SOCKET_CALL(start_socket_wait) - (&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line); - - /* Instrumented code */ -#ifdef _WIN32 - if (DisconnectEx) - result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL, - (DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1; - else -#endif - result= shutdown(mysql_socket.fd, how); - - /* Instrumentation end */ - if (locker != NULL) - PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); - - return result; - } -#endif - - /* Non instrumented code */ -#ifdef _WIN32 - if (DisconnectEx) - result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL, - (DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1; - else -#endif - result= shutdown(mysql_socket.fd, how); - - return result; -} - -/** @} (end of group Socket_instrumentation) */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_sp.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_sp.h deleted file mode 100644 index 5eeea37..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_sp.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef MYSQL_SP_H -#define MYSQL_SP_H - -/** - @file mysql/psi/mysql_sp.h - Instrumentation helpers for stored programs. -*/ - -#include "mysql/psi/psi.h" - -#ifndef PSI_SP_CALL -#define PSI_SP_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -#ifdef HAVE_PSI_SP_INTERFACE - #define MYSQL_START_SP(STATE, SP_SHARE) \ - inline_mysql_start_sp(STATE, SP_SHARE) -#else - #define MYSQL_START_SP(STATE, SP_SHARE) \ - NULL -#endif - - -#ifdef HAVE_PSI_SP_INTERFACE - #define MYSQL_END_SP(LOCKER) \ - inline_mysql_end_sp(LOCKER) -#else - #define MYSQL_END_SP(LOCKER) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_SP_INTERFACE - #define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \ - inline_mysql_drop_sp(OT, SN, SNL, ON, ONL) -#else - #define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_SP_INTERFACE - #define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \ - inline_mysql_get_sp_share(OT, SN, SNL, ON, ONL) -#else - #define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \ - NULL -#endif - -#ifdef HAVE_PSI_SP_INTERFACE -static inline struct PSI_sp_locker* -inline_mysql_start_sp(PSI_sp_locker_state *state, PSI_sp_share *sp_share) -{ - return PSI_SP_CALL(start_sp)(state, sp_share); -} - -static inline void inline_mysql_end_sp(PSI_sp_locker *locker) -{ - if (likely(locker != NULL)) - PSI_SP_CALL(end_sp)(locker); -} - -static inline void -inline_mysql_drop_sp(uint sp_type, - const char* schema_name, uint shcema_name_length, - const char* object_name, uint object_name_length) -{ - PSI_SP_CALL(drop_sp)(sp_type, - schema_name, shcema_name_length, - object_name, object_name_length); -} - -static inline PSI_sp_share* -inline_mysql_get_sp_share(uint sp_type, - const char* schema_name, uint shcema_name_length, - const char* object_name, uint object_name_length) -{ - return PSI_SP_CALL(get_sp_share)(sp_type, - schema_name, shcema_name_length, - object_name, object_name_length); -} -#endif - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_stage.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_stage.h deleted file mode 100644 index 732df6b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_stage.h +++ /dev/null @@ -1,205 +0,0 @@ -/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_STAGE_H -#define MYSQL_STAGE_H - -/** - @file mysql/psi/mysql_stage.h - Instrumentation helpers for stages. -*/ - -#include "mysql/psi/psi.h" - -#ifndef PSI_STAGE_CALL -#define PSI_STAGE_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -/** - @defgroup Stage_instrumentation Stage Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -/** - @def mysql_stage_register(P1, P2, P3) - Stage registration. -*/ -#ifdef HAVE_PSI_STAGE_INTERFACE -#define mysql_stage_register(P1, P2, P3) \ - inline_mysql_stage_register(P1, P2, P3) -#else -#define mysql_stage_register(P1, P2, P3) \ - do {} while (0) -#endif - -/** - @def MYSQL_SET_STAGE - Set the current stage. - Use this API when the file and line - is passed from the caller. - @param K the stage key - @param F the source file name - @param L the source file line - @return the current stage progress -*/ -#ifdef HAVE_PSI_STAGE_INTERFACE - #define MYSQL_SET_STAGE(K, F, L) \ - inline_mysql_set_stage(K, F, L) -#else - #define MYSQL_SET_STAGE(K, F, L) \ - NULL -#endif - -/** - @def mysql_set_stage - Set the current stage. - @param K the stage key - @return the current stage progress -*/ -#ifdef HAVE_PSI_STAGE_INTERFACE - #define mysql_set_stage(K) \ - inline_mysql_set_stage(K, __FILE__, __LINE__) -#else - #define mysql_set_stage(K) \ - NULL -#endif - -/** - @def mysql_end_stage - End the last stage -*/ -#ifdef HAVE_PSI_STAGE_INTERFACE - #define mysql_end_stage() \ - inline_mysql_end_stage() -#else - #define mysql_end_stage() \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STAGE_INTERFACE -static inline void inline_mysql_stage_register( - const char *category, PSI_stage_info **info, int count) -{ - PSI_STAGE_CALL(register_stage)(category, info, count); -} -#endif - -#ifdef HAVE_PSI_STAGE_INTERFACE -static inline PSI_stage_progress* -inline_mysql_set_stage(PSI_stage_key key, - const char *src_file, int src_line) -{ - return PSI_STAGE_CALL(start_stage)(key, src_file, src_line); -} -#endif - -#ifdef HAVE_PSI_STAGE_INTERFACE -static inline void -inline_mysql_end_stage() -{ - PSI_STAGE_CALL(end_stage)(); -} -#endif - -#ifdef HAVE_PSI_STAGE_INTERFACE -#define mysql_stage_set_work_completed(P1, P2) \ - inline_mysql_stage_set_work_completed(P1, P2) - -#define mysql_stage_get_work_completed(P1) \ - inline_mysql_stage_get_work_completed(P1) -#else -#define mysql_stage_set_work_completed(P1, P2) \ - do {} while (0) - -#define mysql_stage_get_work_completed(P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STAGE_INTERFACE -#define mysql_stage_inc_work_completed(P1, P2) \ - inline_mysql_stage_inc_work_completed(P1, P2) -#else -#define mysql_stage_inc_work_completed(P1, P2) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STAGE_INTERFACE -#define mysql_stage_set_work_estimated(P1, P2) \ - inline_mysql_stage_set_work_estimated(P1, P2) - -#define mysql_stage_get_work_estimated(P1) \ - inline_mysql_stage_get_work_estimated(P1) -#else -#define mysql_stage_set_work_estimated(P1, P2) \ - do {} while (0) - -#define mysql_stage_get_work_estimated(P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STAGE_INTERFACE -static inline void -inline_mysql_stage_set_work_completed(PSI_stage_progress *progress, - ulonglong val) -{ - if (progress != NULL) - progress->m_work_completed= val; -} - -static inline ulonglong -inline_mysql_stage_get_work_completed(PSI_stage_progress *progress) -{ - return progress->m_work_completed; -} -#endif - -#ifdef HAVE_PSI_STAGE_INTERFACE -static inline void -inline_mysql_stage_inc_work_completed(PSI_stage_progress *progress, - ulonglong val) -{ - if (progress != NULL) - progress->m_work_completed+= val; -} -#endif - -#ifdef HAVE_PSI_STAGE_INTERFACE -static inline void -inline_mysql_stage_set_work_estimated(PSI_stage_progress *progress, - ulonglong val) -{ - if (progress != NULL) - progress->m_work_estimated= val; -} - -static inline ulonglong -inline_mysql_stage_get_work_estimated(PSI_stage_progress *progress) -{ - return progress->m_work_estimated; -} -#endif - -/** @} (end of group Stage_instrumentation) */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_statement.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_statement.h deleted file mode 100644 index fab23d2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_statement.h +++ /dev/null @@ -1,243 +0,0 @@ -/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_STATEMENT_H -#define MYSQL_STATEMENT_H - -/** - @file mysql/psi/mysql_statement.h - Instrumentation helpers for statements. -*/ - -#include "mysql/psi/psi.h" - -class Diagnostics_area; -typedef const struct charset_info_st CHARSET_INFO; - -#ifndef PSI_STATEMENT_CALL -#define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -#ifndef PSI_DIGEST_CALL -#define PSI_DIGEST_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -/** - @defgroup Statement_instrumentation Statement Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -/** - @def mysql_statement_register(P1, P2, P3) - Statement registration. -*/ -#ifdef HAVE_PSI_STATEMENT_INTERFACE -#define mysql_statement_register(P1, P2, P3) \ - inline_mysql_statement_register(P1, P2, P3) -#else -#define mysql_statement_register(P1, P2, P3) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE - #define MYSQL_DIGEST_START(LOCKER) \ - inline_mysql_digest_start(LOCKER) -#else - #define MYSQL_DIGEST_START(LOCKER) \ - NULL -#endif - -#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE - #define MYSQL_DIGEST_END(LOCKER, DIGEST) \ - inline_mysql_digest_end(LOCKER, DIGEST) -#else - #define MYSQL_DIGEST_END(LOCKER, DIGEST) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STATEMENT_INTERFACE - #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \ - inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, SPS, __FILE__, __LINE__) -#else - #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \ - NULL -#endif - -#ifdef HAVE_PSI_STATEMENT_INTERFACE - #define MYSQL_REFINE_STATEMENT(LOCKER, K) \ - inline_mysql_refine_statement(LOCKER, K) -#else - #define MYSQL_REFINE_STATEMENT(LOCKER, K) \ - NULL -#endif - -#ifdef HAVE_PSI_STATEMENT_INTERFACE - #define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \ - inline_mysql_set_statement_text(LOCKER, P1, P2) -#else - #define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STATEMENT_INTERFACE - #define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \ - inline_mysql_set_statement_lock_time(LOCKER, P1) -#else - #define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STATEMENT_INTERFACE - #define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \ - inline_mysql_set_statement_rows_sent(LOCKER, P1) -#else - #define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STATEMENT_INTERFACE - #define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \ - inline_mysql_set_statement_rows_examined(LOCKER, P1) -#else - #define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STATEMENT_INTERFACE - #define MYSQL_END_STATEMENT(LOCKER, DA) \ - inline_mysql_end_statement(LOCKER, DA) -#else - #define MYSQL_END_STATEMENT(LOCKER, DA) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_STATEMENT_INTERFACE -static inline void inline_mysql_statement_register( - const char *category, PSI_statement_info *info, int count) -{ - PSI_STATEMENT_CALL(register_statement)(category, info, count); -} - -#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE -static inline struct PSI_digest_locker * -inline_mysql_digest_start(PSI_statement_locker *locker) -{ - PSI_digest_locker* digest_locker= NULL; - - if (psi_likely(locker != NULL)) - digest_locker= PSI_DIGEST_CALL(digest_start)(locker); - return digest_locker; -} -#endif - -#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE -static inline void -inline_mysql_digest_end(PSI_digest_locker *locker, const sql_digest_storage *digest) -{ - if (psi_likely(locker != NULL)) - PSI_DIGEST_CALL(digest_end)(locker, digest); -} -#endif - -static inline struct PSI_statement_locker * -inline_mysql_start_statement(PSI_statement_locker_state *state, - PSI_statement_key key, - const char *db, size_t db_len, - CHARSET_INFO *charset, - PSI_sp_share *sp_share, - const char *src_file, uint src_line) -{ - PSI_statement_locker *locker; - locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset, - sp_share); - if (psi_likely(locker != NULL)) - PSI_STATEMENT_CALL(start_statement)(locker, db, (uint)db_len, src_file, src_line); - return locker; -} - -static inline struct PSI_statement_locker * -inline_mysql_refine_statement(PSI_statement_locker *locker, - PSI_statement_key key) -{ - if (psi_likely(locker != NULL)) - { - locker= PSI_STATEMENT_CALL(refine_statement)(locker, key); - } - return locker; -} - -static inline void -inline_mysql_set_statement_text(PSI_statement_locker *locker, - const char *text, uint text_len) -{ - if (psi_likely(locker != NULL)) - { - PSI_STATEMENT_CALL(set_statement_text)(locker, text, text_len); - } -} - -static inline void -inline_mysql_set_statement_lock_time(PSI_statement_locker *locker, - ulonglong count) -{ - if (psi_likely(locker != NULL)) - { - PSI_STATEMENT_CALL(set_statement_lock_time)(locker, count); - } -} - -static inline void -inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker, - ulonglong count) -{ - if (psi_likely(locker != NULL)) - { - PSI_STATEMENT_CALL(set_statement_rows_sent)(locker, count); - } -} - -static inline void -inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker, - ulonglong count) -{ - if (psi_likely(locker != NULL)) - { - PSI_STATEMENT_CALL(set_statement_rows_examined)(locker, count); - } -} - -static inline void -inline_mysql_end_statement(struct PSI_statement_locker *locker, - Diagnostics_area *stmt_da) -{ - PSI_STAGE_CALL(end_stage)(); - if (psi_likely(locker != NULL)) - PSI_STATEMENT_CALL(end_statement)(locker, stmt_da); -} -#endif - -/** @} (end of group Statement_instrumentation) */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_table.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_table.h deleted file mode 100644 index a212406..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_table.h +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_TABLE_H -#define MYSQL_TABLE_H - -/** - @file mysql/psi/mysql_table.h - Instrumentation helpers for table io. -*/ - -#include "mysql/psi/psi.h" - -#ifndef PSI_TABLE_CALL -#define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -/** - @defgroup Table_instrumentation Table Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -#ifdef HAVE_PSI_TABLE_INTERFACE -#define MYSQL_UNBIND_TABLE(handler) (handler)->unbind_psi() - -#define PSI_CALL_unbind_table PSI_TABLE_CALL(unbind_table) -#define PSI_CALL_rebind_table PSI_TABLE_CALL(rebind_table) -#define PSI_CALL_open_table PSI_TABLE_CALL(open_table) -#define PSI_CALL_close_table PSI_TABLE_CALL(close_table) -#define PSI_CALL_get_table_share PSI_TABLE_CALL(get_table_share) -#define PSI_CALL_release_table_share PSI_TABLE_CALL(release_table_share) -#define PSI_CALL_drop_table_share PSI_TABLE_CALL(drop_table_share) -#else -#define MYSQL_UNBIND_TABLE(handler) do { } while(0) - -#define PSI_CALL_unbind_table(A1) do { } while(0) -#define PSI_CALL_rebind_table(A1,A2,A3) NULL -#define PSI_CALL_close_table(A1,A2) do { } while(0) -#define PSI_CALL_open_table(A1,A2) NULL -#define PSI_CALL_get_table_share(A1,A2) NULL -#define PSI_CALL_release_table_share(A1) do { } while(0) -#define PSI_CALL_drop_table_share(A1,A2,A3,A4,A5) do { } while(0) -#endif - -/** - @def MYSQL_TABLE_WAIT_VARIABLES - Instrumentation helper for table waits. - This instrumentation declares local variables. - Do not use a ';' after this macro - @param LOCKER the locker - @param STATE the locker state - @sa MYSQL_START_TABLE_IO_WAIT. - @sa MYSQL_END_TABLE_IO_WAIT. - @sa MYSQL_START_TABLE_LOCK_WAIT. - @sa MYSQL_END_TABLE_LOCK_WAIT. -*/ -#ifdef HAVE_PSI_TABLE_INTERFACE - #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \ - struct PSI_table_locker* LOCKER; \ - PSI_table_locker_state STATE; -#else - #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) -#endif - -/** - @def MYSQL_START_TABLE_LOCK_WAIT - Instrumentation helper for table lock waits. - This instrumentation marks the start of a wait event. - @param LOCKER the locker - @param STATE the locker state - @param PSI the instrumented table - @param OP the table operation to be performed - @param FLAGS per table operation flags. - @sa MYSQL_END_TABLE_LOCK_WAIT. -*/ -#ifdef HAVE_PSI_TABLE_INTERFACE - #define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \ - LOCKER= inline_mysql_start_table_lock_wait(STATE, PSI, \ - OP, FLAGS, __FILE__, __LINE__) -#else - #define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \ - do {} while (0) -#endif - -/** - @def MYSQL_END_TABLE_LOCK_WAIT - Instrumentation helper for table lock waits. - This instrumentation marks the end of a wait event. - @param LOCKER the locker - @sa MYSQL_START_TABLE_LOCK_WAIT. -*/ -#ifdef HAVE_PSI_TABLE_INTERFACE - #define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \ - inline_mysql_end_table_lock_wait(LOCKER) -#else - #define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_TABLE_INTERFACE - #define MYSQL_UNLOCK_TABLE(T) \ - inline_mysql_unlock_table(T) -#else - #define MYSQL_UNLOCK_TABLE(T) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_TABLE_INTERFACE -/** - Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT. - @sa MYSQL_END_TABLE_LOCK_WAIT. -*/ -static inline struct PSI_table_locker * -inline_mysql_start_table_lock_wait(PSI_table_locker_state *state, - struct PSI_table *psi, - enum PSI_table_lock_operation op, - ulong flags, const char *src_file, uint src_line) -{ - if (psi_likely(psi != NULL)) - { - struct PSI_table_locker *locker; - locker= PSI_TABLE_CALL(start_table_lock_wait) - (state, psi, op, flags, src_file, src_line); - return locker; - } - return NULL; -} - -/** - Instrumentation calls for MYSQL_END_TABLE_LOCK_WAIT. - @sa MYSQL_START_TABLE_LOCK_WAIT. -*/ -static inline void -inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker) -{ - if (psi_likely(locker != NULL)) - PSI_TABLE_CALL(end_table_lock_wait)(locker); -} - -static inline void -inline_mysql_unlock_table(struct PSI_table *table) -{ - if (table != NULL) - PSI_TABLE_CALL(unlock_table)(table); -} -#endif - -/** @} (end of group Table_instrumentation) */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_thread.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_thread.h deleted file mode 100644 index 47f89f7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_thread.h +++ /dev/null @@ -1,1349 +0,0 @@ -/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_THREAD_H -#define MYSQL_THREAD_H - -/** - @file mysql/psi/mysql_thread.h - Instrumentation helpers for mysys threads, mutexes, - read write locks and conditions. - This header file provides the necessary declarations - to use the mysys thread API with the performance schema instrumentation. - In some compilers (SunStudio), 'static inline' functions, when declared - but not used, are not optimized away (because they are unused) by default, - so that including a static inline function from a header file does - create unwanted dependencies, causing unresolved symbols at link time. - Other compilers, like gcc, optimize these dependencies by default. - - Since the instrumented APIs declared here are wrapper on top - of my_pthread / safemutex / etc APIs, - including mysql/psi/mysql_thread.h assumes that - the dependency on my_pthread and safemutex already exists. -*/ -/* - Note: there are several orthogonal dimensions here. - - Dimension 1: Instrumentation - HAVE_PSI_INTERFACE is defined when the instrumentation is compiled in. - This may happen both in debug or production builds. - - Dimension 2: Debug - SAFE_MUTEX is defined when debug is compiled in. - This may happen both with and without instrumentation. - - Dimension 3: Platform - Mutexes are implemented with one of: - - the pthread library - - fast mutexes - - window apis - This is implemented by various macro definitions in my_pthread.h - - This causes complexity with '#ifdef'-ery that can't be avoided. -*/ - -#include "mysql/psi/psi.h" -#ifdef MYSQL_SERVER -#ifndef MYSQL_DYNAMIC_PLUGIN -#include "pfs_thread_provider.h" -#endif -#endif - -#ifndef PSI_MUTEX_CALL -#define PSI_MUTEX_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -#ifndef PSI_RWLOCK_CALL -#define PSI_RWLOCK_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -#ifndef PSI_COND_CALL -#define PSI_COND_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -#ifndef PSI_THREAD_CALL -#define PSI_THREAD_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -/** - @defgroup Thread_instrumentation Thread Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -#ifdef HAVE_PSI_THREAD_INTERFACE -#define PSI_CALL_delete_current_thread PSI_THREAD_CALL(delete_current_thread) -#define PSI_CALL_get_thread PSI_THREAD_CALL(get_thread) -#define PSI_CALL_new_thread PSI_THREAD_CALL(new_thread) -#define PSI_CALL_register_thread PSI_THREAD_CALL(register_thread) -#define PSI_CALL_set_thread PSI_THREAD_CALL(set_thread) -#define PSI_CALL_set_thread_THD PSI_THREAD_CALL(set_thread_THD) -#define PSI_CALL_set_thread_connect_attrs PSI_THREAD_CALL(set_thread_connect_attrs) -#define PSI_CALL_set_thread_db PSI_THREAD_CALL(set_thread_db) -#define PSI_CALL_set_thread_id PSI_THREAD_CALL(set_thread_id) -#define PSI_CALL_set_thread_os_id PSI_THREAD_CALL(set_thread_os_id) -#define PSI_CALL_set_thread_info PSI_THREAD_CALL(set_thread_info) -#define PSI_CALL_set_thread_start_time PSI_THREAD_CALL(set_thread_start_time) -#define PSI_CALL_set_thread_account PSI_THREAD_CALL(set_thread_account) -#define PSI_CALL_spawn_thread PSI_THREAD_CALL(spawn_thread) -#define PSI_CALL_set_connection_type PSI_THREAD_CALL(set_connection_type) -#else -#define PSI_CALL_delete_current_thread() do { } while(0) -#define PSI_CALL_get_thread() NULL -#define PSI_CALL_new_thread(A1,A2,A3) NULL -#define PSI_CALL_register_thread(A1,A2,A3) do { } while(0) -#define PSI_CALL_set_thread(A1) do { } while(0) -#define PSI_CALL_set_thread_THD(A1,A2) do { } while(0) -#define PSI_CALL_set_thread_connect_attrs(A1,A2,A3) 0 -#define PSI_CALL_set_thread_db(A1,A2) do { } while(0) -#define PSI_CALL_set_thread_id(A1,A2) do { } while(0) -#define PSI_CALL_set_thread_os_id(A1) do { } while(0) -#define PSI_CALL_set_thread_info(A1, A2) do { } while(0) -#define PSI_CALL_set_thread_start_time(A1) do { } while(0) -#define PSI_CALL_set_thread_account(A1, A2, A3, A4) do { } while(0) -#define PSI_CALL_spawn_thread(A1, A2, A3, A4, A5) 0 -#define PSI_CALL_set_connection_type(A) do { } while(0) -#endif - - -/** - An instrumented mutex structure. - @sa mysql_mutex_t -*/ -struct st_mysql_mutex -{ - /** The real mutex. */ -#ifdef SAFE_MUTEX - safe_mutex_t m_mutex; -#else - pthread_mutex_t m_mutex; -#endif - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c mysql_mutex_t interface. - */ - struct PSI_mutex *m_psi; -}; - -/** - Type of an instrumented mutex. - @c mysql_mutex_t is a drop-in replacement for @c pthread_mutex_t. - @sa mysql_mutex_assert_owner - @sa mysql_mutex_assert_not_owner - @sa mysql_mutex_init - @sa mysql_mutex_lock - @sa mysql_mutex_unlock - @sa mysql_mutex_destroy -*/ -typedef struct st_mysql_mutex mysql_mutex_t; - -/** - An instrumented rwlock structure. - @sa mysql_rwlock_t -*/ -struct st_mysql_rwlock -{ - /** The real rwlock */ - rw_lock_t m_rwlock; - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c mysql_rwlock_t interface. - */ - struct PSI_rwlock *m_psi; -}; - -/** - An instrumented prlock structure. - @sa mysql_prlock_t -*/ -struct st_mysql_prlock -{ - /** The real prlock */ - rw_pr_lock_t m_prlock; - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c mysql_rwlock_t interface. - */ - struct PSI_rwlock *m_psi; -}; - -/** - Type of an instrumented rwlock. - @c mysql_rwlock_t is a drop-in replacement for @c pthread_rwlock_t. - @sa mysql_rwlock_init - @sa mysql_rwlock_rdlock - @sa mysql_rwlock_tryrdlock - @sa mysql_rwlock_wrlock - @sa mysql_rwlock_trywrlock - @sa mysql_rwlock_unlock - @sa mysql_rwlock_destroy -*/ -typedef struct st_mysql_rwlock mysql_rwlock_t; - -/** - Type of an instrumented prlock. - A prlock is a read write lock that 'prefers readers' (pr). - @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t. - @sa mysql_prlock_init - @sa mysql_prlock_rdlock - @sa mysql_prlock_wrlock - @sa mysql_prlock_unlock - @sa mysql_prlock_destroy -*/ -typedef struct st_mysql_prlock mysql_prlock_t; - -/** - An instrumented cond structure. - @sa mysql_cond_t -*/ -struct st_mysql_cond -{ - /** The real condition */ - pthread_cond_t m_cond; - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c mysql_cond_t interface. - */ - struct PSI_cond *m_psi; -}; - -/** - Type of an instrumented condition. - @c mysql_cond_t is a drop-in replacement for @c pthread_cond_t. - @sa mysql_cond_init - @sa mysql_cond_wait - @sa mysql_cond_timedwait - @sa mysql_cond_signal - @sa mysql_cond_broadcast - @sa mysql_cond_destroy -*/ -typedef struct st_mysql_cond mysql_cond_t; - -/* - Consider the following code: - static inline void foo() { bar(); } - when foo() is never called. - - With gcc, foo() is a local static function, so the dependencies - are optimized away at compile time, and there is no dependency on bar(). - With other compilers (HP, Sun Studio), the function foo() implementation - is compiled, and bar() needs to be present to link. - - Due to the existing header dependencies in MySQL code, this header file - is sometime used when it is not needed, which in turn cause link failures - on some platforms. - The proper fix would be to cut these extra dependencies in the calling code. - DISABLE_MYSQL_THREAD_H is a work around to limit dependencies. - DISABLE_MYSQL_PRLOCK_H is similar, and is used to disable specifically - the prlock wrappers. -*/ -#ifndef DISABLE_MYSQL_THREAD_H - -#define mysql_mutex_is_owner(M) safe_mutex_is_owner(&(M)->m_mutex) -/** - @def mysql_mutex_assert_owner(M) - Wrapper, to use safe_mutex_assert_owner with instrumented mutexes. - @c mysql_mutex_assert_owner is a drop-in replacement - for @c safe_mutex_assert_owner. -*/ -#define mysql_mutex_assert_owner(M) \ - safe_mutex_assert_owner(&(M)->m_mutex) - -/** - @def mysql_mutex_assert_not_owner(M) - Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes. - @c mysql_mutex_assert_not_owner is a drop-in replacement - for @c safe_mutex_assert_not_owner. -*/ -#define mysql_mutex_assert_not_owner(M) \ - safe_mutex_assert_not_owner(&(M)->m_mutex) - -#define mysql_mutex_setflags(M, F) \ - safe_mutex_setflags(&(M)->m_mutex, (F)) - -/** - @def mysql_prlock_assert_write_owner(M) - Drop-in replacement - for @c rw_pr_lock_assert_write_owner. -*/ -#define mysql_prlock_assert_write_owner(M) \ - rw_pr_lock_assert_write_owner(&(M)->m_prlock) - -/** - @def mysql_prlock_assert_not_write_owner(M) - Drop-in replacement - for @c rw_pr_lock_assert_not_write_owner. -*/ -#define mysql_prlock_assert_not_write_owner(M) \ - rw_pr_lock_assert_not_write_owner(&(M)->m_prlock) - -/** - @def mysql_mutex_register(P1, P2, P3) - Mutex registration. -*/ -#define mysql_mutex_register(P1, P2, P3) \ - inline_mysql_mutex_register(P1, P2, P3) - -/** - @def mysql_mutex_init(K, M, A) - Instrumented mutex_init. - @c mysql_mutex_init is a replacement for @c pthread_mutex_init. - @param K The PSI_mutex_key for this instrumented mutex - @param M The mutex to initialize - @param A Mutex attributes -*/ - -#ifdef HAVE_PSI_MUTEX_INTERFACE - #ifdef SAFE_MUTEX - #define mysql_mutex_init(K, M, A) \ - inline_mysql_mutex_init(K, M, A, #M, __FILE__, __LINE__) - #else - #define mysql_mutex_init(K, M, A) \ - inline_mysql_mutex_init(K, M, A) - #endif -#else - #ifdef SAFE_MUTEX - #define mysql_mutex_init(K, M, A) \ - inline_mysql_mutex_init(M, A, #M, __FILE__, __LINE__) - #else - #define mysql_mutex_init(K, M, A) \ - inline_mysql_mutex_init(M, A) - #endif -#endif - -/** - @def mysql_mutex_destroy(M) - Instrumented mutex_destroy. - @c mysql_mutex_destroy is a drop-in replacement - for @c pthread_mutex_destroy. -*/ -#ifdef SAFE_MUTEX - #define mysql_mutex_destroy(M) \ - inline_mysql_mutex_destroy(M, __FILE__, __LINE__) -#else - #define mysql_mutex_destroy(M) \ - inline_mysql_mutex_destroy(M) -#endif - -/** - @def mysql_mutex_lock(M) - Instrumented mutex_lock. - @c mysql_mutex_lock is a drop-in replacement for @c pthread_mutex_lock. - @param M The mutex to lock -*/ - -#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) - #define mysql_mutex_lock(M) \ - inline_mysql_mutex_lock(M, __FILE__, __LINE__) -#else - #define mysql_mutex_lock(M) \ - inline_mysql_mutex_lock(M) -#endif - -/** - @def mysql_mutex_trylock(M) - Instrumented mutex_lock. - @c mysql_mutex_trylock is a drop-in replacement - for @c pthread_mutex_trylock. -*/ - -#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) - #define mysql_mutex_trylock(M) \ - inline_mysql_mutex_trylock(M, __FILE__, __LINE__) -#else - #define mysql_mutex_trylock(M) \ - inline_mysql_mutex_trylock(M) -#endif - -/** - @def mysql_mutex_unlock(M) - Instrumented mutex_unlock. - @c mysql_mutex_unlock is a drop-in replacement for @c pthread_mutex_unlock. -*/ -#ifdef SAFE_MUTEX - #define mysql_mutex_unlock(M) \ - inline_mysql_mutex_unlock(M, __FILE__, __LINE__) -#else - #define mysql_mutex_unlock(M) \ - inline_mysql_mutex_unlock(M) -#endif - -/** - @def mysql_rwlock_register(P1, P2, P3) - Rwlock registration. -*/ -#define mysql_rwlock_register(P1, P2, P3) \ - inline_mysql_rwlock_register(P1, P2, P3) - -/** - @def mysql_rwlock_init(K, RW) - Instrumented rwlock_init. - @c mysql_rwlock_init is a replacement for @c pthread_rwlock_init. - Note that pthread_rwlockattr_t is not supported in MySQL. - @param K The PSI_rwlock_key for this instrumented rwlock - @param RW The rwlock to initialize -*/ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(K, RW) -#else - #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW) -#endif - -/** - @def mysql_prlock_init(K, RW) - Instrumented rw_pr_init. - @c mysql_prlock_init is a replacement for @c rw_pr_init. - @param K The PSI_rwlock_key for this instrumented prlock - @param RW The prlock to initialize -*/ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(K, RW) -#else - #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(RW) -#endif - -/** - @def mysql_rwlock_destroy(RW) - Instrumented rwlock_destroy. - @c mysql_rwlock_destroy is a drop-in replacement - for @c pthread_rwlock_destroy. -*/ -#define mysql_rwlock_destroy(RW) inline_mysql_rwlock_destroy(RW) - -/** - @def mysql_prlock_destroy(RW) - Instrumented rw_pr_destroy. - @c mysql_prlock_destroy is a drop-in replacement - for @c rw_pr_destroy. -*/ -#define mysql_prlock_destroy(RW) inline_mysql_prlock_destroy(RW) - -/** - @def mysql_rwlock_rdlock(RW) - Instrumented rwlock_rdlock. - @c mysql_rwlock_rdlock is a drop-in replacement - for @c pthread_rwlock_rdlock. -*/ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - #define mysql_rwlock_rdlock(RW) \ - inline_mysql_rwlock_rdlock(RW, __FILE__, __LINE__) -#else - #define mysql_rwlock_rdlock(RW) \ - inline_mysql_rwlock_rdlock(RW) -#endif - -/** - @def mysql_prlock_rdlock(RW) - Instrumented rw_pr_rdlock. - @c mysql_prlock_rdlock is a drop-in replacement - for @c rw_pr_rdlock. -*/ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - #define mysql_prlock_rdlock(RW) \ - inline_mysql_prlock_rdlock(RW, __FILE__, __LINE__) -#else - #define mysql_prlock_rdlock(RW) \ - inline_mysql_prlock_rdlock(RW) -#endif - -/** - @def mysql_rwlock_wrlock(RW) - Instrumented rwlock_wrlock. - @c mysql_rwlock_wrlock is a drop-in replacement - for @c pthread_rwlock_wrlock. -*/ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - #define mysql_rwlock_wrlock(RW) \ - inline_mysql_rwlock_wrlock(RW, __FILE__, __LINE__) -#else - #define mysql_rwlock_wrlock(RW) \ - inline_mysql_rwlock_wrlock(RW) -#endif - -/** - @def mysql_prlock_wrlock(RW) - Instrumented rw_pr_wrlock. - @c mysql_prlock_wrlock is a drop-in replacement - for @c rw_pr_wrlock. -*/ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - #define mysql_prlock_wrlock(RW) \ - inline_mysql_prlock_wrlock(RW, __FILE__, __LINE__) -#else - #define mysql_prlock_wrlock(RW) \ - inline_mysql_prlock_wrlock(RW) -#endif - -/** - @def mysql_rwlock_tryrdlock(RW) - Instrumented rwlock_tryrdlock. - @c mysql_rwlock_tryrdlock is a drop-in replacement - for @c pthread_rwlock_tryrdlock. -*/ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - #define mysql_rwlock_tryrdlock(RW) \ - inline_mysql_rwlock_tryrdlock(RW, __FILE__, __LINE__) -#else - #define mysql_rwlock_tryrdlock(RW) \ - inline_mysql_rwlock_tryrdlock(RW) -#endif - -/** - @def mysql_rwlock_trywrlock(RW) - Instrumented rwlock_trywrlock. - @c mysql_rwlock_trywrlock is a drop-in replacement - for @c pthread_rwlock_trywrlock. -*/ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - #define mysql_rwlock_trywrlock(RW) \ - inline_mysql_rwlock_trywrlock(RW, __FILE__, __LINE__) -#else - #define mysql_rwlock_trywrlock(RW) \ - inline_mysql_rwlock_trywrlock(RW) -#endif - -/** - @def mysql_rwlock_unlock(RW) - Instrumented rwlock_unlock. - @c mysql_rwlock_unlock is a drop-in replacement - for @c pthread_rwlock_unlock. -*/ -#define mysql_rwlock_unlock(RW) inline_mysql_rwlock_unlock(RW) - -/** - @def mysql_prlock_unlock(RW) - Instrumented rw_pr_unlock. - @c mysql_prlock_unlock is a drop-in replacement - for @c rw_pr_unlock. -*/ -#define mysql_prlock_unlock(RW) inline_mysql_prlock_unlock(RW) - -/** - @def mysql_cond_register(P1, P2, P3) - Cond registration. -*/ -#define mysql_cond_register(P1, P2, P3) \ - inline_mysql_cond_register(P1, P2, P3) - -/** - @def mysql_cond_init(K, C, A) - Instrumented cond_init. - @c mysql_cond_init is a replacement for @c pthread_cond_init. - @param C The cond to initialize - @param K The PSI_cond_key for this instrumented cond - @param A Condition attributes -*/ -#ifdef HAVE_PSI_COND_INTERFACE - #define mysql_cond_init(K, C, A) inline_mysql_cond_init(K, C, A) -#else - #define mysql_cond_init(K, C, A) inline_mysql_cond_init(C, A) -#endif - -/** - @def mysql_cond_destroy(C) - Instrumented cond_destroy. - @c mysql_cond_destroy is a drop-in replacement for @c pthread_cond_destroy. -*/ -#define mysql_cond_destroy(C) inline_mysql_cond_destroy(C) - -/** - @def mysql_cond_wait(C) - Instrumented cond_wait. - @c mysql_cond_wait is a drop-in replacement for @c pthread_cond_wait. -*/ -#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) - #define mysql_cond_wait(C, M) \ - inline_mysql_cond_wait(C, M, __FILE__, __LINE__) -#else - #define mysql_cond_wait(C, M) \ - inline_mysql_cond_wait(C, M) -#endif - -/** - @def mysql_cond_timedwait(C, M, W) - Instrumented cond_timedwait. - @c mysql_cond_timedwait is a drop-in replacement - for @c pthread_cond_timedwait. -*/ -#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) - #define mysql_cond_timedwait(C, M, W) \ - inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__) -#else - #define mysql_cond_timedwait(C, M, W) \ - inline_mysql_cond_timedwait(C, M, W) -#endif - -/** - @def mysql_cond_signal(C) - Instrumented cond_signal. - @c mysql_cond_signal is a drop-in replacement for @c pthread_cond_signal. -*/ -#define mysql_cond_signal(C) inline_mysql_cond_signal(C) - -/** - @def mysql_cond_broadcast(C) - Instrumented cond_broadcast. - @c mysql_cond_broadcast is a drop-in replacement - for @c pthread_cond_broadcast. -*/ -#define mysql_cond_broadcast(C) inline_mysql_cond_broadcast(C) - -/** - @def mysql_thread_register(P1, P2, P3) - Thread registration. -*/ -#define mysql_thread_register(P1, P2, P3) \ - inline_mysql_thread_register(P1, P2, P3) - -/** - @def mysql_thread_create(K, P1, P2, P3, P4) - Instrumented pthread_create. - This function creates both the thread instrumentation and a thread. - @c mysql_thread_create is a replacement for @c pthread_create. - The parameter P4 (or, if it is NULL, P1) will be used as the - instrumented thread "indentity". - Providing a P1 / P4 parameter with a different value for each call - will on average improve performances, since this thread identity value - is used internally to randomize access to data and prevent contention. - This is optional, and the improvement is not guaranteed, only statistical. - @param K The PSI_thread_key for this instrumented thread - @param P1 pthread_create parameter 1 - @param P2 pthread_create parameter 2 - @param P3 pthread_create parameter 3 - @param P4 pthread_create parameter 4 -*/ -#ifdef HAVE_PSI_THREAD_INTERFACE - #define mysql_thread_create(K, P1, P2, P3, P4) \ - inline_mysql_thread_create(K, P1, P2, P3, P4) -#else - #define mysql_thread_create(K, P1, P2, P3, P4) \ - pthread_create(P1, P2, P3, P4) -#endif - -/** - @def mysql_thread_set_psi_id(I) - Set the thread identifier for the instrumentation. - @param I The thread identifier -*/ -#ifdef HAVE_PSI_THREAD_INTERFACE - #define mysql_thread_set_psi_id(I) inline_mysql_thread_set_psi_id(I) -#else - #define mysql_thread_set_psi_id(I) do {} while (0) -#endif - -/** - @def mysql_thread_set_psi_THD(T) - Set the thread sql session for the instrumentation. - @param I The thread identifier -*/ -#ifdef HAVE_PSI_THREAD_INTERFACE - #define mysql_thread_set_psi_THD(T) inline_mysql_thread_set_psi_THD(T) -#else - #define mysql_thread_set_psi_THD(T) do {} while (0) -#endif - -static inline void inline_mysql_mutex_register( -#ifdef HAVE_PSI_MUTEX_INTERFACE - const char *category, - PSI_mutex_info *info, - int count -#else - const char *category __attribute__ ((unused)), - void *info __attribute__ ((unused)), - int count __attribute__ ((unused)) -#endif -) -{ -#ifdef HAVE_PSI_MUTEX_INTERFACE - PSI_MUTEX_CALL(register_mutex)(category, info, count); -#endif -} - -static inline int inline_mysql_mutex_init( -#ifdef HAVE_PSI_MUTEX_INTERFACE - PSI_mutex_key key, -#endif - mysql_mutex_t *that, - const pthread_mutexattr_t *attr -#ifdef SAFE_MUTEX - , const char *src_name, const char *src_file, uint src_line -#endif - ) -{ -#ifdef HAVE_PSI_MUTEX_INTERFACE - that->m_psi= PSI_MUTEX_CALL(init_mutex)(key, &that->m_mutex); -#else - that->m_psi= NULL; -#endif -#ifdef SAFE_MUTEX - return safe_mutex_init(&that->m_mutex, attr, src_name, src_file, src_line); -#else - return pthread_mutex_init(&that->m_mutex, attr); -#endif -} - -static inline int inline_mysql_mutex_destroy( - mysql_mutex_t *that -#ifdef SAFE_MUTEX - , const char *src_file, uint src_line -#endif - ) -{ -#ifdef HAVE_PSI_MUTEX_INTERFACE - if (that->m_psi != NULL) - { - PSI_MUTEX_CALL(destroy_mutex)(that->m_psi); - that->m_psi= NULL; - } -#endif -#ifdef SAFE_MUTEX - return safe_mutex_destroy(&that->m_mutex, src_file, src_line); -#else - return pthread_mutex_destroy(&that->m_mutex); -#endif -} - -static inline int inline_mysql_mutex_lock( - mysql_mutex_t *that -#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_MUTEX_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_mutex_locker *locker; - PSI_mutex_locker_state state; - locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi, - PSI_MUTEX_LOCK, src_file, src_line); - - /* Instrumented code */ -#ifdef SAFE_MUTEX - result= safe_mutex_lock(&that->m_mutex, FALSE, src_file, src_line); -#else - result= pthread_mutex_lock(&that->m_mutex); -#endif - - /* Instrumentation end */ - if (locker != NULL) - PSI_MUTEX_CALL(end_mutex_wait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ -#ifdef SAFE_MUTEX - result= safe_mutex_lock(&that->m_mutex, FALSE, src_file, src_line); -#else - result= pthread_mutex_lock(&that->m_mutex); -#endif - - return result; -} - -static inline int inline_mysql_mutex_trylock( - mysql_mutex_t *that -#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_MUTEX_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_mutex_locker *locker; - PSI_mutex_locker_state state; - locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi, - PSI_MUTEX_TRYLOCK, src_file, src_line); - - /* Instrumented code */ -#ifdef SAFE_MUTEX - result= safe_mutex_lock(&that->m_mutex, TRUE, src_file, src_line); -#else - result= pthread_mutex_trylock(&that->m_mutex); -#endif - - /* Instrumentation end */ - if (locker != NULL) - PSI_MUTEX_CALL(end_mutex_wait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ -#ifdef SAFE_MUTEX - result= safe_mutex_lock(&that->m_mutex, TRUE, src_file, src_line); -#else - result= pthread_mutex_trylock(&that->m_mutex); -#endif - - return result; -} - -static inline int inline_mysql_mutex_unlock( - mysql_mutex_t *that -#ifdef SAFE_MUTEX - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_MUTEX_INTERFACE - if (psi_likely(that->m_psi != NULL)) - PSI_MUTEX_CALL(unlock_mutex)(that->m_psi); -#endif - -#ifdef SAFE_MUTEX - result= safe_mutex_unlock(&that->m_mutex, src_file, src_line); -#else - result= pthread_mutex_unlock(&that->m_mutex); -#endif - - return result; -} - -static inline void inline_mysql_rwlock_register( -#ifdef HAVE_PSI_RWLOCK_INTERFACE - const char *category, - PSI_rwlock_info *info, - int count -#else - const char *category __attribute__ ((unused)), - void *info __attribute__ ((unused)), - int count __attribute__ ((unused)) -#endif -) -{ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - PSI_RWLOCK_CALL(register_rwlock)(category, info, count); -#endif -} - -static inline int inline_mysql_rwlock_init( -#ifdef HAVE_PSI_RWLOCK_INTERFACE - PSI_rwlock_key key, -#endif - mysql_rwlock_t *that) -{ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_rwlock); -#else - that->m_psi= NULL; -#endif - /* - pthread_rwlockattr_t is not used in MySQL. - */ - return my_rwlock_init(&that->m_rwlock, NULL); -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_init( -#ifdef HAVE_PSI_RWLOCK_INTERFACE - PSI_rwlock_key key, -#endif - mysql_prlock_t *that) -{ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_prlock); -#else - that->m_psi= NULL; -#endif - return rw_pr_init(&that->m_prlock); -} -#endif - -static inline int inline_mysql_rwlock_destroy( - mysql_rwlock_t *that) -{ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi); - that->m_psi= NULL; - } -#endif - return rwlock_destroy(&that->m_rwlock); -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_destroy( - mysql_prlock_t *that) -{ -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi); - that->m_psi= NULL; - } -#endif - return rw_pr_destroy(&that->m_prlock); -} -#endif - -static inline int inline_mysql_rwlock_rdlock( - mysql_rwlock_t *that -#ifdef HAVE_PSI_RWLOCK_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_rwlock_locker *locker; - PSI_rwlock_locker_state state; - locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi, - PSI_RWLOCK_READLOCK, src_file, src_line); - - /* Instrumented code */ - result= rw_rdlock(&that->m_rwlock); - - /* Instrumentation end */ - if (locker != NULL) - PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ - result= rw_rdlock(&that->m_rwlock); - - return result; -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_rdlock( - mysql_prlock_t *that -#ifdef HAVE_PSI_RWLOCK_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_rwlock_locker *locker; - PSI_rwlock_locker_state state; - locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi, - PSI_RWLOCK_READLOCK, src_file, src_line); - - /* Instrumented code */ - result= rw_pr_rdlock(&that->m_prlock); - - /* Instrumentation end */ - if (locker != NULL) - PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ - result= rw_pr_rdlock(&that->m_prlock); - - return result; -} -#endif - -static inline int inline_mysql_rwlock_wrlock( - mysql_rwlock_t *that -#ifdef HAVE_PSI_RWLOCK_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_rwlock_locker *locker; - PSI_rwlock_locker_state state; - locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi, - PSI_RWLOCK_WRITELOCK, src_file, src_line); - - /* Instrumented code */ - result= rw_wrlock(&that->m_rwlock); - - /* Instrumentation end */ - if (locker != NULL) - PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ - result= rw_wrlock(&that->m_rwlock); - - return result; -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_wrlock( - mysql_prlock_t *that -#ifdef HAVE_PSI_RWLOCK_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_rwlock_locker *locker; - PSI_rwlock_locker_state state; - locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi, - PSI_RWLOCK_WRITELOCK, src_file, src_line); - - /* Instrumented code */ - result= rw_pr_wrlock(&that->m_prlock); - - /* Instrumentation end */ - if (locker != NULL) - PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ - result= rw_pr_wrlock(&that->m_prlock); - - return result; -} -#endif - -static inline int inline_mysql_rwlock_tryrdlock( - mysql_rwlock_t *that -#ifdef HAVE_PSI_RWLOCK_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_rwlock_locker *locker; - PSI_rwlock_locker_state state; - locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi, - PSI_RWLOCK_TRYREADLOCK, src_file, src_line); - - /* Instrumented code */ - result= rw_tryrdlock(&that->m_rwlock); - - /* Instrumentation end */ - if (locker != NULL) - PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ - result= rw_tryrdlock(&that->m_rwlock); - - return result; -} - -static inline int inline_mysql_rwlock_trywrlock( - mysql_rwlock_t *that -#ifdef HAVE_PSI_RWLOCK_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_rwlock_locker *locker; - PSI_rwlock_locker_state state; - locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi, - PSI_RWLOCK_TRYWRITELOCK, src_file, src_line); - - /* Instrumented code */ - result= rw_trywrlock(&that->m_rwlock); - - /* Instrumentation end */ - if (locker != NULL) - PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ - result= rw_trywrlock(&that->m_rwlock); - - return result; -} - -static inline int inline_mysql_rwlock_unlock( - mysql_rwlock_t *that) -{ - int result; -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi); -#endif - result= rw_unlock(&that->m_rwlock); - return result; -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_unlock( - mysql_prlock_t *that) -{ - int result; -#ifdef HAVE_PSI_RWLOCK_INTERFACE - if (psi_likely(that->m_psi != NULL)) - PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi); -#endif - result= rw_pr_unlock(&that->m_prlock); - return result; -} -#endif - -static inline void inline_mysql_cond_register( -#ifdef HAVE_PSI_COND_INTERFACE - const char *category, - PSI_cond_info *info, - int count -#else - const char *category __attribute__ ((unused)), - void *info __attribute__ ((unused)), - int count __attribute__ ((unused)) -#endif -) -{ -#ifdef HAVE_PSI_COND_INTERFACE - PSI_COND_CALL(register_cond)(category, info, count); -#endif -} - -static inline int inline_mysql_cond_init( -#ifdef HAVE_PSI_COND_INTERFACE - PSI_cond_key key, -#endif - mysql_cond_t *that, - const pthread_condattr_t *attr) -{ -#ifdef HAVE_PSI_COND_INTERFACE - that->m_psi= PSI_COND_CALL(init_cond)(key, &that->m_cond); -#else - that->m_psi= NULL; -#endif - return pthread_cond_init(&that->m_cond, attr); -} - -static inline int inline_mysql_cond_destroy( - mysql_cond_t *that) -{ -#ifdef HAVE_PSI_COND_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - PSI_COND_CALL(destroy_cond)(that->m_psi); - that->m_psi= NULL; - } -#endif - return pthread_cond_destroy(&that->m_cond); -} - -static inline int inline_mysql_cond_wait( - mysql_cond_t *that, - mysql_mutex_t *mutex -#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_COND_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_cond_locker *locker; - PSI_cond_locker_state state; - locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi, - PSI_COND_WAIT, src_file, src_line); - - /* Instrumented code */ - result= my_cond_wait(&that->m_cond, &mutex->m_mutex); - - /* Instrumentation end */ - if (locker != NULL) - PSI_COND_CALL(end_cond_wait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ - result= my_cond_wait(&that->m_cond, &mutex->m_mutex); - - return result; -} - -static inline int inline_mysql_cond_timedwait( - mysql_cond_t *that, - mysql_mutex_t *mutex, - const struct timespec *abstime -#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) - , const char *src_file, uint src_line -#endif - ) -{ - int result; - -#ifdef HAVE_PSI_COND_INTERFACE - if (psi_likely(that->m_psi != NULL)) - { - /* Instrumentation start */ - PSI_cond_locker *locker; - PSI_cond_locker_state state; - locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi, - PSI_COND_TIMEDWAIT, src_file, src_line); - - /* Instrumented code */ - result= my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime); - - /* Instrumentation end */ - if (psi_likely(locker != NULL)) - PSI_COND_CALL(end_cond_wait)(locker, result); - - return result; - } -#endif - - /* Non instrumented code */ - result= my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime); - - return result; -} - -static inline int inline_mysql_cond_signal( - mysql_cond_t *that) -{ - int result; -#ifdef HAVE_PSI_COND_INTERFACE - if (psi_likely(that->m_psi != NULL)) - PSI_COND_CALL(signal_cond)(that->m_psi); -#endif - result= pthread_cond_signal(&that->m_cond); - return result; -} - -static inline int inline_mysql_cond_broadcast( - mysql_cond_t *that) -{ - int result; -#ifdef HAVE_PSI_COND_INTERFACE - if (psi_likely(that->m_psi != NULL)) - PSI_COND_CALL(broadcast_cond)(that->m_psi); -#endif - result= pthread_cond_broadcast(&that->m_cond); - return result; -} - -static inline void inline_mysql_thread_register( -#ifdef HAVE_PSI_THREAD_INTERFACE - const char *category, - PSI_thread_info *info, - int count -#else - const char *category __attribute__ ((unused)), - void *info __attribute__ ((unused)), - int count __attribute__ ((unused)) -#endif -) -{ -#ifdef HAVE_PSI_THREAD_INTERFACE - PSI_THREAD_CALL(register_thread)(category, info, count); -#endif -} - -#ifdef HAVE_PSI_THREAD_INTERFACE -static inline int inline_mysql_thread_create( - PSI_thread_key key, - pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine)(void*), void *arg) -{ - int result; - result= PSI_THREAD_CALL(spawn_thread)(key, thread, attr, start_routine, arg); - return result; -} - -static inline void inline_mysql_thread_set_psi_id(my_thread_id id) -{ - struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)(); - PSI_THREAD_CALL(set_thread_id)(psi, id); -} - -#ifdef __cplusplus -class THD; -static inline void inline_mysql_thread_set_psi_THD(THD *thd) -{ - struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)(); - PSI_THREAD_CALL(set_thread_THD)(psi, thd); -} -#endif /* __cplusplus */ - -#endif - -#endif /* DISABLE_MYSQL_THREAD_H */ - -/** @} (end of group Thread_instrumentation) */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_transaction.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_transaction.h deleted file mode 100644 index 6de794d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/mysql_transaction.h +++ /dev/null @@ -1,220 +0,0 @@ -/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef MYSQL_TRANSACTION_H -#define MYSQL_TRANSACTION_H - -/** - @file mysql/psi/mysql_transaction.h - Instrumentation helpers for transactions. -*/ - -#include "mysql/psi/psi.h" - -#ifndef PSI_TRANSACTION_CALL -#define PSI_TRANSACTION_CALL(M) PSI_DYNAMIC_CALL(M) -#endif - -/** - @defgroup Transaction_instrumentation Transaction Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_START_TRANSACTION(STATE, XID, TRXID, ISO, RO, AC) \ - inline_mysql_start_transaction(STATE, XID, TRXID, ISO, RO, AC, __FILE__, __LINE__) -#else - #define MYSQL_START_TRANSACTION(STATE, XID, TRXID, ISO, RO, AC) \ - 0 -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_SET_TRANSACTION_GTID(LOCKER, P1, P2) \ - inline_mysql_set_transaction_gtid(LOCKER, P1, P2) -#else - #define MYSQL_SET_TRANSACTION_GTID(LOCKER, P1, P2) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_SET_TRANSACTION_XID(LOCKER, P1, P2) \ - inline_mysql_set_transaction_xid(LOCKER, P1, P2) -#else - #define MYSQL_SET_TRANSACTION_XID(LOCKER, P1, P2) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_SET_TRANSACTION_XA_STATE(LOCKER, P1) \ - inline_mysql_set_transaction_xa_state(LOCKER, P1) -#else - #define MYSQL_SET_TRANSACTION_XA_STATE(LOCKER, P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_SET_TRANSACTION_TRXID(LOCKER, P1) \ - inline_mysql_set_transaction_trxid(LOCKER, P1) -#else - #define MYSQL_SET_TRANSACTION_TRXID(LOCKER, P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_INC_TRANSACTION_SAVEPOINTS(LOCKER, P1) \ - inline_mysql_inc_transaction_savepoints(LOCKER, P1) -#else - #define MYSQL_INC_TRANSACTION_SAVEPOINTS(LOCKER, P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_INC_TRANSACTION_ROLLBACK_TO_SAVEPOINT(LOCKER, P1) \ - inline_mysql_inc_transaction_rollback_to_savepoint(LOCKER, P1) -#else - #define MYSQL_INC_TRANSACTION_ROLLBACK_TO_SAVEPOINT(LOCKER, P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_INC_TRANSACTION_RELEASE_SAVEPOINT(LOCKER, P1) \ - inline_mysql_inc_transaction_release_savepoint(LOCKER, P1) -#else - #define MYSQL_INC_TRANSACTION_RELEASE_SAVEPOINT(LOCKER, P1) \ - do {} while (0) -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_ROLLBACK_TRANSACTION(LOCKER) \ - inline_mysql_rollback_transaction(LOCKER) -#else - #define MYSQL_ROLLBACK_TRANSACTION(LOCKER) \ - do { } while(0) -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - #define MYSQL_COMMIT_TRANSACTION(LOCKER) \ - inline_mysql_commit_transaction(LOCKER) -#else - #define MYSQL_COMMIT_TRANSACTION(LOCKER) \ - do { } while(0) -#endif - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE -static inline struct PSI_transaction_locker * -inline_mysql_start_transaction(PSI_transaction_locker_state *state, - const void *xid, - ulonglong trxid, - int isolation_level, - my_bool read_only, - my_bool autocommit, - const char *src_file, int src_line) -{ - PSI_transaction_locker *locker; - locker= PSI_TRANSACTION_CALL(get_thread_transaction_locker)(state, - xid, trxid, - isolation_level, - read_only, - autocommit); - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(start_transaction)(locker, src_file, src_line); - return locker; -} - -static inline void -inline_mysql_set_transaction_gtid(PSI_transaction_locker *locker, - const void *sid, - const void *gtid_spec) -{ - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(set_transaction_gtid)(locker, sid, gtid_spec); -} - -static inline void -inline_mysql_set_transaction_xid(PSI_transaction_locker *locker, - const void *xid, - int xa_state) -{ - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(set_transaction_xid)(locker, xid, xa_state); -} - -static inline void -inline_mysql_set_transaction_xa_state(PSI_transaction_locker *locker, - int xa_state) -{ - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(set_transaction_xa_state)(locker, xa_state); -} - -static inline void -inline_mysql_set_transaction_trxid(PSI_transaction_locker *locker, - const ulonglong *trxid) -{ - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(set_transaction_trxid)(locker, trxid); -} - -static inline void -inline_mysql_inc_transaction_savepoints(PSI_transaction_locker *locker, - ulong count) -{ - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(inc_transaction_savepoints)(locker, count); -} - -static inline void -inline_mysql_inc_transaction_rollback_to_savepoint(PSI_transaction_locker *locker, - ulong count) -{ - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(inc_transaction_rollback_to_savepoint)(locker, count); -} - -static inline void -inline_mysql_inc_transaction_release_savepoint(PSI_transaction_locker *locker, - ulong count) -{ - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(inc_transaction_release_savepoint)(locker, count); -} - -static inline void -inline_mysql_rollback_transaction(struct PSI_transaction_locker *locker) -{ - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(end_transaction)(locker, false); -} - -static inline void -inline_mysql_commit_transaction(struct PSI_transaction_locker *locker) -{ - if (likely(locker != NULL)) - PSI_TRANSACTION_CALL(end_transaction)(locker, true); -} -#endif - -/** @} (end of group Transaction_instrumentation) */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi.h deleted file mode 100644 index 958a086..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi.h +++ /dev/null @@ -1,3028 +0,0 @@ -/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H -#define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H - -#ifndef MY_GLOBAL_INCLUDED -/* - Make sure a .c or .cc file contains an include to my_global.h first. - When this include is missing, all the #ifdef HAVE_XXX have no effect, - and the resulting binary won't build, or won't link, - or will crash at runtime - since various structures will have different binary definitions. -*/ -#error "You must include my_global.h in the code for the build to be correct." -#endif - -/* - If PSI_ON_BY_DFAULT is defined, assume PSI will be enabled by default and - optimize jumps testing for PSI this case. If not, optimize the binary for - that PSI is not enabled -*/ - -#ifdef PSI_ON_BY_DEFAULT -#define psi_likely(A) likely(A) -#define psi_unlikely(A) unlikely(A) -#else -#define psi_likely(A) unlikely(A) -#define psi_unlikely(A) likely(A) -#endif - -#include "psi_base.h" -#include "psi_memory.h" - -#ifdef _WIN32 -typedef struct thread_attr pthread_attr_t; -typedef DWORD pthread_t; -typedef DWORD pthread_key_t; -#endif - -/* - MAINTAINER: - The following pattern: - typedef struct XYZ XYZ; - is not needed in C++, but required for C. -*/ - -C_MODE_START - -/** @sa MDL_key. */ -struct MDL_key; -typedef struct MDL_key MDL_key; - -/** @sa enum_mdl_type. */ -typedef int opaque_mdl_type; - -/** @sa enum_mdl_duration. */ -typedef int opaque_mdl_duration; - -/** @sa MDL_wait::enum_wait_status. */ -typedef int opaque_mdl_status; - -/** @sa enum_vio_type. */ -typedef int opaque_vio_type; - -struct TABLE_SHARE; - -struct sql_digest_storage; - -#ifdef __cplusplus - class THD; -#else - /* - Phony declaration when compiling C code. - This is ok, because the C code will never have a THD anyway. - */ - struct opaque_THD - { - int dummy; - }; - typedef struct opaque_THD THD; -#endif - -/** - @file mysql/psi/psi.h - Performance schema instrumentation interface. - - @defgroup Instrumentation_interface Instrumentation Interface - @ingroup Performance_schema - @{ -*/ - -/** - Interface for an instrumented mutex. - This is an opaque structure. -*/ -struct PSI_mutex; -typedef struct PSI_mutex PSI_mutex; - -/** - Interface for an instrumented rwlock. - This is an opaque structure. -*/ -struct PSI_rwlock; -typedef struct PSI_rwlock PSI_rwlock; - -/** - Interface for an instrumented condition. - This is an opaque structure. -*/ -struct PSI_cond; -typedef struct PSI_cond PSI_cond; - -/** - Interface for an instrumented table share. - This is an opaque structure. -*/ -struct PSI_table_share; -typedef struct PSI_table_share PSI_table_share; - -/** - Interface for an instrumented table handle. - This is an opaque structure. -*/ -struct PSI_table; -typedef struct PSI_table PSI_table; - -/** - Interface for an instrumented thread. - This is an opaque structure. -*/ -struct PSI_thread; -typedef struct PSI_thread PSI_thread; - -/** - Interface for an instrumented file handle. - This is an opaque structure. -*/ -struct PSI_file; -typedef struct PSI_file PSI_file; - -/** - Interface for an instrumented socket descriptor. - This is an opaque structure. -*/ -struct PSI_socket; -typedef struct PSI_socket PSI_socket; - -/** - Interface for an instrumented prepared statement. - This is an opaque structure. -*/ -struct PSI_prepared_stmt; -typedef struct PSI_prepared_stmt PSI_prepared_stmt; - -/** - Interface for an instrumented table operation. - This is an opaque structure. -*/ -struct PSI_table_locker; -typedef struct PSI_table_locker PSI_table_locker; - -/** - Interface for an instrumented statement. - This is an opaque structure. -*/ -struct PSI_statement_locker; -typedef struct PSI_statement_locker PSI_statement_locker; - -/** - Interface for an instrumented transaction. - This is an opaque structure. -*/ -struct PSI_transaction_locker; -typedef struct PSI_transaction_locker PSI_transaction_locker; - -/** - Interface for an instrumented idle operation. - This is an opaque structure. -*/ -struct PSI_idle_locker; -typedef struct PSI_idle_locker PSI_idle_locker; - -/** - Interface for an instrumented statement digest operation. - This is an opaque structure. -*/ -struct PSI_digest_locker; -typedef struct PSI_digest_locker PSI_digest_locker; - -/** - Interface for an instrumented stored procedure share. - This is an opaque structure. -*/ -struct PSI_sp_share; -typedef struct PSI_sp_share PSI_sp_share; - -/** - Interface for an instrumented stored program. - This is an opaque structure. -*/ -struct PSI_sp_locker; -typedef struct PSI_sp_locker PSI_sp_locker; - -/** - Interface for an instrumented metadata lock. - This is an opaque structure. -*/ -struct PSI_metadata_lock; -typedef struct PSI_metadata_lock PSI_metadata_lock; - -/** - Interface for an instrumented stage progress. - This is a public structure, for efficiency. -*/ -struct PSI_stage_progress -{ - ulonglong m_work_completed; - ulonglong m_work_estimated; -}; -typedef struct PSI_stage_progress PSI_stage_progress; - -/** IO operation performed on an instrumented table. */ -enum PSI_table_io_operation -{ - /** Row fetch. */ - PSI_TABLE_FETCH_ROW= 0, - /** Row write. */ - PSI_TABLE_WRITE_ROW= 1, - /** Row update. */ - PSI_TABLE_UPDATE_ROW= 2, - /** Row delete. */ - PSI_TABLE_DELETE_ROW= 3 -}; -typedef enum PSI_table_io_operation PSI_table_io_operation; - -/** - State data storage for @c start_table_io_wait_v1_t, - @c start_table_lock_wait_v1_t. - This structure provide temporary storage to a table locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa start_table_io_wait_v1_t - @sa start_table_lock_wait_v1_t -*/ -struct PSI_table_locker_state -{ - /** Internal state. */ - uint m_flags; - /** Current io operation. */ - enum PSI_table_io_operation m_io_operation; - /** Current table handle. */ - struct PSI_table *m_table; - /** Current table share. */ - struct PSI_table_share *m_table_share; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Internal data. */ - void *m_wait; - /** - Implementation specific. - For table io, the table io index. - For table lock, the lock type. - */ - uint m_index; -}; -typedef struct PSI_table_locker_state PSI_table_locker_state; - -/** Entry point for the performance schema interface. */ -struct PSI_bootstrap -{ - /** - ABI interface finder. - Calling this method with an interface version number returns either - an instance of the ABI for this version, or NULL. - @param version the interface version number to find - @return a versioned interface (PSI_v1, PSI_v2 or PSI) - @sa PSI_VERSION_1 - @sa PSI_v1 - @sa PSI_VERSION_2 - @sa PSI_v2 - @sa PSI_CURRENT_VERSION - @sa PSI - */ - void* (*get_interface)(int version); -}; -typedef struct PSI_bootstrap PSI_bootstrap; - -#ifdef HAVE_PSI_INTERFACE - -#ifdef DISABLE_ALL_PSI - -#ifndef DISABLE_PSI_THREAD -#define DISABLE_PSI_THREAD -#endif - -#ifndef DISABLE_PSI_MUTEX -#define DISABLE_PSI_MUTEX -#endif - -#ifndef DISABLE_PSI_RWLOCK -#define DISABLE_PSI_RWLOCK -#endif - -#ifndef DISABLE_PSI_COND -#define DISABLE_PSI_COND -#endif - -#ifndef DISABLE_PSI_FILE -#define DISABLE_PSI_FILE -#endif - -#ifndef DISABLE_PSI_TABLE -#define DISABLE_PSI_TABLE -#endif - -#ifndef DISABLE_PSI_SOCKET -#define DISABLE_PSI_SOCKET -#endif - -#ifndef DISABLE_PSI_STAGE -#define DISABLE_PSI_STAGE -#endif - -#ifndef DISABLE_PSI_STATEMENT -#define DISABLE_PSI_STATEMENT -#endif - -#ifndef DISABLE_PSI_SP -#define DISABLE_PSI_SP -#endif - -#ifndef DISABLE_PSI_IDLE -#define DISABLE_PSI_IDLE -#endif - -#ifndef DISABLE_PSI_STATEMENT_DIGEST -#define DISABLE_PSI_STATEMENT_DIGEST -#endif - -#ifndef DISABLE_PSI_METADATA -#define DISABLE_PSI_METADATA -#endif - -#ifndef DISABLE_PSI_MEMORY -#define DISABLE_PSI_MEMORY -#endif - -#ifndef DISABLE_PSI_TRANSACTION -#define DISABLE_PSI_TRANSACTION -#endif - -#ifndef DISABLE_PSI_SP -#define DISABLE_PSI_SP -#endif - -#ifndef DISABLE_PSI_PS -#define DISABLE_PSI_PS -#endif - -#endif - -/** - @def DISABLE_PSI_MUTEX - Compiling option to disable the mutex instrumentation. - This option is mostly intended to be used during development, - when doing special builds with only a subset of the performance schema instrumentation, - for code analysis / profiling / performance tuning of a specific instrumentation alone. - @sa DISABLE_PSI_RWLOCK - @sa DISABLE_PSI_COND - @sa DISABLE_PSI_FILE - @sa DISABLE_PSI_THREAD - @sa DISABLE_PSI_TABLE - @sa DISABLE_PSI_STAGE - @sa DISABLE_PSI_STATEMENT - @sa DISABLE_PSI_SP - @sa DISABLE_PSI_STATEMENT_DIGEST - @sa DISABLE_PSI_SOCKET - @sa DISABLE_PSI_MEMORY - @sa DISABLE_PSI_IDLE - @sa DISABLE_PSI_METADATA - @sa DISABLE PSI_TRANSACTION -*/ - -#ifndef DISABLE_PSI_MUTEX -#define HAVE_PSI_MUTEX_INTERFACE -#endif - -/** - @def DISABLE_PSI_RWLOCK - Compiling option to disable the rwlock instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_RWLOCK -#define HAVE_PSI_RWLOCK_INTERFACE -#endif - -/** - @def DISABLE_PSI_COND - Compiling option to disable the cond instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_COND -#define HAVE_PSI_COND_INTERFACE -#endif - -/** - @def DISABLE_PSI_FILE - Compiling option to disable the file instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_FILE -#define HAVE_PSI_FILE_INTERFACE -#endif - -/** - @def DISABLE_PSI_THREAD - Compiling option to disable the thread instrumentation. - @sa DISABLE_PSI_MUTEX -*/ -#ifndef DISABLE_PSI_THREAD -#define HAVE_PSI_THREAD_INTERFACE -#endif - -/** - @def DISABLE_PSI_TABLE - Compiling option to disable the table instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_TABLE -#define HAVE_PSI_TABLE_INTERFACE -#endif - -/** - @def DISABLE_PSI_STAGE - Compiling option to disable the stage instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_STAGE -#define HAVE_PSI_STAGE_INTERFACE -#endif - -/** - @def DISABLE_PSI_STATEMENT - Compiling option to disable the statement instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_STATEMENT -#define HAVE_PSI_STATEMENT_INTERFACE -#endif - -/** - @def DISABLE_PSI_SP - Compiling option to disable the stored program instrumentation. - @sa DISABLE_PSI_MUTEX -*/ -#ifndef DISABLE_PSI_SP -#define HAVE_PSI_SP_INTERFACE -#endif - -/** - @def DISABLE_PSI_PS - Compiling option to disable the prepared statement instrumentation. - @sa DISABLE_PSI_MUTEX -*/ -#ifndef DISABLE_PSI_STATEMENT -#ifndef DISABLE_PSI_PS -#define HAVE_PSI_PS_INTERFACE -#endif -#endif - -/** - @def DISABLE_PSI_STATEMENT_DIGEST - Compiling option to disable the statement digest instrumentation. -*/ - -#ifndef DISABLE_PSI_STATEMENT -#ifndef DISABLE_PSI_STATEMENT_DIGEST -#define HAVE_PSI_STATEMENT_DIGEST_INTERFACE -#endif -#endif - -/** - @def DISABLE_PSI_TRANSACTION - Compiling option to disable the transaction instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_TRANSACTION -#define HAVE_PSI_TRANSACTION_INTERFACE -#endif - -/** - @def DISABLE_PSI_SOCKET - Compiling option to disable the statement instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_SOCKET -#define HAVE_PSI_SOCKET_INTERFACE -#endif - -/** - @def DISABLE_PSI_MEMORY - Compiling option to disable the memory instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_MEMORY -#define HAVE_PSI_MEMORY_INTERFACE -#endif - -/** - @def DISABLE_PSI_IDLE - Compiling option to disable the idle instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_IDLE -#define HAVE_PSI_IDLE_INTERFACE -#endif - -/** - @def DISABLE_PSI_METADATA - Compiling option to disable the metadata instrumentation. - @sa DISABLE_PSI_MUTEX -*/ - -#ifndef DISABLE_PSI_METADATA -#define HAVE_PSI_METADATA_INTERFACE -#endif - -/** - @def PSI_VERSION_1 - Performance Schema Interface number for version 1. - This version is supported. -*/ -#define PSI_VERSION_1 1 - -/** - @def PSI_VERSION_2 - Performance Schema Interface number for version 2. - This version is not implemented, it's a placeholder. -*/ -#define PSI_VERSION_2 2 - -/** - @def PSI_CURRENT_VERSION - Performance Schema Interface number for the most recent version. - The most current version is @c PSI_VERSION_1 -*/ -#define PSI_CURRENT_VERSION 1 - -#ifndef USE_PSI_2 -#ifndef USE_PSI_1 -#define USE_PSI_1 -#endif -#endif - -/** - Interface for an instrumented mutex operation. - This is an opaque structure. -*/ -struct PSI_mutex_locker; -typedef struct PSI_mutex_locker PSI_mutex_locker; - -/** - Interface for an instrumented rwlock operation. - This is an opaque structure. -*/ -struct PSI_rwlock_locker; -typedef struct PSI_rwlock_locker PSI_rwlock_locker; - -/** - Interface for an instrumented condition operation. - This is an opaque structure. -*/ -struct PSI_cond_locker; -typedef struct PSI_cond_locker PSI_cond_locker; - -/** - Interface for an instrumented file operation. - This is an opaque structure. -*/ -struct PSI_file_locker; -typedef struct PSI_file_locker PSI_file_locker; - -/** - Interface for an instrumented socket operation. - This is an opaque structure. -*/ -struct PSI_socket_locker; -typedef struct PSI_socket_locker PSI_socket_locker; - -/** - Interface for an instrumented MDL operation. - This is an opaque structure. -*/ -struct PSI_metadata_locker; -typedef struct PSI_metadata_locker PSI_metadata_locker; - -/** Operation performed on an instrumented mutex. */ -enum PSI_mutex_operation -{ - /** Lock. */ - PSI_MUTEX_LOCK= 0, - /** Lock attempt. */ - PSI_MUTEX_TRYLOCK= 1 -}; -typedef enum PSI_mutex_operation PSI_mutex_operation; - -/** - Operation performed on an instrumented rwlock. - For basic READ / WRITE lock, - operations are "READ" or "WRITE". - For SX-locks, operations are "SHARED", "SHARED-EXCLUSIVE" or "EXCLUSIVE". -*/ -enum PSI_rwlock_operation -{ - /** Read lock. */ - PSI_RWLOCK_READLOCK= 0, - /** Write lock. */ - PSI_RWLOCK_WRITELOCK= 1, - /** Read lock attempt. */ - PSI_RWLOCK_TRYREADLOCK= 2, - /** Write lock attempt. */ - PSI_RWLOCK_TRYWRITELOCK= 3, - - /** Shared lock. */ - PSI_RWLOCK_SHAREDLOCK= 4, - /** Shared Exclusive lock. */ - PSI_RWLOCK_SHAREDEXCLUSIVELOCK= 5, - /** Exclusive lock. */ - PSI_RWLOCK_EXCLUSIVELOCK= 6, - /** Shared lock attempt. */ - PSI_RWLOCK_TRYSHAREDLOCK= 7, - /** Shared Exclusive lock attempt. */ - PSI_RWLOCK_TRYSHAREDEXCLUSIVELOCK= 8, - /** Exclusive lock attempt. */ - PSI_RWLOCK_TRYEXCLUSIVELOCK= 9 - -}; -typedef enum PSI_rwlock_operation PSI_rwlock_operation; - -/** Operation performed on an instrumented condition. */ -enum PSI_cond_operation -{ - /** Wait. */ - PSI_COND_WAIT= 0, - /** Wait, with timeout. */ - PSI_COND_TIMEDWAIT= 1 -}; -typedef enum PSI_cond_operation PSI_cond_operation; - -/** Operation performed on an instrumented file. */ -enum PSI_file_operation -{ - /** File creation, as in @c create(). */ - PSI_FILE_CREATE= 0, - /** Temporary file creation, as in @c create_temp_file(). */ - PSI_FILE_CREATE_TMP= 1, - /** File open, as in @c open(). */ - PSI_FILE_OPEN= 2, - /** File open, as in @c fopen(). */ - PSI_FILE_STREAM_OPEN= 3, - /** File close, as in @c close(). */ - PSI_FILE_CLOSE= 4, - /** File close, as in @c fclose(). */ - PSI_FILE_STREAM_CLOSE= 5, - /** - Generic file read, such as @c fgets(), @c fgetc(), @c fread(), @c read(), - @c pread(). - */ - PSI_FILE_READ= 6, - /** - Generic file write, such as @c fputs(), @c fputc(), @c fprintf(), - @c vfprintf(), @c fwrite(), @c write(), @c pwrite(). - */ - PSI_FILE_WRITE= 7, - /** Generic file seek, such as @c fseek() or @c seek(). */ - PSI_FILE_SEEK= 8, - /** Generic file tell, such as @c ftell() or @c tell(). */ - PSI_FILE_TELL= 9, - /** File flush, as in @c fflush(). */ - PSI_FILE_FLUSH= 10, - /** File stat, as in @c stat(). */ - PSI_FILE_STAT= 11, - /** File stat, as in @c fstat(). */ - PSI_FILE_FSTAT= 12, - /** File chsize, as in @c my_chsize(). */ - PSI_FILE_CHSIZE= 13, - /** File delete, such as @c my_delete() or @c my_handler_delete_with_symlink(). */ - PSI_FILE_DELETE= 14, - /** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */ - PSI_FILE_RENAME= 15, - /** File sync, as in @c fsync() or @c my_sync(). */ - PSI_FILE_SYNC= 16 -}; -typedef enum PSI_file_operation PSI_file_operation; - -/** Lock operation performed on an instrumented table. */ -enum PSI_table_lock_operation -{ - /** Table lock, in the server layer. */ - PSI_TABLE_LOCK= 0, - /** Table lock, in the storage engine layer. */ - PSI_TABLE_EXTERNAL_LOCK= 1 -}; -typedef enum PSI_table_lock_operation PSI_table_lock_operation; - -/** State of an instrumented socket. */ -enum PSI_socket_state -{ - /** Idle, waiting for the next command. */ - PSI_SOCKET_STATE_IDLE= 1, - /** Active, executing a command. */ - PSI_SOCKET_STATE_ACTIVE= 2 -}; -typedef enum PSI_socket_state PSI_socket_state; - -/** Operation performed on an instrumented socket. */ -enum PSI_socket_operation -{ - /** Socket creation, as in @c socket() or @c socketpair(). */ - PSI_SOCKET_CREATE= 0, - /** Socket connection, as in @c connect(), @c listen() and @c accept(). */ - PSI_SOCKET_CONNECT= 1, - /** Socket bind, as in @c bind(), @c getsockname() and @c getpeername(). */ - PSI_SOCKET_BIND= 2, - /** Socket close, as in @c shutdown(). */ - PSI_SOCKET_CLOSE= 3, - /** Socket send, @c send(). */ - PSI_SOCKET_SEND= 4, - /** Socket receive, @c recv(). */ - PSI_SOCKET_RECV= 5, - /** Socket send, @c sendto(). */ - PSI_SOCKET_SENDTO= 6, - /** Socket receive, @c recvfrom). */ - PSI_SOCKET_RECVFROM= 7, - /** Socket send, @c sendmsg(). */ - PSI_SOCKET_SENDMSG= 8, - /** Socket receive, @c recvmsg(). */ - PSI_SOCKET_RECVMSG= 9, - /** Socket seek, such as @c fseek() or @c seek(). */ - PSI_SOCKET_SEEK= 10, - /** Socket options, as in @c getsockopt() and @c setsockopt(). */ - PSI_SOCKET_OPT= 11, - /** Socket status, as in @c sockatmark() and @c isfdtype(). */ - PSI_SOCKET_STAT= 12, - /** Socket shutdown, as in @c shutdown(). */ - PSI_SOCKET_SHUTDOWN= 13, - /** Socket select, as in @c select() and @c poll(). */ - PSI_SOCKET_SELECT= 14 -}; -typedef enum PSI_socket_operation PSI_socket_operation; - -#endif -/** - Instrumented mutex key. - To instrument a mutex, a mutex key must be obtained using @c register_mutex. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_mutex_key; - -/** - Instrumented rwlock key. - To instrument a rwlock, a rwlock key must be obtained - using @c register_rwlock. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_rwlock_key; - -/** - Instrumented cond key. - To instrument a condition, a condition key must be obtained - using @c register_cond. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_cond_key; - -/** - Instrumented thread key. - To instrument a thread, a thread key must be obtained - using @c register_thread. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_thread_key; - -/** - Instrumented file key. - To instrument a file, a file key must be obtained using @c register_file. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_file_key; - -/** - Instrumented stage key. - To instrument a stage, a stage key must be obtained using @c register_stage. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_stage_key; - -/** - Instrumented statement key. - To instrument a statement, a statement key must be obtained using @c register_statement. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_statement_key; - -/** - Instrumented socket key. - To instrument a socket, a socket key must be obtained using @c register_socket. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_socket_key; - -#ifdef HAVE_PSI_1 - -/** - @defgroup Group_PSI_v1 Application Binary Interface, version 1 - @ingroup Instrumentation_interface - @{ -*/ - -/** - Mutex information. - @since PSI_VERSION_1 - This structure is used to register an instrumented mutex. -*/ -struct PSI_mutex_info_v1 -{ - /** - Pointer to the key assigned to the registered mutex. - */ - PSI_mutex_key *m_key; - /** - The name of the mutex to register. - */ - const char *m_name; - /** - The flags of the mutex to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; -typedef struct PSI_mutex_info_v1 PSI_mutex_info_v1; - -/** - Rwlock information. - @since PSI_VERSION_1 - This structure is used to register an instrumented rwlock. -*/ -struct PSI_rwlock_info_v1 -{ - /** - Pointer to the key assigned to the registered rwlock. - */ - PSI_rwlock_key *m_key; - /** - The name of the rwlock to register. - */ - const char *m_name; - /** - The flags of the rwlock to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; -typedef struct PSI_rwlock_info_v1 PSI_rwlock_info_v1; - -/** - Condition information. - @since PSI_VERSION_1 - This structure is used to register an instrumented cond. -*/ -struct PSI_cond_info_v1 -{ - /** - Pointer to the key assigned to the registered cond. - */ - PSI_cond_key *m_key; - /** - The name of the cond to register. - */ - const char *m_name; - /** - The flags of the cond to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; -typedef struct PSI_cond_info_v1 PSI_cond_info_v1; - -/** - Thread instrument information. - @since PSI_VERSION_1 - This structure is used to register an instrumented thread. -*/ -struct PSI_thread_info_v1 -{ - /** - Pointer to the key assigned to the registered thread. - */ - PSI_thread_key *m_key; - /** - The name of the thread instrument to register. - */ - const char *m_name; - /** - The flags of the thread to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; -typedef struct PSI_thread_info_v1 PSI_thread_info_v1; - -/** - File instrument information. - @since PSI_VERSION_1 - This structure is used to register an instrumented file. -*/ -struct PSI_file_info_v1 -{ - /** - Pointer to the key assigned to the registered file. - */ - PSI_file_key *m_key; - /** - The name of the file instrument to register. - */ - const char *m_name; - /** - The flags of the file instrument to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; -typedef struct PSI_file_info_v1 PSI_file_info_v1; - -/** - Stage instrument information. - @since PSI_VERSION_1 - This structure is used to register an instrumented stage. -*/ -struct PSI_stage_info_v1 -{ - /** The registered stage key. */ - PSI_stage_key m_key; - /** The name of the stage instrument to register. */ - const char *m_name; - /** The flags of the stage instrument to register. */ - int m_flags; -}; -typedef struct PSI_stage_info_v1 PSI_stage_info_v1; - -/** - Statement instrument information. - @since PSI_VERSION_1 - This structure is used to register an instrumented statement. -*/ -struct PSI_statement_info_v1 -{ - /** The registered statement key. */ - PSI_statement_key m_key; - /** The name of the statement instrument to register. */ - const char *m_name; - /** The flags of the statement instrument to register. */ - int m_flags; -}; -typedef struct PSI_statement_info_v1 PSI_statement_info_v1; - -/** - Socket instrument information. - @since PSI_VERSION_1 - This structure is used to register an instrumented socket. -*/ -struct PSI_socket_info_v1 -{ - /** - Pointer to the key assigned to the registered socket. - */ - PSI_socket_key *m_key; - /** - The name of the socket instrument to register. - */ - const char *m_name; - /** - The flags of the socket instrument to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; -typedef struct PSI_socket_info_v1 PSI_socket_info_v1; - -/** - State data storage for @c start_idle_wait_v1_t. - This structure provide temporary storage to an idle locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa start_idle_wait_v1_t. -*/ -struct PSI_idle_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Internal data. */ - void *m_wait; -}; -typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state_v1; - -/** - State data storage for @c start_mutex_wait_v1_t. - This structure provide temporary storage to a mutex locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa start_mutex_wait_v1_t -*/ -struct PSI_mutex_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current operation. */ - enum PSI_mutex_operation m_operation; - /** Current mutex. */ - struct PSI_mutex *m_mutex; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Internal data. */ - void *m_wait; -}; -typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state_v1; - -/** - State data storage for @c start_rwlock_rdwait_v1_t, @c start_rwlock_wrwait_v1_t. - This structure provide temporary storage to a rwlock locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa start_rwlock_rdwait_v1_t - @sa start_rwlock_wrwait_v1_t -*/ -struct PSI_rwlock_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current operation. */ - enum PSI_rwlock_operation m_operation; - /** Current rwlock. */ - struct PSI_rwlock *m_rwlock; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Internal data. */ - void *m_wait; -}; -typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state_v1; - -/** - State data storage for @c start_cond_wait_v1_t. - This structure provide temporary storage to a condition locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa start_cond_wait_v1_t -*/ -struct PSI_cond_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current operation. */ - enum PSI_cond_operation m_operation; - /** Current condition. */ - struct PSI_cond *m_cond; - /** Current mutex. */ - struct PSI_mutex *m_mutex; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Internal data. */ - void *m_wait; -}; -typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state_v1; - -/** - State data storage for @c get_thread_file_name_locker_v1_t. - This structure provide temporary storage to a file locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa get_thread_file_name_locker_v1_t - @sa get_thread_file_stream_locker_v1_t - @sa get_thread_file_descriptor_locker_v1_t -*/ -struct PSI_file_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current operation. */ - enum PSI_file_operation m_operation; - /** Current file. */ - struct PSI_file *m_file; - /** Current file name. */ - const char *m_name; - /** Current file class. */ - void *m_class; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Operation number of bytes. */ - size_t m_number_of_bytes; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Internal data. */ - void *m_wait; -}; -typedef struct PSI_file_locker_state_v1 PSI_file_locker_state_v1; - -/** - State data storage for @c start_metadata_wait_v1_t. - This structure provide temporary storage to a metadata locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa start_metadata_wait_v1_t -*/ -struct PSI_metadata_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current metadata lock. */ - struct PSI_metadata_lock *m_metadata_lock; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Internal data. */ - void *m_wait; -}; -typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state_v1; - -/* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */ -#define PSI_SCHEMA_NAME_LEN (64 * 3) - -/** - State data storage for @c get_thread_statement_locker_v1_t, - @c get_thread_statement_locker_v1_t. - This structure provide temporary storage to a statement locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa get_thread_statement_locker_v1_t -*/ -struct PSI_statement_locker_state_v1 -{ - /** Discarded flag. */ - my_bool m_discarded; - /** In prepare flag. */ - my_bool m_in_prepare; - /** Metric, no index used flag. */ - uchar m_no_index_used; - /** Metric, no good index used flag. */ - uchar m_no_good_index_used; - /** Internal state. */ - uint m_flags; - /** Instrumentation class. */ - void *m_class; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Internal data. */ - void *m_statement; - /** Locked time. */ - ulonglong m_lock_time; - /** Rows sent. */ - ulonglong m_rows_sent; - /** Rows examined. */ - ulonglong m_rows_examined; - /** Metric, temporary tables created on disk. */ - ulong m_created_tmp_disk_tables; - /** Metric, temporary tables created. */ - ulong m_created_tmp_tables; - /** Metric, number of select full join. */ - ulong m_select_full_join; - /** Metric, number of select full range join. */ - ulong m_select_full_range_join; - /** Metric, number of select range. */ - ulong m_select_range; - /** Metric, number of select range check. */ - ulong m_select_range_check; - /** Metric, number of select scan. */ - ulong m_select_scan; - /** Metric, number of sort merge passes. */ - ulong m_sort_merge_passes; - /** Metric, number of sort merge. */ - ulong m_sort_range; - /** Metric, number of sort rows. */ - ulong m_sort_rows; - /** Metric, number of sort scans. */ - ulong m_sort_scan; - /** Statement digest. */ - const struct sql_digest_storage *m_digest; - /** Current schema name. */ - char m_schema_name[PSI_SCHEMA_NAME_LEN]; - /** Length in bytes of @c m_schema_name. */ - uint m_schema_name_length; - /** Statement character set number. */ - uint m_cs_number; - PSI_sp_share *m_parent_sp_share; - PSI_prepared_stmt *m_parent_prepared_stmt; -}; -typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state_v1; - -/** - State data storage for @c get_thread_transaction_locker_v1_t, - @c get_thread_transaction_locker_v1_t. - This structure provide temporary storage to a transaction locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa get_thread_transaction_locker_v1_t -*/ -struct PSI_transaction_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Instrumentation class. */ - void *m_class; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Internal data. */ - void *m_transaction; - /** True if read-only transaction, false if read-write. */ - my_bool m_read_only; - /** True if transaction is autocommit. */ - my_bool m_autocommit; - /** Number of statements. */ - ulong m_statement_count; - /** Total number of savepoints. */ - ulong m_savepoint_count; - /** Number of rollback_to_savepoint. */ - ulong m_rollback_to_savepoint_count; - /** Number of release_savepoint. */ - ulong m_release_savepoint_count; -}; - -typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state_v1; - -/** - State data storage for @c start_socket_wait_v1_t. - This structure provide temporary storage to a socket locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa start_socket_wait_v1_t -*/ -struct PSI_socket_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current socket. */ - struct PSI_socket *m_socket; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Operation number of bytes. */ - size_t m_number_of_bytes; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Current operation. */ - enum PSI_socket_operation m_operation; - /** Source file. */ - const char* m_src_file; - /** Source line number. */ - int m_src_line; - /** Internal data. */ - void *m_wait; -}; -typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state_v1; - -struct PSI_sp_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Stored Procedure share. */ - PSI_sp_share* m_sp_share; -}; -typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state_v1; - -/* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */ - -/** - Mutex registration API. - @param category a category name (typically a plugin name) - @param info an array of mutex info to register - @param count the size of the info array -*/ -typedef void (*register_mutex_v1_t) - (const char *category, struct PSI_mutex_info_v1 *info, int count); - -/** - Rwlock registration API. - @param category a category name (typically a plugin name) - @param info an array of rwlock info to register - @param count the size of the info array -*/ -typedef void (*register_rwlock_v1_t) - (const char *category, struct PSI_rwlock_info_v1 *info, int count); - -/** - Cond registration API. - @param category a category name (typically a plugin name) - @param info an array of cond info to register - @param count the size of the info array -*/ -typedef void (*register_cond_v1_t) - (const char *category, struct PSI_cond_info_v1 *info, int count); - -/** - Thread registration API. - @param category a category name (typically a plugin name) - @param info an array of thread info to register - @param count the size of the info array -*/ -typedef void (*register_thread_v1_t) - (const char *category, struct PSI_thread_info_v1 *info, int count); - -/** - File registration API. - @param category a category name (typically a plugin name) - @param info an array of file info to register - @param count the size of the info array -*/ -typedef void (*register_file_v1_t) - (const char *category, struct PSI_file_info_v1 *info, int count); - -/** - Stage registration API. - @param category a category name - @param info an array of stage info to register - @param count the size of the info array -*/ -typedef void (*register_stage_v1_t) - (const char *category, struct PSI_stage_info_v1 **info, int count); - -/** - Statement registration API. - @param category a category name - @param info an array of stage info to register - @param count the size of the info array -*/ -typedef void (*register_statement_v1_t) - (const char *category, struct PSI_statement_info_v1 *info, int count); - -/** - Socket registration API. - @param category a category name (typically a plugin name) - @param info an array of socket info to register - @param count the size of the info array -*/ -typedef void (*register_socket_v1_t) - (const char *category, struct PSI_socket_info_v1 *info, int count); - -/** - Mutex instrumentation initialisation API. - @param key the registered mutex key - @param identity the address of the mutex itself - @return an instrumented mutex -*/ -typedef struct PSI_mutex* (*init_mutex_v1_t) - (PSI_mutex_key key, const void *identity); - -/** - Mutex instrumentation destruction API. - @param mutex the mutex to destroy -*/ -typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex); - -/** - Rwlock instrumentation initialisation API. - @param key the registered rwlock key - @param identity the address of the rwlock itself - @return an instrumented rwlock -*/ -typedef struct PSI_rwlock* (*init_rwlock_v1_t) - (PSI_rwlock_key key, const void *identity); - -/** - Rwlock instrumentation destruction API. - @param rwlock the rwlock to destroy -*/ -typedef void (*destroy_rwlock_v1_t)(struct PSI_rwlock *rwlock); - -/** - Cond instrumentation initialisation API. - @param key the registered key - @param identity the address of the rwlock itself - @return an instrumented cond -*/ -typedef struct PSI_cond* (*init_cond_v1_t) - (PSI_cond_key key, const void *identity); - -/** - Cond instrumentation destruction API. - @param cond the rcond to destroy -*/ -typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond); - -/** - Socket instrumentation initialisation API. - @param key the registered mutex key - @param socket descriptor - @param addr the socket ip address - @param addr_len length of socket ip address - @return an instrumented socket -*/ -typedef struct PSI_socket* (*init_socket_v1_t) - (PSI_socket_key key, const my_socket *fd, - const struct sockaddr *addr, socklen_t addr_len); - -/** - socket instrumentation destruction API. - @param socket the socket to destroy -*/ -typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket); - -/** - Acquire a table share instrumentation. - @param temporary True for temporary tables - @param share The SQL layer table share - @return a table share instrumentation, or NULL -*/ -typedef struct PSI_table_share* (*get_table_share_v1_t) - (my_bool temporary, struct TABLE_SHARE *share); - -/** - Release a table share. - @param info the table share to release -*/ -typedef void (*release_table_share_v1_t)(struct PSI_table_share *share); - -/** - Drop a table share. - @param temporary True for temporary tables - @param schema_name the table schema name - @param schema_name_length the table schema name length - @param table_name the table name - @param table_name_length the table name length -*/ -typedef void (*drop_table_share_v1_t) - (my_bool temporary, const char *schema_name, int schema_name_length, - const char *table_name, int table_name_length); - -/** - Open an instrumentation table handle. - @param share the table to open - @param identity table handle identity - @return a table handle, or NULL -*/ -typedef struct PSI_table* (*open_table_v1_t) - (struct PSI_table_share *share, const void *identity); - -/** - Unbind a table handle from the current thread. - This operation happens when an opened table is added to the open table cache. - @param table the table to unbind -*/ -typedef void (*unbind_table_v1_t) - (struct PSI_table *table); - -/** - Rebind a table handle to the current thread. - This operation happens when a table from the open table cache - is reused for a thread. - @param table the table to unbind -*/ -typedef PSI_table* (*rebind_table_v1_t) - (PSI_table_share *share, const void *identity, PSI_table *table); - -/** - Close an instrumentation table handle. - Note that the table handle is invalid after this call. - @param table the table handle to close -*/ -typedef void (*close_table_v1_t)(struct TABLE_SHARE *server_share, - struct PSI_table *table); - -/** - Create a file instrumentation for a created file. - This method does not create the file itself, but is used to notify the - instrumentation interface that a file was just created. - @param key the file instrumentation key for this file - @param name the file name - @param file the file handle -*/ -typedef void (*create_file_v1_t)(PSI_file_key key, const char *name, - File file); - -/** - Spawn a thread. - This method creates a new thread, with instrumentation. - @param key the instrumentation key for this thread - @param thread the resulting thread - @param attr the thread attributes - @param start_routine the thread start routine - @param arg the thread start routine argument -*/ -typedef int (*spawn_thread_v1_t)(PSI_thread_key key, - pthread_t *thread, - const pthread_attr_t *attr, - void *(*start_routine)(void*), void *arg); - -/** - Create instrumentation for a thread. - @param key the registered key - @param identity an address typical of the thread - @return an instrumented thread -*/ -typedef struct PSI_thread* (*new_thread_v1_t) - (PSI_thread_key key, const void *identity, ulonglong thread_id); - -/** - Assign a THD to an instrumented thread. - @param thread the instrumented thread - @param THD the sql layer THD to assign -*/ -typedef void (*set_thread_THD_v1_t)(struct PSI_thread *thread, - THD *thd); - -/** - Assign an id to an instrumented thread. - @param thread the instrumented thread - @param id the id to assign -*/ -typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread, - ulonglong id); - -/** - Assign the current operating system thread id to an instrumented thread. - The operating system task id is obtained from @c gettid() - @param thread the instrumented thread -*/ -typedef void (*set_thread_os_id_v1_t)(struct PSI_thread *thread); - -/** - Get the instrumentation for the running thread. - For this function to return a result, - the thread instrumentation must have been attached to the - running thread using @c set_thread() - @return the instrumentation for the running thread -*/ -typedef struct PSI_thread* (*get_thread_v1_t)(void); - -/** - Assign a user name to the instrumented thread. - @param user the user name - @param user_len the user name length -*/ -typedef void (*set_thread_user_v1_t)(const char *user, int user_len); - -/** - Assign a user name and host name to the instrumented thread. - @param user the user name - @param user_len the user name length - @param host the host name - @param host_len the host name length -*/ -typedef void (*set_thread_account_v1_t)(const char *user, int user_len, - const char *host, int host_len); - -/** - Assign a current database to the instrumented thread. - @param db the database name - @param db_len the database name length -*/ -typedef void (*set_thread_db_v1_t)(const char* db, int db_len); - -/** - Assign a current command to the instrumented thread. - @param command the current command -*/ -typedef void (*set_thread_command_v1_t)(int command); - -/** - Assign a connection type to the instrumented thread. - @param conn_type the connection type -*/ -typedef void (*set_connection_type_v1_t)(opaque_vio_type conn_type); - - -/** - Assign a start time to the instrumented thread. - @param start_time the thread start time -*/ -typedef void (*set_thread_start_time_v1_t)(time_t start_time); - -/** - Assign a state to the instrumented thread. - @param state the thread state -*/ -typedef void (*set_thread_state_v1_t)(const char* state); - -/** - Assign a process info to the instrumented thread. - @param info the process into string - @param info_len the process into string length -*/ -typedef void (*set_thread_info_v1_t)(const char* info, uint info_len); - -/** - Attach a thread instrumentation to the running thread. - In case of thread pools, this method should be called when - a worker thread picks a work item and runs it. - Also, this method should be called if the instrumented code does not - keep the pointer returned by @c new_thread() and relies on @c get_thread() - instead. - @param thread the thread instrumentation -*/ -typedef void (*set_thread_v1_t)(struct PSI_thread *thread); - -/** Delete the current thread instrumentation. */ -typedef void (*delete_current_thread_v1_t)(void); - -/** Delete a thread instrumentation. */ -typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); - -/** - Get a file instrumentation locker, for opening or creating a file. - @param state data storage for the locker - @param key the file instrumentation key - @param op the operation to perform - @param name the file name - @param identity a pointer representative of this file. - @return a file locker, or NULL -*/ -typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) - (struct PSI_file_locker_state_v1 *state, - PSI_file_key key, enum PSI_file_operation op, const char *name, - const void *identity); - -/** - Get a file stream instrumentation locker. - @param state data storage for the locker - @param file the file stream to access - @param op the operation to perform - @return a file locker, or NULL -*/ -typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) - (struct PSI_file_locker_state_v1 *state, - struct PSI_file *file, enum PSI_file_operation op); - -/** - Get a file instrumentation locker. - @param state data storage for the locker - @param file the file descriptor to access - @param op the operation to perform - @return a file locker, or NULL -*/ -typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) - (struct PSI_file_locker_state_v1 *state, - File file, enum PSI_file_operation op); - -/** - Record a mutex instrumentation unlock event. - @param mutex the mutex instrumentation -*/ -typedef void (*unlock_mutex_v1_t) - (struct PSI_mutex *mutex); - -/** - Record a rwlock instrumentation unlock event. - @param rwlock the rwlock instrumentation -*/ -typedef void (*unlock_rwlock_v1_t) - (struct PSI_rwlock *rwlock); - -/** - Record a condition instrumentation signal event. - @param cond the cond instrumentation -*/ -typedef void (*signal_cond_v1_t) - (struct PSI_cond *cond); - -/** - Record a condition instrumentation broadcast event. - @param cond the cond instrumentation -*/ -typedef void (*broadcast_cond_v1_t) - (struct PSI_cond *cond); - -/** - Record an idle instrumentation wait start event. - @param state data storage for the locker - @param file the source file name - @param line the source line number - @return an idle locker, or NULL -*/ -typedef struct PSI_idle_locker* (*start_idle_wait_v1_t) - (struct PSI_idle_locker_state_v1 *state, const char *src_file, uint src_line); - -/** - Record an idle instrumentation wait end event. - @param locker a thread locker for the running thread -*/ -typedef void (*end_idle_wait_v1_t) - (struct PSI_idle_locker *locker); - -/** - Record a mutex instrumentation wait start event. - @param state data storage for the locker - @param mutex the instrumented mutex to lock - @param op the operation to perform - @param file the source file name - @param line the source line number - @return a mutex locker, or NULL -*/ -typedef struct PSI_mutex_locker* (*start_mutex_wait_v1_t) - (struct PSI_mutex_locker_state_v1 *state, - struct PSI_mutex *mutex, - enum PSI_mutex_operation op, - const char *src_file, uint src_line); - -/** - Record a mutex instrumentation wait end event. - @param locker a thread locker for the running thread - @param rc the wait operation return code -*/ -typedef void (*end_mutex_wait_v1_t) - (struct PSI_mutex_locker *locker, int rc); - -/** - Record a rwlock instrumentation read wait start event. - @param locker a thread locker for the running thread - @param must must block: 1 for lock, 0 for trylock -*/ -typedef struct PSI_rwlock_locker* (*start_rwlock_rdwait_v1_t) - (struct PSI_rwlock_locker_state_v1 *state, - struct PSI_rwlock *rwlock, - enum PSI_rwlock_operation op, - const char *src_file, uint src_line); - -/** - Record a rwlock instrumentation read wait end event. - @param locker a thread locker for the running thread - @param rc the wait operation return code -*/ -typedef void (*end_rwlock_rdwait_v1_t) - (struct PSI_rwlock_locker *locker, int rc); - -/** - Record a rwlock instrumentation write wait start event. - @param locker a thread locker for the running thread - @param must must block: 1 for lock, 0 for trylock -*/ -typedef struct PSI_rwlock_locker* (*start_rwlock_wrwait_v1_t) - (struct PSI_rwlock_locker_state_v1 *state, - struct PSI_rwlock *rwlock, - enum PSI_rwlock_operation op, - const char *src_file, uint src_line); - -/** - Record a rwlock instrumentation write wait end event. - @param locker a thread locker for the running thread - @param rc the wait operation return code -*/ -typedef void (*end_rwlock_wrwait_v1_t) - (struct PSI_rwlock_locker *locker, int rc); - -/** - Record a condition instrumentation wait start event. - @param locker a thread locker for the running thread - @param must must block: 1 for wait, 0 for timedwait -*/ -typedef struct PSI_cond_locker* (*start_cond_wait_v1_t) - (struct PSI_cond_locker_state_v1 *state, - struct PSI_cond *cond, - struct PSI_mutex *mutex, - enum PSI_cond_operation op, - const char *src_file, uint src_line); - -/** - Record a condition instrumentation wait end event. - @param locker a thread locker for the running thread - @param rc the wait operation return code -*/ -typedef void (*end_cond_wait_v1_t) - (struct PSI_cond_locker *locker, int rc); - -/** - Record a table instrumentation io wait start event. - @param locker a table locker for the running thread - @param file the source file name - @param line the source line number -*/ -typedef struct PSI_table_locker* (*start_table_io_wait_v1_t) - (struct PSI_table_locker_state *state, - struct PSI_table *table, - enum PSI_table_io_operation op, - uint index, - const char *src_file, uint src_line); - -/** - Record a table instrumentation io wait end event. - @param locker a table locker for the running thread - @param numrows the number of rows involved in io -*/ -typedef void (*end_table_io_wait_v1_t) - (struct PSI_table_locker *locker, - ulonglong numrows); - -/** - Record a table instrumentation lock wait start event. - @param locker a table locker for the running thread - @param file the source file name - @param line the source line number -*/ -typedef struct PSI_table_locker* (*start_table_lock_wait_v1_t) - (struct PSI_table_locker_state *state, - struct PSI_table *table, - enum PSI_table_lock_operation op, - ulong flags, - const char *src_file, uint src_line); - -/** - Record a table instrumentation lock wait end event. - @param locker a table locker for the running thread -*/ -typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker); - -typedef void (*unlock_table_v1_t)(struct PSI_table *table); - -/** - Start a file instrumentation open operation. - @param locker the file locker - @param op the operation to perform - @param src_file the source file name - @param src_line the source line number -*/ -typedef void (*start_file_open_wait_v1_t) - (struct PSI_file_locker *locker, const char *src_file, uint src_line); - -/** - End a file instrumentation open operation, for file streams. - @param locker the file locker. - @param result the opened file (NULL indicates failure, non NULL success). - @return an instrumented file handle -*/ -typedef struct PSI_file* (*end_file_open_wait_v1_t) - (struct PSI_file_locker *locker, void *result); - -/** - End a file instrumentation open operation, for non stream files. - @param locker the file locker. - @param file the file number assigned by open() or create() for this file. -*/ -typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t) - (struct PSI_file_locker *locker, File file); - -/** - End a file instrumentation open operation, for non stream temporary files. - @param locker the file locker. - @param file the file number assigned by open() or create() for this file. - @param filename the file name generated during temporary file creation. -*/ -typedef void (*end_temp_file_open_wait_and_bind_to_descriptor_v1_t) - (struct PSI_file_locker *locker, File file, const char *filename); - -/** - Record a file instrumentation start event. - @param locker a file locker for the running thread - @param op file operation to be performed - @param count the number of bytes requested, or 0 if not applicable - @param src_file the source file name - @param src_line the source line number -*/ -typedef void (*start_file_wait_v1_t) - (struct PSI_file_locker *locker, size_t count, - const char *src_file, uint src_line); - -/** - Record a file instrumentation end event. - Note that for file close operations, the instrumented file handle - associated with the file (which was provided to obtain a locker) - is invalid after this call. - @param locker a file locker for the running thread - @param count the number of bytes actually used in the operation, - or 0 if not applicable, or -1 if the operation failed - @sa get_thread_file_name_locker - @sa get_thread_file_stream_locker - @sa get_thread_file_descriptor_locker -*/ -typedef void (*end_file_wait_v1_t) - (struct PSI_file_locker *locker, size_t count); - -/** - Start a file instrumentation close operation. - @param locker the file locker - @param op the operation to perform - @param src_file the source file name - @param src_line the source line number -*/ -typedef void (*start_file_close_wait_v1_t) - (struct PSI_file_locker *locker, const char *src_file, uint src_line); - -/** - End a file instrumentation close operation. - @param locker the file locker. - @param rc the close operation return code (0 for success). - @return an instrumented file handle -*/ -typedef void (*end_file_close_wait_v1_t) - (struct PSI_file_locker *locker, int rc); - -/** - Rename a file instrumentation close operation. - @param locker the file locker. - @param old_name name of the file to be renamed. - @param new_name name of the file after rename. - @param rc the rename operation return code (0 for success). -*/ -typedef void (*end_file_rename_wait_v1_t) - (struct PSI_file_locker *locker, const char *old_name, - const char *new_name, int rc); - -/** - Start a new stage, and implicitly end the previous stage. - @param key the key of the new stage - @param src_file the source file name - @param src_line the source line number - @return the new stage progress -*/ -typedef PSI_stage_progress* (*start_stage_v1_t) - (PSI_stage_key key, const char *src_file, int src_line); - -typedef PSI_stage_progress* (*get_current_stage_progress_v1_t)(void); - -/** End the current stage. */ -typedef void (*end_stage_v1_t) (void); - -/** - Get a statement instrumentation locker. - @param state data storage for the locker - @param key the statement instrumentation key - @param charset client character set - @return a statement locker, or NULL -*/ -typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t) - (struct PSI_statement_locker_state_v1 *state, - PSI_statement_key key, const void *charset, PSI_sp_share *sp_share); - -/** - Refine a statement locker to a more specific key. - Note that only events declared mutable can be refined. - @param the statement locker for the current event - @param key the new key for the event - @sa PSI_FLAG_MUTABLE -*/ -typedef struct PSI_statement_locker* (*refine_statement_v1_t) - (struct PSI_statement_locker *locker, - PSI_statement_key key); - -/** - Start a new statement event. - @param locker the statement locker for this event - @param db the active database name for this statement - @param db_length the active database name length for this statement - @param src_file source file name - @param src_line source line number -*/ -typedef void (*start_statement_v1_t) - (struct PSI_statement_locker *locker, - const char *db, uint db_length, - const char *src_file, uint src_line); - -/** - Set the statement text for a statement event. - @param locker the current statement locker - @param text the statement text - @param text_len the statement text length -*/ -typedef void (*set_statement_text_v1_t) - (struct PSI_statement_locker *locker, - const char *text, uint text_len); - -/** - Set a statement event lock time. - @param locker the statement locker - @param lock_time the locked time, in microseconds -*/ -typedef void (*set_statement_lock_time_t) - (struct PSI_statement_locker *locker, ulonglong lock_time); - -/** - Set a statement event rows sent metric. - @param locker the statement locker - @param count the number of rows sent -*/ -typedef void (*set_statement_rows_sent_t) - (struct PSI_statement_locker *locker, ulonglong count); - -/** - Set a statement event rows examined metric. - @param locker the statement locker - @param count the number of rows examined -*/ -typedef void (*set_statement_rows_examined_t) - (struct PSI_statement_locker *locker, ulonglong count); - -/** - Increment a statement event "created tmp disk tables" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_created_tmp_disk_tables_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "created tmp tables" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_created_tmp_tables_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "select full join" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_select_full_join_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "select full range join" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_select_full_range_join_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "select range join" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_select_range_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "select range check" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_select_range_check_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "select scan" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_select_scan_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "sort merge passes" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_sort_merge_passes_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "sort range" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_sort_range_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "sort rows" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_sort_rows_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Increment a statement event "sort scan" metric. - @param locker the statement locker - @param count the metric increment value -*/ -typedef void (*inc_statement_sort_scan_t) - (struct PSI_statement_locker *locker, ulong count); - -/** - Set a statement event "no index used" metric. - @param locker the statement locker - @param count the metric value -*/ -typedef void (*set_statement_no_index_used_t) - (struct PSI_statement_locker *locker); - -/** - Set a statement event "no good index used" metric. - @param locker the statement locker - @param count the metric value -*/ -typedef void (*set_statement_no_good_index_used_t) - (struct PSI_statement_locker *locker); - -/** - End a statement event. - @param locker the statement locker - @param stmt_da the statement diagnostics area. - @sa Diagnostics_area -*/ -typedef void (*end_statement_v1_t) - (struct PSI_statement_locker *locker, void *stmt_da); - -/** - Get a transaction instrumentation locker. - @param state data storage for the locker - @param xid the xid for this transaction - @param trxid the InnoDB transaction id - @param iso_level isolation level for this transaction - @param read_only true if transaction access mode is read-only - @param autocommit true if transaction is autocommit - @return a transaction locker, or NULL -*/ -typedef struct PSI_transaction_locker* (*get_thread_transaction_locker_v1_t) - (struct PSI_transaction_locker_state_v1 *state, const void *xid, - ulonglong trxid, int isolation_level, my_bool read_only, - my_bool autocommit); - -/** - Start a new transaction event. - @param locker the transaction locker for this event - @param src_file source file name - @param src_line source line number -*/ -typedef void (*start_transaction_v1_t) - (struct PSI_transaction_locker *locker, - const char *src_file, uint src_line); - -/** - Set the transaction xid. - @param locker the transaction locker for this event - @param xid the id of the XA transaction - #param xa_state is the state of the XA transaction -*/ -typedef void (*set_transaction_xid_v1_t) - (struct PSI_transaction_locker *locker, - const void *xid, int xa_state); - -/** - Set the state of the XA transaction. - @param locker the transaction locker for this event - @param xa_state the new state of the xa transaction -*/ -typedef void (*set_transaction_xa_state_v1_t) - (struct PSI_transaction_locker *locker, - int xa_state); - -/** - Set the transaction gtid. - @param locker the transaction locker for this event - @param sid the source id for the transaction, mapped from sidno - @param gtid_spec the gtid specifier for the transaction -*/ -typedef void (*set_transaction_gtid_v1_t) - (struct PSI_transaction_locker *locker, - const void *sid, const void *gtid_spec); - -/** - Set the transaction trx_id. - @param locker the transaction locker for this event - @param trxid the storage engine transaction ID -*/ -typedef void (*set_transaction_trxid_v1_t) - (struct PSI_transaction_locker *locker, - const ulonglong *trxid); - -/** - Increment a transaction event savepoint count. - @param locker the transaction locker - @param count the increment value -*/ -typedef void (*inc_transaction_savepoints_v1_t) - (struct PSI_transaction_locker *locker, ulong count); - -/** - Increment a transaction event rollback to savepoint count. - @param locker the transaction locker - @param count the increment value -*/ -typedef void (*inc_transaction_rollback_to_savepoint_v1_t) - (struct PSI_transaction_locker *locker, ulong count); - -/** - Increment a transaction event release savepoint count. - @param locker the transaction locker - @param count the increment value -*/ -typedef void (*inc_transaction_release_savepoint_v1_t) - (struct PSI_transaction_locker *locker, ulong count); - -/** - Commit or rollback the transaction. - @param locker the transaction locker for this event - @param commit true if transaction was committed, false if rolled back -*/ -typedef void (*end_transaction_v1_t) - (struct PSI_transaction_locker *locker, - my_bool commit); - -/** - Record a socket instrumentation start event. - @param locker a socket locker for the running thread - @param op socket operation to be performed - @param count the number of bytes requested, or 0 if not applicable - @param src_file the source file name - @param src_line the source line number -*/ -typedef struct PSI_socket_locker* (*start_socket_wait_v1_t) - (struct PSI_socket_locker_state_v1 *state, - struct PSI_socket *socket, - enum PSI_socket_operation op, - size_t count, - const char *src_file, uint src_line); - -/** - Record a socket instrumentation end event. - Note that for socket close operations, the instrumented socket handle - associated with the socket (which was provided to obtain a locker) - is invalid after this call. - @param locker a socket locker for the running thread - @param count the number of bytes actually used in the operation, - or 0 if not applicable, or -1 if the operation failed - @sa get_thread_socket_locker -*/ -typedef void (*end_socket_wait_v1_t) - (struct PSI_socket_locker *locker, size_t count); - -/** - Set the socket state for an instrumented socket. - @param socket the instrumented socket - @param state socket state - */ -typedef void (*set_socket_state_v1_t)(struct PSI_socket *socket, - enum PSI_socket_state state); - -/** - Set the socket info for an instrumented socket. - @param socket the instrumented socket - @param fd the socket descriptor - @param addr the socket ip address - @param addr_len length of socket ip address - @param thread_id associated thread id -*/ -typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket, - const my_socket *fd, - const struct sockaddr *addr, - socklen_t addr_len); - -/** - Bind a socket to the thread that owns it. - @param socket instrumented socket -*/ -typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket); - -/** - Get a prepare statement. - @param locker a statement locker for the running thread. -*/ -typedef PSI_prepared_stmt* (*create_prepared_stmt_v1_t) - (void *identity, uint stmt_id, PSI_statement_locker *locker, - const char *stmt_name, size_t stmt_name_length); - -/** - destroy a prepare statement. - @param prepared_stmt prepared statement. -*/ -typedef void (*destroy_prepared_stmt_v1_t) - (PSI_prepared_stmt *prepared_stmt); - -/** - repreare a prepare statement. - @param prepared_stmt prepared statement. -*/ -typedef void (*reprepare_prepared_stmt_v1_t) - (PSI_prepared_stmt *prepared_stmt); - -/** - Record a prepare statement instrumentation execute event. - @param locker a statement locker for the running thread. - @param prepared_stmt prepared statement. -*/ -typedef void (*execute_prepared_stmt_v1_t) - (PSI_statement_locker *locker, PSI_prepared_stmt* prepared_stmt); - -/** - Set the statement text for a prepared statment event. - @param prepared_stmt prepared statement. - @param text the prepared statement text - @param text_len the prepared statement text length -*/ -typedef void (*set_prepared_stmt_text_v1_t)(PSI_prepared_stmt *prepared_stmt, - const char *text, - uint text_len); -/** - Get a digest locker for the current statement. - @param locker a statement locker for the running thread -*/ -typedef struct PSI_digest_locker * (*digest_start_v1_t) - (struct PSI_statement_locker *locker); - -/** - Add a token to the current digest instrumentation. - @param locker a digest locker for the current statement - @param token the lexical token to add - @param yylval the lexical token attributes -*/ -typedef void (*digest_end_v1_t) - (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest); - -typedef PSI_sp_locker* (*start_sp_v1_t) - (struct PSI_sp_locker_state_v1 *state, struct PSI_sp_share* sp_share); - -typedef void (*end_sp_v1_t) - (struct PSI_sp_locker *locker); - -typedef void (*drop_sp_v1_t) - (uint object_type, - const char *schema_name, uint schema_name_length, - const char *object_name, uint object_name_length); - -/** - Acquire a sp share instrumentation. - @param type of stored program - @param schema name of stored program - @param name of stored program - @return a stored program share instrumentation, or NULL -*/ -typedef struct PSI_sp_share* (*get_sp_share_v1_t) - (uint object_type, - const char *schema_name, uint schema_name_length, - const char *object_name, uint object_name_length); - -/** - Release a stored program share. - @param info the stored program share to release -*/ -typedef void (*release_sp_share_v1_t)(struct PSI_sp_share *share); - -typedef PSI_metadata_lock* (*create_metadata_lock_v1_t) - (void *identity, - const MDL_key *key, - opaque_mdl_type mdl_type, - opaque_mdl_duration mdl_duration, - opaque_mdl_status mdl_status, - const char *src_file, - uint src_line); - -typedef void (*set_metadata_lock_status_v1_t)(PSI_metadata_lock *lock, - opaque_mdl_status mdl_status); - -typedef void (*destroy_metadata_lock_v1_t)(PSI_metadata_lock *lock); - -typedef struct PSI_metadata_locker* (*start_metadata_wait_v1_t) - (struct PSI_metadata_locker_state_v1 *state, - struct PSI_metadata_lock *mdl, - const char *src_file, uint src_line); - -typedef void (*end_metadata_wait_v1_t) - (struct PSI_metadata_locker *locker, int rc); - -/** - Stores an array of connection attributes - @param buffer char array of length encoded connection attributes - in network format - @param length length of the data in buffer - @param from_cs charset in which @c buffer is encoded - @return state - @retval non_0 attributes truncated - @retval 0 stored the attribute -*/ -typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length, - const void *from_cs); - -/** - Performance Schema Interface, version 1. - @since PSI_VERSION_1 -*/ -struct PSI_v1 -{ - /** @sa register_mutex_v1_t. */ - register_mutex_v1_t register_mutex; - /** @sa register_rwlock_v1_t. */ - register_rwlock_v1_t register_rwlock; - /** @sa register_cond_v1_t. */ - register_cond_v1_t register_cond; - /** @sa register_thread_v1_t. */ - register_thread_v1_t register_thread; - /** @sa register_file_v1_t. */ - register_file_v1_t register_file; - /** @sa register_stage_v1_t. */ - register_stage_v1_t register_stage; - /** @sa register_statement_v1_t. */ - register_statement_v1_t register_statement; - /** @sa register_socket_v1_t. */ - register_socket_v1_t register_socket; - /** @sa init_mutex_v1_t. */ - init_mutex_v1_t init_mutex; - /** @sa destroy_mutex_v1_t. */ - destroy_mutex_v1_t destroy_mutex; - /** @sa init_rwlock_v1_t. */ - init_rwlock_v1_t init_rwlock; - /** @sa destroy_rwlock_v1_t. */ - destroy_rwlock_v1_t destroy_rwlock; - /** @sa init_cond_v1_t. */ - init_cond_v1_t init_cond; - /** @sa destroy_cond_v1_t. */ - destroy_cond_v1_t destroy_cond; - /** @sa init_socket_v1_t. */ - init_socket_v1_t init_socket; - /** @sa destroy_socket_v1_t. */ - destroy_socket_v1_t destroy_socket; - - /** @sa get_table_share_v1_t. */ - get_table_share_v1_t get_table_share; - /** @sa release_table_share_v1_t. */ - release_table_share_v1_t release_table_share; - /** @sa drop_table_share_v1_t. */ - drop_table_share_v1_t drop_table_share; - /** @sa open_table_v1_t. */ - open_table_v1_t open_table; - /** @sa unbind_table_v1_t. */ - unbind_table_v1_t unbind_table; - /** @sa rebind_table_v1_t. */ - rebind_table_v1_t rebind_table; - /** @sa close_table_v1_t. */ - close_table_v1_t close_table; - /** @sa create_file_v1_t. */ - create_file_v1_t create_file; - /** @sa spawn_thread_v1_t. */ - spawn_thread_v1_t spawn_thread; - /** @sa new_thread_v1_t. */ - new_thread_v1_t new_thread; - /** @sa set_thread_id_v1_t. */ - set_thread_id_v1_t set_thread_id; - /** @sa set_thread_THD_v1_t. */ - set_thread_THD_v1_t set_thread_THD; - /** @sa set_thread_os_id_v1_t. */ - set_thread_os_id_v1_t set_thread_os_id; - /** @sa get_thread_v1_t. */ - get_thread_v1_t get_thread; - /** @sa set_thread_user_v1_t. */ - set_thread_user_v1_t set_thread_user; - /** @sa set_thread_account_v1_t. */ - set_thread_account_v1_t set_thread_account; - /** @sa set_thread_db_v1_t. */ - set_thread_db_v1_t set_thread_db; - /** @sa set_thread_command_v1_t. */ - set_thread_command_v1_t set_thread_command; - /** @sa set_connection_type_v1_t. */ - set_connection_type_v1_t set_connection_type; - /** @sa set_thread_start_time_v1_t. */ - set_thread_start_time_v1_t set_thread_start_time; - /** @sa set_thread_state_v1_t. */ - set_thread_state_v1_t set_thread_state; - /** @sa set_thread_info_v1_t. */ - set_thread_info_v1_t set_thread_info; - /** @sa set_thread_v1_t. */ - set_thread_v1_t set_thread; - /** @sa delete_current_thread_v1_t. */ - delete_current_thread_v1_t delete_current_thread; - /** @sa delete_thread_v1_t. */ - delete_thread_v1_t delete_thread; - /** @sa get_thread_file_name_locker_v1_t. */ - get_thread_file_name_locker_v1_t get_thread_file_name_locker; - /** @sa get_thread_file_stream_locker_v1_t. */ - get_thread_file_stream_locker_v1_t get_thread_file_stream_locker; - /** @sa get_thread_file_descriptor_locker_v1_t. */ - get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker; - /** @sa unlock_mutex_v1_t. */ - unlock_mutex_v1_t unlock_mutex; - /** @sa unlock_rwlock_v1_t. */ - unlock_rwlock_v1_t unlock_rwlock; - /** @sa signal_cond_v1_t. */ - signal_cond_v1_t signal_cond; - /** @sa broadcast_cond_v1_t. */ - broadcast_cond_v1_t broadcast_cond; - /** @sa start_idle_wait_v1_t. */ - start_idle_wait_v1_t start_idle_wait; - /** @sa end_idle_wait_v1_t. */ - end_idle_wait_v1_t end_idle_wait; - /** @sa start_mutex_wait_v1_t. */ - start_mutex_wait_v1_t start_mutex_wait; - /** @sa end_mutex_wait_v1_t. */ - end_mutex_wait_v1_t end_mutex_wait; - /** @sa start_rwlock_rdwait_v1_t. */ - start_rwlock_rdwait_v1_t start_rwlock_rdwait; - /** @sa end_rwlock_rdwait_v1_t. */ - end_rwlock_rdwait_v1_t end_rwlock_rdwait; - /** @sa start_rwlock_wrwait_v1_t. */ - start_rwlock_wrwait_v1_t start_rwlock_wrwait; - /** @sa end_rwlock_wrwait_v1_t. */ - end_rwlock_wrwait_v1_t end_rwlock_wrwait; - /** @sa start_cond_wait_v1_t. */ - start_cond_wait_v1_t start_cond_wait; - /** @sa end_cond_wait_v1_t. */ - end_cond_wait_v1_t end_cond_wait; - /** @sa start_table_io_wait_v1_t. */ - start_table_io_wait_v1_t start_table_io_wait; - /** @sa end_table_io_wait_v1_t. */ - end_table_io_wait_v1_t end_table_io_wait; - /** @sa start_table_lock_wait_v1_t. */ - start_table_lock_wait_v1_t start_table_lock_wait; - /** @sa end_table_lock_wait_v1_t. */ - end_table_lock_wait_v1_t end_table_lock_wait; - /** @sa start_file_open_wait_v1_t. */ - start_file_open_wait_v1_t start_file_open_wait; - /** @sa end_file_open_wait_v1_t. */ - end_file_open_wait_v1_t end_file_open_wait; - /** @sa end_file_open_wait_and_bind_to_descriptor_v1_t. */ - end_file_open_wait_and_bind_to_descriptor_v1_t - end_file_open_wait_and_bind_to_descriptor; - /** @sa end_temp_file_open_wait_and_bind_to_descriptor_v1_t. */ - end_temp_file_open_wait_and_bind_to_descriptor_v1_t - end_temp_file_open_wait_and_bind_to_descriptor; - /** @sa start_file_wait_v1_t. */ - start_file_wait_v1_t start_file_wait; - /** @sa end_file_wait_v1_t. */ - end_file_wait_v1_t end_file_wait; - /** @sa start_file_close_wait_v1_t. */ - start_file_close_wait_v1_t start_file_close_wait; - /** @sa end_file_close_wait_v1_t. */ - end_file_close_wait_v1_t end_file_close_wait; - /** @sa rename_file_close_wait_v1_t. */ - end_file_rename_wait_v1_t end_file_rename_wait; - /** @sa start_stage_v1_t. */ - start_stage_v1_t start_stage; - /** @sa get_current_stage_progress_v1_t. */ - get_current_stage_progress_v1_t get_current_stage_progress; - /** @sa end_stage_v1_t. */ - end_stage_v1_t end_stage; - /** @sa get_thread_statement_locker_v1_t. */ - get_thread_statement_locker_v1_t get_thread_statement_locker; - /** @sa refine_statement_v1_t. */ - refine_statement_v1_t refine_statement; - /** @sa start_statement_v1_t. */ - start_statement_v1_t start_statement; - /** @sa set_statement_text_v1_t. */ - set_statement_text_v1_t set_statement_text; - /** @sa set_statement_lock_time_t. */ - set_statement_lock_time_t set_statement_lock_time; - /** @sa set_statement_rows_sent_t. */ - set_statement_rows_sent_t set_statement_rows_sent; - /** @sa set_statement_rows_examined_t. */ - set_statement_rows_examined_t set_statement_rows_examined; - /** @sa inc_statement_created_tmp_disk_tables. */ - inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables; - /** @sa inc_statement_created_tmp_tables. */ - inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables; - /** @sa inc_statement_select_full_join. */ - inc_statement_select_full_join_t inc_statement_select_full_join; - /** @sa inc_statement_select_full_range_join. */ - inc_statement_select_full_range_join_t inc_statement_select_full_range_join; - /** @sa inc_statement_select_range. */ - inc_statement_select_range_t inc_statement_select_range; - /** @sa inc_statement_select_range_check. */ - inc_statement_select_range_check_t inc_statement_select_range_check; - /** @sa inc_statement_select_scan. */ - inc_statement_select_scan_t inc_statement_select_scan; - /** @sa inc_statement_sort_merge_passes. */ - inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes; - /** @sa inc_statement_sort_range. */ - inc_statement_sort_range_t inc_statement_sort_range; - /** @sa inc_statement_sort_rows. */ - inc_statement_sort_rows_t inc_statement_sort_rows; - /** @sa inc_statement_sort_scan. */ - inc_statement_sort_scan_t inc_statement_sort_scan; - /** @sa set_statement_no_index_used. */ - set_statement_no_index_used_t set_statement_no_index_used; - /** @sa set_statement_no_good_index_used. */ - set_statement_no_good_index_used_t set_statement_no_good_index_used; - /** @sa end_statement_v1_t. */ - end_statement_v1_t end_statement; - /** @sa get_thread_transaction_locker_v1_t. */ - get_thread_transaction_locker_v1_t get_thread_transaction_locker; - /** @sa start_transaction_v1_t. */ - start_transaction_v1_t start_transaction; - /** @sa set_transaction_xid_v1_t. */ - set_transaction_xid_v1_t set_transaction_xid; - /** @sa set_transaction_xa_state_v1_t. */ - set_transaction_xa_state_v1_t set_transaction_xa_state; - /** @sa set_transaction_gtid_v1_t. */ - set_transaction_gtid_v1_t set_transaction_gtid; - /** @sa set_transaction_trxid_v1_t. */ - set_transaction_trxid_v1_t set_transaction_trxid; - /** @sa inc_transaction_savepoints_v1_t. */ - inc_transaction_savepoints_v1_t inc_transaction_savepoints; - /** @sa inc_transaction_rollback_to_savepoint_v1_t. */ - inc_transaction_rollback_to_savepoint_v1_t inc_transaction_rollback_to_savepoint; - /** @sa inc_transaction_release_savepoint_v1_t. */ - inc_transaction_release_savepoint_v1_t inc_transaction_release_savepoint; - /** @sa end_transaction_v1_t. */ - end_transaction_v1_t end_transaction; - /** @sa start_socket_wait_v1_t. */ - start_socket_wait_v1_t start_socket_wait; - /** @sa end_socket_wait_v1_t. */ - end_socket_wait_v1_t end_socket_wait; - /** @sa set_socket_state_v1_t. */ - set_socket_state_v1_t set_socket_state; - /** @sa set_socket_info_v1_t. */ - set_socket_info_v1_t set_socket_info; - /** @sa set_socket_thread_owner_v1_t. */ - set_socket_thread_owner_v1_t set_socket_thread_owner; - /** @sa create_prepared_stmt_v1_t. */ - create_prepared_stmt_v1_t create_prepared_stmt; - /** @sa destroy_prepared_stmt_v1_t. */ - destroy_prepared_stmt_v1_t destroy_prepared_stmt; - /** @sa reprepare_prepared_stmt_v1_t. */ - reprepare_prepared_stmt_v1_t reprepare_prepared_stmt; - /** @sa execute_prepared_stmt_v1_t. */ - execute_prepared_stmt_v1_t execute_prepared_stmt; - /** @sa set_prepared_stmt_text_v1_t. */ - set_prepared_stmt_text_v1_t set_prepared_stmt_text; - /** @sa digest_start_v1_t. */ - digest_start_v1_t digest_start; - /** @sa digest_end_v1_t. */ - digest_end_v1_t digest_end; - /** @sa set_thread_connect_attrs_v1_t. */ - set_thread_connect_attrs_v1_t set_thread_connect_attrs; - /** @sa start_sp_v1_t. */ - start_sp_v1_t start_sp; - /** @sa start_sp_v1_t. */ - end_sp_v1_t end_sp; - /** @sa drop_sp_v1_t. */ - drop_sp_v1_t drop_sp; - /** @sa get_sp_share_v1_t. */ - get_sp_share_v1_t get_sp_share; - /** @sa release_sp_share_v1_t. */ - release_sp_share_v1_t release_sp_share; - /** @sa register_memory_v1_t. */ - register_memory_v1_t register_memory; - /** @sa memory_alloc_v1_t. */ - memory_alloc_v1_t memory_alloc; - /** @sa memory_realloc_v1_t. */ - memory_realloc_v1_t memory_realloc; - /** @sa memory_claim_v1_t. */ - memory_claim_v1_t memory_claim; - /** @sa memory_free_v1_t. */ - memory_free_v1_t memory_free; - - unlock_table_v1_t unlock_table; - - create_metadata_lock_v1_t create_metadata_lock; - set_metadata_lock_status_v1_t set_metadata_lock_status; - destroy_metadata_lock_v1_t destroy_metadata_lock; - - start_metadata_wait_v1_t start_metadata_wait; - end_metadata_wait_v1_t end_metadata_wait; -}; - -/** @} (end of group Group_PSI_v1) */ - -#endif /* HAVE_PSI_1 */ - -#ifdef USE_PSI_2 -#define HAVE_PSI_2 -#endif - -#ifdef HAVE_PSI_2 - -/** - @defgroup Group_PSI_v2 Application Binary Interface, version 2 - @ingroup Instrumentation_interface - @{ -*/ - -/** - Performance Schema Interface, version 2. - This is a placeholder, this interface is not defined yet. - @since PSI_VERSION_2 -*/ -struct PSI_v2 -{ - /** Placeholder */ - int placeholder; - /* ... extended interface ... */ -}; - -/** Placeholder */ -struct PSI_mutex_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_rwlock_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_cond_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_thread_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_file_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_stage_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_statement_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_transaction_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_idle_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_mutex_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_rwlock_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_cond_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_file_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_statement_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_transaction_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_socket_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -struct PSI_metadata_locker_state_v2 -{ - int placeholder; -}; - -/** @} (end of group Group_PSI_v2) */ - -#endif /* HAVE_PSI_2 */ - -/** - @typedef PSI - The instrumentation interface for the current version. - @sa PSI_CURRENT_VERSION -*/ - -/** - @typedef PSI_mutex_info - The mutex information structure for the current version. -*/ - -/** - @typedef PSI_rwlock_info - The rwlock information structure for the current version. -*/ - -/** - @typedef PSI_cond_info - The cond information structure for the current version. -*/ - -/** - @typedef PSI_thread_info - The thread information structure for the current version. -*/ - -/** - @typedef PSI_file_info - The file information structure for the current version. -*/ - -/* Export the required version */ -#ifdef USE_PSI_1 -typedef struct PSI_v1 PSI; -typedef struct PSI_mutex_info_v1 PSI_mutex_info; -typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; -typedef struct PSI_cond_info_v1 PSI_cond_info; -typedef struct PSI_thread_info_v1 PSI_thread_info; -typedef struct PSI_file_info_v1 PSI_file_info; -typedef struct PSI_stage_info_v1 PSI_stage_info; -typedef struct PSI_statement_info_v1 PSI_statement_info; -typedef struct PSI_transaction_info_v1 PSI_transaction_info; -typedef struct PSI_socket_info_v1 PSI_socket_info; -typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state; -typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state; -typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state; -typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state; -typedef struct PSI_file_locker_state_v1 PSI_file_locker_state; -typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state; -typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state; -typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state; -typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state; -typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state; -#endif - -#ifdef USE_PSI_2 -typedef struct PSI_v2 PSI; -typedef struct PSI_mutex_info_v2 PSI_mutex_info; -typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; -typedef struct PSI_cond_info_v2 PSI_cond_info; -typedef struct PSI_thread_info_v2 PSI_thread_info; -typedef struct PSI_file_info_v2 PSI_file_info; -typedef struct PSI_stage_info_v2 PSI_stage_info; -typedef struct PSI_statement_info_v2 PSI_statement_info; -typedef struct PSI_transaction_info_v2 PSI_transaction_info; -typedef struct PSI_socket_info_v2 PSI_socket_info; -typedef struct PSI_idle_locker_state_v2 PSI_idle_locker_state; -typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state; -typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state; -typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state; -typedef struct PSI_file_locker_state_v2 PSI_file_locker_state; -typedef struct PSI_statement_locker_state_v2 PSI_statement_locker_state; -typedef struct PSI_transaction_locker_state_v2 PSI_transaction_locker_state; -typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state; -typedef struct PSI_sp_locker_state_v2 PSI_sp_locker_state; -typedef struct PSI_metadata_locker_state_v2 PSI_metadata_locker_state; -#endif - -#ifndef HAVE_PSI_INTERFACE - -/** - Dummy structure, used to declare PSI_server when no instrumentation - is available. - The content does not matter, since PSI_server will be NULL. -*/ -struct PSI_none -{ - int opaque; -}; -typedef struct PSI_none PSI; - -/** - Stage instrument information. - @since PSI_VERSION_1 - This structure is used to register an instrumented stage. -*/ -struct PSI_stage_info_none -{ - /** Unused stage key. */ - unsigned int m_key; - /** The name of the stage instrument. */ - const char *m_name; - /** Unused stage flags. */ - int m_flags; -}; - -/** - The stage instrumentation has to co exist with the legacy - THD::set_proc_info instrumentation. - To avoid duplication of the instrumentation in the server, - the common PSI_stage_info structure is used, - so we export it here, even when not building - with HAVE_PSI_INTERFACE. -*/ -typedef struct PSI_stage_info_none PSI_stage_info; -typedef struct PSI_stage_info_none PSI_statement_info; -typedef struct PSI_stage_info_none PSI_sp_locker_state; -typedef struct PSI_stage_info_none PSI_metadata_locker_state; -typedef struct PSI_stage_info_none PSI_metadata_locker; - -#endif /* HAVE_PSI_INTERFACE */ - -extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; - -/* - Allow to override PSI_XXX_CALL at compile time - with more efficient implementations, if available. - If nothing better is available, - make a dynamic call using the PSI_server function pointer. -*/ - -#define PSI_DYNAMIC_CALL(M) PSI_server->M - -/** @} */ - -C_MODE_END -#endif /* MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H */ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_abi_v0.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_abi_v0.h deleted file mode 100644 index 5c879fb..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_abi_v0.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file mysql/psi/psi_abi_v0.h - ABI check for mysql/psi/psi.h, when compiling without instrumentation. - This file is only used to automate detection of changes between versions. - Do not include this file, include mysql/psi/psi.h instead. -*/ -#define MY_GLOBAL_INCLUDED -#include "mysql/psi/psi.h" - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_abi_v1.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_abi_v1.h deleted file mode 100644 index 488e832..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_abi_v1.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file mysql/psi/psi_abi_v1.h - ABI check for mysql/psi/psi.h, when using PSI_VERSION_1. - This file is only used to automate detection of changes between versions. - Do not include this file, include mysql/psi/psi.h instead. -*/ -#define USE_PSI_1 -#define HAVE_PSI_INTERFACE -#define MY_GLOBAL_INCLUDED -#include "mysql/psi/psi.h" - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_abi_v2.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_abi_v2.h deleted file mode 100644 index 3495d61..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_abi_v2.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file mysql/psi/psi_abi_v1.h - ABI check for mysql/psi/psi.h, when using PSI_VERSION_2. - This file is only used to automate detection of changes between versions. - Do not include this file, include mysql/psi/psi.h instead. -*/ -#define USE_PSI_2 -#define HAVE_PSI_INTERFACE -#define MY_GLOBAL_INCLUDED -#include "mysql/psi/psi.h" - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_base.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_base.h deleted file mode 100644 index f365e26..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_base.h +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - Without limiting anything contained in the foregoing, this file, - which is part of C Driver for MySQL (Connector/C), is also subject to the - Universal FOSS Exception, version 1.0, a copy of which can be found at - http://oss.oracle.com/licenses/universal-foss-exception. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_PSI_BASE_H -#define MYSQL_PSI_BASE_H - -#ifdef EMBEDDED_LIBRARY -#define DISABLE_ALL_PSI -#endif /* EMBEDDED_LIBRARY */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - @file mysql/psi/psi_base.h - Performance schema instrumentation interface. - - @defgroup Instrumentation_interface Instrumentation Interface - @ingroup Performance_schema - @{ -*/ - -#define PSI_INSTRUMENT_ME 0 -#define PSI_INSTRUMENT_MEM ((PSI_memory_key)0) - -#define PSI_NOT_INSTRUMENTED 0 - -/** - Global flag. - This flag indicate that an instrumentation point is a global variable, - or a singleton. -*/ -#define PSI_FLAG_GLOBAL (1 << 0) - -/** - Mutable flag. - This flag indicate that an instrumentation point is a general placeholder, - that can mutate into a more specific instrumentation point. -*/ -#define PSI_FLAG_MUTABLE (1 << 1) - -#define PSI_FLAG_THREAD (1 << 2) - -/** - Stage progress flag. - This flag apply to the stage instruments only. - It indicates the instrumentation provides progress data. -*/ -#define PSI_FLAG_STAGE_PROGRESS (1 << 3) - -/** - Shared Exclusive flag. - Indicates that rwlock support the shared exclusive state. -*/ -#define PSI_RWLOCK_FLAG_SX (1 << 4) - -/** - Transferable flag. - This flag indicate that an instrumented object can - be created by a thread and destroyed by another thread. -*/ -#define PSI_FLAG_TRANSFER (1 << 5) - -/** - Volatility flag. - This flag indicate that an instrumented object - has a volatility (life cycle) comparable - to the volatility of a session. -*/ -#define PSI_FLAG_VOLATILITY_SESSION (1 << 6) - -#ifdef HAVE_PSI_INTERFACE - -/** - @def PSI_VERSION_1 - Performance Schema Interface number for version 1. - This version is supported. -*/ -#define PSI_VERSION_1 1 - -/** - @def PSI_VERSION_2 - Performance Schema Interface number for version 2. - This version is not implemented, it's a placeholder. -*/ -#define PSI_VERSION_2 2 - -/** - @def PSI_CURRENT_VERSION - Performance Schema Interface number for the most recent version. - The most current version is @c PSI_VERSION_1 -*/ -#define PSI_CURRENT_VERSION 1 - -/** - @def USE_PSI_1 - Define USE_PSI_1 to use the interface version 1. -*/ - -/** - @def USE_PSI_2 - Define USE_PSI_2 to use the interface version 2. -*/ - -/** - @def HAVE_PSI_1 - Define HAVE_PSI_1 if the interface version 1 needs to be compiled in. -*/ - -/** - @def HAVE_PSI_2 - Define HAVE_PSI_2 if the interface version 2 needs to be compiled in. -*/ - -#ifndef USE_PSI_2 -#ifndef USE_PSI_1 -#define USE_PSI_1 -#endif -#endif - -#ifdef USE_PSI_1 -#define HAVE_PSI_1 -#endif - -#ifdef USE_PSI_2 -#define HAVE_PSI_2 -#endif - -/* - Allow to override PSI_XXX_CALL at compile time - with more efficient implementations, if available. - If nothing better is available, - make a dynamic call using the PSI_server function pointer. -*/ - -#define PSI_DYNAMIC_CALL(M) PSI_server->M - -#endif /* HAVE_PSI_INTERFACE */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* MYSQL_PSI_BASE_H */ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_memory.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_memory.h deleted file mode 100644 index bbe2be3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/psi/psi_memory.h +++ /dev/null @@ -1,167 +0,0 @@ -/* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - Without limiting anything contained in the foregoing, this file, - which is part of C Driver for MySQL (Connector/C), is also subject to the - Universal FOSS Exception, version 1.0, a copy of which can be found at - http://oss.oracle.com/licenses/universal-foss-exception. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_PSI_MEMORY_H -#define MYSQL_PSI_MEMORY_H - -#include "psi_base.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - @file mysql/psi/psi_memory.h - Performance schema instrumentation interface. - - @defgroup Instrumentation_interface Instrumentation Interface - @ingroup Performance_schema - @{ -*/ - -#ifdef HAVE_PSI_INTERFACE -#ifndef DISABLE_ALL_PSI -#ifndef DISABLE_PSI_MEMORY -#define HAVE_PSI_MEMORY_INTERFACE -#endif /* DISABLE_PSI_MEMORY */ -#endif /* DISABLE_ALL_PSI */ -#endif /* HAVE_PSI_INTERFACE */ - -struct PSI_thread; - -/** - Instrumented memory key. - To instrument memory, a memory key must be obtained using @c register_memory. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_memory_key; - -#ifdef HAVE_PSI_1 - -/** - @defgroup Group_PSI_v1 Application Binary Interface, version 1 - @ingroup Instrumentation_interface - @{ -*/ - -/** - Memory instrument information. - @since PSI_VERSION_1 - This structure is used to register instrumented memory. -*/ -struct PSI_memory_info_v1 -{ - /** Pointer to the key assigned to the registered memory. */ - PSI_memory_key *m_key; - /** The name of the memory instrument to register. */ - const char *m_name; - /** - The flags of the socket instrument to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; -typedef struct PSI_memory_info_v1 PSI_memory_info_v1; - -/** - Memory registration API. - @param category a category name (typically a plugin name) - @param info an array of memory info to register - @param count the size of the info array -*/ -typedef void (*register_memory_v1_t) - (const char *category, struct PSI_memory_info_v1 *info, int count); - -/** - Instrument memory allocation. - @param key the memory instrument key - @param size the size of memory allocated - @param[out] owner the memory owner - @return the effective memory instrument key -*/ -typedef PSI_memory_key (*memory_alloc_v1_t) - (PSI_memory_key key, size_t size, struct PSI_thread ** owner); - -/** - Instrument memory re allocation. - @param key the memory instrument key - @param old_size the size of memory previously allocated - @param new_size the size of memory re allocated - @param[in, out] owner the memory owner - @return the effective memory instrument key -*/ -typedef PSI_memory_key (*memory_realloc_v1_t) - (PSI_memory_key key, size_t old_size, size_t new_size, struct PSI_thread ** owner); - -/** - Instrument memory claim. - @param key the memory instrument key - @param size the size of memory allocated - @param[in, out] owner the memory owner - @return the effective memory instrument key -*/ -typedef PSI_memory_key (*memory_claim_v1_t) - (PSI_memory_key key, size_t size, struct PSI_thread ** owner); - -/** - Instrument memory free. - @param key the memory instrument key - @param size the size of memory allocated - @param owner the memory owner -*/ -typedef void (*memory_free_v1_t) - (PSI_memory_key key, size_t size, struct PSI_thread * owner); - -/** @} (end of group Group_PSI_v1) */ - -#endif /* HAVE_PSI_1 */ - -#ifdef HAVE_PSI_2 -struct PSI_memory_info_v2 -{ - int placeholder; -}; - -#endif /* HAVE_PSI_2 */ - -#ifdef USE_PSI_1 -typedef struct PSI_memory_info_v1 PSI_memory_info; -#endif - -#ifdef USE_PSI_2 -typedef struct PSI_memory_info_v2 PSI_memory_info; -#endif - -/** @} (end of group Instrumentation_interface) */ - -#ifdef __cplusplus -} -#endif - - -#endif /* MYSQL_PSI_MEMORY_H */ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_base64.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_base64.h deleted file mode 100644 index 43b5ba3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_base64.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef MYSQL_SERVICE_BASE64_INCLUDED -/* Copyright (c) 2017, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - my base64 service - - Functions for base64 en- and decoding -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MYSQL_ABI_CHECK -#include -#endif - -/* Allow multuple chunks 'AAA= AA== AA==', binlog uses this */ -#define MY_BASE64_DECODE_ALLOW_MULTIPLE_CHUNKS 1 - -extern struct base64_service_st { - int (*base64_needed_encoded_length_ptr)(int length_of_data); - int (*base64_encode_max_arg_length_ptr)(void); - int (*base64_needed_decoded_length_ptr)(int length_of_encoded_data); - int (*base64_decode_max_arg_length_ptr)(); - int (*base64_encode_ptr)(const void *src, size_t src_len, char *dst); - int (*base64_decode_ptr)(const char *src, size_t src_len, - void *dst, const char **end_ptr, int flags); -} *base64_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define my_base64_needed_encoded_length(A) base64_service->base64_needed_encoded_length_ptr(A) -#define my_base64_encode_max_arg_length() base64_service->base64_encode_max_arg_length_ptr() -#define my_base64_needed_decoded_length(A) base64_service->base64_needed_decoded_length_ptr(A) -#define my_base64_decode_max_arg_length() base64_service->base64_decode_max_arg_length_ptr() -#define my_base64_encode(A,B,C) base64_service->base64_encode_ptr(A,B,C) -#define my_base64_decode(A,B,C,D,E) base64_service->base64_decode_ptr(A,B,C,D,E) - -#else - -/* Calculate how much memory needed for dst of my_base64_encode() */ -int my_base64_needed_encoded_length(int length_of_data); - -/* Maximum length my_base64_encode_needed_length() can accept with no overflow. */ -int my_base64_encode_max_arg_length(void); - -/* Calculate how much memory needed for dst of my_base64_decode() */ -int my_base64_needed_decoded_length(int length_of_encoded_data); - -/* Maximum length my_base64_decode_needed_length() can accept with no overflow. */ -int my_base64_decode_max_arg_length(); - -/* Encode data as a my_base64 string */ -int my_base64_encode(const void *src, size_t src_len, char *dst); - -/* Decode a my_base64 string into data */ -int my_base64_decode(const char *src, size_t src_len, - void *dst, const char **end_ptr, int flags); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_BASE64_INCLUDED -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_debug_sync.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_debug_sync.h deleted file mode 100644 index 0bd49a1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_debug_sync.h +++ /dev/null @@ -1,361 +0,0 @@ -#ifndef MYSQL_SERVICE_DEBUG_SYNC_INCLUDED -/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. - Copyright (c) 2012, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - == Debug Sync Facility == - - The Debug Sync Facility allows placement of synchronization points in - the server code by using the DEBUG_SYNC macro: - - open_tables(...) - - DEBUG_SYNC(thd, "after_open_tables"); - - lock_tables(...) - - When activated, a sync point can - - - Emit a signal and/or - - Wait for a signal - - Nomenclature: - - - signal: A value of a global variable that persists - until overwritten by a new signal. The global - variable can also be seen as a "signal post" - or "flag mast". Then the signal is what is - attached to the "signal post" or "flag mast". - - - emit a signal: Assign the value (the signal) to the global - variable ("set a flag") and broadcast a - global condition to wake those waiting for - a signal. - - - wait for a signal: Loop over waiting for the global condition until - the global value matches the wait-for signal. - - By default, all sync points are inactive. They do nothing (except to - burn a couple of CPU cycles for checking if they are active). - - A sync point becomes active when an action is requested for it. - To do so, put a line like this in the test case file: - - SET DEBUG_SYNC= 'after_open_tables SIGNAL opened WAIT_FOR flushed'; - - This activates the sync point 'after_open_tables'. It requests it to - emit the signal 'opened' and wait for another thread to emit the signal - 'flushed' when the thread's execution runs through the sync point. - - For every sync point there can be one action per thread only. Every - thread can request multiple actions, but only one per sync point. In - other words, a thread can activate multiple sync points. - - Here is an example how to activate and use the sync points: - - --connection conn1 - SET DEBUG_SYNC= 'after_open_tables SIGNAL opened WAIT_FOR flushed'; - send INSERT INTO t1 VALUES(1); - --connection conn2 - SET DEBUG_SYNC= 'now WAIT_FOR opened'; - SET DEBUG_SYNC= 'after_abort_locks SIGNAL flushed'; - FLUSH TABLE t1; - - When conn1 runs through the INSERT statement, it hits the sync point - 'after_open_tables'. It notices that it is active and executes its - action. It emits the signal 'opened' and waits for another thread to - emit the signal 'flushed'. - - conn2 waits immediately at the special sync point 'now' for another - thread to emit the 'opened' signal. - - A signal remains in effect until it is overwritten. If conn1 signals - 'opened' before conn2 reaches 'now', conn2 will still find the 'opened' - signal. It does not wait in this case. - - When conn2 reaches 'after_abort_locks', it signals 'flushed', which lets - conn1 awake. - - Normally the activation of a sync point is cleared when it has been - executed. Sometimes it is necessary to keep the sync point active for - another execution. You can add an execute count to the action: - - SET DEBUG_SYNC= 'name SIGNAL sig EXECUTE 3'; - - This sets the signal point's activation counter to 3. Each execution - decrements the counter. After the third execution the sync point - becomes inactive. - - One of the primary goals of this facility is to eliminate sleeps from - the test suite. In most cases it should be possible to rewrite test - cases so that they do not need to sleep. (But this facility cannot - synchronize multiple processes.) However, to support test development, - and as a last resort, sync point waiting times out. There is a default - timeout, but it can be overridden: - - SET DEBUG_SYNC= 'name WAIT_FOR sig TIMEOUT 10 EXECUTE 2'; - - TIMEOUT 0 is special: If the signal is not present, the wait times out - immediately. - - When a wait timed out (even on TIMEOUT 0), a warning is generated so - that it shows up in the test result. - - You can throw an error message and kill the query when a synchronization - point is hit a certain number of times: - - SET DEBUG_SYNC= 'name HIT_LIMIT 3'; - - Or combine it with signal and/or wait: - - SET DEBUG_SYNC= 'name SIGNAL sig EXECUTE 2 HIT_LIMIT 3'; - - Here the first two hits emit the signal, the third hit returns the error - message and kills the query. - - For cases where you are not sure that an action is taken and thus - cleared in any case, you can force to clear (deactivate) a sync point: - - SET DEBUG_SYNC= 'name CLEAR'; - - If you want to clear all actions and clear the global signal, use: - - SET DEBUG_SYNC= 'RESET'; - - This is the only way to reset the global signal to an empty string. - - For testing of the facility itself you can execute a sync point just - as if it had been hit: - - SET DEBUG_SYNC= 'name TEST'; - - - === Formal Syntax === - - The string to "assign" to the DEBUG_SYNC variable can contain: - - {RESET | - TEST | - CLEAR | - {{SIGNAL | - WAIT_FOR [TIMEOUT ]} - [EXECUTE ] &| HIT_LIMIT } - - Here '&|' means 'and/or'. This means that one of the sections - separated by '&|' must be present or both of them. - - - === Activation/Deactivation === - - The facility is an optional part of the MySQL server. - It is enabled in a debug server by default. - - ./configure --enable-debug-sync - - The Debug Sync Facility, when compiled in, is disabled by default. It - can be enabled by a mysqld command line option: - - --debug-sync-timeout[=default_wait_timeout_value_in_seconds] - - 'default_wait_timeout_value_in_seconds' is the default timeout for the - WAIT_FOR action. If set to zero, the facility stays disabled. - - The facility is enabled by default in the test suite, but can be - disabled with: - - mysql-test-run.pl ... --debug-sync-timeout=0 ... - - Likewise the default wait timeout can be set: - - mysql-test-run.pl ... --debug-sync-timeout=10 ... - - The command line option influences the readable value of the system - variable 'debug_sync'. - - * If the facility is not compiled in, the system variable does not exist. - - * If --debug-sync-timeout=0 the value of the variable reads as "OFF". - - * Otherwise the value reads as "ON - current signal: " followed by the - current signal string, which can be empty. - - The readable variable value is the same, regardless if read as global - or session value. - - Setting the 'debug-sync' system variable requires 'SUPER' privilege. - You can never read back the string that you assigned to the variable, - unless you assign the value that the variable does already have. But - that would give a parse error. A syntactically correct string is - parsed into a debug sync action and stored apart from the variable value. - - - === Implementation === - - Pseudo code for a sync point: - - #define DEBUG_SYNC(thd, sync_point_name) - if (unlikely(opt_debug_sync_timeout)) - debug_sync(thd, STRING_WITH_LEN(sync_point_name)) - - The sync point performs a binary search in a sorted array of actions - for this thread. - - The SET DEBUG_SYNC statement adds a requested action to the array or - overwrites an existing action for the same sync point. When it adds a - new action, the array is sorted again. - - - === A typical synchronization pattern === - - There are quite a few places in MySQL, where we use a synchronization - pattern like this: - - mysql_mutex_lock(&mutex); - thd->enter_cond(&condition_variable, &mutex, new_message); - #if defined(ENABLE_DEBUG_SYNC) - if (!thd->killed && !end_of_wait_condition) - DEBUG_SYNC(thd, "sync_point_name"); - #endif - while (!thd->killed && !end_of_wait_condition) - mysql_cond_wait(&condition_variable, &mutex); - thd->exit_cond(old_message); - - Here some explanations: - - thd->enter_cond() is used to register the condition variable and the - mutex in thd->mysys_var. This is done to allow the thread to be - interrupted (killed) from its sleep. Another thread can find the - condition variable to signal and mutex to use for synchronization in - this thread's THD::mysys_var. - - thd->enter_cond() requires the mutex to be acquired in advance. - - thd->exit_cond() unregisters the condition variable and mutex and - releases the mutex. - - If you want to have a Debug Sync point with the wait, please place it - behind enter_cond(). Only then you can safely decide, if the wait will - be taken. Also you will have THD::proc_info correct when the sync - point emits a signal. DEBUG_SYNC sets its own proc_info, but restores - the previous one before releasing its internal mutex. As soon as - another thread sees the signal, it does also see the proc_info from - before entering the sync point. In this case it will be "new_message", - which is associated with the wait that is to be synchronized. - - In the example above, the wait condition is repeated before the sync - point. This is done to skip the sync point, if no wait takes place. - The sync point is before the loop (not inside the loop) to have it hit - once only. It is possible that the condition variable is signaled - multiple times without the wait condition to be true. - - A bit off-topic: At some places, the loop is taken around the whole - synchronization pattern: - - while (!thd->killed && !end_of_wait_condition) - { - mysql_mutex_lock(&mutex); - thd->enter_cond(&condition_variable, &mutex, new_message); - if (!thd->killed [&& !end_of_wait_condition]) - { - [DEBUG_SYNC(thd, "sync_point_name");] - mysql_cond_wait(&condition_variable, &mutex); - } - thd->exit_cond(old_message); - } - - Note that it is important to repeat the test for thd->killed after - enter_cond(). Otherwise the killing thread may kill this thread after - it tested thd->killed in the loop condition and before it registered - the condition variable and mutex in enter_cond(). In this case, the - killing thread does not know that this thread is going to wait on a - condition variable. It would just set THD::killed. But if we would not - test it again, we would go asleep though we are killed. If the killing - thread would kill us when we are after the second test, but still - before sleeping, we hold the mutex, which is registered in mysys_var. - The killing thread would try to acquire the mutex before signaling - the condition variable. Since the mutex is only released implicitly in - mysql_cond_wait(), the signaling happens at the right place. We - have a safe synchronization. - - === Co-work with the DBUG facility === - - When running the MySQL test suite with the --debug-dbug command line - option, the Debug Sync Facility writes trace messages to the DBUG - trace. The following shell commands proved very useful in extracting - relevant information: - - egrep 'query:|debug_sync_exec:' mysql-test/var/log/mysqld.1.trace - - It shows all executed SQL statements and all actions executed by - synchronization points. - - Sometimes it is also useful to see, which synchronization points have - been run through (hit) with or without executing actions. Then add - "|debug_sync_point:" to the egrep pattern. - - === Further reading === - - For a discussion of other methods to synchronize threads see - http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronization - - For complete syntax tests, functional tests, and examples see the test - case debug_sync.test. - - See also http://forge.mysql.com/worklog/task.php?id=4259 -*/ - -#ifndef MYSQL_ABI_CHECK -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef MYSQL_DYNAMIC_PLUGIN -extern void (*debug_sync_service)(MYSQL_THD, const char *, size_t); -#else -#define debug_sync_service debug_sync_C_callback_ptr -extern void (*debug_sync_C_callback_ptr)(MYSQL_THD, const char *, size_t); -#endif - -#ifdef ENABLED_DEBUG_SYNC -#define DEBUG_SYNC(thd, name) \ - do { \ - if (debug_sync_service) \ - debug_sync_service(thd, STRING_WITH_LEN(name)); \ - } while(0) - -#define DEBUG_SYNC_C_IF_THD(thd, name) \ - do { \ - if (debug_sync_service && thd) \ - debug_sync_service((MYSQL_THD) thd, STRING_WITH_LEN(name)); \ - } while(0) -#else -#define DEBUG_SYNC(thd,name) do { } while(0) -#define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) do { } while(0) -#endif /* defined(ENABLED_DEBUG_SYNC) */ - -/* compatibility macro */ -#define DEBUG_SYNC_C(name) DEBUG_SYNC(NULL, name) - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_DEBUG_SYNC_INCLUDED -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_encryption.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_encryption.h deleted file mode 100644 index a4e908f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_encryption.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef MYSQL_SERVICE_ENCRYPTION_INCLUDED -/* Copyright (c) 2015, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - encryption service - - Functions to support data encryption and encryption key management. - They are normally implemented in an encryption plugin, so this service - connects encryption *consumers* (e.g. storage engines) to the encryption - *provider* (encryption plugin). -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MYSQL_ABI_CHECK -#ifdef _WIN32 -#include -#ifndef __cplusplus -#define inline __inline -#endif -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) -#include -#else -#include -#endif -#endif - -/* returned from encryption_key_get_latest_version() */ -#define ENCRYPTION_KEY_VERSION_INVALID (~(unsigned int)0) -#define ENCRYPTION_KEY_NOT_ENCRYPTED (0) - -#define ENCRYPTION_KEY_SYSTEM_DATA 1 -#define ENCRYPTION_KEY_TEMPORARY_DATA 2 - -/* returned from encryption_key_get() */ -#define ENCRYPTION_KEY_BUFFER_TOO_SMALL (100) - -#define ENCRYPTION_FLAG_DECRYPT 0 -#define ENCRYPTION_FLAG_ENCRYPT 1 -#define ENCRYPTION_FLAG_NOPAD 2 - -struct encryption_service_st { - unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id); - unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version, - unsigned char* buffer, unsigned int* length); - unsigned int (*encryption_ctx_size_func)(unsigned int key_id, unsigned int key_version); - int (*encryption_ctx_init_func)(void *ctx, const unsigned char* key, unsigned int klen, - const unsigned char* iv, unsigned int ivlen, - int flags, unsigned int key_id, - unsigned int key_version); - int (*encryption_ctx_update_func)(void *ctx, const unsigned char* src, unsigned int slen, - unsigned char* dst, unsigned int* dlen); - int (*encryption_ctx_finish_func)(void *ctx, unsigned char* dst, unsigned int* dlen); - unsigned int (*encryption_encrypted_length_func)(unsigned int slen, unsigned int key_id, unsigned int key_version); -}; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -extern struct encryption_service_st *encryption_service; - -#define encryption_key_get_latest_version(KI) encryption_service->encryption_key_get_latest_version_func(KI) -#define encryption_key_get(KI,KV,K,S) encryption_service->encryption_key_get_func((KI),(KV),(K),(S)) -#define encryption_ctx_size(KI,KV) encryption_service->encryption_ctx_size_func((KI),(KV)) -#define encryption_ctx_init(CTX,K,KL,IV,IVL,F,KI,KV) encryption_service->encryption_ctx_init_func((CTX),(K),(KL),(IV),(IVL),(F),(KI),(KV)) -#define encryption_ctx_update(CTX,S,SL,D,DL) encryption_service->encryption_ctx_update_func((CTX),(S),(SL),(D),(DL)) -#define encryption_ctx_finish(CTX,D,DL) encryption_service->encryption_ctx_finish_func((CTX),(D),(DL)) -#define encryption_encrypted_length(SL,KI,KV) encryption_service->encryption_encrypted_length_func((SL),(KI),(KV)) -#else - -extern struct encryption_service_st encryption_handler; - -#define encryption_key_get_latest_version(KI) encryption_handler.encryption_key_get_latest_version_func(KI) -#define encryption_key_get(KI,KV,K,S) encryption_handler.encryption_key_get_func((KI),(KV),(K),(S)) -#define encryption_ctx_size(KI,KV) encryption_handler.encryption_ctx_size_func((KI),(KV)) -#define encryption_ctx_init(CTX,K,KL,IV,IVL,F,KI,KV) encryption_handler.encryption_ctx_init_func((CTX),(K),(KL),(IV),(IVL),(F),(KI),(KV)) -#define encryption_ctx_update(CTX,S,SL,D,DL) encryption_handler.encryption_ctx_update_func((CTX),(S),(SL),(D),(DL)) -#define encryption_ctx_finish(CTX,D,DL) encryption_handler.encryption_ctx_finish_func((CTX),(D),(DL)) -#define encryption_encrypted_length(SL,KI,KV) encryption_handler.encryption_encrypted_length_func((SL),(KI),(KV)) -#endif - -static inline unsigned int encryption_key_id_exists(unsigned int id) -{ - return encryption_key_get_latest_version(id) != ENCRYPTION_KEY_VERSION_INVALID; -} - -static inline unsigned int encryption_key_version_exists(unsigned int id, unsigned int version) -{ - unsigned int unused; - return encryption_key_get(id, version, NULL, &unused) != ENCRYPTION_KEY_VERSION_INVALID; -} - -static inline int encryption_crypt(const unsigned char* src, unsigned int slen, - unsigned char* dst, unsigned int* dlen, - const unsigned char* key, unsigned int klen, - const unsigned char* iv, unsigned int ivlen, - int flags, unsigned int key_id, unsigned int key_version) -{ - void *ctx= alloca(encryption_ctx_size(key_id, key_version)); - int res1, res2; - unsigned int d1, d2; - if ((res1= encryption_ctx_init(ctx, key, klen, iv, ivlen, flags, key_id, key_version))) - return res1; - res1= encryption_ctx_update(ctx, src, slen, dst, &d1); - res2= encryption_ctx_finish(ctx, dst + d1, &d2); - *dlen= d1 + d2; - return res1 ? res1 : res2; -} - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_ENCRYPTION_INCLUDED -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_encryption_scheme.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_encryption_scheme.h deleted file mode 100644 index bcd4d64..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_encryption_scheme.h +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef MYSQL_SERVICE_ENCRYPTION_SCHEME_INCLUDED -/* Copyright (c) 2015, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - encryption scheme service - - A higher-level access to encryption service. - - This is a helper service that storage engines use to encrypt tables on disk. - It requests keys from the plugin, generates temporary or local keys - from the global (as returned by the plugin) keys, etc. - - To use the service: - - * st_encryption_scheme object is created per space. A "space" can be - a table space in XtraDB/InnoDB, a file in Aria, etc. The whole - space is encrypted with the one key id. - - * The service does not take the key and the IV as parameters for - encryption or decryption. Instead it takes two 32-bit integers and - one 64-bit integer (and requests the key from an encryption - plugin, if needed). - - * The service requests the global key from the encryption plugin - automatically as needed. Three last keys are cached in the - st_encryption_scheme. Number of key requests (number of cache - misses) are counted in st_encryption_scheme::keyserver_requests - - * If an st_encryption_scheme can be used concurrently by different - threads, it needs to be able to lock itself when accessing the key - cache. Set the st_encryption_scheme::locker appropriately. If - non-zero, it will be invoked by encrypt/decrypt functions to lock - and unlock the scheme when needed. - - * Implementation details (in particular, key derivation) are defined - by the scheme type. Currently only schema type 1 is supported. - - In the schema type 1, every "space" (table space in XtraDB/InnoDB, - file in Aria) is encrypted with a different space-local key: - - * Every space has a 16-byte unique identifier (typically it's - generated randomly and stored in the space). The caller should - put it into st_encryption_scheme::iv. - - * Space-local key is generated by encrypting this identifier with - the global encryption key (of the given id and version) using AES_ECB. - - * Encryption/decryption parameters for a page are typically the - 4-byte space id, 4-byte page position (offset, page number, etc), - and the 8-byte LSN. This guarantees that they'll be different for - any two pages (of the same or different tablespaces) and also that - they'll change for the same page when it's modified. They don't need - to be secret (they create the IV, not the encryption key). -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#define ENCRYPTION_SCHEME_KEY_INVALID -1 -#define ENCRYPTION_SCHEME_BLOCK_LENGTH 16 - -struct st_encryption_scheme_key { - unsigned int version; - unsigned char key[ENCRYPTION_SCHEME_BLOCK_LENGTH]; -}; - -struct st_encryption_scheme { - unsigned char iv[ENCRYPTION_SCHEME_BLOCK_LENGTH]; - struct st_encryption_scheme_key key[3]; - unsigned int keyserver_requests; - unsigned int key_id; - unsigned int type; - - void (*locker)(struct st_encryption_scheme *self, int release); -}; - -extern struct encryption_scheme_service_st { - int (*encryption_scheme_encrypt_func) - (const unsigned char* src, unsigned int slen, - unsigned char* dst, unsigned int* dlen, - struct st_encryption_scheme *scheme, - unsigned int key_version, unsigned int i32_1, - unsigned int i32_2, unsigned long long i64); - int (*encryption_scheme_decrypt_func) - (const unsigned char* src, unsigned int slen, - unsigned char* dst, unsigned int* dlen, - struct st_encryption_scheme *scheme, - unsigned int key_version, unsigned int i32_1, - unsigned int i32_2, unsigned long long i64); -} *encryption_scheme_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define encryption_scheme_encrypt(S,SL,D,DL,SCH,KV,I32,J32,I64) encryption_scheme_service->encryption_scheme_encrypt_func(S,SL,D,DL,SCH,KV,I32,J32,I64) -#define encryption_scheme_decrypt(S,SL,D,DL,SCH,KV,I32,J32,I64) encryption_scheme_service->encryption_scheme_decrypt_func(S,SL,D,DL,SCH,KV,I32,J32,I64) - -#else - -int encryption_scheme_encrypt(const unsigned char* src, unsigned int slen, - unsigned char* dst, unsigned int* dlen, - struct st_encryption_scheme *scheme, - unsigned int key_version, unsigned int i32_1, - unsigned int i32_2, unsigned long long i64); -int encryption_scheme_decrypt(const unsigned char* src, unsigned int slen, - unsigned char* dst, unsigned int* dlen, - struct st_encryption_scheme *scheme, - unsigned int key_version, unsigned int i32_1, - unsigned int i32_2, unsigned long long i64); - -#endif - - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_ENCRYPTION_SCHEME_INCLUDED -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_json.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_json.h deleted file mode 100644 index 141b762..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_json.h +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright (C) 2018 MariaDB Corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ - -#ifndef MYSQL_SERVICE_JSON -#define MYSQL_SERVICE_JSON - -/** - @file - json service - - Esports JSON parsing methods for plugins to use. - - Fuctions of the service: - js_type - returns the type of the JSON argument, - and the parsed value if it's scalar (not object or array) - - js_get_array_item - expecs JSON array as an argument, - and returns the n_item's item's type and value - Returns JSV_NOTHING type if the array is shorter - than n_item and the actual length of the array in v_len. - - js_get_object_key - expects JSON object as an argument, - searches for a key in the object, return it's type and value. - JSV_NOTHING if no such key found, the number of keys - in v_len. - - js_get_object_nkey - expects JSON object as an argument. - finds n_key's key in the object, returns it's name, type and value. - JSV_NOTHING if object has less keys than n_key. -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - -enum json_types -{ - JSV_BAD_JSON=-1, - JSV_NOTHING=0, - JSV_OBJECT=1, - JSV_ARRAY=2, - JSV_STRING=3, - JSV_NUMBER=4, - JSV_TRUE=5, - JSV_FALSE=6, - JSV_NULL=7 -}; - -extern struct json_service_st { - enum json_types (*json_type)(const char *js, const char *js_end, - const char **value, int *value_len); - enum json_types (*json_get_array_item)(const char *js, const char *js_end, - int n_item, - const char **value, int *value_len); - enum json_types (*json_get_object_key)(const char *js, const char *js_end, - const char *key, - const char **value, int *value_len); - enum json_types (*json_get_object_nkey)(const char *js,const char *js_end, - int nkey, - const char **keyname, const char **keyname_end, - const char **value, int *value_len); - int (*json_escape_string)(const char *str,const char *str_end, - char *json, char *json_end); - int (*json_unescape_json)(const char *json_str, const char *json_end, - char *res, char *res_end); -} *json_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define json_type json_service->json_type -#define json_get_array_item json_service->json_get_array_item -#define json_get_object_key json_service->json_get_object_key -#define json_get_object_nkey json_service->json_get_object_nkey -#define json_escape_string json_service->json_escape_string -#define json_unescape_json json_service->json_unescape_json - -#else - -enum json_types json_type(const char *js, const char *js_end, - const char **value, int *value_len); -enum json_types json_get_array_item(const char *js, const char *js_end, - int n_item, - const char **value, int *value_len); -enum json_types json_get_object_key(const char *js, const char *js_end, - const char *key, - const char **value, int *value_len); -enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey, - const char **keyname, const char **keyname_end, - const char **value, int *value_len); -int json_escape_string(const char *str,const char *str_end, - char *json, char *json_end); -int json_unescape_json(const char *json_str, const char *json_end, - char *res, char *res_end); - -#endif /*MYSQL_DYNAMIC_PLUGIN*/ - - -#ifdef __cplusplus -} -#endif - -#endif /*MYSQL_SERVICE_JSON */ - - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_kill_statement.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_kill_statement.h deleted file mode 100644 index 9f3415a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_kill_statement.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (c) 2013, 2018, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_SERVICE_KILL_STATEMENT_INCLUDED -#define MYSQL_SERVICE_KILL_STATEMENT_INCLUDED - -/** - @file - This service provides functions that allow plugins to support - the KILL statement. - - In MySQL support for the KILL statement is cooperative. The KILL - statement only sets a "killed" flag. This function returns the value - of that flag. A thread should check it often, especially inside - time-consuming loops, and gracefully abort the operation if it is - non-zero. - - thd_killed(thd) - @return 0 - no KILL statement was issued, continue normally - @return 1 - there was a KILL statement, abort the execution. - - thd_kill_level(thd) - @return thd_kill_levels_enum values -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -enum thd_kill_levels { - THD_IS_NOT_KILLED=0, - THD_ABORT_SOFTLY=50, /**< abort when possible, don't leave tables corrupted */ - THD_ABORT_ASAP=100, /**< abort asap */ -}; - -extern struct kill_statement_service_st { - enum thd_kill_levels (*thd_kill_level_func)(const MYSQL_THD); -} *thd_kill_statement_service; - -/* backward compatibility helper */ -#define thd_killed(THD) (thd_kill_level(THD) == THD_ABORT_ASAP) - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define thd_kill_level(THD) \ - thd_kill_statement_service->thd_kill_level_func(THD) - -#else - -enum thd_kill_levels thd_kill_level(const MYSQL_THD); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_logger.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_logger.h deleted file mode 100644 index 5979901..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_logger.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright (C) 2012 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_SERVICE_LOGGER_INCLUDED -#define MYSQL_SERVICE_LOGGER_INCLUDED - -#ifndef MYSQL_ABI_CHECK -#include -#endif - -/** - @file - logger service - - Log file with rotation implementation. - - This service implements logging with possible rotation - of the log files. Interface intentionally tries to be similar to FILE* - related functions. - - So that one can open the log with logger_open(), specifying - the limit on the logfile size and the rotations number. - - Then it's possible to write messages to the log with - logger_printf or logger_vprintf functions. - - As the size of the logfile grows over the specified limit, - it is renamed to 'logfile.1'. The former 'logfile.1' becomes - 'logfile.2', etc. The file 'logfile.rotations' is removed. - That's how the rotation works. - - The rotation can be forced with the logger_rotate() call. - - Finally the log should be closed with logger_close(). - -@notes: - Implementation checks the size of the log file before it starts new - printf into it. So the size of the file gets over the limit when it rotates. - - The access is secured with the mutex, so the log is threadsafe. -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct logger_handle_st LOGGER_HANDLE; - -extern struct logger_service_st { - void (*logger_init_mutexes)(); - LOGGER_HANDLE* (*open)(const char *path, - unsigned long long size_limit, - unsigned int rotations); - int (*close)(LOGGER_HANDLE *log); - int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr); - int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...); - int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size); - int (*rotate)(LOGGER_HANDLE *log); -} *logger_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define logger_init_mutexes logger_service->logger_init_mutexes -#define logger_open(path, size_limit, rotations) \ - (logger_service->open(path, size_limit, rotations)) -#define logger_close(log) (logger_service->close(log)) -#define logger_rotate(log) (logger_service->rotate(log)) -#define logger_vprintf(log, fmt, argptr) (logger_service->\ - vprintf(log, fmt, argptr)) -#define logger_printf (*logger_service->printf) -#define logger_write(log, buffer, size) \ - (logger_service->write(log, buffer, size)) -#else - - void logger_init_mutexes(); - LOGGER_HANDLE *logger_open(const char *path, - unsigned long long size_limit, - unsigned int rotations); - int logger_close(LOGGER_HANDLE *log); - int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr); - int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...); - int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size); - int logger_rotate(LOGGER_HANDLE *log); -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /*MYSQL_SERVICE_LOGGER_INCLUDED*/ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_md5.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_md5.h deleted file mode 100644 index 336cf70..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_md5.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef MYSQL_SERVICE_MD5_INCLUDED -/* Copyright (c) 2014, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - my md5 service - - Functions to calculate MD5 hash from a memory buffer -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MYSQL_ABI_CHECK -#include -#endif - -#define MY_MD5_HASH_SIZE 16 /* Hash size in bytes */ - -extern struct my_md5_service_st { - void (*my_md5_type)(unsigned char*, const char*, size_t); - void (*my_md5_multi_type)(unsigned char*, ...); - size_t (*my_md5_context_size_type)(); - void (*my_md5_init_type)(void *); - void (*my_md5_input_type)(void *, const unsigned char *, size_t); - void (*my_md5_result_type)(void *, unsigned char *); -} *my_md5_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define my_md5(A,B,C) my_md5_service->my_md5_type(A,B,C) -#define my_md5_multi my_md5_service->my_md5_multi_type -#define my_md5_context_size() my_md5_service->my_md5_context_size_type() -#define my_md5_init(A) my_md5_service->my_md5_init_type(A) -#define my_md5_input(A,B,C) my_md5_service->my_md5_input_type(A,B,C) -#define my_md5_result(A,B) my_md5_service->my_md5_result_type(A,B) - -#else - -void my_md5(unsigned char*, const char*, size_t); -void my_md5_multi(unsigned char*, ...); -size_t my_md5_context_size(); -void my_md5_init(void *context); -void my_md5_input(void *context, const unsigned char *buf, size_t len); -void my_md5_result(void *context, unsigned char *digest); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_MD5_INCLUDED -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_my_crypt.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_my_crypt.h deleted file mode 100644 index 930d12a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_my_crypt.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef MYSQL_SERVICE_MY_CRYPT_INCLUDED -#define MYSQL_SERVICE_MY_CRYPT_INCLUDED - -/* - Copyright (c) 2014 Google Inc. - Copyright (c) 2014, 2015 MariaDB Corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - my crypt service - - AES encryption functions, and a function to generate random bytes. - - Include my_config.h before this file to use CTR and GCM modes - (they only work if server was compiled with openssl). -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - -/* return values from my_aes_encrypt/my_aes_decrypt functions */ -#define MY_AES_OK 0 -#define MY_AES_BAD_DATA -100 -#define MY_AES_OPENSSL_ERROR -101 -#define MY_AES_BAD_KEYSIZE -102 - -/* The block size for all supported algorithms */ -#define MY_AES_BLOCK_SIZE 16 - -/* The max key length of all supported algorithms */ -#define MY_AES_MAX_KEY_LENGTH 32 - -#define MY_AES_CTX_SIZE 640 - -enum my_aes_mode { - MY_AES_ECB, MY_AES_CBC -#ifdef HAVE_EncryptAes128Ctr - , MY_AES_CTR -#endif -#ifdef HAVE_EncryptAes128Gcm - , MY_AES_GCM -#endif -}; - -extern struct my_crypt_service_st { - int (*my_aes_crypt_init)(void *ctx, enum my_aes_mode mode, int flags, - const unsigned char* key, unsigned int klen, - const unsigned char* iv, unsigned int ivlen); - int (*my_aes_crypt_update)(void *ctx, const unsigned char *src, unsigned int slen, - unsigned char *dst, unsigned int *dlen); - int (*my_aes_crypt_finish)(void *ctx, unsigned char *dst, unsigned int *dlen); - int (*my_aes_crypt)(enum my_aes_mode mode, int flags, - const unsigned char *src, unsigned int slen, unsigned char *dst, unsigned int *dlen, - const unsigned char *key, unsigned int klen, const unsigned char *iv, unsigned int ivlen); - unsigned int (*my_aes_get_size)(enum my_aes_mode mode, unsigned int source_length); - unsigned int (*my_aes_ctx_size)(enum my_aes_mode mode); - int (*my_random_bytes)(unsigned char* buf, int num); -} *my_crypt_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define my_aes_crypt_init(A,B,C,D,E,F,G) \ - my_crypt_service->my_aes_crypt_init(A,B,C,D,E,F,G) - -#define my_aes_crypt_update(A,B,C,D,E) \ - my_crypt_service->my_aes_crypt_update(A,B,C,D,E) - -#define my_aes_crypt_finish(A,B,C) \ - my_crypt_service->my_aes_crypt_finish(A,B,C) - -#define my_aes_crypt(A,B,C,D,E,F,G,H,I,J) \ - my_crypt_service->my_aes_crypt(A,B,C,D,E,F,G,H,I,J) - -#define my_aes_get_size(A,B)\ - my_crypt_service->my_aes_get_size(A,B) - -#define my_aes_ctx_size(A)\ - my_crypt_service->my_aes_ctx_size(A) - -#define my_random_bytes(A,B)\ - my_crypt_service->my_random_bytes(A,B) - -#else - -int my_aes_crypt_init(void *ctx, enum my_aes_mode mode, int flags, - const unsigned char* key, unsigned int klen, - const unsigned char* iv, unsigned int ivlen); -int my_aes_crypt_update(void *ctx, const unsigned char *src, unsigned int slen, - unsigned char *dst, unsigned int *dlen); -int my_aes_crypt_finish(void *ctx, unsigned char *dst, unsigned int *dlen); -int my_aes_crypt(enum my_aes_mode mode, int flags, - const unsigned char *src, unsigned int slen, unsigned char *dst, unsigned int *dlen, - const unsigned char *key, unsigned int klen, const unsigned char *iv, unsigned int ivlen); - -int my_random_bytes(unsigned char* buf, int num); -unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length); -unsigned int my_aes_ctx_size(enum my_aes_mode mode); -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /* MYSQL_SERVICE_MY_CRYPT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_my_print_error.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_my_print_error.h deleted file mode 100644 index 74ba6a2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_my_print_error.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (c) 2016, MariaDB - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_SERVICE_MY_PRINT_ERROR_INCLUDED -#define MYSQL_SERVICE_MY_PRINT_ERROR_INCLUDED - -/** - @file include/mysql/service_my_print_error.h - - This service provides functions for plugins to report - errors to client (without client, the errors are written to the error log). - -*/ -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MYSQL_ABI_CHECK -#include -#include -#endif - -#define ME_ERROR_LOG 64 /* Write the message to the error log */ -#define ME_ERROR_LOG_ONLY 128 /* Write the error message to error log only */ -#define ME_NOTE 1024 /* Not an error, just a note */ -#define ME_WARNING 2048 /* Not an error, just a warning */ -#define ME_FATAL 4096 /* Fatal statement error */ - -extern struct my_print_error_service_st { - void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...); - void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...); - void (*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap); -} *my_print_error_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define my_error my_print_error_service->my_error_func -#define my_printf_error my_print_error_service->my_printf_error_func -#define my_printv_error(A,B,C,D) my_print_error_service->my_printv_error_func(A,B,C,D) - -#else -extern void my_error(unsigned int nr, unsigned long MyFlags, ...); -extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...); -extern void my_printv_error(unsigned int error, const char *format, unsigned long MyFlags,va_list ap); -#endif /* MYSQL_DYNAMIC_PLUGIN */ - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_my_snprintf.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_my_snprintf.h deleted file mode 100644 index 6757a65..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_my_snprintf.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef MYSQL_SERVICE_MY_SNPRINTF_INCLUDED -/* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - my_snprintf service - - Portable and limited vsnprintf() implementation. - - This is a portable, limited vsnprintf() implementation, with some - extra features. "Portable" means that it'll produce identical result - on all platforms (for example, on Windows and Linux system printf %e - formats the exponent differently, on different systems %p either - prints leading 0x or not, %s may accept null pointer or crash on - it). "Limited" means that it does not support all the C89 features. - But it supports few extensions, not in any standard. - - my_vsnprintf(to, n, fmt, ap) - - @param[out] to A buffer to store the result in - @param[in] n Store up to n-1 characters, followed by an end 0 - @param[in] fmt printf-like format string - @param[in] ap Arguments - - @return a number of bytes written to a buffer *excluding* terminating '\0' - - @post - The syntax of a format string is generally the same: - % - where everithing but the format is optional. - - Three one-character flags are recognized: - '0' has the standard zero-padding semantics; - '-' is parsed, but silently ignored; - '`' (backtick) is only supported for strings (%s) and means that the - string will be quoted according to MySQL identifier quoting rules. - - Both and can be specified as numbers or '*'. - If an asterisk is used, an argument of type int is consumed. - - can be 'l', 'll', or 'z'. - - Supported formats are 's' (null pointer is accepted, printed as - "(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o', - 'X', 'p' (works as 0x%x), 'f', 'g', 'M' (extension, see below), - 'T' (extension, see below). - - Standard syntax for positional arguments $n is supported. - - Extensions: - - Flag '`' (backtick): see above. - - Format 'b': binary buffer, prints exactly bytes from the - argument, without stopping at '\0'. - - Format 'M': takes one integer, prints this integer, space, double quote - error message, double quote. In other words - printf("%M", n) === printf("%d \"%s\"", n, strerror(n)) - - Format 'T': takes string and print it like s but if the strints should be - truncated puts "..." at the end. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MYSQL_ABI_CHECK -#include -#include -#endif - -extern struct my_snprintf_service_st { - size_t (*my_snprintf_type)(char*, size_t, const char*, ...); - size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list); -} *my_snprintf_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define my_vsnprintf my_snprintf_service->my_vsnprintf_type -#define my_snprintf my_snprintf_service->my_snprintf_type - -#else - -size_t my_snprintf(char* to, size_t n, const char* fmt, ...); -size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_progress_report.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_progress_report.h deleted file mode 100644 index 11fc24d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_progress_report.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef MYSQL_SERVICE_PROGRESS_REPORT_INCLUDED -/* Copyright (C) 2011 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - This service allows plugins to report progress of long running operations - to the server. The progress report is visible in SHOW PROCESSLIST, - INFORMATION_SCHEMA.PROCESSLIST, and is sent to the client - if requested. - - The functions are documented at - https://mariadb.com/kb/en/progress-reporting/#how-to-add-support-for-progress-reporting-to-a-storage-engine -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#define thd_proc_info(thd, msg) set_thd_proc_info(thd, msg, \ - __func__, __FILE__, __LINE__) - -extern struct progress_report_service_st { - void (*thd_progress_init_func)(MYSQL_THD thd, unsigned int max_stage); - void (*thd_progress_report_func)(MYSQL_THD thd, - unsigned long long progress, - unsigned long long max_progress); - void (*thd_progress_next_stage_func)(MYSQL_THD thd); - void (*thd_progress_end_func)(MYSQL_THD thd); - const char *(*set_thd_proc_info_func)(MYSQL_THD, const char *info, - const char *func, - const char *file, - unsigned int line); -} *progress_report_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define thd_progress_init(thd,max_stage) (progress_report_service->thd_progress_init_func((thd),(max_stage))) -#define thd_progress_report(thd, progress, max_progress) (progress_report_service->thd_progress_report_func((thd), (progress), (max_progress))) -#define thd_progress_next_stage(thd) (progress_report_service->thd_progress_next_stage_func(thd)) -#define thd_progress_end(thd) (progress_report_service->thd_progress_end_func(thd)) -#define set_thd_proc_info(thd,info,func,file,line) (progress_report_service->set_thd_proc_info_func((thd),(info),(func),(file),(line))) - -#else - -/** - Report progress for long running operations - - @param thd User thread connection handle - @param progress Where we are now - @param max_progress Progress will continue up to this -*/ -void thd_progress_init(MYSQL_THD thd, unsigned int max_stage); -void thd_progress_report(MYSQL_THD thd, - unsigned long long progress, - unsigned long long max_progress); -void thd_progress_next_stage(MYSQL_THD thd); -void thd_progress_end(MYSQL_THD thd); -const char *set_thd_proc_info(MYSQL_THD, const char * info, const char *func, - const char *file, unsigned int line); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_PROGRESS_REPORT_INCLUDED -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_sha1.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_sha1.h deleted file mode 100644 index d864e23..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_sha1.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef MYSQL_SERVICE_SHA1_INCLUDED -/* Copyright (c) 2013, 2014, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - my sha1 service - - Functions to calculate SHA1 hash from a memory buffer -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MYSQL_ABI_CHECK -#include -#endif - -#define MY_SHA1_HASH_SIZE 20 /* Hash size in bytes */ - -extern struct my_sha1_service_st { - void (*my_sha1_type)(unsigned char*, const char*, size_t); - void (*my_sha1_multi_type)(unsigned char*, ...); - size_t (*my_sha1_context_size_type)(); - void (*my_sha1_init_type)(void *); - void (*my_sha1_input_type)(void *, const unsigned char *, size_t); - void (*my_sha1_result_type)(void *, unsigned char *); -} *my_sha1_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define my_sha1(A,B,C) my_sha1_service->my_sha1_type(A,B,C) -#define my_sha1_multi my_sha1_service->my_sha1_multi_type -#define my_sha1_context_size() my_sha1_service->my_sha1_context_size_type() -#define my_sha1_init(A) my_sha1_service->my_sha1_init_type(A) -#define my_sha1_input(A,B,C) my_sha1_service->my_sha1_input_type(A,B,C) -#define my_sha1_result(A,B) my_sha1_service->my_sha1_result_type(A,B) - -#else - -void my_sha1(unsigned char*, const char*, size_t); -void my_sha1_multi(unsigned char*, ...); -size_t my_sha1_context_size(); -void my_sha1_init(void *context); -void my_sha1_input(void *context, const unsigned char *buf, size_t len); -void my_sha1_result(void *context, unsigned char *digest); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_SHA1_INCLUDED -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_sha2.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_sha2.h deleted file mode 100644 index 00834a9..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_sha2.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef MYSQL_SERVICE_SHA2_INCLUDED -/* Copyright (c) 2017, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - my sha2 service - - Functions to calculate SHA2 hash from a memory buffer -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MYSQL_ABI_CHECK -#include -#endif - -extern struct my_sha2_service_st { - void (*my_sha224_type)(unsigned char*, const char*, size_t); - void (*my_sha224_multi_type)(unsigned char*, ...); - size_t (*my_sha224_context_size_type)(); - void (*my_sha224_init_type)(void *); - void (*my_sha224_input_type)(void *, const unsigned char *, size_t); - void (*my_sha224_result_type)(void *, unsigned char *); - - void (*my_sha256_type)(unsigned char*, const char*, size_t); - void (*my_sha256_multi_type)(unsigned char*, ...); - size_t (*my_sha256_context_size_type)(); - void (*my_sha256_init_type)(void *); - void (*my_sha256_input_type)(void *, const unsigned char *, size_t); - void (*my_sha256_result_type)(void *, unsigned char *); - - void (*my_sha384_type)(unsigned char*, const char*, size_t); - void (*my_sha384_multi_type)(unsigned char*, ...); - size_t (*my_sha384_context_size_type)(); - void (*my_sha384_init_type)(void *); - void (*my_sha384_input_type)(void *, const unsigned char *, size_t); - void (*my_sha384_result_type)(void *, unsigned char *); - - void (*my_sha512_type)(unsigned char*, const char*, size_t); - void (*my_sha512_multi_type)(unsigned char*, ...); - size_t (*my_sha512_context_size_type)(); - void (*my_sha512_init_type)(void *); - void (*my_sha512_input_type)(void *, const unsigned char *, size_t); - void (*my_sha512_result_type)(void *, unsigned char *); -} *my_sha2_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define my_sha224(A,B,C) my_sha2_service->my_sha224_type(A,B,C) -#define my_sha224_multi my_sha2_service->my_sha224_multi_type -#define my_sha224_context_size() my_sha2_service->my_sha224_context_size_type() -#define my_sha224_init(A) my_sha2_service->my_sha224_init_type(A) -#define my_sha224_input(A,B,C) my_sha2_service->my_sha224_input_type(A,B,C) -#define my_sha224_result(A,B) my_sha2_service->my_sha224_result_type(A,B) - -#define my_sha256(A,B,C) my_sha2_service->my_sha256_type(A,B,C) -#define my_sha256_multi my_sha2_service->my_sha256_multi_type -#define my_sha256_context_size() my_sha2_service->my_sha256_context_size_type() -#define my_sha256_init(A) my_sha2_service->my_sha256_init_type(A) -#define my_sha256_input(A,B,C) my_sha2_service->my_sha256_input_type(A,B,C) -#define my_sha256_result(A,B) my_sha2_service->my_sha256_result_type(A,B) - -#define my_sha384(A,B,C) my_sha2_service->my_sha384_type(A,B,C) -#define my_sha384_multi my_sha2_service->my_sha384_multi_type -#define my_sha384_context_size() my_sha2_service->my_sha384_context_size_type() -#define my_sha384_init(A) my_sha2_service->my_sha384_init_type(A) -#define my_sha384_input(A,B,C) my_sha2_service->my_sha384_input_type(A,B,C) -#define my_sha384_result(A,B) my_sha2_service->my_sha384_result_type(A,B) - -#define my_sha512(A,B,C) my_sha2_service->my_sha512_type(A,B,C) -#define my_sha512_multi my_sha2_service->my_sha512_multi_type -#define my_sha512_context_size() my_sha2_service->my_sha512_context_size_type() -#define my_sha512_init(A) my_sha2_service->my_sha512_init_type(A) -#define my_sha512_input(A,B,C) my_sha2_service->my_sha512_input_type(A,B,C) -#define my_sha512_result(A,B) my_sha2_service->my_sha512_result_type(A,B) - -#else - -void my_sha224(unsigned char*, const char*, size_t); -void my_sha224_multi(unsigned char*, ...); -size_t my_sha224_context_size(); -void my_sha224_init(void *context); -void my_sha224_input(void *context, const unsigned char *buf, size_t len); -void my_sha224_result(void *context, unsigned char *digest); - -void my_sha256(unsigned char*, const char*, size_t); -void my_sha256_multi(unsigned char*, ...); -size_t my_sha256_context_size(); -void my_sha256_init(void *context); -void my_sha256_input(void *context, const unsigned char *buf, size_t len); -void my_sha256_result(void *context, unsigned char *digest); - -void my_sha384(unsigned char*, const char*, size_t); -void my_sha384_multi(unsigned char*, ...); -size_t my_sha384_context_size(); -void my_sha384_init(void *context); -void my_sha384_input(void *context, const unsigned char *buf, size_t len); -void my_sha384_result(void *context, unsigned char *digest); - -void my_sha512(unsigned char*, const char*, size_t); -void my_sha512_multi(unsigned char*, ...); -size_t my_sha512_context_size(); -void my_sha512_init(void *context); -void my_sha512_input(void *context, const unsigned char *buf, size_t len); -void my_sha512_result(void *context, unsigned char *digest); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_SHA2_INCLUDED -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_alloc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_alloc.h deleted file mode 100644 index 0be4687..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_alloc.h +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef MYSQL_SERVICE_THD_ALLOC_INCLUDED -/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - This service provides functions to allocate memory in a connection local - memory pool. The memory allocated there will be automatically freed at the - end of the statement, don't use it for allocations that should live longer - than that. For short living allocations this is more efficient than - using my_malloc and friends, and automatic "garbage collection" allows not - to think about memory leaks. - - The pool is best for small to medium objects, don't use it for large - allocations - they are better served with my_malloc. -*/ - -#ifndef MYSQL_ABI_CHECK -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -struct st_mysql_lex_string -{ - char *str; - size_t length; -}; -typedef struct st_mysql_lex_string MYSQL_LEX_STRING; - -struct st_mysql_const_lex_string -{ - const char *str; - size_t length; -}; -typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING; - -extern struct thd_alloc_service_st { - void *(*thd_alloc_func)(MYSQL_THD, size_t); - void *(*thd_calloc_func)(MYSQL_THD, size_t); - char *(*thd_strdup_func)(MYSQL_THD, const char *); - char *(*thd_strmake_func)(MYSQL_THD, const char *, size_t); - void *(*thd_memdup_func)(MYSQL_THD, const void*, size_t); - MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD, - MYSQL_CONST_LEX_STRING *, - const char *, size_t, int); -} *thd_alloc_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define thd_alloc(thd,size) (thd_alloc_service->thd_alloc_func((thd), (size))) - -#define thd_calloc(thd,size) (thd_alloc_service->thd_calloc_func((thd), (size))) - -#define thd_strdup(thd,str) (thd_alloc_service->thd_strdup_func((thd), (str))) - -#define thd_strmake(thd,str,size) \ - (thd_alloc_service->thd_strmake_func((thd), (str), (size))) - -#define thd_memdup(thd,str,size) \ - (thd_alloc_service->thd_memdup_func((thd), (str), (size))) - -#define thd_make_lex_string(thd, lex_str, str, size, allocate_lex_string) \ - (thd_alloc_service->thd_make_lex_string_func((thd), (lex_str), (str), \ - (size), (allocate_lex_string))) - -#else - -/** - Allocate memory in the connection's local memory pool - - @details - When properly used in place of @c my_malloc(), this can significantly - improve concurrency. Don't use this or related functions to allocate - large chunks of memory. Use for temporary storage only. The memory - will be freed automatically at the end of the statement; no explicit - code is required to prevent memory leaks. - - @see alloc_root() -*/ -void *thd_alloc(MYSQL_THD thd, size_t size); -/** - @see thd_alloc() -*/ -void *thd_calloc(MYSQL_THD thd, size_t size); -/** - @see thd_alloc() -*/ -char *thd_strdup(MYSQL_THD thd, const char *str); -/** - @see thd_alloc() -*/ -char *thd_strmake(MYSQL_THD thd, const char *str, size_t size); -/** - @see thd_alloc() -*/ -void *thd_memdup(MYSQL_THD thd, const void* str, size_t size); - -/** - Create a LEX_STRING in this connection's local memory pool - - @param thd user thread connection handle - @param lex_str pointer to LEX_STRING object to be initialized - @param str initializer to be copied into lex_str - @param size length of str, in bytes - @param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object, - instead of using lex_str value - @return NULL on failure, or pointer to the LEX_STRING object - - @see thd_alloc() -*/ -MYSQL_CONST_LEX_STRING -*thd_make_lex_string(MYSQL_THD thd, MYSQL_CONST_LEX_STRING *lex_str, - const char *str, size_t size, - int allocate_lex_string); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_THD_ALLOC_INCLUDED -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_autoinc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_autoinc.h deleted file mode 100644 index 28bd2bb..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_autoinc.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef MYSQL_SERVICE_THD_AUTOINC_INCLUDED -/* Copyright (C) 2013 MariaDB Foundation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - This service provides access to the auto_increment related system variables: - - @@auto_increment_offset - @@auto_increment_increment -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -extern struct thd_autoinc_service_st { - void (*thd_get_autoinc_func)(const MYSQL_THD thd, - unsigned long* off, unsigned long* inc); -} *thd_autoinc_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN -#define thd_get_autoinc(thd, off, inc) \ - (thd_autoinc_service->thd_get_autoinc_func((thd), (off), (inc))) -#else -/** - Return autoincrement system variables - @param IN thd user thread connection handle - @param OUT off the value of @@SESSION.auto_increment_offset - @param OUT inc the value of @@SESSION.auto_increment_increment -*/ -void thd_get_autoinc(const MYSQL_THD thd, - unsigned long* off, unsigned long* inc); -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_THD_AUTOINC_INCLUDED -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_error_context.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_error_context.h deleted file mode 100644 index 0b9082d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_error_context.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef MYSQL_SERVICE_THD_STMT_DA_INCLUDED -/* Copyright (C) 2013 MariaDB Foundation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - This service provides access to the statement diagnostics area: - - error message - - error number - - row for warning (e.g. for multi-row INSERT statements) -*/ - -#ifdef __cplusplus -extern "C" { -#endif - - -extern struct thd_error_context_service_st { - const char *(*thd_get_error_message_func)(const MYSQL_THD thd); - unsigned int (*thd_get_error_number_func)(const MYSQL_THD thd); - unsigned long (*thd_get_error_row_func)(const MYSQL_THD thd); - void (*thd_inc_error_row_func)(MYSQL_THD thd); - char *(*thd_get_error_context_description_func)(MYSQL_THD thd, - char *buffer, - unsigned int length, - unsigned int max_query_length); -} *thd_error_context_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN -#define thd_get_error_message(thd) \ - (thd_error_context_service->thd_get_error_message_func((thd))) -#define thd_get_error_number(thd) \ - (thd_error_context_service->thd_get_error_number_func((thd))) -#define thd_get_error_row(thd) \ - (thd_error_context_service->thd_get_error_row_func((thd))) -#define thd_inc_error_row(thd) \ - (thd_error_context_service->thd_inc_error_row_func((thd))) -#define thd_get_error_context_description(thd, buffer, length, max_query_len) \ - (thd_error_context_service->thd_get_error_context_description_func((thd), \ - (buffer), \ - (length), \ - (max_query_len))) -#else -/** - Return error message - @param thd user thread connection handle - @return error text -*/ -const char *thd_get_error_message(const MYSQL_THD thd); -/** - Return error number - @param thd user thread connection handle - @return error number -*/ -unsigned int thd_get_error_number(const MYSQL_THD thd); -/** - Return the current row number (i.e. in a multiple INSERT statement) - @param thd user thread connection handle - @return row number -*/ -unsigned long thd_get_error_row(const MYSQL_THD thd); -/** - Increment the current row number - @param thd user thread connection handle -*/ -void thd_inc_error_row(MYSQL_THD thd); -/** - Return a text description of a thread, its security context (user,host) - and the current query. -*/ -char *thd_get_error_context_description(MYSQL_THD thd, - char *buffer, unsigned int length, - unsigned int max_query_length); -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_THD_STMT_DA_INCLUDED -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_mdl.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_mdl.h deleted file mode 100644 index 19b0476..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_mdl.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (c) 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#pragma once - -/** - @file include/mysql/service_thd_mdl.h - This service provides functions for plugins and storage engines to access - metadata locks. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - - -extern struct thd_mdl_service_st { - void *(*thd_mdl_context)(MYSQL_THD); -} *thd_mdl_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN -# define thd_mdl_context(_THD) thd_mdl_service->thd_mdl_context(_THD) -#else -/** - MDL_context accessor - @param thd the current session - @return pointer to thd->mdl_context -*/ -void *thd_mdl_context(MYSQL_THD thd); -#endif - -#ifdef __cplusplus -} -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_rnd.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_rnd.h deleted file mode 100644 index 8761077..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_rnd.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef MYSQL_SERVICE_THD_RND_INCLUDED -/* Copyright (C) 2017 MariaDB Corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - This service provides access to the thd-local random number generator. - - It's preferable over the global one, because concurrent threads - can generate random numbers without fighting each other over the access - to the shared rnd state. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MYSQL_ABI_CHECK -#include -#endif - -extern struct thd_rnd_service_st { - double (*thd_rnd_ptr)(MYSQL_THD thd); - void (*thd_c_r_p_ptr)(MYSQL_THD thd, char *to, size_t length); -} *thd_rnd_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN -#define thd_rnd(A) thd_rnd_service->thd_rnd_ptr(A) -#define thd_create_random_password(A,B,C) thd_rnd_service->thd_c_r_p_ptr(A,B,C) -#else - -double thd_rnd(MYSQL_THD thd); - -/** - Generate string of printable random characters of requested length. - - @param to[out] Buffer for generation; must be at least length+1 bytes - long; result string is always null-terminated - @param length[in] How many random characters to put in buffer -*/ -void thd_create_random_password(MYSQL_THD thd, char *to, size_t length); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_THD_RND_INCLUDED -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_specifics.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_specifics.h deleted file mode 100644 index a4078bd..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_specifics.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef MYSQL_SERVICE_THD_SPECIFICS_INCLUDED -/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - THD specific for plugin(s) - - This API provides pthread_getspecific like functionality to plugin authors. - This is a functional alternative to the declarative MYSQL_THDVAR - - A plugin should at init call thd_key_create that create a key that - will have storage in each THD. The key should be used by all threads - and can be used concurrently from all threads. - - A plugin should at deinit call thd_key_delete. - - Alternatively, a plugin can use thd_key_create_from_var(K,V) to create - a key that corresponds to a named MYSQL_THDVAR variable. - - This API is also safe when using pool-of-threads in which case - pthread_getspecific is not, because the actual OS thread may change. - - @note - - Normally one should prefer MYSQL_THDVAR declarative API. - - The benefits are: - - - It supports typed variables (int, char*, enum, etc), not only void*. - - The memory allocated for MYSQL_THDVAR is free'd automatically - (if PLUGIN_VAR_MEMALLOC is specified). - - Continuous loading and unloading of the same plugin does not allocate - memory for same variables over and over again. - - An example of using MYSQL_THDVAR for a thd local storage: - - MYSQL_THDVAR_STR(my_tls, - PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT, - "thd local storage example", 0, 0, 0); -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef int MYSQL_THD_KEY_T; - -extern struct thd_specifics_service_st { - int (*thd_key_create_func)(MYSQL_THD_KEY_T *key); - void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key); - void *(*thd_getspecific_func)(MYSQL_THD thd, MYSQL_THD_KEY_T key); - int (*thd_setspecific_func)(MYSQL_THD thd, MYSQL_THD_KEY_T key, void *value); -} *thd_specifics_service; - -#define thd_key_create_from_var(K, V) do { *(K)= MYSQL_SYSVAR_NAME(V).offset; } while(0) - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define thd_key_create(K) (thd_specifics_service->thd_key_create_func(K)) -#define thd_key_delete(K) (thd_specifics_service->thd_key_delete_func(K)) -#define thd_getspecific(T, K) (thd_specifics_service->thd_getspecific_func(T, K)) -#define thd_setspecific(T, K, V) (thd_specifics_service->thd_setspecific_func(T, K, V)) - -#else - -/** - * create THD specific storage - * @return 0 on success - * else errno is returned - */ -int thd_key_create(MYSQL_THD_KEY_T *key); - -/** - * delete THD specific storage - */ -void thd_key_delete(MYSQL_THD_KEY_T *key); - -/** - * get/set thd specific storage - * - first time this is called from a thread it will return 0 - * - this call is thread-safe in that different threads may call this - * simultaneously if operating on different THDs. - * - this call acquires no mutexes and is implemented as an array lookup - */ -void* thd_getspecific(MYSQL_THD thd, MYSQL_THD_KEY_T key); -int thd_setspecific(MYSQL_THD thd, MYSQL_THD_KEY_T key, void *value); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_THD_SPECIFICS_INCLUDED -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_timezone.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_timezone.h deleted file mode 100644 index 89e7527..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_timezone.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef MYSQL_SERVICE_THD_TIMEZONE_INCLUDED -/* Copyright (C) 2013 MariaDB Foundation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - This service provdes functions to convert between my_time_t and - MYSQL_TIME taking into account the current value of the time_zone - session variable. - - The values of the my_time_t type are in Unix timestamp format, - i.e. the number of seconds since "1970-01-01 00:00:00 UTC". - - The values of the MYSQL_TIME type are in the current time zone, - according to thd->variables.time_zone. - - If the MYSQL_THD parameter is NULL, then global_system_variables.time_zone - is used for conversion. -*/ - -#ifndef MYSQL_ABI_CHECK -/* - This service currently does not depend on any system headers. - If it needs system headers in the future, make sure to put - them inside this ifndef. -*/ -#endif - -#include "mysql_time.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -extern struct thd_timezone_service_st { - my_time_t (*thd_TIME_to_gmt_sec)(MYSQL_THD thd, const MYSQL_TIME *ltime, unsigned int *errcode); - void (*thd_gmt_sec_to_TIME)(MYSQL_THD thd, MYSQL_TIME *ltime, my_time_t t); -} *thd_timezone_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define thd_TIME_to_gmt_sec(thd, ltime, errcode) \ - (thd_timezone_service->thd_TIME_to_gmt_sec((thd), (ltime), (errcode))) - -#define thd_gmt_sec_to_TIME(thd, ltime, t) \ - (thd_timezone_service->thd_gmt_sec_to_TIME((thd), (ltime), (t))) - -#else - -my_time_t thd_TIME_to_gmt_sec(MYSQL_THD thd, const MYSQL_TIME *ltime, unsigned int *errcode); -void thd_gmt_sec_to_TIME(MYSQL_THD thd, MYSQL_TIME *ltime, my_time_t t); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_THD_TIMEZONE_INCLUDED -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_wait.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_wait.h deleted file mode 100644 index c20878f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_thd_wait.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_SERVICE_THD_WAIT_INCLUDED -#define MYSQL_SERVICE_THD_WAIT_INCLUDED - -/** - @file include/mysql/service_thd_wait.h - This service provides functions for plugins and storage engines to report - when they are going to sleep/stall. - - SYNOPSIS - thd_wait_begin() - call just before a wait begins - thd Thread object - Use NULL if the thd is NOT known. - wait_type Type of wait - 1 -- short wait (e.g. for mutex) - 2 -- medium wait (e.g. for disk io) - 3 -- large wait (e.g. for locked row/table) - NOTES - This is used by the threadpool to have better knowledge of which - threads that currently are actively running on CPUs. When a thread - reports that it's going to sleep/stall, the threadpool scheduler is - free to start another thread in the pool most likely. The expected wait - time is simply an indication of how long the wait is expected to - become, the real wait time could be very different. - - thd_wait_end() called immediately after the wait is complete - - thd_wait_end() MUST be called if thd_wait_begin() was called. - - Using thd_wait_...() service is optional but recommended. Using it will - improve performance as the thread pool will be more active at managing the - thread workload. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - One should only report wait events that could potentially block for a - long time. A mutex wait is too short of an event to report. The reason - is that an event which is reported leads to a new thread starts - executing a query and this has a negative impact of usage of CPU caches - and thus the expected gain of starting a new thread must be higher than - the expected cost of lost performance due to starting a new thread. - - Good examples of events that should be reported are waiting for row locks - that could easily be for many milliseconds or even seconds and the same - holds true for global read locks, table locks and other meta data locks. - Another event of interest is going to sleep for an extended time. -*/ -typedef enum _thd_wait_type_e { - THD_WAIT_SLEEP= 1, - THD_WAIT_DISKIO= 2, - THD_WAIT_ROW_LOCK= 3, - THD_WAIT_GLOBAL_LOCK= 4, - THD_WAIT_META_DATA_LOCK= 5, - THD_WAIT_TABLE_LOCK= 6, - THD_WAIT_USER_LOCK= 7, - THD_WAIT_BINLOG= 8, - THD_WAIT_GROUP_COMMIT= 9, - THD_WAIT_SYNC= 10, - THD_WAIT_NET= 11, - THD_WAIT_LAST= 12 -} thd_wait_type; - -extern struct thd_wait_service_st { - void (*thd_wait_begin_func)(MYSQL_THD, int); - void (*thd_wait_end_func)(MYSQL_THD); -} *thd_wait_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define thd_wait_begin(_THD, _WAIT_TYPE) \ - thd_wait_service->thd_wait_begin_func(_THD, _WAIT_TYPE) -#define thd_wait_end(_THD) thd_wait_service->thd_wait_end_func(_THD) - -#else - -void thd_wait_begin(MYSQL_THD thd, int wait_type); -void thd_wait_end(MYSQL_THD thd); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_wsrep.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_wsrep.h deleted file mode 100644 index f16331f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/service_wsrep.h +++ /dev/null @@ -1,238 +0,0 @@ -#ifndef MYSQL_SERVICE_WSREP_INCLUDED -#define MYSQL_SERVICE_WSREP_INCLUDED - -enum Wsrep_service_key_type -{ - WSREP_SERVICE_KEY_SHARED, - WSREP_SERVICE_KEY_REFERENCE, - WSREP_SERVICE_KEY_UPDATE, - WSREP_SERVICE_KEY_EXCLUSIVE -}; - -#if (defined (MYSQL_DYNAMIC_PLUGIN) && defined(MYSQL_SERVICE_WSREP_DYNAMIC_INCLUDED)) || (!defined(MYSQL_DYNAMIC_PLUGIN) && defined(MYSQL_SERVICE_WSREP_STATIC_INCLUDED)) - -#else - -/* Copyright (c) 2015, 2020, MariaDB Corporation Ab - 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - wsrep service - - Interface to WSREP functionality in the server. - For engines that want to support galera. -*/ -#include -#ifdef __cplusplus -#endif - -struct xid_t; -struct wsrep_ws_handle; -struct wsrep_buf; - -/* Must match to definition in sql/mysqld.h */ -typedef int64 query_id_t; - - -extern struct wsrep_service_st { - my_bool (*get_wsrep_recovery_func)(); - bool (*wsrep_consistency_check_func)(MYSQL_THD thd); - int (*wsrep_is_wsrep_xid_func)(const void *xid); - long long (*wsrep_xid_seqno_func)(const struct xid_t *xid); - const unsigned char* (*wsrep_xid_uuid_func)(const struct xid_t *xid); - my_bool (*wsrep_on_func)(const MYSQL_THD thd); - bool (*wsrep_prepare_key_for_innodb_func)(MYSQL_THD thd, const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*); - void (*wsrep_thd_LOCK_func)(const MYSQL_THD thd); - void (*wsrep_thd_UNLOCK_func)(const MYSQL_THD thd); - const char * (*wsrep_thd_query_func)(const MYSQL_THD thd); - int (*wsrep_thd_retry_counter_func)(const MYSQL_THD thd); - bool (*wsrep_thd_ignore_table_func)(MYSQL_THD thd); - long long (*wsrep_thd_trx_seqno_func)(const MYSQL_THD thd); - void (*wsrep_thd_auto_increment_variables_func)(THD *thd, unsigned long long *offset, unsigned long long *increment); - my_bool (*wsrep_thd_is_aborting_func)(const MYSQL_THD thd); - void (*wsrep_set_data_home_dir_func)(const char *data_dir); - my_bool (*wsrep_thd_is_BF_func)(const MYSQL_THD thd, my_bool sync); - my_bool (*wsrep_thd_is_local_func)(const MYSQL_THD thd); - void (*wsrep_thd_self_abort_func)(MYSQL_THD thd); - int (*wsrep_thd_append_key_func)(MYSQL_THD thd, const struct wsrep_key* key, - int n_keys, enum Wsrep_service_key_type); - const char* (*wsrep_thd_client_state_str_func)(const MYSQL_THD thd); - const char* (*wsrep_thd_client_mode_str_func)(const MYSQL_THD thd); - const char* (*wsrep_thd_transaction_state_str_func)(const MYSQL_THD thd); - query_id_t (*wsrep_thd_transaction_id_func)(const MYSQL_THD thd); - my_bool (*wsrep_thd_bf_abort_func)(MYSQL_THD bf_thd, - MYSQL_THD victim_thd, - my_bool signal); - my_bool (*wsrep_thd_order_before_func)(const MYSQL_THD left, const MYSQL_THD right); - void (*wsrep_handle_SR_rollback_func)(MYSQL_THD BF_thd, MYSQL_THD victim_thd); - my_bool (*wsrep_thd_skip_locking_func)(const MYSQL_THD thd); - const char* (*wsrep_get_sr_table_name_func)(); - my_bool (*wsrep_get_debug_func)(); - void (*wsrep_commit_ordered_func)(MYSQL_THD thd); - my_bool (*wsrep_thd_is_applying_func)(const MYSQL_THD thd); - ulong (*wsrep_OSU_method_get_func)(const MYSQL_THD thd); - my_bool (*wsrep_thd_has_ignored_error_func)(const MYSQL_THD thd); - void (*wsrep_thd_set_ignored_error_func)(MYSQL_THD thd, my_bool val); - bool (*wsrep_thd_set_wsrep_aborter_func)(MYSQL_THD bf_thd, MYSQL_THD thd); - void (*wsrep_report_bf_lock_wait_func)(const MYSQL_THD thd, - unsigned long long trx_id); -} *wsrep_service; - -#define MYSQL_SERVICE_WSREP_INCLUDED -#endif - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define MYSQL_SERVICE_WSREP_DYNAMIC_INCLUDED -#define get_wsrep_recovery() wsrep_service->get_wsrep_recovery_func() -#define wsrep_consistency_check(T) wsrep_service->wsrep_consistency_check_func(T) -#define wsrep_is_wsrep_xid(X) wsrep_service->wsrep_is_wsrep_xid_func(X) -#define wsrep_xid_seqno(X) wsrep_service->wsrep_xid_seqno_func(X) -#define wsrep_xid_uuid(X) wsrep_service->wsrep_xid_uuid_func(X) -#define wsrep_on(thd) (thd) && WSREP_ON && wsrep_service->wsrep_on_func(thd) -#define wsrep_prepare_key_for_innodb(A,B,C,D,E,F,G) wsrep_service->wsrep_prepare_key_for_innodb_func(A,B,C,D,E,F,G) -#define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T) -#define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T) -#define wsrep_thd_query(T) wsrep_service->wsrep_thd_query_func(T) -#define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T) -#define wsrep_thd_ignore_table(T) wsrep_service->wsrep_thd_ignore_table_func(T) -#define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T) -#define wsrep_thd_auto_increment_variables(T,O,I) wsrep_service->wsrep_thd_auto_increment_variables_func(T,O,I) -#define wsrep_set_data_home_dir(A) wsrep_service->wsrep_set_data_home_dir_func(A) -#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S) -#define wsrep_thd_is_aborting(T) wsrep_service->wsrep_thd_is_aborting_func(T) -#define wsrep_thd_is_local(T) wsrep_service->wsrep_thd_is_local_func(T) -#define wsrep_thd_self_abort(T) wsrep_service->wsrep_thd_self_abort_func(T) -#define wsrep_thd_append_key(T,W,N,K) wsrep_service->wsrep_thd_append_key_func(T,W,N,K) -#define wsrep_thd_client_state_str(T) wsrep_service->wsrep_thd_client_state_str_func(T) -#define wsrep_thd_client_mode_str(T) wsrep_service->wsrep_thd_client_mode_str_func(T) -#define wsrep_thd_transaction_state_str(T) wsrep_service->wsrep_thd_transaction_state_str_func(T) -#define wsrep_thd_transaction_id(T) wsrep_service->wsrep_thd_transaction_id_func(T) -#define wsrep_thd_bf_abort(T,T2,S) wsrep_service->wsrep_thd_bf_abort_func(T,T2,S) -#define wsrep_thd_order_before(L,R) wsrep_service->wsrep_thd_order_before_func(L,R) -#define wsrep_handle_SR_rollback(B,V) wsrep_service->wsrep_handle_SR_rollback_func(B,V) -#define wsrep_thd_skip_locking(T) wsrep_service->wsrep_thd_skip_locking_func(T) -#define wsrep_get_sr_table_name() wsrep_service->wsrep_get_sr_table_name_func() -#define wsrep_get_debug() wsrep_service->wsrep_get_debug_func() -#define wsrep_commit_ordered(T) wsrep_service->wsrep_commit_ordered_func(T) -#define wsrep_thd_is_applying(T) wsrep_service->wsrep_thd_is_applying_func(T) -#define wsrep_OSU_method_get(T) wsrep_service->wsrep_OSU_method_get_func(T) -#define wsrep_thd_has_ignored_error(T) wsrep_service->wsrep_thd_has_ignored_error_func(T) -#define wsrep_thd_set_ignored_error(T,V) wsrep_service->wsrep_thd_set_ignored_error_func(T,V) -#define wsrep_thd_set_wsrep_aborter(T) wsrep_service->wsrep_thd_set_wsrep_aborter_func(T1, T2) -#define wsrep_report_bf_lock_wait(T,I) wsrep_service->wsrep_report_bf_lock_wait(T,I) -#else - -#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED -extern ulong wsrep_debug; -extern my_bool wsrep_log_conflicts; -extern my_bool wsrep_certify_nonPK; -extern my_bool wsrep_load_data_splitting; -extern my_bool wsrep_drupal_282555_workaround; -extern my_bool wsrep_recovery; -extern long wsrep_protocol_version; - -extern "C" bool wsrep_consistency_check(MYSQL_THD thd); -bool wsrep_prepare_key_for_innodb(MYSQL_THD thd, const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len); -extern "C" const char *wsrep_thd_query(const MYSQL_THD thd); -extern "C" int wsrep_is_wsrep_xid(const void* xid); -extern "C" long long wsrep_xid_seqno(const struct xid_t* xid); -const unsigned char* wsrep_xid_uuid(const struct xid_t* xid); -extern "C" long long wsrep_thd_trx_seqno(const MYSQL_THD thd); -my_bool get_wsrep_recovery(); -void wsrep_thd_auto_increment_variables(THD *thd, unsigned long long *offset, unsigned long long *increment); -bool wsrep_thd_ignore_table(MYSQL_THD thd); -void wsrep_set_data_home_dir(const char *data_dir); - -/* from mysql wsrep-lib */ -#include "my_global.h" -#include "my_pthread.h" - -/* Return true if wsrep is enabled for a thd. This means that - wsrep is enabled globally and the thd has wsrep on */ -extern "C" my_bool wsrep_on(const MYSQL_THD thd); -/* Lock thd wsrep lock */ -extern "C" void wsrep_thd_LOCK(const MYSQL_THD thd); -/* Unlock thd wsrep lock */ -extern "C" void wsrep_thd_UNLOCK(const MYSQL_THD thd); - -/* Return thd client state string */ -extern "C" const char* wsrep_thd_client_state_str(const MYSQL_THD thd); -/* Return thd client mode string */ -extern "C" const char* wsrep_thd_client_mode_str(const MYSQL_THD thd); -/* Return thd transaction state string */ -extern "C" const char* wsrep_thd_transaction_state_str(const MYSQL_THD thd); - -/* Return current transaction id */ -extern "C" query_id_t wsrep_thd_transaction_id(const MYSQL_THD thd); -/* Mark thd own transaction as aborted */ -extern "C" void wsrep_thd_self_abort(MYSQL_THD thd); -/* Return true if thd is in replicating mode */ -extern "C" my_bool wsrep_thd_is_local(const MYSQL_THD thd); -/* Return true if thd is in high priority mode */ -/* todo: rename to is_high_priority() */ -extern "C" my_bool wsrep_thd_is_applying(const MYSQL_THD thd); -/* set wsrep_aborter for the target THD */ -extern "C" bool wsrep_thd_set_wsrep_aborter(MYSQL_THD bf_thd, MYSQL_THD victim_thd); -/* Return true if thd is in TOI mode */ -extern "C" my_bool wsrep_thd_is_toi(const MYSQL_THD thd); -/* Return true if thd is in replicating TOI mode */ -extern "C" my_bool wsrep_thd_is_local_toi(const MYSQL_THD thd); -/* Return true if thd is in RSU mode */ -extern "C" my_bool wsrep_thd_is_in_rsu(const MYSQL_THD thd); -/* Return true if thd is in BF mode, either high_priority or TOI */ -extern "C" my_bool wsrep_thd_is_BF(const MYSQL_THD thd, my_bool sync); -/* Return true if thd is streaming */ -extern "C" my_bool wsrep_thd_is_SR(const MYSQL_THD thd); -extern "C" void wsrep_handle_SR_rollback(MYSQL_THD BF_thd, MYSQL_THD victim_thd); -/* Return thd retry counter */ -extern "C" int wsrep_thd_retry_counter(const MYSQL_THD thd); -/* BF abort victim_thd */ -extern "C" my_bool wsrep_thd_bf_abort(MYSQL_THD bf_thd, - MYSQL_THD victim_thd, - my_bool signal); -/* Return true if left thd is ordered before right thd */ -extern "C" my_bool wsrep_thd_order_before(const MYSQL_THD left, const MYSQL_THD right); -/* Return true if thd should skip locking. This means that the thd - is operating on shared resource inside commit order critical section. */ -extern "C" my_bool wsrep_thd_skip_locking(const MYSQL_THD thd); -/* Return true if thd is aborting */ -extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd); - -struct wsrep_key; -struct wsrep_key_array; -extern "C" int wsrep_thd_append_key(MYSQL_THD thd, - const struct wsrep_key* key, - int n_keys, - enum Wsrep_service_key_type); - -extern const char* wsrep_sr_table_name_full; - -extern "C" const char* wsrep_get_sr_table_name(); - -extern "C" my_bool wsrep_get_debug(); - -extern "C" void wsrep_commit_ordered(MYSQL_THD thd); -extern "C" my_bool wsrep_thd_is_applying(const MYSQL_THD thd); -extern "C" ulong wsrep_OSU_method_get(const MYSQL_THD thd); -extern "C" my_bool wsrep_thd_has_ignored_error(const MYSQL_THD thd); -extern "C" void wsrep_thd_set_ignored_error(MYSQL_THD thd, my_bool val); -extern "C" bool wsrep_thd_set_wsrep_aborter(MYSQL_THD bf_thd, MYSQL_THD victim_thd); -extern "C" void wsrep_report_bf_lock_wait(const THD *thd, - unsigned long long trx_id); -#endif -#endif /* MYSQL_SERVICE_WSREP_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/services.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/services.h deleted file mode 100644 index 2c3a0ae..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql/services.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef MYSQL_SERVICES_INCLUDED -/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. - Copyright (c) 2012, 2017, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/*#include */ - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICES_INCLUDED -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_com.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_com.h deleted file mode 100644 index fa5960a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_com.h +++ /dev/null @@ -1,770 +0,0 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* -** Common definition between mysql server & client -*/ - -#ifndef _mysql_com_h -#define _mysql_com_h - -#include "my_decimal_limits.h" - -#define HOSTNAME_LENGTH 60 -#define SYSTEM_CHARSET_MBMAXLEN 3 -#define NAME_CHAR_LEN 64 /* Field/table name length */ -#define USERNAME_CHAR_LENGTH 128 -#define USERNAME_CHAR_LENGTH_STR STRINGIFY_ARG(USERNAME_CHAR_LENGTH) - -#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN) -#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN) -#define DEFINER_CHAR_LENGTH (USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 1) -#define DEFINER_LENGTH (USERNAME_LENGTH + HOSTNAME_LENGTH + 1) - -#define MYSQL_AUTODETECT_CHARSET_NAME "auto" - -#define MYSQL50_TABLE_NAME_PREFIX "#mysql50#" -#define MYSQL50_TABLE_NAME_PREFIX_LENGTH (sizeof(MYSQL50_TABLE_NAME_PREFIX)-1) -#define SAFE_NAME_LEN (NAME_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH) - -/* - MDEV-4088 - - MySQL (and MariaDB 5.x before the fix) was using the first character of the - server version string (as sent in the first handshake protocol packet) to - decide on the replication event formats. And for 10.x the first character - is "1", which the slave thought comes from some ancient 1.x version - (ignoring the fact that the first ever MySQL version was 3.x). - - To support replication to these old clients, we fake the version in the - first handshake protocol packet to start from "5.5.5-" (for example, - it might be "5.5.5-10.0.1-MariaDB-debug-log". - - On the client side we remove this fake version prefix to restore the - correct server version. The version "5.5.5" did not support - pluggable authentication, so any version starting from "5.5.5-" and - claiming to support pluggable auth, must be using this fake prefix. -*/ -/* this version must be the one that *does not* support pluggable auth */ -#define RPL_VERSION_HACK "5.5.5-" - -#define SERVER_VERSION_LENGTH 60 -#define SQLSTATE_LENGTH 5 -#define LIST_PROCESS_HOST_LEN 64 - -/* - Maximum length of comments -*/ -#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 5.5: 60 characters */ -#define TABLE_COMMENT_MAXLEN 2048 -#define COLUMN_COMMENT_MAXLEN 1024 -#define INDEX_COMMENT_MAXLEN 1024 -#define TABLE_PARTITION_COMMENT_MAXLEN 1024 -#define DATABASE_COMMENT_MAXLEN 1024 - -/* - Maximum length of protocol packet. - OK packet length limit also restricted to this value as any length greater - than this value will have first byte of OK packet to be 254 thus does not - provide a means to identify if this is OK or EOF packet. -*/ -#define MAX_PACKET_LENGTH (256L*256L*256L-1) - -/* - USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain - username and hostname parts of the user identifier with trailing zero in - MySQL standard format: - user_name_part@host_name_part\0 -*/ -#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2 - -#define LOCAL_HOST "localhost" -#define LOCAL_HOST_NAMEDPIPE "." - - -#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) -#define MYSQL_NAMEDPIPE "MySQL" -#define MYSQL_SERVICENAME "MySQL" -#endif /* __WIN__ */ - -/* - You should add new commands to the end of this list, otherwise old - servers won't be able to handle them as 'unsupported'. -*/ - -enum enum_server_command -{ - COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, - COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, - COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, - COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, - COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, - COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, - COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, - COM_UNIMPLEMENTED, /* COM_BINLOG_DUMP_GTID in MySQL */ - COM_RESET_CONNECTION, - /* don't forget to update const char *command_name[] in sql_parse.cc */ - COM_MDB_GAP_BEG, - COM_MDB_GAP_END=249, - COM_STMT_BULK_EXECUTE=250, - COM_SLAVE_WORKER=251, - COM_SLAVE_IO=252, - COM_SLAVE_SQL=253, - COM_MULTI=254, - /* Must be last */ - COM_END=255 -}; - - -/* - Bulk PS protocol indicator value: -*/ -enum enum_indicator_type -{ - STMT_INDICATOR_NONE= 0, - STMT_INDICATOR_NULL, - STMT_INDICATOR_DEFAULT, - STMT_INDICATOR_IGNORE -}; - -/* - bulk PS flags -*/ -#define STMT_BULK_FLAG_CLIENT_SEND_TYPES 128 -#define STMT_BULK_FLAG_INSERT_ID_REQUEST 64 - - -/* sql type stored in .frm files for virtual fields */ -#define MYSQL_TYPE_VIRTUAL 245 -/* - Length of random string sent by server on handshake; this is also length of - obfuscated password, received from client -*/ -#define SCRAMBLE_LENGTH 20 -#define SCRAMBLE_LENGTH_323 8 -/* length of password stored in the db: new passwords are preceded with '*' */ -#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1) -#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2) - - -#define NOT_NULL_FLAG 1U /* Field can't be NULL */ -#define PRI_KEY_FLAG 2U /* Field is part of a primary key */ -#define UNIQUE_KEY_FLAG 4U /* Field is part of a unique key */ -#define MULTIPLE_KEY_FLAG 8U /* Field is part of a key */ -#define BLOB_FLAG 16U /* Field is a blob */ -#define UNSIGNED_FLAG 32U /* Field is unsigned */ -#define ZEROFILL_FLAG 64U /* Field is zerofill */ -#define BINARY_FLAG 128U /* Field is binary */ - -/* The following are only sent to new clients */ -#define ENUM_FLAG 256U /* field is an enum */ -#define AUTO_INCREMENT_FLAG 512U /* field is a autoincrement field */ -#define TIMESTAMP_FLAG 1024U /* Field is a timestamp */ -#define SET_FLAG 2048U /* field is a set */ -#define NO_DEFAULT_VALUE_FLAG 4096U /* Field doesn't have default value */ -#define ON_UPDATE_NOW_FLAG 8192U /* Field is set to NOW on UPDATE */ -#define NUM_FLAG 32768U /* Field is num (for clients) */ -#define PART_KEY_FLAG 16384U /* Intern; Part of some key */ -#define GROUP_FLAG 32768U /* Intern: Group field */ -#define BINCMP_FLAG 131072U /* Intern: Used by sql_yacc */ -#define GET_FIXED_FIELDS_FLAG (1U << 18) /* Used to get fields in item tree */ -#define FIELD_IN_PART_FUNC_FLAG (1U << 19)/* Field part of partition func */ -#define PART_INDIRECT_KEY_FLAG (1U << 20) - -/** - Intern: Field in TABLE object for new version of altered table, - which participates in a newly added index. -*/ -#define FIELD_IN_ADD_INDEX (1U << 20) -#define FIELD_IS_RENAMED (1U << 21) /* Intern: Field is being renamed */ -#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23 */ -#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3U << FIELD_FLAGS_STORAGE_MEDIA) -#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25 */ -#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3U << FIELD_FLAGS_COLUMN_FORMAT) -#define FIELD_IS_DROPPED (1U << 26) /* Intern: Field is being dropped */ - -#define VERS_SYS_START_FLAG (1 << 27) /* autogenerated column declared with - `generated always as row start` - (see II.a SQL Standard) */ -#define VERS_SYS_END_FLAG (1 << 28) /* autogenerated column declared with - `generated always as row end` - (see II.a SQL Standard).*/ -#define VERS_SYSTEM_FIELD (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG) -#define VERS_UPDATE_UNVERSIONED_FLAG (1 << 29) /* column that doesn't support - system versioning when table - itself supports it*/ -#define LONG_UNIQUE_HASH_FIELD (1<< 30) /* This field will store hash for unique - column */ -#define FIELD_PART_OF_TMP_UNIQUE (1<< 31) /* part of an unique constrain - for a tmporary table*/ - -#define REFRESH_GRANT (1ULL << 0) /* Refresh grant tables */ -#define REFRESH_LOG (1ULL << 1) /* Start on new log file */ -#define REFRESH_TABLES (1ULL << 2) /* close all tables */ -#define REFRESH_HOSTS (1ULL << 3) /* Flush host cache */ -#define REFRESH_STATUS (1ULL << 4) /* Flush status variables */ -#define REFRESH_THREADS (1ULL << 5) /* Flush thread cache */ -#define REFRESH_SLAVE (1ULL << 6) /* Reset master info and restart slave - thread */ -#define REFRESH_MASTER (1ULL << 7) /* Remove all bin logs in the index - and truncate the index */ - -/* The following can't be set with mysql_refresh() */ -#define REFRESH_ERROR_LOG (1ULL << 8) /* Rotate only the error log */ -#define REFRESH_ENGINE_LOG (1ULL << 9) /* Flush all storage engine logs */ -#define REFRESH_BINARY_LOG (1ULL << 10) /* Flush the binary log */ -#define REFRESH_RELAY_LOG (1ULL << 11) /* Flush the relay log */ -#define REFRESH_GENERAL_LOG (1ULL << 12) /* Flush the general log */ -#define REFRESH_SLOW_LOG (1ULL << 13) /* Flush the slow query log */ - -#define REFRESH_READ_LOCK (1ULL << 14) /* Lock tables for read */ -#define REFRESH_CHECKPOINT (1ULL << 15) /* With REFRESH_READ_LOCK: block checkpoints too */ - -#define REFRESH_QUERY_CACHE (1ULL << 16) /* clear the query cache */ -#define REFRESH_QUERY_CACHE_FREE (1ULL << 17) /* pack query cache */ -#define REFRESH_DES_KEY_FILE (1ULL << 18) -#define REFRESH_USER_RESOURCES (1ULL << 19) -#define REFRESH_FOR_EXPORT (1ULL << 20) /* FLUSH TABLES ... FOR EXPORT */ -#define REFRESH_SSL (1ULL << 21) - -#define REFRESH_GENERIC (1ULL << 30) -#define REFRESH_FAST (1ULL << 31) /* Intern flag */ - -#define CLIENT_LONG_PASSWORD 0 /* obsolete flag */ -#define CLIENT_MYSQL 1ULL /* mysql/old mariadb server/client */ -#define CLIENT_FOUND_ROWS 2ULL /* Found instead of affected rows */ -#define CLIENT_LONG_FLAG 4ULL /* Get all column flags */ -#define CLIENT_CONNECT_WITH_DB 8ULL /* One can specify db on connect */ -#define CLIENT_NO_SCHEMA 16ULL /* Don't allow database.table.column */ -#define CLIENT_COMPRESS 32ULL /* Can use compression protocol */ -#define CLIENT_ODBC 64ULL /* Odbc client */ -#define CLIENT_LOCAL_FILES 128ULL /* Can use LOAD DATA LOCAL */ -#define CLIENT_IGNORE_SPACE 256ULL /* Ignore spaces before '(' */ -#define CLIENT_PROTOCOL_41 512ULL /* New 4.1 protocol */ -#define CLIENT_INTERACTIVE 1024ULL /* This is an interactive client */ -#define CLIENT_SSL 2048ULL /* Switch to SSL after handshake */ -#define CLIENT_IGNORE_SIGPIPE 4096ULL /* IGNORE sigpipes */ -#define CLIENT_TRANSACTIONS 8192ULL /* Client knows about transactions */ -#define CLIENT_RESERVED 16384ULL /* Old flag for 4.1 protocol */ -#define CLIENT_SECURE_CONNECTION 32768ULL /* New 4.1 authentication */ -#define CLIENT_MULTI_STATEMENTS (1ULL << 16) /* Enable/disable multi-stmt support */ -#define CLIENT_MULTI_RESULTS (1ULL << 17) /* Enable/disable multi-results */ -#define CLIENT_PS_MULTI_RESULTS (1ULL << 18) /* Multi-results in PS-protocol */ - -#define CLIENT_PLUGIN_AUTH (1ULL << 19) /* Client supports plugin authentication */ -#define CLIENT_CONNECT_ATTRS (1ULL << 20) /* Client supports connection attributes */ -/* Enable authentication response packet to be larger than 255 bytes. */ -#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1ULL << 21) -/* Don't close the connection for a connection with expired password. */ -#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1ULL << 22) - -/** - Capable of handling server state change information. Its a hint to the - server to include the state change information in Ok packet. -*/ -#define CLIENT_SESSION_TRACK (1ULL << 23) -/* Client no longer needs EOF packet */ -#define CLIENT_DEPRECATE_EOF (1ULL << 24) - -#define CLIENT_PROGRESS_OBSOLETE (1ULL << 29) -#define CLIENT_SSL_VERIFY_SERVER_CERT (1ULL << 30) -/* - It used to be that if mysql_real_connect() failed, it would delete any - options set by the client, unless the CLIENT_REMEMBER_OPTIONS flag was - given. - That behaviour does not appear very useful, and it seems unlikely that - any applications would actually depend on this. So from MariaDB 5.5 we - always preserve any options set in case of failed connect, and this - option is effectively always set. -*/ -#define CLIENT_REMEMBER_OPTIONS (1ULL << 31) - -/* MariaDB extended capability flags */ -#define MARIADB_CLIENT_FLAGS_MASK 0xffffffff00000000ULL -/* Client support progress indicator */ -#define MARIADB_CLIENT_PROGRESS (1ULL << 32) -/* support COM_MULTI */ -#define MARIADB_CLIENT_COM_MULTI (1ULL << 33) -/* support of array binding */ -#define MARIADB_CLIENT_STMT_BULK_OPERATIONS (1ULL << 34) -/* support of extended metadata (e.g. type/format information) */ -#define MARIADB_CLIENT_EXTENDED_METADATA (1ULL << 35) - -#ifdef HAVE_COMPRESS -#define CAN_CLIENT_COMPRESS CLIENT_COMPRESS -#else -#define CAN_CLIENT_COMPRESS 0 -#endif - -/* - Gather all possible capabilities (flags) supported by the server - - MARIADB_* flags supported only by MariaDB connector(s). -*/ -#define CLIENT_ALL_FLAGS (\ - CLIENT_FOUND_ROWS | \ - CLIENT_LONG_FLAG | \ - CLIENT_CONNECT_WITH_DB | \ - CLIENT_NO_SCHEMA | \ - CLIENT_COMPRESS | \ - CLIENT_ODBC | \ - CLIENT_LOCAL_FILES | \ - CLIENT_IGNORE_SPACE | \ - CLIENT_PROTOCOL_41 | \ - CLIENT_INTERACTIVE | \ - CLIENT_SSL | \ - CLIENT_IGNORE_SIGPIPE | \ - CLIENT_TRANSACTIONS | \ - CLIENT_RESERVED | \ - CLIENT_SECURE_CONNECTION | \ - CLIENT_MULTI_STATEMENTS | \ - CLIENT_MULTI_RESULTS | \ - CLIENT_PS_MULTI_RESULTS | \ - CLIENT_SSL_VERIFY_SERVER_CERT | \ - CLIENT_REMEMBER_OPTIONS | \ - MARIADB_CLIENT_PROGRESS | \ - CLIENT_PLUGIN_AUTH | \ - CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \ - CLIENT_SESSION_TRACK |\ - CLIENT_DEPRECATE_EOF |\ - CLIENT_CONNECT_ATTRS |\ - MARIADB_CLIENT_COM_MULTI |\ - MARIADB_CLIENT_STMT_BULK_OPERATIONS |\ - MARIADB_CLIENT_EXTENDED_METADATA|\ - CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS) - -/* - Switch off the flags that are optional and depending on build flags - If any of the optional flags is supported by the build it will be switched - on before sending to the client during the connection handshake. -*/ -#define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \ - & ~CLIENT_COMPRESS) \ - & ~CLIENT_SSL_VERIFY_SERVER_CERT) - -enum mariadb_field_attr_t -{ - MARIADB_FIELD_ATTR_DATA_TYPE_NAME= 0, - MARIADB_FIELD_ATTR_FORMAT_NAME= 1 -}; - -#define MARIADB_FIELD_ATTR_LAST MARIADB_FIELD_ATTR_FORMAT_NAME - - -/** - Is raised when a multi-statement transaction - has been started, either explicitly, by means - of BEGIN or COMMIT AND CHAIN, or - implicitly, by the first transactional - statement, when autocommit=off. -*/ -#define SERVER_STATUS_IN_TRANS 1U -#define SERVER_STATUS_AUTOCOMMIT 2U /* Server in auto_commit mode */ -#define SERVER_MORE_RESULTS_EXISTS 8U /* Multi query - next query exists */ -#define SERVER_QUERY_NO_GOOD_INDEX_USED 16U -#define SERVER_QUERY_NO_INDEX_USED 32U -/** - The server was able to fulfill the clients request and opened a - read-only non-scrollable cursor for a query. This flag comes - in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands. -*/ -#define SERVER_STATUS_CURSOR_EXISTS 64U -/** - This flag is sent when a read-only cursor is exhausted, in reply to - COM_STMT_FETCH command. -*/ -#define SERVER_STATUS_LAST_ROW_SENT 128U -#define SERVER_STATUS_DB_DROPPED 256U /* A database was dropped */ -#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512U -/** - Sent to the client if after a prepared statement reprepare - we discovered that the new statement returns a different - number of result set columns. -*/ -#define SERVER_STATUS_METADATA_CHANGED 1024U -#define SERVER_QUERY_WAS_SLOW 2048U - -/** - To mark ResultSet containing output parameter values. -*/ -#define SERVER_PS_OUT_PARAMS 4096U - -/** - Set at the same time as SERVER_STATUS_IN_TRANS if the started - multi-statement transaction is a read-only transaction. Cleared - when the transaction commits or aborts. Since this flag is sent - to clients in OK and EOF packets, the flag indicates the - transaction status at the end of command execution. -*/ -#define SERVER_STATUS_IN_TRANS_READONLY 8192U - -/** - This status flag, when on, implies that one of the state information has - changed on the server because of the execution of the last statement. -*/ -#define SERVER_SESSION_STATE_CHANGED 16384U - -#define SERVER_STATUS_ANSI_QUOTES 32768U - -/** - Server status flags that must be cleared when starting - execution of a new SQL statement. - Flags from this set are only added to the - current server status by the execution engine, but - never removed -- the execution engine expects them - to disappear automagically by the next command. -*/ -#define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \ - SERVER_QUERY_NO_INDEX_USED|\ - SERVER_MORE_RESULTS_EXISTS|\ - SERVER_STATUS_METADATA_CHANGED |\ - SERVER_QUERY_WAS_SLOW |\ - SERVER_STATUS_DB_DROPPED |\ - SERVER_STATUS_CURSOR_EXISTS|\ - SERVER_STATUS_LAST_ROW_SENT|\ - SERVER_SESSION_STATE_CHANGED) - -#define MYSQL_ERRMSG_SIZE 512 -#define NET_READ_TIMEOUT 30 /* Timeout on read */ -#define NET_WRITE_TIMEOUT 60 /* Timeout on write */ -#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */ - -struct st_vio; /* Only C */ -typedef struct st_vio Vio; - -#define MAX_TINYINT_WIDTH 3 /* Max width for a TINY w.o. sign */ -#define MAX_SMALLINT_WIDTH 5 /* Max width for a SHORT w.o. sign */ -#define MAX_MEDIUMINT_WIDTH 8 /* Max width for a INT24 w.o. sign */ -#define MAX_INT_WIDTH 10 /* Max width for a LONG w.o. sign */ -#define MAX_BIGINT_WIDTH 20 /* Max width for a LONGLONG */ -#define MAX_CHAR_WIDTH 255 /* Max length for a CHAR column */ -#define MAX_BLOB_WIDTH 16777216 /* Default width for blob */ - -typedef struct st_net { -#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) - Vio *vio; - unsigned char *buff,*buff_end,*write_pos,*read_pos; - my_socket fd; /* For Perl DBI/dbd */ - /* - The following variable is set if we are doing several queries in one - command ( as in LOAD TABLE ... FROM MASTER ), - and do not want to confuse the client with OK at the wrong time - */ - unsigned long remain_in_buf,length, buf_length, where_b; - unsigned long max_packet,max_packet_size; - unsigned int pkt_nr,compress_pkt_nr; - unsigned int write_timeout, read_timeout, retry_count; - int fcntl; - unsigned int *return_status; - unsigned char reading_or_writing; - char save_char; - char net_skip_rest_factor; - my_bool thread_specific_malloc; - unsigned char compress; - my_bool unused3; /* Please remove with the next incompatible ABI change. */ - /* - Pointer to query object in query cache, do not equal NULL (0) for - queries in cache that have not stored its results yet - */ -#endif - void *thd; /* Used by MariaDB server to avoid calling current_thd */ - unsigned int last_errno; - unsigned char error; - my_bool unused4; /* Please remove with the next incompatible ABI change. */ - my_bool unused5; /* Please remove with the next incompatible ABI change. */ - /** Client library error message buffer. Actually belongs to struct MYSQL. */ - char last_error[MYSQL_ERRMSG_SIZE]; - /** Client library sqlstate buffer. Set along with the error message. */ - char sqlstate[SQLSTATE_LENGTH+1]; - void *extension; -} NET; - - -#define packet_error ~0UL - -enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, - MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, - MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, - MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, - MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, - MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, - MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, - MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, - MYSQL_TYPE_BIT, - /* - mysql-5.6 compatibility temporal types. - They're only used internally for reading RBR - mysql-5.6 binary log events and mysql-5.6 frm files. - They're never sent to the client. - */ - MYSQL_TYPE_TIMESTAMP2, - MYSQL_TYPE_DATETIME2, - MYSQL_TYPE_TIME2, - /* Compressed types are only used internally for RBR. */ - MYSQL_TYPE_BLOB_COMPRESSED= 140, - MYSQL_TYPE_VARCHAR_COMPRESSED= 141, - - MYSQL_TYPE_NEWDECIMAL=246, - MYSQL_TYPE_ENUM=247, - MYSQL_TYPE_SET=248, - MYSQL_TYPE_TINY_BLOB=249, - MYSQL_TYPE_MEDIUM_BLOB=250, - MYSQL_TYPE_LONG_BLOB=251, - MYSQL_TYPE_BLOB=252, - MYSQL_TYPE_VAR_STRING=253, - MYSQL_TYPE_STRING=254, - MYSQL_TYPE_GEOMETRY=255 - -}; - -/* For backward compatibility */ -#define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS -#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL -#define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL -#define FIELD_TYPE_TINY MYSQL_TYPE_TINY -#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT -#define FIELD_TYPE_LONG MYSQL_TYPE_LONG -#define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT -#define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE -#define FIELD_TYPE_NULL MYSQL_TYPE_NULL -#define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP -#define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG -#define FIELD_TYPE_INT24 MYSQL_TYPE_INT24 -#define FIELD_TYPE_DATE MYSQL_TYPE_DATE -#define FIELD_TYPE_TIME MYSQL_TYPE_TIME -#define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME -#define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR -#define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE -#define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM -#define FIELD_TYPE_SET MYSQL_TYPE_SET -#define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB -#define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB -#define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB -#define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB -#define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING -#define FIELD_TYPE_STRING MYSQL_TYPE_STRING -#define FIELD_TYPE_CHAR MYSQL_TYPE_TINY -#define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM -#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY -#define FIELD_TYPE_BIT MYSQL_TYPE_BIT - - -/* Shutdown/kill enums and constants */ - -/* Bits for THD::killable. */ -#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0) -#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1) -#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2) -#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3) - -enum mysql_enum_shutdown_level { - /* - We want levels to be in growing order of hardness (because we use number - comparisons). Note that DEFAULT does not respect the growing property, but - it's ok. - */ - SHUTDOWN_DEFAULT = 0, - /* wait for existing connections to finish */ - SHUTDOWN_WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT, - /* wait for existing trans to finish */ - SHUTDOWN_WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS, - /* wait for existing updates to finish (=> no partial MyISAM update) */ - SHUTDOWN_WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE, - /* flush InnoDB buffers and other storage engines' buffers*/ - SHUTDOWN_WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1), - /* don't flush InnoDB buffers, flush other storage engines' buffers*/ - SHUTDOWN_WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1 -}; - -enum enum_cursor_type -{ - CURSOR_TYPE_NO_CURSOR= 0, - CURSOR_TYPE_READ_ONLY= 1, - CURSOR_TYPE_FOR_UPDATE= 2, - CURSOR_TYPE_SCROLLABLE= 4 -}; - - -/* options for mysql_set_option */ -enum enum_mysql_set_option -{ - MYSQL_OPTION_MULTI_STATEMENTS_ON, - MYSQL_OPTION_MULTI_STATEMENTS_OFF -}; - -/* - Type of state change information that the server can include in the Ok - packet. -*/ -enum enum_session_state_type -{ - SESSION_TRACK_SYSTEM_VARIABLES, /* Session system variables */ - SESSION_TRACK_SCHEMA, /* Current schema */ - SESSION_TRACK_STATE_CHANGE, /* track session state changes */ - SESSION_TRACK_GTIDS, - SESSION_TRACK_TRANSACTION_CHARACTERISTICS, /* Transaction chistics */ - SESSION_TRACK_TRANSACTION_STATE, /* Transaction state */ -#ifdef USER_VAR_TRACKING - SESSION_TRACK_MYSQL_RESERVED1, - SESSION_TRACK_MYSQL_RESERVED2, - SESSION_TRACK_MYSQL_RESERVED3, - SESSION_TRACK_MYSQL_RESERVED4, - SESSION_TRACK_MYSQL_RESERVED5, - SESSION_TRACK_MYSQL_RESERVED6, - SESSION_TRACK_USER_VARIABLES, -#endif // USER_VAR_TRACKING - SESSION_TRACK_always_at_the_end /* must be last */ -}; - -#define SESSION_TRACK_BEGIN SESSION_TRACK_SYSTEM_VARIABLES - -#define IS_SESSION_STATE_TYPE(T) \ - (((int)(T) >= SESSION_TRACK_BEGIN) && ((T) < SESSION_TRACK_always_at_the_end)) - -#define net_new_transaction(net) ((net)->pkt_nr=0) - -#ifdef __cplusplus -extern "C" { -#endif - -my_bool my_net_init(NET *net, Vio* vio, void *thd, unsigned int my_flags); -void my_net_local_init(NET *net); -void net_end(NET *net); -void net_clear(NET *net, my_bool clear_buffer); -my_bool net_realloc(NET *net, size_t length); -my_bool net_flush(NET *net); -my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); -my_bool net_write_command(NET *net,unsigned char command, - const unsigned char *header, size_t head_len, - const unsigned char *packet, size_t len); -int net_real_write(NET *net,const unsigned char *packet, size_t len); -unsigned long my_net_read_packet(NET *net, my_bool read_from_server); -unsigned long my_net_read_packet_reallen(NET *net, my_bool read_from_server, - unsigned long* reallen); -#define my_net_read(A) my_net_read_packet((A), 0) - -#ifdef MY_GLOBAL_INCLUDED -void my_net_set_write_timeout(NET *net, uint timeout); -void my_net_set_read_timeout(NET *net, uint timeout); -#endif - -struct sockaddr; -int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, - unsigned int timeout); -struct my_rnd_struct; - -#ifdef __cplusplus -} -#endif - - /* The following is for user defined functions */ - -enum Item_result -{ - STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT, - TIME_RESULT -}; - -typedef struct st_udf_args -{ - unsigned int arg_count; /* Number of arguments */ - enum Item_result *arg_type; /* Pointer to item_results */ - char **args; /* Pointer to argument */ - unsigned long *lengths; /* Length of string arguments */ - char *maybe_null; /* Set to 1 for all maybe_null args */ - const char **attributes; /* Pointer to attribute name */ - unsigned long *attribute_lengths; /* Length of attribute arguments */ - void *extension; -} UDF_ARGS; - - /* This holds information about the result */ - -typedef struct st_udf_init -{ - my_bool maybe_null; /* 1 if function can return NULL */ - unsigned int decimals; /* for real functions */ - unsigned long max_length; /* For string functions */ - char *ptr; /* free pointer for function data */ - my_bool const_item; /* 1 if function always returns the same value */ - void *extension; -} UDF_INIT; -/* - TODO: add a notion for determinism of the UDF. - See Item_udf_func::update_used_tables () -*/ - - /* Constants when using compression */ -#define NET_HEADER_SIZE 4 /* standard header size */ -#define COMP_HEADER_SIZE 3 /* compression header extra size */ - - /* Prototypes to password functions */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - These functions are used for authentication by client and server and - implemented in sql/password.c -*/ - -void create_random_string(char *to, unsigned int length, - struct my_rnd_struct *rand_st); - -void hash_password(unsigned long *to, const char *password, unsigned int password_len); -void make_scrambled_password_323(char *to, const char *password); -void scramble_323(char *to, const char *message, const char *password); -my_bool check_scramble_323(const unsigned char *reply, const char *message, - unsigned long *salt); -void get_salt_from_password_323(unsigned long *res, const char *password); -void make_scrambled_password(char *to, const char *password); -void scramble(char *to, const char *message, const char *password); -my_bool check_scramble(const unsigned char *reply, const char *message, - const unsigned char *hash_stage2); -void get_salt_from_password(unsigned char *res, const char *password); -char *octet2hex(char *to, const char *str, size_t len); - -/* end of password.c */ - -char *get_tty_password(const char *opt_message); -void get_tty_password_buff(const char *opt_message, char *to, size_t length); -const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); - -/* Some other useful functions */ - -my_bool my_thread_init(void); -void my_thread_end(void); - -#ifdef MY_GLOBAL_INCLUDED -#include "pack.h" -#endif - -#ifdef __cplusplus -} -#endif - -#define NULL_LENGTH ~0UL /* For net_store_length */ -#define MYSQL_STMT_HEADER 4U -#define MYSQL_LONG_DATA_HEADER 6U - -/* - If a float or double field have more than this number of decimals, - it's regarded as floating point field without any specific number of - decimals -*/ - - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_com_server.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_com_server.h deleted file mode 100644 index d8bf531..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_com_server.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Definitions private to the server, - used in the networking layer to notify specific events. -*/ - -#ifndef _mysql_com_server_h -#define _mysql_com_server_h - -struct st_net_server; - -typedef void (*before_header_callback_fn) - (struct st_net *net, void *user_data, size_t count); - -typedef void (*after_header_callback_fn) - (struct st_net *net, void *user_data, size_t count, my_bool rc); - -struct st_net_server -{ - before_header_callback_fn m_before_header; - after_header_callback_fn m_after_header; - void *m_user_data; -}; - -typedef struct st_net_server NET_SERVER; - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_embed.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_embed.h deleted file mode 100644 index 775040a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_embed.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef MYSQL_EMBED_INCLUDED -#define MYSQL_EMBED_INCLUDED - -/* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Defines that are unique to the embedded version of MySQL */ - -#ifdef EMBEDDED_LIBRARY - -/* Things we don't need in the embedded version of MySQL */ -/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ - -#undef HAVE_DLOPEN /* No udf functions */ - -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_EMBED_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_time.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_time.h deleted file mode 100644 index ef78441..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_time.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (c) 2004, 2006 MySQL AB - Use is subject to license terms - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _mysql_time_h_ -#define _mysql_time_h_ - -/* - Portable time_t replacement. - Should be signed and hold seconds for 1902 -- 2038-01-19 range - i.e at least a 32bit variable - - Using the system built in time_t is not an option as - we rely on the above requirements in the time functions -*/ -typedef long my_time_t; - - -/* - Time declarations shared between the server and client API: - you should not add anything to this header unless it's used - (and hence should be visible) in mysql.h. - If you're looking for a place to add new time-related declaration, - it's most likely my_time.h. See also "C API Handling of Date - and Time Values" chapter in documentation. -*/ - -enum enum_mysql_timestamp_type -{ - MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1, - MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2 -}; - - -/* - Structure which is used to represent datetime values inside MySQL. - - We assume that values in this structure are normalized, i.e. year <= 9999, - month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions - in server such as my_system_gmt_sec() or make_time() family of functions - rely on this (actually now usage of make_*() family relies on a bit weaker - restriction). Also functions that produce MYSQL_TIME as result ensure this. - There is one exception to this rule though if this structure holds time - value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold - bigger values. -*/ -typedef struct st_mysql_time -{ - unsigned int year, month, day, hour, minute, second; - unsigned long second_part; - my_bool neg; - enum enum_mysql_timestamp_type time_type; -} MYSQL_TIME; - -#endif /* _mysql_time_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_version.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_version.h deleted file mode 100644 index 5577ca0..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysql_version.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB - & Detron HB, 1996, 1999-2004, 2007 MySQL AB. - This file is public domain and comes with NO WARRANTY of any kind -*/ - -/* Version numbers for protocol & mysqld */ - -#ifndef _mysql_version_h -#define _mysql_version_h -#ifdef _CUSTOMCONFIG_ -#include -#else -#define PROTOCOL_VERSION 10 -#define MYSQL_SERVER_VERSION "10.5.7-MariaDB" -#define MYSQL_BASE_VERSION "mysqld-10.5" -#define MARIADB_BASE_VERSION "mariadb-10.5" -#define MARIADBD_BASE_VERSION "mariadbd-10.5" -#define MYSQL_SERVER_SUFFIX_DEF "" -#define FRM_VER 6 -#define MYSQL_VERSION_ID 100507 -#define MARIADB_PORT 3306 -#define MYSQL_PORT_DEFAULT 0 -#define MARIADB_UNIX_ADDR "/tmp/mysql.sock" -#define MYSQL_CONFIG_NAME "my" -#define MYSQL_COMPILATION_COMMENT "mariadb.org binary distribution" -#define SERVER_MATURITY_LEVEL MariaDB_PLUGIN_MATURITY_STABLE - -#define MYSQL_PORT MARIADB_PORT -#define MYSQL_UNIX_ADDR MARIADB_UNIX_ADDR - -#ifdef WITH_WSREP -#define WSREP_PATCH_VERSION "" -#endif - -/* mysqld compile time options */ -#endif /* _CUSTOMCONFIG_ */ - -#ifndef LICENSE -#define LICENSE GPL -#endif /* LICENSE */ - -#endif /* _mysql_version_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysqld_ername.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysqld_ername.h deleted file mode 100644 index 6ad26a9..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysqld_ername.h +++ /dev/null @@ -1,1201 +0,0 @@ -/* Autogenerated file, please don't edit */ - -{ "ER_HASHCHK", 1000, "hashchk" }, -{ "ER_NISAMCHK", 1001, "isamchk" }, -{ "ER_NO", 1002, "NO" }, -{ "ER_YES", 1003, "YES" }, -{ "ER_CANT_CREATE_FILE", 1004, "Can\'t create file \'%-.200s\' (errno: %M)" }, -{ "ER_CANT_CREATE_TABLE", 1005, "Can\'t create table %`s.%`s (errno: %M)" }, -{ "ER_CANT_CREATE_DB", 1006, "Can\'t create database \'%-.192s\' (errno: %M)" }, -{ "ER_DB_CREATE_EXISTS", 1007, "Can\'t create database \'%-.192s\'; database exists" }, -{ "ER_DB_DROP_EXISTS", 1008, "Can\'t drop database \'%-.192s\'; database doesn\'t exist" }, -{ "ER_DB_DROP_DELETE", 1009, "Error dropping database (can\'t delete \'%-.192s\', errno: %M)" }, -{ "ER_DB_DROP_RMDIR", 1010, "Error dropping database (can\'t rmdir \'%-.192s\', errno: %M)" }, -{ "ER_CANT_DELETE_FILE", 1011, "Error on delete of \'%-.192s\' (errno: %M)" }, -{ "ER_CANT_FIND_SYSTEM_REC", 1012, "Can\'t read record in system table" }, -{ "ER_CANT_GET_STAT", 1013, "Can\'t get status of \'%-.200s\' (errno: %M)" }, -{ "ER_CANT_GET_WD", 1014, "Can\'t get working directory (errno: %M)" }, -{ "ER_CANT_LOCK", 1015, "Can\'t lock file (errno: %M)" }, -{ "ER_CANT_OPEN_FILE", 1016, "Can\'t open file: \'%-.200s\' (errno: %M)" }, -{ "ER_FILE_NOT_FOUND", 1017, "Can\'t find file: \'%-.200s\' (errno: %M)" }, -{ "ER_CANT_READ_DIR", 1018, "Can\'t read dir of \'%-.192s\' (errno: %M)" }, -{ "ER_CANT_SET_WD", 1019, "Can\'t change dir to \'%-.192s\' (errno: %M)" }, -{ "ER_CHECKREAD", 1020, "Record has changed since last read in table \'%-.192s\'" }, -{ "ER_DISK_FULL", 1021, "Disk full (%s); waiting for someone to free some space... (errno: %M)" }, -{ "ER_DUP_KEY", 1022, "Can\'t write; duplicate key in table \'%-.192s\'" }, -{ "ER_ERROR_ON_CLOSE", 1023, "Error on close of \'%-.192s\' (errno: %M)" }, -{ "ER_ERROR_ON_READ", 1024, "Error reading file \'%-.200s\' (errno: %M)" }, -{ "ER_ERROR_ON_RENAME", 1025, "Error on rename of \'%-.210s\' to \'%-.210s\' (errno: %M)" }, -{ "ER_ERROR_ON_WRITE", 1026, "Error writing file \'%-.200s\' (errno: %M)" }, -{ "ER_FILE_USED", 1027, "\'%-.192s\' is locked against change" }, -{ "ER_FILSORT_ABORT", 1028, "Sort aborted" }, -{ "ER_FORM_NOT_FOUND", 1029, "View \'%-.192s\' doesn\'t exist for \'%-.192s\'" }, -{ "ER_GET_ERRNO", 1030, "Got error %M from storage engine %s" }, -{ "ER_ILLEGAL_HA", 1031, "Storage engine %s of the table %`s.%`s doesn\'t have this option" }, -{ "ER_KEY_NOT_FOUND", 1032, "Can\'t find record in \'%-.192s\'" }, -{ "ER_NOT_FORM_FILE", 1033, "Incorrect information in file: \'%-.200s\'" }, -{ "ER_NOT_KEYFILE", 1034, "Index for table \'%-.200s\' is corrupt; try to repair it" }, -{ "ER_OLD_KEYFILE", 1035, "Old key file for table \'%-.192s\'; repair it!" }, -{ "ER_OPEN_AS_READONLY", 1036, "Table \'%-.192s\' is read only" }, -{ "ER_OUTOFMEMORY", 1037, "Out of memory; restart server and try again (needed %d bytes)" }, -{ "ER_OUT_OF_SORTMEMORY", 1038, "Out of sort memory, consider increasing server sort buffer size" }, -{ "ER_UNEXPECTED_EOF", 1039, "Unexpected EOF found when reading file \'%-.192s\' (errno: %M)" }, -{ "ER_CON_COUNT_ERROR", 1040, "Too many connections" }, -{ "ER_OUT_OF_RESOURCES", 1041, "Out of memory." }, -{ "ER_BAD_HOST_ERROR", 1042, "Can\'t get hostname for your address" }, -{ "ER_HANDSHAKE_ERROR", 1043, "Bad handshake" }, -{ "ER_DBACCESS_DENIED_ERROR", 1044, "Access denied for user \'%s\'@\'%s\' to database \'%-.192s\'" }, -{ "ER_ACCESS_DENIED_ERROR", 1045, "Access denied for user \'%s\'@\'%s\' (using password: %s)" }, -{ "ER_NO_DB_ERROR", 1046, "No database selected" }, -{ "ER_UNKNOWN_COM_ERROR", 1047, "Unknown command" }, -{ "ER_BAD_NULL_ERROR", 1048, "Column \'%-.192s\' cannot be null" }, -{ "ER_BAD_DB_ERROR", 1049, "Unknown database \'%-.192s\'" }, -{ "ER_TABLE_EXISTS_ERROR", 1050, "Table \'%-.192s\' already exists" }, -{ "ER_BAD_TABLE_ERROR", 1051, "Unknown table \'%-.100T\'" }, -{ "ER_NON_UNIQ_ERROR", 1052, "Column \'%-.192s\' in %-.192s is ambiguous" }, -{ "ER_SERVER_SHUTDOWN", 1053, "Server shutdown in progress" }, -{ "ER_BAD_FIELD_ERROR", 1054, "Unknown column \'%-.192s\' in \'%-.192s\'" }, -{ "ER_WRONG_FIELD_WITH_GROUP", 1055, "\'%-.192s\' isn\'t in GROUP BY" }, -{ "ER_WRONG_GROUP_FIELD", 1056, "Can\'t group on \'%-.192s\'" }, -{ "ER_WRONG_SUM_SELECT", 1057, "Statement has sum functions and columns in same statement" }, -{ "ER_WRONG_VALUE_COUNT", 1058, "Column count doesn\'t match value count" }, -{ "ER_TOO_LONG_IDENT", 1059, "Identifier name \'%-.100T\' is too long" }, -{ "ER_DUP_FIELDNAME", 1060, "Duplicate column name \'%-.192s\'" }, -{ "ER_DUP_KEYNAME", 1061, "Duplicate key name \'%-.192s\'" }, -{ "ER_DUP_ENTRY", 1062, "Duplicate entry \'%-.192T\' for key %d" }, -{ "ER_WRONG_FIELD_SPEC", 1063, "Incorrect column specifier for column \'%-.192s\'" }, -{ "ER_PARSE_ERROR", 1064, "%s near \'%-.80T\' at line %d" }, -{ "ER_EMPTY_QUERY", 1065, "Query was empty" }, -{ "ER_NONUNIQ_TABLE", 1066, "Not unique table/alias: \'%-.192s\'" }, -{ "ER_INVALID_DEFAULT", 1067, "Invalid default value for \'%-.192s\'" }, -{ "ER_MULTIPLE_PRI_KEY", 1068, "Multiple primary key defined" }, -{ "ER_TOO_MANY_KEYS", 1069, "Too many keys specified; max %d keys allowed" }, -{ "ER_TOO_MANY_KEY_PARTS", 1070, "Too many key parts specified; max %d parts allowed" }, -{ "ER_TOO_LONG_KEY", 1071, "Specified key was too long; max key length is %d bytes" }, -{ "ER_KEY_COLUMN_DOES_NOT_EXITS", 1072, "Key column \'%-.192s\' doesn\'t exist in table" }, -{ "ER_BLOB_USED_AS_KEY", 1073, "BLOB column %`s can\'t be used in key specification in the %s table" }, -{ "ER_TOO_BIG_FIELDLENGTH", 1074, "Column length too big for column \'%-.192s\' (max = %lu); use BLOB or TEXT instead" }, -{ "ER_WRONG_AUTO_KEY", 1075, "Incorrect table definition; there can be only one auto column and it must be defined as a key" }, -{ "ER_BINLOG_CANT_DELETE_GTID_DOMAIN", 1076, "Could not delete gtid domain. Reason: %s." }, -{ "ER_NORMAL_SHUTDOWN", 1077, "%s (initiated by: %s): Normal shutdown" }, -{ "ER_GOT_SIGNAL", 1078, "%s: Got signal %d. Aborting!\n" }, -{ "ER_SHUTDOWN_COMPLETE", 1079, "%s: Shutdown complete\n" }, -{ "ER_FORCING_CLOSE", 1080, "%s: Forcing close of thread %ld user: \'%-.48s\'\n" }, -{ "ER_IPSOCK_ERROR", 1081, "Can\'t create IP socket" }, -{ "ER_NO_SUCH_INDEX", 1082, "Table \'%-.192s\' has no index like the one used in CREATE INDEX; recreate the table" }, -{ "ER_WRONG_FIELD_TERMINATORS", 1083, "Field separator argument is not what is expected; check the manual" }, -{ "ER_BLOBS_AND_NO_TERMINATED", 1084, "You can\'t use fixed rowlength with BLOBs; please use \'fields terminated by\'" }, -{ "ER_TEXTFILE_NOT_READABLE", 1085, "The file \'%-.128s\' must be in the database directory or be readable by all" }, -{ "ER_FILE_EXISTS_ERROR", 1086, "File \'%-.200s\' already exists" }, -{ "ER_LOAD_INFO", 1087, "Records: %ld Deleted: %ld Skipped: %ld Warnings: %ld" }, -{ "ER_ALTER_INFO", 1088, "Records: %ld Duplicates: %ld" }, -{ "ER_WRONG_SUB_KEY", 1089, "Incorrect prefix key; the used key part isn\'t a string, the used length is longer than the key part, or the storage engine doesn\'t support unique prefix keys" }, -{ "ER_CANT_REMOVE_ALL_FIELDS", 1090, "You can\'t delete all columns with ALTER TABLE; use DROP TABLE instead" }, -{ "ER_CANT_DROP_FIELD_OR_KEY", 1091, "Can\'t DROP %s %`-.192s; check that it exists" }, -{ "ER_INSERT_INFO", 1092, "Records: %ld Duplicates: %ld Warnings: %ld" }, -{ "ER_UPDATE_TABLE_USED", 1093, "Table \'%-.192s\' is specified twice, both as a target for \'%s\' and as a separate source for data" }, -{ "ER_NO_SUCH_THREAD", 1094, "Unknown thread id: %lu" }, -{ "ER_KILL_DENIED_ERROR", 1095, "You are not owner of thread %lu" }, -{ "ER_NO_TABLES_USED", 1096, "No tables used" }, -{ "ER_TOO_BIG_SET", 1097, "Too many strings for column %-.192s and SET" }, -{ "ER_NO_UNIQUE_LOGFILE", 1098, "Can\'t generate a unique log-filename %-.200s.(1-999)\n" }, -{ "ER_TABLE_NOT_LOCKED_FOR_WRITE", 1099, "Table \'%-.192s\' was locked with a READ lock and can\'t be updated" }, -{ "ER_TABLE_NOT_LOCKED", 1100, "Table \'%-.192s\' was not locked with LOCK TABLES" }, -{ "ER_UNUSED_17", 1101, "You should never see it" }, -{ "ER_WRONG_DB_NAME", 1102, "Incorrect database name \'%-.100T\'" }, -{ "ER_WRONG_TABLE_NAME", 1103, "Incorrect table name \'%-.100s\'" }, -{ "ER_TOO_BIG_SELECT", 1104, "The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay" }, -{ "ER_UNKNOWN_ERROR", 1105, "Unknown error" }, -{ "ER_UNKNOWN_PROCEDURE", 1106, "Unknown procedure \'%-.192s\'" }, -{ "ER_WRONG_PARAMCOUNT_TO_PROCEDURE", 1107, "Incorrect parameter count to procedure \'%-.192s\'" }, -{ "ER_WRONG_PARAMETERS_TO_PROCEDURE", 1108, "Incorrect parameters to procedure \'%-.192s\'" }, -{ "ER_UNKNOWN_TABLE", 1109, "Unknown table \'%-.192s\' in %-.32s" }, -{ "ER_FIELD_SPECIFIED_TWICE", 1110, "Column \'%-.192s\' specified twice" }, -{ "ER_INVALID_GROUP_FUNC_USE", 1111, "Invalid use of group function" }, -{ "ER_UNSUPPORTED_EXTENSION", 1112, "Table \'%-.192s\' uses an extension that doesn\'t exist in this MariaDB version" }, -{ "ER_TABLE_MUST_HAVE_COLUMNS", 1113, "A table must have at least 1 column" }, -{ "ER_RECORD_FILE_FULL", 1114, "The table \'%-.192s\' is full" }, -{ "ER_UNKNOWN_CHARACTER_SET", 1115, "Unknown character set: \'%-.64s\'" }, -{ "ER_TOO_MANY_TABLES", 1116, "Too many tables; MariaDB can only use %d tables in a join" }, -{ "ER_TOO_MANY_FIELDS", 1117, "Too many columns" }, -{ "ER_TOO_BIG_ROWSIZE", 1118, "Row size too large. The maximum row size for the used table type, not counting BLOBs, is %ld. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs" }, -{ "ER_STACK_OVERRUN", 1119, "Thread stack overrun: Used: %ld of a %ld stack. Consider increasing the thread_stack system variable" }, -{ "ER_WRONG_OUTER_JOIN", 1120, "Cross dependency found in OUTER JOIN; examine your ON conditions" }, -{ "ER_NULL_COLUMN_IN_INDEX", 1121, "Table handler doesn\'t support NULL in given index. Please change column \'%-.192s\' to be NOT NULL or use another handler" }, -{ "ER_CANT_FIND_UDF", 1122, "Can\'t load function \'%-.192s\'" }, -{ "ER_CANT_INITIALIZE_UDF", 1123, "Can\'t initialize function \'%-.192s\'; %-.80s" }, -{ "ER_UDF_NO_PATHS", 1124, "No paths allowed for shared library" }, -{ "ER_UDF_EXISTS", 1125, "Function \'%-.192s\' already exists" }, -{ "ER_CANT_OPEN_LIBRARY", 1126, "Can\'t open shared library \'%-.192s\' (errno: %d, %-.128s)" }, -{ "ER_CANT_FIND_DL_ENTRY", 1127, "Can\'t find symbol \'%-.128s\' in library" }, -{ "ER_FUNCTION_NOT_DEFINED", 1128, "Function \'%-.192s\' is not defined" }, -{ "ER_HOST_IS_BLOCKED", 1129, "Host \'%-.64s\' is blocked because of many connection errors; unblock with \'mariadb-admin flush-hosts\'" }, -{ "ER_HOST_NOT_PRIVILEGED", 1130, "Host \'%-.64s\' is not allowed to connect to this MariaDB server" }, -{ "ER_PASSWORD_ANONYMOUS_USER", 1131, "You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings" }, -{ "ER_PASSWORD_NOT_ALLOWED", 1132, "You must have privileges to update tables in the mysql database to be able to change passwords for others" }, -{ "ER_PASSWORD_NO_MATCH", 1133, "Can\'t find any matching row in the user table" }, -{ "ER_UPDATE_INFO", 1134, "Rows matched: %ld Changed: %ld Warnings: %ld" }, -{ "ER_CANT_CREATE_THREAD", 1135, "Can\'t create a new thread (errno %M); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug" }, -{ "ER_WRONG_VALUE_COUNT_ON_ROW", 1136, "Column count doesn\'t match value count at row %lu" }, -{ "ER_CANT_REOPEN_TABLE", 1137, "Can\'t reopen table: \'%-.192s\'" }, -{ "ER_INVALID_USE_OF_NULL", 1138, "Invalid use of NULL value" }, -{ "ER_REGEXP_ERROR", 1139, "Regex error \'%s\'" }, -{ "ER_MIX_OF_GROUP_FUNC_AND_FIELDS", 1140, "Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause" }, -{ "ER_NONEXISTING_GRANT", 1141, "There is no such grant defined for user \'%-.48s\' on host \'%-.64s\'" }, -{ "ER_TABLEACCESS_DENIED_ERROR", 1142, "%-.100T command denied to user \'%s\'@\'%s\' for table \'%-.192s\'" }, -{ "ER_COLUMNACCESS_DENIED_ERROR", 1143, "%-.32s command denied to user \'%s\'@\'%s\' for column \'%-.192s\' in table \'%-.192s\'" }, -{ "ER_ILLEGAL_GRANT_FOR_TABLE", 1144, "Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used" }, -{ "ER_GRANT_WRONG_HOST_OR_USER", 1145, "The host or user argument to GRANT is too long" }, -{ "ER_NO_SUCH_TABLE", 1146, "Table \'%-.192s.%-.192s\' doesn\'t exist" }, -{ "ER_NONEXISTING_TABLE_GRANT", 1147, "There is no such grant defined for user \'%-.48s\' on host \'%-.64s\' on table \'%-.192s\'" }, -{ "ER_NOT_ALLOWED_COMMAND", 1148, "The used command is not allowed with this MariaDB version" }, -{ "ER_SYNTAX_ERROR", 1149, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use" }, -{ "ER_DELAYED_CANT_CHANGE_LOCK", 1150, "Delayed insert thread couldn\'t get requested lock for table %-.192s" }, -{ "ER_TOO_MANY_DELAYED_THREADS", 1151, "Too many delayed threads in use" }, -{ "ER_ABORTING_CONNECTION", 1152, "Aborted connection %ld to db: \'%-.192s\' user: \'%-.48s\' (%-.64s)" }, -{ "ER_NET_PACKET_TOO_LARGE", 1153, "Got a packet bigger than \'max_allowed_packet\' bytes" }, -{ "ER_NET_READ_ERROR_FROM_PIPE", 1154, "Got a read error from the connection pipe" }, -{ "ER_NET_FCNTL_ERROR", 1155, "Got an error from fcntl()" }, -{ "ER_NET_PACKETS_OUT_OF_ORDER", 1156, "Got packets out of order" }, -{ "ER_NET_UNCOMPRESS_ERROR", 1157, "Couldn\'t uncompress communication packet" }, -{ "ER_NET_READ_ERROR", 1158, "Got an error reading communication packets" }, -{ "ER_NET_READ_INTERRUPTED", 1159, "Got timeout reading communication packets" }, -{ "ER_NET_ERROR_ON_WRITE", 1160, "Got an error writing communication packets" }, -{ "ER_NET_WRITE_INTERRUPTED", 1161, "Got timeout writing communication packets" }, -{ "ER_TOO_LONG_STRING", 1162, "Result string is longer than \'max_allowed_packet\' bytes" }, -{ "ER_TABLE_CANT_HANDLE_BLOB", 1163, "Storage engine %s doesn\'t support BLOB/TEXT columns" }, -{ "ER_TABLE_CANT_HANDLE_AUTO_INCREMENT", 1164, "Storage engine %s doesn\'t support AUTO_INCREMENT columns" }, -{ "ER_DELAYED_INSERT_TABLE_LOCKED", 1165, "INSERT DELAYED can\'t be used with table \'%-.192s\' because it is locked with LOCK TABLES" }, -{ "ER_WRONG_COLUMN_NAME", 1166, "Incorrect column name \'%-.100s\'" }, -{ "ER_WRONG_KEY_COLUMN", 1167, "The storage engine %s can\'t index column %`s" }, -{ "ER_WRONG_MRG_TABLE", 1168, "Unable to open underlying table which is differently defined or of non-MyISAM type or doesn\'t exist" }, -{ "ER_DUP_UNIQUE", 1169, "Can\'t write, because of unique constraint, to table \'%-.192s\'" }, -{ "ER_BLOB_KEY_WITHOUT_LENGTH", 1170, "BLOB/TEXT column \'%-.192s\' used in key specification without a key length" }, -{ "ER_PRIMARY_CANT_HAVE_NULL", 1171, "All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead" }, -{ "ER_TOO_MANY_ROWS", 1172, "Result consisted of more than one row" }, -{ "ER_REQUIRES_PRIMARY_KEY", 1173, "This table type requires a primary key" }, -{ "ER_NO_RAID_COMPILED", 1174, "This version of MariaDB is not compiled with RAID support" }, -{ "ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE", 1175, "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column" }, -{ "ER_KEY_DOES_NOT_EXISTS", 1176, "Key \'%-.192s\' doesn\'t exist in table \'%-.192s\'" }, -{ "ER_CHECK_NO_SUCH_TABLE", 1177, "Can\'t open table" }, -{ "ER_CHECK_NOT_IMPLEMENTED", 1178, "The storage engine for the table doesn\'t support %s" }, -{ "ER_CANT_DO_THIS_DURING_AN_TRANSACTION", 1179, "You are not allowed to execute this command in a transaction" }, -{ "ER_ERROR_DURING_COMMIT", 1180, "Got error %M during COMMIT" }, -{ "ER_ERROR_DURING_ROLLBACK", 1181, "Got error %M during ROLLBACK" }, -{ "ER_ERROR_DURING_FLUSH_LOGS", 1182, "Got error %M during FLUSH_LOGS" }, -{ "ER_ERROR_DURING_CHECKPOINT", 1183, "Got error %M during CHECKPOINT" }, -{ "ER_NEW_ABORTING_CONNECTION", 1184, "Aborted connection %lld to db: \'%-.192s\' user: \'%-.48s\' host: \'%-.64s\' (%-.64s)" }, -{ "ER_UNUSED_10", 1185, "You should never see it" }, -{ "ER_FLUSH_MASTER_BINLOG_CLOSED", 1186, "Binlog closed, cannot RESET MASTER" }, -{ "ER_INDEX_REBUILD", 1187, "Failed rebuilding the index of dumped table \'%-.192s\'" }, -{ "ER_MASTER", 1188, "Error from master: \'%-.64s\'" }, -{ "ER_MASTER_NET_READ", 1189, "Net error reading from master" }, -{ "ER_MASTER_NET_WRITE", 1190, "Net error writing to master" }, -{ "ER_FT_MATCHING_KEY_NOT_FOUND", 1191, "Can\'t find FULLTEXT index matching the column list" }, -{ "ER_LOCK_OR_ACTIVE_TRANSACTION", 1192, "Can\'t execute the given command because you have active locked tables or an active transaction" }, -{ "ER_UNKNOWN_SYSTEM_VARIABLE", 1193, "Unknown system variable \'%-.*s\'" }, -{ "ER_CRASHED_ON_USAGE", 1194, "Table \'%-.192s\' is marked as crashed and should be repaired" }, -{ "ER_CRASHED_ON_REPAIR", 1195, "Table \'%-.192s\' is marked as crashed and last (automatic?) repair failed" }, -{ "ER_WARNING_NOT_COMPLETE_ROLLBACK", 1196, "Some non-transactional changed tables couldn\'t be rolled back" }, -{ "ER_TRANS_CACHE_FULL", 1197, "Multi-statement transaction required more than \'max_binlog_cache_size\' bytes of storage" }, -{ "ER_SLAVE_MUST_STOP", 1198, "This operation cannot be performed as you have a running slave \'%2$*1$s\'; run STOP SLAVE \'%2$*1$s\' first" }, -{ "ER_SLAVE_NOT_RUNNING", 1199, "This operation requires a running slave; configure slave and do START SLAVE" }, -{ "ER_BAD_SLAVE", 1200, "The server is not configured as slave; fix in config file or with CHANGE MASTER TO" }, -{ "ER_MASTER_INFO", 1201, "Could not initialize master info structure for \'%.*s\'; more error messages can be found in the MariaDB error log" }, -{ "ER_SLAVE_THREAD", 1202, "Could not create slave thread; check system resources" }, -{ "ER_TOO_MANY_USER_CONNECTIONS", 1203, "User %-.64s already has more than \'max_user_connections\' active connections" }, -{ "ER_SET_CONSTANTS_ONLY", 1204, "You may only use constant expressions in this statement" }, -{ "ER_LOCK_WAIT_TIMEOUT", 1205, "Lock wait timeout exceeded; try restarting transaction" }, -{ "ER_LOCK_TABLE_FULL", 1206, "The total number of locks exceeds the lock table size" }, -{ "ER_READ_ONLY_TRANSACTION", 1207, "Update locks cannot be acquired during a READ UNCOMMITTED transaction" }, -{ "ER_DROP_DB_WITH_READ_LOCK", 1208, "DROP DATABASE not allowed while thread is holding global read lock" }, -{ "ER_CREATE_DB_WITH_READ_LOCK", 1209, "CREATE DATABASE not allowed while thread is holding global read lock" }, -{ "ER_WRONG_ARGUMENTS", 1210, "Incorrect arguments to %s" }, -{ "ER_NO_PERMISSION_TO_CREATE_USER", 1211, "\'%s\'@\'%s\' is not allowed to create new users" }, -{ "ER_UNION_TABLES_IN_DIFFERENT_DIR", 1212, "Incorrect table definition; all MERGE tables must be in the same database" }, -{ "ER_LOCK_DEADLOCK", 1213, "Deadlock found when trying to get lock; try restarting transaction" }, -{ "ER_TABLE_CANT_HANDLE_FT", 1214, "The storage engine %s doesn\'t support FULLTEXT indexes" }, -{ "ER_CANNOT_ADD_FOREIGN", 1215, "Cannot add foreign key constraint for `%s`" }, -{ "ER_NO_REFERENCED_ROW", 1216, "Cannot add or update a child row: a foreign key constraint fails" }, -{ "ER_ROW_IS_REFERENCED", 1217, "Cannot delete or update a parent row: a foreign key constraint fails" }, -{ "ER_CONNECT_TO_MASTER", 1218, "Error connecting to master: %-.128s" }, -{ "ER_QUERY_ON_MASTER", 1219, "Error running query on master: %-.128s" }, -{ "ER_ERROR_WHEN_EXECUTING_COMMAND", 1220, "Error when executing command %s: %-.128s" }, -{ "ER_WRONG_USAGE", 1221, "Incorrect usage of %s and %s" }, -{ "ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT", 1222, "The used SELECT statements have a different number of columns" }, -{ "ER_CANT_UPDATE_WITH_READLOCK", 1223, "Can\'t execute the query because you have a conflicting read lock" }, -{ "ER_MIXING_NOT_ALLOWED", 1224, "Mixing of transactional and non-transactional tables is disabled" }, -{ "ER_DUP_ARGUMENT", 1225, "Option \'%s\' used twice in statement" }, -{ "ER_USER_LIMIT_REACHED", 1226, "User \'%-.64s\' has exceeded the \'%s\' resource (current value: %ld)" }, -{ "ER_SPECIFIC_ACCESS_DENIED_ERROR", 1227, "Access denied; you need (at least one of) the %-.128s privilege(s) for this operation" }, -{ "ER_LOCAL_VARIABLE", 1228, "Variable \'%-.64s\' is a SESSION variable and can\'t be used with SET GLOBAL" }, -{ "ER_GLOBAL_VARIABLE", 1229, "Variable \'%-.64s\' is a GLOBAL variable and should be set with SET GLOBAL" }, -{ "ER_NO_DEFAULT", 1230, "Variable \'%-.64s\' doesn\'t have a default value" }, -{ "ER_WRONG_VALUE_FOR_VAR", 1231, "Variable \'%-.64s\' can\'t be set to the value of \'%-.200T\'" }, -{ "ER_WRONG_TYPE_FOR_VAR", 1232, "Incorrect argument type to variable \'%-.64s\'" }, -{ "ER_VAR_CANT_BE_READ", 1233, "Variable \'%-.64s\' can only be set, not read" }, -{ "ER_CANT_USE_OPTION_HERE", 1234, "Incorrect usage/placement of \'%s\'" }, -{ "ER_NOT_SUPPORTED_YET", 1235, "This version of MariaDB doesn\'t yet support \'%s\'" }, -{ "ER_MASTER_FATAL_ERROR_READING_BINLOG", 1236, "Got fatal error %d from master when reading data from binary log: \'%-.320s\'" }, -{ "ER_SLAVE_IGNORED_TABLE", 1237, "Slave SQL thread ignored the query because of replicate-*-table rules" }, -{ "ER_INCORRECT_GLOBAL_LOCAL_VAR", 1238, "Variable \'%-.192s\' is a %s variable" }, -{ "ER_WRONG_FK_DEF", 1239, "Incorrect foreign key definition for \'%-.192s\': %s" }, -{ "ER_KEY_REF_DO_NOT_MATCH_TABLE_REF", 1240, "Key reference and table reference don\'t match" }, -{ "ER_OPERAND_COLUMNS", 1241, "Operand should contain %d column(s)" }, -{ "ER_SUBQUERY_NO_1_ROW", 1242, "Subquery returns more than 1 row" }, -{ "ER_UNKNOWN_STMT_HANDLER", 1243, "Unknown prepared statement handler (%.*s) given to %s" }, -{ "ER_CORRUPT_HELP_DB", 1244, "Help database is corrupt or does not exist" }, -{ "ER_CYCLIC_REFERENCE", 1245, "Cyclic reference on subqueries" }, -{ "ER_AUTO_CONVERT", 1246, "Converting column \'%s\' from %s to %s" }, -{ "ER_ILLEGAL_REFERENCE", 1247, "Reference \'%-.64s\' not supported (%s)" }, -{ "ER_DERIVED_MUST_HAVE_ALIAS", 1248, "Every derived table must have its own alias" }, -{ "ER_SELECT_REDUCED", 1249, "Select %u was reduced during optimization" }, -{ "ER_TABLENAME_NOT_ALLOWED_HERE", 1250, "Table \'%-.192s\' from one of the SELECTs cannot be used in %-.32s" }, -{ "ER_NOT_SUPPORTED_AUTH_MODE", 1251, "Client does not support authentication protocol requested by server; consider upgrading MariaDB client" }, -{ "ER_SPATIAL_CANT_HAVE_NULL", 1252, "All parts of a SPATIAL index must be NOT NULL" }, -{ "ER_COLLATION_CHARSET_MISMATCH", 1253, "COLLATION \'%s\' is not valid for CHARACTER SET \'%s\'" }, -{ "ER_SLAVE_WAS_RUNNING", 1254, "Slave is already running" }, -{ "ER_SLAVE_WAS_NOT_RUNNING", 1255, "Slave already has been stopped" }, -{ "ER_TOO_BIG_FOR_UNCOMPRESS", 1256, "Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)" }, -{ "ER_ZLIB_Z_MEM_ERROR", 1257, "ZLIB: Not enough memory" }, -{ "ER_ZLIB_Z_BUF_ERROR", 1258, "ZLIB: Not enough room in the output buffer (probably, length of uncompressed data was corrupted)" }, -{ "ER_ZLIB_Z_DATA_ERROR", 1259, "ZLIB: Input data corrupted" }, -{ "ER_CUT_VALUE_GROUP_CONCAT", 1260, "Row %u was cut by %s)" }, -{ "ER_WARN_TOO_FEW_RECORDS", 1261, "Row %lu doesn\'t contain data for all columns" }, -{ "ER_WARN_TOO_MANY_RECORDS", 1262, "Row %lu was truncated; it contained more data than there were input columns" }, -{ "ER_WARN_NULL_TO_NOTNULL", 1263, "Column set to default value; NULL supplied to NOT NULL column \'%s\' at row %lu" }, -{ "ER_WARN_DATA_OUT_OF_RANGE", 1264, "Out of range value for column \'%s\' at row %lu" }, -{ "WARN_DATA_TRUNCATED", 1265, "Data truncated for column \'%s\' at row %lu" }, -{ "ER_WARN_USING_OTHER_HANDLER", 1266, "Using storage engine %s for table \'%s\'" }, -{ "ER_CANT_AGGREGATE_2COLLATIONS", 1267, "Illegal mix of collations (%s,%s) and (%s,%s) for operation \'%s\'" }, -{ "ER_DROP_USER", 1268, "Cannot drop one or more of the requested users" }, -{ "ER_REVOKE_GRANTS", 1269, "Can\'t revoke all privileges for one or more of the requested users" }, -{ "ER_CANT_AGGREGATE_3COLLATIONS", 1270, "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation \'%s\'" }, -{ "ER_CANT_AGGREGATE_NCOLLATIONS", 1271, "Illegal mix of collations for operation \'%s\'" }, -{ "ER_VARIABLE_IS_NOT_STRUCT", 1272, "Variable \'%-.64s\' is not a variable component (can\'t be used as XXXX.variable_name)" }, -{ "ER_UNKNOWN_COLLATION", 1273, "Unknown collation: \'%-.64s\'" }, -{ "ER_SLAVE_IGNORED_SSL_PARAMS", 1274, "SSL parameters in CHANGE MASTER are ignored because this MariaDB slave was compiled without SSL support; they can be used later if MariaDB slave with SSL is started" }, -{ "ER_SERVER_IS_IN_SECURE_AUTH_MODE", 1275, "Server is running in --secure-auth mode, but \'%s\'@\'%s\' has a password in the old format; please change the password to the new format" }, -{ "ER_WARN_FIELD_RESOLVED", 1276, "Field or reference \'%-.192s%s%-.192s%s%-.192s\' of SELECT #%d was resolved in SELECT #%d" }, -{ "ER_BAD_SLAVE_UNTIL_COND", 1277, "Incorrect parameter or combination of parameters for START SLAVE UNTIL" }, -{ "ER_MISSING_SKIP_SLAVE", 1278, "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave\'s mariadbd restart" }, -{ "ER_UNTIL_COND_IGNORED", 1279, "SQL thread is not to be started so UNTIL options are ignored" }, -{ "ER_WRONG_NAME_FOR_INDEX", 1280, "Incorrect index name \'%-.100s\'" }, -{ "ER_WRONG_NAME_FOR_CATALOG", 1281, "Incorrect catalog name \'%-.100s\'" }, -{ "ER_WARN_QC_RESIZE", 1282, "Query cache failed to set size %llu; new query cache size is %lu" }, -{ "ER_BAD_FT_COLUMN", 1283, "Column \'%-.192s\' cannot be part of FULLTEXT index" }, -{ "ER_UNKNOWN_KEY_CACHE", 1284, "Unknown key cache \'%-.100s\'" }, -{ "ER_WARN_HOSTNAME_WONT_WORK", 1285, "MariaDB is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work" }, -{ "ER_UNKNOWN_STORAGE_ENGINE", 1286, "Unknown storage engine \'%s\'" }, -{ "ER_WARN_DEPRECATED_SYNTAX", 1287, "\'%s\' is deprecated and will be removed in a future release. Please use %s instead" }, -{ "ER_NON_UPDATABLE_TABLE", 1288, "The target table %-.100s of the %s is not updatable" }, -{ "ER_FEATURE_DISABLED", 1289, "The \'%s\' feature is disabled; you need MariaDB built with \'%s\' to have it working" }, -{ "ER_OPTION_PREVENTS_STATEMENT", 1290, "The MariaDB server is running with the %s option so it cannot execute this statement" }, -{ "ER_DUPLICATED_VALUE_IN_TYPE", 1291, "Column \'%-.100s\' has duplicated value \'%-.64s\' in %s" }, -{ "ER_TRUNCATED_WRONG_VALUE", 1292, "Truncated incorrect %-.32T value: \'%-.128T\'" }, -{ "ER_TOO_MUCH_AUTO_TIMESTAMP_COLS", 1293, "Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause" }, -{ "ER_INVALID_ON_UPDATE", 1294, "Invalid ON UPDATE clause for \'%-.192s\' column" }, -{ "ER_UNSUPPORTED_PS", 1295, "This command is not supported in the prepared statement protocol yet" }, -{ "ER_GET_ERRMSG", 1296, "Got error %d \'%-.200s\' from %s" }, -{ "ER_GET_TEMPORARY_ERRMSG", 1297, "Got temporary error %d \'%-.200s\' from %s" }, -{ "ER_UNKNOWN_TIME_ZONE", 1298, "Unknown or incorrect time zone: \'%-.64s\'" }, -{ "ER_WARN_INVALID_TIMESTAMP", 1299, "Invalid TIMESTAMP value in column \'%s\' at row %lu" }, -{ "ER_INVALID_CHARACTER_STRING", 1300, "Invalid %s character string: \'%.64T\'" }, -{ "ER_WARN_ALLOWED_PACKET_OVERFLOWED", 1301, "Result of %s() was larger than max_allowed_packet (%ld) - truncated" }, -{ "ER_CONFLICTING_DECLARATIONS", 1302, "Conflicting declarations: \'%s%s\' and \'%s%s\'" }, -{ "ER_SP_NO_RECURSIVE_CREATE", 1303, "Can\'t create a %s from within another stored routine" }, -{ "ER_SP_ALREADY_EXISTS", 1304, "%s %s already exists" }, -{ "ER_SP_DOES_NOT_EXIST", 1305, "%s %s does not exist" }, -{ "ER_SP_DROP_FAILED", 1306, "Failed to DROP %s %s" }, -{ "ER_SP_STORE_FAILED", 1307, "Failed to CREATE %s %s" }, -{ "ER_SP_LILABEL_MISMATCH", 1308, "%s with no matching label: %s" }, -{ "ER_SP_LABEL_REDEFINE", 1309, "Redefining label %s" }, -{ "ER_SP_LABEL_MISMATCH", 1310, "End-label %s without match" }, -{ "ER_SP_UNINIT_VAR", 1311, "Referring to uninitialized variable %s" }, -{ "ER_SP_BADSELECT", 1312, "PROCEDURE %s can\'t return a result set in the given context" }, -{ "ER_SP_BADRETURN", 1313, "RETURN is only allowed in a FUNCTION" }, -{ "ER_SP_BADSTATEMENT", 1314, "%s is not allowed in stored procedures" }, -{ "ER_UPDATE_LOG_DEPRECATED_IGNORED", 1315, "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MariaDB 5.6" }, -{ "ER_UPDATE_LOG_DEPRECATED_TRANSLATED", 1316, "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN. This option will be removed in MariaDB 5.6" }, -{ "ER_QUERY_INTERRUPTED", 1317, "Query execution was interrupted" }, -{ "ER_SP_WRONG_NO_OF_ARGS", 1318, "Incorrect number of arguments for %s %s; expected %u, got %u" }, -{ "ER_SP_COND_MISMATCH", 1319, "Undefined CONDITION: %s" }, -{ "ER_SP_NORETURN", 1320, "No RETURN found in FUNCTION %s" }, -{ "ER_SP_NORETURNEND", 1321, "FUNCTION %s ended without RETURN" }, -{ "ER_SP_BAD_CURSOR_QUERY", 1322, "Cursor statement must be a SELECT" }, -{ "ER_SP_BAD_CURSOR_SELECT", 1323, "Cursor SELECT must not have INTO" }, -{ "ER_SP_CURSOR_MISMATCH", 1324, "Undefined CURSOR: %s" }, -{ "ER_SP_CURSOR_ALREADY_OPEN", 1325, "Cursor is already open" }, -{ "ER_SP_CURSOR_NOT_OPEN", 1326, "Cursor is not open" }, -{ "ER_SP_UNDECLARED_VAR", 1327, "Undeclared variable: %s" }, -{ "ER_SP_WRONG_NO_OF_FETCH_ARGS", 1328, "Incorrect number of FETCH variables" }, -{ "ER_SP_FETCH_NO_DATA", 1329, "No data - zero rows fetched, selected, or processed" }, -{ "ER_SP_DUP_PARAM", 1330, "Duplicate parameter: %s" }, -{ "ER_SP_DUP_VAR", 1331, "Duplicate variable: %s" }, -{ "ER_SP_DUP_COND", 1332, "Duplicate condition: %s" }, -{ "ER_SP_DUP_CURS", 1333, "Duplicate cursor: %s" }, -{ "ER_SP_CANT_ALTER", 1334, "Failed to ALTER %s %s" }, -{ "ER_SP_SUBSELECT_NYI", 1335, "Subquery value not supported" }, -{ "ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG", 1336, "%s is not allowed in stored function or trigger" }, -{ "ER_SP_VARCOND_AFTER_CURSHNDLR", 1337, "Variable or condition declaration after cursor or handler declaration" }, -{ "ER_SP_CURSOR_AFTER_HANDLER", 1338, "Cursor declaration after handler declaration" }, -{ "ER_SP_CASE_NOT_FOUND", 1339, "Case not found for CASE statement" }, -{ "ER_FPARSER_TOO_BIG_FILE", 1340, "Configuration file \'%-.192s\' is too big" }, -{ "ER_FPARSER_BAD_HEADER", 1341, "Malformed file type header in file \'%-.192s\'" }, -{ "ER_FPARSER_EOF_IN_COMMENT", 1342, "Unexpected end of file while parsing comment \'%-.200s\'" }, -{ "ER_FPARSER_ERROR_IN_PARAMETER", 1343, "Error while parsing parameter \'%-.192s\' (line: \'%-.192s\')" }, -{ "ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER", 1344, "Unexpected end of file while skipping unknown parameter \'%-.192s\'" }, -{ "ER_VIEW_NO_EXPLAIN", 1345, "ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table" }, -{ "ER_FRM_UNKNOWN_TYPE", 1346, "File \'%-.192s\' has unknown type \'%-.64s\' in its header" }, -{ "ER_WRONG_OBJECT", 1347, "\'%-.192s.%-.192s\' is not of type \'%s\'" }, -{ "ER_NONUPDATEABLE_COLUMN", 1348, "Column \'%-.192s\' is not updatable" }, -{ "ER_VIEW_SELECT_DERIVED", 1349, "View\'s SELECT contains a subquery in the FROM clause" }, -{ "ER_VIEW_SELECT_CLAUSE", 1350, "View\'s SELECT contains a \'%s\' clause" }, -{ "ER_VIEW_SELECT_VARIABLE", 1351, "View\'s SELECT contains a variable or parameter" }, -{ "ER_VIEW_SELECT_TMPTABLE", 1352, "View\'s SELECT refers to a temporary table \'%-.192s\'" }, -{ "ER_VIEW_WRONG_LIST", 1353, "View\'s SELECT and view\'s field list have different column counts" }, -{ "ER_WARN_VIEW_MERGE", 1354, "View merge algorithm can\'t be used here for now (assumed undefined algorithm)" }, -{ "ER_WARN_VIEW_WITHOUT_KEY", 1355, "View being updated does not have complete key of underlying table in it" }, -{ "ER_VIEW_INVALID", 1356, "View \'%-.192s.%-.192s\' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them" }, -{ "ER_SP_NO_DROP_SP", 1357, "Can\'t drop or alter a %s from within another stored routine" }, -{ "ER_SP_GOTO_IN_HNDLR", 1358, "GOTO is not allowed in a stored procedure handler" }, -{ "ER_TRG_ALREADY_EXISTS", 1359, "Trigger \'%s\' already exists" }, -{ "ER_TRG_DOES_NOT_EXIST", 1360, "Trigger does not exist" }, -{ "ER_TRG_ON_VIEW_OR_TEMP_TABLE", 1361, "Trigger\'s \'%-.192s\' is view or temporary table" }, -{ "ER_TRG_CANT_CHANGE_ROW", 1362, "Updating of %s row is not allowed in %strigger" }, -{ "ER_TRG_NO_SUCH_ROW_IN_TRG", 1363, "There is no %s row in %s trigger" }, -{ "ER_NO_DEFAULT_FOR_FIELD", 1364, "Field \'%-.192s\' doesn\'t have a default value" }, -{ "ER_DIVISION_BY_ZERO", 1365, "Division by 0" }, -{ "ER_TRUNCATED_WRONG_VALUE_FOR_FIELD", 1366, "Incorrect %-.32s value: \'%-.128T\' for column `%.192s`.`%.192s`.`%.192s` at row %lu" }, -{ "ER_ILLEGAL_VALUE_FOR_TYPE", 1367, "Illegal %s \'%-.192T\' value found during parsing" }, -{ "ER_VIEW_NONUPD_CHECK", 1368, "CHECK OPTION on non-updatable view %`-.192s.%`-.192s" }, -{ "ER_VIEW_CHECK_FAILED", 1369, "CHECK OPTION failed %`-.192s.%`-.192s" }, -{ "ER_PROCACCESS_DENIED_ERROR", 1370, "%-.32s command denied to user \'%s\'@\'%s\' for routine \'%-.192s\'" }, -{ "ER_RELAY_LOG_FAIL", 1371, "Failed purging old relay logs: %s" }, -{ "ER_PASSWD_LENGTH", 1372, "Password hash should be a %d-digit hexadecimal number" }, -{ "ER_UNKNOWN_TARGET_BINLOG", 1373, "Target log not found in binlog index" }, -{ "ER_IO_ERR_LOG_INDEX_READ", 1374, "I/O error reading log index file" }, -{ "ER_BINLOG_PURGE_PROHIBITED", 1375, "Server configuration does not permit binlog purge" }, -{ "ER_FSEEK_FAIL", 1376, "Failed on fseek()" }, -{ "ER_BINLOG_PURGE_FATAL_ERR", 1377, "Fatal error during log purge" }, -{ "ER_LOG_IN_USE", 1378, "A purgeable log is in use, will not purge" }, -{ "ER_LOG_PURGE_UNKNOWN_ERR", 1379, "Unknown error during log purge" }, -{ "ER_RELAY_LOG_INIT", 1380, "Failed initializing relay log position: %s" }, -{ "ER_NO_BINARY_LOGGING", 1381, "You are not using binary logging" }, -{ "ER_RESERVED_SYNTAX", 1382, "The \'%-.64s\' syntax is reserved for purposes internal to the MariaDB server" }, -{ "ER_WSAS_FAILED", 1383, "WSAStartup Failed" }, -{ "ER_DIFF_GROUPS_PROC", 1384, "Can\'t handle procedures with different groups yet" }, -{ "ER_NO_GROUP_FOR_PROC", 1385, "Select must have a group with this procedure" }, -{ "ER_ORDER_WITH_PROC", 1386, "Can\'t use ORDER clause with this procedure" }, -{ "ER_LOGGING_PROHIBIT_CHANGING_OF", 1387, "Binary logging and replication forbid changing the global server %s" }, -{ "ER_NO_FILE_MAPPING", 1388, "Can\'t map file: %-.200s, errno: %M" }, -{ "ER_WRONG_MAGIC", 1389, "Wrong magic in %-.64s" }, -{ "ER_PS_MANY_PARAM", 1390, "Prepared statement contains too many placeholders" }, -{ "ER_KEY_PART_0", 1391, "Key part \'%-.192s\' length cannot be 0" }, -{ "ER_VIEW_CHECKSUM", 1392, "View text checksum failed" }, -{ "ER_VIEW_MULTIUPDATE", 1393, "Can not modify more than one base table through a join view \'%-.192s.%-.192s\'" }, -{ "ER_VIEW_NO_INSERT_FIELD_LIST", 1394, "Can not insert into join view \'%-.192s.%-.192s\' without fields list" }, -{ "ER_VIEW_DELETE_MERGE_VIEW", 1395, "Can not delete from join view \'%-.192s.%-.192s\'" }, -{ "ER_CANNOT_USER", 1396, "Operation %s failed for %.256s" }, -{ "ER_XAER_NOTA", 1397, "XAER_NOTA: Unknown XID" }, -{ "ER_XAER_INVAL", 1398, "XAER_INVAL: Invalid arguments (or unsupported command)" }, -{ "ER_XAER_RMFAIL", 1399, "XAER_RMFAIL: The command cannot be executed when global transaction is in the %.64s state" }, -{ "ER_XAER_OUTSIDE", 1400, "XAER_OUTSIDE: Some work is done outside global transaction" }, -{ "ER_XAER_RMERR", 1401, "XAER_RMERR: Fatal error occurred in the transaction branch - check your data for consistency" }, -{ "ER_XA_RBROLLBACK", 1402, "XA_RBROLLBACK: Transaction branch was rolled back" }, -{ "ER_NONEXISTING_PROC_GRANT", 1403, "There is no such grant defined for user \'%-.48s\' on host \'%-.64s\' on routine \'%-.192s\'" }, -{ "ER_PROC_AUTO_GRANT_FAIL", 1404, "Failed to grant EXECUTE and ALTER ROUTINE privileges" }, -{ "ER_PROC_AUTO_REVOKE_FAIL", 1405, "Failed to revoke all privileges to dropped routine" }, -{ "ER_DATA_TOO_LONG", 1406, "Data too long for column \'%s\' at row %lu" }, -{ "ER_SP_BAD_SQLSTATE", 1407, "Bad SQLSTATE: \'%s\'" }, -{ "ER_STARTUP", 1408, "%s: ready for connections.\nVersion: \'%s\' socket: \'%s\' port: %d %s" }, -{ "ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR", 1409, "Can\'t load value from file with fixed size rows to variable" }, -{ "ER_CANT_CREATE_USER_WITH_GRANT", 1410, "You are not allowed to create a user with GRANT" }, -{ "ER_WRONG_VALUE_FOR_TYPE", 1411, "Incorrect %-.32s value: \'%-.128T\' for function %-.32s" }, -{ "ER_TABLE_DEF_CHANGED", 1412, "Table definition has changed, please retry transaction" }, -{ "ER_SP_DUP_HANDLER", 1413, "Duplicate handler declared in the same block" }, -{ "ER_SP_NOT_VAR_ARG", 1414, "OUT or INOUT argument %d for routine %s is not a variable or NEW pseudo-variable in BEFORE trigger" }, -{ "ER_SP_NO_RETSET", 1415, "Not allowed to return a result set from a %s" }, -{ "ER_CANT_CREATE_GEOMETRY_OBJECT", 1416, "Cannot get geometry object from data you send to the GEOMETRY field" }, -{ "ER_FAILED_ROUTINE_BREAK_BINLOG", 1417, "A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes" }, -{ "ER_BINLOG_UNSAFE_ROUTINE", 1418, "This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" }, -{ "ER_BINLOG_CREATE_ROUTINE_NEED_SUPER", 1419, "You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" }, -{ "ER_EXEC_STMT_WITH_OPEN_CURSOR", 1420, "You can\'t execute a prepared statement which has an open cursor associated with it. Reset the statement to re-execute it" }, -{ "ER_STMT_HAS_NO_OPEN_CURSOR", 1421, "The statement (%lu) has no open cursor" }, -{ "ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG", 1422, "Explicit or implicit commit is not allowed in stored function or trigger" }, -{ "ER_NO_DEFAULT_FOR_VIEW_FIELD", 1423, "Field of view \'%-.192s.%-.192s\' underlying table doesn\'t have a default value" }, -{ "ER_SP_NO_RECURSION", 1424, "Recursive stored functions and triggers are not allowed" }, -{ "ER_TOO_BIG_SCALE", 1425, "Too big scale %llu specified for \'%-.192s\'. Maximum is %u" }, -{ "ER_TOO_BIG_PRECISION", 1426, "Too big precision %llu specified for \'%-.192s\'. Maximum is %u" }, -{ "ER_M_BIGGER_THAN_D", 1427, "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column \'%-.192s\')" }, -{ "ER_WRONG_LOCK_OF_SYSTEM_TABLE", 1428, "You can\'t combine write-locking of system tables with other tables or lock types" }, -{ "ER_CONNECT_TO_FOREIGN_DATA_SOURCE", 1429, "Unable to connect to foreign data source: %.64s" }, -{ "ER_QUERY_ON_FOREIGN_DATA_SOURCE", 1430, "There was a problem processing the query on the foreign data source. Data source error: %-.64s" }, -{ "ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST", 1431, "The foreign data source you are trying to reference does not exist. Data source error: %-.64s" }, -{ "ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE", 1432, "Can\'t create federated table. The data source connection string \'%-.64s\' is not in the correct format" }, -{ "ER_FOREIGN_DATA_STRING_INVALID", 1433, "The data source connection string \'%-.64s\' is not in the correct format" }, -{ "ER_CANT_CREATE_FEDERATED_TABLE", 1434, "Can\'t create federated table. Foreign data src error: %-.64s" }, -{ "ER_TRG_IN_WRONG_SCHEMA", 1435, "Trigger in wrong schema" }, -{ "ER_STACK_OVERRUN_NEED_MORE", 1436, "Thread stack overrun: %ld bytes used of a %ld byte stack, and %ld bytes needed. Consider increasing the thread_stack system variable." }, -{ "ER_TOO_LONG_BODY", 1437, "Routine body for \'%-.100s\' is too long" }, -{ "ER_WARN_CANT_DROP_DEFAULT_KEYCACHE", 1438, "Cannot drop default keycache" }, -{ "ER_TOO_BIG_DISPLAYWIDTH", 1439, "Display width out of range for \'%-.192s\' (max = %lu)" }, -{ "ER_XAER_DUPID", 1440, "XAER_DUPID: The XID already exists" }, -{ "ER_DATETIME_FUNCTION_OVERFLOW", 1441, "Datetime function: %-.32s field overflow" }, -{ "ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG", 1442, "Can\'t update table \'%-.192s\' in stored function/trigger because it is already used by statement which invoked this stored function/trigger" }, -{ "ER_VIEW_PREVENT_UPDATE", 1443, "The definition of table \'%-.192s\' prevents operation %.192s on table \'%-.192s\'" }, -{ "ER_PS_NO_RECURSION", 1444, "The prepared statement contains a stored routine call that refers to that same statement. It\'s not allowed to execute a prepared statement in such a recursive manner" }, -{ "ER_SP_CANT_SET_AUTOCOMMIT", 1445, "Not allowed to set autocommit from a stored function or trigger" }, -{ "ER_MALFORMED_DEFINER", 1446, "Invalid definer" }, -{ "ER_VIEW_FRM_NO_USER", 1447, "View \'%-.192s\'.\'%-.192s\' has no definer information (old table format). Current user is used as definer. Please recreate the view!" }, -{ "ER_VIEW_OTHER_USER", 1448, "You need the SUPER privilege for creation view with \'%-.192s\'@\'%-.192s\' definer" }, -{ "ER_NO_SUCH_USER", 1449, "The user specified as a definer (\'%-.64s\'@\'%-.64s\') does not exist" }, -{ "ER_FORBID_SCHEMA_CHANGE", 1450, "Changing schema from \'%-.192s\' to \'%-.192s\' is not allowed" }, -{ "ER_ROW_IS_REFERENCED_2", 1451, "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)" }, -{ "ER_NO_REFERENCED_ROW_2", 1452, "Cannot add or update a child row: a foreign key constraint fails (%.192s)" }, -{ "ER_SP_BAD_VAR_SHADOW", 1453, "Variable \'%-.64s\' must be quoted with `...`, or renamed" }, -{ "ER_TRG_NO_DEFINER", 1454, "No definer attribute for trigger \'%-.192s\'.\'%-.192s\'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger" }, -{ "ER_OLD_FILE_FORMAT", 1455, "\'%-.192s\' has an old format, you should re-create the \'%s\' object(s)" }, -{ "ER_SP_RECURSION_LIMIT", 1456, "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.192s" }, -{ "ER_SP_PROC_TABLE_CORRUPT", 1457, "Failed to load routine %-.192s (internal code %d). For more details, run SHOW WARNINGS" }, -{ "ER_SP_WRONG_NAME", 1458, "Incorrect routine name \'%-.192s\'" }, -{ "ER_TABLE_NEEDS_UPGRADE", 1459, "Upgrade required. Please do \"REPAIR %s %`s\" or dump/reload to fix it!" }, -{ "ER_SP_NO_AGGREGATE", 1460, "AGGREGATE is not supported for stored functions" }, -{ "ER_MAX_PREPARED_STMT_COUNT_REACHED", 1461, "Can\'t create more than max_prepared_stmt_count statements (current value: %u)" }, -{ "ER_VIEW_RECURSIVE", 1462, "%`s.%`s contains view recursion" }, -{ "ER_NON_GROUPING_FIELD_USED", 1463, "Non-grouping field \'%-.192s\' is used in %-.64s clause" }, -{ "ER_TABLE_CANT_HANDLE_SPKEYS", 1464, "The storage engine %s doesn\'t support SPATIAL indexes" }, -{ "ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA", 1465, "Triggers can not be created on system tables" }, -{ "ER_REMOVED_SPACES", 1466, "Leading spaces are removed from name \'%s\'" }, -{ "ER_AUTOINC_READ_FAILED", 1467, "Failed to read auto-increment value from storage engine" }, -{ "ER_USERNAME", 1468, "user name" }, -{ "ER_HOSTNAME", 1469, "host name" }, -{ "ER_WRONG_STRING_LENGTH", 1470, "String \'%-.70T\' is too long for %s (should be no longer than %d)" }, -{ "ER_NON_INSERTABLE_TABLE", 1471, "The target table %-.100s of the %s is not insertable-into" }, -{ "ER_ADMIN_WRONG_MRG_TABLE", 1472, "Table \'%-.64s\' is differently defined or of non-MyISAM type or doesn\'t exist" }, -{ "ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT", 1473, "Too high level of nesting for select" }, -{ "ER_NAME_BECOMES_EMPTY", 1474, "Name \'%-.64s\' has become \'\'" }, -{ "ER_AMBIGUOUS_FIELD_TERM", 1475, "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY" }, -{ "ER_FOREIGN_SERVER_EXISTS", 1476, "The foreign server, %s, you are trying to create already exists" }, -{ "ER_FOREIGN_SERVER_DOESNT_EXIST", 1477, "The foreign server name you are trying to reference does not exist. Data source error: %-.64s" }, -{ "ER_ILLEGAL_HA_CREATE_OPTION", 1478, "Table storage engine \'%-.64s\' does not support the create option \'%.64s\'" }, -{ "ER_PARTITION_REQUIRES_VALUES_ERROR", 1479, "Syntax error: %-.64s PARTITIONING requires definition of VALUES %-.64s for each partition" }, -{ "ER_PARTITION_WRONG_VALUES_ERROR", 1480, "Only %-.64s PARTITIONING can use VALUES %-.64s in partition definition" }, -{ "ER_PARTITION_MAXVALUE_ERROR", 1481, "MAXVALUE can only be used in last partition definition" }, -{ "ER_PARTITION_SUBPARTITION_ERROR", 1482, "Subpartitions can only be hash partitions and by key" }, -{ "ER_PARTITION_SUBPART_MIX_ERROR", 1483, "Must define subpartitions on all partitions if on one partition" }, -{ "ER_PARTITION_WRONG_NO_PART_ERROR", 1484, "Wrong number of partitions defined, mismatch with previous setting" }, -{ "ER_PARTITION_WRONG_NO_SUBPART_ERROR", 1485, "Wrong number of subpartitions defined, mismatch with previous setting" }, -{ "ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR", 1486, "Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed" }, -{ "ER_NOT_CONSTANT_EXPRESSION", 1487, "Expression in %s must be constant" }, -{ "ER_FIELD_NOT_FOUND_PART_ERROR", 1488, "Field in list of fields for partition function not found in table" }, -{ "ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR", 1489, "List of fields is only allowed in KEY partitions" }, -{ "ER_INCONSISTENT_PARTITION_INFO_ERROR", 1490, "The partition info in the frm file is not consistent with what can be written into the frm file" }, -{ "ER_PARTITION_FUNC_NOT_ALLOWED_ERROR", 1491, "The %-.192s function returns the wrong type" }, -{ "ER_PARTITIONS_MUST_BE_DEFINED_ERROR", 1492, "For %-.64s partitions each partition must be defined" }, -{ "ER_RANGE_NOT_INCREASING_ERROR", 1493, "VALUES LESS THAN value must be strictly increasing for each partition" }, -{ "ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR", 1494, "VALUES value must be of same type as partition function" }, -{ "ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR", 1495, "Multiple definition of same constant in list partitioning" }, -{ "ER_PARTITION_ENTRY_ERROR", 1496, "Partitioning can not be used stand-alone in query" }, -{ "ER_MIX_HANDLER_ERROR", 1497, "The mix of handlers in the partitions is not allowed in this version of MariaDB" }, -{ "ER_PARTITION_NOT_DEFINED_ERROR", 1498, "For the partitioned engine it is necessary to define all %-.64s" }, -{ "ER_TOO_MANY_PARTITIONS_ERROR", 1499, "Too many partitions (including subpartitions) were defined" }, -{ "ER_SUBPARTITION_ERROR", 1500, "It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning" }, -{ "ER_CANT_CREATE_HANDLER_FILE", 1501, "Failed to create specific handler file" }, -{ "ER_BLOB_FIELD_IN_PART_FUNC_ERROR", 1502, "A BLOB field is not allowed in partition function" }, -{ "ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF", 1503, "A %-.192s must include all columns in the table\'s partitioning function" }, -{ "ER_NO_PARTS_ERROR", 1504, "Number of %-.64s = 0 is not an allowed value" }, -{ "ER_PARTITION_MGMT_ON_NONPARTITIONED", 1505, "Partition management on a not partitioned table is not possible" }, -{ "ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING", 1506, "Partitioned tables do not support %s" }, -{ "ER_DROP_PARTITION_NON_EXISTENT", 1507, "Error in list of partitions to %-.64s" }, -{ "ER_DROP_LAST_PARTITION", 1508, "Cannot remove all partitions, use DROP TABLE instead" }, -{ "ER_COALESCE_ONLY_ON_HASH_PARTITION", 1509, "COALESCE PARTITION can only be used on HASH/KEY partitions" }, -{ "ER_REORG_HASH_ONLY_ON_SAME_NO", 1510, "REORGANIZE PARTITION can only be used to reorganize partitions not to change their numbers" }, -{ "ER_REORG_NO_PARAM_ERROR", 1511, "REORGANIZE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs" }, -{ "ER_ONLY_ON_RANGE_LIST_PARTITION", 1512, "%-.64s PARTITION can only be used on RANGE/LIST partitions" }, -{ "ER_ADD_PARTITION_SUBPART_ERROR", 1513, "Trying to Add partition(s) with wrong number of subpartitions" }, -{ "ER_ADD_PARTITION_NO_NEW_PARTITION", 1514, "At least one partition must be added" }, -{ "ER_COALESCE_PARTITION_NO_PARTITION", 1515, "At least one partition must be coalesced" }, -{ "ER_REORG_PARTITION_NOT_EXIST", 1516, "More partitions to reorganize than there are partitions" }, -{ "ER_SAME_NAME_PARTITION", 1517, "Duplicate partition name %-.192s" }, -{ "ER_NO_BINLOG_ERROR", 1518, "It is not allowed to shut off binlog on this command" }, -{ "ER_CONSECUTIVE_REORG_PARTITIONS", 1519, "When reorganizing a set of partitions they must be in consecutive order" }, -{ "ER_REORG_OUTSIDE_RANGE", 1520, "Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range" }, -{ "ER_PARTITION_FUNCTION_FAILURE", 1521, "Partition function not supported in this version for this handler" }, -{ "ER_PART_STATE_ERROR", 1522, "Partition state cannot be defined from CREATE/ALTER TABLE" }, -{ "ER_LIMITED_PART_RANGE", 1523, "The %-.64s handler only supports 32 bit integers in VALUES" }, -{ "ER_PLUGIN_IS_NOT_LOADED", 1524, "Plugin \'%-.192s\' is not loaded" }, -{ "ER_WRONG_VALUE", 1525, "Incorrect %-.32s value: \'%-.128T\'" }, -{ "ER_NO_PARTITION_FOR_GIVEN_VALUE", 1526, "Table has no partition for value %-.64s" }, -{ "ER_FILEGROUP_OPTION_ONLY_ONCE", 1527, "It is not allowed to specify %s more than once" }, -{ "ER_CREATE_FILEGROUP_FAILED", 1528, "Failed to create %s" }, -{ "ER_DROP_FILEGROUP_FAILED", 1529, "Failed to drop %s" }, -{ "ER_TABLESPACE_AUTO_EXTEND_ERROR", 1530, "The handler doesn\'t support autoextend of tablespaces" }, -{ "ER_WRONG_SIZE_NUMBER", 1531, "A size parameter was incorrectly specified, either number or on the form 10M" }, -{ "ER_SIZE_OVERFLOW_ERROR", 1532, "The size number was correct but we don\'t allow the digit part to be more than 2 billion" }, -{ "ER_ALTER_FILEGROUP_FAILED", 1533, "Failed to alter: %s" }, -{ "ER_BINLOG_ROW_LOGGING_FAILED", 1534, "Writing one row to the row-based binary log failed" }, -{ "ER_BINLOG_ROW_WRONG_TABLE_DEF", 1535, "Table definition on master and slave does not match: %s" }, -{ "ER_BINLOG_ROW_RBR_TO_SBR", 1536, "Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events" }, -{ "ER_EVENT_ALREADY_EXISTS", 1537, "Event \'%-.192s\' already exists" }, -{ "ER_EVENT_STORE_FAILED", 1538, "Failed to store event %s. Error code %M from storage engine" }, -{ "ER_EVENT_DOES_NOT_EXIST", 1539, "Unknown event \'%-.192s\'" }, -{ "ER_EVENT_CANT_ALTER", 1540, "Failed to alter event \'%-.192s\'" }, -{ "ER_EVENT_DROP_FAILED", 1541, "Failed to drop %s" }, -{ "ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG", 1542, "INTERVAL is either not positive or too big" }, -{ "ER_EVENT_ENDS_BEFORE_STARTS", 1543, "ENDS is either invalid or before STARTS" }, -{ "ER_EVENT_EXEC_TIME_IN_THE_PAST", 1544, "Event execution time is in the past. Event has been disabled" }, -{ "ER_EVENT_OPEN_TABLE_FAILED", 1545, "Failed to open mysql.event" }, -{ "ER_EVENT_NEITHER_M_EXPR_NOR_M_AT", 1546, "No datetime expression provided" }, -{ "ER_UNUSED_2", 1547, "You should never see it" }, -{ "ER_UNUSED_3", 1548, "You should never see it" }, -{ "ER_EVENT_CANNOT_DELETE", 1549, "Failed to delete the event from mysql.event" }, -{ "ER_EVENT_COMPILE_ERROR", 1550, "Error during compilation of event\'s body" }, -{ "ER_EVENT_SAME_NAME", 1551, "Same old and new event name" }, -{ "ER_EVENT_DATA_TOO_LONG", 1552, "Data for column \'%s\' too long" }, -{ "ER_DROP_INDEX_FK", 1553, "Cannot drop index \'%-.192s\': needed in a foreign key constraint" }, -{ "ER_WARN_DEPRECATED_SYNTAX_WITH_VER", 1554, "The syntax \'%s\' is deprecated and will be removed in MariaDB %s. Please use %s instead" }, -{ "ER_CANT_WRITE_LOCK_LOG_TABLE", 1555, "You can\'t write-lock a log table. Only read access is possible" }, -{ "ER_CANT_LOCK_LOG_TABLE", 1556, "You can\'t use locks with log tables" }, -{ "ER_UNUSED_4", 1557, "You should never see it" }, -{ "ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE", 1558, "Column count of mysql.%s is wrong. Expected %d, found %d. Created with MariaDB %d, now running %d. Please use mariadb-upgrade to fix this error" }, -{ "ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR", 1559, "Cannot switch out of the row-based binary log format when the session has open temporary tables" }, -{ "ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT", 1560, "Cannot change the binary logging format inside a stored function or trigger" }, -{ "ER_UNUSED_13", 1561, "You should never see it" }, -{ "ER_PARTITION_NO_TEMPORARY", 1562, "Cannot create temporary table with partitions" }, -{ "ER_PARTITION_CONST_DOMAIN_ERROR", 1563, "Partition constant is out of partition function domain" }, -{ "ER_PARTITION_FUNCTION_IS_NOT_ALLOWED", 1564, "This partition function is not allowed" }, -{ "ER_DDL_LOG_ERROR", 1565, "Error in DDL log" }, -{ "ER_NULL_IN_VALUES_LESS_THAN", 1566, "Not allowed to use NULL value in VALUES LESS THAN" }, -{ "ER_WRONG_PARTITION_NAME", 1567, "Incorrect partition name" }, -{ "ER_CANT_CHANGE_TX_CHARACTERISTICS", 1568, "Transaction characteristics can\'t be changed while a transaction is in progress" }, -{ "ER_DUP_ENTRY_AUTOINCREMENT_CASE", 1569, "ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry \'%-.192T\' for key \'%-.192s\'" }, -{ "ER_EVENT_MODIFY_QUEUE_ERROR", 1570, "Internal scheduler error %d" }, -{ "ER_EVENT_SET_VAR_ERROR", 1571, "Error during starting/stopping of the scheduler. Error code %M" }, -{ "ER_PARTITION_MERGE_ERROR", 1572, "Engine cannot be used in partitioned tables" }, -{ "ER_CANT_ACTIVATE_LOG", 1573, "Cannot activate \'%-.64s\' log" }, -{ "ER_RBR_NOT_AVAILABLE", 1574, "The server was not built with row-based replication" }, -{ "ER_BASE64_DECODE_ERROR", 1575, "Decoding of base64 string failed" }, -{ "ER_EVENT_RECURSION_FORBIDDEN", 1576, "Recursion of EVENT DDL statements is forbidden when body is present" }, -{ "ER_EVENTS_DB_ERROR", 1577, "Cannot proceed, because event scheduler is disabled" }, -{ "ER_ONLY_INTEGERS_ALLOWED", 1578, "Only integers allowed as number here" }, -{ "ER_UNSUPORTED_LOG_ENGINE", 1579, "Storage engine %s cannot be used for log tables" }, -{ "ER_BAD_LOG_STATEMENT", 1580, "You cannot \'%s\' a log table if logging is enabled" }, -{ "ER_CANT_RENAME_LOG_TABLE", 1581, "Cannot rename \'%s\'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to \'%s\'" }, -{ "ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT", 1582, "Incorrect parameter count in the call to native function \'%-.192s\'" }, -{ "ER_WRONG_PARAMETERS_TO_NATIVE_FCT", 1583, "Incorrect parameters in the call to native function \'%-.192s\'" }, -{ "ER_WRONG_PARAMETERS_TO_STORED_FCT", 1584, "Incorrect parameters in the call to stored function \'%-.192s\'" }, -{ "ER_NATIVE_FCT_NAME_COLLISION", 1585, "This function \'%-.192s\' has the same name as a native function" }, -{ "ER_DUP_ENTRY_WITH_KEY_NAME", 1586, "Duplicate entry \'%-.64T\' for key \'%-.192s\'" }, -{ "ER_BINLOG_PURGE_EMFILE", 1587, "Too many files opened, please execute the command again" }, -{ "ER_EVENT_CANNOT_CREATE_IN_THE_PAST", 1588, "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation" }, -{ "ER_EVENT_CANNOT_ALTER_IN_THE_PAST", 1589, "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future" }, -{ "ER_SLAVE_INCIDENT", 1590, "The incident %s occurred on the master. Message: %-.64s" }, -{ "ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT", 1591, "Table has no partition for some existing values" }, -{ "ER_BINLOG_UNSAFE_STATEMENT", 1592, "Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. %s" }, -{ "ER_SLAVE_FATAL_ERROR", 1593, "Fatal error: %s" }, -{ "ER_SLAVE_RELAY_LOG_READ_FAILURE", 1594, "Relay log read failure: %s" }, -{ "ER_SLAVE_RELAY_LOG_WRITE_FAILURE", 1595, "Relay log write failure: %s" }, -{ "ER_SLAVE_CREATE_EVENT_FAILURE", 1596, "Failed to create %s" }, -{ "ER_SLAVE_MASTER_COM_FAILURE", 1597, "Master command %s failed: %s" }, -{ "ER_BINLOG_LOGGING_IMPOSSIBLE", 1598, "Binary logging not possible. Message: %s" }, -{ "ER_VIEW_NO_CREATION_CTX", 1599, "View %`s.%`s has no creation context" }, -{ "ER_VIEW_INVALID_CREATION_CTX", 1600, "Creation context of view %`s.%`s is invalid" }, -{ "ER_SR_INVALID_CREATION_CTX", 1601, "Creation context of stored routine %`s.%`s is invalid" }, -{ "ER_TRG_CORRUPTED_FILE", 1602, "Corrupted TRG file for table %`s.%`s" }, -{ "ER_TRG_NO_CREATION_CTX", 1603, "Triggers for table %`s.%`s have no creation context" }, -{ "ER_TRG_INVALID_CREATION_CTX", 1604, "Trigger creation context of table %`s.%`s is invalid" }, -{ "ER_EVENT_INVALID_CREATION_CTX", 1605, "Creation context of event %`s.%`s is invalid" }, -{ "ER_TRG_CANT_OPEN_TABLE", 1606, "Cannot open table for trigger %`s.%`s" }, -{ "ER_CANT_CREATE_SROUTINE", 1607, "Cannot create stored routine %`s. Check warnings" }, -{ "ER_UNUSED_11", 1608, "You should never see it" }, -{ "ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT", 1609, "The BINLOG statement of type %s was not preceded by a format description BINLOG statement" }, -{ "ER_SLAVE_CORRUPT_EVENT", 1610, "Corrupted replication event was detected" }, -{ "ER_LOAD_DATA_INVALID_COLUMN", 1611, "Invalid column reference (%-.64s) in LOAD DATA" }, -{ "ER_LOG_PURGE_NO_FILE", 1612, "Being purged log %s was not found" }, -{ "ER_XA_RBTIMEOUT", 1613, "XA_RBTIMEOUT: Transaction branch was rolled back: took too long" }, -{ "ER_XA_RBDEADLOCK", 1614, "XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected" }, -{ "ER_NEED_REPREPARE", 1615, "Prepared statement needs to be re-prepared" }, -{ "ER_DELAYED_NOT_SUPPORTED", 1616, "DELAYED option not supported for table \'%-.192s\'" }, -{ "WARN_NO_MASTER_INFO", 1617, "There is no master connection \'%.*s\'" }, -{ "WARN_OPTION_IGNORED", 1618, "<%-.64s> option ignored" }, -{ "ER_PLUGIN_DELETE_BUILTIN", 1619, "Built-in plugins cannot be deleted" }, -{ "WARN_PLUGIN_BUSY", 1620, "Plugin is busy and will be uninstalled on shutdown" }, -{ "ER_VARIABLE_IS_READONLY", 1621, "%s variable \'%s\' is read-only. Use SET %s to assign the value" }, -{ "ER_WARN_ENGINE_TRANSACTION_ROLLBACK", 1622, "Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted" }, -{ "ER_SLAVE_HEARTBEAT_FAILURE", 1623, "Unexpected master\'s heartbeat data: %s" }, -{ "ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE", 1624, "The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%u seconds)" }, -{ "ER_UNUSED_14", 1625, "You should never see it" }, -{ "ER_CONFLICT_FN_PARSE_ERROR", 1626, "Error in parsing conflict function. Message: %-.64s" }, -{ "ER_EXCEPTIONS_WRITE_ERROR", 1627, "Write to exceptions table failed. Message: %-.128s\"" }, -{ "ER_TOO_LONG_TABLE_COMMENT", 1628, "Comment for table \'%-.64s\' is too long (max = %u)" }, -{ "ER_TOO_LONG_FIELD_COMMENT", 1629, "Comment for field \'%-.64s\' is too long (max = %u)" }, -{ "ER_FUNC_INEXISTENT_NAME_COLLISION", 1630, "FUNCTION %s does not exist. Check the \'Function Name Parsing and Resolution\' section in the Reference Manual" }, -{ "ER_DATABASE_NAME", 1631, "Database" }, -{ "ER_TABLE_NAME", 1632, "Table" }, -{ "ER_PARTITION_NAME", 1633, "Partition" }, -{ "ER_SUBPARTITION_NAME", 1634, "Subpartition" }, -{ "ER_TEMPORARY_NAME", 1635, "Temporary" }, -{ "ER_RENAMED_NAME", 1636, "Renamed" }, -{ "ER_TOO_MANY_CONCURRENT_TRXS", 1637, "Too many active concurrent transactions" }, -{ "WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED", 1638, "Non-ASCII separator arguments are not fully supported" }, -{ "ER_DEBUG_SYNC_TIMEOUT", 1639, "debug sync point wait timed out" }, -{ "ER_DEBUG_SYNC_HIT_LIMIT", 1640, "debug sync point hit limit reached" }, -{ "ER_DUP_SIGNAL_SET", 1641, "Duplicate condition information item \'%s\'" }, -{ "ER_SIGNAL_WARN", 1642, "Unhandled user-defined warning condition" }, -{ "ER_SIGNAL_NOT_FOUND", 1643, "Unhandled user-defined not found condition" }, -{ "ER_SIGNAL_EXCEPTION", 1644, "Unhandled user-defined exception condition" }, -{ "ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER", 1645, "RESIGNAL when handler not active" }, -{ "ER_SIGNAL_BAD_CONDITION_TYPE", 1646, "SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE" }, -{ "WARN_COND_ITEM_TRUNCATED", 1647, "Data truncated for condition item \'%s\'" }, -{ "ER_COND_ITEM_TOO_LONG", 1648, "Data too long for condition item \'%s\'" }, -{ "ER_UNKNOWN_LOCALE", 1649, "Unknown locale: \'%-.64s\'" }, -{ "ER_SLAVE_IGNORE_SERVER_IDS", 1650, "The requested server id %d clashes with the slave startup option --replicate-same-server-id" }, -{ "ER_QUERY_CACHE_DISABLED", 1651, "Query cache is disabled; set query_cache_type to ON or DEMAND to enable it" }, -{ "ER_SAME_NAME_PARTITION_FIELD", 1652, "Duplicate partition field name \'%-.192s\'" }, -{ "ER_PARTITION_COLUMN_LIST_ERROR", 1653, "Inconsistency in usage of column lists for partitioning" }, -{ "ER_WRONG_TYPE_COLUMN_VALUE_ERROR", 1654, "Partition column values of incorrect type" }, -{ "ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR", 1655, "Too many fields in \'%-.192s\'" }, -{ "ER_MAXVALUE_IN_VALUES_IN", 1656, "Cannot use MAXVALUE as value in VALUES IN" }, -{ "ER_TOO_MANY_VALUES_ERROR", 1657, "Cannot have more than one value for this type of %-.64s partitioning" }, -{ "ER_ROW_SINGLE_PARTITION_FIELD_ERROR", 1658, "Row expressions in VALUES IN only allowed for multi-field column partitioning" }, -{ "ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD", 1659, "Field \'%-.192s\' is of a not allowed type for this type of partitioning" }, -{ "ER_PARTITION_FIELDS_TOO_LONG", 1660, "The total length of the partitioning fields is too large" }, -{ "ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE", 1661, "Cannot execute statement: impossible to write to binary log since both row-incapable engines and statement-incapable engines are involved" }, -{ "ER_BINLOG_ROW_MODE_AND_STMT_ENGINE", 1662, "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging" }, -{ "ER_BINLOG_UNSAFE_AND_STMT_ENGINE", 1663, "Cannot execute statement: impossible to write to binary log since statement is unsafe, storage engine is limited to statement-based logging, and BINLOG_FORMAT = MIXED. %s" }, -{ "ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE", 1664, "Cannot execute statement: impossible to write to binary log since statement is in row format and at least one table uses a storage engine limited to statement-based logging" }, -{ "ER_BINLOG_STMT_MODE_AND_ROW_ENGINE", 1665, "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.%s" }, -{ "ER_BINLOG_ROW_INJECTION_AND_STMT_MODE", 1666, "Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT" }, -{ "ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE", 1667, "Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging" }, -{ "ER_BINLOG_UNSAFE_LIMIT", 1668, "The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted" }, -{ "ER_BINLOG_UNSAFE_INSERT_DELAYED", 1669, "The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted" }, -{ "ER_BINLOG_UNSAFE_SYSTEM_TABLE", 1670, "The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves" }, -{ "ER_BINLOG_UNSAFE_AUTOINC_COLUMNS", 1671, "Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly" }, -{ "ER_BINLOG_UNSAFE_UDF", 1672, "Statement is unsafe because it uses a UDF which may not return the same value on the slave" }, -{ "ER_BINLOG_UNSAFE_SYSTEM_VARIABLE", 1673, "Statement is unsafe because it uses a system variable that may have a different value on the slave" }, -{ "ER_BINLOG_UNSAFE_SYSTEM_FUNCTION", 1674, "Statement is unsafe because it uses a system function that may return a different value on the slave" }, -{ "ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS", 1675, "Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction" }, -{ "ER_MESSAGE_AND_STATEMENT", 1676, "%s Statement: %s" }, -{ "ER_SLAVE_CONVERSION_FAILED", 1677, "Column %d of table \'%-.192s.%-.192s\' cannot be converted from type \'%-.50s\' to type \'%-.50s\'" }, -{ "ER_SLAVE_CANT_CREATE_CONVERSION", 1678, "Can\'t create conversion table for table \'%-.192s.%-.192s\'" }, -{ "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT", 1679, "Cannot modify @@session.binlog_format inside a transaction" }, -{ "ER_PATH_LENGTH", 1680, "The path specified for %.64T is too long" }, -{ "ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT", 1681, "\'%s\' is deprecated and will be removed in a future release" }, -{ "ER_WRONG_NATIVE_TABLE_STRUCTURE", 1682, "Native table \'%-.64s\'.\'%-.64s\' has the wrong structure" }, -{ "ER_WRONG_PERFSCHEMA_USAGE", 1683, "Invalid performance_schema usage" }, -{ "ER_WARN_I_S_SKIPPED_TABLE", 1684, "Table \'%s\'.\'%s\' was skipped since its definition is being modified by concurrent DDL statement" }, -{ "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT", 1685, "Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction" }, -{ "ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT", 1686, "Cannot change the binlog direct flag inside a stored function or trigger" }, -{ "ER_SPATIAL_MUST_HAVE_GEOM_COL", 1687, "A SPATIAL index may only contain a geometrical type column" }, -{ "ER_TOO_LONG_INDEX_COMMENT", 1688, "Comment for index \'%-.64s\' is too long (max = %lu)" }, -{ "ER_LOCK_ABORTED", 1689, "Wait on a lock was aborted due to a pending exclusive lock" }, -{ "ER_DATA_OUT_OF_RANGE", 1690, "%s value is out of range in \'%s\'" }, -{ "ER_WRONG_SPVAR_TYPE_IN_LIMIT", 1691, "A variable of a non-integer based type in LIMIT clause" }, -{ "ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE", 1692, "Mixing self-logging and non-self-logging engines in a statement is unsafe" }, -{ "ER_BINLOG_UNSAFE_MIXED_STATEMENT", 1693, "Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them" }, -{ "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN", 1694, "Cannot modify @@session.sql_log_bin inside a transaction" }, -{ "ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN", 1695, "Cannot change the sql_log_bin inside a stored function or trigger" }, -{ "ER_FAILED_READ_FROM_PAR_FILE", 1696, "Failed to read from the .par file" }, -{ "ER_VALUES_IS_NOT_INT_TYPE_ERROR", 1697, "VALUES value for partition \'%-.64s\' must have type INT" }, -{ "ER_ACCESS_DENIED_NO_PASSWORD_ERROR", 1698, "Access denied for user \'%s\'@\'%s\'" }, -{ "ER_SET_PASSWORD_AUTH_PLUGIN", 1699, "SET PASSWORD is ignored for users authenticating via %s plugin" }, -{ "ER_GRANT_PLUGIN_USER_EXISTS", 1700, "GRANT with IDENTIFIED WITH is illegal because the user %-.*s already exists" }, -{ "ER_TRUNCATE_ILLEGAL_FK", 1701, "Cannot truncate a table referenced in a foreign key constraint (%.192s)" }, -{ "ER_PLUGIN_IS_PERMANENT", 1702, "Plugin \'%s\' is force_plus_permanent and can not be unloaded" }, -{ "ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN", 1703, "The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled" }, -{ "ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX", 1704, "The requested value for the heartbeat period exceeds the value of `slave_net_timeout\' seconds. A sensible value for the period should be less than the timeout" }, -{ "ER_STMT_CACHE_FULL", 1705, "Multi-row statements required more than \'max_binlog_stmt_cache_size\' bytes of storage." }, -{ "ER_MULTI_UPDATE_KEY_CONFLICT", 1706, "Primary key/partition key update is not allowed since the table is updated both as \'%-.192s\' and \'%-.192s\'" }, -{ "ER_TABLE_NEEDS_REBUILD", 1707, "Table rebuild required. Please do \"ALTER TABLE %`s FORCE\" or dump/reload to fix it!" }, -{ "WARN_OPTION_BELOW_LIMIT", 1708, "The value of \'%s\' should be no less than the value of \'%s\'" }, -{ "ER_INDEX_COLUMN_TOO_LONG", 1709, "Index column size too large. The maximum column size is %lu bytes" }, -{ "ER_ERROR_IN_TRIGGER_BODY", 1710, "Trigger \'%-.64s\' has an error in its body: \'%-.256s\'" }, -{ "ER_ERROR_IN_UNKNOWN_TRIGGER_BODY", 1711, "Unknown trigger has an error in its body: \'%-.256s\'" }, -{ "ER_INDEX_CORRUPT", 1712, "Index %s is corrupted" }, -{ "ER_UNDO_RECORD_TOO_BIG", 1713, "Undo log record is too big" }, -{ "ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT", 1714, "INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave" }, -{ "ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE", 1715, "INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave" }, -{ "ER_BINLOG_UNSAFE_REPLACE_SELECT", 1716, "REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave" }, -{ "ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT", 1717, "CREATE... IGNORE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave" }, -{ "ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT", 1718, "CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave" }, -{ "ER_BINLOG_UNSAFE_UPDATE_IGNORE", 1719, "UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave" }, -{ "ER_UNUSED_15", 1720, "You should never see it" }, -{ "ER_UNUSED_16", 1721, "You should never see it" }, -{ "ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT", 1722, "Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave" }, -{ "ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC", 1723, "CREATE TABLE... SELECT... on a table with an auto-increment column is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are inserted. This order cannot be predicted and may differ on master and the slave" }, -{ "ER_BINLOG_UNSAFE_INSERT_TWO_KEYS", 1724, "INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe" }, -{ "ER_TABLE_IN_FK_CHECK", 1725, "Table is being used in foreign key check" }, -{ "ER_UNUSED_1", 1726, "You should never see it" }, -{ "ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST", 1727, "INSERT into autoincrement field which is not the first part in the composed primary key is unsafe" }, -{ "ER_CANNOT_LOAD_FROM_TABLE_V2", 1728, "Cannot load from %s.%s. The table is probably corrupted" }, -{ "ER_MASTER_DELAY_VALUE_OUT_OF_RANGE", 1729, "The requested value %lu for the master delay exceeds the maximum %lu" }, -{ "ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT", 1730, "Only Format_description_log_event and row events are allowed in BINLOG statements (but %s was provided)" }, -{ "ER_PARTITION_EXCHANGE_DIFFERENT_OPTION", 1731, "Non matching attribute \'%-.64s\' between partition and table" }, -{ "ER_PARTITION_EXCHANGE_PART_TABLE", 1732, "Table to exchange with partition is partitioned: \'%-.64s\'" }, -{ "ER_PARTITION_EXCHANGE_TEMP_TABLE", 1733, "Table to exchange with partition is temporary: \'%-.64s\'" }, -{ "ER_PARTITION_INSTEAD_OF_SUBPARTITION", 1734, "Subpartitioned table, use subpartition instead of partition" }, -{ "ER_UNKNOWN_PARTITION", 1735, "Unknown partition \'%-.64s\' in table \'%-.64s\'" }, -{ "ER_TABLES_DIFFERENT_METADATA", 1736, "Tables have different definitions" }, -{ "ER_ROW_DOES_NOT_MATCH_PARTITION", 1737, "Found a row that does not match the partition" }, -{ "ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX", 1738, "Option binlog_cache_size (%lu) is greater than max_binlog_cache_size (%lu); setting binlog_cache_size equal to max_binlog_cache_size" }, -{ "ER_WARN_INDEX_NOT_APPLICABLE", 1739, "Cannot use %-.64s access on index \'%-.64s\' due to type or collation conversion on field \'%-.64s\'" }, -{ "ER_PARTITION_EXCHANGE_FOREIGN_KEY", 1740, "Table to exchange with partition has foreign key references: \'%-.64s\'" }, -{ "ER_NO_SUCH_KEY_VALUE", 1741, "Key value \'%-.192s\' was not found in table \'%-.192s.%-.192s\'" }, -{ "ER_VALUE_TOO_LONG", 1742, "Too long value for \'%s\'" }, -{ "ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE", 1743, "Replication event checksum verification failed while reading from network" }, -{ "ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE", 1744, "Replication event checksum verification failed while reading from a log file" }, -{ "ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX", 1745, "Option binlog_stmt_cache_size (%lu) is greater than max_binlog_stmt_cache_size (%lu); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size" }, -{ "ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT", 1746, "Can\'t update table \'%-.192s\' while \'%-.192s\' is being created" }, -{ "ER_PARTITION_CLAUSE_ON_NONPARTITIONED", 1747, "PARTITION () clause on non partitioned table" }, -{ "ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET", 1748, "Found a row not matching the given partition set" }, -{ "ER_UNUSED_5", 1749, "You should never see it" }, -{ "ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE", 1750, "Failure while changing the type of replication repository: %s" }, -{ "ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE", 1751, "The creation of some temporary tables could not be rolled back" }, -{ "ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE", 1752, "Some temporary tables were dropped, but these operations could not be rolled back" }, -{ "ER_MTS_FEATURE_IS_NOT_SUPPORTED", 1753, "%s is not supported in multi-threaded slave mode. %s" }, -{ "ER_MTS_UPDATED_DBS_GREATER_MAX", 1754, "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata" }, -{ "ER_MTS_CANT_PARALLEL", 1755, "Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s" }, -{ "ER_MTS_INCONSISTENT_DATA", 1756, "%s" }, -{ "ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING", 1757, "FULLTEXT index is not supported for partitioned tables" }, -{ "ER_DA_INVALID_CONDITION_NUMBER", 1758, "Invalid condition number" }, -{ "ER_INSECURE_PLAIN_TEXT", 1759, "Sending passwords in plain text without SSL/TLS is extremely insecure" }, -{ "ER_INSECURE_CHANGE_MASTER", 1760, "Storing MariaDB user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MariaDB Manual for more about this issue and possible alternatives" }, -{ "ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO", 1761, "Foreign key constraint for table \'%.192s\', record \'%-.192s\' would lead to a duplicate entry in table \'%.192s\', key \'%.192s\'" }, -{ "ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO", 1762, "Foreign key constraint for table \'%.192s\', record \'%-.192s\' would lead to a duplicate entry in a child table" }, -{ "ER_SQLTHREAD_WITH_SECURE_SLAVE", 1763, "Setting authentication options is not possible when only the Slave SQL Thread is being started" }, -{ "ER_TABLE_HAS_NO_FT", 1764, "The table does not have FULLTEXT index to support this query" }, -{ "ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER", 1765, "The system variable %.200s cannot be set in stored functions or triggers" }, -{ "ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION", 1766, "The system variable %.200s cannot be set when there is an ongoing transaction" }, -{ "ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST", 1767, "The system variable @@SESSION.GTID_NEXT has the value %.200s, which is not listed in @@SESSION.GTID_NEXT_LIST" }, -{ "ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL", 1768, "When @@SESSION.GTID_NEXT_LIST == NULL, the system variable @@SESSION.GTID_NEXT cannot change inside a transaction" }, -{ "ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION", 1769, "The statement \'SET %.200s\' cannot invoke a stored function" }, -{ "ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL", 1770, "The system variable @@SESSION.GTID_NEXT cannot be \'AUTOMATIC\' when @@SESSION.GTID_NEXT_LIST is non-NULL" }, -{ "ER_SKIPPING_LOGGED_TRANSACTION", 1771, "Skipping transaction %.200s because it has already been executed and logged" }, -{ "ER_MALFORMED_GTID_SET_SPECIFICATION", 1772, "Malformed GTID set specification \'%.200s\'" }, -{ "ER_MALFORMED_GTID_SET_ENCODING", 1773, "Malformed GTID set encoding" }, -{ "ER_MALFORMED_GTID_SPECIFICATION", 1774, "Malformed GTID specification \'%.200s\'" }, -{ "ER_GNO_EXHAUSTED", 1775, "Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the server with a new server_uuid" }, -{ "ER_BAD_SLAVE_AUTO_POSITION", 1776, "Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active" }, -{ "ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON", 1777, "CHANGE MASTER TO MASTER_AUTO_POSITION = 1 can only be executed when GTID_MODE = ON" }, -{ "ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET", 1778, "Cannot execute statements with implicit commit inside a transaction when GTID_NEXT != AUTOMATIC or GTID_NEXT_LIST != NULL" }, -{ "ER_GTID_MODE_2_OR_3_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON", 1779, "GTID_MODE = ON or GTID_MODE = UPGRADE_STEP_2 requires ENFORCE_GTID_CONSISTENCY = 1" }, -{ "ER_GTID_MODE_REQUIRES_BINLOG", 1780, "GTID_MODE = ON or UPGRADE_STEP_1 or UPGRADE_STEP_2 requires --log-bin and --log-slave-updates" }, -{ "ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF", 1781, "GTID_NEXT cannot be set to UUID:NUMBER when GTID_MODE = OFF" }, -{ "ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON", 1782, "GTID_NEXT cannot be set to ANONYMOUS when GTID_MODE = ON" }, -{ "ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF", 1783, "GTID_NEXT_LIST cannot be set to a non-NULL value when GTID_MODE = OFF" }, -{ "ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF", 1784, "Found a Gtid_log_event or Previous_gtids_log_event when GTID_MODE = OFF" }, -{ "ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE", 1785, "When ENFORCE_GTID_CONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables" }, -{ "ER_GTID_UNSAFE_CREATE_SELECT", 1786, "CREATE TABLE ... SELECT is forbidden when ENFORCE_GTID_CONSISTENCY = 1" }, -{ "ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION", 1787, "When ENFORCE_GTID_CONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1" }, -{ "ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME", 1788, "The value of GTID_MODE can only change one step at a time: OFF <-> UPGRADE_STEP_1 <-> UPGRADE_STEP_2 <-> ON. Also note that this value must be stepped up or down simultaneously on all servers; see the Manual for instructions." }, -{ "ER_MASTER_HAS_PURGED_REQUIRED_GTIDS", 1789, "The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires" }, -{ "ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID", 1790, "GTID_NEXT cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK" }, -{ "ER_UNKNOWN_EXPLAIN_FORMAT", 1791, "Unknown %s format name: \'%s\'" }, -{ "ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION", 1792, "Cannot execute statement in a READ ONLY transaction" }, -{ "ER_TOO_LONG_TABLE_PARTITION_COMMENT", 1793, "Comment for table partition \'%-.64s\' is too long (max = %lu)" }, -{ "ER_SLAVE_CONFIGURATION", 1794, "Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MariaDB error log" }, -{ "ER_INNODB_FT_LIMIT", 1795, "InnoDB presently supports one FULLTEXT index creation at a time" }, -{ "ER_INNODB_NO_FT_TEMP_TABLE", 1796, "Cannot create FULLTEXT index on temporary InnoDB table" }, -{ "ER_INNODB_FT_WRONG_DOCID_COLUMN", 1797, "Column \'%-.192s\' is of wrong type for an InnoDB FULLTEXT index" }, -{ "ER_INNODB_FT_WRONG_DOCID_INDEX", 1798, "Index \'%-.192s\' is of wrong type for an InnoDB FULLTEXT index" }, -{ "ER_INNODB_ONLINE_LOG_TOO_BIG", 1799, "Creating index \'%-.192s\' required more than \'innodb_online_alter_log_max_size\' bytes of modification log. Please try again" }, -{ "ER_UNKNOWN_ALTER_ALGORITHM", 1800, "Unknown ALGORITHM \'%s\'" }, -{ "ER_UNKNOWN_ALTER_LOCK", 1801, "Unknown LOCK type \'%s\'" }, -{ "ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS", 1802, "CHANGE MASTER cannot be executed when the slave was stopped with an error or killed in MTS mode. Consider using RESET SLAVE or START SLAVE UNTIL" }, -{ "ER_MTS_RECOVERY_FAILURE", 1803, "Cannot recover after SLAVE errored out in parallel execution mode. Additional error messages can be found in the MariaDB error log" }, -{ "ER_MTS_RESET_WORKERS", 1804, "Cannot clean up worker info tables. Additional error messages can be found in the MariaDB error log" }, -{ "ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2", 1805, "Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted" }, -{ "ER_SLAVE_SILENT_RETRY_TRANSACTION", 1806, "Slave must silently retry current transaction" }, -{ "ER_UNUSED_22", 1807, "You should never see it" }, -{ "ER_TABLE_SCHEMA_MISMATCH", 1808, "Schema mismatch (%s)" }, -{ "ER_TABLE_IN_SYSTEM_TABLESPACE", 1809, "Table %-.192s in system tablespace" }, -{ "ER_IO_READ_ERROR", 1810, "IO Read error: (%lu, %s) %s" }, -{ "ER_IO_WRITE_ERROR", 1811, "IO Write error: (%lu, %s) %s" }, -{ "ER_TABLESPACE_MISSING", 1812, "Tablespace is missing for table \'%-.192s\'" }, -{ "ER_TABLESPACE_EXISTS", 1813, "Tablespace for table \'%-.192s\' exists. Please DISCARD the tablespace before IMPORT" }, -{ "ER_TABLESPACE_DISCARDED", 1814, "Tablespace has been discarded for table %`s" }, -{ "ER_INTERNAL_ERROR", 1815, "Internal error: %-.192s" }, -{ "ER_INNODB_IMPORT_ERROR", 1816, "ALTER TABLE \'%-.192s\' IMPORT TABLESPACE failed with error %lu : \'%s\'" }, -{ "ER_INNODB_INDEX_CORRUPT", 1817, "Index corrupt: %s" }, -{ "ER_INVALID_YEAR_COLUMN_LENGTH", 1818, "YEAR(%lu) column type is deprecated. Creating YEAR(4) column instead" }, -{ "ER_NOT_VALID_PASSWORD", 1819, "Your password does not satisfy the current policy requirements" }, -{ "ER_MUST_CHANGE_PASSWORD", 1820, "You must SET PASSWORD before executing this statement" }, -{ "ER_FK_NO_INDEX_CHILD", 1821, "Failed to add the foreign key constaint. Missing index for constraint \'%s\' in the foreign table \'%s\'" }, -{ "ER_FK_NO_INDEX_PARENT", 1822, "Failed to add the foreign key constaint. Missing index for constraint \'%s\' in the referenced table \'%s\'" }, -{ "ER_FK_FAIL_ADD_SYSTEM", 1823, "Failed to add the foreign key constraint \'%s\' to system tables" }, -{ "ER_FK_CANNOT_OPEN_PARENT", 1824, "Failed to open the referenced table \'%s\'" }, -{ "ER_FK_INCORRECT_OPTION", 1825, "Failed to add the foreign key constraint on table \'%s\'. Incorrect options in FOREIGN KEY constraint \'%s\'" }, -{ "ER_DUP_CONSTRAINT_NAME", 1826, "Duplicate %s constraint name \'%s\'" }, -{ "ER_PASSWORD_FORMAT", 1827, "The password hash doesn\'t have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function" }, -{ "ER_FK_COLUMN_CANNOT_DROP", 1828, "Cannot drop column \'%-.192s\': needed in a foreign key constraint \'%-.192s\'" }, -{ "ER_FK_COLUMN_CANNOT_DROP_CHILD", 1829, "Cannot drop column \'%-.192s\': needed in a foreign key constraint \'%-.192s\' of table %-.192s" }, -{ "ER_FK_COLUMN_NOT_NULL", 1830, "Column \'%-.192s\' cannot be NOT NULL: needed in a foreign key constraint \'%-.192s\' SET NULL" }, -{ "ER_DUP_INDEX", 1831, "Duplicate index %`s. This is deprecated and will be disallowed in a future release" }, -{ "ER_FK_COLUMN_CANNOT_CHANGE", 1832, "Cannot change column \'%-.192s\': used in a foreign key constraint \'%-.192s\'" }, -{ "ER_FK_COLUMN_CANNOT_CHANGE_CHILD", 1833, "Cannot change column \'%-.192s\': used in a foreign key constraint \'%-.192s\' of table \'%-.192s\'" }, -{ "ER_FK_CANNOT_DELETE_PARENT", 1834, "Cannot delete rows from table which is parent in a foreign key constraint \'%-.192s\' of table \'%-.192s\'" }, -{ "ER_MALFORMED_PACKET", 1835, "Malformed communication packet" }, -{ "ER_READ_ONLY_MODE", 1836, "Running in read-only mode" }, -{ "ER_GTID_NEXT_TYPE_UNDEFINED_GROUP", 1837, "When GTID_NEXT is set to a GTID, you must explicitly set it again after a COMMIT or ROLLBACK. If you see this error message in the slave SQL thread, it means that a table in the current transaction is transactional on the master and non-transactional on the slave. In a client connection, it means that you executed SET GTID_NEXT before a transaction and forgot to set GTID_NEXT to a different identifier or to \'AUTOMATIC\' after COMMIT or ROLLBACK. Current GTID_NEXT is \'%s\'" }, -{ "ER_VARIABLE_NOT_SETTABLE_IN_SP", 1838, "The system variable %.200s cannot be set in stored procedures" }, -{ "ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF", 1839, "GTID_PURGED can only be set when GTID_MODE = ON" }, -{ "ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY", 1840, "GTID_PURGED can only be set when GTID_EXECUTED is empty" }, -{ "ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY", 1841, "GTID_PURGED can only be set when there are no ongoing transactions (not even in other clients)" }, -{ "ER_GTID_PURGED_WAS_CHANGED", 1842, "GTID_PURGED was changed from \'%s\' to \'%s\'" }, -{ "ER_GTID_EXECUTED_WAS_CHANGED", 1843, "GTID_EXECUTED was changed from \'%s\' to \'%s\'" }, -{ "ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES", 1844, "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT, and both replicated and non replicated tables are written to" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED", 1845, "%s is not supported for this operation. Try %s" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON", 1846, "%s is not supported. Reason: %s. Try %s" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY", 1847, "COPY algorithm requires a lock" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION", 1848, "Partition specific operations do not yet support LOCK/ALGORITHM" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME", 1849, "Columns participating in a foreign key are renamed" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE", 1850, "Cannot change column type" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK", 1851, "Adding foreign keys needs foreign_key_checks=OFF" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_IGNORE", 1852, "Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK", 1853, "Dropping a primary key is not allowed without also adding a new primary key" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC", 1854, "Adding an auto-increment column requires a lock" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS", 1855, "Cannot replace hidden FTS_DOC_ID with a user-visible one" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS", 1856, "Cannot drop or rename FTS_DOC_ID" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS", 1857, "Fulltext index creation requires a lock" }, -{ "ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE", 1858, "sql_slave_skip_counter can not be set when the server is running with GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction" }, -{ "ER_DUP_UNKNOWN_IN_INDEX", 1859, "Duplicate entry for key \'%-.192s\'" }, -{ "ER_IDENT_CAUSES_TOO_LONG_PATH", 1860, "Long database name and identifier for object resulted in path length exceeding %d characters. Path: \'%s\'" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL", 1861, "cannot convert NULL to non-constant DEFAULT" }, -{ "ER_MUST_CHANGE_PASSWORD_LOGIN", 1862, "Your password has expired. To log in you must change it using a client that supports expired passwords" }, -{ "ER_ROW_IN_WRONG_PARTITION", 1863, "Found a row in wrong partition %s" }, -{ "ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX", 1864, "Cannot schedule event %s, relay-log name %s, position %s to Worker thread because its size %lu exceeds %lu of slave_pending_jobs_size_max" }, -{ "ER_INNODB_NO_FT_USES_PARSER", 1865, "Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table" }, -{ "ER_BINLOG_LOGICAL_CORRUPTION", 1866, "The binary log file \'%s\' is logically corrupted: %s" }, -{ "ER_WARN_PURGE_LOG_IN_USE", 1867, "file %s was not purged because it was being read by %d thread(s), purged only %d out of %d files" }, -{ "ER_WARN_PURGE_LOG_IS_ACTIVE", 1868, "file %s was not purged because it is the active log file" }, -{ "ER_AUTO_INCREMENT_CONFLICT", 1869, "Auto-increment value in UPDATE conflicts with internally generated values" }, -{ "WARN_ON_BLOCKHOLE_IN_RBR", 1870, "Row events are not logged for %s statements that modify BLACKHOLE tables in row format. Table(s): \'%-.192s\'" }, -{ "ER_SLAVE_MI_INIT_REPOSITORY", 1871, "Slave failed to initialize master info structure from the repository" }, -{ "ER_SLAVE_RLI_INIT_REPOSITORY", 1872, "Slave failed to initialize relay log info structure from the repository" }, -{ "ER_ACCESS_DENIED_CHANGE_USER_ERROR", 1873, "Access denied trying to change to user \'%-.48s\'@\'%-.64s\' (using password: %s). Disconnecting" }, -{ "ER_INNODB_READ_ONLY", 1874, "InnoDB is in read only mode" }, -{ "ER_STOP_SLAVE_SQL_THREAD_TIMEOUT", 1875, "STOP SLAVE command execution is incomplete: Slave SQL thread got the stop signal, thread is busy, SQL thread will stop once the current task is complete" }, -{ "ER_STOP_SLAVE_IO_THREAD_TIMEOUT", 1876, "STOP SLAVE command execution is incomplete: Slave IO thread got the stop signal, thread is busy, IO thread will stop once the current task is complete" }, -{ "ER_TABLE_CORRUPT", 1877, "Operation cannot be performed. The table \'%-.64s.%-.64s\' is missing, corrupt or contains bad data" }, -{ "ER_TEMP_FILE_WRITE_FAILURE", 1878, "Temporary file write failure" }, -{ "ER_INNODB_FT_AUX_NOT_HEX_ID", 1879, "Upgrade index name failed, please use create index(alter table) algorithm copy to rebuild index" }, -{ "ER_LAST_MYSQL_ERROR_MESSAGE", 1880, "\"" }, -{ "ER_UNUSED_18", 1900, "\"" }, -{ "ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED", 1901, "Function or expression \'%s\' cannot be used in the %s clause of %`s" }, -{ "ER_UNUSED_19", 1902, "\"" }, -{ "ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN", 1903, "Primary key cannot be defined upon a generated column" }, -{ "ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN", 1904, "Key/Index cannot be defined on a virtual generated column" }, -{ "ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN", 1905, "Cannot define foreign key with %s clause on a generated column" }, -{ "ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN", 1906, "The value specified for generated column \'%s\' in table \'%s\' has been ignored" }, -{ "ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN", 1907, "This is not yet supported for generated columns" }, -{ "ER_UNUSED_20", 1908, "\"" }, -{ "ER_UNUSED_21", 1909, "\"" }, -{ "ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS", 1910, "%s storage engine does not support generated columns" }, -{ "ER_UNKNOWN_OPTION", 1911, "Unknown option \'%-.64s\'" }, -{ "ER_BAD_OPTION_VALUE", 1912, "Incorrect value \'%-.64T\' for option \'%-.64s\'" }, -{ "ER_UNUSED_6", 1913, "You should never see it" }, -{ "ER_UNUSED_7", 1914, "You should never see it" }, -{ "ER_UNUSED_8", 1915, "You should never see it" }, -{ "ER_DATA_OVERFLOW", 1916, "Got overflow when converting \'%-.128s\' to %-.32s. Value truncated" }, -{ "ER_DATA_TRUNCATED", 1917, "Truncated value \'%-.128s\' when converting to %-.32s" }, -{ "ER_BAD_DATA", 1918, "Encountered illegal value \'%-.128s\' when converting to %-.32s" }, -{ "ER_DYN_COL_WRONG_FORMAT", 1919, "Encountered illegal format of dynamic column string" }, -{ "ER_DYN_COL_IMPLEMENTATION_LIMIT", 1920, "Dynamic column implementation limit reached" }, -{ "ER_DYN_COL_DATA", 1921, "Illegal value used as argument of dynamic column function" }, -{ "ER_DYN_COL_WRONG_CHARSET", 1922, "Dynamic column contains unknown character set" }, -{ "ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES", 1923, "At least one of the \'in_to_exists\' or \'materialization\' optimizer_switch flags must be \'on\'" }, -{ "ER_QUERY_CACHE_IS_DISABLED", 1924, "Query cache is disabled (resize or similar command in progress); repeat this command later" }, -{ "ER_QUERY_CACHE_IS_GLOBALY_DISABLED", 1925, "Query cache is globally disabled and you can\'t enable it only for this session" }, -{ "ER_VIEW_ORDERBY_IGNORED", 1926, "View \'%-.192s\'.\'%-.192s\' ORDER BY clause ignored because there is other ORDER BY clause already" }, -{ "ER_CONNECTION_KILLED", 1927, "Connection was killed" }, -{ "ER_UNUSED_12", 1928, "You should never see it" }, -{ "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION", 1929, "Cannot modify @@session.skip_replication inside a transaction" }, -{ "ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION", 1930, "Cannot modify @@session.skip_replication inside a stored function or trigger" }, -{ "ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT", 1931, "Query execution was interrupted. The query examined at least %llu rows, which exceeds LIMIT ROWS EXAMINED (%llu). The query result may be incomplete" }, -{ "ER_NO_SUCH_TABLE_IN_ENGINE", 1932, "Table \'%-.192s.%-.192s\' doesn\'t exist in engine" }, -{ "ER_TARGET_NOT_EXPLAINABLE", 1933, "Target is not running an EXPLAINable command" }, -{ "ER_CONNECTION_ALREADY_EXISTS", 1934, "Connection \'%.*s\' conflicts with existing connection \'%.*s\'" }, -{ "ER_MASTER_LOG_PREFIX", 1935, "Master \'%.*s\': " }, -{ "ER_CANT_START_STOP_SLAVE", 1936, "Can\'t %s SLAVE \'%.*s\'" }, -{ "ER_SLAVE_STARTED", 1937, "SLAVE \'%.*s\' started" }, -{ "ER_SLAVE_STOPPED", 1938, "SLAVE \'%.*s\' stopped" }, -{ "ER_SQL_DISCOVER_ERROR", 1939, "Engine %s failed to discover table %`-.192s.%`-.192s with \'%s\'" }, -{ "ER_FAILED_GTID_STATE_INIT", 1940, "Failed initializing replication GTID state" }, -{ "ER_INCORRECT_GTID_STATE", 1941, "Could not parse GTID list" }, -{ "ER_CANNOT_UPDATE_GTID_STATE", 1942, "Could not update replication slave gtid state" }, -{ "ER_DUPLICATE_GTID_DOMAIN", 1943, "GTID %u-%u-%llu and %u-%u-%llu conflict (duplicate domain id %u)" }, -{ "ER_GTID_OPEN_TABLE_FAILED", 1944, "Failed to open %s.%s" }, -{ "ER_GTID_POSITION_NOT_FOUND_IN_BINLOG", 1945, "Connecting slave requested to start from GTID %u-%u-%llu, which is not in the master\'s binlog" }, -{ "ER_CANNOT_LOAD_SLAVE_GTID_STATE", 1946, "Failed to load replication slave GTID position from table %s.%s" }, -{ "ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG", 1947, "Specified GTID %u-%u-%llu conflicts with the binary log which contains a more recent GTID %u-%u-%llu. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos" }, -{ "ER_MASTER_GTID_POS_MISSING_DOMAIN", 1948, "Specified value for @@gtid_slave_pos contains no value for replication domain %u. This conflicts with the binary log which contains GTID %u-%u-%llu. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos" }, -{ "ER_UNTIL_REQUIRES_USING_GTID", 1949, "START SLAVE UNTIL master_gtid_pos requires that slave is using GTID" }, -{ "ER_GTID_STRICT_OUT_OF_ORDER", 1950, "An attempt was made to binlog GTID %u-%u-%llu which would create an out-of-order sequence number with existing GTID %u-%u-%llu, and gtid strict mode is enabled" }, -{ "ER_GTID_START_FROM_BINLOG_HOLE", 1951, "The binlog on the master is missing the GTID %u-%u-%llu requested by the slave (even though a subsequent sequence number does exist), and GTID strict mode is enabled" }, -{ "ER_SLAVE_UNEXPECTED_MASTER_SWITCH", 1952, "Unexpected GTID received from master after reconnect. This normally indicates that the master server was replaced without restarting the slave threads. %s" }, -{ "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO", 1953, "Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a transaction" }, -{ "ER_STORED_FUNCTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO", 1954, "Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a stored function or trigger" }, -{ "ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2", 1955, "Connecting slave requested to start from GTID %u-%u-%llu, which is not in the master\'s binlog. Since the master\'s binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged due to executing extra erroneous transactions" }, -{ "ER_BINLOG_MUST_BE_EMPTY", 1956, "This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log" }, -{ "ER_NO_SUCH_QUERY", 1957, "Unknown query id: %lld" }, -{ "ER_BAD_BASE64_DATA", 1958, "Bad base64 data as position %u" }, -{ "ER_INVALID_ROLE", 1959, "Invalid role specification %`s" }, -{ "ER_INVALID_CURRENT_USER", 1960, "The current user is invalid" }, -{ "ER_CANNOT_GRANT_ROLE", 1961, "Cannot grant role \'%s\' to: %s" }, -{ "ER_CANNOT_REVOKE_ROLE", 1962, "Cannot revoke role \'%s\' from: %s" }, -{ "ER_CHANGE_SLAVE_PARALLEL_THREADS_ACTIVE", 1963, "Cannot change @@slave_parallel_threads while another change is in progress" }, -{ "ER_PRIOR_COMMIT_FAILED", 1964, "Commit failed due to failure of an earlier commit on which this one depends" }, -{ "ER_IT_IS_A_VIEW", 1965, "\'%-.192s\' is a view" }, -{ "ER_SLAVE_SKIP_NOT_IN_GTID", 1966, "When using parallel replication and GTID with multiple replication domains, @@sql_slave_skip_counter can not be used. Instead, setting @@gtid_slave_pos explicitly can be used to skip to after a given GTID position" }, -{ "ER_TABLE_DEFINITION_TOO_BIG", 1967, "The definition for table %`s is too big" }, -{ "ER_PLUGIN_INSTALLED", 1968, "Plugin \'%-.192s\' already installed" }, -{ "ER_STATEMENT_TIMEOUT", 1969, "Query execution was interrupted (max_statement_time exceeded)" }, -{ "ER_SUBQUERIES_NOT_SUPPORTED", 1970, "%s does not support subqueries or stored functions" }, -{ "ER_SET_STATEMENT_NOT_SUPPORTED", 1971, "The system variable %.200s cannot be set in SET STATEMENT." }, -{ "ER_UNUSED_9", 1972, "You should never see it" }, -{ "ER_USER_CREATE_EXISTS", 1973, "Can\'t create user \'%-.64s\'@\'%-.64s\'; it already exists" }, -{ "ER_USER_DROP_EXISTS", 1974, "Can\'t drop user \'%-.64s\'@\'%-.64s\'; it doesn\'t exist" }, -{ "ER_ROLE_CREATE_EXISTS", 1975, "Can\'t create role \'%-.64s\'; it already exists" }, -{ "ER_ROLE_DROP_EXISTS", 1976, "Can\'t drop role \'%-.64s\'; it doesn\'t exist" }, -{ "ER_CANNOT_CONVERT_CHARACTER", 1977, "Cannot convert \'%s\' character 0x%-.64s to \'%s\'" }, -{ "ER_INVALID_DEFAULT_VALUE_FOR_FIELD", 1978, "Incorrect default value \'%-.128T\' for column \'%.192s\'" }, -{ "ER_KILL_QUERY_DENIED_ERROR", 1979, "You are not owner of query %lu" }, -{ "ER_NO_EIS_FOR_FIELD", 1980, "Engine-independent statistics are not collected for column \'%s\'" }, -{ "ER_WARN_AGGFUNC_DEPENDENCE", 1981, "Aggregate function \'%-.192s)\' of SELECT #%d belongs to SELECT #%d" }, -{ "WARN_INNODB_PARTITION_OPTION_IGNORED", 1982, "<%-.64s> option ignored for InnoDB partition" }, -{ "ER_FILE_CORRUPT", 3000, "File %s is corrupted" }, -{ "ER_ERROR_ON_MASTER", 3001, "Query partially completed on the master (error on master: %d) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;. Query:\'%s\'" }, -{ "ER_INCONSISTENT_ERROR", 3002, "Query caused different errors on master and slave. Error on master: message (format)=\'%s\' error code=%d; Error on slave:actual message=\'%s\', error code=%d. Default database:\'%s\'. Query:\'%s\'" }, -{ "ER_STORAGE_ENGINE_NOT_LOADED", 3003, "Storage engine for table \'%s\'.\'%s\' is not loaded." }, -{ "ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER", 3004, "GET STACKED DIAGNOSTICS when handler not active" }, -{ "ER_WARN_LEGACY_SYNTAX_CONVERTED", 3005, "%s is no longer supported. The statement was converted to %s." }, -{ "ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN", 3006, "Statement is unsafe because it uses a fulltext parser plugin which may not return the same value on the slave." }, -{ "ER_CANNOT_DISCARD_TEMPORARY_TABLE", 3007, "Cannot DISCARD/IMPORT tablespace associated with temporary table" }, -{ "ER_FK_DEPTH_EXCEEDED", 3008, "Foreign key cascade delete/update exceeds max depth of %d." }, -{ "ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2", 3009, "Column count of %s.%s is wrong. Expected %d, found %d. Created with MariaDB %d, now running %d. Please use mariadb-upgrade to fix this error." }, -{ "ER_WARN_TRIGGER_DOESNT_HAVE_CREATED", 3010, "Trigger %s.%s.%s does not have CREATED attribute." }, -{ "ER_REFERENCED_TRG_DOES_NOT_EXIST_MYSQL", 3011, "Referenced trigger \'%s\' for the given action time and event type does not exist." }, -{ "ER_EXPLAIN_NOT_SUPPORTED", 3012, "EXPLAIN FOR CONNECTION command is supported only for SELECT/UPDATE/INSERT/DELETE/REPLACE" }, -{ "ER_INVALID_FIELD_SIZE", 3013, "Invalid size for column \'%-.192s\'." }, -{ "ER_MISSING_HA_CREATE_OPTION", 3014, "Table storage engine \'%-.64s\' found required create option missing" }, -{ "ER_ENGINE_OUT_OF_MEMORY", 3015, "Out of memory in storage engine \'%-.64s\'." }, -{ "ER_PASSWORD_EXPIRE_ANONYMOUS_USER", 3016, "The password for anonymous user cannot be expired." }, -{ "ER_SLAVE_SQL_THREAD_MUST_STOP", 3017, "This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD first" }, -{ "ER_NO_FT_MATERIALIZED_SUBQUERY", 3018, "Cannot create FULLTEXT index on materialized subquery" }, -{ "ER_INNODB_UNDO_LOG_FULL", 3019, "Undo Log error: %s" }, -{ "ER_INVALID_ARGUMENT_FOR_LOGARITHM", 3020, "Invalid argument for logarithm" }, -{ "ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP", 3021, "This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL \'%s\' first." }, -{ "ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO", 3022, "This operation may not be safe when the slave has temporary tables. The tables will be kept open until the server restarts or until the tables are deleted by any replicated DROP statement. Suggest to wait until slave_open_temp_tables = 0." }, -{ "ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS", 3023, "CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file." }, -{ "ER_QUERY_TIMEOUT", 3024, "Query execution was interrupted, maximum statement execution time exceeded" }, -{ "ER_NON_RO_SELECT_DISABLE_TIMER", 3025, "Select is not a read only statement, disabling timer" }, -{ "ER_DUP_LIST_ENTRY", 3026, "Duplicate entry \'%-.192s\'." }, -{ "ER_SQL_MODE_NO_EFFECT", 3027, "\'%s\' mode no longer has any effect. Use STRICT_ALL_TABLES or STRICT_TRANS_TABLES instead." }, -{ "ER_AGGREGATE_ORDER_FOR_UNION", 3028, "Expression #%u of ORDER BY contains aggregate function and applies to a UNION" }, -{ "ER_AGGREGATE_ORDER_NON_AGG_QUERY", 3029, "Expression #%u of ORDER BY contains aggregate function and applies to the result of a non-aggregated query" }, -{ "ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR", 3030, "Slave worker has stopped after at least one previous worker encountered an error when slave-preserve-commit-order was enabled. To preserve commit order, the last transaction executed by this thread has not been committed. When restarting the slave after fixing any failed threads, you should fix this worker as well." }, -{ "ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER", 3031, "slave_preserve_commit_order is not supported %s." }, -{ "ER_SERVER_OFFLINE_MODE", 3032, "The server is currently in offline mode" }, -{ "ER_GIS_DIFFERENT_SRIDS", 3033, "Binary geometry function %s given two geometries of different srids: %u and %u, which should have been identical." }, -{ "ER_GIS_UNSUPPORTED_ARGUMENT", 3034, "Calling geometry function %s with unsupported types of arguments." }, -{ "ER_GIS_UNKNOWN_ERROR", 3035, "Unknown GIS error occurred in function %s." }, -{ "ER_GIS_UNKNOWN_EXCEPTION", 3036, "Unknown exception caught in GIS function %s." }, -{ "ER_GIS_INVALID_DATA", 3037, "Invalid GIS data provided to function %s." }, -{ "ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION", 3038, "The geometry has no data in function %s." }, -{ "ER_BOOST_GEOMETRY_CENTROID_EXCEPTION", 3039, "Unable to calculate centroid because geometry is empty in function %s." }, -{ "ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION", 3040, "Geometry overlay calculation error: geometry data is invalid in function %s." }, -{ "ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION", 3041, "Geometry turn info calculation error: geometry data is invalid in function %s." }, -{ "ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION", 3042, "Analysis procedures of intersection points interrupted unexpectedly in function %s." }, -{ "ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION", 3043, "Unknown exception thrown in function %s." }, -{ "ER_STD_BAD_ALLOC_ERROR", 3044, "Memory allocation error: %-.256s in function %s." }, -{ "ER_STD_DOMAIN_ERROR", 3045, "Domain error: %-.256s in function %s." }, -{ "ER_STD_LENGTH_ERROR", 3046, "Length error: %-.256s in function %s." }, -{ "ER_STD_INVALID_ARGUMENT", 3047, "Invalid argument error: %-.256s in function %s." }, -{ "ER_STD_OUT_OF_RANGE_ERROR", 3048, "Out of range error: %-.256s in function %s." }, -{ "ER_STD_OVERFLOW_ERROR", 3049, "Overflow error error: %-.256s in function %s." }, -{ "ER_STD_RANGE_ERROR", 3050, "Range error: %-.256s in function %s." }, -{ "ER_STD_UNDERFLOW_ERROR", 3051, "Underflow error: %-.256s in function %s." }, -{ "ER_STD_LOGIC_ERROR", 3052, "Logic error: %-.256s in function %s." }, -{ "ER_STD_RUNTIME_ERROR", 3053, "Runtime error: %-.256s in function %s." }, -{ "ER_STD_UNKNOWN_EXCEPTION", 3054, "Unknown exception: %-.384s in function %s." }, -{ "ER_GIS_DATA_WRONG_ENDIANESS", 3055, "Geometry byte string must be little endian." }, -{ "ER_CHANGE_MASTER_PASSWORD_LENGTH", 3056, "The password provided for the replication user exceeds the maximum length of 32 characters" }, -{ "ER_USER_LOCK_WRONG_NAME", 3057, "Incorrect user-level lock name \'%-.192s\'." }, -{ "ER_USER_LOCK_DEADLOCK", 3058, "Deadlock found when trying to get user-level lock; try rolling back transaction/releasing locks and restarting lock acquisition." }, -{ "ER_REPLACE_INACCESSIBLE_ROWS", 3059, "REPLACE cannot be executed as it requires deleting rows that are not in the view" }, -{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS", 3060, "Do not support online operation on table with GIS index" }, -{ "ER_COMMULTI_BADCONTEXT", 4000, "COM_MULTI can\'t return a result set in the given context" }, -{ "ER_BAD_COMMAND_IN_MULTI", 4001, "Command \'%s\' is not allowed for COM_MULTI" }, -{ "ER_WITH_COL_WRONG_LIST", 4002, "WITH column list and SELECT field list have different column counts" }, -{ "ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE", 4003, "Too many WITH elements in WITH clause" }, -{ "ER_DUP_QUERY_NAME", 4004, "Duplicate query name %`-.64s in WITH clause" }, -{ "ER_RECURSIVE_WITHOUT_ANCHORS", 4005, "No anchors for recursive WITH element \'%s\'" }, -{ "ER_UNACCEPTABLE_MUTUAL_RECURSION", 4006, "Unacceptable mutual recursion with anchored table \'%s\'" }, -{ "ER_REF_TO_RECURSIVE_WITH_TABLE_IN_DERIVED", 4007, "Reference to recursive WITH table \'%s\' in materialized derived" }, -{ "ER_NOT_STANDARD_COMPLIANT_RECURSIVE", 4008, "Restrictions imposed on recursive definitions are violated for table \'%s\'" }, -{ "ER_WRONG_WINDOW_SPEC_NAME", 4009, "Window specification with name \'%s\' is not defined" }, -{ "ER_DUP_WINDOW_NAME", 4010, "Multiple window specifications with the same name \'%s\'" }, -{ "ER_PARTITION_LIST_IN_REFERENCING_WINDOW_SPEC", 4011, "Window specification referencing another one \'%s\' cannot contain partition list" }, -{ "ER_ORDER_LIST_IN_REFERENCING_WINDOW_SPEC", 4012, "Referenced window specification \'%s\' already contains order list" }, -{ "ER_WINDOW_FRAME_IN_REFERENCED_WINDOW_SPEC", 4013, "Referenced window specification \'%s\' cannot contain window frame" }, -{ "ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS", 4014, "Unacceptable combination of window frame bound specifications" }, -{ "ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION", 4015, "Window function is allowed only in SELECT list and ORDER BY clause" }, -{ "ER_WINDOW_FUNCTION_IN_WINDOW_SPEC", 4016, "Window function is not allowed in window specification" }, -{ "ER_NOT_ALLOWED_WINDOW_FRAME", 4017, "Window frame is not allowed with \'%s\'" }, -{ "ER_NO_ORDER_LIST_IN_WINDOW_SPEC", 4018, "No order list in window specification for \'%s\'" }, -{ "ER_RANGE_FRAME_NEEDS_SIMPLE_ORDERBY", 4019, "RANGE-type frame requires ORDER BY clause with single sort key" }, -{ "ER_WRONG_TYPE_FOR_ROWS_FRAME", 4020, "Integer is required for ROWS-type frame" }, -{ "ER_WRONG_TYPE_FOR_RANGE_FRAME", 4021, "Numeric datatype is required for RANGE-type frame" }, -{ "ER_FRAME_EXCLUSION_NOT_SUPPORTED", 4022, "Frame exclusion is not supported yet" }, -{ "ER_WINDOW_FUNCTION_DONT_HAVE_FRAME", 4023, "This window function may not have a window frame" }, -{ "ER_INVALID_NTILE_ARGUMENT", 4024, "Argument of NTILE must be greater than 0" }, -{ "ER_CONSTRAINT_FAILED", 4025, "CONSTRAINT %`s failed for %`-.192s.%`-.192s" }, -{ "ER_EXPRESSION_IS_TOO_BIG", 4026, "Expression in the %s clause is too big" }, -{ "ER_ERROR_EVALUATING_EXPRESSION", 4027, "Got an error evaluating stored expression %s" }, -{ "ER_CALCULATING_DEFAULT_VALUE", 4028, "Got an error when calculating default value for %`s" }, -{ "ER_EXPRESSION_REFERS_TO_UNINIT_FIELD", 4029, "Expression for field %`-.64s is referring to uninitialized field %`s" }, -{ "ER_PARTITION_DEFAULT_ERROR", 4030, "Only one DEFAULT partition allowed" }, -{ "ER_REFERENCED_TRG_DOES_NOT_EXIST", 4031, "Referenced trigger \'%s\' for the given action time and event type does not exist" }, -{ "ER_INVALID_DEFAULT_PARAM", 4032, "Default/ignore value is not supported for such parameter usage" }, -{ "ER_BINLOG_NON_SUPPORTED_BULK", 4033, "Only row based replication supported for bulk operations" }, -{ "ER_BINLOG_UNCOMPRESS_ERROR", 4034, "Uncompress the compressed binlog failed" }, -{ "ER_JSON_BAD_CHR", 4035, "Broken JSON string in argument %d to function \'%s\' at position %d" }, -{ "ER_JSON_NOT_JSON_CHR", 4036, "Character disallowed in JSON in argument %d to function \'%s\' at position %d" }, -{ "ER_JSON_EOS", 4037, "Unexpected end of JSON text in argument %d to function \'%s\'" }, -{ "ER_JSON_SYNTAX", 4038, "Syntax error in JSON text in argument %d to function \'%s\' at position %d" }, -{ "ER_JSON_ESCAPING", 4039, "Incorrect escaping in JSON text in argument %d to function \'%s\' at position %d" }, -{ "ER_JSON_DEPTH", 4040, "Limit of %d on JSON nested strucures depth is reached in argument %d to function \'%s\' at position %d" }, -{ "ER_JSON_PATH_EOS", 4041, "Unexpected end of JSON path in argument %d to function \'%s\'" }, -{ "ER_JSON_PATH_SYNTAX", 4042, "Syntax error in JSON path in argument %d to function \'%s\' at position %d" }, -{ "ER_JSON_PATH_DEPTH", 4043, "Limit of %d on JSON path depth is reached in argument %d to function \'%s\' at position %d" }, -{ "ER_JSON_PATH_NO_WILDCARD", 4044, "Wildcards in JSON path not allowed in argument %d to function \'%s\'" }, -{ "ER_JSON_PATH_ARRAY", 4045, "JSON path should end with an array identifier in argument %d to function \'%s\'" }, -{ "ER_JSON_ONE_OR_ALL", 4046, "Argument 2 to function \'%s\' must be \"one\" or \"all\"." }, -{ "ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE", 4047, "CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE." }, -{ "ER_GEOJSON_INCORRECT", 4048, "Incorrect GeoJSON format specified for st_geomfromgeojson function." }, -{ "ER_GEOJSON_TOO_FEW_POINTS", 4049, "Incorrect GeoJSON format - too few points for linestring specified." }, -{ "ER_GEOJSON_NOT_CLOSED", 4050, "Incorrect GeoJSON format - polygon not closed." }, -{ "ER_JSON_PATH_EMPTY", 4051, "Path expression \'$\' is not allowed in argument %d to function \'%s\'." }, -{ "ER_SLAVE_SAME_ID", 4052, "A slave with the same server_uuid/server_id as this slave has connected to the master" }, -{ "ER_FLASHBACK_NOT_SUPPORTED", 4053, "Flashback does not support %s %s" }, -{ "ER_KEYS_OUT_OF_ORDER", 4054, "Keys are out order during bulk load" }, -{ "ER_OVERLAPPING_KEYS", 4055, "Bulk load rows overlap existing rows" }, -{ "ER_REQUIRE_ROW_BINLOG_FORMAT", 4056, "Can\'t execute updates on master with binlog_format != ROW." }, -{ "ER_ISOLATION_MODE_NOT_SUPPORTED", 4057, "MyRocks supports only READ COMMITTED and REPEATABLE READ isolation levels. Please change from current isolation level %s" }, -{ "ER_ON_DUPLICATE_DISABLED", 4058, "When unique checking is disabled in MyRocks, INSERT,UPDATE,LOAD statements with clauses that update or replace the key (i.e. INSERT ON DUPLICATE KEY UPDATE, REPLACE) are not allowed. Query: %s" }, -{ "ER_UPDATES_WITH_CONSISTENT_SNAPSHOT", 4059, "Can\'t execute updates when you started a transaction with START TRANSACTION WITH CONSISTENT [ROCKSDB] SNAPSHOT." }, -{ "ER_ROLLBACK_ONLY", 4060, "This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction." }, -{ "ER_ROLLBACK_TO_SAVEPOINT", 4061, "MyRocks currently does not support ROLLBACK TO SAVEPOINT if modifying rows." }, -{ "ER_ISOLATION_LEVEL_WITH_CONSISTENT_SNAPSHOT", 4062, "Only REPEATABLE READ isolation level is supported for START TRANSACTION WITH CONSISTENT SNAPSHOT in RocksDB Storage Engine." }, -{ "ER_UNSUPPORTED_COLLATION", 4063, "Unsupported collation on string indexed column %s.%s Use binary collation (%s)." }, -{ "ER_METADATA_INCONSISTENCY", 4064, "Table \'%s\' does not exist, but metadata information exists inside MyRocks. This is a sign of data inconsistency. Please check if \'%s.frm\' exists, and try to restore it if it does not exist." }, -{ "ER_CF_DIFFERENT", 4065, "Column family (\'%s\') flag (%d) is different from an existing flag (%d). Assign a new CF flag, or do not change existing CF flag." }, -{ "ER_RDB_TTL_DURATION_FORMAT", 4066, "TTL duration (%s) in MyRocks must be an unsigned non-null 64-bit integer." }, -{ "ER_RDB_STATUS_GENERAL", 4067, "Status error %d received from RocksDB: %s" }, -{ "ER_RDB_STATUS_MSG", 4068, "%s, Status error %d received from RocksDB: %s" }, -{ "ER_RDB_TTL_UNSUPPORTED", 4069, "TTL support is currently disabled when table has a hidden PK." }, -{ "ER_RDB_TTL_COL_FORMAT", 4070, "TTL column (%s) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration." }, -{ "ER_PER_INDEX_CF_DEPRECATED", 4071, "The per-index column family option has been deprecated" }, -{ "ER_KEY_CREATE_DURING_ALTER", 4072, "MyRocks failed creating new key definitions during alter." }, -{ "ER_SK_POPULATE_DURING_ALTER", 4073, "MyRocks failed populating secondary key during alter." }, -{ "ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG", 4074, "Window functions can not be used as arguments to group functions." }, -{ "ER_NET_OK_PACKET_TOO_LARGE", 4075, "OK packet too large" }, -{ "ER_GEOJSON_EMPTY_COORDINATES", 4076, "Incorrect GeoJSON format - empty \'coordinates\' array." }, -{ "ER_MYROCKS_CANT_NOPAD_COLLATION", 4077, "MyRocks doesn\'t currently support collations with \"No pad\" attribute." }, -{ "ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION", 4078, "Illegal parameter data types %s and %s for operation \'%s\'" }, -{ "ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION", 4079, "Illegal parameter data type %s for operation \'%s\'" }, -{ "ER_WRONG_PARAMCOUNT_TO_CURSOR", 4080, "Incorrect parameter count to cursor \'%-.192s\'" }, -{ "ER_UNKNOWN_STRUCTURED_VARIABLE", 4081, "Unknown structured system variable or ROW routine variable \'%-.*s\'" }, -{ "ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD", 4082, "Row variable \'%-.192s\' does not have a field \'%-.192s\'" }, -{ "ER_END_IDENTIFIER_DOES_NOT_MATCH", 4083, "END identifier \'%-.192s\' does not match \'%-.192s\'" }, -{ "ER_SEQUENCE_RUN_OUT", 4084, "Sequence \'%-.64s.%-.64s\' has run out" }, -{ "ER_SEQUENCE_INVALID_DATA", 4085, "Sequence \'%-.64s.%-.64s\' values are conflicting" }, -{ "ER_SEQUENCE_INVALID_TABLE_STRUCTURE", 4086, "Sequence \'%-.64s.%-.64s\' table structure is invalid (%s)" }, -{ "ER_SEQUENCE_ACCESS_ERROR", 4087, "Sequence \'%-.64s.%-.64s\' access error" }, -{ "ER_SEQUENCE_BINLOG_FORMAT", 4088, "Sequences requires binlog_format mixed or row" }, -{ "ER_NOT_SEQUENCE", 4089, "\'%-.64s.%-.64s\' is not a SEQUENCE" }, -{ "ER_NOT_SEQUENCE2", 4090, "\'%-.192s\' is not a SEQUENCE" }, -{ "ER_UNKNOWN_SEQUENCES", 4091, "Unknown SEQUENCE: \'%-.300s\'" }, -{ "ER_UNKNOWN_VIEW", 4092, "Unknown VIEW: \'%-.300s\'" }, -{ "ER_WRONG_INSERT_INTO_SEQUENCE", 4093, "Wrong INSERT into a SEQUENCE. One can only do single table INSERT into a sequence object (like with mariadb-dump). If you want to change the SEQUENCE, use ALTER SEQUENCE instead." }, -{ "ER_SP_STACK_TRACE", 4094, "At line %u in %s" }, -{ "ER_PACKAGE_ROUTINE_IN_SPEC_NOT_DEFINED_IN_BODY", 4095, "Subroutine \'%-.192s\' is declared in the package specification but is not defined in the package body" }, -{ "ER_PACKAGE_ROUTINE_FORWARD_DECLARATION_NOT_DEFINED", 4096, "Subroutine \'%-.192s\' has a forward declaration but is not defined" }, -{ "ER_COMPRESSED_COLUMN_USED_AS_KEY", 4097, "Compressed column \'%-.192s\' can\'t be used in key specification" }, -{ "ER_UNKNOWN_COMPRESSION_METHOD", 4098, "Unknown compression method: %s" }, -{ "ER_WRONG_NUMBER_OF_VALUES_IN_TVC", 4099, "The used table value constructor has a different number of values" }, -{ "ER_FIELD_REFERENCE_IN_TVC", 4100, "Field reference \'%-.192s\' can\'t be used in table value constructor" }, -{ "ER_WRONG_TYPE_FOR_PERCENTILE_FUNC", 4101, "Numeric datatype is required for %s function" }, -{ "ER_ARGUMENT_NOT_CONSTANT", 4102, "Argument to the %s function is not a constant for a partition" }, -{ "ER_ARGUMENT_OUT_OF_RANGE", 4103, "Argument to the %s function does not belong to the range [0,1]" }, -{ "ER_WRONG_TYPE_OF_ARGUMENT", 4104, "%s function only accepts arguments that can be converted to numerical types" }, -{ "ER_NOT_AGGREGATE_FUNCTION", 4105, "Aggregate specific instruction (FETCH GROUP NEXT ROW) used in a wrong context" }, -{ "ER_INVALID_AGGREGATE_FUNCTION", 4106, "Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function" }, -{ "ER_INVALID_VALUE_TO_LIMIT", 4107, "Limit only accepts integer values" }, -{ "ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT", 4108, "Invisible column %`s must have a default value" }, -{ "ER_UPDATE_INFO_WITH_SYSTEM_VERSIONING", 4109, "Rows matched: %ld Changed: %ld Inserted: %ld Warnings: %ld" }, -{ "ER_VERS_FIELD_WRONG_TYPE", 4110, "%`s must be of type %s for system-versioned table %`s" }, -{ "ER_VERS_ENGINE_UNSUPPORTED", 4111, "Transaction-precise system versioning for %`s is not supported" }, -{ "ER_UNUSED_23", 4112, "You should never see it" }, -{ "ER_PARTITION_WRONG_TYPE", 4113, "Wrong partitioning type, expected type: %`s" }, -{ "WARN_VERS_PART_FULL", 4114, "Versioned table %`s.%`s: last HISTORY partition (%`s) is out of %s, need more HISTORY partitions" }, -{ "WARN_VERS_PARAMETERS", 4115, "Maybe missing parameters: %s" }, -{ "ER_VERS_DROP_PARTITION_INTERVAL", 4116, "Can only drop oldest partitions when rotating by INTERVAL" }, -{ "ER_UNUSED_25", 4117, "You should never see it" }, -{ "WARN_VERS_PART_NON_HISTORICAL", 4118, "Partition %`s contains non-historical data" }, -{ "ER_VERS_ALTER_NOT_ALLOWED", 4119, "Not allowed for system-versioned %`s.%`s. Change @@system_versioning_alter_history to proceed with ALTER." }, -{ "ER_VERS_ALTER_ENGINE_PROHIBITED", 4120, "Not allowed for system-versioned %`s.%`s. Change to/from native system versioning engine is not supported." }, -{ "ER_VERS_RANGE_PROHIBITED", 4121, "SYSTEM_TIME range selector is not allowed" }, -{ "ER_CONFLICTING_FOR_SYSTEM_TIME", 4122, "Conflicting FOR SYSTEM_TIME clauses in WITH RECURSIVE" }, -{ "ER_VERS_TABLE_MUST_HAVE_COLUMNS", 4123, "Table %`s must have at least one versioned column" }, -{ "ER_VERS_NOT_VERSIONED", 4124, "Table %`s is not system-versioned" }, -{ "ER_MISSING", 4125, "Wrong parameters for %`s: missing \'%s\'" }, -{ "ER_VERS_PERIOD_COLUMNS", 4126, "PERIOD FOR SYSTEM_TIME must use columns %`s and %`s" }, -{ "ER_PART_WRONG_VALUE", 4127, "Wrong parameters for partitioned %`s: wrong value for \'%s\'" }, -{ "ER_VERS_WRONG_PARTS", 4128, "Wrong partitions for %`s: must have at least one HISTORY and exactly one last CURRENT" }, -{ "ER_VERS_NO_TRX_ID", 4129, "TRX_ID %llu not found in `mysql.transaction_registry`" }, -{ "ER_VERS_ALTER_SYSTEM_FIELD", 4130, "Can not change system versioning field %`s" }, -{ "ER_DROP_VERSIONING_SYSTEM_TIME_PARTITION", 4131, "Can not DROP SYSTEM VERSIONING for table %`s partitioned BY SYSTEM_TIME" }, -{ "ER_VERS_DB_NOT_SUPPORTED", 4132, "System-versioned tables in the %`s database are not supported" }, -{ "ER_VERS_TRT_IS_DISABLED", 4133, "Transaction registry is disabled" }, -{ "ER_VERS_DUPLICATE_ROW_START_END", 4134, "Duplicate ROW %s column %`s" }, -{ "ER_VERS_ALREADY_VERSIONED", 4135, "Table %`s is already system-versioned" }, -{ "ER_UNUSED_24", 4136, "You should never see it" }, -{ "ER_VERS_NOT_SUPPORTED", 4137, "System-versioned tables do not support %s" }, -{ "ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED", 4138, "Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END" }, -{ "ER_INDEX_FILE_FULL", 4139, "The index file for table \'%-.192s\' is full" }, -{ "ER_UPDATED_COLUMN_ONLY_ONCE", 4140, "The column %`s.%`s cannot be changed more than once in a single UPDATE statement" }, -{ "ER_EMPTY_ROW_IN_TVC", 4141, "Row with no elements is not allowed in table value constructor in this context" }, -{ "ER_VERS_QUERY_IN_PARTITION", 4142, "SYSTEM_TIME partitions in table %`s does not support historical query" }, -{ "ER_KEY_DOESNT_SUPPORT", 4143, "%s index %`s does not support this operation" }, -{ "ER_ALTER_OPERATION_TABLE_OPTIONS_NEED_REBUILD", 4144, "Changing table options requires the table to be rebuilt" }, -{ "ER_BACKUP_LOCK_IS_ACTIVE", 4145, "Can\'t execute the command as you have a BACKUP STAGE active" }, -{ "ER_BACKUP_NOT_RUNNING", 4146, "You must start backup with \"BACKUP STAGE START\"" }, -{ "ER_BACKUP_WRONG_STAGE", 4147, "Backup stage \'%s\' is same or before current backup stage \'%s\'" }, -{ "ER_BACKUP_STAGE_FAILED", 4148, "Backup stage \'%s\' failed" }, -{ "ER_BACKUP_UNKNOWN_STAGE", 4149, "Unknown backup stage: \'%s\'. Stage should be one of START, FLUSH, BLOCK_DDL, BLOCK_COMMIT or END" }, -{ "ER_USER_IS_BLOCKED", 4150, "User is blocked because of too many credential errors; unblock with \'FLUSH PRIVILEGES\'" }, -{ "ER_ACCOUNT_HAS_BEEN_LOCKED", 4151, "Access denied, this account is locked" }, -{ "ER_PERIOD_TEMPORARY_NOT_ALLOWED", 4152, "Application-time period table cannot be temporary" }, -{ "ER_PERIOD_TYPES_MISMATCH", 4153, "Fields of PERIOD FOR %`s have different types" }, -{ "ER_MORE_THAN_ONE_PERIOD", 4154, "Cannot specify more than one application-time period" }, -{ "ER_PERIOD_FIELD_WRONG_ATTRIBUTES", 4155, "Period field %`s cannot be %s" }, -{ "ER_PERIOD_NOT_FOUND", 4156, "Period %`s is not found in table" }, -{ "ER_PERIOD_COLUMNS_UPDATED", 4157, "Column %`s used in period %`s specified in update SET list" }, -{ "ER_PERIOD_CONSTRAINT_DROP", 4158, "Can\'t DROP CONSTRAINT `%s`. Use DROP PERIOD `%s` for this" }, -{ "ER_TOO_LONG_KEYPART", 4159, "Specified key part was too long; max key part length is %u bytes" }, -{ "ER_TOO_LONG_DATABASE_COMMENT", 4160, "Comment for database \'%-.64s\' is too long (max = %u)" }, -{ "ER_UNKNOWN_DATA_TYPE", 4161, "Unknown data type: \'%-.64s\'" }, -{ "ER_UNKNOWN_OPERATOR", 4162, "Operator does not exists: \'%-.128s\'" }, -{ "ER_WARN_HISTORY_ROW_START_TIME", 4163, "Table `%s.%s` history row start \'%s\' is later than row end \'%s\'" }, -{ "ER_PART_STARTS_BEYOND_INTERVAL", 4164, "%`s: STARTS is later than query time, first history partition may exceed INTERVAL value" }, -{ "ER_GALERA_REPLICATION_NOT_SUPPORTED", 4165, "DDL-statement is forbidden as table storage engine does not support Galera replication" }, -{ "ER_LOAD_INFILE_CAPABILITY_DISABLED", 4166, "The used command is not allowed because the MariaDB server or client has disabled the local infile capability" }, -{ "ER_NO_SECURE_TRANSPORTS_CONFIGURED", 4167, "No secure transports are configured, unable to set --require_secure_transport=ON" }, -{ "ER_SLAVE_IGNORED_SHARED_TABLE", 4168, "Slave SQL thread ignored the \'%s\' because table is shared" }, -{ "ER_NO_AUTOINCREMENT_WITH_UNIQUE", 4169, "AUTO_INCREMENT column %`s cannot be used in the UNIQUE index %`s" }, -{ "ER_KEY_CONTAINS_PERIOD_FIELDS", 4170, "Key %`s cannot explicitly include column %`s" }, -{ "ER_KEY_CANT_HAVE_WITHOUT_OVERLAPS", 4171, "Key %`s cannot have WITHOUT OVERLAPS" }, -{ "ER_NOT_ALLOWED_IN_THIS_CONTEXT", 4172, "\'%-.128s\' is not allowed in this context" }, -{ "ER_DATA_WAS_COMMITED_UNDER_ROLLBACK", 4173, "Engine %s does not support rollback. Changes were committed during rollback call" }, diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/mysqld_error.h b/VCMP-LUA/modules/mariadb/include/mysql/server/mysqld_error.h deleted file mode 100644 index 04ec2da..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/mysqld_error.h +++ /dev/null @@ -1,1225 +0,0 @@ -/* Autogenerated file, please don't edit */ - -#ifndef ER_ERROR_FIRST -#define ER_ERROR_FIRST 1000 -#define ER_HASHCHK 1000 -#define ER_NISAMCHK 1001 -#define ER_NO 1002 -#define ER_YES 1003 -#define ER_CANT_CREATE_FILE 1004 -#define ER_CANT_CREATE_TABLE 1005 -#define ER_CANT_CREATE_DB 1006 -#define ER_DB_CREATE_EXISTS 1007 -#define ER_DB_DROP_EXISTS 1008 -#define ER_DB_DROP_DELETE 1009 -#define ER_DB_DROP_RMDIR 1010 -#define ER_CANT_DELETE_FILE 1011 -#define ER_CANT_FIND_SYSTEM_REC 1012 -#define ER_CANT_GET_STAT 1013 -#define ER_CANT_GET_WD 1014 -#define ER_CANT_LOCK 1015 -#define ER_CANT_OPEN_FILE 1016 -#define ER_FILE_NOT_FOUND 1017 -#define ER_CANT_READ_DIR 1018 -#define ER_CANT_SET_WD 1019 -#define ER_CHECKREAD 1020 -#define ER_DISK_FULL 1021 -#define ER_DUP_KEY 1022 -#define ER_ERROR_ON_CLOSE 1023 -#define ER_ERROR_ON_READ 1024 -#define ER_ERROR_ON_RENAME 1025 -#define ER_ERROR_ON_WRITE 1026 -#define ER_FILE_USED 1027 -#define ER_FILSORT_ABORT 1028 -#define ER_FORM_NOT_FOUND 1029 -#define ER_GET_ERRNO 1030 -#define ER_ILLEGAL_HA 1031 -#define ER_KEY_NOT_FOUND 1032 -#define ER_NOT_FORM_FILE 1033 -#define ER_NOT_KEYFILE 1034 -#define ER_OLD_KEYFILE 1035 -#define ER_OPEN_AS_READONLY 1036 -#define ER_OUTOFMEMORY 1037 -#define ER_OUT_OF_SORTMEMORY 1038 -#define ER_UNEXPECTED_EOF 1039 -#define ER_CON_COUNT_ERROR 1040 -#define ER_OUT_OF_RESOURCES 1041 -#define ER_BAD_HOST_ERROR 1042 -#define ER_HANDSHAKE_ERROR 1043 -#define ER_DBACCESS_DENIED_ERROR 1044 -#define ER_ACCESS_DENIED_ERROR 1045 -#define ER_NO_DB_ERROR 1046 -#define ER_UNKNOWN_COM_ERROR 1047 -#define ER_BAD_NULL_ERROR 1048 -#define ER_BAD_DB_ERROR 1049 -#define ER_TABLE_EXISTS_ERROR 1050 -#define ER_BAD_TABLE_ERROR 1051 -#define ER_NON_UNIQ_ERROR 1052 -#define ER_SERVER_SHUTDOWN 1053 -#define ER_BAD_FIELD_ERROR 1054 -#define ER_WRONG_FIELD_WITH_GROUP 1055 -#define ER_WRONG_GROUP_FIELD 1056 -#define ER_WRONG_SUM_SELECT 1057 -#define ER_WRONG_VALUE_COUNT 1058 -#define ER_TOO_LONG_IDENT 1059 -#define ER_DUP_FIELDNAME 1060 -#define ER_DUP_KEYNAME 1061 -#define ER_DUP_ENTRY 1062 -#define ER_WRONG_FIELD_SPEC 1063 -#define ER_PARSE_ERROR 1064 -#define ER_EMPTY_QUERY 1065 -#define ER_NONUNIQ_TABLE 1066 -#define ER_INVALID_DEFAULT 1067 -#define ER_MULTIPLE_PRI_KEY 1068 -#define ER_TOO_MANY_KEYS 1069 -#define ER_TOO_MANY_KEY_PARTS 1070 -#define ER_TOO_LONG_KEY 1071 -#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072 -#define ER_BLOB_USED_AS_KEY 1073 -#define ER_TOO_BIG_FIELDLENGTH 1074 -#define ER_WRONG_AUTO_KEY 1075 -#define ER_BINLOG_CANT_DELETE_GTID_DOMAIN 1076 -#define ER_NORMAL_SHUTDOWN 1077 -#define ER_GOT_SIGNAL 1078 -#define ER_SHUTDOWN_COMPLETE 1079 -#define ER_FORCING_CLOSE 1080 -#define ER_IPSOCK_ERROR 1081 -#define ER_NO_SUCH_INDEX 1082 -#define ER_WRONG_FIELD_TERMINATORS 1083 -#define ER_BLOBS_AND_NO_TERMINATED 1084 -#define ER_TEXTFILE_NOT_READABLE 1085 -#define ER_FILE_EXISTS_ERROR 1086 -#define ER_LOAD_INFO 1087 -#define ER_ALTER_INFO 1088 -#define ER_WRONG_SUB_KEY 1089 -#define ER_CANT_REMOVE_ALL_FIELDS 1090 -#define ER_CANT_DROP_FIELD_OR_KEY 1091 -#define ER_INSERT_INFO 1092 -#define ER_UPDATE_TABLE_USED 1093 -#define ER_NO_SUCH_THREAD 1094 -#define ER_KILL_DENIED_ERROR 1095 -#define ER_NO_TABLES_USED 1096 -#define ER_TOO_BIG_SET 1097 -#define ER_NO_UNIQUE_LOGFILE 1098 -#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099 -#define ER_TABLE_NOT_LOCKED 1100 -#define ER_UNUSED_17 1101 -#define ER_WRONG_DB_NAME 1102 -#define ER_WRONG_TABLE_NAME 1103 -#define ER_TOO_BIG_SELECT 1104 -#define ER_UNKNOWN_ERROR 1105 -#define ER_UNKNOWN_PROCEDURE 1106 -#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107 -#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108 -#define ER_UNKNOWN_TABLE 1109 -#define ER_FIELD_SPECIFIED_TWICE 1110 -#define ER_INVALID_GROUP_FUNC_USE 1111 -#define ER_UNSUPPORTED_EXTENSION 1112 -#define ER_TABLE_MUST_HAVE_COLUMNS 1113 -#define ER_RECORD_FILE_FULL 1114 -#define ER_UNKNOWN_CHARACTER_SET 1115 -#define ER_TOO_MANY_TABLES 1116 -#define ER_TOO_MANY_FIELDS 1117 -#define ER_TOO_BIG_ROWSIZE 1118 -#define ER_STACK_OVERRUN 1119 -#define ER_WRONG_OUTER_JOIN 1120 -#define ER_NULL_COLUMN_IN_INDEX 1121 -#define ER_CANT_FIND_UDF 1122 -#define ER_CANT_INITIALIZE_UDF 1123 -#define ER_UDF_NO_PATHS 1124 -#define ER_UDF_EXISTS 1125 -#define ER_CANT_OPEN_LIBRARY 1126 -#define ER_CANT_FIND_DL_ENTRY 1127 -#define ER_FUNCTION_NOT_DEFINED 1128 -#define ER_HOST_IS_BLOCKED 1129 -#define ER_HOST_NOT_PRIVILEGED 1130 -#define ER_PASSWORD_ANONYMOUS_USER 1131 -#define ER_PASSWORD_NOT_ALLOWED 1132 -#define ER_PASSWORD_NO_MATCH 1133 -#define ER_UPDATE_INFO 1134 -#define ER_CANT_CREATE_THREAD 1135 -#define ER_WRONG_VALUE_COUNT_ON_ROW 1136 -#define ER_CANT_REOPEN_TABLE 1137 -#define ER_INVALID_USE_OF_NULL 1138 -#define ER_REGEXP_ERROR 1139 -#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140 -#define ER_NONEXISTING_GRANT 1141 -#define ER_TABLEACCESS_DENIED_ERROR 1142 -#define ER_COLUMNACCESS_DENIED_ERROR 1143 -#define ER_ILLEGAL_GRANT_FOR_TABLE 1144 -#define ER_GRANT_WRONG_HOST_OR_USER 1145 -#define ER_NO_SUCH_TABLE 1146 -#define ER_NONEXISTING_TABLE_GRANT 1147 -#define ER_NOT_ALLOWED_COMMAND 1148 -#define ER_SYNTAX_ERROR 1149 -#define ER_DELAYED_CANT_CHANGE_LOCK 1150 -#define ER_TOO_MANY_DELAYED_THREADS 1151 -#define ER_ABORTING_CONNECTION 1152 -#define ER_NET_PACKET_TOO_LARGE 1153 -#define ER_NET_READ_ERROR_FROM_PIPE 1154 -#define ER_NET_FCNTL_ERROR 1155 -#define ER_NET_PACKETS_OUT_OF_ORDER 1156 -#define ER_NET_UNCOMPRESS_ERROR 1157 -#define ER_NET_READ_ERROR 1158 -#define ER_NET_READ_INTERRUPTED 1159 -#define ER_NET_ERROR_ON_WRITE 1160 -#define ER_NET_WRITE_INTERRUPTED 1161 -#define ER_TOO_LONG_STRING 1162 -#define ER_TABLE_CANT_HANDLE_BLOB 1163 -#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164 -#define ER_DELAYED_INSERT_TABLE_LOCKED 1165 -#define ER_WRONG_COLUMN_NAME 1166 -#define ER_WRONG_KEY_COLUMN 1167 -#define ER_WRONG_MRG_TABLE 1168 -#define ER_DUP_UNIQUE 1169 -#define ER_BLOB_KEY_WITHOUT_LENGTH 1170 -#define ER_PRIMARY_CANT_HAVE_NULL 1171 -#define ER_TOO_MANY_ROWS 1172 -#define ER_REQUIRES_PRIMARY_KEY 1173 -#define ER_NO_RAID_COMPILED 1174 -#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175 -#define ER_KEY_DOES_NOT_EXISTS 1176 -#define ER_CHECK_NO_SUCH_TABLE 1177 -#define ER_CHECK_NOT_IMPLEMENTED 1178 -#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 -#define ER_ERROR_DURING_COMMIT 1180 -#define ER_ERROR_DURING_ROLLBACK 1181 -#define ER_ERROR_DURING_FLUSH_LOGS 1182 -#define ER_ERROR_DURING_CHECKPOINT 1183 -#define ER_NEW_ABORTING_CONNECTION 1184 -#define ER_UNUSED_10 1185 -#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186 -#define ER_INDEX_REBUILD 1187 -#define ER_MASTER 1188 -#define ER_MASTER_NET_READ 1189 -#define ER_MASTER_NET_WRITE 1190 -#define ER_FT_MATCHING_KEY_NOT_FOUND 1191 -#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192 -#define ER_UNKNOWN_SYSTEM_VARIABLE 1193 -#define ER_CRASHED_ON_USAGE 1194 -#define ER_CRASHED_ON_REPAIR 1195 -#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196 -#define ER_TRANS_CACHE_FULL 1197 -#define ER_SLAVE_MUST_STOP 1198 -#define ER_SLAVE_NOT_RUNNING 1199 -#define ER_BAD_SLAVE 1200 -#define ER_MASTER_INFO 1201 -#define ER_SLAVE_THREAD 1202 -#define ER_TOO_MANY_USER_CONNECTIONS 1203 -#define ER_SET_CONSTANTS_ONLY 1204 -#define ER_LOCK_WAIT_TIMEOUT 1205 -#define ER_LOCK_TABLE_FULL 1206 -#define ER_READ_ONLY_TRANSACTION 1207 -#define ER_DROP_DB_WITH_READ_LOCK 1208 -#define ER_CREATE_DB_WITH_READ_LOCK 1209 -#define ER_WRONG_ARGUMENTS 1210 -#define ER_NO_PERMISSION_TO_CREATE_USER 1211 -#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 -#define ER_LOCK_DEADLOCK 1213 -#define ER_TABLE_CANT_HANDLE_FT 1214 -#define ER_CANNOT_ADD_FOREIGN 1215 -#define ER_NO_REFERENCED_ROW 1216 -#define ER_ROW_IS_REFERENCED 1217 -#define ER_CONNECT_TO_MASTER 1218 -#define ER_QUERY_ON_MASTER 1219 -#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220 -#define ER_WRONG_USAGE 1221 -#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222 -#define ER_CANT_UPDATE_WITH_READLOCK 1223 -#define ER_MIXING_NOT_ALLOWED 1224 -#define ER_DUP_ARGUMENT 1225 -#define ER_USER_LIMIT_REACHED 1226 -#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 -#define ER_LOCAL_VARIABLE 1228 -#define ER_GLOBAL_VARIABLE 1229 -#define ER_NO_DEFAULT 1230 -#define ER_WRONG_VALUE_FOR_VAR 1231 -#define ER_WRONG_TYPE_FOR_VAR 1232 -#define ER_VAR_CANT_BE_READ 1233 -#define ER_CANT_USE_OPTION_HERE 1234 -#define ER_NOT_SUPPORTED_YET 1235 -#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 -#define ER_SLAVE_IGNORED_TABLE 1237 -#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238 -#define ER_WRONG_FK_DEF 1239 -#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240 -#define ER_OPERAND_COLUMNS 1241 -#define ER_SUBQUERY_NO_1_ROW 1242 -#define ER_UNKNOWN_STMT_HANDLER 1243 -#define ER_CORRUPT_HELP_DB 1244 -#define ER_CYCLIC_REFERENCE 1245 -#define ER_AUTO_CONVERT 1246 -#define ER_ILLEGAL_REFERENCE 1247 -#define ER_DERIVED_MUST_HAVE_ALIAS 1248 -#define ER_SELECT_REDUCED 1249 -#define ER_TABLENAME_NOT_ALLOWED_HERE 1250 -#define ER_NOT_SUPPORTED_AUTH_MODE 1251 -#define ER_SPATIAL_CANT_HAVE_NULL 1252 -#define ER_COLLATION_CHARSET_MISMATCH 1253 -#define ER_SLAVE_WAS_RUNNING 1254 -#define ER_SLAVE_WAS_NOT_RUNNING 1255 -#define ER_TOO_BIG_FOR_UNCOMPRESS 1256 -#define ER_ZLIB_Z_MEM_ERROR 1257 -#define ER_ZLIB_Z_BUF_ERROR 1258 -#define ER_ZLIB_Z_DATA_ERROR 1259 -#define ER_CUT_VALUE_GROUP_CONCAT 1260 -#define ER_WARN_TOO_FEW_RECORDS 1261 -#define ER_WARN_TOO_MANY_RECORDS 1262 -#define ER_WARN_NULL_TO_NOTNULL 1263 -#define ER_WARN_DATA_OUT_OF_RANGE 1264 -#define WARN_DATA_TRUNCATED 1265 -#define ER_WARN_USING_OTHER_HANDLER 1266 -#define ER_CANT_AGGREGATE_2COLLATIONS 1267 -#define ER_DROP_USER 1268 -#define ER_REVOKE_GRANTS 1269 -#define ER_CANT_AGGREGATE_3COLLATIONS 1270 -#define ER_CANT_AGGREGATE_NCOLLATIONS 1271 -#define ER_VARIABLE_IS_NOT_STRUCT 1272 -#define ER_UNKNOWN_COLLATION 1273 -#define ER_SLAVE_IGNORED_SSL_PARAMS 1274 -#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275 -#define ER_WARN_FIELD_RESOLVED 1276 -#define ER_BAD_SLAVE_UNTIL_COND 1277 -#define ER_MISSING_SKIP_SLAVE 1278 -#define ER_UNTIL_COND_IGNORED 1279 -#define ER_WRONG_NAME_FOR_INDEX 1280 -#define ER_WRONG_NAME_FOR_CATALOG 1281 -#define ER_WARN_QC_RESIZE 1282 -#define ER_BAD_FT_COLUMN 1283 -#define ER_UNKNOWN_KEY_CACHE 1284 -#define ER_WARN_HOSTNAME_WONT_WORK 1285 -#define ER_UNKNOWN_STORAGE_ENGINE 1286 -#define ER_WARN_DEPRECATED_SYNTAX 1287 -#define ER_NON_UPDATABLE_TABLE 1288 -#define ER_FEATURE_DISABLED 1289 -#define ER_OPTION_PREVENTS_STATEMENT 1290 -#define ER_DUPLICATED_VALUE_IN_TYPE 1291 -#define ER_TRUNCATED_WRONG_VALUE 1292 -#define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293 -#define ER_INVALID_ON_UPDATE 1294 -#define ER_UNSUPPORTED_PS 1295 -#define ER_GET_ERRMSG 1296 -#define ER_GET_TEMPORARY_ERRMSG 1297 -#define ER_UNKNOWN_TIME_ZONE 1298 -#define ER_WARN_INVALID_TIMESTAMP 1299 -#define ER_INVALID_CHARACTER_STRING 1300 -#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 -#define ER_CONFLICTING_DECLARATIONS 1302 -#define ER_SP_NO_RECURSIVE_CREATE 1303 -#define ER_SP_ALREADY_EXISTS 1304 -#define ER_SP_DOES_NOT_EXIST 1305 -#define ER_SP_DROP_FAILED 1306 -#define ER_SP_STORE_FAILED 1307 -#define ER_SP_LILABEL_MISMATCH 1308 -#define ER_SP_LABEL_REDEFINE 1309 -#define ER_SP_LABEL_MISMATCH 1310 -#define ER_SP_UNINIT_VAR 1311 -#define ER_SP_BADSELECT 1312 -#define ER_SP_BADRETURN 1313 -#define ER_SP_BADSTATEMENT 1314 -#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1315 -#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1316 -#define ER_QUERY_INTERRUPTED 1317 -#define ER_SP_WRONG_NO_OF_ARGS 1318 -#define ER_SP_COND_MISMATCH 1319 -#define ER_SP_NORETURN 1320 -#define ER_SP_NORETURNEND 1321 -#define ER_SP_BAD_CURSOR_QUERY 1322 -#define ER_SP_BAD_CURSOR_SELECT 1323 -#define ER_SP_CURSOR_MISMATCH 1324 -#define ER_SP_CURSOR_ALREADY_OPEN 1325 -#define ER_SP_CURSOR_NOT_OPEN 1326 -#define ER_SP_UNDECLARED_VAR 1327 -#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1328 -#define ER_SP_FETCH_NO_DATA 1329 -#define ER_SP_DUP_PARAM 1330 -#define ER_SP_DUP_VAR 1331 -#define ER_SP_DUP_COND 1332 -#define ER_SP_DUP_CURS 1333 -#define ER_SP_CANT_ALTER 1334 -#define ER_SP_SUBSELECT_NYI 1335 -#define ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 1336 -#define ER_SP_VARCOND_AFTER_CURSHNDLR 1337 -#define ER_SP_CURSOR_AFTER_HANDLER 1338 -#define ER_SP_CASE_NOT_FOUND 1339 -#define ER_FPARSER_TOO_BIG_FILE 1340 -#define ER_FPARSER_BAD_HEADER 1341 -#define ER_FPARSER_EOF_IN_COMMENT 1342 -#define ER_FPARSER_ERROR_IN_PARAMETER 1343 -#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1344 -#define ER_VIEW_NO_EXPLAIN 1345 -#define ER_FRM_UNKNOWN_TYPE 1346 -#define ER_WRONG_OBJECT 1347 -#define ER_NONUPDATEABLE_COLUMN 1348 -#define ER_VIEW_SELECT_DERIVED 1349 -#define ER_VIEW_SELECT_CLAUSE 1350 -#define ER_VIEW_SELECT_VARIABLE 1351 -#define ER_VIEW_SELECT_TMPTABLE 1352 -#define ER_VIEW_WRONG_LIST 1353 -#define ER_WARN_VIEW_MERGE 1354 -#define ER_WARN_VIEW_WITHOUT_KEY 1355 -#define ER_VIEW_INVALID 1356 -#define ER_SP_NO_DROP_SP 1357 -#define ER_SP_GOTO_IN_HNDLR 1358 -#define ER_TRG_ALREADY_EXISTS 1359 -#define ER_TRG_DOES_NOT_EXIST 1360 -#define ER_TRG_ON_VIEW_OR_TEMP_TABLE 1361 -#define ER_TRG_CANT_CHANGE_ROW 1362 -#define ER_TRG_NO_SUCH_ROW_IN_TRG 1363 -#define ER_NO_DEFAULT_FOR_FIELD 1364 -#define ER_DIVISION_BY_ZERO 1365 -#define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366 -#define ER_ILLEGAL_VALUE_FOR_TYPE 1367 -#define ER_VIEW_NONUPD_CHECK 1368 -#define ER_VIEW_CHECK_FAILED 1369 -#define ER_PROCACCESS_DENIED_ERROR 1370 -#define ER_RELAY_LOG_FAIL 1371 -#define ER_PASSWD_LENGTH 1372 -#define ER_UNKNOWN_TARGET_BINLOG 1373 -#define ER_IO_ERR_LOG_INDEX_READ 1374 -#define ER_BINLOG_PURGE_PROHIBITED 1375 -#define ER_FSEEK_FAIL 1376 -#define ER_BINLOG_PURGE_FATAL_ERR 1377 -#define ER_LOG_IN_USE 1378 -#define ER_LOG_PURGE_UNKNOWN_ERR 1379 -#define ER_RELAY_LOG_INIT 1380 -#define ER_NO_BINARY_LOGGING 1381 -#define ER_RESERVED_SYNTAX 1382 -#define ER_WSAS_FAILED 1383 -#define ER_DIFF_GROUPS_PROC 1384 -#define ER_NO_GROUP_FOR_PROC 1385 -#define ER_ORDER_WITH_PROC 1386 -#define ER_LOGGING_PROHIBIT_CHANGING_OF 1387 -#define ER_NO_FILE_MAPPING 1388 -#define ER_WRONG_MAGIC 1389 -#define ER_PS_MANY_PARAM 1390 -#define ER_KEY_PART_0 1391 -#define ER_VIEW_CHECKSUM 1392 -#define ER_VIEW_MULTIUPDATE 1393 -#define ER_VIEW_NO_INSERT_FIELD_LIST 1394 -#define ER_VIEW_DELETE_MERGE_VIEW 1395 -#define ER_CANNOT_USER 1396 -#define ER_XAER_NOTA 1397 -#define ER_XAER_INVAL 1398 -#define ER_XAER_RMFAIL 1399 -#define ER_XAER_OUTSIDE 1400 -#define ER_XAER_RMERR 1401 -#define ER_XA_RBROLLBACK 1402 -#define ER_NONEXISTING_PROC_GRANT 1403 -#define ER_PROC_AUTO_GRANT_FAIL 1404 -#define ER_PROC_AUTO_REVOKE_FAIL 1405 -#define ER_DATA_TOO_LONG 1406 -#define ER_SP_BAD_SQLSTATE 1407 -#define ER_STARTUP 1408 -#define ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR 1409 -#define ER_CANT_CREATE_USER_WITH_GRANT 1410 -#define ER_WRONG_VALUE_FOR_TYPE 1411 -#define ER_TABLE_DEF_CHANGED 1412 -#define ER_SP_DUP_HANDLER 1413 -#define ER_SP_NOT_VAR_ARG 1414 -#define ER_SP_NO_RETSET 1415 -#define ER_CANT_CREATE_GEOMETRY_OBJECT 1416 -#define ER_FAILED_ROUTINE_BREAK_BINLOG 1417 -#define ER_BINLOG_UNSAFE_ROUTINE 1418 -#define ER_BINLOG_CREATE_ROUTINE_NEED_SUPER 1419 -#define ER_EXEC_STMT_WITH_OPEN_CURSOR 1420 -#define ER_STMT_HAS_NO_OPEN_CURSOR 1421 -#define ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG 1422 -#define ER_NO_DEFAULT_FOR_VIEW_FIELD 1423 -#define ER_SP_NO_RECURSION 1424 -#define ER_TOO_BIG_SCALE 1425 -#define ER_TOO_BIG_PRECISION 1426 -#define ER_M_BIGGER_THAN_D 1427 -#define ER_WRONG_LOCK_OF_SYSTEM_TABLE 1428 -#define ER_CONNECT_TO_FOREIGN_DATA_SOURCE 1429 -#define ER_QUERY_ON_FOREIGN_DATA_SOURCE 1430 -#define ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST 1431 -#define ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE 1432 -#define ER_FOREIGN_DATA_STRING_INVALID 1433 -#define ER_CANT_CREATE_FEDERATED_TABLE 1434 -#define ER_TRG_IN_WRONG_SCHEMA 1435 -#define ER_STACK_OVERRUN_NEED_MORE 1436 -#define ER_TOO_LONG_BODY 1437 -#define ER_WARN_CANT_DROP_DEFAULT_KEYCACHE 1438 -#define ER_TOO_BIG_DISPLAYWIDTH 1439 -#define ER_XAER_DUPID 1440 -#define ER_DATETIME_FUNCTION_OVERFLOW 1441 -#define ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG 1442 -#define ER_VIEW_PREVENT_UPDATE 1443 -#define ER_PS_NO_RECURSION 1444 -#define ER_SP_CANT_SET_AUTOCOMMIT 1445 -#define ER_MALFORMED_DEFINER 1446 -#define ER_VIEW_FRM_NO_USER 1447 -#define ER_VIEW_OTHER_USER 1448 -#define ER_NO_SUCH_USER 1449 -#define ER_FORBID_SCHEMA_CHANGE 1450 -#define ER_ROW_IS_REFERENCED_2 1451 -#define ER_NO_REFERENCED_ROW_2 1452 -#define ER_SP_BAD_VAR_SHADOW 1453 -#define ER_TRG_NO_DEFINER 1454 -#define ER_OLD_FILE_FORMAT 1455 -#define ER_SP_RECURSION_LIMIT 1456 -#define ER_SP_PROC_TABLE_CORRUPT 1457 -#define ER_SP_WRONG_NAME 1458 -#define ER_TABLE_NEEDS_UPGRADE 1459 -#define ER_SP_NO_AGGREGATE 1460 -#define ER_MAX_PREPARED_STMT_COUNT_REACHED 1461 -#define ER_VIEW_RECURSIVE 1462 -#define ER_NON_GROUPING_FIELD_USED 1463 -#define ER_TABLE_CANT_HANDLE_SPKEYS 1464 -#define ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA 1465 -#define ER_REMOVED_SPACES 1466 -#define ER_AUTOINC_READ_FAILED 1467 -#define ER_USERNAME 1468 -#define ER_HOSTNAME 1469 -#define ER_WRONG_STRING_LENGTH 1470 -#define ER_NON_INSERTABLE_TABLE 1471 -#define ER_ADMIN_WRONG_MRG_TABLE 1472 -#define ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT 1473 -#define ER_NAME_BECOMES_EMPTY 1474 -#define ER_AMBIGUOUS_FIELD_TERM 1475 -#define ER_FOREIGN_SERVER_EXISTS 1476 -#define ER_FOREIGN_SERVER_DOESNT_EXIST 1477 -#define ER_ILLEGAL_HA_CREATE_OPTION 1478 -#define ER_PARTITION_REQUIRES_VALUES_ERROR 1479 -#define ER_PARTITION_WRONG_VALUES_ERROR 1480 -#define ER_PARTITION_MAXVALUE_ERROR 1481 -#define ER_PARTITION_SUBPARTITION_ERROR 1482 -#define ER_PARTITION_SUBPART_MIX_ERROR 1483 -#define ER_PARTITION_WRONG_NO_PART_ERROR 1484 -#define ER_PARTITION_WRONG_NO_SUBPART_ERROR 1485 -#define ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR 1486 -#define ER_NOT_CONSTANT_EXPRESSION 1487 -#define ER_FIELD_NOT_FOUND_PART_ERROR 1488 -#define ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR 1489 -#define ER_INCONSISTENT_PARTITION_INFO_ERROR 1490 -#define ER_PARTITION_FUNC_NOT_ALLOWED_ERROR 1491 -#define ER_PARTITIONS_MUST_BE_DEFINED_ERROR 1492 -#define ER_RANGE_NOT_INCREASING_ERROR 1493 -#define ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR 1494 -#define ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR 1495 -#define ER_PARTITION_ENTRY_ERROR 1496 -#define ER_MIX_HANDLER_ERROR 1497 -#define ER_PARTITION_NOT_DEFINED_ERROR 1498 -#define ER_TOO_MANY_PARTITIONS_ERROR 1499 -#define ER_SUBPARTITION_ERROR 1500 -#define ER_CANT_CREATE_HANDLER_FILE 1501 -#define ER_BLOB_FIELD_IN_PART_FUNC_ERROR 1502 -#define ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF 1503 -#define ER_NO_PARTS_ERROR 1504 -#define ER_PARTITION_MGMT_ON_NONPARTITIONED 1505 -#define ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING 1506 -#define ER_DROP_PARTITION_NON_EXISTENT 1507 -#define ER_DROP_LAST_PARTITION 1508 -#define ER_COALESCE_ONLY_ON_HASH_PARTITION 1509 -#define ER_REORG_HASH_ONLY_ON_SAME_NO 1510 -#define ER_REORG_NO_PARAM_ERROR 1511 -#define ER_ONLY_ON_RANGE_LIST_PARTITION 1512 -#define ER_ADD_PARTITION_SUBPART_ERROR 1513 -#define ER_ADD_PARTITION_NO_NEW_PARTITION 1514 -#define ER_COALESCE_PARTITION_NO_PARTITION 1515 -#define ER_REORG_PARTITION_NOT_EXIST 1516 -#define ER_SAME_NAME_PARTITION 1517 -#define ER_NO_BINLOG_ERROR 1518 -#define ER_CONSECUTIVE_REORG_PARTITIONS 1519 -#define ER_REORG_OUTSIDE_RANGE 1520 -#define ER_PARTITION_FUNCTION_FAILURE 1521 -#define ER_PART_STATE_ERROR 1522 -#define ER_LIMITED_PART_RANGE 1523 -#define ER_PLUGIN_IS_NOT_LOADED 1524 -#define ER_WRONG_VALUE 1525 -#define ER_NO_PARTITION_FOR_GIVEN_VALUE 1526 -#define ER_FILEGROUP_OPTION_ONLY_ONCE 1527 -#define ER_CREATE_FILEGROUP_FAILED 1528 -#define ER_DROP_FILEGROUP_FAILED 1529 -#define ER_TABLESPACE_AUTO_EXTEND_ERROR 1530 -#define ER_WRONG_SIZE_NUMBER 1531 -#define ER_SIZE_OVERFLOW_ERROR 1532 -#define ER_ALTER_FILEGROUP_FAILED 1533 -#define ER_BINLOG_ROW_LOGGING_FAILED 1534 -#define ER_BINLOG_ROW_WRONG_TABLE_DEF 1535 -#define ER_BINLOG_ROW_RBR_TO_SBR 1536 -#define ER_EVENT_ALREADY_EXISTS 1537 -#define ER_EVENT_STORE_FAILED 1538 -#define ER_EVENT_DOES_NOT_EXIST 1539 -#define ER_EVENT_CANT_ALTER 1540 -#define ER_EVENT_DROP_FAILED 1541 -#define ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG 1542 -#define ER_EVENT_ENDS_BEFORE_STARTS 1543 -#define ER_EVENT_EXEC_TIME_IN_THE_PAST 1544 -#define ER_EVENT_OPEN_TABLE_FAILED 1545 -#define ER_EVENT_NEITHER_M_EXPR_NOR_M_AT 1546 -#define ER_UNUSED_2 1547 -#define ER_UNUSED_3 1548 -#define ER_EVENT_CANNOT_DELETE 1549 -#define ER_EVENT_COMPILE_ERROR 1550 -#define ER_EVENT_SAME_NAME 1551 -#define ER_EVENT_DATA_TOO_LONG 1552 -#define ER_DROP_INDEX_FK 1553 -#define ER_WARN_DEPRECATED_SYNTAX_WITH_VER 1554 -#define ER_CANT_WRITE_LOCK_LOG_TABLE 1555 -#define ER_CANT_LOCK_LOG_TABLE 1556 -#define ER_UNUSED_4 1557 -#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE 1558 -#define ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR 1559 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT 1560 -#define ER_UNUSED_13 1561 -#define ER_PARTITION_NO_TEMPORARY 1562 -#define ER_PARTITION_CONST_DOMAIN_ERROR 1563 -#define ER_PARTITION_FUNCTION_IS_NOT_ALLOWED 1564 -#define ER_DDL_LOG_ERROR 1565 -#define ER_NULL_IN_VALUES_LESS_THAN 1566 -#define ER_WRONG_PARTITION_NAME 1567 -#define ER_CANT_CHANGE_TX_CHARACTERISTICS 1568 -#define ER_DUP_ENTRY_AUTOINCREMENT_CASE 1569 -#define ER_EVENT_MODIFY_QUEUE_ERROR 1570 -#define ER_EVENT_SET_VAR_ERROR 1571 -#define ER_PARTITION_MERGE_ERROR 1572 -#define ER_CANT_ACTIVATE_LOG 1573 -#define ER_RBR_NOT_AVAILABLE 1574 -#define ER_BASE64_DECODE_ERROR 1575 -#define ER_EVENT_RECURSION_FORBIDDEN 1576 -#define ER_EVENTS_DB_ERROR 1577 -#define ER_ONLY_INTEGERS_ALLOWED 1578 -#define ER_UNSUPORTED_LOG_ENGINE 1579 -#define ER_BAD_LOG_STATEMENT 1580 -#define ER_CANT_RENAME_LOG_TABLE 1581 -#define ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 1582 -#define ER_WRONG_PARAMETERS_TO_NATIVE_FCT 1583 -#define ER_WRONG_PARAMETERS_TO_STORED_FCT 1584 -#define ER_NATIVE_FCT_NAME_COLLISION 1585 -#define ER_DUP_ENTRY_WITH_KEY_NAME 1586 -#define ER_BINLOG_PURGE_EMFILE 1587 -#define ER_EVENT_CANNOT_CREATE_IN_THE_PAST 1588 -#define ER_EVENT_CANNOT_ALTER_IN_THE_PAST 1589 -#define ER_SLAVE_INCIDENT 1590 -#define ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT 1591 -#define ER_BINLOG_UNSAFE_STATEMENT 1592 -#define ER_SLAVE_FATAL_ERROR 1593 -#define ER_SLAVE_RELAY_LOG_READ_FAILURE 1594 -#define ER_SLAVE_RELAY_LOG_WRITE_FAILURE 1595 -#define ER_SLAVE_CREATE_EVENT_FAILURE 1596 -#define ER_SLAVE_MASTER_COM_FAILURE 1597 -#define ER_BINLOG_LOGGING_IMPOSSIBLE 1598 -#define ER_VIEW_NO_CREATION_CTX 1599 -#define ER_VIEW_INVALID_CREATION_CTX 1600 -#define ER_SR_INVALID_CREATION_CTX 1601 -#define ER_TRG_CORRUPTED_FILE 1602 -#define ER_TRG_NO_CREATION_CTX 1603 -#define ER_TRG_INVALID_CREATION_CTX 1604 -#define ER_EVENT_INVALID_CREATION_CTX 1605 -#define ER_TRG_CANT_OPEN_TABLE 1606 -#define ER_CANT_CREATE_SROUTINE 1607 -#define ER_UNUSED_11 1608 -#define ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT 1609 -#define ER_SLAVE_CORRUPT_EVENT 1610 -#define ER_LOAD_DATA_INVALID_COLUMN 1611 -#define ER_LOG_PURGE_NO_FILE 1612 -#define ER_XA_RBTIMEOUT 1613 -#define ER_XA_RBDEADLOCK 1614 -#define ER_NEED_REPREPARE 1615 -#define ER_DELAYED_NOT_SUPPORTED 1616 -#define WARN_NO_MASTER_INFO 1617 -#define WARN_OPTION_IGNORED 1618 -#define ER_PLUGIN_DELETE_BUILTIN 1619 -#define WARN_PLUGIN_BUSY 1620 -#define ER_VARIABLE_IS_READONLY 1621 -#define ER_WARN_ENGINE_TRANSACTION_ROLLBACK 1622 -#define ER_SLAVE_HEARTBEAT_FAILURE 1623 -#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE 1624 -#define ER_UNUSED_14 1625 -#define ER_CONFLICT_FN_PARSE_ERROR 1626 -#define ER_EXCEPTIONS_WRITE_ERROR 1627 -#define ER_TOO_LONG_TABLE_COMMENT 1628 -#define ER_TOO_LONG_FIELD_COMMENT 1629 -#define ER_FUNC_INEXISTENT_NAME_COLLISION 1630 -#define ER_DATABASE_NAME 1631 -#define ER_TABLE_NAME 1632 -#define ER_PARTITION_NAME 1633 -#define ER_SUBPARTITION_NAME 1634 -#define ER_TEMPORARY_NAME 1635 -#define ER_RENAMED_NAME 1636 -#define ER_TOO_MANY_CONCURRENT_TRXS 1637 -#define WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED 1638 -#define ER_DEBUG_SYNC_TIMEOUT 1639 -#define ER_DEBUG_SYNC_HIT_LIMIT 1640 -#define ER_DUP_SIGNAL_SET 1641 -#define ER_SIGNAL_WARN 1642 -#define ER_SIGNAL_NOT_FOUND 1643 -#define ER_SIGNAL_EXCEPTION 1644 -#define ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER 1645 -#define ER_SIGNAL_BAD_CONDITION_TYPE 1646 -#define WARN_COND_ITEM_TRUNCATED 1647 -#define ER_COND_ITEM_TOO_LONG 1648 -#define ER_UNKNOWN_LOCALE 1649 -#define ER_SLAVE_IGNORE_SERVER_IDS 1650 -#define ER_QUERY_CACHE_DISABLED 1651 -#define ER_SAME_NAME_PARTITION_FIELD 1652 -#define ER_PARTITION_COLUMN_LIST_ERROR 1653 -#define ER_WRONG_TYPE_COLUMN_VALUE_ERROR 1654 -#define ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR 1655 -#define ER_MAXVALUE_IN_VALUES_IN 1656 -#define ER_TOO_MANY_VALUES_ERROR 1657 -#define ER_ROW_SINGLE_PARTITION_FIELD_ERROR 1658 -#define ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD 1659 -#define ER_PARTITION_FIELDS_TOO_LONG 1660 -#define ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE 1661 -#define ER_BINLOG_ROW_MODE_AND_STMT_ENGINE 1662 -#define ER_BINLOG_UNSAFE_AND_STMT_ENGINE 1663 -#define ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE 1664 -#define ER_BINLOG_STMT_MODE_AND_ROW_ENGINE 1665 -#define ER_BINLOG_ROW_INJECTION_AND_STMT_MODE 1666 -#define ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1667 -#define ER_BINLOG_UNSAFE_LIMIT 1668 -#define ER_BINLOG_UNSAFE_INSERT_DELAYED 1669 -#define ER_BINLOG_UNSAFE_SYSTEM_TABLE 1670 -#define ER_BINLOG_UNSAFE_AUTOINC_COLUMNS 1671 -#define ER_BINLOG_UNSAFE_UDF 1672 -#define ER_BINLOG_UNSAFE_SYSTEM_VARIABLE 1673 -#define ER_BINLOG_UNSAFE_SYSTEM_FUNCTION 1674 -#define ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS 1675 -#define ER_MESSAGE_AND_STATEMENT 1676 -#define ER_SLAVE_CONVERSION_FAILED 1677 -#define ER_SLAVE_CANT_CREATE_CONVERSION 1678 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT 1679 -#define ER_PATH_LENGTH 1680 -#define ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT 1681 -#define ER_WRONG_NATIVE_TABLE_STRUCTURE 1682 -#define ER_WRONG_PERFSCHEMA_USAGE 1683 -#define ER_WARN_I_S_SKIPPED_TABLE 1684 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT 1685 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT 1686 -#define ER_SPATIAL_MUST_HAVE_GEOM_COL 1687 -#define ER_TOO_LONG_INDEX_COMMENT 1688 -#define ER_LOCK_ABORTED 1689 -#define ER_DATA_OUT_OF_RANGE 1690 -#define ER_WRONG_SPVAR_TYPE_IN_LIMIT 1691 -#define ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1692 -#define ER_BINLOG_UNSAFE_MIXED_STATEMENT 1693 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN 1694 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN 1695 -#define ER_FAILED_READ_FROM_PAR_FILE 1696 -#define ER_VALUES_IS_NOT_INT_TYPE_ERROR 1697 -#define ER_ACCESS_DENIED_NO_PASSWORD_ERROR 1698 -#define ER_SET_PASSWORD_AUTH_PLUGIN 1699 -#define ER_GRANT_PLUGIN_USER_EXISTS 1700 -#define ER_TRUNCATE_ILLEGAL_FK 1701 -#define ER_PLUGIN_IS_PERMANENT 1702 -#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN 1703 -#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX 1704 -#define ER_STMT_CACHE_FULL 1705 -#define ER_MULTI_UPDATE_KEY_CONFLICT 1706 -#define ER_TABLE_NEEDS_REBUILD 1707 -#define WARN_OPTION_BELOW_LIMIT 1708 -#define ER_INDEX_COLUMN_TOO_LONG 1709 -#define ER_ERROR_IN_TRIGGER_BODY 1710 -#define ER_ERROR_IN_UNKNOWN_TRIGGER_BODY 1711 -#define ER_INDEX_CORRUPT 1712 -#define ER_UNDO_RECORD_TOO_BIG 1713 -#define ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT 1714 -#define ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE 1715 -#define ER_BINLOG_UNSAFE_REPLACE_SELECT 1716 -#define ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT 1717 -#define ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT 1718 -#define ER_BINLOG_UNSAFE_UPDATE_IGNORE 1719 -#define ER_UNUSED_15 1720 -#define ER_UNUSED_16 1721 -#define ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT 1722 -#define ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC 1723 -#define ER_BINLOG_UNSAFE_INSERT_TWO_KEYS 1724 -#define ER_TABLE_IN_FK_CHECK 1725 -#define ER_UNUSED_1 1726 -#define ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST 1727 -#define ER_CANNOT_LOAD_FROM_TABLE_V2 1728 -#define ER_MASTER_DELAY_VALUE_OUT_OF_RANGE 1729 -#define ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT 1730 -#define ER_PARTITION_EXCHANGE_DIFFERENT_OPTION 1731 -#define ER_PARTITION_EXCHANGE_PART_TABLE 1732 -#define ER_PARTITION_EXCHANGE_TEMP_TABLE 1733 -#define ER_PARTITION_INSTEAD_OF_SUBPARTITION 1734 -#define ER_UNKNOWN_PARTITION 1735 -#define ER_TABLES_DIFFERENT_METADATA 1736 -#define ER_ROW_DOES_NOT_MATCH_PARTITION 1737 -#define ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX 1738 -#define ER_WARN_INDEX_NOT_APPLICABLE 1739 -#define ER_PARTITION_EXCHANGE_FOREIGN_KEY 1740 -#define ER_NO_SUCH_KEY_VALUE 1741 -#define ER_VALUE_TOO_LONG 1742 -#define ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE 1743 -#define ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE 1744 -#define ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX 1745 -#define ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT 1746 -#define ER_PARTITION_CLAUSE_ON_NONPARTITIONED 1747 -#define ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET 1748 -#define ER_UNUSED_5 1749 -#define ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE 1750 -#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE 1751 -#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE 1752 -#define ER_MTS_FEATURE_IS_NOT_SUPPORTED 1753 -#define ER_MTS_UPDATED_DBS_GREATER_MAX 1754 -#define ER_MTS_CANT_PARALLEL 1755 -#define ER_MTS_INCONSISTENT_DATA 1756 -#define ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING 1757 -#define ER_DA_INVALID_CONDITION_NUMBER 1758 -#define ER_INSECURE_PLAIN_TEXT 1759 -#define ER_INSECURE_CHANGE_MASTER 1760 -#define ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO 1761 -#define ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO 1762 -#define ER_SQLTHREAD_WITH_SECURE_SLAVE 1763 -#define ER_TABLE_HAS_NO_FT 1764 -#define ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER 1765 -#define ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION 1766 -#define ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST 1767 -#define ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL 1768 -#define ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION 1769 -#define ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL 1770 -#define ER_SKIPPING_LOGGED_TRANSACTION 1771 -#define ER_MALFORMED_GTID_SET_SPECIFICATION 1772 -#define ER_MALFORMED_GTID_SET_ENCODING 1773 -#define ER_MALFORMED_GTID_SPECIFICATION 1774 -#define ER_GNO_EXHAUSTED 1775 -#define ER_BAD_SLAVE_AUTO_POSITION 1776 -#define ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON 1777 -#define ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET 1778 -#define ER_GTID_MODE_2_OR_3_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON 1779 -#define ER_GTID_MODE_REQUIRES_BINLOG 1780 -#define ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF 1781 -#define ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON 1782 -#define ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF 1783 -#define ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF 1784 -#define ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE 1785 -#define ER_GTID_UNSAFE_CREATE_SELECT 1786 -#define ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION 1787 -#define ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME 1788 -#define ER_MASTER_HAS_PURGED_REQUIRED_GTIDS 1789 -#define ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID 1790 -#define ER_UNKNOWN_EXPLAIN_FORMAT 1791 -#define ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION 1792 -#define ER_TOO_LONG_TABLE_PARTITION_COMMENT 1793 -#define ER_SLAVE_CONFIGURATION 1794 -#define ER_INNODB_FT_LIMIT 1795 -#define ER_INNODB_NO_FT_TEMP_TABLE 1796 -#define ER_INNODB_FT_WRONG_DOCID_COLUMN 1797 -#define ER_INNODB_FT_WRONG_DOCID_INDEX 1798 -#define ER_INNODB_ONLINE_LOG_TOO_BIG 1799 -#define ER_UNKNOWN_ALTER_ALGORITHM 1800 -#define ER_UNKNOWN_ALTER_LOCK 1801 -#define ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS 1802 -#define ER_MTS_RECOVERY_FAILURE 1803 -#define ER_MTS_RESET_WORKERS 1804 -#define ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 1805 -#define ER_SLAVE_SILENT_RETRY_TRANSACTION 1806 -#define ER_UNUSED_22 1807 -#define ER_TABLE_SCHEMA_MISMATCH 1808 -#define ER_TABLE_IN_SYSTEM_TABLESPACE 1809 -#define ER_IO_READ_ERROR 1810 -#define ER_IO_WRITE_ERROR 1811 -#define ER_TABLESPACE_MISSING 1812 -#define ER_TABLESPACE_EXISTS 1813 -#define ER_TABLESPACE_DISCARDED 1814 -#define ER_INTERNAL_ERROR 1815 -#define ER_INNODB_IMPORT_ERROR 1816 -#define ER_INNODB_INDEX_CORRUPT 1817 -#define ER_INVALID_YEAR_COLUMN_LENGTH 1818 -#define ER_NOT_VALID_PASSWORD 1819 -#define ER_MUST_CHANGE_PASSWORD 1820 -#define ER_FK_NO_INDEX_CHILD 1821 -#define ER_FK_NO_INDEX_PARENT 1822 -#define ER_FK_FAIL_ADD_SYSTEM 1823 -#define ER_FK_CANNOT_OPEN_PARENT 1824 -#define ER_FK_INCORRECT_OPTION 1825 -#define ER_DUP_CONSTRAINT_NAME 1826 -#define ER_PASSWORD_FORMAT 1827 -#define ER_FK_COLUMN_CANNOT_DROP 1828 -#define ER_FK_COLUMN_CANNOT_DROP_CHILD 1829 -#define ER_FK_COLUMN_NOT_NULL 1830 -#define ER_DUP_INDEX 1831 -#define ER_FK_COLUMN_CANNOT_CHANGE 1832 -#define ER_FK_COLUMN_CANNOT_CHANGE_CHILD 1833 -#define ER_FK_CANNOT_DELETE_PARENT 1834 -#define ER_MALFORMED_PACKET 1835 -#define ER_READ_ONLY_MODE 1836 -#define ER_GTID_NEXT_TYPE_UNDEFINED_GROUP 1837 -#define ER_VARIABLE_NOT_SETTABLE_IN_SP 1838 -#define ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF 1839 -#define ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY 1840 -#define ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY 1841 -#define ER_GTID_PURGED_WAS_CHANGED 1842 -#define ER_GTID_EXECUTED_WAS_CHANGED 1843 -#define ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES 1844 -#define ER_ALTER_OPERATION_NOT_SUPPORTED 1845 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON 1846 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY 1847 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION 1848 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME 1849 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE 1850 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK 1851 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_IGNORE 1852 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK 1853 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC 1854 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS 1855 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS 1856 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS 1857 -#define ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE 1858 -#define ER_DUP_UNKNOWN_IN_INDEX 1859 -#define ER_IDENT_CAUSES_TOO_LONG_PATH 1860 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL 1861 -#define ER_MUST_CHANGE_PASSWORD_LOGIN 1862 -#define ER_ROW_IN_WRONG_PARTITION 1863 -#define ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX 1864 -#define ER_INNODB_NO_FT_USES_PARSER 1865 -#define ER_BINLOG_LOGICAL_CORRUPTION 1866 -#define ER_WARN_PURGE_LOG_IN_USE 1867 -#define ER_WARN_PURGE_LOG_IS_ACTIVE 1868 -#define ER_AUTO_INCREMENT_CONFLICT 1869 -#define WARN_ON_BLOCKHOLE_IN_RBR 1870 -#define ER_SLAVE_MI_INIT_REPOSITORY 1871 -#define ER_SLAVE_RLI_INIT_REPOSITORY 1872 -#define ER_ACCESS_DENIED_CHANGE_USER_ERROR 1873 -#define ER_INNODB_READ_ONLY 1874 -#define ER_STOP_SLAVE_SQL_THREAD_TIMEOUT 1875 -#define ER_STOP_SLAVE_IO_THREAD_TIMEOUT 1876 -#define ER_TABLE_CORRUPT 1877 -#define ER_TEMP_FILE_WRITE_FAILURE 1878 -#define ER_INNODB_FT_AUX_NOT_HEX_ID 1879 -#define ER_LAST_MYSQL_ERROR_MESSAGE 1880 -#define ER_ERROR_LAST_SECTION_1 1880 - -/* New section */ - -#define ER_ERROR_FIRST_SECTION_2 1900 -#define ER_UNUSED_18 1900 -#define ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED 1901 -#define ER_UNUSED_19 1902 -#define ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN 1903 -#define ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN 1904 -#define ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN 1905 -#define ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN 1906 -#define ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN 1907 -#define ER_UNUSED_20 1908 -#define ER_UNUSED_21 1909 -#define ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS 1910 -#define ER_UNKNOWN_OPTION 1911 -#define ER_BAD_OPTION_VALUE 1912 -#define ER_UNUSED_6 1913 -#define ER_UNUSED_7 1914 -#define ER_UNUSED_8 1915 -#define ER_DATA_OVERFLOW 1916 -#define ER_DATA_TRUNCATED 1917 -#define ER_BAD_DATA 1918 -#define ER_DYN_COL_WRONG_FORMAT 1919 -#define ER_DYN_COL_IMPLEMENTATION_LIMIT 1920 -#define ER_DYN_COL_DATA 1921 -#define ER_DYN_COL_WRONG_CHARSET 1922 -#define ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES 1923 -#define ER_QUERY_CACHE_IS_DISABLED 1924 -#define ER_QUERY_CACHE_IS_GLOBALY_DISABLED 1925 -#define ER_VIEW_ORDERBY_IGNORED 1926 -#define ER_CONNECTION_KILLED 1927 -#define ER_UNUSED_12 1928 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION 1929 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION 1930 -#define ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT 1931 -#define ER_NO_SUCH_TABLE_IN_ENGINE 1932 -#define ER_TARGET_NOT_EXPLAINABLE 1933 -#define ER_CONNECTION_ALREADY_EXISTS 1934 -#define ER_MASTER_LOG_PREFIX 1935 -#define ER_CANT_START_STOP_SLAVE 1936 -#define ER_SLAVE_STARTED 1937 -#define ER_SLAVE_STOPPED 1938 -#define ER_SQL_DISCOVER_ERROR 1939 -#define ER_FAILED_GTID_STATE_INIT 1940 -#define ER_INCORRECT_GTID_STATE 1941 -#define ER_CANNOT_UPDATE_GTID_STATE 1942 -#define ER_DUPLICATE_GTID_DOMAIN 1943 -#define ER_GTID_OPEN_TABLE_FAILED 1944 -#define ER_GTID_POSITION_NOT_FOUND_IN_BINLOG 1945 -#define ER_CANNOT_LOAD_SLAVE_GTID_STATE 1946 -#define ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG 1947 -#define ER_MASTER_GTID_POS_MISSING_DOMAIN 1948 -#define ER_UNTIL_REQUIRES_USING_GTID 1949 -#define ER_GTID_STRICT_OUT_OF_ORDER 1950 -#define ER_GTID_START_FROM_BINLOG_HOLE 1951 -#define ER_SLAVE_UNEXPECTED_MASTER_SWITCH 1952 -#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO 1953 -#define ER_STORED_FUNCTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO 1954 -#define ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2 1955 -#define ER_BINLOG_MUST_BE_EMPTY 1956 -#define ER_NO_SUCH_QUERY 1957 -#define ER_BAD_BASE64_DATA 1958 -#define ER_INVALID_ROLE 1959 -#define ER_INVALID_CURRENT_USER 1960 -#define ER_CANNOT_GRANT_ROLE 1961 -#define ER_CANNOT_REVOKE_ROLE 1962 -#define ER_CHANGE_SLAVE_PARALLEL_THREADS_ACTIVE 1963 -#define ER_PRIOR_COMMIT_FAILED 1964 -#define ER_IT_IS_A_VIEW 1965 -#define ER_SLAVE_SKIP_NOT_IN_GTID 1966 -#define ER_TABLE_DEFINITION_TOO_BIG 1967 -#define ER_PLUGIN_INSTALLED 1968 -#define ER_STATEMENT_TIMEOUT 1969 -#define ER_SUBQUERIES_NOT_SUPPORTED 1970 -#define ER_SET_STATEMENT_NOT_SUPPORTED 1971 -#define ER_UNUSED_9 1972 -#define ER_USER_CREATE_EXISTS 1973 -#define ER_USER_DROP_EXISTS 1974 -#define ER_ROLE_CREATE_EXISTS 1975 -#define ER_ROLE_DROP_EXISTS 1976 -#define ER_CANNOT_CONVERT_CHARACTER 1977 -#define ER_INVALID_DEFAULT_VALUE_FOR_FIELD 1978 -#define ER_KILL_QUERY_DENIED_ERROR 1979 -#define ER_NO_EIS_FOR_FIELD 1980 -#define ER_WARN_AGGFUNC_DEPENDENCE 1981 -#define WARN_INNODB_PARTITION_OPTION_IGNORED 1982 -#define ER_ERROR_LAST_SECTION_2 1982 - -/* New section */ - -#define ER_ERROR_FIRST_SECTION_3 2000 -#define ER_ERROR_LAST_SECTION_3 2000 - -/* New section */ - -#define ER_ERROR_FIRST_SECTION_4 3000 -#define ER_FILE_CORRUPT 3000 -#define ER_ERROR_ON_MASTER 3001 -#define ER_INCONSISTENT_ERROR 3002 -#define ER_STORAGE_ENGINE_NOT_LOADED 3003 -#define ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 3004 -#define ER_WARN_LEGACY_SYNTAX_CONVERTED 3005 -#define ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN 3006 -#define ER_CANNOT_DISCARD_TEMPORARY_TABLE 3007 -#define ER_FK_DEPTH_EXCEEDED 3008 -#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 3009 -#define ER_WARN_TRIGGER_DOESNT_HAVE_CREATED 3010 -#define ER_REFERENCED_TRG_DOES_NOT_EXIST_MYSQL 3011 -#define ER_EXPLAIN_NOT_SUPPORTED 3012 -#define ER_INVALID_FIELD_SIZE 3013 -#define ER_MISSING_HA_CREATE_OPTION 3014 -#define ER_ENGINE_OUT_OF_MEMORY 3015 -#define ER_PASSWORD_EXPIRE_ANONYMOUS_USER 3016 -#define ER_SLAVE_SQL_THREAD_MUST_STOP 3017 -#define ER_NO_FT_MATERIALIZED_SUBQUERY 3018 -#define ER_INNODB_UNDO_LOG_FULL 3019 -#define ER_INVALID_ARGUMENT_FOR_LOGARITHM 3020 -#define ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP 3021 -#define ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO 3022 -#define ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS 3023 -#define ER_QUERY_TIMEOUT 3024 -#define ER_NON_RO_SELECT_DISABLE_TIMER 3025 -#define ER_DUP_LIST_ENTRY 3026 -#define ER_SQL_MODE_NO_EFFECT 3027 -#define ER_AGGREGATE_ORDER_FOR_UNION 3028 -#define ER_AGGREGATE_ORDER_NON_AGG_QUERY 3029 -#define ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR 3030 -#define ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER 3031 -#define ER_SERVER_OFFLINE_MODE 3032 -#define ER_GIS_DIFFERENT_SRIDS 3033 -#define ER_GIS_UNSUPPORTED_ARGUMENT 3034 -#define ER_GIS_UNKNOWN_ERROR 3035 -#define ER_GIS_UNKNOWN_EXCEPTION 3036 -#define ER_GIS_INVALID_DATA 3037 -#define ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION 3038 -#define ER_BOOST_GEOMETRY_CENTROID_EXCEPTION 3039 -#define ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION 3040 -#define ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION 3041 -#define ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION 3042 -#define ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION 3043 -#define ER_STD_BAD_ALLOC_ERROR 3044 -#define ER_STD_DOMAIN_ERROR 3045 -#define ER_STD_LENGTH_ERROR 3046 -#define ER_STD_INVALID_ARGUMENT 3047 -#define ER_STD_OUT_OF_RANGE_ERROR 3048 -#define ER_STD_OVERFLOW_ERROR 3049 -#define ER_STD_RANGE_ERROR 3050 -#define ER_STD_UNDERFLOW_ERROR 3051 -#define ER_STD_LOGIC_ERROR 3052 -#define ER_STD_RUNTIME_ERROR 3053 -#define ER_STD_UNKNOWN_EXCEPTION 3054 -#define ER_GIS_DATA_WRONG_ENDIANESS 3055 -#define ER_CHANGE_MASTER_PASSWORD_LENGTH 3056 -#define ER_USER_LOCK_WRONG_NAME 3057 -#define ER_USER_LOCK_DEADLOCK 3058 -#define ER_REPLACE_INACCESSIBLE_ROWS 3059 -#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS 3060 -#define ER_ERROR_LAST_SECTION_4 3060 - -/* New section */ - -#define ER_ERROR_FIRST_SECTION_5 4000 -#define ER_COMMULTI_BADCONTEXT 4000 -#define ER_BAD_COMMAND_IN_MULTI 4001 -#define ER_WITH_COL_WRONG_LIST 4002 -#define ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE 4003 -#define ER_DUP_QUERY_NAME 4004 -#define ER_RECURSIVE_WITHOUT_ANCHORS 4005 -#define ER_UNACCEPTABLE_MUTUAL_RECURSION 4006 -#define ER_REF_TO_RECURSIVE_WITH_TABLE_IN_DERIVED 4007 -#define ER_NOT_STANDARD_COMPLIANT_RECURSIVE 4008 -#define ER_WRONG_WINDOW_SPEC_NAME 4009 -#define ER_DUP_WINDOW_NAME 4010 -#define ER_PARTITION_LIST_IN_REFERENCING_WINDOW_SPEC 4011 -#define ER_ORDER_LIST_IN_REFERENCING_WINDOW_SPEC 4012 -#define ER_WINDOW_FRAME_IN_REFERENCED_WINDOW_SPEC 4013 -#define ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS 4014 -#define ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION 4015 -#define ER_WINDOW_FUNCTION_IN_WINDOW_SPEC 4016 -#define ER_NOT_ALLOWED_WINDOW_FRAME 4017 -#define ER_NO_ORDER_LIST_IN_WINDOW_SPEC 4018 -#define ER_RANGE_FRAME_NEEDS_SIMPLE_ORDERBY 4019 -#define ER_WRONG_TYPE_FOR_ROWS_FRAME 4020 -#define ER_WRONG_TYPE_FOR_RANGE_FRAME 4021 -#define ER_FRAME_EXCLUSION_NOT_SUPPORTED 4022 -#define ER_WINDOW_FUNCTION_DONT_HAVE_FRAME 4023 -#define ER_INVALID_NTILE_ARGUMENT 4024 -#define ER_CONSTRAINT_FAILED 4025 -#define ER_EXPRESSION_IS_TOO_BIG 4026 -#define ER_ERROR_EVALUATING_EXPRESSION 4027 -#define ER_CALCULATING_DEFAULT_VALUE 4028 -#define ER_EXPRESSION_REFERS_TO_UNINIT_FIELD 4029 -#define ER_PARTITION_DEFAULT_ERROR 4030 -#define ER_REFERENCED_TRG_DOES_NOT_EXIST 4031 -#define ER_INVALID_DEFAULT_PARAM 4032 -#define ER_BINLOG_NON_SUPPORTED_BULK 4033 -#define ER_BINLOG_UNCOMPRESS_ERROR 4034 -#define ER_JSON_BAD_CHR 4035 -#define ER_JSON_NOT_JSON_CHR 4036 -#define ER_JSON_EOS 4037 -#define ER_JSON_SYNTAX 4038 -#define ER_JSON_ESCAPING 4039 -#define ER_JSON_DEPTH 4040 -#define ER_JSON_PATH_EOS 4041 -#define ER_JSON_PATH_SYNTAX 4042 -#define ER_JSON_PATH_DEPTH 4043 -#define ER_JSON_PATH_NO_WILDCARD 4044 -#define ER_JSON_PATH_ARRAY 4045 -#define ER_JSON_ONE_OR_ALL 4046 -#define ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE 4047 -#define ER_GEOJSON_INCORRECT 4048 -#define ER_GEOJSON_TOO_FEW_POINTS 4049 -#define ER_GEOJSON_NOT_CLOSED 4050 -#define ER_JSON_PATH_EMPTY 4051 -#define ER_SLAVE_SAME_ID 4052 -#define ER_FLASHBACK_NOT_SUPPORTED 4053 -#define ER_KEYS_OUT_OF_ORDER 4054 -#define ER_OVERLAPPING_KEYS 4055 -#define ER_REQUIRE_ROW_BINLOG_FORMAT 4056 -#define ER_ISOLATION_MODE_NOT_SUPPORTED 4057 -#define ER_ON_DUPLICATE_DISABLED 4058 -#define ER_UPDATES_WITH_CONSISTENT_SNAPSHOT 4059 -#define ER_ROLLBACK_ONLY 4060 -#define ER_ROLLBACK_TO_SAVEPOINT 4061 -#define ER_ISOLATION_LEVEL_WITH_CONSISTENT_SNAPSHOT 4062 -#define ER_UNSUPPORTED_COLLATION 4063 -#define ER_METADATA_INCONSISTENCY 4064 -#define ER_CF_DIFFERENT 4065 -#define ER_RDB_TTL_DURATION_FORMAT 4066 -#define ER_RDB_STATUS_GENERAL 4067 -#define ER_RDB_STATUS_MSG 4068 -#define ER_RDB_TTL_UNSUPPORTED 4069 -#define ER_RDB_TTL_COL_FORMAT 4070 -#define ER_PER_INDEX_CF_DEPRECATED 4071 -#define ER_KEY_CREATE_DURING_ALTER 4072 -#define ER_SK_POPULATE_DURING_ALTER 4073 -#define ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG 4074 -#define ER_NET_OK_PACKET_TOO_LARGE 4075 -#define ER_GEOJSON_EMPTY_COORDINATES 4076 -#define ER_MYROCKS_CANT_NOPAD_COLLATION 4077 -#define ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION 4078 -#define ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION 4079 -#define ER_WRONG_PARAMCOUNT_TO_CURSOR 4080 -#define ER_UNKNOWN_STRUCTURED_VARIABLE 4081 -#define ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD 4082 -#define ER_END_IDENTIFIER_DOES_NOT_MATCH 4083 -#define ER_SEQUENCE_RUN_OUT 4084 -#define ER_SEQUENCE_INVALID_DATA 4085 -#define ER_SEQUENCE_INVALID_TABLE_STRUCTURE 4086 -#define ER_SEQUENCE_ACCESS_ERROR 4087 -#define ER_SEQUENCE_BINLOG_FORMAT 4088 -#define ER_NOT_SEQUENCE 4089 -#define ER_NOT_SEQUENCE2 4090 -#define ER_UNKNOWN_SEQUENCES 4091 -#define ER_UNKNOWN_VIEW 4092 -#define ER_WRONG_INSERT_INTO_SEQUENCE 4093 -#define ER_SP_STACK_TRACE 4094 -#define ER_PACKAGE_ROUTINE_IN_SPEC_NOT_DEFINED_IN_BODY 4095 -#define ER_PACKAGE_ROUTINE_FORWARD_DECLARATION_NOT_DEFINED 4096 -#define ER_COMPRESSED_COLUMN_USED_AS_KEY 4097 -#define ER_UNKNOWN_COMPRESSION_METHOD 4098 -#define ER_WRONG_NUMBER_OF_VALUES_IN_TVC 4099 -#define ER_FIELD_REFERENCE_IN_TVC 4100 -#define ER_WRONG_TYPE_FOR_PERCENTILE_FUNC 4101 -#define ER_ARGUMENT_NOT_CONSTANT 4102 -#define ER_ARGUMENT_OUT_OF_RANGE 4103 -#define ER_WRONG_TYPE_OF_ARGUMENT 4104 -#define ER_NOT_AGGREGATE_FUNCTION 4105 -#define ER_INVALID_AGGREGATE_FUNCTION 4106 -#define ER_INVALID_VALUE_TO_LIMIT 4107 -#define ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT 4108 -#define ER_UPDATE_INFO_WITH_SYSTEM_VERSIONING 4109 -#define ER_VERS_FIELD_WRONG_TYPE 4110 -#define ER_VERS_ENGINE_UNSUPPORTED 4111 -#define ER_UNUSED_23 4112 -#define ER_PARTITION_WRONG_TYPE 4113 -#define WARN_VERS_PART_FULL 4114 -#define WARN_VERS_PARAMETERS 4115 -#define ER_VERS_DROP_PARTITION_INTERVAL 4116 -#define ER_UNUSED_25 4117 -#define WARN_VERS_PART_NON_HISTORICAL 4118 -#define ER_VERS_ALTER_NOT_ALLOWED 4119 -#define ER_VERS_ALTER_ENGINE_PROHIBITED 4120 -#define ER_VERS_RANGE_PROHIBITED 4121 -#define ER_CONFLICTING_FOR_SYSTEM_TIME 4122 -#define ER_VERS_TABLE_MUST_HAVE_COLUMNS 4123 -#define ER_VERS_NOT_VERSIONED 4124 -#define ER_MISSING 4125 -#define ER_VERS_PERIOD_COLUMNS 4126 -#define ER_PART_WRONG_VALUE 4127 -#define ER_VERS_WRONG_PARTS 4128 -#define ER_VERS_NO_TRX_ID 4129 -#define ER_VERS_ALTER_SYSTEM_FIELD 4130 -#define ER_DROP_VERSIONING_SYSTEM_TIME_PARTITION 4131 -#define ER_VERS_DB_NOT_SUPPORTED 4132 -#define ER_VERS_TRT_IS_DISABLED 4133 -#define ER_VERS_DUPLICATE_ROW_START_END 4134 -#define ER_VERS_ALREADY_VERSIONED 4135 -#define ER_UNUSED_24 4136 -#define ER_VERS_NOT_SUPPORTED 4137 -#define ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED 4138 -#define ER_INDEX_FILE_FULL 4139 -#define ER_UPDATED_COLUMN_ONLY_ONCE 4140 -#define ER_EMPTY_ROW_IN_TVC 4141 -#define ER_VERS_QUERY_IN_PARTITION 4142 -#define ER_KEY_DOESNT_SUPPORT 4143 -#define ER_ALTER_OPERATION_TABLE_OPTIONS_NEED_REBUILD 4144 -#define ER_BACKUP_LOCK_IS_ACTIVE 4145 -#define ER_BACKUP_NOT_RUNNING 4146 -#define ER_BACKUP_WRONG_STAGE 4147 -#define ER_BACKUP_STAGE_FAILED 4148 -#define ER_BACKUP_UNKNOWN_STAGE 4149 -#define ER_USER_IS_BLOCKED 4150 -#define ER_ACCOUNT_HAS_BEEN_LOCKED 4151 -#define ER_PERIOD_TEMPORARY_NOT_ALLOWED 4152 -#define ER_PERIOD_TYPES_MISMATCH 4153 -#define ER_MORE_THAN_ONE_PERIOD 4154 -#define ER_PERIOD_FIELD_WRONG_ATTRIBUTES 4155 -#define ER_PERIOD_NOT_FOUND 4156 -#define ER_PERIOD_COLUMNS_UPDATED 4157 -#define ER_PERIOD_CONSTRAINT_DROP 4158 -#define ER_TOO_LONG_KEYPART 4159 -#define ER_TOO_LONG_DATABASE_COMMENT 4160 -#define ER_UNKNOWN_DATA_TYPE 4161 -#define ER_UNKNOWN_OPERATOR 4162 -#define ER_WARN_HISTORY_ROW_START_TIME 4163 -#define ER_PART_STARTS_BEYOND_INTERVAL 4164 -#define ER_GALERA_REPLICATION_NOT_SUPPORTED 4165 -#define ER_LOAD_INFILE_CAPABILITY_DISABLED 4166 -#define ER_NO_SECURE_TRANSPORTS_CONFIGURED 4167 -#define ER_SLAVE_IGNORED_SHARED_TABLE 4168 -#define ER_NO_AUTOINCREMENT_WITH_UNIQUE 4169 -#define ER_KEY_CONTAINS_PERIOD_FIELDS 4170 -#define ER_KEY_CANT_HAVE_WITHOUT_OVERLAPS 4171 -#define ER_NOT_ALLOWED_IN_THIS_CONTEXT 4172 -#define ER_DATA_WAS_COMMITED_UNDER_ROLLBACK 4173 -#define ER_ERROR_LAST 4173 -#endif /* ER_ERROR_FIRST */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/pack.h b/VCMP-LUA/modules/mariadb/include/mysql/server/pack.h deleted file mode 100644 index f991e72..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/pack.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2016, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifdef __cplusplus -extern "C" { -#endif - -ulong net_field_length(uchar **packet); -my_ulonglong net_field_length_ll(uchar **packet); -my_ulonglong safe_net_field_length_ll(uchar **packet, size_t packet_len); -uchar *net_store_length(uchar *pkg, ulonglong length); -uchar *safe_net_store_length(uchar *pkg, size_t pkg_len, ulonglong length); -unsigned int net_length_size(ulonglong num); - -#ifdef __cplusplus -} -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/aria_backup.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/aria_backup.h deleted file mode 100644 index f399f6a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/aria_backup.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2018,2020 MariaDB Corporation Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ - -/* Interfaces for doing backups of Aria tables */ - -C_MODE_START - -typedef struct st_aria_table_capabilities -{ - my_off_t header_size; - ulong bitmap_pages_covered; - uint block_size; - uint keypage_header; - enum data_file_type data_file_type; - my_bool checksum; - my_bool transactional; - my_bool encrypted; - /* This is true if the table can be copied without any locks */ - my_bool online_backup_safe; - /* s3 capabilities */ - ulong s3_block_size; - uint8 compression; -} ARIA_TABLE_CAPABILITIES; - -int aria_get_capabilities(File kfile, ARIA_TABLE_CAPABILITIES *cap); -int aria_read_index(File kfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block, - uchar *buffer); -int aria_read_data(File dfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block, - uchar *buffer, size_t *bytes_read); -C_MODE_END diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/assume_aligned.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/assume_aligned.h deleted file mode 100644 index e1b807c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/assume_aligned.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#pragma once - -#include -#include - -#ifdef _MSC_VER -template -static inline T my_assume_aligned(T ptr) -{ - assert(reinterpret_cast(ptr) % Alignment == 0); - __assume(reinterpret_cast(ptr) % Alignment == 0); - return ptr; -} -#else -template -static inline T my_assume_aligned(T ptr) -{ - assert(reinterpret_cast(ptr) % Alignment == 0); - return static_cast(__builtin_assume_aligned(ptr, Alignment)); -} -#endif - -template -inline void *memcpy_aligned(void *dest, const void *src, size_t n) -{ - static_assert(Alignment && !(Alignment & (Alignment - 1)), "power of 2"); - - return std::memcpy(my_assume_aligned(dest), - my_assume_aligned(src), n); -} -template -inline void *memmove_aligned(void *dest, const void *src, size_t n) -{ - static_assert(Alignment && !(Alignment & (Alignment - 1)), "power of 2"); - - return std::memmove(my_assume_aligned(dest), - my_assume_aligned(src), n); -} -template -inline int memcmp_aligned(const void *s1, const void *s2, size_t n) -{ - static_assert(Alignment && !(Alignment & (Alignment - 1)), "power of 2"); - - return std::memcmp(my_assume_aligned(s1), - my_assume_aligned(s2), n); -} -template -inline void *memset_aligned(void *s, int c, size_t n) -{ - static_assert(Alignment && !(Alignment & (Alignment - 1)), "power of 2"); - - return std::memset(my_assume_aligned(s), c, n); -} diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/atomic/gcc_builtins.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/atomic/gcc_builtins.h deleted file mode 100644 index 5b2b2c9..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/atomic/gcc_builtins.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef ATOMIC_GCC_BUILTINS_INCLUDED -#define ATOMIC_GCC_BUILTINS_INCLUDED - -/* Copyright (c) 2017 MariaDB Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#define MY_MEMORY_ORDER_RELAXED __ATOMIC_RELAXED -#define MY_MEMORY_ORDER_CONSUME __ATOMIC_CONSUME -#define MY_MEMORY_ORDER_ACQUIRE __ATOMIC_ACQUIRE -#define MY_MEMORY_ORDER_RELEASE __ATOMIC_RELEASE -#define MY_MEMORY_ORDER_ACQ_REL __ATOMIC_ACQ_REL -#define MY_MEMORY_ORDER_SEQ_CST __ATOMIC_SEQ_CST - -#define my_atomic_store32_explicit(P, D, O) __atomic_store_n((P), (D), (O)) -#define my_atomic_store64_explicit(P, D, O) __atomic_store_n((P), (D), (O)) -#define my_atomic_storeptr_explicit(P, D, O) __atomic_store_n((P), (D), (O)) - -#define my_atomic_load32_explicit(P, O) __atomic_load_n((P), (O)) -#define my_atomic_load64_explicit(P, O) __atomic_load_n((P), (O)) -#define my_atomic_loadptr_explicit(P, O) __atomic_load_n((P), (O)) - -#define my_atomic_fas32_explicit(P, D, O) __atomic_exchange_n((P), (D), (O)) -#define my_atomic_fas64_explicit(P, D, O) __atomic_exchange_n((P), (D), (O)) -#define my_atomic_fasptr_explicit(P, D, O) __atomic_exchange_n((P), (D), (O)) - -#define my_atomic_add32_explicit(P, A, O) __atomic_fetch_add((P), (A), (O)) -#define my_atomic_add64_explicit(P, A, O) __atomic_fetch_add((P), (A), (O)) - -#define my_atomic_cas32_weak_explicit(P, E, D, S, F) \ - __atomic_compare_exchange_n((P), (E), (D), 1, (S), (F)) -#define my_atomic_cas64_weak_explicit(P, E, D, S, F) \ - __atomic_compare_exchange_n((P), (E), (D), 1, (S), (F)) -#define my_atomic_casptr_weak_explicit(P, E, D, S, F) \ - __atomic_compare_exchange_n((P), (E), (D), 1, (S), (F)) - -#define my_atomic_cas32_strong_explicit(P, E, D, S, F) \ - __atomic_compare_exchange_n((P), (E), (D), 0, (S), (F)) -#define my_atomic_cas64_strong_explicit(P, E, D, S, F) \ - __atomic_compare_exchange_n((P), (E), (D), 0, (S), (F)) -#define my_atomic_casptr_strong_explicit(P, E, D, S, F) \ - __atomic_compare_exchange_n((P), (E), (D), 0, (S), (F)) - -#define my_atomic_store32(P, D) __atomic_store_n((P), (D), __ATOMIC_SEQ_CST) -#define my_atomic_store64(P, D) __atomic_store_n((P), (D), __ATOMIC_SEQ_CST) -#define my_atomic_storeptr(P, D) __atomic_store_n((P), (D), __ATOMIC_SEQ_CST) - -#define my_atomic_load32(P) __atomic_load_n((P), __ATOMIC_SEQ_CST) -#define my_atomic_load64(P) __atomic_load_n((P), __ATOMIC_SEQ_CST) -#define my_atomic_loadptr(P) __atomic_load_n((P), __ATOMIC_SEQ_CST) - -#define my_atomic_fas32(P, D) __atomic_exchange_n((P), (D), __ATOMIC_SEQ_CST) -#define my_atomic_fas64(P, D) __atomic_exchange_n((P), (D), __ATOMIC_SEQ_CST) -#define my_atomic_fasptr(P, D) __atomic_exchange_n((P), (D), __ATOMIC_SEQ_CST) - -#define my_atomic_add32(P, A) __atomic_fetch_add((P), (A), __ATOMIC_SEQ_CST) -#define my_atomic_add64(P, A) __atomic_fetch_add((P), (A), __ATOMIC_SEQ_CST) - -#define my_atomic_cas32(P, E, D) \ - __atomic_compare_exchange_n((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) -#define my_atomic_cas64(P, E, D) \ - __atomic_compare_exchange_n((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) -#define my_atomic_casptr(P, E, D) \ - __atomic_compare_exchange_n((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) - -#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/atomic/generic-msvc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/atomic/generic-msvc.h deleted file mode 100644 index ff2a543..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/atomic/generic-msvc.h +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef ATOMIC_MSC_INCLUDED -#define ATOMIC_MSC_INCLUDED - -/* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include - -static inline int my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set) -{ - int32 initial_cmp= *cmp; - int32 initial_a= InterlockedCompareExchange((volatile LONG*)a, - set, initial_cmp); - int ret= (initial_a == initial_cmp); - if (!ret) - *cmp= initial_a; - return ret; -} - -static inline int my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set) -{ - int64 initial_cmp= *cmp; - int64 initial_a= InterlockedCompareExchange64((volatile LONGLONG*)a, - (LONGLONG)set, - (LONGLONG)initial_cmp); - int ret= (initial_a == initial_cmp); - if (!ret) - *cmp= initial_a; - return ret; -} - -static inline int my_atomic_casptr(void * volatile *a, void **cmp, void *set) -{ - void *initial_cmp= *cmp; - void *initial_a= InterlockedCompareExchangePointer(a, set, initial_cmp); - int ret= (initial_a == initial_cmp); - if (!ret) - *cmp= initial_a; - return ret; -} - -static inline int32 my_atomic_add32(int32 volatile *a, int32 v) -{ - return (int32)InterlockedExchangeAdd((volatile LONG*)a, v); -} - -static inline int64 my_atomic_add64(int64 volatile *a, int64 v) -{ - return (int64)InterlockedExchangeAdd64((volatile LONGLONG*)a, (LONGLONG)v); -} - - -/* - According to MSDN: - - Simple reads and writes to properly-aligned 32-bit variables are atomic - operations. - ... - Simple reads and writes to properly aligned 64-bit variables are atomic on - 64-bit Windows. Reads and writes to 64-bit values are not guaranteed to be - atomic on 32-bit Windows. - - https://msdn.microsoft.com/en-us/library/windows/desktop/ms684122(v=vs.85).aspx -*/ - -static inline int32 my_atomic_load32(int32 volatile *a) -{ - int32 value= *a; - MemoryBarrier(); - return value; -} - -static inline int64 my_atomic_load64(int64 volatile *a) -{ -#ifdef _M_X64 - int64 value= *a; - MemoryBarrier(); - return value; -#else - return (int64) InterlockedCompareExchange64((volatile LONGLONG *) a, 0, 0); -#endif -} - -static inline void* my_atomic_loadptr(void * volatile *a) -{ - void *value= *a; - MemoryBarrier(); - return value; -} - -static inline int32 my_atomic_fas32(int32 volatile *a, int32 v) -{ - return (int32)InterlockedExchange((volatile LONG*)a, v); -} - -static inline int64 my_atomic_fas64(int64 volatile *a, int64 v) -{ - return (int64)InterlockedExchange64((volatile LONGLONG*)a, v); -} - -static inline void * my_atomic_fasptr(void * volatile *a, void * v) -{ - return InterlockedExchangePointer(a, v); -} - -static inline void my_atomic_store32(int32 volatile *a, int32 v) -{ - MemoryBarrier(); - *a= v; -} - -static inline void my_atomic_store64(int64 volatile *a, int64 v) -{ -#ifdef _M_X64 - MemoryBarrier(); - *a= v; -#else - (void) InterlockedExchange64((volatile LONGLONG *) a, v); -#endif -} - -static inline void my_atomic_storeptr(void * volatile *a, void *v) -{ - MemoryBarrier(); - *a= v; -} - -#endif /* ATOMIC_MSC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/atomic/solaris.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/atomic/solaris.h deleted file mode 100644 index b48ab46..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/atomic/solaris.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef ATOMIC_SOLARIS_INCLUDED -#define ATOMIC_SOLARIS_INCLUDED - -/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include - -#if defined(__GNUC__) -#define atomic_typeof(T,V) __typeof__(V) -#else -#define atomic_typeof(T,V) T -#endif - -static inline int my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set) -{ - int ret; - atomic_typeof(uint32_t, *cmp) sav; - sav= atomic_cas_32((volatile uint32_t *)a, (uint32_t)*cmp, (uint32_t)set); - ret= (sav == *cmp); - if (!ret) - *cmp= sav; - return ret; -} - -static inline int my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set) -{ - int ret; - atomic_typeof(uint64_t, *cmp) sav; - sav= atomic_cas_64((volatile uint64_t *)a, (uint64_t)*cmp, (uint64_t)set); - ret= (sav == *cmp); - if (!ret) - *cmp= sav; - return ret; -} - -static inline int my_atomic_casptr(void * volatile *a, void **cmp, void *set) -{ - int ret; - atomic_typeof(void *, *cmp) sav; - sav= atomic_cas_ptr((volatile void **)a, (void *)*cmp, (void *)set); - ret= (sav == *cmp); - if (!ret) - *cmp= sav; - return ret; -} - -static inline int32 my_atomic_add32(int32 volatile *a, int32 v) -{ - int32 nv= atomic_add_32_nv((volatile uint32_t *)a, v); - return nv - v; -} - -static inline int64 my_atomic_add64(int64 volatile *a, int64 v) -{ - int64 nv= atomic_add_64_nv((volatile uint64_t *)a, v); - return nv - v; -} - -static inline int32 my_atomic_fas32(int32 volatile *a, int32 v) -{ - return atomic_swap_32((volatile uint32_t *)a, (uint32_t)v); -} - -static inline int64 my_atomic_fas64(int64 volatile *a, int64 v) -{ - return atomic_swap_64((volatile uint64_t *)a, (uint64_t)v); -} - -static inline void * my_atomic_fasptr(void * volatile *a, void * v) -{ - return atomic_swap_ptr(a, v); -} - -static inline int32 my_atomic_load32(int32 volatile *a) -{ - return atomic_or_32_nv((volatile uint32_t *)a, 0); -} - -static inline int64 my_atomic_load64(int64 volatile *a) -{ - return atomic_or_64_nv((volatile uint64_t *)a, 0); -} - -static inline void* my_atomic_loadptr(void * volatile *a) -{ - return atomic_add_ptr_nv(a, 0); -} - -static inline void my_atomic_store32(int32 volatile *a, int32 v) -{ - (void) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v); -} - -static inline void my_atomic_store64(int64 volatile *a, int64 v) -{ - (void) atomic_swap_64((volatile uint64_t *)a, (uint64_t)v); -} - -static inline void my_atomic_storeptr(void * volatile *a, void *v) -{ - (void) atomic_swap_ptr((volatile void **)a, (void *)v); -} - -#endif /* ATOMIC_SOLARIS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/authors.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/authors.h deleted file mode 100644 index cf0a4c5..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/authors.h +++ /dev/null @@ -1,195 +0,0 @@ -#ifndef AUTHORS_INCLUDED -#define AUTHORS_INCLUDED - -/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Structure of the name list */ - -struct show_table_authors_st { - const char *name; - const char *location; - const char *comment; -}; - -/* - Output from "SHOW AUTHORS" - - If you can update it, you get to be in it :) - - Don't be offended if your name is not in here, just add it! - - Active people in the MariaDB are listed first, active people in MySQL - then, not active last. - - Names should be encoded using UTF-8. - - See also https://mariadb.com/kb/en/log-of-mariadb-contributions/ -*/ - -struct show_table_authors_st show_table_authors[]= { - /* Active people on MariaDB */ - { "Michael (Monty) Widenius", "Tusby, Finland", - "Lead developer and main author" }, - { "Sergei Golubchik", "Kerpen, Germany", - "Architect, Full-text search, precision math, plugin framework, merges etc" }, - { "Igor Babaev", "Bellevue, USA", "Optimizer, keycache, core work"}, - { "Sergey Petrunia", "St. Petersburg, Russia", "Optimizer"}, - { "Oleksandr Byelkin", "Lugansk, Ukraine", - "Query Cache (4.0), Subqueries (4.1), Views (5.0)" }, - { "Timour Katchaounov", "Sofia , Bulgaria", "Optimizer"}, - { "Kristian Nielsen", "Copenhagen, Denmark", - "Replication, Async client prototocol, General buildbot stuff" }, - { "Alexander (Bar) Barkov", "Izhevsk, Russia", - "Unicode and character sets" }, - { "Alexey Botchkov (Holyfoot)", "Izhevsk, Russia", - "GIS extensions, embedded server, precision math"}, - { "Daniel Bartholomew", "Raleigh, USA", "MariaDB documentation, Buildbot, releases"}, - { "Colin Charles", "Selangor, Malesia", "MariaDB documentation, talks at a LOT of conferences"}, - { "Sergey Vojtovich", "Izhevsk, Russia", - "initial implementation of plugin architecture, maintained native storage engines (MyISAM, MEMORY, ARCHIVE, etc), rewrite of table cache"}, - { "Vladislav Vaintroub", "Mannheim, Germany", "MariaDB Java connector, new thread pool, Windows optimizations"}, - { "Elena Stepanova", "Sankt Petersburg, Russia", "QA, test cases"}, - { "Georg Richter", "Heidelberg, Germany", "New LGPL C connector, PHP connector"}, - { "Jan Lindström", "Ylämylly, Finland", "Working on InnoDB"}, - { "Lixun Peng", "Hangzhou, China", "Multi Source replication" }, - { "Olivier Bertrand", "Paris, France", "CONNECT storage engine"}, - { "Kentoku Shiba", "Tokyo, Japan", "Spider storage engine, metadata_lock_info Information schema"}, - { "Percona", "CA, USA", "XtraDB, microslow patches, extensions to slow log"}, - { "Vicentiu Ciorbaru", "Bucharest, Romania", "Roles"}, - { "Sudheera Palihakkara", "", "PCRE Regular Expressions" }, - { "Pavel Ivanov", "USA", "Some patches and bug fixes"}, - { "Konstantin Osipov", "Moscow, Russia", - "Prepared statements (4.1), Cursors (5.0), GET_LOCK (10.0)" }, - { "Ian Gilfillan", "South Africa", "MariaDB documentation"}, - { "Federico Razolli", "Italy", "MariaDB documentation Italian translation"}, - { "Vinchen", "Shenzhen, China", "Instant ADD Column for InnoDB, Spider engine optimization, from Tencent Game DBA Team" }, - { "Willhan", "Shenzhen, China", "Big Column Compression, Spider engine optimization, from Tencent Game DBA Team" }, - { "Anders Karlsson", "Ystad, Sweden", "Replication patch for enforcing triggers on slave"}, - { "Otto Kekäläinen", "Tampere, Finland", "Debian packaging, install/upgrade engineering, QA pipelines, documentation"}, - { "Daniel Black", "Canberra, Australia", "Modernising large page support, systemd, and bug fixes"}, - - /* People working on MySQL code base (not NDB) */ - { "Guilhem Bichot", "Bordeaux, France", "Replication (since 4.0)" }, - { "Andrei Elkin", "Espoo, Finland", "Replication" }, - { "Dmitri Lenev", "Moscow, Russia", - "Time zones support (4.1), Triggers (5.0)" }, - { "Marc Alff", "Denver, CO, USA", "Signal, Resignal, Performance schema" }, - { "Mikael Ronström", "Stockholm, Sweden", - "NDB Cluster, Partitioning, online alter table" }, - { "Ingo Strüwing", "Berlin, Germany", - "Bug fixing in MyISAM, Merge tables etc" }, - {"Marko Mäkelä", "Helsinki, Finland", "InnoDB core developer"}, - - /* People not active anymore */ - { "David Axmark", "London, England", - "MySQL founder; Small stuff long time ago, Monty ripped it out!" }, - { "Brian (Krow) Aker", "Seattle, WA, USA", - "Architecture, archive, blackhole, federated, bunch of little stuff :)" }, - { "Venu Anuganti", "", "Client/server protocol (4.1)" }, - { "Omer BarNir", "Sunnyvale, CA, USA", - "Testing (sometimes) and general QA stuff" }, - { "John Birrell", "", "Emulation of pthread_mutex() for OS/2" }, - { "Andreas F. Bobak", "", "AGGREGATE extension to user-defined functions" }, - { "Reggie Burnett", "Nashville, TN, USA", "Windows development, Connectors" }, - { "Kent Boortz", "Orebro, Sweden", "Test platform, and general build stuff" }, - { "Tim Bunce", "", "mysqlhotcopy" }, - { "Yves Carlier", "", "mysqlaccess" }, - { "Joshua Chamas", "Cupertino, CA, USA", - "Concurrent insert, extended date syntax" }, - { "Petr Chardin", "Moscow, Russia", - "Instance Manager (5.0), Server log tables (5.1)" }, - { "Wei-Jou Chen", "", "Chinese (Big5) character set" }, - { "Albert Chin-A-Young", "", - "Tru64 port, large file support, better TCP wrappers support" }, - { "Jorge del Conde", "Mexico City, Mexico", "Windows development" }, - { "Antony T. Curtis", "Norwalk, CA, USA", - "Parser, port to OS/2, storage engines and some random stuff" }, - { "Yuri Dario", "", "OS/2 port" }, - { "Patrick Galbraith", "Sharon, NH", "Federated Engine, mysqlslap" }, - { "Lenz Grimmer", "Hamburg, Germany", - "Production (build and release) engineering" }, - { "Nikolay Grishakin", "Austin, TX, USA", "Testing - Server" }, - { "Wei He", "", "Chinese (GBK) character set" }, - { "Eric Herman", "Amsterdam, Netherlands", "Bug fixing - federated" }, - { "Andrey Hristov", "Walldorf, Germany", "Event scheduler (5.1)" }, - { "Alexander (Alexi) Ivanov", "St. Petersburg, Russia", "Replication" }, - { "Mattias Jonsson", "Uppsala, Sweden", "Partitioning" }, - { "Alexander (Salle) Keremidarski", "Sofia, Bulgaria", - "Bug fixing" }, - { "Mats Kindahl", "Storvreta, Sweden", "Replication" }, - { "Serge Kozlov", "Velikie Luki, Russia", "Testing - Cluster" }, - { "Hakan Küçükyılmaz", "Walldorf, Germany", "Testing - Server" }, - { "Matthias Leich", "Berlin, Germany", "Testing - Server" }, - { "Arjen Lentz", "Brisbane, Australia", - "Documentation (2001-2004), Dutch error messages, LOG2()" }, - { "Marc Liyanage", "", "Created Mac OS X packages" }, - { "Kelly Long", "Denver, CO, USA", "Pool Of Threads" }, - { "Zarko Mocnik", "", "Sorting for Slovenian language" }, - { "Per-Erik Martin", "Uppsala, Sweden", "Stored Procedures (5.0)" }, - { "Alexis Mikhailov", "", "User-defined functions" }, - { "Sinisa Milivojevic", "Larnaca, Cyprus", - "UNION (4.0), Subqueries in FROM clause (4.1), many other features" }, - { "Jonathan (Jeb) Miller", "Kyle, TX, USA", - "Testing - Cluster, Replication" }, - { "Elliot Murphy", "Cocoa, FL, USA", "Replication and backup" }, - { "Pekka Nouisiainen", "Stockholm, Sweden", - "NDB Cluster: BLOB support, character set support, ordered indexes" }, - { "Alexander Nozdrin", "Moscow, Russia", - "Bug fixing (Stored Procedures, 5.0)" }, - { "Per Eric Olsson", "", "Testing of dynamic record format" }, - { "Jonas Oreland", "Stockholm, Sweden", - "NDB Cluster, Online Backup, lots of other things" }, - { "Alexander (Sasha) Pachev", "Provo, UT, USA", - "Statement-based replication, SHOW CREATE TABLE, mysql-bench" }, - { "Irena Pancirov", "", "Port to Windows with Borland compiler" }, - { "Jan Pazdziora", "", "Czech sorting order" }, - { "Benjamin Pflugmann", "", - "Extended MERGE storage engine to handle INSERT" }, - { "Igor Romanenko", "", - "mysqldump" }, - { "Tõnu Samuel", "Estonia", - "VIO interface, other miscellaneous features" }, - { "Carsten Segieth (Pino)", "Fredersdorf, Germany", "Testing - Server"}, - { "Martin Sköld", "Stockholm, Sweden", - "NDB Cluster: Unique indexes, integration into MySQL" }, - { "Timothy Smith", "Auckland, New Zealand", - "Dynamic character sets, parts of the build system, libmysqld"}, - { "Miguel Solorzano", "Florianopolis, Santa Catarina, Brazil", - "Windows development, Windows NT service"}, - { "Punita Srivastava", "Austin, TX, USA", "Testing - Merlin"}, - { "Alexey Stroganov (Ranger)", "Lugansk, Ukraine", "Testing - Benchmarks"}, - { "Magnus Svensson", "Öregrund, Sweden", - "NDB Cluster: Integration into MySQL, test framework" }, - { "Zeev Suraski", "", "FROM_UNIXTIME(), ENCRYPT()" }, - { "TAMITO", "", - "The _MB character set macros and UJIS and SJIS character sets" }, - { "Jani Tolonen", "Helsinki, Finland", - "mysqlimport, extensions to command-line clients, PROCEDURE ANALYSE()" }, - { "Lars Thalmann", "Stockholm, Sweden", - "Replication and cluster development" }, - { "Tomas Ulin", "Stockholm, Sweden", - "NDB Cluster: Configuration, installation" }, - { "Gianmassimo Vigazzola", "", "Initial Windows port" }, - { "Sergey Vojtovich", "Izhevsk, Russia", "Plugins infrastructure (5.1)" }, - { "Matt Wagner", "Northfield, MN, USA", "Bug fixing" }, - { "Jim Winstead Jr.", "Los Angeles, CA, USA", "Bug fixing" }, - { "Peter Zaitsev", "Tacoma, WA, USA", - "SHA1(), AES_ENCRYPT(), AES_DECRYPT(), bug fixing" }, - {"Mark Mark Callaghan", "Texas, USA", "Statistics patches"}, - {NULL, NULL, NULL} -}; - -#endif /* AUTHORS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/backup.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/backup.h deleted file mode 100644 index 8d8a28b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/backup.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef BACKUP_INCLUDED -#define BACKUP_INCLUDED -/* Copyright (c) 2018, MariaDB Corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -enum backup_stages -{ - BACKUP_START, BACKUP_FLUSH, BACKUP_WAIT_FOR_FLUSH, BACKUP_LOCK_COMMIT, - BACKUP_END, BACKUP_FINISHED -}; - -extern TYPELIB backup_stage_names; - -void backup_init(); -bool run_backup_stage(THD *thd, backup_stages stage); -bool backup_end(THD *thd); -void backup_set_alter_copy_lock(THD *thd, TABLE *altered_table); -bool backup_reset_alter_copy_lock(THD *thd); - -bool backup_lock(THD *thd, TABLE_LIST *table); -void backup_unlock(THD *thd); -#endif /* BACKUP_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/bounded_queue.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/bounded_queue.h deleted file mode 100644 index 07ab6db..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/bounded_queue.h +++ /dev/null @@ -1,196 +0,0 @@ -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef BOUNDED_QUEUE_INCLUDED -#define BOUNDED_QUEUE_INCLUDED - -#include "my_base.h" -#include -#include "queues.h" -#include - -class Sort_param; - -/** - A priority queue with a fixed, limited size. - - This is a wrapper on top of QUEUE and the queue_xxx() functions. - It keeps the top-N elements which are inserted. - - Elements of type Element_type are pushed into the queue. - For each element, we call a user-supplied keymaker_function, - to generate a key of type Key_type for the element. - Instances of Key_type are compared with the user-supplied compare_function. - - The underlying QUEUE implementation needs one extra element for replacing - the lowest/highest element when pushing into a full queue. - */ -template -class Bounded_queue -{ -public: - Bounded_queue() - { - memset(&m_queue, 0, sizeof(m_queue)); - } - - ~Bounded_queue() - { - delete_queue(&m_queue); - } - - /** - Function for making sort-key from input data. - @param param Sort parameters. - @param to Where to put the key. - @param from The input data. - */ - typedef uint (*keymaker_function)(Sort_param *param, - Key_type *to, - Element_type *from, - bool packing_keys); - - /** - Function for comparing two keys. - @param n Pointer to number of bytes to compare. - @param a First key. - @param b Second key. - @retval -1, 0, or 1 depending on whether the left argument is - less than, equal to, or greater than the right argument. - */ - typedef int (*compare_function)(size_t *n, Key_type **a, Key_type **b); - - /** - Initialize the queue. - - @param max_elements The size of the queue. - @param max_at_top Set to true if you want biggest element on top. - false: We keep the n largest elements. - pop() will return the smallest key in the result set. - true: We keep the n smallest elements. - pop() will return the largest key in the result set. - @param compare Compare function for elements, takes 3 arguments. - If NULL, we use get_ptr_compare(compare_length). - @param compare_length Length of the data (i.e. the keys) used for sorting. - @param keymaker Function which generates keys for elements. - @param sort_param Sort parameters. - @param sort_keys Array of pointers to keys to sort. - - @retval 0 OK, 1 Could not allocate memory. - - We do *not* take ownership of any of the input pointer arguments. - */ - int init(ha_rows max_elements, bool max_at_top, - compare_function compare, size_t compare_length, - keymaker_function keymaker, Sort_param *sort_param, - Key_type **sort_keys); - - /** - Pushes an element on the queue. - If the queue is already full, we discard one element. - Calls keymaker_function to generate a key for the element. - - @param element The element to be pushed. - */ - void push(Element_type *element); - - /** - Removes the top element from the queue. - - @retval Pointer to the (key of the) removed element. - - @note This function is for unit testing, where we push elements into to the - queue, and test that the appropriate keys are retained. - Interleaving of push() and pop() operations has not been tested. - */ - Key_type **pop() - { - // Don't return the extra element to the client code. - if (queue_is_full((&m_queue))) - queue_remove(&m_queue, 0); - DBUG_ASSERT(m_queue.elements > 0); - if (m_queue.elements == 0) - return NULL; - return reinterpret_cast(queue_remove(&m_queue, 0)); - } - - /** - The number of elements in the queue. - */ - uint num_elements() const { return m_queue.elements; } - - /** - Is the queue initialized? - */ - bool is_initialized() const { return m_queue.max_elements > 0; } - -private: - Key_type **m_sort_keys; - size_t m_compare_length; - keymaker_function m_keymaker; - Sort_param *m_sort_param; - st_queue m_queue; -}; - - -template -int Bounded_queue::init(ha_rows max_elements, - bool max_at_top, - compare_function compare, - size_t compare_length, - keymaker_function keymaker, - Sort_param *sort_param, - Key_type **sort_keys) -{ - DBUG_ASSERT(sort_keys != NULL); - - m_sort_keys= sort_keys; - m_compare_length= compare_length; - m_keymaker= keymaker; - m_sort_param= sort_param; - // init_queue() takes an uint, and also does (max_elements + 1) - if (max_elements >= (UINT_MAX - 1)) - return 1; - if (compare == NULL) - compare= - reinterpret_cast(get_ptr_compare(compare_length)); - // We allocate space for one extra element, for replace when queue is full. - return init_queue(&m_queue, (uint) max_elements + 1, - 0, max_at_top, - reinterpret_cast(compare), - &m_compare_length, 0, 0); -} - - -template -void Bounded_queue::push(Element_type *element) -{ - DBUG_ASSERT(is_initialized()); - if (queue_is_full((&m_queue))) - { - // Replace top element with new key, and re-order the queue. - Key_type **pq_top= reinterpret_cast(queue_top(&m_queue)); - (void)(*m_keymaker)(m_sort_param, *pq_top, element, false); - queue_replace_top(&m_queue); - } else { - // Insert new key into the queue. - (*m_keymaker)(m_sort_param, m_sort_keys[m_queue.elements], - element, false); - queue_insert(&m_queue, - reinterpret_cast(&m_sort_keys[m_queue.elements])); - } -} - -#endif // BOUNDED_QUEUE_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/client_settings.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/client_settings.h deleted file mode 100644 index cc4981e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/client_settings.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef CLIENT_SETTINGS_INCLUDED -#define CLIENT_SETTINGS_INCLUDED -#else -#error You have already included an client_settings.h and it should not be included twice -#endif /* CLIENT_SETTINGS_INCLUDED */ - -#include -#include - -/* - Note: CLIENT_CAPABILITIES is also defined in libmysql/client_settings.h. - When adding capabilities here, consider if they should be also added to - the libmysql version. -*/ -#define CLIENT_CAPABILITIES (CLIENT_MYSQL | \ - CLIENT_LONG_FLAG | \ - CLIENT_TRANSACTIONS | \ - CLIENT_PROTOCOL_41 | \ - CLIENT_SECURE_CONNECTION | \ - CLIENT_PLUGIN_AUTH | \ - CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \ - CLIENT_CONNECT_ATTRS) - -#define read_user_name(A) A[0]= 0 -#undef _CUSTOMCONFIG_ - -#define mysql_server_init(a,b,c) mysql_client_plugin_init() -#define mysql_server_end() mysql_client_plugin_deinit() - -#ifdef HAVE_REPLICATION -C_MODE_START -void slave_io_thread_detach_vio(); -C_MODE_END -#else -#define slave_io_thread_detach_vio() -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/compat56.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/compat56.h deleted file mode 100644 index 347d614..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/compat56.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef COMPAT56_H_INCLUDED -#define COMPAT56_H_INCLUDED -/* - Copyright (c) 2004, 2012, Oracle and/or its affiliates. - Copyright (c) 2013 MariaDB Foundation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/** MySQL56 routines and macros **/ - -/* - Buffer size for a native TIMESTAMP representation, for use with NativBuffer. - 4 bytes for seconds - 3 bytes for microseconds - 1 byte for the trailing '\0' (class Native reserves extra 1 byte for '\0') -*/ -#define STRING_BUFFER_TIMESTAMP_BINARY_SIZE 8 /* 4 + 3 + 1 */ - -#define MY_PACKED_TIME_GET_INT_PART(x) ((x) >> 24) -#define MY_PACKED_TIME_GET_FRAC_PART(x) ((x) % (1LL << 24)) -#define MY_PACKED_TIME_MAKE(i, f) ((((longlong) (i)) << 24) + (f)) -#define MY_PACKED_TIME_MAKE_INT(i) ((((longlong) (i)) << 24)) - -longlong TIME_to_longlong_datetime_packed(const MYSQL_TIME *); -longlong TIME_to_longlong_time_packed(const MYSQL_TIME *); - -void TIME_from_longlong_datetime_packed(MYSQL_TIME *ltime, longlong nr); -void TIME_from_longlong_time_packed(MYSQL_TIME *ltime, longlong nr); - -void my_datetime_packed_to_binary(longlong nr, uchar *ptr, uint dec); -longlong my_datetime_packed_from_binary(const uchar *ptr, uint dec); -uint my_datetime_binary_length(uint dec); - -void my_time_packed_to_binary(longlong nr, uchar *ptr, uint dec); -longlong my_time_packed_from_binary(const uchar *ptr, uint dec); -uint my_time_binary_length(uint dec); - -void my_timestamp_to_binary(const struct timeval *tm, uchar *ptr, uint dec); -void my_timestamp_from_binary(struct timeval *tm, const uchar *ptr, uint dec); -uint my_timestamp_binary_length(uint dec); -/** End of MySQL routines and macros **/ - -#endif /* COMPAT56_H_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/config.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/config.h deleted file mode 100644 index 22f5893..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/config.h +++ /dev/null @@ -1,558 +0,0 @@ -/* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MY_CONFIG_H -#define MY_CONFIG_H -#define DOT_FRM_VERSION 6 -/* Headers we may want to use. */ -#define STDC_HEADERS 1 -/* #undef _GNU_SOURCE */ -/* #undef HAVE_ALLOCA_H */ -/* #undef HAVE_ARPA_INET_H */ -/* #undef HAVE_ASM_TERMBITS_H */ -/* #undef HAVE_CRYPT_H */ -/* #undef HAVE_CURSES_H */ -/* #undef HAVE_BFD_H */ -/* #undef HAVE_NDIR_H */ -/* #undef HAVE_DIRENT_H */ -/* #undef HAVE_DLFCN_H */ -/* #undef HAVE_EXECINFO_H */ -#define HAVE_FCNTL_H 1 -/* #undef HAVE_FENV_H */ -#define HAVE_FLOAT_H 1 -/* #undef HAVE_FNMATCH_H */ -/* #undef HAVE_FPU_CONTROL_H */ -/* #undef HAVE_GRP_H */ -/* #undef HAVE_IA64INTRIN_H */ -/* #undef HAVE_IEEEFP_H */ -/* #undef HAVE_INTTYPES_H */ -/* #undef HAVE_KQUEUE */ -#define HAVE_LIMITS_H 1 -/* #undef HAVE_LINK_H */ -/* #undef HAVE_LINUX_UNISTD_H */ -#define HAVE_LOCALE_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -/* #undef HAVE_NETINET_IN_H */ -/* #undef HAVE_PATHS_H */ -/* #undef HAVE_POLL_H */ -/* #undef HAVE_PWD_H */ -/* #undef HAVE_SCHED_H */ -/* #undef HAVE_SELECT_H */ -/* #undef HAVE_SOLARIS_LARGE_PAGES */ -#define HAVE_STDDEF_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STDARG_H 1 -/* #undef HAVE_STRINGS_H */ -#define HAVE_STRING_H 1 -/* #undef HAVE_STDINT_H */ -/* #undef HAVE_SYNCH_H */ -/* #undef HAVE_SYSENT_H */ -/* #undef HAVE_SYS_DIR_H */ -/* #undef HAVE_SYS_FILE_H */ -/* #undef HAVE_SYS_FPU_H */ -/* #undef HAVE_SYS_IOCTL_H */ -/* #undef HAVE_SYS_MALLOC_H */ -/* #undef HAVE_SYS_MMAN_H */ -/* #undef HAVE_SYS_NDIR_H */ -/* #undef HAVE_SYS_PTE_H */ -/* #undef HAVE_SYS_PTEM_H */ -/* #undef HAVE_SYS_PRCTL_H */ -/* #undef HAVE_SYS_RESOURCE_H */ -/* #undef HAVE_SYS_SELECT_H */ -/* #undef HAVE_SYS_SOCKET_H */ -/* #undef HAVE_SYS_SOCKIO_H */ -/* #undef HAVE_SYS_UTSNAME_H */ -#define HAVE_SYS_STAT_H 1 -/* #undef HAVE_SYS_STREAM_H */ -/* #undef HAVE_SYS_SYSCALL_H */ -#define HAVE_SYS_TIMEB_H 1 -/* #undef HAVE_SYS_TIMES_H */ -/* #undef HAVE_SYS_TIME_H */ -#define HAVE_SYS_TYPES_H 1 -/* #undef HAVE_SYS_UN_H */ -/* #undef HAVE_SYS_VADVISE_H */ -/* #undef HAVE_SYS_STATVFS_H */ -/* #undef HAVE_UCONTEXT_H */ -/* #undef HAVE_TERM_H */ -/* #undef HAVE_TERMBITS_H */ -/* #undef HAVE_TERMIOS_H */ -/* #undef HAVE_TERMIO_H */ -/* #undef HAVE_TERMCAP_H */ -#define HAVE_TIME_H 1 -/* #undef HAVE_UNISTD_H */ -/* #undef HAVE_UTIME_H */ -#define HAVE_VARARGS_H 1 -#define HAVE_SYS_UTIME_H 1 -/* #undef HAVE_SYS_WAIT_H */ -/* #undef HAVE_SYS_PARAM_H */ - -/* Libraries */ -/* #undef HAVE_LIBWRAP */ -/* #undef HAVE_SYSTEMD */ - -/* Does "struct timespec" have a "sec" and "nsec" field? */ -/* #undef HAVE_TIMESPEC_TS_SEC */ - -/* Readline */ -/* #undef HAVE_HIST_ENTRY */ -/* #undef USE_LIBEDIT_INTERFACE */ -/* #undef USE_NEW_READLINE_INTERFACE */ - -/* #undef FIONREAD_IN_SYS_IOCTL */ -/* #undef GWINSZ_IN_SYS_IOCTL */ -/* #undef TIOCSTAT_IN_SYS_IOCTL */ -/* #undef FIONREAD_IN_SYS_FILIO */ - -/* Functions we may want to use. */ -/* #undef HAVE_ACCEPT4 */ -#define HAVE_ACCESS 1 -/* #undef HAVE_ALARM */ -#define HAVE_ALLOCA 1 -/* #undef HAVE_BFILL */ -/* #undef HAVE_INDEX */ -/* #undef HAVE_CLOCK_GETTIME */ -/* #undef HAVE_CRYPT */ -/* #undef HAVE_CUSERID */ -/* #undef HAVE_DLADDR */ -/* #undef HAVE_DLERROR */ -/* #undef HAVE_DLOPEN */ -/* #undef HAVE_FCHMOD */ -/* #undef HAVE_FCNTL */ -/* #undef HAVE_FDATASYNC */ -/* #undef HAVE_DECL_FDATASYNC */ -/* #undef HAVE_FEDISABLEEXCEPT */ -/* #undef HAVE_FESETROUND */ -/* #undef HAVE_FP_EXCEPT */ -/* #undef HAVE_FSEEKO */ -/* #undef HAVE_FSYNC */ -#define HAVE_FTIME 1 -/* #undef HAVE_GETIFADDRS */ -#define HAVE_GETCWD 1 -/* #undef HAVE_GETHOSTBYADDR_R */ -/* #undef HAVE_GETHRTIME */ -/* #undef HAVE_GETPAGESIZE */ -/* #undef HAVE_GETPAGESIZES */ -/* #undef HAVE_GETPASS */ -/* #undef HAVE_GETPASSPHRASE */ -/* #undef HAVE_GETPWNAM */ -/* #undef HAVE_GETPWUID */ -/* #undef HAVE_GETRLIMIT */ -/* #undef HAVE_GETRUSAGE */ -/* #undef HAVE_GETTIMEOFDAY */ -/* #undef HAVE_GETWD */ -#define HAVE_GMTIME_R 1 -/* #undef gmtime_r */ -/* #undef HAVE_IN_ADDR_T */ -/* #undef HAVE_INITGROUPS */ -#define HAVE_LDIV 1 -/* #undef HAVE_LRAND48 */ -#define HAVE_LOCALTIME_R 1 -/* #undef HAVE_LSTAT */ -/* #undef HAVE_MEMALIGN */ -/* #undef HAVE_MLOCK */ -/* #undef HAVE_NL_LANGINFO */ -/* #undef HAVE_MADVISE */ -/* #undef HAVE_DECL_MADVISE */ -/* #undef HAVE_DECL_MHA_MAPSIZE_VA */ -/* #undef HAVE_MALLINFO */ -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -/* #undef HAVE_MKSTEMP */ -/* #undef HAVE_MKOSTEMP */ -/* #undef HAVE_MLOCKALL */ -/* #undef HAVE_MMAP */ -/* #undef HAVE_MMAP64 */ -#define HAVE_PERROR 1 -/* #undef HAVE_POLL */ -/* #undef HAVE_POSIX_FALLOCATE */ -/* #undef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */ -/* #undef HAVE_PREAD */ -/* #undef HAVE_READ_REAL_TIME */ -/* #undef HAVE_PTHREAD_ATTR_CREATE */ -/* #undef HAVE_PTHREAD_ATTR_GETGUARDSIZE */ -/* #undef HAVE_PTHREAD_ATTR_GETSTACKSIZE */ -/* #undef HAVE_PTHREAD_ATTR_SETSCOPE */ -/* #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE */ -/* #undef HAVE_PTHREAD_CONDATTR_CREATE */ -/* #undef HAVE_PTHREAD_GETAFFINITY_NP */ -/* #undef HAVE_PTHREAD_KEY_DELETE */ -/* #undef HAVE_PTHREAD_KILL */ -/* #undef HAVE_PTHREAD_RWLOCK_RDLOCK */ -/* #undef HAVE_PTHREAD_SIGMASK */ -/* #undef HAVE_PTHREAD_YIELD_NP */ -/* #undef HAVE_PTHREAD_YIELD_ZERO_ARG */ -/* #undef PTHREAD_ONCE_INITIALIZER */ -#define HAVE_PUTENV 1 -/* #undef HAVE_READDIR_R */ -/* #undef HAVE_READLINK */ -/* #undef HAVE_REALPATH */ -#define HAVE_RENAME 1 -/* #undef HAVE_RWLOCK_INIT */ -/* #undef HAVE_SCHED_YIELD */ -#define HAVE_SELECT 1 -/* #undef HAVE_SETENV */ -#define HAVE_SETLOCALE 1 -/* #undef HAVE_SETUPTERM */ -/* #undef HAVE_SIGSET */ -/* #undef HAVE_SIGACTION */ -/* #undef HAVE_SIGTHREADMASK */ -/* #undef HAVE_SIGWAIT */ -/* #undef HAVE_SIGWAITINFO */ -/* #undef HAVE_SLEEP */ -#define HAVE_SNPRINTF 1 -/* #undef HAVE_STPCPY */ -#define HAVE_STRERROR 1 -#define HAVE_STRCOLL 1 -#define HAVE_STRNLEN 1 -#define HAVE_STRPBRK 1 -#define HAVE_STRTOK_R 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOULL 1 -#define HAVE_TELL 1 -/* #undef HAVE_THR_SETCONCURRENCY */ -/* #undef HAVE_THR_YIELD */ -#define HAVE_TIME 1 -/* #undef HAVE_TIMES */ -/* #undef HAVE_VIDATTR */ -#define HAVE_VIO_READ_BUFF 1 -/* #undef HAVE_VASPRINTF */ -#define HAVE_VSNPRINTF 1 -/* #undef HAVE_FTRUNCATE */ -#define HAVE_TZNAME 1 -/* Symbols we may use */ -/* #undef HAVE_SYS_ERRLIST */ -/* used by stacktrace functions */ -/* #undef HAVE_BACKTRACE */ -/* #undef HAVE_BACKTRACE_SYMBOLS */ -/* #undef HAVE_BACKTRACE_SYMBOLS_FD */ -/* #undef HAVE_PRINTSTACK */ -#define HAVE_IPV6 1 -/* #undef ss_family */ -/* #undef HAVE_SOCKADDR_IN_SIN_LEN */ -/* #undef HAVE_SOCKADDR_IN6_SIN6_LEN */ -#define STRUCT_TIMESPEC_HAS_TV_SEC 1 -#define STRUCT_TIMESPEC_HAS_TV_NSEC 1 - -#define USE_MB 1 -#define USE_MB_IDENT 1 - -/* this means that valgrind headers and macros are available */ -/* #undef HAVE_VALGRIND_MEMCHECK_H */ - -/* this means WITH_VALGRIND - we change some code paths for valgrind */ -/* #undef HAVE_valgrind */ - -/* Types we may use */ -#ifdef __APPLE__ - /* - Special handling required for OSX to support universal binaries that - mix 32 and 64 bit architectures. - */ - #if(__LP64__) - #define SIZEOF_LONG 8 - #else - #define SIZEOF_LONG 4 - #endif - #define SIZEOF_VOIDP SIZEOF_LONG - #define SIZEOF_CHARP SIZEOF_LONG - #define SIZEOF_SIZE_T SIZEOF_LONG -#else -/* No indentation, to fetch the lines from verification scripts */ -#define SIZEOF_LONG 4 -#define SIZEOF_VOIDP 8 -#define SIZEOF_CHARP 8 -#define SIZEOF_SIZE_T 8 -#endif - -#define HAVE_LONG 1 -#define HAVE_CHARP 1 -#define SIZEOF_INT 4 -#define HAVE_INT 1 -#define SIZEOF_LONG_LONG 8 -#define HAVE_LONG_LONG 1 -#define SIZEOF_OFF_T 4 -#define HAVE_OFF_T 1 -/* #undef SIZEOF_UCHAR */ -/* #undef HAVE_UCHAR */ -/* #undef SIZEOF_UINT */ -/* #undef HAVE_UINT */ -/* #undef SIZEOF_ULONG */ -/* #undef HAVE_ULONG */ -/* #undef SIZEOF_INT8 */ -/* #undef HAVE_INT8 */ -/* #undef SIZEOF_UINT8 */ -/* #undef HAVE_UINT8 */ -/* #undef SIZEOF_INT16 */ -/* #undef HAVE_INT16 */ -/* #undef SIZEOF_UINT16 */ -/* #undef HAVE_UINT16 */ -/* #undef SIZEOF_INT32 */ -/* #undef HAVE_INT32 */ -/* #undef SIZEOF_UINT32 */ -/* #undef HAVE_UINT32 */ -/* #undef SIZEOF_INT64 */ -/* #undef HAVE_INT64 */ -/* #undef SIZEOF_UINT64 */ -/* #undef HAVE_UINT64 */ - -#define SOCKET_SIZE_TYPE int - -/* #undef HAVE_MBSTATE_T */ - -#define MAX_INDEXES 64 - -#define QSORT_TYPE_IS_VOID 1 -#define RETQSORTTYPE void - -#define RETSIGTYPE void -#define VOID_SIGHANDLER 1 -/* #undef HAVE_SIGHANDLER_T */ -#define STRUCT_RLIMIT struct rlimit - -#ifdef __APPLE__ - #if __BIG_ENDIAN - #define WORDS_BIGENDIAN 1 - #endif -#else -/* #undef WORDS_BIGENDIAN */ -#endif - -/* Define to `__inline__' or `__inline' if that's what the C compiler calls - it, or to nothing if 'inline' is not supported under any name. */ -/* #undef C_HAS_inline */ -#if !(C_HAS_inline) -#ifndef __cplusplus -# define inline __inline -#endif -#endif - - -/* #undef TARGET_OS_LINUX */ - -#define HAVE_WCTYPE_H 1 -#define HAVE_WCHAR_H 1 -/* #undef HAVE_LANGINFO_H */ -/* #undef HAVE_MBRLEN */ -/* #undef HAVE_MBSRTOWCS */ -/* #undef HAVE_MBRTOWC */ -/* #undef HAVE_WCWIDTH */ -/* #undef HAVE_ISWLOWER */ -/* #undef HAVE_ISWUPPER */ -/* #undef HAVE_TOWLOWER */ -/* #undef HAVE_TOWUPPER */ -/* #undef HAVE_ISWCTYPE */ -/* #undef HAVE_WCHAR_T */ - - -#define HAVE_STRCASECMP 1 -/* #undef HAVE_TCGETATTR */ - -/* #undef HAVE_WEAK_SYMBOL */ -/* #undef HAVE_ABI_CXA_DEMANGLE */ -/* #undef HAVE_ATTRIBUTE_CLEANUP */ - -/* #undef HAVE_POSIX_SIGNALS */ -/* #undef HAVE_BSD_SIGNALS */ - -/* #undef HAVE_SVR3_SIGNALS */ -/* #undef HAVE_V7_SIGNALS */ -#define HAVE_ERR_remove_thread_state 1 -#define HAVE_X509_check_host 1 - -/* #undef HAVE_SOLARIS_STYLE_GETHOST */ - -/* #undef HAVE_GCC_C11_ATOMICS */ -/* #undef HAVE_SOLARIS_ATOMIC */ -#define NO_FCNTL_NONBLOCK 1 -#define NO_ALARM 1 - -/* #undef _LARGE_FILES */ -#define _LARGEFILE_SOURCE 1 -/* #undef _LARGEFILE64_SOURCE */ - -/* #undef TIME_WITH_SYS_TIME */ - -#define STACK_DIRECTION -1 - -#define SYSTEM_TYPE "Win64" -#define MACHINE_TYPE "AMD64" -#define DEFAULT_MACHINE "x64" -/* #undef HAVE_DTRACE */ - -#define SIGNAL_WITH_VIO_CLOSE 1 - -/* Windows stuff, mostly functions, that have Posix analogs but named differently */ -#define S_IROTH _S_IREAD -#define S_IFIFO _S_IFIFO -/* #undef IPPROTO_IPV6 */ -/* #undef IPV6_V6ONLY */ -#define sigset_t int -#define mode_t int -#define SIGQUIT SIGTERM -#define SIGPIPE SIGINT -#define popen _popen -#define pclose _pclose -#define ssize_t SSIZE_T -#define strcasecmp _stricmp -#define strncasecmp _strnicmp -/* #undef snprintf */ -#define strtok_r strtok_s -#define strtoll _strtoi64 -#define strtoull _strtoui64 -/* #undef vsnprintf */ -#if defined(_MSC_VER) && (_MSC_VER > 1800) -#define tzname _tzname -#define P_tmpdir "C:\\TEMP" -#endif -#if defined(_MSC_VER) && (_MSC_VER > 1310) -# define HAVE_SETENV -#define setenv(a,b,c) _putenv_s(a,b) -#endif -#define PSAPI_VERSION 1 /* for GetProcessMemoryInfo() */ - -/* We don't want the min/max macros */ -#ifdef __WIN__ -#define NOMINMAX 1 -#endif - -/* - MySQL features -*/ -#define LOCAL_INFILE_MODE_OFF 0 -#define LOCAL_INFILE_MODE_ON 1 -#define LOCAL_INFILE_MODE_AUTO 2 -#define ENABLED_LOCAL_INFILE LOCAL_INFILE_MODE_AUTO - -#define ENABLED_PROFILING 1 -/* #undef EXTRA_DEBUG */ -#define USE_SYMDIR 1 - -/* Character sets and collations */ -#define MYSQL_DEFAULT_CHARSET_NAME "latin1" -#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" - -#define USE_MB 1 -#define USE_MB_IDENT 1 - -/* This should mean case insensitive file system */ -#define FN_NO_CASE_SENSE 1 - -#define HAVE_CHARSET_armscii8 1 -#define HAVE_CHARSET_ascii 1 -#define HAVE_CHARSET_big5 1 -#define HAVE_CHARSET_cp1250 1 -#define HAVE_CHARSET_cp1251 1 -#define HAVE_CHARSET_cp1256 1 -#define HAVE_CHARSET_cp1257 1 -#define HAVE_CHARSET_cp850 1 -#define HAVE_CHARSET_cp852 1 -#define HAVE_CHARSET_cp866 1 -#define HAVE_CHARSET_cp932 1 -#define HAVE_CHARSET_dec8 1 -#define HAVE_CHARSET_eucjpms 1 -#define HAVE_CHARSET_euckr 1 -#define HAVE_CHARSET_gb2312 1 -#define HAVE_CHARSET_gbk 1 -#define HAVE_CHARSET_geostd8 1 -#define HAVE_CHARSET_greek 1 -#define HAVE_CHARSET_hebrew 1 -#define HAVE_CHARSET_hp8 1 -#define HAVE_CHARSET_keybcs2 1 -#define HAVE_CHARSET_koi8r 1 -#define HAVE_CHARSET_koi8u 1 -#define HAVE_CHARSET_latin1 1 -#define HAVE_CHARSET_latin2 1 -#define HAVE_CHARSET_latin5 1 -#define HAVE_CHARSET_latin7 1 -#define HAVE_CHARSET_macce 1 -#define HAVE_CHARSET_macroman 1 -#define HAVE_CHARSET_sjis 1 -#define HAVE_CHARSET_swe7 1 -#define HAVE_CHARSET_tis620 1 -#define HAVE_CHARSET_ucs2 1 -#define HAVE_CHARSET_ujis 1 -#define HAVE_CHARSET_utf8mb4 1 -#define HAVE_CHARSET_utf8mb3 1 -#define HAVE_CHARSET_utf16 1 -#define HAVE_CHARSET_utf32 1 -#define HAVE_UCA_COLLATIONS 1 -#define HAVE_COMPRESS 1 -/* #undef HAVE_EncryptAes128Ctr */ -/* #undef HAVE_EncryptAes128Gcm */ - -/* - Stuff that always need to be defined (compile breaks without it) -*/ -#define HAVE_SPATIAL 1 -#define HAVE_RTREE_KEYS 1 -#define HAVE_QUERY_CACHE 1 -#define BIG_TABLES 1 - -/* - Important storage engines (those that really need define - WITH__STORAGE_ENGINE for the whole server) -*/ -#define WITH_INNOBASE_STORAGE_ENGINE 1 -#define WITH_PARTITION_STORAGE_ENGINE 1 -#define WITH_PERFSCHEMA_STORAGE_ENGINE 1 -#define WITH_ARIA_STORAGE_ENGINE 1 -#define USE_ARIA_FOR_TMP_TABLES 1 - -#define DEFAULT_MYSQL_HOME "C:/Program Files/MariaDB 10.5" -#define SHAREDIR "share" -#define DEFAULT_BASEDIR "C:/Program Files/MariaDB 10.5" -#define MYSQL_DATADIR "C:/Program Files/MariaDB 10.5/data" -#define DEFAULT_CHARSET_HOME "C:/Program Files/MariaDB 10.5" -#define PLUGINDIR "C:/Program Files/MariaDB 10.5/lib/plugin" -/* #undef DEFAULT_SYSCONFDIR */ -#define DEFAULT_TMPDIR P_tmpdir - -/* #undef SO_EXT */ - -#define MYSQL_VERSION_MAJOR 10 -#define MYSQL_VERSION_MINOR 5 -#define MYSQL_VERSION_PATCH 7 -#define MYSQL_VERSION_EXTRA "" - -#define PACKAGE "mysql" -#define PACKAGE_BUGREPORT "" -#define PACKAGE_NAME "MySQL Server" -#define PACKAGE_STRING "MySQL Server 10.5.7" -#define PACKAGE_TARNAME "mysql" -#define PACKAGE_VERSION "10.5.7" -#define VERSION "10.5.7" -#define PROTOCOL_VERSION 10 -#define PCRE2_CODE_UNIT_WIDTH 8 - -#define MALLOC_LIBRARY "system" - -/* time_t related defines */ - -#define SIZEOF_TIME_T 8 -#define TIME_T_UNSIGNED 1 - -#ifndef EMBEDDED_LIBRARY -/* #undef WSREP_INTERFACE_VERSION */ -/* #undef WITH_WSREP */ -/* #undef WSREP_PROC_INFO */ -#endif - -#if !defined(__STDC_FORMAT_MACROS) -#define __STDC_FORMAT_MACROS -#endif // !defined(__STDC_FORMAT_MACROS) - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/contributors.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/contributors.h deleted file mode 100644 index 34f0608..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/contributors.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef CONTRIBUTORS_INCLUDED -#define CONTRIBUTORS_INCLUDED - -/* Copyright (c) 2006 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Structure of the name list */ - -struct show_table_contributors_st { - const char *name; - const char *location; - const char *comment; -}; - -/* - Output from "SHOW CONTRIBUTORS" - - Get permission before editing. - - Names should be encoded using UTF-8. - - See also https://mariadb.com/kb/en/log-of-mariadb-contributions/ -*/ - -struct show_table_contributors_st show_table_contributors[]= { - /* MariaDB foundation sponsors, in contribution, size , time order */ - {"Booking.com", "https://www.booking.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"}, - {"Alibaba Cloud", "https://www.alibabacloud.com/", "Platinum Sponsor of the MariaDB Foundation"}, - {"Tencent Cloud", "https://cloud.tencent.com", "Platinum Sponsor of the MariaDB Foundation"}, - {"Microsoft", "https://microsoft.com/", "Platinum Sponsor of the MariaDB Foundation"}, - {"MariaDB Corporation", "https://mariadb.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"}, - {"Visma", "https://visma.com", "Gold Sponsor of the MariaDB Foundation"}, - {"DBS", "https://dbs.com", "Gold Sponsor of the MariaDB Foundation"}, - {"IBM", "https://www.ibm.com", "Gold Sponsor of the MariaDB Foundation"}, - {"Tencent Games", "http://game.qq.com/", "Gold Sponsor of the MariaDB Foundation"}, - {"Nexedi", "https://www.nexedi.com", "Silver Sponsor of the MariaDB Foundation"}, - {"Acronis", "https://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"}, - {"Verkkokauppa.com", "https://www.verkkokauppa.com", "Bronze Sponsor of the MariaDB Foundation"}, - {"Virtuozzo", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"}, - {"Tencent Game DBA", "http://tencentdba.com/about", "Bronze Sponsor of the MariaDB Foundation"}, - {"Tencent TDSQL", "http://tdsql.org", "Bronze Sponsor of the MariaDB Foundation"}, - {"Percona", "https://www.percona.com/", "Bronze Sponsor of the MariaDB Foundation"}, - - /* Sponsors of important features */ - {"Google", "USA", "Sponsoring encryption, parallel replication and GTID"}, - {"Facebook", "USA", "Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc"}, - - /* Individual contributors, names in historical order, newer first */ - {"Ronald Bradford", "Brisbane, Australia", "EFF contribution for UC2006 Auction"}, - {"Sheeri Kritzer", "Boston, Mass. USA", "EFF contribution for UC2006 Auction"}, - {"Mark Shuttleworth", "London, UK.", "EFF contribution for UC2006 Auction"}, - {NULL, NULL, NULL} -}; - -#endif /* CONTRIBUTORS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/create_options.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/create_options.h deleted file mode 100644 index ce64516..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/create_options.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Copyright (C) 2010 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - Engine defined options of tables/fields/keys in CREATE/ALTER TABLE. -*/ - -#ifndef SQL_CREATE_OPTIONS_INCLUDED -#define SQL_CREATE_OPTIONS_INCLUDED - -#include "sql_class.h" - -enum { ENGINE_OPTION_MAX_LENGTH=32767 }; - -class engine_option_value: public Sql_alloc -{ - public: - LEX_CSTRING name; - LEX_CSTRING value; - engine_option_value *next; ///< parser puts them in a FIFO linked list - bool parsed; ///< to detect unrecognized options - bool quoted_value; ///< option=VAL vs. option='VAL' - - engine_option_value(engine_option_value *src, - engine_option_value **start, engine_option_value **end) : - name(src->name), value(src->value), - next(NULL), parsed(src->parsed), quoted_value(src->quoted_value) - { - link(start, end); - } - engine_option_value(LEX_CSTRING &name_arg, LEX_CSTRING &value_arg, - bool quoted, - engine_option_value **start, engine_option_value **end) : - name(name_arg), value(value_arg), - next(NULL), parsed(false), quoted_value(quoted) - { - link(start, end); - } - engine_option_value(LEX_CSTRING &name_arg, - engine_option_value **start, engine_option_value **end) : - name(name_arg), value(null_clex_str), - next(NULL), parsed(false), quoted_value(false) - { - link(start, end); - } - engine_option_value(LEX_CSTRING &name_arg, ulonglong value_arg, - engine_option_value **start, engine_option_value **end, - MEM_ROOT *root) : - name(name_arg), next(NULL), parsed(false), quoted_value(false) - { - char *str; - if (likely((value.str= str= (char *)alloc_root(root, 22)))) - { - value.length= longlong10_to_str(value_arg, str, 10) - str; - link(start, end); - } - } - static uchar *frm_read(const uchar *buff, const uchar *buff_end, - engine_option_value **start, - engine_option_value **end, MEM_ROOT *root); - void link(engine_option_value **start, engine_option_value **end); - uint frm_length(); - uchar *frm_image(uchar *buff); -}; - -typedef struct st_key KEY; -class Create_field; - -bool resolve_sysvar_table_options(handlerton *hton); -void free_sysvar_table_options(handlerton *hton); -bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share); -bool parse_option_list(THD* thd, handlerton *hton, void *option_struct, - engine_option_value **option_list, - ha_create_table_option *rules, - bool suppress_warning, MEM_ROOT *root); -bool engine_table_options_frm_read(const uchar *buff, size_t length, - TABLE_SHARE *share); -engine_option_value *merge_engine_table_options(engine_option_value *source, - engine_option_value *changes, - MEM_ROOT *root); - -uint engine_table_options_frm_length(engine_option_value *table_option_list, - List &create_fields, - uint keys, KEY *key_info); -uchar *engine_table_options_frm_image(uchar *buff, - engine_option_value *table_option_list, - List &create_fields, - uint keys, KEY *key_info); - -bool engine_options_differ(void *old_struct, void *new_struct, - ha_create_table_option *rules); -bool is_engine_option_known(engine_option_value *opt, - ha_create_table_option *rules); -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/custom_conf.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/custom_conf.h deleted file mode 100644 index 5847b93..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/custom_conf.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2000, 2006 MySQL AB - Use is subject to license terms - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef __MYSQL_CUSTOM_BUILD_CONFIG__ -#define __MYSQL_CUSTOM_BUILD_CONFIG__ - -#define MYSQL_PORT 5002 -#ifdef __WIN__ -#define MYSQL_NAMEDPIPE "SwSqlServer" -#define MYSQL_SERVICENAME "SwSqlServer" -#define KEY_SERVICE_PARAMETERS -"SYSTEM\\CurrentControlSet\\Services\\SwSqlServer\\Parameters" -#endif - -#endif /* __MYSQL_CUSTOM_BUILD_CONFIG__ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/datadict.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/datadict.h deleted file mode 100644 index f4af592..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/datadict.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef DATADICT_INCLUDED -#define DATADICT_INCLUDED -/* Copyright (c) 2010, Oracle and/or its affiliates. - Copyright (c) 2017 MariaDB corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "handler.h" - -/* - Data dictionary API. -*/ - -enum Table_type -{ - TABLE_TYPE_UNKNOWN, - TABLE_TYPE_NORMAL, /* Normal table */ - TABLE_TYPE_SEQUENCE, - TABLE_TYPE_VIEW -}; - -/* - Take extra care when using dd_frm_type() - it only checks the .frm file, - and it won't work for any engine that supports discovery. - - Prefer to use ha_table_exists() instead. - To check whether it's an frm of a view, use dd_frm_is_view(). -*/ - -enum Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name); - -static inline bool dd_frm_is_view(THD *thd, char *path) -{ - return dd_frm_type(thd, path, NULL) == TABLE_TYPE_VIEW; -} - -bool dd_recreate_table(THD *thd, const char *db, const char *table_name); - -#endif // DATADICT_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/debug_sync.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/debug_sync.h deleted file mode 100644 index 3b8aa88..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/debug_sync.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef DEBUG_SYNC_INCLUDED -#define DEBUG_SYNC_INCLUDED - -/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - Declarations for the Debug Sync Facility. See debug_sync.cc for details. -*/ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -class THD; - -#if defined(ENABLED_DEBUG_SYNC) - -/* Command line option --debug-sync-timeout. See mysqld.cc. */ -extern MYSQL_PLUGIN_IMPORT uint opt_debug_sync_timeout; - -/* Default WAIT_FOR timeout if command line option is given without argument. */ -#define DEBUG_SYNC_DEFAULT_WAIT_TIMEOUT 300 - -/* Debug Sync prototypes. See debug_sync.cc. */ -extern int debug_sync_init(void); -extern void debug_sync_end(void); -extern void debug_sync_init_thread(THD *thd); -extern void debug_sync_end_thread(THD *thd); -void debug_sync_reset_thread(THD *thd); -extern bool debug_sync_set_action(THD *thd, const char *action_str, size_t len); -extern bool debug_sync_update(THD *thd, char *val_str, size_t len); -extern uchar *debug_sync_value_ptr(THD *thd); -#else -static inline void debug_sync_init_thread(THD *thd) {} -static inline void debug_sync_end_thread(THD *thd) {} -static inline void debug_sync_reset_thread(THD *thd) {} -static inline bool debug_sync_set_action(THD *, const char *, size_t) -{ return false; } -#endif /* defined(ENABLED_DEBUG_SYNC) */ - -#endif /* DEBUG_SYNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/derived_handler.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/derived_handler.h deleted file mode 100644 index 171165b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/derived_handler.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (c) 2016, 2017 MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef DERIVED_HANDLER_INCLUDED -#define DERIVED_HANDLER_INCLUDED - -#include "mariadb.h" -#include "sql_priv.h" - -class TMP_TABLE_PARAM; - -typedef class st_select_lex_unit SELECT_LEX_UNIT; - -/** - @class derived_handler - - This interface class is to be used for execution of queries that specify - derived table by foreign engines -*/ - -class derived_handler -{ -public: - THD *thd; - handlerton *ht; - - TABLE_LIST *derived; - - /* - Temporary table where all results should be stored in record[0] - The table has a field for every item from the select list of - the specification of derived. - */ - TABLE *table; - - /* The parameters if the temporary table used at its creation */ - TMP_TABLE_PARAM *tmp_table_param; - - SELECT_LEX_UNIT *unit; // Specifies the derived table - - SELECT_LEX *select; // The first select of the specification - - derived_handler(THD *thd_arg, handlerton *ht_arg) - : thd(thd_arg), ht(ht_arg), derived(0),table(0), tmp_table_param(0), - unit(0), select(0) {} - virtual ~derived_handler() {} - - /* - Functions to scan data. All these returns 0 if ok, error code in case - of error - */ - - /* Initialize the process of producing rows of the derived table */ - virtual int init_scan()= 0; - - /* - Put the next produced row of the derived in table->record[0] and return 0. - Return HA_ERR_END_OF_FILE if there are no more rows, return other error - number in case of fatal error. - */ - virtual int next_row()= 0; - - /* End prodicing rows */ - virtual int end_scan()=0; - - /* Report errors */ - virtual void print_error(int error, myf errflag); - - void set_derived(TABLE_LIST *tbl); -}; - -#endif /* DERIVED_HANDLER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/derror.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/derror.h deleted file mode 100644 index 34a71b7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/derror.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef DERROR_INCLUDED -#define DERROR_INCLUDED - -bool init_errmessage(void); -void free_error_messages(); -bool read_texts(const char *file_name, const char *language, - const char ****data); - -#endif /* DERROR_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/des_key_file.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/des_key_file.h deleted file mode 100644 index 847cd76..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/des_key_file.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef DES_KEY_FILE_INCLUDED -#define DES_KEY_FILE_INCLUDED - -#ifdef HAVE_OPENSSL -#include - -#include "violite.h" /* DES_cblock, DES_key_schedule */ - -struct st_des_keyblock -{ - DES_cblock key1, key2, key3; -}; - -struct st_des_keyschedule -{ - DES_key_schedule ks1, ks2, ks3; -}; - -extern struct st_des_keyschedule des_keyschedule[10]; -extern uint des_default_key; - -bool load_des_key_file(const char *file_name); -#endif /* HAVE_OPENSSL */ - -#endif /* DES_KEY_FILE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/discover.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/discover.h deleted file mode 100644 index 1775f5d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/discover.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef DISCOVER_INCLUDED -#define DISCOVER_INCLUDED - -int extension_based_table_discovery(MY_DIR *dirp, const char *ext, - handlerton::discovered_list *tl); - -#ifdef MYSQL_SERVER -int readfrm(const char *name, const uchar **data, size_t *length); -int writefile(const char *path, const char *db, const char *table, - bool tmp_table, const uchar *frmdata, size_t len); - -/* a helper to delete an frm file, given a path w/o .frm extension */ -inline void deletefrm(const char *path) -{ - char frm_name[FN_REFLEN]; - strxmov(frm_name, path, reg_ext, NullS); - mysql_file_delete(key_file_frm, frm_name, MYF(0)); -} - -int ext_table_discovery_simple(MY_DIR *dirp, - handlerton::discovered_list *result); -#endif - -#endif /* DISCOVER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/dur_prop.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/dur_prop.h deleted file mode 100644 index 558ce5a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/dur_prop.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef _my_dur_prop_h -#define _my_dur_prop_h - -enum durability_properties -{ - /* - Preserves the durability properties defined by the engine - */ - HA_REGULAR_DURABILITY= 0, - /* - Ignore the durability properties defined by the engine and - write only in-memory entries. - */ - HA_IGNORE_DURABILITY= 1 -}; - -#endif /* _my_dur_prop_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_data_objects.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_data_objects.h deleted file mode 100644 index c20a8c3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_data_objects.h +++ /dev/null @@ -1,207 +0,0 @@ -#ifndef _EVENT_DATA_OBJECTS_H_ -#define _EVENT_DATA_OBJECTS_H_ -/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @addtogroup Event_Scheduler - @{ - - @file event_data_objects.h -*/ - -#include "event_parse_data.h" -#include "thr_lock.h" /* thr_lock_type */ - -class Field; -class THD; -class Time_zone; -struct TABLE; - -void init_scheduler_psi_keys(void); - -class Event_queue_element_for_exec -{ -public: - Event_queue_element_for_exec(){}; - ~Event_queue_element_for_exec(); - - bool - init(const LEX_CSTRING &dbname, const LEX_CSTRING &name); - - LEX_CSTRING dbname; - LEX_CSTRING name; - bool dropped; - THD *thd; - -private: - /* Prevent use of these */ - Event_queue_element_for_exec(const Event_queue_element_for_exec &); - void operator=(Event_queue_element_for_exec &); -#ifdef HAVE_PSI_INTERFACE -public: - PSI_statement_info* get_psi_info() - { - return & psi_info; - } - - static PSI_statement_info psi_info; -#endif -}; - - -class Event_basic -{ -protected: - MEM_ROOT mem_root; - -public: - - LEX_CSTRING dbname; - LEX_CSTRING name; - LEX_CSTRING definer;// combination of user and host - - Time_zone *time_zone; - - Event_basic(); - virtual ~Event_basic(); - - virtual bool - load_from_row(THD *thd, TABLE *table) = 0; - -protected: - bool - load_string_fields(Field **fields, ...); - - bool - load_time_zone(THD *thd, const LEX_CSTRING *tz_name); -}; - - - -class Event_queue_element : public Event_basic -{ -public: - int on_completion; - int status; - uint32 originator; - - my_time_t last_executed; - my_time_t execute_at; - my_time_t starts; - my_time_t ends; - bool starts_null; - bool ends_null; - bool execute_at_null; - - longlong expression; - interval_type interval; - - bool dropped; - - uint execution_count; - - Event_queue_element(); - virtual ~Event_queue_element(); - - virtual bool - load_from_row(THD *thd, TABLE *table); - - bool - compute_next_execution_time(); - - void - mark_last_executed(THD *thd); -}; - - -class Event_timed : public Event_queue_element -{ - Event_timed(const Event_timed &); /* Prevent use of these */ - void operator=(Event_timed &); - -public: - LEX_CSTRING body; - - LEX_CSTRING definer_user; - LEX_CSTRING definer_host; - - LEX_CSTRING comment; - - ulonglong created; - ulonglong modified; - - sql_mode_t sql_mode; - - class Stored_program_creation_ctx *creation_ctx; - LEX_CSTRING body_utf8; - - Event_timed(); - virtual ~Event_timed(); - - void - init(); - - virtual bool - load_from_row(THD *thd, TABLE *table); - - int - get_create_event(THD *thd, String *buf); -}; - - -class Event_job_data : public Event_basic -{ -public: - LEX_CSTRING body; - LEX_CSTRING definer_user; - LEX_CSTRING definer_host; - - sql_mode_t sql_mode; - - class Stored_program_creation_ctx *creation_ctx; - - Event_job_data(); - - virtual bool - load_from_row(THD *thd, TABLE *table); - - bool - execute(THD *thd, bool drop); -private: - bool - construct_sp_sql(THD *thd, String *sp_sql); - bool - construct_drop_event_sql(THD *thd, String *sp_sql); - - Event_job_data(const Event_job_data &); /* Prevent use of these */ - void operator=(Event_job_data &); -}; - - -/* Compares only the schema part of the identifier */ -bool -event_basic_db_equal(const LEX_CSTRING *db, Event_basic *et); - -/* Compares the whole identifier*/ -bool -event_basic_identifier_equal(const LEX_CSTRING *db, const LEX_CSTRING *name, - Event_basic *b); - -/** - @} (End of group Event_Scheduler) -*/ - -#endif /* _EVENT_DATA_OBJECTS_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_db_repository.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_db_repository.h deleted file mode 100644 index b89a1a1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_db_repository.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef _EVENT_DB_REPOSITORY_H_ -#define _EVENT_DB_REPOSITORY_H_ -/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -/** - @addtogroup Event_Scheduler - @{ - - @file event_db_repository.h - - Data Dictionary related operations of Event Scheduler. - - This is a private header file of Events module. Please do not include it - directly. All public declarations of Events module should be stored in - events.h and event_data_objects.h. -*/ - -enum enum_events_table_field -{ - ET_FIELD_DB = 0, - ET_FIELD_NAME, - ET_FIELD_BODY, - ET_FIELD_DEFINER, - ET_FIELD_EXECUTE_AT, - ET_FIELD_INTERVAL_EXPR, - ET_FIELD_TRANSIENT_INTERVAL, - ET_FIELD_CREATED, - ET_FIELD_MODIFIED, - ET_FIELD_LAST_EXECUTED, - ET_FIELD_STARTS, - ET_FIELD_ENDS, - ET_FIELD_STATUS, - ET_FIELD_ON_COMPLETION, - ET_FIELD_SQL_MODE, - ET_FIELD_COMMENT, - ET_FIELD_ORIGINATOR, - ET_FIELD_TIME_ZONE, - ET_FIELD_CHARACTER_SET_CLIENT, - ET_FIELD_COLLATION_CONNECTION, - ET_FIELD_DB_COLLATION, - ET_FIELD_BODY_UTF8, - ET_FIELD_COUNT /* a cool trick to count the number of fields :) */ -}; - - -int -events_table_index_read_for_db(THD *thd, TABLE *schema_table, - TABLE *event_table); - -int -events_table_scan_all(THD *thd, TABLE *schema_table, TABLE *event_table); - - -class Event_basic; -class Event_parse_data; - -class Event_db_repository -{ -public: - Event_db_repository(){} - - bool - create_event(THD *thd, Event_parse_data *parse_data, - bool *event_already_exists); - bool - update_event(THD *thd, Event_parse_data *parse_data, LEX_CSTRING *new_dbname, - LEX_CSTRING *new_name); - - bool - drop_event(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *name, - bool drop_if_exists); - - void - drop_schema_events(THD *thd, const LEX_CSTRING *schema); - - bool - find_named_event(const LEX_CSTRING *db, const LEX_CSTRING *name, - TABLE *table); - - bool - load_named_event(THD *thd, const LEX_CSTRING *dbname, - const LEX_CSTRING *name, - Event_basic *et); - - static bool - open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table); - - bool - fill_schema_events(THD *thd, TABLE_LIST *tables, const char *db); - - bool - update_timing_fields_for_event(THD *thd, - const LEX_CSTRING *event_db_name, - const LEX_CSTRING *event_name, - my_time_t last_executed, - ulonglong status); -public: - static bool - check_system_tables(THD *thd); -private: - bool - index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, TABLE *event_table, - const char *db); - - bool - table_scan_all_for_i_s(THD *thd, TABLE *schema_table, TABLE *event_table); - -private: - /* Prevent use of these */ - Event_db_repository(const Event_db_repository &); - void operator=(Event_db_repository &); -}; - -/** - @} (End of group Event_Scheduler) -*/ -#endif /* _EVENT_DB_REPOSITORY_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_parse_data.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_parse_data.h deleted file mode 100644 index 4e68295..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_parse_data.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - Copyright (c) 2008, 2011, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _EVENT_PARSE_DATA_H_ -#define _EVENT_PARSE_DATA_H_ - -#include "sql_alloc.h" - -class Item; -class THD; -class sp_name; - -#define EVEX_GET_FIELD_FAILED -2 -#define EVEX_BAD_PARAMS -5 -#define EVEX_MICROSECOND_UNSUP -6 -#define EVEX_MAX_INTERVAL_VALUE 1000000000L - -class Event_parse_data : public Sql_alloc -{ -public: - /* - ENABLED = feature can function normally (is turned on) - SLAVESIDE_DISABLED = feature is turned off on slave - DISABLED = feature is turned off - */ - enum enum_status - { - ENABLED = 1, - DISABLED, - SLAVESIDE_DISABLED - }; - - enum enum_on_completion - { - /* - On CREATE EVENT, DROP is the DEFAULT as per the docs. - On ALTER EVENT, "no change" is the DEFAULT. - */ - ON_COMPLETION_DEFAULT = 0, - ON_COMPLETION_DROP, - ON_COMPLETION_PRESERVE - }; - - int on_completion; - int status; - bool status_changed; - uint32 originator; - /* - do_not_create will be set if STARTS time is in the past and - on_completion == ON_COMPLETION_DROP. - */ - bool do_not_create; - - bool body_changed; - - LEX_CSTRING dbname; - LEX_CSTRING name; - LEX_CSTRING definer;// combination of user and host - LEX_CSTRING comment; - - Item* item_starts; - Item* item_ends; - Item* item_execute_at; - - my_time_t starts; - my_time_t ends; - my_time_t execute_at; - bool starts_null; - bool ends_null; - bool execute_at_null; - - sp_name *identifier; - Item* item_expression; - longlong expression; - interval_type interval; - - static Event_parse_data * - new_instance(THD *thd); - - bool - check_parse_data(THD *thd); - - bool - check_dates(THD *thd, int previous_on_completion); - -private: - - void - init_definer(THD *thd); - - void - init_name(THD *thd, sp_name *spn); - - int - init_execute_at(THD *thd); - - int - init_interval(THD *thd); - - int - init_starts(THD *thd); - - int - init_ends(THD *thd); - - Event_parse_data(); - ~Event_parse_data(); - - void - report_bad_value(const char *item_name, Item *bad_item); - - void - check_if_in_the_past(THD *thd, my_time_t ltime_utc); - - Event_parse_data(const Event_parse_data &); /* Prevent use of these */ - void check_originator_id(THD *thd); - void operator=(Event_parse_data &); -}; -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_queue.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_queue.h deleted file mode 100644 index 2b6a0a5..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_queue.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef _EVENT_QUEUE_H_ -#define _EVENT_QUEUE_H_ -/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - - @addtogroup Event_Scheduler - @{ - - @file event_queue.h - - Queue of events awaiting execution. -*/ - -#ifdef HAVE_PSI_INTERFACE -extern PSI_mutex_key key_LOCK_event_queue; -extern PSI_cond_key key_COND_queue_state; -#endif /* HAVE_PSI_INTERFACE */ - -#include "queues.h" // QUEUE -#include "sql_string.h" /* LEX_CSTRING */ -#include "my_time.h" /* my_time_t, interval_type */ - -class Event_basic; -class Event_queue_element; -class Event_queue_element_for_exec; - -class THD; - -/** - Queue of active events awaiting execution. -*/ - -class Event_queue -{ -public: - Event_queue(); - ~Event_queue(); - - bool - init_queue(THD *thd); - - /* Methods for queue management follow */ - - bool - create_event(THD *thd, Event_queue_element *new_element, - bool *created); - - void - update_event(THD *thd, const LEX_CSTRING *dbname, const LEX_CSTRING *name, - Event_queue_element *new_element); - - void - drop_event(THD *thd, const LEX_CSTRING *dbname, const LEX_CSTRING *name); - - void - drop_schema_events(THD *thd, const LEX_CSTRING *schema); - - void - recalculate_activation_times(THD *thd); - - bool - get_top_for_execution_if_time(THD *thd, - Event_queue_element_for_exec **event_name); - - - void - dump_internal_status(); - -private: - void - empty_queue(); - - void - deinit_queue(); - /* helper functions for working with mutexes & conditionals */ - void - lock_data(const char *func, uint line); - - void - unlock_data(const char *func, uint line); - - void - cond_wait(THD *thd, struct timespec *abstime, const PSI_stage_info *stage, - const char *src_func, const char *src_file, uint src_line); - - void - find_n_remove_event(const LEX_CSTRING *db, const LEX_CSTRING *name); - - - void - drop_matching_events(THD *thd, const LEX_CSTRING *pattern, - bool (*)(const LEX_CSTRING*, Event_basic *)); - - - void - dbug_dump_queue(my_time_t now); - - /* LOCK_event_queue is the mutex which protects the access to the queue. */ - mysql_mutex_t LOCK_event_queue; - mysql_cond_t COND_queue_state; - - /* The sorted queue with the Event_queue_element objects */ - QUEUE queue; - - my_time_t next_activation_at; - - uint mutex_last_locked_at_line; - uint mutex_last_unlocked_at_line; - uint mutex_last_attempted_lock_at_line; - const char* mutex_last_locked_in_func; - const char* mutex_last_unlocked_in_func; - const char* mutex_last_attempted_lock_in_func; - bool mutex_queue_data_locked; - bool mutex_queue_data_attempting_lock; - bool waiting_on_cond; -}; -/** - @} (End of group Event_Scheduler) -*/ - -#endif /* _EVENT_QUEUE_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_scheduler.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_scheduler.h deleted file mode 100644 index 59ac923..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/event_scheduler.h +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef _EVENT_SCHEDULER_H_ -#define _EVENT_SCHEDULER_H_ -/* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @addtogroup Event_Scheduler - @{ -*/ -/** - @file - - Declarations of the scheduler thread class - and related functionality. - - This file is internal to Event_Scheduler module. Please do not - include it directly. All public declarations of Event_Scheduler - module are in events.h and event_data_objects.h. -*/ - - -class Event_queue; -class Event_job_data; -class Event_db_repository; -class Event_queue_element_for_exec; -class Events; -class THD; - -void -pre_init_event_thread(THD* thd); - -bool -post_init_event_thread(THD* thd); - -void -deinit_event_thread(THD *thd); - - -class Event_worker_thread -{ -public: - static void - init(Event_db_repository *db_repository_arg) - { - db_repository= db_repository_arg; - } - - void - run(THD *thd, Event_queue_element_for_exec *event); - -private: - void - print_warnings(THD *thd, Event_job_data *et); - - static Event_db_repository *db_repository; -}; - - -class Event_scheduler -{ -public: - Event_scheduler(Event_queue *event_queue_arg); - ~Event_scheduler(); - - - /* State changing methods follow */ - - bool - start(int *err_no); - - bool - stop(); - - /* - Need to be public because has to be called from the function - passed to pthread_create. - */ - bool - run(THD *thd); - - - /* Information retrieving methods follow */ - bool - is_running(); - - void - dump_internal_status(); - -private: - uint - workers_count(); - - /* helper functions */ - bool - execute_top(Event_queue_element_for_exec *event_name); - - /* helper functions for working with mutexes & conditionals */ - void - lock_data(const char *func, uint line); - - void - unlock_data(const char *func, uint line); - - void - cond_wait(THD *thd, struct timespec *abstime, const PSI_stage_info *stage, - const char *src_func, const char *src_file, uint src_line); - - mysql_mutex_t LOCK_scheduler_state; - - enum enum_state - { - INITIALIZED = 0, - RUNNING, - STOPPING - }; - - /* This is the current status of the life-cycle of the scheduler. */ - enum enum_state state; - - THD *scheduler_thd; - - mysql_cond_t COND_state; - - Event_queue *queue; - - uint mutex_last_locked_at_line; - uint mutex_last_unlocked_at_line; - const char* mutex_last_locked_in_func; - const char* mutex_last_unlocked_in_func; - bool mutex_scheduler_data_locked; - bool waiting_on_cond; - - ulonglong started_events; - -private: - /* Prevent use of these */ - Event_scheduler(const Event_scheduler &); - void operator=(Event_scheduler &); -}; - -/** - @} (End of group Event_Scheduler) -*/ - -#endif /* _EVENT_SCHEDULER_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/events.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/events.h deleted file mode 100644 index 2fb13d7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/events.h +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef _EVENT_H_ -#define _EVENT_H_ -/* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @defgroup Event_Scheduler Event Scheduler - @ingroup Runtime_Environment - @{ - - @file events.h - - A public interface of Events_Scheduler module. -*/ - -#ifdef HAVE_PSI_INTERFACE -extern PSI_mutex_key key_event_scheduler_LOCK_scheduler_state; -extern PSI_cond_key key_event_scheduler_COND_state; -extern PSI_thread_key key_thread_event_scheduler, key_thread_event_worker; -#endif /* HAVE_PSI_INTERFACE */ - -extern PSI_memory_key key_memory_event_basic_root; - -/* Always defined, for SHOW PROCESSLIST. */ -extern PSI_stage_info stage_waiting_on_empty_queue; -extern PSI_stage_info stage_waiting_for_next_activation; -extern PSI_stage_info stage_waiting_for_scheduler_to_stop; - -#include "sql_string.h" /* LEX_CSTRING */ -#include "my_time.h" /* interval_type */ - -class Event_db_repository; -class Event_parse_data; -class Event_queue; -class Event_scheduler; -struct TABLE_LIST; -class THD; -typedef class Item COND; - -int -sortcmp_lex_string(const LEX_CSTRING *s, const LEX_CSTRING *t, - const CHARSET_INFO *cs); - -/** - @brief A facade to the functionality of the Event Scheduler. - - Every public operation against the scheduler has to be executed via the - interface provided by a static method of this class. No instance of this - class is ever created and it has no non-static data members. - - The life cycle of the Events module is the following: - - At server start up: - init_mutexes() -> init() - When the server is running: - create_event(), drop_event(), start_or_stop_event_scheduler(), etc - At shutdown: - deinit(), destroy_mutexes(). - - The peculiar initialization and shutdown cycle is an adaptation to the - outside server startup/shutdown framework and mimics the rest of MySQL - subsystems (ACL, time zone tables, etc). -*/ - -class Events -{ -public: - /* - the following block is to support --event-scheduler command line option - and the @@global.event_scheduler SQL variable. - See sys_var.cc - */ - enum enum_opt_event_scheduler { EVENTS_OFF, EVENTS_ON, EVENTS_DISABLED, - EVENTS_ORIGINAL }; - /* Protected using LOCK_global_system_variables only. */ - static ulong opt_event_scheduler, startup_state; - static ulong inited; - static bool check_if_system_tables_error(); - static bool start(int *err_no); - static bool stop(); - -public: - /* A hack needed for Event_queue_element */ - static Event_db_repository * - get_db_repository() { return db_repository; } - - static bool init(THD *thd, bool opt_noacl); - - static void - deinit(); - - static void - init_mutexes(); - - static void - destroy_mutexes(); - - static bool - create_event(THD *thd, Event_parse_data *parse_data); - - static bool - update_event(THD *thd, Event_parse_data *parse_data, - LEX_CSTRING *new_dbname, LEX_CSTRING *new_name); - - static bool - drop_event(THD *thd, const LEX_CSTRING *dbname, const LEX_CSTRING *name, - bool if_exists); - - static void - drop_schema_events(THD *thd, const char *db); - - static bool - show_create_event(THD *thd, const LEX_CSTRING *dbname, - const LEX_CSTRING *name); - - /* Needed for both SHOW CREATE EVENT and INFORMATION_SCHEMA */ - static int - reconstruct_interval_expression(String *buf, interval_type interval, - longlong expression); - - static int - fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */); - - static void - dump_internal_status(); - - static void set_original_state(ulong startup_state_org) - { - startup_state= startup_state_org; - } - -private: - - static bool - load_events_from_db(THD *thd); - -private: - static Event_queue *event_queue; - static Event_scheduler *scheduler; - static Event_db_repository *db_repository; - -private: - /* Prevent use of these */ - Events(const Events &); - void operator=(Events &); -}; - -/** - @} (end of group Event Scheduler) -*/ - -#endif /* _EVENT_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/field.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/field.h deleted file mode 100644 index be4d279..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/field.h +++ /dev/null @@ -1,5828 +0,0 @@ -#ifndef FIELD_INCLUDED -#define FIELD_INCLUDED -/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Because of the function make_new_field() all field classes that have static - variables must declare the size_of() member function. -*/ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "mysqld.h" /* system_charset_info */ -#include "table.h" /* TABLE */ -#include "sql_string.h" /* String */ -#include "my_decimal.h" /* my_decimal */ -#include "sql_error.h" /* Sql_condition */ -#include "compat56.h" -#include "sql_type.h" /* Type_std_attributes */ -#include "field_comp.h" - -class Send_field; -class Copy_field; -class Protocol; -class Protocol_text; -class Create_field; -class Relay_log_info; -class Field; -class Column_statistics; -class Column_statistics_collected; -class Item_func; -class Item_bool_func; -class Item_equal; -class Virtual_tmp_table; -class Qualified_column_ident; -class Table_ident; -class SEL_ARG; -class RANGE_OPT_PARAM; -struct KEY_PART; -struct SORT_FIELD; -struct SORT_FIELD_ATTR; - -enum enum_check_fields -{ - CHECK_FIELD_IGNORE, - CHECK_FIELD_EXPRESSION, - CHECK_FIELD_WARN, - CHECK_FIELD_ERROR_FOR_NULL, -}; - - -enum enum_conv_type -{ - CONV_TYPE_PRECISE, - CONV_TYPE_VARIANT, - CONV_TYPE_SUBSET_TO_SUPERSET, - CONV_TYPE_SUPERSET_TO_SUBSET, - CONV_TYPE_IMPOSSIBLE -}; - - -class Conv_param -{ - uint16 m_table_def_flags; -public: - Conv_param(uint16 table_def_flags) - :m_table_def_flags(table_def_flags) - { } - uint16 table_def_flags() const { return m_table_def_flags; } -}; - - -class Conv_source: public Type_handler_hybrid_field_type -{ - uint16 m_metadata; - CHARSET_INFO *m_cs; -public: - Conv_source(const Type_handler *h, uint16 metadata, CHARSET_INFO *cs) - :Type_handler_hybrid_field_type(h), - m_metadata(metadata), - m_cs(cs) - { - DBUG_ASSERT(cs); - } - uint16 metadata() const { return m_metadata; } - uint mbmaxlen() const { return m_cs->mbmaxlen; } -}; - - -/* - Common declarations for Field and Item -*/ -class Value_source -{ -protected: - - // Parameters for warning and note generation - class Warn_filter - { - bool m_want_warning_edom; - bool m_want_note_truncated_spaces; - public: - Warn_filter(bool want_warning_edom, bool want_note_truncated_spaces) : - m_want_warning_edom(want_warning_edom), - m_want_note_truncated_spaces(want_note_truncated_spaces) - { } - Warn_filter(const THD *thd); - bool want_warning_edom() const - { return m_want_warning_edom; } - bool want_note_truncated_spaces() const - { return m_want_note_truncated_spaces; } - }; - class Warn_filter_all: public Warn_filter - { - public: - Warn_filter_all() :Warn_filter(true, true) { } - }; - - class Converter_double_to_longlong - { - protected: - bool m_error; - longlong m_result; - public: - Converter_double_to_longlong(double nr, bool unsigned_flag); - longlong result() const { return m_result; } - bool error() const { return m_error; } - void push_warning(THD *thd, double nr, bool unsigned_flag); - }; - class Converter_double_to_longlong_with_warn: - public Converter_double_to_longlong - { - public: - Converter_double_to_longlong_with_warn(THD *thd, double nr, - bool unsigned_flag) - :Converter_double_to_longlong(nr, unsigned_flag) - { - if (m_error) - push_warning(thd, nr, unsigned_flag); - } - Converter_double_to_longlong_with_warn(double nr, bool unsigned_flag) - :Converter_double_to_longlong(nr, unsigned_flag) - { - if (m_error) - push_warning(current_thd, nr, unsigned_flag); - } - }; - - // String-to-number converters - class Converter_string_to_number - { - protected: - char *m_end_of_num; // Where the low-level conversion routine stopped - int m_error; // The error code returned by the low-level routine - bool m_edom; // If EDOM-alike error happened during conversion - /** - Check string-to-number conversion and produce a warning if - - could not convert any digits (EDOM-alike error) - - found garbage at the end of the string - - found extra spaces at the end (a note) - See also Field_num::check_edom_and_truncation() for a similar function. - - @param thd - the thread that will be used to generate warnings. - Can be NULL (which means current_thd will be used - if a warning is really necessary). - @param type - name of the data type - (e.g. "INTEGER", "DECIMAL", "DOUBLE") - @param cs - character set of the original string - @param str - the original string - @param end - the end of the string - @param allow_notes - tells if trailing space notes should be displayed - or suppressed. - - Unlike Field_num::check_edom_and_truncation(), this function does not - distinguish between EDOM and truncation and reports the same warning for - both cases. Perhaps we should eventually print different warnings, - to make the explicit CAST work closer to the implicit cast in - Field_xxx::store(). - */ - void check_edom_and_truncation(THD *thd, Warn_filter filter, - const char *type, - CHARSET_INFO *cs, - const char *str, - size_t length) const; - public: - int error() const { return m_error; } - }; - - class Converter_strntod: public Converter_string_to_number - { - double m_result; - public: - Converter_strntod(CHARSET_INFO *cs, const char *str, size_t length) - { - m_result= cs->strntod((char *) str, length, &m_end_of_num, &m_error); - // strntod() does not set an error if the input string was empty - m_edom= m_error !=0 || str == m_end_of_num; - } - double result() const { return m_result; } - }; - - class Converter_string_to_longlong: public Converter_string_to_number - { - protected: - longlong m_result; - public: - longlong result() const { return m_result; } - }; - - class Converter_strntoll: public Converter_string_to_longlong - { - public: - Converter_strntoll(CHARSET_INFO *cs, const char *str, size_t length) - { - m_result= cs->strntoll(str, length, 10, &m_end_of_num, &m_error); - /* - All non-zero errors means EDOM error. - strntoll() does not set an error if the input string was empty. - Check it here. - Notice the different with the same condition in Converter_strntoll10. - */ - m_edom= m_error != 0 || str == m_end_of_num; - } - }; - - class Converter_strtoll10: public Converter_string_to_longlong - { - public: - Converter_strtoll10(CHARSET_INFO *cs, const char *str, size_t length) - { - m_end_of_num= (char *) str + length; - m_result= cs->strtoll10(str, &m_end_of_num, &m_error); - /* - Negative error means "good negative number". - Only a positive m_error value means a real error. - strtoll10() sets error to MY_ERRNO_EDOM in case of an empty string, - so we don't have to additionally catch empty strings here. - */ - m_edom= m_error > 0; - } - }; - - class Converter_str2my_decimal: public Converter_string_to_number - { - public: - Converter_str2my_decimal(uint mask, - CHARSET_INFO *cs, const char *str, size_t length, - my_decimal *buf) - { - DBUG_ASSERT(length < UINT_MAX32); - m_error= str2my_decimal(mask, str, length, cs, - buf, (const char **) &m_end_of_num); - // E_DEC_TRUNCATED means a very minor truncation: '1e-100' -> 0 - m_edom= m_error && m_error != E_DEC_TRUNCATED; - } - }; - - - // String-to-number converters with automatic warning generation - class Converter_strntod_with_warn: public Converter_strntod - { - public: - Converter_strntod_with_warn(THD *thd, Warn_filter filter, - CHARSET_INFO *cs, - const char *str, size_t length) - :Converter_strntod(cs, str, length) - { - check_edom_and_truncation(thd, filter, "DOUBLE", cs, str, length); - } - }; - - class Converter_strntoll_with_warn: public Converter_strntoll - { - public: - Converter_strntoll_with_warn(THD *thd, Warn_filter filter, - CHARSET_INFO *cs, - const char *str, size_t length) - :Converter_strntoll(cs, str, length) - { - check_edom_and_truncation(thd, filter, "INTEGER", cs, str, length); - } - }; - - class Converter_strtoll10_with_warn: public Converter_strtoll10 - { - public: - Converter_strtoll10_with_warn(THD *thd, Warn_filter filter, - CHARSET_INFO *cs, - const char *str, size_t length) - :Converter_strtoll10(cs, str, length) - { - check_edom_and_truncation(thd, filter, "INTEGER", cs, str, length); - } - }; - - class Converter_str2my_decimal_with_warn: public Converter_str2my_decimal - { - public: - Converter_str2my_decimal_with_warn(THD *thd, Warn_filter filter, - uint mask, CHARSET_INFO *cs, - const char *str, size_t length, - my_decimal *buf) - :Converter_str2my_decimal(mask, cs, str, length, buf) - { - check_edom_and_truncation(thd, filter, "DECIMAL", cs, str, length); - } - }; - - - // String-to-number conversion methods for the old code compatibility - longlong longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr, - const char *end) const - { - /* - TODO: Give error if we wanted a signed integer and we got an unsigned - one - - Notice, longlong_from_string_with_check() honors thd->no_error, because - it's used to handle queries like this: - SELECT COUNT(@@basedir); - and is called when Item_func_get_system_var::update_null_value() - suppresses warnings and then calls val_int(). - The other methods {double|decimal}_from_string_with_check() ignore - thd->no_errors, because they are not used for update_null_value() - and they always allow all kind of warnings. - */ - THD *thd= current_thd; - return Converter_strtoll10_with_warn(thd, Warn_filter(thd), - cs, cptr, end - cptr).result(); - } - - double double_from_string_with_check(CHARSET_INFO *cs, const char *cptr, - const char *end) const - { - return Converter_strntod_with_warn(NULL, Warn_filter_all(), - cs, cptr, end - cptr).result(); - } - my_decimal *decimal_from_string_with_check(my_decimal *decimal_value, - CHARSET_INFO *cs, - const char *cptr, - const char *end) - { - Converter_str2my_decimal_with_warn(NULL, Warn_filter_all(), - E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM, - cs, cptr, end - cptr, decimal_value); - return decimal_value; - } - - longlong longlong_from_hex_hybrid(const char *str, size_t length) - { - const char *end= str + length; - const char *ptr= end - MY_MIN(length, sizeof(longlong)); - ulonglong value= 0; - for ( ; ptr != end ; ptr++) - value= (value << 8) + (ulonglong) (uchar) *ptr; - return (longlong) value; - } - - longlong longlong_from_string_with_check(const String *str) const - { - return longlong_from_string_with_check(str->charset(), - str->ptr(), str->end()); - } - double double_from_string_with_check(const String *str) const - { - return double_from_string_with_check(str->charset(), - str->ptr(), str->end()); - } - my_decimal *decimal_from_string_with_check(my_decimal *decimal_value, - const String *str) - { - return decimal_from_string_with_check(decimal_value, str->charset(), - str->ptr(), str->end()); - } - // End of String-to-number conversion methods - -public: - /* - The enumeration Subst_constraint is currently used only in implementations - of the virtual function subst_argument_checker. - */ - enum Subst_constraint - { - ANY_SUBST, /* Any substitution for a field is allowed */ - IDENTITY_SUBST /* Substitution for a field is allowed if any two - different values of the field type are not equal */ - }; - /* - Item context attributes. - Comparison functions pass their attributes to propagate_equal_fields(). - For example, for string comparison, the collation of the comparison - operation is important inside propagate_equal_fields(). - */ - class Context - { - /* - Which type of propagation is allowed: - - ANY_SUBST (loose equality, according to the collation), or - - IDENTITY_SUBST (strict binary equality). - */ - Subst_constraint m_subst_constraint; - /* - Comparison type. - Important only when ANY_SUBSTS. - */ - const Type_handler *m_compare_handler; - /* - Collation of the comparison operation. - Important only when ANY_SUBST. - */ - CHARSET_INFO *m_compare_collation; - public: - Context(Subst_constraint subst, const Type_handler *h, CHARSET_INFO *cs) - :m_subst_constraint(subst), - m_compare_handler(h), - m_compare_collation(cs) - { DBUG_ASSERT(h == h->type_handler_for_comparison()); } - Subst_constraint subst_constraint() const { return m_subst_constraint; } - const Type_handler *compare_type_handler() const - { - DBUG_ASSERT(m_subst_constraint == ANY_SUBST); - return m_compare_handler; - } - CHARSET_INFO *compare_collation() const - { - DBUG_ASSERT(m_subst_constraint == ANY_SUBST); - return m_compare_collation; - } - }; - class Context_identity: public Context - { // Use this to request only exact value, no invariants. - public: - Context_identity() - :Context(IDENTITY_SUBST, &type_handler_long_blob, &my_charset_bin) { } - }; - class Context_boolean: public Context - { // Use this when an item is [a part of] a boolean expression - public: - Context_boolean() - :Context(ANY_SUBST, &type_handler_slonglong, &my_charset_bin) { } - }; -}; - - -#define STORAGE_TYPE_MASK 7 -#define COLUMN_FORMAT_MASK 7 -#define COLUMN_FORMAT_SHIFT 3 - -/* The length of the header part for each virtual column in the .frm file */ -#define FRM_VCOL_OLD_HEADER_SIZE(b) (3 + MY_TEST(b)) -#define FRM_VCOL_NEW_BASE_SIZE 16 -#define FRM_VCOL_NEW_HEADER_SIZE 6 - -class Count_distinct_field; - -struct ha_field_option_struct; - -struct st_cache_field; -int field_conv(Field *to,Field *from); -int truncate_double(double *nr, uint field_length, uint dec, - bool unsigned_flag, double max_value); - -inline uint get_enum_pack_length(int elements) -{ - return elements < 256 ? 1 : 2; -} - -inline uint get_set_pack_length(int elements) -{ - uint len= (elements + 7) / 8; - return len > 4 ? 8 : len; -} - - -/** - Tests if field type is temporal and has date part, - i.e. represents DATE, DATETIME or TIMESTAMP types in SQL. - - @param type Field type, as returned by field->type(). - @retval true If field type is temporal type with date part. - @retval false If field type is not temporal type with date part. -*/ -inline bool is_temporal_type_with_date(enum_field_types type) -{ - switch (type) - { - case MYSQL_TYPE_DATE: - case MYSQL_TYPE_DATETIME: - case MYSQL_TYPE_TIMESTAMP: - return true; - case MYSQL_TYPE_DATETIME2: - case MYSQL_TYPE_TIMESTAMP2: - DBUG_ASSERT(0); // field->real_type() should not get to here. - return false; - default: - return false; - } -} - - -enum enum_vcol_info_type -{ - VCOL_GENERATED_VIRTUAL, VCOL_GENERATED_STORED, - VCOL_DEFAULT, VCOL_CHECK_FIELD, VCOL_CHECK_TABLE, - /* Additional types should be added here */ - /* Following is the highest value last */ - VCOL_TYPE_NONE = 127 // Since the 0 value is already in use -}; - -static inline const char *vcol_type_name(enum_vcol_info_type type) -{ - switch (type) - { - case VCOL_GENERATED_VIRTUAL: - case VCOL_GENERATED_STORED: - return "GENERATED ALWAYS AS"; - case VCOL_DEFAULT: - return "DEFAULT"; - case VCOL_CHECK_FIELD: - case VCOL_CHECK_TABLE: - return "CHECK"; - case VCOL_TYPE_NONE: - return "UNTYPED"; - } - return 0; -} - -/* - Flags for Virtual_column_info. If none is set, the expression must be - a constant with no side-effects, so it's calculated at CREATE TABLE time, - stored in table->record[2], and not recalculated for every statement. -*/ -#define VCOL_FIELD_REF 1 -#define VCOL_NON_DETERMINISTIC 2 -#define VCOL_SESSION_FUNC 4 /* uses session data, e.g. USER or DAYNAME */ -#define VCOL_TIME_FUNC 8 -#define VCOL_AUTO_INC 16 -#define VCOL_IMPOSSIBLE 32 -#define VCOL_NOT_VIRTUAL 64 /* Function can't be virtual */ -#define VCOL_CHECK_CONSTRAINT_IF_NOT_EXISTS 128 - -#define VCOL_NOT_STRICTLY_DETERMINISTIC \ - (VCOL_NON_DETERMINISTIC | VCOL_TIME_FUNC | VCOL_SESSION_FUNC) - -/* - Virtual_column_info is the class to contain additional - characteristics that is specific for a virtual/computed - field such as: - - the defining expression that is evaluated to compute the value - of the field - - whether the field is to be stored in the database - - whether the field is used in a partitioning expression -*/ - -class Virtual_column_info: public Sql_alloc, - private Type_handler_hybrid_field_type -{ -private: - enum_vcol_info_type vcol_type; /* Virtual column expression type */ - /* - The following data is only updated by the parser and read - when a Create_field object is created/initialized. - */ - /* Flag indicating that the field used in a partitioning expression */ - bool in_partitioning_expr; - -public: - /* Flag indicating that the field is physically stored in the database */ - bool stored_in_db; - bool utf8; /* Already in utf8 */ - bool automatic_name; - Item *expr; - Lex_ident name; /* Name of constraint */ - /* see VCOL_* (VCOL_FIELD_REF, ...) */ - uint flags; - - Virtual_column_info() - :Type_handler_hybrid_field_type(&type_handler_null), - vcol_type((enum_vcol_info_type)VCOL_TYPE_NONE), - in_partitioning_expr(FALSE), stored_in_db(FALSE), - utf8(TRUE), automatic_name(FALSE), expr(NULL), flags(0) - { - name.str= NULL; - name.length= 0; - }; - Virtual_column_info* clone(THD *thd); - ~Virtual_column_info() {}; - enum_vcol_info_type get_vcol_type() const - { - return vcol_type; - } - void set_vcol_type(enum_vcol_info_type v_type) - { - vcol_type= v_type; - } - const char *get_vcol_type_name() const - { - DBUG_ASSERT(vcol_type != VCOL_TYPE_NONE); - return vcol_type_name(vcol_type); - } - void set_handler(const Type_handler *handler) - { - /* Calling this function can only be done once. */ - DBUG_ASSERT(type_handler() == &type_handler_null); - Type_handler_hybrid_field_type::set_handler(handler); - } - bool is_stored() const - { - return stored_in_db; - } - void set_stored_in_db_flag(bool stored) - { - stored_in_db= stored; - } - bool is_in_partitioning_expr() const - { - return in_partitioning_expr; - } - void mark_as_in_partitioning_expr() - { - in_partitioning_expr= TRUE; - } - inline bool is_equal(const Virtual_column_info* vcol) const; - inline void print(String*); -}; - -class Binlog_type_info -{ -public: - enum binlog_sign_t - { - SIGN_SIGNED, - SIGN_UNSIGNED, - SIGN_NOT_APPLICABLE // for non-numeric types - }; - uchar m_type_code; // according to Field::binlog_type() - /** - Retrieve the field metadata for fields. - */ - uint16 m_metadata; - uint8 m_metadata_size; - binlog_sign_t m_signedness; - CHARSET_INFO *m_cs; // NULL if not relevant - TYPELIB *m_enum_typelib; // NULL if not relevant - TYPELIB *m_set_typelib; // NULL if not relevant - uchar m_geom_type; // Non-geometry fields can return 0 - Binlog_type_info(uchar type_code, - uint16 metadata, - uint8 metadata_size) - :m_type_code(type_code), - m_metadata(metadata), - m_metadata_size(metadata_size), - m_signedness(SIGN_NOT_APPLICABLE), - m_cs(NULL), - m_enum_typelib(NULL), - m_set_typelib(NULL), - m_geom_type(0) - {}; - Binlog_type_info(uchar type_code, uint16 metadata, - uint8 metadata_size, - binlog_sign_t signedness) - :m_type_code(type_code), - m_metadata(metadata), - m_metadata_size(metadata_size), - m_signedness(signedness), - m_cs(NULL), - m_enum_typelib(NULL), - m_set_typelib(NULL), - m_geom_type(0) - {}; - Binlog_type_info(uchar type_code, uint16 metadata, - uint8 metadata_size, - CHARSET_INFO *cs) - :m_type_code(type_code), - m_metadata(metadata), - m_metadata_size(metadata_size), - m_signedness(SIGN_NOT_APPLICABLE), - m_cs(cs), - m_enum_typelib(NULL), - m_set_typelib(NULL), - m_geom_type(0) - {}; - Binlog_type_info(uchar type_code, uint16 metadata, - uint8 metadata_size, - CHARSET_INFO *cs, - TYPELIB *t_enum, TYPELIB *t_set) - :m_type_code(type_code), - m_metadata(metadata), - m_metadata_size(metadata_size), - m_signedness(SIGN_NOT_APPLICABLE), - m_cs(cs), - m_enum_typelib(t_enum), - m_set_typelib(t_set), - m_geom_type(0) - {}; - Binlog_type_info(uchar type_code, uint16 metadata, - uint8 metadata_size, CHARSET_INFO *cs, - uchar geom_type) - :m_type_code(type_code), - m_metadata(metadata), - m_metadata_size(metadata_size), - m_signedness(SIGN_NOT_APPLICABLE), - m_cs(cs), - m_enum_typelib(NULL), - m_set_typelib(NULL), - m_geom_type(geom_type) - {}; - static void *operator new(size_t size, MEM_ROOT *mem_root) throw () - { return alloc_root(mem_root, size); } -}; - - -class Binlog_type_info_fixed_string: public Binlog_type_info -{ -public: - Binlog_type_info_fixed_string(uchar type_code, - uint32 octet_length, - CHARSET_INFO *cs); -}; - - -class Field: public Value_source -{ - Field(const Item &); /* Prevent use of these */ - void operator=(Field &); -protected: - int save_in_field_str(Field *to) - { - StringBuffer result(charset()); - val_str(&result); - return to->store(result.ptr(), result.length(), charset()); - } - void error_generated_column_function_is_not_allowed(THD *thd, bool error) - const; - static void do_field_eq(Copy_field *copy); - static void do_field_int(Copy_field *copy); - static void do_field_real(Copy_field *copy); - static void do_field_string(Copy_field *copy); - static void do_field_date(Copy_field *copy); - static void do_field_temporal(Copy_field *copy, date_mode_t fuzzydate); - static void do_field_datetime(Copy_field *copy); - static void do_field_timestamp(Copy_field *copy); - static void do_field_decimal(Copy_field *copy); -public: - static void *operator new(size_t size, MEM_ROOT *mem_root) throw () - { return alloc_root(mem_root, size); } - static void *operator new(size_t size) throw () - { - DBUG_ASSERT(size < UINT_MAX32); - return thd_alloc(current_thd, (uint) size); - } - static void operator delete(void *ptr_arg, size_t size) { TRASH_FREE(ptr_arg, size); } - static void operator delete(void *ptr, MEM_ROOT *mem_root) - { DBUG_ASSERT(0); } - - bool marked_for_read() const; - bool marked_for_write_or_computed() const; - - /** - Used by System Versioning. - */ - virtual void set_max() - { DBUG_ASSERT(0); } - virtual bool is_max() - { DBUG_ASSERT(0); return false; } - - uchar *ptr; // Position to field in record - - field_visibility_t invisible; - /** - Byte where the @c NULL bit is stored inside a record. If this Field is a - @c NOT @c NULL field, this member is @c NULL. - */ - uchar *null_ptr; - /* - Note that you can use table->in_use as replacement for current_thd member - only inside of val_*() and store() members (e.g. you can't use it in cons) - */ - TABLE *table; // Pointer for table - TABLE *orig_table; // Pointer to original table - const char * const *table_name; // Pointer to alias in TABLE - LEX_CSTRING field_name; - LEX_CSTRING comment; - /** reference to the list of options or NULL */ - engine_option_value *option_list; - ha_field_option_struct *option_struct; /* structure with parsed options */ - /* Field is part of the following keys */ - key_map key_start, part_of_key, part_of_key_not_clustered; - - /* - Bitmap of indexes that have records ordered by col1, ... this_field, ... - - For example, INDEX (col(prefix_n)) is not present in col.part_of_sortkey. - */ - key_map part_of_sortkey; - /* - We use three additional unireg types for TIMESTAMP to overcome limitation - of current binary format of .frm file. We'd like to be able to support - NOW() as default and on update value for such fields but unable to hold - this info anywhere except unireg_check field. This issue will be resolved - in more clean way with transition to new text based .frm format. - See also comment for Field_timestamp::Field_timestamp(). - */ - enum utype { - NONE=0, - NEXT_NUMBER=15, // AUTO_INCREMENT - TIMESTAMP_OLD_FIELD=18, // TIMESTAMP created before 4.1.3 - TIMESTAMP_DN_FIELD=21, // TIMESTAMP DEFAULT NOW() - TIMESTAMP_UN_FIELD=22, // TIMESTAMP ON UPDATE NOW() - TIMESTAMP_DNUN_FIELD=23, // TIMESTAMP DEFAULT NOW() ON UPDATE NOW() - TMYSQL_COMPRESSED= 24, // Compatibility with TMySQL - }; - enum imagetype { itRAW, itMBR}; - - utype unireg_check; - uint32 field_length; // Length of field - uint32 flags; - uint16 field_index; // field number in fields array - uchar null_bit; // Bit used to test null bit - /** - If true, this field was created in create_tmp_field_from_item from a NULL - value. This means that the type of the field is just a guess, and the type - may be freely coerced to another type. - - @see create_tmp_field_from_item - @see Item_type_holder::get_real_type - - */ - bool is_created_from_null_item; - - /* - Selectivity of the range condition over this field. - When calculating this selectivity a range predicate - is taken into account only if: - - it is extracted from the WHERE clause - - it depends only on the table the field belongs to - */ - double cond_selectivity; - - /* - The next field in the class of equal fields at the top AND level - of the WHERE clause - */ - Field *next_equal_field; - - /* - This structure is used for statistical data on the column - that has been read from the statistical table column_stat - */ - Column_statistics *read_stats; - /* - This structure is used for statistical data on the column that - is collected by the function collect_statistics_for_table - */ - Column_statistics_collected *collected_stats; - - /* - This is additional data provided for any computed(virtual) field, - default function or check constraint. - In particular it includes a pointer to the item by which this field - can be computed from other fields. - */ - Virtual_column_info *vcol_info, *check_constraint, *default_value; - - Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, - uchar null_bit_arg, utype unireg_check_arg, - const LEX_CSTRING *field_name_arg); - virtual ~Field() {} - - virtual Type_numeric_attributes type_numeric_attributes() const - { - return Type_numeric_attributes(field_length, decimals(), is_unsigned()); - } - Type_std_attributes type_std_attributes() const - { - return Type_std_attributes(type_numeric_attributes(), dtcollation()); - } - - bool is_unsigned() const { return flags & UNSIGNED_FLAG; } - - /** - Convenience definition of a copy function returned by - Field::get_copy_func() - */ - typedef void Copy_func(Copy_field*); - virtual Copy_func *get_copy_func(const Field *from) const= 0; - virtual Copy_func *get_copy_func_to(const Field *to) const - { - return to->get_copy_func(this); - } - /* Store functions returns 1 on overflow and -1 on fatal error */ - virtual int store_field(Field *from) { return from->save_in_field(this); } - virtual int save_in_field(Field *to)= 0; - /** - Check if it is possible just copy the value - of the field 'from' to the field 'this', e.g. for - INSERT INTO t1 (field1) SELECT field2 FROM t2; - @param from - The field to copy from - @retval true - it is possible to just copy value of 'from' to 'this' - @retval false - conversion is needed - */ - virtual bool memcpy_field_possible(const Field *from) const= 0; - virtual bool make_empty_rec_store_default_value(THD *thd, Item *item); - virtual void make_empty_rec_reset(THD *thd) - { - reset(); - } - virtual int store(const char *to, size_t length,CHARSET_INFO *cs)=0; - /* - This is used by engines like CSV and Federated to signal the field - that the data is going to be in text (rather than binary) representation, - even if cs points to &my_charset_bin. - - If a Field distinguishes between text and binary formats (e.g. INET6), - we cannot call store(str,length,&my_charset_bin), - to avoid "field" mis-interpreting the data format as binary. - */ - virtual int store_text(const char *to, size_t length, CHARSET_INFO *cs) - { - return store(to, length, cs); - } - virtual int store_binary(const char *to, size_t length) - { - return store(to, length, &my_charset_bin); - } - virtual int store_hex_hybrid(const char *str, size_t length); - virtual int store(double nr)=0; - virtual int store(longlong nr, bool unsigned_val)=0; - virtual int store_decimal(const my_decimal *d)=0; - virtual int store_time_dec(const MYSQL_TIME *ltime, uint dec); - virtual int store_timestamp_dec(const timeval &ts, uint dec); - int store_timestamp(my_time_t timestamp, ulong sec_part) - { - return store_timestamp_dec(Timeval(timestamp, sec_part), - TIME_SECOND_PART_DIGITS); - } - /** - Store a value represented in native format - */ - virtual int store_native(const Native &value) - { - DBUG_ASSERT(0); - reset(); - return 0; - } - int store_time(const MYSQL_TIME *ltime) - { return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); } - int store(const char *to, size_t length, CHARSET_INFO *cs, - enum_check_fields check_level); - int store_text(const char *to, size_t length, CHARSET_INFO *cs, - enum_check_fields check_level); - int store(const LEX_STRING *ls, CHARSET_INFO *cs) - { - DBUG_ASSERT(ls->length < UINT_MAX32); - return store(ls->str, (uint) ls->length, cs); - } - int store(const LEX_CSTRING *ls, CHARSET_INFO *cs) - { - DBUG_ASSERT(ls->length < UINT_MAX32); - return store(ls->str, (uint) ls->length, cs); - } - int store(const LEX_CSTRING &ls, CHARSET_INFO *cs) - { - DBUG_ASSERT(ls.length < UINT_MAX32); - return store(ls.str, (uint) ls.length, cs); - } - - /* - @brief - Store minimum/maximum value of a column in the statistics table. - @param - field statistical table field - str value buffer - */ - virtual int store_to_statistical_minmax_field(Field *field, String *str); - - /* - @brief - Store minimum/maximum value of a column from the statistical table. - @param - field statistical table field - str value buffer - */ - virtual int store_from_statistical_minmax_field(Field *field, String *str); - -#ifdef HAVE_valgrind - /** - Mark unused memory in the field as defined. Mainly used to ensure - that if we write full field to disk (for example in - Count_distinct_field::add(), we don't write unitalized data to - disk which would confuse valgrind or MSAN. - */ - virtual void mark_unused_memory_as_defined() {} -#else - void mark_unused_memory_as_defined() {} -#endif - - virtual double val_real()=0; - virtual longlong val_int()=0; - /* - Get ulonglong representation. - Negative values are truncated to 0. - */ - virtual ulonglong val_uint(void) - { - longlong nr= val_int(); - return nr < 0 ? 0 : (ulonglong) nr; - } - virtual bool val_bool()= 0; - virtual my_decimal *val_decimal(my_decimal *)=0; - inline String *val_str(String *str) { return val_str(str, str); } - /* - val_str(buf1, buf2) gets two buffers and should use them as follows: - if it needs a temp buffer to convert result to string - use buf1 - example Field_tiny::val_str() - if the value exists as a string already - use buf2 - example Field_string::val_str() - consequently, buf2 may be created as 'String buf;' - no memory - will be allocated for it. buf1 will be allocated to hold a - value if it's too small. Using allocated buffer for buf2 may result in - an unnecessary free (and later, may be an alloc). - This trickery is used to decrease a number of malloc calls. - */ - virtual String *val_str(String*,String *)=0; - virtual bool val_native(Native *to) - { - DBUG_ASSERT(!is_null()); - return to->copy((const char *) ptr, pack_length()); - } - String *val_int_as_str(String *val_buffer, bool unsigned_flag); - /* - Return the field value as a LEX_CSTRING, without padding to full length - (MODE_PAD_CHAR_TO_FULL_LENGTH is temporarily suppressed during the call). - - In case of an empty value, to[0] is assigned to empty_clex_string, - memory is not allocated. - In case of a non-empty value, the memory is allocated on mem_root. - In case of a memory allocation failure, to[0] is assigned to {NULL,0}. - - @param [IN] mem_root store non-empty values here - @param [OUT to return the string here - @retval false (success) - @retval true (EOM) - */ - bool val_str_nopad(MEM_ROOT *mem_root, LEX_CSTRING *to); - fast_field_copier get_fast_field_copier(const Field *from); - /* - str_needs_quotes() returns TRUE if the value returned by val_str() needs - to be quoted when used in constructing an SQL query. - */ - virtual bool str_needs_quotes() const { return false; } - const Type_handler *type_handler_for_comparison() const - { - return type_handler()->type_handler_for_comparison(); - } - Item_result result_type () const - { - return type_handler()->result_type(); - } - Item_result cmp_type () const - { - return type_handler()->cmp_type(); - } - virtual bool eq(Field *field) - { - return (ptr == field->ptr && null_ptr == field->null_ptr && - null_bit == field->null_bit && field->type() == type()); - } - virtual bool eq_def(const Field *field) const; - - /* - pack_length() returns size (in bytes) used to store field data in memory - (i.e. it returns the maximum size of the field in a row of the table, - which is located in RAM). - */ - virtual uint32 pack_length() const { return (uint32) field_length; } - - /* - pack_length_in_rec() returns size (in bytes) used to store field data on - storage (i.e. it returns the maximal size of the field in a row of the - table, which is located on disk). - */ - virtual uint32 pack_length_in_rec() const { return pack_length(); } - virtual bool compatible_field_size(uint metadata, const Relay_log_info *rli, - uint16 mflags, int *order) const; - virtual uint pack_length_from_metadata(uint field_metadata) const - { - DBUG_ENTER("Field::pack_length_from_metadata"); - DBUG_RETURN(field_metadata); - } - virtual uint row_pack_length() const { return 0; } - - /* - data_length() return the "real size" of the data in memory. - */ - virtual uint32 data_length() { return pack_length(); } - virtual uint32 sort_length() const { return pack_length(); } - - /* - sort_suffix_length() return the length bytes needed to store the length - for binary charset - */ - virtual uint32 sort_suffix_length() const { return 0; } - - /* - Get the number bytes occupied by the value in the field. - CHAR values are stripped of trailing spaces. - Flexible values are stripped of their length. - */ - virtual uint32 value_length() - { - uint len; - if (!zero_pack() && - (type() == MYSQL_TYPE_STRING && - (len= pack_length()) >= 4 && len < 256)) - { - uchar *str, *end; - for (str= ptr, end= str+len; end > str && end[-1] == ' '; end--) {} - len=(uint) (end-str); - return len; - } - return data_length(); - } - - /** - Get the maximum size of the data in packed format. - - @return Maximum data length of the field when packed using the - Field::pack() function. - */ - virtual uint32 max_data_length() const { - return pack_length(); - }; - - virtual int reset() { bzero(ptr,pack_length()); return 0; } - virtual void reset_fields() {} - const uchar *ptr_in_record(const uchar *record) const - { - my_ptrdiff_t l_offset= (my_ptrdiff_t) (record - table->record[0]); - return ptr + l_offset; - } - virtual int set_default(); - - bool has_update_default_function() const - { - return flags & ON_UPDATE_NOW_FLAG; - } - bool has_default_now_unireg_check() const - { - return unireg_check == TIMESTAMP_DN_FIELD - || unireg_check == TIMESTAMP_DNUN_FIELD; - } - - /* - Mark the field as having a value supplied by the client, thus it should - not be auto-updated. - */ - void set_has_explicit_value() - { - bitmap_set_bit(&table->has_value_set, field_index); - } - bool has_explicit_value() - { - return bitmap_is_set(&table->has_value_set, field_index); - } - void clear_has_explicit_value() - { - bitmap_clear_bit(&table->has_value_set, field_index); - } - - virtual my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const - { DBUG_ASSERT(0); return 0; } - my_time_t get_timestamp(ulong *sec_part) const - { - return get_timestamp(ptr, sec_part); - } - - virtual bool binary() const { return 1; } - virtual bool zero_pack() const { return 1; } - virtual enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; } - virtual uint16 key_part_flag() const { return 0; } - virtual uint16 key_part_length_bytes() const { return 0; } - virtual uint32 key_length() const { return pack_length(); } - virtual const Type_handler *type_handler() const= 0; - virtual enum_field_types type() const - { - return type_handler()->field_type(); - } - virtual enum_field_types real_type() const - { - return type_handler()->real_field_type(); - } - virtual enum_field_types binlog_type() const - { - /* - Binlog stores field->type() as type code by default. For example, - it puts MYSQL_TYPE_STRING in case of CHAR, VARCHAR, SET and ENUM, - with extra data type details put into metadata. - - Binlog behaviour slightly differs between various MySQL and MariaDB - versions for the temporal data types TIME, DATETIME and TIMESTAMP. - - MySQL prior to 5.6 uses MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME - and MYSQL_TYPE_TIMESTAMP type codes in binlog and stores no - additional metadata. - - MariaDB-5.3 implements new versions for TIME, DATATIME, TIMESTAMP - with fractional second precision, but uses the old format for the - types TIME(0), DATETIME(0), TIMESTAMP(0), and it still stores - MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME and MYSQL_TYPE_TIMESTAMP in binlog, - with no additional metadata. - So row-based replication between temporal data types of - different precision is not possible in MariaDB. - - MySQL-5.6 also implements a new version of TIME, DATETIME, TIMESTAMP - which support fractional second precision 0..6, and use the new - format even for the types TIME(0), DATETIME(0), TIMESTAMP(0). - For these new data types, MySQL-5.6 stores new type codes - MYSQL_TYPE_TIME2, MYSQL_TYPE_DATETIME2, MYSQL_TYPE_TIMESTAMP2 in binlog, - with fractional precision 0..6 put into metadata. - This makes it in theory possible to do row-based replication between - columns of different fractional precision (e.g. from TIME(1) on master - to TIME(6) on slave). However, it's not currently fully implemented yet. - MySQL-5.6 can only do row-based replication from the old types - TIME, DATETIME, TIMESTAMP (represented by MYSQL_TYPE_TIME, - MYSQL_TYPE_DATETIME and MYSQL_TYPE_TIMESTAMP type codes in binlog) - to the new corresponding types TIME(0), DATETIME(0), TIMESTAMP(0). - - Note: MariaDB starting from the version 10.0 understands the new - MySQL-5.6 type codes MYSQL_TYPE_TIME2, MYSQL_TYPE_DATETIME2, - MYSQL_TYPE_TIMESTAMP2. When started over MySQL-5.6 tables both on - master and on slave, MariaDB-10.0 can also do row-based replication - from the old types TIME, DATETIME, TIMESTAMP to the new MySQL-5.6 - types TIME(0), DATETIME(0), TIMESTAMP(0). - - Note: perhaps binlog should eventually be modified to store - real_type() instead of type() for all column types. - */ - return type(); - } - virtual Binlog_type_info binlog_type_info() const - { - DBUG_ASSERT(Field::type() == binlog_type()); - return Binlog_type_info(Field::type(), 0, 0); - } - virtual en_fieldtype tmp_engine_column_type(bool use_packed_rows) const - { - return FIELD_NORMAL; - } - /* - Conversion type for from the source to the current field. - */ - virtual enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) - const= 0; - enum_conv_type rpl_conv_type_from_same_data_type(uint16 metadata, - const Relay_log_info *rli, - const Conv_param ¶m) - const; - inline int cmp(const uchar *str) const { return cmp(ptr,str); } - /* - The following method is used for comparing prefix keys. - Currently it's only used in partitioning. - */ - virtual int cmp_prefix(const uchar *a, const uchar *b, - size_t prefix_len) const - { return cmp(a, b); } - virtual int cmp(const uchar *,const uchar *) const=0; - virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const - { return memcmp(a,b,pack_length()); } - virtual int cmp_offset(my_ptrdiff_t row_offset) - { return cmp(ptr,ptr+row_offset); } - virtual int cmp_binary_offset(uint row_offset) - { return cmp_binary(ptr, ptr+row_offset); }; - virtual int key_cmp(const uchar *a,const uchar *b) const - { return cmp(a, b); } - virtual int key_cmp(const uchar *str, uint length) const - { return cmp(ptr,str); } - /* - Update the value m of the 'min_val' field with the current value v - of this field if force_update is set to TRUE or if v < m. - Return TRUE if the value has been updated. - */ - virtual bool update_min(Field *min_val, bool force_update) - { - bool update_fl= force_update || cmp(ptr, min_val->ptr) < 0; - if (update_fl) - { - min_val->set_notnull(); - memcpy(min_val->ptr, ptr, pack_length()); - } - return update_fl; - } - /* - Update the value m of the 'max_val' field with the current value v - of this field if force_update is set to TRUE or if v > m. - Return TRUE if the value has been updated. - */ - virtual bool update_max(Field *max_val, bool force_update) - { - bool update_fl= force_update || cmp(ptr, max_val->ptr) > 0; - if (update_fl) - { - max_val->set_notnull(); - memcpy(max_val->ptr, ptr, pack_length()); - } - return update_fl; - } - virtual void store_field_value(uchar *val, uint len) - { - memcpy(ptr, val, len); - } - virtual uint decimals() const { return 0; } - virtual Information_schema_numeric_attributes - information_schema_numeric_attributes() const - { - return Information_schema_numeric_attributes(); - } - virtual Information_schema_character_attributes - information_schema_character_attributes() const - { - return Information_schema_character_attributes(); - } - virtual void update_data_type_statistics(Data_type_statistics *st) const - { } - /* - Caller beware: sql_type can change str.Ptr, so check - ptr() to see if it changed if you are using your own buffer - in str and restore it with set() if needed - */ - virtual void sql_type(String &str) const =0; - virtual void sql_rpl_type(String *str) const { sql_type(*str); } - virtual uint size_of() const =0; // For new field - inline bool is_null(my_ptrdiff_t row_offset= 0) const - { - /* - The table may have been marked as containing only NULL values - for all fields if it is a NULL-complemented row of an OUTER JOIN - or if the query is an implicitly grouped query (has aggregate - functions but no GROUP BY clause) with no qualifying rows. If - this is the case (in which TABLE::null_row is true), the field - is considered to be NULL. - - Note that if a table->null_row is set then also all null_bits are - set for the row. - - In the case of the 'result_field' for GROUP BY, table->null_row might - refer to the *next* row in the table (when the algorithm is: read the - next row, see if any of group column values have changed, send the - result - grouped - row to the client if yes). So, table->null_row might - be wrong, but such a result_field is always nullable (that's defined by - original_field->maybe_null()) and we trust its null bit. - */ - return null_ptr ? null_ptr[row_offset] & null_bit : table->null_row; - } - inline bool is_real_null(my_ptrdiff_t row_offset= 0) const - { return null_ptr && (null_ptr[row_offset] & null_bit); } - inline bool is_null_in_record(const uchar *record) const - { - if (maybe_null_in_table()) - return record[(uint) (null_ptr - table->record[0])] & null_bit; - return 0; - } - inline void set_null(my_ptrdiff_t row_offset= 0) - { if (null_ptr) null_ptr[row_offset]|= null_bit; } - inline void set_notnull(my_ptrdiff_t row_offset= 0) - { if (null_ptr) null_ptr[row_offset]&= (uchar) ~null_bit; } - inline bool maybe_null(void) const - { return null_ptr != 0 || table->maybe_null; } - // Set to NULL on LOAD DATA or LOAD XML - virtual bool load_data_set_null(THD *thd); - // Reset when a LOAD DATA file ended unexpectedly - virtual bool load_data_set_no_data(THD *thd, bool fixed_format); - void load_data_set_value(const char *pos, uint length, CHARSET_INFO *cs); - - /* @return true if this field is NULL-able (even if temporarily) */ - inline bool real_maybe_null() const { return null_ptr != 0; } - uint null_offset(const uchar *record) const - { return (uint) (null_ptr - record); } - /* - For a NULL-able field (that can actually store a NULL value in a table) - null_ptr points to the "null bitmap" in the table->record[0] header. For - NOT NULL fields it is either 0 or points outside table->record[0] into the - table->triggers->extra_null_bitmap (so that the field can store a NULL - value temporarily, only in memory) - */ - bool maybe_null_in_table() const - { return null_ptr >= table->record[0] && null_ptr <= ptr; } - - uint null_offset() const - { return null_offset(table->record[0]); } - void set_null_ptr(uchar *p_null_ptr, uint p_null_bit) - { - null_ptr= p_null_ptr; - null_bit= static_cast(p_null_bit); - } - - bool stored_in_db() const { return !vcol_info || vcol_info->stored_in_db; } - bool check_vcol_sql_mode_dependency(THD *, vcol_init_mode mode) const; - - virtual sql_mode_t value_depends_on_sql_mode() const - { - return 0; - } - virtual sql_mode_t conversion_depends_on_sql_mode(THD *thd, - Item *expr) const - { - return (sql_mode_t) 0; - } - virtual sql_mode_t can_handle_sql_mode_dependency_on_store() const - { - return 0; - } - - inline THD *get_thd() const - { return likely(table) ? table->in_use : current_thd; } - - enum { - LAST_NULL_BYTE_UNDEF= 0 - }; - - /* - Find the position of the last null byte for the field. - - SYNOPSIS - last_null_byte() - - DESCRIPTION - Return a pointer to the last byte of the null bytes where the - field conceptually is placed. - - RETURN VALUE - The position of the last null byte relative to the beginning of - the record. If the field does not use any bits of the null - bytes, the value 0 (LAST_NULL_BYTE_UNDEF) is returned. - */ - size_t last_null_byte() const { - size_t bytes= do_last_null_byte(); - DBUG_PRINT("debug", ("last_null_byte() ==> %ld", (long) bytes)); - DBUG_ASSERT(bytes <= table->s->null_bytes); - return bytes; - } - - /* - Create mem-comparable sort key part for a sort key - */ - void make_sort_key_part(uchar *buff, uint length); - - /* - create a compact sort key which can be compared with a comparison - function. They are called packed sort keys - */ - virtual uint make_packed_sort_key_part(uchar *buff, - const SORT_FIELD_ATTR *sort_field); - - virtual void make_send_field(Send_field *); - - /* - Some implementations actually may write up to 8 bytes regardless of what - size was requested. This is due to the minimum value of the system variable - max_sort_length. - */ - - virtual void sort_string(uchar *buff,uint length)=0; - virtual bool optimize_range(uint idx, uint part) const; - virtual void free() {} - virtual Field *make_new_field(MEM_ROOT *root, TABLE *new_table, - bool keep_type); - virtual Field *new_key_field(MEM_ROOT *root, TABLE *new_table, - uchar *new_ptr, uint32 length, - uchar *new_null_ptr, uint new_null_bit); - Field *create_tmp_field(MEM_ROOT *root, TABLE *new_table, - bool maybe_null_arg); - Field *create_tmp_field(MEM_ROOT *root, TABLE *new_table) - { - return create_tmp_field(root, new_table, maybe_null()); - } - Field *clone(MEM_ROOT *mem_root, TABLE *new_table); - Field *clone(MEM_ROOT *mem_root, TABLE *new_table, my_ptrdiff_t diff); - inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg) - { - ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg; - } - inline void move_field(uchar *ptr_arg) { ptr=ptr_arg; } - inline uchar *record_ptr() // record[0] or wherever the field was moved to - { - my_ptrdiff_t offset= table->s->field[field_index]->ptr - table->s->default_values; - return ptr - offset; - } - virtual void move_field_offset(my_ptrdiff_t ptr_diff) - { - ptr=ADD_TO_PTR(ptr,ptr_diff, uchar*); - if (null_ptr) - null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*); - } - void get_image(uchar *buff, uint length, CHARSET_INFO *cs) const - { get_image(buff, length, ptr, cs); } - virtual void get_image(uchar *buff, uint length, - const uchar *ptr_arg, CHARSET_INFO *cs) const - { memcpy(buff,ptr_arg,length); } - virtual void set_image(const uchar *buff,uint length, CHARSET_INFO *cs) - { memcpy(ptr,buff,length); } - - - /* - Copy a field part into an output buffer. - - SYNOPSIS - Field::get_key_image() - buff [out] output buffer - length output buffer size - type itMBR for geometry blobs, otherwise itRAW - - DESCRIPTION - This function makes a copy of field part of size equal to or - less than "length" parameter value. - For fields of string types (CHAR, VARCHAR, TEXT) the rest of buffer - is padded by zero byte. - - NOTES - For variable length character fields (i.e. UTF-8) the "length" - parameter means a number of output buffer bytes as if all field - characters have maximal possible size (mbmaxlen). In the other words, - "length" parameter is a number of characters multiplied by - field_charset->mbmaxlen. - - RETURN - Number of copied bytes (excluding padded zero bytes -- see above). - */ - - uint get_key_image(uchar *buff, uint length, imagetype type_arg) const - { return get_key_image(buff, length, ptr, type_arg); } - virtual uint get_key_image(uchar *buff, uint length, const uchar *ptr_arg, imagetype type_arg) const - { - get_image(buff, length, ptr_arg, &my_charset_bin); - return length; - } - virtual void set_key_image(const uchar *buff,uint length) - { set_image(buff,length, &my_charset_bin); } - inline longlong val_int_offset(uint row_offset) - { - ptr+=row_offset; - longlong tmp=val_int(); - ptr-=row_offset; - return tmp; - } - inline longlong val_int(const uchar *new_ptr) - { - uchar *old_ptr= ptr; - longlong return_value; - ptr= (uchar*) new_ptr; - return_value= val_int(); - ptr= old_ptr; - return return_value; - } - inline String *val_str(String *str, const uchar *new_ptr) - { - uchar *old_ptr= ptr; - ptr= (uchar*) new_ptr; - val_str(str); - ptr= old_ptr; - return str; - } - virtual bool send(Protocol *protocol); - - virtual uchar *pack(uchar *to, const uchar *from, uint max_length); - /** - @overload Field::pack(uchar*, const uchar*, uint, bool) - */ - uchar *pack(uchar *to, const uchar *from) - { - DBUG_ENTER("Field::pack"); - uchar *result= this->pack(to, from, UINT_MAX); - DBUG_RETURN(result); - } - - virtual const uchar *unpack(uchar* to, const uchar *from, - const uchar *from_end, uint param_data=0); - - virtual uint packed_col_length(const uchar *to, uint length) - { return length;} - virtual uint max_packed_col_length(uint max_length) - { return max_length;} - virtual bool is_packable() const { return false; } - - uint offset(const uchar *record) const - { - return (uint) (ptr - record); - } - void copy_from_tmp(int offset); - uint fill_cache_field(struct st_cache_field *copy); - virtual bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate); - virtual longlong val_datetime_packed(THD *thd); - virtual longlong val_time_packed(THD *thd); - virtual const TYPELIB *get_typelib() const { return NULL; } - virtual CHARSET_INFO *charset() const= 0; - virtual const DTCollation &dtcollation() const= 0; - virtual CHARSET_INFO *charset_for_protocol(void) const - { return binary() ? &my_charset_bin : charset(); } - virtual CHARSET_INFO *sort_charset(void) const { return charset(); } - virtual bool has_charset(void) const { return FALSE; } - virtual int set_time() { return 1; } - bool set_warning(Sql_condition::enum_warning_level, unsigned int code, - int cuted_increment, ulong current_row=0) const; - virtual void print_key_value(String *out, uint32 length); - void print_key_part_value(String *out, const uchar *key, uint32 length); - void print_key_value_binary(String *out, const uchar* key, uint32 length); -protected: - bool set_warning(unsigned int code, int cuted_increment) const - { - return set_warning(Sql_condition::WARN_LEVEL_WARN, code, cuted_increment); - } - bool set_note(unsigned int code, int cuted_increment) const - { - return set_warning(Sql_condition::WARN_LEVEL_NOTE, code, cuted_increment); - } - void set_datetime_warning(Sql_condition::enum_warning_level, uint code, - const ErrConv *str, const char *typestr, - int cuted_increment) const; - void set_datetime_warning(uint code, - const ErrConv *str, const char *typestr, - int cuted_increment) const - { - set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, code, str, typestr, - cuted_increment); - } - void set_warning_truncated_wrong_value(const char *type, const char *value); - inline bool check_overflow(int op_result) - { - return (op_result == E_DEC_OVERFLOW); - } - int warn_if_overflow(int op_result); - Copy_func *get_identical_copy_func() const; - bool can_optimize_scalar_range(const RANGE_OPT_PARAM *param, - const KEY_PART *key_part, - const Item_bool_func *cond, - scalar_comparison_op op, - const Item *value) const; - uchar *make_key_image(MEM_ROOT *mem_root, const KEY_PART *key_part); - SEL_ARG *get_mm_leaf_int(RANGE_OPT_PARAM *param, KEY_PART *key_part, - const Item_bool_func *cond, - scalar_comparison_op op, Item *value, - bool unsigned_field); - /* - Make a leaf tree for the cases when the value was stored - to the field exactly, without any truncation, rounding or adjustments. - For example, if we stored an INT value into an INT column, - and value->save_in_field_no_warnings() returned 0, - we know that the value was stored exactly. - */ - SEL_ARG *stored_field_make_mm_leaf_exact(RANGE_OPT_PARAM *param, - KEY_PART *key_part, - scalar_comparison_op op, - Item *value); - /* - Make a leaf tree for the cases when we don't know if - the value was stored to the field without any data loss, - or was modified to a smaller or a greater value. - Used for the data types whose methods Field::store*() - silently adjust the value. This is the most typical case. - */ - SEL_ARG *stored_field_make_mm_leaf(RANGE_OPT_PARAM *param, - KEY_PART *key_part, - scalar_comparison_op op, Item *value); - /* - Make a leaf tree when an INT value was stored into a field of INT type, - and some truncation happened. Tries to adjust the range search condition - when possible, e.g. "tinytint < 300" -> "tinyint <= 127". - Can also return SEL_ARG_IMPOSSIBLE(), and NULL (not sargable). - */ - SEL_ARG *stored_field_make_mm_leaf_bounded_int(RANGE_OPT_PARAM *param, - KEY_PART *key_part, - scalar_comparison_op op, - Item *value, - bool unsigned_field); - /* - Make a leaf tree when some truncation happened during - value->save_in_field_no_warning(this), and we cannot yet adjust the range - search condition for the current combination of the field and the value - data types. - Returns SEL_ARG_IMPOSSIBLE() for "=" and "<=>". - Returns NULL (not sargable) for other comparison operations. - */ - SEL_ARG *stored_field_make_mm_leaf_truncated(RANGE_OPT_PARAM *prm, - scalar_comparison_op, - Item *value); -public: - void set_table_name(String *alias) - { - table_name= &alias->Ptr; - } - void init(TABLE *table_arg) - { - orig_table= table= table_arg; - set_table_name(&table_arg->alias); - } - virtual void init_for_tmp_table(Field *org_field, TABLE *new_table) - { - init(new_table); - orig_table= org_field->orig_table; - vcol_info= 0; - cond_selectivity= 1.0; - next_equal_field= NULL; - option_list= NULL; - option_struct= NULL; - if (org_field->type() == MYSQL_TYPE_VAR_STRING || - org_field->type() == MYSQL_TYPE_VARCHAR) - new_table->s->db_create_options|= HA_OPTION_PACK_RECORD; - } - void init_for_make_new_field(TABLE *new_table_arg, TABLE *orig_table_arg) - { - init(new_table_arg); - /* - Normally orig_table is different from table only if field was - created via ::make_new_field. Here we alter the type of field, - so ::make_new_field is not applicable. But we still need to - preserve the original field metadata for the client-server - protocol. - */ - orig_table= orig_table_arg; - } - - /* maximum possible display length */ - virtual uint32 max_display_length() const= 0; - /** - Whether a field being created has the samle type. - Used by the ALTER TABLE - */ - virtual bool is_equal(const Column_definition &new_field) const= 0; - // Used as double dispatch pattern: calls virtual method of handler - virtual bool - can_be_converted_by_engine(const Column_definition &new_type) const - { - return false; - } - /* convert decimal to longlong with overflow check */ - longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag, - int *err); - /* - Maximum number of bytes in character representation. - - For string types it is equal to the field capacity, in bytes. - - For non-string types it represents the longest possible string length - after conversion to string. - */ - virtual uint32 character_octet_length() const - { - return field_length; - } - /* The max. number of characters */ - virtual uint32 char_length() const - { - return field_length / charset()->mbmaxlen; - } - - ha_storage_media field_storage_type() const - { - return (ha_storage_media) - ((flags >> FIELD_FLAGS_STORAGE_MEDIA) & 3); - } - - void set_storage_type(ha_storage_media storage_type_arg) - { - DBUG_ASSERT(field_storage_type() == HA_SM_DEFAULT); - flags |= static_cast(storage_type_arg) << - FIELD_FLAGS_STORAGE_MEDIA; - } - - column_format_type column_format() const - { - return (column_format_type) - ((flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3); - } - - void set_column_format(column_format_type column_format_arg) - { - DBUG_ASSERT(column_format() == COLUMN_FORMAT_TYPE_DEFAULT); - flags |= static_cast(column_format_arg) << - FIELD_FLAGS_COLUMN_FORMAT; - } - - bool vers_sys_field() const - { - return flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG); - } - - bool vers_update_unversioned() const - { - return flags & VERS_UPDATE_UNVERSIONED_FLAG; - } - - /* - Validate a non-null field value stored in the given record - according to the current thread settings, e.g. sql_mode. - @param thd - the thread - @param record - the record to check in - */ - virtual bool validate_value_in_record(THD *thd, const uchar *record) const - { return false; } - bool validate_value_in_record_with_warn(THD *thd, const uchar *record); - key_map get_possible_keys(); - - /* Hash value */ - virtual void hash(ulong *nr, ulong *nr2); - - /** - Get the upper limit of the MySQL integral and floating-point type. - - @return maximum allowed value for the field - */ - virtual ulonglong get_max_int_value() const - { - DBUG_ASSERT(false); - return 0ULL; - } - -/** - Checks whether a string field is part of write_set. - - @return - FALSE - If field is not char/varchar/.... - - If field is char/varchar/.. and is not part of write set. - TRUE - If field is char/varchar/.. and is part of write set. -*/ - virtual bool is_varchar_and_in_write_set() const { return FALSE; } - - /* Check whether the field can be used as a join attribute in hash join */ - virtual bool hash_join_is_possible() { return TRUE; } - virtual bool eq_cmp_as_binary() { return TRUE; } - - /* Position of the field value within the interval of [min, max] */ - virtual double pos_in_interval(Field *min, Field *max) - { - return (double) 0.5; - } - - /* - Check if comparison between the field and an item unambiguously - identifies a distinct field value. - - Example1: SELECT * FROM t1 WHERE int_column=10; - This example returns distinct integer value of 10. - - Example2: SELECT * FROM t1 WHERE varchar_column=DATE'2001-01-01' - This example returns non-distinct values. - Comparison as DATE will return '2001-01-01' and '2001-01-01x', - but these two values are not equal to each other as VARCHARs. - See also the function with the same name in sql_select.cc. - */ - virtual bool test_if_equality_guarantees_uniqueness(const Item *const_item) - const; - virtual bool can_be_substituted_to_equal_item(const Context &ctx, - const Item_equal *item); - virtual Item *get_equal_const_item(THD *thd, const Context &ctx, - Item *const_item) - { - return const_item; - } - virtual bool can_optimize_keypart_ref(const Item_bool_func *cond, - const Item *item) const; - virtual bool can_optimize_hash_join(const Item_bool_func *cond, - const Item *item) const - { - return can_optimize_keypart_ref(cond, item); - } - virtual bool can_optimize_group_min_max(const Item_bool_func *cond, - const Item *const_item) const; - /** - Test if Field can use range optimizer for a standard comparison operation: - <=, <, =, <=>, >, >= - Note, this method does not cover spatial operations. - */ - virtual bool can_optimize_range(const Item_bool_func *cond, - const Item *item, - bool is_eq_func) const; - - virtual SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part, - const Item_bool_func *cond, - scalar_comparison_op op, Item *value)= 0; - - bool can_optimize_outer_join_table_elimination(const Item_bool_func *cond, - const Item *item) const - { - // Exactly the same rules with REF access - return can_optimize_keypart_ref(cond, item); - } - - bool save_in_field_default_value(bool view_eror_processing); - bool save_in_field_ignore_value(bool view_error_processing); - - /* Mark field in read map. Updates also virtual fields */ - void register_field_in_read_map(); - - virtual Compression_method *compression_method() const { return 0; } - - virtual Virtual_tmp_table **virtual_tmp_table_addr() - { - return NULL; - } - virtual bool sp_prepare_and_store_item(THD *thd, Item **value); - - friend int cre_myisam(char * name, TABLE *form, uint options, - ulonglong auto_increment_value); - friend class Copy_field; - friend class Item_avg_field; - friend class Item_std_field; - friend class Item_sum_num; - friend class Item_sum_sum; - friend class Item_sum_count; - friend class Item_sum_avg; - friend class Item_sum_std; - friend class Item_sum_min; - friend class Item_sum_max; - friend class Item_func_group_concat; - -private: - /* - Primitive for implementing last_null_byte(). - - SYNOPSIS - do_last_null_byte() - - DESCRIPTION - Primitive for the implementation of the last_null_byte() - function. This represents the inheritance interface and can be - overridden by subclasses. - */ - virtual size_t do_last_null_byte() const; - -protected: - uchar *pack_int(uchar *to, const uchar *from, size_t size) - { - memcpy(to, from, size); - return to + size; - } - - const uchar *unpack_int(uchar* to, const uchar *from, - const uchar *from_end, size_t size) - { - if (from + size > from_end) - return 0; - memcpy(to, from, size); - return from + size; - } - - uchar *pack_int16(uchar *to, const uchar *from) - { return pack_int(to, from, 2); } - const uchar *unpack_int16(uchar* to, const uchar *from, const uchar *from_end) - { return unpack_int(to, from, from_end, 2); } - uchar *pack_int24(uchar *to, const uchar *from) - { return pack_int(to, from, 3); } - const uchar *unpack_int24(uchar* to, const uchar *from, const uchar *from_end) - { return unpack_int(to, from, from_end, 3); } - uchar *pack_int32(uchar *to, const uchar *from) - { return pack_int(to, from, 4); } - const uchar *unpack_int32(uchar* to, const uchar *from, const uchar *from_end) - { return unpack_int(to, from, from_end, 4); } - uchar *pack_int64(uchar* to, const uchar *from) - { return pack_int(to, from, 8); } - const uchar *unpack_int64(uchar* to, const uchar *from, const uchar *from_end) - { return unpack_int(to, from, from_end, 8); } - - double pos_in_interval_val_real(Field *min, Field *max); - double pos_in_interval_val_str(Field *min, Field *max, uint data_offset); -}; - - -class Field_num :public Field { -protected: - int check_edom_and_important_data_truncation(const char *type, bool edom, - CHARSET_INFO *cs, - const char *str, size_t length, - const char *end_of_num); - int check_edom_and_truncation(const char *type, bool edom, - CHARSET_INFO *cs, - const char *str, size_t length, - const char *end_of_num); - int check_int(CHARSET_INFO *cs, const char *str, size_t length, - const char *int_end, int error) - { - return check_edom_and_truncation("integer", - error == MY_ERRNO_EDOM || str == int_end, - cs, str, length, int_end); - } - bool get_int(CHARSET_INFO *cs, const char *from, size_t len, - longlong *rnd, ulonglong unsigned_max, - longlong signed_min, longlong signed_max); - void prepend_zeros(String *value) const; - Item *get_equal_zerofill_const_item(THD *thd, const Context &ctx, - Item *const_item); - Binlog_type_info::binlog_sign_t binlog_signedness() const - { - return (flags & UNSIGNED_FLAG) ? Binlog_type_info::SIGN_UNSIGNED : - Binlog_type_info::SIGN_SIGNED; - } - bool send_numeric_zerofill_str(Protocol_text *protocol, - protocol_send_type_t send_type); - -public: - const uint8 dec; - bool zerofill,unsigned_flag; // Purify cannot handle bit fields - Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - uint8 dec_arg, bool zero_arg, bool unsigned_arg); - CHARSET_INFO *charset() const override - { - return DTCollation_numeric::singleton().collation; - } - const DTCollation &dtcollation() const override - { - return DTCollation_numeric::singleton(); - } - sql_mode_t can_handle_sql_mode_dependency_on_store() const override; - Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item) - override - { - return (flags & ZEROFILL_FLAG) ? - get_equal_zerofill_const_item(thd, ctx, const_item) : - const_item; - } - void add_zerofill_and_unsigned(String &res) const; - friend class Create_field; - void make_send_field(Send_field *) override; - uint decimals() const override { return (uint) dec; } - uint size_of() const override { return sizeof(*this); } - bool eq_def(const Field *field) const override; - Copy_func *get_copy_func(const Field *from) const override - { - if (unsigned_flag && from->cmp_type() == DECIMAL_RESULT) - return do_field_decimal; - return do_field_int; - } - int save_in_field(Field *to) override - { - return to->store(val_int(), MY_TEST(flags & UNSIGNED_FLAG)); - } - bool is_equal(const Column_definition &new_field) const override; - uint row_pack_length() const override { return pack_length(); } - uint32 pack_length_from_metadata(uint field_metadata) const override - { - uint32 length= pack_length(); - DBUG_PRINT("result", ("pack_length_from_metadata(%d): %u", - field_metadata, length)); - return length; - } - double pos_in_interval(Field *min, Field *max) override - { - return pos_in_interval_val_real(min, max); - } - SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part, - const Item_bool_func *cond, - scalar_comparison_op op, Item *value) override; - Binlog_type_info binlog_type_info() const override - { - DBUG_ASSERT(Field_num::type() == binlog_type()); - return Binlog_type_info(Field_num::type(), 0, 0, binlog_signedness()); - } -}; - - -class Field_str :public Field { -protected: - DTCollation m_collation; - // A short alias for m_collation.collation with non-virtual linkage - const CHARSET_INFO *field_charset() const { return m_collation.collation; } - uint mbmaxlen() const { return m_collation.collation->mbmaxlen; } -public: - bool can_be_substituted_to_equal_item(const Context &ctx, - const Item_equal *item_equal) override; - Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - const DTCollation &collation); - uint decimals() const override { return NOT_FIXED_DEC; } - int save_in_field(Field *to) override { return save_in_field_str(to); } - bool memcpy_field_possible(const Field *from) const override - { - return real_type() == from->real_type() && - pack_length() == from->pack_length() && - charset() == from->charset(); - } - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int store_decimal(const my_decimal *) override; - int store(const char *to,size_t length,CHARSET_INFO *cs) override=0; - int store_hex_hybrid(const char *str, size_t length) override - { - return store(str, length, &my_charset_bin); - } - CHARSET_INFO *charset() const override { return m_collation.collation; } - const DTCollation &dtcollation() const override - { - return m_collation; - } - bool binary() const override { return field_charset() == &my_charset_bin; } - uint32 max_display_length() const override { return field_length; } - uint32 character_octet_length() const override { return field_length; } - uint32 char_length() const override - { - return field_length / mbmaxlen(); - } - Information_schema_character_attributes - information_schema_character_attributes() const override - { - return Information_schema_character_attributes(max_display_length(), - char_length()); - } - friend class Create_field; - my_decimal *val_decimal(my_decimal *) override; - bool val_bool() override { return val_real() != 0e0; } - bool str_needs_quotes() const override { return true; } - bool eq_cmp_as_binary() override { return MY_TEST(flags & BINARY_FLAG); } - virtual uint length_size() const { return 0; } - double pos_in_interval(Field *min, Field *max) override - { - return pos_in_interval_val_str(min, max, length_size()); - } - bool test_if_equality_guarantees_uniqueness(const Item *const_item) const - override; - SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part, - const Item_bool_func *cond, - scalar_comparison_op op, Item *value) override; - Binlog_type_info binlog_type_info() const override - { - DBUG_ASSERT(Field_str::type() == binlog_type()); - return Binlog_type_info(Field_str::type(), 0, 0, charset()); - } -}; - -/* base class for Field_string, Field_varstring and Field_blob */ - -class Field_longstr :public Field_str -{ -protected: - int report_if_important_data(const char *ptr, const char *end, - bool count_spaces); - bool check_string_copy_error(const String_copier *copier, - const char *end, CHARSET_INFO *cs); - int check_conversion_status(const String_copier *copier, - const char *end, CHARSET_INFO *cs, - bool count_spaces) - { - if (check_string_copy_error(copier, end, cs)) - return 2; - return report_if_important_data(copier->source_end_pos(), - end, count_spaces); - } - int well_formed_copy_with_check(char *to, size_t to_length, - CHARSET_INFO *from_cs, - const char *from, size_t from_length, - size_t nchars, bool count_spaces, - uint *copy_length) - { - String_copier copier; - - *copy_length= copier.well_formed_copy(field_charset(), to, to_length, - from_cs, from, from_length, - nchars); - - return check_conversion_status(&copier, from + from_length, from_cs, count_spaces); - } - bool cmp_to_string_with_same_collation(const Item_bool_func *cond, - const Item *item) const; - bool cmp_to_string_with_stricter_collation(const Item_bool_func *cond, - const Item *item) const; - int compress(char *to, uint to_length, - const char *from, uint length, - uint max_length, - uint *out_length, - CHARSET_INFO *cs, size_t nchars); - String *uncompress(String *val_buffer, String *val_ptr, - const uchar *from, uint from_length) const; -public: - Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - const DTCollation &collation) - :Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, collation) - {} - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - int store_decimal(const my_decimal *d) override; - uint32 max_data_length() const override; - void make_send_field(Send_field *) override; - bool send(Protocol *protocol) override; - - bool is_varchar_and_in_write_set() const override - { - DBUG_ASSERT(table && table->write_set); - return bitmap_is_set(table->write_set, field_index); - } - bool match_collation_to_optimize_range() const { return true; } - - bool can_optimize_keypart_ref(const Item_bool_func *cond, - const Item *item) const override; - bool can_optimize_hash_join(const Item_bool_func *cond, - const Item *item) const override; - bool can_optimize_group_min_max(const Item_bool_func *cond, - const Item *const_item) const override; - bool can_optimize_range(const Item_bool_func *cond, - const Item *item, - bool is_eq_func) const override; - bool is_packable() const override { return true; } - uint make_packed_sort_key_part(uchar *buff, - const SORT_FIELD_ATTR *sort_field)override; - uchar* pack_sort_string(uchar *to, const SORT_FIELD_ATTR *sort_field); -}; - -/* base class for float and double and decimal (old one) */ -class Field_real :public Field_num { -protected: - double get_double(const char *str, size_t length, CHARSET_INFO *cs, int *err); -public: - bool not_fixed; - - Field_real(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - uint8 dec_arg, bool zero_arg, bool unsigned_arg) - :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, dec_arg, zero_arg, unsigned_arg), - not_fixed(dec_arg >= FLOATING_POINT_DECIMALS) - {} - Copy_func *get_copy_func(const Field *from) const override - { - return do_field_real; - } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - Information_schema_numeric_attributes - information_schema_numeric_attributes() const override - { - return dec == NOT_FIXED_DEC ? - Information_schema_numeric_attributes(field_length) : - Information_schema_numeric_attributes(field_length, dec); - } - void sql_type(String &str) const override; - int save_in_field(Field *to) override { return to->store(val_real()); } - bool memcpy_field_possible(const Field *from) const override - { - /* - Cannot do memcpy from a longer field to a shorter field, - e.g. a DOUBLE(53,10) into a DOUBLE(10,10). - But it should be OK the other way around. - */ - return real_type() == from->real_type() && - pack_length() == from->pack_length() && - is_unsigned() <= from->is_unsigned() && - decimals() == from->decimals() && - field_length >= from->field_length; - } - int store_decimal(const my_decimal *dec) override - { return store(dec->to_double()); } - int store_time_dec(const MYSQL_TIME *ltime, uint dec) override; - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override; - my_decimal *val_decimal(my_decimal *) override; - bool val_bool() override { return val_real() != 0e0; } - uint32 max_display_length() const override { return field_length; } - uint size_of() const override { return sizeof *this; } - Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item) - override; -}; - - -class Field_decimal final :public Field_real { -public: - Field_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - uint8 dec_arg,bool zero_arg,bool unsigned_arg) - :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, - dec_arg, zero_arg, unsigned_arg) - {} - Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type) - override; - const Type_handler *type_handler() const override - { return &type_handler_olddecimal; } - enum ha_base_keytype key_type() const override - { return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; } - Information_schema_numeric_attributes - information_schema_numeric_attributes() const override - { - uint tmp= dec ? 2 : 1; // The sign and the decimal point - return Information_schema_numeric_attributes(field_length - tmp, dec); - } - Copy_func *get_copy_func(const Field *from) const override - { - return eq_def(from) ? get_identical_copy_func() : do_field_string; - } - int reset() override; - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - void overflow(bool negative); - bool zero_pack() const override { return false; } - void sql_type(String &str) const override; - uchar *pack(uchar* to, const uchar *from, uint max_length) override - { - return Field::pack(to, from, max_length); - } -}; - - -/* New decimal/numeric field which use fixed point arithmetic */ -class Field_new_decimal final :public Field_num { -public: - /* The maximum number of decimal digits can be stored */ - uint precision; - uint bin_size; - /* - Constructors take max_length of the field as a parameter - not the - precision as the number of decimal digits allowed. - So for example we need to count length from precision handling - CREATE TABLE ( DECIMAL(x,y)) - */ - Field_new_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - uint8 dec_arg, bool zero_arg, bool unsigned_arg); - const Type_handler *type_handler() const override - { return &type_handler_newdecimal; } - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; } - Copy_func *get_copy_func(const Field *from) const override - { - // if (from->real_type() == MYSQL_TYPE_BIT) // QQ: why? - // return do_field_int; - return do_field_decimal; - } - int save_in_field(Field *to) override - { - my_decimal tmp(ptr, precision, dec); - return to->store_decimal(&tmp); - } - bool memcpy_field_possible(const Field *from) const override - { - return real_type() == from->real_type() && - pack_length() == from->pack_length() && - is_unsigned() <= from->is_unsigned() && - decimals() == from->decimals() && - field_length == from->field_length; - } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - int reset() override; - bool store_value(const my_decimal *decimal_value); - bool store_value(const my_decimal *decimal_value, int *native_error); - void set_value_on_overflow(my_decimal *decimal_value, bool sign); - int store(const char *to, size_t length, CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int store_time_dec(const MYSQL_TIME *ltime, uint dec) override; - int store_decimal(const my_decimal *) override; - double val_real() override - { - return my_decimal(ptr, precision, dec).to_double(); - } - longlong val_int() override - { - return my_decimal(ptr, precision, dec).to_longlong(unsigned_flag); - } - ulonglong val_uint() override - { - return (ulonglong) my_decimal(ptr, precision, dec).to_longlong(true); - } - my_decimal *val_decimal(my_decimal *) override; - String *val_str(String *val_buffer, String *) override - { - uint fixed_precision= zerofill ? precision : 0; - return my_decimal(ptr, precision, dec). - to_string(val_buffer, fixed_precision, dec, '0'); - } - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override - { - my_decimal nr(ptr, precision, dec); - return decimal_to_datetime_with_warn(get_thd(), &nr, ltime, - fuzzydate, table->s, field_name.str); - } - bool val_bool() override - { - return my_decimal(ptr, precision, dec).to_bool(); - } - int cmp(const uchar *, const uchar *) const override; - void sort_string(uchar *buff, uint length) override; - bool zero_pack() const override { return false; } - void sql_type(String &str) const override; - uint32 max_display_length() const override { return field_length; } - Information_schema_numeric_attributes - information_schema_numeric_attributes() const override - { - return Information_schema_numeric_attributes(precision, dec); - } - uint size_of() const override { return sizeof *this; } - uint32 pack_length() const override { return (uint32) bin_size; } - uint pack_length_from_metadata(uint field_metadata) const override; - uint row_pack_length() const override { return pack_length(); } - bool compatible_field_size(uint field_metadata, const Relay_log_info *rli, - uint16 mflags, int *order_var) const override; - bool is_equal(const Column_definition &new_field) const override; - const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint param_data) override; - Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item) - override; - Binlog_type_info binlog_type_info() const override; -}; - - -class Field_int :public Field_num -{ -protected: - String *val_str_from_long(String *val_buffer, uint max_char_length, - int radix, long nr); -public: - Field_int(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, bool zero_arg, bool unsigned_arg) - :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, 0, zero_arg, unsigned_arg) - {} - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - bool memcpy_field_possible(const Field *from) const override - { - return real_type() == from->real_type() && - pack_length() == from->pack_length() && - is_unsigned() == from->is_unsigned(); - } - int store_decimal(const my_decimal *) override; - my_decimal *val_decimal(my_decimal *) override; - bool val_bool() override { return val_int() != 0; } - ulonglong val_uint() override - { - longlong nr= val_int(); - return nr < 0 && !unsigned_flag ? 0 : (ulonglong) nr; - } - int store_time_dec(const MYSQL_TIME *ltime, uint dec) override; - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override; - virtual const Type_limits_int *type_limits_int() const= 0; - uint32 max_display_length() const override - { - return type_limits_int()->char_length(); - } - Type_numeric_attributes type_numeric_attributes() const override - { - /* - For integer data types, the user-specified length does not constrain the - supported range, so e.g. a column of the INT(1) data type supports the - full integer range anyway. - Choose the maximum from the user-specified length and the maximum - possible length determined by the data type capacity: - INT(1) -> 11 - INT(10) -> 11 - INT(40) -> 40 - */ - uint32 length1= max_display_length(); - uint32 length2= field_length; - return Type_numeric_attributes(MY_MAX(length1, length2), - decimals(), is_unsigned()); - } - Information_schema_numeric_attributes - information_schema_numeric_attributes() const override - { - uint32 prec= type_limits_int()->precision(); - return Information_schema_numeric_attributes(prec, 0); - } - void sql_type(String &str) const override; - SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part, - const Item_bool_func *cond, - scalar_comparison_op op, Item *value) override - { - return get_mm_leaf_int(param, key_part, cond, op, value, unsigned_flag); - } -}; - - -class Field_tiny :public Field_int -{ - const Type_handler_general_purpose_int *type_handler_priv() const - { - if (is_unsigned()) - return &type_handler_utiny; - return &type_handler_stiny; - } -public: - Field_tiny(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - bool zero_arg, bool unsigned_arg) - :Field_int(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, zero_arg, unsigned_arg) - {} - const Type_handler *type_handler() const override - { return type_handler_priv(); } - enum ha_base_keytype key_type() const override - { return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int reset() override { ptr[0]=0; return 0; } - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 1; } - const Type_limits_int *type_limits_int() const override - { - return type_handler_priv()->type_limits_int(); - } - - uchar *pack(uchar* to, const uchar *from, uint max_length) override - { - *to= *from; - return to + 1; - } - - const uchar *unpack(uchar* to, const uchar *from, - const uchar *from_end, uint param_data) override - { - if (from == from_end) - return 0; - *to= *from; - return from + 1; - } - ulonglong get_max_int_value() const override - { - return unsigned_flag ? 0xFFULL : 0x7FULL; - } -}; - - -class Field_short final :public Field_int -{ - const Type_handler_general_purpose_int *type_handler_priv() const - { - if (is_unsigned()) - return &type_handler_ushort; - return &type_handler_sshort; - } -public: - Field_short(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - bool zero_arg, bool unsigned_arg) - :Field_int(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, zero_arg, unsigned_arg) - {} - Field_short(uint32 len_arg,bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, - bool unsigned_arg) - :Field_int((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, 0, unsigned_arg) - {} - const Type_handler *type_handler() const override - { return type_handler_priv(); } - enum ha_base_keytype key_type() const override - { return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;} - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int reset() override { ptr[0]=ptr[1]=0; return 0; } - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 2; } - const Type_limits_int *type_limits_int() const override - { - return type_handler_priv()->type_limits_int(); - } - uchar *pack(uchar* to, const uchar *from, uint) override - { return pack_int16(to, from); } - - const uchar *unpack(uchar* to, const uchar *from, - const uchar *from_end, uint) override - { return unpack_int16(to, from, from_end); } - ulonglong get_max_int_value() const override - { - return unsigned_flag ? 0xFFFFULL : 0x7FFFULL; - } -}; - -class Field_medium final :public Field_int -{ - const Type_handler_general_purpose_int *type_handler_priv() const - { - if (is_unsigned()) - return &type_handler_uint24; - return &type_handler_sint24; - } -public: - Field_medium(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - bool zero_arg, bool unsigned_arg) - :Field_int(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, zero_arg, unsigned_arg) - {} - const Type_handler *type_handler() const override - { return type_handler_priv(); } - enum ha_base_keytype key_type() const override - { return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int reset() override { ptr[0]=ptr[1]=ptr[2]=0; return 0; } - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 3; } - const Type_limits_int *type_limits_int() const override - { - return type_handler_priv()->type_limits_int(); - } - uchar *pack(uchar* to, const uchar *from, uint max_length) override - { - return Field::pack(to, from, max_length); - } - ulonglong get_max_int_value() const override - { - return unsigned_flag ? 0xFFFFFFULL : 0x7FFFFFULL; - } -}; - - -class Field_long final :public Field_int -{ - const Type_handler_general_purpose_int *type_handler_priv() const - { - if (is_unsigned()) - return &type_handler_ulong; - return &type_handler_slong; - } -public: - Field_long(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - bool zero_arg, bool unsigned_arg) - :Field_int(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, zero_arg, unsigned_arg) - {} - Field_long(uint32 len_arg,bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, - bool unsigned_arg) - :Field_int((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, 0, unsigned_arg) - {} - const Type_handler *type_handler() const override - { return type_handler_priv(); } - enum ha_base_keytype key_type() const override - { return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int reset() override { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; } - double val_real() override; - longlong val_int() override; - bool send(Protocol *protocol) override; - String *val_str(String *, String *) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 4; } - const Type_limits_int *type_limits_int() const override - { - return type_handler_priv()->type_limits_int(); - } - uchar *pack(uchar* to, const uchar *from, uint) override - { - return pack_int32(to, from); - } - const uchar *unpack(uchar* to, const uchar *from, - const uchar *from_end, uint) override - { - return unpack_int32(to, from, from_end); - } - ulonglong get_max_int_value() const override - { - return unsigned_flag ? 0xFFFFFFFFULL : 0x7FFFFFFFULL; - } -}; - - -class Field_longlong :public Field_int -{ - const Type_handler_general_purpose_int *type_handler_priv() const - { - if (is_unsigned()) - return &type_handler_ulonglong; - return &type_handler_slonglong; - } -public: - Field_longlong(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - bool zero_arg, bool unsigned_arg) - :Field_int(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, zero_arg, unsigned_arg) - {} - Field_longlong(uint32 len_arg,bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, - bool unsigned_arg) - :Field_int((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, 0, unsigned_arg) - {} - const Type_handler *type_handler() const override - { return type_handler_priv(); } - enum ha_base_keytype key_type() const override - { return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int reset() override - { - ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; - return 0; - } - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 8; } - const Type_limits_int *type_limits_int() const override - { - return type_handler_priv()->type_limits_int(); - } - uchar *pack(uchar* to, const uchar *from, uint) override - { - return pack_int64(to, from); - } - const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint) override - { - return unpack_int64(to, from, from_end); - } - void set_max() override; - bool is_max() override; - ulonglong get_max_int_value() const override - { - return unsigned_flag ? 0xFFFFFFFFFFFFFFFFULL : 0x7FFFFFFFFFFFFFFFULL; - } -}; - - -class Field_vers_trx_id :public Field_longlong { - MYSQL_TIME cache; - ulonglong cached; -public: - Field_vers_trx_id(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, bool zero_arg, - bool unsigned_arg) - : Field_longlong(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, zero_arg, - unsigned_arg), - cached(0) - {} - const Type_handler *type_handler() const override - { return &type_handler_vers_trx_id; } - uint size_of() const override { return sizeof *this; } - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate, ulonglong trx_id); - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override - { - return get_date(ltime, fuzzydate, (ulonglong) val_int()); - } - bool test_if_equality_guarantees_uniqueness(const Item *item) const override; - bool can_optimize_keypart_ref(const Item_bool_func *, const Item *) - const override - { - return true; - } - - bool can_optimize_group_min_max(const Item_bool_func *, const Item *) - const override - { - return true; - } - bool can_optimize_range(const Item_bool_func *, const Item *, bool) - const override - { - return true; - } - /* cmp_type() cannot be TIME_RESULT, because we want to compare this field against - integers. But in all other cases we treat it as TIME_RESULT! */ -}; - - -class Field_float final :public Field_real { -public: - Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - uint8 dec_arg,bool zero_arg,bool unsigned_arg) - :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, - dec_arg, zero_arg, unsigned_arg) - { - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } - Field_float(uint32 len_arg, bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, uint8 dec_arg) - :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0, - NONE, field_name_arg, dec_arg, 0, 0) - { - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } - const Type_handler *type_handler() const override - { return &type_handler_float; } - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_FLOAT; } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int reset() override { bzero(ptr,sizeof(float)); return 0; } - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff, uint length) override; - uint32 pack_length() const override { return sizeof(float); } - uint row_pack_length() const override { return pack_length(); } - ulonglong get_max_int_value() const override - { - /* - We use the maximum as per IEEE754-2008 standard, 2^24 - */ - return 0x1000000ULL; - } - Binlog_type_info binlog_type_info() const override; -}; - - -class Field_double :public Field_real { - longlong val_int_from_real(bool want_unsigned_result); -public: - Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - uint8 dec_arg,bool zero_arg,bool unsigned_arg) - :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, - dec_arg, zero_arg, unsigned_arg) - { - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } - Field_double(uint32 len_arg, bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, uint8 dec_arg) - :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, - NONE, field_name_arg, dec_arg, 0, 0) - { - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } - Field_double(uint32 len_arg, bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, - uint8 dec_arg, bool not_fixed_arg) - :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, - NONE, field_name_arg, dec_arg, 0, 0) - { - not_fixed= not_fixed_arg; - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } - void init_for_tmp_table(Field *org_field, TABLE *new_table) override - { - Field::init_for_tmp_table(org_field, new_table); - not_fixed= true; - } - const Type_handler *type_handler() const override - { return &type_handler_double; } - enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_DOUBLE; } - int store(const char *to,size_t length,CHARSET_INFO *charset) override final; - int store(double nr) override final; - int store(longlong nr, bool unsigned_val) override final; - int reset() override final { bzero(ptr,sizeof(double)); return 0; } - double val_real() override final; - longlong val_int() override final { return val_int_from_real(false); } - ulonglong val_uint() override final { return (ulonglong) val_int_from_real(true); } - String *val_str(String *, String *) override final; - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override final; - void sort_string(uchar *buff, uint length) override final; - uint32 pack_length() const override final { return sizeof(double); } - uint row_pack_length() const override final { return pack_length(); } - ulonglong get_max_int_value() const override final - { - /* - We use the maximum as per IEEE754-2008 standard, 2^53 - */ - return 0x20000000000000ULL; - } - Binlog_type_info binlog_type_info() const override final; -}; - - -/* Everything saved in this will disappear. It will always return NULL */ - -class Field_null :public Field_str { - static uchar null[1]; -public: - Field_null(uchar *ptr_arg, uint32 len_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - const DTCollation &collation) - :Field_str(ptr_arg, len_arg, null, 1, - unireg_check_arg, field_name_arg, collation) - {} - const Type_handler *type_handler() const override - { return &type_handler_null; } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - Information_schema_character_attributes - information_schema_character_attributes() const override - { - return Information_schema_character_attributes(); - } - Copy_func *get_copy_func(const Field *from) const override - { - return do_field_string; - } - int store(const char *to, size_t length, CHARSET_INFO *cs) override final - { null[0]=1; return 0; } - int store(double nr) override final { null[0]=1; return 0; } - int store(longlong nr, bool unsigned_val) override final { null[0]=1; return 0; } - int store_decimal(const my_decimal *d) override final { null[0]=1; return 0; } - int reset() override final { return 0; } - double val_real() override final { return 0.0;} - longlong val_int() override final { return 0;} - bool val_bool() override final { return false; } - my_decimal *val_decimal(my_decimal *) override final { return 0; } - String *val_str(String *value,String *value2) override final - { value2->length(0); return value2;} - bool is_equal(const Column_definition &new_field) const override final; - int cmp(const uchar *a, const uchar *b) const override final { return 0;} - void sort_string(uchar *buff, uint length) override final {} - uint32 pack_length() const override final { return 0; } - void sql_type(String &str) const override final; - uint size_of() const override final { return sizeof *this; } - uint32 max_display_length() const override final { return 4; } - void move_field_offset(my_ptrdiff_t ptr_diff) override final {} - bool can_optimize_keypart_ref(const Item_bool_func *cond, - const Item *item) const override final - { - return false; - } - bool can_optimize_group_min_max(const Item_bool_func *cond, - const Item *const_item) const override final - { - return false; - } -}; - - -class Field_temporal :public Field { -protected: - Item *get_equal_const_item_datetime(THD *thd, const Context &ctx, - Item *const_item); - void set_warnings(Sql_condition::enum_warning_level trunc_level, - const ErrConv *str, int was_cut, const char *typestr); - int store_TIME_return_code_with_warnings(int warn, const ErrConv *str, - const char *typestr) - { - if (!MYSQL_TIME_WARN_HAVE_WARNINGS(warn) && - MYSQL_TIME_WARN_HAVE_NOTES(warn)) - { - set_warnings(Sql_condition::WARN_LEVEL_NOTE, str, - warn | MYSQL_TIME_WARN_TRUNCATED, typestr); - return 3; - } - set_warnings(Sql_condition::WARN_LEVEL_WARN, str, warn, typestr); - return warn ? 2 : 0; - } - int store_invalid_with_warning(const ErrConv *str, int was_cut, - const char *typestr) - { - DBUG_ASSERT(was_cut); - reset(); - Sql_condition::enum_warning_level level= Sql_condition::WARN_LEVEL_WARN; - if (was_cut & MYSQL_TIME_WARN_ZERO_DATE) - { - set_warnings(level, str, MYSQL_TIME_WARN_OUT_OF_RANGE, typestr); - return 2; - } - set_warnings(level, str, MYSQL_TIME_WARN_TRUNCATED, typestr); - return 1; - } - void sql_type_comment(String &str, - const Name &name, - const Name &comment) const; - void sql_type_dec_comment(String &str, - const Name &name, uint dec, - const Name &comment) const; - void sql_type_opt_dec_comment(String &str, - const Name &name, uint dec, - const Name &comment) const - { - if (dec) - sql_type_dec_comment(str, name, dec, comment); - else - sql_type_comment(str, name, comment); - } - static const Name &type_version_mysql56(); -public: - Field_temporal(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, utype unireg_check_arg, - const LEX_CSTRING *field_name_arg) - :Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg) - { flags|= BINARY_FLAG; } - int store_hex_hybrid(const char *str, size_t length) override - { - return store(str, length, &my_charset_bin); - } - sql_mode_t can_handle_sql_mode_dependency_on_store() const override; - Copy_func *get_copy_func(const Field *from) const override; - int save_in_field(Field *to) override - { - MYSQL_TIME ltime; - // For temporal types no truncation needed. Rounding mode is not important. - if (get_date(<ime, TIME_CONV_NONE | TIME_FRAC_NONE)) - return to->reset(); - return to->store_time_dec(<ime, decimals()); - } - bool memcpy_field_possible(const Field *from) const override; - uint32 max_display_length() const override { return field_length; } - bool str_needs_quotes() const override { return true; } - CHARSET_INFO *charset() const override - { - return DTCollation_numeric::singleton().collation; - } - const DTCollation &dtcollation() const override - { - return DTCollation_numeric::singleton(); - } - CHARSET_INFO *sort_charset() const override { return &my_charset_bin; } - bool binary() const override { return true; } - bool val_bool() override { return val_real() != 0e0; } - bool is_equal(const Column_definition &new_field) const override; - bool eq_def(const Field *field) const override - { - return (Field::eq_def(field) && decimals() == field->decimals()); - } - my_decimal *val_decimal(my_decimal*) override; - double pos_in_interval(Field *min, Field *max) override - { - return pos_in_interval_val_real(min, max); - } - bool can_optimize_keypart_ref(const Item_bool_func *cond, - const Item *item) const override; - bool can_optimize_group_min_max(const Item_bool_func *cond, - const Item *const_item) const override; - bool can_optimize_range(const Item_bool_func *cond, - const Item *item, - bool is_eq_func) const override - { - return true; - } - SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part, - const Item_bool_func *cond, - scalar_comparison_op op, Item *value) override; -}; - - -/** - Abstract class for: - - DATE - - DATETIME - - DATETIME(1..6) - - DATETIME(0..6) - MySQL56 version -*/ -class Field_temporal_with_date :public Field_temporal { -protected: - virtual void store_TIME(const MYSQL_TIME *ltime) = 0; - void store_datetime(const Datetime &dt) - { - return store_TIME(dt.get_mysql_time()); - } - virtual bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, - date_mode_t fuzzydate) const = 0; - bool validate_MMDD(bool not_zero_date, uint month, uint day, - date_mode_t fuzzydate) const - { - if (!not_zero_date) - return bool(fuzzydate & TIME_NO_ZERO_DATE); - if (!month || !day) - return bool(fuzzydate & TIME_NO_ZERO_IN_DATE); - return false; - } -public: - Field_temporal_with_date(uchar *ptr_arg, uint32 len_arg, - uchar *null_ptr_arg, uchar null_bit_arg, - utype unireg_check_arg, - const LEX_CSTRING *field_name_arg) - :Field_temporal(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg) - {} - bool validate_value_in_record(THD *thd, const uchar *record) const; -}; - - -class Field_timestamp :public Field_temporal { -protected: - int store_TIME_with_warning(THD *, const Datetime *, - const ErrConv *, int warn); - virtual void store_TIMEVAL(const timeval &tv)= 0; - void store_TIMESTAMP(const Timestamp &ts) - { - store_TIMEVAL(ts.tv()); - } - int zero_time_stored_return_code_with_warning(); -public: - Field_timestamp(uchar *ptr_arg, uint32 len_arg, - uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share); - const Type_handler *type_handler() const override - { return &type_handler_timestamp; } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - Copy_func *get_copy_func(const Field *from) const override; - sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const override; - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int store_time_dec(const MYSQL_TIME *ltime, uint dec) override; - int store_decimal(const my_decimal *) override; - int store_timestamp_dec(const timeval &ts, uint dec) override; - int save_in_field(Field *to) override; - longlong val_int() override; - String *val_str(String *, String *) override; - bool zero_pack() const override { return false; } - /* - This method is used by storage/perfschema and - Item_func_now_local::save_in_field(). - */ - void store_TIME(my_time_t ts, ulong sec_part) - { - int warn; - time_round_mode_t mode= Datetime::default_round_mode(get_thd()); - store_TIMESTAMP(Timestamp(ts, sec_part).round(decimals(), mode, &warn)); - } - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override; - int store_native(const Native &value) override; - bool validate_value_in_record(THD *thd, const uchar *record) const override; - Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item) - override - { - return get_equal_const_item_datetime(thd, ctx, const_item); - } - bool load_data_set_null(THD *thd) override; - bool load_data_set_no_data(THD *thd, bool fixed_format) override; -}; - - -class Field_timestamp0 :public Field_timestamp -{ - void store_TIMEVAL(const timeval &tv) override - { - int4store(ptr, tv.tv_sec); - } -public: - Field_timestamp0(uchar *ptr_arg, uint32 len_arg, - uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share) - :Field_timestamp(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, share) - { } - enum ha_base_keytype key_type() const override - { return HA_KEYTYPE_ULONG_INT; } - void sql_type(String &str) const override - { - sql_type_comment(str, Field_timestamp0::type_handler()->name(), - Type_handler::version_mariadb53()); - } - double val_real() override - { - return (double) Field_timestamp0::val_int(); - } - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 4; } - int set_time() override; - /* Get TIMESTAMP field value as seconds since begging of Unix Epoch */ - my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const override; - bool val_native(Native *to) override; - uchar *pack(uchar *to, const uchar *from, uint) override - { - return pack_int32(to, from); - } - const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint) override - { - return unpack_int32(to, from, from_end); - } - uint size_of() const override { return sizeof *this; } -}; - - -/** - Abstract class for: - - TIMESTAMP(1..6) - - TIMESTAMP(0..6) - MySQL56 version -*/ -class Field_timestamp_with_dec :public Field_timestamp { -protected: - uint dec; -public: - Field_timestamp_with_dec(uchar *ptr_arg, - uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share, uint dec_arg) : - Field_timestamp(ptr_arg, - MAX_DATETIME_WIDTH + dec_arg + MY_TEST(dec_arg), null_ptr_arg, - null_bit_arg, unireg_check_arg, field_name_arg, share), - dec(dec_arg) - { - DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS); - } - uint decimals() const override { return dec; } - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; } - uchar *pack(uchar *to, const uchar *from, uint max_length) override - { return Field::pack(to, from, max_length); } - const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint param_data) override - { return Field::unpack(to, from, from_end, param_data); } - void make_send_field(Send_field *field) override; - void sort_string(uchar *to, uint length) override - { - DBUG_ASSERT(length == pack_length()); - memcpy(to, ptr, length); - } - bool send(Protocol *protocol) override; - double val_real() override; - my_decimal* val_decimal(my_decimal*) override; - int set_time() override; -}; - - -class Field_timestamp_hires :public Field_timestamp_with_dec { - uint sec_part_bytes(uint dec) const - { - return Type_handler_timestamp::sec_part_bytes(dec); - } - void store_TIMEVAL(const timeval &tv) override; -public: - Field_timestamp_hires(uchar *ptr_arg, - uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share, uint dec_arg) : - Field_timestamp_with_dec(ptr_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, share, dec_arg) - { - DBUG_ASSERT(dec); - } - void sql_type(String &str) const override - { - sql_type_dec_comment(str, Field_timestamp_hires::type_handler()->name(), - dec, Type_handler::version_mariadb53()); - } - bool val_native(Native *to) override; - my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const override; - int cmp(const uchar *,const uchar *) const override; - uint32 pack_length() const override { return 4 + sec_part_bytes(dec); } - uint size_of() const override { return sizeof *this; } -}; - - -/** - TIMESTAMP(0..6) - MySQL56 version -*/ -class Field_timestampf final :public Field_timestamp_with_dec { - void store_TIMEVAL(const timeval &tv) override; -public: - Field_timestampf(uchar *ptr_arg, - uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share, uint dec_arg) : - Field_timestamp_with_dec(ptr_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, share, dec_arg) - {} - const Type_handler *type_handler() const override - { return &type_handler_timestamp2; } - enum_field_types binlog_type() const override - { return MYSQL_TYPE_TIMESTAMP2; } - void sql_type(String &str) const override - { - sql_type_opt_dec_comment(str, Field_timestampf::type_handler()->name(), - dec, type_version_mysql56()); - - } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - uint32 pack_length() const override - { - return my_timestamp_binary_length(dec); - } - uint row_pack_length() const override { return pack_length(); } - uint pack_length_from_metadata(uint field_metadata) const override - { - DBUG_ENTER("Field_timestampf::pack_length_from_metadata"); - uint tmp= my_timestamp_binary_length(field_metadata); - DBUG_RETURN(tmp); - } - int cmp(const uchar *a_ptr,const uchar *b_ptr) const override - { - return memcmp(a_ptr, b_ptr, pack_length()); - } - void set_max() override; - bool is_max() override; - my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const override; - bool val_native(Native *to) override; - uint size_of() const override { return sizeof *this; } - Binlog_type_info binlog_type_info() const override; -}; - - -class Field_year final :public Field_tiny { -public: - Field_year(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg) - :Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, 1, 1) - {} - const Type_handler *type_handler() const override - { - return field_length == 2 ? &type_handler_year2 : &type_handler_year; - } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - Copy_func *get_copy_func(const Field *from) const override - { - if (eq_def(from)) - return get_identical_copy_func(); - switch (from->cmp_type()) { - case STRING_RESULT: - { - const Type_handler *handler= from->type_handler(); - if (handler == &type_handler_enum || handler == &type_handler_set) - return do_field_int; - return do_field_string; - } - case TIME_RESULT: - return do_field_date; - case DECIMAL_RESULT: - return do_field_decimal; - case REAL_RESULT: - return do_field_real; - case INT_RESULT: - break; - case ROW_RESULT: - default: - DBUG_ASSERT(0); - break; - } - return do_field_int; - } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int store_time_dec(const MYSQL_TIME *ltime, uint dec) override; - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override; - bool send(Protocol *protocol) override; - Information_schema_numeric_attributes - information_schema_numeric_attributes() const override - { - return Information_schema_numeric_attributes(); - } - uint32 max_display_length() const override { return field_length; } - void sql_type(String &str) const override; -}; - - -class Field_date_common :public Field_temporal_with_date -{ -protected: - int store_TIME_with_warning(const Datetime *ltime, const ErrConv *str, - int was_cut); -public: - Field_date_common(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg) - :Field_temporal_with_date(ptr_arg, MAX_DATE_WIDTH, - null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg) - {} - Copy_func *get_copy_func(const Field *from) const override; - SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part, - const Item_bool_func *cond, - scalar_comparison_op op, Item *value) override; - int store(const char *to, size_t length, CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int store_time_dec(const MYSQL_TIME *ltime, uint dec) override; - int store_decimal(const my_decimal *) override; -}; - - -class Field_date final :public Field_date_common -{ - void store_TIME(const MYSQL_TIME *ltime) override; - bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) - const override; -public: - Field_date(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg) - :Field_date_common(ptr_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg) {} - const Type_handler *type_handler() const override - { return &type_handler_date; } - enum ha_base_keytype key_type() const override - { return HA_KEYTYPE_ULONG_INT; } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - int reset() override { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; } - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override - { return Field_date::get_TIME(ltime, ptr, fuzzydate); } - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 4; } - void sql_type(String &str) const override; - uchar *pack(uchar* to, const uchar *from, uint) override - { - return pack_int32(to, from); - } - const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint) override - { - return unpack_int32(to, from, from_end); - } - uint size_of() const override { return sizeof *this; } -}; - - -class Field_newdate final :public Field_date_common -{ - void store_TIME(const MYSQL_TIME *ltime) override; - bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) - const override; -public: - Field_newdate(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg) - :Field_date_common(ptr_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg) - {} - const Type_handler *type_handler() const override - { return &type_handler_newdate; } - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_UINT24; } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - int reset() override { ptr[0]=ptr[1]=ptr[2]=0; return 0; } - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 3; } - void sql_type(String &str) const override; - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override - { return Field_newdate::get_TIME(ltime, ptr, fuzzydate); } - longlong val_datetime_packed(THD *thd) override; - uint size_of() const override { return sizeof *this; } - Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item) - override; -}; - - -class Field_time :public Field_temporal { - /* - when this Field_time instance is used for storing values for index lookups - (see class store_key, Field::new_key_field(), etc), the following - might be set to TO_DAYS(CURDATE()). See also Field_time::store_time_dec() - */ - long curdays; -protected: - virtual void store_TIME(const MYSQL_TIME *ltime)= 0; - void store_TIME(const Time &t) { return store_TIME(t.get_mysql_time()); } - int store_TIME_with_warning(const Time *ltime, const ErrConv *str, int warn); - bool check_zero_in_date_with_warn(date_mode_t fuzzydate); - static void do_field_time(Copy_field *copy); -public: - Field_time(uchar *ptr_arg, uint length_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg) - :Field_temporal(ptr_arg, length_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg), curdays(0) - {} - bool can_be_substituted_to_equal_item(const Context &ctx, - const Item_equal *item_equal) override; - const Type_handler *type_handler() const override - { return &type_handler_time; } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - Copy_func *get_copy_func(const Field *from) const override - { - return from->cmp_type() == REAL_RESULT ? do_field_string : // MDEV-9344 - from->type() == MYSQL_TYPE_YEAR ? do_field_int : - from->type() == MYSQL_TYPE_BIT ? do_field_int : - eq_def(from) ? get_identical_copy_func() : - do_field_time; - } - bool memcpy_field_possible(const Field *from) const override - { - return real_type() == from->real_type() && - decimals() == from->decimals(); - } - sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const override; - int store_native(const Native &value) override; - bool val_native(Native *to) override; - int store_time_dec(const MYSQL_TIME *ltime, uint dec) override; - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int store_decimal(const my_decimal *) override; - String *val_str(String *, String *) override; - bool send(Protocol *protocol) override; - void set_curdays(THD *thd); - Field *new_key_field(MEM_ROOT *root, TABLE *new_table, - uchar *new_ptr, uint32 length, - uchar *new_null_ptr, uint new_null_bit) override; - Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item) - override; -}; - - -class Field_time0 final :public Field_time -{ -protected: - void store_TIME(const MYSQL_TIME *ltime) override; -public: - Field_time0(uchar *ptr_arg, uint length_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg) - :Field_time(ptr_arg, length_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg) - { } - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_INT24; } - void sql_type(String &str) const override - { - sql_type_comment(str, Field_time0::type_handler()->name(), - Type_handler::version_mariadb53()); - } - double val_real() override; - longlong val_int() override; - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 3; } - uint size_of() const override { return sizeof *this; } -}; - - -/** - Abstract class for: - - TIME(1..6) - - TIME(0..6) - MySQL56 version -*/ -class Field_time_with_dec :public Field_time { -protected: - uint dec; -public: - Field_time_with_dec(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - uint dec_arg) - :Field_time(ptr_arg, MIN_TIME_WIDTH + dec_arg + MY_TEST(dec_arg), - null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg), - dec(dec_arg) - { - DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS); - } - uint decimals() const override { return dec; } - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; } - longlong val_int() override; - double val_real() override; - void make_send_field(Send_field *) override; -}; - - -/** - TIME(1..6) -*/ -class Field_time_hires final :public Field_time_with_dec { - longlong zero_point; - void store_TIME(const MYSQL_TIME *) override; -public: - Field_time_hires(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - uint dec_arg) - :Field_time_with_dec(ptr_arg, null_ptr_arg, - null_bit_arg, unireg_check_arg, field_name_arg, - dec_arg) - { - DBUG_ASSERT(dec); - zero_point= sec_part_shift( - ((TIME_MAX_VALUE_SECONDS+1LL)*TIME_SECOND_PART_FACTOR), dec); - } - void sql_type(String &str) const override - { - sql_type_dec_comment(str, Field_time_hires::type_handler()->name(), - dec, Type_handler::version_mariadb53()); - } - int reset() override; - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override - { return Type_handler_time::hires_bytes(dec); } - uint size_of() const override { return sizeof *this; } -}; - - -/** - TIME(0..6) - MySQL56 version -*/ -class Field_timef final :public Field_time_with_dec { - void store_TIME(const MYSQL_TIME *ltime) override; -public: - Field_timef(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - uint dec_arg) - :Field_time_with_dec(ptr_arg, null_ptr_arg, - null_bit_arg, unireg_check_arg, field_name_arg, - dec_arg) - { - DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS); - } - const Type_handler *type_handler() const override - { return &type_handler_time2; } - enum_field_types binlog_type() const override { return MYSQL_TYPE_TIME2; } - void sql_type(String &str) const override - { - sql_type_opt_dec_comment(str, Field_timef::type_handler()->name(), - dec, type_version_mysql56()); - } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - uint32 pack_length() const override - { - return my_time_binary_length(dec); - } - uint row_pack_length() const override { return pack_length(); } - uint pack_length_from_metadata(uint field_metadata) const override - { - DBUG_ENTER("Field_timef::pack_length_from_metadata"); - uint tmp= my_time_binary_length(field_metadata); - DBUG_RETURN(tmp); - } - void sort_string(uchar *to, uint length) override - { - DBUG_ASSERT(length == Field_timef::pack_length()); - memcpy(to, ptr, length); - } - int cmp(const uchar *a_ptr, const uchar *b_ptr) const override - { - return memcmp(a_ptr, b_ptr, pack_length()); - } - int reset() override; - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override; - longlong val_time_packed(THD *thd) override; - int store_native(const Native &value) override; - bool val_native(Native *to) override; - uint size_of() const override { return sizeof *this; } - Binlog_type_info binlog_type_info() const override; -}; - - -class Field_datetime :public Field_temporal_with_date { -protected: - int store_TIME_with_warning(const Datetime *ltime, const ErrConv *str, - int was_cut); -public: - Field_datetime(uchar *ptr_arg, uint length_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg) - :Field_temporal_with_date(ptr_arg, length_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg) - { - if (unireg_check == TIMESTAMP_UN_FIELD || - unireg_check == TIMESTAMP_DNUN_FIELD) - flags|= ON_UPDATE_NOW_FLAG; - } - const Type_handler *type_handler() const override - { return &type_handler_datetime; } - sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const override; - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - int store(const char *to, size_t length, CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int store_time_dec(const MYSQL_TIME *ltime, uint dec) override; - int store_decimal(const my_decimal *) override; - int set_time() override; - Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item) - override - { - return get_equal_const_item_datetime(thd, ctx, const_item); - } -}; - - -/* - Stored as a 8 byte unsigned int. Should sometimes be change to a 6 byte -*/ - -class Field_datetime0 final :public Field_datetime -{ - void store_TIME(const MYSQL_TIME *ltime) override; - bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) - const override; -public: - Field_datetime0(uchar *ptr_arg, uint length_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg) - :Field_datetime(ptr_arg, length_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg) - {} - enum ha_base_keytype key_type() const override - { return HA_KEYTYPE_ULONGLONG; } - void sql_type(String &str) const override - { - sql_type_comment(str, Field_datetime0::type_handler()->name(), - Type_handler::version_mariadb53()); - } - double val_real() override - { - return (double) Field_datetime0::val_int(); - } - longlong val_int() override; - String *val_str(String *, String *) override; - bool send(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return 8; } - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override - { return Field_datetime0::get_TIME(ltime, ptr, fuzzydate); } - uchar *pack(uchar* to, const uchar *from, uint) override - { - return pack_int64(to, from); - } - const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint) override - { - return unpack_int64(to, from, from_end); - } - uint size_of() const override { return sizeof *this; } -}; - - -/** - Abstract class for: - - DATETIME(1..6) - - DATETIME(0..6) - MySQL56 version -*/ -class Field_datetime_with_dec :public Field_datetime { -protected: - uint dec; -public: - Field_datetime_with_dec(uchar *ptr_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, uint dec_arg) - :Field_datetime(ptr_arg, MAX_DATETIME_WIDTH + dec_arg + MY_TEST(dec_arg), - null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg), dec(dec_arg) - { - DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS); - } - uint decimals() const override final { return dec; } - enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_BINARY; } - void make_send_field(Send_field *field) override final; - bool send(Protocol *protocol) override final; - uchar *pack(uchar *to, const uchar *from, uint max_length) override final - { return Field::pack(to, from, max_length); } - const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint param_data) override final - { return Field::unpack(to, from, from_end, param_data); } - void sort_string(uchar *to, uint length) override final - { - DBUG_ASSERT(length == pack_length()); - memcpy(to, ptr, length); - } - double val_real() override final; - longlong val_int() override final; - String *val_str(String *, String *) override final; -}; - - -/** - DATETIME(1..6) -*/ -class Field_datetime_hires final :public Field_datetime_with_dec { - void store_TIME(const MYSQL_TIME *ltime) override; - bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) - const override; -public: - Field_datetime_hires(uchar *ptr_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, uint dec_arg) - :Field_datetime_with_dec(ptr_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, dec_arg) - { - DBUG_ASSERT(dec); - } - void sql_type(String &str) const override - { - sql_type_dec_comment(str, Field_datetime_hires::type_handler()->name(), - dec, Type_handler::version_mariadb53()); - } - int cmp(const uchar *,const uchar *) const override; - uint32 pack_length() const override - { return Type_handler_datetime::hires_bytes(dec); } - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override - { return Field_datetime_hires::get_TIME(ltime, ptr, fuzzydate); } - uint size_of() const override { return sizeof *this; } -}; - - -/** - DATETIME(0..6) - MySQL56 version -*/ - -class Field_datetimef final :public Field_datetime_with_dec { - void store_TIME(const MYSQL_TIME *ltime) override; - bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) - const override; -public: - Field_datetimef(uchar *ptr_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, uint dec_arg) - :Field_datetime_with_dec(ptr_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, dec_arg) - {} - const Type_handler *type_handler() const override - { return &type_handler_datetime2; } - enum_field_types binlog_type() const override - { return MYSQL_TYPE_DATETIME2; } - void sql_type(String &str) const override - { - sql_type_opt_dec_comment(str, Field_datetimef::type_handler()->name(), - dec, type_version_mysql56()); - } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - uint32 pack_length() const override - { - return my_datetime_binary_length(dec); - } - uint row_pack_length() const override { return pack_length(); } - uint pack_length_from_metadata(uint field_metadata) const override - { - DBUG_ENTER("Field_datetimef::pack_length_from_metadata"); - uint tmp= my_datetime_binary_length(field_metadata); - DBUG_RETURN(tmp); - } - int cmp(const uchar *a_ptr, const uchar *b_ptr) const override - { - return memcmp(a_ptr, b_ptr, pack_length()); - } - int reset() override; - bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override - { return Field_datetimef::get_TIME(ltime, ptr, fuzzydate); } - longlong val_datetime_packed(THD *thd) override; - uint size_of() const override { return sizeof *this; } - Binlog_type_info binlog_type_info() const override; -}; - - -static inline Field_timestamp * -new_Field_timestamp(MEM_ROOT *root,uchar *ptr, uchar *null_ptr, uchar null_bit, - enum Field::utype unireg_check, - const LEX_CSTRING *field_name, - TABLE_SHARE *share, uint dec) -{ - if (dec==0) - return new (root) - Field_timestamp0(ptr, MAX_DATETIME_WIDTH, null_ptr, - null_bit, unireg_check, field_name, share); - if (dec >= FLOATING_POINT_DECIMALS) - dec= MAX_DATETIME_PRECISION; - return new (root) - Field_timestamp_hires(ptr, null_ptr, null_bit, unireg_check, - field_name, share, dec); -} - -static inline Field_time * -new_Field_time(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit, - enum Field::utype unireg_check, const LEX_CSTRING *field_name, - uint dec) -{ - if (dec == 0) - return new (root) - Field_time0(ptr, MIN_TIME_WIDTH, null_ptr, null_bit, unireg_check, - field_name); - if (dec >= FLOATING_POINT_DECIMALS) - dec= MAX_DATETIME_PRECISION; - return new (root) - Field_time_hires(ptr, null_ptr, null_bit, unireg_check, field_name, dec); -} - -static inline Field_datetime * -new_Field_datetime(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit, - enum Field::utype unireg_check, - const LEX_CSTRING *field_name, uint dec) -{ - if (dec == 0) - return new (root) - Field_datetime0(ptr, MAX_DATETIME_WIDTH, null_ptr, null_bit, - unireg_check, field_name); - if (dec >= FLOATING_POINT_DECIMALS) - dec= MAX_DATETIME_PRECISION; - return new (root) - Field_datetime_hires(ptr, null_ptr, null_bit, - unireg_check, field_name, dec); -} - -class Field_string final :public Field_longstr { - class Warn_filter_string: public Warn_filter - { - public: - Warn_filter_string(const THD *thd, const Field_string *field); - }; - bool is_var_string() const - { - return can_alter_field_type && - orig_table && - (orig_table->s->db_create_options & HA_OPTION_PACK_RECORD) && - field_length >= 4 && - orig_table->s->frm_version < FRM_VER_TRUE_VARCHAR; - } -public: - bool can_alter_field_type; - Field_string(uchar *ptr_arg, uint32 len_arg,uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - const DTCollation &collation) - :Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, collation), - can_alter_field_type(1) {}; - Field_string(uint32 len_arg,bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, - const DTCollation &collation) - :Field_longstr((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, - NONE, field_name_arg, collation), - can_alter_field_type(1) {}; - - const Type_handler *type_handler() const override - { - if (is_var_string()) - return &type_handler_var_string; - return &type_handler_string; - } - enum ha_base_keytype key_type() const override - { return binary() ? HA_KEYTYPE_BINARY : HA_KEYTYPE_TEXT; } - en_fieldtype tmp_engine_column_type(bool use_packed_rows) const override; - bool zero_pack() const override { return false; } - Copy_func *get_copy_func(const Field *from) const override; - int reset() override - { - charset()->fill((char*) ptr, field_length, (has_charset() ? ' ' : 0)); - return 0; - } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - using Field_str::store; - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - my_decimal *val_decimal(my_decimal *) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - void update_data_type_statistics(Data_type_statistics *st) const override - { - st->m_fixed_string_count++; - st->m_fixed_string_total_length+= pack_length(); - } - void sql_type(String &str) const override; - void sql_rpl_type(String*) const override; - bool is_equal(const Column_definition &new_field) const override; - bool can_be_converted_by_engine(const Column_definition &new_type) const - override - { - return table->file->can_convert_string(this, new_type); - } - uchar *pack(uchar *to, const uchar *from, uint max_length) override; - const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint param_data) override; - uint pack_length_from_metadata(uint field_metadata) const override - { - DBUG_PRINT("debug", ("field_metadata: 0x%04x", field_metadata)); - if (field_metadata == 0) - return row_pack_length(); - return (((field_metadata >> 4) & 0x300) ^ 0x300) + (field_metadata & 0x00ff); - } - bool compatible_field_size(uint field_metadata, const Relay_log_info *rli, - uint16 mflags, int *order_var) const override; - uint row_pack_length() const override { return field_length; } - int pack_cmp(const uchar *a,const uchar *b,uint key_length, - bool insert_or_update); - int pack_cmp(const uchar *b,uint key_length,bool insert_or_update); - uint packed_col_length(const uchar *to, uint length) override; - uint max_packed_col_length(uint max_length) override; - uint size_of() const override { return sizeof *this; } - bool has_charset() const override { return charset() != &my_charset_bin; } - Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type) - override; - uint get_key_image(uchar *buff, uint length, - const uchar *ptr_arg, imagetype type) const override; - sql_mode_t value_depends_on_sql_mode() const override; - sql_mode_t can_handle_sql_mode_dependency_on_store() const override; - void print_key_value(String *out, uint32 length) override; - Binlog_type_info binlog_type_info() const override; -}; - - -class Field_varstring :public Field_longstr { -public: - const uchar *get_data() const - { - return get_data(ptr); - } - const uchar *get_data(const uchar *ptr_arg) const - { - return ptr_arg + length_bytes; - } - uint get_length() const - { - return get_length(ptr); - } - uint get_length(const uchar *ptr_arg) const - { - return length_bytes == 1 ? (uint) *ptr_arg : uint2korr(ptr_arg); - } -protected: - void store_length(uint32 number) - { - if (length_bytes == 1) - *ptr= (uchar) number; - else - int2store(ptr, number); - } - virtual void val_str_from_ptr(String *val, const uchar *ptr) const; -public: - /* - The maximum space available in a Field_varstring, in bytes. See - length_bytes. - */ - static const uint MAX_SIZE; - /* Store number of bytes used to store length (1 or 2) */ - uint32 length_bytes; - Field_varstring(uchar *ptr_arg, - uint32 len_arg, uint length_bytes_arg, - uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share, const DTCollation &collation) - :Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, collation), - length_bytes(length_bytes_arg) - { - share->varchar_fields++; - } - Field_varstring(uint32 len_arg,bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share, const DTCollation &collation) - :Field_longstr((uchar*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0, - NONE, field_name_arg, collation), - length_bytes(len_arg < 256 ? 1 :2) - { - share->varchar_fields++; - } - - const Type_handler *type_handler() const override - { return &type_handler_varchar; } - en_fieldtype tmp_engine_column_type(bool use_packed_rows) const override - { - return FIELD_VARCHAR; - } - enum ha_base_keytype key_type() const override; - uint16 key_part_flag() const override { return HA_VAR_LENGTH_PART; } - uint16 key_part_length_bytes() const override { return HA_KEY_BLOB_LENGTH; } - uint row_pack_length() const override { return field_length; } - bool zero_pack() const override { return false; } - int reset() override { bzero(ptr,field_length+length_bytes); return 0; } - uint32 pack_length() const override - { return (uint32) field_length+length_bytes; } - uint32 key_length() const override { return (uint32) field_length; } - uint32 sort_length() const override - { - return (uint32) field_length + sort_suffix_length(); - } - virtual uint32 sort_suffix_length() const override - { - return (field_charset() == &my_charset_bin ? length_bytes : 0); - } - Copy_func *get_copy_func(const Field *from) const override; - bool memcpy_field_possible(const Field *from) const override; - void update_data_type_statistics(Data_type_statistics *st) const override - { - st->m_variable_string_count++; - st->m_variable_string_total_length+= pack_length(); - } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - using Field_str::store; -#ifdef HAVE_valgrind - void mark_unused_memory_as_defined() override; -#endif - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - my_decimal *val_decimal(my_decimal *) override; - bool send(Protocol *protocol) override; - int cmp(const uchar *a,const uchar *b) const override; - int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len) const - override; - void sort_string(uchar *buff,uint length) override; - uint get_key_image(uchar *buff, uint length, - const uchar *ptr_arg, imagetype type) const override; - void set_key_image(const uchar *buff,uint length) override; - void sql_type(String &str) const override; - void sql_rpl_type(String*) const override; - uchar *pack(uchar *to, const uchar *from, uint max_length) override; - const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint param_data) override; - int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const - override; - int key_cmp(const uchar *,const uchar*) const override; - int key_cmp(const uchar *str, uint length) const override; - uint packed_col_length(const uchar *to, uint length) override; - uint max_packed_col_length(uint max_length) override; - uint32 data_length() override; - uint size_of() const override { return sizeof *this; } - bool has_charset() const override - { return charset() == &my_charset_bin ? FALSE : TRUE; } - Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type) - override; - Field *new_key_field(MEM_ROOT *root, TABLE *new_table, - uchar *new_ptr, uint32 length, - uchar *new_null_ptr, uint new_null_bit) override; - bool is_equal(const Column_definition &new_field) const override; - bool can_be_converted_by_engine(const Column_definition &new_type) const - override - { - return table->file->can_convert_varstring(this, new_type); - } - void hash(ulong *nr, ulong *nr2) override; - uint length_size() const override { return length_bytes; } - void print_key_value(String *out, uint32 length) override; - Binlog_type_info binlog_type_info() const override; -}; - - -class Field_varstring_compressed final :public Field_varstring { -public: - Field_varstring_compressed(uchar *ptr_arg, - uint32 len_arg, uint length_bytes_arg, - uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share, const DTCollation &collation, - Compression_method *compression_method_arg): - Field_varstring(ptr_arg, len_arg, length_bytes_arg, null_ptr_arg, - null_bit_arg, unireg_check_arg, field_name_arg, - share, collation), - compression_method_ptr(compression_method_arg) { DBUG_ASSERT(len_arg > 0); } - Compression_method *compression_method() const override - { return compression_method_ptr; } -private: - Compression_method *compression_method_ptr; - void val_str_from_ptr(String *val, const uchar *ptr) const override; - int store(const char *to, size_t length, CHARSET_INFO *charset) override; - using Field_str::store; - String *val_str(String *, String *) override; - double val_real() override; - longlong val_int() override; - uint size_of() const override { return sizeof *this; } - /* - We use the default Field::send() implementation, - because the derived optimized version (from Field_longstr) - is not suitable for compressed fields. - */ - bool send(Protocol *protocol) override - { - return Field::send(protocol); - } - enum_field_types binlog_type() const override - { return MYSQL_TYPE_VARCHAR_COMPRESSED; } - void sql_type(String &str) const override - { - Field_varstring::sql_type(str); - str.append(STRING_WITH_LEN(" /*!100301 COMPRESSED*/")); - } - uint32 max_display_length() const override { return field_length - 1; } - uint32 character_octet_length() const override { return field_length - 1; } - uint32 char_length() const override - { - return (field_length - 1) / mbmaxlen(); - } - int cmp(const uchar *a_ptr, const uchar *b_ptr) const override; - - /* - Compressed fields can't have keys as two rows may have different - compression methods or compression levels. - */ - - int key_cmp(const uchar *str, uint length) const override - { DBUG_ASSERT(0); return 0; } - using Field_varstring::key_cmp; - Binlog_type_info binlog_type_info() const override; -}; - - -static inline uint8 number_storage_requirement(uint32 n) -{ - return n < 256 ? 1 : n < 65536 ? 2 : n < 16777216 ? 3 : 4; -} - - -static inline void store_bigendian(ulonglong num, uchar *to, uint bytes) -{ - switch(bytes) { - case 1: mi_int1store(to, num); break; - case 2: mi_int2store(to, num); break; - case 3: mi_int3store(to, num); break; - case 4: mi_int4store(to, num); break; - case 5: mi_int5store(to, num); break; - case 6: mi_int6store(to, num); break; - case 7: mi_int7store(to, num); break; - case 8: mi_int8store(to, num); break; - default: DBUG_ASSERT(0); - } -} - - -static inline longlong read_bigendian(const uchar *from, uint bytes) -{ - switch(bytes) { - case 1: return mi_uint1korr(from); - case 2: return mi_uint2korr(from); - case 3: return mi_uint3korr(from); - case 4: return mi_uint4korr(from); - case 5: return mi_uint5korr(from); - case 6: return mi_uint6korr(from); - case 7: return mi_uint7korr(from); - case 8: return mi_sint8korr(from); - default: DBUG_ASSERT(0); return 0; - } -} - -static inline void store_lowendian(ulonglong num, uchar *to, uint bytes) -{ - switch(bytes) { - case 1: *to= (uchar)num; break; - case 2: int2store(to, num); break; - case 3: int3store(to, num); break; - case 4: int4store(to, num); break; - case 8: int8store(to, num); break; - default: DBUG_ASSERT(0); - } -} - -static inline longlong read_lowendian(const uchar *from, uint bytes) -{ - switch(bytes) { - case 1: return from[0]; - case 2: return uint2korr(from); - case 3: return uint3korr(from); - case 4: return uint4korr(from); - case 8: return sint8korr(from); - default: DBUG_ASSERT(0); return 0; - } -} - - -extern LEX_CSTRING temp_lex_str; - -class Field_blob :public Field_longstr { -protected: - /** - The number of bytes used to represent the length of the blob. - */ - uint packlength; - - /** - The 'value'-object is a cache fronting the storage engine. - */ - String value; - /** - Cache for blob values when reading a row with a virtual blob - field. This is needed to not destroy the old cached value when - updating the blob with a new value when creating the new row. - */ - String read_value; - - static void do_copy_blob(Copy_field *copy); - static void do_conv_blob(Copy_field *copy); - uint get_key_image_itRAW(const uchar *ptr_arg, uchar *buff, uint length) const; -public: - Field_blob(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share, uint blob_pack_length, - const DTCollation &collation); - Field_blob(uint32 len_arg,bool maybe_null_arg, const LEX_CSTRING *field_name_arg, - const DTCollation &collation) - :Field_longstr((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, - NONE, field_name_arg, collation), - packlength(4) - { - flags|= BLOB_FLAG; - } - Field_blob(uint32 len_arg,bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, - const DTCollation &collation, bool set_packlength) - :Field_longstr((uchar*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0, - NONE, field_name_arg, collation) - { - flags|= BLOB_FLAG; - packlength= set_packlength ? number_storage_requirement(len_arg) : 4; - } - Field_blob(uint32 packlength_arg) - :Field_longstr((uchar*) 0, 0, (uchar*) "", 0, NONE, &temp_lex_str, - system_charset_info), - packlength(packlength_arg) {} - const Type_handler *type_handler() const override; - /* Note that the default copy constructor is used, in clone() */ - enum_field_types type() const override - { - /* - We cannot return type_handler()->field_type() here. - Some pieces of the code (e.g. in engines) rely on the fact - that Field::type(), Field::real_type() and Item_field::field_type() - return MYSQL_TYPE_BLOB for all blob variants. - We should eventually fix all such code pieces to expect - all BLOB type codes. - */ - return MYSQL_TYPE_BLOB; - } - enum_field_types real_type() const override - { - return MYSQL_TYPE_BLOB; - } - enum ha_base_keytype key_type() const override - { return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; } - uint16 key_part_flag() const override { return HA_BLOB_PART; } - uint16 key_part_length_bytes() const override { return HA_KEY_BLOB_LENGTH; } - en_fieldtype tmp_engine_column_type(bool use_packed_rows) const override - { - return FIELD_BLOB; - } - Type_numeric_attributes type_numeric_attributes() const override - { - return Type_numeric_attributes(Field_blob::max_display_length(), - decimals(), is_unsigned()); - } - Information_schema_character_attributes - information_schema_character_attributes() const override - { - uint32 octets= Field_blob::character_octet_length(); - uint32 chars= octets / field_charset()->mbminlen; - return Information_schema_character_attributes(octets, chars); - } - void update_data_type_statistics(Data_type_statistics *st) const override - { - st->m_blob_count++; - } - void make_send_field(Send_field *) override; - Copy_func *get_copy_func(const Field *from) const override - { - /* - TODO: MDEV-9331 - if (from->type() == MYSQL_TYPE_BIT) - return do_field_int; - */ - if (!(from->flags & BLOB_FLAG) || from->charset() != charset() || - !from->compression_method() != !compression_method()) - return do_conv_blob; - if (from->pack_length() != Field_blob::pack_length()) - return do_copy_blob; - return get_identical_copy_func(); - } - int store_field(Field *from) override - { // Be sure the value is stored - if (field_charset() == &my_charset_bin && - from->type_handler()->convert_to_binary_using_val_native()) - { - NativeBuffer<64> tmp; - from->val_native(&tmp); - value.copy(tmp.ptr(), tmp.length(), &my_charset_bin); - return store(value.ptr(), value.length(), &my_charset_bin); - } - from->val_str(&value); - if (table->copy_blobs || - (!value.is_alloced() && from->is_varchar_and_in_write_set())) - value.copy(); - return store(value.ptr(), value.length(), from->charset()); - } - bool memcpy_field_possible(const Field *from) const override - { - return Field_str::memcpy_field_possible(from) && - !compression_method() == !from->compression_method() && - !table->copy_blobs; - } - bool make_empty_rec_store_default_value(THD *thd, Item *item) override; - int store(const char *to, size_t length, CHARSET_INFO *charset) override; - using Field_str::store; - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - my_decimal *val_decimal(my_decimal *) override; - int cmp(const uchar *a, const uchar *b) const override; - int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len) const - override; - int cmp(const uchar *a, uint32 a_length, const uchar *b, uint32 b_length) - const; - int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const - override; - int key_cmp(const uchar *,const uchar*) const override; - int key_cmp(const uchar *str, uint length) const override; - /* Never update the value of min_val for a blob field */ - bool update_min(Field *min_val, bool force_update) override { return false; } - /* Never update the value of max_val for a blob field */ - bool update_max(Field *max_val, bool force_update) override { return false; } - uint32 key_length() const override { return 0; } - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override - { return (uint32) (packlength + portable_sizeof_char_ptr); } - - /** - Return the packed length without the pointer size added. - - This is used to determine the size of the actual data in the row - buffer. - - @returns The length of the raw data itself without the pointer. - */ - uint32 pack_length_no_ptr() const - { return (uint32) (packlength); } - uint row_pack_length() const override { return pack_length_no_ptr(); } - uint32 sort_length() const override; - uint32 sort_suffix_length() const override; - uint32 value_length() override { return get_length(); } - virtual uint32 max_data_length() const override - { - return (uint32) (((ulonglong) 1 << (packlength*8)) -1); - } - int reset() override { bzero(ptr, packlength+sizeof(uchar*)); return 0; } - void reset_fields() override - { - bzero((uchar*) &value, sizeof value); - bzero((uchar*) &read_value, sizeof read_value); - } - uint32 get_field_buffer_size() { return value.alloced_length(); } - void store_length(uchar *i_ptr, uint i_packlength, uint32 i_number); - void store_length(size_t number) - { - DBUG_ASSERT(number < UINT_MAX32); - store_length(ptr, packlength, (uint32)number); - } - inline uint32 get_length(my_ptrdiff_t row_offset= 0) const - { return get_length(ptr+row_offset, this->packlength); } - uint32 get_length(const uchar *ptr, uint packlength) const; - uint32 get_length(const uchar *ptr_arg) const - { return get_length(ptr_arg, this->packlength); } - inline uchar *get_ptr() const { return get_ptr(ptr); } - inline uchar *get_ptr(const uchar *ptr_arg) const - { - uchar *s; - memcpy(&s, ptr_arg + packlength, sizeof(uchar*)); - return s; - } - inline void set_ptr(uchar *length, uchar *data) - { - memcpy(ptr,length,packlength); - memcpy(ptr+packlength, &data,sizeof(char*)); - } - void set_ptr_offset(my_ptrdiff_t ptr_diff, uint32 length, const uchar *data) - { - uchar *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,uchar*); - store_length(ptr_ofs, packlength, length); - memcpy(ptr_ofs+packlength, &data, sizeof(char*)); - } - inline void set_ptr(uint32 length, uchar *data) - { - set_ptr_offset(0, length, data); - } - int copy_value(Field_blob *from); - uint get_key_image(uchar *buff, uint length, - const uchar *ptr_arg, imagetype type) const override - { - DBUG_ASSERT(type == itRAW); - return get_key_image_itRAW(ptr_arg, buff, length); - } - void set_key_image(const uchar *buff,uint length) override; - Field *new_key_field(MEM_ROOT *root, TABLE *new_table, - uchar *new_ptr, uint32 length, - uchar *new_null_ptr, uint new_null_bit) override; - void sql_type(String &str) const override; - inline bool copy() - { - uchar *tmp= get_ptr(); - if (value.copy((char*) tmp, get_length(), charset())) - { - Field_blob::reset(); - return 1; - } - tmp=(uchar*) value.ptr(); - memcpy(ptr+packlength, &tmp, sizeof(char*)); - return 0; - } - /* store value for the duration of the current read record */ - inline void swap_value_and_read_value() - { - read_value.swap(value); - } - inline void set_value(uchar *data) - { - /* Set value pointer. Lengths are not important */ - value.reset((char*) data, 1, 1, &my_charset_bin); - } - uchar *pack(uchar *to, const uchar *from, uint max_length) override; - const uchar *unpack(uchar *to, const uchar *from, const uchar *from_end, - uint param_data) override; - uint packed_col_length(const uchar *col_ptr, uint length) override; - uint max_packed_col_length(uint max_length) override; - void free() override - { - value.free(); - read_value.free(); - } - inline void clear_temporary() - { - uchar *tmp= get_ptr(); - if (likely(value.ptr() == (char*) tmp)) - bzero((uchar*) &value, sizeof(value)); - else - { - /* - Currently read_value should never point to tmp, the following code - is mainly here to make things future proof. - */ - if (unlikely(read_value.ptr() == (char*) tmp)) - bzero((uchar*) &read_value, sizeof(read_value)); - } - } - uint size_of() const override { return sizeof *this; } - bool has_charset() const override { return charset() != &my_charset_bin; } - uint32 max_display_length() const override; - uint32 char_length() const override; - uint32 character_octet_length() const override; - bool is_equal(const Column_definition &new_field) const override; - bool can_be_converted_by_engine(const Column_definition &new_type) const - override - { - return table->file->can_convert_blob(this, new_type); - } - void print_key_value(String *out, uint32 length) override; - Binlog_type_info binlog_type_info() const override; - - friend void TABLE::remember_blob_values(String *blob_storage); - friend void TABLE::restore_blob_values(String *blob_storage); -}; - - -class Field_blob_compressed final :public Field_blob { -public: - Field_blob_compressed(uchar *ptr_arg, uchar *null_ptr_arg, - uchar null_bit_arg, enum utype unireg_check_arg, - const LEX_CSTRING *field_name_arg, TABLE_SHARE *share, - uint blob_pack_length, const DTCollation &collation, - Compression_method *compression_method_arg): - Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, share, blob_pack_length, collation), - compression_method_ptr(compression_method_arg) {} - Compression_method *compression_method() const override - { return compression_method_ptr; } -private: - Compression_method *compression_method_ptr; - int store(const char *to, size_t length, CHARSET_INFO *charset) override; - using Field_str::store; - String *val_str(String *, String *) override; - double val_real() override; - longlong val_int() override; - /* - We use the default Field::send() implementation, - because the derived optimized version (from Field_longstr) - is not suitable for compressed fields. - */ - bool send(Protocol *protocol) override - { - return Field::send(protocol); - } - uint size_of() const override { return sizeof *this; } - enum_field_types binlog_type() const override - { return MYSQL_TYPE_BLOB_COMPRESSED; } - void sql_type(String &str) const override - { - Field_blob::sql_type(str); - str.append(STRING_WITH_LEN(" /*!100301 COMPRESSED*/")); - } - - /* - Compressed fields can't have keys as two rows may have different - compression methods or compression levels. - */ - - uint get_key_image(uchar *buff, uint length, - const uchar *ptr_arg, imagetype type_arg) const override - { DBUG_ASSERT(0); return 0; } - void set_key_image(const uchar *, uint) override - { DBUG_ASSERT(0); } - int key_cmp(const uchar *, const uchar *) const override - { DBUG_ASSERT(0); return 0; } - int key_cmp(const uchar *, uint) const override - { DBUG_ASSERT(0); return 0; } - Field *new_key_field(MEM_ROOT *, TABLE *, uchar *, uint32, uchar *, uint) - override - { DBUG_ASSERT(0); return 0; } - Binlog_type_info binlog_type_info() const override; -}; - - -class Field_enum :public Field_str { - static void do_field_enum(Copy_field *copy_field); - longlong val_int(const uchar *) const; -protected: - uint packlength; -public: - const TYPELIB *typelib; - Field_enum(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - uint packlength_arg, - const TYPELIB *typelib_arg, - const DTCollation &collation) - :Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, collation), - packlength(packlength_arg),typelib(typelib_arg) - { - flags|=ENUM_FLAG; - } - Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type) - override; - const Type_handler *type_handler() const override - { return &type_handler_enum; } - enum ha_base_keytype key_type() const override; - sql_mode_t can_handle_sql_mode_dependency_on_store() const override; - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - Copy_func *get_copy_func(const Field *from) const override - { - if (eq_def(from)) - return get_identical_copy_func(); - if (real_type() == MYSQL_TYPE_ENUM && - from->real_type() == MYSQL_TYPE_ENUM) - return do_field_enum; - if (from->result_type() == STRING_RESULT) - return do_field_string; - return do_field_int; - } - int store_field(Field *from) override - { - if (from->real_type() == MYSQL_TYPE_ENUM && from->val_int() == 0) - { - store_type(0); - return 0; - } - return from->save_in_field(this); - } - int save_in_field(Field *to) override - { - if (to->result_type() != STRING_RESULT) - return to->store(val_int(), 0); - return save_in_field_str(to); - } - bool memcpy_field_possible(const Field *from) const override - { return false; } - void make_empty_rec_reset(THD *) override - { - if (flags & NOT_NULL_FLAG) - { - set_notnull(); - store((longlong) 1, true); - } - else - reset(); - } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff,uint length) override; - uint32 pack_length() const override { return (uint32) packlength; } - void store_type(ulonglong value); - void sql_type(String &str) const override; - uint size_of() const override { return sizeof *this; } - uint pack_length_from_metadata(uint field_metadata) const override - { return (field_metadata & 0x00ff); } - uint row_pack_length() const override { return pack_length(); } - bool zero_pack() const override { return false; } - bool optimize_range(uint, uint) const override { return false; } - bool eq_def(const Field *field) const override; - bool has_charset() const override { return true; } - /* enum and set are sorted as integers */ - CHARSET_INFO *sort_charset() const override { return &my_charset_bin; } - uint decimals() const override { return 0; } - const TYPELIB *get_typelib() const override { return typelib; } - - uchar *pack(uchar *to, const uchar *from, uint max_length) override; - const uchar *unpack(uchar *to, const uchar *from, const uchar *from_end, - uint param_data) override; - - bool can_optimize_keypart_ref(const Item_bool_func *cond, - const Item *item) const override; - bool can_optimize_group_min_max(const Item_bool_func *, const Item *) - const override - { - /* - Can't use GROUP_MIN_MAX optimization for ENUM and SET, - because the values are stored as numbers in index, - while MIN() and MAX() work as strings. - It would return the records with min and max enum numeric indexes. - "Bug#45300 MAX() and ENUM type" should be fixed first. - */ - return false; - } - bool can_optimize_range(const Item_bool_func *cond, - const Item *item, - bool is_eq_func) const override; - Binlog_type_info binlog_type_info() const override; -private: - bool is_equal(const Column_definition &new_field) const override; -}; - - -class Field_set final :public Field_enum { -public: - Field_set(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - uint32 packlength_arg, - const TYPELIB *typelib_arg, const DTCollation &collation) - :Field_enum(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, - packlength_arg, - typelib_arg, collation), - empty_set_string("", 0, collation.collation) - { - flags=(flags & ~ENUM_FLAG) | SET_FLAG; - } - void make_empty_rec_reset(THD *thd) override - { - Field::make_empty_rec_reset(thd); - } - - int store_field(Field *from) override { return from->save_in_field(this); } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override - { return Field_set::store((longlong) nr, FALSE); } - int store(longlong nr, bool unsigned_val) override; - - bool zero_pack() const override { return true; } - String *val_str(String *, String *) override; - void sql_type(String &str) const override; - uint size_of() const override { return sizeof *this; } - const Type_handler *type_handler() const override - { return &type_handler_set; } - bool has_charset() const override { return true; } - Binlog_type_info binlog_type_info() const override; -private: - const String empty_set_string; -}; - - -/* - Note: - To use Field_bit::cmp_binary() you need to copy the bits stored in - the beginning of the record (the NULL bytes) to each memory you - want to compare (where the arguments point). - - This is the reason: - - Field_bit::cmp_binary() is only implemented in the base class - (Field::cmp_binary()). - - Field::cmp_binary() currently uses pack_length() to calculate how - long the data is. - - pack_length() includes size of the bits stored in the NULL bytes - of the record. -*/ -class Field_bit :public Field { -public: - uchar *bit_ptr; // position in record where 'uneven' bits store - uchar bit_ofs; // offset to 'uneven' high bits - uint bit_len; // number of 'uneven' high bits - uint bytes_in_rec; - Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg); - const Type_handler *type_handler() const override - { return &type_handler_bit; } - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BIT; } - uint16 key_part_flag() const override { return HA_BIT_PART; } - uint32 key_length() const override - { return (uint32) (field_length + 7) / 8; } - uint32 max_data_length() const override { return key_length(); } - uint32 max_display_length() const override { return field_length; } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - CHARSET_INFO *charset() const override { return &my_charset_bin; } - const DTCollation & dtcollation() const override; - Information_schema_numeric_attributes - information_schema_numeric_attributes() const override - { - return Information_schema_numeric_attributes(field_length); - } - void update_data_type_statistics(Data_type_statistics *st) const override - { - st->m_uneven_bit_length+= field_length & 7; - } - uint size_of() const override { return sizeof *this; } - int reset() override - { - bzero(ptr, bytes_in_rec); - if (bit_ptr && (bit_len > 0)) // reset odd bits among null bits - clr_rec_bits(bit_ptr, bit_ofs, bit_len); - return 0; - } - Copy_func *get_copy_func(const Field *from) const override - { - if (from->cmp_type() == DECIMAL_RESULT) - return do_field_decimal; - return do_field_int; - } - int save_in_field(Field *to) override { return to->store(val_int(), true); } - bool memcpy_field_possible(const Field *from) const override{ return false; } - int store(const char *to, size_t length, CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int store_decimal(const my_decimal *) override; - double val_real() override; - longlong val_int() override; - String *val_str(String*, String *) override; - bool str_needs_quotes() const override { return true; } - my_decimal *val_decimal(my_decimal *) override; - bool val_bool() override { return val_int() != 0; } - int cmp(const uchar *a, const uchar *b) const override - { - DBUG_ASSERT(ptr == a || ptr == b); - if (ptr == a) - return Field_bit::key_cmp(b, bytes_in_rec + MY_TEST(bit_len)); - else - return Field_bit::key_cmp(a, bytes_in_rec + MY_TEST(bit_len)) * -1; - } - int cmp_binary_offset(uint row_offset) override - { return cmp_offset(row_offset); } - int cmp_prefix(const uchar *a, const uchar *b, - size_t max_length) const override; - int key_cmp(const uchar *a, const uchar *b) const override - { return cmp_binary((uchar *) a, (uchar *) b); } - int key_cmp(const uchar *str, uint length) const override; - int cmp_offset(my_ptrdiff_t row_offset) override; - bool update_min(Field *min_val, bool force_update) override - { - longlong val= val_int(); - bool update_fl= force_update || val < min_val->val_int(); - if (update_fl) - { - min_val->set_notnull(); - min_val->store(val, FALSE); - } - return update_fl; - } - bool update_max(Field *max_val, bool force_update) override - { - longlong val= val_int(); - bool update_fl= force_update || val > max_val->val_int(); - if (update_fl) - { - max_val->set_notnull(); - max_val->store(val, FALSE); - } - return update_fl; - } - void store_field_value(uchar *val, uint) override - { - store(*((longlong *)val), TRUE); - } - double pos_in_interval(Field *min, Field *max) override - { - return pos_in_interval_val_real(min, max); - } - void get_image(uchar *buff, uint length, - const uchar *ptr_arg, CHARSET_INFO *cs) const override - { get_key_image(buff, length, ptr_arg, itRAW); } - void set_image(const uchar *buff,uint length, CHARSET_INFO *cs) override - { Field_bit::store((char *) buff, length, cs); } - uint get_key_image(uchar *buff, uint length, - const uchar *ptr_arg, imagetype type) const override; - void set_key_image(const uchar *buff, uint length) override - { Field_bit::store((char*) buff, length, &my_charset_bin); } - void sort_string(uchar *buff, uint length) override - { get_key_image(buff, length, ptr, itRAW); } - uint32 pack_length() const override - { return (uint32) (field_length + 7) / 8; } - uint32 pack_length_in_rec() const override { return bytes_in_rec; } - uint pack_length_from_metadata(uint field_metadata) const override; - uint row_pack_length() const override - { return (bytes_in_rec + ((bit_len > 0) ? 1 : 0)); } - bool compatible_field_size(uint metadata, const Relay_log_info *rli, - uint16 mflags, int *order_var) const override; - void sql_type(String &str) const override; - uchar *pack(uchar *to, const uchar *from, uint max_length) override; - const uchar *unpack(uchar *to, const uchar *from, - const uchar *from_end, uint param_data) override; - int set_default() override; - - Field *new_key_field(MEM_ROOT *root, TABLE *new_table, - uchar *new_ptr, uint32 length, - uchar *new_null_ptr, uint new_null_bit) override; - void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg) - { - bit_ptr= bit_ptr_arg; - bit_ofs= bit_ofs_arg; - } - bool eq(Field *field) override - { - return (Field::eq(field) && - bit_ptr == ((Field_bit *)field)->bit_ptr && - bit_ofs == ((Field_bit *)field)->bit_ofs); - } - bool is_equal(const Column_definition &new_field) const override; - void move_field_offset(my_ptrdiff_t ptr_diff) override - { - Field::move_field_offset(ptr_diff); - bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*); - } - void hash(ulong *nr, ulong *nr2) override; - - SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part, - const Item_bool_func *cond, - scalar_comparison_op op, Item *value) override - { - return get_mm_leaf_int(param, key_part, cond, op, value, true); - } - void print_key_value(String *out, uint32 length) override - { - val_int_as_str(out, 1); - } - /** - Save the field metadata for bit fields. - Saves the bit length in the first byte and bytes in record in the - second byte of the field metadata array at index of *metadata_ptr and - *(metadata_ptr + 1). - - @param metadata_ptr First byte of field metadata - - @returns number of bytes written to metadata_ptr - */ - Binlog_type_info binlog_type_info() const override - { - DBUG_PRINT("debug", ("bit_len: %d, bytes_in_rec: %d", - bit_len, bytes_in_rec)); - /* - Since this class and Field_bit_as_char have different ideas of - what should be stored here, we compute the values of the metadata - explicitly using the field_length. - */ - return Binlog_type_info(type(), - static_cast((field_length & 7) | - ((field_length / 8) << 8)), 2); - } - -private: - size_t do_last_null_byte() const override; -}; - - -/** - BIT field represented as chars for non-MyISAM tables. - - @todo The inheritance relationship is backwards since Field_bit is - an extended version of Field_bit_as_char and not the other way - around. Hence, we should refactor it to fix the hierarchy order. - */ -class Field_bit_as_char final :public Field_bit { -public: - Field_bit_as_char(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg); - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; } - uint size_of() const override { return sizeof *this; } - int store(const char *to, size_t length, CHARSET_INFO *charset) override; - int store(double nr) override { return Field_bit::store(nr); } - int store(longlong nr, bool unsigned_val) override - { return Field_bit::store(nr, unsigned_val); } - void sql_type(String &str) const override; -}; - - -class Field_row final :public Field_null -{ - class Virtual_tmp_table *m_table; -public: - Field_row(uchar *ptr_arg, const LEX_CSTRING *field_name_arg) - :Field_null(ptr_arg, 0, Field::NONE, field_name_arg, &my_charset_bin), - m_table(NULL) - {} - ~Field_row(); - en_fieldtype tmp_engine_column_type(bool use_packed_rows) const - { - DBUG_ASSERT(0); - return Field::tmp_engine_column_type(use_packed_rows); - } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const - { - DBUG_ASSERT(0); - return CONV_TYPE_IMPOSSIBLE; - } - Virtual_tmp_table **virtual_tmp_table_addr() { return &m_table; } - bool sp_prepare_and_store_item(THD *thd, Item **value); -}; - - -extern const LEX_CSTRING null_clex_str; - -class Column_definition_attributes -{ -public: - /* - At various stages in execution this can be length of field in bytes or - max number of characters. - */ - ulonglong length; - uint decimals; - Field::utype unireg_check; - const TYPELIB *interval; // Which interval to use - CHARSET_INFO *charset; - uint32 srid; - uint pack_flag; - Column_definition_attributes() - :length(0), - decimals(0), - unireg_check(Field::NONE), - interval(NULL), - charset(&my_charset_bin), - srid(0), - pack_flag(0) - { } - Column_definition_attributes(const Field *field); - Column_definition_attributes(const Type_all_attributes &attr); - Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, - const Record_addr *rec, - const Type_handler *handler, - const LEX_CSTRING *field_name, - uint32 flags) const; - uint temporal_dec(uint intlen) const - { - return (uint) (length > intlen ? length - intlen - 1 : 0); - } - uint pack_flag_to_pack_length() const; - void frm_pack_basic(uchar *buff) const; - void frm_pack_charset(uchar *buff) const; - void frm_pack_numeric_with_dec(uchar *buff) const; - void frm_unpack_basic(const uchar *buff); - bool frm_unpack_charset(TABLE_SHARE *share, const uchar *buff); - bool frm_unpack_numeric_with_dec(TABLE_SHARE *share, const uchar *buff); - bool frm_unpack_temporal_with_dec(TABLE_SHARE *share, uint intlen, - const uchar *buff); - void set_length_and_dec(const Lex_length_and_dec_st &attr); -}; - - -/* - Create field class for CREATE TABLE -*/ -class Column_definition: public Sql_alloc, - public Type_handler_hybrid_field_type, - public Column_definition_attributes -{ - /** - Create "interval" from "interval_list". - @param mem_root - memory root to create the TYPELIB - instance and its values on - @param reuse_interval_list_values - determines if TYPELIB can reuse strings - from interval_list, or should always - allocate a copy on mem_root, even if - character set conversion is not needed - @retval false on success - @retval true on error (bad values, or EOM) - */ - bool create_interval_from_interval_list(MEM_ROOT *mem_root, - bool reuse_interval_list_values); - - /* - Calculate TYPELIB (set or enum) max and total lengths - - @param cs charset+collation pair of the interval - @param max_length length of the longest item - @param tot_length sum of the item lengths - - After this method call: - - ENUM uses max_length - - SET uses tot_length. - */ - void calculate_interval_lengths(uint32 *max_length, uint32 *tot_length) - { - const char **pos; - uint *len; - *max_length= *tot_length= 0; - for (pos= interval->type_names, len= interval->type_lengths; - *pos ; pos++, len++) - { - size_t length= charset->numchars(*pos, *pos + *len); - DBUG_ASSERT(length < UINT_MAX32); - *tot_length+= (uint) length; - set_if_bigger(*max_length, (uint32)length); - } - } - bool prepare_stage1_check_typelib_default(); - bool prepare_stage1_convert_default(THD *, MEM_ROOT *, CHARSET_INFO *to); - const Type_handler *field_type() const; // Prevent using this - Compression_method *compression_method_ptr; -public: - LEX_CSTRING field_name; - LEX_CSTRING comment; // Comment for field - enum enum_column_versioning - { - VERSIONING_NOT_SET, - WITH_VERSIONING, - WITHOUT_VERSIONING - }; - Item *on_update; // ON UPDATE NOW() - field_visibility_t invisible; - /* - The value of `length' as set by parser: is the number of characters - for most of the types, or of bytes for BLOBs or numeric types. - */ - uint32 char_length; - uint flags, pack_length; - List interval_list; - engine_option_value *option_list; - - - /* - This is additinal data provided for any computed(virtual) field. - In particular it includes a pointer to the item by which this field - can be computed from other fields. - */ - Virtual_column_info - *vcol_info, // Virtual field - *default_value, // Default value - *check_constraint; // Check constraint - - enum_column_versioning versioning; - - Table_period_info *period; - - Column_definition() - :Type_handler_hybrid_field_type(&type_handler_null), - compression_method_ptr(0), - comment(null_clex_str), - on_update(NULL), invisible(VISIBLE), char_length(0), - flags(0), pack_length(0), - option_list(NULL), - vcol_info(0), default_value(0), check_constraint(0), - versioning(VERSIONING_NOT_SET), period(NULL) - { - interval_list.empty(); - } - - Column_definition(THD *thd, Field *field, Field *orig_field); - bool set_attributes(THD *thd, - const Lex_field_type_st &attr, - CHARSET_INFO *cs, - column_definition_type_t type); - void create_length_to_internal_length_null() - { - DBUG_ASSERT(length == 0); - pack_length= 0; - } - void create_length_to_internal_length_simple() - { - pack_length= type_handler()->calc_pack_length((uint32) length); - } - void create_length_to_internal_length_string() - { - length*= charset->mbmaxlen; - if (real_field_type() == MYSQL_TYPE_VARCHAR && compression_method()) - length++; - set_if_smaller(length, UINT_MAX32); - pack_length= type_handler()->calc_pack_length((uint32) length); - } - void create_length_to_internal_length_typelib() - { - /* Pack_length already calculated in sql_parse.cc */ - length*= charset->mbmaxlen; - } - bool vers_sys_field() const - { - return flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG); - } - void create_length_to_internal_length_bit(); - void create_length_to_internal_length_newdecimal(); - - /** - Prepare a SET/ENUM field. - Create "interval" from "interval_list" if needed, and adjust "length". - @param mem_root - Memory root to allocate TYPELIB and - its values on - @param reuse_interval_list_values - determines if TYPELIB can reuse value - buffers from interval_list, or should - always allocate a copy on mem_root, - even if character set conversion - is not needed - */ - bool prepare_interval_field(MEM_ROOT *mem_root, - bool reuse_interval_list_values); - - void prepare_interval_field_calc_length() - { - uint32 field_length, dummy; - if (real_field_type() == MYSQL_TYPE_SET) - { - calculate_interval_lengths(&dummy, &field_length); - length= field_length + (interval->count - 1); - } - else /* MYSQL_TYPE_ENUM */ - { - calculate_interval_lengths(&field_length, &dummy); - length= field_length; - } - set_if_smaller(length, MAX_FIELD_WIDTH - 1); - } - - bool prepare_blob_field(THD *thd); - - bool sp_prepare_create_field(THD *thd, MEM_ROOT *mem_root); - - bool prepare_stage1(THD *thd, MEM_ROOT *mem_root, - handler *file, ulonglong table_flags); - bool prepare_stage1_typelib(THD *thd, MEM_ROOT *mem_root, - handler *file, ulonglong table_flags); - bool prepare_stage1_string(THD *thd, MEM_ROOT *mem_root, - handler *file, ulonglong table_flags); - bool prepare_stage1_bit(THD *thd, MEM_ROOT *mem_root, - handler *file, ulonglong table_flags); - - void redefine_stage1_common(const Column_definition *dup_field, - const handler *file, - const Schema_specification_st *schema); - bool redefine_stage1(const Column_definition *dup_field, const handler *file, - const Schema_specification_st *schema) - { - const Type_handler *handler= dup_field->type_handler(); - return handler->Column_definition_redefine_stage1(this, dup_field, - file, schema); - } - bool prepare_stage2(handler *handler, ulonglong table_flags); - bool prepare_stage2_blob(handler *handler, - ulonglong table_flags, uint field_flags); - bool prepare_stage2_varchar(ulonglong table_flags); - bool prepare_stage2_typelib(const char *type_name, uint field_flags, - uint *dup_val_count); - uint pack_flag_numeric() const; - uint sign_length() const { return flags & UNSIGNED_FLAG ? 0 : 1; } - bool check_length(uint mysql_errno, uint max_allowed_length) const; - bool fix_attributes_real(uint default_length); - bool fix_attributes_int(uint default_length); - bool fix_attributes_decimal(); - bool fix_attributes_temporal_with_time(uint int_part_length); - bool fix_attributes_bit(); - - bool check(THD *thd); - bool validate_check_constraint(THD *thd); - - bool stored_in_db() const { return !vcol_info || vcol_info->stored_in_db; } - - ha_storage_media field_storage_type() const - { - return (ha_storage_media) - ((flags >> FIELD_FLAGS_STORAGE_MEDIA) & 3); - } - - column_format_type column_format() const - { - return (column_format_type) - ((flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3); - } - - bool has_default_function() const - { - return unireg_check != Field::NONE; - } - - Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, - const Record_addr *addr, - const LEX_CSTRING *field_name_arg) const - { - return Column_definition_attributes::make_field(share, mem_root, addr, - type_handler(), - field_name_arg, flags); - } - Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, - const LEX_CSTRING *field_name_arg) const - { - Record_addr addr(true); - return make_field(share, mem_root, &addr, field_name_arg); - } - /* Return true if default is an expression that must be saved explicitely */ - bool has_default_expression(); - - bool has_default_now_unireg_check() const - { - return unireg_check == Field::TIMESTAMP_DN_FIELD - || unireg_check == Field::TIMESTAMP_DNUN_FIELD; - } - - void set_type(const Column_definition &other) - { - set_handler(other.type_handler()); - length= other.length; - char_length= other.char_length; - decimals= other.decimals; - flags= other.flags; - pack_length= other.pack_length; - unireg_check= other.unireg_check; - interval= other.interval; - charset= other.charset; - srid= other.srid; - pack_flag= other.pack_flag; - } - - // Replace the entire value by another definition - void set_column_definition(const Column_definition *def) - { - *this= *def; - } - bool set_compressed(const char *method); - bool set_compressed_deprecated(THD *thd, const char *method); - bool set_compressed_deprecated_column_attribute(THD *thd, - const char *pos, - const char *method); - void set_compression_method(Compression_method *compression_method_arg) - { compression_method_ptr= compression_method_arg; } - Compression_method *compression_method() const - { return compression_method_ptr; } - - bool check_vcol_for_key(THD *thd) const; -}; - - -/** - List of ROW element definitions, e.g.: - DECLARE a ROW(a INT,b VARCHAR(10)) -*/ -class Row_definition_list: public List -{ -public: - inline bool eq_name(const Spvar_definition *def, const LEX_CSTRING *name) const; - /** - Find a ROW field by name. - @param [IN] name - the name - @param [OUT] offset - if the ROW field found, its offset it returned here - @retval NULL - the ROW field was not found - @retval !NULL - the pointer to the found ROW field - */ - Spvar_definition *find_row_field_by_name(const LEX_CSTRING *name, uint *offset) const - { - // Cast-off the "const" qualifier - List_iterator it(*((List*)this)); - Spvar_definition *def; - for (*offset= 0; (def= it++); (*offset)++) - { - if (eq_name(def, name)) - return def; - } - return 0; - } - static Row_definition_list *make(MEM_ROOT *mem_root, Spvar_definition *var) - { - Row_definition_list *list; - if (!(list= new (mem_root) Row_definition_list())) - return NULL; - return list->push_back(var, mem_root) ? NULL : list; - } - bool append_uniq(MEM_ROOT *thd, Spvar_definition *var); - bool adjust_formal_params_to_actual_params(THD *thd, List *args); - bool adjust_formal_params_to_actual_params(THD *thd, - Item **args, uint arg_count); - bool resolve_type_refs(THD *); -}; - -/** - This class is used during a stored routine or a trigger execution, - at sp_rcontext::create() time. - Currently it can represent: - - variables with explicit data types: DECLARE a INT; - - variables with data type references: DECLARE a t1.a%TYPE; - - ROW type variables - - Notes: - - Scalar variables have m_field_definitions==NULL. - - ROW variables are defined as having MYSQL_TYPE_NULL, - with a non-empty m_field_definitions. - - Data type references to other object types will be added soon, e.g.: - - DECLARE a table_name%ROWTYPE; - - DECLARE a cursor_name%ROWTYPE; - - DECLARE a record_name%TYPE; - - DECLARE a variable_name%TYPE; -*/ -class Spvar_definition: public Column_definition -{ - Qualified_column_ident *m_column_type_ref; // for %TYPE - Table_ident *m_table_rowtype_ref; // for table%ROWTYPE - bool m_cursor_rowtype_ref; // for cursor%ROWTYPE - uint m_cursor_rowtype_offset; // for cursor%ROWTYPE - Row_definition_list *m_row_field_definitions; // for ROW -public: - Spvar_definition() - :m_column_type_ref(NULL), - m_table_rowtype_ref(NULL), - m_cursor_rowtype_ref(false), - m_cursor_rowtype_offset(0), - m_row_field_definitions(NULL) - { } - Spvar_definition(THD *thd, Field *field) - :Column_definition(thd, field, NULL), - m_column_type_ref(NULL), - m_table_rowtype_ref(NULL), - m_cursor_rowtype_ref(false), - m_cursor_rowtype_offset(0), - m_row_field_definitions(NULL) - { } - const Type_handler *type_handler() const - { - return Type_handler_hybrid_field_type::type_handler(); - } - bool is_column_type_ref() const { return m_column_type_ref != 0; } - bool is_table_rowtype_ref() const { return m_table_rowtype_ref != 0; } - bool is_cursor_rowtype_ref() const { return m_cursor_rowtype_ref; } - bool is_explicit_data_type() const - { - return !is_column_type_ref() && - !is_table_rowtype_ref() && - !is_cursor_rowtype_ref(); - } - Qualified_column_ident *column_type_ref() const - { - return m_column_type_ref; - } - void set_column_type_ref(Qualified_column_ident *ref) - { - m_column_type_ref= ref; - } - - Table_ident *table_rowtype_ref() const - { - return m_table_rowtype_ref; - } - void set_table_rowtype_ref(Table_ident *ref) - { - DBUG_ASSERT(ref); - set_handler(&type_handler_row); - m_table_rowtype_ref= ref; - } - - uint cursor_rowtype_offset() const - { - return m_cursor_rowtype_offset; - } - void set_cursor_rowtype_ref(uint offset) - { - set_handler(&type_handler_row); - m_cursor_rowtype_ref= true; - m_cursor_rowtype_offset= offset; - } - - /* - Find a ROW field by name. - See Row_field_list::find_row_field_by_name() for details. - */ - Spvar_definition *find_row_field_by_name(const LEX_CSTRING *name, uint *offset) const - { - DBUG_ASSERT(m_row_field_definitions); - return m_row_field_definitions->find_row_field_by_name(name, offset); - } - uint is_row() const - { - return m_row_field_definitions != NULL; - } - // Check if "this" defines a ROW variable with n elements - uint is_row(uint n) const - { - return m_row_field_definitions != NULL && - m_row_field_definitions->elements == n; - } - Row_definition_list *row_field_definitions() const - { - return m_row_field_definitions; - } - void set_row_field_definitions(Row_definition_list *list) - { - DBUG_ASSERT(list); - set_handler(&type_handler_row); - m_row_field_definitions= list; - } - -}; - - -inline bool Row_definition_list::eq_name(const Spvar_definition *def, - const LEX_CSTRING *name) const -{ - return def->field_name.length == name->length && my_strcasecmp(system_charset_info, def->field_name.str, name->str) == 0; -} - - -class Create_field :public Column_definition -{ -public: - LEX_CSTRING change; // If done with alter table - LEX_CSTRING after; // Put column after this one - Field *field; // For alter table - const TYPELIB *save_interval; // Temporary copy for the above - // Used only for UCS2 intervals - - /** structure with parsed options (for comparing fields in ALTER TABLE) */ - ha_field_option_struct *option_struct; - uint offset; - uint8 interval_id; - bool create_if_not_exists; // Used in ALTER TABLE IF NOT EXISTS - - Create_field(): - Column_definition(), - field(0), option_struct(NULL), - create_if_not_exists(false) - { - change= after= null_clex_str; - } - Create_field(THD *thd, Field *old_field, Field *orig_field): - Column_definition(thd, old_field, orig_field), - change(old_field->field_name), - field(old_field), option_struct(old_field->option_struct), - create_if_not_exists(false) - { - after= null_clex_str; - } - /* Used to make a clone of this object for ALTER/CREATE TABLE */ - Create_field *clone(MEM_ROOT *mem_root) const; -}; - - -/* - A class for sending info to the client -*/ - -class Send_field :public Sql_alloc, - public Type_handler_hybrid_field_type, - public Send_field_extended_metadata -{ -public: - LEX_CSTRING db_name; - LEX_CSTRING table_name, org_table_name; - LEX_CSTRING col_name, org_col_name; - ulong length; - uint flags, decimals; - Send_field(Field *field) - { - field->make_send_field(this); - DBUG_ASSERT(table_name.str != 0); - normalize(); - } - Send_field(THD *thd, Item *item); - Send_field(Field *field, - const LEX_CSTRING &db_name_arg, - const LEX_CSTRING &table_name_arg) - :Type_handler_hybrid_field_type(field->type_handler()), - db_name(db_name_arg), - table_name(table_name_arg), - org_table_name(table_name_arg), - col_name(field->field_name), - org_col_name(field->field_name), - length(field->field_length), - flags(field->table->maybe_null ? - (field->flags & ~NOT_NULL_FLAG) : field->flags), - decimals(field->decimals()) - { - normalize(); - } - -private: - void normalize() - { - /* limit number of decimals for float and double */ - if (type_handler()->field_type() == MYSQL_TYPE_FLOAT || - type_handler()->field_type() == MYSQL_TYPE_DOUBLE) - set_if_smaller(decimals, FLOATING_POINT_DECIMALS); - } -public: - // This should move to Type_handler eventually - uint32 max_char_length(CHARSET_INFO *cs) const - { - return type_handler()->field_type() >= MYSQL_TYPE_TINY_BLOB && - type_handler()->field_type() <= MYSQL_TYPE_BLOB - ? static_cast(length / cs->mbminlen) - : static_cast(length / cs->mbmaxlen); - } - uint32 max_octet_length(CHARSET_INFO *from, CHARSET_INFO *to) const - { - /* - For TEXT/BLOB columns, field_length describes the maximum data - length in bytes. There is no limit to the number of characters - that a TEXT column can store, as long as the data fits into - the designated space. - For the rest of textual columns, field_length is evaluated as - char_count * mbmaxlen, where character count is taken from the - definition of the column. In other words, the maximum number - of characters here is limited by the column definition. - - When one has a LONG TEXT column with a single-byte - character set, and the connection character set is multi-byte, the - client may get fields longer than UINT_MAX32, due to - -> conversion. - In that case column max length would not fit into the 4 bytes - reserved for it in the protocol. So we cut it here to UINT_MAX32. - */ - return char_to_byte_length_safe(max_char_length(from), to->mbmaxlen); - } - - // This should move to Type_handler eventually - bool is_sane_float() const - { - return (decimals <= FLOATING_POINT_DECIMALS || - (type_handler()->field_type() != MYSQL_TYPE_FLOAT && - type_handler()->field_type() != MYSQL_TYPE_DOUBLE)); - } - bool is_sane_signess() const - { - if (type_handler() == type_handler()->type_handler_signed() && - type_handler() == type_handler()->type_handler_unsigned()) - return true; // Any signess is allowed, e.g. DOUBLE, DECIMAL - /* - We are here e.g. in case of INT data type. - The UNSIGNED_FLAG bit must match in flags and in the type handler. - */ - return ((bool) (flags & UNSIGNED_FLAG)) == type_handler()->is_unsigned(); - } - bool is_sane() const - { - return is_sane_float() && is_sane_signess(); - } -}; - - -/* - A class for quick copying data to fields -*/ - -class Copy_field :public Sql_alloc { -public: - uchar *from_ptr,*to_ptr; - uchar *from_null_ptr,*to_null_ptr; - bool *null_row; - uint from_bit,to_bit; - /** - Number of bytes in the fields pointed to by 'from_ptr' and - 'to_ptr'. Usually this is the number of bytes that are copied from - 'from_ptr' to 'to_ptr'. - - For variable-length fields (VARCHAR), the first byte(s) describe - the actual length of the text. For VARCHARs with length - < 256 there is 1 length byte - >= 256 there is 2 length bytes - Thus, if from_field is VARCHAR(10), from_length (and in most cases - to_length) is 11. For VARCHAR(1024), the length is 1026. @see - Field_varstring::length_bytes - - Note that for VARCHARs, do_copy() will be do_varstring*() which - only copies the length-bytes (1 or 2) + the actual length of the - text instead of from/to_length bytes. - */ - uint from_length,to_length; - Field *from_field,*to_field; - String tmp; // For items - - Copy_field() {} - ~Copy_field() {} - void set(Field *to,Field *from,bool save); // Field to field - void set(uchar *to,Field *from); // Field to string - void (*do_copy)(Copy_field *); - void (*do_copy2)(Copy_field *); // Used to handle null values -}; - - -uint pack_length_to_packflag(uint type); -enum_field_types get_blob_type_from_length(ulong length); -int set_field_to_null(Field *field); -int set_field_to_null_with_conversions(Field *field, bool no_conversions); -int convert_null_to_field_value_or_error(Field *field); -bool check_expression(Virtual_column_info *vcol, const LEX_CSTRING *name, - enum_vcol_info_type type, Alter_info *alter_info= NULL); - -/* - The following are for the interface with the .frm file -*/ - -#define FIELDFLAG_DECIMAL 1U -#define FIELDFLAG_BINARY 1U // Shares same flag -#define FIELDFLAG_NUMBER 2U -#define FIELDFLAG_ZEROFILL 4U -#define FIELDFLAG_PACK 120U // Bits used for packing -#define FIELDFLAG_INTERVAL 256U // mangled with decimals! -#define FIELDFLAG_BITFIELD 512U // mangled with decimals! -#define FIELDFLAG_BLOB 1024U // mangled with decimals! -#define FIELDFLAG_GEOM 2048U // mangled with decimals! - -#define FIELDFLAG_TREAT_BIT_AS_CHAR 4096U /* use Field_bit_as_char */ -#define FIELDFLAG_LONG_DECIMAL 8192U -#define FIELDFLAG_NO_DEFAULT 16384U /* sql */ -#define FIELDFLAG_MAYBE_NULL 32768U // sql -#define FIELDFLAG_HEX_ESCAPE 0x10000U -#define FIELDFLAG_PACK_SHIFT 3 -#define FIELDFLAG_DEC_SHIFT 8 -#define FIELDFLAG_MAX_DEC 63U - -#define FIELDFLAG_DEC_MASK 0x3F00U - -#define MTYP_TYPENR(type) ((type) & 127U) // Remove bits from type - -#define f_is_dec(x) ((x) & FIELDFLAG_DECIMAL) -#define f_is_num(x) ((x) & FIELDFLAG_NUMBER) -#define f_is_zerofill(x) ((x) & FIELDFLAG_ZEROFILL) -#define f_is_packed(x) ((x) & FIELDFLAG_PACK) -#define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15) -#define f_decimals(x) ((uint8) (((x) >> FIELDFLAG_DEC_SHIFT) & FIELDFLAG_MAX_DEC)) -#define f_is_alpha(x) (!f_is_num(x)) -#define f_is_binary(x) ((x) & FIELDFLAG_BINARY) // 4.0- compatibility -#define f_is_enum(x) (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == FIELDFLAG_INTERVAL) -#define f_is_bitfield(x) (((x) & (FIELDFLAG_BITFIELD | FIELDFLAG_NUMBER)) == FIELDFLAG_BITFIELD) -#define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB) -#define f_is_geom(x) (((x) & (FIELDFLAG_GEOM | FIELDFLAG_NUMBER)) == FIELDFLAG_GEOM) -#define f_settype(x) (((uint) (x)) << FIELDFLAG_PACK_SHIFT) -#define f_maybe_null(x) ((x) & FIELDFLAG_MAYBE_NULL) -#define f_no_default(x) ((x) & FIELDFLAG_NO_DEFAULT) -#define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR) -#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE) -#define f_visibility(x) (static_cast ((x) & INVISIBLE_MAX_BITS)) - -inline -ulonglong TABLE::vers_end_id() const -{ - DBUG_ASSERT(versioned(VERS_TRX_ID)); - return static_cast(vers_end_field()->val_int()); -} - -inline -ulonglong TABLE::vers_start_id() const -{ - DBUG_ASSERT(versioned(VERS_TRX_ID)); - return static_cast(vers_start_field()->val_int()); -} - - -#endif /* FIELD_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/field_comp.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/field_comp.h deleted file mode 100644 index 7eb8ab1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/field_comp.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef FIELD_COMP_H_INCLUDED -#define FIELD_COMP_H_INCLUDED -/* Copyright (C) 2017 MariaDB Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -#define MAX_COMPRESSION_METHODS 16 - -struct Compression_method -{ - const char *name; - uint (*compress)(THD *thd, char *to, const char *from, uint length); - int (*uncompress)(String *to, const uchar *from, uint from_length, - uint field_length); -}; - - -extern Compression_method compression_methods[MAX_COMPRESSION_METHODS]; -#define zlib_compression_method (&compression_methods[8]) - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/filesort.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/filesort.h deleted file mode 100644 index 9f71da0..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/filesort.h +++ /dev/null @@ -1,231 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef FILESORT_INCLUDED -#define FILESORT_INCLUDED - -#include "my_base.h" /* ha_rows */ -#include "sql_alloc.h" -#include "filesort_utils.h" - -class SQL_SELECT; -class THD; -struct TABLE; -class Filesort_tracker; -struct SORT_FIELD; -struct SORT_FIELD_ATTR; -typedef struct st_order ORDER; -class JOIN; -class Addon_fields; -class Sort_keys; - - -/** - Sorting related info. - To be extended by another WL to include complete filesort implementation. -*/ -class Filesort: public Sql_alloc -{ -public: - /** List of expressions to order the table by */ - ORDER *order; - /** Number of records to return */ - ha_rows limit; - /** ORDER BY list with some precalculated info for filesort */ - SORT_FIELD *sortorder; - /** select to use for getting records */ - SQL_SELECT *select; - /** TRUE <=> free select on destruction */ - bool own_select; - /** true means we are using Priority Queue for order by with limit. */ - bool using_pq; - - /* - TRUE means sort operation must produce table rowids. - FALSE means that it halso has an option of producing {sort_key, - addon_fields} pairs. - */ - bool sort_positions; - - Filesort_tracker *tracker; - Sort_keys *sort_keys; - - Filesort(ORDER *order_arg, ha_rows limit_arg, bool sort_positions_arg, - SQL_SELECT *select_arg): - order(order_arg), - limit(limit_arg), - sortorder(NULL), - select(select_arg), - own_select(false), - using_pq(false), - sort_positions(sort_positions_arg), - sort_keys(NULL) - { - DBUG_ASSERT(order); - }; - - ~Filesort() { cleanup(); } - /* Prepare ORDER BY list for sorting. */ - Sort_keys* make_sortorder(THD *thd, JOIN *join, table_map first_table_bit); - -private: - void cleanup(); -}; - - -class SORT_INFO -{ - /// Buffer for sorting keys. - Filesort_buffer filesort_buffer; - -public: - SORT_INFO() - :addon_fields(NULL), record_pointers(0), - sort_keys(NULL), - sorted_result_in_fsbuf(FALSE) - { - buffpek.str= 0; - my_b_clear(&io_cache); - } - - ~SORT_INFO(); - - void free_data() - { - close_cached_file(&io_cache); - free_addon_buff(); - my_free(record_pointers); - my_free(buffpek.str); - my_free(addon_fields); - free_sort_buffer(); - } - - void reset() - { - free_data(); - record_pointers= 0; - buffpek.str= 0; - addon_fields= 0; - sorted_result_in_fsbuf= false; - } - - void free_addon_buff(); - - IO_CACHE io_cache; /* If sorted through filesort */ - LEX_STRING buffpek; /* Buffer for buffpek structures */ - Addon_fields *addon_fields; /* Addon field descriptors */ - uchar *record_pointers; /* If sorted in memory */ - Sort_keys *sort_keys; /* Sort key descriptors*/ - - /** - If the entire result of filesort fits in memory, we skip the merge phase. - We may leave the result in filesort_buffer - (indicated by sorted_result_in_fsbuf), or we may strip away - the sort keys, and copy the sorted result into a new buffer. - @see save_index() - */ - bool sorted_result_in_fsbuf; - - /* - How many rows in final result. - Also how many rows in record_pointers, if used - */ - ha_rows return_rows; - ha_rows examined_rows; /* How many rows read */ - ha_rows found_rows; /* How many rows was accepted */ - - /** Sort filesort_buffer */ - void sort_buffer(Sort_param *param, uint count) - { filesort_buffer.sort_buffer(param, count); } - - uchar **get_sort_keys() - { return filesort_buffer.get_sort_keys(); } - - uchar *get_sorted_record(uint ix) - { return filesort_buffer.get_sorted_record(ix); } - - uchar *alloc_sort_buffer(uint num_records, uint record_length) - { return filesort_buffer.alloc_sort_buffer(num_records, record_length); } - - void free_sort_buffer() - { filesort_buffer.free_sort_buffer(); } - - bool isfull() const - { return filesort_buffer.isfull(); } - void init_record_pointers() - { filesort_buffer.init_record_pointers(); } - void init_next_record_pointer() - { filesort_buffer.init_next_record_pointer(); } - uchar *get_next_record_pointer() - { return filesort_buffer.get_next_record_pointer(); } - void adjust_next_record_pointer(uint val) - { filesort_buffer.adjust_next_record_pointer(val); } - - Bounds_checked_array get_raw_buf() - { return filesort_buffer.get_raw_buf(); } - - size_t sort_buffer_size() const - { return filesort_buffer.sort_buffer_size(); } - - bool is_allocated() const - { return filesort_buffer.is_allocated(); } - void set_sort_length(uint val) - { filesort_buffer.set_sort_length(val); } - uint get_sort_length() const - { return filesort_buffer.get_sort_length(); } - - bool has_filesort_result_in_memory() const - { - return record_pointers || sorted_result_in_fsbuf; - } - - /// Are we using "addon fields"? - bool using_addon_fields() const - { - return addon_fields != NULL; - } - - /// Are we using "packed addon fields"? - bool using_packed_addons(); - - /** - Copies (unpacks) values appended to sorted fields from a buffer back to - their regular positions specified by the Field::ptr pointers. - @param buff Buffer which to unpack the value from - */ - template - inline void unpack_addon_fields(uchar *buff); - - bool using_packed_sortkeys(); - - friend SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort, - Filesort_tracker* tracker, JOIN *join, - table_map first_table_bit); -}; - -SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort, - Filesort_tracker* tracker, JOIN *join=NULL, - table_map first_table_bit=0); - -bool filesort_use_addons(TABLE *table, uint sortlength, - uint *length, uint *fields, uint *null_fields, - uint *m_packable_length); - -void change_double_for_sort(double nr,uchar *to); -void store_length(uchar *to, uint length, uint pack_length); -void -reverse_key(uchar *to, const SORT_FIELD_ATTR *sort_field); - -#endif /* FILESORT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/filesort_utils.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/filesort_utils.h deleted file mode 100644 index 1962f14..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/filesort_utils.h +++ /dev/null @@ -1,286 +0,0 @@ -/* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef FILESORT_UTILS_INCLUDED -#define FILESORT_UTILS_INCLUDED - -#include "my_base.h" -#include "sql_array.h" - -class Sort_param; -/* - Calculate cost of merge sort - - @param num_rows Total number of rows. - @param num_keys_per_buffer Number of keys per buffer. - @param elem_size Size of each element. - - Calculates cost of merge sort by simulating call to merge_many_buff(). - - @retval - Computed cost of merge sort in disk seeks. - - @note - Declared here in order to be able to unit test it, - since library dependencies have not been sorted out yet. - - See also comments get_merge_many_buffs_cost(). -*/ - -double get_merge_many_buffs_cost_fast(ha_rows num_rows, - ha_rows num_keys_per_buffer, - uint elem_size); - - -/** - A wrapper class around the buffer used by filesort(). - The sort buffer is a contiguous chunk of memory, - containing both records to be sorted, and pointers to said records: - - - |rec 0|record 1 |rec 2| ............ |ptr to rec2|ptr to rec1|ptr to rec0| - - Records will be inserted "left-to-right". Records are not necessarily - fixed-size, they can be packed and stored without any "gaps". - - Record pointers will be inserted "right-to-left", as a side-effect - of inserting the actual records. - - We wrap the buffer in order to be able to do lazy initialization of the - pointers: the buffer is often much larger than what we actually need. - - With this allocation scheme, and lazy initialization of the pointers, - we are able to pack variable-sized records in the buffer, - and thus possibly have space for more records than we initially estimated. - - The buffer must be kept available for multiple executions of the - same sort operation, so we have explicit allocate and free functions, - rather than doing alloc/free in CTOR/DTOR. -*/ - -class Filesort_buffer -{ -public: - Filesort_buffer() : - m_next_rec_ptr(NULL), m_rawmem(NULL), m_record_pointers(NULL), - m_sort_keys(NULL), - m_num_records(0), m_record_length(0), - m_sort_length(0), - m_size_in_bytes(0), m_idx(0) - {} - - /** Sort me... */ - void sort_buffer(const Sort_param *param, uint count); - - /** - Reverses the record pointer array, to avoid recording new results for - non-deterministic mtr tests. - */ - void reverse_record_pointers() - { - if (m_idx < 2) // There is nothing to swap. - return; - uchar **keys= get_sort_keys(); - const longlong count= m_idx - 1; - for (longlong ix= 0; ix <= count/2; ++ix) - { - uchar *tmp= keys[count - ix]; - keys[count - ix] = keys[ix]; - keys[ix]= tmp; - } - } - - /** - Initializes all the record pointers. - */ - void init_record_pointers() - { - init_next_record_pointer(); - while (m_idx < m_num_records) - (void) get_next_record_pointer(); - reverse_record_pointers(); - } - - /** - Prepares the buffer for the next batch of records to process. - */ - void init_next_record_pointer() - { - m_idx= 0; - m_next_rec_ptr= m_rawmem; - m_sort_keys= NULL; - } - - /** - @returns the number of bytes currently in use for data. - */ - size_t space_used_for_data() const - { - return m_next_rec_ptr ? m_next_rec_ptr - m_rawmem : 0; - } - - /** - @returns the number of bytes left in the buffer. - */ - size_t spaceleft() const - { - DBUG_ASSERT(m_next_rec_ptr >= m_rawmem); - const size_t spaceused= - (m_next_rec_ptr - m_rawmem) + - (static_cast(m_idx) * sizeof(uchar*)); - return m_size_in_bytes - spaceused; - } - - /** - Is the buffer full? - */ - bool isfull() const - { - if (m_idx < m_num_records) - return false; - return spaceleft() < (m_record_length + sizeof(uchar*)); - } - - /** - Where should the next record be stored? - */ - uchar *get_next_record_pointer() - { - uchar *retval= m_next_rec_ptr; - // Save the return value in the record pointer array. - m_record_pointers[-m_idx]= m_next_rec_ptr; - // Prepare for the subsequent request. - m_idx++; - m_next_rec_ptr+= m_record_length; - return retval; - } - - /** - Adjusts for actual record length. get_next_record_pointer() above was - pessimistic, and assumed that the record could not be packed. - */ - void adjust_next_record_pointer(uint val) - { - m_next_rec_ptr-= (m_record_length - val); - } - - /// Returns total size: pointer array + record buffers. - size_t sort_buffer_size() const - { - return m_size_in_bytes; - } - - bool is_allocated() const - { - return m_rawmem; - } - - /** - Allocates the buffer, but does *not* initialize pointers. - Total size = (num_records * record_length) + (num_records * sizeof(pointer)) - space for records space for pointer to records - Caller is responsible for raising an error if allocation fails. - - @param num_records Number of records. - @param record_length (maximum) size of each record. - @returns Pointer to allocated area, or NULL in case of out-of-memory. - */ - uchar *alloc_sort_buffer(uint num_records, uint record_length); - - /// Frees the buffer. - void free_sort_buffer(); - - void reset() - { - m_rawmem= NULL; - } - /** - Used to access the "right-to-left" array of record pointers as an ordinary - "left-to-right" array, so that we can pass it directly on to std::sort(). - */ - uchar **get_sort_keys() - { - if (m_idx == 0) - return NULL; - return &m_record_pointers[1 - m_idx]; - } - - /** - Gets sorted record number ix. @see get_sort_keys() - Only valid after buffer has been sorted! - */ - uchar *get_sorted_record(uint ix) - { - return m_sort_keys[ix]; - } - - /** - @returns The entire buffer, as a character array. - This is for reusing the memory for merge buffers. - */ - Bounds_checked_array get_raw_buf() - { - return Bounds_checked_array(m_rawmem, m_size_in_bytes); - } - - /** - We need an assignment operator, see filesort(). - This happens to have the same semantics as the one that would be - generated by the compiler. We still implement it here, to show shallow - assignment explicitly: we have two objects sharing the same array. - */ - Filesort_buffer &operator=(const Filesort_buffer &rhs) - { - m_next_rec_ptr= rhs.m_next_rec_ptr; - m_rawmem= rhs.m_rawmem; - m_record_pointers= rhs.m_record_pointers; - m_sort_keys= rhs.m_sort_keys; - m_num_records= rhs.m_num_records; - m_record_length= rhs.m_record_length; - m_sort_length= rhs.m_sort_length; - m_size_in_bytes= rhs.m_size_in_bytes; - m_idx= rhs.m_idx; - return *this; - } - - uint get_sort_length() const { return m_sort_length; } - void set_sort_length(uint val) { m_sort_length= val; } - -private: - uchar *m_next_rec_ptr; /// The next record will be inserted here. - uchar *m_rawmem; /// The raw memory buffer. - uchar **m_record_pointers; /// The "right-to-left" array of record pointers. - uchar **m_sort_keys; /// Caches the value of get_sort_keys() - uint m_num_records; /// Saved value from alloc_sort_buffer() - uint m_record_length; /// Saved value from alloc_sort_buffer() - uint m_sort_length; /// The length of the sort key. - size_t m_size_in_bytes; /// Size of raw buffer, in bytes. - - /** - This is the index in the "right-to-left" array of the next record to - be inserted into the buffer. It is signed, because we use it in signed - expressions like: - m_record_pointers[-m_idx]; - It is longlong rather than int, to ensure that it covers UINT_MAX32 - without any casting/warning. - */ - longlong m_idx; -}; - -int compare_packed_sort_keys(void *sort_keys, unsigned char **a, - unsigned char **b); -qsort2_cmp get_packed_keys_compare_ptr(); - -#endif // FILESORT_UTILS_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ft_global.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/ft_global.h deleted file mode 100644 index 725363c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ft_global.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright (c) 2000-2005, 2007 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Written by Sergei A. Golubchik, who has a shared copyright to this code */ - -/* some definitions for full-text indices */ - -/* #include "myisam.h" */ - -#ifndef _ft_global_h -#define _ft_global_h -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define HA_FT_MAXBYTELEN 254 -#define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN/3) - -#define DEFAULT_FTB_SYNTAX "+ -><()~*:\"\"&|" - -typedef struct st_ft_info FT_INFO; -struct _ft_vft -{ - int (*read_next)(FT_INFO *, char *); - float (*find_relevance)(FT_INFO *, uchar *, uint); - void (*close_search)(FT_INFO *); - float (*get_relevance)(FT_INFO *); - void (*reinit_search)(FT_INFO *); -}; - -typedef struct st_ft_info_ext FT_INFO_EXT; -struct _ft_vft_ext -{ - uint (*get_version)(); // Extended API version - ulonglong (*get_flags)(); - ulonglong (*get_docid)(FT_INFO_EXT *); - ulonglong (*count_matches)(FT_INFO_EXT *); -}; - -/* Flags for extended FT API */ -#define FTS_ORDERED_RESULT (1LL << 1) -#define FTS_DOCID_IN_RESULT (1LL << 2) - -#define FTS_DOC_ID_COL_NAME "FTS_DOC_ID" - -#ifndef FT_CORE -struct st_ft_info -{ - struct _ft_vft *please; /* INTERCAL style :-) */ -}; - -struct st_ft_info_ext -{ - struct _ft_vft *please; /* INTERCAL style :-) */ - struct _ft_vft_ext *could_you; -}; -#endif - -extern const char *ft_stopword_file; -extern const char *ft_precompiled_stopwords[]; - -extern ulong ft_min_word_len; -extern ulong ft_max_word_len; -extern ulong ft_query_expansion_limit; -extern const char *ft_boolean_syntax; -extern struct st_mysql_ftparser ft_default_parser; - -int ft_init_stopwords(void); -void ft_free_stopwords(void); - -#define FT_NL 0 -#define FT_BOOL 1 -#define FT_SORTED 2 -#define FT_EXPAND 4 /* query expansion */ - -FT_INFO *ft_init_search(uint,void *, uint, uchar *, size_t, - CHARSET_INFO *, uchar *); -my_bool ft_boolean_check_syntax_string(const uchar *); - -/* Internal symbols for fulltext between maria and MyISAM */ - -#define HA_FT_WTYPE HA_KEYTYPE_FLOAT -#define HA_FT_WLEN 4 -#define FT_SEGS 2 - -#define ft_sintXkorr(A) mi_sint4korr(A) -#define ft_intXstore(T,A) mi_int4store(T,A) - -extern const HA_KEYSEG ft_keysegs[FT_SEGS]; - -typedef union {int32 i; float f;} FT_WEIGTH; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/gcalc_slicescan.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/gcalc_slicescan.h deleted file mode 100644 index b5188f2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/gcalc_slicescan.h +++ /dev/null @@ -1,607 +0,0 @@ -/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved. - Copyright (C) 2011 Monty Program Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef GCALC_SLICESCAN_INCLUDED -#define GCALC_SLICESCAN_INCLUDED - -#ifndef DBUG_OFF -// #define GCALC_CHECK_WITH_FLOAT -#else -#define GCALC_DBUG_OFF -#endif /*DBUG_OFF*/ - -#ifndef GCALC_DBUG_OFF -#define GCALC_DBUG_PRINT(b) DBUG_PRINT("Gcalc", b) -#define GCALC_DBUG_ENTER(a) DBUG_ENTER("Gcalc " a) -#define GCALC_DBUG_RETURN(r) DBUG_RETURN(r) -#define GCALC_DBUG_VOID_RETURN DBUG_VOID_RETURN -#define GCALC_DBUG_ASSERT(r) DBUG_ASSERT(r) -#else -#define GCALC_DBUG_PRINT(b) do {} while(0) -#define GCALC_DBUG_ENTER(a) do {} while(0) -#define GCALC_DBUG_RETURN(r) return (r) -#define GCALC_DBUG_VOID_RETURN do {} while(0) -#define GCALC_DBUG_ASSERT(r) do {} while(0) -#endif /*GCALC_DBUG_OFF*/ - -#define GCALC_TERMINATED(state_var) (state_var && (*state_var)) -#define GCALC_SET_TERMINATED(state_var, val) state_var= val -#define GCALC_DECL_TERMINATED_STATE(varname) \ - volatile int *varname; - -/* - Gcalc_dyn_list class designed to manage long lists of same-size objects - with the possible efficiency. - It allocates fixed-size blocks of memory (blk_size specified at the time - of creation). When new object is added to the list, it occupies part of - this block until it's full. Then the new block is allocated. - Freed objects are chained to the m_free list, and if it's not empty, the - newly added object is taken from this list instead the block. -*/ - -class Gcalc_dyn_list -{ -public: - class Item - { - public: - Item *next; - }; - - Gcalc_dyn_list(size_t blk_size, size_t sizeof_item); - Gcalc_dyn_list(const Gcalc_dyn_list &dl); - ~Gcalc_dyn_list(); - Item *new_item() - { - Item *result; - if (m_free) - { - result= m_free; - m_free= m_free->next; - } - else - result= alloc_new_blk(); - - return result; - } - inline void free_item(Item *item) - { - item->next= m_free; - m_free= item; - } - inline void free_list(Item **list, Item **hook) - { - *hook= m_free; - m_free= *list; - } - - void free_list(Item *list) - { - Item **hook= &list; - while (*hook) - hook= &(*hook)->next; - free_list(&list, hook); - } - - void reset(); - void cleanup(); - -protected: - size_t m_blk_size; - size_t m_sizeof_item; - unsigned int m_points_per_blk; - void *m_first_blk; - void **m_blk_hook; - Item *m_free; - Item *m_keep; - - Item *alloc_new_blk(); - void format_blk(void* block); - inline Item *ptr_add(Item *ptr, int n_items) - { - return (Item *)(((char*)ptr) + n_items * m_sizeof_item); - } -}; - -/* Internal Gcalc coordinates to provide the precise calculations */ - -#define GCALC_DIG_BASE 1000000000 -typedef uint32 gcalc_digit_t; -typedef unsigned long long gcalc_coord2; -typedef gcalc_digit_t Gcalc_internal_coord; -#define GCALC_COORD_BASE 2 -#define GCALC_COORD_BASE2 4 -#define GCALC_COORD_BASE3 6 -#define GCALC_COORD_BASE4 8 -#define GCALC_COORD_BASE5 10 - -typedef gcalc_digit_t Gcalc_coord1[GCALC_COORD_BASE]; -typedef gcalc_digit_t Gcalc_coord2[GCALC_COORD_BASE*2]; -typedef gcalc_digit_t Gcalc_coord3[GCALC_COORD_BASE*3]; - - -void gcalc_mul_coord(Gcalc_internal_coord *result, int result_len, - const Gcalc_internal_coord *a, int a_len, - const Gcalc_internal_coord *b, int b_len); - -void gcalc_add_coord(Gcalc_internal_coord *result, int result_len, - const Gcalc_internal_coord *a, - const Gcalc_internal_coord *b); - -void gcalc_sub_coord(Gcalc_internal_coord *result, int result_len, - const Gcalc_internal_coord *a, - const Gcalc_internal_coord *b); - -int gcalc_cmp_coord(const Gcalc_internal_coord *a, - const Gcalc_internal_coord *b, int len); - -/* Internal coordinates declarations end. */ - - -typedef uint gcalc_shape_info; - -/* - Gcalc_heap represents the 'dynamic list' of Info objects, that - contain information about vertexes of all the shapes that take - part in some spatial calculation. Can become quite long. - After filled, the list is usually sorted and then walked through - in the slicescan algorithm. - The Gcalc_heap and the algorithm can only operate with two - kinds of shapes - polygon and polyline. So all the spatial - objects should be represented as sets of these two. -*/ - -class Gcalc_heap : public Gcalc_dyn_list -{ -public: - enum node_type - { - nt_shape_node, - nt_intersection, - nt_eq_node - }; - class Info : public Gcalc_dyn_list::Item - { - public: - node_type type; - union - { - struct - { - /* nt_shape_node */ - gcalc_shape_info shape; - Info *left; - Info *right; - double x,y; - Gcalc_coord1 ix, iy; - int top_node; - } shape; - struct - { - /* nt_intersection */ - /* Line p1-p2 supposed to intersect line p3-p4 */ - const Info *p1; - const Info *p2; - const Info *p3; - const Info *p4; - void *data; - int equal; - } intersection; - struct - { - /* nt_eq_node */ - const Info *node; - void *data; - } eq; - } node; - - bool is_bottom() const - { GCALC_DBUG_ASSERT(type == nt_shape_node); return !node.shape.left; } - bool is_top() const - { GCALC_DBUG_ASSERT(type == nt_shape_node); return node.shape.top_node; } - bool is_single_node() const - { return is_bottom() && is_top(); } - - void calc_xy(double *x, double *y) const; - int equal_pi(const Info *pi) const; -#ifdef GCALC_CHECK_WITH_FLOAT - void calc_xy_ld(long double *x, long double *y) const; -#endif /*GCALC_CHECK_WITH_FLOAT*/ - - Info *get_next() { return (Info *)next; } - const Info *get_next() const { return (const Info *)next; } - }; - - Gcalc_heap(size_t blk_size=8192) : - Gcalc_dyn_list(blk_size, sizeof(Info)), - m_hook(&m_first), m_n_points(0) - {} - - Gcalc_heap(const Gcalc_heap &gh) : - Gcalc_dyn_list(gh), - m_hook(&m_first), m_n_points(0) - {} - - void set_extent(double xmin, double xmax, double ymin, double ymax); - Info *new_point_info(double x, double y, gcalc_shape_info shape); - void free_point_info(Info *i, Gcalc_dyn_list::Item **i_hook); - Info *new_intersection(const Info *p1, const Info *p2, - const Info *p3, const Info *p4); - void prepare_operation(); - inline bool ready() const { return m_hook == NULL; } - Info *get_first() { return (Info *)m_first; } - const Info *get_first() const { return (const Info *)m_first; } - Gcalc_dyn_list::Item **get_last_hook() { return m_hook; } - void reset(); -#ifdef GCALC_CHECK_WITH_FLOAT - long double get_double(const Gcalc_internal_coord *c) const; -#endif /*GCALC_CHECK_WITH_FLOAT*/ - double coord_extent; - Gcalc_dyn_list::Item **get_cur_hook() { return m_hook; } - -private: - Gcalc_dyn_list::Item *m_first; - Gcalc_dyn_list::Item **m_hook; - int m_n_points; -}; - - -/* - the spatial object has to be represented as a set of - simple polygones and polylines to be sent to the slicescan. - - Gcalc_shape_transporter class and his descendants are used to - simplify storing the information about the shape into necessary structures. - This base class only fills the Gcalc_heap with the information about - shapes and vertices. - - Normally the Gcalc_shape_transporter family object is sent as a parameter - to the 'get_shapes' method of an 'spatial' object so it can pass - the spatial information about itself. The virtual methods are - treating this data in a way the caller needs. -*/ - -class Gcalc_shape_transporter -{ -private: - Gcalc_heap::Info *m_first; - Gcalc_heap::Info *m_prev; - Gcalc_dyn_list::Item **m_prev_hook; - int m_shape_started; - void int_complete(); -protected: - Gcalc_heap *m_heap; - int int_single_point(gcalc_shape_info Info, double x, double y); - int int_add_point(gcalc_shape_info Info, double x, double y); - void int_start_line() - { - DBUG_ASSERT(!m_shape_started); - m_shape_started= 1; - m_first= m_prev= NULL; - } - void int_complete_line() - { - DBUG_ASSERT(m_shape_started== 1); - int_complete(); - m_shape_started= 0; - } - void int_start_ring() - { - DBUG_ASSERT(m_shape_started== 2); - m_shape_started= 3; - m_first= m_prev= NULL; - } - void int_complete_ring() - { - DBUG_ASSERT(m_shape_started== 3); - int_complete(); - m_shape_started= 2; - } - void int_start_poly() - { - DBUG_ASSERT(!m_shape_started); - m_shape_started= 2; - } - void int_complete_poly() - { - DBUG_ASSERT(m_shape_started== 2); - m_shape_started= 0; - } - bool line_started() { return m_shape_started == 1; }; -public: - Gcalc_shape_transporter(Gcalc_heap *heap) : - m_shape_started(0), m_heap(heap) {} - - virtual int single_point(double x, double y)=0; - virtual int start_line()=0; - virtual int complete_line()=0; - virtual int start_poly()=0; - virtual int complete_poly()=0; - virtual int start_ring()=0; - virtual int complete_ring()=0; - virtual int add_point(double x, double y)=0; - virtual int start_collection(int n_objects) { return 0; } - virtual int empty_shape() { return 0; } - int start_simple_poly() - { - return start_poly() || start_ring(); - } - int complete_simple_poly() - { - return complete_ring() || complete_poly(); - } - virtual ~Gcalc_shape_transporter() {} -}; - - -enum Gcalc_scan_events -{ - scev_none= 0, - scev_point= 1, /* Just a new point in thread */ - scev_thread= 2, /* Start of the new thread */ - scev_two_threads= 4, /* A couple of new threads started */ - scev_intersection= 8, /* Intersection happened */ - scev_end= 16, /* Single thread finished */ - scev_two_ends= 32, /* A couple of threads finished */ - scev_single_point= 64 /* Got single point */ -}; - - -/* - Gcalc_scan_iterator incapsulates the slicescan algorithm. - It takes filled Gcalc_heap as a datasource. Then can be - iterated through the vertexes and intersection points with - the step() method. After the 'step()' one usually observes - the current 'slice' to do the necessary calculations, like - looking for intersections, calculating the area, whatever. -*/ - -class Gcalc_scan_iterator : public Gcalc_dyn_list -{ -public: - class point : public Gcalc_dyn_list::Item - { - public: - Gcalc_coord1 dx; - Gcalc_coord1 dy; - Gcalc_heap::Info *pi; - Gcalc_heap::Info *next_pi; - Gcalc_heap::Info *ev_pi; - const Gcalc_coord1 *l_border; - const Gcalc_coord1 *r_border; - point *ev_next; - - Gcalc_scan_events event; - - inline const point *c_get_next() const - { return (const point *)next; } - inline bool is_bottom() const { return !next_pi; } - gcalc_shape_info get_shape() const { return pi->node.shape.shape; } - inline point *get_next() { return (point *)next; } - inline const point *get_next() const { return (const point *)next; } - /* Compare the dx_dy parameters regarding the horiz_dir */ - /* returns -1 if less, 0 if equal, 1 if bigger */ - static int cmp_dx_dy(const Gcalc_coord1 dx_a, - const Gcalc_coord1 dy_a, - const Gcalc_coord1 dx_b, - const Gcalc_coord1 dy_b); - static int cmp_dx_dy(const Gcalc_heap::Info *p1, - const Gcalc_heap::Info *p2, - const Gcalc_heap::Info *p3, - const Gcalc_heap::Info *p4); - int cmp_dx_dy(const point *p) const; - point **next_ptr() { return (point **) &next; } -#ifndef GCALC_DBUG_OFF - unsigned int thread; -#endif /*GCALC_DBUG_OFF*/ -#ifdef GCALC_CHECK_WITH_FLOAT - void calc_x(long double *x, long double y, long double ix) const; -#endif /*GCALC_CHECK_WITH_FLOAT*/ - }; - - /* That class introduced mostly for the 'typecontrol' reason. */ - /* only difference from the point classis the get_next() function. */ - class event_point : public point - { - public: - inline const event_point *get_next() const - { return (const event_point*) ev_next; } - int simple_event() const - { - return !ev_next ? (event & (scev_point | scev_end)) : - (!ev_next->ev_next && event == scev_two_ends); - } - }; - - class intersection_info : public Gcalc_dyn_list::Item - { - public: - point *edge_a; - point *edge_b; - - Gcalc_coord2 t_a; - Gcalc_coord2 t_b; - int t_calculated; - Gcalc_coord3 x_exp; - int x_calculated; - Gcalc_coord3 y_exp; - int y_calculated; - void calc_t() - {if (!t_calculated) do_calc_t(); } - void calc_y_exp() - { if (!y_calculated) do_calc_y(); } - void calc_x_exp() - { if (!x_calculated) do_calc_x(); } - - void do_calc_t(); - void do_calc_x(); - void do_calc_y(); - }; - - - class slice_state - { - public: - point *slice; - point **event_position_hook; - point *event_end; - const Gcalc_heap::Info *pi; - }; - -public: - Gcalc_scan_iterator(size_t blk_size= 8192); - - GCALC_DECL_TERMINATED_STATE(killed) - - void init(Gcalc_heap *points); /* Iterator can be reused */ - void reset(); - int step(); - - Gcalc_heap::Info *more_points() { return m_cur_pi; } - bool more_trapezoids() - { return m_cur_pi && m_cur_pi->next; } - - const point *get_bottom_points() const - { return m_bottom_points; } - const point *get_event_position() const - { return *state.event_position_hook; } - const point *get_event_end() const - { return state.event_end; } - const event_point *get_events() const - { return (const event_point *) - (*state.event_position_hook == state.event_end ? - m_bottom_points : *state.event_position_hook); } - const point *get_b_slice() const { return state.slice; } - double get_h() const; - double get_y() const; - double get_event_x() const; - double get_sp_x(const point *sp) const; - int intersection_step() const - { return state.pi->type == Gcalc_heap::nt_intersection; } - const Gcalc_heap::Info *get_cur_pi() const - { - return state.pi; - } - -private: - Gcalc_heap *m_heap; - Gcalc_heap::Info *m_cur_pi; - slice_state state; - -#ifndef GCALC_DBUG_OFF - unsigned int m_cur_thread; -#endif /*GCALC_DBUG_OFF*/ - - point *m_bottom_points; - point **m_bottom_hook; - - int node_scan(); - void eq_scan(); - void intersection_scan(); - void remove_bottom_node(); - int insert_top_node(); - int add_intersection(point *sp_a, point *sp_b, - Gcalc_heap::Info *pi_from); - int add_eq_node(Gcalc_heap::Info *node, point *sp); - int add_events_for_node(point *sp_node); - - point *new_slice_point() - { - point *new_point= (point *)new_item(); - return new_point; - } - intersection_info *new_intersection_info(point *a, point *b) - { - intersection_info *ii= (intersection_info *)new_item(); - ii->edge_a= a; - ii->edge_b= b; - ii->t_calculated= ii->x_calculated= ii->y_calculated= 0; - return ii; - } - int arrange_event(int do_sorting, int n_intersections); - static double get_pure_double(const Gcalc_internal_coord *d, int d_len); -}; - - -/* - Gcalc_trapezoid_iterator simplifies the calculations on - the current slice of the Gcalc_scan_iterator. - One can walk through the trapezoids formed between - previous and current slices. -*/ - -#ifdef TMP_BLOCK -class Gcalc_trapezoid_iterator -{ -protected: - const Gcalc_scan_iterator::point *sp0; - const Gcalc_scan_iterator::point *sp1; -public: - Gcalc_trapezoid_iterator(const Gcalc_scan_iterator *scan_i) : - sp0(scan_i->get_b_slice()), - sp1(scan_i->get_t_slice()) - {} - - inline bool more() const { return sp1 && sp1->next; } - - const Gcalc_scan_iterator::point *lt() const { return sp1; } - const Gcalc_scan_iterator::point *lb() const { return sp0; } - const Gcalc_scan_iterator::point *rb() const - { - const Gcalc_scan_iterator::point *result= sp0; - while ((result= result->c_get_next())->is_bottom()) - {} - return result; - } - const Gcalc_scan_iterator::point *rt() const - { return sp1->c_get_next(); } - - void operator++() - { - sp0= rb(); - sp1= rt(); - } -}; -#endif /*TMP_BLOCK*/ - - -/* - Gcalc_point_iterator simplifies the calculations on - the current slice of the Gcalc_scan_iterator. - One can walk through the points on the current slice. -*/ - -class Gcalc_point_iterator -{ -protected: - const Gcalc_scan_iterator::point *sp; -public: - Gcalc_point_iterator(const Gcalc_scan_iterator *scan_i): - sp(scan_i->get_b_slice()) - {} - - inline bool more() const { return sp != NULL; } - inline void operator++() { sp= sp->c_get_next(); } - inline const Gcalc_scan_iterator::point *point() const { return sp; } - inline const Gcalc_heap::Info *get_pi() const { return sp->pi; } - inline gcalc_shape_info get_shape() const { return sp->get_shape(); } - inline void restart(const Gcalc_scan_iterator *scan_i) - { sp= scan_i->get_b_slice(); } -}; - -#endif /*GCALC_SLICESCAN_INCLUDED*/ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/gcalc_tools.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/gcalc_tools.h deleted file mode 100644 index 77da791..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/gcalc_tools.h +++ /dev/null @@ -1,357 +0,0 @@ -/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved. - Copyright (C) 2011 Monty Program Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef GCALC_TOOLS_INCLUDED -#define GCALC_TOOLS_INCLUDED - -#include "gcalc_slicescan.h" -#include "sql_string.h" - - -/* - The Gcalc_function class objects are used to check for a binary relation. - The relation can be constructed with the prefix notation using predicates as - op_not (as !A) - op_union ( A || B || C... ) - op_intersection ( A && B && C ... ) - op_symdifference ( A+B+C+... == 1 ) - op_difference ( A && !(B||C||..)) - with the calls of the add_operation(operation, n_operands) method. - The relation is calculated over a set of shapes, that in turn have - to be added with the add_new_shape() method. All the 'shapes' can - be set to 0 with clear_shapes() method and single value - can be changed with the invert_state() method. - Then the value of the relation can be calculated with the count() method. - Frequently used method is find_function(Gcalc_scan_iterator it) that - iterates through the 'it' until the relation becomes TRUE. -*/ - -class Gcalc_function -{ -private: - String shapes_buffer; - String function_buffer; - int *i_states; - int *b_states; - uint32 cur_object_id; - uint n_shapes; - int count_internal(const char *cur_func, uint set_type, - const char **end); -public: - enum value - { - v_empty= 0x0000000, - v_find_t= 0x1000000, - v_find_f= 0x2000000, - v_t_found= 0x3000000, - v_f_found= 0x4000000, - v_mask= 0x7000000 - }; - enum op_type - { - op_not= 0x80000000, - op_shape= 0x00000000, - op_union= 0x10000000, - op_intersection= 0x20000000, - op_symdifference= 0x30000000, - op_difference= 0x40000000, - op_repeat= 0x50000000, - op_border= 0x60000000, - op_internals= 0x70000000, - op_false= 0x08000000, - op_any= 0x78000000 /* The mask to get any of the operations */ - }; - enum shape_type - { - shape_point= 0, - shape_line= 1, - shape_polygon= 2, - shape_hole= 3 - }; - enum count_result - { - result_false= 0, - result_true= 1, - result_unknown= 2 - }; - Gcalc_function() : n_shapes(0) {} - gcalc_shape_info add_new_shape(uint32 shape_id, shape_type shape_kind); - /* - Adds the leaf operation that returns the shape value. - Also adds the shape to the list of operands. - */ - int single_shape_op(shape_type shape_kind, gcalc_shape_info *si); - void add_operation(uint operation, uint32 n_operands); - void add_not_operation(op_type operation, uint32 n_operands); - uint32 get_next_expression_pos() { return function_buffer.length(); } - void add_operands_to_op(uint32 operation_pos, uint32 n_operands); - int repeat_expression(uint32 exp_pos); - void set_cur_obj(uint32 cur_obj) { cur_object_id= cur_obj; } - int reserve_shape_buffer(uint n_shapes); - int reserve_op_buffer(uint n_ops); - uint get_nshapes() const { return n_shapes; } - shape_type get_shape_kind(gcalc_shape_info si) const - { - return (shape_type) uint4korr(shapes_buffer.ptr() + (si*4)); - } - - void set_states(int *shape_states) { i_states= shape_states; } - int alloc_states(); - void invert_i_state(gcalc_shape_info shape) { i_states[shape]^= 1; } - void set_i_state(gcalc_shape_info shape) { i_states[shape]= 1; } - void clear_i_state(gcalc_shape_info shape) { i_states[shape]= 0; } - void set_b_state(gcalc_shape_info shape) { b_states[shape]= 1; } - void clear_b_state(gcalc_shape_info shape) { b_states[shape]= 0; } - int get_state(gcalc_shape_info shape) - { return i_states[shape] | b_states[shape]; } - int get_i_state(gcalc_shape_info shape) { return i_states[shape]; } - int get_b_state(gcalc_shape_info shape) { return b_states[shape]; } - int count() - { return count_internal(function_buffer.ptr(), 0, 0); } - int count_last() - { return count_internal(function_buffer.ptr(), 1, 0); } - void clear_i_states(); - void clear_b_states(); - void reset(); - - int check_function(Gcalc_scan_iterator &scan_it); -}; - - -/* - Gcalc_operation_transporter class extends the Gcalc_shape_transporter. - In addition to the parent's functionality, it fills the Gcalc_function - object so it has the function that determines the proper shape. - For example Multipolyline will be represented as an union of polylines. -*/ - -class Gcalc_operation_transporter : public Gcalc_shape_transporter -{ -protected: - Gcalc_function *m_fn; - gcalc_shape_info m_si; -public: - Gcalc_operation_transporter(Gcalc_function *fn, Gcalc_heap *heap) : - Gcalc_shape_transporter(heap), m_fn(fn) {} - - int single_point(double x, double y); - int start_line(); - int complete_line(); - int start_poly(); - int complete_poly(); - int start_ring(); - int complete_ring(); - int add_point(double x, double y); - int start_collection(int n_objects); - int empty_shape(); -}; - - -/* - When we calculate the result of an spatial operation like - Union or Intersection, we receive vertexes of the result - one-by-one, and probably need to treat them in variative ways. - So, the Gcalc_result_receiver class designed to get these - vertexes and construct shapes/objects out of them. - and to store the result in an appropriate format -*/ - -class Gcalc_result_receiver -{ - String buffer; - uint32 n_points; - Gcalc_function::shape_type common_shapetype; - bool collection_result; - uint32 n_shapes; - uint32 n_holes; - - Gcalc_function::shape_type cur_shape; - uint32 shape_pos; - double first_x, first_y, prev_x, prev_y; - double shape_area; -public: - Gcalc_result_receiver() : collection_result(FALSE), n_shapes(0), n_holes(0) - {} - int start_shape(Gcalc_function::shape_type shape); - int add_point(double x, double y); - int complete_shape(); - int single_point(double x, double y); - int done(); - void reset(); - - const char *result() { return buffer.ptr(); } - uint length() { return buffer.length(); } - int get_nshapes() { return n_shapes; } - int get_nholes() { return n_holes; } - int get_result_typeid(); - uint32 position() { return buffer.length(); } - int move_hole(uint32 dest_position, uint32 source_position, - uint32 *position_shift); -}; - - -/* - Gcalc_operation_reducer class incapsulates the spatial - operation functionality. It analyses the slices generated by - the slicescan and calculates the shape of the result defined - by some Gcalc_function. -*/ - -class Gcalc_operation_reducer : public Gcalc_dyn_list -{ -public: - enum modes - { - /* Numeric values important here - careful with changing */ - default_mode= 0, - prefer_big_with_holes= 1, - polygon_selfintersections_allowed= 2, /* allowed in the result */ - line_selfintersections_allowed= 4 /* allowed in the result */ - }; - - Gcalc_operation_reducer(size_t blk_size=8192); - Gcalc_operation_reducer(const Gcalc_operation_reducer &gor); - void init(Gcalc_function *fn, modes mode= default_mode); - Gcalc_operation_reducer(Gcalc_function *fn, modes mode= default_mode, - size_t blk_size=8192); - GCALC_DECL_TERMINATED_STATE(killed) - int count_slice(Gcalc_scan_iterator *si); - int count_all(Gcalc_heap *hp); - int get_result(Gcalc_result_receiver *storage); - void reset(); - -#ifndef GCALC_DBUG_OFF - int n_res_points; -#endif /*GCALC_DBUG_OFF*/ - class res_point : public Gcalc_dyn_list::Item - { - public: - int intersection_point; - union - { - const Gcalc_heap::Info *pi; - res_point *first_poly_node; - }; - union - { - res_point *outer_poly; - uint32 poly_position; - }; - res_point *up; - res_point *down; - res_point *glue; - Gcalc_function::shape_type type; - Gcalc_dyn_list::Item **prev_hook; -#ifndef GCALC_DBUG_OFF - int point_n; -#endif /*GCALC_DBUG_OFF*/ - void set(const Gcalc_scan_iterator *si); - res_point *get_next() { return (res_point *)next; } - }; - - class active_thread : public Gcalc_dyn_list::Item - { - public: - res_point *rp; - res_point *thread_start; - - const Gcalc_heap::Info *p1, *p2; - res_point *enabled() { return rp; } - active_thread *get_next() { return (active_thread *)next; } - }; - - class poly_instance : public Gcalc_dyn_list::Item - { - public: - uint32 *after_poly_position; - poly_instance *get_next() { return (poly_instance *)next; } - }; - - class line : public Gcalc_dyn_list::Item - { - public: - active_thread *t; - int incoming; - const Gcalc_scan_iterator::point *p; - line *get_next() { return (line *)next; } - }; - - class poly_border : public Gcalc_dyn_list::Item - { - public: - active_thread *t; - int incoming; - int prev_state; - const Gcalc_scan_iterator::point *p; - poly_border *get_next() { return (poly_border *)next; } - }; - - line *m_lines; - Gcalc_dyn_list::Item **m_lines_hook; - poly_border *m_poly_borders; - Gcalc_dyn_list::Item **m_poly_borders_hook; - line *new_line() { return (line *) new_item(); } - poly_border *new_poly_border() { return (poly_border *) new_item(); } - int add_line(int incoming, active_thread *t, - const Gcalc_scan_iterator::point *p); - int add_poly_border(int incoming, active_thread *t, int prev_state, - const Gcalc_scan_iterator::point *p); - -protected: - Gcalc_function *m_fn; - Gcalc_dyn_list::Item **m_res_hook; - res_point *m_result; - int m_mode; - - res_point *result_heap; - active_thread *m_first_active_thread; - - res_point *add_res_point(Gcalc_function::shape_type type); - active_thread *new_active_thread() { return (active_thread *)new_item(); } - - poly_instance *new_poly() { return (poly_instance *) new_item(); } - -private: - int start_line(active_thread *t, const Gcalc_scan_iterator::point *p, - const Gcalc_scan_iterator *si); - int end_line(active_thread *t, const Gcalc_scan_iterator *si); - int connect_threads(int incoming_a, int incoming_b, - active_thread *ta, active_thread *tb, - const Gcalc_scan_iterator::point *pa, - const Gcalc_scan_iterator::point *pb, - active_thread *prev_range, - const Gcalc_scan_iterator *si, - Gcalc_function::shape_type s_t); - int add_single_point(const Gcalc_scan_iterator *si); - poly_border *get_pair_border(poly_border *b1); - int continue_range(active_thread *t, const Gcalc_heap::Info *p, - const Gcalc_heap::Info *p_next); - int continue_i_range(active_thread *t, - const Gcalc_heap::Info *ii); - int end_couple(active_thread *t0, active_thread *t1, const Gcalc_heap::Info *p); - int get_single_result(res_point *res, Gcalc_result_receiver *storage); - int get_result_thread(res_point *cur, Gcalc_result_receiver *storage, - int move_upward, res_point *first_poly_node); - int get_polygon_result(res_point *cur, Gcalc_result_receiver *storage, - res_point *first_poly_node); - int get_line_result(res_point *cur, Gcalc_result_receiver *storage); - - void free_result(res_point *res); -}; - -#endif /*GCALC_TOOLS_INCLUDED*/ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/grant.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/grant.h deleted file mode 100644 index 5fbec44..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/grant.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_GRANT_INCLUDED -#define SQL_GRANT_INCLUDED - -#include "lex_string.h" -#include "privilege.h" - -class LEX_COLUMN; -class Lex_ident_sys; -class Table_ident; - -/* - Represents the object name in this standard SQL grammar: - GRANT ON -*/ -class Grant_object_name -{ -public: - enum Type - { - STAR, // ON * - IDENT_STAR, // ON db.* - STAR_STAR, // ON *.* - TABLE_IDENT // ON db.name - }; - Lex_cstring m_db; - Table_ident *m_table_ident; - Type m_type; -public: - Grant_object_name(Table_ident *table_ident) - :m_table_ident(table_ident), - m_type(TABLE_IDENT) - { } - Grant_object_name(const LEX_CSTRING &db, Type type) - :m_db(db), - m_table_ident(NULL), - m_type(type) - { } - privilege_t all_privileges_by_type() const; -}; - - - -/* - Represents standard SQL statements described by: - - - - -*/ -class Grant_privilege -{ -protected: - List m_columns; - Lex_cstring m_db; - privilege_t m_object_privilege; - privilege_t m_column_privilege_total; - bool m_all_privileges; -public: - Grant_privilege() - :m_object_privilege(NO_ACL), - m_column_privilege_total(NO_ACL), - m_all_privileges(false) - { } - Grant_privilege(privilege_t privilege, bool all_privileges) - :m_object_privilege(privilege), - m_column_privilege_total(NO_ACL), - m_all_privileges(all_privileges) - { } - void add_object_privilege(privilege_t privilege) - { - m_object_privilege|= privilege; - } - bool add_column_privilege(THD *thd, const Lex_ident_sys &col, - privilege_t privilege); - bool add_column_list_privilege(THD *thd, List &list, - privilege_t privilege); - bool set_object_name(THD *thd, - const Grant_object_name &ident, - SELECT_LEX *sel, - privilege_t with_grant_option); - const List & columns() const { return m_columns; } -}; - - -#endif // SQL_GRANT_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/group_by_handler.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/group_by_handler.h deleted file mode 100644 index ff3b204..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/group_by_handler.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright (c) 2014, 2015 SkySQL Ab & MariaDB Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef GROUP_BY_HANDLER_INCLUDED -#define GROUP_BY_HANDLER_INCLUDED - -class Select_limit_counters; -/* - This file implements the group_by_handler interface. This interface - can be used by storage handlers that can intercept summary or GROUP - BY queries from MariaDB and itself return the result to the user or - upper level. It is part of the Storage Engine API - - Both main and sub queries are supported. Here are some examples of what the - storage engine could intersept: - - SELECT count(*) FROM t1; - SELECT a,count(*) FROM t1 group by a; - SELECT a,count(*) as sum FROM t1 where b > 10 group by a, order by sum; - SELECT a,count(*) FROM t1,t2; - SELECT a, (select sum(*) from t2 where t1.a=t2.a) from t2; -*/ - -/** - The structure describing various parts of the query - - The engine is supposed to take out parts that it can do internally. - For example, if the engine can return results sorted according to - the specified order_by clause, it sets Query::order_by=NULL before - returning. - - At the moment the engine must take group_by (or return an error), and - optionally can take distinct, where, order_by, and having. - - The engine should not modify the select list. It is the extended SELECT - clause (extended, because it has more items than the original - user-specified SELECT clause) and it contains all aggregate functions, - used in the query. -*/ -struct Query -{ - List *select; - bool distinct; - TABLE_LIST *from; - Item *where; - ORDER *group_by; - ORDER *order_by; - Item *having; - // LIMIT - Select_limit_counters *limit; -}; - -class group_by_handler -{ -public: - THD *thd; - handlerton *ht; - - /* - Temporary table where all results should be stored in record[0] - The table has a field for every item from the Query::select list. - */ - TABLE *table; - - group_by_handler(THD *thd_arg, handlerton *ht_arg) - : thd(thd_arg), ht(ht_arg), table(0) {} - virtual ~group_by_handler() {} - - /* - Functions to scan data. All these returns 0 if ok, error code in case - of error - */ - - /* - Initialize group_by scan, prepare for next_row(). - If this is a sub query with group by, this can be called many times for - a query. - */ - virtual int init_scan()= 0; - - /* - Return next group by result in table->record[0]. - Return 0 if row found, HA_ERR_END_OF_FILE if last row and other error - number in case of fatal error. - */ - virtual int next_row()= 0; - - /* End scanning */ - virtual int end_scan()=0; - - /* Report errors */ - virtual void print_error(int error, myf errflag); -}; - -#endif //GROUP_BY_HANDLER_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/gstream.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/gstream.h deleted file mode 100644 index c5c7153..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/gstream.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef GSTREAM_INCLUDED -#define GSTREAM_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#include /* MY_ALLOW_ZERO_PTR */ -#include "m_ctype.h" /* my_charset_latin1, my_charset_bin */ - -class Gis_read_stream -{ -public: - enum enum_tok_types - { - unknown, - eostream, - word, - numeric, - l_bra, - r_bra, - comma - }; - - Gis_read_stream(CHARSET_INFO *charset, const char *buffer, int size) - :m_cur(buffer), m_limit(buffer + size), m_err_msg(NULL), m_charset(charset) - {} - Gis_read_stream(): m_cur(NullS), m_limit(NullS), m_err_msg(NullS) - {} - ~Gis_read_stream() - { - my_free(m_err_msg); - } - - enum enum_tok_types get_next_toc_type(); - bool lookup_next_word(LEX_STRING *res); - bool get_next_word(LEX_STRING *); - bool get_next_number(double *); - bool check_next_symbol(char); - - inline void skip_space() - { - while ((m_cur < m_limit) && my_isspace(&my_charset_latin1, *m_cur)) - m_cur++; - } - /* Skip next character, if match. Return 1 if no match */ - inline bool skip_char(char skip) - { - skip_space(); - if ((m_cur >= m_limit) || *m_cur != skip) - return 1; /* Didn't find char */ - m_cur++; - return 0; - } - /* Returns the next notempty character. */ - char next_symbol() - { - skip_space(); - if (m_cur >= m_limit) - return 0; /* EOL meet. */ - return *m_cur; - } - void set_error_msg(const char *msg); - - // caller should free this pointer - char *get_error_msg() - { - char *err_msg = m_err_msg; - m_err_msg= NullS; - return err_msg; - } - -protected: - const char *m_cur; - const char *m_limit; - char *m_err_msg; - CHARSET_INFO *m_charset; -}; - -#endif /* GSTREAM_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ha_partition.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/ha_partition.h deleted file mode 100644 index 8d0557f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ha_partition.h +++ /dev/null @@ -1,1654 +0,0 @@ -#ifndef HA_PARTITION_INCLUDED -#define HA_PARTITION_INCLUDED - -/* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "sql_partition.h" /* part_id_range, partition_element */ -#include "queues.h" /* QUEUE */ - -#define PARTITION_BYTES_IN_POS 2 -#define PAR_EXT ".par" - -/** Struct used for partition_name_hash */ -typedef struct st_part_name_def -{ - uchar *partition_name; - uint length; - uint32 part_id; - my_bool is_subpart; -} PART_NAME_DEF; - -/** class where to save partitions Handler_share's */ -class Parts_share_refs -{ -public: - uint num_parts; /**< Size of ha_share array */ - Handler_share **ha_shares; /**< Storage for each part */ - Parts_share_refs() - { - num_parts= 0; - ha_shares= NULL; - } - ~Parts_share_refs() - { - uint i; - for (i= 0; i < num_parts; i++) - delete ha_shares[i]; - delete[] ha_shares; - } - bool init(uint arg_num_parts) - { - DBUG_ASSERT(!num_parts && !ha_shares); - num_parts= arg_num_parts; - /* Allocate an array of Handler_share pointers */ - ha_shares= new Handler_share *[num_parts]; - if (!ha_shares) - { - num_parts= 0; - return true; - } - memset(ha_shares, 0, sizeof(Handler_share*) * num_parts); - return false; - } -}; - -class ha_partition; - -/* Partition Full Text Search info */ -struct st_partition_ft_info -{ - struct _ft_vft *please; - st_partition_ft_info *next; - ha_partition *file; - FT_INFO **part_ft_info; -}; - - -#ifdef HAVE_PSI_MUTEX_INTERFACE -extern PSI_mutex_key key_partition_auto_inc_mutex; -#endif - -/** - Partition specific Handler_share. -*/ -class Partition_share : public Handler_share -{ -public: - bool auto_inc_initialized; - mysql_mutex_t auto_inc_mutex; /**< protecting auto_inc val */ - ulonglong next_auto_inc_val; /**< first non reserved value */ - ulonglong prev_auto_inc_val; /**< stored next_auto_inc_val */ - /** - Hash of partition names. Initialized in the first ha_partition::open() - for the table_share. After that it is read-only, i.e. no locking required. - */ - bool partition_name_hash_initialized; - HASH partition_name_hash; - /** Storage for each partitions Handler_share */ - Parts_share_refs partitions_share_refs; - Partition_share() - : auto_inc_initialized(false), - next_auto_inc_val(0), - prev_auto_inc_val(0), - partition_name_hash_initialized(false), - partition_names(NULL) - { - mysql_mutex_init(key_partition_auto_inc_mutex, - &auto_inc_mutex, - MY_MUTEX_INIT_FAST); - } - - ~Partition_share() - { - mysql_mutex_destroy(&auto_inc_mutex); - if (partition_names) - { - my_free(partition_names); - } - if (partition_name_hash_initialized) - { - my_hash_free(&partition_name_hash); - } - } - - bool init(uint num_parts); - - /** - Release reserved auto increment values not used. - @param thd Thread. - @param table_share Table Share - @param next_insert_id Next insert id (first non used auto inc value). - @param max_reserved End of reserved auto inc range. - */ - void release_auto_inc_if_possible(THD *thd, TABLE_SHARE *table_share, - const ulonglong next_insert_id, - const ulonglong max_reserved); - - /** lock mutex protecting auto increment value next_auto_inc_val. */ - inline void lock_auto_inc() - { - mysql_mutex_lock(&auto_inc_mutex); - } - /** unlock mutex protecting auto increment value next_auto_inc_val. */ - inline void unlock_auto_inc() - { - mysql_mutex_unlock(&auto_inc_mutex); - } - /** - Populate partition_name_hash with partition and subpartition names - from part_info. - @param part_info Partition info containing all partitions metadata. - - @return Operation status. - @retval false Success. - @retval true Failure. - */ - bool populate_partition_name_hash(partition_info *part_info); - /** Get partition name. - - @param part_id Partition id (for subpartitioned table only subpartition - names will be returned.) - - @return partition name or NULL if error. - */ - const char *get_partition_name(size_t part_id) const; -private: - const uchar **partition_names; - /** - Insert [sub]partition name into partition_name_hash - @param name Partition name. - @param part_id Partition id. - @param is_subpart True if subpartition else partition. - - @return Operation status. - @retval false Success. - @retval true Failure. - */ - bool insert_partition_name_in_hash(const char *name, - uint part_id, - bool is_subpart); -}; - - -/* - List of ranges to be scanned by ha_partition's MRR implementation - - This object is - - A KEY_MULTI_RANGE structure (the MRR range) - - Storage for the range endpoints that the KEY_MULTI_RANGE has pointers to - - list of such ranges (connected through the "next" pointer). -*/ - -typedef struct st_partition_key_multi_range -{ - /* - Number of the range. The ranges are numbered in the order RANGE_SEQ_IF has - emitted them, starting from 1. The numbering in used by ordered MRR scans. - */ - uint id; - uchar *key[2]; - /* - Sizes of allocated memory in key[]. These may be larger then the actual - values as this structure is reused across MRR scans - */ - uint length[2]; - - /* - The range. - key_multi_range.ptr is a pointer to the this PARTITION_KEY_MULTI_RANGE - object - */ - KEY_MULTI_RANGE key_multi_range; - - // Range id from the SQL layer - range_id_t ptr; - - // The next element in the list of MRR ranges. - st_partition_key_multi_range *next; -} PARTITION_KEY_MULTI_RANGE; - - -/* - List of ranges to be scanned in a certain [sub]partition - - The idea is that there's a list of ranges to be scanned in the table - (formed by PARTITION_KEY_MULTI_RANGE structures), - and for each [sub]partition, we only need to scan a subset of that list. - - PKMR1 --> PKMR2 --> PKMR3 -->... // list of PARTITION_KEY_MULTI_RANGE - ^ ^ - | | - PPKMR1 ----------> PPKMR2 -->... // list of PARTITION_PART_KEY_MULTI_RANGE - - This way, per-partition lists of PARTITION_PART_KEY_MULTI_RANGE have pointers - to the elements of the global list of PARTITION_KEY_MULTI_RANGE. -*/ - -typedef struct st_partition_part_key_multi_range -{ - PARTITION_KEY_MULTI_RANGE *partition_key_multi_range; - st_partition_part_key_multi_range *next; -} PARTITION_PART_KEY_MULTI_RANGE; - - -class ha_partition; - -/* - The structure holding information about range sequence to be used with one - partition. - (pointer to this is used as seq_init_param for RANGE_SEQ_IF structure when - invoking MRR for an individual partition) -*/ - -typedef struct st_partition_part_key_multi_range_hld -{ - /* Owner object */ - ha_partition *partition; - - /* id of the the partition this structure is for */ - uint32 part_id; - - /* Current range we're iterating through */ - PARTITION_PART_KEY_MULTI_RANGE *partition_part_key_multi_range; -} PARTITION_PART_KEY_MULTI_RANGE_HLD; - - -extern "C" int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2); -extern "C" int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2); - -class ha_partition :public handler -{ -private: - enum partition_index_scan_type - { - partition_index_read= 0, - partition_index_first= 1, - partition_index_last= 3, - partition_index_read_last= 4, - partition_read_range = 5, - partition_no_index_scan= 6, - partition_read_multi_range = 7, - partition_ft_read= 8 - }; - /* Data for the partition handler */ - int m_mode; // Open mode - uint m_open_test_lock; // Open test_if_locked - uchar *m_file_buffer; // Content of the .par file - char *m_name_buffer_ptr; // Pointer to first partition name - MEM_ROOT m_mem_root; - plugin_ref *m_engine_array; // Array of types of the handlers - handler **m_file; // Array of references to handler inst. - uint m_file_tot_parts; // Debug - handler **m_new_file; // Array of references to new handlers - handler **m_reorged_file; // Reorganised partitions - handler **m_added_file; // Added parts kept for errors - LEX_CSTRING *m_connect_string; - partition_info *m_part_info; // local reference to partition - Field **m_part_field_array; // Part field array locally to save acc - uchar *m_ordered_rec_buffer; // Row and key buffer for ord. idx scan - st_partition_ft_info *ft_first; - st_partition_ft_info *ft_current; - /* - Current index. - When used in key_rec_cmp: If clustered pk, index compare - must compare pk if given index is same for two rows. - So normally m_curr_key_info[0]= current index and m_curr_key[1]= NULL, - and if clustered pk, [0]= current index, [1]= pk, [2]= NULL - */ - KEY *m_curr_key_info[3]; // Current index - uchar *m_rec0; // table->record[0] - const uchar *m_err_rec; // record which gave error - QUEUE m_queue; // Prio queue used by sorted read - - /* - Length of an element in m_ordered_rec_buffer. The elements are composed of - - [part_no] [table->record copy] [underlying_table_rowid] - - underlying_table_rowid is only stored when the table has no extended keys. - */ - size_t m_priority_queue_rec_len; - - /* - If true, then sorting records by key value also sorts them by their - underlying_table_rowid. - */ - bool m_using_extended_keys; - - /* - Since the partition handler is a handler on top of other handlers, it - is necessary to keep information about what the underlying handler - characteristics is. It is not possible to keep any handler instances - for this since the MySQL Server sometimes allocating the handler object - without freeing them. - */ - enum enum_handler_status - { - handler_not_initialized= 0, - handler_initialized, - handler_opened, - handler_closed - }; - enum_handler_status m_handler_status; - - uint m_reorged_parts; // Number of reorganised parts - uint m_tot_parts; // Total number of partitions; - uint m_num_locks; // For engines like ha_blackhole, which needs no locks - uint m_last_part; // Last file that we update,write,read - part_id_range m_part_spec; // Which parts to scan - uint m_scan_value; // Value passed in rnd_init - // call - uint m_ref_length; // Length of position in this - // handler object - key_range m_start_key; // index read key range - enum partition_index_scan_type m_index_scan_type;// What type of index - // scan - uint m_top_entry; // Which partition is to - // deliver next result - uint m_rec_length; // Local copy of record length - - bool m_ordered; // Ordered/Unordered index scan - bool m_create_handler; // Handler used to create table - bool m_is_sub_partitioned; // Is subpartitioned - bool m_ordered_scan_ongoing; - bool m_rnd_init_and_first; - bool m_ft_init_and_first; - - /* - If set, this object was created with ha_partition::clone and doesn't - "own" the m_part_info structure. - */ - ha_partition *m_is_clone_of; - MEM_ROOT *m_clone_mem_root; - - /* - We keep track if all underlying handlers are MyISAM since MyISAM has a - great number of extra flags not needed by other handlers. - */ - bool m_myisam; // Are all underlying handlers - // MyISAM - /* - We keep track of InnoDB handlers below since it requires proper setting - of query_id in fields at index_init and index_read calls. - */ - bool m_innodb; // Are all underlying handlers - // InnoDB - /* - When calling extra(HA_EXTRA_CACHE) we do not pass this to the underlying - handlers immediately. Instead we cache it and call the underlying - immediately before starting the scan on the partition. This is to - prevent allocating a READ CACHE for each partition in parallel when - performing a full table scan on MyISAM partitioned table. - This state is cleared by extra(HA_EXTRA_NO_CACHE). - */ - bool m_extra_cache; - uint m_extra_cache_size; - /* The same goes for HA_EXTRA_PREPARE_FOR_UPDATE */ - bool m_extra_prepare_for_update; - /* Which partition has active cache */ - uint m_extra_cache_part_id; - - void init_handler_variables(); - /* - Variables for lock structures. - */ - - bool auto_increment_lock; /**< lock reading/updating auto_inc */ - /** - Flag to keep the auto_increment lock through out the statement. - This to ensure it will work with statement based replication. - */ - bool auto_increment_safe_stmt_log_lock; - /** For optimizing ha_start_bulk_insert calls */ - MY_BITMAP m_bulk_insert_started; - ha_rows m_bulk_inserted_rows; - /** used for prediction of start_bulk_insert rows */ - enum_monotonicity_info m_part_func_monotonicity_info; - part_id_range m_direct_update_part_spec; - bool m_pre_calling; - bool m_pre_call_use_parallel; - /* Keep track of bulk access requests */ - bool bulk_access_executing; - - /** keep track of locked partitions */ - MY_BITMAP m_locked_partitions; - /** Stores shared auto_increment etc. */ - Partition_share *part_share; - /** Fix spurious -Werror=overloaded-virtual in GCC 9 */ - virtual void restore_auto_increment(ulonglong prev_insert_id) override - { - handler::restore_auto_increment(prev_insert_id); - } - /** Store and restore next_auto_inc_val over duplicate key errors. */ - void store_auto_increment() override - { - DBUG_ASSERT(part_share); - part_share->prev_auto_inc_val= part_share->next_auto_inc_val; - handler::store_auto_increment(); - } - void restore_auto_increment() override - { - DBUG_ASSERT(part_share); - part_share->next_auto_inc_val= part_share->prev_auto_inc_val; - handler::restore_auto_increment(); - } - void sum_copy_info(handler *file); - void sum_copy_infos(); - void reset_copy_info() override; - /** Temporary storage for new partitions Handler_shares during ALTER */ - List m_new_partitions_share_refs; - /** Sorted array of partition ids in descending order of number of rows. */ - uint32 *m_part_ids_sorted_by_num_of_records; - /* Compare function for my_qsort2, for reversed order. */ - static int compare_number_of_records(ha_partition *me, - const uint32 *a, - const uint32 *b); - /** keep track of partitions to call ha_reset */ - MY_BITMAP m_partitions_to_reset; - /** partitions that returned HA_ERR_KEY_NOT_FOUND. */ - MY_BITMAP m_key_not_found_partitions; - bool m_key_not_found; - List *m_partitions_to_open; - MY_BITMAP m_opened_partitions; - /** This is one of the m_file-s that it guaranteed to be opened. */ - /** It is set in open_read_partitions() */ - handler *m_file_sample; -public: - handler **get_child_handlers() - { - return m_file; - } - ha_partition *get_clone_source() - { - return m_is_clone_of; - } - virtual part_id_range *get_part_spec() - { - return &m_part_spec; - } - virtual uint get_no_current_part_id() - { - return NO_CURRENT_PART_ID; - } - Partition_share *get_part_share() { return part_share; } - handler *clone(const char *name, MEM_ROOT *mem_root) override; - virtual void set_part_info(partition_info *part_info) override - { - m_part_info= part_info; - m_is_sub_partitioned= part_info->is_sub_partitioned(); - } - - void return_record_by_parent() override; - - bool vers_can_native(THD *thd) override - { - if (thd->lex->part_info) - { - // PARTITION BY SYSTEM_TIME is not supported for now - return thd->lex->part_info->part_type != VERSIONING_PARTITION; - } - else - { - bool can= true; - for (uint i= 0; i < m_tot_parts && can; i++) - can= can && m_file[i]->vers_can_native(thd); - return can; - } - } - - /* - ------------------------------------------------------------------------- - MODULE create/delete handler object - ------------------------------------------------------------------------- - Object create/delete method. Normally called when a table object - exists. There is also a method to create the handler object with only - partition information. This is used from mysql_create_table when the - table is to be created and the engine type is deduced to be the - partition handler. - ------------------------------------------------------------------------- - */ - ha_partition(handlerton *hton, TABLE_SHARE * table); - ha_partition(handlerton *hton, partition_info * part_info); - ha_partition(handlerton *hton, TABLE_SHARE *share, - partition_info *part_info_arg, - ha_partition *clone_arg, - MEM_ROOT *clone_mem_root_arg); - ~ha_partition(); - void ha_partition_init(); - /* - A partition handler has no characteristics in itself. It only inherits - those from the underlying handlers. Here we set-up those constants to - enable later calls of the methods to retrieve constants from the under- - lying handlers. Returns false if not successful. - */ - bool initialize_partition(MEM_ROOT *mem_root); - - /* - ------------------------------------------------------------------------- - MODULE meta data changes - ------------------------------------------------------------------------- - Meta data routines to CREATE, DROP, RENAME table and often used at - ALTER TABLE (update_create_info used from ALTER TABLE and SHOW ..). - - update_table_comment is used in SHOW TABLE commands to provide a - chance for the handler to add any interesting comments to the table - comments not provided by the users comment. - - create_partitioning_metadata is called before opening a new handler object - with openfrm to call create. It is used to create any local handler - object needed in opening the object in openfrm - ------------------------------------------------------------------------- - */ - int delete_table(const char *from) override; - int rename_table(const char *from, const char *to) override; - int create(const char *name, TABLE *form, - HA_CREATE_INFO *create_info) override; - int create_partitioning_metadata(const char *name, - const char *old_name, - chf_create_flags action_flag) - override; - bool check_if_updates_are_ignored(const char *op) const override; - void update_create_info(HA_CREATE_INFO *create_info) override; - char *update_table_comment(const char *comment) override; - int change_partitions(HA_CREATE_INFO *create_info, const char *path, - ulonglong * const copied, ulonglong * const deleted, - const uchar *pack_frm_data, size_t pack_frm_len) - override; - int drop_partitions(const char *path) override; - int rename_partitions(const char *path) override; - bool get_no_parts(const char *, uint *num_parts) override - { - DBUG_ENTER("ha_partition::get_no_parts"); - *num_parts= m_tot_parts; - DBUG_RETURN(0); - } - void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) override; - bool check_if_incompatible_data(HA_CREATE_INFO *create_info, - uint table_changes) override; - void update_part_create_info(HA_CREATE_INFO *create_info, uint part_id) - { - m_file[part_id]->update_create_info(create_info); - } -private: - int copy_partitions(ulonglong * const copied, ulonglong * const deleted); - void cleanup_new_partition(uint part_count); - int prepare_new_partition(TABLE *table, HA_CREATE_INFO *create_info, - handler *file, const char *part_name, - partition_element *p_elem, - uint disable_non_uniq_indexes); - /* - delete_table and rename_table uses very similar logic which - is packed into this routine. - */ - uint del_ren_table(const char *from, const char *to); - /* - One method to create the table_name.par file containing the names of the - underlying partitions, their engine and the number of partitions. - And one method to read it in. - */ - bool create_handler_file(const char *name); - bool setup_engine_array(MEM_ROOT *mem_root); - bool read_par_file(const char *name); - bool get_from_handler_file(const char *name, MEM_ROOT *mem_root, - bool is_clone); - bool new_handlers_from_part_info(MEM_ROOT *mem_root); - bool create_handlers(MEM_ROOT *mem_root); - void clear_handler_file(); - int set_up_table_before_create(TABLE *table_arg, - const char *partition_name_with_path, - HA_CREATE_INFO *info, - partition_element *p_elem); - partition_element *find_partition_element(uint part_id); - bool insert_partition_name_in_hash(const char *name, uint part_id, - bool is_subpart); - bool populate_partition_name_hash(); - Partition_share *get_share(); - bool set_ha_share_ref(Handler_share **ha_share) override; - void fix_data_dir(char* path); - bool init_partition_bitmaps(); - void free_partition_bitmaps(); - -public: - - /* - ------------------------------------------------------------------------- - MODULE open/close object - ------------------------------------------------------------------------- - Open and close handler object to ensure all underlying files and - objects allocated and deallocated for query handling is handled - properly. - ------------------------------------------------------------------------- - - A handler object is opened as part of its initialisation and before - being used for normal queries (not before meta-data changes always. - If the object was opened it will also be closed before being deleted. - */ - int open(const char *name, int mode, uint test_if_locked) override; - int close() override; - - /* - ------------------------------------------------------------------------- - MODULE start/end statement - ------------------------------------------------------------------------- - This module contains methods that are used to understand start/end of - statements, transaction boundaries, and aid for proper concurrency - control. - The partition handler need not implement abort and commit since this - will be handled by any underlying handlers implementing transactions. - There is only one call to each handler type involved per transaction - and these go directly to the handlers supporting transactions - ------------------------------------------------------------------------- - */ - THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to, - enum thr_lock_type lock_type) override; - int external_lock(THD * thd, int lock_type) override; - LEX_CSTRING *engine_name() override { return hton_name(partition_ht()); } - /* - When table is locked a statement is started by calling start_stmt - instead of external_lock - */ - int start_stmt(THD * thd, thr_lock_type lock_type) override; - /* - Lock count is number of locked underlying handlers (I assume) - */ - uint lock_count() const override; - /* - Call to unlock rows not to be updated in transaction - */ - void unlock_row() override; - /* - Check if semi consistent read - */ - bool was_semi_consistent_read() override; - /* - Call to hint about semi consistent read - */ - void try_semi_consistent_read(bool) override; - - /* - NOTE: due to performance and resource issues with many partitions, - we only use the m_psi on the ha_partition handler, excluding all - partitions m_psi. - */ -#ifdef HAVE_M_PSI_PER_PARTITION - /* - Bind the table/handler thread to track table i/o. - */ - virtual void unbind_psi(); - virtual int rebind(); -#endif - int discover_check_version() override; - /* - ------------------------------------------------------------------------- - MODULE change record - ------------------------------------------------------------------------- - This part of the handler interface is used to change the records - after INSERT, DELETE, UPDATE, REPLACE method calls but also other - special meta-data operations as ALTER TABLE, LOAD DATA, TRUNCATE. - ------------------------------------------------------------------------- - - These methods are used for insert (write_row), update (update_row) - and delete (delete_row). All methods to change data always work on - one row at a time. update_row and delete_row also contains the old - row. - delete_all_rows will delete all rows in the table in one call as a - special optimisation for DELETE from table; - - Bulk inserts are supported if all underlying handlers support it. - start_bulk_insert and end_bulk_insert is called before and after a - number of calls to write_row. - */ - int write_row(const uchar * buf) override; - bool start_bulk_update() override; - int exec_bulk_update(ha_rows *dup_key_found) override; - int end_bulk_update() override; - int bulk_update_row(const uchar *old_data, const uchar *new_data, - ha_rows *dup_key_found) override; - int update_row(const uchar * old_data, const uchar * new_data) override; - int direct_update_rows_init(List *update_fields) override; - int pre_direct_update_rows_init(List *update_fields) override; - int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows) override; - int pre_direct_update_rows() override; - bool start_bulk_delete() override; - int end_bulk_delete() override; - int delete_row(const uchar * buf) override; - int direct_delete_rows_init() override; - int pre_direct_delete_rows_init() override; - int direct_delete_rows(ha_rows *delete_rows) override; - int pre_direct_delete_rows() override; - int delete_all_rows() override; - int truncate() override; - void start_bulk_insert(ha_rows rows, uint flags) override; - int end_bulk_insert() override; -private: - ha_rows guess_bulk_insert_rows(); - void start_part_bulk_insert(THD *thd, uint part_id); - long estimate_read_buffer_size(long original_size); -public: - - /* - Method for truncating a specific partition. - (i.e. ALTER TABLE t1 TRUNCATE PARTITION p). - - @remark This method is a partitioning-specific hook - and thus not a member of the general SE API. - */ - int truncate_partition(Alter_info *, bool *binlog_stmt); - - bool is_fatal_error(int error, uint flags) override - { - if (!handler::is_fatal_error(error, flags) || - error == HA_ERR_NO_PARTITION_FOUND || - error == HA_ERR_NOT_IN_LOCK_PARTITIONS) - return FALSE; - return TRUE; - } - - - /* - ------------------------------------------------------------------------- - MODULE full table scan - ------------------------------------------------------------------------- - This module is used for the most basic access method for any table - handler. This is to fetch all data through a full table scan. No - indexes are needed to implement this part. - It contains one method to start the scan (rnd_init) that can also be - called multiple times (typical in a nested loop join). Then proceeding - to the next record (rnd_next) and closing the scan (rnd_end). - To remember a record for later access there is a method (position) - and there is a method used to retrieve the record based on the stored - position. - The position can be a file position, a primary key, a ROWID dependent - on the handler below. - ------------------------------------------------------------------------- - */ - /* - unlike index_init(), rnd_init() can be called two times - without rnd_end() in between (it only makes sense if scan=1). - then the second call should prepare for the new table scan - (e.g if rnd_init allocates the cursor, second call should - position it to the start of the table, no need to deallocate - and allocate it again - */ - int rnd_init(bool scan) override; - int rnd_end() override; - int rnd_next(uchar * buf) override; - int rnd_pos(uchar * buf, uchar * pos) override; - int rnd_pos_by_record(uchar *record) override; - void position(const uchar * record) override; - - /* - ------------------------------------------------------------------------- - MODULE index scan - ------------------------------------------------------------------------- - This part of the handler interface is used to perform access through - indexes. The interface is defined as a scan interface but the handler - can also use key lookup if the index is a unique index or a primary - key index. - Index scans are mostly useful for SELECT queries but are an important - part also of UPDATE, DELETE, REPLACE and CREATE TABLE table AS SELECT - and so forth. - Naturally an index is needed for an index scan and indexes can either - be ordered, hash based. Some ordered indexes can return data in order - but not necessarily all of them. - There are many flags that define the behavior of indexes in the - various handlers. These methods are found in the optimizer module. - ------------------------------------------------------------------------- - - index_read is called to start a scan of an index. The find_flag defines - the semantics of the scan. These flags are defined in - include/my_base.h - index_read_idx is the same but also initializes index before calling doing - the same thing as index_read. Thus it is similar to index_init followed - by index_read. This is also how we implement it. - - index_read/index_read_idx does also return the first row. Thus for - key lookups, the index_read will be the only call to the handler in - the index scan. - - index_init initializes an index before using it and index_end does - any end processing needed. - */ - int index_read_map(uchar * buf, const uchar * key, - key_part_map keypart_map, - enum ha_rkey_function find_flag) override; - int index_init(uint idx, bool sorted) override; - int index_end() override; - - /** - @breif - Positions an index cursor to the index specified in the handle. Fetches the - row if available. If the key value is null, begin at first key of the - index. - */ - int index_read_idx_map(uchar *buf, uint index, const uchar *key, - key_part_map keypart_map, - enum ha_rkey_function find_flag) override; - /* - These methods are used to jump to next or previous entry in the index - scan. There are also methods to jump to first and last entry. - */ - int index_next(uchar * buf) override; - int index_prev(uchar * buf) override; - int index_first(uchar * buf) override; - int index_last(uchar * buf) override; - int index_next_same(uchar * buf, const uchar * key, uint keylen) override; - - int index_read_last_map(uchar *buf, - const uchar *key, - key_part_map keypart_map) override; - - /* - read_first_row is virtual method but is only implemented by - handler.cc, no storage engine has implemented it so neither - will the partition handler. - - int read_first_row(uchar *buf, uint primary_key) override; - */ - - - int read_range_first(const key_range * start_key, - const key_range * end_key, - bool eq_range, bool sorted) override; - int read_range_next() override; - - - HANDLER_BUFFER *m_mrr_buffer; - uint *m_mrr_buffer_size; - uchar *m_mrr_full_buffer; - uint m_mrr_full_buffer_size; - uint m_mrr_new_full_buffer_size; - MY_BITMAP m_mrr_used_partitions; - uint *m_stock_range_seq; - /* not used: uint m_current_range_seq; */ - - /* Value of mrr_mode passed to ha_partition::multi_range_read_init */ - uint m_mrr_mode; - - /* Value of n_ranges passed to ha_partition::multi_range_read_init */ - uint m_mrr_n_ranges; - - /* - Ordered MRR mode: m_range_info[N] has the range_id of the last record that - we've got from partition N - */ - range_id_t *m_range_info; - - /* - TRUE <=> This ha_partition::multi_range_read_next() call is the first one - */ - bool m_multi_range_read_first; - - /* not used: uint m_mrr_range_init_flags; */ - - /* Number of elements in the list pointed by m_mrr_range_first. Not used */ - uint m_mrr_range_length; - - /* Linked list of ranges to scan */ - PARTITION_KEY_MULTI_RANGE *m_mrr_range_first; - PARTITION_KEY_MULTI_RANGE *m_mrr_range_current; - - /* - For each partition: number of ranges MRR scan will scan in the partition - */ - uint *m_part_mrr_range_length; - - /* For each partition: List of ranges to scan in this partition */ - PARTITION_PART_KEY_MULTI_RANGE **m_part_mrr_range_first; - PARTITION_PART_KEY_MULTI_RANGE **m_part_mrr_range_current; - PARTITION_PART_KEY_MULTI_RANGE_HLD *m_partition_part_key_multi_range_hld; - - /* - Sequence of ranges to be scanned (TODO: why not store this in - handler::mrr_{iter,funcs}?) - */ - range_seq_t m_seq; - RANGE_SEQ_IF *m_seq_if; - - /* Range iterator structure to be supplied to partitions */ - RANGE_SEQ_IF m_part_seq_if; - - virtual int multi_range_key_create_key( - RANGE_SEQ_IF *seq, - range_seq_t seq_it - ); - ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, - void *seq_init_param, - uint n_ranges, uint *bufsz, - uint *mrr_mode, - Cost_estimate *cost) override; - ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, - uint key_parts, uint *bufsz, - uint *mrr_mode, Cost_estimate *cost) override; - int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, - uint n_ranges, uint mrr_mode, - HANDLER_BUFFER *buf) override; - int multi_range_read_next(range_id_t *range_info) override; - int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size) - override; - uint last_part() { return m_last_part; } - -private: - bool init_record_priority_queue(); - void destroy_record_priority_queue(); - int common_index_read(uchar * buf, bool have_start_key); - int common_first_last(uchar * buf); - int partition_scan_set_up(uchar * buf, bool idx_read_flag); - bool check_parallel_search(); - int handle_pre_scan(bool reverse_order, bool use_parallel); - int handle_unordered_next(uchar * buf, bool next_same); - int handle_unordered_scan_next_partition(uchar * buf); - int handle_ordered_index_scan(uchar * buf, bool reverse_order); - int handle_ordered_index_scan_key_not_found(); - int handle_ordered_next(uchar * buf, bool next_same); - int handle_ordered_prev(uchar * buf); - void return_top_record(uchar * buf); -public: - /* - ------------------------------------------------------------------------- - MODULE information calls - ------------------------------------------------------------------------- - This calls are used to inform the handler of specifics of the ongoing - scans and other actions. Most of these are used for optimisation - purposes. - ------------------------------------------------------------------------- - */ - int info(uint) override; - void get_dynamic_partition_info(PARTITION_STATS *stat_info, uint part_id) - override; - void set_partitions_to_open(List *partition_names) override; - int change_partitions_to_open(List *partition_names) override; - int open_read_partitions(char *name_buff, size_t name_buff_size); - int extra(enum ha_extra_function operation) override; - int extra_opt(enum ha_extra_function operation, ulong arg) override; - int reset() override; - uint count_query_cache_dependant_tables(uint8 *tables_type) override; - my_bool register_query_cache_dependant_tables(THD *thd, - Query_cache *cache, - Query_cache_block_table **block, - uint *n) override; - -private: - typedef int handler_callback(handler *, void *); - - my_bool reg_query_cache_dependant_table(THD *thd, - char *engine_key, - uint engine_key_len, - char *query_key, uint query_key_len, - uint8 type, - Query_cache *cache, - Query_cache_block_table - **block_table, - handler *file, uint *n); - static const uint NO_CURRENT_PART_ID= NOT_A_PARTITION_ID; - int loop_partitions(handler_callback callback, void *param); - int loop_extra_alter(enum ha_extra_function operations); - void late_extra_cache(uint partition_id); - void late_extra_no_cache(uint partition_id); - void prepare_extra_cache(uint cachesize); - handler *get_open_file_sample() const { return m_file_sample; } -public: - - /* - ------------------------------------------------------------------------- - MODULE optimiser support - ------------------------------------------------------------------------- - ------------------------------------------------------------------------- - */ - - /* - NOTE !!!!!! - ------------------------------------------------------------------------- - ------------------------------------------------------------------------- - One important part of the public handler interface that is not depicted in - the methods is the attribute records - - which is defined in the base class. This is looked upon directly and is - set by calling info(HA_STATUS_INFO) ? - ------------------------------------------------------------------------- - */ - -private: - /* Helper functions for optimizer hints. */ - ha_rows min_rows_for_estimate(); - uint get_biggest_used_partition(uint *part_index); -public: - - /* - keys_to_use_for_scanning can probably be implemented as the - intersection of all underlying handlers if mixed handlers are used. - This method is used to derive whether an index can be used for - index-only scanning when performing an ORDER BY query. - Only called from one place in sql_select.cc - */ - const key_map *keys_to_use_for_scanning() override; - - /* - Called in test_quick_select to determine if indexes should be used. - */ - double scan_time() override; - - double key_scan_time(uint inx) override; - - double keyread_time(uint inx, uint ranges, ha_rows rows) override; - - /* - The next method will never be called if you do not implement indexes. - */ - double read_time(uint index, uint ranges, ha_rows rows) override; - /* - For the given range how many records are estimated to be in this range. - Used by optimiser to calculate cost of using a particular index. - */ - ha_rows records_in_range(uint inx, - const key_range * min_key, - const key_range * max_key, - page_range *pages) override; - - /* - Upper bound of number records returned in scan is sum of all - underlying handlers. - */ - ha_rows estimate_rows_upper_bound() override; - - /* - table_cache_type is implemented by the underlying handler but all - underlying handlers must have the same implementation for it to work. - */ - uint8 table_cache_type() override; - ha_rows records() override; - - /* Calculate hash value for PARTITION BY KEY tables. */ - static uint32 calculate_key_hash_value(Field **field_array); - - /* - ------------------------------------------------------------------------- - MODULE print messages - ------------------------------------------------------------------------- - This module contains various methods that returns text messages for - table types, index type and error messages. - ------------------------------------------------------------------------- - */ - /* - The name of the index type that will be used for display - Here we must ensure that all handlers use the same index type - for each index created. - */ - const char *index_type(uint inx) override; - - /* The name of the table type that will be used for display purposes */ - const char *table_type() const; - - /* The name of the row type used for the underlying tables. */ - enum row_type get_row_type() const override; - - /* - Handler specific error messages - */ - void print_error(int error, myf errflag) override; - bool get_error_message(int error, String * buf) override; - /* - ------------------------------------------------------------------------- - MODULE handler characteristics - ------------------------------------------------------------------------- - This module contains a number of methods defining limitations and - characteristics of the handler. The partition handler will calculate - this characteristics based on underlying handler characteristics. - ------------------------------------------------------------------------- - - This is a list of flags that says what the storage engine - implements. The current table flags are documented in handler.h - The partition handler will support whatever the underlying handlers - support except when specifically mentioned below about exceptions - to this rule. - NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION - LEVEL which is dynamic, see bug#39084. - - HA_READ_RND_SAME: - Not currently used. (Means that the handler supports the rnd_same() call) - (MyISAM, HEAP) - - HA_TABLE_SCAN_ON_INDEX: - Used to avoid scanning full tables on an index. If this flag is set then - the handler always has a primary key (hidden if not defined) and this - index is used for scanning rather than a full table scan in all - situations. - (InnoDB, Federated) - - HA_REC_NOT_IN_SEQ: - This flag is set for handlers that cannot guarantee that the rows are - returned according to incremental positions (0, 1, 2, 3...). - This also means that rnd_next() should return HA_ERR_RECORD_DELETED - if it finds a deleted row. - (MyISAM (not fixed length row), HEAP, InnoDB) - - HA_CAN_GEOMETRY: - Can the storage engine handle spatial data. - Used to check that no spatial attributes are declared unless - the storage engine is capable of handling it. - (MyISAM) - - HA_FAST_KEY_READ: - Setting this flag indicates that the handler is equally fast in - finding a row by key as by position. - This flag is used in a very special situation in conjunction with - filesort's. For further explanation see intro to init_read_record. - (HEAP, InnoDB) - - HA_NULL_IN_KEY: - Is NULL values allowed in indexes. - If this is not allowed then it is not possible to use an index on a - NULLable field. - (HEAP, MyISAM, InnoDB) - - HA_DUPLICATE_POS: - Tells that we can the position for the conflicting duplicate key - record is stored in table->file->dupp_ref. (insert uses rnd_pos() on - this to find the duplicated row) - (MyISAM) - - HA_CAN_INDEX_BLOBS: - Is the storage engine capable of defining an index of a prefix on - a BLOB attribute. - (Federated, MyISAM, InnoDB) - - HA_AUTO_PART_KEY: - Auto increment fields can be part of a multi-part key. For second part - auto-increment keys, the auto_incrementing is done in handler.cc - (Federated, MyISAM) - - HA_REQUIRE_PRIMARY_KEY: - Can't define a table without primary key (and cannot handle a table - with hidden primary key) - (No handler has this limitation currently) - - HA_STATS_RECORDS_IS_EXACT: - Does the counter of records after the info call specify an exact - value or not. If it does this flag is set. - Only MyISAM and HEAP uses exact count. - - HA_CAN_INSERT_DELAYED: - Can the storage engine support delayed inserts. - To start with the partition handler will not support delayed inserts. - Further investigation needed. - (HEAP, MyISAM) - - HA_PRIMARY_KEY_IN_READ_INDEX: - This parameter is set when the handler will also return the primary key - when doing read-only-key on another index. - - HA_NOT_DELETE_WITH_CACHE: - Seems to be an old MyISAM feature that is no longer used. No handler - has it defined but it is checked in init_read_record. - Further investigation needed. - (No handler defines it) - - HA_NO_PREFIX_CHAR_KEYS: - Indexes on prefixes of character fields is not allowed. - (Federated) - - HA_CAN_FULLTEXT: - Does the storage engine support fulltext indexes - The partition handler will start by not supporting fulltext indexes. - (MyISAM) - - HA_CAN_SQL_HANDLER: - Can the HANDLER interface in the MySQL API be used towards this - storage engine. - (MyISAM, InnoDB) - - HA_NO_AUTO_INCREMENT: - Set if the storage engine does not support auto increment fields. - (Currently not set by any handler) - - HA_HAS_CHECKSUM: - Special MyISAM feature. Has special SQL support in CREATE TABLE. - No special handling needed by partition handler. - (MyISAM) - - HA_FILE_BASED: - Should file names always be in lower case (used by engines - that map table names to file names. - Since partition handler has a local file this flag is set. - (Federated, MyISAM) - - HA_CAN_BIT_FIELD: - Is the storage engine capable of handling bit fields? - (MyISAM) - - HA_NEED_READ_RANGE_BUFFER: - Is Read Multi-Range supported => need multi read range buffer - This parameter specifies whether a buffer for read multi range - is needed by the handler. Whether the handler supports this - feature or not is dependent of whether the handler implements - read_multi_range* calls or not. The only handler currently - supporting this feature is NDB so the partition handler need - not handle this call. There are methods in handler.cc that will - transfer those calls into index_read and other calls in the - index scan module. - (No handler defines it) - - HA_PRIMARY_KEY_REQUIRED_FOR_POSITION: - Does the storage engine need a PK for position? - (InnoDB) - - HA_FILE_BASED is always set for partition handler since we use a - special file for handling names of partitions, engine types. - HA_REC_NOT_IN_SEQ is always set for partition handler since we cannot - guarantee that the records will be returned in sequence. - HA_DUPLICATE_POS, - HA_CAN_INSERT_DELAYED, HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is disabled - until further investigated. - */ - Table_flags table_flags() const override; - - /* - This is a bitmap of flags that says how the storage engine - implements indexes. The current index flags are documented in - handler.h. If you do not implement indexes, just return zero - here. - - part is the key part to check. First key part is 0 - If all_parts it's set, MySQL want to know the flags for the combined - index up to and including 'part'. - - HA_READ_NEXT: - Does the index support read next, this is assumed in the server - code and never checked so all indexes must support this. - Note that the handler can be used even if it doesn't have any index. - (HEAP, MyISAM, Federated, InnoDB) - - HA_READ_PREV: - Can the index be used to scan backwards. - (HEAP, MyISAM, InnoDB) - - HA_READ_ORDER: - Can the index deliver its record in index order. Typically true for - all ordered indexes and not true for hash indexes. - In first step this is not true for partition handler until a merge - sort has been implemented in partition handler. - Used to set keymap part_of_sortkey - This keymap is only used to find indexes usable for resolving an ORDER BY - in the query. Thus in most cases index_read will work just fine without - order in result production. When this flag is set it is however safe to - order all output started by index_read since most engines do this. With - read_multi_range calls there is a specific flag setting order or not - order so in those cases ordering of index output can be avoided. - (InnoDB, HEAP, MyISAM) - - HA_READ_RANGE: - Specify whether index can handle ranges, typically true for all - ordered indexes and not true for hash indexes. - Used by optimiser to check if ranges (as key >= 5) can be optimised - by index. - (InnoDB, MyISAM, HEAP) - - HA_ONLY_WHOLE_INDEX: - Can't use part key searches. This is typically true for hash indexes - and typically not true for ordered indexes. - (Federated, HEAP) - - HA_KEYREAD_ONLY: - Does the storage engine support index-only scans on this index. - Enables use of HA_EXTRA_KEYREAD and HA_EXTRA_NO_KEYREAD - Used to set key_map keys_for_keyread and to check in optimiser for - index-only scans. When doing a read under HA_EXTRA_KEYREAD the handler - only have to fill in the columns the key covers. If - HA_PRIMARY_KEY_IN_READ_INDEX is set then also the PRIMARY KEY columns - must be updated in the row. - (InnoDB, MyISAM) - */ - ulong index_flags(uint inx, uint part, bool all_parts) const override - { - /* - The following code is not safe if you are using different - storage engines or different index types per partition. - */ - return m_file[0]->index_flags(inx, part, all_parts); - } - - /** - wrapper function for handlerton alter_table_flags, since - the ha_partition_hton cannot know all its capabilities - */ - alter_table_operations alter_table_flags(alter_table_operations flags) - override; - /* - unireg.cc will call the following to make sure that the storage engine - can handle the data it is about to send. - - The maximum supported values is the minimum of all handlers in the table - */ - uint min_of_the_max_uint(uint (handler::*operator_func)(void) const) const; - uint max_supported_record_length() const override; - uint max_supported_keys() const override; - uint max_supported_key_parts() const override; - uint max_supported_key_length() const override; - uint max_supported_key_part_length() const override; - uint min_record_length(uint options) const override; - - /* - ------------------------------------------------------------------------- - MODULE compare records - ------------------------------------------------------------------------- - cmp_ref checks if two references are the same. For most handlers this is - a simple memcmp of the reference. However some handlers use primary key - as reference and this can be the same even if memcmp says they are - different. This is due to character sets and end spaces and so forth. - For the partition handler the reference is first two bytes providing the - partition identity of the referred record and then the reference of the - underlying handler. - Thus cmp_ref for the partition handler always returns FALSE for records - not in the same partition and uses cmp_ref on the underlying handler - to check whether the rest of the reference part is also the same. - ------------------------------------------------------------------------- - */ - int cmp_ref(const uchar * ref1, const uchar * ref2) override; - /* - ------------------------------------------------------------------------- - MODULE auto increment - ------------------------------------------------------------------------- - This module is used to handle the support of auto increments. - - This variable in the handler is used as part of the handler interface - It is maintained by the parent handler object and should not be - touched by child handler objects (see handler.cc for its use). - - auto_increment_column_changed - ------------------------------------------------------------------------- - */ - bool need_info_for_auto_inc() override; - bool can_use_for_auto_inc_init() override; - void get_auto_increment(ulonglong offset, ulonglong increment, - ulonglong nb_desired_values, - ulonglong *first_value, - ulonglong *nb_reserved_values) override; - void release_auto_increment() override; -private: - int reset_auto_increment(ulonglong value) override; - void update_next_auto_inc_val(); - virtual void lock_auto_increment() - { - /* lock already taken */ - if (auto_increment_safe_stmt_log_lock) - return; - if (table_share->tmp_table == NO_TMP_TABLE) - { - part_share->lock_auto_inc(); - DBUG_ASSERT(!auto_increment_lock); - auto_increment_lock= TRUE; - } - } - virtual void unlock_auto_increment() - { - /* - If auto_increment_safe_stmt_log_lock is true, we have to keep the lock. - It will be set to false and thus unlocked at the end of the statement by - ha_partition::release_auto_increment. - */ - if (auto_increment_lock && !auto_increment_safe_stmt_log_lock) - { - auto_increment_lock= FALSE; - part_share->unlock_auto_inc(); - } - } - virtual void set_auto_increment_if_higher(Field *field) - { - ulonglong nr= (((Field_num*) field)->unsigned_flag || - field->val_int() > 0) ? field->val_int() : 0; - lock_auto_increment(); - DBUG_ASSERT(part_share->auto_inc_initialized || - !can_use_for_auto_inc_init()); - /* must check when the mutex is taken */ - if (nr >= part_share->next_auto_inc_val) - part_share->next_auto_inc_val= nr + 1; - unlock_auto_increment(); - } - - void check_insert_autoincrement() - { - /* - If we INSERT into the table having the AUTO_INCREMENT column, - we have to read all partitions for the next autoincrement value - unless we already did it. - */ - if (!part_share->auto_inc_initialized && - ha_thd()->lex->sql_command == SQLCOM_INSERT && - table->found_next_number_field) - bitmap_set_all(&m_part_info->read_partitions); - } - -public: - - /* - ------------------------------------------------------------------------- - MODULE initialize handler for HANDLER call - ------------------------------------------------------------------------- - This method is a special InnoDB method called before a HANDLER query. - ------------------------------------------------------------------------- - */ - void init_table_handle_for_HANDLER() override; - - /* - The remainder of this file defines the handler methods not implemented - by the partition handler - */ - - /* - ------------------------------------------------------------------------- - MODULE foreign key support - ------------------------------------------------------------------------- - The following methods are used to implement foreign keys as supported by - InnoDB. Implement this ?? - get_foreign_key_create_info is used by SHOW CREATE TABLE to get a textual - description of how the CREATE TABLE part to define FOREIGN KEY's is done. - free_foreign_key_create_info is used to free the memory area that provided - this description. - can_switch_engines checks if it is ok to switch to a new engine based on - the foreign key info in the table. - ------------------------------------------------------------------------- - - virtual char* get_foreign_key_create_info() - virtual void free_foreign_key_create_info(char* str) - - virtual int get_foreign_key_list(THD *thd, - List *f_key_list) - virtual uint referenced_by_foreign_key() - */ - bool can_switch_engines() override; - /* - ------------------------------------------------------------------------- - MODULE fulltext index - ------------------------------------------------------------------------- - */ - void ft_close_search(FT_INFO *handler); - int ft_init() override; - int pre_ft_init() override; - void ft_end() override; - int pre_ft_end() override; - FT_INFO *ft_init_ext(uint flags, uint inx, String *key) override; - int ft_read(uchar *buf) override; - int pre_ft_read(bool use_parallel) override; - - /* - ------------------------------------------------------------------------- - MODULE restart full table scan at position (MyISAM) - ------------------------------------------------------------------------- - The following method is only used by MyISAM when used as - temporary tables in a join. - int restart_rnd_next(uchar *buf, uchar *pos) override; - */ - - /* - ------------------------------------------------------------------------- - MODULE in-place ALTER TABLE - ------------------------------------------------------------------------- - These methods are in the handler interface. (used by innodb-plugin) - They are used for in-place alter table: - ------------------------------------------------------------------------- - */ - enum_alter_inplace_result - check_if_supported_inplace_alter(TABLE *altered_table, - Alter_inplace_info *ha_alter_info) - override; - bool prepare_inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info) - override; - bool inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info) override; - bool commit_inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info, - bool commit) override; - /* - ------------------------------------------------------------------------- - MODULE tablespace support - ------------------------------------------------------------------------- - Admin of table spaces is not applicable to the partition handler (InnoDB) - This means that the following method is not implemented: - ------------------------------------------------------------------------- - virtual int discard_or_import_tablespace(my_bool discard) - */ - - /* - ------------------------------------------------------------------------- - MODULE admin MyISAM - ------------------------------------------------------------------------- - - ------------------------------------------------------------------------- - OPTIMIZE TABLE, CHECK TABLE, ANALYZE TABLE and REPAIR TABLE are - mapped to a routine that handles looping over a given set of - partitions and those routines send a flag indicating to execute on - all partitions. - ------------------------------------------------------------------------- - */ - int optimize(THD* thd, HA_CHECK_OPT *check_opt) override; - int analyze(THD* thd, HA_CHECK_OPT *check_opt) override; - int check(THD* thd, HA_CHECK_OPT *check_opt) override; - int repair(THD* thd, HA_CHECK_OPT *check_opt) override; - bool check_and_repair(THD *thd) override; - bool auto_repair(int error) const override; - bool is_crashed() const override; - int check_for_upgrade(HA_CHECK_OPT *check_opt) override; - - /* - ------------------------------------------------------------------------- - MODULE condition pushdown - ------------------------------------------------------------------------- - */ - const COND *cond_push(const COND *cond) override; - void cond_pop() override; - int info_push(uint info_type, void *info) override; - - private: - int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags); - int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt, uint part_id, - uint flag); - /** - Check if the rows are placed in the correct partition. If the given - argument is true, then move the rows to the correct partition. - */ - int check_misplaced_rows(uint read_part_id, bool repair); - void append_row_to_str(String &str); - public: - - int pre_calculate_checksum() override; - int calculate_checksum() override; - - /* Enabled keycache for performance reasons, WL#4571 */ - int assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) override; - int preload_keys(THD* thd, HA_CHECK_OPT* check_opt) override; - TABLE_LIST *get_next_global_for_child() override; - - /* - ------------------------------------------------------------------------- - MODULE enable/disable indexes - ------------------------------------------------------------------------- - Enable/Disable Indexes are only supported by HEAP and MyISAM. - ------------------------------------------------------------------------- - */ - int disable_indexes(uint mode) override; - int enable_indexes(uint mode) override; - int indexes_are_disabled() override; - - /* - ------------------------------------------------------------------------- - MODULE append_create_info - ------------------------------------------------------------------------- - append_create_info is only used by MyISAM MERGE tables and the partition - handler will not support this handler as underlying handler. - Implement this?? - ------------------------------------------------------------------------- - virtual void append_create_info(String *packet) - */ - - /* - the following heavily relies on the fact that all partitions - are in the same storage engine. - - When this limitation is lifted, the following hack should go away, - and a proper interface for engines needs to be introduced: - - an PARTITION_SHARE structure that has a pointer to the TABLE_SHARE. - is given to engines everywhere where TABLE_SHARE is used now - has members like option_struct, ha_data - perhaps TABLE needs to be split the same way too... - - this can also be done before partition will support a mix of engines, - but preferably together with other incompatible API changes. - */ - handlerton *partition_ht() const override - { - handlerton *h= m_file[0]->ht; - for (uint i=1; i < m_tot_parts; i++) - DBUG_ASSERT(h == m_file[i]->ht); - return h; - } - - ha_rows part_records(partition_element *part_elem) - { - DBUG_ASSERT(m_part_info); - uint32 sub_factor= m_part_info->num_subparts ? m_part_info->num_subparts : 1; - uint32 part_id= part_elem->id * sub_factor; - uint32 part_id_end= part_id + sub_factor; - DBUG_ASSERT(part_id_end <= m_tot_parts); - ha_rows part_recs= 0; - for (; part_id < part_id_end; ++part_id) - { - handler *file= m_file[part_id]; - DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), part_id)); - file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_OPEN); - part_recs+= file->stats.records; - } - return part_recs; - } - - friend int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2); - friend int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2); - bool can_convert_string( - const Field_string* field, - const Column_definition& new_field) const override; - - bool can_convert_varstring( - const Field_varstring* field, - const Column_definition& new_field) const override; - - bool can_convert_blob( - const Field_blob* field, - const Column_definition& new_field) const override; -}; -#endif /* HA_PARTITION_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ha_sequence.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/ha_sequence.h deleted file mode 100644 index 72e59a4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ha_sequence.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef HA_SEQUENCE_INCLUDED -#define HA_SEQUENCE_INCLUDED -/* - Copyright (c) 2017 Aliyun and/or its affiliates. - Copyright (c) 2017 MariaDB corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "sql_sequence.h" -#include "table.h" -#include "handler.h" - -extern handlerton *sql_sequence_hton; - -/* - Sequence engine handler. - - The sequence engine is a logic engine. It doesn't store any data. - All the sequence data stored into the base table which must support - non rollback writes (HA_CAN_TABLES_WITHOUT_ROLLBACK) - - The sequence data (SEQUENCE class) is stored in TABLE_SHARE->sequence - - TABLE RULES: - 1. When table is created, one row is automaticlly inserted into - the table. The table will always have one and only one row. - 2. Any inserts or updates to the table will be validated. - 3. Inserts will overwrite the original row. - 4. DELETE and TRUNCATE will not affect the table. - Instead a warning will be given. - 5. Cache will be reset for any updates. - - CACHE RULES: - SEQUENCE class is used to cache values that sequence defined. - 1. If hit cache, we can query back the sequence nextval directly - instead of reading the underlying table. - - 2. When run out of values, the sequence engine will reserve new values - in update the base table. - - 3. The cache is invalidated if any update on based table. -*/ - -class ha_sequence :public handler -{ -private: - handler *file; - SEQUENCE *sequence; /* From table_share->sequence */ - -public: - /* Set when handler is write locked */ - bool write_locked; - - ha_sequence(handlerton *hton, TABLE_SHARE *share); - ~ha_sequence(); - - /* virtual function that are re-implemented for sequence */ - int open(const char *name, int mode, uint test_if_locked); - int create(const char *name, TABLE *form, - HA_CREATE_INFO *create_info); - handler *clone(const char *name, MEM_ROOT *mem_root); - int write_row(const uchar *buf); - Table_flags table_flags() const; - /* One can't update or delete from sequence engine */ - int update_row(const uchar *old_data, const uchar *new_data) - { return HA_ERR_WRONG_COMMAND; } - int delete_row(const uchar *buf) - { return HA_ERR_WRONG_COMMAND; } - /* One can't delete from sequence engine */ - int truncate() - { return HA_ERR_WRONG_COMMAND; } - /* Can't use query cache */ - uint8 table_cache_type() - { return HA_CACHE_TBL_NOCACHE; } - void print_error(int error, myf errflag); - int info(uint); - LEX_CSTRING *engine_name() { return hton_name(file->ht); } - int external_lock(THD *thd, int lock_type); - int extra(enum ha_extra_function operation); - /* For ALTER ONLINE TABLE */ - bool check_if_incompatible_data(HA_CREATE_INFO *create_info, - uint table_changes); - void write_lock() { write_locked= 1;} - void unlock() { write_locked= 0; } - bool is_locked() { return write_locked; } - - /* Functions that are directly mapped to the underlying handler */ - int rnd_init(bool scan) - { return file->rnd_init(scan); } - /* - We need to have a lock here to protect engines like MyISAM from - simultaneous read and write. For sequence's this is not critical - as this function is used extremely seldom. - */ - int rnd_next(uchar *buf) - { - int error; - table->s->sequence->read_lock(table); - error= file->rnd_next(buf); - table->s->sequence->read_unlock(table); - return error; - } - int rnd_end() - { return file->rnd_end(); } - int rnd_pos(uchar *buf, uchar *pos) - { - int error; - table->s->sequence->read_lock(table); - error= file->rnd_pos(buf, pos); - table->s->sequence->read_unlock(table); - return error; - } - void position(const uchar *record) - { return file->position(record); } - const char *table_type() const - { return file->table_type(); } - ulong index_flags(uint inx, uint part, bool all_parts) const - { return file->index_flags(inx, part, all_parts); } - THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type) - { return file->store_lock(thd, to, lock_type); } - int close(void) - { return file->close(); } - const char **bas_ext() const - { return file->bas_ext(); } - int delete_table(const char*name) - { return file->delete_table(name); } - int rename_table(const char *from, const char *to) - { return file->rename_table(from, to); } - void unbind_psi() - { file->unbind_psi(); } - void rebind_psi() - { file->rebind_psi(); } - - bool auto_repair(int error) const - { return file->auto_repair(error); } - int repair(THD* thd, HA_CHECK_OPT* check_opt) - { return file->repair(thd, check_opt); } - bool check_and_repair(THD *thd) - { return file->check_and_repair(thd); } - bool is_crashed() const - { return file->is_crashed(); } - void column_bitmaps_signal() - { return file->column_bitmaps_signal(); } - - /* New methods */ - void register_original_handler(handler *file_arg) - { - file= file_arg; - init(); /* Update cached_table_flags */ - } -}; -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/handle_connections_win.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/handle_connections_win.h deleted file mode 100644 index bf66c08..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/handle_connections_win.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2018 MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - -/** - Handles incoming socket and pipe connections, on Windows. - Creates new (THD) connections.. -*/ -extern void handle_connections_win(); -extern void network_init_win(); diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/handler.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/handler.h deleted file mode 100644 index e06b6a7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/handler.h +++ /dev/null @@ -1,5314 +0,0 @@ -#ifndef HANDLER_INCLUDED -#define HANDLER_INCLUDED -/* - Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -/* Definitions for parameters to do with handler-routines */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_const.h" -#include "sql_basic_types.h" -#include "mysqld.h" /* server_id */ -#include "sql_plugin.h" /* plugin_ref, st_plugin_int, plugin */ -#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA */ -#include "sql_cache.h" -#include "structs.h" /* SHOW_COMP_OPTION */ -#include "sql_array.h" /* Dynamic_array<> */ -#include "mdl.h" -#include "vers_string.h" - -#include "sql_analyze_stmt.h" // for Exec_time_tracker - -#include -#include -#include -#include -#include "sql_sequence.h" -#include "mem_root_array.h" - -class Alter_info; -class Virtual_column_info; -class sequence_definition; -class Rowid_filter; -class Field_string; -class Field_varstring; -class Field_blob; -class Column_definition; - -// the following is for checking tables - -#define HA_ADMIN_ALREADY_DONE 1 -#define HA_ADMIN_OK 0 -#define HA_ADMIN_NOT_IMPLEMENTED -1 -#define HA_ADMIN_FAILED -2 -#define HA_ADMIN_CORRUPT -3 -#define HA_ADMIN_INTERNAL_ERROR -4 -#define HA_ADMIN_INVALID -5 -#define HA_ADMIN_REJECT -6 -#define HA_ADMIN_TRY_ALTER -7 -#define HA_ADMIN_WRONG_CHECKSUM -8 -#define HA_ADMIN_NOT_BASE_TABLE -9 -#define HA_ADMIN_NEEDS_UPGRADE -10 -#define HA_ADMIN_NEEDS_ALTER -11 -#define HA_ADMIN_NEEDS_CHECK -12 -#define HA_ADMIN_COMMIT_ERROR -13 - -/** - Return values for check_if_supported_inplace_alter(). - - @see check_if_supported_inplace_alter() for description of - the individual values. -*/ -enum enum_alter_inplace_result { - HA_ALTER_ERROR, - HA_ALTER_INPLACE_COPY_NO_LOCK, - HA_ALTER_INPLACE_COPY_LOCK, - HA_ALTER_INPLACE_NOCOPY_LOCK, - HA_ALTER_INPLACE_NOCOPY_NO_LOCK, - HA_ALTER_INPLACE_INSTANT, - HA_ALTER_INPLACE_NOT_SUPPORTED, - HA_ALTER_INPLACE_EXCLUSIVE_LOCK, - HA_ALTER_INPLACE_SHARED_LOCK, - HA_ALTER_INPLACE_NO_LOCK -}; - -/* Flags for create_partitioning_metadata() */ - -enum chf_create_flags { - CHF_CREATE_FLAG, - CHF_DELETE_FLAG, - CHF_RENAME_FLAG, - CHF_INDEX_FLAG -}; - -/* Bits in table_flags() to show what database can do */ - -#define HA_NO_TRANSACTIONS (1ULL << 0) /* Doesn't support transactions */ -#define HA_PARTIAL_COLUMN_READ (1ULL << 1) /* read may not return all columns */ -#define HA_TABLE_SCAN_ON_INDEX (1ULL << 2) /* No separate data/index file */ -/* - The following should be set if the following is not true when scanning - a table with rnd_next() - - We will see all rows (including deleted ones) - - Row positions are 'table->s->db_record_offset' apart - If this flag is not set, filesort will do a position() call for each matched - row to be able to find the row later. -*/ -#define HA_REC_NOT_IN_SEQ (1ULL << 3) -#define HA_CAN_GEOMETRY (1ULL << 4) -/* - Reading keys in random order is as fast as reading keys in sort order - (Used in records.cc to decide if we should use a record cache and by - filesort to decide if we should sort key + data or key + pointer-to-row -*/ -#define HA_FAST_KEY_READ (1ULL << 5) -/* - Set the following flag if we on delete should force all key to be read - and on update read all keys that changes -*/ -#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1ULL << 6) -#define HA_NULL_IN_KEY (1ULL << 7) /* One can have keys with NULL */ -#define HA_DUPLICATE_POS (1ULL << 8) /* ha_position() gives dup row */ -#define HA_NO_BLOBS (1ULL << 9) /* Doesn't support blobs */ -#define HA_CAN_INDEX_BLOBS (1ULL << 10) -#define HA_AUTO_PART_KEY (1ULL << 11) /* auto-increment in multi-part key */ -/* - The engine requires every table to have a user-specified PRIMARY KEY. - Do not set the flag if the engine can generate a hidden primary key internally. - This flag is ignored if a SEQUENCE is created (which, in turn, needs - HA_CAN_TABLES_WITHOUT_ROLLBACK flag) -*/ -#define HA_REQUIRE_PRIMARY_KEY (1ULL << 12) -#define HA_STATS_RECORDS_IS_EXACT (1ULL << 13) /* stats.records is exact */ -/* - INSERT_DELAYED only works with handlers that uses MySQL internal table - level locks -*/ -#define HA_CAN_INSERT_DELAYED (1ULL << 14) -/* - If we get the primary key columns for free when we do an index read - (usually, it also implies that HA_PRIMARY_KEY_REQUIRED_FOR_POSITION - flag is set). -*/ -#define HA_PRIMARY_KEY_IN_READ_INDEX (1ULL << 15) -/* - If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position() - uses a primary key given by the record argument. - Without primary key, we can't call position(). - If not set, the position is returned as the current rows position - regardless of what argument is given. -*/ -#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1ULL << 16) -#define HA_CAN_RTREEKEYS (1ULL << 17) -#define HA_NOT_DELETE_WITH_CACHE (1ULL << 18) /* unused */ -/* - The following is we need to a primary key to delete (and update) a row. - If there is no primary key, all columns needs to be read on update and delete -*/ -#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1ULL << 19) -#define HA_NO_PREFIX_CHAR_KEYS (1ULL << 20) -#define HA_CAN_FULLTEXT (1ULL << 21) -#define HA_CAN_SQL_HANDLER (1ULL << 22) -#define HA_NO_AUTO_INCREMENT (1ULL << 23) -/* Has automatic checksums and uses the old checksum format */ -#define HA_HAS_OLD_CHECKSUM (1ULL << 24) -/* Table data are stored in separate files (for lower_case_table_names) */ -#define HA_FILE_BASED (1ULL << 26) -#define HA_CAN_BIT_FIELD (1ULL << 28) /* supports bit fields */ -#define HA_NEED_READ_RANGE_BUFFER (1ULL << 29) /* for read_multi_range */ -#define HA_ANY_INDEX_MAY_BE_UNIQUE (1ULL << 30) -#define HA_NO_COPY_ON_ALTER (1ULL << 31) -#define HA_HAS_RECORDS (1ULL << 32) /* records() gives exact count*/ -/* Has it's own method of binlog logging */ -#define HA_HAS_OWN_BINLOGGING (1ULL << 33) -/* - Engine is capable of row-format and statement-format logging, - respectively -*/ -#define HA_BINLOG_ROW_CAPABLE (1ULL << 34) -#define HA_BINLOG_STMT_CAPABLE (1ULL << 35) - -/* - When a multiple key conflict happens in a REPLACE command mysql - expects the conflicts to be reported in the ascending order of - key names. - - For e.g. - - CREATE TABLE t1 (a INT, UNIQUE (a), b INT NOT NULL, UNIQUE (b), c INT NOT - NULL, INDEX(c)); - - REPLACE INTO t1 VALUES (1,1,1),(2,2,2),(2,1,3); - - MySQL expects the conflict with 'a' to be reported before the conflict with - 'b'. - - If the underlying storage engine does not report the conflicting keys in - ascending order, it causes unexpected errors when the REPLACE command is - executed. - - This flag helps the underlying SE to inform the server that the keys are not - ordered. -*/ -#define HA_DUPLICATE_KEY_NOT_IN_ORDER (1ULL << 36) - -/* - Engine supports REPAIR TABLE. Used by CHECK TABLE FOR UPGRADE if an - incompatible table is detected. If this flag is set, CHECK TABLE FOR UPGRADE - will report ER_TABLE_NEEDS_UPGRADE, otherwise ER_TABLE_NEED_REBUILD. -*/ -#define HA_CAN_REPAIR (1ULL << 37) - -/* Has automatic checksums and uses the new checksum format */ -#define HA_HAS_NEW_CHECKSUM (1ULL << 38) -#define HA_CAN_VIRTUAL_COLUMNS (1ULL << 39) -#define HA_MRR_CANT_SORT (1ULL << 40) -/* All of VARCHAR is stored, including bytes after real varchar data */ -#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (1ULL << 41) - -/* - This storage engine supports condition pushdown -*/ -#define HA_CAN_TABLE_CONDITION_PUSHDOWN (1ULL << 42) -/* old name for the same flag */ -#define HA_MUST_USE_TABLE_CONDITION_PUSHDOWN HA_CAN_TABLE_CONDITION_PUSHDOWN - -/** - The handler supports read before write removal optimization - - Read before write removal may be used for storage engines which support - write without previous read of the row to be updated. Handler returning - this flag must implement start_read_removal() and end_read_removal(). - The handler may return "fake" rows constructed from the key of the row - asked for. This is used to optimize UPDATE and DELETE by reducing the - number of roundtrips between handler and storage engine. - - Example: - UPDATE a=1 WHERE pk IN () - - mysql_update() - { - if () - start_read_removal() - -> handler returns true if read removal supported for this table/query - - while(read_record("pk=")) - -> handler returns fake row with column "pk" set to - - ha_update_row() - -> handler sends write "a=1" for row with "pk=" - - end_read_removal() - -> handler returns the number of rows actually written - } - - @note This optimization in combination with batching may be used to - remove even more roundtrips. -*/ -#define HA_READ_BEFORE_WRITE_REMOVAL (1ULL << 43) - -/* - Engine supports extended fulltext API - */ -#define HA_CAN_FULLTEXT_EXT (1ULL << 44) - -/* - Storage engine supports table export using the - FLUSH TABLE FOR EXPORT statement - (meaning, after this statement one can copy table files out of the - datadir and later "import" (somehow) in another MariaDB instance) - */ -#define HA_CAN_EXPORT (1ULL << 45) - -/* - Storage engine does not require an exclusive metadata lock - on the table during optimize. (TODO and repair?). - It can allow other connections to open the table. - (it does not necessarily mean that other connections can - read or modify the table - this is defined by THR locks and the - ::store_lock() method). -*/ -#define HA_CONCURRENT_OPTIMIZE (1ULL << 46) - -/* - If the storage engine support tables that will not roll back on commit - In addition the table should not lock rows and support READ and WRITE - UNCOMMITTED. - This is useful for implementing things like SEQUENCE but can also in - the future be useful to do logging that should never roll back. -*/ -#define HA_CAN_TABLES_WITHOUT_ROLLBACK (1ULL << 47) - -/* - Mainly for usage by SEQUENCE engine. Setting this flag means - that the table will never roll back and that all operations - for this table should stored in the non transactional log - space that will always be written, even on rollback. -*/ - -#define HA_PERSISTENT_TABLE (1ULL << 48) - -/* If storage engine uses another engine as a base */ -#define HA_REUSES_FILE_NAMES (1ULL << 49) - -/* - Set of all binlog flags. Currently only contain the capabilities - flags. - */ -#define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE) - -/* The following are used by Spider */ -#define HA_CAN_FORCE_BULK_UPDATE (1ULL << 50) -#define HA_CAN_FORCE_BULK_DELETE (1ULL << 51) -#define HA_CAN_DIRECT_UPDATE_AND_DELETE (1ULL << 52) - -/* The following is for partition handler */ -#define HA_CAN_MULTISTEP_MERGE (1LL << 53) - -/* calling cmp_ref() on the engine is expensive */ -#define HA_SLOW_CMP_REF (1ULL << 54) -#define HA_CMP_REF_IS_EXPENSIVE HA_SLOW_CMP_REF - -/** - Some engines are unable to provide an efficient implementation for rnd_pos(). - Server will try to avoid it, if possible - - TODO better to do it with cost estimates, not with an explicit flag -*/ -#define HA_SLOW_RND_POS (1ULL << 55) - -/* Safe for online backup */ -#define HA_CAN_ONLINE_BACKUPS (1ULL << 56) - -/* Support native hash index */ -#define HA_CAN_HASH_KEYS (1ULL << 57) -#define HA_CRASH_SAFE (1ULL << 58) - -/* - There is no need to evict the table from the table definition cache having - run ANALYZE TABLE on it - */ -#define HA_ONLINE_ANALYZE (1ULL << 59) - -#define HA_LAST_TABLE_FLAG HA_ONLINE_ANALYZE - - -/* bits in index_flags(index_number) for what you can do with index */ -#define HA_READ_NEXT 1 /* TODO really use this flag */ -#define HA_READ_PREV 2 /* supports ::index_prev */ -#define HA_READ_ORDER 4 /* index_next/prev follow sort order */ -#define HA_READ_RANGE 8 /* can find all records in a range */ -#define HA_ONLY_WHOLE_INDEX 16 /* Can't use part key searches */ -#define HA_KEYREAD_ONLY 64 /* Support HA_EXTRA_KEYREAD */ - -/* - Index scan will not return records in rowid order. Not guaranteed to be - set for unordered (e.g. HASH) indexes. -*/ -#define HA_KEY_SCAN_NOT_ROR 128 -#define HA_DO_INDEX_COND_PUSHDOWN 256 /* Supports Index Condition Pushdown */ -/* - Data is clustered on this key. This means that when you read the key - you also get the row data without any additional disk reads. -*/ -#define HA_CLUSTERED_INDEX 512 - -#define HA_DO_RANGE_FILTER_PUSHDOWN 1024 - -/* - bits in alter_table_flags: -*/ -/* - These bits are set if different kinds of indexes can be created or dropped - in-place without re-creating the table using a temporary table. - NO_READ_WRITE indicates that the handler needs concurrent reads and writes - of table data to be blocked. - Partitioning needs both ADD and DROP to be supported by its underlying - handlers, due to error handling, see bug#57778. -*/ -#define HA_INPLACE_ADD_INDEX_NO_READ_WRITE (1UL << 0) -#define HA_INPLACE_DROP_INDEX_NO_READ_WRITE (1UL << 1) -#define HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE (1UL << 2) -#define HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE (1UL << 3) -#define HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE (1UL << 4) -#define HA_INPLACE_DROP_PK_INDEX_NO_READ_WRITE (1UL << 5) -/* - These are set if different kinds of indexes can be created or dropped - in-place while still allowing concurrent reads (but not writes) of table - data. If a handler is capable of one or more of these, it should also set - the corresponding *_NO_READ_WRITE bit(s). -*/ -#define HA_INPLACE_ADD_INDEX_NO_WRITE (1UL << 6) -#define HA_INPLACE_DROP_INDEX_NO_WRITE (1UL << 7) -#define HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE (1UL << 8) -#define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE (1UL << 9) -#define HA_INPLACE_ADD_PK_INDEX_NO_WRITE (1UL << 10) -#define HA_INPLACE_DROP_PK_INDEX_NO_WRITE (1UL << 11) -/* - HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is - supported at all. - HA_FAST_CHANGE_PARTITION means that optimised variants of the changes - exists but they are not necessarily done online. - - HA_ONLINE_DOUBLE_WRITE means that the handler supports writing to both - the new partition and to the old partitions when updating through the - old partitioning schema while performing a change of the partitioning. - This means that we can support updating of the table while performing - the copy phase of the change. For no lock at all also a double write - from new to old must exist and this is not required when this flag is - set. - This is actually removed even before it was introduced the first time. - The new idea is that handlers will handle the lock level already in - store_lock for ALTER TABLE partitions. - - HA_PARTITION_ONE_PHASE is a flag that can be set by handlers that take - care of changing the partitions online and in one phase. Thus all phases - needed to handle the change are implemented inside the storage engine. - The storage engine must also support auto-discovery since the frm file - is changed as part of the change and this change must be controlled by - the storage engine. A typical engine to support this is NDB (through - WL #2498). -*/ -#define HA_PARTITION_FUNCTION_SUPPORTED (1UL << 12) -#define HA_FAST_CHANGE_PARTITION (1UL << 13) -#define HA_PARTITION_ONE_PHASE (1UL << 14) - -/* operations for disable/enable indexes */ -#define HA_KEY_SWITCH_NONUNIQ 0 -#define HA_KEY_SWITCH_ALL 1 -#define HA_KEY_SWITCH_NONUNIQ_SAVE 2 -#define HA_KEY_SWITCH_ALL_SAVE 3 - -/* - Note: the following includes binlog and closing 0. - TODO remove the limit, use dynarrays -*/ -#define MAX_HA 64 - -/* - Use this instead of 0 as the initial value for the slot number of - handlerton, so that we can distinguish uninitialized slot number - from slot 0. -*/ -#define HA_SLOT_UNDEF ((uint)-1) - -/* - Parameters for open() (in register form->filestat) - HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED -*/ - -#define HA_OPEN_KEYFILE 1U -#define HA_READ_ONLY 16U /* File opened as readonly */ -/* Try readonly if can't open with read and write */ -#define HA_TRY_READ_ONLY 32U - - /* Some key definitions */ -#define HA_KEY_NULL_LENGTH 1 -#define HA_KEY_BLOB_LENGTH 2 - -/* Maximum length of any index lookup key, in bytes */ - -#define MAX_KEY_LENGTH (MAX_DATA_LENGTH_FOR_KEY \ - +(MAX_REF_PARTS \ - *(HA_KEY_NULL_LENGTH + HA_KEY_BLOB_LENGTH))) - -#define HA_LEX_CREATE_TMP_TABLE 1U -#define HA_CREATE_TMP_ALTER 8U -#define HA_LEX_CREATE_SEQUENCE 16U -#define HA_VERSIONED_TABLE 32U - -#define HA_MAX_REC_LENGTH 65535 - -/* Table caching type */ -#define HA_CACHE_TBL_NONTRANSACT 0 -#define HA_CACHE_TBL_NOCACHE 1U -#define HA_CACHE_TBL_ASKTRANSACT 2U -#define HA_CACHE_TBL_TRANSACT 4U - -/** - Options for the START TRANSACTION statement. - - Note that READ ONLY and READ WRITE are logically mutually exclusive. - This is enforced by the parser and depended upon by trans_begin(). - - We need two flags instead of one in order to differentiate between - situation when no READ WRITE/ONLY clause were given and thus transaction - is implicitly READ WRITE and the case when READ WRITE clause was used - explicitly. -*/ - -// WITH CONSISTENT SNAPSHOT option -static const uint MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT = 1; -// READ ONLY option -static const uint MYSQL_START_TRANS_OPT_READ_ONLY = 2; -// READ WRITE option -static const uint MYSQL_START_TRANS_OPT_READ_WRITE = 4; - -/* Flags for method is_fatal_error */ -#define HA_CHECK_DUP_KEY 1U -#define HA_CHECK_DUP_UNIQUE 2U -#define HA_CHECK_FK_ERROR 4U -#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE) -#define HA_CHECK_ALL (~0U) - -/* Options for info_push() */ -#define INFO_KIND_UPDATE_FIELDS 101 -#define INFO_KIND_UPDATE_VALUES 102 -#define INFO_KIND_FORCE_LIMIT_BEGIN 103 -#define INFO_KIND_FORCE_LIMIT_END 104 - -enum legacy_db_type -{ - /* note these numerical values are fixed and can *not* be changed */ - DB_TYPE_UNKNOWN=0, - DB_TYPE_HEAP=6, - DB_TYPE_MYISAM=9, - DB_TYPE_MRG_MYISAM=10, - DB_TYPE_INNODB=12, - DB_TYPE_EXAMPLE_DB=15, - DB_TYPE_ARCHIVE_DB=16, - DB_TYPE_CSV_DB=17, - DB_TYPE_FEDERATED_DB=18, - DB_TYPE_BLACKHOLE_DB=19, - DB_TYPE_PARTITION_DB=20, - DB_TYPE_BINLOG=21, - DB_TYPE_PBXT=23, - DB_TYPE_PERFORMANCE_SCHEMA=28, - DB_TYPE_S3=41, - DB_TYPE_ARIA=42, - DB_TYPE_TOKUDB=43, - DB_TYPE_SEQUENCE=44, - DB_TYPE_FIRST_DYNAMIC=45, - DB_TYPE_DEFAULT=127 // Must be last -}; -/* - Better name for DB_TYPE_UNKNOWN. Should be used for engines that do not have - a hard-coded type value here. - */ -#define DB_TYPE_AUTOASSIGN DB_TYPE_UNKNOWN - -enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, - ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED, - ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE }; - -/* not part of the enum, so that it shouldn't be in switch(row_type) */ -#define ROW_TYPE_MAX ((uint)ROW_TYPE_PAGE + 1) - -/* Specifies data storage format for individual columns */ -enum column_format_type { - COLUMN_FORMAT_TYPE_DEFAULT= 0, /* Not specified (use engine default) */ - COLUMN_FORMAT_TYPE_FIXED= 1, /* FIXED format */ - COLUMN_FORMAT_TYPE_DYNAMIC= 2 /* DYNAMIC format */ -}; - -enum enum_binlog_func { - BFN_RESET_LOGS= 1, - BFN_RESET_SLAVE= 2, - BFN_BINLOG_WAIT= 3, - BFN_BINLOG_END= 4, - BFN_BINLOG_PURGE_FILE= 5 -}; - -enum enum_binlog_command { - LOGCOM_CREATE_TABLE, - LOGCOM_ALTER_TABLE, - LOGCOM_RENAME_TABLE, - LOGCOM_DROP_TABLE, - LOGCOM_CREATE_DB, - LOGCOM_ALTER_DB, - LOGCOM_DROP_DB -}; - -/* struct to hold information about the table that should be created */ - -/* Bits in used_fields */ -#define HA_CREATE_USED_AUTO (1UL << 0) -#define HA_CREATE_USED_RAID (1UL << 1) //RAID is no longer available -#define HA_CREATE_USED_UNION (1UL << 2) -#define HA_CREATE_USED_INSERT_METHOD (1UL << 3) -#define HA_CREATE_USED_MIN_ROWS (1UL << 4) -#define HA_CREATE_USED_MAX_ROWS (1UL << 5) -#define HA_CREATE_USED_AVG_ROW_LENGTH (1UL << 6) -#define HA_CREATE_USED_PACK_KEYS (1UL << 7) -#define HA_CREATE_USED_CHARSET (1UL << 8) -#define HA_CREATE_USED_DEFAULT_CHARSET (1UL << 9) -#define HA_CREATE_USED_DATADIR (1UL << 10) -#define HA_CREATE_USED_INDEXDIR (1UL << 11) -#define HA_CREATE_USED_ENGINE (1UL << 12) -#define HA_CREATE_USED_CHECKSUM (1UL << 13) -#define HA_CREATE_USED_DELAY_KEY_WRITE (1UL << 14) -#define HA_CREATE_USED_ROW_FORMAT (1UL << 15) -#define HA_CREATE_USED_COMMENT (1UL << 16) -#define HA_CREATE_USED_PASSWORD (1UL << 17) -#define HA_CREATE_USED_CONNECTION (1UL << 18) -#define HA_CREATE_USED_KEY_BLOCK_SIZE (1UL << 19) -/* The following two are used by Maria engine: */ -#define HA_CREATE_USED_TRANSACTIONAL (1UL << 20) -#define HA_CREATE_USED_PAGE_CHECKSUM (1UL << 21) -/** This is set whenever STATS_PERSISTENT=0|1|default has been -specified in CREATE/ALTER TABLE. See also HA_OPTION_STATS_PERSISTENT in -include/my_base.h. It is possible to distinguish whether -STATS_PERSISTENT=default has been specified or no STATS_PERSISTENT= is -given at all. */ -#define HA_CREATE_USED_STATS_PERSISTENT (1UL << 22) -/** - This is set whenever STATS_AUTO_RECALC=0|1|default has been - specified in CREATE/ALTER TABLE. See enum_stats_auto_recalc. - It is possible to distinguish whether STATS_AUTO_RECALC=default - has been specified or no STATS_AUTO_RECALC= is given at all. -*/ -#define HA_CREATE_USED_STATS_AUTO_RECALC (1UL << 23) -/** - This is set whenever STATS_SAMPLE_PAGES=N|default has been - specified in CREATE/ALTER TABLE. It is possible to distinguish whether - STATS_SAMPLE_PAGES=default has been specified or no STATS_SAMPLE_PAGES= is - given at all. -*/ -#define HA_CREATE_USED_STATS_SAMPLE_PAGES (1UL << 24) - -/* Create a sequence */ -#define HA_CREATE_USED_SEQUENCE (1UL << 25) -/* Tell binlog_show_create_table to print all engine options */ -#define HA_CREATE_PRINT_ALL_OPTIONS (1UL << 26) - -typedef ulonglong alter_table_operations; -typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*); - -/* - These flags are set by the parser and describes the type of - operation(s) specified by the ALTER TABLE statement. -*/ - -// Set by parser for ADD [COLUMN] -#define ALTER_PARSER_ADD_COLUMN (1ULL << 0) -// Set by parser for DROP [COLUMN] -#define ALTER_PARSER_DROP_COLUMN (1ULL << 1) -// Set for CHANGE [COLUMN] | MODIFY [CHANGE] & mysql_recreate_table -#define ALTER_CHANGE_COLUMN (1ULL << 2) -// Set for ADD INDEX | ADD KEY | ADD PRIMARY KEY | ADD UNIQUE KEY | -// ADD UNIQUE INDEX | ALTER ADD [COLUMN] -#define ALTER_ADD_INDEX (1ULL << 3) -// Set for DROP PRIMARY KEY | DROP FOREIGN KEY | DROP KEY | DROP INDEX -#define ALTER_DROP_INDEX (1ULL << 4) -// Set for RENAME [TO] -#define ALTER_RENAME (1ULL << 5) -// Set for ORDER BY -#define ALTER_ORDER (1ULL << 6) -// Set for table_options, like table comment -#define ALTER_OPTIONS (1ULL << 7) -// Set for ALTER [COLUMN] ... SET DEFAULT ... | DROP DEFAULT -#define ALTER_CHANGE_COLUMN_DEFAULT (1ULL << 8) -// Set for DISABLE KEYS | ENABLE KEYS -#define ALTER_KEYS_ONOFF (1ULL << 9) -// Set for FORCE, ENGINE(same engine), by mysql_recreate_table() -#define ALTER_RECREATE (1ULL << 10) -// Set for CONVERT TO -#define ALTER_CONVERT_TO (1ULL << 11) -// Set for DROP ... ADD some_index -#define ALTER_RENAME_INDEX (1ULL << 12) -// Set for ADD FOREIGN KEY -#define ALTER_ADD_FOREIGN_KEY (1ULL << 21) -// Set for DROP FOREIGN KEY -#define ALTER_DROP_FOREIGN_KEY (1ULL << 22) -#define ALTER_CHANGE_INDEX_COMMENT (1ULL << 23) -// Set for ADD [COLUMN] FIRST | AFTER -#define ALTER_COLUMN_ORDER (1ULL << 25) -#define ALTER_ADD_CHECK_CONSTRAINT (1ULL << 27) -#define ALTER_DROP_CHECK_CONSTRAINT (1ULL << 28) -#define ALTER_RENAME_COLUMN (1ULL << 29) -#define ALTER_COLUMN_UNVERSIONED (1ULL << 30) -#define ALTER_ADD_SYSTEM_VERSIONING (1ULL << 31) -#define ALTER_DROP_SYSTEM_VERSIONING (1ULL << 32) -#define ALTER_ADD_PERIOD (1ULL << 33) -#define ALTER_DROP_PERIOD (1ULL << 34) - -/* - Following defines are used by ALTER_INPLACE_TABLE - - They do describe in more detail the type operation(s) to be executed - by the storage engine. For example, which type of type of index to be - added/dropped. These are set by fill_alter_inplace_info(). -*/ - -#define ALTER_RECREATE_TABLE ALTER_RECREATE -#define ALTER_CHANGE_CREATE_OPTION ALTER_OPTIONS -#define ALTER_ADD_COLUMN (ALTER_ADD_VIRTUAL_COLUMN | \ - ALTER_ADD_STORED_BASE_COLUMN | \ - ALTER_ADD_STORED_GENERATED_COLUMN) -#define ALTER_DROP_COLUMN (ALTER_DROP_VIRTUAL_COLUMN | \ - ALTER_DROP_STORED_COLUMN) -#define ALTER_COLUMN_DEFAULT ALTER_CHANGE_COLUMN_DEFAULT - -// Add non-unique, non-primary index -#define ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX (1ULL << 35) - -// Drop non-unique, non-primary index -#define ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX (1ULL << 36) - -// Add unique, non-primary index -#define ALTER_ADD_UNIQUE_INDEX (1ULL << 37) - -// Drop unique, non-primary index -#define ALTER_DROP_UNIQUE_INDEX (1ULL << 38) - -// Add primary index -#define ALTER_ADD_PK_INDEX (1ULL << 39) - -// Drop primary index -#define ALTER_DROP_PK_INDEX (1ULL << 40) - -// Virtual generated column -#define ALTER_ADD_VIRTUAL_COLUMN (1ULL << 41) -// Stored base (non-generated) column -#define ALTER_ADD_STORED_BASE_COLUMN (1ULL << 42) -// Stored generated column -#define ALTER_ADD_STORED_GENERATED_COLUMN (1ULL << 43) - -// Drop column -#define ALTER_DROP_VIRTUAL_COLUMN (1ULL << 44) -#define ALTER_DROP_STORED_COLUMN (1ULL << 45) - -// Rename column (verified; ALTER_RENAME_COLUMN may use original name) -#define ALTER_COLUMN_NAME (1ULL << 46) - -// Change column datatype -#define ALTER_VIRTUAL_COLUMN_TYPE (1ULL << 47) -#define ALTER_STORED_COLUMN_TYPE (1ULL << 48) - - -// Engine can handle type change by itself in ALGORITHM=INPLACE -#define ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE (1ULL << 49) - -// Reorder column -#define ALTER_STORED_COLUMN_ORDER (1ULL << 50) - -// Reorder column -#define ALTER_VIRTUAL_COLUMN_ORDER (1ULL << 51) - -// Change column from NOT NULL to NULL -#define ALTER_COLUMN_NULLABLE (1ULL << 52) - -// Change column from NULL to NOT NULL -#define ALTER_COLUMN_NOT_NULLABLE (1ULL << 53) - -// Change column generation expression -#define ALTER_VIRTUAL_GCOL_EXPR (1ULL << 54) -#define ALTER_STORED_GCOL_EXPR (1ULL << 55) - -// column's engine options changed, something in field->option_struct -#define ALTER_COLUMN_OPTION (1ULL << 56) - -// MySQL alias for the same thing: -#define ALTER_COLUMN_STORAGE_TYPE ALTER_COLUMN_OPTION - -// Change the column format of column -#define ALTER_COLUMN_COLUMN_FORMAT (1ULL << 57) - -/** - Changes in generated columns that affect storage, - for example, when a vcol type or expression changes - and this vcol is indexed or used in a partitioning expression -*/ -#define ALTER_COLUMN_VCOL (1ULL << 58) - -/** - ALTER TABLE for a partitioned table. The engine needs to commit - online alter of all partitions atomically (using group_commit_ctx) -*/ -#define ALTER_PARTITIONED (1ULL << 59) - -/** - Change in index length such that it doesn't require index rebuild. -*/ -#define ALTER_COLUMN_INDEX_LENGTH (1ULL << 60) - -/* - Flags set in partition_flags when altering partitions -*/ - -// Set for ADD PARTITION -#define ALTER_PARTITION_ADD (1ULL << 1) -// Set for DROP PARTITION -#define ALTER_PARTITION_DROP (1ULL << 2) -// Set for COALESCE PARTITION -#define ALTER_PARTITION_COALESCE (1ULL << 3) -// Set for REORGANIZE PARTITION ... INTO -#define ALTER_PARTITION_REORGANIZE (1ULL << 4) -// Set for partition_options -#define ALTER_PARTITION_INFO (1ULL << 5) -// Set for LOAD INDEX INTO CACHE ... PARTITION -// Set for CACHE INDEX ... PARTITION -#define ALTER_PARTITION_ADMIN (1ULL << 6) -// Set for REBUILD PARTITION -#define ALTER_PARTITION_REBUILD (1ULL << 7) -// Set for partitioning operations specifying ALL keyword -#define ALTER_PARTITION_ALL (1ULL << 8) -// Set for REMOVE PARTITIONING -#define ALTER_PARTITION_REMOVE (1ULL << 9) -// Set for EXCHANGE PARITION -#define ALTER_PARTITION_EXCHANGE (1ULL << 10) -// Set by Sql_cmd_alter_table_truncate_partition::execute() -#define ALTER_PARTITION_TRUNCATE (1ULL << 11) -// Set for REORGANIZE PARTITION -#define ALTER_PARTITION_TABLE_REORG (1ULL << 12) - -/* - This is master database for most of system tables. However there - can be other databases which can hold system tables. Respective - storage engines define their own system database names. -*/ -extern const char *mysqld_system_database; - -/* - Structure to hold list of system_database.system_table. - This is used at both mysqld and storage engine layer. -*/ -struct st_system_tablename -{ - const char *db; - const char *tablename; -}; - - -typedef ulonglong my_xid; // this line is the same as in log_event.h -#define MYSQL_XID_PREFIX "MySQLXid" -#define MYSQL_XID_PREFIX_LEN 8 // must be a multiple of 8 -#define MYSQL_XID_OFFSET (MYSQL_XID_PREFIX_LEN+sizeof(server_id)) -#define MYSQL_XID_GTRID_LEN (MYSQL_XID_OFFSET+sizeof(my_xid)) - -#define XIDDATASIZE MYSQL_XIDDATASIZE -#define MAXGTRIDSIZE 64 -#define MAXBQUALSIZE 64 - -#define COMPATIBLE_DATA_YES 0 -#define COMPATIBLE_DATA_NO 1 - -/** - struct xid_t is binary compatible with the XID structure as - in the X/Open CAE Specification, Distributed Transaction Processing: - The XA Specification, X/Open Company Ltd., 1991. - http://www.opengroup.org/bookstore/catalog/c193.htm - - @see MYSQL_XID in mysql/plugin.h -*/ -struct xid_t { - long formatID; - long gtrid_length; - long bqual_length; - char data[XIDDATASIZE]; // not \0-terminated ! - - xid_t() {} /* Remove gcc warning */ - bool eq(struct xid_t *xid) const - { return !xid->is_null() && eq(xid->gtrid_length, xid->bqual_length, xid->data); } - bool eq(long g, long b, const char *d) const - { return !is_null() && g == gtrid_length && b == bqual_length && !memcmp(d, data, g+b); } - void set(struct xid_t *xid) - { memcpy(this, xid, xid->length()); } - void set(long f, const char *g, long gl, const char *b, long bl) - { - formatID= f; - memcpy(data, g, gtrid_length= gl); - memcpy(data+gl, b, bqual_length= bl); - } - void set(ulonglong xid) - { - my_xid tmp; - formatID= 1; - set(MYSQL_XID_PREFIX_LEN, 0, MYSQL_XID_PREFIX); - memcpy(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id)); - tmp= xid; - memcpy(data+MYSQL_XID_OFFSET, &tmp, sizeof(tmp)); - gtrid_length=MYSQL_XID_GTRID_LEN; - } - void set(long g, long b, const char *d) - { - formatID= 1; - gtrid_length= g; - bqual_length= b; - memcpy(data, d, g+b); - } - bool is_null() const { return formatID == -1; } - void null() { formatID= -1; } - my_xid quick_get_my_xid() - { - my_xid tmp; - memcpy(&tmp, data+MYSQL_XID_OFFSET, sizeof(tmp)); - return tmp; - } - my_xid get_my_xid() - { - return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 && - !memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ? - quick_get_my_xid() : 0; - } - uint length() - { - return static_cast(sizeof(formatID)) + key_length(); - } - uchar *key() const - { - return (uchar *)>rid_length; - } - uint key_length() const - { - return static_cast(sizeof(gtrid_length)+sizeof(bqual_length)+ - gtrid_length+bqual_length); - } -}; -typedef struct xid_t XID; - -/* for recover() handlerton call */ -#define MIN_XID_LIST_SIZE 128 -#define MAX_XID_LIST_SIZE (1024*128) - -/* - These structures are used to pass information from a set of SQL commands - on add/drop/change tablespace definitions to the proper hton. -*/ -#define UNDEF_NODEGROUP 65535 -enum ts_command_type -{ - TS_CMD_NOT_DEFINED = -1, - CREATE_TABLESPACE = 0, - ALTER_TABLESPACE = 1, - CREATE_LOGFILE_GROUP = 2, - ALTER_LOGFILE_GROUP = 3, - DROP_TABLESPACE = 4, - DROP_LOGFILE_GROUP = 5, - CHANGE_FILE_TABLESPACE = 6, - ALTER_ACCESS_MODE_TABLESPACE = 7 -}; - -enum ts_alter_tablespace_type -{ - TS_ALTER_TABLESPACE_TYPE_NOT_DEFINED = -1, - ALTER_TABLESPACE_ADD_FILE = 1, - ALTER_TABLESPACE_DROP_FILE = 2 -}; - -enum tablespace_access_mode -{ - TS_NOT_DEFINED= -1, - TS_READ_ONLY = 0, - TS_READ_WRITE = 1, - TS_NOT_ACCESSIBLE = 2 -}; - -/* Statistics about batch operations like bulk_insert */ -struct ha_copy_info -{ - ha_rows records; /* Used to check if rest of variables can be used */ - ha_rows touched; - ha_rows copied; - ha_rows deleted; - ha_rows updated; -}; - -struct handlerton; -class st_alter_tablespace : public Sql_alloc -{ - public: - const char *tablespace_name; - const char *logfile_group_name; - enum ts_command_type ts_cmd_type; - enum ts_alter_tablespace_type ts_alter_tablespace_type; - const char *data_file_name; - const char *undo_file_name; - const char *redo_file_name; - ulonglong extent_size; - ulonglong undo_buffer_size; - ulonglong redo_buffer_size; - ulonglong initial_size; - ulonglong autoextend_size; - ulonglong max_size; - uint nodegroup_id; - handlerton *storage_engine; - bool wait_until_completed; - const char *ts_comment; - enum tablespace_access_mode ts_access_mode; - st_alter_tablespace() - { - tablespace_name= NULL; - logfile_group_name= "DEFAULT_LG"; //Default log file group - ts_cmd_type= TS_CMD_NOT_DEFINED; - data_file_name= NULL; - undo_file_name= NULL; - redo_file_name= NULL; - extent_size= 1024*1024; //Default 1 MByte - undo_buffer_size= 8*1024*1024; //Default 8 MByte - redo_buffer_size= 8*1024*1024; //Default 8 MByte - initial_size= 128*1024*1024; //Default 128 MByte - autoextend_size= 0; //No autoextension as default - max_size= 0; //Max size == initial size => no extension - storage_engine= NULL; - nodegroup_id= UNDEF_NODEGROUP; - wait_until_completed= TRUE; - ts_comment= NULL; - ts_access_mode= TS_NOT_DEFINED; - } -}; - -/* The handler for a table type. Will be included in the TABLE structure */ - -struct TABLE; - -/* - Make sure that the order of schema_tables and enum_schema_tables are the same. -*/ -enum enum_schema_tables -{ - SCH_ALL_PLUGINS, - SCH_APPLICABLE_ROLES, - SCH_CHARSETS, - SCH_CHECK_CONSTRAINTS, - SCH_COLLATIONS, - SCH_COLLATION_CHARACTER_SET_APPLICABILITY, - SCH_COLUMNS, - SCH_COLUMN_PRIVILEGES, - SCH_ENABLED_ROLES, - SCH_ENGINES, - SCH_EVENTS, - SCH_EXPLAIN, - SCH_FILES, - SCH_GLOBAL_STATUS, - SCH_GLOBAL_VARIABLES, - SCH_KEY_CACHES, - SCH_KEY_COLUMN_USAGE, - SCH_OPEN_TABLES, - SCH_OPT_TRACE, - SCH_PARAMETERS, - SCH_PARTITIONS, - SCH_PLUGINS, - SCH_PROCESSLIST, - SCH_PROFILES, - SCH_REFERENTIAL_CONSTRAINTS, - SCH_PROCEDURES, - SCH_SCHEMATA, - SCH_SCHEMA_PRIVILEGES, - SCH_SESSION_STATUS, - SCH_SESSION_VARIABLES, - SCH_STATISTICS, - SCH_SYSTEM_VARIABLES, - SCH_TABLES, - SCH_TABLESPACES, - SCH_TABLE_CONSTRAINTS, - SCH_TABLE_NAMES, - SCH_TABLE_PRIVILEGES, - SCH_TRIGGERS, - SCH_USER_PRIVILEGES, - SCH_VIEWS -}; - -struct TABLE_SHARE; -struct HA_CREATE_INFO; -struct st_foreign_key_info; -typedef struct st_foreign_key_info FOREIGN_KEY_INFO; -typedef bool (stat_print_fn)(THD *thd, const char *type, size_t type_len, - const char *file, size_t file_len, - const char *status, size_t status_len); -enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX }; -extern MYSQL_PLUGIN_IMPORT st_plugin_int *hton2plugin[MAX_HA]; - -/* Transaction log maintains type definitions */ -enum log_status -{ - HA_LOG_STATUS_FREE= 0, /* log is free and can be deleted */ - HA_LOG_STATUS_INUSE= 1, /* log can't be deleted because it is in use */ - HA_LOG_STATUS_NOSUCHLOG= 2 /* no such log (can't be returned by - the log iterator status) */ -}; -/* - Function for signaling that the log file changed its state from - LOG_STATUS_INUSE to LOG_STATUS_FREE - - Now it do nothing, will be implemented as part of new transaction - log management for engines. - TODO: implement the function. -*/ -void signal_log_not_needed(struct handlerton, char *log_file); -/* - Data of transaction log iterator. -*/ -struct handler_log_file_data { - LEX_STRING filename; - enum log_status status; -}; - -/* - Definitions for engine-specific table/field/index options in the CREATE TABLE. - - Options are declared with HA_*OPTION_* macros (HA_TOPTION_NUMBER, - HA_FOPTION_ENUM, HA_IOPTION_STRING, etc). - - Every macros takes the option name, and the name of the underlying field of - the appropriate C structure. The "appropriate C structure" is - ha_table_option_struct for table level options, - ha_field_option_struct for field level options, - ha_index_option_struct for key level options. The engine either - defines a structure of this name, or uses #define's to map - these "appropriate" names to the actual structure type name. - - ULL options use a ulonglong as the backing store. - HA_*OPTION_NUMBER() takes the option name, the structure field name, - the default value for the option, min, max, and blk_siz values. - - STRING options use a char* as a backing store. - HA_*OPTION_STRING takes the option name and the structure field name. - The default value will be 0. - - ENUM options use a uint as a backing store (not enum!!!). - HA_*OPTION_ENUM takes the option name, the structure field name, - the default value for the option as a number, and a string with the - permitted values for this enum - one string with comma separated values, - for example: "gzip,bzip2,lzma" - - BOOL options use a bool as a backing store. - HA_*OPTION_BOOL takes the option name, the structure field name, - and the default value for the option. - From the SQL, BOOL options accept YES/NO, ON/OFF, and 1/0. - - The name of the option is limited to 255 bytes, - the value (for string options) - to the 32767 bytes. - - See ha_example.cc for an example. -*/ - -struct ha_table_option_struct; -struct ha_field_option_struct; -struct ha_index_option_struct; - -enum ha_option_type { HA_OPTION_TYPE_ULL, /* unsigned long long */ - HA_OPTION_TYPE_STRING, /* char * */ - HA_OPTION_TYPE_ENUM, /* uint */ - HA_OPTION_TYPE_BOOL, /* bool */ - HA_OPTION_TYPE_SYSVAR};/* type of the sysval */ - -#define HA_xOPTION_NUMBER(name, struc, field, def, min, max, blk_siz) \ - { HA_OPTION_TYPE_ULL, name, sizeof(name)-1, \ - offsetof(struc, field), def, min, max, blk_siz, 0, 0 } -#define HA_xOPTION_STRING(name, struc, field) \ - { HA_OPTION_TYPE_STRING, name, sizeof(name)-1, \ - offsetof(struc, field), 0, 0, 0, 0, 0, 0} -#define HA_xOPTION_ENUM(name, struc, field, values, def) \ - { HA_OPTION_TYPE_ENUM, name, sizeof(name)-1, \ - offsetof(struc, field), def, 0, \ - sizeof(values)-1, 0, values, 0 } -#define HA_xOPTION_BOOL(name, struc, field, def) \ - { HA_OPTION_TYPE_BOOL, name, sizeof(name)-1, \ - offsetof(struc, field), def, 0, 1, 0, 0, 0 } -#define HA_xOPTION_SYSVAR(name, struc, field, sysvar) \ - { HA_OPTION_TYPE_SYSVAR, name, sizeof(name)-1, \ - offsetof(struc, field), 0, 0, 0, 0, 0, MYSQL_SYSVAR(sysvar) } -#define HA_xOPTION_END { HA_OPTION_TYPE_ULL, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - -#define HA_TOPTION_NUMBER(name, field, def, min, max, blk_siz) \ - HA_xOPTION_NUMBER(name, ha_table_option_struct, field, def, min, max, blk_siz) -#define HA_TOPTION_STRING(name, field) \ - HA_xOPTION_STRING(name, ha_table_option_struct, field) -#define HA_TOPTION_ENUM(name, field, values, def) \ - HA_xOPTION_ENUM(name, ha_table_option_struct, field, values, def) -#define HA_TOPTION_BOOL(name, field, def) \ - HA_xOPTION_BOOL(name, ha_table_option_struct, field, def) -#define HA_TOPTION_SYSVAR(name, field, sysvar) \ - HA_xOPTION_SYSVAR(name, ha_table_option_struct, field, sysvar) -#define HA_TOPTION_END HA_xOPTION_END - -#define HA_FOPTION_NUMBER(name, field, def, min, max, blk_siz) \ - HA_xOPTION_NUMBER(name, ha_field_option_struct, field, def, min, max, blk_siz) -#define HA_FOPTION_STRING(name, field) \ - HA_xOPTION_STRING(name, ha_field_option_struct, field) -#define HA_FOPTION_ENUM(name, field, values, def) \ - HA_xOPTION_ENUM(name, ha_field_option_struct, field, values, def) -#define HA_FOPTION_BOOL(name, field, def) \ - HA_xOPTION_BOOL(name, ha_field_option_struct, field, def) -#define HA_FOPTION_SYSVAR(name, field, sysvar) \ - HA_xOPTION_SYSVAR(name, ha_field_option_struct, field, sysvar) -#define HA_FOPTION_END HA_xOPTION_END - -#define HA_IOPTION_NUMBER(name, field, def, min, max, blk_siz) \ - HA_xOPTION_NUMBER(name, ha_index_option_struct, field, def, min, max, blk_siz) -#define HA_IOPTION_STRING(name, field) \ - HA_xOPTION_STRING(name, ha_index_option_struct, field) -#define HA_IOPTION_ENUM(name, field, values, def) \ - HA_xOPTION_ENUM(name, ha_index_option_struct, field, values, def) -#define HA_IOPTION_BOOL(name, field, def) \ - HA_xOPTION_BOOL(name, ha_index_option_struct, field, def) -#define HA_IOPTION_SYSVAR(name, field, sysvar) \ - HA_xOPTION_SYSVAR(name, ha_index_option_struct, field, sysvar) -#define HA_IOPTION_END HA_xOPTION_END - -typedef struct st_ha_create_table_option { - enum ha_option_type type; - const char *name; - size_t name_length; - ptrdiff_t offset; - ulonglong def_value; - ulonglong min_value, max_value, block_size; - const char *values; - struct st_mysql_sys_var *var; -} ha_create_table_option; - -enum handler_iterator_type -{ - /* request of transaction log iterator */ - HA_TRANSACTLOG_ITERATOR= 1 -}; -enum handler_create_iterator_result -{ - HA_ITERATOR_OK, /* iterator created */ - HA_ITERATOR_UNSUPPORTED, /* such type of iterator is not supported */ - HA_ITERATOR_ERROR /* error during iterator creation */ -}; - -/* - Iterator structure. Can be used by handler/handlerton for different purposes. - - Iterator should be created in the way to point "before" the first object - it iterate, so next() call move it to the first object or return !=0 if - there is nothing to iterate through. -*/ -struct handler_iterator { - /* - Moves iterator to next record and return 0 or return !=0 - if there is no records. - iterator_object will be filled by this function if next() returns 0. - Content of the iterator_object depend on iterator type. - */ - int (*next)(struct handler_iterator *, void *iterator_object); - /* - Free resources allocated by iterator, after this call iterator - is not usable. - */ - void (*destroy)(struct handler_iterator *); - /* - Pointer to buffer for the iterator to use. - Should be allocated by function which created the iterator and - destroyed by freed by above "destroy" call - */ - void *buffer; -}; - -class handler; -class group_by_handler; -class derived_handler; -class select_handler; -struct Query; -typedef class st_select_lex SELECT_LEX; -typedef struct st_order ORDER; - -/* - handlerton is a singleton structure - one instance per storage engine - - to provide access to storage engine functionality that works on the - "global" level (unlike handler class that works on a per-table basis) - - usually handlerton instance is defined statically in ha_xxx.cc as - - static handlerton { ... } xxx_hton; - - savepoint_*, prepare, recover, and *_by_xid pointers can be 0. -*/ -struct handlerton -{ - /* - Historical number used for frm file to determine the correct - storage engine. This is going away and new engines will just use - "name" for this. - */ - enum legacy_db_type db_type; - /* - each storage engine has it's own memory area (actually a pointer) - in the thd, for storing per-connection information. - It is accessed as - - thd->ha_data[xxx_hton.slot] - - slot number is initialized by MySQL after xxx_init() is called. - */ - uint slot; - /* - to store per-savepoint data storage engine is provided with an area - of a requested size (0 is ok here). - savepoint_offset must be initialized statically to the size of - the needed memory to store per-savepoint information. - After xxx_init it is changed to be an offset to savepoint storage - area and need not be used by storage engine. - see binlog_hton and binlog_savepoint_set/rollback for an example. - */ - uint savepoint_offset; - /* - handlerton methods: - - close_connection is only called if - thd->ha_data[xxx_hton.slot] is non-zero, so even if you don't need - this storage area - set it to something, so that MySQL would know - this storage engine was accessed in this connection - */ - int (*close_connection)(handlerton *hton, THD *thd); - /* - Tell handler that query has been killed. - */ - void (*kill_query)(handlerton *hton, THD *thd, enum thd_kill_levels level); - /* - sv points to an uninitialized storage area of requested size - (see savepoint_offset description) - */ - int (*savepoint_set)(handlerton *hton, THD *thd, void *sv); - /* - sv points to a storage area, that was earlier passed - to the savepoint_set call - */ - int (*savepoint_rollback)(handlerton *hton, THD *thd, void *sv); - /** - Check if storage engine allows to release metadata locks which were - acquired after the savepoint if rollback to savepoint is done. - @return true - If it is safe to release MDL locks. - false - If it is not. - */ - bool (*savepoint_rollback_can_release_mdl)(handlerton *hton, THD *thd); - int (*savepoint_release)(handlerton *hton, THD *thd, void *sv); - /* - 'all' is true if it's a real commit, that makes persistent changes - 'all' is false if it's not in fact a commit but an end of the - statement that is part of the transaction. - NOTE 'all' is also false in auto-commit mode where 'end of statement' - and 'real commit' mean the same event. - */ - int (*commit)(handlerton *hton, THD *thd, bool all); - /* - The commit_ordered() method is called prior to the commit() method, after - the transaction manager has decided to commit (not rollback) the - transaction. Unlike commit(), commit_ordered() is called only when the - full transaction is committed, not for each commit of statement - transaction in a multi-statement transaction. - - Not that like prepare(), commit_ordered() is only called when 2-phase - commit takes place. Ie. when no binary log and only a single engine - participates in a transaction, one commit() is called, no - commit_ordered(). So engines must be prepared for this. - - The calls to commit_ordered() in multiple parallel transactions is - guaranteed to happen in the same order in every participating - handler. This can be used to ensure the same commit order among multiple - handlers (eg. in table handler and binlog). So if transaction T1 calls - into commit_ordered() of handler A before T2, then T1 will also call - commit_ordered() of handler B before T2. - - Engines that implement this method should during this call make the - transaction visible to other transactions, thereby making the order of - transaction commits be defined by the order of commit_ordered() calls. - - The intention is that commit_ordered() should do the minimal amount of - work that needs to happen in consistent commit order among handlers. To - preserve ordering, calls need to be serialised on a global mutex, so - doing any time-consuming or blocking operations in commit_ordered() will - limit scalability. - - Handlers can rely on commit_ordered() calls to be serialised (no two - calls can run in parallel, so no extra locking on the handler part is - required to ensure this). - - Note that commit_ordered() can be called from a different thread than the - one handling the transaction! So it can not do anything that depends on - thread local storage, in particular it can not call my_error() and - friends (instead it can store the error code and delay the call of - my_error() to the commit() method). - - Similarly, since commit_ordered() returns void, any return error code - must be saved and returned from the commit() method instead. - - The commit_ordered method is optional, and can be left unset if not - needed in a particular handler (then there will be no ordering guarantees - wrt. other engines and binary log). - */ - void (*commit_ordered)(handlerton *hton, THD *thd, bool all); - int (*rollback)(handlerton *hton, THD *thd, bool all); - int (*prepare)(handlerton *hton, THD *thd, bool all); - /* - The prepare_ordered method is optional. If set, it will be called after - successful prepare() in all handlers participating in 2-phase - commit. Like commit_ordered(), it is called only when the full - transaction is committed, not for each commit of statement transaction. - - The calls to prepare_ordered() among multiple parallel transactions are - ordered consistently with calls to commit_ordered(). This means that - calls to prepare_ordered() effectively define the commit order, and that - each handler will see the same sequence of transactions calling into - prepare_ordered() and commit_ordered(). - - Thus, prepare_ordered() can be used to define commit order for handlers - that need to do this in the prepare step (like binlog). It can also be - used to release transaction's locks early in an order consistent with the - order transactions will be eventually committed. - - Like commit_ordered(), prepare_ordered() calls are serialised to maintain - ordering, so the intention is that they should execute fast, with only - the minimal amount of work needed to define commit order. Handlers can - rely on this serialisation, and do not need to do any extra locking to - avoid two prepare_ordered() calls running in parallel. - - Like commit_ordered(), prepare_ordered() is not guaranteed to be called - in the context of the thread handling the rest of the transaction. So it - cannot invoke code that relies on thread local storage, in particular it - cannot call my_error(). - - prepare_ordered() cannot cause a rollback by returning an error, all - possible errors must be handled in prepare() (the prepare_ordered() - method returns void). In case of some fatal error, a record of the error - must be made internally by the engine and returned from commit() later. - - Note that for user-level XA SQL commands, no consistent ordering among - prepare_ordered() and commit_ordered() is guaranteed (as that would - require blocking all other commits for an indefinite time). - - When 2-phase commit is not used (eg. only one engine (and no binlog) in - transaction), neither prepare() nor prepare_ordered() is called. - */ - void (*prepare_ordered)(handlerton *hton, THD *thd, bool all); - int (*recover)(handlerton *hton, XID *xid_list, uint len); - int (*commit_by_xid)(handlerton *hton, XID *xid); - int (*rollback_by_xid)(handlerton *hton, XID *xid); - /* - The commit_checkpoint_request() handlerton method is used to checkpoint - the XA recovery process for storage engines that support two-phase - commit. - - The method is optional - an engine that does not implemented is expected - to work the traditional way, where every commit() durably flushes the - transaction to disk in the engine before completion, so XA recovery will - no longer be needed for that transaction. - - An engine that does implement commit_checkpoint_request() is also - expected to implement commit_ordered(), so that ordering of commits is - consistent between 2pc participants. Such engine is no longer required to - durably flush to disk transactions in commit(), provided that the - transaction has been successfully prepare()d and commit_ordered(); thus - potentionally saving one fsync() call. (Engine must still durably flush - to disk in commit() when no prepare()/commit_ordered() steps took place, - at least if durable commits are wanted; this happens eg. if binlog is - disabled). - - The TC will periodically (eg. once per binlog rotation) call - commit_checkpoint_request(). When this happens, the engine must arrange - for all transaction that have completed commit_ordered() to be durably - flushed to disk (this does not include transactions that might be in the - middle of executing commit_ordered()). When such flush has completed, the - engine must call commit_checkpoint_notify_ha(), passing back the opaque - "cookie". - - The flush and call of commit_checkpoint_notify_ha() need not happen - immediately - it can be scheduled and performed asynchronously (ie. as - part of next prepare(), or sync every second, or whatever), but should - not be postponed indefinitely. It is however also permissible to do it - immediately, before returning from commit_checkpoint_request(). - - When commit_checkpoint_notify_ha() is called, the TC will know that the - transactions are durably committed, and thus no longer require XA - recovery. It uses that to reduce the work needed for any subsequent XA - recovery process. - */ - void (*commit_checkpoint_request)(handlerton *hton, void *cookie); - /* - "Disable or enable checkpointing internal to the storage engine. This is - used for FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT to ensure that - the engine will never start any recovery from a time between - FLUSH TABLES ... ; UNLOCK TABLES. - - While checkpointing is disabled, the engine should pause any background - write activity (such as tablespace checkpointing) that require consistency - between different files (such as transaction log and tablespace files) for - crash recovery to succeed. The idea is to use this to make safe - multi-volume LVM snapshot backups. - */ - int (*checkpoint_state)(handlerton *hton, bool disabled); - void *(*create_cursor_read_view)(handlerton *hton, THD *thd); - void (*set_cursor_read_view)(handlerton *hton, THD *thd, void *read_view); - void (*close_cursor_read_view)(handlerton *hton, THD *thd, void *read_view); - handler *(*create)(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root); - void (*drop_database)(handlerton *hton, char* path); - /* - return 0 if dropped successfully, - -1 if nothing was done by design (as in e.g. blackhole) - an error code (e.g. HA_ERR_NO_SUCH_TABLE) otherwise - */ - int (*drop_table)(handlerton *hton, const char* path); - int (*panic)(handlerton *hton, enum ha_panic_function flag); - int (*start_consistent_snapshot)(handlerton *hton, THD *thd); - bool (*flush_logs)(handlerton *hton); - bool (*show_status)(handlerton *hton, THD *thd, stat_print_fn *print, enum ha_stat_type stat); - uint (*partition_flags)(); - alter_table_operations (*alter_table_flags)(alter_table_operations flags); - int (*alter_tablespace)(handlerton *hton, THD *thd, st_alter_tablespace *ts_info); - int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables, - class Item *cond, - enum enum_schema_tables); - uint32 flags; /* global handler flags */ - /* - Those handlerton functions below are properly initialized at handler - init. - */ - int (*binlog_func)(handlerton *hton, THD *thd, enum_binlog_func fn, void *arg); - void (*binlog_log_query)(handlerton *hton, THD *thd, - enum_binlog_command binlog_command, - const char *query, uint query_length, - const char *db, const char *table_name); - - /* - Get log status. - If log_status is null then the handler do not support transaction - log information (i.e. log iterator can't be created). - (see example of implementation in handler.cc, TRANS_LOG_MGM_EXAMPLE_CODE) - - */ - enum log_status (*get_log_status)(handlerton *hton, char *log); - - /* - Iterators creator. - Presence of the pointer should be checked before using - */ - enum handler_create_iterator_result - (*create_iterator)(handlerton *hton, enum handler_iterator_type type, - struct handler_iterator *fill_this_in); - int (*abort_transaction)(handlerton *hton, THD *bf_thd, - THD *victim_thd, my_bool signal); - int (*set_checkpoint)(handlerton *hton, const XID* xid); - int (*get_checkpoint)(handlerton *hton, XID* xid); - /* - Optional clauses in the CREATE/ALTER TABLE - */ - ha_create_table_option *table_options; // table level options - ha_create_table_option *field_options; // these are specified per field - ha_create_table_option *index_options; // these are specified per index - - /** - The list of extensions of files created for a single table in the - database directory (datadir/db_name/). - - Used by open_table_error(), by the default rename_table and delete_table - handler methods, and by the default discovery implementation. - - For engines that have more than one file name extensions (separate - metadata, index, and/or data files), the order of elements is relevant. - First element of engine file name extensions array should be metadata - file extention. This is implied by the open_table_error() - and the default discovery implementation. - - Second element - data file extension. This is implied - assumed by REPAIR TABLE ... USE_FRM implementation. - */ - const char **tablefile_extensions; // by default - empty list - - /********************************************************************** - Functions to intercept queries - **********************************************************************/ - - /* - Create and return a group_by_handler, if the storage engine can execute - the summary / group by query. - If the storage engine can't do that, return NULL. - - The server guaranteeds that all tables in the list belong to this - storage engine. - */ - group_by_handler *(*create_group_by)(THD *thd, Query *query); - - /* - Create and return a derived_handler if the storage engine can execute - the derived table 'derived', otherwise return NULL. - In a general case 'derived' may contain tables not from the engine. - If the engine cannot handle or does not want to handle such pushed derived - the function create_group_by has to return NULL. - */ - derived_handler *(*create_derived)(THD *thd, TABLE_LIST *derived); - - /* - Create and return a select_handler if the storage engine can execute - the select statement 'select, otherwise return NULL - */ - select_handler *(*create_select) (THD *thd, SELECT_LEX *select); - - /********************************************************************* - Table discovery API. - It allows the server to "discover" tables that exist in the storage - engine, without user issuing an explicit CREATE TABLE statement. - **********************************************************************/ - - /* - This method is required for any engine that supports automatic table - discovery, there is no default implementation. - - Given a TABLE_SHARE discover_table() fills it in with a correct table - structure using one of the TABLE_SHARE::init_from_* methods. - - Returns HA_ERR_NO_SUCH_TABLE if the table did not exist in the engine, - zero if the table was discovered successfully, or any other - HA_ERR_* error code as appropriate if the table existed, but the - discovery failed. - */ - int (*discover_table)(handlerton *hton, THD* thd, TABLE_SHARE *share); - - /* - The discover_table_names method tells the server - about all tables in the specified database that the engine - knows about. Tables (or file names of tables) are added to - the provided discovered_list collector object using - add_table() or add_file() methods. - */ - class discovered_list - { - public: - virtual bool add_table(const char *tname, size_t tlen) = 0; - virtual bool add_file(const char *fname) = 0; - protected: virtual ~discovered_list() {} - }; - - /* - By default (if not implemented by the engine, but the discover_table() is - implemented) it will perform a file-based discovery: - - - if tablefile_extensions[0] is not null, this will discovers all tables - with the tablefile_extensions[0] extension. - - Returns 0 on success and 1 on error. - */ - int (*discover_table_names)(handlerton *hton, LEX_CSTRING *db, MY_DIR *dir, - discovered_list *result); - - /* - This is a method that allows to server to check if a table exists without - an overhead of the complete discovery. - - By default (if not implemented by the engine, but the discovery_table() is - implemented) it will try to perform a file-based discovery: - - - if tablefile_extensions[0] is not null this will look for a file name - with the tablefile_extensions[0] extension. - - - if tablefile_extensions[0] is null, this will resort to discover_table(). - - Note that resorting to discover_table() is slow and the engine - should probably implement its own discover_table_existence() method, - if its tablefile_extensions[0] is null. - - Returns 1 if the table exists and 0 if it does not. - */ - int (*discover_table_existence)(handlerton *hton, const char *db, - const char *table_name); - - /* - This is the assisted table discovery method. Unlike the fully - automatic discovery as above, here a user is expected to issue an - explicit CREATE TABLE with the appropriate table attributes to - "assist" the discovery of a table. But this "discovering" CREATE TABLE - statement will not specify the table structure - the engine discovers - it using this method. For example, FederatedX uses it in - - CREATE TABLE t1 ENGINE=FEDERATED CONNECTION="mysql://foo/bar/t1"; - - Given a TABLE_SHARE discover_table_structure() fills it in with a correct - table structure using one of the TABLE_SHARE::init_from_* methods. - - Assisted discovery works independently from the automatic discover. - An engine is allowed to support only assisted discovery and not - support automatic one. Or vice versa. - */ - int (*discover_table_structure)(handlerton *hton, THD* thd, - TABLE_SHARE *share, HA_CREATE_INFO *info); - - /* - Notify the storage engine that the definition of the table (and the .frm - file) has changed. Returns 0 if ok. - */ - int (*notify_tabledef_changed)(handlerton *hton, LEX_CSTRING *db, - LEX_CSTRING *table_name, LEX_CUSTRING *frm, - LEX_CUSTRING *org_tabledef_version); - - /* - System Versioning - */ - /** Determine if system-versioned data was modified by the transaction. - @param[in,out] thd current session - @param[out] trx_id transaction start ID - @return transaction commit ID - @retval 0 if no system-versioned data was affected by the transaction */ - ulonglong (*prepare_commit_versioned)(THD *thd, ulonglong *trx_id); - - /* backup */ - void (*prepare_for_backup)(void); - void (*end_backup)(void); - - /* Server shutdown early notification.*/ - void (*pre_shutdown)(void); - - /* - Inform handler that partitioning engine has changed the .frm and the .par - files - */ - int (*create_partitioning_metadata)(const char *path, - const char *old_path, - chf_create_flags action_flag); -}; - - -static inline LEX_CSTRING *hton_name(const handlerton *hton) -{ - return &(hton2plugin[hton->slot]->name); -} - -static inline handlerton *plugin_hton(plugin_ref plugin) -{ - return plugin_data(plugin, handlerton *); -} - -static inline sys_var *find_hton_sysvar(handlerton *hton, st_mysql_sys_var *var) -{ - return find_plugin_sysvar(hton2plugin[hton->slot], var); -} - -handlerton *ha_default_handlerton(THD *thd); -handlerton *ha_default_tmp_handlerton(THD *thd); - -/* Possible flags of a handlerton (there can be 32 of them) */ -#define HTON_NO_FLAGS 0 -#define HTON_CLOSE_CURSORS_AT_COMMIT (1 << 0) -#define HTON_ALTER_NOT_SUPPORTED (1 << 1) //Engine does not support alter -#define HTON_CAN_RECREATE (1 << 2) //Delete all is used for truncate -#define HTON_HIDDEN (1 << 3) //Engine does not appear in lists -#define HTON_NOT_USER_SELECTABLE (1 << 5) -#define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported -#define HTON_SUPPORT_LOG_TABLES (1 << 7) //Engine supports log tables -#define HTON_NO_PARTITION (1 << 8) //Not partition of these tables - -/* - This flag should be set when deciding that the engine does not allow - row based binary logging (RBL) optimizations. - - Currently, setting this flag, means that table's read/write_set will - be left untouched when logging changes to tables in this engine. In - practice this means that the server will not mess around with - table->write_set and/or table->read_set when using RBL and deciding - whether to log full or minimal rows. - - It's valuable for instance for virtual tables, eg: Performance - Schema which have no meaning for replication. -*/ -#define HTON_NO_BINLOG_ROW_OPT (1 << 9) -#define HTON_SUPPORTS_EXTENDED_KEYS (1 <<10) //supports extended keys -#define HTON_NATIVE_SYS_VERSIONING (1 << 11) //Engine supports System Versioning - -// MySQL compatibility. Unused. -#define HTON_SUPPORTS_FOREIGN_KEYS (1 << 0) //Foreign key constraint supported. - -#define HTON_CAN_MERGE (1 <<11) //Merge type table -// Engine needs to access the main connect string in partitions -#define HTON_CAN_READ_CONNECT_STRING_IN_PARTITION (1 <<12) - -/* can be replicated by wsrep replication provider plugin */ -#define HTON_WSREP_REPLICATION (1 << 13) - -/* - Set this on the *slave* that's connected to a shared with a master storage. - The slave will ignore any CREATE TABLE, DROP or updates for this engine. -*/ -#define HTON_IGNORE_UPDATES (1 << 14) - -/* - Set this on the *master* that's connected to a shared with a slave storage. - The table may not exists on the slave. The effects of having this flag are: - - ALTER TABLE that changes engine from this table to another engine will - be replicated as CREATE + INSERT - - CREATE ... LIKE shared_table will be replicated as a full CREATE TABLE - - ALTER TABLE for this engine will have "IF EXISTS" added. - - RENAME TABLE for this engine will have "IF EXISTS" added. - - DROP TABLE for this engine will have "IF EXISTS" added. -*/ -#define HTON_TABLE_MAY_NOT_EXIST_ON_SLAVE (1 << 15) - -/* - True if handler cannot rollback transactions. If not true, the transaction - will be put in the transactional binlog cache. - For some engines, like Aria, the rollback can happen in case of crash, but - not trough a handler rollback call. -*/ -#define HTON_NO_ROLLBACK (1 << 16) - -/* - This storage engine can support both transactional and non transactional - tables -*/ -#define HTON_TRANSACTIONAL_AND_NON_TRANSACTIONAL (1 << 17) - -class Ha_trx_info; - -struct THD_TRANS -{ - /* true is not all entries in the ht[] support 2pc */ - bool no_2pc; - /* storage engines that registered in this transaction */ - Ha_trx_info *ha_list; - /* - The purpose of this flag is to keep track of non-transactional - tables that were modified in scope of: - - transaction, when the variable is a member of - THD::transaction.all - - top-level statement or sub-statement, when the variable is a - member of THD::transaction.stmt - This member has the following life cycle: - * stmt.modified_non_trans_table is used to keep track of - modified non-transactional tables of top-level statements. At - the end of the previous statement and at the beginning of the session, - it is reset to FALSE. If such functions - as mysql_insert, mysql_update, mysql_delete etc modify a - non-transactional table, they set this flag to TRUE. At the - end of the statement, the value of stmt.modified_non_trans_table - is merged with all.modified_non_trans_table and gets reset. - * all.modified_non_trans_table is reset at the end of transaction - - * Since we do not have a dedicated context for execution of a - sub-statement, to keep track of non-transactional changes in a - sub-statement, we re-use stmt.modified_non_trans_table. - At entrance into a sub-statement, a copy of the value of - stmt.modified_non_trans_table (containing the changes of the - outer statement) is saved on stack. Then - stmt.modified_non_trans_table is reset to FALSE and the - substatement is executed. Then the new value is merged with the - saved value. - */ - bool modified_non_trans_table; - - void reset() { - no_2pc= FALSE; - modified_non_trans_table= FALSE; - m_unsafe_rollback_flags= 0; - } - bool is_empty() const { return ha_list == NULL; } - THD_TRANS() {} /* Remove gcc warning */ - - unsigned int m_unsafe_rollback_flags; - /* - Define the type of statements which cannot be rolled back safely. - Each type occupies one bit in m_unsafe_rollback_flags. - */ - enum unsafe_statement_types - { - CREATED_TEMP_TABLE= 2, - DROPPED_TEMP_TABLE= 4, - DID_WAIT= 8, - DID_DDL= 0x10 - }; - - void mark_created_temp_table() - { - DBUG_PRINT("debug", ("mark_created_temp_table")); - m_unsafe_rollback_flags|= CREATED_TEMP_TABLE; - } - void mark_dropped_temp_table() - { - DBUG_PRINT("debug", ("mark_dropped_temp_table")); - m_unsafe_rollback_flags|= DROPPED_TEMP_TABLE; - } - bool has_created_dropped_temp_table() const { - return - (m_unsafe_rollback_flags & (CREATED_TEMP_TABLE|DROPPED_TEMP_TABLE)) != 0; - } - void mark_trans_did_wait() { m_unsafe_rollback_flags|= DID_WAIT; } - bool trans_did_wait() const { - return (m_unsafe_rollback_flags & DID_WAIT) != 0; - } - bool is_trx_read_write() const; - void mark_trans_did_ddl() { m_unsafe_rollback_flags|= DID_DDL; } - bool trans_did_ddl() const { - return (m_unsafe_rollback_flags & DID_DDL) != 0; - } - -}; - - -/** - Either statement transaction or normal transaction - related - thread-specific storage engine data. - - If a storage engine participates in a statement/transaction, - an instance of this class is present in - thd->transaction.{stmt|all}.ha_list. The addition to - {stmt|all}.ha_list is made by trans_register_ha(). - - When it's time to commit or rollback, each element of ha_list - is used to access storage engine's prepare()/commit()/rollback() - methods, and also to evaluate if a full two phase commit is - necessary. - - @sa General description of transaction handling in handler.cc. -*/ - -class Ha_trx_info -{ -public: - /** Register this storage engine in the given transaction context. */ - void register_ha(THD_TRANS *trans, handlerton *ht_arg) - { - DBUG_ASSERT(m_flags == 0); - DBUG_ASSERT(m_ht == NULL); - DBUG_ASSERT(m_next == NULL); - - m_ht= ht_arg; - m_flags= (int) TRX_READ_ONLY; /* Assume read-only at start. */ - - m_next= trans->ha_list; - trans->ha_list= this; - } - - /** Clear, prepare for reuse. */ - void reset() - { - m_next= NULL; - m_ht= NULL; - m_flags= 0; - } - - Ha_trx_info() { reset(); } - - void set_trx_read_write() - { - DBUG_ASSERT(is_started()); - m_flags|= (int) TRX_READ_WRITE; - } - bool is_trx_read_write() const - { - DBUG_ASSERT(is_started()); - return m_flags & (int) TRX_READ_WRITE; - } - bool is_started() const { return m_ht != NULL; } - /** Mark this transaction read-write if the argument is read-write. */ - void coalesce_trx_with(const Ha_trx_info *stmt_trx) - { - /* - Must be called only after the transaction has been started. - Can be called many times, e.g. when we have many - read-write statements in a transaction. - */ - DBUG_ASSERT(is_started()); - if (stmt_trx->is_trx_read_write()) - set_trx_read_write(); - } - Ha_trx_info *next() const - { - DBUG_ASSERT(is_started()); - return m_next; - } - handlerton *ht() const - { - DBUG_ASSERT(is_started()); - return m_ht; - } -private: - enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1 }; - /** Auxiliary, used for ha_list management */ - Ha_trx_info *m_next; - /** - Although a given Ha_trx_info instance is currently always used - for the same storage engine, 'ht' is not-NULL only when the - corresponding storage is a part of a transaction. - */ - handlerton *m_ht; - /** - Transaction flags related to this engine. - Not-null only if this instance is a part of transaction. - May assume a combination of enum values above. - */ - uchar m_flags; -}; - - -inline bool THD_TRANS::is_trx_read_write() const -{ - Ha_trx_info *ha_info; - for (ha_info= ha_list; ha_info; ha_info= ha_info->next()) - if (ha_info->is_trx_read_write()) - return TRUE; - return FALSE; -} - - -enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED, - ISO_REPEATABLE_READ, ISO_SERIALIZABLE}; - - -typedef struct { - ulonglong data_file_length; - ulonglong max_data_file_length; - ulonglong index_file_length; - ulonglong max_index_file_length; - ulonglong delete_length; - ha_rows records; - ulong mean_rec_length; - time_t create_time; - time_t check_time; - time_t update_time; - ulonglong check_sum; - bool check_sum_null; -} PARTITION_STATS; - -#define UNDEF_NODEGROUP 65535 -class Item; -struct st_table_log_memory_entry; - -class partition_info; - -struct st_partition_iter; - -enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES, HA_CHOICE_MAX }; - -enum enum_stats_auto_recalc { HA_STATS_AUTO_RECALC_DEFAULT= 0, - HA_STATS_AUTO_RECALC_ON, - HA_STATS_AUTO_RECALC_OFF }; - -/** - A helper struct for schema DDL statements: - CREATE SCHEMA [IF NOT EXISTS] name [ schema_specification... ] - ALTER SCHEMA name [ schema_specification... ] - - It stores the "schema_specification" part of the CREATE/ALTER statements and - is passed to mysql_create_db() and mysql_alter_db(). - Currently consists of the schema default character set, collation - and schema_comment. -*/ -struct Schema_specification_st -{ - CHARSET_INFO *default_table_charset; - LEX_CSTRING *schema_comment; - void init() - { - bzero(this, sizeof(*this)); - } -}; - -class Create_field; - -struct Table_period_info: Sql_alloc -{ - Table_period_info() : - create_if_not_exists(false), - constr(NULL), - unique_keys(0) {} - Table_period_info(const char *name_arg, size_t size) : - name(name_arg, size), - create_if_not_exists(false), - constr(NULL), - unique_keys(0){} - - Lex_ident name; - - struct start_end_t - { - start_end_t() {}; - start_end_t(const LEX_CSTRING& _start, const LEX_CSTRING& _end) : - start(_start), - end(_end) {} - Lex_ident start; - Lex_ident end; - }; - start_end_t period; - bool create_if_not_exists; - Virtual_column_info *constr; - uint unique_keys; - - bool is_set() const - { - DBUG_ASSERT(bool(period.start) == bool(period.end)); - return period.start; - } - - void set_period(const Lex_ident& start, const Lex_ident& end) - { - period.start= start; - period.end= end; - } - bool check_field(const Create_field* f, const Lex_ident& f_name) const; -}; - -struct Vers_parse_info: public Table_period_info -{ - Vers_parse_info() : - Table_period_info(STRING_WITH_LEN("SYSTEM_TIME")), - versioned_fields(false), - unversioned_fields(false) - {} - - Table_period_info::start_end_t as_row; - -protected: - friend struct Table_scope_and_contents_source_st; - void set_start(const LEX_CSTRING field_name) - { - as_row.start= field_name; - period.start= field_name; - } - void set_end(const LEX_CSTRING field_name) - { - as_row.end= field_name; - period.end= field_name; - } - bool is_start(const char *name) const; - bool is_end(const char *name) const; - bool is_start(const Create_field &f) const; - bool is_end(const Create_field &f) const; - bool fix_implicit(THD *thd, Alter_info *alter_info); - operator bool() const - { - return as_row.start || as_row.end || period.start || period.end; - } - bool need_check(const Alter_info *alter_info) const; - bool check_conditions(const Lex_table_name &table_name, - const Lex_table_name &db) const; -public: - static const Lex_ident default_start; - static const Lex_ident default_end; - - bool fix_alter_info(THD *thd, Alter_info *alter_info, - HA_CREATE_INFO *create_info, TABLE *table); - bool fix_create_like(Alter_info &alter_info, HA_CREATE_INFO &create_info, - TABLE_LIST &src_table, TABLE_LIST &table); - bool check_sys_fields(const Lex_table_name &table_name, - const Lex_table_name &db, Alter_info *alter_info) const; - - /** - At least one field was specified 'WITH/WITHOUT SYSTEM VERSIONING'. - Useful for error handling. - */ - bool versioned_fields : 1; - bool unversioned_fields : 1; -}; - -/** - A helper struct for table DDL statements, e.g.: - CREATE [OR REPLACE] [TEMPORARY] - TABLE [IF NOT EXISTS] tbl_name table_contents_source; - - Represents a combinations of: - 1. The scope, i.e. TEMPORARY or not TEMPORARY - 2. The "table_contents_source" part of the table DDL statements, - which can be initialized from either of these: - - table_element_list ... // Explicit definition (column and key list) - - LIKE another_table_name ... // Copy structure from another table - - [AS] SELECT ... // Copy structure from a subquery -*/ - -struct Table_scope_and_contents_source_pod_st // For trivial members -{ - CHARSET_INFO *table_charset; - LEX_CUSTRING tabledef_version; - LEX_CSTRING connect_string; - LEX_CSTRING comment; - LEX_CSTRING alias; - const char *password, *tablespace; - const char *data_file_name, *index_file_name; - ulonglong max_rows,min_rows; - ulonglong auto_increment_value; - ulong table_options; ///< HA_OPTION_ values - ulong avg_row_length; - ulong used_fields; - ulong key_block_size; - ulong expression_length; - ulong field_check_constraints; - /* - number of pages to sample during - stats estimation, if used, otherwise 0. - */ - uint stats_sample_pages; - uint null_bits; /* NULL bits at start of record */ - uint options; /* OR of HA_CREATE_ options */ - uint merge_insert_method; - uint extra_size; /* length of extra data segment */ - handlerton *db_type; - /** - Row type of the table definition. - - Defaults to ROW_TYPE_DEFAULT for all non-ALTER statements. - For ALTER TABLE defaults to ROW_TYPE_NOT_USED (means "keep the current"). - - Can be changed either explicitly by the parser. - If nothing specified inherits the value of the original table (if present). - */ - enum row_type row_type; - enum ha_choice transactional; - enum ha_storage_media storage_media; ///< DEFAULT, DISK or MEMORY - enum ha_choice page_checksum; ///< If we have page_checksums - engine_option_value *option_list; ///< list of table create options - enum_stats_auto_recalc stats_auto_recalc; - bool varchar; ///< 1 if table has a VARCHAR - bool sequence; // If SEQUENCE=1 was used - - List *check_constraint_list; - - /* the following three are only for ALTER TABLE, check_if_incompatible_data() */ - ha_table_option_struct *option_struct; ///< structure with parsed table options - ha_field_option_struct **fields_option_struct; ///< array of field option structures - ha_index_option_struct **indexes_option_struct; ///< array of index option structures - - /* The following is used to remember the old state for CREATE OR REPLACE */ - TABLE *table; - TABLE_LIST *pos_in_locked_tables; - TABLE_LIST *merge_list; - MDL_ticket *mdl_ticket; - bool table_was_deleted; - sequence_definition *seq_create_info; - - void init() - { - bzero(this, sizeof(*this)); - } - bool tmp_table() const { return options & HA_LEX_CREATE_TMP_TABLE; } - void use_default_db_type(THD *thd) - { - db_type= tmp_table() ? ha_default_tmp_handlerton(thd) - : ha_default_handlerton(thd); - } - - bool versioned() const - { - return options & HA_VERSIONED_TABLE; - } -}; - - -struct Table_scope_and_contents_source_st: - public Table_scope_and_contents_source_pod_st -{ - Vers_parse_info vers_info; - Table_period_info period_info; - - void init() - { - Table_scope_and_contents_source_pod_st::init(); - vers_info= {}; - period_info= {}; - } - - bool fix_create_fields(THD *thd, Alter_info *alter_info, - const TABLE_LIST &create_table); - bool fix_period_fields(THD *thd, Alter_info *alter_info); - bool check_fields(THD *thd, Alter_info *alter_info, - const Lex_table_name &table_name, - const Lex_table_name &db, - int select_count= 0); - bool check_period_fields(THD *thd, Alter_info *alter_info); - - bool vers_fix_system_fields(THD *thd, Alter_info *alter_info, - const TABLE_LIST &create_table); - - bool vers_check_system_fields(THD *thd, Alter_info *alter_info, - const Lex_table_name &table_name, - const Lex_table_name &db, - int select_count= 0); - -}; - - -/** - This struct is passed to handler table routines, e.g. ha_create(). - It does not include the "OR REPLACE" and "IF NOT EXISTS" parts, as these - parts are handled on the SQL level and are not needed on the handler level. -*/ -struct HA_CREATE_INFO: public Table_scope_and_contents_source_st, - public Schema_specification_st -{ - /* TODO: remove after MDEV-20865 */ - Alter_info *alter_info; - - void init() - { - Table_scope_and_contents_source_st::init(); - Schema_specification_st::init(); - alter_info= NULL; - } - bool check_conflicting_charset_declarations(CHARSET_INFO *cs); - bool add_table_option_default_charset(CHARSET_INFO *cs) - { - // cs can be NULL, e.g.: CREATE TABLE t1 (..) CHARACTER SET DEFAULT; - if (check_conflicting_charset_declarations(cs)) - return true; - default_table_charset= cs; - used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; - return false; - } - bool add_alter_list_item_convert_to_charset(CHARSET_INFO *cs) - { - /* - cs cannot be NULL, as sql_yacc.yy translates - CONVERT TO CHARACTER SET DEFAULT - to - CONVERT TO CHARACTER SET - TODO: Shouldn't we postpone resolution of DEFAULT until the - character set of the table owner database is loaded from its db.opt? - */ - DBUG_ASSERT(cs); - if (check_conflicting_charset_declarations(cs)) - return true; - table_charset= default_table_charset= cs; - used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET); - return false; - } - ulong table_options_with_row_type() - { - if (row_type == ROW_TYPE_DYNAMIC || row_type == ROW_TYPE_PAGE) - return table_options | HA_OPTION_PACK_RECORD; - else - return table_options; - } -}; - - -/** - This struct is passed to mysql_create_table() and similar creation functions, - as well as to show_create_table(). -*/ -struct Table_specification_st: public HA_CREATE_INFO, - public DDL_options_st -{ - // Deep initialization - void init() - { - HA_CREATE_INFO::init(); - DDL_options_st::init(); - } - void init(DDL_options_st::Options options_arg) - { - HA_CREATE_INFO::init(); - DDL_options_st::init(options_arg); - } - /* - Quick initialization, for parser. - Most of the HA_CREATE_INFO is left uninitialized. - It gets fully initialized in sql_yacc.yy, only when the parser - scans a related keyword (e.g. CREATE, ALTER). - */ - void lex_start() - { - HA_CREATE_INFO::options= 0; - DDL_options_st::init(); - } -}; - - -/** - In-place alter handler context. - - This is a superclass intended to be subclassed by individual handlers - in order to store handler unique context between in-place alter API calls. - - The handler is responsible for creating the object. This can be done - as early as during check_if_supported_inplace_alter(). - - The SQL layer is responsible for destroying the object. - The class extends Sql_alloc so the memory will be mem root allocated. - - @see Alter_inplace_info -*/ - -class inplace_alter_handler_ctx : public Sql_alloc -{ -public: - inplace_alter_handler_ctx() {} - - virtual ~inplace_alter_handler_ctx() {} - virtual void set_shared_data(const inplace_alter_handler_ctx& ctx) {} -}; - - -/** - Class describing changes to be done by ALTER TABLE. - Instance of this class is passed to storage engine in order - to determine if this ALTER TABLE can be done using in-place - algorithm. It is also used for executing the ALTER TABLE - using in-place algorithm. -*/ - -class Alter_inplace_info -{ -public: - - /** - Create options (like MAX_ROWS) for the new version of table. - - @note The referenced instance of HA_CREATE_INFO object was already - used to create new .FRM file for table being altered. So it - has been processed by mysql_prepare_create_table() already. - For example, this means that it has HA_OPTION_PACK_RECORD - flag in HA_CREATE_INFO::table_options member correctly set. - */ - HA_CREATE_INFO *create_info; - - /** - Alter options, fields and keys for the new version of table. - - @note The referenced instance of Alter_info object was already - used to create new .FRM file for table being altered. So it - has been processed by mysql_prepare_create_table() already. - In particular, this means that in Create_field objects for - fields which were present in some form in the old version - of table, Create_field::field member points to corresponding - Field instance for old version of table. - */ - Alter_info *alter_info; - - /** - Array of KEYs for new version of table - including KEYs to be added. - - @note Currently this array is produced as result of - mysql_prepare_create_table() call. - This means that it follows different convention for - KEY_PART_INFO::fieldnr values than objects in TABLE::key_info - array. - - @todo This is mainly due to the fact that we need to keep compatibility - with removed handler::add_index() call. We plan to switch to - TABLE::key_info numbering later. - - KEYs are sorted - see sort_keys(). - */ - KEY *key_info_buffer; - - /** Size of key_info_buffer array. */ - uint key_count; - - /** Size of index_drop_buffer array. */ - uint index_drop_count; - - /** - Array of pointers to KEYs to be dropped belonging to the TABLE instance - for the old version of the table. - */ - KEY **index_drop_buffer; - - /** Size of index_add_buffer array. */ - uint index_add_count; - - /** - Array of indexes into key_info_buffer for KEYs to be added, - sorted in increasing order. - */ - uint *index_add_buffer; - - /** - Old and new index names. Used for index rename. - */ - struct Rename_key_pair - { - Rename_key_pair(const KEY *old_key, const KEY *new_key) - : old_key(old_key), new_key(new_key) - { - } - const KEY *old_key; - const KEY *new_key; - }; - /** - Vector of key pairs from DROP/ADD index which can be renamed. - */ - typedef Mem_root_array Rename_keys_vector; - - /** - A list of indexes which should be renamed. - Index definitions stays the same. - */ - Rename_keys_vector rename_keys; - - /** - Context information to allow handlers to keep context between in-place - alter API calls. - - @see inplace_alter_handler_ctx for information about object lifecycle. - */ - inplace_alter_handler_ctx *handler_ctx; - - /** - If the table uses several handlers, like ha_partition uses one handler - per partition, this contains a Null terminated array of ctx pointers - that should all be committed together. - Or NULL if only handler_ctx should be committed. - Set to NULL if the low level handler::commit_inplace_alter_table uses it, - to signal to the main handler that everything was committed as atomically. - - @see inplace_alter_handler_ctx for information about object lifecycle. - */ - inplace_alter_handler_ctx **group_commit_ctx; - - /** - Flags describing in detail which operations the storage engine is to - execute. Flags are defined in sql_alter.h - */ - alter_table_operations handler_flags; - - /* Alter operations involving parititons are strored here */ - ulong partition_flags; - - /** - Partition_info taking into account the partition changes to be performed. - Contains all partitions which are present in the old version of the table - with partitions to be dropped or changed marked as such + all partitions - to be added in the new version of table marked as such. - */ - partition_info *modified_part_info; - - /** true for ALTER IGNORE TABLE ... */ - const bool ignore; - - /** true for online operation (LOCK=NONE) */ - bool online; - - /** which ALGORITHM and LOCK are supported by the storage engine */ - enum_alter_inplace_result inplace_supported; - - /** - Can be set by handler to describe why a given operation cannot be done - in-place (HA_ALTER_INPLACE_NOT_SUPPORTED) or why it cannot be done - online (HA_ALTER_INPLACE_NO_LOCK or HA_ALTER_INPLACE_COPY_NO_LOCK) - If set, it will be used with ER_ALTER_OPERATION_NOT_SUPPORTED_REASON if - results from handler::check_if_supported_inplace_alter() doesn't match - requirements set by user. If not set, the more generic - ER_ALTER_OPERATION_NOT_SUPPORTED will be used. - - Please set to a properly localized string, for example using - my_get_err_msg(), so that the error message as a whole is localized. - */ - const char *unsupported_reason; - - /** true when InnoDB should abort the alter when table is not empty */ - bool error_if_not_empty; - - Alter_inplace_info(HA_CREATE_INFO *create_info_arg, - Alter_info *alter_info_arg, - KEY *key_info_arg, uint key_count_arg, - partition_info *modified_part_info_arg, - bool ignore_arg, bool error_non_empty); - - ~Alter_inplace_info() - { - delete handler_ctx; - } - - /** - Used after check_if_supported_inplace_alter() to report - error if the result does not match the LOCK/ALGORITHM - requirements set by the user. - - @param not_supported Part of statement that was not supported. - @param try_instead Suggestion as to what the user should - replace not_supported with. - */ - void report_unsupported_error(const char *not_supported, - const char *try_instead) const; -}; - - -typedef struct st_key_create_information -{ - enum ha_key_alg algorithm; - ulong block_size; - uint flags; /* HA_USE.. flags */ - LEX_CSTRING parser_name; - LEX_CSTRING comment; - /** - A flag to determine if we will check for duplicate indexes. - This typically means that the key information was specified - directly by the user (set by the parser). - */ - bool check_for_duplicate_indexes; -} KEY_CREATE_INFO; - - -/* - Class for maintaining hooks used inside operations on tables such - as: create table functions, delete table functions, and alter table - functions. - - Class is using the Template Method pattern to separate the public - usage interface from the private inheritance interface. This - imposes no overhead, since the public non-virtual function is small - enough to be inlined. - - The hooks are usually used for functions that does several things, - e.g., create_table_from_items(), which both create a table and lock - it. - */ -class TABLEOP_HOOKS -{ -public: - TABLEOP_HOOKS() {} - virtual ~TABLEOP_HOOKS() {} - - inline void prelock(TABLE **tables, uint count) - { - do_prelock(tables, count); - } - - inline int postlock(TABLE **tables, uint count) - { - return do_postlock(tables, count); - } -private: - /* Function primitive that is called prior to locking tables */ - virtual void do_prelock(TABLE **tables, uint count) - { - /* Default is to do nothing */ - } - - /** - Primitive called after tables are locked. - - If an error is returned, the tables will be unlocked and error - handling start. - - @return Error code or zero. - */ - virtual int do_postlock(TABLE **tables, uint count) - { - return 0; /* Default is to do nothing */ - } -}; - -typedef struct st_savepoint SAVEPOINT; -extern ulong savepoint_alloc_size; -extern KEY_CREATE_INFO default_key_create_info; - -/* Forward declaration for condition pushdown to storage engine */ -typedef class Item COND; - -typedef struct st_ha_check_opt -{ - st_ha_check_opt() {} /* Remove gcc warning */ - uint flags; /* isam layer flags (e.g. for myisamchk) */ - uint sql_flags; /* sql layer flags - for something myisamchk cannot do */ - time_t start_time; /* When check/repair starts */ - KEY_CACHE *key_cache; /* new key cache when changing key cache */ - void init(); -} HA_CHECK_OPT; - - -/******************************************************************************** - * MRR - ********************************************************************************/ - -typedef void *range_seq_t; - -typedef struct st_range_seq_if -{ - /* - Get key information - - SYNOPSIS - get_key_info() - init_params The seq_init_param parameter - length OUT length of the keys in this range sequence - map OUT key_part_map of the keys in this range sequence - - DESCRIPTION - This function is set only when using HA_MRR_FIXED_KEY mode. In that mode, - all ranges are single-point equality ranges that use the same set of key - parts. This function allows the MRR implementation to get the length of - a key, and which keyparts it uses. - */ - void (*get_key_info)(void *init_params, uint *length, key_part_map *map); - - /* - Initialize the traversal of range sequence - - SYNOPSIS - init() - init_params The seq_init_param parameter - n_ranges The number of ranges obtained - flags A combination of HA_MRR_SINGLE_POINT, HA_MRR_FIXED_KEY - - RETURN - An opaque value to be used as RANGE_SEQ_IF::next() parameter - */ - range_seq_t (*init)(void *init_params, uint n_ranges, uint flags); - - - /* - Get the next range in the range sequence - - SYNOPSIS - next() - seq The value returned by RANGE_SEQ_IF::init() - range OUT Information about the next range - - RETURN - FALSE - Ok, the range structure filled with info about the next range - TRUE - No more ranges - */ - bool (*next) (range_seq_t seq, KEY_MULTI_RANGE *range); - - /* - Check whether range_info orders to skip the next record - - SYNOPSIS - skip_record() - seq The value returned by RANGE_SEQ_IF::init() - range_info Information about the next range - (Ignored if MRR_NO_ASSOCIATION is set) - rowid Rowid of the record to be checked (ignored if set to 0) - - RETURN - 1 - Record with this range_info and/or this rowid shall be filtered - out from the stream of records returned by multi_range_read_next() - 0 - The record shall be left in the stream - */ - bool (*skip_record) (range_seq_t seq, range_id_t range_info, uchar *rowid); - - /* - Check if the record combination matches the index condition - SYNOPSIS - skip_index_tuple() - seq The value returned by RANGE_SEQ_IF::init() - range_info Information about the next range - - RETURN - 0 - The record combination satisfies the index condition - 1 - Otherwise - */ - bool (*skip_index_tuple) (range_seq_t seq, range_id_t range_info); -} RANGE_SEQ_IF; - -typedef bool (*SKIP_INDEX_TUPLE_FUNC) (range_seq_t seq, range_id_t range_info); - -class Cost_estimate -{ -public: - double io_count; /* number of I/O to fetch records */ - double avg_io_cost; /* cost of an average I/O oper. to fetch records */ - double idx_io_count; /* number of I/O to read keys */ - double idx_avg_io_cost; /* cost of an average I/O oper. to fetch records */ - double cpu_cost; /* total cost of operations in CPU */ - double idx_cpu_cost; /* cost of operations in CPU for index */ - double import_cost; /* cost of remote operations */ - double mem_cost; /* cost of used memory */ - - static constexpr double IO_COEFF= 1; - static constexpr double CPU_COEFF= 1; - static constexpr double MEM_COEFF= 1; - static constexpr double IMPORT_COEFF= 1; - - Cost_estimate() - { - reset(); - } - - double total_cost() const - { - return IO_COEFF*io_count*avg_io_cost + - IO_COEFF*idx_io_count*idx_avg_io_cost + - CPU_COEFF*(cpu_cost + idx_cpu_cost) + - MEM_COEFF*mem_cost + IMPORT_COEFF*import_cost; - } - - double index_only_cost() - { - return IO_COEFF*idx_io_count*idx_avg_io_cost + - CPU_COEFF*idx_cpu_cost; - } - - /** - Whether or not all costs in the object are zero - - @return true if all costs are zero, false otherwise - */ - bool is_zero() const - { - return io_count == 0.0 && idx_io_count == 0.0 && cpu_cost == 0.0 && - import_cost == 0.0 && mem_cost == 0.0; - } - - void reset() - { - avg_io_cost= 1.0; - idx_avg_io_cost= 1.0; - io_count= idx_io_count= cpu_cost= idx_cpu_cost= mem_cost= import_cost= 0.0; - } - - void multiply(double m) - { - io_count *= m; - cpu_cost *= m; - idx_io_count *= m; - idx_cpu_cost *= m; - import_cost *= m; - /* Don't multiply mem_cost */ - } - - void add(const Cost_estimate* cost) - { - if (cost->io_count != 0.0) - { - double io_count_sum= io_count + cost->io_count; - avg_io_cost= (io_count * avg_io_cost + - cost->io_count * cost->avg_io_cost) - /io_count_sum; - io_count= io_count_sum; - } - if (cost->idx_io_count != 0.0) - { - double idx_io_count_sum= idx_io_count + cost->idx_io_count; - idx_avg_io_cost= (idx_io_count * idx_avg_io_cost + - cost->idx_io_count * cost->idx_avg_io_cost) - /idx_io_count_sum; - idx_io_count= idx_io_count_sum; - } - cpu_cost += cost->cpu_cost; - idx_cpu_cost += cost->idx_cpu_cost; - import_cost += cost->import_cost; - } - - void add_io(double add_io_cnt, double add_avg_cost) - { - /* In edge cases add_io_cnt may be zero */ - if (add_io_cnt > 0) - { - double io_count_sum= io_count + add_io_cnt; - avg_io_cost= (io_count * avg_io_cost + - add_io_cnt * add_avg_cost) / io_count_sum; - io_count= io_count_sum; - } - } - - /// Add to CPU cost - void add_cpu(double add_cpu_cost) { cpu_cost+= add_cpu_cost; } - - /// Add to import cost - void add_import(double add_import_cost) { import_cost+= add_import_cost; } - - /// Add to memory cost - void add_mem(double add_mem_cost) { mem_cost+= add_mem_cost; } - - /* - To be used when we go from old single value-based cost calculations to - the new Cost_estimate-based. - */ - void convert_from_cost(double cost) - { - reset(); - io_count= cost; - } -}; - -void get_sweep_read_cost(TABLE *table, ha_rows nrows, bool interrupted, - Cost_estimate *cost); - -/* - Indicates that all scanned ranges will be singlepoint (aka equality) ranges. - The ranges may not use the full key but all of them will use the same number - of key parts. -*/ -#define HA_MRR_SINGLE_POINT 1U -#define HA_MRR_FIXED_KEY 2U - -/* - Indicates that RANGE_SEQ_IF::next(&range) doesn't need to fill in the - 'range' parameter. -*/ -#define HA_MRR_NO_ASSOCIATION 4U - -/* - The MRR user will provide ranges in key order, and MRR implementation - must return rows in key order. -*/ -#define HA_MRR_SORTED 8U - -/* MRR implementation doesn't have to retrieve full records */ -#define HA_MRR_INDEX_ONLY 16U - -/* - The passed memory buffer is of maximum possible size, the caller can't - assume larger buffer. -*/ -#define HA_MRR_LIMITS 32U - - -/* - Flag set <=> default MRR implementation is used - (The choice is made by **_info[_const]() function which may set this - flag. SQL layer remembers the flag value and then passes it to - multi_read_range_init(). -*/ -#define HA_MRR_USE_DEFAULT_IMPL 64U - -/* - Used only as parameter to multi_range_read_info(): - Flag set <=> the caller guarantees that the bounds of the scanned ranges - will not have NULL values. -*/ -#define HA_MRR_NO_NULL_ENDPOINTS 128U - -/* - The MRR user has materialized range keys somewhere in the user's buffer. - This can be used for optimization of the procedure that sorts these keys - since in this case key values don't have to be copied into the MRR buffer. - - In other words, it is guaranteed that after RANGE_SEQ_IF::next() call the - pointer in range->start_key.key will point to a key value that will remain - there until the end of the MRR scan. -*/ -#define HA_MRR_MATERIALIZED_KEYS 256U - -/* - The following bits are reserved for use by MRR implementation. The intended - use scenario: - - * sql layer calls handler->multi_range_read_info[_const]() - - MRR implementation figures out what kind of scan it will perform, saves - the result in *mrr_mode parameter. - * sql layer remembers what was returned in *mrr_mode - - * the optimizer picks the query plan (which may or may not include the MRR - scan that was estimated by the multi_range_read_info[_const] call) - - * if the query is an EXPLAIN statement, sql layer will call - handler->multi_range_read_explain_info(mrr_mode) to get a text description - of the picked MRR scan; the description will be a part of EXPLAIN output. -*/ -#define HA_MRR_IMPLEMENTATION_FLAG1 512U -#define HA_MRR_IMPLEMENTATION_FLAG2 1024U -#define HA_MRR_IMPLEMENTATION_FLAG3 2048U -#define HA_MRR_IMPLEMENTATION_FLAG4 4096U -#define HA_MRR_IMPLEMENTATION_FLAG5 8192U -#define HA_MRR_IMPLEMENTATION_FLAG6 16384U - -#define HA_MRR_IMPLEMENTATION_FLAGS \ - (512U | 1024U | 2048U | 4096U | 8192U | 16384U) - -/* - This is a buffer area that the handler can use to store rows. - 'end_of_used_area' should be kept updated after calls to - read-functions so that other parts of the code can use the - remaining area (until next read calls is issued). -*/ - -typedef struct st_handler_buffer -{ - /* const? */uchar *buffer; /* Buffer one can start using */ - /* const? */uchar *buffer_end; /* End of buffer */ - uchar *end_of_used_area; /* End of area that was used by handler */ -} HANDLER_BUFFER; - -typedef struct system_status_var SSV; - -class ha_statistics -{ -public: - ulonglong data_file_length; /* Length off data file */ - ulonglong max_data_file_length; /* Length off data file */ - ulonglong index_file_length; - ulonglong max_index_file_length; - ulonglong delete_length; /* Free bytes */ - ulonglong auto_increment_value; - /* - The number of records in the table. - 0 - means the table has exactly 0 rows - other - if (table_flags() & HA_STATS_RECORDS_IS_EXACT) - the value is the exact number of records in the table - else - it is an estimate - */ - ha_rows records; - ha_rows deleted; /* Deleted records */ - ulong mean_rec_length; /* physical reclength */ - time_t create_time; /* When table was created */ - time_t check_time; - time_t update_time; - uint block_size; /* index block size */ - ha_checksum checksum; - bool checksum_null; - - /* - number of buffer bytes that native mrr implementation needs, - */ - uint mrr_length_per_rec; - - ha_statistics(): - data_file_length(0), max_data_file_length(0), - index_file_length(0), max_index_file_length(0), delete_length(0), - auto_increment_value(0), records(0), deleted(0), mean_rec_length(0), - create_time(0), check_time(0), update_time(0), block_size(8192), - checksum(0), checksum_null(FALSE), mrr_length_per_rec(0) - {} -}; - -extern "C" check_result_t handler_index_cond_check(void* h_arg); - -extern "C" check_result_t handler_rowid_filter_check(void* h_arg); -extern "C" int handler_rowid_filter_is_active(void* h_arg); - -uint calculate_key_len(TABLE *, uint, const uchar *, key_part_map); -/* - bitmap with first N+1 bits set - (keypart_map for a key prefix of [0..N] keyparts) -*/ -#define make_keypart_map(N) (((key_part_map)2 << (N)) - 1) -/* - bitmap with first N bits set - (keypart_map for a key prefix of [0..N-1] keyparts) -*/ -#define make_prev_keypart_map(N) (((key_part_map)1 << (N)) - 1) - - -/** Base class to be used by handlers different shares */ -class Handler_share -{ -public: - Handler_share() {} - virtual ~Handler_share() {} -}; - -enum class Compare_keys : uint32_t -{ - Equal= 0, - EqualButKeyPartLength, - EqualButComment, - NotEqual -}; - -/** - The handler class is the interface for dynamically loadable - storage engines. Do not add ifdefs and take care when adding or - changing virtual functions to avoid vtable confusion - - Functions in this class accept and return table columns data. Two data - representation formats are used: - 1. TableRecordFormat - Used to pass [partial] table records to/from - storage engine - - 2. KeyTupleFormat - used to pass index search tuples (aka "keys") to - storage engine. See opt_range.cc for description of this format. - - TableRecordFormat - ================= - [Warning: this description is work in progress and may be incomplete] - The table record is stored in a fixed-size buffer: - - record: null_bytes, column1_data, column2_data, ... - - The offsets of the parts of the buffer are also fixed: every column has - an offset to its column{i}_data, and if it is nullable it also has its own - bit in null_bytes. - - The record buffer only includes data about columns that are marked in the - relevant column set (table->read_set and/or table->write_set, depending on - the situation). - It could be that it is required that null bits of non-present - columns are set to 1 - - VARIOUS EXCEPTIONS AND SPECIAL CASES - - If the table has no nullable columns, then null_bytes is still - present, its length is one byte which must be set to 0xFF - at all times. - - If the table has columns of type BIT, then certain bits from those columns - may be stored in null_bytes as well. Grep around for Field_bit for - details. - - For blob columns (see Field_blob), the record buffer stores length of the - data, following by memory pointer to the blob data. The pointer is owned - by the storage engine and is valid until the next operation. - - If a blob column has NULL value, then its length and blob data pointer - must be set to 0. -*/ - -class handler :public Sql_alloc -{ -public: - typedef ulonglong Table_flags; -protected: - TABLE_SHARE *table_share; /* The table definition */ - TABLE *table; /* The current open table */ - Table_flags cached_table_flags; /* Set on init() and open() */ - - ha_rows estimation_rows_to_insert; - handler *lookup_handler; -public: - handlerton *ht; /* storage engine of this handler */ - uchar *ref; /* Pointer to current row */ - uchar *dup_ref; /* Pointer to duplicate row */ - uchar *lookup_buffer; - - ha_statistics stats; - - /** MultiRangeRead-related members: */ - range_seq_t mrr_iter; /* Iterator to traverse the range sequence */ - RANGE_SEQ_IF mrr_funcs; /* Range sequence traversal functions */ - HANDLER_BUFFER *multi_range_buffer; /* MRR buffer info */ - uint ranges_in_seq; /* Total number of ranges in the traversed sequence */ - /** Current range (the one we're now returning rows from) */ - KEY_MULTI_RANGE mrr_cur_range; - - /** The following are for read_range() */ - key_range save_end_range, *end_range; - KEY_PART_INFO *range_key_part; - int key_compare_result_on_equal; - - /* TRUE <=> source MRR ranges and the output are ordered */ - bool mrr_is_output_sorted; - /** TRUE <=> we're currently traversing a range in mrr_cur_range. */ - bool mrr_have_range; - bool eq_range; - bool internal_tmp_table; /* If internal tmp table */ - bool implicit_emptied; /* Can be !=0 only if HEAP */ - bool mark_trx_read_write_done; /* mark_trx_read_write was called */ - bool check_table_binlog_row_based_done; /* check_table_binlog.. was called */ - bool check_table_binlog_row_based_result; /* cached check_table_binlog... */ - /* - TRUE <=> the engine guarantees that returned records are within the range - being scanned. - */ - bool in_range_check_pushed_down; - - uint lookup_errkey; - uint errkey; /* Last dup key */ - uint key_used_on_scan; - uint active_index, keyread; - - /** Length of ref (1-8 or the clustered key length) */ - uint ref_length; - FT_INFO *ft_handler; - enum init_stat { NONE=0, INDEX, RND }; - init_stat inited, pre_inited; - - const COND *pushed_cond; - /** - next_insert_id is the next value which should be inserted into the - auto_increment column: in a inserting-multi-row statement (like INSERT - SELECT), for the first row where the autoinc value is not specified by the - statement, get_auto_increment() called and asked to generate a value, - next_insert_id is set to the next value, then for all other rows - next_insert_id is used (and increased each time) without calling - get_auto_increment(). - */ - ulonglong next_insert_id; - /** - insert id for the current row (*autogenerated*; if not - autogenerated, it's 0). - At first successful insertion, this variable is stored into - THD::first_successful_insert_id_in_cur_stmt. - */ - ulonglong insert_id_for_cur_row; - /** - Interval returned by get_auto_increment() and being consumed by the - inserter. - */ - /* Statistics variables */ - ulonglong rows_read; - ulonglong rows_tmp_read; - ulonglong rows_changed; - /* One bigger than needed to avoid to test if key == MAX_KEY */ - ulonglong index_rows_read[MAX_KEY+1]; - ha_copy_info copy_info; - -private: - /* ANALYZE time tracker, if present */ - Exec_time_tracker *tracker; -public: - void set_time_tracker(Exec_time_tracker *tracker_arg) { tracker=tracker_arg;} - Exec_time_tracker *get_time_tracker() { return tracker; } - - Item *pushed_idx_cond; - uint pushed_idx_cond_keyno; /* The index which the above condition is for */ - - /* Rowid filter pushed into the engine */ - Rowid_filter *pushed_rowid_filter; - /* true when the pushed rowid filter has been already filled */ - bool rowid_filter_is_active; - - Discrete_interval auto_inc_interval_for_cur_row; - /** - Number of reserved auto-increment intervals. Serves as a heuristic - when we have no estimation of how many records the statement will insert: - the more intervals we have reserved, the bigger the next one. Reset in - handler::ha_release_auto_increment(). - */ - uint auto_inc_intervals_count; - - /** - Instrumented table associated with this handler. - This member should be set to NULL when no instrumentation is in place, - so that linking an instrumented/non instrumented server/plugin works. - For example: - - the server is compiled with the instrumentation. - The server expects either NULL or valid pointers in m_psi. - - an engine plugin is compiled without instrumentation. - The plugin can not leave this pointer uninitialized, - or can not leave a trash value on purpose in this pointer, - as this would crash the server. - */ - PSI_table *m_psi; - -private: - /** Internal state of the batch instrumentation. */ - enum batch_mode_t - { - /** Batch mode not used. */ - PSI_BATCH_MODE_NONE, - /** Batch mode used, before first table io. */ - PSI_BATCH_MODE_STARTING, - /** Batch mode used, after first table io. */ - PSI_BATCH_MODE_STARTED - }; - /** - Batch mode state. - @sa start_psi_batch_mode. - @sa end_psi_batch_mode. - */ - batch_mode_t m_psi_batch_mode; - /** - The number of rows in the batch. - @sa start_psi_batch_mode. - @sa end_psi_batch_mode. - */ - ulonglong m_psi_numrows; - /** - The current event in a batch. - @sa start_psi_batch_mode. - @sa end_psi_batch_mode. - */ - PSI_table_locker *m_psi_locker; - /** - Storage for the event in a batch. - @sa start_psi_batch_mode. - @sa end_psi_batch_mode. - */ - PSI_table_locker_state m_psi_locker_state; - -public: - virtual void unbind_psi(); - virtual void rebind_psi(); - /* Return error if definition doesn't match for already opened table */ - virtual int discover_check_version() { return 0; } - - /** - Put the handler in 'batch' mode when collecting - table io instrumented events. - When operating in batch mode: - - a single start event is generated in the performance schema. - - all table io performed between @c start_psi_batch_mode - and @c end_psi_batch_mode is not instrumented: - the number of rows affected is counted instead in @c m_psi_numrows. - - a single end event is generated in the performance schema - when the batch mode ends with @c end_psi_batch_mode. - */ - void start_psi_batch_mode(); - /** End a batch started with @c start_psi_batch_mode. */ - void end_psi_batch_mode(); - - /* If we have row logging enabled for this table */ - bool row_logging, row_logging_init; - /* If the row logging should be done in transaction cache */ - bool row_logging_has_trans; - -private: - /** - The lock type set by when calling::ha_external_lock(). This is - propagated down to the storage engine. The reason for also storing - it here, is that when doing MRR we need to create/clone a second handler - object. This cloned handler object needs to know about the lock_type used. - */ - int m_lock_type; - /** - Pointer where to store/retrieve the Handler_share pointer. - For non partitioned handlers this is &TABLE_SHARE::ha_share. - */ - Handler_share **ha_share; - - /** Stores next_insert_id for handling duplicate key errors. */ - ulonglong m_prev_insert_id; - -public: - handler(handlerton *ht_arg, TABLE_SHARE *share_arg) - :table_share(share_arg), table(0), - estimation_rows_to_insert(0), - lookup_handler(this), - ht(ht_arg), ref(0), lookup_buffer(NULL), end_range(NULL), - implicit_emptied(0), - mark_trx_read_write_done(0), - check_table_binlog_row_based_done(0), - check_table_binlog_row_based_result(0), - in_range_check_pushed_down(FALSE), lookup_errkey(-1), errkey(-1), - key_used_on_scan(MAX_KEY), - active_index(MAX_KEY), keyread(MAX_KEY), - ref_length(sizeof(my_off_t)), - ft_handler(0), inited(NONE), pre_inited(NONE), - pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0), - tracker(NULL), - pushed_idx_cond(NULL), - pushed_idx_cond_keyno(MAX_KEY), - pushed_rowid_filter(NULL), - rowid_filter_is_active(0), - auto_inc_intervals_count(0), - m_psi(NULL), - m_psi_batch_mode(PSI_BATCH_MODE_NONE), - m_psi_numrows(0), - m_psi_locker(NULL), - row_logging(0), row_logging_init(0), - m_lock_type(F_UNLCK), ha_share(NULL), m_prev_insert_id(0) - { - DBUG_PRINT("info", - ("handler created F_UNLCK %d F_RDLCK %d F_WRLCK %d", - F_UNLCK, F_RDLCK, F_WRLCK)); - reset_statistics(); - } - virtual ~handler(void) - { - DBUG_ASSERT(m_lock_type == F_UNLCK); - DBUG_ASSERT(inited == NONE); - } - /* To check if table has been properely opened */ - bool is_open() - { - return ref != 0; - } - virtual handler *clone(const char *name, MEM_ROOT *mem_root); - /** This is called after create to allow us to set up cached variables */ - void init() - { - cached_table_flags= table_flags(); - } - /* ha_ methods: pubilc wrappers for private virtual API */ - - int ha_open(TABLE *table, const char *name, int mode, uint test_if_locked, - MEM_ROOT *mem_root= 0, List *partitions_to_open=NULL); - int ha_index_init(uint idx, bool sorted) - { - DBUG_EXECUTE_IF("ha_index_init_fail", return HA_ERR_TABLE_DEF_CHANGED;); - int result; - DBUG_ENTER("ha_index_init"); - DBUG_ASSERT(inited==NONE); - if (!(result= index_init(idx, sorted))) - { - inited= INDEX; - active_index= idx; - end_range= NULL; - } - DBUG_RETURN(result); - } - int ha_index_end() - { - DBUG_ENTER("ha_index_end"); - DBUG_ASSERT(inited==INDEX); - inited= NONE; - active_index= MAX_KEY; - end_range= NULL; - DBUG_RETURN(index_end()); - } - /* This is called after index_init() if we need to do a index scan */ - virtual int prepare_index_scan() { return 0; } - virtual int prepare_index_key_scan_map(const uchar * key, key_part_map keypart_map) - { - uint key_len= calculate_key_len(table, active_index, key, keypart_map); - return prepare_index_key_scan(key, key_len); - } - virtual int prepare_index_key_scan( const uchar * key, uint key_len ) - { return 0; } - virtual int prepare_range_scan(const key_range *start_key, const key_range *end_key) - { return 0; } - - int ha_rnd_init(bool scan) __attribute__ ((warn_unused_result)) - { - DBUG_EXECUTE_IF("ha_rnd_init_fail", return HA_ERR_TABLE_DEF_CHANGED;); - int result; - DBUG_ENTER("ha_rnd_init"); - DBUG_ASSERT(inited==NONE || (inited==RND && scan)); - inited= (result= rnd_init(scan)) ? NONE: RND; - end_range= NULL; - DBUG_RETURN(result); - } - int ha_rnd_end() - { - DBUG_ENTER("ha_rnd_end"); - DBUG_ASSERT(inited==RND); - inited=NONE; - end_range= NULL; - DBUG_RETURN(rnd_end()); - } - int ha_rnd_init_with_error(bool scan) __attribute__ ((warn_unused_result)); - int ha_reset(); - /* this is necessary in many places, e.g. in HANDLER command */ - int ha_index_or_rnd_end() - { - return inited == INDEX ? ha_index_end() : inited == RND ? ha_rnd_end() : 0; - } - /** - The cached_table_flags is set at ha_open and ha_external_lock - */ - Table_flags ha_table_flags() const - { - DBUG_ASSERT(cached_table_flags < (HA_LAST_TABLE_FLAG << 1)); - return cached_table_flags; - } - /** - These functions represent the public interface to *users* of the - handler class, hence they are *not* virtual. For the inheritance - interface, see the (private) functions write_row(), update_row(), - and delete_row() below. - */ - int ha_external_lock(THD *thd, int lock_type); - int ha_external_unlock(THD *thd) { return ha_external_lock(thd, F_UNLCK); } - int ha_write_row(const uchar * buf); - int ha_update_row(const uchar * old_data, const uchar * new_data); - int ha_delete_row(const uchar * buf); - void ha_release_auto_increment(); - - bool keyread_enabled() { return keyread < MAX_KEY; } - int ha_start_keyread(uint idx) - { - int res= keyread_enabled() ? 0 : extra_opt(HA_EXTRA_KEYREAD, idx); - keyread= idx; - return res; - } - int ha_end_keyread() - { - if (!keyread_enabled()) - return 0; - keyread= MAX_KEY; - return extra(HA_EXTRA_NO_KEYREAD); - } - - int check_collation_compatibility(); - int ha_check_for_upgrade(HA_CHECK_OPT *check_opt); - /** to be actually called to get 'check()' functionality*/ - int ha_check(THD *thd, HA_CHECK_OPT *check_opt); - int ha_repair(THD* thd, HA_CHECK_OPT* check_opt); - void ha_start_bulk_insert(ha_rows rows, uint flags= 0) - { - DBUG_ENTER("handler::ha_start_bulk_insert"); - estimation_rows_to_insert= rows; - bzero(©_info,sizeof(copy_info)); - start_bulk_insert(rows, flags); - DBUG_VOID_RETURN; - } - int ha_end_bulk_insert(); - int ha_bulk_update_row(const uchar *old_data, const uchar *new_data, - ha_rows *dup_key_found); - int ha_delete_all_rows(); - int ha_truncate(); - int ha_reset_auto_increment(ulonglong value); - int ha_optimize(THD* thd, HA_CHECK_OPT* check_opt); - int ha_analyze(THD* thd, HA_CHECK_OPT* check_opt); - bool ha_check_and_repair(THD *thd); - int ha_disable_indexes(uint mode); - int ha_enable_indexes(uint mode); - int ha_discard_or_import_tablespace(my_bool discard); - int ha_rename_table(const char *from, const char *to); - void ha_drop_table(const char *name); - - int ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info); - - int ha_create_partitioning_metadata(const char *name, const char *old_name, - chf_create_flags action_flag); - - int ha_change_partitions(HA_CREATE_INFO *create_info, - const char *path, - ulonglong * const copied, - ulonglong * const deleted, - const uchar *pack_frm_data, - size_t pack_frm_len); - int ha_drop_partitions(const char *path); - int ha_rename_partitions(const char *path); - - void adjust_next_insert_id_after_explicit_value(ulonglong nr); - int update_auto_increment(); - virtual void print_error(int error, myf errflag); - virtual bool get_error_message(int error, String *buf); - uint get_dup_key(int error); - /** - Retrieves the names of the table and the key for which there was a - duplicate entry in the case of HA_ERR_FOREIGN_DUPLICATE_KEY. - - If any of the table or key name is not available this method will return - false and will not change any of child_table_name or child_key_name. - - @param child_table_name[out] Table name - @param child_table_name_len[in] Table name buffer size - @param child_key_name[out] Key name - @param child_key_name_len[in] Key name buffer size - - @retval true table and key names were available - and were written into the corresponding - out parameters. - @retval false table and key names were not available, - the out parameters were not touched. - */ - virtual bool get_foreign_dup_key(char *child_table_name, - uint child_table_name_len, - char *child_key_name, - uint child_key_name_len) - { DBUG_ASSERT(false); return(false); } - void reset_statistics() - { - rows_read= rows_changed= rows_tmp_read= 0; - bzero(index_rows_read, sizeof(index_rows_read)); - bzero(©_info, sizeof(copy_info)); - } - virtual void reset_copy_info() {} - void ha_reset_copy_info() - { - bzero(©_info, sizeof(copy_info)); - reset_copy_info(); - } - virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) - { - table= table_arg; - table_share= share; - reset_statistics(); - } - virtual double scan_time() - { - return ((ulonglong2double(stats.data_file_length) / stats.block_size + 2) * - avg_io_cost()); - } - - virtual double key_scan_time(uint index) - { - return keyread_time(index, 1, records()); - } - - virtual double avg_io_cost() - { - return 1.0; - } - - /** - The cost of reading a set of ranges from the table using an index - to access it. - - @param index The index number. - @param ranges The number of ranges to be read. If 0, it means that - we calculate separately the cost of reading the key. - @param rows Total number of rows to be read. - - This method can be used to calculate the total cost of scanning a table - using an index by calling it using read_time(index, 1, table_size). - */ - virtual double read_time(uint index, uint ranges, ha_rows rows) - { return rows2double(ranges+rows); } - - /** - Calculate cost of 'keyread' scan for given index and number of records. - - @param index index to read - @param ranges #of ranges to read - @param rows #of records to read - */ - virtual double keyread_time(uint index, uint ranges, ha_rows rows); - - virtual const key_map *keys_to_use_for_scanning() { return &key_map_empty; } - - /* - True if changes to the table is persistent (if there are no rollback) - This is used to decide: - - If the table is stored in the transaction or non transactional binary - log - - How things are tracked in trx and in add_changed_table(). - - If we can combine several statements under one commit in the binary log. - */ - bool has_transactions() - { - return ((ha_table_flags() & (HA_NO_TRANSACTIONS | HA_PERSISTENT_TABLE)) - == 0); - } - /* - True if table has both transactions and rollback. This is used to decide - if we should write the changes to the binary log. If this is true, - we don't have to write failed statements to the log as they can be - rolled back. - */ - bool has_transactions_and_rollback() - { - return has_transactions() && has_rollback(); - } - /* - True if the underlaying table support transactions and rollback - */ - bool has_transaction_manager() - { - return ((ha_table_flags() & HA_NO_TRANSACTIONS) == 0 && has_rollback()); - } - - /* - True if table has rollback. Used to check if an update on the table - can be killed fast. - */ - - bool has_rollback() - { - return ((ht->flags & HTON_NO_ROLLBACK) == 0); - } - - /** - This method is used to analyse the error to see whether the error - is ignorable or not, certain handlers can have more error that are - ignorable than others. E.g. the partition handler can get inserts - into a range where there is no partition and this is an ignorable - error. - HA_ERR_FOUND_DUP_UNIQUE is a special case in MyISAM that means the - same thing as HA_ERR_FOUND_DUP_KEY but can in some cases lead to - a slightly different error message. - */ - virtual bool is_fatal_error(int error, uint flags) - { - if (!error || - ((flags & HA_CHECK_DUP_KEY) && - (error == HA_ERR_FOUND_DUPP_KEY || - error == HA_ERR_FOUND_DUPP_UNIQUE)) || - error == HA_ERR_AUTOINC_ERANGE || - ((flags & HA_CHECK_FK_ERROR) && - (error == HA_ERR_ROW_IS_REFERENCED || - error == HA_ERR_NO_REFERENCED_ROW))) - return FALSE; - return TRUE; - } - - /** - Number of rows in table. It will only be called if - (table_flags() & (HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT)) != 0 - */ - virtual int pre_records() { return 0; } - virtual ha_rows records() { return stats.records; } - /** - Return upper bound of current number of records in the table - (max. of how many records one will retrieve when doing a full table scan) - If upper bound is not known, HA_POS_ERROR should be returned as a max - possible upper bound. - */ - virtual ha_rows estimate_rows_upper_bound() - { return stats.records+EXTRA_RECORDS; } - - /** - Get the row type from the storage engine. If this method returns - ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used. - */ - virtual enum row_type get_row_type() const { return ROW_TYPE_NOT_USED; } - - virtual const char *index_type(uint key_number) { DBUG_ASSERT(0); return "";} - - - /** - Signal that the table->read_set and table->write_set table maps changed - The handler is allowed to set additional bits in the above map in this - call. Normally the handler should ignore all calls until we have done - a ha_rnd_init() or ha_index_init(), write_row(), update_row or delete_row() - as there may be several calls to this routine. - */ - virtual void column_bitmaps_signal(); - /* - We have to check for inited as some engines, like innodb, sets - active_index during table scan. - */ - uint get_index(void) const - { return inited == INDEX ? active_index : MAX_KEY; } - int ha_close(void); - - /** - @retval 0 Bulk update used by handler - @retval 1 Bulk update not used, normal operation used - */ - virtual bool start_bulk_update() { return 1; } - /** - @retval 0 Bulk delete used by handler - @retval 1 Bulk delete not used, normal operation used - */ - virtual bool start_bulk_delete() { return 1; } - /** - After this call all outstanding updates must be performed. The number - of duplicate key errors are reported in the duplicate key parameter. - It is allowed to continue to the batched update after this call, the - handler has to wait until end_bulk_update with changing state. - - @param dup_key_found Number of duplicate keys found - - @retval 0 Success - @retval >0 Error code - */ - virtual int exec_bulk_update(ha_rows *dup_key_found) - { - DBUG_ASSERT(FALSE); - return HA_ERR_WRONG_COMMAND; - } - /** - Perform any needed clean-up, no outstanding updates are there at the - moment. - */ - virtual int end_bulk_update() { return 0; } - /** - Execute all outstanding deletes and close down the bulk delete. - - @retval 0 Success - @retval >0 Error code - */ - virtual int end_bulk_delete() - { - DBUG_ASSERT(FALSE); - return HA_ERR_WRONG_COMMAND; - } - virtual int pre_index_read_map(const uchar *key, - key_part_map keypart_map, - enum ha_rkey_function find_flag, - bool use_parallel) - { return 0; } - virtual int pre_index_first(bool use_parallel) - { return 0; } - virtual int pre_index_last(bool use_parallel) - { return 0; } - virtual int pre_index_read_last_map(const uchar *key, - key_part_map keypart_map, - bool use_parallel) - { return 0; } -/* - virtual int pre_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, HANDLER_BUFFER *buffer, - bool use_parallel); -*/ - virtual int pre_multi_range_read_next(bool use_parallel) - { return 0; } - virtual int pre_read_range_first(const key_range *start_key, - const key_range *end_key, - bool eq_range, bool sorted, - bool use_parallel) - { return 0; } - virtual int pre_ft_read(bool use_parallel) - { return 0; } - virtual int pre_rnd_next(bool use_parallel) - { return 0; } - int ha_pre_rnd_init(bool scan) - { - int result; - DBUG_ENTER("ha_pre_rnd_init"); - DBUG_ASSERT(pre_inited==NONE || (pre_inited==RND && scan)); - pre_inited= (result= pre_rnd_init(scan)) ? NONE: RND; - DBUG_RETURN(result); - } - int ha_pre_rnd_end() - { - DBUG_ENTER("ha_pre_rnd_end"); - DBUG_ASSERT(pre_inited==RND); - pre_inited=NONE; - DBUG_RETURN(pre_rnd_end()); - } - virtual int pre_rnd_init(bool scan) { return 0; } - virtual int pre_rnd_end() { return 0; } - virtual int pre_index_init(uint idx, bool sorted) { return 0; } - virtual int pre_index_end() { return 0; } - int ha_pre_index_init(uint idx, bool sorted) - { - int result; - DBUG_ENTER("ha_pre_index_init"); - DBUG_ASSERT(pre_inited==NONE); - if (!(result= pre_index_init(idx, sorted))) - pre_inited=INDEX; - DBUG_RETURN(result); - } - int ha_pre_index_end() - { - DBUG_ENTER("ha_pre_index_end"); - DBUG_ASSERT(pre_inited==INDEX); - pre_inited=NONE; - DBUG_RETURN(pre_index_end()); - } - int ha_pre_index_or_rnd_end() - { - return (pre_inited == INDEX ? - ha_pre_index_end() : - pre_inited == RND ? ha_pre_rnd_end() : 0 ); - } - virtual bool vers_can_native(THD *thd) - { - return ht->flags & HTON_NATIVE_SYS_VERSIONING; - } - - /** - @brief - Positions an index cursor to the index specified in the - handle. Fetches the row if available. If the key value is null, - begin at the first key of the index. - */ -protected: - virtual int index_read_map(uchar * buf, const uchar * key, - key_part_map keypart_map, - enum ha_rkey_function find_flag) - { - uint key_len= calculate_key_len(table, active_index, key, keypart_map); - return index_read(buf, key, key_len, find_flag); - } - /** - @brief - Positions an index cursor to the index specified in the - handle. Fetches the row if available. If the key value is null, - begin at the first key of the index. - */ - virtual int index_read_idx_map(uchar * buf, uint index, const uchar * key, - key_part_map keypart_map, - enum ha_rkey_function find_flag); - virtual int index_next(uchar * buf) - { return HA_ERR_WRONG_COMMAND; } - virtual int index_prev(uchar * buf) - { return HA_ERR_WRONG_COMMAND; } - virtual int index_first(uchar * buf) - { return HA_ERR_WRONG_COMMAND; } - virtual int index_last(uchar * buf) - { return HA_ERR_WRONG_COMMAND; } - virtual int index_next_same(uchar *buf, const uchar *key, uint keylen); - /** - @brief - The following functions works like index_read, but it find the last - row with the current key value or prefix. - @returns @see index_read_map(). - */ - virtual int index_read_last_map(uchar * buf, const uchar * key, - key_part_map keypart_map) - { - uint key_len= calculate_key_len(table, active_index, key, keypart_map); - return index_read_last(buf, key, key_len); - } - virtual int close(void)=0; - inline void update_rows_read() - { - if (likely(!internal_tmp_table)) - rows_read++; - else - rows_tmp_read++; - } - inline void update_index_statistics() - { - index_rows_read[active_index]++; - update_rows_read(); - } -public: - - int ha_index_read_map(uchar * buf, const uchar * key, - key_part_map keypart_map, - enum ha_rkey_function find_flag); - int ha_index_read_idx_map(uchar * buf, uint index, const uchar * key, - key_part_map keypart_map, - enum ha_rkey_function find_flag); - int ha_index_next(uchar * buf); - int ha_index_prev(uchar * buf); - int ha_index_first(uchar * buf); - int ha_index_last(uchar * buf); - int ha_index_next_same(uchar *buf, const uchar *key, uint keylen); - /* - TODO: should we make for those functions non-virtual ha_func_name wrappers, - too? - */ - virtual ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, - void *seq_init_param, - uint n_ranges, uint *bufsz, - uint *mrr_mode, - Cost_estimate *cost); - virtual ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, - uint key_parts, uint *bufsz, - uint *mrr_mode, Cost_estimate *cost); - virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, - uint n_ranges, uint mrr_mode, - HANDLER_BUFFER *buf); - virtual int multi_range_read_next(range_id_t *range_info); - /* - Return string representation of the MRR plan. - - This is intended to be used for EXPLAIN, via the following scenario: - 1. SQL layer calls handler->multi_range_read_info(). - 1.1. Storage engine figures out whether it will use some non-default - MRR strategy, sets appropritate bits in *mrr_mode, and returns - control to SQL layer - 2. SQL layer remembers the returned mrr_mode - 3. SQL layer compares various options and choses the final query plan. As - a part of that, it makes a choice of whether to use the MRR strategy - picked in 1.1 - 4. EXPLAIN code converts the query plan to its text representation. If MRR - strategy is part of the plan, it calls - multi_range_read_explain_info(mrr_mode) to get a text representation of - the picked MRR strategy. - - @param mrr_mode Mode which was returned by multi_range_read_info[_const] - @param str INOUT string to be printed for EXPLAIN - @param str_end End of the string buffer. The function is free to put the - string into [str..str_end] memory range. - */ - virtual int multi_range_read_explain_info(uint mrr_mode, char *str, - size_t size) - { return 0; } - - virtual int read_range_first(const key_range *start_key, - const key_range *end_key, - bool eq_range, bool sorted); - virtual int read_range_next(); - void set_end_range(const key_range *end_key); - int compare_key(key_range *range); - int compare_key2(key_range *range) const; - virtual int ft_init() { return HA_ERR_WRONG_COMMAND; } - virtual int pre_ft_init() { return HA_ERR_WRONG_COMMAND; } - virtual void ft_end() {} - virtual int pre_ft_end() { return 0; } - virtual FT_INFO *ft_init_ext(uint flags, uint inx,String *key) - { return NULL; } -public: - virtual int ft_read(uchar *buf) { return HA_ERR_WRONG_COMMAND; } - virtual int rnd_next(uchar *buf)=0; - virtual int rnd_pos(uchar * buf, uchar *pos)=0; - /** - This function only works for handlers having - HA_PRIMARY_KEY_REQUIRED_FOR_POSITION set. - It will return the row with the PK given in the record argument. - */ - virtual int rnd_pos_by_record(uchar *record) - { - int error; - DBUG_ASSERT(table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION); - - error = ha_rnd_init(false); - if (error != 0) - return error; - - position(record); - error = ha_rnd_pos(record, ref); - ha_rnd_end(); - return error; - } - virtual int read_first_row(uchar *buf, uint primary_key); -public: - - /* Same as above, but with statistics */ - inline int ha_ft_read(uchar *buf); - inline void ha_ft_end() { ft_end(); ft_handler=NULL; } - int ha_rnd_next(uchar *buf); - int ha_rnd_pos(uchar *buf, uchar *pos); - inline int ha_rnd_pos_by_record(uchar *buf); - inline int ha_read_first_row(uchar *buf, uint primary_key); - - /** - The following 3 function is only needed for tables that may be - internal temporary tables during joins. - */ - virtual int remember_rnd_pos() - { return HA_ERR_WRONG_COMMAND; } - virtual int restart_rnd_next(uchar *buf) - { return HA_ERR_WRONG_COMMAND; } - virtual int rnd_same(uchar *buf, uint inx) - { return HA_ERR_WRONG_COMMAND; } - - virtual ha_rows records_in_range(uint inx, const key_range *min_key, - const key_range *max_key, - page_range *res) - { return (ha_rows) 10; } - /* - If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, then it sets ref - (reference to the row, aka position, with the primary key given in - the record). - Otherwise it set ref to the current row. - */ - virtual void position(const uchar *record)=0; - virtual int info(uint)=0; // see my_base.h for full description - virtual void get_dynamic_partition_info(PARTITION_STATS *stat_info, - uint part_id); - virtual void set_partitions_to_open(List *partition_names) {} - virtual bool check_if_updates_are_ignored(const char *op) const; - virtual int change_partitions_to_open(List *partition_names) - { return 0; } - virtual int extra(enum ha_extra_function operation) - { return 0; } - virtual int extra_opt(enum ha_extra_function operation, ulong arg) - { return extra(operation); } - - /** - In an UPDATE or DELETE, if the row under the cursor was locked by another - transaction, and the engine used an optimistic read of the last - committed row value under the cursor, then the engine returns 1 from this - function. MySQL must NOT try to update this optimistic value. If the - optimistic value does not match the WHERE condition, MySQL can decide to - skip over this row. Currently only works for InnoDB. This can be used to - avoid unnecessary lock waits. - - If this method returns nonzero, it will also signal the storage - engine that the next read will be a locking re-read of the row. - */ - bool ha_was_semi_consistent_read(); - virtual bool was_semi_consistent_read() { return 0; } - /** - Tell the engine whether it should avoid unnecessary lock waits. - If yes, in an UPDATE or DELETE, if the row under the cursor was locked - by another transaction, the engine may try an optimistic read of - the last committed row value under the cursor. - */ - virtual void try_semi_consistent_read(bool) {} - virtual void unlock_row() {} - virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;} - virtual bool need_info_for_auto_inc() { return 0; } - virtual bool can_use_for_auto_inc_init() { return 1; } - virtual void get_auto_increment(ulonglong offset, ulonglong increment, - ulonglong nb_desired_values, - ulonglong *first_value, - ulonglong *nb_reserved_values); - void set_next_insert_id(ulonglong id) - { - DBUG_PRINT("info",("auto_increment: next value %lu", (ulong)id)); - next_insert_id= id; - } - virtual void restore_auto_increment(ulonglong prev_insert_id) - { - /* - Insertion of a row failed, re-use the lastly generated auto_increment - id, for the next row. This is achieved by resetting next_insert_id to - what it was before the failed insertion (that old value is provided by - the caller). If that value was 0, it was the first row of the INSERT; - then if insert_id_for_cur_row contains 0 it means no id was generated - for this first row, so no id was generated since the INSERT started, so - we should set next_insert_id to 0; if insert_id_for_cur_row is not 0, it - is the generated id of the first and failed row, so we use it. - */ - next_insert_id= (prev_insert_id > 0) ? prev_insert_id : - insert_id_for_cur_row; - } - - /** Store and restore next_insert_id over duplicate key errors. */ - virtual void store_auto_increment() - { - m_prev_insert_id= next_insert_id; - } - virtual void restore_auto_increment() - { - restore_auto_increment(m_prev_insert_id); - } - - virtual void update_create_info(HA_CREATE_INFO *create_info) {} - int check_old_types(); - virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt) - { return HA_ADMIN_NOT_IMPLEMENTED; } - virtual int preload_keys(THD* thd, HA_CHECK_OPT* check_opt) - { return HA_ADMIN_NOT_IMPLEMENTED; } - /* end of the list of admin commands */ - - virtual int indexes_are_disabled(void) {return 0;} - virtual char *update_table_comment(const char * comment) - { return (char*) comment;} - virtual void append_create_info(String *packet) {} - /** - If index == MAX_KEY then a check for table is made and if index < - MAX_KEY then a check is made if the table has foreign keys and if - a foreign key uses this index (and thus the index cannot be dropped). - - @param index Index to check if foreign key uses it - - @retval TRUE Foreign key defined on table or index - @retval FALSE No foreign key defined - */ - virtual bool is_fk_defined_on_table_or_index(uint index) - { return FALSE; } - virtual char* get_foreign_key_create_info() - { return(NULL);} /* gets foreign key create string from InnoDB */ - /** - Used in ALTER TABLE to check if changing storage engine is allowed. - - @note Called without holding thr_lock.c lock. - - @retval true Changing storage engine is allowed. - @retval false Changing storage engine not allowed. - */ - virtual bool can_switch_engines() { return true; } - virtual int can_continue_handler_scan() { return 0; } - /** - Get the list of foreign keys in this table. - - @remark Returns the set of foreign keys where this table is the - dependent or child table. - - @param thd The thread handle. - @param f_key_list[out] The list of foreign keys. - - @return The handler error code or zero for success. - */ - virtual int - get_foreign_key_list(THD *thd, List *f_key_list) - { return 0; } - /** - Get the list of foreign keys referencing this table. - - @remark Returns the set of foreign keys where this table is the - referenced or parent table. - - @param thd The thread handle. - @param f_key_list[out] The list of foreign keys. - - @return The handler error code or zero for success. - */ - virtual int - get_parent_foreign_key_list(THD *thd, List *f_key_list) - { return 0; } - virtual uint referenced_by_foreign_key() { return 0;} - virtual void init_table_handle_for_HANDLER() - { return; } /* prepare InnoDB for HANDLER */ - virtual void free_foreign_key_create_info(char* str) {} - /** The following can be called without an open handler */ - const char *table_type() const { return hton_name(ht)->str; } - const char **bas_ext() const { return ht->tablefile_extensions; } - - virtual int get_default_no_partitions(HA_CREATE_INFO *create_info) - { return 1;} - virtual void set_auto_partitions(partition_info *part_info) { return; } - virtual bool get_no_parts(const char *name, - uint *no_parts) - { - *no_parts= 0; - return 0; - } - virtual void set_part_info(partition_info *part_info) {return;} - virtual void return_record_by_parent() { return; } - - /* Information about index. Both index and part starts from 0 */ - virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0; - - uint max_record_length() const - { return MY_MIN(HA_MAX_REC_LENGTH, max_supported_record_length()); } - uint max_keys() const - { return MY_MIN(MAX_KEY, max_supported_keys()); } - uint max_key_parts() const - { return MY_MIN(MAX_REF_PARTS, max_supported_key_parts()); } - uint max_key_length() const - { return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_length()); } - uint max_key_part_length() const - { return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_part_length()); } - - virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } - virtual uint max_supported_keys() const { return 0; } - virtual uint max_supported_key_parts() const { return MAX_REF_PARTS; } - virtual uint max_supported_key_length() const { return MAX_DATA_LENGTH_FOR_KEY; } - virtual uint max_supported_key_part_length() const { return 255; } - virtual uint min_record_length(uint options) const { return 1; } - - virtual int pre_calculate_checksum() { return 0; } - virtual int calculate_checksum(); - virtual bool is_crashed() const { return 0; } - virtual bool auto_repair(int error) const { return 0; } - - void update_global_table_stats(); - void update_global_index_stats(); - - /** - @note lock_count() can return > 1 if the table is MERGE or partitioned. - */ - virtual uint lock_count(void) const { return 1; } - /** - Is not invoked for non-transactional temporary tables. - - @note store_lock() can return more than one lock if the table is MERGE - or partitioned. - - @note that one can NOT rely on table->in_use in store_lock(). It may - refer to a different thread if called from mysql_lock_abort_for_thread(). - - @note If the table is MERGE, store_lock() can return less locks - than lock_count() claimed. This can happen when the MERGE children - are not attached when this is called from another thread. - */ - virtual THR_LOCK_DATA **store_lock(THD *thd, - THR_LOCK_DATA **to, - enum thr_lock_type lock_type)=0; - - /** Type of table for caching query */ - virtual uint8 table_cache_type() { return HA_CACHE_TBL_NONTRANSACT; } - - - /** - @brief Register a named table with a call back function to the query cache. - - @param thd The thread handle - @param table_key A pointer to the table name in the table cache - @param key_length The length of the table name - @param[out] engine_callback The pointer to the storage engine call back - function - @param[out] engine_data Storage engine specific data which could be - anything - - This method offers the storage engine, the possibility to store a reference - to a table name which is going to be used with query cache. - The method is called each time a statement is written to the cache and can - be used to verify if a specific statement is cacheable. It also offers - the possibility to register a generic (but static) call back function which - is called each time a statement is matched against the query cache. - - @note If engine_data supplied with this function is different from - engine_data supplied with the callback function, and the callback returns - FALSE, a table invalidation on the current table will occur. - - @return Upon success the engine_callback will point to the storage engine - call back function, if any, and engine_data will point to any storage - engine data used in the specific implementation. - @retval TRUE Success - @retval FALSE The specified table or current statement should not be - cached - */ - - virtual my_bool register_query_cache_table(THD *thd, const char *table_key, - uint key_length, - qc_engine_callback *callback, - ulonglong *engine_data) - { - *callback= 0; - return TRUE; - } - - /* - Count tables invisible from all tables list on which current one built - (like myisammrg and partitioned tables) - - tables_type mask for the tables should be added herdde - - returns number of such tables - */ - - virtual uint count_query_cache_dependant_tables(uint8 *tables_type - __attribute__((unused))) - { - return 0; - } - - /* - register tables invisible from all tables list on which current one built - (like myisammrg and partitioned tables). - - @note they should be counted by method above - - cache Query cache pointer - block Query cache block to write the table - n Number of the table - - @retval FALSE - OK - @retval TRUE - Error - */ - - virtual my_bool - register_query_cache_dependant_tables(THD *thd - __attribute__((unused)), - Query_cache *cache - __attribute__((unused)), - Query_cache_block_table **block - __attribute__((unused)), - uint *n __attribute__((unused))) - { - return FALSE; - } - - /* - Check if the key is a clustering key - - - Data is stored together with the primary key (no secondary lookup - needed to find the row data). The optimizer uses this to find out - the cost of fetching data. - - Note that in many cases a clustered key is also a reference key. - This means that: - - - The key is part of each secondary key and is used - to find the row data in the primary index when reading trough - secondary indexes. - - When doing a HA_KEYREAD_ONLY we get also all the primary key parts - into the row. This is critical property used by index_merge. - - All the above is usually true for engines that store the row - data in the primary key index (e.g. in a b-tree), and use the key - key value as a position(). InnoDB is an example of such an engine. - - For a clustered (primary) key, the following should also hold: - index_flags() should contain HA_CLUSTERED_INDEX - table_flags() should contain HA_TABLE_SCAN_ON_INDEX - - For a reference key the following should also hold: - table_flags() should contain HA_PRIMARY_KEY_IS_READ_INDEX. - - @retval TRUE yes - @retval FALSE No. - */ - - /* The following code is for primary keys */ - bool pk_is_clustering_key(uint index) const - { - /* - We have to check for MAX_INDEX as table->s->primary_key can be - MAX_KEY in the case where there is no primary key. - */ - return index != MAX_KEY && is_clustering_key(index); - } - /* Same as before but for other keys, in which case we can skip the check */ - bool is_clustering_key(uint index) const - { - DBUG_ASSERT(index != MAX_KEY); - return (index_flags(index, 0, 1) & HA_CLUSTERED_INDEX); - } - - virtual int cmp_ref(const uchar *ref1, const uchar *ref2) - { - return memcmp(ref1, ref2, ref_length); - } - - /* - Condition pushdown to storage engines - */ - - /** - Push condition down to the table handler. - - @param cond Condition to be pushed. The condition tree must not be - modified by the by the caller. - - @return - The 'remainder' condition that caller must use to filter out records. - NULL means the handler will not return rows that do not match the - passed condition. - - @note - The pushed conditions form a stack (from which one can remove the - last pushed condition using cond_pop). - The table handler filters out rows using (pushed_cond1 AND pushed_cond2 - AND ... AND pushed_condN) - or less restrictive condition, depending on handler's capabilities. - - handler->ha_reset() call empties the condition stack. - Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the - condition stack. - */ - virtual const COND *cond_push(const COND *cond) { return cond; }; - /** - Pop the top condition from the condition stack of the handler instance. - - Pops the top if condition stack, if stack is not empty. - */ - virtual void cond_pop() { return; }; - - /** - Push metadata for the current operation down to the table handler. - */ - virtual int info_push(uint info_type, void *info) { return 0; }; - - /** - Push down an index condition to the handler. - - The server will use this method to push down a condition it wants - the handler to evaluate when retrieving records using a specified - index. The pushed index condition will only refer to fields from - this handler that is contained in the index (but it may also refer - to fields in other handlers). Before the handler evaluates the - condition it must read the content of the index entry into the - record buffer. - - The handler is free to decide if and how much of the condition it - will take responsibility for evaluating. Based on this evaluation - it should return the part of the condition it will not evaluate. - If it decides to evaluate the entire condition it should return - NULL. If it decides not to evaluate any part of the condition it - should return a pointer to the same condition as given as argument. - - @param keyno the index number to evaluate the condition on - @param idx_cond the condition to be evaluated by the handler - - @return The part of the pushed condition that the handler decides - not to evaluate - */ - virtual Item *idx_cond_push(uint keyno, Item* idx_cond) { return idx_cond; } - - /** Reset information about pushed index conditions */ - virtual void cancel_pushed_idx_cond() - { - pushed_idx_cond= NULL; - pushed_idx_cond_keyno= MAX_KEY; - in_range_check_pushed_down= false; - } - - virtual void cancel_pushed_rowid_filter() - { - pushed_rowid_filter= NULL; - rowid_filter_is_active= false; - } - - virtual bool rowid_filter_push(Rowid_filter *rowid_filter) { return true; } - - /* Needed for partition / spider */ - virtual TABLE_LIST *get_next_global_for_child() { return NULL; } - - /** - Part of old, deprecated in-place ALTER API. - */ - virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info, - uint table_changes) - { return COMPATIBLE_DATA_NO; } - - /* On-line/in-place ALTER TABLE interface. */ - - /* - Here is an outline of on-line/in-place ALTER TABLE execution through - this interface. - - Phase 1 : Initialization - ======================== - During this phase we determine which algorithm should be used - for execution of ALTER TABLE and what level concurrency it will - require. - - *) This phase starts by opening the table and preparing description - of the new version of the table. - *) Then we check if it is impossible even in theory to carry out - this ALTER TABLE using the in-place algorithm. For example, because - we need to change storage engine or the user has explicitly requested - usage of the "copy" algorithm. - *) If in-place ALTER TABLE is theoretically possible, we continue - by compiling differences between old and new versions of the table - in the form of HA_ALTER_FLAGS bitmap. We also build a few - auxiliary structures describing requested changes and store - all these data in the Alter_inplace_info object. - *) Then the handler::check_if_supported_inplace_alter() method is called - in order to find if the storage engine can carry out changes requested - by this ALTER TABLE using the in-place algorithm. To determine this, - the engine can rely on data in HA_ALTER_FLAGS/Alter_inplace_info - passed to it as well as on its own checks. If the in-place algorithm - can be used for this ALTER TABLE, the level of required concurrency for - its execution is also returned. - If any errors occur during the handler call, ALTER TABLE is aborted - and no further handler functions are called. - *) Locking requirements of the in-place algorithm are compared to any - concurrency requirements specified by user. If there is a conflict - between them, we either switch to the copy algorithm or emit an error. - - Phase 2 : Execution - =================== - - In this phase the operations are executed. - - *) As the first step, we acquire a lock corresponding to the concurrency - level which was returned by handler::check_if_supported_inplace_alter() - and requested by the user. This lock is held for most of the - duration of in-place ALTER (if HA_ALTER_INPLACE_COPY_LOCK - or HA_ALTER_INPLACE_COPY_NO_LOCK were returned we acquire an - exclusive lock for duration of the next step only). - *) After that we call handler::ha_prepare_inplace_alter_table() to give the - storage engine a chance to update its internal structures with a higher - lock level than the one that will be used for the main step of algorithm. - After that we downgrade the lock if it is necessary. - *) After that, the main step of this phase and algorithm is executed. - We call the handler::ha_inplace_alter_table() method, which carries out the - changes requested by ALTER TABLE but does not makes them visible to other - connections yet. - *) We ensure that no other connection uses the table by upgrading our - lock on it to exclusive. - *) a) If the previous step succeeds, handler::ha_commit_inplace_alter_table() is - called to allow the storage engine to do any final updates to its structures, - to make all earlier changes durable and visible to other connections. - b) If we have failed to upgrade lock or any errors have occurred during the - handler functions calls (including commit), we call - handler::ha_commit_inplace_alter_table() - to rollback all changes which were done during previous steps. - - Phase 3 : Final - =============== - - In this phase we: - - *) Update SQL-layer data-dictionary by installing .FRM file for the new version - of the table. - *) Inform the storage engine about this change by calling the - hton::notify_table_changed() - *) Destroy the Alter_inplace_info and handler_ctx objects. - - */ - - /** - Check if a storage engine supports a particular alter table in-place - - @param altered_table TABLE object for new version of table. - @param ha_alter_info Structure describing changes to be done - by ALTER TABLE and holding data used - during in-place alter. - - @retval HA_ALTER_ERROR Unexpected error. - @retval HA_ALTER_INPLACE_NOT_SUPPORTED Not supported, must use copy. - @retval HA_ALTER_INPLACE_EXCLUSIVE_LOCK Supported, but requires X lock. - @retval HA_ALTER_INPLACE_COPY_LOCK - Supported, but requires SNW lock - during main phase. Prepare phase - requires X lock. - @retval HA_ALTER_INPLACE_SHARED_LOCK Supported, but requires SNW lock. - @retval HA_ALTER_INPLACE_COPY_NO_LOCK - Supported, concurrent reads/writes - allowed. However, prepare phase - requires X lock. - @retval HA_ALTER_INPLACE_NO_LOCK Supported, concurrent - reads/writes allowed. - - @note The default implementation uses the old in-place ALTER API - to determine if the storage engine supports in-place ALTER or not. - - @note Called without holding thr_lock.c lock. - */ - virtual enum_alter_inplace_result - check_if_supported_inplace_alter(TABLE *altered_table, - Alter_inplace_info *ha_alter_info); - - - /** - Public functions wrapping the actual handler call. - @see prepare_inplace_alter_table() - */ - bool ha_prepare_inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info); - - - /** - Public function wrapping the actual handler call. - @see inplace_alter_table() - */ - bool ha_inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info) - { - return inplace_alter_table(altered_table, ha_alter_info); - } - - - /** - Public function wrapping the actual handler call. - Allows us to enforce asserts regardless of handler implementation. - @see commit_inplace_alter_table() - */ - bool ha_commit_inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info, - bool commit); - - -protected: - /** - Allows the storage engine to update internal structures with concurrent - writes blocked. If check_if_supported_inplace_alter() returns - HA_ALTER_INPLACE_COPY_NO_LOCK or HA_ALTER_INPLACE_COPY_LOCK, - this function is called with exclusive lock otherwise the same level - of locking as for inplace_alter_table() will be used. - - @note Storage engines are responsible for reporting any errors by - calling my_error()/print_error() - - @note If this function reports error, commit_inplace_alter_table() - will be called with commit= false. - - @note For partitioning, failing to prepare one partition, means that - commit_inplace_alter_table() will be called to roll back changes for - all partitions. This means that commit_inplace_alter_table() might be - called without prepare_inplace_alter_table() having been called first - for a given partition. - - @param altered_table TABLE object for new version of table. - @param ha_alter_info Structure describing changes to be done - by ALTER TABLE and holding data used - during in-place alter. - - @retval true Error - @retval false Success - */ - virtual bool prepare_inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info) - { return false; } - - - /** - Alter the table structure in-place with operations specified using HA_ALTER_FLAGS - and Alter_inplace_info. The level of concurrency allowed during this - operation depends on the return value from check_if_supported_inplace_alter(). - - @note Storage engines are responsible for reporting any errors by - calling my_error()/print_error() - - @note If this function reports error, commit_inplace_alter_table() - will be called with commit= false. - - @param altered_table TABLE object for new version of table. - @param ha_alter_info Structure describing changes to be done - by ALTER TABLE and holding data used - during in-place alter. - - @retval true Error - @retval false Success - */ - virtual bool inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info) - { return false; } - - - /** - Commit or rollback the changes made during prepare_inplace_alter_table() - and inplace_alter_table() inside the storage engine. - Note that in case of rollback the allowed level of concurrency during - this operation will be the same as for inplace_alter_table() and thus - might be higher than during prepare_inplace_alter_table(). (For example, - concurrent writes were blocked during prepare, but might not be during - rollback). - - @note Storage engines are responsible for reporting any errors by - calling my_error()/print_error() - - @note If this function with commit= true reports error, it will be called - again with commit= false. - - @note In case of partitioning, this function might be called for rollback - without prepare_inplace_alter_table() having been called first. - Also partitioned tables sets ha_alter_info->group_commit_ctx to a NULL - terminated array of the partitions handlers and if all of them are - committed as one, then group_commit_ctx should be set to NULL to indicate - to the partitioning handler that all partitions handlers are committed. - @see prepare_inplace_alter_table(). - - @param altered_table TABLE object for new version of table. - @param ha_alter_info Structure describing changes to be done - by ALTER TABLE and holding data used - during in-place alter. - @param commit True => Commit, False => Rollback. - - @retval true Error - @retval false Success - */ - virtual bool commit_inplace_alter_table(TABLE *altered_table, - Alter_inplace_info *ha_alter_info, - bool commit) -{ - /* Nothing to commit/rollback, mark all handlers committed! */ - ha_alter_info->group_commit_ctx= NULL; - return false; -} - -public: - /* End of On-line/in-place ALTER TABLE interface. */ - - - /** - use_hidden_primary_key() is called in case of an update/delete when - (table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined - but we don't have a primary key - */ - virtual void use_hidden_primary_key(); - virtual alter_table_operations alter_table_flags(alter_table_operations flags) - { - if (ht->alter_table_flags) - return ht->alter_table_flags(flags); - return 0; - } - - virtual LEX_CSTRING *engine_name(); - - TABLE* get_table() { return table; } - TABLE_SHARE* get_table_share() { return table_share; } -protected: - /* Service methods for use by storage engines. */ - THD *ha_thd(void) const; - - /** - Acquire the instrumented table information from a table share. - @return an instrumented table share, or NULL. - */ - PSI_table_share *ha_table_share_psi() const; - - /** - Default rename_table() and delete_table() rename/delete files with a - given name and extensions from bas_ext(). - - These methods can be overridden, but their default implementation - provide useful functionality. - */ - virtual int rename_table(const char *from, const char *to); - - -public: - /** - Delete a table in the engine. Called for base as well as temporary - tables. - */ - virtual int delete_table(const char *name); - bool check_table_binlog_row_based(); - bool prepare_for_row_logging(); - int prepare_for_insert(bool do_create); - int binlog_log_row(TABLE *table, - const uchar *before_record, - const uchar *after_record, - Log_func *log_func); - - inline void clear_cached_table_binlog_row_based_flag() - { - check_table_binlog_row_based_done= 0; - } -private: - /* Cache result to avoid extra calls */ - inline void mark_trx_read_write() - { - if (unlikely(!mark_trx_read_write_done)) - { - mark_trx_read_write_done= 1; - mark_trx_read_write_internal(); - } - } - -private: - void mark_trx_read_write_internal(); - bool check_table_binlog_row_based_internal(); - - int create_lookup_handler(); - void alloc_lookup_buffer(); - int check_duplicate_long_entries(const uchar *new_rec); - int check_duplicate_long_entries_update(const uchar *new_rec); - int check_duplicate_long_entry_key(const uchar *new_rec, uint key_no); - /** PRIMARY KEY/UNIQUE WITHOUT OVERLAPS check */ - int ha_check_overlaps(const uchar *old_data, const uchar* new_data); - -protected: - /* - These are intended to be used only by handler::ha_xxxx() functions - However, engines that implement read_range_XXX() (like MariaRocks) - or embed other engines (like ha_partition) may need to call these also - */ - inline void increment_statistics(ulong SSV::*offset) const; - inline void decrement_statistics(ulong SSV::*offset) const; - -private: - /* - Low-level primitives for storage engines. These should be - overridden by the storage engine class. To call these methods, use - the corresponding 'ha_*' method above. - */ - - virtual int open(const char *name, int mode, uint test_if_locked)=0; - /* Note: ha_index_read_idx_map() may bypass index_init() */ - virtual int index_init(uint idx, bool sorted) { return 0; } - virtual int index_end() { return 0; } - /** - rnd_init() can be called two times without rnd_end() in between - (it only makes sense if scan=1). - then the second call should prepare for the new table scan (e.g - if rnd_init allocates the cursor, second call should position it - to the start of the table, no need to deallocate and allocate it again - */ - virtual int rnd_init(bool scan)= 0; - virtual int rnd_end() { return 0; } - virtual int write_row(const uchar *buf __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; - } - - /** - Update a single row. - - Note: If HA_ERR_FOUND_DUPP_KEY is returned, the handler must read - all columns of the row so MySQL can create an error message. If - the columns required for the error message are not read, the error - message will contain garbage. - */ - virtual int update_row(const uchar *old_data __attribute__((unused)), - const uchar *new_data __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; - } - - /* - Optimized function for updating the first row. Only used by sequence - tables - */ - virtual int update_first_row(const uchar *new_data); - - virtual int delete_row(const uchar *buf __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; - } - - /* Perform initialization for a direct update request */ -public: - int ha_direct_update_rows(ha_rows *update_rows, ha_rows *found_rows); - virtual int direct_update_rows_init(List *update_fields) - { - return HA_ERR_WRONG_COMMAND; - } -private: - virtual int pre_direct_update_rows_init(List *update_fields) - { - return HA_ERR_WRONG_COMMAND; - } - virtual int direct_update_rows(ha_rows *update_rows __attribute__((unused)), - ha_rows *found_rows __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; - } - virtual int pre_direct_update_rows() - { - return HA_ERR_WRONG_COMMAND; - } - - /* Perform initialization for a direct delete request */ -public: - int ha_direct_delete_rows(ha_rows *delete_rows); - virtual int direct_delete_rows_init() - { - return HA_ERR_WRONG_COMMAND; - } -private: - virtual int pre_direct_delete_rows_init() - { - return HA_ERR_WRONG_COMMAND; - } - virtual int direct_delete_rows(ha_rows *delete_rows __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; - } - virtual int pre_direct_delete_rows() - { - return HA_ERR_WRONG_COMMAND; - } - - /** - Reset state of file to after 'open'. - This function is called after every statement for all tables used - by that statement. - */ - virtual int reset() { return 0; } - virtual Table_flags table_flags(void) const= 0; - /** - Is not invoked for non-transactional temporary tables. - - Tells the storage engine that we intend to read or write data - from the table. This call is prefixed with a call to handler::store_lock() - and is invoked only for those handler instances that stored the lock. - - Calls to rnd_init/index_init are prefixed with this call. When table - IO is complete, we call external_lock(F_UNLCK). - A storage engine writer should expect that each call to - ::external_lock(F_[RD|WR]LOCK is followed by a call to - ::external_lock(F_UNLCK). If it is not, it is a bug in MySQL. - - The name and signature originate from the first implementation - in MyISAM, which would call fcntl to set/clear an advisory - lock on the data file in this method. - - @param lock_type F_RDLCK, F_WRLCK, F_UNLCK - - @return non-0 in case of failure, 0 in case of success. - When lock_type is F_UNLCK, the return value is ignored. - */ - virtual int external_lock(THD *thd __attribute__((unused)), - int lock_type __attribute__((unused))) - { - return 0; - } - virtual void release_auto_increment() { return; }; - /** admin commands - called from mysql_admin_table */ - virtual int check_for_upgrade(HA_CHECK_OPT *check_opt) - { return 0; } - virtual int check(THD* thd, HA_CHECK_OPT* check_opt) - { return HA_ADMIN_NOT_IMPLEMENTED; } - - /** - In this method check_opt can be modified - to specify CHECK option to use to call check() - upon the table. - */ - virtual int repair(THD* thd, HA_CHECK_OPT* check_opt) - { - DBUG_ASSERT(!(ha_table_flags() & HA_CAN_REPAIR)); - return HA_ADMIN_NOT_IMPLEMENTED; - } -protected: - virtual void start_bulk_insert(ha_rows rows, uint flags) {} - virtual int end_bulk_insert() { return 0; } - virtual int index_read(uchar * buf, const uchar * key, uint key_len, - enum ha_rkey_function find_flag) - { return HA_ERR_WRONG_COMMAND; } - virtual int index_read_last(uchar * buf, const uchar * key, uint key_len) - { - my_errno= HA_ERR_WRONG_COMMAND; - return HA_ERR_WRONG_COMMAND; - } - friend class ha_partition; - friend class ha_sequence; -public: - /** - This method is similar to update_row, however the handler doesn't need - to execute the updates at this point in time. The handler can be certain - that another call to bulk_update_row will occur OR a call to - exec_bulk_update before the set of updates in this query is concluded. - - @param old_data Old record - @param new_data New record - @param dup_key_found Number of duplicate keys found - - @retval 0 Bulk delete used by handler - @retval 1 Bulk delete not used, normal operation used - */ - virtual int bulk_update_row(const uchar *old_data, const uchar *new_data, - ha_rows *dup_key_found) - { - DBUG_ASSERT(FALSE); - return HA_ERR_WRONG_COMMAND; - } - /** - This is called to delete all rows in a table - If the handler don't support this, then this function will - return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one - by one. - */ - virtual int delete_all_rows() - { return (my_errno=HA_ERR_WRONG_COMMAND); } - /** - Quickly remove all rows from a table. - - @remark This method is responsible for implementing MySQL's TRUNCATE - TABLE statement, which is a DDL operation. As such, a engine - can bypass certain integrity checks and in some cases avoid - fine-grained locking (e.g. row locks) which would normally be - required for a DELETE statement. - - @remark Typically, truncate is not used if it can result in integrity - violation. For example, truncate is not used when a foreign - key references the table, but it might be used if foreign key - checks are disabled. - - @remark Engine is responsible for resetting the auto-increment counter. - - @remark The table is locked in exclusive mode. - */ - virtual int truncate() - { - int error= delete_all_rows(); - return error ? error : reset_auto_increment(0); - } - /** - Reset the auto-increment counter to the given value, i.e. the next row - inserted will get the given value. - */ - virtual int reset_auto_increment(ulonglong value) - { return 0; } - virtual int optimize(THD* thd, HA_CHECK_OPT* check_opt) - { return HA_ADMIN_NOT_IMPLEMENTED; } - virtual int analyze(THD* thd, HA_CHECK_OPT* check_opt) - { return HA_ADMIN_NOT_IMPLEMENTED; } - virtual bool check_and_repair(THD *thd) { return TRUE; } - virtual int disable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } - virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } - virtual int discard_or_import_tablespace(my_bool discard) - { return (my_errno=HA_ERR_WRONG_COMMAND); } - virtual void drop_table(const char *name); - virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0; - - virtual int create_partitioning_metadata(const char *name, - const char *old_name, - chf_create_flags action_flag) - { return FALSE; } - - virtual int change_partitions(HA_CREATE_INFO *create_info, - const char *path, - ulonglong * const copied, - ulonglong * const deleted, - const uchar *pack_frm_data, - size_t pack_frm_len) - { return HA_ERR_WRONG_COMMAND; } - virtual int drop_partitions(const char *path) - { return HA_ERR_WRONG_COMMAND; } - virtual int rename_partitions(const char *path) - { return HA_ERR_WRONG_COMMAND; } - virtual bool set_ha_share_ref(Handler_share **arg_ha_share) - { - DBUG_ASSERT(!ha_share); - DBUG_ASSERT(arg_ha_share); - if (ha_share || !arg_ha_share) - return true; - ha_share= arg_ha_share; - return false; - } - void set_table(TABLE* table_arg) { table= table_arg; } - int get_lock_type() const { return m_lock_type; } -public: - /* XXX to be removed, see ha_partition::partition_ht() */ - virtual handlerton *partition_ht() const - { return ht; } - inline int ha_write_tmp_row(uchar *buf); - inline int ha_delete_tmp_row(uchar *buf); - inline int ha_update_tmp_row(const uchar * old_data, uchar * new_data); - - virtual void set_lock_type(enum thr_lock_type lock); - friend check_result_t handler_index_cond_check(void* h_arg); - friend check_result_t handler_rowid_filter_check(void *h_arg); - - /** - Find unique record by index or unique constrain - - @param record record to find (also will be fillded with - actual record fields) - @param unique_ref index or unique constraiun number (depends - on what used in the engine - - @retval -1 Error - @retval 1 Not found - @retval 0 Found - */ - virtual int find_unique_row(uchar *record, uint unique_ref) - { return -1; /*unsupported */} - - bool native_versioned() const - { DBUG_ASSERT(ht); return partition_ht()->flags & HTON_NATIVE_SYS_VERSIONING; } - virtual void update_partition(uint part_id) - {} - - /** - Some engines can perform column type conversion with ALGORITHM=INPLACE. - These functions check for such possibility. - Implementation could be based on Field_xxx::is_equal() - */ - virtual bool can_convert_string(const Field_string *field, - const Column_definition &new_type) const - { - return false; - } - virtual bool can_convert_varstring(const Field_varstring *field, - const Column_definition &new_type) const - { - return false; - } - virtual bool can_convert_blob(const Field_blob *field, - const Column_definition &new_type) const - { - return false; - } - /* If the table is using sql level unique constraints on some column */ - inline bool has_long_unique(); - - /* Used for ALTER TABLE. - Some engines can handle some differences in indexes by themself. */ - virtual Compare_keys compare_key_parts(const Field &old_field, - const Column_definition &new_field, - const KEY_PART_INFO &old_part, - const KEY_PART_INFO &new_part) const; - -protected: - Handler_share *get_ha_share_ptr(); - void set_ha_share_ptr(Handler_share *arg_ha_share); - void lock_shared_ha_data(); - void unlock_shared_ha_data(); -}; - -#include "multi_range_read.h" -#include "group_by_handler.h" - -bool key_uses_partial_cols(TABLE_SHARE *table, uint keyno); - - /* Some extern variables used with handlers */ - -extern const char *ha_row_type[]; -extern MYSQL_PLUGIN_IMPORT const char *tx_isolation_names[]; -extern MYSQL_PLUGIN_IMPORT const char *binlog_format_names[]; -extern TYPELIB tx_isolation_typelib; -extern const char *myisam_stats_method_names[]; -extern ulong total_ha, total_ha_2pc; - -/* lookups */ -plugin_ref ha_resolve_by_name(THD *thd, const LEX_CSTRING *name, bool tmp_table); -plugin_ref ha_lock_engine(THD *thd, const handlerton *hton); -handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type); -handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc, - handlerton *db_type); -handlerton *ha_checktype(THD *thd, handlerton *hton, bool no_substitute); - -static inline handlerton *ha_checktype(THD *thd, enum legacy_db_type type, - bool no_substitute = 0) -{ - return ha_checktype(thd, ha_resolve_by_legacy_type(thd, type), no_substitute); -} - -static inline enum legacy_db_type ha_legacy_type(const handlerton *db_type) -{ - return (db_type == NULL) ? DB_TYPE_UNKNOWN : db_type->db_type; -} - -static inline const char *ha_resolve_storage_engine_name(const handlerton *db_type) -{ - return db_type == NULL ? "UNKNOWN" : hton_name(db_type)->str; -} - -static inline bool ha_check_storage_engine_flag(const handlerton *db_type, uint32 flag) -{ - return db_type == NULL ? FALSE : MY_TEST(db_type->flags & flag); -} - -static inline bool ha_storage_engine_is_enabled(const handlerton *db_type) -{ - return db_type && db_type->create; -} - -#define view_pseudo_hton ((handlerton *)1) - -/* basic stuff */ -int ha_init_errors(void); -int ha_init(void); -int ha_end(void); -int ha_initialize_handlerton(st_plugin_int *plugin); -int ha_finalize_handlerton(st_plugin_int *plugin); - -TYPELIB *ha_known_exts(void); -int ha_panic(enum ha_panic_function flag); -void ha_close_connection(THD* thd); -void ha_kill_query(THD* thd, enum thd_kill_levels level); -bool ha_flush_logs(); -void ha_drop_database(char* path); -void ha_checkpoint_state(bool disable); -void ha_commit_checkpoint_request(void *cookie, void (*pre_hook)(void *)); -int ha_create_table(THD *thd, const char *path, - const char *db, const char *table_name, - HA_CREATE_INFO *create_info, LEX_CUSTRING *frm); -int ha_delete_table(THD *thd, handlerton *db_type, const char *path, - const LEX_CSTRING *db, const LEX_CSTRING *alias, - bool generate_warning); -int ha_delete_table_force(THD *thd, const char *path, const LEX_CSTRING *db, - const LEX_CSTRING *alias); - -void ha_prepare_for_backup(); -void ha_end_backup(); -void ha_pre_shutdown(); - -/* statistics and info */ -bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat); - -/* discovery */ -#ifdef MYSQL_SERVER -class Discovered_table_list: public handlerton::discovered_list -{ - THD *thd; - const char *wild, *wend; - bool with_temps; // whether to include temp tables in the result -public: - Dynamic_array *tables; - - Discovered_table_list(THD *thd_arg, Dynamic_array *tables_arg, - const LEX_CSTRING *wild_arg); - Discovered_table_list(THD *thd_arg, Dynamic_array *tables_arg) - : thd(thd_arg), wild(NULL), with_temps(true), tables(tables_arg) {} - ~Discovered_table_list() {} - - bool add_table(const char *tname, size_t tlen); - bool add_file(const char *fname); - - void sort(); - void remove_duplicates(); // assumes that the list is sorted -#ifndef DBUG_OFF - /* - Used to find unstable mtr tests querying - INFORMATION_SCHEMA.TABLES without ORDER BY. - */ - void sort_desc(); -#endif /* DBUG_OFF */ -}; - -int ha_discover_table(THD *thd, TABLE_SHARE *share); -int ha_discover_table_names(THD *thd, LEX_CSTRING *db, MY_DIR *dirp, - Discovered_table_list *result, bool reusable); -bool ha_table_exists(THD *thd, const LEX_CSTRING *db, - const LEX_CSTRING *table_name, - handlerton **hton= 0, bool *is_sequence= 0); -bool ha_check_if_updates_are_ignored(THD *thd, handlerton *hton, - const char *op); -#endif /* MYSQL_SERVER */ - -/* key cache */ -extern "C" int ha_init_key_cache(const char *name, KEY_CACHE *key_cache, void *); -int ha_resize_key_cache(KEY_CACHE *key_cache); -int ha_change_key_cache_param(KEY_CACHE *key_cache); -int ha_repartition_key_cache(KEY_CACHE *key_cache); -int ha_change_key_cache(KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache); - -/* transactions: interface to handlerton functions */ -int ha_start_consistent_snapshot(THD *thd); -int ha_commit_or_rollback_by_xid(XID *xid, bool commit); -int ha_commit_one_phase(THD *thd, bool all); -int ha_commit_trans(THD *thd, bool all); -int ha_rollback_trans(THD *thd, bool all); -int ha_prepare(THD *thd); -int ha_recover(HASH *commit_list); - -/* transactions: these functions never call handlerton functions directly */ -int ha_enable_transaction(THD *thd, bool on); - -/* savepoints */ -int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv); -bool ha_rollback_to_savepoint_can_release_mdl(THD *thd); -int ha_savepoint(THD *thd, SAVEPOINT *sv); -int ha_release_savepoint(THD *thd, SAVEPOINT *sv); -#ifdef WITH_WSREP -int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal); -#endif - -/* these are called by storage engines */ -void trans_register_ha(THD *thd, bool all, handlerton *ht, - ulonglong trxid); - -/* - Storage engine has to assume the transaction will end up with 2pc if - - there is more than one 2pc-capable storage engine available - - in the current transaction 2pc was not disabled yet -*/ -#define trans_need_2pc(thd, all) ((total_ha_2pc > 1) && \ - !((all ? &thd->transaction.all : &thd->transaction.stmt)->no_2pc)) - -const char *get_canonical_filename(handler *file, const char *path, - char *tmp_path); -void commit_checkpoint_notify_ha(handlerton *hton, void *cookie); - -inline const LEX_CSTRING *table_case_name(HA_CREATE_INFO *info, const LEX_CSTRING *name) -{ - return ((lower_case_table_names == 2 && info->alias.str) ? &info->alias : name); -} - -typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*); -int binlog_log_row(TABLE* table, - const uchar *before_record, - const uchar *after_record, - Log_func *log_func); - -/** - @def MYSQL_TABLE_IO_WAIT - Instrumentation helper for table io_waits. - Note that this helper is intended to be used from - within the handler class only, as it uses members - from @c handler - Performance schema events are instrumented as follows: - - in non batch mode, one event is generated per call - - in batch mode, the number of rows affected is saved - in @c m_psi_numrows, so that @c end_psi_batch_mode() - generates a single event for the batch. - @param OP the table operation to be performed - @param INDEX the table index used if any, or MAX_KEY. - @param PAYLOAD instrumented code to execute - @sa handler::end_psi_batch_mode. -*/ -#ifdef HAVE_PSI_TABLE_INTERFACE - #define MYSQL_TABLE_IO_WAIT(OP, INDEX, RESULT, PAYLOAD) \ - { \ - if (m_psi != NULL) \ - { \ - switch (m_psi_batch_mode) \ - { \ - case PSI_BATCH_MODE_NONE: \ - { \ - PSI_table_locker *sub_locker= NULL; \ - PSI_table_locker_state reentrant_safe_state; \ - sub_locker= PSI_TABLE_CALL(start_table_io_wait) \ - (& reentrant_safe_state, m_psi, OP, INDEX, \ - __FILE__, __LINE__); \ - PAYLOAD \ - if (sub_locker != NULL) \ - PSI_TABLE_CALL(end_table_io_wait) \ - (sub_locker, 1); \ - break; \ - } \ - case PSI_BATCH_MODE_STARTING: \ - { \ - m_psi_locker= PSI_TABLE_CALL(start_table_io_wait) \ - (& m_psi_locker_state, m_psi, OP, INDEX, \ - __FILE__, __LINE__); \ - PAYLOAD \ - if (!RESULT) \ - m_psi_numrows++; \ - m_psi_batch_mode= PSI_BATCH_MODE_STARTED; \ - break; \ - } \ - case PSI_BATCH_MODE_STARTED: \ - default: \ - { \ - DBUG_ASSERT(m_psi_batch_mode \ - == PSI_BATCH_MODE_STARTED); \ - PAYLOAD \ - if (!RESULT) \ - m_psi_numrows++; \ - break; \ - } \ - } \ - } \ - else \ - { \ - PAYLOAD \ - } \ - } -#else - #define MYSQL_TABLE_IO_WAIT(OP, INDEX, RESULT, PAYLOAD) \ - PAYLOAD -#endif - -#define TABLE_IO_WAIT(TRACKER, OP, INDEX, RESULT, PAYLOAD) \ - { \ - Exec_time_tracker *this_tracker; \ - if (unlikely((this_tracker= tracker))) \ - tracker->start_tracking(table->in_use); \ - \ - MYSQL_TABLE_IO_WAIT(OP, INDEX, RESULT, PAYLOAD); \ - \ - if (unlikely(this_tracker)) \ - tracker->stop_tracking(table->in_use); \ - } -void print_keydup_error(TABLE *table, KEY *key, const char *msg, myf errflag); -void print_keydup_error(TABLE *table, KEY *key, myf errflag); - -int del_global_index_stat(THD *thd, TABLE* table, KEY* key_info); -int del_global_table_stat(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *table); -uint ha_count_rw_all(THD *thd, Ha_trx_info **ptr_ha_info); -bool non_existing_table_error(int error); -#endif /* HANDLER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/hash.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/hash.h deleted file mode 100644 index 00ffca5..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/hash.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. - Copyright (c) 2011, 2013, Monty Program Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Dynamic hashing of record with different key-length */ - -#ifndef _hash_h -#define _hash_h - -#include "my_sys.h" /* DYNAMIC_ARRAY */ - -/* - This forward declaration is used from C files where the real - definition is included before. Since C does not allow repeated - typedef declarations, even when identical, the definition may not be - repeated. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/* - Overhead to store an element in hash - Can be used to approximate memory consumption for a hash - */ -#define HASH_OVERHEAD (sizeof(char*)*2) - -/* flags for hash_init */ -#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */ -#define HASH_THREAD_SPECIFIC 2 /* Mark allocated memory THREAD_SPECIFIC */ - -typedef uint32 my_hash_value_type; -typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool); -typedef my_hash_value_type (*my_hash_function)(CHARSET_INFO *, - const uchar *, size_t); -typedef void (*my_hash_free_key)(void *); -typedef my_bool (*my_hash_walk_action)(void *,void *); - -typedef struct st_hash { - size_t key_offset,key_length; /* Length of key if const length */ - size_t blength; - ulong records; - uint flags; - DYNAMIC_ARRAY array; /* Place for hash_keys */ - my_hash_get_key get_key; - my_hash_function hash_function; - void (*free)(void *); - CHARSET_INFO *charset; -} HASH; - -/* A search iterator state */ -typedef uint HASH_SEARCH_STATE; - -#define my_hash_init(A,B,C,D,E,F,G,H,I) my_hash_init2(A,B,0,C,D,E,F,G,0,H,I) -my_bool my_hash_init2(PSI_memory_key psi_key, HASH *hash, uint growth_size, - CHARSET_INFO *charset, ulong default_array_elements, - size_t key_offset, size_t key_length, - my_hash_get_key get_key, my_hash_function hash_function, - void (*free_element)(void*), uint flags); -void my_hash_free(HASH *tree); -void my_hash_reset(HASH *hash); -uchar *my_hash_element(HASH *hash, size_t idx); -uchar *my_hash_search(const HASH *info, const uchar *key, size_t length); -uchar *my_hash_search_using_hash_value(const HASH *info, - my_hash_value_type hash_value, - const uchar *key, size_t length); -my_hash_value_type my_hash_sort(CHARSET_INFO *cs, - const uchar *key, size_t length); -#define my_calc_hash(A, B, C) my_hash_sort((A)->charset, B, C) -uchar *my_hash_first(const HASH *info, const uchar *key, size_t length, - HASH_SEARCH_STATE *state); -uchar *my_hash_first_from_hash_value(const HASH *info, - my_hash_value_type hash_value, - const uchar *key, - size_t length, - HASH_SEARCH_STATE *state); -uchar *my_hash_next(const HASH *info, const uchar *key, size_t length, - HASH_SEARCH_STATE *state); -my_bool my_hash_insert(HASH *info, const uchar *data); -my_bool my_hash_delete(HASH *hash, uchar *record); -my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key, - size_t old_key_length); -void my_hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row); -my_bool my_hash_check(HASH *hash); /* Only in debug library */ -my_bool my_hash_iterate(HASH *hash, my_hash_walk_action action, void *argument); - -#define my_hash_clear(H) bzero((char*) (H), sizeof(*(H))) -#define my_hash_inited(H) ((H)->blength != 0) -#define my_hash_init_opt(A,B,C,D,E,F,G,H,I) \ - (!my_hash_inited(B) && my_hash_init(A,B,C,D,E,F,G,H,I)) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/hash_filo.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/hash_filo.h deleted file mode 100644 index ac84e5c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/hash_filo.h +++ /dev/null @@ -1,214 +0,0 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* -** A class for static sized hash tables where old entries are deleted in -** first-in-last-out to usage. -*/ - -#ifndef HASH_FILO_H -#define HASH_FILO_H - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class interface */ -#endif - -#include "hash.h" /* my_hash_get_key, my_hash_free_key, HASH */ -#include "m_string.h" /* bzero */ -#include "mysqld.h" /* key_hash_filo_lock */ - -class hash_filo_element -{ -private: - hash_filo_element *next_used,*prev_used; - public: - hash_filo_element() {} - hash_filo_element *next() - { return next_used; } - hash_filo_element *prev() - { return prev_used; } - - friend class hash_filo; -}; - - -class hash_filo -{ -private: - PSI_memory_key m_psi_key; - const uint key_offset, key_length; - const my_hash_get_key get_key; - /** Size of this hash table. */ - uint m_size; - my_hash_free_key free_element; - bool init; - CHARSET_INFO *hash_charset; - - hash_filo_element *first_link,*last_link; -public: - mysql_mutex_t lock; - HASH cache; - - hash_filo(PSI_memory_key psi_key, uint size_arg, uint key_offset_arg, - uint key_length_arg, my_hash_get_key get_key_arg, - my_hash_free_key free_element_arg, CHARSET_INFO *hash_charset_arg) - : m_psi_key(psi_key), key_offset(key_offset_arg), - key_length(key_length_arg), get_key(get_key_arg), m_size(size_arg), - free_element(free_element_arg),init(0), hash_charset(hash_charset_arg), - first_link(NULL), last_link(NULL) - { - bzero((char*) &cache,sizeof(cache)); - } - - ~hash_filo() - { - if (init) - { - if (cache.array.buffer) /* Avoid problems with thread library */ - (void) my_hash_free(&cache); - mysql_mutex_destroy(&lock); - } - } - void clear(bool locked=0) - { - if (!init) - { - init=1; - mysql_mutex_init(key_hash_filo_lock, &lock, MY_MUTEX_INIT_FAST); - } - if (!locked) - mysql_mutex_lock(&lock); - first_link= NULL; - last_link= NULL; - (void) my_hash_free(&cache); - (void) my_hash_init(m_psi_key, &cache,hash_charset,m_size,key_offset, - key_length, get_key, free_element, 0); - if (!locked) - mysql_mutex_unlock(&lock); - } - - hash_filo_element *first() - { - mysql_mutex_assert_owner(&lock); - return first_link; - } - - hash_filo_element *last() - { - mysql_mutex_assert_owner(&lock); - return last_link; - } - - hash_filo_element *search(uchar* key, size_t length) - { - mysql_mutex_assert_owner(&lock); - - hash_filo_element *entry=(hash_filo_element*) - my_hash_search(&cache,(uchar*) key,length); - if (entry) - { // Found; link it first - DBUG_ASSERT(first_link != NULL); - DBUG_ASSERT(last_link != NULL); - if (entry != first_link) - { // Relink used-chain - if (entry == last_link) - { - last_link= last_link->prev_used; - /* - The list must have at least 2 elements, - otherwise entry would be equal to first_link. - */ - DBUG_ASSERT(last_link != NULL); - last_link->next_used= NULL; - } - else - { - DBUG_ASSERT(entry->next_used != NULL); - DBUG_ASSERT(entry->prev_used != NULL); - entry->next_used->prev_used = entry->prev_used; - entry->prev_used->next_used = entry->next_used; - } - entry->prev_used= NULL; - entry->next_used= first_link; - - first_link->prev_used= entry; - first_link=entry; - } - } - return entry; - } - - bool add(hash_filo_element *entry) - { - if (!m_size) return 1; - if (cache.records == m_size) - { - hash_filo_element *tmp=last_link; - last_link= last_link->prev_used; - if (last_link != NULL) - { - last_link->next_used= NULL; - } - else - { - /* Pathological case, m_size == 1 */ - first_link= NULL; - } - my_hash_delete(&cache,(uchar*) tmp); - } - if (my_hash_insert(&cache,(uchar*) entry)) - { - if (free_element) - (*free_element)(entry); // This should never happen - return 1; - } - entry->prev_used= NULL; - entry->next_used= first_link; - if (first_link != NULL) - first_link->prev_used= entry; - else - last_link= entry; - first_link= entry; - - return 0; - } - - uint size() - { return m_size; } - - void resize(uint new_size) - { - mysql_mutex_lock(&lock); - m_size= new_size; - clear(true); - mysql_mutex_unlock(&lock); - } -}; - -template class Hash_filo: public hash_filo -{ -public: - Hash_filo(PSI_memory_key psi_key, uint size_arg, uint key_offset_arg, uint - key_length_arg, my_hash_get_key get_key_arg, my_hash_free_key - free_element_arg, CHARSET_INFO *hash_charset_arg) : - hash_filo(psi_key, size_arg, key_offset_arg, key_length_arg, - get_key_arg, free_element_arg, hash_charset_arg) {} - T* first() { return (T*)hash_filo::first(); } - T* last() { return (T*)hash_filo::last(); } - T* search(uchar* key, size_t len) { return (T*)hash_filo::search(key, len); } -}; - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/heap.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/heap.h deleted file mode 100644 index f0ac527..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/heap.h +++ /dev/null @@ -1,271 +0,0 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -/* This file should be included when using heap_database_functions */ -/* Author: Michael Widenius */ - -#ifndef _heap_h -#define _heap_h -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _my_base_h -#include -#endif - -#include -#include - -#include "my_compare.h" -#include "my_tree.h" - - /* defines used by heap-funktions */ - -#define HP_MAX_LEVELS 4 /* 128^5 records is enough */ -#define HP_PTRS_IN_NOD 128 - - /* struct used with heap_funktions */ - -typedef struct st_heapinfo /* Struct from heap_info */ -{ - ulong records; /* Records in database */ - ulong deleted; /* Deleted records in database */ - ulong max_records; - ulonglong data_length; - ulonglong index_length; - uint reclength; /* Length of one record */ - int errkey; - ulonglong auto_increment; - time_t create_time; -} HEAPINFO; - - - /* Structs used by heap-database-handler */ - -typedef struct st_heap_ptrs -{ - uchar *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */ -} HP_PTRS; - -struct st_level_info -{ - /* Number of unused slots in *last_blocks HP_PTRS block (0 for 0th level) */ - uint free_ptrs_in_block; - - /* - Maximum number of records that can be 'contained' inside of each element - of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for - level 2 - HP_PTRS_IN_NOD^2 and so forth. - */ - ulong records_under_level; - - /* - Ptr to last allocated HP_PTRS (or records buffer for level 0) on this - level. - */ - HP_PTRS *last_blocks; -}; - - -/* - Heap table records and hash index entries are stored in HP_BLOCKs. - HP_BLOCK is used as a 'growable array' of fixed-size records. Size of record - is recbuffer bytes. - The internal representation is as follows: - HP_BLOCK is a hierarchical structure of 'blocks'. - A block at level 0 is an array records_in_block records. - A block at higher level is an HP_PTRS structure with pointers to blocks at - lower levels. - At the highest level there is one top block. It is stored in HP_BLOCK::root. - - See hp_find_block for a description of how record pointer is obtained from - its index. - See hp_get_new_block -*/ - -typedef struct st_heap_block -{ - HP_PTRS *root; /* Top-level block */ - struct st_level_info level_info[HP_MAX_LEVELS+1]; - uint levels; /* number of used levels */ - uint recbuffer; /* Length of one saved record */ - ulong records_in_block; /* Records in one heap-block */ - ulong last_allocated; /* number of records there is allocated space for */ -} HP_BLOCK; - -struct st_heap_info; /* For referense */ - -typedef struct st_hp_keydef /* Key definition with open */ -{ - uint flag; /* HA_NOSAME | HA_NULL_PART_KEY */ - uint keysegs; /* Number of key-segment */ - uint length; /* Length of key (automatic) */ - uint8 algorithm; /* HASH / BTREE */ - HA_KEYSEG *seg; - HP_BLOCK block; /* Where keys are saved */ - /* - Number of buckets used in hash table. Used only to provide - #records estimates for heap key scans. - */ - ha_rows hash_buckets; - TREE rb_tree; - int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo, - const uchar *record, uchar *recpos); - int (*delete_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo, - const uchar *record, uchar *recpos, int flag); - uint (*get_key_length)(struct st_hp_keydef *keydef, const uchar *key); -} HP_KEYDEF; - -typedef struct st_heap_share -{ - HP_BLOCK block; - HP_KEYDEF *keydef; - ulonglong data_length,index_length,max_table_size; - ulonglong auto_increment; - ulong min_records,max_records; /* Params to open */ - ulong records; /* records */ - ulong blength; /* records rounded up to 2^n */ - ulong deleted; /* Deleted records in database */ - uint key_stat_version; /* version to indicate insert/delete */ - uint key_version; /* Updated on key change */ - uint file_version; /* Update on clear */ - uint reclength; /* Length of one record */ - uint visible; /* Offset to the visible/deleted mark */ - uint changed; - uint keys,max_key_length; - uint currently_disabled_keys; /* saved value from "keys" when disabled */ - uint open_count; - uchar *del_link; /* Link to next block with del. rec */ - char * name; /* Name of "memory-file" */ - time_t create_time; - THR_LOCK lock; - my_bool delete_on_close; - my_bool internal; /* Internal temporary table */ - LIST open_list; - uint auto_key; - uint auto_key_type; /* real type of the auto key segment */ -} HP_SHARE; - -struct st_hp_hash_info; - -typedef struct st_heap_info -{ - HP_SHARE *s; - uchar *current_ptr; - struct st_hp_hash_info *current_hash_ptr; - ulong current_record,next_block; - int lastinx,errkey; - int mode; /* Mode of file (READONLY..) */ - uint opt_flag,update; - uchar *lastkey; /* Last used key with rkey */ - uchar *recbuf; /* Record buffer for rb-tree keys */ - enum ha_rkey_function last_find_flag; - TREE_ELEMENT *parents[MAX_TREE_HEIGHT+1]; - TREE_ELEMENT **last_pos; - uint key_version; /* Version at last read */ - uint file_version; /* Version at scan */ - uint lastkey_len; - my_bool implicit_emptied; - THR_LOCK_DATA lock; - LIST open_list; -} HP_INFO; - - -typedef struct st_heap_create_info -{ - HP_KEYDEF *keydef; - uint auto_key; /* keynr [1 - maxkey] for auto key */ - uint auto_key_type; - uint keys; - uint reclength; - ulong max_records; - ulong min_records; - ulonglong max_table_size; - ulonglong auto_increment; - my_bool with_auto_increment; - my_bool internal_table; - /* - TRUE if heap_create should 'pin' the created share by setting - open_count to 1. Is only looked at if not internal_table. - */ - my_bool pin_share; -} HP_CREATE_INFO; - - /* Prototypes for heap-functions */ - -extern HP_INFO *heap_open(const char *name, int mode); -extern HP_INFO *heap_open_from_share(HP_SHARE *share, int mode); -extern HP_INFO *heap_open_from_share_and_register(HP_SHARE *share, int mode); -extern void heap_release_share(HP_SHARE *share, my_bool internal_table); -extern int heap_close(HP_INFO *info); -extern int heap_write(HP_INFO *info,const uchar *buff); -extern int heap_update(HP_INFO *info,const uchar *old,const uchar *newdata); -extern int heap_rrnd(HP_INFO *info,uchar *buf,uchar *pos); -extern int heap_scan_init(HP_INFO *info); -extern int heap_scan(HP_INFO *info, uchar *record); -extern int heap_delete(HP_INFO *info,const uchar *buff); -extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag); -extern int heap_create(const char *name, - HP_CREATE_INFO *create_info, HP_SHARE **share, - my_bool *created_new_share); -extern int heap_delete_table(const char *name); -extern void heap_drop_table(HP_INFO *info); -extern int heap_extra(HP_INFO *info,enum ha_extra_function function); -extern int heap_reset(HP_INFO *info); -extern int heap_rename(const char *old_name,const char *new_name); -extern int heap_panic(enum ha_panic_function flag); -extern int heap_rsame(HP_INFO *info,uchar *record,int inx); -extern int heap_rnext(HP_INFO *info,uchar *record); -extern int heap_rprev(HP_INFO *info,uchar *record); -extern int heap_rfirst(HP_INFO *info,uchar *record,int inx); -extern int heap_rlast(HP_INFO *info,uchar *record,int inx); -extern void heap_clear(HP_INFO *info); -extern void heap_clear_keys(HP_INFO *info); -extern int heap_disable_indexes(HP_INFO *info); -extern int heap_enable_indexes(HP_INFO *info); -extern int heap_indexes_are_disabled(HP_INFO *info); -extern void heap_update_auto_increment(HP_INFO *info, const uchar *record); -ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, - const key_range *min_key, - const key_range *max_key); -int hp_panic(enum ha_panic_function flag); -int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key, - key_part_map keypart_map, enum ha_rkey_function find_flag); -extern uchar * heap_find(HP_INFO *info,int inx,const uchar *key); -extern int heap_check_heap(const HP_INFO *info, my_bool print_status); -extern uchar *heap_position(HP_INFO *info); - -/* The following is for programs that uses the old HEAP interface where - pointer to rows where a long instead of a (uchar*). -*/ - -#if defined(WANT_OLD_HEAP_VERSION) || defined(OLD_HEAP_VERSION) -extern int heap_rrnd_old(HP_INFO *info,uchar *buf,ulong pos); -extern ulong heap_position_old(HP_INFO *info); -#endif -#ifdef OLD_HEAP_VERSION -typedef ulong HEAP_PTR; -#define heap_position(A) heap_position_old(A) -#define heap_rrnd(A,B,C) heap_rrnd_old(A,B,C) -#else -typedef uchar *HEAP_PTR; -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/hostname.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/hostname.h deleted file mode 100644 index 3a371dc..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/hostname.h +++ /dev/null @@ -1,183 +0,0 @@ -/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef HOSTNAME_INCLUDED -#define HOSTNAME_INCLUDED - -#include "my_net.h" -#include "hash_filo.h" - -struct Host_errors -{ -public: - Host_errors(); - ~Host_errors(); - - void reset(); - void aggregate(const Host_errors *errors); - - /** Number of connect errors. */ - ulong m_connect; - - /** Number of host blocked errors. */ - ulong m_host_blocked; - /** Number of transient errors from getnameinfo(). */ - ulong m_nameinfo_transient; - /** Number of permanent errors from getnameinfo(). */ - ulong m_nameinfo_permanent; - /** Number of errors from is_hostname_valid(). */ - ulong m_format; - /** Number of transient errors from getaddrinfo(). */ - ulong m_addrinfo_transient; - /** Number of permanent errors from getaddrinfo(). */ - ulong m_addrinfo_permanent; - /** Number of errors from Forward-Confirmed reverse DNS checks. */ - ulong m_FCrDNS; - /** Number of errors from host grants. */ - ulong m_host_acl; - /** Number of errors from missing auth plugin. */ - ulong m_no_auth_plugin; - /** Number of errors from auth plugin. */ - ulong m_auth_plugin; - /** Number of errors from authentication plugins. */ - ulong m_handshake; - /** Number of errors from proxy user. */ - ulong m_proxy_user; - /** Number of errors from proxy user acl. */ - ulong m_proxy_user_acl; - /** Number of errors from authentication. */ - ulong m_authentication; - /** Number of errors from ssl. */ - ulong m_ssl; - /** Number of errors from max user connection. */ - ulong m_max_user_connection; - /** Number of errors from max user connection per hour. */ - ulong m_max_user_connection_per_hour; - /** Number of errors from the default database. */ - ulong m_default_database; - /** Number of errors from init_connect. */ - ulong m_init_connect; - /** Number of errors from the server itself. */ - ulong m_local; - - bool has_error() const - { - return ((m_host_blocked != 0) - || (m_nameinfo_transient != 0) - || (m_nameinfo_permanent != 0) - || (m_format != 0) - || (m_addrinfo_transient != 0) - || (m_addrinfo_permanent != 0) - || (m_FCrDNS != 0) - || (m_host_acl != 0) - || (m_no_auth_plugin != 0) - || (m_auth_plugin != 0) - || (m_handshake != 0) - || (m_proxy_user != 0) - || (m_proxy_user_acl != 0) - || (m_authentication != 0) - || (m_ssl != 0) - || (m_max_user_connection != 0) - || (m_max_user_connection_per_hour != 0) - || (m_default_database != 0) - || (m_init_connect != 0) - || (m_local != 0)); - } - - void sum_connect_errors() - { - /* Current (historical) behavior: */ - m_connect= m_handshake; - } - - void clear_connect_errors() - { - m_connect= 0; - } -}; - -/** Size of IP address string in the hash cache. */ -#define HOST_ENTRY_KEY_SIZE INET6_ADDRSTRLEN - -/** - An entry in the hostname hash table cache. - - Host name cache does two things: - - caches host names to save DNS look ups; - - counts errors from IP. - - Host name can be empty (that means DNS look up failed), - but errors still are counted. -*/ -class Host_entry : public hash_filo_element -{ -public: - Host_entry *next() - { return (Host_entry*) hash_filo_element::next(); } - - /** - Client IP address. This is the key used with the hash table. - - The client IP address is always expressed in IPv6, even when the - network IPv6 stack is not present. - - This IP address is never used to connect to a socket. - */ - char ip_key[HOST_ENTRY_KEY_SIZE]; - - /** - One of the host names for the IP address. May be a zero length string. - */ - char m_hostname[HOSTNAME_LENGTH + 1]; - /** Length in bytes of @c m_hostname. */ - uint m_hostname_length; - /** The hostname is validated and used for authorization. */ - bool m_host_validated; - ulonglong m_first_seen; - ulonglong m_last_seen; - ulonglong m_first_error_seen; - ulonglong m_last_error_seen; - /** Error statistics. */ - Host_errors m_errors; - - void set_error_timestamps(ulonglong now) - { - if (m_first_error_seen == 0) - m_first_error_seen= now; - m_last_error_seen= now; - } -}; - -/** The size of the host_cache. */ -extern ulong host_cache_size; - -#define RC_OK 0 -#define RC_BLOCKED_HOST 1 -int ip_to_hostname(struct sockaddr_storage *ip_storage, - const char *ip_string, - const char **hostname, uint *connect_errors); - -void inc_host_errors(const char *ip_string, Host_errors *errors); -void reset_host_connect_errors(const char *ip_string); -bool hostname_cache_init(); -void hostname_cache_free(); -void hostname_cache_refresh(void); -uint hostname_cache_size(); -void hostname_cache_resize(uint size); -void hostname_cache_lock(); -void hostname_cache_unlock(); -Host_entry *hostname_cache_first(); - -#endif /* HOSTNAME_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ilist.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/ilist.h deleted file mode 100644 index 92812ba..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ilist.h +++ /dev/null @@ -1,267 +0,0 @@ -/* - Copyright (c) 2019, 2020, MariaDB - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -#ifndef ILIST_H -#define ILIST_H - -#include "my_dbug.h" - -#include -#include - -// Derive your class from this struct to insert to a linked list. -template struct ilist_node -{ - ilist_node() noexcept -#ifndef DBUG_OFF - : next(NULL), prev(NULL) -#endif - { - } - - ilist_node(ilist_node *next, ilist_node *prev) noexcept - : next(next), prev(prev) - { - } - - ilist_node *next; - ilist_node *prev; -}; - -// Modelled after std::list -template class ilist -{ -public: - typedef ilist_node ListNode; - class Iterator; - - // All containers in C++ should define these types to implement generic - // container interface. - typedef T value_type; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef value_type &reference; - typedef const value_type &const_reference; - typedef T *pointer; - typedef const T *const_pointer; - typedef Iterator iterator; - typedef Iterator const_iterator; /* FIXME */ - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - class Iterator - { - public: - // All iterators in C++ should define these types to implement generic - // iterator interface. - typedef std::bidirectional_iterator_tag iterator_category; - typedef T value_type; - typedef std::ptrdiff_t difference_type; - typedef T *pointer; - typedef T &reference; - - Iterator(ListNode *node) noexcept : node_(node) - { DBUG_ASSERT(node_ != nullptr); } - - Iterator &operator++() noexcept - { - node_= node_->next; - DBUG_ASSERT(node_ != nullptr); - return *this; - } - Iterator operator++(int) noexcept - { - Iterator tmp(*this); - operator++(); - return tmp; - } - - Iterator &operator--() noexcept - { - node_= node_->prev; - DBUG_ASSERT(node_ != nullptr); - return *this; - } - Iterator operator--(int) noexcept - { - Iterator tmp(*this); - operator--(); - return tmp; - } - - reference operator*() noexcept { return *static_cast(node_); } - pointer operator->() noexcept { return static_cast(node_); } - - friend bool operator==(const Iterator &lhs, const Iterator &rhs) noexcept - { - return lhs.node_ == rhs.node_; - } - friend bool operator!=(const Iterator &lhs, const Iterator &rhs) noexcept - { - return !(lhs == rhs); - } - - private: - ListNode *node_; - - friend class ilist; - }; - - ilist() noexcept : sentinel_(&sentinel_, &sentinel_) {} - - reference front() noexcept { return *begin(); } - reference back() noexcept { return *--end(); } - const_reference front() const noexcept { return *begin(); } - const_reference back() const noexcept { return *--end(); } - - iterator begin() noexcept { return iterator(sentinel_.next); } - const_iterator begin() const noexcept - { - return iterator(const_cast(sentinel_.next)); - } - iterator end() noexcept { return iterator(&sentinel_); } - const_iterator end() const noexcept - { - return iterator(const_cast(&sentinel_)); - } - - reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const noexcept - { - return reverse_iterator(end()); - } - reverse_iterator rend() noexcept { return reverse_iterator(begin()); } - const_reverse_iterator rend() const noexcept - { - return reverse_iterator(begin()); - } - - bool empty() const noexcept { return sentinel_.next == &sentinel_; } - - // Not implemented because it's O(N) - // size_type size() const - // { - // return static_cast(std::distance(begin(), end())); - // } - - void clear() noexcept - { - sentinel_.next= &sentinel_; - sentinel_.prev= &sentinel_; - } - - iterator insert(iterator pos, reference value) noexcept - { - ListNode *curr= pos.node_; - ListNode *prev= pos.node_->prev; - - prev->next= &value; - curr->prev= &value; - - static_cast(value).prev= prev; - static_cast(value).next= curr; - - return iterator(&value); - } - - iterator erase(iterator pos) noexcept - { - ListNode *prev= pos.node_->prev; - ListNode *next= pos.node_->next; - - prev->next= next; - next->prev= prev; - -#ifndef DBUG_OFF - ListNode *curr= pos.node_; - curr->prev= nullptr; - curr->next= nullptr; -#endif - - return next; - } - - void push_back(reference value) noexcept { insert(end(), value); } - void pop_back() noexcept { erase(end()); } - - void push_front(reference value) noexcept { insert(begin(), value); } - void pop_front() noexcept { erase(begin()); } - - // STL version is O(n) but this is O(1) because an element can't be inserted - // several times in the same ilist. - void remove(reference value) noexcept { erase(iterator(&value)); } - -private: - ListNode sentinel_; -}; - -// Similar to ilist but also has O(1) size() method. -template class sized_ilist : public ilist -{ - typedef ilist BASE; - -public: - // All containers in C++ should define these types to implement generic - // container interface. - typedef T value_type; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef value_type &reference; - typedef const value_type &const_reference; - typedef T *pointer; - typedef const T *const_pointer; - typedef typename BASE::Iterator iterator; - typedef const typename BASE::Iterator const_iterator; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - sized_ilist() noexcept : size_(0) {} - - size_type size() const noexcept { return size_; } - - void clear() noexcept - { - BASE::clear(); - size_= 0; - } - - iterator insert(iterator pos, reference value) noexcept - { - ++size_; - return BASE::insert(pos, value); - } - - iterator erase(iterator pos) noexcept - { - --size_; - return BASE::erase(pos); - } - - void push_back(reference value) noexcept { insert(BASE::end(), value); } - void pop_back() noexcept { erase(BASE::end()); } - - void push_front(reference value) noexcept { insert(BASE::begin(), value); } - void pop_front() noexcept { erase(BASE::begin()); } - - void remove(reference value) noexcept { erase(iterator(&value)); } - -private: - size_type size_; -}; - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/init.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/init.h deleted file mode 100644 index b9d5053..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/init.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef INIT_INCLUDED -#define INIT_INCLUDED - -void unireg_init(ulong options); - -#endif /* INIT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/innodb_priv.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/innodb_priv.h deleted file mode 100644 index bec63a8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/innodb_priv.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef INNODB_PRIV_INCLUDED -#define INNODB_PRIV_INCLUDED - -/** @file Declaring server-internal functions that are used by InnoDB. */ - -#include -#include /* strconvert */ - -class THD; - -int get_quote_char_for_identifier(THD *thd, const char *name, size_t length); -bool schema_table_store_record(THD *thd, TABLE *table); -void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); - -void sql_print_error(const char *format, ...); - -#define thd_binlog_pos(X, Y, Z) mysql_bin_log_commit_pos(X, Z, Y) - -#endif /* INNODB_PRIV_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item.h deleted file mode 100644 index fb480b4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item.h +++ /dev/null @@ -1,7502 +0,0 @@ -#ifndef SQL_ITEM_INCLUDED -#define SQL_ITEM_INCLUDED - -/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_priv.h" /* STRING_BUFFER_USUAL_SIZE */ -#include "unireg.h" -#include "sql_const.h" /* RAND_TABLE_BIT, MAX_FIELD_NAME */ -#include "field.h" /* Derivation */ -#include "sql_type.h" -#include "sql_time.h" -#include "mem_root_array.h" - -C_MODE_START -#include - -/* - A prototype for a C-compatible structure to store a value of any data type. - Currently it has to stay in /sql, as it depends on String and my_decimal. - We'll do the following changes: - 1. add pure C "struct st_string" and "struct st_my_decimal" - 2. change type of m_string to struct st_string and move inside the union - 3. change type of m_decmal to struct st_my_decimal and move inside the union - 4. move the definition to some file in /include -*/ -struct st_value -{ - enum enum_dynamic_column_type m_type; - union - { - longlong m_longlong; - double m_double; - MYSQL_TIME m_time; - } value; - String m_string; - my_decimal m_decimal; -}; - -C_MODE_END - - -class Value: public st_value -{ -public: - bool is_null() const { return m_type == DYN_COL_NULL; } - bool is_longlong() const - { - return m_type == DYN_COL_UINT || m_type == DYN_COL_INT; - } - bool is_double() const { return m_type == DYN_COL_DOUBLE; } - bool is_temporal() const { return m_type == DYN_COL_DATETIME; } - bool is_string() const { return m_type == DYN_COL_STRING; } - bool is_decimal() const { return m_type == DYN_COL_DECIMAL; } -}; - - -template -class ValueBuffer: public Value -{ - char buffer[buffer_size]; - void reset_buffer() - { - m_string.set(buffer, buffer_size, &my_charset_bin); - } -public: - ValueBuffer() - { - reset_buffer(); - } -}; - - -#ifdef DBUG_OFF -static inline const char *dbug_print_item(Item *item) { return NULL; } -#else -const char *dbug_print_item(Item *item); -#endif - -class Virtual_tmp_table; -class sp_head; -class Protocol; -struct TABLE_LIST; -void item_init(void); /* Init item functions */ -class Item_basic_value; -class Item_result_field; -class Item_field; -class Item_ref; -class Item_param; -class user_var_entry; -class JOIN; -struct KEY_FIELD; -struct SARGABLE_PARAM; -class RANGE_OPT_PARAM; -class SEL_TREE; -class With_sum_func_cache; - -enum precedence { - LOWEST_PRECEDENCE, - ASSIGN_PRECEDENCE, // := - OR_PRECEDENCE, // OR, || (unless PIPES_AS_CONCAT) - XOR_PRECEDENCE, // XOR - AND_PRECEDENCE, // AND, && - NOT_PRECEDENCE, // NOT (unless HIGH_NOT_PRECEDENCE) - CMP_PRECEDENCE, // =, <=>, >=, >, <=, <, <>, !=, IS - BETWEEN_PRECEDENCE, // BETWEEN - IN_PRECEDENCE, // IN, LIKE, REGEXP - BITOR_PRECEDENCE, // | - BITAND_PRECEDENCE, // & - SHIFT_PRECEDENCE, // <<, >> - INTERVAL_PRECEDENCE, // first argument in +INTERVAL - ADD_PRECEDENCE, // +, - - MUL_PRECEDENCE, // *, /, DIV, %, MOD - BITXOR_PRECEDENCE, // ^ - PIPES_PRECEDENCE, // || (if PIPES_AS_CONCAT) - NEG_PRECEDENCE, // unary -, ~, !, NOT (if HIGH_NOT_PRECEDENCE) - COLLATE_PRECEDENCE, // BINARY, COLLATE - DEFAULT_PRECEDENCE, - HIGHEST_PRECEDENCE -}; - -bool mark_unsupported_function(const char *where, void *store, uint result); - -/* convenience helper for mark_unsupported_function() above */ -bool mark_unsupported_function(const char *w1, const char *w2, - void *store, uint result); - -/* Bits for the split_sum_func() function */ -#define SPLIT_SUM_SKIP_REGISTERED 1 /* Skip registered funcs */ -#define SPLIT_SUM_SELECT 2 /* SELECT item; Split all parts */ - - -#define NO_EXTRACTION_FL (1 << 6) -#define FULL_EXTRACTION_FL (1 << 7) -#define DELETION_FL (1 << 8) -#define IMMUTABLE_FL (1 << 9) -#define SUBSTITUTION_FL (1 << 10) -#define EXTRACTION_MASK \ - (NO_EXTRACTION_FL | FULL_EXTRACTION_FL | DELETION_FL | IMMUTABLE_FL) - -extern const char *item_empty_name; - -void dummy_error_processor(THD *thd, void *data); - -void view_error_processor(THD *thd, void *data); - -/* - Instances of Name_resolution_context store the information necessary for - name resolution of Items and other context analysis of a query made in - fix_fields(). - - This structure is a part of SELECT_LEX, a pointer to this structure is - assigned when an item is created (which happens mostly during parsing - (sql_yacc.yy)), but the structure itself will be initialized after parsing - is complete - - TODO: move subquery of INSERT ... SELECT and CREATE ... SELECT to - separate SELECT_LEX which allow to remove tricks of changing this - structure before and after INSERT/CREATE and its SELECT to make correct - field name resolution. -*/ -struct Name_resolution_context: Sql_alloc -{ - /* - The name resolution context to search in when an Item cannot be - resolved in this context (the context of an outer select) - */ - Name_resolution_context *outer_context; - - /* - List of tables used to resolve the items of this context. Usually these - are tables from the FROM clause of SELECT statement. The exceptions are - INSERT ... SELECT and CREATE ... SELECT statements, where SELECT - subquery is not moved to a separate SELECT_LEX. For these types of - statements we have to change this member dynamically to ensure correct - name resolution of different parts of the statement. - */ - TABLE_LIST *table_list; - /* - In most cases the two table references below replace 'table_list' above - for the purpose of name resolution. The first and last name resolution - table references allow us to search only in a sub-tree of the nested - join tree in a FROM clause. This is needed for NATURAL JOIN, JOIN ... USING - and JOIN ... ON. - */ - TABLE_LIST *first_name_resolution_table; - /* - Last table to search in the list of leaf table references that begins - with first_name_resolution_table. - */ - TABLE_LIST *last_name_resolution_table; - - /* Cache first_name_resolution_table in setup_natural_join_row_types */ - TABLE_LIST *natural_join_first_table; - /* - SELECT_LEX item belong to, in case of merged VIEW it can differ from - SELECT_LEX where item was created, so we can't use table_list/field_list - from there - */ - st_select_lex *select_lex; - - /* - Processor of errors caused during Item name resolving, now used only to - hide underlying tables in errors about views (i.e. it substitute some - errors for views) - */ - void (*error_processor)(THD *, void *); - void *error_processor_data; - - /* - When TRUE items are resolved in this context both against the - SELECT list and this->table_list. If FALSE, items are resolved - only against this->table_list. - */ - bool resolve_in_select_list; - - /* - Security context of this name resolution context. It's used for views - and is non-zero only if the view is defined with SQL SECURITY DEFINER. - */ - Security_context *security_ctx; - - Name_resolution_context() - :outer_context(0), table_list(0), select_lex(0), - error_processor_data(0), - security_ctx(0) - {} - - void init() - { - resolve_in_select_list= FALSE; - error_processor= &dummy_error_processor; - first_name_resolution_table= NULL; - last_name_resolution_table= NULL; - } - - void resolve_in_table_list_only(TABLE_LIST *tables) - { - table_list= first_name_resolution_table= tables; - resolve_in_select_list= FALSE; - } - - void process_error(THD *thd) - { - (*error_processor)(thd, error_processor_data); - } - st_select_lex *outer_select() - { - return (outer_context ? - outer_context->select_lex : - NULL); - } -}; - - -/* - Store and restore the current state of a name resolution context. -*/ - -class Name_resolution_context_state -{ -private: - TABLE_LIST *save_table_list; - TABLE_LIST *save_first_name_resolution_table; - TABLE_LIST *save_next_name_resolution_table; - bool save_resolve_in_select_list; - TABLE_LIST *save_next_local; - -public: - Name_resolution_context_state() {} /* Remove gcc warning */ - -public: - /* Save the state of a name resolution context. */ - void save_state(Name_resolution_context *context, TABLE_LIST *table_list) - { - save_table_list= context->table_list; - save_first_name_resolution_table= context->first_name_resolution_table; - save_resolve_in_select_list= context->resolve_in_select_list; - save_next_local= table_list->next_local; - save_next_name_resolution_table= table_list->next_name_resolution_table; - } - - /* Restore a name resolution context from saved state. */ - void restore_state(Name_resolution_context *context, TABLE_LIST *table_list) - { - table_list->next_local= save_next_local; - table_list->next_name_resolution_table= save_next_name_resolution_table; - context->table_list= save_table_list; - context->first_name_resolution_table= save_first_name_resolution_table; - context->resolve_in_select_list= save_resolve_in_select_list; - } - - TABLE_LIST *get_first_name_resolution_table() - { - return save_first_name_resolution_table; - } -}; - -class Name_resolution_context_backup -{ - Name_resolution_context &ctx; - TABLE_LIST &table_list; - table_map save_map; - Name_resolution_context_state ctx_state; - -public: - Name_resolution_context_backup(Name_resolution_context &_ctx, TABLE_LIST &_table_list) - : ctx(_ctx), table_list(_table_list), save_map(_table_list.map) - { - ctx_state.save_state(&ctx, &table_list); - ctx.table_list= &table_list; - ctx.first_name_resolution_table= &table_list; - } - ~Name_resolution_context_backup() - { - ctx_state.restore_state(&ctx, &table_list); - table_list.map= save_map; - } -}; - - -/* - This enum is used to report information about monotonicity of function - represented by Item* tree. - Monotonicity is defined only for Item* trees that represent table - partitioning expressions (i.e. have no subselects/user vars/PS parameters - etc etc). An Item* tree is assumed to have the same monotonicity properties - as its corresponding function F: - - [signed] longlong F(field1, field2, ...) { - put values of field_i into table record buffer; - return item->val_int(); - } - - NOTE - At the moment function monotonicity is not well defined (and so may be - incorrect) for Item trees with parameters/return types that are different - from INT_RESULT, may be NULL, or are unsigned. - It will be possible to address this issue once the related partitioning bugs - (BUG#16002, BUG#15447, BUG#13436) are fixed. - - The NOT_NULL enums are used in TO_DAYS, since TO_DAYS('2001-00-00') returns - NULL which puts those rows into the NULL partition, but - '2000-12-31' < '2001-00-00' < '2001-01-01'. So special handling is needed - for this (see Bug#20577). -*/ - -typedef enum monotonicity_info -{ - NON_MONOTONIC, /* none of the below holds */ - MONOTONIC_INCREASING, /* F() is unary and (x < y) => (F(x) <= F(y)) */ - MONOTONIC_INCREASING_NOT_NULL, /* But only for valid/real x and y */ - MONOTONIC_STRICT_INCREASING,/* F() is unary and (x < y) => (F(x) < F(y)) */ - MONOTONIC_STRICT_INCREASING_NOT_NULL /* But only for valid/real x and y */ -} enum_monotonicity_info; - -/*************************************************************************/ - -class sp_rcontext; - -/** - A helper class to collect different behavior of various kinds of SP variables: - - local SP variables and SP parameters - - PACKAGE BODY routine variables - - (there will be more kinds in the future) -*/ - -class Sp_rcontext_handler -{ -public: - virtual ~Sp_rcontext_handler() {} - /** - A prefix used for SP variable names in queries: - - EXPLAIN EXTENDED - - SHOW PROCEDURE CODE - Local variables and SP parameters have empty prefixes. - Package body variables are marked with a special prefix. - This improves readability of the output of these queries, - especially when a local variable or a parameter has the same - name with a package body variable. - */ - virtual const LEX_CSTRING *get_name_prefix() const= 0; - /** - At execution time THD->spcont points to the run-time context (sp_rcontext) - of the currently executed routine. - Local variables store their data in the sp_rcontext pointed by thd->spcont. - Package body variables store data in separate sp_rcontext that belongs - to the package. - This method provides access to the proper sp_rcontext structure, - depending on the SP variable kind. - */ - virtual sp_rcontext *get_rcontext(sp_rcontext *ctx) const= 0; -}; - - -class Sp_rcontext_handler_local: public Sp_rcontext_handler -{ -public: - const LEX_CSTRING *get_name_prefix() const; - sp_rcontext *get_rcontext(sp_rcontext *ctx) const; -}; - - -class Sp_rcontext_handler_package_body: public Sp_rcontext_handler -{ -public: - const LEX_CSTRING *get_name_prefix() const; - sp_rcontext *get_rcontext(sp_rcontext *ctx) const; -}; - - -extern MYSQL_PLUGIN_IMPORT - Sp_rcontext_handler_local sp_rcontext_handler_local; - - -extern MYSQL_PLUGIN_IMPORT - Sp_rcontext_handler_package_body sp_rcontext_handler_package_body; - - - -class Item_equal; - -struct st_join_table* const NO_PARTICULAR_TAB= (struct st_join_table*)0x1; - -typedef struct replace_equal_field_arg -{ - Item_equal *item_equal; - struct st_join_table *context_tab; -} REPLACE_EQUAL_FIELD_ARG; - -class Settable_routine_parameter -{ -public: - /* - Set required privileges for accessing the parameter. - - SYNOPSIS - set_required_privilege() - rw if 'rw' is true then we are going to read and set the - parameter, so SELECT and UPDATE privileges might be - required, otherwise we only reading it and SELECT - privilege might be required. - */ - Settable_routine_parameter() {} - virtual ~Settable_routine_parameter() {} - virtual void set_required_privilege(bool rw) {}; - - /* - Set parameter value. - - SYNOPSIS - set_value() - thd thread handle - ctx context to which parameter belongs (if it is local - variable). - it item which represents new value - - RETURN - FALSE if parameter value has been set, - TRUE if error has occurred. - */ - virtual bool set_value(THD *thd, sp_rcontext *ctx, Item **it)= 0; - - virtual void set_out_param_info(Send_field *info) {} - - virtual const Send_field *get_out_param_info() const - { return NULL; } - - virtual Item_param *get_item_param() { return 0; } -}; - - -/* - A helper class to calculate offset and length of a query fragment - - outside of SP - - inside an SP - - inside a compound block -*/ -class Query_fragment -{ - uint m_pos; - uint m_length; - void set(size_t pos, size_t length) - { - DBUG_ASSERT(pos < UINT_MAX32); - DBUG_ASSERT(length < UINT_MAX32); - m_pos= (uint) pos; - m_length= (uint) length; - } -public: - Query_fragment(THD *thd, sp_head *sphead, const char *start, const char *end); - uint pos() const { return m_pos; } - uint length() const { return m_length; } -}; - - -/** - This is used for items in the query that needs to be rewritten - before binlogging - - At the moment this applies to Item_param and Item_splocal -*/ -class Rewritable_query_parameter -{ - public: - /* - Offset inside the query text. - Value of 0 means that this object doesn't have to be replaced - (for example SP variables in control statements) - */ - my_ptrdiff_t pos_in_query; - - /* - Byte length of parameter name in the statement. This is not - Item::name.length because name.length contains byte length of UTF8-encoded - name, but the query string is in the client charset. - */ - uint len_in_query; - - bool limit_clause_param; - - Rewritable_query_parameter(uint pos_in_q= 0, uint len_in_q= 0) - : pos_in_query(pos_in_q), len_in_query(len_in_q), - limit_clause_param(false) - { } - - virtual ~Rewritable_query_parameter() { } - - virtual bool append_for_log(THD *thd, String *str) = 0; -}; - -class Copy_query_with_rewrite -{ - THD *thd; - const char *src; - size_t src_len, from; - String *dst; - - bool copy_up_to(size_t bytes) - { - DBUG_ASSERT(bytes >= from); - return dst->append(src + from, uint32(bytes - from)); - } - -public: - - Copy_query_with_rewrite(THD *t, const char *s, size_t l, String *d) - :thd(t), src(s), src_len(l), from(0), dst(d) { } - - bool append(Rewritable_query_parameter *p) - { - if (copy_up_to(p->pos_in_query) || p->append_for_log(thd, dst)) - return true; - from= p->pos_in_query + p->len_in_query; - return false; - } - - bool finalize() - { return copy_up_to(src_len); } -}; - -struct st_dyncall_create_def -{ - Item *key, *value; - CHARSET_INFO *cs; - uint len, frac; - DYNAMIC_COLUMN_TYPE type; -}; - -typedef struct st_dyncall_create_def DYNCALL_CREATE_DEF; - - -typedef bool (Item::*Item_processor) (void *arg); -/* - Analyzer function - SYNOPSIS - argp in/out IN: Analysis parameter - OUT: Parameter to be passed to the transformer - - RETURN - TRUE Invoke the transformer - FALSE Don't do it - -*/ -typedef bool (Item::*Item_analyzer) (uchar **argp); -typedef Item* (Item::*Item_transformer) (THD *thd, uchar *arg); -typedef void (*Cond_traverser) (const Item *item, void *arg); -typedef bool (Item::*Pushdown_checker) (uchar *arg); - -struct st_cond_statistic; - -struct find_selective_predicates_list_processor_data -{ - TABLE *table; - List list; -}; - -class MY_LOCALE; - -class Item_equal; -class COND_EQUAL; - -class st_select_lex_unit; - -class Item_func_not; -class Item_splocal; - -/* Item::common_flags */ -/* Indicates that name of this Item autogenerated or set by user */ -#define IS_AUTO_GENERATED_NAME 1 -/* Indicates that this item is in CYCLE clause of WITH */ -#define IS_IN_WITH_CYCLE 2 - - -/** - String_copier that sends Item specific warnings. -*/ -class String_copier_for_item: public String_copier -{ - THD *m_thd; -public: - bool copy_with_warn(CHARSET_INFO *dstcs, String *dst, - CHARSET_INFO *srccs, const char *src, - uint32 src_length, uint32 nchars); - String_copier_for_item(THD *thd): m_thd(thd) { } -}; - - -/** - A helper class describing what kind of Item created a temporary field. - - If m_field is set, then the temporary field was created from Field - (e.g. when the Item was Item_field, or Item_ref pointing to Item_field) - - If m_default_field is set, then there is a usable DEFAULT value. - (e.g. when the Item is Item_field) - - If m_item_result_field is set, then the temporary field was created - from certain sub-types of Item_result_field (e.g. Item_func) - See create_tmp_field() in sql_select.cc for details. -*/ - -class Tmp_field_src -{ - Field *m_field; - Field *m_default_field; - Item_result_field *m_item_result_field; -public: - Tmp_field_src() - :m_field(0), - m_default_field(0), - m_item_result_field(0) - { } - Field *field() const { return m_field; } - Field *default_field() const { return m_default_field; } - Item_result_field *item_result_field() const { return m_item_result_field; } - void set_field(Field *field) { m_field= field; } - void set_default_field(Field *field) { m_default_field= field; } - void set_item_result_field(Item_result_field *item) - { m_item_result_field= item; } -}; - - -/** - Parameters for create_tmp_field_ex(). - See create_tmp_field() in sql_select.cc for details. -*/ - -class Tmp_field_param -{ - bool m_group; - bool m_modify_item; - bool m_table_cant_handle_bit_fields; - bool m_make_copy_field; -public: - Tmp_field_param(bool group, - bool modify_item, - bool table_cant_handle_bit_fields, - bool make_copy_field) - :m_group(group), - m_modify_item(modify_item), - m_table_cant_handle_bit_fields(table_cant_handle_bit_fields), - m_make_copy_field(make_copy_field) - { } - bool group() const { return m_group; } - bool modify_item() const { return m_modify_item; } - bool table_cant_handle_bit_fields() const - { return m_table_cant_handle_bit_fields; } - bool make_copy_field() const { return m_make_copy_field; } - void set_modify_item(bool to) { m_modify_item= to; } -}; - - -class Item_const -{ -public: - virtual ~Item_const() {} - virtual const Type_all_attributes *get_type_all_attributes_from_const() const= 0; - virtual bool const_is_null() const { return false; } - virtual const longlong *const_ptr_longlong() const { return NULL; } - virtual const double *const_ptr_double() const { return NULL; } - virtual const my_decimal *const_ptr_my_decimal() const { return NULL; } - virtual const MYSQL_TIME *const_ptr_mysql_time() const { return NULL; } - virtual const String *const_ptr_string() const { return NULL; } -}; - - -/****************************************************************************/ - -#define STOP_PTR ((void *) 1) - -class Item: public Value_source, - public Type_all_attributes -{ - /** - The index in the JOIN::join_tab array of the JOIN_TAB this Item is attached - to. Items are attached (or 'pushed') to JOIN_TABs during optimization by the - make_cond_for_table procedure. During query execution, this item is - evaluated when the join loop reaches the corresponding JOIN_TAB. - - If the value of join_tab_idx >= MAX_TABLES, this means that there is no - corresponding JOIN_TAB. - */ - uint join_tab_idx; - - static void *operator new(size_t size); - -public: - static void *operator new(size_t size, MEM_ROOT *mem_root) throw () - { return alloc_root(mem_root, size); } - static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); } - static void operator delete(void *ptr, MEM_ROOT *mem_root) {} - - enum Type {FIELD_ITEM= 0, FUNC_ITEM, SUM_FUNC_ITEM, - WINDOW_FUNC_ITEM, - /* - NOT NULL literal-alike constants, which do not change their - value during an SQL statement execution, but can optionally - change their value between statements: - - Item_literal - real NOT NULL constants - - Item_param - can change between statements - - Item_splocal - can change between statements - - Item_user_var_as_out_param - hack - Note, Item_user_var_as_out_param actually abuses the type code. - It should be moved out of the Item tree eventually. - */ - CONST_ITEM, - NULL_ITEM, // Item_null or Item_param bound to NULL - COPY_STR_ITEM, FIELD_AVG_ITEM, DEFAULT_VALUE_ITEM, - CONTEXTUALLY_TYPED_VALUE_ITEM, - PROC_ITEM,COND_ITEM, REF_ITEM, FIELD_STD_ITEM, - FIELD_VARIANCE_ITEM, INSERT_VALUE_ITEM, - SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM, TYPE_HOLDER, - PARAM_ITEM, TRIGGER_FIELD_ITEM, - EXPR_CACHE_ITEM}; - - enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; - - enum traverse_order { POSTFIX, PREFIX }; - - /* Cache of the result of is_expensive(). */ - int8 is_expensive_cache; - - /* Reuse size, only used by SP local variable assignment, otherwise 0 */ - uint rsize; - -protected: - /* - str_values's main purpose is to be used to cache the value in - save_in_field - */ - String str_value; - - SEL_TREE *get_mm_tree_for_const(RANGE_OPT_PARAM *param); - - /** - Create a field based on the exact data type handler. - */ - Field *create_table_field_from_handler(MEM_ROOT *root, TABLE *table) - { - const Type_handler *h= type_handler(); - return h->make_and_init_table_field(root, &name, - Record_addr(maybe_null), - *this, table); - } - /** - Create a field based on field_type of argument. - This is used to create a field for - - IFNULL(x,something) - - time functions - - prepared statement placeholders - - SP variables with data type references: DECLARE a TYPE OF t1.a; - @retval NULL error - @retval !NULL on success - */ - Field *tmp_table_field_from_field_type(MEM_ROOT *root, TABLE *table) - { - DBUG_ASSERT(is_fixed()); - const Type_handler *h= type_handler()->type_handler_for_tmp_table(this); - return h->make_and_init_table_field(root, &name, - Record_addr(maybe_null), - *this, table); - } - /** - Create a temporary field for a simple Item, which does not - need any special action after the field creation: - - is not an Item_field descendant (and not a reference to Item_field) - - is not an Item_result_field descendant - - does not need to copy any DEFAULT value to the result Field - - does not need to set Field::is_created_from_null_item for the result - See create_tmp_field_ex() for details on parameters and return values. - */ - Field *create_tmp_field_ex_simple(MEM_ROOT *root, - TABLE *table, - Tmp_field_src *src, - const Tmp_field_param *param) - { - DBUG_ASSERT(!param->make_copy_field()); - DBUG_ASSERT(!is_result_field()); - DBUG_ASSERT(type() != NULL_ITEM); - return tmp_table_field_from_field_type(root, table); - } - Field *create_tmp_field_int(MEM_ROOT *root, TABLE *table, - uint convert_int_length); - Field *tmp_table_field_from_field_type_maybe_null(MEM_ROOT *root, - TABLE *table, - Tmp_field_src *src, - const Tmp_field_param *param, - bool is_explicit_null); - - void raise_error_not_evaluable(); - void push_note_converted_to_negative_complement(THD *thd); - void push_note_converted_to_positive_complement(THD *thd); - - /* Helper methods, to get an Item value from another Item */ - double val_real_from_item(Item *item) - { - DBUG_ASSERT(is_fixed()); - double value= item->val_real(); - null_value= item->null_value; - return value; - } - longlong val_int_from_item(Item *item) - { - DBUG_ASSERT(is_fixed()); - longlong value= item->val_int(); - null_value= item->null_value; - return value; - } - String *val_str_from_item(Item *item, String *str) - { - DBUG_ASSERT(is_fixed()); - String *res= item->val_str(str); - if (res) - res->set_charset(collation.collation); - if ((null_value= item->null_value)) - res= NULL; - return res; - } - bool val_native_from_item(THD *thd, Item *item, Native *to) - { - DBUG_ASSERT(is_fixed()); - null_value= item->val_native(thd, to); - DBUG_ASSERT(null_value == item->null_value); - return null_value; - } - bool val_native_from_field(Field *field, Native *to) - { - if ((null_value= field->is_null())) - return true; - return (null_value= field->val_native(to)); - } - bool val_native_with_conversion_from_item(THD *thd, Item *item, Native *to, - const Type_handler *handler) - { - DBUG_ASSERT(is_fixed()); - return null_value= item->val_native_with_conversion(thd, to, handler); - } - my_decimal *val_decimal_from_item(Item *item, my_decimal *decimal_value) - { - DBUG_ASSERT(is_fixed()); - my_decimal *value= item->val_decimal(decimal_value); - if ((null_value= item->null_value)) - value= NULL; - return value; - } - bool get_date_from_item(THD *thd, Item *item, - MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - bool rc= item->get_date(thd, ltime, fuzzydate); - null_value= MY_TEST(rc || item->null_value); - return rc; - } -public: - - /* - Cache val_str() into the own buffer, e.g. to evaluate constant - expressions with subqueries in the ORDER/GROUP clauses. - */ - String *val_str() { return val_str(&str_value); } - virtual Item_func *get_item_func() { return NULL; } - - const MY_LOCALE *locale_from_val_str(); - - LEX_CSTRING name; /* Name of item */ - /* Original item name (if it was renamed)*/ - const char *orig_name; - /** - Intrusive list pointer for free list. If not null, points to the next - Item on some Query_arena's free list. For instance, stored procedures - have their own Query_arena's. - - @see Query_arena::free_list - */ - Item *next; - int marker; - bool maybe_null; /* If item may be null */ - bool in_rollup; /* If used in GROUP BY list - of a query with ROLLUP */ - bool null_value; /* if item is null */ - bool with_param; /* True if contains an SP parameter */ - bool with_window_func; /* True if item contains a window func */ - /** - True if any item except Item_sum contains a field. Set during parsing. - */ - bool with_field; - uint8 common_flags; - bool is_autogenerated_name() - { return (common_flags & IS_AUTO_GENERATED_NAME); } - // alloc & destruct is done as start of select on THD::mem_root - Item(THD *thd); - /* - Constructor used by Item_field, Item_ref & aggregate (sum) functions. - Used for duplicating lists in processing queries with temporary - tables - Also it used for Item_cond_and/Item_cond_or for creating - top AND/OR structure of WHERE clause to protect it of - optimisation changes in prepared statements - */ - Item(THD *thd, Item *item); - virtual ~Item() - { -#ifdef EXTRA_DEBUG - name.str= 0; - name.length= 0; -#endif - } /*lint -e1509 */ - void set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs); - void set_name(THD *thd, String *str) - { - set_name(thd, str->ptr(), str->length(), str->charset()); - } - void set_name(THD *thd, const LEX_CSTRING &str, - CHARSET_INFO *cs= system_charset_info) - { - set_name(thd, str.str, str.length, cs); - } - void set_name_no_truncate(THD *thd, const char *str, uint length, - CHARSET_INFO *cs); - void init_make_send_field(Send_field *tmp_field, const Type_handler *h); - virtual void cleanup(); - virtual void make_send_field(THD *thd, Send_field *field); - - bool fix_fields_if_needed(THD *thd, Item **ref) - { - return is_fixed() ? false : fix_fields(thd, ref); - } - bool fix_fields_if_needed_for_scalar(THD *thd, Item **ref) - { - return fix_fields_if_needed(thd, ref) || check_cols(1); - } - bool fix_fields_if_needed_for_bool(THD *thd, Item **ref) - { - return fix_fields_if_needed_for_scalar(thd, ref); - } - bool fix_fields_if_needed_for_order_by(THD *thd, Item **ref) - { - return fix_fields_if_needed_for_scalar(thd, ref); - } - /* - By default we assume that an Item is fixed by the contstructor. - */ - virtual bool fix_fields(THD *, Item **) - { - /* - This should not normally be called, because usually before - fix_fields() we check is_fixed() to be false. - But historically we allow fix_fields() to be called for Items - who return basic_const_item()==true. - */ - DBUG_ASSERT(is_fixed()); - DBUG_ASSERT(basic_const_item()); - return false; - } - virtual bool is_fixed() const { return true; } - virtual void unfix_fields() - { - DBUG_ASSERT(0); - } - - /* - Fix after some tables has been pulled out. Basically re-calculate all - attributes that are dependent on the tables. - */ - virtual void fix_after_pullout(st_select_lex *new_parent, Item **ref, - bool merge) - {}; - - /* - This method should be used in case where we are sure that we do not need - complete fix_fields() procedure. - Usually this method is used by the optimizer when it has to create a new - item out of other already fixed items. For example, if the optimizer has - to create a new Item_func for an inferred equality whose left and right - parts are already fixed items. In some cases the optimizer cannot use - directly fixed items as the arguments of the created functional item, - but rather uses intermediate type conversion items. Then the method is - supposed to be applied recursively. - */ - virtual void quick_fix_field() - { - DBUG_ASSERT(0); - } - - bool save_in_value(THD *thd, struct st_value *value) - { - return type_handler()->Item_save_in_value(thd, this, value); - } - - /* Function returns 1 on overflow and -1 on fatal errors */ - int save_in_field_no_warnings(Field *field, bool no_conversions); - virtual int save_in_field(Field *field, bool no_conversions); - virtual bool save_in_param(THD *thd, Item_param *param); - virtual void save_org_in_field(Field *field, - fast_field_copier data - __attribute__ ((__unused__))) - { (void) save_in_field(field, 1); } - virtual fast_field_copier setup_fast_field_copier(Field *field) - { return NULL; } - virtual int save_safe_in_field(Field *field) - { return save_in_field(field, 1); } - virtual bool send(Protocol *protocol, st_value *buffer) - { - return type_handler()->Item_send(this, protocol, buffer); - } - virtual bool eq(const Item *, bool binary_cmp) const; - enum_field_types field_type() const - { - return type_handler()->field_type(); - } - virtual const Type_handler *type_handler() const= 0; - /** - Detects if an Item has a fixed data type which is known - even before fix_fields(). - Currently it's important only to find Items with a fixed boolean - data type. More item types can be marked in the future as having - a fixed data type (e.g. all literals, all fixed type functions, etc). - - @retval NULL if the Item type is not known before fix_fields() - @retval the pointer to the data type handler, if the data type - is known before fix_fields(). - */ - virtual const Type_handler *fixed_type_handler() const - { - return NULL; - } - const Type_handler *type_handler_for_comparison() const - { - return type_handler()->type_handler_for_comparison(); - } - virtual const Type_handler *real_type_handler() const - { - return type_handler(); - } - const Type_handler *cast_to_int_type_handler() const - { - return real_type_handler()->cast_to_int_type_handler(); - } - /* result_type() of an item specifies how the value should be returned */ - Item_result result_type() const - { - return type_handler()->result_type(); - } - /* ... while cmp_type() specifies how it should be compared */ - Item_result cmp_type() const - { - return type_handler()->cmp_type(); - } - const Type_handler *string_type_handler() const - { - return Type_handler::string_type_handler(max_length); - } - /* - Calculate the maximum length of an expression. - This method is used in data type aggregation for UNION, e.g.: - SELECT 'b' UNION SELECT COALESCE(double_10_3_field) FROM t1; - - The result is usually equal to max_length, except for some numeric types. - In case of the INT, FLOAT, DOUBLE data types Item::max_length and - Item::decimals are ignored, so the returned value depends only on the - data type itself. E.g. for an expression of the DOUBLE(10,3) data type, - the result is always 53 (length 10 and precision 3 do not matter). - - max_length is ignored for these numeric data types because the length limit - means only "expected maximum length", it is not a hard limit, so it does - not impose any data truncation. E.g. a column of the type INT(4) can - normally store big values up to 2147483647 without truncation. When we're - aggregating such column for UNION it's important to create a long enough - result column, not to lose any data. - - For detailed behaviour of various data types see implementations of - the corresponding Type_handler_xxx::max_display_length(). - - Note, Item_field::max_display_length() overrides this to get - max_display_length() from the underlying field. - */ - virtual uint32 max_display_length() const - { - return type_handler()->max_display_length(this); - } - const TYPELIB *get_typelib() const { return NULL; } - void set_maybe_null(bool maybe_null_arg) { maybe_null= maybe_null_arg; } - void set_typelib(const TYPELIB *typelib) - { - // Non-field Items (e.g. hybrid functions) never have ENUM/SET types yet. - DBUG_ASSERT(0); - } - Item_cache* get_cache(THD *thd) const - { - return type_handler()->Item_get_cache(thd, this); - } - virtual enum Type type() const =0; - bool is_of_type(Type t, Item_result cmp) const - { - return type() == t && cmp_type() == cmp; - } - /* - real_type() is the type of base item. This is same as type() for - most items, except Item_ref() and Item_cache_wrapper() where it - shows the type for the underlying item. - */ - virtual enum Type real_type() const { return type(); } - - /* - Return information about function monotonicity. See comment for - enum_monotonicity_info for details. This function can only be called - after fix_fields() call. - */ - virtual enum_monotonicity_info get_monotonicity_info() const - { return NON_MONOTONIC; } - - /* - Convert "func_arg $CMP$ const" half-interval into "FUNC(func_arg) $CMP2$ const2" - - SYNOPSIS - val_int_endpoint() - left_endp FALSE <=> The interval is "x < const" or "x <= const" - TRUE <=> The interval is "x > const" or "x >= const" - - incl_endp IN FALSE <=> the comparison is '<' or '>' - TRUE <=> the comparison is '<=' or '>=' - OUT The same but for the "F(x) $CMP$ F(const)" comparison - - DESCRIPTION - This function is defined only for unary monotonic functions. The caller - supplies the source half-interval - - x $CMP$ const - - The value of const is supplied implicitly as the value this item's - argument, the form of $CMP$ comparison is specified through the - function's arguments. The calle returns the result interval - - F(x) $CMP2$ F(const) - - passing back F(const) as the return value, and the form of $CMP2$ - through the out parameter. NULL values are assumed to be comparable and - be less than any non-NULL values. - - RETURN - The output range bound, which equal to the value of val_int() - - If the value of the function is NULL then the bound is the - smallest possible value of LONGLONG_MIN - */ - virtual longlong val_int_endpoint(bool left_endp, bool *incl_endp) - { DBUG_ASSERT(0); return 0; } - - - /* valXXX methods must return NULL or 0 or 0.0 if null_value is set. */ - /* - Return double precision floating point representation of item. - - SYNOPSIS - val_real() - - RETURN - In case of NULL value return 0.0 and set null_value flag to TRUE. - If value is not null null_value flag will be reset to FALSE. - */ - virtual double val_real()=0; - Double_null to_double_null() - { - // val_real() must be caleed on a separate line. See to_longlong_null() - double nr= val_real(); - return Double_null(nr, null_value); - } - /* - Return integer representation of item. - - SYNOPSIS - val_int() - - RETURN - In case of NULL value return 0 and set null_value flag to TRUE. - If value is not null null_value flag will be reset to FALSE. - */ - virtual longlong val_int()=0; - Longlong_hybrid to_longlong_hybrid() - { - return Longlong_hybrid(val_int(), unsigned_flag); - } - Longlong_null to_longlong_null() - { - longlong nr= val_int(); - /* - C++ does not guarantee the order of parameter evaluation, - so to make sure "null_value" is passed to the constructor - after the val_int() call, val_int() is caled on a separate line. - */ - return Longlong_null(nr, null_value); - } - Longlong_hybrid_null to_longlong_hybrid_null() - { - return Longlong_hybrid_null(to_longlong_null(), unsigned_flag); - } - /** - Get a value for CAST(x AS SIGNED). - Too large positive unsigned integer values are converted - to negative complements. - Values of non-integer data types are adjusted to the SIGNED range. - */ - virtual longlong val_int_signed_typecast() - { - return cast_to_int_type_handler()->Item_val_int_signed_typecast(this); - } - longlong val_int_signed_typecast_from_str(); - /** - Get a value for CAST(x AS UNSIGNED). - Negative signed integer values are converted - to positive complements. - Values of non-integer data types are adjusted to the UNSIGNED range. - */ - virtual longlong val_int_unsigned_typecast() - { - return cast_to_int_type_handler()->Item_val_int_unsigned_typecast(this); - } - longlong val_int_unsigned_typecast_from_int(); - longlong val_int_unsigned_typecast_from_str(); - longlong val_int_unsigned_typecast_from_real(); - - /** - Get a value for CAST(x AS UNSIGNED). - Huge positive unsigned values are converted to negative complements. - */ - longlong val_int_signed_typecast_from_int(); - longlong val_int_signed_typecast_from_real(); - - /* - This is just a shortcut to avoid the cast. You should still use - unsigned_flag to check the sign of the item. - */ - inline ulonglong val_uint() { return (ulonglong) val_int(); } - - /* - Return string representation of this item object. - - SYNOPSIS - val_str() - str an allocated buffer this or any nested Item object can use to - store return value of this method. - - NOTE - The caller can modify the returned String, if it's not marked - "const" (with the String::mark_as_const() method). That means that - if the item returns its own internal buffer (e.g. tmp_value), it - *must* be marked "const" [1]. So normally it's preferable to - return the result value in the String, that was passed as an - argument. But, for example, SUBSTR() returns a String that simply - points into the buffer of SUBSTR()'s args[0]->val_str(). Such a - String is always "const", so it's ok to use tmp_value for that and - avoid reallocating/copying of the argument String. - - [1] consider SELECT CONCAT(f, ":", f) FROM (SELECT func() AS f); - here the return value of f() is used twice in the top-level - select, and if they share the same tmp_value buffer, modifying the - first one will implicitly modify the second too. - - RETURN - In case of NULL value return 0 (NULL pointer) and set null_value flag - to TRUE. - If value is not null null_value flag will be reset to FALSE. - */ - virtual String *val_str(String *str)=0; - - - bool val_native_with_conversion(THD *thd, Native *to, const Type_handler *th) - { - return th->Item_val_native_with_conversion(thd, this, to); - } - bool val_native_with_conversion_result(THD *thd, Native *to, - const Type_handler *th) - { - return th->Item_val_native_with_conversion_result(thd, this, to); - } - - virtual bool val_native(THD *thd, Native *to) - { - /* - The default implementation for the Items that do not need native format: - - Item_basic_value (default implementation) - - Item_copy - - Item_exists_subselect - - Item_sum_field - - Item_sum_or_func (default implementation) - - Item_proc - - Item_type_holder (as val_xxx() are never called for it); - - These hybrid Item types override val_native(): - - Item_field - - Item_param - - Item_sp_variable - - Item_ref - - Item_cache_wrapper - - Item_direct_ref - - Item_direct_view_ref - - Item_ref_null_helper - - Item_name_const - - Item_time_literal - - Item_sum_or_func - Note, these hybrid type Item_sum_or_func descendants - override the default implementation: - * Item_sum_hybrid - * Item_func_hybrid_field_type - * Item_func_min_max - * Item_func_sp - * Item_func_last_value - * Item_func_rollup_const - */ - DBUG_ASSERT(0); - return null_value= true; - } - virtual bool val_native_result(THD *thd, Native *to) - { - return val_native(thd, to); - } - - /* - Returns string representation of this item in ASCII format. - - SYNOPSIS - val_str_ascii() - str - similar to val_str(); - - NOTE - This method is introduced for performance optimization purposes. - - 1. val_str() result of some Items in string context - depends on @@character_set_results. - @@character_set_results can be set to a "real multibyte" character - set like UCS2, UTF16, UTF32. (We'll use only UTF32 in the examples - below for convenience.) - - So the default string result of such functions - in these circumstances is real multi-byte character set, like UTF32. - - For example, all numbers in string context - return result in @@character_set_results: - - SELECT CONCAT(20010101); -> UTF32 - - We do sprintf() first (to get ASCII representation) - and then convert to UTF32; - - So these kind "data sources" can use ASCII representation - internally, but return multi-byte data only because - @@character_set_results wants so. - Therefore, conversion from ASCII to UTF32 is applied internally. - - - 2. Some other functions need in fact ASCII input. - - For example, - inet_aton(), GeometryFromText(), Convert_TZ(), GET_FORMAT(). - - Similar, fields of certain type, like DATE, TIME, - when you insert string data into them, expect in fact ASCII input. - If they get non-ASCII input, for example UTF32, they - convert input from UTF32 to ASCII, and then use ASCII - representation to do further processing. - - - 3. Now imagine we pass result of a data source of the first type - to a data destination of the second type. - - What happens: - a. data source converts data from ASCII to UTF32, because - @@character_set_results wants so and passes the result to - data destination. - b. data destination gets UTF32 string. - c. data destination converts UTF32 string to ASCII, - because it needs ASCII representation to be able to handle data - correctly. - - As a result we get two steps of unnecessary conversion: - From ASCII to UTF32, then from UTF32 to ASCII. - - A better way to handle these situations is to pass ASCII - representation directly from the source to the destination. - - This is why val_str_ascii() introduced. - - RETURN - Similar to val_str() - */ - virtual String *val_str_ascii(String *str); - - /* - Returns the result of val_str_ascii(), translating NULLs back - to empty strings (if MODE_EMPTY_STRING_IS_NULL is set). - */ - String *val_str_ascii_revert_empty_string_is_null(THD *thd, String *str); - - /* - Returns the val_str() value converted to the given character set. - */ - String *val_str(String *str, String *converter, CHARSET_INFO *to); - - virtual String *val_json(String *str) { return val_str(str); } - /* - Return decimal representation of item with fixed point. - - SYNOPSIS - val_decimal() - decimal_buffer buffer which can be used by Item for returning value - (but can be not) - - NOTE - Returned value should not be changed if it is not the same which was - passed via argument. - - RETURN - Return pointer on my_decimal (it can be other then passed via argument) - if value is not NULL (null_value flag will be reset to FALSE). - In case of NULL value it return 0 pointer and set null_value flag - to TRUE. - */ - virtual my_decimal *val_decimal(my_decimal *decimal_buffer)= 0; - /* - Return boolean value of item. - - RETURN - FALSE value is false or NULL - TRUE value is true (not equal to 0) - */ - virtual bool val_bool() - { - return type_handler()->Item_val_bool(this); - } - - bool eval_const_cond() - { - DBUG_ASSERT(const_item()); - DBUG_ASSERT(!is_expensive()); - return val_bool(); - } - - /* - save_val() is method of val_* family which stores value in the given - field. - */ - virtual void save_val(Field *to) { save_org_in_field(to, NULL); } - /* - save_result() is method of val*result() family which stores value in - the given field. - */ - virtual void save_result(Field *to) { save_val(to); } - /* Helper functions, see item_sum.cc */ - String *val_string_from_real(String *str); - String *val_string_from_int(String *str); - my_decimal *val_decimal_from_real(my_decimal *decimal_value); - my_decimal *val_decimal_from_int(my_decimal *decimal_value); - my_decimal *val_decimal_from_string(my_decimal *decimal_value); - longlong val_int_from_real() - { - DBUG_ASSERT(is_fixed()); - return Converter_double_to_longlong_with_warn(val_real(), false).result(); - } - longlong val_int_from_str(int *error); - - /* - Returns true if this item can be calculated during - value_depends_on_sql_mode() - */ - bool value_depends_on_sql_mode_const_item() - { - /* - Currently we use value_depends_on_sql_mode() only for virtual - column expressions. They should not contain any expensive items. - If we ever get a crash on the assert below, it means - check_vcol_func_processor() is badly implemented for this item. - */ - DBUG_ASSERT(!is_expensive()); - /* - It should return const_item() actually. - But for some reasons Item_field::const_item() returns true - at value_depends_on_sql_mode() call time. - This should be checked and fixed. - */ - return basic_const_item(); - } - virtual Sql_mode_dependency value_depends_on_sql_mode() const - { - return Sql_mode_dependency(); - } - - int save_time_in_field(Field *field, bool no_conversions); - int save_date_in_field(Field *field, bool no_conversions); - int save_str_in_field(Field *field, bool no_conversions); - int save_real_in_field(Field *field, bool no_conversions); - int save_int_in_field(Field *field, bool no_conversions); - int save_decimal_in_field(Field *field, bool no_conversions); - - int save_str_value_in_field(Field *field, String *result); - - virtual Field *get_tmp_table_field() { return 0; } - virtual Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table); - virtual const char *full_name() const { return name.str ? name.str : "???"; } - const char *field_name_or_null() - { return real_item()->type() == Item::FIELD_ITEM ? name.str : NULL; } - const TABLE_SHARE *field_table_or_null(); - - /* - *result* family of methods is analog of *val* family (see above) but - return value of result_field of item if it is present. If Item have not - result field, it return val(). This methods set null_value flag in same - way as *val* methods do it. - */ - virtual double val_result() { return val_real(); } - virtual longlong val_int_result() { return val_int(); } - virtual String *str_result(String* tmp) { return val_str(tmp); } - virtual my_decimal *val_decimal_result(my_decimal *val) - { return val_decimal(val); } - virtual bool val_bool_result() { return val_bool(); } - virtual bool is_null_result() { return is_null(); } - /* - Returns 1 if result type and collation for val_str() can change between - calls - */ - virtual bool dynamic_result() { return 0; } - /* - Bitmap of tables used by item - (note: if you need to check dependencies on individual columns, check out - class Field_enumerator) - */ - virtual table_map used_tables() const { return (table_map) 0L; } - virtual table_map all_used_tables() const { return used_tables(); } - /* - Return table map of tables that can't be NULL tables (tables that are - used in a context where if they would contain a NULL row generated - by a LEFT or RIGHT join, the item would not be true). - This expression is used on WHERE item to determinate if a LEFT JOIN can be - converted to a normal join. - Generally this function should return used_tables() if the function - would return null if any of the arguments are null - As this is only used in the beginning of optimization, the value don't - have to be updated in update_used_tables() - */ - virtual table_map not_null_tables() const { return used_tables(); } - /* - Returns true if this is a simple constant item like an integer, not - a constant expression. Used in the optimizer to propagate basic constants. - */ - virtual bool basic_const_item() const { return 0; } - /** - Determines if the expression is allowed as - a virtual column assignment source: - INSERT INTO t1 (vcol) VALUES (10) -> error - INSERT INTO t1 (vcol) VALUES (NULL) -> ok - */ - virtual bool vcol_assignment_allowed_value() const { return false; } - /** - Test if "this" is an ORDER position (rather than an expression). - Notes: - - can be called before fix_fields(). - - local SP variables (even of integer types) are always expressions, not - positions. (And they can't be used before fix_fields is called for them). - */ - virtual bool is_order_clause_position() const { return false; } - /* - Determines if the Item is an evaluable expression, that is - it can return a value, so we can call methods val_xxx(), get_date(), etc. - Most items are evaluable expressions. - Examples of non-evaluable expressions: - - Item_contextually_typed_value_specification (handling DEFAULT and IGNORE) - - Item_type_param bound to DEFAULT and IGNORE - We cannot call the mentioned methods for these Items, - their method implementations typically have DBUG_ASSERT(0). - */ - virtual bool is_evaluable_expression() const { return true; } - bool check_is_evaluable_expression_or_error() - { - if (is_evaluable_expression()) - return false; // Ok - raise_error_not_evaluable(); - return true; // Error - } - /* cloning of constant items (0 if it is not const) */ - virtual Item *clone_item(THD *thd) { return 0; } - /* deep copy item */ - virtual Item* build_clone(THD *thd) { return get_copy(thd); } - virtual cond_result eq_cmp_result() const { return COND_OK; } - inline uint float_length(uint decimals_par) const - { return decimals < FLOATING_POINT_DECIMALS ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;} - /* Returns total number of decimal digits */ - virtual uint decimal_precision() const - { - return type_handler()->Item_decimal_precision(this); - } - /* Returns the number of integer part digits only */ - inline int decimal_int_part() const - { return my_decimal_int_part(decimal_precision(), decimals); } - /* - Returns the number of fractional digits only. - NOT_FIXED_DEC is replaced to the maximum possible number - of fractional digits, taking into account the data type. - */ - uint decimal_scale() const - { - return type_handler()->Item_decimal_scale(this); - } - /* - Returns how many digits a divisor adds into a division result. - This is important when the integer part of the divisor can be 0. - In this example: - SELECT 1 / 0.000001; -> 1000000.0000 - the divisor adds 5 digits into the result precision. - - Currently this method only replaces NOT_FIXED_DEC to - TIME_SECOND_PART_DIGITS for temporal data types. - This method can be made virtual, to create more efficient (smaller) - data types for division results. - For example, in - SELECT 1/1.000001; - the divisor could provide no additional precision into the result, - so could any other items that are know to return a result - with non-zero integer part. - */ - uint divisor_precision_increment() const - { - return type_handler()->Item_divisor_precision_increment(this); - } - /** - TIME or DATETIME precision of the item: 0..6 - */ - uint time_precision(THD *thd) - { - return const_item() ? type_handler()->Item_time_precision(thd, this) : - MY_MIN(decimals, TIME_SECOND_PART_DIGITS); - } - uint datetime_precision(THD *thd) - { - return const_item() ? type_handler()->Item_datetime_precision(thd, this) : - MY_MIN(decimals, TIME_SECOND_PART_DIGITS); - } - virtual longlong val_int_min() const - { - return LONGLONG_MIN; - } - /* - Returns true if this is constant (during query execution, i.e. its value - will not change until next fix_fields) and its value is known. - */ - virtual bool const_item() const { return used_tables() == 0; } - /* - Returns true if this is constant but its value may be not known yet. - (Can be used for parameters of prep. stmts or of stored procedures.) - */ - virtual bool const_during_execution() const - { return (used_tables() & ~PARAM_TABLE_BIT) == 0; } - - /** - This method is used for to: - - to generate a view definition query (SELECT-statement); - - to generate a SQL-query for EXPLAIN EXTENDED; - - to generate a SQL-query to be shown in INFORMATION_SCHEMA; - - debug. - - For more information about view definition query, INFORMATION_SCHEMA - query and why they should be generated from the Item-tree, @see - mysql_register_view(). - */ - virtual enum precedence precedence() const { return DEFAULT_PRECEDENCE; } - enum precedence higher_precedence() const - { return (enum precedence)(precedence() + 1); } - void print_parenthesised(String *str, enum_query_type query_type, - enum precedence parent_prec); - /** - This helper is used to print expressions as a part of a table definition, - in particular for - - generated columns - - check constraints - - default value expressions - - partitioning expressions - */ - void print_for_table_def(String *str) - { - print_parenthesised(str, - (enum_query_type)(QT_ITEM_ORIGINAL_FUNC_NULLIF | - QT_ITEM_IDENT_SKIP_DB_NAMES | - QT_ITEM_IDENT_SKIP_TABLE_NAMES | - QT_NO_DATA_EXPANSION | - QT_TO_SYSTEM_CHARSET), - LOWEST_PRECEDENCE); - } - virtual void print(String *str, enum_query_type query_type); - - class Print: public String - { - public: - Print(Item *item, enum_query_type type) - { - item->print(this, type); - } - }; - - void print_item_w_name(String *str, enum_query_type query_type); - void print_value(String *str); - - virtual void update_used_tables() {} - virtual COND *build_equal_items(THD *thd, COND_EQUAL *inheited, - bool link_item_fields, - COND_EQUAL **cond_equal_ref) - { - update_used_tables(); - DBUG_ASSERT(!cond_equal_ref || !cond_equal_ref[0]); - return this; - } - virtual COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, - bool top_level); - virtual void add_key_fields(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, - table_map usable_tables, - SARGABLE_PARAM **sargables) - { - return; - } - /* - Make a select tree for all keys in a condition or a condition part - @param param Context - @param cond_ptr[OUT] Store a replacement item here if the condition - can be simplified, e.g.: - WHERE part1 OR part2 OR part3 - with one of the partN evaluating to SEL_TREE::ALWAYS. - */ - virtual SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - /* - Checks whether the item is: - - a simple equality (field=field_item or field=constant_item), or - - a row equality - and form multiple equality predicates. - */ - virtual bool check_equality(THD *thd, COND_EQUAL *cond, List *eq_list) - { - return false; - } - virtual void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags) {} - /* Called for items that really have to be split */ - void split_sum_func2(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, - Item **ref, uint flags); - virtual bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)= 0; - bool get_date_from_int(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool get_date_from_real(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool get_date_from_string(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool get_time(THD *thd, MYSQL_TIME *ltime) - { return get_date(thd, ltime, Time::Options(thd)); } - // Get a DATE or DATETIME value in numeric packed format for comparison - virtual longlong val_datetime_packed(THD *thd) - { - return Datetime(thd, this, Datetime::Options_cmp(thd)).to_packed(); - } - // Get a TIME value in numeric packed format for comparison - virtual longlong val_time_packed(THD *thd) - { - return Time(thd, this, Time::Options_cmp(thd)).to_packed(); - } - longlong val_datetime_packed_result(THD *thd); - longlong val_time_packed_result(THD *thd); - - virtual bool get_date_result(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { return get_date(thd, ltime,fuzzydate); } - - /* - The method allows to determine nullness of a complex expression - without fully evaluating it, instead of calling val/result*() then - checking null_value. Used in Item_func_isnull/Item_func_isnotnull - and Item_sum_count. - Any new item which can be NULL must implement this method. - */ - virtual bool is_null() { return 0; } - - /* - Make sure the null_value member has a correct value. - */ - virtual void update_null_value () - { - return type_handler()->Item_update_null_value(this); - } - - /* - Inform the item that there will be no distinction between its result - being FALSE or NULL. - - NOTE - This function will be called for eg. Items that are top-level AND-parts - of the WHERE clause. Items implementing this function (currently - Item_cond_and and subquery-related item) enable special optimizations - when they are "top level". - */ - virtual void top_level_item() {} - /* - Return TRUE if it is item of top WHERE level (AND/OR) and it is - important, return FALSE if it not important (we can not use to simplify - calculations) or not top level - */ - virtual bool is_top_level_item() const - { return FALSE; /* not important */} - /* - return IN/ALL/ANY subquery or NULL - */ - virtual Item_in_subselect* get_IN_subquery() - { return NULL; /* in is not IN/ALL/ANY */ } - /* - set field of temporary table for Item which can be switched on temporary - table during query processing (grouping and so on) - */ - virtual bool is_result_field() { return 0; } - virtual bool is_json_type() { return false; } - virtual bool is_bool_literal() const { return false; } - /* This is to handle printing of default values */ - virtual bool need_parentheses_in_default() { return false; } - virtual void save_in_result_field(bool no_conversions) {} - /* - Data type format implied by the CHECK CONSTRAINT, - to be sent to the client in the result set metadata. - */ - virtual bool set_format_by_check_constraint(Send_field_extended_metadata *) - const - { - return false; - } - /* - set value of aggregate function in case of no rows for grouping were found - */ - virtual void no_rows_in_result() {} - virtual void restore_to_before_no_rows_in_result() {} - virtual Item *copy_or_same(THD *thd) { return this; } - virtual Item *copy_andor_structure(THD *thd) { return this; } - virtual Item *real_item() { return this; } - virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); } - virtual Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr) - { - return this; - } - - static CHARSET_INFO *default_charset(); - - CHARSET_INFO *charset_for_protocol(void) const - { - return type_handler()->charset_for_protocol(this); - }; - - virtual bool walk(Item_processor processor, bool walk_subquery, void *arg) - { - return (this->*processor)(arg); - } - - virtual Item* transform(THD *thd, Item_transformer transformer, uchar *arg); - - /* - This function performs a generic "compilation" of the Item tree. - The process of compilation is assumed to go as follows: - - compile() - { - if (this->*some_analyzer(...)) - { - compile children if any; - this->*some_transformer(...); - } - } - - i.e. analysis is performed top-down while transformation is done - bottom-up. - */ - virtual Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t) - { - if ((this->*analyzer) (arg_p)) - return ((this->*transformer) (thd, arg_t)); - return 0; - } - - virtual void traverse_cond(Cond_traverser traverser, - void *arg, traverse_order order) - { - (*traverser)(this, arg); - } - - /*========= Item processors, to be used with Item::walk() ========*/ - virtual bool remove_dependence_processor(void *arg) { return 0; } - virtual bool cleanup_processor(void *arg); - virtual bool cleanup_excluding_fields_processor (void *arg) - { return cleanup_processor(arg); } - bool cleanup_excluding_immutables_processor (void *arg); - virtual bool cleanup_excluding_const_fields_processor (void *arg) - { return cleanup_processor(arg); } - virtual bool collect_item_field_processor(void *arg) { return 0; } - virtual bool unknown_splocal_processor(void *arg) { return 0; } - virtual bool collect_outer_ref_processor(void *arg) {return 0; } - virtual bool check_inner_refs_processor(void *arg) { return 0; } - virtual bool find_item_in_field_list_processor(void *arg) { return 0; } - virtual bool find_item_processor(void *arg); - virtual bool change_context_processor(void *arg) { return 0; } - virtual bool reset_query_id_processor(void *arg) { return 0; } - virtual bool is_expensive_processor(void *arg) { return 0; } - - // FIXME reduce the number of "add field to bitmap" processors - virtual bool add_field_to_set_processor(void *arg) { return 0; } - virtual bool register_field_in_read_map(void *arg) { return 0; } - virtual bool register_field_in_write_map(void *arg) { return 0; } - virtual bool register_field_in_bitmap(void *arg) { return 0; } - virtual bool update_table_bitmaps_processor(void *arg) { return 0; } - - virtual bool enumerate_field_refs_processor(void *arg) { return 0; } - virtual bool mark_as_eliminated_processor(void *arg) { return 0; } - virtual bool eliminate_subselect_processor(void *arg) { return 0; } - virtual bool set_fake_select_as_master_processor(void *arg) { return 0; } - virtual bool view_used_tables_processor(void *arg) { return 0; } - virtual bool eval_not_null_tables(void *arg) { return 0; } - virtual bool is_subquery_processor(void *arg) { return 0; } - virtual bool count_sargable_conds(void *arg) { return 0; } - virtual bool limit_index_condition_pushdown_processor(void *arg) { return 0; } - virtual bool exists2in_processor(void *arg) { return 0; } - virtual bool find_selective_predicates_list_processor(void *arg) { return 0; } - bool cleanup_is_expensive_cache_processor(void *arg) - { - is_expensive_cache= (int8)(-1); - return 0; - } - - /* - TRUE if the expression depends only on the table indicated by tab_map - or can be converted to such an exression using equalities. - Not to be used for AND/OR formulas. - */ - virtual bool excl_dep_on_table(table_map tab_map) { return false; } - /* - TRUE if the expression depends only on grouping fields of sel - or can be converted to such an expression using equalities. - It also checks if the expression doesn't contain stored procedures, - subqueries or randomly generated elements. - Not to be used for AND/OR formulas. - */ - virtual bool excl_dep_on_grouping_fields(st_select_lex *sel) - { return false; } - /* - TRUE if the expression depends only on fields from the left part of - IN subquery or can be converted to such an expression using equalities. - Not to be used for AND/OR formulas. - */ - virtual bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) - { return false; } - - virtual bool switch_to_nullable_fields_processor(void *arg) { return 0; } - virtual bool find_function_processor (void *arg) { return 0; } - /* - Check if a partition function is allowed - SYNOPSIS - check_partition_func_processor() - int_arg Ignored - RETURN VALUE - TRUE Partition function not accepted - FALSE Partition function accepted - - DESCRIPTION - check_partition_func_processor is used to check if a partition function - uses an allowed function. An allowed function will always ensure that - X=Y guarantees that also part_function(X)=part_function(Y) where X is - a set of partition fields and so is Y. The problems comes mainly from - character sets where two equal strings can be quite unequal. E.g. the - german character for double s is equal to 2 s. - - The default is that an item is not allowed - in a partition function. Allowed functions - can never depend on server version, they cannot depend on anything - related to the environment. They can also only depend on a set of - fields in the table itself. They cannot depend on other tables and - cannot contain any queries and cannot contain udf's or similar. - If a new Item class is defined and it inherits from a class that is - allowed in a partition function then it is very important to consider - whether this should be inherited to the new class. If not the function - below should be defined in the new Item class. - - The general behaviour is that most integer functions are allowed. - If the partition function contains any multi-byte collations then - the function check_part_func_fields will report an error on the - partition function independent of what functions are used. So the - only character sets allowed are single character collation and - even for those only a limited set of functions are allowed. The - problem with multi-byte collations is that almost every string - function has the ability to change things such that two strings - that are equal will not be equal after manipulated by a string - function. E.g. two strings one contains a double s, there is a - special german character that is equal to two s. Now assume a - string function removes one character at this place, then in - one the double s will be removed and in the other there will - still be one s remaining and the strings are no longer equal - and thus the partition function will not sort equal strings into - the same partitions. - - So the check if a partition function is valid is two steps. First - check that the field types are valid, next check that the partition - function is valid. The current set of partition functions valid - assumes that there are no multi-byte collations amongst the partition - fields. - */ - virtual bool check_partition_func_processor(void *arg) { return 1;} - virtual bool post_fix_fields_part_expr_processor(void *arg) { return 0; } - virtual bool rename_fields_processor(void *arg) { return 0; } - /* - TRUE if the function is knowingly TRUE or FALSE. - Not to be used for AND/OR formulas. - */ - virtual bool is_simplified_cond_processor(void *arg) { return false; } - - /** Processor used to check acceptability of an item in the defining - expression for a virtual column - - @param arg always ignored - - @retval 0 the item is accepted in the definition of a virtual column - @retval 1 otherwise - */ - struct vcol_func_processor_result - { - uint errors; /* Bits of possible errors */ - const char *name; /* Not supported function */ - Alter_info *alter_info; - vcol_func_processor_result() : - errors(0), name(NULL), alter_info(NULL) {} - }; - struct func_processor_rename - { - LEX_CSTRING db_name; - LEX_CSTRING table_name; - List fields; - }; - virtual bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE); - } - virtual bool check_field_expression_processor(void *arg) { return 0; } - virtual bool check_func_default_processor(void *arg) { return 0; } - /* - Check if an expression value has allowed arguments, like DATE/DATETIME - for date functions. Also used by partitioning code to reject - timezone-dependent expressions in a (sub)partitioning function. - */ - virtual bool check_valid_arguments_processor(void *arg) { return 0; } - virtual bool update_vcol_processor(void *arg) { return 0; } - virtual bool set_fields_as_dependent_processor(void *arg) { return 0; } - /* - Find if some of the key parts of table keys (the reference on table is - passed as an argument) participate in the expression. - If there is some, sets a bit for this key in the proper key map. - */ - virtual bool check_index_dependence(void *arg) { return 0; } - /*============== End of Item processor list ======================*/ - - /* - Given a condition P from the WHERE clause or from an ON expression of - the processed SELECT S and a set of join tables from S marked in the - parameter 'allowed'={T} a call of P->find_not_null_fields({T}) has to - find the set fields {F} of the tables from 'allowed' such that: - - each field from {F} is declared as nullable - - each record of table t from {T} that contains NULL as the value for at - at least one field from {F} can be ignored when building the result set - for S - It is assumed here that the condition P is conjunctive and all its column - references belong to T. - - Examples: - CREATE TABLE t1 (a int, b int); - CREATE TABLE t2 (a int, b int); - - SELECT * FROM t1,t2 WHERE t1.a=t2.a and t1.b > 5; - A call of find_not_null_fields() for the whole WHERE condition and {t1,t2} - should find {t1.a,t1.b,t2.a} - - SELECT * FROM t1 LEFT JOIN ON (t1.a=t2.a and t2.a > t2.b); - A call of find_not_null_fields() for the ON expression and {t2} - should find {t2.a,t2.b} - - The function returns TRUE if it succeeds to prove that all records of - a table from {T} can be ignored. Otherwise it always returns FALSE. - - Example: - SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t2.a IS NULL; - A call of find_not_null_fields() for the WHERE condition and {t1,t2} - will return TRUE. - - It is assumed that the implementation of this virtual function saves - the info on the found set of fields in the structures associates with - tables from {T}. - */ - virtual bool find_not_null_fields(table_map allowed) { return false; } - - /* - Does not guarantee deep copy (depends on copy ctor). - See build_clone() for deep copy. - */ - virtual Item *get_copy(THD *thd)=0; - - bool cache_const_expr_analyzer(uchar **arg); - Item* cache_const_expr_transformer(THD *thd, uchar *arg); - - virtual Item* propagate_equal_fields(THD*, const Context &, COND_EQUAL *) - { - return this; - }; - - Item* propagate_equal_fields_and_change_item_tree(THD *thd, - const Context &ctx, - COND_EQUAL *cond, - Item **place); - - /* arg points to REPLACE_EQUAL_FIELD_ARG object */ - virtual Item *replace_equal_field(THD *thd, uchar *arg) { return this; } - - struct Collect_deps_prm - { - List *parameters; - /* unit from which we count nest_level */ - st_select_lex_unit *nest_level_base; - uint count; - int nest_level; - bool collect; - }; - - /* - For SP local variable returns pointer to Item representing its - current value and pointer to current Item otherwise. - */ - virtual Item *this_item() { return this; } - virtual const Item *this_item() const { return this; } - - /* - For SP local variable returns address of pointer to Item representing its - current value and pointer passed via parameter otherwise. - */ - virtual Item **this_item_addr(THD *thd, Item **addr_arg) { return addr_arg; } - - // Row emulation - virtual uint cols() const { return 1; } - virtual Item* element_index(uint i) { return this; } - virtual Item** addr(uint i) { return 0; } - virtual bool check_cols(uint c); - bool check_type_traditional_scalar(const char *opname) const; - bool check_type_scalar(const char *opname) const; - bool check_type_or_binary(const char *opname, const Type_handler *handler) const; - bool check_type_general_purpose_string(const char *opname) const; - bool check_type_can_return_int(const char *opname) const; - bool check_type_can_return_decimal(const char *opname) const; - bool check_type_can_return_real(const char *opname) const; - bool check_type_can_return_str(const char *opname) const; - bool check_type_can_return_text(const char *opname) const; - bool check_type_can_return_date(const char *opname) const; - bool check_type_can_return_time(const char *opname) const; - // It is not row => null inside is impossible - virtual bool null_inside() { return 0; } - // used in row subselects to get value of elements - virtual void bring_value() {} - - const Type_handler *type_handler_long_or_longlong() const - { - return Type_handler::type_handler_long_or_longlong(max_char_length(), - unsigned_flag); - } - - /** - Create field for temporary table. - @param table Temporary table - @param [OUT] src Who created the fields - @param param Create parameters - @retval NULL (on error) - @retval a pointer to a newly create Field (on success) - */ - virtual Field *create_tmp_field_ex(MEM_ROOT *root, - TABLE *table, - Tmp_field_src *src, - const Tmp_field_param *param)= 0; - virtual Item_field *field_for_view_update() { return 0; } - - virtual Item *neg_transformer(THD *thd) { return NULL; } - virtual Item *update_value_transformer(THD *thd, uchar *select_arg) - { return this; } - virtual Item *expr_cache_insert_transformer(THD *thd, uchar *unused) - { return this; } - virtual Item *derived_field_transformer_for_having(THD *thd, uchar *arg) - { return this; } - virtual Item *derived_field_transformer_for_where(THD *thd, uchar *arg) - { return this; } - virtual Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) - { return this; } - /* Now is not used. */ - virtual Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) - { return this; } - virtual Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) - { return this; } - virtual Item *in_predicate_to_in_subs_transformer(THD *thd, uchar *arg) - { return this; } - virtual Item *field_transformer_for_having_pushdown(THD *thd, uchar *arg) - { return this; } - virtual Item *multiple_equality_transformer(THD *thd, uchar *arg) - { return this; } - virtual bool expr_cache_is_needed(THD *) { return FALSE; } - virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - bool needs_charset_converter(uint32 length, CHARSET_INFO *tocs) const - { - /* - This will return "true" if conversion happens: - - between two non-binary different character sets - - from "binary" to "unsafe" character set - (those that can have non-well-formed string) - - from "binary" to UCS2-alike character set with mbminlen>1, - when prefix left-padding is needed for an incomplete character: - binary 0xFF -> ucs2 0x00FF) - */ - if (!String::needs_conversion_on_storage(length, - collation.collation, tocs)) - return false; - /* - No needs to add converter if an "arg" is NUMERIC or DATETIME - value (which is pure ASCII) and at the same time target DTCollation - is ASCII-compatible. For example, no needs to rewrite: - SELECT * FROM t1 WHERE datetime_field = '2010-01-01'; - to - SELECT * FROM t1 WHERE CONVERT(datetime_field USING cs) = '2010-01-01'; - - TODO: avoid conversion of any values with - repertoire ASCII and 7bit-ASCII-compatible, - not only numeric/datetime origin. - */ - if (collation.derivation == DERIVATION_NUMERIC && - collation.repertoire == MY_REPERTOIRE_ASCII && - !(collation.collation->state & MY_CS_NONASCII) && - !(tocs->state & MY_CS_NONASCII)) - return false; - return true; - } - bool needs_charset_converter(CHARSET_INFO *tocs) - { - // Pass 1 as length to force conversion if tocs->mbminlen>1. - return needs_charset_converter(1, tocs); - } - Item *const_charset_converter(THD *thd, CHARSET_INFO *tocs, bool lossless, - const char *func_name); - Item *const_charset_converter(THD *thd, CHARSET_INFO *tocs, bool lossless) - { return const_charset_converter(thd, tocs, lossless, NULL); } - void delete_self() - { - cleanup(); - delete this; - } - - virtual const Item_const *get_item_const() const { return NULL; } - virtual Item_splocal *get_item_splocal() { return 0; } - virtual Rewritable_query_parameter *get_rewritable_query_parameter() - { return 0; } - - /* - Return Settable_routine_parameter interface of the Item. Return 0 - if this Item is not Settable_routine_parameter. - */ - virtual Settable_routine_parameter *get_settable_routine_parameter() - { - return 0; - } - - virtual Load_data_outvar *get_load_data_outvar() - { - return 0; - } - Load_data_outvar *get_load_data_outvar_or_error() - { - Load_data_outvar *dst= get_load_data_outvar(); - if (dst) - return dst; - my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), name.str); - return NULL; - } - - /** - Test whether an expression is expensive to compute. Used during - optimization to avoid computing expensive expressions during this - phase. Also used to force temp tables when sorting on expensive - functions. - @todo - Normally we should have a method: - cost Item::execution_cost(), - where 'cost' is either 'double' or some structure of various cost - parameters. - - @note - This function is now used to prevent evaluation of expensive subquery - predicates during the optimization phase. It also prevents evaluation - of predicates that are not computable at this moment. - */ - virtual bool is_expensive() - { - if (is_expensive_cache < 0) - is_expensive_cache= walk(&Item::is_expensive_processor, 0, NULL); - return MY_TEST(is_expensive_cache); - } - String *check_well_formed_result(String *str, bool send_error= 0); - bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs); - bool too_big_for_varchar() const - { return max_char_length() > CONVERT_IF_BIGGER_TO_BLOB; } - void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs) - { - max_length= char_to_byte_length_safe(max_char_length_arg, cs->mbmaxlen); - collation.collation= cs; - } - void fix_char_length(size_t max_char_length_arg) - { - max_length= char_to_byte_length_safe(max_char_length_arg, - collation.collation->mbmaxlen); - } - /* - Return TRUE if the item points to a column of an outer-joined table. - */ - virtual bool is_outer_field() const { DBUG_ASSERT(is_fixed()); return FALSE; } - - /** - Checks if this item or any of its descendents contains a subquery. - This is a replacement of the former Item::has_subquery() and - Item::with_subselect. - */ - virtual bool with_subquery() const { DBUG_ASSERT(is_fixed()); return false; } - - virtual bool with_sum_func() const { return false; } - virtual With_sum_func_cache* get_with_sum_func_cache() { return NULL; } - - Item* set_expr_cache(THD *thd); - - virtual Item_equal *get_item_equal() { return NULL; } - virtual void set_item_equal(Item_equal *item_eq) {}; - virtual Item_equal *find_item_equal(COND_EQUAL *cond_equal) { return NULL; } - /** - Set the join tab index to the minimal (left-most) JOIN_TAB to which this - Item is attached. The number is an index is depth_first_tab() traversal - order. - */ - virtual void set_join_tab_idx(uint join_tab_idx_arg) - { - if (join_tab_idx_arg < join_tab_idx) - join_tab_idx= join_tab_idx_arg; - } - uint get_join_tab_idx() const { return join_tab_idx; } - - table_map view_used_tables(TABLE_LIST *view) - { - view->view_used_tables= 0; - walk(&Item::view_used_tables_processor, 0, view); - return view->view_used_tables; - } - - /** - Collect and add to the list cache parameters for this Item. - - @note Now implemented only for subqueries and in_optimizer, - if we need it for general function then this method should - be defined for Item_func. - */ - virtual void get_cache_parameters(List ¶meters) { }; - - virtual void mark_as_condition_AND_part(TABLE_LIST *embedding) {}; - - /* how much position should be reserved for Exists2In transformation */ - virtual uint exists2in_reserved_items() { return 0; }; - - virtual Item *neg(THD *thd); - - /** - Inform the item that it is located under a NOT, which is a top-level item. - */ - virtual void under_not(Item_func_not * upper - __attribute__((unused))) {}; - /* - If Item_field is wrapped in Item_direct_wrep remove this Item_direct_ref - wrapper. - */ - virtual Item *remove_item_direct_ref() { return this; } - - - void register_in(THD *thd); - - bool depends_only_on(table_map view_map) - { return marker & FULL_EXTRACTION_FL; } - int get_extraction_flag() - { return marker & EXTRACTION_MASK; } - void set_extraction_flag(int flags) - { - marker &= ~EXTRACTION_MASK; - marker|= flags; - } - void clear_extraction_flag() - { - marker &= ~EXTRACTION_MASK; - } - void check_pushable_cond(Pushdown_checker excl_dep_func, uchar *arg); - bool pushable_cond_checker_for_derived(uchar *arg) - { - return excl_dep_on_table(*((table_map *)arg)); - } - bool pushable_cond_checker_for_subquery(uchar *arg) - { - DBUG_ASSERT(((Item*) arg)->get_IN_subquery()); - return excl_dep_on_in_subq_left_part(((Item*)arg)->get_IN_subquery()); - } - Item *build_pushable_cond(THD *thd, - Pushdown_checker checker, - uchar *arg); - /* - Checks if this item depends only on the arg table - */ - bool pushable_equality_checker_for_derived(uchar *arg) - { - return (used_tables() == *((table_map *)arg)); - } - /* - Checks if this item consists in the left part of arg IN subquery predicate - */ - bool pushable_equality_checker_for_subquery(uchar *arg); -}; - -MEM_ROOT *get_thd_memroot(THD *thd); - -template -inline Item* get_item_copy (THD *thd, T* item) -{ - Item *copy= new (get_thd_memroot(thd)) T(*item); - if (likely(copy)) - copy->register_in(thd); - return copy; -} - - -#ifndef DBUG_OFF -/** - A helper class to print the data type and the value for an Item - in debug builds. -*/ -class DbugStringItemTypeValue: public StringBuffer<128> -{ -public: - DbugStringItemTypeValue(THD *thd, const Item *item) - { - append('('); - append(item->type_handler()->name().ptr()); - append(')'); - const_cast(item)->print(this, QT_EXPLAIN); - /* Append end \0 to allow usage of c_ptr() */ - append('\0'); - str_length--; - } -}; -#endif - -class With_sum_func_cache -{ -protected: - bool m_with_sum_func; // True if the owner item contains a sum func -public: - With_sum_func_cache() - :m_with_sum_func(false) - { } - With_sum_func_cache(const Item *a) - :m_with_sum_func(a->with_sum_func()) - { } - With_sum_func_cache(const Item *a, const Item *b) - :m_with_sum_func(a->with_sum_func() || b->with_sum_func()) - { } - With_sum_func_cache(const Item *a, const Item *b, const Item *c) - :m_with_sum_func(a->with_sum_func() || b->with_sum_func() || - c->with_sum_func()) - { } - With_sum_func_cache(const Item *a, const Item *b, const Item *c, - const Item *d) - :m_with_sum_func(a->with_sum_func() || b->with_sum_func() || - c->with_sum_func() || d->with_sum_func()) - { } - With_sum_func_cache(const Item *a, const Item *b, const Item *c, - const Item *d, const Item *e) - :m_with_sum_func(a->with_sum_func() || b->with_sum_func() || - c->with_sum_func() || d->with_sum_func() || - e->with_sum_func()) - { } - void set_with_sum_func() { m_with_sum_func= true; } - void reset_with_sum_func() { m_with_sum_func= false; } - void copy_with_sum_func(const Item *item) - { - m_with_sum_func= item->with_sum_func(); - } - void join_with_sum_func(const Item *item) - { - m_with_sum_func|= item->with_sum_func(); - } -}; - - -/* - This class is a replacement for the former member Item::with_subselect. - Determines if the descendant Item is a subselect or some of - its arguments is or contains a subselect. -*/ -class With_subquery_cache -{ -protected: - bool m_with_subquery; -public: - With_subquery_cache(): m_with_subquery(false) { } - void join(const Item *item) { m_with_subquery|= item->with_subquery(); } -}; - - -/** - Compare two Items for List::add_unique() -*/ - -bool cmp_items(Item *a, Item *b); - - -/** - Array of items, e.g. function or aggerate function arguments. -*/ -class Item_args -{ -protected: - Item **args, *tmp_arg[2]; - uint arg_count; - void set_arguments(THD *thd, List &list); - bool walk_args(Item_processor processor, bool walk_subquery, void *arg) - { - for (uint i= 0; i < arg_count; i++) - { - if (args[i]->walk(processor, walk_subquery, arg)) - return true; - } - return false; - } - bool transform_args(THD *thd, Item_transformer transformer, uchar *arg); - void propagate_equal_fields(THD *, const Item::Context &, COND_EQUAL *); - bool excl_dep_on_table(table_map tab_map) - { - for (uint i= 0; i < arg_count; i++) - { - if (args[i]->const_item()) - continue; - if (!args[i]->excl_dep_on_table(tab_map)) - return false; - } - return true; - } - bool excl_dep_on_grouping_fields(st_select_lex *sel); - bool eq(const Item_args *other, bool binary_cmp) const - { - for (uint i= 0; i < arg_count ; i++) - { - if (!args[i]->eq(other->args[i], binary_cmp)) - return false; - } - return true; - } - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) - { - for (uint i= 0; i < arg_count; i++) - { - if (args[i]->const_item()) - continue; - if (!args[i]->excl_dep_on_in_subq_left_part(subq_pred)) - return false; - } - return true; - } -public: - Item_args(void) - :args(NULL), arg_count(0) - { } - Item_args(Item *a) - :args(tmp_arg), arg_count(1) - { - args[0]= a; - } - Item_args(Item *a, Item *b) - :args(tmp_arg), arg_count(2) - { - args[0]= a; args[1]= b; - } - Item_args(THD *thd, Item *a, Item *b, Item *c) - { - arg_count= 0; - if (likely((args= (Item**) thd_alloc(thd, sizeof(Item*) * 3)))) - { - arg_count= 3; - args[0]= a; args[1]= b; args[2]= c; - } - } - Item_args(THD *thd, Item *a, Item *b, Item *c, Item *d) - { - arg_count= 0; - if (likely((args= (Item**) thd_alloc(thd, sizeof(Item*) * 4)))) - { - arg_count= 4; - args[0]= a; args[1]= b; args[2]= c; args[3]= d; - } - } - Item_args(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e) - { - arg_count= 5; - if (likely((args= (Item**) thd_alloc(thd, sizeof(Item*) * 5)))) - { - arg_count= 5; - args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e; - } - } - Item_args(THD *thd, List &list) - { - set_arguments(thd, list); - } - Item_args(THD *thd, const Item_args *other); - bool alloc_arguments(THD *thd, uint count); - void add_argument(Item *item) - { - args[arg_count++]= item; - } - /** - Extract row elements from the given position. - For example, for this input: (1,2),(3,4),(5,6) - pos=0 will extract (1,3,5) - pos=1 will extract (2,4,6) - @param thd - current thread, to allocate memory on its mem_root - @param rows - an array of compatible ROW-type items - @param pos - the element position to extract - */ - bool alloc_and_extract_row_elements(THD *thd, const Item_args *rows, uint pos) - { - DBUG_ASSERT(rows->argument_count() > 0); - DBUG_ASSERT(rows->arguments()[0]->cols() > pos); - if (alloc_arguments(thd, rows->argument_count())) - return true; - for (uint i= 0; i < rows->argument_count(); i++) - { - DBUG_ASSERT(rows->arguments()[0]->cols() == rows->arguments()[i]->cols()); - Item *arg= rows->arguments()[i]->element_index(pos); - add_argument(arg); - } - DBUG_ASSERT(argument_count() == rows->argument_count()); - return false; - } - inline Item **arguments() const { return args; } - inline uint argument_count() const { return arg_count; } - inline void remove_arguments() { arg_count=0; } - Sql_mode_dependency value_depends_on_sql_mode_bit_or() const; -}; - - -/* - Class to be used to enumerate all field references in an item tree. This - includes references to outside but not fields of the tables within a - subquery. - Suggested usage: - - class My_enumerator : public Field_enumerator - { - virtual void visit_field() { ... your actions ...} - } - - My_enumerator enumerator; - item->walk(Item::enumerate_field_refs_processor, ...,&enumerator); - - This is similar to Visitor pattern. -*/ - -class Field_enumerator -{ -public: - virtual void visit_field(Item_field *field)= 0; - virtual ~Field_enumerator() {}; /* purecov: inspected */ - Field_enumerator() {} /* Remove gcc warning */ -}; - -class Item_string; - - -class Item_fixed_hybrid: public Item -{ -public: - bool fixed; // If item was fixed with fix_fields -public: - Item_fixed_hybrid(THD *thd): Item(thd), fixed(false) - { } - Item_fixed_hybrid(THD *thd, Item_fixed_hybrid *item) - :Item(thd, item), fixed(item->fixed) - { } - bool fix_fields(THD *thd, Item **ref) - { - DBUG_ASSERT(!fixed); - fixed= true; - return false; - } - void cleanup() - { - Item::cleanup(); - fixed= false; - } - void quick_fix_field() { fixed= true; } - void unfix_fields() { fixed= false; } - bool is_fixed() const { return fixed; } -}; - - -/** - A common class for Item_basic_constant and Item_param -*/ -class Item_basic_value :public Item, - public Item_const -{ -protected: - // Value metadata, e.g. to make string processing easier - class Metadata: private MY_STRING_METADATA - { - public: - Metadata(const String *str) - { - my_string_metadata_get(this, str->charset(), str->ptr(), str->length()); - } - Metadata(const String *str, my_repertoire_t repertoire_arg) - { - MY_STRING_METADATA::repertoire= repertoire_arg; - MY_STRING_METADATA::char_length= str->numchars(); - } - my_repertoire_t repertoire() const - { - return MY_STRING_METADATA::repertoire; - } - size_t char_length() const { return MY_STRING_METADATA::char_length; } - }; - void fix_charset_and_length(CHARSET_INFO *cs, - Derivation dv, Metadata metadata) - { - /* - We have to have a different max_length than 'length' here to - ensure that we get the right length if we do use the item - to create a new table. In this case max_length must be the maximum - number of chars for a string of this type because we in Create_field:: - divide the max_length with mbmaxlen). - */ - collation.set(cs, dv, metadata.repertoire()); - fix_char_length(metadata.char_length()); - decimals= NOT_FIXED_DEC; - } - void fix_charset_and_length_from_str_value(const String &str, Derivation dv) - { - fix_charset_and_length(str.charset(), dv, Metadata(&str)); - } - Item_basic_value(THD *thd): Item(thd) {} -public: - Field *create_tmp_field_ex(MEM_ROOT *root, - TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - - /* - create_tmp_field_ex() for this type of Items is called for: - - CREATE TABLE ... SELECT - - In ORDER BY: SELECT max(a) FROM t1 GROUP BY a ORDER BY 'const'; - - In CURSORS: - DECLARE c CURSOR FOR SELECT 'test'; - OPEN c; - */ - return tmp_table_field_from_field_type_maybe_null(root, - table, src, param, - type() == Item::NULL_ITEM); - } - bool eq(const Item *item, bool binary_cmp) const; - const Type_all_attributes *get_type_all_attributes_from_const() const - { return this; } -}; - - -class Item_basic_constant :public Item_basic_value -{ -public: - Item_basic_constant(THD *thd): Item_basic_value(thd) {}; - bool check_vcol_func_processor(void *arg) { return false; } - const Item_const *get_item_const() const { return this; } - virtual Item_basic_constant *make_string_literal_concat(THD *thd, - const LEX_CSTRING *) - { - DBUG_ASSERT(0); - return this; - } -}; - - -/***************************************************************************** - The class is a base class for representation of stored routine variables in - the Item-hierarchy. There are the following kinds of SP-vars: - - local variables (Item_splocal); - - CASE expression (Item_case_expr); -*****************************************************************************/ - -class Item_sp_variable :public Item_fixed_hybrid -{ -protected: - /* - THD, which is stored in fix_fields() and is used in this_item() to avoid - current_thd use. - */ - THD *m_thd; - - bool fix_fields_from_item(THD *thd, Item **, const Item *); -public: - LEX_CSTRING m_name; - -public: -#ifdef DBUG_ASSERT_EXISTS - /* - Routine to which this Item_splocal belongs. Used for checking if correct - runtime context is used for variable handling. - */ - const sp_head *m_sp; -#endif - -public: - Item_sp_variable(THD *thd, const LEX_CSTRING *sp_var_name); - -public: - bool fix_fields(THD *thd, Item **)= 0; - - double val_real(); - longlong val_int(); - String *val_str(String *sp); - my_decimal *val_decimal(my_decimal *decimal_value); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to); - bool is_null(); - -public: - void make_send_field(THD *thd, Send_field *field); - - inline bool const_item() const; - - Field *create_tmp_field_ex(MEM_ROOT *root, - TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - return create_tmp_field_ex_simple(root, table, src, param); - } - inline int save_in_field(Field *field, bool no_conversions); - inline bool send(Protocol *protocol, st_value *buffer); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(m_name.str, arg, VCOL_IMPOSSIBLE); - } -}; - -/***************************************************************************** - Item_sp_variable inline implementation. -*****************************************************************************/ - -inline bool Item_sp_variable::const_item() const -{ - return TRUE; -} - -inline int Item_sp_variable::save_in_field(Field *field, bool no_conversions) -{ - return this_item()->save_in_field(field, no_conversions); -} - -inline bool Item_sp_variable::send(Protocol *protocol, st_value *buffer) -{ - return this_item()->send(protocol, buffer); -} - - -/***************************************************************************** - A reference to local SP variable (incl. reference to SP parameter), used in - runtime. -*****************************************************************************/ - -class Item_splocal :public Item_sp_variable, - private Settable_routine_parameter, - public Rewritable_query_parameter, - public Type_handler_hybrid_field_type -{ -protected: - const Sp_rcontext_handler *m_rcontext_handler; - - uint m_var_idx; - - Type m_type; - - bool append_value_for_log(THD *thd, String *str); - - sp_rcontext *get_rcontext(sp_rcontext *local_ctx) const; - Item_field *get_variable(sp_rcontext *ctx) const; - -public: - Item_splocal(THD *thd, const Sp_rcontext_handler *rh, - const LEX_CSTRING *sp_var_name, uint sp_var_idx, - const Type_handler *handler, - uint pos_in_q= 0, uint len_in_q= 0); - - bool fix_fields(THD *, Item **); - Item *this_item(); - const Item *this_item() const; - Item **this_item_addr(THD *thd, Item **); - - virtual void print(String *str, enum_query_type query_type); - -public: - inline const LEX_CSTRING *my_name() const; - - inline uint get_var_idx() const; - - inline enum Type type() const; - const Type_handler *type_handler() const - { return Type_handler_hybrid_field_type::type_handler(); } - uint cols() const { return this_item()->cols(); } - Item* element_index(uint i) { return this_item()->element_index(i); } - Item** addr(uint i) { return this_item()->addr(i); } - bool check_cols(uint c); - -private: - bool set_value(THD *thd, sp_rcontext *ctx, Item **it); - -public: - Item_splocal *get_item_splocal() { return this; } - - Rewritable_query_parameter *get_rewritable_query_parameter() - { return this; } - - Settable_routine_parameter *get_settable_routine_parameter() - { return this; } - - bool append_for_log(THD *thd, String *str); - - Item *get_copy(THD *thd) { return 0; } - - /* - Override the inherited create_field_for_create_select(), - because we want to preserve the exact data type for: - DECLARE a1 INT; - DECLARE a2 TYPE OF t1.a2; - CREATE TABLE t1 AS SELECT a1, a2; - The inherited implementation would create a column - based on result_type(), which is less exact. - */ - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) - { return create_table_field_from_handler(root, table); } - - bool is_valid_limit_clause_variable_with_error() const - { - /* - In case if the variable has an anchored data type, e.g.: - DECLARE a TYPE OF t1.a; - type_handler() is set to &type_handler_null and this - function detects such variable as not valid in LIMIT. - */ - if (type_handler()->is_limit_clause_valid_type()) - return true; - my_error(ER_WRONG_SPVAR_TYPE_IN_LIMIT, MYF(0)); - return false; - } -}; - - -/** - An Item_splocal variant whose data type becomes known only at - sp_rcontext creation time, e.g. "DECLARE var1 t1.col1%TYPE". -*/ -class Item_splocal_with_delayed_data_type: public Item_splocal -{ -public: - Item_splocal_with_delayed_data_type(THD *thd, - const Sp_rcontext_handler *rh, - const LEX_CSTRING *sp_var_name, - uint sp_var_idx, - uint pos_in_q, uint len_in_q) - :Item_splocal(thd, rh, sp_var_name, sp_var_idx, &type_handler_null, - pos_in_q, len_in_q) - { } -}; - - -/** - SP variables that are fields of a ROW. - DELCARE r ROW(a INT,b INT); - SELECT r.a; -- This is handled by Item_splocal_row_field -*/ -class Item_splocal_row_field :public Item_splocal -{ -protected: - LEX_CSTRING m_field_name; - uint m_field_idx; - bool set_value(THD *thd, sp_rcontext *ctx, Item **it); -public: - Item_splocal_row_field(THD *thd, - const Sp_rcontext_handler *rh, - const LEX_CSTRING *sp_var_name, - const LEX_CSTRING *sp_field_name, - uint sp_var_idx, uint sp_field_idx, - const Type_handler *handler, - uint pos_in_q= 0, uint len_in_q= 0) - :Item_splocal(thd, rh, sp_var_name, sp_var_idx, handler, pos_in_q, len_in_q), - m_field_name(*sp_field_name), - m_field_idx(sp_field_idx) - { } - bool fix_fields(THD *thd, Item **); - Item *this_item(); - const Item *this_item() const; - Item **this_item_addr(THD *thd, Item **); - bool append_for_log(THD *thd, String *str); - void print(String *str, enum_query_type query_type); -}; - - -class Item_splocal_row_field_by_name :public Item_splocal_row_field -{ - bool set_value(THD *thd, sp_rcontext *ctx, Item **it); -public: - Item_splocal_row_field_by_name(THD *thd, - const Sp_rcontext_handler *rh, - const LEX_CSTRING *sp_var_name, - const LEX_CSTRING *sp_field_name, - uint sp_var_idx, - const Type_handler *handler, - uint pos_in_q= 0, uint len_in_q= 0) - :Item_splocal_row_field(thd, rh, sp_var_name, sp_field_name, - sp_var_idx, 0 /* field index will be set later */, - handler, pos_in_q, len_in_q) - { } - bool fix_fields(THD *thd, Item **it); - void print(String *str, enum_query_type query_type); -}; - - -/***************************************************************************** - Item_splocal inline implementation. -*****************************************************************************/ - -inline const LEX_CSTRING *Item_splocal::my_name() const -{ - return &m_name; -} - -inline uint Item_splocal::get_var_idx() const -{ - return m_var_idx; -} - -inline enum Item::Type Item_splocal::type() const -{ - return m_type; -} - -/***************************************************************************** - A reference to case expression in SP, used in runtime. -*****************************************************************************/ - -class Item_case_expr :public Item_sp_variable -{ -public: - Item_case_expr(THD *thd, uint case_expr_id); - -public: - bool fix_fields(THD *thd, Item **); - Item *this_item(); - const Item *this_item() const; - Item **this_item_addr(THD *thd, Item **); - - inline enum Type type() const; - const Type_handler *type_handler() const { return this_item()->type_handler(); } - -public: - /* - NOTE: print() is intended to be used from views and for debug. - Item_case_expr can not occur in views, so here it is only for debug - purposes. - */ - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) { return 0; } - -private: - uint m_case_expr_id; -}; - -/***************************************************************************** - Item_case_expr inline implementation. -*****************************************************************************/ - -inline enum Item::Type Item_case_expr::type() const -{ - return this_item()->type(); -} - -/* - NAME_CONST(given_name, const_value). - This 'function' has all properties of the supplied const_value (which is - assumed to be a literal constant), and the name given_name. - - This is used to replace references to SP variables when we write PROCEDURE - statements into the binary log. - - TODO - Together with Item_splocal and Item::this_item() we can actually extract - common a base of this class and Item_splocal. Maybe it is possible to - extract a common base with class Item_ref, too. -*/ - -class Item_name_const : public Item_fixed_hybrid -{ - Item *value_item; - Item *name_item; -public: - Item_name_const(THD *thd, Item *name_arg, Item *val); - - bool fix_fields(THD *, Item **); - - enum Type type() const; - double val_real(); - longlong val_int(); - String *val_str(String *sp); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to); - bool is_null(); - virtual void print(String *str, enum_query_type query_type); - - const Type_handler *type_handler() const - { - return value_item->type_handler(); - } - - bool const_item() const - { - return TRUE; - } - - Field *create_tmp_field_ex(MEM_ROOT *root, - TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - /* - We can get to here when using a CURSOR for a query with NAME_CONST(): - DECLARE c CURSOR FOR SELECT NAME_CONST('x','y') FROM t1; - OPEN c; - */ - return tmp_table_field_from_field_type_maybe_null(root, table, src, param, - type() == Item::NULL_ITEM); - } - int save_in_field(Field *field, bool no_conversions) - { - return value_item->save_in_field(field, no_conversions); - } - - bool send(Protocol *protocol, st_value *buffer) - { - return value_item->send(protocol, buffer); - } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function("name_const()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_literal: public Item_basic_constant -{ -public: - Item_literal(THD *thd): Item_basic_constant(thd) - { } - enum Type type() const { return CONST_ITEM; } - bool check_partition_func_processor(void *int_arg) { return false;} - bool const_item() const { return true; } - bool basic_const_item() const { return true; } -}; - - -class Item_num: public Item_literal -{ -public: - Item_num(THD *thd): Item_literal(thd) { collation= DTCollation_numeric(); } - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } -}; - -#define NO_CACHED_FIELD_INDEX ((uint)(-1)) - -class st_select_lex; - - -class Item_result_field :public Item_fixed_hybrid /* Item with result field */ -{ -protected: - Field *create_tmp_field_ex_from_handler(MEM_ROOT *root, TABLE *table, - Tmp_field_src *src, - const Tmp_field_param *param, - const Type_handler *h); -public: - Field *result_field; /* Save result here */ - Item_result_field(THD *thd): Item_fixed_hybrid(thd), result_field(0) {} - // Constructor used for Item_sum/Item_cond_and/or (see Item comment) - Item_result_field(THD *thd, Item_result_field *item): - Item_fixed_hybrid(thd, item), result_field(item->result_field) - {} - ~Item_result_field() {} /* Required with gcc 2.95 */ - Field *get_tmp_table_field() { return result_field; } - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - DBUG_ASSERT(fixed); - const Type_handler *h= type_handler()->type_handler_for_tmp_table(this); - return create_tmp_field_ex_from_handler(root, table, src, param, h); - } - void get_tmp_field_src(Tmp_field_src *src, const Tmp_field_param *param); - /* - This implementation of used_tables() used by Item_avg_field and - Item_variance_field which work when only temporary table left, so theu - return table map of the temporary table. - */ - table_map used_tables() const { return 1; } - bool is_result_field() { return true; } - void save_in_result_field(bool no_conversions) - { - save_in_field(result_field, no_conversions); - } - void cleanup(); - bool check_vcol_func_processor(void *arg) { return FALSE;} -}; - - -class Item_ident :public Item_result_field -{ -protected: - /* - We have to store initial values of db_name, table_name and field_name - to be able to restore them during cleanup() because they can be - updated during fix_fields() to values from Field object and life-time - of those is shorter than life-time of Item_field. - */ - LEX_CSTRING orig_db_name; - LEX_CSTRING orig_table_name; - LEX_CSTRING orig_field_name; - - void undeclared_spvar_error() const; - -public: - Name_resolution_context *context; - LEX_CSTRING db_name; - LEX_CSTRING table_name; - LEX_CSTRING field_name; - bool alias_name_used; /* true if item was resolved against alias */ - /* - Cached value of index for this field in table->field array, used by prep. - stmts for speeding up their re-execution. Holds NO_CACHED_FIELD_INDEX - if index value is not known. - */ - uint cached_field_index; - /* - Cached pointer to table which contains this field, used for the same reason - by prep. stmt. too in case then we have not-fully qualified field. - 0 - means no cached value. - */ - TABLE_LIST *cached_table; - st_select_lex *depended_from; - /* - Some Items resolved in another select should not be marked as dependency - of the subquery where they are. During normal name resolution, we check - this. Stored procedures and prepared statements first try to resolve an - ident item using a cached table reference and field position from the - previous query execution (cached_table/cached_field_index). If the - tables were not changed, the ident matches the table/field, and we have - faster resolution of the ident without looking through all tables and - fields in the query. But in this case, we can not check all conditions - about this ident item dependency, so we should cache the condition in - this variable. - */ - bool can_be_depended; - Item_ident(THD *thd, Name_resolution_context *context_arg, - const LEX_CSTRING &db_name_arg, const LEX_CSTRING &table_name_arg, - const LEX_CSTRING &field_name_arg); - Item_ident(THD *thd, Item_ident *item); - Item_ident(THD *thd, TABLE_LIST *view_arg, const LEX_CSTRING &field_name_arg); - const char *full_name() const; - void cleanup(); - st_select_lex *get_depended_from() const; - bool remove_dependence_processor(void * arg); - virtual void print(String *str, enum_query_type query_type); - virtual bool change_context_processor(void *cntx) - { context= (Name_resolution_context *)cntx; return FALSE; } - /** - Collect outer references - */ - virtual bool collect_outer_ref_processor(void *arg); - friend bool insert_fields(THD *thd, Name_resolution_context *context, - const char *db_name, - const char *table_name, List_iterator *it, - bool any_privileges); -}; - - -class Item_field :public Item_ident, - public Load_data_outvar -{ -protected: - void set_field(Field *field); -public: - Field *field; - Item_equal *item_equal; - /* - if any_privileges set to TRUE then here real effective privileges will - be stored - */ - privilege_t have_privileges; - /* field need any privileges (for VIEW creation) */ - bool any_privileges; - Item_field(THD *thd, Name_resolution_context *context_arg, - const LEX_CSTRING &db_arg, const LEX_CSTRING &table_name_arg, - const LEX_CSTRING &field_name_arg); - Item_field(THD *thd, Name_resolution_context *context_arg, - const LEX_CSTRING &field_name_arg) - :Item_field(thd, context_arg, null_clex_str, null_clex_str, field_name_arg) - { } - Item_field(THD *thd, Name_resolution_context *context_arg) - :Item_field(thd, context_arg, null_clex_str, null_clex_str, null_clex_str) - { } - /* - Constructor needed to process subselect with temporary tables (see Item) - */ - Item_field(THD *thd, Item_field *item); - /* - Constructor used inside setup_wild(), ensures that field, table, - and database names will live as long as Item_field (this is important - in prepared statements). - */ - Item_field(THD *thd, Name_resolution_context *context_arg, Field *field); - /* - If this constructor is used, fix_fields() won't work, because - db_name, table_name and column_name are unknown. It's necessary to call - reset_field() before fix_fields() for all fields created this way. - */ - Item_field(THD *thd, Field *field); - enum Type type() const { return FIELD_ITEM; } - bool eq(const Item *item, bool binary_cmp) const; - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - String *val_str(String*); - void save_result(Field *to); - double val_result(); - longlong val_int_result(); - bool val_native(THD *thd, Native *to); - bool val_native_result(THD *thd, Native *to); - String *str_result(String* tmp); - my_decimal *val_decimal_result(my_decimal *); - bool val_bool_result(); - bool is_null_result(); - bool is_json_type(); - bool send(Protocol *protocol, st_value *buffer); - Load_data_outvar *get_load_data_outvar() - { - return this; - } - bool load_data_set_null(THD *thd, const Load_data_param *param) - { - return field->load_data_set_null(thd); - } - bool load_data_set_value(THD *thd, const char *pos, uint length, - const Load_data_param *param) - { - field->load_data_set_value(pos, length, param->charset()); - return false; - } - bool load_data_set_no_data(THD *thd, const Load_data_param *param); - void load_data_print_for_log_event(THD *thd, String *to) const; - bool load_data_add_outvar(THD *thd, Load_data_param *param) const - { - return param->add_outvar_field(thd, field); - } - uint load_data_fixed_length() const - { - return field->field_length; - } - void reset_field(Field *f); - bool fix_fields(THD *, Item **); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - void make_send_field(THD *thd, Send_field *tmp_field); - int save_in_field(Field *field,bool no_conversions); - void save_org_in_field(Field *field, fast_field_copier optimizer_data); - fast_field_copier setup_fast_field_copier(Field *field); - table_map used_tables() const; - table_map all_used_tables() const; - const Type_handler *type_handler() const - { - const Type_handler *handler= field->type_handler(); - return handler->type_handler_for_item_field(); - } - const Type_handler *real_type_handler() const - { - if (field->is_created_from_null_item) - return &type_handler_null; - return field->type_handler(); - } - Field *create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table, - Item_ref *orig_item, - const Tmp_field_param *param); - Field *create_tmp_field_ex(MEM_ROOT *root, - TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param); - const TYPELIB *get_typelib() const { return field->get_typelib(); } - enum_monotonicity_info get_monotonicity_info() const - { - return MONOTONIC_STRICT_INCREASING; - } - Sql_mode_dependency value_depends_on_sql_mode() const - { - return Sql_mode_dependency(0, field->value_depends_on_sql_mode()); - } - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool get_date_result(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate); - longlong val_datetime_packed(THD *thd); - longlong val_time_packed(THD *thd); - bool is_null() { return field->is_null(); } - void update_null_value(); - void update_table_bitmaps() - { - if (field && field->table) - { - TABLE *tab= field->table; - tab->covering_keys.intersect(field->part_of_key); - if (tab->read_set) - tab->mark_column_with_deps(field); - } - } - void update_used_tables() - { - update_table_bitmaps(); - } - COND *build_equal_items(THD *thd, COND_EQUAL *inherited, - bool link_item_fields, - COND_EQUAL **cond_equal_ref) - { - /* - normilize_cond() replaced all conditions of type - WHERE/HAVING field - to: - WHERE/HAVING field<>0 - By the time of a build_equal_items() call, all such conditions should - already be replaced. No Item_field are possible. - Note, some Item_field derivants are still possible. - Item_insert_value: - SELECT * FROM t1 WHERE VALUES(a); - Item_default_value: - SELECT * FROM t1 WHERE DEFAULT(a); - */ - DBUG_ASSERT(type() != FIELD_ITEM); - return Item_ident::build_equal_items(thd, inherited, link_item_fields, - cond_equal_ref); - } - bool is_result_field() { return false; } - void save_in_result_field(bool no_conversions); - Item *get_tmp_table_item(THD *thd); - bool find_not_null_fields(table_map allowed); - bool collect_item_field_processor(void * arg); - bool unknown_splocal_processor(void *arg); - bool add_field_to_set_processor(void * arg); - bool find_item_in_field_list_processor(void *arg); - bool register_field_in_read_map(void *arg); - bool register_field_in_write_map(void *arg); - bool register_field_in_bitmap(void *arg); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool post_fix_fields_part_expr_processor(void *bool_arg); - bool check_valid_arguments_processor(void *bool_arg); - bool check_field_expression_processor(void *arg); - bool enumerate_field_refs_processor(void *arg); - bool update_table_bitmaps_processor(void *arg); - bool switch_to_nullable_fields_processor(void *arg); - bool update_vcol_processor(void *arg); - bool rename_fields_processor(void *arg); - bool check_vcol_func_processor(void *arg); - bool set_fields_as_dependent_processor(void *arg) - { - if (!(used_tables() & OUTER_REF_TABLE_BIT)) - { - depended_from= (st_select_lex *) arg; - item_equal= NULL; - } - return 0; - } - void cleanup(); - Item_equal *get_item_equal() { return item_equal; } - void set_item_equal(Item_equal *item_eq) { item_equal= item_eq; } - Item_equal *find_item_equal(COND_EQUAL *cond_equal); - Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *); - Item *replace_equal_field(THD *thd, uchar *arg); - uint32 max_display_length() const { return field->max_display_length(); } - Item_field *field_for_view_update() { return this; } - int fix_outer_field(THD *thd, Field **field, Item **reference); - virtual Item *update_value_transformer(THD *thd, uchar *select_arg); - Item *derived_field_transformer_for_having(THD *thd, uchar *arg); - Item *derived_field_transformer_for_where(THD *thd, uchar *arg); - Item *grouping_field_transformer_for_where(THD *thd, uchar *arg); - Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg); - Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg); - virtual void print(String *str, enum_query_type query_type); - bool excl_dep_on_table(table_map tab_map); - bool excl_dep_on_grouping_fields(st_select_lex *sel); - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred); - bool cleanup_excluding_fields_processor(void *arg) - { return field ? 0 : cleanup_processor(arg); } - bool cleanup_excluding_const_fields_processor(void *arg) - { return field && const_item() ? 0 : cleanup_processor(arg); } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - bool is_outer_field() const - { - DBUG_ASSERT(fixed); - return field->table->pos_in_table_list->outer_join; - } - bool check_index_dependence(void *arg); - friend class Item_default_value; - friend class Item_insert_value; - friend class st_select_lex_unit; -}; - - -/** - Item_field for the ROW data type -*/ -class Item_field_row: public Item_field, - public Item_args -{ -public: - Item_field_row(THD *thd, Field *field) - :Item_field(thd, field), - Item_args() - { } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - - const Type_handler *type_handler() const { return &type_handler_row; } - uint cols() const { return arg_count; } - Item* element_index(uint i) { return arg_count ? args[i] : this; } - Item** addr(uint i) { return arg_count ? args + i : NULL; } - bool check_cols(uint c) - { - if (cols() != c) - { - my_error(ER_OPERAND_COLUMNS, MYF(0), c); - return true; - } - return false; - } - bool row_create_items(THD *thd, List *list); -}; - - -/* - @brief - Item_temptable_field is the same as Item_field, except that print() - continues to work even if the table has been dropped. - - @detail - - We need this item for "ANALYZE statement" feature. Query execution has - these steps: - - 1. Run the query. - 2. Cleanup starts. Temporary tables are destroyed - 3. print "ANALYZE statement" output, if needed - 4. Call close_thread_table() for regular tables. - - Step #4 is done after step #3, so "ANALYZE stmt" has no problem printing - Item_field objects that refer to regular tables. - - However, Step #3 is done after Step #2. Attempt to print Item_field objects - that refer to temporary tables will cause access to freed memory. - - To resolve this, we use Item_temptable_field to refer to items in temporary - (work) tables. -*/ - -class Item_temptable_field :public Item_field -{ -public: - Item_temptable_field(THD *thd, Name_resolution_context *context_arg, Field *field) - : Item_field(thd, context_arg, field) {} - - Item_temptable_field(THD *thd, Field *field) - : Item_field(thd, field) {} - - Item_temptable_field(THD *thd, Item_field *item) : Item_field(thd, item) {}; - - virtual void print(String *str, enum_query_type query_type); -}; - - -class Item_null :public Item_basic_constant -{ -public: - Item_null(THD *thd, const char *name_par=0, CHARSET_INFO *cs= &my_charset_bin): - Item_basic_constant(thd) - { - maybe_null= null_value= TRUE; - max_length= 0; - name.str= name_par ? name_par : "NULL"; - name.length= strlen(name.str); - collation.set(cs, DERIVATION_IGNORABLE, MY_REPERTOIRE_ASCII); - } - enum Type type() const { return NULL_ITEM; } - bool vcol_assignment_allowed_value() const { return true; } - double val_real(); - longlong val_int(); - String *val_str(String *str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - longlong val_datetime_packed(THD *); - longlong val_time_packed(THD *); - int save_in_field(Field *field, bool no_conversions); - int save_safe_in_field(Field *field); - bool send(Protocol *protocol, st_value *buffer); - const Type_handler *type_handler() const { return &type_handler_null; } - bool basic_const_item() const { return 1; } - Item *clone_item(THD *thd); - bool const_is_null() const { return true; } - bool is_null() { return 1; } - - virtual inline void print(String *str, enum_query_type query_type) - { - str->append(STRING_WITH_LEN("NULL")); - } - - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - Item_basic_constant *make_string_literal_concat(THD *thd, - const LEX_CSTRING *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_null_result :public Item_null -{ -public: - Field *result_field; - Item_null_result(THD *thd): Item_null(thd), result_field(0) {} - bool is_result_field() { return result_field != 0; } - const Type_handler *type_handler() const - { - if (result_field) - return result_field->type_handler(); - return &type_handler_null; - } - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - DBUG_ASSERT(0); - return NULL; - } - void save_in_result_field(bool no_conversions) - { - save_in_field(result_field, no_conversions); - } - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE); - } -}; - -/* - Item represents one placeholder ('?') of prepared statement - - Notes: - Item_param::field_type() is used when this item is in a temporary table. - This is NOT placeholder metadata sent to client, as this value - is assigned after sending metadata (in setup_one_conversion_function). - For example in case of 'SELECT ?' you'll get MYSQL_TYPE_STRING both - in result set and placeholders metadata, no matter what type you will - supply for this placeholder in mysql_stmt_execute. - - Item_param has two Type_handler pointers, - which can point to different handlers: - - 1. In the Type_handler_hybrid_field_type member - It's initialized in: - - Item_param::setup_conversion(), for client-server PS protocol, - according to the bind type. - - Item_param::set_from_item(), for EXECUTE and EXECUTE IMMEDIATE, - according to the actual parameter data type. - - 2. In the "value" member. - It's initialized in: - - Item_param::set_param_func(), for client-server PS protocol. - - Item_param::set_from_item(), for EXECUTE and EXECUTE IMMEDIATE. -*/ - -class Item_param :public Item_basic_value, - private Settable_routine_parameter, - public Rewritable_query_parameter, - private Type_handler_hybrid_field_type -{ - /* - NO_VALUE is a special value meaning that the parameter has not been - assigned yet. Item_param::state is assigned to NO_VALUE in constructor - and is used at prepare time. - - 1. At prepare time - Item_param::fix_fields() sets "fixed" to true, - but as Item_param::state is still NO_VALUE, - Item_param::basic_const_item() returns false. This prevents various - optimizations to happen at prepare time fix_fields(). - For example, in this query: - PREPARE stmt FROM 'SELECT FORMAT(10000,2,?)'; - Item_param::basic_const_item() is tested from - Item_func_format::fix_length_and_dec(). - - 2. At execute time: - When Item_param gets a value - (or a pseudo-value like DEFAULT_VALUE or IGNORE_VALUE): - - Item_param::state changes from NO_VALUE to something else - - Item_param::fixed is changed to true - All Item_param::set_xxx() make sure to do so. - In the state with an assigned value: - - Item_param::basic_const_item() returns true - - Item::type() returns NULL_ITEM or CONST_ITEM, - depending on the value assigned. - So in this state Item_param behaves in many cases like a literal. - - When Item_param::cleanup() is called: - - Item_param::state does not change - - Item_param::fixed changes to false - Note, this puts Item_param into an inconsistent state: - - Item_param::basic_const_item() still returns "true" - - Item_param::type() still pretends to be a basic constant Item - Both are not expected in combination with fixed==false. - However, these methods are not really called in this state, - see asserts in Item_param::basic_const_item() and Item_param::type(). - - When Item_param::reset() is called: - - Item_param::state changes to NO_VALUE - - Item_param::fixed changes to false - */ - enum enum_item_param_state - { - NO_VALUE, NULL_VALUE, SHORT_DATA_VALUE, LONG_DATA_VALUE, - DEFAULT_VALUE, IGNORE_VALUE - } state; - - void fix_temporal(uint32 max_length_arg, uint decimals_arg); - - struct CONVERSION_INFO - { - /* - Character sets conversion info for string values. - Character sets of client and connection defined at bind time are used - for all conversions, even if one of them is later changed (i.e. - between subsequent calls to mysql_stmt_execute). - */ - CHARSET_INFO *character_set_client; - CHARSET_INFO *character_set_of_placeholder; - /* - This points at character set of connection if conversion - to it is required (i. e. if placeholder typecode is not BLOB). - Otherwise it's equal to character_set_client (to simplify - check in convert_str_value()). - */ - CHARSET_INFO *final_character_set_of_str_value; - private: - bool needs_conversion() const - { - return final_character_set_of_str_value != - character_set_of_placeholder; - } - bool convert(THD *thd, String *str); - public: - void set(THD *thd, CHARSET_INFO *cs); - bool convert_if_needed(THD *thd, String *str) - { - /* - Check is so simple because all charsets were set up properly - in setup_one_conversion_function, where typecode of - placeholder was also taken into account: the variables are different - here only if conversion is really necessary. - */ - if (needs_conversion()) - return convert(thd, str); - str->set_charset(final_character_set_of_str_value); - return false; - } - }; - - bool m_empty_string_is_null; - - class PValue_simple - { - public: - union - { - longlong integer; - double real; - CONVERSION_INFO cs_info; - MYSQL_TIME time; - }; - void swap(PValue_simple &other) - { - swap_variables(PValue_simple, *this, other); - } - }; - - class PValue: public Type_handler_hybrid_field_type, - public PValue_simple, - public Value_source - { - public: - PValue(): Type_handler_hybrid_field_type(&type_handler_null) {} - my_decimal m_decimal; - String m_string; - /* - A buffer for string and long data values. Historically all allocated - values returned from val_str() were treated as eligible to - modification. I. e. in some cases Item_func_concat can append it's - second argument to return value of the first one. Because of that we - can't return the original buffer holding string data from val_str(), - and have to have one buffer for data and another just pointing to - the data. This is the latter one and it's returned from val_str(). - Can not be declared inside the union as it's not a POD type. - */ - String m_string_ptr; - - void swap(PValue &other) - { - Type_handler_hybrid_field_type::swap(other); - PValue_simple::swap(other); - m_decimal.swap(other.m_decimal); - m_string.swap(other.m_string); - m_string_ptr.swap(other.m_string_ptr); - } - double val_real() const; - longlong val_int(const Type_std_attributes *attr) const; - my_decimal *val_decimal(my_decimal *dec, const Type_std_attributes *attr); - String *val_str(String *str, const Type_std_attributes *attr); - }; - - PValue value; - - const String *value_query_val_str(THD *thd, String* str) const; - Item *value_clone_item(THD *thd); - bool is_evaluable_expression() const; - bool can_return_value() const; - -public: - /* - Used for bulk protocol only. - */ - enum enum_indicator_type indicator; - - const Type_handler *type_handler() const - { return Type_handler_hybrid_field_type::type_handler(); } - - bool vcol_assignment_allowed_value() const - { - switch (state) { - case NULL_VALUE: - case DEFAULT_VALUE: - case IGNORE_VALUE: - return true; - case NO_VALUE: - case SHORT_DATA_VALUE: - case LONG_DATA_VALUE: - break; - } - return false; - } - - Item_param(THD *thd, const LEX_CSTRING *name_arg, - uint pos_in_query_arg, uint len_in_query_arg); - - enum Type type() const - { - // Don't pretend to be a constant unless value for this item is set. - switch (state) { - case NO_VALUE: return PARAM_ITEM; - case NULL_VALUE: return NULL_ITEM; - case SHORT_DATA_VALUE: return CONST_ITEM; - case LONG_DATA_VALUE: return CONST_ITEM; - case DEFAULT_VALUE: return PARAM_ITEM; - case IGNORE_VALUE: return PARAM_ITEM; - } - DBUG_ASSERT(0); - return PARAM_ITEM; - } - - bool is_order_clause_position() const - { - return state == SHORT_DATA_VALUE && - type_handler()->is_order_clause_position_type(); - } - - const Item_const *get_item_const() const - { - switch (state) { - case SHORT_DATA_VALUE: - case LONG_DATA_VALUE: - case NULL_VALUE: - return this; - case IGNORE_VALUE: - case DEFAULT_VALUE: - case NO_VALUE: - break; - } - return NULL; - } - - bool const_is_null() const { return state == NULL_VALUE; } - bool can_return_const_value(Item_result type) const - { - return can_return_value() && - value.type_handler()->cmp_type() == type && - type_handler()->cmp_type() == type; - } - const longlong *const_ptr_longlong() const - { return can_return_const_value(INT_RESULT) ? &value.integer : NULL; } - const double *const_ptr_double() const - { return can_return_const_value(REAL_RESULT) ? &value.real : NULL; } - const my_decimal *const_ptr_my_decimal() const - { return can_return_const_value(DECIMAL_RESULT) ? &value.m_decimal : NULL; } - const MYSQL_TIME *const_ptr_mysql_time() const - { return can_return_const_value(TIME_RESULT) ? &value.time : NULL; } - const String *const_ptr_string() const - { return can_return_const_value(STRING_RESULT) ? &value.m_string : NULL; } - - double val_real() - { - return can_return_value() ? value.val_real() : 0e0; - } - longlong val_int() - { - return can_return_value() ? value.val_int(this) : 0; - } - my_decimal *val_decimal(my_decimal *dec) - { - return can_return_value() ? value.val_decimal(dec, this) : NULL; - } - String *val_str(String *str) - { - return can_return_value() ? value.val_str(str, this) : NULL; - } - bool get_date(THD *thd, MYSQL_TIME *tm, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to) - { - return Item_param::type_handler()->Item_param_val_native(thd, this, to); - } - - int save_in_field(Field *field, bool no_conversions); - - void set_default(); - void set_ignore(); - void set_null(); - void set_int(longlong i, uint32 max_length_arg); - void set_double(double i); - void set_decimal(const char *str, ulong length); - void set_decimal(const my_decimal *dv, bool unsigned_arg); - bool set_str(const char *str, ulong length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs); - bool set_longdata(const char *str, ulong length); - void set_time(MYSQL_TIME *tm, timestamp_type type, uint32 max_length_arg); - void set_time(const MYSQL_TIME *tm, uint32 max_length_arg, uint decimals_arg); - bool set_from_item(THD *thd, Item *item); - void reset(); - - void set_param_tiny(uchar **pos, ulong len); - void set_param_short(uchar **pos, ulong len); - void set_param_int32(uchar **pos, ulong len); - void set_param_int64(uchar **pos, ulong len); - void set_param_float(uchar **pos, ulong len); - void set_param_double(uchar **pos, ulong len); - void set_param_decimal(uchar **pos, ulong len); - void set_param_time(uchar **pos, ulong len); - void set_param_datetime(uchar **pos, ulong len); - void set_param_date(uchar **pos, ulong len); - void set_param_str(uchar **pos, ulong len); - - void setup_conversion(THD *thd, uchar param_type); - void setup_conversion_blob(THD *thd); - void setup_conversion_string(THD *thd, CHARSET_INFO *fromcs); - - /* - Assign placeholder value from bind data. - Note, that 'len' has different semantics in embedded library (as we - don't need to check that packet is not broken there). See - sql_prepare.cc for details. - */ - void set_param_func(uchar **pos, ulong len) - { - /* - To avoid Item_param::set_xxx() asserting on data type mismatch, - we set the value type handler here: - - It can not be initialized yet after Item_param::setup_conversion(). - - Also, for LIMIT clause parameters, the value type handler might have - changed from the real type handler to type_handler_longlong. - So here we'll restore it. - */ - const Type_handler *h= Item_param::type_handler(); - value.set_handler(h); - h->Item_param_set_param_func(this, pos, len); - } - - bool set_value(THD *thd, const Type_all_attributes *attr, - const st_value *val, const Type_handler *h) - { - value.set_handler(h); // See comments in set_param_func() - return h->Item_param_set_from_value(thd, this, attr, val); - } - - bool set_limit_clause_param(longlong nr) - { - value.set_handler(&type_handler_slonglong); - set_int(nr, MY_INT64_NUM_DECIMAL_DIGITS); - return !unsigned_flag && value.integer < 0; - } - const String *query_val_str(THD *thd, String *str) const; - - bool convert_str_value(THD *thd); - - /* - If value for parameter was not set we treat it as non-const - so no one will use parameters value in fix_fields still - parameter is constant during execution. - */ - bool const_item() const - { - return state != NO_VALUE; - } - virtual table_map used_tables() const - { - return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; - } - virtual void print(String *str, enum_query_type query_type); - bool is_null() - { DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; } - bool basic_const_item() const; - bool has_no_value() const - { - return state == NO_VALUE; - } - bool has_long_data_value() const - { - return state == LONG_DATA_VALUE; - } - bool has_int_value() const - { - return state == SHORT_DATA_VALUE && - value.type_handler()->cmp_type() == INT_RESULT; - } - /* - This method is used to make a copy of a basic constant item when - propagating constants in the optimizer. The reason to create a new - item and not use the existing one is not precisely known (2005/04/16). - Probably we are trying to preserve tree structure of items, in other - words, avoid pointing at one item from two different nodes of the tree. - Return a new basic constant item if parameter value is a basic - constant, assert otherwise. This method is called only if - basic_const_item returned TRUE. - */ - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - Item *clone_item(THD *thd); - void set_param_type_and_swap_value(Item_param *from); - - Rewritable_query_parameter *get_rewritable_query_parameter() - { return this; } - Settable_routine_parameter *get_settable_routine_parameter() - { return m_is_settable_routine_parameter ? this : NULL; } - - bool append_for_log(THD *thd, String *str); - bool check_vcol_func_processor(void *int_arg) {return FALSE;} - Item *get_copy(THD *thd) { return 0; } - - bool add_as_clone(THD *thd); - void sync_clones(); - bool register_clone(Item_param *i) { return m_clones.push_back(i); } - -private: - void invalid_default_param() const; - - virtual bool set_value(THD *thd, sp_rcontext *ctx, Item **it); - - virtual void set_out_param_info(Send_field *info); - -public: - virtual const Send_field *get_out_param_info() const; - - Item_param *get_item_param() { return this; } - - virtual void make_send_field(THD *thd, Send_field *field); - -private: - Send_field *m_out_param_info; - bool m_is_settable_routine_parameter; - /* - Array of all references of this parameter marker used in a CTE to its clones - created for copies of this marker used the CTE's copies. It's used to - synchronize the actual value of the parameter with the values of the clones. - */ - Mem_root_array m_clones; -}; - - -class Item_int :public Item_num -{ -public: - longlong value; - Item_int(THD *thd, int32 i,size_t length= MY_INT32_NUM_DECIMAL_DIGITS): - Item_num(thd), value((longlong) i) - { max_length=(uint32)length; } - Item_int(THD *thd, longlong i,size_t length= MY_INT64_NUM_DECIMAL_DIGITS): - Item_num(thd), value(i) - { max_length=(uint32)length; } - Item_int(THD *thd, ulonglong i, size_t length= MY_INT64_NUM_DECIMAL_DIGITS): - Item_num(thd), value((longlong)i) - { max_length=(uint32)length; unsigned_flag= 1; } - Item_int(THD *thd, const char *str_arg,longlong i,size_t length): - Item_num(thd), value(i) - { - max_length=(uint32)length; - name.str= str_arg; name.length= safe_strlen(name.str); - } - Item_int(THD *thd, const char *str_arg,longlong i,size_t length, bool flag): - Item_num(thd), value(i) - { - max_length=(uint32)length; - name.str= str_arg; name.length= safe_strlen(name.str); - unsigned_flag= flag; - } - Item_int(THD *thd, const char *str_arg, size_t length=64); - const Type_handler *type_handler() const - { return type_handler_long_or_longlong(); } - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) - { return tmp_table_field_from_field_type(root, table); } - const longlong *const_ptr_longlong() const { return &value; } - longlong val_int() { return value; } - longlong val_int_min() const { return value; } - double val_real() { return (double) value; } - my_decimal *val_decimal(my_decimal *); - String *val_str(String*); - int save_in_field(Field *field, bool no_conversions); - bool is_order_clause_position() const { return true; } - Item *clone_item(THD *thd); - virtual void print(String *str, enum_query_type query_type); - Item *neg(THD *thd); - uint decimal_precision() const - { return (uint) (max_length - MY_TEST(value < 0)); } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - We sometimes need to distinguish a number from a boolean: - a[1] and a[true] are different things in XPath. - Also in JSON boolean values should be treated differently. -*/ -class Item_bool :public Item_int -{ -public: - Item_bool(THD *thd, const char *str_arg, longlong i): - Item_int(thd, str_arg, i, 1) {} - Item_bool(THD *thd, bool i) :Item_int(thd, (longlong) i, 1) { } - bool is_bool_literal() const { return true; } - Item *neg_transformer(THD *thd); - const Type_handler *type_handler() const - { return &type_handler_bool; } - const Type_handler *fixed_type_handler() const - { return &type_handler_bool; } - void quick_fix_field() - { - /* - We can get here when Item_bool is created instead of a constant - predicate at various condition optimization stages in sql_select. - */ - } -}; - - -class Item_uint :public Item_int -{ -public: - Item_uint(THD *thd, const char *str_arg, size_t length); - Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {} - Item_uint(THD *thd, const char *str_arg, longlong i, uint length); - double val_real() { return ulonglong2double((ulonglong)value); } - Item *clone_item(THD *thd); - Item *neg(THD *thd); - uint decimal_precision() const { return max_length; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_datetime :public Item_int -{ -protected: - MYSQL_TIME ltime; -public: - Item_datetime(THD *thd): Item_int(thd, 0) { unsigned_flag=0; } - int save_in_field(Field *field, bool no_conversions); - longlong val_int(); - double val_real() { return (double)val_int(); } - void set(longlong packed, enum_mysql_timestamp_type ts_type); - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) - { - *to= ltime; - return false; - } -}; - - -/* decimal (fixed point) constant */ -class Item_decimal :public Item_num -{ -protected: - my_decimal decimal_value; -public: - Item_decimal(THD *thd, const char *str_arg, size_t length, - CHARSET_INFO *charset); - Item_decimal(THD *thd, const char *str, const my_decimal *val_arg, - uint decimal_par, uint length); - Item_decimal(THD *thd, const my_decimal *value_par); - Item_decimal(THD *thd, longlong val, bool unsig); - Item_decimal(THD *thd, double val, int precision, int scale); - Item_decimal(THD *thd, const uchar *bin, int precision, int scale); - - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - longlong val_int() { return decimal_value.to_longlong(unsigned_flag); } - double val_real() { return decimal_value.to_double(); } - String *val_str(String *to) { return decimal_value.to_string(to); } - my_decimal *val_decimal(my_decimal *val) { return &decimal_value; } - const my_decimal *const_ptr_my_decimal() const { return &decimal_value; } - int save_in_field(Field *field, bool no_conversions); - Item *clone_item(THD *thd); - virtual void print(String *str, enum_query_type query_type) - { - decimal_value.to_string(&str_value); - str->append(str_value); - } - Item *neg(THD *thd); - uint decimal_precision() const { return decimal_value.precision(); } - void set_decimal_value(my_decimal *value_par); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_float :public Item_num -{ - const char *presentation; -public: - double value; - Item_float(THD *thd, const char *str_arg, size_t length); - Item_float(THD *thd, const char *str, double val_arg, uint decimal_par, - uint length): Item_num(thd), value(val_arg) - { - presentation= name.str= str; - name.length= safe_strlen(str); - decimals=(uint8) decimal_par; - max_length= length; - } - Item_float(THD *thd, double value_par, uint decimal_par): - Item_num(thd), presentation(0), value(value_par) - { - decimals= (uint8) decimal_par; - } - int save_in_field(Field *field, bool no_conversions); - const Type_handler *type_handler() const { return &type_handler_double; } - const double *const_ptr_double() const { return &value; } - double val_real() { return value; } - longlong val_int() - { - if (value <= (double) LONGLONG_MIN) - { - return LONGLONG_MIN; - } - else if (value >= (double) (ulonglong) LONGLONG_MAX) - { - return LONGLONG_MAX; - } - return (longlong) rint(value); - } - String *val_str(String*); - my_decimal *val_decimal(my_decimal *); - Item *clone_item(THD *thd); - Item *neg(THD *thd); - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_static_float_func :public Item_float -{ - const char *func_name; -public: - Item_static_float_func(THD *thd, const char *str, double val_arg, - uint decimal_par, uint length): - Item_float(thd, NullS, val_arg, decimal_par, length), func_name(str) - {} - - virtual inline void print(String *str, enum_query_type query_type) - { - str->append(func_name); - } - - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) - { - return const_charset_converter(thd, tocs, true, func_name); - } -}; - - -class Item_string :public Item_literal -{ -protected: - void fix_from_value(Derivation dv, const Metadata metadata) - { - fix_charset_and_length(str_value.charset(), dv, metadata); - } - void fix_and_set_name_from_value(THD *thd, Derivation dv, - const Metadata metadata) - { - fix_from_value(dv, metadata); - set_name(thd, &str_value); - } -protected: - /* Just create an item and do not fill string representation */ - Item_string(THD *thd, CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE): - Item_literal(thd) - { - collation.set(cs, dv); - max_length= 0; - set_name(thd, NULL, 0, system_charset_info); - decimals= NOT_FIXED_DEC; - } -public: - Item_string(THD *thd, CHARSET_INFO *csi, const char *str_arg, uint length_arg) - :Item_literal(thd) - { - collation.set(csi, DERIVATION_COERCIBLE); - set_name(thd, NULL, 0, system_charset_info); - decimals= NOT_FIXED_DEC; - str_value.copy(str_arg, length_arg, csi); - max_length= str_value.numchars() * csi->mbmaxlen; - } - // Constructors with the item name set from its value - Item_string(THD *thd, const char *str, uint length, CHARSET_INFO *cs, - Derivation dv, my_repertoire_t repertoire) - :Item_literal(thd) - { - str_value.set_or_copy_aligned(str, length, cs); - fix_and_set_name_from_value(thd, dv, Metadata(&str_value, repertoire)); - } - Item_string(THD *thd, const char *str, size_t length, - CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) - :Item_literal(thd) - { - str_value.set_or_copy_aligned(str, length, cs); - fix_and_set_name_from_value(thd, dv, Metadata(&str_value)); - } - Item_string(THD *thd, const String *str, CHARSET_INFO *tocs, uint *conv_errors, - Derivation dv, my_repertoire_t repertoire) - :Item_literal(thd) - { - if (str_value.copy(str, tocs, conv_errors)) - str_value.set("", 0, tocs); // EOM ? - str_value.mark_as_const(); - fix_and_set_name_from_value(thd, dv, Metadata(&str_value, repertoire)); - } - // Constructors with an externally provided item name - Item_string(THD *thd, const LEX_CSTRING &name_par, const LEX_CSTRING &str, - CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) - :Item_literal(thd) - { - str_value.set_or_copy_aligned(str.str, str.length, cs); - fix_from_value(dv, Metadata(&str_value)); - set_name(thd, name_par); - } - Item_string(THD *thd, const LEX_CSTRING &name_par, const LEX_CSTRING &str, - CHARSET_INFO *cs, Derivation dv, my_repertoire_t repertoire) - :Item_literal(thd) - { - str_value.set_or_copy_aligned(str.str, str.length, cs); - fix_from_value(dv, Metadata(&str_value, repertoire)); - set_name(thd, name_par); - } - void print_value(String *to) const - { - str_value.print(to); - } - double val_real(); - longlong val_int(); - const String *const_ptr_string() const - { - return &str_value; - } - String *val_str(String*) - { - return (String*) &str_value; - } - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return get_date_from_string(thd, ltime, fuzzydate); - } - int save_in_field(Field *field, bool no_conversions); - const Type_handler *type_handler() const { return &type_handler_varchar; } - Item *clone_item(THD *thd); - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) - { - return const_charset_converter(thd, tocs, true); - } - inline void append(const char *str, uint length) - { - str_value.append(str, length); - max_length= str_value.numchars() * collation.collation->mbmaxlen; - } - virtual void print(String *str, enum_query_type query_type); - - /** - Return TRUE if character-set-introducer was explicitly specified in the - original query for this item (text literal). - - This operation is to be called from Item_string::print(). The idea is - that when a query is generated (re-constructed) from the Item-tree, - character-set-introducers should appear only for those literals, where - they were explicitly specified by the user. Otherwise, that may lead to - loss collation information (character set introducers implies default - collation for the literal). - - Basically, that makes sense only for views and hopefully will be gone - one day when we start using original query as a view definition. - - @return This operation returns the value of m_cs_specified attribute. - @retval TRUE if character set introducer was explicitly specified in - the original query. - @retval FALSE otherwise. - */ - virtual bool is_cs_specified() const - { - return false; - } - - String *check_well_formed_result(bool send_error) - { return Item::check_well_formed_result(&str_value, send_error); } - - Item_basic_constant *make_string_literal_concat(THD *thd, - const LEX_CSTRING *); - Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr); - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - -}; - - -class Item_string_with_introducer :public Item_string -{ -public: - Item_string_with_introducer(THD *thd, const LEX_CSTRING &str, - CHARSET_INFO *cs): - Item_string(thd, str.str, str.length, cs) - { } - Item_string_with_introducer(THD *thd, const LEX_CSTRING &name_arg, - const LEX_CSTRING &str, CHARSET_INFO *tocs): - Item_string(thd, name_arg, str, tocs) - { } - virtual bool is_cs_specified() const - { - return true; - } -}; - - -class Item_string_sys :public Item_string -{ -public: - Item_string_sys(THD *thd, const char *str, uint length): - Item_string(thd, str, length, system_charset_info) - { } - Item_string_sys(THD *thd, const char *str): - Item_string(thd, str, (uint) strlen(str), system_charset_info) - { } -}; - - -class Item_string_ascii :public Item_string -{ -public: - Item_string_ascii(THD *thd, const char *str, uint length): - Item_string(thd, str, length, &my_charset_latin1, - DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII) - { } - Item_string_ascii(THD *thd, const char *str): - Item_string(thd, str, (uint) strlen(str), &my_charset_latin1, - DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII) - { } -}; - - -class Item_static_string_func :public Item_string -{ - const LEX_CSTRING func_name; -public: - Item_static_string_func(THD *thd, const LEX_CSTRING &name_par, - const LEX_CSTRING &str, CHARSET_INFO *cs, - Derivation dv= DERIVATION_COERCIBLE): - Item_string(thd, LEX_CSTRING({NullS,0}), str, cs, dv), func_name(name_par) - {} - Item_static_string_func(THD *thd, const LEX_CSTRING &name_par, - const String *str, - CHARSET_INFO *tocs, uint *conv_errors, - Derivation dv, my_repertoire_t repertoire): - Item_string(thd, str, tocs, conv_errors, dv, repertoire), - func_name(name_par) - {} - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) - { - return const_charset_converter(thd, tocs, true, func_name.str); - } - - virtual inline void print(String *str, enum_query_type query_type) - { - str->append(func_name); - } - - bool check_partition_func_processor(void *int_arg) {return TRUE;} - - bool check_vcol_func_processor(void *arg) - { // VCOL_TIME_FUNC because the value is not constant, but does not - // require fix_fields() to be re-run for every statement. - return mark_unsupported_function(func_name.str, arg, VCOL_TIME_FUNC); - } -}; - - -/* for show tables */ -class Item_partition_func_safe_string: public Item_string -{ -public: - Item_partition_func_safe_string(THD *thd, const LEX_CSTRING &name_arg, - uint length, CHARSET_INFO *cs): - Item_string(thd, name_arg, LEX_CSTRING({0,0}), cs) - { - max_length= length; - } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function("safe_string", arg, VCOL_IMPOSSIBLE); - } -}; - - -/** - Item_empty_string -- is a utility class to put an item into List - which is then used in protocol.send_result_set_metadata() when sending SHOW output to - the client. -*/ - -class Item_empty_string :public Item_partition_func_safe_string -{ -public: - Item_empty_string(THD *thd, const LEX_CSTRING &header, uint length, - CHARSET_INFO *cs= &my_charset_utf8mb3_general_ci) - :Item_partition_func_safe_string(thd, header, length * cs->mbmaxlen, cs) - { } - Item_empty_string(THD *thd, const char *header, uint length, - CHARSET_INFO *cs= &my_charset_utf8mb3_general_ci) - :Item_partition_func_safe_string(thd, LEX_CSTRING({header, strlen(header)}), - length * cs->mbmaxlen, cs) - { } - void make_send_field(THD *thd, Send_field *field); -}; - - -class Item_return_int :public Item_int -{ - enum_field_types int_field_type; -public: - Item_return_int(THD *thd, const char *name_arg, uint length, - enum_field_types field_type_arg, longlong value_arg= 0): - Item_int(thd, name_arg, value_arg, length), int_field_type(field_type_arg) - { - unsigned_flag=1; - } - const Type_handler *type_handler() const - { - const Type_handler *h= - Type_handler::get_handler_by_field_type(int_field_type); - return unsigned_flag ? h->type_handler_unsigned() : h; - } -}; - - -/** - Item_hex_constant -- a common class for hex literals: X'HHHH' and 0xHHHH -*/ -class Item_hex_constant: public Item_literal -{ -private: - void hex_string_init(THD *thd, const char *str, size_t str_length); -public: - Item_hex_constant(THD *thd): Item_literal(thd) - { - hex_string_init(thd, "", 0); - } - Item_hex_constant(THD *thd, const char *str, size_t str_length): - Item_literal(thd) - { - hex_string_init(thd, str, str_length); - } - const Type_handler *type_handler() const { return &type_handler_varchar; } - virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) - { - return const_charset_converter(thd, tocs, true); - } - const String *const_ptr_string() const { return &str_value; } - String *val_str(String*) { return &str_value; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } -}; - - -/** - Item_hex_hybrid -- is a class implementing 0xHHHH literals, e.g.: - SELECT 0x3132; - They can behave as numbers and as strings depending on context. -*/ -class Item_hex_hybrid: public Item_hex_constant -{ -public: - Item_hex_hybrid(THD *thd): Item_hex_constant(thd) {} - Item_hex_hybrid(THD *thd, const char *str, size_t str_length): - Item_hex_constant(thd, str, str_length) {} - const Type_handler *type_handler() const { return &type_handler_hex_hybrid; } - uint decimal_precision() const; - double val_real() - { - return (double) (ulonglong) Item_hex_hybrid::val_int(); - } - longlong val_int() - { - return longlong_from_hex_hybrid(str_value.ptr(), str_value.length()); - } - my_decimal *val_decimal(my_decimal *decimal_value) - { - longlong value= Item_hex_hybrid::val_int(); - int2my_decimal(E_DEC_FATAL_ERROR, value, TRUE, decimal_value); - return decimal_value; - } - int save_in_field(Field *field, bool no_conversions) - { - field->set_notnull(); - return field->store_hex_hybrid(str_value.ptr(), str_value.length()); - } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - Item_hex_string -- is a class implementing X'HHHH' literals, e.g.: - SELECT X'3132'; - Unlike Item_hex_hybrid, X'HHHH' literals behave as strings in all contexts. - X'HHHH' are also used in replication of string constants in case of - "dangerous" charsets (sjis, cp932, big5, gbk) who can have backslash (0x5C) - as the second byte of a multi-byte character, so using '\' escaping for - these charsets is not desirable. -*/ -class Item_hex_string: public Item_hex_constant -{ -public: - Item_hex_string(THD *thd): Item_hex_constant(thd) {} - Item_hex_string(THD *thd, const char *str, size_t str_length): - Item_hex_constant(thd, str, str_length) {} - longlong val_int() - { - return longlong_from_string_with_check(&str_value); - } - double val_real() - { - return double_from_string_with_check(&str_value); - } - my_decimal *val_decimal(my_decimal *decimal_value) - { - return val_decimal_from_string(decimal_value); - } - int save_in_field(Field *field, bool no_conversions) - { - field->set_notnull(); - return field->store(str_value.ptr(), str_value.length(), - collation.collation); - } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_bin_string: public Item_hex_hybrid -{ -public: - Item_bin_string(THD *thd, const char *str, size_t str_length); -}; - - -class Item_timestamp_literal: public Item_literal -{ - Timestamp_or_zero_datetime m_value; -public: - Item_timestamp_literal(THD *thd) - :Item_literal(thd) - { } - const Type_handler *type_handler() const { return &type_handler_timestamp2; } - int save_in_field(Field *field, bool no_conversions) - { - Timestamp_or_zero_datetime_native native(m_value, decimals); - return native.save_in_field(field, decimals); - } - longlong val_int() - { - return m_value.to_datetime(current_thd).to_longlong(); - } - double val_real() - { - return m_value.to_datetime(current_thd).to_double(); - } - String *val_str(String *to) - { - return m_value.to_datetime(current_thd).to_string(to, decimals); - } - my_decimal *val_decimal(my_decimal *to) - { - return m_value.to_datetime(current_thd).to_decimal(to); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - bool res= m_value.to_TIME(thd, ltime, fuzzydate); - DBUG_ASSERT(!res); - return res; - } - bool val_native(THD *thd, Native *to) - { - return m_value.to_native(to, decimals); - } - void set_value(const Timestamp_or_zero_datetime &value) - { - m_value= value; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_temporal_literal :public Item_literal -{ -public: - Item_temporal_literal(THD *thd) - :Item_literal(thd) - { - collation= DTCollation_numeric(); - decimals= 0; - } - Item_temporal_literal(THD *thd, uint dec_arg): - Item_literal(thd) - { - collation= DTCollation_numeric(); - decimals= dec_arg; - } - - int save_in_field(Field *field, bool no_conversions) - { return save_date_in_field(field, no_conversions); } -}; - - -/** - DATE'2010-01-01' -*/ -class Item_date_literal: public Item_temporal_literal -{ -protected: - Date cached_time; - bool update_null() - { - return maybe_null && - (null_value= cached_time.check_date_with_warn(current_thd)); - } -public: - Item_date_literal(THD *thd, const Date *ltime) - :Item_temporal_literal(thd), - cached_time(*ltime) - { - DBUG_ASSERT(cached_time.is_valid_date()); - max_length= MAX_DATE_WIDTH; - /* - If date has zero month or day, it can return NULL in case of - NO_ZERO_DATE or NO_ZERO_IN_DATE. - If date is `February 30`, it can return NULL in case if - no ALLOW_INVALID_DATES is set. - We can't set null_value using the current sql_mode here in constructor, - because sql_mode can change in case of prepared statements - between PREPARE and EXECUTE. - Here we only set maybe_null to true if the value has such anomalies. - Later (during execution time), if maybe_null is true, then the value - will be checked per row, according to the execution time sql_mode. - The check_date() below call should cover all cases mentioned. - */ - maybe_null= cached_time.check_date(TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE); - } - const Type_handler *type_handler() const { return &type_handler_newdate; } - void print(String *str, enum_query_type query_type); - const MYSQL_TIME *const_ptr_mysql_time() const - { - return cached_time.get_mysql_time(); - } - Item *clone_item(THD *thd); - longlong val_int() - { - return update_null() ? 0 : cached_time.to_longlong(); - } - double val_real() - { - return update_null() ? 0 : cached_time.to_double(); - } - String *val_str(String *to) - { - return update_null() ? 0 : cached_time.to_string(to); - } - my_decimal *val_decimal(my_decimal *to) - { - return update_null() ? 0 : cached_time.to_decimal(to); - } - longlong val_datetime_packed(THD *thd) - { - return update_null() ? 0 : cached_time.valid_date_to_packed(); - } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - TIME'10:10:10' -*/ -class Item_time_literal: public Item_temporal_literal -{ -protected: - Time cached_time; -public: - Item_time_literal(THD *thd, const Time *ltime, uint dec_arg): - Item_temporal_literal(thd, dec_arg), - cached_time(*ltime) - { - DBUG_ASSERT(cached_time.is_valid_time()); - max_length= MIN_TIME_WIDTH + (decimals ? decimals + 1 : 0); - } - const Type_handler *type_handler() const { return &type_handler_time2; } - void print(String *str, enum_query_type query_type); - const MYSQL_TIME *const_ptr_mysql_time() const - { - return cached_time.get_mysql_time(); - } - Item *clone_item(THD *thd); - longlong val_int() { return cached_time.to_longlong(); } - double val_real() { return cached_time.to_double(); } - String *val_str(String *to) { return cached_time.to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) { return cached_time.to_decimal(to); } - longlong val_time_packed(THD *thd) - { - return cached_time.valid_time_to_packed(); - } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to) - { - return Time(thd, this).to_native(to, decimals); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - TIMESTAMP'2001-01-01 10:20:30' -*/ -class Item_datetime_literal: public Item_temporal_literal -{ -protected: - Datetime cached_time; - bool update_null() - { - return maybe_null && - (null_value= cached_time.check_date_with_warn(current_thd)); - } -public: - Item_datetime_literal(THD *thd, const Datetime *ltime, uint dec_arg): - Item_temporal_literal(thd, dec_arg), - cached_time(*ltime) - { - DBUG_ASSERT(cached_time.is_valid_datetime()); - max_length= MAX_DATETIME_WIDTH + (decimals ? decimals + 1 : 0); - // See the comment on maybe_null in Item_date_literal - maybe_null= cached_time.check_date(TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE); - } - const Type_handler *type_handler() const { return &type_handler_datetime2; } - void print(String *str, enum_query_type query_type); - const MYSQL_TIME *const_ptr_mysql_time() const - { - return cached_time.get_mysql_time(); - } - Item *clone_item(THD *thd); - longlong val_int() - { - return update_null() ? 0 : cached_time.to_longlong(); - } - double val_real() - { - return update_null() ? 0 : cached_time.to_double(); - } - String *val_str(String *to) - { - return update_null() ? NULL : cached_time.to_string(to, decimals); - } - my_decimal *val_decimal(my_decimal *to) - { - return update_null() ? NULL : cached_time.to_decimal(to); - } - longlong val_datetime_packed(THD *thd) - { - return update_null() ? 0 : cached_time.valid_datetime_to_packed(); - } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - An error-safe counterpart for Item_date_literal -*/ -class Item_date_literal_for_invalid_dates: public Item_date_literal -{ - /** - During equal field propagation we can replace non-temporal constants - found in equalities to their native temporal equivalents: - WHERE date_column='2001-01-01' ... -> - WHERE date_column=DATE'2001-01-01' ... - - This is done to make the eqial field propagation code handle mixtures of - different temporal types in the same expressions easier (MDEV-8706), e.g. - WHERE LENGTH(date_column)=10 AND date_column=TIME'00:00:00' - - Item_date_literal_for_invalid_dates::get_date() - (unlike the regular Item_date_literal::get_date()) - does not check the result for NO_ZERO_IN_DATE and NO_ZERO_DATE, - always returns success (false), and does not produce error/warning messages. - - We need these _for_invalid_dates classes to be able to rewrite: - SELECT * FROM t1 WHERE date_column='0000-00-00' ... - to: - SELECT * FROM t1 WHERE date_column=DATE'0000-00-00' ... - - to avoid returning NULL value instead of '0000-00-00' even - in sql_mode=TRADITIONAL. - */ -public: - Item_date_literal_for_invalid_dates(THD *thd, const Date *ltime) - :Item_date_literal(thd, ltime) - { - maybe_null= false; - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - cached_time.copy_to_mysql_time(ltime); - return (null_value= false); - } -}; - - -/** - An error-safe counterpart for Item_datetime_literal - (see Item_date_literal_for_invalid_dates for comments) -*/ -class Item_datetime_literal_for_invalid_dates: public Item_datetime_literal -{ -public: - Item_datetime_literal_for_invalid_dates(THD *thd, - const Datetime *ltime, uint dec_arg) - :Item_datetime_literal(thd, ltime, dec_arg) - { - maybe_null= false; - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - cached_time.copy_to_mysql_time(ltime); - return (null_value= false); - } -}; - - -class Used_tables_and_const_cache -{ -public: - /* - In some cases used_tables_cache is not what used_tables() return - so the method should be used where one need used tables bit map - (even internally in Item_func_* code). - */ - table_map used_tables_cache; - bool const_item_cache; - - Used_tables_and_const_cache() - :used_tables_cache(0), - const_item_cache(true) - { } - Used_tables_and_const_cache(const Used_tables_and_const_cache *other) - :used_tables_cache(other->used_tables_cache), - const_item_cache(other->const_item_cache) - { } - void used_tables_and_const_cache_init() - { - used_tables_cache= 0; - const_item_cache= true; - } - void used_tables_and_const_cache_join(const Item *item) - { - used_tables_cache|= item->used_tables(); - const_item_cache&= item->const_item(); - } - void used_tables_and_const_cache_update_and_join(Item *item) - { - item->update_used_tables(); - used_tables_and_const_cache_join(item); - } - /* - Call update_used_tables() for all "argc" items in the array "argv" - and join with the current cache. - "this" must be initialized with a constructor or - re-initialized with used_tables_and_const_cache_init(). - */ - void used_tables_and_const_cache_update_and_join(uint argc, Item **argv) - { - for (uint i=0 ; i < argc ; i++) - used_tables_and_const_cache_update_and_join(argv[i]); - } - /* - Call update_used_tables() for all items in the list - and join with the current cache. - "this" must be initialized with a constructor or - re-initialized with used_tables_and_const_cache_init(). - */ - void used_tables_and_const_cache_update_and_join(List &list) - { - List_iterator_fast li(list); - Item *item; - while ((item=li++)) - used_tables_and_const_cache_update_and_join(item); - } -}; - - -/** - An abstract class representing common features of - regular functions and aggregate functions. -*/ -class Item_func_or_sum: public Item_result_field, - public Item_args, - public Used_tables_and_const_cache, - public With_subquery_cache -{ -protected: - bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems, - uint flags, int item_sep) - { - return Type_std_attributes::agg_arg_charsets(c, func_name(), - items, nitems, - flags, item_sep); - } - bool agg_arg_charsets_for_string_result(DTCollation &c, - Item **items, uint nitems, - int item_sep= 1) - { - return Type_std_attributes:: - agg_arg_charsets_for_string_result(c, func_name(), - items, nitems, item_sep); - } - bool agg_arg_charsets_for_string_result_with_comparison(DTCollation &c, - Item **items, - uint nitems, - int item_sep= 1) - { - return Type_std_attributes:: - agg_arg_charsets_for_string_result_with_comparison(c, func_name(), - items, nitems, - item_sep); - } - - /* - Aggregate arguments for comparison, e.g: a=b, a LIKE b, a RLIKE b - - don't convert to @@character_set_connection if all arguments are numbers - - don't allow DERIVATION_NONE - */ - bool agg_arg_charsets_for_comparison(DTCollation &c, - Item **items, uint nitems, - int item_sep= 1) - { - return Type_std_attributes:: - agg_arg_charsets_for_comparison(c, func_name(), items, nitems, item_sep); - } - -public: - // This method is used by Arg_comparator - bool agg_arg_charsets_for_comparison(CHARSET_INFO **cs, Item **a, Item **b) - { - DTCollation tmp; - if (tmp.set((*a)->collation, (*b)->collation, MY_COLL_CMP_CONV) || - tmp.derivation == DERIVATION_NONE) - { - my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), - (*a)->collation.collation->name, - (*a)->collation.derivation_name(), - (*b)->collation.collation->name, - (*b)->collation.derivation_name(), - func_name()); - return true; - } - if (agg_item_set_converter(tmp, func_name(), - a, 1, MY_COLL_CMP_CONV, 1) || - agg_item_set_converter(tmp, func_name(), - b, 1, MY_COLL_CMP_CONV, 1)) - return true; - *cs= tmp.collation; - return false; - } - -public: - Item_func_or_sum(THD *thd): Item_result_field(thd), Item_args() {} - Item_func_or_sum(THD *thd, Item *a): Item_result_field(thd), Item_args(a) { } - Item_func_or_sum(THD *thd, Item *a, Item *b): - Item_result_field(thd), Item_args(a, b) { } - Item_func_or_sum(THD *thd, Item *a, Item *b, Item *c): - Item_result_field(thd), Item_args(thd, a, b, c) { } - Item_func_or_sum(THD *thd, Item *a, Item *b, Item *c, Item *d): - Item_result_field(thd), Item_args(thd, a, b, c, d) { } - Item_func_or_sum(THD *thd, Item *a, Item *b, Item *c, Item *d, Item *e): - Item_result_field(thd), Item_args(thd, a, b, c, d, e) { } - Item_func_or_sum(THD *thd, Item_func_or_sum *item): - Item_result_field(thd, item), Item_args(thd, item), - Used_tables_and_const_cache(item) { } - Item_func_or_sum(THD *thd, List &list): - Item_result_field(thd), Item_args(thd, list) { } - bool with_subquery() const { DBUG_ASSERT(fixed); return m_with_subquery; } - bool walk(Item_processor processor, bool walk_subquery, void *arg) - { - if (walk_args(processor, walk_subquery, arg)) - return true; - return (this->*processor)(arg); - } - /* - This method is used for debug purposes to print the name of an - item to the debug log. The second use of this method is as - a helper function of print() and error messages, where it is - applicable. To suit both goals it should return a meaningful, - distinguishable and sintactically correct string. This method - should not be used for runtime type identification, use enum - {Sum}Functype and Item_func::functype()/Item_sum::sum_func() - instead. - Added here, to the parent class of both Item_func and Item_sum. - - NOTE: for Items inherited from Item_sum, func_name() return part of - function name till first argument (including '(') to make difference in - names for functions with 'distinct' clause and without 'distinct' and - also to make printing of items inherited from Item_sum uniform. - */ - virtual const char *func_name() const= 0; - virtual bool fix_length_and_dec()= 0; - bool const_item() const { return const_item_cache; } - table_map used_tables() const { return used_tables_cache; } - Item* build_clone(THD *thd); - Sql_mode_dependency value_depends_on_sql_mode() const - { - return Item_args::value_depends_on_sql_mode_bit_or().soft_to_hard(); - } -}; - -class sp_head; -class sp_name; -struct st_sp_security_context; - -class Item_sp -{ -protected: - // Can be NULL in some non-SELECT queries - Name_resolution_context *context; -public: - sp_name *m_name; - sp_head *m_sp; - TABLE *dummy_table; - uchar result_buf[64]; - sp_rcontext *func_ctx; - MEM_ROOT sp_mem_root; - Query_arena *sp_query_arena; - - /* - The result field of the stored function. - */ - Field *sp_result_field; - Item_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name_arg); - Item_sp(THD *thd, Item_sp *item); - const char *func_name(THD *thd) const; - void cleanup(); - bool sp_check_access(THD *thd); - bool execute(THD *thd, bool *null_value, Item **args, uint arg_count); - bool execute_impl(THD *thd, Item **args, uint arg_count); - bool init_result_field(THD *thd, uint max_length, uint maybe_null, - bool *null_value, LEX_CSTRING *name); - void process_error(THD *thd) - { - if (context) - context->process_error(thd); - } -}; - -class Item_ref :public Item_ident, - protected With_sum_func_cache -{ -protected: - void set_properties(); - bool set_properties_only; // the item doesn't need full fix_fields -public: - enum Ref_Type { REF, DIRECT_REF, VIEW_REF, OUTER_REF, AGGREGATE_REF }; - Item **ref; - bool reference_trough_name; - Item_ref(THD *thd, Name_resolution_context *context_arg, - const LEX_CSTRING &db_arg, const LEX_CSTRING &table_name_arg, - const LEX_CSTRING &field_name_arg): - Item_ident(thd, context_arg, db_arg, table_name_arg, field_name_arg), - set_properties_only(0), ref(0), reference_trough_name(1) {} - Item_ref(THD *thd, Name_resolution_context *context_arg, - const LEX_CSTRING &field_name_arg) - :Item_ref(thd, context_arg, null_clex_str, null_clex_str, field_name_arg) - { } - /* - This constructor is used in two scenarios: - A) *item = NULL - No initialization is performed, fix_fields() call will be necessary. - - B) *item points to an Item this Item_ref will refer to. This is - used for GROUP BY. fix_fields() will not be called in this case, - so we call set_properties to make this item "fixed". set_properties - performs a subset of action Item_ref::fix_fields does, and this subset - is enough for Item_ref's used in GROUP BY. - - TODO we probably fix a superset of problems like in BUG#6658. Check this - with Bar, and if we have a more broader set of problems like this. - */ - Item_ref(THD *thd, Name_resolution_context *context_arg, Item **item, - const LEX_CSTRING &table_name_arg, const LEX_CSTRING &field_name_arg, - bool alias_name_used_arg= FALSE); - Item_ref(THD *thd, TABLE_LIST *view_arg, Item **item, - const LEX_CSTRING &field_name_arg, bool alias_name_used_arg= FALSE); - - /* Constructor need to process subselect with temporary tables (see Item) */ - Item_ref(THD *thd, Item_ref *item) - :Item_ident(thd, item), With_sum_func_cache(*item), - set_properties_only(0), ref(item->ref) {} - enum Type type() const { return REF_ITEM; } - enum Type real_type() const { return ref ? (*ref)->type() : - REF_ITEM; } - bool eq(const Item *item, bool binary_cmp) const - { - Item *it= ((Item *) item)->real_item(); - return ref && (*ref)->eq(it, binary_cmp); - } - void save_val(Field *to); - void save_result(Field *to); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - String *val_str(String* tmp); - bool val_native(THD *thd, Native *to); - bool is_null(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - longlong val_datetime_packed(THD *); - longlong val_time_packed(THD *); - double val_result(); - longlong val_int_result(); - String *str_result(String* tmp); - bool val_native_result(THD *thd, Native *to); - my_decimal *val_decimal_result(my_decimal *); - bool val_bool_result(); - bool is_null_result(); - bool send(Protocol *prot, st_value *buffer); - void make_send_field(THD *thd, Send_field *field); - bool fix_fields(THD *, Item **); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - int save_in_field(Field *field, bool no_conversions); - void save_org_in_field(Field *field, fast_field_copier optimizer_data); - fast_field_copier setup_fast_field_copier(Field *field) - { return (*ref)->setup_fast_field_copier(field); } - const Type_handler *type_handler() const { return (*ref)->type_handler(); } - const Type_handler *real_type_handler() const - { return (*ref)->real_type_handler(); } - Field *get_tmp_table_field() - { return result_field ? result_field : (*ref)->get_tmp_table_field(); } - Item *get_tmp_table_item(THD *thd); - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param); - Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *); - table_map used_tables() const; - void update_used_tables(); - COND *build_equal_items(THD *thd, COND_EQUAL *inherited, - bool link_item_fields, - COND_EQUAL **cond_equal_ref) - { - /* - normilize_cond() replaced all conditions of type - WHERE/HAVING field - to: - WHERE/HAVING field<>0 - By the time of a build_equal_items() call, all such conditions should - already be replaced. No Item_ref referencing to Item_field are possible. - */ - DBUG_ASSERT(real_type() != FIELD_ITEM); - return Item_ident::build_equal_items(thd, inherited, link_item_fields, - cond_equal_ref); - } - bool const_item() const - { - return (*ref)->const_item(); - } - table_map not_null_tables() const - { - return depended_from ? 0 : (*ref)->not_null_tables(); - } - bool find_not_null_fields(table_map allowed) - { - return depended_from ? false : (*ref)->find_not_null_fields(allowed); - } - void save_in_result_field(bool no_conversions) - { - (*ref)->save_in_field(result_field, no_conversions); - } - Item *real_item() - { - return ref ? (*ref)->real_item() : this; - } - const TYPELIB *get_typelib() const - { - return ref ? (*ref)->get_typelib() : NULL; - } - bool is_json_type() { return (*ref)->is_json_type(); } - - bool walk(Item_processor processor, bool walk_subquery, void *arg) - { - if (ref && *ref) - return (*ref)->walk(processor, walk_subquery, arg) || - (this->*processor)(arg); - else - return FALSE; - } - Item* transform(THD *thd, Item_transformer, uchar *arg); - Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t); - bool enumerate_field_refs_processor(void *arg) - { return (*ref)->enumerate_field_refs_processor(arg); } - void no_rows_in_result() - { - (*ref)->no_rows_in_result(); - } - void restore_to_before_no_rows_in_result() - { - (*ref)->restore_to_before_no_rows_in_result(); - } - void print(String *str, enum_query_type query_type); - enum precedence precedence() const - { - return ref ? (*ref)->precedence() : DEFAULT_PRECEDENCE; - } - void cleanup(); - Item_field *field_for_view_update() - { return (*ref)->field_for_view_update(); } - Load_data_outvar *get_load_data_outvar() - { - return (*ref)->get_load_data_outvar(); - } - virtual Ref_Type ref_type() { return REF; } - - // Row emulation: forwarding of ROW-related calls to ref - uint cols() const - { - return ref && result_type() == ROW_RESULT ? (*ref)->cols() : 1; - } - Item* element_index(uint i) - { - return ref && result_type() == ROW_RESULT ? (*ref)->element_index(i) : this; - } - Item** addr(uint i) - { - return ref && result_type() == ROW_RESULT ? (*ref)->addr(i) : 0; - } - bool check_cols(uint c) - { - return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c) - : Item::check_cols(c); - } - bool null_inside() - { - return ref && result_type() == ROW_RESULT ? (*ref)->null_inside() : 0; - } - void bring_value() - { - if (ref && result_type() == ROW_RESULT) - (*ref)->bring_value(); - } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function("ref", arg, VCOL_IMPOSSIBLE); - } - bool basic_const_item() const { return ref && (*ref)->basic_const_item(); } - bool is_outer_field() const - { - DBUG_ASSERT(fixed); - DBUG_ASSERT(ref); - return (*ref)->is_outer_field(); - } - - Item* build_clone(THD *thd); - - /** - Checks if the item tree that ref points to contains a subquery. - */ - virtual bool with_subquery() const - { - return (*ref)->with_subquery(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - bool excl_dep_on_table(table_map tab_map) - { - table_map used= used_tables(); - if (used & OUTER_REF_TABLE_BIT) - return false; - return (used == tab_map) || (*ref)->excl_dep_on_table(tab_map); - } - bool excl_dep_on_grouping_fields(st_select_lex *sel) - { return (*ref)->excl_dep_on_grouping_fields(sel); } - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) - { return (*ref)->excl_dep_on_in_subq_left_part(subq_pred); } - bool cleanup_excluding_fields_processor(void *arg) - { - Item *item= real_item(); - if (item && item->type() == FIELD_ITEM && - ((Item_field *)item)->field) - return 0; - return cleanup_processor(arg); - } - bool cleanup_excluding_const_fields_processor(void *arg) - { - Item *item= real_item(); - if (item && item->type() == FIELD_ITEM && - ((Item_field *) item)->field && item->const_item()) - return 0; - return cleanup_processor(arg); - } - bool with_sum_func() const { return m_with_sum_func; } - With_sum_func_cache* get_with_sum_func_cache() { return this; } - Item *field_transformer_for_having_pushdown(THD *thd, uchar *arg) - { return (*ref)->field_transformer_for_having_pushdown(thd, arg); } - Item *remove_item_direct_ref() - { - *ref= (*ref)->remove_item_direct_ref(); - return this; - } -}; - - -/* - The same as Item_ref, but get value from val_* family of method to get - value of item on which it referred instead of result* family. -*/ -class Item_direct_ref :public Item_ref -{ -public: - Item_direct_ref(THD *thd, Name_resolution_context *context_arg, Item **item, - const LEX_CSTRING &table_name_arg, - const LEX_CSTRING &field_name_arg, - bool alias_name_used_arg= FALSE): - Item_ref(thd, context_arg, item, table_name_arg, - field_name_arg, alias_name_used_arg) - {} - /* Constructor need to process subselect with temporary tables (see Item) */ - Item_direct_ref(THD *thd, Item_direct_ref *item) : Item_ref(thd, item) {} - Item_direct_ref(THD *thd, TABLE_LIST *view_arg, Item **item, - const LEX_CSTRING &field_name_arg, - bool alias_name_used_arg= FALSE): - Item_ref(thd, view_arg, item, field_name_arg, - alias_name_used_arg) - {} - - bool fix_fields(THD *thd, Item **it) - { - if ((*ref)->fix_fields_if_needed_for_scalar(thd, ref)) - return TRUE; - return Item_ref::fix_fields(thd, it); - } - void save_val(Field *to); - double val_real(); - longlong val_int(); - String *val_str(String* tmp); - bool val_native(THD *thd, Native *to); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - bool is_null(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - virtual Ref_Type ref_type() { return DIRECT_REF; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *remove_item_direct_ref() - { return (*ref)->remove_item_direct_ref(); } -}; - - -/** - This class is the same as Item_direct_ref but created to wrap Item_ident - before fix_fields() call -*/ - -class Item_direct_ref_to_ident :public Item_direct_ref -{ - Item_ident *ident; -public: - Item_direct_ref_to_ident(THD *thd, Item_ident *item): - Item_direct_ref(thd, item->context, (Item**)&item, item->table_name, - item->field_name, FALSE) - { - ident= item; - ref= (Item**)&ident; - } - - bool fix_fields(THD *thd, Item **it) - { - DBUG_ASSERT(ident->type() == FIELD_ITEM || ident->type() == REF_ITEM); - if (ident->fix_fields_if_needed_for_scalar(thd, ref)) - return TRUE; - set_properties(); - return FALSE; - } - - virtual void print(String *str, enum_query_type query_type) - { ident->print(str, query_type); } - -}; - - -class Item_cache; -class Expression_cache; -class Expression_cache_tracker; - -/** - The objects of this class can store its values in an expression cache. -*/ - -class Item_cache_wrapper :public Item_result_field, - public With_subquery_cache, - protected With_sum_func_cache -{ -private: - /* Pointer on the cached expression */ - Item *orig_item; - Expression_cache *expr_cache; - /* - In order to put the expression into the expression cache and return - value of val_*() method, we will need to get the expression value twice - (probably in different types). In order to avoid making two - (potentially costly) orig_item->val_*() calls, we store expression value - in this Item_cache object. - */ - Item_cache *expr_value; - - List parameters; - - Item *check_cache(); - void cache(); - void init_on_demand(); - -public: - Item_cache_wrapper(THD *thd, Item *item_arg); - ~Item_cache_wrapper(); - - enum Type type() const { return EXPR_CACHE_ITEM; } - enum Type real_type() const { return orig_item->type(); } - bool with_subquery() const { DBUG_ASSERT(fixed); return m_with_subquery; } - bool with_sum_func() const { return m_with_sum_func; } - With_sum_func_cache* get_with_sum_func_cache() { return this; } - - bool set_cache(THD *thd); - Expression_cache_tracker* init_tracker(MEM_ROOT *mem_root); - - bool fix_fields(THD *thd, Item **it); - void cleanup(); - - Item *get_orig_item() const { return orig_item; } - - /* Methods of getting value which should be cached in the cache */ - void save_val(Field *to); - double val_real(); - longlong val_int(); - String *val_str(String* tmp); - bool val_native(THD *thd, Native *to); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - bool is_null(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool send(Protocol *protocol, st_value *buffer); - void save_org_in_field(Field *field, - fast_field_copier data __attribute__ ((__unused__))) - { - save_val(field); - } - void save_in_result_field(bool no_conversions) - { - save_val(result_field); - } - Item* get_tmp_table_item(THD *thd_arg); - - /* Following methods make this item transparent as much as possible */ - - virtual void print(String *str, enum_query_type query_type); - virtual const char *full_name() const { return orig_item->full_name(); } - virtual void make_send_field(THD *thd, Send_field *field) - { orig_item->make_send_field(thd, field); } - bool eq(const Item *item, bool binary_cmp) const - { - Item *it= ((Item *) item)->real_item(); - return orig_item->eq(it, binary_cmp); - } - void fix_after_pullout(st_select_lex *new_parent, Item **refptr, bool merge) - { - orig_item->fix_after_pullout(new_parent, &orig_item, merge); - } - int save_in_field(Field *to, bool no_conversions); - const Type_handler *type_handler() const { return orig_item->type_handler(); } - table_map used_tables() const { return orig_item->used_tables(); } - void update_used_tables() - { - orig_item->update_used_tables(); - } - bool const_item() const { return orig_item->const_item(); } - table_map not_null_tables() const { return orig_item->not_null_tables(); } - bool walk(Item_processor processor, bool walk_subquery, void *arg) - { - return orig_item->walk(processor, walk_subquery, arg) || - (this->*processor)(arg); - } - bool enumerate_field_refs_processor(void *arg) - { return orig_item->enumerate_field_refs_processor(arg); } - Item_field *field_for_view_update() - { return orig_item->field_for_view_update(); } - - /* Row emulation: forwarding of ROW-related calls to orig_item */ - uint cols() const - { return result_type() == ROW_RESULT ? orig_item->cols() : 1; } - Item* element_index(uint i) - { return result_type() == ROW_RESULT ? orig_item->element_index(i) : this; } - Item** addr(uint i) - { return result_type() == ROW_RESULT ? orig_item->addr(i) : 0; } - bool check_cols(uint c) - { - return (result_type() == ROW_RESULT ? - orig_item->check_cols(c) : - Item::check_cols(c)); - } - bool null_inside() - { return result_type() == ROW_RESULT ? orig_item->null_inside() : 0; } - void bring_value() - { - if (result_type() == ROW_RESULT) - orig_item->bring_value(); - } - bool is_expensive() { return orig_item->is_expensive(); } - bool is_expensive_processor(void *arg) - { return orig_item->is_expensive_processor(arg); } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *build_clone(THD *thd) { return 0; } -}; - - -/* - Class for view fields, the same as Item_direct_ref, but call fix_fields - of reference if it is not called yet -*/ -class Item_direct_view_ref :public Item_direct_ref -{ - Item_equal *item_equal; - TABLE_LIST *view; - TABLE *null_ref_table; - -#define NO_NULL_TABLE (reinterpret_cast(0x1)) - - void set_null_ref_table() - { - if (!view->is_inner_table_of_outer_join() || - !(null_ref_table= view->get_real_join_table())) - null_ref_table= NO_NULL_TABLE; - } - - bool check_null_ref() - { - DBUG_ASSERT(null_ref_table); - if (null_ref_table != NO_NULL_TABLE && null_ref_table->null_row) - { - null_value= 1; - return TRUE; - } - return FALSE; - } - -public: - Item_direct_view_ref(THD *thd, Name_resolution_context *context_arg, - Item **item, - LEX_CSTRING &table_name_arg, - LEX_CSTRING &field_name_arg, - TABLE_LIST *view_arg): - Item_direct_ref(thd, context_arg, item, table_name_arg, field_name_arg), - item_equal(0), view(view_arg), - null_ref_table(NULL) - { - if (fixed) - set_null_ref_table(); - } - - bool fix_fields(THD *, Item **); - bool eq(const Item *item, bool binary_cmp) const; - Item *get_tmp_table_item(THD *thd) - { - if (const_item()) - return copy_or_same(thd); - Item *item= Item_ref::get_tmp_table_item(thd); - item->name= name; - return item; - } - virtual Ref_Type ref_type() { return VIEW_REF; } - Item_equal *get_item_equal() { return item_equal; } - void set_item_equal(Item_equal *item_eq) { item_equal= item_eq; } - Item_equal *find_item_equal(COND_EQUAL *cond_equal); - Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *); - Item *replace_equal_field(THD *thd, uchar *arg); - table_map used_tables() const; - void update_used_tables(); - table_map not_null_tables() const; - bool const_item() const { return used_tables() == 0; } - TABLE *get_null_ref_table() const { return null_ref_table; } - bool walk(Item_processor processor, bool walk_subquery, void *arg) - { - return (*ref)->walk(processor, walk_subquery, arg) || - (this->*processor)(arg); - } - bool view_used_tables_processor(void *arg) - { - TABLE_LIST *view_arg= (TABLE_LIST *) arg; - if (view_arg == view) - view_arg->view_used_tables|= (*ref)->used_tables(); - return 0; - } - bool excl_dep_on_table(table_map tab_map); - bool excl_dep_on_grouping_fields(st_select_lex *sel); - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred); - Item *derived_field_transformer_for_having(THD *thd, uchar *arg); - Item *derived_field_transformer_for_where(THD *thd, uchar *arg); - Item *grouping_field_transformer_for_where(THD *thd, uchar *arg); - Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg); - Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg); - - void save_val(Field *to) - { - if (check_null_ref()) - to->set_null(); - else - Item_direct_ref::save_val(to); - } - double val_real() - { - if (check_null_ref()) - return 0; - else - return Item_direct_ref::val_real(); - } - longlong val_int() - { - if (check_null_ref()) - return 0; - else - return Item_direct_ref::val_int(); - } - String *val_str(String* tmp) - { - if (check_null_ref()) - return NULL; - else - return Item_direct_ref::val_str(tmp); - } - bool val_native(THD *thd, Native *to) - { - if (check_null_ref()) - return true; - return Item_direct_ref::val_native(thd, to); - } - my_decimal *val_decimal(my_decimal *tmp) - { - if (check_null_ref()) - return NULL; - else - return Item_direct_ref::val_decimal(tmp); - } - bool val_bool() - { - if (check_null_ref()) - return 0; - else - return Item_direct_ref::val_bool(); - } - bool is_null() - { - if (check_null_ref()) - return 1; - else - return Item_direct_ref::is_null(); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - if (check_null_ref()) - { - bzero((char*) ltime,sizeof(*ltime)); - return 1; - } - return Item_direct_ref::get_date(thd, ltime, fuzzydate); - } - bool send(Protocol *protocol, st_value *buffer); - void save_org_in_field(Field *field, - fast_field_copier data __attribute__ ((__unused__))) - { - if (check_null_ref()) - field->set_null(); - else - Item_direct_ref::save_val(field); - } - void save_in_result_field(bool no_conversions) - { - if (check_null_ref()) - result_field->set_null(); - else - Item_direct_ref::save_in_result_field(no_conversions); - } - - void cleanup() - { - null_ref_table= NULL; - item_equal= NULL; - Item_direct_ref::cleanup(); - } - /* - TODO move these val_*_result function to Item_dierct_ref (maybe) - */ - double val_result(); - longlong val_int_result(); - String *str_result(String* tmp); - my_decimal *val_decimal_result(my_decimal *val); - bool val_bool_result(); - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *field_transformer_for_having_pushdown(THD *thd, uchar *arg) - { return this; } - Item *remove_item_direct_ref() { return this; } -}; - - -/* - Class for outer fields. - An object of this class is created when the select where the outer field was - resolved is a grouping one. After it has been fixed the ref field will point - to either an Item_ref or an Item_direct_ref object which will be used to - access the field. - See also comments for the fix_inner_refs() and the - Item_field::fix_outer_field() functions. -*/ - -class Item_sum; -class Item_outer_ref :public Item_direct_ref -{ -public: - Item *outer_ref; - /* The aggregate function under which this outer ref is used, if any. */ - Item_sum *in_sum_func; - /* - TRUE <=> that the outer_ref is already present in the select list - of the outer select. - */ - bool found_in_select_list; - bool found_in_group_by; - Item_outer_ref(THD *thd, Name_resolution_context *context_arg, - Item_field *outer_field_arg): - Item_direct_ref(thd, context_arg, 0, outer_field_arg->table_name, - outer_field_arg->field_name), - outer_ref(outer_field_arg), in_sum_func(0), - found_in_select_list(0), found_in_group_by(0) - { - ref= &outer_ref; - set_properties(); - fixed= 0; /* reset flag set in set_properties() */ - } - Item_outer_ref(THD *thd, Name_resolution_context *context_arg, Item **item, - const LEX_CSTRING &table_name_arg, LEX_CSTRING &field_name_arg, - bool alias_name_used_arg): - Item_direct_ref(thd, context_arg, item, table_name_arg, field_name_arg, - alias_name_used_arg), - outer_ref(0), in_sum_func(0), found_in_select_list(1), found_in_group_by(0) - {} - void save_in_result_field(bool no_conversions) - { - outer_ref->save_org_in_field(result_field, NULL); - } - bool fix_fields(THD *, Item **); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - table_map used_tables() const - { - return (*ref)->const_item() ? 0 : OUTER_REF_TABLE_BIT; - } - table_map not_null_tables() const { return 0; } - virtual Ref_Type ref_type() { return OUTER_REF; } - bool check_inner_refs_processor(void * arg); -}; - - -class Item_in_subselect; - - -/* - An object of this class: - - Converts val_XXX() calls to ref->val_XXX_result() calls, like Item_ref. - - Sets owner->was_null=TRUE if it has returned a NULL value from any - val_XXX() function. This allows to inject an Item_ref_null_helper - object into subquery and then check if the subquery has produced a row - with NULL value. -*/ - -class Item_ref_null_helper: public Item_ref -{ -protected: - Item_in_subselect* owner; -public: - Item_ref_null_helper(THD *thd, Name_resolution_context *context_arg, - Item_in_subselect* master, Item **item, - const LEX_CSTRING &table_name_arg, - const LEX_CSTRING &field_name_arg): - Item_ref(thd, context_arg, item, table_name_arg, field_name_arg), - owner(master) {} - void save_val(Field *to); - double val_real(); - longlong val_int(); - String* val_str(String* s); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to); - virtual void print(String *str, enum_query_type query_type); - table_map used_tables() const; - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -/* - The following class is used to optimize comparing of date and bigint columns - We need to save the original item ('ref') to be able to call - ref->save_in_field(). This is used to create index search keys. - - An instance of Item_int_with_ref may have signed or unsigned integer value. - -*/ - -class Item_int_with_ref :public Item_int -{ - Item *ref; -public: - Item_int_with_ref(THD *thd, longlong i, Item *ref_arg, bool unsigned_arg): - Item_int(thd, i), ref(ref_arg) - { - unsigned_flag= unsigned_arg; - } - int save_in_field(Field *field, bool no_conversions) - { - return ref->save_in_field(field, no_conversions); - } - Item *clone_item(THD *thd); - virtual Item *real_item() { return ref; } -}; - -#ifdef MYSQL_SERVER -#include "item_sum.h" -#include "item_func.h" -#include "item_row.h" -#include "item_cmpfunc.h" -#include "item_strfunc.h" -#include "item_timefunc.h" -#include "item_subselect.h" -#include "item_xmlfunc.h" -#include "item_jsonfunc.h" -#include "item_create.h" -#include "item_vers.h" -#endif - -/** - Base class to implement typed value caching Item classes - - Item_copy_ classes are very similar to the corresponding Item_ - classes (e.g. Item_copy_string is similar to Item_string) but they add - the following additional functionality to Item_ : - 1. Nullability - 2. Possibility to store the value not only on instantiation time, - but also later. - Item_copy_ classes are a functionality subset of Item_cache_ - classes, as e.g. they don't support comparisons with the original Item - as Item_cache_ classes do. - Item_copy_ classes are used in GROUP BY calculation. - TODO: Item_copy should be made an abstract interface and Item_copy_ - classes should inherit both the respective Item_ class and the interface. - Ideally we should drop Item_copy_ classes altogether and merge - their functionality to Item_cache_ (and these should be made to inherit - from Item_). -*/ - -class Item_copy :public Item, - public Type_handler_hybrid_field_type -{ -protected: - - /** - Type_handler_hybrid_field_type is used to - store the type of the resulting field that would be used to store the data - in the cache. This is to avoid calls to the original item. - */ - - /** The original item that is copied */ - Item *item; - - /** - Constructor of the Item_copy class - - stores metadata information about the original class as well as a - pointer to it. - */ - Item_copy(THD *thd, Item *i): Item(thd) - { - DBUG_ASSERT(i->is_fixed()); - item= i; - null_value=maybe_null=item->maybe_null; - Type_std_attributes::set(item); - name= item->name; - set_handler(item->type_handler()); - } - -public: - - /** - Update the cache with the value of the original item - - This is the method that updates the cached value. - It must be explicitly called by the user of this class to store the value - of the original item in the cache. - */ - virtual void copy() = 0; - - Item *get_item() { return item; } - /** All of the subclasses should have the same type tag */ - enum Type type() const { return COPY_STR_ITEM; } - - const Type_handler *type_handler() const - { return Type_handler_hybrid_field_type::type_handler(); } - - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - DBUG_ASSERT(0); - return NULL; - } - void make_send_field(THD *thd, Send_field *field) - { item->make_send_field(thd, field); } - table_map used_tables() const { return (table_map) 1L; } - bool const_item() const { return 0; } - bool is_null() { return null_value; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function("copy", arg, VCOL_IMPOSSIBLE); - } - - /* - Override the methods below as pure virtual to make sure all the - sub-classes implement them. - */ - - virtual String *val_str(String*) = 0; - virtual my_decimal *val_decimal(my_decimal *) = 0; - virtual double val_real() = 0; - virtual longlong val_int() = 0; - virtual int save_in_field(Field *field, bool no_conversions) = 0; - bool walk(Item_processor processor, bool walk_subquery, void *args) - { - return (item->walk(processor, walk_subquery, args)) || - (this->*processor)(args); - } -}; - -/** - Implementation of a string cache. - - Uses Item::str_value for storage -*/ -class Item_copy_string : public Item_copy -{ -public: - Item_copy_string(THD *thd, Item *item_arg): Item_copy(thd, item_arg) {} - - String *val_str(String*); - my_decimal *val_decimal(my_decimal *); - double val_real(); - longlong val_int(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { return get_date_from_string(thd, ltime, fuzzydate); } - void copy(); - int save_in_field(Field *field, bool no_conversions); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - We need a separate class Item_copy_timestamp because - TIMESTAMP->string->TIMESTAMP conversion is not round trip safe - near the DST change, e.g. '2010-10-31 02:25:26' can mean: - - my_time_t(1288477526) - summer time in Moscow - - my_time_t(1288481126) - winter time in Moscow, one hour later -*/ -class Item_copy_timestamp: public Item_copy -{ - Timestamp_or_zero_datetime m_value; - bool sane() const { return !null_value || m_value.is_zero_datetime(); } -public: - Item_copy_timestamp(THD *thd, Item *arg): Item_copy(thd, arg) { } - const Type_handler *type_handler() const { return &type_handler_timestamp2; } - void copy() - { - Timestamp_or_zero_datetime_native_null tmp(current_thd, item, false); - null_value= tmp.is_null(); - m_value= tmp.is_null() ? Timestamp_or_zero_datetime() : - Timestamp_or_zero_datetime(tmp); - } - int save_in_field(Field *field, bool no_conversions) - { - DBUG_ASSERT(sane()); - if (null_value) - return set_field_to_null(field); - Timestamp_or_zero_datetime_native native(m_value, decimals); - return native.save_in_field(field, decimals); - } - longlong val_int() - { - DBUG_ASSERT(sane()); - return null_value ? 0 : - m_value.to_datetime(current_thd).to_longlong(); - } - double val_real() - { - DBUG_ASSERT(sane()); - return null_value ? 0e0 : - m_value.to_datetime(current_thd).to_double(); - } - String *val_str(String *to) - { - DBUG_ASSERT(sane()); - return null_value ? NULL : - m_value.to_datetime(current_thd).to_string(to, decimals); - } - my_decimal *val_decimal(my_decimal *to) - { - DBUG_ASSERT(sane()); - return null_value ? NULL : - m_value.to_datetime(current_thd).to_decimal(to); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - DBUG_ASSERT(sane()); - bool res= m_value.to_TIME(thd, ltime, fuzzydate); - DBUG_ASSERT(!res); - return null_value || res; - } - bool val_native(THD *thd, Native *to) - { - DBUG_ASSERT(sane()); - return null_value || m_value.to_native(to, decimals); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - Cached_item_XXX objects are not exactly caches. They do the following: - - Each Cached_item_XXX object has - - its source item - - saved value of the source item - - cmp() method that compares the saved value with the current value of the - source item, and if they were not equal saves item's value into the saved - value. - - TODO: add here: - - a way to save the new value w/o comparison - - a way to do less/equal/greater comparison -*/ - -class Cached_item :public Sql_alloc -{ -public: - bool null_value; - Cached_item() :null_value(0) {} - /* - Compare the cached value with the source value. If not equal, copy - the source value to the cache. - @return - true - Not equal - false - Equal - */ - virtual bool cmp(void)=0; - - /* Compare the cached value with the source value, without copying */ - virtual int cmp_read_only()=0; - - virtual ~Cached_item(); /*line -e1509 */ -}; - -class Cached_item_item : public Cached_item -{ -protected: - Item *item; - - Cached_item_item(Item *arg) : item(arg) {} -public: - void fetch_value_from(Item *new_item) - { - Item *save= item; - item= new_item; - cmp(); - item= save; - } -}; - -class Cached_item_str :public Cached_item_item -{ - uint32 value_max_length; - String value,tmp_value; -public: - Cached_item_str(THD *thd, Item *arg); - bool cmp(void); - int cmp_read_only(); - ~Cached_item_str(); // Deallocate String:s -}; - - -class Cached_item_real :public Cached_item_item -{ - double value; -public: - Cached_item_real(Item *item_par) :Cached_item_item(item_par),value(0.0) {} - bool cmp(void); - int cmp_read_only(); -}; - -class Cached_item_int :public Cached_item_item -{ - longlong value; -public: - Cached_item_int(Item *item_par) :Cached_item_item(item_par),value(0) {} - bool cmp(void); - int cmp_read_only(); -}; - - -class Cached_item_decimal :public Cached_item_item -{ - my_decimal value; -public: - Cached_item_decimal(Item *item_par); - bool cmp(void); - int cmp_read_only(); -}; - -class Cached_item_field :public Cached_item -{ - uchar *buff; - Field *field; - uint length; - -public: - Cached_item_field(THD *thd, Field *arg_field): field(arg_field) - { - field= arg_field; - /* TODO: take the memory allocation below out of the constructor. */ - buff= (uchar*) thd_calloc(thd, length= field->pack_length()); - } - bool cmp(void); - int cmp_read_only(); -}; - -class Item_default_value : public Item_field -{ - void calculate(); -public: - Item *arg= nullptr; - Field *cached_field= nullptr; - Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a) : - Item_field(thd, context_arg), arg(a) {} - enum Type type() const { return DEFAULT_VALUE_ITEM; } - bool eq(const Item *item, bool binary_cmp) const; - bool fix_fields(THD *, Item **); - void cleanup(); - void print(String *str, enum_query_type query_type); - String *val_str(String *str); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *decimal_value); - bool get_date(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to); - bool send(Protocol *protocol, st_value *buffer); - int save_in_field(Field *field_arg, bool no_conversions); - bool save_in_param(THD *thd, Item_param *param) - { - // It should not be possible to have "EXECUTE .. USING DEFAULT(a)" - DBUG_ASSERT(0); - param->set_default(); - return false; - } - table_map used_tables() const; - virtual void update_used_tables() - { - if (field && field->default_value) - field->default_value->expr->update_used_tables(); - } - Field *get_tmp_table_field() { return 0; } - Item *get_tmp_table_item(THD *thd) { return this; } - Item_field *field_for_view_update() { return 0; } - bool update_vcol_processor(void *arg) { return 0; } - bool check_func_default_processor(void *arg) { return true; } - - bool walk(Item_processor processor, bool walk_subquery, void *args) - { - return (arg && arg->walk(processor, walk_subquery, args)) || - (this->*processor)(args); - } - - Item *transform(THD *thd, Item_transformer transformer, uchar *args); -}; - - -class Item_contextually_typed_value_specification: public Item -{ -public: - Item_contextually_typed_value_specification(THD *thd) :Item(thd) - { } - enum Type type() const { return CONTEXTUALLY_TYPED_VALUE_ITEM; } - bool vcol_assignment_allowed_value() const { return true; } - bool eq(const Item *item, bool binary_cmp) const - { - return false; - } - bool is_evaluable_expression() const { return false; } - Field *create_tmp_field_ex(MEM_ROOT *root, - TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - DBUG_ASSERT(0); - return NULL; - } - String *val_str(String *str) - { - DBUG_ASSERT(0); // never should be called - null_value= true; - return 0; - } - double val_real() - { - DBUG_ASSERT(0); // never should be called - null_value= true; - return 0.0; - } - longlong val_int() - { - DBUG_ASSERT(0); // never should be called - null_value= true; - return 0; - } - my_decimal *val_decimal(my_decimal *decimal_value) - { - DBUG_ASSERT(0); // never should be called - null_value= true; - return 0; - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - DBUG_ASSERT(0); // never should be called - return null_value= true; - } - bool send(Protocol *protocol, st_value *buffer) - { - DBUG_ASSERT(0); - return true; - } - const Type_handler *type_handler() const - { - DBUG_ASSERT(0); - return &type_handler_null; - } -}; - - -/* - ::= DEFAULT -*/ -class Item_default_specification: - public Item_contextually_typed_value_specification -{ -public: - Item_default_specification(THD *thd) - :Item_contextually_typed_value_specification(thd) - { } - void print(String *str, enum_query_type query_type) - { - str->append(STRING_WITH_LEN("default")); - } - int save_in_field(Field *field_arg, bool no_conversions) - { - return field_arg->save_in_field_default_value(false); - } - bool save_in_param(THD *thd, Item_param *param) - { - param->set_default(); - return false; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - This class is used as bulk parameter INGNORE representation. - - It just do nothing when assigned to a field - - This is a non-standard MariaDB extension. -*/ - -class Item_ignore_specification: - public Item_contextually_typed_value_specification -{ -public: - Item_ignore_specification(THD *thd) - :Item_contextually_typed_value_specification(thd) - { } - void print(String *str, enum_query_type query_type) - { - str->append(STRING_WITH_LEN("ignore")); - } - int save_in_field(Field *field_arg, bool no_conversions) - { - return field_arg->save_in_field_ignore_value(false); - } - bool save_in_param(THD *thd, Item_param *param) - { - param->set_ignore(); - return false; - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - Item_insert_value -- an implementation of VALUES() function. - You can use the VALUES(col_name) function in the UPDATE clause - to refer to column values from the INSERT portion of the INSERT - ... UPDATE statement. In other words, VALUES(col_name) in the - UPDATE clause refers to the value of col_name that would be - inserted, had no duplicate-key conflict occurred. - In all other places this function returns NULL. -*/ - -class Item_insert_value : public Item_field -{ -public: - Item *arg; - Item_insert_value(THD *thd, Name_resolution_context *context_arg, Item *a) - :Item_field(thd, context_arg), - arg(a) {} - bool eq(const Item *item, bool binary_cmp) const; - bool fix_fields(THD *, Item **); - virtual void print(String *str, enum_query_type query_type); - int save_in_field(Field *field_arg, bool no_conversions) - { - return Item_field::save_in_field(field_arg, no_conversions); - } - enum Type type() const { return INSERT_VALUE_ITEM; } - /* - We use RAND_TABLE_BIT to prevent Item_insert_value from - being treated as a constant and precalculated before execution - */ - table_map used_tables() const { return RAND_TABLE_BIT; } - - Item_field *field_for_view_update() { return 0; } - - bool walk(Item_processor processor, bool walk_subquery, void *args) - { - return arg->walk(processor, walk_subquery, args) || - (this->*processor)(args); - } - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool update_vcol_processor(void *arg) { return 0; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function("value()", arg, VCOL_IMPOSSIBLE); - } -}; - - -class Table_triggers_list; - -/* - Represents NEW/OLD version of field of row which is - changed/read in trigger. - - Note: For this item main part of actual binding to Field object happens - not during fix_fields() call (like for Item_field) but right after - parsing of trigger definition, when table is opened, with special - setup_field() call. On fix_fields() stage we simply choose one of - two Field instances representing either OLD or NEW version of this - field. -*/ -class Item_trigger_field : public Item_field, - private Settable_routine_parameter -{ -public: - /* Is this item represents row from NEW or OLD row ? */ - enum row_version_type {OLD_ROW, NEW_ROW}; - row_version_type row_version; - /* Next in list of all Item_trigger_field's in trigger */ - Item_trigger_field *next_trg_field; - /* Index of the field in the TABLE::field array */ - uint field_idx; - /* Pointer to Table_trigger_list object for table of this trigger */ - Table_triggers_list *triggers; - - Item_trigger_field(THD *thd, Name_resolution_context *context_arg, - row_version_type row_ver_arg, - const LEX_CSTRING &field_name_arg, - privilege_t priv, const bool ro) - :Item_field(thd, context_arg, field_name_arg), - row_version(row_ver_arg), field_idx((uint)-1), original_privilege(priv), - want_privilege(priv), table_grants(NULL), read_only (ro) - {} - void setup_field(THD *thd, TABLE *table, GRANT_INFO *table_grant_info); - enum Type type() const { return TRIGGER_FIELD_ITEM; } - bool eq(const Item *item, bool binary_cmp) const; - bool fix_fields(THD *, Item **); - virtual void print(String *str, enum_query_type query_type); - table_map used_tables() const { return (table_map)0L; } - Field *get_tmp_table_field() { return 0; } - Item *copy_or_same(THD *thd) { return this; } - Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); } - void cleanup(); - -private: - void set_required_privilege(bool rw); - bool set_value(THD *thd, sp_rcontext *ctx, Item **it); - -public: - Settable_routine_parameter *get_settable_routine_parameter() - { - return (read_only ? 0 : this); - } - - bool set_value(THD *thd, Item **it) - { - return set_value(thd, NULL, it); - } - -private: - /* - 'want_privilege' holds privileges required to perform operation on - this trigger field (SELECT_ACL if we are going to read it and - UPDATE_ACL if we are going to update it). It is initialized at - parse time but can be updated later if this trigger field is used - as OUT or INOUT parameter of stored routine (in this case - set_required_privilege() is called to appropriately update - want_privilege and cleanup() is responsible for restoring of - original want_privilege once parameter's value is updated). - */ - privilege_t original_privilege; - privilege_t want_privilege; - GRANT_INFO *table_grants; - /* - Trigger field is read-only unless it belongs to the NEW row in a - BEFORE INSERT of BEFORE UPDATE trigger. - */ - bool read_only; -public: - bool unknown_splocal_processor(void *arg) { return false; } - bool check_vcol_func_processor(void *arg); -}; - - -/** - @todo - Implement the is_null() method for this class. Currently calling is_null() - on any Item_cache object resolves to Item::is_null(), which returns FALSE - for any value. -*/ - -class Item_cache: public Item, - public Type_handler_hybrid_field_type -{ -protected: - Item *example; - /** - Field that this object will get value from. This is used by - index-based subquery engines to detect and remove the equality injected - by IN->EXISTS transformation. - */ - Field *cached_field; - /* - TRUE <=> cache holds value of the last stored item (i.e actual value). - store() stores item to be cached and sets this flag to FALSE. - On the first call of val_xxx function if this flag is set to FALSE the - cache_value() will be called to actually cache value of saved item. - cache_value() will set this flag to TRUE. - */ - bool value_cached; - - table_map used_table_map; -public: - Item_cache(THD *thd): - Item(thd), - Type_handler_hybrid_field_type(&type_handler_string), - example(0), cached_field(0), - value_cached(0), - used_table_map(0) - { - maybe_null= 1; - null_value= 1; - } -protected: - Item_cache(THD *thd, const Type_handler *handler): - Item(thd), - Type_handler_hybrid_field_type(handler), - example(0), cached_field(0), - value_cached(0), - used_table_map(0) - { - maybe_null= 1; - null_value= 1; - } - -public: - virtual bool allocate(THD *thd, uint i) { return 0; } - virtual bool setup(THD *thd, Item *item) - { - example= item; - Type_std_attributes::set(item); - if (item->type() == FIELD_ITEM) - cached_field= ((Item_field *)item)->field; - return 0; - }; - - void set_used_tables(table_map map) { used_table_map= map; } - table_map used_tables() const { return used_table_map; } - enum Type type() const { return CACHE_ITEM; } - - const Type_handler *type_handler() const - { return Type_handler_hybrid_field_type::type_handler(); } - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - return create_tmp_field_ex_simple(root, table, src, param); - } - - virtual void keep_array() {} - virtual void print(String *str, enum_query_type query_type); - bool eq_def(const Field *field) - { - return cached_field ? cached_field->eq_def (field) : FALSE; - } - bool eq(const Item *item, bool binary_cmp) const - { - return this == item; - } - bool check_vcol_func_processor(void *arg) - { - if (example) - { - Item::vcol_func_processor_result *res= (Item::vcol_func_processor_result*)arg; - example->check_vcol_func_processor(arg); - /* - Item_cache of a non-deterministic function requires re-fixing - even if the function itself doesn't (e.g. CURRENT_TIMESTAMP) - */ - if (res->errors & VCOL_NOT_STRICTLY_DETERMINISTIC) - res->errors|= VCOL_SESSION_FUNC; - return false; - } - return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE); - } - void cleanup() - { - clear(); - Item::cleanup(); - } - /** - Check if saved item has a non-NULL value. - Will cache value of saved item if not already done. - @return TRUE if cached value is non-NULL. - */ - bool has_value() - { - return (value_cached || cache_value()) && !null_value; - } - - virtual void store(Item *item); - virtual Item *get_item() { return example; } - virtual bool cache_value()= 0; - bool basic_const_item() const - { return example && example->basic_const_item(); } - virtual void clear() { null_value= TRUE; value_cached= FALSE; } - bool is_null() { return !has_value(); } - virtual bool is_expensive() - { - if (value_cached) - return false; - return example->is_expensive(); - } - bool is_expensive_processor(void *arg) - { - DBUG_ASSERT(example); - if (value_cached) - return false; - return example->is_expensive_processor(arg); - } - virtual void set_null(); - bool walk(Item_processor processor, bool walk_subquery, void *arg) - { - if (arg == STOP_PTR) - return FALSE; - if (example && example->walk(processor, walk_subquery, arg)) - return TRUE; - return (this->*processor)(arg); - } - virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - void split_sum_func2_example(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags) - { - example->split_sum_func2(thd, ref_pointer_array, fields, &example, flags); - } - Item *get_example() const { return example; } - - virtual Item *convert_to_basic_const_item(THD *thd) { return 0; }; - Item *derived_field_transformer_for_having(THD *thd, uchar *arg) - { return convert_to_basic_const_item(thd); } - Item *derived_field_transformer_for_where(THD *thd, uchar *arg) - { return convert_to_basic_const_item(thd); } - Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) - { return convert_to_basic_const_item(thd); } - Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) - { return convert_to_basic_const_item(thd); } - Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) - { return convert_to_basic_const_item(thd); } -}; - - -class Item_cache_int: public Item_cache -{ -protected: - longlong value; -public: - Item_cache_int(THD *thd, const Type_handler *handler): - Item_cache(thd, handler), value(0) {} - - double val_real(); - longlong val_int(); - String* val_str(String *str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { return get_date_from_int(thd, ltime, fuzzydate); } - bool cache_value(); - int save_in_field(Field *field, bool no_conversions); - Item *convert_to_basic_const_item(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_cache_year: public Item_cache_int -{ -public: - Item_cache_year(THD *thd, const Type_handler *handler) - :Item_cache_int(thd, handler) { } - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) - { - return type_handler_year.Item_get_date_with_warn(thd, this, to, mode); - } -}; - - -class Item_cache_temporal: public Item_cache_int -{ -protected: - Item_cache_temporal(THD *thd, const Type_handler *handler); -public: - bool cache_value(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - int save_in_field(Field *field, bool no_conversions); - bool setup(THD *thd, Item *item) - { - if (Item_cache_int::setup(thd, item)) - return true; - set_if_smaller(decimals, TIME_SECOND_PART_DIGITS); - return false; - } - void store_packed(longlong val_arg, Item *example); - /* - Having a clone_item method tells optimizer that this object - is a constant and need not be optimized further. - Important when storing packed datetime values. - */ - Item *clone_item(THD *thd); - Item *convert_to_basic_const_item(THD *thd); - virtual Item *make_literal(THD *) =0; -}; - - -class Item_cache_time: public Item_cache_temporal -{ -public: - Item_cache_time(THD *thd) - :Item_cache_temporal(thd, &type_handler_time2) { } - bool cache_value(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *make_literal(THD *); - longlong val_datetime_packed(THD *thd) - { - Datetime::Options_cmp opt(thd); - return has_value() ? Datetime(thd, this, opt).to_packed() : 0; - } - longlong val_time_packed(THD *thd) - { - return has_value() ? value : 0; - } - longlong val_int() - { - return has_value() ? Time(this).to_longlong() : 0; - } - double val_real() - { - return has_value() ? Time(this).to_double() : 0; - } - String *val_str(String *to) - { - return has_value() ? Time(this).to_string(to, decimals) : NULL; - } - my_decimal *val_decimal(my_decimal *to) - { - return has_value() ? Time(this).to_decimal(to) : NULL; - } - bool val_native(THD *thd, Native *to) - { - return has_value() ? Time(thd, this).to_native(to, decimals) : true; - } -}; - - -class Item_cache_datetime: public Item_cache_temporal -{ -public: - Item_cache_datetime(THD *thd) - :Item_cache_temporal(thd, &type_handler_datetime2) { } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *make_literal(THD *); - longlong val_datetime_packed(THD *thd) - { - return has_value() ? value : 0; - } - longlong val_time_packed(THD *thd) - { - return Time(thd, this, Time::Options_cmp(thd)).to_packed(); - } - longlong val_int() - { - return has_value() ? Datetime(this).to_longlong() : 0; - } - double val_real() - { - return has_value() ? Datetime(this).to_double() : 0; - } - String *val_str(String *to) - { - return has_value() ? Datetime(this).to_string(to, decimals) : NULL; - } - my_decimal *val_decimal(my_decimal *to) - { - return has_value() ? Datetime(this).to_decimal(to) : NULL; - } -}; - - -class Item_cache_date: public Item_cache_temporal -{ -public: - Item_cache_date(THD *thd) - :Item_cache_temporal(thd, &type_handler_newdate) { } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *make_literal(THD *); - longlong val_datetime_packed(THD *thd) - { - return has_value() ? value : 0; - } - longlong val_time_packed(THD *thd) - { - return Time(thd, this, Time::Options_cmp(thd)).to_packed(); - } - longlong val_int() { return has_value() ? Date(this).to_longlong() : 0; } - double val_real() { return has_value() ? Date(this).to_double() : 0; } - String *val_str(String *to) - { - return has_value() ? Date(this).to_string(to) : NULL; - } - my_decimal *val_decimal(my_decimal *to) - { - return has_value() ? Date(this).to_decimal(to) : NULL; - } -}; - - -class Item_cache_timestamp: public Item_cache -{ - Timestamp_or_zero_datetime_native m_native; - Datetime to_datetime(THD *thd); -public: - Item_cache_timestamp(THD *thd) - :Item_cache(thd, &type_handler_timestamp2) { } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - bool cache_value(); - String* val_str(String *to) - { - return to_datetime(current_thd).to_string(to, decimals); - } - my_decimal *val_decimal(my_decimal *to) - { - return to_datetime(current_thd).to_decimal(to); - } - longlong val_int() - { - return to_datetime(current_thd).to_longlong(); - } - double val_real() - { - return to_datetime(current_thd).to_double(); - } - longlong val_datetime_packed(THD *thd) - { - return to_datetime(current_thd).to_packed(); - } - longlong val_time_packed(THD *thd) - { - DBUG_ASSERT(0); - return 0; - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - int save_in_field(Field *field, bool no_conversions); - bool val_native(THD *thd, Native *to); -}; - - -class Item_cache_real: public Item_cache -{ -protected: - double value; -public: - Item_cache_real(THD *thd, const Type_handler *h) - :Item_cache(thd, h), - value(0) - {} - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { return get_date_from_real(thd, ltime, fuzzydate); } - bool cache_value(); - Item *convert_to_basic_const_item(THD *thd); -}; - - -class Item_cache_double: public Item_cache_real -{ -public: - Item_cache_double(THD *thd) - :Item_cache_real(thd, &type_handler_double) - { } - String* val_str(String *str); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_cache_float: public Item_cache_real -{ -public: - Item_cache_float(THD *thd) - :Item_cache_real(thd, &type_handler_float) - { } - String* val_str(String *str); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_cache_decimal: public Item_cache -{ -protected: - my_decimal decimal_value; -public: - Item_cache_decimal(THD *thd): Item_cache(thd, &type_handler_newdecimal) {} - - double val_real(); - longlong val_int(); - String* val_str(String *str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) - { - return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, - NULL, NULL); - } - bool cache_value(); - Item *convert_to_basic_const_item(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_cache_str: public Item_cache -{ - char buffer[STRING_BUFFER_USUAL_SIZE]; - String *value, value_buff; - bool is_varbinary; - -public: - Item_cache_str(THD *thd, const Item *item): - Item_cache(thd, item->type_handler()), value(0), - is_varbinary(item->type() == FIELD_ITEM && - Item_cache_str::field_type() == MYSQL_TYPE_VARCHAR && - !((const Item_field *) item)->field->has_charset()) - { - collation.set(const_cast(item->collation)); - } - double val_real(); - longlong val_int(); - String* val_str(String *); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { return get_date_from_string(thd, ltime, fuzzydate); } - CHARSET_INFO *charset() const { return value->charset(); }; - int save_in_field(Field *field, bool no_conversions); - bool cache_value(); - Item *convert_to_basic_const_item(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_cache_str_for_nullif: public Item_cache_str -{ -public: - Item_cache_str_for_nullif(THD *thd, const Item *item) - :Item_cache_str(thd, item) - { } - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) - { - /** - Item_cache_str::safe_charset_converter() returns a new Item_cache - with Item_func_conv_charset installed on "example". The original - Item_cache is not referenced (neither directly nor recursively) - from the result of Item_cache_str::safe_charset_converter(). - - For NULLIF() purposes we need a different behavior: - we need a new instance of Item_func_conv_charset, - with the original Item_cache referenced in args[0]. See MDEV-9181. - */ - return Item::safe_charset_converter(thd, tocs); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_cache_row: public Item_cache -{ - Item_cache **values; - uint item_count; - bool save_array; -public: - Item_cache_row(THD *thd): - Item_cache(thd), values(0), item_count(2), - save_array(0) {} - - /* - 'allocate' used only in row transformer, to preallocate space for row - cache. - */ - bool allocate(THD *thd, uint num); - /* - 'setup' is needed only by row => it not called by simple row subselect - (only by IN subselect (in subselect optimizer)) - */ - bool setup(THD *thd, Item *item); - void store(Item *item); - void illegal_method_call(const char *); - void make_send_field(THD *thd, Send_field *) - { - illegal_method_call((const char*)"make_send_field"); - }; - double val_real() - { - illegal_method_call((const char*)"val"); - return 0; - }; - longlong val_int() - { - illegal_method_call((const char*)"val_int"); - return 0; - }; - String *val_str(String *) - { - illegal_method_call((const char*)"val_str"); - return 0; - }; - my_decimal *val_decimal(my_decimal *val) - { - illegal_method_call((const char*)"val_decimal"); - return 0; - }; - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - illegal_method_call((const char*)"val_decimal"); - return true; - } - - uint cols() const { return item_count; } - Item *element_index(uint i) { return values[i]; } - Item **addr(uint i) { return (Item **) (values + i); } - bool check_cols(uint c); - bool null_inside(); - void bring_value(); - void keep_array() { save_array= 1; } - void cleanup() - { - DBUG_ENTER("Item_cache_row::cleanup"); - Item_cache::cleanup(); - if (save_array) - bzero(values, item_count*sizeof(Item**)); - else - values= 0; - DBUG_VOID_RETURN; - } - bool cache_value(); - virtual void set_null(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - Item_type_holder used to store type. name, length of Item for UNIONS & - derived tables. - - Item_type_holder do not need cleanup() because its time of live limited by - single SP/PS execution. -*/ -class Item_type_holder: public Item, - public Type_handler_hybrid_field_type -{ -protected: - const TYPELIB *enum_set_typelib; -public: - Item_type_holder(THD *thd, Item *item) - :Item(thd, item), - Type_handler_hybrid_field_type(item->real_type_handler()), - enum_set_typelib(0) - { - DBUG_ASSERT(item->is_fixed()); - maybe_null= item->maybe_null; - } - Item_type_holder(THD *thd, - Item *item, - const Type_handler *handler, - const Type_all_attributes *attr, - bool maybe_null_arg) - :Item(thd), - Type_handler_hybrid_field_type(handler), - enum_set_typelib(attr->get_typelib()) - { - name= item->name; - Type_std_attributes::set(*attr); - maybe_null= maybe_null_arg; - common_flags= item->common_flags; - } - - const Type_handler *type_handler() const - { - return Type_handler_hybrid_field_type::type_handler()-> - type_handler_for_item_field(); - } - const Type_handler *real_type_handler() const - { - return Type_handler_hybrid_field_type::type_handler(); - } - - enum Type type() const { return TYPE_HOLDER; } - const TYPELIB *get_typelib() const { return enum_set_typelib; } - /* - When handling a query like this: - VALUES ('') UNION VALUES( _utf16 0x0020 COLLATE utf16_bin); - Item_type_holder can be passed to - Type_handler_xxx::Item_hybrid_func_fix_attributes() - We don't want the latter to perform character set conversion of a - Item_type_holder by calling its val_str(), which calls DBUG_ASSERT(0). - Let's override const_item() and is_expensive() to avoid this. - Note, Item_hybrid_func_fix_attributes() could probably - have a new argument to distinguish what we need: - - (a) aggregate data type attributes only - - (b) install converters after attribute aggregation - So st_select_lex_unit::join_union_type_attributes() could - ask it to do (a) only, without (b). - */ - bool const_item() const { return false; } - bool is_expensive() { return true; } - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - String *val_str(String*); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - return Item_type_holder::real_type_handler()-> - make_and_init_table_field(root, &name, Record_addr(maybe_null), - *this, table); - } - Item* get_copy(THD *thd) { return 0; } - -}; - - -class st_select_lex; -void mark_select_range_as_dependent(THD *thd, - st_select_lex *last_select, - st_select_lex *current_sel, - Field *found_field, Item *found_item, - Item_ident *resolved_item); - -extern Cached_item *new_Cached_item(THD *thd, Item *item, - bool pass_through_ref); -extern Item_result item_cmp_type(Item_result a,Item_result b); -extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item); -extern int stored_field_cmp_to_item(THD *thd, Field *field, Item *item); - -extern const String my_null_string; - -/** - Interface for Item iterator -*/ - -class Item_iterator -{ -public: - /** - Shall set this iterator to the position before the first item - - @note - This method also may perform some other initialization actions like - allocation of certain resources. - */ - virtual void open()= 0; - /** - Shall return the next Item (or NULL if there is no next item) and - move pointer to position after it. - */ - virtual Item *next()= 0; - /** - Shall force iterator to free resources (if it holds them) - - @note - One should not use the iterator without open() call after close() - */ - virtual void close()= 0; - - virtual ~Item_iterator() {} -}; - - -/** - Item iterator over List_iterator_fast for Item references -*/ - -class Item_iterator_ref_list: public Item_iterator -{ - List_iterator list; -public: - Item_iterator_ref_list(List_iterator &arg_list): - list(arg_list) {} - void open() { list.rewind(); } - Item *next() { return *(list++); } - void close() {} -}; - - -/** - Item iterator over List_iterator_fast for Items -*/ - -class Item_iterator_list: public Item_iterator -{ - List_iterator list; -public: - Item_iterator_list(List_iterator &arg_list): - list(arg_list) {} - void open() { list.rewind(); } - Item *next() { return (list++); } - void close() {} -}; - - -/** - Item iterator over Item interface for rows -*/ - -class Item_iterator_row: public Item_iterator -{ - Item *base_item; - uint current; -public: - Item_iterator_row(Item *base) : base_item(base), current(0) {} - void open() { current= 0; } - Item *next() - { - if (current >= base_item->cols()) - return NULL; - return base_item->element_index(current++); - } - void close() {} -}; - - -/* - It's used in ::fix_fields() methods of LIKE and JSON_SEARCH - functions to handle the ESCAPE parameter. - This parameter is quite non-standard so the specific function. -*/ -bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str, - bool escape_used_in_parsing, CHARSET_INFO *cmp_cs, - int *escape); - -inline bool Virtual_column_info::is_equal(const Virtual_column_info* vcol) const -{ - return type_handler() == vcol->type_handler() - && stored_in_db == vcol->is_stored() - && expr->eq(vcol->expr, true); -} - -inline void Virtual_column_info::print(String* str) -{ - expr->print_for_table_def(str); -} - -inline bool TABLE::mark_column_with_deps(Field *field) -{ - bool res; - if (!(res= bitmap_fast_test_and_set(read_set, field->field_index))) - { - if (field->vcol_info) - mark_virtual_column_deps(field); - } - return res; -} - -inline bool TABLE::mark_virtual_column_with_deps(Field *field) -{ - bool res; - DBUG_ASSERT(field->vcol_info); - if (!(res= bitmap_fast_test_and_set(read_set, field->field_index))) - mark_virtual_column_deps(field); - return res; -} - -inline void TABLE::mark_virtual_column_deps(Field *field) -{ - DBUG_ASSERT(field->vcol_info); - DBUG_ASSERT(field->vcol_info->expr); - field->vcol_info->expr->walk(&Item::register_field_in_read_map, 1, 0); -} - -inline void TABLE::use_all_stored_columns() -{ - bitmap_set_all(read_set); - if (Field **vf= vfield) - for (; *vf; vf++) - bitmap_clear_bit(read_set, (*vf)->field_index); -} - -#endif /* SQL_ITEM_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_cmpfunc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_cmpfunc.h deleted file mode 100644 index fa715ba..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_cmpfunc.h +++ /dev/null @@ -1,3590 +0,0 @@ -#ifndef ITEM_CMPFUNC_INCLUDED -#define ITEM_CMPFUNC_INCLUDED -/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* compare and test functions */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "item_func.h" /* Item_int_func, Item_bool_func */ -#include "item.h" - -extern Item_result item_cmp_type(Item_result a,Item_result b); -inline Item_result item_cmp_type(const Item *a, const Item *b) -{ - return item_cmp_type(a->cmp_type(), b->cmp_type()); -} -inline Item_result item_cmp_type(Item_result a, const Item *b) -{ - return item_cmp_type(a, b->cmp_type()); -} -class Item_bool_func2; -class Arg_comparator; - -typedef int (Arg_comparator::*arg_cmp_func)(); - -typedef int (*Item_field_cmpfunc)(Item *f1, Item *f2, void *arg); - -class Arg_comparator: public Sql_alloc -{ - Item **a, **b; - const Type_handler *m_compare_handler; - CHARSET_INFO *m_compare_collation; - arg_cmp_func func; - Item_func_or_sum *owner; - bool set_null; // TRUE <=> set owner->null_value - Arg_comparator *comparators; // used only for compare_row() - double precision; - /* Fields used in DATE/DATETIME comparison. */ - Item *a_cache, *b_cache; // Cached values of a and b items - // when one of arguments is NULL. - - int set_cmp_func(Item_func_or_sum *owner_arg, Item **a1, Item **a2); - - int compare_not_null_values(longlong val1, longlong val2) - { - if (set_null) - owner->null_value= false; - if (val1 < val2) return -1; - if (val1 == val2) return 0; - return 1; - } - NativeBuffer m_native1, m_native2; -public: - /* Allow owner function to use string buffers. */ - String value1, value2; - - Arg_comparator(): - m_compare_handler(&type_handler_null), - m_compare_collation(&my_charset_bin), - set_null(TRUE), comparators(0), - a_cache(0), b_cache(0) {}; - Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), - m_compare_handler(&type_handler_null), - m_compare_collation(&my_charset_bin), - set_null(TRUE), comparators(0), - a_cache(0), b_cache(0) {}; - -public: - bool set_cmp_func_for_row_arguments(); - bool set_cmp_func_row(); - bool set_cmp_func_string(); - bool set_cmp_func_time(); - bool set_cmp_func_datetime(); - bool set_cmp_func_native(); - bool set_cmp_func_int(); - bool set_cmp_func_real(); - bool set_cmp_func_decimal(); - - inline int set_cmp_func(Item_func_or_sum *owner_arg, - Item **a1, Item **a2, bool set_null_arg) - { - set_null= set_null_arg; - return set_cmp_func(owner_arg, a1, a2); - } - inline int compare() { return (this->*func)(); } - - int compare_string(); // compare args[0] & args[1] - int compare_real(); // compare args[0] & args[1] - int compare_decimal(); // compare args[0] & args[1] - int compare_int_signed(); // compare args[0] & args[1] - int compare_int_signed_unsigned(); - int compare_int_unsigned_signed(); - int compare_int_unsigned(); - int compare_row(); // compare args[0] & args[1] - int compare_e_string(); // compare args[0] & args[1] - int compare_e_real(); // compare args[0] & args[1] - int compare_e_decimal(); // compare args[0] & args[1] - int compare_e_int(); // compare args[0] & args[1] - int compare_e_int_diff_signedness(); - int compare_e_row(); // compare args[0] & args[1] - int compare_real_fixed(); - int compare_e_real_fixed(); - int compare_datetime(); - int compare_e_datetime(); - int compare_time(); - int compare_e_time(); - int compare_native(); - int compare_e_native(); - int compare_json_str_basic(Item *j, Item *s); - int compare_json_str(); - int compare_str_json(); - int compare_e_json_str_basic(Item *j, Item *s); - int compare_e_json_str(); - int compare_e_str_json(); - - void min_max_update_field_native(THD *thd, Field *field, Item *item, - int cmp_sign); - - Item** cache_converted_constant(THD *thd, Item **value, Item **cache, - const Type_handler *type); - inline bool is_owner_equal_func() - { - return (owner->type() == Item::FUNC_ITEM && - ((Item_func*)owner)->functype() == Item_func::EQUAL_FUNC); - } - const Type_handler *compare_type_handler() const { return m_compare_handler; } - Item_result compare_type() const { return m_compare_handler->cmp_type(); } - CHARSET_INFO *compare_collation() const { return m_compare_collation; } - Arg_comparator *subcomparators() const { return comparators; } - void cleanup() - { - delete [] comparators; - comparators= 0; - } - friend class Item_func; - friend class Item_bool_rowready_func2; -}; - - -class SEL_ARG; -struct KEY_PART; - -class Item_bool_func :public Item_int_func, - public Type_cmp_attributes -{ -protected: - /* - Build a SEL_TREE for a simple predicate - @param param PARAM from SQL_SELECT::test_quick_select - @param field field in the predicate - @param value constant in the predicate - @return Pointer to the tree built tree - */ - virtual SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) - { - DBUG_ENTER("Item_bool_func::get_func_mm_tree"); - DBUG_ASSERT(0); - DBUG_RETURN(0); - } - /* - Return the full select tree for "field_item" and "value": - - a single SEL_TREE if the field is not in a multiple equality, or - - a conjunction of all SEL_TREEs for all fields from - the same multiple equality with "field_item". - */ - SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param, - Item_field *field_item, Item *value); - /** - Test if "item" and "value" are suitable for the range optimization - and get their full select tree. - - "Suitable" means: - - "item" is a field or a field reference - - "value" is NULL (e.g. WHERE field IS NULL), or - "value" is an unexpensive item (e.g. WHERE field OP value) - - @param item - the argument that is checked to be a field - @param value - the other argument - @returns - NULL if the arguments are not suitable for the range optimizer. - @returns - the full select tree if the arguments are suitable. - */ - SEL_TREE *get_full_func_mm_tree_for_args(RANGE_OPT_PARAM *param, - Item *item, Item *value) - { - DBUG_ENTER("Item_bool_func::get_full_func_mm_tree_for_args"); - Item *field= item->real_item(); - if (field->type() == Item::FIELD_ITEM && !field->const_item() && - (!value || !value->is_expensive())) - DBUG_RETURN(get_full_func_mm_tree(param, (Item_field *) field, value)); - DBUG_RETURN(NULL); - } - SEL_TREE *get_mm_parts(RANGE_OPT_PARAM *param, Field *field, - Item_func::Functype type, Item *value); - SEL_TREE *get_ne_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *lt_value, Item *gt_value); - virtual SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, - KEY_PART *key_part, - Item_func::Functype type, Item *value); -public: - Item_bool_func(THD *thd): Item_int_func(thd) {} - Item_bool_func(THD *thd, Item *a): Item_int_func(thd, a) {} - Item_bool_func(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {} - Item_bool_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {} - Item_bool_func(THD *thd, List &list): Item_int_func(thd, list) { } - Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const { return &type_handler_bool; } - const Type_handler *fixed_type_handler() const { return &type_handler_bool; } - CHARSET_INFO *compare_collation() const { return NULL; } - bool fix_length_and_dec() { decimals=0; max_length=1; return FALSE; } - uint decimal_precision() const { return 1; } - bool need_parentheses_in_default() { return true; } -}; - - -/** - Abstract Item class, to represent X IS [NOT] (TRUE | FALSE) - boolean predicates. -*/ - -class Item_func_truth : public Item_bool_func -{ -public: - virtual bool val_bool(); - virtual longlong val_int(); - virtual bool fix_length_and_dec(); - virtual void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return CMP_PRECEDENCE; } - -protected: - Item_func_truth(THD *thd, Item *a, bool a_value, bool a_affirmative): - Item_bool_func(thd, a), value(a_value), affirmative(a_affirmative) - {} - - ~Item_func_truth() - {} -private: - /** - True for X IS [NOT] TRUE, - false for X IS [NOT] FALSE predicates. - */ - const bool value; - /** - True for X IS Y, false for X IS NOT Y predicates. - */ - const bool affirmative; -}; - - -/** - This Item represents a X IS TRUE boolean predicate. -*/ - -class Item_func_istrue : public Item_func_truth -{ -public: - Item_func_istrue(THD *thd, Item *a): Item_func_truth(thd, a, true, true) {} - ~Item_func_istrue() {} - virtual const char* func_name() const { return "istrue"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - This Item represents a X IS NOT TRUE boolean predicate. -*/ - -class Item_func_isnottrue : public Item_func_truth -{ -public: - Item_func_isnottrue(THD *thd, Item *a): - Item_func_truth(thd, a, true, false) {} - ~Item_func_isnottrue() {} - virtual const char* func_name() const { return "isnottrue"; } - bool find_not_null_fields(table_map allowed) { return false; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; } -}; - - -/** - This Item represents a X IS FALSE boolean predicate. -*/ - -class Item_func_isfalse : public Item_func_truth -{ -public: - Item_func_isfalse(THD *thd, Item *a): Item_func_truth(thd, a, false, true) {} - ~Item_func_isfalse() {} - virtual const char* func_name() const { return "isfalse"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - This Item represents a X IS NOT FALSE boolean predicate. -*/ - -class Item_func_isnotfalse : public Item_func_truth -{ -public: - Item_func_isnotfalse(THD *thd, Item *a): - Item_func_truth(thd, a, false, false) {} - ~Item_func_isnotfalse() {} - virtual const char* func_name() const { return "isnotfalse"; } - bool find_not_null_fields(table_map allowed) { return false; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; } -}; - - -class Item_cache; -#define UNKNOWN (-1) - - -/* - Item_in_optimizer(left_expr, Item_in_subselect(...)) - - Item_in_optimizer is used to wrap an instance of Item_in_subselect. This - class does the following: - - Evaluate the left expression and store it in Item_cache_* object (to - avoid re-evaluating it many times during subquery execution) - - Shortcut the evaluation of "NULL IN (...)" to NULL in the cases where we - don't care if the result is NULL or FALSE. - - NOTE - It is not quite clear why the above listed functionality should be - placed into a separate class called 'Item_in_optimizer'. -*/ - -class Item_in_optimizer: public Item_bool_func -{ -protected: - Item_cache *cache; - Item *expr_cache; - bool save_cache; - /* - Stores the value of "NULL IN (SELECT ...)" for uncorrelated subqueries: - UNKNOWN - "NULL in (SELECT ...)" has not yet been evaluated - FALSE - result is FALSE - TRUE - result is NULL - */ - int result_for_null_param; -public: - Item_in_optimizer(THD *thd, Item *a, Item *b): - Item_bool_func(thd, a, b), cache(0), expr_cache(0), - save_cache(0), result_for_null_param(UNKNOWN) - { m_with_subquery= true; } - bool fix_fields(THD *, Item **) override; - bool fix_left(THD *thd); - table_map not_null_tables() const override { return 0; } - bool is_null() override; - longlong val_int() override; - void cleanup() override; - enum Functype functype() const override { return IN_OPTIMIZER_FUNC; } - const char *func_name() const override { return ""; } - Item_cache **get_cache() { return &cache; } - void keep_top_level_cache(); - Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override; - Item *expr_cache_insert_transformer(THD *thd, uchar *unused) override; - bool is_expensive_processor(void *arg) override; - bool is_expensive() override; - void set_join_tab_idx(uint join_tab_idx_arg) override - { args[1]->set_join_tab_idx(join_tab_idx_arg); } - void get_cache_parameters(List ¶meters) override; - bool is_top_level_item() const override; - bool eval_not_null_tables(void *opt_arg) override; - bool find_not_null_fields(table_map allowed) override; - void fix_after_pullout(st_select_lex *new_parent, Item **ref, - bool merge) override; - bool invisible_mode(); - void reset_cache() { cache= NULL; } - void print(String *str, enum_query_type query_type) override; - void restore_first_argument(); - Item* get_wrapped_in_subselect_item() - { return args[1]; } - Item *get_copy(THD *thd) override - { return get_item_copy(thd, this); } - enum precedence precedence() const override { return args[1]->precedence(); } -}; - - -/* - Functions and operators with two arguments that can use range optimizer. -*/ -class Item_bool_func2 :public Item_bool_func -{ /* Bool with 2 string args */ -protected: - void add_key_fields_optimize_op(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables, bool equal_func); -public: - Item_bool_func2(THD *thd, Item *a, Item *b): - Item_bool_func(thd, a, b) { } - - bool is_null() { return MY_TEST(args[0]->is_null() || args[1]->is_null()); } - COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, - bool top_level); - bool count_sargable_conds(void *arg); - /* - Specifies which result type the function uses to compare its arguments. - This method is used in equal field propagation. - */ - virtual const Type_handler *compare_type_handler() const - { - /* - Have STRING_RESULT by default, which means the function compares - val_str() results of the arguments. This is suitable for Item_func_like - and for Item_func_spatial_rel. - Note, Item_bool_rowready_func2 overrides this default behaviour. - */ - return &type_handler_varchar; - } - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) - { - DBUG_ENTER("Item_bool_func2::get_mm_tree"); - DBUG_ASSERT(arg_count == 2); - SEL_TREE *ftree= get_full_func_mm_tree_for_args(param, args[0], args[1]); - if (!ftree) - ftree= Item_func::get_mm_tree(param, cond_ptr); - DBUG_RETURN(ftree); - } -}; - - -/** - A class for functions and operators that can use the range optimizer and - have a reverse function/operator that can also use the range optimizer, - so this condition: - WHERE value OP field - can be optimized as equivalent to: - WHERE field REV_OP value - - This class covers: - - scalar comparison predicates: <, <=, =, <=>, >=, > - - MBR and precise spatial relation predicates (e.g. SP_TOUCHES(x,y)) - - For example: - WHERE 10 > field - can be optimized as: - WHERE field < 10 -*/ -class Item_bool_func2_with_rev :public Item_bool_func2 -{ -protected: - SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) - { - DBUG_ENTER("Item_bool_func2_with_rev::get_func_mm_tree"); - Item_func::Functype func_type= - (value != arguments()[0]) ? functype() : rev_functype(); - DBUG_RETURN(get_mm_parts(param, field, func_type, value)); - } -public: - Item_bool_func2_with_rev(THD *thd, Item *a, Item *b): - Item_bool_func2(thd, a, b) { } - virtual enum Functype rev_functype() const= 0; - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) - { - DBUG_ENTER("Item_bool_func2_with_rev::get_mm_tree"); - DBUG_ASSERT(arg_count == 2); - SEL_TREE *ftree; - /* - Even if get_full_func_mm_tree_for_args(param, args[0], args[1]) will not - return a range predicate it may still be possible to create one - by reversing the order of the operands. Note that this only - applies to predicates where both operands are fields. Example: A - query of the form - - WHERE t1.a OP t2.b - - In this case, args[0] == t1.a and args[1] == t2.b. - When creating range predicates for t2, - get_full_func_mm_tree_for_args(param, args[0], args[1]) - will return NULL because 'field' belongs to t1 and only - predicates that applies to t2 are of interest. In this case a - call to get_full_func_mm_tree_for_args() with reversed operands - may succeed. - */ - if (!(ftree= get_full_func_mm_tree_for_args(param, args[0], args[1])) && - !(ftree= get_full_func_mm_tree_for_args(param, args[1], args[0]))) - ftree= Item_func::get_mm_tree(param, cond_ptr); - DBUG_RETURN(ftree); - } -}; - - -class Item_bool_rowready_func2 :public Item_bool_func2_with_rev -{ -protected: - Arg_comparator cmp; - bool check_arguments() const - { - return check_argument_types_like_args0(); - } -public: - Item_bool_rowready_func2(THD *thd, Item *a, Item *b): - Item_bool_func2_with_rev(thd, a, b), cmp(tmp_arg, tmp_arg + 1) - { } - Sql_mode_dependency value_depends_on_sql_mode() const; - void print(String *str, enum_query_type query_type) - { - Item_func::print_op(str, query_type); - } - enum precedence precedence() const { return CMP_PRECEDENCE; } - Item *neg_transformer(THD *thd); - virtual Item *negated_item(THD *thd); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { - Item_args::propagate_equal_fields(thd, - Context(ANY_SUBST, - cmp.compare_type_handler(), - compare_collation()), - cond); - return this; - } - bool fix_length_and_dec(); - int set_cmp_func() - { - return cmp.set_cmp_func(this, tmp_arg, tmp_arg + 1, true); - } - CHARSET_INFO *compare_collation() const { return cmp.compare_collation(); } - const Type_handler *compare_type_handler() const - { - return cmp.compare_type_handler(); - } - Arg_comparator *get_comparator() { return &cmp; } - void cleanup() - { - Item_bool_func2::cleanup(); - cmp.cleanup(); - } - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables) - { - return add_key_fields_optimize_op(join, key_fields, and_level, - usable_tables, sargables, false); - } - Item *build_clone(THD *thd) - { - Item_bool_rowready_func2 *clone= - (Item_bool_rowready_func2 *) Item_func::build_clone(thd); - if (clone) - { - clone->cmp.comparators= 0; - } - return clone; - } -}; - -/** - XOR inherits from Item_bool_func because it is not optimized yet. - Later, when XOR is optimized, it needs to inherit from - Item_cond instead. See WL#5800. -*/ -class Item_func_xor :public Item_bool_func -{ -public: - Item_func_xor(THD *thd, Item *i1, Item *i2): Item_bool_func(thd, i1, i2) {} - enum Functype functype() const { return XOR_FUNC; } - const char *func_name() const { return "xor"; } - enum precedence precedence() const { return XOR_PRECEDENCE; } - void print(String *str, enum_query_type query_type) - { Item_func::print_op(str, query_type); } - longlong val_int(); - bool find_not_null_fields(table_map allowed) { return false; } - Item *neg_transformer(THD *thd); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { - Item_args::propagate_equal_fields(thd, Context_boolean(), cond); - return this; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_not :public Item_bool_func -{ - bool abort_on_null; -public: - Item_func_not(THD *thd, Item *a): - Item_bool_func(thd, a), abort_on_null(FALSE) {} - void top_level_item() override { abort_on_null= 1; } - bool is_top_level_item() const override { return abort_on_null; } - longlong val_int() override; - enum Functype functype() const override { return NOT_FUNC; } - const char *func_name() const override { return "not"; } - bool find_not_null_fields(table_map allowed) override { return false; } - enum precedence precedence() const override { return NEG_PRECEDENCE; } - Item *neg_transformer(THD *thd) override; - bool fix_fields(THD *, Item **) override; - void print(String *str, enum_query_type query_type) override; - Item *get_copy(THD *thd) override - { return get_item_copy(thd, this); } -}; - -class Item_maxmin_subselect; - -/* - trigcond(arg) ::= param? arg : TRUE - - The class Item_func_trig_cond is used for guarded predicates - which are employed only for internal purposes. - A guarded predicate is an object consisting of an a regular or - a guarded predicate P and a pointer to a boolean guard variable g. - A guarded predicate P/g is evaluated to true if the value of the - guard g is false, otherwise it is evaluated to the same value that - the predicate P: val(P/g)= g ? val(P):true. - Guarded predicates allow us to include predicates into a conjunction - conditionally. Currently they are utilized for pushed down predicates - in queries with outer join operations. - - In the future, probably, it makes sense to extend this class to - the objects consisting of three elements: a predicate P, a pointer - to a variable g and a firing value s with following evaluation - rule: val(P/g,s)= g==s? val(P) : true. It will allow us to build only - one item for the objects of the form P/g1/g2... - - Objects of this class are built only for query execution after - the execution plan has been already selected. That's why this - class needs only val_int out of generic methods. - - Current uses of Item_func_trig_cond objects: - - To wrap selection conditions when executing outer joins - - To wrap condition that is pushed down into subquery -*/ - -class Item_func_trig_cond: public Item_bool_func -{ - bool *trig_var; -public: - Item_func_trig_cond(THD *thd, Item *a, bool *f): Item_bool_func(thd, a) - { trig_var= f; } - longlong val_int() { return *trig_var ? args[0]->val_int() : 1; } - enum Functype functype() const { return TRIG_COND_FUNC; }; - const char *func_name() const { return "trigcond"; }; - bool const_item() const { return FALSE; } - bool *get_trig_var() { return trig_var; } - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_not_all :public Item_func_not -{ - /* allow to check presence of values in max/min optimization */ - Item_sum_min_max *test_sum_item; - Item_maxmin_subselect *test_sub_item; - -public: - bool show; - - Item_func_not_all(THD *thd, Item *a): - Item_func_not(thd, a), test_sum_item(0), test_sub_item(0), show(0) - {} - table_map not_null_tables() const { return 0; } - longlong val_int(); - enum Functype functype() const { return NOT_ALL_FUNC; } - const char *func_name() const { return ""; } - bool fix_fields(THD *thd, Item **ref) - {return Item_func::fix_fields(thd, ref);} - virtual void print(String *str, enum_query_type query_type); - void set_sum_test(Item_sum_min_max *item) { test_sum_item= item; test_sub_item= 0; }; - void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; test_sum_item= 0;}; - bool empty_underlying_subquery(); - Item *neg_transformer(THD *thd); -}; - - -class Item_func_nop_all :public Item_func_not_all -{ -public: - - Item_func_nop_all(THD *thd, Item *a): Item_func_not_all(thd, a) {} - longlong val_int(); - const char *func_name() const { return ""; } - Item *neg_transformer(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_eq :public Item_bool_rowready_func2 -{ - bool abort_on_null; -public: - Item_func_eq(THD *thd, Item *a, Item *b): - Item_bool_rowready_func2(thd, a, b), - abort_on_null(false), in_equality_no(UINT_MAX) - {} - longlong val_int(); - enum Functype functype() const { return EQ_FUNC; } - enum Functype rev_functype() const { return EQ_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } - const char *func_name() const { return "="; } - void top_level_item() { abort_on_null= true; } - Item *negated_item(THD *thd); - COND *build_equal_items(THD *thd, COND_EQUAL *inherited, - bool link_item_fields, - COND_EQUAL **cond_equal_ref); - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables) - { - return add_key_fields_optimize_op(join, key_fields, and_level, - usable_tables, sargables, true); - } - bool check_equality(THD *thd, COND_EQUAL *cond, List *eq_list); - /* - - If this equality is created from the subquery's IN-equality: - number of the item it was created from, e.g. for - (a,b) IN (SELECT c,d ...) a=c will have in_equality_no=0, - and b=d will have in_equality_no=1. - - Otherwise, UINT_MAX - */ - uint in_equality_no; - virtual uint exists2in_reserved_items() { return 1; }; - friend class Arg_comparator; - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_equal final :public Item_bool_rowready_func2 -{ -public: - Item_func_equal(THD *thd, Item *a, Item *b): - Item_bool_rowready_func2(thd, a, b) {} - longlong val_int(); - bool fix_length_and_dec(); - table_map not_null_tables() const { return 0; } - bool find_not_null_fields(table_map allowed) { return false; } - enum Functype functype() const { return EQUAL_FUNC; } - enum Functype rev_functype() const { return EQUAL_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } - const char *func_name() const { return "<=>"; } - Item *neg_transformer(THD *thd) { return 0; } - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables) - { - return add_key_fields_optimize_op(join, key_fields, and_level, - usable_tables, sargables, true); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_ge :public Item_bool_rowready_func2 -{ -public: - Item_func_ge(THD *thd, Item *a, Item *b): - Item_bool_rowready_func2(thd, a, b) {}; - longlong val_int(); - enum Functype functype() const { return GE_FUNC; } - enum Functype rev_functype() const { return LE_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } - const char *func_name() const { return ">="; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_gt :public Item_bool_rowready_func2 -{ -public: - Item_func_gt(THD *thd, Item *a, Item *b): - Item_bool_rowready_func2(thd, a, b) {}; - longlong val_int(); - enum Functype functype() const { return GT_FUNC; } - enum Functype rev_functype() const { return LT_FUNC; } - cond_result eq_cmp_result() const { return COND_FALSE; } - const char *func_name() const { return ">"; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_le :public Item_bool_rowready_func2 -{ -public: - Item_func_le(THD *thd, Item *a, Item *b): - Item_bool_rowready_func2(thd, a, b) {}; - longlong val_int(); - enum Functype functype() const { return LE_FUNC; } - enum Functype rev_functype() const { return GE_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } - const char *func_name() const { return "<="; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_lt :public Item_bool_rowready_func2 -{ -public: - Item_func_lt(THD *thd, Item *a, Item *b): - Item_bool_rowready_func2(thd, a, b) {} - longlong val_int(); - enum Functype functype() const { return LT_FUNC; } - enum Functype rev_functype() const { return GT_FUNC; } - cond_result eq_cmp_result() const { return COND_FALSE; } - const char *func_name() const { return "<"; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_ne :public Item_bool_rowready_func2 -{ -protected: - SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) - { - DBUG_ENTER("Item_func_ne::get_func_mm_tree"); - DBUG_RETURN(get_ne_mm_tree(param, field, value, value)); - } -public: - Item_func_ne(THD *thd, Item *a, Item *b): - Item_bool_rowready_func2(thd, a, b) {} - longlong val_int(); - enum Functype functype() const { return NE_FUNC; } - enum Functype rev_functype() const { return NE_FUNC; } - cond_result eq_cmp_result() const { return COND_FALSE; } - const char *func_name() const { return "<>"; } - Item *negated_item(THD *thd); - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - The class Item_func_opt_neg is defined to factor out the functionality - common for the classes Item_func_between and Item_func_in. The objects - of these classes can express predicates or there negations. - The alternative approach would be to create pairs Item_func_between, - Item_func_notbetween and Item_func_in, Item_func_notin. - -*/ - -class Item_func_opt_neg :public Item_bool_func -{ -protected: - /* - The data type handler that will be used for comparison. - Data type handlers of all arguments are mixed to here. - */ - Type_handler_hybrid_field_type m_comparator; - /* - The collation that will be used for comparison in case - when m_compare_type is STRING_RESULT. - */ - DTCollation cmp_collation; -public: - bool negated; /* <=> the item represents NOT */ - bool pred_level; /* <=> [NOT] is used on a predicate level */ -public: - Item_func_opt_neg(THD *thd, Item *a, Item *b, Item *c): - Item_bool_func(thd, a, b, c), negated(0), pred_level(0) {} - Item_func_opt_neg(THD *thd, List &list): - Item_bool_func(thd, list), negated(0), pred_level(0) {} -public: - void top_level_item() override { pred_level= 1; } - bool is_top_level_item() const override { return pred_level; } - Item *neg_transformer(THD *thd) override - { - negated= !negated; - return this; - } - bool eq(const Item *item, bool binary_cmp) const override; - CHARSET_INFO *compare_collation() const override - { - return cmp_collation.collation; - } - Item *propagate_equal_fields(THD *, const Context &, - COND_EQUAL *) override= 0; -}; - -class Item_func_between :public Item_func_opt_neg -{ -protected: - SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value); - bool val_int_cmp_int_finalize(longlong value, longlong a, longlong b); -public: - String value0,value1,value2; - Item_func_between(THD *thd, Item *a, Item *b, Item *c): - Item_func_opt_neg(thd, a, b, c) { } - longlong val_int() - { - DBUG_ASSERT(fixed); - return m_comparator.type_handler()->Item_func_between_val_int(this); - } - enum Functype functype() const { return BETWEEN; } - const char *func_name() const { return "between"; } - enum precedence precedence() const { return BETWEEN_PRECEDENCE; } - bool fix_length_and_dec(); - bool fix_length_and_dec_string(THD *) - { - return agg_arg_charsets_for_comparison(cmp_collation, args, 3); - } - bool fix_length_and_dec_temporal(THD *); - bool fix_length_and_dec_numeric(THD *); - virtual void print(String *str, enum_query_type query_type); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - bool count_sargable_conds(void *arg); - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { - Item_args::propagate_equal_fields(thd, - Context(ANY_SUBST, - m_comparator.type_handler(), - compare_collation()), - cond); - return this; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - - longlong val_int_cmp_string(); - longlong val_int_cmp_datetime(); - longlong val_int_cmp_time(); - longlong val_int_cmp_native(); - longlong val_int_cmp_int(); - longlong val_int_cmp_real(); - longlong val_int_cmp_decimal(); -}; - - -class Item_func_strcmp :public Item_long_func -{ - bool check_arguments() const - { return check_argument_types_can_return_str(0, 2); } - String value1, value2; - DTCollation cmp_collation; -public: - Item_func_strcmp(THD *thd, Item *a, Item *b): - Item_long_func(thd, a, b) {} - longlong val_int(); - uint decimal_precision() const { return 1; } - const char *func_name() const { return "strcmp"; } - bool fix_length_and_dec() - { - if (agg_arg_charsets_for_comparison(cmp_collation, args, 2)) - return TRUE; - fix_char_length(2); // returns "1" or "0" or "-1" - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -struct interval_range -{ - Item_result type; - double dbl; - my_decimal dec; -}; - -class Item_func_interval :public Item_long_func -{ - Item_row *row; - bool use_decimal_comparison; - interval_range *intervals; - bool check_arguments() const - { - return check_argument_types_like_args0(); - } -public: - Item_func_interval(THD *thd, Item_row *a): - Item_long_func(thd, a), row(a), intervals(0) - { } - bool fix_fields(THD *, Item **); - longlong val_int(); - bool fix_length_and_dec(); - const char *func_name() const { return "interval"; } - uint decimal_precision() const { return 2; } - void print(String *str, enum_query_type query_type) - { - str->append(func_name()); - print_args(str, 0, query_type); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_coalesce :public Item_func_case_expression -{ -public: - Item_func_coalesce(THD *thd, Item *a, Item *b): - Item_func_case_expression(thd, a, b) {} - Item_func_coalesce(THD *thd, List &list): - Item_func_case_expression(thd, list) {} - double real_op(); - longlong int_op(); - String *str_op(String *); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - bool fix_length_and_dec() - { - if (aggregate_for_result(func_name(), args, arg_count, true)) - return TRUE; - fix_attributes(args, arg_count); - return FALSE; - } - const char *func_name() const { return "coalesce"; } - table_map not_null_tables() const { return 0; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - Case abbreviations that aggregate its result field type by two arguments: - IFNULL(arg1, arg2) - IF(switch, arg1, arg2) - NVL2(switch, arg1, arg2) -*/ -class Item_func_case_abbreviation2 :public Item_func_case_expression -{ -protected: - bool fix_length_and_dec2(Item **items) - { - if (aggregate_for_result(func_name(), items, 2, true)) - return TRUE; - fix_attributes(items, 2); - return FALSE; - } - - void cache_type_info(const Item *source, bool maybe_null_arg) - { - Type_std_attributes::set(source); - set_handler(source->type_handler()); - maybe_null= maybe_null_arg; - } - - bool fix_length_and_dec2_eliminate_null(Item **items) - { - // Let IF(cond, expr, NULL) and IF(cond, NULL, expr) inherit type from expr. - if (items[0]->type() == NULL_ITEM) - { - cache_type_info(items[1], true); - // If both arguments are NULL, make resulting type BINARY(0). - if (items[1]->type() == NULL_ITEM) - set_handler(&type_handler_string); - } - else if (items[1]->type() == NULL_ITEM) - { - cache_type_info(items[0], true); - } - else - { - if (fix_length_and_dec2(items)) - return TRUE; - } - return FALSE; - } - -public: - Item_func_case_abbreviation2(THD *thd, Item *a, Item *b): - Item_func_case_expression(thd, a, b) { } - Item_func_case_abbreviation2(THD *thd, Item *a, Item *b, Item *c): - Item_func_case_expression(thd, a, b, c) { } -}; - - -class Item_func_ifnull :public Item_func_case_abbreviation2 -{ -public: - Item_func_ifnull(THD *thd, Item *a, Item *b): - Item_func_case_abbreviation2(thd, a, b) {} - double real_op(); - longlong int_op(); - String *str_op(String *str); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - bool fix_length_and_dec() - { - /* - Set nullability from args[1] by default. - Note, some type handlers may reset maybe_null - in Item_hybrid_func_fix_attributes() if args[1] - is NOT NULL but cannot always be converted to - the data type of "this" safely. - E.g. Type_handler_inet6 does: - IFNULL(inet6_not_null_expr, 'foo') -> INET6 NULL - IFNULL(inet6_not_null_expr, '::1') -> INET6 NOT NULL - */ - maybe_null= args[1]->maybe_null; - if (Item_func_case_abbreviation2::fix_length_and_dec2(args)) - return TRUE; - return FALSE; - } - const char *func_name() const { return "ifnull"; } - - table_map not_null_tables() const { return 0; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - Case abbreviations that have a switch argument and - two return arguments to choose from. Returns the value - of either of the two return arguments depending on the switch argument value. - - IF(switch, arg1, arg2) - NVL(switch, arg1, arg2) -*/ -class Item_func_case_abbreviation2_switch: public Item_func_case_abbreviation2 -{ -protected: - virtual Item *find_item() const= 0; - -public: - Item_func_case_abbreviation2_switch(THD *thd, Item *a, Item *b, Item *c) - :Item_func_case_abbreviation2(thd, a, b, c) - { } - - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - Datetime_truncation_not_needed dt(thd, find_item(), fuzzydate); - return (null_value= dt.copy_to_mysql_time(ltime, mysql_timestamp_type())); - } - bool time_op(THD *thd, MYSQL_TIME *ltime) - { - return (null_value= Time(find_item()).copy_to_mysql_time(ltime)); - } - longlong int_op() - { - return val_int_from_item(find_item()); - } - double real_op() - { - return val_real_from_item(find_item()); - } - my_decimal *decimal_op(my_decimal *decimal_value) - { - return val_decimal_from_item(find_item(), decimal_value); - } - String *str_op(String *str) - { - return val_str_from_item(find_item(), str); - } - bool native_op(THD *thd, Native *to) - { - return val_native_with_conversion_from_item(thd, find_item(), to, - type_handler()); - } -}; - - -class Item_func_if :public Item_func_case_abbreviation2_switch -{ -protected: - Item *find_item() const { return args[0]->val_bool() ? args[1] : args[2]; } - -public: - Item_func_if(THD *thd, Item *a, Item *b, Item *c): - Item_func_case_abbreviation2_switch(thd, a, b, c) - {} - bool fix_fields(THD *, Item **); - bool fix_length_and_dec() - { - return fix_length_and_dec2_eliminate_null(args + 1); - } - const char *func_name() const { return "if"; } - bool eval_not_null_tables(void *opt_arg); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -private: - void cache_type_info(Item *source); -}; - - -class Item_func_nvl2 :public Item_func_case_abbreviation2_switch -{ -protected: - Item *find_item() const { return args[0]->is_null() ? args[2] : args[1]; } - -public: - Item_func_nvl2(THD *thd, Item *a, Item *b, Item *c): - Item_func_case_abbreviation2_switch(thd, a, b, c) - {} - const char *func_name() const { return "nvl2"; } - bool fix_length_and_dec() - { - return fix_length_and_dec2_eliminate_null(args + 1); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_nullif :public Item_func_case_expression -{ - Arg_comparator cmp; - /* - NULLIF(a,b) is a short for: - CASE WHEN a=b THEN NULL ELSE a END - - The left "a" is for comparison purposes. - The right "a" is for return value purposes. - These are two different "a" and they can be replaced to different items. - - The left "a" is in a comparison and can be replaced by: - - Item_func::convert_const_compared_to_int_field() - - agg_item_set_converter() in set_cmp_func() - - cache_converted_constant() in set_cmp_func() - - Both "a"s are subject to equal fields propagation and can be replaced by: - - Item_field::propagate_equal_fields(ANY_SUBST) for the left "a" - - Item_field::propagate_equal_fields(IDENTITY_SUBST) for the right "a" - */ - Item_cache *m_cache; - int compare(); - void reset_first_arg_if_needed() - { - if (arg_count == 3 && args[0] != args[2]) - args[0]= args[2]; - } - Item *m_arg0; -public: - /* - Here we pass three arguments to the parent constructor, as NULLIF - is a three-argument function, it needs two copies of the first argument - (see above). But fix_fields() will be confused if we try to prepare the - same Item twice (if args[0]==args[2]), so we hide the third argument - (decrementing arg_count) and copy args[2]=args[0] again after fix_fields(). - See also Item_func_nullif::fix_length_and_dec(). - */ - Item_func_nullif(THD *thd, Item *a, Item *b): - Item_func_case_expression(thd, a, b, a), - m_cache(NULL), - m_arg0(NULL) - { arg_count--; } - void cleanup() - { - Item_func_hybrid_field_type::cleanup(); - arg_count= 2; // See the comment to the constructor - } - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - double real_op(); - longlong int_op(); - String *str_op(String *str); - my_decimal *decimal_op(my_decimal *); - bool native_op(THD *thd, Native *to); - bool fix_length_and_dec(); - bool walk(Item_processor processor, bool walk_subquery, void *arg); - const char *func_name() const { return "nullif"; } - void print(String *str, enum_query_type query_type); - void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - void update_used_tables(); - table_map not_null_tables() const { return 0; } - bool is_null(); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { - Context cmpctx(ANY_SUBST, cmp.compare_type_handler(), - cmp.compare_collation()); - const Item *old0= args[0]; - args[0]->propagate_equal_fields_and_change_item_tree(thd, cmpctx, - cond, &args[0]); - args[1]->propagate_equal_fields_and_change_item_tree(thd, cmpctx, - cond, &args[1]); - /* - MDEV-9712 Performance degradation of nested NULLIF - ANY_SUBST is more relaxed than IDENTITY_SUBST. - If ANY_SUBST did not change args[0], - then we can skip propagation for args[2]. - */ - if (old0 != args[0]) - args[2]->propagate_equal_fields_and_change_item_tree(thd, - Context_identity(), - cond, &args[2]); - return this; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *derived_field_transformer_for_having(THD *thd, uchar *arg) - { reset_first_arg_if_needed(); return this; } - Item *derived_field_transformer_for_where(THD *thd, uchar *arg) - { reset_first_arg_if_needed(); return this; } - Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) - { reset_first_arg_if_needed(); return this; } - Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) - { reset_first_arg_if_needed(); return this; } - Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) - { reset_first_arg_if_needed(); return this; } -}; - - -/* Functions to handle the optimized IN */ - - -/* A vector of values of some type */ - -class in_vector :public Sql_alloc -{ -public: - char *base; - uint size; - qsort2_cmp compare; - CHARSET_INFO *collation; - uint count; - uint used_count; - in_vector() {} - in_vector(THD *thd, uint elements, uint element_length, qsort2_cmp cmp_func, - CHARSET_INFO *cmp_coll) - :base((char*) thd_calloc(thd, elements * element_length)), - size(element_length), compare(cmp_func), collation(cmp_coll), - count(elements), used_count(elements) {} - virtual ~in_vector() {} - virtual void set(uint pos,Item *item)=0; - virtual uchar *get_value(Item *item)=0; - void sort() - { - my_qsort2(base,used_count,size,compare,(void*)collation); - } - bool find(Item *item); - - /* - Create an instance of Item_{type} (e.g. Item_decimal) constant object - which type allows it to hold an element of this vector without any - conversions. - The purpose of this function is to be able to get elements of this - vector in form of Item_xxx constants without creating Item_xxx object - for every array element you get (i.e. this implements "FlyWeight" pattern) - */ - virtual Item* create_item(THD *thd) { return NULL; } - - /* - Store the value at position #pos into provided item object - SYNOPSIS - value_to_item() - pos Index of value to store - item Constant item to store value into. The item must be of the same - type that create_item() returns. - */ - virtual void value_to_item(uint pos, Item *item) { } - - /* Compare values number pos1 and pos2 for equality */ - bool compare_elems(uint pos1, uint pos2) - { - return MY_TEST(compare(collation, base + pos1 * size, base + pos2 * size)); - } - virtual const Type_handler *type_handler() const= 0; -}; - -class in_string :public in_vector -{ - char buff[STRING_BUFFER_USUAL_SIZE]; - String tmp; - class Item_string_for_in_vector: public Item_string - { - public: - Item_string_for_in_vector(THD *thd, CHARSET_INFO *cs): - Item_string(thd, cs) - { } - void set_value(const String *str) - { - str_value= *str; - collation.set(str->charset()); - } - }; -public: - in_string(THD *thd, uint elements, qsort2_cmp cmp_func, CHARSET_INFO *cs); - ~in_string(); - void set(uint pos,Item *item); - uchar *get_value(Item *item); - Item* create_item(THD *thd); - void value_to_item(uint pos, Item *item) - { - String *str=((String*) base)+pos; - Item_string_for_in_vector *to= (Item_string_for_in_vector*) item; - to->set_value(str); - } - const Type_handler *type_handler() const { return &type_handler_varchar; } -}; - -class in_longlong :public in_vector -{ -protected: - /* - Here we declare a temporary variable (tmp) of the same type as the - elements of this vector. tmp is used in finding if a given value is in - the list. - */ - struct packed_longlong - { - longlong val; - longlong unsigned_flag; // Use longlong, not bool, to preserve alignment - } tmp; -public: - in_longlong(THD *thd, uint elements); - void set(uint pos,Item *item); - uchar *get_value(Item *item); - Item* create_item(THD *thd); - void value_to_item(uint pos, Item *item) - { - ((Item_int*) item)->value= ((packed_longlong*) base)[pos].val; - ((Item_int*) item)->unsigned_flag= (bool) - ((packed_longlong*) base)[pos].unsigned_flag; - } - const Type_handler *type_handler() const { return &type_handler_slonglong; } - - friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b); -}; - - -class in_timestamp :public in_vector -{ - Timestamp_or_zero_datetime tmp; -public: - in_timestamp(THD *thd, uint elements); - void set(uint pos,Item *item); - uchar *get_value(Item *item); - Item* create_item(THD *thd); - void value_to_item(uint pos, Item *item); - const Type_handler *type_handler() const { return &type_handler_timestamp2; } -}; - - -/* - Class to represent a vector of constant DATE/DATETIME values. -*/ -class in_temporal :public in_longlong -{ -public: - /* Cache for the left item. */ - - in_temporal(THD *thd, uint elements) - :in_longlong(thd, elements) {}; - Item *create_item(THD *thd); - void value_to_item(uint pos, Item *item) - { - packed_longlong *val= reinterpret_cast(base)+pos; - Item_datetime *dt= static_cast(item); - dt->set(val->val, type_handler()->mysql_timestamp_type()); - } - friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b); -}; - - -class in_datetime :public in_temporal -{ -public: - in_datetime(THD *thd, uint elements) - :in_temporal(thd, elements) - {} - void set(uint pos,Item *item); - uchar *get_value(Item *item); - const Type_handler *type_handler() const { return &type_handler_datetime2; } -}; - - -class in_time :public in_temporal -{ -public: - in_time(THD *thd, uint elements) - :in_temporal(thd, elements) - {} - void set(uint pos,Item *item); - uchar *get_value(Item *item); - const Type_handler *type_handler() const { return &type_handler_time2; } -}; - - -class in_double :public in_vector -{ - double tmp; -public: - in_double(THD *thd, uint elements); - void set(uint pos,Item *item); - uchar *get_value(Item *item); - Item *create_item(THD *thd); - void value_to_item(uint pos, Item *item) - { - ((Item_float*)item)->value= ((double*) base)[pos]; - } - const Type_handler *type_handler() const { return &type_handler_double; } -}; - - -class in_decimal :public in_vector -{ - my_decimal val; -public: - in_decimal(THD *thd, uint elements); - void set(uint pos, Item *item); - uchar *get_value(Item *item); - Item *create_item(THD *thd); - void value_to_item(uint pos, Item *item) - { - my_decimal *dec= ((my_decimal *)base) + pos; - Item_decimal *item_dec= (Item_decimal*)item; - item_dec->set_decimal_value(dec); - } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } -}; - - -/* -** Classes for easy comparing of non const items -*/ - -class cmp_item :public Sql_alloc -{ -public: - CHARSET_INFO *cmp_charset; - cmp_item() { cmp_charset= &my_charset_bin; } - virtual ~cmp_item() {} - virtual void store_value(Item *item)= 0; - /** - @returns result (TRUE, FALSE or UNKNOWN) of - "stored argument's value <> item's value" - */ - virtual int cmp(Item *item)= 0; - virtual int cmp_not_null(const Value *value)= 0; - // for optimized IN with row - virtual int compare(cmp_item *item)= 0; - virtual cmp_item *make_same()= 0; - virtual void store_value_by_template(THD *thd, cmp_item *tmpl, Item *item) - { - store_value(item); - } -}; - -/// cmp_item which stores a scalar (i.e. non-ROW). -class cmp_item_scalar : public cmp_item -{ -protected: - bool m_null_value; ///< If stored value is NULL -}; - -class cmp_item_string : public cmp_item_scalar -{ -protected: - String *value_res; -public: - cmp_item_string () {} - cmp_item_string (CHARSET_INFO *cs) { cmp_charset= cs; } - void set_charset(CHARSET_INFO *cs) { cmp_charset= cs; } - friend class cmp_item_sort_string; - friend class cmp_item_sort_string_in_static; -}; - -class cmp_item_sort_string :public cmp_item_string -{ -protected: - char value_buff[STRING_BUFFER_USUAL_SIZE]; - String value; -public: - cmp_item_sort_string(): - cmp_item_string() {} - cmp_item_sort_string(CHARSET_INFO *cs): - cmp_item_string(cs), - value(value_buff, sizeof(value_buff), cs) {} - void store_value(Item *item) - { - value_res= item->val_str(&value); - m_null_value= item->null_value; - // Make sure to cache the result String inside "value" - if (value_res && value_res != &value) - { - if (value.copy(*value_res)) - value.set("", 0, item->collation.collation); - value_res= &value; - } - } - int cmp_not_null(const Value *val) - { - DBUG_ASSERT(!val->is_null()); - DBUG_ASSERT(val->is_string()); - return sortcmp(value_res, &val->m_string, cmp_charset) != 0; - } - int cmp(Item *arg) - { - char buff[STRING_BUFFER_USUAL_SIZE]; - String tmp(buff, sizeof(buff), cmp_charset), *res= arg->val_str(&tmp); - if (m_null_value || arg->null_value) - return UNKNOWN; - if (value_res && res) - return sortcmp(value_res, res, cmp_charset) != 0; - else if (!value_res && !res) - return FALSE; - else - return TRUE; - } - int compare(cmp_item *ci) - { - cmp_item_string *l_cmp= (cmp_item_string *) ci; - return sortcmp(value_res, l_cmp->value_res, cmp_charset); - } - cmp_item *make_same(); - void set_charset(CHARSET_INFO *cs) - { - cmp_charset= cs; - value.set_quick(value_buff, sizeof(value_buff), cs); - } -}; - -class cmp_item_int : public cmp_item_scalar -{ - longlong value; -public: - cmp_item_int() {} /* Remove gcc warning */ - void store_value(Item *item) - { - value= item->val_int(); - m_null_value= item->null_value; - } - int cmp_not_null(const Value *val) - { - DBUG_ASSERT(!val->is_null()); - DBUG_ASSERT(val->is_longlong()); - return value != val->value.m_longlong; - } - int cmp(Item *arg) - { - const bool rc= value != arg->val_int(); - return (m_null_value || arg->null_value) ? UNKNOWN : rc; - } - int compare(cmp_item *ci) - { - cmp_item_int *l_cmp= (cmp_item_int *)ci; - return (value < l_cmp->value) ? -1 : ((value == l_cmp->value) ? 0 : 1); - } - cmp_item *make_same(); -}; - -/* - Compare items in the DATETIME context. -*/ -class cmp_item_temporal: public cmp_item_scalar -{ -protected: - longlong value; -public: - cmp_item_temporal() {} - int compare(cmp_item *ci); -}; - - -class cmp_item_datetime: public cmp_item_temporal -{ -public: - cmp_item_datetime() - :cmp_item_temporal() - { } - void store_value(Item *item) - { - value= item->val_datetime_packed(current_thd); - m_null_value= item->null_value; - } - int cmp_not_null(const Value *val); - int cmp(Item *arg); - cmp_item *make_same(); -}; - - -class cmp_item_time: public cmp_item_temporal -{ -public: - cmp_item_time() - :cmp_item_temporal() - { } - void store_value(Item *item) - { - value= item->val_time_packed(current_thd); - m_null_value= item->null_value; - } - int cmp_not_null(const Value *val); - int cmp(Item *arg); - cmp_item *make_same(); -}; - - -class cmp_item_timestamp: public cmp_item_scalar -{ - Timestamp_or_zero_datetime_native m_native; -public: - cmp_item_timestamp() :cmp_item_scalar() { } - void store_value(Item *item); - int cmp_not_null(const Value *val); - int cmp(Item *arg); - int compare(cmp_item *ci); - cmp_item *make_same(); -}; - - -class cmp_item_real : public cmp_item_scalar -{ - double value; -public: - cmp_item_real() {} /* Remove gcc warning */ - void store_value(Item *item) - { - value= item->val_real(); - m_null_value= item->null_value; - } - int cmp_not_null(const Value *val) - { - DBUG_ASSERT(!val->is_null()); - DBUG_ASSERT(val->is_double()); - return value != val->value.m_double; - } - int cmp(Item *arg) - { - const bool rc= value != arg->val_real(); - return (m_null_value || arg->null_value) ? UNKNOWN : rc; - } - int compare(cmp_item *ci) - { - cmp_item_real *l_cmp= (cmp_item_real *) ci; - return (value < l_cmp->value)? -1 : ((value == l_cmp->value) ? 0 : 1); - } - cmp_item *make_same(); -}; - - -class cmp_item_decimal : public cmp_item_scalar -{ - my_decimal value; -public: - cmp_item_decimal() {} /* Remove gcc warning */ - void store_value(Item *item); - int cmp(Item *arg); - int cmp_not_null(const Value *val); - int compare(cmp_item *c); - cmp_item *make_same(); -}; - - -/* - cmp_item for optimized IN with row (right part string, which never - be changed) -*/ - -class cmp_item_sort_string_in_static :public cmp_item_string -{ - protected: - String value; -public: - cmp_item_sort_string_in_static(CHARSET_INFO *cs): - cmp_item_string(cs) {} - void store_value(Item *item) - { - value_res= item->val_str(&value); - m_null_value= item->null_value; - } - int cmp_not_null(const Value *val) - { - DBUG_ASSERT(false); - return TRUE; - } - int cmp(Item *item) - { - // Should never be called - DBUG_ASSERT(false); - return TRUE; - } - int compare(cmp_item *ci) - { - cmp_item_string *l_cmp= (cmp_item_string *) ci; - return sortcmp(value_res, l_cmp->value_res, cmp_charset); - } - cmp_item *make_same() - { - return new cmp_item_sort_string_in_static(cmp_charset); - } -}; - - -/** - A helper class to handle situations when some item "pred" (the predicant) - is consequently compared to a list of other items value0..valueN (the values). - Currently used to handle: - - - pred IN (value0, value1, value2) - - - CASE pred WHEN value0 .. WHEN value1 .. WHEN value2 .. END - - Every pair {pred,valueN} can be compared by its own Type_handler. - Some pairs can use the same Type_handler. - In cases when all pairs use exactly the same Type_handler, - we say "all types are compatible". - - For example, for an expression - 1 IN (1, 1e0, 1.0, 2) - - pred is 1 - - value0 is 1 - - value1 is 1e0 - - value2 is 1.1 - - value3 is 2 - - Pairs (pred,valueN) are compared as follows: - N expr1 Type - - ----- ---- - 0 1 INT - 1 1e0 DOUBLE - 2 1.0 DECIMAL - 3 2 INT - - Types are not compatible in this example. - - During add_value() calls, each pair {pred,valueN} is analysed: - - If valueN is an explicit NULL, it can be ignored in the caller asks to do so - - If valueN is not an explicit NULL (or if the caller didn't ask to skip - NULLs), then the value add an element in the array m_comparators[]. - - Every element m_comparators[] stores the following information: - 1. m_arg_index - the position of the value expression in the original - argument array, e.g. in Item_func_in::args[] or Item_func_case::args[]. - - 2. m_handler - the pointer to the data type handler that the owner - will use to compare the pair {args[m_predicate_index],args[m_arg_index]}. - - 3. m_handler_index - the index of an m_comparators[] element corresponding - to the leftmost pair that uses exactly the same Type_handler for - comparison. m_handler_index helps to maintain unique data type handlers. - - m_comparators[i].m_handler_index==i means that this is the - leftmost pair that uses the Type_handler m_handler for comparision. - - If m_comparators[i].m_handlex_index!=i, it means that some earlier - element m_comparators[jm_cmp_item; - DBUG_ASSERT(in_item); - /* - If this is the leftmost pair that uses the data type handler - pointed by m_comparators[i].m_handler, then we need to cache - the predicant value representation used by this handler. - */ - if (m_comparators[i].m_handler_index == i) - in_item->store_value(args->arguments()[m_predicant_index]); - /* - If the predicant item has null_value==true then: - - In case of scalar expression we can returns UNKNOWN immediately. - No needs to check the result of the value item. - - In case of ROW, null_value==true means that *some* row elements - returned NULL, but *some* elements can still be non-NULL! - We need to get the result of the value item and test - if non-NULL elements in the predicant and the value produce - TRUE (not equal), or UNKNOWN. - */ - if (args->arguments()[m_predicant_index]->null_value && - m_comparators[i].m_handler != &type_handler_row) - return UNKNOWN; - return in_item->cmp(args->arguments()[m_comparators[i].m_arg_index]); - } - int cmp_args_nulls_equal(THD *thd, Item_args *args, uint i) - { - Predicant_to_value_comparator *cmp= - &m_comparators[m_comparators[i].m_handler_index]; - cmp_item *in_item= cmp->m_cmp_item; - DBUG_ASSERT(in_item); - Item *predicant= args->arguments()[m_predicant_index]; - Item *arg= args->arguments()[m_comparators[i].m_arg_index]; - ValueBuffer val; - if (m_comparators[i].m_handler_index == i) - in_item->store_value(predicant); - m_comparators[i].m_handler->Item_save_in_value(thd, arg, &val); - if (predicant->null_value && val.is_null()) - return FALSE; // Two nulls are equal - if (predicant->null_value || val.is_null()) - return UNKNOWN; - return in_item->cmp_not_null(&val); - } - /** - Predicant_to_value_comparator - a comparator for one pair (pred,valueN). - See comments above. - */ - struct Predicant_to_value_comparator - { - const Type_handler *m_handler; - cmp_item *m_cmp_item; - uint m_arg_index; - uint m_handler_index; - void cleanup() - { - if (m_cmp_item) - delete m_cmp_item; - memset(this, 0, sizeof(*this)); - } - }; - - Predicant_to_value_comparator *m_comparators; // The comparator array - uint m_comparator_count;// The number of elements in m_comparators[] - uint m_predicant_index; // The position of the predicant in its argument list, - // e.g. for Item_func_in m_predicant_index is 0, - // as predicant is stored in Item_func_in::args[0]. - // For Item_func_case m_predicant_index is - // set to Item_func_case::first_expr_num. - -public: - Predicant_to_list_comparator(THD *thd, uint nvalues) - :m_comparator_count(0), - m_predicant_index(0) - { - alloc_comparators(thd, nvalues); - } - - uint comparator_count() const { return m_comparator_count; } - const Type_handler *get_comparator_type_handler(uint i) const - { - DBUG_ASSERT(i < m_comparator_count); - return m_comparators[i].m_handler; - } - uint get_comparator_arg_index(uint i) const - { - DBUG_ASSERT(i < m_comparator_count); - return m_comparators[i].m_arg_index; - } - cmp_item *get_comparator_cmp_item(uint i) const - { - DBUG_ASSERT(i < m_comparator_count); - return m_comparators[i].m_cmp_item; - } - -#ifndef DBUG_OFF - void debug_print(THD *thd) - { - for (uint i= 0; i < m_comparator_count; i++) - { - DBUG_EXECUTE_IF("Predicant_to_list_comparator", - push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, - ER_UNKNOWN_ERROR, "DBUG: [%d] arg=%d handler=%d (%s)", i, - m_comparators[i].m_arg_index, - m_comparators[i].m_handler_index, - m_comparators[m_comparators[i].m_handler_index]. - m_handler->name().ptr());); - } - } -#endif - - void add_predicant(Item_args *args, uint predicant_index) - { - DBUG_ASSERT(m_comparator_count == 0); // Set in constructor - DBUG_ASSERT(m_predicant_index == 0); // Set in constructor - DBUG_ASSERT(predicant_index < args->argument_count()); - m_predicant_index= predicant_index; - } - /** - Add a new element into m_comparators[], using a {pred,valueN} pair. - - @param funcname - the name of the operation, for error reporting - @param args - the owner function's argument list - @param value_index - the value position in args - @retval true - could not add an element because of non-comparable - arguments (e.g. ROWs with size) - @retval false - a new element was successfully added. - */ - bool add_value(const char *funcname, Item_args *args, uint value_index); - - /** - Add a new element into m_comparators[], ignoring explicit NULL values. - If the value appeared to be an explicit NULL, nulls_found[0] is set to true. - */ - bool add_value_skip_null(const char *funcname, - Item_args *args, uint value_index, - bool *nulls_found); - - /** - Signal "this" that there will be no new add_value*() calls, - so it can prepare its internal structures for comparison. - - @param [OUT] compatible - If all comparators are compatible, - their data type handler is returned here. - @param [OUT] unuque_cnt - The number of unique data type handlers found. - If the value returned in *unique_cnt is 0, - it means all values were explicit NULLs: - expr0 IN (NULL,NULL,..,NULL) - @param [OUT] found_type - The bit mask for all found cmp_type()'s. - */ - void all_values_added(Type_handler_hybrid_field_type *compatible, - uint *unique_cnt, uint *found_types) - { - detect_unique_handlers(compatible, unique_cnt, found_types); - } - /** - Creates cmp_item instances for all unique handlers and stores - them into m_comparators[].m_cmp_item, using the information previously - populated by add_predicant(), add_value() and detect_unque_handlers(). - */ - bool make_unique_cmp_items(THD *thd, CHARSET_INFO *cs); - void cleanup() - { - DBUG_ASSERT(m_comparators); - for (uint i= 0; i < m_comparator_count; i++) - m_comparators[i].cleanup(); - memset(m_comparators, 0, sizeof(m_comparators[0]) * m_comparator_count); - m_comparator_count= 0; - m_predicant_index= 0; - } - bool init_clone(THD *thd, uint nvalues) - { - m_comparator_count= 0; - m_predicant_index= 0; - return alloc_comparators(thd, nvalues); - } - /** - @param [IN] args - The argument list that was previously used with - add_predicant() and add_value(). - @param [OUT] idx - In case if a value that is equal to the predicant - was found, the index of the matching value is returned - here. Otherwise, *idx is not changed. - @param [IN/OUT] found_unknown_values - how to handle UNKNOWN results. - If found_unknown_values is NULL (e.g. Item_func_case), - cmp() returns immediately when the first UNKNOWN - result is found. - If found_unknown_values is non-NULL (Item_func_in), - cmp() does not return when an UNKNOWN result is found, - sets *found_unknown_values to true, and continues - to compare the remaining pairs to find FALSE - (i.e. the value that is equal to the predicant). - - @retval false - Found a value that is equal to the predicant - @retval true - Didn't find an equal value - */ - bool cmp(Item_args *args, uint *idx, bool *found_unknown_values) - { - for (uint i= 0 ; i < m_comparator_count ; i++) - { - DBUG_ASSERT(m_comparators[i].m_handler != NULL); - const int rc= cmp_arg(args, i); - if (rc == FALSE) - { - *idx= m_comparators[i].m_arg_index; - return false; // Found a matching value - } - if (rc == UNKNOWN) - { - if (!found_unknown_values) - return true; - *found_unknown_values= true; - } - } - return true; // Not found - } - /* - Same as above, but treats two NULLs as equal, e.g. as in DECODE_ORACLE(). - */ - bool cmp_nulls_equal(THD *thd, Item_args *args, uint *idx) - { - for (uint i= 0 ; i < m_comparator_count ; i++) - { - DBUG_ASSERT(m_comparators[i].m_handler != NULL); - if (cmp_args_nulls_equal(thd, args, i) == FALSE) - { - *idx= m_comparators[i].m_arg_index; - return false; // Found a matching value - } - } - return true; // Not found - } -}; - - -/* - The class Item_func_case is the CASE ... WHEN ... THEN ... END function - implementation. -*/ - -class Item_func_case :public Item_func_case_expression -{ -protected: - String tmp_value; - DTCollation cmp_collation; - bool aggregate_then_and_else_arguments(THD *thd, uint count); - virtual Item **else_expr_addr() const= 0; - virtual Item *find_item()= 0; - inline void print_when_then_arguments(String *str, - enum_query_type query_type, - Item **items, uint count); - inline void print_else_argument(String *str, enum_query_type query_type, - Item *item); - void reorder_args(uint start); -public: - Item_func_case(THD *thd, List &list) - :Item_func_case_expression(thd, list) - { } - double real_op(); - longlong int_op(); - String *str_op(String *); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - bool fix_fields(THD *thd, Item **ref); - table_map not_null_tables() const { return 0; } - const char *func_name() const { return "case"; } - CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } - bool need_parentheses_in_default() { return true; } -}; - - -/* - CASE WHEN cond THEN res [WHEN cond THEN res...] [ELSE res] END - - Searched CASE checks all WHEN expressions one after another. - When some WHEN expression evaluated to TRUE then the - value of the corresponding THEN expression is returned. -*/ -class Item_func_case_searched: public Item_func_case -{ - uint when_count() const { return arg_count / 2; } - bool with_else() const { return arg_count % 2; } - Item **else_expr_addr() const { return with_else() ? &args[arg_count - 1] : 0; } -public: - Item_func_case_searched(THD *thd, List &list) - :Item_func_case(thd, list) - { - DBUG_ASSERT(arg_count >= 2); - reorder_args(0); - } - enum Functype functype() const { return CASE_SEARCHED_FUNC; } - void print(String *str, enum_query_type query_type); - bool fix_length_and_dec(); - Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { - // None of the arguments are in a comparison context - Item_args::propagate_equal_fields(thd, Context_identity(), cond); - return this; - } - Item *find_item(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - CASE pred WHEN value THEN res [WHEN value THEN res...] [ELSE res] END - - When the predicant expression is specified then it is compared to each WHEN - expression individually. When an equal WHEN expression is found - the corresponding THEN expression is returned. - In order to do correct comparisons several comparators are used. One for - each result type. Different result types that are used in particular - CASE ... END expression are collected in the fix_length_and_dec() member - function and only comparators for there result types are used. -*/ -class Item_func_case_simple: public Item_func_case, - public Predicant_to_list_comparator -{ -protected: - uint m_found_types; - uint when_count() const { return (arg_count - 1) / 2; } - bool with_else() const { return arg_count % 2 == 0; } - Item **else_expr_addr() const { return with_else() ? &args[arg_count - 1] : 0; } - bool aggregate_switch_and_when_arguments(THD *thd, bool nulls_equal); - bool prepare_predicant_and_values(THD *thd, uint *found_types, - bool nulls_equal); -public: - Item_func_case_simple(THD *thd, List &list) - :Item_func_case(thd, list), - Predicant_to_list_comparator(thd, arg_count), - m_found_types(0) - { - DBUG_ASSERT(arg_count >= 3); - reorder_args(1); - } - void cleanup() - { - DBUG_ENTER("Item_func_case_simple::cleanup"); - Item_func::cleanup(); - Predicant_to_list_comparator::cleanup(); - DBUG_VOID_RETURN; - } - enum Functype functype() const { return CASE_SIMPLE_FUNC; } - void print(String *str, enum_query_type query_type); - bool fix_length_and_dec(); - Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond); - Item *find_item(); - Item *build_clone(THD *thd) - { - Item_func_case_simple *clone= (Item_func_case_simple *) - Item_func_case::build_clone(thd); - uint ncases= when_count(); - if (clone && clone->Predicant_to_list_comparator::init_clone(thd, ncases)) - return NULL; - return clone; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_decode_oracle: public Item_func_case_simple -{ -public: - Item_func_decode_oracle(THD *thd, List &list) - :Item_func_case_simple(thd, list) - { } - const char *func_name() const { return "decode_oracle"; } - void print(String *str, enum_query_type query_type); - bool fix_length_and_dec(); - Item *find_item(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - The Item_func_in class implements - in_expr IN () - and - in_expr NOT IN () - - The current implementation distinguishes 2 cases: - 1) all items in are constants and have the same - result type. This case is handled by in_vector class, - implementing fast bisection search. - 2) otherwise Item_func_in employs several cmp_item objects to perform - comparisons of in_expr and an item from . One cmp_item - object for each result type. Different result types are collected in the - fix_length_and_dec() member function by means of collect_cmp_types() - function. - - Bisection is possible when: - 1. All types are similar - 2. All expressions in are const - In the presence of NULLs, the correct result of evaluating this item - must be UNKNOWN or FALSE. To achieve that: - - If type is scalar, we can use bisection and the "have_null" boolean. - - If type is ROW, we will need to scan all of when - searching, so bisection is impossible. Unless: - 3. UNKNOWN and FALSE are equivalent results - 4. Neither left expression nor contain any NULL value -*/ -class Item_func_in :public Item_func_opt_neg, - public Predicant_to_list_comparator -{ - /** - Usable if is made only of constants. Returns true if one - of these constants contains a NULL. Example: - IN ( (-5, (12,NULL)), ... ). - */ - bool list_contains_null(); - bool all_items_are_consts(Item **items, uint nitems) const - { - for (uint i= 0; i < nitems; i++) - { - if (!items[i]->const_item() || items[i]->is_expensive()) - return false; - } - return true; - } - bool prepare_predicant_and_values(THD *thd, uint *found_types); - bool check_arguments() const - { - return check_argument_types_like_args0(); - } -protected: - SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value); - bool transform_into_subq; -public: - /// An array of values, created when the bisection lookup method is used - in_vector *array; - /** - If there is some NULL among , during a val_int() call; for - example - IN ( (1,(3,'col')), ... ), where 'col' is a column which evaluates to - NULL. - */ - bool have_null; - /** - true when all arguments of the IN list are of compatible types - and can be used safely as comparisons for key conditions - */ - bool arg_types_compatible; - - TABLE_LIST *emb_on_expr_nest; - - Item_func_in(THD *thd, List &list): - Item_func_opt_neg(thd, list), - Predicant_to_list_comparator(thd, arg_count - 1), - transform_into_subq(false), - array(0), have_null(0), - arg_types_compatible(FALSE), emb_on_expr_nest(0) - { } - longlong val_int(); - bool fix_fields(THD *, Item **); - bool fix_length_and_dec(); - bool compatible_types_scalar_bisection_possible() - { - DBUG_ASSERT(m_comparator.cmp_type() != ROW_RESULT); - return all_items_are_consts(args + 1, arg_count - 1); // Bisection #2 - } - bool compatible_types_row_bisection_possible() - { - DBUG_ASSERT(m_comparator.cmp_type() == ROW_RESULT); - return all_items_are_consts(args + 1, arg_count - 1) && // Bisection #2 - ((is_top_level_item() && !negated) || // Bisection #3 - (!list_contains_null() && !args[0]->maybe_null)); // Bisection #4 - } - bool agg_all_arg_charsets_for_comparison() - { - return agg_arg_charsets_for_comparison(cmp_collation, args, arg_count); - } - void fix_in_vector(); - bool value_list_convert_const_to_int(THD *thd); - bool fix_for_scalar_comparison_using_bisection(THD *thd) - { - array= m_comparator.type_handler()->make_in_vector(thd, this, arg_count - 1); - if (!array) // OOM - return true; - fix_in_vector(); - return false; - } - bool fix_for_scalar_comparison_using_cmp_items(THD *thd, uint found_types); - - bool fix_for_row_comparison_using_cmp_items(THD *thd); - bool fix_for_row_comparison_using_bisection(THD *thd); - - void cleanup() - { - DBUG_ENTER("Item_func_in::cleanup"); - Item_int_func::cleanup(); - delete array; - array= 0; - Predicant_to_list_comparator::cleanup(); - DBUG_VOID_RETURN; - } - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - SEL_TREE *get_func_row_mm_tree(RANGE_OPT_PARAM *param, Item_row *key_row); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { - /* - Note, we pass ANY_SUBST, this makes sure that non of the args - will be replaced to a zero-filled Item_string. - Such a change would require rebuilding of cmp_items. - */ - if (arg_types_compatible) - { - Context cmpctx(ANY_SUBST, m_comparator.type_handler(), - Item_func_in::compare_collation()); - args[0]->propagate_equal_fields_and_change_item_tree(thd, cmpctx, - cond, &args[0]); - } - for (uint i= 0; i < comparator_count(); i++) - { - Context cmpctx(ANY_SUBST, get_comparator_type_handler(i), - Item_func_in::compare_collation()); - uint idx= get_comparator_arg_index(i); - args[idx]->propagate_equal_fields_and_change_item_tree(thd, cmpctx, - cond, &args[idx]); - } - return this; - } - virtual void print(String *str, enum_query_type query_type); - enum Functype functype() const { return IN_FUNC; } - const char *func_name() const { return "in"; } - enum precedence precedence() const { return IN_PRECEDENCE; } - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - bool count_sargable_conds(void *arg); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *build_clone(THD *thd) - { - Item_func_in *clone= (Item_func_in *) Item_func::build_clone(thd); - if (clone) - { - clone->array= 0; - if (clone->Predicant_to_list_comparator::init_clone(thd, arg_count - 1)) - return NULL; - } - return clone; - } - void mark_as_condition_AND_part(TABLE_LIST *embedding); - bool to_be_transformed_into_in_subq(THD *thd); - bool create_value_list_for_tvc(THD *thd, List< List > *values); - Item *in_predicate_to_in_subs_transformer(THD *thd, uchar *arg); - uint32 max_length_of_left_expr(); -}; - -class cmp_item_row :public cmp_item -{ - cmp_item **comparators; - uint n; - bool alloc_comparators(THD *thd, uint n); - bool aggregate_row_elements_for_comparison(THD *thd, - Type_handler_hybrid_field_type *cmp, - Item_args *tmp, - const char *funcname, - uint col, - uint level); -public: - cmp_item_row(): comparators(0), n(0) {} - ~cmp_item_row(); - void store_value(Item *item); - bool prepare_comparators(THD *, const char *funcname, - const Item_args *args, uint level); - int cmp(Item *arg); - int cmp_not_null(const Value *val) - { - DBUG_ASSERT(false); - return TRUE; - } - int compare(cmp_item *arg); - cmp_item *make_same(); - void store_value_by_template(THD *thd, cmp_item *tmpl, Item *); - friend class Item_func_in; - cmp_item *get_comparator(uint i) { return comparators[i]; } -}; - - -class in_row :public in_vector -{ - cmp_item_row tmp; -public: - in_row(THD *thd, uint elements, Item *); - ~in_row(); - void set(uint pos,Item *item); - uchar *get_value(Item *item); - friend class Item_func_in; - const Type_handler *type_handler() const { return &type_handler_row; } - cmp_item *get_cmp_item() { return &tmp; } -}; - -/* Functions used by where clause */ -class Item_func_null_predicate :public Item_bool_func -{ -protected: - SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) - { - DBUG_ENTER("Item_func_null_predicate::get_func_mm_tree"); - DBUG_RETURN(get_mm_parts(param, field, functype(), value)); - } - SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, - KEY_PART *key_part, - Item_func::Functype type, Item *value); -public: - Item_func_null_predicate(THD *thd, Item *a): Item_bool_func(thd, a) { } - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) - { - DBUG_ENTER("Item_func_null_predicate::get_mm_tree"); - SEL_TREE *ftree= get_full_func_mm_tree_for_args(param, args[0], NULL); - if (!ftree) - ftree= Item_func::get_mm_tree(param, cond_ptr); - DBUG_RETURN(ftree); - } - CHARSET_INFO *compare_collation() const - { return args[0]->collation.collation; } - bool fix_length_and_dec() - { - decimals=0; max_length=1; maybe_null=0; - return FALSE; - } - bool count_sargable_conds(void *arg); -}; - - -class Item_func_isnull :public Item_func_null_predicate -{ -public: - Item_func_isnull(THD *thd, Item *a): Item_func_null_predicate(thd, a) {} - longlong val_int(); - enum Functype functype() const { return ISNULL_FUNC; } - const char *func_name() const { return "isnull"; } - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return CMP_PRECEDENCE; } - - bool arg_is_datetime_notnull_field() - { - Item **args= arguments(); - if (args[0]->real_item()->type() == Item::FIELD_ITEM) - { - Field *field=((Item_field*) args[0]->real_item())->field; - - if ((field->flags & NOT_NULL_FLAG) && - field->type_handler()->cond_notnull_field_isnull_to_field_eq_zero()) - return true; - } - return false; - } - - /* Optimize case of not_null_column IS NULL */ - virtual void update_used_tables() - { - if (!args[0]->maybe_null && !arg_is_datetime_notnull_field()) - { - used_tables_cache= 0; /* is always false */ - const_item_cache= 1; - } - else - { - args[0]->update_used_tables(); - used_tables_cache= args[0]->used_tables(); - const_item_cache= args[0]->const_item(); - } - } - COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, - bool top_level); - table_map not_null_tables() const { return 0; } - bool find_not_null_fields(table_map allowed); - Item *neg_transformer(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -/* Functions used by HAVING for rewriting IN subquery */ - -class Item_in_subselect; - -/* - This is like IS NOT NULL but it also remembers if it ever has - encountered a NULL. -*/ -class Item_is_not_null_test :public Item_func_isnull -{ - Item_in_subselect* owner; -public: - Item_is_not_null_test(THD *thd, Item_in_subselect* ow, Item *a): - Item_func_isnull(thd, a), owner(ow) - {} - enum Functype functype() const { return ISNOTNULLTEST_FUNC; } - longlong val_int(); - const char *func_name() const { return ""; } - void update_used_tables(); - /* - we add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE - */ - table_map used_tables() const - { return used_tables_cache | RAND_TABLE_BIT; } - bool const_item() const { return FALSE; } -}; - - -class Item_func_isnotnull :public Item_func_null_predicate -{ - bool abort_on_null; -public: - Item_func_isnotnull(THD *thd, Item *a): - Item_func_null_predicate(thd, a), abort_on_null(0) - { } - longlong val_int(); - enum Functype functype() const { return ISNOTNULL_FUNC; } - const char *func_name() const { return "isnotnull"; } - enum precedence precedence() const { return CMP_PRECEDENCE; } - table_map not_null_tables() const - { return abort_on_null ? not_null_tables_cache : 0; } - Item *neg_transformer(THD *thd); - void print(String *str, enum_query_type query_type); - void top_level_item() { abort_on_null=1; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_like :public Item_bool_func2 -{ - // Turbo Boyer-Moore data - bool canDoTurboBM; // pattern is '%abcd%' case - const char* pattern; - int pattern_len; - - // TurboBM buffers, *this is owner - int* bmGs; // good suffix shift table, size is pattern_len + 1 - int* bmBc; // bad character shift table, size is alphabet_size - - void turboBM_compute_suffixes(int* suff); - void turboBM_compute_good_suffix_shifts(int* suff); - void turboBM_compute_bad_character_shifts(); - bool turboBM_matches(const char* text, int text_len) const; - enum { alphabet_size = 256 }; - - Item *escape_item; - - bool escape_used_in_parsing; - bool use_sampling; - - DTCollation cmp_collation; - String cmp_value1, cmp_value2; - bool with_sargable_pattern() const; -protected: - SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) - { - DBUG_ENTER("Item_func_like::get_func_mm_tree"); - DBUG_RETURN(get_mm_parts(param, field, LIKE_FUNC, value)); - } - SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, - KEY_PART *key_part, - Item_func::Functype type, Item *value); -public: - int escape; - bool negated; - - Item_func_like(THD *thd, Item *a, Item *b, Item *escape_arg, bool escape_used): - Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0), - bmGs(0), bmBc(0), escape_item(escape_arg), - escape_used_in_parsing(escape_used), use_sampling(0), negated(0) {} - - bool get_negated() const { return negated; } // Used by ColumnStore - - Sql_mode_dependency value_depends_on_sql_mode() const; - longlong val_int(); - enum Functype functype() const { return LIKE_FUNC; } - void print(String *str, enum_query_type query_type); - CHARSET_INFO *compare_collation() const - { return cmp_collation.collation; } - cond_result eq_cmp_result() const - { - /** - We cannot always rewrite conditions as follows: - from: WHERE expr1=const AND expr1 LIKE expr2 - to: WHERE expr1=const AND const LIKE expr2 - or - from: WHERE expr1=const AND expr2 LIKE expr1 - to: WHERE expr1=const AND expr2 LIKE const - - because LIKE works differently comparing to the regular "=" operator: - - 1. LIKE performs a stricter one-character-to-one-character comparison - and does not recognize contractions and expansions. - Replacing "expr1" to "const in LIKE would make the condition - stricter in case of a complex collation. - - 2. LIKE does not ignore trailing spaces and thus works differently - from the "=" operator in case of "PAD SPACE" collations - (which are the majority in MariaDB). So, for "PAD SPACE" collations: - - - expr1=const - ignores trailing spaces - - const LIKE expr2 - does not ignore trailing spaces - - expr2 LIKE const - does not ignore trailing spaces - - Allow only "binary" for now. - It neither ignores trailing spaces nor has contractions/expansions. - - TODO: - We could still replace "expr1" to "const" in "expr1 LIKE expr2" - in case of a "PAD SPACE" collation, but only if "expr2" has '%' - at the end. - */ - return compare_collation() == &my_charset_bin ? COND_TRUE : COND_OK; - } - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { - /* - LIKE differs from the regular comparison operator ('=') in the following: - - LIKE never ignores trailing spaces (even for PAD SPACE collations) - Propagation of equal fields with a PAD SPACE collation into LIKE - is not safe. - Example: - WHERE a='a ' AND a LIKE 'a' - returns true for 'a' - cannot be rewritten to: - WHERE a='a ' AND 'a ' LIKE 'a' - returns false for 'a' - Note, binary collations in MySQL/MariaDB, e.g. latin1_bin, - still have the PAD SPACE attribute and ignore trailing spaces! - - LIKE does not take into account contractions, expansions, - and ignorable characters. - Propagation of equal fields with contractions/expansions/ignorables - is also not safe. - - It's safe to propagate my_charset_bin (BINARY/VARBINARY/BLOB) values, - because they do not ignore trailing spaces and have one-to-one mapping - between a string and its weights. - The below condition should be true only for my_charset_bin - (as of version 10.1.7). - */ - uint flags= Item_func_like::compare_collation()->state; - if ((flags & MY_CS_NOPAD) && !(flags & MY_CS_NON1TO1)) - Item_args::propagate_equal_fields(thd, - Context(ANY_SUBST, - &type_handler_long_blob, - compare_collation()), - cond); - return this; - } - const char *func_name() const { return "like"; } - enum precedence precedence() const { return IN_PRECEDENCE; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() - { - max_length= 1; - return agg_arg_charsets_for_comparison(cmp_collation, args, 2); - } - void cleanup(); - - Item *neg_transformer(THD *thd) - { - negated= !negated; - return this; - } - - bool find_selective_predicates_list_processor(void *arg); - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -typedef struct pcre2_real_code_8 pcre2_code; -typedef struct pcre2_real_match_data_8 pcre2_match_data; -#define PCRE2_SIZE size_t -class Regexp_processor_pcre -{ - pcre2_code *m_pcre; - pcre2_match_data *m_pcre_match_data; - bool m_conversion_is_needed; - bool m_is_const; - int m_library_flags; - CHARSET_INFO *m_library_charset; - String m_prev_pattern; - int m_pcre_exec_rc; - PCRE2_SIZE *m_SubStrVec; - void pcre_exec_warn(int rc) const; - int pcre_exec_with_warn(const pcre2_code *code, - pcre2_match_data *data, - const char *subject, int length, int startoffset, - int options); -public: - String *convert_if_needed(String *src, String *converter); - String subject_converter; - String pattern_converter; - String replace_converter; - Regexp_processor_pcre() : - m_pcre(NULL), m_pcre_match_data(NULL), - m_conversion_is_needed(true), m_is_const(0), - m_library_flags(0), - m_library_charset(&my_charset_utf8mb3_general_ci) - {} - int default_regex_flags(); - void init(CHARSET_INFO *data_charset, int extra_flags); - void fix_owner(Item_func *owner, Item *subject_arg, Item *pattern_arg); - bool compile(String *pattern, bool send_error); - bool compile(Item *item, bool send_error); - bool recompile(Item *item) - { - return !m_is_const && compile(item, false); - } - bool exec(const char *str, size_t length, size_t offset); - bool exec(String *str, int offset, uint n_result_offsets_to_convert); - bool exec(Item *item, int offset, uint n_result_offsets_to_convert); - bool match() const { return m_pcre_exec_rc < 0 ? 0 : 1; } - int nsubpatterns() const { return m_pcre_exec_rc <= 0 ? 0 : m_pcre_exec_rc; } - size_t subpattern_start(int n) const - { - return m_pcre_exec_rc <= 0 ? 0 : m_SubStrVec[n * 2]; - } - size_t subpattern_end(int n) const - { - return m_pcre_exec_rc <= 0 ? 0 : m_SubStrVec[n * 2 + 1]; - } - size_t subpattern_length(int n) const - { - return subpattern_end(n) - subpattern_start(n); - } - void reset() - { - m_pcre= NULL; - m_pcre_match_data= NULL; - m_prev_pattern.length(0); - } - void cleanup(); - bool is_compiled() const { return m_pcre != NULL; } - bool is_const() const { return m_is_const; } - void set_const(bool arg) { m_is_const= arg; } - CHARSET_INFO * library_charset() const { return m_library_charset; } -}; - - -class Item_func_regex :public Item_bool_func -{ - Regexp_processor_pcre re; - DTCollation cmp_collation; -public: - Item_func_regex(THD *thd, Item *a, Item *b): Item_bool_func(thd, a, b) - {} - void cleanup() - { - DBUG_ENTER("Item_func_regex::cleanup"); - Item_bool_func::cleanup(); - re.cleanup(); - DBUG_VOID_RETURN; - } - longlong val_int(); - bool fix_length_and_dec(); - const char *func_name() const { return "regexp"; } - enum precedence precedence() const { return IN_PRECEDENCE; } - Item *get_copy(THD *) { return 0; } - void print(String *str, enum_query_type query_type) - { - print_op(str, query_type); - } - - CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } -}; - - -/* - In the corner case REGEXP_INSTR could return (2^32 + 1), - which would not fit into Item_long_func range. - But string lengths are limited with max_allowed_packet, - which cannot be bigger than 1024*1024*1024. -*/ -class Item_func_regexp_instr :public Item_long_func -{ - bool check_arguments() const - { - return args[0]->check_type_can_return_str(func_name()) || - args[1]->check_type_can_return_text(func_name()); - } - Regexp_processor_pcre re; - DTCollation cmp_collation; -public: - Item_func_regexp_instr(THD *thd, Item *a, Item *b) - :Item_long_func(thd, a, b) - {} - void cleanup() - { - DBUG_ENTER("Item_func_regexp_instr::cleanup"); - Item_int_func::cleanup(); - re.cleanup(); - DBUG_VOID_RETURN; - } - longlong val_int(); - bool fix_length_and_dec(); - const char *func_name() const { return "regexp_instr"; } - Item *get_copy(THD *thd) { return 0; } -}; - - -typedef class Item COND; - -class Item_cond :public Item_bool_func -{ -protected: - List list; - bool abort_on_null; - table_map and_tables_cache; - -public: - /* Item_cond() is only used to create top level items */ - Item_cond(THD *thd): Item_bool_func(thd), abort_on_null(1) - { const_item_cache=0; } - Item_cond(THD *thd, Item *i1, Item *i2); - Item_cond(THD *thd, Item_cond *item); - Item_cond(THD *thd, List &nlist): - Item_bool_func(thd), list(nlist), abort_on_null(0) {} - bool add(Item *item, MEM_ROOT *root) - { - DBUG_ASSERT(item); - return list.push_back(item, root); - } - bool add_at_head(Item *item, MEM_ROOT *root) - { - DBUG_ASSERT(item); - return list.push_front(item, root); - } - void add_at_head(List *nlist) - { - DBUG_ASSERT(nlist->elements); - list.prepend(nlist); - } - void add_at_end(List *nlist) - { - DBUG_ASSERT(nlist->elements); - list.append(nlist); - } - bool fix_fields(THD *, Item **ref); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - - enum Type type() const { return COND_ITEM; } - List* argument_list() { return &list; } - table_map used_tables() const; - void update_used_tables() - { - used_tables_and_const_cache_init(); - used_tables_and_const_cache_update_and_join(list); - } - COND *build_equal_items(THD *thd, COND_EQUAL *inherited, - bool link_item_fields, - COND_EQUAL **cond_equal_ref); - COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, - bool top_level); - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - virtual void print(String *str, enum_query_type query_type); - void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - friend int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, - COND **conds); - void top_level_item() { abort_on_null=1; } - bool top_level() { return abort_on_null; } - void copy_andor_arguments(THD *thd, Item_cond *item); - bool walk(Item_processor processor, bool walk_subquery, void *arg); - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); - void traverse_cond(Cond_traverser, void *arg, traverse_order order); - void neg_arguments(THD *thd); - Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *); - Item *compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - Item *build_clone(THD *thd); - bool excl_dep_on_table(table_map tab_map); - bool excl_dep_on_grouping_fields(st_select_lex *sel); -}; - -template class LI, class T> class Item_equal_iterator; - -/* - The class Item_equal is used to represent conjunctions of equality - predicates of the form field1 = field2, and field=const in where - conditions and on expressions. - - All equality predicates of the form field1=field2 contained in a - conjunction are substituted for a sequence of items of this class. - An item of this class Item_equal(f1,f2,...fk) represents a - multiple equality f1=f2=...=fk.l - - If a conjunction contains predicates f1=f2 and f2=f3, a new item of - this class is created Item_equal(f1,f2,f3) representing the multiple - equality f1=f2=f3 that substitutes the above equality predicates in - the conjunction. - A conjunction of the predicates f2=f1 and f3=f1 and f3=f2 will be - substituted for the item representing the same multiple equality - f1=f2=f3. - An item Item_equal(f1,f2) can appear instead of a conjunction of - f2=f1 and f1=f2, or instead of just the predicate f1=f2. - - An item of the class Item_equal inherits equalities from outer - conjunctive levels. - - Suppose we have a where condition of the following form: - WHERE f1=f2 AND f3=f4 AND f3=f5 AND ... AND (...OR (f1=f3 AND ...)). - In this case: - f1=f2 will be substituted for Item_equal(f1,f2); - f3=f4 and f3=f5 will be substituted for Item_equal(f3,f4,f5); - f1=f3 will be substituted for Item_equal(f1,f2,f3,f4,f5); - - An object of the class Item_equal can contain an optional constant - item c. Then it represents a multiple equality of the form - c=f1=...=fk. - - Objects of the class Item_equal are used for the following: - - 1. An object Item_equal(t1.f1,...,tk.fk) allows us to consider any - pair of tables ti and tj as joined by an equi-condition. - Thus it provide us with additional access paths from table to table. - - 2. An object Item_equal(t1.f1,...,tk.fk) is applied to deduce new - SARGable predicates: - f1=...=fk AND P(fi) => f1=...=fk AND P(fi) AND P(fj). - It also can give us additional index scans and can allow us to - improve selectivity estimates. - - 3. An object Item_equal(t1.f1,...,tk.fk) is used to optimize the - selected execution plan for the query: if table ti is accessed - before the table tj then in any predicate P in the where condition - the occurrence of tj.fj is substituted for ti.fi. This can allow - an evaluation of the predicate at an earlier step. - - When feature 1 is supported they say that join transitive closure - is employed. - When feature 2 is supported they say that search argument transitive - closure is employed. - Both features are usually supported by preprocessing original query and - adding additional predicates. - We do not just add predicates, we rather dynamically replace some - predicates that can not be used to access tables in the investigated - plan for those, obtained by substitution of some fields for equal fields, - that can be used. - - Prepared Statements/Stored Procedures note: instances of class - Item_equal are created only at the time a PS/SP is executed and - are deleted in the end of execution. All changes made to these - objects need not be registered in the list of changes of the parse - tree and do not harm PS/SP re-execution. - - Item equal objects are employed only at the optimize phase. Usually they are - not supposed to be evaluated. Yet in some cases we call the method val_int() - for them. We have to take care of restricting the predicate such an - object represents f1=f2= ...=fn to the projection of known fields fi1=...=fik. -*/ - -class Item_equal: public Item_bool_func -{ - /* - The list of equal items. Currently the list can contain: - - Item_fields items for references to table columns - - Item_direct_view_ref items for references to view columns - - one const item - - If the list contains a constant item this item is always first in the list. - The list contains at least two elements. - Currently all Item_fields/Item_direct_view_ref items in the list should - refer to table columns with equavalent type definitions. In particular - if these are string columns they should have the same charset/collation. - - Use objects of the companion class Item_equal_fields_iterator to iterate - over all items from the list of the Item_field/Item_direct_view_ref classes. - */ - List equal_items; - /* - TRUE <-> one of the items is a const item. - Such item is always first in in the equal_items list - */ - bool with_const; - /* - The field eval_item is used when this item is evaluated - with the method val_int() - */ - cmp_item *eval_item; - /* - This initially is set to FALSE. It becomes TRUE when this item is evaluated - as being always false. If the flag is TRUE the contents of the list - the equal_items should be ignored. - */ - bool cond_false; - /* - This initially is set to FALSE. It becomes TRUE when this item is evaluated - as being always true. If the flag is TRUE the contents of the list - the equal_items should be ignored. - */ - bool cond_true; - /* - For Item_equal objects inside an OR clause: one of the fields that were - used in the original equality. - */ - Item_field *context_field; - - bool link_equal_fields; - - const Type_handler *m_compare_handler; - CHARSET_INFO *m_compare_collation; -public: - - COND_EQUAL *upper_levels; /* multiple equalities of upper and levels */ - - Item_equal(THD *thd, const Type_handler *handler, - Item *f1, Item *f2, bool with_const_item); - Item_equal(THD *thd, Item_equal *item_equal); - /* Currently the const item is always the first in the list of equal items */ - inline Item* get_const() { return with_const ? equal_items.head() : NULL; } - void add_const(THD *thd, Item *c); - /** Add a non-constant item to the multiple equality */ - void add(Item *f, MEM_ROOT *root) { equal_items.push_back(f, root); } - bool contains(Field *field); - Item* get_first(struct st_join_table *context, Item *field); - /** Get number of field items / references to field items in this object */ - uint n_field_items() { return equal_items.elements - MY_TEST(with_const); } - void merge(THD *thd, Item_equal *item); - bool merge_with_check(THD *thd, Item_equal *equal_item, bool save_merged); - void merge_into_list(THD *thd, List *list, bool save_merged, - bool only_intersected); - void update_const(THD *thd); - enum Functype functype() const { return MULT_EQUAL_FUNC; } - longlong val_int(); - const char *func_name() const { return "multiple equal"; } - void sort(Item_field_cmpfunc compare, void *arg); - bool fix_length_and_dec(); - bool fix_fields(THD *thd, Item **ref); - void cleanup() - { - delete eval_item; - eval_item= NULL; - } - void update_used_tables(); - bool find_not_null_fields(table_map allowed); - COND *build_equal_items(THD *thd, COND_EQUAL *inherited, - bool link_item_fields, - COND_EQUAL **cond_equal_ref); - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - bool walk(Item_processor processor, bool walk_subquery, void *arg); - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); - virtual void print(String *str, enum_query_type query_type); - const Type_handler *compare_type_handler() const { return m_compare_handler; } - CHARSET_INFO *compare_collation() const { return m_compare_collation; } - - void set_context_field(Item_field *ctx_field) { context_field= ctx_field; } - void set_link_equal_fields(bool flag) { link_equal_fields= flag; } - Item* get_copy(THD *thd) { return 0; } - /* - This does not comply with the specification of the virtual method, - but Item_equal items are processed distinguishly anyway - */ - bool excl_dep_on_table(table_map tab_map) - { - return used_tables() & tab_map; - } - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred); - bool excl_dep_on_grouping_fields(st_select_lex *sel); - bool create_pushable_equalities(THD *thd, List *equalities, - Pushdown_checker checker, uchar *arg, - bool clone_const); - /* Return the number of elements in this multiple equality */ - uint elements_count() { return equal_items.elements; } - friend class Item_equal_fields_iterator; - bool count_sargable_conds(void *arg); - Item *multiple_equality_transformer(THD *thd, uchar *arg); - friend class Item_equal_iterator; - friend class Item_equal_iterator; - friend Item *eliminate_item_equal(THD *thd, COND *cond, - COND_EQUAL *upper_levels, - Item_equal *item_equal); - friend bool setup_sj_materialization_part1(struct st_join_table *tab); - friend bool setup_sj_materialization_part2(struct st_join_table *tab); -}; - -class COND_EQUAL: public Sql_alloc -{ -public: - uint max_members; /* max number of members the current level - list and all lower level lists */ - COND_EQUAL *upper_levels; /* multiple equalities of upper and levels */ - List current_level; /* list of multiple equalities of - the current and level */ - COND_EQUAL() - { - upper_levels= 0; - } - COND_EQUAL(Item_equal *item, MEM_ROOT *mem_root) - :upper_levels(0) - { - current_level.push_back(item, mem_root); - } - void copy(COND_EQUAL &cond_equal) - { - max_members= cond_equal.max_members; - upper_levels= cond_equal.upper_levels; - if (cond_equal.current_level.is_empty()) - current_level.empty(); - else - current_level= cond_equal.current_level; - } - bool is_empty() - { - return (current_level.elements == 0); - } -}; - - -/* - The template Item_equal_iterator is used to define classes - Item_equal_fields_iterator and Item_equal_fields_iterator_slow. - These are helper classes for the class Item equal - Both classes are used to iterate over references to table/view columns - from the list of equal items that included in an Item_equal object. - The second class supports the operation of removal of the current member - from the list when performing an iteration. -*/ - -template class LI, typename T> class Item_equal_iterator - : public LI -{ -protected: - Item_equal *item_equal; - Item *curr_item; -public: - Item_equal_iterator(Item_equal &item_eq) - :LI (item_eq.equal_items) - { - curr_item= NULL; - item_equal= &item_eq; - if (item_eq.with_const) - { - LI *list_it= this; - curr_item= (*list_it)++; - } - } - Item* operator++(int) - { - LI *list_it= this; - curr_item= (*list_it)++; - return curr_item; - } - void rewind(void) - { - LI *list_it= this; - list_it->rewind(); - if (item_equal->with_const) - curr_item= (*list_it)++; - } - Field *get_curr_field() - { - Item_field *item= (Item_field *) (curr_item->real_item()); - return item->field; - } -}; - -typedef Item_equal_iterator Item_equal_iterator_fast; - -class Item_equal_fields_iterator - :public Item_equal_iterator_fast -{ -public: - Item_equal_fields_iterator(Item_equal &item_eq) - :Item_equal_iterator_fast(item_eq) - { } - Item ** ref() - { - return List_iterator_fast::ref(); - } -}; - -typedef Item_equal_iterator Item_equal_iterator_iterator_slow; - -class Item_equal_fields_iterator_slow - :public Item_equal_iterator_iterator_slow -{ -public: - Item_equal_fields_iterator_slow(Item_equal &item_eq) - :Item_equal_iterator_iterator_slow(item_eq) - { } - void remove() - { - List_iterator::remove(); - } -}; - - -class Item_cond_and final :public Item_cond -{ -public: - COND_EQUAL m_cond_equal; /* contains list of Item_equal objects for - the current and level and reference - to multiple equalities of upper and levels */ - Item_cond_and(THD *thd): Item_cond(thd) {} - Item_cond_and(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {} - Item_cond_and(THD *thd, Item_cond_and *item): Item_cond(thd, item) {} - Item_cond_and(THD *thd, List &list_arg): Item_cond(thd, list_arg) {} - enum Functype functype() const { return COND_AND_FUNC; } - longlong val_int(); - const char *func_name() const { return "and"; } - enum precedence precedence() const { return AND_PRECEDENCE; } - table_map not_null_tables() const - { return abort_on_null ? not_null_tables_cache: and_tables_cache; } - Item *copy_andor_structure(THD *thd); - Item *neg_transformer(THD *thd); - void mark_as_condition_AND_part(TABLE_LIST *embedding); - virtual uint exists2in_reserved_items() { return list.elements; }; - COND *build_equal_items(THD *thd, COND_EQUAL *inherited, - bool link_item_fields, - COND_EQUAL **cond_equal_ref); - bool set_format_by_check_constraint(Send_field_extended_metadata *to) const; - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -inline bool is_cond_and(Item *item) -{ - Item_func *func_item= item->get_item_func(); - return func_item && func_item->functype() == Item_func::COND_AND_FUNC; -} - -class Item_cond_or final :public Item_cond -{ -public: - Item_cond_or(THD *thd): Item_cond(thd) {} - Item_cond_or(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {} - Item_cond_or(THD *thd, Item_cond_or *item): Item_cond(thd, item) {} - Item_cond_or(THD *thd, List &list_arg): Item_cond(thd, list_arg) {} - enum Functype functype() const { return COND_OR_FUNC; } - longlong val_int(); - const char *func_name() const { return "or"; } - enum precedence precedence() const { return OR_PRECEDENCE; } - table_map not_null_tables() const { return and_tables_cache; } - Item *copy_andor_structure(THD *thd); - Item *neg_transformer(THD *thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_dyncol_check :public Item_bool_func -{ -public: - Item_func_dyncol_check(THD *thd, Item *str): Item_bool_func(thd, str) {} - longlong val_int(); - const char *func_name() const { return "column_check"; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_dyncol_exists :public Item_bool_func -{ -public: - Item_func_dyncol_exists(THD *thd, Item *str, Item *num): - Item_bool_func(thd, str, num) {} - longlong val_int(); - const char *func_name() const { return "column_exists"; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_cursor_bool_attr: public Item_bool_func, public Cursor_ref -{ -public: - Item_func_cursor_bool_attr(THD *thd, const LEX_CSTRING *name, uint offset) - :Item_bool_func(thd), Cursor_ref(name, offset) - { } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC); - } - void print(String *str, enum_query_type query_type) - { - Cursor_ref::print_func(str, func_name()); - } -}; - - -class Item_func_cursor_isopen: public Item_func_cursor_bool_attr -{ -public: - Item_func_cursor_isopen(THD *thd, const LEX_CSTRING *name, uint offset) - :Item_func_cursor_bool_attr(thd, name, offset) { } - const char *func_name() const { return "%ISOPEN"; } - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_cursor_found: public Item_func_cursor_bool_attr -{ -public: - Item_func_cursor_found(THD *thd, const LEX_CSTRING *name, uint offset) - :Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; } - const char *func_name() const { return "%FOUND"; } - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_cursor_notfound: public Item_func_cursor_bool_attr -{ -public: - Item_func_cursor_notfound(THD *thd, const LEX_CSTRING *name, uint offset) - :Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; } - const char *func_name() const { return "%NOTFOUND"; } - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - - -inline bool is_cond_or(Item *item) -{ - Item_func *func_item= item->get_item_func(); - return func_item && func_item->functype() == Item_func::COND_OR_FUNC; -} - -Item *and_expressions(Item *a, Item *b, Item **org_item); - -class Comp_creator -{ -public: - Comp_creator() {} /* Remove gcc warning */ - virtual ~Comp_creator() {} /* Remove gcc warning */ - /** - Create operation with given arguments. - */ - virtual Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) - const = 0; - /** - Create operation with given arguments in swap order. - */ - virtual Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) - const = 0; - virtual const char* symbol(bool invert) const = 0; - virtual bool eqne_op() const = 0; - virtual bool l_op() const = 0; -}; - -class Eq_creator :public Comp_creator -{ -public: - Eq_creator() {} /* Remove gcc warning */ - virtual ~Eq_creator() {} /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? "<>" : "="; } - bool eqne_op() const { return 1; } - bool l_op() const { return 0; } -}; - -class Ne_creator :public Comp_creator -{ -public: - Ne_creator() {} /* Remove gcc warning */ - virtual ~Ne_creator() {} /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? "=" : "<>"; } - bool eqne_op() const { return 1; } - bool l_op() const { return 0; } -}; - -class Gt_creator :public Comp_creator -{ -public: - Gt_creator() {} /* Remove gcc warning */ - virtual ~Gt_creator() {} /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? "<=" : ">"; } - bool eqne_op() const { return 0; } - bool l_op() const { return 0; } -}; - -class Lt_creator :public Comp_creator -{ -public: - Lt_creator() {} /* Remove gcc warning */ - virtual ~Lt_creator() {} /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? ">=" : "<"; } - bool eqne_op() const { return 0; } - bool l_op() const { return 1; } -}; - -class Ge_creator :public Comp_creator -{ -public: - Ge_creator() {} /* Remove gcc warning */ - virtual ~Ge_creator() {} /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? "<" : ">="; } - bool eqne_op() const { return 0; } - bool l_op() const { return 0; } -}; - -class Le_creator :public Comp_creator -{ -public: - Le_creator() {} /* Remove gcc warning */ - virtual ~Le_creator() {} /* Remove gcc warning */ - Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; - Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; - const char* symbol(bool invert) const { return invert? ">" : "<="; } - bool eqne_op() const { return 0; } - bool l_op() const { return 1; } -}; - -/* - These need definitions from this file but the variables are defined - in mysqld.h. The variables really belong in this component, but for - the time being we leave them in mysqld.cc to avoid merge problems. -*/ -extern Eq_creator eq_creator; -extern Ne_creator ne_creator; -extern Gt_creator gt_creator; -extern Lt_creator lt_creator; -extern Ge_creator ge_creator; -extern Le_creator le_creator; - -#endif /* ITEM_CMPFUNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_create.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_create.h deleted file mode 100644 index c9bdb23..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_create.h +++ /dev/null @@ -1,344 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. - Copyright (c) 2008-2011 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Functions to create an item. Used by sql/sql_yacc.yy */ - -#ifndef ITEM_CREATE_H -#define ITEM_CREATE_H - -#include "item_func.h" // Cast_target - -typedef struct st_udf_func udf_func; - -/** - Public function builder interface. - The parser (sql/sql_yacc.yy) uses a factory / builder pattern to - construct an Item object for each function call. - All the concrete function builders implements this interface, - either directly or indirectly with some adapter helpers. - Keeping the function creation separated from the bison grammar allows - to simplify the parser, and avoid the need to introduce a new token - for each function, which has undesirable side effects in the grammar. -*/ - -class Create_func -{ -public: - /** - The builder create method. - Given the function name and list or arguments, this method creates - an Item that represents the function call. - In case or errors, a NULL item is returned, and an error is reported. - Note that the thd object may be modified by the builder. - In particular, the following members/methods can be set/called, - depending on the function called and the function possible side effects. -
    -
  • thd->lex->binlog_row_based_if_mixed
  • -
  • thd->lex->current_context()
  • -
  • thd->lex->safe_to_cache_query
  • -
  • thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT)
  • -
  • thd->lex->uncacheable(UNCACHEABLE_RAND)
  • -
  • thd->lex->add_time_zone_tables_to_query_tables(thd)
  • -
- @param thd The current thread - @param name The function name - @param item_list The list of arguments to the function, can be NULL - @return An item representing the parsed function call, or NULL - */ - virtual Item *create_func(THD *thd, LEX_CSTRING *name, List *item_list) = 0; - -protected: - /** Constructor */ - Create_func() {} - /** Destructor */ - virtual ~Create_func() {} -}; - - -/** - Adapter for functions that takes exactly zero arguments. -*/ - -class Create_func_arg0 : public Create_func -{ -public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, - List *item_list); - - /** - Builder method, with no arguments. - @param thd The current thread - @return An item representing the function call - */ - virtual Item *create_builder(THD *thd) = 0; - -protected: - /** Constructor. */ - Create_func_arg0() {} - /** Destructor. */ - virtual ~Create_func_arg0() {} -}; - - -/** - Adapter for functions that takes exactly one argument. -*/ - -class Create_func_arg1 : public Create_func -{ -public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, List *item_list); - - /** - Builder method, with one argument. - @param thd The current thread - @param arg1 The first argument of the function - @return An item representing the function call - */ - virtual Item *create_1_arg(THD *thd, Item *arg1) = 0; - -protected: - /** Constructor. */ - Create_func_arg1() {} - /** Destructor. */ - virtual ~Create_func_arg1() {} -}; - - -/** - Adapter for functions that takes exactly two arguments. -*/ - -class Create_func_arg2 : public Create_func -{ -public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, List *item_list); - - /** - Builder method, with two arguments. - @param thd The current thread - @param arg1 The first argument of the function - @param arg2 The second argument of the function - @return An item representing the function call - */ - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) = 0; - -protected: - /** Constructor. */ - Create_func_arg2() {} - /** Destructor. */ - virtual ~Create_func_arg2() {} -}; - - -/** - Adapter for functions that takes exactly three arguments. -*/ - -class Create_func_arg3 : public Create_func -{ -public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, List *item_list); - - /** - Builder method, with three arguments. - @param thd The current thread - @param arg1 The first argument of the function - @param arg2 The second argument of the function - @param arg3 The third argument of the function - @return An item representing the function call - */ - virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) = 0; - -protected: - /** Constructor. */ - Create_func_arg3() {} - /** Destructor. */ - virtual ~Create_func_arg3() {} -}; - - - - -/** - Adapter for native functions with a variable number of arguments. - The main use of this class is to discard the following calls: - foo(expr1 AS name1, expr2 AS name2, ...) - which are syntactically correct (the syntax can refer to a UDF), - but semantically invalid for native functions. -*/ - -class Create_native_func : public Create_func -{ -public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, - List *item_list); - - /** - Builder method, with no arguments. - @param thd The current thread - @param name The native function name - @param item_list The function parameters, none of which are named - @return An item representing the function call - */ - virtual Item *create_native(THD *thd, LEX_CSTRING *name, - List *item_list) = 0; - -protected: - /** Constructor. */ - Create_native_func() {} - /** Destructor. */ - virtual ~Create_native_func() {} -}; - - -/** - Function builder for qualified functions. - This builder is used with functions call using a qualified function name - syntax, as in db.func(expr, expr, ...). -*/ - -class Create_qfunc : public Create_func -{ -public: - /** - The builder create method, for unqualified functions. - This builder will use the current database for the database name. - @param thd The current thread - @param name The function name - @param item_list The list of arguments to the function, can be NULL - @return An item representing the parsed function call - */ - virtual Item *create_func(THD *thd, LEX_CSTRING *name, - List *item_list); - - /** - The builder create method, for qualified functions. - @param thd The current thread - @param db The database name - @param name The function name - @param use_explicit_name Should the function be represented as 'db.name'? - @param item_list The list of arguments to the function, can be NULL - @return An item representing the parsed function call - */ - virtual Item *create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name, - bool use_explicit_name, - List *item_list) = 0; - -protected: - /** Constructor. */ - Create_qfunc() {} - /** Destructor. */ - virtual ~Create_qfunc() {} -}; - - -/** - Find the native function builder associated with a given function name. - @param thd The current thread - @param name The native function name - @return The native function builder associated with the name, or NULL -*/ -extern Create_func *find_native_function_builder(THD *thd, - const LEX_CSTRING *name); - - -/** - Find the function builder for qualified functions. - @param thd The current thread - @return A function builder for qualified functions -*/ -extern Create_qfunc * find_qualified_function_builder(THD *thd); - - -#ifdef HAVE_DLOPEN -/** - Function builder for User Defined Functions. -*/ - -class Create_udf_func : public Create_func -{ -public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, - List *item_list); - - /** - The builder create method, for User Defined Functions. - @param thd The current thread - @param fct The User Defined Function metadata - @param item_list The list of arguments to the function, can be NULL - @return An item representing the parsed function call - */ - Item *create(THD *thd, udf_func *fct, List *item_list); - - /** Singleton. */ - static Create_udf_func s_singleton; - -protected: - /** Constructor. */ - Create_udf_func() {} - /** Destructor. */ - virtual ~Create_udf_func() {} -}; -#endif - - -struct Native_func_registry -{ - LEX_CSTRING name; - Create_func *builder; -}; - -int item_create_init(); -int item_create_append(Native_func_registry array[]); -void item_create_cleanup(); - -Item *create_func_dyncol_create(THD *thd, List &list); -Item *create_func_dyncol_add(THD *thd, Item *str, - List &list); -Item *create_func_dyncol_delete(THD *thd, Item *str, List &nums); -Item *create_func_dyncol_get(THD *thd, Item *num, Item *str, - const Type_handler *handler, - const char *c_len, const char *c_dec, - CHARSET_INFO *cs); -Item *create_func_dyncol_json(THD *thd, Item *str); - - -class Native_func_registry_array -{ - const Native_func_registry *m_elements; - size_t m_count; -public: - Native_func_registry_array() - :m_elements(NULL), - m_count(0) - { } - Native_func_registry_array(const Native_func_registry *elements, size_t count) - :m_elements(elements), - m_count(count) - { } - const Native_func_registry& element(size_t i) const - { - DBUG_ASSERT(i < m_count); - return m_elements[i]; - } - size_t count() const { return m_count; } - bool append_to_hash(HASH *hash) const; -}; - - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_func.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_func.h deleted file mode 100644 index 6a4a9fa..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_func.h +++ /dev/null @@ -1,3792 +0,0 @@ -#ifndef ITEM_FUNC_INCLUDED -#define ITEM_FUNC_INCLUDED -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* Function items used by mysql */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#ifdef HAVE_IEEEFP_H -extern "C" /* Bug in BSDI include file */ -{ -#include -} -#endif - -#include "sql_udf.h" // udf_handler -#include "my_decimal.h" // string2my_decimal -#include - - -class Item_func :public Item_func_or_sum, - protected With_sum_func_cache -{ - void sync_with_sum_func_and_with_field(List &list); -protected: - virtual bool check_arguments() const - { - return check_argument_types_scalar(0, arg_count); - } - bool check_argument_types_like_args0() const; - bool check_argument_types_scalar(uint start, uint end) const; - bool check_argument_types_traditional_scalar(uint start, uint end) const; - bool check_argument_types_or_binary(const Type_handler *handler, - uint start, uint end) const; - bool check_argument_types_can_return_int(uint start, uint end) const; - bool check_argument_types_can_return_real(uint start, uint end) const; - bool check_argument_types_can_return_str(uint start, uint end) const; - bool check_argument_types_can_return_text(uint start, uint end) const; - bool check_argument_types_can_return_date(uint start, uint end) const; - bool check_argument_types_can_return_time(uint start, uint end) const; - void print_cast_temporal(String *str, enum_query_type query_type); -public: - - table_map not_null_tables_cache; - - enum Functype { UNKNOWN_FUNC,EQ_FUNC,EQUAL_FUNC,NE_FUNC,LT_FUNC,LE_FUNC, - GE_FUNC,GT_FUNC,FT_FUNC, - LIKE_FUNC,ISNULL_FUNC,ISNOTNULL_FUNC, - COND_AND_FUNC, COND_OR_FUNC, XOR_FUNC, - BETWEEN, IN_FUNC, MULT_EQUAL_FUNC, - INTERVAL_FUNC, ISNOTNULLTEST_FUNC, - SP_EQUALS_FUNC, SP_DISJOINT_FUNC,SP_INTERSECTS_FUNC, - SP_TOUCHES_FUNC,SP_CROSSES_FUNC,SP_WITHIN_FUNC, - SP_CONTAINS_FUNC,SP_OVERLAPS_FUNC, - SP_STARTPOINT,SP_ENDPOINT,SP_EXTERIORRING, - SP_POINTN,SP_GEOMETRYN,SP_INTERIORRINGN, SP_RELATE_FUNC, - NOT_FUNC, NOT_ALL_FUNC, TEMPTABLE_ROWID, - NOW_FUNC, NOW_UTC_FUNC, SYSDATE_FUNC, TRIG_COND_FUNC, - SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC, - EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC, - NEG_FUNC, GSYSVAR_FUNC, IN_OPTIMIZER_FUNC, DYNCOL_FUNC, - JSON_EXTRACT_FUNC, JSON_VALID_FUNC, - CASE_SEARCHED_FUNC, // Used by ColumnStore/Spider - CASE_SIMPLE_FUNC // Used by ColumnStore/spider - }; - static scalar_comparison_op functype_to_scalar_comparison_op(Functype type) - { - switch (type) { - case EQ_FUNC: return SCALAR_CMP_EQ; - case EQUAL_FUNC: return SCALAR_CMP_EQUAL; - case LT_FUNC: return SCALAR_CMP_LT; - case LE_FUNC: return SCALAR_CMP_LE; - case GE_FUNC: return SCALAR_CMP_GE; - case GT_FUNC: return SCALAR_CMP_GT; - default: break; - } - DBUG_ASSERT(0); - return SCALAR_CMP_EQ; - } - enum Type type() const { return FUNC_ITEM; } - virtual enum Functype functype() const { return UNKNOWN_FUNC; } - Item_func(THD *thd): Item_func_or_sum(thd) - { - with_field= 0; - with_param= 0; - } - Item_func(THD *thd, Item *a) - :Item_func_or_sum(thd, a), With_sum_func_cache(a) - { - with_param= a->with_param; - with_field= a->with_field; - } - Item_func(THD *thd, Item *a, Item *b) - :Item_func_or_sum(thd, a, b), With_sum_func_cache(a, b) - { - with_param= a->with_param || b->with_param; - with_field= a->with_field || b->with_field; - } - Item_func(THD *thd, Item *a, Item *b, Item *c) - :Item_func_or_sum(thd, a, b, c), With_sum_func_cache(a, b, c) - { - with_field= a->with_field || b->with_field || c->with_field; - with_param= a->with_param || b->with_param || c->with_param; - } - Item_func(THD *thd, Item *a, Item *b, Item *c, Item *d) - :Item_func_or_sum(thd, a, b, c, d), With_sum_func_cache(a, b, c, d) - { - with_field= a->with_field || b->with_field || - c->with_field || d->with_field; - with_param= a->with_param || b->with_param || - c->with_param || d->with_param; - } - Item_func(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e) - :Item_func_or_sum(thd, a, b, c, d, e), With_sum_func_cache(a, b, c, d, e) - { - with_field= a->with_field || b->with_field || - c->with_field || d->with_field || e->with_field; - with_param= a->with_param || b->with_param || - c->with_param || d->with_param || e->with_param; - } - Item_func(THD *thd, List &list): - Item_func_or_sum(thd, list) - { - set_arguments(thd, list); - } - // Constructor used for Item_cond_and/or (see Item comment) - Item_func(THD *thd, Item_func *item) - :Item_func_or_sum(thd, item), With_sum_func_cache(item), - not_null_tables_cache(item->not_null_tables_cache) - { } - bool fix_fields(THD *, Item **ref); - void cleanup() - { - Item_func_or_sum::cleanup(); - used_tables_and_const_cache_init(); - } - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - void quick_fix_field(); - table_map not_null_tables() const; - void update_used_tables() - { - used_tables_and_const_cache_init(); - used_tables_and_const_cache_update_and_join(arg_count, args); - } - COND *build_equal_items(THD *thd, COND_EQUAL *inherited, - bool link_item_fields, - COND_EQUAL **cond_equal_ref); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) - { - DBUG_ENTER("Item_func::get_mm_tree"); - DBUG_RETURN(const_item() ? get_mm_tree_for_const(param) : NULL); - } - bool eq(const Item *item, bool binary_cmp) const; - virtual Item *key_item() const { return args[0]; } - void set_arguments(THD *thd, List &list) - { - Item_args::set_arguments(thd, list); - sync_with_sum_func_and_with_field(list); - list.empty(); // Fields are used - } - void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - virtual void print(String *str, enum_query_type query_type); - void print_op(String *str, enum_query_type query_type); - void print_args(String *str, uint from, enum_query_type query_type); - bool is_null() { - update_null_value(); - return null_value; - } - String *val_str_from_val_str_ascii(String *str, String *str2); - - void signal_divide_by_null(); - friend class udf_handler; - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) - { return tmp_table_field_from_field_type(root, table); } - Item *get_tmp_table_item(THD *thd); - - void fix_char_length_ulonglong(ulonglong max_char_length_arg) - { - ulonglong max_result_length= max_char_length_arg * - collation.collation->mbmaxlen; - if (max_result_length >= MAX_BLOB_WIDTH) - { - max_length= MAX_BLOB_WIDTH; - maybe_null= 1; - } - else - max_length= (uint32) max_result_length; - } - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); - Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t); - void traverse_cond(Cond_traverser traverser, - void * arg, traverse_order order); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - // bool is_expensive_processor(void *arg); - // virtual bool is_expensive() { return 0; } - inline void raise_numeric_overflow(const char *type_name) - { - char buf[256]; - String str(buf, sizeof(buf), system_charset_info); - str.length(0); - print(&str, QT_NO_DATA_EXPANSION); - my_error(ER_DATA_OUT_OF_RANGE, MYF(0), type_name, str.c_ptr_safe()); - } - inline double raise_float_overflow() - { - raise_numeric_overflow("DOUBLE"); - return 0.0; - } - inline longlong raise_integer_overflow() - { - raise_numeric_overflow(unsigned_flag ? "BIGINT UNSIGNED": "BIGINT"); - return 0; - } - inline int raise_decimal_overflow() - { - raise_numeric_overflow("DECIMAL"); - return E_DEC_OVERFLOW; - } - /** - Throw an error if the input double number is not finite, i.e. is either - +/-INF or NAN. - */ - inline double check_float_overflow(double value) - { - return std::isfinite(value) ? value : raise_float_overflow(); - } - /** - Throw an error if the input BIGINT value represented by the - (longlong value, bool unsigned flag) pair cannot be returned by the - function, i.e. is not compatible with this Item's unsigned_flag. - */ - inline longlong check_integer_overflow(longlong value, bool val_unsigned) - { - if ((unsigned_flag && !val_unsigned && value < 0) || - (!unsigned_flag && val_unsigned && - (ulonglong) value > (ulonglong) LONGLONG_MAX)) - return raise_integer_overflow(); - return value; - } - /** - Throw an error if the error code of a DECIMAL operation is E_DEC_OVERFLOW. - */ - inline int check_decimal_overflow(int error) - { - return (error == E_DEC_OVERFLOW) ? raise_decimal_overflow() : error; - } - - bool has_timestamp_args() - { - DBUG_ASSERT(fixed == TRUE); - for (uint i= 0; i < arg_count; i++) - { - if (args[i]->type() == Item::FIELD_ITEM && - args[i]->field_type() == MYSQL_TYPE_TIMESTAMP) - return TRUE; - } - return FALSE; - } - - bool has_date_args() - { - DBUG_ASSERT(fixed == TRUE); - for (uint i= 0; i < arg_count; i++) - { - if (args[i]->type() == Item::FIELD_ITEM && - (args[i]->field_type() == MYSQL_TYPE_DATE || - args[i]->field_type() == MYSQL_TYPE_DATETIME)) - return TRUE; - } - return FALSE; - } - - bool has_time_args() - { - DBUG_ASSERT(fixed == TRUE); - for (uint i= 0; i < arg_count; i++) - { - if (args[i]->type() == Item::FIELD_ITEM && - (args[i]->field_type() == MYSQL_TYPE_TIME || - args[i]->field_type() == MYSQL_TYPE_DATETIME)) - return TRUE; - } - return FALSE; - } - - bool has_datetime_args() - { - DBUG_ASSERT(fixed == TRUE); - for (uint i= 0; i < arg_count; i++) - { - if (args[i]->type() == Item::FIELD_ITEM && - args[i]->field_type() == MYSQL_TYPE_DATETIME) - return TRUE; - } - return FALSE; - } - - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { - /* - By default only substitution for a field whose two different values - are never equal is allowed in the arguments of a function. - This is overruled for the direct arguments of comparison functions. - */ - Item_args::propagate_equal_fields(thd, Context_identity(), cond); - return this; - } - - bool has_rand_bit() - { - return used_tables() & RAND_TABLE_BIT; - } - - bool excl_dep_on_table(table_map tab_map) - { - if (used_tables() & OUTER_REF_TABLE_BIT) - return false; - return !(used_tables() & ~tab_map) || - Item_args::excl_dep_on_table(tab_map); - } - - bool excl_dep_on_grouping_fields(st_select_lex *sel) - { - if (has_rand_bit() || with_subquery()) - return false; - return Item_args::excl_dep_on_grouping_fields(sel); - } - - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) - { - return Item_args::excl_dep_on_in_subq_left_part(subq_pred); - } - - /* - We assume the result of any function that has a TIMESTAMP argument to be - timezone-dependent, since a TIMESTAMP value in both numeric and string - contexts is interpreted according to the current timezone. - The only exception is UNIX_TIMESTAMP() which returns the internal - representation of a TIMESTAMP argument verbatim, and thus does not depend on - the timezone. - */ - virtual bool check_valid_arguments_processor(void *bool_arg) - { - return has_timestamp_args(); - } - - virtual bool find_function_processor (void *arg) - { - return functype() == *(Functype *) arg; - } - - void no_rows_in_result() - { - for (uint i= 0; i < arg_count; i++) - { - args[i]->no_rows_in_result(); - } - } - void restore_to_before_no_rows_in_result() - { - for (uint i= 0; i < arg_count; i++) - { - args[i]->no_rows_in_result(); - } - } - void convert_const_compared_to_int_field(THD *thd); - /** - Prepare arguments and setup a comparator. - Used in Item_func_xxx with two arguments and a comparator, - e.g. Item_bool_func2 and Item_func_nullif. - args[0] or args[1] can be modified: - - converted to character set and collation of the operation - - or replaced to an Item_int_with_ref - */ - bool setup_args_and_comparator(THD *thd, Arg_comparator *cmp); - - bool with_sum_func() const { return m_with_sum_func; } - With_sum_func_cache* get_with_sum_func_cache() { return this; } - Item_func *get_item_func() { return this; } - bool is_simplified_cond_processor(void *arg) - { return const_item() && !val_int(); } -}; - - -class Item_real_func :public Item_func -{ -public: - Item_real_func(THD *thd): Item_func(thd) { collation= DTCollation_numeric(); } - Item_real_func(THD *thd, Item *a): Item_func(thd, a) - { collation= DTCollation_numeric(); } - Item_real_func(THD *thd, Item *a, Item *b): Item_func(thd, a, b) - { collation= DTCollation_numeric(); } - Item_real_func(THD *thd, List &list): Item_func(thd, list) - { collation= DTCollation_numeric(); } - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *decimal_value); - longlong val_int() - { - DBUG_ASSERT(fixed == 1); - return Converter_double_to_longlong(val_real(), unsigned_flag).result(); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { return get_date_from_real(thd, ltime, fuzzydate); } - const Type_handler *type_handler() const { return &type_handler_double; } - bool fix_length_and_dec() - { - decimals= NOT_FIXED_DEC; - max_length= float_length(decimals); - return FALSE; - } -}; - - -/** - Functions whose returned field type is determined at fix_fields() time. -*/ -class Item_hybrid_func: public Item_func, - public Type_handler_hybrid_field_type -{ -protected: - bool fix_attributes(Item **item, uint nitems); -public: - Item_hybrid_func(THD *thd): Item_func(thd) { } - Item_hybrid_func(THD *thd, Item *a): Item_func(thd, a) { } - Item_hybrid_func(THD *thd, Item *a, Item *b): Item_func(thd, a, b) { } - Item_hybrid_func(THD *thd, Item *a, Item *b, Item *c): - Item_func(thd, a, b, c) { } - Item_hybrid_func(THD *thd, List &list): Item_func(thd, list) { } - Item_hybrid_func(THD *thd, Item_hybrid_func *item) - :Item_func(thd, item), Type_handler_hybrid_field_type(item) { } - const Type_handler *type_handler() const - { return Type_handler_hybrid_field_type::type_handler(); } - void fix_length_and_dec_long_or_longlong(uint char_length, bool unsigned_arg) - { - collation= DTCollation_numeric(); - unsigned_flag= unsigned_arg; - max_length= char_length; - set_handler(Type_handler::type_handler_long_or_longlong(char_length, - unsigned_arg)); - } - void fix_length_and_dec_ulong_or_ulonglong_by_nbits(uint nbits) - { - uint digits= Type_handler_bit::Bit_decimal_notation_int_digits_by_nbits(nbits); - collation= DTCollation_numeric(); - unsigned_flag= true; - max_length= digits; - if (nbits > 32) - set_handler(&type_handler_ulonglong); - else - set_handler(&type_handler_ulong); - } -}; - - -class Item_handled_func: public Item_func -{ -public: - class Handler - { - public: - virtual ~Handler() { } - virtual String *val_str(Item_handled_func *, String *) const= 0; - virtual String *val_str_ascii(Item_handled_func *, String *) const= 0; - virtual double val_real(Item_handled_func *) const= 0; - virtual longlong val_int(Item_handled_func *) const= 0; - virtual my_decimal *val_decimal(Item_handled_func *, my_decimal *) const= 0; - virtual bool get_date(THD *thd, Item_handled_func *, MYSQL_TIME *, date_mode_t fuzzydate) const= 0; - virtual bool val_native(THD *thd, Item_handled_func *, Native *to) const - { - DBUG_ASSERT(0); - to->length(0); - return true; - } - virtual const Type_handler * - return_type_handler(const Item_handled_func *item) const= 0; - virtual const Type_handler * - type_handler_for_create_select(const Item_handled_func *item) const - { - return return_type_handler(item); - } - virtual bool fix_length_and_dec(Item_handled_func *) const= 0; - }; - - class Handler_str: public Handler - { - public: - String *val_str_ascii(Item_handled_func *item, String *str) const - { - return item->Item::val_str_ascii(str); - } - double val_real(Item_handled_func *item) const - { - DBUG_ASSERT(item->is_fixed()); - StringBuffer<64> tmp; - String *res= item->val_str(&tmp); - return res ? item->double_from_string_with_check(res) : 0.0; - } - longlong val_int(Item_handled_func *item) const - { - DBUG_ASSERT(item->is_fixed()); - StringBuffer<22> tmp; - String *res= item->val_str(&tmp); - return res ? item->longlong_from_string_with_check(res) : 0; - } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const - { - return item->val_decimal_from_string(to); - } - bool get_date(THD *thd, Item_handled_func *item, MYSQL_TIME *to, - date_mode_t fuzzydate) const - { - return item->get_date_from_string(thd, to, fuzzydate); - } - }; - - /** - Abstract class for functions returning TIME, DATE, DATETIME or string values, - whose data type depends on parameters and is set at fix_fields time. - */ - class Handler_temporal: public Handler - { - public: - String *val_str(Item_handled_func *item, String *to) const - { - StringBuffer ascii_buf; - return item->val_str_from_val_str_ascii(to, &ascii_buf); - } - }; - - /** - Abstract class for functions returning strings, - which are generated from get_date() results, - when get_date() can return different MYSQL_TIMESTAMP_XXX per row. - */ - class Handler_temporal_string: public Handler_temporal - { - public: - const Type_handler *return_type_handler(const Item_handled_func *) const - { - return &type_handler_string; - } - const Type_handler * - type_handler_for_create_select(const Item_handled_func *item) const - { - return return_type_handler(item)->type_handler_for_tmp_table(item); - } - double val_real(Item_handled_func *item) const - { - return Temporal_hybrid(item).to_double(); - } - longlong val_int(Item_handled_func *item) const - { - return Temporal_hybrid(item).to_longlong(); - } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const - { - return Temporal_hybrid(item).to_decimal(to); - } - String *val_str_ascii(Item_handled_func *item, String *to) const - { - return Temporal_hybrid(item).to_string(to, item->decimals); - } - }; - - - class Handler_date: public Handler_temporal - { - public: - const Type_handler *return_type_handler(const Item_handled_func *) const - { - return &type_handler_newdate; - } - bool fix_length_and_dec(Item_handled_func *item) const - { - item->fix_attributes_date(); - return false; - } - double val_real(Item_handled_func *item) const - { - return Date(item).to_double(); - } - longlong val_int(Item_handled_func *item) const - { - return Date(item).to_longlong(); - } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const - { - return Date(item).to_decimal(to); - } - String *val_str_ascii(Item_handled_func *item, String *to) const - { - return Date(item).to_string(to); - } - }; - - - class Handler_time: public Handler_temporal - { - public: - const Type_handler *return_type_handler(const Item_handled_func *) const - { - return &type_handler_time2; - } - double val_real(Item_handled_func *item) const - { - return Time(item).to_double(); - } - longlong val_int(Item_handled_func *item) const - { - return Time(item).to_longlong(); - } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const - { - return Time(item).to_decimal(to); - } - String *val_str_ascii(Item_handled_func *item, String *to) const - { - return Time(item).to_string(to, item->decimals); - } - bool val_native(THD *thd, Item_handled_func *item, Native *to) const - { - return Time(thd, item).to_native(to, item->decimals); - } - }; - - - class Handler_datetime: public Handler_temporal - { - public: - const Type_handler *return_type_handler(const Item_handled_func *) const - { - return &type_handler_datetime2; - } - double val_real(Item_handled_func *item) const - { - return Datetime(item).to_double(); - } - longlong val_int(Item_handled_func *item) const - { - return Datetime(item).to_longlong(); - } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const - { - return Datetime(item).to_decimal(to); - } - String *val_str_ascii(Item_handled_func *item, String *to) const - { - return Datetime(item).to_string(to, item->decimals); - } - }; - - - class Handler_int: public Handler - { - public: - String *val_str(Item_handled_func *item, String *to) const - { - longlong nr= val_int(item); - if (item->null_value) - return 0; - to->set_int(nr, item->unsigned_flag, item->collation.collation); - return to; - } - String *val_str_ascii(Item_handled_func *item, String *to) const - { - return item->Item::val_str_ascii(to); - } - double val_real(Item_handled_func *item) const - { - return item->unsigned_flag ? (double) ((ulonglong) val_int(item)) : - (double) val_int(item); - } - my_decimal *val_decimal(Item_handled_func *item, my_decimal *to) const - { - return item->val_decimal_from_int(to); - } - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzydate) const - { - return item->get_date_from_int(thd, to, fuzzydate); - } - longlong val_int(Item_handled_func *item) const - { - Longlong_null tmp= to_longlong_null(item); - item->null_value= tmp.is_null(); - return tmp.value(); - } - virtual Longlong_null to_longlong_null(Item_handled_func *item) const= 0; - }; - - class Handler_slong: public Handler_int - { - public: - const Type_handler *return_type_handler(const Item_handled_func *item) const - { - return &type_handler_slong; - } - bool fix_length_and_dec(Item_handled_func *item) const - { - item->unsigned_flag= false; - item->collation= DTCollation_numeric(); - item->fix_char_length(11); - return false; - } - }; - - class Handler_slong2: public Handler_slong - { - public: - bool fix_length_and_dec(Item_handled_func *func) const - { - bool rc= Handler_slong::fix_length_and_dec(func); - func->max_length= 2; - return rc; - } - }; - - class Handler_ulonglong: public Handler_int - { - public: - const Type_handler *return_type_handler(const Item_handled_func *item) const - { - return &type_handler_ulonglong; - } - bool fix_length_and_dec(Item_handled_func *item) const - { - item->unsigned_flag= true; - item->collation= DTCollation_numeric(); - item->fix_char_length(21); - return false; - } - }; - -protected: - const Handler *m_func_handler; -public: - Item_handled_func(THD *thd, Item *a) - :Item_func(thd, a), m_func_handler(NULL) { } - Item_handled_func(THD *thd, Item *a, Item *b) - :Item_func(thd, a, b), m_func_handler(NULL) { } - void set_func_handler(const Handler *handler) - { - m_func_handler= handler; - } - const Type_handler *type_handler() const - { - return m_func_handler->return_type_handler(this); - } - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) - { - DBUG_ASSERT(fixed); - const Type_handler *h= m_func_handler->type_handler_for_create_select(this); - return h->make_and_init_table_field(root, &name, - Record_addr(maybe_null), - *this, table); - } - String *val_str(String *to) - { - return m_func_handler->val_str(this, to); - } - String *val_str_ascii(String *to) - { - return m_func_handler->val_str_ascii(this, to); - } - double val_real() - { - return m_func_handler->val_real(this); - } - longlong val_int() - { - return m_func_handler->val_int(this); - } - my_decimal *val_decimal(my_decimal *to) - { - return m_func_handler->val_decimal(this, to); - } - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) - { - return m_func_handler->get_date(thd, this, to, fuzzydate); - } - bool val_native(THD *thd, Native *to) - { - return m_func_handler->val_native(thd, this, to); - } -}; - - -/** - Functions that at fix_fields() time determine the returned field type, - trying to preserve the exact data type of the arguments. - - The descendants have to implement "native" value methods, - i.e. str_op(), date_op(), int_op(), real_op(), decimal_op(). - fix_fields() chooses which of the above value methods will be - used during execution time, according to the returned field type. - - For example, if fix_fields() determines that the returned value type - is MYSQL_TYPE_LONG, then: - - int_op() is chosen as the execution time native method. - - val_int() returns the result of int_op() as is. - - all other methods, i.e. val_real(), val_decimal(), val_str(), get_date(), - call int_op() first, then convert the result to the requested data type. -*/ -class Item_func_hybrid_field_type: public Item_hybrid_func -{ - /* - Helper methods to make sure that the result of - decimal_op(), str_op() and date_op() is properly synched with null_value. - */ - bool date_op_with_null_check(THD *thd, MYSQL_TIME *ltime) - { - bool rc= date_op(thd, ltime, date_mode_t(0)); - DBUG_ASSERT(!rc ^ null_value); - return rc; - } - bool time_op_with_null_check(THD *thd, MYSQL_TIME *ltime) - { - bool rc= time_op(thd, ltime); - DBUG_ASSERT(!rc ^ null_value); - DBUG_ASSERT(rc || ltime->time_type == MYSQL_TIMESTAMP_TIME); - return rc; - } - String *str_op_with_null_check(String *str) - { - String *res= str_op(str); - DBUG_ASSERT((res != NULL) ^ null_value); - return res; - } - -public: - // Value methods that involve no conversion - String *val_str_from_str_op(String *str) - { - return str_op_with_null_check(&str_value); - } - longlong val_int_from_int_op() - { - return int_op(); - } - double val_real_from_real_op() - { - return real_op(); - } - - // Value methods that involve conversion - String *val_str_from_real_op(String *str); - String *val_str_from_int_op(String *str); - String *val_str_from_date_op(String *str); - String *val_str_from_time_op(String *str); - - my_decimal *val_decimal_from_str_op(my_decimal *dec); - my_decimal *val_decimal_from_real_op(my_decimal *dec); - my_decimal *val_decimal_from_int_op(my_decimal *dec); - my_decimal *val_decimal_from_date_op(my_decimal *dec); - my_decimal *val_decimal_from_time_op(my_decimal *dec); - - longlong val_int_from_str_op(); - longlong val_int_from_real_op(); - longlong val_int_from_date_op(); - longlong val_int_from_time_op(); - - double val_real_from_str_op(); - double val_real_from_date_op(); - double val_real_from_time_op(); - double val_real_from_int_op(); - -public: - Item_func_hybrid_field_type(THD *thd): - Item_hybrid_func(thd) - { collation= DTCollation_numeric(); } - Item_func_hybrid_field_type(THD *thd, Item *a): - Item_hybrid_func(thd, a) - { collation= DTCollation_numeric(); } - Item_func_hybrid_field_type(THD *thd, Item *a, Item *b): - Item_hybrid_func(thd, a, b) - { collation= DTCollation_numeric(); } - Item_func_hybrid_field_type(THD *thd, Item *a, Item *b, Item *c): - Item_hybrid_func(thd, a, b, c) - { collation= DTCollation_numeric(); } - Item_func_hybrid_field_type(THD *thd, List &list): - Item_hybrid_func(thd, list) - { collation= DTCollation_numeric(); } - - double val_real() - { - DBUG_ASSERT(fixed); - return Item_func_hybrid_field_type::type_handler()-> - Item_func_hybrid_field_type_val_real(this); - } - longlong val_int() - { - DBUG_ASSERT(fixed); - return Item_func_hybrid_field_type::type_handler()-> - Item_func_hybrid_field_type_val_int(this); - } - my_decimal *val_decimal(my_decimal *dec) - { - DBUG_ASSERT(fixed); - return Item_func_hybrid_field_type::type_handler()-> - Item_func_hybrid_field_type_val_decimal(this, dec); - } - String *val_str(String*str) - { - DBUG_ASSERT(fixed); - String *res= Item_func_hybrid_field_type::type_handler()-> - Item_func_hybrid_field_type_val_str(this, str); - DBUG_ASSERT(null_value == (res == NULL)); - return res; - } - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) - { - DBUG_ASSERT(fixed); - return Item_func_hybrid_field_type::type_handler()-> - Item_func_hybrid_field_type_get_date_with_warn(thd, this, to, mode); - } - - bool val_native(THD *thd, Native *to) - { - DBUG_ASSERT(fixed); - return native_op(thd, to); - } - - /** - @brief Performs the operation that this functions implements when the - result type is INT. - - @return The result of the operation. - */ - virtual longlong int_op()= 0; - Longlong_null to_longlong_null_op() - { - longlong nr= int_op(); - /* - C++ does not guarantee the order of parameter evaluation, - so to make sure "null_value" is passed to the constructor - after the int_op() call, int_op() is caled on a separate line. - */ - return Longlong_null(nr, null_value); - } - Longlong_hybrid_null to_longlong_hybrid_null_op() - { - return Longlong_hybrid_null(to_longlong_null_op(), unsigned_flag); - } - - /** - @brief Performs the operation that this functions implements when the - result type is REAL. - - @return The result of the operation. - */ - virtual double real_op()= 0; - Double_null to_double_null_op() - { - // val_real() must be caleed on a separate line. See to_longlong_null() - double nr= real_op(); - return Double_null(nr, null_value); - } - - /** - @brief Performs the operation that this functions implements when the - result type is DECIMAL. - - @param A pointer where the DECIMAL value will be allocated. - @return - - 0 If the result is NULL - - The same pointer it was given, with the area initialized to the - result of the operation. - */ - virtual my_decimal *decimal_op(my_decimal *)= 0; - - /** - @brief Performs the operation that this functions implements when the - result type is a string type. - - @return The result of the operation. - */ - virtual String *str_op(String *)= 0; - - /** - @brief Performs the operation that this functions implements when - field type is DATETIME or DATE. - @return The result of the operation. - */ - virtual bool date_op(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate)= 0; - - /** - @brief Performs the operation that this functions implements when - field type is TIME. - @return The result of the operation. - */ - virtual bool time_op(THD *thd, MYSQL_TIME *res)= 0; - - virtual bool native_op(THD *thd, Native *native)= 0; -}; - - -/* - This class resembles SQL standard CASE-alike expressions: - CASE and its abbreviations COALESCE, NULLIF, IFNULL, IF. - - ::= - | -*/ -class Item_func_case_expression: public Item_func_hybrid_field_type -{ -public: - Item_func_case_expression(THD *thd) - :Item_func_hybrid_field_type(thd) - { } - Item_func_case_expression(THD *thd, Item *a) - :Item_func_hybrid_field_type(thd, a) - { } - Item_func_case_expression(THD *thd, Item *a, Item *b) - :Item_func_hybrid_field_type(thd, a, b) - { } - Item_func_case_expression(THD *thd, Item *a, Item *b, Item *c) - :Item_func_hybrid_field_type(thd, a, b, c) - { } - Item_func_case_expression(THD *thd, List &list): - Item_func_hybrid_field_type(thd, list) - { } - bool find_not_null_fields(table_map allowed) { return false; } -}; - - -class Item_func_numhybrid: public Item_func_hybrid_field_type -{ -protected: - - inline void fix_decimals() - { - DBUG_ASSERT(result_type() == DECIMAL_RESULT); - if (decimals == NOT_FIXED_DEC) - set_if_smaller(decimals, max_length - 1); - } - -public: - Item_func_numhybrid(THD *thd): Item_func_hybrid_field_type(thd) - { } - Item_func_numhybrid(THD *thd, Item *a): Item_func_hybrid_field_type(thd, a) - { } - Item_func_numhybrid(THD *thd, Item *a, Item *b): - Item_func_hybrid_field_type(thd, a, b) - { } - Item_func_numhybrid(THD *thd, Item *a, Item *b, Item *c): - Item_func_hybrid_field_type(thd, a, b, c) - { } - Item_func_numhybrid(THD *thd, List &list): - Item_func_hybrid_field_type(thd, list) - { } - String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - DBUG_ASSERT(0); - return true; - } - bool time_op(THD *thd, MYSQL_TIME *ltime) - { - DBUG_ASSERT(0); - return true; - } - bool native_op(THD *thd, Native *to) - { - DBUG_ASSERT(0); - return true; - } -}; - - -/* function where type of result detected by first argument */ -class Item_func_num1: public Item_func_numhybrid -{ -public: - Item_func_num1(THD *thd, Item *a): Item_func_numhybrid(thd, a) {} - Item_func_num1(THD *thd, Item *a, Item *b): Item_func_numhybrid(thd, a, b) {} - bool check_partition_func_processor(void *int_arg) { return FALSE; } - bool check_vcol_func_processor(void *arg) { return FALSE; } -}; - - -/* Base class for operations like '+', '-', '*' */ -class Item_num_op :public Item_func_numhybrid -{ -protected: - bool check_arguments() const - { - return false; // Checked by aggregate_for_num_op() - } -public: - Item_num_op(THD *thd, Item *a, Item *b): Item_func_numhybrid(thd, a, b) {} - virtual void result_precision()= 0; - - virtual inline void print(String *str, enum_query_type query_type) - { - print_op(str, query_type); - } - bool fix_type_handler(const Type_aggregator *aggregator); - void fix_length_and_dec_double() - { - aggregate_numeric_attributes_real(args, arg_count); - max_length= float_length(decimals); - } - void fix_length_and_dec_decimal() - { - unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag; - result_precision(); - fix_decimals(); - } - void fix_length_and_dec_int() - { - unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag; - result_precision(); - decimals= 0; - set_handler(type_handler_long_or_longlong()); - } - void fix_length_and_dec_temporal(bool downcast_decimal_to_int) - { - set_handler(&type_handler_newdecimal); - fix_length_and_dec_decimal(); - if (decimals == 0 && downcast_decimal_to_int) - set_handler(type_handler_long_or_longlong()); - } - bool need_parentheses_in_default() { return true; } -}; - - -class Item_int_func :public Item_func -{ -public: - /* - QQ: shouldn't 20 characters be enough: - Max unsigned = 18,446,744,073,709,551,615 = 20 digits, 20 characters - Max signed = 9,223,372,036,854,775,807 = 19 digits, 19 characters - Min signed = -9,223,372,036,854,775,808 = 19 digits, 20 characters - */ - Item_int_func(THD *thd): Item_func(thd) - { collation= DTCollation_numeric(); fix_char_length(21); } - Item_int_func(THD *thd, Item *a): Item_func(thd, a) - { collation= DTCollation_numeric(); fix_char_length(21); } - Item_int_func(THD *thd, Item *a, Item *b): Item_func(thd, a, b) - { collation= DTCollation_numeric(); fix_char_length(21); } - Item_int_func(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b, c) - { collation= DTCollation_numeric(); fix_char_length(21); } - Item_int_func(THD *thd, Item *a, Item *b, Item *c, Item *d): - Item_func(thd, a, b, c, d) - { collation= DTCollation_numeric(); fix_char_length(21); } - Item_int_func(THD *thd, List &list): Item_func(thd, list) - { collation= DTCollation_numeric(); fix_char_length(21); } - Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) - { collation= DTCollation_numeric(); } - double val_real(); - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *decimal_value) - { - return val_decimal_from_int(decimal_value); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { return get_date_from_int(thd, ltime, fuzzydate); } - const Type_handler *type_handler() const= 0; - bool fix_length_and_dec() { return FALSE; } -}; - - -class Item_long_func: public Item_int_func -{ -public: - Item_long_func(THD *thd): Item_int_func(thd) { } - Item_long_func(THD *thd, Item *a): Item_int_func(thd, a) {} - Item_long_func(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {} - Item_long_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {} - Item_long_func(THD *thd, List &list): Item_int_func(thd, list) { } - Item_long_func(THD *thd, Item_long_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const - { - if (unsigned_flag) - return &type_handler_ulong; - return &type_handler_slong; - } - bool fix_length_and_dec() { max_length= 11; return FALSE; } -}; - - -class Item_func_hash: public Item_int_func -{ -public: - Item_func_hash(THD *thd, List &item): Item_int_func(thd, item) - {} - longlong val_int(); - bool fix_length_and_dec(); - const Type_handler *type_handler() const { return &type_handler_slong; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - const char *func_name() const { return ""; } -}; - -class Item_longlong_func: public Item_int_func -{ -public: - Item_longlong_func(THD *thd): Item_int_func(thd) { } - Item_longlong_func(THD *thd, Item *a): Item_int_func(thd, a) {} - Item_longlong_func(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {} - Item_longlong_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {} - Item_longlong_func(THD *thd, Item *a, Item *b, Item *c, Item *d): - Item_int_func(thd, a, b, c, d) {} - Item_longlong_func(THD *thd, List &list): Item_int_func(thd, list) { } - Item_longlong_func(THD *thd, Item_longlong_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const - { - if (unsigned_flag) - return &type_handler_ulonglong; - return &type_handler_slonglong; - } -}; - - -class Cursor_ref -{ -protected: - LEX_CSTRING m_cursor_name; - uint m_cursor_offset; - class sp_cursor *get_open_cursor_or_error(); - Cursor_ref(const LEX_CSTRING *name, uint offset) - :m_cursor_name(*name), m_cursor_offset(offset) - { } - void print_func(String *str, const char *func_name); -}; - - - -class Item_func_cursor_rowcount: public Item_longlong_func, - public Cursor_ref -{ -public: - Item_func_cursor_rowcount(THD *thd, const LEX_CSTRING *name, uint offset) - :Item_longlong_func(thd), Cursor_ref(name, offset) { maybe_null= true; } - const char *func_name() const { return "%ROWCOUNT"; } - longlong val_int(); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC); - } - void print(String *str, enum_query_type query_type) - { - return Cursor_ref::print_func(str, func_name()); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - - -class Item_func_connection_id :public Item_long_func -{ - longlong value; - -public: - Item_func_connection_id(THD *thd): Item_long_func(thd) { unsigned_flag=1; } - const char *func_name() const { return "connection_id"; } - bool fix_length_and_dec(); - bool fix_fields(THD *thd, Item **ref); - longlong val_int() { DBUG_ASSERT(fixed == 1); return value; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_signed :public Item_int_func -{ -public: - Item_func_signed(THD *thd, Item *a): Item_int_func(thd, a) - { - unsigned_flag= 0; - } - const char *func_name() const { return "cast_as_signed"; } - const Type_handler *type_handler() const - { - return Type_handler::type_handler_long_or_longlong(max_char_length(), - false); - } - longlong val_int() - { - longlong value= args[0]->val_int_signed_typecast(); - null_value= args[0]->null_value; - return value; - } - void fix_length_and_dec_double() - { - fix_char_length(MAX_BIGINT_WIDTH); - } - void fix_length_and_dec_generic() - { - uint32 char_length= MY_MIN(args[0]->max_char_length(), - MY_INT64_NUM_DECIMAL_DIGITS); - /* - args[0]->max_char_length() can return 0. - Reserve max_length to fit at least one character for one digit, - plus one character for the sign (if signed). - */ - set_if_bigger(char_length, 1U + (unsigned_flag ? 0 : 1)); - fix_char_length(char_length); - } - void fix_length_and_dec_string() - { - /* - For strings, use decimal_int_part() instead of max_char_length(). - This is important for Item_hex_hybrid: - SELECT CAST(0x1FFFFFFFF AS SIGNED); - Length is 5, decimal_int_part() is 13. - */ - uint32 char_length= MY_MIN(args[0]->decimal_int_part(), - MY_INT64_NUM_DECIMAL_DIGITS); - set_if_bigger(char_length, 1U + (unsigned_flag ? 0 : 1)); - fix_char_length(char_length); - } - bool fix_length_and_dec() - { - return args[0]->type_handler()->Item_func_signed_fix_length_and_dec(this); - } - virtual void print(String *str, enum_query_type query_type); - uint decimal_precision() const { return args[0]->decimal_precision(); } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_unsigned :public Item_func_signed -{ -public: - Item_func_unsigned(THD *thd, Item *a): Item_func_signed(thd, a) - { - unsigned_flag= 1; - } - const char *func_name() const { return "cast_as_unsigned"; } - const Type_handler *type_handler() const - { - if (max_char_length() <= MY_INT32_NUM_DECIMAL_DIGITS - 1) - return &type_handler_ulong; - return &type_handler_ulonglong; - } - longlong val_int() - { - longlong value= args[0]->val_int_unsigned_typecast(); - null_value= args[0]->null_value; - return value; - } - bool fix_length_and_dec() - { - return args[0]->type_handler()->Item_func_unsigned_fix_length_and_dec(this); - } - uint decimal_precision() const { return max_length; } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_decimal_typecast :public Item_func -{ - my_decimal decimal_value; -public: - Item_decimal_typecast(THD *thd, Item *a, uint len, uint dec) - :Item_func(thd, a) - { - decimals= (uint8) dec; - collation= DTCollation_numeric(); - fix_char_length(my_decimal_precision_to_length_no_truncation(len, dec, - unsigned_flag)); - } - String *val_str(String *str) { return VDec(this).to_string(str); } - double val_real() { return VDec(this).to_double(); } - longlong val_int() { return VDec(this).to_longlong(unsigned_flag); } - my_decimal *val_decimal(my_decimal*); - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) - { - return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, - NULL, NULL); - } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - void fix_length_and_dec_generic() {} - bool fix_length_and_dec() - { - return - args[0]->type_handler()->Item_decimal_typecast_fix_length_and_dec(this); - } - const char *func_name() const { return "decimal_typecast"; } - virtual void print(String *str, enum_query_type query_type); - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_real_typecast: public Item_real_func -{ -protected: - double val_real_with_truncate(double max_value); -public: - Item_real_typecast(THD *thd, Item *a, uint len, uint dec) - :Item_real_func(thd, a) - { - decimals= (uint8) dec; - max_length= (uint32) len; - } - bool need_parentheses_in_default() { return true; } - void print(String *str, enum_query_type query_type); - void fix_length_and_dec_generic() { maybe_null= 1; } -}; - - -class Item_float_typecast :public Item_real_typecast -{ -public: - Item_float_typecast(THD *thd, Item *a) - :Item_real_typecast(thd, a, MAX_FLOAT_STR_LENGTH, NOT_FIXED_DEC) - { } - const Type_handler *type_handler() const { return &type_handler_float; } - bool fix_length_and_dec() - { - return - args[0]->type_handler()->Item_float_typecast_fix_length_and_dec(this); - } - const char *func_name() const { return "float_typecast"; } - double val_real() - { - return (double) (float) val_real_with_truncate(FLT_MAX); - } - String *val_str(String*str) - { - Float nr(Item_float_typecast::val_real()); - if (null_value) - return 0; - nr.to_string(str, decimals); - return str; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_double_typecast :public Item_real_typecast -{ -public: - Item_double_typecast(THD *thd, Item *a, uint len, uint dec): - Item_real_typecast(thd, a, len, dec) - { } - bool fix_length_and_dec() - { - return - args[0]->type_handler()->Item_double_typecast_fix_length_and_dec(this); - } - const char *func_name() const { return "double_typecast"; } - double val_real() { return val_real_with_truncate(DBL_MAX); } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_additive_op :public Item_num_op -{ -public: - Item_func_additive_op(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} - void result_precision(); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} -}; - - -class Item_func_plus :public Item_func_additive_op -{ -public: - Item_func_plus(THD *thd, Item *a, Item *b): - Item_func_additive_op(thd, a, b) {} - const char *func_name() const { return "+"; } - enum precedence precedence() const { return ADD_PRECEDENCE; } - bool fix_length_and_dec(); - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_minus :public Item_func_additive_op -{ - bool m_depends_on_sql_mode_no_unsigned_subtraction; -public: - Item_func_minus(THD *thd, Item *a, Item *b): - Item_func_additive_op(thd, a, b), - m_depends_on_sql_mode_no_unsigned_subtraction(false) - { } - const char *func_name() const { return "-"; } - enum precedence precedence() const { return ADD_PRECEDENCE; } - Sql_mode_dependency value_depends_on_sql_mode() const; - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - bool fix_length_and_dec(); - void fix_unsigned_flag(); - void fix_length_and_dec_double() - { - Item_func_additive_op::fix_length_and_dec_double(); - fix_unsigned_flag(); - } - void fix_length_and_dec_decimal() - { - Item_func_additive_op::fix_length_and_dec_decimal(); - fix_unsigned_flag(); - } - void fix_length_and_dec_int() - { - Item_func_additive_op::fix_length_and_dec_int(); - fix_unsigned_flag(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_mul :public Item_num_op -{ -public: - Item_func_mul(THD *thd, Item *a, Item *b): - Item_num_op(thd, a, b) {} - const char *func_name() const { return "*"; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - void result_precision(); - bool fix_length_and_dec(); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_div :public Item_num_op -{ -public: - uint prec_increment; - Item_func_div(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} - longlong int_op() { DBUG_ASSERT(0); return 0; } - double real_op(); - my_decimal *decimal_op(my_decimal *); - const char *func_name() const { return "/"; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - bool fix_length_and_dec(); - void fix_length_and_dec_double(); - void fix_length_and_dec_int(); - void result_precision(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_int_div :public Item_int_func -{ -public: - Item_func_int_div(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) - {} - longlong val_int(); - const char *func_name() const { return "DIV"; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - const Type_handler *type_handler() const - { return type_handler_long_or_longlong(); } - bool fix_length_and_dec(); - void print(String *str, enum_query_type query_type) - { - print_op(str, query_type); - } - - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_mod :public Item_num_op -{ -public: - Item_func_mod(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - const char *func_name() const { return "MOD"; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - void result_precision(); - bool fix_length_and_dec(); - void fix_length_and_dec_double() - { - Item_num_op::fix_length_and_dec_double(); - unsigned_flag= args[0]->unsigned_flag; - } - void fix_length_and_dec_decimal() - { - result_precision(); - fix_decimals(); - } - void fix_length_and_dec_int() - { - result_precision(); - DBUG_ASSERT(decimals == 0); - set_handler(type_handler_long_or_longlong()); - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_neg :public Item_func_num1 -{ -public: - Item_func_neg(THD *thd, Item *a): Item_func_num1(thd, a) {} - double real_op(); - longlong int_op(); - my_decimal *decimal_op(my_decimal *); - const char *func_name() const { return "-"; } - enum Functype functype() const { return NEG_FUNC; } - enum precedence precedence() const { return NEG_PRECEDENCE; } - void print(String *str, enum_query_type query_type) - { - str->append(func_name()); - args[0]->print_parenthesised(str, query_type, precedence()); - } - void fix_length_and_dec_int(); - void fix_length_and_dec_double(); - void fix_length_and_dec_decimal(); - bool fix_length_and_dec(); - uint decimal_precision() const { return args[0]->decimal_precision(); } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_abs :public Item_func_num1 -{ -public: - Item_func_abs(THD *thd, Item *a): Item_func_num1(thd, a) {} - double real_op(); - longlong int_op(); - my_decimal *decimal_op(my_decimal *); - const char *func_name() const { return "abs"; } - void fix_length_and_dec_int(); - void fix_length_and_dec_double(); - void fix_length_and_dec_decimal(); - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -// A class to handle logarithmic and trigonometric functions - -class Item_dec_func :public Item_real_func -{ - bool check_arguments() const - { return check_argument_types_can_return_real(0, arg_count); } - public: - Item_dec_func(THD *thd, Item *a): Item_real_func(thd, a) {} - Item_dec_func(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {} - bool fix_length_and_dec() - { - decimals=NOT_FIXED_DEC; max_length=float_length(decimals); - maybe_null=1; - return FALSE; - } -}; - -class Item_func_exp :public Item_dec_func -{ -public: - Item_func_exp(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "exp"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_ln :public Item_dec_func -{ -public: - Item_func_ln(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "ln"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_log :public Item_dec_func -{ -public: - Item_func_log(THD *thd, Item *a): Item_dec_func(thd, a) {} - Item_func_log(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {} - double val_real(); - const char *func_name() const { return "log"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_log2 :public Item_dec_func -{ -public: - Item_func_log2(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "log2"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_log10 :public Item_dec_func -{ -public: - Item_func_log10(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "log10"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_sqrt :public Item_dec_func -{ -public: - Item_func_sqrt(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "sqrt"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_pow :public Item_dec_func -{ -public: - Item_func_pow(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {} - double val_real(); - const char *func_name() const { return "pow"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_acos :public Item_dec_func -{ -public: - Item_func_acos(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "acos"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_asin :public Item_dec_func -{ -public: - Item_func_asin(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "asin"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_atan :public Item_dec_func -{ -public: - Item_func_atan(THD *thd, Item *a): Item_dec_func(thd, a) {} - Item_func_atan(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {} - double val_real(); - const char *func_name() const { return "atan"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_cos :public Item_dec_func -{ -public: - Item_func_cos(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "cos"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_sin :public Item_dec_func -{ -public: - Item_func_sin(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "sin"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_tan :public Item_dec_func -{ -public: - Item_func_tan(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "tan"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_cot :public Item_dec_func -{ -public: - Item_func_cot(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); - const char *func_name() const { return "cot"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_int_val :public Item_func_hybrid_field_type -{ -public: - Item_func_int_val(THD *thd, Item *a): Item_func_hybrid_field_type(thd, a) {} - bool check_partition_func_processor(void *int_arg) { return FALSE; } - bool check_vcol_func_processor(void *arg) { return FALSE; } - virtual decimal_round_mode round_mode() const= 0; - void fix_length_and_dec_double(); - void fix_length_and_dec_int_or_decimal(); - void fix_length_and_dec_time() - { - fix_attributes_time(0); - set_handler(&type_handler_time2); - } - void fix_length_and_dec_datetime() - { - fix_attributes_datetime(0); - set_handler(&type_handler_datetime2); - maybe_null= true; // E.g. CEILING(TIMESTAMP'0000-01-01 23:59:59.9') - } - bool fix_length_and_dec(); - String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool native_op(THD *thd, Native *to) - { - DBUG_ASSERT(0); - return true; - } -}; - - -class Item_func_ceiling :public Item_func_int_val -{ -public: - Item_func_ceiling(THD *thd, Item *a): Item_func_int_val(thd, a) {} - const char *func_name() const { return "ceiling"; } - decimal_round_mode round_mode() const { return CEILING; } - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_floor :public Item_func_int_val -{ -public: - Item_func_floor(THD *thd, Item *a): Item_func_int_val(thd, a) {} - const char *func_name() const { return "floor"; } - decimal_round_mode round_mode() const { return FLOOR; } - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -/* This handles round and truncate */ - -class Item_func_round :public Item_func_hybrid_field_type -{ - bool truncate; - void fix_length_and_dec_decimal(uint decimals_to_set); - void fix_length_and_dec_double(uint decimals_to_set); - bool test_if_length_can_increase(); -public: - Item_func_round(THD *thd, Item *a, Item *b, bool trunc_arg) - :Item_func_hybrid_field_type(thd, a, b), truncate(trunc_arg) {} - const char *func_name() const { return truncate ? "truncate" : "round"; } - double real_op(); - longlong int_op(); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to) - { - DBUG_ASSERT(0); - return true; - } - String *str_op(String *str) - { - DBUG_ASSERT(0); - return NULL; - } - void fix_arg_decimal(); - void fix_arg_int(const Type_handler *preferred, - const Type_std_attributes *preferred_attributes, - bool use_decimal_on_length_increase); - void fix_arg_hex_hybrid(); - void fix_arg_double(); - void fix_arg_time(); - void fix_arg_datetime(); - void fix_arg_temporal(const Type_handler *h, uint int_part_length); - bool fix_length_and_dec() - { - /* - We don't want to translate ENUM/SET to CHAR here. - So let's real_type_handler(), not type_handler(). - */ - return args[0]->real_type_handler()->Item_func_round_fix_length_and_dec(this); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_rand :public Item_real_func -{ - struct my_rnd_struct *rand; - bool first_eval; // TRUE if val_real() is called 1st time - bool check_arguments() const - { return check_argument_types_can_return_int(0, arg_count); } -public: - Item_func_rand(THD *thd, Item *a): - Item_real_func(thd, a), rand(0), first_eval(TRUE) {} - Item_func_rand(THD *thd): Item_real_func(thd) {} - double val_real(); - const char *func_name() const { return "rand"; } - bool const_item() const { return 0; } - void update_used_tables(); - bool fix_fields(THD *thd, Item **ref); - void cleanup() { first_eval= TRUE; Item_real_func::cleanup(); } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -private: - void seed_random (Item * val); -}; - - -class Item_func_sign :public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_real(func_name()); } -public: - Item_func_sign(THD *thd, Item *a): Item_long_func(thd, a) {} - const char *func_name() const { return "sign"; } - uint decimal_precision() const { return 1; } - bool fix_length_and_dec() { fix_char_length(2); return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_units :public Item_real_func -{ - char *name; - double mul,add; - bool check_arguments() const - { return check_argument_types_can_return_real(0, arg_count); } -public: - Item_func_units(THD *thd, char *name_arg, Item *a, double mul_arg, - double add_arg): - Item_real_func(thd, a), name(name_arg), mul(mul_arg), add(add_arg) {} - double val_real(); - const char *func_name() const { return name; } - bool fix_length_and_dec() - { - decimals= NOT_FIXED_DEC; - max_length= float_length(decimals); - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - Item_func_min_max does not derive from Item_func_hybrid_field_type - because the way how its methods val_xxx() and get_date() work depend - not only by its arguments, but also on the context in which - LEAST() and GREATEST() appear. - For example, using Item_func_min_max in a CAST like this: - CAST(LEAST('11','2') AS SIGNED) - forces Item_func_min_max to compare the arguments as numbers rather - than strings. - Perhaps this should be changed eventually (see MDEV-5893). -*/ -class Item_func_min_max :public Item_hybrid_func -{ - String tmp_value; - int cmp_sign; -protected: - bool check_arguments() const - { - return false; // Checked by aggregate_for_min_max() - } - bool fix_attributes(Item **item, uint nitems); -public: - Item_func_min_max(THD *thd, List &list, int cmp_sign_arg): - Item_hybrid_func(thd, list), cmp_sign(cmp_sign_arg) - {} - String *val_str_native(String *str); - double val_real_native(); - longlong val_int_native(); - my_decimal *val_decimal_native(my_decimal *); - bool get_date_native(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool get_time_native(THD *thd, MYSQL_TIME *res); - - double val_real() - { - DBUG_ASSERT(fixed); - return Item_func_min_max::type_handler()-> - Item_func_min_max_val_real(this); - } - longlong val_int() - { - DBUG_ASSERT(fixed); - return Item_func_min_max::type_handler()-> - Item_func_min_max_val_int(this); - } - String *val_str(String *str) - { - DBUG_ASSERT(fixed); - return Item_func_min_max::type_handler()-> - Item_func_min_max_val_str(this, str); - } - my_decimal *val_decimal(my_decimal *dec) - { - DBUG_ASSERT(fixed); - return Item_func_min_max::type_handler()-> - Item_func_min_max_val_decimal(this, dec); - } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) - { - DBUG_ASSERT(fixed); - return Item_func_min_max::type_handler()-> - Item_func_min_max_get_date(thd, this, res, fuzzydate); - } - bool val_native(THD *thd, Native *to); - void aggregate_attributes_real(Item **items, uint nitems) - { - /* - Aggregating attributes for the double data type for LEAST/GREATEST - is almost the same with aggregating for CASE-alike hybrid functions, - (CASE..THEN, COALESCE, IF, etc). - There is one notable difference though, when a numeric argument is mixed - with a string argument: - - CASE-alike functions return a string data type in such cases - COALESCE(10,'x') -> VARCHAR(2) = '10' - - LEAST/GREATEST returns double: - GREATEST(10,'10e4') -> DOUBLE = 100000 - As the string argument can represent a number in the scientific notation, - like in the example above, max_length of the result can be longer than - max_length of the arguments. To handle this properly, max_length is - additionally assigned to the result of float_length(decimals). - */ - Item_func::aggregate_attributes_real(items, nitems); - max_length= float_length(decimals); - } - bool fix_length_and_dec() - { - if (aggregate_for_min_max(func_name(), args, arg_count)) - return true; - fix_attributes(args, arg_count); - return false; - } -}; - -class Item_func_min :public Item_func_min_max -{ -public: - Item_func_min(THD *thd, List &list): Item_func_min_max(thd, list, 1) {} - const char *func_name() const { return "least"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_max :public Item_func_min_max -{ -public: - Item_func_max(THD *thd, List &list): Item_func_min_max(thd, list, -1) {} - const char *func_name() const { return "greatest"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - Objects of this class are used for ROLLUP queries to wrap up - each constant item referred to in GROUP BY list. -*/ - -class Item_func_rollup_const :public Item_func -{ -public: - Item_func_rollup_const(THD *thd, Item *a): Item_func(thd, a) - { - name= a->name; - } - double val_real() { return val_real_from_item(args[0]); } - longlong val_int() { return val_int_from_item(args[0]); } - String *val_str(String *str) { return val_str_from_item(args[0], str); } - bool val_native(THD *thd, Native *to) - { return val_native_from_item(thd, args[0], to); } - my_decimal *val_decimal(my_decimal *dec) - { return val_decimal_from_item(args[0], dec); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { return get_date_from_item(thd, args[0], ltime, fuzzydate); } - const char *func_name() const { return "rollup_const"; } - bool const_item() const { return 0; } - const Type_handler *type_handler() const { return args[0]->type_handler(); } - bool fix_length_and_dec() - { - Type_std_attributes::set(*args[0]); - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_long_func_length: public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_str(func_name()); } -public: - Item_long_func_length(THD *thd, Item *a): Item_long_func(thd, a) {} - bool fix_length_and_dec() { max_length=10; return FALSE; } -}; - - -class Item_func_octet_length :public Item_long_func_length -{ - String value; -public: - Item_func_octet_length(THD *thd, Item *a): Item_long_func_length(thd, a) {} - longlong val_int(); - const char *func_name() const { return "octet_length"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_bit_length :public Item_longlong_func -{ - String value; -public: - Item_func_bit_length(THD *thd, Item *a): Item_longlong_func(thd, a) {} - bool fix_length_and_dec() - { - max_length= 11; // 0x100000000*8 = 34,359,738,368 - return FALSE; - } - longlong val_int(); - const char *func_name() const { return "bit_length"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_char_length :public Item_long_func_length -{ - String value; -public: - Item_func_char_length(THD *thd, Item *a): Item_long_func_length(thd, a) {} - longlong val_int(); - const char *func_name() const { return "char_length"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_coercibility :public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_str(func_name()); } -public: - Item_func_coercibility(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "coercibility"; } - bool fix_length_and_dec() { max_length=10; maybe_null= 0; return FALSE; } - bool eval_not_null_tables(void *) - { - not_null_tables_cache= 0; - return false; - } - bool find_not_null_fields(table_map allowed) - { - return false; - } - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { return this; } - bool const_item() const { return true; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - In the corner case LOCATE could return (4,294,967,296 + 1), - which would not fit into Item_long_func range. - But string lengths are limited with max_allowed_packet, - which cannot be bigger than 1024*1024*1024. -*/ -class Item_func_locate :public Item_long_func -{ - bool check_arguments() const - { - return check_argument_types_can_return_str(0, 2) || - (arg_count > 2 && args[2]->check_type_can_return_int(func_name())); - } - String value1,value2; - DTCollation cmp_collation; -public: - Item_func_locate(THD *thd, Item *a, Item *b) - :Item_long_func(thd, a, b) {} - Item_func_locate(THD *thd, Item *a, Item *b, Item *c) - :Item_long_func(thd, a, b, c) {} - const char *func_name() const { return "locate"; } - longlong val_int(); - bool fix_length_and_dec() - { - max_length= MY_INT32_NUM_DECIMAL_DIGITS; - return agg_arg_charsets_for_comparison(cmp_collation, args, 2); - } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_field :public Item_long_func -{ - String value,tmp; - Item_result cmp_type; - DTCollation cmp_collation; -public: - Item_func_field(THD *thd, List &list): Item_long_func(thd, list) {} - longlong val_int(); - const char *func_name() const { return "field"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_ascii :public Item_long_func -{ - bool check_arguments() const - { return check_argument_types_can_return_str(0, arg_count); } - String value; -public: - Item_func_ascii(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "ascii"; } - bool fix_length_and_dec() { max_length=3; return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_ord :public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_str(func_name()); } - String value; -public: - Item_func_ord(THD *thd, Item *a): Item_long_func(thd, a) {} - bool fix_length_and_dec() { fix_char_length(7); return FALSE; } - longlong val_int(); - const char *func_name() const { return "ord"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_find_in_set :public Item_long_func -{ - bool check_arguments() const - { return check_argument_types_can_return_str(0, 2); } - String value,value2; - uint enum_value; - ulonglong enum_bit; - DTCollation cmp_collation; -public: - Item_func_find_in_set(THD *thd, Item *a, Item *b): - Item_long_func(thd, a, b), enum_value(0) {} - longlong val_int(); - const char *func_name() const { return "find_in_set"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */ - -class Item_func_bit_operator: public Item_handled_func -{ - bool check_arguments() const - { return check_argument_types_can_return_int(0, arg_count); } -protected: - bool fix_length_and_dec_op1_std(const Handler *ha_int, const Handler *ha_dec) - { - set_func_handler(args[0]->cmp_type() == INT_RESULT ? ha_int : ha_dec); - return m_func_handler->fix_length_and_dec(this); - } - bool fix_length_and_dec_op2_std(const Handler *ha_int, const Handler *ha_dec) - { - set_func_handler(args[0]->cmp_type() == INT_RESULT && - args[1]->cmp_type() == INT_RESULT ? ha_int : ha_dec); - return m_func_handler->fix_length_and_dec(this); - } -public: - Item_func_bit_operator(THD *thd, Item *a) - :Item_handled_func(thd, a) {} - Item_func_bit_operator(THD *thd, Item *a, Item *b) - :Item_handled_func(thd, a, b) {} - void print(String *str, enum_query_type query_type) - { - print_op(str, query_type); - } - bool need_parentheses_in_default() { return true; } -}; - -class Item_func_bit_or :public Item_func_bit_operator -{ -public: - Item_func_bit_or(THD *thd, Item *a, Item *b) - :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "|"; } - enum precedence precedence() const { return BITOR_PRECEDENCE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_bit_and :public Item_func_bit_operator -{ -public: - Item_func_bit_and(THD *thd, Item *a, Item *b) - :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "&"; } - enum precedence precedence() const { return BITAND_PRECEDENCE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_bit_count :public Item_handled_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_int(func_name()); } -public: - Item_func_bit_count(THD *thd, Item *a): Item_handled_func(thd, a) {} - const char *func_name() const { return "bit_count"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_shift_left :public Item_func_bit_operator -{ -public: - Item_func_shift_left(THD *thd, Item *a, Item *b) - :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "<<"; } - enum precedence precedence() const { return SHIFT_PRECEDENCE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_shift_right :public Item_func_bit_operator -{ -public: - Item_func_shift_right(THD *thd, Item *a, Item *b) - :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return ">>"; } - enum precedence precedence() const { return SHIFT_PRECEDENCE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_bit_neg :public Item_func_bit_operator -{ -public: - Item_func_bit_neg(THD *thd, Item *a): Item_func_bit_operator(thd, a) {} - bool fix_length_and_dec(); - const char *func_name() const { return "~"; } - enum precedence precedence() const { return NEG_PRECEDENCE; } - void print(String *str, enum_query_type query_type) - { - str->append(func_name()); - args[0]->print_parenthesised(str, query_type, precedence()); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_last_insert_id :public Item_longlong_func -{ - bool check_arguments() const - { return check_argument_types_can_return_int(0, arg_count); } -public: - Item_func_last_insert_id(THD *thd): Item_longlong_func(thd) {} - Item_func_last_insert_id(THD *thd, Item *a): Item_longlong_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "last_insert_id"; } - bool fix_length_and_dec() - { - unsigned_flag= true; - if (arg_count) - max_length= args[0]->max_length; - return FALSE; - } - bool fix_fields(THD *thd, Item **ref); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_benchmark :public Item_long_func -{ - bool check_arguments() const - { - return args[0]->check_type_can_return_int(func_name()) || - args[1]->check_type_scalar(func_name()); - } -public: - Item_func_benchmark(THD *thd, Item *count_expr, Item *expr): - Item_long_func(thd, count_expr, expr) - {} - longlong val_int(); - const char *func_name() const { return "benchmark"; } - bool fix_length_and_dec() { max_length=1; maybe_null=0; return FALSE; } - virtual void print(String *str, enum_query_type query_type); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -void item_func_sleep_init(void); -void item_func_sleep_free(void); - -class Item_func_sleep :public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_real(func_name()); } -public: - Item_func_sleep(THD *thd, Item *a): Item_long_func(thd, a) {} - bool fix_length_and_dec() { fix_char_length(1); return FALSE; } - bool const_item() const { return 0; } - const char *func_name() const { return "sleep"; } - table_map used_tables() const - { - return used_tables_cache | RAND_TABLE_BIT; - } - bool is_expensive() { return 1; } - longlong val_int(); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - - -#ifdef HAVE_DLOPEN - -class Item_udf_func :public Item_func -{ - /** - Mark "this" as non-deterministic if it uses no tables - and is not a constant at the same time. - */ - void set_non_deterministic_if_needed() - { - if (!const_item_cache && !used_tables_cache) - used_tables_cache= RAND_TABLE_BIT; - } -protected: - udf_handler udf; - bool is_expensive_processor(void *arg) { return TRUE; } - - class VDec_udf: public Dec_ptr_and_buffer - { - public: - VDec_udf(Item_udf_func *func, udf_handler *udf) - { - my_bool tmp_null_value; - m_ptr= udf->val_decimal(&tmp_null_value, &m_buffer); - DBUG_ASSERT(is_null() == (tmp_null_value != 0)); - func->null_value= is_null(); - } - }; - -public: - Item_udf_func(THD *thd, udf_func *udf_arg): - Item_func(thd), udf(udf_arg) {} - Item_udf_func(THD *thd, udf_func *udf_arg, List &list): - Item_func(thd, list), udf(udf_arg) {} - const char *func_name() const { return udf.name(); } - enum Functype functype() const { return UDF_FUNC; } - bool fix_fields(THD *thd, Item **ref) - { - DBUG_ASSERT(fixed == 0); - bool res= udf.fix_fields(thd, this, arg_count, args); - set_non_deterministic_if_needed(); - fixed= 1; - return res; - } - void fix_num_length_and_dec(); - void update_used_tables() - { - /* - TODO: Make a member in UDF_INIT and return if a UDF is deterministic or - not. - Currently UDF_INIT has a member (const_item) that is an in/out - parameter to the init() call. - The code in udf_handler::fix_fields also duplicates the arguments - handling code in Item_func::fix_fields(). - - The lack of information if a UDF is deterministic makes writing - a correct update_used_tables() for UDFs impossible. - One solution to this would be : - - Add a is_deterministic member of UDF_INIT - - (optionally) deprecate the const_item member of UDF_INIT - - Take away the duplicate code from udf_handler::fix_fields() and - make Item_udf_func call Item_func::fix_fields() to process its - arguments as for any other function. - - Store the deterministic flag returned by _init into the - udf_handler. - - Don't implement Item_udf_func::fix_fields, implement - Item_udf_func::fix_length_and_dec() instead (similar to non-UDF - functions). - - Override Item_func::update_used_tables to call - Item_func::update_used_tables() and add a RAND_TABLE_BIT to the - result of Item_func::update_used_tables() if the UDF is - non-deterministic. - - (optionally) rename RAND_TABLE_BIT to NONDETERMINISTIC_BIT to - better describe its usage. - - The above would require a change of the UDF API. - Until that change is done here's how the current code works: - We call Item_func::update_used_tables() only when we know that - the function depends on real non-const tables and is deterministic. - This can be done only because we know that the optimizer will - call update_used_tables() only when there's possibly a new const - table. So update_used_tables() can only make a Item_func more - constant than it is currently. - That's why we don't need to do anything if a function is guaranteed - to return non-constant (it's non-deterministic) or is already a - const. - */ - if ((used_tables_cache & ~PSEUDO_TABLE_BITS) && - !(used_tables_cache & RAND_TABLE_BIT)) - { - Item_func::update_used_tables(); - set_non_deterministic_if_needed(); - } - } - void cleanup(); - bool eval_not_null_tables(void *opt_arg) - { - not_null_tables_cache= 0; - return 0; - } - bool find_not_null_fields(table_map allowed) - { - return false; - } - bool is_expensive() { return 1; } - virtual void print(String *str, enum_query_type query_type); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } - bool excl_dep_on_grouping_fields(st_select_lex *sel) - { return false; } -}; - - -class Item_func_udf_float :public Item_udf_func -{ - public: - Item_func_udf_float(THD *thd, udf_func *udf_arg): - Item_udf_func(thd, udf_arg) {} - Item_func_udf_float(THD *thd, udf_func *udf_arg, - List &list): - Item_udf_func(thd, udf_arg, list) {} - longlong val_int() - { - DBUG_ASSERT(fixed == 1); - return Converter_double_to_longlong(Item_func_udf_float::val_real(), - unsigned_flag).result(); - } - my_decimal *val_decimal(my_decimal *dec_buf) - { - double res=val_real(); - if (null_value) - return NULL; - double2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf); - return dec_buf; - } - double val_real(); - String *val_str(String *str); - const Type_handler *type_handler() const { return &type_handler_double; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_udf_int :public Item_udf_func -{ -public: - Item_func_udf_int(THD *thd, udf_func *udf_arg): - Item_udf_func(thd, udf_arg) {} - Item_func_udf_int(THD *thd, udf_func *udf_arg, - List &list): - Item_udf_func(thd, udf_arg, list) {} - longlong val_int(); - double val_real() { return (double) Item_func_udf_int::val_int(); } - my_decimal *val_decimal(my_decimal *decimal_value) - { - return val_decimal_from_int(decimal_value); - } - String *val_str(String *str); - const Type_handler *type_handler() const - { - if (unsigned_flag) - return &type_handler_ulonglong; - return &type_handler_slonglong; - } - bool fix_length_and_dec() { decimals= 0; max_length= 21; return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_udf_decimal :public Item_udf_func -{ -public: - Item_func_udf_decimal(THD *thd, udf_func *udf_arg): - Item_udf_func(thd, udf_arg) {} - Item_func_udf_decimal(THD *thd, udf_func *udf_arg, List &list): - Item_udf_func(thd, udf_arg, list) {} - longlong val_int() - { - return VDec_udf(this, &udf).to_longlong(unsigned_flag); - } - double val_real() - { - return VDec_udf(this, &udf).to_double(); - } - my_decimal *val_decimal(my_decimal *); - String *val_str(String *str) - { - return VDec_udf(this, &udf).to_string_round(str, decimals); - } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_udf_str :public Item_udf_func -{ -public: - Item_func_udf_str(THD *thd, udf_func *udf_arg): - Item_udf_func(thd, udf_arg) {} - Item_func_udf_str(THD *thd, udf_func *udf_arg, List &list): - Item_udf_func(thd, udf_arg, list) {} - String *val_str(String *); - double val_real() - { - int err_not_used; - char *end_not_used; - String *res; - res= val_str(&str_value); - return res ? res->charset()->strntod((char*) res->ptr(), res->length(), - &end_not_used, &err_not_used) : 0.0; - } - longlong val_int() - { - int err_not_used; - String *res; res=val_str(&str_value); - return res ? res->charset()->strntoll(res->ptr(),res->length(),10, - (char**) 0, &err_not_used) : (longlong) 0; - } - my_decimal *val_decimal(my_decimal *dec_buf) - { - String *res=val_str(&str_value); - if (!res) - return NULL; - string2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf); - return dec_buf; - } - const Type_handler *type_handler() const { return string_type_handler(); } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -#else /* Dummy functions to get sql_yacc.cc compiled */ - -class Item_func_udf_float :public Item_real_func -{ - public: - Item_func_udf_float(THD *thd, udf_func *udf_arg): - Item_real_func(thd) {} - Item_func_udf_float(THD *thd, udf_func *udf_arg, List &list): - Item_real_func(thd, list) {} - double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; } -}; - - -class Item_func_udf_int :public Item_int_func -{ -public: - Item_func_udf_int(THD *thd, udf_func *udf_arg): - Item_int_func(thd) {} - Item_func_udf_int(THD *thd, udf_func *udf_arg, List &list): - Item_int_func(thd, list) {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } - longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; } -}; - - -class Item_func_udf_decimal :public Item_int_func -{ -public: - Item_func_udf_decimal(THD *thd, udf_func *udf_arg): - Item_int_func(thd) {} - Item_func_udf_decimal(THD *thd, udf_func *udf_arg, List &list): - Item_int_func(thd, list) {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } - my_decimal *val_decimal(my_decimal *) { DBUG_ASSERT(fixed == 1); return 0; } -}; - - -class Item_func_udf_str :public Item_func -{ -public: - Item_func_udf_str(THD *thd, udf_func *udf_arg): - Item_func(thd) {} - Item_func_udf_str(THD *thd, udf_func *udf_arg, List &list): - Item_func(thd, list) {} - String *val_str(String *) - { DBUG_ASSERT(fixed == 1); null_value=1; return 0; } - double val_real() { DBUG_ASSERT(fixed == 1); null_value= 1; return 0.0; } - longlong val_int() { DBUG_ASSERT(fixed == 1); null_value=1; return 0; } - bool fix_length_and_dec() { maybe_null=1; max_length=0; return FALSE; } -}; - -#endif /* HAVE_DLOPEN */ - -void mysql_ull_cleanup(THD *thd); -void mysql_ull_set_explicit_lock_duration(THD *thd); - - -class Item_func_lock :public Item_long_func -{ - public: - Item_func_lock(THD *thd): Item_long_func(thd) { } - Item_func_lock(THD *thd, Item *a): Item_long_func(thd, a) {} - Item_func_lock(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - table_map used_tables() const - { - return used_tables_cache | RAND_TABLE_BIT; - } - bool const_item() const { return 0; } - bool is_expensive() { return 1; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } -}; - - -class Item_func_get_lock final :public Item_func_lock -{ - bool check_arguments() const - { - return args[0]->check_type_general_purpose_string(func_name()) || - args[1]->check_type_can_return_real(func_name()); - } - String value; - public: - Item_func_get_lock(THD *thd, Item *a, Item *b) :Item_func_lock(thd, a, b) {} - longlong val_int() final; - const char *func_name() const final { return "get_lock"; } - bool fix_length_and_dec() { max_length= 1; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) final - { return get_item_copy(thd, this); } -}; - - -class Item_func_release_all_locks final :public Item_func_lock -{ -public: - Item_func_release_all_locks(THD *thd): Item_func_lock(thd) - { unsigned_flag= 1; } - longlong val_int() final; - const char *func_name() const final { return "release_all_locks"; } - Item *get_copy(THD *thd) final - { return get_item_copy(thd, this); } -}; - - -class Item_func_release_lock final :public Item_func_lock -{ - bool check_arguments() const - { return args[0]->check_type_general_purpose_string(func_name()); } - String value; -public: - Item_func_release_lock(THD *thd, Item *a): Item_func_lock(thd, a) {} - longlong val_int() final; - const char *func_name() const { return "release_lock"; } - bool fix_length_and_dec() { max_length= 1; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) final - { return get_item_copy(thd, this); } -}; - - -/* replication functions */ - -class Item_master_pos_wait :public Item_longlong_func -{ - bool check_arguments() const - { - return - args[0]->check_type_general_purpose_string(func_name()) || - args[1]->check_type_can_return_int(func_name()) || - (arg_count > 2 && args[2]->check_type_can_return_int(func_name())) || - (arg_count > 3 && args[3]->check_type_general_purpose_string(func_name())); - } - String value; -public: - Item_master_pos_wait(THD *thd, Item *a, Item *b) - :Item_longlong_func(thd, a, b) {} - Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c): - Item_longlong_func(thd, a, b, c) {} - Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c, Item *d): - Item_longlong_func(thd, a, b, c, d) {} - longlong val_int(); - const char *func_name() const { return "master_pos_wait"; } - bool fix_length_and_dec() { max_length=21; maybe_null=1; return FALSE; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_master_gtid_wait :public Item_long_func -{ - bool check_arguments() const - { - return args[0]->check_type_general_purpose_string(func_name()) || - (arg_count > 1 && args[1]->check_type_can_return_real(func_name())); - } - String value; -public: - Item_master_gtid_wait(THD *thd, Item *a) - :Item_long_func(thd, a) {} - Item_master_gtid_wait(THD *thd, Item *a, Item *b) - :Item_long_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "master_gtid_wait"; } - bool fix_length_and_dec() { max_length=2; return FALSE; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* Handling of user definable variables */ - -class user_var_entry; - - -/** - A class to set and get user variables -*/ -class Item_func_user_var :public Item_hybrid_func -{ -protected: - user_var_entry *m_var_entry; -public: - LEX_CSTRING name; // keep it public - Item_func_user_var(THD *thd, const LEX_CSTRING *a) - :Item_hybrid_func(thd), m_var_entry(NULL), name(*a) { } - Item_func_user_var(THD *thd, const LEX_CSTRING *a, Item *b) - :Item_hybrid_func(thd, b), m_var_entry(NULL), name(*a) { } - Item_func_user_var(THD *thd, Item_func_user_var *item) - :Item_hybrid_func(thd, item), - m_var_entry(item->m_var_entry), name(item->name) { } - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - DBUG_ASSERT(fixed); - return create_tmp_field_ex_from_handler(root, table, src, param, - type_handler()); - } - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) - { return create_table_field_from_handler(root, table); } - bool check_vcol_func_processor(void *arg); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } -}; - - -class Item_func_set_user_var :public Item_func_user_var -{ - /* - The entry_thread_id variable is used: - 1) to skip unnecessary updates of the entry field (see above); - 2) to reset the entry field that was initialized in the other thread - (for example, an item tree of a trigger that updates user variables - may be shared between several connections, and the entry_thread_id field - prevents updates of one connection user variables from a concurrent - connection calling the same trigger that initially updated some - user variable it the first connection context). - */ - my_thread_id entry_thread_id; - String value; - my_decimal decimal_buff; - bool null_item; - union - { - longlong vint; - double vreal; - String *vstr; - my_decimal *vdec; - } save_result; - -public: - Item_func_set_user_var(THD *thd, const LEX_CSTRING *a, Item *b): - Item_func_user_var(thd, a, b), - entry_thread_id(0) - {} - Item_func_set_user_var(THD *thd, Item_func_set_user_var *item) - :Item_func_user_var(thd, item), - entry_thread_id(item->entry_thread_id), - value(item->value), decimal_buff(item->decimal_buff), - null_item(item->null_item), save_result(item->save_result) - {} - - enum Functype functype() const { return SUSERVAR_FUNC; } - double val_real(); - longlong val_int(); - String *val_str(String *str); - my_decimal *val_decimal(my_decimal *); - double val_result(); - longlong val_int_result(); - bool val_bool_result(); - String *str_result(String *str); - my_decimal *val_decimal_result(my_decimal *); - bool is_null_result(); - bool update_hash(void *ptr, size_t length, enum Item_result type, - CHARSET_INFO *cs, bool unsigned_arg); - bool send(Protocol *protocol, st_value *buffer); - void make_send_field(THD *thd, Send_field *tmp_field); - bool check(bool use_result_field); - void save_item_result(Item *item); - bool update(); - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return ASSIGN_PRECEDENCE; } - void print_as_stmt(String *str, enum_query_type query_type); - const char *func_name() const { return "set_user_var"; } - int save_in_field(Field *field, bool no_conversions, - bool can_use_result_field); - int save_in_field(Field *field, bool no_conversions) - { - return save_in_field(field, no_conversions, 1); - } - void save_org_in_field(Field *field, - fast_field_copier data __attribute__ ((__unused__))) - { (void)save_in_field(field, 1, 0); } - bool register_field_in_read_map(void *arg); - bool register_field_in_bitmap(void *arg); - bool set_entry(THD *thd, bool create_if_not_exists); - void cleanup(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - bool excl_dep_on_table(table_map tab_map) { return false; } -}; - - -class Item_func_get_user_var :public Item_func_user_var, - private Settable_routine_parameter -{ -public: - Item_func_get_user_var(THD *thd, const LEX_CSTRING *a): - Item_func_user_var(thd, a) {} - enum Functype functype() const { return GUSERVAR_FUNC; } - LEX_CSTRING get_name() { return name; } - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal*); - String *val_str(String* str); - bool fix_length_and_dec(); - virtual void print(String *str, enum_query_type query_type); - /* - We must always return variables as strings to guard against selects of type - select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b) - */ - const char *func_name() const { return "get_user_var"; } - bool const_item() const; - table_map used_tables() const - { return const_item() ? 0 : RAND_TABLE_BIT; } - bool eq(const Item *item, bool binary_cmp) const; - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -private: - bool set_value(THD *thd, sp_rcontext *ctx, Item **it); - -public: - Settable_routine_parameter *get_settable_routine_parameter() - { - return this; - } -}; - - -/* - This item represents user variable used as out parameter (e.g in LOAD DATA), - and it is supposed to be used only for this purprose. So it is simplified - a lot. Actually you should never obtain its value. - - The only two reasons for this thing being an Item is possibility to store it - in List and desire to place this code somewhere near other functions - working with user variables. -*/ -class Item_user_var_as_out_param :public Item_fixed_hybrid, - public Load_data_outvar -{ - LEX_CSTRING org_name; - user_var_entry *entry; -public: - Item_user_var_as_out_param(THD *thd, const LEX_CSTRING *a) - :Item_fixed_hybrid(thd) - { - DBUG_ASSERT(a->length < UINT_MAX32); - org_name= *a; - set_name(thd, a->str, a->length, system_charset_info); - } - Load_data_outvar *get_load_data_outvar() - { - return this; - } - bool load_data_set_null(THD *thd, const Load_data_param *param) - { - set_null_value(param->charset()); - return false; - } - bool load_data_set_no_data(THD *thd, const Load_data_param *param) - { - set_null_value(param->charset()); - return false; - } - bool load_data_set_value(THD *thd, const char *pos, uint length, - const Load_data_param *param) - { - set_value(pos, length, param->charset()); - return false; - } - void load_data_print_for_log_event(THD *thd, String *to) const; - bool load_data_add_outvar(THD *thd, Load_data_param *param) const - { - return param->add_outvar_user_var(thd); - } - uint load_data_fixed_length() const - { - return 0; - } - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - DBUG_ASSERT(0); - return NULL; - } - /* We should return something different from FIELD_ITEM here */ - enum Type type() const { return CONST_ITEM;} - double val_real(); - longlong val_int(); - String *val_str(String *str); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - my_decimal *val_decimal(my_decimal *decimal_buffer); - /* fix_fields() binds variable name with its entry structure */ - bool fix_fields(THD *thd, Item **ref); - void set_null_value(CHARSET_INFO* cs); - void set_value(const char *str, uint length, CHARSET_INFO* cs); - const Type_handler *type_handler() const { return &type_handler_double; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* A system variable */ - -#define GET_SYS_VAR_CACHE_LONG 1 -#define GET_SYS_VAR_CACHE_DOUBLE 2 -#define GET_SYS_VAR_CACHE_STRING 4 - -class Item_func_get_system_var :public Item_func -{ - sys_var *var; - enum_var_type var_type, orig_var_type; - LEX_CSTRING component; - longlong cached_llval; - double cached_dval; - String cached_strval; - bool cached_null_value; - query_id_t used_query_id; - uchar cache_present; - -public: - Item_func_get_system_var(THD *thd, sys_var *var_arg, - enum_var_type var_type_arg, - LEX_CSTRING *component_arg, const char *name_arg, - size_t name_len_arg); - enum Functype functype() const { return GSYSVAR_FUNC; } - void update_null_value(); - bool fix_length_and_dec(); - void print(String *str, enum_query_type query_type); - bool const_item() const { return true; } - table_map used_tables() const { return 0; } - const Type_handler *type_handler() const; - double val_real(); - longlong val_int(); - String* val_str(String*); - my_decimal *val_decimal(my_decimal *dec_buf) - { return val_decimal_from_real(dec_buf); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } - /* TODO: fix to support views */ - const char *func_name() const { return "get_system_var"; } - /** - Indicates whether this system variable is written to the binlog or not. - - Variables are written to the binlog as part of "status_vars" in - Query_log_event, as an Intvar_log_event, or a Rand_log_event. - - @return true if the variable is written to the binlog, false otherwise. - */ - bool is_written_to_binlog(); - bool eq(const Item *item, bool binary_cmp) const; - - void cleanup(); - bool check_vcol_func_processor(void *arg); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* for fulltext search */ - -class Item_func_match :public Item_real_func -{ -public: - uint key, flags; - bool join_key; - DTCollation cmp_collation; - FT_INFO *ft_handler; - TABLE *table; - Item_func_match *master; // for master-slave optimization - Item *concat_ws; // Item_func_concat_ws - String value; // value of concat_ws - String search_value; // key_item()'s value converted to cmp_collation - - Item_func_match(THD *thd, List &a, uint b): - Item_real_func(thd, a), key(0), flags(b), join_key(0), ft_handler(0), - table(0), master(0), concat_ws(0) { } - void cleanup() - { - DBUG_ENTER("Item_func_match::cleanup"); - Item_real_func::cleanup(); - if (!master && ft_handler) - ft_handler->please->close_search(ft_handler); - ft_handler= 0; - concat_ws= 0; - table= 0; // required by Item_func_match::eq() - DBUG_VOID_RETURN; - } - bool is_expensive_processor(void *arg) { return TRUE; } - enum Functype functype() const { return FT_FUNC; } - const char *func_name() const { return "match"; } - bool eval_not_null_tables(void *opt_arg) - { - not_null_tables_cache= 0; - return 0; - } - bool find_not_null_fields(table_map allowed) - { - return false; - } - bool fix_fields(THD *thd, Item **ref); - bool eq(const Item *, bool binary_cmp) const; - /* The following should be safe, even if we compare doubles */ - longlong val_int() { DBUG_ASSERT(fixed == 1); return val_real() != 0.0; } - double val_real(); - virtual void print(String *str, enum_query_type query_type); - - bool fix_index(); - bool init_search(THD *thd, bool no_order); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function("match ... against()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *build_clone(THD *thd) { return 0; } -private: - /** - Check whether storage engine for given table, - allows FTS Boolean search on non-indexed columns. - - @todo A flag should be added to the extended fulltext API so that - it may be checked whether search on non-indexed columns are - supported. Currently, it is not possible to check for such a - flag since @c this->ft_handler is not yet set when this function is - called. The current hack is to assume that search on non-indexed - columns are supported for engines that does not support the extended - fulltext API (e.g., MyISAM), while it is not supported for other - engines (e.g., InnoDB) - - @param table_arg Table for which storage engine to check - - @retval true if BOOLEAN search on non-indexed columns is supported - @retval false otherwise - */ - bool allows_search_on_non_indexed_columns(TABLE* table_arg) - { - // Only Boolean search may support non_indexed columns - if (!(flags & FT_BOOL)) - return false; - - DBUG_ASSERT(table_arg && table_arg->file); - - // Assume that if extended fulltext API is not supported, - // non-indexed columns are allowed. This will be true for MyISAM. - if ((table_arg->file->ha_table_flags() & HA_CAN_FULLTEXT_EXT) == 0) - return true; - - return false; - } -}; - - -class Item_func_bit_xor : public Item_func_bit_operator -{ -public: - Item_func_bit_xor(THD *thd, Item *a, Item *b) - :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "^"; } - enum precedence precedence() const { return BITXOR_PRECEDENCE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_is_free_lock :public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_general_purpose_string(func_name()); } - String value; -public: - Item_func_is_free_lock(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "is_free_lock"; } - bool fix_length_and_dec() - { - decimals=0; max_length=1; maybe_null=1; - return FALSE; - } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_is_used_lock :public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_general_purpose_string(func_name()); } - String value; -public: - Item_func_is_used_lock(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "is_used_lock"; } - bool fix_length_and_dec() - { - decimals=0; max_length=10; maybe_null=1; - return FALSE; - } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -struct Lex_cast_type_st: public Lex_length_and_dec_st -{ -private: - const Type_handler *m_type_handler; -public: - void set(const Type_handler *handler, const char *length, const char *dec) - { - m_type_handler= handler; - Lex_length_and_dec_st::set(length, dec); - } - void set(const Type_handler *handler, Lex_length_and_dec_st length_and_dec) - { - m_type_handler= handler; - Lex_length_and_dec_st::operator=(length_and_dec); - } - void set(const Type_handler *handler, const char *length) - { - set(handler, length, 0); - } - void set(const Type_handler *handler) - { - set(handler, 0, 0); - } - const Type_handler *type_handler() const { return m_type_handler; } - Item *create_typecast_item(THD *thd, Item *item, - CHARSET_INFO *cs= NULL) const - { - return m_type_handler-> - create_typecast_item(thd, item, - Type_cast_attributes(length(), dec(), cs)); - } - Item *create_typecast_item_or_error(THD *thd, Item *item, - CHARSET_INFO *cs= NULL) const; -}; - - -class Item_func_row_count :public Item_longlong_func -{ -public: - Item_func_row_count(THD *thd): Item_longlong_func(thd) {} - longlong val_int(); - const char *func_name() const { return "row_count"; } - bool fix_length_and_dec() { decimals= 0; maybe_null=0; return FALSE; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - * - * Stored FUNCTIONs - * - */ - -class Item_func_sp :public Item_func, - public Item_sp -{ -private: - const Sp_handler *m_handler; - - bool execute(); - -protected: - bool is_expensive_processor(void *arg) - { return is_expensive(); } - - bool check_arguments() const - { - // sp_prepare_func_item() checks that the number of columns is correct - return false; - } -public: - - Item_func_sp(THD *thd, Name_resolution_context *context_arg, - sp_name *name, const Sp_handler *sph); - - Item_func_sp(THD *thd, Name_resolution_context *context_arg, - sp_name *name, const Sp_handler *sph, List &list); - - virtual ~Item_func_sp() - {} - - void update_used_tables(); - - void cleanup(); - - const char *func_name() const; - - const Type_handler *type_handler() const; - - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param); - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) - { - return result_type() != STRING_RESULT ? - sp_result_field : - create_table_field_from_handler(root, table); - } - void make_send_field(THD *thd, Send_field *tmp_field); - - longlong val_int() - { - if (execute()) - return (longlong) 0; - return sp_result_field->val_int(); - } - - double val_real() - { - if (execute()) - return 0.0; - return sp_result_field->val_real(); - } - - my_decimal *val_decimal(my_decimal *dec_buf) - { - if (execute()) - return NULL; - return sp_result_field->val_decimal(dec_buf); - } - - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - if (execute()) - return true; - return sp_result_field->get_date(ltime, fuzzydate); - } - - String *val_str(String *str) - { - String buf; - char buff[20]; - buf.set(buff, 20, str->charset()); - buf.length(0); - if (execute()) - return NULL; - /* - result_field will set buf pointing to internal buffer - of the resul_field. Due to this it will change any time - when SP is executed. In order to prevent occasional - corruption of returned value, we make here a copy. - */ - sp_result_field->val_str(&buf); - str->copy(buf); - return str; - } - - bool val_native(THD *thd, Native *to) - { - if (execute()) - return true; - return null_value= sp_result_field->val_native(to); - } - - void update_null_value() - { - execute(); - } - - virtual bool change_context_processor(void *cntx) - { context= (Name_resolution_context *)cntx; return FALSE; } - - virtual enum Functype functype() const { return FUNC_SP; } - - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(void); - bool is_expensive(); - - inline Field *get_sp_result_field() - { - return sp_result_field; - } - const sp_name *get_sp_name() const - { - return m_name; - } - - bool check_vcol_func_processor(void *arg); - bool limit_index_condition_pushdown_processor(void *opt_arg) - { - return TRUE; - } - Item *get_copy(THD *) { return 0; } - bool eval_not_null_tables(void *opt_arg) - { - not_null_tables_cache= 0; - return 0; - } - bool excl_dep_on_grouping_fields(st_select_lex *sel) - { return false; } - bool find_not_null_fields(table_map allowed) - { - return false; - } -}; - - -class Item_func_found_rows :public Item_longlong_func -{ -public: - Item_func_found_rows(THD *thd): Item_longlong_func(thd) {} - longlong val_int(); - const char *func_name() const { return "found_rows"; } - bool fix_length_and_dec() { decimals= 0; maybe_null=0; return FALSE; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_oracle_sql_rowcount :public Item_longlong_func -{ -public: - Item_func_oracle_sql_rowcount(THD *thd): Item_longlong_func(thd) {} - longlong val_int(); - const char *func_name() const { return "SQL%ROWCOUNT"; } - void print(String *str, enum_query_type query_type) - { - str->append(func_name()); - } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_sqlcode: public Item_long_func -{ -public: - Item_func_sqlcode(THD *thd): Item_long_func(thd) { } - longlong val_int(); - const char *func_name() const { return "SQLCODE"; } - void print(String *str, enum_query_type query_type) - { - str->append(func_name()); - } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - bool fix_length_and_dec() - { - maybe_null= null_value= false; - max_length= 11; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -void uuid_short_init(); - -class Item_func_uuid_short :public Item_longlong_func -{ -public: - Item_func_uuid_short(THD *thd): Item_longlong_func(thd) {} - const char *func_name() const { return "uuid_short"; } - longlong val_int(); - bool const_item() const { return false; } - bool fix_length_and_dec() - { max_length= 21; unsigned_flag=1; return FALSE; } - table_map used_tables() const { return RAND_TABLE_BIT; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_last_value :public Item_func -{ -protected: - Item *last_value; -public: - Item_func_last_value(THD *thd, List &list): Item_func(thd, list) {} - double val_real(); - longlong val_int(); - String *val_str(String *); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *); - bool fix_length_and_dec(); - const char *func_name() const { return "last_value"; } - const Type_handler *type_handler() const { return last_value->type_handler(); } - bool eval_not_null_tables(void *) - { - not_null_tables_cache= 0; - return 0; - } - bool find_not_null_fields(table_map allowed) - { - return false; - } - bool const_item() const { return 0; } - void evaluate_sideeffects(); - void update_used_tables() - { - Item_func::update_used_tables(); - maybe_null= last_value->maybe_null; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* Implementation for sequences: NEXT VALUE FOR sequence and NEXTVAL() */ - -class Item_func_nextval :public Item_longlong_func -{ -protected: - TABLE_LIST *table_list; - TABLE *table; -public: - Item_func_nextval(THD *thd, TABLE_LIST *table_list_arg): - Item_longlong_func(thd), table_list(table_list_arg) {} - longlong val_int(); - const char *func_name() const { return "nextval"; } - bool fix_length_and_dec() - { - unsigned_flag= 0; - max_length= MAX_BIGINT_WIDTH; - maybe_null= 1; /* In case of errors */ - return FALSE; - } - /* - update_table() function must be called during the value function - as in case of DEFAULT the sequence table may not yet be open - while fix_fields() are called - */ - void update_table() - { - if (!(table= table_list->table)) - { - /* - If nextval was used in DEFAULT then next_local points to - the table_list used by to open the sequence table - */ - table= table_list->next_local->table; - } - } - bool const_item() const { return 0; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - void print(String *str, enum_query_type query_type); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, - (VCOL_NON_DETERMINISTIC | - VCOL_NOT_VIRTUAL)); - } -}; - - -/* Implementation for sequences: LASTVAL(sequence), PostgreSQL style */ - -class Item_func_lastval :public Item_func_nextval -{ -public: - Item_func_lastval(THD *thd, TABLE_LIST *table_list_arg): - Item_func_nextval(thd, table_list_arg) {} - longlong val_int(); - const char *func_name() const { return "lastval"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* Implementation for sequences: SETVAL(sequence), PostgreSQL style */ - -class Item_func_setval :public Item_func_nextval -{ - longlong nextval; - ulonglong round; - bool is_used; -public: - Item_func_setval(THD *thd, TABLE_LIST *table_list_arg, longlong nextval_arg, - ulonglong round_arg, bool is_used_arg) - : Item_func_nextval(thd, table_list_arg), - nextval(nextval_arg), round(round_arg), is_used(is_used_arg) - {} - longlong val_int(); - const char *func_name() const { return "setval"; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -Item *get_system_var(THD *thd, enum_var_type var_type, - const LEX_CSTRING *name, const LEX_CSTRING *component); -extern bool check_reserved_words(const LEX_CSTRING *name); -double my_double_round(double value, longlong dec, bool dec_unsigned, - bool truncate); - -extern bool volatile mqh_used; - -bool update_hash(user_var_entry *entry, bool set_null, void *ptr, size_t length, - Item_result type, CHARSET_INFO *cs, - bool unsigned_arg); - -#endif /* ITEM_FUNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_geofunc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_geofunc.h deleted file mode 100644 index c38d0b9..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_geofunc.h +++ /dev/null @@ -1,1109 +0,0 @@ -#ifndef ITEM_GEOFUNC_INCLUDED -#define ITEM_GEOFUNC_INCLUDED - -/* Copyright (c) 2000, 2016 Oracle and/or its affiliates. - Copyright (C) 2011, 2016, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* This file defines all spatial functions */ - -#ifdef HAVE_SPATIAL - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_type_geom.h" -#include "item.h" -#include "gstream.h" -#include "spatial.h" -#include "gcalc_slicescan.h" -#include "gcalc_tools.h" - -class Item_geometry_func: public Item_str_func -{ -public: - Item_geometry_func(THD *thd): Item_str_func(thd) {} - Item_geometry_func(THD *thd, Item *a): Item_str_func(thd, a) {} - Item_geometry_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - Item_geometry_func(THD *thd, Item *a, Item *b, Item *c): - Item_str_func(thd, a, b, c) {} - Item_geometry_func(THD *thd, List &list): Item_str_func(thd, list) {} - bool fix_length_and_dec(); - const Type_handler *type_handler() const { return &type_handler_geometry; } -}; - - -/* - Functions returning REAL measurements of a single GEOMETRY argument -*/ -class Item_real_func_args_geometry: public Item_real_func -{ -protected: - String value; - bool check_arguments() const - { - DBUG_ASSERT(arg_count == 1); - return Type_handler_geometry::check_type_geom_or_binary(func_name(), - args[0]); - } -public: - Item_real_func_args_geometry(THD *thd, Item *a) - :Item_real_func(thd, a) {} -}; - - -/* - Functions returning INT measurements of a single GEOMETRY argument -*/ -class Item_long_func_args_geometry: public Item_long_func -{ - bool check_arguments() const - { - DBUG_ASSERT(arg_count == 1); - return Type_handler_geometry::check_type_geom_or_binary(func_name(), - args[0]); - } -protected: - String value; -public: - Item_long_func_args_geometry(THD *thd, Item *a) - :Item_long_func(thd, a) {} -}; - - -/* - Functions returning BOOL measurements of a single GEOMETRY argument -*/ -class Item_bool_func_args_geometry: public Item_bool_func -{ -protected: - String value; - bool check_arguments() const - { - DBUG_ASSERT(arg_count == 1); - return Type_handler_geometry::check_type_geom_or_binary(func_name(), - args[0]); - } -public: - Item_bool_func_args_geometry(THD *thd, Item *a) - :Item_bool_func(thd, a) {} -}; - - -/* - Functions returning ASCII string measurements of a single GEOMETRY argument -*/ -class Item_str_ascii_func_args_geometry: public Item_str_ascii_func -{ -protected: - bool check_arguments() const - { - DBUG_ASSERT(arg_count >= 1); - return Type_handler_geometry::check_type_geom_or_binary(func_name(), - args[0]); - } -public: - Item_str_ascii_func_args_geometry(THD *thd, Item *a) - :Item_str_ascii_func(thd, a) {} - Item_str_ascii_func_args_geometry(THD *thd, Item *a, Item *b) - :Item_str_ascii_func(thd, a, b) {} - Item_str_ascii_func_args_geometry(THD *thd, Item *a, Item *b, Item *c) - :Item_str_ascii_func(thd, a, b, c) {} -}; - - -/* - Functions returning binary string measurements of a single GEOMETRY argument -*/ -class Item_binary_func_args_geometry: public Item_str_func -{ -protected: - bool check_arguments() const - { - DBUG_ASSERT(arg_count >= 1); - return Type_handler_geometry::check_type_geom_or_binary(func_name(), - args[0]); - } -public: - Item_binary_func_args_geometry(THD *thd, Item *a) - :Item_str_func(thd, a) {} -}; - - -/* - Functions returning GEOMETRY measurements of a single GEOEMETRY argument -*/ -class Item_geometry_func_args_geometry: public Item_geometry_func -{ -protected: - bool check_arguments() const - { - DBUG_ASSERT(arg_count >= 1); - return Type_handler_geometry::check_type_geom_or_binary(func_name(), - args[0]); - } -public: - Item_geometry_func_args_geometry(THD *thd, Item *a) - :Item_geometry_func(thd, a) {} - Item_geometry_func_args_geometry(THD *thd, Item *a, Item *b) - :Item_geometry_func(thd, a, b) {} -}; - - -/* - Functions returning REAL result relationships between two GEOMETRY arguments -*/ -class Item_real_func_args_geometry_geometry: public Item_real_func -{ -protected: - bool check_arguments() const - { - DBUG_ASSERT(arg_count >= 2); - return Type_handler_geometry::check_types_geom_or_binary(func_name(), - args, 0, 2); - } -public: - Item_real_func_args_geometry_geometry(THD *thd, Item *a, Item *b) - :Item_real_func(thd, a, b) {} -}; - - -/* - Functions returning BOOL result relationships between two GEOMETRY arguments -*/ -class Item_bool_func_args_geometry_geometry: public Item_bool_func -{ -protected: - String value; - bool check_arguments() const - { - DBUG_ASSERT(arg_count >= 2); - return Type_handler_geometry::check_types_geom_or_binary(func_name(), - args, 0, 2); - } -public: - Item_bool_func_args_geometry_geometry(THD *thd, Item *a, Item *b, Item *c) - :Item_bool_func(thd, a, b, c) {} -}; - - -class Item_func_geometry_from_text: public Item_geometry_func -{ - bool check_arguments() const - { - return args[0]->check_type_general_purpose_string(func_name()) || - check_argument_types_can_return_int(1, MY_MIN(2, arg_count)); - } -public: - Item_func_geometry_from_text(THD *thd, Item *a): Item_geometry_func(thd, a) {} - Item_func_geometry_from_text(THD *thd, Item *a, Item *srid): - Item_geometry_func(thd, a, srid) {} - const char *func_name() const { return "st_geometryfromtext"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_geometry_from_wkb: public Item_geometry_func -{ - bool check_arguments() const - { - return - Type_handler_geometry::check_type_geom_or_binary(func_name(), args[0]) || - check_argument_types_can_return_int(1, MY_MIN(2, arg_count)); - } -public: - Item_func_geometry_from_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {} - Item_func_geometry_from_wkb(THD *thd, Item *a, Item *srid): - Item_geometry_func(thd, a, srid) {} - const char *func_name() const { return "st_geometryfromwkb"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_geometry_from_json: public Item_geometry_func -{ - String tmp_js; - bool check_arguments() const - { - // TODO: check with Alexey, for better args[1] and args[2] type control - return args[0]->check_type_general_purpose_string(func_name()) || - check_argument_types_traditional_scalar(1, MY_MIN(3, arg_count)); - } -public: - Item_func_geometry_from_json(THD *thd, Item *js): Item_geometry_func(thd, js) {} - Item_func_geometry_from_json(THD *thd, Item *js, Item *opt): - Item_geometry_func(thd, js, opt) {} - Item_func_geometry_from_json(THD *thd, Item *js, Item *opt, Item *srid): - Item_geometry_func(thd, js, opt, srid) {} - const char *func_name() const { return "st_geomfromgeojson"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_as_wkt: public Item_str_ascii_func_args_geometry -{ -public: - Item_func_as_wkt(THD *thd, Item *a) - :Item_str_ascii_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_astext"; } - String *val_str_ascii(String *); - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_as_wkb: public Item_binary_func_args_geometry -{ -public: - Item_func_as_wkb(THD *thd, Item *a) - :Item_binary_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_aswkb"; } - String *val_str(String *); - const Type_handler *type_handler() const { return &type_handler_long_blob; } - bool fix_length_and_dec() - { - collation.set(&my_charset_bin); - decimals=0; - max_length= (uint32) UINT_MAX32; - maybe_null= 1; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_as_geojson: public Item_str_ascii_func_args_geometry -{ - bool check_arguments() const - { - // TODO: check with Alexey, for better args[1] and args[2] type control - return Item_str_ascii_func_args_geometry::check_arguments() || - check_argument_types_traditional_scalar(1, MY_MIN(3, arg_count)); - } -public: - Item_func_as_geojson(THD *thd, Item *js) - :Item_str_ascii_func_args_geometry(thd, js) {} - Item_func_as_geojson(THD *thd, Item *js, Item *max_dec_digits) - :Item_str_ascii_func_args_geometry(thd, js, max_dec_digits) {} - Item_func_as_geojson(THD *thd, Item *js, Item *max_dec_digits, Item *opt) - :Item_str_ascii_func_args_geometry(thd, js, max_dec_digits, opt) {} - const char *func_name() const { return "st_asgeojson"; } - bool fix_length_and_dec(); - String *val_str_ascii(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_geometry_type: public Item_str_ascii_func_args_geometry -{ -public: - Item_func_geometry_type(THD *thd, Item *a) - :Item_str_ascii_func_args_geometry(thd, a) {} - String *val_str_ascii(String *); - const char *func_name() const { return "st_geometrytype"; } - bool fix_length_and_dec() - { - // "GeometryCollection" is the longest - fix_length_and_charset(20, default_charset()); - maybe_null= 1; - return FALSE; - }; - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -// #define HEAVY_CONVEX_HULL -class Item_func_convexhull: public Item_geometry_func_args_geometry -{ - class ch_node: public Gcalc_dyn_list::Item - { - public: - const Gcalc_heap::Info *pi; - ch_node *prev; - Gcalc_dyn_list::Item *next; - ch_node *get_next() { return (ch_node *) next; } - }; - - Gcalc_heap collector; - Gcalc_function func; - Gcalc_dyn_list res_heap; - - Gcalc_result_receiver res_receiver; - String tmp_value; -#ifdef HEAVY_CONVEX_HULL - Gcalc_scan_iterator scan_it; -#endif /*HEAVY_CONVEX_HULL*/ - ch_node *new_ch_node() { return (ch_node *) res_heap.new_item(); } - int add_node_to_line(ch_node **p_cur, int dir, const Gcalc_heap::Info *pi); -public: - Item_func_convexhull(THD *thd, Item *a) - :Item_geometry_func_args_geometry(thd, a), - res_heap(8192, sizeof(ch_node)) - {} - const char *func_name() const { return "st_convexhull"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_centroid: public Item_geometry_func_args_geometry -{ -public: - Item_func_centroid(THD *thd, Item *a) - :Item_geometry_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_centroid"; } - String *val_str(String *); - const Type_handler *type_handler() const - { - return &type_handler_point; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_envelope: public Item_geometry_func_args_geometry -{ -public: - Item_func_envelope(THD *thd, Item *a) - :Item_geometry_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_envelope"; } - String *val_str(String *); - const Type_handler *type_handler() const - { - return &type_handler_polygon; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_boundary: public Item_geometry_func_args_geometry -{ - class Transporter : public Gcalc_shape_transporter - { - Gcalc_result_receiver *m_receiver; - uint n_points; - Gcalc_function::shape_type current_type; - double last_x, last_y; - public: - Transporter(Gcalc_result_receiver *receiver) : - Gcalc_shape_transporter(NULL), m_receiver(receiver) - {} - int single_point(double x, double y); - int start_line(); - int complete_line(); - int start_poly(); - int complete_poly(); - int start_ring(); - int complete_ring(); - int add_point(double x, double y); - - int start_collection(int n_objects); - }; - Gcalc_result_receiver res_receiver; -public: - Item_func_boundary(THD *thd, Item *a) - :Item_geometry_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_boundary"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_point: public Item_geometry_func -{ - bool check_arguments() const - { return check_argument_types_can_return_real(0, 2); } -public: - Item_func_point(THD *thd, Item *a, Item *b): Item_geometry_func(thd, a, b) {} - Item_func_point(THD *thd, Item *a, Item *b, Item *srid): - Item_geometry_func(thd, a, b, srid) {} - const char *func_name() const { return "point"; } - String *val_str(String *); - const Type_handler *type_handler() const - { - return &type_handler_point; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_spatial_decomp: public Item_geometry_func_args_geometry -{ - enum Functype decomp_func; -public: - Item_func_spatial_decomp(THD *thd, Item *a, Item_func::Functype ft): - Item_geometry_func_args_geometry(thd, a) { decomp_func = ft; } - const char *func_name() const - { - switch (decomp_func) - { - case SP_STARTPOINT: - return "st_startpoint"; - case SP_ENDPOINT: - return "st_endpoint"; - case SP_EXTERIORRING: - return "st_exteriorring"; - default: - DBUG_ASSERT(0); // Should never happened - return "spatial_decomp_unknown"; - } - } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_spatial_decomp_n: public Item_geometry_func_args_geometry -{ - enum Functype decomp_func_n; - bool check_arguments() const - { - return Item_geometry_func_args_geometry::check_arguments() || - args[1]->check_type_can_return_int(func_name()); - } -public: - Item_func_spatial_decomp_n(THD *thd, Item *a, Item *b, Item_func::Functype ft) - :Item_geometry_func_args_geometry(thd, a, b), - decomp_func_n(ft) - { } - const char *func_name() const - { - switch (decomp_func_n) - { - case SP_POINTN: - return "st_pointn"; - case SP_GEOMETRYN: - return "st_geometryn"; - case SP_INTERIORRINGN: - return "st_interiorringn"; - default: - DBUG_ASSERT(0); // Should never happened - return "spatial_decomp_n_unknown"; - } - } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_spatial_collection: public Item_geometry_func -{ - bool check_arguments() const - { - return Type_handler_geometry::check_types_geom_or_binary(func_name(), args, - 0, arg_count); - } - enum Geometry::wkbType coll_type; - enum Geometry::wkbType item_type; -public: - Item_func_spatial_collection(THD *thd, - List &list, enum Geometry::wkbType ct, enum Geometry::wkbType it): - Item_geometry_func(thd, list) - { - coll_type=ct; - item_type=it; - } - String *val_str(String *); - bool fix_length_and_dec() - { - if (Item_geometry_func::fix_length_and_dec()) - return TRUE; - for (unsigned int i= 0; i < arg_count; ++i) - { - if (args[i]->is_fixed() && args[i]->field_type() != MYSQL_TYPE_GEOMETRY) - { - String str; - args[i]->print(&str, QT_NO_DATA_EXPANSION); - str.append('\0'); - my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "non geometric", - str.ptr()); - return TRUE; - } - } - return FALSE; - } -}; - - -class Item_func_geometrycollection: public Item_func_spatial_collection -{ -public: - Item_func_geometrycollection(THD *thd, List &list) - :Item_func_spatial_collection(thd, list, - Geometry::wkb_geometrycollection, - Geometry::wkb_point) - { } - const Type_handler *type_handler() const - { - return &type_handler_geometrycollection; - } - const char *func_name() const { return "geometrycollection"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_linestring: public Item_func_spatial_collection -{ -public: - Item_func_linestring(THD *thd, List &list) - :Item_func_spatial_collection(thd, list, - Geometry::wkb_linestring, - Geometry::wkb_point) - { } - const Type_handler *type_handler() const { return &type_handler_linestring; } - const char *func_name() const { return "linestring"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_polygon: public Item_func_spatial_collection -{ -public: - Item_func_polygon(THD *thd, List &list) - :Item_func_spatial_collection(thd, list, - Geometry::wkb_polygon, - Geometry::wkb_linestring) - { } - const Type_handler *type_handler() const { return &type_handler_polygon; } - const char *func_name() const { return "polygon"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_multilinestring: public Item_func_spatial_collection -{ -public: - Item_func_multilinestring(THD *thd, List &list) - :Item_func_spatial_collection(thd, list, - Geometry::wkb_multilinestring, - Geometry::wkb_linestring) - { } - const Type_handler *type_handler() const - { - return &type_handler_multilinestring; - } - const char *func_name() const { return "multilinestring"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_multipoint: public Item_func_spatial_collection -{ -public: - Item_func_multipoint(THD *thd, List &list) - :Item_func_spatial_collection(thd, list, - Geometry::wkb_multipoint, - Geometry::wkb_point) - { } - const Type_handler *type_handler() const - { - return &type_handler_multipoint; - } - const char *func_name() const { return "multipoint"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_multipolygon: public Item_func_spatial_collection -{ -public: - Item_func_multipolygon(THD *thd, List &list) - :Item_func_spatial_collection(thd, list, - Geometry::wkb_multipolygon, - Geometry::wkb_polygon) - { } - const Type_handler *type_handler() const - { - return &type_handler_multipolygon; - } - const char *func_name() const { return "multipolygon"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - - -/* - Spatial relations -*/ - -class Item_func_spatial_rel: public Item_bool_func2_with_rev -{ -protected: - enum Functype spatial_rel; - String tmp_value1, tmp_value2; - SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, - KEY_PART *key_part, - Item_func::Functype type, Item *value); - bool check_arguments() const - { - DBUG_ASSERT(arg_count >= 2); - return Type_handler_geometry::check_types_geom_or_binary(func_name(), - args, 0, 2); - } -public: - Item_func_spatial_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel): - Item_bool_func2_with_rev(thd, a, b), spatial_rel(sp_rel) - { - maybe_null= true; - } - enum Functype functype() const { return spatial_rel; } - enum Functype rev_functype() const - { - switch (spatial_rel) - { - case SP_CONTAINS_FUNC: - return SP_WITHIN_FUNC; - case SP_WITHIN_FUNC: - return SP_CONTAINS_FUNC; - default: - return spatial_rel; - } - } - bool is_null() { (void) val_int(); return null_value; } - void add_key_fields(JOIN *join, KEY_FIELD **key_fields, - uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables) - { - return add_key_fields_optimize_op(join, key_fields, and_level, - usable_tables, sargables, false); - } - bool need_parentheses_in_default() { return false; } - Item *build_clone(THD *thd) { return 0; } -}; - - -class Item_func_spatial_mbr_rel: public Item_func_spatial_rel -{ -public: - Item_func_spatial_mbr_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel): - Item_func_spatial_rel(thd, a, b, sp_rel) - { } - longlong val_int(); - const char *func_name() const; - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_spatial_precise_rel: public Item_func_spatial_rel -{ - Gcalc_heap collector; - Gcalc_scan_iterator scan_it; - Gcalc_function func; -public: - Item_func_spatial_precise_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel): - Item_func_spatial_rel(thd, a, b, sp_rel), collector() - { } - longlong val_int(); - const char *func_name() const; - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_spatial_relate: public Item_bool_func_args_geometry_geometry -{ - Gcalc_heap collector; - Gcalc_scan_iterator scan_it; - Gcalc_function func; - String tmp_value1, tmp_value2, tmp_matrix; - bool check_arguments() const - { - return Item_bool_func_args_geometry_geometry::check_arguments() || - args[2]->check_type_general_purpose_string(func_name()); - } -public: - Item_func_spatial_relate(THD *thd, Item *a, Item *b, Item *matrix): - Item_bool_func_args_geometry_geometry(thd, a, b, matrix) - { } - longlong val_int(); - const char *func_name() const { return "st_relate"; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - Spatial operations -*/ - -class Item_func_spatial_operation: public Item_geometry_func -{ - bool check_arguments() const - { - DBUG_ASSERT(arg_count >= 2); - return Type_handler_geometry::check_types_geom_or_binary(func_name(), - args, 0, 2); - } -public: - Gcalc_function::op_type spatial_op; - Gcalc_heap collector; - Gcalc_function func; - - Gcalc_result_receiver res_receiver; - Gcalc_operation_reducer operation; - String tmp_value1,tmp_value2; -public: - Item_func_spatial_operation(THD *thd, Item *a,Item *b, - Gcalc_function::op_type sp_op): - Item_geometry_func(thd, a, b), spatial_op(sp_op) - {} - virtual ~Item_func_spatial_operation(); - String *val_str(String *); - const char *func_name() const; - virtual inline void print(String *str, enum_query_type query_type) - { - Item_func::print(str, query_type); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_buffer: public Item_geometry_func_args_geometry -{ - bool check_arguments() const - { - return Item_geometry_func_args_geometry::check_arguments() || - args[1]->check_type_can_return_real(func_name()); - } -protected: - class Transporter : public Gcalc_operation_transporter - { - int m_npoints; - double m_d; - double x1,y1,x2,y2; - double x00,y00,x01,y01; - int add_edge_buffer(double x3, double y3, bool round_p1, bool round_p2); - int add_last_edge_buffer(); - int add_point_buffer(double x, double y); - int complete(); - int m_nshapes; - Gcalc_function::op_type buffer_op; - int last_shape_pos; - bool skip_line; - - public: - Transporter(Gcalc_function *fn, Gcalc_heap *heap, double d) : - Gcalc_operation_transporter(fn, heap), m_npoints(0), m_d(d), - m_nshapes(0), buffer_op((d > 0.0) ? Gcalc_function::op_union : - Gcalc_function::op_difference), - skip_line(FALSE) - {} - int single_point(double x, double y); - int start_line(); - int complete_line(); - int start_poly(); - int complete_poly(); - int start_ring(); - int complete_ring(); - int add_point(double x, double y); - - int start_collection(int n_objects); - }; - Gcalc_heap collector; - Gcalc_function func; - - Gcalc_result_receiver res_receiver; - Gcalc_operation_reducer operation; - -public: - Item_func_buffer(THD *thd, Item *obj, Item *distance) - :Item_geometry_func_args_geometry(thd, obj, distance) {} - const char *func_name() const { return "st_buffer"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_isempty: public Item_bool_func_args_geometry -{ -public: - Item_func_isempty(THD *thd, Item *a) - :Item_bool_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_isempty"; } - bool fix_length_and_dec() { maybe_null= 1; return FALSE; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_issimple: public Item_long_func_args_geometry -{ - Gcalc_heap collector; - Gcalc_function func; - Gcalc_scan_iterator scan_it; - String tmp; -public: - Item_func_issimple(THD *thd, Item *a) - :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_issimple"; } - bool fix_length_and_dec() { decimals=0; max_length=2; return FALSE; } - uint decimal_precision() const { return 1; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_isclosed: public Item_long_func_args_geometry -{ -public: - Item_func_isclosed(THD *thd, Item *a) - :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_isclosed"; } - bool fix_length_and_dec() { decimals=0; max_length=2; return FALSE; } - uint decimal_precision() const { return 1; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_isring: public Item_func_issimple -{ -public: - Item_func_isring(THD *thd, Item *a): Item_func_issimple(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_isring"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_dimension: public Item_long_func_args_geometry -{ -public: - Item_func_dimension(THD *thd, Item *a) - :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_dimension"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_x: public Item_real_func_args_geometry -{ -public: - Item_func_x(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {} - double val_real(); - const char *func_name() const { return "st_x"; } - bool fix_length_and_dec() - { - if (Item_real_func::fix_length_and_dec()) - return TRUE; - maybe_null= 1; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_y: public Item_real_func_args_geometry -{ -public: - Item_func_y(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {} - double val_real(); - const char *func_name() const { return "st_y"; } - bool fix_length_and_dec() - { - if (Item_real_func::fix_length_and_dec()) - return TRUE; - maybe_null= 1; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_numgeometries: public Item_long_func_args_geometry -{ -public: - Item_func_numgeometries(THD *thd, Item *a) - :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_numgeometries"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_numinteriorring: public Item_long_func_args_geometry -{ -public: - Item_func_numinteriorring(THD *thd, Item *a) - :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_numinteriorrings"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_numpoints: public Item_long_func_args_geometry -{ -public: - Item_func_numpoints(THD *thd, Item *a) - :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "st_numpoints"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_area: public Item_real_func_args_geometry -{ -public: - Item_func_area(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {} - double val_real(); - const char *func_name() const { return "st_area"; } - bool fix_length_and_dec() - { - if (Item_real_func::fix_length_and_dec()) - return TRUE; - maybe_null= 1; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_glength: public Item_real_func_args_geometry -{ - String value; -public: - Item_func_glength(THD *thd, Item *a) - :Item_real_func_args_geometry(thd, a) {} - double val_real(); - const char *func_name() const { return "st_length"; } - bool fix_length_and_dec() - { - if (Item_real_func::fix_length_and_dec()) - return TRUE; - maybe_null= 1; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_srid: public Item_long_func_args_geometry -{ -public: - Item_func_srid(THD *thd, Item *a) - :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); - const char *func_name() const { return "srid"; } - bool fix_length_and_dec() { max_length= 10; maybe_null= 1; return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_distance: public Item_real_func_args_geometry_geometry -{ - String tmp_value1; - String tmp_value2; - Gcalc_heap collector; - Gcalc_function func; - Gcalc_scan_iterator scan_it; -public: - Item_func_distance(THD *thd, Item *a, Item *b) - :Item_real_func_args_geometry_geometry(thd, a, b) {} - double val_real(); - const char *func_name() const { return "st_distance"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_pointonsurface: public Item_geometry_func_args_geometry -{ - String tmp_value; - Gcalc_heap collector; - Gcalc_function func; - Gcalc_scan_iterator scan_it; -public: - Item_func_pointonsurface(THD *thd, Item *a) - :Item_geometry_func_args_geometry(thd, a) {} - const char *func_name() const { return "st_pointonsurface"; } - String *val_str(String *); - const Type_handler *type_handler() const - { - return &type_handler_point; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -#ifndef DBUG_OFF -class Item_func_gis_debug: public Item_long_func -{ - public: - Item_func_gis_debug(THD *thd, Item *a): Item_long_func(thd, a) - { null_value= false; } - bool fix_length_and_dec() { fix_char_length(10); return FALSE; } - const char *func_name() const { return "st_gis_debug"; } - longlong val_int(); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; -#endif - - -#define GEOM_NEW(thd, obj_constructor) new (thd->mem_root) obj_constructor -#define GEOM_TYPE(x) (x) - -#else /*HAVE_SPATIAL*/ - -#define GEOM_NEW(thd, obj_constructor) NULL -#define GEOM_TYPE(x) NULL - -#endif /*HAVE_SPATIAL*/ -#endif /* ITEM_GEOFUNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_jsonfunc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_jsonfunc.h deleted file mode 100644 index ec6c669..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_jsonfunc.h +++ /dev/null @@ -1,626 +0,0 @@ -#ifndef ITEM_JSONFUNC_INCLUDED -#define ITEM_JSONFUNC_INCLUDED - -/* Copyright (c) 2016, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -/* This file defines all JSON functions */ - - -#include -#include "item_cmpfunc.h" // Item_bool_func -#include "item_strfunc.h" // Item_str_func -#include "item_sum.h" - - -class json_path_with_flags -{ -public: - json_path_t p; - bool constant; - bool parsed; - json_path_step_t *cur_step; - void set_constant_flag(bool s_constant) - { - constant= s_constant; - parsed= FALSE; - } -}; - - -class Json_engine_scan: public json_engine_t -{ -public: - Json_engine_scan(CHARSET_INFO *i_cs, const uchar *str, const uchar *end) - { - json_scan_start(this, i_cs, str, end); - } - Json_engine_scan(const String &str) - :Json_engine_scan(str.charset(), (const uchar *) str.ptr(), - (const uchar *) str.end()) - { } - bool check_and_get_value_scalar(String *res, int *error); - bool check_and_get_value_complex(String *res, int *error); -}; - - -class Json_path_extractor: public json_path_with_flags -{ -protected: - String tmp_js, tmp_path; - virtual ~Json_path_extractor() { } - virtual bool check_and_get_value(Json_engine_scan *je, - String *to, int *error)=0; - bool extract(String *to, Item *js, Item *jp, CHARSET_INFO *cs); -}; - - -class Item_func_json_valid: public Item_bool_func -{ -protected: - String tmp_value; - -public: - Item_func_json_valid(THD *thd, Item *json) : Item_bool_func(thd, json) {} - longlong val_int(); - const char *func_name() const { return "json_valid"; } - bool fix_length_and_dec() - { - if (Item_bool_func::fix_length_and_dec()) - return TRUE; - maybe_null= 1; - return FALSE; - } - bool set_format_by_check_constraint(Send_field_extended_metadata *to) const - { - static const Lex_cstring fmt(STRING_WITH_LEN("json")); - return to->set_format_name(fmt); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - enum Functype functype() const { return JSON_VALID_FUNC; } -}; - - -class Item_func_json_exists: public Item_bool_func -{ -protected: - json_path_with_flags path; - String tmp_js, tmp_path; - -public: - Item_func_json_exists(THD *thd, Item *js, Item *i_path): - Item_bool_func(thd, js, i_path) {} - const char *func_name() const { return "json_exists"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - longlong val_int(); -}; - - -class Item_json_func: public Item_str_func -{ -public: - Item_json_func(THD *thd) - :Item_str_func(thd) { } - Item_json_func(THD *thd, Item *a) - :Item_str_func(thd, a) { } - Item_json_func(THD *thd, Item *a, Item *b) - :Item_str_func(thd, a, b) { } - Item_json_func(THD *thd, List &list) - :Item_str_func(thd, list) { } - bool is_json_type() { return true; } - void make_send_field(THD *thd, Send_field *tmp_field) - { - Item_str_func::make_send_field(thd, tmp_field); - static const Lex_cstring fmt(STRING_WITH_LEN("json")); - tmp_field->set_format_name(fmt); - } -}; - - -class Item_func_json_value: public Item_str_func, - public Json_path_extractor -{ - -public: - Item_func_json_value(THD *thd, Item *js, Item *i_path): - Item_str_func(thd, js, i_path) {} - const char *func_name() const override { return "json_value"; } - bool fix_length_and_dec() override ; - String *val_str(String *to) override - { - null_value= Json_path_extractor::extract(to, args[0], args[1], - collation.collation); - return null_value ? NULL : to; - } - bool check_and_get_value(Json_engine_scan *je, - String *res, int *error) override - { - return je->check_and_get_value_scalar(res, error); - } - Item *get_copy(THD *thd) override - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_query: public Item_json_func, - public Json_path_extractor -{ -public: - Item_func_json_query(THD *thd, Item *js, Item *i_path): - Item_json_func(thd, js, i_path) {} - const char *func_name() const override { return "json_query"; } - bool fix_length_and_dec() override; - String *val_str(String *to) override - { - null_value= Json_path_extractor::extract(to, args[0], args[1], - collation.collation); - return null_value ? NULL : to; - } - bool check_and_get_value(Json_engine_scan *je, - String *res, int *error) override - { - return je->check_and_get_value_complex(res, error); - } - Item *get_copy(THD *thd) override - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_quote: public Item_str_func -{ -protected: - String tmp_s; - -public: - Item_func_json_quote(THD *thd, Item *s): Item_str_func(thd, s) {} - const char *func_name() const { return "json_quote"; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_unquote: public Item_str_func -{ -protected: - String tmp_s; - String *read_json(json_engine_t *je); -public: - Item_func_json_unquote(THD *thd, Item *s): Item_str_func(thd, s) {} - const char *func_name() const { return "json_unquote"; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_json_str_multipath: public Item_json_func -{ -protected: - json_path_with_flags *paths; - String *tmp_paths; -public: - Item_json_str_multipath(THD *thd, List &list): - Item_json_func(thd, list), tmp_paths(0) {} - bool fix_fields(THD *thd, Item **ref); - void cleanup(); - virtual uint get_n_paths() const = 0; -}; - - -class Item_func_json_extract: public Item_json_str_multipath -{ -protected: - String tmp_js; -public: - String *read_json(String *str, json_value_types *type, - char **out_val, int *value_len); - Item_func_json_extract(THD *thd, List &list): - Item_json_str_multipath(thd, list) {} - const char *func_name() const { return "json_extract"; } - enum Functype functype() const { return JSON_EXTRACT_FUNC; } - bool fix_length_and_dec(); - String *val_str(String *); - longlong val_int(); - double val_real(); - my_decimal *val_decimal(my_decimal *); - uint get_n_paths() const { return arg_count - 1; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_contains: public Item_bool_func -{ -protected: - String tmp_js; - json_path_with_flags path; - String tmp_path; - bool a2_constant, a2_parsed; - String tmp_val, *val; -public: - Item_func_json_contains(THD *thd, List &list): - Item_bool_func(thd, list) {} - const char *func_name() const { return "json_contains"; } - bool fix_length_and_dec(); - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_contains_path: public Item_bool_func -{ -protected: - String tmp_js; - json_path_with_flags *paths; - String *tmp_paths; - bool mode_one; - bool ooa_constant, ooa_parsed; - bool *p_found; - -public: - Item_func_json_contains_path(THD *thd, List &list): - Item_bool_func(thd, list), tmp_paths(0) {} - const char *func_name() const { return "json_contains_path"; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - void cleanup(); - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_array: public Item_json_func -{ -protected: - String tmp_val; - ulong result_limit; -public: - Item_func_json_array(THD *thd): - Item_json_func(thd) {} - Item_func_json_array(THD *thd, List &list): - Item_json_func(thd, list) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "json_array"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_array_append: public Item_json_str_multipath -{ -protected: - String tmp_js; - String tmp_val; -public: - Item_func_json_array_append(THD *thd, List &list): - Item_json_str_multipath(thd, list) {} - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count/2; } - const char *func_name() const { return "json_array_append"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_array_insert: public Item_func_json_array_append -{ -public: - Item_func_json_array_insert(THD *thd, List &list): - Item_func_json_array_append(thd, list) {} - String *val_str(String *); - const char *func_name() const { return "json_array_insert"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_object: public Item_func_json_array -{ -public: - Item_func_json_object(THD *thd): - Item_func_json_array(thd) {} - Item_func_json_object(THD *thd, List &list): - Item_func_json_array(thd, list) {} - String *val_str(String *); - const char *func_name() const { return "json_object"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_merge: public Item_func_json_array -{ -protected: - String tmp_js1, tmp_js2; -public: - Item_func_json_merge(THD *thd, List &list): - Item_func_json_array(thd, list) {} - String *val_str(String *); - const char *func_name() const { return "json_merge_preserve"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_json_merge_patch: public Item_func_json_merge -{ -public: - Item_func_json_merge_patch(THD *thd, List &list): - Item_func_json_merge(thd, list) {} - const char *func_name() const { return "json_merge_patch"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_json_length: public Item_long_func -{ - bool check_arguments() const - { - return args[0]->check_type_can_return_text(func_name()) || - (arg_count > 1 && - args[1]->check_type_general_purpose_string(func_name())); - } -protected: - json_path_with_flags path; - String tmp_js; - String tmp_path; -public: - Item_func_json_length(THD *thd, List &list): - Item_long_func(thd, list) {} - const char *func_name() const { return "json_length"; } - bool fix_length_and_dec(); - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_depth: public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_text(func_name()); } -protected: - String tmp_js; -public: - Item_func_json_depth(THD *thd, Item *js): Item_long_func(thd, js) {} - const char *func_name() const { return "json_depth"; } - bool fix_length_and_dec() { max_length= 10; return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_type: public Item_str_func -{ -protected: - String tmp_js; -public: - Item_func_json_type(THD *thd, Item *js): Item_str_func(thd, js) {} - const char *func_name() const { return "json_type"; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_insert: public Item_json_str_multipath -{ -protected: - String tmp_js; - String tmp_val; - bool mode_insert, mode_replace; -public: - Item_func_json_insert(bool i_mode, bool r_mode, THD *thd, List &list): - Item_json_str_multipath(thd, list), - mode_insert(i_mode), mode_replace(r_mode) {} - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count/2; } - const char *func_name() const - { - return mode_insert ? - (mode_replace ? "json_set" : "json_insert") : "json_update"; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_remove: public Item_json_str_multipath -{ -protected: - String tmp_js; -public: - Item_func_json_remove(THD *thd, List &list): - Item_json_str_multipath(thd, list) {} - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count - 1; } - const char *func_name() const { return "json_remove"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_keys: public Item_str_func -{ -protected: - json_path_with_flags path; - String tmp_js, tmp_path; - -public: - Item_func_json_keys(THD *thd, List &list): - Item_str_func(thd, list) {} - const char *func_name() const { return "json_keys"; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_search: public Item_json_str_multipath -{ -protected: - String tmp_js, tmp_path, esc_value; - bool mode_one; - bool ooa_constant, ooa_parsed; - int escape; - int n_path_found; - json_path_t sav_path; - - int compare_json_value_wild(json_engine_t *je, const String *cmp_str); - -public: - Item_func_json_search(THD *thd, List &list): - Item_json_str_multipath(thd, list) {} - const char *func_name() const { return "json_search"; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count > 4 ? arg_count - 4 : 0; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_format: public Item_json_func -{ -public: - enum formats - { - NONE, - COMPACT, - LOOSE, - DETAILED - }; -protected: - formats fmt; - String tmp_js; -public: - Item_func_json_format(THD *thd, Item *js, formats format): - Item_json_func(thd, js), fmt(format) {} - Item_func_json_format(THD *thd, List &list): - Item_json_func(thd, list), fmt(DETAILED) {} - - const char *func_name() const; - bool fix_length_and_dec(); - String *val_str(String *str); - String *val_json(String *str); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_arrayagg : public Item_func_group_concat -{ -protected: - /* - Overrides Item_func_group_concat::skip_nulls() - NULL-s should be added to the result as JSON null value. - */ - bool skip_nulls() const { return false; } - String *get_str_from_item(Item *i, String *tmp); - String *get_str_from_field(Item *i, Field *f, String *tmp, - const uchar *key, size_t offset); - void cut_max_length(String *result, - uint old_length, uint max_length) const; -public: - String m_tmp_json; /* Used in get_str_from_*.. */ - Item_func_json_arrayagg(THD *thd, Name_resolution_context *context_arg, - bool is_distinct, List *is_select, - const SQL_I_List &is_order, String *is_separator, - bool limit_clause, Item *row_limit, Item *offset_limit): - Item_func_group_concat(thd, context_arg, is_distinct, is_select, is_order, - is_separator, limit_clause, row_limit, offset_limit) - { - } - Item_func_json_arrayagg(THD *thd, Item_func_json_arrayagg *item); - bool is_json_type() { return true; } - - const char *func_name() const { return "json_arrayagg("; } - enum Sumfunctype sum_func() const {return JSON_ARRAYAGG_FUNC;} - - String* val_str(String *str); - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_json_objectagg : public Item_sum -{ - String result; -public: - Item_func_json_objectagg(THD *thd, Item *key, Item *value) : - Item_sum(thd, key, value) - { - quick_group= FALSE; - result.append("{"); - } - - Item_func_json_objectagg(THD *thd, Item_func_json_objectagg *item); - bool is_json_type() { return true; } - void cleanup(); - - enum Sumfunctype sum_func () const {return JSON_OBJECTAGG_FUNC;} - const char *func_name() const { return "json_objectagg"; } - const Type_handler *type_handler() const - { - if (too_big_for_varchar()) - return &type_handler_blob; - return &type_handler_varchar; - } - void clear(); - bool add(); - void reset_field() { DBUG_ASSERT(0); } // not used - void update_field() { DBUG_ASSERT(0); } // not used - bool fix_fields(THD *,Item **); - - double val_real() - { return 0.0; } - longlong val_int() - { return 0; } - my_decimal *val_decimal(my_decimal *decimal_value) - { - my_decimal_set_zero(decimal_value); - return decimal_value; - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return get_date_from_string(thd, ltime, fuzzydate); - } - String* val_str(String* str); - Item *copy_or_same(THD* thd); - void no_rows_in_result() {} - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -#endif /* ITEM_JSONFUNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_row.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_row.h deleted file mode 100644 index 2872a49..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_row.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef ITEM_ROW_INCLUDED -#define ITEM_ROW_INCLUDED - -/* - Copyright (c) 2002, 2013, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - Row items used for comparing rows and IN operations on rows: - - @verbatim - (a, b, c) > (10, 10, 30) - (a, b, c) = (select c, d, e, from t1 where x=12) - (a, b, c) IN ((1,2,2), (3,4,5), (6,7,8) - (a, b, c) IN (select c, d, e, from t1) - @endverbatim -*/ - - -/** - Item which stores (x,y,...) and ROW(x,y,...). - Note that this can be recursive: ((x,y),(z,t)) is a ROW of ROWs. -*/ -class Item_row: public Item_fixed_hybrid, - private Item_args, - private Used_tables_and_const_cache, - private With_subquery_cache, - private With_sum_func_cache -{ - table_map not_null_tables_cache; - /** - If elements are made only of constants, of which one or more are - NULL. For example, this item is (1,2,NULL), or ( (1,NULL), (2,3) ). - */ - bool with_null; -public: - Item_row(THD *thd, List &list) - :Item_fixed_hybrid(thd), Item_args(thd, list), - not_null_tables_cache(0), with_null(0) - { } - Item_row(THD *thd, Item_row *row) - :Item_fixed_hybrid(thd), Item_args(thd, static_cast(row)), - Used_tables_and_const_cache(), - With_sum_func_cache(*row), - not_null_tables_cache(0), with_null(0) - { } - - bool with_subquery() const { DBUG_ASSERT(fixed); return m_with_subquery; } - enum Type type() const { return ROW_ITEM; }; - const Type_handler *type_handler() const { return &type_handler_row; } - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - return NULL; // Check with Vicentiu why it's called for Item_row - } - void illegal_method_call(const char *); - bool is_null() { return null_value; } - void make_send_field(THD *thd, Send_field *) - { - illegal_method_call((const char*)"make_send_field"); - }; - double val_real() - { - illegal_method_call((const char*)"val"); - return 0; - }; - longlong val_int() - { - illegal_method_call((const char*)"val_int"); - return 0; - }; - String *val_str(String *) - { - illegal_method_call((const char*)"val_str"); - return 0; - }; - my_decimal *val_decimal(my_decimal *) - { - illegal_method_call((const char*)"val_decimal"); - return 0; - }; - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - illegal_method_call((const char*)"get_date"); - return true; - } - bool fix_fields(THD *thd, Item **ref); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - void cleanup(); - void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - bool with_sum_func() const { return m_with_sum_func; } - With_sum_func_cache* get_with_sum_func_cache() { return this; } - table_map used_tables() const { return used_tables_cache; }; - bool const_item() const { return const_item_cache; }; - void update_used_tables() - { - used_tables_and_const_cache_init(); - used_tables_and_const_cache_update_and_join(arg_count, args); - } - table_map not_null_tables() const { return not_null_tables_cache; } - virtual void print(String *str, enum_query_type query_type); - - bool walk(Item_processor processor, bool walk_subquery, void *arg) - { - if (walk_args(processor, walk_subquery, arg)) - return true; - return (this->*processor)(arg); - } - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - - uint cols() const { return arg_count; } - Item* element_index(uint i) { return args[i]; } - Item** addr(uint i) { return args + i; } - bool check_cols(uint c); - bool null_inside() { return with_null; }; - void bring_value(); - - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { - Item_args::propagate_equal_fields(thd, Context_identity(), cond); - return this; - } - - bool excl_dep_on_table(table_map tab_map) - { - return Item_args::excl_dep_on_table(tab_map); - } - - bool excl_dep_on_grouping_fields(st_select_lex *sel) - { - return Item_args::excl_dep_on_grouping_fields(sel); - } - - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) - { - return Item_args::excl_dep_on_in_subq_left_part(subq_pred); - } - - bool check_vcol_func_processor(void *arg) {return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *build_clone(THD *thd); -}; - -#endif /* ITEM_ROW_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_strfunc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_strfunc.h deleted file mode 100644 index 1ae62a4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_strfunc.h +++ /dev/null @@ -1,1871 +0,0 @@ -#ifndef ITEM_STRFUNC_INCLUDED -#define ITEM_STRFUNC_INCLUDED - -/* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* This file defines all string functions */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -extern size_t username_char_length; - -class Item_str_func :public Item_func -{ -protected: - /** - Sets the result value of the function an empty string, using the current - character set. No memory is allocated. - @retval A pointer to the str_value member. - */ - virtual String *make_empty_result() - { - /* - Reset string length to an empty string. We don't use str_value.set() as - we don't want to free and potentially have to reallocate the buffer - for each call. - */ - str_value.length(0); - str_value.set_charset(collation.collation); - return &str_value; - } -public: - Item_str_func(THD *thd): Item_func(thd) { decimals=NOT_FIXED_DEC; } - Item_str_func(THD *thd, Item *a): Item_func(thd, a) {decimals=NOT_FIXED_DEC; } - Item_str_func(THD *thd, Item *a, Item *b): - Item_func(thd, a, b) { decimals=NOT_FIXED_DEC; } - Item_str_func(THD *thd, Item *a, Item *b, Item *c): - Item_func(thd, a, b, c) { decimals=NOT_FIXED_DEC; } - Item_str_func(THD *thd, Item *a, Item *b, Item *c, Item *d): - Item_func(thd, a, b, c, d) { decimals=NOT_FIXED_DEC; } - Item_str_func(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e): - Item_func(thd, a, b, c, d, e) { decimals=NOT_FIXED_DEC; } - Item_str_func(THD *thd, List &list): - Item_func(thd, list) { decimals=NOT_FIXED_DEC; } - longlong val_int(); - double val_real(); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { return get_date_from_string(thd, ltime, fuzzydate); } - const Type_handler *type_handler() const { return string_type_handler(); } - void left_right_max_length(); - bool fix_fields(THD *thd, Item **ref); -}; - - - -/* - Functions that return values with ASCII repertoire -*/ -class Item_str_ascii_func :public Item_str_func -{ - String ascii_buf; -public: - Item_str_ascii_func(THD *thd): Item_str_func(thd) {} - Item_str_ascii_func(THD *thd, Item *a): Item_str_func(thd, a) {} - Item_str_ascii_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - Item_str_ascii_func(THD *thd, Item *a, Item *b, Item *c): - Item_str_func(thd, a, b, c) {} - String *val_str(String *str) - { - return val_str_from_val_str_ascii(str, &ascii_buf); - } - String *val_str_ascii(String *)= 0; -}; - - -/** - Functions that return a checksum or a hash of the argument, - or somehow else encode or decode the argument, - returning an ASCII-repertoire string. -*/ -class Item_str_ascii_checksum_func: public Item_str_ascii_func -{ -public: - Item_str_ascii_checksum_func(THD *thd, Item *a) - :Item_str_ascii_func(thd, a) { } - Item_str_ascii_checksum_func(THD *thd, Item *a, Item *b) - :Item_str_ascii_func(thd, a, b) { } - bool eq(const Item *item, bool binary_cmp) const - { - // Always use binary argument comparison: MD5('x') != MD5('X') - return Item_func::eq(item, true); - } -}; - - -/** - Functions that return a checksum or a hash of the argument, - or somehow else encode or decode the argument, - returning a binary string. -*/ -class Item_str_binary_checksum_func: public Item_str_func -{ -public: - Item_str_binary_checksum_func(THD *thd, Item *a) - :Item_str_func(thd, a) { } - Item_str_binary_checksum_func(THD *thd, Item *a, Item *b) - :Item_str_func(thd, a, b) { } - bool eq(const Item *item, bool binary_cmp) const - { - /* - Always use binary argument comparison: - FROM_BASE64('test') != FROM_BASE64('TEST') - */ - return Item_func::eq(item, true); - } -}; - - -class Item_func_md5 :public Item_str_ascii_checksum_func -{ -public: - Item_func_md5(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} - String *val_str_ascii(String *); - bool fix_length_and_dec() - { - fix_length_and_charset(32, default_charset()); - return FALSE; - } - const char *func_name() const { return "md5"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_sha :public Item_str_ascii_checksum_func -{ -public: - Item_func_sha(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "sha"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_sha2 :public Item_str_ascii_checksum_func -{ -public: - Item_func_sha2(THD *thd, Item *a, Item *b) - :Item_str_ascii_checksum_func(thd, a, b) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "sha2"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_to_base64 :public Item_str_ascii_checksum_func -{ - String tmp_value; -public: - Item_func_to_base64(THD *thd, Item *a) - :Item_str_ascii_checksum_func(thd, a) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "to_base64"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_from_base64 :public Item_str_binary_checksum_func -{ - String tmp_value; -public: - Item_func_from_base64(THD *thd, Item *a) - :Item_str_binary_checksum_func(thd, a) { } - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "from_base64"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -#include - -class Item_aes_crypt :public Item_str_binary_checksum_func -{ - enum { AES_KEY_LENGTH = 128 }; - void create_key(String *user_key, uchar* key); - -protected: - int what; - String tmp_value; -public: - Item_aes_crypt(THD *thd, Item *a, Item *b) - :Item_str_binary_checksum_func(thd, a, b) {} - String *val_str(String *); -}; - -class Item_func_aes_encrypt :public Item_aes_crypt -{ -public: - Item_func_aes_encrypt(THD *thd, Item *a, Item *b) - :Item_aes_crypt(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "aes_encrypt"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_aes_decrypt :public Item_aes_crypt -{ -public: - Item_func_aes_decrypt(THD *thd, Item *a, Item *b): - Item_aes_crypt(thd, a, b) {} - bool fix_length_and_dec(); - const char *func_name() const { return "aes_decrypt"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_concat :public Item_str_func -{ -protected: - String tmp_value; - /* - Append a non-NULL value to the result. - @param [IN] thd - The current thread. - @param [IN/OUT] res - The current val_str() return value. - @param [IN] app - The value to be appended. - @retval - false on success, true on error - */ - bool append_value(THD *thd, String *res, const String *app); - bool realloc_result(String *str, uint length) const; -public: - Item_func_concat(THD *thd, List &list): Item_str_func(thd, list) {} - Item_func_concat(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "concat"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - This class handles the || operator in sql_mode=ORACLE. - Unlike the traditional MariaDB concat(), it treats NULL arguments as ''. -*/ -class Item_func_concat_operator_oracle :public Item_func_concat -{ -public: - Item_func_concat_operator_oracle(THD *thd, List &list) - :Item_func_concat(thd, list) - { } - Item_func_concat_operator_oracle(THD *thd, Item *a, Item *b) - :Item_func_concat(thd, a, b) - { } - String *val_str(String *); - const char *func_name() const { return "concat_operator_oracle"; } - Item *get_copy(THD *thd) - { - return get_item_copy(thd, this); - } -}; - - -class Item_func_decode_histogram :public Item_str_func -{ -public: - Item_func_decode_histogram(THD *thd, Item *a, Item *b): - Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec() - { - collation.set(system_charset_info); - max_length= MAX_BLOB_WIDTH; - maybe_null= 1; - return FALSE; - } - const char *func_name() const { return "decode_histogram"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_concat_ws :public Item_str_func -{ - String tmp_value; -public: - Item_func_concat_ws(THD *thd, List &list): Item_str_func(thd, list) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "concat_ws"; } - table_map not_null_tables() const { return 0; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_reverse :public Item_str_func -{ - String tmp_value; -public: - Item_func_reverse(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "reverse"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_replace :public Item_str_func -{ - String tmp_value,tmp_value2; -public: - Item_func_replace(THD *thd, Item *org, Item *find, Item *replace): - Item_str_func(thd, org, find, replace) {} - String *val_str(String *to) { return val_str_internal(to, NULL); }; - bool fix_length_and_dec(); - String *val_str_internal(String *str, String *empty_string_for_null); - const char *func_name() const { return "replace"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_replace_oracle :public Item_func_replace -{ - String tmp_emtpystr; -public: - Item_func_replace_oracle(THD *thd, Item *org, Item *find, Item *replace): - Item_func_replace(thd, org, find, replace) {} - String *val_str(String *to) { return val_str_internal(to, &tmp_emtpystr); }; - const char *func_name() const { return "replace_oracle"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_regexp_replace :public Item_str_func -{ - Regexp_processor_pcre re; - bool append_replacement(String *str, - const LEX_CSTRING *source, - const LEX_CSTRING *replace); -public: - Item_func_regexp_replace(THD *thd, Item *a, Item *b, Item *c): - Item_str_func(thd, a, b, c) - {} - void cleanup() - { - DBUG_ENTER("Item_func_regexp_replace::cleanup"); - Item_str_func::cleanup(); - re.cleanup(); - DBUG_VOID_RETURN; - } - String *val_str(String *str); - bool fix_length_and_dec(); - const char *func_name() const { return "regexp_replace"; } - Item *get_copy(THD *thd) { return 0;} -}; - - -class Item_func_regexp_substr :public Item_str_func -{ - Regexp_processor_pcre re; -public: - Item_func_regexp_substr(THD *thd, Item *a, Item *b): - Item_str_func(thd, a, b) - {} - void cleanup() - { - DBUG_ENTER("Item_func_regexp_substr::cleanup"); - Item_str_func::cleanup(); - re.cleanup(); - DBUG_VOID_RETURN; - } - String *val_str(String *str); - bool fix_length_and_dec(); - const char *func_name() const { return "regexp_substr"; } - Item *get_copy(THD *thd) { return 0; } -}; - - -class Item_func_insert :public Item_str_func -{ - String tmp_value; -public: - Item_func_insert(THD *thd, Item *org, Item *start, Item *length, - Item *new_str): - Item_str_func(thd, org, start, length, new_str) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "insert"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_str_conv :public Item_str_func -{ -protected: - uint multiply; - my_charset_conv_case converter; - String tmp_value; -public: - Item_str_conv(THD *thd, Item *item): Item_str_func(thd, item) {} - String *val_str(String *); -}; - - -class Item_func_lcase :public Item_str_conv -{ -public: - Item_func_lcase(THD *thd, Item *item): Item_str_conv(thd, item) {} - const char *func_name() const { return "lcase"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_ucase :public Item_str_conv -{ -public: - Item_func_ucase(THD *thd, Item *item): Item_str_conv(thd, item) {} - const char *func_name() const { return "ucase"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_left :public Item_str_func -{ - String tmp_value; -public: - Item_func_left(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "left"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_right :public Item_str_func -{ - String tmp_value; -public: - Item_func_right(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "right"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_substr :public Item_str_func -{ - String tmp_value; -protected: - virtual longlong get_position() { return args[1]->val_int(); } -public: - Item_func_substr(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - Item_func_substr(THD *thd, Item *a, Item *b, Item *c): - Item_str_func(thd, a, b, c) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "substr"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_substr_oracle :public Item_func_substr -{ -protected: - longlong get_position() - { longlong pos= args[1]->val_int(); return pos == 0 ? 1 : pos; } - String *make_empty_result() - { null_value= 1; return NULL; } -public: - Item_func_substr_oracle(THD *thd, Item *a, Item *b): - Item_func_substr(thd, a, b) {} - Item_func_substr_oracle(THD *thd, Item *a, Item *b, Item *c): - Item_func_substr(thd, a, b, c) {} - bool fix_length_and_dec() - { - bool res= Item_func_substr::fix_length_and_dec(); - maybe_null= true; - return res; - } - const char *func_name() const { return "substr_oracle"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_substr_index :public Item_str_func -{ - String tmp_value; -public: - Item_func_substr_index(THD *thd, Item *a,Item *b,Item *c): - Item_str_func(thd, a, b, c) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "substring_index"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - -}; - - -class Item_func_trim :public Item_str_func -{ -protected: - String tmp_value; - String remove; - String *trimmed_value(String *res, uint32 offset, uint32 length) - { - if (length == 0) - return make_empty_result(); - - tmp_value.set(*res, offset, length); - /* - Make sure to return correct charset and collation: - TRIM(0x000000 FROM _ucs2 0x0061) - should set charset to "binary" rather than to "ucs2". - */ - tmp_value.set_charset(collation.collation); - return &tmp_value; - } - String *non_trimmed_value(String *res) - { - return trimmed_value(res, 0, res->length()); - } - virtual const char *func_name_ext() const { return ""; } -public: - Item_func_trim(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - Item_func_trim(THD *thd, Item *a): Item_str_func(thd, a) {} - Sql_mode_dependency value_depends_on_sql_mode() const; - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "trim"; } - void print(String *str, enum_query_type query_type); - virtual const char *mode_name() const { return "both"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_trim_oracle :public Item_func_trim -{ -protected: - String *make_empty_result() - { null_value= 1; return NULL; } - const char *func_name_ext() const { return "_oracle"; } -public: - Item_func_trim_oracle(THD *thd, Item *a, Item *b): - Item_func_trim(thd, a, b) {} - Item_func_trim_oracle(THD *thd, Item *a): Item_func_trim(thd, a) {} - const char *func_name() const { return "trim_oracle"; } - bool fix_length_and_dec() - { - bool res= Item_func_trim::fix_length_and_dec(); - maybe_null= true; - return res; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_ltrim :public Item_func_trim -{ -public: - Item_func_ltrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {} - Item_func_ltrim(THD *thd, Item *a): Item_func_trim(thd, a) {} - Sql_mode_dependency value_depends_on_sql_mode() const - { - return Item_func::value_depends_on_sql_mode(); - } - String *val_str(String *); - const char *func_name() const { return "ltrim"; } - const char *mode_name() const { return "leading"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_ltrim_oracle :public Item_func_ltrim -{ -protected: - String *make_empty_result() - { null_value= 1; return NULL; } - const char *func_name_ext() const { return "_oracle"; } -public: - Item_func_ltrim_oracle(THD *thd, Item *a, Item *b): - Item_func_ltrim(thd, a, b) {} - Item_func_ltrim_oracle(THD *thd, Item *a): Item_func_ltrim(thd, a) {} - const char *func_name() const { return "ltrim_oracle"; } - bool fix_length_and_dec() - { - bool res= Item_func_ltrim::fix_length_and_dec(); - maybe_null= true; - return res; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_rtrim :public Item_func_trim -{ -public: - Item_func_rtrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {} - Item_func_rtrim(THD *thd, Item *a): Item_func_trim(thd, a) {} - String *val_str(String *); - const char *func_name() const { return "rtrim"; } - const char *mode_name() const { return "trailing"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_rtrim_oracle :public Item_func_rtrim -{ -protected: - String *make_empty_result() - { null_value= 1; return NULL; } - const char *func_name_ext() const { return "_oracle"; } -public: - Item_func_rtrim_oracle(THD *thd, Item *a, Item *b): - Item_func_rtrim(thd, a, b) {} - Item_func_rtrim_oracle(THD *thd, Item *a): Item_func_rtrim(thd, a) {} - const char *func_name() const { return "rtrim_oracle"; } - bool fix_length_and_dec() - { - bool res= Item_func_rtrim::fix_length_and_dec(); - maybe_null= true; - return res; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -/* - Item_func_password -- new (4.1.1) PASSWORD() function implementation. - Returns strcat('*', octet2hex(sha1(sha1(password)))). '*' stands for new - password format, sha1(sha1(password) is so-called hash_stage2 value. - Length of returned string is always 41 byte. To find out how entire - authentication procedure works, see comments in password.c. -*/ - -class Item_func_password :public Item_str_ascii_checksum_func -{ -public: - enum PW_Alg {OLD, NEW}; -private: - char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH+1]; - enum PW_Alg alg; - bool deflt; -public: - Item_func_password(THD *thd, Item *a): - Item_str_ascii_checksum_func(thd, a), alg(NEW), deflt(1) {} - Item_func_password(THD *thd, Item *a, PW_Alg al): - Item_str_ascii_checksum_func(thd, a), alg(al), deflt(0) {} - String *val_str_ascii(String *str); - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() - { - fix_length_and_charset((alg == 1 ? - SCRAMBLED_PASSWORD_CHAR_LENGTH : - SCRAMBLED_PASSWORD_CHAR_LENGTH_323), - default_charset()); - return FALSE; - } - const char *func_name() const { return ((deflt || alg == 1) ? - "password" : "old_password"); } - static char *alloc(THD *thd, const char *password, size_t pass_len, - enum PW_Alg al); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - - -class Item_func_des_encrypt :public Item_str_binary_checksum_func -{ - String tmp_value,tmp_arg; -public: - Item_func_des_encrypt(THD *thd, Item *a) - :Item_str_binary_checksum_func(thd, a) {} - Item_func_des_encrypt(THD *thd, Item *a, Item *b) - :Item_str_binary_checksum_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec() - { - maybe_null=1; - /* 9 = MAX ((8- (arg_len % 8)) + 1) */ - max_length = args[0]->max_length + 9; - return FALSE; - } - const char *func_name() const { return "des_encrypt"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_des_decrypt :public Item_str_binary_checksum_func -{ - String tmp_value; -public: - Item_func_des_decrypt(THD *thd, Item *a) - :Item_str_binary_checksum_func(thd, a) {} - Item_func_des_decrypt(THD *thd, Item *a, Item *b) - :Item_str_binary_checksum_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec() - { - maybe_null=1; - /* 9 = MAX ((8- (arg_len % 8)) + 1) */ - max_length= args[0]->max_length; - if (max_length >= 9U) - max_length-= 9U; - return FALSE; - } - const char *func_name() const { return "des_decrypt"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - QQ: Item_func_encrypt should derive from Item_str_ascii_checksum_func. - However, it should be fixed to handle UCS2, UTF16, UTF32 properly first, - as the underlying crypt() call expects a null-terminated input string. -*/ -class Item_func_encrypt :public Item_str_binary_checksum_func -{ - String tmp_value; - - /* Encapsulate common constructor actions */ - void constructor_helper() - { - collation.set(&my_charset_bin); - } -public: - Item_func_encrypt(THD *thd, Item *a): Item_str_binary_checksum_func(thd, a) - { - constructor_helper(); - } - Item_func_encrypt(THD *thd, Item *a, Item *b) - :Item_str_binary_checksum_func(thd, a, b) - { - constructor_helper(); - } - String *val_str(String *); - bool fix_length_and_dec() { maybe_null=1; max_length = 13; return FALSE; } - const char *func_name() const { return "encrypt"; } - bool check_vcol_func_processor(void *arg) - { - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -#include "sql_crypt.h" - - -class Item_func_encode :public Item_str_binary_checksum_func -{ -private: - /** Whether the PRNG has already been seeded. */ - bool seeded; -protected: - SQL_CRYPT sql_crypt; -public: - Item_func_encode(THD *thd, Item *a, Item *seed_arg): - Item_str_binary_checksum_func(thd, a, seed_arg) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "encode"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -protected: - virtual void crypto_transform(String *); -private: - /** Provide a seed for the PRNG sequence. */ - bool seed(); -}; - - -class Item_func_decode :public Item_func_encode -{ -public: - Item_func_decode(THD *thd, Item *a, Item *seed_arg): Item_func_encode(thd, a, seed_arg) {} - const char *func_name() const { return "decode"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -protected: - void crypto_transform(String *); -}; - - -class Item_func_sysconst :public Item_str_func -{ -public: - Item_func_sysconst(THD *thd): Item_str_func(thd) - { collation.set(system_charset_info,DERIVATION_SYSCONST); } - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - /* - Used to create correct Item name in new converted item in - safe_charset_converter, return string representation of this function - call - */ - virtual const char *fully_qualified_func_name() const = 0; - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(fully_qualified_func_name(), arg, - VCOL_SESSION_FUNC); - } - bool const_item() const; -}; - - -class Item_func_database :public Item_func_sysconst -{ -public: - Item_func_database(THD *thd): Item_func_sysconst(thd) {} - String *val_str(String *); - bool fix_length_and_dec() - { - max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen; - maybe_null=1; - return FALSE; - } - const char *func_name() const { return "database"; } - const char *fully_qualified_func_name() const { return "database()"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_sqlerrm :public Item_func_sysconst -{ -public: - Item_func_sqlerrm(THD *thd): Item_func_sysconst(thd) {} - String *val_str(String *); - const char *func_name() const { return "SQLERRM"; } - const char *fully_qualified_func_name() const { return "SQLERRM"; } - void print(String *str, enum_query_type query_type) - { - str->append(func_name()); - } - bool fix_length_and_dec() - { - max_length= 512 * system_charset_info->mbmaxlen; - null_value= maybe_null= false; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_user :public Item_func_sysconst -{ -protected: - bool init (const char *user, const char *host); - -public: - Item_func_user(THD *thd): Item_func_sysconst(thd) - { - str_value.set("", 0, system_charset_info); - } - String *val_str(String *) - { - DBUG_ASSERT(fixed == 1); - return (null_value ? 0 : &str_value); - } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() - { - max_length= (uint32) (username_char_length + - HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN; - return FALSE; - } - const char *func_name() const { return "user"; } - const char *fully_qualified_func_name() const { return "user()"; } - int save_in_field(Field *field, bool no_conversions) - { - return save_str_value_in_field(field, &str_value); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_current_user :public Item_func_user -{ - Name_resolution_context *context; - -public: - Item_func_current_user(THD *thd, Name_resolution_context *context_arg): - Item_func_user(thd), context(context_arg) {} - bool fix_fields(THD *thd, Item **ref); - const char *func_name() const { return "current_user"; } - const char *fully_qualified_func_name() const { return "current_user()"; } - bool check_vcol_func_processor(void *arg) - { - context= 0; - return mark_unsupported_function(fully_qualified_func_name(), arg, - VCOL_SESSION_FUNC); - } -}; - - -class Item_func_current_role :public Item_func_sysconst -{ - Name_resolution_context *context; - -public: - Item_func_current_role(THD *thd, Name_resolution_context *context_arg): - Item_func_sysconst(thd), context(context_arg) {} - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() - { - max_length= (uint32) username_char_length * SYSTEM_CHARSET_MBMAXLEN; - return FALSE; - } - int save_in_field(Field *field, bool no_conversions) - { return save_str_value_in_field(field, &str_value); } - const char *func_name() const { return "current_role"; } - const char *fully_qualified_func_name() const { return "current_role()"; } - String *val_str(String *) - { - DBUG_ASSERT(fixed == 1); - return null_value ? NULL : &str_value; - } - bool check_vcol_func_processor(void *arg) - { - - context= 0; - return mark_unsupported_function(fully_qualified_func_name(), arg, - VCOL_SESSION_FUNC); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_soundex :public Item_str_func -{ - String tmp_value; -public: - Item_func_soundex(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "soundex"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_elt :public Item_str_func -{ -public: - Item_func_elt(THD *thd, List &list): Item_str_func(thd, list) {} - double val_real(); - longlong val_int(); - String *val_str(String *str); - bool fix_length_and_dec(); - const char *func_name() const { return "elt"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_make_set :public Item_str_func -{ - String tmp_str; - -public: - Item_func_make_set(THD *thd, List &list): Item_str_func(thd, list) {} - String *val_str(String *str); - bool fix_length_and_dec(); - const char *func_name() const { return "make_set"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_format :public Item_str_ascii_func -{ - const MY_LOCALE *locale; -public: - Item_func_format(THD *thd, Item *org, Item *dec): - Item_str_ascii_func(thd, org, dec) {} - Item_func_format(THD *thd, Item *org, Item *dec, Item *lang): - Item_str_ascii_func(thd, org, dec, lang) {} - - String *val_str_ascii(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "format"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_char :public Item_str_func -{ -public: - Item_func_char(THD *thd, List &list): Item_str_func(thd, list) - { collation.set(&my_charset_bin); } - Item_func_char(THD *thd, List &list, CHARSET_INFO *cs): - Item_str_func(thd, list) - { collation.set(cs); } - Item_func_char(THD *thd, Item *arg1, CHARSET_INFO *cs): - Item_str_func(thd, arg1) - { collation.set(cs); } - String *val_str(String *); - void append_char(String * str, int32 num); - bool fix_length_and_dec() - { - max_length= arg_count * 4; - return FALSE; - } - const char *func_name() const { return "char"; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_chr :public Item_func_char -{ -public: - Item_func_chr(THD *thd, Item *arg1, CHARSET_INFO *cs): - Item_func_char(thd, arg1, cs) {} - String *val_str(String *); - bool fix_length_and_dec() - { - max_length= 4; - return FALSE; - } - const char *func_name() const { return "chr"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_repeat :public Item_str_func -{ - String tmp_value; -public: - Item_func_repeat(THD *thd, Item *arg1, Item *arg2): - Item_str_func(thd, arg1, arg2) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "repeat"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_space :public Item_str_func -{ -public: - Item_func_space(THD *thd, Item *arg1): Item_str_func(thd, arg1) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "space"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_binlog_gtid_pos :public Item_str_func -{ -public: - Item_func_binlog_gtid_pos(THD *thd, Item *arg1, Item *arg2): - Item_str_func(thd, arg1, arg2) {} - String *val_str(String *); - bool fix_length_and_dec(); - const char *func_name() const { return "binlog_gtid_pos"; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_pad: public Item_str_func -{ -protected: - String tmp_value, pad_str; -public: - Item_func_pad(THD *thd, Item *arg1, Item *arg2, Item *arg3): - Item_str_func(thd, arg1, arg2, arg3) {} - Item_func_pad(THD *thd, Item *arg1, Item *arg2): - Item_str_func(thd, arg1, arg2) {} - bool fix_length_and_dec(); -}; - - -class Item_func_rpad :public Item_func_pad -{ -public: - Item_func_rpad(THD *thd, Item *arg1, Item *arg2, Item *arg3): - Item_func_pad(thd, arg1, arg2, arg3) {} - Item_func_rpad(THD *thd, Item *arg1, Item *arg2): - Item_func_pad(thd, arg1, arg2) {} - String *val_str(String *); - const char *func_name() const { return "rpad"; } - Sql_mode_dependency value_depends_on_sql_mode() const; - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_rpad_oracle :public Item_func_rpad -{ - String *make_empty_result() - { null_value= 1; return NULL; } -public: - Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2, Item *arg3): - Item_func_rpad(thd, arg1, arg2, arg3) {} - Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2): - Item_func_rpad(thd, arg1, arg2) {} - bool fix_length_and_dec() - { - bool res= Item_func_rpad::fix_length_and_dec(); - maybe_null= true; - return res; - } - const char *func_name() const { return "rpad_oracle"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_lpad :public Item_func_pad -{ -public: - Item_func_lpad(THD *thd, Item *arg1, Item *arg2, Item *arg3): - Item_func_pad(thd, arg1, arg2, arg3) {} - Item_func_lpad(THD *thd, Item *arg1, Item *arg2): - Item_func_pad(thd, arg1, arg2) {} - String *val_str(String *); - const char *func_name() const { return "lpad"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_lpad_oracle :public Item_func_lpad -{ - String *make_empty_result() - { null_value= 1; return NULL; } -public: - Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2, Item *arg3): - Item_func_lpad(thd, arg1, arg2, arg3) {} - Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2): - Item_func_lpad(thd, arg1, arg2) {} - bool fix_length_and_dec() - { - bool res= Item_func_lpad::fix_length_and_dec(); - maybe_null= true; - return res; - } - const char *func_name() const { return "lpad_oracle"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_conv :public Item_str_func -{ -public: - Item_func_conv(THD *thd, Item *a, Item *b, Item *c): - Item_str_func(thd, a, b, c) {} - const char *func_name() const { return "conv"; } - String *val_str(String *); - bool fix_length_and_dec() - { - collation.set(default_charset()); - fix_char_length(64); - maybe_null= 1; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_hex :public Item_str_ascii_checksum_func -{ -protected: - String tmp_value; - /* - Calling arg[0]->type_handler() can be expensive on every row. - It's a virtual method, and in case if args[0] is a complex Item, - its type_handler() can call more virtual methods. - So let's cache it during fix_length_and_dec(). - */ - const Type_handler *m_arg0_type_handler; -public: - Item_func_hex(THD *thd, Item *a): - Item_str_ascii_checksum_func(thd, a), m_arg0_type_handler(NULL) {} - const char *func_name() const { return "hex"; } - String *val_str_ascii_from_val_int(String *str); - String *val_str_ascii_from_val_real(String *str); - String *val_str_ascii_from_val_str(String *str); - String *val_str_ascii(String *str) - { - DBUG_ASSERT(fixed); - return m_arg0_type_handler->Item_func_hex_val_str_ascii(this, str); - } - bool fix_length_and_dec() - { - collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); - decimals=0; - fix_char_length(args[0]->max_length * 2); - m_arg0_type_handler= args[0]->type_handler(); - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_unhex :public Item_str_func -{ - String tmp_value; -public: - Item_func_unhex(THD *thd, Item *a): Item_str_func(thd, a) - { - /* there can be bad hex strings */ - maybe_null= 1; - } - const char *func_name() const { return "unhex"; } - String *val_str(String *); - bool fix_length_and_dec() - { - collation.set(&my_charset_bin); - decimals=0; - max_length=(1+args[0]->max_length)/2; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -#ifndef DBUG_OFF -class Item_func_like_range :public Item_str_func -{ -protected: - String min_str; - String max_str; - const bool is_min; -public: - Item_func_like_range(THD *thd, Item *a, Item *b, bool is_min_arg): - Item_str_func(thd, a, b), is_min(is_min_arg) - { maybe_null= 1; } - String *val_str(String *); - bool fix_length_and_dec() - { - collation.set(args[0]->collation); - decimals=0; - max_length= MAX_BLOB_WIDTH; - return FALSE; - } -}; - - -class Item_func_like_range_min :public Item_func_like_range -{ -public: - Item_func_like_range_min(THD *thd, Item *a, Item *b): - Item_func_like_range(thd, a, b, true) { } - const char *func_name() const { return "like_range_min"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_like_range_max :public Item_func_like_range -{ -public: - Item_func_like_range_max(THD *thd, Item *a, Item *b): - Item_func_like_range(thd, a, b, false) { } - const char *func_name() const { return "like_range_max"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; -#endif - - -class Item_func_binary :public Item_str_func -{ -public: - Item_func_binary(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *a) - { - DBUG_ASSERT(fixed == 1); - String *tmp=args[0]->val_str(a); - null_value=args[0]->null_value; - if (tmp) - tmp->set_charset(&my_charset_bin); - return tmp; - } - bool fix_length_and_dec() - { - collation.set(&my_charset_bin); - max_length=args[0]->max_length; - return FALSE; - } - void print(String *str, enum_query_type query_type); - const char *func_name() const { return "cast_as_binary"; } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_load_file :public Item_str_func -{ - String tmp_value; -public: - Item_load_file(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *); - const char *func_name() const { return "load_file"; } - bool fix_length_and_dec() - { - collation.set(&my_charset_bin, DERIVATION_COERCIBLE); - maybe_null=1; - max_length=MAX_BLOB_WIDTH; - return FALSE; - } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_export_set: public Item_str_func -{ - public: - Item_func_export_set(THD *thd, Item *a, Item *b, Item* c): - Item_str_func(thd, a, b, c) {} - Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d): - Item_str_func(thd, a, b, c, d) {} - Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d, Item* e): - Item_str_func(thd, a, b, c, d, e) {} - String *val_str(String *str); - bool fix_length_and_dec(); - const char *func_name() const { return "export_set"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_quote :public Item_str_func -{ - String tmp_value; -public: - Item_func_quote(THD *thd, Item *a): Item_str_func(thd, a) {} - const char *func_name() const { return "quote"; } - String *val_str(String *); - bool fix_length_and_dec() - { - collation.set(args[0]->collation); - ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 + - 2 * collation.collation->mbmaxlen; - max_length= (uint32) MY_MIN(max_result_length, MAX_BLOB_WIDTH); - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_conv_charset :public Item_str_func -{ - bool use_cached_value; - String tmp_value; -public: - bool safe; - Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs): - Item_str_func(thd, a) - { - collation.set(cs, DERIVATION_IMPLICIT); - use_cached_value= 0; safe= 0; - } - Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs, bool cache_if_const): - Item_str_func(thd, a) - { - collation.set(cs, DERIVATION_IMPLICIT); - if (cache_if_const && args[0]->const_item() && !args[0]->is_expensive()) - { - uint errors= 0; - String tmp, *str= args[0]->val_str(&tmp); - if (!str || str_value.copy(str->ptr(), str->length(), - str->charset(), cs, &errors)) - null_value= 1; - use_cached_value= 1; - str_value.mark_as_const(); - safe= (errors == 0); - } - else - { - use_cached_value= 0; - /* - Conversion from and to "binary" is safe. - Conversion to Unicode is safe. - Conversion from an expression with the ASCII repertoire - to any character set that can store characters U+0000..U+007F - is safe: - - All supported multibyte character sets can store U+0000..U+007F - - All supported 7bit character sets can store U+0000..U+007F - except those marked with MY_CS_NONASCII (e.g. swe7). - Other kind of conversions are potentially lossy. - */ - safe= (args[0]->collation.collation == &my_charset_bin || - cs == &my_charset_bin || - (cs->state & MY_CS_UNICODE) || - (args[0]->collation.repertoire == MY_REPERTOIRE_ASCII && - (cs->mbmaxlen > 1 || !(cs->state & MY_CS_NONASCII)))); - } - } - bool is_json_type() { return args[0]->is_json_type(); } - String *val_str(String *); - longlong val_int() - { - if (args[0]->result_type() == STRING_RESULT) - return Item_str_func::val_int(); - longlong res= args[0]->val_int(); - if ((null_value= args[0]->null_value)) - return 0; - return res; - } - double val_real() - { - if (args[0]->result_type() == STRING_RESULT) - return Item_str_func::val_real(); - double res= args[0]->val_real(); - if ((null_value= args[0]->null_value)) - return 0; - return res; - } - my_decimal *val_decimal(my_decimal *d) - { - if (args[0]->result_type() == STRING_RESULT) - return Item_str_func::val_decimal(d); - my_decimal *res= args[0]->val_decimal(d); - if ((null_value= args[0]->null_value)) - return NULL; - return res; - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - if (args[0]->result_type() == STRING_RESULT) - return Item_str_func::get_date(thd, ltime, fuzzydate); - bool res= args[0]->get_date(thd, ltime, fuzzydate); - if ((null_value= args[0]->null_value)) - return 1; - return res; - } - bool fix_length_and_dec(); - const char *func_name() const { return "convert"; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_set_collation :public Item_str_func -{ - CHARSET_INFO *m_set_collation; -public: - Item_func_set_collation(THD *thd, Item *a, CHARSET_INFO *set_collation): - Item_str_func(thd, a), m_set_collation(set_collation) {} - String *val_str(String *); - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const; - const char *func_name() const { return "collate"; } - enum precedence precedence() const { return COLLATE_PRECEDENCE; } - enum Functype functype() const { return COLLATE_FUNC; } - void print(String *str, enum_query_type query_type); - Item_field *field_for_view_update() - { - /* this function is transparent for view updating */ - return args[0]->field_for_view_update(); - } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_expr_str_metadata :public Item_str_func -{ -public: - Item_func_expr_str_metadata(THD *thd, Item *a): Item_str_func(thd, a) { } - bool fix_length_and_dec() - { - collation.set(system_charset_info); - max_length= 64 * collation.collation->mbmaxlen; // should be enough - maybe_null= 0; - return FALSE; - }; - table_map not_null_tables() const { return 0; } - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { return this; } - bool const_item() const { return true; } -}; - - -class Item_func_charset :public Item_func_expr_str_metadata -{ -public: - Item_func_charset(THD *thd, Item *a) - :Item_func_expr_str_metadata(thd, a) { } - String *val_str(String *); - const char *func_name() const { return "charset"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_collation :public Item_func_expr_str_metadata -{ -public: - Item_func_collation(THD *thd, Item *a) - :Item_func_expr_str_metadata(thd, a) {} - String *val_str(String *); - const char *func_name() const { return "collation"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_weight_string :public Item_str_func -{ - String tmp_value; - uint flags; - uint nweights; - uint result_length; -public: - Item_func_weight_string(THD *thd, Item *a, uint result_length_arg, - uint nweights_arg, uint flags_arg): - Item_str_func(thd, a) - { - nweights= nweights_arg; - flags= flags_arg; - result_length= result_length_arg; - } - const char *func_name() const { return "weight_string"; } - String *val_str(String *); - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const - { - if (!Item_str_func::eq(item, binary_cmp)) - return false; - Item_func_weight_string *that= (Item_func_weight_string *)item; - return this->flags == that->flags && - this->nweights == that->nweights && - this->result_length == that->result_length; - } - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) - { return this; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_crc32 :public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_str(func_name()); } - String value; -public: - Item_func_crc32(THD *thd, Item *a): Item_long_func(thd, a) - { unsigned_flag= 1; } - const char *func_name() const { return "crc32"; } - bool fix_length_and_dec() { max_length=10; return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_uncompressed_length : public Item_long_func_length -{ - String value; -public: - Item_func_uncompressed_length(THD *thd, Item *a) - :Item_long_func_length(thd, a) {} - const char *func_name() const{return "uncompressed_length";} - bool fix_length_and_dec() { max_length=10; maybe_null= true; return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -#ifdef HAVE_COMPRESS -#define ZLIB_DEPENDED_FUNCTION ; -#else -#define ZLIB_DEPENDED_FUNCTION { null_value=1; return 0; } -#endif - -class Item_func_compress: public Item_str_binary_checksum_func -{ - String tmp_value; -public: - Item_func_compress(THD *thd, Item *a) - :Item_str_binary_checksum_func(thd, a) {} - bool fix_length_and_dec() - { - max_length= (args[0]->max_length * 120) / 100 + 12; - return FALSE; - } - const char *func_name() const{return "compress";} - String *val_str(String *) ZLIB_DEPENDED_FUNCTION - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_uncompress: public Item_str_binary_checksum_func -{ - String tmp_value; -public: - Item_func_uncompress(THD *thd, Item *a) - :Item_str_binary_checksum_func(thd, a) {} - bool fix_length_and_dec() - { - maybe_null= 1; max_length= MAX_BLOB_WIDTH; - return FALSE; - } - const char *func_name() const{return "uncompress";} - String *val_str(String *) ZLIB_DEPENDED_FUNCTION - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_uuid: public Item_str_func -{ -public: - Item_func_uuid(THD *thd): Item_str_func(thd) {} - bool fix_length_and_dec() - { - collation.set(DTCollation_numeric()); - fix_char_length(MY_UUID_STRING_LENGTH); - return FALSE; - } - bool const_item() const { return false; } - table_map used_tables() const { return RAND_TABLE_BIT; } - const char *func_name() const{ return "uuid"; } - String *val_str(String *); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_dyncol_create: public Item_str_func -{ -protected: - DYNCALL_CREATE_DEF *defs; - DYNAMIC_COLUMN_VALUE *vals; - uint *keys_num; - LEX_STRING *keys_str; - bool names, force_names; - bool prepare_arguments(THD *thd, bool force_names); - void print_arguments(String *str, enum_query_type query_type); -public: - Item_func_dyncol_create(THD *thd, List &args, DYNCALL_CREATE_DEF *dfs); - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - const char *func_name() const{ return "column_create"; } - String *val_str(String *); - void print(String *str, enum_query_type query_type); - enum Functype functype() const { return DYNCOL_FUNC; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_dyncol_add: public Item_func_dyncol_create -{ -public: - Item_func_dyncol_add(THD *thd, List &args_arg, DYNCALL_CREATE_DEF *dfs): - Item_func_dyncol_create(thd, args_arg, dfs) - {} - const char *func_name() const{ return "column_add"; } - String *val_str(String *); - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_dyncol_json: public Item_str_func -{ -public: - Item_func_dyncol_json(THD *thd, Item *str): Item_str_func(thd, str) - {collation.set(DYNCOL_UTF);} - const char *func_name() const{ return "column_json"; } - String *val_str(String *); - bool fix_length_and_dec() - { - max_length= MAX_BLOB_WIDTH; - maybe_null= 1; - decimals= 0; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -/* - The following functions is always called from an Item_cast function -*/ - -class Item_dyncol_get: public Item_str_func -{ -public: - Item_dyncol_get(THD *thd, Item *str, Item *num): Item_str_func(thd, str, num) - {} - bool fix_length_and_dec() - { maybe_null= 1;; max_length= MAX_BLOB_WIDTH; return FALSE; } - /* Mark that collation can change between calls */ - bool dynamic_result() { return 1; } - - const char *func_name() const { return "column_get"; } - String *val_str(String *); - longlong val_int(); - longlong val_int_signed_typecast() - { - unsigned_flag= false; // Mark that we want to have a signed value - longlong value= val_int(); // val_int() can change unsigned_flag - if (!null_value && unsigned_flag && value < 0) - push_note_converted_to_negative_complement(current_thd); - return value; - } - longlong val_int_unsigned_typecast() - { - unsigned_flag= true; // Mark that we want to have an unsigned value - longlong value= val_int(); // val_int() can change unsigned_flag - if (!null_value && unsigned_flag == 0 && value < 0) - push_note_converted_to_positive_complement(current_thd); - return value; - } - double val_real(); - my_decimal *val_decimal(my_decimal *); - bool get_dyn_value(THD *thd, DYNAMIC_COLUMN_VALUE *val, String *tmp); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_dyncol_list: public Item_str_func -{ -public: - Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str) - {collation.set(DYNCOL_UTF);} - bool fix_length_and_dec() - { maybe_null= 1; max_length= MAX_BLOB_WIDTH; return FALSE; }; - const char *func_name() const{ return "column_list"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -/* - this is used by JOIN_TAB::keep_current_rowid - and stores handler::position(). - It has nothing to do with _rowid pseudo-column, that the parser supports. -*/ -class Item_temptable_rowid :public Item_str_func -{ -public: - TABLE *table; - Item_temptable_rowid(TABLE *table_arg); - const Type_handler *type_handler() const { return &type_handler_string; } - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) - { return create_table_field_from_handler(root, table); } - String *val_str(String *str); - enum Functype functype() const { return TEMPTABLE_ROWID; } - const char *func_name() const { return ""; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; -#ifdef WITH_WSREP - -#include "wsrep_api.h" - -class Item_func_wsrep_last_written_gtid: public Item_str_ascii_func -{ - String gtid_str; -public: - Item_func_wsrep_last_written_gtid(THD *thd): Item_str_ascii_func(thd) {} - const char *func_name() const { return "wsrep_last_written_gtid"; } - String *val_str_ascii(String *); - bool fix_length_and_dec() - { - max_length= WSREP_GTID_STR_LEN; - maybe_null= true; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_wsrep_last_seen_gtid: public Item_str_ascii_func -{ - String gtid_str; -public: - Item_func_wsrep_last_seen_gtid(THD *thd): Item_str_ascii_func(thd) {} - const char *func_name() const { return "wsrep_last_seen_gtid"; } - String *val_str_ascii(String *); - bool fix_length_and_dec() - { - max_length= WSREP_GTID_STR_LEN; - maybe_null= true; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_wsrep_sync_wait_upto: public Item_int_func -{ - String value; -public: - Item_func_wsrep_sync_wait_upto(THD *thd, Item *a): Item_int_func(thd, a) {} - Item_func_wsrep_sync_wait_upto(THD *thd, Item *a, Item* b): Item_int_func(thd, a, b) {} - const Type_handler *type_handler() const { return &type_handler_string; } - const char *func_name() const { return "wsrep_sync_wait_upto_gtid"; } - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; -#endif /* WITH_WSREP */ - -#endif /* ITEM_STRFUNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_subselect.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_subselect.h deleted file mode 100644 index ec4398b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_subselect.h +++ /dev/null @@ -1,1533 +0,0 @@ -#ifndef ITEM_SUBSELECT_INCLUDED -#define ITEM_SUBSELECT_INCLUDED - -/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* subselect Item */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include - -class st_select_lex; -class st_select_lex_unit; -class JOIN; -class select_result_interceptor; -class subselect_engine; -class subselect_hash_sj_engine; -class Item_bool_func2; -class Comp_creator; -class With_element; -class Field_pair; - -typedef class st_select_lex SELECT_LEX; - -/** - Convenience typedef used in this file, and further used by any files - including this file. -*/ -typedef Comp_creator* (*chooser_compare_func_creator)(bool invert); -class Cached_item; - -/* base class for subselects */ - -class Item_subselect :public Item_result_field, - protected Used_tables_and_const_cache, - protected With_sum_func_cache -{ - bool value_assigned; /* value already assigned to subselect */ - bool own_engine; /* the engine was not taken from other Item_subselect */ -protected: - /* thread handler, will be assigned in fix_fields only */ - THD *thd; - /* old engine if engine was changed */ - subselect_engine *old_engine; - /* allowed number of columns (1 for single value subqueries) */ - uint max_columns; - /* where subquery is placed */ - enum_parsing_place parsing_place; - /* work with 'substitution' */ - bool have_to_be_excluded; - - bool inside_first_fix_fields; - bool done_first_fix_fields; - Item *expr_cache; - /* - Set to TRUE if at optimization or execution time we determine that this - item's value is a constant. We need this member because it is not possible - to substitute 'this' with a constant item. - */ - bool forced_const; - /* Set to the result of the last call of is_expensive() */ - bool expensive_fl; -#ifndef DBUG_OFF - /* Count the number of times this subquery predicate has been executed. */ - uint exec_counter; -#endif -public: - /* - Used inside Item_subselect::fix_fields() according to this scenario: - > Item_subselect::fix_fields - > engine->prepare - > child_join->prepare - (Here we realize we need to do the rewrite and set - substitution= some new Item, eg. Item_in_optimizer ) - < child_join->prepare - < engine->prepare - *ref= substitution; - substitution= NULL; - < Item_subselect::fix_fields - */ - /* TODO make this protected member again. */ - Item *substitution; - /* engine that perform execution of subselect (single select or union) */ - /* TODO make this protected member again. */ - subselect_engine *engine; - /* unit of subquery */ - st_select_lex_unit *unit; - /* Cached buffers used when calling filesort in sub queries */ - Filesort_buffer filesort_buffer; - LEX_STRING sortbuffer; - /* A reference from inside subquery predicate to somewhere outside of it */ - class Ref_to_outside : public Sql_alloc - { - public: - st_select_lex *select; /* Select where the reference is pointing to */ - /* - What is being referred. This may be NULL when we're referring to an - aggregate function. - */ - Item *item; - }; - /* - References from within this subquery to somewhere outside of it (i.e. to - parent select, grandparent select, etc) - */ - List upper_refs; - st_select_lex *parent_select; - - /* - TRUE<=>Table Elimination has made it redundant to evaluate this select - (and so it is not part of QEP, etc) - */ - bool eliminated; - - /* subquery is transformed */ - bool changed; - - /* TRUE <=> The underlying SELECT is correlated w.r.t some ancestor select */ - bool is_correlated; - - /* - TRUE <=> the subquery contains a recursive reference in the FROM list - of one of its selects. In this case some of subquery optimization - strategies cannot be applied for the subquery; - */ - bool with_recursive_reference; - - /* To link Item_subselects containing references to the same recursive CTE */ - Item_subselect *next_with_rec_ref; - - enum subs_type {UNKNOWN_SUBS, SINGLEROW_SUBS, - EXISTS_SUBS, IN_SUBS, ALL_SUBS, ANY_SUBS}; - - Item_subselect(THD *thd); - - virtual subs_type substype() { return UNKNOWN_SUBS; } - bool is_exists_predicate() - { - return substype() == Item_subselect::EXISTS_SUBS; - } - bool is_in_predicate() - { - return get_IN_subquery() != NULL; - } - - /* - We need this method, because some compilers do not allow 'this' - pointer in constructor initialization list, but we need to pass a pointer - to subselect Item class to select_result_interceptor's constructor. - */ - virtual void init (st_select_lex *select_lex, - select_result_interceptor *result); - - ~Item_subselect(); - void cleanup() override; - virtual void reset() - { - eliminated= FALSE; - null_value= 1; - } - /** - Set the subquery result to a default value consistent with the semantics of - the result row produced for queries with implicit grouping. - */ - void no_rows_in_result() override= 0; - virtual bool select_transformer(JOIN *join); - bool assigned() { return value_assigned; } - void assigned(bool a) { value_assigned= a; } - enum Type type() const override; - bool is_null() override - { - update_null_value(); - return null_value; - } - bool fix_fields(THD *thd, Item **ref) override; - bool with_subquery() const override { DBUG_ASSERT(fixed); return true; } - bool with_sum_func() const override { return m_with_sum_func; } - With_sum_func_cache* get_with_sum_func_cache() override { return this; } - bool mark_as_dependent(THD *thd, st_select_lex *select, Item *item); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, - bool merge) override; - void recalc_used_tables(st_select_lex *new_parent, bool after_pullout); - virtual bool exec(); - /* - If subquery optimization or execution determines that the subquery has - an empty result, mark the subquery predicate as a constant value. - */ - void make_const() - { - used_tables_cache= 0; - const_item_cache= 0; - forced_const= TRUE; - } - virtual bool fix_length_and_dec(); - table_map used_tables() const override; - table_map not_null_tables() const override { return 0; } - bool const_item() const override; - inline table_map get_used_tables_cache() { return used_tables_cache; } - Item *get_tmp_table_item(THD *thd) override; - void update_used_tables() override; - void print(String *str, enum_query_type query_type) override; - virtual bool have_guarded_conds() { return FALSE; } - bool change_engine(subselect_engine *eng) - { - old_engine= engine; - engine= eng; - return eng == 0; - } - bool engine_changed(subselect_engine *eng) { return engine != eng; } - /* - True if this subquery has been already evaluated. Implemented only for - single select and union subqueries only. - */ - bool is_evaluated() const; - bool is_uncacheable() const; - bool is_expensive() override; - - /* - Used by max/min subquery to initialize value presence registration - mechanism. Engine call this method before rexecution query. - */ - virtual void reset_value_registration() {} - enum_parsing_place place() { return parsing_place; } - bool walk(Item_processor processor, bool walk_subquery, void *arg) override; - bool unknown_splocal_processor(void *arg) override; - bool mark_as_eliminated_processor(void *arg) override; - bool eliminate_subselect_processor(void *arg) override; - bool set_fake_select_as_master_processor(void *arg) override; - bool enumerate_field_refs_processor(void *arg) override; - bool check_vcol_func_processor(void *arg) override - { - return mark_unsupported_function("select ...", arg, VCOL_IMPOSSIBLE); - } - /** - Callback to test if an IN predicate is expensive. - - @notes - The return value affects the behavior of make_cond_for_table(). - - @retval TRUE if the predicate is expensive - @retval FALSE otherwise - */ - bool is_expensive_processor(void *arg) override { return is_expensive(); } - - /** - Get the SELECT_LEX structure associated with this Item. - @return the SELECT_LEX structure associated with this Item - */ - st_select_lex* get_select_lex(); - bool expr_cache_is_needed(THD *) override; - void get_cache_parameters(List ¶meters) override; - bool is_subquery_processor (void *opt_arg) override { return 1; } - bool exists2in_processor(void *opt_arg) override { return 0; } - bool limit_index_condition_pushdown_processor(void *opt_arg) override - { - return TRUE; - } - - void register_as_with_rec_ref(With_element *with_elem); - void init_expr_cache_tracker(THD *thd); - - Item* build_clone(THD *thd) override { return 0; } - Item* get_copy(THD *thd) override { return 0; } - - bool wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl); - - friend class select_result_interceptor; - friend class Item_in_optimizer; - friend bool Item_field::fix_fields(THD *, Item **); - friend int Item_field::fix_outer_field(THD *, Field **, Item **); - friend bool Item_ref::fix_fields(THD *, Item **); - friend void mark_select_range_as_dependent(THD*, - st_select_lex*, st_select_lex*, - Field*, Item*, Item_ident*); - friend bool convert_join_subqueries_to_semijoins(JOIN *join); -}; - -/* single value subselect */ - -class Item_cache; -class Item_singlerow_subselect :public Item_subselect -{ -protected: - Item_cache *value, **row; -public: - Item_singlerow_subselect(THD *thd_arg, st_select_lex *select_lex); - Item_singlerow_subselect(THD *thd_arg): Item_subselect(thd_arg), value(0), row (0) - {} - - void cleanup(); - subs_type substype() { return SINGLEROW_SUBS; } - - void reset(); - void no_rows_in_result(); - bool select_transformer(JOIN *join); - void store(uint i, Item* item); - double val_real(); - longlong val_int (); - String *val_str (String *); - bool val_native(THD *thd, Native *); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - const Type_handler *type_handler() const; - bool fix_length_and_dec(); - - uint cols() const; - Item* element_index(uint i) { return reinterpret_cast(row[i]); } - Item** addr(uint i) { return (Item**)row + i; } - bool check_cols(uint c); - bool null_inside(); - void bring_value(); - - /** - This method is used to implement a special case of semantic tree - rewriting, mandated by a SQL:2003 exception in the specification. - The only caller of this method is handle_sql2003_note184_exception(), - see the code there for more details. - Note that this method breaks the object internal integrity, by - removing it's association with the corresponding SELECT_LEX, - making this object orphan from the parse tree. - No other method, beside the destructor, should be called on this - object, as it is now invalid. - @return the SELECT_LEX structure that was given in the constructor. - */ - st_select_lex* invalidate_and_restore_select_lex(); - - Item* expr_cache_insert_transformer(THD *thd, uchar *unused); - - friend class select_singlerow_subselect; -}; - -/* used in static ALL/ANY optimization */ -class select_max_min_finder_subselect; -class Item_maxmin_subselect :public Item_singlerow_subselect -{ -protected: - bool max; - bool was_values; // Set if we have found at least one row -public: - Item_maxmin_subselect(THD *thd, Item_subselect *parent, - st_select_lex *select_lex, bool max); - virtual void print(String *str, enum_query_type query_type); - void cleanup(); - bool any_value() { return was_values; } - void register_value() { was_values= TRUE; } - void reset_value_registration() { was_values= FALSE; } - void no_rows_in_result(); -}; - -/* exists subselect */ - -class Item_exists_subselect :public Item_subselect -{ -protected: - Item_func_not *upper_not; - bool value; /* value of this item (boolean: exists/not-exists) */ - bool abort_on_null; - - void init_length_and_dec(); - bool select_prepare_to_be_in(); - -public: - /* - Used by subquery optimizations to keep track about in which clause this - subquery predicate is located: - NO_JOIN_NEST - the predicate is an AND-part of the WHERE - join nest pointer - the predicate is an AND-part of ON expression - of a join nest - NULL - for all other locations - */ - TABLE_LIST *emb_on_expr_nest; - /** - Reference on the Item_in_optimizer wrapper of this subquery - */ - Item_in_optimizer *optimizer; - /* true if we got this from EXISTS or to IN */ - bool exists_transformed; - - Item_exists_subselect(THD *thd_arg, st_select_lex *select_lex); - Item_exists_subselect(THD *thd_arg): - Item_subselect(thd_arg), upper_not(NULL), abort_on_null(0), - emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0) - {} - - subs_type substype() override { return EXISTS_SUBS; } - void reset() override - { - eliminated= FALSE; - value= 0; - } - void no_rows_in_result() override; - - const Type_handler *type_handler() const override - { - return &type_handler_bool; - } - longlong val_int() override; - double val_real() override; - String *val_str(String*) override; - my_decimal *val_decimal(my_decimal *) override; - bool val_bool() override; - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override - { return get_date_from_int(thd, ltime, fuzzydate); } - bool fix_fields(THD *thd, Item **ref) override; - bool fix_length_and_dec() override; - void print(String *str, enum_query_type query_type) override; - bool select_transformer(JOIN *join) override; - void top_level_item() override { abort_on_null=1; } - bool is_top_level_item() const override { return abort_on_null; } - bool exists2in_processor(void *opt_arg) override; - - Item* expr_cache_insert_transformer(THD *thd, uchar *unused) override; - - void mark_as_condition_AND_part(TABLE_LIST *embedding) override - { - emb_on_expr_nest= embedding; - } - void under_not(Item_func_not *upper) override { upper_not= upper; }; - - void set_exists_transformed() { exists_transformed= TRUE; } - - friend class select_exists_subselect; - friend class subselect_uniquesubquery_engine; - friend class subselect_indexsubquery_engine; -}; - - -TABLE_LIST * const NO_JOIN_NEST=(TABLE_LIST*)0x1; - -/* - Possible methods to execute an IN predicate. These are set by the optimizer - based on user-set optimizer switches, semantic analysis and cost comparison. -*/ -#define SUBS_NOT_TRANSFORMED 0 /* No execution method was chosen for this IN. */ -/* The Final decision about the strategy is made. */ -#define SUBS_STRATEGY_CHOSEN 1 -#define SUBS_SEMI_JOIN 2 /* IN was converted to semi-join. */ -#define SUBS_IN_TO_EXISTS 4 /* IN was converted to correlated EXISTS. */ -#define SUBS_MATERIALIZATION 8 /* Execute IN via subquery materialization. */ -/* Partial matching substrategies of MATERIALIZATION. */ -#define SUBS_PARTIAL_MATCH_ROWID_MERGE 16 -#define SUBS_PARTIAL_MATCH_TABLE_SCAN 32 -/* ALL/ANY will be transformed with max/min optimization */ -/* The subquery has not aggregates, transform it into a MAX/MIN query. */ -#define SUBS_MAXMIN_INJECTED 64 -/* The subquery has aggregates, use a special max/min subselect engine. */ -#define SUBS_MAXMIN_ENGINE 128 - - -/** - Representation of IN subquery predicates of the form - "left_expr IN (SELECT ...)". - - @details - This class has: - - A "subquery execution engine" (as a subclass of Item_subselect) that allows - it to evaluate subqueries. (and this class participates in execution by - having was_null variable where part of execution result is stored. - - Transformation methods (todo: more on this). - - This class is not used directly, it is "wrapped" into Item_in_optimizer - which provides some small bits of subquery evaluation. -*/ - -class Item_in_subselect :public Item_exists_subselect -{ -protected: - /* - Cache of the left operand of the subquery predicate. Allocated in the - runtime memory root, for each execution, thus need not be freed. - */ - List *left_expr_cache; - bool first_execution; - - /* - expr & optimizer used in subselect rewriting to store Item for - all JOIN in UNION - */ - Item *expr; - bool was_null; - /* A bitmap of possible execution strategies for an IN predicate. */ - uchar in_strategy; -protected: - /* Used to trigger on/off conditions that were pushed down to subselect */ - bool *pushed_cond_guards; - Comp_creator *func; - -protected: - bool init_cond_guards(); - bool select_in_like_transformer(JOIN *join); - bool single_value_transformer(JOIN *join); - bool row_value_transformer(JOIN * join); - bool fix_having(Item *having, st_select_lex *select_lex); - bool create_single_in_to_exists_cond(JOIN * join, - Item **where_item, - Item **having_item); - bool create_row_in_to_exists_cond(JOIN * join, - Item **where_item, - Item **having_item); - Item *left_expr; - /* - Important for PS/SP: left_expr_orig is the item that left_expr originally - pointed at. That item is allocated on the statement arena, while - left_expr could later be changed to something on the execution arena. - */ - Item *left_expr_orig; -public: - /* Priority of this predicate in the convert-to-semi-join-nest process. */ - int sj_convert_priority; - /* May be TRUE only for the candidates to semi-join conversion */ - bool do_not_convert_to_sj; - /* - Types of left_expr and subquery's select list allow to perform subquery - materialization. Currently, we set this to FALSE when it as well could - be TRUE. This is to be properly addressed with fix for BUG#36752. - */ - bool types_allow_materialization; - - /* - Same as above, but they also allow to scan the materialized table. - */ - bool sjm_scan_allowed; - - /* - JoinTaB Materialization (JTBM) members - */ - - /* - TRUE <=> This subselect has been converted into non-mergeable semi-join - table. - */ - bool is_jtbm_merged; - - /* (Applicable if is_jtbm_merged==TRUE) Time required to run the materialized join */ - double jtbm_read_time; - - /* (Applicable if is_jtbm_merged==TRUE) Number of output rows in materialized join */ - double jtbm_record_count; - - /* - (Applicable if is_jtbm_merged==TRUE) TRUE <=> The materialized subselect is - a degenerate subselect which produces 0 or 1 rows, which we know at - optimization phase. - Examples: - 1. subquery has "Impossible WHERE": - - SELECT * FROM ot WHERE ot.column IN (SELECT it.col FROM it WHERE 2 > 3) - - 2. Subquery produces one row which opt_sum.cc is able to get with one lookup: - - SELECT * FROM ot WHERE ot.column IN (SELECT MAX(it.key_col) FROM it) - */ - bool is_jtbm_const_tab; - - /* - (Applicable if is_jtbm_const_tab==TRUE) Whether the subquery has produced - the row (or not) - */ - bool jtbm_const_row_found; - - /* - TRUE<=>this is a flattenable semi-join, false otherwise. - */ - bool is_flattenable_semijoin; - - /* - TRUE<=>registered in the list of semijoins in outer select - */ - bool is_registered_semijoin; - - List corresponding_fields; - - /* - Used to determine how this subselect item is represented in the item tree, - in case there is a need to locate it there and replace with something else. - Two options are possible: - 1. This item is there 'as-is'. - 1. This item is wrapped within Item_in_optimizer. - */ - Item *original_item() - { - return (is_flattenable_semijoin && !exists_transformed ? - (Item*)this : - (Item*)optimizer); - } - - bool *get_cond_guard(int i) - { - return pushed_cond_guards ? pushed_cond_guards + i : NULL; - } - void set_cond_guard_var(int i, bool v) - { - if ( pushed_cond_guards) - pushed_cond_guards[i]= v; - } - bool have_guarded_conds() override { return MY_TEST(pushed_cond_guards); } - - Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery - - Item_in_subselect(THD *thd_arg, Item * left_expr, st_select_lex *select_lex); - Item_in_subselect(THD *thd_arg): - Item_exists_subselect(thd_arg), left_expr_cache(0), first_execution(TRUE), - in_strategy(SUBS_NOT_TRANSFORMED), - pushed_cond_guards(NULL), func(NULL), do_not_convert_to_sj(FALSE), - is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE), upper_item(0) {} - void cleanup() override; - subs_type substype() override { return IN_SUBS; } - void reset() override - { - eliminated= FALSE; - value= 0; - null_value= 0; - was_null= 0; - } - bool select_transformer(JOIN *join) override; - bool create_in_to_exists_cond(JOIN *join_arg); - bool inject_in_to_exists_cond(JOIN *join_arg); - - bool exec() override; - longlong val_int() override; - double val_real() override; - String *val_str(String*) override; - my_decimal *val_decimal(my_decimal *) override; - bool val_bool() override; - bool test_limit(st_select_lex_unit *unit); - void print(String *str, enum_query_type query_type) override; - enum precedence precedence() const override { return IN_PRECEDENCE; } - bool fix_fields(THD *thd, Item **ref) override; - bool fix_length_and_dec() override; - void fix_after_pullout(st_select_lex *new_parent, Item **ref, - bool merge) override; - bool const_item() const override - { - return Item_subselect::const_item() && left_expr->const_item(); - } - void update_used_tables() override; - bool setup_mat_engine(); - bool init_left_expr_cache(); - /* Inform 'this' that it was computed, and contains a valid result. */ - void set_first_execution() { if (first_execution) first_execution= FALSE; } - bool expr_cache_is_needed(THD *thd) override; - inline bool left_expr_has_null(); - - void disable_cond_guard_for_const_null_left_expr(int i) - { - if (left_expr->const_item() && !left_expr->is_expensive()) - { - if (left_expr->element_index(i)->is_null()) - set_cond_guard_var(i,FALSE); - } - } - - int optimize(double *out_rows, double *cost); - /* - Return the identifier that we could use to identify the subquery for the - user. - */ - int get_identifier(); - - void block_conversion_to_sj () { do_not_convert_to_sj= TRUE; } - - bool test_strategy(uchar strategy) - { return MY_TEST(in_strategy & strategy); } - - /** - Test that the IN strategy was chosen for execution. This is so - when the CHOSEN flag is ON, and there is no other strategy. - */ - bool test_set_strategy(uchar strategy) - { - DBUG_ASSERT(strategy == SUBS_SEMI_JOIN || - strategy == SUBS_IN_TO_EXISTS || - strategy == SUBS_MATERIALIZATION || - strategy == SUBS_PARTIAL_MATCH_ROWID_MERGE || - strategy == SUBS_PARTIAL_MATCH_TABLE_SCAN || - strategy == SUBS_MAXMIN_INJECTED || - strategy == SUBS_MAXMIN_ENGINE); - return ((in_strategy & SUBS_STRATEGY_CHOSEN) && - (in_strategy & ~SUBS_STRATEGY_CHOSEN) == strategy); - } - - bool is_set_strategy() - { return MY_TEST(in_strategy & SUBS_STRATEGY_CHOSEN); } - - bool has_strategy() - { return in_strategy != SUBS_NOT_TRANSFORMED; } - - void add_strategy (uchar strategy) - { - DBUG_ENTER("Item_in_subselect::add_strategy"); - DBUG_PRINT("enter", ("current: %u add: %u", - (uint) in_strategy, (uint) strategy)); - DBUG_ASSERT(strategy != SUBS_NOT_TRANSFORMED); - DBUG_ASSERT(!(strategy & SUBS_STRATEGY_CHOSEN)); - /* - TODO: PS re-execution breaks this condition, because - check_and_do_in_subquery_rewrites() is called for each reexecution - and re-adds the same strategies. - DBUG_ASSERT(!(in_strategy & SUBS_STRATEGY_CHOSEN)); - */ - in_strategy|= strategy; - DBUG_VOID_RETURN; - } - - void reset_strategy(uchar strategy) - { - DBUG_ENTER("Item_in_subselect::reset_strategy"); - DBUG_PRINT("enter", ("current: %u new: %u", - (uint) in_strategy, (uint) strategy)); - DBUG_ASSERT(strategy != SUBS_NOT_TRANSFORMED); - in_strategy= strategy; - DBUG_VOID_RETURN; - } - - void set_strategy(uchar strategy) - { - DBUG_ENTER("Item_in_subselect::set_strategy"); - DBUG_PRINT("enter", ("current: %u set: %u", - (uint) in_strategy, - (uint) (SUBS_STRATEGY_CHOSEN | strategy))); - /* Check that only one strategy is set for execution. */ - DBUG_ASSERT(strategy == SUBS_SEMI_JOIN || - strategy == SUBS_IN_TO_EXISTS || - strategy == SUBS_MATERIALIZATION || - strategy == SUBS_PARTIAL_MATCH_ROWID_MERGE || - strategy == SUBS_PARTIAL_MATCH_TABLE_SCAN || - strategy == SUBS_MAXMIN_INJECTED || - strategy == SUBS_MAXMIN_ENGINE); - in_strategy= (SUBS_STRATEGY_CHOSEN | strategy); - DBUG_VOID_RETURN; - } - - bool walk(Item_processor processor, bool walk_subquery, void *arg) override - { - return left_expr->walk(processor, walk_subquery, arg) || - Item_subselect::walk(processor, walk_subquery, arg); - } - - bool exists2in_processor(void *opt_arg __attribute__((unused))) override - { - return 0; - }; - - bool pushdown_cond_for_in_subquery(THD *thd, Item *cond); - - Item_in_subselect *get_IN_subquery() override - { return this; } - inline Item** left_exp_ptr() - { return &left_expr; } - inline Item* left_exp() const - { return left_expr; } - inline Item* left_exp_orig() const - { return left_expr_orig; } - - friend class Item_ref_null_helper; - friend class Item_is_not_null_test; - friend class Item_in_optimizer; - friend class subselect_indexsubquery_engine; - friend class subselect_hash_sj_engine; - friend class subselect_partial_match_engine; - friend class Item_exists_subselect; -}; - - -/* ALL/ANY/SOME subselect */ -class Item_allany_subselect :public Item_in_subselect -{ -public: - chooser_compare_func_creator func_creator; - bool all; - - Item_allany_subselect(THD *thd_arg, Item * left_expr, - chooser_compare_func_creator fc, - st_select_lex *select_lex, bool all); - - void cleanup(); - // only ALL subquery has upper not - subs_type substype() { return all?ALL_SUBS:ANY_SUBS; } - bool select_transformer(JOIN *join); - void create_comp_func(bool invert) { func= func_creator(invert); } - void print(String *str, enum_query_type query_type); - bool is_maxmin_applicable(JOIN *join); - bool transform_into_max_min(JOIN *join); - void no_rows_in_result(); -}; - - -class subselect_engine: public Sql_alloc, - public Type_handler_hybrid_field_type -{ -protected: - select_result_interceptor *result; /* results storage class */ - THD *thd; /* pointer to current THD */ - Item_subselect *item; /* item, that use this engine */ - bool maybe_null; /* may be null (first item in select) */ -public: - - enum enum_engine_type {ABSTRACT_ENGINE, SINGLE_SELECT_ENGINE, - UNION_ENGINE, UNIQUESUBQUERY_ENGINE, - INDEXSUBQUERY_ENGINE, HASH_SJ_ENGINE, - ROWID_MERGE_ENGINE, TABLE_SCAN_ENGINE}; - - subselect_engine(Item_subselect *si, - select_result_interceptor *res): - Type_handler_hybrid_field_type(&type_handler_varchar), - thd(NULL) - { - result= res; - item= si; - maybe_null= 0; - } - virtual ~subselect_engine() {}; // to satisfy compiler - virtual void cleanup()= 0; - - /* - Also sets "thd" for subselect_engine::result. - Should be called before prepare(). - */ - void set_thd(THD *thd_arg); - THD * get_thd() { return thd ? thd : current_thd; } - virtual int prepare(THD *)= 0; - virtual bool fix_length_and_dec(Item_cache** row)= 0; - /* - Execute the engine - - SYNOPSIS - exec() - - DESCRIPTION - Execute the engine. The result of execution is subquery value that is - either captured by previously set up select_result-based 'sink' or - stored somewhere by the exec() method itself. - - A required side effect: If at least one pushed-down predicate is - disabled, subselect_engine->no_rows() must return correct result after - the exec() call. - - RETURN - 0 - OK - 1 - Either an execution error, or the engine was "changed", and the - caller should call exec() again for the new engine. - */ - virtual int exec()= 0; - virtual uint cols() const= 0; /* return number of columns in select */ - virtual uint8 uncacheable()= 0; /* query is uncacheable */ - virtual void exclude()= 0; - virtual bool may_be_null() { return maybe_null; }; - virtual table_map upper_select_const_tables()= 0; - static table_map calc_const_tables(TABLE_LIST *); - static table_map calc_const_tables(List &list); - virtual void print(String *str, enum_query_type query_type)= 0; - virtual bool change_result(Item_subselect *si, - select_result_interceptor *result, - bool temp= FALSE)= 0; - virtual bool no_tables()= 0; - virtual bool is_executed() const { return FALSE; } - /* Check if subquery produced any rows during last query execution */ - virtual bool no_rows() = 0; - virtual enum_engine_type engine_type() { return ABSTRACT_ENGINE; } - virtual int get_identifier() { DBUG_ASSERT(0); return 0; } - virtual void force_reexecution() {} -protected: - bool set_row(List &item_list, Item_cache **row); -}; - -class subselect_single_select_engine: public subselect_engine -{ - bool prepared; /* simple subselect is prepared */ - bool executed; /* simple subselect is executed */ - st_select_lex *select_lex; /* corresponding select_lex */ - JOIN * join; /* corresponding JOIN structure */ -public: - subselect_single_select_engine(st_select_lex *select, - select_result_interceptor *result, - Item_subselect *item); - void cleanup(); - int prepare(THD *thd); - bool fix_length_and_dec(Item_cache** row); - int exec(); - uint cols() const; - uint8 uncacheable(); - void exclude(); - table_map upper_select_const_tables(); - void print (String *str, enum_query_type query_type); - bool change_result(Item_subselect *si, - select_result_interceptor *result, - bool temp); - bool no_tables(); - bool may_be_null(); - bool is_executed() const { return executed; } - bool no_rows(); - virtual enum_engine_type engine_type() { return SINGLE_SELECT_ENGINE; } - int get_identifier(); - void force_reexecution(); - void change_select(st_select_lex *new_select) { select_lex= new_select; } - - friend class subselect_hash_sj_engine; - friend class Item_in_subselect; - friend bool execute_degenerate_jtbm_semi_join(THD *thd, - TABLE_LIST *tbl, - Item_in_subselect *subq_pred, - List &eq_list); -}; - - -class subselect_union_engine: public subselect_engine -{ - st_select_lex_unit *unit; /* corresponding unit structure */ -public: - subselect_union_engine(st_select_lex_unit *u, - select_result_interceptor *result, - Item_subselect *item); - void cleanup(); - int prepare(THD *); - bool fix_length_and_dec(Item_cache** row); - int exec(); - uint cols() const; - uint8 uncacheable(); - void exclude(); - table_map upper_select_const_tables(); - void print (String *str, enum_query_type query_type); - bool change_result(Item_subselect *si, - select_result_interceptor *result, - bool temp= FALSE); - bool no_tables(); - bool is_executed() const; - void force_reexecution(); - bool no_rows(); - virtual enum_engine_type engine_type() { return UNION_ENGINE; } -}; - - -struct st_join_table; - - -/* - A subquery execution engine that evaluates the subquery by doing one index - lookup in a unique index. - - This engine is used to resolve subqueries in forms - - outer_expr IN (SELECT tbl.unique_key FROM tbl WHERE subq_where) - - or, tuple-based: - - (oe1, .. oeN) IN (SELECT uniq_key_part1, ... uniq_key_partK - FROM tbl WHERE subqwhere) - - i.e. the subquery is a single table SELECT without GROUP BY, aggregate - functions, etc. -*/ - -class subselect_uniquesubquery_engine: public subselect_engine -{ -protected: - st_join_table *tab; - Item *cond; /* The WHERE condition of subselect */ - /* - TRUE<=> last execution produced empty set. Valid only when left - expression is NULL. - */ - bool empty_result_set; -public: - - // constructor can assign THD because it will be called after JOIN::prepare - subselect_uniquesubquery_engine(THD *thd_arg, st_join_table *tab_arg, - Item_in_subselect *subs, Item *where) - :subselect_engine(subs, 0), tab(tab_arg), cond(where) - { DBUG_ASSERT(subs); } - ~subselect_uniquesubquery_engine(); - void cleanup(); - int prepare(THD *); - bool fix_length_and_dec(Item_cache** row); - int exec(); - uint cols() const { return 1; } - uint8 uncacheable() { return UNCACHEABLE_DEPENDENT_INJECTED; } - void exclude(); - table_map upper_select_const_tables() { return 0; } - void print (String *str, enum_query_type query_type); - bool change_result(Item_subselect *si, - select_result_interceptor *result, - bool temp= FALSE); - bool no_tables(); - int index_lookup(); /* TIMOUR: this method needs refactoring. */ - int scan_table(); - bool copy_ref_key(bool skip_constants); - bool no_rows() { return empty_result_set; } - virtual enum_engine_type engine_type() { return UNIQUESUBQUERY_ENGINE; } -}; - - -class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine -{ - /* FALSE for 'ref', TRUE for 'ref-or-null'. */ - bool check_null; - /* - The "having" clause. This clause (further referred to as "artificial - having") was inserted by subquery transformation code. It contains - Item(s) that have a side-effect: they record whether the subquery has - produced a row with NULL certain components. We need to use it for cases - like - (oe1, oe2) IN (SELECT t.key, t.no_key FROM t1) - where we do index lookup on t.key=oe1 but need also to check if there - was a row such that t.no_key IS NULL. - - NOTE: This is currently here and not in the uniquesubquery_engine. Ideally - it should have been in uniquesubquery_engine in order to allow execution of - subqueries like - - (oe1, oe2) IN (SELECT primary_key, non_key_maybe_null_field FROM tbl) - - We could use uniquesubquery_engine for the first component and let - Item_is_not_null_test( non_key_maybe_null_field) to handle the second. - - However, subqueries like the above are currently not handled by index - lookup-based subquery engines, the engine applicability check misses - them: it doesn't switch the engine for case of artificial having and - [eq_]ref access (only for artificial having + ref_or_null or no having). - The above example subquery is handled as a full-blown SELECT with eq_ref - access to one table. - - Due to this limitation, the "artificial having" currently needs to be - checked by only in indexsubquery_engine. - */ - Item *having; -public: - - // constructor can assign THD because it will be called after JOIN::prepare - subselect_indexsubquery_engine(THD *thd_arg, st_join_table *tab_arg, - Item_in_subselect *subs, Item *where, - Item *having_arg, bool chk_null) - :subselect_uniquesubquery_engine(thd_arg, tab_arg, subs, where), - check_null(chk_null), - having(having_arg) - { DBUG_ASSERT(subs); } - int exec(); - void print (String *str, enum_query_type query_type); - virtual enum_engine_type engine_type() { return INDEXSUBQUERY_ENGINE; } -}; - -/* - This function is actually defined in sql_parse.cc, but it depends on - chooser_compare_func_creator defined in this file. - */ -Item * all_any_subquery_creator(THD *thd, Item *left_expr, - chooser_compare_func_creator cmp, - bool all, - SELECT_LEX *select_lex); - - -inline bool Item_subselect::is_evaluated() const -{ - return engine->is_executed(); -} - - -inline bool Item_subselect::is_uncacheable() const -{ - return engine->uncacheable(); -} - -/** - Compute an IN predicate via a hash semi-join. This class is responsible for - the materialization of the subquery, and the selection of the correct and - optimal execution method (e.g. direct index lookup, or partial matching) for - the IN predicate. -*/ - -class subselect_hash_sj_engine : public subselect_engine -{ -public: - /* The table into which the subquery is materialized. */ - TABLE *tmp_table; - /* TRUE if the subquery was materialized into a temp table. */ - bool is_materialized; - /* - The old engine already chosen at parse time and stored in permanent memory. - Through this member we can re-create and re-prepare materialize_join for - each execution of a prepared statement. We also reuse the functionality - of subselect_single_select_engine::[prepare | cols]. - */ - subselect_single_select_engine *materialize_engine; - /* - QEP to execute the subquery and materialize its result into a - temporary table. Created during the first call to exec(). - */ - JOIN *materialize_join; - /* - A conjunction of all the equality conditions between all pairs of expressions - that are arguments of an IN predicate. We need these to post-filter some - IN results because index lookups sometimes match values that are actually - not equal to the search key in SQL terms. - */ - Item_cond_and *semi_join_conds; - Name_resolution_context *semi_join_conds_context; - - - subselect_hash_sj_engine(THD *thd_arg, Item_in_subselect *in_predicate, - subselect_single_select_engine *old_engine) - : subselect_engine(in_predicate, NULL), - tmp_table(NULL), is_materialized(FALSE), materialize_engine(old_engine), - materialize_join(NULL), semi_join_conds(NULL), lookup_engine(NULL), - count_partial_match_columns(0), count_null_only_columns(0), - count_columns_with_nulls(0), strategy(UNDEFINED) - { DBUG_ASSERT(in_predicate); } - ~subselect_hash_sj_engine(); - - bool init(List *tmp_columns, uint subquery_id); - void cleanup(); - int prepare(THD *); - int exec(); - void print(String *str, enum_query_type query_type); - uint cols() const { return materialize_engine->cols(); } - uint8 uncacheable() { return materialize_engine->uncacheable(); } - table_map upper_select_const_tables() { return 0; } - bool no_rows() { return !tmp_table->file->stats.records; } - virtual enum_engine_type engine_type() { return HASH_SJ_ENGINE; } - /* - TODO: factor out all these methods in a base subselect_index_engine class - because all of them have dummy implementations and should never be called. - */ - bool fix_length_and_dec(Item_cache** row);//=>base class - void exclude(); //=>base class - //=>base class - bool change_result(Item_subselect *si, - select_result_interceptor *result, - bool temp= FALSE); - bool no_tables();//=>base class - -protected: - /* The engine used to compute the IN predicate. */ - subselect_engine *lookup_engine; - /* Keyparts of the only non-NULL composite index in a rowid merge. */ - MY_BITMAP non_null_key_parts; - /* Keyparts of the single column indexes with NULL, one keypart per index. */ - MY_BITMAP partial_match_key_parts; - uint count_partial_match_columns; - uint count_null_only_columns; - uint count_columns_with_nulls; - /* Possible execution strategies that can be used to compute hash semi-join.*/ - enum exec_strategy { - UNDEFINED, - COMPLETE_MATCH, /* Use regular index lookups. */ - PARTIAL_MATCH, /* Use some partial matching strategy. */ - PARTIAL_MATCH_MERGE, /* Use partial matching through index merging. */ - PARTIAL_MATCH_SCAN, /* Use partial matching through table scan. */ - IMPOSSIBLE /* Subquery materialization is not applicable. */ - }; - /* The chosen execution strategy. Computed after materialization. */ - exec_strategy strategy; - exec_strategy get_strategy_using_schema(); - exec_strategy get_strategy_using_data(); - ulonglong rowid_merge_buff_size(bool has_non_null_key, - bool has_covering_null_row, - MY_BITMAP *partial_match_key_parts); - void choose_partial_match_strategy(bool has_non_null_key, - bool has_covering_null_row, - MY_BITMAP *partial_match_key_parts); - bool make_semi_join_conds(); - subselect_uniquesubquery_engine* make_unique_engine(); - -}; - - -/* - Distinguish the type of (0-based) row numbers from the type of the index into - an array of row numbers. -*/ -typedef ha_rows rownum_t; - - -/* - An Ordered_key is an in-memory table index that allows O(log(N)) time - lookups of a multi-part key. - - If the index is over a single column, then this column may contain NULLs, and - the NULLs are stored and tested separately for NULL in O(1) via is_null(). - Multi-part indexes assume that the indexed columns do not contain NULLs. - - TODO: - = Due to the unnatural assymetry between single and multi-part indexes, it - makes sense to somehow refactor or extend the class. - - = This class can be refactored into a base abstract interface, and two - subclasses: - - one to represent single-column indexes, and - - another to represent multi-column indexes. - Such separation would allow slightly more efficient implementation of - the single-column indexes. - = The current design requires such indexes to be fully recreated for each - PS (re)execution, however most of the comprising objects can be reused. -*/ - -class Ordered_key : public Sql_alloc -{ -protected: - /* - Index of the key in an array of keys. This index allows to - construct (sub)sets of keys represented by bitmaps. - */ - uint keyid; - /* The table being indexed. */ - TABLE *tbl; - /* The columns being indexed. */ - Item_field **key_columns; - /* Number of elements in 'key_columns' (number of key parts). */ - uint key_column_count; - /* - An expression, or sequence of expressions that forms the search key. - The search key is a sequence when it is Item_row. Each element of the - sequence is accessible via Item::element_index(int i). - */ - Item *search_key; - -/* Value index related members. */ - /* - The actual value index, consists of a sorted sequence of row numbers. - */ - rownum_t *key_buff; - /* Number of elements in key_buff. */ - ha_rows key_buff_elements; - /* Current element in 'key_buff'. */ - ha_rows cur_key_idx; - /* - Mapping from row numbers to row ids. The element row_num_to_rowid[i] - contains a buffer with the rowid for the row numbered 'i'. - The memory for this member is not maintanined by this class because - all Ordered_key indexes of the same table share the same mapping. - */ - uchar *row_num_to_rowid; - /* - A sequence of predicates to compare the search key with the corresponding - columns of a table row from the index. - */ - Item_func_lt **compare_pred; - -/* Null index related members. */ - MY_BITMAP null_key; - /* Count of NULLs per column. */ - ha_rows null_count; - /* The row number that contains the first NULL in a column. */ - rownum_t min_null_row; - /* The row number that contains the last NULL in a column. */ - rownum_t max_null_row; - -protected: - bool alloc_keys_buffers(); - /* - Quick sort comparison function that compares two rows of the same table - indentfied with their row numbers. - */ - int cmp_keys_by_row_data(rownum_t a, rownum_t b); - static int cmp_keys_by_row_data_and_rownum(Ordered_key *key, - rownum_t* a, rownum_t* b); - - int cmp_key_with_search_key(rownum_t row_num); - -public: - Ordered_key(uint keyid_arg, TABLE *tbl_arg, - Item *search_key_arg, ha_rows null_count_arg, - ha_rows min_null_row_arg, ha_rows max_null_row_arg, - uchar *row_num_to_rowid_arg); - ~Ordered_key(); - void cleanup(); - /* Initialize a multi-column index. */ - bool init(MY_BITMAP *columns_to_index); - /* Initialize a single-column index. */ - bool init(int col_idx); - - uint get_column_count() { return key_column_count; } - uint get_keyid() { return keyid; } - Field *get_field(uint i) - { - DBUG_ASSERT(i < key_column_count); - return key_columns[i]->field; - } - rownum_t get_min_null_row() { return min_null_row; } - rownum_t get_max_null_row() { return max_null_row; } - MY_BITMAP * get_null_key() { return &null_key; } - ha_rows get_null_count() { return null_count; } - /* - Get the search key element that corresponds to the i-th key part of this - index. - */ - Item *get_search_key(uint i) - { - return search_key->element_index(key_columns[i]->field->field_index); - } - void add_key(rownum_t row_num) - { - /* The caller must know how many elements to add. */ - DBUG_ASSERT(key_buff_elements && cur_key_idx < key_buff_elements); - key_buff[cur_key_idx]= row_num; - ++cur_key_idx; - } - - bool sort_keys(); - double null_selectivity(); - - /* - Position the current element at the first row that matches the key. - The key itself is propagated by evaluating the current value(s) of - this->search_key. - */ - bool lookup(); - /* Move the current index cursor to the first key. */ - void first() - { - DBUG_ASSERT(key_buff_elements); - cur_key_idx= 0; - } - /* TODO */ - bool next_same(); - /* Move the current index cursor to the next key. */ - bool next() - { - DBUG_ASSERT(key_buff_elements); - if (cur_key_idx < key_buff_elements - 1) - { - ++cur_key_idx; - return TRUE; - } - return FALSE; - }; - /* Return the current index element. */ - rownum_t current() - { - DBUG_ASSERT(key_buff_elements && cur_key_idx < key_buff_elements); - return key_buff[cur_key_idx]; - } - - void set_null(rownum_t row_num) - { - bitmap_set_bit(&null_key, (uint)row_num); - } - bool is_null(rownum_t row_num) - { - /* - Indexes consisting of only NULLs do not have a bitmap buffer at all. - Their only initialized member is 'n_bits', which is equal to the number - of temp table rows. - */ - if (null_count == tbl->file->stats.records) - { - DBUG_ASSERT(tbl->file->stats.records == null_key.n_bits); - return TRUE; - } - if (row_num > max_null_row || row_num < min_null_row) - return FALSE; - return bitmap_is_set(&null_key, (uint)row_num); - } - void print(String *str); -}; - - -class subselect_partial_match_engine : public subselect_engine -{ -protected: - /* The temporary table that contains a materialized subquery. */ - TABLE *tmp_table; - /* - The engine used to check whether an IN predicate is TRUE or not. If not - TRUE, then subselect_rowid_merge_engine further distinguishes between - FALSE and UNKNOWN. - */ - subselect_uniquesubquery_engine *lookup_engine; - /* A list of equalities between each pair of IN operands. */ - List *equi_join_conds; - /* - True if there is an all NULL row in tmp_table. If so, then if there is - no complete match, there is a guaranteed partial match. - */ - bool has_covering_null_row; - - /* - True if all nullable columns of tmp_table consist of only NULL values. - If so, then if there is a match in the non-null columns, there is a - guaranteed partial match. - */ - bool has_covering_null_columns; - uint count_columns_with_nulls; - -protected: - virtual bool partial_match()= 0; -public: - subselect_partial_match_engine(subselect_uniquesubquery_engine *engine_arg, - TABLE *tmp_table_arg, Item_subselect *item_arg, - select_result_interceptor *result_arg, - List *equi_join_conds_arg, - bool has_covering_null_row_arg, - bool has_covering_null_columns_arg, - uint count_columns_with_nulls_arg); - int prepare(THD *thd_arg) { set_thd(thd_arg); return 0; } - int exec(); - bool fix_length_and_dec(Item_cache**) { return FALSE; } - uint cols() const { /* TODO: what is the correct value? */ return 1; } - uint8 uncacheable() { return UNCACHEABLE_DEPENDENT; } - void exclude() {} - table_map upper_select_const_tables() { return 0; } - bool change_result(Item_subselect*, - select_result_interceptor*, - bool temp= FALSE) - { DBUG_ASSERT(FALSE); return false; } - bool no_tables() { return false; } - bool no_rows() - { - /* - TODO: It is completely unclear what is the semantics of this - method. The current result is computed so that the call to no_rows() - from Item_in_optimizer::val_int() sets Item_in_optimizer::null_value - correctly. - */ - return !(item->get_IN_subquery()->null_value); - } - void print(String*, enum_query_type); - - friend void subselect_hash_sj_engine::cleanup(); -}; - - -class subselect_rowid_merge_engine: public subselect_partial_match_engine -{ -protected: - /* - Mapping from row numbers to row ids. The rowids are stored sequentially - in the array - rowid[i] is located in row_num_to_rowid + i * rowid_length. - */ - uchar *row_num_to_rowid; - /* - A subset of all the keys for which there is a match for the same row. - Used during execution. Computed for each outer reference - */ - MY_BITMAP matching_keys; - /* - The columns of the outer reference that are NULL. Computed for each - outer reference. - */ - MY_BITMAP matching_outer_cols; - /* - Indexes of row numbers, sorted by . If an - index may contain NULLs, the NULLs are stored efficiently in a bitmap. - - The indexes are sorted by the selectivity of their NULL sub-indexes, the - one with the fewer NULLs is first. Thus, if there is any index on - non-NULL columns, it is contained in keys[0]. - */ - Ordered_key **merge_keys; - /* The number of elements in merge_keys. */ - uint merge_keys_count; - /* The NULL bitmaps of merge keys.*/ - MY_BITMAP **null_bitmaps; - /* - An index on all non-NULL columns of 'tmp_table'. The index has the - logical form: <[v_i1 | ... | v_ik], rownum>. It allows to find the row - number where the columns c_i1,...,c1_k contain the values v_i1,...,v_ik. - If such an index exists, it is always the first element of 'merge_keys'. - */ - Ordered_key *non_null_key; - /* - Priority queue of Ordered_key indexes, one per NULLable column. - This queue is used by the partial match algorithm in method exec(). - */ - QUEUE pq; -protected: - /* - Comparison function to compare keys in order of decreasing bitmap - selectivity. - */ - static int cmp_keys_by_null_selectivity(Ordered_key **k1, Ordered_key **k2); - /* - Comparison function used by the priority queue pq, the 'smaller' key - is the one with the smaller current row number. - */ - static int cmp_keys_by_cur_rownum(void *arg, uchar *k1, uchar *k2); - - bool test_null_row(rownum_t row_num); - bool exists_complementing_null_row(MY_BITMAP *keys_to_complement); - bool partial_match(); -public: - subselect_rowid_merge_engine(subselect_uniquesubquery_engine *engine_arg, - TABLE *tmp_table_arg, uint merge_keys_count_arg, - bool has_covering_null_row_arg, - bool has_covering_null_columns_arg, - uint count_columns_with_nulls_arg, - Item_subselect *item_arg, - select_result_interceptor *result_arg, - List *equi_join_conds_arg) - :subselect_partial_match_engine(engine_arg, tmp_table_arg, - item_arg, result_arg, equi_join_conds_arg, - has_covering_null_row_arg, - has_covering_null_columns_arg, - count_columns_with_nulls_arg), - merge_keys_count(merge_keys_count_arg), non_null_key(NULL) - {} - ~subselect_rowid_merge_engine(); - bool init(MY_BITMAP *non_null_key_parts, MY_BITMAP *partial_match_key_parts); - void cleanup(); - virtual enum_engine_type engine_type() { return ROWID_MERGE_ENGINE; } -}; - - -class subselect_table_scan_engine: public subselect_partial_match_engine -{ -protected: - bool partial_match(); -public: - subselect_table_scan_engine(subselect_uniquesubquery_engine *engine_arg, - TABLE *tmp_table_arg, Item_subselect *item_arg, - select_result_interceptor *result_arg, - List *equi_join_conds_arg, - bool has_covering_null_row_arg, - bool has_covering_null_columns_arg, - uint count_columns_with_nulls_arg); - void cleanup(); - virtual enum_engine_type engine_type() { return TABLE_SCAN_ENGINE; } -}; -#endif /* ITEM_SUBSELECT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_sum.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_sum.h deleted file mode 100644 index 118f78e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_sum.h +++ /dev/null @@ -1,2026 +0,0 @@ -#ifndef ITEM_SUM_INCLUDED -#define ITEM_SUM_INCLUDED -/* Copyright (c) 2000, 2013 Oracle and/or its affiliates. - Copyright (c) 2008, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* classes for sum functions */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include -#include "sql_udf.h" /* udf_handler */ - -class Item_sum; -class Aggregator_distinct; -class Aggregator_simple; - -/** - The abstract base class for the Aggregator_* classes. - It implements the data collection functions (setup/add/clear) - as either pass-through to the real functionality or - as collectors into an Unique (for distinct) structure. - - Note that update_field/reset_field are not in that - class, because they're simply not called when - GROUP BY/DISTINCT can be handled with help of index on grouped - fields (quick_group = 0); -*/ - -class Aggregator : public Sql_alloc -{ - friend class Item_sum; - friend class Item_sum_sum; - friend class Item_sum_count; - friend class Item_sum_avg; - - /* - All members are protected as this class is not usable outside of an - Item_sum descendant. - */ -protected: - /* the aggregate function class to act on */ - Item_sum *item_sum; - -public: - Aggregator (Item_sum *arg): item_sum(arg) {} - virtual ~Aggregator () {} /* Keep gcc happy */ - - enum Aggregator_type { SIMPLE_AGGREGATOR, DISTINCT_AGGREGATOR }; - virtual Aggregator_type Aggrtype() = 0; - - /** - Called before adding the first row. - Allocates and sets up the internal aggregation structures used, - e.g. the Unique instance used to calculate distinct. - */ - virtual bool setup(THD *) = 0; - - /** - Called when we need to wipe out all the data from the aggregator : - all the values acumulated and all the state. - Cleans up the internal structures and resets them to their initial state. - */ - virtual void clear() = 0; - - /** - Called when there's a new value to be aggregated. - Updates the internal state of the aggregator to reflect the new value. - */ - virtual bool add() = 0; - - /** - Called when there are no more data and the final value is to be retrieved. - Finalises the state of the aggregator, so the final result can be retrieved. - */ - virtual void endup() = 0; - - /** Decimal value of being-aggregated argument */ - virtual my_decimal *arg_val_decimal(my_decimal * value) = 0; - /** Floating point value of being-aggregated argument */ - virtual double arg_val_real() = 0; - /** - NULLness of being-aggregated argument. - - @param use_null_value Optimization: to determine if the argument is NULL - we must, in the general case, call is_null() on it, which itself might - call val_*() on it, which might be costly. If you just have called - arg_val*(), you can pass use_null_value=true; this way, arg_is_null() - might avoid is_null() and instead do a cheap read of the Item's null_value - (updated by arg_val*()). - */ - virtual bool arg_is_null(bool use_null_value) = 0; -}; - - -class st_select_lex; -class Window_spec; - -/** - Class Item_sum is the base class used for special expressions that SQL calls - 'set functions'. These expressions are formed with the help of aggregate - functions such as SUM, MAX, GROUP_CONCAT etc. - - GENERAL NOTES - - A set function cannot be used in certain positions where expressions are - accepted. There are some quite explicable restrictions for the usage of - set functions. - - In the query: - SELECT AVG(b) FROM t1 WHERE SUM(b) > 20 GROUP by a - the usage of the set function AVG(b) is legal, while the usage of SUM(b) - is illegal. A WHERE condition must contain expressions that can be - evaluated for each row of the table. Yet the expression SUM(b) can be - evaluated only for each group of rows with the same value of column a. - In the query: - SELECT AVG(b) FROM t1 WHERE c > 30 GROUP BY a HAVING SUM(b) > 20 - both set function expressions AVG(b) and SUM(b) are legal. - - We can say that in a query without nested selects an occurrence of a - set function in an expression of the SELECT list or/and in the HAVING - clause is legal, while in the WHERE clause it's illegal. - - The general rule to detect whether a set function is legal in a query with - nested subqueries is much more complicated. - - Consider the the following query: - SELECT t1.a FROM t1 GROUP BY t1.a - HAVING t1.a > ALL (SELECT t2.c FROM t2 WHERE SUM(t1.b) < t2.c). - The set function SUM(b) is used here in the WHERE clause of the subquery. - Nevertheless it is legal since it is under the HAVING clause of the query - to which this function relates. The expression SUM(t1.b) is evaluated - for each group defined in the main query, not for groups of the subquery. - - The problem of finding the query where to aggregate a particular - set function is not so simple as it seems to be. - - In the query: - SELECT t1.a FROM t1 GROUP BY t1.a - HAVING t1.a > ALL(SELECT t2.c FROM t2 GROUP BY t2.c - HAVING SUM(t1.a) < t2.c) - the set function can be evaluated for both outer and inner selects. - If we evaluate SUM(t1.a) for the outer query then we get the value of t1.a - multiplied by the cardinality of a group in table t1. In this case - in each correlated subquery SUM(t1.a) is used as a constant. But we also - can evaluate SUM(t1.a) for the inner query. In this case t1.a will be a - constant for each correlated subquery and summation is performed - for each group of table t2. - (Here it makes sense to remind that the query - SELECT c FROM t GROUP BY a HAVING SUM(1) < a - is quite legal in our SQL). - - So depending on what query we assign the set function to we - can get different result sets. - - The general rule to detect the query where a set function is to be - evaluated can be formulated as follows. - Consider a set function S(E) where E is an expression with occurrences - of column references C1, ..., CN. Resolve these column references against - subqueries that contain the set function S(E). Let Q be the innermost - subquery of those subqueries. (It should be noted here that S(E) - in no way can be evaluated in the subquery embedding the subquery Q, - otherwise S(E) would refer to at least one unbound column reference) - If S(E) is used in a construct of Q where set functions are allowed then - we evaluate S(E) in Q. - Otherwise we look for a innermost subquery containing S(E) of those where - usage of S(E) is allowed. - - Let's demonstrate how this rule is applied to the following queries. - - 1. SELECT t1.a FROM t1 GROUP BY t1.a - HAVING t1.a > ALL(SELECT t2.b FROM t2 GROUP BY t2.b - HAVING t2.b > ALL(SELECT t3.c FROM t3 GROUP BY t3.c - HAVING SUM(t1.a+t2.b) < t3.c)) - For this query the set function SUM(t1.a+t2.b) depends on t1.a and t2.b - with t1.a defined in the outermost query, and t2.b defined for its - subquery. The set function is in the HAVING clause of the subquery and can - be evaluated in this subquery. - - 2. SELECT t1.a FROM t1 GROUP BY t1.a - HAVING t1.a > ALL(SELECT t2.b FROM t2 - WHERE t2.b > ALL (SELECT t3.c FROM t3 GROUP BY t3.c - HAVING SUM(t1.a+t2.b) < t3.c)) - Here the set function SUM(t1.a+t2.b)is in the WHERE clause of the second - subquery - the most upper subquery where t1.a and t2.b are defined. - If we evaluate the function in this subquery we violate the context rules. - So we evaluate the function in the third subquery (over table t3) where it - is used under the HAVING clause. - - 3. SELECT t1.a FROM t1 GROUP BY t1.a - HAVING t1.a > ALL(SELECT t2.b FROM t2 - WHERE t2.b > ALL (SELECT t3.c FROM t3 - WHERE SUM(t1.a+t2.b) < t3.c)) - In this query evaluation of SUM(t1.a+t2.b) is not legal neither in the second - nor in the third subqueries. So this query is invalid. - - Mostly set functions cannot be nested. In the query - SELECT t1.a from t1 GROUP BY t1.a HAVING AVG(SUM(t1.b)) > 20 - the expression SUM(b) is not acceptable, though it is under a HAVING clause. - Yet it is acceptable in the query: - SELECT t.1 FROM t1 GROUP BY t1.a HAVING SUM(t1.b) > 20. - - An argument of a set function does not have to be a reference to a table - column as we saw it in examples above. This can be a more complex expression - SELECT t1.a FROM t1 GROUP BY t1.a HAVING SUM(t1.b+1) > 20. - The expression SUM(t1.b+1) has a very clear semantics in this context: - we sum up the values of t1.b+1 where t1.b varies for all values within a - group of rows that contain the same t1.a value. - - A set function for an outer query yields a constant within a subquery. So - the semantics of the query - SELECT t1.a FROM t1 GROUP BY t1.a - HAVING t1.a IN (SELECT t2.c FROM t2 GROUP BY t2.c - HAVING AVG(t2.c+SUM(t1.b)) > 20) - is still clear. For a group of the rows with the same t1.a values we - calculate the value of SUM(t1.b). This value 's' is substituted in the - the subquery: - SELECT t2.c FROM t2 GROUP BY t2.c HAVING AVG(t2.c+s) - than returns some result set. - - By the same reason the following query with a subquery - SELECT t1.a FROM t1 GROUP BY t1.a - HAVING t1.a IN (SELECT t2.c FROM t2 GROUP BY t2.c - HAVING AVG(SUM(t1.b)) > 20) - is also acceptable. - - IMPLEMENTATION NOTES - - Three methods were added to the class to check the constraints specified - in the previous section. These methods utilize several new members. - - The field 'nest_level' contains the number of the level for the subquery - containing the set function. The main SELECT is of level 0, its subqueries - are of levels 1, the subqueries of the latter are of level 2 and so on. - - The field 'aggr_level' is to contain the nest level of the subquery - where the set function is aggregated. - - The field 'max_arg_level' is for the maximum of the nest levels of the - unbound column references occurred in the set function. A column reference - is unbound within a set function if it is not bound by any subquery - used as a subexpression in this function. A column reference is bound by - a subquery if it is a reference to the column by which the aggregation - of some set function that is used in the subquery is calculated. - For the set function used in the query - SELECT t1.a FROM t1 GROUP BY t1.a - HAVING t1.a > ALL(SELECT t2.b FROM t2 GROUP BY t2.b - HAVING t2.b > ALL(SELECT t3.c FROM t3 GROUP BY t3.c - HAVING SUM(t1.a+t2.b) < t3.c)) - the value of max_arg_level is equal to 1 since t1.a is bound in the main - query, and t2.b is bound by the first subquery whose nest level is 1. - Obviously a set function cannot be aggregated in the subquery whose - nest level is less than max_arg_level. (Yet it can be aggregated in the - subqueries whose nest level is greater than max_arg_level.) - In the query - SELECT t.a FROM t1 HAVING AVG(t1.a+(SELECT MIN(t2.c) FROM t2)) - the value of the max_arg_level for the AVG set function is 0 since - the reference t2.c is bound in the subquery. - - The field 'max_sum_func_level' is to contain the maximum of the - nest levels of the set functions that are used as subexpressions of - the arguments of the given set function, but not aggregated in any - subquery within this set function. A nested set function s1 can be - used within set function s0 only if s1.max_sum_func_level < - s0.max_sum_func_level. Set function s1 is considered as nested - for set function s0 if s1 is not calculated in any subquery - within s0. - - A set function that is used as a subexpression in an argument of another - set function refers to the latter via the field 'in_sum_func'. - - The condition imposed on the usage of set functions are checked when - we traverse query subexpressions with the help of the recursive method - fix_fields. When we apply this method to an object of the class - Item_sum, first, on the descent, we call the method init_sum_func_check - that initialize members used at checking. Then, on the ascent, we - call the method check_sum_func that validates the set function usage - and reports an error if it is illegal. - The method register_sum_func serves to link the items for the set functions - that are aggregated in the embedding (sub)queries. Circular chains of such - functions are attached to the corresponding st_select_lex structures - through the field inner_sum_func_list. - - Exploiting the fact that the members mentioned above are used in one - recursive function we could have allocated them on the thread stack. - Yet we don't do it now. - - We assume that the nesting level of subquries does not exceed 127. - TODO: to catch queries where the limit is exceeded to make the - code clean here. - - @note - The implementation takes into account the used strategy: - - Items resolved at optimization phase return 0 from Item_sum::used_tables(). - - Items that depend on the number of join output records, but not columns of - any particular table (like COUNT(*)), returm 0 from Item_sum::used_tables(), - but still return false from Item_sum::const_item(). -*/ - -class Item_sum :public Item_func_or_sum -{ - friend class Aggregator_distinct; - friend class Aggregator_simple; - -protected: - /** - Aggregator class instance. Not set initially. Allocated only after - it is determined if the incoming data are already distinct. - */ - Aggregator *aggr; - -private: - /** - Used in making ROLLUP. Set for the ROLLUP copies of the original - Item_sum and passed to create_tmp_field() to cause it to work - over the temp table buffer that is referenced by - Item_result_field::result_field. - */ - bool force_copy_fields; - - /** - Indicates how the aggregate function was specified by the parser : - 1 if it was written as AGGREGATE(DISTINCT), - 0 if it was AGGREGATE() - */ - bool with_distinct; - - /* TRUE if this is aggregate function of a window function */ - bool window_func_sum_expr_flag; - -public: - - bool has_force_copy_fields() const { return force_copy_fields; } - bool has_with_distinct() const { return with_distinct; } - - enum Sumfunctype - { COUNT_FUNC, COUNT_DISTINCT_FUNC, SUM_FUNC, SUM_DISTINCT_FUNC, AVG_FUNC, - AVG_DISTINCT_FUNC, MIN_FUNC, MAX_FUNC, STD_FUNC, - VARIANCE_FUNC, SUM_BIT_FUNC, UDF_SUM_FUNC, GROUP_CONCAT_FUNC, - ROW_NUMBER_FUNC, RANK_FUNC, DENSE_RANK_FUNC, PERCENT_RANK_FUNC, - CUME_DIST_FUNC, NTILE_FUNC, FIRST_VALUE_FUNC, LAST_VALUE_FUNC, - NTH_VALUE_FUNC, LEAD_FUNC, LAG_FUNC, PERCENTILE_CONT_FUNC, - PERCENTILE_DISC_FUNC, SP_AGGREGATE_FUNC, JSON_ARRAYAGG_FUNC, - JSON_OBJECTAGG_FUNC - }; - - Item **ref_by; /* pointer to a ref to the object used to register it */ - Item_sum *next; /* next in the circular chain of registered objects */ - Item_sum *in_sum_func; /* embedding set function if any */ - st_select_lex * aggr_sel; /* select where the function is aggregated */ - int8 nest_level; /* number of the nesting level of the set function */ - int8 aggr_level; /* nesting level of the aggregating subquery */ - int8 max_arg_level; /* max level of unbound column references */ - int8 max_sum_func_level;/* max level of aggregation for embedded functions */ - bool quick_group; /* If incremental update of fields */ - /* - This list is used by the check for mixing non aggregated fields and - sum functions in the ONLY_FULL_GROUP_BY_MODE. We save all outer fields - directly or indirectly used under this function it as it's unclear - at the moment of fixing outer field whether it's aggregated or not. - */ - List outer_fields; - -protected: - /* - Copy of the arguments list to hold the original set of arguments. - Used in EXPLAIN EXTENDED instead of the current argument list because - the current argument list can be altered by usage of temporary tables. - */ - Item **orig_args, *tmp_orig_args[2]; - - static size_t ram_limitation(THD *thd); -public: - // Methods used by ColumnStore - Item **get_orig_args() const { return orig_args; } -public: - - void mark_as_sum_func(); - Item_sum(THD *thd): Item_func_or_sum(thd), quick_group(1) - { - mark_as_sum_func(); - init_aggregator(); - } - Item_sum(THD *thd, Item *a): Item_func_or_sum(thd, a), quick_group(1), - orig_args(tmp_orig_args) - { - mark_as_sum_func(); - init_aggregator(); - } - Item_sum(THD *thd, Item *a, Item *b): Item_func_or_sum(thd, a, b), - quick_group(1), orig_args(tmp_orig_args) - { - mark_as_sum_func(); - init_aggregator(); - } - Item_sum(THD *thd, List &list); - //Copy constructor, need to perform subselects with temporary tables - Item_sum(THD *thd, Item_sum *item); - enum Type type() const { return SUM_FUNC_ITEM; } - virtual enum Sumfunctype sum_func () const=0; - bool is_aggr_sum_func() - { - switch (sum_func()) { - case COUNT_FUNC: - case COUNT_DISTINCT_FUNC: - case SUM_FUNC: - case SUM_DISTINCT_FUNC: - case AVG_FUNC: - case AVG_DISTINCT_FUNC: - case MIN_FUNC: - case MAX_FUNC: - case STD_FUNC: - case VARIANCE_FUNC: - case SUM_BIT_FUNC: - case UDF_SUM_FUNC: - case GROUP_CONCAT_FUNC: - case JSON_ARRAYAGG_FUNC: - return true; - default: - return false; - } - } - /** - Resets the aggregate value to its default and aggregates the current - value of its attribute(s). - */ - inline bool reset_and_add() - { - aggregator_clear(); - return aggregator_add(); - }; - - /* - Called when new group is started and results are being saved in - a temporary table. Similarly to reset_and_add() it resets the - value to its default and aggregates the value of its - attribute(s), but must also store it in result_field. - This set of methods (result_item(), reset_field, update_field()) of - Item_sum is used only if quick_group is not null. Otherwise - copy_or_same() is used to obtain a copy of this item. - */ - virtual void reset_field()=0; - /* - Called for each new value in the group, when temporary table is in use. - Similar to add(), but uses temporary table field to obtain current value, - Updated value is then saved in the field. - */ - virtual void update_field()=0; - virtual bool fix_length_and_dec() - { maybe_null=1; null_value=1; return FALSE; } - virtual Item *result_item(THD *thd, Field *field); - - void update_used_tables (); - COND *build_equal_items(THD *thd, COND_EQUAL *inherited, - bool link_item_fields, - COND_EQUAL **cond_equal_ref) - { - /* - Item_sum (and derivants) of the original WHERE/HAVING clauses - should already be replaced to Item_aggregate_ref by the time when - build_equal_items() is called. See Item::split_sum_func2(). - */ - DBUG_ASSERT(0); - return Item::build_equal_items(thd, inherited, link_item_fields, - cond_equal_ref); - } - bool is_null() { return null_value; } - /** - make_const() - Called if we've managed to calculate the value of this Item in - opt_sum_query(), hence it can be considered constant at all subsequent - steps. - */ - void make_const () - { - used_tables_cache= 0; - const_item_cache= true; - } - void reset_forced_const() { const_item_cache= false; } - virtual bool const_during_execution() const { return false; } - virtual void print(String *str, enum_query_type query_type); - void fix_num_length_and_dec(); - - /** - Mark an aggregate as having no rows. - - This function is called by the execution engine to assign 'NO ROWS - FOUND' value to an aggregate item, when the underlying result set - has no rows. Such value, in a general case, may be different from - the default value of the item after 'clear()': e.g. a numeric item - may be initialized to 0 by clear() and to NULL by - no_rows_in_result(). - */ - virtual void no_rows_in_result() - { - set_aggregator(with_distinct ? - Aggregator::DISTINCT_AGGREGATOR : - Aggregator::SIMPLE_AGGREGATOR); - aggregator_clear(); - } - virtual void make_unique() { force_copy_fields= TRUE; } - Item *get_tmp_table_item(THD *thd); - virtual Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - return create_tmp_field(root, param->group(), table); - } - virtual bool collect_outer_ref_processor(void *param); - bool init_sum_func_check(THD *thd); - bool check_sum_func(THD *thd, Item **ref); - bool register_sum_func(THD *thd, Item **ref); - st_select_lex *depended_from() - { return (nest_level == aggr_level ? 0 : aggr_sel); } - - Item *get_arg(uint i) const { return args[i]; } - Item *set_arg(uint i, THD *thd, Item *new_val); - uint get_arg_count() const { return arg_count; } - virtual Item **get_args() { return fixed ? orig_args : args; } - - /* Initialization of distinct related members */ - void init_aggregator() - { - aggr= NULL; - with_distinct= FALSE; - force_copy_fields= FALSE; - } - - /** - Called to initialize the aggregator. - */ - - inline bool aggregator_setup(THD *thd) { return aggr->setup(thd); }; - - /** - Called to cleanup the aggregator. - */ - - inline void aggregator_clear() { aggr->clear(); } - - /** - Called to add value to the aggregator. - */ - - inline bool aggregator_add() { return aggr->add(); }; - - /* stores the declared DISTINCT flag (from the parser) */ - void set_distinct(bool distinct) - { - with_distinct= distinct; - quick_group= with_distinct ? 0 : 1; - } - - /* - Set the type of aggregation : DISTINCT or not. - - May be called multiple times. - */ - - int set_aggregator(Aggregator::Aggregator_type aggregator); - - virtual void clear()= 0; - virtual bool add()= 0; - virtual bool setup(THD *thd) { return false; } - - virtual bool supports_removal() const { return false; } - virtual void remove() { DBUG_ASSERT(0); } - - virtual void cleanup(); - bool check_vcol_func_processor(void *arg); - virtual void setup_window_func(THD *thd, Window_spec *window_spec) {} - void mark_as_window_func_sum_expr() { window_func_sum_expr_flag= true; } - bool is_window_func_sum_expr() { return window_func_sum_expr_flag; } - virtual void setup_caches(THD *thd) {}; - - bool with_sum_func() const { return true; } - virtual void set_partition_row_count(ulonglong count) { DBUG_ASSERT(0); } -}; - - -class Unique; - - -/** - The distinct aggregator. - Implements AGGFN (DISTINCT ..) - Collects all the data into an Unique (similarly to what Item_sum - does currently when with_distinct=true) and then (if applicable) iterates over - the list of unique values and pumps them back into its object -*/ - -class Aggregator_distinct : public Aggregator -{ - friend class Item_sum_sum; - - /* - flag to prevent consecutive runs of endup(). Normally in endup there are - expensive calculations (like walking the distinct tree for example) - which we must do only once if there are no data changes. - We can re-use the data for the second and subsequent val_xxx() calls. - endup_done set to TRUE also means that the calculated values for - the aggregate functions are correct and don't need recalculation. - */ - bool endup_done; - - /* - Used depending on the type of the aggregate function and the presence of - blob columns in it: - - For COUNT(DISTINCT) and no blob fields this points to a real temporary - table. It's used as a hash table. - - For AVG/SUM(DISTINCT) or COUNT(DISTINCT) with blob fields only the - in-memory data structure of a temporary table is constructed. - It's used by the Field classes to transform data into row format. - */ - TABLE *table; - - /* - An array of field lengths on row allocated and used only for - COUNT(DISTINCT) with multiple columns and no blobs. Used in - Aggregator_distinct::composite_key_cmp (called from Unique to compare - nodes - */ - uint32 *field_lengths; - - /* - Used in conjunction with 'table' to support the access to Field classes - for COUNT(DISTINCT). Needed by copy_fields()/copy_funcs(). - */ - TMP_TABLE_PARAM *tmp_table_param; - - /* - If there are no blobs in the COUNT(DISTINCT) arguments, we can use a tree, - which is faster than heap table. In that case, we still use the table - to help get things set up, but we insert nothing in it. - For AVG/SUM(DISTINCT) we always use this tree (as it takes a single - argument) to get the distinct rows. - */ - Unique *tree; - - /* - The length of the temp table row. Must be a member of the class as it - gets passed down to simple_raw_key_cmp () as a compare function argument - to Unique. simple_raw_key_cmp () is used as a fast comparison function - when the entire row can be binary compared. - */ - uint tree_key_length; - - /* - Set to true if the result is known to be always NULL. - If set deactivates creation and usage of the temporary table (in the - 'table' member) and the Unique instance (in the 'tree' member) as well as - the calculation of the final value on the first call to - Item_[sum|avg|count]::val_xxx(). - */ - bool always_null; - - /** - When feeding back the data in endup() from Unique/temp table back to - Item_sum::add() methods we must read the data from Unique (and not - recalculate the functions that are given as arguments to the aggregate - function. - This flag is to tell the arg_*() methods to take the data from the Unique - instead of calling the relevant val_..() method. - */ - bool use_distinct_values; - -public: - Aggregator_distinct (Item_sum *sum) : - Aggregator(sum), table(NULL), tmp_table_param(NULL), tree(NULL), - always_null(false), use_distinct_values(false) {} - virtual ~Aggregator_distinct (); - Aggregator_type Aggrtype() { return DISTINCT_AGGREGATOR; } - - bool setup(THD *); - void clear(); - bool add(); - void endup(); - virtual my_decimal *arg_val_decimal(my_decimal * value); - virtual double arg_val_real(); - virtual bool arg_is_null(bool use_null_value); - - bool unique_walk_function(void *element); - bool unique_walk_function_for_count(void *element); - static int composite_key_cmp(void* arg, uchar* key1, uchar* key2); -}; - - -/** - The pass-through aggregator. - Implements AGGFN (DISTINCT ..) by knowing it gets distinct data on input. - So it just pumps them back to the Item_sum descendant class. -*/ -class Aggregator_simple : public Aggregator -{ -public: - - Aggregator_simple (Item_sum *sum) : - Aggregator(sum) {} - Aggregator_type Aggrtype() { return Aggregator::SIMPLE_AGGREGATOR; } - - bool setup(THD * thd) { return item_sum->setup(thd); } - void clear() { item_sum->clear(); } - bool add() { return item_sum->add(); } - void endup() {}; - virtual my_decimal *arg_val_decimal(my_decimal * value); - virtual double arg_val_real(); - virtual bool arg_is_null(bool use_null_value); -}; - - -class Item_sum_num :public Item_sum -{ -public: - Item_sum_num(THD *thd): Item_sum(thd) {} - Item_sum_num(THD *thd, Item *item_par): - Item_sum(thd, item_par) {} - Item_sum_num(THD *thd, Item *a, Item* b): - Item_sum(thd, a, b) {} - Item_sum_num(THD *thd, List &list): - Item_sum(thd, list) {} - Item_sum_num(THD *thd, Item_sum_num *item): - Item_sum(thd, item) {} - bool fix_fields(THD *, Item **); -}; - - -class Item_sum_double :public Item_sum_num -{ -public: - Item_sum_double(THD *thd): Item_sum_num(thd) {} - Item_sum_double(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {} - Item_sum_double(THD *thd, List &list): Item_sum_num(thd, list) {} - Item_sum_double(THD *thd, Item_sum_double *item) :Item_sum_num(thd, item) {} - longlong val_int() - { - return val_int_from_real(); - } - String *val_str(String*str) - { - return val_string_from_real(str); - } - my_decimal *val_decimal(my_decimal *to) - { - return val_decimal_from_real(to); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return get_date_from_real(thd, ltime, fuzzydate); - } - const Type_handler *type_handler() const { return &type_handler_double; } -}; - - -class Item_sum_int :public Item_sum_num -{ -public: - Item_sum_int(THD *thd): Item_sum_num(thd) {} - Item_sum_int(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {} - Item_sum_int(THD *thd, List &list): Item_sum_num(thd, list) {} - Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item) {} - double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); } - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return get_date_from_int(thd, ltime, fuzzydate); - } - bool fix_length_and_dec() - { decimals=0; max_length=21; maybe_null=null_value=0; return FALSE; } -}; - - -class Item_sum_sum :public Item_sum_num, - public Type_handler_hybrid_field_type -{ -protected: - bool direct_added; - bool direct_reseted_field; - bool direct_sum_is_null; - double direct_sum_real; - double sum; - my_decimal direct_sum_decimal; - my_decimal dec_buffs[2]; - uint curr_dec_buff; - bool fix_length_and_dec(); - -public: - Item_sum_sum(THD *thd, Item *item_par, bool distinct): - Item_sum_num(thd, item_par), direct_added(FALSE), - direct_reseted_field(FALSE) - { - set_distinct(distinct); - } - Item_sum_sum(THD *thd, Item_sum_sum *item); - enum Sumfunctype sum_func () const - { - return has_with_distinct() ? SUM_DISTINCT_FUNC : SUM_FUNC; - } - void cleanup(); - void direct_add(my_decimal *add_sum_decimal); - void direct_add(double add_sum_real, bool add_sum_is_null); - void clear(); - bool add(); - double val_real(); - longlong val_int(); - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } - const Type_handler *type_handler() const - { return Type_handler_hybrid_field_type::type_handler(); } - void fix_length_and_dec_double(); - void fix_length_and_dec_decimal(); - void reset_field(); - void update_field(); - void no_rows_in_result() {} - const char *func_name() const - { - return has_with_distinct() ? "sum(distinct " : "sum("; - } - Item *copy_or_same(THD* thd); - void remove(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - - bool supports_removal() const - { - return true; - } - -private: - void add_helper(bool perform_removal); - ulonglong count; -}; - - -class Item_sum_count :public Item_sum_int -{ - bool direct_counted; - bool direct_reseted_field; - longlong direct_count; - longlong count; - - friend class Aggregator_distinct; - - void clear(); - bool add(); - void cleanup(); - void remove(); - -public: - Item_sum_count(THD *thd, Item *item_par): - Item_sum_int(thd, item_par), direct_counted(FALSE), - direct_reseted_field(FALSE), count(0) - {} - - /** - Constructs an instance for COUNT(DISTINCT) - - @param list a list of the arguments to the aggregate function - - This constructor is called by the parser only for COUNT (DISTINCT). - */ - - Item_sum_count(THD *thd, List &list): - Item_sum_int(thd, list), direct_counted(FALSE), - direct_reseted_field(FALSE), count(0) - { - set_distinct(TRUE); - } - Item_sum_count(THD *thd, Item_sum_count *item): - Item_sum_int(thd, item), direct_counted(FALSE), - direct_reseted_field(FALSE), count(item->count) - {} - enum Sumfunctype sum_func () const - { - return has_with_distinct() ? COUNT_DISTINCT_FUNC : COUNT_FUNC; - } - void no_rows_in_result() { count=0; } - void make_const(longlong count_arg) - { - count=count_arg; - Item_sum::make_const(); - } - const Type_handler *type_handler() const { return &type_handler_slonglong; } - longlong val_int(); - void reset_field(); - void update_field(); - void direct_add(longlong add_count); - const char *func_name() const - { - return has_with_distinct() ? "count(distinct " : "count("; - } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - - bool supports_removal() const - { - return true; - } -}; - - -class Item_sum_avg :public Item_sum_sum -{ -public: - // TODO-cvicentiu given that Item_sum_sum now uses a counter of its own, in - // order to implement remove(), it is possible to remove this member. - ulonglong count; - uint prec_increment; - uint f_precision, f_scale, dec_bin_size; - - Item_sum_avg(THD *thd, Item *item_par, bool distinct): - Item_sum_sum(thd, item_par, distinct), count(0) - {} - Item_sum_avg(THD *thd, Item_sum_avg *item) - :Item_sum_sum(thd, item), count(item->count), - prec_increment(item->prec_increment) {} - - void fix_length_and_dec_double(); - void fix_length_and_dec_decimal(); - bool fix_length_and_dec(); - enum Sumfunctype sum_func () const - { - return has_with_distinct() ? AVG_DISTINCT_FUNC : AVG_FUNC; - } - void clear(); - bool add(); - void remove(); - double val_real(); - // In SPs we might force the "wrong" type with select into a declare variable - longlong val_int() { return val_int_from_real(); } - my_decimal *val_decimal(my_decimal *); - String *val_str(String *str); - void reset_field(); - void update_field(); - Item *result_item(THD *thd, Field *field); - void no_rows_in_result() {} - const char *func_name() const - { - return has_with_distinct() ? "avg(distinct " : "avg("; - } - Item *copy_or_same(THD* thd); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void cleanup() - { - count= 0; - Item_sum_sum::cleanup(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - - bool supports_removal() const - { - return true; - } -}; - - -/* - variance(a) = - - = sum (ai - avg(a))^2 / count(a) ) - = sum (ai^2 - 2*ai*avg(a) + avg(a)^2) / count(a) - = (sum(ai^2) - sum(2*ai*avg(a)) + sum(avg(a)^2))/count(a) = - = (sum(ai^2) - 2*avg(a)*sum(a) + count(a)*avg(a)^2)/count(a) = - = (sum(ai^2) - 2*sum(a)*sum(a)/count(a) + count(a)*sum(a)^2/count(a)^2 )/count(a) = - = (sum(ai^2) - 2*sum(a)^2/count(a) + sum(a)^2/count(a) )/count(a) = - = (sum(ai^2) - sum(a)^2/count(a))/count(a) - -But, this falls prey to catastrophic cancellation. Instead, use the recurrence formulas - - M_{1} = x_{1}, ~ M_{k} = M_{k-1} + (x_{k} - M_{k-1}) / k newline - S_{1} = 0, ~ S_{k} = S_{k-1} + (x_{k} - M_{k-1}) times (x_{k} - M_{k}) newline - for 2 <= k <= n newline - ital variance = S_{n} / (n-1) - -*/ - -class Stddev -{ - double m_m; - double m_s; - ulonglong m_count; -public: - Stddev() :m_m(0), m_s(0), m_count(0) { } - Stddev(double nr) :m_m(nr), m_s(0.0), m_count(1) { } - Stddev(const uchar *); - void to_binary(uchar *) const; - void recurrence_next(double nr); - double result(bool is_simple_variance); - ulonglong count() const { return m_count; } - static uint32 binary_size() - { - return (uint32) (sizeof(double) * 2 + sizeof(ulonglong)); - }; -}; - - - -class Item_sum_variance :public Item_sum_double -{ - Stddev m_stddev; - bool fix_length_and_dec() override; - -public: - uint sample; - uint prec_increment; - - Item_sum_variance(THD *thd, Item *item_par, uint sample_arg): - Item_sum_double(thd, item_par), - sample(sample_arg) - {} - Item_sum_variance(THD *thd, Item_sum_variance *item); - Sumfunctype sum_func () const override { return VARIANCE_FUNC; } - void fix_length_and_dec_double(); - void fix_length_and_dec_decimal(); - void clear() override final; - bool add() override final; - double val_real() override; - void reset_field() override final; - void update_field() override final; - Item *result_item(THD *thd, Field *field) override; - void no_rows_in_result() override final {} - const char *func_name() const override - { return sample ? "var_samp(" : "variance("; } - Item *copy_or_same(THD* thd) override; - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override - final; - void cleanup() override final - { - m_stddev= Stddev(); - Item_sum_double::cleanup(); - } - Item *get_copy(THD *thd) override - { return get_item_copy(thd, this); } -}; - -/* - standard_deviation(a) = sqrt(variance(a)) -*/ - -class Item_sum_std final :public Item_sum_variance -{ - public: - Item_sum_std(THD *thd, Item *item_par, uint sample_arg): - Item_sum_variance(thd, item_par, sample_arg) {} - Item_sum_std(THD *thd, Item_sum_std *item) - :Item_sum_variance(thd, item) - {} - enum Sumfunctype sum_func () const override final { return STD_FUNC; } - double val_real() override final; - Item *result_item(THD *thd, Field *field) override final; - const char *func_name() const override final { return "std("; } - Item *copy_or_same(THD* thd) override final; - Item *get_copy(THD *thd) override final - { return get_item_copy(thd, this); } -}; - - -class Item_sum_hybrid : public Item_sum, - public Type_handler_hybrid_field_type -{ -public: - Item_sum_hybrid(THD *thd, Item *item_par): - Item_sum(thd, item_par), - Type_handler_hybrid_field_type(&type_handler_slonglong) - { collation.set(&my_charset_bin); } - Item_sum_hybrid(THD *thd, Item *a, Item *b): - Item_sum(thd, a, b), - Type_handler_hybrid_field_type(&type_handler_slonglong) - { collation.set(&my_charset_bin); } - Item_sum_hybrid(THD *thd, Item_sum_hybrid *item) - :Item_sum(thd, item), - Type_handler_hybrid_field_type(item) - { } - const Type_handler *type_handler() const - { return Type_handler_hybrid_field_type::type_handler(); } - bool fix_length_and_dec_generic(); - bool fix_length_and_dec_numeric(const Type_handler *h); - bool fix_length_and_dec_string(); -}; - - -// This class is a string or number function depending on num_func -class Arg_comparator; -class Item_cache; -class Item_sum_min_max :public Item_sum_hybrid -{ -protected: - bool direct_added; - Item *direct_item; - Item_cache *value, *arg_cache; - Arg_comparator *cmp; - int cmp_sign; - bool was_values; // Set if we have found at least one row (for max/min only) - bool was_null_value; - -public: - Item_sum_min_max(THD *thd, Item *item_par,int sign): - Item_sum_hybrid(thd, item_par), - direct_added(FALSE), value(0), arg_cache(0), cmp(0), - cmp_sign(sign), was_values(TRUE) - { collation.set(&my_charset_bin); } - Item_sum_min_max(THD *thd, Item_sum_min_max *item) - :Item_sum_hybrid(thd, item), - direct_added(FALSE), value(item->value), arg_cache(0), - cmp_sign(item->cmp_sign), was_values(item->was_values) - { } - bool fix_fields(THD *, Item **); - bool fix_length_and_dec(); - void setup_hybrid(THD *thd, Item *item, Item *value_arg); - void clear(); - void direct_add(Item *item); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - void reset_field(); - String *val_str(String *); - bool val_native(THD *thd, Native *); - const Type_handler *real_type_handler() const - { - return get_arg(0)->real_type_handler(); - } - const TYPELIB *get_typelib() const { return args[0]->get_typelib(); } - void update_field(); - void min_max_update_str_field(); - void min_max_update_real_field(); - void min_max_update_int_field(); - void min_max_update_decimal_field(); - void min_max_update_native_field(); - void cleanup(); - bool any_value() { return was_values; } - void no_rows_in_result(); - void restore_to_before_no_rows_in_result(); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void setup_caches(THD *thd) { setup_hybrid(thd, arguments()[0], NULL); } -}; - - -class Item_sum_min final :public Item_sum_min_max -{ -public: - Item_sum_min(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, 1) {} - Item_sum_min(THD *thd, Item_sum_min *item) :Item_sum_min_max(thd, item) {} - enum Sumfunctype sum_func () const {return MIN_FUNC;} - - bool add(); - const char *func_name() const { return "min("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_sum_max final :public Item_sum_min_max -{ -public: - Item_sum_max(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, -1) {} - Item_sum_max(THD *thd, Item_sum_max *item) :Item_sum_min_max(thd, item) {} - enum Sumfunctype sum_func () const {return MAX_FUNC;} - - bool add(); - const char *func_name() const { return "max("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_sum_bit :public Item_sum_int -{ -public: - Item_sum_bit(THD *thd, Item *item_par, ulonglong reset_arg): - Item_sum_int(thd, item_par), reset_bits(reset_arg), bits(reset_arg), - as_window_function(FALSE), num_values_added(0) {} - Item_sum_bit(THD *thd, Item_sum_bit *item): - Item_sum_int(thd, item), reset_bits(item->reset_bits), bits(item->bits), - as_window_function(item->as_window_function), - num_values_added(item->num_values_added) - { - if (as_window_function) - memcpy(bit_counters, item->bit_counters, sizeof(bit_counters)); - } - enum Sumfunctype sum_func () const {return SUM_BIT_FUNC;} - void clear(); - longlong val_int(); - void reset_field(); - void update_field(); - const Type_handler *type_handler() const { return &type_handler_ulonglong; } - bool fix_length_and_dec() - { - if (args[0]->check_type_can_return_int(func_name())) - return true; - decimals= 0; max_length=21; unsigned_flag= 1; maybe_null= null_value= 0; - return FALSE; - } - void cleanup() - { - bits= reset_bits; - if (as_window_function) - clear_as_window(); - Item_sum_int::cleanup(); - } - void setup_window_func(THD *thd __attribute__((unused)), - Window_spec *window_spec __attribute__((unused))) - { - as_window_function= TRUE; - clear_as_window(); - } - void remove() - { - if (as_window_function) - { - remove_as_window(args[0]->val_int()); - return; - } - // Unless we're counting bits, we can not remove anything. - DBUG_ASSERT(0); - } - - bool supports_removal() const - { - return true; - } - -protected: - enum bit_counters { NUM_BIT_COUNTERS= 64 }; - ulonglong reset_bits,bits; - /* - Marks whether the function is to be computed as a window function. - */ - bool as_window_function; - // When used as an aggregate window function, we need to store - // this additional information. - ulonglong num_values_added; - ulonglong bit_counters[NUM_BIT_COUNTERS]; - bool add_as_window(ulonglong value); - bool remove_as_window(ulonglong value); - bool clear_as_window(); - virtual void set_bits_from_counters()= 0; -}; - - -class Item_sum_or final :public Item_sum_bit -{ -public: - Item_sum_or(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {} - Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {} - bool add(); - const char *func_name() const { return "bit_or("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - -private: - void set_bits_from_counters(); -}; - - -class Item_sum_and final :public Item_sum_bit -{ -public: - Item_sum_and(THD *thd, Item *item_par): - Item_sum_bit(thd, item_par, ULONGLONG_MAX) {} - Item_sum_and(THD *thd, Item_sum_and *item) :Item_sum_bit(thd, item) {} - bool add(); - const char *func_name() const { return "bit_and("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - -private: - void set_bits_from_counters(); -}; - -class Item_sum_xor final :public Item_sum_bit -{ -public: - Item_sum_xor(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {} - Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {} - bool add(); - const char *func_name() const { return "bit_xor("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - -private: - void set_bits_from_counters(); -}; - -class sp_head; -class sp_name; -class Query_arena; -struct st_sp_security_context; - -/* - Item_sum_sp handles STORED AGGREGATE FUNCTIONS - - Each Item_sum_sp represents a custom aggregate function. Inside the - function's body, we require at least one occurrence of FETCH GROUP NEXT ROW - instruction. This cursor is what makes custom stored aggregates possible. - - During computation the function's add method is called. This in turn performs - an execution of the function. The function will execute from the current - function context (and instruction), if one exists, or from the start if not. - See Item_sp for more details. - - Upon encounter of FETCH GROUP NEXT ROW instruction, the function will pause - execution. We assume that the user has performed the necessary additions for - a row, between two encounters of FETCH GROUP NEXT ROW. - - Example: - create aggregate function f1(x INT) returns int - begin - declare continue handler for not found return s; - declare s int default 0 - loop - fetch group next row; - set s = s + x; - end loop; - end - - The function will always stop after an encounter of FETCH GROUP NEXT ROW, - except (!) on first encounter, as the value for the first row in the - group is already set in the argument x. This behaviour is done so when - a user writes a function, he should "logically" include FETCH GROUP NEXT ROW - before any "add" instructions in the stored function. This means however that - internally, the first occurrence doesn't stop the function. See the - implementation of FETCH GROUP NEXT ROW for details as to how it happens. - - Either way, one should assume that after calling "Item_sum_sp::add()" that - the values for that particular row have been added to the aggregation. - - To produce values for val_xxx methods we need an extra syntactic construct. - We require a continue handler when "no more rows are available". val_xxx - methods force a function return by executing the function again, while - setting a server flag that no more rows have been found. This implies - that val_xxx methods should only be called once per group however. - - Example: - DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN ret_val; -*/ -class Item_sum_sp final :public Item_sum, - public Item_sp -{ - private: - bool execute(); - -public: - Item_sum_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name, - sp_head *sp); - - Item_sum_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name, - sp_head *sp, List &list); - Item_sum_sp(THD *thd, Item_sum_sp *item); - - enum Sumfunctype sum_func () const - { - return SP_AGGREGATE_FUNC; - } - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) - { - return create_table_field_from_handler(root, table); - } - bool fix_length_and_dec(); - bool fix_fields(THD *thd, Item **ref); - const char *func_name() const; - const Type_handler *type_handler() const; - bool add(); - - /* val_xx functions */ - longlong val_int() - { - if(execute()) - return 0; - return sp_result_field->val_int(); - } - - double val_real() - { - if(execute()) - return 0.0; - return sp_result_field->val_real(); - } - - my_decimal *val_decimal(my_decimal *dec_buf) - { - if(execute()) - return NULL; - return sp_result_field->val_decimal(dec_buf); - } - - bool val_native(THD *thd, Native *to) - { - return null_value= execute() || sp_result_field->val_native(to); - } - - String *val_str(String *str) - { - String buf; - char buff[20]; - buf.set(buff, 20, str->charset()); - buf.length(0); - if (execute()) - return NULL; - /* - result_field will set buf pointing to internal buffer - of the resul_field. Due to this it will change any time - when SP is executed. In order to prevent occasional - corruption of returned value, we make here a copy. - */ - sp_result_field->val_str(&buf); - str->copy(buf); - return str; - } - void reset_field(){DBUG_ASSERT(0);} - void update_field(){DBUG_ASSERT(0);} - void clear(); - void cleanup(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return execute() || sp_result_field->get_date(ltime, fuzzydate); - } - inline Field *get_sp_result_field() - { - return sp_result_field; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - Item *copy_or_same(THD *thd); -}; - -/* Items to get the value of a stored sum function */ - -class Item_sum_field :public Item -{ -protected: - Field *field; -public: - Item_sum_field(THD *thd, Item_sum *item) - :Item(thd), field(item->result_field) - { - name= item->name; - maybe_null= true; - decimals= item->decimals; - max_length= item->max_length; - unsigned_flag= item->unsigned_flag; - } - table_map used_tables() const { return (table_map) 1L; } - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - return create_tmp_field_ex_simple(root, table, src, param); - } - void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(name.str, arg, VCOL_IMPOSSIBLE); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } -}; - - -class Item_avg_field :public Item_sum_field -{ -protected: - uint prec_increment; -public: - Item_avg_field(THD *thd, Item_sum_avg *item) - :Item_sum_field(thd, item), prec_increment(item->prec_increment) - { } - enum Type type() const { return FIELD_AVG_ITEM; } - bool is_null() { update_null_value(); return null_value; } -}; - - -class Item_avg_field_double :public Item_avg_field -{ -public: - Item_avg_field_double(THD *thd, Item_sum_avg *item) - :Item_avg_field(thd, item) - { } - const Type_handler *type_handler() const { return &type_handler_double; } - longlong val_int() { return val_int_from_real(); } - my_decimal *val_decimal(my_decimal *dec) { return val_decimal_from_real(dec); } - String *val_str(String *str) { return val_string_from_real(str); } - double val_real(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_avg_field_decimal :public Item_avg_field -{ - uint f_precision, f_scale, dec_bin_size; -public: - Item_avg_field_decimal(THD *thd, Item_sum_avg *item) - :Item_avg_field(thd, item), - f_precision(item->f_precision), - f_scale(item->f_scale), - dec_bin_size(item->dec_bin_size) - { } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - double val_real() - { - return VDec(this).to_double(); - } - longlong val_int() - { - return VDec(this).to_longlong(unsigned_flag); - } - String *val_str(String *str) - { - return VDec(this).to_string_round(str, decimals); - } - my_decimal *val_decimal(my_decimal *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_variance_field :public Item_sum_field -{ - uint sample; -public: - Item_variance_field(THD *thd, Item_sum_variance *item) - :Item_sum_field(thd, item), sample(item->sample) - { } - enum Type type() const {return FIELD_VARIANCE_ITEM; } - double val_real(); - longlong val_int() { return val_int_from_real(); } - String *val_str(String *str) - { return val_string_from_real(str); } - my_decimal *val_decimal(my_decimal *dec_buf) - { return val_decimal_from_real(dec_buf); } - bool is_null() { update_null_value(); return null_value; } - const Type_handler *type_handler() const { return &type_handler_double; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_std_field :public Item_variance_field -{ -public: - Item_std_field(THD *thd, Item_sum_std *item) - :Item_variance_field(thd, item) - { } - enum Type type() const { return FIELD_STD_ITEM; } - double val_real(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - User defined aggregates -*/ - -#ifdef HAVE_DLOPEN - -class Item_udf_sum : public Item_sum -{ -protected: - udf_handler udf; - -public: - Item_udf_sum(THD *thd, udf_func *udf_arg): - Item_sum(thd), udf(udf_arg) - { quick_group=0; } - Item_udf_sum(THD *thd, udf_func *udf_arg, List &list): - Item_sum(thd, list), udf(udf_arg) - { quick_group=0;} - Item_udf_sum(THD *thd, Item_udf_sum *item) - :Item_sum(thd, item), udf(item->udf) - { udf.not_original= TRUE; } - const char *func_name() const { return udf.name(); } - bool fix_fields(THD *thd, Item **ref) - { - DBUG_ASSERT(fixed == 0); - - if (init_sum_func_check(thd)) - return TRUE; - - fixed= 1; - /* - We set const_item_cache to false in constructors. - It can be later changed to "true", in a Item_sum::make_const() call. - No make_const() calls should have happened so far. - */ - DBUG_ASSERT(!const_item_cache); - if (udf.fix_fields(thd, this, this->arg_count, this->args)) - return TRUE; - /** - The above call for udf.fix_fields() updates - the Used_tables_and_const_cache part of "this" as if it was a regular - non-aggregate UDF function and can change both const_item_cache and - used_tables_cache members. - - The used_tables_cache will be re-calculated in update_used_tables() - which is called from check_sum_func() below. So we don't care about - its current value. - - The const_item_cache must stay "false" until a Item_sum::make_const() - call happens, if ever. So we need to reset const_item_cache back to - "false" here. - */ - const_item_cache= false; - memcpy (orig_args, args, sizeof (Item *) * arg_count); - return check_sum_func(thd, ref); - } - enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } - virtual bool have_field_update(void) const { return 0; } - - void clear(); - bool add(); - bool supports_removal() const; - void remove(); - void reset_field() {}; - void update_field() {}; - void cleanup(); - virtual void print(String *str, enum_query_type query_type); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } -}; - - -class Item_sum_udf_float :public Item_udf_sum -{ - public: - Item_sum_udf_float(THD *thd, udf_func *udf_arg): - Item_udf_sum(thd, udf_arg) {} - Item_sum_udf_float(THD *thd, udf_func *udf_arg, List &list): - Item_udf_sum(thd, udf_arg, list) {} - Item_sum_udf_float(THD *thd, Item_sum_udf_float *item) - :Item_udf_sum(thd, item) {} - longlong val_int() { return val_int_from_real(); } - double val_real(); - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - const Type_handler *type_handler() const { return &type_handler_double; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_sum_udf_int :public Item_udf_sum -{ -public: - Item_sum_udf_int(THD *thd, udf_func *udf_arg): - Item_udf_sum(thd, udf_arg) {} - Item_sum_udf_int(THD *thd, udf_func *udf_arg, List &list): - Item_udf_sum(thd, udf_arg, list) {} - Item_sum_udf_int(THD *thd, Item_sum_udf_int *item) - :Item_udf_sum(thd, item) {} - longlong val_int(); - double val_real() - { DBUG_ASSERT(fixed == 1); return (double) Item_sum_udf_int::val_int(); } - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - const Type_handler *type_handler() const - { - if (unsigned_flag) - return &type_handler_ulonglong; - return &type_handler_slonglong; - } - bool fix_length_and_dec() { decimals=0; max_length=21; return FALSE; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_sum_udf_str :public Item_udf_sum -{ -public: - Item_sum_udf_str(THD *thd, udf_func *udf_arg): - Item_udf_sum(thd, udf_arg) {} - Item_sum_udf_str(THD *thd, udf_func *udf_arg, List &list): - Item_udf_sum(thd, udf_arg, list) {} - Item_sum_udf_str(THD *thd, Item_sum_udf_str *item) - :Item_udf_sum(thd, item) {} - String *val_str(String *); - double val_real() - { - int err_not_used; - char *end_not_used; - String *res; - res=val_str(&str_value); - return res ? res->charset()->strntod((char*) res->ptr(),res->length(), - &end_not_used, &err_not_used) : 0.0; - } - longlong val_int() - { - int err_not_used; - char *end; - String *res; - CHARSET_INFO *cs; - - if (!(res= val_str(&str_value))) - return 0; /* Null value */ - cs= res->charset(); - end= (char*) res->ptr()+res->length(); - return cs->strtoll10(res->ptr(), &end, &err_not_used); - } - my_decimal *val_decimal(my_decimal *dec); - const Type_handler *type_handler() const { return string_type_handler(); } - bool fix_length_and_dec(); - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_sum_udf_decimal :public Item_udf_sum -{ -public: - Item_sum_udf_decimal(THD *thd, udf_func *udf_arg): - Item_udf_sum(thd, udf_arg) {} - Item_sum_udf_decimal(THD *thd, udf_func *udf_arg, List &list): - Item_udf_sum(thd, udf_arg, list) {} - Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item) - :Item_udf_sum(thd, item) {} - String *val_str(String *str) - { - return VDec(this).to_string_round(str, decimals); - } - double val_real() - { - return VDec(this).to_double(); - } - longlong val_int() - { - return VDec(this).to_longlong(unsigned_flag); - } - my_decimal *val_decimal(my_decimal *); - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -#else /* Dummy functions to get sql_yacc.cc compiled */ - -class Item_sum_udf_float :public Item_sum_double -{ - public: - Item_sum_udf_float(THD *thd, udf_func *udf_arg): - Item_sum_double(thd) {} - Item_sum_udf_float(THD *thd, udf_func *udf_arg, List &list): - Item_sum_double(thd) {} - Item_sum_udf_float(THD *thd, Item_sum_udf_float *item) - :Item_sum_double(thd, item) {} - enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } - double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; } - void clear() {} - bool add() { return 0; } - void reset_field() { DBUG_ASSERT(0); }; - void update_field() {} -}; - - -class Item_sum_udf_int :public Item_sum_double -{ -public: - Item_sum_udf_int(THD *thd, udf_func *udf_arg): - Item_sum_double(thd) {} - Item_sum_udf_int(THD *thd, udf_func *udf_arg, List &list): - Item_sum_double(thd) {} - Item_sum_udf_int(THD *thd, Item_sum_udf_int *item) - :Item_sum_double(thd, item) {} - enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } - longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; } - double val_real() { DBUG_ASSERT(fixed == 1); return 0; } - void clear() {} - bool add() { return 0; } - void reset_field() { DBUG_ASSERT(0); }; - void update_field() {} -}; - - -class Item_sum_udf_decimal :public Item_sum_double -{ - public: - Item_sum_udf_decimal(THD *thd, udf_func *udf_arg): - Item_sum_double(thd) {} - Item_sum_udf_decimal(THD *thd, udf_func *udf_arg, List &list): - Item_sum_double(thd) {} - Item_sum_udf_decimal(THD *thd, Item_sum_udf_float *item) - :Item_sum_double(thd, item) {} - enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } - double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; } - my_decimal *val_decimal(my_decimal *) { DBUG_ASSERT(fixed == 1); return 0; } - void clear() {} - bool add() { return 0; } - void reset_field() { DBUG_ASSERT(0); }; - void update_field() {} -}; - - -class Item_sum_udf_str :public Item_sum_double -{ -public: - Item_sum_udf_str(THD *thd, udf_func *udf_arg): - Item_sum_double(thd) {} - Item_sum_udf_str(THD *thd, udf_func *udf_arg, List &list): - Item_sum_double(thd) {} - Item_sum_udf_str(THD *thd, Item_sum_udf_str *item) - :Item_sum_double(thd, item) {} - String *val_str(String *) - { DBUG_ASSERT(fixed == 1); null_value=1; return 0; } - double val_real() { DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; } - longlong val_int() { DBUG_ASSERT(fixed == 1); null_value=1; return 0; } - bool fix_length_and_dec() { maybe_null=1; max_length=0; return FALSE; } - enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } - void clear() {} - bool add() { return 0; } - void reset_field() { DBUG_ASSERT(0); }; - void update_field() {} -}; - -#endif /* HAVE_DLOPEN */ - -C_MODE_START -int group_concat_key_cmp_with_distinct(void* arg, const void* key1, - const void* key2); -int group_concat_key_cmp_with_distinct_with_nulls(void* arg, const void* key1, - const void* key2); -int group_concat_key_cmp_with_order(void* arg, const void* key1, - const void* key2); -int group_concat_key_cmp_with_order_with_nulls(void *arg, const void *key1, - const void *key2); -int dump_leaf_key(void* key_arg, - element_count count __attribute__((unused)), - void* item_arg); -C_MODE_END - -class Item_func_group_concat : public Item_sum -{ -protected: - TMP_TABLE_PARAM *tmp_table_param; - String result; - String *separator; - TREE tree_base; - TREE *tree; - size_t tree_len; - Item **ref_pointer_array; - - /** - If DISTINCT is used with this GROUP_CONCAT, this member is used to filter - out duplicates. - @see Item_func_group_concat::setup - @see Item_func_group_concat::add - @see Item_func_group_concat::clear - */ - Unique *unique_filter; - TABLE *table; - ORDER **order; - Name_resolution_context *context; - /** The number of ORDER BY items. */ - uint arg_count_order; - /** The number of selected items, aka the expr list. */ - uint arg_count_field; - uint row_count; - bool distinct; - bool warning_for_row; - bool always_null; - bool force_copy_fields; - /** True if entire result of GROUP_CONCAT has been written to output buffer. */ - bool result_finalized; - /** Limits the rows in the result */ - Item *row_limit; - /** Skips a particular number of rows in from the result*/ - Item *offset_limit; - bool limit_clause; - /* copy of the offset limit */ - ulonglong copy_offset_limit; - /*copy of the row limit */ - ulonglong copy_row_limit; - - /* - Following is 0 normal object and pointer to original one for copy - (to correctly free resources) - */ - Item_func_group_concat *original; - - /* - Used by Item_func_group_concat and Item_func_json_arrayagg. The latter - needs null values but the former doesn't. - */ - bool add(bool exclude_nulls); - - friend int group_concat_key_cmp_with_distinct(void* arg, const void* key1, - const void* key2); - friend int group_concat_key_cmp_with_distinct_with_nulls(void* arg, - const void* key1, - const void* key2); - friend int group_concat_key_cmp_with_order(void* arg, const void* key1, - const void* key2); - friend int group_concat_key_cmp_with_order_with_nulls(void *arg, - const void *key1, const void *key2); - friend int dump_leaf_key(void* key_arg, - element_count count __attribute__((unused)), - void* item_arg); - - bool repack_tree(THD *thd); - - /* - Says whether the function should skip NULL arguments - or add them to the result. - Redefined in JSON_ARRAYAGG. - */ - virtual bool skip_nulls() const { return true; } - virtual String *get_str_from_item(Item *i, String *tmp) - { return i->val_str(tmp); } - virtual String *get_str_from_field(Item *i, Field *f, String *tmp, - const uchar *key, size_t offset) - { return f->val_str(tmp, key + offset); } - virtual void cut_max_length(String *result, - uint old_length, uint max_length) const; -public: - // Methods used by ColumnStore - bool get_distinct() const { return distinct; } - uint get_count_field() const { return arg_count_field; } - uint get_order_field() const { return arg_count_order; } - const String* get_separator() const { return separator; } - ORDER** get_order() const { return order; } - -public: - Item_func_group_concat(THD *thd, Name_resolution_context *context_arg, - bool is_distinct, List *is_select, - const SQL_I_List &is_order, String *is_separator, - bool limit_clause, Item *row_limit, Item *offset_limit); - - Item_func_group_concat(THD *thd, Item_func_group_concat *item); - ~Item_func_group_concat(); - void cleanup(); - - enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;} - const char *func_name() const { return "group_concat("; } - const Type_handler *type_handler() const - { - if (too_big_for_varchar()) - return &type_handler_blob; - return &type_handler_varchar; - } - void clear(); - bool add() - { - return add(skip_nulls()); - } - void reset_field() { DBUG_ASSERT(0); } // not used - void update_field() { DBUG_ASSERT(0); } // not used - bool fix_fields(THD *,Item **); - bool setup(THD *thd); - void make_unique(); - double val_real() - { - int error; - const char *end; - String *res; - if (!(res= val_str(&str_value))) - return 0.0; - end= res->ptr() + res->length(); - return (my_strtod(res->ptr(), (char**) &end, &error)); - } - longlong val_int() - { - String *res; - char *end_ptr; - int error; - if (!(res= val_str(&str_value))) - return (longlong) 0; - end_ptr= (char*) res->ptr()+ res->length(); - return my_strtoll10(res->ptr(), &end_ptr, &error); - } - my_decimal *val_decimal(my_decimal *decimal_value) - { - return val_decimal_from_string(decimal_value); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return get_date_from_string(thd, ltime, fuzzydate); - } - String* val_str(String* str); - Item *copy_or_same(THD* thd); - void no_rows_in_result() {} - void print(String *str, enum_query_type query_type); - bool change_context_processor(void *cntx) - { context= (Name_resolution_context *)cntx; return FALSE; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - qsort_cmp2 get_comparator_function_for_distinct(); - qsort_cmp2 get_comparator_function_for_order_by(); - uchar* get_record_pointer(); - uint get_null_bytes(); - -}; - -#endif /* ITEM_SUM_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_timefunc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_timefunc.h deleted file mode 100644 index a910b2c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_timefunc.h +++ /dev/null @@ -1,1776 +0,0 @@ -#ifndef ITEM_TIMEFUNC_INCLUDED -#define ITEM_TIMEFUNC_INCLUDED -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2009-2011, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* Function items used by mysql */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -class MY_LOCALE; - - -bool get_interval_value(THD *thd, Item *args, - interval_type int_type, INTERVAL *interval); - - -class Item_long_func_date_field: public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_date(func_name()); } -public: - Item_long_func_date_field(THD *thd, Item *a) - :Item_long_func(thd, a) { } -}; - - -class Item_long_func_time_field: public Item_long_func -{ - bool check_arguments() const - { return args[0]->check_type_can_return_time(func_name()); } -public: - Item_long_func_time_field(THD *thd, Item *a) - :Item_long_func(thd, a) { } -}; - - -class Item_func_period_add :public Item_long_func -{ - bool check_arguments() const - { return check_argument_types_can_return_int(0, 2); } -public: - Item_func_period_add(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "period_add"; } - bool fix_length_and_dec() - { - max_length=6*MY_CHARSET_BIN_MB_MAXLEN; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_period_diff :public Item_long_func -{ - bool check_arguments() const - { return check_argument_types_can_return_int(0, 2); } -public: - Item_func_period_diff(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "period_diff"; } - bool fix_length_and_dec() - { - decimals=0; - max_length=6*MY_CHARSET_BIN_MB_MAXLEN; - return FALSE; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_to_days :public Item_long_func_date_field -{ -public: - Item_func_to_days(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "to_days"; } - bool fix_length_and_dec() - { - decimals=0; - max_length=6*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - return FALSE; - } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_to_seconds :public Item_longlong_func -{ - bool check_arguments() const - { return check_argument_types_can_return_date(0, arg_count); } -public: - Item_func_to_seconds(THD *thd, Item *a): Item_longlong_func(thd, a) {} - longlong val_int(); - const char *func_name() const { return "to_seconds"; } - bool fix_length_and_dec() - { - decimals=0; - fix_char_length(12); - maybe_null= 1; - return FALSE; - } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool check_partition_func_processor(void *bool_arg) { return FALSE;} - - /* Only meaningful with date part and optional time part */ - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_dayofmonth :public Item_long_func_date_field -{ -public: - Item_func_dayofmonth(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "dayofmonth"; } - bool fix_length_and_dec() - { - decimals=0; - max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_month :public Item_long_func -{ -public: - Item_func_month(THD *thd, Item *a): Item_long_func(thd, a) - { } - longlong val_int(); - const char *func_name() const { return "month"; } - bool fix_length_and_dec() - { - decimals= 0; - fix_char_length(2); - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_monthname :public Item_str_func -{ - MY_LOCALE *locale; -public: - Item_func_monthname(THD *thd, Item *a): Item_str_func(thd, a) {} - const char *func_name() const { return "monthname"; } - String *val_str(String *str); - bool fix_length_and_dec(); - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_dayofyear :public Item_long_func_date_field -{ -public: - Item_func_dayofyear(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "dayofyear"; } - bool fix_length_and_dec() - { - decimals= 0; - fix_char_length(3); - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_hour :public Item_long_func_time_field -{ -public: - Item_func_hour(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "hour"; } - bool fix_length_and_dec() - { - decimals=0; - max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_time_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_minute :public Item_long_func_time_field -{ -public: - Item_func_minute(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "minute"; } - bool fix_length_and_dec() - { - decimals=0; - max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_time_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_quarter :public Item_long_func_date_field -{ -public: - Item_func_quarter(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "quarter"; } - bool fix_length_and_dec() - { - decimals=0; - max_length=1*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_second :public Item_long_func_time_field -{ -public: - Item_func_second(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "second"; } - bool fix_length_and_dec() - { - decimals=0; - max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_time_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_week :public Item_long_func -{ - bool check_arguments() const - { - return args[0]->check_type_can_return_date(func_name()) || - (arg_count > 1 && args[1]->check_type_can_return_int(func_name())); - } -public: - Item_func_week(THD *thd, Item *a): Item_long_func(thd, a) {} - Item_func_week(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "week"; } - bool fix_length_and_dec() - { - decimals=0; - max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - return FALSE; - } - bool check_vcol_func_processor(void *arg) - { - if (arg_count == 2) - return FALSE; - return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); - } - bool check_valid_arguments_processor(void *int_arg) - { - return arg_count == 2; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_yearweek :public Item_long_func -{ - bool check_arguments() const - { - return args[0]->check_type_can_return_date(func_name()) || - args[1]->check_type_can_return_int(func_name()); - } -public: - Item_func_yearweek(THD *thd, Item *a, Item *b) - :Item_long_func(thd, a, b) {} - longlong val_int(); - const char *func_name() const { return "yearweek"; } - bool fix_length_and_dec() - { - decimals=0; - max_length=6*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_year :public Item_long_func_date_field -{ -public: - Item_func_year(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "year"; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool fix_length_and_dec() - { - decimals=0; - max_length=4*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_weekday :public Item_long_func -{ - bool odbc_type; -public: - Item_func_weekday(THD *thd, Item *a, bool type_arg): - Item_long_func(thd, a), odbc_type(type_arg) { } - longlong val_int(); - const char *func_name() const - { - return (odbc_type ? "dayofweek" : "weekday"); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } - bool fix_length_and_dec() - { - decimals= 0; - fix_char_length(1); - maybe_null=1; - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_dayname :public Item_str_func -{ - MY_LOCALE *locale; - public: - Item_func_dayname(THD *thd, Item *a): Item_str_func(thd, a) {} - const char *func_name() const { return "dayname"; } - String *val_str(String *str); - const Type_handler *type_handler() const { return &type_handler_varchar; } - bool fix_length_and_dec(); - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); - } - bool check_valid_arguments_processor(void *int_arg) - { - return !has_date_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_seconds_hybrid: public Item_func_numhybrid -{ -public: - Item_func_seconds_hybrid(THD *thd): Item_func_numhybrid(thd) {} - Item_func_seconds_hybrid(THD *thd, Item *a): Item_func_numhybrid(thd, a) {} - void fix_length_and_dec_generic(uint dec) - { - DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS); - decimals= dec; - max_length=17 + (decimals ? decimals + 1 : 0); - maybe_null= true; - if (decimals) - set_handler(&type_handler_newdecimal); - else - set_handler(type_handler_long_or_longlong()); - } - double real_op() { DBUG_ASSERT(0); return 0; } - String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - DBUG_ASSERT(0); - return true; - } -}; - - -class Item_func_unix_timestamp :public Item_func_seconds_hybrid -{ - bool get_timestamp_value(my_time_t *seconds, ulong *second_part); -public: - Item_func_unix_timestamp(THD *thd): Item_func_seconds_hybrid(thd) {} - Item_func_unix_timestamp(THD *thd, Item *a): - Item_func_seconds_hybrid(thd, a) {} - const char *func_name() const { return "unix_timestamp"; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - /* - UNIX_TIMESTAMP() depends on the current timezone - (and thus may not be used as a partitioning function) - when its argument is NOT of the TIMESTAMP type. - */ - bool check_valid_arguments_processor(void *int_arg) - { - return !has_timestamp_args(); - } - bool check_vcol_func_processor(void *arg) - { - if (arg_count) - return FALSE; - return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); - } - bool fix_length_and_dec() - { - fix_length_and_dec_generic(arg_count ? - args[0]->datetime_precision(current_thd) : 0); - return FALSE; - } - longlong int_op(); - my_decimal *decimal_op(my_decimal* buf); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_time_to_sec :public Item_func_seconds_hybrid -{ -public: - Item_func_time_to_sec(THD *thd, Item *item): - Item_func_seconds_hybrid(thd, item) {} - const char *func_name() const { return "time_to_sec"; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_time_args(); - } - bool fix_length_and_dec() - { - fix_length_and_dec_generic(args[0]->time_precision(current_thd)); - return FALSE; - } - longlong int_op(); - my_decimal *decimal_op(my_decimal* buf); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_datefunc :public Item_func -{ -public: - Item_datefunc(THD *thd): Item_func(thd) { } - Item_datefunc(THD *thd, Item *a): Item_func(thd, a) { } - Item_datefunc(THD *thd, Item *a, Item *b): Item_func(thd, a, b) { } - const Type_handler *type_handler() const { return &type_handler_newdate; } - longlong val_int() { return Date(this).to_longlong(); } - double val_real() { return Date(this).to_double(); } - String *val_str(String *to) { return Date(this).to_string(to); } - my_decimal *val_decimal(my_decimal *to) { return Date(this).to_decimal(to); } - bool fix_length_and_dec() - { - fix_attributes_date(); - maybe_null= (arg_count > 0); - return FALSE; - } -}; - - -class Item_timefunc :public Item_func -{ -public: - Item_timefunc(THD *thd): Item_func(thd) {} - Item_timefunc(THD *thd, Item *a): Item_func(thd, a) {} - Item_timefunc(THD *thd, Item *a, Item *b): Item_func(thd, a, b) {} - Item_timefunc(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b ,c) {} - const Type_handler *type_handler() const { return &type_handler_time2; } - longlong val_int() { return Time(this).to_longlong(); } - double val_real() { return Time(this).to_double(); } - String *val_str(String *to) { return Time(this).to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) { return Time(this).to_decimal(to); } - bool val_native(THD *thd, Native *to) - { - return Time(thd, this).to_native(to, decimals); - } -}; - - -class Item_datetimefunc :public Item_func -{ -public: - Item_datetimefunc(THD *thd): Item_func(thd) {} - Item_datetimefunc(THD *thd, Item *a): Item_func(thd, a) {} - Item_datetimefunc(THD *thd, Item *a, Item *b): Item_func(thd, a, b) {} - Item_datetimefunc(THD *thd, Item *a, Item *b, Item *c): - Item_func(thd, a, b ,c) {} - const Type_handler *type_handler() const { return &type_handler_datetime2; } - longlong val_int() { return Datetime(this).to_longlong(); } - double val_real() { return Datetime(this).to_double(); } - String *val_str(String *to) { return Datetime(this).to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) { return Datetime(this).to_decimal(to); } -}; - - -/* Abstract CURTIME function. Children should define what time zone is used */ - -class Item_func_curtime :public Item_timefunc -{ - MYSQL_TIME ltime; - query_id_t last_query_id; -public: - Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd), last_query_id(0) - { decimals= dec; } - bool fix_fields(THD *, Item **); - bool fix_length_and_dec() { fix_attributes_time(decimals); return FALSE; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - /* - Abstract method that defines which time zone is used for conversion. - Converts time current time in my_time_t representation to broken-down - MYSQL_TIME representation using UTC-SYSTEM or per-thread time zone. - */ - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); - } - void print(String *str, enum_query_type query_type); -}; - - -class Item_func_curtime_local :public Item_func_curtime -{ -public: - Item_func_curtime_local(THD *thd, uint dec): Item_func_curtime(thd, dec) {} - const char *func_name() const { return "curtime"; } - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_curtime_utc :public Item_func_curtime -{ -public: - Item_func_curtime_utc(THD *thd, uint dec): Item_func_curtime(thd, dec) {} - const char *func_name() const { return "utc_time"; } - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* Abstract CURDATE function. See also Item_func_curtime. */ - -class Item_func_curdate :public Item_datefunc -{ - query_id_t last_query_id; - MYSQL_TIME ltime; -public: - Item_func_curdate(THD *thd): Item_datefunc(thd), last_query_id(0) {} - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); - } -}; - - -class Item_func_curdate_local :public Item_func_curdate -{ -public: - Item_func_curdate_local(THD *thd): Item_func_curdate(thd) {} - const char *func_name() const { return "curdate"; } - void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_curdate_utc :public Item_func_curdate -{ -public: - Item_func_curdate_utc(THD *thd): Item_func_curdate(thd) {} - const char *func_name() const { return "utc_date"; } - void store_now_in_TIME(THD* thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* Abstract CURRENT_TIMESTAMP function. See also Item_func_curtime */ - -class Item_func_now :public Item_datetimefunc -{ - MYSQL_TIME ltime; - query_id_t last_query_id; -public: - Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0) - { decimals= dec; } - bool fix_fields(THD *, Item **); - bool fix_length_and_dec() - { fix_attributes_datetime(decimals); return FALSE;} - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; - bool check_vcol_func_processor(void *arg) - { - /* - NOW is safe for replication as slaves will run with same time as - master - */ - return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); - } - void print(String *str, enum_query_type query_type); -}; - - -class Item_func_now_local :public Item_func_now -{ -public: - Item_func_now_local(THD *thd, uint dec): Item_func_now(thd, dec) {} - const char *func_name() const { return "current_timestamp"; } - int save_in_field(Field *field, bool no_conversions); - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - virtual enum Functype functype() const { return NOW_FUNC; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_now_utc :public Item_func_now -{ -public: - Item_func_now_utc(THD *thd, uint dec): Item_func_now(thd, dec) {} - const char *func_name() const { return "utc_timestamp"; } - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - virtual enum Functype functype() const { return NOW_UTC_FUNC; } - virtual bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, - VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - This is like NOW(), but always uses the real current time, not the - query_start(). This matches the Oracle behavior. -*/ -class Item_func_sysdate_local :public Item_func_now -{ -public: - Item_func_sysdate_local(THD *thd, uint dec): Item_func_now(thd, dec) {} - bool const_item() const { return 0; } - const char *func_name() const { return "sysdate"; } - void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - table_map used_tables() const { return RAND_TABLE_BIT; } - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, - VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC); - } - virtual enum Functype functype() const { return SYSDATE_FUNC; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_from_days :public Item_datefunc -{ - bool check_arguments() const - { return args[0]->check_type_can_return_int(func_name()); } -public: - Item_func_from_days(THD *thd, Item *a): Item_datefunc(thd, a) {} - const char *func_name() const { return "from_days"; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return has_date_args() || has_time_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_date_format :public Item_str_func -{ - bool check_arguments() const - { - return args[0]->check_type_can_return_date(func_name()) || - check_argument_types_can_return_text(1, arg_count); - } - const MY_LOCALE *locale; - int fixed_length; - String value; -protected: - bool is_time_format; -public: - Item_func_date_format(THD *thd, Item *a, Item *b): - Item_str_func(thd, a, b), locale(0), is_time_format(false) {} - Item_func_date_format(THD *thd, Item *a, Item *b, Item *c): - Item_str_func(thd, a, b, c), locale(0), is_time_format(false) {} - String *val_str(String *str); - const char *func_name() const { return "date_format"; } - bool fix_length_and_dec(); - uint format_length(const String *format); - bool eq(const Item *item, bool binary_cmp) const; - bool check_vcol_func_processor(void *arg) - { - if (arg_count > 2) - return false; - return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_time_format: public Item_func_date_format -{ -public: - Item_func_time_format(THD *thd, Item *a, Item *b): - Item_func_date_format(thd, a, b) { is_time_format= true; } - const char *func_name() const { return "time_format"; } - bool check_vcol_func_processor(void *arg) { return false; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_from_unixtime :public Item_datetimefunc -{ - bool check_arguments() const - { return args[0]->check_type_can_return_decimal(func_name()); } - Time_zone *tz; - public: - Item_func_from_unixtime(THD *thd, Item *a): Item_datetimefunc(thd, a) {} - const char *func_name() const { return "from_unixtime"; } - bool fix_length_and_dec(); - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - We need Time_zone class declaration for storing pointers in - Item_func_convert_tz. -*/ -class Time_zone; - -/* - This class represents CONVERT_TZ() function. - The important fact about this function that it is handled in special way. - When such function is met in expression time_zone system tables are added - to global list of tables to open, so later those already opened and locked - tables can be used during this function calculation for loading time zone - descriptions. -*/ -class Item_func_convert_tz :public Item_datetimefunc -{ - bool check_arguments() const - { - return args[0]->check_type_can_return_date(func_name()) || - check_argument_types_can_return_text(1, arg_count); - } - /* - If time zone parameters are constants we are caching objects that - represent them (we use separate from_tz_cached/to_tz_cached members - to indicate this fact, since NULL is legal value for from_tz/to_tz - members. - */ - bool from_tz_cached, to_tz_cached; - Time_zone *from_tz, *to_tz; - public: - Item_func_convert_tz(THD *thd, Item *a, Item *b, Item *c): - Item_datetimefunc(thd, a, b, c), from_tz_cached(0), to_tz_cached(0) {} - const char *func_name() const { return "convert_tz"; } - bool fix_length_and_dec() - { - fix_attributes_datetime(args[0]->datetime_precision(current_thd)); - maybe_null= true; - return FALSE; - } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - void cleanup(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_sec_to_time :public Item_timefunc -{ - bool check_arguments() const - { return args[0]->check_type_can_return_decimal(func_name()); } -public: - Item_func_sec_to_time(THD *thd, Item *item): Item_timefunc(thd, item) {} - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool fix_length_and_dec() - { - fix_attributes_time(args[0]->decimals); - maybe_null= true; - return FALSE; - } - const char *func_name() const { return "sec_to_time"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_date_add_interval :public Item_handled_func -{ -public: - const interval_type int_type; // keep it public - const bool date_sub_interval; // keep it public - Item_date_add_interval(THD *thd, Item *a, Item *b, interval_type type_arg, - bool neg_arg): - Item_handled_func(thd, a, b), int_type(type_arg), - date_sub_interval(neg_arg) {} - const char *func_name() const { return "date_add_interval"; } - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const; - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return INTERVAL_PRECEDENCE; } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_extract :public Item_int_func, - public Type_handler_hybrid_field_type -{ - date_mode_t m_date_mode; - const Type_handler_int_result *handler_by_length(uint32 length, - uint32 threashold) - { - if (length >= threashold) - return &type_handler_slonglong; - return &type_handler_slong; - } - void set_date_length(uint32 length) - { - /* - Although DATE components (e.g. YEAR, YEAR_MONTH, QUARTER, MONTH, WEEK) - cannot have a sign, we should probably still add +1, - because all around the code we assume that max_length is sign inclusive. - Another options is to set unsigned_flag to "true". - */ - set_handler(handler_by_length(max_length= length, 10)); // QQ: see above - m_date_mode= date_mode_t(0); - } - void set_day_length(uint32 length) - { - /* - Units starting with DAY can be negative: - EXTRACT(DAY FROM '-24:00:00') -> -1 - */ - set_handler(handler_by_length(max_length= length + 1/*sign*/, 11)); - m_date_mode= Temporal::Options(TIME_INTERVAL_DAY, current_thd); - } - void set_time_length(uint32 length) - { - set_handler(handler_by_length(max_length= length + 1/*sign*/, 11)); - m_date_mode= Temporal::Options(TIME_INTERVAL_hhmmssff, current_thd); - } - public: - const interval_type int_type; // keep it public - Item_extract(THD *thd, interval_type type_arg, Item *a): - Item_int_func(thd, a), - Type_handler_hybrid_field_type(&type_handler_slonglong), - m_date_mode(date_mode_t(0)), - int_type(type_arg) - { } - const Type_handler *type_handler() const - { - return Type_handler_hybrid_field_type::type_handler(); - } - longlong val_int(); - enum Functype functype() const { return EXTRACT_FUNC; } - const char *func_name() const { return "extract"; } - bool check_arguments() const; - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const; - void print(String *str, enum_query_type query_type); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) - { - if (int_type != INTERVAL_WEEK) - return FALSE; - return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); - } - bool check_valid_arguments_processor(void *int_arg) - { - switch (int_type) { - case INTERVAL_YEAR: - case INTERVAL_YEAR_MONTH: - case INTERVAL_QUARTER: - case INTERVAL_MONTH: - /* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */ - case INTERVAL_DAY: - return !has_date_args(); - case INTERVAL_DAY_HOUR: - case INTERVAL_DAY_MINUTE: - case INTERVAL_DAY_SECOND: - case INTERVAL_DAY_MICROSECOND: - return !has_datetime_args(); - case INTERVAL_HOUR: - case INTERVAL_HOUR_MINUTE: - case INTERVAL_HOUR_SECOND: - case INTERVAL_MINUTE: - case INTERVAL_MINUTE_SECOND: - case INTERVAL_SECOND: - case INTERVAL_MICROSECOND: - case INTERVAL_HOUR_MICROSECOND: - case INTERVAL_MINUTE_MICROSECOND: - case INTERVAL_SECOND_MICROSECOND: - return !has_time_args(); - default: - /* - INTERVAL_LAST is only an end marker, - INTERVAL_WEEK depends on default_week_format which is a session - variable and cannot be used for partitioning. See bug#57071. - */ - break; - } - return true; - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_char_typecast :public Item_handled_func -{ - uint cast_length; - CHARSET_INFO *cast_cs, *from_cs; - bool charset_conversion; - String tmp_value; - bool m_suppress_warning_to_error_escalation; -public: - bool has_explicit_length() const { return cast_length != ~0U; } -private: - String *reuse(String *src, size_t length); - String *copy(String *src, CHARSET_INFO *cs); - uint adjusted_length_with_warn(uint length); - void check_truncation_with_warn(String *src, size_t dstlen); - void fix_length_and_dec_internal(CHARSET_INFO *fromcs); -public: - // Methods used by ColumnStore - uint get_cast_length() const { return cast_length; } -public: - Item_char_typecast(THD *thd, Item *a, uint length_arg, CHARSET_INFO *cs_arg): - Item_handled_func(thd, a), cast_length(length_arg), cast_cs(cs_arg), - m_suppress_warning_to_error_escalation(false) {} - enum Functype functype() const { return CHAR_TYPECAST_FUNC; } - bool eq(const Item *item, bool binary_cmp) const; - const char *func_name() const { return "cast_as_char"; } - CHARSET_INFO *cast_charset() const { return cast_cs; } - String *val_str_generic(String *a); - String *val_str_binary_from_native(String *a); - void fix_length_and_dec_generic(); - void fix_length_and_dec_numeric(); - void fix_length_and_dec_str(); - void fix_length_and_dec_native_to_binary(uint32 octet_length); - bool fix_length_and_dec() - { - return args[0]->type_handler()->Item_char_typecast_fix_length_and_dec(this); - } - void print(String *str, enum_query_type query_type); - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_interval_DDhhmmssff_typecast :public Item_char_typecast -{ - uint m_fsp; -public: - Item_interval_DDhhmmssff_typecast(THD *thd, Item *a, uint fsp) - :Item_char_typecast(thd, a,Interval_DDhhmmssff::max_char_length(fsp), - &my_charset_latin1), - m_fsp(fsp) - { } - String *val_str(String *to) - { - Interval_DDhhmmssff it(current_thd, args[0], m_fsp); - null_value= !it.is_valid_interval_DDhhmmssff(); - return it.to_string(to, m_fsp); - } -}; - - -class Item_date_typecast :public Item_datefunc -{ -public: - Item_date_typecast(THD *thd, Item *a): Item_datefunc(thd, a) {} - const char *func_name() const { return "cast_as_date"; } - void print(String *str, enum_query_type query_type) - { - print_cast_temporal(str, query_type); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool fix_length_and_dec() - { - return args[0]->type_handler()->Item_date_typecast_fix_length_and_dec(this); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_time_typecast :public Item_timefunc -{ -public: - Item_time_typecast(THD *thd, Item *a, uint dec_arg): - Item_timefunc(thd, a) { decimals= dec_arg; } - const char *func_name() const { return "cast_as_time"; } - void print(String *str, enum_query_type query_type) - { - print_cast_temporal(str, query_type); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool fix_length_and_dec() - { - return args[0]->type_handler()-> - Item_time_typecast_fix_length_and_dec(this); - } - Sql_mode_dependency value_depends_on_sql_mode() const; - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_datetime_typecast :public Item_datetimefunc -{ -public: - Item_datetime_typecast(THD *thd, Item *a, uint dec_arg): - Item_datetimefunc(thd, a) { decimals= dec_arg; } - const char *func_name() const { return "cast_as_datetime"; } - void print(String *str, enum_query_type query_type) - { - print_cast_temporal(str, query_type); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool fix_length_and_dec() - { - return args[0]->type_handler()-> - Item_datetime_typecast_fix_length_and_dec(this); - } - Sql_mode_dependency value_depends_on_sql_mode() const; - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_makedate :public Item_datefunc -{ - bool check_arguments() const - { return check_argument_types_can_return_int(0, arg_count); } -public: - Item_func_makedate(THD *thd, Item *a, Item *b): - Item_datefunc(thd, a, b) {} - const char *func_name() const { return "makedate"; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_timestamp :public Item_datetimefunc -{ - bool check_arguments() const - { - return args[0]->check_type_can_return_date(func_name()) || - args[1]->check_type_can_return_time(func_name()); - } -public: - Item_func_timestamp(THD *thd, Item *a, Item *b) - :Item_datetimefunc(thd, a, b) - { } - const char *func_name() const { return "timestamp"; } - bool fix_length_and_dec() - { - THD *thd= current_thd; - uint dec0= args[0]->datetime_precision(thd); - uint dec1= Interval_DDhhmmssff::fsp(thd, args[1]); - fix_attributes_datetime(MY_MAX(dec0, dec1)); - maybe_null= true; - return false; - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - Datetime dt(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd)); - if (!dt.is_valid_datetime()) - return null_value= true; - Interval_DDhhmmssff it(thd, args[1]); - if (!it.is_valid_interval_DDhhmmssff()) - return null_value= true; - return (null_value= Sec6_add(dt.get_mysql_time(), it.get_mysql_time(), 1). - to_datetime(ltime)); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/** - ADDTIME(t,a) and SUBTIME(t,a) are time functions that calculate a - time/datetime value - - t: time_or_datetime_expression - a: time_expression - - Result: Time value or datetime value -*/ - -class Item_func_add_time :public Item_handled_func -{ - int sign; -public: - // Methods used by ColumnStore - int get_sign() const { return sign; } -public: - Item_func_add_time(THD *thd, Item *a, Item *b, bool neg_arg) - :Item_handled_func(thd, a, b), sign(neg_arg ? -1 : 1) - { } - bool fix_length_and_dec(); - const char *func_name() const { return sign > 0 ? "addtime" : "subtime"; } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_timediff :public Item_timefunc -{ - bool check_arguments() const - { return check_argument_types_can_return_time(0, arg_count); } -public: - Item_func_timediff(THD *thd, Item *a, Item *b): Item_timefunc(thd, a, b) {} - const char *func_name() const { return "timediff"; } - bool fix_length_and_dec() - { - THD *thd= current_thd; - uint dec= MY_MAX(args[0]->time_precision(thd), - args[1]->time_precision(thd)); - fix_attributes_time(dec); - maybe_null= true; - return FALSE; - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_maketime :public Item_timefunc -{ - bool check_arguments() const - { - return check_argument_types_can_return_int(0, 2) || - args[2]->check_type_can_return_decimal(func_name()); - } -public: - Item_func_maketime(THD *thd, Item *a, Item *b, Item *c): - Item_timefunc(thd, a, b, c) - {} - bool fix_length_and_dec() - { - fix_attributes_time(args[2]->decimals); - maybe_null= true; - return FALSE; - } - const char *func_name() const { return "maketime"; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_microsecond :public Item_long_func_time_field -{ -public: - Item_func_microsecond(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); - const char *func_name() const { return "microsecond"; } - bool fix_length_and_dec() - { - decimals=0; - maybe_null=1; - fix_char_length(6); - return FALSE; - } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) - { - return !has_time_args(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_timestamp_diff :public Item_longlong_func -{ - bool check_arguments() const - { return check_argument_types_can_return_date(0, arg_count); } - const interval_type int_type; -public: - // Methods used by ColumnStore - interval_type get_int_type() const { return int_type; }; -public: - Item_func_timestamp_diff(THD *thd, Item *a, Item *b, interval_type type_arg): - Item_longlong_func(thd, a, b), int_type(type_arg) {} - const char *func_name() const { return "timestampdiff"; } - longlong val_int(); - bool fix_length_and_dec() - { - decimals=0; - maybe_null=1; - return FALSE; - } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -enum date_time_format -{ - USA_FORMAT, JIS_FORMAT, ISO_FORMAT, EUR_FORMAT, INTERNAL_FORMAT -}; - -class Item_func_get_format :public Item_str_ascii_func -{ -public: - const timestamp_type type; // keep it public - Item_func_get_format(THD *thd, timestamp_type type_arg, Item *a): - Item_str_ascii_func(thd, a), type(type_arg) - {} - String *val_str_ascii(String *str); - const char *func_name() const { return "get_format"; } - bool fix_length_and_dec() - { - maybe_null= 1; - decimals=0; - fix_length_and_charset(17, default_charset()); - return FALSE; - } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_str_to_date :public Item_handled_func -{ - bool const_item; - String subject_converter; - String format_converter; - CHARSET_INFO *internal_charset; -public: - Item_func_str_to_date(THD *thd, Item *a, Item *b): - Item_handled_func(thd, a, b), const_item(false), - internal_charset(NULL) - {} - bool get_date_common(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate, - timestamp_type); - const char *func_name() const { return "str_to_date"; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_last_day :public Item_datefunc -{ - bool check_arguments() const - { return args[0]->check_type_can_return_date(func_name()); } -public: - Item_func_last_day(THD *thd, Item *a): Item_datefunc(thd, a) {} - const char *func_name() const { return "last_day"; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/*****************************************************************************/ - -class Func_handler_date_add_interval -{ -protected: - static uint interval_dec(const Item *item, interval_type int_type) - { - if (int_type == INTERVAL_MICROSECOND || - (int_type >= INTERVAL_DAY_MICROSECOND && - int_type <= INTERVAL_SECOND_MICROSECOND)) - return TIME_SECOND_PART_DIGITS; - if (int_type == INTERVAL_SECOND && item->decimals > 0) - return MY_MIN(item->decimals, TIME_SECOND_PART_DIGITS); - return 0; - } - interval_type int_type(const Item_handled_func *item) const - { - return static_cast(item)->int_type; - } - bool sub(const Item_handled_func *item) const - { - return static_cast(item)->date_sub_interval; - } - bool add(THD *thd, Item *item, interval_type type, bool sub, MYSQL_TIME *to) const - { - INTERVAL interval; - if (get_interval_value(thd, item, type, &interval)) - return true; - if (sub) - interval.neg = !interval.neg; - return date_add_interval(thd, to, type, interval); - } -}; - - -class Func_handler_date_add_interval_datetime: - public Item_handled_func::Handler_datetime, - public Func_handler_date_add_interval -{ -public: - bool fix_length_and_dec(Item_handled_func *item) const - { - uint dec= MY_MAX(item->arguments()[0]->datetime_precision(current_thd), - interval_dec(item->arguments()[1], int_type(item))); - item->fix_attributes_datetime(dec); - return false; - } - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - Datetime::Options opt(TIME_CONV_NONE, thd); - Datetime dt(thd, item->arguments()[0], opt); - if (!dt.is_valid_datetime() || - dt.check_date_with_warn(thd, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) - return (item->null_value= true); - dt.copy_to_mysql_time(to); - return (item->null_value= add(thd, item->arguments()[1], - int_type(item), sub(item), to)); - } -}; - - -class Func_handler_date_add_interval_datetime_arg0_time: - public Func_handler_date_add_interval_datetime -{ -public: - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const; -}; - - -class Func_handler_date_add_interval_date: - public Item_handled_func::Handler_date, - public Func_handler_date_add_interval -{ -public: - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - /* - The first argument is known to be of the DATE data type (not DATETIME). - We don't need rounding here. - */ - Date d(thd, item->arguments()[0], TIME_CONV_NONE); - if (!d.is_valid_date() || - d.check_date_with_warn(thd, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) - return (item->null_value= true); - d.copy_to_mysql_time(to); - return (item->null_value= add(thd, item->arguments()[1], - int_type(item), sub(item), to)); - } -}; - - -class Func_handler_date_add_interval_time: - public Item_handled_func::Handler_time, - public Func_handler_date_add_interval -{ -public: - bool fix_length_and_dec(Item_handled_func *item) const - { - uint dec= MY_MAX(item->arguments()[0]->time_precision(current_thd), - interval_dec(item->arguments()[1], int_type(item))); - item->fix_attributes_time(dec); - return false; - } - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - Time t(thd, item->arguments()[0]); - if (!t.is_valid_time()) - return (item->null_value= true); - t.copy_to_mysql_time(to); - return (item->null_value= add(thd, item->arguments()[1], - int_type(item), sub(item), to)); - } -}; - - -class Func_handler_date_add_interval_string: - public Item_handled_func::Handler_temporal_string, - public Func_handler_date_add_interval -{ -public: - bool fix_length_and_dec(Item_handled_func *item) const - { - uint dec= MY_MAX(item->arguments()[0]->datetime_precision(current_thd), - interval_dec(item->arguments()[1], int_type(item))); - item->Type_std_attributes::set( - Type_temporal_attributes_not_fixed_dec(MAX_DATETIME_WIDTH, dec, false), - DTCollation(item->default_charset(), - DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII)); - item->fix_char_length(item->max_length); - return false; - } - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - if (item->arguments()[0]-> - get_date(thd, to, Datetime::Options(TIME_CONV_NONE, thd)) || - (to->time_type != MYSQL_TIMESTAMP_TIME && - check_date_with_warn(thd, to, TIME_NO_ZEROS, MYSQL_TIMESTAMP_ERROR))) - return (item->null_value= true); - return (item->null_value= add(thd, item->arguments()[1], - int_type(item), sub(item), to)); - } -}; - - -class Func_handler_sign -{ -protected: - int m_sign; - Func_handler_sign(int sign) :m_sign(sign) { } -}; - - -class Func_handler_add_time_datetime: - public Item_handled_func::Handler_datetime, - public Func_handler_sign -{ -public: - Func_handler_add_time_datetime(int sign) - :Func_handler_sign(sign) - { } - bool fix_length_and_dec(Item_handled_func *item) const - { - THD *thd= current_thd; - uint dec0= item->arguments()[0]->datetime_precision(thd); - uint dec1= Interval_DDhhmmssff::fsp(thd, item->arguments()[1]); - item->fix_attributes_datetime(MY_MAX(dec0, dec1)); - return false; - } - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - DBUG_ASSERT(item->is_fixed()); - Datetime::Options opt(TIME_CONV_NONE, thd); - Datetime dt(thd, item->arguments()[0], opt); - if (!dt.is_valid_datetime()) - return item->null_value= true; - Interval_DDhhmmssff it(thd, item->arguments()[1]); - if (!it.is_valid_interval_DDhhmmssff()) - return item->null_value= true; - return (item->null_value= (Sec6_add(dt.get_mysql_time(), - it.get_mysql_time(), m_sign). - to_datetime(to))); - } -}; - - -class Func_handler_add_time_time: - public Item_handled_func::Handler_time, - public Func_handler_sign -{ -public: - Func_handler_add_time_time(int sign) - :Func_handler_sign(sign) - { } - bool fix_length_and_dec(Item_handled_func *item) const - { - THD *thd= current_thd; - uint dec0= item->arguments()[0]->time_precision(thd); - uint dec1= Interval_DDhhmmssff::fsp(thd, item->arguments()[1]); - item->fix_attributes_time(MY_MAX(dec0, dec1)); - return false; - } - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - DBUG_ASSERT(item->is_fixed()); - Time t(thd, item->arguments()[0]); - if (!t.is_valid_time()) - return item->null_value= true; - Interval_DDhhmmssff i(thd, item->arguments()[1]); - if (!i.is_valid_interval_DDhhmmssff()) - return item->null_value= true; - return (item->null_value= (Sec6_add(t.get_mysql_time(), - i.get_mysql_time(), m_sign). - to_time(thd, to, item->decimals))); - } -}; - - -class Func_handler_add_time_string: - public Item_handled_func::Handler_temporal_string, - public Func_handler_sign -{ -public: - Func_handler_add_time_string(int sign) - :Func_handler_sign(sign) - { } - bool fix_length_and_dec(Item_handled_func *item) const - { - uint dec0= item->arguments()[0]->decimals; - uint dec1= Interval_DDhhmmssff::fsp(current_thd, item->arguments()[1]); - uint dec= MY_MAX(dec0, dec1); - item->Type_std_attributes::set( - Type_temporal_attributes_not_fixed_dec(MAX_DATETIME_WIDTH, dec, false), - DTCollation(item->default_charset(), - DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII)); - item->fix_char_length(item->max_length); - return false; - } - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - DBUG_ASSERT(item->is_fixed()); - // Detect a proper timestamp type based on the argument values - Temporal_hybrid l_time1(thd, item->arguments()[0], - Temporal::Options(TIME_TIME_ONLY, thd)); - if (!l_time1.is_valid_temporal()) - return (item->null_value= true); - Interval_DDhhmmssff l_time2(thd, item->arguments()[1]); - if (!l_time2.is_valid_interval_DDhhmmssff()) - return (item->null_value= true); - Sec6_add add(l_time1.get_mysql_time(), l_time2.get_mysql_time(), m_sign); - return (item->null_value= (l_time1.get_mysql_time()->time_type == - MYSQL_TIMESTAMP_TIME ? - add.to_time(thd, to, item->decimals) : - add.to_datetime(to))); - } -}; - - -class Func_handler_str_to_date_datetime_sec: - public Item_handled_func::Handler_datetime -{ -public: - bool fix_length_and_dec(Item_handled_func *item) const - { - item->fix_attributes_datetime(0); - return false; - } - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - return static_cast(item)-> - get_date_common(thd, to, fuzzy, MYSQL_TIMESTAMP_DATETIME); - } -}; - - -class Func_handler_str_to_date_datetime_usec: - public Item_handled_func::Handler_datetime -{ -public: - bool fix_length_and_dec(Item_handled_func *item) const - { - item->fix_attributes_datetime(TIME_SECOND_PART_DIGITS); - return false; - } - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - return static_cast(item)-> - get_date_common(thd, to, fuzzy, MYSQL_TIMESTAMP_DATETIME); - } -}; - - -class Func_handler_str_to_date_date: public Item_handled_func::Handler_date -{ -public: - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - return static_cast(item)-> - get_date_common(thd, to, fuzzy, MYSQL_TIMESTAMP_DATE); - } -}; - - -class Func_handler_str_to_date_time: public Item_handled_func::Handler_time -{ -public: - bool get_date(THD *thd, Item_handled_func *item, - MYSQL_TIME *to, date_mode_t fuzzy) const - { - if (static_cast(item)-> - get_date_common(thd, to, fuzzy, MYSQL_TIMESTAMP_TIME)) - return true; - if (to->day) - { - /* - Day part for time type can be nonzero value and so - we should add hours from day part to hour part to - keep valid time value. - */ - to->hour+= to->day * 24; - to->day= 0; - } - return false; - } -}; - - -class Func_handler_str_to_date_time_sec: public Func_handler_str_to_date_time -{ -public: - bool fix_length_and_dec(Item_handled_func *item) const - { - item->fix_attributes_time(0); - return false; - } -}; - - -class Func_handler_str_to_date_time_usec: public Func_handler_str_to_date_time -{ -public: - bool fix_length_and_dec(Item_handled_func *item) const - { - item->fix_attributes_time(TIME_SECOND_PART_DIGITS); - return false; - } -}; - - -#endif /* ITEM_TIMEFUNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_vers.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_vers.h deleted file mode 100644 index a42b5a0..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_vers.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef ITEM_VERS_INCLUDED -#define ITEM_VERS_INCLUDED -/* Copyright (c) 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - - -/* System Versioning items */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -class Item_func_trt_ts: public Item_datetimefunc -{ - TR_table::field_id_t trt_field; -public: - Item_func_trt_ts(THD *thd, Item* a, TR_table::field_id_t _trt_field); - const char *func_name() const - { - if (trt_field == TR_table::FLD_BEGIN_TS) - { - return "trt_begin_ts"; - } - return "trt_commit_ts"; - } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - bool fix_length_and_dec() - { fix_attributes_datetime(decimals); return FALSE; } -}; - -class Item_func_trt_id : public Item_longlong_func -{ - TR_table::field_id_t trt_field; - bool backwards; - - longlong get_by_trx_id(ulonglong trx_id); - longlong get_by_commit_ts(MYSQL_TIME &commit_ts, bool backwards); - -public: - Item_func_trt_id(THD *thd, Item* a, TR_table::field_id_t _trt_field, bool _backwards= false); - Item_func_trt_id(THD *thd, Item* a, Item* b, TR_table::field_id_t _trt_field); - - const char *func_name() const - { - switch (trt_field) - { - case TR_table::FLD_TRX_ID: - return "trt_trx_id"; - case TR_table::FLD_COMMIT_ID: - return "trt_commit_id"; - case TR_table::FLD_ISO_LEVEL: - return "trt_iso_level"; - default: - DBUG_ASSERT(0); - } - return NULL; - } - - bool fix_length_and_dec() - { - bool res= Item_int_func::fix_length_and_dec(); - max_length= 20; - return res; - } - - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_trt_trx_sees : public Item_bool_func -{ -protected: - bool accept_eq; - -public: - Item_func_trt_trx_sees(THD *thd, Item* a, Item* b); - const char *func_name() const - { - return "trt_trx_sees"; - } - longlong val_int(); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_func_trt_trx_sees_eq : - public Item_func_trt_trx_sees -{ -public: - Item_func_trt_trx_sees_eq(THD *thd, Item* a, Item* b) : - Item_func_trt_trx_sees(thd, a, b) - { - accept_eq= true; - } - const char *func_name() const - { - return "trt_trx_sees_eq"; - } -}; - -#endif /* ITEM_VERS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_windowfunc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_windowfunc.h deleted file mode 100644 index 99ef738..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_windowfunc.h +++ /dev/null @@ -1,1372 +0,0 @@ -/* - Copyright (c) 2016, 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef ITEM_WINDOWFUNC_INCLUDED -#define ITEM_WINDOWFUNC_INCLUDED - -#include "item.h" - -class Window_spec; - - -int test_if_group_changed(List &list); - - -/* A wrapper around test_if_group_changed */ -class Group_bound_tracker -{ -public: - - Group_bound_tracker(THD *thd, SQL_I_List *list) - { - for (ORDER *curr = list->first; curr; curr=curr->next) - { - Cached_item *tmp= new_Cached_item(thd, curr->item[0], TRUE); - group_fields.push_back(tmp); - } - } - - void init() - { - first_check= true; - } - - /* - Check if the current row is in a different group than the previous row - this function was called for. - XXX: Side-effect: The new row's group becomes the current row's group. - - Returns true if there is a change between the current_group and the cached - value, or if it is the first check after a call to init. - */ - bool check_if_next_group() - { - if (test_if_group_changed(group_fields) > -1 || first_check) - { - first_check= false; - return true; - } - return false; - } - - /* - Check if the current row is in a different group than the previous row - check_if_next_group was called for. - - Compares the groups without the additional side effect of updating the - current cached values. - */ - int compare_with_cache() - { - List_iterator li(group_fields); - Cached_item *ptr; - int res; - while ((ptr= li++)) - { - if ((res= ptr->cmp_read_only())) - return res; - } - return 0; - } - ~Group_bound_tracker() - { - group_fields.delete_elements(); - } - -private: - List group_fields; - /* - During the first check_if_next_group, the list of cached_items is not - initialized. The compare function will return that the items match if - the field's value is the same as the Cached_item's default value (0). - This flag makes sure that we always return true during the first check. - - XXX This is better to be implemented within test_if_group_changed, but - since it is used in other parts of the codebase, we keep it here for now. - */ - bool first_check; -}; - -/* - ROW_NUMBER() OVER (...) - - @detail - - This is a Window function (not just an aggregate) - - It can be computed by doing one pass over select output, provided - the output is sorted according to the window definition. -*/ - -class Item_sum_row_number: public Item_sum_int -{ - longlong count; - -public: - - Item_sum_row_number(THD *thd) - : Item_sum_int(thd), count(0) {} - - const Type_handler *type_handler() const { return &type_handler_slonglong; } - - void clear() - { - count= 0; - } - - bool add() - { - count++; - return false; - } - - void reset_field() { DBUG_ASSERT(0); } - void update_field() {} - - enum Sumfunctype sum_func() const - { - return ROW_NUMBER_FUNC; - } - - longlong val_int() - { - return count; - } - const char*func_name() const - { - return "row_number"; - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - RANK() OVER (...) Windowing function - - @detail - - This is a Window function (not just an aggregate) - - It can be computed by doing one pass over select output, provided - the output is sorted according to the window definition. - - The function is defined as: - - "The rank of row R is defined as 1 (one) plus the number of rows that - precede R and are not peers of R" - - "This implies that if two or more rows are not distinct with respect to - the window ordering, then there will be one or more" -*/ - -class Item_sum_rank: public Item_sum_int -{ -protected: - longlong row_number; // just ROW_NUMBER() - longlong cur_rank; // current value - - Group_bound_tracker *peer_tracker; -public: - - Item_sum_rank(THD *thd) : Item_sum_int(thd), peer_tracker(NULL) {} - - const Type_handler *type_handler() const { return &type_handler_slonglong; } - - void clear() - { - /* This is called on partition start */ - cur_rank= 1; - row_number= 0; - } - - bool add(); - - longlong val_int() - { - return cur_rank; - } - - void reset_field() { DBUG_ASSERT(0); } - void update_field() {} - - enum Sumfunctype sum_func () const - { - return RANK_FUNC; - } - - const char*func_name() const - { - return "rank"; - } - - void setup_window_func(THD *thd, Window_spec *window_spec); - - void cleanup() - { - if (peer_tracker) - { - delete peer_tracker; - peer_tracker= NULL; - } - Item_sum_int::cleanup(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -/* - DENSE_RANK() OVER (...) Windowing function - - @detail - - This is a Window function (not just an aggregate) - - It can be computed by doing one pass over select output, provided - the output is sorted according to the window definition. - - The function is defined as: - - "If DENSE_RANK is specified, then the rank of row R is defined as the - number of rows preceding and including R that are distinct with respect - to the window ordering" - - "This implies that there are no gaps in the sequential rank numbering of - rows in each window partition." -*/ - - -class Item_sum_dense_rank: public Item_sum_int -{ - longlong dense_rank; - bool first_add; - Group_bound_tracker *peer_tracker; - public: - /* - XXX(cvicentiu) This class could potentially be implemented in the rank - class, with a switch for the DENSE case. - */ - void clear() - { - dense_rank= 0; - first_add= true; - } - bool add(); - void reset_field() { DBUG_ASSERT(0); } - void update_field() {} - longlong val_int() - { - return dense_rank; - } - - Item_sum_dense_rank(THD *thd) - : Item_sum_int(thd), dense_rank(0), first_add(true), peer_tracker(NULL) {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } - enum Sumfunctype sum_func () const - { - return DENSE_RANK_FUNC; - } - - const char*func_name() const - { - return "dense_rank"; - } - - void setup_window_func(THD *thd, Window_spec *window_spec); - - void cleanup() - { - if (peer_tracker) - { - delete peer_tracker; - peer_tracker= NULL; - } - Item_sum_int::cleanup(); - } - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_sum_hybrid_simple : public Item_sum_hybrid -{ - public: - Item_sum_hybrid_simple(THD *thd, Item *arg): - Item_sum_hybrid(thd, arg), - value(NULL) - { } - - Item_sum_hybrid_simple(THD *thd, Item *arg1, Item *arg2): - Item_sum_hybrid(thd, arg1, arg2), - value(NULL) - { } - - bool add(); - bool fix_fields(THD *, Item **); - bool fix_length_and_dec(); - void setup_hybrid(THD *thd, Item *item); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - void reset_field(); - String *val_str(String *); - bool val_native(THD *thd, Native *to); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - const Type_handler *type_handler() const - { return Type_handler_hybrid_field_type::type_handler(); } - void update_field(); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void clear() - { - value->clear(); - null_value= 1; - } - - private: - Item_cache *value; -}; - -/* - This item will remember the first value added to it. It will not update - the value unless it is cleared. -*/ -class Item_sum_first_value : public Item_sum_hybrid_simple -{ - public: - Item_sum_first_value(THD* thd, Item* arg_expr) : - Item_sum_hybrid_simple(thd, arg_expr) {} - - - enum Sumfunctype sum_func () const - { - return FIRST_VALUE_FUNC; - } - - const char*func_name() const - { - return "first_value"; - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -/* - This item will remember the last value added to it. - - This item does not support removal, and can be cleared only by calling - clear(). -*/ -class Item_sum_last_value : public Item_sum_hybrid_simple -{ - public: - Item_sum_last_value(THD* thd, Item* arg_expr) : - Item_sum_hybrid_simple(thd, arg_expr) {} - - enum Sumfunctype sum_func() const - { - return LAST_VALUE_FUNC; - } - - const char*func_name() const - { - return "last_value"; - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_sum_nth_value : public Item_sum_hybrid_simple -{ - public: - Item_sum_nth_value(THD *thd, Item *arg_expr, Item* offset_expr) : - Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {} - - enum Sumfunctype sum_func() const - { - return NTH_VALUE_FUNC; - } - - const char*func_name() const - { - return "nth_value"; - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_sum_lead : public Item_sum_hybrid_simple -{ - public: - Item_sum_lead(THD *thd, Item *arg_expr, Item* offset_expr) : - Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {} - - enum Sumfunctype sum_func() const - { - return LEAD_FUNC; - } - - const char*func_name() const - { - return "lead"; - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -class Item_sum_lag : public Item_sum_hybrid_simple -{ - public: - Item_sum_lag(THD *thd, Item *arg_expr, Item* offset_expr) : - Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {} - - enum Sumfunctype sum_func() const - { - return LAG_FUNC; - } - - const char*func_name() const - { - return "lag"; - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Partition_row_count -{ -public: - Partition_row_count() :partition_row_count_(0) { } - void set_partition_row_count(ulonglong count) - { - partition_row_count_ = count; - } - double calc_val_real(bool *null_value, - ulonglong current_row_count) - { - if ((*null_value= (partition_row_count_ == 0))) - return 0; - return static_cast(current_row_count) / partition_row_count_; - } -protected: - longlong get_row_count() { return partition_row_count_; } - ulonglong partition_row_count_; -}; - - -class Current_row_count -{ -public: - Current_row_count() :current_row_count_(0) { } -protected: - ulonglong get_row_number() { return current_row_count_ ; } - ulonglong current_row_count_; -}; - - -/* - @detail - "The relative rank of a row R is defined as (RK-1)/(NR-1), where RK is - defined to be the RANK of R and NR is defined to be the number of rows in - the window partition of R." - - Computation of this function requires two passes: - - First pass to find #rows in the partition - This is held within the row_count context. - - Second pass to compute rank of current row and the value of the function -*/ -class Item_sum_percent_rank: public Item_sum_double, - public Partition_row_count -{ - public: - Item_sum_percent_rank(THD *thd) - : Item_sum_double(thd), cur_rank(1), peer_tracker(NULL) {} - - longlong val_int() - { - /* - Percent rank is a real value so calling the integer value should never - happen. It makes no sense as it gets truncated to either 0 or 1. - */ - DBUG_ASSERT(0); - return 0; - } - - double val_real() - { - /* - We can not get the real value without knowing the number of rows - in the partition. Don't divide by 0. - */ - ulonglong partition_rows = get_row_count(); - null_value= partition_rows > 0 ? false : true; - - return partition_rows > 1 ? - static_cast(cur_rank - 1) / (partition_rows - 1) : 0; - } - - enum Sumfunctype sum_func () const - { - return PERCENT_RANK_FUNC; - } - - const char*func_name() const - { - return "percent_rank"; - } - - void update_field() {} - - void clear() - { - cur_rank= 1; - row_number= 0; - } - bool add(); - const Type_handler *type_handler() const { return &type_handler_double; } - - bool fix_length_and_dec() - { - decimals = 10; // TODO-cvicentiu find out how many decimals the standard - // requires. - return FALSE; - } - - void setup_window_func(THD *thd, Window_spec *window_spec); - - void reset_field() { DBUG_ASSERT(0); } - - void set_partition_row_count(ulonglong count) - { - Partition_row_count::set_partition_row_count(count); - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - - private: - longlong cur_rank; // Current rank of the current row. - longlong row_number; // Value if this were ROW_NUMBER() function. - - Group_bound_tracker *peer_tracker; - - void cleanup() - { - if (peer_tracker) - { - delete peer_tracker; - peer_tracker= NULL; - } - Item_sum_num::cleanup(); - } -}; - - - - -/* - @detail - "The relative rank of a row R is defined as NP/NR, where - - NP is defined to be the number of rows preceding or peer with R in the - window ordering of the window partition of R - - NR is defined to be the number of rows in the window partition of R. - - Just like with Item_sum_percent_rank, computation of this function requires - two passes. -*/ - -class Item_sum_cume_dist: public Item_sum_double, - public Partition_row_count, - public Current_row_count -{ - public: - Item_sum_cume_dist(THD *thd) :Item_sum_double(thd) { } - Item_sum_cume_dist(THD *thd, Item *arg) :Item_sum_double(thd, arg) { } - - double val_real() - { - return calc_val_real(&null_value, current_row_count_); - } - - bool add() - { - current_row_count_++; - return false; - } - - enum Sumfunctype sum_func() const - { - return CUME_DIST_FUNC; - } - - void clear() - { - current_row_count_= 0; - partition_row_count_= 0; - } - - const char*func_name() const - { - return "cume_dist"; - } - - void update_field() {} - const Type_handler *type_handler() const { return &type_handler_double; } - - bool fix_length_and_dec() - { - decimals = 10; // TODO-cvicentiu find out how many decimals the standard - // requires. - return FALSE; - } - - void reset_field() { DBUG_ASSERT(0); } - - void set_partition_row_count(ulonglong count) - { - Partition_row_count::set_partition_row_count(count); - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - -}; - -class Item_sum_ntile : public Item_sum_int, - public Partition_row_count, - public Current_row_count -{ - public: - Item_sum_ntile(THD* thd, Item* num_quantiles_expr) : - Item_sum_int(thd, num_quantiles_expr), n_old_val_(0) - { } - - longlong val_int() - { - if (get_row_count() == 0) - { - null_value= true; - return 0; - } - - longlong num_quantiles= get_num_quantiles(); - - if (num_quantiles <= 0 || - (static_cast(num_quantiles) != n_old_val_ && n_old_val_ > 0)) - { - my_error(ER_INVALID_NTILE_ARGUMENT, MYF(0)); - return true; - } - n_old_val_= static_cast(num_quantiles); - null_value= false; - ulonglong quantile_size = get_row_count() / num_quantiles; - ulonglong extra_rows = get_row_count() - quantile_size * num_quantiles; - - if (current_row_count_ <= extra_rows * (quantile_size + 1)) - return (current_row_count_ - 1) / (quantile_size + 1) + 1; - - return (current_row_count_ - 1 - extra_rows) / quantile_size + 1; - } - - bool add() - { - current_row_count_++; - return false; - } - - enum Sumfunctype sum_func() const - { - return NTILE_FUNC; - } - - void clear() - { - current_row_count_= 0; - partition_row_count_= 0; - n_old_val_= 0; - } - - const char*func_name() const - { - return "ntile"; - } - - void update_field() {} - - const Type_handler *type_handler() const { return &type_handler_slonglong; } - - void reset_field() { DBUG_ASSERT(0); } - - void set_partition_row_count(ulonglong count) - { - Partition_row_count::set_partition_row_count(count); - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - - private: - longlong get_num_quantiles() { return args[0]->val_int(); } - ulonglong n_old_val_; -}; - -class Item_sum_percentile_disc : public Item_sum_num, - public Type_handler_hybrid_field_type, - public Partition_row_count, - public Current_row_count -{ -public: - Item_sum_percentile_disc(THD *thd, Item* arg) : Item_sum_num(thd, arg), - Type_handler_hybrid_field_type(&type_handler_slonglong), - value(NULL), val_calculated(FALSE), first_call(TRUE), - prev_value(0), order_item(NULL){} - - double val_real() - { - if (get_row_count() == 0 || get_arg(0)->is_null()) - { - null_value= true; - return 0; - } - null_value= false; - return value->val_real(); - } - - longlong val_int() - { - if (get_row_count() == 0 || get_arg(0)->is_null()) - { - null_value= true; - return 0; - } - null_value= false; - return value->val_int(); - } - - my_decimal* val_decimal(my_decimal* dec) - { - if (get_row_count() == 0 || get_arg(0)->is_null()) - { - null_value= true; - return 0; - } - null_value= false; - return value->val_decimal(dec); - } - - String* val_str(String *str) - { - if (get_row_count() == 0 || get_arg(0)->is_null()) - { - null_value= true; - return 0; - } - null_value= false; - return value->val_str(str); - } - - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - if (get_row_count() == 0 || get_arg(0)->is_null()) - { - null_value= true; - return true; - } - null_value= false; - return value->get_date(thd, ltime, fuzzydate); - } - - bool val_native(THD *thd, Native *to) - { - if (get_row_count() == 0 || get_arg(0)->is_null()) - { - null_value= true; - return true; - } - null_value= false; - return value->val_native(thd, to); - } - - bool add() - { - Item *arg= get_arg(0); - if (arg->is_null()) - return false; - - if (first_call) - { - prev_value= arg->val_real(); - if (prev_value > 1 || prev_value < 0) - { - my_error(ER_ARGUMENT_OUT_OF_RANGE, MYF(0), func_name()); - return true; - } - first_call= false; - } - - double arg_val= arg->val_real(); - - if (prev_value != arg_val) - { - my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0), func_name()); - return true; - } - - if (val_calculated) - return false; - - value->store(order_item); - value->cache_value(); - if (value->null_value) - return false; - - current_row_count_++; - double val= calc_val_real(&null_value, current_row_count_); - - if (val >= prev_value && !val_calculated) - val_calculated= true; - return false; - } - - enum Sumfunctype sum_func() const - { - return PERCENTILE_DISC_FUNC; - } - - void clear() - { - val_calculated= false; - first_call= true; - value->clear(); - partition_row_count_= 0; - current_row_count_= 0; - } - - const char*func_name() const - { - return "percentile_disc"; - } - - void update_field() {} - const Type_handler *type_handler() const - {return Type_handler_hybrid_field_type::type_handler();} - - bool fix_length_and_dec() - { - decimals = 10; // TODO-cvicentiu find out how many decimals the standard - // requires. - return FALSE; - } - - void reset_field() { DBUG_ASSERT(0); } - - void set_partition_row_count(ulonglong count) - { - Partition_row_count::set_partition_row_count(count); - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - void setup_window_func(THD *thd, Window_spec *window_spec); - void setup_hybrid(THD *thd, Item *item); - bool fix_fields(THD *thd, Item **ref); - -private: - Item_cache *value; - bool val_calculated; - bool first_call; - double prev_value; - Item *order_item; -}; - -class Item_sum_percentile_cont : public Item_sum_double, - public Partition_row_count, - public Current_row_count -{ -public: - Item_sum_percentile_cont(THD *thd, Item* arg) : Item_sum_double(thd, arg), - floor_value(NULL), ceil_value(NULL), first_call(TRUE),prev_value(0), - ceil_val_calculated(FALSE), floor_val_calculated(FALSE), order_item(NULL){} - - double val_real() - { - if (get_row_count() == 0 || get_arg(0)->is_null()) - { - null_value= true; - return 0; - } - null_value= false; - double val= 1 + prev_value * (get_row_count()-1); - - /* - Applying the formula to get the value - If (CRN = FRN = RN) then the result is (value of expression from row at RN) - Otherwise the result is - (CRN - RN) * (value of expression for row at FRN) + - (RN - FRN) * (value of expression for row at CRN) - */ - - if(ceil(val) == floor(val)) - return floor_value->val_real(); - - double ret_val= ((val - floor(val)) * ceil_value->val_real()) + - ((ceil(val) - val) * floor_value->val_real()); - - return ret_val; - } - - bool add() - { - Item *arg= get_arg(0); - if (arg->is_null()) - return false; - - if (first_call) - { - first_call= false; - prev_value= arg->val_real(); - if (prev_value > 1 || prev_value < 0) - { - my_error(ER_ARGUMENT_OUT_OF_RANGE, MYF(0), func_name()); - return true; - } - } - - double arg_val= arg->val_real(); - if (prev_value != arg_val) - { - my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0), func_name()); - return true; - } - - if (!floor_val_calculated) - { - floor_value->store(order_item); - floor_value->cache_value(); - if (floor_value->null_value) - return false; - } - if (floor_val_calculated && !ceil_val_calculated) - { - ceil_value->store(order_item); - ceil_value->cache_value(); - if (ceil_value->null_value) - return false; - } - - current_row_count_++; - double val= 1 + prev_value * (get_row_count()-1); - - if (!floor_val_calculated && get_row_number() == floor(val)) - floor_val_calculated= true; - - if (!ceil_val_calculated && get_row_number() == ceil(val)) - ceil_val_calculated= true; - return false; - } - - enum Sumfunctype sum_func() const - { - return PERCENTILE_CONT_FUNC; - } - - void clear() - { - first_call= true; - floor_value->clear(); - ceil_value->clear(); - floor_val_calculated= false; - ceil_val_calculated= false; - partition_row_count_= 0; - current_row_count_= 0; - } - - const char*func_name() const - { - return "percentile_cont"; - } - void update_field() {} - - bool fix_length_and_dec() - { - decimals = 10; // TODO-cvicentiu find out how many decimals the standard - // requires. - return FALSE; - } - - void reset_field() { DBUG_ASSERT(0); } - - void set_partition_row_count(ulonglong count) - { - Partition_row_count::set_partition_row_count(count); - } - - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } - void setup_window_func(THD *thd, Window_spec *window_spec); - void setup_hybrid(THD *thd, Item *item); - bool fix_fields(THD *thd, Item **ref); - -private: - Item_cache *floor_value; - Item_cache *ceil_value; - bool first_call; - double prev_value; - bool ceil_val_calculated; - bool floor_val_calculated; - Item *order_item; -}; - - - - -class Item_window_func : public Item_func_or_sum -{ - /* Window function parameters as we've got them from the parser */ -public: - LEX_CSTRING *window_name; -public: - Window_spec *window_spec; - -public: - Item_window_func(THD *thd, Item_sum *win_func, LEX_CSTRING *win_name) - : Item_func_or_sum(thd, (Item *) win_func), - window_name(win_name), window_spec(NULL), - force_return_blank(true), - read_value_from_result_field(false) {} - - Item_window_func(THD *thd, Item_sum *win_func, Window_spec *win_spec) - : Item_func_or_sum(thd, (Item *) win_func), - window_name(NULL), window_spec(win_spec), - force_return_blank(true), - read_value_from_result_field(false) {} - - Item_sum *window_func() const { return (Item_sum *) args[0]; } - - void update_used_tables(); - - /* - This is used by filesort to mark the columns it needs to read (because they - participate in the sort criteria and/or row retrieval. Window functions can - only be used in sort criteria). - - Sorting by window function value is only done after the window functions - have been computed. In that case, window function will need to read its - temp.table field. In order to allow that, mark that field in the read_set. - */ - bool register_field_in_read_map(void *arg) - { - TABLE *table= (TABLE*) arg; - if (result_field && (result_field->table == table || !table)) - { - bitmap_set_bit(result_field->table->read_set, result_field->field_index); - } - return 0; - } - - bool is_frame_prohibited() const - { - switch (window_func()->sum_func()) { - case Item_sum::ROW_NUMBER_FUNC: - case Item_sum::RANK_FUNC: - case Item_sum::DENSE_RANK_FUNC: - case Item_sum::PERCENT_RANK_FUNC: - case Item_sum::CUME_DIST_FUNC: - case Item_sum::NTILE_FUNC: - case Item_sum::PERCENTILE_CONT_FUNC: - case Item_sum::PERCENTILE_DISC_FUNC: - return true; - default: - return false; - } - } - - bool requires_special_cursors() const - { - switch (window_func()->sum_func()) { - case Item_sum::FIRST_VALUE_FUNC: - case Item_sum::LAST_VALUE_FUNC: - case Item_sum::NTH_VALUE_FUNC: - case Item_sum::LAG_FUNC: - case Item_sum::LEAD_FUNC: - return true; - default: - return false; - } - } - - bool requires_partition_size() const - { - switch (window_func()->sum_func()) { - case Item_sum::PERCENT_RANK_FUNC: - case Item_sum::CUME_DIST_FUNC: - case Item_sum::NTILE_FUNC: - case Item_sum::PERCENTILE_CONT_FUNC: - case Item_sum::PERCENTILE_DISC_FUNC: - return true; - default: - return false; - } - } - - bool requires_peer_size() const - { - switch (window_func()->sum_func()) { - case Item_sum::CUME_DIST_FUNC: - return true; - default: - return false; - } - } - - bool is_order_list_mandatory() const - { - switch (window_func()->sum_func()) { - case Item_sum::RANK_FUNC: - case Item_sum::DENSE_RANK_FUNC: - case Item_sum::PERCENT_RANK_FUNC: - case Item_sum::CUME_DIST_FUNC: - case Item_sum::LAG_FUNC: - case Item_sum::LEAD_FUNC: - case Item_sum::PERCENTILE_CONT_FUNC: - case Item_sum::PERCENTILE_DISC_FUNC: - return true; - default: - return false; - } - } - - bool only_single_element_order_list() const - { - switch (window_func()->sum_func()){ - case Item_sum::PERCENTILE_CONT_FUNC: - case Item_sum::PERCENTILE_DISC_FUNC: - return true; - default: - return false; - } - } - - bool check_result_type_of_order_item(); - - - - /* - Computation functions. - TODO: consoder merging these with class Group_bound_tracker. - */ - void setup_partition_border_check(THD *thd); - - const Type_handler *type_handler() const - { - return ((Item_sum *) args[0])->type_handler(); - } - enum Item::Type type() const { return Item::WINDOW_FUNC_ITEM; } - -private: - /* - Window functions are very special functions, so val_() methods have - special meaning for them: - - - Phase#1, "Initial" we run the join and put its result into temporary - table. For window functions, we write the default value (NULL?) as - a placeholder. - - - Phase#2: "Computation": executor does the scan in {PARTITION, ORDER BY} - order of this window function. It calls appropriate methods to inform - the window function about rows entering/leaving the window. - It calls window_func()->val_int() so that current window function value - can be saved and stored in the temp.table. - - - Phase#3: "Retrieval" the temporary table is read and passed to query - output. However, Item_window_func still remains in the select list, - so item_windowfunc->val_int() will be called. - During Phase#3, read_value_from_result_field= true. - */ - bool force_return_blank; - bool read_value_from_result_field; - void print_for_percentile_functions(String *str, enum_query_type query_type); - -public: - void set_phase_to_initial() - { - force_return_blank= true; - read_value_from_result_field= false; - } - void set_phase_to_computation() - { - force_return_blank= false; - read_value_from_result_field= false; - } - void set_phase_to_retrieval() - { - force_return_blank= false; - read_value_from_result_field= true; - } - - bool is_null() - { - if (force_return_blank) - return true; - - if (read_value_from_result_field) - return result_field->is_null(); - - return window_func()->is_null(); - } - - double val_real() - { - double res; - if (force_return_blank) - { - res= 0.0; - null_value= true; - } - else if (read_value_from_result_field) - { - res= result_field->val_real(); - null_value= result_field->is_null(); - } - else - { - res= window_func()->val_real(); - null_value= window_func()->null_value; - } - return res; - } - - longlong val_int() - { - longlong res; - if (force_return_blank) - { - res= 0; - null_value= true; - } - else if (read_value_from_result_field) - { - res= result_field->val_int(); - null_value= result_field->is_null(); - } - else - { - res= window_func()->val_int(); - null_value= window_func()->null_value; - } - return res; - } - - String* val_str(String* str) - { - String *res; - if (force_return_blank) - { - null_value= true; - res= NULL; - } - else if (read_value_from_result_field) - { - if ((null_value= result_field->is_null())) - res= NULL; - else - res= result_field->val_str(str); - } - else - { - res= window_func()->val_str(str); - null_value= window_func()->null_value; - } - return res; - } - - bool val_native(THD *thd, Native *to) - { - if (force_return_blank) - return null_value= true; - if (read_value_from_result_field) - return val_native_from_field(result_field, to); - return val_native_from_item(thd, window_func(), to); - } - - my_decimal* val_decimal(my_decimal* dec) - { - my_decimal *res; - if (force_return_blank) - { - null_value= true; - res= NULL; - } - else if (read_value_from_result_field) - { - if ((null_value= result_field->is_null())) - res= NULL; - else - res= result_field->val_decimal(dec); - } - else - { - res= window_func()->val_decimal(dec); - null_value= window_func()->null_value; - } - return res; - } - - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - bool res; - if (force_return_blank) - { - null_value= true; - res= true; - } - else if (read_value_from_result_field) - { - if ((null_value= result_field->is_null())) - res= true; - else - res= result_field->get_date(ltime, fuzzydate); - } - else - { - res= window_func()->get_date(thd, ltime, fuzzydate); - null_value= window_func()->null_value; - } - return res; - } - - void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - - bool fix_length_and_dec() - { - Type_std_attributes::set(window_func()); - return FALSE; - } - - const char* func_name() const { return "WF"; } - - bool fix_fields(THD *thd, Item **ref); - - bool resolve_window_name(THD *thd); - - void print(String *str, enum_query_type query_type); - - Item *get_copy(THD *thd) { return 0; } - -}; - -#endif /* ITEM_WINDOWFUNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_xmlfunc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_xmlfunc.h deleted file mode 100644 index 806739d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/item_xmlfunc.h +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef ITEM_XMLFUNC_INCLUDED -#define ITEM_XMLFUNC_INCLUDED - -/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2009, 2019, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* This file defines all XML functions */ - - -typedef struct my_xml_node_st MY_XML_NODE; - - -/* Structure to store nodeset elements */ -class MY_XPATH_FLT -{ -public: - uint num; // Absolute position in MY_XML_NODE array - uint pos; // Relative position in context - uint size; // Context size -public: - MY_XPATH_FLT(uint32 num_arg, uint32 pos_arg) - :num(num_arg), pos(pos_arg), size(0) - { } - MY_XPATH_FLT(uint32 num_arg, uint32 pos_arg, uint32 size_arg) - :num(num_arg), pos(pos_arg), size(size_arg) - { } - bool append_to(Native *to) const - { - return to->append((const char*) this, (uint32) sizeof(*this)); - } -}; - - -class NativeNodesetBuffer: public NativeBuffer<16*sizeof(MY_XPATH_FLT)> -{ -public: - const MY_XPATH_FLT &element(uint i) const - { - const MY_XPATH_FLT *p= (MY_XPATH_FLT*) (ptr() + i * sizeof(MY_XPATH_FLT)); - return *p; - } - uint32 elements() const - { - return length() / sizeof(MY_XPATH_FLT); - } -}; - - -class Item_xml_str_func: public Item_str_func -{ -protected: - /* - A helper class to store raw and parsed XML. - */ - class XML - { - bool m_cached; - String *m_raw_ptr; // Pointer to text representation - String m_raw_buf; // Cached text representation - String m_parsed_buf; // Array of MY_XML_NODEs, pointing to raw_buffer - bool parse(); - void reset() - { - m_cached= false; - m_raw_ptr= (String *) 0; - } - public: - XML() { reset(); } - void set_charset(CHARSET_INFO *cs) { m_parsed_buf.set_charset(cs); } - String *raw() { return m_raw_ptr; } - String *parsed() { return &m_parsed_buf; } - const MY_XML_NODE *node(uint idx); - bool cached() { return m_cached; } - bool parse(String *raw, bool cache); - bool parse(Item *item, bool cache) - { - String *res; - if (!(res= item->val_str(&m_raw_buf))) - { - m_raw_ptr= (String *) 0; - m_cached= cache; - return true; - } - return parse(res, cache); - } - }; - String m_xpath_query; // XPath query text - Item *nodeset_func; - XML xml; - bool get_xml(XML *xml_arg, bool cache= false) - { - if (!cache && xml_arg->cached()) - return xml_arg->raw() == 0; - return xml_arg->parse(args[0], cache); - } -public: - Item_xml_str_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) - { - maybe_null= TRUE; - } - Item_xml_str_func(THD *thd, Item *a, Item *b, Item *c): - Item_str_func(thd, a, b, c) - { - maybe_null= TRUE; - } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - bool const_item() const - { - return const_item_cache && (!nodeset_func || nodeset_func->const_item()); - } -}; - - -class Item_func_xml_extractvalue: public Item_xml_str_func -{ -public: - Item_func_xml_extractvalue(THD *thd, Item *a, Item *b): - Item_xml_str_func(thd, a, b) {} - const char *func_name() const { return "extractvalue"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - - -class Item_func_xml_update: public Item_xml_str_func -{ - NativeNodesetBuffer tmp_native_value2; - String tmp_value3; - bool collect_result(String *str, - const MY_XML_NODE *cut, - const String *replace); -public: - Item_func_xml_update(THD *thd, Item *a, Item *b, Item *c): - Item_xml_str_func(thd, a, b, c) {} - const char *func_name() const { return "updatexml"; } - String *val_str(String *); - Item *get_copy(THD *thd) - { return get_item_copy(thd, this); } -}; - -#endif /* ITEM_XMLFUNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/key.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/key.h deleted file mode 100644 index 871373b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/key.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef KEY_INCLUDED -#define KEY_INCLUDED - -class Field; -class String; -struct TABLE; -typedef struct st_bitmap MY_BITMAP; -typedef struct st_key KEY; -typedef struct st_key_part_info KEY_PART_INFO; - -int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field, - uint *key_length, uint *keypart); -void key_copy(uchar *to_key, const uchar *from_record, const KEY *key_info, - uint key_length, bool with_zerofill= FALSE); -void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info, - uint key_length); -bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length); -void key_unpack(String *to, TABLE *table, KEY *key); -void field_unpack(String *to, Field *field, const uchar *rec, uint max_length, - bool prefix_key); -bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields); -int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length); -ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key); -bool key_buf_cmp(KEY *key_info, uint used_key_parts, - const uchar *key1, const uchar *key2); -extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b); -int key_tuple_cmp(KEY_PART_INFO *part, uchar *key1, uchar *key2, uint tuple_length); - -#endif /* KEY_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/keycaches.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/keycaches.h deleted file mode 100644 index 68c3dd3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/keycaches.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef KEYCACHES_INCLUDED -#define KEYCACHES_INCLUDED - -/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "sql_list.h" -#include -#include - -extern "C" -{ - typedef int (*process_key_cache_t) (const char *, KEY_CACHE *, void *); -} - -class NAMED_ILINK; - -class NAMED_ILIST: public I_List -{ - public: - void delete_elements(void (*free_element)(const char*, void*)); - bool delete_element(const char *name, size_t length, void (*free_element)(const char*, void*)); -}; - -/* For key cache */ -extern LEX_CSTRING default_key_cache_base; -extern KEY_CACHE zero_key_cache; -extern NAMED_ILIST key_caches; - -KEY_CACHE *create_key_cache(const char *name, size_t length); -KEY_CACHE *get_key_cache(const LEX_CSTRING *cache_name); -KEY_CACHE *get_or_create_key_cache(const char *name, size_t length); -void free_key_cache(const char *name, void *key_cache); -bool process_key_caches(process_key_cache_t func, void *param); - -/* For Rpl_filter */ -extern LEX_CSTRING default_rpl_filter_base; -extern NAMED_ILIST rpl_filters; - -Rpl_filter *create_rpl_filter(const char *name, size_t length); -Rpl_filter *get_rpl_filter(LEX_CSTRING *filter_name); -Rpl_filter *get_or_create_rpl_filter(const char *name, size_t length); -void free_all_rpl_filters(void); - -#endif /* KEYCACHES_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lex.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/lex.h deleted file mode 100644 index 542356c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lex.h +++ /dev/null @@ -1,791 +0,0 @@ -#ifndef LEX_INCLUDED -#define LEX_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. - Copyright (c) 2009, 2015, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* This file includes all reserved words and functions */ - -#include "lex_symbol.h" - -SYM_GROUP sym_group_common= {"", ""}; -SYM_GROUP sym_group_geom= {"Spatial extensions", "HAVE_SPATIAL"}; -SYM_GROUP sym_group_rtree= {"RTree keys", "HAVE_RTREE_KEYS"}; - -/* We don't want to include sql_yacc.h into gen_lex_hash */ -#ifdef NO_YACC_SYMBOLS -#define SYM_OR_NULL(A) 0 -#else -#define SYM_OR_NULL(A) A -#endif - -#define SYM(A) SYM_OR_NULL(A),0,&sym_group_common - -/* - Symbols are broken into separated arrays to allow field names with - same name as functions. - These are kept sorted for human lookup (the symbols are hashed). - - NOTE! The symbol tables should be the same regardless of what features - are compiled into the server. Don't add ifdef'ed symbols to the - lists - NOTE!! - If you add or delete symbols from this file, you must also update results for - the perfschema.start_server_low_digest_sql_length test! -*/ - -static SYMBOL symbols[] = { - { "&&", SYM(AND_AND_SYM)}, - { "<=", SYM(LE)}, - { "<>", SYM(NE)}, - { "!=", SYM(NE)}, - { ">=", SYM(GE)}, - { "<<", SYM(SHIFT_LEFT)}, - { ">>", SYM(SHIFT_RIGHT)}, - { "<=>", SYM(EQUAL_SYM)}, - { "ACCESSIBLE", SYM(ACCESSIBLE_SYM)}, - { "ACCOUNT", SYM(ACCOUNT_SYM)}, - { "ACTION", SYM(ACTION)}, - { "ADD", SYM(ADD)}, - { "ADMIN", SYM(ADMIN_SYM)}, - { "AFTER", SYM(AFTER_SYM)}, - { "AGAINST", SYM(AGAINST)}, - { "AGGREGATE", SYM(AGGREGATE_SYM)}, - { "ALL", SYM(ALL)}, - { "ALGORITHM", SYM(ALGORITHM_SYM)}, - { "ALTER", SYM(ALTER)}, - { "ALWAYS", SYM(ALWAYS_SYM)}, - { "ANALYZE", SYM(ANALYZE_SYM)}, - { "AND", SYM(AND_SYM)}, - { "ANY", SYM(ANY_SYM)}, - { "AS", SYM(AS)}, - { "ASC", SYM(ASC)}, - { "ASCII", SYM(ASCII_SYM)}, - { "ASENSITIVE", SYM(ASENSITIVE_SYM)}, - { "AT", SYM(AT_SYM)}, - { "ATOMIC", SYM(ATOMIC_SYM)}, - { "AUTHORS", SYM(AUTHORS_SYM)}, - { "AUTO_INCREMENT", SYM(AUTO_INC)}, - { "AUTOEXTEND_SIZE", SYM(AUTOEXTEND_SIZE_SYM)}, - { "AUTO", SYM(AUTO_SYM)}, - { "AVG", SYM(AVG_SYM)}, - { "AVG_ROW_LENGTH", SYM(AVG_ROW_LENGTH)}, - { "BACKUP", SYM(BACKUP_SYM)}, - { "BEFORE", SYM(BEFORE_SYM)}, - { "BEGIN", SYM(BEGIN_MARIADB_SYM)}, - { "BETWEEN", SYM(BETWEEN_SYM)}, - { "BIGINT", SYM(BIGINT)}, - { "BINARY", SYM(BINARY)}, - { "BINLOG", SYM(BINLOG_SYM)}, - { "BIT", SYM(BIT_SYM)}, - { "BLOB", SYM(BLOB_MARIADB_SYM)}, - { "BLOCK", SYM(BLOCK_SYM)}, - { "BODY", SYM(BODY_MARIADB_SYM)}, - { "BOOL", SYM(BOOL_SYM)}, - { "BOOLEAN", SYM(BOOLEAN_SYM)}, - { "BOTH", SYM(BOTH)}, - { "BTREE", SYM(BTREE_SYM)}, - { "BY", SYM(BY)}, - { "BYTE", SYM(BYTE_SYM)}, - { "CACHE", SYM(CACHE_SYM)}, - { "CALL", SYM(CALL_SYM)}, - { "CASCADE", SYM(CASCADE)}, - { "CASCADED", SYM(CASCADED)}, - { "CASE", SYM(CASE_SYM)}, - { "CATALOG_NAME", SYM(CATALOG_NAME_SYM)}, - { "CHAIN", SYM(CHAIN_SYM)}, - { "CHANGE", SYM(CHANGE)}, - { "CHANGED", SYM(CHANGED)}, - { "CHAR", SYM(CHAR_SYM)}, - { "CHARACTER", SYM(CHAR_SYM)}, - { "CHARSET", SYM(CHARSET)}, - { "CHECK", SYM(CHECK_SYM)}, - { "CHECKPOINT", SYM(CHECKPOINT_SYM)}, - { "CHECKSUM", SYM(CHECKSUM_SYM)}, - { "CIPHER", SYM(CIPHER_SYM)}, - { "CLASS_ORIGIN", SYM(CLASS_ORIGIN_SYM)}, - { "CLIENT", SYM(CLIENT_SYM)}, - { "CLOB", SYM(CLOB_MARIADB_SYM)}, - { "CLOSE", SYM(CLOSE_SYM)}, - { "COALESCE", SYM(COALESCE)}, - { "CODE", SYM(CODE_SYM)}, - { "COLLATE", SYM(COLLATE_SYM)}, - { "COLLATION", SYM(COLLATION_SYM)}, - { "COLUMN", SYM(COLUMN_SYM)}, - { "COLUMN_NAME", SYM(COLUMN_NAME_SYM)}, - { "COLUMNS", SYM(COLUMNS)}, - { "COLUMN_ADD", SYM(COLUMN_ADD_SYM)}, - { "COLUMN_CHECK", SYM(COLUMN_CHECK_SYM)}, - { "COLUMN_CREATE", SYM(COLUMN_CREATE_SYM)}, - { "COLUMN_DELETE", SYM(COLUMN_DELETE_SYM)}, - { "COLUMN_GET", SYM(COLUMN_GET_SYM)}, - { "COMMENT", SYM(COMMENT_SYM)}, - { "COMMIT", SYM(COMMIT_SYM)}, - { "COMMITTED", SYM(COMMITTED_SYM)}, - { "COMPACT", SYM(COMPACT_SYM)}, - { "COMPLETION", SYM(COMPLETION_SYM)}, - { "COMPRESSED", SYM(COMPRESSED_SYM)}, - { "CONCURRENT", SYM(CONCURRENT)}, - { "CONDITION", SYM(CONDITION_SYM)}, - { "CONNECTION", SYM(CONNECTION_SYM)}, - { "CONSISTENT", SYM(CONSISTENT_SYM)}, - { "CONSTRAINT", SYM(CONSTRAINT)}, - { "CONSTRAINT_CATALOG", SYM(CONSTRAINT_CATALOG_SYM)}, - { "CONSTRAINT_NAME", SYM(CONSTRAINT_NAME_SYM)}, - { "CONSTRAINT_SCHEMA", SYM(CONSTRAINT_SCHEMA_SYM)}, - { "CONTAINS", SYM(CONTAINS_SYM)}, - { "CONTEXT", SYM(CONTEXT_SYM)}, - { "CONTINUE", SYM(CONTINUE_MARIADB_SYM)}, - { "CONTRIBUTORS", SYM(CONTRIBUTORS_SYM)}, - { "CONVERT", SYM(CONVERT_SYM)}, - { "CPU", SYM(CPU_SYM)}, - { "CREATE", SYM(CREATE)}, - { "CROSS", SYM(CROSS)}, - { "CUBE", SYM(CUBE_SYM)}, - { "CURRENT", SYM(CURRENT_SYM)}, - { "CURRENT_DATE", SYM(CURDATE)}, - { "CURRENT_POS", SYM(CURRENT_POS_SYM)}, - { "CURRENT_ROLE", SYM(CURRENT_ROLE)}, - { "CURRENT_TIME", SYM(CURTIME)}, - { "CURRENT_TIMESTAMP", SYM(NOW_SYM)}, - { "CURRENT_USER", SYM(CURRENT_USER)}, - { "CURSOR", SYM(CURSOR_SYM)}, - { "CURSOR_NAME", SYM(CURSOR_NAME_SYM)}, - { "CYCLE", SYM(CYCLE_SYM)}, - { "DATA", SYM(DATA_SYM)}, - { "DATABASE", SYM(DATABASE)}, - { "DATABASES", SYM(DATABASES)}, - { "DATAFILE", SYM(DATAFILE_SYM)}, - { "DATE", SYM(DATE_SYM)}, - { "DATETIME", SYM(DATETIME)}, - { "DAY", SYM(DAY_SYM)}, - { "DAY_HOUR", SYM(DAY_HOUR_SYM)}, - { "DAY_MICROSECOND", SYM(DAY_MICROSECOND_SYM)}, - { "DAY_MINUTE", SYM(DAY_MINUTE_SYM)}, - { "DAY_SECOND", SYM(DAY_SECOND_SYM)}, - { "DEALLOCATE", SYM(DEALLOCATE_SYM)}, - { "DEC", SYM(DECIMAL_SYM)}, - { "DECIMAL", SYM(DECIMAL_SYM)}, - { "DECLARE", SYM(DECLARE_MARIADB_SYM)}, - { "DEFAULT", SYM(DEFAULT)}, - { "DEFINER", SYM(DEFINER_SYM)}, - { "DELAYED", SYM(DELAYED_SYM)}, - { "DELAY_KEY_WRITE", SYM(DELAY_KEY_WRITE_SYM)}, - { "DELETE", SYM(DELETE_SYM)}, - { "DELETE_DOMAIN_ID", SYM(DELETE_DOMAIN_ID_SYM)}, - { "DESC", SYM(DESC)}, - { "DESCRIBE", SYM(DESCRIBE)}, - { "DES_KEY_FILE", SYM(DES_KEY_FILE)}, - { "DETERMINISTIC", SYM(DETERMINISTIC_SYM)}, - { "DIAGNOSTICS", SYM(DIAGNOSTICS_SYM)}, - { "DIRECTORY", SYM(DIRECTORY_SYM)}, - { "DISABLE", SYM(DISABLE_SYM)}, - { "DISCARD", SYM(DISCARD)}, - { "DISK", SYM(DISK_SYM)}, - { "DISTINCT", SYM(DISTINCT)}, - { "DISTINCTROW", SYM(DISTINCT)}, /* Access likes this */ - { "DIV", SYM(DIV_SYM)}, - { "DO", SYM(DO_SYM)}, - { "DOUBLE", SYM(DOUBLE_SYM)}, - { "DO_DOMAIN_IDS", SYM(DO_DOMAIN_IDS_SYM)}, - { "DROP", SYM(DROP)}, - { "DUAL", SYM(DUAL_SYM)}, - { "DUMPFILE", SYM(DUMPFILE)}, - { "DUPLICATE", SYM(DUPLICATE_SYM)}, - { "DYNAMIC", SYM(DYNAMIC_SYM)}, - { "EACH", SYM(EACH_SYM)}, - { "ELSE", SYM(ELSE)}, - { "ELSEIF", SYM(ELSEIF_MARIADB_SYM)}, - { "ELSIF", SYM(ELSIF_MARIADB_SYM)}, - { "ENABLE", SYM(ENABLE_SYM)}, - { "ENCLOSED", SYM(ENCLOSED)}, - { "END", SYM(END)}, - { "ENDS", SYM(ENDS_SYM)}, - { "ENGINE", SYM(ENGINE_SYM)}, - { "ENGINES", SYM(ENGINES_SYM)}, - { "ENUM", SYM(ENUM)}, - { "ERROR", SYM(ERROR_SYM)}, - { "ERRORS", SYM(ERRORS)}, - { "ESCAPE", SYM(ESCAPE_SYM)}, - { "ESCAPED", SYM(ESCAPED)}, - { "EVENT", SYM(EVENT_SYM)}, - { "EVENTS", SYM(EVENTS_SYM)}, - { "EVERY", SYM(EVERY_SYM)}, - { "EXAMINED", SYM(EXAMINED_SYM)}, - { "EXCEPT", SYM(EXCEPT_SYM)}, - { "EXCHANGE", SYM(EXCHANGE_SYM)}, - { "EXCLUDE", SYM(EXCLUDE_SYM)}, - { "EXECUTE", SYM(EXECUTE_SYM)}, - { "EXCEPTION", SYM(EXCEPTION_MARIADB_SYM)}, - { "EXISTS", SYM(EXISTS)}, - { "EXIT", SYM(EXIT_MARIADB_SYM)}, - { "EXPANSION", SYM(EXPANSION_SYM)}, - { "EXPIRE", SYM(EXPIRE_SYM)}, - { "EXPORT", SYM(EXPORT_SYM)}, - { "EXPLAIN", SYM(DESCRIBE)}, - { "EXTENDED", SYM(EXTENDED_SYM)}, - { "EXTENT_SIZE", SYM(EXTENT_SIZE_SYM)}, - { "FALSE", SYM(FALSE_SYM)}, - { "FAST", SYM(FAST_SYM)}, - { "FAULTS", SYM(FAULTS_SYM)}, - { "FEDERATED", SYM(FEDERATED_SYM)}, - { "FETCH", SYM(FETCH_SYM)}, - { "FIELDS", SYM(COLUMNS)}, - { "FILE", SYM(FILE_SYM)}, - { "FIRST", SYM(FIRST_SYM)}, - { "FIXED", SYM(FIXED_SYM)}, - { "FLOAT", SYM(FLOAT_SYM)}, - { "FLOAT4", SYM(FLOAT_SYM)}, - { "FLOAT8", SYM(DOUBLE_SYM)}, - { "FLUSH", SYM(FLUSH_SYM)}, - { "FOLLOWING", SYM(FOLLOWING_SYM)}, - { "FOLLOWS", SYM(FOLLOWS_SYM)}, - { "FOR", SYM(FOR_SYM)}, - { "FORCE", SYM(FORCE_SYM)}, - { "FOREIGN", SYM(FOREIGN)}, - { "FORMAT", SYM(FORMAT_SYM)}, - { "FOUND", SYM(FOUND_SYM)}, - { "FROM", SYM(FROM)}, - { "FULL", SYM(FULL)}, - { "FULLTEXT", SYM(FULLTEXT_SYM)}, - { "FUNCTION", SYM(FUNCTION_SYM)}, - { "GENERAL", SYM(GENERAL)}, - { "GENERATED", SYM(GENERATED_SYM)}, - { "GET_FORMAT", SYM(GET_FORMAT)}, - { "GET", SYM(GET_SYM)}, - { "GLOBAL", SYM(GLOBAL_SYM)}, - { "GOTO", SYM(GOTO_MARIADB_SYM)}, - { "GRANT", SYM(GRANT)}, - { "GRANTS", SYM(GRANTS)}, - { "GROUP", SYM(GROUP_SYM)}, - { "HANDLER", SYM(HANDLER_SYM)}, - { "HARD", SYM(HARD_SYM)}, - { "HASH", SYM(HASH_SYM)}, - { "HAVING", SYM(HAVING)}, - { "HELP", SYM(HELP_SYM)}, - { "HIGH_PRIORITY", SYM(HIGH_PRIORITY)}, - { "HISTORY", SYM(HISTORY_SYM)}, - { "HOST", SYM(HOST_SYM)}, - { "HOSTS", SYM(HOSTS_SYM)}, - { "HOUR", SYM(HOUR_SYM)}, - { "HOUR_MICROSECOND", SYM(HOUR_MICROSECOND_SYM)}, - { "HOUR_MINUTE", SYM(HOUR_MINUTE_SYM)}, - { "HOUR_SECOND", SYM(HOUR_SECOND_SYM)}, - { "ID", SYM(ID_SYM)}, - { "IDENTIFIED", SYM(IDENTIFIED_SYM)}, - { "IF", SYM(IF_SYM)}, - { "IGNORE", SYM(IGNORE_SYM)}, - { "IGNORE_DOMAIN_IDS", SYM(IGNORE_DOMAIN_IDS_SYM)}, - { "IGNORE_SERVER_IDS", SYM(IGNORE_SERVER_IDS_SYM)}, - { "IMMEDIATE", SYM(IMMEDIATE_SYM)}, - { "IMPORT", SYM(IMPORT)}, - { "INTERSECT", SYM(INTERSECT_SYM)}, - { "IN", SYM(IN_SYM)}, - { "INCREMENT", SYM(INCREMENT_SYM)}, - { "INDEX", SYM(INDEX_SYM)}, - { "INDEXES", SYM(INDEXES)}, - { "INFILE", SYM(INFILE)}, - { "INITIAL_SIZE", SYM(INITIAL_SIZE_SYM)}, - { "INNER", SYM(INNER_SYM)}, - { "INOUT", SYM(INOUT_SYM)}, - { "INSENSITIVE", SYM(INSENSITIVE_SYM)}, - { "INSERT", SYM(INSERT)}, - { "INSERT_METHOD", SYM(INSERT_METHOD)}, - { "INSTALL", SYM(INSTALL_SYM)}, - { "INT", SYM(INT_SYM)}, - { "INT1", SYM(TINYINT)}, - { "INT2", SYM(SMALLINT)}, - { "INT3", SYM(MEDIUMINT)}, - { "INT4", SYM(INT_SYM)}, - { "INT8", SYM(BIGINT)}, - { "INTEGER", SYM(INT_SYM)}, - { "INTERVAL", SYM(INTERVAL_SYM)}, - { "INVISIBLE", SYM(INVISIBLE_SYM)}, - { "INTO", SYM(INTO)}, - { "IO", SYM(IO_SYM)}, - { "IO_THREAD", SYM(RELAY_THREAD)}, - { "IPC", SYM(IPC_SYM)}, - { "IS", SYM(IS)}, - { "ISOLATION", SYM(ISOLATION)}, - { "ISOPEN", SYM(ISOPEN_SYM)}, - { "ISSUER", SYM(ISSUER_SYM)}, - { "ITERATE", SYM(ITERATE_SYM)}, - { "INVOKER", SYM(INVOKER_SYM)}, - { "JOIN", SYM(JOIN_SYM)}, - { "JSON", SYM(JSON_SYM)}, - { "KEY", SYM(KEY_SYM)}, - { "KEYS", SYM(KEYS)}, - { "KEY_BLOCK_SIZE", SYM(KEY_BLOCK_SIZE)}, - { "KILL", SYM(KILL_SYM)}, - { "LANGUAGE", SYM(LANGUAGE_SYM)}, - { "LAST", SYM(LAST_SYM)}, - { "LAST_VALUE", SYM(LAST_VALUE)}, - { "LASTVAL", SYM(LASTVAL_SYM)}, - { "LEADING", SYM(LEADING)}, - { "LEAVE", SYM(LEAVE_SYM)}, - { "LEAVES", SYM(LEAVES)}, - { "LEFT", SYM(LEFT)}, - { "LESS", SYM(LESS_SYM)}, - { "LEVEL", SYM(LEVEL_SYM)}, - { "LIKE", SYM(LIKE)}, - { "LIMIT", SYM(LIMIT)}, - { "LINEAR", SYM(LINEAR_SYM)}, - { "LINES", SYM(LINES)}, - { "LIST", SYM(LIST_SYM)}, - { "LOAD", SYM(LOAD)}, - { "LOCAL", SYM(LOCAL_SYM)}, - { "LOCALTIME", SYM(NOW_SYM)}, - { "LOCALTIMESTAMP", SYM(NOW_SYM)}, - { "LOCK", SYM(LOCK_SYM)}, - { "LOCKS", SYM(LOCKS_SYM)}, - { "LOGFILE", SYM(LOGFILE_SYM)}, - { "LOGS", SYM(LOGS_SYM)}, - { "LONG", SYM(LONG_SYM)}, - { "LONGBLOB", SYM(LONGBLOB)}, - { "LONGTEXT", SYM(LONGTEXT)}, - { "LOOP", SYM(LOOP_SYM)}, - { "LOW_PRIORITY", SYM(LOW_PRIORITY)}, - { "MASTER", SYM(MASTER_SYM)}, - { "MASTER_CONNECT_RETRY", SYM(MASTER_CONNECT_RETRY_SYM)}, - { "MASTER_DELAY", SYM(MASTER_DELAY_SYM)}, - { "MASTER_GTID_POS", SYM(MASTER_GTID_POS_SYM)}, - { "MASTER_HOST", SYM(MASTER_HOST_SYM)}, - { "MASTER_LOG_FILE", SYM(MASTER_LOG_FILE_SYM)}, - { "MASTER_LOG_POS", SYM(MASTER_LOG_POS_SYM)}, - { "MASTER_PASSWORD", SYM(MASTER_PASSWORD_SYM)}, - { "MASTER_PORT", SYM(MASTER_PORT_SYM)}, - { "MASTER_SERVER_ID", SYM(MASTER_SERVER_ID_SYM)}, - { "MASTER_SSL", SYM(MASTER_SSL_SYM)}, - { "MASTER_SSL_CA", SYM(MASTER_SSL_CA_SYM)}, - { "MASTER_SSL_CAPATH",SYM(MASTER_SSL_CAPATH_SYM)}, - { "MASTER_SSL_CERT", SYM(MASTER_SSL_CERT_SYM)}, - { "MASTER_SSL_CIPHER",SYM(MASTER_SSL_CIPHER_SYM)}, - { "MASTER_SSL_CRL", SYM(MASTER_SSL_CRL_SYM)}, - { "MASTER_SSL_CRLPATH",SYM(MASTER_SSL_CRLPATH_SYM)}, - { "MASTER_SSL_KEY", SYM(MASTER_SSL_KEY_SYM)}, - { "MASTER_SSL_VERIFY_SERVER_CERT", SYM(MASTER_SSL_VERIFY_SERVER_CERT_SYM)}, - { "MASTER_USER", SYM(MASTER_USER_SYM)}, - { "MASTER_USE_GTID", SYM(MASTER_USE_GTID_SYM)}, - { "MASTER_HEARTBEAT_PERIOD", SYM(MASTER_HEARTBEAT_PERIOD_SYM)}, - { "MATCH", SYM(MATCH)}, - { "MAX_CONNECTIONS_PER_HOUR", SYM(MAX_CONNECTIONS_PER_HOUR)}, - { "MAX_QUERIES_PER_HOUR", SYM(MAX_QUERIES_PER_HOUR)}, - { "MAX_ROWS", SYM(MAX_ROWS)}, - { "MAX_SIZE", SYM(MAX_SIZE_SYM)}, - { "MAX_STATEMENT_TIME", SYM(MAX_STATEMENT_TIME_SYM)}, - { "MAX_UPDATES_PER_HOUR", SYM(MAX_UPDATES_PER_HOUR)}, - { "MAX_USER_CONNECTIONS", SYM(MAX_USER_CONNECTIONS_SYM)}, - { "MAXVALUE", SYM(MAXVALUE_SYM)}, - { "MEDIUM", SYM(MEDIUM_SYM)}, - { "MEDIUMBLOB", SYM(MEDIUMBLOB)}, - { "MEDIUMINT", SYM(MEDIUMINT)}, - { "MEDIUMTEXT", SYM(MEDIUMTEXT)}, - { "MEMORY", SYM(MEMORY_SYM)}, - { "MERGE", SYM(MERGE_SYM)}, - { "MESSAGE_TEXT", SYM(MESSAGE_TEXT_SYM)}, - { "MICROSECOND", SYM(MICROSECOND_SYM)}, - { "MIDDLEINT", SYM(MEDIUMINT)}, /* For powerbuilder */ - { "MIGRATE", SYM(MIGRATE_SYM)}, - { "MINUTE", SYM(MINUTE_SYM)}, - { "MINUTE_MICROSECOND", SYM(MINUTE_MICROSECOND_SYM)}, - { "MINUTE_SECOND", SYM(MINUTE_SECOND_SYM)}, - { "MINVALUE", SYM(MINVALUE_SYM)}, - { "MIN_ROWS", SYM(MIN_ROWS)}, - { "MOD", SYM(MOD_SYM)}, - { "MODE", SYM(MODE_SYM)}, - { "MODIFIES", SYM(MODIFIES_SYM)}, - { "MODIFY", SYM(MODIFY_SYM)}, - { "MONITOR", SYM(MONITOR_SYM)}, - { "MONTH", SYM(MONTH_SYM)}, - { "MUTEX", SYM(MUTEX_SYM)}, - { "MYSQL", SYM(MYSQL_SYM)}, - { "MYSQL_ERRNO", SYM(MYSQL_ERRNO_SYM)}, - { "NAME", SYM(NAME_SYM)}, - { "NAMES", SYM(NAMES_SYM)}, - { "NATIONAL", SYM(NATIONAL_SYM)}, - { "NATURAL", SYM(NATURAL)}, - { "NCHAR", SYM(NCHAR_SYM)}, - { "NEVER", SYM(NEVER_SYM)}, - { "NEW", SYM(NEW_SYM)}, - { "NEXT", SYM(NEXT_SYM)}, - { "NEXTVAL", SYM(NEXTVAL_SYM)}, - { "NO", SYM(NO_SYM)}, - { "NOMAXVALUE", SYM(NOMAXVALUE_SYM)}, - { "NOMINVALUE", SYM(NOMINVALUE_SYM)}, - { "NOCACHE", SYM(NOCACHE_SYM)}, - { "NOCYCLE", SYM(NOCYCLE_SYM)}, - { "NO_WAIT", SYM(NO_WAIT_SYM)}, - { "NOWAIT", SYM(NOWAIT_SYM)}, - { "NODEGROUP", SYM(NODEGROUP_SYM)}, - { "NONE", SYM(NONE_SYM)}, - { "NOT", SYM(NOT_SYM)}, - { "NOTFOUND", SYM(NOTFOUND_SYM)}, - { "NO_WRITE_TO_BINLOG", SYM(NO_WRITE_TO_BINLOG)}, - { "NULL", SYM(NULL_SYM)}, - { "NUMBER", SYM(NUMBER_MARIADB_SYM)}, - { "NUMERIC", SYM(NUMERIC_SYM)}, - { "NVARCHAR", SYM(NVARCHAR_SYM)}, - { "OF", SYM(OF_SYM)}, - { "OFFSET", SYM(OFFSET_SYM)}, - { "OLD_PASSWORD", SYM(OLD_PASSWORD_SYM)}, - { "ON", SYM(ON)}, - { "ONE", SYM(ONE_SYM)}, - { "ONLINE", SYM(ONLINE_SYM)}, - { "ONLY", SYM(ONLY_SYM)}, - { "OPEN", SYM(OPEN_SYM)}, - { "OPTIMIZE", SYM(OPTIMIZE)}, - { "OPTIONS", SYM(OPTIONS_SYM)}, - { "OPTION", SYM(OPTION)}, - { "OPTIONALLY", SYM(OPTIONALLY)}, - { "OR", SYM(OR_SYM)}, - { "ORDER", SYM(ORDER_SYM)}, - { "OTHERS", SYM(OTHERS_MARIADB_SYM)}, - { "OUT", SYM(OUT_SYM)}, - { "OUTER", SYM(OUTER)}, - { "OUTFILE", SYM(OUTFILE)}, - { "OVER", SYM(OVER_SYM)}, - { "OVERLAPS", SYM(OVERLAPS_SYM)}, - { "OWNER", SYM(OWNER_SYM)}, - { "PACKAGE", SYM(PACKAGE_MARIADB_SYM)}, - { "PACK_KEYS", SYM(PACK_KEYS_SYM)}, - { "PAGE", SYM(PAGE_SYM)}, - { "PAGE_CHECKSUM", SYM(PAGE_CHECKSUM_SYM)}, - { "PARSER", SYM(PARSER_SYM)}, - { "PARSE_VCOL_EXPR", SYM(PARSE_VCOL_EXPR_SYM)}, - { "PERIOD", SYM(PERIOD_SYM)}, - { "PARTIAL", SYM(PARTIAL)}, - { "PARTITION", SYM(PARTITION_SYM)}, - { "PARTITIONING", SYM(PARTITIONING_SYM)}, - { "PARTITIONS", SYM(PARTITIONS_SYM)}, - { "PASSWORD", SYM(PASSWORD_SYM)}, - { "PERSISTENT", SYM(PERSISTENT_SYM)}, - { "PHASE", SYM(PHASE_SYM)}, - { "PLUGIN", SYM(PLUGIN_SYM)}, - { "PLUGINS", SYM(PLUGINS_SYM)}, - { "PORT", SYM(PORT_SYM)}, - { "PORTION", SYM(PORTION_SYM)}, - { "PRECEDES", SYM(PRECEDES_SYM)}, - { "PRECEDING", SYM(PRECEDING_SYM)}, - { "PRECISION", SYM(PRECISION)}, - { "PREPARE", SYM(PREPARE_SYM)}, - { "PRESERVE", SYM(PRESERVE_SYM)}, - { "PREV", SYM(PREV_SYM)}, - { "PREVIOUS", SYM(PREVIOUS_SYM)}, - { "PRIMARY", SYM(PRIMARY_SYM)}, - { "PRIVILEGES", SYM(PRIVILEGES)}, - { "PROCEDURE", SYM(PROCEDURE_SYM)}, - { "PROCESS" , SYM(PROCESS)}, - { "PROCESSLIST", SYM(PROCESSLIST_SYM)}, - { "PROFILE", SYM(PROFILE_SYM)}, - { "PROFILES", SYM(PROFILES_SYM)}, - { "PROXY", SYM(PROXY_SYM)}, - { "PURGE", SYM(PURGE)}, - { "QUARTER", SYM(QUARTER_SYM)}, - { "QUERY", SYM(QUERY_SYM)}, - { "QUICK", SYM(QUICK)}, - { "RAISE", SYM(RAISE_MARIADB_SYM)}, - { "RANGE", SYM(RANGE_SYM)}, - { "RAW", SYM(RAW_MARIADB_SYM)}, - { "READ", SYM(READ_SYM)}, - { "READ_ONLY", SYM(READ_ONLY_SYM)}, - { "READ_WRITE", SYM(READ_WRITE_SYM)}, - { "READS", SYM(READS_SYM)}, - { "REAL", SYM(REAL)}, - { "REBUILD", SYM(REBUILD_SYM)}, - { "RECOVER", SYM(RECOVER_SYM)}, - { "RECURSIVE", SYM(RECURSIVE_SYM)}, - { "REDO_BUFFER_SIZE", SYM(REDO_BUFFER_SIZE_SYM)}, - { "REDOFILE", SYM(REDOFILE_SYM)}, - { "REDUNDANT", SYM(REDUNDANT_SYM)}, - { "REFERENCES", SYM(REFERENCES)}, - { "REGEXP", SYM(REGEXP)}, - { "RELAY", SYM(RELAY)}, - { "RELAYLOG", SYM(RELAYLOG_SYM)}, - { "RELAY_LOG_FILE", SYM(RELAY_LOG_FILE_SYM)}, - { "RELAY_LOG_POS", SYM(RELAY_LOG_POS_SYM)}, - { "RELAY_THREAD", SYM(RELAY_THREAD)}, - { "RELEASE", SYM(RELEASE_SYM)}, - { "RELOAD", SYM(RELOAD)}, - { "REMOVE", SYM(REMOVE_SYM)}, - { "RENAME", SYM(RENAME)}, - { "REORGANIZE", SYM(REORGANIZE_SYM)}, - { "REPAIR", SYM(REPAIR)}, - { "REPEATABLE", SYM(REPEATABLE_SYM)}, - { "REPLACE", SYM(REPLACE)}, - { "REPLAY", SYM(REPLAY_SYM)}, - { "REPLICA", SYM(SLAVE)}, - { "REPLICAS", SYM(SLAVES)}, - { "REPLICA_POS", SYM(SLAVE_POS_SYM)}, - { "REPLICATION", SYM(REPLICATION)}, - { "REPEAT", SYM(REPEAT_SYM)}, - { "REQUIRE", SYM(REQUIRE_SYM)}, - { "RESET", SYM(RESET_SYM)}, - { "RESIGNAL", SYM(RESIGNAL_SYM)}, - { "RESTART", SYM(RESTART_SYM)}, - { "RESTORE", SYM(RESTORE_SYM)}, - { "RESTRICT", SYM(RESTRICT)}, - { "RESUME", SYM(RESUME_SYM)}, - { "RETURNED_SQLSTATE",SYM(RETURNED_SQLSTATE_SYM)}, - { "RETURN", SYM(RETURN_MARIADB_SYM)}, - { "RETURNING", SYM(RETURNING_SYM)}, - { "RETURNS", SYM(RETURNS_SYM)}, - { "REUSE", SYM(REUSE_SYM)}, - { "REVERSE", SYM(REVERSE_SYM)}, - { "REVOKE", SYM(REVOKE)}, - { "RIGHT", SYM(RIGHT)}, - { "RLIKE", SYM(REGEXP)}, /* Like in mSQL2 */ - { "ROLE", SYM(ROLE_SYM)}, - { "ROLLBACK", SYM(ROLLBACK_SYM)}, - { "ROLLUP", SYM(ROLLUP_SYM)}, - { "ROUTINE", SYM(ROUTINE_SYM)}, - { "ROW", SYM(ROW_SYM)}, - { "ROWCOUNT", SYM(ROWCOUNT_SYM)}, /* Oracle-N */ - { "ROWS", SYM(ROWS_SYM)}, - { "ROWTYPE", SYM(ROWTYPE_MARIADB_SYM)}, - { "ROW_COUNT", SYM(ROW_COUNT_SYM)}, - { "ROW_FORMAT", SYM(ROW_FORMAT_SYM)}, - { "RTREE", SYM(RTREE_SYM)}, - { "SAVEPOINT", SYM(SAVEPOINT_SYM)}, - { "SCHEDULE", SYM(SCHEDULE_SYM)}, - { "SCHEMA", SYM(DATABASE)}, - { "SCHEMA_NAME", SYM(SCHEMA_NAME_SYM)}, - { "SCHEMAS", SYM(DATABASES)}, - { "SECOND", SYM(SECOND_SYM)}, - { "SECOND_MICROSECOND", SYM(SECOND_MICROSECOND_SYM)}, - { "SECURITY", SYM(SECURITY_SYM)}, - { "SELECT", SYM(SELECT_SYM)}, - { "SENSITIVE", SYM(SENSITIVE_SYM)}, - { "SEPARATOR", SYM(SEPARATOR_SYM)}, - { "SEQUENCE", SYM(SEQUENCE_SYM)}, - { "SERIAL", SYM(SERIAL_SYM)}, - { "SERIALIZABLE", SYM(SERIALIZABLE_SYM)}, - { "SESSION", SYM(SESSION_SYM)}, - { "SERVER", SYM(SERVER_SYM)}, - { "SET", SYM(SET)}, - { "SETVAL", SYM(SETVAL_SYM)}, - { "SHARE", SYM(SHARE_SYM)}, - { "SHOW", SYM(SHOW)}, - { "SHUTDOWN", SYM(SHUTDOWN)}, - { "SIGNAL", SYM(SIGNAL_SYM)}, - { "SIGNED", SYM(SIGNED_SYM)}, - { "SIMPLE", SYM(SIMPLE_SYM)}, - { "SLAVE", SYM(SLAVE)}, - { "SLAVES", SYM(SLAVES)}, - { "SLAVE_POS", SYM(SLAVE_POS_SYM)}, - { "SLOW", SYM(SLOW)}, - { "SNAPSHOT", SYM(SNAPSHOT_SYM)}, - { "SMALLINT", SYM(SMALLINT)}, - { "SOCKET", SYM(SOCKET_SYM)}, - { "SOFT", SYM(SOFT_SYM)}, - { "SOME", SYM(ANY_SYM)}, - { "SONAME", SYM(SONAME_SYM)}, - { "SOUNDS", SYM(SOUNDS_SYM)}, - { "SOURCE", SYM(SOURCE_SYM)}, - { "STAGE", SYM(STAGE_SYM)}, - { "STORED", SYM(STORED_SYM)}, - { "SPATIAL", SYM(SPATIAL_SYM)}, - { "SPECIFIC", SYM(SPECIFIC_SYM)}, - { "REF_SYSTEM_ID", SYM(REF_SYSTEM_ID_SYM)}, - { "SQL", SYM(SQL_SYM)}, - { "SQLEXCEPTION", SYM(SQLEXCEPTION_SYM)}, - { "SQLSTATE", SYM(SQLSTATE_SYM)}, - { "SQLWARNING", SYM(SQLWARNING_SYM)}, - { "SQL_BIG_RESULT", SYM(SQL_BIG_RESULT)}, - { "SQL_BUFFER_RESULT", SYM(SQL_BUFFER_RESULT)}, - { "SQL_CACHE", SYM(SQL_CACHE_SYM)}, - { "SQL_CALC_FOUND_ROWS", SYM(SQL_CALC_FOUND_ROWS)}, - { "SQL_NO_CACHE", SYM(SQL_NO_CACHE_SYM)}, - { "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT)}, - { "SQL_THREAD", SYM(SQL_THREAD)}, - { "SQL_TSI_SECOND", SYM(SECOND_SYM)}, - { "SQL_TSI_MINUTE", SYM(MINUTE_SYM)}, - { "SQL_TSI_HOUR", SYM(HOUR_SYM)}, - { "SQL_TSI_DAY", SYM(DAY_SYM)}, - { "SQL_TSI_WEEK", SYM(WEEK_SYM)}, - { "SQL_TSI_MONTH", SYM(MONTH_SYM)}, - { "SQL_TSI_QUARTER", SYM(QUARTER_SYM)}, - { "SQL_TSI_YEAR", SYM(YEAR_SYM)}, - { "SSL", SYM(SSL_SYM)}, - { "START", SYM(START_SYM)}, - { "STARTING", SYM(STARTING)}, - { "STARTS", SYM(STARTS_SYM)}, - { "STATEMENT", SYM(STATEMENT_SYM)}, - { "STATS_AUTO_RECALC",SYM(STATS_AUTO_RECALC_SYM)}, - { "STATS_PERSISTENT", SYM(STATS_PERSISTENT_SYM)}, - { "STATS_SAMPLE_PAGES",SYM(STATS_SAMPLE_PAGES_SYM)}, - { "STATUS", SYM(STATUS_SYM)}, - { "STOP", SYM(STOP_SYM)}, - { "STORAGE", SYM(STORAGE_SYM)}, - { "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN)}, - { "STRING", SYM(STRING_SYM)}, - { "SUBCLASS_ORIGIN", SYM(SUBCLASS_ORIGIN_SYM)}, - { "SUBJECT", SYM(SUBJECT_SYM)}, - { "SUBPARTITION", SYM(SUBPARTITION_SYM)}, - { "SUBPARTITIONS", SYM(SUBPARTITIONS_SYM)}, - { "SUPER", SYM(SUPER_SYM)}, - { "SUSPEND", SYM(SUSPEND_SYM)}, - { "SWAPS", SYM(SWAPS_SYM)}, - { "SWITCHES", SYM(SWITCHES_SYM)}, - { "SYSTEM", SYM(SYSTEM)}, - { "SYSTEM_TIME", SYM(SYSTEM_TIME_SYM)}, - { "TABLE", SYM(TABLE_SYM)}, - { "TABLE_NAME", SYM(TABLE_NAME_SYM)}, - { "TABLES", SYM(TABLES)}, - { "TABLESPACE", SYM(TABLESPACE)}, - { "TABLE_CHECKSUM", SYM(TABLE_CHECKSUM_SYM)}, - { "TEMPORARY", SYM(TEMPORARY)}, - { "TEMPTABLE", SYM(TEMPTABLE_SYM)}, - { "TERMINATED", SYM(TERMINATED)}, - { "TEXT", SYM(TEXT_SYM)}, - { "THAN", SYM(THAN_SYM)}, - { "THEN", SYM(THEN_SYM)}, - { "TIES", SYM(TIES_SYM)}, - { "TIME", SYM(TIME_SYM)}, - { "TIMESTAMP", SYM(TIMESTAMP)}, - { "TIMESTAMPADD", SYM(TIMESTAMP_ADD)}, - { "TIMESTAMPDIFF", SYM(TIMESTAMP_DIFF)}, - { "TINYBLOB", SYM(TINYBLOB)}, - { "TINYINT", SYM(TINYINT)}, - { "TINYTEXT", SYM(TINYTEXT)}, - { "TO", SYM(TO_SYM)}, - { "TRAILING", SYM(TRAILING)}, - { "TRANSACTION", SYM(TRANSACTION_SYM)}, - { "TRANSACTIONAL", SYM(TRANSACTIONAL_SYM)}, - { "THREADS", SYM(THREADS_SYM)}, - { "TRIGGER", SYM(TRIGGER_SYM)}, - { "TRIGGERS", SYM(TRIGGERS_SYM)}, - { "TRUE", SYM(TRUE_SYM)}, - { "TRUNCATE", SYM(TRUNCATE_SYM)}, - { "TYPE", SYM(TYPE_SYM)}, - { "TYPES", SYM(TYPES_SYM)}, - { "UNBOUNDED", SYM(UNBOUNDED_SYM)}, - { "UNCOMMITTED", SYM(UNCOMMITTED_SYM)}, - { "UNDEFINED", SYM(UNDEFINED_SYM)}, - { "UNDO_BUFFER_SIZE", SYM(UNDO_BUFFER_SIZE_SYM)}, - { "UNDOFILE", SYM(UNDOFILE_SYM)}, - { "UNDO", SYM(UNDO_SYM)}, - { "UNICODE", SYM(UNICODE_SYM)}, - { "UNION", SYM(UNION_SYM)}, - { "UNIQUE", SYM(UNIQUE_SYM)}, - { "UNKNOWN", SYM(UNKNOWN_SYM)}, - { "UNLOCK", SYM(UNLOCK_SYM)}, - { "UNINSTALL", SYM(UNINSTALL_SYM)}, - { "UNSIGNED", SYM(UNSIGNED)}, - { "UNTIL", SYM(UNTIL_SYM)}, - { "UPDATE", SYM(UPDATE_SYM)}, - { "UPGRADE", SYM(UPGRADE_SYM)}, - { "USAGE", SYM(USAGE)}, - { "USE", SYM(USE_SYM)}, - { "USER", SYM(USER_SYM)}, - { "USER_RESOURCES", SYM(RESOURCES)}, - { "USE_FRM", SYM(USE_FRM)}, - { "USING", SYM(USING)}, - { "UTC_DATE", SYM(UTC_DATE_SYM)}, - { "UTC_TIME", SYM(UTC_TIME_SYM)}, - { "UTC_TIMESTAMP", SYM(UTC_TIMESTAMP_SYM)}, - { "VALUE", SYM(VALUE_SYM)}, - { "VALUES", SYM(VALUES)}, - { "VARBINARY", SYM(VARBINARY)}, - { "VARCHAR", SYM(VARCHAR)}, - { "VARCHARACTER", SYM(VARCHAR)}, - { "VARCHAR2", SYM(VARCHAR2_MARIADB_SYM)}, - { "VARIABLES", SYM(VARIABLES)}, - { "VARYING", SYM(VARYING)}, - { "VIA", SYM(VIA_SYM)}, - { "VIEW", SYM(VIEW_SYM)}, - { "VIRTUAL", SYM(VIRTUAL_SYM)}, - { "VISIBLE", SYM(VISIBLE_SYM)}, - { "VERSIONING", SYM(VERSIONING_SYM)}, - { "WAIT", SYM(WAIT_SYM)}, - { "WARNINGS", SYM(WARNINGS)}, - { "WEEK", SYM(WEEK_SYM)}, - { "WEIGHT_STRING", SYM(WEIGHT_STRING_SYM)}, - { "WHEN", SYM(WHEN_SYM)}, - { "WHERE", SYM(WHERE)}, - { "WHILE", SYM(WHILE_SYM)}, - { "WINDOW", SYM(WINDOW_SYM)}, - { "WITH", SYM(WITH)}, - { "WITHIN", SYM(WITHIN)}, - { "WITHOUT", SYM(WITHOUT)}, - { "WORK", SYM(WORK_SYM)}, - { "WRAPPER", SYM(WRAPPER_SYM)}, - { "WRITE", SYM(WRITE_SYM)}, - { "X509", SYM(X509_SYM)}, - { "XOR", SYM(XOR)}, - { "XA", SYM(XA_SYM)}, - { "XML", SYM(XML_SYM)}, /* LOAD XML Arnold/Erik */ - { "YEAR", SYM(YEAR_SYM)}, - { "YEAR_MONTH", SYM(YEAR_MONTH_SYM)}, - { "ZEROFILL", SYM(ZEROFILL)}, - { "||", SYM(OR2_SYM)} -}; - - -static SYMBOL sql_functions[] = { - { "ADDDATE", SYM(ADDDATE_SYM)}, - { "BIT_AND", SYM(BIT_AND)}, - { "BIT_OR", SYM(BIT_OR)}, - { "BIT_XOR", SYM(BIT_XOR)}, - { "CAST", SYM(CAST_SYM)}, - { "COUNT", SYM(COUNT_SYM)}, - { "CUME_DIST", SYM(CUME_DIST_SYM)}, - { "CURDATE", SYM(CURDATE)}, - { "CURTIME", SYM(CURTIME)}, - { "DATE_ADD", SYM(DATE_ADD_INTERVAL)}, - { "DATE_SUB", SYM(DATE_SUB_INTERVAL)}, - { "DATE_FORMAT", SYM(DATE_FORMAT_SYM)}, - { "DECODE", SYM(DECODE_MARIADB_SYM)}, - { "DENSE_RANK", SYM(DENSE_RANK_SYM)}, - { "EXTRACT", SYM(EXTRACT_SYM)}, - { "FIRST_VALUE", SYM(FIRST_VALUE_SYM)}, - { "GROUP_CONCAT", SYM(GROUP_CONCAT_SYM)}, - { "JSON_ARRAYAGG", SYM(JSON_ARRAYAGG_SYM)}, - { "JSON_OBJECTAGG", SYM(JSON_OBJECTAGG_SYM)}, - { "LAG", SYM(LAG_SYM)}, - { "LEAD", SYM(LEAD_SYM)}, - { "MAX", SYM(MAX_SYM)}, - { "MEDIAN", SYM(MEDIAN_SYM)}, - { "MID", SYM(SUBSTRING)}, /* unireg function */ - { "MIN", SYM(MIN_SYM)}, - { "NOW", SYM(NOW_SYM)}, - { "NTH_VALUE", SYM(NTH_VALUE_SYM)}, - { "NTILE", SYM(NTILE_SYM)}, - { "POSITION", SYM(POSITION_SYM)}, - { "PERCENT_RANK", SYM(PERCENT_RANK_SYM)}, - { "PERCENTILE_CONT", SYM(PERCENTILE_CONT_SYM)}, - { "PERCENTILE_DISC", SYM(PERCENTILE_DISC_SYM)}, - { "RANK", SYM(RANK_SYM)}, - { "ROW_NUMBER", SYM(ROW_NUMBER_SYM)}, - { "SESSION_USER", SYM(USER_SYM)}, - { "STD", SYM(STD_SYM)}, - { "STDDEV", SYM(STD_SYM)}, - { "STDDEV_POP", SYM(STD_SYM)}, - { "STDDEV_SAMP", SYM(STDDEV_SAMP_SYM)}, - { "SUBDATE", SYM(SUBDATE_SYM)}, - { "SUBSTR", SYM(SUBSTRING)}, - { "SUBSTRING", SYM(SUBSTRING)}, - { "SUM", SYM(SUM_SYM)}, - { "SYSDATE", SYM(SYSDATE)}, - { "SYSTEM_USER", SYM(USER_SYM)}, - { "TRIM", SYM(TRIM)}, - { "TRIM_ORACLE", SYM(TRIM_ORACLE)}, - { "VARIANCE", SYM(VARIANCE_SYM)}, - { "VAR_POP", SYM(VARIANCE_SYM)}, - { "VAR_SAMP", SYM(VAR_SAMP_SYM)}, -}; - -#endif /* LEX_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lex_string.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/lex_string.h deleted file mode 100644 index 008e5f7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lex_string.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (c) 2018, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -#ifndef LEX_STRING_INCLUDED -#define LEX_STRING_INCLUDED - - -typedef struct st_mysql_const_lex_string LEX_CSTRING; - - -class Lex_cstring : public LEX_CSTRING -{ - public: - Lex_cstring() - { - str= NULL; - length= 0; - } - Lex_cstring(const LEX_CSTRING &str) - { - LEX_CSTRING::operator=(str); - } - Lex_cstring(const char *_str, size_t _len) - { - str= _str; - length= _len; - } - Lex_cstring(const char *start, const char *end) - { - DBUG_ASSERT(start <= end); - str= start; - length= end - start; - } - void set(const char *_str, size_t _len) - { - str= _str; - length= _len; - } -}; - - -class Lex_cstring_strlen: public Lex_cstring -{ -public: - Lex_cstring_strlen(const char *from) - :Lex_cstring(from, from ? strlen(from) : 0) - { } -}; - - -/* Functions to compare if two lex strings are equal */ - -static inline bool lex_string_cmp(CHARSET_INFO *charset, const LEX_CSTRING *a, - const LEX_CSTRING *b) -{ - return my_strcasecmp(charset, a->str, b->str); -} - -/* - Compare to LEX_CSTRING's and return 0 if equal -*/ - -static inline bool cmp(const LEX_CSTRING *a, const LEX_CSTRING *b) -{ - return (a->length != b->length || - memcmp(a->str, b->str, a->length)); -} -static inline bool cmp(const LEX_CSTRING a, const LEX_CSTRING b) -{ - return a.length != b.length || memcmp(a.str, b.str, a.length); -} - -/* - Compare if two LEX_CSTRING are equal. Assumption is that - character set is ASCII (like for plugin names) -*/ - -static inline bool lex_string_eq(const LEX_CSTRING *a, const LEX_CSTRING *b) -{ - if (a->length != b->length) - return 0; /* Different */ - return strcasecmp(a->str, b->str) == 0; -} - -/* - To be used when calling lex_string_eq with STRING_WITH_LEN() as second - argument -*/ - -static inline bool lex_string_eq(const LEX_CSTRING *a, const char *b, size_t b_length) -{ - if (a->length != b_length) - return 0; /* Different */ - return strcasecmp(a->str, b) == 0; -} - -#endif /* LEX_STRING_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lex_symbol.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/lex_symbol.h deleted file mode 100644 index e7819cd..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lex_symbol.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2000, 2001, 2004, 2006, 2007 MySQL AB - Use is subject to license terms - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* This struct includes all reserved words and functions */ - -#ifndef _lex_symbol_h -#define _lex_symbol_h - -struct st_sym_group; - -typedef struct st_symbol { - const char *name; - uint tok; - uint length; - struct st_sym_group *group; -} SYMBOL; - -typedef struct st_lex_symbol -{ - SYMBOL *symbol; - char *str; - uint length; -} LEX_SYMBOL; - -typedef struct st_sym_group { - const char *name; - const char *needed_define; -} SYM_GROUP; - -extern SYM_GROUP sym_group_common; -extern SYM_GROUP sym_group_geom; -extern SYM_GROUP sym_group_rtree; - -#endif /* _lex_symbol_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lf.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/lf.h deleted file mode 100644 index 88ac644..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lf.h +++ /dev/null @@ -1,184 +0,0 @@ -/* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef INCLUDE_LF_INCLUDED -#define INCLUDE_LF_INCLUDED - -#include - -C_MODE_START - -/* - wait-free dynamic array, see lf_dynarray.c - - 4 levels of 256 elements each mean 4311810304 elements in an array - it - should be enough for a while -*/ -#define LF_DYNARRAY_LEVEL_LENGTH 256 -#define LF_DYNARRAY_LEVELS 4 - -typedef struct { - void * volatile level[LF_DYNARRAY_LEVELS]; - uint size_of_element; -} LF_DYNARRAY; - -typedef int (*lf_dynarray_func)(void *, void *); - -void lf_dynarray_init(LF_DYNARRAY *array, uint element_size); -void lf_dynarray_destroy(LF_DYNARRAY *array); - -void *lf_dynarray_value(LF_DYNARRAY *array, uint idx); -void *lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx); -int lf_dynarray_iterate(LF_DYNARRAY *array, lf_dynarray_func func, void *arg); - -/* - pin manager for memory allocator, lf_alloc-pin.c -*/ - -#define LF_PINBOX_PINS 4 -#define LF_PURGATORY_SIZE 100 - -typedef void lf_pinbox_free_func(void *, void *, void*); - -typedef struct { - LF_DYNARRAY pinarray; - lf_pinbox_free_func *free_func; - void *free_func_arg; - uint free_ptr_offset; - uint32 volatile pinstack_top_ver; /* this is a versioned pointer */ - uint32 volatile pins_in_array; /* number of elements in array */ -} LF_PINBOX; - -typedef struct { - void * volatile pin[LF_PINBOX_PINS]; - LF_PINBOX *pinbox; - void *purgatory; - uint32 purgatory_count; - uint32 volatile link; - /* avoid false sharing */ - char pad[CPU_LEVEL1_DCACHE_LINESIZE]; -} LF_PINS; - -/* compile-time assert to make sure we have enough pins. */ -#define lf_pin(PINS, PIN, ADDR) \ - do { \ - compile_time_assert(PIN < LF_PINBOX_PINS); \ - my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR)); \ - } while(0) - -#define lf_unpin(PINS, PIN) lf_pin(PINS, PIN, NULL) -#define lf_assert_pin(PINS, PIN) assert((PINS)->pin[PIN] != 0) -#define lf_assert_unpin(PINS, PIN) assert((PINS)->pin[PIN] == 0) - -void lf_pinbox_init(LF_PINBOX *pinbox, uint free_ptr_offset, - lf_pinbox_free_func *free_func, void * free_func_arg); -void lf_pinbox_destroy(LF_PINBOX *pinbox); - -LF_PINS *lf_pinbox_get_pins(LF_PINBOX *pinbox); -void lf_pinbox_put_pins(LF_PINS *pins); -void lf_pinbox_free(LF_PINS *pins, void *addr); - -/* - memory allocator, lf_alloc-pin.c -*/ - -typedef struct st_lf_allocator { - LF_PINBOX pinbox; - uchar * volatile top; - uint element_size; - uint32 volatile mallocs; - void (*constructor)(uchar *); /* called, when an object is malloc()'ed */ - void (*destructor)(uchar *); /* called, when an object is free()'d */ -} LF_ALLOCATOR; - -void lf_alloc_init(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset); -void lf_alloc_destroy(LF_ALLOCATOR *allocator); -uint lf_alloc_pool_count(LF_ALLOCATOR *allocator); -/* - shortcut macros to access underlying pinbox functions from an LF_ALLOCATOR - see lf_pinbox_get_pins() and lf_pinbox_put_pins() -*/ -#define lf_alloc_free(PINS, PTR) lf_pinbox_free((PINS), (PTR)) -#define lf_alloc_get_pins(A) lf_pinbox_get_pins(&(A)->pinbox) -#define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS) -#define lf_alloc_direct_free(ALLOC, ADDR) \ - do { \ - if ((ALLOC)->destructor) \ - (ALLOC)->destructor((uchar*) ADDR); \ - my_free(ADDR); \ - } while(0) - -void *lf_alloc_new(LF_PINS *pins); - -C_MODE_END - -/* - extendible hash, lf_hash.c -*/ -#include - -C_MODE_START - -typedef struct st_lf_hash LF_HASH; -typedef void (*lf_hash_initializer)(LF_HASH *hash, void *dst, const void *src); - -#define LF_HASH_UNIQUE 1 - -/* lf_hash overhead per element (that is, sizeof(LF_SLIST) */ -extern const int LF_HASH_OVERHEAD; - -struct st_lf_hash { - LF_DYNARRAY array; /* hash itself */ - LF_ALLOCATOR alloc; /* allocator for elements */ - my_hash_get_key get_key; /* see HASH */ - lf_hash_initializer initializer; /* called when an element is inserted */ - my_hash_function hash_function; /* see HASH */ - CHARSET_INFO *charset; /* see HASH */ - uint key_offset, key_length; /* see HASH */ - uint element_size; /* size of memcpy'ed area on insert */ - uint flags; /* LF_HASH_UNIQUE, etc */ - int32 volatile size; /* size of array */ - int32 volatile count; /* number of elements in the hash */ -}; - -void lf_hash_init(LF_HASH *hash, uint element_size, uint flags, - uint key_offset, uint key_length, my_hash_get_key get_key, - CHARSET_INFO *charset); -void lf_hash_destroy(LF_HASH *hash); -int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data); -void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen); -void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins, - my_hash_value_type hash_value, - const void *key, uint keylen); -int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen); -int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins, - my_hash_walk_action action, void *argument); -#define lf_hash_size(hash) \ - my_atomic_load32_explicit(&(hash)->count, MY_MEMORY_ORDER_RELAXED) -/* - shortcut macros to access underlying pinbox functions from an LF_HASH - see lf_pinbox_get_pins() and lf_pinbox_put_pins() -*/ -#define lf_hash_get_pins(HASH) lf_alloc_get_pins(&(HASH)->alloc) -#define lf_hash_put_pins(PINS) lf_pinbox_put_pins(PINS) -#define lf_hash_search_unpin(PINS) lf_unpin((PINS), 2) -/* - cleanup -*/ - -C_MODE_END - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lock.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/lock.h deleted file mode 100644 index 0b23ddd..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/lock.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef LOCK_INCLUDED -#define LOCK_INCLUDED - -#include "thr_lock.h" /* thr_lock_type */ -#include "mdl.h" - -// Forward declarations -struct TABLE; -struct TABLE_LIST; -class THD; -typedef struct st_mysql_lock MYSQL_LOCK; - - -MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, uint flags); -bool mysql_lock_tables(THD *thd, MYSQL_LOCK *sql_lock, uint flags); -int mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock, bool free_lock); -int mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock); -int mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock); -int mysql_unlock_some_tables(THD *thd, TABLE **table,uint count, uint flag); -int mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table); -bool mysql_lock_abort_for_thread(THD *thd, TABLE *table); -MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b); -/* Lock based on name */ -bool lock_schema_name(THD *thd, const char *db); -/* Lock based on stored routine name */ -bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type, - const char *db, const char *name); - -/* flags for get_lock_data */ -#define GET_LOCK_UNLOCK 0 -#define GET_LOCK_STORE_LOCKS 1 -#define GET_LOCK_ACTION_MASK 1 -#define GET_LOCK_ON_THD (1 << 1) -#define GET_LOCK_SKIP_SEQUENCES (1 << 2) - -MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags); -void reset_lock_data(MYSQL_LOCK *sql_lock, bool unlock); - -#endif /* LOCK_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/log.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/log.h deleted file mode 100644 index 58e6819..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/log.h +++ /dev/null @@ -1,1240 +0,0 @@ -/* Copyright (c) 2005, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef LOG_H -#define LOG_H - -#include "handler.h" /* my_xid */ -#include "wsrep_mysqld.h" -#include "rpl_constants.h" - -class Relay_log_info; - -class Format_description_log_event; - -bool reopen_fstreams(const char *filename, FILE *outstream, FILE *errstream); -void setup_log_handling(); -bool trans_has_updated_trans_table(const THD* thd); -bool stmt_has_updated_trans_table(const THD *thd); -bool use_trans_cache(const THD* thd, bool is_transactional); -bool ending_trans(THD* thd, const bool all); -bool ending_single_stmt_trans(THD* thd, const bool all); -bool trans_has_updated_non_trans_table(const THD* thd); -bool stmt_has_updated_non_trans_table(const THD* thd); - -/* - Transaction Coordinator log - a base abstract class - for two different implementations -*/ -class TC_LOG -{ - public: - int using_heuristic_recover(); - TC_LOG() {} - virtual ~TC_LOG() {} - - virtual int open(const char *opt_name)=0; - virtual void close()=0; - /* - Transaction coordinator 2-phase commit. - - Must invoke the run_prepare_ordered and run_commit_ordered methods, as - described below for these methods. - - In addition, must invoke THD::wait_for_prior_commit(), or equivalent - wait, to ensure that one commit waits for another if registered to do so. - */ - virtual int log_and_order(THD *thd, my_xid xid, bool all, - bool need_prepare_ordered, - bool need_commit_ordered) = 0; - virtual int unlog(ulong cookie, my_xid xid)=0; - virtual int unlog_xa_prepare(THD *thd, bool all)= 0; - virtual void commit_checkpoint_notify(void *cookie)= 0; - -protected: - /* - These methods are meant to be invoked from log_and_order() implementations - to run any prepare_ordered() respectively commit_ordered() methods in - participating handlers. - - They must be called using suitable thread syncronisation to ensure that - they are each called in the correct commit order among all - transactions. However, it is only necessary to call them if the - corresponding flag passed to log_and_order is set (it is safe, but not - required, to call them when the flag is false). - - The caller must be holding LOCK_prepare_ordered respectively - LOCK_commit_ordered when calling these methods. - */ - void run_prepare_ordered(THD *thd, bool all); - void run_commit_ordered(THD *thd, bool all); -}; - -/* - Locks used to ensure serialised execution of TC_LOG::run_prepare_ordered() - and TC_LOG::run_commit_ordered(), or any other code that calls handler - prepare_ordered() or commit_ordered() methods. -*/ -extern mysql_mutex_t LOCK_prepare_ordered; -extern mysql_cond_t COND_prepare_ordered; -extern mysql_mutex_t LOCK_after_binlog_sync; -extern mysql_mutex_t LOCK_commit_ordered; -#ifdef HAVE_PSI_INTERFACE -extern PSI_mutex_key key_LOCK_prepare_ordered, key_LOCK_commit_ordered; -extern PSI_mutex_key key_LOCK_after_binlog_sync; -extern PSI_cond_key key_COND_prepare_ordered; -#endif - -class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging -{ -public: - TC_LOG_DUMMY() {} - int open(const char *opt_name) { return 0; } - void close() { } - /* - TC_LOG_DUMMY is only used when there are <= 1 XA-capable engines, and we - only use internal XA during commit when >= 2 XA-capable engines - participate. - */ - int log_and_order(THD *thd, my_xid xid, bool all, - bool need_prepare_ordered, bool need_commit_ordered) - { - DBUG_ASSERT(0); - return 1; - } - int unlog(ulong cookie, my_xid xid) { return 0; } - int unlog_xa_prepare(THD *thd, bool all) - { - return 0; - } - void commit_checkpoint_notify(void *cookie) { DBUG_ASSERT(0); }; -}; - -#define TC_LOG_PAGE_SIZE 8192 - -#ifdef HAVE_MMAP -class TC_LOG_MMAP: public TC_LOG -{ - public: // only to keep Sun Forte on sol9x86 happy - typedef enum { - PS_POOL, // page is in pool - PS_ERROR, // last sync failed - PS_DIRTY // new xids added since last sync - } PAGE_STATE; - - struct pending_cookies { - uint count; - uint pending_count; - ulong cookies[1]; - }; - - private: - typedef struct st_page { - struct st_page *next; // page a linked in a fifo queue - my_xid *start, *end; // usable area of a page - my_xid *ptr; // next xid will be written here - int size, free; // max and current number of free xid slots on the page - int waiters; // number of waiters on condition - PAGE_STATE state; // see above - mysql_mutex_t lock; // to access page data or control structure - mysql_cond_t cond; // to wait for a sync - } PAGE; - - /* List of THDs for which to invoke commit_ordered(), in order. */ - struct commit_entry - { - struct commit_entry *next; - THD *thd; - }; - - char logname[FN_REFLEN]; - File fd; - my_off_t file_length; - uint npages, inited; - uchar *data; - struct st_page *pages, *syncing, *active, *pool, **pool_last_ptr; - /* - note that, e.g. LOCK_active is only used to protect - 'active' pointer, to protect the content of the active page - one has to use active->lock. - Same for LOCK_pool and LOCK_sync - */ - mysql_mutex_t LOCK_active, LOCK_pool, LOCK_sync, LOCK_pending_checkpoint; - mysql_cond_t COND_pool, COND_active; - /* - Queue of threads that need to call commit_ordered(). - Access to this queue must be protected by LOCK_prepare_ordered. - */ - commit_entry *commit_ordered_queue; - /* - This flag and condition is used to reserve the queue while threads in it - each run the commit_ordered() methods one after the other. Only once the - last commit_ordered() in the queue is done can we start on a new queue - run. - - Since we start this process in the first thread in the queue and finish in - the last (and possibly different) thread, we need a condition variable for - this (we cannot unlock a mutex in a different thread than the one who - locked it). - - The condition is used together with the LOCK_prepare_ordered mutex. - */ - mysql_cond_t COND_queue_busy; - my_bool commit_ordered_queue_busy; - pending_cookies* pending_checkpoint; - - public: - TC_LOG_MMAP(): inited(0), pending_checkpoint(0) {} - int open(const char *opt_name); - void close(); - int log_and_order(THD *thd, my_xid xid, bool all, - bool need_prepare_ordered, bool need_commit_ordered); - int unlog(ulong cookie, my_xid xid); - int unlog_xa_prepare(THD *thd, bool all) - { - return 0; - } - void commit_checkpoint_notify(void *cookie); - int recover(); - - private: - int log_one_transaction(my_xid xid); - void get_active_from_pool(); - int sync(); - int overflow(); - int delete_entry(ulong cookie); -}; -#else -#define TC_LOG_MMAP TC_LOG_DUMMY -#endif - -extern TC_LOG *tc_log; -extern TC_LOG_MMAP tc_log_mmap; -extern TC_LOG_DUMMY tc_log_dummy; - -/* log info errors */ -#define LOG_INFO_EOF -1 -#define LOG_INFO_IO -2 -#define LOG_INFO_INVALID -3 -#define LOG_INFO_SEEK -4 -#define LOG_INFO_MEM -6 -#define LOG_INFO_FATAL -7 -#define LOG_INFO_IN_USE -8 -#define LOG_INFO_EMFILE -9 - - -/* bitmap to SQL_LOG::close() */ -#define LOG_CLOSE_INDEX 1 -#define LOG_CLOSE_TO_BE_OPENED 2 -#define LOG_CLOSE_STOP_EVENT 4 -#define LOG_CLOSE_DELAYED_CLOSE 8 - -/* - Maximum unique log filename extension. - Note: setting to 0x7FFFFFFF due to atol windows - overflow/truncate. - */ -#define MAX_LOG_UNIQUE_FN_EXT 0x7FFFFFFF - -/* - Number of warnings that will be printed to error log - before extension number is exhausted. -*/ -#define LOG_WARN_UNIQUE_FN_EXT_LEFT 1000 - -class Relay_log_info; - -/* - Note that we destroy the lock mutex in the desctructor here. - This means that object instances cannot be destroyed/go out of scope, - until we have reset thd->current_linfo to NULL; - */ -typedef struct st_log_info -{ - char log_file_name[FN_REFLEN]; - my_off_t index_file_offset, index_file_start_offset; - my_off_t pos; - bool fatal; // if the purge happens to give us a negative offset - st_log_info() : index_file_offset(0), index_file_start_offset(0), - pos(0), fatal(0) - { - DBUG_ENTER("LOG_INFO"); - log_file_name[0] = '\0'; - DBUG_VOID_RETURN; - } -} LOG_INFO; - -/* - Currently we have only 3 kinds of logging functions: old-fashioned - logs, stdout and csv logging routines. -*/ -#define MAX_LOG_HANDLERS_NUM 3 - -/* log event handler flags */ -#define LOG_NONE 1U -#define LOG_FILE 2U -#define LOG_TABLE 4U - -class Log_event; -class Rows_log_event; - -enum enum_log_type { LOG_UNKNOWN, LOG_NORMAL, LOG_BIN }; -enum enum_log_state { LOG_OPENED, LOG_CLOSED, LOG_TO_BE_OPENED }; - -/* - Use larger buffers when reading from and to binary log - We make it one step smaller than 64K to account for malloc overhead. -*/ -#define LOG_BIN_IO_SIZE MY_ALIGN_DOWN(65536-1, IO_SIZE) - -/* - TODO use mmap instead of IO_CACHE for binlog - (mmap+fsync is two times faster than write+fsync) -*/ - -class MYSQL_LOG -{ -public: - MYSQL_LOG(); - virtual ~MYSQL_LOG() {} - void init_pthread_objects(); - void cleanup(); - bool open( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key log_file_key, -#endif - const char *log_name, - enum_log_type log_type, - const char *new_name, ulong next_file_number, - enum cache_type io_cache_type_arg); - void close(uint exiting); - inline bool is_open() { return log_state != LOG_CLOSED; } - const char *generate_name(const char *log_name, - const char *suffix, - bool strip_ext, char *buff); - virtual int generate_new_name(char *new_name, const char *log_name, - ulong next_log_number); - protected: - /* LOCK_log is inited by init_pthread_objects() */ - mysql_mutex_t LOCK_log; - char *name; - char log_file_name[FN_REFLEN]; - char time_buff[20], db[NAME_LEN + 1]; - bool write_error, inited; - IO_CACHE log_file; - enum_log_type log_type; - volatile enum_log_state log_state; - enum cache_type io_cache_type; - friend class Log_event; -#ifdef HAVE_PSI_INTERFACE - /** Instrumentation key to use for file io in @c log_file */ - PSI_file_key m_log_file_key; -#endif - - bool init_and_set_log_file_name(const char *log_name, - const char *new_name, - ulong next_log_number, - enum_log_type log_type_arg, - enum cache_type io_cache_type_arg); -}; - -/* Tell the io thread if we can delay the master info sync. */ -#define SEMI_SYNC_SLAVE_DELAY_SYNC 1 -/* Tell the io thread if the current event needs a ack. */ -#define SEMI_SYNC_NEED_ACK 2 - -class MYSQL_QUERY_LOG: public MYSQL_LOG -{ -public: - MYSQL_QUERY_LOG() : last_time(0) {} - void reopen_file(); - bool write(time_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id, - const char *command_type, size_t command_type_len, - const char *sql_text, size_t sql_text_len); - bool write(THD *thd, time_t current_time, - const char *user_host, size_t user_host_len, - ulonglong query_utime, ulonglong lock_utime, bool is_command, - const char *sql_text, size_t sql_text_len); - bool open_slow_log(const char *log_name) - { - char buf[FN_REFLEN]; - return open( -#ifdef HAVE_PSI_INTERFACE - key_file_slow_log, -#endif - generate_name(log_name, "-slow.log", 0, buf), - LOG_NORMAL, 0, 0, WRITE_CACHE); - } - bool open_query_log(const char *log_name) - { - char buf[FN_REFLEN]; - return open( -#ifdef HAVE_PSI_INTERFACE - key_file_query_log, -#endif - generate_name(log_name, ".log", 0, buf), - LOG_NORMAL, 0, 0, WRITE_CACHE); - } - -private: - time_t last_time; -}; - -/* - We assign each binlog file an internal ID, used to identify them for unlog(). - The IDs start from 0 and increment for each new binlog created. - - In unlog() we need to know the ID of the binlog file that the corresponding - transaction was written into. We also need a special value for a corner - case where there is no corresponding binlog id (since nothing was logged). - And we need an error flag to mark that unlog() must return failure. - - We use the following macros to pack all of this information into the single - ulong available with log_and_order() / unlog(). - - Note that we cannot use the value 0 for cookie, as that is reserved as error - return value from log_and_order(). - */ -#define BINLOG_COOKIE_ERROR_RETURN 0 -#define BINLOG_COOKIE_DUMMY_ID 1 -#define BINLOG_COOKIE_BASE 2 -#define BINLOG_COOKIE_DUMMY(error_flag) \ - ( (BINLOG_COOKIE_DUMMY_ID<<1) | ((error_flag)&1) ) -#define BINLOG_COOKIE_MAKE(id, error_flag) \ - ( (((id)+BINLOG_COOKIE_BASE)<<1) | ((error_flag)&1) ) -#define BINLOG_COOKIE_GET_ERROR_FLAG(c) ((c) & 1) -#define BINLOG_COOKIE_GET_ID(c) ( ((ulong)(c)>>1) - BINLOG_COOKIE_BASE ) -#define BINLOG_COOKIE_IS_DUMMY(c) \ - ( ((ulong)(c)>>1) == BINLOG_COOKIE_DUMMY_ID ) - -class binlog_cache_mngr; -class binlog_cache_data; -struct rpl_gtid; -struct wait_for_commit; - -class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG -{ - /** The instrumentation key to use for @ LOCK_index. */ - PSI_mutex_key m_key_LOCK_index; - /** The instrumentation key to use for @ COND_relay_log_updated */ - PSI_cond_key m_key_relay_log_update; - /** The instrumentation key to use for @ COND_bin_log_updated */ - PSI_cond_key m_key_bin_log_update; - /** The instrumentation key to use for opening the log file. */ - PSI_file_key m_key_file_log, m_key_file_log_cache; - /** The instrumentation key to use for opening the log index file. */ - PSI_file_key m_key_file_log_index, m_key_file_log_index_cache; - - PSI_cond_key m_key_COND_queue_busy; - /** The instrumentation key to use for LOCK_binlog_end_pos. */ - PSI_mutex_key m_key_LOCK_binlog_end_pos; - - struct group_commit_entry - { - struct group_commit_entry *next; - THD *thd; - binlog_cache_mngr *cache_mngr; - bool using_stmt_cache; - bool using_trx_cache; - /* - Extra events (COMMIT/ROLLBACK/XID, and possibly INCIDENT) to be - written during group commit. The incident_event is only valid if - trx_data->has_incident() is true. - */ - Log_event *end_event; - Log_event *incident_event; - /* Set during group commit to record any per-thread error. */ - int error; - int commit_errno; - IO_CACHE *error_cache; - /* This is the `all' parameter for ha_commit_ordered(). */ - bool all; - /* - True if we need to increment xid_count in trx_group_commit_leader() and - decrement in unlog() (this is needed if there is a participating engine - that does not implement the commit_checkpoint_request() handlerton - method). - */ - bool need_unlog; - /* - Fields used to pass the necessary information to the last thread in a - group commit, only used when opt_optimize_thread_scheduling is not set. - */ - bool check_purge; - /* Flag used to optimise around wait_for_prior_commit. */ - bool queued_by_other; - ulong binlog_id; - }; - - /* - When this is set, a RESET MASTER is in progress. - - Then we should not write any binlog checkpoints into the binlog (that - could result in deadlock on LOCK_log, and we will delete all binlog files - anyway). Instead we should signal COND_xid_list whenever a new binlog - checkpoint arrives - when all have arrived, RESET MASTER will complete. - */ - uint reset_master_pending; - ulong mark_xid_done_waiting; - - /* LOCK_log and LOCK_index are inited by init_pthread_objects() */ - mysql_mutex_t LOCK_index; - mysql_mutex_t LOCK_binlog_end_pos; - mysql_mutex_t LOCK_xid_list; - mysql_cond_t COND_xid_list; - mysql_cond_t COND_relay_log_updated, COND_bin_log_updated; - ulonglong bytes_written; - IO_CACHE index_file; - char index_file_name[FN_REFLEN]; - /* - purge_file is a temp file used in purge_logs so that the index file - can be updated before deleting files from disk, yielding better crash - recovery. It is created on demand the first time purge_logs is called - and then reused for subsequent calls. It is cleaned up in cleanup(). - */ - IO_CACHE purge_index_file; - char purge_index_file_name[FN_REFLEN]; - /* - The max size before rotation (usable only if log_type == LOG_BIN: binary - logs and relay logs). - For a binlog, max_size should be max_binlog_size. - max_size is set in init(), and dynamically changed (when one does SET - GLOBAL MAX_BINLOG_SIZE|MAX_RELAY_LOG_SIZE) from sys_vars.cc - */ - ulong max_size; - /* - Number generated by last call of find_uniq_filename(). Corresponds - closely with current_binlog_id - */ - ulong last_used_log_number; - // current file sequence number for load data infile binary logging - uint file_id; - uint open_count; // For replication - int readers_count; - /* Queue of transactions queued up to participate in group commit. */ - group_commit_entry *group_commit_queue; - /* - Condition variable to mark that the group commit queue is busy. - Used when each thread does it's own commit_ordered() (when - binlog_optimize_thread_scheduling=1). - Used with the LOCK_commit_ordered mutex. - */ - my_bool group_commit_queue_busy; - mysql_cond_t COND_queue_busy; - /* Total number of committed transactions. */ - ulonglong num_commits; - /* Number of group commits done. */ - ulonglong num_group_commits; - /* The reason why the group commit was grouped */ - ulonglong group_commit_trigger_count, group_commit_trigger_timeout; - ulonglong group_commit_trigger_lock_wait; - - /* binlog encryption data */ - struct Binlog_crypt_data crypto; - - /* pointer to the sync period variable, for binlog this will be - sync_binlog_period, for relay log this will be - sync_relay_log_period - */ - uint *sync_period_ptr; - uint sync_counter; - bool state_file_deleted; - bool binlog_state_recover_done; - - inline uint get_sync_period() - { - return *sync_period_ptr; - } - - int write_to_file(IO_CACHE *cache); - /* - This is used to start writing to a new log file. The difference from - new_file() is locking. new_file_without_locking() does not acquire - LOCK_log. - */ - int new_file_without_locking(); - int new_file_impl(); - void do_checkpoint_request(ulong binlog_id); - void purge(); - int write_transaction_or_stmt(group_commit_entry *entry, uint64 commit_id); - int queue_for_group_commit(group_commit_entry *entry); - bool write_transaction_to_binlog_events(group_commit_entry *entry); - void trx_group_commit_leader(group_commit_entry *leader); - bool is_xidlist_idle_nolock(); -public: - /* - A list of struct xid_count_per_binlog is used to keep track of how many - XIDs are in prepared, but not committed, state in each binlog. And how - many commit_checkpoint_request()'s are pending. - - When count drops to zero in a binlog after rotation, it means that there - are no more XIDs in prepared state, so that binlog is no longer needed - for XA crash recovery, and we can log a new binlog checkpoint event. - - The list is protected against simultaneous access from multiple - threads by LOCK_xid_list. - */ - struct xid_count_per_binlog : public ilink { - char *binlog_name; - uint binlog_name_len; - ulong binlog_id; - /* Total prepared XIDs and pending checkpoint requests in this binlog. */ - long xid_count; - long notify_count; - /* For linking in requests to the binlog background thread. */ - xid_count_per_binlog *next_in_queue; - xid_count_per_binlog(char *log_file_name, uint log_file_name_len) - :binlog_id(0), xid_count(0), notify_count(0) - { - binlog_name_len= log_file_name_len; - binlog_name= (char *) my_malloc(PSI_INSTRUMENT_ME, binlog_name_len, MYF(MY_ZEROFILL)); - if (binlog_name) - memcpy(binlog_name, log_file_name, binlog_name_len); - } - ~xid_count_per_binlog() - { - my_free(binlog_name); - } - }; - I_List binlog_xid_count_list; - mysql_mutex_t LOCK_binlog_background_thread; - mysql_cond_t COND_binlog_background_thread; - mysql_cond_t COND_binlog_background_thread_end; - - void stop_background_thread(); - - using MYSQL_LOG::generate_name; - using MYSQL_LOG::is_open; - - /* This is relay log */ - bool is_relay_log; - ulong relay_signal_cnt; // update of the counter is checked by heartbeat - enum enum_binlog_checksum_alg checksum_alg_reset; // to contain a new value when binlog is rotated - /* - Holds the last seen in Relay-Log FD's checksum alg value. - The initial value comes from the slave's local FD that heads - the very first Relay-Log file. In the following the value may change - with each received master's FD_m. - Besides to be used in verification events that IO thread receives - (except the 1st fake Rotate, see @c Master_info:: checksum_alg_before_fd), - the value specifies if/how to compute checksum for slave's local events - and the first fake Rotate (R_f^1) coming from the master. - R_f^1 needs logging checksum-compatibly with the RL's heading FD_s. - - Legends for the checksum related comments: - - FD - Format-Description event, - R - Rotate event - R_f - the fake Rotate event - E - an arbirary event - - The underscore indexes for any event - `_s' indicates the event is generated by Slave - `_m' - by Master - - Two special underscore indexes of FD: - FD_q - Format Description event for queuing (relay-logging) - FD_e - Format Description event for executing (relay-logging) - - Upper indexes: - E^n - n:th event is a sequence - - RL - Relay Log - (A) - checksum algorithm descriptor value - FD.(A) - the value of (A) in FD - */ - enum enum_binlog_checksum_alg relay_log_checksum_alg; - /* - These describe the log's format. This is used only for relay logs. - _for_exec is used by the SQL thread, _for_queue by the I/O thread. It's - necessary to have 2 distinct objects, because the I/O thread may be reading - events in a different format from what the SQL thread is reading (consider - the case of a master which has been upgraded from 5.0 to 5.1 without doing - RESET MASTER, or from 4.x to 5.0). - */ - Format_description_log_event *description_event_for_exec, - *description_event_for_queue; - /* - Binlog position of last commit (or non-transactional write) to the binlog. - Access to this is protected by LOCK_commit_ordered. - */ - char last_commit_pos_file[FN_REFLEN]; - my_off_t last_commit_pos_offset; - ulong current_binlog_id; - - MYSQL_BIN_LOG(uint *sync_period); - /* - note that there's no destructor ~MYSQL_BIN_LOG() ! - The reason is that we don't want it to be automatically called - on exit() - but only during the correct shutdown process - */ - -#ifdef HAVE_PSI_INTERFACE - void set_psi_keys(PSI_mutex_key key_LOCK_index, - PSI_cond_key key_relay_log_update, - PSI_cond_key key_bin_log_update, - PSI_file_key key_file_log, - PSI_file_key key_file_log_cache, - PSI_file_key key_file_log_index, - PSI_file_key key_file_log_index_cache, - PSI_cond_key key_COND_queue_busy, - PSI_mutex_key key_LOCK_binlog_end_pos) - { - m_key_LOCK_index= key_LOCK_index; - m_key_relay_log_update= key_relay_log_update; - m_key_bin_log_update= key_bin_log_update; - m_key_file_log= key_file_log; - m_key_file_log_cache= key_file_log_cache; - m_key_file_log_index= key_file_log_index; - m_key_file_log_index_cache= key_file_log_index_cache; - m_key_COND_queue_busy= key_COND_queue_busy; - m_key_LOCK_binlog_end_pos= key_LOCK_binlog_end_pos; - } -#endif - - int open(const char *opt_name); - void close(); - virtual int generate_new_name(char *new_name, const char *log_name, - ulong next_log_number); - int log_and_order(THD *thd, my_xid xid, bool all, - bool need_prepare_ordered, bool need_commit_ordered); - int unlog(ulong cookie, my_xid xid); - int unlog_xa_prepare(THD *thd, bool all); - void commit_checkpoint_notify(void *cookie); - int recover(LOG_INFO *linfo, const char *last_log_name, IO_CACHE *first_log, - Format_description_log_event *fdle, bool do_xa); - int do_binlog_recovery(const char *opt_name, bool do_xa_recovery); -#if !defined(MYSQL_CLIENT) - - int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event, - bool is_transactional); - int remove_pending_rows_event(THD *thd, bool is_transactional); - -#endif /* !defined(MYSQL_CLIENT) */ - void reset_bytes_written() - { - bytes_written = 0; - } - void harvest_bytes_written(ulonglong* counter) - { -#ifndef DBUG_OFF - char buf1[22],buf2[22]; -#endif - DBUG_ENTER("harvest_bytes_written"); - (*counter)+=bytes_written; - DBUG_PRINT("info",("counter: %s bytes_written: %s", llstr(*counter,buf1), - llstr(bytes_written,buf2))); - bytes_written=0; - DBUG_VOID_RETURN; - } - void set_max_size(ulong max_size_arg); - - /* Handle signaling that relay has been updated */ - void signal_relay_log_update() - { - mysql_mutex_assert_owner(&LOCK_log); - DBUG_ASSERT(is_relay_log); - DBUG_ENTER("MYSQL_BIN_LOG::signal_relay_log_update"); - relay_signal_cnt++; - mysql_cond_broadcast(&COND_relay_log_updated); - DBUG_VOID_RETURN; - } - void signal_bin_log_update() - { - mysql_mutex_assert_owner(&LOCK_binlog_end_pos); - DBUG_ASSERT(!is_relay_log); - DBUG_ENTER("MYSQL_BIN_LOG::signal_bin_log_update"); - mysql_cond_broadcast(&COND_bin_log_updated); - DBUG_VOID_RETURN; - } - void update_binlog_end_pos() - { - if (is_relay_log) - signal_relay_log_update(); - else - { - lock_binlog_end_pos(); - binlog_end_pos= my_b_safe_tell(&log_file); - signal_bin_log_update(); - unlock_binlog_end_pos(); - } - } - void update_binlog_end_pos(my_off_t pos) - { - mysql_mutex_assert_owner(&LOCK_log); - mysql_mutex_assert_not_owner(&LOCK_binlog_end_pos); - lock_binlog_end_pos(); - /* - Note: it would make more sense to assert(pos > binlog_end_pos) - but there are two places triggered by mtr that has pos == binlog_end_pos - i didn't investigate but accepted as it should do no harm - */ - DBUG_ASSERT(pos >= binlog_end_pos); - binlog_end_pos= pos; - signal_bin_log_update(); - unlock_binlog_end_pos(); - } - - void wait_for_sufficient_commits(); - void binlog_trigger_immediate_group_commit(); - void wait_for_update_relay_log(THD* thd); - void init(ulong max_size); - void init_pthread_objects(); - void cleanup(); - bool open(const char *log_name, - const char *new_name, - ulong next_log_number, - enum cache_type io_cache_type_arg, - ulong max_size, - bool null_created, - bool need_mutex); - bool open_index_file(const char *index_file_name_arg, - const char *log_name, bool need_mutex); - /* Use this to start writing a new log file */ - int new_file(); - - bool write(Log_event* event_info, - my_bool *with_annotate= 0); // binary log write - bool write_transaction_to_binlog(THD *thd, binlog_cache_mngr *cache_mngr, - Log_event *end_ev, bool all, - bool using_stmt_cache, bool using_trx_cache); - - bool write_incident_already_locked(THD *thd); - bool write_incident(THD *thd); - void write_binlog_checkpoint_event_already_locked(const char *name, uint len); - int write_cache(THD *thd, IO_CACHE *cache); - void set_write_error(THD *thd, bool is_transactional); - bool check_write_error(THD *thd); - - void start_union_events(THD *thd, query_id_t query_id_param); - void stop_union_events(THD *thd); - bool is_query_in_union(THD *thd, query_id_t query_id_param); - - bool write_event(Log_event *ev, binlog_cache_data *data, IO_CACHE *file); - bool write_event(Log_event *ev) { return write_event(ev, 0, &log_file); } - - bool write_event_buffer(uchar* buf,uint len); - bool append(Log_event* ev); - bool append_no_lock(Log_event* ev); - - void mark_xids_active(ulong cookie, uint xid_count); - void mark_xid_done(ulong cookie, bool write_checkpoint); - void make_log_name(char* buf, const char* log_ident); - bool is_active(const char* log_file_name); - bool can_purge_log(const char *log_file_name); - int update_log_index(LOG_INFO* linfo, bool need_update_threads); - int rotate(bool force_rotate, bool* check_purge); - void checkpoint_and_purge(ulong binlog_id); - int rotate_and_purge(bool force_rotate, DYNAMIC_ARRAY* drop_gtid_domain= NULL); - /** - Flush binlog cache and synchronize to disk. - - This function flushes events in binlog cache to binary log file, - it will do synchronizing according to the setting of system - variable 'sync_binlog'. If file is synchronized, @c synced will - be set to 1, otherwise 0. - - @param[out] synced if not NULL, set to 1 if file is synchronized, otherwise 0 - - @retval 0 Success - @retval other Failure - */ - bool flush_and_sync(bool *synced); - int purge_logs(const char *to_log, bool included, - bool need_mutex, bool need_update_threads, - ulonglong *decrease_log_space); - int purge_logs_before_date(time_t purge_time); - int purge_first_log(Relay_log_info* rli, bool included); - int set_purge_index_file_name(const char *base_file_name); - int open_purge_index_file(bool destroy); - bool is_inited_purge_index_file(); - int close_purge_index_file(); - int clean_purge_index_file(); - int sync_purge_index_file(); - int register_purge_index_entry(const char* entry); - int register_create_index_entry(const char* entry); - int purge_index_entry(THD *thd, ulonglong *decrease_log_space, - bool need_mutex); - bool reset_logs(THD* thd, bool create_new_log, - rpl_gtid *init_state, uint32 init_state_len, - ulong next_log_number); - void wait_for_last_checkpoint_event(); - void close(uint exiting); - void clear_inuse_flag_when_closing(File file); - - // iterating through the log index file - int find_log_pos(LOG_INFO* linfo, const char* log_name, - bool need_mutex); - int find_next_log(LOG_INFO* linfo, bool need_mutex); - int get_current_log(LOG_INFO* linfo); - int raw_get_current_log(LOG_INFO* linfo); - uint next_file_id(); - inline char* get_index_fname() { return index_file_name;} - inline char* get_log_fname() { return log_file_name; } - inline char* get_name() { return name; } - inline mysql_mutex_t* get_log_lock() { return &LOCK_log; } - inline mysql_cond_t* get_bin_log_cond() { return &COND_bin_log_updated; } - inline IO_CACHE* get_log_file() { return &log_file; } - - inline void lock_index() { mysql_mutex_lock(&LOCK_index);} - inline void unlock_index() { mysql_mutex_unlock(&LOCK_index);} - inline IO_CACHE *get_index_file() { return &index_file;} - inline uint32 get_open_count() { return open_count; } - void set_status_variables(THD *thd); - bool is_xidlist_idle(); - bool write_gtid_event(THD *thd, bool standalone, bool is_transactional, - uint64 commit_id); - int read_state_from_file(); - int write_state_to_file(); - int get_most_recent_gtid_list(rpl_gtid **list, uint32 *size); - bool append_state_pos(String *str); - bool append_state(String *str); - bool is_empty_state(); - bool find_in_binlog_state(uint32 domain_id, uint32 server_id, - rpl_gtid *out_gtid); - bool lookup_domain_in_binlog_state(uint32 domain_id, rpl_gtid *out_gtid); - int bump_seq_no_counter_if_needed(uint32 domain_id, uint64 seq_no); - bool check_strict_gtid_sequence(uint32 domain_id, uint32 server_id, - uint64 seq_no); - - /** - * used when opening new file, and binlog_end_pos moves backwards - */ - void reset_binlog_end_pos(const char file_name[FN_REFLEN], my_off_t pos) - { - mysql_mutex_assert_owner(&LOCK_log); - mysql_mutex_assert_not_owner(&LOCK_binlog_end_pos); - lock_binlog_end_pos(); - binlog_end_pos= pos; - strcpy(binlog_end_pos_file, file_name); - signal_bin_log_update(); - unlock_binlog_end_pos(); - } - - /* - It is called by the threads(e.g. dump thread) which want to read - log without LOCK_log protection. - */ - my_off_t get_binlog_end_pos(char file_name_buf[FN_REFLEN]) const - { - mysql_mutex_assert_not_owner(&LOCK_log); - mysql_mutex_assert_owner(&LOCK_binlog_end_pos); - strcpy(file_name_buf, binlog_end_pos_file); - return binlog_end_pos; - } - void lock_binlog_end_pos() { mysql_mutex_lock(&LOCK_binlog_end_pos); } - void unlock_binlog_end_pos() { mysql_mutex_unlock(&LOCK_binlog_end_pos); } - mysql_mutex_t* get_binlog_end_pos_lock() { return &LOCK_binlog_end_pos; } - - int wait_for_update_binlog_end_pos(THD* thd, struct timespec * timeout); - - /* - Binlog position of end of the binlog. - Access to this is protected by LOCK_binlog_end_pos - - The difference between this and last_commit_pos_{file,offset} is that - the commit position is updated later. If semi-sync wait point is set - to WAIT_AFTER_SYNC, the commit pos is update after semi-sync-ack has - been received and the end point is updated after the write as it's needed - for the dump threads to be able to semi-sync the event. - */ - my_off_t binlog_end_pos; - char binlog_end_pos_file[FN_REFLEN]; -}; - -class Log_event_handler -{ -public: - Log_event_handler() {} - virtual bool init()= 0; - virtual void cleanup()= 0; - - virtual bool log_slow(THD *thd, my_hrtime_t current_time, - const char *user_host, size_t user_host_len, ulonglong query_utime, - ulonglong lock_utime, bool is_command, - const char *sql_text, size_t sql_text_len)= 0; - virtual bool log_error(enum loglevel level, const char *format, - va_list args)= 0; - virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id, - const char *command_type, size_t command_type_len, - const char *sql_text, size_t sql_text_len, - CHARSET_INFO *client_cs)= 0; - virtual ~Log_event_handler() {} -}; - - -int check_if_log_table(const TABLE_LIST *table, bool check_if_opened, - const char *errmsg); - -class Log_to_csv_event_handler: public Log_event_handler -{ - friend class LOGGER; - -public: - Log_to_csv_event_handler(); - ~Log_to_csv_event_handler(); - virtual bool init(); - virtual void cleanup(); - - virtual bool log_slow(THD *thd, my_hrtime_t current_time, - const char *user_host, size_t user_host_len, ulonglong query_utime, - ulonglong lock_utime, bool is_command, - const char *sql_text, size_t sql_text_len); - virtual bool log_error(enum loglevel level, const char *format, - va_list args); - virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id, - const char *command_type, size_t command_type_len, - const char *sql_text, size_t sql_text_len, - CHARSET_INFO *client_cs); - - int activate_log(THD *thd, uint log_type); -}; - - -/* type of the log table */ -#define QUERY_LOG_SLOW 1 -#define QUERY_LOG_GENERAL 2 - -class Log_to_file_event_handler: public Log_event_handler -{ - MYSQL_QUERY_LOG mysql_log; - MYSQL_QUERY_LOG mysql_slow_log; - bool is_initialized; -public: - Log_to_file_event_handler(): is_initialized(FALSE) - {} - virtual bool init(); - virtual void cleanup(); - - virtual bool log_slow(THD *thd, my_hrtime_t current_time, - const char *user_host, size_t user_host_len, ulonglong query_utime, - ulonglong lock_utime, bool is_command, - const char *sql_text, size_t sql_text_len); - virtual bool log_error(enum loglevel level, const char *format, - va_list args); - virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id, - const char *command_type, size_t command_type_len, - const char *sql_text, size_t sql_text_len, - CHARSET_INFO *client_cs); - void flush(); - void init_pthread_objects(); - MYSQL_QUERY_LOG *get_mysql_slow_log() { return &mysql_slow_log; } - MYSQL_QUERY_LOG *get_mysql_log() { return &mysql_log; } -}; - - -/* Class which manages slow, general and error log event handlers */ -class LOGGER -{ - mysql_rwlock_t LOCK_logger; - /* flag to check whether logger mutex is initialized */ - uint inited; - - /* available log handlers */ - Log_to_csv_event_handler *table_log_handler; - Log_to_file_event_handler *file_log_handler; - - /* NULL-terminated arrays of log handlers */ - Log_event_handler *error_log_handler_list[MAX_LOG_HANDLERS_NUM + 1]; - Log_event_handler *slow_log_handler_list[MAX_LOG_HANDLERS_NUM + 1]; - Log_event_handler *general_log_handler_list[MAX_LOG_HANDLERS_NUM + 1]; - -public: - - bool is_log_tables_initialized; - - LOGGER() : inited(0), table_log_handler(NULL), - file_log_handler(NULL), is_log_tables_initialized(FALSE) - {} - void lock_shared() { mysql_rwlock_rdlock(&LOCK_logger); } - void lock_exclusive() { mysql_rwlock_wrlock(&LOCK_logger); } - void unlock() { mysql_rwlock_unlock(&LOCK_logger); } - bool is_log_table_enabled(uint log_table_type); - bool log_command(THD *thd, enum enum_server_command command); - - /* - We want to initialize all log mutexes as soon as possible, - but we cannot do it in constructor, as safe_mutex relies on - initialization, performed by MY_INIT(). This why this is done in - this function. - */ - void init_base(); - void init_log_tables(); - bool flush_slow_log(); - bool flush_general_log(); - /* Perform basic logger cleanup. this will leave e.g. error log open. */ - void cleanup_base(); - /* Free memory. Nothing could be logged after this function is called */ - void cleanup_end(); - bool error_log_print(enum loglevel level, const char *format, - va_list args); - bool slow_log_print(THD *thd, const char *query, size_t query_length, - ulonglong current_utime); - bool general_log_print(THD *thd,enum enum_server_command command, - const char *format, va_list args); - bool general_log_write(THD *thd, enum enum_server_command command, - const char *query, size_t query_length); - - /* we use this function to setup all enabled log event handlers */ - int set_handlers(ulonglong error_log_printer, - ulonglong slow_log_printer, - ulonglong general_log_printer); - void init_error_log(ulonglong error_log_printer); - void init_slow_log(ulonglong slow_log_printer); - void init_general_log(ulonglong general_log_printer); - void deactivate_log_handler(THD* thd, uint log_type); - bool activate_log_handler(THD* thd, uint log_type); - MYSQL_QUERY_LOG *get_slow_log_file_handler() const - { - if (file_log_handler) - return file_log_handler->get_mysql_slow_log(); - return NULL; - } - MYSQL_QUERY_LOG *get_log_file_handler() const - { - if (file_log_handler) - return file_log_handler->get_mysql_log(); - return NULL; - } -}; - -enum enum_binlog_format { - BINLOG_FORMAT_MIXED= 0, ///< statement if safe, otherwise row - autodetected - BINLOG_FORMAT_STMT= 1, ///< statement-based - BINLOG_FORMAT_ROW= 2, ///< row-based - BINLOG_FORMAT_UNSPEC=3 ///< thd_binlog_format() returns it when binlog is closed -}; - -int query_error_code(THD *thd, bool not_killed); -uint purge_log_get_error_code(int res); - -int vprint_msg_to_log(enum loglevel level, const char *format, va_list args); -void sql_print_error(const char *format, ...); -void sql_print_warning(const char *format, ...); -void sql_print_information(const char *format, ...); -void sql_print_information_v(const char *format, va_list ap); -typedef void (*sql_print_message_func)(const char *format, ...); -extern sql_print_message_func sql_print_message_handlers[]; - -int error_log_print(enum loglevel level, const char *format, - va_list args); - -bool slow_log_print(THD *thd, const char *query, uint query_length, - ulonglong current_utime); - -bool general_log_print(THD *thd, enum enum_server_command command, - const char *format,...); - -bool general_log_write(THD *thd, enum enum_server_command command, - const char *query, size_t query_length); - -void binlog_report_wait_for(THD *thd, THD *other_thd); -void sql_perror(const char *message); -bool flush_error_log(); - -File open_binlog(IO_CACHE *log, const char *log_file_name, - const char **errmsg); - -void make_default_log_name(char **out, const char* log_ext, bool once); -void binlog_reset_cache(THD *thd); -bool write_annotated_row(THD *thd); - -extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log; -extern handlerton *binlog_hton; -extern LOGGER logger; - -extern const char *log_bin_index; -extern const char *log_bin_basename; - -/** - Turns a relative log binary log path into a full path, based on the - opt_bin_logname or opt_relay_logname. - - @param from The log name we want to make into an absolute path. - @param to The buffer where to put the results of the - normalization. - @param is_relay_log Switch that makes is used inside to choose which - option (opt_bin_logname or opt_relay_logname) to - use when calculating the base path. - - @returns true if a problem occurs, false otherwise. - */ - -inline bool normalize_binlog_name(char *to, const char *from, bool is_relay_log) -{ - DBUG_ENTER("normalize_binlog_name"); - bool error= false; - char buff[FN_REFLEN]; - char *ptr= (char*) from; - char *opt_name= is_relay_log ? opt_relay_logname : opt_bin_logname; - - DBUG_ASSERT(from); - - /* opt_name is not null and not empty and from is a relative path */ - if (opt_name && opt_name[0] && from && !test_if_hard_path(from)) - { - // take the path from opt_name - // take the filename from from - char log_dirpart[FN_REFLEN], log_dirname[FN_REFLEN]; - size_t log_dirpart_len, log_dirname_len; - dirname_part(log_dirpart, opt_name, &log_dirpart_len); - dirname_part(log_dirname, from, &log_dirname_len); - - /* log may be empty => relay-log or log-bin did not - hold paths, just filename pattern */ - if (log_dirpart_len > 0) - { - /* create the new path name */ - if(fn_format(buff, from+log_dirname_len, log_dirpart, "", - MYF(MY_UNPACK_FILENAME | MY_SAFE_PATH)) == NULL) - { - error= true; - goto end; - } - - ptr= buff; - } - } - - DBUG_ASSERT(ptr); - - if (ptr) - strmake(to, ptr, strlen(ptr)); - -end: - DBUG_RETURN(error); -} - -static inline TC_LOG *get_tc_log_implementation() -{ - if (total_ha_2pc <= 1) - return &tc_log_dummy; - if (opt_bin_log) - return &mysql_bin_log; - return &tc_log_mmap; -} - -#ifdef WITH_WSREP -IO_CACHE* wsrep_get_trans_cache(THD *); -void wsrep_thd_binlog_trx_reset(THD * thd); -void wsrep_thd_binlog_stmt_rollback(THD * thd); -#endif /* WITH_WSREP */ - -class Gtid_list_log_event; -const char * -get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list); - -#endif /* LOG_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/log_event.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/log_event.h deleted file mode 100644 index 4e19323..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/log_event.h +++ /dev/null @@ -1,5781 +0,0 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @addtogroup Replication - @{ - - @file - - @brief Binary log event definitions. This includes generic code - common to all types of log events, as well as specific code for each - type of log event. -*/ - - -#ifndef _log_event_h -#define _log_event_h - -#if defined(USE_PRAGMA_INTERFACE) && defined(MYSQL_SERVER) -#pragma interface /* gcc class implementation */ -#endif - -#include -#include "rpl_constants.h" -#include -#include -#include -#include -#include - -#ifdef MYSQL_CLIENT -#include "sql_const.h" -#include "rpl_utility.h" -#include "hash.h" -#include "rpl_tblmap.h" -#include "sql_string.h" -#endif - -#ifdef MYSQL_SERVER -#include "rpl_record.h" -#include "rpl_reporting.h" -#include "sql_class.h" /* THD */ -#endif - -#include "rpl_gtid.h" - -/* Forward declarations */ -#ifndef MYSQL_CLIENT -class String; -#endif - -#define PREFIX_SQL_LOAD "SQL_LOAD-" -#define LONG_FIND_ROW_THRESHOLD 60 /* seconds */ - -/** - Either assert or return an error. - - In debug build, the condition will be checked, but in non-debug - builds, the error code given will be returned instead. - - @param COND Condition to check - @param ERRNO Error number to return in non-debug builds -*/ -#ifdef DBUG_OFF -#define ASSERT_OR_RETURN_ERROR(COND, ERRNO) \ - do { if (!(COND)) return ERRNO; } while (0) -#else -#define ASSERT_OR_RETURN_ERROR(COND, ERRNO) \ - DBUG_ASSERT(COND) -#endif - -#define LOG_READ_EOF -1 -#define LOG_READ_BOGUS -2 -#define LOG_READ_IO -3 -#define LOG_READ_MEM -5 -#define LOG_READ_TRUNC -6 -#define LOG_READ_TOO_LARGE -7 -#define LOG_READ_CHECKSUM_FAILURE -8 -#define LOG_READ_DECRYPT -9 - -#define LOG_EVENT_OFFSET 4 - -/* - 3 is MySQL 4.x; 4 is MySQL 5.0.0. - Compared to version 3, version 4 has: - - a different Start_log_event, which includes info about the binary log - (sizes of headers); this info is included for better compatibility if the - master's MySQL version is different from the slave's. - - all events have a unique ID (the triplet (server_id, timestamp at server - start, other) to be sure an event is not executed more than once in a - multimaster setup, example: - M1 - / \ - v v - M2 M3 - \ / - v v - S - if a query is run on M1, it will arrive twice on S, so we need that S - remembers the last unique ID it has processed, to compare and know if the - event should be skipped or not. Example of ID: we already have the server id - (4 bytes), plus: - timestamp_when_the_master_started (4 bytes), a counter (a sequence number - which increments every time we write an event to the binlog) (3 bytes). - Q: how do we handle when the counter is overflowed and restarts from 0 ? - - - Query and Load (Create or Execute) events may have a more precise - timestamp (with microseconds), number of matched/affected/warnings rows - and fields of session variables: SQL_MODE, - FOREIGN_KEY_CHECKS, UNIQUE_CHECKS, SQL_AUTO_IS_NULL, the collations and - charsets, the PASSWORD() version (old/new/...). -*/ -#define BINLOG_VERSION 4 - -/* - We could have used SERVER_VERSION_LENGTH, but this introduces an - obscure dependency - if somebody decided to change SERVER_VERSION_LENGTH - this would break the replication protocol -*/ -#define ST_SERVER_VER_LEN 50 - -/* - These are flags and structs to handle all the LOAD DATA INFILE options (LINES - TERMINATED etc). -*/ - -/* - These are flags and structs to handle all the LOAD DATA INFILE options (LINES - TERMINATED etc). - DUMPFILE_FLAG is probably useless (DUMPFILE is a clause of SELECT, not of LOAD - DATA). -*/ -#define DUMPFILE_FLAG 0x1 -#define OPT_ENCLOSED_FLAG 0x2 -#define REPLACE_FLAG 0x4 -#define IGNORE_FLAG 0x8 - -#define FIELD_TERM_EMPTY 0x1 -#define ENCLOSED_EMPTY 0x2 -#define LINE_TERM_EMPTY 0x4 -#define LINE_START_EMPTY 0x8 -#define ESCAPED_EMPTY 0x10 - -#define NUM_LOAD_DELIM_STRS 5 - -/***************************************************************************** - - MySQL Binary Log - - This log consists of events. Each event has a fixed-length header, - possibly followed by a variable length data body. - - The data body consists of an optional fixed length segment (post-header) - and an optional variable length segment. - - See the #defines below for the format specifics. - - The events which really update data are Query_log_event, - Execute_load_query_log_event and old Load_log_event and - Execute_load_log_event events (Execute_load_query is used together with - Begin_load_query and Append_block events to replicate LOAD DATA INFILE. - Create_file/Append_block/Execute_load (which includes Load_log_event) - were used to replicate LOAD DATA before the 5.0.3). - - ****************************************************************************/ - -#define LOG_EVENT_HEADER_LEN 19 /* the fixed header length */ -#define OLD_HEADER_LEN 13 /* the fixed header length in 3.23 */ -/* - Fixed header length, where 4.x and 5.0 agree. That is, 5.0 may have a longer - header (it will for sure when we have the unique event's ID), but at least - the first 19 bytes are the same in 4.x and 5.0. So when we have the unique - event's ID, LOG_EVENT_HEADER_LEN will be something like 26, but - LOG_EVENT_MINIMAL_HEADER_LEN will remain 19. -*/ -#define LOG_EVENT_MINIMAL_HEADER_LEN 19 - -/* event-specific post-header sizes */ -// where 3.23, 4.x and 5.0 agree -#define QUERY_HEADER_MINIMAL_LEN (4 + 4 + 1 + 2) -// where 5.0 differs: 2 for len of N-bytes vars. -#define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 2) -#define STOP_HEADER_LEN 0 -#define LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4) -#define SLAVE_HEADER_LEN 0 -#define START_V3_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4) -#define ROTATE_HEADER_LEN 8 // this is FROZEN (the Rotate post-header is frozen) -#define INTVAR_HEADER_LEN 0 -#define CREATE_FILE_HEADER_LEN 4 -#define APPEND_BLOCK_HEADER_LEN 4 -#define EXEC_LOAD_HEADER_LEN 4 -#define DELETE_FILE_HEADER_LEN 4 -#define NEW_LOAD_HEADER_LEN LOAD_HEADER_LEN -#define RAND_HEADER_LEN 0 -#define USER_VAR_HEADER_LEN 0 -#define FORMAT_DESCRIPTION_HEADER_LEN (START_V3_HEADER_LEN+1+LOG_EVENT_TYPES) -#define XID_HEADER_LEN 0 -#define BEGIN_LOAD_QUERY_HEADER_LEN APPEND_BLOCK_HEADER_LEN -#define ROWS_HEADER_LEN_V1 8 -#define TABLE_MAP_HEADER_LEN 8 -#define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1) -#define EXECUTE_LOAD_QUERY_HEADER_LEN (QUERY_HEADER_LEN + EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN) -#define INCIDENT_HEADER_LEN 2 -#define HEARTBEAT_HEADER_LEN 0 -#define IGNORABLE_HEADER_LEN 0 -#define ROWS_HEADER_LEN_V2 10 -#define ANNOTATE_ROWS_HEADER_LEN 0 -#define BINLOG_CHECKPOINT_HEADER_LEN 4 -#define GTID_HEADER_LEN 19 -#define GTID_LIST_HEADER_LEN 4 -#define START_ENCRYPTION_HEADER_LEN 0 -#define XA_PREPARE_HEADER_LEN 0 - -/* - Max number of possible extra bytes in a replication event compared to a - packet (i.e. a query) sent from client to master; - First, an auxiliary log_event status vars estimation: -*/ -#define MAX_SIZE_LOG_EVENT_STATUS (1 + 4 /* type, flags2 */ + \ - 1 + 8 /* type, sql_mode */ + \ - 1 + 1 + 255 /* type, length, catalog */ + \ - 1 + 4 /* type, auto_increment */ + \ - 1 + 6 /* type, charset */ + \ - 1 + 1 + 255 /* type, length, time_zone */ + \ - 1 + 2 /* type, lc_time_names_number */ + \ - 1 + 2 /* type, charset_database_number */ + \ - 1 + 8 /* type, table_map_for_update */ + \ - 1 + 4 /* type, master_data_written */ + \ - 1 + 3 /* type, sec_part of NOW() */ + \ - 1 + 16 + 1 + 60/* type, user_len, user, host_len, host */) -#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \ - LOG_EVENT_HEADER_LEN + /* write_header */ \ - QUERY_HEADER_LEN + /* write_data */ \ - EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \ - MAX_SIZE_LOG_EVENT_STATUS + /* status */ \ - NAME_LEN + 1) - -/* - The new option is added to handle large packets that are sent from the master - to the slave. It is used to increase the thd(max_allowed) for both the - DUMP thread on the master and the SQL/IO thread on the slave. -*/ -#define MAX_MAX_ALLOWED_PACKET (1024*1024*1024) - -/* - Event header offsets; - these point to places inside the fixed header. -*/ - -#define EVENT_TYPE_OFFSET 4 -#define SERVER_ID_OFFSET 5 -#define EVENT_LEN_OFFSET 9 -#define LOG_POS_OFFSET 13 -#define FLAGS_OFFSET 17 - -/* start event post-header (for v3 and v4) */ - -#define ST_BINLOG_VER_OFFSET 0 -#define ST_SERVER_VER_OFFSET 2 -#define ST_CREATED_OFFSET (ST_SERVER_VER_OFFSET + ST_SERVER_VER_LEN) -#define ST_COMMON_HEADER_LEN_OFFSET (ST_CREATED_OFFSET + 4) - -/* slave event post-header (this event is never written) */ - -#define SL_MASTER_PORT_OFFSET 8 -#define SL_MASTER_POS_OFFSET 0 -#define SL_MASTER_HOST_OFFSET 10 - -/* query event post-header */ - -#define Q_THREAD_ID_OFFSET 0 -#define Q_EXEC_TIME_OFFSET 4 -#define Q_DB_LEN_OFFSET 8 -#define Q_ERR_CODE_OFFSET 9 -#define Q_STATUS_VARS_LEN_OFFSET 11 -#define Q_DATA_OFFSET QUERY_HEADER_LEN -/* these are codes, not offsets; not more than 256 values (1 byte). */ -#define Q_FLAGS2_CODE 0 -#define Q_SQL_MODE_CODE 1 -/* - Q_CATALOG_CODE is catalog with end zero stored; it is used only by MySQL - 5.0.x where 0<=x<=3. We have to keep it to be able to replicate these - old masters. -*/ -#define Q_CATALOG_CODE 2 -#define Q_AUTO_INCREMENT 3 -#define Q_CHARSET_CODE 4 -#define Q_TIME_ZONE_CODE 5 -/* - Q_CATALOG_NZ_CODE is catalog withOUT end zero stored; it is used by MySQL - 5.0.x where x>=4. Saves one byte in every Query_log_event in binlog, - compared to Q_CATALOG_CODE. The reason we didn't simply re-use - Q_CATALOG_CODE is that then a 5.0.3 slave of this 5.0.x (x>=4) master would - crash (segfault etc) because it would expect a 0 when there is none. -*/ -#define Q_CATALOG_NZ_CODE 6 - -#define Q_LC_TIME_NAMES_CODE 7 - -#define Q_CHARSET_DATABASE_CODE 8 - -#define Q_TABLE_MAP_FOR_UPDATE_CODE 9 - -#define Q_MASTER_DATA_WRITTEN_CODE 10 - -#define Q_INVOKER 11 - -#define Q_HRNOW 128 - -/* Intvar event post-header */ - -/* Intvar event data */ -#define I_TYPE_OFFSET 0 -#define I_VAL_OFFSET 1 - -/* Rand event data */ -#define RAND_SEED1_OFFSET 0 -#define RAND_SEED2_OFFSET 8 - -/* User_var event data */ -#define UV_VAL_LEN_SIZE 4 -#define UV_VAL_IS_NULL 1 -#define UV_VAL_TYPE_SIZE 1 -#define UV_NAME_LEN_SIZE 4 -#define UV_CHARSET_NUMBER_SIZE 4 - -/* Load event post-header */ -#define L_THREAD_ID_OFFSET 0 -#define L_EXEC_TIME_OFFSET 4 -#define L_SKIP_LINES_OFFSET 8 -#define L_TBL_LEN_OFFSET 12 -#define L_DB_LEN_OFFSET 13 -#define L_NUM_FIELDS_OFFSET 14 -#define L_SQL_EX_OFFSET 18 -#define L_DATA_OFFSET LOAD_HEADER_LEN - -/* Rotate event post-header */ -#define R_POS_OFFSET 0 -#define R_IDENT_OFFSET 8 - -/* CF to DF handle LOAD DATA INFILE */ - -/* CF = "Create File" */ -#define CF_FILE_ID_OFFSET 0 -#define CF_DATA_OFFSET CREATE_FILE_HEADER_LEN - -/* AB = "Append Block" */ -#define AB_FILE_ID_OFFSET 0 -#define AB_DATA_OFFSET APPEND_BLOCK_HEADER_LEN - -/* EL = "Execute Load" */ -#define EL_FILE_ID_OFFSET 0 - -/* DF = "Delete File" */ -#define DF_FILE_ID_OFFSET 0 - -/* TM = "Table Map" */ -#define TM_MAPID_OFFSET 0 -#define TM_FLAGS_OFFSET 6 - -/* RW = "RoWs" */ -#define RW_MAPID_OFFSET 0 -#define RW_FLAGS_OFFSET 6 -#define RW_VHLEN_OFFSET 8 -#define RW_V_TAG_LEN 1 -#define RW_V_EXTRAINFO_TAG 0 - -/* ELQ = "Execute Load Query" */ -#define ELQ_FILE_ID_OFFSET QUERY_HEADER_LEN -#define ELQ_FN_POS_START_OFFSET ELQ_FILE_ID_OFFSET + 4 -#define ELQ_FN_POS_END_OFFSET ELQ_FILE_ID_OFFSET + 8 -#define ELQ_DUP_HANDLING_OFFSET ELQ_FILE_ID_OFFSET + 12 - -/* 4 bytes which all binlogs should begin with */ -#define BINLOG_MAGIC (const uchar*) "\xfe\x62\x69\x6e" - -/* - The 2 flags below were useless : - - the first one was never set - - the second one was set in all Rotate events on the master, but not used for - anything useful. - So they are now removed and their place may later be reused for other - flags. Then one must remember that Rotate events in 4.x have - LOG_EVENT_FORCED_ROTATE_F set, so one should not rely on the value of the - replacing flag when reading a Rotate event. - I keep the defines here just to remember what they were. -*/ -#ifdef TO_BE_REMOVED -#define LOG_EVENT_TIME_F 0x1 -#define LOG_EVENT_FORCED_ROTATE_F 0x2 -#endif - -/* - This flag only makes sense for Format_description_log_event. It is set - when the event is written, and *reset* when a binlog file is - closed (yes, it's the only case when MySQL modifies already written - part of binlog). Thus it is a reliable indicator that binlog was - closed correctly. (Stop_log_event is not enough, there's always a - small chance that mysqld crashes in the middle of insert and end of - the binlog would look like a Stop_log_event). - - This flag is used to detect a restart after a crash, and to provide - "unbreakable" binlog. The problem is that on a crash storage engines - rollback automatically, while binlog does not. To solve this we use this - flag and automatically append ROLLBACK to every non-closed binlog (append - virtually, on reading, file itself is not changed). If this flag is found, - mysqlbinlog simply prints "ROLLBACK" Replication master does not abort on - binlog corruption, but takes it as EOF, and replication slave forces a - rollback in this case. - - Note, that old binlogs does not have this flag set, so we get a - a backward-compatible behaviour. -*/ - -#define LOG_EVENT_BINLOG_IN_USE_F 0x1 - -/** - @def LOG_EVENT_THREAD_SPECIFIC_F - - If the query depends on the thread (for example: TEMPORARY TABLE). - Currently this is used by mysqlbinlog to know it must print - SET @@PSEUDO_THREAD_ID=xx; before the query (it would not hurt to print it - for every query but this would be slow). -*/ -#define LOG_EVENT_THREAD_SPECIFIC_F 0x4 - -/** - @def LOG_EVENT_SUPPRESS_USE_F - - Suppress the generation of 'USE' statements before the actual - statement. This flag should be set for any events that does not need - the current database set to function correctly. Most notable cases - are 'CREATE DATABASE' and 'DROP DATABASE'. - - This flags should only be used in exceptional circumstances, since - it introduce a significant change in behaviour regarding the - replication logic together with the flags --binlog-do-db and - --replicated-do-db. - */ -#define LOG_EVENT_SUPPRESS_USE_F 0x8 - -/* - Note: this is a place holder for the flag - LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F (0x10), which is not used any - more, please do not reused this value for other flags. - */ - -/** - @def LOG_EVENT_ARTIFICIAL_F - - Artificial events are created arbitrarily and not written to binary - log - - These events should not update the master log position when slave - SQL thread executes them. -*/ -#define LOG_EVENT_ARTIFICIAL_F 0x20 - -/** - @def LOG_EVENT_RELAY_LOG_F - - Events with this flag set are created by slave IO thread and written - to relay log -*/ -#define LOG_EVENT_RELAY_LOG_F 0x40 - -/** - @def LOG_EVENT_IGNORABLE_F - - For an event, 'e', carrying a type code, that a slave, - 's', does not recognize, 's' will check 'e' for - LOG_EVENT_IGNORABLE_F, and if the flag is set, then 'e' - is ignored. Otherwise, 's' acknowledges that it has - found an unknown event in the relay log. -*/ -#define LOG_EVENT_IGNORABLE_F 0x80 - -/** - @def LOG_EVENT_SKIP_REPLICATION_F - - Flag set by application creating the event (with @@skip_replication); the - slave will skip replication of such events if - --replicate-events-marked-for-skip is not set to REPLICATE. - - This is a MariaDB flag; we allocate it from the end of the available - values to reduce risk of conflict with new MySQL flags. -*/ -#define LOG_EVENT_SKIP_REPLICATION_F 0x8000 - - -/** - @def OPTIONS_WRITTEN_TO_BIN_LOG - - OPTIONS_WRITTEN_TO_BIN_LOG are the bits of thd->options which must - be written to the binlog. OPTIONS_WRITTEN_TO_BIN_LOG could be - written into the Format_description_log_event, so that if later we - don't want to replicate a variable we did replicate, or the - contrary, it's doable. But it should not be too hard to decide once - for all of what we replicate and what we don't, among the fixed 32 - bits of thd->options. - - I (Guilhem) have read through every option's usage, and it looks - like OPTION_AUTO_IS_NULL and OPTION_NO_FOREIGN_KEYS are the only - ones which alter how the query modifies the table. It's good to - replicate OPTION_RELAXED_UNIQUE_CHECKS too because otherwise, the - slave may insert data slower than the master, in InnoDB. - OPTION_BIG_SELECTS is not needed (the slave thread runs with - max_join_size=HA_POS_ERROR) and OPTION_BIG_TABLES is not needed - either, as the manual says (because a too big in-memory temp table - is automatically written to disk). -*/ -#define OPTIONS_WRITTEN_TO_BIN_LOG \ - (OPTION_AUTO_IS_NULL | OPTION_NO_FOREIGN_KEY_CHECKS | \ - OPTION_RELAXED_UNIQUE_CHECKS | OPTION_NOT_AUTOCOMMIT | OPTION_IF_EXISTS) - -/* Shouldn't be defined before */ -#define EXPECTED_OPTIONS \ - ((1ULL << 14) | (1ULL << 26) | (1ULL << 27) | (1ULL << 19) | (1ULL << 28)) - -#if OPTIONS_WRITTEN_TO_BIN_LOG != EXPECTED_OPTIONS -#error OPTIONS_WRITTEN_TO_BIN_LOG must NOT change their values! -#endif -#undef EXPECTED_OPTIONS /* You shouldn't use this one */ - -#define CHECKSUM_CRC32_SIGNATURE_LEN 4 -/** - defined statically while there is just one alg implemented -*/ -#define BINLOG_CHECKSUM_LEN CHECKSUM_CRC32_SIGNATURE_LEN -#define BINLOG_CHECKSUM_ALG_DESC_LEN 1 /* 1 byte checksum alg descriptor */ - -/* - These are capability numbers for MariaDB slave servers. - - Newer MariaDB slaves set this to inform the master about their capabilities. - This allows the master to decide which events it can send to the slave - without breaking replication on old slaves that maybe do not understand - all events from newer masters. - - As new releases are backwards compatible, a given capability implies also - all capabilities with smaller number. - - Older MariaDB slaves and other MySQL slave servers do not set this, so they - are recorded with capability 0. -*/ - -/* MySQL or old MariaDB slave with no announced capability. */ -#define MARIA_SLAVE_CAPABILITY_UNKNOWN 0 -/* MariaDB >= 5.3, which understands ANNOTATE_ROWS_EVENT. */ -#define MARIA_SLAVE_CAPABILITY_ANNOTATE 1 -/* - MariaDB >= 5.5. This version has the capability to tolerate events omitted - from the binlog stream without breaking replication (MySQL slaves fail - because they mis-compute the offsets into the master's binlog). -*/ -#define MARIA_SLAVE_CAPABILITY_TOLERATE_HOLES 2 -/* MariaDB >= 10.0, which knows about binlog_checkpoint_log_event. */ -#define MARIA_SLAVE_CAPABILITY_BINLOG_CHECKPOINT 3 -/* MariaDB >= 10.0.1, which knows about global transaction id events. */ -#define MARIA_SLAVE_CAPABILITY_GTID 4 - -/* Our capability. */ -#define MARIA_SLAVE_CAPABILITY_MINE MARIA_SLAVE_CAPABILITY_GTID - - -/** - @enum Log_event_type - - Enumeration type for the different types of log events. -*/ -enum Log_event_type -{ - /* - Every time you update this enum (when you add a type), you have to - fix Format_description_log_event::Format_description_log_event(). - */ - UNKNOWN_EVENT= 0, - START_EVENT_V3= 1, - QUERY_EVENT= 2, - STOP_EVENT= 3, - ROTATE_EVENT= 4, - INTVAR_EVENT= 5, - LOAD_EVENT= 6, - SLAVE_EVENT= 7, - CREATE_FILE_EVENT= 8, - APPEND_BLOCK_EVENT= 9, - EXEC_LOAD_EVENT= 10, - DELETE_FILE_EVENT= 11, - /* - NEW_LOAD_EVENT is like LOAD_EVENT except that it has a longer - sql_ex, allowing multibyte TERMINATED BY etc; both types share the - same class (Load_log_event) - */ - NEW_LOAD_EVENT= 12, - RAND_EVENT= 13, - USER_VAR_EVENT= 14, - FORMAT_DESCRIPTION_EVENT= 15, - XID_EVENT= 16, - BEGIN_LOAD_QUERY_EVENT= 17, - EXECUTE_LOAD_QUERY_EVENT= 18, - - TABLE_MAP_EVENT = 19, - - /* - These event numbers were used for 5.1.0 to 5.1.15 and are - therefore obsolete. - */ - PRE_GA_WRITE_ROWS_EVENT = 20, - PRE_GA_UPDATE_ROWS_EVENT = 21, - PRE_GA_DELETE_ROWS_EVENT = 22, - - /* - These event numbers are used from 5.1.16 until mysql-5.6.6, - and in MariaDB - */ - WRITE_ROWS_EVENT_V1 = 23, - UPDATE_ROWS_EVENT_V1 = 24, - DELETE_ROWS_EVENT_V1 = 25, - - /* - Something out of the ordinary happened on the master - */ - INCIDENT_EVENT= 26, - - /* - Heartbeat event to be send by master at its idle time - to ensure master's online status to slave - */ - HEARTBEAT_LOG_EVENT= 27, - - /* - In some situations, it is necessary to send over ignorable - data to the slave: data that a slave can handle in case there - is code for handling it, but which can be ignored if it is not - recognized. - - These mysql-5.6 events are not recognized (and ignored) by MariaDB - */ - IGNORABLE_LOG_EVENT= 28, - ROWS_QUERY_LOG_EVENT= 29, - - /* Version 2 of the Row events, generated only by mysql-5.6.6+ */ - WRITE_ROWS_EVENT = 30, - UPDATE_ROWS_EVENT = 31, - DELETE_ROWS_EVENT = 32, - - /* MySQL 5.6 GTID events, ignored by MariaDB */ - GTID_LOG_EVENT= 33, - ANONYMOUS_GTID_LOG_EVENT= 34, - PREVIOUS_GTIDS_LOG_EVENT= 35, - - /* MySQL 5.7 events, ignored by MariaDB */ - TRANSACTION_CONTEXT_EVENT= 36, - VIEW_CHANGE_EVENT= 37, - /* not ignored */ - XA_PREPARE_LOG_EVENT= 38, - - /* - Add new events here - right above this comment! - Existing events (except ENUM_END_EVENT) should never change their numbers - */ - - /* New MySQL/Sun events are to be added right above this comment */ - MYSQL_EVENTS_END, - - MARIA_EVENTS_BEGIN= 160, - /* New Maria event numbers start from here */ - ANNOTATE_ROWS_EVENT= 160, - /* - Binlog checkpoint event. Used for XA crash recovery on the master, not used - in replication. - A binlog checkpoint event specifies a binlog file such that XA crash - recovery can start from that file - and it is guaranteed to find all XIDs - that are prepared in storage engines but not yet committed. - */ - BINLOG_CHECKPOINT_EVENT= 161, - /* - Gtid event. For global transaction ID, used to start a new event group, - instead of the old BEGIN query event, and also to mark stand-alone - events. - */ - GTID_EVENT= 162, - /* - Gtid list event. Logged at the start of every binlog, to record the - current replication state. This consists of the last GTID seen for - each replication domain. - */ - GTID_LIST_EVENT= 163, - - START_ENCRYPTION_EVENT= 164, - - /* - Compressed binlog event. - - Note that the order between WRITE/UPDATE/DELETE events is significant; - this is so that we can convert from the compressed to the uncompressed - event type with (type-WRITE_ROWS_COMPRESSED_EVENT + WRITE_ROWS_EVENT) - and similar for _V1. - */ - QUERY_COMPRESSED_EVENT = 165, - WRITE_ROWS_COMPRESSED_EVENT_V1 = 166, - UPDATE_ROWS_COMPRESSED_EVENT_V1 = 167, - DELETE_ROWS_COMPRESSED_EVENT_V1 = 168, - WRITE_ROWS_COMPRESSED_EVENT = 169, - UPDATE_ROWS_COMPRESSED_EVENT = 170, - DELETE_ROWS_COMPRESSED_EVENT = 171, - - /* Add new MariaDB events here - right above this comment! */ - - ENUM_END_EVENT /* end marker */ -}; - - -/* - Bit flags for what has been writting to cache. Used to - discard logs with table map events but not row events and - nothing else important. This is stored by cache. -*/ - -enum enum_logged_status -{ - LOGGED_TABLE_MAP= 1, - LOGGED_ROW_EVENT= 2, - LOGGED_NO_DATA= 4, - LOGGED_CRITICAL= 8 -}; - -static inline bool LOG_EVENT_IS_QUERY(enum Log_event_type type) -{ - return type == QUERY_EVENT || type == QUERY_COMPRESSED_EVENT; -} - - -static inline bool LOG_EVENT_IS_WRITE_ROW(enum Log_event_type type) -{ - return type == WRITE_ROWS_EVENT || type == WRITE_ROWS_EVENT_V1 || - type == WRITE_ROWS_COMPRESSED_EVENT || - type == WRITE_ROWS_COMPRESSED_EVENT_V1; -} - - -static inline bool LOG_EVENT_IS_UPDATE_ROW(enum Log_event_type type) -{ - return type == UPDATE_ROWS_EVENT || type == UPDATE_ROWS_EVENT_V1 || - type == UPDATE_ROWS_COMPRESSED_EVENT || - type == UPDATE_ROWS_COMPRESSED_EVENT_V1; -} - - -static inline bool LOG_EVENT_IS_DELETE_ROW(enum Log_event_type type) -{ - return type == DELETE_ROWS_EVENT || type == DELETE_ROWS_EVENT_V1 || - type == DELETE_ROWS_COMPRESSED_EVENT || - type == DELETE_ROWS_COMPRESSED_EVENT_V1; -} - - -static inline bool LOG_EVENT_IS_ROW_COMPRESSED(enum Log_event_type type) -{ - return type == WRITE_ROWS_COMPRESSED_EVENT || - type == WRITE_ROWS_COMPRESSED_EVENT_V1 || - type == UPDATE_ROWS_COMPRESSED_EVENT || - type == UPDATE_ROWS_COMPRESSED_EVENT_V1 || - type == DELETE_ROWS_COMPRESSED_EVENT || - type == DELETE_ROWS_COMPRESSED_EVENT_V1; -} - - -static inline bool LOG_EVENT_IS_ROW_V2(enum Log_event_type type) -{ - return (type >= WRITE_ROWS_EVENT && type <= DELETE_ROWS_EVENT) || - (type >= WRITE_ROWS_COMPRESSED_EVENT && type <= DELETE_ROWS_COMPRESSED_EVENT); -} - - -/* - The number of types we handle in Format_description_log_event (UNKNOWN_EVENT - is not to be handled, it does not exist in binlogs, it does not have a - format). -*/ -#define LOG_EVENT_TYPES (ENUM_END_EVENT-1) - -enum Int_event_type -{ - INVALID_INT_EVENT = 0, LAST_INSERT_ID_EVENT = 1, INSERT_ID_EVENT = 2 -}; - -#ifdef MYSQL_SERVER -class String; -class MYSQL_BIN_LOG; -class THD; -#endif - -class Format_description_log_event; -class Relay_log_info; -class binlog_cache_data; - -bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, FILE *file); - -#ifdef MYSQL_CLIENT -enum enum_base64_output_mode { - BASE64_OUTPUT_NEVER= 0, - BASE64_OUTPUT_AUTO= 1, - BASE64_OUTPUT_ALWAYS= 2, - BASE64_OUTPUT_UNSPEC= 3, - BASE64_OUTPUT_DECODE_ROWS= 4, - /* insert new output modes here */ - BASE64_OUTPUT_MODE_COUNT -}; - -bool copy_event_cache_to_string_and_reinit(IO_CACHE *cache, LEX_STRING *to); - -/* - A structure for mysqlbinlog to know how to print events - - This structure is passed to the event's print() methods, - - There are two types of settings stored here: - 1. Last db, flags2, sql_mode etc comes from the last printed event. - They are stored so that only the necessary USE and SET commands - are printed. - 2. Other information on how to print the events, e.g. short_form, - hexdump_from. These are not dependent on the last event. -*/ -typedef struct st_print_event_info -{ - /* - Settings for database, sql_mode etc that comes from the last event - that was printed. We cache these so that we don't have to print - them if they are unchanged. - */ - char db[FN_REFLEN+1]; // TODO: make this a LEX_STRING when thd->db is - char charset[6]; // 3 variables, each of them storable in 2 bytes - char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH]; - char delimiter[16]; - sql_mode_t sql_mode; /* must be same as THD.variables.sql_mode */ - my_thread_id thread_id; - ulonglong row_events; - ulong auto_increment_increment, auto_increment_offset; - uint lc_time_names_number; - uint charset_database_number; - uint verbose; - uint32 flags2; - uint32 server_id; - uint32 domain_id; - uint8 common_header_len; - enum_base64_output_mode base64_output_mode; - my_off_t hexdump_from; - - table_mapping m_table_map; - table_mapping m_table_map_ignored; - bool flags2_inited; - bool sql_mode_inited; - bool charset_inited; - bool thread_id_printed; - bool server_id_printed; - bool domain_id_printed; - bool allow_parallel; - bool allow_parallel_printed; - bool found_row_event; - bool print_row_count; - static const uint max_delimiter_size= 16; - /* Settings on how to print the events */ - bool short_form; - /* - This is set whenever a Format_description_event is printed. - Later, when an event is printed in base64, this flag is tested: if - no Format_description_event has been seen, it is unsafe to print - the base64 event, so an error message is generated. - */ - bool printed_fd_event; - /* - Track when @@skip_replication changes so we need to output a SET - statement for it. - */ - bool skip_replication; - bool print_table_metadata; - - /* - These two caches are used by the row-based replication events to - collect the header information and the main body of the events - making up a statement. - */ - IO_CACHE head_cache; - IO_CACHE body_cache; - IO_CACHE tail_cache; -#ifdef WHEN_FLASHBACK_REVIEW_READY - /* Storing the SQL for reviewing */ - IO_CACHE review_sql_cache; -#endif - FILE *file; - st_print_event_info(); - - ~st_print_event_info() { - close_cached_file(&head_cache); - close_cached_file(&body_cache); - close_cached_file(&tail_cache); -#ifdef WHEN_FLASHBACK_REVIEW_READY - close_cached_file(&review_sql_cache); -#endif - } - bool init_ok() /* tells if construction was successful */ - { return my_b_inited(&head_cache) && my_b_inited(&body_cache) -#ifdef WHEN_FLASHBACK_REVIEW_READY - && my_b_inited(&review_sql_cache) -#endif - ; } - void flush_for_error() - { - if (!copy_event_cache_to_file_and_reinit(&head_cache, file)) - copy_event_cache_to_file_and_reinit(&body_cache, file); - fflush(file); - } -} PRINT_EVENT_INFO; -#endif - -/** - This class encapsulates writing of Log_event objects to IO_CACHE. - Automatically calculates the checksum and encrypts the data, if necessary. -*/ - -class Log_event_writer -{ - /* Log_event_writer is updated when ctx is set */ - int (Log_event_writer::*encrypt_or_write)(const uchar *pos, size_t len); -public: - ulonglong bytes_written; - void *ctx; ///< Encryption context or 0 if no encryption is needed - uint checksum_len; - int write(Log_event *ev); - int write_header(uchar *pos, size_t len); - int write_data(const uchar *pos, size_t len); - int write_footer(); - my_off_t pos() { return my_b_safe_tell(file); } - void add_status(enum_logged_status status); - void set_incident(); - void set_encrypted_writer() - { encrypt_or_write= &Log_event_writer::encrypt_and_write; } - - Log_event_writer(IO_CACHE *file_arg, binlog_cache_data *cache_data_arg, - Binlog_crypt_data *cr= 0) - :encrypt_or_write(&Log_event_writer::write_internal), - bytes_written(0), ctx(0), - file(file_arg), cache_data(cache_data_arg), crypto(cr) { } - -private: - IO_CACHE *file; - binlog_cache_data *cache_data; - /** - Placeholder for event checksum while writing to binlog. - */ - ha_checksum crc; - /** - Encryption data (key, nonce). Only used if ctx != 0. - */ - Binlog_crypt_data *crypto; - /** - Event length to be written into the next encrypted block - */ - uint event_len; - int write_internal(const uchar *pos, size_t len); - int encrypt_and_write(const uchar *pos, size_t len); - int maybe_write_event_len(uchar *pos, size_t len); -}; - -/** - the struct aggregates two parameters that identify an event - uniquely in scope of communication of a particular master and slave couple. - I.e there can not be 2 events from the same staying connected master which - have the same coordinates. - @note - Such identifier is not yet unique generally as the event originating master - is resettable. Also the crashed master can be replaced with some other. -*/ -typedef struct event_coordinates -{ - char * file_name; // binlog file name (directories stripped) - my_off_t pos; // event's position in the binlog file -} LOG_POS_COORD; - -/** - @class Log_event - - This is the abstract base class for binary log events. - - @section Log_event_binary_format Binary Format - - Any @c Log_event saved on disk consists of the following three - components. - - - Common-Header - - Post-Header - - Body - - The Common-Header, documented in the table @ref Table_common_header - "below", always has the same form and length within one version of - MySQL. Each event type specifies a format and length of the - Post-Header. The length of the Common-Header is the same for all - events of the same type. The Body may be of different format and - length even for different events of the same type. The binary - formats of Post-Header and Body are documented separately in each - subclass. The binary format of Common-Header is as follows. - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Common-Header
NameFormatDescription
timestamp4 byte unsigned integerThe time when the query started, in seconds since 1970. -
type1 byte enumerationSee enum #Log_event_type.
server_id4 byte unsigned integerServer ID of the server that created the event.
total_size4 byte unsigned integerThe total size of this event, in bytes. In other words, this - is the sum of the sizes of Common-Header, Post-Header, and Body. -
master_position4 byte unsigned integerThe position of the next event in the master binary log, in - bytes from the beginning of the file. In a binlog that is not a - relay log, this is just the position of the next event, in bytes - from the beginning of the file. In a relay log, this is - the position of the next event in the master's binlog. -
flags2 byte bitfieldSee Log_event::flags.
- - Summing up the numbers above, we see that the total size of the - common header is 19 bytes. - - @subsection Log_event_format_of_atomic_primitives Format of Atomic Primitives - - - All numbers, whether they are 16-, 24-, 32-, or 64-bit numbers, - are stored in little endian, i.e., the least significant byte first, - unless otherwise specified. - - @anchor packed_integer - - Some events use a special format for efficient representation of - unsigned integers, called Packed Integer. A Packed Integer has the - capacity of storing up to 8-byte integers, while small integers - still can use 1, 3, or 4 bytes. The value of the first byte - determines how to read the number, according to the following table: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Format of Packed Integer
First byteFormat
0-250The first byte is the number (in the range 0-250), and no more - bytes are used.
252Two more bytes are used. The number is in the range - 251-0xffff.
253Three more bytes are used. The number is in the range - 0xffff-0xffffff.
254Eight more bytes are used. The number is in the range - 0xffffff-0xffffffffffffffff.
- - - Strings are stored in various formats. The format of each string - is documented separately. -*/ -class Log_event -{ -public: - /** - Enumeration of what kinds of skipping (and non-skipping) that can - occur when the slave executes an event. - - @see shall_skip - @see do_shall_skip - */ - enum enum_skip_reason { - /** - Don't skip event. - */ - EVENT_SKIP_NOT, - - /** - Skip event by ignoring it. - - This means that the slave skip counter will not be changed. - */ - EVENT_SKIP_IGNORE, - - /** - Skip event and decrease skip counter. - */ - EVENT_SKIP_COUNT - }; - - enum enum_event_cache_type - { - EVENT_INVALID_CACHE, - /* - If possible the event should use a non-transactional cache before - being flushed to the binary log. This means that it must be flushed - right after its correspondent statement is completed. - */ - EVENT_STMT_CACHE, - /* - The event should use a transactional cache before being flushed to - the binary log. This means that it must be flushed upon commit or - rollback. - */ - EVENT_TRANSACTIONAL_CACHE, - /* - The event must be written directly to the binary log without going - through a cache. - */ - EVENT_NO_CACHE, - /** - If there is a need for different types, introduce them before this. - */ - EVENT_CACHE_COUNT - }; - - /* - The following type definition is to be used whenever data is placed - and manipulated in a common buffer. Use this typedef for buffers - that contain data containing binary and character data. - */ - typedef unsigned char Byte; - - /* - The offset in the log where this event originally appeared (it is - preserved in relay logs, making SHOW SLAVE STATUS able to print - coordinates of the event in the master's binlog). Note: when a - transaction is written by the master to its binlog (wrapped in - BEGIN/COMMIT) the log_pos of all the queries it contains is the - one of the BEGIN (this way, when one does SHOW SLAVE STATUS it - sees the offset of the BEGIN, which is logical as rollback may - occur), except the COMMIT query which has its real offset. - */ - my_off_t log_pos; - /* - A temp buffer for read_log_event; it is later analysed according to the - event's type, and its content is distributed in the event-specific fields. - */ - char *temp_buf; - - /* - TRUE <=> this event 'owns' temp_buf and should call my_free() when done - with it - */ - bool event_owns_temp_buf; - - /* - Timestamp on the master(for debugging and replication of - NOW()/TIMESTAMP). It is important for queries and LOAD DATA - INFILE. This is set at the event's creation time, except for Query - and Load (et al.) events where this is set at the query's - execution time, which guarantees good replication (otherwise, we - could have a query and its event with different timestamps). - */ - my_time_t when; - ulong when_sec_part; - /* The number of seconds the query took to run on the master. */ - ulong exec_time; - /* Number of bytes written by write() function */ - size_t data_written; - - /* - The master's server id (is preserved in the relay log; used to - prevent from infinite loops in circular replication). - */ - uint32 server_id; - - /** - Some 16 flags. See the definitions above for LOG_EVENT_TIME_F, - LOG_EVENT_FORCED_ROTATE_F, LOG_EVENT_THREAD_SPECIFIC_F, - LOG_EVENT_SUPPRESS_USE_F, and LOG_EVENT_SKIP_REPLICATION_F for notes. - */ - uint16 flags; - - enum_event_cache_type cache_type; - - /** - A storage to cache the global system variable's value. - Handling of a separate event will be governed its member. - */ - ulong slave_exec_mode; - - Log_event_writer *writer; - -#ifdef MYSQL_SERVER - THD* thd; - - Log_event(); - Log_event(THD* thd_arg, uint16 flags_arg, bool is_transactional); - - /* - init_show_field_list() prepares the column names and types for the - output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG - EVENTS. - */ - static void init_show_field_list(THD *thd, List* field_list); -#ifdef HAVE_REPLICATION - int net_send(Protocol *protocol, const char* log_name, my_off_t pos); - - /* - pack_info() is used by SHOW BINLOG EVENTS; as print() it prepares and sends - a string to display to the user, so it resembles print(). - */ - - virtual void pack_info(Protocol *protocol); - -#endif /* HAVE_REPLICATION */ - virtual const char* get_db() - { - return thd ? thd->db.str : 0; - } -#else - Log_event() : temp_buf(0), when(0), flags(0) {} - ha_checksum crc; - /* print*() functions are used by mysqlbinlog */ - virtual bool print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0; - bool print_timestamp(IO_CACHE* file, time_t *ts = 0); - bool print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info, - bool is_more); - bool print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info, - bool do_print_encoded); -#endif /* MYSQL_SERVER */ - - /* The following code used for Flashback */ -#ifdef MYSQL_CLIENT - my_bool is_flashback; - my_bool need_flashback_review; - String output_buf; // Storing the event output -#ifdef WHEN_FLASHBACK_REVIEW_READY - String m_review_dbname; - String m_review_tablename; - - void set_review_dbname(const char *name) - { - if (name) - { - m_review_dbname.free(); - m_review_dbname.append(name); - } - } - void set_review_tablename(const char *name) - { - if (name) - { - m_review_tablename.free(); - m_review_tablename.append(name); - } - } - const char *get_review_dbname() const { return m_review_dbname.ptr(); } - const char *get_review_tablename() const { return m_review_tablename.ptr(); } -#endif -#endif - - /* - read_log_event() functions read an event from a binlog or relay - log; used by SHOW BINLOG EVENTS, the binlog_dump thread on the - master (reads master's binlog), the slave IO thread (reads the - event sent by binlog_dump), the slave SQL thread (reads the event - from the relay log). If mutex is 0, the read will proceed without - mutex. We need the description_event to be able to parse the - event (to know the post-header's size); in fact in read_log_event - we detect the event's type, then call the specific event's - constructor and pass description_event as an argument. - */ - static Log_event* read_log_event(IO_CACHE* file, - const Format_description_log_event - *description_event, - my_bool crc_check); - - /** - Reads an event from a binlog or relay log. Used by the dump thread - this method reads the event into a raw buffer without parsing it. - - @Note If mutex is 0, the read will proceed without mutex. - - @Note If a log name is given than the method will check if the - given binlog is still active. - - @param[in] file log file to be read - @param[out] packet packet to hold the event - @param[in] checksum_alg_arg verify the event checksum using this - algorithm (or don't if it's - use BINLOG_CHECKSUM_ALG_OFF) - - @retval 0 success - @retval LOG_READ_EOF end of file, nothing was read - @retval LOG_READ_BOGUS malformed event - @retval LOG_READ_IO io error while reading - @retval LOG_READ_MEM packet memory allocation failed - @retval LOG_READ_TRUNC only a partial event could be read - @retval LOG_READ_TOO_LARGE event too large - */ - static int read_log_event(IO_CACHE* file, String* packet, - const Format_description_log_event *fdle, - enum enum_binlog_checksum_alg checksum_alg_arg); - /* - The value is set by caller of FD constructor and - Log_event::write_header() for the rest. - In the FD case it's propagated into the last byte - of post_header_len[] at FD::write(). - On the slave side the value is assigned from post_header_len[last] - of the last seen FD event. - */ - enum enum_binlog_checksum_alg checksum_alg; - - static void *operator new(size_t size) - { - extern PSI_memory_key key_memory_log_event; - return my_malloc(key_memory_log_event, size, MYF(MY_WME|MY_FAE)); - } - - static void operator delete(void *ptr, size_t) - { - my_free(ptr); - } - - /* Placement version of the above operators */ - static void *operator new(size_t, void* ptr) { return ptr; } - static void operator delete(void*, void*) { } - -#ifdef MYSQL_SERVER - bool write_header(size_t event_data_length); - bool write_data(const uchar *buf, size_t data_length) - { return writer->write_data(buf, data_length); } - bool write_data(const char *buf, size_t data_length) - { return write_data((uchar*)buf, data_length); } - bool write_footer() - { return writer->write_footer(); } - - my_bool need_checksum(); - - virtual bool write() - { - return write_header(get_data_size()) || write_data_header() || - write_data_body() || write_footer(); - } - virtual bool write_data_header() - { return 0; } - virtual bool write_data_body() - { return 0; } - - /* Return start of query time or current time */ - inline my_time_t get_time() - { - THD *tmp_thd; - if (when) - return when; - if (thd) - { - when= thd->start_time; - when_sec_part= thd->start_time_sec_part; - return when; - } - /* thd will only be 0 here at time of log creation */ - if ((tmp_thd= current_thd)) - { - when= tmp_thd->start_time; - when_sec_part= tmp_thd->start_time_sec_part; - return when; - } - my_hrtime_t hrtime= my_hrtime(); - when= hrtime_to_my_time(hrtime); - when_sec_part= hrtime_sec_part(hrtime); - return when; - } -#endif - virtual Log_event_type get_type_code() = 0; - virtual enum_logged_status logged_status() { return LOGGED_CRITICAL; } - virtual bool is_valid() const = 0; - virtual my_off_t get_header_len(my_off_t len) { return len; } - void set_artificial_event() { flags |= LOG_EVENT_ARTIFICIAL_F; } - void set_relay_log_event() { flags |= LOG_EVENT_RELAY_LOG_F; } - bool is_artificial_event() const { return flags & LOG_EVENT_ARTIFICIAL_F; } - bool is_relay_log_event() const { return flags & LOG_EVENT_RELAY_LOG_F; } - inline bool use_trans_cache() const - { - return (cache_type == Log_event::EVENT_TRANSACTIONAL_CACHE); - } - inline void set_direct_logging() - { - cache_type = Log_event::EVENT_NO_CACHE; - } - inline bool use_direct_logging() - { - return (cache_type == Log_event::EVENT_NO_CACHE); - } - Log_event(const char* buf, const Format_description_log_event - *description_event); - virtual ~Log_event() { free_temp_buf();} - void register_temp_buf(char* buf, bool must_free) - { - temp_buf= buf; - event_owns_temp_buf= must_free; - } - void free_temp_buf() - { - if (temp_buf) - { - if (event_owns_temp_buf) - my_free(temp_buf); - temp_buf = 0; - } - } - /* - Get event length for simple events. For complicated events the length - is calculated during write() - */ - virtual int get_data_size() { return 0;} - static Log_event* read_log_event(const char* buf, uint event_len, - const char **error, - const Format_description_log_event - *description_event, my_bool crc_check); - /** - Returns the human readable name of the given event type. - */ - static const char* get_type_str(Log_event_type type); - /** - Returns the human readable name of this event's type. - */ - const char* get_type_str(); - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - - /** - Apply the event to the database. - - This function represents the public interface for applying an - event. - - @see do_apply_event - */ - int apply_event(rpl_group_info *rgi) - { - int res; - THD_STAGE_INFO(thd, stage_apply_event); - res= do_apply_event(rgi); - THD_STAGE_INFO(thd, stage_after_apply_event); - return res; - } - - - /** - Update the relay log position. - - This function represents the public interface for "stepping over" - the event and will update the relay log information. - - @see do_update_pos - */ - int update_pos(rpl_group_info *rgi) - { - return do_update_pos(rgi); - } - - /** - Decide if the event shall be skipped, and the reason for skipping - it. - - @see do_shall_skip - */ - enum_skip_reason shall_skip(rpl_group_info *rgi) - { - return do_shall_skip(rgi); - } - - - /* - Check if an event is non-final part of a stand-alone event group, - such as Intvar_log_event (such events should be processed as part - of the following event group, not individually). - See also is_part_of_group() - */ - static bool is_part_of_group(enum Log_event_type ev_type) - { - switch (ev_type) - { - case GTID_EVENT: - case INTVAR_EVENT: - case RAND_EVENT: - case USER_VAR_EVENT: - case TABLE_MAP_EVENT: - case ANNOTATE_ROWS_EVENT: - return true; - case DELETE_ROWS_EVENT: - case UPDATE_ROWS_EVENT: - case WRITE_ROWS_EVENT: - /* - ToDo: also check for non-final Rows_log_event (though such events - are usually in a BEGIN-COMMIT group). - */ - default: - return false; - } - } - /* - Same as above, but works on the object. In addition this is true for all - rows event except the last one. - */ - virtual bool is_part_of_group() { return 0; } - - static bool is_group_event(enum Log_event_type ev_type) - { - switch (ev_type) - { - case START_EVENT_V3: - case STOP_EVENT: - case ROTATE_EVENT: - case SLAVE_EVENT: - case FORMAT_DESCRIPTION_EVENT: - case INCIDENT_EVENT: - case HEARTBEAT_LOG_EVENT: - case BINLOG_CHECKPOINT_EVENT: - case GTID_LIST_EVENT: - case START_ENCRYPTION_EVENT: - return false; - - default: - return true; - } - } - -protected: - - /** - Helper function to ignore an event w.r.t. the slave skip counter. - - This function can be used inside do_shall_skip() for functions - that cannot end a group. If the slave skip counter is 1 when - seeing such an event, the event shall be ignored, the counter - left intact, and processing continue with the next event. - - A typical usage is: - @code - enum_skip_reason do_shall_skip(rpl_group_info *rgi) { - return continue_group(rgi); - } - @endcode - - @return Skip reason - */ - enum_skip_reason continue_group(rpl_group_info *rgi); - - /** - Primitive to apply an event to the database. - - This is where the change to the database is made. - - @note The primitive is protected instead of private, since there - is a hierarchy of actions to be performed in some cases. - - @see Format_description_log_event::do_apply_event() - - @param rli Pointer to relay log info structure - - @retval 0 Event applied successfully - @retval errno Error code if event application failed - */ - virtual int do_apply_event(rpl_group_info *rgi) - { - return 0; /* Default implementation does nothing */ - } - - - /** - Advance relay log coordinates. - - This function is called to advance the relay log coordinates to - just after the event. It is essential that both the relay log - coordinate and the group log position is updated correctly, since - this function is used also for skipping events. - - Normally, each implementation of do_update_pos() shall: - - - Update the event position to refer to the position just after - the event. - - - Update the group log position to refer to the position just - after the event if the event is last in a group - - @param rli Pointer to relay log info structure - - @retval 0 Coordinates changed successfully - @retval errno Error code if advancing failed (usually just - 1). Observe that handler errors are returned by the - do_apply_event() function, and not by this one. - */ - virtual int do_update_pos(rpl_group_info *rgi); - - - /** - Decide if this event shall be skipped or not and the reason for - skipping it. - - The default implementation decide that the event shall be skipped - if either: - - - the server id of the event is the same as the server id of the - server and rli->replicate_same_server_id is true, - or - - - if rli->slave_skip_counter is greater than zero. - - @see do_apply_event - @see do_update_pos - - @retval Log_event::EVENT_SKIP_NOT - The event shall not be skipped and should be applied. - - @retval Log_event::EVENT_SKIP_IGNORE - The event shall be skipped by just ignoring it, i.e., the slave - skip counter shall not be changed. This happends if, for example, - the originating server id of the event is the same as the server - id of the slave. - - @retval Log_event::EVENT_SKIP_COUNT - The event shall be skipped because the slave skip counter was - non-zero. The caller shall decrease the counter by one. - */ - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif -}; - - -/* - One class for each type of event. - Two constructors for each class: - - one to create the event for logging (when the server acts as a master), - called after an update to the database is done, - which accepts parameters like the query, the database, the options for LOAD - DATA INFILE... - - one to create the event from a packet (when the server acts as a slave), - called before reproducing the update, which accepts parameters (like a - buffer). Used to read from the master, from the relay log, and in - mysqlbinlog. This constructor must be format-tolerant. -*/ - -/** - @class Query_log_event - - A @c Query_log_event is created for each query that modifies the - database, unless the query is logged row-based. - - @section Query_log_event_binary_format Binary format - - See @ref Log_event_binary_format "Binary format for log events" for - a general discussion and introduction to the binary format of binlog - events. - - The Post-Header has five components: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Post-Header for Query_log_event
NameFormatDescription
slave_proxy_id4 byte unsigned integerAn integer identifying the client thread that issued the - query. The id is unique per server. (Note, however, that two - threads on different servers may have the same slave_proxy_id.) - This is used when a client thread creates a temporary table local - to the client. The slave_proxy_id is used to distinguish - temporary tables that belong to different clients. -
exec_time4 byte unsigned integerThe time from when the query started to when it was logged in - the binlog, in seconds.
db_len1 byte integerThe length of the name of the currently selected database.
error_code2 byte unsigned integerError code generated by the master. If the master fails, the - slave will fail with the same error code, except for the error - codes ER_DB_CREATE_EXISTS == 1007 and ER_DB_DROP_EXISTS == 1008. -
status_vars_len2 byte unsigned integerThe length of the status_vars block of the Body, in bytes. See - @ref query_log_event_status_vars "below". -
- - The Body has the following components: - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Body for Query_log_event
NameFormatDescription
@anchor query_log_event_status_vars status_varsstatus_vars_len bytesZero or more status variables. Each status variable consists - of one byte identifying the variable stored, followed by the value - of the variable. The possible variables are listed separately in - the table @ref Table_query_log_event_status_vars "below". MySQL - always writes events in the order defined below; however, it is - capable of reading them in any order.
dbdb_len+1The currently selected database, as a null-terminated string. - - (The trailing zero is redundant since the length is already known; - it is db_len from Post-Header.) -
queryvariable length string without trailing zero, extending to the - end of the event (determined by the length field of the - Common-Header) - The SQL query.
- - The following table lists the status variables that may appear in - the status_vars field. - - @anchor Table_query_log_event_status_vars - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Status variables for Query_log_event
Status variable1 byte identifierFormatDescription
flags2Q_FLAGS2_CODE == 04 byte bitfieldThe flags in @c thd->options, binary AND-ed with @c - OPTIONS_WRITTEN_TO_BIN_LOG. The @c thd->options bitfield contains - options for "SELECT". @c OPTIONS_WRITTEN identifies those options - that need to be written to the binlog (not all do). Specifically, - @c OPTIONS_WRITTEN_TO_BIN_LOG equals (@c OPTION_AUTO_IS_NULL | @c - OPTION_NO_FOREIGN_KEY_CHECKS | @c OPTION_RELAXED_UNIQUE_CHECKS | - @c OPTION_NOT_AUTOCOMMIT), or 0x0c084000 in hex. - - These flags correspond to the SQL variables SQL_AUTO_IS_NULL, - FOREIGN_KEY_CHECKS, UNIQUE_CHECKS, and AUTOCOMMIT, documented in - the "SET Syntax" section of the MySQL Manual. - - This field is always written to the binlog in version >= 5.0, and - never written in version < 5.0. -
sql_modeQ_SQL_MODE_CODE == 18 byte bitfieldThe @c sql_mode variable. See the section "SQL Modes" in the - MySQL manual, and see sql_priv.h for a list of the possible - flags. Currently (2007-10-04), the following flags are available: -
-    MODE_REAL_AS_FLOAT==0x1
-    MODE_PIPES_AS_CONCAT==0x2
-    MODE_ANSI_QUOTES==0x4
-    MODE_IGNORE_SPACE==0x8
-    MODE_IGNORE_BAD_TABLE_OPTIONS==0x10
-    MODE_ONLY_FULL_GROUP_BY==0x20
-    MODE_NO_UNSIGNED_SUBTRACTION==0x40
-    MODE_NO_DIR_IN_CREATE==0x80
-    MODE_POSTGRESQL==0x100
-    MODE_ORACLE==0x200
-    MODE_MSSQL==0x400
-    MODE_DB2==0x800
-    MODE_MAXDB==0x1000
-    MODE_NO_KEY_OPTIONS==0x2000
-    MODE_NO_TABLE_OPTIONS==0x4000
-    MODE_NO_FIELD_OPTIONS==0x8000
-    MODE_MYSQL323==0x10000
-    MODE_MYSQL323==0x20000
-    MODE_MYSQL40==0x40000
-    MODE_ANSI==0x80000
-    MODE_NO_AUTO_VALUE_ON_ZERO==0x100000
-    MODE_NO_BACKSLASH_ESCAPES==0x200000
-    MODE_STRICT_TRANS_TABLES==0x400000
-    MODE_STRICT_ALL_TABLES==0x800000
-    MODE_NO_ZERO_IN_DATE==0x1000000
-    MODE_NO_ZERO_DATE==0x2000000
-    MODE_INVALID_DATES==0x4000000
-    MODE_ERROR_FOR_DIVISION_BY_ZERO==0x8000000
-    MODE_TRADITIONAL==0x10000000
-    MODE_NO_AUTO_CREATE_USER==0x20000000
-    MODE_HIGH_NOT_PRECEDENCE==0x40000000
-    MODE_PAD_CHAR_TO_FULL_LENGTH==0x80000000
-    
- All these flags are replicated from the server. However, all - flags except @c MODE_NO_DIR_IN_CREATE are honored by the slave; - the slave always preserves its old value of @c - MODE_NO_DIR_IN_CREATE. For a rationale, see comment in - @c Query_log_event::do_apply_event in @c log_event.cc. - - This field is always written to the binlog. -
catalogQ_CATALOG_NZ_CODE == 6Variable-length string: the length in bytes (1 byte) followed - by the characters (at most 255 bytes) - Stores the client's current catalog. Every database belongs - to a catalog, the same way that every table belongs to a - database. Currently, there is only one catalog, "std". - - This field is written if the length of the catalog is > 0; - otherwise it is not written. -
auto_incrementQ_AUTO_INCREMENT == 3two 2 byte unsigned integers, totally 2+2=4 bytesThe two variables auto_increment_increment and - auto_increment_offset, in that order. For more information, see - "System variables" in the MySQL manual. - - This field is written if auto_increment > 1. Otherwise, it is not - written. -
charsetQ_CHARSET_CODE == 4three 2 byte unsigned integers, totally 2+2+2=6 bytesThe three variables character_set_client, - collation_connection, and collation_server, in that order. - character_set_client is a code identifying the character set and - collation used by the client to encode the query. - collation_connection identifies the character set and collation - that the master converts the query to when it receives it; this is - useful when comparing literal strings. collation_server is the - default character set and collation used when a new database is - created. - - See also "Connection Character Sets and Collations" in the MySQL - 5.1 manual. - - All three variables are codes identifying a (character set, - collation) pair. To see which codes map to which pairs, run the - query "SELECT id, character_set_name, collation_name FROM - COLLATIONS". - - Cf. Q_CHARSET_DATABASE_CODE below. - - This field is always written. -
time_zoneQ_TIME_ZONE_CODE == 5Variable-length string: the length in bytes (1 byte) followed - by the characters (at most 255 bytes). - The time_zone of the master. - - See also "System Variables" and "MySQL Server Time Zone Support" - in the MySQL manual. - - This field is written if the length of the time zone string is > - 0; otherwise, it is not written. -
lc_time_names_numberQ_LC_TIME_NAMES_CODE == 72 byte integerA code identifying a table of month and day names. The - mapping from codes to languages is defined in @c sql_locale.cc. - - This field is written if it is not 0, i.e., if the locale is not - en_US. -
charset_database_numberQ_CHARSET_DATABASE_CODE == 82 byte integerThe value of the collation_database system variable (in the - source code stored in @c thd->variables.collation_database), which - holds the code for a (character set, collation) pair as described - above (see Q_CHARSET_CODE). - - collation_database was used in old versions (???WHEN). Its value - was loaded when issuing a "use db" query and could be changed by - issuing a "SET collation_database=xxx" query. It used to affect - the "LOAD DATA INFILE" and "CREATE TABLE" commands. - - In newer versions, "CREATE TABLE" has been changed to take the - character set from the database of the created table, rather than - the character set of the current database. This makes a - difference when creating a table in another database than the - current one. "LOAD DATA INFILE" has not yet changed to do this, - but there are plans to eventually do it, and to make - collation_database read-only. - - This field is written if it is not 0. -
table_map_for_updateQ_TABLE_MAP_FOR_UPDATE_CODE == 98 byte integerThe value of the table map that is to be updated by the - multi-table update query statement. Every bit of this variable - represents a table, and is set to 1 if the corresponding table is - to be updated by this statement. - - The value of this variable is set when executing a multi-table update - statement and used by slave to apply filter rules without opening - all the tables on slave. This is required because some tables may - not exist on slave because of the filter rules. -
- - @subsection Query_log_event_notes_on_previous_versions Notes on Previous Versions - - * Status vars were introduced in version 5.0. To read earlier - versions correctly, check the length of the Post-Header. - - * The status variable Q_CATALOG_CODE == 2 existed in MySQL 5.0.x, - where 0<=x<=3. It was identical to Q_CATALOG_CODE, except that the - string had a trailing '\0'. The '\0' was removed in 5.0.4 since it - was redundant (the string length is stored before the string). The - Q_CATALOG_CODE will never be written by a new master, but can still - be understood by a new slave. - - * See Q_CHARSET_DATABASE_CODE in the table above. - - * When adding new status vars, please don't forget to update the - MAX_SIZE_LOG_EVENT_STATUS, and update function code_name - -*/ -class Query_log_event: public Log_event -{ - LEX_CSTRING user; - LEX_CSTRING host; -protected: - Log_event::Byte* data_buf; -public: - const char* query; - const char* catalog; - const char* db; - /* - If we already know the length of the query string - we pass it with q_len, so we would not have to call strlen() - otherwise, set it to 0, in which case, we compute it with strlen() - */ - uint32 q_len; - uint32 db_len; - uint16 error_code; - my_thread_id thread_id; - /* - For events created by Query_log_event::do_apply_event (and - Load_log_event::do_apply_event()) we need the *original* thread - id, to be able to log the event with the original (=master's) - thread id (fix for BUG#1686). - */ - ulong slave_proxy_id; - - /* - Binlog format 3 and 4 start to differ (as far as class members are - concerned) from here. - */ - - uint catalog_len; // <= 255 char; 0 means uninited - - /* - We want to be able to store a variable number of N-bit status vars: - (generally N=32; but N=64 for SQL_MODE) a user may want to log the number - of affected rows (for debugging) while another does not want to lose 4 - bytes in this. - The storage on disk is the following: - status_vars_len is part of the post-header, - status_vars are in the variable-length part, after the post-header, before - the db & query. - status_vars on disk is a sequence of pairs (code, value) where 'code' means - 'sql_mode', 'affected' etc. Sometimes 'value' must be a short string, so - its first byte is its length. For now the order of status vars is: - flags2 - sql_mode - catalog - autoinc - charset - We should add the same thing to Load_log_event, but in fact - LOAD DATA INFILE is going to be logged with a new type of event (logging of - the plain text query), so Load_log_event would be frozen, so no need. The - new way of logging LOAD DATA INFILE would use a derived class of - Query_log_event, so automatically benefit from the work already done for - status variables in Query_log_event. - */ - uint16 status_vars_len; - - /* - 'flags2' is a second set of flags (on top of those in Log_event), for - session variables. These are thd->options which is & against a mask - (OPTIONS_WRITTEN_TO_BIN_LOG). - flags2_inited helps make a difference between flags2==0 (3.23 or 4.x - master, we don't know flags2, so use the slave server's global options) and - flags2==0 (5.0 master, we know this has a meaning of flags all down which - must influence the query). - */ - bool flags2_inited; - bool sql_mode_inited; - bool charset_inited; - - uint32 flags2; - sql_mode_t sql_mode; - ulong auto_increment_increment, auto_increment_offset; - char charset[6]; - uint time_zone_len; /* 0 means uninited */ - const char *time_zone_str; - uint lc_time_names_number; /* 0 means en_US */ - uint charset_database_number; - /* - map for tables that will be updated for a multi-table update query - statement, for other query statements, this will be zero. - */ - ulonglong table_map_for_update; - /* - Holds the original length of a Query_log_event that comes from a - master of version < 5.0 (i.e., binlog_version < 4). When the IO - thread writes the relay log, it augments the Query_log_event with a - Q_MASTER_DATA_WRITTEN_CODE status_var that holds the original event - length. This field is initialized to non-zero in the SQL thread when - it reads this augmented event. SQL thread does not write - Q_MASTER_DATA_WRITTEN_CODE to the slave's server binlog. - */ - uint32 master_data_written; - -#ifdef MYSQL_SERVER - - Query_log_event(THD* thd_arg, const char* query_arg, size_t query_length, - bool using_trans, bool direct, bool suppress_use, int error); - const char* get_db() { return db; } -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info); - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Query_log_event(); - Query_log_event(const char* buf, uint event_len, - const Format_description_log_event *description_event, - Log_event_type event_type); - ~Query_log_event() - { - if (data_buf) - my_free(data_buf); - } - Log_event_type get_type_code() { return QUERY_EVENT; } - static int dummy_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); - static int begin_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); -#ifdef MYSQL_SERVER - bool write(); - virtual bool write_post_header_for_derived() { return FALSE; } -#endif - bool is_valid() const { return query != 0; } - - /* - Returns number of bytes additionally written to post header by derived - events (so far it is only Execute_load_query event). - */ - virtual ulong get_post_header_size_for_derived() { return 0; } - /* Writes derived event-specific part of post header. */ - -public: /* !!! Public in this patch to allow old usage */ -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); - virtual int do_apply_event(rpl_group_info *rgi); - - int do_apply_event(rpl_group_info *rgi, - const char *query_arg, - uint32 q_len_arg); - static bool peek_is_commit_rollback(const char *event_start, - size_t event_len, enum enum_binlog_checksum_alg checksum_alg); -#endif /* HAVE_REPLICATION */ - /* - If true, the event always be applied by slave SQL thread or be printed by - mysqlbinlog - */ - bool is_trans_keyword() - { - /* - Before the patch for bug#50407, The 'SAVEPOINT and ROLLBACK TO' - queries input by user was written into log events directly. - So the keywords can be written in both upper case and lower case - together, strncasecmp is used to check both cases. they also could be - binlogged with comments in the front of these keywords. for examples: - / * bla bla * / SAVEPOINT a; - / * bla bla * / ROLLBACK TO a; - but we don't handle these cases and after the patch, both quiries are - binlogged in upper case with no comments. - */ - return !strncmp(query, "BEGIN", q_len) || - !strncmp(query, "COMMIT", q_len) || - !strncasecmp(query, "SAVEPOINT", 9) || - !strncasecmp(query, "ROLLBACK", 8); - } - virtual bool is_begin() { return !strcmp(query, "BEGIN"); } - virtual bool is_commit() { return !strcmp(query, "COMMIT"); } - virtual bool is_rollback() { return !strcmp(query, "ROLLBACK"); } -}; - -class Query_compressed_log_event:public Query_log_event{ -protected: - Log_event::Byte* query_buf; // point to the uncompressed query -public: - Query_compressed_log_event(const char* buf, uint event_len, - const Format_description_log_event *description_event, - Log_event_type event_type); - ~Query_compressed_log_event() - { - if (query_buf) - my_free(query_buf); - } - Log_event_type get_type_code() { return QUERY_COMPRESSED_EVENT; } - - /* - the min length of log_bin_compress_min_len is 10, - means that Begin/Commit/Rollback would never be compressed! - */ - virtual bool is_begin() { return false; } - virtual bool is_commit() { return false; } - virtual bool is_rollback() { return false; } -#ifdef MYSQL_SERVER - Query_compressed_log_event(THD* thd_arg, const char* query_arg, - ulong query_length, - bool using_trans, bool direct, bool suppress_use, - int error); - virtual bool write(); -#endif -}; - - -/***************************************************************************** - sql_ex_info struct - ****************************************************************************/ -struct sql_ex_info -{ - const char* field_term; - const char* enclosed; - const char* line_term; - const char* line_start; - const char* escaped; - int cached_new_format= -1; - uint8 field_term_len= 0, enclosed_len= 0, line_term_len= 0, - line_start_len= 0, escaped_len= 0; - char opt_flags; - char empty_flags= 0; - - // store in new format even if old is possible - void force_new_format() { cached_new_format = 1;} - int data_size() - { - return (new_format() ? - field_term_len + enclosed_len + line_term_len + - line_start_len + escaped_len + 6 : 7); - } - bool write_data(Log_event_writer *writer); - const char* init(const char* buf, const char* buf_end, bool use_new_format); - bool new_format() - { - return ((cached_new_format != -1) ? cached_new_format : - (cached_new_format=(field_term_len > 1 || - enclosed_len > 1 || - line_term_len > 1 || line_start_len > 1 || - escaped_len > 1))); - } -}; - -/** - @class Load_log_event - - This log event corresponds to a "LOAD DATA INFILE" SQL query on the - following form: - - @verbatim - (1) USE db; - (2) LOAD DATA [CONCURRENT] [LOCAL] INFILE 'file_name' - (3) [REPLACE | IGNORE] - (4) INTO TABLE 'table_name' - (5) [FIELDS - (6) [TERMINATED BY 'field_term'] - (7) [[OPTIONALLY] ENCLOSED BY 'enclosed'] - (8) [ESCAPED BY 'escaped'] - (9) ] - (10) [LINES - (11) [TERMINATED BY 'line_term'] - (12) [LINES STARTING BY 'line_start'] - (13) ] - (14) [IGNORE skip_lines LINES] - (15) (field_1, field_2, ..., field_n)@endverbatim - - @section Load_log_event_binary_format Binary Format - - The Post-Header consists of the following six components. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Post-Header for Load_log_event
NameFormatDescription
slave_proxy_id4 byte unsigned integerAn integer identifying the client thread that issued the - query. The id is unique per server. (Note, however, that two - threads on different servers may have the same slave_proxy_id.) - This is used when a client thread creates a temporary table local - to the client. The slave_proxy_id is used to distinguish - temporary tables that belong to different clients. -
exec_time4 byte unsigned integerThe time from when the query started to when it was logged in - the binlog, in seconds.
skip_lines4 byte unsigned integerThe number on line (14) above, if present, or 0 if line (14) - is left out. -
table_name_len1 byte unsigned integerThe length of 'table_name' on line (4) above.
db_len1 byte unsigned integerThe length of 'db' on line (1) above.
num_fields4 byte unsigned integerThe number n of fields on line (15) above.
- - The Body contains the following components. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Body of Load_log_event
NameFormatDescription
sql_exvariable lengthDescribes the part of the query on lines (3) and - (5)–(13) above. More precisely, it stores the five strings - (on lines) field_term (6), enclosed (7), escaped (8), line_term - (11), and line_start (12); as well as a bitfield indicating the - presence of the keywords REPLACE (3), IGNORE (3), and OPTIONALLY - (7). - - The data is stored in one of two formats, called "old" and "new". - The type field of Common-Header determines which of these two - formats is used: type LOAD_EVENT means that the old format is - used, and type NEW_LOAD_EVENT means that the new format is used. - When MySQL writes a Load_log_event, it uses the new format if at - least one of the five strings is two or more bytes long. - Otherwise (i.e., if all strings are 0 or 1 bytes long), the old - format is used. - - The new and old format differ in the way the five strings are - stored. - -
    -
  • In the new format, the strings are stored in the order - field_term, enclosed, escaped, line_term, line_start. Each string - consists of a length (1 byte), followed by a sequence of - characters (0-255 bytes). Finally, a boolean combination of the - following flags is stored in 1 byte: REPLACE_FLAG==0x4, - IGNORE_FLAG==0x8, and OPT_ENCLOSED_FLAG==0x2. If a flag is set, - it indicates the presence of the corresponding keyword in the SQL - query. - -
  • In the old format, we know that each string has length 0 or - 1. Therefore, only the first byte of each string is stored. The - order of the strings is the same as in the new format. These five - bytes are followed by the same 1 byte bitfield as in the new - format. Finally, a 1 byte bitfield called empty_flags is stored. - The low 5 bits of empty_flags indicate which of the five strings - have length 0. For each of the following flags that is set, the - corresponding string has length 0; for the flags that are not set, - the string has length 1: FIELD_TERM_EMPTY==0x1, - ENCLOSED_EMPTY==0x2, LINE_TERM_EMPTY==0x4, LINE_START_EMPTY==0x8, - ESCAPED_EMPTY==0x10. -
- - Thus, the size of the new format is 6 bytes + the sum of the sizes - of the five strings. The size of the old format is always 7 - bytes. -
field_lensnum_fields 1 byte unsigned integersAn array of num_fields integers representing the length of - each field in the query. (num_fields is from the Post-Header). -
fieldsnum_fields null-terminated stringsAn array of num_fields null-terminated strings, each - representing a field in the query. (The trailing zero is - redundant, since the length are stored in the num_fields array.) - The total length of all strings equals to the sum of all - field_lens, plus num_fields bytes for all the trailing zeros. -
table_namenull-terminated string of length table_len+1 bytesThe 'table_name' from the query, as a null-terminated string. - (The trailing zero is actually redundant since the table_len is - known from Post-Header.) -
dbnull-terminated string of length db_len+1 bytesThe 'db' from the query, as a null-terminated string. - (The trailing zero is actually redundant since the db_len is known - from Post-Header.) -
file_namevariable length string without trailing zero, extending to the - end of the event (determined by the length field of the - Common-Header) - The 'file_name' from the query. -
- - @subsection Load_log_event_notes_on_previous_versions Notes on Previous Versions - - This event type is understood by current versions, but only - generated by MySQL 3.23 and earlier. -*/ -class Load_log_event: public Log_event -{ -private: -protected: - int copy_log_event(const char *buf, ulong event_len, - int body_offset, - const Format_description_log_event* description_event); - -public: - bool print_query(THD *thd, bool need_db, const char *cs, String *buf, - my_off_t *fn_start, my_off_t *fn_end, - const char *qualify_db); - my_thread_id thread_id; - ulong slave_proxy_id; - uint32 table_name_len; - /* - No need to have a catalog, as these events can only come from 4.x. - TODO: this may become false if Dmitri pushes his new LOAD DATA INFILE in - 5.0 only (not in 4.x). - */ - uint32 db_len; - uint32 fname_len; - uint32 num_fields; - const char* fields; - const uchar* field_lens; - uint32 field_block_len; - - const char* table_name; - const char* db; - const char* fname; - uint32 skip_lines; - sql_ex_info sql_ex; - bool local_fname; - /** - Indicates that this event corresponds to LOAD DATA CONCURRENT, - - @note Since Load_log_event event coming from the binary log - lacks information whether LOAD DATA on master was concurrent - or not, this flag is only set to TRUE for an auxiliary - Load_log_event object which is used in mysql_load() to - re-construct LOAD DATA statement from function parameters, - for logging. - */ - bool is_concurrent; - - /* fname doesn't point to memory inside Log_event::temp_buf */ - void set_fname_outside_temp_buf(const char *afname, size_t alen) - { - fname= afname; - fname_len= (uint)alen; - local_fname= TRUE; - } - /* fname doesn't point to memory inside Log_event::temp_buf */ - int check_fname_outside_temp_buf() - { - return local_fname; - } - -#ifdef MYSQL_SERVER - String field_lens_buf; - String fields_buf; - - Load_log_event(THD* thd, const sql_exchange* ex, const char* db_arg, - const char* table_name_arg, - List& fields_arg, - bool is_concurrent_arg, - enum enum_duplicates handle_dup, bool ignore, - bool using_trans); - void set_fields(const char* db, List &fields_arg, - Name_resolution_context *context); - const char* get_db() { return db; } -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool commented); -#endif - - /* - Note that for all the events related to LOAD DATA (Load_log_event, - Create_file/Append/Exec/Delete, we pass description_event; however as - logging of LOAD DATA is going to be changed in 4.1 or 5.0, this is only used - for the common_header_len (post_header_len will not be changed). - */ - Load_log_event(const char* buf, uint event_len, - const Format_description_log_event* description_event); - ~Load_log_event() - {} - Log_event_type get_type_code() - { - return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT; - } -#ifdef MYSQL_SERVER - bool write_data_header(); - bool write_data_body(); -#endif - bool is_valid() const { return table_name != 0; } - int get_data_size() - { - return (table_name_len + db_len + 2 + fname_len - + LOAD_HEADER_LEN - + sql_ex.data_size() + field_block_len + num_fields); - } - -public: /* !!! Public in this patch to allow old usage */ -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi) - { - return do_apply_event(thd->slave_net,rgi,0); - } - - int do_apply_event(NET *net, rpl_group_info *rgi, - bool use_rli_only_for_errors); -#endif -}; - -/** - @class Start_log_event_v3 - - Start_log_event_v3 is the Start_log_event of binlog format 3 (MySQL 3.23 and - 4.x). - - Format_description_log_event derives from Start_log_event_v3; it is - the Start_log_event of binlog format 4 (MySQL 5.0), that is, the - event that describes the other events' Common-Header/Post-Header - lengths. This event is sent by MySQL 5.0 whenever it starts sending - a new binlog if the requested position is >4 (otherwise if ==4 the - event will be sent naturally). - - @section Start_log_event_v3_binary_format Binary Format -*/ -class Start_log_event_v3: public Log_event -{ -public: - /* - If this event is at the start of the first binary log since server - startup 'created' should be the timestamp when the event (and the - binary log) was created. In the other case (i.e. this event is at - the start of a binary log created by FLUSH LOGS or automatic - rotation), 'created' should be 0. This "trick" is used by MySQL - >=4.0.14 slaves to know whether they must drop stale temporary - tables and whether they should abort unfinished transaction. - - Note that when 'created'!=0, it is always equal to the event's - timestamp; indeed Start_log_event is written only in log.cc where - the first constructor below is called, in which 'created' is set - to 'when'. So in fact 'created' is a useless variable. When it is - 0 we can read the actual value from timestamp ('when') and when it - is non-zero we can read the same value from timestamp - ('when'). Conclusion: - - we use timestamp to print when the binlog was created. - - we use 'created' only to know if this is a first binlog or not. - In 3.23.57 we did not pay attention to this identity, so mysqlbinlog in - 3.23.57 does not print 'created the_date' if created was zero. This is now - fixed. - */ - time_t created; - uint16 binlog_version; - char server_version[ST_SERVER_VER_LEN]; - /* - We set this to 1 if we don't want to have the created time in the log, - which is the case when we rollover to a new log. - */ - bool dont_set_created; - -#ifdef MYSQL_SERVER - Start_log_event_v3(); -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - Start_log_event_v3() {} - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Start_log_event_v3(const char* buf, uint event_len, - const Format_description_log_event* description_event); - ~Start_log_event_v3() {} - Log_event_type get_type_code() { return START_EVENT_V3;} - my_off_t get_header_len(my_off_t l __attribute__((unused))) - { return LOG_EVENT_MINIMAL_HEADER_LEN; } -#ifdef MYSQL_SERVER - bool write(); -#endif - bool is_valid() const { return server_version[0] != 0; } - int get_data_size() - { - return START_V3_HEADER_LEN; //no variable-sized part - } - -protected: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info*) - { - /* - Events from ourself should be skipped, but they should not - decrease the slave skip counter. - */ - if (this->server_id == global_system_variables.server_id) - return Log_event::EVENT_SKIP_IGNORE; - else - return Log_event::EVENT_SKIP_NOT; - } -#endif -}; - -/** - @class Start_encryption_log_event - - Start_encryption_log_event marks the beginning of encrypted data (all events - after this event are encrypted). - - It contains the cryptographic scheme used for the encryption as well as any - data required to decrypt (except the actual key). - - For binlog cryptoscheme 1: key version, and nonce for iv generation. -*/ -class Start_encryption_log_event : public Log_event -{ -public: -#ifdef MYSQL_SERVER - Start_encryption_log_event(uint crypto_scheme_arg, uint key_version_arg, - const uchar* nonce_arg) - : crypto_scheme(crypto_scheme_arg), key_version(key_version_arg) - { - cache_type = EVENT_NO_CACHE; - DBUG_ASSERT(crypto_scheme == 1); - memcpy(nonce, nonce_arg, BINLOG_NONCE_LENGTH); - } - - bool write_data_body() - { - uchar scheme_buf= crypto_scheme; - uchar key_version_buf[BINLOG_KEY_VERSION_LENGTH]; - int4store(key_version_buf, key_version); - return write_data(&scheme_buf, sizeof(scheme_buf)) || - write_data(key_version_buf, sizeof(key_version_buf)) || - write_data(nonce, BINLOG_NONCE_LENGTH); - } -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Start_encryption_log_event( - const char* buf, uint event_len, - const Format_description_log_event* description_event); - - bool is_valid() const { return crypto_scheme == 1; } - - Log_event_type get_type_code() { return START_ENCRYPTION_EVENT; } - - int get_data_size() - { - return BINLOG_CRYPTO_SCHEME_LENGTH + BINLOG_KEY_VERSION_LENGTH + - BINLOG_NONCE_LENGTH; - } - - uint crypto_scheme; - uint key_version; - uchar nonce[BINLOG_NONCE_LENGTH]; - -protected: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info* rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info* rgi) - { - return Log_event::EVENT_SKIP_NOT; - } -#endif - -}; - - -class Version -{ -protected: - uchar m_ver[3]; - int cmp(const Version &other) const - { - return memcmp(m_ver, other.m_ver, 3); - } -public: - Version() - { - m_ver[0]= m_ver[1]= m_ver[2]= '\0'; - } - Version(uchar v0, uchar v1, uchar v2) - { - m_ver[0]= v0; - m_ver[1]= v1; - m_ver[2]= v2; - } - Version(const char *version, const char **endptr); - const uchar& operator [] (size_t i) const - { - DBUG_ASSERT(i < 3); - return m_ver[i]; - } - bool operator<(const Version &other) const { return cmp(other) < 0; } - bool operator>(const Version &other) const { return cmp(other) > 0; } - bool operator<=(const Version &other) const { return cmp(other) <= 0; } - bool operator>=(const Version &other) const { return cmp(other) >= 0; } -}; - - -/** - @class Format_description_log_event - - For binlog version 4. - This event is saved by threads which read it, as they need it for future - use (to decode the ordinary events). - - @section Format_description_log_event_binary_format Binary Format -*/ - -class Format_description_log_event: public Start_log_event_v3 -{ -public: - /* - The size of the fixed header which _all_ events have - (for binlogs written by this version, this is equal to - LOG_EVENT_HEADER_LEN), except FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT - (those have a header of size LOG_EVENT_MINIMAL_HEADER_LEN). - */ - uint8 common_header_len; - uint8 number_of_event_types; - /* - The list of post-headers' lengths followed - by the checksum alg description byte - */ - uint8 *post_header_len; - class master_version_split: public Version { - public: - enum {KIND_MYSQL, KIND_MARIADB}; - int kind; - master_version_split() :kind(KIND_MARIADB) { } - master_version_split(const char *version); - bool version_is_valid() const - { - /* It is invalid only when all version numbers are 0 */ - return !(m_ver[0] == 0 && m_ver[1] == 0 && m_ver[2] == 0); - } - }; - master_version_split server_version_split; - const uint8 *event_type_permutation; - - Format_description_log_event(uint8 binlog_ver, const char* server_ver=0); - Format_description_log_event(const char* buf, uint event_len, - const Format_description_log_event - *description_event); - ~Format_description_log_event() - { - my_free(post_header_len); - } - Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;} -#ifdef MYSQL_SERVER - bool write(); -#endif - bool header_is_valid() const - { - return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN : - LOG_EVENT_MINIMAL_HEADER_LEN)) && - (post_header_len != NULL)); - } - - bool is_valid() const - { - return header_is_valid() && server_version_split.version_is_valid(); - } - - int get_data_size() - { - /* - The vector of post-header lengths is considered as part of the - post-header, because in a given version it never changes (contrary to the - query in a Query_log_event). - */ - return FORMAT_DESCRIPTION_HEADER_LEN; - } - - Binlog_crypt_data crypto_data; - bool start_decryption(Start_encryption_log_event* sele); - void copy_crypto_data(const Format_description_log_event* o) - { - crypto_data= o->crypto_data; - } - void reset_crypto() - { - crypto_data.scheme= 0; - } - - void calc_server_version_split(); - static bool is_version_before_checksum(const master_version_split *version_split); -protected: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif -}; - - -/** - @class Intvar_log_event - - An Intvar_log_event will be created just before a Query_log_event, - if the query uses one of the variables LAST_INSERT_ID or INSERT_ID. - Each Intvar_log_event holds the value of one of these variables. - - @section Intvar_log_event_binary_format Binary Format - - The Post-Header for this event type is empty. The Body has two - components: - - - - - - - - - - - - - - - - - - - - - - -
Body for Intvar_log_event
NameFormatDescription
type1 byte enumerationOne byte identifying the type of variable stored. Currently, - two identifiers are supported: LAST_INSERT_ID_EVENT==1 and - INSERT_ID_EVENT==2. -
value8 byte unsigned integerThe value of the variable.
-*/ -class Intvar_log_event: public Log_event -{ -public: - ulonglong val; - uchar type; - -#ifdef MYSQL_SERVER -Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg, - bool using_trans, bool direct) - :Log_event(thd_arg,0,using_trans),val(val_arg),type(type_arg) - { - if (direct) - cache_type= Log_event::EVENT_NO_CACHE; - } -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Intvar_log_event(const char* buf, - const Format_description_log_event *description_event); - ~Intvar_log_event() {} - Log_event_type get_type_code() { return INTVAR_EVENT;} - const char* get_var_type_name(); - int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;} -#ifdef MYSQL_SERVER - bool write(); -#endif - bool is_valid() const { return 1; } - bool is_part_of_group() { return 1; } - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif -}; - - -/** - @class Rand_log_event - - Logs random seed used by the next RAND(), and by PASSWORD() in 4.1.0. - 4.1.1 does not need it (it's repeatable again) so this event needn't be - written in 4.1.1 for PASSWORD() (but the fact that it is written is just a - waste, it does not cause bugs). - - The state of the random number generation consists of 128 bits, - which are stored internally as two 64-bit numbers. - - @section Rand_log_event_binary_format Binary Format - - The Post-Header for this event type is empty. The Body has two - components: - - - - - - - - - - - - - - - - - - - - - -
Body for Rand_log_event
NameFormatDescription
seed18 byte unsigned integer64 bit random seed1.
seed28 byte unsigned integer64 bit random seed2.
-*/ - -class Rand_log_event: public Log_event -{ - public: - ulonglong seed1; - ulonglong seed2; - -#ifdef MYSQL_SERVER - Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg, - bool using_trans, bool direct) - :Log_event(thd_arg,0,using_trans),seed1(seed1_arg),seed2(seed2_arg) - { - if (direct) - cache_type= Log_event::EVENT_NO_CACHE; - } -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Rand_log_event(const char* buf, - const Format_description_log_event *description_event); - ~Rand_log_event() {} - Log_event_type get_type_code() { return RAND_EVENT;} - int get_data_size() { return 16; /* sizeof(ulonglong) * 2*/ } -#ifdef MYSQL_SERVER - bool write(); -#endif - bool is_valid() const { return 1; } - bool is_part_of_group() { return 1; } - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif -}; - - -class Xid_apply_log_event: public Log_event -{ -public: -#ifdef MYSQL_SERVER - Xid_apply_log_event(THD* thd_arg): - Log_event(thd_arg, 0, TRUE) {} -#endif - Xid_apply_log_event(const char* buf, - const Format_description_log_event *description_event): - Log_event(buf, description_event) {} - - ~Xid_apply_log_event() {} - bool is_valid() const { return 1; } -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_commit()= 0; - virtual int do_apply_event(rpl_group_info *rgi); - int do_record_gtid(THD *thd, rpl_group_info *rgi, bool in_trans, - void **out_hton); - enum_skip_reason do_shall_skip(rpl_group_info *rgi); - virtual const char* get_query()= 0; -#endif -}; - - -/** - @class Xid_log_event - - Logs xid of the transaction-to-be-committed in the 2pc protocol. - Has no meaning in replication, slaves ignore it. - - @section Xid_log_event_binary_format Binary Format -*/ -#ifdef MYSQL_CLIENT -typedef ulonglong my_xid; // this line is the same as in handler.h -#endif - -class Xid_log_event: public Xid_apply_log_event -{ -public: - my_xid xid; - -#ifdef MYSQL_SERVER - Xid_log_event(THD* thd_arg, my_xid x, bool direct): - Xid_apply_log_event(thd_arg), xid(x) - { - if (direct) - cache_type= Log_event::EVENT_NO_CACHE; - } - const char* get_query() - { - return "COMMIT /* implicit, from Xid_log_event */"; - } -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Xid_log_event(const char* buf, - const Format_description_log_event *description_event); - ~Xid_log_event() {} - Log_event_type get_type_code() { return XID_EVENT;} - int get_data_size() { return sizeof(xid); } -#ifdef MYSQL_SERVER - bool write(); -#endif - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - int do_commit(); -#endif -}; - - -/** - @class XA_prepare_log_event - - Similar to Xid_log_event except that - - it is specific to XA transaction - - it carries out the prepare logics rather than the final committing - when @c one_phase member is off. The latter option is only for - compatibility with the upstream. - - From the groupping perspective the event finalizes the current - "prepare" group that is started with Gtid_log_event similarly to the - regular replicated transaction. -*/ - -/** - Function serializes XID which is characterized by by four last arguments - of the function. - Serialized XID is presented in valid hex format and is returned to - the caller in a buffer pointed by the first argument. - The buffer size provived by the caller must be not less than - 8 + 2 * XIDDATASIZE + 4 * sizeof(XID::formatID) + 1, see - {MYSQL_,}XID definitions. - - @param buf pointer to a buffer allocated for storing serialized data - @param fmt formatID value - @param gln gtrid_length value - @param bln bqual_length value - @param dat data value - - @return the value of the buffer pointer -*/ - -inline char *serialize_xid(char *buf, long fmt, long gln, long bln, - const char *dat) -{ - int i; - char *c= buf; - /* - Build a string consisting of the hex format representation of XID - as passed through fmt,gln,bln,dat argument: - X'hex11hex12...hex1m',X'hex21hex22...hex2n',11 - and store it into buf. - */ - c[0]= 'X'; - c[1]= '\''; - c+= 2; - for (i= 0; i < gln; i++) - { - c[0]=_dig_vec_lower[((uchar*) dat)[i] >> 4]; - c[1]=_dig_vec_lower[((uchar*) dat)[i] & 0x0f]; - c+= 2; - } - c[0]= '\''; - c[1]= ','; - c[2]= 'X'; - c[3]= '\''; - c+= 4; - - for (; i < gln + bln; i++) - { - c[0]=_dig_vec_lower[((uchar*) dat)[i] >> 4]; - c[1]=_dig_vec_lower[((uchar*) dat)[i] & 0x0f]; - c+= 2; - } - c[0]= '\''; - sprintf(c+1, ",%lu", fmt); - - return buf; -} - -/* - The size of the string containing serialized Xid representation - is computed as a sum of - eight as the number of formatting symbols (X'',X'',) - plus 2 x XIDDATASIZE (2 due to hex format), - plus space for decimal digits of XID::formatID, - plus one for 0x0. -*/ -static const uint ser_buf_size= - 8 + 2 * MYSQL_XIDDATASIZE + 4 * sizeof(long) + 1; - -struct event_mysql_xid_t : MYSQL_XID -{ - char buf[ser_buf_size]; - char *serialize() - { - return serialize_xid(buf, formatID, gtrid_length, bqual_length, data); - } -}; - -#ifndef MYSQL_CLIENT -struct event_xid_t : XID -{ - char buf[ser_buf_size]; - - char *serialize(char *buf_arg) - { - return serialize_xid(buf_arg, formatID, gtrid_length, bqual_length, data); - } - char *serialize() - { - return serialize(buf); - } -}; -#endif - -class XA_prepare_log_event: public Xid_apply_log_event -{ -protected: - - /* Constant contributor to subheader in write() by members of XID struct. */ - static const int xid_subheader_no_data= 12; - event_mysql_xid_t m_xid; - void *xid; - bool one_phase; - -public: -#ifdef MYSQL_SERVER - XA_prepare_log_event(THD* thd_arg, XID *xid_arg, bool one_phase_arg): - Xid_apply_log_event(thd_arg), xid(xid_arg), one_phase(one_phase_arg) - { - cache_type= Log_event::EVENT_NO_CACHE; - } -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - XA_prepare_log_event(const char* buf, - const Format_description_log_event *description_event); - ~XA_prepare_log_event() {} - Log_event_type get_type_code() { return XA_PREPARE_LOG_EVENT; } - bool is_valid() const { return m_xid.formatID != -1; } - int get_data_size() - { - return xid_subheader_no_data + m_xid.gtrid_length + m_xid.bqual_length; - } - -#ifdef MYSQL_SERVER - bool write(); -#endif - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - char query[sizeof("XA COMMIT ONE PHASE") + 1 + ser_buf_size]; - int do_commit(); - const char* get_query() - { - sprintf(query, - (one_phase ? "XA COMMIT %s ONE PHASE" : "XA PREPARE %s"), - m_xid.serialize()); - return query; - } -#endif -}; - - -/** - @class User_var_log_event - - Every time a query uses the value of a user variable, a User_var_log_event is - written before the Query_log_event, to set the user variable. - - @section User_var_log_event_binary_format Binary Format -*/ - -class User_var_log_event: public Log_event -{ -public: - enum { - UNDEF_F= 0, - UNSIGNED_F= 1 - }; - const char *name; - size_t name_len; - const char *val; - size_t val_len; - Item_result type; - uint charset_number; - bool is_null; - uchar flags; -#ifdef MYSQL_SERVER - bool deferred; - query_id_t query_id; - User_var_log_event(THD* thd_arg, const char *name_arg, size_t name_len_arg, - const char *val_arg, size_t val_len_arg, Item_result type_arg, - uint charset_number_arg, uchar flags_arg, - bool using_trans, bool direct) - :Log_event(thd_arg, 0, using_trans), - name(name_arg), name_len(name_len_arg), val(val_arg), - val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg), - flags(flags_arg), deferred(false) - { - is_null= !val; - if (direct) - cache_type= Log_event::EVENT_NO_CACHE; - } - void pack_info(Protocol* protocol); -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - User_var_log_event(const char* buf, uint event_len, - const Format_description_log_event *description_event); - ~User_var_log_event() {} - Log_event_type get_type_code() { return USER_VAR_EVENT;} -#ifdef MYSQL_SERVER - bool write(); - /* - Getter and setter for deferred User-event. - Returns true if the event is not applied directly - and which case the applier adjusts execution path. - */ - bool is_deferred() { return deferred; } - /* - In case of the deferred applying the variable instance is flagged - and the parsing time query id is stored to be used at applying time. - */ - void set_deferred(query_id_t qid) { deferred= true; query_id= qid; } -#endif - bool is_valid() const { return name != 0; } - bool is_part_of_group() { return 1; } - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif -}; - - -/** - @class Stop_log_event - - @section Stop_log_event_binary_format Binary Format - - The Post-Header and Body for this event type are empty; it only has - the Common-Header. -*/ -class Stop_log_event: public Log_event -{ -public: -#ifdef MYSQL_SERVER - Stop_log_event() :Log_event() - {} -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Stop_log_event(const char* buf, - const Format_description_log_event *description_event): - Log_event(buf, description_event) - {} - ~Stop_log_event() {} - Log_event_type get_type_code() { return STOP_EVENT;} - bool is_valid() const { return 1; } - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi) - { - /* - Events from ourself should be skipped, but they should not - decrease the slave skip counter. - */ - if (this->server_id == global_system_variables.server_id) - return Log_event::EVENT_SKIP_IGNORE; - else - return Log_event::EVENT_SKIP_NOT; - } -#endif -}; - -/** - @class Rotate_log_event - - This will be deprecated when we move to using sequence ids. - - @section Rotate_log_event_binary_format Binary Format - - The Post-Header has one component: - - - - - - - - - - - - - - - - -
Post-Header for Rotate_log_event
NameFormatDescription
position8 byte integerThe position within the binlog to rotate to.
- - The Body has one component: - - - - - - - - - - - - - - - - -
Body for Rotate_log_event
NameFormatDescription
new_logvariable length string without trailing zero, extending to the - end of the event (determined by the length field of the - Common-Header) - Name of the binlog to rotate to.
-*/ - -class Rotate_log_event: public Log_event -{ -public: - enum { - DUP_NAME= 2, // if constructor should dup the string argument - RELAY_LOG=4 // rotate event for relay log - }; - const char* new_log_ident; - ulonglong pos; - uint ident_len; - uint flags; -#ifdef MYSQL_SERVER - Rotate_log_event(const char* new_log_ident_arg, - uint ident_len_arg, - ulonglong pos_arg, uint flags); -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Rotate_log_event(const char* buf, uint event_len, - const Format_description_log_event* description_event); - ~Rotate_log_event() - { - if (flags & DUP_NAME) - my_free((void*) new_log_ident); - } - Log_event_type get_type_code() { return ROTATE_EVENT;} - my_off_t get_header_len(my_off_t l __attribute__((unused))) - { return LOG_EVENT_MINIMAL_HEADER_LEN; } - int get_data_size() { return ident_len + ROTATE_HEADER_LEN;} - bool is_valid() const { return new_log_ident != 0; } -#ifdef MYSQL_SERVER - bool write(); -#endif - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif -}; - - -class Binlog_checkpoint_log_event: public Log_event -{ -public: - char *binlog_file_name; - uint binlog_file_len; - -#ifdef MYSQL_SERVER - Binlog_checkpoint_log_event(const char *binlog_file_name_arg, - uint binlog_file_len_arg); -#ifdef HAVE_REPLICATION - void pack_info(Protocol *protocol); -#endif -#else - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - Binlog_checkpoint_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); - ~Binlog_checkpoint_log_event() { my_free(binlog_file_name); } - Log_event_type get_type_code() { return BINLOG_CHECKPOINT_EVENT;} - int get_data_size() { return binlog_file_len + BINLOG_CHECKPOINT_HEADER_LEN;} - bool is_valid() const { return binlog_file_name != 0; } -#ifdef MYSQL_SERVER - bool write(); - enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif -}; - - -/** - @class Gtid_log_event - - This event is logged as part of every event group to give the global - transaction id (GTID) of that group. - - It replaces the BEGIN query event used in earlier versions to begin most - event groups, but is also used for events that used to be stand-alone. - - @section Gtid_log_event_binary_format Binary Format - - The binary format for Gtid_log_event has 6 extra reserved bytes to make the - length a total of 19 byte (+ 19 bytes of header in common with all events). - This is just the minimal size for a BEGIN query event, which makes it easy - to replace this event with such BEGIN event to remain compatible with old - slave servers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Post-Header
NameFormatDescription
seq_no8 byte unsigned integerincreasing id within one server_id. Starts at 1, holes in the sequence - may occur
domain_id4 byte unsigned integerReplication domain id, identifying independent replication streams>
flags1 byte bitfieldBit 0 set indicates stand-alone event (no terminating COMMIT)Bit 1 set indicates group commit, and that commit id existsBit 2 set indicates a transactional event group (can be safely rolled - back).Bit 3 set indicates that user allowed optimistic parallel apply (the - @@SESSION.replicate_allow_parallel value was true at commit).Bit 4 set indicates that this transaction encountered a row (or other) - lock wait during execution.
Reserved (no group commit) / commit id (group commit) (see flags bit 1)6 bytes / 8 bytesReserved bytes, set to 0. Maybe be used for future expansion (no - group commit). OR commit id, same for all GTIDs in the same group - commit (see flags bit 1).
- - The Body of Gtid_log_event is empty. The total event size is 19 bytes + - the normal 19 bytes common-header. -*/ - -class Gtid_log_event: public Log_event -{ -public: - uint64 seq_no; - uint64 commit_id; - uint32 domain_id; -#ifdef MYSQL_SERVER - event_xid_t xid; -#else - event_mysql_xid_t xid; -#endif - uchar flags2; - /* Flags2. */ - - /* FL_STANDALONE is set when there is no terminating COMMIT event. */ - static const uchar FL_STANDALONE= 1; - /* - FL_GROUP_COMMIT_ID is set when event group is part of a group commit on the - master. Groups with same commit_id are part of the same group commit. - */ - static const uchar FL_GROUP_COMMIT_ID= 2; - /* - FL_TRANSACTIONAL is set for an event group that can be safely rolled back - (no MyISAM, eg.). - */ - static const uchar FL_TRANSACTIONAL= 4; - /* - FL_ALLOW_PARALLEL reflects the (negation of the) value of - @@SESSION.skip_parallel_replication at the time of commit. - */ - static const uchar FL_ALLOW_PARALLEL= 8; - /* - FL_WAITED is set if a row lock wait (or other wait) is detected during the - execution of the transaction. - */ - static const uchar FL_WAITED= 16; - /* FL_DDL is set for event group containing DDL. */ - static const uchar FL_DDL= 32; - /* FL_PREPARED_XA is set for XA transaction. */ - static const uchar FL_PREPARED_XA= 64; - /* FL_"COMMITTED or ROLLED-BACK"_XA is set for XA transaction. */ - static const uchar FL_COMPLETED_XA= 128; - -#ifdef MYSQL_SERVER - Gtid_log_event(THD *thd_arg, uint64 seq_no, uint32 domain_id, bool standalone, - uint16 flags, bool is_transactional, uint64 commit_id); -#ifdef HAVE_REPLICATION - void pack_info(Protocol *protocol); - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif -#else - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - Gtid_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); - ~Gtid_log_event() { } - Log_event_type get_type_code() { return GTID_EVENT; } - enum_logged_status logged_status() { return LOGGED_NO_DATA; } - int get_data_size() - { - return GTID_HEADER_LEN + ((flags2 & FL_GROUP_COMMIT_ID) ? 2 : 0); - } - bool is_valid() const { return seq_no != 0; } -#ifdef MYSQL_SERVER - bool write(); - static int make_compatible_event(String *packet, bool *need_dummy_event, - ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); - static bool peek(const char *event_start, size_t event_len, - enum enum_binlog_checksum_alg checksum_alg, - uint32 *domain_id, uint32 *server_id, uint64 *seq_no, - uchar *flags2, const Format_description_log_event *fdev); -#endif -}; - - -/** - @class Gtid_list_log_event - - This event is logged at the start of every binlog file to record the - current replication state: the last global transaction id (GTID) applied - on the server within each replication domain. - - It consists of a list of GTIDs, one for each replication domain ever seen - on the server. - - @section Gtid_list_log_event_binary_format Binary Format - - - - - - - - - - - - - - - -
Post-Header
NameFormatDescription
count4 byte unsigned integerThe lower 28 bits are the number of GTIDs. The upper 4 bits are - flags bits.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Body
NameFormatDescription
domain_id4 byte unsigned integerReplication domain id of one GTID
server_id4 byte unsigned integerServer id of one GTID
seq_no8 byte unsigned integersequence number of one GTID
- - The three elements in the body repeat COUNT times to form the GTID list. - - At the time of writing, only two flag bit are in use. - - Bit 28 of `count' is used for flag FLAG_UNTIL_REACHED, which is sent in a - Gtid_list event from the master to the slave to indicate that the START - SLAVE UNTIL master_gtid_pos=xxx condition has been reached. (This flag is - only sent in "fake" events generated on the fly, it is not written into - the binlog). -*/ - -class Gtid_list_log_event: public Log_event -{ -public: - uint32 count; - uint32 gl_flags; - struct rpl_gtid *list; - uint64 *sub_id_list; - - static const uint element_size= 4+4+8; - /* Upper bits stored in 'count'. See comment above */ - enum gtid_flags - { - FLAG_UNTIL_REACHED= (1<<28), - FLAG_IGN_GTIDS= (1<<29), - }; -#ifdef MYSQL_SERVER - Gtid_list_log_event(rpl_binlog_state *gtid_set, uint32 gl_flags); - Gtid_list_log_event(slave_connection_state *gtid_set, uint32 gl_flags); -#ifdef HAVE_REPLICATION - void pack_info(Protocol *protocol); -#endif -#else - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - Gtid_list_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); - ~Gtid_list_log_event() { my_free(list); my_free(sub_id_list); } - Log_event_type get_type_code() { return GTID_LIST_EVENT; } - int get_data_size() { - /* - Replacing with dummy event, needed for older slaves, requires a minimum - of 6 bytes in the body. - */ - return (count==0 ? - GTID_LIST_HEADER_LEN+2 : GTID_LIST_HEADER_LEN+count*element_size); - } - bool is_valid() const { return list != NULL; } -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - bool to_packet(String *packet); - bool write(); - virtual int do_apply_event(rpl_group_info *rgi); - enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif - static bool peek(const char *event_start, size_t event_len, - enum enum_binlog_checksum_alg checksum_alg, - rpl_gtid **out_gtid_list, uint32 *out_list_len, - const Format_description_log_event *fdev); -}; - - -/* the classes below are for the new LOAD DATA INFILE logging */ - -/** - @class Create_file_log_event - - @section Create_file_log_event_binary_format Binary Format -*/ - -class Create_file_log_event: public Load_log_event -{ -protected: - /* - Pretend we are Load event, so we can write out just - our Load part - used on the slave when writing event out to - SQL_LOAD-*.info file - */ - bool fake_base; -public: - uchar* block; - const char *event_buf; - uint block_len; - uint file_id; - bool inited_from_old; - -#ifdef MYSQL_SERVER - Create_file_log_event(THD* thd, sql_exchange* ex, const char* db_arg, - const char* table_name_arg, - List& fields_arg, - bool is_concurrent_arg, - enum enum_duplicates handle_dup, bool ignore, - uchar* block_arg, uint block_len_arg, - bool using_trans); -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, - bool enable_local); -#endif - - Create_file_log_event(const char* buf, uint event_len, - const Format_description_log_event* description_event); - ~Create_file_log_event() - { - my_free((void*) event_buf); - } - - Log_event_type get_type_code() - { - return fake_base ? Load_log_event::get_type_code() : CREATE_FILE_EVENT; - } - int get_data_size() - { - return (fake_base ? Load_log_event::get_data_size() : - Load_log_event::get_data_size() + - 4 + 1 + block_len); - } - bool is_valid() const { return inited_from_old || block != 0; } -#ifdef MYSQL_SERVER - bool write_data_header(); - bool write_data_body(); - /* - Cut out Create_file extensions and - write it as Load event - used on the slave - */ - bool write_base(); -#endif - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); -#endif -}; - - -/** - @class Append_block_log_event - - @section Append_block_log_event_binary_format Binary Format -*/ - -class Append_block_log_event: public Log_event -{ -public: - uchar* block; - uint block_len; - uint file_id; - /* - 'db' is filled when the event is created in mysql_load() (the - event needs to have a 'db' member to be well filtered by - binlog-*-db rules). 'db' is not written to the binlog (it's not - used by Append_block_log_event::write()), so it can't be read in - the Append_block_log_event(const char* buf, int event_len) - constructor. In other words, 'db' is used only for filtering by - binlog-*-db rules. Create_file_log_event is different: it's 'db' - (which is inherited from Load_log_event) is written to the binlog - and can be re-read. - */ - const char* db; - -#ifdef MYSQL_SERVER - Append_block_log_event(THD* thd, const char* db_arg, uchar* block_arg, - uint block_len_arg, bool using_trans); -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); - virtual int get_create_or_append() const; -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Append_block_log_event(const char* buf, uint event_len, - const Format_description_log_event - *description_event); - ~Append_block_log_event() {} - Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;} - int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;} - bool is_valid() const { return block != 0; } -#ifdef MYSQL_SERVER - bool write(); - const char* get_db() { return db; } -#endif - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); -#endif -}; - - -/** - @class Delete_file_log_event - - @section Delete_file_log_event_binary_format Binary Format -*/ - -class Delete_file_log_event: public Log_event -{ -public: - uint file_id; - const char* db; /* see comment in Append_block_log_event */ - -#ifdef MYSQL_SERVER - Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans); -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, - bool enable_local); -#endif - - Delete_file_log_event(const char* buf, uint event_len, - const Format_description_log_event* description_event); - ~Delete_file_log_event() {} - Log_event_type get_type_code() { return DELETE_FILE_EVENT;} - int get_data_size() { return DELETE_FILE_HEADER_LEN ;} - bool is_valid() const { return file_id != 0; } -#ifdef MYSQL_SERVER - bool write(); - const char* get_db() { return db; } -#endif - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); -#endif -}; - - -/** - @class Execute_load_log_event - - @section Delete_file_log_event_binary_format Binary Format -*/ - -class Execute_load_log_event: public Log_event -{ -public: - uint file_id; - const char* db; /* see comment in Append_block_log_event */ - -#ifdef MYSQL_SERVER - Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans); -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); -#endif - - Execute_load_log_event(const char* buf, uint event_len, - const Format_description_log_event - *description_event); - ~Execute_load_log_event() {} - Log_event_type get_type_code() { return EXEC_LOAD_EVENT;} - int get_data_size() { return EXEC_LOAD_HEADER_LEN ;} - bool is_valid() const { return file_id != 0; } -#ifdef MYSQL_SERVER - bool write(); - const char* get_db() { return db; } -#endif - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); -#endif -}; - - -/** - @class Begin_load_query_log_event - - Event for the first block of file to be loaded, its only difference from - Append_block event is that this event creates or truncates existing file - before writing data. - - @section Begin_load_query_log_event_binary_format Binary Format -*/ -class Begin_load_query_log_event: public Append_block_log_event -{ -public: -#ifdef MYSQL_SERVER - Begin_load_query_log_event(THD* thd_arg, const char *db_arg, - uchar* block_arg, uint block_len_arg, - bool using_trans); -#ifdef HAVE_REPLICATION - Begin_load_query_log_event(THD* thd); - int get_create_or_append() const; -#endif /* HAVE_REPLICATION */ -#endif - Begin_load_query_log_event(const char* buf, uint event_len, - const Format_description_log_event - *description_event); - ~Begin_load_query_log_event() {} - Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; } -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif -}; - - -/* - Elements of this enum describe how LOAD DATA handles duplicates. -*/ -enum enum_load_dup_handling { LOAD_DUP_ERROR= 0, LOAD_DUP_IGNORE, - LOAD_DUP_REPLACE }; - -/** - @class Execute_load_query_log_event - - Event responsible for LOAD DATA execution, it similar to Query_log_event - but before executing the query it substitutes original filename in LOAD DATA - query with name of temporary file. - - @section Execute_load_query_log_event_binary_format Binary Format -*/ -class Execute_load_query_log_event: public Query_log_event -{ -public: - uint file_id; // file_id of temporary file - uint fn_pos_start; // pointer to the part of the query that should - // be substituted - uint fn_pos_end; // pointer to the end of this part of query - /* - We have to store type of duplicate handling explicitly, because - for LOAD DATA it also depends on LOCAL option. And this part - of query will be rewritten during replication so this information - may be lost... - */ - enum_load_dup_handling dup_handling; - -#ifdef MYSQL_SERVER - Execute_load_query_log_event(THD* thd, const char* query_arg, - ulong query_length, uint fn_pos_start_arg, - uint fn_pos_end_arg, - enum_load_dup_handling dup_handling_arg, - bool using_trans, bool direct, - bool suppress_use, int errcode); -#ifdef HAVE_REPLICATION - void pack_info(Protocol* protocol); -#endif /* HAVE_REPLICATION */ -#else - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); - /* Prints the query as LOAD DATA LOCAL and with rewritten filename */ - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info, - const char *local_fname); -#endif - Execute_load_query_log_event(const char* buf, uint event_len, - const Format_description_log_event - *description_event); - ~Execute_load_query_log_event() {} - - Log_event_type get_type_code() { return EXECUTE_LOAD_QUERY_EVENT; } - bool is_valid() const { return Query_log_event::is_valid() && file_id != 0; } - - ulong get_post_header_size_for_derived(); -#ifdef MYSQL_SERVER - bool write_post_header_for_derived(); -#endif - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); -#endif -}; - - -#ifdef MYSQL_CLIENT -/** - @class Unknown_log_event - - @section Unknown_log_event_binary_format Binary Format -*/ -class Unknown_log_event: public Log_event -{ -public: - enum { UNKNOWN, ENCRYPTED } what; - /* - Even if this is an unknown event, we still pass description_event to - Log_event's ctor, this way we can extract maximum information from the - event's header (the unique ID for example). - */ - Unknown_log_event(const char* buf, - const Format_description_log_event *description_event): - Log_event(buf, description_event), what(UNKNOWN) - {} - /* constructor for hopelessly corrupted events */ - Unknown_log_event(): Log_event(), what(ENCRYPTED) {} - ~Unknown_log_event() {} - bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); - Log_event_type get_type_code() { return UNKNOWN_EVENT;} - bool is_valid() const { return 1; } -}; -#endif -char *str_to_hex(char *to, const char *from, size_t len); - -/** - @class Annotate_rows_log_event - - In row-based mode, if binlog_annotate_row_events = ON, each group of - Table_map_log_events is preceded by an Annotate_rows_log_event which - contains the query which caused the subsequent rows operations. - - The Annotate_rows_log_event has no post-header and its body contains - the corresponding query (without trailing zero). Note. The query length - is to be calculated as a difference between the whole event length and - the common header length. -*/ -class Annotate_rows_log_event: public Log_event -{ -public: -#ifndef MYSQL_CLIENT - Annotate_rows_log_event(THD*, bool using_trans, bool direct); -#endif - Annotate_rows_log_event(const char *buf, uint event_len, - const Format_description_log_event*); - ~Annotate_rows_log_event(); - - virtual int get_data_size(); - virtual Log_event_type get_type_code(); - enum_logged_status logged_status() { return LOGGED_NO_DATA; } - virtual bool is_valid() const; - virtual bool is_part_of_group() { return 1; } - -#ifndef MYSQL_CLIENT - virtual bool write_data_header(); - virtual bool write_data_body(); -#endif - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual void pack_info(Protocol*); -#endif - -#ifdef MYSQL_CLIENT - virtual bool print(FILE*, PRINT_EVENT_INFO*); -#endif - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) -private: - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info*); -#endif - -private: - char *m_query_txt; - uint m_query_len; - char *m_save_thd_query_txt; - uint m_save_thd_query_len; - bool m_saved_thd_query; - bool m_used_query_txt; -}; - -/** - @class Table_map_log_event - - In row-based mode, every row operation event is preceded by a - Table_map_log_event which maps a table definition to a number. The - table definition consists of database name, table name, and column - definitions. - - @section Table_map_log_event_binary_format Binary Format - - The Post-Header has the following components: - - - - - - - - - - - - - - - - - - - - - - -
Post-Header for Table_map_log_event
NameFormatDescription
table_id6 bytes unsigned integerThe number that identifies the table.
flags2 byte bitfieldReserved for future use; currently always 0.
- - The Body has the following components: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Body for Table_map_log_event
NameFormatDescription
database_nameone byte string length, followed by null-terminated stringThe name of the database in which the table resides. The name - is represented as a one byte unsigned integer representing the - number of bytes in the name, followed by length bytes containing - the database name, followed by a terminating 0 byte. (Note the - redundancy in the representation of the length.)
table_nameone byte string length, followed by null-terminated stringThe name of the table, encoded the same way as the database - name above.
column_count@ref packed_integer "Packed Integer"The number of columns in the table, represented as a packed - variable-length integer.
column_typeList of column_count 1 byte enumeration valuesThe type of each column in the table, listed from left to - right. Each byte is mapped to a column type according to the - enumeration type enum_field_types defined in mysql_com.h. The - mapping of types to numbers is listed in the table @ref - Table_table_map_log_event_column_types "below" (along with - description of the associated metadata field).
metadata_length@ref packed_integer "Packed Integer"The length of the following metadata block
metadatalist of metadata for each columnFor each column from left to right, a chunk of data who's - length and semantics depends on the type of the column. The - length and semantics for the metadata for each column are listed - in the table @ref Table_table_map_log_event_column_types - "below".
null_bitscolumn_count bits, rounded up to nearest byteFor each column, a bit indicating whether data in the column - can be NULL or not. The number of bytes needed for this is - int((column_count+7)/8). The flag for the first column from the - left is in the least-significant bit of the first byte, the second - is in the second least significant bit of the first byte, the - ninth is in the least significant bit of the second byte, and so - on.
optional metadata fieldsoptional metadata fields are stored in Type, Length, Value(TLV) format. - Type takes 1 byte. Length is a packed integer value. Values takes - Length bytes. - There are some optional metadata defined. They are listed in the table - @ref Table_table_map_event_optional_metadata. Optional metadata fields - follow null_bits. Whether binlogging an optional metadata is decided by the - server. The order is not defined, so they can be binlogged in any order. -
- - The table below lists all column types, along with the numerical - identifier for it and the size and interpretation of meta-data used - to describe the type. - - @anchor Table_table_map_log_event_column_types - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Table_map_log_event column types: numerical identifier and - metadata
NameIdentifierSize of metadata in bytesDescription of metadata
MYSQL_TYPE_DECIMAL00No column metadata.
MYSQL_TYPE_TINY10No column metadata.
MYSQL_TYPE_SHORT20No column metadata.
MYSQL_TYPE_LONG30No column metadata.
MYSQL_TYPE_FLOAT41 byte1 byte unsigned integer, representing the "pack_length", which - is equal to sizeof(float) on the server from which the event - originates.
MYSQL_TYPE_DOUBLE51 byte1 byte unsigned integer, representing the "pack_length", which - is equal to sizeof(double) on the server from which the event - originates.
MYSQL_TYPE_NULL60No column metadata.
MYSQL_TYPE_TIMESTAMP70No column metadata.
MYSQL_TYPE_LONGLONG80No column metadata.
MYSQL_TYPE_INT2490No column metadata.
MYSQL_TYPE_DATE100No column metadata.
MYSQL_TYPE_TIME110No column metadata.
MYSQL_TYPE_DATETIME120No column metadata.
MYSQL_TYPE_YEAR130No column metadata.
MYSQL_TYPE_NEWDATE14This enumeration value is only used internally and cannot - exist in a binlog.
MYSQL_TYPE_VARCHAR152 bytes2 byte unsigned integer representing the maximum length of - the string.
MYSQL_TYPE_BIT162 bytesA 1 byte unsigned int representing the length in bits of the - bitfield (0 to 64), followed by a 1 byte unsigned int - representing the number of bytes occupied by the bitfield. The - number of bytes is either int((length+7)/8) or int(length/8).
MYSQL_TYPE_NEWDECIMAL2462 bytesA 1 byte unsigned int representing the precision, followed - by a 1 byte unsigned int representing the number of decimals.
MYSQL_TYPE_ENUM247This enumeration value is only used internally and cannot - exist in a binlog.
MYSQL_TYPE_SET248This enumeration value is only used internally and cannot - exist in a binlog.
MYSQL_TYPE_TINY_BLOB249This enumeration value is only used internally and cannot - exist in a binlog.
MYSQL_TYPE_MEDIUM_BLOB250This enumeration value is only used internally and cannot - exist in a binlog.
MYSQL_TYPE_LONG_BLOB251This enumeration value is only used internally and cannot - exist in a binlog.
MYSQL_TYPE_BLOB2521 byteThe pack length, i.e., the number of bytes needed to represent - the length of the blob: 1, 2, 3, or 4.
MYSQL_TYPE_VAR_STRING2532 bytesThis is used to store both strings and enumeration values. - The first byte is a enumeration value storing the real - type, which may be either MYSQL_TYPE_VAR_STRING or - MYSQL_TYPE_ENUM. The second byte is a 1 byte unsigned integer - representing the field size, i.e., the number of bytes needed to - store the length of the string.
MYSQL_TYPE_STRING2542 bytesThe first byte is always MYSQL_TYPE_VAR_STRING (i.e., 253). - The second byte is the field size, i.e., the number of bytes in - the representation of size of the string: 3 or 4.
MYSQL_TYPE_GEOMETRY2551 byteThe pack length, i.e., the number of bytes needed to represent - the length of the geometry: 1, 2, 3, or 4.
- The table below lists all optional metadata types, along with the numerical - identifier for it and the size and interpretation of meta-data used - to describe the type. - - @anchor Table_table_map_event_optional_metadata - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Table_map_event optional metadata types: numerical identifier and - metadata. Optional metadata fields are stored in TLV fields. - Format of values are described in this table.
TypeDescriptionFormat
SIGNEDNESSsignedness of numeric colums. This is included for all values of - binlog_row_metadata.For each numeric column, a bit indicates whether the numeric - colunm has unsigned flag. 1 means it is unsigned. The number of - bytes needed for this is int((column_count + 7) / 8). The order is - the same as the order of column_type field.
DEFAULT_CHARSETCharsets of character columns. It has a default charset for - the case that most of character columns have same charset and the - most used charset is binlogged as default charset.Collation - numbers are binlogged for identifying charsets. They are stored in - packed length format. Either DEFAULT_CHARSET or COLUMN_CHARSET is - included for all values of binlog_row_metadata.Default charset's collation is logged first. The charsets which are not - same to default charset are logged following default charset. They are - logged as column index and charset collation number pair sequence. The - column index is counted only in all character columns. The order is same to - the order of column_type - field.
COLUMN_CHARSETCharsets of character columns. For the case that most of columns have - different charsets, this field is logged. It is never logged with - DEFAULT_CHARSET together. Either DEFAULT_CHARSET or COLUMN_CHARSET is - included for all values of binlog_row_metadata.It is a collation number sequence for all character columns.
COLUMN_NAMENames of columns. This is only included if - binlog_row_metadata=FULL.A sequence of column names. For each column name, 1 byte for - the string length in bytes is followed by a string without null - terminator.
SET_STR_VALUEThe string values of SET columns. This is only included if - binlog_row_metadata=FULL.For each SET column, a pack_length representing the value - count is followed by a sequence of length and string pairs. length - is the byte count in pack_length format. The string has no null - terminator.
ENUM_STR_VALUEThe string values is ENUM columns. This is only included - if binlog_row_metadata=FULL.The format is the same as SET_STR_VALUE.
GEOMETRY_TYPEThe real type of geometry columns. This is only included - if binlog_row_metadata=FULL.A sequence of real type of geometry columns are stored in pack_length - format.
SIMPLE_PRIMARY_KEYThe primary key without any prefix. This is only included - if binlog_row_metadata=FULL and there is a primary key where every - key part covers an entire column.A sequence of column indexes. The indexes are stored in pack_length - format.
PRIMARY_KEY_WITH_PREFIXThe primary key with some prefix. It doesn't appear together with - SIMPLE_PRIMARY_KEY. This is only included if - binlog_row_metadata=FULL and there is a primary key where some key - part covers a prefix of the column.A sequence of column index and prefix length pairs. Both - column index and prefix length are in pack_length format. Prefix length - 0 means that the whole column value is used.
ENUM_AND_SET_DEFAULT_CHARSETCharsets of ENUM and SET columns. It has the same layout as - DEFAULT_CHARSET. If there are SET or ENUM columns and - binlog_row_metadata=FULL, exactly one of - ENUM_AND_SET_DEFAULT_CHARSET and ENUM_AND_SET_COLUMN_CHARSET - appears (the encoder chooses the representation that uses the - least amount of space). Otherwise, none of them appears.The same format as for DEFAULT_CHARSET, except it counts ENUM - and SET columns rather than character columns.
ENUM_AND_SET_COLUMN_CHARSETCharsets of ENUM and SET columns. It has the same layout as - COLUMN_CHARSET. If there are SET or ENUM columns and - binlog_row_metadata=FULL, exactly one of - ENUM_AND_SET_DEFAULT_CHARSET and ENUM_AND_SET_COLUMN_CHARSET - appears (the encoder chooses the representation that uses the - least amount of space). Otherwise, none of them appears.The same format as for COLUMN_CHARSET, except it counts ENUM - and SET columns rather than character columns.
-*/ -class Table_map_log_event : public Log_event -{ -public: - /* Constants */ - enum - { - TYPE_CODE = TABLE_MAP_EVENT - }; - - /** - Enumeration of the errors that can be returned. - */ - enum enum_error - { - ERR_OPEN_FAILURE = -1, /**< Failure to open table */ - ERR_OK = 0, /**< No error */ - ERR_TABLE_LIMIT_EXCEEDED = 1, /**< No more room for tables */ - ERR_OUT_OF_MEM = 2, /**< Out of memory */ - ERR_BAD_TABLE_DEF = 3, /**< Table definition does not match */ - ERR_RBR_TO_SBR = 4 /**< daisy-chanining RBR to SBR not allowed */ - }; - - enum enum_flag - { - /* - Nothing here right now, but the flags support is there in - preparation for changes that are coming. Need to add a - constant to make it compile under HP-UX: aCC does not like - empty enumerations. - */ - ENUM_FLAG_COUNT - }; - - typedef uint16 flag_set; - /** - DEFAULT_CHARSET and COLUMN_CHARSET don't appear together, and - ENUM_AND_SET_DEFAULT_CHARSET and ENUM_AND_SET_COLUMN_CHARSET don't - appear together. They are just alternative ways to pack character - set information. When binlogging, it logs character sets in the - way that occupies least storage. - - SIMPLE_PRIMARY_KEY and PRIMARY_KEY_WITH_PREFIX don't appear together. - SIMPLE_PRIMARY_KEY is for the primary keys which only use whole values of - pk columns. PRIMARY_KEY_WITH_PREFIX is - for the primary keys which just use part value of pk columns. - */ - enum Optional_metadata_field_type - { - SIGNEDNESS = 1, // UNSIGNED flag of numeric columns - DEFAULT_CHARSET, /* Character set of string columns, optimized to - minimize space when many columns have the - same charset. */ - COLUMN_CHARSET, /* Character set of string columns, optimized to - minimize space when columns have many - different charsets. */ - COLUMN_NAME, - SET_STR_VALUE, // String value of SET columns - ENUM_STR_VALUE, // String value of ENUM columns - GEOMETRY_TYPE, // Real type of geometry columns - SIMPLE_PRIMARY_KEY, // Primary key without prefix - PRIMARY_KEY_WITH_PREFIX, // Primary key with prefix - ENUM_AND_SET_DEFAULT_CHARSET, /* Character set of enum and set - columns, optimized to minimize - space when many columns have the - same charset. */ - ENUM_AND_SET_COLUMN_CHARSET, /* Character set of enum and set - columns, optimized to minimize - space when many columns have the - same charset. */ - }; - /** - Metadata_fields organizes m_optional_metadata into a structured format which - is easy to access. - */ - // Values for binlog_row_metadata sysvar - enum enum_binlog_row_metadata - { - BINLOG_ROW_METADATA_NO_LOG= 0, - BINLOG_ROW_METADATA_MINIMAL= 1, - BINLOG_ROW_METADATA_FULL= 2 - }; - struct Optional_metadata_fields - { - typedef std::pair uint_pair; - typedef std::vector str_vector; - - struct Default_charset - { - Default_charset() : default_charset(0) {} - bool empty() const { return default_charset == 0; } - - // Default charset for the columns which are not in charset_pairs. - unsigned int default_charset; - - /* The uint_pair means . */ - std::vector charset_pairs; - }; - - // Contents of DEFAULT_CHARSET field is converted into Default_charset. - Default_charset m_default_charset; - // Contents of ENUM_AND_SET_DEFAULT_CHARSET are converted into - // Default_charset. - Default_charset m_enum_and_set_default_charset; - std::vector m_signedness; - // Character set number of every string column - std::vector m_column_charset; - // Character set number of every ENUM or SET column. - std::vector m_enum_and_set_column_charset; - std::vector m_column_name; - // each str_vector stores values of one enum/set column - std::vector m_enum_str_value; - std::vector m_set_str_value; - std::vector m_geometry_type; - /* - The uint_pair means . Prefix length is 0 if - whole column value is used. - */ - std::vector m_primary_key; - - /* - It parses m_optional_metadata and populates into above variables. - - @param[in] optional_metadata points to the begin of optional metadata - fields in table_map_event. - @param[in] optional_metadata_len length of optional_metadata field. - */ - Optional_metadata_fields(unsigned char* optional_metadata, - unsigned int optional_metadata_len); - }; - - /** - Print column metadata. Its format looks like: - # Columns(colume_name type, colume_name type, ...) - if colume_name field is not logged into table_map_log_event, then - only type is printed. - - @@param[out] file the place where colume metadata is printed - @@param[in] The metadata extracted from optional metadata fields - */ - void print_columns(IO_CACHE *file, - const Optional_metadata_fields &fields); - /** - Print primary information. Its format looks like: - # Primary Key(colume_name, column_name(prifix), ...) - if colume_name field is not logged into table_map_log_event, then - colume index is printed. - - @@param[out] file the place where primary key is printed - @@param[in] The metadata extracted from optional metadata fields - */ - void print_primary_key(IO_CACHE *file, - const Optional_metadata_fields &fields); - - /* Special constants representing sets of flags */ - enum - { - TM_NO_FLAGS = 0U, - TM_BIT_LEN_EXACT_F = (1U << 0), - // MariaDB flags (we starts from the other end) - TM_BIT_HAS_TRIGGERS_F= (1U << 14) - }; - - flag_set get_flags(flag_set flag) const { return m_flags & flag; } - -#ifdef MYSQL_SERVER - Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, bool is_transactional); -#endif -#ifdef HAVE_REPLICATION - Table_map_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif - - ~Table_map_log_event(); - -#ifdef MYSQL_CLIENT - table_def *create_table_def() - { - return new table_def(m_coltype, m_colcnt, m_field_metadata, - m_field_metadata_size, m_null_bits, m_flags); - } - int rewrite_db(const char* new_name, size_t new_name_len, - const Format_description_log_event*); -#endif - ulonglong get_table_id() const { return m_table_id; } - const char *get_table_name() const { return m_tblnam; } - const char *get_db_name() const { return m_dbnam; } - - virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; } - virtual enum_logged_status logged_status() { return LOGGED_TABLE_MAP; } - virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ } - virtual bool is_part_of_group() { return 1; } - - virtual int get_data_size() { return (uint) m_data_size; } -#ifdef MYSQL_SERVER - virtual int save_field_metadata(); - virtual bool write_data_header(); - virtual bool write_data_body(); - virtual const char *get_db() { return m_dbnam; } -#endif - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual void pack_info(Protocol *protocol); -#endif - -#ifdef MYSQL_CLIENT - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - - -private: -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); -#endif - -#ifdef MYSQL_SERVER - TABLE *m_table; - Binlog_type_info *binlog_type_info_array; - - - // Metadata fields buffer - StringBuffer<1024> m_metadata_buf; - - /** - Capture the optional metadata fields which should be logged into - table_map_log_event and serialize them into m_metadata_buf. - */ - void init_metadata_fields(); - bool init_signedness_field(); - /** - Capture and serialize character sets. Character sets for - character columns (TEXT etc) and character sets for ENUM and SET - columns are stored in different metadata fields. The reason is - that TEXT character sets are included even when - binlog_row_metadata=MINIMAL, whereas ENUM and SET character sets - are included only when binlog_row_metadata=FULL. - - @param include_type Predicate to determine if a given Field object - is to be included in the metadata field. - - @param default_charset_type Type code when storing in "default - charset" format. (See comment above Table_maps_log_event in - libbinlogevents/include/rows_event.h) - - @param column_charset_type Type code when storing in "column - charset" format. (See comment above Table_maps_log_event in - libbinlogevents/include/rows_event.h) - */ - bool init_charset_field(bool(* include_type)(Binlog_type_info *, Field *), - Optional_metadata_field_type default_charset_type, - Optional_metadata_field_type column_charset_type); - bool init_column_name_field(); - bool init_set_str_value_field(); - bool init_enum_str_value_field(); - bool init_geometry_type_field(); - bool init_primary_key_field(); -#endif - -#ifdef MYSQL_CLIENT - class Charset_iterator; - class Default_charset_iterator; - class Column_charset_iterator; -#endif - char const *m_dbnam; - size_t m_dblen; - char const *m_tblnam; - size_t m_tbllen; - ulong m_colcnt; - uchar *m_coltype; - - uchar *m_memory; - ulonglong m_table_id; - flag_set m_flags; - - size_t m_data_size; - - uchar *m_field_metadata; // buffer for field metadata - /* - The size of field metadata buffer set by calling save_field_metadata() - */ - ulong m_field_metadata_size; - uchar *m_null_bits; - uchar *m_meta_memory; - unsigned int m_optional_metadata_len; - unsigned char *m_optional_metadata; -}; - - -/** - @class Rows_log_event - - Common base class for all row-containing log events. - - RESPONSIBILITIES - - Encode the common parts of all events containing rows, which are: - - Write data header and data body to an IO_CACHE. - - Provide an interface for adding an individual row to the event. - - @section Rows_log_event_binary_format Binary Format -*/ - - -class Rows_log_event : public Log_event -{ -public: - /** - Enumeration of the errors that can be returned. - */ - enum enum_error - { - ERR_OPEN_FAILURE = -1, /**< Failure to open table */ - ERR_OK = 0, /**< No error */ - ERR_TABLE_LIMIT_EXCEEDED = 1, /**< No more room for tables */ - ERR_OUT_OF_MEM = 2, /**< Out of memory */ - ERR_BAD_TABLE_DEF = 3, /**< Table definition does not match */ - ERR_RBR_TO_SBR = 4 /**< daisy-chanining RBR to SBR not allowed */ - }; - - /* - These definitions allow you to combine the flags into an - appropriate flag set using the normal bitwise operators. The - implicit conversion from an enum-constant to an integer is - accepted by the compiler, which is then used to set the real set - of flags. - */ - enum enum_flag - { - /* Last event of a statement */ - STMT_END_F = (1U << 0), - - /* Value of the OPTION_NO_FOREIGN_KEY_CHECKS flag in thd->options */ - NO_FOREIGN_KEY_CHECKS_F = (1U << 1), - - /* Value of the OPTION_RELAXED_UNIQUE_CHECKS flag in thd->options */ - RELAXED_UNIQUE_CHECKS_F = (1U << 2), - - /** - Indicates that rows in this event are complete, that is contain - values for all columns of the table. - */ - COMPLETE_ROWS_F = (1U << 3), - - /* Value of the OPTION_NO_CHECK_CONSTRAINT_CHECKS flag in thd->options */ - NO_CHECK_CONSTRAINT_CHECKS_F = (1U << 7) - }; - - typedef uint16 flag_set; - - /* Special constants representing sets of flags */ - enum - { - RLE_NO_FLAGS = 0U - }; - - virtual ~Rows_log_event(); - - void set_flags(flag_set flags_arg) { m_flags |= flags_arg; } - void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; } - flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; } - void update_flags() { int2store(temp_buf + m_flags_pos, m_flags); } - - Log_event_type get_type_code() { return m_type; } /* Specific type (_V1 etc) */ - enum_logged_status logged_status() { return LOGGED_ROW_EVENT; } - virtual Log_event_type get_general_type_code() = 0; /* General rows op type, no version */ - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual void pack_info(Protocol *protocol); -#endif - -#ifdef MYSQL_CLIENT - /* not for direct call, each derived has its own ::print() */ - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0; - void change_to_flashback_event(PRINT_EVENT_INFO *print_event_info, uchar *rows_buff, Log_event_type ev_type); - bool print_verbose(IO_CACHE *file, - PRINT_EVENT_INFO *print_event_info); - size_t print_verbose_one_row(IO_CACHE *file, table_def *td, - PRINT_EVENT_INFO *print_event_info, - MY_BITMAP *cols_bitmap, - const uchar *ptr, const uchar *prefix, - const my_bool no_fill_output= 0); // if no_fill_output=1, then print result is unnecessary - size_t calc_row_event_length(table_def *td, - PRINT_EVENT_INFO *print_event_info, - MY_BITMAP *cols_bitmap, - const uchar *value); - void count_row_events(PRINT_EVENT_INFO *print_event_info); - -#endif - -#ifdef MYSQL_SERVER - int add_row_data(uchar *data, size_t length) - { - return do_add_row_data(data,length); - } -#endif - - /* Member functions to implement superclass interface */ - virtual int get_data_size(); - - MY_BITMAP const *get_cols() const { return &m_cols; } - MY_BITMAP const *get_cols_ai() const { return &m_cols_ai; } - size_t get_width() const { return m_width; } - ulonglong get_table_id() const { return m_table_id; } - -#if defined(MYSQL_SERVER) - /* - This member function compares the table's read/write_set - with this event's m_cols and m_cols_ai. Comparison takes - into account what type of rows event is this: Delete, Write or - Update, therefore it uses the correct m_cols[_ai] according - to the event type code. - - Note that this member function should only be called for the - following events: - - Delete_rows_log_event - - Write_rows_log_event - - Update_rows_log_event - - @param[IN] table The table to compare this events bitmaps - against. - - @return TRUE if sets match, FALSE otherwise. (following - bitmap_cmp return logic). - - */ - bool read_write_bitmaps_cmp(TABLE *table) - { - bool res= FALSE; - - switch (get_general_type_code()) - { - case DELETE_ROWS_EVENT: - res= bitmap_cmp(get_cols(), table->read_set); - break; - case UPDATE_ROWS_EVENT: - res= (bitmap_cmp(get_cols(), table->read_set) && - bitmap_cmp(get_cols_ai(), table->rpl_write_set)); - break; - case WRITE_ROWS_EVENT: - res= bitmap_cmp(get_cols(), table->rpl_write_set); - break; - default: - /* - We should just compare bitmaps for Delete, Write - or Update rows events. - */ - DBUG_ASSERT(0); - } - return res; - } -#endif - -#ifdef MYSQL_SERVER - virtual bool write_data_header(); - virtual bool write_data_body(); - virtual bool write_compressed(); - virtual const char *get_db() { return m_table->s->db.str; } -#endif - /* - Check that malloc() succeeded in allocating memory for the rows - buffer and the COLS vector. Checking that an Update_rows_log_event - is valid is done in the Update_rows_log_event::is_valid() - function. - */ - virtual bool is_valid() const - { - return m_rows_buf && m_cols.bitmap; - } - bool is_part_of_group() { return get_flags(STMT_END_F) != 0; } - - uint m_row_count; /* The number of rows added to the event */ - - const uchar* get_extra_row_data() const { return m_extra_row_data; } - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual uint8 get_trg_event_map()= 0; - - inline bool do_invoke_trigger() - { - return (slave_run_triggers_for_rbr && !master_had_triggers) || - slave_run_triggers_for_rbr == SLAVE_RUN_TRIGGERS_FOR_RBR_ENFORCE; - } -#endif - -protected: - /* - The constructors are protected since you're supposed to inherit - this class, not create instances of this class. - */ -#ifdef MYSQL_SERVER - Rows_log_event(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols, bool is_transactional, - Log_event_type event_type); -#endif - Rows_log_event(const char *row_data, uint event_len, - const Format_description_log_event *description_event); - void uncompress_buf(); - -#ifdef MYSQL_CLIENT - bool print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name); -#endif - -#ifdef MYSQL_SERVER - virtual int do_add_row_data(uchar *data, size_t length); -#endif - -#ifdef MYSQL_SERVER - TABLE *m_table; /* The table the rows belong to */ -#endif - ulonglong m_table_id; /* Table ID */ - MY_BITMAP m_cols; /* Bitmap denoting columns available */ - ulong m_width; /* The width of the columns bitmap */ - /* - Bitmap for columns available in the after image, if present. These - fields are only available for Update_rows events. Observe that the - width of both the before image COLS vector and the after image - COLS vector is the same: the number of columns of the table on the - master. - */ - MY_BITMAP m_cols_ai; - - ulong m_master_reclength; /* Length of record on master side */ - - /* Bit buffers in the same memory as the class */ - uint32 m_bitbuf[128/(sizeof(uint32)*8)]; - uint32 m_bitbuf_ai[128/(sizeof(uint32)*8)]; - - uchar *m_rows_buf; /* The rows in packed format */ - uchar *m_rows_cur; /* One-after the end of the data */ - uchar *m_rows_end; /* One-after the end of the allocated space */ - - size_t m_rows_before_size; /* The length before m_rows_buf */ - size_t m_flags_pos; /* The position of the m_flags */ - - flag_set m_flags; /* Flags for row-level events */ - - Log_event_type m_type; /* Actual event type */ - - uchar *m_extra_row_data; /* Pointer to extra row data if any */ - /* If non null, first byte is length */ - - bool m_vers_from_plain; - - - /* helper functions */ - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - const uchar *m_curr_row; /* Start of the row being processed */ - const uchar *m_curr_row_end; /* One-after the end of the current row */ - uchar *m_key; /* Buffer to keep key value during searches */ - KEY *m_key_info; /* Pointer to KEY info for m_key_nr */ - uint m_key_nr; /* Key number */ - bool master_had_triggers; /* set after tables opening */ - - int find_key(); // Find a best key to use in find_row() - int find_row(rpl_group_info *); - int write_row(rpl_group_info *, const bool); - int update_sequence(); - - // Unpack the current row into m_table->record[0], but with - // a different columns bitmap. - int unpack_current_row(rpl_group_info *rgi, MY_BITMAP const *cols) - { - DBUG_ASSERT(m_table); - - ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT); - return ::unpack_row(rgi, m_table, m_width, m_curr_row, cols, - &m_curr_row_end, &m_master_reclength, m_rows_end); - } - - // Unpack the current row into m_table->record[0] - int unpack_current_row(rpl_group_info *rgi) - { - DBUG_ASSERT(m_table); - - ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT); - return ::unpack_row(rgi, m_table, m_width, m_curr_row, &m_cols, - &m_curr_row_end, &m_master_reclength, m_rows_end); - } - bool process_triggers(trg_event_type event, - trg_action_time_type time_type, - bool old_row_is_record1); - - /** - Helper function to check whether there is an auto increment - column on the table where the event is to be applied. - - @return true if there is an autoincrement field on the extra - columns, false otherwise. - */ - inline bool is_auto_inc_in_extra_columns() - { - DBUG_ASSERT(m_table); - return (m_table->next_number_field && - m_table->next_number_field->field_index >= m_width); - } -#endif - -private: - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); - - /* - Primitive to prepare for a sequence of row executions. - - DESCRIPTION - - Before doing a sequence of do_prepare_row() and do_exec_row() - calls, this member function should be called to prepare for the - entire sequence. Typically, this member function will allocate - space for any buffers that are needed for the two member - functions mentioned above. - - RETURN VALUE - - The member function will return 0 if all went OK, or a non-zero - error code otherwise. - */ - virtual - int do_before_row_operations(const Slave_reporting_capability *const log) = 0; - - /* - Primitive to clean up after a sequence of row executions. - - DESCRIPTION - - After doing a sequence of do_prepare_row() and do_exec_row(), - this member function should be called to clean up and release - any allocated buffers. - - The error argument, if non-zero, indicates an error which happened during - row processing before this function was called. In this case, even if - function is successful, it should return the error code given in the argument. - */ - virtual - int do_after_row_operations(const Slave_reporting_capability *const log, - int error) = 0; - - /* - Primitive to do the actual execution necessary for a row. - - DESCRIPTION - The member function will do the actual execution needed to handle a row. - The row is located at m_curr_row. When the function returns, - m_curr_row_end should point at the next row (one byte after the end - of the current row). - - RETURN VALUE - 0 if execution succeeded, 1 if execution failed. - - */ - virtual int do_exec_row(rpl_group_info *rli) = 0; -#endif /* defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) */ - - friend class Old_rows_log_event; -}; - -/** - @class Write_rows_log_event - - Log row insertions and updates. The event contain several - insert/update rows for a table. Note that each event contains only - rows for one table. - - @section Write_rows_log_event_binary_format Binary Format -*/ -class Write_rows_log_event : public Rows_log_event -{ -public: - enum - { - /* Support interface to THD::binlog_prepare_pending_rows_event */ - TYPE_CODE = WRITE_ROWS_EVENT - }; - -#if defined(MYSQL_SERVER) - Write_rows_log_event(THD*, TABLE*, ulong table_id, - bool is_transactional); -#endif -#ifdef HAVE_REPLICATION - Write_rows_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif -#if defined(MYSQL_SERVER) - static bool binlog_row_logging_function(THD *thd, TABLE *table, - bool is_transactional, - const uchar *before_record - __attribute__((unused)), - const uchar *after_record) - { - DBUG_ASSERT(!table->versioned(VERS_TRX_ID)); - return thd->binlog_write_row(table, is_transactional, after_record); - } -#endif - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - uint8 get_trg_event_map(); -#endif - -private: - virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } - -#ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); -#endif -}; - -class Write_rows_compressed_log_event : public Write_rows_log_event -{ -public: -#if defined(MYSQL_SERVER) - Write_rows_compressed_log_event(THD*, TABLE*, ulong table_id, - bool is_transactional); - virtual bool write(); -#endif -#ifdef HAVE_REPLICATION - Write_rows_compressed_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif -private: -#if defined(MYSQL_CLIENT) - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif -}; - -/** - @class Update_rows_log_event - - Log row updates with a before image. The event contain several - update rows for a table. Note that each event contains only rows for - one table. - - Also note that the row data consists of pairs of row data: one row - for the old data and one row for the new data. - - @section Update_rows_log_event_binary_format Binary Format -*/ -class Update_rows_log_event : public Rows_log_event -{ -public: - enum - { - /* Support interface to THD::binlog_prepare_pending_rows_event */ - TYPE_CODE = UPDATE_ROWS_EVENT - }; - -#ifdef MYSQL_SERVER - Update_rows_log_event(THD*, TABLE*, ulong table_id, - bool is_transactional); - - void init(MY_BITMAP const *cols); -#endif - - virtual ~Update_rows_log_event(); - -#ifdef HAVE_REPLICATION - Update_rows_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif - -#ifdef MYSQL_SERVER - static bool binlog_row_logging_function(THD *thd, TABLE *table, - bool is_transactional, - const uchar *before_record, - const uchar *after_record) - { - DBUG_ASSERT(!table->versioned(VERS_TRX_ID)); - return thd->binlog_update_row(table, is_transactional, - before_record, after_record); - } -#endif - - virtual bool is_valid() const - { - return Rows_log_event::is_valid() && m_cols_ai.bitmap; - } - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - uint8 get_trg_event_map(); -#endif - -protected: - virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } - -#ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); -#endif /* defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) */ -}; - -class Update_rows_compressed_log_event : public Update_rows_log_event -{ -public: -#if defined(MYSQL_SERVER) - Update_rows_compressed_log_event(THD*, TABLE*, ulong table_id, - bool is_transactional); - virtual bool write(); -#endif -#ifdef HAVE_REPLICATION - Update_rows_compressed_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif -private: -#if defined(MYSQL_CLIENT) - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif -}; - -/** - @class Delete_rows_log_event - - Log row deletions. The event contain several delete rows for a - table. Note that each event contains only rows for one table. - - RESPONSIBILITIES - - - Act as a container for rows that has been deleted on the master - and should be deleted on the slave. - - COLLABORATION - - Row_writer - Create the event and add rows to the event. - Row_reader - Extract the rows from the event. - - @section Delete_rows_log_event_binary_format Binary Format -*/ -class Delete_rows_log_event : public Rows_log_event -{ -public: - enum - { - /* Support interface to THD::binlog_prepare_pending_rows_event */ - TYPE_CODE = DELETE_ROWS_EVENT - }; - -#ifdef MYSQL_SERVER - Delete_rows_log_event(THD*, TABLE*, ulong, bool is_transactional); -#endif -#ifdef HAVE_REPLICATION - Delete_rows_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif -#ifdef MYSQL_SERVER - static bool binlog_row_logging_function(THD *thd, TABLE *table, - bool is_transactional, - const uchar *before_record, - const uchar *after_record - __attribute__((unused))) - { - DBUG_ASSERT(!table->versioned(VERS_TRX_ID)); - return thd->binlog_delete_row(table, is_transactional, - before_record); - } -#endif - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - uint8 get_trg_event_map(); -#endif - -protected: - virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } - -#ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); -#endif -}; - -class Delete_rows_compressed_log_event : public Delete_rows_log_event -{ -public: -#if defined(MYSQL_SERVER) - Delete_rows_compressed_log_event(THD*, TABLE*, ulong, bool is_transactional); - virtual bool write(); -#endif -#ifdef HAVE_REPLICATION - Delete_rows_compressed_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif -private: -#if defined(MYSQL_CLIENT) - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif -}; - - -#include "log_event_old.h" - -/** - @class Incident_log_event - - Class representing an incident, an occurence out of the ordinary, - that happened on the master. - - The event is used to inform the slave that something out of the - ordinary happened on the master that might cause the database to be - in an inconsistent state. - - - - - - - - - - - - - - - - - - - - - - - -
Incident event format
SymbolFormatDescription
INCIDENT2Incident number as an unsigned integer
MSGLEN1Message length as an unsigned integer
MESSAGEMSGLENThe message, if present. Not null terminated.
- - @section Delete_rows_log_event_binary_format Binary Format -*/ -class Incident_log_event : public Log_event { -public: -#ifdef MYSQL_SERVER - Incident_log_event(THD *thd_arg, Incident incident) - : Log_event(thd_arg, 0, FALSE), m_incident(incident) - { - DBUG_ENTER("Incident_log_event::Incident_log_event"); - DBUG_PRINT("enter", ("m_incident: %d", m_incident)); - m_message.str= NULL; /* Just as a precaution */ - m_message.length= 0; - set_direct_logging(); - /* Replicate the incident regardless of @@skip_replication. */ - flags&= ~LOG_EVENT_SKIP_REPLICATION_F; - DBUG_VOID_RETURN; - } - - Incident_log_event(THD *thd_arg, Incident incident, const LEX_CSTRING *msg) - : Log_event(thd_arg, 0, FALSE), m_incident(incident) - { - extern PSI_memory_key key_memory_Incident_log_event_message; - DBUG_ENTER("Incident_log_event::Incident_log_event"); - DBUG_PRINT("enter", ("m_incident: %d", m_incident)); - m_message.length= 0; - if (!(m_message.str= (char*) my_malloc(key_memory_Incident_log_event_message, - msg->length + 1, MYF(MY_WME)))) - { - /* Mark this event invalid */ - m_incident= INCIDENT_NONE; - DBUG_VOID_RETURN; - } - strmake(m_message.str, msg->str, msg->length); - m_message.length= msg->length; - set_direct_logging(); - /* Replicate the incident regardless of @@skip_replication. */ - flags&= ~LOG_EVENT_SKIP_REPLICATION_F; - DBUG_VOID_RETURN; - } -#endif - -#ifdef MYSQL_SERVER - void pack_info(Protocol*); - - virtual bool write_data_header(); - virtual bool write_data_body(); -#endif - - Incident_log_event(const char *buf, uint event_len, - const Format_description_log_event *descr_event); - - virtual ~Incident_log_event(); - -#ifdef MYSQL_CLIENT - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - -#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); -#endif - - virtual Log_event_type get_type_code() { return INCIDENT_EVENT; } - - virtual bool is_valid() const - { - return m_incident > INCIDENT_NONE && m_incident < INCIDENT_COUNT; - } - virtual int get_data_size() { - return INCIDENT_HEADER_LEN + 1 + (uint) m_message.length; - } - -private: - const char *description() const; - - Incident m_incident; - LEX_STRING m_message; -}; - -/** - @class Ignorable_log_event - - Base class for ignorable log events. Events deriving from - this class can be safely ignored by slaves that cannot - recognize them. Newer slaves, will be able to read and - handle them. This has been designed to be an open-ended - architecture, so adding new derived events shall not harm - the old slaves that support ignorable log event mechanism - (they will just ignore unrecognized ignorable events). - - @note The only thing that makes an event ignorable is that it has - the LOG_EVENT_IGNORABLE_F flag set. It is not strictly necessary - that ignorable event types derive from Ignorable_log_event; they may - just as well derive from Log_event and pass LOG_EVENT_IGNORABLE_F as - argument to the Log_event constructor. -**/ - -class Ignorable_log_event : public Log_event { -public: - int number; - const char *description; - -#ifndef MYSQL_CLIENT - Ignorable_log_event(THD *thd_arg) - :Log_event(thd_arg, LOG_EVENT_IGNORABLE_F, FALSE), - number(0), description("internal") - { - DBUG_ENTER("Ignorable_log_event::Ignorable_log_event"); - DBUG_VOID_RETURN; - } -#endif - - Ignorable_log_event(const char *buf, - const Format_description_log_event *descr_event, - const char *event_name); - virtual ~Ignorable_log_event(); - -#ifndef MYSQL_CLIENT - void pack_info(Protocol*); -#endif - -#ifdef MYSQL_CLIENT - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - - virtual Log_event_type get_type_code() { return IGNORABLE_LOG_EVENT; } - - virtual bool is_valid() const { return 1; } - - virtual int get_data_size() { return IGNORABLE_HEADER_LEN; } -}; - -#ifdef MYSQL_CLIENT -bool copy_cache_to_string_wrapped(IO_CACHE *body, - LEX_STRING *to, - bool do_wrap, - const char *delimiter, - bool is_verbose); -bool copy_cache_to_file_wrapped(IO_CACHE *body, - FILE *file, - bool do_wrap, - const char *delimiter, - bool is_verbose); -#endif - -#ifdef MYSQL_SERVER -/***************************************************************************** - - Heartbeat Log Event class - - Replication event to ensure to slave that master is alive. - The event is originated by master's dump thread and sent straight to - slave without being logged. Slave itself does not store it in relay log - but rather uses a data for immediate checks and throws away the event. - - Two members of the class log_ident and Log_event::log_pos comprise - @see the event_coordinates instance. The coordinates that a heartbeat - instance carries correspond to the last event master has sent from - its binlog. - - ****************************************************************************/ -class Heartbeat_log_event: public Log_event -{ -public: - Heartbeat_log_event(const char* buf, uint event_len, - const Format_description_log_event* description_event); - Log_event_type get_type_code() { return HEARTBEAT_LOG_EVENT; } - bool is_valid() const - { - return (log_ident != NULL && - log_pos >= BIN_LOG_HEADER_SIZE); - } - const char * get_log_ident() { return log_ident; } - uint get_ident_len() { return ident_len; } - -private: - const char* log_ident; - uint ident_len; -}; - -inline int Log_event_writer::write(Log_event *ev) -{ - ev->writer= this; - int res= ev->write(); - IF_DBUG(ev->writer= 0,); // writer must be set before every Log_event::write - add_status(ev->logged_status()); - return res; -} - -/** - The function is called by slave applier in case there are - active table filtering rules to force gathering events associated - with Query-log-event into an array to execute - them once the fate of the Query is determined for execution. -*/ -bool slave_execute_deferred_events(THD *thd); -#endif - -bool event_that_should_be_ignored(const char *buf); -bool event_checksum_test(uchar *buf, ulong event_len, enum_binlog_checksum_alg alg); -enum enum_binlog_checksum_alg get_checksum_alg(const char* buf, ulong len); -extern TYPELIB binlog_checksum_typelib; -#ifdef WITH_WSREP -enum Log_event_type wsrep_peak_event(rpl_group_info *rgi, ulonglong* event_size); -#endif /* WITH_WSREP */ - -/** - @} (end of group Replication) -*/ - - -int binlog_buf_compress(const char *src, char *dst, uint32 len, uint32 *comlen); -int binlog_buf_uncompress(const char *src, char *dst, uint32 len, uint32 *newlen); -uint32 binlog_get_compress_len(uint32 len); -uint32 binlog_get_uncompress_len(const char *buf); - -int query_event_uncompress(const Format_description_log_event *description_event, bool contain_checksum, - const char *src, ulong src_len, char* buf, ulong buf_size, bool* is_malloc, - char **dst, ulong *newlen); - -int row_log_event_uncompress(const Format_description_log_event *description_event, bool contain_checksum, - const char *src, ulong src_len, char* buf, ulong buf_size, bool* is_malloc, - char **dst, ulong *newlen); - -#endif /* _log_event_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/log_event_old.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/log_event_old.h deleted file mode 100644 index 3a11313..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/log_event_old.h +++ /dev/null @@ -1,569 +0,0 @@ -/* Copyright (c) 2007, 2013, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef LOG_EVENT_OLD_H -#define LOG_EVENT_OLD_H - -/* - Need to include this file at the proper position of log_event.h - */ - - -/** - @file - - @brief This file contains classes handling old formats of row-based - binlog events. -*/ -/* - Around 2007-10-31, I made these classes completely separated from - the new classes (before, there was a complex class hierarchy - involving multiple inheritance; see BUG#31581), by simply copying - and pasting the entire contents of Rows_log_event into - Old_rows_log_event and the entire contents of - {Write|Update|Delete}_rows_log_event into - {Write|Update|Delete}_rows_log_event_old. For clarity, I will keep - the comments marking which code was cut-and-pasted for some time. - With the classes collapsed into one, there is probably some - redundancy (maybe some methods can be simplified and/or removed), - but we keep them this way for now. /Sven -*/ - -/* These classes are based on the v1 RowsHeaderLen */ -#undef ROWS_HEADER_LEN -#define ROWS_HEADER_LEN ROWS_HEADER_LEN_V1 - -/** - @class Old_rows_log_event - - Base class for the three types of row-based events - {Write|Update|Delete}_row_log_event_old, with event type codes - PRE_GA_{WRITE|UPDATE|DELETE}_ROWS_EVENT. These events are never - created any more, except when reading a relay log created by an old - server. -*/ -class Old_rows_log_event : public Log_event -{ - /********** BEGIN CUT & PASTE FROM Rows_log_event **********/ -public: - /** - Enumeration of the errors that can be returned. - */ - enum enum_error - { - ERR_OPEN_FAILURE = -1, /**< Failure to open table */ - ERR_OK = 0, /**< No error */ - ERR_TABLE_LIMIT_EXCEEDED = 1, /**< No more room for tables */ - ERR_OUT_OF_MEM = 2, /**< Out of memory */ - ERR_BAD_TABLE_DEF = 3, /**< Table definition does not match */ - ERR_RBR_TO_SBR = 4 /**< daisy-chanining RBR to SBR not allowed */ - }; - - /* - These definitions allow you to combine the flags into an - appropriate flag set using the normal bitwise operators. The - implicit conversion from an enum-constant to an integer is - accepted by the compiler, which is then used to set the real set - of flags. - */ - enum enum_flag - { - /* Last event of a statement */ - STMT_END_F = (1U << 0), - - /* Value of the OPTION_NO_FOREIGN_KEY_CHECKS flag in thd->options */ - NO_FOREIGN_KEY_CHECKS_F = (1U << 1), - - /* Value of the OPTION_RELAXED_UNIQUE_CHECKS flag in thd->options */ - RELAXED_UNIQUE_CHECKS_F = (1U << 2), - - /** - Indicates that rows in this event are complete, that is contain - values for all columns of the table. - */ - COMPLETE_ROWS_F = (1U << 3) - }; - - typedef uint16 flag_set; - - /* Special constants representing sets of flags */ - enum - { - RLE_NO_FLAGS = 0U - }; - - virtual ~Old_rows_log_event(); - - void set_flags(flag_set flags_arg) { m_flags |= flags_arg; } - void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; } - flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; } - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual void pack_info(Protocol *protocol); -#endif - -#ifdef MYSQL_CLIENT - /* not for direct call, each derived has its own ::print() */ - virtual bool print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0; -#endif - -#ifndef MYSQL_CLIENT - int add_row_data(uchar *data, size_t length) - { - return do_add_row_data(data,length); - } -#endif - - /* Member functions to implement superclass interface */ - virtual int get_data_size(); - - MY_BITMAP const *get_cols() const { return &m_cols; } - size_t get_width() const { return m_width; } - ulong get_table_id() const { return m_table_id; } - -#ifndef MYSQL_CLIENT - virtual bool write_data_header(); - virtual bool write_data_body(); - virtual const char *get_db() { return m_table->s->db.str; } -#endif - /* - Check that malloc() succeeded in allocating memory for the rows - buffer and the COLS vector. Checking that an Update_rows_log_event_old - is valid is done in the Update_rows_log_event_old::is_valid() - function. - */ - virtual bool is_valid() const - { - return m_rows_buf && m_cols.bitmap; - } - bool is_part_of_group() { return 1; } - - uint m_row_count; /* The number of rows added to the event */ - -protected: - /* - The constructors are protected since you're supposed to inherit - this class, not create instances of this class. - */ -#ifndef MYSQL_CLIENT - Old_rows_log_event(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols, bool is_transactional); -#endif - Old_rows_log_event(const char *row_data, uint event_len, - Log_event_type event_type, - const Format_description_log_event *description_event); - -#ifdef MYSQL_CLIENT - bool print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name); -#endif - -#ifndef MYSQL_CLIENT - virtual int do_add_row_data(uchar *data, size_t length); -#endif - -#ifndef MYSQL_CLIENT - TABLE *m_table; /* The table the rows belong to */ -#endif - ulong m_table_id; /* Table ID */ - MY_BITMAP m_cols; /* Bitmap denoting columns available */ - ulong m_width; /* The width of the columns bitmap */ - - ulong m_master_reclength; /* Length of record on master side */ - - /* Bit buffers in the same memory as the class */ - uint32 m_bitbuf[128/(sizeof(uint32)*8)]; - uint32 m_bitbuf_ai[128/(sizeof(uint32)*8)]; - - uchar *m_rows_buf; /* The rows in packed format */ - uchar *m_rows_cur; /* One-after the end of the data */ - uchar *m_rows_end; /* One-after the end of the allocated space */ - - flag_set m_flags; /* Flags for row-level events */ - - /* helper functions */ - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - const uchar *m_curr_row; /* Start of the row being processed */ - const uchar *m_curr_row_end; /* One-after the end of the current row */ - uchar *m_key; /* Buffer to keep key value during searches */ - - int find_row(rpl_group_info *); - int write_row(rpl_group_info *, const bool); - - // Unpack the current row into m_table->record[0] - int unpack_current_row(rpl_group_info *rgi) - { - DBUG_ASSERT(m_table); - ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT); - return ::unpack_row(rgi, m_table, m_width, m_curr_row, &m_cols, - &m_curr_row_end, &m_master_reclength, m_rows_end); - } -#endif - -private: - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int do_apply_event(rpl_group_info *rgi); - virtual int do_update_pos(rpl_group_info *rgi); - virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); - - /* - Primitive to prepare for a sequence of row executions. - - DESCRIPTION - - Before doing a sequence of do_prepare_row() and do_exec_row() - calls, this member function should be called to prepare for the - entire sequence. Typically, this member function will allocate - space for any buffers that are needed for the two member - functions mentioned above. - - RETURN VALUE - - The member function will return 0 if all went OK, or a non-zero - error code otherwise. - */ - virtual - int do_before_row_operations(const Slave_reporting_capability *const log) = 0; - - /* - Primitive to clean up after a sequence of row executions. - - DESCRIPTION - - After doing a sequence of do_prepare_row() and do_exec_row(), - this member function should be called to clean up and release - any allocated buffers. - - The error argument, if non-zero, indicates an error which happened during - row processing before this function was called. In this case, even if - function is successful, it should return the error code given in the argument. - */ - virtual - int do_after_row_operations(const Slave_reporting_capability *const log, - int error) = 0; - - /* - Primitive to do the actual execution necessary for a row. - - DESCRIPTION - The member function will do the actual execution needed to handle a row. - The row is located at m_curr_row. When the function returns, - m_curr_row_end should point at the next row (one byte after the end - of the current row). - - RETURN VALUE - 0 if execution succeeded, 1 if execution failed. - - */ - virtual int do_exec_row(rpl_group_info *rgi) = 0; -#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ - - /********** END OF CUT & PASTE FROM Rows_log_event **********/ - protected: - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - - int do_apply_event(Old_rows_log_event*, rpl_group_info *rgi); - - /* - Primitive to prepare for a sequence of row executions. - - DESCRIPTION - - Before doing a sequence of do_prepare_row() and do_exec_row() - calls, this member function should be called to prepare for the - entire sequence. Typically, this member function will allocate - space for any buffers that are needed for the two member - functions mentioned above. - - RETURN VALUE - - The member function will return 0 if all went OK, or a non-zero - error code otherwise. - */ - virtual int do_before_row_operations(TABLE *table) = 0; - - /* - Primitive to clean up after a sequence of row executions. - - DESCRIPTION - - After doing a sequence of do_prepare_row() and do_exec_row(), - this member function should be called to clean up and release - any allocated buffers. - */ - virtual int do_after_row_operations(TABLE *table, int error) = 0; - - /* - Primitive to prepare for handling one row in a row-level event. - - DESCRIPTION - - The member function prepares for execution of operations needed for one - row in a row-level event by reading up data from the buffer containing - the row. No specific interpretation of the data is normally done here, - since SQL thread specific data is not available: that data is made - available for the do_exec function. - - A pointer to the start of the next row, or NULL if the preparation - failed. Currently, preparation cannot fail, but don't rely on this - behavior. - - RETURN VALUE - Error code, if something went wrong, 0 otherwise. - */ - virtual int do_prepare_row(THD*, rpl_group_info*, TABLE*, - uchar const *row_start, - uchar const **row_end) = 0; - - /* - Primitive to do the actual execution necessary for a row. - - DESCRIPTION - The member function will do the actual execution needed to handle a row. - - RETURN VALUE - 0 if execution succeeded, 1 if execution failed. - - */ - virtual int do_exec_row(TABLE *table) = 0; - -#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ -}; - - -/** - @class Write_rows_log_event_old - - Old class for binlog events that write new rows to a table (event - type code PRE_GA_WRITE_ROWS_EVENT). Such events are never produced - by this version of the server, but they may be read from a relay log - created by an old server. New servers create events of class - Write_rows_log_event (event type code WRITE_ROWS_EVENT) instead. -*/ -class Write_rows_log_event_old : public Old_rows_log_event -{ - /********** BEGIN CUT & PASTE FROM Write_rows_log_event **********/ -public: -#if !defined(MYSQL_CLIENT) - Write_rows_log_event_old(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols, bool is_transactional); -#endif -#ifdef HAVE_REPLICATION - Write_rows_log_event_old(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif -#if !defined(MYSQL_CLIENT) - static bool binlog_row_logging_function(THD *thd, TABLE *table, - bool is_transactional, - const uchar *before_record - __attribute__((unused)), - const uchar *after_record) - { - return thd->binlog_write_row(table, is_transactional, after_record); - } -#endif - -private: -#ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); -#endif - /********** END OF CUT & PASTE FROM Write_rows_log_event **********/ - -public: - enum - { - /* Support interface to THD::binlog_prepare_pending_rows_event */ - TYPE_CODE = PRE_GA_WRITE_ROWS_EVENT - }; - -private: - virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - // use old definition of do_apply_event() - virtual int do_apply_event(rpl_group_info *rgi) - { return Old_rows_log_event::do_apply_event(this, rgi); } - - // primitives for old version of do_apply_event() - virtual int do_before_row_operations(TABLE *table); - virtual int do_after_row_operations(TABLE *table, int error); - virtual int do_prepare_row(THD*, rpl_group_info*, TABLE*, - uchar const *row_start, uchar const **row_end); - virtual int do_exec_row(TABLE *table); - -#endif -}; - - -/** - @class Update_rows_log_event_old - - Old class for binlog events that modify existing rows to a table - (event type code PRE_GA_UPDATE_ROWS_EVENT). Such events are never - produced by this version of the server, but they may be read from a - relay log created by an old server. New servers create events of - class Update_rows_log_event (event type code UPDATE_ROWS_EVENT) - instead. -*/ -class Update_rows_log_event_old : public Old_rows_log_event -{ - /********** BEGIN CUT & PASTE FROM Update_rows_log_event **********/ -public: -#ifndef MYSQL_CLIENT - Update_rows_log_event_old(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols, - bool is_transactional); -#endif - -#ifdef HAVE_REPLICATION - Update_rows_log_event_old(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif - -#if !defined(MYSQL_CLIENT) - static bool binlog_row_logging_function(THD *thd, TABLE *table, - bool is_transactional, - MY_BITMAP *cols, - uint fields, - const uchar *before_record, - const uchar *after_record) - { - return thd->binlog_update_row(table, is_transactional, - before_record, after_record); - } -#endif - -protected: -#ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); -#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ - /********** END OF CUT & PASTE FROM Update_rows_log_event **********/ - - uchar *m_after_image, *m_memory; - -public: - enum - { - /* Support interface to THD::binlog_prepare_pending_rows_event */ - TYPE_CODE = PRE_GA_UPDATE_ROWS_EVENT - }; - -private: - virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - // use old definition of do_apply_event() - virtual int do_apply_event(rpl_group_info *rgi) - { return Old_rows_log_event::do_apply_event(this, rgi); } - - // primitives for old version of do_apply_event() - virtual int do_before_row_operations(TABLE *table); - virtual int do_after_row_operations(TABLE *table, int error); - virtual int do_prepare_row(THD*, rpl_group_info*, TABLE*, - uchar const *row_start, uchar const **row_end); - virtual int do_exec_row(TABLE *table); -#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ -}; - - -/** - @class Delete_rows_log_event_old - - Old class for binlog events that delete existing rows from a table - (event type code PRE_GA_DELETE_ROWS_EVENT). Such events are never - produced by this version of the server, but they may be read from a - relay log created by an old server. New servers create events of - class Delete_rows_log_event (event type code DELETE_ROWS_EVENT) - instead. -*/ -class Delete_rows_log_event_old : public Old_rows_log_event -{ - /********** BEGIN CUT & PASTE FROM Update_rows_log_event **********/ -public: -#ifndef MYSQL_CLIENT - Delete_rows_log_event_old(THD*, TABLE*, ulong, - MY_BITMAP const *cols, bool is_transactional); -#endif -#ifdef HAVE_REPLICATION - Delete_rows_log_event_old(const char *buf, uint event_len, - const Format_description_log_event *description_event); -#endif -#if !defined(MYSQL_CLIENT) - static bool binlog_row_logging_function(THD *thd, TABLE *table, - bool is_transactional, - MY_BITMAP *cols, - uint fields, - const uchar *before_record, - const uchar *after_record - __attribute__((unused))) - { - return thd->binlog_delete_row(table, is_transactional, before_record); - } -#endif - -protected: -#ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); -#endif - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const Slave_reporting_capability *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); -#endif - /********** END CUT & PASTE FROM Delete_rows_log_event **********/ - - uchar *m_after_image, *m_memory; - -public: - enum - { - /* Support interface to THD::binlog_prepare_pending_rows_event */ - TYPE_CODE = PRE_GA_DELETE_ROWS_EVENT - }; - -private: - virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - // use old definition of do_apply_event() - virtual int do_apply_event(rpl_group_info *rgi) - { return Old_rows_log_event::do_apply_event(this, rgi); } - - // primitives for old version of do_apply_event() - virtual int do_before_row_operations(TABLE *table); - virtual int do_after_row_operations(TABLE *table, int error); - virtual int do_prepare_row(THD*, rpl_group_info*, TABLE*, - uchar const *row_start, uchar const **row_end); - virtual int do_exec_row(TABLE *table); -#endif -}; - - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/log_slow.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/log_slow.h deleted file mode 100644 index c6b3407..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/log_slow.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2009, 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 or later of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Defining what to log to slow log */ - -#ifndef LOG_SLOW_INCLUDED -#define LOG_SLOW_INCLUDED - -#define LOG_SLOW_VERBOSITY_INIT 0 -#define LOG_SLOW_VERBOSITY_INNODB (1U << 0) -#define LOG_SLOW_VERBOSITY_QUERY_PLAN (1U << 1) -#define LOG_SLOW_VERBOSITY_EXPLAIN (1U << 2) - -#define QPLAN_INIT QPLAN_QC_NO - -#define QPLAN_ADMIN (1U << 0) -#define QPLAN_FILESORT (1U << 1) -#define QPLAN_FILESORT_DISK (1U << 2) -#define QPLAN_FILESORT_PRIORITY_QUEUE (1U << 3) -#define QPLAN_FULL_JOIN (1U << 4) -#define QPLAN_FULL_SCAN (1U << 5) -#define QPLAN_NOT_USING_INDEX (1U << 6) -#define QPLAN_QC (1U << 7) -#define QPLAN_QC_NO (1U << 8) -#define QPLAN_TMP_TABLE (1U << 9) -#define QPLAN_TMP_DISK (1U << 10) - -/* ... */ -#define QPLAN_STATUS (1UL << 31) /* not in the slow_log_filter */ -#define QPLAN_MAX (1UL << 31) /* reserved as placeholder */ - -/* Bits for log_slow_disabled_statements */ -#define LOG_SLOW_DISABLE_ADMIN (1 << 0) -#define LOG_SLOW_DISABLE_CALL (1 << 1) -#define LOG_SLOW_DISABLE_SLAVE (1 << 2) -#define LOG_SLOW_DISABLE_SP (1 << 3) - -/* Bits for log_disabled_statements */ -#define LOG_DISABLE_SLAVE (1 << 0) -#define LOG_DISABLE_SP (1 << 1) - -#endif /* LOG_SLOW_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/maria.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/maria.h deleted file mode 100644 index 7fdf95f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/maria.h +++ /dev/null @@ -1,154 +0,0 @@ -/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. - Copyright (c) 2009, 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* This file should be included when using maria functions */ - -#ifndef _maria_h -#define _maria_h -#include -#include -#include "my_compare.h" -#include "ft_global.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define MARIA_UNIQUE_HASH_LENGTH 4 -extern my_bool maria_delay_key_write; -uint maria_max_key_length(void); -#define maria_max_key_segments() HA_MAX_KEY_SEG - -struct st_maria_bit_buff; -struct st_maria_page; -struct st_maria_s_param; -struct st_maria_share; -typedef struct st_maria_decode_tree MARIA_DECODE_TREE; -typedef struct st_maria_handler MARIA_HA; -typedef struct st_maria_key MARIA_KEY; -typedef ulonglong MARIA_RECORD_POS; - -typedef struct st_maria_keydef /* Key definition with open & info */ -{ - struct st_maria_share *share; /* Pointer to base (set in open) */ - mysql_rwlock_t root_lock; /* locking of tree */ - uint16 keysegs; /* Number of key-segment */ - uint16 flag; /* NOSAME, PACK_USED */ - - uint8 key_alg; /* BTREE, RTREE */ - uint8 key_nr; /* key number (auto) */ - uint16 block_length; /* Length of keyblock (auto) */ - uint16 underflow_block_length; /* When to execute underflow */ - uint16 keylength; /* Tot length of keyparts (auto) */ - uint16 minlength; /* min length of (packed) key (auto) */ - uint16 maxlength; /* max length of (packed) key (auto) */ - uint16 max_store_length; /* Size to store key + overhead */ - uint32 write_comp_flag; /* compare flag for write key (auto) */ - uint32 version; /* For concurrent read/write */ - uint32 ftkey_nr; /* full-text index number */ - - HA_KEYSEG *seg, *end; - struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */ - int (*bin_search)(const MARIA_KEY *key, const struct st_maria_page *page, - uint32 comp_flag, uchar **ret_pos, uchar *buff, - my_bool *was_last_key); - uint (*get_key)(MARIA_KEY *key, uint page_flag, uint nod_flag, - uchar **page); - uchar *(*skip_key)(MARIA_KEY *key, uint page_flag, uint nod_flag, - uchar *page); - int (*pack_key)(const MARIA_KEY *key, uint nod_flag, - uchar *next_key, uchar *org_key, uchar *prev_key, - struct st_maria_s_param *s_temp); - void (*store_key)(struct st_maria_keydef *keyinfo, uchar *key_pos, - struct st_maria_s_param *s_temp); - my_bool (*ck_insert)(MARIA_HA *inf, MARIA_KEY *key); - my_bool (*ck_delete)(MARIA_HA *inf, MARIA_KEY *klen); - MARIA_KEY *(*make_key)(MARIA_HA *info, MARIA_KEY *int_key, uint keynr, - uchar *key, const uchar *record, - MARIA_RECORD_POS filepos, ulonglong trid); -} MARIA_KEYDEF; - - -typedef struct st_maria_unique_def /* Segment definition of unique */ -{ - uint16 keysegs; /* Number of key-segment */ - uint8 key; /* Mapped to which key */ - uint8 null_are_equal; - HA_KEYSEG *seg, *end; -} MARIA_UNIQUEDEF; - -/* - Note that null markers should always be first in a row ! - When creating a column, one should only specify: - type, length, null_bit and null_pos -*/ - -typedef struct st_maria_columndef /* column information */ -{ - enum en_fieldtype type; - uint32 offset; /* Offset to position in row */ - uint16 length; /* length of field */ - uint16 column_nr; - /* Intern variable (size of total storage area for the row) */ - uint16 fill_length; - uint16 null_pos; /* Position for null marker */ - uint16 empty_pos; /* Position for empty marker */ - uint8 null_bit; /* If column may be NULL */ - /* Intern. Set if column should be zero packed (part of empty_bits) */ - uint8 empty_bit; - -#ifndef NOT_PACKED_DATABASES - void(*unpack)(struct st_maria_columndef *rec, - struct st_maria_bit_buff *buff, - uchar *start, uchar *end); - enum en_fieldtype base_type; - uint space_length_bits, pack_type; - MARIA_DECODE_TREE *huff_tree; -#endif -} MARIA_COLUMNDEF; - - -typedef struct st_maria_create_info -{ - const char *index_file_name, *data_file_name; /* If using symlinks */ - ha_rows max_rows; - ha_rows reloc_rows; - ulonglong auto_increment; - ulonglong data_file_length; - ulonglong key_file_length; - ulong s3_block_size; - /* Size of null bitmap at start of row */ - uint null_bytes; - uint old_options; - uint compression_algorithm; - enum data_file_type org_data_file_type; - uint16 language; - my_bool with_auto_increment, transactional, encrypted; -} MARIA_CREATE_INFO; - -extern int maria_create(const char *name, enum data_file_type record_type, - uint keys, MARIA_KEYDEF *keydef, - uint columns, MARIA_COLUMNDEF *columndef, - uint uniques, MARIA_UNIQUEDEF *uniquedef, - MARIA_CREATE_INFO *create_info, uint flags); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mariadb.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/mariadb.h deleted file mode 100644 index 00cf2ed..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mariadb.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2010, 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -/* - Include file that should always be included first in all file in the sql - directory. Used to ensure that some files, like my_global.h and my_config.h - are always included first. - It can also be used to speed up compilation by using precompiled headers. - - This file should include a minum set of header files used by all files - and header files that are very seldom changed. - It can also include some defines that all files should be aware of. -*/ - -#ifndef MARIADB_INCLUDED -#define MARIADB_INCLUDED -#include -#endif /* MARIADB_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mdl.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/mdl.h deleted file mode 100644 index f6b7154..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mdl.h +++ /dev/null @@ -1,1132 +0,0 @@ -#ifndef MDL_H -#define MDL_H -/* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "sql_plist.h" -#include "ilist.h" -#include -#include -#include -#include - -class THD; - -class MDL_context; -class MDL_lock; -class MDL_ticket; -bool ok_for_lower_case_names(const char *name); - -typedef unsigned short mdl_bitmap_t; -#define MDL_BIT(A) static_cast(1U << A) - - -/** - @def ENTER_COND(C, M, S, O) - Start a wait on a condition. - @param C the condition to wait on - @param M the associated mutex - @param S the new stage to enter - @param O the previous stage - @sa EXIT_COND(). -*/ -#define ENTER_COND(C, M, S, O) enter_cond(C, M, S, O, __func__, __FILE__, __LINE__) - -/** - @def EXIT_COND(S) - End a wait on a condition - @param S the new stage to enter -*/ -#define EXIT_COND(S) exit_cond(S, __func__, __FILE__, __LINE__) - -/** - An interface to separate the MDL module from the THD, and the rest of the - server code. - */ - -class MDL_context_owner -{ -public: - virtual ~MDL_context_owner() {} - - /** - Enter a condition wait. - For @c enter_cond() / @c exit_cond() to work the mutex must be held before - @c enter_cond(); this mutex is then released by @c exit_cond(). - Usage must be: lock mutex; enter_cond(); your code; exit_cond(). - @param cond the condition to wait on - @param mutex the associated mutex - @param [in] stage the stage to enter, or NULL - @param [out] old_stage the previous stage, or NULL - @param src_function function name of the caller - @param src_file file name of the caller - @param src_line line number of the caller - @sa ENTER_COND(), THD::enter_cond() - @sa EXIT_COND(), THD::exit_cond() - */ - virtual void enter_cond(mysql_cond_t *cond, mysql_mutex_t *mutex, - const PSI_stage_info *stage, PSI_stage_info *old_stage, - const char *src_function, const char *src_file, - int src_line) = 0; - - /** - @def EXIT_COND(S) - End a wait on a condition - @param [in] stage the new stage to enter - @param src_function function name of the caller - @param src_file file name of the caller - @param src_line line number of the caller - @sa ENTER_COND(), THD::enter_cond() - @sa EXIT_COND(), THD::exit_cond() - */ - virtual void exit_cond(const PSI_stage_info *stage, - const char *src_function, const char *src_file, - int src_line) = 0; - /** - Has the owner thread been killed? - */ - virtual int is_killed() = 0; - - /** - This one is only used for DEBUG_SYNC. - (Do not use it to peek/poke into other parts of THD.) - */ - virtual THD* get_thd() = 0; - - /** - @see THD::notify_shared_lock() - */ - virtual bool notify_shared_lock(MDL_context_owner *in_use, - bool needs_thr_lock_abort) = 0; -}; - -/** - Type of metadata lock request. - - @sa Comments for MDL_object_lock::can_grant_lock() and - MDL_scoped_lock::can_grant_lock() for details. - - Scoped locks are database (or schema) locks. - The object locks are for tables, triggers etc. -*/ - -enum enum_mdl_type { - /* This means that the MDL_request is not initialized */ - MDL_NOT_INITIALIZED= -1, - /* - An intention exclusive metadata lock (IX). Used only for scoped locks. - Owner of this type of lock can acquire upgradable exclusive locks on - individual objects. - Compatible with other IX locks, but is incompatible with scoped S and - X locks. - IX lock is taken in SCHEMA namespace when we intend to modify - object metadata. Object may refer table, stored procedure, trigger, - view/etc. - */ - MDL_INTENTION_EXCLUSIVE= 0, - /* - A shared metadata lock (S). - To be used in cases when we are interested in object metadata only - and there is no intention to access object data (e.g. for stored - routines or during preparing prepared statements). - We also mis-use this type of lock for open HANDLERs, since lock - acquired by this statement has to be compatible with lock acquired - by LOCK TABLES ... WRITE statement, i.e. SNRW (We can't get by by - acquiring S lock at HANDLER ... OPEN time and upgrading it to SR - lock for HANDLER ... READ as it doesn't solve problem with need - to abort DML statements which wait on table level lock while having - open HANDLER in the same connection). - To avoid deadlock which may occur when SNRW lock is being upgraded to - X lock for table on which there is an active S lock which is owned by - thread which waits in its turn for table-level lock owned by thread - performing upgrade we have to use thr_abort_locks_for_thread() - facility in such situation. - This problem does not arise for locks on stored routines as we don't - use SNRW locks for them. It also does not arise when S locks are used - during PREPARE calls as table-level locks are not acquired in this - case. - This lock is taken for global read lock, when caching a stored - procedure in memory for the duration of the transaction and for - tables used by prepared statements. - */ - MDL_SHARED, - /* - A high priority shared metadata lock. - Used for cases when there is no intention to access object data (i.e. - data in the table). - "High priority" means that, unlike other shared locks, it is granted - ignoring pending requests for exclusive locks. Intended for use in - cases when we only need to access metadata and not data, e.g. when - filling an INFORMATION_SCHEMA table. - Since SH lock is compatible with SNRW lock, the connection that - holds SH lock lock should not try to acquire any kind of table-level - or row-level lock, as this can lead to a deadlock. Moreover, after - acquiring SH lock, the connection should not wait for any other - resource, as it might cause starvation for X locks and a potential - deadlock during upgrade of SNW or SNRW to X lock (e.g. if the - upgrading connection holds the resource that is being waited for). - */ - MDL_SHARED_HIGH_PRIO, - /* - A shared metadata lock (SR) for cases when there is an intention to read - data from table. - A connection holding this kind of lock can read table metadata and read - table data (after acquiring appropriate table and row-level locks). - This means that one can only acquire TL_READ, TL_READ_NO_INSERT, and - similar table-level locks on table if one holds SR MDL lock on it. - To be used for tables in SELECTs, subqueries, and LOCK TABLE ... READ - statements. - */ - MDL_SHARED_READ, - /* - A shared metadata lock (SW) for cases when there is an intention to modify - (and not just read) data in the table. - A connection holding SW lock can read table metadata and modify or read - table data (after acquiring appropriate table and row-level locks). - To be used for tables to be modified by INSERT, UPDATE, DELETE - statements, but not LOCK TABLE ... WRITE or DDL). Also taken by - SELECT ... FOR UPDATE. - */ - MDL_SHARED_WRITE, - /* - An upgradable shared metadata lock for cases when there is an - intention to modify (and not just read) data in the table. - Can be upgraded to MDL_SHARED_NO_WRITE and MDL_EXCLUSIVE. - A connection holding SU lock can read table metadata and modify or read - table data (after acquiring appropriate table and row-level locks). - To be used for the first phase of ALTER TABLE. - */ - MDL_SHARED_UPGRADABLE, - /* - A shared metadata lock for cases when we need to read data from table - and block all concurrent modifications to it (for both data and metadata). - Used by LOCK TABLES READ statement. - */ - MDL_SHARED_READ_ONLY, - /* - An upgradable shared metadata lock which blocks all attempts to update - table data, allowing reads. - A connection holding this kind of lock can read table metadata and read - table data. - Can be upgraded to X metadata lock. - Note, that since this type of lock is not compatible with SNRW or SW - lock types, acquiring appropriate engine-level locks for reading - (TL_READ* for MyISAM, shared row locks in InnoDB) should be - contention-free. - To be used for the first phase of ALTER TABLE, when copying data between - tables, to allow concurrent SELECTs from the table, but not UPDATEs. - */ - MDL_SHARED_NO_WRITE, - /* - An upgradable shared metadata lock which allows other connections - to access table metadata, but not data. - It blocks all attempts to read or update table data, while allowing - INFORMATION_SCHEMA and SHOW queries. - A connection holding this kind of lock can read table metadata modify and - read table data. - Can be upgraded to X metadata lock. - To be used for LOCK TABLES WRITE statement. - Not compatible with any other lock type except S and SH. - */ - MDL_SHARED_NO_READ_WRITE, - /* - An exclusive metadata lock (X). - A connection holding this lock can modify both table's metadata and data. - No other type of metadata lock can be granted while this lock is held. - To be used for CREATE/DROP/RENAME TABLE statements and for execution of - certain phases of other DDL statements. - */ - MDL_EXCLUSIVE, - /* This should be the last !!! */ - MDL_TYPE_END -}; - - -/** Backup locks */ - -/** - Block concurrent backup -*/ -#define MDL_BACKUP_START enum_mdl_type(0) -/** - Block new write requests to non transactional tables -*/ -#define MDL_BACKUP_FLUSH enum_mdl_type(1) -/** - In addition to previous locks, blocks running requests to non trans tables - Used to wait until all DML usage of on trans tables are finished -*/ -#define MDL_BACKUP_WAIT_FLUSH enum_mdl_type(2) -/** - In addition to previous locks, blocks new DDL's from starting -*/ -#define MDL_BACKUP_WAIT_DDL enum_mdl_type(3) -/** - In addition to previous locks, blocks commits -*/ -#define MDL_BACKUP_WAIT_COMMIT enum_mdl_type(4) - -/** - Blocks (or is blocked by) statements that intend to modify data. Acquired - before commit lock by FLUSH TABLES WITH READ LOCK. -*/ -#define MDL_BACKUP_FTWRL1 enum_mdl_type(5) - -/** - Blocks (or is blocked by) commits. Acquired after global read lock by - FLUSH TABLES WITH READ LOCK. -*/ -#define MDL_BACKUP_FTWRL2 enum_mdl_type(6) - -#define MDL_BACKUP_DML enum_mdl_type(7) -#define MDL_BACKUP_TRANS_DML enum_mdl_type(8) -#define MDL_BACKUP_SYS_DML enum_mdl_type(9) - -/** - Must be acquired by DDL statements that intend to modify data. - Currently it's also used for LOCK TABLES. -*/ -#define MDL_BACKUP_DDL enum_mdl_type(10) - -/** - Blocks new DDL's. Used by backup code to enable DDL logging -*/ -#define MDL_BACKUP_BLOCK_DDL enum_mdl_type(11) - -/* - Statement is modifying data, but will not block MDL_BACKUP_DDL or earlier - BACKUP stages. - ALTER TABLE is started with MDL_BACKUP_DDL, but changed to - MDL_BACKUP_ALTER_COPY while alter table is copying or modifing data. -*/ - -#define MDL_BACKUP_ALTER_COPY enum_mdl_type(12) - -/** - Must be acquired during commit. -*/ -#define MDL_BACKUP_COMMIT enum_mdl_type(13) -#define MDL_BACKUP_END enum_mdl_type(14) - - -/** Duration of metadata lock. */ - -enum enum_mdl_duration { - /** - Locks with statement duration are automatically released at the end - of statement or transaction. - */ - MDL_STATEMENT= 0, - /** - Locks with transaction duration are automatically released at the end - of transaction. - */ - MDL_TRANSACTION, - /** - Locks with explicit duration survive the end of statement and transaction. - They have to be released explicitly by calling MDL_context::release_lock(). - */ - MDL_EXPLICIT, - /* This should be the last ! */ - MDL_DURATION_END }; - - -/** Maximal length of key for metadata locking subsystem. */ -#define MAX_MDLKEY_LENGTH (1 + NAME_LEN + 1 + NAME_LEN + 1) - - -/** - Metadata lock object key. - - A lock is requested or granted based on a fully qualified name and type. - E.g. They key for a table consists of <0 (=table)>++. - Elsewhere in the comments this triple will be referred to simply as "key" - or "name". -*/ - -struct MDL_key -{ -public: -#ifdef HAVE_PSI_INTERFACE - static void init_psi_keys(); -#endif - - /** - Object namespaces. - Sic: when adding a new member to this enum make sure to - update m_namespace_to_wait_state_name array in mdl.cc and - metadata_lock_info_lock_name in metadata_lock_info.cc! - - Different types of objects exist in different namespaces - - SCHEMA is for databases (to protect against DROP DATABASE) - - TABLE is for tables and views. - - BACKUP is for locking DML, DDL and COMMIT's during BACKUP STAGES - - FUNCTION is for stored functions. - - PROCEDURE is for stored procedures. - - TRIGGER is for triggers. - - EVENT is for event scheduler events - Note that although there isn't metadata locking on triggers, - it's necessary to have a separate namespace for them since - MDL_key is also used outside of the MDL subsystem. - */ - enum enum_mdl_namespace { BACKUP=0, - SCHEMA, - TABLE, - FUNCTION, - PROCEDURE, - PACKAGE_BODY, - TRIGGER, - EVENT, - USER_LOCK, /* user level locks. */ - /* This should be the last ! */ - NAMESPACE_END }; - - const uchar *ptr() const { return (uchar*) m_ptr; } - uint length() const { return m_length; } - - const char *db_name() const { return m_ptr + 1; } - uint db_name_length() const { return m_db_name_length; } - - const char *name() const { return m_ptr + m_db_name_length + 2; } - uint name_length() const { return m_length - m_db_name_length - 3; } - - enum_mdl_namespace mdl_namespace() const - { return (enum_mdl_namespace)(m_ptr[0]); } - - /** - Construct a metadata lock key from a triplet (mdl_namespace, - database and name). - - @remark The key for a table is ++
- - @param mdl_namespace Id of namespace of object to be locked - @param db Name of database to which the object belongs - @param name Name of of the object - @param key Where to store the the MDL key. - */ - void mdl_key_init(enum_mdl_namespace mdl_namespace_arg, - const char *db, const char *name_arg) - { - m_ptr[0]= (char) mdl_namespace_arg; - /* - It is responsibility of caller to ensure that db and object names - are not longer than NAME_LEN. Still we play safe and try to avoid - buffer overruns. - */ - DBUG_ASSERT(strlen(db) <= NAME_LEN); - DBUG_ASSERT(strlen(name_arg) <= NAME_LEN); - m_db_name_length= static_cast(strmake(m_ptr + 1, db, NAME_LEN) - - m_ptr - 1); - m_length= static_cast(strmake(m_ptr + m_db_name_length + 2, - name_arg, - NAME_LEN) - m_ptr + 1); - m_hash_value= my_hash_sort(&my_charset_bin, (uchar*) m_ptr + 1, - m_length - 1); - DBUG_SLOW_ASSERT(mdl_namespace_arg == USER_LOCK || ok_for_lower_case_names(db)); - } - void mdl_key_init(const MDL_key *rhs) - { - memcpy(m_ptr, rhs->m_ptr, rhs->m_length); - m_length= rhs->m_length; - m_db_name_length= rhs->m_db_name_length; - m_hash_value= rhs->m_hash_value; - } - bool is_equal(const MDL_key *rhs) const - { - return (m_length == rhs->m_length && - memcmp(m_ptr, rhs->m_ptr, m_length) == 0); - } - /** - Compare two MDL keys lexicographically. - */ - int cmp(const MDL_key *rhs) const - { - /* - The key buffer is always '\0'-terminated. Since key - character set is utf-8, we can safely assume that no - character starts with a zero byte. - */ - return memcmp(m_ptr, rhs->m_ptr, MY_MIN(m_length, rhs->m_length)); - } - - MDL_key(const MDL_key *rhs) - { - mdl_key_init(rhs); - } - MDL_key(enum_mdl_namespace namespace_arg, - const char *db_arg, const char *name_arg) - { - mdl_key_init(namespace_arg, db_arg, name_arg); - } - MDL_key() {} /* To use when part of MDL_request. */ - - /** - Get thread state name to be used in case when we have to - wait on resource identified by key. - */ - const PSI_stage_info * get_wait_state_name() const - { - return & m_namespace_to_wait_state_name[(int)mdl_namespace()]; - } - my_hash_value_type hash_value() const - { - return m_hash_value + mdl_namespace(); - } - my_hash_value_type tc_hash_value() const - { - return m_hash_value; - } - -private: - uint16 m_length; - uint16 m_db_name_length; - my_hash_value_type m_hash_value; - char m_ptr[MAX_MDLKEY_LENGTH]; - static PSI_stage_info m_namespace_to_wait_state_name[NAMESPACE_END]; -private: - MDL_key(const MDL_key &); /* not implemented */ - MDL_key &operator=(const MDL_key &); /* not implemented */ - friend my_hash_value_type mdl_hash_function(CHARSET_INFO *, - const uchar *, size_t); -}; - - -/** - A pending metadata lock request. - - A lock request and a granted metadata lock are represented by - different classes because they have different allocation - sites and hence different lifetimes. The allocation of lock requests is - controlled from outside of the MDL subsystem, while allocation of granted - locks (tickets) is controlled within the MDL subsystem. - - MDL_request is a C structure, you don't need to call a constructor - or destructor for it. -*/ - -class MDL_request -{ -public: - /** Type of metadata lock. */ - enum enum_mdl_type type; - /** Duration for requested lock. */ - enum enum_mdl_duration duration; - - /** - Pointers for participating in the list of lock requests for this context. - */ - MDL_request *next_in_list; - MDL_request **prev_in_list; - /** - Pointer to the lock ticket object for this lock request. - Valid only if this lock request is satisfied. - */ - MDL_ticket *ticket; - - /** A lock is requested based on a fully qualified name and type. */ - MDL_key key; - - const char *m_src_file; - uint m_src_line; - -public: - - static void *operator new(size_t size, MEM_ROOT *mem_root) throw () - { return alloc_root(mem_root, size); } - static void operator delete(void *, MEM_ROOT *) {} - - void init_with_source(MDL_key::enum_mdl_namespace namespace_arg, - const char *db_arg, const char *name_arg, - enum_mdl_type mdl_type_arg, - enum_mdl_duration mdl_duration_arg, - const char *src_file, uint src_line); - void init_by_key_with_source(const MDL_key *key_arg, enum_mdl_type mdl_type_arg, - enum_mdl_duration mdl_duration_arg, - const char *src_file, uint src_line); - /** Set type of lock request. Can be only applied to pending locks. */ - inline void set_type(enum_mdl_type type_arg) - { - DBUG_ASSERT(ticket == NULL); - type= type_arg; - } - void move_from(MDL_request &from) - { - type= from.type; - duration= from.duration; - ticket= from.ticket; - next_in_list= from.next_in_list; - prev_in_list= from.prev_in_list; - key.mdl_key_init(&from.key); - from.ticket= NULL; // that's what "move" means - } - - /** - Is this a request for a lock which allow data to be updated? - - @note This method returns true for MDL_SHARED_UPGRADABLE type of - lock. Even though this type of lock doesn't allow updates - it will always be upgraded to one that does. - */ - bool is_write_lock_request() const - { - return (type >= MDL_SHARED_WRITE && - type != MDL_SHARED_READ_ONLY); - } - - /* - This is to work around the ugliness of TABLE_LIST - compiler-generated assignment operator. It is currently used - in several places to quickly copy "most" of the members of the - table list. These places currently never assume that the mdl - request is carried over to the new TABLE_LIST, or shared - between lists. - - This method does not initialize the instance being assigned! - Use of init() for initialization after this assignment operator - is mandatory. Can only be used before the request has been - granted. - */ - MDL_request& operator=(const MDL_request &) - { - type= MDL_NOT_INITIALIZED; - ticket= NULL; - /* Do nothing, in particular, don't try to copy the key. */ - return *this; - } - /* Another piece of ugliness for TABLE_LIST constructor */ - MDL_request(): type(MDL_NOT_INITIALIZED), ticket(NULL) {} - - MDL_request(const MDL_request *rhs) - :type(rhs->type), - duration(rhs->duration), - ticket(NULL), - key(&rhs->key) - {} -}; - - -typedef void (*mdl_cached_object_release_hook)(void *); - -#define MDL_REQUEST_INIT(R, P1, P2, P3, P4, P5) \ - (*R).init_with_source(P1, P2, P3, P4, P5, __FILE__, __LINE__) - -#define MDL_REQUEST_INIT_BY_KEY(R, P1, P2, P3) \ - (*R).init_by_key_with_source(P1, P2, P3, __FILE__, __LINE__) - - -/** - An abstract class for inspection of a connected - subgraph of the wait-for graph. -*/ - -class MDL_wait_for_graph_visitor -{ -public: - virtual bool enter_node(MDL_context *node) = 0; - virtual void leave_node(MDL_context *node) = 0; - - virtual bool inspect_edge(MDL_context *dest) = 0; - virtual ~MDL_wait_for_graph_visitor(); - MDL_wait_for_graph_visitor() {} -}; - -/** - Abstract class representing an edge in the waiters graph - to be traversed by deadlock detection algorithm. -*/ - -class MDL_wait_for_subgraph -{ -public: - virtual ~MDL_wait_for_subgraph(); - - /** - Accept a wait-for graph visitor to inspect the node - this edge is leading to. - */ - virtual bool accept_visitor(MDL_wait_for_graph_visitor *gvisitor) = 0; - - enum enum_deadlock_weight - { - DEADLOCK_WEIGHT_FTWRL1= 0, - DEADLOCK_WEIGHT_DML= 1, - DEADLOCK_WEIGHT_DDL= 100 - }; - /* A helper used to determine which lock request should be aborted. */ - virtual uint get_deadlock_weight() const = 0; -}; - - -/** - A granted metadata lock. - - @warning MDL_ticket members are private to the MDL subsystem. - - @note Multiple shared locks on a same object are represented by a - single ticket. The same does not apply for other lock types. - - @note There are two groups of MDL_ticket members: - - "Externally accessible". These members can be accessed from - threads/contexts different than ticket owner in cases when - ticket participates in some list of granted or waiting tickets - for a lock. Therefore one should change these members before - including then to waiting/granted lists or while holding lock - protecting those lists. - - "Context private". Such members are private to thread/context - owning this ticket. I.e. they should not be accessed from other - threads/contexts. -*/ - -class MDL_ticket : public MDL_wait_for_subgraph, public ilist_node<> -{ -public: - /** - Pointers for participating in the list of lock requests for this context. - Context private. - */ - MDL_ticket *next_in_context; - MDL_ticket **prev_in_context; -public: -#ifdef WITH_WSREP - void wsrep_report(bool debug) const; -#endif /* WITH_WSREP */ - bool has_pending_conflicting_lock() const; - - MDL_context *get_ctx() const { return m_ctx; } - bool is_upgradable_or_exclusive() const - { - return m_type == MDL_SHARED_UPGRADABLE || - m_type == MDL_SHARED_NO_WRITE || - m_type == MDL_SHARED_NO_READ_WRITE || - m_type == MDL_EXCLUSIVE; - } - enum_mdl_type get_type() const { return m_type; } - const LEX_STRING *get_type_name() const; - const LEX_STRING *get_type_name(enum_mdl_type type) const; - MDL_lock *get_lock() const { return m_lock; } - MDL_key *get_key() const; - void downgrade_lock(enum_mdl_type type); - - bool has_stronger_or_equal_type(enum_mdl_type type) const; - - bool is_incompatible_when_granted(enum_mdl_type type) const; - bool is_incompatible_when_waiting(enum_mdl_type type) const; - - /** Implement MDL_wait_for_subgraph interface. */ - virtual bool accept_visitor(MDL_wait_for_graph_visitor *dvisitor); - virtual uint get_deadlock_weight() const; - /** - Status of lock request represented by the ticket as reflected in P_S. - */ - enum enum_psi_status { PENDING = 0, GRANTED, - PRE_ACQUIRE_NOTIFY, POST_RELEASE_NOTIFY }; -private: - friend class MDL_context; - - MDL_ticket(MDL_context *ctx_arg, enum_mdl_type type_arg -#ifndef DBUG_OFF - , enum_mdl_duration duration_arg -#endif - ) - : m_type(type_arg), -#ifndef DBUG_OFF - m_duration(duration_arg), -#endif - m_ctx(ctx_arg), - m_lock(NULL), - m_psi(NULL) - {} - - virtual ~MDL_ticket() - { - DBUG_ASSERT(m_psi == NULL); - } - - static MDL_ticket *create(MDL_context *ctx_arg, enum_mdl_type type_arg -#ifndef DBUG_OFF - , enum_mdl_duration duration_arg -#endif - ); - static void destroy(MDL_ticket *ticket); -private: - /** Type of metadata lock. Externally accessible. */ - enum enum_mdl_type m_type; -#ifndef DBUG_OFF - /** - Duration of lock represented by this ticket. - Context private. Debug-only. - */ - enum_mdl_duration m_duration; -#endif - /** - Context of the owner of the metadata lock ticket. Externally accessible. - */ - MDL_context *m_ctx; - - /** - Pointer to the lock object for this lock ticket. Externally accessible. - */ - MDL_lock *m_lock; - - PSI_metadata_lock *m_psi; - -private: - MDL_ticket(const MDL_ticket &); /* not implemented */ - MDL_ticket &operator=(const MDL_ticket &); /* not implemented */ -}; - - -/** - Savepoint for MDL context. - - Doesn't include metadata locks with explicit duration as - they are not released during rollback to savepoint. -*/ - -class MDL_savepoint -{ -public: - MDL_savepoint() {}; - -private: - MDL_savepoint(MDL_ticket *stmt_ticket, MDL_ticket *trans_ticket) - : m_stmt_ticket(stmt_ticket), m_trans_ticket(trans_ticket) - {} - - friend class MDL_context; - -private: - /** - Pointer to last lock with statement duration which was taken - before creation of savepoint. - */ - MDL_ticket *m_stmt_ticket; - /** - Pointer to last lock with transaction duration which was taken - before creation of savepoint. - */ - MDL_ticket *m_trans_ticket; -}; - - -/** - A reliable way to wait on an MDL lock. -*/ - -class MDL_wait -{ -public: - MDL_wait(); - ~MDL_wait(); - - enum enum_wait_status { EMPTY = 0, GRANTED, VICTIM, TIMEOUT, KILLED }; - - bool set_status(enum_wait_status result_arg); - enum_wait_status get_status(); - void reset_status(); - enum_wait_status timed_wait(MDL_context_owner *owner, - struct timespec *abs_timeout, - bool signal_timeout, - const PSI_stage_info *wait_state_name); -private: - /** - Condvar which is used for waiting until this context's pending - request can be satisfied or this thread has to perform actions - to resolve a potential deadlock (we subscribe to such - notification by adding a ticket corresponding to the request - to an appropriate queue of waiters). - */ - mysql_mutex_t m_LOCK_wait_status; - mysql_cond_t m_COND_wait_status; - enum_wait_status m_wait_status; -}; - - -typedef I_P_List, - I_P_List_counter> - MDL_request_list; - -/** - Context of the owner of metadata locks. I.e. each server - connection has such a context. -*/ - -class MDL_context -{ -public: - typedef I_P_List > - Ticket_list; - - typedef Ticket_list::Iterator Ticket_iterator; - - MDL_context(); - void destroy(); - - bool try_acquire_lock(MDL_request *mdl_request); - bool acquire_lock(MDL_request *mdl_request, double lock_wait_timeout); - bool acquire_locks(MDL_request_list *requests, double lock_wait_timeout); - bool upgrade_shared_lock(MDL_ticket *mdl_ticket, - enum_mdl_type new_type, - double lock_wait_timeout); - - bool clone_ticket(MDL_request *mdl_request); - - void release_all_locks_for_name(MDL_ticket *ticket); - void release_lock(MDL_ticket *ticket); - - bool is_lock_owner(MDL_key::enum_mdl_namespace mdl_namespace, - const char *db, const char *name, - enum_mdl_type mdl_type); - unsigned long get_lock_owner(MDL_key *mdl_key); - - bool has_lock(const MDL_savepoint &mdl_savepoint, MDL_ticket *mdl_ticket); - - inline bool has_locks() const - { - return !(m_tickets[MDL_STATEMENT].is_empty() && - m_tickets[MDL_TRANSACTION].is_empty() && - m_tickets[MDL_EXPLICIT].is_empty()); - } - inline bool has_transactional_locks() const - { - return !m_tickets[MDL_TRANSACTION].is_empty(); - } - - MDL_savepoint mdl_savepoint() - { - return MDL_savepoint(m_tickets[MDL_STATEMENT].front(), - m_tickets[MDL_TRANSACTION].front()); - } - - void set_explicit_duration_for_all_locks(); - void set_transaction_duration_for_all_locks(); - void set_lock_duration(MDL_ticket *mdl_ticket, enum_mdl_duration duration); - - void release_statement_locks(); - void release_transactional_locks(); - void release_explicit_locks(); - void rollback_to_savepoint(const MDL_savepoint &mdl_savepoint); - - MDL_context_owner *get_owner() { return m_owner; } - - /** @pre Only valid if we started waiting for lock. */ - inline uint get_deadlock_weight() const - { return m_waiting_for->get_deadlock_weight(); } - /** - Post signal to the context (and wake it up if necessary). - - @retval FALSE - Success, signal was posted. - @retval TRUE - Failure, signal was not posted since context - already has received some signal or closed - signal slot. - */ - void init(MDL_context_owner *arg) { m_owner= arg; } - - void set_needs_thr_lock_abort(bool needs_thr_lock_abort) - { - /* - @note In theory, this member should be modified under protection - of some lock since it can be accessed from different threads. - In practice, this is not necessary as code which reads this - value and so might miss the fact that value was changed will - always re-try reading it after small timeout and therefore - will see the new value eventually. - */ - m_needs_thr_lock_abort= needs_thr_lock_abort; - } - bool get_needs_thr_lock_abort() const - { - return m_needs_thr_lock_abort; - } -public: - /** - If our request for a lock is scheduled, or aborted by the deadlock - detector, the result is recorded in this class. - */ - MDL_wait m_wait; -private: - /** - Lists of all MDL tickets acquired by this connection. - - Lists of MDL tickets: - --------------------- - The entire set of locks acquired by a connection can be separated - in three subsets according to their duration: locks released at - the end of statement, at the end of transaction and locks are - released explicitly. - - Statement and transactional locks are locks with automatic scope. - They are accumulated in the course of a transaction, and released - either at the end of uppermost statement (for statement locks) or - on COMMIT, ROLLBACK or ROLLBACK TO SAVEPOINT (for transactional - locks). They must not be (and never are) released manually, - i.e. with release_lock() call. - - Tickets with explicit duration are taken for locks that span - multiple transactions or savepoints. - These are: HANDLER SQL locks (HANDLER SQL is - transaction-agnostic), LOCK TABLES locks (you can COMMIT/etc - under LOCK TABLES, and the locked tables stay locked), user level - locks (GET_LOCK()/RELEASE_LOCK() functions) and - locks implementing "global read lock". - - Statement/transactional locks are always prepended to the - beginning of the appropriate list. In other words, they are - stored in reverse temporal order. Thus, when we rollback to - a savepoint, we start popping and releasing tickets from the - front until we reach the last ticket acquired after the savepoint. - - Locks with explicit duration are not stored in any - particular order, and among each other can be split into - four sets: - - [LOCK TABLES locks] [USER locks] [HANDLER locks] [GLOBAL READ LOCK locks] - - The following is known about these sets: - - * GLOBAL READ LOCK locks are always stored last. - This is because one can't say SET GLOBAL read_only=1 or - FLUSH TABLES WITH READ LOCK if one has locked tables. One can, - however, LOCK TABLES after having entered the read only mode. - Note, that subsequent LOCK TABLES statement will unlock the previous - set of tables, but not the GRL! - There are no HANDLER locks after GRL locks because - SET GLOBAL read_only performs a FLUSH TABLES WITH - READ LOCK internally, and FLUSH TABLES, in turn, implicitly - closes all open HANDLERs. - However, one can open a few HANDLERs after entering the - read only mode. - * LOCK TABLES locks include intention exclusive locks on - involved schemas and global intention exclusive lock. - */ - Ticket_list m_tickets[MDL_DURATION_END]; - MDL_context_owner *m_owner; - /** - TRUE - if for this context we will break protocol and try to - acquire table-level locks while having only S lock on - some table. - To avoid deadlocks which might occur during concurrent - upgrade of SNRW lock on such object to X lock we have to - abort waits for table-level locks for such connections. - FALSE - Otherwise. - */ - bool m_needs_thr_lock_abort; - - /** - Read-write lock protecting m_waiting_for member. - - @note The fact that this read-write lock prefers readers is - important as deadlock detector won't work correctly - otherwise. @sa Comment for MDL_lock::m_rwlock. - */ - mysql_prlock_t m_LOCK_waiting_for; - /** - Tell the deadlock detector what metadata lock or table - definition cache entry this session is waiting for. - In principle, this is redundant, as information can be found - by inspecting waiting queues, but we'd very much like it to be - readily available to the wait-for graph iterator. - */ - MDL_wait_for_subgraph *m_waiting_for; - LF_PINS *m_pins; -private: - MDL_ticket *find_ticket(MDL_request *mdl_req, - enum_mdl_duration *duration); - void release_locks_stored_before(enum_mdl_duration duration, MDL_ticket *sentinel); - void release_lock(enum_mdl_duration duration, MDL_ticket *ticket); - bool try_acquire_lock_impl(MDL_request *mdl_request, - MDL_ticket **out_ticket); - bool fix_pins(); - -public: - THD *get_thd() const { return m_owner->get_thd(); } - bool has_explicit_locks(); - void find_deadlock(); - - ulong get_thread_id() const { return thd_get_thread_id(get_thd()); } - - bool visit_subgraph(MDL_wait_for_graph_visitor *dvisitor); - - /** Inform the deadlock detector there is an edge in the wait-for graph. */ - void will_wait_for(MDL_wait_for_subgraph *waiting_for_arg) - { - mysql_prlock_wrlock(&m_LOCK_waiting_for); - m_waiting_for= waiting_for_arg; - mysql_prlock_unlock(&m_LOCK_waiting_for); - } - - /** Remove the wait-for edge from the graph after we're done waiting. */ - void done_waiting_for() - { - mysql_prlock_wrlock(&m_LOCK_waiting_for); - m_waiting_for= NULL; - mysql_prlock_unlock(&m_LOCK_waiting_for); - } - void lock_deadlock_victim() - { - mysql_prlock_rdlock(&m_LOCK_waiting_for); - } - void unlock_deadlock_victim() - { - mysql_prlock_unlock(&m_LOCK_waiting_for); - } -private: - MDL_context(const MDL_context &rhs); /* not implemented */ - MDL_context &operator=(MDL_context &rhs); /* not implemented */ - - /* metadata_lock_info plugin */ - friend int i_s_metadata_lock_info_fill_row(MDL_ticket*, void*); -}; - - -void mdl_init(); -void mdl_destroy(); - -extern "C" unsigned long thd_get_thread_id(const MYSQL_THD thd); - -/** - Check if a connection in question is no longer connected. - - @details - Replication apply thread is always connected. Otherwise, - does a poll on the associated socket to check if the client - is gone. -*/ -extern "C" int thd_is_connected(MYSQL_THD thd); - - -/* - Metadata locking subsystem tries not to grant more than - max_write_lock_count high-prio, strong locks successively, - to avoid starving out weak, low-prio locks. -*/ -extern "C" ulong max_write_lock_count; - -typedef int (*mdl_iterator_callback)(MDL_ticket *ticket, void *arg, - bool granted); -extern MYSQL_PLUGIN_IMPORT -int mdl_iterate(mdl_iterator_callback callback, void *arg); -#ifndef DBUG_OFF -void mdl_dbug_print_locks(); -#else - static inline void mdl_dbug_print_locks() {} -#endif /* DBUG_OFF */ -#endif /* MDL_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mem_root_array.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/mem_root_array.h deleted file mode 100644 index 3d03a5a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mem_root_array.h +++ /dev/null @@ -1,245 +0,0 @@ -/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef MEM_ROOT_ARRAY_INCLUDED -#define MEM_ROOT_ARRAY_INCLUDED - -#include - -/** - A typesafe replacement for DYNAMIC_ARRAY. - We use MEM_ROOT for allocating storage, rather than the C++ heap. - The interface is chosen to be similar to std::vector. - - @remark - Unlike DYNAMIC_ARRAY, elements are properly copied - (rather than memcpy()d) if the underlying array needs to be expanded. - - @remark - Depending on has_trivial_destructor, we destroy objects which are - removed from the array (including when the array object itself is destroyed). - - @remark - Note that MEM_ROOT has no facility for reusing free space, - so don't use this if multiple re-expansions are likely to happen. - - @param Element_type The type of the elements of the container. - Elements must be copyable. - @param has_trivial_destructor If true, we don't destroy elements. - We could have used type traits to determine this. - __has_trivial_destructor is supported by some (but not all) - compilers we use. -*/ -template -class Mem_root_array -{ -public: - /// Convenience typedef, same typedef name as std::vector - typedef Element_type value_type; - - Mem_root_array(MEM_ROOT *root) - : m_root(root), m_array(NULL), m_size(0), m_capacity(0) - { - DBUG_ASSERT(m_root != NULL); - } - - Mem_root_array(MEM_ROOT *root, size_t n, const value_type &val= value_type()) - : m_root(root), m_array(NULL), m_size(0), m_capacity(0) - { - resize(n, val); - } - - ~Mem_root_array() - { - clear(); - } - - Element_type &at(size_t n) - { - DBUG_ASSERT(n < size()); - return m_array[n]; - } - - const Element_type &at(size_t n) const - { - DBUG_ASSERT(n < size()); - return m_array[n]; - } - - Element_type &operator[](size_t n) { return at(n); } - const Element_type &operator[](size_t n) const { return at(n); } - - Element_type &back() { return at(size() - 1); } - const Element_type &back() const { return at(size() - 1); } - - // Returns a pointer to the first element in the array. - Element_type *begin() { return &m_array[0]; } - const Element_type *begin() const { return &m_array[0]; } - - // Returns a pointer to the past-the-end element in the array. - Element_type *end() { return &m_array[size()]; } - const Element_type *end() const { return &m_array[size()]; } - - // Erases all of the elements. - void clear() - { - if (!empty()) - chop(0); - } - - /* - Chops the tail off the array, erasing all tail elements. - @param pos Index of first element to erase. - */ - void chop(const size_t pos) - { - DBUG_ASSERT(pos < m_size); - if (!has_trivial_destructor) - { - for (size_t ix= pos; ix < m_size; ++ix) - { - Element_type *p= &m_array[ix]; - p->~Element_type(); // Destroy discarded element. - } - } - m_size= pos; - } - - /* - Reserves space for array elements. - Copies over existing elements, in case we are re-expanding the array. - - @param n number of elements. - @retval true if out-of-memory, false otherwise. - */ - bool reserve(size_t n) - { - if (n <= m_capacity) - return false; - - void *mem= alloc_root(m_root, n * element_size()); - if (!mem) - return true; - Element_type *array= static_cast(mem); - - // Copy all the existing elements into the new array. - for (size_t ix= 0; ix < m_size; ++ix) - { - Element_type *new_p= &array[ix]; - Element_type *old_p= &m_array[ix]; - new (new_p) Element_type(*old_p); // Copy into new location. - if (!has_trivial_destructor) - old_p->~Element_type(); // Destroy the old element. - } - - // Forget the old array. - m_array= array; - m_capacity= n; - return false; - } - - /* - Adds a new element at the end of the array, after its current last - element. The content of this new element is initialized to a copy of - the input argument. - - @param element Object to copy. - @retval true if out-of-memory, false otherwise. - */ - bool push_back(const Element_type &element) - { - const size_t min_capacity= 20; - const size_t expansion_factor= 2; - if (0 == m_capacity && reserve(min_capacity)) - return true; - if (m_size == m_capacity && reserve(m_capacity * expansion_factor)) - return true; - Element_type *p= &m_array[m_size++]; - new (p) Element_type(element); - return false; - } - - /** - Removes the last element in the array, effectively reducing the - container size by one. This destroys the removed element. - */ - void pop_back() - { - DBUG_ASSERT(!empty()); - if (!has_trivial_destructor) - back().~Element_type(); - m_size-= 1; - } - - /** - Resizes the container so that it contains n elements. - - If n is smaller than the current container size, the content is - reduced to its first n elements, removing those beyond (and - destroying them). - - If n is greater than the current container size, the content is - expanded by inserting at the end as many elements as needed to - reach a size of n. If val is specified, the new elements are - initialized as copies of val, otherwise, they are - value-initialized. - - If n is also greater than the current container capacity, an automatic - reallocation of the allocated storage space takes place. - - Notice that this function changes the actual content of the - container by inserting or erasing elements from it. - */ - void resize(size_t n, const value_type &val= value_type()) - { - if (n == m_size) - return; - if (n > m_size) - { - if (!reserve(n)) - { - while (n != m_size) - push_back(val); - } - return; - } - if (!has_trivial_destructor) - { - while (n != m_size) - pop_back(); - } - m_size= n; - } - - size_t capacity() const { return m_capacity; } - size_t element_size() const { return sizeof(Element_type); } - bool empty() const { return size() == 0; } - size_t size() const { return m_size; } - const MEM_ROOT *mem_root() const { return m_root; } - -private: - MEM_ROOT *const m_root; - Element_type *m_array; - size_t m_size; - size_t m_capacity; - - // Not (yet) implemented. - Mem_root_array(const Mem_root_array&); - Mem_root_array &operator=(const Mem_root_array&); -}; - - -#endif // MEM_ROOT_ARRAY_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/message.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/message.h deleted file mode 100644 index a649173..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/message.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - To change or add messages mysqld writes to the Windows error log, run - mc.exe message.mc - and checkin generated messages.h, messages.rc and msg000001.bin under the - source control. - mc.exe can be installed with Windows SDK, some Visual Studio distributions - do not include it. -*/ -// -// Values are 32 bit values laid out as follows: -// -// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 -// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 -// +---+-+-+-----------------------+-------------------------------+ -// |Sev|C|R| Facility | Code | -// +---+-+-+-----------------------+-------------------------------+ -// -// where -// -// Sev - is the severity code -// -// 00 - Success -// 01 - Informational -// 10 - Warning -// 11 - Error -// -// C - is the Customer code flag -// -// R - is a reserved bit -// -// Facility - is the facility code -// -// Code - is the facility's status code -// -// -// Define the facility codes -// - - -// -// Define the severity codes -// - - -// -// MessageId: MSG_DEFAULT -// -// MessageText: -// -// %1 -// -// -#define MSG_DEFAULT 0xC0000064L - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/multi_range_read.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/multi_range_read.h deleted file mode 100644 index 37a00e3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/multi_range_read.h +++ /dev/null @@ -1,670 +0,0 @@ -/* - Copyright (c) 2009, 2011, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @defgroup DS-MRR declarations - @{ -*/ - -/** - A Disk-Sweep implementation of MRR Interface (DS-MRR for short) - - This is a "plugin"(*) for storage engines that allows to - 1. When doing index scans, read table rows in rowid order; - 2. when making many index lookups, do them in key order and don't - lookup the same key value multiple times; - 3. Do both #1 and #2, when applicable. - These changes are expected to speed up query execution for disk-based - storage engines running io-bound loads and "big" queries (ie. queries that - do joins and enumerate lots of records). - - (*) - only conceptually. No dynamic loading or binary compatibility of any - kind. - - General scheme of things: - - SQL Layer code - | | | - v v v - -|---|---|---- handler->multi_range_read_XXX() function calls - | | | - _____________________________________ - / DS-MRR module \ - | (order/de-duplicate lookup keys, | - | scan indexes in key order, | - | order/de-duplicate rowids, | - | retrieve full record reads in rowid | - | order) | - \_____________________________________/ - | | | - -|---|---|----- handler->read_range_first()/read_range_next(), - | | | handler->index_read(), handler->rnd_pos() calls. - | | | - v v v - Storage engine internals - - - Currently DS-MRR is used by MyISAM, InnoDB and Maria storage engines. - Potentially it can be used with any table handler that has disk-based data - storage and has better performance when reading data in rowid order. -*/ - -#include "sql_lifo_buffer.h" - -class DsMrr_impl; -class Mrr_ordered_index_reader; - - -/* A structure with key parameters that's shared among several classes */ -class Key_parameters -{ -public: - uint key_tuple_length; /* Length of index lookup tuple, in bytes */ - key_part_map key_tuple_map; /* keyparts used in index lookup tuples */ - - /* - This is - = key_tuple_length if we copy keys to buffer - = sizeof(void*) if we're using pointers to materialized keys. - */ - uint key_size_in_keybuf; - - /* TRUE <=> don't copy key values, use pointers to them instead. */ - bool use_key_pointers; - - /* TRUE <=> We can get at most one index tuple for a lookup key */ - bool index_ranges_unique; -}; - - -/** - A class to enumerate (record, range_id) pairs that match given key value. - - @note - - The idea is that we have a Lifo_buffer which holds (key, range_id) pairs - ordered by key value. From the front of the buffer we see - - (key_val1, range_id1), (key_val1, range_id2) ... (key_val2, range_idN) - - we take the first elements that have the same key value (key_val1 in the - example above), and make lookup into the table. The table will have - multiple matches for key_val1: - - == Table Index == - ... - key_val1 -> key_val1, index_tuple1 - key_val1, index_tuple2 - ... - key_val1, index_tupleN - ... - - Our goal is to produce all possible combinations, i.e. we need: - - {(key_val1, index_tuple1), range_id1} - {(key_val1, index_tuple1), range_id2} - ... ... | - {(key_val1, index_tuple1), range_idN}, - - {(key_val1, index_tuple2), range_id1} - {(key_val1, index_tuple2), range_id2} - ... ... | - {(key_val1, index_tuple2), range_idN}, - - ... ... ... - - {(key_val1, index_tupleK), range_idN} -*/ - -class Key_value_records_iterator -{ - /* Use this to get table handler, key buffer and other parameters */ - Mrr_ordered_index_reader *owner; - - /* Iterator to get (key, range_id) pairs from */ - Lifo_buffer_iterator identical_key_it; - - /* - Last of the identical key values (when we get this pointer from - identical_key_it, it will be time to stop). - */ - uchar *last_identical_key_ptr; - - /* - FALSE <=> we're right after the init() call, the record has been already - read with owner->file->index_read_map() call - */ - bool get_next_row; - -public: - int init(Mrr_ordered_index_reader *owner_arg); - int get_next(range_id_t *range_info); - void move_to_next_key_value(); -}; - - -/* - Buffer manager interface. Mrr_reader objects use it to inqure DsMrr_impl - to manage buffer space for them. -*/ -typedef struct st_buffer_manager -{ -public: - /* Opaque value to be passed as the first argument to all member functions */ - void *arg; - - /* - This is called when we've freed more space from the rowid buffer. The - callee will get the unused space from the rowid buffer and give it to the - key buffer. - */ - void (*redistribute_buffer_space)(void *arg); - - /* - This is called when both key and rowid buffers are empty, and so it's time - to reset them to their original size (They've lost their original size, - because we were dynamically growing rowid buffer and shrinking key buffer). - */ - void (*reset_buffer_sizes)(void *arg); - -} Buffer_manager; - - -/* - Mrr_reader - DS-MRR execution strategy abstraction - - A reader produces ([index]_record, range_info) pairs, and requires periodic - refill operations. - - - one starts using the reader by calling reader->get_next(), - - when a get_next() call returns HA_ERR_END_OF_FILE, one must call - refill_buffer() before they can make more get_next() calls. - - when refill_buffer() returns HA_ERR_END_OF_FILE, this means the real - end of stream and get_next() should not be called anymore. - - Both functions can return other error codes, these mean unrecoverable errors - after which one cannot continue. -*/ - -class Mrr_reader -{ -public: - virtual int get_next(range_id_t *range_info) = 0; - virtual int refill_buffer(bool initial) = 0; - virtual ~Mrr_reader() {}; /* just to remove compiler warning */ -}; - - -/* - A common base for readers that do index scans and produce index tuples -*/ - -class Mrr_index_reader : public Mrr_reader -{ -protected: - handler *file; /* Handler object to use */ -public: - virtual int init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, - void *seq_init_param, uint n_ranges, - uint mode, Key_parameters *key_par, - Lifo_buffer *key_buffer, - Buffer_manager *buf_manager_arg) = 0; - - /* Get pointer to place where every get_next() call will put rowid */ - virtual uchar *get_rowid_ptr() = 0; - /* Get the rowid (call this after get_next() call) */ - virtual void position(); - virtual bool skip_record(range_id_t range_id, uchar *rowid) = 0; - - virtual void interrupt_read() {} - virtual void resume_read() {} -}; - - -/* - A "bypass" index reader that just does and index scan. The index scan is done - by calling default MRR implementation (i.e. handler::multi_range_read_XXX()) - functions. -*/ - -class Mrr_simple_index_reader : public Mrr_index_reader -{ -public: - int init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, - void *seq_init_param, uint n_ranges, - uint mode, Key_parameters *key_par, - Lifo_buffer *key_buffer, - Buffer_manager *buf_manager_arg); - int get_next(range_id_t *range_info); - int refill_buffer(bool initial) { return initial? 0: HA_ERR_END_OF_FILE; } - uchar *get_rowid_ptr() { return file->ref; } - bool skip_record(range_id_t range_id, uchar *rowid) - { - return (file->mrr_funcs.skip_record && - file->mrr_funcs.skip_record(file->mrr_iter, range_id, rowid)); - } -}; - - -/* - A reader that sorts the key values before it makes the index lookups. -*/ - -class Mrr_ordered_index_reader : public Mrr_index_reader -{ -public: - int init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, - void *seq_init_param, uint n_ranges, - uint mode, Key_parameters *key_par, - Lifo_buffer *key_buffer, - Buffer_manager *buf_manager_arg); - int get_next(range_id_t *range_info); - int refill_buffer(bool initial); - uchar *get_rowid_ptr() { return file->ref; } - - bool skip_record(range_id_t range_info, uchar *rowid) - { - return (mrr_funcs.skip_record && - mrr_funcs.skip_record(mrr_iter, range_info, rowid)); - } - - bool skip_index_tuple(range_id_t range_info) - { - return (mrr_funcs.skip_index_tuple && - mrr_funcs.skip_index_tuple(mrr_iter, range_info)); - } - - bool set_interruption_temp_buffer(uint rowid_length, uint key_len, - uint saved_pk_len, - uchar **space_start, uchar *space_end); - void set_no_interruption_temp_buffer(); - - void interrupt_read(); - void resume_read(); - void position(); -private: - Key_value_records_iterator kv_it; - - bool scanning_key_val_iter; - - /* Buffer to store (key, range_id) pairs */ - Lifo_buffer *key_buffer; - - /* This manages key buffer allocation and sizing for us */ - Buffer_manager *buf_manager; - - Key_parameters keypar; /* index scan and lookup tuple parameters */ - - /* TRUE <=> need range association, buffers hold {rowid, range_id} pairs */ - bool is_mrr_assoc; - - /* Range sequence iteration members */ - RANGE_SEQ_IF mrr_funcs; - range_seq_t mrr_iter; - - /* TRUE == reached eof when enumerating ranges */ - bool source_exhausted; - - /* - Following members are for interrupt_read()/resume_read(). The idea is that - in some cases index scan that is done by this object is interrupted by - rnd_pos() calls made by Mrr_ordered_rndpos_reader. The problem is that - we're sharing handler->record[0] with that object, and it destroys its - contents. - We need to save/restore our current - - index tuple (for pushed index condition checks) - - clustered primary key values (again, for pushed index condition checks) - - rowid of the last record we've retrieved (in case this rowid matches - multiple ranges and we'll need to return it again) - */ - bool support_scan_interruptions; - /* Space where we save the rowid of the last record we've returned */ - uchar *saved_rowid; - - /* TRUE <=> saved_rowid has the last saved rowid */ - bool have_saved_rowid; - - uchar *saved_key_tuple; /* Saved current key tuple */ - uchar *saved_primary_key; /* Saved current primary key tuple */ - - /* - TRUE<=> saved_key_tuple (and saved_primary_key when applicable) have - valid values. - */ - bool read_was_interrupted; - - static int compare_keys(void* arg, uchar* key1, uchar* key2); - static int compare_keys_reverse(void* arg, uchar* key1, uchar* key2); - - friend class Key_value_records_iterator; - friend class DsMrr_impl; - friend class Mrr_ordered_rndpos_reader; -}; - - -/* - A reader that gets rowids from an Mrr_index_reader, and then sorts them - before getting full records with handler->rndpos() calls. -*/ - -class Mrr_ordered_rndpos_reader : public Mrr_reader -{ -public: - int init(handler *file, Mrr_index_reader *index_reader, uint mode, - Lifo_buffer *buf, Rowid_filter *filter); - int get_next(range_id_t *range_info); - int refill_buffer(bool initial); -private: - handler *file; /* Handler to use */ - - /* This what we get (rowid, range_info) pairs from */ - Mrr_index_reader *index_reader; - - /* index_reader->get_next() puts rowid here */ - uchar *index_rowid; - - /* TRUE <=> index_reader->refill_buffer() call has returned EOF */ - bool index_reader_exhausted; - - /* - TRUE <=> We should call index_reader->refill_buffer(). This happens if - 1. we've made index_reader->get_next() call which returned EOF - 2. we haven't made any index_reader calls (and our first call should - be index_reader->refill_buffer(initial=TRUE) - */ - bool index_reader_needs_refill; - - /* TRUE <=> need range association, buffers hold {rowid, range_id} pairs */ - bool is_mrr_assoc; - - /* - When reading from ordered rowid buffer: the rowid element of the last - buffer element that has rowid identical to this one. - */ - uchar *last_identical_rowid; - - /* Buffer to store (rowid, range_id) pairs */ - Lifo_buffer *rowid_buffer; - - /* Rowid filter to be checked against (if any) */ - Rowid_filter *rowid_filter; - - int refill_from_index_reader(); -}; - - -/* - A primitive "factory" of various Mrr_*_reader classes (the point is to - get various kinds of readers without having to allocate them on the heap) -*/ - -class Mrr_reader_factory -{ -public: - Mrr_ordered_rndpos_reader ordered_rndpos_reader; - Mrr_ordered_index_reader ordered_index_reader; - Mrr_simple_index_reader simple_index_reader; -}; - - -#define DSMRR_IMPL_SORT_KEYS HA_MRR_IMPLEMENTATION_FLAG1 -#define DSMRR_IMPL_SORT_ROWIDS HA_MRR_IMPLEMENTATION_FLAG2 - -/* - DS-MRR implementation for one table. Create/use one object of this class for - each ha_{myisam/innobase/etc} object. That object will be further referred to - as "the handler" - - DsMrr_impl supports has the following execution strategies: - - - Bypass DS-MRR, pass all calls to default MRR implementation, which is - an MRR-to-non-MRR call converter. - - Key-Ordered Retrieval - - Rowid-Ordered Retrieval - - DsMrr_impl will use one of the above strategies, or a combination of them, - according to the following diagram: - - (mrr function calls) - | - +----------------->-----------------+ - | | - ___________v______________ _______________v________________ - / default: use lookup keys \ / KEY-ORDERED RETRIEVAL: \ - | (or ranges) in whatever | | sort lookup keys and then make | - | order they are supplied | | index lookups in index order | - \__________________________/ \________________________________/ - | | | | | - +---<---+ | +--------------->-----------|----+ - | | | | - | | +---------------+ | - | ______v___ ______ | _______________v_______________ - | / default: read \ | / ROWID-ORDERED RETRIEVAL: \ - | | table records | | | Before reading table records, | - v | in random order | v | sort their rowids and then | - | \_________________/ | | read them in rowid order | - | | | \_______________________________/ - | | | | - | | | | - +-->---+ | +----<------+-----------<--------+ - | | | - v v v - (table records and range_ids) - - The choice of strategy depends on MRR scan properties, table properties - (whether we're scanning clustered primary key), and @@optimizer_switch - settings. - - Key-Ordered Retrieval - --------------------- - The idea is: if MRR scan is essentially a series of lookups on - - tbl.key=value1 OR tbl.key=value2 OR ... OR tbl.key=valueN - - then it makes sense to collect and order the set of lookup values, i.e. - - sort(value1, value2, .. valueN) - - and then do index lookups in index order. This results in fewer index page - fetch operations, and we also can avoid making multiple index lookups for the - same value. That is, if value1=valueN we can easily discover that after - sorting and make one index lookup for them instead of two. - - Rowid-Ordered Retrieval - ----------------------- - If we do a regular index scan or a series of index lookups, we'll be hitting - table records at random. For disk-based engines, this is much slower than - reading the same records in disk order. We assume that disk ordering of - rows is the same as ordering of their rowids (which is provided by - handler::cmp_ref()) - In order to retrieve records in different order, we must separate index - scanning and record fetching, that is, MRR scan uses the following steps: - - 1. Scan the index (and only index, that is, with HA_EXTRA_KEYREAD on) and - fill a buffer with {rowid, range_id} pairs - 2. Sort the buffer by rowid value - 3. for each {rowid, range_id} pair in the buffer - get record by rowid and return the {record, range_id} pair - 4. Repeat the above steps until we've exhausted the list of ranges we're - scanning. - - Buffer space management considerations - -------------------------------------- - With regards to buffer/memory management, MRR interface specifies that - - SQL layer provides multi_range_read_init() with buffer of certain size. - - MRR implementation may use (i.e. have at its disposal till the end of - the MRR scan) all of the buffer, or return the unused end of the buffer - to SQL layer. - - DS-MRR needs buffer in order to accumulate and sort rowids and/or keys. When - we need to accumulate/sort only keys (or only rowids), it is fairly trivial. - - When we need to accumulate/sort both keys and rowids, efficient buffer use - gets complicated. We need to: - - First, accumulate keys and sort them - - Then use the keys (smaller values go first) to obtain rowids. A key is not - needed after we've got matching rowids for it. - - Make sure that rowids are accumulated at the front of the buffer, so that we - can return the end part of the buffer to SQL layer, should there be too - few rowid values to occupy the buffer. - - All of these goals are achieved by using the following scheme: - - | | We get an empty buffer from SQL layer. - - | *-| - | *----| First, we fill the buffer with keys. Key_buffer - | *-------| part grows from end of the buffer space to start - | *----------| (In this picture, the buffer is big enough to - | *-------------| accomodate all keys and even have some space left) - - | *=============| We want to do key-ordered index scan, so we sort - the keys - - |-x *===========| Then we use the keys get rowids. Rowids are - |----x *========| stored from start of buffer space towards the end. - |--------x *=====| The part of the buffer occupied with keys - |------------x *===| gradually frees up space for rowids. In this - |--------------x *=| picture we run out of keys before we've ran out - |----------------x | of buffer space (it can be other way as well). - - |================x | Then we sort the rowids. - - | |~~~| The unused part of the buffer is at the end, so - we can return it to the SQL layer. - - |================* Sorted rowids are then used to read table records - in disk order - -*/ - -class DsMrr_impl -{ -public: - typedef void (handler::*range_check_toggle_func_t)(bool on); - - DsMrr_impl() - : secondary_file(NULL), - rowid_filter(NULL) {}; - - void init(handler *h_arg, TABLE *table_arg) - { - primary_file= h_arg; - table= table_arg; - } - int dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, - void *seq_init_param, uint n_ranges, uint mode, - HANDLER_BUFFER *buf); - void dsmrr_close(); - int dsmrr_next(range_id_t *range_info); - - ha_rows dsmrr_info(uint keyno, uint n_ranges, uint keys, uint key_parts, - uint *bufsz, uint *flags, Cost_estimate *cost); - - ha_rows dsmrr_info_const(uint keyno, RANGE_SEQ_IF *seq, - void *seq_init_param, uint n_ranges, uint *bufsz, - uint *flags, Cost_estimate *cost); - - int dsmrr_explain_info(uint mrr_mode, char *str, size_t size); -private: - /* Buffer to store (key, range_id) pairs */ - Lifo_buffer *key_buffer; - - /* - The "owner" handler object (the one that is expected to "own" this object - and call its functions). - */ - handler *primary_file; - TABLE *table; /* Always equal to primary_file->table */ - - /* - Secondary handler object. (created when needed, we need it when we need - to run both index scan and rnd_pos() scan at the same time) - */ - handler *secondary_file; - - /* - The rowid filter that DS-MRR has "unpushed" from the storage engine. - If it's present, DS-MRR will use it. - */ - Rowid_filter *rowid_filter; - - uint keyno; /* index we're running the scan on */ - /* TRUE <=> need range association, buffers hold {rowid, range_id} pairs */ - bool is_mrr_assoc; - - Mrr_reader_factory reader_factory; - - Mrr_reader *strategy; - bool strategy_exhausted; - - Mrr_index_reader *index_strategy; - - /* The whole buffer space that we're using */ - uchar *full_buf; - uchar *full_buf_end; - - /* - When using both rowid and key buffers: the boundary between key and rowid - parts of the buffer. This is the "original" value, actual memory ranges - used by key and rowid parts may be different because of dynamic space - reallocation between them. - */ - uchar *rowid_buffer_end; - - /* - One of the following two is used for key buffer: forward is used when - we only need key buffer, backward is used when we need both key and rowid - buffers. - */ - Forward_lifo_buffer forward_key_buf; - Backward_lifo_buffer backward_key_buf; - - /* - Buffer to store (rowid, range_id) pairs, or just rowids if - is_mrr_assoc==FALSE - */ - Forward_lifo_buffer rowid_buffer; - - bool choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, uint *bufsz, - Cost_estimate *cost); - bool get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags, - uint *buffer_size, uint extra_mem_overhead, - Cost_estimate *cost); - bool check_cpk_scan(THD *thd, TABLE_SHARE *share, uint keyno, uint mrr_flags); - - bool setup_buffer_sharing(uint key_size_in_keybuf, key_part_map key_tuple_map); - - /* Buffer_manager and its member functions */ - Buffer_manager buf_manager; - static void redistribute_buffer_space(void *dsmrr_arg); - static void reset_buffer_sizes(void *dsmrr_arg); - static void do_nothing(void *dsmrr_arg); - - Lifo_buffer* get_key_buffer() { return key_buffer; } - - friend class Key_value_records_iterator; - friend class Mrr_ordered_index_reader; - friend class Mrr_ordered_rndpos_reader; - - int setup_two_handlers(); - void close_second_handler(); -}; - -/** - @} (end of group DS-MRR declarations) -*/ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_alarm.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_alarm.h deleted file mode 100644 index 14a81c1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_alarm.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (c) 2000, 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - File to include when we want to use alarm or a loop_counter to display - some information when a program is running -*/ -#ifndef _my_alarm_h -#define _my_alarm_h -#ifdef __cplusplus -extern "C" { -#endif - -extern int volatile my_have_got_alarm; -extern ulong my_time_to_wait_for_lock; - -#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP) -#include -#ifdef HAVE_SIGHANDLER_T -#define sig_return sighandler_t -#elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) -typedef void (*sig_return)(int); /* Returns type from signal */ -#else -typedef void (*sig_return)(void); /* Returns type from signal */ -#endif -#define ALARM_VARIABLES uint alarm_old=0; \ - sig_return alarm_signal=0 -#define ALARM_INIT my_have_got_alarm=0 ; \ - alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \ - alarm_signal=signal(SIGALRM,my_set_alarm_variable); -#define ALARM_END (void) signal(SIGALRM,alarm_signal); \ - (void) alarm(alarm_old); -#define ALARM_TEST my_have_got_alarm -#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY -#define ALARM_REINIT (void) alarm(MY_HOW_OFTEN_TO_ALARM); \ - (void) signal(SIGALRM,my_set_alarm_variable);\ - my_have_got_alarm=0; -#else -#define ALARM_REINIT (void) alarm((uint) MY_HOW_OFTEN_TO_ALARM); \ - my_have_got_alarm=0; -#endif /* SIGNAL_HANDLER_RESET_ON_DELIVERY */ -#else -#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1 -#define ALARM_INIT -#define ALARM_END -#define ALARM_TEST (alarm_pos++ >= alarm_end_pos) -#define ALARM_REINIT (alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE) -#endif /* HAVE_ALARM */ - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_apc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_apc.h deleted file mode 100644 index cc98e36..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_apc.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef SQL_MY_APC_INCLUDED -#define SQL_MY_APC_INCLUDED -/* - Copyright (c) 2011, 2013 Monty Program Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Interface - ~~~~~~~~~ - ( - - This is an APC request queue - - We assume there is a particular owner thread which periodically calls - process_apc_requests() to serve the call requests. - - Other threads can post call requests, and block until they are exectued. - ) - - Implementation - ~~~~~~~~~~~~~~ - - The target has a mutex-guarded request queue. - - - After the request has been put into queue, the requestor waits for request - to be satisfied. The worker satisifes the request and signals the - requestor. -*/ - -class THD; - -/* - Target for asynchronous procedure calls (APCs). - - A target is running in some particular thread, - - One can make calls to it from other threads. -*/ -class Apc_target -{ - mysql_mutex_t *LOCK_thd_kill_ptr; -public: - Apc_target() : enabled(0), apc_calls(NULL) {} - ~Apc_target() { DBUG_ASSERT(!enabled && !apc_calls);} - - void init(mysql_mutex_t *target_mutex); - - /* Destroy the target. The target must be disabled when this call is made. */ - void destroy() { DBUG_ASSERT(!enabled); } - - /* Enter ther state where the target is available for serving APC requests */ - void enable() { enabled++; } - - /* - Make the target unavailable for serving APC requests. - - @note - This call will serve all requests that were already enqueued - */ - void disable() - { - DBUG_ASSERT(enabled); - mysql_mutex_lock(LOCK_thd_kill_ptr); - bool process= !--enabled && have_apc_requests(); - mysql_mutex_unlock(LOCK_thd_kill_ptr); - if (unlikely(process)) - process_apc_requests(); - } - - void process_apc_requests(); - /* - A lightweight function, intended to be used in frequent checks like this: - - if (apc_target.have_requests()) apc_target.process_apc_requests() - */ - inline bool have_apc_requests() - { - return MY_TEST(apc_calls); - } - - inline bool is_enabled() { return enabled; } - - /* Functor class for calls you can schedule */ - class Apc_call - { - public: - /* This function will be called in the target thread */ - virtual void call_in_target_thread()= 0; - virtual ~Apc_call() {} - }; - - /* Make a call in the target thread (see function definition for details) */ - bool make_apc_call(THD *caller_thd, Apc_call *call, int timeout_sec, bool *timed_out); - -#ifndef DBUG_OFF - int n_calls_processed; /* Number of calls served by this target */ -#endif -private: - class Call_request; - - /* - Non-zero value means we're enabled. It's an int, not bool, because one can - call enable() N times (and then needs to call disable() N times before the - target is really disabled) - */ - int enabled; - - /* - Circular, double-linked list of all enqueued call requests. - We use this structure, because we - - process requests sequentially: requests are added at the end of the - list and removed from the front. With circular list, we can keep one - pointer, and access both front an back of the list with it. - - a thread that has posted a request may time out (or be KILLed) and - cancel the request, which means we need a fast request-removal - operation. - */ - Call_request *apc_calls; - - class Call_request - { - public: - Apc_call *call; /* Functor to be called */ - - /* The caller will actually wait for "processed==TRUE" */ - bool processed; - - /* Condition that will be signalled when the request has been served */ - mysql_cond_t COND_request; - - /* Double linked-list linkage */ - Call_request *next; - Call_request *prev; - - const char *what; /* (debug) state of the request */ - }; - - void enqueue_request(Call_request *qe); - void dequeue_request(Call_request *qe); - - /* return the first call request in queue, or NULL if there are none enqueued */ - Call_request *get_first_in_queue() - { - return apc_calls; - } -}; - -#ifdef HAVE_PSI_INTERFACE -void init_show_explain_psi_keys(void); -#else -#define init_show_explain_psi_keys() /* no-op */ -#endif - -#endif //SQL_MY_APC_INCLUDED - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_atomic.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_atomic.h deleted file mode 100644 index 81da9e3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_atomic.h +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef MY_ATOMIC_INCLUDED -#define MY_ATOMIC_INCLUDED - -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2018, 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - This header defines five atomic operations: - - my_atomic_add#(&var, what) - my_atomic_add#_explicit(&var, what, memory_order) - 'Fetch and Add' - add 'what' to *var, and return the old value of *var - All memory orders are valid. - - my_atomic_fas#(&var, what) - my_atomic_fas#_explicit(&var, what, memory_order) - 'Fetch And Store' - store 'what' in *var, and return the old value of *var - All memory orders are valid. - - my_atomic_cas#(&var, &old, new) - my_atomic_cas#_weak_explicit(&var, &old, new, succ, fail) - my_atomic_cas#_strong_explicit(&var, &old, new, succ, fail) - 'Compare And Swap' - if *var is equal to *old, then store 'new' in *var, and return TRUE - otherwise store *var in *old, and return FALSE - succ - the memory synchronization ordering for the read-modify-write - operation if the comparison succeeds. All memory orders are valid. - fail - the memory synchronization ordering for the load operation if the - comparison fails. Cannot be MY_MEMORY_ORDER_RELEASE or - MY_MEMORY_ORDER_ACQ_REL and cannot specify stronger ordering than succ. - - The weak form is allowed to fail spuriously, that is, act as if *var != *old - even if they are equal. When a compare-and-exchange is in a loop, the weak - version will yield better performance on some platforms. When a weak - compare-and-exchange would require a loop and a strong one would not, the - strong one is preferable. - - my_atomic_load#(&var) - my_atomic_load#_explicit(&var, memory_order) - return *var - Order must be one of MY_MEMORY_ORDER_RELAXED, MY_MEMORY_ORDER_CONSUME, - MY_MEMORY_ORDER_ACQUIRE, MY_MEMORY_ORDER_SEQ_CST. - - my_atomic_store#(&var, what) - my_atomic_store#_explicit(&var, what, memory_order) - store 'what' in *var - Order must be one of MY_MEMORY_ORDER_RELAXED, MY_MEMORY_ORDER_RELEASE, - MY_MEMORY_ORDER_SEQ_CST. - - '#' is substituted by a size suffix - 8, 16, 32, 64, or ptr - (e.g. my_atomic_add8, my_atomic_fas32, my_atomic_casptr). - - The first version orders memory accesses according to MY_MEMORY_ORDER_SEQ_CST, - the second version (with _explicit suffix) orders memory accesses according to - given memory order. - - memory_order specifies how non-atomic memory accesses are to be ordered around - an atomic operation: - - MY_MEMORY_ORDER_RELAXED - there are no constraints on reordering of memory - accesses around the atomic variable. - MY_MEMORY_ORDER_CONSUME - no reads in the current thread dependent on the - value currently loaded can be reordered before this - load. This ensures that writes to dependent - variables in other threads that release the same - atomic variable are visible in the current thread. - On most platforms, this affects compiler - optimization only. - MY_MEMORY_ORDER_ACQUIRE - no reads in the current thread can be reordered - before this load. This ensures that all writes in - other threads that release the same atomic variable - are visible in the current thread. - MY_MEMORY_ORDER_RELEASE - no writes in the current thread can be reordered - after this store. This ensures that all writes in - the current thread are visible in other threads that - acquire the same atomic variable. - MY_MEMORY_ORDER_ACQ_REL - no reads in the current thread can be reordered - before this load as well as no writes in the current - thread can be reordered after this store. The - operation is read-modify-write operation. It is - ensured that all writes in another threads that - release the same atomic variable are visible before - the modification and the modification is visible in - other threads that acquire the same atomic variable. - MY_MEMORY_ORDER_SEQ_CST - The operation has the same semantics as - acquire-release operation, and additionally has - sequentially-consistent operation ordering. - - We choose implementation as follows: on Windows using Visual C++ the native - implementation should be preferable. When using gcc we prefer the Solaris - implementation before the gcc because of stability preference, we choose gcc - builtins if available. -*/ - -#if defined(_MSC_VER) -#include "atomic/generic-msvc.h" -#elif defined(HAVE_SOLARIS_ATOMIC) -#include "atomic/solaris.h" -#elif defined(HAVE_GCC_C11_ATOMICS) -#include "atomic/gcc_builtins.h" -#endif - -#if SIZEOF_LONG == 4 -#define my_atomic_addlong(A,B) my_atomic_add32((int32*) (A), (B)) -#define my_atomic_loadlong(A) my_atomic_load32((int32*) (A)) -#define my_atomic_loadlong_explicit(A,O) my_atomic_load32_explicit((int32*) (A), (O)) -#define my_atomic_storelong(A,B) my_atomic_store32((int32*) (A), (B)) -#define my_atomic_faslong(A,B) my_atomic_fas32((int32*) (A), (B)) -#define my_atomic_caslong(A,B,C) my_atomic_cas32((int32*) (A), (int32*) (B), (C)) -#else -#define my_atomic_addlong(A,B) my_atomic_add64((int64*) (A), (B)) -#define my_atomic_loadlong(A) my_atomic_load64((int64*) (A)) -#define my_atomic_loadlong_explicit(A,O) my_atomic_load64_explicit((int64*) (A), (O)) -#define my_atomic_storelong(A,B) my_atomic_store64((int64*) (A), (B)) -#define my_atomic_faslong(A,B) my_atomic_fas64((int64*) (A), (B)) -#define my_atomic_caslong(A,B,C) my_atomic_cas64((int64*) (A), (int64*) (B), (C)) -#endif - -#ifndef MY_MEMORY_ORDER_SEQ_CST -#define MY_MEMORY_ORDER_RELAXED -#define MY_MEMORY_ORDER_CONSUME -#define MY_MEMORY_ORDER_ACQUIRE -#define MY_MEMORY_ORDER_RELEASE -#define MY_MEMORY_ORDER_ACQ_REL -#define MY_MEMORY_ORDER_SEQ_CST - -#define my_atomic_store32_explicit(P, D, O) my_atomic_store32((P), (D)) -#define my_atomic_store64_explicit(P, D, O) my_atomic_store64((P), (D)) -#define my_atomic_storeptr_explicit(P, D, O) my_atomic_storeptr((P), (D)) - -#define my_atomic_load32_explicit(P, O) my_atomic_load32((P)) -#define my_atomic_load64_explicit(P, O) my_atomic_load64((P)) -#define my_atomic_loadptr_explicit(P, O) my_atomic_loadptr((P)) - -#define my_atomic_fas32_explicit(P, D, O) my_atomic_fas32((P), (D)) -#define my_atomic_fas64_explicit(P, D, O) my_atomic_fas64((P), (D)) -#define my_atomic_fasptr_explicit(P, D, O) my_atomic_fasptr((P), (D)) - -#define my_atomic_add32_explicit(P, A, O) my_atomic_add32((P), (A)) -#define my_atomic_add64_explicit(P, A, O) my_atomic_add64((P), (A)) -#define my_atomic_addptr_explicit(P, A, O) my_atomic_addptr((P), (A)) - -#define my_atomic_cas32_weak_explicit(P, E, D, S, F) \ - my_atomic_cas32((P), (E), (D)) -#define my_atomic_cas64_weak_explicit(P, E, D, S, F) \ - my_atomic_cas64((P), (E), (D)) -#define my_atomic_casptr_weak_explicit(P, E, D, S, F) \ - my_atomic_casptr((P), (E), (D)) - -#define my_atomic_cas32_strong_explicit(P, E, D, S, F) \ - my_atomic_cas32((P), (E), (D)) -#define my_atomic_cas64_strong_explicit(P, E, D, S, F) \ - my_atomic_cas64((P), (E), (D)) -#define my_atomic_casptr_strong_explicit(P, E, D, S, F) \ - my_atomic_casptr((P), (E), (D)) -#endif -#endif /* MY_ATOMIC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_atomic_wrapper.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_atomic_wrapper.h deleted file mode 100644 index 64835e3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_atomic_wrapper.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (c) 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef __cplusplus -#include -/** - A wrapper for std::atomic, defaulting to std::memory_order_relaxed. - - When it comes to atomic loads or stores at std::memory_order_relaxed - on IA-32 or AMD64, this wrapper is only introducing some constraints - to the C++ compiler, to prevent some optimizations of loads or - stores. - - On POWER and ARM, atomic loads and stores involve different instructions - from normal loads and stores and will thus incur some overhead. - - Because atomic read-modify-write operations will always incur - overhead, we intentionally do not define - operator++(), operator--(), operator+=(), operator-=(), or similar, - to make the overhead stand out in the users of this code. -*/ -template class Atomic_relaxed -{ - std::atomic m; -public: - Atomic_relaxed(const Atomic_relaxed &rhs) - { m.store(rhs, std::memory_order_relaxed); } - Atomic_relaxed(Type val) : m(val) {} - Atomic_relaxed() {} - - operator Type() const { return m.load(std::memory_order_relaxed); } - Type operator=(const Type val) - { m.store(val, std::memory_order_relaxed); return val; } - Type operator=(const Atomic_relaxed &rhs) { return *this= Type{rhs}; } - Type fetch_add(const Type i, std::memory_order o= std::memory_order_relaxed) - { return m.fetch_add(i, o); } - Type fetch_sub(const Type i, std::memory_order o= std::memory_order_relaxed) - { return m.fetch_sub(i, o); } - Type fetch_xor(const Type i, std::memory_order o= std::memory_order_relaxed) - { return m.fetch_xor(i, o); } - bool compare_exchange_strong(Type& i1, const Type i2, - std::memory_order o1= std::memory_order_relaxed, - std::memory_order o2= std::memory_order_relaxed) - { return m.compare_exchange_strong(i1, i2, o1, o2); } - Type exchange(const Type i, std::memory_order o= std::memory_order_relaxed) - { return m.exchange(i, o); } -}; -#endif /* __cplusplus */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_base.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_base.h deleted file mode 100644 index dc5b135..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_base.h +++ /dev/null @@ -1,685 +0,0 @@ -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 1995, 2018, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* This file includes constants used with all databases */ - -#ifndef _my_base_h -#define _my_base_h - -#include /* This includes types */ -#include -#include -#include - -#ifndef EOVERFLOW -#define EOVERFLOW 84 -#endif - -#include - -/* The following is bits in the flag parameter to ha_open() */ - -#define HA_OPEN_ABORT_IF_LOCKED 0U /* default */ -#define HA_OPEN_WAIT_IF_LOCKED 1U -#define HA_OPEN_IGNORE_IF_LOCKED 2U -#define HA_OPEN_TMP_TABLE 4U /* Table is a temp table */ -#define HA_OPEN_DELAY_KEY_WRITE 8U /* Don't update index */ -#define HA_OPEN_ABORT_IF_CRASHED 16U -#define HA_OPEN_FOR_REPAIR 32U /* open even if crashed */ -#define HA_OPEN_FROM_SQL_LAYER 64U -#define HA_OPEN_MMAP 128U /* open memory mapped */ -#define HA_OPEN_COPY 256U /* Open copy (for repair) */ -/* Internal temp table, used for temporary results */ -#define HA_OPEN_INTERNAL_TABLE 512U -#define HA_OPEN_NO_PSI_CALL 1024U /* Don't call/connect PSI */ -#define HA_OPEN_MERGE_TABLE 2048U -#define HA_OPEN_FOR_CREATE 4096U - -/* - Allow opening even if table is incompatible as this is for ALTER TABLE which - will fix the table structure. -*/ -#define HA_OPEN_FOR_ALTER 8192U - -/* Open table for FLUSH */ -#define HA_OPEN_FOR_FLUSH 8192U - - -/* The following is parameter to ha_rkey() how to use key */ - -/* - We define a complete-field prefix of a key value as a prefix where - the last included field in the prefix contains the full field, not - just some bytes from the start of the field. A partial-field prefix - is allowed to contain only a few first bytes from the last included - field. - - Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a - complete-field prefix of a key value as the search - key. HA_READ_PREFIX and HA_READ_PREFIX_LAST could also take a - partial-field prefix, but currently (4.0.10) they are only used with - complete-field prefixes. MySQL uses a padding trick to implement - LIKE 'abc%' queries. - - NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a - partial-field prefix because InnoDB currently strips spaces from the - end of varchar fields! -*/ - -enum ha_rkey_function { - HA_READ_KEY_EXACT, /* Find first record else error */ - HA_READ_KEY_OR_NEXT, /* Record or next record */ - HA_READ_KEY_OR_PREV, /* Record or previous */ - HA_READ_AFTER_KEY, /* Find next rec. after key-record */ - HA_READ_BEFORE_KEY, /* Find next rec. before key-record */ - HA_READ_PREFIX, /* Key which as same prefix */ - HA_READ_PREFIX_LAST, /* Last key with the same prefix */ - HA_READ_PREFIX_LAST_OR_PREV, /* Last or prev key with the same prefix */ - HA_READ_MBR_CONTAIN, - HA_READ_MBR_INTERSECT, - HA_READ_MBR_WITHIN, - HA_READ_MBR_DISJOINT, - HA_READ_MBR_EQUAL -}; - - /* Key algorithm types */ - -enum ha_key_alg { - HA_KEY_ALG_UNDEF= 0, /* Not specified (old file) */ - HA_KEY_ALG_BTREE= 1, /* B-tree, default one */ - HA_KEY_ALG_RTREE= 2, /* R-tree, for spatial searches */ - HA_KEY_ALG_HASH= 3, /* HASH keys (HEAP tables) */ - HA_KEY_ALG_FULLTEXT= 4, /* FULLTEXT (MyISAM tables) */ - HA_KEY_ALG_LONG_HASH= 5 /* long BLOB keys */ -}; - - /* Storage media types */ - -enum ha_storage_media { - HA_SM_DEFAULT= 0, /* Not specified (engine default) */ - HA_SM_DISK= 1, /* DISK storage */ - HA_SM_MEMORY= 2 /* MAIN MEMORY storage */ -}; - - /* The following is parameter to ha_extra() */ - -enum ha_extra_function { - HA_EXTRA_NORMAL=0, /* Optimize for space (def) */ - HA_EXTRA_QUICK=1, /* Optimize for speed */ - HA_EXTRA_NOT_USED=2, /* Should be ignored by handler */ - HA_EXTRA_CACHE=3, /* Cache record in HA_rrnd() */ - HA_EXTRA_NO_CACHE=4, /* End caching of records (def) */ - HA_EXTRA_NO_READCHECK=5, /* No readcheck on update */ - HA_EXTRA_READCHECK=6, /* Use readcheck (def) */ - HA_EXTRA_KEYREAD=7, /* Read only key to database */ - HA_EXTRA_NO_KEYREAD=8, /* Normal read of records (def) */ - HA_EXTRA_NO_USER_CHANGE=9, /* No user is allowed to write */ - HA_EXTRA_KEY_CACHE=10, - HA_EXTRA_NO_KEY_CACHE=11, - HA_EXTRA_WAIT_LOCK=12, /* Wait until file is avalably (def) */ - HA_EXTRA_NO_WAIT_LOCK=13, /* If file is locked, return quickly */ - HA_EXTRA_WRITE_CACHE=14, /* Use write cache in ha_write() */ - HA_EXTRA_FLUSH_CACHE=15, /* flush write_record_cache */ - HA_EXTRA_NO_KEYS=16, /* Remove all update of keys */ - HA_EXTRA_KEYREAD_CHANGE_POS=17, /* Keyread, but change pos */ - /* xxxxchk -r must be used */ - HA_EXTRA_REMEMBER_POS=18, /* Remember pos for next/prev */ - HA_EXTRA_RESTORE_POS=19, - HA_EXTRA_REINIT_CACHE=20, /* init cache from current record */ - HA_EXTRA_FORCE_REOPEN=21, /* Datafile have changed on disk */ - HA_EXTRA_FLUSH, /* Flush tables to disk */ - HA_EXTRA_NO_ROWS, /* Don't write rows */ - HA_EXTRA_RESET_STATE, /* Reset positions */ - HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/ - HA_EXTRA_NO_IGNORE_DUP_KEY, - HA_EXTRA_PREPARE_FOR_DROP, - HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */ - HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */ - /* - On-the-fly switching between unique and non-unique key inserting. - */ - HA_EXTRA_CHANGE_KEY_TO_UNIQUE, - HA_EXTRA_CHANGE_KEY_TO_DUP, - /* - When using HA_EXTRA_KEYREAD, overwrite only key member fields and keep - other fields intact. When this is off (by default) InnoDB will use memcpy - to overwrite entire row. - */ - HA_EXTRA_KEYREAD_PRESERVE_FIELDS, - HA_EXTRA_MMAP, - /* - Ignore if the a tuple is not found, continue processing the - transaction and ignore that 'row'. Needed for idempotency - handling on the slave - */ - HA_EXTRA_IGNORE_NO_KEY, - HA_EXTRA_NO_IGNORE_NO_KEY, - /* - Mark the table as a log table. For some handlers (e.g. CSV) this results - in a special locking for the table. - */ - HA_EXTRA_MARK_AS_LOG_TABLE, - /* - Informs handler that write_row() which tries to insert new row into the - table and encounters some already existing row with same primary/unique - key can replace old row with new row instead of reporting error (basically - it informs handler that we do REPLACE instead of simple INSERT). - Off by default. - */ - HA_EXTRA_WRITE_CAN_REPLACE, - HA_EXTRA_WRITE_CANNOT_REPLACE, - /* - Inform handler that delete_row()/update_row() cannot batch deletes/updates - and should perform them immediately. This may be needed when table has - AFTER DELETE/UPDATE triggers which access to subject table. - These flags are reset by the handler::extra(HA_EXTRA_RESET) call. - */ - HA_EXTRA_DELETE_CANNOT_BATCH, - HA_EXTRA_UPDATE_CANNOT_BATCH, - /* - Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be - executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY. - */ - HA_EXTRA_INSERT_WITH_UPDATE, - /* Inform handler that we will do a rename */ - HA_EXTRA_PREPARE_FOR_RENAME, - /* - Special actions for MERGE tables. - */ - HA_EXTRA_ADD_CHILDREN_LIST, - HA_EXTRA_ATTACH_CHILDREN, - HA_EXTRA_IS_ATTACHED_CHILDREN, - HA_EXTRA_DETACH_CHILDREN, - HA_EXTRA_DETACH_CHILD, - /* Inform handler we will force a close as part of flush */ - HA_EXTRA_PREPARE_FOR_FORCED_CLOSE, - /* Inform handler that we will do an alter table */ - HA_EXTRA_PREPARE_FOR_ALTER_TABLE, - /* - Used in ha_partition::handle_ordered_index_scan() to inform engine - that we are starting an ordered index scan. Needed by Spider - */ - HA_EXTRA_STARTING_ORDERED_INDEX_SCAN, - /** Start writing rows during ALTER TABLE...ALGORITHM=COPY. */ - HA_EXTRA_BEGIN_ALTER_COPY, - /** Finish writing rows during ALTER TABLE...ALGORITHM=COPY. */ - HA_EXTRA_END_ALTER_COPY, - /** Fake the start of a statement after wsrep_load_data_splitting hack */ - HA_EXTRA_FAKE_START_STMT -}; - -/* Compatible option, to be deleted in 6.0 */ -#define HA_EXTRA_PREPARE_FOR_DELETE HA_EXTRA_PREPARE_FOR_DROP - - /* The following is parameter to ha_panic() */ - -enum ha_panic_function { - HA_PANIC_CLOSE, /* Close all databases */ - HA_PANIC_WRITE, /* Unlock and write status */ - HA_PANIC_READ /* Lock and read keyinfo */ -}; - - /* The following is parameter to ha_create(); keytypes */ - -enum ha_base_keytype { - HA_KEYTYPE_END=0, - HA_KEYTYPE_TEXT=1, /* Key is sorted as letters */ - HA_KEYTYPE_BINARY=2, /* Key is sorted as unsigned chars */ - HA_KEYTYPE_SHORT_INT=3, - HA_KEYTYPE_LONG_INT=4, - HA_KEYTYPE_FLOAT=5, - HA_KEYTYPE_DOUBLE=6, - HA_KEYTYPE_NUM=7, /* Not packed num with pre-space */ - HA_KEYTYPE_USHORT_INT=8, - HA_KEYTYPE_ULONG_INT=9, - HA_KEYTYPE_LONGLONG=10, - HA_KEYTYPE_ULONGLONG=11, - HA_KEYTYPE_INT24=12, - HA_KEYTYPE_UINT24=13, - HA_KEYTYPE_INT8=14, - /* Varchar (0-255 bytes) with length packed with 1 byte */ - HA_KEYTYPE_VARTEXT1=15, /* Key is sorted as letters */ - HA_KEYTYPE_VARBINARY1=16, /* Key is sorted as unsigned chars */ - /* Varchar (0-65535 bytes) with length packed with 2 bytes */ - HA_KEYTYPE_VARTEXT2=17, /* Key is sorted as letters */ - HA_KEYTYPE_VARBINARY2=18, /* Key is sorted as unsigned chars */ - HA_KEYTYPE_BIT=19 -}; - -#define HA_MAX_KEYTYPE 31 /* Must be log2-1 */ - -/* - These flags kan be OR:ed to key-flag - Note that these can only be up to 16 bits! -*/ - -#define HA_NOSAME 1U /* Set if not dupplicated records */ -#define HA_PACK_KEY 2U /* Pack string key to previous key */ -#define HA_AUTO_KEY 16U -#define HA_BINARY_PACK_KEY 32U /* Packing of all keys to prev key */ -#define HA_FULLTEXT 128U /* For full-text search */ -#define HA_UNIQUE_CHECK 256U /* Check the key for uniqueness */ -#define HA_SPATIAL 1024U /* For spatial search */ -#define HA_NULL_ARE_EQUAL 2048U /* NULL in key are cmp as equal */ -#define HA_GENERATED_KEY 8192U /* Automatically generated key */ - - /* The combination of the above can be used for key type comparison. */ -#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \ - HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \ - HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY) - -/* - Key contains partial segments. - - This flag is internal to the MySQL server by design. It is not supposed - neither to be saved in FRM-files, nor to be passed to storage engines. - It is intended to pass information into internal static sort_keys(KEY *, - KEY *) function. - - This flag can be calculated -- it's based on key lengths comparison. -*/ -#define HA_KEY_HAS_PART_KEY_SEG 65536 -/* Internal Flag Can be calcaluted */ -#define HA_INVISIBLE_KEY 2<<18 - /* Automatic bits in key-flag */ - -#define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */ -#define HA_VAR_LENGTH_KEY 8 -#define HA_NULL_PART_KEY 64 -#define HA_USES_COMMENT 4096 -#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */ -#define HA_USES_BLOCK_SIZE ((uint) 32768) -#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */ - -/* This flag can be used only in KEY::ext_key_flags */ -#define HA_EXT_NOSAME 131072 - - /* These flags can be added to key-seg-flag */ - -#define HA_SPACE_PACK 1 /* Pack space in key-seg */ -#define HA_PART_KEY_SEG 4 /* Used by MySQL for part-key-cols */ -#define HA_VAR_LENGTH_PART 8 -#define HA_NULL_PART 16 -#define HA_BLOB_PART 32 -#define HA_SWAP_KEY 64 -#define HA_REVERSE_SORT 128 /* Sort key in reverse order */ -#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */ - -#define HA_BIT_PART 1024 -#define HA_CAN_MEMCMP 2048 /* internal, never stored in frm */ - - /* optionbits for database */ -#define HA_OPTION_PACK_RECORD 1U -#define HA_OPTION_PACK_KEYS 2U -#define HA_OPTION_COMPRESS_RECORD 4U -#define HA_OPTION_LONG_BLOB_PTR 8U /* new ISAM format */ -#define HA_OPTION_TMP_TABLE 16U -#define HA_OPTION_CHECKSUM 32U -#define HA_OPTION_DELAY_KEY_WRITE 64U -#define HA_OPTION_NO_PACK_KEYS 128U /* Reserved for MySQL */ -/* unused 256 */ -#define HA_OPTION_RELIES_ON_SQL_LAYER 512U -#define HA_OPTION_NULL_FIELDS 1024U -#define HA_OPTION_PAGE_CHECKSUM 2048U -/* - STATS_PERSISTENT=1 has been specified in the SQL command (either CREATE - or ALTER TABLE). Table and index statistics that are collected by the - storage engine and used by the optimizer for query optimization will be - stored on disk and will not change after a server restart. -*/ -#define HA_OPTION_STATS_PERSISTENT 4096U -/* - STATS_PERSISTENT=0 has been specified in CREATE/ALTER TABLE. Statistics - for the table will be wiped away on server shutdown and new ones recalculated - after the server is started again. If none of HA_OPTION_STATS_PERSISTENT or - HA_OPTION_NO_STATS_PERSISTENT is set, this means that the setting is not - explicitly set at table level and the corresponding table will use whatever - is the global server default. -*/ -#define HA_OPTION_NO_STATS_PERSISTENT 8192U - -/* .frm has extra create options in linked-list format */ -#define HA_OPTION_TEXT_CREATE_OPTIONS_legacy (1U << 14) /* 5.2 to 5.5, unused since 10.0 */ -#define HA_OPTION_TEMP_COMPRESS_RECORD (1U << 15) /* set by isamchk */ -#define HA_OPTION_READ_ONLY_DATA (1U << 16) /* Set by isamchk */ -#define HA_OPTION_NO_CHECKSUM (1U << 17) -#define HA_OPTION_NO_DELAY_KEY_WRITE (1U << 18) - - /* Bits in flag to create() */ - -#define HA_DONT_TOUCH_DATA 1U /* Don't empty datafile (isamchk) */ -#define HA_PACK_RECORD 2U /* Request packed record format */ -#define HA_CREATE_TMP_TABLE 4U -#define HA_CREATE_CHECKSUM 8U -#define HA_CREATE_KEEP_FILES 16U /* don't overwrite .MYD and MYI */ -#define HA_CREATE_PAGE_CHECKSUM 32U -#define HA_CREATE_DELAY_KEY_WRITE 64U -#define HA_CREATE_RELIES_ON_SQL_LAYER 128U -#define HA_CREATE_INTERNAL_TABLE 256U -#define HA_PRESERVE_INSERT_ORDER 512U -#define HA_CREATE_NO_ROLLBACK 1024U - -/* Flags used by start_bulk_insert */ - -#define HA_CREATE_UNIQUE_INDEX_BY_SORT 1U - - -/* - The following flags (OR-ed) are passed to handler::info() method. - The method copies misc handler information out of the storage engine - to data structures accessible from MySQL - - Same flags are also passed down to mi_status, myrg_status, etc. -*/ - -/* this one is not used */ -#define HA_STATUS_POS 1U -/* - assuming the table keeps shared actual copy of the 'info' and - local, possibly outdated copy, the following flag means that - it should not try to get the actual data (locking the shared structure) - slightly outdated version will suffice -*/ -#define HA_STATUS_NO_LOCK 2U -/* update the time of the last modification (in handler::update_time) */ -#define HA_STATUS_TIME 4U -/* - update the 'constant' part of the info: - handler::max_data_file_length, max_index_file_length, create_time - sortkey, ref_length, block_size, data_file_name, index_file_name. - handler::table->s->keys_in_use, keys_for_keyread, rec_per_key -*/ -#define HA_STATUS_CONST 8U -/* - update the 'variable' part of the info: - handler::records, deleted, data_file_length, index_file_length, - check_time, mean_rec_length -*/ -#define HA_STATUS_VARIABLE 16U -/* - get the information about the key that caused last duplicate value error - update handler::errkey and handler::dupp_ref - see handler::get_dup_key() -*/ -#define HA_STATUS_ERRKEY 32U -/* - update handler::auto_increment_value -*/ -#define HA_STATUS_AUTO 64U -/* - Get also delete_length when HA_STATUS_VARIABLE is called. It's ok to set it also - when only HA_STATUS_VARIABLE but it won't be used. -*/ -#define HA_STATUS_VARIABLE_EXTRA 128U -/* - Treat empty table as empty (ignore HA_STATUS_TIME hack). -*/ -#define HA_STATUS_OPEN 256U - -/* - Errorcodes given by handler functions - - opt_sum_query() assumes these codes are > 1 - Do not add error numbers before HA_ERR_FIRST. - If necessary to add lower numbers, change HA_ERR_FIRST accordingly. -*/ -#define HA_ERR_FIRST 120 /* Copy of first error nr.*/ - -#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */ -#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */ -#define HA_ERR_INTERNAL_ERROR 122 /* Internal error */ -#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */ -#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */ -#define HA_ERR_CRASHED 126 /* Indexfile is crashed */ -#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */ -#define HA_ERR_OUT_OF_MEM 128 /* Out of memory */ -#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */ -#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */ -#define HA_ERR_OLD_FILE 132 /* old databasfile */ -#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */ -#define HA_ERR_RECORD_DELETED 134 /* A record is not there */ -#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */ -#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */ -#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */ -#define HA_ERR_UNSUPPORTED 138 /* unsupported extension used */ -#define HA_ERR_TO_BIG_ROW 139 /* Too big row */ -#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */ -#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */ -#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */ -#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */ -#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */ -#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */ -#define HA_ERR_LOCK_WAIT_TIMEOUT 146 -#define HA_ERR_LOCK_TABLE_FULL 147 -#define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */ -#define HA_ERR_LOCK_DEADLOCK 149 -#define HA_ERR_CANNOT_ADD_FOREIGN 150 /* Cannot add a foreign key constr. */ -#define HA_ERR_NO_REFERENCED_ROW 151 /* Cannot add a child row */ -#define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */ -#define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */ -#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */ -#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */ -#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */ -#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */ -/* NULLs are not supported in spatial index */ -#define HA_ERR_NULL_IN_SPATIAL 158 -#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */ -/* There's no partition in table for given value */ -#define HA_ERR_NO_PARTITION_FOUND 160 -#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */ -#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr */ -/* - Upholding foreign key constraints would lead to a duplicate key error - in some other table. -*/ -#define HA_ERR_FOREIGN_DUPLICATE_KEY 163 -/* The table changed in storage engine */ -#define HA_ERR_TABLE_NEEDS_UPGRADE 164 -#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */ - -#define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */ -#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */ -#define HA_ERR_GENERIC 168 /* Generic error */ -/* row not actually updated: new values same as the old values */ -#define HA_ERR_RECORD_IS_THE_SAME 169 -#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this - statement */ -#define HA_ERR_CORRUPT_EVENT 171 /* The event was corrupt, leading to - illegal data being read */ -#define HA_ERR_NEW_FILE 172 /* New file format */ -#define HA_ERR_ROWS_EVENT_APPLY 173 /* The event could not be processed - no other hanlder error happened */ -#define HA_ERR_INITIALIZATION 174 /* Error during initialization */ -#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */ -#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */ -#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177 /*Too many active concurrent transactions */ -/* There's no explicitly listed partition in table for the given value */ -#define HA_ERR_NOT_IN_LOCK_PARTITIONS 178 -#define HA_ERR_INDEX_COL_TOO_LONG 179 /* Index column length exceeds limit */ -#define HA_ERR_INDEX_CORRUPT 180 /* Index corrupted */ -#define HA_ERR_UNDO_REC_TOO_BIG 181 /* Undo log record too big */ -#define HA_FTS_INVALID_DOCID 182 /* Invalid InnoDB Doc ID */ -#define HA_ERR_TABLE_IN_FK_CHECK 183 /* Table being used in foreign key check */ -#define HA_ERR_TABLESPACE_EXISTS 184 /* The tablespace existed in storage engine */ -#define HA_ERR_TOO_MANY_FIELDS 185 /* Table has too many columns */ -#define HA_ERR_ROW_IN_WRONG_PARTITION 186 /* Row in wrong partition */ -#define HA_ERR_ROW_NOT_VISIBLE 187 -#define HA_ERR_ABORTED_BY_USER 188 -#define HA_ERR_DISK_FULL 189 -#define HA_ERR_INCOMPATIBLE_DEFINITION 190 -#define HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE 191 /* Too many words in a phrase */ -#define HA_ERR_DECRYPTION_FAILED 192 /* Table encrypted but decypt failed */ -#define HA_ERR_FK_DEPTH_EXCEEDED 193 /* FK cascade depth exceeded */ -#define HA_ERR_TABLESPACE_MISSING 194 /* Missing Tablespace */ -#define HA_ERR_SEQUENCE_INVALID_DATA 195 -#define HA_ERR_SEQUENCE_RUN_OUT 196 -#define HA_ERR_LAST 196 /* Copy of last error nr * */ - -/* Number of different errors */ -#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) - -/* aliases */ -#define HA_ERR_TABLE_CORRUPT HA_ERR_WRONG_IN_RECORD -#define HA_ERR_QUERY_INTERRUPTED HA_ERR_ABORTED_BY_USER -#define HA_ERR_NOT_ALLOWED_COMMAND HA_ERR_WRONG_COMMAND - - /* Other constants */ - -#define HA_NAMELEN 64 /* Max length of saved filename */ -#define NO_SUCH_KEY (~(uint)0) /* used as a key no. */ - -typedef ulong key_part_map; -#define HA_WHOLE_KEY (~(key_part_map)0) - - /* Intern constants in databases */ - - /* bits in _search */ -#define SEARCH_FIND 1U -#define SEARCH_NO_FIND 2U -#define SEARCH_SAME 4U -#define SEARCH_BIGGER 8U -#define SEARCH_SMALLER 16U -#define SEARCH_SAVE_BUFF 32U -#define SEARCH_UPDATE 64U -#define SEARCH_PREFIX 128U -#define SEARCH_LAST 256U -#define MBR_CONTAIN 512U -#define MBR_INTERSECT 1024U -#define MBR_WITHIN 2048U -#define MBR_DISJOINT 4096U -#define MBR_EQUAL 8192U -#define MBR_DATA 16384U -#define SEARCH_NULL_ARE_EQUAL 32768U /* NULL in keys are equal */ -#define SEARCH_NULL_ARE_NOT_EQUAL 65536U/* NULL in keys are not equal */ -/* Use this when inserting a key in position order */ -#define SEARCH_INSERT (SEARCH_NULL_ARE_NOT_EQUAL*2) -/* Only part of the key is specified while reading */ -#define SEARCH_PART_KEY (SEARCH_INSERT*2) -/* Used when user key (key 2) contains transaction id's */ -#define SEARCH_USER_KEY_HAS_TRANSID (SEARCH_PART_KEY*2) -/* Used when page key (key 1) contains transaction id's */ -#define SEARCH_PAGE_KEY_HAS_TRANSID (SEARCH_USER_KEY_HAS_TRANSID*2) - - /* bits in opt_flag */ -#define QUICK_USED 1U -#define READ_CACHE_USED 2U -#define READ_CHECK_USED 4U -#define KEY_READ_USED 8U -#define WRITE_CACHE_USED 16U -#define OPT_NO_ROWS 32U - - /* bits in update */ -#define HA_STATE_CHANGED 1U /* Database has changed */ -#define HA_STATE_AKTIV 2U /* Has a current record */ -#define HA_STATE_WRITTEN 4U /* Record is written */ -#define HA_STATE_DELETED 8U -#define HA_STATE_NEXT_FOUND 16U /* Next found record (record before) */ -#define HA_STATE_PREV_FOUND 32U /* Prev found record (record after) */ -#define HA_STATE_NO_KEY 64U /* Last read didn't find record */ -#define HA_STATE_KEY_CHANGED 128U -#define HA_STATE_WRITE_AT_END 256U /* set in _ps_find_writepos */ -#define HA_STATE_BUFF_SAVED 512U /* If current keybuff is info->buff */ -#define HA_STATE_ROW_CHANGED 1024U /* To invalidate ROW cache */ -#define HA_STATE_EXTEND_BLOCK 2048U -#define HA_STATE_RNEXT_SAME 4096U /* rnext_same occupied lastkey2 */ - -/* myisampack expects no more than 32 field types. */ -enum en_fieldtype { - FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE, - FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO, - FIELD_VARCHAR,FIELD_CHECK, - FIELD_enum_val_count -}; - -enum data_file_type { - STATIC_RECORD, DYNAMIC_RECORD, COMPRESSED_RECORD, BLOCK_RECORD, NO_RECORD -}; - -/* For key ranges */ - -#define NO_MIN_RANGE 1U -#define NO_MAX_RANGE 2U -#define NEAR_MIN 4U -#define NEAR_MAX 8U -#define UNIQUE_RANGE 16U -#define EQ_RANGE 32U -#define NULL_RANGE 64U -#define GEOM_FLAG 128U - -typedef struct st_key_range -{ - const uchar *key; - uint length; - key_part_map keypart_map; - enum ha_rkey_function flag; -} key_range; - -typedef void *range_id_t; - -typedef struct st_key_multi_range -{ - key_range start_key; - key_range end_key; - range_id_t ptr; /* Free to use by caller (ptr to row etc) */ - /* - A set of range flags that describe both endpoints: UNIQUE_RANGE, - NULL_RANGE, EQ_RANGE, GEOM_FLAG. - (Flags that describe one endpoint, NO_{MIN|MAX}_RANGE, NEAR_{MIN|MAX} will - not be set here) - */ - uint range_flag; -} KEY_MULTI_RANGE; - - -/* Store first and last leaf page accessed by records_in_range */ - -typedef struct st_page_range -{ - ulonglong first_page; - ulonglong last_page; -} page_range; - -#define UNUSED_PAGE_NO ULONGLONG_MAX -#define unused_page_range { UNUSED_PAGE_NO, UNUSED_PAGE_NO } - -/* For number of records */ -#ifdef BIG_TABLES -#define rows2double(A) ulonglong2double(A) -typedef my_off_t ha_rows; -#else -#define rows2double(A) (double) (A) -typedef ulong ha_rows; -#endif - -#define HA_POS_ERROR (~ (ha_rows) 0) -#define HA_OFFSET_ERROR (~ (my_off_t) 0) -#define HA_ROWS_MAX HA_POS_ERROR - -#if SIZEOF_OFF_T == 4 -#define MAX_FILE_SIZE INT_MAX32 -#else -#define MAX_FILE_SIZE LONGLONG_MAX -#endif - -#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2) - -/* invalidator function reference for Query Cache */ -C_MODE_START -typedef void (* invalidator_by_filename)(const char * filename); -C_MODE_END - -#endif /* _my_base_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_bit.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_bit.h deleted file mode 100644 index 8ee8b41..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_bit.h +++ /dev/null @@ -1,219 +0,0 @@ -/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MY_BIT_INCLUDED -#define MY_BIT_INCLUDED - -/* - Some useful bit functions -*/ - -C_MODE_START - -extern const uchar _my_bits_reverse_table[256]; - - -/* - my_bit_log2_xxx() - - In the given value, find the highest bit set, - which is the smallest X that satisfies the condition: (2^X >= value). - Can be used as a reverse operation for (1<> 4)) + 4: - my_bit_log2_hex_digit(value); -} -static inline CONSTEXPR uint my_bit_log2_uint16(uint16 value) -{ - return value & 0xFF00 ? my_bit_log2_uint8((uint8) (value >> 8)) + 8 : - my_bit_log2_uint8((uint8) value); -} -static inline CONSTEXPR uint my_bit_log2_uint32(uint32 value) -{ - return value & 0xFFFF0000UL ? - my_bit_log2_uint16((uint16) (value >> 16)) + 16 : - my_bit_log2_uint16((uint16) value); -} -static inline CONSTEXPR uint my_bit_log2_uint64(ulonglong value) -{ - return value & 0xFFFFFFFF00000000ULL ? - my_bit_log2_uint32((uint32) (value >> 32)) + 32 : - my_bit_log2_uint32((uint32) value); -} -static inline CONSTEXPR uint my_bit_log2_size_t(size_t value) -{ -#ifdef __cplusplus - static_assert(sizeof(size_t) <= sizeof(ulonglong), - "size_t <= ulonglong is an assumption that needs to be fixed " - "for this architecture. Please create an issue on " - "https://jira.mariadb.org"); -#endif - return my_bit_log2_uint64((ulonglong) value); -} - - -/* -Count bits in 32bit integer - - Algorithm by Sean Anderson, according to: - http://graphics.stanford.edu/~seander/bithacks.html - under "Counting bits set, in parallel" - - (Original code public domain). -*/ -static inline uint my_count_bits_uint32(uint32 v) -{ - v = v - ((v >> 1) & 0x55555555); - v = (v & 0x33333333) + ((v >> 2) & 0x33333333); - return (((v + (v >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; -} - - -static inline uint my_count_bits(ulonglong x) -{ - return my_count_bits_uint32((uint32)x) + my_count_bits_uint32((uint32)(x >> 32)); -} - - - - -/* - Next highest power of two - - SYNOPSIS - my_round_up_to_next_power() - v Value to check - - RETURN - Next or equal power of 2 - Note: 0 will return 0 - - NOTES - Algorithm by Sean Anderson, according to: - http://graphics.stanford.edu/~seander/bithacks.html - (Original code public domain) - - Comments shows how this works with 01100000000000000000000000001011 -*/ - -static inline uint32 my_round_up_to_next_power(uint32 v) -{ - v--; /* 01100000000000000000000000001010 */ - v|= v >> 1; /* 01110000000000000000000000001111 */ - v|= v >> 2; /* 01111100000000000000000000001111 */ - v|= v >> 4; /* 01111111110000000000000000001111 */ - v|= v >> 8; /* 01111111111111111100000000001111 */ - v|= v >> 16; /* 01111111111111111111111111111111 */ - return v+1; /* 10000000000000000000000000000000 */ -} - -static inline uint32 my_clear_highest_bit(uint32 v) -{ - uint32 w=v >> 1; - w|= w >> 1; - w|= w >> 2; - w|= w >> 4; - w|= w >> 8; - w|= w >> 16; - return v & w; -} - -static inline uint32 my_reverse_bits(uint32 key) -{ - return - ((uint32)_my_bits_reverse_table[ key & 255] << 24) | - ((uint32)_my_bits_reverse_table[(key>> 8) & 255] << 16) | - ((uint32)_my_bits_reverse_table[(key>>16) & 255] << 8) | - (uint32)_my_bits_reverse_table[(key>>24) ]; -} - -/* - a number with the n lowest bits set - an overflow-safe version of (1 << n) - 1 -*/ -static inline uint64 my_set_bits(int n) -{ - return (((1ULL << (n - 1)) - 1) << 1) | 1; -} - -/* Create a mask of the significant bits for the last byte (1,3,7,..255) */ -static inline uchar last_byte_mask(uint bits) -{ - /* Get the number of used bits-1 (0..7) in the last byte */ - unsigned int const used = (bits - 1U) & 7U; - /* Return bitmask for the significant bits */ - return (uchar) ((2U << used) - 1); -} - -#ifdef _MSC_VER -#include -#endif - -/* - Find the position of the first(least significant) bit set in - the argument. Returns 64 if the argument was 0. -*/ -static inline uint my_find_first_bit(ulonglong n) -{ - if(!n) - return 64; -#if defined(__GNUC__) - return __builtin_ctzll(n); -#elif defined(_MSC_VER) -#if defined(_M_IX86) - unsigned long bit; - if( _BitScanForward(&bit, (uint)n)) - return bit; - _BitScanForward(&bit, (uint)(n>>32)); - return bit + 32; -#else - unsigned long bit; - _BitScanForward64(&bit, n); - return bit; -#endif -#else - /* Generic case */ - uint shift= 0; - static const uchar last_bit[16] = { 32, 0, 1, 0, - 2, 0, 1, 0, - 3, 0, 1, 0, - 2, 0, 1, 0}; - uint bit; - while ((bit = last_bit[(n >> shift) & 0xF]) == 32) - shift+= 4; - return shift+bit; -#endif -} -C_MODE_END - -#endif /* MY_BIT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_bitmap.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_bitmap.h deleted file mode 100644 index f192544..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_bitmap.h +++ /dev/null @@ -1,139 +0,0 @@ -/* Copyright (c) 2001, 2011, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_bitmap_h_ -#define _my_bitmap_h_ - -#define MY_BIT_NONE (~(uint) 0) - -#include -#include - -typedef uint32 my_bitmap_map; - -typedef struct st_bitmap -{ - my_bitmap_map *bitmap; - my_bitmap_map *last_word_ptr; - /* - mutex will be acquired for the duration of each bitmap operation if - thread_safe flag in bitmap_init was set. Otherwise, we optimize by not - acquiring the mutex - */ - mysql_mutex_t *mutex; - my_bitmap_map last_word_mask; - uint32 n_bits; /* number of bits occupied by the above */ -} MY_BITMAP; - -#ifdef __cplusplus -extern "C" { -#endif - -/* compatibility functions */ -#define bitmap_init(A,B,C,D) my_bitmap_init(A,B,C,D) -#define bitmap_free(A) my_bitmap_free(A) -/* Reset memory. Faster then doing a full bzero */ -#define my_bitmap_clear(A) ((A)->bitmap= 0) - -extern void create_last_word_mask(MY_BITMAP *map); -extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, - my_bool thread_safe); -extern my_bool bitmap_is_clear_all(const MY_BITMAP *map); -extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size); -extern my_bool bitmap_is_set_all(const MY_BITMAP *map); -extern my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2); -extern my_bool bitmap_is_overlapping(const MY_BITMAP *map1, - const MY_BITMAP *map2); -extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit); -extern my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit); -extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit); -extern my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit); -extern my_bool bitmap_union_is_set_all(const MY_BITMAP *map1, - const MY_BITMAP *map2); -extern my_bool bitmap_exists_intersection(const MY_BITMAP **bitmap_array, - uint bitmap_count, - uint start_bit, uint end_bit); - -extern uint bitmap_set_next(MY_BITMAP *map); -extern uint bitmap_get_first(const MY_BITMAP *map); -extern uint bitmap_get_first_set(const MY_BITMAP *map); -extern uint bitmap_bits_set(const MY_BITMAP *map); -extern uint bitmap_get_next_set(const MY_BITMAP *map, uint bitmap_bit); -extern void my_bitmap_free(MY_BITMAP *map); -extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit); -extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size); -extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2); -extern void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2); -extern void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2); -extern void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2); -extern void bitmap_invert(MY_BITMAP *map); -extern void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2); - -extern uint bitmap_lock_set_next(MY_BITMAP *map); -extern void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit); -/* Fast, not thread safe, bitmap functions */ -#define bitmap_buffer_size(bits) (((bits)+31)/32)*4 -#define no_bytes_in_map(map) (((map)->n_bits + 7)/8) -#define no_words_in_map(map) (((map)->n_bits + 31)/32) -#define bytes_word_aligned(bytes) (4*((bytes + 3)/4)) -/* The following functions must be compatible with create_last_word_mask()! */ -static inline void -bitmap_set_bit(MY_BITMAP *map,uint bit) -{ - uchar *b= (uchar*) map->bitmap + bit / 8; - DBUG_ASSERT(bit < map->n_bits); - *b= (uchar) (*b | 1U << (bit & 7)); -} -static inline void -bitmap_flip_bit(MY_BITMAP *map,uint bit) -{ - uchar *b= (uchar*) map->bitmap + bit / 8; - DBUG_ASSERT(bit < map->n_bits); - *b= (uchar) (*b ^ 1U << (bit & 7)); -} -static inline void -bitmap_clear_bit(MY_BITMAP *map,uint bit) -{ - uchar *b= (uchar*) map->bitmap + bit / 8; - DBUG_ASSERT(bit < map->n_bits); - *b= (uchar) (*b & ~(1U << (bit & 7))); -} -static inline uint -bitmap_is_set(const MY_BITMAP *map,uint bit) -{ - const uchar *b= (const uchar*) map->bitmap + bit / 8; - DBUG_ASSERT(bit < map->n_bits); - return !!(*b & (1U << (bit & 7))); -} - -static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) -{ - if (memcmp(map1->bitmap, map2->bitmap, 4*(no_words_in_map(map1)-1)) != 0) - return FALSE; - return ((*map1->last_word_ptr | map1->last_word_mask) == - (*map2->last_word_ptr | map2->last_word_mask)); -} - -#define bitmap_clear_all(MAP) \ - { memset((MAP)->bitmap, 0, 4*no_words_in_map((MAP))); } -#define bitmap_set_all(MAP) \ - (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP)))) - -#ifdef __cplusplus -} -#endif - -#endif /* _my_bitmap_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_check_opt.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_check_opt.h deleted file mode 100644 index f5ec522..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_check_opt.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_check_opt_h -#define _my_check_opt_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - All given definitions needed for MyISAM storage engine: - myisamchk.c or/and ha_myisam.cc or/and micheck.c - Some definitions are needed by the MySQL parser. -*/ - -#define T_AUTO_INC (1UL << 0) -#define T_AUTO_REPAIR (1UL << 1) -#define T_BACKUP_DATA (1UL << 2) -#define T_CALC_CHECKSUM (1UL << 3) -#define T_CHECK (1UL << 4) -#define T_CHECK_ONLY_CHANGED (1UL << 5) -#define T_CREATE_MISSING_KEYS (1UL << 6) -#define T_DESCRIPT (1UL << 7) -#define T_DONT_CHECK_CHECKSUM (1UL << 8) -#define T_EXTEND (1UL << 9) -#define T_FAST (1UL << 10) -#define T_FORCE_CREATE (1UL << 11) -#define T_FORCE_UNIQUENESS (1UL << 12) -#define T_INFO (1UL << 13) -/** CHECK TABLE...MEDIUM (the default) */ -#define T_MEDIUM (1UL << 14) -/** CHECK TABLE...QUICK */ -#define T_QUICK (1UL << 15) -#define T_READONLY (1UL << 16) -#define T_REP (1UL << 17) -#define T_REP_BY_SORT (1UL << 18) -#define T_REP_PARALLEL (1UL << 19) -#define T_RETRY_WITHOUT_QUICK (1UL << 20) -#define T_SAFE_REPAIR (1UL << 21) -#define T_SILENT (1UL << 22) -#define T_SORT_INDEX (1UL << 23) -#define T_SORT_RECORDS (1UL << 24) -#define T_STATISTICS (1UL << 25) -#define T_UNPACK (1UL << 26) -#define T_UPDATE_STATE (1UL << 27) -#define T_VERBOSE (1UL << 28) -#define T_VERY_SILENT (1UL << 29) -#define T_WAIT_FOREVER (1UL << 30) -#define T_WRITE_LOOP (1UL << 31) -#define T_ZEROFILL (1ULL << 32) -#define T_ZEROFILL_KEEP_LSN (1ULL << 33) -/** If repair should not bump create_rename_lsn */ -#define T_NO_CREATE_RENAME_LSN (1ULL << 34) -/** If repair shouldn't do any locks */ -#define T_NO_LOCKS (1ULL << 35) -#define T_CREATE_UNIQUE_BY_SORT (1ULL << 36) -#define T_SUPPRESS_ERR_HANDLING (1ULL << 37) -#define T_FORCE_SORT_MEMORY (1ULL << 38) - -#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_compare.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_compare.h deleted file mode 100644 index e9c0513..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_compare.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright (c) 2011, Oracle and/or its affiliates. - Copyright (c) 1991, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_compare_h -#define _my_compare_h - -#include "myisampack.h" -#ifdef __cplusplus -extern "C" { -#endif - -#include "m_ctype.h" /* CHARSET_INFO */ - -/* - There is a hard limit for the maximum number of keys as there are only - 8 bits in the index file header for the number of keys in a table. - This means that 0..255 keys can exist for a table. The idea of - HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on - a MyISAM table for which one has more keys than MyISAM is normally - compiled for. If you don't have this, you will get a core dump when - running myisamchk compiled for 128 keys on a table with 255 keys. -*/ - -#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */ -/* - The following defines can be increased if necessary. - But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH. -*/ - -#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */ -#define HA_MAX_KEY_SEG 32 /* Max segments for key */ - -#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6) -#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8) - -typedef struct st_HA_KEYSEG /* Key-portion */ -{ - CHARSET_INFO *charset; - uint32 start; /* Start of key in record */ - uint32 null_pos; /* position to NULL indicator */ - uint16 bit_pos; /* Position to bit part */ - uint16 flag; - uint16 length; /* Keylength */ - uint16 language; - uint8 type; /* Type of key (for sort) */ - uint8 null_bit; /* bitmask to test for NULL */ - uint8 bit_start; - uint8 bit_length; /* Length of bit part */ -} HA_KEYSEG; - -#define get_key_length(length,key) \ -{ if (*(const uchar*) (key) != 255) \ - length= (uint) *(const uchar*) ((key)++); \ - else \ - { length= mi_uint2korr((key)+1); (key)+=3; } \ -} - -#define get_key_length_rdonly(length,key) \ -{ if (*(const uchar*) (key) != 255) \ - length= ((uint) *(const uchar*) ((key))); \ - else \ - { length= mi_uint2korr((key)+1); } \ -} - -#define get_key_pack_length(length,length_pack,key) \ -{ if (*(const uchar*) (key) != 255) \ - { length= (uint) *(const uchar*) ((key)++); length_pack= 1; }\ - else \ - { length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \ -} - -#define store_key_length_inc(key,length) \ -{ if ((length) < 255) \ - { *(key)++= (uchar)(length); } \ - else \ - { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \ -} - -#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3) - -static inline uchar get_rec_bits(const uchar *ptr, uchar ofs, uint len) -{ - uint16 val= ptr[0]; - if (ofs + len > 8) - val|= (uint16)((uint16)(ptr[1]) << 8); - return (uchar) ((val >> ofs) & ((1 << len) - 1)); -} - -static inline void set_rec_bits(uint16 bits, uchar *ptr, uchar ofs, uint len) -{ - ptr[0]= (uchar) ((ptr[0] & ~(((1 << len) - 1) << ofs)) | (bits << ofs)); - if (ofs + len > 8) - ptr[1]= (uchar) ((ptr[1] & ~((1 << (len - 8 + ofs)) - 1)) | - bits >> (8 - ofs)); -} - -#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \ - set_rec_bits(0, bit_ptr, bit_ofs, bit_len) - -extern int ha_compare_text(CHARSET_INFO *, const uchar *, size_t, - const uchar *, size_t , my_bool); -extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a, - const uchar *b, uint key_length, uint nextflag, - uint *diff_pos); -extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a); - -/* - Inside an in-memory data record, memory pointers to pieces of the - record (like BLOBs) are stored in their native byte order and in - this amount of bytes. -*/ -#define portable_sizeof_char_ptr 8 -#ifdef __cplusplus -} -#endif - -/** - Return values for pushed index condition or rowid filter check functions. - - 0=CHECK_NEG - The filter is not satisfied. The engine should discard this - index tuple and continue the scan. - 1=CHECK_POS - The filter is statisfied. Current index tuple should be - returned to the SQL layer. - 2=CHECK_OUT_OF_RANGE - the index tuple is outside of the range that we're - scanning. (Example: if we're scanning "t.key BETWEEN 10 AND - 20" and got a "t.key=21" tuple) Tthe engine should stop - scanning and return HA_ERR_END_OF_FILE right away). - 3=CHECK_ABORTED_BY_USER - the engine must stop scanning and should return - HA_ERR_ABORTED_BY_USER right away - -1=CHECK_ERROR - Reserved for internal errors in engines. Should not be - returned by ICP or rowid filter check functions. -*/ - -typedef enum check_result { - CHECK_ERROR=-1, - CHECK_NEG=0, - CHECK_POS=1, - CHECK_OUT_OF_RANGE=2, - CHECK_ABORTED_BY_USER=3 -} check_result_t; - -typedef check_result_t (*index_cond_func_t)(void *param); -typedef check_result_t (*rowid_filter_func_t)(void *param); -typedef int (*rowid_filter_is_active_func_t)(void *param); - -#endif /* _my_compare_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_context.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_context.h deleted file mode 100644 index ea0e349..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_context.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - Copyright 2011 Kristian Nielsen and Monty Program Ab - - This file is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this. If not, see . -*/ - -/* - Simple API for spawning a co-routine, to be used for async libmysqlclient. - - Idea is that by implementing this interface using whatever facilities are - available for given platform, we can use the same code for the generic - libmysqlclient-async code. - - (This particular implementation uses Posix ucontext swapcontext().) -*/ - -#ifdef __WIN__ -#define MY_CONTEXT_USE_WIN32_FIBERS 1 -#elif defined(__GNUC__) && __GNUC__ >= 3 && defined(__x86_64__) && !defined(__ILP32__) -#define MY_CONTEXT_USE_X86_64_GCC_ASM -#elif defined(__GNUC__) && __GNUC__ >= 3 && defined(__i386__) -#define MY_CONTEXT_USE_I386_GCC_ASM -#elif defined(HAVE_UCONTEXT_H) -#define MY_CONTEXT_USE_UCONTEXT -#else -#define MY_CONTEXT_DISABLE -#endif - -#ifdef MY_CONTEXT_USE_WIN32_FIBERS -struct my_context { - void (*user_func)(void *); - void *user_arg; - void *app_fiber; - void *lib_fiber; - int return_value; -#ifndef DBUG_OFF - void *dbug_state; -#endif -}; -#endif - - -#ifdef MY_CONTEXT_USE_UCONTEXT -#include - -struct my_context { - void (*user_func)(void *); - void *user_data; - void *stack; - size_t stack_size; - ucontext_t base_context; - ucontext_t spawned_context; - int active; -#ifdef HAVE_VALGRIND_MEMCHECK_H - unsigned int valgrind_stack_id; -#endif -#ifndef DBUG_OFF - void *dbug_state; -#endif -}; -#endif - - -#ifdef MY_CONTEXT_USE_X86_64_GCC_ASM -#include - -struct my_context { - uint64_t save[9]; - void *stack_top; - void *stack_bot; -#ifdef HAVE_VALGRIND_MEMCHECK_H - unsigned int valgrind_stack_id; -#endif -#ifndef DBUG_OFF - void *dbug_state; -#endif -}; -#endif - - -#ifdef MY_CONTEXT_USE_I386_GCC_ASM -#include - -struct my_context { - uint64_t save[7]; - void *stack_top; - void *stack_bot; -#ifdef HAVE_VALGRIND_MEMCHECK_H - unsigned int valgrind_stack_id; -#endif -#ifndef DBUG_OFF - void *dbug_state; -#endif -}; -#endif - - -#ifdef MY_CONTEXT_DISABLE -struct my_context { - int dummy; -}; -#endif - - -/* - Initialize an asynchroneous context object. - Returns 0 on success, non-zero on failure. -*/ -extern int my_context_init(struct my_context *c, size_t stack_size); - -/* Free an asynchroneous context object, deallocating any resources used. */ -extern void my_context_destroy(struct my_context *c); - -/* - Spawn an asynchroneous context. The context will run the supplied user - function, passing the supplied user data pointer. - - The context must have been initialised with my_context_init() prior to - this call. - - The user function may call my_context_yield(), which will cause this - function to return 1. Then later my_context_continue() may be called, which - will resume the asynchroneous context by returning from the previous - my_context_yield() call. - - When the user function returns, this function returns 0. - - In case of error, -1 is returned. -*/ -extern int my_context_spawn(struct my_context *c, void (*f)(void *), void *d); - -/* - Suspend an asynchroneous context started with my_context_spawn. - - When my_context_yield() is called, execution immediately returns from the - last my_context_spawn() or my_context_continue() call. Then when later - my_context_continue() is called, execution resumes by returning from this - my_context_yield() call. - - Returns 0 if ok, -1 in case of error. -*/ -extern int my_context_yield(struct my_context *c); - -/* - Resume an asynchroneous context. The context was spawned by - my_context_spawn(), and later suspended inside my_context_yield(). - - The asynchroneous context may be repeatedly suspended with - my_context_yield() and resumed with my_context_continue(). - - Each time it is suspended, this function returns 1. When the originally - spawned user function returns, this function returns 0. - - In case of error, -1 is returned. -*/ -extern int my_context_continue(struct my_context *c); - - -struct mysql_async_context { - /* - This is set to the value that should be returned from foo_start() or - foo_cont() when a call is suspended. - */ - unsigned int events_to_wait_for; - /* - It is also set to the event(s) that triggered when a suspended call is - resumed, eg. whether we woke up due to connection completed or timeout - in mysql_real_connect_cont(). - */ - unsigned int events_occurred; - /* - This is set to the result of the whole asynchronous operation when it - completes. It uses a union, as different calls have different return - types. - */ - union { - void *r_ptr; - const void *r_const_ptr; - int r_int; - my_bool r_my_bool; - } ret_result; - /* - The timeout value (in millisecods), for suspended calls that need to wake - up on a timeout (eg. mysql_real_connect_start(). - */ - unsigned int timeout_value; - /* - This flag is set when we are executing inside some asynchronous call - foo_start() or foo_cont(). It is used to decide whether to use the - synchronous or asynchronous version of calls that may block such as - recv(). - - Note that this flag is not set when a call is suspended, eg. after - returning from foo_start() and before re-entering foo_cont(). - */ - my_bool active; - /* - This flag is set when an asynchronous operation is in progress, but - suspended. Ie. it is set when foo_start() or foo_cont() returns because - the operation needs to block, suspending the operation. - - It is used to give an error (rather than crash) if the application - attempts to call some foo_cont() method when no suspended operation foo is - in progress. - */ - my_bool suspended; - /* - If non-NULL, this is a pointer to a callback hook that will be invoked with - the user data argument just before the context is suspended, and just after - it is resumed. - */ - void (*suspend_resume_hook)(my_bool suspend, void *user_data); - void *suspend_resume_hook_user_data; - /* - This is used to save the execution contexts so that we can suspend an - operation and switch back to the application context, to resume the - suspended context later when the application re-invokes us with - foo_cont(). - */ - struct my_context async_context; -}; diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_counter.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_counter.h deleted file mode 100644 index c5cbe29..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_counter.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef MY_COUNTER_H_INCLUDED -#define MY_COUNTER_H_INCLUDED -/* - Copyright (C) 2018 MariaDB Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include - - -template class Atomic_counter -{ - std::atomic m_counter; - - Type add(Type i) { return m_counter.fetch_add(i, std::memory_order_relaxed); } - Type sub(Type i) { return m_counter.fetch_sub(i, std::memory_order_relaxed); } - -public: - Atomic_counter(const Atomic_counter &rhs) - { m_counter.store(rhs, std::memory_order_relaxed); } - Atomic_counter(Type val): m_counter(val) {} - Atomic_counter() {} - - Type operator++(int) { return add(1); } - Type operator--(int) { return sub(1); } - - Type operator++() { return add(1) + 1; } - Type operator--() { return sub(1) - 1; } - - Type operator+=(const Type i) { return add(i) + i; } - Type operator-=(const Type i) { return sub(i) - i; } - - operator Type() const { return m_counter.load(std::memory_order_relaxed); } - Type operator=(const Type val) - { m_counter.store(val, std::memory_order_relaxed); return val; } -}; -#endif /* MY_COUNTER_H_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_cpu.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_cpu.h deleted file mode 100644 index e536ff2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_cpu.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef MY_CPU_INCLUDED -#define MY_CPU_INCLUDED -/* Copyright (c) 2013, 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -/* instructions for specific cpu's */ - -/* - Macros for adjusting thread priority (hardware multi-threading) - The defines are the same ones used by the linux kernel -*/ - -#ifdef _ARCH_PWR8 -#include -/* Very low priority */ -#define HMT_very_low() __ppc_set_ppr_very_low() -/* Low priority */ -#define HMT_low() __ppc_set_ppr_low() -/* Medium low priority */ -#define HMT_medium_low() __ppc_set_ppr_med_low() -/* Medium priority */ -#define HMT_medium() __ppc_set_ppr_med() -/* Medium high priority */ -#define HMT_medium_high() __ppc_set_ppr_med_high() -/* High priority */ -#define HMT_high() asm volatile("or 3,3,3") -#else -#define HMT_very_low() -#define HMT_low() -#define HMT_medium_low() -#define HMT_medium() -#define HMT_medium_high() -#define HMT_high() -#endif - -#if defined __i386__ || defined __x86_64__ || defined _WIN32 -# define HAVE_PAUSE_INSTRUCTION /* added in Intel Pentium 4 */ -#endif - -#ifdef _WIN32 -#elif defined HAVE_PAUSE_INSTRUCTION -#elif defined(_ARCH_PWR8) -#elif defined __GNUC__ && (defined __arm__ || defined __aarch64__) -#else -# include "my_global.h" -# include "my_atomic.h" -#endif - -static inline void MY_RELAX_CPU(void) -{ -#ifdef _WIN32 - /* - In the Win32 API, the x86 PAUSE instruction is executed by calling - the YieldProcessor macro defined in WinNT.h. It is a CPU architecture- - independent way by using YieldProcessor. - */ - YieldProcessor(); -#elif defined HAVE_PAUSE_INSTRUCTION - /* - According to the gcc info page, asm volatile means that the - instruction has important side-effects and must not be removed. - Also asm volatile may trigger a memory barrier (spilling all registers - to memory). - */ -#ifdef __SUNPRO_CC - asm ("pause" ); -#else - __asm__ __volatile__ ("pause"); -#endif -#elif defined(_ARCH_PWR8) - __ppc_get_timebase(); -#elif defined __GNUC__ && (defined __arm__ || defined __aarch64__) - /* Mainly, prevent the compiler from optimizing away delay loops */ - __asm__ __volatile__ ("":::"memory"); -#else - int32 var, oldval = 0; - my_atomic_cas32_strong_explicit(&var, &oldval, 1, MY_MEMORY_ORDER_RELAXED, - MY_MEMORY_ORDER_RELAXED); -#endif -} - - -#ifdef HAVE_PAUSE_INSTRUCTION -# ifdef __cplusplus -extern "C" { -# endif -extern unsigned my_cpu_relax_multiplier; -void my_cpu_init(void); -# ifdef __cplusplus -} -# endif -#else -# define my_cpu_relax_multiplier 200 -# define my_cpu_init() /* nothing */ -#endif - -/* - LF_BACKOFF should be used to improve performance on hyperthreaded CPUs. Intel - recommends to use it in spin loops also on non-HT machines to reduce power - consumption (see e.g http://softwarecommunity.intel.com/articles/eng/2004.htm) - - Running benchmarks for spinlocks implemented with InterlockedCompareExchange - and YieldProcessor shows that much better performance is achieved by calling - YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting - loop count in the range 200-300 brought best results. -*/ - -static inline int LF_BACKOFF(void) -{ - unsigned i= my_cpu_relax_multiplier; - while (i--) - MY_RELAX_CPU(); - return 1; -} - -/** - Run a delay loop while waiting for a shared resource to be released. - @param delay originally, roughly microseconds on 100 MHz Intel Pentium -*/ -static inline void ut_delay(unsigned delay) -{ - unsigned i= my_cpu_relax_multiplier / 4 * delay; - HMT_low(); - while (i--) - MY_RELAX_CPU(); - HMT_medium(); -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_crypt.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_crypt.h deleted file mode 100644 index eced2cd..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_crypt.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright (c) 2014 Google Inc. - Copyright (c) 2014, 2015 MariaDB Corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MY_CRYPT_INCLUDED -#define MY_CRYPT_INCLUDED - -#include /* HAVE_EncryptAes128{Ctr,Gcm} */ -#include - -#endif /* MY_CRYPT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_decimal.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_decimal.h deleted file mode 100644 index 4c1f414..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_decimal.h +++ /dev/null @@ -1,538 +0,0 @@ -/* Copyright (c) 2005, 2013, Oracle and/or its affiliates. - Copyright (c) 2011, 2014, SkySQL Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - It is interface module to fixed precision decimals library. - - Most functions use 'uint mask' as parameter, if during operation error - which fit in this mask is detected then it will be processed automatically - here. (errors are E_DEC_* constants, see include/decimal.h) - - Most function are just inline wrappers around library calls -*/ - -#ifndef my_decimal_h -#define my_decimal_h - -#include "sql_basic_types.h" - -#if defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) -#include "sql_string.h" /* String */ -#endif - -C_MODE_START -#include -#include -C_MODE_END - -class String; -class Field; -typedef struct st_mysql_time MYSQL_TIME; - -/** - maximum size of packet length. -*/ -#define DECIMAL_MAX_FIELD_SIZE DECIMAL_MAX_PRECISION - - -inline uint my_decimal_size(uint precision, uint scale) -{ - /* - Always allocate more space to allow library to put decimal point - where it want - */ - return decimal_size(precision, scale) + 1; -} - - -inline int my_decimal_int_part(uint precision, uint decimals) -{ - return precision - ((decimals == DECIMAL_NOT_SPECIFIED) ? 0 : decimals); -} - - -#ifndef MYSQL_CLIENT -int decimal_operation_results(int result, const char *value, const char *type); -#else -inline int decimal_operation_results(int result, const char *value, - const char *type) -{ - return result; -} -#endif /*MYSQL_CLIENT*/ - - -inline int check_result(uint mask, int result) -{ - if (result & mask) - decimal_operation_results(result, "", "DECIMAL"); - return result; -} - - -/** - my_decimal class limits 'decimal_t' type to what we need in MySQL. - - It contains internally all necessary space needed by the instance so - no extra memory is needed. One should call fix_buffer_pointer() function - when he moves my_decimal objects in memory. -*/ - -class my_decimal :public decimal_t -{ - /* - Several of the routines in strings/decimal.c have had buffer - overrun/underrun problems. These are *not* caught by valgrind. - To catch them, we allocate dummy fields around the buffer, - and test that their values do not change. - */ -#if !defined(DBUG_OFF) - int foo1; -#endif - - decimal_digit_t buffer[DECIMAL_BUFF_LENGTH]; - -#if !defined(DBUG_OFF) - int foo2; - static const int test_value= 123; -#endif - -public: - - my_decimal(const my_decimal &rhs) : decimal_t(rhs) - { - init(); - for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++) - buffer[i]= rhs.buffer[i]; - } - - my_decimal& operator=(const my_decimal &rhs) - { - if (this == &rhs) - return *this; - decimal_t::operator=(rhs); - for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++) - buffer[i]= rhs.buffer[i]; - fix_buffer_pointer(); - return *this; - } - - void init() - { -#if !defined(DBUG_OFF) - foo1= test_value; - foo2= test_value; -#endif - len= DECIMAL_BUFF_LENGTH; - buf= buffer; - TRASH_ALLOC(buffer, sizeof(buffer)); - } - - my_decimal() - { - init(); - } - my_decimal(const uchar *bin, int prec, int scale) - { - init(); - check_result(E_DEC_FATAL_ERROR, bin2decimal(bin, this, prec, scale)); - } - my_decimal(Field *field); - ~my_decimal() - { - sanity_check(); - } - - void sanity_check() - { - DBUG_SLOW_ASSERT(foo1 == test_value); - DBUG_SLOW_ASSERT(foo2 == test_value); - } - - void fix_buffer_pointer() { buf= buffer; } - - bool sign() const { return decimal_t::sign; } - void sign(bool s) { decimal_t::sign= s; } - uint precision() const { return intg + frac; } - void set_zero() - { - /* - We need the up-cast here, since my_decimal has sign() member functions, - which conflicts with decimal_t::sign - (and decimal_make_zero is a macro, rather than a funcion). - */ - decimal_make_zero(static_cast(this)); - } - int cmp(const my_decimal *other) const - { - return decimal_cmp(this, other); - } - -#ifndef MYSQL_CLIENT - bool to_bool() const - { - return !decimal_is_zero(this); - } - double to_double() const - { - double res; - decimal2double(this, &res); - return res; - } - longlong to_longlong(bool unsigned_flag) const; - /* - Return the value as a signed or unsigned longlong, depending on the sign. - - Positive values are returned as unsigned. - - Negative values are returned as signed. - This is used by bit SQL operators: | & ^ ~ - as well as by the SQL function BIT_COUNT(). - */ - longlong to_xlonglong() const - { return to_longlong(!sign()); } - - // Convert to string returning decimal2string() error code - int to_string_native(String *to, uint prec, uint dec, char filler, - uint mask= E_DEC_FATAL_ERROR) const; - // Convert to string returning the String pointer - String *to_string(String *to, uint prec, uint dec, char filler) const - { - return to_string_native(to, prec, dec, filler) ? NULL : to; - } - String *to_string(String *to) const - { - return to_string(to, 0, 0, 0); - } - String *to_string_round(String *to, int scale, my_decimal *round_buff) const - { - (void) round_to(round_buff, scale, HALF_UP); // QQ: check result? - return round_buff->to_string(to); - } - int round_to(my_decimal *to, int scale, decimal_round_mode mode, - int mask= E_DEC_FATAL_ERROR) const - { - return check_result(mask, decimal_round(this, to, scale, mode)); - } - int to_binary(uchar *bin, int prec, int scale, - uint mask= E_DEC_FATAL_ERROR) const; -#endif - /** Swap two my_decimal values */ - void swap(my_decimal &rhs) - { - swap_variables(my_decimal, *this, rhs); - } -}; - - -#ifndef DBUG_OFF -void print_decimal(const my_decimal *dec); -void print_decimal_buff(const my_decimal *dec, const uchar* ptr, int length); -const char *dbug_decimal_as_string(char *buff, const my_decimal *val); -#else -#define dbug_decimal_as_string(A) NULL -#endif - -bool str_set_decimal(uint mask, const my_decimal *val, uint fixed_prec, - uint fixed_dec, char filler, String *str, - CHARSET_INFO *cs); - -extern my_decimal decimal_zero; - -inline -void max_my_decimal(my_decimal *to, int precision, int frac) -{ - DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION)&& - (frac <= DECIMAL_MAX_SCALE)); - max_decimal(precision, frac, to); -} - -inline void max_internal_decimal(my_decimal *to) -{ - max_my_decimal(to, DECIMAL_MAX_PRECISION, 0); -} - -inline int check_result_and_overflow(uint mask, int result, my_decimal *val) -{ - if (check_result(mask, result) & E_DEC_OVERFLOW) - { - bool sign= val->sign(); - val->fix_buffer_pointer(); - max_internal_decimal(val); - val->sign(sign); - } - return result; -} - -inline uint my_decimal_length_to_precision(uint length, uint scale, - bool unsigned_flag) -{ - /* Precision can't be negative thus ignore unsigned_flag when length is 0. */ - DBUG_ASSERT(length || !scale); - return (uint) (length - (scale>0 ? 1:0) - - (unsigned_flag || !length ? 0:1)); -} - -inline uint32 my_decimal_precision_to_length_no_truncation(uint precision, - uint8 scale, - bool unsigned_flag) -{ - /* - When precision is 0 it means that original length was also 0. Thus - unsigned_flag is ignored in this case. - */ - DBUG_ASSERT(precision || !scale); - return (uint32)(precision + (scale > 0 ? 1 : 0) + - (unsigned_flag || !precision ? 0 : 1)); -} - -inline uint32 my_decimal_precision_to_length(uint precision, uint8 scale, - bool unsigned_flag) -{ - /* - When precision is 0 it means that original length was also 0. Thus - unsigned_flag is ignored in this case. - */ - DBUG_ASSERT(precision || !scale); - set_if_smaller(precision, DECIMAL_MAX_PRECISION); - return my_decimal_precision_to_length_no_truncation(precision, scale, - unsigned_flag); -} - -inline -int my_decimal_string_length(const my_decimal *d) -{ - /* length of string representation including terminating '\0' */ - return decimal_string_size(d); -} - - -inline -int my_decimal_max_length(const my_decimal *d) -{ - /* -1 because we do not count \0 */ - return decimal_string_size(d) - 1; -} - - -inline -int my_decimal_get_binary_size(uint precision, uint scale) -{ - return decimal_bin_size((int)precision, (int)scale); -} - - -inline -void my_decimal2decimal(const my_decimal *from, my_decimal *to) -{ - *to= *from; -} - - -inline -int binary2my_decimal(uint mask, const uchar *bin, my_decimal *d, int prec, - int scale) -{ - return check_result(mask, bin2decimal(bin, d, prec, scale)); -} - - -inline -int my_decimal_set_zero(my_decimal *d) -{ - d->set_zero(); - return 0; -} - - -inline -bool my_decimal_is_zero(const my_decimal *decimal_value) -{ - return decimal_is_zero(decimal_value); -} - - -inline bool str_set_decimal(const my_decimal *val, String *str, - CHARSET_INFO *cs) -{ - return str_set_decimal(E_DEC_FATAL_ERROR, val, 0, 0, 0, str, cs); -} - - -bool my_decimal2seconds(const my_decimal *d, ulonglong *sec, - ulong *microsec, ulong *nanosec); - -my_decimal *seconds2my_decimal(bool sign, ulonglong sec, ulong microsec, - my_decimal *d); - -#define TIME_to_my_decimal(TIME, DECIMAL) \ - seconds2my_decimal((TIME)->neg, TIME_to_ulonglong(TIME), \ - (TIME)->second_part, (DECIMAL)) - -int my_decimal2int(uint mask, const decimal_t *d, bool unsigned_flag, - longlong *l, decimal_round_mode round_type= HALF_UP); - -inline -int my_decimal2double(uint, const decimal_t *d, double *result) -{ - /* No need to call check_result as this will always succeed */ - return decimal2double(d, result); -} - - -inline -int str2my_decimal(uint mask, const char *str, my_decimal *d, char **end) -{ - return check_result_and_overflow(mask, string2decimal(str, d, end), d); -} - - -int str2my_decimal(uint mask, const char *from, size_t length, - CHARSET_INFO *charset, my_decimal *decimal_value, - const char **end); - -inline int str2my_decimal(uint mask, const char *from, size_t length, - CHARSET_INFO *charset, my_decimal *decimal_value) -{ - const char *end; - return str2my_decimal(mask, from, length, charset, decimal_value, &end); -} - -#if defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) -inline -int string2my_decimal(uint mask, const String *str, my_decimal *d) -{ - const char *end; - return str2my_decimal(mask, str->ptr(), str->length(), str->charset(), - d, &end); -} - - -my_decimal *date2my_decimal(const MYSQL_TIME *ltime, my_decimal *dec); - - -#endif /*defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) */ - -inline -int double2my_decimal(uint mask, double val, my_decimal *d) -{ - return check_result_and_overflow(mask, double2decimal(val, d), d); -} - - -inline -int int2my_decimal(uint mask, longlong i, my_bool unsigned_flag, my_decimal *d) -{ - return check_result(mask, (unsigned_flag ? - ulonglong2decimal((ulonglong)i, d) : - longlong2decimal(i, d))); -} - -inline -void decimal2my_decimal(decimal_t *from, my_decimal *to) -{ - DBUG_ASSERT(to->len >= from->len); - to->intg= from->intg; - to->frac= from->frac; - to->sign(from->sign); - memcpy(to->buf, from->buf, to->len*sizeof(decimal_digit_t)); -} - - -inline -void my_decimal_neg(decimal_t *arg) -{ - if (decimal_is_zero(arg)) - { - arg->sign= 0; - return; - } - decimal_neg(arg); -} - - -inline -int my_decimal_add(uint mask, my_decimal *res, const my_decimal *a, - const my_decimal *b) -{ - return check_result_and_overflow(mask, - decimal_add(a, b, res), - res); -} - - -inline -int my_decimal_sub(uint mask, my_decimal *res, const my_decimal *a, - const my_decimal *b) -{ - return check_result_and_overflow(mask, - decimal_sub(a, b, res), - res); -} - - -inline -int my_decimal_mul(uint mask, my_decimal *res, const my_decimal *a, - const my_decimal *b) -{ - return check_result_and_overflow(mask, - decimal_mul(a, b, res), - res); -} - - -inline -int my_decimal_div(uint mask, my_decimal *res, const my_decimal *a, - const my_decimal *b, int div_scale_inc) -{ - return check_result_and_overflow(mask, - decimal_div(a, b, res, div_scale_inc), - res); -} - - -inline -int my_decimal_mod(uint mask, my_decimal *res, const my_decimal *a, - const my_decimal *b) -{ - return check_result_and_overflow(mask, - decimal_mod(a, b, res), - res); -} - -/** - @return - -1 if ab and 0 if a==b -*/ -inline -int my_decimal_cmp(const my_decimal *a, const my_decimal *b) -{ - return decimal_cmp(a, b); -} - - -inline -int my_decimal_intg(const my_decimal *a) -{ - return decimal_intg(a); -} - - -void my_decimal_trim(ulonglong *precision, uint *scale); - - -#endif /*my_decimal_h*/ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_default.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_default.h deleted file mode 100644 index 0f158bb..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_default.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 2013 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Definitions for mysys/my_default.c */ - -#ifndef MY_DEFAULT_INCLUDED -#define MY_DEFAULT_INCLUDED - -C_MODE_START - -extern MYSQL_PLUGIN_IMPORT const char *my_defaults_extra_file; -extern const char *my_defaults_group_suffix; -extern MYSQL_PLUGIN_IMPORT const char *my_defaults_file; -extern my_bool my_defaults_mark_files; - -extern int get_defaults_options(char **argv); -extern int my_load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv, const char ***); -extern int load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv); -extern void free_defaults(char **argv); -extern void my_print_default_files(const char *conf_file); -extern void print_defaults(const char *conf_file, const char **groups); - - -/** Simplify load_defaults() common use */ -#define load_defaults_or_exit(A, B, C, D) switch (load_defaults(A, B, C, D)) { \ - case 0: break; \ - case 4: my_end(0); exit(0); \ - default: my_end(0); exit(1); } - -C_MODE_END - -#endif /* MY_DEFAULT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_handler_errors.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_handler_errors.h deleted file mode 100644 index faf7b9f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_handler_errors.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef MYSYS_MY_HANDLER_ERRORS_INCLUDED -#define MYSYS_MY_HANDLER_ERRORS_INCLUDED - -/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. - Copyright (c) 2011, 2013, SkySQL Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Errors a handler can give you -*/ - -static const char *handler_error_messages[]= -{ - /* 120 */ - "Didn't find the key on read or update", - "Duplicate key on write or update", - "Internal (unspecified) error in handler", - "Someone has changed the row since it was read (even though the table was locked to prevent it)", - "Wrong index given to a function", - "Undefined handler error 125", - "Index is corrupted", - "Table file is corrupted", - "Out of memory in engine", - "Undefined handler error 129", - /* 130 */ - "Incorrect file format", - "Command not supported by the engine", - "Old database file", - "No record read before update", - "Record was already deleted (or record file crashed)", - "No more room in record file", - "No more room in index file", - "No more records (read after end of file)", - "Unsupported extension used for table", - "Too big row", - /* 140 */ - "Wrong create options", - "Duplicate unique key on write or update", - "Unknown character set used in table", - "Conflicting table definitions in sub-tables of MERGE table", - "Table is crashed and last repair failed", - "Table was marked as crashed and should be repaired", - "Lock timed out; Retry transaction", - "Lock table is full; Restart program with a larger lock table", - "Updates are not allowed under a read only transactions", - "Lock deadlock; Retry transaction", - /* 150 */ - "Foreign key constraint is incorrectly formed", - "Cannot add a child row", - "Cannot delete a parent row", - "No savepoint with that name", - "Non unique key block size", - "The table does not exist in the storage engine", - "The table already existed in the storage engine", - "Could not connect to the storage engine", - "Unexpected null pointer found when using spatial index", - "The table changed in the storage engine", - /* 160 */ - "There's no partition in the table for the given value", - "Row-based binary logging of row failed", - "Index needed in foreign key constraint", - "Upholding foreign key constraints would lead to a duplicate key error in some other table", - "Table needs to be upgraded before it can be used", - "Table is read only", - "Failed to get next auto increment value", - "Failed to set row auto increment value", - "Unknown (generic) error from engine", - "Record was not updated. New values were the same as original values", - /* 170 */ - "It is not possible to log this statement", - "The event was corrupt, leading to illegal data being read", - "The table is of a new format not supported by this version", - "The event could not be processed. No other handler error happened", - "Fatal error during initialization of handler", - "File too short; Expected more data in file", - "Read page with wrong checksum", - "Too many active concurrent transactions", - "Record not matching the given partition set", - "Index column length exceeds limit", - /* 180 */ - "Index corrupted", - "Undo record too big", - "Invalid InnoDB FTS Doc ID", - "Table is being used in foreign key check", - "Tablespace already exists", - "Too many columns", - "Row in wrong partition", - "Row is not visible by the current transaction", - "Operation was interrupted by end user (probably kill command?)", - "Disk full", - /* 190 */ - "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry or dump and restore the table to fix this", - "Too many words in a FTS phrase or proximity search", - "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.", - "Foreign key cascade delete/update exceeds max depth", - "Tablespace is missing for a table", - "Sequence has been run out", - "Sequence values are conflicting" -}; - -#endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_json_writer.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_json_writer.h deleted file mode 100644 index bc8002d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_json_writer.h +++ /dev/null @@ -1,692 +0,0 @@ -/* Copyright (C) 2014 SkySQL Ab, MariaDB Corporation Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef JSON_WRITER_INCLUDED -#define JSON_WRITER_INCLUDED -#include "my_base.h" -#include "sql_select.h" -class Opt_trace_stmt; -class Opt_trace_context; -class Json_writer; -struct TABLE_LIST; - - -/* - Single_line_formatting_helper is used by Json_writer to do better formatting - of JSON documents. - - The idea is to catch arrays that can be printed on one line: - - arrayName : [ "boo", 123, 456 ] - - and actually print them on one line. Arrrays that occupy too much space on - the line, or have nested members cannot be printed on one line. - - We hook into JSON printing functions and try to detect the pattern. While - detecting the pattern, we will accumulate "boo", 123, 456 as strings. - - Then, - - either the pattern is broken, and we print the elements out, - - or the pattern lasts till the end of the array, and we print the - array on one line. -*/ - -class Single_line_formatting_helper -{ - enum enum_state - { - INACTIVE, - ADD_MEMBER, - IN_ARRAY, - DISABLED - }; - - /* - This works like a finite automaton. - - state=DISABLED means the helper is disabled - all on_XXX functions will - return false (which means "not handled") and do nothing. - - +->-+ - | v - INACTIVE ---> ADD_MEMBER ---> IN_ARRAY--->-+ - ^ | - +------------------<--------------------+ - - For other states: - INACTIVE - initial state, we have nothing. - ADD_MEMBER - add_member() was called, the buffer has "member_name\0". - IN_ARRAY - start_array() was called. - - - */ - enum enum_state state; - enum { MAX_LINE_LEN= 80 }; - char buffer[80]; - - /* The data in the buffer is located between buffer[0] and buf_ptr */ - char *buf_ptr; - uint line_len; - - Json_writer *owner; -public: - Single_line_formatting_helper() : state(INACTIVE), buf_ptr(buffer) {} - - void init(Json_writer *owner_arg) { owner= owner_arg; } - - bool on_add_member(const char *name, size_t len); - - bool on_start_array(); - bool on_end_array(); - void on_start_object(); - // on_end_object() is not needed. - - bool on_add_str(const char *str, size_t num_bytes); - - void flush_on_one_line(); - void disable_and_flush(); -}; - - -/* - Something that looks like class String, but has an internal limit of - how many bytes one can append to it. - - Bytes that were truncated due to the size limitation are counted. -*/ - -class String_with_limit -{ -public: - - String_with_limit() : size_limit(SIZE_T_MAX), truncated_len(0) - { - str.length(0); - } - - size_t get_truncated_bytes() const { return truncated_len; } - size_t get_size_limit() { return size_limit; } - - void set_size_limit(size_t limit_arg) - { - // Setting size limit to be shorter than length will not have the desired - // effect - DBUG_ASSERT(str.length() < size_limit); - size_limit= limit_arg; - } - - void append(const char *s, size_t size) - { - if (str.length() + size <= size_limit) - { - // Whole string can be added, just do it - str.append(s, size); - } - else - { - // We cannot add the whole string - if (str.length() < size_limit) - { - // But we can still add something - size_t bytes_to_add = size_limit - str.length(); - str.append(s, bytes_to_add); - truncated_len += size - bytes_to_add; - } - else - truncated_len += size; - } - } - - void append(const char *s) - { - append(s, strlen(s)); - } - - void append(char c) - { - if (str.length() + 1 > size_limit) - truncated_len++; - else - str.append(c); - } - - const String *get_string() { return &str; } - size_t length() { return str.length(); } -private: - String str; - - // str must not get longer than this many bytes. - size_t size_limit; - - // How many bytes were truncated from the string - size_t truncated_len; -}; - -/* - A class to write well-formed JSON documents. The documents are also formatted - for human readability. -*/ - -class Json_writer -{ -public: - /* Add a member. We must be in an object. */ - Json_writer& add_member(const char *name); - Json_writer& add_member(const char *name, size_t len); - - /* Add atomic values */ - void add_str(const char* val); - void add_str(const char* val, size_t num_bytes); - void add_str(const String &str); - void add_str(Item *item); - void add_table_name(const JOIN_TAB *tab); - void add_table_name(const TABLE* table); - - void add_ll(longlong val); - void add_ull(ulonglong val); - void add_size(longlong val); - void add_double(double val); - void add_bool(bool val); - void add_null(); - -private: - void add_unquoted_str(const char* val); - void add_unquoted_str(const char* val, size_t len); -public: - /* Start a child object */ - void start_object(); - void start_array(); - - void end_object(); - void end_array(); - - /* - One can set a limit of how large a JSON document should be. - Writes beyond that size will be counted, but will not be collected. - */ - void set_size_limit(size_t mem_size) { output.set_size_limit(mem_size); } - - size_t get_truncated_bytes() { return output.get_truncated_bytes(); } - - Json_writer() : - indent_level(0), document_start(true), element_started(false), - first_child(true) - { - fmt_helper.init(this); - } -private: - // TODO: a stack of (name, bool is_object_or_array) elements. - int indent_level; - enum { INDENT_SIZE = 2 }; - - friend class Single_line_formatting_helper; - friend class Json_writer_nesting_guard; - bool document_start; - bool element_started; - bool first_child; - - Single_line_formatting_helper fmt_helper; - - void append_indent(); - void start_element(); - void start_sub_element(); - -public: - String_with_limit output; -}; - -/* A class to add values to Json_writer_object and Json_writer_array */ -class Json_value_helper -{ - Json_writer* writer; - -public: - void init(Json_writer *my_writer) { writer= my_writer; } - void add_str(const char* val) - { - writer->add_str(val); - } - void add_str(const char* val, size_t length) - { - writer->add_str(val, length); - } - void add_str(const String &str) - { - writer->add_str(str.ptr(), str.length()); - } - void add_str(const LEX_CSTRING &str) - { - writer->add_str(str.str, str.length); - } - void add_str(Item *item) - { - writer->add_str(item); - } - - void add_ll(longlong val) - { - writer->add_ll(val); - } - void add_size(longlong val) - { - writer->add_size(val); - } - void add_double(double val) - { - writer->add_double(val); - } - void add_bool(bool val) - { - writer->add_bool(val); - } - void add_null() - { - writer->add_null(); - } - void add_table_name(const JOIN_TAB *tab) - { - writer->add_table_name(tab); - } - void add_table_name(const TABLE* table) - { - writer->add_table_name(table); - } -}; - -/* A common base for Json_writer_object and Json_writer_array */ -class Json_writer_struct -{ -protected: - Json_writer* my_writer; - Json_value_helper context; - /* - Tells when a json_writer_struct has been closed or not - */ - bool closed; - -public: - explicit Json_writer_struct(THD *thd) - { - my_writer= thd->opt_trace.get_current_json(); - context.init(my_writer); - closed= false; - } - bool trace_started() - { - return my_writer != 0; - } -}; - - -/* - RAII-based class to start/end writing a JSON object into the JSON document - - There is "ignore mode": one can initialize Json_writer_object with a NULL - Json_writer argument, and then all its calls will do nothing. This is used - by optimizer trace which can be enabled or disabled. -*/ - -class Json_writer_object : public Json_writer_struct -{ -private: - void add_member(const char *name) - { - my_writer->add_member(name); - } -public: - explicit Json_writer_object(THD *thd) - : Json_writer_struct(thd) - { - if (unlikely(my_writer)) - my_writer->start_object(); - } - - explicit Json_writer_object(THD* thd, const char *str) - : Json_writer_struct(thd) - { - if (unlikely(my_writer)) - my_writer->add_member(str).start_object(); - } - - ~Json_writer_object() - { - if (my_writer && !closed) - my_writer->end_object(); - closed= TRUE; - } - - Json_writer_object& add(const char *name, bool value) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member(name); - context.add_bool(value); - } - return *this; - } - Json_writer_object& add(const char *name, ulonglong value) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member(name); - context.add_ll(static_cast(value)); - } - return *this; - } - Json_writer_object& add(const char *name, longlong value) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member(name); - context.add_ll(value); - } - return *this; - } - Json_writer_object& add(const char *name, double value) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member(name); - context.add_double(value); - } - return *this; - } - #ifndef _WIN64 - Json_writer_object& add(const char *name, size_t value) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member(name); - context.add_ll(static_cast(value)); - } - return *this; - } - #endif - Json_writer_object& add(const char *name, const char *value) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member(name); - context.add_str(value); - } - return *this; - } - Json_writer_object& add(const char *name, const char *value, size_t num_bytes) - { - add_member(name); - context.add_str(value, num_bytes); - return *this; - } - Json_writer_object& add(const char *name, const LEX_CSTRING &value) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member(name); - context.add_str(value.str, value.length); - } - return *this; - } - Json_writer_object& add(const char *name, Item *value) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member(name); - context.add_str(value); - } - return *this; - } - Json_writer_object& add_null(const char*name) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member(name); - context.add_null(); - } - return *this; - } - Json_writer_object& add_table_name(const JOIN_TAB *tab) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member("table"); - context.add_table_name(tab); - } - return *this; - } - Json_writer_object& add_table_name(const TABLE *table) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member("table"); - context.add_table_name(table); - } - return *this; - } - Json_writer_object& add_select_number(uint select_number) - { - DBUG_ASSERT(!closed); - if (my_writer) - { - add_member("select_id"); - if (unlikely(select_number >= INT_MAX)) - context.add_str("fake"); - else - context.add_ll(static_cast(select_number)); - } - return *this; - } - void end() - { - DBUG_ASSERT(!closed); - if (unlikely(my_writer)) - my_writer->end_object(); - closed= TRUE; - } -}; - - -/* - RAII-based class to start/end writing a JSON array into the JSON document - - There is "ignore mode": one can initialize Json_writer_array with a NULL - Json_writer argument, and then all its calls will do nothing. This is used - by optimizer trace which can be enabled or disabled. -*/ - -class Json_writer_array : public Json_writer_struct -{ -public: - Json_writer_array(THD *thd): Json_writer_struct(thd) - { - if (unlikely(my_writer)) - my_writer->start_array(); - } - - Json_writer_array(THD *thd, const char *str) : Json_writer_struct(thd) - { - if (unlikely(my_writer)) - my_writer->add_member(str).start_array(); - } - ~Json_writer_array() - { - if (unlikely(my_writer && !closed)) - { - my_writer->end_array(); - closed= TRUE; - } - } - void end() - { - DBUG_ASSERT(!closed); - if (unlikely(my_writer)) - my_writer->end_array(); - closed= TRUE; - } - - Json_writer_array& add(bool value) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_bool(value); - return *this; - } - Json_writer_array& add(ulonglong value) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_ll(static_cast(value)); - return *this; - } - Json_writer_array& add(longlong value) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_ll(value); - return *this; - } - Json_writer_array& add(double value) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_double(value); - return *this; - } - #ifndef _WIN64 - Json_writer_array& add(size_t value) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_ll(static_cast(value)); - return *this; - } - #endif - Json_writer_array& add(const char *value) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_str(value); - return *this; - } - Json_writer_array& add(const char *value, size_t num_bytes) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_str(value, num_bytes); - return *this; - } - Json_writer_array& add(const LEX_CSTRING &value) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_str(value.str, value.length); - return *this; - } - Json_writer_array& add(Item *value) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_str(value); - return *this; - } - Json_writer_array& add_null() - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_null(); - return *this; - } - Json_writer_array& add_table_name(const JOIN_TAB *tab) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_table_name(tab); - return *this; - } - Json_writer_array& add_table_name(const TABLE *table) - { - DBUG_ASSERT(!closed); - if (my_writer) - context.add_table_name(table); - return *this; - } -}; - -/* - RAII-based class to disable writing into the JSON document - The tracing is disabled as soon as the object is created. - The destuctor is called as soon as we exit the scope of the object - and the tracing is enabled back. -*/ - -class Json_writer_temp_disable -{ -public: - Json_writer_temp_disable(THD *thd_arg); - ~Json_writer_temp_disable(); - THD *thd; -}; - -/* - RAII-based helper class to detect incorrect use of Json_writer. - - The idea is that a function typically must leave Json_writer at the same - identation level as it was when it was invoked. Leaving it at a different - level typically means we forgot to close an object or an array - - So, here is a way to guard - void foo(Json_writer *writer) - { - Json_writer_nesting_guard(writer); - .. do something with writer - - // at the end of the function, ~Json_writer_nesting_guard() is called - // and it makes sure that the nesting is the same as when the function was - // entered. - } -*/ - -class Json_writer_nesting_guard -{ -#ifdef DBUG_OFF -public: - Json_writer_nesting_guard(Json_writer *) {} -#else - Json_writer* writer; - int indent_level; -public: - Json_writer_nesting_guard(Json_writer *writer_arg) : - writer(writer_arg), - indent_level(writer->indent_level) - {} - - ~Json_writer_nesting_guard() - { - DBUG_ASSERT(indent_level == writer->indent_level); - } -#endif -}; - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_libwrap.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_libwrap.h deleted file mode 100644 index b520080..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_libwrap.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef MY_LIBWRAP_INCLUDED -#define MY_LIBWRAP_INCLUDED - -/* Copyright (c) 2000, 2006 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef HAVE_LIBWRAP -#include -#include -#ifdef NEED_SYS_SYSLOG_H -#include -#endif /* NEED_SYS_SYSLOG_H */ - -extern void my_fromhost(struct request_info *req); -extern int my_hosts_access(struct request_info *req); -extern char *my_eval_client(struct request_info *req); - -#endif /* HAVE_LIBWRAP */ -#endif /* MY_LIBWRAP_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_md5.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_md5.h deleted file mode 100644 index c3919bf..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_md5.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef MY_MD5_INCLUDED -#define MY_MD5_INCLUDED - -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2013 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "m_string.h" - -#define MD5_HASH_SIZE 16 /* Hash size in bytes */ - -/* - Wrapper function for MD5 implementation. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -#define compute_md5_hash(A,B,C) my_md5(A,B,C) - -/* - Convert an array of bytes to a hexadecimal representation. - - Used to generate a hexadecimal representation of a message digest. -*/ -static inline void array_to_hex(char *to, const unsigned char *str, uint len) -{ - const unsigned char *str_end= str + len; - for (; str != str_end; ++str) - { - *to++= _dig_vec_lower[((uchar) *str) >> 4]; - *to++= _dig_vec_lower[((uchar) *str) & 0x0F]; - } -} - -#ifdef __cplusplus -} -#endif - -#endif /* MY_MD5_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_nosys.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_nosys.h deleted file mode 100644 index ff13a04..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_nosys.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Header to remove use of my_functions in functions where we need speed and - where calls to posix functions should work -*/ -#ifndef _my_nosys_h -#define _my_nosys_h -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MY_NOSYS__ -#define __MY_NOSYS__ - -#ifndef HAVE_STDLIB_H -#include -#endif - -#undef my_read -#undef my_write -#undef my_seek -#define my_read(a,b,c,d) my_quick_read(a,b,c,d) -#define my_write(a,b,c,d) my_quick_write(a,b,c) -extern size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count, - myf myFlags); -extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count); - -#endif /* __MY_NOSYS__ */ - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_rdtsc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_rdtsc.h deleted file mode 100644 index 33d7227..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_rdtsc.h +++ /dev/null @@ -1,236 +0,0 @@ -/* Copyright (c) 2008 MySQL AB, 2009 Sun Microsystems, Inc. - Copyright (c) 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - rdtsc3 -- multi-platform timer code - pgulutzan@mysql.com, 2005-08-29 - modified 2008-11-02 -*/ - -#ifndef MY_RDTSC_H -#define MY_RDTSC_H - -# ifndef __has_builtin -# define __has_builtin(x) 0 /* Compatibility with non-clang compilers */ -# endif -# if __has_builtin(__builtin_readcyclecounter) -# elif defined _WIN32 -# include -# elif defined __i386__ || defined __x86_64__ -# include -# elif defined(__INTEL_COMPILER) && defined(__ia64__) && defined(HAVE_IA64INTRIN_H) -# include -# elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME) -# include -# endif - -/** - Characteristics of a timer. -*/ -struct my_timer_unit_info -{ - /** Routine used for the timer. */ - ulonglong routine; - /** Overhead of the timer. */ - ulonglong overhead; - /** Frequency of the timer. */ - ulonglong frequency; - /** Resolution of the timer. */ - ulonglong resolution; -}; - -/** - Characteristics of all the supported timers. - @sa my_timer_init(). -*/ -struct my_timer_info -{ - /** Characteristics of the cycle timer. */ - struct my_timer_unit_info cycles; - /** Characteristics of the nanosecond timer. */ - struct my_timer_unit_info nanoseconds; - /** Characteristics of the microsecond timer. */ - struct my_timer_unit_info microseconds; - /** Characteristics of the millisecond timer. */ - struct my_timer_unit_info milliseconds; - /** Characteristics of the tick timer. */ - struct my_timer_unit_info ticks; -}; - -typedef struct my_timer_info MY_TIMER_INFO; - -C_MODE_START - -/** - A cycle timer. - - On clang we use __builtin_readcyclecounter(), except for AARCH64. - On other compilers: - - On IA-32 and AMD64, we use the RDTSC instruction. - On IA-64, we read the ar.itc register. - On SPARC, we read the tick register. - On POWER, we read the Time Base Register (which is not really a cycle count - but a separate counter with less than nanosecond resolution). - On IBM S/390 System z we use the STCK instruction. - On ARM, we probably should use the Generic Timer, but should figure out - how to ensure that it can be accessed. - On AARCH64, we use the generic timer base register. We override clang - implementation for aarch64 as it access a PMU register which is not - guarenteed to be active. - - Sadly, we have nothing for the Digital Alpha, MIPS, Motorola m68k, - HP PA-RISC or other non-mainstream (or obsolete) processors. - - TODO: consider C++11 std::chrono::high_resolution_clock. - - We fall back to gethrtime() where available. - - On the platforms that do not have a CYCLE timer, - "wait" events are initialized to use NANOSECOND instead of CYCLE - during performance_schema initialization (at the server startup). - - Linux performance monitor (see "man perf_event_open") can - provide cycle counter on the platforms that do not have - other kinds of cycle counters. But we don't use it so far. - - ARM notes - --------- - During tests on ARMv7 Debian, perf_even_open() based cycle counter provided - too low frequency with too high overhead: - MariaDB [performance_schema]> SELECT * FROM performance_timers; - +-------------+-----------------+------------------+----------------+ - | TIMER_NAME | TIMER_FREQUENCY | TIMER_RESOLUTION | TIMER_OVERHEAD | - +-------------+-----------------+------------------+----------------+ - | CYCLE | 689368159 | 1 | 970 | - | NANOSECOND | 1000000000 | 1 | 308 | - | MICROSECOND | 1000000 | 1 | 417 | - | MILLISECOND | 1000 | 1000 | 407 | - | TICK | 127 | 1 | 612 | - +-------------+-----------------+------------------+----------------+ - Therefore, it was decided not to use perf_even_open() on ARM - (i.e. go without CYCLE and have "wait" events use NANOSECOND by default). - - @return the current timer value, in cycles. -*/ -static inline ulonglong my_timer_cycles(void) -{ -# if __has_builtin(__builtin_readcyclecounter) && !defined (__aarch64__) - return __builtin_readcyclecounter(); -# elif defined _WIN32 || defined __i386__ || defined __x86_64__ - return __rdtsc(); -# elif defined(__INTEL_COMPILER) && defined(__ia64__) && defined(HAVE_IA64INTRIN_H) - return (ulonglong) __getReg(_IA64_REG_AR_ITC); /* (3116) */ -#elif defined(__GNUC__) && defined(__ia64__) - { - ulonglong result; - __asm __volatile__ ("mov %0=ar.itc" : "=r" (result)); - return result; - } -#elif defined __GNUC__ && defined __powerpc__ - return __builtin_ppc_get_timebase(); -#elif defined(__GNUC__) && defined(__sparcv9) && defined(_LP64) - { - ulonglong result; - __asm __volatile__ ("rd %%tick,%0" : "=r" (result)); - return result; - } -#elif defined(__GNUC__) && defined(__sparc__) && !defined(_LP64) - { - union { - ulonglong wholeresult; - struct { - ulong high; - ulong low; - } splitresult; - } result; - __asm __volatile__ ("rd %%tick,%1; srlx %1,32,%0" : "=r" (result.splitresult.high), "=r" (result.splitresult.low)); - return result.wholeresult; - } -#elif defined(__GNUC__) && defined(__s390__) - /* covers both s390 and s390x */ - { - ulonglong result; - __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc"); - return result; - } -#elif defined(__GNUC__) && defined (__aarch64__) - { - ulonglong result; - __asm __volatile("mrs %0, CNTVCT_EL0" : "=&r" (result)); - return result; - } -#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME) - /* gethrtime may appear as either cycle or nanosecond counter */ - return (ulonglong) gethrtime(); -#else - return 0; -#endif -} - -/** - A nanosecond timer. - @return the current timer value, in nanoseconds. -*/ -ulonglong my_timer_nanoseconds(void); - -/** - A microseconds timer. - @return the current timer value, in microseconds. -*/ -ulonglong my_timer_microseconds(void); - -/** - A millisecond timer. - @return the current timer value, in milliseconds. -*/ -ulonglong my_timer_milliseconds(void); - -/** - A ticks timer. - @return the current timer value, in ticks. -*/ -ulonglong my_timer_ticks(void); - -/** - Timer initialization function. - @param [out] mti the timer characteristics. -*/ -void my_timer_init(MY_TIMER_INFO *mti); - -C_MODE_END - -#define MY_TIMER_ROUTINE_RDTSC 5 -#define MY_TIMER_ROUTINE_ASM_IA64 6 -#define MY_TIMER_ROUTINE_PPC_GET_TIMEBASE 7 -#define MY_TIMER_ROUTINE_GETHRTIME 9 -#define MY_TIMER_ROUTINE_READ_REAL_TIME 10 -#define MY_TIMER_ROUTINE_CLOCK_GETTIME 11 -#define MY_TIMER_ROUTINE_GETTIMEOFDAY 13 -#define MY_TIMER_ROUTINE_QUERYPERFORMANCECOUNTER 14 -#define MY_TIMER_ROUTINE_GETTICKCOUNT 15 -#define MY_TIMER_ROUTINE_TIME 16 -#define MY_TIMER_ROUTINE_TIMES 17 -#define MY_TIMER_ROUTINE_FTIME 18 -#define MY_TIMER_ROUTINE_ASM_GCC_SPARC64 23 -#define MY_TIMER_ROUTINE_ASM_GCC_SPARC32 24 -#define MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME 25 -#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26 -#define MY_TIMER_ROUTINE_ASM_S390 28 -#define MY_TIMER_ROUTINE_AARCH64 29 - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_rnd.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_rnd.h deleted file mode 100644 index a3e3788..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_rnd.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2013 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 or later of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_rnd_h -#define _my_rnd_h - -C_MODE_START - -struct my_rnd_struct { - unsigned long seed1,seed2,max_value; - double max_value_dbl; -}; - -void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2); -double my_rnd(struct my_rnd_struct *rand_st); -double my_rnd_ssl(struct my_rnd_struct *rand_st); - -C_MODE_END - -#endif /* _my_rnd_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_service_manager.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_service_manager.h deleted file mode 100644 index 95b5235..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_service_manager.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (c) 2015 Daniel Black. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA -*/ - - -#ifndef MY_SERVICE_MANAGER_INCLUDED -#define MY_SERVICE_MANAGER_INCLUDED - -#if defined(HAVE_SYSTEMD) && !defined(EMBEDDED_LIBRARY) -/* - sd-daemon.h may include inttypes.h. Explicitly request format macros before - the first inclusion of inttypes.h. -*/ -#if !defined(__STDC_FORMAT_MACROS) -#define __STDC_FORMAT_MACROS -#endif // !defined(__STDC_FORMAT_MACROS) -#include -/** INTERVAL in seconds followed by printf style status */ -#define service_manager_extend_timeout(INTERVAL, FMTSTR, ...) \ - sd_notifyf(0, "STATUS=" FMTSTR "\nEXTEND_TIMEOUT_USEC=%u\n", ##__VA_ARGS__, INTERVAL * 1000000) - -#else -#define sd_notify(X, Y) -#define sd_notifyf(E, F, ...) -#define service_manager_extend_timeout(I, FMTSTR, ...) -#endif - -#endif /* MY_SERVICE_MANAGER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_stack_alloc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_stack_alloc.h deleted file mode 100644 index 95e746d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_stack_alloc.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2019 MariaDB corporation AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -#ifndef _my_stack_alloc_h -#define _my_stack_alloc_h - -/* - Do allocation through alloca if there is enough stack available. - If not, use my_malloc() instead. - - The idea is that to be able to alloc as much as possible through the - stack. To ensure this, we have two different limits, on for big - blocks and one for small blocks. This will enable us to continue to - do allocation for small blocks even when there is less stack space - available. - This is for example used by Aria when traversing the b-tree and the code - needs to allocate one b-tree page and a few keys for each recursion. Even - if there is not space to allocate the b-tree pages on stack we can still - continue to allocate the keys. -*/ - -/* - Default suggested allocations -*/ - -/* Allocate big blocks as long as there is this much left */ -#define STACK_ALLOC_BIG_BLOCK 1024*64 - -/* Allocate small blocks as long as there is this much left */ -#define STACK_ALLOC_SMALL_BLOCK 1024*32 - -/* Allocate small blocks as long as there is this much left */ -#define STACK_ALLOC_SMALL_BLOCK_SIZE 4096 - -/* - Allocate a block on stack or through malloc. - The 'must_be_freed' variable will be set to 1 if malloc was called. - 'must_be_freed' must be a variable on the stack! -*/ - -#ifdef HAVE_ALLOCA -#define alloc_on_stack(stack_end, res, must_be_freed, size) \ -do \ -{ \ - size_t alloc_size= (size); \ - size_t stack_left= available_stack_size(&alloc_size, (stack_end)); \ - if (stack_left > alloc_size && \ - (STACK_ALLOC_BIG_BLOCK < stack_left - alloc_size || \ - ((STACK_ALLOC_SMALL_BLOCK < stack_left - alloc_size) && \ - (STACK_ALLOC_SMALL_BLOCK_SIZE <= alloc_size)))) \ - { \ - (must_be_freed)= 0; \ - (res)= alloca(size); \ - } \ - else \ - { \ - (must_be_freed)= 1; \ - (res)= my_malloc(PSI_INSTRUMENT_ME, size, MYF(MY_THREAD_SPECIFIC | MY_WME)); \ - } \ -} while(0) -#else -#define alloc_on_stack(stack_end, res, must_be_freed, size) \ - do { \ - (must_be_freed)= 1; \ - (res)= my_malloc(PSI_INSTRUMENT_ME, size, MYF(MY_THREAD_SPECIFIC | MY_WME)); \ - } while(0) -#endif /* HAVE_ALLOCA */ - - -/* - Free memory allocated by stack_alloc -*/ - -static inline void stack_alloc_free(void *res, my_bool must_be_freed) -{ - if (must_be_freed) - my_free(res); -} -#endif /* _my_stack_alloc_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_stacktrace.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_stacktrace.h deleted file mode 100644 index 20b86f4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_stacktrace.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright (c) 2001, 2011, Oracle and/or its affiliates. - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _my_stacktrace_h_ -#define _my_stacktrace_h_ - -#ifdef TARGET_OS_LINUX -#if defined (__x86_64__) || defined (__i386__) || \ - (defined(__alpha__) && defined(__GNUC__)) -#define HAVE_STACKTRACE 1 -#endif -#elif defined(__WIN__) || defined(HAVE_PRINTSTACK) -#define HAVE_STACKTRACE 1 -#endif - -#if HAVE_BACKTRACE && (HAVE_BACKTRACE_SYMBOLS || HAVE_BACKTRACE_SYMBOLS_FD) -#undef HAVE_STACKTRACE -#define HAVE_STACKTRACE 1 -#endif - -#define HAVE_WRITE_CORE - -#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && HAVE_ABI_CXA_DEMANGLE && \ - HAVE_WEAK_SYMBOL -#define BACKTRACE_DEMANGLE 1 -#endif - -C_MODE_START - -#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE) -void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack, - my_bool silent); -int my_safe_print_str(const char* val, size_t max_len); -void my_write_core(int sig); -# if BACKTRACE_DEMANGLE -char *my_demangle(const char *mangled_name, int *status); -# endif /* BACKTRACE_DEMANGLE */ -# ifdef __WIN__ -# define my_setup_stacktrace() -void my_set_exception_pointers(EXCEPTION_POINTERS *ep); -# else -void my_setup_stacktrace(void); -# endif /* __WIN__ */ -#else -# define my_setup_stacktrace() -#endif /* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */ - -#ifndef _WIN32 -#define MY_ADDR_RESOLVE_FORK -#endif - -#if defined(HAVE_BFD_H) || defined(MY_ADDR_RESOLVE_FORK) -#define HAVE_MY_ADDR_RESOLVE 1 -#endif - -typedef struct { - const char *file; - const char *func; - uint line; -} my_addr_loc; - -#ifdef HAVE_MY_ADDR_RESOLVE -int my_addr_resolve(void *ptr, my_addr_loc *loc); -const char *my_addr_resolve_init(); -#else -#define my_addr_resolve_init() (0) -#define my_addr_resolve(A,B) (1) -#endif - -#ifdef HAVE_WRITE_CORE -void my_write_core(int sig); -#endif - -/** - A (very) limited version of snprintf, which writes the result to STDERR. - @sa my_safe_snprintf - Implemented with simplicity, and async-signal-safety in mind. - @note Has an internal buffer capacity of 512 bytes, - which should suffice for our signal handling routines. -*/ -size_t my_safe_printf_stderr(const char* fmt, ...) - ATTRIBUTE_FORMAT(printf, 1, 2); - -/** - Writes up to count bytes from buffer to STDERR. - Implemented with simplicity, and async-signal-safety in mind. - @param buf Buffer containing data to be written. - @param count Number of bytes to write. - @returns Number of bytes written. -*/ -size_t my_write_stderr(const void *buf, size_t count); - -C_MODE_END - -#endif /* _my_stacktrace_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_time.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_time.h deleted file mode 100644 index b7b54db..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_time.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - Copyright (c) 2004, 2011, Oracle and/or its affiliates. - Copyright (c) 2017, Monty Program Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - This is a private header of sql-common library, containing - declarations for my_time.c -*/ - -#ifndef _my_time_h_ -#define _my_time_h_ -#include "mysql_time.h" -#include "my_decimal_limits.h" - -C_MODE_START - -extern MYSQL_PLUGIN_IMPORT ulonglong log_10_int[20]; -extern uchar days_in_month[]; - -#define MY_TIME_T_MAX LONG_MAX -#define MY_TIME_T_MIN LONG_MIN - -/* Time handling defaults */ -#define TIMESTAMP_MAX_YEAR 2038 -#define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1) -#define TIMESTAMP_MAX_VALUE INT_MAX32 -#define TIMESTAMP_MIN_VALUE 0 - -/* two-digit years < this are 20..; >= this are 19.. */ -#define YY_PART_YEAR 70 - -/* - check for valid times only if the range of time_t is greater than - the range of my_time_t -*/ -#if SIZEOF_TIME_T > 4 || defined(TIME_T_UNSIGNED) -# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \ - ((x) <= TIMESTAMP_MAX_VALUE && \ - (x) >= TIMESTAMP_MIN_VALUE) -#else -# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \ - ((x) >= TIMESTAMP_MIN_VALUE) -#endif - -/* Flags to str_to_datetime */ - -#define C_TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */ -#define C_TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */ -#define C_TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */ - -#define MYSQL_TIME_WARN_TRUNCATED 1U -#define MYSQL_TIME_WARN_OUT_OF_RANGE 2U -#define MYSQL_TIME_WARN_EDOM 4U -#define MYSQL_TIME_WARN_ZERO_DATE 8U -#define MYSQL_TIME_NOTE_TRUNCATED 16U - -#define MYSQL_TIME_WARN_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|\ - MYSQL_TIME_WARN_OUT_OF_RANGE|\ - MYSQL_TIME_WARN_EDOM|\ - MYSQL_TIME_WARN_ZERO_DATE) -#define MYSQL_TIME_WARN_NOTES (MYSQL_TIME_NOTE_TRUNCATED) - -#define MYSQL_TIME_WARN_HAVE_WARNINGS(x) MY_TEST((x) & MYSQL_TIME_WARN_WARNINGS) -#define MYSQL_TIME_WARN_HAVE_NOTES(x) MY_TEST((x) & MYSQL_TIME_WARN_NOTES) - -/* Useful constants */ -#define SECONDS_IN_24H 86400L - -/* Limits for the INTERVAL data type */ - - /* Number of hours between '0001-01-01 00h' and '9999-12-31 23h' */ -#define TIME_MAX_INTERVAL_HOUR 87649415 -#define TIME_MAX_INTERVAL_HOUR_CHAR_LENGTH 8 - -/* Number of full days between '0001-01-01' and '9999-12-31'*/ -#define TIME_MAX_INTERVAL_DAY 3652058 /*87649415/24*/ -#define TIME_MAX_INTERVAL_DAY_CHAR_LENGTH 7 - -/* Limits for the TIME data type */ -#define TIME_MAX_HOUR 838 -#define TIME_MAX_MINUTE 59 -#define TIME_MAX_SECOND 59 -#define TIME_MAX_SECOND_PART 999999 -#define TIME_SECOND_PART_FACTOR (TIME_MAX_SECOND_PART+1) -#define TIME_SECOND_PART_DIGITS 6 -#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + TIME_MAX_SECOND) -#define TIME_MAX_VALUE_SECONDS (TIME_MAX_HOUR * 3600L + \ - TIME_MAX_MINUTE * 60L + TIME_MAX_SECOND) - -/* - Structure to return status from - str_to_datetime(), str_to_time(). -*/ -typedef struct st_mysql_time_status -{ - int warnings; - uint precision; - uint nanoseconds; -} MYSQL_TIME_STATUS; - -static inline void my_time_status_init(MYSQL_TIME_STATUS *status) -{ - status->warnings= 0; - status->precision= 0; - status->nanoseconds= 0; -} - -my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date, - ulonglong flags, int *was_cut); -my_bool str_to_DDhhmmssff(const char *str, size_t length, MYSQL_TIME *l_time, - ulong max_hour, MYSQL_TIME_STATUS *status); -my_bool str_to_datetime_or_date_or_time(const char *str, size_t length, - MYSQL_TIME *to, ulonglong flag, - MYSQL_TIME_STATUS *status, - ulong time_max_hour, - ulong time_err_hour); -my_bool -str_to_datetime_or_date_or_interval_hhmmssff(const char *str, size_t length, - MYSQL_TIME *to, ulonglong flag, - MYSQL_TIME_STATUS *status, - ulong time_max_hour, - ulong time_err_hour); -my_bool -str_to_datetime_or_date_or_interval_day(const char *str, size_t length, - MYSQL_TIME *to, ulonglong flag, - MYSQL_TIME_STATUS *status, - ulong time_max_hour, - ulong time_err_hour); -my_bool str_to_datetime_or_date(const char *str, size_t length, MYSQL_TIME *to, - ulonglong flags, MYSQL_TIME_STATUS *status); - -longlong number_to_datetime_or_date(longlong nr, ulong sec_part, - MYSQL_TIME *time_res, - ulonglong flags, int *was_cut); -int number_to_time_only(my_bool neg, ulonglong nr, ulong sec_part, - ulong max_hour, MYSQL_TIME *to, int *was_cut); - -ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *); -ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *); -ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *); -ulonglong TIME_to_ulonglong(const MYSQL_TIME *); -double TIME_to_double(const MYSQL_TIME *my_time); - -int check_time_range(struct st_mysql_time *my_time, uint dec, int *warning); -my_bool check_datetime_range(const MYSQL_TIME *ltime); - - -long calc_daynr(uint year,uint month,uint day); -uint calc_days_in_year(uint year); -uint year_2000_handling(uint year); - -void my_init_time(void); - - -/* - Function to check sanity of a TIMESTAMP value - - DESCRIPTION - Check if a given MYSQL_TIME value fits in TIMESTAMP range. - This function doesn't make precise check, but rather a rough - estimate. - - RETURN VALUES - TRUE The value seems sane - FALSE The MYSQL_TIME value is definitely out of range -*/ - -static inline my_bool validate_timestamp_range(const MYSQL_TIME *t) -{ - if ((t->year > TIMESTAMP_MAX_YEAR || t->year < TIMESTAMP_MIN_YEAR) || - (t->year == TIMESTAMP_MAX_YEAR && (t->month > 1 || t->day > 19)) || - (t->year == TIMESTAMP_MIN_YEAR && (t->month < 12 || t->day < 31))) - return FALSE; - - return TRUE; -} - -/* Can't include mysqld_error.h, it needs mysys to build, thus hardcode 2 error values here. */ -#ifndef ER_WARN_DATA_OUT_OF_RANGE -#define ER_WARN_DATA_OUT_OF_RANGE 1264 -#define ER_WARN_INVALID_TIMESTAMP 1299 -#endif - -my_time_t -my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, uint *error_code); - -void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type); - -/* - Required buffer length for my_time_to_str, my_date_to_str, - my_datetime_to_str and TIME_to_string functions. Note, that the - caller is still responsible to check that given TIME structure - has values in valid ranges, otherwise size of the buffer could - be not enough. We also rely on the fact that even wrong values - sent using binary protocol fit in this buffer. -*/ -#define MAX_DATE_STRING_REP_LENGTH 30 -#define AUTO_SEC_PART_DIGITS DECIMAL_NOT_SPECIFIED - -int my_interval_DDhhmmssff_to_str(const MYSQL_TIME *, char *to, uint digits); -int my_time_to_str(const MYSQL_TIME *l_time, char *to, uint digits); -int my_date_to_str(const MYSQL_TIME *l_time, char *to); -int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, uint digits); -int my_TIME_to_str(const MYSQL_TIME *l_time, char *to, uint digits); - -int my_timeval_to_str(const struct timeval *tm, char *to, uint dec); - -static inline longlong sec_part_shift(longlong second_part, uint digits) -{ - return second_part / (longlong)log_10_int[TIME_SECOND_PART_DIGITS - digits]; -} -static inline longlong sec_part_unshift(longlong second_part, uint digits) -{ - return second_part * (longlong)log_10_int[TIME_SECOND_PART_DIGITS - digits]; -} - -/* Date/time rounding and truncation functions */ -static inline long my_time_fraction_remainder(long nr, uint decimals) -{ - DBUG_ASSERT(decimals <= TIME_SECOND_PART_DIGITS); - return nr % (long) log_10_int[TIME_SECOND_PART_DIGITS - decimals]; -} -static inline void my_datetime_trunc(MYSQL_TIME *ltime, uint decimals) -{ - ltime->second_part-= my_time_fraction_remainder(ltime->second_part, decimals); -} -static inline void my_time_trunc(MYSQL_TIME *ltime, uint decimals) -{ - ltime->second_part-= my_time_fraction_remainder(ltime->second_part, decimals); - if (!ltime->second_part && ltime->neg && - !ltime->hour && !ltime->minute && !ltime->second) - ltime->neg= FALSE; -} -static inline void my_timeval_trunc(struct timeval *tv, uint decimals) -{ - tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals); -} - - -#define hrtime_to_my_time(X) ((my_time_t)hrtime_to_time(X)) - -/* - Available interval types used in any statement. - - 'interval_type' must be sorted so that simple intervals comes first, - ie year, quarter, month, week, day, hour, etc. The order based on - interval size is also important and the intervals should be kept in a - large to smaller order. (get_interval_value() depends on this) - - Note: If you change the order of elements in this enum you should fix - order of elements in 'interval_type_to_name' and 'interval_names' - arrays - - See also interval_type_to_name, get_interval_value, interval_names, append_interval -*/ - -enum interval_type -{ - INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_WEEK, INTERVAL_DAY, - INTERVAL_HOUR, INTERVAL_MINUTE, INTERVAL_SECOND, INTERVAL_MICROSECOND, - INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE, - INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND, - INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND, INTERVAL_HOUR_MICROSECOND, - INTERVAL_MINUTE_MICROSECOND, INTERVAL_SECOND_MICROSECOND, INTERVAL_LAST -}; - -C_MODE_END - -#endif /* _my_time_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_tree.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_tree.h deleted file mode 100644 index 9bed28e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_tree.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _tree_h -#define _tree_h -#ifdef __cplusplus -extern "C" { -#endif - -#include "my_base.h" /* get 'enum ha_rkey_function' */ -#include "my_alloc.h" /* MEM_ROOT */ - -/* Worst case tree is half full. This gives use 2^(MAX_TREE_HEIGHT/2) leafs */ -#define MAX_TREE_HEIGHT 64 - -#define ELEMENT_KEY(tree,element)\ -(tree->offset_to_key ? (void*)((uchar*) element+tree->offset_to_key) :\ - *((void**) (element+1))) - -#define tree_set_pointer(element,ptr) *((uchar **) (element+1))=((uchar*) (ptr)) - -/* - A tree with its flag set to TREE_ONLY_DUPS behaves differently on inserting - an element that is not in the tree: - the element is not added at all, but instead tree_insert() returns a special - address TREE_ELEMENT_UNIQUE as an indication that the function has not failed - due to lack of memory. -*/ - -#define TREE_ELEMENT_UNIQUE ((TREE_ELEMENT *) 1) -#define TREE_NO_DUPS 1 -#define TREE_ONLY_DUPS 2 - -typedef enum { left_root_right, right_root_left } TREE_WALK; -typedef uint32 element_count; -typedef int (*tree_walk_action)(void *,element_count,void *); - -typedef enum { free_init, free_free, free_end } TREE_FREE; -typedef int (*tree_element_free)(void*, TREE_FREE, void *); - -typedef struct st_tree_element { - struct st_tree_element *left,*right; - uint32 count:31, - colour:1; /* black is marked as 1 */ -} TREE_ELEMENT; - -#define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs)) - -typedef struct st_tree { - TREE_ELEMENT *root; - TREE_ELEMENT **parents[MAX_TREE_HEIGHT]; - uint offset_to_key,elements_in_tree,size_of_element; - size_t memory_limit, allocated; - qsort_cmp2 compare; - void *custom_arg; - MEM_ROOT mem_root; - my_bool with_delete; - tree_element_free free; - myf my_flags; - uint flag; -} TREE; - - /* Functions on whole tree */ -void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit, - int size, qsort_cmp2 compare, - tree_element_free free_element, void *custom_arg, - myf my_flags); -int delete_tree(TREE*, my_bool abort); -int reset_tree(TREE*); - - /* similar to delete tree, except we do not my_free() blocks in mem_root */ -#define is_tree_inited(tree) ((tree)->root != 0) - - /* Functions on leafs */ -TREE_ELEMENT *tree_insert(TREE *tree,void *key, uint key_size, - void *custom_arg); -void *tree_search(TREE *tree, void *key, void *custom_arg); -int tree_walk(TREE *tree,tree_walk_action action, - void *argument, TREE_WALK visit); -int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg); -void *tree_search_key(TREE *tree, const void *key, - TREE_ELEMENT **parents, TREE_ELEMENT ***last_pos, - enum ha_rkey_function flag, void *custom_arg); -void *tree_search_edge(TREE *tree, TREE_ELEMENT **parents, - TREE_ELEMENT ***last_pos, int child_offs); -void *tree_search_next(TREE *tree, TREE_ELEMENT ***last_pos, int l_offs, - int r_offs); -ha_rows tree_record_pos(TREE *tree, const void *key, - enum ha_rkey_function search_flag, void *custom_arg); -#define reset_free_element(tree) (tree)->free= 0 - -#define TREE_ELEMENT_EXTRA_SIZE (sizeof(TREE_ELEMENT) + sizeof(void*)) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_uctype.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_uctype.h deleted file mode 100644 index 82949ff..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_uctype.h +++ /dev/null @@ -1,1484 +0,0 @@ -#ifndef MY_UCTYPE_INCLUDED -#define MY_UCTYPE_INCLUDED - -/* Copyright (c) 2006 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Unicode ctype data - Generated from UnicodeData-5.0.0d9.txt -*/ -static unsigned char uctype_page00[256]= -{ - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, - 16, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 16, 16, 16, 16, 16, - 16, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 16, 16, 16, 16, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, 16, 32, 16, 16, - 16, 16, 20, 20, 16, 2, 16, 16, 16, 20, 2, 16, 20, 20, 20, 16, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2 -}; - -static unsigned char uctype_page01[256]= -{ - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, - 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, - 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, - 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 2, 1, - 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, - 2, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, - 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, - 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 2, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2 -}; - -static unsigned char uctype_page02[256]= -{ - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, - 2, 1, 2, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 2, 2, 2, 2, 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 -}; - -static unsigned char uctype_page03[256]= -{ - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 0, 0, 0, 0, 16, 16, 0, 0, 0, 0, 2, 2, 2, 2, 16, 0, - 0, 0, 0, 0, 16, 16, 1, 16, 1, 1, 1, 0, 1, 0, 1, 1, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, - 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 2, 2, 2, 2, 1, 2, 16, 1, 2, 1, 1, 2, 2, 1, 1, 1 -}; - -static unsigned char uctype_page04[256]= -{ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 16, 18, 18, 18, 18, 0, 18, 18, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 -}; - -static unsigned char uctype_page05[256]= -{ - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 0, 2, 16, 16, 16, 16, 16, 16, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 0, 16, 16, 0, 0, 0, 0, 0, - 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 16, 18, - 16, 18, 18, 16, 18, 18, 16, 18, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, - 2, 2, 2, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page06[256]= -{ - 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, - 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 16, 0, 0, 16, 16, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 2, 2, - 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 16, 2, 18, 18, 18, 18, 18, 18, 18, 32, 18, 18, - 18, 18, 18, 18, 18, 2, 2, 18, 18, 16, 18, 18, 18, 18, 2, 2, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 16, 16, 2 -}; - -static unsigned char uctype_page07[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 32, - 2, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 2, 2, 16, 16, 16, 16, 2, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page09[256]= -{ - 0, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, - 2, 18, 18, 18, 18, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 18, 18, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, - 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, - 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, - 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, - 18, 18, 18, 18, 18, 0, 0, 18, 18, 0, 0, 18, 18, 18, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 2, 2, 0, 2, - 2, 2, 18, 18, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 2, 2, 16, 16, 20, 20, 20, 20, 20, 20, 16, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page0A[256]= -{ - 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, - 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, - 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 0, 18, 0, 18, 18, - 18, 18, 18, 0, 0, 0, 0, 18, 18, 0, 0, 18, 18, 18, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 18, 18, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, - 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, - 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, - 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 0, 18, 18, 18, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 18, 18, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page0B[256]= -{ - 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, - 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, - 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, - 18, 18, 18, 18, 0, 0, 0, 18, 18, 0, 0, 18, 18, 18, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 2, 2, 0, 2, - 2, 2, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 16, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 2, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, - 2, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 0, 2, 0, 2, 2, - 0, 0, 0, 2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 18, 18, - 18, 18, 18, 0, 0, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 20, 20, 20, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page0C[256]= -{ - 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, - 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 18, 18, - 18, 18, 18, 18, 18, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, - 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, - 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, - 18, 18, 18, 18, 18, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, - 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 2, 2, 18, 18, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 0, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page0D[256]= -{ - 0, 0, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, - 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 18, 18, - 18, 18, 18, 18, 0, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 18, 0, 0, 0, 0, 18, - 18, 18, 18, 18, 18, 0, 18, 0, 18, 18, 18, 18, 18, 18, 18, 18, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 18, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page0E[256]= -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 18, 2, 2, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 16, - 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 16, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 2, 0, 2, 0, 0, 2, 2, 0, 2, 0, 0, 2, 0, 0, - 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, - 0, 2, 2, 2, 0, 2, 0, 2, 0, 0, 2, 2, 0, 2, 2, 2, - 2, 18, 2, 2, 18, 18, 18, 18, 18, 18, 0, 18, 18, 2, 0, 0, - 2, 2, 2, 2, 2, 0, 2, 0, 18, 18, 18, 18, 18, 18, 0, 0, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 2, 2, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page0F[256]= -{ - 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 16, 16, 16, 16, 16, 16, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 16, 18, 16, 18, 16, 18, 16, 16, 16, 16, 18, 18, - 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, - 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 16, 18, 18, 2, 2, 2, 2, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 16, 16, - 16, 16, 16, 16, 16, 16, 18, 16, 16, 16, 16, 16, 16, 0, 0, 16, - 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page10[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 0, 2, 2, 2, 2, 2, 0, 2, 2, 0, 18, 18, 18, 18, - 18, 18, 18, 0, 0, 0, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, - 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 0, 0, 0 -}; - -static unsigned char uctype_page11[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page12[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, - 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 -}; - -static unsigned char uctype_page13[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 18, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page14[256]= -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 -}; - -static unsigned char uctype_page16[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 2, - 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 7, 7, - 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page17[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, - 2, 2, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 18, 18, 18, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, - 2, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 32, 32, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 16, 16, 16, 2, 16, 16, 16, 16, 2, 18, 0, 0, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page18[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 18, 8, 0, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page19[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, - 16, 0, 0, 0, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, - 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 2, 2, 2, 2, 2, 2, 2, 18, 18, 0, 0, 0, 0, 0, 0, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 -}; - -static unsigned char uctype_page1A[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 0, 0, 16, 16, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page1B[256]= -{ - 18, 18, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page1D[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18 -}; - -static unsigned char uctype_page1E[256]= -{ - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page1F[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 1, 0, 1, 0, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 2, 16, - 16, 16, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 16, 16, - 2, 2, 2, 2, 0, 0, 2, 2, 1, 1, 1, 1, 0, 16, 16, 16, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 16, 16, 16, - 0, 0, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 16, 0 -}; - -static unsigned char uctype_page20[256]= -{ - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 32, 32, 32, 32, 32, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 32, 32, 32, 32, 32, 8, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, - 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 32, 32, - 20, 2, 0, 0, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 2, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 0, - 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page21[256]= -{ - 16, 16, 1, 16, 16, 16, 16, 1, 16, 16, 2, 1, 1, 1, 2, 2, - 1, 1, 1, 2, 16, 1, 16, 16, 16, 1, 1, 1, 1, 1, 16, 16, - 16, 16, 16, 16, 1, 16, 1, 16, 1, 16, 1, 1, 1, 1, 16, 2, - 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 16, 16, 2, 2, 1, 1, - 16, 16, 16, 16, 16, 1, 2, 2, 2, 2, 16, 16, 16, 16, 2, 0, - 0, 0, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 -}; - -static unsigned char uctype_page23[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page24[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 -}; - -static unsigned char uctype_page26[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page27[256]= -{ - 0, 16, 16, 16, 16, 0, 16, 16, 16, 16, 0, 0, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 0, 16, - 16, 16, 16, 0, 0, 0, 16, 0, 16, 16, 16, 16, 16, 16, 16, 0, - 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 16, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 -}; - -static unsigned char uctype_page2B[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page2C[256]= -{ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, - 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 0, 0, 0, - 0, 0, 0, 0, 2, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 2, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 20, 16, 16 -}; - -static unsigned char uctype_page2D[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, - 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, - 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, - 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page2E[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 16, 16, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_page2F[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0 -}; - -static unsigned char uctype_page30[256]= -{ - 8, 16, 16, 16, 16, 2, 2, 7, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 7, 7, 7, 7, 7, 7, 7, 7, 7, 18, 18, 18, 18, 18, 18, - 16, 2, 2, 2, 2, 2, 16, 16, 7, 7, 7, 2, 2, 16, 16, 16, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 0, 0, 18, 18, 16, 16, 2, 2, 2, - 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2 -}; - -static unsigned char uctype_page31[256]= -{ - 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, - 16, 16, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 -}; - -static unsigned char uctype_page32[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0 -}; - -static unsigned char uctype_page4D[256]= -{ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 -}; - -static unsigned char uctype_page9F[256]= -{ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_pageA4[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_pageA7[256]= -{ - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 0, 0, 0, 0, 0, - 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_pageA8[256]= -{ - 2, 2, 18, 2, 2, 2, 18, 2, 2, 2, 2, 18, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 18, 18, 18, 18, 18, 16, 16, 16, 16, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_pageD7[256]= -{ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_pageD8[256]= -{ - 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_pageDB[256]= -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, - 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32 -}; - -static unsigned char uctype_pageDC[256]= -{ - 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_pageDF[256]= -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32 -}; - -static unsigned char uctype_pageE0[256]= -{ - 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_pageF8[256]= -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32 -}; - -static unsigned char uctype_pageFA[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static unsigned char uctype_pageFB[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 18, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 2, 0, - 2, 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 -}; - -static unsigned char uctype_pageFD[256]= -{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 0, 0 -}; - -static unsigned char uctype_pageFE[256]= -{ - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, - 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 32 -}; - -static unsigned char uctype_pageFF[256]= -{ - 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, - 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, - 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, - 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, - 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0, - 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32, 16, 16, 0, 0 -}; - -MY_UNI_CTYPE my_uni_ctype[256]={ - {0,uctype_page00}, - {0,uctype_page01}, - {0,uctype_page02}, - {0,uctype_page03}, - {0,uctype_page04}, - {0,uctype_page05}, - {0,uctype_page06}, - {0,uctype_page07}, - {0,NULL}, - {0,uctype_page09}, - {0,uctype_page0A}, - {0,uctype_page0B}, - {0,uctype_page0C}, - {0,uctype_page0D}, - {0,uctype_page0E}, - {0,uctype_page0F}, - {0,uctype_page10}, - {0,uctype_page11}, - {0,uctype_page12}, - {0,uctype_page13}, - {0,uctype_page14}, - {2,NULL}, - {0,uctype_page16}, - {0,uctype_page17}, - {0,uctype_page18}, - {0,uctype_page19}, - {0,uctype_page1A}, - {0,uctype_page1B}, - {0,NULL}, - {0,uctype_page1D}, - {0,uctype_page1E}, - {0,uctype_page1F}, - {0,uctype_page20}, - {0,uctype_page21}, - {16,NULL}, - {0,uctype_page23}, - {0,uctype_page24}, - {16,NULL}, - {0,uctype_page26}, - {0,uctype_page27}, - {16,NULL}, - {16,NULL}, - {16,NULL}, - {0,uctype_page2B}, - {0,uctype_page2C}, - {0,uctype_page2D}, - {0,uctype_page2E}, - {0,uctype_page2F}, - {0,uctype_page30}, - {0,uctype_page31}, - {0,uctype_page32}, - {16,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {0,uctype_page4D}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {0,uctype_page9F}, - {2,NULL}, - {2,NULL}, - {2,NULL}, - {2,NULL}, - {0,uctype_pageA4}, - {0,NULL}, - {0,NULL}, - {0,uctype_pageA7}, - {0,uctype_pageA8}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {3,NULL}, - {0,uctype_pageD7}, - {0,uctype_pageD8}, - {0,NULL}, - {0,NULL}, - {0,uctype_pageDB}, - {0,uctype_pageDC}, - {0,NULL}, - {0,NULL}, - {0,uctype_pageDF}, - {0,uctype_pageE0}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,NULL}, - {0,uctype_pageF8}, - {2,NULL}, - {0,uctype_pageFA}, - {0,uctype_pageFB}, - {2,NULL}, - {0,uctype_pageFD}, - {0,uctype_pageFE}, - {0,uctype_pageFF} -}; - - -#endif /* MY_UCTYPE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_user.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_user.h deleted file mode 100644 index 46a811d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/my_user.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2005-2007 MySQL AB - Use is subject to license terms - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - This is a header for libraries containing functions used in both server and - only some of clients (but not in libmysql)... -*/ - -#ifndef _my_user_h_ -#define _my_user_h_ - -C_MODE_START - -int parse_user(const char *user_id_str, size_t user_id_len, - char *user_name_str, size_t *user_name_len, - char *host_name_str, size_t *host_name_len); - -C_MODE_END - -#endif /* _my_user_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisam.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisam.h deleted file mode 100644 index 0942584..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisam.h +++ /dev/null @@ -1,442 +0,0 @@ -/* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2013, Monty Program Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* This file should be included when using myisam_funktions */ - -#ifndef _myisam_h -#define _myisam_h -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "keycache.h" -#include "my_compare.h" -#include -#include -#include -/* - Limit max keys according to HA_MAX_POSSIBLE_KEY; See myisamchk.h for details -*/ - -#if MAX_INDEXES > HA_MAX_POSSIBLE_KEY -#define MI_MAX_KEY HA_MAX_POSSIBLE_KEY /* Max allowed keys */ -#else -#define MI_MAX_KEY MAX_INDEXES /* Max allowed keys */ -#endif - -#define MI_MAX_POSSIBLE_KEY_BUFF HA_MAX_POSSIBLE_KEY_BUFF -/* - The following defines can be increased if necessary. - But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and MI_MAX_KEY_LENGTH. -*/ -#define MI_MAX_KEY_LENGTH 1000 /* Max length in bytes */ -#define MI_MAX_KEY_SEG 16 /* Max segments for key */ - -#define MI_NAME_IEXT ".MYI" -#define MI_NAME_DEXT ".MYD" - -/* Possible values for myisam_block_size (must be power of 2) */ -#define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */ -#define MI_MIN_KEY_BLOCK_LENGTH 1024 /* Min key block length */ -#define MI_MAX_KEY_BLOCK_LENGTH 16384 - -/* - In the following macros '_keyno_' is 0 .. keys-1. - If there can be more keys than bits in the key_map, the highest bit - is for all upper keys. They cannot be switched individually. - This means that clearing of high keys is ignored, setting one high key - sets all high keys. -*/ -#define MI_KEYMAP_BITS (8 * SIZEOF_LONG_LONG) -#define MI_KEYMAP_HIGH_MASK (1ULL << (MI_KEYMAP_BITS - 1)) -#define mi_get_mask_all_keys_active(_keys_) \ - (((_keys_) < MI_KEYMAP_BITS) ? \ - ((1ULL << (_keys_)) - 1ULL) : \ - (~ 0ULL)) - -#if MI_MAX_KEY > MI_KEYMAP_BITS - -#define mi_is_key_active(_keymap_,_keyno_) \ - (((_keyno_) < MI_KEYMAP_BITS) ? \ - MY_TEST((_keymap_) & (1ULL << (_keyno_))) : \ - MY_TEST((_keymap_) & MI_KEYMAP_HIGH_MASK)) -#define mi_set_key_active(_keymap_,_keyno_) \ - (_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \ - (1ULL << (_keyno_)) : \ - MI_KEYMAP_HIGH_MASK) -#define mi_clear_key_active(_keymap_,_keyno_) \ - (_keymap_)&= (((_keyno_) < MI_KEYMAP_BITS) ? \ - (~ (1ULL << (_keyno_))) : \ - (~ (0ULL)) /*ignore*/ ) - -#else - -#define mi_is_key_active(_keymap_,_keyno_) \ - MY_TEST((_keymap_) & (1ULL << (_keyno_))) -#define mi_set_key_active(_keymap_,_keyno_) \ - (_keymap_)|= (1ULL << (_keyno_)) -#define mi_clear_key_active(_keymap_,_keyno_) \ - (_keymap_)&= (~ (1ULL << (_keyno_))) - -#endif - -#define mi_is_any_key_active(_keymap_) \ - MY_TEST((_keymap_)) -#define mi_is_all_keys_active(_keymap_,_keys_) \ - ((_keymap_) == mi_get_mask_all_keys_active(_keys_)) -#define mi_set_all_keys_active(_keymap_,_keys_) \ - (_keymap_)= mi_get_mask_all_keys_active(_keys_) -#define mi_clear_all_keys_active(_keymap_) \ - (_keymap_)= 0 -#define mi_intersect_keys_active(_to_,_from_) \ - (_to_)&= (_from_) -#define mi_is_any_intersect_keys_active(_keymap1_,_keys_,_keymap2_) \ - ((_keymap1_) & (_keymap2_) & \ - mi_get_mask_all_keys_active(_keys_)) -#define mi_copy_keys_active(_to_,_maxkeys_,_from_) \ - (_to_)= (mi_get_mask_all_keys_active(_maxkeys_) & \ - (_from_)) - - /* Param to/from mi_info */ - -typedef struct st_mi_isaminfo /* Struct from h_info */ -{ - ha_rows records; /* Records in database */ - ha_rows deleted; /* Deleted records in database */ - my_off_t recpos; /* Pos for last used record */ - my_off_t newrecpos; /* Pos if we write new record */ - my_off_t dupp_key_pos; /* Position to record with dupp key */ - my_off_t data_file_length, /* Length of data file */ - max_data_file_length, - index_file_length, - max_index_file_length, - delete_length; - ulong reclength; /* Recordlength */ - ulong mean_reclength; /* Mean recordlength (if packed) */ - ulonglong auto_increment; - ulonglong key_map; /* Which keys are used */ - char *data_file_name, *index_file_name; - uint keys; /* Number of keys in use */ - uint options; /* HA_OPTION_... used */ - int errkey, /* With key was dupplicated on err */ - sortkey; /* clustered by this key */ - File filenr; /* (uniq) filenr for datafile */ - time_t create_time; /* When table was created */ - time_t check_time; - time_t update_time; - uint reflength; - ulong record_offset; - ulong *rec_per_key; /* for sql optimizing */ -} MI_ISAMINFO; - - -typedef struct st_mi_create_info -{ - const char *index_file_name, *data_file_name; /* If using symlinks */ - ha_rows max_rows; - ha_rows reloc_rows; - ulonglong auto_increment; - ulonglong data_file_length; - ulonglong key_file_length; - uint old_options; - uint16 language; - my_bool with_auto_increment; -} MI_CREATE_INFO; - -struct st_myisam_info; /* For referense */ -struct st_mi_isam_share; -typedef struct st_myisam_info MI_INFO; -struct st_mi_s_param; - -typedef struct st_mi_keydef /* Key definition with open & info */ -{ - struct st_mi_isam_share *share; /* Pointer to base (set in mi_open) */ - uint16 keysegs; /* Number of key-segment */ - uint16 flag; /* NOSAME, PACK_USED */ - - uint8 key_alg; /* BTREE, RTREE */ - uint16 block_length; /* Length of keyblock (auto) */ - uint16 underflow_block_length; /* When to execute underflow */ - uint16 keylength; /* Tot length of keyparts (auto) */ - uint16 minlength; /* min length of (packed) key (auto) */ - uint16 maxlength; /* max length of (packed) key (auto) */ - uint16 block_size_index; /* block_size (auto) */ - uint32 version; /* For concurrent read/write */ - uint32 ftkey_nr; /* full-text index number */ - - HA_KEYSEG *seg,*end; - struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */ - int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo, - uchar *page,uchar *key, - uint key_len,uint comp_flag,uchar * *ret_pos, - uchar *buff, my_bool *was_last_key); - uint (*get_key)(struct st_mi_keydef *keyinfo,uint nod_flag,uchar * *page, - uchar *key); - int (*pack_key)(struct st_mi_keydef *keyinfo,uint nod_flag,uchar *next_key, - uchar *org_key, uchar *prev_key, uchar *key, - struct st_mi_s_param *s_temp); - void (*store_key)(struct st_mi_keydef *keyinfo, uchar *key_pos, - struct st_mi_s_param *s_temp); - int (*ck_insert)(struct st_myisam_info *inf, uint k_nr, uchar *k, uint klen); - int (*ck_delete)(struct st_myisam_info *inf, uint k_nr, uchar *k, uint klen); -} MI_KEYDEF; - - -#define MI_UNIQUE_HASH_LENGTH 4 - -typedef struct st_unique_def /* Segment definition of unique */ -{ - uint16 keysegs; /* Number of key-segment */ - uchar key; /* Mapped to which key */ - uint8 null_are_equal; - HA_KEYSEG *seg,*end; -} MI_UNIQUEDEF; - -typedef struct st_mi_decode_tree /* Decode huff-table */ -{ - uint16 *table; - uint quick_table_bits; - uchar *intervalls; -} MI_DECODE_TREE; - - -struct st_mi_bit_buff; - -/* - Note that null markers should always be first in a row ! - When creating a column, one should only specify: - type, length, null_bit and null_pos -*/ - -typedef struct st_columndef /* column information */ -{ - enum en_fieldtype type; - uint16 length; /* length of field */ - uint32 offset; /* Offset to position in row */ - uint8 null_bit; /* If column may be 0 */ - uint16 null_pos; /* position for null marker */ - -#ifndef NOT_PACKED_DATABASES - void (*unpack)(struct st_columndef *rec,struct st_mi_bit_buff *buff, - uchar *start,uchar *end); - enum en_fieldtype base_type; - uint space_length_bits,pack_type; - MI_DECODE_TREE *huff_tree; -#endif -} MI_COLUMNDEF; - -extern char * myisam_log_filename; /* Name of logfile */ -extern ulong myisam_block_size; -extern ulong myisam_concurrent_insert; -extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user; -extern my_off_t myisam_max_temp_length; -extern ulong myisam_data_pointer_size; - -/* usually used to check if a symlink points into the mysql data home */ -/* which is normally forbidden */ -extern int (*myisam_test_invalid_symlink)(const char *filename); -extern ulonglong myisam_mmap_size, myisam_mmap_used; -extern mysql_mutex_t THR_LOCK_myisam_mmap; - - /* Prototypes for myisam-functions */ - -extern int mi_close(struct st_myisam_info *file); -extern int mi_delete(struct st_myisam_info *file,const uchar *buff); -extern struct st_myisam_info *mi_open(const char *name,int mode, - uint wait_if_locked); -extern int mi_panic(enum ha_panic_function function); -extern int mi_rfirst(struct st_myisam_info *file,uchar *buf,int inx); -extern int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key, - key_part_map keypart_map, enum ha_rkey_function search_flag); -extern int mi_rlast(struct st_myisam_info *file,uchar *buf,int inx); -extern int mi_rnext(struct st_myisam_info *file,uchar *buf,int inx); -extern int mi_rnext_same(struct st_myisam_info *info, uchar *buf); -extern int mi_rprev(struct st_myisam_info *file,uchar *buf,int inx); -extern int mi_rrnd(struct st_myisam_info *file,uchar *buf, my_off_t pos); -extern int mi_scan_init(struct st_myisam_info *file); -extern int mi_scan(struct st_myisam_info *file,uchar *buf); -extern int mi_rsame(struct st_myisam_info *file,uchar *record,int inx); -extern int mi_rsame_with_pos(struct st_myisam_info *file,uchar *record, - int inx, my_off_t pos); -extern int mi_update(struct st_myisam_info *file,const uchar *old, - const uchar *new_record); -extern int mi_write(struct st_myisam_info *file,const uchar *buff); -extern my_off_t mi_position(struct st_myisam_info *file); -extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint flag); -extern int mi_lock_database(struct st_myisam_info *file,int lock_type); -extern int mi_create(const char *name,uint keys,MI_KEYDEF *keydef, - uint columns, MI_COLUMNDEF *columndef, - uint uniques, MI_UNIQUEDEF *uniquedef, - MI_CREATE_INFO *create_info, uint flags); -extern int mi_delete_table(const char *name); -extern int mi_rename(const char *from, const char *to); -extern int mi_extra(struct st_myisam_info *file, - enum ha_extra_function function, - void *extra_arg); -extern int mi_reset(struct st_myisam_info *file); -extern ha_rows mi_records_in_range(MI_INFO *info,int inx, - const key_range *min_key, - const key_range *max_key, - page_range *pages); -extern int mi_log(int activate_log); -extern int mi_is_changed(struct st_myisam_info *info); -extern int mi_delete_all_rows(struct st_myisam_info *info); -extern ulong _mi_calc_blob_length(uint length , const uchar *pos); -extern uint mi_get_pointer_length(ulonglong file_length, uint def); -extern int mi_make_backup_of_index(struct st_myisam_info *info, - time_t backup_time, myf flags); -#define myisam_max_key_length() HA_MAX_KEY_LENGTH -#define myisam_max_key_segments() HA_MAX_KEY_SEG - -#define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for mmap file */ -/* this is used to pass to mysql_myisamchk_table */ - -#define MYISAMCHK_REPAIR 1 /* equivalent to myisamchk -r */ -#define MYISAMCHK_VERIFY 2 /* Verify, run repair if failure */ - -typedef uint mi_bit_type; -typedef struct st_sort_key_blocks SORT_KEY_BLOCKS; -typedef struct st_sort_ftbuf SORT_FT_BUF; - -typedef struct st_mi_bit_buff -{ /* Used for packing of record */ - mi_bit_type current_byte; - uint bits; - uchar *pos, *end, *blob_pos, *blob_end; - uint error; -} MI_BIT_BUFF; - -typedef struct st_sort_info -{ - /* sync things */ - mysql_mutex_t mutex; - mysql_cond_t cond; - MI_INFO *info; - HA_CHECK *param; - uchar *buff; - SORT_KEY_BLOCKS *key_block, *key_block_end; - SORT_FT_BUF *ft_buf; - my_off_t filelength, dupp, buff_length; - ha_rows max_records; - uint current_key, total_keys; - volatile uint got_error; - uint threads_running; - myf myf_rw; - enum data_file_type new_data_file_type; -} MI_SORT_INFO; - -typedef struct st_mi_sort_param -{ - pthread_t thr; - IO_CACHE read_cache, tempfile, tempfile_for_exceptions; - DYNAMIC_ARRAY buffpek; - MI_BIT_BUFF bit_buff; /* For parallel repair of packrec. */ - - MI_KEYDEF *keyinfo; - MI_SORT_INFO *sort_info; - HA_KEYSEG *seg; - uchar **sort_keys; - uchar *rec_buff; - void *wordlist, *wordptr; - MEM_ROOT wordroot; - uchar *record; - MY_TMPDIR *tmpdir; - - /* - The next two are used to collect statistics, see update_key_parts for - description. - */ - ulonglong unique[HA_MAX_KEY_SEG+1]; - ulonglong notnull[HA_MAX_KEY_SEG+1]; - - my_off_t pos,max_pos,filepos,start_recpos; - uint key, key_length,real_key_length; - uint maxbuffers, find_length; - ulonglong sortbuff_size; - ha_rows keys; - my_bool fix_datafile, master; - my_bool calc_checksum; /* calculate table checksum */ - - int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *); - int (*key_read)(struct st_mi_sort_param *,void *); - int (*key_write)(struct st_mi_sort_param *, const void *); - void (*lock_in_memory)(HA_CHECK *); - int (*write_keys)(struct st_mi_sort_param *, uchar **, - ulonglong , struct st_buffpek *, IO_CACHE *); - my_off_t (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); - int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, - uint, ulonglong); -} MI_SORT_PARAM; - -/* functions in mi_check */ -void myisamchk_init(HA_CHECK *param); -int chk_status(HA_CHECK *param, MI_INFO *info); -int chk_del(HA_CHECK *param, MI_INFO *info, ulonglong test_flag); -int chk_size(HA_CHECK *param, MI_INFO *info); -int chk_key(HA_CHECK *param, MI_INFO *info); -int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend); -int mi_repair(HA_CHECK *param, MI_INFO *info, char * name, int rep_quick); -int mi_sort_index(HA_CHECK *param, MI_INFO *info, char * name); -int mi_repair_by_sort(HA_CHECK *param, MI_INFO *info, - const char * name, int rep_quick); -int mi_repair_parallel(HA_CHECK *param, MI_INFO *info, - const char * name, int rep_quick); -int change_to_newfile(const char * filename, const char * old_ext, - const char * new_ext, time_t backup_time, myf myflags); -int lock_file(HA_CHECK *param, File file, my_off_t start, int lock_type, - const char *filetype, const char *filename); -void lock_memory(HA_CHECK *param); -void update_auto_increment_key(HA_CHECK *param, MI_INFO *info, - my_bool repair); -int update_state_info(HA_CHECK *param, MI_INFO *info,uint update); -void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part, - ulonglong *unique, ulonglong *notnull, - ulonglong records); -int filecopy(HA_CHECK *param, File to,File from,my_off_t start, - my_off_t length, const char *type); -int movepoint(MI_INFO *info,uchar *record,my_off_t oldpos, - my_off_t newpos, uint prot_key); -int write_data_suffix(MI_SORT_INFO *sort_info, my_bool fix_datafile); -int test_if_almost_full(MI_INFO *info); -int recreate_table(HA_CHECK *param, MI_INFO **org_info, char *filename); -void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); -my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map, - my_bool force); - -int mi_init_bulk_insert(MI_INFO *info, size_t cache_size, ha_rows rows); -void mi_flush_bulk_insert(MI_INFO *info, uint inx); -int mi_end_bulk_insert(MI_INFO *info, my_bool abort); -int mi_assign_to_key_cache(MI_INFO *info, ulonglong key_map, - KEY_CACHE *key_cache); -void mi_change_key_cache(KEY_CACHE *old_key_cache, - KEY_CACHE *new_key_cache); -int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves); - -int write_data_suffix(MI_SORT_INFO *sort_info, my_bool fix_datafile); -int flush_pending_blocks(MI_SORT_PARAM *param); -int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); -int thr_write_keys(MI_SORT_PARAM *sort_param); -int sort_write_record(MI_SORT_PARAM *sort_param); -int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, ulonglong); -my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisamchk.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisamchk.h deleted file mode 100644 index f1a7348..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisamchk.h +++ /dev/null @@ -1,130 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - Copyright (c) 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Definitions needed for myisamchk/mariachk.c */ - -#ifndef _myisamchk_h -#define _myisamchk_h - -#include - -/* - Flags used by xxxxchk.c or/and ha_xxxx.cc that are NOT passed - to xxxcheck.c follows: -*/ - -#define TT_USEFRM 1U -#define TT_FOR_UPGRADE 2U -#define TT_FROM_MYSQL 4U - -/* Bits set in out_flag */ -#define O_NEW_DATA 2U -#define O_DATA_LOST 4U - -/* - MARIA/MYISAM supports several statistics collection - methods. Currently statistics collection method is not stored in - MARIA file and has to be specified for each table analyze/repair - operation in MI_CHECK::stats_method. -*/ - -typedef enum -{ - /* Treat NULLs as inequal when collecting statistics (default for 4.1/5.0) */ - MI_STATS_METHOD_NULLS_NOT_EQUAL, - /* Treat NULLs as equal when collecting statistics (like 4.0 did) */ - MI_STATS_METHOD_NULLS_EQUAL, - /* Ignore NULLs - count only tuples without NULLs in the index components */ - MI_STATS_METHOD_IGNORE_NULLS -} enum_handler_stats_method; - -struct st_myisam_info; - -typedef struct st_handler_check_param -{ - char *isam_file_name; - MY_TMPDIR *tmpdir; - void *thd; - const char *db_name, *table_name, *op_name; - ulonglong auto_increment_value; - ulonglong max_data_file_length; - ulonglong keys_in_use; - ulonglong max_record_length; - /* - The next two are used to collect statistics, see update_key_parts for - description. - */ - ulonglong unique_count[HA_MAX_KEY_SEG + 1]; - ulonglong notnull_count[HA_MAX_KEY_SEG + 1]; - - my_off_t search_after_block; - my_off_t new_file_pos, key_file_blocks; - my_off_t keydata, totaldata, key_blocks, start_check_pos; - my_off_t used, empty, splits, del_length, link_used, lost; - ha_rows total_records, total_deleted, records,del_blocks; - ha_rows full_page_count, tail_count; - ha_checksum record_checksum, glob_crc; - ha_checksum key_crc[HA_MAX_POSSIBLE_KEY]; - ha_checksum tmp_key_crc[HA_MAX_POSSIBLE_KEY]; - ha_checksum tmp_record_checksum; - ulonglong org_key_map; - ulonglong testflag; - - /* Following is used to check if rows are visible */ - ulonglong max_trid, max_found_trid; - ulonglong not_visible_rows_found; - ulonglong sort_buffer_length; - ulonglong use_buffers; /* Used as param to getopt() */ - size_t read_buffer_length, write_buffer_length, sort_key_blocks; - time_t backup_time; /* To sign backup files */ - ulong rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY]; - double new_rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY]; - uint out_flag, error_printed, verbose; - uint opt_sort_key, total_files, max_level; - uint key_cache_block_size, pagecache_block_size; - int tmpfile_createflag, err_count; - myf myf_rw; - uint16 language; - my_bool warning_printed, note_printed, wrong_trd_printed; - my_bool using_global_keycache, opt_lock_memory, opt_follow_links; - my_bool retry_repair, force_sort, calc_checksum, static_row_size; - char temp_filename[FN_REFLEN]; - IO_CACHE read_cache; - void **stack_end_ptr; - enum_handler_stats_method stats_method; - /* For reporting progress */ - uint stage, max_stage; - uint progress_counter; /* How often to call _report_progress() */ - ulonglong progress, max_progress; - - int (*fix_record)(struct st_myisam_info *info, uchar *record, int keynum); - - mysql_mutex_t print_msg_mutex; - my_bool need_print_msg_lock; - myf malloc_flags; -} HA_CHECK; - - -typedef struct st_buffpek { - my_off_t file_pos; /* Where we are in the sort file */ - uchar *base, *key; /* Key pointers */ - ha_rows count; /* Number of rows in table */ - ha_rows mem_count; /* Numbers of keys in memory */ - ha_rows max_keys; /* Max keys in buffert */ -} BUFFPEK; - -#endif /* _myisamchk_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisammrg.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisammrg.h deleted file mode 100644 index 78e7ac0..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisammrg.h +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright (c) 2000-2002, 2004, 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* This file should be included when using merge_isam_funktions */ - -#ifndef _myisammrg_h -#define _myisammrg_h -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _my_base_h -#include -#endif -#ifndef _myisam_h -#include -#endif - -#include - -#define MYRG_NAME_EXT ".MRG" -#define MYRG_NAME_TMPEXT ".MRG_TMP" - -/* In which table to INSERT rows */ -#define MERGE_INSERT_DISABLED 0 -#define MERGE_INSERT_TO_FIRST 1 -#define MERGE_INSERT_TO_LAST 2 - -extern TYPELIB merge_insert_method; - - /* Param to/from myrg_info */ - -typedef struct st_mymerge_info /* Struct from h_info */ -{ - ulonglong records; /* Records in database */ - ulonglong deleted; /* Deleted records in database */ - ulonglong recpos; /* Pos for last used record */ - ulonglong data_file_length; - ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */ - uint reclength; /* Recordlength */ - int errkey; /* With key was dupplicated on err */ - uint options; /* HA_OPTION_... used */ - ulong *rec_per_key; /* for sql optimizing */ -} MYMERGE_INFO; - -typedef struct st_myrg_table_info -{ - struct st_myisam_info *table; - ulonglong file_offset; -} MYRG_TABLE; - -typedef struct st_myrg_info -{ - MYRG_TABLE *open_tables,*current_table,*end_table,*last_used_table; - ulonglong records; /* records in tables */ - ulonglong del; /* Removed records */ - ulonglong data_file_length; - ulong cache_size; - uint merge_insert_method; - uint tables,options,reclength,keys; - my_bool cache_in_use; - /* If MERGE children attached to parent. See top comment in ha_myisammrg.cc */ - my_bool children_attached; - LIST open_list; - QUEUE by_key; - ulong *rec_per_key_part; /* for sql optimizing */ - mysql_mutex_t mutex; -} MYRG_INFO; - - - /* Prototypes for merge-functions */ - -extern int myrg_close(MYRG_INFO *file); -extern int myrg_delete(MYRG_INFO *file,const uchar *buff); -extern MYRG_INFO *myrg_open(const char *name,int mode,int wait_if_locked); -extern MYRG_INFO *myrg_parent_open(const char *parent_name, - int (*callback)(void*, const char*), - void *callback_param); -extern int myrg_attach_children(MYRG_INFO *m_info, int handle_locking, - MI_INFO *(*callback)(void*), - void *callback_param, - my_bool *need_compat_check); -extern int myrg_detach_children(MYRG_INFO *m_info); -extern int myrg_panic(enum ha_panic_function function); -extern int myrg_rfirst(MYRG_INFO *file,uchar *buf,int inx); -extern int myrg_rlast(MYRG_INFO *file,uchar *buf,int inx); -extern int myrg_rnext(MYRG_INFO *file,uchar *buf,int inx); -extern int myrg_rprev(MYRG_INFO *file,uchar *buf,int inx); -extern int myrg_rnext_same(MYRG_INFO *file,uchar *buf); -extern int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key, - key_part_map keypart_map, enum ha_rkey_function search_flag); -extern int myrg_rrnd(MYRG_INFO *file,uchar *buf,ulonglong pos); -extern int myrg_rsame(MYRG_INFO *file,uchar *record,int inx); -extern int myrg_update(MYRG_INFO *file,const uchar *old, - const uchar *new_rec); -extern int myrg_write(MYRG_INFO *info,const uchar *rec); -extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag); -extern int myrg_lock_database(MYRG_INFO *file,int lock_type); -extern int myrg_create(const char *name, const char **table_names, - uint insert_method, my_bool fix_names); -extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function, - void *extra_arg); -extern int myrg_reset(MYRG_INFO *info); -extern void myrg_extrafunc(MYRG_INFO *info,invalidator_by_filename inv); -extern ha_rows myrg_records_in_range(MYRG_INFO *info, int inx, - const key_range *min_key, - const key_range *max_key, - page_range *pages); -extern ha_rows myrg_records(MYRG_INFO *info); - -extern ulonglong myrg_position(MYRG_INFO *info); -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisampack.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisampack.h deleted file mode 100644 index 6bfe195..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/myisampack.h +++ /dev/null @@ -1,256 +0,0 @@ -#ifndef MYISAMPACK_INCLUDED -#define MYISAMPACK_INCLUDED - -/* Copyright (c) 2000-2002, 2004 MySQL AB, 2009 Sun Microsystems, Inc. - Copyright (c) 2020, MariaDB Corporation. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Storing of values in high byte first order. - - integer keys and file pointers are stored with high byte first to get - better compression -*/ - -/* these two are for uniformity */ -#define mi_sint1korr(A) ((int8)(*A)) -#define mi_uint1korr(A) ((uint8)(*A)) - -#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) |\ - ((int16) ((int16) ((const char*) (A))[0]) << 8))) -#define mi_sint3korr(A) ((int32) (((((const uchar*) (A))[0]) & 128) ? \ - (((uint32) 255L << 24) | \ - (((uint32) ((const uchar*) (A))[0]) << 16) |\ - (((uint32) ((const uchar*) (A))[1]) << 8) | \ - ((uint32) ((const uchar*) (A))[2])) : \ - (((uint32) ((const uchar*) (A))[0]) << 16) |\ - (((uint32) ((const uchar*) (A))[1]) << 8) | \ - ((uint32) ((const uchar*) (A))[2]))) -#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) |\ - ((int32) (((const uchar*) (A))[2]) << 8) |\ - ((int32) (((const uchar*) (A))[1]) << 16) |\ - ((int32) ((int16) ((const char*) (A))[0]) << 24))) -#define mi_sint8korr(A) ((longlong) mi_uint8korr(A)) -#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) |\ - ((uint16) (((const uchar*) (A))[0]) << 8))) -#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) |\ - (((uint32) (((const uchar*) (A))[1])) << 8) |\ - (((uint32) (((const uchar*) (A))[0])) << 16))) -#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) |\ - (((uint32) (((const uchar*) (A))[2])) << 8) |\ - (((uint32) (((const uchar*) (A))[1])) << 16) |\ - (((uint32) (((const uchar*) (A))[0])) << 24))) - -#ifndef HAVE_mi_uint5korr -#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) |\ - (((uint32) (((const uchar*) (A))[3])) << 8) |\ - (((uint32) (((const uchar*) (A))[2])) << 16) |\ - (((uint32) (((const uchar*) (A))[1])) << 24)) |\ - (((ulonglong) (((const uchar*) (A))[0])) << 32)) -#endif /* HAVE_mi_uint5korr */ - -#ifndef HAVE_mi_uint6korr -#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) |\ - (((uint32) (((const uchar*) (A))[4])) << 8) |\ - (((uint32) (((const uchar*) (A))[3])) << 16) |\ - (((uint32) (((const uchar*) (A))[2])) << 24)) |\ - (((ulonglong) (((uint32) (((const uchar*) (A))[1])) |\ - (((uint32) (((const uchar*) (A))[0]) << 8)))) <<\ - 32)) -#endif /* HAVE_mi_uint6korr */ - -#ifndef HAVE_mi_uint7korr -#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) |\ - (((uint32) (((const uchar*) (A))[5])) << 8) |\ - (((uint32) (((const uchar*) (A))[4])) << 16) |\ - (((uint32) (((const uchar*) (A))[3])) << 24)) |\ - (((ulonglong) (((uint32) (((const uchar*) (A))[2])) |\ - (((uint32) (((const uchar*) (A))[1])) << 8) |\ - (((uint32) (((const uchar*) (A))[0])) << 16))) <<\ - 32)) -#endif /* HAVE_mi_uint7korr */ - -#ifndef HAVE_mi_uint8korr -#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) |\ - (((uint32) (((const uchar*) (A))[6])) << 8) |\ - (((uint32) (((const uchar*) (A))[5])) << 16) |\ - (((uint32) (((const uchar*) (A))[4])) << 24)) |\ - (((ulonglong) (((uint32) (((const uchar*) (A))[3])) |\ - (((uint32) (((const uchar*) (A))[2])) << 8) |\ - (((uint32) (((const uchar*) (A))[1])) << 16) |\ - (((uint32) (((const uchar*) (A))[0])) << 24))) <<\ - 32)) -#endif /* HAVE_mi_uint8korr */ - -/* This one is for uniformity */ -#define mi_int1store(T,A) *((uchar*)(T))= (uchar) (A) - -#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\ - ((uchar*) (T))[1]= (uchar) (def_temp);\ - ((uchar*) (T))[0]= (uchar) (def_temp >> 8); } -#define mi_int3store(T,A) { /*lint -save -e734 */\ - ulong def_temp= (ulong) (A);\ - ((uchar*) (T))[2]= (uchar) (def_temp);\ - ((uchar*) (T))[1]= (uchar) (def_temp >> 8);\ - ((uchar*) (T))[0]= (uchar) (def_temp >> 16);\ - /*lint -restore */} -#define mi_int4store(T,A) { ulong def_temp= (ulong) (A);\ - ((uchar*) (T))[3]= (uchar) (def_temp);\ - ((uchar*) (T))[2]= (uchar) (def_temp >> 8);\ - ((uchar*) (T))[1]= (uchar) (def_temp >> 16);\ - ((uchar*) (T))[0]= (uchar) (def_temp >> 24); } -#define mi_int5store(T,A) { ulong def_temp= (ulong) (A),\ - def_temp2= (ulong) ((A) >> 32);\ - ((uchar*) (T))[4]= (uchar) (def_temp);\ - ((uchar*) (T))[3]= (uchar) (def_temp >> 8);\ - ((uchar*) (T))[2]= (uchar) (def_temp >> 16);\ - ((uchar*) (T))[1]= (uchar) (def_temp >> 24);\ - ((uchar*) (T))[0]= (uchar) (def_temp2); } -#define mi_int6store(T,A) { ulong def_temp= (ulong) (A),\ - def_temp2= (ulong) ((A) >> 32);\ - ((uchar*) (T))[5]= (uchar) (def_temp);\ - ((uchar*) (T))[4]= (uchar) (def_temp >> 8);\ - ((uchar*) (T))[3]= (uchar) (def_temp >> 16);\ - ((uchar*) (T))[2]= (uchar) (def_temp >> 24);\ - ((uchar*) (T))[1]= (uchar) (def_temp2);\ - ((uchar*) (T))[0]= (uchar) (def_temp2 >> 8); } -#define mi_int7store(T,A) { ulong def_temp= (ulong) (A),\ - def_temp2= (ulong) ((A) >> 32);\ - ((uchar*) (T))[6]= (uchar) (def_temp);\ - ((uchar*) (T))[5]= (uchar) (def_temp >> 8);\ - ((uchar*) (T))[4]= (uchar) (def_temp >> 16);\ - ((uchar*) (T))[3]= (uchar) (def_temp >> 24);\ - ((uchar*) (T))[2]= (uchar) (def_temp2);\ - ((uchar*) (T))[1]= (uchar) (def_temp2 >> 8);\ - ((uchar*) (T))[0]= (uchar) (def_temp2 >> 16); } -#define mi_int8store(T,A) { ulong def_temp3= (ulong) (A),\ - def_temp4= (ulong) ((A) >> 32);\ - mi_int4store((uchar*) (T) + 0, def_temp4);\ - mi_int4store((uchar*) (T) + 4, def_temp3); } - -#ifdef WORDS_BIGENDIAN - -#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[0];\ - ((uchar*) (T))[1]= ((uchar*) &A)[1];\ - ((uchar*) (T))[2]= ((uchar*) &A)[2];\ - ((uchar*) (T))[3]= ((uchar*) &A)[3]; } - -#define mi_float4get(V,M) { float def_temp;\ - ((uchar*) &def_temp)[0]= ((const uchar*) (M))[0];\ - ((uchar*) &def_temp)[1]= ((const uchar*) (M))[1]; \ - ((uchar*) &def_temp)[2]= ((const uchar*) (M))[2];\ - ((uchar*) &def_temp)[3]= ((const uchar*) (M))[3];\ - (V)= def_temp; } - -#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((const uchar*) &V)[0];\ - ((uchar*) (T))[1]= ((const uchar*) &V)[1];\ - ((uchar*) (T))[2]= ((const uchar*) &V)[2];\ - ((uchar*) (T))[3]= ((const uchar*) &V)[3];\ - ((uchar*) (T))[4]= ((const uchar*) &V)[4];\ - ((uchar*) (T))[5]= ((const uchar*) &V)[5];\ - ((uchar*) (T))[6]= ((const uchar*) &V)[6];\ - ((uchar*) (T))[7]= ((const uchar*) &V)[7]; } - -#define mi_float8get(V,M) { double def_temp;\ - ((uchar*) &def_temp)[0]= ((const uchar*) (M))[0];\ - ((uchar*) &def_temp)[1]= ((const uchar*) (M))[1];\ - ((uchar*) &def_temp)[2]= ((const uchar*) (M))[2];\ - ((uchar*) &def_temp)[3]= ((const uchar*) (M))[3];\ - ((uchar*) &def_temp)[4]= ((const uchar*) (M))[4];\ - ((uchar*) &def_temp)[5]= ((const uchar*) (M))[5];\ - ((uchar*) &def_temp)[6]= ((const uchar*) (M))[6];\ - ((uchar*) &def_temp)[7]= ((const uchar*) (M))[7]; \ - (V)= def_temp; } -#else - -#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((const uchar*) &A)[3];\ - ((uchar*) (T))[1]= ((const uchar*) &A)[2];\ - ((uchar*) (T))[2]= ((const uchar*) &A)[1];\ - ((uchar*) (T))[3]= ((const uchar*) &A)[0]; } - -#define mi_float4get(V,M) { float def_temp;\ - ((uchar*) &def_temp)[0]= ((const uchar*) (M))[3];\ - ((uchar*) &def_temp)[1]= ((const uchar*) (M))[2];\ - ((uchar*) &def_temp)[2]= ((const uchar*) (M))[1];\ - ((uchar*) &def_temp)[3]= ((const uchar*) (M))[0];\ - (V)= def_temp; } - -#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) -#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((const uchar*) &V)[3];\ - ((uchar*) (T))[1]= ((const uchar*) &V)[2];\ - ((uchar*) (T))[2]= ((const uchar*) &V)[1];\ - ((uchar*) (T))[3]= ((const uchar*) &V)[0];\ - ((uchar*) (T))[4]= ((const uchar*) &V)[7];\ - ((uchar*) (T))[5]= ((const uchar*) &V)[6];\ - ((uchar*) (T))[6]= ((const uchar*) &V)[5];\ - ((uchar*) (T))[7]= ((const uchar*) &V)[4];} - -#define mi_float8get(V,M) { double def_temp;\ - ((uchar*) &def_temp)[0]= ((const uchar*) (M))[3];\ - ((uchar*) &def_temp)[1]= ((const uchar*) (M))[2];\ - ((uchar*) &def_temp)[2]= ((const uchar*) (M))[1];\ - ((uchar*) &def_temp)[3]= ((const uchar*) (M))[0];\ - ((uchar*) &def_temp)[4]= ((const uchar*) (M))[7];\ - ((uchar*) &def_temp)[5]= ((const uchar*) (M))[6];\ - ((uchar*) &def_temp)[6]= ((const uchar*) (M))[5];\ - ((uchar*) &def_temp)[7]= ((const uchar*) (M))[4];\ - (V)= def_temp; } - -#else -#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((const uchar*) &V)[7];\ - ((uchar*) (T))[1]= ((const uchar*) &V)[6];\ - ((uchar*) (T))[2]= ((const uchar*) &V)[5];\ - ((uchar*) (T))[3]= ((const uchar*) &V)[4];\ - ((uchar*) (T))[4]= ((const uchar*) &V)[3];\ - ((uchar*) (T))[5]= ((const uchar*) &V)[2];\ - ((uchar*) (T))[6]= ((const uchar*) &V)[1];\ - ((uchar*) (T))[7]= ((const uchar*) &V)[0];} - -#define mi_float8get(V,M) { double def_temp;\ - ((uchar*) &def_temp)[0]= ((const uchar*) (M))[7];\ - ((uchar*) &def_temp)[1]= ((const uchar*) (M))[6];\ - ((uchar*) &def_temp)[2]= ((const uchar*) (M))[5];\ - ((uchar*) &def_temp)[3]= ((const uchar*) (M))[4];\ - ((uchar*) &def_temp)[4]= ((const uchar*) (M))[3];\ - ((uchar*) &def_temp)[5]= ((const uchar*) (M))[2];\ - ((uchar*) &def_temp)[6]= ((const uchar*) (M))[1];\ - ((uchar*) &def_temp)[7]= ((const uchar*) (M))[0];\ - (V)= def_temp; } -#endif /* __FLOAT_WORD_ORDER */ -#endif /* WORDS_BIGENDIAN */ - -/* Fix to avoid warnings when sizeof(ha_rows) == sizeof(long) */ - -#ifdef BIG_TABLES -#define mi_rowstore(T,A) mi_int8store(T, A) -#define mi_rowkorr(T) mi_uint8korr(T) -#else -#define mi_rowstore(T,A) { mi_int4store(T, 0);\ - mi_int4store(((uchar*) (T) + 4), A); } -#define mi_rowkorr(T) mi_uint4korr((const uchar*) (T) + 4) -#endif - -#if SIZEOF_OFF_T > 4 -#define mi_sizestore(T,A) mi_int8store(T, A) -#define mi_sizekorr(T) mi_uint8korr(T) -#else -#define mi_sizestore(T,A) { if ((A) == HA_OFFSET_ERROR)\ - bfill((char*) (T), 8, 255);\ - else { mi_int4store((T), 0);\ - mi_int4store(((T) + 4), A); }} -#define mi_sizekorr(T) mi_uint4korr((const uchar*) (T) + 4) -#endif -#endif /* MYISAMPACK_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysql_async.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysql_async.h deleted file mode 100644 index 3e4cb35..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysql_async.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2012 MariaDB Services and Kristian Nielsen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Common definitions for MariaDB non-blocking client library. */ - -#ifndef MYSQL_ASYNC_H -#define MYSQL_ASYNC_H - -extern int my_connect_async(struct mysql_async_context *b, my_socket fd, - const struct sockaddr *name, uint namelen, - int vio_timeout); -extern ssize_t my_recv_async(struct mysql_async_context *b, my_socket fd, - unsigned char *buf, size_t size, int timeout); -extern ssize_t my_send_async(struct mysql_async_context *b, my_socket fd, - const unsigned char *buf, size_t size, - int timeout); -extern my_bool my_io_wait_async(struct mysql_async_context *b, - enum enum_vio_io_event event, int timeout); -#ifdef HAVE_OPENSSL -extern int my_ssl_read_async(struct mysql_async_context *b, SSL *ssl, - void *buf, int size); -extern int my_ssl_write_async(struct mysql_async_context *b, SSL *ssl, - const void *buf, int size); -#endif - -#endif /* MYSQL_ASYNC_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysqld.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysqld.h deleted file mode 100644 index e8dd570..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysqld.h +++ /dev/null @@ -1,961 +0,0 @@ -/* Copyright (c) 2006, 2016, Oracle and/or its affiliates. - Copyright (c) 2010, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef MYSQLD_INCLUDED -#define MYSQLD_INCLUDED - -#include "sql_basic_types.h" /* query_id_t */ -#include "sql_mode.h" /* Sql_mode_dependency */ -#include "sql_plugin.h" -#include "sql_bitmap.h" /* Bitmap */ -#include "my_decimal.h" /* my_decimal */ -#include "mysql_com.h" /* SERVER_VERSION_LENGTH */ -#include "my_counter.h" -#include "mysql/psi/mysql_file.h" /* MYSQL_FILE */ -#include "mysql/psi/mysql_socket.h" /* MYSQL_SOCKET */ -#include "sql_list.h" /* I_List */ -#include "sql_cmd.h" -#include -#include "my_pthread.h" -#include "my_rdtsc.h" - -class THD; -class CONNECT; -struct handlerton; -class Time_zone; - -struct scheduler_functions; - -typedef struct st_mysql_show_var SHOW_VAR; - -/* Bits from testflag */ -#define TEST_PRINT_CACHED_TABLES 1U -#define TEST_NO_KEY_GROUP 2U -#define TEST_MIT_THREAD 4U -#define TEST_BLOCKING 8U -#define TEST_KEEP_TMP_TABLES 16U -#define TEST_READCHECK 64U /**< Force use of readcheck */ -#define TEST_NO_EXTRA 128U -#define TEST_CORE_ON_SIGNAL 256U /**< Give core if signal */ -#define TEST_SIGINT 1024U /**< Allow sigint on threads */ -#define TEST_SYNCHRONIZATION 2048U /**< get server to do sleep in - some places */ - -/* Keep things compatible */ -#define OPT_DEFAULT SHOW_OPT_DEFAULT -#define OPT_SESSION SHOW_OPT_SESSION -#define OPT_GLOBAL SHOW_OPT_GLOBAL - -extern MYSQL_PLUGIN_IMPORT MY_TIMER_INFO sys_timer_info; - -/* - Values for --slave-parallel-mode - Must match order in slave_parallel_mode_typelib in sys_vars.cc. -*/ -enum enum_slave_parallel_mode { - SLAVE_PARALLEL_NONE, - SLAVE_PARALLEL_MINIMAL, - SLAVE_PARALLEL_CONSERVATIVE, - SLAVE_PARALLEL_OPTIMISTIC, - SLAVE_PARALLEL_AGGRESSIVE -}; - -/* Function prototypes */ -void kill_mysql(THD *thd); -void close_connection(THD *thd, uint sql_errno= 0); -void handle_connection_in_main_thread(CONNECT *thd); -void create_thread_to_handle_connection(CONNECT *connect); -void unlink_thd(THD *thd); -void refresh_status(THD *thd); -bool is_secure_file_path(char *path); -extern void init_net_server_extension(THD *thd); -extern void handle_accepted_socket(MYSQL_SOCKET new_sock, MYSQL_SOCKET sock); -extern void create_new_thread(CONNECT *connect); - -extern void ssl_acceptor_stats_update(int sslaccept_ret); -extern int reinit_ssl(); - -extern "C" MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info; -extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *files_charset_info ; -extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *national_charset_info; -extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *table_alias_charset; - -/** - Character set of the buildin error messages loaded from errmsg.sys. -*/ -extern CHARSET_INFO *error_message_charset_info; - -extern CHARSET_INFO *character_set_filesystem; - -extern MY_BITMAP temp_pool; -extern bool opt_large_files; -extern bool opt_update_log, opt_bin_log, opt_error_log, opt_bin_log_compress; -extern uint opt_bin_log_compress_min_len; -extern my_bool opt_log, opt_bootstrap; -extern my_bool opt_backup_history_log; -extern my_bool opt_backup_progress_log; -extern my_bool opt_support_flashback; -extern ulonglong log_output_options; -extern ulong log_backup_output_options; -extern bool opt_disable_networking, opt_skip_show_db; -extern bool opt_skip_name_resolve; -extern bool opt_ignore_builtin_innodb; -extern my_bool opt_character_set_client_handshake; -extern my_bool debug_assert_on_not_freed_memory; -extern MYSQL_PLUGIN_IMPORT bool volatile abort_loop; -extern Atomic_counter connection_count; -extern my_bool opt_safe_user_create; -extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap; -extern my_bool opt_slave_compressed_protocol, use_temp_pool; -extern ulong slave_exec_mode_options, slave_ddl_exec_mode_options; -extern ulong slave_retried_transactions; -extern ulong transactions_multi_engine; -extern ulong rpl_transactions_multi_engine; -extern ulong transactions_gtid_foreign_engine; -extern ulong slave_run_triggers_for_rbr; -extern ulonglong slave_type_conversions_options; -extern my_bool read_only, opt_readonly; -extern MYSQL_PLUGIN_IMPORT my_bool lower_case_file_system; -extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs; -extern my_bool opt_secure_auth; -extern my_bool opt_require_secure_transport; -extern const char *current_dbug_option; -extern char* opt_secure_file_priv; -extern char* opt_secure_backup_file_priv; -extern size_t opt_secure_backup_file_priv_len; -extern my_bool sp_automatic_privileges, opt_noacl; -extern ulong use_stat_tables; -extern my_bool opt_old_style_user_limits, trust_function_creators; -extern uint opt_crash_binlog_innodb; -extern const char *shared_memory_base_name; -extern MYSQL_PLUGIN_IMPORT char *mysqld_unix_port; -extern my_bool opt_enable_shared_memory; -extern ulong opt_replicate_events_marked_for_skip; -extern char *default_tz_name; -extern Time_zone *default_tz; -extern char *my_bind_addr_str; -extern int server_socket_ai_family; -extern char *default_storage_engine, *default_tmp_storage_engine; -extern char *enforced_storage_engine; -extern char *gtid_pos_auto_engines; -extern plugin_ref *opt_gtid_pos_auto_plugins; -extern bool opt_endinfo, using_udf_functions; -extern my_bool locked_in_memory; -extern bool opt_using_transactions; -extern ulong current_pid; -extern ulong expire_logs_days; -extern my_bool relay_log_recovery; -extern uint sync_binlog_period, sync_relaylog_period, - sync_relayloginfo_period, sync_masterinfo_period; -extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size; -extern ulong tc_log_page_waits; -extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb; -extern my_bool relay_log_recovery; -extern uint select_errors,ha_open_options; -extern ulonglong test_flags; -extern uint protocol_version, dropping_tables; -extern MYSQL_PLUGIN_IMPORT uint mysqld_port; -extern ulong delay_key_write_options; -extern char *opt_logname, *opt_slow_logname, *opt_bin_logname, - *opt_relay_logname; -extern char *opt_binlog_index_name; -extern char *opt_backup_history_logname, *opt_backup_progress_logname, - *opt_backup_settings_name; -extern const char *log_output_str; -extern const char *log_backup_output_str; - -/* System Versioning begin */ -enum vers_system_time_t -{ - SYSTEM_TIME_UNSPECIFIED = 0, - SYSTEM_TIME_AS_OF, - SYSTEM_TIME_FROM_TO, - SYSTEM_TIME_BETWEEN, - SYSTEM_TIME_BEFORE, // used for DELETE HISTORY ... BEFORE - SYSTEM_TIME_HISTORY, // used for DELETE HISTORY - SYSTEM_TIME_ALL -}; - -struct vers_asof_timestamp_t -{ - ulong type; - MYSQL_TIME ltime; -}; - -enum vers_alter_history_enum -{ - VERS_ALTER_HISTORY_ERROR= 0, - VERS_ALTER_HISTORY_KEEP -}; -/* System Versioning end */ - -extern char *mysql_home_ptr, *pidfile_name_ptr; -extern MYSQL_PLUGIN_IMPORT char glob_hostname[FN_REFLEN]; -extern char mysql_home[FN_REFLEN]; -extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file; -extern char default_logfile_name[FN_REFLEN]; -extern char log_error_file[FN_REFLEN], *opt_tc_log_file; -extern const double log_10[309]; -extern ulonglong keybuff_size; -extern ulonglong thd_startup_options; -extern my_thread_id global_thread_id; -extern ulong binlog_cache_use, binlog_cache_disk_use; -extern ulong binlog_stmt_cache_use, binlog_stmt_cache_disk_use; -extern ulong aborted_threads, aborted_connects, aborted_connects_preauth; -extern ulong delayed_insert_timeout; -extern ulong delayed_insert_limit, delayed_queue_size; -extern ulong delayed_insert_threads, delayed_insert_writes; -extern ulong delayed_rows_in_use,delayed_insert_errors; -extern Atomic_counter slave_open_temp_tables; -extern ulonglong query_cache_size; -extern ulong query_cache_limit; -extern ulong query_cache_min_res_unit; -extern ulong slow_launch_threads, slow_launch_time; -extern MYSQL_PLUGIN_IMPORT ulong max_connections; -extern uint max_digest_length; -extern ulong max_connect_errors, connect_timeout; -extern uint max_password_errors; -extern my_bool slave_allow_batching; -extern my_bool allow_slave_start; -extern LEX_CSTRING reason_slave_blocked; -extern ulong slave_trans_retries; -extern ulong slave_trans_retry_interval; -extern uint slave_net_timeout; -extern int max_user_connections; -extern ulong what_to_log,flush_time; -extern uint max_prepared_stmt_count, prepared_stmt_count; -extern MYSQL_PLUGIN_IMPORT ulong open_files_limit; -extern ulonglong binlog_cache_size, binlog_stmt_cache_size, binlog_file_cache_size; -extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size; -extern ulong max_binlog_size; -extern ulong slave_max_allowed_packet; -extern ulong opt_binlog_rows_event_max_size; -extern ulong binlog_row_metadata; -extern ulong thread_cache_size; -extern ulong stored_program_cache_size; -extern ulong opt_slave_parallel_threads; -extern ulong opt_slave_domain_parallel_threads; -extern ulong opt_slave_parallel_max_queued; -extern ulong opt_slave_parallel_mode; -extern ulong opt_binlog_commit_wait_count; -extern ulong opt_binlog_commit_wait_usec; -extern my_bool opt_gtid_ignore_duplicates; -extern uint opt_gtid_cleanup_batch_size; -extern ulong back_log; -extern ulong executed_events; -extern char language[FN_REFLEN]; -extern "C" MYSQL_PLUGIN_IMPORT ulong server_id; -extern ulong concurrency; -extern time_t server_start_time, flush_status_time; -extern char *opt_mysql_tmpdir, mysql_charsets_dir[]; -extern size_t mysql_unpacked_real_data_home_len; -extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list; -extern const char *first_keyword, *delayed_user; -extern MYSQL_PLUGIN_IMPORT const char *my_localhost; -extern MYSQL_PLUGIN_IMPORT const char **errmesg; /* Error messages */ -extern const char *myisam_recover_options_str; -extern const LEX_CSTRING in_left_expr_name, in_additional_cond, in_having_cond; -extern SHOW_VAR status_vars[]; -extern struct system_variables max_system_variables; -extern struct system_status_var global_status_var; -extern struct my_rnd_struct sql_rand; -extern const char *opt_date_time_formats[]; -extern handlerton *partition_hton; -extern handlerton *myisam_hton; -extern handlerton *heap_hton; -extern const char *load_default_groups[]; -extern struct my_option my_long_options[]; -int handle_early_options(); -extern int MYSQL_PLUGIN_IMPORT mysqld_server_started; -extern int mysqld_server_initialized; -extern "C" MYSQL_PLUGIN_IMPORT int orig_argc; -extern "C" MYSQL_PLUGIN_IMPORT char **orig_argv; -extern pthread_attr_t connection_attrib; -extern my_bool old_mode; -extern LEX_STRING opt_init_connect, opt_init_slave; -extern char err_shared_dir[]; -extern ulong connection_errors_select; -extern ulong connection_errors_accept; -extern ulong connection_errors_tcpwrap; -extern ulong connection_errors_internal; -extern ulong connection_errors_max_connection; -extern ulong connection_errors_peer_addr; -extern ulong log_warnings; -extern my_bool encrypt_binlog; -extern my_bool encrypt_tmp_disk_tables, encrypt_tmp_files; -extern ulong encryption_algorithm; -extern const char *encryption_algorithm_names[]; -extern long opt_secure_timestamp; -extern uint default_password_lifetime; -extern my_bool disconnect_on_expired_password; - -enum secure_timestamp { SECTIME_NO, SECTIME_SUPER, SECTIME_REPL, SECTIME_YES }; - -#ifdef HAVE_MMAP -extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, - key_LOCK_pool, key_LOCK_pending_checkpoint; -#endif /* HAVE_MMAP */ - -#ifdef HAVE_OPENSSL -extern PSI_mutex_key key_LOCK_des_key_file; -#endif - -extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list, - key_BINLOG_LOCK_binlog_background_thread, - key_LOCK_binlog_end_pos, - key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi, - key_LOCK_crypt, key_LOCK_delayed_create, - key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log, - key_LOCK_gdl, key_LOCK_global_system_variables, - key_LOCK_logger, key_LOCK_manager, - key_LOCK_prepared_stmt_count, - key_LOCK_rpl_status, key_LOCK_server_started, - key_LOCK_status, - key_LOCK_thd_data, key_LOCK_thd_kill, - key_LOCK_user_conn, key_LOG_LOCK_log, - key_master_info_data_lock, key_master_info_run_lock, - key_master_info_sleep_lock, key_master_info_start_stop_lock, - key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock, - key_relay_log_info_log_space_lock, key_relay_log_info_run_lock, - key_rpl_group_info_sleep_lock, - key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data, - key_LOCK_start_thread, - key_LOCK_error_messages, - key_PARTITION_LOCK_auto_inc; -extern PSI_mutex_key key_RELAYLOG_LOCK_index; -extern PSI_mutex_key key_LOCK_relaylog_end_pos; -extern PSI_mutex_key key_LOCK_slave_state, key_LOCK_binlog_state, - key_LOCK_rpl_thread, key_LOCK_rpl_thread_pool, key_LOCK_parallel_entry; - -extern PSI_mutex_key key_TABLE_SHARE_LOCK_share, key_LOCK_stats, - key_LOCK_global_user_client_stats, key_LOCK_global_table_stats, - key_LOCK_global_index_stats, key_LOCK_wakeup_ready, key_LOCK_wait_commit, - key_TABLE_SHARE_LOCK_rotation; -extern PSI_mutex_key key_LOCK_gtid_waiting; - -extern PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger, - key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave, - key_rwlock_LOCK_system_variables_hash, key_rwlock_query_cache_query_lock, - key_LOCK_SEQUENCE, - key_rwlock_LOCK_vers_stats, key_rwlock_LOCK_stat_serial, - key_rwlock_THD_list; - -#ifdef HAVE_MMAP -extern PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool; -#endif /* HAVE_MMAP */ - -extern PSI_cond_key key_BINLOG_COND_xid_list, key_BINLOG_update_cond, - key_BINLOG_COND_binlog_background_thread, - key_BINLOG_COND_binlog_background_thread_end, - key_COND_cache_status_changed, key_COND_manager, - key_COND_rpl_status, key_COND_server_started, - key_delayed_insert_cond, key_delayed_insert_cond_client, - key_item_func_sleep_cond, key_master_info_data_cond, - key_master_info_start_cond, key_master_info_stop_cond, - key_master_info_sleep_cond, - key_relay_log_info_data_cond, key_relay_log_info_log_space_cond, - key_relay_log_info_start_cond, key_relay_log_info_stop_cond, - key_rpl_group_info_sleep_cond, - key_TABLE_SHARE_cond, key_user_level_lock_cond, - key_COND_start_thread; -extern PSI_cond_key key_RELAYLOG_COND_relay_log_updated, - key_RELAYLOG_COND_bin_log_updated, key_COND_wakeup_ready, - key_COND_wait_commit; -extern PSI_cond_key key_RELAYLOG_COND_queue_busy; -extern PSI_cond_key key_TC_LOG_MMAP_COND_queue_busy; -extern PSI_cond_key key_COND_rpl_thread, key_COND_rpl_thread_queue, - key_COND_rpl_thread_stop, key_COND_rpl_thread_pool, - key_COND_parallel_entry, key_COND_group_commit_orderer; -extern PSI_cond_key key_COND_wait_gtid, key_COND_gtid_ignore_duplicates; -extern PSI_cond_key key_TABLE_SHARE_COND_rotation; - -extern PSI_thread_key key_thread_delayed_insert, - key_thread_handle_manager, key_thread_kill_server, key_thread_main, - key_thread_one_connection, key_thread_signal_hand, - key_thread_slave_background, key_rpl_parallel_thread; - -extern PSI_file_key key_file_binlog, key_file_binlog_cache, - key_file_binlog_index, key_file_binlog_index_cache, key_file_casetest, - key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file, - key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load, - key_file_loadfile, key_file_log_event_data, key_file_log_event_info, - key_file_master_info, key_file_misc, key_file_partition_ddl_log, - key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog, - key_file_trg, key_file_trn, key_file_init; -extern PSI_file_key key_file_query_log, key_file_slow_log; -extern PSI_file_key key_file_relaylog, key_file_relaylog_index, - key_file_relaylog_cache, key_file_relaylog_index_cache; -extern PSI_socket_key key_socket_tcpip, key_socket_unix, - key_socket_client_connection; -extern PSI_file_key key_file_binlog_state; - -#ifdef HAVE_PSI_INTERFACE -void init_server_psi_keys(); -#endif /* HAVE_PSI_INTERFACE */ - -extern PSI_memory_key key_memory_locked_table_list; -extern PSI_memory_key key_memory_locked_thread_list; -extern PSI_memory_key key_memory_thd_transactions; -extern PSI_memory_key key_memory_delegate; -extern PSI_memory_key key_memory_acl_mem; -extern PSI_memory_key key_memory_acl_memex; -extern PSI_memory_key key_memory_acl_cache; -extern PSI_memory_key key_memory_thd_main_mem_root; -extern PSI_memory_key key_memory_help; -extern PSI_memory_key key_memory_frm; -extern PSI_memory_key key_memory_table_share; -extern PSI_memory_key key_memory_gdl; -extern PSI_memory_key key_memory_table_triggers_list; -extern PSI_memory_key key_memory_prepared_statement_map; -extern PSI_memory_key key_memory_prepared_statement_main_mem_root; -extern PSI_memory_key key_memory_protocol_rset_root; -extern PSI_memory_key key_memory_warning_info_warn_root; -extern PSI_memory_key key_memory_sp_cache; -extern PSI_memory_key key_memory_sp_head_main_root; -extern PSI_memory_key key_memory_sp_head_execute_root; -extern PSI_memory_key key_memory_sp_head_call_root; -extern PSI_memory_key key_memory_table_mapping_root; -extern PSI_memory_key key_memory_quick_range_select_root; -extern PSI_memory_key key_memory_quick_index_merge_root; -extern PSI_memory_key key_memory_quick_ror_intersect_select_root; -extern PSI_memory_key key_memory_quick_ror_union_select_root; -extern PSI_memory_key key_memory_quick_group_min_max_select_root; -extern PSI_memory_key key_memory_test_quick_select_exec; -extern PSI_memory_key key_memory_prune_partitions_exec; -extern PSI_memory_key key_memory_binlog_recover_exec; -extern PSI_memory_key key_memory_blob_mem_storage; - -extern PSI_memory_key key_memory_Sys_var_charptr_value; -extern PSI_memory_key key_memory_THD_db; -extern PSI_memory_key key_memory_user_var_entry; -extern PSI_memory_key key_memory_user_var_entry_value; -extern PSI_memory_key key_memory_Slave_job_group_group_relay_log_name; -extern PSI_memory_key key_memory_Relay_log_info_group_relay_log_name; -extern PSI_memory_key key_memory_binlog_cache_mngr; -extern PSI_memory_key key_memory_Row_data_memory_memory; -extern PSI_memory_key key_memory_errmsgs; -extern PSI_memory_key key_memory_Event_queue_element_for_exec_names; -extern PSI_memory_key key_memory_Event_scheduler_scheduler_param; -extern PSI_memory_key key_memory_Gis_read_stream_err_msg; -extern PSI_memory_key key_memory_Geometry_objects_data; -extern PSI_memory_key key_memory_host_cache_hostname; -extern PSI_memory_key key_memory_User_level_lock; -extern PSI_memory_key key_memory_Filesort_info_record_pointers; -extern PSI_memory_key key_memory_Sort_param_tmp_buffer; -extern PSI_memory_key key_memory_Filesort_info_merge; -extern PSI_memory_key key_memory_Filesort_buffer_sort_keys; -extern PSI_memory_key key_memory_handler_errmsgs; -extern PSI_memory_key key_memory_handlerton; -extern PSI_memory_key key_memory_XID; -extern PSI_memory_key key_memory_MYSQL_LOCK; -extern PSI_memory_key key_memory_MYSQL_LOG_name; -extern PSI_memory_key key_memory_TC_LOG_MMAP_pages; -extern PSI_memory_key key_memory_my_str_malloc; -extern PSI_memory_key key_memory_MYSQL_BIN_LOG_basename; -extern PSI_memory_key key_memory_MYSQL_BIN_LOG_index; -extern PSI_memory_key key_memory_MYSQL_RELAY_LOG_basename; -extern PSI_memory_key key_memory_MYSQL_RELAY_LOG_index; -extern PSI_memory_key key_memory_rpl_filter; -extern PSI_memory_key key_memory_Security_context; -extern PSI_memory_key key_memory_NET_buff; -extern PSI_memory_key key_memory_NET_compress_packet; -extern PSI_memory_key key_memory_my_bitmap_map; -extern PSI_memory_key key_memory_QUICK_RANGE_SELECT_mrr_buf_desc; -extern PSI_memory_key key_memory_TABLE_RULE_ENT; -extern PSI_memory_key key_memory_Mutex_cond_array_Mutex_cond; -extern PSI_memory_key key_memory_Owned_gtids_sidno_to_hash; -extern PSI_memory_key key_memory_Sid_map_Node; -extern PSI_memory_key key_memory_bison_stack; -extern PSI_memory_key key_memory_TABLE_sort_io_cache; -extern PSI_memory_key key_memory_DATE_TIME_FORMAT; -extern PSI_memory_key key_memory_DDL_LOG_MEMORY_ENTRY; -extern PSI_memory_key key_memory_ST_SCHEMA_TABLE; -extern PSI_memory_key key_memory_ignored_db; -extern PSI_memory_key key_memory_SLAVE_INFO; -extern PSI_memory_key key_memory_log_event_old; -extern PSI_memory_key key_memory_HASH_ROW_ENTRY; -extern PSI_memory_key key_memory_table_def_memory; -extern PSI_memory_key key_memory_MPVIO_EXT_auth_info; -extern PSI_memory_key key_memory_LOG_POS_COORD; -extern PSI_memory_key key_memory_XID_STATE; -extern PSI_memory_key key_memory_Rpl_info_file_buffer; -extern PSI_memory_key key_memory_Rpl_info_table; -extern PSI_memory_key key_memory_binlog_pos; -extern PSI_memory_key key_memory_db_worker_hash_entry; -extern PSI_memory_key key_memory_rpl_slave_command_buffer; -extern PSI_memory_key key_memory_binlog_ver_1_event; -extern PSI_memory_key key_memory_rpl_slave_check_temp_dir; -extern PSI_memory_key key_memory_TABLE; -extern PSI_memory_key key_memory_binlog_statement_buffer; -extern PSI_memory_key key_memory_user_conn; -extern PSI_memory_key key_memory_dboptions_hash; -extern PSI_memory_key key_memory_hash_index_key_buffer; -extern PSI_memory_key key_memory_THD_handler_tables_hash; -extern PSI_memory_key key_memory_JOIN_CACHE; -extern PSI_memory_key key_memory_READ_INFO; -extern PSI_memory_key key_memory_partition_syntax_buffer; -extern PSI_memory_key key_memory_global_system_variables; -extern PSI_memory_key key_memory_THD_variables; -extern PSI_memory_key key_memory_PROFILE; -extern PSI_memory_key key_memory_LOG_name; -extern PSI_memory_key key_memory_string_iterator; -extern PSI_memory_key key_memory_frm_extra_segment_buff; -extern PSI_memory_key key_memory_frm_form_pos; -extern PSI_memory_key key_memory_frm_string; -extern PSI_memory_key key_memory_Unique_sort_buffer; -extern PSI_memory_key key_memory_Unique_merge_buffer; -extern PSI_memory_key key_memory_shared_memory_name; -extern PSI_memory_key key_memory_opt_bin_logname; -extern PSI_memory_key key_memory_Query_cache; -extern PSI_memory_key key_memory_READ_RECORD_cache; -extern PSI_memory_key key_memory_Quick_ranges; -extern PSI_memory_key key_memory_File_query_log_name; -extern PSI_memory_key key_memory_Table_trigger_dispatcher; -extern PSI_memory_key key_memory_show_slave_status_io_gtid_set; -extern PSI_memory_key key_memory_write_set_extraction; -extern PSI_memory_key key_memory_thd_timer; -extern PSI_memory_key key_memory_THD_Session_tracker; -extern PSI_memory_key key_memory_THD_Session_sysvar_resource_manager; -extern PSI_memory_key key_memory_get_all_tables; -extern PSI_memory_key key_memory_fill_schema_schemata; -extern PSI_memory_key key_memory_native_functions; -extern PSI_memory_key key_memory_JSON; - -/* - MAINTAINER: Please keep this list in order, to limit merge collisions. - Hint: grep PSI_stage_info | sort -u -*/ -extern PSI_stage_info stage_apply_event; -extern PSI_stage_info stage_after_create; -extern PSI_stage_info stage_after_opening_tables; -extern PSI_stage_info stage_after_table_lock; -extern PSI_stage_info stage_allocating_local_table; -extern PSI_stage_info stage_alter_inplace_prepare; -extern PSI_stage_info stage_alter_inplace; -extern PSI_stage_info stage_alter_inplace_commit; -extern PSI_stage_info stage_after_apply_event; -extern PSI_stage_info stage_changing_master; -extern PSI_stage_info stage_checking_master_version; -extern PSI_stage_info stage_checking_permissions; -extern PSI_stage_info stage_checking_privileges_on_cached_query; -extern PSI_stage_info stage_checking_query_cache_for_query; -extern PSI_stage_info stage_cleaning_up; -extern PSI_stage_info stage_closing_tables; -extern PSI_stage_info stage_connecting_to_master; -extern PSI_stage_info stage_converting_heap_to_myisam; -extern PSI_stage_info stage_copying_to_group_table; -extern PSI_stage_info stage_copying_to_tmp_table; -extern PSI_stage_info stage_copy_to_tmp_table; -extern PSI_stage_info stage_creating_delayed_handler; -extern PSI_stage_info stage_creating_sort_index; -extern PSI_stage_info stage_creating_table; -extern PSI_stage_info stage_creating_tmp_table; -extern PSI_stage_info stage_deleting_from_main_table; -extern PSI_stage_info stage_deleting_from_reference_tables; -extern PSI_stage_info stage_discard_or_import_tablespace; -extern PSI_stage_info stage_end; -extern PSI_stage_info stage_enabling_keys; -extern PSI_stage_info stage_executing; -extern PSI_stage_info stage_execution_of_init_command; -extern PSI_stage_info stage_explaining; -extern PSI_stage_info stage_finding_key_cache; -extern PSI_stage_info stage_finished_reading_one_binlog_switching_to_next_binlog; -extern PSI_stage_info stage_flushing_relay_log_and_master_info_repository; -extern PSI_stage_info stage_flushing_relay_log_info_file; -extern PSI_stage_info stage_freeing_items; -extern PSI_stage_info stage_fulltext_initialization; -extern PSI_stage_info stage_got_handler_lock; -extern PSI_stage_info stage_got_old_table; -extern PSI_stage_info stage_init; -extern PSI_stage_info stage_init_update; -extern PSI_stage_info stage_insert; -extern PSI_stage_info stage_invalidating_query_cache_entries_table; -extern PSI_stage_info stage_invalidating_query_cache_entries_table_list; -extern PSI_stage_info stage_killing_slave; -extern PSI_stage_info stage_logging_slow_query; -extern PSI_stage_info stage_making_temp_file_append_before_load_data; -extern PSI_stage_info stage_making_temp_file_create_before_load_data; -extern PSI_stage_info stage_manage_keys; -extern PSI_stage_info stage_master_has_sent_all_binlog_to_slave; -extern PSI_stage_info stage_opening_tables; -extern PSI_stage_info stage_optimizing; -extern PSI_stage_info stage_preparing; -extern PSI_stage_info stage_purging_old_relay_logs; -extern PSI_stage_info stage_query_end; -extern PSI_stage_info stage_starting_cleanup; -extern PSI_stage_info stage_rollback; -extern PSI_stage_info stage_rollback_implicit; -extern PSI_stage_info stage_commit; -extern PSI_stage_info stage_commit_implicit; -extern PSI_stage_info stage_queueing_master_event_to_the_relay_log; -extern PSI_stage_info stage_reading_event_from_the_relay_log; -extern PSI_stage_info stage_recreating_table; -extern PSI_stage_info stage_registering_slave_on_master; -extern PSI_stage_info stage_removing_duplicates; -extern PSI_stage_info stage_removing_tmp_table; -extern PSI_stage_info stage_rename; -extern PSI_stage_info stage_rename_result_table; -extern PSI_stage_info stage_requesting_binlog_dump; -extern PSI_stage_info stage_reschedule; -extern PSI_stage_info stage_searching_rows_for_update; -extern PSI_stage_info stage_sending_binlog_event_to_slave; -extern PSI_stage_info stage_sending_cached_result_to_client; -extern PSI_stage_info stage_sending_data; -extern PSI_stage_info stage_setup; -extern PSI_stage_info stage_slave_has_read_all_relay_log; -extern PSI_stage_info stage_show_explain; -extern PSI_stage_info stage_sorting; -extern PSI_stage_info stage_sorting_for_group; -extern PSI_stage_info stage_sorting_for_order; -extern PSI_stage_info stage_sorting_result; -extern PSI_stage_info stage_sql_thd_waiting_until_delay; -extern PSI_stage_info stage_statistics; -extern PSI_stage_info stage_storing_result_in_query_cache; -extern PSI_stage_info stage_storing_row_into_queue; -extern PSI_stage_info stage_system_lock; -extern PSI_stage_info stage_unlocking_tables; -extern PSI_stage_info stage_table_lock; -extern PSI_stage_info stage_filling_schema_table; -extern PSI_stage_info stage_update; -extern PSI_stage_info stage_updating; -extern PSI_stage_info stage_updating_main_table; -extern PSI_stage_info stage_updating_reference_tables; -extern PSI_stage_info stage_upgrading_lock; -extern PSI_stage_info stage_user_lock; -extern PSI_stage_info stage_user_sleep; -extern PSI_stage_info stage_verifying_table; -extern PSI_stage_info stage_waiting_for_delay_list; -extern PSI_stage_info stage_waiting_for_gtid_to_be_written_to_binary_log; -extern PSI_stage_info stage_waiting_for_handler_insert; -extern PSI_stage_info stage_waiting_for_handler_lock; -extern PSI_stage_info stage_waiting_for_handler_open; -extern PSI_stage_info stage_waiting_for_insert; -extern PSI_stage_info stage_waiting_for_master_to_send_event; -extern PSI_stage_info stage_waiting_for_master_update; -extern PSI_stage_info stage_waiting_for_relay_log_space; -extern PSI_stage_info stage_waiting_for_slave_mutex_on_exit; -extern PSI_stage_info stage_waiting_for_slave_thread_to_start; -extern PSI_stage_info stage_waiting_for_query_cache_lock; -extern PSI_stage_info stage_waiting_for_table_flush; -extern PSI_stage_info stage_waiting_for_the_next_event_in_relay_log; -extern PSI_stage_info stage_waiting_for_the_slave_thread_to_advance_position; -extern PSI_stage_info stage_waiting_to_finalize_termination; -extern PSI_stage_info stage_binlog_waiting_background_tasks; -extern PSI_stage_info stage_binlog_write; -extern PSI_stage_info stage_binlog_processing_checkpoint_notify; -extern PSI_stage_info stage_binlog_stopping_background_thread; -extern PSI_stage_info stage_waiting_for_work_from_sql_thread; -extern PSI_stage_info stage_waiting_for_prior_transaction_to_commit; -extern PSI_stage_info stage_waiting_for_prior_transaction_to_start_commit; -extern PSI_stage_info stage_waiting_for_room_in_worker_thread; -extern PSI_stage_info stage_waiting_for_workers_idle; -extern PSI_stage_info stage_waiting_for_ftwrl; -extern PSI_stage_info stage_waiting_for_ftwrl_threads_to_pause; -extern PSI_stage_info stage_waiting_for_rpl_thread_pool; -extern PSI_stage_info stage_master_gtid_wait_primary; -extern PSI_stage_info stage_master_gtid_wait; -extern PSI_stage_info stage_gtid_wait_other_connection; -extern PSI_stage_info stage_slave_background_process_request; -extern PSI_stage_info stage_slave_background_wait_request; -extern PSI_stage_info stage_waiting_for_deadlock_kill; -extern PSI_stage_info stage_starting; - -#ifdef HAVE_PSI_STATEMENT_INTERFACE -/** - Statement instrumentation keys (sql). - The last entry, at [SQLCOM_END], is for parsing errors. -*/ -extern PSI_statement_info sql_statement_info[(uint) SQLCOM_END + 1]; - -/** - Statement instrumentation keys (com). - The last entry, at [COM_END], is for packet errors. -*/ -extern PSI_statement_info com_statement_info[(uint) COM_END + 1]; - -/** - Statement instrumentation key for replication. -*/ -extern PSI_statement_info stmt_info_rpl; - -void init_sql_statement_info(); -void init_com_statement_info(); -#endif /* HAVE_PSI_STATEMENT_INTERFACE */ - -#ifndef __WIN__ -extern pthread_t signal_thread; -#endif - -#ifdef HAVE_OPENSSL -extern struct st_VioSSLFd * ssl_acceptor_fd; -#endif /* HAVE_OPENSSL */ - -/* - The following variables were under INNODB_COMPABILITY_HOOKS - */ -extern my_bool opt_large_pages; -extern uint opt_large_page_size; -extern char lc_messages_dir[FN_REFLEN]; -extern char *lc_messages_dir_ptr, *log_error_file_ptr; -extern MYSQL_PLUGIN_IMPORT char reg_ext[FN_EXTLEN]; -extern MYSQL_PLUGIN_IMPORT uint reg_ext_length; -extern MYSQL_PLUGIN_IMPORT uint lower_case_table_names; -extern MYSQL_PLUGIN_IMPORT bool mysqld_embedded; -extern ulong specialflag; -extern uint mysql_data_home_len; -extern uint mysql_real_data_home_len; -extern const char *mysql_real_data_home_ptr; -extern ulong thread_handling; -extern "C" MYSQL_PLUGIN_IMPORT char server_version[SERVER_VERSION_LENGTH]; -extern char *server_version_ptr; -extern bool using_custom_server_version; -extern MYSQL_PLUGIN_IMPORT char mysql_real_data_home[]; -extern char mysql_unpacked_real_data_home[]; -extern MYSQL_PLUGIN_IMPORT struct system_variables global_system_variables; -extern char default_logfile_name[FN_REFLEN]; -extern char *my_proxy_protocol_networks; - -#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list)) - -extern MYSQL_PLUGIN_IMPORT const key_map key_map_empty; -extern MYSQL_PLUGIN_IMPORT key_map key_map_full; /* Should be threaded as const */ - -/* - Server mutex locks and condition variables. - */ -extern mysql_mutex_t - LOCK_item_func_sleep, LOCK_status, - LOCK_error_log, LOCK_delayed_insert, LOCK_short_uuid_generator, - LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone, - LOCK_active_mi, LOCK_manager, LOCK_user_conn, - LOCK_prepared_stmt_count, LOCK_error_messages, - LOCK_slave_background; -extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_global_system_variables; -extern mysql_rwlock_t LOCK_all_status_vars; -extern mysql_mutex_t LOCK_start_thread; -#ifdef HAVE_OPENSSL -extern char* des_key_file; -extern mysql_mutex_t LOCK_des_key_file; -#endif -extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_server_started; -extern MYSQL_PLUGIN_IMPORT mysql_cond_t COND_server_started; -extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; -extern mysql_rwlock_t LOCK_ssl_refresh; -extern mysql_prlock_t LOCK_system_variables_hash; -extern mysql_cond_t COND_start_thread; -extern mysql_cond_t COND_manager; -extern mysql_cond_t COND_slave_background; -extern Atomic_counter thread_count; - -extern my_bool opt_use_ssl; -extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher, - *opt_ssl_key, *opt_ssl_crl, *opt_ssl_crlpath; -extern ulonglong tls_version; - -#ifdef MYSQL_SERVER - -/** - only options that need special treatment in get_one_option() deserve - to be listed below -*/ -enum options_mysqld -{ - OPT_to_set_the_start_number=256, - OPT_BINLOG_DO_DB, - OPT_BINLOG_FORMAT, - OPT_BINLOG_IGNORE_DB, - OPT_BIN_LOG, - OPT_BOOTSTRAP, - OPT_CONSOLE, - OPT_DEBUG_SYNC_TIMEOUT, - OPT_REMOVED_OPTION, - OPT_IGNORE_DB_DIRECTORY, - OPT_ISAM_LOG, - OPT_KEY_BUFFER_SIZE, - OPT_KEY_CACHE_AGE_THRESHOLD, - OPT_KEY_CACHE_BLOCK_SIZE, - OPT_KEY_CACHE_DIVISION_LIMIT, - OPT_KEY_CACHE_PARTITIONS, - OPT_KEY_CACHE_CHANGED_BLOCKS_HASH_SIZE, - OPT_LOG_BASENAME, - OPT_LOG_ERROR, - OPT_LOWER_CASE_TABLE_NAMES, - OPT_PLUGIN_LOAD, - OPT_PLUGIN_LOAD_ADD, - OPT_PFS_INSTRUMENT, - OPT_REPLICATE_DO_DB, - OPT_REPLICATE_DO_TABLE, - OPT_REPLICATE_IGNORE_DB, - OPT_REPLICATE_IGNORE_TABLE, - OPT_REPLICATE_REWRITE_DB, - OPT_REPLICATE_WILD_DO_TABLE, - OPT_REPLICATE_WILD_IGNORE_TABLE, - OPT_SAFE, - OPT_SERVER_ID, - OPT_SILENT, - OPT_SKIP_HOST_CACHE, - OPT_SKIP_RESOLVE, - OPT_SLAVE_PARALLEL_MODE, - OPT_SSL_CA, - OPT_SSL_CAPATH, - OPT_SSL_CERT, - OPT_SSL_CIPHER, - OPT_SSL_CRL, - OPT_SSL_CRLPATH, - OPT_SSL_KEY, - OPT_THREAD_CONCURRENCY, - OPT_WANT_CORE, -#ifdef WITH_WSREP - OPT_WSREP_CAUSAL_READS, - OPT_WSREP_SYNC_WAIT, -#endif /* WITH_WSREP */ - OPT_MYSQL_COMPATIBILITY, - OPT_TLS_VERSION, - OPT_MYSQL_TO_BE_IMPLEMENTED, - OPT_which_is_always_the_last -}; -#endif - -/** - Query type constants (usable as bitmap flags). -*/ -enum enum_query_type -{ - /// Nothing specific, ordinary SQL query. - QT_ORDINARY= 0, - /// In utf8. - QT_TO_SYSTEM_CHARSET= (1 << 0), - /// Without character set introducers. - QT_WITHOUT_INTRODUCERS= (1 << 1), - /// view internal representation (like QT_ORDINARY except ORDER BY clause) - QT_VIEW_INTERNAL= (1 << 2), - /// If identifiers should not include database names, where unambiguous - QT_ITEM_IDENT_SKIP_DB_NAMES= (1 << 3), - /// If identifiers should not include table names, where unambiguous - QT_ITEM_IDENT_SKIP_TABLE_NAMES= (1 << 4), - /// If Item_cache_wrapper should not print - QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS= (1 << 5), - /// If Item_subselect should print as just "(subquery#1)" - /// rather than display the subquery body - QT_ITEM_SUBSELECT_ID_ONLY= (1 << 6), - /// If NULLIF(a,b) should print itself as - /// CASE WHEN a_for_comparison=b THEN NULL ELSE a_for_return_value END - /// when "a" was replaced to two different items - /// (e.g. by equal fields propagation in optimize_cond()) - /// or always as NULLIF(a, b). - /// The default behaviour is to use CASE syntax when - /// a_for_return_value is not the same as a_for_comparison. - /// SHOW CREATE {VIEW|PROCEDURE|FUNCTION} and other cases where the - /// original representation is required, should set this flag. - QT_ITEM_ORIGINAL_FUNC_NULLIF= (1 << 7), - /// good for parsing - QT_PARSABLE= (1 << 8), - - /// This value means focus on readability, not on ability to parse back, etc. - QT_EXPLAIN= QT_TO_SYSTEM_CHARSET | - QT_ITEM_IDENT_SKIP_DB_NAMES | - QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS | - QT_ITEM_SUBSELECT_ID_ONLY, - - QT_SHOW_SELECT_NUMBER= (1<<10), - - /// Do not print database name or table name in the identifiers (even if - /// this means the printout will be ambigous). It is assumed that the caller - /// passing this flag knows what they are doing. - QT_ITEM_IDENT_DISABLE_DB_TABLE_NAMES= (1 <<11), - - /// This is used for EXPLAIN EXTENDED extra warnings / Be more detailed - /// Be more detailed than QT_EXPLAIN. - /// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE - /// here, as it would give better readable results - QT_EXPLAIN_EXTENDED= QT_TO_SYSTEM_CHARSET| - QT_SHOW_SELECT_NUMBER, - - // If an expression is constant, print the expression, not the value - // it evaluates to. Should be used for error messages, so that they - // don't reveal values. - QT_NO_DATA_EXPANSION= (1 << 9), -}; - - -/* query_id */ -extern Atomic_counter global_query_id; - -/* increment query_id and return it. */ -inline __attribute__((warn_unused_result)) query_id_t next_query_id() -{ - return global_query_id++; -} - -inline query_id_t get_query_id() -{ - return global_query_id; -} - -/* increment global_thread_id and return it. */ -extern __attribute__((warn_unused_result)) my_thread_id next_thread_id(void); - -/* - TODO: Replace this with an inline function. - */ -#ifndef EMBEDDED_LIBRARY -extern "C" void unireg_abort(int exit_code) __attribute__((noreturn)); -#else -extern "C" void unireg_clear(int exit_code); -#define unireg_abort(exit_code) do { unireg_clear(exit_code); DBUG_RETURN(exit_code); } while(0) -#endif - -inline void table_case_convert(char * name, uint length) -{ - if (lower_case_table_names) - files_charset_info->casedn(name, length, name, length); -} - -extern void set_server_version(char *buf, size_t size); - -#define current_thd _current_thd() -void set_current_thd(THD *thd); - -/* - @todo remove, make it static in ha_maria.cc - currently it's needed for sql_select.cc -*/ -extern handlerton *maria_hton; - -extern uint64 global_gtid_counter; -extern my_bool opt_gtid_strict_mode; -extern my_bool opt_userstat_running, debug_assert_if_crashed_table; -extern uint mysqld_extra_port; -extern ulong opt_progress_report_time; -extern ulong extra_max_connections; -extern ulonglong denied_connections; -extern ulong thread_created; -extern scheduler_functions *thread_scheduler, *extra_thread_scheduler; -extern char *opt_log_basename; -extern my_bool opt_master_verify_checksum; -extern my_bool opt_stack_trace, disable_log_notes; -extern my_bool opt_expect_abort; -extern my_bool opt_slave_sql_verify_checksum; -extern my_bool opt_mysql56_temporal_format, strict_password_validation; -extern my_bool opt_explicit_defaults_for_timestamp; -extern ulong binlog_checksum_options; -extern bool max_user_connections_checking; -extern ulong opt_binlog_dbug_fsync_sleep; - -extern uint volatile global_disable_checkpoint; -extern my_bool opt_help; - -#endif /* MYSQLD_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysqld_default_groups.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysqld_default_groups.h deleted file mode 100644 index cf6e92e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysqld_default_groups.h +++ /dev/null @@ -1,9 +0,0 @@ -const char *load_default_groups[]= { -"mysqld", "server", MYSQL_BASE_VERSION, -"mariadb", MARIADB_BASE_VERSION, -"mariadbd", MARIADBD_BASE_VERSION, -"client-server", -#ifdef WITH_WSREP -"galera", -#endif -0, 0}; diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysqld_suffix.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysqld_suffix.h deleted file mode 100644 index 3c36ba2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysqld_suffix.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef MYSQLD_SUFFIX_INCLUDED -#define MYSQLD_SUFFIX_INCLUDED - -/* Copyright (c) 2000-2004, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - Set MYSQL_SERVER_SUFFIX_STR. - - The following code is quite ugly as there is no portable way to easily set a - string to the value of a macro -*/ - -#ifdef MYSQL_SERVER_SUFFIX -#define MYSQL_SERVER_SUFFIX_STR STRINGIFY_ARG(MYSQL_SERVER_SUFFIX) -#else -#define MYSQL_SERVER_SUFFIX_STR MYSQL_SERVER_SUFFIX_DEF -#endif -#endif /* MYSQLD_SUFFIX_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysys_err.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysys_err.h deleted file mode 100644 index e0e97d0..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/mysys_err.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (c) 2000, 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _mysys_err_h -#define _mysys_err_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */ -#define EE(X) (globerrs[(X) - EE_ERROR_FIRST]) - -extern const char *globerrs[]; /* my_error_messages is here */ - -/* Error message numbers in global map */ -/* - Do not add error numbers before EE_ERROR_FIRST. - If necessary to add lower numbers, change EE_ERROR_FIRST accordingly. - - We start with error 1 to not confuse peoples with 'error 0' -*/ - -#define EE_ERROR_FIRST 1 /*Copy first error nr.*/ -#define EE_CANTCREATEFILE 1 -#define EE_READ 2 -#define EE_WRITE 3 -#define EE_BADCLOSE 4 -#define EE_OUTOFMEMORY 5 -#define EE_DELETE 6 -#define EE_LINK 7 -#define EE_EOFERR 9 -#define EE_CANTLOCK 10 -#define EE_CANTUNLOCK 11 -#define EE_DIR 12 -#define EE_STAT 13 -#define EE_CANT_CHSIZE 14 -#define EE_CANT_OPEN_STREAM 15 -#define EE_GETWD 16 -#define EE_SETWD 17 -#define EE_LINK_WARNING 18 -#define EE_OPEN_WARNING 19 -#define EE_DISK_FULL 20 -#define EE_CANT_MKDIR 21 -#define EE_UNKNOWN_CHARSET 22 -#define EE_OUT_OF_FILERESOURCES 23 -#define EE_CANT_READLINK 24 -#define EE_CANT_SYMLINK 25 -#define EE_REALPATH 26 -#define EE_SYNC 27 -#define EE_UNKNOWN_COLLATION 28 -#define EE_FILENOTFOUND 29 -#define EE_FILE_NOT_CLOSED 30 -#define EE_CHANGE_OWNERSHIP 31 -#define EE_CHANGE_PERMISSIONS 32 -#define EE_CANT_SEEK 33 -#define EE_CANT_CHMOD 34 -#define EE_CANT_COPY_OWNERSHIP 35 -#define EE_BADMEMORYRELEASE 36 -#define EE_PERM_LOCK_MEMORY 37 -#define EE_MEMCNTL 38 -#define EE_DUPLICATE_CHARSET 39 -#define EE_ERROR_LAST 39 /* Copy last error nr */ - -/* Add error numbers before EE_ERROR_LAST and change it accordingly. */ - - /* exit codes for all MySQL programs */ - -#define EXIT_UNSPECIFIED_ERROR 1 -#define EXIT_UNKNOWN_OPTION 2 -#define EXIT_AMBIGUOUS_OPTION 3 -#define EXIT_NO_ARGUMENT_ALLOWED 4 -#define EXIT_ARGUMENT_REQUIRED 5 -#define EXIT_VAR_PREFIX_NOT_UNIQUE 6 -#define EXIT_UNKNOWN_VARIABLE 7 -#define EXIT_OUT_OF_MEMORY 8 -#define EXIT_UNKNOWN_SUFFIX 9 -#define EXIT_NO_PTR_TO_VARIABLE 10 -#define EXIT_CANNOT_CONNECT_TO_SERVICE 11 -#define EXIT_OPTION_DISABLED 12 -#define EXIT_ARGUMENT_INVALID 13 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/nt_servc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/nt_servc.h deleted file mode 100644 index 8ba2951..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/nt_servc.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef NT_SERVC_INCLUDED -#define NT_SERVC_INCLUDED - -/** - @file - - @brief - Windows NT Service class library - - Copyright Abandoned 1998 Irena Pancirov - Irnet Snc - This file is public domain and comes with NO WARRANTY of any kind -*/ - -// main application thread -typedef void (*THREAD_FC)(void *); - -class NTService -{ - public: - NTService(); - ~NTService(); - - BOOL bOsNT; ///< true if OS is NT, false for Win95 - //install optinos - DWORD dwDesiredAccess; - DWORD dwServiceType; - DWORD dwStartType; - DWORD dwErrorControl; - - LPSTR szLoadOrderGroup; - LPDWORD lpdwTagID; - LPSTR szDependencies; - OSVERSIONINFO osVer; - - // time-out (in milisec) - int nStartTimeOut; - int nStopTimeOut; - int nPauseTimeOut; - int nResumeTimeOut; - - // - DWORD my_argc; - LPTSTR *my_argv; - HANDLE hShutdownEvent; - int nError; - DWORD dwState; - - //init service entry point - long Init(LPCSTR szInternName,THREAD_FC ServiceThread); - - //application shutdown event - void SetShutdownEvent(HANDLE hEvent){ hShutdownEvent=hEvent; } - - - //service install / un-install - BOOL Install(int startType,LPCSTR szInternName,LPCSTR szDisplayName, - LPCSTR szFullPath, LPCSTR szAccountName=NULL, - LPCSTR szPassword=NULL); - BOOL SeekStatus(LPCSTR szInternName, int OperationType); - BOOL Remove(LPCSTR szInternName); - BOOL IsService(LPCSTR ServiceName); - BOOL got_service_option(char **argv, const char *service_option); - BOOL is_super_user(); - - /* - SetRunning() is to be called by the application - when initialization completes and it can accept - stop request - */ - void SetRunning(void); - - /** - Sets a timeout after which SCM will abort service startup if SetRunning() - was not called or the timeout was not extended with another call to - SetSlowStarting(). Should be called when static initialization completes, - and the variable initialization part begins - - @arg timeout the timeout to pass to the SCM (in milliseconds) - */ - void SetSlowStarting(unsigned long timeout); - - /* - Stop() is to be called by the application to stop - the service - */ - void Stop(void); - - protected: - LPSTR ServiceName; - HANDLE hExitEvent; - SERVICE_STATUS_HANDLE hServiceStatusHandle; - BOOL bPause; - BOOL bRunning; - HANDLE hThreadHandle; - THREAD_FC fpServiceThread; - - void PauseService(); - void ResumeService(); - void StopService(); - BOOL StartService(); - - static void WINAPI ServiceMain(DWORD argc, LPTSTR *argv); - static void WINAPI ServiceCtrlHandler (DWORD ctrlCode); - - void Exit(DWORD error); - BOOL SetStatus (DWORD dwCurrentState,DWORD dwWin32ExitCode, - DWORD dwServiceSpecificExitCode, - DWORD dwCheckPoint,DWORD dwWaitHint); - -}; -/* ------------------------- the end -------------------------------------- */ - -#endif /* NT_SERVC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_range.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_range.h deleted file mode 100644 index 664e821..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_range.h +++ /dev/null @@ -1,1753 +0,0 @@ -/* - Copyright (c) 2000, 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* classes to use when handling where clause */ - -#ifndef _opt_range_h -#define _opt_range_h - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "records.h" /* READ_RECORD */ -#include "queues.h" /* QUEUE */ -#include "filesort.h" /* SORT_INFO */ - -/* - It is necessary to include set_var.h instead of item.h because there - are dependencies on include order for set_var.h and item.h. This - will be resolved later. -*/ -#include "sql_class.h" // set_var.h: THD -#include "set_var.h" /* Item */ - -class JOIN; -class Item_sum; - -struct KEY_PART { - uint16 key,part; - /* See KEY_PART_INFO for meaning of the next two: */ - uint16 store_length, length; - uint8 null_bit; - /* - Keypart flags (0 when this structure is used by partition pruning code - for fake partitioning index description) - */ - uint8 flag; - Field *field; - Field::imagetype image_type; -}; - - -class RANGE_OPT_PARAM; -/* - A construction block of the SEL_ARG-graph. - - The following description only covers graphs of SEL_ARG objects with - sel_arg->type==KEY_RANGE: - - One SEL_ARG object represents an "elementary interval" in form - - min_value <=? table.keypartX <=? max_value - - The interval is a non-empty interval of any kind: with[out] minimum/maximum - bound, [half]open/closed, single-point interval, etc. - - 1. SEL_ARG GRAPH STRUCTURE - - SEL_ARG objects are linked together in a graph. The meaning of the graph - is better demostrated by an example: - - tree->keys[i] - | - | $ $ - | part=1 $ part=2 $ part=3 - | $ $ - | +-------+ $ +-------+ $ +--------+ - | | kp1<1 |--$-->| kp2=5 |--$-->| kp3=10 | - | +-------+ $ +-------+ $ +--------+ - | | $ $ | - | | $ $ +--------+ - | | $ $ | kp3=12 | - | | $ $ +--------+ - | +-------+ $ $ - \->| kp1=2 |--$--------------$-+ - +-------+ $ $ | +--------+ - | $ $ ==>| kp3=11 | - +-------+ $ $ | +--------+ - | kp1=3 |--$--------------$-+ | - +-------+ $ $ +--------+ - | $ $ | kp3=14 | - ... $ $ +--------+ - - The entire graph is partitioned into "interval lists". - - An interval list is a sequence of ordered disjoint intervals over the same - key part. SEL_ARG are linked via "next" and "prev" pointers. Additionally, - all intervals in the list form an RB-tree, linked via left/right/parent - pointers. The RB-tree root SEL_ARG object will be further called "root of the - interval list". - - In the example pic, there are 4 interval lists: - "kp<1 OR kp1=2 OR kp1=3", "kp2=5", "kp3=10 OR kp3=12", "kp3=11 OR kp3=13". - The vertical lines represent SEL_ARG::next/prev pointers. - - In an interval list, each member X may have SEL_ARG::next_key_part pointer - pointing to the root of another interval list Y. The pointed interval list - must cover a key part with greater number (i.e. Y->part > X->part). - - In the example pic, the next_key_part pointers are represented by - horisontal lines. - - 2. SEL_ARG GRAPH SEMANTICS - - It represents a condition in a special form (we don't have a name for it ATM) - The SEL_ARG::next/prev is "OR", and next_key_part is "AND". - - For example, the picture represents the condition in form: - (kp1 < 1 AND kp2=5 AND (kp3=10 OR kp3=12)) OR - (kp1=2 AND (kp3=11 OR kp3=14)) OR - (kp1=3 AND (kp3=11 OR kp3=14)) - - - 3. SEL_ARG GRAPH USE - - Use get_mm_tree() to construct SEL_ARG graph from WHERE condition. - Then walk the SEL_ARG graph and get a list of dijsoint ordered key - intervals (i.e. intervals in form - - (constA1, .., const1_K) < (keypart1,.., keypartK) < (constB1, .., constB_K) - - Those intervals can be used to access the index. The uses are in: - - check_quick_select() - Walk the SEL_ARG graph and find an estimate of - how many table records are contained within all - intervals. - - get_quick_select() - Walk the SEL_ARG, materialize the key intervals, - and create QUICK_RANGE_SELECT object that will - read records within these intervals. - - 4. SPACE COMPLEXITY NOTES - - SEL_ARG graph is a representation of an ordered disjoint sequence of - intervals over the ordered set of index tuple values. - - For multi-part keys, one can construct a WHERE expression such that its - list of intervals will be of combinatorial size. Here is an example: - - (keypart1 IN (1,2, ..., n1)) AND - (keypart2 IN (1,2, ..., n2)) AND - (keypart3 IN (1,2, ..., n3)) - - For this WHERE clause the list of intervals will have n1*n2*n3 intervals - of form - - (keypart1, keypart2, keypart3) = (k1, k2, k3), where 1 <= k{i} <= n{i} - - SEL_ARG graph structure aims to reduce the amount of required space by - "sharing" the elementary intervals when possible (the pic at the - beginning of this comment has examples of such sharing). The sharing may - prevent combinatorial blowup: - - There are WHERE clauses that have combinatorial-size interval lists but - will be represented by a compact SEL_ARG graph. - Example: - (keypartN IN (1,2, ..., n1)) AND - ... - (keypart2 IN (1,2, ..., n2)) AND - (keypart1 IN (1,2, ..., n3)) - - but not in all cases: - - - There are WHERE clauses that do have a compact SEL_ARG-graph - representation but get_mm_tree() and its callees will construct a - graph of combinatorial size. - Example: - (keypart1 IN (1,2, ..., n1)) AND - (keypart2 IN (1,2, ..., n2)) AND - ... - (keypartN IN (1,2, ..., n3)) - - - There are WHERE clauses for which the minimal possible SEL_ARG graph - representation will have combinatorial size. - Example: - By induction: Let's take any interval on some keypart in the middle: - - kp15=c0 - - Then let's AND it with this interval 'structure' from preceding and - following keyparts: - - (kp14=c1 AND kp16=c3) OR keypart14=c2) (*) - - We will obtain this SEL_ARG graph: - - kp14 $ kp15 $ kp16 - $ $ - +---------+ $ +---------+ $ +---------+ - | kp14=c1 |--$-->| kp15=c0 |--$-->| kp16=c3 | - +---------+ $ +---------+ $ +---------+ - | $ $ - +---------+ $ +---------+ $ - | kp14=c2 |--$-->| kp15=c0 | $ - +---------+ $ +---------+ $ - $ $ - - Note that we had to duplicate "kp15=c0" and there was no way to avoid - that. - The induction step: AND the obtained expression with another "wrapping" - expression like (*). - When the process ends because of the limit on max. number of keyparts - we'll have: - - WHERE clause length is O(3*#max_keyparts) - SEL_ARG graph size is O(2^(#max_keyparts/2)) - - (it is also possible to construct a case where instead of 2 in 2^n we - have a bigger constant, e.g. 4, and get a graph with 4^(31/2)= 2^31 - nodes) - - We avoid consuming too much memory by setting a limit on the number of - SEL_ARG object we can construct during one range analysis invocation. -*/ - -class SEL_ARG :public Sql_alloc -{ - static int sel_cmp(Field *field, uchar *a, uchar *b, uint8 a_flag, - uint8 b_flag); -public: - uint8 min_flag,max_flag,maybe_flag; - uint8 part; // Which key part - uint8 maybe_null; - /* - The ordinal number the least significant component encountered in - the ranges of the SEL_ARG tree (the first component has number 1) - */ - uint16 max_part_no; - /* - Number of children of this element in the RB-tree, plus 1 for this - element itself. - */ - uint32 elements; - /* - Valid only for elements which are RB-tree roots: Number of times this - RB-tree is referred to (it is referred by SEL_ARG::next_key_part or by - SEL_TREE::keys[i] or by a temporary SEL_ARG* variable) - */ - ulong use_count; - - Field *field; - uchar *min_value,*max_value; // Pointer to range - - /* - eq_tree() requires that left == right == 0 if the type is MAYBE_KEY. - */ - SEL_ARG *left,*right; /* R-B tree children */ - SEL_ARG *next,*prev; /* Links for bi-directional interval list */ - SEL_ARG *parent; /* R-B tree parent */ - SEL_ARG *next_key_part; - enum leaf_color { BLACK,RED } color; - enum Type { IMPOSSIBLE, MAYBE, MAYBE_KEY, KEY_RANGE } type; - - enum { MAX_SEL_ARGS = 16000 }; - - SEL_ARG() {} - SEL_ARG(SEL_ARG &); - SEL_ARG(Field *,const uchar *, const uchar *); - SEL_ARG(Field *field, uint8 part, uchar *min_value, uchar *max_value, - uint8 min_flag, uint8 max_flag, uint8 maybe_flag); - SEL_ARG(enum Type type_arg) - :min_flag(0), max_part_no(0) /* first key part means 1. 0 mean 'no parts'*/, - elements(1),use_count(1),left(0),right(0), - next_key_part(0), color(BLACK), type(type_arg) - {} - /** - returns true if a range predicate is equal. Use all_same() - to check for equality of all the predicates on this keypart. - */ - inline bool is_same(const SEL_ARG *arg) const - { - if (type != arg->type || part != arg->part) - return false; - if (type != KEY_RANGE) - return true; - return cmp_min_to_min(arg) == 0 && cmp_max_to_max(arg) == 0; - } - /** - returns true if all the predicates in the keypart tree are equal - */ - bool all_same(const SEL_ARG *arg) const - { - if (type != arg->type || part != arg->part) - return false; - if (type != KEY_RANGE) - return true; - if (arg == this) - return true; - const SEL_ARG *cmp_arg= arg->first(); - const SEL_ARG *cur_arg= first(); - for (; cur_arg && cmp_arg && cur_arg->is_same(cmp_arg); - cur_arg= cur_arg->next, cmp_arg= cmp_arg->next) ; - if (cur_arg || cmp_arg) - return false; - return true; - } - inline void merge_flags(SEL_ARG *arg) { maybe_flag|=arg->maybe_flag; } - inline void maybe_smaller() { maybe_flag=1; } - /* Return true iff it's a single-point null interval */ - inline bool is_null_interval() { return maybe_null && max_value[0] == 1; } - inline int cmp_min_to_min(const SEL_ARG* arg) const - { - return sel_cmp(field,min_value, arg->min_value, min_flag, arg->min_flag); - } - inline int cmp_min_to_max(const SEL_ARG* arg) const - { - return sel_cmp(field,min_value, arg->max_value, min_flag, arg->max_flag); - } - inline int cmp_max_to_max(const SEL_ARG* arg) const - { - return sel_cmp(field,max_value, arg->max_value, max_flag, arg->max_flag); - } - inline int cmp_max_to_min(const SEL_ARG* arg) const - { - return sel_cmp(field,max_value, arg->min_value, max_flag, arg->min_flag); - } - SEL_ARG *clone_and(THD *thd, SEL_ARG* arg) - { // Get overlapping range - uchar *new_min,*new_max; - uint8 flag_min,flag_max; - if (cmp_min_to_min(arg) >= 0) - { - new_min=min_value; flag_min=min_flag; - } - else - { - new_min=arg->min_value; flag_min=arg->min_flag; /* purecov: deadcode */ - } - if (cmp_max_to_max(arg) <= 0) - { - new_max=max_value; flag_max=max_flag; - } - else - { - new_max=arg->max_value; flag_max=arg->max_flag; - } - return new (thd->mem_root) SEL_ARG(field, part, new_min, new_max, flag_min, - flag_max, - MY_TEST(maybe_flag && arg->maybe_flag)); - } - SEL_ARG *clone_first(SEL_ARG *arg) - { // min <= X < arg->min - return new SEL_ARG(field,part, min_value, arg->min_value, - min_flag, arg->min_flag & NEAR_MIN ? 0 : NEAR_MAX, - maybe_flag | arg->maybe_flag); - } - SEL_ARG *clone_last(SEL_ARG *arg) - { // min <= X <= key_max - return new SEL_ARG(field, part, min_value, arg->max_value, - min_flag, arg->max_flag, maybe_flag | arg->maybe_flag); - } - SEL_ARG *clone(RANGE_OPT_PARAM *param, SEL_ARG *new_parent, SEL_ARG **next); - - bool copy_min(SEL_ARG* arg) - { // Get overlapping range - if (cmp_min_to_min(arg) > 0) - { - min_value=arg->min_value; min_flag=arg->min_flag; - if ((max_flag & (NO_MAX_RANGE | NO_MIN_RANGE)) == - (NO_MAX_RANGE | NO_MIN_RANGE)) - return 1; // Full range - } - maybe_flag|=arg->maybe_flag; - return 0; - } - bool copy_max(SEL_ARG* arg) - { // Get overlapping range - if (cmp_max_to_max(arg) <= 0) - { - max_value=arg->max_value; max_flag=arg->max_flag; - if ((max_flag & (NO_MAX_RANGE | NO_MIN_RANGE)) == - (NO_MAX_RANGE | NO_MIN_RANGE)) - return 1; // Full range - } - maybe_flag|=arg->maybe_flag; - return 0; - } - - void copy_min_to_min(SEL_ARG *arg) - { - min_value=arg->min_value; min_flag=arg->min_flag; - } - void copy_min_to_max(SEL_ARG *arg) - { - max_value=arg->min_value; - max_flag=arg->min_flag & NEAR_MIN ? 0 : NEAR_MAX; - } - void copy_max_to_min(SEL_ARG *arg) - { - min_value=arg->max_value; - min_flag=arg->max_flag & NEAR_MAX ? 0 : NEAR_MIN; - } - /* returns a number of keypart values (0 or 1) appended to the key buffer */ - int store_min(uint length, uchar **min_key,uint min_key_flag) - { - /* "(kp1 > c1) AND (kp2 OP c2) AND ..." -> (kp1 > c1) */ - if ((min_flag & GEOM_FLAG) || - (!(min_flag & NO_MIN_RANGE) && - !(min_key_flag & (NO_MIN_RANGE | NEAR_MIN)))) - { - if (maybe_null && *min_value) - { - **min_key=1; - bzero(*min_key+1,length-1); - } - else - memcpy(*min_key,min_value,length); - (*min_key)+= length; - return 1; - } - return 0; - } - /* returns a number of keypart values (0 or 1) appended to the key buffer */ - int store_max(uint length, uchar **max_key, uint max_key_flag) - { - if (!(max_flag & NO_MAX_RANGE) && - !(max_key_flag & (NO_MAX_RANGE | NEAR_MAX))) - { - if (maybe_null && *max_value) - { - **max_key=1; - bzero(*max_key+1,length-1); - } - else - memcpy(*max_key,max_value,length); - (*max_key)+= length; - return 1; - } - return 0; - } - - /* - Returns a number of keypart values appended to the key buffer - for min key and max key. This function is used by both Range - Analysis and Partition pruning. For partition pruning we have - to ensure that we don't store also subpartition fields. Thus - we have to stop at the last partition part and not step into - the subpartition fields. For Range Analysis we set last_part - to MAX_KEY which we should never reach. - */ - int store_min_key(KEY_PART *key, - uchar **range_key, - uint *range_key_flag, - uint last_part) - { - SEL_ARG *key_tree= first(); - uint res= key_tree->store_min(key[key_tree->part].store_length, - range_key, *range_key_flag); - // add flags only if a key_part is written to the buffer - if (!res) - return 0; - *range_key_flag|= key_tree->min_flag; - if (key_tree->next_key_part && - key_tree->next_key_part->type == SEL_ARG::KEY_RANGE && - key_tree->part != last_part && - key_tree->next_key_part->part == key_tree->part+1 && - !(*range_key_flag & (NO_MIN_RANGE | NEAR_MIN))) - res+= key_tree->next_key_part->store_min_key(key, - range_key, - range_key_flag, - last_part); - return res; - } - - /* returns a number of keypart values appended to the key buffer */ - int store_max_key(KEY_PART *key, - uchar **range_key, - uint *range_key_flag, - uint last_part) - { - SEL_ARG *key_tree= last(); - uint res=key_tree->store_max(key[key_tree->part].store_length, - range_key, *range_key_flag); - if (!res) - return 0; - *range_key_flag|= key_tree->max_flag; - if (key_tree->next_key_part && - key_tree->next_key_part->type == SEL_ARG::KEY_RANGE && - key_tree->part != last_part && - key_tree->next_key_part->part == key_tree->part+1 && - !(*range_key_flag & (NO_MAX_RANGE | NEAR_MAX))) - res+= key_tree->next_key_part->store_max_key(key, - range_key, - range_key_flag, - last_part); - return res; - } - - SEL_ARG *insert(SEL_ARG *key); - SEL_ARG *tree_delete(SEL_ARG *key); - SEL_ARG *find_range(SEL_ARG *key); - SEL_ARG *rb_insert(SEL_ARG *leaf); - friend SEL_ARG *rb_delete_fixup(SEL_ARG *root,SEL_ARG *key, SEL_ARG *par); -#ifdef EXTRA_DEBUG - friend int test_rb_tree(SEL_ARG *element,SEL_ARG *parent); - void test_use_count(SEL_ARG *root); -#endif - SEL_ARG *first(); - const SEL_ARG *first() const; - SEL_ARG *last(); - void make_root(); - inline bool simple_key() - { - return !next_key_part && elements == 1; - } - void increment_use_count(long count) - { - if (next_key_part) - { - next_key_part->use_count+=count; - count*= (next_key_part->use_count-count); - for (SEL_ARG *pos=next_key_part->first(); pos ; pos=pos->next) - if (pos->next_key_part) - pos->increment_use_count(count); - } - } - void incr_refs() - { - increment_use_count(1); - use_count++; - } - void incr_refs_all() - { - for (SEL_ARG *pos=first(); pos ; pos=pos->next) - { - pos->increment_use_count(1); - } - use_count++; - } - void free_tree() - { - for (SEL_ARG *pos=first(); pos ; pos=pos->next) - if (pos->next_key_part) - { - pos->next_key_part->use_count--; - pos->next_key_part->free_tree(); - } - } - - inline SEL_ARG **parent_ptr() - { - return parent->left == this ? &parent->left : &parent->right; - } - - - /* - Check if this SEL_ARG object represents a single-point interval - - SYNOPSIS - is_singlepoint() - - DESCRIPTION - Check if this SEL_ARG object (not tree) represents a single-point - interval, i.e. if it represents a "keypart = const" or - "keypart IS NULL". - - RETURN - TRUE This SEL_ARG object represents a singlepoint interval - FALSE Otherwise - */ - - bool is_singlepoint() const - { - /* - Check for NEAR_MIN ("strictly less") and NO_MIN_RANGE (-inf < field) - flags, and the same for right edge. - */ - if (min_flag || max_flag) - return FALSE; - uchar *min_val= min_value; - uchar *max_val= max_value; - - if (maybe_null) - { - /* First byte is a NULL value indicator */ - if (*min_val != *max_val) - return FALSE; - - if (*min_val) - return TRUE; /* This "x IS NULL" */ - min_val++; - max_val++; - } - return !field->key_cmp(min_val, max_val); - } - SEL_ARG *clone_tree(RANGE_OPT_PARAM *param); -}; - -extern MYSQL_PLUGIN_IMPORT SEL_ARG null_element; - -class SEL_ARG_IMPOSSIBLE: public SEL_ARG -{ -public: - SEL_ARG_IMPOSSIBLE(Field *field) - :SEL_ARG(field, 0, 0) - { - type= SEL_ARG::IMPOSSIBLE; - } -}; - - -class RANGE_OPT_PARAM -{ -public: - THD *thd; /* Current thread handle */ - TABLE *table; /* Table being analyzed */ - table_map prev_tables; - table_map read_tables; - table_map current_table; /* Bit of the table being analyzed */ - - /* Array of parts of all keys for which range analysis is performed */ - KEY_PART *key_parts; - KEY_PART *key_parts_end; - MEM_ROOT *mem_root; /* Memory that will be freed when range analysis completes */ - MEM_ROOT *old_root; /* Memory that will last until the query end */ - /* - Number of indexes used in range analysis (In SEL_TREE::keys only first - #keys elements are not empty) - */ - uint keys; - - /* - If true, the index descriptions describe real indexes (and it is ok to - call field->optimize_range(real_keynr[...], ...). - Otherwise index description describes fake indexes. - */ - bool using_real_indexes; - - /* - Aggressively remove "scans" that do not have conditions on first - keyparts. Such scans are usable when doing partition pruning but not - regular range optimization. - */ - bool remove_jump_scans; - - /* - TRUE <=> Range analyzer should remove parts of condition that are found - to be always FALSE. - */ - bool remove_false_where_parts; - - /* - used_key_no -> table_key_no translation table. Only makes sense if - using_real_indexes==TRUE - */ - uint real_keynr[MAX_KEY]; - - /* - Used to store 'current key tuples', in both range analysis and - partitioning (list) analysis - */ - uchar *min_key; - uchar *max_key; - - /* Number of SEL_ARG objects allocated by SEL_ARG::clone_tree operations */ - uint alloced_sel_args; - - bool force_default_mrr; - KEY_PART *key[MAX_KEY]; /* First key parts of keys used in the query */ - - bool statement_should_be_aborted() const - { - return - thd->killed || - thd->is_fatal_error || - thd->is_error() || - alloced_sel_args > SEL_ARG::MAX_SEL_ARGS; - } -}; - - -class Explain_quick_select; -/* - A "MIN_TUPLE < tbl.key_tuple < MAX_TUPLE" interval. - - One of endpoints may be absent. 'flags' member has flags which tell whether - the endpoints are '<' or '<='. -*/ -class QUICK_RANGE :public Sql_alloc { - public: - uchar *min_key,*max_key; - uint16 min_length,max_length,flag; - key_part_map min_keypart_map, // bitmap of used keyparts in min_key - max_keypart_map; // bitmap of used keyparts in max_key -#ifdef HAVE_valgrind - uint16 dummy; /* Avoid warnings on 'flag' */ -#endif - QUICK_RANGE(); /* Full range */ - QUICK_RANGE(THD *thd, const uchar *min_key_arg, uint min_length_arg, - key_part_map min_keypart_map_arg, - const uchar *max_key_arg, uint max_length_arg, - key_part_map max_keypart_map_arg, - uint flag_arg) - : min_key((uchar*) thd->memdup(min_key_arg, min_length_arg + 1)), - max_key((uchar*) thd->memdup(max_key_arg, max_length_arg + 1)), - min_length((uint16) min_length_arg), - max_length((uint16) max_length_arg), - flag((uint16) flag_arg), - min_keypart_map(min_keypart_map_arg), - max_keypart_map(max_keypart_map_arg) - { -#ifdef HAVE_valgrind - dummy=0; -#endif - } - - /** - Initalizes a key_range object for communication with storage engine. - - This function facilitates communication with the Storage Engine API by - translating the minimum endpoint of the interval represented by this - QUICK_RANGE into an index range endpoint specifier for the engine. - - @param Pointer to an uninitialized key_range C struct. - - @param prefix_length The length of the search key prefix to be used for - lookup. - - @param keypart_map A set (bitmap) of keyparts to be used. - */ - void make_min_endpoint(key_range *kr, uint prefix_length, - key_part_map keypart_map) { - make_min_endpoint(kr); - kr->length= MY_MIN(kr->length, prefix_length); - kr->keypart_map&= keypart_map; - } - - /** - Initalizes a key_range object for communication with storage engine. - - This function facilitates communication with the Storage Engine API by - translating the minimum endpoint of the interval represented by this - QUICK_RANGE into an index range endpoint specifier for the engine. - - @param Pointer to an uninitialized key_range C struct. - */ - void make_min_endpoint(key_range *kr) { - kr->key= (const uchar*)min_key; - kr->length= min_length; - kr->keypart_map= min_keypart_map; - kr->flag= ((flag & NEAR_MIN) ? HA_READ_AFTER_KEY : - (flag & EQ_RANGE) ? HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT); - } - - /** - Initalizes a key_range object for communication with storage engine. - - This function facilitates communication with the Storage Engine API by - translating the maximum endpoint of the interval represented by this - QUICK_RANGE into an index range endpoint specifier for the engine. - - @param Pointer to an uninitialized key_range C struct. - - @param prefix_length The length of the search key prefix to be used for - lookup. - - @param keypart_map A set (bitmap) of keyparts to be used. - */ - void make_max_endpoint(key_range *kr, uint prefix_length, - key_part_map keypart_map) { - make_max_endpoint(kr); - kr->length= MY_MIN(kr->length, prefix_length); - kr->keypart_map&= keypart_map; - } - - /** - Initalizes a key_range object for communication with storage engine. - - This function facilitates communication with the Storage Engine API by - translating the maximum endpoint of the interval represented by this - QUICK_RANGE into an index range endpoint specifier for the engine. - - @param Pointer to an uninitialized key_range C struct. - */ - void make_max_endpoint(key_range *kr) { - kr->key= (const uchar*)max_key; - kr->length= max_length; - kr->keypart_map= max_keypart_map; - /* - We use READ_AFTER_KEY here because if we are reading on a key - prefix we want to find all keys with this prefix - */ - kr->flag= (flag & NEAR_MAX ? HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY); - } -}; - - -/* - Quick select interface. - This class is a parent for all QUICK_*_SELECT and FT_SELECT classes. - - The usage scenario is as follows: - 1. Create quick select - quick= new QUICK_XXX_SELECT(...); - - 2. Perform lightweight initialization. This can be done in 2 ways: - 2.a: Regular initialization - if (quick->init()) - { - //the only valid action after failed init() call is delete - delete quick; - } - 2.b: Special initialization for quick selects merged by QUICK_ROR_*_SELECT - if (quick->init_ror_merged_scan()) - delete quick; - - 3. Perform zero, one, or more scans. - while (...) - { - // initialize quick select for scan. This may allocate - // buffers and/or prefetch rows. - if (quick->reset()) - { - //the only valid action after failed reset() call is delete - delete quick; - //abort query - } - - // perform the scan - do - { - res= quick->get_next(); - } while (res && ...) - } - - 4. Delete the select: - delete quick; - - NOTE - quick select doesn't use Sql_alloc/MEM_ROOT allocation because "range - checked for each record" functionality may create/destroy - O(#records_in_some_table) quick selects during query execution. -*/ - -class QUICK_SELECT_I -{ -public: - ha_rows records; /* estimate of # of records to be retrieved */ - double read_time; /* time to perform this retrieval */ - TABLE *head; - /* - Index this quick select uses, or MAX_KEY for quick selects - that use several indexes - */ - uint index; - - /* - Total length of first used_key_parts parts of the key. - Applicable if index!= MAX_KEY. - */ - uint max_used_key_length; - - /* - Max. number of (first) key parts this quick select uses for retrieval. - eg. for "(key1p1=c1 AND key1p2=c2) OR key1p1=c2" used_key_parts == 2. - Applicable if index!= MAX_KEY. - - For QUICK_GROUP_MIN_MAX_SELECT it includes MIN/MAX argument keyparts. - */ - uint used_key_parts; - - QUICK_SELECT_I(); - virtual ~QUICK_SELECT_I(){}; - - /* - Do post-constructor initialization. - SYNOPSIS - init() - - init() performs initializations that should have been in constructor if - it was possible to return errors from constructors. The join optimizer may - create and then delete quick selects without retrieving any rows so init() - must not contain any IO or CPU intensive code. - - If init() call fails the only valid action is to delete this quick select, - reset() and get_next() must not be called. - - RETURN - 0 OK - other Error code - */ - virtual int init() = 0; - - /* - Initialize quick select for row retrieval. - SYNOPSIS - reset() - - reset() should be called when it is certain that row retrieval will be - necessary. This call may do heavyweight initialization like buffering first - N records etc. If reset() call fails get_next() must not be called. - Note that reset() may be called several times if - * the quick select is executed in a subselect - * a JOIN buffer is used - - RETURN - 0 OK - other Error code - */ - virtual int reset(void) = 0; - - virtual int get_next() = 0; /* get next record to retrieve */ - - /* Range end should be called when we have looped over the whole index */ - virtual void range_end() {} - - virtual bool reverse_sorted() = 0; - virtual bool unique_key_range() { return false; } - - /* - Request that this quick select produces sorted output. Not all quick - selects can do it, the caller is responsible for calling this function - only for those quick selects that can. - */ - virtual void need_sorted_output() = 0; - enum { - QS_TYPE_RANGE = 0, - QS_TYPE_INDEX_INTERSECT = 1, - QS_TYPE_INDEX_MERGE = 2, - QS_TYPE_RANGE_DESC = 3, - QS_TYPE_FULLTEXT = 4, - QS_TYPE_ROR_INTERSECT = 5, - QS_TYPE_ROR_UNION = 6, - QS_TYPE_GROUP_MIN_MAX = 7 - }; - - /* Get type of this quick select - one of the QS_TYPE_* values */ - virtual int get_type() = 0; - - /* - Initialize this quick select as a merged scan inside a ROR-union or a ROR- - intersection scan. The caller must not additionally call init() if this - function is called. - SYNOPSIS - init_ror_merged_scan() - reuse_handler If true, the quick select may use table->handler, - otherwise it must create and use a separate handler - object. - RETURN - 0 Ok - other Error - */ - virtual int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc) - { DBUG_ASSERT(0); return 1; } - - /* - Save ROWID of last retrieved row in file->ref. This used in ROR-merging. - */ - virtual void save_last_pos(){}; - - void add_key_and_length(String *key_names, - String *used_lengths, - bool *first); - - /* - Append comma-separated list of keys this quick select uses to key_names; - append comma-separated list of corresponding used lengths to used_lengths. - This is used by select_describe. - */ - virtual void add_keys_and_lengths(String *key_names, - String *used_lengths)=0; - - void add_key_name(String *str, bool *first); - - /* Save information about quick select's query plan */ - virtual Explain_quick_select* get_explain(MEM_ROOT *alloc)= 0; - - /* - Return 1 if any index used by this quick select - uses field which is marked in passed bitmap. - */ - virtual bool is_keys_used(const MY_BITMAP *fields); - - /** - Simple sanity check that the quick select has been set up - correctly. Function is overridden by quick selects that merge - indices. - */ - virtual bool is_valid() { return index != MAX_KEY; }; - - /* - rowid of last row retrieved by this quick select. This is used only when - doing ROR-index_merge selects - */ - uchar *last_rowid; - - /* - Table record buffer used by this quick select. - */ - uchar *record; - - virtual void replace_handler(handler *new_file) - { - DBUG_ASSERT(0); /* Only supported in QUICK_RANGE_SELECT */ - } - -#ifndef DBUG_OFF - /* - Print quick select information to DBUG_FILE. Caller is responsible - for locking DBUG_FILE before this call and unlocking it afterwards. - */ - virtual void dbug_dump(int indent, bool verbose)= 0; -#endif - - /* - Returns a QUICK_SELECT with reverse order of to the index. - */ - virtual QUICK_SELECT_I *make_reverse(uint used_key_parts_arg) { return NULL; } - - /* - Add the key columns used by the quick select into table's read set. - - This is used by an optimization in filesort. - */ - virtual void add_used_key_part_to_set()=0; -}; - - -struct st_qsel_param; -class PARAM; - - -/* - MRR range sequence, array implementation: sequence traversal - context. -*/ -typedef struct st_quick_range_seq_ctx -{ - QUICK_RANGE **first; - QUICK_RANGE **cur; - QUICK_RANGE **last; -} QUICK_RANGE_SEQ_CTX; - -range_seq_t quick_range_seq_init(void *init_param, uint n_ranges, uint flags); -bool quick_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range); - - -/* - Quick select that does a range scan on a single key. The records are - returned in key order. -*/ -class QUICK_RANGE_SELECT : public QUICK_SELECT_I -{ -protected: - THD *thd; - bool no_alloc; - MEM_ROOT *parent_alloc; - - /* true if we enabled key only reads */ - handler *file; - - /* Members to deal with case when this quick select is a ROR-merged scan */ - bool in_ror_merged_scan; - MY_BITMAP column_bitmap; - bool free_file; /* TRUE <=> this->file is "owned" by this quick select */ - - /* Range pointers to be used when not using MRR interface */ - /* Members needed to use the MRR interface */ - QUICK_RANGE_SEQ_CTX qr_traversal_ctx; -public: - uint mrr_flags; /* Flags to be used with MRR interface */ -protected: - uint mrr_buf_size; /* copy from thd->variables.mrr_buff_size */ - HANDLER_BUFFER *mrr_buf_desc; /* the handler buffer */ - - /* Info about index we're scanning */ - - DYNAMIC_ARRAY ranges; /* ordered array of range ptrs */ - QUICK_RANGE **cur_range; /* current element in ranges */ - - QUICK_RANGE *last_range; - - KEY_PART *key_parts; - KEY_PART_INFO *key_part_info; - - bool dont_free; /* Used by QUICK_SELECT_DESC */ - - int cmp_next(QUICK_RANGE *range); - int cmp_prev(QUICK_RANGE *range); - bool row_in_ranges(); -public: - MEM_ROOT alloc; - - QUICK_RANGE_SELECT(THD *thd, TABLE *table,uint index_arg,bool no_alloc, - MEM_ROOT *parent_alloc, bool *create_err); - ~QUICK_RANGE_SELECT(); - virtual QUICK_RANGE_SELECT *clone(bool *create_error) - { return new QUICK_RANGE_SELECT(thd, head, index, no_alloc, parent_alloc, - create_error); } - - void need_sorted_output(); - int init(); - int reset(void); - int get_next(); - void range_end(); - int get_next_prefix(uint prefix_length, uint group_key_parts, - uchar *cur_prefix); - bool reverse_sorted() { return 0; } - bool unique_key_range(); - int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc); - void save_last_pos() - { file->position(record); } - int get_type() { return QS_TYPE_RANGE; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - Explain_quick_select *get_explain(MEM_ROOT *alloc); -#ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); -#endif - virtual void replace_handler(handler *new_file) { file= new_file; } - QUICK_SELECT_I *make_reverse(uint used_key_parts_arg); - - virtual void add_used_key_part_to_set(); - -private: - /* Default copy ctor used by QUICK_SELECT_DESC */ - friend class TRP_ROR_INTERSECT; - friend - QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, - struct st_table_ref *ref, - ha_rows records); - friend bool get_quick_keys(PARAM *param, QUICK_RANGE_SELECT *quick, - KEY_PART *key, SEL_ARG *key_tree, - uchar *min_key, uint min_key_flag, - uchar *max_key, uint max_key_flag); - friend QUICK_RANGE_SELECT *get_quick_select(PARAM*,uint idx, - SEL_ARG *key_tree, - uint mrr_flags, - uint mrr_buf_size, - MEM_ROOT *alloc); - friend class QUICK_SELECT_DESC; - friend class QUICK_INDEX_SORT_SELECT; - friend class QUICK_INDEX_MERGE_SELECT; - friend class QUICK_ROR_INTERSECT_SELECT; - friend class QUICK_INDEX_INTERSECT_SELECT; - friend class QUICK_GROUP_MIN_MAX_SELECT; - friend bool quick_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range); - friend range_seq_t quick_range_seq_init(void *init_param, - uint n_ranges, uint flags); - friend - int read_keys_and_merge_scans(THD *thd, TABLE *head, - List quick_selects, - QUICK_RANGE_SELECT *pk_quick_select, - READ_RECORD *read_record, - bool intersection, - key_map *filtered_scans, - Unique **unique_ptr); - -}; - - -class QUICK_RANGE_SELECT_GEOM: public QUICK_RANGE_SELECT -{ -public: - QUICK_RANGE_SELECT_GEOM(THD *thd, TABLE *table, uint index_arg, - bool no_alloc, MEM_ROOT *parent_alloc, - bool *create_err) - :QUICK_RANGE_SELECT(thd, table, index_arg, no_alloc, parent_alloc, - create_err) - {}; - virtual QUICK_RANGE_SELECT *clone(bool *create_error) - { - DBUG_ASSERT(0); - return new QUICK_RANGE_SELECT_GEOM(thd, head, index, no_alloc, - parent_alloc, create_error); - } - virtual int get_next(); -}; - - -/* - QUICK_INDEX_SORT_SELECT is the base class for the common functionality of: - - QUICK_INDEX_MERGE_SELECT, access based on multi-index merge/union - - QUICK_INDEX_INTERSECT_SELECT, access based on multi-index intersection - - - QUICK_INDEX_SORT_SELECT uses - * QUICK_RANGE_SELECTs to get rows - * Unique class - - to remove duplicate rows for QUICK_INDEX_MERGE_SELECT - - to intersect rows for QUICK_INDEX_INTERSECT_SELECT - - INDEX MERGE OPTIMIZER - Current implementation doesn't detect all cases where index merge could - be used, in particular: - - * index_merge+'using index' is not supported - - * If WHERE part contains complex nested AND and OR conditions, some ways - to retrieve rows using index merge will not be considered. The choice - of read plan may depend on the order of conjuncts/disjuncts in WHERE - part of the query, see comments near imerge_list_or_list and - SEL_IMERGE::or_sel_tree_with_checks functions for details. - - * There is no "index_merge_ref" method (but index merge on non-first - table in join is possible with 'range checked for each record'). - - - ROW RETRIEVAL ALGORITHM - - index merge/intersection uses Unique class for duplicates removal. - index merge/intersection takes advantage of Clustered Primary Key (CPK) - if the table has one. - The index merge/intersection algorithm consists of two phases: - - Phase 1 - (implemented by a QUICK_INDEX_MERGE_SELECT::read_keys_and_merge call): - - prepare() - { - activate 'index only'; - while(retrieve next row for non-CPK scan) - { - if (there is a CPK scan and row will be retrieved by it) - skip this row; - else - put its rowid into Unique; - } - deactivate 'index only'; - } - - Phase 2 - (implemented as sequence of QUICK_INDEX_MERGE_SELECT::get_next calls): - - fetch() - { - retrieve all rows from row pointers stored in Unique - (merging/intersecting them); - free Unique; - if (! intersection) - retrieve all rows for CPK scan; - } -*/ - -class QUICK_INDEX_SORT_SELECT : public QUICK_SELECT_I -{ -protected: - Unique *unique; -public: - QUICK_INDEX_SORT_SELECT(THD *thd, TABLE *table); - ~QUICK_INDEX_SORT_SELECT(); - - int init(); - void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ } - int reset(void); - bool reverse_sorted() { return false; } - bool unique_key_range() { return false; } - bool is_keys_used(const MY_BITMAP *fields); -#ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); -#endif - Explain_quick_select *get_explain(MEM_ROOT *alloc); - - bool push_quick_back(QUICK_RANGE_SELECT *quick_sel_range); - - /* range quick selects this index merge/intersect consists of */ - List quick_selects; - - /* quick select that uses clustered primary key (NULL if none) */ - QUICK_RANGE_SELECT* pk_quick_select; - - MEM_ROOT alloc; - THD *thd; - virtual bool is_valid() - { - List_iterator_fast it(quick_selects); - QUICK_RANGE_SELECT *quick; - bool valid= true; - while ((quick= it++)) - { - if (!quick->is_valid()) - { - valid= false; - break; - } - } - return valid; - } - virtual int read_keys_and_merge()= 0; - /* used to get rows collected in Unique */ - READ_RECORD read_record; - - virtual void add_used_key_part_to_set(); -}; - - - -class QUICK_INDEX_MERGE_SELECT : public QUICK_INDEX_SORT_SELECT -{ -private: - /* true if this select is currently doing a clustered PK scan */ - bool doing_pk_scan; -protected: - int read_keys_and_merge(); - -public: - QUICK_INDEX_MERGE_SELECT(THD *thd_arg, TABLE *table) - :QUICK_INDEX_SORT_SELECT(thd_arg, table) {} - - int get_next(); - int get_type() { return QS_TYPE_INDEX_MERGE; } - void add_keys_and_lengths(String *key_names, String *used_lengths); -}; - -class QUICK_INDEX_INTERSECT_SELECT : public QUICK_INDEX_SORT_SELECT -{ -protected: - int read_keys_and_merge(); - -public: - QUICK_INDEX_INTERSECT_SELECT(THD *thd_arg, TABLE *table) - :QUICK_INDEX_SORT_SELECT(thd_arg, table) {} - - key_map filtered_scans; - int get_next(); - int get_type() { return QS_TYPE_INDEX_INTERSECT; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - Explain_quick_select *get_explain(MEM_ROOT *alloc); -}; - - -/* - Rowid-Ordered Retrieval (ROR) index intersection quick select. - This quick select produces intersection of row sequences returned - by several QUICK_RANGE_SELECTs it "merges". - - All merged QUICK_RANGE_SELECTs must return rowids in rowid order. - QUICK_ROR_INTERSECT_SELECT will return rows in rowid order, too. - - All merged quick selects retrieve {rowid, covered_fields} tuples (not full - table records). - QUICK_ROR_INTERSECT_SELECT retrieves full records if it is not being used - by QUICK_ROR_INTERSECT_SELECT and all merged quick selects together don't - cover needed all fields. - - If one of the merged quick selects is a Clustered PK range scan, it is - used only to filter rowid sequence produced by other merged quick selects. -*/ - -class QUICK_ROR_INTERSECT_SELECT : public QUICK_SELECT_I -{ -public: - QUICK_ROR_INTERSECT_SELECT(THD *thd, TABLE *table, - bool retrieve_full_rows, - MEM_ROOT *parent_alloc); - ~QUICK_ROR_INTERSECT_SELECT(); - - int init(); - void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ } - int reset(void); - int get_next(); - bool reverse_sorted() { return false; } - bool unique_key_range() { return false; } - int get_type() { return QS_TYPE_ROR_INTERSECT; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - Explain_quick_select *get_explain(MEM_ROOT *alloc); - bool is_keys_used(const MY_BITMAP *fields); - void add_used_key_part_to_set(); -#ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); -#endif - int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc); - bool push_quick_back(MEM_ROOT *alloc, QUICK_RANGE_SELECT *quick_sel_range); - - class QUICK_SELECT_WITH_RECORD : public Sql_alloc - { - public: - QUICK_RANGE_SELECT *quick; - uchar *key_tuple; - ~QUICK_SELECT_WITH_RECORD() { delete quick; } - }; - - /* - Range quick selects this intersection consists of, not including - cpk_quick. - */ - List quick_selects; - - virtual bool is_valid() - { - List_iterator_fast it(quick_selects); - QUICK_SELECT_WITH_RECORD *quick; - bool valid= true; - while ((quick= it++)) - { - if (!quick->quick->is_valid()) - { - valid= false; - break; - } - } - return valid; - } - - /* - Merged quick select that uses Clustered PK, if there is one. This quick - select is not used for row retrieval, it is used for row retrieval. - */ - QUICK_RANGE_SELECT *cpk_quick; - - MEM_ROOT alloc; /* Memory pool for this and merged quick selects data. */ - THD *thd; /* current thread */ - bool need_to_fetch_row; /* if true, do retrieve full table records. */ - /* in top-level quick select, true if merged scans where initialized */ - bool scans_inited; -}; - - -/* - Rowid-Ordered Retrieval index union select. - This quick select produces union of row sequences returned by several - quick select it "merges". - - All merged quick selects must return rowids in rowid order. - QUICK_ROR_UNION_SELECT will return rows in rowid order, too. - - All merged quick selects are set not to retrieve full table records. - ROR-union quick select always retrieves full records. - -*/ - -class QUICK_ROR_UNION_SELECT : public QUICK_SELECT_I -{ -public: - QUICK_ROR_UNION_SELECT(THD *thd, TABLE *table); - ~QUICK_ROR_UNION_SELECT(); - - int init(); - void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ } - int reset(void); - int get_next(); - bool reverse_sorted() { return false; } - bool unique_key_range() { return false; } - int get_type() { return QS_TYPE_ROR_UNION; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - Explain_quick_select *get_explain(MEM_ROOT *alloc); - bool is_keys_used(const MY_BITMAP *fields); - void add_used_key_part_to_set(); -#ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); -#endif - - bool push_quick_back(QUICK_SELECT_I *quick_sel_range); - - List quick_selects; /* Merged quick selects */ - - virtual bool is_valid() - { - List_iterator_fast it(quick_selects); - QUICK_SELECT_I *quick; - bool valid= true; - while ((quick= it++)) - { - if (!quick->is_valid()) - { - valid= false; - break; - } - } - return valid; - } - - QUEUE queue; /* Priority queue for merge operation */ - MEM_ROOT alloc; /* Memory pool for this and merged quick selects data. */ - - THD *thd; /* current thread */ - uchar *cur_rowid; /* buffer used in get_next() */ - uchar *prev_rowid; /* rowid of last row returned by get_next() */ - bool have_prev_rowid; /* true if prev_rowid has valid data */ - uint rowid_length; /* table rowid length */ -private: - bool scans_inited; -}; - - -/* - Index scan for GROUP-BY queries with MIN/MAX aggregate functions. - - This class provides a specialized index access method for GROUP-BY queries - of the forms: - - SELECT A_1,...,A_k, [B_1,...,B_m], [MIN(C)], [MAX(C)] - FROM T - WHERE [RNG(A_1,...,A_p ; where p <= k)] - [AND EQ(B_1,...,B_m)] - [AND PC(C)] - [AND PA(A_i1,...,A_iq)] - GROUP BY A_1,...,A_k; - - or - - SELECT DISTINCT A_i1,...,A_ik - FROM T - WHERE [RNG(A_1,...,A_p ; where p <= k)] - [AND PA(A_i1,...,A_iq)]; - - where all selected fields are parts of the same index. - The class of queries that can be processed by this quick select is fully - specified in the description of get_best_trp_group_min_max() in opt_range.cc. - - The get_next() method directly produces result tuples, thus obviating the - need to call end_send_group() because all grouping is already done inside - get_next(). - - Since one of the requirements is that all select fields are part of the same - index, this class produces only index keys, and not complete records. -*/ - -class QUICK_GROUP_MIN_MAX_SELECT : public QUICK_SELECT_I -{ -private: - handler * const file; /* The handler used to get data. */ - JOIN *join; /* Descriptor of the current query */ - KEY *index_info; /* The index chosen for data access */ - uchar *record; /* Buffer where the next record is returned. */ - uchar *tmp_record; /* Temporary storage for next_min(), next_max(). */ - uchar *group_prefix; /* Key prefix consisting of the GROUP fields. */ - const uint group_prefix_len; /* Length of the group prefix. */ - uint group_key_parts; /* A number of keyparts in the group prefix */ - uchar *last_prefix; /* Prefix of the last group for detecting EOF. */ - bool have_min; /* Specify whether we are computing */ - bool have_max; /* a MIN, a MAX, or both. */ - bool have_agg_distinct;/* aggregate_function(DISTINCT ...). */ - bool seen_first_key; /* Denotes whether the first key was retrieved.*/ - bool doing_key_read; /* true if we enabled key only reads */ - - KEY_PART_INFO *min_max_arg_part; /* The keypart of the only argument field */ - /* of all MIN/MAX functions. */ - uint min_max_arg_len; /* The length of the MIN/MAX argument field */ - uchar *key_infix; /* Infix of constants from equality predicates. */ - uint key_infix_len; - DYNAMIC_ARRAY min_max_ranges; /* Array of range ptrs for the MIN/MAX field. */ - uint real_prefix_len; /* Length of key prefix extended with key_infix. */ - uint real_key_parts; /* A number of keyparts in the above value. */ - List *min_functions; - List *max_functions; - List_iterator *min_functions_it; - List_iterator *max_functions_it; - /* - Use index scan to get the next different key instead of jumping into it - through index read - */ - bool is_index_scan; -public: - /* - The following two members are public to allow easy access from - TRP_GROUP_MIN_MAX::make_quick() - */ - MEM_ROOT alloc; /* Memory pool for this and quick_prefix_select data. */ - QUICK_RANGE_SELECT *quick_prefix_select;/* For retrieval of group prefixes. */ -private: - int next_prefix(); - int next_min_in_range(); - int next_max_in_range(); - int next_min(); - int next_max(); - void update_min_result(); - void update_max_result(); - int cmp_min_max_key(const uchar *key, uint16 length); -public: - QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join, bool have_min, - bool have_max, bool have_agg_distinct, - KEY_PART_INFO *min_max_arg_part, - uint group_prefix_len, uint group_key_parts, - uint used_key_parts, KEY *index_info, uint - use_index, double read_cost, ha_rows records, uint - key_infix_len, uchar *key_infix, MEM_ROOT - *parent_alloc, bool is_index_scan); - ~QUICK_GROUP_MIN_MAX_SELECT(); - bool add_range(SEL_ARG *sel_range); - void update_key_stat(); - void adjust_prefix_ranges(); - bool alloc_buffers(); - int init(); - void need_sorted_output() { /* always do it */ } - int reset(); - int get_next(); - bool reverse_sorted() { return false; } - bool unique_key_range() { return false; } - int get_type() { return QS_TYPE_GROUP_MIN_MAX; } - void add_keys_and_lengths(String *key_names, String *used_lengths); - void add_used_key_part_to_set(); -#ifndef DBUG_OFF - void dbug_dump(int indent, bool verbose); -#endif - bool is_agg_distinct() { return have_agg_distinct; } - bool loose_scan_is_scanning() { return is_index_scan; } - Explain_quick_select *get_explain(MEM_ROOT *alloc); -}; - - -class QUICK_SELECT_DESC: public QUICK_RANGE_SELECT -{ -public: - QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q, uint used_key_parts); - virtual QUICK_RANGE_SELECT *clone(bool *create_error) - { DBUG_ASSERT(0); return new QUICK_SELECT_DESC(this, used_key_parts); } - int get_next(); - bool reverse_sorted() { return 1; } - int get_type() { return QS_TYPE_RANGE_DESC; } - QUICK_SELECT_I *make_reverse(uint used_key_parts_arg) - { - return this; // is already reverse sorted - } -private: - bool range_reads_after_key(QUICK_RANGE *range); - int reset(void) { rev_it.rewind(); return QUICK_RANGE_SELECT::reset(); } - List rev_ranges; - List_iterator rev_it; - uint used_key_parts; -}; - - -class SQL_SELECT :public Sql_alloc { - public: - QUICK_SELECT_I *quick; // If quick-select used - COND *cond; // where condition - - /* - When using Index Condition Pushdown: condition that we've had before - extracting and pushing index condition. - In other cases, NULL. - */ - Item *pre_idx_push_select_cond; - TABLE *head; - IO_CACHE file; // Positions to used records - ha_rows records; // Records in use if read from file - double read_time; // Time to read rows - key_map quick_keys; // Possible quick keys - key_map needed_reg; // Possible quick keys after prev tables. - table_map const_tables,read_tables; - /* See PARAM::possible_keys */ - key_map possible_keys; - bool free_cond; /* Currently not used and always FALSE */ - - SQL_SELECT(); - ~SQL_SELECT(); - void cleanup(); - void set_quick(QUICK_SELECT_I *new_quick) { delete quick; quick= new_quick; } - bool check_quick(THD *thd, bool force_quick_range, ha_rows limit) - { - key_map tmp; - tmp.set_all(); - return test_quick_select(thd, tmp, 0, limit, force_quick_range, - FALSE, FALSE, FALSE) < 0; - } - /* - RETURN - 0 if record must be skipped <-> (cond && cond->val_int() == 0) - -1 if error - 1 otherwise - */ - inline int skip_record(THD *thd) - { - int rc= MY_TEST(!cond || cond->val_int()); - if (thd->is_error()) - rc= -1; - return rc; - } - int test_quick_select(THD *thd, key_map keys, table_map prev_tables, - ha_rows limit, bool force_quick_range, - bool ordered_output, bool remove_false_parts_of_where, - bool only_single_index_range_scan); -}; - - -class SQL_SELECT_auto -{ - SQL_SELECT *select; -public: - SQL_SELECT_auto(): select(NULL) - {} - ~SQL_SELECT_auto() - { - delete select; - } - SQL_SELECT_auto& - operator= (SQL_SELECT *_select) - { - select= _select; - return *this; - } - operator SQL_SELECT * () const - { - return select; - } - SQL_SELECT * - operator-> () const - { - return select; - } - operator bool () const - { - return select; - } -}; - - -class FT_SELECT: public QUICK_RANGE_SELECT -{ -public: - FT_SELECT(THD *thd, TABLE *table, uint key, bool *create_err) : - QUICK_RANGE_SELECT (thd, table, key, 1, NULL, create_err) - { (void) init(); } - ~FT_SELECT() { file->ft_end(); } - virtual QUICK_RANGE_SELECT *clone(bool *create_error) - { DBUG_ASSERT(0); return new FT_SELECT(thd, head, index, create_error); } - int init() { return file->ft_init(); } - int reset() { return 0; } - int get_next() { return file->ha_ft_read(record); } - int get_type() { return QS_TYPE_FULLTEXT; } -}; - -FT_SELECT *get_ft_select(THD *thd, TABLE *table, uint key); -QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, - struct st_table_ref *ref, - ha_rows records); -SQL_SELECT *make_select(TABLE *head, table_map const_tables, - table_map read_tables, COND *conds, - SORT_INFO* filesort, - bool allow_null_cond, int *error); - -bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond); - -bool eq_ranges_exceeds_limit(RANGE_SEQ_IF *seq, void *seq_init_param, - uint limit); - -#ifdef WITH_PARTITION_STORAGE_ENGINE -bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond); -#endif -void store_key_image_to_rec(Field *field, uchar *ptr, uint len); - -extern String null_string; - -/* check this number of rows (default value) */ -#define SELECTIVITY_SAMPLING_LIMIT 100 -/* but no more then this part of table (10%) */ -#define SELECTIVITY_SAMPLING_SHARE 0.10 -/* do not check if we are going check less then this number of records */ -#define SELECTIVITY_SAMPLING_THRESHOLD 10 - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_subselect.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_subselect.h deleted file mode 100644 index abd37f1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_subselect.h +++ /dev/null @@ -1,416 +0,0 @@ -/* - Copyright (c) 2010, 2019, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Semi-join subquery optimization code definitions -*/ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -int check_and_do_in_subquery_rewrites(JOIN *join); -bool convert_join_subqueries_to_semijoins(JOIN *join); -int pull_out_semijoin_tables(JOIN *join); -bool optimize_semijoin_nests(JOIN *join, table_map all_table_map); -bool setup_degenerate_jtbm_semi_joins(JOIN *join, - List *join_list, - List &eq_list); -bool setup_jtbm_semi_joins(JOIN *join, List *join_list, - List &eq_list); -void cleanup_empty_jtbm_semi_joins(JOIN *join, List *join_list); - -// used by Loose_scan_opt -ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest, - table_map remaining_tables); - -/* - This is a class for considering possible loose index scan optimizations. - It's usage pattern is as follows: - best_access_path() - { - Loose_scan_opt opt; - - opt.init() - for each index we can do ref access with - { - opt.next_ref_key(); - for each keyuse - opt.add_keyuse(); - opt.check_ref_access(); - } - - if (some criteria for range scans) - opt.check_range_access(); - - opt.get_best_option(); - } -*/ - -class Loose_scan_opt -{ - /* All methods must check this before doing anything else */ - bool try_loosescan; - - /* - If we consider (oe1, .. oeN) IN (SELECT ie1, .. ieN) then ieK=oeK is - called sj-equality. If oeK depends only on preceding tables then such - equality is called 'bound'. - */ - ulonglong bound_sj_equalities; - - /* Accumulated properties of ref access we're now considering: */ - ulonglong handled_sj_equalities; - key_part_map loose_scan_keyparts; - uint max_loose_keypart; - bool part1_conds_met; - - /* - Use of quick select is a special case. Some of its properties: - */ - uint quick_uses_applicable_index; - uint quick_max_loose_keypart; - - /* Best loose scan method so far */ - uint best_loose_scan_key; - double best_loose_scan_cost; - double best_loose_scan_records; - KEYUSE *best_loose_scan_start_key; - - uint best_max_loose_keypart; - table_map best_ref_depend_map; - -public: - Loose_scan_opt(): - try_loosescan(false), - bound_sj_equalities(0), - quick_uses_applicable_index(0), - quick_max_loose_keypart(0), - best_loose_scan_key(0), - best_loose_scan_cost(0), - best_loose_scan_records(0), - best_loose_scan_start_key(NULL), - best_max_loose_keypart(0), - best_ref_depend_map(0) - { - } - - void init(JOIN *join, JOIN_TAB *s, table_map remaining_tables) - { - /* - Discover the bound equalities. We need to do this if - 1. The next table is an SJ-inner table, and - 2. It is the first table from that semijoin, and - 3. We're not within a semi-join range (i.e. all semi-joins either have - all or none of their tables in join_table_map), except - s->emb_sj_nest (which we've just entered, see #2). - 4. All non-IN-equality correlation references from this sj-nest are - bound - 5. But some of the IN-equalities aren't (so this can't be handled by - FirstMatch strategy) - */ - best_loose_scan_cost= DBL_MAX; - if (!join->emb_sjm_nest && s->emb_sj_nest && // (1) - s->emb_sj_nest->sj_in_exprs < 64 && - ((remaining_tables & s->emb_sj_nest->sj_inner_tables) == // (2) - s->emb_sj_nest->sj_inner_tables) && // (2) - join->cur_sj_inner_tables == 0 && // (3) - !(remaining_tables & - s->emb_sj_nest->nested_join->sj_corr_tables) && // (4) - remaining_tables & s->emb_sj_nest->nested_join->sj_depends_on &&// (5) - optimizer_flag(join->thd, OPTIMIZER_SWITCH_LOOSE_SCAN)) - { - /* This table is an LooseScan scan candidate */ - bound_sj_equalities= get_bound_sj_equalities(s->emb_sj_nest, - remaining_tables); - try_loosescan= TRUE; - DBUG_PRINT("info", ("Will try LooseScan scan, bound_map=%llx", - (longlong)bound_sj_equalities)); - } - } - - void next_ref_key() - { - handled_sj_equalities=0; - loose_scan_keyparts= 0; - max_loose_keypart= 0; - part1_conds_met= FALSE; - } - - void add_keyuse(table_map remaining_tables, KEYUSE *keyuse) - { - if (try_loosescan && keyuse->sj_pred_no != UINT_MAX && - (keyuse->table->file->index_flags(keyuse->key, 0, 1 ) & HA_READ_ORDER)) - - { - if (!(remaining_tables & keyuse->used_tables)) - { - /* - This allows to use equality propagation to infer that some - sj-equalities are bound. - */ - bound_sj_equalities |= 1ULL << keyuse->sj_pred_no; - } - else - { - handled_sj_equalities |= 1ULL << keyuse->sj_pred_no; - loose_scan_keyparts |= ((key_part_map)1) << keyuse->keypart; - set_if_bigger(max_loose_keypart, keyuse->keypart); - } - } - } - - bool have_a_case() { return MY_TEST(handled_sj_equalities); } - - void check_ref_access_part1(JOIN_TAB *s, uint key, KEYUSE *start_key, - table_map found_part) - { - /* - Check if we can use LooseScan semi-join strategy. We can if - 1. This is the right table at right location - 2. All IN-equalities are either - - "bound", ie. the outer_expr part refers to the preceding tables - - "handled", ie. covered by the index we're considering - 3. Index order allows to enumerate subquery's duplicate groups in - order. This happens when the index definition matches this - pattern: - - (handled_col|bound_col)* (other_col|bound_col) - - */ - if (try_loosescan && // (1) - (handled_sj_equalities | bound_sj_equalities) == // (2) - PREV_BITS(ulonglong, s->emb_sj_nest->sj_in_exprs) && // (2) - (PREV_BITS(key_part_map, max_loose_keypart+1) & // (3) - (found_part | loose_scan_keyparts)) == // (3) - PREV_BITS(key_part_map, max_loose_keypart+1) && // (3) - !key_uses_partial_cols(s->table->s, key)) - { - if (s->quick && s->quick->index == key && - s->quick->get_type() == QUICK_SELECT_I::QS_TYPE_RANGE) - { - quick_uses_applicable_index= TRUE; - quick_max_loose_keypart= max_loose_keypart; - } - DBUG_PRINT("info", ("Can use LooseScan scan")); - - if (found_part & 1) - { - /* Can use LooseScan on ref access if the first key part is bound */ - part1_conds_met= TRUE; - } - - /* - Check if this is a special case where there are no usable bound - IN-equalities, i.e. we have - - outer_expr IN (SELECT innertbl.key FROM ...) - - and outer_expr cannot be evaluated yet, so it's actually full - index scan and not a ref access. - We can do full index scan if it uses index-only. - */ - if (!(found_part & 1 ) && /* no usable ref access for 1st key part */ - s->table->covering_keys.is_set(key)) - { - part1_conds_met= TRUE; - DBUG_PRINT("info", ("Can use full index scan for LooseScan")); - - /* Calculate the cost of complete loose index scan. */ - double records= rows2double(s->table->file->stats.records); - - /* The cost is entire index scan cost (divided by 2) */ - double read_time= s->table->file->keyread_time(key, 1, - (ha_rows) records); - - /* - Now find out how many different keys we will get (for now we - ignore the fact that we have "keypart_i=const" restriction for - some key components, that may make us think think that loose - scan will produce more distinct records than it actually will) - */ - ulong rpc; - if ((rpc= s->table->key_info[key].rec_per_key[max_loose_keypart])) - records= records / rpc; - - // TODO: previous version also did /2 - if (read_time < best_loose_scan_cost) - { - best_loose_scan_key= key; - best_loose_scan_cost= read_time; - best_loose_scan_records= records; - best_max_loose_keypart= max_loose_keypart; - best_loose_scan_start_key= start_key; - best_ref_depend_map= 0; - } - } - } - } - - void check_ref_access_part2(uint key, KEYUSE *start_key, double records, - double read_time, table_map ref_depend_map_arg) - { - if (part1_conds_met && read_time < best_loose_scan_cost) - { - /* TODO use rec-per-key-based fanout calculations */ - best_loose_scan_key= key; - best_loose_scan_cost= read_time; - best_loose_scan_records= records; - best_max_loose_keypart= max_loose_keypart; - best_loose_scan_start_key= start_key; - best_ref_depend_map= ref_depend_map_arg; - } - } - - void check_range_access(JOIN *join, uint idx, QUICK_SELECT_I *quick) - { - /* TODO: this the right part restriction: */ - if (quick_uses_applicable_index && idx == join->const_tables && - quick->read_time < best_loose_scan_cost) - { - best_loose_scan_key= quick->index; - best_loose_scan_cost= quick->read_time; - /* this is ok because idx == join->const_tables */ - best_loose_scan_records= rows2double(quick->records); - best_max_loose_keypart= quick_max_loose_keypart; - best_loose_scan_start_key= NULL; - best_ref_depend_map= 0; - } - } - - void save_to_position(JOIN_TAB *tab, POSITION *pos) - { - pos->read_time= best_loose_scan_cost; - if (best_loose_scan_cost != DBL_MAX) - { - pos->records_read= best_loose_scan_records; - pos->key= best_loose_scan_start_key; - pos->cond_selectivity= 1.0; - pos->loosescan_picker.loosescan_key= best_loose_scan_key; - pos->loosescan_picker.loosescan_parts= best_max_loose_keypart + 1; - pos->use_join_buffer= FALSE; - pos->table= tab; - pos->range_rowid_filter_info= tab->range_rowid_filter_info; - pos->ref_depend_map= best_ref_depend_map; - DBUG_PRINT("info", ("Produced a LooseScan plan, key %s, %s", - tab->table->key_info[best_loose_scan_key].name.str, - best_loose_scan_start_key? "(ref access)": - "(range/index access)")); - } - } -}; - - -void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, - double *current_record_count, double *current_read_time, - POSITION *loose_scan_pos); -void restore_prev_sj_state(const table_map remaining_tables, - const JOIN_TAB *tab, uint idx); - -void fix_semijoin_strategies_for_picked_join_order(JOIN *join); - -bool setup_sj_materialization_part1(JOIN_TAB *sjm_tab); -bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab); -uint get_number_of_tables_at_top_level(JOIN *join); - - -/* - Temporary table used by semi-join DuplicateElimination strategy - - This consists of the temptable itself and data needed to put records - into it. The table's DDL is as follows: - - CREATE TABLE tmptable (col VARCHAR(n) BINARY, PRIMARY KEY(col)); - - where the primary key can be replaced with unique constraint if n exceeds - the limit (as it is always done for query execution-time temptables). - - The record value is a concatenation of rowids of tables from the join we're - executing. If a join table is on the inner side of the outer join, we - assume that its rowid can be NULL and provide means to store this rowid in - the tuple. -*/ - -class SJ_TMP_TABLE : public Sql_alloc -{ -public: - /* - Array of pointers to tables whose rowids compose the temporary table - record. - */ - class TAB - { - public: - JOIN_TAB *join_tab; - uint rowid_offset; - ushort null_byte; - uchar null_bit; - }; - TAB *tabs; - TAB *tabs_end; - - /* - is_degenerate==TRUE means this is a special case where the temptable record - has zero length (and presence of a unique key means that the temptable can - have either 0 or 1 records). - In this case we don't create the physical temptable but instead record - its state in SJ_TMP_TABLE::have_degenerate_row. - */ - bool is_degenerate; - - /* - When is_degenerate==TRUE: the contents of the table (whether it has the - record or not). - */ - bool have_degenerate_row; - - /* table record parameters */ - uint null_bits; - uint null_bytes; - uint rowid_len; - - /* The temporary table itself (NULL means not created yet) */ - TABLE *tmp_table; - - /* - These are the members we got from temptable creation code. We'll need - them if we'll need to convert table from HEAP to MyISAM/Maria. - */ - TMP_ENGINE_COLUMNDEF *start_recinfo; - TMP_ENGINE_COLUMNDEF *recinfo; - - SJ_TMP_TABLE *next_flush_table; - - int sj_weedout_delete_rows(); - int sj_weedout_check_row(THD *thd); - bool create_sj_weedout_tmp_table(THD *thd); -}; - -int setup_semijoin_loosescan(JOIN *join); -int setup_semijoin_dups_elimination(JOIN *join, ulonglong options, - uint no_jbuf_after); -void destroy_sj_tmp_tables(JOIN *join); -int clear_sj_tmp_tables(JOIN *join); -int rewrite_to_index_subquery_engine(JOIN *join); - - -void get_delayed_table_estimates(TABLE *table, - ha_rows *out_rows, - double *scan_time, - double *startup_cost); - -enum_nested_loop_state join_tab_execution_startup(JOIN_TAB *tab); - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_trace.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_trace.h deleted file mode 100644 index 550f18c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_trace.h +++ /dev/null @@ -1,210 +0,0 @@ -#ifndef OPT_TRACE_INCLUDED -#define OPT_TRACE_INCLUDED -/* This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include "opt_trace_context.h" // Opt_trace_context -#include "sql_lex.h" -#include "my_json_writer.h" -#include "sql_select.h" -class Item; -class THD; -struct TABLE_LIST; - -/* - User-visible information about a trace. -*/ - -struct Opt_trace_info -{ - /** - String containing trace. - If trace has been end()ed, this is 0-terminated, which is only to aid - debugging or unit testing; this property is not relied upon in normal - server usage. - If trace has not been ended, this is not 0-terminated. That rare case can - happen when a substatement reads OPTIMIZER_TRACE (at that stage, the top - statement is still executing so its trace is not ended yet, but may still - be read by the sub-statement). - */ - const char *trace_ptr; - size_t trace_length; - //// String containing original query. - const char *query_ptr; - size_t query_length; - const CHARSET_INFO *query_charset; ///< charset of query string - /** - How many bytes this trace is missing (for traces which were truncated - because of @@@@optimizer-trace-max-mem-size). - The trace is not extended beyond trace-max-mem-size. - */ - size_t missing_bytes; - /* - Whether user lacks privilege to see this trace. - If this is set to TRUE, then we return an empty trace - */ - bool missing_priv; -}; - -/** - Instantiate this class to start tracing a THD's actions (generally at a - statement's start), and to set the "original" query (not transformed, as - sent by client) for the new trace. Destructor will end the trace. - - @param thd the THD - @param tbl list of tables read/written by the statement. - @param sql_command SQL command being prepared or executed - @param set_vars what variables are set by this command (only used if - sql_command is SQLCOM_SET_OPTION) - @param query query - @param length query's length - @param charset charset which was used to encode this query -*/ - - -class Opt_trace_start { - public: - Opt_trace_start(THD *thd_arg, TABLE_LIST *tbl, - enum enum_sql_command sql_command, - List *set_vars, - const char *query, - size_t query_length, - const CHARSET_INFO *query_charset); - ~Opt_trace_start(); - - private: - Opt_trace_context *const ctx; - /* - True: the query will be traced - False: otherwise - */ - bool traceable; -}; - -/** - Prints SELECT query to optimizer trace. It is not the original query (as in - @c Opt_trace_context::set_query()) but a printout of the parse tree - (Item-s). - @param thd the THD - @param select_lex query's parse tree - @param trace_object Json_writer object to which the query will be added -*/ -void opt_trace_print_expanded_query(THD *thd, SELECT_LEX *select_lex, - Json_writer_object *trace_object); - -void add_table_scan_values_to_trace(THD *thd, JOIN_TAB *tab); -void trace_plan_prefix(JOIN *join, uint idx, table_map join_tables); -void print_final_join_order(JOIN *join); -void print_best_access_for_table(THD *thd, POSITION *pos, - enum join_type type); - -/* - Security related (need to add a proper comment here) -*/ - -/** - If the security context is not that of the connected user, inform the trace - system that a privilege is missing. With one exception: see below. - - @param thd - - This serves to eliminate the following issue. - Any information readable by a SELECT may theoretically end up in - the trace. And a SELECT may read information from other places than tables: - - from views (reading their bodies) - - from stored routines (reading their bodies) - - from files (reading their content), with LOAD_FILE() - - from the list of connections (reading their queries...), with - I_S.PROCESSLIST. - If the connected user has EXECUTE privilege on a routine which does a - security context change, the routine can retrieve information internally - (if allowed by the SUID context's privileges), and present only a portion - of it to the connected user. But with tracing on, all information is - possibly in the trace. So the connected user receives more information than - the routine's definer intended to provide. Fixing this issue would require - adding, near many privilege checks in the server, a new - optimizer-trace-specific check done against the connected user's context, - to verify that the connected user has the right to see the retrieved - information. - - Instead, our chosen simpler solution is that if we see a security context - change where SUID user is not the connected user, we disable tracing. With - only one safe exception: if the connected user has all global privileges - (because then she/he can find any information anyway). By "all global - privileges" we mean everything but WITH GRANT OPTION (that latter one isn't - related to information gathering). - - Read access to I_S.OPTIMIZER_TRACE by another user than the connected user - is restricted: @see fill_optimizer_trace_info(). -*/ -void opt_trace_disable_if_no_security_context_access(THD *thd); - -void opt_trace_disable_if_no_tables_access(THD *thd, TABLE_LIST *tbl); - -/** - If tracing is on, checks additional privileges for a view, to make sure - that the user has the right to do SHOW CREATE VIEW. For that: - - this function checks SHOW VIEW - - SELECT is tested in opt_trace_disable_if_no_tables_access() - - SELECT + SHOW VIEW is sufficient for SHOW CREATE VIEW. - We also check underlying tables. - If a privilege is missing, notifies the trace system. - This function should be called when the view's underlying tables have not - yet been merged. - - @param thd THD context - @param view view to check - @param underlying_tables underlying tables/views of 'view' - */ - -void opt_trace_disable_if_no_view_access(THD *thd, TABLE_LIST *view, - TABLE_LIST *underlying_tables); - -/** - If tracing is on, checks additional privileges on a stored routine, to make - sure that the user has the right to do SHOW CREATE PROCEDURE/FUNCTION. For - that, we use the same checks as in those SHOW commands. - If a privilege is missing, notifies the trace system. - - This function is not redundant with - opt_trace_disable_if_no_security_context_access(). - Indeed, for a SQL SECURITY INVOKER routine, there is no context change, but - we must still verify that the invoker can do SHOW CREATE. - - For triggers, see note in sp_head::execute_trigger(). - - @param thd - @param sp routine to check - */ -void opt_trace_disable_if_no_stored_proc_func_access(THD *thd, sp_head *sp); - -/** - Fills information_schema.OPTIMIZER_TRACE with rows (one per trace) - @retval 0 ok - @retval 1 error -*/ -int fill_optimizer_trace_info(THD *thd, TABLE_LIST *tables, Item *); - -#define OPT_TRACE_TRANSFORM(thd, object_level0, object_level1, \ - select_number, from, to) \ - Json_writer_object object_level0(thd); \ - Json_writer_object object_level1(thd, "transformation"); \ - object_level1.add_select_number(select_number).add("from", from).add("to", to); - -#define OPT_TRACE_VIEWS_TRANSFORM(thd, object_level0, object_level1, \ - derived, name, select_number, algorithm) \ - Json_writer_object trace_wrapper(thd); \ - Json_writer_object trace_derived(thd, derived); \ - trace_derived.add("table", name).add_select_number(select_number) \ - .add("algorithm", algorithm); -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_trace_context.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_trace_context.h deleted file mode 100644 index f578a0c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/opt_trace_context.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef OPT_TRACE_CONTEXT_INCLUDED -#define OPT_TRACE_CONTEXT_INCLUDED - -#include "sql_array.h" - -class Opt_trace_context; -struct Opt_trace_info; -class Json_writer; - -class Opt_trace_stmt { - public: - /** - Constructor, starts a trace for information_schema and dbug. - @param ctx_arg context - */ - Opt_trace_stmt(Opt_trace_context *ctx_arg); - ~Opt_trace_stmt(); - void set_query(const char *query_ptr, size_t length, const CHARSET_INFO *charset); - void open_struct(const char *key, char opening_bracket); - void close_struct(const char *saved_key, char closing_bracket); - void fill_info(Opt_trace_info* info); - void add(const char *key, char *opening_bracket, size_t val_length); - Json_writer* get_current_json() {return current_json;} - void missing_privilege(); - void disable_tracing_for_children(); - void enable_tracing_for_children(); - bool is_enabled() - { - return I_S_disabled == 0; - } - void set_allowed_mem_size(size_t mem_size); - size_t get_length(); - size_t get_truncated_bytes(); - bool get_missing_priv() { return missing_priv; } - -private: - Opt_trace_context *ctx; - String query; // store the query sent by the user - Json_writer *current_json; // stores the trace - bool missing_priv; ///< whether user lacks privilege to see this trace - /* - 0 <=> this trace should be in information_schema. - !=0 tracing is disabled, this currently happens when we want to trace a - sub-statement. For now traces are only collect for the top statement - not for the sub-statments. - */ - uint I_S_disabled; -}; - - -class Opt_trace_context -{ -public: - Opt_trace_context(); - ~Opt_trace_context(); - - void start(THD *thd, TABLE_LIST *tbl, - enum enum_sql_command sql_command, - const char *query, - size_t query_length, - const CHARSET_INFO *query_charset, - ulong max_mem_size_arg); - void end(); - void set_query(const char *query, size_t length, const CHARSET_INFO *charset); - void delete_traces(); - void set_allowed_mem_size(size_t mem_size); - size_t remaining_mem_size(); - -private: - Opt_trace_stmt* top_trace() - { - return *(traces.front()); - } - -public: - - /* - This returns the top trace from the list of traces. This function - is used when we want to see the contents of the INFORMATION_SCHEMA.OPTIMIZER_TRACE - table. - */ - - Opt_trace_stmt* get_top_trace() - { - if (!traces.elements()) - return NULL; - return top_trace(); - } - - /* - This returns the current trace, to which we are still writing and has not been finished - */ - - Json_writer* get_current_json() - { - if (!is_started()) - return NULL; - return current_trace->get_current_json(); - } - - bool empty() - { - return static_cast(traces.elements()) == 0; - } - - bool is_started() - { - return current_trace && current_trace->is_enabled(); - } - - bool disable_tracing_if_required(); - - bool enable_tracing_if_required(); - - bool is_enabled(); - - void missing_privilege(); - - static const char *flag_names[]; - enum - { - FLAG_DEFAULT = 0, - FLAG_ENABLED = 1 << 0 - }; - -private: - /* - List of traces (currently it stores only 1 trace) - */ - Dynamic_array traces; - Opt_trace_stmt *current_trace; - size_t max_mem_size; -}; - -#endif /* OPT_TRACE_CONTEXT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/parse_file.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/parse_file.h deleted file mode 100644 index cbd41d1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/parse_file.h +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- C++ -*- */ -/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _PARSE_FILE_H_ -#define _PARSE_FILE_H_ - -#include "sql_string.h" // LEX_STRING -#include "sql_alloc.h" // Sql_alloc - -class THD; - -typedef struct st_mem_root MEM_ROOT; - -#define PARSE_FILE_TIMESTAMPLENGTH 19 - -enum file_opt_type { - FILE_OPTIONS_STRING, /**< String (LEX_STRING) */ - FILE_OPTIONS_ESTRING, /**< Escaped string (LEX_STRING) */ - FILE_OPTIONS_ULONGLONG, /**< ulonglong parameter (ulonglong) */ - FILE_OPTIONS_VIEW_ALGO, /**< Similar to longlong, but needs conversion */ - FILE_OPTIONS_TIMESTAMP, /**< timestamp (LEX_STRING have to be - allocated with length 20 (19+1) */ - FILE_OPTIONS_STRLIST, /**< list of escaped strings - (List) */ - FILE_OPTIONS_ULLLIST /**< list of ulonglong values - (List) */ -}; - -struct File_option -{ - LEX_CSTRING name; /**< Name of the option */ - my_ptrdiff_t offset; /**< offset to base address of value */ - file_opt_type type; /**< Option type */ -}; - - -/** - This hook used to catch no longer supported keys and process them for - backward compatibility. -*/ - -class Unknown_key_hook -{ -public: - Unknown_key_hook() {} /* Remove gcc warning */ - virtual ~Unknown_key_hook() {} /* Remove gcc warning */ - virtual bool process_unknown_string(const char *&unknown_key, uchar* base, - MEM_ROOT *mem_root, const char *end)= 0; -}; - - -/** Dummy hook for parsers which do not need hook for unknown keys. */ - -class File_parser_dummy_hook: public Unknown_key_hook -{ -public: - File_parser_dummy_hook() {} /* Remove gcc warning */ - virtual bool process_unknown_string(const char *&unknown_key, uchar* base, - MEM_ROOT *mem_root, const char *end); -}; - -extern File_parser_dummy_hook file_parser_dummy_hook; - -bool get_file_options_ulllist(const char *&ptr, const char *end, - const char *line, uchar* base, - File_option *parameter, - MEM_ROOT *mem_root); - -const char * -parse_escaped_string(const char *ptr, const char *end, MEM_ROOT *mem_root, - LEX_CSTRING *str); - -class File_parser; -File_parser *sql_parse_prepare(const LEX_CSTRING *file_name, - MEM_ROOT *mem_root, bool bad_format_errors); - -my_bool -sql_create_definition_file(const LEX_CSTRING *dir, - const LEX_CSTRING *file_name, - const LEX_CSTRING *type, - uchar* base, File_option *parameters); -my_bool rename_in_schema_file(THD *thd, - const char *schema, const char *old_name, - const char *new_db, const char *new_name); - -class File_parser: public Sql_alloc -{ - char *start, *end; - LEX_CSTRING file_type; - bool content_ok; -public: - File_parser() :start(0), end(0), content_ok(0) - { file_type.str= 0; file_type.length= 0; } - - bool ok() { return content_ok; } - const LEX_CSTRING *type() const { return &file_type; } - my_bool parse(uchar* base, MEM_ROOT *mem_root, - struct File_option *parameters, uint required, - Unknown_key_hook *hook) const; - - friend File_parser *sql_parse_prepare(const LEX_CSTRING *file_name, - MEM_ROOT *mem_root, - bool bad_format_errors); -}; -#endif /* _PARSE_FILE_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/partition_element.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/partition_element.h deleted file mode 100644 index ff0d0d5..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/partition_element.h +++ /dev/null @@ -1,170 +0,0 @@ -#ifndef PARTITION_ELEMENT_INCLUDED -#define PARTITION_ELEMENT_INCLUDED - -/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "my_base.h" /* ha_rows */ -#include "handler.h" /* UNDEF_NODEGROUP */ - -/** - * An enum and a struct to handle partitioning and subpartitioning. - */ -enum partition_type { - NOT_A_PARTITION= 0, - RANGE_PARTITION, - HASH_PARTITION, - LIST_PARTITION, - VERSIONING_PARTITION -}; - -enum partition_state { - PART_NORMAL= 0, - PART_IS_DROPPED= 1, - PART_TO_BE_DROPPED= 2, - PART_TO_BE_ADDED= 3, - PART_TO_BE_REORGED= 4, - PART_REORGED_DROPPED= 5, - PART_CHANGED= 6, - PART_IS_CHANGED= 7, - PART_IS_ADDED= 8, - PART_ADMIN= 9 -}; - -/* - This struct is used to keep track of column expressions as part - of the COLUMNS concept in conjunction with RANGE and LIST partitioning. - The value can be either of MINVALUE, MAXVALUE and an expression that - must be constant and evaluate to the same type as the column it - represents. - - The data in this fixed in two steps. The parser will only fill in whether - it is a max_value or provide an expression. Filling in - column_value, part_info, partition_id, null_value is done by the - function fix_column_value_function. However the item tree needs - fixed also before writing it into the frm file (in add_column_list_values). - To distinguish between those two variants, fixed= 1 after the - fixing in add_column_list_values and fixed= 2 otherwise. This is - since the fixing in add_column_list_values isn't a complete fixing. -*/ - -typedef struct p_column_list_val -{ - void* column_value; - Item* item_expression; - partition_info *part_info; - uint partition_id; - bool max_value; // MAXVALUE for RANGE type or DEFAULT value for LIST type - bool null_value; - char fixed; -} part_column_list_val; - - -/* - This struct is used to contain the value of an element - in the VALUES IN struct. It needs to keep knowledge of - whether it is a signed/unsigned value and whether it is - NULL or not. -*/ - -typedef struct p_elem_val -{ - longlong value; - uint added_items; - bool null_value; - bool unsigned_flag; - part_column_list_val *col_val_array; -} part_elem_value; - -struct st_ddl_log_memory_entry; - -enum stat_trx_field -{ - STAT_TRX_END= 0 -}; - -class partition_element :public Sql_alloc -{ -public: - enum elem_type_enum - { - CONVENTIONAL= 0, - CURRENT, - HISTORY - }; - - List subpartitions; - List list_val_list; - ha_rows part_max_rows; - ha_rows part_min_rows; - longlong range_value; - const char *partition_name; - const char *tablespace_name; - struct st_ddl_log_memory_entry *log_entry; - const char* part_comment; - const char* data_file_name; - const char* index_file_name; - handlerton *engine_type; - LEX_CSTRING connect_string; - enum partition_state part_state; - uint16 nodegroup_id; - bool has_null_value; - bool signed_flag; // Range value signed - bool max_value; // MAXVALUE range - uint32 id; - bool empty; - elem_type_enum type; - - partition_element() - : part_max_rows(0), part_min_rows(0), range_value(0), - partition_name(NULL), tablespace_name(NULL), - log_entry(NULL), part_comment(NULL), - data_file_name(NULL), index_file_name(NULL), - engine_type(NULL), connect_string(null_clex_str), part_state(PART_NORMAL), - nodegroup_id(UNDEF_NODEGROUP), has_null_value(FALSE), - signed_flag(FALSE), max_value(FALSE), - id(UINT_MAX32), - empty(true), - type(CONVENTIONAL) - {} - partition_element(partition_element *part_elem) - : part_max_rows(part_elem->part_max_rows), - part_min_rows(part_elem->part_min_rows), - range_value(0), partition_name(NULL), - tablespace_name(part_elem->tablespace_name), - part_comment(part_elem->part_comment), - data_file_name(part_elem->data_file_name), - index_file_name(part_elem->index_file_name), - engine_type(part_elem->engine_type), - connect_string(null_clex_str), - part_state(part_elem->part_state), - nodegroup_id(part_elem->nodegroup_id), - has_null_value(FALSE), - id(part_elem->id), - empty(part_elem->empty), - type(CONVENTIONAL) - {} - ~partition_element() {} - - part_column_list_val& get_col_val(uint idx) - { - part_elem_value *ev= list_val_list.head(); - DBUG_ASSERT(ev); - DBUG_ASSERT(ev->col_val_array); - return ev->col_val_array[idx]; - } -}; - -#endif /* PARTITION_ELEMENT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/partition_info.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/partition_info.h deleted file mode 100644 index 0656238..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/partition_info.h +++ /dev/null @@ -1,551 +0,0 @@ -#ifndef PARTITION_INFO_INCLUDED -#define PARTITION_INFO_INCLUDED - -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_class.h" -#include "partition_element.h" -#include "sql_partition.h" - -class partition_info; -struct TABLE_LIST; -/* Some function typedefs */ -typedef int (*get_part_id_func)(partition_info *part_info, uint32 *part_id, - longlong *func_value); -typedef int (*get_subpart_id_func)(partition_info *part_info, uint32 *part_id); -typedef bool (*check_constants_func)(THD *thd, partition_info *part_info); - -struct st_ddl_log_memory_entry; - -#define MAX_PART_NAME_SIZE 8 - - -struct Vers_part_info : public Sql_alloc -{ - Vers_part_info() : - limit(0), - now_part(NULL), - hist_part(NULL) - { - interval.type= INTERVAL_LAST; - } - Vers_part_info(Vers_part_info &src) : - interval(src.interval), - limit(src.limit), - now_part(NULL), - hist_part(NULL) - { - } - bool initialized() - { - if (now_part) - { - DBUG_ASSERT(now_part->id != UINT_MAX32); - DBUG_ASSERT(now_part->type == partition_element::CURRENT); - if (hist_part) - { - DBUG_ASSERT(hist_part->id != UINT_MAX32); - DBUG_ASSERT(hist_part->type == partition_element::HISTORY); - } - return true; - } - return false; - } - struct { - my_time_t start; - INTERVAL step; - enum interval_type type; - bool is_set() { return type < INTERVAL_LAST; } - } interval; - ulonglong limit; - partition_element *now_part; - partition_element *hist_part; -}; - -class partition_info : public Sql_alloc -{ -public: - /* - * Here comes a set of definitions needed for partitioned table handlers. - */ - List partitions; - List temp_partitions; - - List part_field_list; - List subpart_field_list; - - /* - If there is no subpartitioning, use only this func to get partition ids. - If there is subpartitioning, use the this func to get partition id when - you have both partition and subpartition fields. - */ - get_part_id_func get_partition_id; - - /* Get partition id when we don't have subpartition fields */ - get_part_id_func get_part_partition_id; - - /* - Get subpartition id when we have don't have partition fields by we do - have subpartition ids. - Mikael said that for given constant tuple - {subpart_field1, ..., subpart_fieldN} the subpartition id will be the - same in all subpartitions - */ - get_subpart_id_func get_subpartition_id; - - /* - When we have various string fields we might need some preparation - before and clean-up after calling the get_part_id_func's. We need - one such method for get_part_partition_id and one for - get_subpartition_id. - */ - get_part_id_func get_part_partition_id_charset; - get_subpart_id_func get_subpartition_id_charset; - - check_constants_func check_constants; - - /* NULL-terminated array of fields used in partitioned expression */ - Field **part_field_array; - Field **subpart_field_array; - Field **part_charset_field_array; - Field **subpart_charset_field_array; - /* - Array of all fields used in partition and subpartition expression, - without duplicates, NULL-terminated. - */ - Field **full_part_field_array; - /* - Set of all fields used in partition and subpartition expression. - Required for testing of partition fields in write_set when - updating. We need to set all bits in read_set because the row may - need to be inserted in a different [sub]partition. - */ - MY_BITMAP full_part_field_set; - - /* - When we have a field that requires transformation before calling the - partition functions we must allocate field buffers for the field of - the fields in the partition function. - */ - uchar **part_field_buffers; - uchar **subpart_field_buffers; - uchar **restore_part_field_ptrs; - uchar **restore_subpart_field_ptrs; - - Item *part_expr; - Item *subpart_expr; - - Item *item_free_list; - - struct st_ddl_log_memory_entry *first_log_entry; - struct st_ddl_log_memory_entry *exec_log_entry; - struct st_ddl_log_memory_entry *frm_log_entry; - - /* - Bitmaps of partitions used by the current query. - * read_partitions - partitions to be used for reading. - * lock_partitions - partitions that must be locked (read or write). - Usually read_partitions is the same set as lock_partitions, but - in case of UPDATE the WHERE clause can limit the read_partitions set, - but not neccesarily the lock_partitions set. - Usage pattern: - * Initialized in ha_partition::open(). - * read+lock_partitions is set according to explicit PARTITION, - WL#5217, in open_and_lock_tables(). - * Bits in read_partitions can be cleared in prune_partitions() - in the optimizing step. - (WL#4443 is about allowing prune_partitions() to affect lock_partitions - and be done before locking too). - * When the partition enabled handler get an external_lock call it locks - all partitions in lock_partitions (and remembers which partitions it - locked, so that it can unlock them later). In case of LOCK TABLES it will - lock all partitions, and keep them locked while lock_partitions can - change for each statement under LOCK TABLES. - * Freed at the same time item_free_list is freed. - */ - MY_BITMAP read_partitions; - MY_BITMAP lock_partitions; - bool bitmaps_are_initialized; - - union { - longlong *range_int_array; - LIST_PART_ENTRY *list_array; - part_column_list_val *range_col_array; - part_column_list_val *list_col_array; - }; - - Vers_part_info *vers_info; - - /******************************************** - * INTERVAL ANALYSIS - ********************************************/ - /* - Partitioning interval analysis function for partitioning, or NULL if - interval analysis is not supported for this kind of partitioning. - */ - get_partitions_in_range_iter get_part_iter_for_interval; - /* - Partitioning interval analysis function for subpartitioning, or NULL if - interval analysis is not supported for this kind of partitioning. - */ - get_partitions_in_range_iter get_subpart_iter_for_interval; - - /******************************************** - * INTERVAL ANALYSIS ENDS - ********************************************/ - - longlong err_value; - char* part_info_string; - - partition_element *curr_part_elem; // part or sub part - partition_element *current_partition; // partition - part_elem_value *curr_list_val; - uint curr_list_object; - uint num_columns; - - TABLE *table; - /* - These key_map's are used for Partitioning to enable quick decisions - on whether we can derive more information about which partition to - scan just by looking at what index is used. - */ - key_map all_fields_in_PF, all_fields_in_PPF, all_fields_in_SPF; - key_map some_fields_in_PF; - - handlerton *default_engine_type; - partition_type part_type; - partition_type subpart_type; - - uint part_info_len; - - uint num_parts; - uint num_subparts; - uint count_curr_subparts; // used during parsing - - uint num_list_values; - - uint num_part_fields; - uint num_subpart_fields; - uint num_full_part_fields; - - uint has_null_part_id; - uint32 default_partition_id; - /* - This variable is used to calculate the partition id when using - LINEAR KEY/HASH. This functionality is kept in the MySQL Server - but mainly of use to handlers supporting partitioning. - */ - uint16 linear_hash_mask; - /* - PARTITION BY KEY ALGORITHM=N - Which algorithm to use for hashing the fields. - N = 1 - Use 5.1 hashing (numeric fields are hashed as binary) - N = 2 - Use 5.5 hashing (numeric fields are hashed like latin1 bytes) - */ - enum enum_key_algorithm - { - KEY_ALGORITHM_NONE= 0, - KEY_ALGORITHM_51= 1, - KEY_ALGORITHM_55= 2 - }; - enum_key_algorithm key_algorithm; - - /* Only the number of partitions defined (uses default names and options). */ - bool use_default_partitions; - bool use_default_num_partitions; - /* Only the number of subpartitions defined (uses default names etc.). */ - bool use_default_subpartitions; - bool use_default_num_subpartitions; - bool default_partitions_setup; - bool defined_max_value; - inline bool has_default_partititon() - { - return (part_type == LIST_PARTITION && defined_max_value); - } - bool list_of_part_fields; // KEY or COLUMNS PARTITIONING - bool list_of_subpart_fields; // KEY SUBPARTITIONING - bool linear_hash_ind; // LINEAR HASH/KEY - bool fixed; - bool is_auto_partitioned; - bool has_null_value; - bool column_list; // COLUMNS PARTITIONING, 5.5+ - - partition_info() - : get_partition_id(NULL), get_part_partition_id(NULL), - get_subpartition_id(NULL), - part_field_array(NULL), subpart_field_array(NULL), - part_charset_field_array(NULL), - subpart_charset_field_array(NULL), - full_part_field_array(NULL), - part_field_buffers(NULL), subpart_field_buffers(NULL), - restore_part_field_ptrs(NULL), restore_subpart_field_ptrs(NULL), - part_expr(NULL), subpart_expr(NULL), item_free_list(NULL), - first_log_entry(NULL), exec_log_entry(NULL), frm_log_entry(NULL), - bitmaps_are_initialized(FALSE), - list_array(NULL), vers_info(NULL), err_value(0), - part_info_string(NULL), - curr_part_elem(NULL), current_partition(NULL), - curr_list_object(0), num_columns(0), table(NULL), - default_engine_type(NULL), - part_type(NOT_A_PARTITION), subpart_type(NOT_A_PARTITION), - part_info_len(0), - num_parts(0), num_subparts(0), - count_curr_subparts(0), - num_list_values(0), num_part_fields(0), num_subpart_fields(0), - num_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0), - key_algorithm(KEY_ALGORITHM_NONE), - use_default_partitions(TRUE), use_default_num_partitions(TRUE), - use_default_subpartitions(TRUE), use_default_num_subpartitions(TRUE), - default_partitions_setup(FALSE), defined_max_value(FALSE), - list_of_part_fields(FALSE), list_of_subpart_fields(FALSE), - linear_hash_ind(FALSE), fixed(FALSE), - is_auto_partitioned(FALSE), - has_null_value(FALSE), column_list(FALSE) - { - all_fields_in_PF.clear_all(); - all_fields_in_PPF.clear_all(); - all_fields_in_SPF.clear_all(); - some_fields_in_PF.clear_all(); - partitions.empty(); - temp_partitions.empty(); - part_field_list.empty(); - subpart_field_list.empty(); - } - ~partition_info() {} - - partition_info *get_clone(THD *thd); - bool set_named_partition_bitmap(const char *part_name, size_t length); - bool set_partition_bitmaps(List *partition_names); - bool set_partition_bitmaps_from_table(TABLE_LIST *table_list); - /* Answers the question if subpartitioning is used for a certain table */ - bool is_sub_partitioned() - { - return (subpart_type == NOT_A_PARTITION ? FALSE : TRUE); - } - - /* Returns the total number of partitions on the leaf level */ - uint get_tot_partitions() - { - return num_parts * (is_sub_partitioned() ? num_subparts : 1); - } - - bool set_up_defaults_for_partitioning(THD *thd, handler *file, - HA_CREATE_INFO *info, - uint start_no); - const char *find_duplicate_field(); - char *find_duplicate_name(); - bool check_engine_mix(handlerton *engine_type, bool default_engine); - bool check_partition_info(THD *thd, handlerton **eng_type, - handler *file, HA_CREATE_INFO *info, - partition_info *add_or_reorg_part= NULL); - void print_no_partition_found(TABLE *table, myf errflag); - void print_debug(const char *str, uint*); - Item* get_column_item(Item *item, Field *field); - int fix_partition_values(THD *thd, - part_elem_value *val, - partition_element *part_elem); - bool fix_column_value_functions(THD *thd, - part_elem_value *val, - uint part_id); - bool fix_parser_data(THD *thd); - int add_max_value(THD *thd); - void init_col_val(part_column_list_val *col_val, Item *item); - int reorganize_into_single_field_col_val(THD *thd); - part_column_list_val *add_column_value(THD *thd); - bool set_part_expr(THD *thd, Item *item_ptr, bool is_subpart); - bool set_up_charset_field_preps(THD *thd); - bool check_partition_field_length(); - bool init_column_part(THD *thd); - bool add_column_list_value(THD *thd, Item *item); - partition_element *get_part_elem(const char *partition_name, char *file_name, - size_t file_name_size, uint32 *part_id); - void report_part_expr_error(bool use_subpart_expr); - bool has_same_partitioning(partition_info *new_part_info); - bool error_if_requires_values() const; -private: - bool set_up_default_partitions(THD *thd, handler *file, HA_CREATE_INFO *info, - uint start_no); - bool set_up_default_subpartitions(THD *thd, handler *file, - HA_CREATE_INFO *info); - char *create_default_partition_names(THD *thd, uint part_no, uint num_parts, - uint start_no); - char *create_default_subpartition_name(THD *thd, uint subpart_no, - const char *part_name); - bool prune_partition_bitmaps(List *partition_names); // set_read_partitions() in 8.0 - bool add_named_partition(const char *part_name, size_t length); -public: - bool has_unique_name(partition_element *element); - bool field_in_partition_expr(Field *field) const; - - bool vers_init_info(THD *thd); - bool vers_set_interval(THD *thd, Item *interval, - interval_type int_type, Item *starts, - const char *table_name); - bool vers_set_limit(ulonglong limit) - { - DBUG_ASSERT(part_type == VERSIONING_PARTITION); - vers_info->limit= limit; - return !limit; - } - void vers_set_hist_part(THD *thd); - bool vers_fix_field_list(THD *thd); - void vers_update_el_ids(); - partition_element *get_partition(uint part_id) - { - List_iterator it(partitions); - partition_element *el; - while ((el= it++)) - { - if (el->id == part_id) - return el; - } - return NULL; - } - uint next_part_no(uint new_parts) const; -}; - -uint32 get_next_partition_id_range(struct st_partition_iter* part_iter); -bool check_partition_dirs(partition_info *part_info); - -/* Initialize the iterator to return a single partition with given part_id */ - -static inline void init_single_partition_iterator(uint32 part_id, - PARTITION_ITERATOR *part_iter) -{ - part_iter->part_nums.start= part_iter->part_nums.cur= part_id; - part_iter->part_nums.end= part_id+1; - part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; - part_iter->ret_default_part= part_iter->ret_default_part_orig= FALSE; - part_iter->get_next= get_next_partition_id_range; -} - -/* Initialize the iterator to enumerate all partitions */ -static inline -void init_all_partitions_iterator(partition_info *part_info, - PARTITION_ITERATOR *part_iter) -{ - part_iter->part_nums.start= part_iter->part_nums.cur= 0; - part_iter->part_nums.end= part_info->num_parts; - part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; - part_iter->ret_default_part= part_iter->ret_default_part_orig= FALSE; - part_iter->get_next= get_next_partition_id_range; -} - - -/** - @brief Update part_field_list by row_end field name - - @returns true on error; false on success -*/ -inline -bool partition_info::vers_fix_field_list(THD * thd) -{ - if (!table->versioned()) - { - // frm must be corrupted, normally CREATE/ALTER TABLE checks for that - my_error(ER_FILE_CORRUPT, MYF(0), table->s->path.str); - return true; - } - DBUG_ASSERT(part_type == VERSIONING_PARTITION); - DBUG_ASSERT(table->versioned(VERS_TIMESTAMP)); - - Field *row_end= table->vers_end_field(); - // needed in handle_list_of_fields() - row_end->flags|= GET_FIXED_FIELDS_FLAG; - Name_resolution_context *context= &thd->lex->current_select->context; - Item *row_end_item= new (thd->mem_root) Item_field(thd, context, row_end); - Item *row_end_ts= new (thd->mem_root) Item_func_unix_timestamp(thd, row_end_item); - set_part_expr(thd, row_end_ts, false); - - return false; -} - - -/** - @brief Update partition_element's id - - @returns true on error; false on success -*/ -inline -void partition_info::vers_update_el_ids() -{ - DBUG_ASSERT(part_type == VERSIONING_PARTITION); - DBUG_ASSERT(table->versioned(VERS_TIMESTAMP)); - - List_iterator it(partitions); - partition_element *el; - for(uint32 id= 0; ((el= it++)); id++) - { - DBUG_ASSERT(el->type != partition_element::CONVENTIONAL); - /* Newly added element is inserted before AS_OF_NOW. */ - if (el->id == UINT_MAX32 || el->type == partition_element::CURRENT) - { - el->id= id; - if (el->type == partition_element::CURRENT) - break; - } - } -} - - -inline -bool make_partition_name(char *move_ptr, uint i) -{ - int res= snprintf(move_ptr, MAX_PART_NAME_SIZE + 1, "p%u", i); - return res < 0 || res > MAX_PART_NAME_SIZE; -} - - -#ifdef WITH_PARTITION_STORAGE_ENGINE -inline -uint partition_info::next_part_no(uint new_parts) const -{ - if (part_type != VERSIONING_PARTITION) - return num_parts; - DBUG_ASSERT(new_parts > 0); - /* Choose first non-occupied name suffix */ - uint32 suffix= num_parts - 1; - DBUG_ASSERT(suffix > 0); - char part_name[MAX_PART_NAME_SIZE + 1]; - List_iterator_fast it(table->part_info->partitions); - for (uint cur_part= 0; cur_part < new_parts; ++cur_part, ++suffix) - { - uint32 cur_suffix= suffix; - if (make_partition_name(part_name, suffix)) - return 0; - partition_element *el; - it.rewind(); - while ((el= it++)) - { - if (0 == my_strcasecmp(&my_charset_latin1, el->partition_name, part_name)) - { - if (make_partition_name(part_name, ++suffix)) - return 0; - it.rewind(); - } - } - if (cur_part > 0 && suffix > cur_suffix) - cur_part= 0; - } - return suffix - new_parts; -} -#endif - -#endif /* PARTITION_INFO_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/password.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/password.h deleted file mode 100644 index a076a6a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/password.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef PASSWORD_INCLUDED -#define PASSWORD_INCLUDED - -C_MODE_START - -void my_make_scrambled_password_323(char *to, const char *password, - size_t pass_len); -void my_make_scrambled_password(char *to, const char *password, - size_t pass_len); - -void hash_password(ulong *result, const char *password, uint password_len); - -C_MODE_END - -#endif /* PASSWORD_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_file_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_file_provider.h deleted file mode 100644 index 3df9998..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_file_provider.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_FILE_PROVIDER_H -#define PFS_FILE_PROVIDER_H - -/** - @file include/pfs_file_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_FILE_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_FILE_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -void pfs_register_file_v1(const char *category, - PSI_file_info_v1 *info, - int count); - -void pfs_create_file_v1(PSI_file_key key, const char *name, File file); - -PSI_file_locker* -pfs_get_thread_file_name_locker_v1(PSI_file_locker_state *state, - PSI_file_key key, - PSI_file_operation op, - const char *name, const void *identity); - -PSI_file_locker* -pfs_get_thread_file_stream_locker_v1(PSI_file_locker_state *state, - PSI_file *file, PSI_file_operation op); - -PSI_file_locker* -pfs_get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state, - File file, PSI_file_operation op); - -void pfs_start_file_open_wait_v1(PSI_file_locker *locker, - const char *src_file, - uint src_line); - -PSI_file* pfs_end_file_open_wait_v1(PSI_file_locker *locker, void *result); - -void pfs_end_file_open_wait_and_bind_to_descriptor_v1 - (PSI_file_locker *locker, File file); - -void pfs_end_temp_file_open_wait_and_bind_to_descriptor_v1 - (PSI_file_locker *locker, File file, const char *filename); - -void pfs_start_file_wait_v1(PSI_file_locker *locker, - size_t count, - const char *src_file, - uint src_line); - -void pfs_end_file_wait_v1(PSI_file_locker *locker, - size_t byte_count); - -void pfs_start_file_close_wait_v1(PSI_file_locker *locker, - const char *src_file, - uint src_line); - -void pfs_end_file_close_wait_v1(PSI_file_locker *locker, int rc); - -void pfs_end_file_rename_wait_v1(PSI_file_locker *locker, const char *old_name, - const char *new_name, int rc); - -C_MODE_END - -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_FILE_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_idle_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_idle_provider.h deleted file mode 100644 index 71d116f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_idle_provider.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_IDLE_PROVIDER_H -#define PFS_IDLE_PROVIDER_H - -/** - @file include/pfs_idle_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_IDLE_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_IDLE_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -PSI_idle_locker* -pfs_start_idle_wait_v1(PSI_idle_locker_state* state, const char *src_file, uint src_line); - -void pfs_end_idle_wait_v1(PSI_idle_locker* locker); - -C_MODE_END - -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_IDLE_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_memory_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_memory_provider.h deleted file mode 100644 index ea60f9d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_memory_provider.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_MEMORY_PROVIDER_H -#define PFS_MEMORY_PROVIDER_H - -/** - @file include/pfs_memory_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_MEMORY_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_MEMORY_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -void pfs_register_memory_v1 - (const char *category, struct PSI_memory_info_v1 *info, int count); - -PSI_memory_key -pfs_memory_alloc_v1 - (PSI_memory_key key, size_t size, PSI_thread **owner); - -PSI_memory_key -pfs_memory_realloc_v1 - (PSI_memory_key key, size_t old_size, size_t new_size, PSI_thread **owner); - -void pfs_memory_free_v1 - (PSI_memory_key key, size_t size, PSI_thread *owner); - -C_MODE_END - -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_MEMORY_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_metadata_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_metadata_provider.h deleted file mode 100644 index cf3dd0d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_metadata_provider.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_METADATA_PROVIDER_H -#define PFS_METADATA_PROVIDER_H - -/** - @file include/pfs_metadata_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_METADATA_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_METADATA_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -PSI_metadata_lock* pfs_create_metadata_lock_v1 - (void *identity, - const MDL_key *key, - opaque_mdl_type mdl_type, - opaque_mdl_duration mdl_duration, - opaque_mdl_status mdl_status, - const char *src_file, - uint src_line); - -void pfs_set_metadata_lock_status_v1 - (PSI_metadata_lock *lock, - opaque_mdl_status mdl_status); - -void pfs_destroy_metadata_lock_v1(PSI_metadata_lock *lock); - -struct PSI_metadata_locker* -pfs_start_metadata_wait_v1 - (struct PSI_metadata_locker_state_v1 *state, - struct PSI_metadata_lock *mdl, - const char *src_file, uint src_line); - -void pfs_end_metadata_wait_v1 - (struct PSI_metadata_locker *locker, int rc); - -C_MODE_END - -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_METADATA_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_socket_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_socket_provider.h deleted file mode 100644 index bfafdaa..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_socket_provider.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_SOCKET_PROVIDER_H -#define PFS_SOCKET_PROVIDER_H - -/** - @file include/pfs_socket_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_SOCKET_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_SOCKET_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -void pfs_register_socket_v1(const char *category, - PSI_socket_info_v1 *info, - int count); - -PSI_socket* -pfs_init_socket_v1(PSI_socket_key key, const my_socket *fd, - const struct sockaddr *addr, socklen_t addr_len); - -void pfs_destroy_socket_v1(PSI_socket *socket); - -PSI_socket_locker* -pfs_start_socket_wait_v1(PSI_socket_locker_state *state, - PSI_socket *socket, - PSI_socket_operation op, - size_t count, - const char *src_file, uint src_line); - -void pfs_end_socket_wait_v1(PSI_socket_locker *locker, size_t byte_count); - -void pfs_set_socket_state_v1(PSI_socket *socket, PSI_socket_state state); - -void pfs_set_socket_info_v1(PSI_socket *socket, - const my_socket *fd, - const struct sockaddr *addr, - socklen_t addr_len); - -void pfs_set_socket_thread_owner_v1(PSI_socket *socket); - -C_MODE_END - -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_SOCKET_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_stage_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_stage_provider.h deleted file mode 100644 index 2ad2faa..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_stage_provider.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_STAGE_PROVIDER_H -#define PFS_STAGE_PROVIDER_H - -/** - @file include/pfs_stage_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_STAGE_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_STAGE_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -void pfs_register_stage_v1(const char *category, - PSI_stage_info_v1 **info_array, - int count); - -PSI_stage_progress* pfs_start_stage_v1(PSI_stage_key key, const char *src_file, int src_line); -PSI_stage_progress* pfs_get_current_stage_progress_v1(); - -void pfs_end_stage_v1(); - -C_MODE_END - -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_STAGE_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_statement_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_statement_provider.h deleted file mode 100644 index 96870d8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_statement_provider.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_STATEMENT_PROVIDER_H -#define PFS_STATEMENT_PROVIDER_H - -/** - @file include/pfs_statement_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_STATEMENT_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_STATEMENT_CALL(M) pfs_ ## M ## _v1 -#define PSI_DIGEST_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -void pfs_register_statement_v1(const char *category, - PSI_statement_info_v1 *info, - int count); - -PSI_statement_locker* -pfs_get_thread_statement_locker_v1(PSI_statement_locker_state *state, - PSI_statement_key key, - const void *charset, - PSI_sp_share *sp_share); - -PSI_statement_locker* -pfs_refine_statement_v1(PSI_statement_locker *locker, - PSI_statement_key key); - -void pfs_start_statement_v1(PSI_statement_locker *locker, - const char *db, uint db_len, - const char *src_file, uint src_line); - -void pfs_set_statement_text_v1(PSI_statement_locker *locker, - const char *text, uint text_len); - -void pfs_set_statement_lock_time_v1(PSI_statement_locker *locker, - ulonglong count); - -void pfs_set_statement_rows_sent_v1(PSI_statement_locker *locker, - ulonglong count); - -void pfs_set_statement_rows_examined_v1(PSI_statement_locker *locker, - ulonglong count); - -void pfs_inc_statement_created_tmp_disk_tables_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_created_tmp_tables_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_select_full_join_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_select_full_range_join_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_select_range_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_select_range_check_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_select_scan_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_sort_merge_passes_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_sort_range_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_sort_rows_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_inc_statement_sort_scan_v1(PSI_statement_locker *locker, - ulong count); - -void pfs_set_statement_no_index_used_v1(PSI_statement_locker *locker); - -void pfs_set_statement_no_good_index_used_v1(PSI_statement_locker *locker); - -void pfs_end_statement_v1(PSI_statement_locker *locker, void *stmt_da); - -PSI_digest_locker *pfs_digest_start_v1(PSI_statement_locker *locker); - -void pfs_digest_end_v1(PSI_digest_locker *locker, - const sql_digest_storage *digest); - -C_MODE_END - -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_STATEMENT_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_table_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_table_provider.h deleted file mode 100644 index 0d7ee76..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_table_provider.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_TABLE_PROVIDER_H -#define PFS_TABLE_PROVIDER_H - -/** - @file include/pfs_table_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_TABLE_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_TABLE_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -PSI_table_share* -pfs_get_table_share_v1(my_bool temporary, struct TABLE_SHARE *share); - -void pfs_release_table_share_v1(PSI_table_share* share); - -void -pfs_drop_table_share_v1(my_bool temporary, - const char *schema_name, int schema_name_length, - const char *table_name, int table_name_length); - -PSI_table* -pfs_open_table_v1(PSI_table_share *share, const void *identity); - -void pfs_unbind_table_v1(PSI_table *table); - -PSI_table * -pfs_rebind_table_v1(PSI_table_share *share, const void *identity, PSI_table *table); - -void pfs_close_table_v1(struct TABLE_SHARE *server_share, PSI_table *table); - -PSI_table_locker* -pfs_start_table_io_wait_v1(PSI_table_locker_state *state, - PSI_table *table, - PSI_table_io_operation op, - uint index, - const char *src_file, uint src_line); - -PSI_table_locker* -pfs_start_table_lock_wait_v1(PSI_table_locker_state *state, - PSI_table *table, - PSI_table_lock_operation op, - ulong op_flags, - const char *src_file, uint src_line); - -void pfs_end_table_io_wait_v1(PSI_table_locker* locker, ulonglong numrows); - -void pfs_end_table_lock_wait_v1(PSI_table_locker* locker); - -void pfs_unlock_table_v1(PSI_table *table); - -C_MODE_END - -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_TABLE_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_thread_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_thread_provider.h deleted file mode 100644 index c4118a8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_thread_provider.h +++ /dev/null @@ -1,170 +0,0 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_THREAD_PROVIDER_H -#define PFS_THREAD_PROVIDER_H - -/** - @file include/pfs_thread_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_THREAD_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_MUTEX_CALL(M) pfs_ ## M ## _v1 -#define PSI_RWLOCK_CALL(M) pfs_ ## M ## _v1 -#define PSI_COND_CALL(M) pfs_ ## M ## _v1 -#define PSI_THREAD_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -void pfs_register_mutex_v1(const char *category, - PSI_mutex_info_v1 *info, - int count); - -void pfs_register_rwlock_v1(const char *category, - PSI_rwlock_info_v1 *info, - int count); - -void pfs_register_cond_v1(const char *category, - PSI_cond_info_v1 *info, - int count); - -void pfs_register_thread_v1(const char *category, - PSI_thread_info_v1 *info, - int count); - -PSI_mutex* -pfs_init_mutex_v1(PSI_mutex_key key, const void *identity); - -void pfs_destroy_mutex_v1(PSI_mutex* mutex); - -PSI_rwlock* -pfs_init_rwlock_v1(PSI_rwlock_key key, const void *identity); - -void pfs_destroy_rwlock_v1(PSI_rwlock* rwlock); - -PSI_cond* -pfs_init_cond_v1(PSI_cond_key key, const void *identity); - -void pfs_destroy_cond_v1(PSI_cond* cond); - -int pfs_spawn_thread_v1(PSI_thread_key key, - pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine)(void*), void *arg); - -PSI_thread* -pfs_new_thread_v1(PSI_thread_key key, const void *identity, ulonglong processlist_id); - -void pfs_set_thread_id_v1(PSI_thread *thread, ulonglong processlist_id); -void pfs_set_thread_THD_v1(PSI_thread *thread, THD *thd); -void pfs_set_thread_os_id_v1(PSI_thread *thread); - -PSI_thread* -pfs_get_thread_v1(void); - -void pfs_set_thread_user_v1(const char *user, int user_len); - -void pfs_set_thread_account_v1(const char *user, int user_len, - const char *host, int host_len); - -void pfs_set_thread_db_v1(const char* db, int db_len); - -void pfs_set_thread_command_v1(int command); - -void pfs_set_thread_start_time_v1(time_t start_time); - -void pfs_set_thread_state_v1(const char* state); - -void pfs_set_connection_type_v1(opaque_vio_type conn_type); - -void pfs_set_thread_info_v1(const char* info, uint info_len); - -void pfs_set_thread_v1(PSI_thread* thread); - -void pfs_delete_current_thread_v1(void); - -void pfs_delete_thread_v1(PSI_thread *thread); - -PSI_mutex_locker* -pfs_start_mutex_wait_v1(PSI_mutex_locker_state *state, - PSI_mutex *mutex, PSI_mutex_operation op, - const char *src_file, uint src_line); - -PSI_rwlock_locker* -pfs_start_rwlock_rdwait_v1(PSI_rwlock_locker_state *state, - PSI_rwlock *rwlock, - PSI_rwlock_operation op, - const char *src_file, uint src_line); - -PSI_rwlock_locker* -pfs_start_rwlock_wrwait_v1(PSI_rwlock_locker_state *state, - PSI_rwlock *rwlock, - PSI_rwlock_operation op, - const char *src_file, uint src_line); - -PSI_cond_locker* -pfs_start_cond_wait_v1(PSI_cond_locker_state *state, - PSI_cond *cond, PSI_mutex *mutex, - PSI_cond_operation op, - const char *src_file, uint src_line); - -PSI_table_locker* -pfs_start_table_io_wait_v1(PSI_table_locker_state *state, - PSI_table *table, - PSI_table_io_operation op, - uint index, - const char *src_file, uint src_line); - -PSI_table_locker* -pfs_start_table_lock_wait_v1(PSI_table_locker_state *state, - PSI_table *table, - PSI_table_lock_operation op, - ulong op_flags, - const char *src_file, uint src_line); - -void pfs_unlock_mutex_v1(PSI_mutex *mutex); - -void pfs_unlock_rwlock_v1(PSI_rwlock *rwlock); - -void pfs_signal_cond_v1(PSI_cond* cond); - -void pfs_broadcast_cond_v1(PSI_cond* cond); - -void pfs_end_mutex_wait_v1(PSI_mutex_locker* locker, int rc); - -void pfs_end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc); - -void pfs_end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc); - -void pfs_end_cond_wait_v1(PSI_cond_locker* locker, int rc); - -int pfs_set_thread_connect_attrs_v1(const char *buffer, uint length, - const void *from_cs); - -C_MODE_END - -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_THREAD_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_transaction_provider.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_transaction_provider.h deleted file mode 100644 index fdaad8a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/pfs_transaction_provider.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef PFS_TRANSACTION_PROVIDER_H -#define PFS_TRANSACTION_PROVIDER_H - -/** - @file include/pfs_transaction_provider.h - Performance schema instrumentation (declarations). -*/ - -#ifdef HAVE_PSI_TRANSACTION_INTERFACE -#ifdef MYSQL_SERVER -#ifndef EMBEDDED_LIBRARY -#ifndef MYSQL_DYNAMIC_PLUGIN - -#include "mysql/psi/psi.h" - -#define PSI_TRANSACTION_CALL(M) pfs_ ## M ## _v1 - -C_MODE_START - -PSI_transaction_locker* -pfs_get_thread_transaction_locker_v1(PSI_transaction_locker_state *state, - const void *xid, - ulonglong trxid, - int isolation_level, - my_bool read_only, - my_bool autocommit); - -void pfs_start_transaction_v1(PSI_transaction_locker *locker, - const char *src_file, uint src_line); - -void pfs_set_transaction_xid_v1(PSI_transaction_locker *locker, - const void *xid, - int xa_state); - -void pfs_set_transaction_xa_state_v1(PSI_transaction_locker *locker, - int xa_state); - -void pfs_set_transaction_gtid_v1(PSI_transaction_locker *locker, - const void *sid, - const void *gtid_spec); - -void pfs_set_transaction_trxid_v1(PSI_transaction_locker *locker, - const ulonglong *trxid); - -void pfs_inc_transaction_savepoints_v1(PSI_transaction_locker *locker, - ulong count); - -void pfs_inc_transaction_rollback_to_savepoint_v1(PSI_transaction_locker *locker, - ulong count); - -void pfs_inc_transaction_release_savepoint_v1(PSI_transaction_locker *locker, - ulong count); - -void pfs_end_transaction_v1(PSI_transaction_locker *locker, my_bool commit); - -C_MODE_END - -#endif /* MYSQL_DYNAMIC_PLUGIN */ -#endif /* EMBEDDED_LIBRARY */ -#endif /* MYSQL_SERVER */ -#endif /* HAVE_PSI_TRANSACTION_INTERFACE */ - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/privilege.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/privilege.h deleted file mode 100644 index 37cdf4d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/privilege.h +++ /dev/null @@ -1,738 +0,0 @@ -#ifndef PRIVILEGE_H_INCLUDED -#define PRIVILEGE_H_INCLUDED - -/* Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "my_global.h" // ulonglong - - -/* - A strict enum to store privilege bits. - - We should eventually make if even stricter using "enum class privilege_t" and: - - Replace all code pieces like `if (priv)` to `if (priv != NO_ACL)` - - Remove "delete" comparison operators below -*/ -enum privilege_t: unsigned long long -{ - NO_ACL = (0), - SELECT_ACL = (1UL << 0), - INSERT_ACL = (1UL << 1), - UPDATE_ACL = (1UL << 2), - DELETE_ACL = (1UL << 3), - CREATE_ACL = (1UL << 4), - DROP_ACL = (1UL << 5), - RELOAD_ACL = (1UL << 6), - SHUTDOWN_ACL = (1UL << 7), - PROCESS_ACL = (1UL << 8), - FILE_ACL = (1UL << 9), - GRANT_ACL = (1UL << 10), - REFERENCES_ACL = (1UL << 11), - INDEX_ACL = (1UL << 12), - ALTER_ACL = (1UL << 13), - SHOW_DB_ACL = (1UL << 14), - SUPER_ACL = (1UL << 15), - CREATE_TMP_ACL = (1UL << 16), - LOCK_TABLES_ACL = (1UL << 17), - EXECUTE_ACL = (1UL << 18), - REPL_SLAVE_ACL = (1UL << 19), - BINLOG_MONITOR_ACL = (1UL << 20), // Was REPL_CLIENT_ACL prior to 10.5.2 - CREATE_VIEW_ACL = (1UL << 21), - SHOW_VIEW_ACL = (1UL << 22), - CREATE_PROC_ACL = (1UL << 23), - ALTER_PROC_ACL = (1UL << 24), - CREATE_USER_ACL = (1UL << 25), - EVENT_ACL = (1UL << 26), - TRIGGER_ACL = (1UL << 27), - CREATE_TABLESPACE_ACL = (1UL << 28), - DELETE_HISTORY_ACL = (1UL << 29), // Added in 10.3.4 - SET_USER_ACL = (1UL << 30), // Added in 10.5.2 - FEDERATED_ADMIN_ACL = (1UL << 31), // Added in 10.5.2 - CONNECTION_ADMIN_ACL = (1ULL << 32), // Added in 10.5.2 - READ_ONLY_ADMIN_ACL = (1ULL << 33), // Added in 10.5.2 - REPL_SLAVE_ADMIN_ACL = (1ULL << 34), // Added in 10.5.2 - REPL_MASTER_ADMIN_ACL = (1ULL << 35), // Added in 10.5.2 - BINLOG_ADMIN_ACL = (1ULL << 36), // Added in 10.5.2 - BINLOG_REPLAY_ACL = (1ULL << 37) // Added in 10.5.2 - /* - When adding new privilege bits, don't forget to update: - In this file: - - Add a new LAST_version_ACL - - Add a new ALL_KNOWN_ACL_version - - Change ALL_KNOWN_ACL to ALL_KNOWN_ACL_version - - Change GLOBAL_ACLS if needed - - Change SUPER_ADDED_SINCE_USER_TABLE_ACL if needed - - In other files: - - static struct show_privileges_st sys_privileges[] - - static const char *command_array[] and static uint command_lengths[] - - mysql_system_tables.sql and mysql_system_tables_fix.sql - - acl_init() or whatever - to define behaviour for old privilege tables - - Update User_table_json::get_access() - - sql_yacc.yy - for GRANT/REVOKE to work - - Important: the enum should contain only single-bit values. - In this case, debuggers print bit combinations in the readable form: - (gdb) p (privilege_t) (15) - $8 = (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL) - - Bit-OR combinations of the above values should be declared outside! - */ -}; - - -// Version markers -constexpr privilege_t LAST_100304_ACL= DELETE_HISTORY_ACL; -constexpr privilege_t LAST_100502_ACL= BINLOG_REPLAY_ACL; - -// Current version markers -constexpr privilege_t LAST_CURRENT_ACL= LAST_100502_ACL; -constexpr uint PRIVILEGE_T_MAX_BIT= - my_bit_log2_uint64((ulonglong) LAST_CURRENT_ACL); - -static_assert((privilege_t)(1ULL << PRIVILEGE_T_MAX_BIT) == LAST_CURRENT_ACL, - "Something went fatally badly: " - "LAST_CURRENT_ACL and PRIVILEGE_T_MAX_BIT do not match"); - -// A combination of all bits defined in 10.3.4 (and earlier) -constexpr privilege_t ALL_KNOWN_ACL_100304 = - (privilege_t) ((LAST_100304_ACL << 1) - 1); - -// A combination of all bits defined in 10.5.2 -constexpr privilege_t ALL_KNOWN_ACL_100502= - (privilege_t) ((LAST_100502_ACL << 1) - 1); - -// A combination of all bits defined as of the current version -constexpr privilege_t ALL_KNOWN_ACL= ALL_KNOWN_ACL_100502; - - -// Unary operators -static inline constexpr ulonglong operator~(privilege_t access) -{ - return ~static_cast(access); -} - -/* - Comparison operators. - Delete automatic conversion between to/from integer types as much as possible. - This forces to use `(priv == NO_ACL)` instead of `(priv == 0)`. - - Note: these operators will be gone when we change privilege_t to - "enum class privilege_t". See comments above. -*/ -static inline bool operator==(privilege_t, ulonglong)= delete; -static inline bool operator==(privilege_t, ulong)= delete; -static inline bool operator==(privilege_t, uint)= delete; -static inline bool operator==(privilege_t, uchar)= delete; -static inline bool operator==(privilege_t, longlong)= delete; -static inline bool operator==(privilege_t, long)= delete; -static inline bool operator==(privilege_t, int)= delete; -static inline bool operator==(privilege_t, char)= delete; -static inline bool operator==(privilege_t, bool)= delete; - -static inline bool operator==(ulonglong, privilege_t)= delete; -static inline bool operator==(ulong, privilege_t)= delete; -static inline bool operator==(uint, privilege_t)= delete; -static inline bool operator==(uchar, privilege_t)= delete; -static inline bool operator==(longlong, privilege_t)= delete; -static inline bool operator==(long, privilege_t)= delete; -static inline bool operator==(int, privilege_t)= delete; -static inline bool operator==(char, privilege_t)= delete; -static inline bool operator==(bool, privilege_t)= delete; - -static inline bool operator!=(privilege_t, ulonglong)= delete; -static inline bool operator!=(privilege_t, ulong)= delete; -static inline bool operator!=(privilege_t, uint)= delete; -static inline bool operator!=(privilege_t, uchar)= delete; -static inline bool operator!=(privilege_t, longlong)= delete; -static inline bool operator!=(privilege_t, long)= delete; -static inline bool operator!=(privilege_t, int)= delete; -static inline bool operator!=(privilege_t, char)= delete; -static inline bool operator!=(privilege_t, bool)= delete; - -static inline bool operator!=(ulonglong, privilege_t)= delete; -static inline bool operator!=(ulong, privilege_t)= delete; -static inline bool operator!=(uint, privilege_t)= delete; -static inline bool operator!=(uchar, privilege_t)= delete; -static inline bool operator!=(longlong, privilege_t)= delete; -static inline bool operator!=(long, privilege_t)= delete; -static inline bool operator!=(int, privilege_t)= delete; -static inline bool operator!=(char, privilege_t)= delete; -static inline bool operator!=(bool, privilege_t)= delete; - - -// Dyadic bitwise operators -static inline constexpr privilege_t operator&(privilege_t a, privilege_t b) -{ - return static_cast(static_cast(a) & - static_cast(b)); -} - -static inline constexpr privilege_t operator&(ulonglong a, privilege_t b) -{ - return static_cast(a & static_cast(b)); -} - -static inline constexpr privilege_t operator&(privilege_t a, ulonglong b) -{ - return static_cast(static_cast(a) & b); -} - -static inline constexpr privilege_t operator|(privilege_t a, privilege_t b) -{ - return static_cast(static_cast(a) | - static_cast(b)); -} - - -// Dyadyc bitwise assignment operators -static inline privilege_t& operator&=(privilege_t &a, privilege_t b) -{ - return a= a & b; -} - -static inline privilege_t& operator&=(privilege_t &a, ulonglong b) -{ - return a= a & b; -} - -static inline privilege_t& operator|=(privilege_t &a, privilege_t b) -{ - return a= a | b; -} - - -/* - A combination of all SUPER privileges added since the old user table format. - These privileges are automatically added when upgrading from the - old format mysql.user table if a user has the SUPER privilege. -*/ -constexpr privilege_t GLOBAL_SUPER_ADDED_SINCE_USER_TABLE_ACLS= - SET_USER_ACL | - FEDERATED_ADMIN_ACL | - CONNECTION_ADMIN_ACL | - READ_ONLY_ADMIN_ACL | - REPL_SLAVE_ADMIN_ACL | - BINLOG_ADMIN_ACL | - BINLOG_REPLAY_ACL; - - -constexpr privilege_t COL_DML_ACLS= - SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL; - -constexpr privilege_t VIEW_ACLS= - CREATE_VIEW_ACL | SHOW_VIEW_ACL; - -constexpr privilege_t STD_TABLE_DDL_ACLS= - CREATE_ACL | DROP_ACL | ALTER_ACL; - -constexpr privilege_t ALL_TABLE_DDL_ACLS= - STD_TABLE_DDL_ACLS | INDEX_ACL; - -constexpr privilege_t COL_ACLS= - SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL; - -constexpr privilege_t PROC_DDL_ACLS= - CREATE_PROC_ACL | ALTER_PROC_ACL; - -constexpr privilege_t SHOW_PROC_ACLS= - PROC_DDL_ACLS | EXECUTE_ACL; - -constexpr privilege_t TABLE_ACLS= - COL_DML_ACLS | ALL_TABLE_DDL_ACLS | VIEW_ACLS | - GRANT_ACL | REFERENCES_ACL | - TRIGGER_ACL | DELETE_HISTORY_ACL; - -constexpr privilege_t DB_ACLS= - TABLE_ACLS | PROC_DDL_ACLS | EXECUTE_ACL | - CREATE_TMP_ACL | LOCK_TABLES_ACL | EVENT_ACL; - -constexpr privilege_t PROC_ACLS= - ALTER_PROC_ACL | EXECUTE_ACL | GRANT_ACL; - -constexpr privilege_t GLOBAL_ACLS= - DB_ACLS | SHOW_DB_ACL | - CREATE_USER_ACL | CREATE_TABLESPACE_ACL | - SUPER_ACL | RELOAD_ACL | SHUTDOWN_ACL | PROCESS_ACL | FILE_ACL | - REPL_SLAVE_ACL | BINLOG_MONITOR_ACL | - GLOBAL_SUPER_ADDED_SINCE_USER_TABLE_ACLS | - REPL_MASTER_ADMIN_ACL; - -constexpr privilege_t DEFAULT_CREATE_PROC_ACLS= - ALTER_PROC_ACL | EXECUTE_ACL; - -constexpr privilege_t SHOW_CREATE_TABLE_ACLS= - COL_DML_ACLS | ALL_TABLE_DDL_ACLS | - TRIGGER_ACL | REFERENCES_ACL | GRANT_ACL | VIEW_ACLS; - -/** - Table-level privileges which are automatically "granted" to everyone on - existing temporary tables (CREATE_ACL is necessary for ALTER ... RENAME). -*/ -constexpr privilege_t TMP_TABLE_ACLS= - COL_DML_ACLS | ALL_TABLE_DDL_ACLS; - - - -/* - Allow to set an object definer: - CREATE DEFINER=xxx {TRIGGER|VIEW|FUNCTION|PROCEDURE} - Was SUPER prior to 10.5.2 -*/ -constexpr privilege_t PRIV_DEFINER_CLAUSE= SET_USER_ACL | SUPER_ACL; -/* - If a VIEW has a `definer=invoker@host` clause and - the specified definer does not exists, then - - The invoker with REVEAL_MISSING_DEFINER_ACL gets: - ERROR: The user specified as a definer ('definer1'@'localhost') doesn't exist - - The invoker without MISSING_DEFINER_ACL gets a generic access error, - without revealing details that the definer does not exists. - - TODO: we should eventually test the same privilege when processing - other objects that have the DEFINER clause (e.g. routines, triggers). - Currently the missing definer is revealed for non-privileged invokers - in case of routines, triggers, etc. - - Was SUPER prior to 10.5.2 -*/ -constexpr privilege_t PRIV_REVEAL_MISSING_DEFINER= SET_USER_ACL | SUPER_ACL; - -/* Actions that require only the SUPER privilege */ -constexpr privilege_t PRIV_DES_DECRYPT_ONE_ARG= SUPER_ACL; -constexpr privilege_t PRIV_LOG_BIN_TRUSTED_SP_CREATOR= SUPER_ACL; -constexpr privilege_t PRIV_DEBUG= SUPER_ACL; -constexpr privilege_t PRIV_SET_GLOBAL_SYSTEM_VARIABLE= SUPER_ACL; -constexpr privilege_t PRIV_SET_RESTRICTED_SESSION_SYSTEM_VARIABLE= SUPER_ACL; - -/* The following variables respected only SUPER_ACL prior to 10.5.2 */ -constexpr privilege_t PRIV_SET_SYSTEM_VAR_BINLOG_FORMAT= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_VAR_BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_VAR_BINLOG_ANNOTATE_ROW_EVENTS= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_VAR_BINLOG_ROW_IMAGE= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_VAR_SQL_LOG_BIN= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_CACHE_SIZE= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_FILE_CACHE_SIZE= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_STMT_CACHE_SIZE= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_COMMIT_WAIT_COUNT= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_COMMIT_WAIT_USEC= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_ROW_METADATA= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_EXPIRE_LOGS_DAYS= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_LOG_BIN_COMPRESS= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_LOG_BIN_COMPRESS_MIN_LEN= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_LOG_BIN_TRUST_FUNCTION_CREATORS= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_BINLOG_CACHE_SIZE= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_BINLOG_STMT_CACHE_SIZE= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_BINLOG_SIZE= - SUPER_ACL | BINLOG_ADMIN_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SYNC_BINLOG= - SUPER_ACL | BINLOG_ADMIN_ACL; - - - -/* Privileges related to --read-only */ -// Was super prior to 10.5.2 -constexpr privilege_t PRIV_IGNORE_READ_ONLY= READ_ONLY_ADMIN_ACL | SUPER_ACL; -// Was super prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_READ_ONLY= - READ_ONLY_ADMIN_ACL | SUPER_ACL; - -/* - Privileges related to connection handling. -*/ -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_IGNORE_INIT_CONNECT= CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_IGNORE_MAX_USER_CONNECTIONS= CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_IGNORE_MAX_CONNECTIONS= CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_IGNORE_MAX_PASSWORD_ERRORS= CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_KILL_OTHER_USER_PROCESS= CONNECTION_ADMIN_ACL | SUPER_ACL; - -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_CONNECT_TIMEOUT= - CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_DISCONNECT_ON_EXPIRED_PASSWORD= - CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_EXTRA_MAX_CONNECTIONS= - CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_INIT_CONNECT= - CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_CONNECTIONS= - CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_CONNECT_ERRORS= - CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_PASSWORD_ERRORS= - CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_PROXY_PROTOCOL_NETWORKS= - CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SECURE_AUTH= - CONNECTION_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLOW_LAUNCH_TIME= - CONNECTION_ADMIN_ACL | SUPER_ACL; - -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL= - CONNECTION_ADMIN_ACL | SUPER_ACL; - - -/* - Binary log related privileges that are checked regardless - of active replication running. -*/ - -/* - This command was renamed from "SHOW MASTER STATUS" - to "SHOW BINLOG STATUS" in 10.5.2. - Was SUPER_ACL | REPL_CLIENT_ACL prior to 10.5.2 - REPL_CLIENT_ACL was renamed to BINLOG_MONITOR_ACL. -*/ -constexpr privilege_t PRIV_STMT_SHOW_BINLOG_STATUS= BINLOG_MONITOR_ACL | SUPER_ACL; - -/* - Was SUPER_ACL | REPL_CLIENT_ACL prior to 10.5.2 - REPL_CLIENT_ACL was renamed to BINLOG_MONITOR_ACL. -*/ -constexpr privilege_t PRIV_STMT_SHOW_BINARY_LOGS= BINLOG_MONITOR_ACL | SUPER_ACL; - -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_PURGE_BINLOG= BINLOG_ADMIN_ACL | SUPER_ACL; - -// Was REPL_SLAVE_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_SHOW_BINLOG_EVENTS= BINLOG_MONITOR_ACL; - - -/* - Privileges for replication related statements and commands - that are executed on the master. -*/ -constexpr privilege_t PRIV_COM_REGISTER_SLAVE= REPL_SLAVE_ACL; -constexpr privilege_t PRIV_COM_BINLOG_DUMP= REPL_SLAVE_ACL; -// Was REPL_SLAVE_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_SHOW_SLAVE_HOSTS= REPL_MASTER_ADMIN_ACL; - -/* - Replication master related variable privileges. - Where SUPER prior to 10.5.2 -*/ -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_ENABLED= - REPL_MASTER_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_TIMEOUT= - REPL_MASTER_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_WAIT_NO_SLAVE= - REPL_MASTER_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_TRACE_LEVEL= - REPL_MASTER_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_WAIT_POINT= - REPL_MASTER_ADMIN_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_MASTER_VERIFY_CHECKSUM= - REPL_MASTER_ADMIN_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_BINLOG_STATE= - REPL_MASTER_ADMIN_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SERVER_ID= - REPL_MASTER_ADMIN_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_DOMAIN_ID= - REPL_MASTER_ADMIN_ACL | SUPER_ACL; - - -/* Privileges for statements that are executed on the slave */ -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_START_SLAVE= REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_STOP_SLAVE= REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_CHANGE_MASTER= REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -// Was (SUPER_ACL | REPL_CLIENT_ACL) prior to 10.5.2 -constexpr privilege_t PRIV_STMT_SHOW_SLAVE_STATUS= REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -// Was REPL_SLAVE_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_SHOW_RELAYLOG_EVENTS= REPL_SLAVE_ADMIN_ACL; - -/* - Privileges related to binlog replying. - Were SUPER_ACL prior to 10.5.2 -*/ -constexpr privilege_t PRIV_STMT_BINLOG= BINLOG_REPLAY_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_SESSION_VAR_GTID_SEQ_NO= - BINLOG_REPLAY_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_SESSION_VAR_PSEUDO_THREAD_ID= - BINLOG_REPLAY_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_SESSION_VAR_SERVER_ID= - BINLOG_REPLAY_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_SESSION_VAR_GTID_DOMAIN_ID= - BINLOG_REPLAY_ACL | SUPER_ACL; - -/* - Privileges for slave related global variables. - Were SUPER prior to 10.5.2. -*/ -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_EVENTS_MARKED_FOR_SKIP= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_DO_DB= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_DO_TABLE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_IGNORE_DB= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_IGNORE_TABLE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_WILD_DO_TABLE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_WILD_IGNORE_TABLE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_READ_BINLOG_SPEED_LIMIT= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_COMPRESSED_PROTOCOL= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_DDL_EXEC_MODE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_DOMAIN_PARALLEL_THREADS= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_EXEC_MODE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_MAX_ALLOWED_PACKET= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_NET_TIMEOUT= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_MAX_QUEUED= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_MODE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_THREADS= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_WORKERS= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_RUN_TRIGGERS_FOR_RBR= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_SQL_VERIFY_CHECKSUM= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_TRANSACTION_RETRY_INTERVAL= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_TYPE_CONVERSIONS= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_INIT_SLAVE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_SLAVE_ENABLED= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_SLAVE_TRACE_LEVEL= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_SLAVE_DELAY_MASTER= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_SLAVE_KILL_CONN_TIMEOUT= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RELAY_LOG_PURGE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_RELAY_LOG_RECOVERY= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SYNC_MASTER_INFO= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SYNC_RELAY_LOG= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SYNC_RELAY_LOG_INFO= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; - -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_CLEANUP_BATCH_SIZE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_IGNORE_DUPLICATES= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_POS_AUTO_ENGINES= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_SLAVE_POS= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; -constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_STRICT_MODE= - REPL_SLAVE_ADMIN_ACL | SUPER_ACL; - - -/* Privileges for federated database related statements */ -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_CREATE_SERVER= FEDERATED_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_ALTER_SERVER= FEDERATED_ADMIN_ACL | SUPER_ACL; -// Was SUPER_ACL prior to 10.5.2 -constexpr privilege_t PRIV_STMT_DROP_SERVER= FEDERATED_ADMIN_ACL | SUPER_ACL; - - -/* Privileges related to processes */ -constexpr privilege_t PRIV_COM_PROCESS_INFO= PROCESS_ACL; -constexpr privilege_t PRIV_STMT_SHOW_EXPLAIN= PROCESS_ACL; -constexpr privilege_t PRIV_STMT_SHOW_ENGINE_STATUS= PROCESS_ACL; -constexpr privilege_t PRIV_STMT_SHOW_ENGINE_MUTEX= PROCESS_ACL; -constexpr privilege_t PRIV_STMT_SHOW_PROCESSLIST= PROCESS_ACL; - - -/* - Defines to change the above bits to how things are stored in tables - This is needed as the 'host' and 'db' table is missing a few privileges -*/ - -/* Privileges that need to be reallocated (in continous chunks) */ -constexpr privilege_t DB_CHUNK0 (COL_DML_ACLS | CREATE_ACL | DROP_ACL); -constexpr privilege_t DB_CHUNK1 (GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL); -constexpr privilege_t DB_CHUNK2 (CREATE_TMP_ACL | LOCK_TABLES_ACL); -constexpr privilege_t DB_CHUNK3 (VIEW_ACLS | PROC_DDL_ACLS); -constexpr privilege_t DB_CHUNK4 (EXECUTE_ACL); -constexpr privilege_t DB_CHUNK5 (EVENT_ACL | TRIGGER_ACL); -constexpr privilege_t DB_CHUNK6 (DELETE_HISTORY_ACL); - - -static inline privilege_t fix_rights_for_db(privilege_t access) -{ - ulonglong A(access); - return static_cast - (((A) & DB_CHUNK0) | - ((A << 4) & DB_CHUNK1) | - ((A << 6) & DB_CHUNK2) | - ((A << 9) & DB_CHUNK3) | - ((A << 2) & DB_CHUNK4) | - ((A << 9) & DB_CHUNK5) | - ((A << 10) & DB_CHUNK6)); -} - -static inline privilege_t get_rights_for_db(privilege_t access) -{ - ulonglong A(access); - return static_cast - ((A & DB_CHUNK0) | - ((A & DB_CHUNK1) >> 4) | - ((A & DB_CHUNK2) >> 6) | - ((A & DB_CHUNK3) >> 9) | - ((A & DB_CHUNK4) >> 2) | - ((A & DB_CHUNK5) >> 9) | - ((A & DB_CHUNK6) >> 10)); -} - - -#define TBL_CHUNK0 DB_CHUNK0 -#define TBL_CHUNK1 DB_CHUNK1 -#define TBL_CHUNK2 (CREATE_VIEW_ACL | SHOW_VIEW_ACL) -#define TBL_CHUNK3 TRIGGER_ACL -#define TBL_CHUNK4 (DELETE_HISTORY_ACL) - - -static inline privilege_t fix_rights_for_table(privilege_t access) -{ - ulonglong A(access); - return static_cast - ((A & TBL_CHUNK0) | - ((A << 4) & TBL_CHUNK1) | - ((A << 11) & TBL_CHUNK2) | - ((A << 15) & TBL_CHUNK3) | - ((A << 16) & TBL_CHUNK4)); -} - - -static inline privilege_t get_rights_for_table(privilege_t access) -{ - ulonglong A(access); - return static_cast - ((A & TBL_CHUNK0) | - ((A & TBL_CHUNK1) >> 4) | - ((A & TBL_CHUNK2) >> 11) | - ((A & TBL_CHUNK3) >> 15) | - ((A & TBL_CHUNK4) >> 16)); -} - - -static inline privilege_t fix_rights_for_column(privilege_t A) -{ - const ulonglong mask(SELECT_ACL | INSERT_ACL | UPDATE_ACL); - return (A & mask) | static_cast((A & ~mask) << 8); -} - - -static inline privilege_t get_rights_for_column(privilege_t A) -{ - const ulonglong mask(SELECT_ACL | INSERT_ACL | UPDATE_ACL); - return static_cast((static_cast(A) & mask) | - (static_cast(A) >> 8)); -} - - -static inline privilege_t fix_rights_for_procedure(privilege_t access) -{ - ulonglong A(access); - return static_cast - (((A << 18) & EXECUTE_ACL) | - ((A << 23) & ALTER_PROC_ACL) | - ((A << 8) & GRANT_ACL)); -} - - -static inline privilege_t get_rights_for_procedure(privilege_t access) -{ - ulonglong A(access); - return static_cast - (((A & EXECUTE_ACL) >> 18) | - ((A & ALTER_PROC_ACL) >> 23) | - ((A & GRANT_ACL) >> 8)); -} - - -#endif /* PRIVILEGE_H_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/probes_mysql.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/probes_mysql.h deleted file mode 100644 index ce5be04..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/probes_mysql.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2008 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef PROBES_MYSQL_H - -#define PROBES_MYSQL_H - -#if defined(HAVE_DTRACE) && !defined(DISABLE_DTRACE) -#include "probes_mysql_dtrace.h" -#else /* no dtrace */ -#include "probes_mysql_nodtrace.h" -#endif -#endif /* PROBES_MYSQL_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/probes_mysql_nodtrace.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/probes_mysql_nodtrace.h deleted file mode 100644 index 2155e84..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/probes_mysql_nodtrace.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Generated by dheadgen(1). - */ - -#ifndef _PROBES_MYSQL_D -#define _PROBES_MYSQL_D - -#ifdef __cplusplus -extern "C" { -#define MYSQL_DTRACE_DISABLED false -#else -#define MYSQL_DTRACE_DISABLED 0 -#endif - -#define MYSQL_CONNECTION_START(arg0, arg1, arg2) -#define MYSQL_CONNECTION_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_CONNECTION_DONE(arg0, arg1) -#define MYSQL_CONNECTION_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_COMMAND_START(arg0, arg1, arg2, arg3) -#define MYSQL_COMMAND_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_COMMAND_DONE(arg0) -#define MYSQL_COMMAND_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_QUERY_START(arg0, arg1, arg2, arg3, arg4) -#define MYSQL_QUERY_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_QUERY_DONE(arg0) -#define MYSQL_QUERY_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_QUERY_PARSE_START(arg0) -#define MYSQL_QUERY_PARSE_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_QUERY_PARSE_DONE(arg0) -#define MYSQL_QUERY_PARSE_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_QUERY_CACHE_HIT(arg0, arg1) -#define MYSQL_QUERY_CACHE_HIT_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_QUERY_CACHE_MISS(arg0) -#define MYSQL_QUERY_CACHE_MISS_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_QUERY_EXEC_START(arg0, arg1, arg2, arg3, arg4, arg5) -#define MYSQL_QUERY_EXEC_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_QUERY_EXEC_DONE(arg0) -#define MYSQL_QUERY_EXEC_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_INSERT_ROW_START(arg0, arg1) -#define MYSQL_INSERT_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_INSERT_ROW_DONE(arg0) -#define MYSQL_INSERT_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_UPDATE_ROW_START(arg0, arg1) -#define MYSQL_UPDATE_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_UPDATE_ROW_DONE(arg0) -#define MYSQL_UPDATE_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_DELETE_ROW_START(arg0, arg1) -#define MYSQL_DELETE_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_DELETE_ROW_DONE(arg0) -#define MYSQL_DELETE_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_READ_ROW_START(arg0, arg1, arg2) -#define MYSQL_READ_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_READ_ROW_DONE(arg0) -#define MYSQL_READ_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_INDEX_READ_ROW_START(arg0, arg1) -#define MYSQL_INDEX_READ_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_INDEX_READ_ROW_DONE(arg0) -#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_HANDLER_RDLOCK_START(arg0, arg1) -#define MYSQL_HANDLER_RDLOCK_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_HANDLER_WRLOCK_START(arg0, arg1) -#define MYSQL_HANDLER_WRLOCK_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_HANDLER_UNLOCK_START(arg0, arg1) -#define MYSQL_HANDLER_UNLOCK_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_HANDLER_RDLOCK_DONE(arg0) -#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_HANDLER_WRLOCK_DONE(arg0) -#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_HANDLER_UNLOCK_DONE(arg0) -#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_FILESORT_START(arg0, arg1) -#define MYSQL_FILESORT_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_FILESORT_DONE(arg0, arg1) -#define MYSQL_FILESORT_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_SELECT_START(arg0) -#define MYSQL_SELECT_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_SELECT_DONE(arg0, arg1) -#define MYSQL_SELECT_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_INSERT_START(arg0) -#define MYSQL_INSERT_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_INSERT_DONE(arg0, arg1) -#define MYSQL_INSERT_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_INSERT_SELECT_START(arg0) -#define MYSQL_INSERT_SELECT_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_INSERT_SELECT_DONE(arg0, arg1) -#define MYSQL_INSERT_SELECT_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_UPDATE_START(arg0) -#define MYSQL_UPDATE_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_UPDATE_DONE(arg0, arg1, arg2) -#define MYSQL_UPDATE_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_MULTI_UPDATE_START(arg0) -#define MYSQL_MULTI_UPDATE_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_MULTI_UPDATE_DONE(arg0, arg1, arg2) -#define MYSQL_MULTI_UPDATE_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_DELETE_START(arg0) -#define MYSQL_DELETE_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_DELETE_DONE(arg0, arg1) -#define MYSQL_DELETE_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_MULTI_DELETE_START(arg0) -#define MYSQL_MULTI_DELETE_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_MULTI_DELETE_DONE(arg0, arg1) -#define MYSQL_MULTI_DELETE_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_NET_READ_START() -#define MYSQL_NET_READ_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_NET_READ_DONE(arg0, arg1) -#define MYSQL_NET_READ_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_NET_WRITE_START(arg0) -#define MYSQL_NET_WRITE_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_NET_WRITE_DONE(arg0) -#define MYSQL_NET_WRITE_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_KEYCACHE_READ_START(arg0, arg1, arg2, arg3) -#define MYSQL_KEYCACHE_READ_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_KEYCACHE_READ_BLOCK(arg0) -#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_KEYCACHE_READ_HIT() -#define MYSQL_KEYCACHE_READ_HIT_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_KEYCACHE_READ_MISS() -#define MYSQL_KEYCACHE_READ_MISS_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_KEYCACHE_READ_DONE(arg0, arg1) -#define MYSQL_KEYCACHE_READ_DONE_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_KEYCACHE_WRITE_START(arg0, arg1, arg2, arg3) -#define MYSQL_KEYCACHE_WRITE_START_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_KEYCACHE_WRITE_BLOCK(arg0) -#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() MYSQL_DTRACE_DISABLED -#define MYSQL_KEYCACHE_WRITE_DONE(arg0, arg1) -#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() MYSQL_DTRACE_DISABLED - -#ifdef __cplusplus -} -#endif - -#endif /* _PROBES_MYSQL_D */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/procedure.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/procedure.h deleted file mode 100644 index 769eac5..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/procedure.h +++ /dev/null @@ -1,184 +0,0 @@ -#ifndef PROCEDURE_INCLUDED -#define PROCEDURE_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* When using sql procedures */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -/* - It is necessary to include set_var.h instead of item.h because there - are dependencies on include order for set_var.h and item.h. This - will be resolved later. -*/ -#include "sql_class.h" /* select_result, set_var.h: THD */ -#include "set_var.h" /* Item */ - -#define PROC_NO_SORT 1 /**< Bits in flags */ -#define PROC_GROUP 2 /**< proc must have group */ - -/* Procedure items used by procedures to store values for send_result_set_metadata */ - -class Item_proc :public Item -{ -public: - Item_proc(THD *thd, const char *name_par): Item(thd) - { - this->name.str= name_par; - this->name.length= strlen(name_par); - } - enum Type type() const { return Item::PROC_ITEM; } - Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param) - { - /* - We can get to here when using a CURSOR for a query with PROCEDURE: - DECLARE c CURSOR FOR SELECT * FROM t1 PROCEDURE analyse(); - OPEN c; - */ - return create_tmp_field_ex_simple(root, table, src, param); - } - virtual void set(double nr)=0; - virtual void set(const char *str,uint length,CHARSET_INFO *cs)=0; - virtual void set(longlong nr)=0; - const Type_handler *type_handler() const=0; - void set(const char *str) { set(str,(uint) strlen(str), default_charset()); } - unsigned int size_of() { return sizeof(*this);} - bool check_vcol_func_processor(void *arg) - { - DBUG_ASSERT(0); // impossible - return mark_unsupported_function("proc", arg, VCOL_IMPOSSIBLE); - } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) - { - return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); - } - Item* get_copy(THD *thd) { return 0; } -}; - -class Item_proc_real :public Item_proc -{ - double value; -public: - Item_proc_real(THD *thd, const char *name_par, uint dec): - Item_proc(thd, name_par) - { - decimals=dec; max_length=float_length(dec); - } - const Type_handler *type_handler() const { return &type_handler_double; } - void set(double nr) { value=nr; } - void set(longlong nr) { value=(double) nr; } - void set(const char *str,uint length,CHARSET_INFO *cs) - { - int err_not_used; - char *end_not_used; - value= cs->strntod((char*) str,length, &end_not_used, &err_not_used); - } - double val_real() { return value; } - longlong val_int() { return (longlong) value; } - String *val_str(String *s) - { - s->set_real(value,decimals,default_charset()); - return s; - } - my_decimal *val_decimal(my_decimal *); - unsigned int size_of() { return sizeof(*this);} -}; - -class Item_proc_int :public Item_proc -{ - longlong value; -public: - Item_proc_int(THD *thd, const char *name_par): Item_proc(thd, name_par) - { max_length=11; } - const Type_handler *type_handler() const - { - if (unsigned_flag) - return &type_handler_ulonglong; - return &type_handler_slonglong; - } - void set(double nr) { value=(longlong) nr; } - void set(longlong nr) { value=nr; } - void set(const char *str,uint length, CHARSET_INFO *cs) - { int err; value= cs->strntoll(str,length,10,NULL,&err); } - double val_real() { return (double) value; } - longlong val_int() { return value; } - String *val_str(String *s) { s->set(value, default_charset()); return s; } - my_decimal *val_decimal(my_decimal *); - unsigned int size_of() { return sizeof(*this);} -}; - - -class Item_proc_string :public Item_proc -{ -public: - Item_proc_string(THD *thd, const char *name_par, uint length): - Item_proc(thd, name_par) { this->max_length=length; } - const Type_handler *type_handler() const { return &type_handler_varchar; } - void set(double nr) { str_value.set_real(nr, 2, default_charset()); } - void set(longlong nr) { str_value.set(nr, default_charset()); } - void set(const char *str, uint length, CHARSET_INFO *cs) - { str_value.copy(str,length,cs); } - double val_real() - { - int err_not_used; - char *end_not_used; - CHARSET_INFO *cs= str_value.charset(); - return cs->strntod((char*) str_value.ptr(), str_value.length(), - &end_not_used, &err_not_used); - } - longlong val_int() - { - int err; - CHARSET_INFO *cs=str_value.charset(); - return cs->strntoll(str_value.ptr(),str_value.length(),10,NULL,&err); - } - String *val_str(String*) - { - return null_value ? (String*) 0 : (String*) &str_value; - } - my_decimal *val_decimal(my_decimal *); - unsigned int size_of() { return sizeof(*this);} -}; - -/* The procedure class definitions */ - -class Procedure { -protected: - List *fields; - select_result *result; -public: - const uint flags; - ORDER *group,*param_fields; - Procedure(select_result *res,uint flags_par) :result(res),flags(flags_par), - group(0),param_fields(0) {} - virtual ~Procedure() {group=param_fields=0; fields=0; } - virtual void add(void)=0; - virtual void end_group(void)=0; - virtual int send_row(List &fields)=0; - virtual bool change_columns(THD *thd, List &fields)= 0; - virtual void update_refs(void) {} - virtual int end_of_records() { return 0; } -}; - -Procedure *setup_procedure(THD *thd,ORDER *proc_param,select_result *result, - List &field_list,int *error); - -#endif /* PROCEDURE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/protocol.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/protocol.h deleted file mode 100644 index eb11304..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/protocol.h +++ /dev/null @@ -1,331 +0,0 @@ -#ifndef PROTOCOL_INCLUDED -#define PROTOCOL_INCLUDED - -/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_error.h" -#include "my_decimal.h" /* my_decimal */ -#include "sql_type.h" - -class i_string; -class Field; -class Send_field; -class THD; -class Item_param; -struct TABLE_LIST; -typedef struct st_mysql_field MYSQL_FIELD; -typedef struct st_mysql_rows MYSQL_ROWS; - -class Protocol -{ -protected: - String *packet; - /* Used by net_store_data() for charset conversions */ - String *convert; - uint field_pos; -#ifndef DBUG_OFF - const Type_handler **field_handlers; - bool valid_handler(uint pos, protocol_send_type_t type) const - { - return field_handlers == 0 || - field_handlers[field_pos]->protocol_send_type() == type; - } -#endif - uint field_count; - virtual bool net_store_data(const uchar *from, size_t length); - virtual bool net_store_data_cs(const uchar *from, size_t length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs); - virtual bool net_send_ok(THD *, uint, uint, ulonglong, ulonglong, const char *, - bool, bool); - virtual bool net_send_error_packet(THD *, uint, const char *, const char *); -#ifdef EMBEDDED_LIBRARY - char **next_field; - MYSQL_FIELD *next_mysql_field; - MEM_ROOT *alloc; -#endif - bool needs_conversion(CHARSET_INFO *fromcs, - CHARSET_INFO *tocs) const - { - // 'tocs' is set 0 when client issues SET character_set_results=NULL - return tocs && !my_charset_same(fromcs, tocs) && - fromcs != &my_charset_bin && - tocs != &my_charset_bin; - } - /* - The following two are low-level functions that are invoked from - higher-level store_xxx() funcs. The data is stored into this->packet. - */ - bool store_string_aux(const char *from, size_t length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs); - - virtual bool send_ok(uint server_status, uint statement_warn_count, - ulonglong affected_rows, ulonglong last_insert_id, - const char *message, bool skip_flush); - - virtual bool send_eof(uint server_status, uint statement_warn_count); - - virtual bool send_error(uint sql_errno, const char *err_msg, - const char *sql_state); - - CHARSET_INFO *character_set_results() const; - -public: - THD *thd; - Protocol(THD *thd_arg) { init(thd_arg); } - virtual ~Protocol() {} - void init(THD* thd_arg); - - enum { SEND_NUM_ROWS= 1, SEND_EOF= 2 }; - virtual bool send_result_set_metadata(List *list, uint flags); - bool send_list_fields(List *list, const TABLE_LIST *table_list); - bool send_result_set_row(List *row_items); - - bool store(I_List *str_list); - bool store(const char *from, CHARSET_INFO *cs); - bool store_warning(const char *from, size_t length); - String *storage_packet() { return packet; } - inline void free() { packet->free(); } - virtual bool write(); - inline bool store(int from) - { return store_long((longlong) from); } - inline bool store(uint32 from) - { return store_long((longlong) from); } - inline bool store(longlong from) - { return store_longlong((longlong) from, 0); } - inline bool store(ulonglong from) - { return store_longlong((longlong) from, 1); } - inline bool store(String *str) - { return store((char*) str->ptr(), str->length(), str->charset()); } - - virtual bool prepare_for_send(uint num_columns) - { - field_count= num_columns; - return 0; - } - virtual bool flush(); - virtual void end_partial_result_set(THD *thd); - virtual void prepare_for_resend()=0; - - virtual bool store_null()=0; - virtual bool store_tiny(longlong from)=0; - virtual bool store_short(longlong from)=0; - virtual bool store_long(longlong from)=0; - virtual bool store_longlong(longlong from, bool unsigned_flag)=0; - virtual bool store_decimal(const my_decimal *)=0; - virtual bool store_str(const char *from, size_t length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0; - virtual bool store_float(float from, uint32 decimals)=0; - virtual bool store_double(double from, uint32 decimals)=0; - virtual bool store(MYSQL_TIME *time, int decimals)=0; - virtual bool store_date(MYSQL_TIME *time)=0; - virtual bool store_time(MYSQL_TIME *time, int decimals)=0; - virtual bool store(Field *field)=0; - - // Various useful wrappers for the virtual store*() methods. - // Backward wrapper for store_str() - bool store(const char *from, size_t length, CHARSET_INFO *cs) - { - return store_str(from, length, cs, character_set_results()); - } - bool store_lex_cstring(const LEX_CSTRING &s, - CHARSET_INFO *fromcs, - CHARSET_INFO *tocs) - { - return store_str(s.str, (uint) s.length, fromcs, tocs); - } - bool store_binary_string(const char *str, size_t length) - { - return store_str(str, (uint) length, &my_charset_bin, &my_charset_bin); - } - bool store_ident(const LEX_CSTRING &s) - { - return store_lex_cstring(s, system_charset_info, character_set_results()); - } - // End of wrappers - - virtual bool send_out_parameters(List *sp_params)=0; -#ifdef EMBEDDED_LIBRARY - bool begin_dataset(); - bool begin_dataset(THD *thd, uint numfields); - virtual void remove_last_row() {} -#else - void remove_last_row() {} -#endif - enum enum_protocol_type - { - /* - Before adding a new type, please make sure - there is enough storage for it in Query_cache_query_flags. - */ - PROTOCOL_TEXT= 0, PROTOCOL_BINARY= 1, PROTOCOL_LOCAL= 2, - PROTOCOL_DISCARD= 3 /* Should be last, not used by Query_cache */ - }; - virtual enum enum_protocol_type type()= 0; - - virtual bool net_send_eof(THD *thd, uint server_status, uint statement_warn_count); - bool net_send_error(THD *thd, uint sql_errno, const char *err, - const char* sqlstate); - void end_statement(); - - friend int send_answer_1(Protocol *protocol, String *s1, String *s2, - String *s3); - friend int send_header_2(Protocol *protocol, bool for_category); -}; - - -/** Class used for the old (MySQL 4.0 protocol). */ - -class Protocol_text :public Protocol -{ - StringBuffer buffer; - bool store_numeric_string_aux(const char *from, size_t length); -public: - Protocol_text(THD *thd_arg, ulong prealloc= 0) - :Protocol(thd_arg) - { - if (prealloc) - packet->alloc(prealloc); - } - void prepare_for_resend() override; - bool store_null() override; - bool store_tiny(longlong from) override; - bool store_short(longlong from) override; - bool store_long(longlong from) override; - bool store_longlong(longlong from, bool unsigned_flag) override; - bool store_decimal(const my_decimal *) override; - bool store_str(const char *from, size_t length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs) override; - bool store(MYSQL_TIME *time, int decimals) override; - bool store_date(MYSQL_TIME *time) override; - bool store_time(MYSQL_TIME *time, int decimals) override; - bool store_float(float nr, uint32 decimals) override; - bool store_double(double from, uint32 decimals) override; - bool store(Field *field) override; - - bool send_out_parameters(List *sp_params) override; - - bool store_numeric_zerofill_str(const char *from, size_t length, - protocol_send_type_t send_type); - -#ifdef EMBEDDED_LIBRARY - void remove_last_row() override; -#endif - virtual bool store_field_metadata(const THD *thd, const Send_field &field, - CHARSET_INFO *charset_for_protocol, - uint pos); - bool store_item_metadata(THD *thd, Item *item, uint pos); - bool store_field_metadata_for_list_fields(const THD *thd, Field *field, - const TABLE_LIST *table_list, - uint pos); - enum enum_protocol_type type() override { return PROTOCOL_TEXT; }; -}; - - -class Protocol_binary final :public Protocol -{ -private: - uint bit_fields; -public: - Protocol_binary(THD *thd_arg) :Protocol(thd_arg) {} - bool prepare_for_send(uint num_columns) override; - void prepare_for_resend() override; -#ifdef EMBEDDED_LIBRARY - bool write() override; - bool net_store_data(const uchar *from, size_t length) override; - bool net_store_data_cs(const uchar *from, size_t length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs) override; -#endif - bool store_null() override; - bool store_tiny(longlong from) override; - bool store_short(longlong from) override; - bool store_long(longlong from) override; - bool store_longlong(longlong from, bool unsigned_flag) override; - bool store_decimal(const my_decimal *) override; - bool store_str(const char *from, size_t length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs) override; - bool store(MYSQL_TIME *time, int decimals) override; - bool store_date(MYSQL_TIME *time) override; - bool store_time(MYSQL_TIME *time, int decimals) override; - bool store_float(float nr, uint32 decimals) override; - bool store_double(double from, uint32 decimals) override; - bool store(Field *field) override; - - bool send_out_parameters(List *sp_params) override; - - enum enum_protocol_type type() override { return PROTOCOL_BINARY; }; -}; - - -/* - A helper for "ANALYZE $stmt" which looks a real network procotol but doesn't - write results to the network. - - At first glance, class select_send looks like a more appropriate place to - implement the "write nothing" hook. This is not true, because - - we need to evaluate the value of every item, and do it the way - select_send does it (i.e. call item->val_int() or val_real() or...) - - select_send::send_data() has some other code, like telling the storage - engine that the row can be unlocked. We want to keep that also. - as a result, "ANALYZE $stmt" uses a select_send_analyze which still uses - select_send::send_data() & co., and also uses Protocol_discard object. -*/ - -class Protocol_discard final : public Protocol -{ -public: - Protocol_discard(THD *thd_arg) : Protocol(thd_arg) {} - bool write() override { return 0; } - bool send_result_set_metadata(List *, uint) override { return 0; } - bool send_eof(uint, uint) override { return 0; } - void prepare_for_resend() override { IF_DBUG(field_pos= 0,); } - bool send_out_parameters(List *sp_params) override { return false; } - - /* - Provide dummy overrides for any storage methods so that we - avoid allocating and copying of data - */ - bool store_null() override { return false; } - bool store_tiny(longlong) override { return false; } - bool store_short(longlong) override { return false; } - bool store_long(longlong) override { return false; } - bool store_longlong(longlong, bool) override { return false; } - bool store_decimal(const my_decimal *) override { return false; } - bool store_str(const char *, size_t, CHARSET_INFO *, CHARSET_INFO *) override - { - return false; - } - bool store(MYSQL_TIME *, int) override { return false; } - bool store_date(MYSQL_TIME *) override { return false; } - bool store_time(MYSQL_TIME *, int) override { return false; } - bool store_float(float, uint32) override { return false; } - bool store_double(double, uint32) override { return false; } - bool store(Field *) override { return false; } - enum enum_protocol_type type() override { return PROTOCOL_DISCARD; }; -}; - - -void send_warning(THD *thd, uint sql_errno, const char *err=0); -void net_send_progress_packet(THD *thd); -uchar *net_store_data(uchar *to,const uchar *from, size_t length); -uchar *net_store_data(uchar *to,int32 from); -uchar *net_store_data(uchar *to,longlong from); - -#endif /* PROTOCOL_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/proxy_protocol.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/proxy_protocol.h deleted file mode 100644 index 0f873e2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/proxy_protocol.h +++ /dev/null @@ -1,19 +0,0 @@ -#include "my_net.h" - -struct proxy_peer_info -{ - struct sockaddr_storage peer_addr; - int port; - bool is_local_command; -}; - -extern bool has_proxy_protocol_header(NET *net); -extern int parse_proxy_protocol_header(NET *net, proxy_peer_info *peer_info); -extern bool is_proxy_protocol_allowed(const sockaddr *remote_addr); - -extern int init_proxy_protocol_networks(const char *spec); -extern void destroy_proxy_protocol_networks(); - -extern int set_proxy_protocol_networks(const char *spec); -extern bool proxy_protocol_networks_valid(const char *spec); - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/queues.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/queues.h deleted file mode 100644 index e994885..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/queues.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright (C) 2010 Monty Program Ab - All Rights reserved - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -/* - Code for generell handling of priority Queues. - Implementation of queues from "Algorithms in C" by Robert Sedgewick. -*/ - -#ifndef _queues_h -#define _queues_h - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct st_queue { - uchar **root; - void *first_cmp_arg; - uint elements; - uint max_elements; - uint offset_to_key; /* compare is done on element+offset */ - uint offset_to_queue_pos; /* If we want to store position in element */ - uint auto_extent; - int max_at_top; /* Normally 1, set to -1 if queue_top gives max */ - int (*compare)(void *, uchar *,uchar *); -} QUEUE; - -#define queue_first_element(queue) 1 -#define queue_last_element(queue) (queue)->elements -#define queue_empty(queue) ((queue)->elements == 0) -#define queue_top(queue) ((queue)->root[1]) -#define queue_element(queue,index) ((queue)->root[index]) -#define queue_end(queue) ((queue)->root[(queue)->elements]) -#define queue_replace_top(queue) _downheap(queue, 1) -#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg -#define queue_set_max_at_top(queue, set_arg) \ - (queue)->max_at_top= set_arg ? -1 : 1 -#define queue_remove_top(queue_arg) queue_remove((queue_arg), queue_first_element(queue_arg)) -typedef int (*queue_compare)(void *,uchar *, uchar *); - -int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key, - my_bool max_at_top, queue_compare compare, - void *first_cmp_arg, uint offset_to_queue_pos, - uint auto_extent); -int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key, - my_bool max_at_top, queue_compare compare, - void *first_cmp_arg, uint offset_to_queue_pos, - uint auto_extent); -int resize_queue(QUEUE *queue, uint max_elements); -void delete_queue(QUEUE *queue); -void queue_insert(QUEUE *queue, uchar *element); -int queue_insert_safe(QUEUE *queue, uchar *element); -uchar *queue_remove(QUEUE *queue,uint idx); -void queue_replace(QUEUE *queue,uint idx); - -#define queue_remove_all(queue) { (queue)->elements= 0; } -#define queue_is_full(queue) (queue->elements == queue->max_elements) -void _downheap(QUEUE *queue, uint idx); -void queue_fix(QUEUE *queue); -#define is_queue_inited(queue) ((queue)->root != 0) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/records.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/records.h deleted file mode 100644 index 272bbd0..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/records.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef SQL_RECORDS_H -#define SQL_RECORDS_H -/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "table.h" - -struct st_join_table; -class handler; -class THD; -class SQL_SELECT; -class Copy_field; -class SORT_INFO; - -struct READ_RECORD; - -void end_read_record(READ_RECORD *info); -void free_cache(READ_RECORD *info); - -/** - A context for reading through a single table using a chosen access method: - index read, scan, etc, use of cache, etc. - - Use by: - READ_RECORD read_record; - init_read_record(&read_record, ...); - while (read_record.read_record()) - { - ... - } - end_read_record(); -*/ - -struct READ_RECORD -{ - typedef int (*Read_func)(READ_RECORD*); - typedef void (*Unlock_row_func)(st_join_table *); - typedef int (*Setup_func)(struct st_join_table*); - - TABLE *table; /* Head-form */ - Unlock_row_func unlock_row; - Read_func read_record_func; - THD *thd; - SQL_SELECT *select; - uint ref_length, reclength, rec_cache_size, error_offset; - - /** - Counting records when reading result from filesort(). - Used when filesort leaves the result in the filesort buffer. - */ - ha_rows unpack_counter; - - uchar *ref_pos; /* pointer to form->refpos */ - uchar *rec_buf; /* to read field values after filesort */ - uchar *cache,*cache_pos,*cache_end,*read_positions; - - /* - Structure storing information about sorting - */ - SORT_INFO *sort_info; - struct st_io_cache *io_cache; - bool print_error; - - int read_record() { return read_record_func(this); } - uchar *record() const { return table->record[0]; } - - /* - SJ-Materialization runtime may need to read fields from the materialized - table and unpack them into original table fields: - */ - Copy_field *copy_field; - Copy_field *copy_field_end; -public: - READ_RECORD() : table(NULL), cache(NULL) {} - ~READ_RECORD() { end_read_record(this); } -}; - -bool init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form, - SQL_SELECT *select, SORT_INFO *sort, - int use_record_cache, - bool print_errors, bool disable_rr_cache); -bool init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, - bool print_error, uint idx, bool reverse); - -void rr_unlock_row(st_join_table *tab); - -#endif /* SQL_RECORDS_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/repl_failsafe.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/repl_failsafe.h deleted file mode 100644 index 6f8bdfc..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/repl_failsafe.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef REPL_FAILSAFE_INCLUDED -#define REPL_FAILSAFE_INCLUDED - -/* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef HAVE_REPLICATION - -#include "mysql.h" -#include -#include "slave.h" - -extern Atomic_counter binlog_dump_thread_count; -typedef enum {RPL_AUTH_MASTER=0,RPL_IDLE_SLAVE,RPL_ACTIVE_SLAVE, - RPL_LOST_SOLDIER,RPL_TROOP_SOLDIER, - RPL_RECOVERY_CAPTAIN,RPL_NULL /* inactive */, - RPL_ANY /* wild card used by change_rpl_status */ } RPL_STATUS; -extern ulong rpl_status; - -extern mysql_mutex_t LOCK_rpl_status; -extern mysql_cond_t COND_rpl_status; -extern TYPELIB rpl_role_typelib; -extern const char* rpl_role_type[], *rpl_status_type[]; - -void change_rpl_status(ulong from_status, ulong to_status); -int find_recovery_captain(THD* thd, MYSQL* mysql); - -bool show_slave_hosts(THD* thd); - -#endif /* HAVE_REPLICATION */ -#endif /* REPL_FAILSAFE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/replication.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/replication.h deleted file mode 100644 index 49d896f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/replication.h +++ /dev/null @@ -1,567 +0,0 @@ -/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef REPLICATION_H -#define REPLICATION_H - -/*************************************************************************** - NOTE: plugin locking. - - The plugin is locked on Binlog_transmit_observer::transmit_start and is - unlocked after Binlog_transmit_observer::transmit_stop. All other - master observable events happen between these two and don't lock the - plugin at all. - - Also a plugin is locked on Binlog_relay_IO_observer::thread_start - and unlocked after Binlog_relay_IO_observer::thread_stop. -***************************************************************************/ - -#include - -typedef struct st_mysql MYSQL; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - Transaction observer flags. -*/ -enum Trans_flags { - /** Transaction is a real transaction */ - TRANS_IS_REAL_TRANS = 1 -}; - -/** - Transaction observer parameter -*/ -typedef struct Trans_param { - uint32 server_id; - uint32 flags; - - /* - The latest binary log file name and position written by current - transaction, if binary log is disabled or no log event has been - written into binary log file by current transaction (events - written into transaction log cache are not counted), these two - member will be zero. - */ - const char *log_file; - my_off_t log_pos; -} Trans_param; - -/** - Observes and extends transaction execution -*/ -typedef struct Trans_observer { - uint32 len; - - /** - This callback is called after transaction commit - - This callback is called right after commit to storage engines for - transactional tables. - - For non-transactional tables, this is called at the end of the - statement, before sending statement status, if the statement - succeeded. - - @note The return value is currently ignored by the server. - @note This hook is called wo/ any global mutex held - - @param param The parameter for transaction observers - - @retval 0 Sucess - @retval 1 Failure - */ - int (*after_commit)(Trans_param *param); - - /** - This callback is called after transaction rollback - - This callback is called right after rollback to storage engines - for transactional tables. - - For non-transactional tables, this is called at the end of the - statement, before sending statement status, if the statement - failed. - - @note The return value is currently ignored by the server. - - @param param The parameter for transaction observers - - @note This hook is called wo/ any global mutex held - - @retval 0 Sucess - @retval 1 Failure - */ - int (*after_rollback)(Trans_param *param); -} Trans_observer; - -/** - Binlog storage flags -*/ -enum Binlog_storage_flags { - /** Binary log was sync:ed */ - BINLOG_STORAGE_IS_SYNCED = 1, - - /** First(or alone) in a group commit */ - BINLOG_GROUP_COMMIT_LEADER = 2, - - /** Last(or alone) in a group commit */ - BINLOG_GROUP_COMMIT_TRAILER = 4 -}; - -/** - Binlog storage observer parameters - */ -typedef struct Binlog_storage_param { - uint32 server_id; -} Binlog_storage_param; - -/** - Observe binlog logging storage -*/ -typedef struct Binlog_storage_observer { - uint32 len; - - /** - This callback is called after binlog has been flushed - - This callback is called after cached events have been flushed to - binary log file. Whether the binary log file is synchronized to - disk is indicated by the bit BINLOG_STORAGE_IS_SYNCED in @a flags. - - @note: this hook is called with LOCK_log mutex held - - @param param Observer common parameter - @param log_file Binlog file name been updated - @param log_pos Binlog position after update - @param flags flags for binlog storage - - @retval 0 Sucess - @retval 1 Failure - */ - int (*after_flush)(Binlog_storage_param *param, - const char *log_file, my_off_t log_pos, - uint32 flags); - - /** - This callback is called after binlog has been synced - - This callback is called after events flushed to disk has been sync:ed - ("group committed"). - - @note: this hook is called with LOCK_after_binlog_sync mutex held - - @param param Observer common parameter - @param log_file Binlog file name been updated - @param log_pos Binlog position after update - @param flags flags for binlog storage - - @retval 0 Sucess - @retval 1 Failure - */ - int (*after_sync)(Binlog_storage_param *param, - const char *log_file, my_off_t log_pos, - uint32 flags); -} Binlog_storage_observer; - -/** - Replication binlog transmitter (binlog dump) observer parameter. -*/ -typedef struct Binlog_transmit_param { - uint32 server_id; - uint32 flags; -} Binlog_transmit_param; - -/** - Observe and extends the binlog dumping thread. -*/ -typedef struct Binlog_transmit_observer { - uint32 len; - - /** - This callback is called when binlog dumping starts - - - @param param Observer common parameter - @param log_file Binlog file name to transmit from - @param log_pos Binlog position to transmit from - - @retval 0 Sucess - @retval 1 Failure - */ - int (*transmit_start)(Binlog_transmit_param *param, - const char *log_file, my_off_t log_pos); - - /** - This callback is called when binlog dumping stops - - @param param Observer common parameter - - @retval 0 Sucess - @retval 1 Failure - */ - int (*transmit_stop)(Binlog_transmit_param *param); - - /** - This callback is called to reserve bytes in packet header for event transmission - - This callback is called when resetting transmit packet header to - reserve bytes for this observer in packet header. - - The @a header buffer is allocated by the server code, and @a size - is the size of the header buffer. Each observer can only reserve - a maximum size of @a size in the header. - - @param param Observer common parameter - @param header Pointer of the header buffer - @param size Size of the header buffer - @param len Header length reserved by this observer - - @retval 0 Sucess - @retval 1 Failure - */ - int (*reserve_header)(Binlog_transmit_param *param, - unsigned char *header, - unsigned long size, - unsigned long *len); - - /** - This callback is called before sending an event packet to slave - - @param param Observer common parameter - @param packet Binlog event packet to send - @param len Length of the event packet - @param log_file Binlog file name of the event packet to send - @param log_pos Binlog position of the event packet to send - - @retval 0 Sucess - @retval 1 Failure - */ - int (*before_send_event)(Binlog_transmit_param *param, - unsigned char *packet, unsigned long len, - const char *log_file, my_off_t log_pos ); - - /** - This callback is called after sending an event packet to slave - - @param param Observer common parameter - @param event_buf Binlog event packet buffer sent - @param len length of the event packet buffer - - @retval 0 Sucess - @retval 1 Failure - */ - int (*after_send_event)(Binlog_transmit_param *param, - const char *event_buf, unsigned long len); - - /** - This callback is called after resetting master status - - This is called when executing the command RESET MASTER, and is - used to reset status variables added by observers. - - @param param Observer common parameter - - @retval 0 Sucess - @retval 1 Failure - */ - int (*after_reset_master)(Binlog_transmit_param *param); -} Binlog_transmit_observer; - -/** - Binlog relay IO flags -*/ -enum Binlog_relay_IO_flags { - /** Binary relay log was sync:ed */ - BINLOG_RELAY_IS_SYNCED = 1 -}; - - -/** - Replication binlog relay IO observer parameter -*/ -typedef struct Binlog_relay_IO_param { - uint32 server_id; - - /* Master host, user and port */ - char *host; - char *user; - unsigned int port; - - char *master_log_name; - my_off_t master_log_pos; - - MYSQL *mysql; /* the connection to master */ -} Binlog_relay_IO_param; - -/** - Observes and extends the service of slave IO thread. -*/ -typedef struct Binlog_relay_IO_observer { - uint32 len; - - /** - This callback is called when slave IO thread starts - - @param param Observer common parameter - - @retval 0 Sucess - @retval 1 Failure - */ - int (*thread_start)(Binlog_relay_IO_param *param); - - /** - This callback is called when slave IO thread stops - - @param param Observer common parameter - - @retval 0 Sucess - @retval 1 Failure - */ - int (*thread_stop)(Binlog_relay_IO_param *param); - - /** - This callback is called before slave requesting binlog transmission from master - - This is called before slave issuing BINLOG_DUMP command to master - to request binlog. - - @param param Observer common parameter - @param flags binlog dump flags - - @retval 0 Sucess - @retval 1 Failure - */ - int (*before_request_transmit)(Binlog_relay_IO_param *param, uint32 flags); - - /** - This callback is called after read an event packet from master - - @param param Observer common parameter - @param packet The event packet read from master - @param len Length of the event packet read from master - @param event_buf The event packet return after process - @param event_len The length of event packet return after process - - @retval 0 Sucess - @retval 1 Failure - */ - int (*after_read_event)(Binlog_relay_IO_param *param, - const char *packet, unsigned long len, - const char **event_buf, unsigned long *event_len); - - /** - This callback is called after written an event packet to relay log - - @param param Observer common parameter - @param event_buf Event packet written to relay log - @param event_len Length of the event packet written to relay log - @param flags flags for relay log - - @retval 0 Sucess - @retval 1 Failure - */ - int (*after_queue_event)(Binlog_relay_IO_param *param, - const char *event_buf, unsigned long event_len, - uint32 flags); - - /** - This callback is called after reset slave relay log IO status - - @param param Observer common parameter - - @retval 0 Sucess - @retval 1 Failure - */ - int (*after_reset_slave)(Binlog_relay_IO_param *param); -} Binlog_relay_IO_observer; - - -/** - Register a transaction observer - - @param observer The transaction observer to register - @param p pointer to the internal plugin structure - - @retval 0 Sucess - @retval 1 Observer already exists -*/ -int register_trans_observer(Trans_observer *observer, void *p); - -/** - Unregister a transaction observer - - @param observer The transaction observer to unregister - @param p pointer to the internal plugin structure - - @retval 0 Sucess - @retval 1 Observer not exists -*/ -int unregister_trans_observer(Trans_observer *observer, void *p); - -/** - Register a binlog storage observer - - @param observer The binlog storage observer to register - @param p pointer to the internal plugin structure - - @retval 0 Sucess - @retval 1 Observer already exists -*/ -int register_binlog_storage_observer(Binlog_storage_observer *observer, void *p); - -/** - Unregister a binlog storage observer - - @param observer The binlog storage observer to unregister - @param p pointer to the internal plugin structure - - @retval 0 Sucess - @retval 1 Observer not exists -*/ -int unregister_binlog_storage_observer(Binlog_storage_observer *observer, void *p); - -/** - Register a binlog transmit observer - - @param observer The binlog transmit observer to register - @param p pointer to the internal plugin structure - - @retval 0 Sucess - @retval 1 Observer already exists -*/ -int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p); - -/** - Unregister a binlog transmit observer - - @param observer The binlog transmit observer to unregister - @param p pointer to the internal plugin structure - - @retval 0 Sucess - @retval 1 Observer not exists -*/ -int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p); - -/** - Register a binlog relay IO (slave IO thread) observer - - @param observer The binlog relay IO observer to register - @param p pointer to the internal plugin structure - - @retval 0 Sucess - @retval 1 Observer already exists -*/ -int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p); - -/** - Unregister a binlog relay IO (slave IO thread) observer - - @param observer The binlog relay IO observer to unregister - @param p pointer to the internal plugin structure - - @retval 0 Sucess - @retval 1 Observer not exists -*/ -int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p); - -/** - Connect to master - - This function can only used in the slave I/O thread context, and - will use the same master information to do the connection. - - @code - MYSQL *mysql = mysql_init(NULL); - if (rpl_connect_master(mysql)) - { - // do stuff with the connection - } - mysql_close(mysql); // close the connection - @endcode - - @param mysql address of MYSQL structure to use, pass NULL will - create a new one - - @return address of MYSQL structure on success, NULL on failure -*/ -MYSQL *rpl_connect_master(MYSQL *mysql); - -/** - Get the value of user variable as an integer. - - This function will return the value of variable @a name as an - integer. If the original value of the variable is not an integer, - the value will be converted into an integer. - - @param name user variable name - @param value pointer to return the value - @param null_value if not NULL, the function will set it to true if - the value of variable is null, set to false if not - - @retval 0 Success - @retval 1 Variable not found -*/ -int get_user_var_int(const char *name, - long long int *value, int *null_value); - -/** - Get the value of user variable as a double precision float number. - - This function will return the value of variable @a name as real - number. If the original value of the variable is not a real number, - the value will be converted into a real number. - - @param name user variable name - @param value pointer to return the value - @param null_value if not NULL, the function will set it to true if - the value of variable is null, set to false if not - - @retval 0 Success - @retval 1 Variable not found -*/ -int get_user_var_real(const char *name, - double *value, int *null_value); - -/** - Get the value of user variable as a string. - - This function will return the value of variable @a name as - string. If the original value of the variable is not a string, - the value will be converted into a string. - - @param name user variable name - @param value pointer to the value buffer - @param len length of the value buffer - @param precision precision of the value if it is a float number - @param null_value if not NULL, the function will set it to true if - the value of variable is null, set to false if not - - @retval 0 Success - @retval 1 Variable not found -*/ -int get_user_var_str(const char *name, - char *value, unsigned long len, - unsigned int precision, int *null_value); - - - -#ifdef __cplusplus -} -#endif -#endif /* REPLICATION_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rijndael.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rijndael.h deleted file mode 100644 index 552430a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rijndael.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef RIJNDAEL_INCLUDED -#define RIJNDAEL_INCLUDED - -/* Copyright (c) 2002, 2006 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* - rijndael-alg-fst.h - - @version 3.0 (December 2000) - Optimised ANSI C code for the Rijndael cipher (now AES) - @author Vincent Rijmen - @author Antoon Bosselaers - @author Paulo Barreto - - This code is hereby placed in the public domain. - Modified by Peter Zaitsev to fit MySQL coding style. - */ - -#define AES_MAXKC (256/32) -#define AES_MAXKB (256/8) -#define AES_MAXNR 14 - -int rijndaelKeySetupEnc(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], - int keyBits); -int rijndaelKeySetupDec(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], - int keyBits); -void rijndaelEncrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, - const uint8 pt[16], uint8 ct[16]); -void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, - const uint8 ct[16], uint8 pt[16]); - -#endif /* RIJNDAEL_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rowid_filter.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rowid_filter.h deleted file mode 100644 index 467b688..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rowid_filter.h +++ /dev/null @@ -1,470 +0,0 @@ -/* - Copyright (c) 2018, 2019 MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef ROWID_FILTER_INCLUDED -#define ROWID_FILTER_INCLUDED - - -#include "mariadb.h" -#include "sql_array.h" - -/* - - What rowid / primary filters are - -------------------------------- - - Consider a join query Q of the form - SELECT * FROM T1, ... , Tk WHERE P. - - For any of the table reference Ti(Q) from the from clause of Q different - rowid / primary key filters (pk-filters for short) can be built. - A pk-filter F built for Ti(Q) is a set of rowids / primary keys of Ti - F= {pk1,...,pkN} such that for any row r=r1||...||rk from the result set of Q - ri's rowid / primary key pk(ri) is contained in F. - - When pk-filters are useful - -------------------------- - - If building a pk-filter F for Ti(Q )is not too costly and its cardinality #F - is much less than the cardinality of T - #T then using the pk-filter when - executing Q might be quite beneficial. - - Let r be a random row from Ti. Let s(F) be the probability that pk(r) - belongs to F. Let BC(F) be the cost of building F. - - Suppose that the optimizer has chosen for Q a plan with this join order - T1 => ... Tk and that the table Ti is accessed by a ref access using index I. - Let K = {k1,...,kM} be the set of all rowid/primary keys values used to access - rows of Ti when looking for matches in this table.to join Ti by index I. - - Let's assume that two set sets K and F are uncorrelated. With this assumption - if before accessing data from Ti by the rowid / primary key k we first - check whether k is in F then we can expect saving on M*(1-s(S)) accesses of - data rows from Ti. If we can guarantee that test whether k is in F is - relatively cheap then we can gain a lot assuming that BC(F) is much less - then the cost of fetching M*(1-s(S)) records from Ti and following - evaluation of conditions pushed into Ti. - - Making pk-filter test cheap - --------------------------- - - If the search structure to test whether an element is in F can be fully - placed in RAM then this test is expected to be be much cheaper than a random - access of a record from Ti. We'll consider two search structures for - pk-filters: ordered array and bloom filter. Ordered array is easy to - implement, but it's space consuming. If a filter contains primary keys - then at least space for each primary key from the filter must be allocated - in the search structure. On a the opposite a bloom filter requires a - fixed number of bits and this number does not depend on the cardinality - of the pk-filter (10 bits per element will serve pk-filter of any size). - -*/ - -/* - - How and when the optimizer builds and uses range rowid filters - -------------------------------------------------------------- - - 1. In make_join_statistics() - for each join table s - after the call of get_quick_record_count() - the TABLE::method init_cost_info_for_usable_range_rowid_filters() - is called - The method build an array of Range_rowid_filter_cost_info elements - containing the cost info on possible range filters for s->table. - The array is optimized for further usage. - - 2. For each partial join order when the optimizer considers joining - table s to this partial join - In the function best_access_path() - a. When evaluating a ref access r by index idx to join s - the optimizer estimates the effect of usage of each possible - range filter f and chooses one with the best gain. The gain - is taken into account when the cost of thr ref access r is - calculated. If it turns out that this is the best ref access - to join s then the info about the chosen filter together - with the info on r is remembered in the corresponding element - of the array of POSITION structures. - [We evaluate every pair (ref access, range_filter) rather then - every pair (best ref access, range filter) because if the index - ref_idx used for ref access r correlates with the index rf_idx - used by the filter f then the pair (r,f) is not evaluated - at all as we don't know how to estimate the effect of correlation - between ref_idx and rf_idx.] - b. When evaluating the best range access to join table s the - optimizer estimates the effect of usage of each possible - range filter f and chooses one with the best gain. - [Here we should have evaluated every pair (range access, - range filter) as well, but it's not done yet.] - - 3. When the cheapest execution plan has been chosen and after the - call of JOIN::get_best_combination() - The method JOIN::make_range_rowid_filters() is called - For each range rowid filter used in the chosen execution plan - the method creates a quick select object to be able to perform - index range scan to fill the filter at the execution stage. - The method also creates Range_rowid_filter objects that are - used at the execution stage. - - 4. Just before the execution stage - The method JOIN::init_range_rowid_filters() is called. - For each join table s that is to be accessed with usage of a range - filter the method allocates containers for the range filter and - it lets the engine know that the filter will be used when - accessing s. - - 5. At the execution stage - In the function sub_select() just before the first access of a join - table s employing a range filter - The method JOIN_TAB::build_range_rowid_filter_if_needed() is called - The method fills the filter using the quick select created by - JOIN::make_range_rowid_filters(). - - 6. The accessed key tuples are checked against the filter within the engine - using the info pushed into it. - -*/ - -struct TABLE; -class SQL_SELECT; -class Rowid_filter_container; -class Range_rowid_filter_cost_info; - -/* Cost to write rowid into array */ -#define ARRAY_WRITE_COST 0.005 -/* Factor used to calculate cost of sorting rowids in array */ -#define ARRAY_SORT_C 0.01 -/* Cost to evaluate condition */ -#define COST_COND_EVAL 0.2 - -typedef enum -{ - SORTED_ARRAY_CONTAINER, - BLOOM_FILTER_CONTAINER // Not used yet -} Rowid_filter_container_type; - -/** - @class Rowid_filter_container - - The interface for different types of containers to store info on the set - of rowids / primary keys that defines a pk-filter. - - There will be two implementations of this abstract class. - - sorted array - - bloom filter -*/ - -class Rowid_filter_container : public Sql_alloc -{ -public: - - virtual Rowid_filter_container_type get_type() = 0; - - /* Allocate memory for the container */ - virtual bool alloc() = 0; - - /* - @brief Add info on a rowid / primary to the container - @param ctxt The context info (opaque) - @param elem The rowid / primary key to be added to the container - @retval true if elem is successfully added - */ - virtual bool add(void *ctxt, char *elem) = 0; - - /* - @brief Check whether a rowid / primary key is in container - @param ctxt The context info (opaque) - @param elem The rowid / primary key to be checked against the container - @retval False if elem is definitely not in the container - */ - virtual bool check(void *ctxt, char *elem) = 0; - - virtual ~Rowid_filter_container() {} -}; - - -/** - @class Rowid_filter - - The interface for different types of pk-filters - - Currently we support only range pk filters. -*/ - -class Rowid_filter : public Sql_alloc -{ -protected: - - /* The container to store info the set of elements in the filter */ - Rowid_filter_container *container; - - Rowid_filter_tracker *tracker; - -public: - Rowid_filter(Rowid_filter_container *container_arg) - : container(container_arg) {} - - /* - Build the filter : - fill it with info on the set of elements placed there - */ - virtual bool build() = 0; - - /* - Check whether an element is in the filter. - Returns false is the elements is definitely not in the filter. - */ - virtual bool check(char *elem) = 0; - - virtual ~Rowid_filter() {} - - Rowid_filter_container *get_container() { return container; } - - void set_tracker(Rowid_filter_tracker *track_arg) { tracker= track_arg; } - Rowid_filter_tracker *get_tracker() { return tracker; } -}; - - -/** - @class Rowid_filter_container - - The implementation of the Rowid_interface used for pk-filters - that are filled when performing range index scans. -*/ - -class Range_rowid_filter: public Rowid_filter -{ - /* The table for which the rowid filter is built */ - TABLE *table; - /* The select to perform the range scan to fill the filter */ - SQL_SELECT *select; - /* The cost info on the filter (used for EXPLAIN/ANALYZE) */ - Range_rowid_filter_cost_info *cost_info; - -public: - Range_rowid_filter(TABLE *tab, - Range_rowid_filter_cost_info *cost_arg, - Rowid_filter_container *container_arg, - SQL_SELECT *sel) - : Rowid_filter(container_arg), table(tab), select(sel), cost_info(cost_arg) - {} - - ~Range_rowid_filter(); - - bool build() { return fill(); } - - bool check(char *elem) - { - bool was_checked= container->check(table, elem); - tracker->increment_checked_elements_count(was_checked); - return was_checked; - } - - bool fill(); - - SQL_SELECT *get_select() { return select; } -}; - - -/** - @class Refpos_container_sorted_array - - The wrapper class over Dynamic_array to facilitate operations over - array of elements of the type char[N] where N is the same for all elements -*/ - -class Refpos_container_sorted_array : public Sql_alloc -{ - /* - Maximum number of elements in the array - (Now is used only at the initialization of the dynamic array) - */ - uint max_elements; - /* Number of bytes allocated for an element */ - uint elem_size; - /* The dynamic array over which the wrapper is built */ - Dynamic_array *array; - -public: - - Refpos_container_sorted_array(uint max_elems, uint elem_sz) - : max_elements(max_elems), elem_size(elem_sz), array(0) {} - - ~Refpos_container_sorted_array() - { - delete array; - array= 0; - } - - bool alloc() - { - array= new Dynamic_array (elem_size * max_elements, - elem_size * max_elements/sizeof(char) + 1); - return array == NULL; - } - - bool add(char *elem) - { - for (uint i= 0; i < elem_size; i++) - { - if (array->append(elem[i])) - return true; - } - return false; - } - - char *get_pos(uint n) - { - return array->get_pos(n * elem_size); - } - - uint elements() { return (uint) (array->elements() / elem_size); } - - void sort (int (*cmp) (void *ctxt, const void *el1, const void *el2), - void *cmp_arg) - { - my_qsort2(array->front(), array->elements()/elem_size, - elem_size, (qsort2_cmp) cmp, cmp_arg); - } -}; - - -/** - @class Rowid_filter_sorted_array - - The implementation of the Rowid_filter_container interface as - a sorted array container of rowids / primary keys -*/ - -class Rowid_filter_sorted_array: public Rowid_filter_container -{ - /* The dynamic array to store rowids / primary keys */ - Refpos_container_sorted_array refpos_container; - /* Initially false, becomes true after the first call of (check() */ - bool is_checked; - -public: - Rowid_filter_sorted_array(uint elems, uint elem_size) - : refpos_container(elems, elem_size), is_checked(false) {} - - Rowid_filter_container_type get_type() - { return SORTED_ARRAY_CONTAINER; } - - bool alloc() { return refpos_container.alloc(); } - - bool add(void *ctxt, char *elem) { return refpos_container.add(elem); } - - bool check(void *ctxt, char *elem); -}; - -/** - @class Range_rowid_filter_cost_info - - An objects of this class is created for each potentially usable - range filter. It contains the info that allows to figure out - whether usage of the range filter promises some gain. -*/ - -class Range_rowid_filter_cost_info : public Sql_alloc -{ - /* The table for which the range filter is to be built (if needed) */ - TABLE *table; - /* Estimated number of elements in the filter */ - ulonglong est_elements; - /* The cost of building the range filter */ - double b; - /* - a*N-b yields the gain of the filter - for N key tuples of the index key_no - */ - double a; - /* The value of N where the gain is 0 */ - double cross_x; - /* Used for pruning of the potential range filters */ - key_map abs_independent; - - /* - These two parameters are used to choose the best range filter - in the function TABLE::best_range_rowid_filter_for_partial_join - */ - double a_adj; - double cross_x_adj; - -public: - /* The type of the container of the range filter */ - Rowid_filter_container_type container_type; - /* The index whose range scan would be used to build the range filter */ - uint key_no; - /* The selectivity of the range filter */ - double selectivity; - - Range_rowid_filter_cost_info() : table(0), key_no(0) {} - - void init(Rowid_filter_container_type cont_type, - TABLE *tab, uint key_no); - - double build_cost(Rowid_filter_container_type container_type); - - inline double lookup_cost(Rowid_filter_container_type cont_type); - - inline double - avg_access_and_eval_gain_per_row(Rowid_filter_container_type cont_type); - - inline double avg_adjusted_gain_per_row(double access_cost_factor); - - inline void set_adjusted_gain_param(double access_cost_factor); - - /* Get the gain that usage of filter promises for r key tuples */ - inline double get_gain(double r) - { - return r * a - b; - } - - /* Get the adjusted gain that usage of filter promises for r key tuples */ - inline double get_adjusted_gain(double r) - { - return r * a_adj - b; - } - - /* - The gain promised by usage of the filter for r key tuples - due to less condition evaluations - */ - inline double get_cmp_gain(double r) - { - return r * (1 - selectivity) / TIME_FOR_COMPARE; - } - - Rowid_filter_container *create_container(); - - double get_a() { return a; } - - void trace_info(THD *thd); - - friend - void TABLE::prune_range_rowid_filters(); - - friend - void TABLE::init_cost_info_for_usable_range_rowid_filters(THD *thd); - - friend - Range_rowid_filter_cost_info * - TABLE::best_range_rowid_filter_for_partial_join(uint access_key_no, - double records, - double access_cost_factor); -}; - -#endif /* ROWID_FILTER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_constants.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_constants.h deleted file mode 100644 index f319d08..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_constants.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (c) 2007 MySQL AB, 2008 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef RPL_CONSTANTS_H -#define RPL_CONSTANTS_H - -#include -#include - -/** - Enumeration of the incidents that can occur for the server. - */ -enum Incident { - /** No incident */ - INCIDENT_NONE = 0, - - /** There are possibly lost events in the replication stream */ - INCIDENT_LOST_EVENTS = 1, - - /** Shall be last event of the enumeration */ - INCIDENT_COUNT -}; - - -/** - Enumeration of the reserved formats of Binlog extra row information -*/ -enum ExtraRowInfoFormat { - - /** Reserved formats 0 -> 63 inclusive */ - ERIF_LASTRESERVED = 63, - - /** - Available / uncontrolled formats - 64 -> 254 inclusive - */ - ERIF_OPEN1 = 64, - ERIF_OPEN2 = 65, - - ERIF_LASTOPEN = 254, - - /** - Multi-payload format 255 - - Length is total length, payload is sequence of - sub-payloads with their own headers containing - length + format. - */ - ERIF_MULTI = 255 -}; - -/* - 1 byte length, 1 byte format - Length is total length in bytes, including 2 byte header - Length values 0 and 1 are currently invalid and reserved. -*/ -#define EXTRA_ROW_INFO_LEN_OFFSET 0 -#define EXTRA_ROW_INFO_FORMAT_OFFSET 1 -#define EXTRA_ROW_INFO_HDR_BYTES 2 -#define EXTRA_ROW_INFO_MAX_PAYLOAD (255 - EXTRA_ROW_INFO_HDR_BYTES) - -enum enum_binlog_checksum_alg { - BINLOG_CHECKSUM_ALG_OFF= 0, // Events are without checksum though its generator - // is checksum-capable New Master (NM). - BINLOG_CHECKSUM_ALG_CRC32= 1, // CRC32 of zlib algorithm. - BINLOG_CHECKSUM_ALG_ENUM_END, // the cut line: valid alg range is [1, 0x7f]. - BINLOG_CHECKSUM_ALG_UNDEF= 255 // special value to tag undetermined yet checksum - // or events from checksum-unaware servers -}; - -#define BINLOG_CRYPTO_SCHEME_LENGTH 1 -#define BINLOG_KEY_VERSION_LENGTH 4 -#define BINLOG_IV_LENGTH MY_AES_BLOCK_SIZE -#define BINLOG_IV_OFFS_LENGTH 4 -#define BINLOG_NONCE_LENGTH (BINLOG_IV_LENGTH - BINLOG_IV_OFFS_LENGTH) - -struct Binlog_crypt_data { - uint scheme; - uint key_version, key_length, ctx_size; - uchar key[MY_AES_MAX_KEY_LENGTH]; - uchar nonce[BINLOG_NONCE_LENGTH]; - - int init(uint sch, uint kv) - { - scheme= sch; - ctx_size= encryption_ctx_size(ENCRYPTION_KEY_SYSTEM_DATA, kv); - key_version= kv; - key_length= sizeof(key); - return encryption_key_get(ENCRYPTION_KEY_SYSTEM_DATA, kv, key, &key_length); - } - - void set_iv(uchar* iv, uint32 offs) const - { - memcpy(iv, nonce, BINLOG_NONCE_LENGTH); - int4store(iv + BINLOG_NONCE_LENGTH, offs); - } -}; - -#endif /* RPL_CONSTANTS_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_filter.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_filter.h deleted file mode 100644 index f22ec8a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_filter.h +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef RPL_FILTER_H -#define RPL_FILTER_H - -#include "mysql.h" -#include "mysqld.h" -#include "sql_list.h" /* I_List */ -#include "hash.h" /* HASH */ - -class String; -struct TABLE_LIST; -typedef struct st_dynamic_array DYNAMIC_ARRAY; - -typedef struct st_table_rule_ent -{ - char* db; - char* tbl_name; - uint key_len; -} TABLE_RULE_ENT; - -/* - Rpl_filter - - Inclusion and exclusion rules of tables and databases. - Also handles rewrites of db. - Used for replication and binlogging. - */ -class Rpl_filter -{ -public: - Rpl_filter(); - ~Rpl_filter(); - Rpl_filter(Rpl_filter const&); - Rpl_filter& operator=(Rpl_filter const&); - - /* Checks - returns true if ok to replicate/log */ - -#ifndef MYSQL_CLIENT - bool tables_ok(const char* db, TABLE_LIST *tables); -#endif - bool db_ok(const char* db); - bool db_ok_with_wild_table(const char *db); - - bool is_on(); - - /* Setters - add filtering rules */ - - int add_do_table(const char* table_spec); - int add_ignore_table(const char* table_spec); - - int set_do_table(const char* table_spec); - int set_ignore_table(const char* table_spec); - - int add_wild_do_table(const char* table_spec); - int add_wild_ignore_table(const char* table_spec); - - int set_wild_do_table(const char* table_spec); - int set_wild_ignore_table(const char* table_spec); - - int add_do_db(const char* db_spec); - int add_ignore_db(const char* db_spec); - - int set_do_db(const char* db_spec); - int set_ignore_db(const char* db_spec); - - void set_parallel_mode(enum_slave_parallel_mode mode) - { - parallel_mode= mode; - } - /* Return given parallel mode or if one is not given, the default mode */ - enum_slave_parallel_mode get_parallel_mode() - { - return parallel_mode; - } - - void add_db_rewrite(const char* from_db, const char* to_db); - - /* Getters - to get information about current rules */ - - void get_do_table(String* str); - void get_ignore_table(String* str); - - void get_wild_do_table(String* str); - void get_wild_ignore_table(String* str); - - bool rewrite_db_is_empty(); - const char* get_rewrite_db(const char* db, size_t *new_len); - void copy_rewrite_db(Rpl_filter *from); - - I_List* get_do_db(); - I_List* get_ignore_db(); - - void get_do_db(String* str); - void get_ignore_db(String* str); - -private: - - void init_table_rule_hash(HASH* h, bool* h_inited); - void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited); - - int add_table_rule(HASH* h, const char* table_spec); - int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); - - typedef int (Rpl_filter::*Add_filter)(char const*); - - int parse_filter_rule(const char* spec, Add_filter func); - - void free_string_array(DYNAMIC_ARRAY *a); - void free_string_list(I_List *l); - - void table_rule_ent_hash_to_str(String* s, HASH* h, bool inited); - void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a, - bool inited); - void db_rule_ent_list_to_str(String* s, I_List* l); - TABLE_RULE_ENT* find_wild(DYNAMIC_ARRAY *a, const char* key, int len); - - int add_string_list(I_List *list, const char* spec); - - /* - Those 4 structures below are uninitialized memory unless the - corresponding *_inited variables are "true". - */ - HASH do_table; - HASH ignore_table; - DYNAMIC_ARRAY wild_do_table; - DYNAMIC_ARRAY wild_ignore_table; - enum_slave_parallel_mode parallel_mode; - - bool table_rules_on; - bool do_table_inited; - bool ignore_table_inited; - bool wild_do_table_inited; - bool wild_ignore_table_inited; - - I_List do_db; - I_List ignore_db; - - I_List rewrite_db; -}; - -extern Rpl_filter *global_rpl_filter; -extern Rpl_filter *binlog_filter; - -#endif // RPL_FILTER_H diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_gtid.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_gtid.h deleted file mode 100644 index 11541c8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_gtid.h +++ /dev/null @@ -1,384 +0,0 @@ -/* Copyright (c) 2013, Kristian Nielsen and MariaDB Services Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef RPL_GTID_H -#define RPL_GTID_H - -#include "hash.h" -#include "queues.h" -#include - -/* Definitions for MariaDB global transaction ID (GTID). */ - - -extern const LEX_CSTRING rpl_gtid_slave_state_table_name; - -class String; - -#define GTID_MAX_STR_LENGTH (10+1+10+1+20) - -struct rpl_gtid -{ - uint32 domain_id; - uint32 server_id; - uint64 seq_no; -}; - -inline bool operator==(const rpl_gtid& lhs, const rpl_gtid& rhs) -{ - return - lhs.domain_id == rhs.domain_id && - lhs.server_id == rhs.server_id && - lhs.seq_no == rhs.seq_no; -}; - -enum enum_gtid_skip_type { - GTID_SKIP_NOT, GTID_SKIP_STANDALONE, GTID_SKIP_TRANSACTION -}; - - -/* - Structure to keep track of threads waiting in MASTER_GTID_WAIT(). - - Since replication is (mostly) single-threaded, we want to minimise the - performance impact on that from MASTER_GTID_WAIT(). To achieve this, we - are careful to keep the common lock between replication threads and - MASTER_GTID_WAIT threads held for as short as possible. We keep only - a single thread waiting to be notified by the replication threads; this - thread then handles all the (potentially heavy) lifting of dealing with - all current waiting threads. -*/ -struct gtid_waiting { - /* Elements in the hash, basically a priority queue for each domain. */ - struct hash_element { - QUEUE queue; - uint32 domain_id; - }; - /* A priority queue to handle waiters in one domain in seq_no order. */ - struct queue_element { - uint64 wait_seq_no; - THD *thd; - int queue_idx; - /* - do_small_wait is true if we have responsibility for ensuring that there - is a small waiter. - */ - bool do_small_wait; - /* - The flag `done' is set when the wait is completed (either due to reaching - the position waited for, or due to timeout or kill). The queue_element - is in the queue if and only if `done' is true. - */ - bool done; - }; - - mysql_mutex_t LOCK_gtid_waiting; - HASH hash; - - void init(); - void destroy(); - hash_element *get_entry(uint32 domain_id); - int wait_for_pos(THD *thd, String *gtid_str, longlong timeout_us); - void promote_new_waiter(gtid_waiting::hash_element *he); - int wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, struct timespec *wait_until); - void process_wait_hash(uint64 wakeup_seq_no, gtid_waiting::hash_element *he); - int register_in_wait_queue(THD *thd, rpl_gtid *wait_gtid, hash_element *he, - queue_element *elem); - void remove_from_wait_queue(hash_element *he, queue_element *elem); -}; - - -class Relay_log_info; -struct rpl_group_info; -class Gtid_list_log_event; - -/* - Replication slave state. - - For every independent replication stream (identified by domain_id), this - remembers the last gtid applied on the slave within this domain. - - Since events are always committed in-order within a single domain, this is - sufficient to maintain the state of the replication slave. -*/ -struct rpl_slave_state -{ - /* Elements in the list of GTIDs kept for each domain_id. */ - struct list_element - { - struct list_element *next; - uint64 sub_id; - uint32 domain_id; - uint32 server_id; - uint64 seq_no; - /* - hton of mysql.gtid_slave_pos* table used to record this GTID. - Can be NULL if the gtid table failed to load (eg. missing - mysql.gtid_slave_pos table following an upgrade). - */ - void *hton; - }; - - /* Elements in the HASH that hold the state for one domain_id. */ - struct element - { - struct list_element *list; - uint32 domain_id; - /* Highest seq_no seen so far in this domain. */ - uint64 highest_seq_no; - /* - If this is non-NULL, then it is the waiter responsible for the small - wait in MASTER_GTID_WAIT(). - */ - gtid_waiting::queue_element *gtid_waiter; - /* - If gtid_waiter is non-NULL, then this is the seq_no that its - MASTER_GTID_WAIT() is waiting on. When we reach this seq_no, we need to - signal the waiter on COND_wait_gtid. - */ - uint64 min_wait_seq_no; - mysql_cond_t COND_wait_gtid; - - /* - For --gtid-ignore-duplicates. The Relay_log_info that currently owns - this domain, and the number of worker threads that are active in it. - - The idea is that only one of multiple master connections is allowed to - actively apply events for a given domain. Other connections must either - discard the events (if the seq_no in GTID shows they have already been - applied), or wait to see if the current owner will apply it. - */ - const Relay_log_info *owner_rli; - uint32 owner_count; - mysql_cond_t COND_gtid_ignore_duplicates; - - list_element *grab_list() { list_element *l= list; list= NULL; return l; } - void add(list_element *l) - { - l->next= list; - list= l; - } - }; - - /* Descriptor for mysql.gtid_slave_posXXX table in specific engine. */ - enum gtid_pos_table_state { - GTID_POS_AUTO_CREATE, - GTID_POS_CREATE_REQUESTED, - GTID_POS_CREATE_IN_PROGRESS, - GTID_POS_AVAILABLE - }; - struct gtid_pos_table { - struct gtid_pos_table *next; - /* - Use a void * here, rather than handlerton *, to make explicit that we - are not using the value to access any functionality in the engine. It - is just used as an opaque value to identify which engine we are using - for each GTID row. - */ - void *table_hton; - LEX_CSTRING table_name; - uint8 state; - }; - - /* Mapping from domain_id to its element. */ - HASH hash; - /* GTIDs added since last purge of old mysql.gtid_slave_pos rows. */ - uint32 pending_gtid_count; - /* Mutex protecting access to the state. */ - mysql_mutex_t LOCK_slave_state; - /* Auxiliary buffer to sort gtid list. */ - DYNAMIC_ARRAY gtid_sort_array; - - uint64 last_sub_id; - /* - List of tables available for durably storing the slave GTID position. - - Accesses to this table is protected by LOCK_slave_state. However for - efficiency, there is also a provision for read access to it from a running - slave without lock. - - An element can be added at the head of a list by storing the new - gtid_pos_tables pointer atomically with release semantics, to ensure that - the next pointer of the new element is visible to readers of the new list. - Other changes (like deleting or replacing elements) must happen only while - all SQL driver threads are stopped. LOCK_slave_state must be held in any - case. - - The list can be read without lock by an SQL driver thread or worker thread - by reading the gtid_pos_tables pointer atomically with acquire semantics, - to ensure that it will see the correct next pointer of a new head element. - */ - std::atomic gtid_pos_tables; - /* The default entry in gtid_pos_tables, mysql.gtid_slave_pos. */ - std::atomic default_gtid_pos_table; - bool loaded; - - rpl_slave_state(); - ~rpl_slave_state(); - - void truncate_hash(); - ulong count() const { return hash.records; } - int update(uint32 domain_id, uint32 server_id, uint64 sub_id, - uint64 seq_no, void *hton, rpl_group_info *rgi); - int truncate_state_table(THD *thd); - void select_gtid_pos_table(THD *thd, LEX_CSTRING *out_tablename); - int record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id, - bool in_transaction, bool in_statement, void **out_hton); - list_element *gtid_grab_pending_delete_list(); - LEX_CSTRING *select_gtid_pos_table(void *hton); - void gtid_delete_pending(THD *thd, rpl_slave_state::list_element **list_ptr); - uint64 next_sub_id(uint32 domain_id); - int iterate(int (*cb)(rpl_gtid *, void *), void *data, - rpl_gtid *extra_gtids, uint32 num_extra, - bool sort); - int tostring(String *dest, rpl_gtid *extra_gtids, uint32 num_extra); - bool domain_to_gtid(uint32 domain_id, rpl_gtid *out_gtid); - int load(THD *thd, const char *state_from_master, size_t len, bool reset, - bool in_statement); - bool is_empty(); - - element *get_element(uint32 domain_id); - int put_back_list(list_element *list); - - void update_state_hash(uint64 sub_id, rpl_gtid *gtid, void *hton, - rpl_group_info *rgi); - int record_and_update_gtid(THD *thd, struct rpl_group_info *rgi); - int check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi); - void release_domain_owner(rpl_group_info *rgi); - void set_gtid_pos_tables_list(gtid_pos_table *new_list, - gtid_pos_table *default_entry); - void add_gtid_pos_table(gtid_pos_table *entry); - struct gtid_pos_table *alloc_gtid_pos_table(LEX_CSTRING *table_name, - void *hton, rpl_slave_state::gtid_pos_table_state state); - void free_gtid_pos_tables(struct gtid_pos_table *list); -}; - - -/* - Binlog state. - This keeps the last GTID written to the binlog for every distinct - (domain_id, server_id) pair. - This will be logged at the start of the next binlog file as a - Gtid_list_log_event; this way, it is easy to find the binlog file - containing a given GTID, by simply scanning backwards from the newest - one until a lower seq_no is found in the Gtid_list_log_event at the - start of a binlog for the given domain_id and server_id. - - We also remember the last logged GTID for every domain_id. This is used - to know where to start when a master is changed to a slave. As a side - effect, it also allows to skip a hash lookup in the very common case of - logging a new GTID with same server id as last GTID. -*/ -struct rpl_binlog_state -{ - struct element { - uint32 domain_id; - HASH hash; /* Containing all server_id for one domain_id */ - /* The most recent entry in the hash. */ - rpl_gtid *last_gtid; - /* Counter to allocate next seq_no for this domain. */ - uint64 seq_no_counter; - - int update_element(const rpl_gtid *gtid); - }; - /* Mapping from domain_id to collection of elements. */ - HASH hash; - /* Mutex protecting access to the state. */ - mysql_mutex_t LOCK_binlog_state; - my_bool initialized; - - /* Auxiliary buffer to sort gtid list. */ - DYNAMIC_ARRAY gtid_sort_array; - - rpl_binlog_state() :initialized(0) {} - ~rpl_binlog_state(); - - void init(); - void reset_nolock(); - void reset(); - void free(); - bool load(struct rpl_gtid *list, uint32 count); - bool load(rpl_slave_state *slave_pos); - int update_nolock(const struct rpl_gtid *gtid, bool strict); - int update(const struct rpl_gtid *gtid, bool strict); - int update_with_next_gtid(uint32 domain_id, uint32 server_id, - rpl_gtid *gtid); - int alloc_element_nolock(const rpl_gtid *gtid); - bool check_strict_sequence(uint32 domain_id, uint32 server_id, uint64 seq_no); - int bump_seq_no_if_needed(uint32 domain_id, uint64 seq_no); - int write_to_iocache(IO_CACHE *dest); - int read_from_iocache(IO_CACHE *src); - uint32 count(); - int get_gtid_list(rpl_gtid *gtid_list, uint32 list_size); - int get_most_recent_gtid_list(rpl_gtid **list, uint32 *size); - bool append_pos(String *str); - bool append_state(String *str); - rpl_gtid *find_nolock(uint32 domain_id, uint32 server_id); - rpl_gtid *find(uint32 domain_id, uint32 server_id); - rpl_gtid *find_most_recent(uint32 domain_id); - const char* drop_domain(DYNAMIC_ARRAY *ids, Gtid_list_log_event *glev, char*); -}; - - -/* - Represent the GTID state that a slave connection to a master requests - the master to start sending binlog events from. -*/ -struct slave_connection_state -{ - struct entry { - rpl_gtid gtid; - uint32 flags; - }; - /* Bits for 'flags' */ - enum start_flags - { - START_OWN_SLAVE_POS= 0x1, - START_ON_EMPTY_DOMAIN= 0x2 - }; - - /* Mapping from domain_id to the entry with GTID requested for that domain. */ - HASH hash; - - /* Auxiliary buffer to sort gtid list. */ - DYNAMIC_ARRAY gtid_sort_array; - - slave_connection_state(); - ~slave_connection_state(); - - void reset() { my_hash_reset(&hash); } - int load(const char *slave_request, size_t len); - int load(const rpl_gtid *gtid_list, uint32 count); - int load(rpl_slave_state *state, rpl_gtid *extra_gtids, uint32 num_extra); - rpl_gtid *find(uint32 domain_id); - entry *find_entry(uint32 domain_id); - int update(const rpl_gtid *in_gtid); - void remove(const rpl_gtid *gtid); - void remove_if_present(const rpl_gtid *in_gtid); - ulong count() const { return hash.records; } - int to_string(String *out_str); - int append_to_string(String *out_str); - int get_gtid_list(rpl_gtid *gtid_list, uint32 list_size); - bool is_pos_reached(); -}; - - -extern bool rpl_slave_state_tostring_helper(String *dest, const rpl_gtid *gtid, - bool *first); -extern int gtid_check_rpl_slave_state_table(TABLE *table); -extern rpl_gtid *gtid_parse_string_to_list(const char *p, size_t len, - uint32 *out_len); - -#endif /* RPL_GTID_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_injector.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_injector.h deleted file mode 100644 index 669a8e2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_injector.h +++ /dev/null @@ -1,316 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef INJECTOR_H -#define INJECTOR_H - -/* Pull in 'byte', 'my_off_t', and 'uint32' */ -#include - -#include "rpl_constants.h" -#include "table.h" /* TABLE */ - -/* Forward declarations */ -class handler; -class MYSQL_BIN_LOG; -struct TABLE; - - -/* - Injector to inject rows into the MySQL server. - - The injector class is used to notify the MySQL server of new rows that have - appeared outside of MySQL control. - - The original purpose of this is to allow clusters---which handle replication - inside the cluster through other means---to insert new rows into binary log. - Note, however, that the injector should be used whenever rows are altered in - any manner that is outside of MySQL server visibility and which therefore - are not seen by the MySQL server. - */ -class injector -{ -public: - - /* - Get an instance of the injector. - - DESCRIPTION - The injector is a Singleton, so this static function return the - available instance of the injector. - - RETURN VALUE - A pointer to the available injector object. - */ - static injector *instance(); - - /* - Delete the singleton instance (if allocated). Used during server shutdown. - */ - static void free_instance(); - - /* - A transaction where rows can be added. - - DESCRIPTION - The transaction class satisfy the **CopyConstructible** and - **Assignable** requirements. Note that the transaction is *not* - default constructible. - */ - class transaction { - friend class injector; - public: - /* Convenience definitions */ - typedef uchar* record_type; - typedef uint32 server_id_type; - - /* - Table reference. - - RESPONSIBILITY - - The class contains constructors to handle several forms of - references to tables. The constructors can implicitly be used to - construct references from, e.g., strings containing table names. - - EXAMPLE - - The class is intended to be used *by value*. Please, do not try to - construct objects of this type using 'new'; instead construct an - object, possibly a temporary object. For example: - - injector::transaction::table tbl(share->table, true); - MY_BITMAP cols; - my_bitmap_init(&cols, NULL, (i + 7) / 8, false); - inj->write_row(::server_id, tbl, &cols, row_data); - - or - - MY_BITMAP cols; - my_bitmap_init(&cols, NULL, (i + 7) / 8, false); - inj->write_row(::server_id, - injector::transaction::table(share->table, true), - &cols, row_data); - - This will work, be more efficient, and have greater chance of - inlining, not run the risk of losing pointers. - - COLLABORATION - - injector::transaction - Provide a flexible interface to the representation of tables. - - */ - class table - { - public: - table(TABLE *table, bool is_transactional_arg) - : m_table(table), m_is_transactional(is_transactional_arg) - { - } - - char const *db_name() const { return m_table->s->db.str; } - char const *table_name() const { return m_table->s->table_name.str; } - TABLE *get_table() const { return m_table; } - bool is_transactional() const { return m_is_transactional; } - - private: - TABLE *m_table; - bool m_is_transactional; - }; - - /* - Binlog position as a structure. - */ - class binlog_pos { - friend class transaction; - public: - char const *file_name() const { return m_file_name; } - my_off_t file_pos() const { return m_file_pos; } - - private: - char const *m_file_name; - my_off_t m_file_pos; - }; - - transaction() : m_thd(NULL) { } - transaction(transaction const&); - ~transaction(); - - /* Clear transaction, i.e., make calls to 'good()' return false. */ - void clear() { m_thd= NULL; } - - /* Is the transaction in a good state? */ - bool good() const { return m_thd != NULL; } - - /* Default assignment operator: standard implementation */ - transaction& operator=(transaction t) { - swap(t); - return *this; - } - - /* - - DESCRIPTION - - Register table for use within the transaction. All tables - that are going to be used need to be registered before being - used below. The member function will fail with an error if - use_table() is called after any *_row() function has been - called for the transaction. - - RETURN VALUE - - 0 All OK - >0 Failure - - */ -#ifdef TO_BE_DELETED - int use_table(server_id_type sid, table tbl); -#endif - /* - Commit a transaction. - - This member function will clean up after a sequence of *_row calls by, - for example, releasing resource and unlocking files. - */ - int commit(); - - /* - Get the position for the start of the transaction. - - Returns the position in the binary log of the first event in this - transaction. If no event is yet written, the position where the event - *will* be written is returned. This position is known, since a - new_transaction() will lock the binary log and prevent any other - writes to the binary log. - */ - binlog_pos start_pos() const; - - private: - /* Only the injector may construct these object */ - transaction(MYSQL_BIN_LOG *, THD *); - - void swap(transaction& o) { - /* std::swap(m_start_pos, o.m_start_pos); */ - { - binlog_pos const tmp= m_start_pos; - m_start_pos= o.m_start_pos; - o.m_start_pos= tmp; - } - - /* std::swap(m_thd, o.m_thd); */ - { - THD* const tmp= m_thd; - m_thd= o.m_thd; - o.m_thd= tmp; - } - { - enum_state const tmp= m_state; - m_state= o.m_state; - o.m_state= tmp; - } - } - - enum enum_state - { - START_STATE, /* Start state */ - TABLE_STATE, /* At least one table has been registered */ - ROW_STATE, /* At least one row has been registered */ - STATE_COUNT /* State count and sink state */ - } m_state; - - /* - Check and update the state. - - PARAMETER(S) - - target_state - The state we are moving to: TABLE_STATE if we are - writing a table and ROW_STATE if we are writing a row. - - DESCRIPTION - - The internal state will be updated to the target state if - and only if it is a legal move. The only legal moves are: - - START_STATE -> START_STATE - START_STATE -> TABLE_STATE - TABLE_STATE -> TABLE_STATE - TABLE_STATE -> ROW_STATE - - That is: - - It is not possible to write any row before having written at - least one table - - It is not possible to write a table after at least one row - has been written - - RETURN VALUE - - 0 All OK - -1 Incorrect call sequence - */ - int check_state(enum_state const target_state) - { -#ifndef DBUG_OFF - static char const *state_name[] = { - "START_STATE", "TABLE_STATE", "ROW_STATE", "STATE_COUNT" - }; - - DBUG_ASSERT(target_state <= STATE_COUNT); - DBUG_PRINT("info", ("In state %s", state_name[m_state])); -#endif - - if (m_state <= target_state && target_state <= m_state + 1 && - m_state < STATE_COUNT) - m_state= target_state; - else - m_state= STATE_COUNT; - return m_state == STATE_COUNT ? 1 : 0; - } - - - binlog_pos m_start_pos; - THD *m_thd; - }; - - /* - Create a new transaction. This member function will prepare for a - sequence of *_row calls by, for example, reserving resources and - locking files. There are two overloaded alternatives: one returning a - transaction by value and one using placement semantics. The following - two calls are equivalent, with the exception that the latter will - overwrite the transaction. - - injector::transaction trans1= inj->new_trans(thd); - - injector::transaction trans2; - inj->new_trans(thd, &trans); - */ - transaction new_trans(THD *); - void new_trans(THD *, transaction *); - - int record_incident(THD*, Incident incident); - int record_incident(THD*, Incident incident, const LEX_CSTRING *message); - -private: - explicit injector(); - ~injector() { } /* Nothing needs to be done */ - injector(injector const&); /* You're not allowed to copy injector - instances. - */ -}; - -#endif /* INJECTOR_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_mi.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_mi.h deleted file mode 100644 index 4d47689..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_mi.h +++ /dev/null @@ -1,422 +0,0 @@ -/* Copyright (c) 2006, 2012, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef RPL_MI_H -#define RPL_MI_H - -#ifdef HAVE_REPLICATION - -#include "rpl_rli.h" -#include "rpl_reporting.h" -#include -#include "rpl_filter.h" -#include "keycaches.h" - -typedef struct st_mysql MYSQL; - -/** - Domain id based filter to handle DO_DOMAIN_IDS and IGNORE_DOMAIN_IDS used to - set filtering on replication slave based on event's GTID domain_id. -*/ -class Domain_id_filter -{ -private: - /* - Flag to tell whether the events in the current GTID group get written to - the relay log. It is set according to the domain_id based filtering rule - on every GTID_EVENT and reset at the end of current GTID event group. - */ - bool m_filter; - - /* - DO_DOMAIN_IDS (0): - Ignore all the events which do not belong to any of the domain ids in the - list. - - IGNORE_DOMAIN_IDS (1): - Ignore the events which belong to one of the domain ids in the list. - */ - DYNAMIC_ARRAY m_domain_ids[2]; - -public: - /* domain id list types */ - enum enum_list_type { - DO_DOMAIN_IDS= 0, - IGNORE_DOMAIN_IDS - }; - - Domain_id_filter(); - - ~Domain_id_filter(); - - /* - Returns whether the current group needs to be filtered. - */ - bool is_group_filtered() { return m_filter; } - - /* - Checks whether the group with the specified domain_id needs to be - filtered and updates m_filter flag accordingly. - */ - void do_filter(ulong domain_id); - - /* - Reset m_filter. It should be called when IO thread receives COMMIT_EVENT or - XID_EVENT. - */ - void reset_filter(); - - /* - Update the do/ignore domain id filter lists. - - @param do_ids [IN] domain ids to be kept - @param ignore_ids [IN] domain ids to be filtered out - @param using_gtid [IN] use GTID? - - @retval false Success - true Error - */ - bool update_ids(DYNAMIC_ARRAY *do_ids, DYNAMIC_ARRAY *ignore_ids, - bool using_gtid); - - /* - Serialize and store the ids from domain id lists into the thd's protocol - buffer. - - @param thd [IN] thread handler - - @retval void - */ - void store_ids(THD *thd); - - /* - Initialize the given domain id list (DYNAMIC_ARRAY) with the - space-separated list of numbers from the specified IO_CACHE where - the first number is the total number of entries to follows. - - @param f [IN] IO_CACHE file - @param type [IN] domain id list type - - @retval false Success - true Error - */ - bool init_ids(IO_CACHE *f, enum_list_type type); - - /* - Return the elements of the give domain id list type as string. - - @param type [IN] domain id list type - - @retval a string buffer storing the total number - of elements followed by the individual - elements (space-separated) in the - specified list. - - Note: Its caller's responsibility to free the returned string buffer. - */ - char *as_string(enum_list_type type); - -}; - - -extern TYPELIB slave_parallel_mode_typelib; - -typedef struct st_rows_event_tracker -{ - char binlog_file_name[FN_REFLEN]; - my_off_t first_seen; - my_off_t last_seen; - bool stmt_end_seen; - void update(const char* file_name, my_off_t pos, - const char* buf, - const Format_description_log_event *fdle); - void reset(); - bool check_and_report(const char* file_name, my_off_t pos); -} Rows_event_tracker; - -/***************************************************************************** - Replication IO Thread - - Master_info contains: - - information about how to connect to a master - - current master log name - - current master log offset - - misc control variables - - Master_info is initialized once from the master.info file if such - exists. Otherwise, data members corresponding to master.info fields - are initialized with defaults specified by master-* options. The - initialization is done through init_master_info() call. - - The format of master.info file: - - log_name - log_pos - master_host - master_user - master_pass - master_port - master_connect_retry - - To write out the contents of master.info file to disk ( needed every - time we read and queue data from the master ), a call to - flush_master_info() is required. - - To clean up, call end_master_info() - -*****************************************************************************/ - -class Master_info : public Slave_reporting_capability -{ - public: - enum enum_using_gtid { - USE_GTID_NO= 0, USE_GTID_CURRENT_POS= 1, USE_GTID_SLAVE_POS= 2 - }; - - Master_info(LEX_CSTRING *connection_name, bool is_slave_recovery); - ~Master_info(); - bool shall_ignore_server_id(ulong s_id); - void clear_in_memory_info(bool all); - bool error() - { - /* If malloc() in initialization failed */ - return connection_name.str == 0; - } - static const char *using_gtid_astext(enum enum_using_gtid arg); - bool using_parallel() - { - return opt_slave_parallel_threads > 0 && - parallel_mode > SLAVE_PARALLEL_NONE; - } - void release(); - void wait_until_free(); - void lock_slave_threads(); - void unlock_slave_threads(); - - /* the variables below are needed because we can change masters on the fly */ - char master_log_name[FN_REFLEN+6]; /* Room for multi-*/ - char host[HOSTNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1]; - char user[USERNAME_LENGTH+1]; - char password[MAX_PASSWORD_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1]; - LEX_CSTRING connection_name; /* User supplied connection name */ - LEX_CSTRING cmp_connection_name; /* Connection name in lower case */ - bool ssl; // enables use of SSL connection if true - char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN]; - char ssl_cipher[FN_REFLEN], ssl_key[FN_REFLEN]; - char ssl_crl[FN_REFLEN], ssl_crlpath[FN_REFLEN]; - bool ssl_verify_server_cert; - - my_off_t master_log_pos; - File fd; // we keep the file open, so we need to remember the file pointer - IO_CACHE file; - - mysql_mutex_t data_lock, run_lock, sleep_lock, start_stop_lock; - mysql_cond_t data_cond, start_cond, stop_cond, sleep_cond; - THD *io_thd; - MYSQL* mysql; - uint32 file_id; /* for 3.23 load data infile */ - Relay_log_info rli; - uint port; - Rpl_filter* rpl_filter; /* Each replication can set its filter rule*/ - /* - to hold checksum alg in use until IO thread has received FD. - Initialized to novalue, then set to the queried from master - @@global.binlog_checksum and deactivated once FD has been received. - */ - enum enum_binlog_checksum_alg checksum_alg_before_fd; - uint connect_retry; -#ifndef DBUG_OFF - int events_till_disconnect; - - /* - The following are auxiliary DBUG variables used to kill IO thread in the - middle of a group/transaction (see "kill_slave_io_after_2_events"). - */ - bool dbug_do_disconnect; - int dbug_event_counter; -#endif - bool inited; - volatile bool abort_slave; - volatile uint slave_running; - volatile ulong slave_run_id; - /* - The difference in seconds between the clock of the master and the clock of - the slave (second - first). It must be signed as it may be <0 or >0. - clock_diff_with_master is computed when the I/O thread starts; for this the - I/O thread does a SELECT UNIX_TIMESTAMP() on the master. - "how late the slave is compared to the master" is computed like this: - clock_of_slave - last_timestamp_executed_by_SQL_thread - clock_diff_with_master - - */ - long clock_diff_with_master; - /* - Keeps track of the number of events before fsyncing. - The option --sync-master-info determines how many - events should happen before fsyncing. - */ - uint sync_counter; - float heartbeat_period; // interface with CHANGE MASTER or master.info - ulonglong received_heartbeats; // counter of received heartbeat events - DYNAMIC_ARRAY ignore_server_ids; - ulong master_id; - /* - At reconnect and until the first rotate event is seen, prev_master_id is - the value of master_id during the previous connection, used to detect - silent change of master server during reconnects. - */ - ulong prev_master_id; - /* - Which kind of GTID position (if any) is used when connecting to master. - - Note that you can not change the numeric values of these, they are used - in master.info. - */ - enum enum_using_gtid using_gtid; - - /* - This GTID position records how far we have fetched into the relay logs. - This is used to continue fetching when the IO thread reconnects to the - master. - - (Full slave stop/start does not use it, as it resets the relay logs). - */ - slave_connection_state gtid_current_pos; - /* - If events_queued_since_last_gtid is non-zero, it is the number of events - queued so far in the relaylog of a GTID-prefixed event group. - It is zero when no partial event group has been queued at the moment. - */ - uint64 events_queued_since_last_gtid; - /* - The GTID of the partially-queued event group, when - events_queued_since_last_gtid is non-zero. - */ - rpl_gtid last_queued_gtid; - /* Whether last_queued_gtid had the FL_STANDALONE flag set. */ - bool last_queued_gtid_standalone; - /* - When slave IO thread needs to reconnect, gtid_reconnect_event_skip_count - counts number of events to skip from the first GTID-prefixed event group, - to avoid duplicating events in the relay log. - */ - uint64 gtid_reconnect_event_skip_count; - /* gtid_event_seen is false until we receive first GTID event from master. */ - bool gtid_event_seen; - /** - The struct holds some history of Rows- log-event reading/queuing - by the receiver thread. Its fields are updated per each such event - at time of queue_event(), and they are checked to detect - the Rows- event group integrity violation at time of first non-Rows- - event gets handled. - */ - Rows_event_tracker rows_event_tracker; - bool in_start_all_slaves, in_stop_all_slaves; - bool in_flush_all_relay_logs; - uint users; /* Active user for object */ - uint killed; - - - /* No of DDL event group */ - Atomic_counter total_ddl_groups; - - /* No of non-transactional event group*/ - Atomic_counter total_non_trans_groups; - - /* No of transactional event group*/ - Atomic_counter total_trans_groups; - - /* domain-id based filter */ - Domain_id_filter domain_id_filter; - - /* The parallel replication mode. */ - enum_slave_parallel_mode parallel_mode; - /* - semi_ack is used to identify if the current binlog event needs an - ACK from slave, or if delay_master is enabled. - */ - int semi_ack; -}; - -int init_master_info(Master_info* mi, const char* master_info_fname, - const char* slave_info_fname, - bool abort_if_no_master_info_file, - int thread_mask); -void end_master_info(Master_info* mi); -int flush_master_info(Master_info* mi, - bool flush_relay_log_cache, - bool need_lock_relay_log); -void copy_filter_setting(Rpl_filter* dst_filter, Rpl_filter* src_filter); -void update_change_master_ids(DYNAMIC_ARRAY *new_ids, DYNAMIC_ARRAY *old_ids); -void prot_store_ids(THD *thd, DYNAMIC_ARRAY *ids); - -/* - Multi master are handled trough this struct. - Changes to this needs to be protected by LOCK_active_mi; -*/ - -class Master_info_index -{ -private: - IO_CACHE index_file; - char index_file_name[FN_REFLEN]; - -public: - Master_info_index(); - ~Master_info_index(); - - HASH master_info_hash; - - bool init_all_master_info(); - bool write_master_name_to_index_file(LEX_CSTRING *connection_name, - bool do_sync); - - bool check_duplicate_master_info(LEX_CSTRING *connection_name, - const char *host, uint port); - bool add_master_info(Master_info *mi, bool write_to_file); - bool remove_master_info(Master_info *mi); - Master_info *get_master_info(const LEX_CSTRING *connection_name, - Sql_condition::enum_warning_level warning); - bool start_all_slaves(THD *thd); - bool stop_all_slaves(THD *thd); - void free_connections(); - bool flush_all_relay_logs(); -}; - - -/* - The class rpl_io_thread_info is the THD::system_thread_info for the IO thread. -*/ -class rpl_io_thread_info -{ -public: -}; - - -Master_info *get_master_info(const LEX_CSTRING *connection_name, - Sql_condition::enum_warning_level warning); -bool check_master_connection_name(LEX_CSTRING *name); -void create_logfile_name_with_suffix(char *res_file_name, size_t length, - const char *info_file, - bool append, - LEX_CSTRING *suffix); - -uchar *get_key_master_info(Master_info *mi, size_t *length, - my_bool not_used __attribute__((unused))); -void free_key_master_info(Master_info *mi); -uint any_slave_sql_running(bool already_locked); -bool give_error_if_slave_running(bool already_lock); - -#endif /* HAVE_REPLICATION */ -#endif /* RPL_MI_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_parallel.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_parallel.h deleted file mode 100644 index b88e77d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_parallel.h +++ /dev/null @@ -1,382 +0,0 @@ -#ifndef RPL_PARALLEL_H -#define RPL_PARALLEL_H - -#include "log_event.h" - - -struct rpl_parallel; -struct rpl_parallel_entry; -struct rpl_parallel_thread_pool; - -class Relay_log_info; -struct inuse_relaylog; - - -/* - Structure used to keep track of the parallel replication of a batch of - event-groups that group-committed together on the master. - - It is used to ensure that every event group in one batch has reached the - commit stage before the next batch starts executing. - - Note the lifetime of this structure: - - - It is allocated when the first event in a new batch of group commits - is queued, from the free list rpl_parallel_entry::gco_free_list. - - - The gco for the batch currently being queued is owned by - rpl_parallel_entry::current_gco. The gco for a previous batch that has - been fully queued is owned by the gco->prev_gco pointer of the gco for - the following batch. - - - The worker thread waits on gco->COND_group_commit_orderer for - rpl_parallel_entry::count_committing_event_groups to reach wait_count - before starting; the first waiter links the gco into the next_gco - pointer of the gco of the previous batch for signalling. - - - When an event group reaches the commit stage, it signals the - COND_group_commit_orderer if its gco->next_gco pointer is non-NULL and - rpl_parallel_entry::count_committing_event_groups has reached - gco->next_gco->wait_count. - - - The gco lives until all its event groups have completed their commit. - This is detected by rpl_parallel_entry::last_committed_sub_id being - greater than or equal gco->last_sub_id. Once this happens, the gco is - freed. Note that since update of last_committed_sub_id can happen - out-of-order, the thread that frees a given gco can be for any later - event group, not necessarily an event group from the gco being freed. -*/ -struct group_commit_orderer { - /* Wakeup condition, used with rpl_parallel_entry::LOCK_parallel_entry. */ - mysql_cond_t COND_group_commit_orderer; - uint64 wait_count; - group_commit_orderer *prev_gco; - group_commit_orderer *next_gco; - /* - The sub_id of last event group in the previous GCO. - Only valid if prev_gco != NULL. - */ - uint64 prior_sub_id; - /* - The sub_id of the last event group in this GCO. Only valid when next_gco - is non-NULL. - */ - uint64 last_sub_id; - /* - This flag is set when this GCO has been installed into the next_gco pointer - of the previous GCO. - */ - bool installed; - - enum force_switch_bits - { - /* - This flag is set for a GCO in which we have event groups with multiple - different commit_id values from the master. This happens when we - optimistically try to execute in parallel transactions not known to be - conflict-free. - - When this flag is set, in case of DDL we need to start a new GCO - regardless of current commit_id, as DDL is not safe to - speculatively apply in parallel with prior event groups. - */ - MULTI_BATCH= 1, - /* - This flag is set for a GCO that contains DDL. If set, it forces - a switch to a new GCO upon seeing a new commit_id, as DDL is not - safe to speculatively replicate in parallel with subsequent - transactions. - */ - FORCE_SWITCH= 2 - }; - uint8 flags; -}; - - -struct rpl_parallel_thread { - bool delay_start; - bool running; - bool stop; - bool pause_for_ftwrl; - mysql_mutex_t LOCK_rpl_thread; - mysql_cond_t COND_rpl_thread; - mysql_cond_t COND_rpl_thread_queue; - mysql_cond_t COND_rpl_thread_stop; - struct rpl_parallel_thread *next; /* For free list. */ - struct rpl_parallel_thread_pool *pool; - THD *thd; - /* - Who owns the thread, if any (it's a pointer into the - rpl_parallel_entry::rpl_threads array. - */ - struct rpl_parallel_thread **current_owner; - /* The rpl_parallel_entry of the owner. */ - rpl_parallel_entry *current_entry; - struct queued_event { - queued_event *next; - /* - queued_event can hold either an event to be executed, or just a binlog - position to be updated without any associated event. - */ - enum queued_event_t { - QUEUED_EVENT, - QUEUED_POS_UPDATE, - QUEUED_MASTER_RESTART - } typ; - union { - Log_event *ev; /* QUEUED_EVENT */ - rpl_parallel_entry *entry_for_queued; /* QUEUED_POS_UPDATE and - QUEUED_MASTER_RESTART */ - }; - rpl_group_info *rgi; - inuse_relaylog *ir; - ulonglong future_event_relay_log_pos; - char event_relay_log_name[FN_REFLEN]; - char future_event_master_log_name[FN_REFLEN]; - ulonglong event_relay_log_pos; - my_off_t future_event_master_log_pos; - size_t event_size; - } *event_queue, *last_in_queue; - uint64 queued_size; - /* These free lists are protected by LOCK_rpl_thread. */ - queued_event *qev_free_list; - rpl_group_info *rgi_free_list; - group_commit_orderer *gco_free_list; - /* - These free lists are local to the thread, so need not be protected by any - lock. They are moved to the global free lists in batches in the function - batch_free(), to reduce LOCK_rpl_thread contention. - - The lists are not NULL-terminated (as we do not need to traverse them). - Instead, if they are non-NULL, the loc_XXX_last_ptr_ptr points to the - `next' pointer of the last element, which is used to link into the front - of the global freelists. - */ - queued_event *loc_qev_list, **loc_qev_last_ptr_ptr; - size_t loc_qev_size; - uint64 qev_free_pending; - rpl_group_info *loc_rgi_list, **loc_rgi_last_ptr_ptr; - group_commit_orderer *loc_gco_list, **loc_gco_last_ptr_ptr; - /* These keep track of batch update of inuse_relaylog refcounts. */ - inuse_relaylog *accumulated_ir_last; - uint64 accumulated_ir_count; - - void enqueue(queued_event *qev) - { - if (last_in_queue) - last_in_queue->next= qev; - else - event_queue= qev; - last_in_queue= qev; - queued_size+= qev->event_size; - } - - void dequeue1(queued_event *list) - { - DBUG_ASSERT(list == event_queue); - event_queue= last_in_queue= NULL; - } - - void dequeue2(size_t dequeue_size) - { - queued_size-= dequeue_size; - } - - queued_event *get_qev_common(Log_event *ev, ulonglong event_size); - queued_event *get_qev(Log_event *ev, ulonglong event_size, - Relay_log_info *rli); - queued_event *retry_get_qev(Log_event *ev, queued_event *orig_qev, - const char *relay_log_name, - ulonglong event_pos, ulonglong event_size); - /* - Put a qev on the local free list, to be later released to the global free - list by batch_free(). - */ - void loc_free_qev(queued_event *qev); - /* - Release an rgi immediately to the global free list. Requires holding the - LOCK_rpl_thread mutex. - */ - void free_qev(queued_event *qev); - rpl_group_info *get_rgi(Relay_log_info *rli, Gtid_log_event *gtid_ev, - rpl_parallel_entry *e, ulonglong event_size); - /* - Put an gco on the local free list, to be later released to the global free - list by batch_free(). - */ - void loc_free_rgi(rpl_group_info *rgi); - /* - Release an rgi immediately to the global free list. Requires holding the - LOCK_rpl_thread mutex. - */ - void free_rgi(rpl_group_info *rgi); - group_commit_orderer *get_gco(uint64 wait_count, group_commit_orderer *prev, - uint64 first_sub_id); - /* - Put a gco on the local free list, to be later released to the global free - list by batch_free(). - */ - void loc_free_gco(group_commit_orderer *gco); - /* - Move all local free lists to the global ones. Requires holding - LOCK_rpl_thread. - */ - void batch_free(); - /* Update inuse_relaylog refcounts with what we have accumulated so far. */ - void inuse_relaylog_refcount_update(); -}; - - -struct rpl_parallel_thread_pool { - struct rpl_parallel_thread **threads; - struct rpl_parallel_thread *free_list; - mysql_mutex_t LOCK_rpl_thread_pool; - mysql_cond_t COND_rpl_thread_pool; - uint32 count; - bool inited; - /* - While FTWRL runs, this counter is incremented to make SQL thread or - STOP/START slave not try to start new activity while that operation - is in progress. - */ - bool busy; - - rpl_parallel_thread_pool(); - int init(uint32 size); - void destroy(); - void deactivate(); - void destroy_cond_mutex(); - struct rpl_parallel_thread *get_thread(rpl_parallel_thread **owner, - rpl_parallel_entry *entry); - void release_thread(rpl_parallel_thread *rpt); -}; - - -struct rpl_parallel_entry { - mysql_mutex_t LOCK_parallel_entry; - mysql_cond_t COND_parallel_entry; - uint32 domain_id; - /* - Incremented by wait_for_workers_idle() and rpl_pause_for_ftwrl() to show - that they are waiting, so that finish_event_group knows to signal them - when last_committed_sub_id is increased. - */ - uint32 need_sub_id_signal; - uint64 last_commit_id; - bool active; - /* - Set when SQL thread is shutting down, and no more events can be processed, - so worker threads must force abort any current transactions without - waiting for event groups to complete. - */ - bool force_abort; - /* - At STOP SLAVE (force_abort=true), we do not want to process all events in - the queue (which could unnecessarily delay stop, if a lot of events happen - to be queued). The stop_count provides a safe point at which to stop, so - that everything before becomes committed and nothing after does. The value - corresponds to group_commit_orderer::wait_count; if wait_count is less than - or equal to stop_count, we execute the associated event group, else we - skip it (and all following) and stop. - */ - uint64 stop_count; - - /* - Cyclic array recording the last rpl_thread_max worker threads that we - queued event for. This is used to limit how many workers a single domain - can occupy (--slave-domain-parallel-threads). - - Note that workers are never explicitly deleted from the array. Instead, - we need to check (under LOCK_rpl_thread) that the thread still belongs - to us before re-using (rpl_thread::current_owner). - */ - rpl_parallel_thread **rpl_threads; - uint32 rpl_thread_max; - uint32 rpl_thread_idx; - /* - The sub_id of the last transaction to commit within this domain_id. - Must be accessed under LOCK_parallel_entry protection. - - Event groups commit in order, so the rpl_group_info for an event group - will be alive (at least) as long as - rpl_group_info::gtid_sub_id > last_committed_sub_id. This can be used to - safely refer back to previous event groups if they are still executing, - and ignore them if they completed, without requiring explicit - synchronisation between the threads. - */ - uint64 last_committed_sub_id; - /* - The sub_id of the last event group in this replication domain that was - queued for execution by a worker thread. - */ - uint64 current_sub_id; - /* - The largest sub_id that has started its transaction. Protected by - LOCK_parallel_entry. - - (Transactions can start out-of-order, so this value signifies that no - transactions with larger sub_id have started, but not necessarily that all - transactions with smaller sub_id have started). - */ - uint64 largest_started_sub_id; - rpl_group_info *current_group_info; - /* - If we get an error in some event group, we set the sub_id of that event - group here. Then later event groups (with higher sub_id) can know not to - try to start (event groups that already started will be rolled back when - wait_for_prior_commit() returns error). - The value is ULONGLONG_MAX when no error occurred. - */ - uint64 stop_on_error_sub_id; - /* - During FLUSH TABLES WITH READ LOCK, transactions with sub_id larger than - this value must not start, but wait until the global read lock is released. - The value is set to ULONGLONG_MAX when no FTWRL is pending. - */ - uint64 pause_sub_id; - /* Total count of event groups queued so far. */ - uint64 count_queued_event_groups; - /* - Count of event groups that have started (but not necessarily completed) - the commit phase. We use this to know when every event group in a previous - batch of master group commits have started committing on the slave, so - that it is safe to start executing the events in the following batch. - */ - uint64 count_committing_event_groups; - /* The group_commit_orderer object for the events currently being queued. */ - group_commit_orderer *current_gco; - - rpl_parallel_thread * choose_thread(rpl_group_info *rgi, bool *did_enter_cond, - PSI_stage_info *old_stage, - Gtid_log_event *gtid_ev); - int queue_master_restart(rpl_group_info *rgi, - Format_description_log_event *fdev); -}; -struct rpl_parallel { - HASH domain_hash; - rpl_parallel_entry *current; - bool sql_thread_stopping; - - rpl_parallel(); - ~rpl_parallel(); - void reset(); - rpl_parallel_entry *find(uint32 domain_id); - void wait_for_done(THD *thd, Relay_log_info *rli); - void stop_during_until(); - bool workers_idle(); - int wait_for_workers_idle(THD *thd); - int do_event(rpl_group_info *serial_rgi, Log_event *ev, ulonglong event_size); -}; - - -extern struct rpl_parallel_thread_pool global_rpl_thread_pool; - - -extern int rpl_parallel_resize_pool_if_no_slaves(void); -extern int rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool); -extern int rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool); -extern bool process_gtid_for_restart_pos(Relay_log_info *rli, rpl_gtid *gtid); -extern int rpl_pause_for_ftwrl(THD *thd); -extern void rpl_unpause_after_ftwrl(THD *thd); - -#endif /* RPL_PARALLEL_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_record.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_record.h deleted file mode 100644 index 357dc76..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_record.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2007, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2013, SkySQL Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef RPL_RECORD_H -#define RPL_RECORD_H - -#include - -struct rpl_group_info; -struct TABLE; -typedef struct st_bitmap MY_BITMAP; - -#if !defined(MYSQL_CLIENT) -size_t pack_row(TABLE* table, MY_BITMAP const* cols, - uchar *row_data, const uchar *data); -#endif - -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) -int unpack_row(rpl_group_info *rgi, - TABLE *table, uint const colcnt, - uchar const *const row_data, MY_BITMAP const *cols, - uchar const **const curr_row_end, ulong *const master_reclength, - uchar const *const row_end); - -// Fill table's record[0] with default values. -int prepare_record(TABLE *const table, const uint skip, const bool check); -int fill_extra_persistent_columns(TABLE *table, int master_cols); -#endif - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_record_old.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_record_old.h deleted file mode 100644 index 0b2dd43..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_record_old.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2007, 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef RPL_RECORD_OLD_H -#define RPL_RECORD_OLD_H - -#include "log_event.h" /* Log_event_type */ - -#ifndef MYSQL_CLIENT -size_t pack_row_old(TABLE *table, MY_BITMAP const* cols, - uchar *row_data, const uchar *record); - -#ifdef HAVE_REPLICATION -int unpack_row_old(rpl_group_info *rgi, - TABLE *table, uint const colcnt, uchar *record, - uchar const *row, uchar const *row_buffer_end, - MY_BITMAP const *cols, - uchar const **row_end, ulong *master_reclength, - MY_BITMAP* const rw_set, - Log_event_type const event_type); -#endif -#endif -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_reporting.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_reporting.h deleted file mode 100644 index 62b934c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_reporting.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef RPL_REPORTING_H -#define RPL_REPORTING_H - -#include /* loglevel */ - -/** - Maximum size of an error message from a slave thread. - */ -#define MAX_SLAVE_ERRMSG 1024 - -/** - Mix-in to handle the message logging and reporting for relay log - info and master log info structures. - - By inheriting from this class, the class is imbued with - capabilities to do slave reporting. - */ -class Slave_reporting_capability -{ -public: - /** lock used to synchronize m_last_error on 'SHOW SLAVE STATUS' **/ - mutable mysql_mutex_t err_lock; - /** - Constructor. - - @param thread_name Printable name of the slave thread that is reporting. - */ - Slave_reporting_capability(char const *thread_name); - - /** - Writes a message and, if it's an error message, to Last_Error - (which will be displayed by SHOW SLAVE STATUS). - - @param level The severity level - @param err_code The error code - @param msg The message (usually related to the error - code, but can contain more information), in - printf() format. - */ - void report(loglevel level, int err_code, const char *extra_info, - const char *msg, ...) const - ATTRIBUTE_FORMAT(printf, 5, 6); - - /** - Clear errors. They will not show up under SHOW SLAVE - STATUS. - */ - void clear_error() { - mysql_mutex_lock(&err_lock); - m_last_error.clear(); - mysql_mutex_unlock(&err_lock); - } - - /** - Error information structure. - */ - class Error { - friend class Slave_reporting_capability; - public: - Error() - { - clear(); - } - - void clear() - { - number= 0; - message[0]= '\0'; - } - - /** Error code */ - uint32 number; - /** Error message */ - char message[MAX_SLAVE_ERRMSG]; - }; - - Error const& last_error() const { return m_last_error; } - - virtual ~Slave_reporting_capability()= 0; -private: - /** - Last error produced by the I/O or SQL thread respectively. - */ - mutable Error m_last_error; - - char const *const m_thread_name; - - // not implemented - Slave_reporting_capability(const Slave_reporting_capability& rhs); - Slave_reporting_capability& operator=(const Slave_reporting_capability& rhs); -}; - -#endif // RPL_REPORTING_H - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_rli.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_rli.h deleted file mode 100644 index 4223e01..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_rli.h +++ /dev/null @@ -1,998 +0,0 @@ -/* Copyright (c) 2005, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB Corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef RPL_RLI_H -#define RPL_RLI_H - -#include "rpl_tblmap.h" -#include "rpl_reporting.h" -#include "rpl_utility.h" -#include "log.h" /* LOG_INFO, MYSQL_BIN_LOG */ -#include "sql_class.h" /* THD */ -#include "log_event.h" -#include "rpl_parallel.h" - -struct RPL_TABLE_LIST; -class Master_info; -class Rpl_filter; - - -/**************************************************************************** - - Replication SQL Thread - - Relay_log_info contains: - - the current relay log - - the current relay log offset - - master log name - - master log sequence corresponding to the last update - - misc information specific to the SQL thread - - Relay_log_info is initialized from the slave.info file if such - exists. Otherwise, data members are intialized with defaults. The - initialization is done with Relay_log_info::init() call. - - The format of slave.info file: - - relay_log_name - relay_log_pos - master_log_name - master_log_pos - - To clean up, call end_relay_log_info() - -*****************************************************************************/ - -struct rpl_group_info; -struct inuse_relaylog; - -class Relay_log_info : public Slave_reporting_capability -{ -public: - /** - Flags for the state of reading the relay log. Note that these are - bit masks. - */ - enum enum_state_flag { - /** We are inside a group of events forming a statement */ - IN_STMT=1, - /** We have inside a transaction */ - IN_TRANSACTION=2 - }; - - /* - The SQL thread owns one Relay_log_info, and each client that has - executed a BINLOG statement owns one Relay_log_info. This function - returns zero for the Relay_log_info object that belongs to the SQL - thread and nonzero for Relay_log_info objects that belong to - clients. - */ - inline bool belongs_to_client() - { - DBUG_ASSERT(sql_driver_thd); - return !sql_driver_thd->slave_thread; - } - - /* - If true, events with the same server id should be replicated. This - field is set on creation of a relay log info structure by copying - the value of ::replicate_same_server_id and can be overridden if - necessary. For example of when this is done, check sql_binlog.cc, - where the BINLOG statement can be used to execute "raw" events. - */ - bool replicate_same_server_id; - - /*** The following variables can only be read when protect by data lock ****/ - - /* - info_fd - file descriptor of the info file. set only during - initialization or clean up - safe to read anytime - cur_log_fd - file descriptor of the current read relay log - */ - File info_fd,cur_log_fd; - - /* - Protected with internal locks. - Must get data_lock when resetting the logs. - */ - MYSQL_BIN_LOG relay_log; - LOG_INFO linfo; - - /* - cur_log - Pointer that either points at relay_log.get_log_file() or - &rli->cache_buf, depending on whether the log is hot or there was - the need to open a cold relay_log. - - cache_buf - IO_CACHE used when opening cold relay logs. - */ - IO_CACHE cache_buf,*cur_log; - - /* - Keeps track of the number of transactions that commits - before fsyncing. The option --sync-relay-log-info determines - how many transactions should commit before fsyncing. - */ - uint sync_counter; - - /* - Identifies when the recovery process is going on. - See sql/slave.cc:init_recovery for further details. - */ - bool is_relay_log_recovery; - - /* The following variables are safe to read any time */ - - /* IO_CACHE of the info file - set only during init or end */ - IO_CACHE info_file; - - /* - List of temporary tables used by this connection. - This is updated when a temporary table is created or dropped by - a replication thread. - - Not reset when replication ends, to allow one to access the tables - when replication restarts. - - Protected by data_lock. - */ - All_tmp_tables_list *save_temporary_tables; - - /* - standard lock acquisition order to avoid deadlocks: - run_lock, data_lock, relay_log.LOCK_log, relay_log.LOCK_index - */ - mysql_mutex_t data_lock, run_lock; - /* - start_cond is broadcast when SQL thread is started - stop_cond - when stopped - data_cond - when data protected by data_lock changes - */ - mysql_cond_t start_cond, stop_cond, data_cond; - /* parent Master_info structure */ - Master_info *mi; - - /* - List of active relay log files. - (This can be more than one in case of parallel replication). - */ - inuse_relaylog *inuse_relaylog_list; - inuse_relaylog *last_inuse_relaylog; - - /* - Needed to deal properly with cur_log getting closed and re-opened with - a different log under our feet - */ - uint32 cur_log_old_open_count; - - /* - If on init_info() call error_on_rli_init_info is true that means - that previous call to init_info() terminated with an error, RESET - SLAVE must be executed and the problem fixed manually. - */ - bool error_on_rli_init_info; - - /* - Let's call a group (of events) : - - a transaction - or - - an autocommiting query + its associated events (INSERT_ID, - TIMESTAMP...) - We need these rli coordinates : - - relay log name and position of the beginning of the group we currently - are executing. Needed to know where we have to restart when replication has - stopped in the middle of a group (which has been rolled back by the slave). - - relay log name and position just after the event we have just - executed. This event is part of the current group. - Formerly we only had the immediately above coordinates, plus a 'pending' - variable, but this dealt wrong with the case of a transaction starting on a - relay log and finishing (commiting) on another relay log. Case which can - happen when, for example, the relay log gets rotated because of - max_binlog_size. - - Note: group_relay_log_name, group_relay_log_pos must only be - written from the thread owning the Relay_log_info (SQL thread if - !belongs_to_client(); client thread executing BINLOG statement if - belongs_to_client()). - */ - char group_relay_log_name[FN_REFLEN]; - ulonglong group_relay_log_pos; - char event_relay_log_name[FN_REFLEN]; - ulonglong event_relay_log_pos; - ulonglong future_event_relay_log_pos; - /* - The master log name for current event. Only used in parallel replication. - */ - char future_event_master_log_name[FN_REFLEN]; - - /* - Original log name and position of the group we're currently executing - (whose coordinates are group_relay_log_name/pos in the relay log) - in the master's binlog. These concern the *group*, because in the master's - binlog the log_pos that comes with each event is the position of the - beginning of the group. - - Note: group_master_log_name, group_master_log_pos must only be - written from the thread owning the Relay_log_info (SQL thread if - !belongs_to_client(); client thread executing BINLOG statement if - belongs_to_client()). - */ - char group_master_log_name[FN_REFLEN]; - volatile my_off_t group_master_log_pos; - - /* - Handling of the relay_log_space_limit optional constraint. - ignore_log_space_limit is used to resolve a deadlock between I/O and SQL - threads, the SQL thread sets it to unblock the I/O thread and make it - temporarily forget about the constraint. - */ - ulonglong log_space_limit,log_space_total; - bool ignore_log_space_limit; - - /* - Used by the SQL thread to instructs the IO thread to rotate - the logs when the SQL thread needs to purge to release some - disk space. - */ - bool sql_force_rotate_relay; - - time_t last_master_timestamp; - /* - The SQL driver thread sets this true while it is waiting at the end of the - relay log for more events to arrive. SHOW SLAVE STATUS uses this to report - Seconds_Behind_Master as zero while the SQL thread is so waiting. - */ - bool sql_thread_caught_up; - - void clear_until_condition(); - /** - Reset the delay. - This is used by RESET SLAVE to clear the delay. - */ - void clear_sql_delay() - { - sql_delay= 0; - } - - - /* - Needed for problems when slave stops and we want to restart it - skipping one or more events in the master log that have caused - errors, and have been manually applied by DBA already. - Must be ulong as it's refered to from set_var.cc - */ - volatile ulonglong slave_skip_counter; - ulonglong max_relay_log_size; - - volatile ulong abort_pos_wait; /* Incremented on change master */ - volatile ulong slave_run_id; /* Incremented on slave start */ - mysql_mutex_t log_space_lock; - mysql_cond_t log_space_cond; - /* - THD for the main sql thread, the one that starts threads to process - slave requests. If there is only one thread, then this THD is also - used for SQL processing. - A kill sent to this THD will kill the replication. - */ - THD *sql_driver_thd; -#ifndef DBUG_OFF - int events_till_abort; -#endif - - enum_gtid_skip_type gtid_skip_flag; - - /* - inited changes its value within LOCK_active_mi-guarded critical - sections at times of start_slave_threads() (0->1) and end_slave() (1->0). - Readers may not acquire the mutex while they realize potential concurrency - issue. - If not set, the value of other members of the structure are undefined. - */ - volatile bool inited; - volatile bool abort_slave; - volatile bool stop_for_until; - volatile uint slave_running; - - /* - Condition and its parameters from START SLAVE UNTIL clause. - - UNTIL condition is tested with is_until_satisfied() method that is - called by exec_relay_log_event(). is_until_satisfied() caches the result - of the comparison of log names because log names don't change very often; - this cache is invalidated by parts of code which change log names with - notify_*_log_name_updated() methods. (They need to be called only if SQL - thread is running). - */ - - enum { - UNTIL_NONE= 0, UNTIL_MASTER_POS, UNTIL_RELAY_POS, UNTIL_GTID - } until_condition; - char until_log_name[FN_REFLEN]; - ulonglong until_log_pos; - /* extension extracted from log_name and converted to int */ - ulong until_log_name_extension; - /* - Cached result of comparison of until_log_name and current log name - -2 means unitialised, -1,0,1 are comarison results - */ - enum - { - UNTIL_LOG_NAMES_CMP_UNKNOWN= -2, UNTIL_LOG_NAMES_CMP_LESS= -1, - UNTIL_LOG_NAMES_CMP_EQUAL= 0, UNTIL_LOG_NAMES_CMP_GREATER= 1 - } until_log_names_cmp_result; - /* Condition for UNTIL master_gtid_pos. */ - slave_connection_state until_gtid_pos; - - /* - retried_trans is a cumulative counter: how many times the slave - has retried a transaction (any) since slave started. - Protected by data_lock. - */ - ulong retried_trans; - /* - Number of executed events for SLAVE STATUS. - Protected by slave_executed_entries_lock - */ - Atomic_counter executed_entries; - - /* - If the end of the hot relay log is made of master's events ignored by the - slave I/O thread, these two keep track of the coords (in the master's - binlog) of the last of these events seen by the slave I/O thread. If not, - ign_master_log_name_end[0] == 0. - As they are like a Rotate event read/written from/to the relay log, they - are both protected by rli->relay_log.LOCK_log. - */ - char ign_master_log_name_end[FN_REFLEN]; - ulonglong ign_master_log_pos_end; - /* Similar for ignored GTID events. */ - slave_connection_state ign_gtids; - - /* - Indentifies where the SQL Thread should create temporary files for the - LOAD DATA INFILE. This is used for security reasons. - */ - char slave_patternload_file[FN_REFLEN]; - size_t slave_patternload_file_size; - - rpl_parallel parallel; - /* - The relay_log_state keeps track of the current binlog state of the - execution of the relay log. This is used to know where to resume - current GTID position if the slave thread is stopped and - restarted. It is only accessed from the SQL thread, so it does - not need any locking. - */ - rpl_binlog_state relay_log_state; - /* - The restart_gtid_state is used when the SQL thread restarts on a relay log - in GTID mode. In multi-domain parallel replication, each domain may have a - separat position, so some events in more progressed domains may need to be - skipped. This keeps track of the domains that have not yet reached their - starting event. - */ - slave_connection_state restart_gtid_pos; - - Relay_log_info(bool is_slave_recovery, const char* thread_name= "SQL"); - ~Relay_log_info(); - - /* - Invalidate cached until_log_name and group_relay_log_name comparison - result. Should be called after any update of group_realy_log_name if - there chances that sql_thread is running. - */ - inline void notify_group_relay_log_name_update() - { - if (until_condition==UNTIL_RELAY_POS) - until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_UNKNOWN; - } - - /* - The same as previous but for group_master_log_name. - */ - inline void notify_group_master_log_name_update() - { - if (until_condition==UNTIL_MASTER_POS) - until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_UNKNOWN; - } - - void inc_group_relay_log_pos(ulonglong log_pos, - rpl_group_info *rgi, - bool skip_lock=0); - - int wait_for_pos(THD* thd, String* log_name, longlong log_pos, - longlong timeout); - void close_temporary_tables(); - - /* Check if UNTIL condition is satisfied. See slave.cc for more. */ - bool is_until_satisfied(Log_event *ev); - inline ulonglong until_pos() - { - DBUG_ASSERT(until_condition == UNTIL_MASTER_POS || - until_condition == UNTIL_RELAY_POS); - return ((until_condition == UNTIL_MASTER_POS) ? group_master_log_pos : - group_relay_log_pos); - } - inline char *until_name() - { - DBUG_ASSERT(until_condition == UNTIL_MASTER_POS || - until_condition == UNTIL_RELAY_POS); - return ((until_condition == UNTIL_MASTER_POS) ? group_master_log_name : - group_relay_log_name); - } - /** - Helper function to do after statement completion. - - This function is called from an event to complete the group by - either stepping the group position, if the "statement" is not - inside a transaction; or increase the event position, if the - "statement" is inside a transaction. - - @param event_log_pos - Master log position of the event. The position is recorded in the - relay log info and used to produce information for SHOW - SLAVE STATUS. - */ - bool stmt_done(my_off_t event_log_pos, THD *thd, rpl_group_info *rgi); - int alloc_inuse_relaylog(const char *name); - void free_inuse_relaylog(inuse_relaylog *ir); - void reset_inuse_relaylog(); - int update_relay_log_state(rpl_gtid *gtid_list, uint32 count); - - /** - Is the replication inside a group? - - The reader of the relay log is inside a group if either: - - The IN_TRANSACTION flag is set, meaning we're inside a transaction - - The IN_STMT flag is set, meaning we have read at least one row from - a multi-event entry. - - This flag reflects the state of the log 'just now', ie after the last - read event would be executed. - This allow us to test if we can stop replication before reading - the next entry. - - @retval true Replication thread is currently inside a group - @retval false Replication thread is currently not inside a group - */ - bool is_in_group() const { - return (m_flags & (IN_STMT | IN_TRANSACTION)); - } - - /** - Set the value of a replication state flag. - - @param flag Flag to set - */ - void set_flag(enum_state_flag flag) - { - m_flags|= flag; - } - - /** - Get the value of a replication state flag. - - @param flag Flag to get value of - - @return @c true if the flag was set, @c false otherwise. - */ - bool get_flag(enum_state_flag flag) - { - return m_flags & flag; - } - - /** - Clear the value of a replication state flag. - - @param flag Flag to clear - */ - void clear_flag(enum_state_flag flag) - { - m_flags&= ~flag; - } - - /** - Text used in THD::proc_info when the slave SQL thread is delaying. - */ - static const char *const state_delaying_string; - - bool flush(); - - /** - Reads the relay_log.info file. - */ - int init(const char* info_filename); - - /** - Indicate that a delay starts. - - This does not actually sleep; it only sets the state of this - Relay_log_info object to delaying so that the correct state can be - reported by SHOW SLAVE STATUS and SHOW PROCESSLIST. - - Requires rli->data_lock. - - @param delay_end The time when the delay shall end. - */ - void start_sql_delay(time_t delay_end) - { - mysql_mutex_assert_owner(&data_lock); - sql_delay_end= delay_end; - thd_proc_info(sql_driver_thd, state_delaying_string); - } - - int32 get_sql_delay() { return sql_delay; } - void set_sql_delay(int32 _sql_delay) { sql_delay= _sql_delay; } - time_t get_sql_delay_end() { return sql_delay_end; } - -private: - - - /** - Delay slave SQL thread by this amount, compared to master (in - seconds). This is set with CHANGE MASTER TO MASTER_DELAY=X. - - Guarded by data_lock. Initialized by the client thread executing - START SLAVE. Written by client threads executing CHANGE MASTER TO - MASTER_DELAY=X. Read by SQL thread and by client threads - executing SHOW SLAVE STATUS. Note: must not be written while the - slave SQL thread is running, since the SQL thread reads it without - a lock when executing Relay_log_info::flush(). - */ - int sql_delay; - - /** - During a delay, specifies the point in time when the delay ends. - - This is used for the SQL_Remaining_Delay column in SHOW SLAVE STATUS. - - Guarded by data_lock. Written by the sql thread. Read by client - threads executing SHOW SLAVE STATUS. - */ - time_t sql_delay_end; - - /* - Before the MASTER_DELAY parameter was added (WL#344), - relay_log.info had 4 lines. Now it has 5 lines. - */ - static const int LINES_IN_RELAY_LOG_INFO_WITH_DELAY= 5; - /* - Hint for when to stop event distribution by sql driver thread. - The flag is set ON by a non-group event when this event is in the middle - of a group (e.g a transaction group) so it's too early - to refresh the current-relay-log vs until-log cached comparison result. - And it is checked and to decide whether it's a right time to do so - when the being processed group has been fully scheduled. - */ - bool until_relay_log_names_defer; - - /* - Holds the state of the data in the relay log. - We need this to ensure that we are not in the middle of a - statement or inside BEGIN ... COMMIT when should rotate the - relay log. - */ - uint32 m_flags; -}; - - -/* - In parallel replication, if we need to re-try a transaction due to a - deadlock or other temporary error, we may need to go back and re-read events - out of an earlier relay log. - - This structure keeps track of the relaylogs that are potentially in use. - Each rpl_group_info has a pointer to one of those, corresponding to the - first GTID event. - - A pair of reference count keeps track of how long a relay log is potentially - in use. When the `completed' flag is set, all events have been read out of - the relay log, but the log might still be needed for retry in worker - threads. As worker threads complete an event group, they increment - atomically the `dequeued_count' with number of events queued. Thus, when - completed is set and dequeued_count equals queued_count, the relay log file - is finally done with and can be purged. - - By separating the queued and dequeued count, only the dequeued_count needs - multi-thread synchronisation; the completed flag and queued_count fields - are only accessed by the SQL driver thread and need no synchronisation. -*/ -struct inuse_relaylog { - inuse_relaylog *next; - Relay_log_info *rli; - /* - relay_log_state holds the binlog state corresponding to the start of this - relay log file. It is an array with relay_log_state_count elements. - */ - rpl_gtid *relay_log_state; - uint32 relay_log_state_count; - /* Number of events in this relay log queued for worker threads. */ - int64 queued_count; - /* Number of events completed by worker threads. */ - Atomic_counter dequeued_count; - /* Set when all events have been read from a relaylog. */ - bool completed; - char name[FN_REFLEN]; - - inuse_relaylog(Relay_log_info *rli_arg, rpl_gtid *relay_log_state_arg, - uint32 relay_log_state_count_arg, - const char *name_arg): - next(0), rli(rli_arg), relay_log_state(relay_log_state_arg), - relay_log_state_count(relay_log_state_count_arg), queued_count(0), - dequeued_count(0), completed(false) - { - strmake_buf(name, name_arg); - } -}; - - -/* - This is data for various state needed to be kept for the processing of - one event group (transaction) during replication. - - In single-threaded replication, there will be one global rpl_group_info and - one global Relay_log_info per master connection. They will be linked - together. - - In parallel replication, there will be one rpl_group_info object for - each running sql thread, each having their own thd. - - All rpl_group_info will share the same Relay_log_info. -*/ - -struct rpl_group_info -{ - rpl_group_info *next; /* For free list in rpl_parallel_thread */ - Relay_log_info *rli; - THD *thd; - /* - Current GTID being processed. - The sub_id gives the binlog order within one domain_id. A zero sub_id - means that there is no active GTID. - */ - uint64 gtid_sub_id; - rpl_gtid current_gtid; - uint64 commit_id; - /* - This is used to keep transaction commit order. - We will signal this when we commit, and can register it to wait for the - commit_orderer of the previous commit to signal us. - */ - wait_for_commit commit_orderer; - /* - If non-zero, the sub_id of a prior event group whose commit we have to wait - for before committing ourselves. Then wait_commit_group_info points to the - event group to wait for. - - Before using this, rpl_parallel_entry::last_committed_sub_id should be - compared against wait_commit_sub_id. Only if last_committed_sub_id is - smaller than wait_commit_sub_id must the wait be done (otherwise the - waited-for transaction is already committed, so we would otherwise wait - for the wrong commit). - */ - uint64 wait_commit_sub_id; - rpl_group_info *wait_commit_group_info; - /* - This holds a pointer to a struct that keeps track of the need to wait - for the previous batch of event groups to reach the commit stage, before - this batch can start to execute. - - (When we execute in parallel the transactions that group committed - together on the master, we still need to wait for any prior transactions - to have reached the commit stage). - - The pointed-to gco is only valid for as long as - gtid_sub_id < parallel_entry->last_committed_sub_id. After that, it can - be freed by another thread. - */ - group_commit_orderer *gco; - - struct rpl_parallel_entry *parallel_entry; - - /* - A container to hold on Intvar-, Rand-, Uservar- log-events in case - the slave is configured with table filtering rules. - The withhold events are executed when their parent Query destiny is - determined for execution as well. - */ - Deferred_log_events *deferred_events; - - /* - State of the container: true stands for IRU events gathering, - false does for execution, either deferred or direct. - */ - bool deferred_events_collecting; - - Annotate_rows_log_event *m_annotate_event; - - RPL_TABLE_LIST *tables_to_lock; /* RBR: Tables to lock */ - uint tables_to_lock_count; /* RBR: Count of tables to lock */ - table_mapping m_table_map; /* RBR: Mapping table-id to table */ - mysql_mutex_t sleep_lock; - mysql_cond_t sleep_cond; - - /* - trans_retries varies between 0 to slave_transaction_retries and counts how - many times the slave has retried the present transaction; gets reset to 0 - when the transaction finally succeeds. - */ - ulong trans_retries; - - /* - Used to defer stopping the SQL thread to give it a chance - to finish up the current group of events. - The timestamp is set and reset in @c sql_slave_killed(). - */ - time_t last_event_start_time; - - char *event_relay_log_name; - char event_relay_log_name_buf[FN_REFLEN]; - ulonglong event_relay_log_pos; - ulonglong future_event_relay_log_pos; - /* - The master log name for current event. Only used in parallel replication. - */ - char future_event_master_log_name[FN_REFLEN]; - bool is_parallel_exec; - /* When gtid_pending is true, we have not yet done record_gtid(). */ - bool gtid_pending; - int worker_error; - /* - Set true when we signalled that we reach the commit phase. Used to avoid - counting one event group twice. - */ - bool did_mark_start_commit; - /* Copy of flags2 from GTID event. */ - uchar gtid_ev_flags2; - enum { - GTID_DUPLICATE_NULL=0, - GTID_DUPLICATE_IGNORE=1, - GTID_DUPLICATE_OWNER=2 - }; - /* - When --gtid-ignore-duplicates, this is set to one of the above three - values: - GTID_DUPLICATE_NULL - Not using --gtid-ignore-duplicates. - GTID_DUPLICATE_IGNORE - This gtid already applied, skip the event group. - GTID_DUPLICATE_OWNER - We are the current owner of the domain, and must - apply the event group and then release the domain. - */ - uint8 gtid_ignore_duplicate_state; - - /* - Runtime state for printing a note when slave is taking - too long while processing a row event. - */ - longlong row_stmt_start_timestamp; - bool long_find_row_note_printed; - /* Needs room for "Gtid D-S-N\x00". */ - char gtid_info_buf[5+10+1+10+1+20+1]; - - /* - The timestamp, from the master, of the commit event. - Used to do delayed update of rli->last_master_timestamp, for getting - reasonable values out of Seconds_Behind_Master in SHOW SLAVE STATUS. - */ - time_t last_master_timestamp; - - /* - Information to be able to re-try an event group in case of a deadlock or - other temporary error. - */ - inuse_relaylog *relay_log; - uint64 retry_start_offset; - uint64 retry_event_count; - /* - If `speculation' is != SPECULATE_NO, then we are optimistically running - this transaction in parallel, even though it might not be safe (there may - be a conflict with a prior event group). - - In this case, a conflict can cause other errors than deadlocks (like - duplicate key for example). So in case of _any_ error, we need to roll - back and retry the event group. - */ - enum enum_speculation { - /* - This transaction was group-committed together on the master with the - other transactions with which it is replicated in parallel. - */ - SPECULATE_NO, - /* - We will optimistically try to run this transaction in parallel with - other transactions, even though it is not known to be conflict free. - If we get a conflict, we will detect it as a deadlock, roll back and - retry. - */ - SPECULATE_OPTIMISTIC, - /* - This transaction got a conflict during speculative parallel apply, or - it was marked on the master as likely to cause a conflict or unsafe to - speculate. So it will wait for the prior transaction to commit before - starting to replicate. - */ - SPECULATE_WAIT - } speculation; - enum enum_retry_killed { - RETRY_KILL_NONE = 0, - RETRY_KILL_PENDING, - RETRY_KILL_KILLED - }; - uchar killed_for_retry; - - rpl_group_info(Relay_log_info *rli_); - ~rpl_group_info(); - void reinit(Relay_log_info *rli); - - /* - Returns true if the argument event resides in the containter; - more specifically, the checking is done against the last added event. - */ - bool is_deferred_event(Log_event * ev) - { - return deferred_events_collecting ? deferred_events->is_last(ev) : false; - }; - /* The general cleanup that slave applier may need at the end of query. */ - inline void cleanup_after_query() - { - if (deferred_events) - deferred_events->rewind(); - }; - /* The general cleanup that slave applier may need at the end of session. */ - void cleanup_after_session() - { - if (deferred_events) - { - delete deferred_events; - deferred_events= NULL; - } - }; - - /** - Save pointer to Annotate_rows event and switch on the - binlog_annotate_row_events for this sql thread. - To be called when sql thread receives an Annotate_rows event. - */ - inline void set_annotate_event(Annotate_rows_log_event *event) - { - DBUG_ASSERT(m_annotate_event == NULL); - m_annotate_event= event; - this->thd->variables.binlog_annotate_row_events= 1; - } - - /** - Returns pointer to the saved Annotate_rows event or NULL if there is - no saved event. - */ - inline Annotate_rows_log_event* get_annotate_event() - { - return m_annotate_event; - } - - /** - Delete saved Annotate_rows event (if any) and switch off the - binlog_annotate_row_events for this sql thread. - To be called when sql thread has applied the last (i.e. with - STMT_END_F flag) rbr event. - */ - inline void free_annotate_event() - { - if (m_annotate_event) - { - this->thd->variables.binlog_annotate_row_events= 0; - delete m_annotate_event; - m_annotate_event= 0; - } - } - - bool get_table_data(TABLE *table_arg, table_def **tabledef_var, TABLE **conv_table_var) const - { - DBUG_ASSERT(tabledef_var && conv_table_var); - for (TABLE_LIST *ptr= tables_to_lock ; ptr != NULL ; ptr= ptr->next_global) - if (ptr->table == table_arg) - { - *tabledef_var= &static_cast(ptr)->m_tabledef; - *conv_table_var= static_cast(ptr)->m_conv_table; - DBUG_PRINT("debug", ("Fetching table data for table %s.%s:" - " tabledef: %p, conv_table: %p", - table_arg->s->db.str, table_arg->s->table_name.str, - *tabledef_var, *conv_table_var)); - return true; - } - return false; - } - - void clear_tables_to_lock(); - void cleanup_context(THD *, bool); - void slave_close_thread_tables(THD *); - void mark_start_commit_no_lock(); - void mark_start_commit(); - char *gtid_info(); - void unmark_start_commit(); - - longlong get_row_stmt_start_timestamp() - { - return row_stmt_start_timestamp; - } - - void set_row_stmt_start_timestamp() - { - if (row_stmt_start_timestamp == 0) - row_stmt_start_timestamp= microsecond_interval_timer(); - } - - void reset_row_stmt_start_timestamp() - { - row_stmt_start_timestamp= 0; - } - - void set_long_find_row_note_printed() - { - long_find_row_note_printed= true; - } - - void unset_long_find_row_note_printed() - { - long_find_row_note_printed= false; - } - - bool is_long_find_row_note_printed() - { - return long_find_row_note_printed; - } - - inline void inc_event_relay_log_pos() - { - if (!is_parallel_exec) - rli->event_relay_log_pos= future_event_relay_log_pos; - } -}; - - -/* - The class rpl_sql_thread_info is the THD::system_thread_info for an SQL - thread; this is either the driver SQL thread or a worker thread for parallel - replication. -*/ -class rpl_sql_thread_info -{ -public: - char cached_charset[6]; - Rpl_filter* rpl_filter; - - rpl_sql_thread_info(Rpl_filter *filter); - - /* - Last charset (6 bytes) seen by slave SQL thread is cached here; it helps - the thread save 3 get_charset() per Query_log_event if the charset is not - changing from event to event (common situation). - When the 6 bytes are equal to 0 is used to mean "cache is invalidated". - */ - void cached_charset_invalidate(); - bool cached_charset_compare(char *charset) const; -}; - - -extern struct rpl_slave_state *rpl_global_gtid_slave_state; -extern gtid_waiting rpl_global_gtid_waiting; - -int rpl_load_gtid_slave_state(THD *thd); -int find_gtid_slave_pos_tables(THD *thd); -int event_group_new_gtid(rpl_group_info *rgi, Gtid_log_event *gev); -void delete_or_keep_event_post_apply(rpl_group_info *rgi, - Log_event_type typ, Log_event *ev); - -#endif /* RPL_RLI_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_tblmap.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_tblmap.h deleted file mode 100644 index 63bac5e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_tblmap.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef TABLE_MAPPING_H -#define TABLE_MAPPING_H - -/* Forward declarations */ -#ifndef MYSQL_CLIENT -struct TABLE; -#else -class Table_map_log_event; -typedef Table_map_log_event TABLE; -void free_table_map_log_event(TABLE *table); -#endif - - -/* - CLASS table_mapping - - RESPONSIBILITIES - The table mapping is used to map table id's to table pointers - - COLLABORATION - RELAY_LOG For mapping table id:s to tables when receiving events. - */ - -/* - Guilhem to Mats: - in the table_mapping class, the memory is allocated and never freed (until - destruction). So this is a good candidate for allocating inside a MEM_ROOT: - it gives the efficient allocation in chunks (like in expand()). So I have - introduced a MEM_ROOT. - - Note that inheriting from Sql_alloc had no effect: it has effects only when - "ptr= new table_mapping" is called, and this is never called. And it would - then allocate from thd->mem_root which is a highly volatile object (reset - from example after executing each query, see dispatch_command(), it has a - free_root() at end); as the table_mapping object is supposed to live longer - than a query, it was dangerous. - A dedicated MEM_ROOT needs to be used, see below. -*/ - -#include "hash.h" /* HASH */ - -class table_mapping { - -private: - MEM_ROOT m_mem_root; - -public: - - enum enum_error { - ERR_NO_ERROR = 0, - ERR_LIMIT_EXCEEDED, - ERR_MEMORY_ALLOCATION - }; - - table_mapping(); - ~table_mapping(); - - TABLE* get_table(ulonglong table_id); - - int set_table(ulonglong table_id, TABLE* table); - int remove_table(ulonglong table_id); - void clear_tables(); - ulong count() const { return m_table_ids.records; } - -private: - /* - This is a POD (Plain Old Data). Keep it that way (we apply offsetof() to - it, which only works for PODs) - */ - struct entry { - ulonglong table_id; - union { - TABLE *table; - entry *next; - }; - }; - - entry *find_entry(ulonglong table_id) - { - return (entry *) my_hash_search(&m_table_ids, - (uchar*)&table_id, - sizeof(table_id)); - } - int expand(); - - /* - Head of the list of free entries; "free" in the sense that it's an - allocated entry free for use, NOT in the sense that it's freed - memory. - */ - entry *m_free; - - /* Correspondance between an id (a number) and a TABLE object */ - HASH m_table_ids; -}; - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_utility.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_utility.h deleted file mode 100644 index c28e8aa..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/rpl_utility.h +++ /dev/null @@ -1,309 +0,0 @@ -/* - Copyright (c) 2006, 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef RPL_UTILITY_H -#define RPL_UTILITY_H - -#ifndef __cplusplus -#error "Don't include this C++ header file from a non-C++ file!" -#endif - -#include "sql_priv.h" -#include "m_string.h" /* bzero, memcpy */ -#ifdef MYSQL_SERVER -#include "table.h" /* TABLE_LIST */ -#endif -#include "mysql_com.h" - -class Relay_log_info; -class Log_event; -struct rpl_group_info; - -/** - A table definition from the master. - - The responsibilities of this class is: - - Extract and decode table definition data from the table map event - - Check if table definition in table map is compatible with table - definition on slave - */ - -class table_def -{ -public: - /** - Constructor. - - @param types Array of types, each stored as a byte - @param size Number of elements in array 'types' - @param field_metadata Array of extra information about fields - @param metadata_size Size of the field_metadata array - @param null_bitmap The bitmap of fields that can be null - */ - table_def(unsigned char *types, ulong size, uchar *field_metadata, - int metadata_size, uchar *null_bitmap, uint16 flags); - - ~table_def(); - - /** - Return the number of fields there is type data for. - - @return The number of fields that there is type data for. - */ - ulong size() const { return m_size; } - - - /** - Returns internal binlog type code for one field, - without translation to real types. - */ - enum_field_types binlog_type(ulong index) const - { - return static_cast(m_type[index]); - } - /* - Return a representation of the type data for one field. - - @param index Field index to return data for - - @return Will return a representation of the type data for field - index. Currently, only the type identifier is - returned. - */ - enum_field_types type(ulong index) const - { - DBUG_ASSERT(index < m_size); - /* - If the source type is MYSQL_TYPE_STRING, it can in reality be - either MYSQL_TYPE_STRING, MYSQL_TYPE_ENUM, or MYSQL_TYPE_SET, so - we might need to modify the type to get the real type. - */ - enum_field_types source_type= binlog_type(index); - uint16 source_metadata= m_field_metadata[index]; - switch (source_type) - { - case MYSQL_TYPE_STRING: - { - int real_type= source_metadata >> 8; - if (real_type == MYSQL_TYPE_ENUM || real_type == MYSQL_TYPE_SET) - source_type= static_cast(real_type); - break; - } - - /* - This type has not been used since before row-based replication, - so we can safely assume that it really is MYSQL_TYPE_NEWDATE. - */ - case MYSQL_TYPE_DATE: - source_type= MYSQL_TYPE_NEWDATE; - break; - - default: - /* Do nothing */ - break; - } - - return source_type; - } -#ifdef MYSQL_SERVER - const Type_handler *field_type_handler(uint index) const; -#endif - - /* - This function allows callers to get the extra field data from the - table map for a given field. If there is no metadata for that field - or there is no extra metadata at all, the function returns 0. - - The function returns the value for the field metadata for column at - position indicated by index. As mentioned, if the field was a type - that stores field metadata, that value is returned else zero (0) is - returned. This method is used in the unpack() methods of the - corresponding fields to properly extract the data from the binary log - in the event that the master's field is smaller than the slave. - */ - uint16 field_metadata(uint index) const - { - DBUG_ASSERT(index < m_size); - if (m_field_metadata_size) - return m_field_metadata[index]; - else - return 0; - } - - /* - This function returns whether the field on the master can be null. - This value is derived from field->maybe_null(). - */ - my_bool maybe_null(uint index) const - { - DBUG_ASSERT(index < m_size); - return ((m_null_bits[(index / 8)] & - (1 << (index % 8))) == (1 << (index %8))); - } - - /* - This function returns the field size in raw bytes based on the type - and the encoded field data from the master's raw data. This method can - be used for situations where the slave needs to skip a column (e.g., - WL#3915) or needs to advance the pointer for the fields in the raw - data from the master to a specific column. - */ - uint32 calc_field_size(uint col, uchar *master_data) const; - - /** - Decide if the table definition is compatible with a table. - - Compare the definition with a table to see if it is compatible - with it. - - A table definition is compatible with a table if: - - The columns types of the table definition is a (not - necessarily proper) prefix of the column type of the table. - - - The other way around. - - - Each column on the master that also exists on the slave can be - converted according to the current settings of @c - SLAVE_TYPE_CONVERSIONS. - - @param thd - @param rli Pointer to relay log info - @param table Pointer to table to compare with. - - @param[out] tmp_table_var Pointer to temporary table for holding - conversion table. - - @retval 1 if the table definition is not compatible with @c table - @retval 0 if the table definition is compatible with @c table - */ -#ifndef MYSQL_CLIENT - bool compatible_with(THD *thd, rpl_group_info *rgi, TABLE *table, - TABLE **conv_table_var) const; - - /** - Create a virtual in-memory temporary table structure. - - The table structure has records and field array so that a row can - be unpacked into the record for further processing. - - In the virtual table, each field that requires conversion will - have a non-NULL value, while fields that do not require - conversion will have a NULL value. - - Some information that is missing in the events, such as the - character set for string types, are taken from the table that the - field is going to be pushed into, so the target table that the data - eventually need to be pushed into need to be supplied. - - @param thd Thread to allocate memory from. - @param rli Relay log info structure, for error reporting. - @param target_table Target table for fields. - - @return A pointer to a temporary table with memory allocated in the - thread's memroot, NULL if the table could not be created - */ - TABLE *create_conversion_table(THD *thd, rpl_group_info *rgi, - TABLE *target_table) const; -#endif - - -private: - ulong m_size; // Number of elements in the types array - unsigned char *m_type; // Array of type descriptors - uint m_field_metadata_size; - uint16 *m_field_metadata; - uchar *m_null_bits; - uint16 m_flags; // Table flags - uchar *m_memory; -}; - - -#ifndef MYSQL_CLIENT -/** - Extend the normal table list with a few new fields needed by the - slave thread, but nowhere else. - */ -struct RPL_TABLE_LIST - : public TABLE_LIST -{ - bool m_tabledef_valid; - table_def m_tabledef; - TABLE *m_conv_table; - bool master_had_triggers; -}; - - -/* Anonymous namespace for template functions/classes */ -CPP_UNNAMED_NS_START - - /* - Smart pointer that will automatically call my_afree (a macro) when - the pointer goes out of scope. This is used so that I do not have - to remember to call my_afree() before each return. There is no - overhead associated with this, since all functions are inline. - - I (Matz) would prefer to use the free function as a template - parameter, but that is not possible when the "function" is a - macro. - */ - template - class auto_afree_ptr - { - Obj* m_ptr; - public: - auto_afree_ptr(Obj* ptr) : m_ptr(ptr) { } - ~auto_afree_ptr() { if (m_ptr) my_afree(m_ptr); } - void assign(Obj* ptr) { - /* Only to be called if it hasn't been given a value before. */ - DBUG_ASSERT(m_ptr == NULL); - m_ptr= ptr; - } - Obj* get() { return m_ptr; } - }; - -CPP_UNNAMED_NS_END - -class Deferred_log_events -{ -private: - DYNAMIC_ARRAY array; - Log_event *last_added; - -public: - Deferred_log_events(Relay_log_info *rli); - ~Deferred_log_events(); - /* queue for exection at Query-log-event time prior the Query */ - int add(Log_event *ev); - bool is_empty(); - bool execute(struct rpl_group_info *rgi); - void rewind(); - bool is_last(Log_event *ev) { return ev == last_added; }; -}; - -#endif - -// NB. number of printed bit values is limited to sizeof(buf) - 1 -#define DBUG_PRINT_BITSET(N,FRM,BS) \ - do { \ - char buf[256]; \ - uint i; \ - for (i = 0 ; i < MY_MIN(sizeof(buf) - 1, (BS)->n_bits) ; i++) \ - buf[i] = bitmap_is_set((BS), i) ? '1' : '0'; \ - buf[i] = '\0'; \ - DBUG_PRINT((N), ((FRM), buf)); \ - } while (0) - -#endif /* RPL_UTILITY_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/scheduler.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/scheduler.h deleted file mode 100644 index ebf8d6e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/scheduler.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef SCHEDULER_INCLUDED -#define SCHEDULER_INCLUDED - -/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2012, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Classes for the thread scheduler -*/ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface -#endif - -class THD; - -/* Functions used when manipulating threads */ - -struct scheduler_functions -{ - uint max_threads; - Atomic_counter *connection_count; - ulong *max_connections; - bool (*init)(void); - void (*add_connection)(CONNECT *connect); - void (*thd_wait_begin)(THD *thd, int wait_type); - void (*thd_wait_end)(THD *thd); - void (*post_kill_notification)(THD *thd); - void (*end)(void); -}; - - -/** - Scheduler types enumeration. - - The default of --thread-handling is the first one in the - thread_handling_names array, this array has to be consistent with - the order in this array, so to change default one has to change the - first entry in this enum and the first entry in the - thread_handling_names array. - - @note The last entry of the enumeration is also used to mark the - thread handling as dynamic. In this case the name of the thread - handling is fetched from the name of the plugin that implements it. -*/ -enum scheduler_types -{ - /* - The default of --thread-handling is the first one in the - thread_handling_names array, this array has to be consistent with - the order in this array, so to change default one has to change - the first entry in this enum and the first entry in the - thread_handling_names array. - */ - SCHEDULER_ONE_THREAD_PER_CONNECTION=0, - SCHEDULER_NO_THREADS, - SCHEDULER_TYPES_COUNT -}; - -void one_thread_per_connection_scheduler(scheduler_functions *func, - ulong *arg_max_connections, Atomic_counter *arg_connection_count); -void one_thread_scheduler(scheduler_functions *func); - -extern void scheduler_init(); -extern void post_kill_notification(THD *); -/* - To be used for pool-of-threads (implemeneted differently on various OSs) -*/ -struct thd_scheduler -{ -public: - void *data; /* scheduler-specific data structure */ -}; - -#ifdef HAVE_POOL_OF_THREADS -void pool_of_threads_scheduler(scheduler_functions* func, - ulong *arg_max_connections, - Atomic_counter *arg_connection_count); -#else -#define pool_of_threads_scheduler(A,B,C) \ - one_thread_per_connection_scheduler(A, B, C) -#endif /*HAVE_POOL_OF_THREADS*/ - -#endif /* SCHEDULER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/scope.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/scope.h deleted file mode 100644 index b9e2e96..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/scope.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (c) 2020, MariaDB - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -#pragma once - -#include -#include - -namespace detail -{ - -template class scope_exit -{ -public: - template - explicit scope_exit(F &&f) : function_(std::forward(f)) - { - } - - scope_exit(scope_exit &&rhs) - : function_(std::move(rhs.function_)), engaged_(rhs.engaged_) - { - rhs.release(); - } - - scope_exit(const scope_exit &)= delete; - scope_exit &operator=(scope_exit &&)= delete; - scope_exit &operator=(const scope_exit &)= delete; - - void release() { engaged_= false; } - - ~scope_exit() - { - if (engaged_) - function_(); - } - -private: - Callable function_; - bool engaged_= true; -}; - -} // end namespace detail - -template -detail::scope_exit::type> -make_scope_exit(Callable &&f) -{ - return detail::scope_exit::type>( - std::forward(f)); -} diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/select_handler.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/select_handler.h deleted file mode 100644 index 5cc6323..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/select_handler.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (c) 2018, 2019 MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef SELECT_HANDLER_INCLUDED -#define SELECT_HANDLER_INCLUDED - -#include "mariadb.h" -#include "sql_priv.h" - -/** - @class select_handler - - This interface class is to be used for execution of select queries - by foreign engines -*/ - -class select_handler -{ - public: - THD *thd; - handlerton *ht; - - SELECT_LEX *select; // Select to be excuted - - /* - Temporary table where all results should be stored in record[0] - The table has a field for every item from the select_lex::item_list. - The table is actually never filled. Only its record buffer is used. - */ - TABLE *table; - List result_columns; - - bool is_analyze; - - bool send_result_set_metadata(); - bool send_data(); - - select_handler(THD *thd_arg, handlerton *ht_arg); - - virtual ~select_handler(); - - int execute(); - - virtual bool prepare(); - - static TABLE *create_tmp_table(THD *thd, SELECT_LEX *sel); - -protected: - /* - Functions to scan the select result set. - All these returns 0 if ok, error code in case of error. - */ - - /* Initialize the process of producing rows of result set */ - virtual int init_scan() = 0; - - /* - Put the next produced row of the result set in table->record[0] - and return 0. Return HA_ERR_END_OF_FILE if there are no more rows, - return other error number in case of fatal error. - */ - virtual int next_row() = 0; - - /* Finish scanning */ - virtual int end_scan() = 0; - - /* Report errors */ - virtual void print_error(int error, myf errflag); - - bool send_eof(); -}; - -#endif /* SELECT_HANDLER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync.h deleted file mode 100644 index 44f2366..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (C) 2007 Google Inc. - Copyright (C) 2008 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef SEMISYNC_H -#define SEMISYNC_H - -#include "mysqld.h" -#include "log_event.h" -#include "replication.h" - -/** - This class is used to trace function calls and other process - information -*/ -class Trace { -public: - static const unsigned long k_trace_function; - static const unsigned long k_trace_general; - static const unsigned long k_trace_detail; - static const unsigned long k_trace_net_wait; - - unsigned long m_trace_level; /* the level for tracing */ - - Trace() - :m_trace_level(0L) - {} - Trace(unsigned long trace_level) - :m_trace_level(trace_level) - {} -}; - -/** - Base class for semi-sync master and slave classes -*/ -class Repl_semi_sync_base - :public Trace { -public: - static const unsigned char k_sync_header[2]; /* three byte packet header */ - - /* Constants in network packet header. */ - static const unsigned char k_packet_magic_num; - static const unsigned char k_packet_flag_sync; -}; - -/* The layout of a semisync slave reply packet: - 1 byte for the magic num - 8 bytes for the binlog positon - n bytes for the binlog filename, terminated with a '\0' -*/ -#define REPLY_MAGIC_NUM_LEN 1 -#define REPLY_BINLOG_POS_LEN 8 -#define REPLY_BINLOG_NAME_LEN (FN_REFLEN + 1) -#define REPLY_MAGIC_NUM_OFFSET 0 -#define REPLY_BINLOG_POS_OFFSET (REPLY_MAGIC_NUM_OFFSET + REPLY_MAGIC_NUM_LEN) -#define REPLY_BINLOG_NAME_OFFSET (REPLY_BINLOG_POS_OFFSET + REPLY_BINLOG_POS_LEN) -#define REPLY_MESSAGE_MAX_LENGTH \ - (REPLY_MAGIC_NUM_LEN + REPLY_BINLOG_POS_LEN + REPLY_BINLOG_NAME_LEN) - -#endif /* SEMISYNC_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync_master.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync_master.h deleted file mode 100644 index 9f0acf5..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync_master.h +++ /dev/null @@ -1,673 +0,0 @@ -/* Copyright (C) 2007 Google Inc. - Copyright (c) 2008 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef SEMISYNC_MASTER_H -#define SEMISYNC_MASTER_H - -#include "semisync.h" -#include "semisync_master_ack_receiver.h" - -#ifdef HAVE_PSI_INTERFACE -extern PSI_mutex_key key_LOCK_rpl_semi_sync_master_enabled; -extern PSI_mutex_key key_LOCK_binlog; -extern PSI_cond_key key_COND_binlog_send; -#endif - -struct Tranx_node { - char log_name[FN_REFLEN]; - my_off_t log_pos; - struct Tranx_node *next; /* the next node in the sorted list */ - struct Tranx_node *hash_next; /* the next node during hash collision */ -}; - -/** - @class Tranx_node_allocator - - This class provides memory allocating and freeing methods for - Tranx_node. The main target is performance. - - @section ALLOCATE How to allocate a node - The pointer of the first node after 'last_node' in current_block is - returned. current_block will move to the next free Block when all nodes of - it are in use. A new Block is allocated and is put into the rear of the - Block link table if no Block is free. - - The list starts up empty (ie, there is no allocated Block). - - After some nodes are freed, there probably are some free nodes before - the sequence of the allocated nodes, but we do not reuse it. It is better - to keep the allocated nodes are in the sequence, for it is more efficient - for allocating and freeing Tranx_node. - - @section FREENODE How to free nodes - There are two methods for freeing nodes. They are free_all_nodes and - free_nodes_before. - - 'A Block is free' means all of its nodes are free. - @subsection free_nodes_before - As all allocated nodes are in the sequence, 'Before one node' means all - nodes before given node in the same Block and all Blocks before the Block - which containing the given node. As such, all Blocks before the given one - ('node') are free Block and moved into the rear of the Block link table. - The Block containing the given 'node', however, is not. For at least the - given 'node' is still in use. This will waste at most one Block, but it is - more efficient. - */ -#define BLOCK_TRANX_NODES 16 -class Tranx_node_allocator -{ -public: - /** - @param reserved_nodes - The number of reserved Tranx_nodes. It is used to set 'reserved_blocks' - which can contain at least 'reserved_nodes' number of Tranx_nodes. When - freeing memory, we will reserve at least reserved_blocks of Blocks not - freed. - */ - Tranx_node_allocator(uint reserved_nodes) : - reserved_blocks(reserved_nodes/BLOCK_TRANX_NODES + - (reserved_nodes%BLOCK_TRANX_NODES > 1 ? 2 : 1)), - first_block(NULL), last_block(NULL), - current_block(NULL), last_node(-1), block_num(0) {} - - ~Tranx_node_allocator() - { - Block *block= first_block; - while (block != NULL) - { - Block *next= block->next; - free_block(block); - block= next; - } - } - - /** - The pointer of the first node after 'last_node' in current_block is - returned. current_block will move to the next free Block when all nodes of - it are in use. A new Block is allocated and is put into the rear of the - Block link table if no Block is free. - - @return Return a Tranx_node *, or NULL if an error occurred. - */ - Tranx_node *allocate_node() - { - Tranx_node *trx_node; - Block *block= current_block; - - if (last_node == BLOCK_TRANX_NODES-1) - { - current_block= current_block->next; - last_node= -1; - } - - if (current_block == NULL && allocate_block()) - { - current_block= block; - if (current_block) - last_node= BLOCK_TRANX_NODES-1; - return NULL; - } - - trx_node= &(current_block->nodes[++last_node]); - trx_node->log_name[0] = '\0'; - trx_node->log_pos= 0; - trx_node->next= 0; - trx_node->hash_next= 0; - return trx_node; - } - - /** - All nodes are freed. - - @return Return 0, or 1 if an error occurred. - */ - int free_all_nodes() - { - current_block= first_block; - last_node= -1; - free_blocks(); - return 0; - } - - /** - All Blocks before the given 'node' are free Block and moved into the rear - of the Block link table. - - @param node All nodes before 'node' will be freed - - @return Return 0, or 1 if an error occurred. - */ - int free_nodes_before(Tranx_node* node) - { - Block *block; - Block *prev_block= NULL; - - block= first_block; - while (block != current_block->next) - { - /* Find the Block containing the given node */ - if (&(block->nodes[0]) <= node && &(block->nodes[BLOCK_TRANX_NODES]) >= node) - { - /* All Blocks before the given node are put into the rear */ - if (first_block != block) - { - last_block->next= first_block; - first_block= block; - last_block= prev_block; - last_block->next= NULL; - free_blocks(); - } - return 0; - } - prev_block= block; - block= block->next; - } - - /* Node does not find should never happen */ - DBUG_ASSERT(0); - return 1; - } - -private: - uint reserved_blocks; - - /** - A sequence memory which contains BLOCK_TRANX_NODES Tranx_nodes. - - BLOCK_TRANX_NODES The number of Tranx_nodes which are in a Block. - - next Every Block has a 'next' pointer which points to the next Block. - These linking Blocks constitute a Block link table. - */ - struct Block { - Block *next; - Tranx_node nodes[BLOCK_TRANX_NODES]; - }; - - /** - The 'first_block' is the head of the Block link table; - */ - Block *first_block; - /** - The 'last_block' is the rear of the Block link table; - */ - Block *last_block; - - /** - current_block always points the Block in the Block link table in - which the last allocated node is. The Blocks before it are all in use - and the Blocks after it are all free. - */ - Block *current_block; - - /** - It always points to the last node which has been allocated in the - current_block. - */ - int last_node; - - /** - How many Blocks are in the Block link table. - */ - uint block_num; - - /** - Allocate a block and then assign it to current_block. - */ - int allocate_block() - { - Block *block= (Block *)my_malloc(PSI_INSTRUMENT_ME, sizeof(Block), MYF(0)); - if (block) - { - block->next= NULL; - - if (first_block == NULL) - first_block= block; - else - last_block->next= block; - - /* New Block is always put into the rear */ - last_block= block; - /* New Block is always the current_block */ - current_block= block; - ++block_num; - return 0; - } - return 1; - } - - /** - Free a given Block. - @param block The Block will be freed. - */ - void free_block(Block *block) - { - my_free(block); - --block_num; - } - - - /** - If there are some free Blocks and the total number of the Blocks in the - Block link table is larger than the 'reserved_blocks', Some free Blocks - will be freed until the total number of the Blocks is equal to the - 'reserved_blocks' or there is only one free Block behind the - 'current_block'. - */ - void free_blocks() - { - if (current_block == NULL || current_block->next == NULL) - return; - - /* One free Block is always kept behind the current block */ - Block *block= current_block->next->next; - while (block_num > reserved_blocks && block != NULL) - { - Block *next= block->next; - free_block(block); - block= next; - } - current_block->next->next= block; - if (block == NULL) - last_block= current_block->next; - } -}; - -/** - This class manages memory for active transaction list. - - We record each active transaction with a Tranx_node, each session - can have only one open transaction. Because of EVENT, the total - active transaction nodes can exceed the maximum allowed - connections. -*/ -class Active_tranx - :public Trace { -private: - - Tranx_node_allocator m_allocator; - /* These two record the active transaction list in sort order. */ - Tranx_node *m_trx_front, *m_trx_rear; - - Tranx_node **m_trx_htb; /* A hash table on active transactions. */ - - int m_num_entries; /* maximum hash table entries */ - mysql_mutex_t *m_lock; /* mutex lock */ - - inline void assert_lock_owner(); - - inline unsigned int calc_hash(const unsigned char *key, size_t length); - unsigned int get_hash_value(const char *log_file_name, my_off_t log_file_pos); - - int compare(const char *log_file_name1, my_off_t log_file_pos1, - const Tranx_node *node2) { - return compare(log_file_name1, log_file_pos1, - node2->log_name, node2->log_pos); - } - int compare(const Tranx_node *node1, - const char *log_file_name2, my_off_t log_file_pos2) { - return compare(node1->log_name, node1->log_pos, - log_file_name2, log_file_pos2); - } - int compare(const Tranx_node *node1, const Tranx_node *node2) { - return compare(node1->log_name, node1->log_pos, - node2->log_name, node2->log_pos); - } - -public: - Active_tranx(mysql_mutex_t *lock, unsigned long trace_level); - ~Active_tranx(); - - /* Insert an active transaction node with the specified position. - * - * Return: - * 0: success; non-zero: error - */ - int insert_tranx_node(const char *log_file_name, my_off_t log_file_pos); - - /* Clear the active transaction nodes until(inclusive) the specified - * position. - * If log_file_name is NULL, everything will be cleared: the sorted - * list and the hash table will be reset to empty. - */ - void clear_active_tranx_nodes(const char *log_file_name, - my_off_t log_file_pos); - - /* Given a position, check to see whether the position is an active - * transaction's ending position by probing the hash table. - */ - bool is_tranx_end_pos(const char *log_file_name, my_off_t log_file_pos); - - /* Given two binlog positions, compare which one is bigger based on - * (file_name, file_position). - */ - static int compare(const char *log_file_name1, my_off_t log_file_pos1, - const char *log_file_name2, my_off_t log_file_pos2); - -}; - -/** - The extension class for the master of semi-synchronous replication -*/ -class Repl_semi_sync_master - :public Repl_semi_sync_base { - Active_tranx *m_active_tranxs; /* active transaction list: the list will - be cleared when semi-sync switches off. */ - - /* True when init_object has been called */ - bool m_init_done; - - /* This cond variable is signaled when enough binlog has been sent to slave, - * so that a waiting trx can return the 'ok' to the client for a commit. - */ - mysql_cond_t COND_binlog_send; - - /* Mutex that protects the following state variables and the active - * transaction list. - * Under no cirumstances we can acquire mysql_bin_log.LOCK_log if we are - * already holding m_LOCK_binlog because it can cause deadlocks. - */ - mysql_mutex_t LOCK_binlog; - - /* This is set to true when m_reply_file_name contains meaningful data. */ - bool m_reply_file_name_inited; - - /* The binlog name up to which we have received replies from any slaves. */ - char m_reply_file_name[FN_REFLEN]; - - /* The position in that file up to which we have the reply from any slaves. */ - my_off_t m_reply_file_pos; - - /* This is set to true when we know the 'smallest' wait position. */ - bool m_wait_file_name_inited; - - /* NULL, or the 'smallest' filename that a transaction is waiting for - * slave replies. - */ - char m_wait_file_name[FN_REFLEN]; - - /* The smallest position in that file that a trx is waiting for: the trx - * can proceed and send an 'ok' to the client when the master has got the - * reply from the slave indicating that it already got the binlog events. - */ - my_off_t m_wait_file_pos; - - /* This is set to true when we know the 'largest' transaction commit - * position in the binlog file. - * We always maintain the position no matter whether semi-sync is switched - * on switched off. When a transaction wait timeout occurs, semi-sync will - * switch off. Binlog-dump thread can use the three fields to detect when - * slaves catch up on replication so that semi-sync can switch on again. - */ - bool m_commit_file_name_inited; - - /* The 'largest' binlog filename that a commit transaction is seeing. */ - char m_commit_file_name[FN_REFLEN]; - - /* The 'largest' position in that file that a commit transaction is seeing. */ - my_off_t m_commit_file_pos; - - /* All global variables which can be set by parameters. */ - volatile bool m_master_enabled; /* semi-sync is enabled on the master */ - unsigned long m_wait_timeout; /* timeout period(ms) during tranx wait */ - - bool m_state; /* whether semi-sync is switched */ - - /*Waiting for ACK before/after innodb commit*/ - ulong m_wait_point; - - void lock(); - void unlock(); - void cond_broadcast(); - int cond_timewait(struct timespec *wait_time); - - /* Is semi-sync replication on? */ - bool is_on() { - return (m_state); - } - - void set_master_enabled(bool enabled) { - m_master_enabled = enabled; - } - - /* Switch semi-sync off because of timeout in transaction waiting. */ - void switch_off(); - - /* Switch semi-sync on when slaves catch up. */ - int try_switch_on(int server_id, - const char *log_file_name, my_off_t log_file_pos); - - public: - Repl_semi_sync_master(); - ~Repl_semi_sync_master() {} - - void cleanup(); - - bool get_master_enabled() { - return m_master_enabled; - } - void set_trace_level(unsigned long trace_level) { - m_trace_level = trace_level; - if (m_active_tranxs) - m_active_tranxs->m_trace_level = trace_level; - } - - /* Set the transaction wait timeout period, in milliseconds. */ - void set_wait_timeout(unsigned long wait_timeout) { - m_wait_timeout = wait_timeout; - } - - /*set the ACK point, after binlog sync or after transaction commit*/ - void set_wait_point(unsigned long ack_point) - { - m_wait_point = ack_point; - } - - ulong wait_point() //no cover line - { - return m_wait_point; //no cover line - } - - /* Initialize this class after MySQL parameters are initialized. this - * function should be called once at bootstrap time. - */ - int init_object(); - - /* Enable the object to enable semi-sync replication inside the master. */ - int enable_master(); - - /* Disable the object to disable semi-sync replication inside the master. */ - void disable_master(); - - /* Add a semi-sync replication slave */ - void add_slave(); - - /* Remove a semi-sync replication slave */ - void remove_slave(); - - /* It parses a reply packet and call report_reply_binlog to handle it. */ - int report_reply_packet(uint32 server_id, const uchar *packet, - ulong packet_len); - - /* In semi-sync replication, reports up to which binlog position we have - * received replies from the slave indicating that it already get the events. - * - * Input: - * server_id - (IN) master server id number - * log_file_name - (IN) binlog file name - * end_offset - (IN) the offset in the binlog file up to which we have - * the replies from the slave - * - * Return: - * 0: success; non-zero: error - */ - int report_reply_binlog(uint32 server_id, - const char* log_file_name, - my_off_t end_offset); - - /* Commit a transaction in the final step. This function is called from - * InnoDB before returning from the low commit. If semi-sync is switch on, - * the function will wait to see whether binlog-dump thread get the reply for - * the events of the transaction. Remember that this is not a direct wait, - * instead, it waits to see whether the binlog-dump thread has reached the - * point. If the wait times out, semi-sync status will be switched off and - * all other transaction would not wait either. - * - * Input: (the transaction events' ending binlog position) - * trx_wait_binlog_name - (IN) ending position's file name - * trx_wait_binlog_pos - (IN) ending position's file offset - * - * Return: - * 0: success; non-zero: error - */ - int commit_trx(const char* trx_wait_binlog_name, - my_off_t trx_wait_binlog_pos); - - /*Wait for ACK after writing/sync binlog to file*/ - int wait_after_sync(const char* log_file, my_off_t log_pos); - - /*Wait for ACK after commting the transaction*/ - int wait_after_commit(THD* thd, bool all); - - /*Wait after the transaction is rollback*/ - int wait_after_rollback(THD *thd, bool all); - /*Store the current binlog position in m_active_tranxs. This position should - * be acked by slave*/ - int report_binlog_update(THD *thd, const char *log_file,my_off_t log_pos); - - int dump_start(THD* thd, - const char *log_file, - my_off_t log_pos); - - void dump_end(THD* thd); - - /* Reserve space in the replication event packet header: - * . slave semi-sync off: 1 byte - (0) - * . slave semi-sync on: 3 byte - (0, 0xef, 0/1} - * - * Input: - * packet - (IN) the header buffer - * - * Return: - * size of the bytes reserved for header - */ - int reserve_sync_header(String* packet); - - /* Update the sync bit in the packet header to indicate to the slave whether - * the master will wait for the reply of the event. If semi-sync is switched - * off and we detect that the slave is catching up, we switch semi-sync on. - * - * Input: - * THD - (IN) current dump thread - * packet - (IN) the packet containing the replication event - * log_file_name - (IN) the event ending position's file name - * log_file_pos - (IN) the event ending position's file offset - * need_sync - (IN) identify if flush_net is needed to call. - * server_id - (IN) master server id number - * - * Return: - * 0: success; non-zero: error - */ - int update_sync_header(THD* thd, unsigned char *packet, - const char *log_file_name, - my_off_t log_file_pos, - bool* need_sync); - - /* Called when a transaction finished writing binlog events. - * . update the 'largest' transactions' binlog event position - * . insert the ending position in the active transaction list if - * semi-sync is on - * - * Input: (the transaction events' ending binlog position) - * log_file_name - (IN) transaction ending position's file name - * log_file_pos - (IN) transaction ending position's file offset - * - * Return: - * 0: success; non-zero: error - */ - int write_tranx_in_binlog(const char* log_file_name, my_off_t log_file_pos); - - /* Read the slave's reply so that we know how much progress the slave makes - * on receive replication events. - */ - int flush_net(THD* thd, const char *event_buf); - - /* Export internal statistics for semi-sync replication. */ - void set_export_stats(); - - /* 'reset master' command is issued from the user and semi-sync need to - * go off for that. - */ - int after_reset_master(); - - /*called before reset master*/ - int before_reset_master(); - - void check_and_switch(); - - mysql_mutex_t LOCK_rpl_semi_sync_master_enabled; -}; - -enum rpl_semi_sync_master_wait_point_t { - SEMI_SYNC_MASTER_WAIT_POINT_AFTER_BINLOG_SYNC, - SEMI_SYNC_MASTER_WAIT_POINT_AFTER_STORAGE_COMMIT, -}; - -extern Repl_semi_sync_master repl_semisync_master; -extern Ack_receiver ack_receiver; - -/* System and status variables for the master component */ -extern my_bool rpl_semi_sync_master_enabled; -extern my_bool rpl_semi_sync_master_status; -extern ulong rpl_semi_sync_master_wait_point; -extern ulong rpl_semi_sync_master_clients; -extern ulong rpl_semi_sync_master_timeout; -extern ulong rpl_semi_sync_master_trace_level; -extern ulong rpl_semi_sync_master_yes_transactions; -extern ulong rpl_semi_sync_master_no_transactions; -extern ulong rpl_semi_sync_master_off_times; -extern ulong rpl_semi_sync_master_wait_timeouts; -extern ulong rpl_semi_sync_master_timefunc_fails; -extern ulong rpl_semi_sync_master_num_timeouts; -extern ulong rpl_semi_sync_master_wait_sessions; -extern ulong rpl_semi_sync_master_wait_pos_backtraverse; -extern ulong rpl_semi_sync_master_avg_trx_wait_time; -extern ulong rpl_semi_sync_master_avg_net_wait_time; -extern ulonglong rpl_semi_sync_master_net_wait_num; -extern ulonglong rpl_semi_sync_master_trx_wait_num; -extern ulonglong rpl_semi_sync_master_net_wait_time; -extern ulonglong rpl_semi_sync_master_trx_wait_time; -extern unsigned long long rpl_semi_sync_master_request_ack; -extern unsigned long long rpl_semi_sync_master_get_ack; - -/* - This indicates whether we should keep waiting if no semi-sync slave - is available. - 0 : stop waiting if detected no avaialable semi-sync slave. - 1 (default) : keep waiting until timeout even no available semi-sync slave. -*/ -extern char rpl_semi_sync_master_wait_no_slave; -extern Repl_semi_sync_master repl_semisync_master; - -extern PSI_stage_info stage_waiting_for_semi_sync_ack_from_slave; -extern PSI_stage_info stage_reading_semi_sync_ack; -extern PSI_stage_info stage_waiting_for_semi_sync_slave; - -void semi_sync_master_deinit(); - -#endif /* SEMISYNC_MASTER_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync_master_ack_receiver.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync_master_ack_receiver.h deleted file mode 100644 index 138f7b5..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync_master_ack_receiver.h +++ /dev/null @@ -1,240 +0,0 @@ -/* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef SEMISYNC_MASTER_ACK_RECEIVER_DEFINED -#define SEMISYNC_MASTER_ACK_RECEIVER_DEFINED - -#include "my_global.h" -#include "my_pthread.h" -#include "sql_class.h" -#include "semisync.h" -#include - -struct Slave :public ilink -{ - THD *thd; - Vio vio; -#ifdef HAVE_POLL - uint m_fds_index; -#endif - my_socket sock_fd() const { return vio.mysql_socket.fd; } - uint server_id() const { return thd->variables.server_id; } -}; - -typedef I_List Slave_ilist; -typedef I_List_iterator Slave_ilist_iterator; - -/** - Ack_receiver is responsible to control ack receive thread and maintain - slave information used by ack receive thread. - - There are mainly four operations on ack receive thread: - start: start ack receive thread - stop: stop ack receive thread - add_slave: maintain a new semisync slave's information - remove_slave: remove a semisync slave's information - */ -class Ack_receiver : public Repl_semi_sync_base -{ -public: - Ack_receiver(); - ~Ack_receiver() {} - void cleanup(); - /** - Notify ack receiver to receive acks on the dump session. - - It adds the given dump thread into the slave list and wakes - up ack thread if it is waiting for any slave coming. - - @param[in] thd THD of a dump thread. - - @return it return false if succeeds, otherwise true is returned. - */ - bool add_slave(THD *thd); - - /** - Notify ack receiver not to receive ack on the dump session. - - it removes the given dump thread from slave list. - - @param[in] thd THD of a dump thread. - */ - void remove_slave(THD *thd); - - /** - Start ack receive thread - - @return it return false if succeeds, otherwise true is returned. - */ - bool start(); - - /** - Stop ack receive thread - */ - void stop(); - - /** - The core of ack receive thread. - - It monitors all slaves' sockets and receives acks when they come. - */ - void run(); - - void set_trace_level(unsigned long trace_level) - { - m_trace_level= trace_level; - } -private: - enum status {ST_UP, ST_DOWN, ST_STOPPING}; - uint8 m_status; - /* - Protect m_status, m_slaves_changed and m_slaves. ack thread and other - session may access the variables at the same time. - */ - mysql_mutex_t m_mutex; - mysql_cond_t m_cond; - /* If slave list is updated(add or remove). */ - bool m_slaves_changed; - - Slave_ilist m_slaves; - pthread_t m_pid; - -/* Declare them private, so no one can copy the object. */ - Ack_receiver(const Ack_receiver &ack_receiver); - Ack_receiver& operator=(const Ack_receiver &ack_receiver); - - void set_stage_info(const PSI_stage_info &stage); - void wait_for_slave_connection(); -}; - - -#ifdef HAVE_POLL -#include -#include - -class Poll_socket_listener -{ -public: - Poll_socket_listener(const Slave_ilist &slaves) - :m_slaves(slaves) - { - } - - bool listen_on_sockets() - { - return poll(m_fds.data(), m_fds.size(), 1000 /*1 Second timeout*/); - } - - bool is_socket_active(const Slave *slave) - { - return m_fds[slave->m_fds_index].revents & POLLIN; - } - - void clear_socket_info(const Slave *slave) - { - m_fds[slave->m_fds_index].fd= -1; - m_fds[slave->m_fds_index].events= 0; - } - - uint init_slave_sockets() - { - Slave_ilist_iterator it(const_cast(m_slaves)); - Slave *slave; - uint fds_index= 0; - - m_fds.clear(); - while ((slave= it++)) - { - pollfd poll_fd; - poll_fd.fd= slave->sock_fd(); - poll_fd.events= POLLIN; - m_fds.push_back(poll_fd); - slave->m_fds_index= fds_index++; - } - return fds_index; - } - -private: - const Slave_ilist &m_slaves; - std::vector m_fds; -}; - -#else //NO POLL - -class Select_socket_listener -{ -public: - Select_socket_listener(const Slave_ilist &slaves) - :m_slaves(slaves), m_max_fd(INVALID_SOCKET) - { - } - - bool listen_on_sockets() - { - /* Reinitialze the fds with active fds before calling select */ - m_fds= m_init_fds; - struct timeval tv= {1,0}; - /* select requires max fd + 1 for the first argument */ - return select((int) m_max_fd+1, &m_fds, NULL, NULL, &tv); - } - - bool is_socket_active(const Slave *slave) - { - return FD_ISSET(slave->sock_fd(), &m_fds); - } - - void clear_socket_info(const Slave *slave) - { - FD_CLR(slave->sock_fd(), &m_init_fds); - } - - uint init_slave_sockets() - { - Slave_ilist_iterator it(const_cast(m_slaves)); - Slave *slave; - uint fds_index= 0; - - FD_ZERO(&m_init_fds); - while ((slave= it++)) - { - my_socket socket_id= slave->sock_fd(); - m_max_fd= (socket_id > m_max_fd ? socket_id : m_max_fd); -#ifndef _WIN32 - if (socket_id > FD_SETSIZE) - { - sql_print_error("Semisync slave socket fd is %u. " - "select() cannot handle if the socket fd is " - "greater than %u (FD_SETSIZE).", socket_id, FD_SETSIZE); - return 0; - } -#endif //_WIN32 - FD_SET(socket_id, &m_init_fds); - fds_index++; - } - return fds_index; - } - my_socket get_max_fd() { return m_max_fd; } - -private: - const Slave_ilist &m_slaves; - my_socket m_max_fd; - fd_set m_init_fds; - fd_set m_fds; -}; - -#endif //HAVE_POLL - -extern Ack_receiver ack_receiver; -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync_slave.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync_slave.h deleted file mode 100644 index d65262f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/semisync_slave.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 2006 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -#ifndef SEMISYNC_SLAVE_H -#define SEMISYNC_SLAVE_H - -#include "semisync.h" -#include "my_global.h" -#include "sql_priv.h" -#include "rpl_mi.h" -#include "mysql.h" - -class Master_info; - -/** - The extension class for the slave of semi-synchronous replication -*/ -class Repl_semi_sync_slave - :public Repl_semi_sync_base { -public: - Repl_semi_sync_slave() :m_slave_enabled(false) {} - ~Repl_semi_sync_slave() {} - - void set_trace_level(unsigned long trace_level) { - m_trace_level = trace_level; - } - - /* Initialize this class after MySQL parameters are initialized. this - * function should be called once at bootstrap time. - */ - int init_object(); - - bool get_slave_enabled() { - return m_slave_enabled; - } - - void set_slave_enabled(bool enabled) { - m_slave_enabled = enabled; - } - - bool is_delay_master(){ - return m_delay_master; - } - - void set_delay_master(bool enabled) { - m_delay_master = enabled; - } - - void set_kill_conn_timeout(unsigned int timeout) { - m_kill_conn_timeout = timeout; - } - - /* A slave reads the semi-sync packet header and separate the metadata - * from the payload data. - * - * Input: - * header - (IN) packet header pointer - * total_len - (IN) total packet length: metadata + payload - * semi_flags - (IN) store flags: SEMI_SYNC_SLAVE_DELAY_SYNC and - SEMI_SYNC_NEED_ACK - * payload - (IN) payload: the replication event - * payload_len - (IN) payload length - * - * Return: - * 0: success; non-zero: error - */ - int slave_read_sync_header(const char *header, unsigned long total_len, - int *semi_flags, - const char **payload, unsigned long *payload_len); - - /* A slave replies to the master indicating its replication process. It - * indicates that the slave has received all events before the specified - * binlog position. - */ - int slave_reply(Master_info* mi); - int slave_start(Master_info *mi); - int slave_stop(Master_info *mi); - int request_transmit(Master_info*); - void kill_connection(MYSQL *mysql); - int reset_slave(Master_info *mi); - -private: - /* True when init_object has been called */ - bool m_init_done; - bool m_slave_enabled; /* semi-sycn is enabled on the slave */ - bool m_delay_master; - unsigned int m_kill_conn_timeout; -}; - - -/* System and status variables for the slave component */ -extern my_bool rpl_semi_sync_slave_enabled; -extern my_bool rpl_semi_sync_slave_status; -extern ulong rpl_semi_sync_slave_trace_level; -extern Repl_semi_sync_slave repl_semisync_slave; - -extern char rpl_semi_sync_slave_delay_master; -extern unsigned int rpl_semi_sync_slave_kill_conn_timeout; -extern unsigned long long rpl_semi_sync_slave_send_ack; - -#endif /* SEMISYNC_SLAVE_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/service_versions.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/service_versions.h deleted file mode 100644 index 66451ee..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/service_versions.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. - Copyright (c) 2012, 2019, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef _WIN32 -#define SERVICE_VERSION __declspec(dllexport) void * -#else -#define SERVICE_VERSION void * -#endif - -#define VERSION_debug_sync 0x1000 -#define VERSION_kill_statement 0x1000 - -#define VERSION_base64 0x0100 -#define VERSION_encryption 0x0300 -#define VERSION_encryption_scheme 0x0100 -#define VERSION_logger 0x0100 -#define VERSION_my_crypt 0x0100 -#define VERSION_my_md5 0x0100 -#define VERSION_my_print_error 0x0100 -#define VERSION_my_sha1 0x0101 -#define VERSION_my_sha2 0x0100 -#define VERSION_my_snprintf 0x0100 -#define VERSION_progress_report 0x0100 -#define VERSION_thd_alloc 0x0200 -#define VERSION_thd_autoinc 0x0100 -#define VERSION_thd_error_context 0x0200 -#define VERSION_thd_rnd 0x0100 -#define VERSION_thd_specifics 0x0100 -#define VERSION_thd_timezone 0x0100 -#define VERSION_thd_wait 0x0100 -#define VERSION_wsrep 0x0202 -#define VERSION_json 0x0100 -#define VERSION_thd_mdl 0x0100 diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/session_tracker.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/session_tracker.h deleted file mode 100644 index c78778a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/session_tracker.h +++ /dev/null @@ -1,498 +0,0 @@ -#ifndef SESSION_TRACKER_INCLUDED -#define SESSION_TRACKER_INCLUDED - -/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2016, 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include "m_string.h" -#include "thr_lock.h" -#include "sql_hset.h" - -#ifndef EMBEDDED_LIBRARY -/* forward declarations */ -class THD; -class set_var; -class String; -class user_var_entry; - - -enum enum_session_tracker -{ - SESSION_SYSVARS_TRACKER, /* Session system variables */ - CURRENT_SCHEMA_TRACKER, /* Current schema */ - SESSION_STATE_CHANGE_TRACKER, - TRANSACTION_INFO_TRACKER, /* Transaction state */ -#ifdef USER_VAR_TRACKING - USER_VARIABLES_TRACKER, -#endif // USER_VAR_TRACKING - SESSION_TRACKER_END /* must be the last */ -}; - -/** - State_tracker - - An abstract class that defines the interface for any of the server's - 'session state change tracker'. A tracker, however, is a sub- class of - this class which takes care of tracking the change in value of a part- - icular session state type and thus defines various methods listed in this - interface. The change information is later serialized and transmitted to - the client through protocol's OK packet. - - Tracker system variables :- - A tracker is normally mapped to a system variable. So in order to enable, - disable or modify the sub-entities of a tracker, the user needs to modify - the respective system variable either through SET command or via command - line option. As required in system variable handling, this interface also - includes two functions to help in the verification of the supplied value - (ON_UPDATE) of the tracker system variable, namely - update(). -*/ - -class State_tracker -{ -protected: - /** - Is tracking enabled for a particular session state type ? - - @note: it is a cache of the corresponding thd->variables.session_track_xxx - variable - */ - bool m_enabled; - - void set_changed(THD *thd); - -private: - /** Has the session state type changed ? */ - bool m_changed; - -public: - virtual ~State_tracker() {} - - /** Getters */ - bool is_enabled() const - { return m_enabled; } - - bool is_changed() const - { return m_changed; } - - void reset_changed() { m_changed= false; } - - /** - Called by THD::init() when new connection is being created - - We may inherit m_changed from previous connection served by this THD if - connection was broken or client didn't have session tracking capability. - Thus we have to reset it here. - */ - virtual bool enable(THD *thd) - { - reset_changed(); - return update(thd, 0); - } - - /** To be invoked when the tracker's system variable is updated (ON_UPDATE).*/ - virtual bool update(THD *thd, set_var *var)= 0; - - /** Store changed data into the given buffer. */ - virtual bool store(THD *thd, String *buf)= 0; - - /** Mark the entity as changed. */ - void mark_as_changed(THD *thd) { if (is_enabled()) set_changed(thd); } -}; - - -/** - Session_sysvars_tracker - - This is a tracker class that enables & manages the tracking of session - system variables. It internally maintains a hash of user supplied variable - references and a boolean field to store if the variable was changed by the - last statement. -*/ - -class Session_sysvars_tracker: public State_tracker -{ - struct sysvar_node_st { - sys_var *m_svar; - bool *test_load; - bool m_changed; - }; - - class vars_list - { - /** - Registered system variables. (@@session_track_system_variables) - A hash to store the name of all the system variables specified by the - user. - */ - HASH m_registered_sysvars; - /** - If TRUE then we want to check all session variable. - */ - bool track_all; - void init() - { - my_hash_init(PSI_INSTRUMENT_ME, &m_registered_sysvars, &my_charset_bin, - 0, 0, 0, (my_hash_get_key) sysvars_get_key, my_free, - HASH_UNIQUE | (mysqld_server_initialized ? HASH_THREAD_SPECIFIC : 0)); - } - void free_hash() - { - DBUG_ASSERT(my_hash_inited(&m_registered_sysvars)); - my_hash_free(&m_registered_sysvars); - } - - sysvar_node_st *search(const sys_var *svar) - { - return reinterpret_cast( - my_hash_search(&m_registered_sysvars, - reinterpret_cast(&svar), - sizeof(sys_var*))); - } - - sysvar_node_st *at(ulong i) - { - DBUG_ASSERT(i < m_registered_sysvars.records); - return reinterpret_cast( - my_hash_element(&m_registered_sysvars, i)); - } - public: - vars_list(): track_all(false) { init(); } - ~vars_list() { if (my_hash_inited(&m_registered_sysvars)) free_hash(); } - void deinit() { free_hash(); } - - sysvar_node_st *insert_or_search(const sys_var *svar) - { - sysvar_node_st *res= search(svar); - if (!res) - { - if (track_all) - { - insert(svar); - return search(svar); - } - } - return res; - } - - bool insert(const sys_var *svar); - void reinit(); - void reset(); - inline bool is_enabled() - { - return track_all || m_registered_sysvars.records; - } - void copy(vars_list* from, THD *thd); - bool parse_var_list(THD *thd, LEX_STRING var_list, bool throw_error, - CHARSET_INFO *char_set); - bool construct_var_list(char *buf, size_t buf_len); - bool store(THD *thd, String *buf); - }; - /** - Two objects of vars_list type are maintained to manage - various operations. - */ - vars_list orig_list; - bool m_parsed; - -public: - void init(THD *thd); - void deinit(THD *thd); - bool enable(THD *thd); - bool update(THD *thd, set_var *var); - bool store(THD *thd, String *buf); - void mark_as_changed(THD *thd, const sys_var *var); - void deinit() { orig_list.deinit(); } - /* callback */ - static uchar *sysvars_get_key(const char *entry, size_t *length, - my_bool not_used __attribute__((unused))); - - friend bool sysvartrack_global_update(THD *thd, char *str, size_t len); -}; - - -bool sysvartrack_validate_value(THD *thd, const char *str, size_t len); -bool sysvartrack_global_update(THD *thd, char *str, size_t len); - - -/** - Current_schema_tracker, - - This is a tracker class that enables & manages the tracking of current - schema for a particular connection. -*/ - -class Current_schema_tracker: public State_tracker -{ -public: - bool update(THD *thd, set_var *var); - bool store(THD *thd, String *buf); -}; - - -/* - Session_state_change_tracker - - This is a boolean tracker class that will monitor any change that contributes - to a session state change. - Attributes that contribute to session state change include: - - Successful change to System variables - - User defined variables assignments - - temporary tables created, altered or deleted - - prepared statements added or removed - - change in current database - - change of current role -*/ - -class Session_state_change_tracker: public State_tracker -{ -public: - bool update(THD *thd, set_var *var); - bool store(THD *thd, String *buf); -}; - - -/* - Transaction_state_tracker -*/ - -/** - Transaction state (no transaction, transaction active, work attached, etc.) -*/ -enum enum_tx_state { - TX_EMPTY = 0, ///< "none of the below" - TX_EXPLICIT = 1, ///< an explicit transaction is active - TX_IMPLICIT = 2, ///< an implicit transaction is active - TX_READ_TRX = 4, ///< transactional reads were done - TX_READ_UNSAFE = 8, ///< non-transaction reads were done - TX_WRITE_TRX = 16, ///< transactional writes were done - TX_WRITE_UNSAFE = 32, ///< non-transactional writes were done - TX_STMT_UNSAFE = 64, ///< "unsafe" (non-deterministic like UUID()) stmts - TX_RESULT_SET = 128, ///< result set was sent - TX_WITH_SNAPSHOT= 256, ///< WITH CONSISTENT SNAPSHOT was used - TX_LOCKED_TABLES= 512 ///< LOCK TABLES is active -}; - - -/** - Transaction access mode -*/ -enum enum_tx_read_flags { - TX_READ_INHERIT = 0, ///< not explicitly set, inherit session.tx_read_only - TX_READ_ONLY = 1, ///< START TRANSACTION READ ONLY, or tx_read_only=1 - TX_READ_WRITE = 2, ///< START TRANSACTION READ WRITE, or tx_read_only=0 -}; - - -/** - Transaction isolation level -*/ -enum enum_tx_isol_level { - TX_ISOL_INHERIT = 0, ///< not explicitly set, inherit session.tx_isolation - TX_ISOL_UNCOMMITTED = 1, - TX_ISOL_COMMITTED = 2, - TX_ISOL_REPEATABLE = 3, - TX_ISOL_SERIALIZABLE= 4 -}; - - -/** - Transaction tracking level -*/ -enum enum_session_track_transaction_info { - TX_TRACK_NONE = 0, ///< do not send tracker items on transaction info - TX_TRACK_STATE = 1, ///< track transaction status - TX_TRACK_CHISTICS = 2 ///< track status and characteristics -}; - - -/** - This is a tracker class that enables & manages the tracking of - current transaction info for a particular connection. -*/ - -class Transaction_state_tracker : public State_tracker -{ - /** Helper function: turn table info into table access flag */ - enum_tx_state calc_trx_state(THD *thd, thr_lock_type l, bool has_trx); -public: - - bool enable(THD *thd) - { - m_enabled= false; - tx_changed= TX_CHG_NONE; - tx_curr_state= TX_EMPTY; - tx_reported_state= TX_EMPTY; - tx_read_flags= TX_READ_INHERIT; - tx_isol_level= TX_ISOL_INHERIT; - return State_tracker::enable(thd); - } - - bool update(THD *thd, set_var *var); - bool store(THD *thd, String *buf); - - /** Change transaction characteristics */ - void set_read_flags(THD *thd, enum enum_tx_read_flags flags); - void set_isol_level(THD *thd, enum enum_tx_isol_level level); - - /** Change transaction state */ - void clear_trx_state(THD *thd, uint clear); - void add_trx_state(THD *thd, uint add); - void inline add_trx_state(THD *thd, thr_lock_type l, bool has_trx) - { - add_trx_state(thd, calc_trx_state(thd, l, has_trx)); - } - void add_trx_state_from_thd(THD *thd); - void end_trx(THD *thd); - - -private: - enum enum_tx_changed { - TX_CHG_NONE = 0, ///< no changes from previous stmt - TX_CHG_STATE = 1, ///< state has changed from previous stmt - TX_CHG_CHISTICS = 2 ///< characteristics have changed from previous stmt - }; - - /** any trackable changes caused by this statement? */ - uint tx_changed; - - /** transaction state */ - uint tx_curr_state, tx_reported_state; - - /** r/w or r/o set? session default? */ - enum enum_tx_read_flags tx_read_flags; - - /** isolation level */ - enum enum_tx_isol_level tx_isol_level; - - inline void update_change_flags(THD *thd) - { - tx_changed &= uint(~TX_CHG_STATE); - tx_changed |= (tx_curr_state != tx_reported_state) ? TX_CHG_STATE : 0; - if (tx_changed != TX_CHG_NONE) - set_changed(thd); - } -}; - -#define TRANSACT_TRACKER(X) \ - do { if (thd->variables.session_track_transaction_info > TX_TRACK_NONE) \ - thd->session_tracker.transaction_info.X; } while(0) - - -/** - User_variables_tracker - - This is a tracker class that enables & manages the tracking of user variables. -*/ - -#ifdef USER_VAR_TRACKING -class User_variables_tracker: public State_tracker -{ - Hash_set m_changed_user_variables; -public: - User_variables_tracker(): - m_changed_user_variables(PSI_INSTRUMENT_ME, &my_charset_bin, 0, 0, - sizeof(const user_var_entry*), 0, 0, HASH_UNIQUE | - mysqld_server_initialized ? HASH_THREAD_SPECIFIC : 0) {} - bool update(THD *thd, set_var *var); - bool store(THD *thd, String *buf); - void mark_as_changed(THD *thd, const user_var_entry *var) - { - if (is_enabled()) - { - m_changed_user_variables.insert(var); - set_changed(thd); - } - } - void deinit() { m_changed_user_variables.~Hash_set(); } -}; -#endif // USER_VAR_TRACKING - - -/** - Session_tracker - - This class holds an object each for all tracker classes and provides - methods necessary for systematic detection and generation of session - state change information. -*/ - -class Session_tracker -{ - State_tracker *m_trackers[SESSION_TRACKER_END]; - - /* The following two functions are private to disable copying. */ - Session_tracker(Session_tracker const &other) - { - DBUG_ASSERT(FALSE); - } - Session_tracker& operator= (Session_tracker const &rhs) - { - DBUG_ASSERT(FALSE); - return *this; - } - -public: - Current_schema_tracker current_schema; - Session_state_change_tracker state_change; - Transaction_state_tracker transaction_info; - Session_sysvars_tracker sysvars; -#ifdef USER_VAR_TRACKING - User_variables_tracker user_variables; -#endif // USER_VAR_TRACKING - - Session_tracker() - { - m_trackers[SESSION_SYSVARS_TRACKER]= &sysvars; - m_trackers[CURRENT_SCHEMA_TRACKER]= ¤t_schema; - m_trackers[SESSION_STATE_CHANGE_TRACKER]= &state_change; - m_trackers[TRANSACTION_INFO_TRACKER]= &transaction_info; -#ifdef USER_VAR_TRACKING - m_trackers[USER_VARIABLES_TRACKER]= &user_variables; -#endif // USER_VAR_TRACKING - } - - void enable(THD *thd) - { - for (int i= 0; i < SESSION_TRACKER_END; i++) - m_trackers[i]->enable(thd); - } - - void store(THD *thd, String *main_buf); -}; - - -int session_tracker_init(); -#else - -#define TRANSACT_TRACKER(X) do{}while(0) - -class Session_tracker -{ - class Dummy_tracker - { - public: - void mark_as_changed(THD *thd) {} - void mark_as_changed(THD *thd, const sys_var *var) {} - }; -public: - Dummy_tracker current_schema; - Dummy_tracker state_change; - Dummy_tracker sysvars; -}; - -#endif //EMBEDDED_LIBRARY - -#endif /* SESSION_TRACKER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/set_var.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/set_var.h deleted file mode 100644 index 18c4dbc..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/set_var.h +++ /dev/null @@ -1,477 +0,0 @@ -#ifndef SET_VAR_INCLUDED -#define SET_VAR_INCLUDED -/* Copyright (c) 2002, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - "public" interface to sys_var - server configuration variables. -*/ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include - -class sys_var; -class set_var; -class sys_var_pluginvar; -class PolyLock; -class Item_func_set_user_var; - -// This include needs to be here since item.h requires enum_var_type :-P -#include "item.h" /* Item */ -#include "sql_class.h" /* THD */ - -extern TYPELIB bool_typelib; - -struct sys_var_chain -{ - sys_var *first; - sys_var *last; -}; - -int mysql_add_sys_var_chain(sys_var *chain); -int mysql_del_sys_var_chain(sys_var *chain); - - -/** - A class representing one system variable - that is something - that can be accessed as @@global.variable_name or @@session.variable_name, - visible in SHOW xxx VARIABLES and in INFORMATION_SCHEMA.xxx_VARIABLES, - optionally it can be assigned to, optionally it can have a command-line - counterpart with the same name. -*/ -class sys_var: protected Value_source // for double_from_string_with_check -{ -public: - sys_var *next; - LEX_CSTRING name; - bool *test_load; - enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023, - READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096, - NO_SET_STATEMENT=8192, AUTO_SET=16384}; - enum { NO_GETOPT=-1, GETOPT_ONLY_HELP=-2 }; - enum where { CONFIG, COMMAND_LINE, AUTO, SQL, COMPILE_TIME, ENV }; - - /** - Enumeration type to indicate for a system variable whether - it will be written to the binlog or not. - */ - enum binlog_status_enum { VARIABLE_NOT_IN_BINLOG, - SESSION_VARIABLE_IN_BINLOG } binlog_status; - - my_option option; ///< min, max, default values are stored here - enum where value_origin; - const char *origin_filename; - -protected: - typedef bool (*on_check_function)(sys_var *self, THD *thd, set_var *var); - typedef bool (*on_update_function)(sys_var *self, THD *thd, enum_var_type type); - - int flags; ///< or'ed flag_enum values - const SHOW_TYPE show_val_type; ///< what value_ptr() returns for sql_show.cc - PolyLock *guard; ///< *second* lock that protects the variable - ptrdiff_t offset; ///< offset to the value from global_system_variables - on_check_function on_check; - on_update_function on_update; - const char *const deprecation_substitute; - -public: - sys_var(sys_var_chain *chain, const char *name_arg, const char *comment, - int flag_args, ptrdiff_t off, int getopt_id, - enum get_opt_arg_type getopt_arg_type, SHOW_TYPE show_val_type_arg, - longlong def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg, - on_check_function on_check_func, on_update_function on_update_func, - const char *substitute); - - virtual ~sys_var() {} - - /** - All the cleanup procedures should be performed here - */ - virtual void cleanup() {} - /** - downcast for sys_var_pluginvar. Returns this if it's an instance - of sys_var_pluginvar, and 0 otherwise. - */ - virtual sys_var_pluginvar *cast_pluginvar() { return 0; } - - bool check(THD *thd, set_var *var); - uchar *value_ptr(THD *thd, enum_var_type type, const LEX_CSTRING *base); - - /** - Update the system variable with the default value from either - session or global scope. The default value is stored in the - 'var' argument. Return false when successful. - */ - bool set_default(THD *thd, set_var *var); - bool update(THD *thd, set_var *var); - - String *val_str_nolock(String *str, THD *thd, const uchar *value); - longlong val_int(bool *is_null, THD *thd, enum_var_type type, const LEX_CSTRING *base); - String *val_str(String *str, THD *thd, enum_var_type type, const LEX_CSTRING *base); - double val_real(bool *is_null, THD *thd, enum_var_type type, const LEX_CSTRING *base); - - SHOW_TYPE show_type() { return show_val_type; } - int scope() const { return flags & SCOPE_MASK; } - virtual CHARSET_INFO *charset(THD *thd) const - { - return system_charset_info; - } - bool is_readonly() const { return flags & READONLY; } - /** - the following is only true for keycache variables, - that support the syntax @@keycache_name.variable_name - */ - bool is_struct() { return option.var_type & GET_ASK_ADDR; } - bool is_set_stmt_ok() const { return !(flags & NO_SET_STATEMENT); } - bool is_written_to_binlog(enum_var_type type) - { return type != OPT_GLOBAL && binlog_status == SESSION_VARIABLE_IN_BINLOG; } - bool check_update_type(const Item *item) - { - Item_result type= item->result_type(); - switch (option.var_type & GET_TYPE_MASK) { - case GET_INT: - case GET_UINT: - case GET_LONG: - case GET_ULONG: - case GET_LL: - case GET_ULL: - return type != INT_RESULT && - (type != DECIMAL_RESULT || item->decimals != 0); - case GET_STR: - case GET_STR_ALLOC: - return type != STRING_RESULT; - case GET_ENUM: - case GET_BOOL: - case GET_SET: - case GET_FLAGSET: - case GET_BIT: - return type != STRING_RESULT && type != INT_RESULT; - case GET_DOUBLE: - return type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT; - default: - return true; - } - } - - bool check_type(enum_var_type type) - { - switch (scope()) - { - case GLOBAL: return type != OPT_GLOBAL; - case SESSION: return false; // always ok - case ONLY_SESSION: return type == OPT_GLOBAL; - } - return true; // keep gcc happy - } - bool register_option(DYNAMIC_ARRAY *array, int parse_flags) - { - DBUG_ASSERT(parse_flags == GETOPT_ONLY_HELP || - parse_flags == PARSE_EARLY || parse_flags == 0); - if (option.id == NO_GETOPT) - return 0; - if (parse_flags == GETOPT_ONLY_HELP) - { - if (option.id != GETOPT_ONLY_HELP) - return 0; - } - else - { - if (option.id == GETOPT_ONLY_HELP) - return 0; - if ((flags & PARSE_EARLY) != parse_flags) - return 0; - } - return insert_dynamic(array, (uchar*)&option); - } - void do_deprecated_warning(THD *thd); - /** - whether session value of a sysvar is a default one. - - in this simple implementation we don't distinguish between default - and non-default values. for most variables it's ok, they don't treat - default values specially. this method is overwritten in descendant - classes as necessary. - */ - virtual bool session_is_default(THD *thd) { return false; } - - virtual uchar *default_value_ptr(THD *thd) - { return (uchar*)&option.def_value; } - - virtual bool on_check_access_global(THD *thd) const; - virtual bool on_check_access_session(THD *thd) const - { - return false; - } - -private: - virtual bool do_check(THD *thd, set_var *var) = 0; - /** - save the session default value of the variable in var - */ - virtual void session_save_default(THD *thd, set_var *var) = 0; - /** - save the global default value of the variable in var - */ - virtual void global_save_default(THD *thd, set_var *var) = 0; - virtual bool session_update(THD *thd, set_var *var) = 0; - virtual bool global_update(THD *thd, set_var *var) = 0; - -protected: - /** - A pointer to a value of the variable for SHOW. - It must be of show_val_type type (my_bool for SHOW_MY_BOOL, - int for SHOW_INT, longlong for SHOW_LONGLONG, etc). - */ - virtual uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base); - virtual uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base); - - /** - A pointer to a storage area of the variable, to the raw data. - Typically it's the same as session_value_ptr(), but it's different, - for example, for ENUM, that is printed as a string, but stored as a number. - */ - uchar *session_var_ptr(THD *thd) - { return ((uchar*)&(thd->variables)) + offset; } - - uchar *global_var_ptr() - { return ((uchar*)&global_system_variables) + offset; } - - void *max_var_ptr() - { - return scope() == SESSION ? (((uchar*)&max_system_variables) + offset) : - 0; - } - - friend class Session_sysvars_tracker; - friend class Session_tracker; -}; - -#include "sql_plugin.h" /* SHOW_HA_ROWS, SHOW_MY_BOOL */ - - -/**************************************************************************** - Classes for parsing of the SET command -****************************************************************************/ - -/** - A base class for everything that can be set with SET command. - It's similar to Items, an instance of this is created by the parser - for every assigmnent in SET (or elsewhere, e.g. in SELECT). -*/ -class set_var_base :public Sql_alloc -{ -public: - set_var_base() {} - virtual ~set_var_base() {} - virtual int check(THD *thd)=0; /* To check privileges etc. */ - virtual int update(THD *thd)=0; /* To set the value */ - virtual int light_check(THD *thd) { return check(thd); } /* for PS */ - virtual bool is_system() { return FALSE; } - /** - @returns whether this variable is @@@@optimizer_trace. - */ - virtual bool is_var_optimizer_trace() const { return false; } -}; - - -/** - set_var_base descendant for assignments to the system variables. -*/ -class set_var :public set_var_base -{ -public: - sys_var *var; ///< system variable to be updated - Item *value; ///< the expression that provides the new value of the variable - enum_var_type type; - union ///< temp storage to hold a value between sys_var::check and ::update - { - ulonglong ulonglong_value; ///< for unsigned integer, set, enum sysvars - longlong longlong_value; ///< for signed integer - double double_value; ///< for Sys_var_double - plugin_ref plugin; ///< for Sys_var_plugin - plugin_ref *plugins; ///< for Sys_var_pluginlist - Time_zone *time_zone; ///< for Sys_var_tz - LEX_STRING string_value; ///< for Sys_var_charptr and others - const void *ptr; ///< for Sys_var_struct - } save_result; - LEX_CSTRING base; /**< for structured variables, like keycache_name.variable_name */ - - set_var(THD *thd, enum_var_type type_arg, sys_var *var_arg, - const LEX_CSTRING *base_name_arg, Item *value_arg); - virtual bool is_system() { return 1; } - int check(THD *thd); - int update(THD *thd); - int light_check(THD *thd); - virtual bool is_var_optimizer_trace() const - { - extern sys_var *Sys_optimizer_trace_ptr; - return var == Sys_optimizer_trace_ptr; - } -}; - - -/* User variables like @my_own_variable */ -class set_var_user: public set_var_base -{ - Item_func_set_user_var *user_var_item; -public: - set_var_user(Item_func_set_user_var *item) - :user_var_item(item) - {} - int check(THD *thd); - int update(THD *thd); - int light_check(THD *thd); -}; - -/* For SET PASSWORD */ - -class set_var_password: public set_var_base -{ - LEX_USER *user; -public: - set_var_password(LEX_USER *user_arg) :user(user_arg) - {} - int check(THD *thd); - int update(THD *thd); -}; - -/* For SET ROLE */ - -class set_var_role: public set_var_base -{ - LEX_CSTRING role; - privilege_t access; -public: - set_var_role(LEX_CSTRING role_arg) : role(role_arg), access(NO_ACL) {} - int check(THD *thd); - int update(THD *thd); -}; - -/* For SET DEFAULT ROLE */ - -class set_var_default_role: public set_var_base -{ - LEX_USER *user, *real_user; - LEX_CSTRING role; - const char *real_role; -public: - set_var_default_role(LEX_USER *user_arg, LEX_CSTRING role_arg) : - user(user_arg), role(role_arg) {} - int check(THD *thd); - int update(THD *thd); -}; - -/* For SET NAMES and SET CHARACTER SET */ - -class set_var_collation_client: public set_var_base -{ - CHARSET_INFO *character_set_client; - CHARSET_INFO *character_set_results; - CHARSET_INFO *collation_connection; -public: - set_var_collation_client(CHARSET_INFO *client_coll_arg, - CHARSET_INFO *connection_coll_arg, - CHARSET_INFO *result_coll_arg) - :character_set_client(client_coll_arg), - character_set_results(result_coll_arg), - collation_connection(connection_coll_arg) - {} - int check(THD *thd); - int update(THD *thd); -}; - - -/* optional things, have_* variables */ -extern SHOW_COMP_OPTION have_csv, have_innodb; -extern SHOW_COMP_OPTION have_ndbcluster, have_partitioning; -extern SHOW_COMP_OPTION have_profiling; - -extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen; -extern SHOW_COMP_OPTION have_query_cache; -extern SHOW_COMP_OPTION have_geometry, have_rtree_keys; -extern SHOW_COMP_OPTION have_crypt; -extern SHOW_COMP_OPTION have_compress; -extern SHOW_COMP_OPTION have_openssl; - -/* - Prototypes for helper functions -*/ -ulong get_system_variable_hash_records(void); -ulonglong get_system_variable_hash_version(void); - -SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted, enum enum_var_type type); -int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond); - -sys_var *find_sys_var(THD *thd, const char *str, size_t length= 0, - bool throw_error= false); -int sql_set_variables(THD *thd, List *var_list, bool free); - -#define SYSVAR_AUTOSIZE(VAR,VAL) \ - do { \ - VAR= (VAL); \ - set_sys_var_value_origin(&VAR, sys_var::AUTO); \ - } while(0) - -#define SYSVAR_AUTOSIZE_IF_CHANGED(VAR,VAL,TYPE) \ - do { \ - TYPE tmp= (VAL); \ - if (VAR != tmp) \ - { \ - VAR= (VAL); \ - set_sys_var_value_origin(&VAR, sys_var::AUTO); \ - } \ - } while(0) - -void set_sys_var_value_origin(void *ptr, enum sys_var::where here); - -enum sys_var::where get_sys_var_value_origin(void *ptr); -inline bool IS_SYSVAR_AUTOSIZE(void *ptr) -{ - enum sys_var::where res= get_sys_var_value_origin(ptr); - return (res == sys_var::AUTO || res == sys_var::COMPILE_TIME); -} - -bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type); - -sql_mode_t expand_sql_mode(sql_mode_t sql_mode); -const char *sql_mode_string_representation(uint bit_number); -bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode, - LEX_CSTRING *ls); -int default_regex_flags_pcre(THD *thd); - -extern sys_var *Sys_autocommit_ptr, *Sys_last_gtid_ptr, - *Sys_character_set_client_ptr, *Sys_character_set_connection_ptr, - *Sys_character_set_results_ptr; - -CHARSET_INFO *get_old_charset_by_name(const char *old_name); - -int sys_var_init(); -uint sys_var_elements(); -int sys_var_add_options(DYNAMIC_ARRAY *long_options, int parse_flags); -void sys_var_end(void); -bool check_has_super(sys_var *self, THD *thd, set_var *var); -plugin_ref *resolve_engine_list(THD *thd, const char *str_arg, size_t str_arg_len, - bool error_on_unknown_engine, bool temp_copy); -void free_engine_list(plugin_ref *list); -plugin_ref *copy_engine_list(plugin_ref *list); -plugin_ref *temp_copy_engine_list(THD *thd, plugin_ref *list); -char *pretty_print_engine_list(THD *thd, plugin_ref *list); - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/slave.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/slave.h deleted file mode 100644 index 5ca6054..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/slave.h +++ /dev/null @@ -1,308 +0,0 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2016, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SLAVE_H -#define SLAVE_H - -/** - MASTER_DELAY can be at most (1 << 31) - 1. -*/ -#define MASTER_DELAY_MAX (0x7FFFFFFF) -#if INT_MAX < 0x7FFFFFFF -#error "don't support platforms where INT_MAX < 0x7FFFFFFF" -#endif - -/** - @defgroup Replication Replication - @{ - - @file -*/ - -/** - Some of defines are need in parser even though replication is not - compiled in (embedded). -*/ - -/** - The maximum is defined as (ULONG_MAX/1000) with 4 bytes ulong -*/ -#define SLAVE_MAX_HEARTBEAT_PERIOD 4294967 - -#ifdef HAVE_REPLICATION - -#include "log.h" -#include "my_list.h" -#include "rpl_filter.h" -#include "rpl_tblmap.h" -#include "rpl_gtid.h" - -#define SLAVE_NET_TIMEOUT 60 - -#define MAX_SLAVE_ERROR ER_ERROR_LAST+1 - -#define MAX_REPLICATION_THREAD 64 - -// Forward declarations -class Relay_log_info; -class Master_info; -class Master_info_index; -struct rpl_group_info; -struct rpl_parallel_thread; - -int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); -int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, - const char *default_val); -int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val); -int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f); - -/***************************************************************************** - - MySQL Replication - - Replication is implemented via two types of threads: - - I/O Thread - One of these threads is started for each master server. - They maintain a connection to their master server, read log - events from the master as they arrive, and queues them into - a single, shared relay log file. A Master_info - represents each of these threads. - - SQL Thread - One of these threads is started and reads from the relay log - file, executing each event. A Relay_log_info - represents this thread. - - Buffering in the relay log file makes it unnecessary to reread events from - a master server across a slave restart. It also decouples the slave from - the master where long-running updates and event logging are concerned--ie - it can continue to log new events while a slow query executes on the slave. - -*****************************************************************************/ - -/* - MUTEXES in replication: - - LOCK_active_mi: [note: this was originally meant for multimaster, to switch - from a master to another, to protect active_mi] It is used to SERIALIZE ALL - administrative commands of replication: START SLAVE, STOP SLAVE, CHANGE - MASTER, RESET SLAVE, end_slave() (when mysqld stops) [init_slave() does not - need it it's called early]. Any of these commands holds the mutex from the - start till the end. This thus protects us against a handful of deadlocks - (consider start_slave_thread() which, when starting the I/O thread, releases - mi->run_lock, keeps rli->run_lock, and tries to re-acquire mi->run_lock). - - Currently active_mi never moves (it's created at startup and deleted at - shutdown, and not changed: it always points to the same Master_info struct), - because we don't have multimaster. So for the moment, mi does not move, and - mi->rli does not either. - - In Master_info: run_lock, data_lock - run_lock protects all information about the run state: slave_running, thd - and the existence of the I/O thread (to stop/start it, you need this mutex). - data_lock protects some moving members of the struct: counters (log name, - position) and relay log (MYSQL_BIN_LOG object). - - In Relay_log_info: run_lock, data_lock - see Master_info - However, note that run_lock does not protect - Relay_log_info.run_state; that is protected by data_lock. - - Order of acquisition: if you want to have LOCK_active_mi and a run_lock, you - must acquire LOCK_active_mi first. - - In MYSQL_BIN_LOG: LOCK_log, LOCK_index of the binlog and the relay log - LOCK_log: when you write to it. LOCK_index: when you create/delete a binlog - (so that you have to update the .index file). -*/ - -extern ulong master_retry_count; -extern MY_BITMAP slave_error_mask; -extern char slave_skip_error_names[]; -extern bool use_slave_mask; -extern char slave_transaction_retry_error_names[]; -extern uint *slave_transaction_retry_errors; -extern uint slave_transaction_retry_error_length; -extern char *slave_load_tmpdir; -extern char *master_info_file; -extern MYSQL_PLUGIN_IMPORT char *relay_log_info_file; -extern char *opt_relay_logname, *opt_relaylog_index_name; -extern my_bool opt_skip_slave_start, opt_reckless_slave; -extern my_bool opt_log_slave_updates; -extern char *opt_slave_skip_errors; -extern char *opt_slave_transaction_retry_errors; -extern my_bool opt_replicate_annotate_row_events; -extern ulonglong relay_log_space_limit; -extern ulonglong opt_read_binlog_speed_limit; -extern ulonglong slave_skipped_errors; -extern const char *relay_log_index; -extern const char *relay_log_basename; - -/* - 4 possible values for Master_info::slave_running and - Relay_log_info::slave_running. - The values 0,1,2,3 are very important: to keep the diff small, I didn't - substitute places where we use 0/1 with the newly defined symbols. - So don't change these values. - The same way, code is assuming that in Relay_log_info we use only values - 0/1. - I started with using an enum, but - enum_variable=1; is not legal so would have required many line changes. -*/ -#define MYSQL_SLAVE_NOT_RUN 0 -#define MYSQL_SLAVE_RUN_NOT_CONNECT 1 -#define MYSQL_SLAVE_RUN_CONNECT 2 -#define MYSQL_SLAVE_RUN_READING 3 - -#define RPL_LOG_NAME (rli->group_master_log_name[0] ? rli->group_master_log_name :\ - "FIRST") -#define IO_RPL_LOG_NAME (mi->master_log_name[0] ? mi->master_log_name :\ - "FIRST") - -/* - If the following is set, if first gives an error, second will be - tried. Otherwise, if first fails, we fail. -*/ -#define SLAVE_FORCE_ALL 4 - -/* - Values for the option --replicate-events-marked-for-skip. - Must match the names in replicate_events_marked_for_skip_names in sys_vars.cc -*/ -#define RPL_SKIP_REPLICATE 0 -#define RPL_SKIP_FILTER_ON_SLAVE 1 -#define RPL_SKIP_FILTER_ON_MASTER 2 - - -int init_slave(); -int init_recovery(Master_info* mi, const char** errmsg); -bool init_slave_skip_errors(const char* arg); -bool init_slave_transaction_retry_errors(const char* arg); -int register_slave_on_master(MYSQL* mysql); -int terminate_slave_threads(Master_info* mi, int thread_mask, - bool skip_lock = 0); -int start_slave_threads(THD *thd, - bool need_slave_mutex, bool wait_for_start, - Master_info* mi, const char* master_info_fname, - const char* slave_info_fname, int thread_mask); -/* - cond_lock is usually same as start_lock. It is needed for the case when - start_lock is 0 which happens if start_slave_thread() is called already - inside the start_lock section, but at the same time we want a - mysql_cond_wait() on start_cond, start_lock -*/ -int start_slave_thread( -#ifdef HAVE_PSI_INTERFACE - PSI_thread_key thread_key, -#endif - pthread_handler h_func, - mysql_mutex_t *start_lock, - mysql_mutex_t *cond_lock, - mysql_cond_t *start_cond, - volatile uint *slave_running, - volatile ulong *slave_run_id, - Master_info *mi); - -/* If fd is -1, dump to NET */ -int mysql_table_dump(THD* thd, const char* db, - const char* tbl_name, int fd = -1); - -/* retrieve table from master and copy to slave*/ -int fetch_master_table(THD* thd, const char* db_name, const char* table_name, - Master_info* mi, MYSQL* mysql, bool overwrite); - -void show_master_info_get_fields(THD *thd, List *field_list, - bool full, size_t gtid_pos_length); -bool show_master_info(THD* thd, Master_info* mi, bool full); -bool show_all_master_info(THD* thd); -void show_binlog_info_get_fields(THD *thd, List *field_list); -bool show_binlog_info(THD* thd); -bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report, - bool (*pred)(const void *), const void *param); -bool rpl_master_erroneous_autoinc(THD* thd); - -const char *print_slave_db_safe(const char *db); -void skip_load_data_infile(NET* net); - -void slave_prepare_for_shutdown(); -void end_slave(); /* release slave threads */ -void close_active_mi(); /* clean up slave threads data */ -void clear_until_condition(Relay_log_info* rli); -void clear_slave_error(Relay_log_info* rli); -void end_relay_log_info(Relay_log_info* rli); -void init_thread_mask(int* mask,Master_info* mi,bool inverse); -Format_description_log_event * -read_relay_log_description_event(IO_CACHE *cur_log, ulonglong start_pos, - const char **errmsg); - -int init_relay_log_pos(Relay_log_info* rli,const char* log,ulonglong pos, - bool need_data_lock, const char** errmsg, - bool look_for_description_event); - -int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset, - const char** errmsg); -void set_slave_thread_options(THD* thd); -void set_slave_thread_default_charset(THD *thd, rpl_group_info *rgi); -int rotate_relay_log(Master_info* mi); -int has_temporary_error(THD *thd); -int sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi); -int apply_event_and_update_pos(Log_event* ev, THD* thd, - struct rpl_group_info *rgi); -int apply_event_and_update_pos_for_parallel(Log_event* ev, THD* thd, - struct rpl_group_info *rgi); - -int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); -int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val); -int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, - const char *default_val); -int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f); - -pthread_handler_t handle_slave_io(void *arg); -void slave_output_error_info(rpl_group_info *rgi, THD *thd); -pthread_handler_t handle_slave_sql(void *arg); -bool net_request_file(NET* net, const char* fname); -void slave_background_kill_request(THD *to_kill); -void slave_background_gtid_pos_create_request - (rpl_slave_state::gtid_pos_table *table_entry); -void slave_background_gtid_pending_delete_request(void); - -extern Master_info *active_mi; /* active_mi for multi-master */ -extern Master_info *default_master_info; /* To replace active_mi */ -extern Master_info_index *master_info_index; -extern LEX_CSTRING default_master_connection_name; -extern my_bool replicate_same_server_id; - -extern int disconnect_slave_event_count, abort_slave_event_count ; - -/* the master variables are defaults read from my.cnf or command line */ -extern uint report_port; -extern char *master_info_file, *report_user; -extern char *report_host, *report_password; - -extern I_List threads; - -#else -#define close_active_mi() /* no-op */ -#endif /* HAVE_REPLICATION */ - -/* masks for start/stop operations on io and sql slave threads */ -#define SLAVE_IO 1 -#define SLAVE_SQL 2 - -/** - @} (end of group Replication) -*/ - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/source_revision.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/source_revision.h deleted file mode 100644 index 15a5b26..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/source_revision.h +++ /dev/null @@ -1 +0,0 @@ -#define SOURCE_REVISION "90f43d260e407c650aa8a7885d674c717618cc37" diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp.h deleted file mode 100644 index e92525e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp.h +++ /dev/null @@ -1,674 +0,0 @@ -/* -*- C++ -*- */ -/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _SP_H_ -#define _SP_H_ - -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ -#include "sql_string.h" // LEX_STRING -#include "sql_cmd.h" -#include "mdl.h" - -class Field; -class Open_tables_backup; -class Open_tables_state; -class Query_arena; -class Query_tables_list; -class Sroutine_hash_entry; -class THD; -class sp_cache; -class sp_head; -class sp_package; -class sp_pcontext; -class sp_name; -class Database_qualified_name; -struct st_sp_chistics; -class Stored_program_creation_ctx; -struct LEX; -struct TABLE; -struct TABLE_LIST; -typedef struct st_hash HASH; -template class SQL_I_List; - -/* - Values for the type enum. This reflects the order of the enum declaration - in the CREATE TABLE command. - See also storage/perfschema/my_thread.h -*/ -enum enum_sp_type -{ - SP_TYPE_FUNCTION=1, - SP_TYPE_PROCEDURE=2, - SP_TYPE_PACKAGE=3, - SP_TYPE_PACKAGE_BODY=4, - SP_TYPE_TRIGGER=5, - SP_TYPE_EVENT=6, -}; - -class Sp_handler -{ - bool sp_resolve_package_routine_explicit(THD *thd, - sp_head *caller, - sp_name *name, - const Sp_handler **pkg_routine_hndlr, - Database_qualified_name *pkgname) - const; - bool sp_resolve_package_routine_implicit(THD *thd, - sp_head *caller, - sp_name *name, - const Sp_handler **pkg_routine_hndlr, - Database_qualified_name *pkgname) - const; -protected: - int db_find_routine_aux(THD *thd, const Database_qualified_name *name, - TABLE *table) const; - int db_find_routine(THD *thd, const Database_qualified_name *name, - sp_head **sphp) const; - int db_find_and_cache_routine(THD *thd, - const Database_qualified_name *name, - sp_head **sp) const; - int db_load_routine(THD *thd, const Database_qualified_name *name, - sp_head **sphp, - sql_mode_t sql_mode, - const LEX_CSTRING ¶ms, - const LEX_CSTRING &returns, - const LEX_CSTRING &body, - const st_sp_chistics &chistics, - const AUTHID &definer, - longlong created, longlong modified, - sp_package *parent, - Stored_program_creation_ctx *creation_ctx) const; - int sp_drop_routine_internal(THD *thd, - const Database_qualified_name *name, - TABLE *table) const; - - sp_head *sp_clone_and_link_routine(THD *thd, - const Database_qualified_name *name, - sp_head *sp) const; - int sp_cache_package_routine(THD *thd, - const LEX_CSTRING &pkgname_cstr, - const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const; - int sp_cache_package_routine(THD *thd, - const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const; - sp_head *sp_find_package_routine(THD *thd, - const LEX_CSTRING pkgname_str, - const Database_qualified_name *name, - bool cache_only) const; - sp_head *sp_find_package_routine(THD *thd, - const Database_qualified_name *name, - bool cache_only) const; -public: // TODO: make it private or protected - virtual int sp_find_and_drop_routine(THD *thd, TABLE *table, - const Database_qualified_name *name) - const; - -public: - virtual ~Sp_handler() {} - static const Sp_handler *handler(enum enum_sql_command cmd); - static const Sp_handler *handler(enum_sp_type type); - static const Sp_handler *handler(MDL_key::enum_mdl_namespace ns); - /* - Return a handler only those SP objects that store - definitions in the mysql.proc system table - */ - static const Sp_handler *handler_mysql_proc(enum_sp_type type) - { - const Sp_handler *sph= handler(type); - return sph ? sph->sp_handler_mysql_proc() : NULL; - } - - static bool eq_routine_name(const LEX_CSTRING &name1, - const LEX_CSTRING &name2) - { - return system_charset_info->strnncoll(name1.str, name1.length, - name2.str, name2.length) == 0; - } - const char *type_str() const { return type_lex_cstring().str; } - virtual const char *show_create_routine_col1_caption() const - { - DBUG_ASSERT(0); - return ""; - } - virtual const char *show_create_routine_col3_caption() const - { - DBUG_ASSERT(0); - return ""; - } - virtual const Sp_handler *package_routine_handler() const - { - return this; - } - virtual enum_sp_type type() const= 0; - virtual LEX_CSTRING type_lex_cstring() const= 0; - virtual LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const - { - static LEX_CSTRING m_empty_body= {STRING_WITH_LEN("???")}; - DBUG_ASSERT(0); - return m_empty_body; - } - virtual MDL_key::enum_mdl_namespace get_mdl_type() const= 0; - virtual const Sp_handler *sp_handler_mysql_proc() const { return this; } - virtual sp_cache **get_cache(THD *) const { return NULL; } -#ifndef NO_EMBEDDED_ACCESS_CHECKS - virtual HASH *get_priv_hash() const { return NULL; } -#endif - virtual ulong recursion_depth(THD *thd) const { return 0; } - /** - Return appropriate error about recursion limit reaching - - @param thd Thread handle - @param sp SP routine - - @remark For functions and triggers we return error about - prohibited recursion. For stored procedures we - return about reaching recursion limit. - */ - virtual void recursion_level_error(THD *thd, const sp_head *sp) const - { - my_error(ER_SP_NO_RECURSION, MYF(0)); - } - virtual bool add_instr_freturn(THD *thd, sp_head *sp, - sp_pcontext *spcont, - Item *item, LEX *lex) const; - virtual bool add_instr_preturn(THD *thd, sp_head *sp, - sp_pcontext *spcont) const; - - void add_used_routine(Query_tables_list *prelocking_ctx, - Query_arena *arena, - const Database_qualified_name *name) const; - - bool sp_resolve_package_routine(THD *thd, - sp_head *caller, - sp_name *name, - const Sp_handler **pkg_routine_handler, - Database_qualified_name *pkgname) const; - virtual sp_head *sp_find_routine(THD *thd, - const Database_qualified_name *name, - bool cache_only) const; - virtual int sp_cache_routine(THD *thd, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const; - - int sp_cache_routine_reentrant(THD *thd, - const Database_qualified_name *nm, - sp_head **sp) const; - - bool sp_exist_routines(THD *thd, TABLE_LIST *procs) const; - bool sp_show_create_routine(THD *thd, - const Database_qualified_name *name) const; - - bool sp_create_routine(THD *thd, const sp_head *sp) const; - - int sp_update_routine(THD *thd, const Database_qualified_name *name, - const st_sp_chistics *chistics) const; - - int sp_drop_routine(THD *thd, const Database_qualified_name *name) const; - - sp_head *sp_load_for_information_schema(THD *thd, TABLE *proc_table, - const LEX_CSTRING &db, - const LEX_CSTRING &name, - const LEX_CSTRING ¶ms, - const LEX_CSTRING &returns, - sql_mode_t sql_mode, - bool *free_sp_head) const; - - /* - Make a SHOW CREATE statement. - @retval true on error - @retval false on success - */ - virtual bool show_create_sp(THD *thd, String *buf, - const LEX_CSTRING &db, - const LEX_CSTRING &name, - const LEX_CSTRING ¶ms, - const LEX_CSTRING &returns, - const LEX_CSTRING &body, - const st_sp_chistics &chistics, - const AUTHID &definer, - const DDL_options_st ddl_options, - sql_mode_t sql_mode) const; - -}; - - -class Sp_handler_procedure: public Sp_handler -{ -public: - enum_sp_type type() const { return SP_TYPE_PROCEDURE; } - LEX_CSTRING type_lex_cstring() const - { - static LEX_CSTRING m_type_str= { STRING_WITH_LEN("PROCEDURE")}; - return m_type_str; - } - LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const; - const char *show_create_routine_col1_caption() const - { - return "Procedure"; - } - const char *show_create_routine_col3_caption() const - { - return "Create Procedure"; - } - MDL_key::enum_mdl_namespace get_mdl_type() const - { - return MDL_key::PROCEDURE; - } - const Sp_handler *package_routine_handler() const; - sp_cache **get_cache(THD *) const; -#ifndef NO_EMBEDDED_ACCESS_CHECKS - HASH *get_priv_hash() const; -#endif - ulong recursion_depth(THD *thd) const; - void recursion_level_error(THD *thd, const sp_head *sp) const; - bool add_instr_preturn(THD *thd, sp_head *sp, sp_pcontext *spcont) const; -}; - - -class Sp_handler_package_procedure: public Sp_handler_procedure -{ -public: - int sp_cache_routine(THD *thd, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const - { - return sp_cache_package_routine(thd, name, lookup_only, sp); - } - sp_head *sp_find_routine(THD *thd, - const Database_qualified_name *name, - bool cache_only) const - { - return sp_find_package_routine(thd, name, cache_only); - } -}; - - -class Sp_handler_function: public Sp_handler -{ -public: - enum_sp_type type() const { return SP_TYPE_FUNCTION; } - LEX_CSTRING type_lex_cstring() const - { - static LEX_CSTRING m_type_str= { STRING_WITH_LEN("FUNCTION")}; - return m_type_str; - } - LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const; - const char *show_create_routine_col1_caption() const - { - return "Function"; - } - const char *show_create_routine_col3_caption() const - { - return "Create Function"; - } - MDL_key::enum_mdl_namespace get_mdl_type() const - { - return MDL_key::FUNCTION; - } - const Sp_handler *package_routine_handler() const; - sp_cache **get_cache(THD *) const; -#ifndef NO_EMBEDDED_ACCESS_CHECKS - HASH *get_priv_hash() const; -#endif - bool add_instr_freturn(THD *thd, sp_head *sp, sp_pcontext *spcont, - Item *item, LEX *lex) const; -}; - - -class Sp_handler_package_function: public Sp_handler_function -{ -public: - int sp_cache_routine(THD *thd, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const - { - return sp_cache_package_routine(thd, name, lookup_only, sp); - } - sp_head *sp_find_routine(THD *thd, - const Database_qualified_name *name, - bool cache_only) const - { - return sp_find_package_routine(thd, name, cache_only); - } -}; - - -class Sp_handler_package: public Sp_handler -{ -public: - bool show_create_sp(THD *thd, String *buf, - const LEX_CSTRING &db, - const LEX_CSTRING &name, - const LEX_CSTRING ¶ms, - const LEX_CSTRING &returns, - const LEX_CSTRING &body, - const st_sp_chistics &chistics, - const AUTHID &definer, - const DDL_options_st ddl_options, - sql_mode_t sql_mode) const; -}; - - -class Sp_handler_package_spec: public Sp_handler_package -{ -public: // TODO: make it private or protected - int sp_find_and_drop_routine(THD *thd, TABLE *table, - const Database_qualified_name *name) - const; -public: - enum_sp_type type() const { return SP_TYPE_PACKAGE; } - LEX_CSTRING type_lex_cstring() const - { - static LEX_CSTRING m_type_str= {STRING_WITH_LEN("PACKAGE")}; - return m_type_str; - } - LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const - { - static LEX_CSTRING m_empty_body= {STRING_WITH_LEN("BEGIN END")}; - return m_empty_body; - } - const char *show_create_routine_col1_caption() const - { - return "Package"; - } - const char *show_create_routine_col3_caption() const - { - return "Create Package"; - } - MDL_key::enum_mdl_namespace get_mdl_type() const - { - return MDL_key::PACKAGE_BODY; - } - sp_cache **get_cache(THD *) const; -#ifndef NO_EMBEDDED_ACCESS_CHECKS - HASH *get_priv_hash() const; -#endif -}; - - -class Sp_handler_package_body: public Sp_handler_package -{ -public: - enum_sp_type type() const { return SP_TYPE_PACKAGE_BODY; } - LEX_CSTRING type_lex_cstring() const - { - static LEX_CSTRING m_type_str= {STRING_WITH_LEN("PACKAGE BODY")}; - return m_type_str; - } - LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const - { - static LEX_CSTRING m_empty_body= {STRING_WITH_LEN("BEGIN END")}; - return m_empty_body; - } - const char *show_create_routine_col1_caption() const - { - return "Package body"; - } - const char *show_create_routine_col3_caption() const - { - return "Create Package Body"; - } - MDL_key::enum_mdl_namespace get_mdl_type() const - { - return MDL_key::PACKAGE_BODY; - } - sp_cache **get_cache(THD *) const; -#ifndef NO_EMBEDDED_ACCESS_CHECKS - HASH *get_priv_hash() const; -#endif -}; - - -class Sp_handler_trigger: public Sp_handler -{ -public: - enum_sp_type type() const { return SP_TYPE_TRIGGER; } - LEX_CSTRING type_lex_cstring() const - { - static LEX_CSTRING m_type_str= { STRING_WITH_LEN("TRIGGER")}; - return m_type_str; - } - MDL_key::enum_mdl_namespace get_mdl_type() const - { - DBUG_ASSERT(0); - return MDL_key::TRIGGER; - } - const Sp_handler *sp_handler_mysql_proc() const { return NULL; } -}; - - -extern MYSQL_PLUGIN_IMPORT Sp_handler_function sp_handler_function; -extern MYSQL_PLUGIN_IMPORT Sp_handler_procedure sp_handler_procedure; -extern MYSQL_PLUGIN_IMPORT Sp_handler_package_spec sp_handler_package_spec; -extern MYSQL_PLUGIN_IMPORT Sp_handler_package_body sp_handler_package_body; -extern MYSQL_PLUGIN_IMPORT Sp_handler_package_function sp_handler_package_function; -extern MYSQL_PLUGIN_IMPORT Sp_handler_package_procedure sp_handler_package_procedure; -extern MYSQL_PLUGIN_IMPORT Sp_handler_trigger sp_handler_trigger; - - -inline const Sp_handler *Sp_handler::handler(enum_sql_command cmd) -{ - switch (cmd) { - case SQLCOM_CREATE_PROCEDURE: - case SQLCOM_ALTER_PROCEDURE: - case SQLCOM_DROP_PROCEDURE: - case SQLCOM_SHOW_PROC_CODE: - case SQLCOM_SHOW_CREATE_PROC: - case SQLCOM_SHOW_STATUS_PROC: - return &sp_handler_procedure; - case SQLCOM_CREATE_SPFUNCTION: - case SQLCOM_ALTER_FUNCTION: - case SQLCOM_DROP_FUNCTION: - case SQLCOM_SHOW_FUNC_CODE: - case SQLCOM_SHOW_CREATE_FUNC: - case SQLCOM_SHOW_STATUS_FUNC: - return &sp_handler_function; - case SQLCOM_CREATE_PACKAGE: - case SQLCOM_DROP_PACKAGE: - case SQLCOM_SHOW_CREATE_PACKAGE: - case SQLCOM_SHOW_STATUS_PACKAGE: - return &sp_handler_package_spec; - case SQLCOM_CREATE_PACKAGE_BODY: - case SQLCOM_DROP_PACKAGE_BODY: - case SQLCOM_SHOW_CREATE_PACKAGE_BODY: - case SQLCOM_SHOW_STATUS_PACKAGE_BODY: - case SQLCOM_SHOW_PACKAGE_BODY_CODE: - return &sp_handler_package_body; - default: - break; - } - return NULL; -} - - -inline const Sp_handler *Sp_handler::handler(enum_sp_type type) -{ - switch (type) { - case SP_TYPE_PROCEDURE: - return &sp_handler_procedure; - case SP_TYPE_FUNCTION: - return &sp_handler_function; - case SP_TYPE_PACKAGE: - return &sp_handler_package_spec; - case SP_TYPE_PACKAGE_BODY: - return &sp_handler_package_body; - case SP_TYPE_TRIGGER: - return &sp_handler_trigger; - case SP_TYPE_EVENT: - break; - } - return NULL; -} - - -inline const Sp_handler *Sp_handler::handler(MDL_key::enum_mdl_namespace type) -{ - switch (type) { - case MDL_key::FUNCTION: - return &sp_handler_function; - case MDL_key::PROCEDURE: - return &sp_handler_procedure; - case MDL_key::PACKAGE_BODY: - return &sp_handler_package_body; - case MDL_key::BACKUP: - case MDL_key::SCHEMA: - case MDL_key::TABLE: - case MDL_key::TRIGGER: - case MDL_key::EVENT: - case MDL_key::USER_LOCK: - case MDL_key::NAMESPACE_END: - break; - } - return NULL; -} - - -/* Tells what SP_DEFAULT_ACCESS should be mapped to */ -#define SP_DEFAULT_ACCESS_MAPPING SP_CONTAINS_SQL - -// Return codes from sp_create_*, sp_drop_*, and sp_show_*: -#define SP_OK 0 -#define SP_KEY_NOT_FOUND -1 -#define SP_OPEN_TABLE_FAILED -2 -#define SP_WRITE_ROW_FAILED -3 -#define SP_DELETE_ROW_FAILED -4 -#define SP_GET_FIELD_FAILED -5 -#define SP_PARSE_ERROR -6 -#define SP_INTERNAL_ERROR -7 -#define SP_NO_DB_ERROR -8 -#define SP_BAD_IDENTIFIER -9 -#define SP_BODY_TOO_LONG -10 -#define SP_FLD_STORE_FAILED -11 - -/* DB storage of Stored PROCEDUREs and FUNCTIONs */ -enum -{ - MYSQL_PROC_FIELD_DB = 0, - MYSQL_PROC_FIELD_NAME, - MYSQL_PROC_MYSQL_TYPE, - MYSQL_PROC_FIELD_SPECIFIC_NAME, - MYSQL_PROC_FIELD_LANGUAGE, - MYSQL_PROC_FIELD_ACCESS, - MYSQL_PROC_FIELD_DETERMINISTIC, - MYSQL_PROC_FIELD_SECURITY_TYPE, - MYSQL_PROC_FIELD_PARAM_LIST, - MYSQL_PROC_FIELD_RETURNS, - MYSQL_PROC_FIELD_BODY, - MYSQL_PROC_FIELD_DEFINER, - MYSQL_PROC_FIELD_CREATED, - MYSQL_PROC_FIELD_MODIFIED, - MYSQL_PROC_FIELD_SQL_MODE, - MYSQL_PROC_FIELD_COMMENT, - MYSQL_PROC_FIELD_CHARACTER_SET_CLIENT, - MYSQL_PROC_FIELD_COLLATION_CONNECTION, - MYSQL_PROC_FIELD_DB_COLLATION, - MYSQL_PROC_FIELD_BODY_UTF8, - MYSQL_PROC_FIELD_AGGREGATE, - MYSQL_PROC_FIELD_COUNT -}; - -/* Drop all routines in database 'db' */ -int -sp_drop_db_routines(THD *thd, const char *db); - -/** - Acquires exclusive metadata lock on all stored routines in the - given database. - - @param thd Thread handler - @param db Database name - - @retval false Success - @retval true Failure - */ -bool lock_db_routines(THD *thd, const char *db); - -/** - Structure that represents element in the set of stored routines - used by statement or routine. -*/ - -class Sroutine_hash_entry -{ -public: - /** - Metadata lock request for routine. - MDL_key in this request is also used as a key for set. - */ - MDL_request mdl_request; - /** - Next element in list linking all routines in set. See also comments - for LEX::sroutine/sroutine_list and sp_head::m_sroutines. - */ - Sroutine_hash_entry *next; - /** - Uppermost view which directly or indirectly uses this routine. - 0 if routine is not used in view. Note that it also can be 0 if - statement uses routine both via view and directly. - */ - TABLE_LIST *belong_to_view; - /** - This is for prepared statement validation purposes. - A statement looks up and pre-loads all its stored functions - at prepare. Later on, if a function is gone from the cache, - execute may fail. - Remember the version of sp_head at prepare to be able to - invalidate the prepared statement at execute if it - changes. - */ - ulong m_sp_cache_version; - - const Sp_handler *m_handler; - - int sp_cache_routine(THD *thd, bool lookup_only, sp_head **sp) const; -}; - - -bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena, - const MDL_key *key, - const Sp_handler *handler, - TABLE_LIST *belong_to_view); -void sp_remove_not_own_routines(Query_tables_list *prelocking_ctx); -bool sp_update_sp_used_routines(HASH *dst, HASH *src); -void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx, - HASH *src, TABLE_LIST *belong_to_view); -void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx, - SQL_I_List *src, - TABLE_LIST *belong_to_view); - -extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen, - my_bool first); - -/* - Routines which allow open/lock and close mysql.proc table even when - we already have some tables open and locked. -*/ -TABLE *open_proc_table_for_read(THD *thd); - -bool load_charset(MEM_ROOT *mem_root, - Field *field, - CHARSET_INFO *dflt_cs, - CHARSET_INFO **cs); - -bool load_collation(MEM_ROOT *mem_root, - Field *field, - CHARSET_INFO *dflt_cl, - CHARSET_INFO **cl); - -void sp_returns_type(THD *thd, - String &result, - const sp_head *sp); - -#endif /* _SP_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_cache.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_cache.h deleted file mode 100644 index 7506edf..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_cache.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- C++ -*- */ -/* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _SP_CACHE_H_ -#define _SP_CACHE_H_ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -/* - Stored procedures/functions cache. This is used as follows: - * Each thread has its own cache. - * Each sp_head object is put into its thread cache before it is used, and - then remains in the cache until deleted. -*/ - -class sp_head; -class sp_cache; -class Database_qualified_name; - -/* - Cache usage scenarios: - 1. Application-wide init: - sp_cache_init(); - - 2. SP execution in thread: - 2.1 While holding sp_head* pointers: - - // look up a routine in the cache (no checks if it is up to date or not) - sp_cache_lookup(); - - sp_cache_insert(); - sp_cache_invalidate(); - - 2.2 When not holding any sp_head* pointers: - sp_cache_flush_obsolete(); - - 3. Before thread exit: - sp_cache_clear(); -*/ - -void sp_cache_init(); -void sp_cache_end(); -void sp_cache_clear(sp_cache **cp); -void sp_cache_insert(sp_cache **cp, sp_head *sp); -sp_head *sp_cache_lookup(sp_cache **cp, const Database_qualified_name *name); -void sp_cache_invalidate(); -void sp_cache_flush_obsolete(sp_cache **cp, sp_head **sp); -ulong sp_cache_version(); -void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements); - -#endif /* _SP_CACHE_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_head.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_head.h deleted file mode 100644 index 913be1a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_head.h +++ /dev/null @@ -1,2133 +0,0 @@ -/* -*- C++ -*- */ -/* - Copyright (c) 2002, 2011, Oracle and/or its affiliates. - Copyright (c) 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _SP_HEAD_H_ -#define _SP_HEAD_H_ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -/* - It is necessary to include set_var.h instead of item.h because there - are dependencies on include order for set_var.h and item.h. This - will be resolved later. -*/ -#include "sql_class.h" // THD, set_var.h: THD -#include "set_var.h" // Item -#include "sp_pcontext.h" // sp_pcontext -#include -#include "sp.h" - -/** - @defgroup Stored_Routines Stored Routines - @ingroup Runtime_Environment - @{ -*/ - -uint -sp_get_flags_for_command(LEX *lex); - -class sp_instr; -class sp_instr_opt_meta; -class sp_instr_jump_if_not; - -/** - Number of PSI_statement_info instruments - for internal stored programs statements. -*/ -#ifdef HAVE_PSI_INTERFACE -void init_sp_psi_keys(void); -#endif - -/*************************************************************************/ - -/** - Stored_program_creation_ctx -- base class for creation context of stored - programs (stored routines, triggers, events). -*/ - -class Stored_program_creation_ctx :public Default_object_creation_ctx -{ -public: - CHARSET_INFO *get_db_cl() - { - return m_db_cl; - } - -public: - virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) = 0; - -protected: - Stored_program_creation_ctx(THD *thd) - : Default_object_creation_ctx(thd), - m_db_cl(thd->variables.collation_database) - { } - - Stored_program_creation_ctx(CHARSET_INFO *client_cs, - CHARSET_INFO *connection_cl, - CHARSET_INFO *db_cl) - : Default_object_creation_ctx(client_cs, connection_cl), - m_db_cl(db_cl) - { } - -protected: - virtual void change_env(THD *thd) const - { - thd->variables.collation_database= m_db_cl; - - Default_object_creation_ctx::change_env(thd); - } - -protected: - /** - db_cl stores the value of the database collation. Both character set - and collation attributes are used. - - Database collation is included into the context because it defines the - default collation for stored-program variables. - */ - CHARSET_INFO *m_db_cl; -}; - -/*************************************************************************/ - -class sp_name : public Sql_alloc, - public Database_qualified_name -{ -public: - bool m_explicit_name; /**< Prepend the db name? */ - - sp_name(const LEX_CSTRING *db, const LEX_CSTRING *name, - bool use_explicit_name) - : Database_qualified_name(db, name), m_explicit_name(use_explicit_name) - { - if (lower_case_table_names && m_db.str) - m_db.length= my_casedn_str(files_charset_info, (char*) m_db.str); - } - - /** Create temporary sp_name object from MDL key. Store in qname_buff */ - sp_name(const MDL_key *key, char *qname_buff); - - ~sp_name() - {} -}; - - -bool -check_routine_name(const LEX_CSTRING *ident); - -class sp_head :private Query_arena, - public Database_qualified_name, - public Sql_alloc -{ - sp_head(const sp_head &)= delete; - void operator=(sp_head &)= delete; - -protected: - MEM_ROOT main_mem_root; -public: - /** Possible values of m_flags */ - enum { - HAS_RETURN= 1, // For FUNCTIONs only: is set if has RETURN - MULTI_RESULTS= 8, // Is set if a procedure with SELECT(s) - CONTAINS_DYNAMIC_SQL= 16, // Is set if a procedure with PREPARE/EXECUTE - IS_INVOKED= 32, // Is set if this sp_head is being used - HAS_SET_AUTOCOMMIT_STMT= 64,// Is set if a procedure with 'set autocommit' - /* Is set if a procedure with COMMIT (implicit or explicit) | ROLLBACK */ - HAS_COMMIT_OR_ROLLBACK= 128, - LOG_SLOW_STATEMENTS= 256, // Used by events - LOG_GENERAL_LOG= 512, // Used by events - HAS_SQLCOM_RESET= 1024, - HAS_SQLCOM_FLUSH= 2048, - - /** - Marks routines that directly (i.e. not by calling other routines) - change tables. Note that this flag is set automatically based on - type of statements used in the stored routine and is different - from routine characteristic provided by user in a form of CONTAINS - SQL, READS SQL DATA, MODIFIES SQL DATA clauses. The latter are - accepted by parser but pretty much ignored after that. - We don't rely on them: - a) for compatibility reasons. - b) because in CONTAINS SQL case they don't provide enough - information anyway. - */ - MODIFIES_DATA= 4096, - /* - Marks routines that have column type references: DECLARE a t1.a%TYPE; - */ - HAS_COLUMN_TYPE_REFS= 8192, - /* Set if has FETCH GROUP NEXT ROW instr. Used to ensure that only - functions with AGGREGATE keyword use the instr. */ - HAS_AGGREGATE_INSTR= 16384 - }; - - sp_package *m_parent; - const Sp_handler *m_handler; - uint m_flags; // Boolean attributes of a stored routine - - /** - Instrumentation interface for SP. - */ - PSI_sp_share *m_sp_share; - - Column_definition m_return_field_def; /**< This is used for FUNCTIONs only. */ - - const char *m_tmp_query; ///< Temporary pointer to sub query string -private: - /* - Private to guarantee that m_chistics.comment is properly set to: - - a string which is alloced on this->mem_root - - or (NULL,0) - set_chistics() makes sure this. - */ - Sp_chistics m_chistics; - void set_chistics(const st_sp_chistics &chistics); - inline void set_chistics_agg_type(enum enum_sp_aggregate_type type) - { - m_chistics.agg_type= type; - } -public: - sql_mode_t m_sql_mode; ///< For SHOW CREATE and execution - bool m_explicit_name; /**< Prepend the db name? */ - LEX_CSTRING m_qname; ///< db.name - LEX_CSTRING m_params; - LEX_CSTRING m_body; - LEX_CSTRING m_body_utf8; - LEX_CSTRING m_defstr; - AUTHID m_definer; - - const st_sp_chistics &chistics() const { return m_chistics; } - const LEX_CSTRING &comment() const { return m_chistics.comment; } - void set_suid(enum_sp_suid_behaviour suid) { m_chistics.suid= suid; } - enum_sp_suid_behaviour suid() const { return m_chistics.suid; } - bool detistic() const { return m_chistics.detistic; } - enum_sp_data_access daccess() const { return m_chistics.daccess; } - enum_sp_aggregate_type agg_type() const { return m_chistics.agg_type; } - /** - Is this routine being executed? - */ - virtual bool is_invoked() const { return m_flags & IS_INVOKED; } - - /** - Get the value of the SP cache version, as remembered - when the routine was inserted into the cache. - */ - ulong sp_cache_version() const; - - /** Set the value of the SP cache version. */ - void set_sp_cache_version(ulong version_arg) const - { - m_sp_cache_version= version_arg; - } - - sp_rcontext *rcontext_create(THD *thd, Field *retval, List *args); - sp_rcontext *rcontext_create(THD *thd, Field *retval, - Item **args, uint arg_count); - sp_rcontext *rcontext_create(THD *thd, Field *retval, - Row_definition_list *list, - bool switch_security_ctx); - bool eq_routine_spec(const sp_head *) const; -private: - /** - Version of the stored routine cache at the moment when the - routine was added to it. Is used only for functions and - procedures, not used for triggers or events. When sp_head is - created, its version is 0. When it's added to the cache, the - version is assigned the global value 'Cversion'. - If later on Cversion is incremented, we know that the routine - is obsolete and should not be used -- - sp_cache_flush_obsolete() will purge it. - */ - mutable ulong m_sp_cache_version; - Stored_program_creation_ctx *m_creation_ctx; - /** - Boolean combination of (1<clone(mem_root); - } - - longlong m_created; - longlong m_modified; - /** Recursion level of the current SP instance. The levels are numbered from 0 */ - ulong m_recursion_level; - /** - A list of diferent recursion level instances for the same procedure. - For every recursion level we have a sp_head instance. This instances - connected in the list. The list ordered by increasing recursion level - (m_recursion_level). - */ - sp_head *m_next_cached_sp; - /** - Pointer to the first element of the above list - */ - sp_head *m_first_instance; - /** - Pointer to the first free (non-INVOKED) routine in the list of - cached instances for this SP. This pointer is set only for the first - SP in the list of instences (see above m_first_cached_sp pointer). - The pointer equal to 0 if we have no free instances. - For non-first instance value of this pointer meanless (point to itself); - */ - sp_head *m_first_free_instance; - /** - Pointer to the last element in the list of instances of the SP. - For non-first instance value of this pointer meanless (point to itself); - */ - sp_head *m_last_cached_sp; - /** - Set containing names of stored routines used by this routine. - Note that unlike elements of similar set for statement elements of this - set are not linked in one list. Because of this we are able save memory - by using for this set same objects that are used in 'sroutines' sets - for statements of which this stored routine consists. - */ - HASH m_sroutines; - // Pointers set during parsing - const char *m_param_begin; - const char *m_param_end; - -private: - const char *m_body_begin; - -public: - /* - Security context for stored routine which should be run under - definer privileges. - */ - Security_context m_security_ctx; - - /** - List of all items (Item_trigger_field objects) representing fields in - old/new version of row in trigger. We use this list for checking whenever - all such fields are valid at trigger creation time and for binding these - fields to TABLE object at table open (although for latter pointer to table - being opened is probably enough). - */ - SQL_I_List m_trg_table_fields; - -protected: - sp_head(MEM_ROOT *mem_root, sp_package *parent, const Sp_handler *handler, - enum_sp_aggregate_type agg_type); - virtual ~sp_head(); -public: - static void destroy(sp_head *sp); - static sp_head *create(sp_package *parent, const Sp_handler *handler, - enum_sp_aggregate_type agg_type); - - /// Initialize after we have reset mem_root - void - init(LEX *lex); - - /** Copy sp name from parser. */ - void - init_sp_name(const sp_name *spname); - - /** Set the body-definition start position. */ - void - set_body_start(THD *thd, const char *begin_ptr); - - /** Set the statement-definition (body-definition) end position. */ - void - set_stmt_end(THD *thd); - - - bool - execute_trigger(THD *thd, - const LEX_CSTRING *db_name, - const LEX_CSTRING *table_name, - GRANT_INFO *grant_info); - - bool - execute_function(THD *thd, Item **args, uint argcount, Field *return_fld, - sp_rcontext **nctx, Query_arena *call_arena); - - bool - execute_procedure(THD *thd, List *args); - - static void - show_create_routine_get_fields(THD *thd, const Sp_handler *sph, - List *fields); - - bool - show_create_routine(THD *thd, const Sp_handler *sph); - - MEM_ROOT *get_main_mem_root() { return &main_mem_root; } - - int - add_instr(sp_instr *instr); - - bool - add_instr_jump(THD *thd, sp_pcontext *spcont); - - bool - add_instr_jump(THD *thd, sp_pcontext *spcont, uint dest); - - bool - add_instr_jump_forward_with_backpatch(THD *thd, sp_pcontext *spcont, - sp_label *lab); - bool - add_instr_jump_forward_with_backpatch(THD *thd, sp_pcontext *spcont) - { - return add_instr_jump_forward_with_backpatch(thd, spcont, - spcont->last_label()); - } - - bool - add_instr_freturn(THD *thd, sp_pcontext *spcont, Item *item, LEX *lex); - - bool - add_instr_preturn(THD *thd, sp_pcontext *spcont); - - Item *adjust_assignment_source(THD *thd, Item *val, Item *val2); - /** - @param thd - the current thd - @param spcont - the current parse context - @param spv - the SP variable - @param val - the value to be assigned to the variable - @param lex - the LEX that was used to create "val" - @param responsible_to_free_lex - if the generated sp_instr_set should - free "lex". - @retval true - on error - @retval false - on success - */ - bool set_local_variable(THD *thd, sp_pcontext *spcont, - const Sp_rcontext_handler *rh, - sp_variable *spv, Item *val, LEX *lex, - bool responsible_to_free_lex); - bool set_local_variable_row_field(THD *thd, sp_pcontext *spcont, - const Sp_rcontext_handler *rh, - sp_variable *spv, uint field_idx, - Item *val, LEX *lex); - bool set_local_variable_row_field_by_name(THD *thd, sp_pcontext *spcont, - const Sp_rcontext_handler *rh, - sp_variable *spv, - const LEX_CSTRING *field_name, - Item *val, LEX *lex); - bool check_package_routine_end_name(const LEX_CSTRING &end_name) const; - bool check_standalone_routine_end_name(const sp_name *end_name) const; - bool check_group_aggregate_instructions_function() const; - bool check_group_aggregate_instructions_forbid() const; - bool check_group_aggregate_instructions_require() const; -private: - /** - Generate a code to set a single cursor parameter variable. - @param thd - current thd, for mem_root allocations. - @param param_spcont - the context of the parameter block - @param idx - the index of the parameter - @param prm - the actual parameter (contains information about - the assignment source expression Item, - its free list, and its LEX) - */ - bool add_set_cursor_param_variable(THD *thd, - sp_pcontext *param_spcont, uint idx, - sp_assignment_lex *prm) - { - DBUG_ASSERT(idx < param_spcont->context_var_count()); - sp_variable *spvar= param_spcont->get_context_variable(idx); - /* - add_instr() gets free_list from m_thd->free_list. - Initialize it before the set_local_variable() call. - */ - DBUG_ASSERT(m_thd->free_list == NULL); - m_thd->free_list= prm->get_free_list(); - if (set_local_variable(thd, param_spcont, - &sp_rcontext_handler_local, - spvar, prm->get_item(), prm, true)) - return true; - /* - Safety: - The item and its free_list are now fully owned by the sp_instr_set - instance, created by set_local_variable(). The sp_instr_set instance - is now responsible for freeing the item and the free_list. - Reset the "item" and the "free_list" members of "prm", - to avoid double pointers to the same objects from "prm" and - from the sp_instr_set instance. - */ - prm->set_item_and_free_list(NULL, NULL); - return false; - } - - /** - Generate a code to set all cursor parameter variables. - This method is called only when parameters exists, - and the number of formal parameters matches the number of actual - parameters. See also comments to add_open_cursor(). - */ - bool add_set_cursor_param_variables(THD *thd, sp_pcontext *param_spcont, - List *parameters) - { - DBUG_ASSERT(param_spcont->context_var_count() == parameters->elements); - sp_assignment_lex *prm; - List_iterator li(*parameters); - for (uint idx= 0; (prm= li++); idx++) - { - if (add_set_cursor_param_variable(thd, param_spcont, idx, prm)) - return true; - } - return false; - } - - /** - Generate a code to set all cursor parameter variables for a FOR LOOP, e.g.: - FOR index IN cursor(1,2,3) - @param - */ - bool add_set_for_loop_cursor_param_variables(THD *thd, - sp_pcontext *param_spcont, - sp_assignment_lex *param_lex, - Item_args *parameters); - -public: - /** - Generate a code for an "OPEN cursor" statement. - @param thd - current thd, for mem_root allocations - @param spcont - the context of the cursor - @param offset - the offset of the cursor - @param param_spcont - the context of the cursor parameter block - @param parameters - the list of the OPEN actual parameters - - The caller must make sure that the number of local variables - in "param_spcont" (formal parameters) matches the number of list elements - in "parameters" (actual parameters). - NULL in either of them means 0 parameters. - */ - bool add_open_cursor(THD *thd, sp_pcontext *spcont, - uint offset, - sp_pcontext *param_spcont, - List *parameters); - - /** - Generate an initiation code for a CURSOR FOR LOOP, e.g.: - FOR index IN cursor -- cursor without parameters - FOR index IN cursor(1,2,3) -- cursor with parameters - - The code generated by this method does the following during SP run-time: - - Sets all cursor parameter vartiables from "parameters" - - Initializes the index ROW-type variable from the cursor - (the structure is copied from the cursor to the index variable) - - The cursor gets opened - - The first records is fetched from the cursor to the variable "index". - - @param thd - the current thread (for mem_root and error reporting) - @param spcont - the current parse context - @param index - the loop "index" ROW-type variable - @param pcursor - the cursor - @param coffset - the cursor offset - @param param_lex - the LEX that owns Items in "parameters" - @param parameters - the cursor parameters Item array - @retval true - on error (EOM) - @retval false - on success - */ - bool add_for_loop_open_cursor(THD *thd, sp_pcontext *spcont, - sp_variable *index, - const sp_pcursor *pcursor, uint coffset, - sp_assignment_lex *param_lex, - Item_args *parameters); - /** - Returns true if any substatement in the routine directly - (not through another routine) modifies data/changes table. - - @sa Comment for MODIFIES_DATA flag. - */ - bool modifies_data() const - { return m_flags & MODIFIES_DATA; } - - inline uint instructions() - { return m_instr.elements; } - - inline sp_instr * - last_instruction() - { - sp_instr *i; - - get_dynamic(&m_instr, (uchar*)&i, m_instr.elements-1); - return i; - } - - bool replace_instr_to_nop(THD *thd, uint ip); - - /* - Resets lex in 'thd' and keeps a copy of the old one. - - @todo Conflicting comment in sp_head.cc - */ - bool - reset_lex(THD *thd); - - bool - reset_lex(THD *thd, sp_lex_local *sublex); - - /** - Merge two LEX instances. - @param oldlex - the upper level LEX we're going to restore to. - @param sublex - the local lex that have just parsed some substatement. - @returns - false on success, true on error (e.g. failed to - merge the routine list or the table list). - This method is shared by: - - restore_lex(), when the old LEX is popped by sp_head::m_lex.pop() - - THD::restore_from_local_lex_to_old_lex(), when the old LEX - is stored in the caller's local variable. - */ - bool - merge_lex(THD *thd, LEX *oldlex, LEX *sublex); - - /** - Restores lex in 'thd' from our copy, but keeps some status from the - one in 'thd', like ptr, tables, fields, etc. - - @todo Conflicting comment in sp_head.cc - */ - bool - restore_lex(THD *thd) - { - DBUG_ENTER("sp_head::restore_lex"); - LEX *oldlex= (LEX *) m_lex.pop(); - if (!oldlex) - DBUG_RETURN(false); // Nothing to restore - LEX *sublex= thd->lex; - // This restores thd->lex and thd->stmt_lex - if (thd->restore_from_local_lex_to_old_lex(oldlex)) - DBUG_RETURN(true); - if (!sublex->sp_lex_in_use) - { - sublex->sphead= NULL; - lex_end(sublex); - delete sublex; - } - DBUG_RETURN(false); - } - - /// Put the instruction on the backpatch list, associated with the label. - int - push_backpatch(THD *thd, sp_instr *, sp_label *); - int - push_backpatch_goto(THD *thd, sp_pcontext *ctx, sp_label *lab); - - /// Update all instruction with this label in the backpatch list to - /// the current position. - void - backpatch(sp_label *); - void - backpatch_goto(THD *thd, sp_label *, sp_label *); - - /// Check for unresolved goto label - bool - check_unresolved_goto(); - - /// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr. - int - new_cont_backpatch(sp_instr_opt_meta *i); - - /// Add an instruction to the current level - int - add_cont_backpatch(sp_instr_opt_meta *i); - - /// Backpatch (and pop) the current level to the current position. - void - do_cont_backpatch(); - - /// Add cpush instructions for all cursors declared in the current frame - bool sp_add_instr_cpush_for_cursors(THD *thd, sp_pcontext *pcontext); - - const LEX_CSTRING *name() const - { return &m_name; } - - char *create_string(THD *thd, ulong *lenp); - - Field *create_result_field(uint field_max_length, const LEX_CSTRING *field_name, - TABLE *table) const; - - - /** - Check and prepare an instance of Column_definition for field creation - (fill all necessary attributes), for variables, parameters and - function return values. - - @param[in] thd Thread handle - @param[in] lex Yacc parsing context - @param[out] field_def An instance of create_field to be filled - - @retval false on success - @retval true on error - */ - bool fill_field_definition(THD *thd, Column_definition *field_def) - { - const Type_handler *h= field_def->type_handler(); - return h->Column_definition_fix_attributes(field_def) || - field_def->sp_prepare_create_field(thd, mem_root); - } - bool row_fill_field_definitions(THD *thd, Row_definition_list *row) - { - /* - Prepare all row fields. This will (among other things) - - convert VARCHAR lengths from character length to octet length - - calculate interval lengths for SET and ENUM - */ - List_iterator it(*row); - for (Spvar_definition *def= it++; def; def= it++) - { - if (fill_spvar_definition(thd, def)) - return true; - } - return false; - } - /** - Check and prepare a Column_definition for a variable or a parameter. - */ - bool fill_spvar_definition(THD *thd, Column_definition *def) - { - if (fill_field_definition(thd, def)) - return true; - def->pack_flag|= FIELDFLAG_MAYBE_NULL; - return false; - } - bool fill_spvar_definition(THD *thd, Column_definition *def, - LEX_CSTRING *name) - { - def->field_name= *name; - return fill_spvar_definition(thd, def); - } - -private: - /** - Set a column type reference for a parameter definition - */ - void fill_spvar_using_type_reference(sp_variable *spvar, - Qualified_column_ident *ref) - { - spvar->field_def.set_column_type_ref(ref); - spvar->field_def.field_name= spvar->name; - m_flags|= sp_head::HAS_COLUMN_TYPE_REFS; - } - - void fill_spvar_using_table_rowtype_reference(THD *thd, - sp_variable *spvar, - Table_ident *ref) - { - spvar->field_def.set_table_rowtype_ref(ref); - spvar->field_def.field_name= spvar->name; - fill_spvar_definition(thd, &spvar->field_def); - m_flags|= sp_head::HAS_COLUMN_TYPE_REFS; - } - -public: - bool spvar_fill_row(THD *thd, sp_variable *spvar, Row_definition_list *def); - bool spvar_fill_type_reference(THD *thd, sp_variable *spvar, - const LEX_CSTRING &table, - const LEX_CSTRING &column); - bool spvar_fill_type_reference(THD *thd, sp_variable *spvar, - const LEX_CSTRING &db, - const LEX_CSTRING &table, - const LEX_CSTRING &column); - bool spvar_fill_table_rowtype_reference(THD *thd, sp_variable *spvar, - const LEX_CSTRING &table); - bool spvar_fill_table_rowtype_reference(THD *thd, sp_variable *spvar, - const LEX_CSTRING &db, - const LEX_CSTRING &table); - - void set_c_chistics(const st_sp_chistics &chistics); - void set_info(longlong created, longlong modified, - const st_sp_chistics &chistics, sql_mode_t sql_mode); - - void set_definer(const char *definer, size_t definerlen) - { - AUTHID tmp; - tmp.parse(definer, definerlen); - m_definer.copy(mem_root, &tmp.user, &tmp.host); - } - void set_definer(const LEX_CSTRING *user_name, const LEX_CSTRING *host_name) - { - m_definer.copy(mem_root, user_name, host_name); - } - - void reset_thd_mem_root(THD *thd); - - void restore_thd_mem_root(THD *thd); - - /** - Optimize the code. - */ - void optimize(); - - /** - Helper used during flow analysis during code optimization. - See the implementation of opt_mark(). - @param ip the instruction to add to the leads list - @param leads the list of remaining paths to explore in the graph that - represents the code, during flow analysis. - */ - void add_mark_lead(uint ip, List *leads); - - inline sp_instr * - get_instr(uint i) - { - sp_instr *ip; - - if (i < m_instr.elements) - get_dynamic(&m_instr, (uchar*)&ip, i); - else - ip= NULL; - return ip; - } - - /* Add tables used by routine to the table list. */ - bool add_used_tables_to_table_list(THD *thd, - TABLE_LIST ***query_tables_last_ptr, - TABLE_LIST *belong_to_view); - - /** - Check if this stored routine contains statements disallowed - in a stored function or trigger, and set an appropriate error message - if this is the case. - */ - bool is_not_allowed_in_function(const char *where) - { - if (m_flags & CONTAINS_DYNAMIC_SQL) - my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "Dynamic SQL"); - else if (m_flags & MULTI_RESULTS) - my_error(ER_SP_NO_RETSET, MYF(0), where); - else if (m_flags & HAS_SET_AUTOCOMMIT_STMT) - my_error(ER_SP_CANT_SET_AUTOCOMMIT, MYF(0)); - else if (m_flags & HAS_COMMIT_OR_ROLLBACK) - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - else if (m_flags & HAS_SQLCOM_RESET) - my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "RESET"); - else if (m_flags & HAS_SQLCOM_FLUSH) - my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "FLUSH"); - - return MY_TEST(m_flags & - (CONTAINS_DYNAMIC_SQL | MULTI_RESULTS | - HAS_SET_AUTOCOMMIT_STMT | HAS_COMMIT_OR_ROLLBACK | - HAS_SQLCOM_RESET | HAS_SQLCOM_FLUSH)); - } - -#ifndef DBUG_OFF - int show_routine_code(THD *thd); -#endif - - /* - This method is intended for attributes of a routine which need - to propagate upwards to the Query_tables_list of the caller (when - a property of a sp_head needs to "taint" the calling statement). - */ - void propagate_attributes(Query_tables_list *prelocking_ctx) - { - DBUG_ENTER("sp_head::propagate_attributes"); - /* - If this routine needs row-based binary logging, the entire top statement - too (we cannot switch from statement-based to row-based only for this - routine, as in statement-based the top-statement may be binlogged and - the substatements not). - */ - DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x", - prelocking_ctx->get_stmt_unsafe_flags())); - DBUG_PRINT("info", ("sp_head(%p=%s)->unsafe_flags: 0x%x", - this, name()->str, unsafe_flags)); - prelocking_ctx->set_stmt_unsafe_flags(unsafe_flags); - DBUG_VOID_RETURN; - } - - sp_pcontext *get_parse_context() { return m_pcont; } - - /* - Check EXECUTE access: - - in case of a standalone rotuine, for the routine itself - - in case of a package routine, for the owner package body - */ - bool check_execute_access(THD *thd) const; - - virtual sp_package *get_package() - { - return NULL; - } - - virtual void init_psi_share(); - -protected: - - MEM_ROOT *m_thd_root; ///< Temp. store for thd's mem_root - THD *m_thd; ///< Set if we have reset mem_root - - sp_pcontext *m_pcont; ///< Parse context - List m_lex; ///< Temp. store for the other lex - DYNAMIC_ARRAY m_instr; ///< The "instructions" - - enum backpatch_instr_type { GOTO, CPOP, HPOP }; - typedef struct - { - sp_label *lab; - sp_instr *instr; - backpatch_instr_type instr_type; - } bp_t; - List m_backpatch; ///< Instructions needing backpatching - List m_backpatch_goto; // Instructions needing backpatching (for goto) - - /** - We need a special list for backpatching of instructions with a continue - destination (in the case of a continue handler catching an error in - the test), since it would otherwise interfere with the normal backpatch - mechanism - e.g. jump_if_not instructions have two different destinations - which are to be patched differently. - Since these occur in a more restricted way (always the same "level" in - the code), we don't need the label. - */ - List m_cont_backpatch; - uint m_cont_level; // The current cont. backpatch level - - /** - Multi-set representing optimized list of tables to be locked by this - routine. Does not include tables which are used by invoked routines. - - @note - For prelocking-free SPs this multiset is constructed too. - We do so because the same instance of sp_head may be called both - in prelocked mode and in non-prelocked mode. - */ - HASH m_sptabs; - - bool - execute(THD *thd, bool merge_da_on_success); - - /** - Perform a forward flow analysis in the generated code. - Mark reachable instructions, for the optimizer. - */ - void opt_mark(); - - /** - Merge the list of tables used by query into the multi-set of tables used - by routine. - */ - bool merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check); - - /// Put the instruction on the a backpatch list, associated with the label. - int - push_backpatch(THD *thd, sp_instr *, sp_label *, List *list, - backpatch_instr_type itype); - -}; // class sp_head : public Sql_alloc - - -class sp_package: public sp_head -{ - bool validate_public_routines(THD *thd, sp_package *spec); - bool validate_private_routines(THD *thd); -public: - class LexList: public List - { - public: - LexList() { elements= 0; } - // Find a package routine by a non qualified name - LEX *find(const LEX_CSTRING &name, enum_sp_type type); - // Find a package routine by a package-qualified name, e.g. 'pkg.proc' - LEX *find_qualified(const LEX_CSTRING &name, enum_sp_type type); - // Check if a routine with the given qualified name already exists - bool check_dup_qualified(const LEX_CSTRING &name, const Sp_handler *sph) - { - if (!find_qualified(name, sph->type())) - return false; - my_error(ER_SP_ALREADY_EXISTS, MYF(0), sph->type_str(), name.str); - return true; - } - bool check_dup_qualified(const sp_head *sp) - { - return check_dup_qualified(sp->m_name, sp->m_handler); - } - void cleanup(); - }; - /* - The LEX for a new package subroutine is initially assigned to - m_current_routine. After scanning parameters, return type and chistics, - the parser detects if we have a declaration or a definition, e.g.: - PROCEDURE p1(a INT); - vs - PROCEDURE p1(a INT) AS BEGIN NULL; END; - (i.e. either semicolon or the "AS" keyword) - m_current_routine is then added either to m_routine_implementations, - or m_routine_declarations, and then m_current_routine is set to NULL. - */ - LEX *m_current_routine; - LexList m_routine_implementations; - LexList m_routine_declarations; - - LEX *m_top_level_lex; - sp_rcontext *m_rcontext; - uint m_invoked_subroutine_count; - bool m_is_instantiated; - bool m_is_cloning_routine; - -private: - sp_package(MEM_ROOT *mem_root, - LEX *top_level_lex, - const sp_name *name, - const Sp_handler *sph); - ~sp_package(); -public: - static sp_package *create(LEX *top_level_lex, const sp_name *name, - const Sp_handler *sph); - - bool add_routine_declaration(LEX *lex) - { - return m_routine_declarations.check_dup_qualified(lex->sphead) || - m_routine_declarations.push_back(lex, &main_mem_root); - } - bool add_routine_implementation(LEX *lex) - { - return m_routine_implementations.check_dup_qualified(lex->sphead) || - m_routine_implementations.push_back(lex, &main_mem_root); - } - sp_package *get_package() { return this; } - void init_psi_share(); - bool is_invoked() const - { - /* - Cannot flush a package out of the SP cache when: - - its initialization block is running - - one of its subroutine is running - */ - return sp_head::is_invoked() || m_invoked_subroutine_count > 0; - } - sp_variable *find_package_variable(const LEX_CSTRING *name) const - { - /* - sp_head::m_pcont is a special level for routine parameters. - Variables declared inside CREATE PACKAGE BODY reside in m_children.at(0). - */ - sp_pcontext *ctx= m_pcont->child_context(0); - return ctx ? ctx->find_variable(name, true) : NULL; - } - bool validate_after_parser(THD *thd); - bool instantiate_if_needed(THD *thd); -}; - - -class sp_lex_cursor: public sp_lex_local, public Query_arena -{ -public: - sp_lex_cursor(THD *thd, const LEX *oldlex, MEM_ROOT *mem_root_arg) - :sp_lex_local(thd, oldlex), - Query_arena(mem_root_arg, STMT_INITIALIZED_FOR_SP) - { } - sp_lex_cursor(THD *thd, const LEX *oldlex) - :sp_lex_local(thd, oldlex), - Query_arena(thd->lex->sphead->get_main_mem_root(), STMT_INITIALIZED_FOR_SP) - { } - ~sp_lex_cursor() { free_items(); } - void cleanup_stmt() { } - Query_arena *query_arena() { return this; } - bool validate() - { - DBUG_ASSERT(sql_command == SQLCOM_SELECT); - if (result) - { - my_error(ER_SP_BAD_CURSOR_SELECT, MYF(0)); - return true; - } - return false; - } - bool stmt_finalize(THD *thd) - { - if (validate()) - return true; - sp_lex_in_use= true; - free_list= thd->free_list; - thd->free_list= NULL; - return false; - } -}; - - -// -// "Instructions"... -// - -class sp_instr :public Query_arena, public Sql_alloc -{ - sp_instr(const sp_instr &); /**< Prevent use of these */ - void operator=(sp_instr &); - -public: - - uint marked; - uint m_ip; ///< My index - sp_pcontext *m_ctx; ///< My parse context - uint m_lineno; - - /// Should give each a name or type code for debugging purposes? - sp_instr(uint ip, sp_pcontext *ctx) - :Query_arena(0, STMT_INITIALIZED_FOR_SP), marked(0), m_ip(ip), m_ctx(ctx) - {} - - virtual ~sp_instr() - { free_items(); } - - - /** - Execute this instruction - - - @param thd Thread handle - @param[out] nextp index of the next instruction to execute. (For most - instructions this will be the instruction following this - one). Note that this parameter is undefined in case of - errors, use get_cont_dest() to find the continuation - instruction for CONTINUE error handlers. - - @retval 0 on success, - @retval other if some error occurred - */ - - virtual int execute(THD *thd, uint *nextp) = 0; - - /** - Execute open_and_lock_tables() for this statement. - Open and lock the tables used by this statement, as a pre-requisite - to execute the core logic of this instruction with - exec_core(). - @param thd the current thread - @param tables the list of tables to open and lock - @return zero on success, non zero on failure. - */ - int exec_open_and_lock_tables(THD *thd, TABLE_LIST *tables); - - /** - Get the continuation destination of this instruction. - @return the continuation destination - */ - virtual uint get_cont_dest() const; - - /* - Execute core function of instruction after all preparations (e.g. - setting of proper LEX, saving part of the thread context have been - done). - - Should be implemented for instructions using expressions or whole - statements (thus having to have own LEX). Used in concert with - sp_lex_keeper class and its descendants (there are none currently). - */ - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str) = 0; - - virtual void backpatch(uint dest, sp_pcontext *dst_ctx) - {} - - /** - Mark this instruction as reachable during optimization and return the - index to the next instruction. Jump instruction will add their - destination to the leads list. - */ - virtual uint opt_mark(sp_head *sp, List *leads) - { - marked= 1; - return m_ip+1; - } - - /** - Short-cut jumps to jumps during optimization. This is used by the - jump instructions' opt_mark() methods. 'start' is the starting point, - used to prevent the mark sweep from looping for ever. Return the - end destination. - */ - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) - { - return m_ip; - } - - /** - Inform the instruction that it has been moved during optimization. - Most instructions will simply update its index, but jump instructions - must also take care of their destination pointers. Forward jumps get - pushed to the backpatch list 'ibp'. - */ - virtual void opt_move(uint dst, List *ibp) - { - m_ip= dst; - } - virtual PSI_statement_info* get_psi_info() = 0; - -}; // class sp_instr : public Sql_alloc - - -/** - Auxilary class to which instructions delegate responsibility - for handling LEX and preparations before executing statement - or calculating complex expression. - - Exist mainly to avoid having double hierarchy between instruction - classes. - - @todo - Add ability to not store LEX and do any preparations if - expression used is simple. -*/ - -class sp_lex_keeper -{ - /** Prevent use of these */ - sp_lex_keeper(const sp_lex_keeper &); - void operator=(sp_lex_keeper &); -public: - - sp_lex_keeper(LEX *lex, bool lex_resp) - : m_lex(lex), m_lex_resp(lex_resp), - lex_query_tables_own_last(NULL) - { - lex->sp_lex_in_use= TRUE; - } - virtual ~sp_lex_keeper() - { - if (m_lex_resp) - { - /* Prevent endless recursion. */ - m_lex->sphead= NULL; - lex_end(m_lex); - delete m_lex; - } - } - - /** - Prepare execution of instruction using LEX, if requested check whenever - we have read access to tables used and open/lock them, call instruction's - exec_core() method, perform cleanup afterwards. - - @todo Conflicting comment in sp_head.cc - */ - int reset_lex_and_exec_core(THD *thd, uint *nextp, bool open_tables, - sp_instr* instr); - - int cursor_reset_lex_and_exec_core(THD *thd, uint *nextp, bool open_tables, - sp_instr *instr); - - inline uint sql_command() const - { - return (uint)m_lex->sql_command; - } - - void disable_query_cache() - { - m_lex->safe_to_cache_query= 0; - } - -private: - - LEX *m_lex; - /** - Indicates whenever this sp_lex_keeper instance responsible - for LEX deletion. - */ - bool m_lex_resp; - - /* - Support for being able to execute this statement in two modes: - a) inside prelocked mode set by the calling procedure or its ancestor. - b) outside of prelocked mode, when this statement enters/leaves - prelocked mode itself. - */ - - /** - List of additional tables this statement needs to lock when it - enters/leaves prelocked mode on its own. - */ - TABLE_LIST *prelocking_tables; - - /** - The value m_lex->query_tables_own_last should be set to this when the - statement enters/leaves prelocked mode on its own. - */ - TABLE_LIST **lex_query_tables_own_last; -}; - - -/** - Call out to some prepared SQL statement. -*/ -class sp_instr_stmt : public sp_instr -{ - sp_instr_stmt(const sp_instr_stmt &); /**< Prevent use of these */ - void operator=(sp_instr_stmt &); - -public: - - LEX_STRING m_query; ///< For thd->query - - sp_instr_stmt(uint ip, sp_pcontext *ctx, LEX *lex) - : sp_instr(ip, ctx), m_lex_keeper(lex, TRUE) - { - m_query.str= 0; - m_query.length= 0; - } - - virtual ~sp_instr_stmt() - {}; - - virtual int execute(THD *thd, uint *nextp); - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); - -private: - - sp_lex_keeper m_lex_keeper; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; - -}; // class sp_instr_stmt : public sp_instr - - -class sp_instr_set : public sp_instr -{ - sp_instr_set(const sp_instr_set &); /**< Prevent use of these */ - void operator=(sp_instr_set &); - -public: - - sp_instr_set(uint ip, sp_pcontext *ctx, - const Sp_rcontext_handler *rh, - uint offset, Item *val, - LEX *lex, bool lex_resp) - : sp_instr(ip, ctx), - m_rcontext_handler(rh), m_offset(offset), m_value(val), - m_lex_keeper(lex, lex_resp) - {} - - virtual ~sp_instr_set() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); - -protected: - sp_rcontext *get_rcontext(THD *thd) const; - const Sp_rcontext_handler *m_rcontext_handler; - uint m_offset; ///< Frame offset - Item *m_value; - sp_lex_keeper m_lex_keeper; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_set : public sp_instr - - -/* - This class handles assignments of a ROW fields: - DECLARE rec ROW (a INT,b INT); - SET rec.a= 10; -*/ -class sp_instr_set_row_field : public sp_instr_set -{ - sp_instr_set_row_field(const sp_instr_set_row_field &); // Prevent use of this - void operator=(sp_instr_set_row_field &); - uint m_field_offset; - -public: - - sp_instr_set_row_field(uint ip, sp_pcontext *ctx, - const Sp_rcontext_handler *rh, - uint offset, uint field_offset, - Item *val, - LEX *lex, bool lex_resp) - : sp_instr_set(ip, ctx, rh, offset, val, lex, lex_resp), - m_field_offset(field_offset) - {} - - virtual ~sp_instr_set_row_field() - {} - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); -}; // class sp_instr_set_field : public sp_instr_set - - -/** - This class handles assignment instructions like this: - DECLARE - CURSOR cur IS SELECT * FROM t1; - rec cur%ROWTYPE; - BEGIN - rec.column1:= 10; -- This instruction - END; - - The idea is that during sp_rcontext::create() we do not know the extact - structure of "rec". It gets resolved at run time, during the corresponding - sp_instr_cursor_copy_struct::exec_core(). - - So sp_instr_set_row_field_by_name searches for ROW fields by name, - while sp_instr_set_row_field (see above) searches for ROW fields by index. -*/ -class sp_instr_set_row_field_by_name : public sp_instr_set -{ - // Prevent use of this - sp_instr_set_row_field_by_name(const sp_instr_set_row_field &); - void operator=(sp_instr_set_row_field_by_name &); - const LEX_CSTRING m_field_name; - -public: - - sp_instr_set_row_field_by_name(uint ip, sp_pcontext *ctx, - const Sp_rcontext_handler *rh, - uint offset, const LEX_CSTRING &field_name, - Item *val, - LEX *lex, bool lex_resp) - : sp_instr_set(ip, ctx, rh, offset, val, lex, lex_resp), - m_field_name(field_name) - {} - - virtual ~sp_instr_set_row_field_by_name() - {} - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); -}; // class sp_instr_set_field_by_name : public sp_instr_set - - -/** - Set NEW/OLD row field value instruction. Used in triggers. -*/ -class sp_instr_set_trigger_field : public sp_instr -{ - sp_instr_set_trigger_field(const sp_instr_set_trigger_field &); - void operator=(sp_instr_set_trigger_field &); - -public: - - sp_instr_set_trigger_field(uint ip, sp_pcontext *ctx, - Item_trigger_field *trg_fld, - Item *val, LEX *lex) - : sp_instr(ip, ctx), - trigger_field(trg_fld), - value(val), m_lex_keeper(lex, TRUE) - {} - - virtual ~sp_instr_set_trigger_field() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); - -private: - Item_trigger_field *trigger_field; - Item *value; - sp_lex_keeper m_lex_keeper; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_trigger_field : public sp_instr - - -/** - An abstract class for all instructions with destinations that - needs to be updated by the optimizer. - - Even if not all subclasses will use both the normal destination and - the continuation destination, we put them both here for simplicity. -*/ -class sp_instr_opt_meta : public sp_instr -{ -public: - - uint m_dest; ///< Where we will go - uint m_cont_dest; ///< Where continue handlers will go - - sp_instr_opt_meta(uint ip, sp_pcontext *ctx) - : sp_instr(ip, ctx), - m_dest(0), m_cont_dest(0), m_optdest(0), m_cont_optdest(0) - {} - - sp_instr_opt_meta(uint ip, sp_pcontext *ctx, uint dest) - : sp_instr(ip, ctx), - m_dest(dest), m_cont_dest(0), m_optdest(0), m_cont_optdest(0) - {} - - virtual ~sp_instr_opt_meta() - {} - - virtual void set_destination(uint old_dest, uint new_dest) - = 0; - - virtual uint get_cont_dest() const; - -protected: - - sp_instr *m_optdest; ///< Used during optimization - sp_instr *m_cont_optdest; ///< Used during optimization - -}; // class sp_instr_opt_meta : public sp_instr - -class sp_instr_jump : public sp_instr_opt_meta -{ - sp_instr_jump(const sp_instr_jump &); /**< Prevent use of these */ - void operator=(sp_instr_jump &); - -public: - - sp_instr_jump(uint ip, sp_pcontext *ctx) - : sp_instr_opt_meta(ip, ctx) - {} - - sp_instr_jump(uint ip, sp_pcontext *ctx, uint dest) - : sp_instr_opt_meta(ip, ctx, dest) - {} - - virtual ~sp_instr_jump() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - - virtual uint opt_mark(sp_head *sp, List *leads); - - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start); - - virtual void opt_move(uint dst, List *ibp); - - virtual void backpatch(uint dest, sp_pcontext *dst_ctx) - { - /* Calling backpatch twice is a logic flaw in jump resolution. */ - DBUG_ASSERT(m_dest == 0); - m_dest= dest; - } - - /** - Update the destination; used by the optimizer. - */ - virtual void set_destination(uint old_dest, uint new_dest) - { - if (m_dest == old_dest) - m_dest= new_dest; - } - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_jump : public sp_instr_opt_meta - - -class sp_instr_jump_if_not : public sp_instr_jump -{ - sp_instr_jump_if_not(const sp_instr_jump_if_not &); /**< Prevent use of these */ - void operator=(sp_instr_jump_if_not &); - -public: - - sp_instr_jump_if_not(uint ip, sp_pcontext *ctx, Item *i, LEX *lex) - : sp_instr_jump(ip, ctx), m_expr(i), - m_lex_keeper(lex, TRUE) - {} - - sp_instr_jump_if_not(uint ip, sp_pcontext *ctx, Item *i, uint dest, LEX *lex) - : sp_instr_jump(ip, ctx, dest), m_expr(i), - m_lex_keeper(lex, TRUE) - {} - - virtual ~sp_instr_jump_if_not() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); - - virtual uint opt_mark(sp_head *sp, List *leads); - - /** Override sp_instr_jump's shortcut; we stop here */ - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) - { - return m_ip; - } - - virtual void opt_move(uint dst, List *ibp); - - virtual void set_destination(uint old_dest, uint new_dest) - { - sp_instr_jump::set_destination(old_dest, new_dest); - if (m_cont_dest == old_dest) - m_cont_dest= new_dest; - } - -private: - - Item *m_expr; ///< The condition - sp_lex_keeper m_lex_keeper; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_jump_if_not : public sp_instr_jump - - -class sp_instr_preturn : public sp_instr -{ - sp_instr_preturn(const sp_instr_preturn &); /**< Prevent use of these */ - void operator=(sp_instr_preturn &); - -public: - - sp_instr_preturn(uint ip, sp_pcontext *ctx) - : sp_instr(ip, ctx) - {} - - virtual ~sp_instr_preturn() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - - virtual uint opt_mark(sp_head *sp, List *leads) - { - marked= 1; - return UINT_MAX; - } - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_preturn : public sp_instr - - -class sp_instr_freturn : public sp_instr -{ - sp_instr_freturn(const sp_instr_freturn &); /**< Prevent use of these */ - void operator=(sp_instr_freturn &); - -public: - - sp_instr_freturn(uint ip, sp_pcontext *ctx, - Item *val, const Type_handler *handler, LEX *lex) - : sp_instr(ip, ctx), m_value(val), m_type_handler(handler), - m_lex_keeper(lex, TRUE) - {} - - virtual ~sp_instr_freturn() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); - - virtual uint opt_mark(sp_head *sp, List *leads) - { - marked= 1; - return UINT_MAX; - } - -protected: - - Item *m_value; - const Type_handler *m_type_handler; - sp_lex_keeper m_lex_keeper; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_freturn : public sp_instr - - -class sp_instr_hpush_jump : public sp_instr_jump -{ - sp_instr_hpush_jump(const sp_instr_hpush_jump &); /**< Prevent use of these */ - void operator=(sp_instr_hpush_jump &); - -public: - - sp_instr_hpush_jump(uint ip, - sp_pcontext *ctx, - sp_handler *handler) - :sp_instr_jump(ip, ctx), - m_handler(handler), - m_opt_hpop(0), - m_frame(ctx->current_var_count()) - { - DBUG_ASSERT(m_handler->condition_values.elements == 0); - } - - virtual ~sp_instr_hpush_jump() - { - m_handler->condition_values.empty(); - m_handler= NULL; - } - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - - virtual uint opt_mark(sp_head *sp, List *leads); - - /** Override sp_instr_jump's shortcut; we stop here. */ - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) - { - return m_ip; - } - - virtual void backpatch(uint dest, sp_pcontext *dst_ctx) - { - DBUG_ASSERT(!m_dest || !m_opt_hpop); - if (!m_dest) - m_dest= dest; - else - m_opt_hpop= dest; - } - - void add_condition(sp_condition_value *condition_value) - { m_handler->condition_values.push_back(condition_value); } - - sp_handler *get_handler() - { return m_handler; } - -private: - /// Handler. - sp_handler *m_handler; - - /// hpop marking end of handler scope. - uint m_opt_hpop; - - // This attribute is needed for SHOW PROCEDURE CODE only (i.e. it's needed in - // debug version only). It's used in print(). - uint m_frame; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_hpush_jump : public sp_instr_jump - - -class sp_instr_hpop : public sp_instr -{ - sp_instr_hpop(const sp_instr_hpop &); /**< Prevent use of these */ - void operator=(sp_instr_hpop &); - -public: - - sp_instr_hpop(uint ip, sp_pcontext *ctx, uint count) - : sp_instr(ip, ctx), m_count(count) - {} - - virtual ~sp_instr_hpop() - {} - - void update_count(uint count) - { - m_count= count; - } - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - -private: - - uint m_count; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_hpop : public sp_instr - - -class sp_instr_hreturn : public sp_instr_jump -{ - sp_instr_hreturn(const sp_instr_hreturn &); /**< Prevent use of these */ - void operator=(sp_instr_hreturn &); - -public: - - sp_instr_hreturn(uint ip, sp_pcontext *ctx) - :sp_instr_jump(ip, ctx), - m_frame(ctx->current_var_count()) - {} - - virtual ~sp_instr_hreturn() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - - /* This instruction will not be short cut optimized. */ - virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) - { - return m_ip; - } - - virtual uint opt_mark(sp_head *sp, List *leads); - -private: - - uint m_frame; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_hreturn : public sp_instr_jump - - -/** This is DECLARE CURSOR */ -class sp_instr_cpush : public sp_instr, public sp_cursor -{ - sp_instr_cpush(const sp_instr_cpush &); /**< Prevent use of these */ - void operator=(sp_instr_cpush &); - -public: - - sp_instr_cpush(uint ip, sp_pcontext *ctx, LEX *lex, uint offset) - : sp_instr(ip, ctx), m_lex_keeper(lex, TRUE), m_cursor(offset) - {} - - virtual ~sp_instr_cpush() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - - /** - This call is used to cleanup the instruction when a sensitive - cursor is closed. For now stored procedures always use materialized - cursors and the call is not used. - */ - virtual void cleanup_stmt() { /* no op */ } -private: - - sp_lex_keeper m_lex_keeper; - uint m_cursor; /**< Frame offset (for debugging) */ - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_cpush : public sp_instr - - -class sp_instr_cpop : public sp_instr -{ - sp_instr_cpop(const sp_instr_cpop &); /**< Prevent use of these */ - void operator=(sp_instr_cpop &); - -public: - - sp_instr_cpop(uint ip, sp_pcontext *ctx, uint count) - : sp_instr(ip, ctx), m_count(count) - {} - - virtual ~sp_instr_cpop() - {} - - void update_count(uint count) - { - m_count= count; - } - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - -private: - - uint m_count; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_cpop : public sp_instr - - -class sp_instr_copen : public sp_instr -{ - sp_instr_copen(const sp_instr_copen &); /**< Prevent use of these */ - void operator=(sp_instr_copen &); - -public: - - sp_instr_copen(uint ip, sp_pcontext *ctx, uint c) - : sp_instr(ip, ctx), m_cursor(c) - {} - - virtual ~sp_instr_copen() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); - -private: - - uint m_cursor; ///< Stack index - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_copen : public sp_instr_stmt - - -/** - Initialize the structure of a cursor%ROWTYPE variable - from the LEX containing the cursor SELECT statement. -*/ -class sp_instr_cursor_copy_struct: public sp_instr -{ - /**< Prevent use of these */ - sp_instr_cursor_copy_struct(const sp_instr_cursor_copy_struct &); - void operator=(sp_instr_cursor_copy_struct &); - sp_lex_keeper m_lex_keeper; - uint m_cursor; - uint m_var; -public: - sp_instr_cursor_copy_struct(uint ip, sp_pcontext *ctx, uint coffs, - sp_lex_cursor *lex, uint voffs) - : sp_instr(ip, ctx), m_lex_keeper(lex, FALSE), - m_cursor(coffs), - m_var(voffs) - {} - virtual ~sp_instr_cursor_copy_struct() - {} - virtual int execute(THD *thd, uint *nextp); - virtual int exec_core(THD *thd, uint *nextp); - virtual void print(String *str); - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; - - -class sp_instr_cclose : public sp_instr -{ - sp_instr_cclose(const sp_instr_cclose &); /**< Prevent use of these */ - void operator=(sp_instr_cclose &); - -public: - - sp_instr_cclose(uint ip, sp_pcontext *ctx, uint c) - : sp_instr(ip, ctx), m_cursor(c) - {} - - virtual ~sp_instr_cclose() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - -private: - - uint m_cursor; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_cclose : public sp_instr - - -class sp_instr_cfetch : public sp_instr -{ - sp_instr_cfetch(const sp_instr_cfetch &); /**< Prevent use of these */ - void operator=(sp_instr_cfetch &); - -public: - - sp_instr_cfetch(uint ip, sp_pcontext *ctx, uint c, bool error_on_no_data) - : sp_instr(ip, ctx), m_cursor(c), m_error_on_no_data(error_on_no_data) - { - m_varlist.empty(); - } - - virtual ~sp_instr_cfetch() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - - void add_to_varlist(sp_variable *var) - { - m_varlist.push_back(var); - } - -private: - - uint m_cursor; - List m_varlist; - bool m_error_on_no_data; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_cfetch : public sp_instr - -/* -This class is created for the special fetch instruction -FETCH GROUP NEXT ROW, used in the user-defined aggregate -functions -*/ - -class sp_instr_agg_cfetch : public sp_instr -{ - sp_instr_agg_cfetch(const sp_instr_cfetch &); /**< Prevent use of these */ - void operator=(sp_instr_cfetch &); - -public: - - sp_instr_agg_cfetch(uint ip, sp_pcontext *ctx) - : sp_instr(ip, ctx){} - - virtual ~sp_instr_agg_cfetch() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_agg_cfetch : public sp_instr - - - - -class sp_instr_error : public sp_instr -{ - sp_instr_error(const sp_instr_error &); /**< Prevent use of these */ - void operator=(sp_instr_error &); - -public: - - sp_instr_error(uint ip, sp_pcontext *ctx, int errcode) - : sp_instr(ip, ctx), m_errcode(errcode) - {} - - virtual ~sp_instr_error() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual void print(String *str); - - virtual uint opt_mark(sp_head *sp, List *leads) - { - marked= 1; - return UINT_MAX; - } - -private: - - int m_errcode; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_error : public sp_instr - - -class sp_instr_set_case_expr : public sp_instr_opt_meta -{ -public: - - sp_instr_set_case_expr(uint ip, sp_pcontext *ctx, uint case_expr_id, - Item *case_expr, LEX *lex) - : sp_instr_opt_meta(ip, ctx), - m_case_expr_id(case_expr_id), m_case_expr(case_expr), - m_lex_keeper(lex, TRUE) - {} - - virtual ~sp_instr_set_case_expr() - {} - - virtual int execute(THD *thd, uint *nextp); - - virtual int exec_core(THD *thd, uint *nextp); - - virtual void print(String *str); - - virtual uint opt_mark(sp_head *sp, List *leads); - - virtual void opt_move(uint dst, List *ibp); - - virtual void set_destination(uint old_dest, uint new_dest) - { - if (m_cont_dest == old_dest) - m_cont_dest= new_dest; - } - -private: - - uint m_case_expr_id; - Item *m_case_expr; - sp_lex_keeper m_lex_keeper; - -public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } - static PSI_statement_info psi_info; -}; // class sp_instr_set_case_expr : public sp_instr_opt_meta - -bool check_show_routine_access(THD *thd, sp_head *sp, bool *full_access); - -#ifndef NO_EMBEDDED_ACCESS_CHECKS -bool -sp_change_security_context(THD *thd, sp_head *sp, - Security_context **backup); -void -sp_restore_security_context(THD *thd, Security_context *backup); - -bool -set_routine_security_ctx(THD *thd, sp_head *sp, Security_context **save_ctx); -#endif /* NO_EMBEDDED_ACCESS_CHECKS */ - -TABLE_LIST * -sp_add_to_query_tables(THD *thd, LEX *lex, - const LEX_CSTRING *db, const LEX_CSTRING *name, - thr_lock_type locktype, - enum_mdl_type mdl_type); - -/** - @} (end of group Stored_Routines) -*/ - -#endif /* _SP_HEAD_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_pcontext.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_pcontext.h deleted file mode 100644 index ffc9c0e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_pcontext.h +++ /dev/null @@ -1,786 +0,0 @@ -/* -*- C++ -*- */ -/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _SP_PCONTEXT_H_ -#define _SP_PCONTEXT_H_ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_string.h" // LEX_STRING -#include "field.h" // Create_field -#include "sql_array.h" // Dynamic_array - - -/// This class represents a stored program variable or a parameter -/// (also referenced as 'SP-variable'). - -class sp_variable : public Sql_alloc -{ -public: - enum enum_mode - { - MODE_IN, - MODE_OUT, - MODE_INOUT - }; - - /// Name of the SP-variable. - LEX_CSTRING name; - - /// Mode of the SP-variable. - enum_mode mode; - - /// The index to the variable's value in the runtime frame. - /// - /// It is calculated during parsing and used when creating sp_instr_set - /// instructions and Item_splocal items. I.e. values are set/referred by - /// array indexing in runtime. - uint offset; - - /// Default value of the SP-variable (if any). - Item *default_value; - - /// Full type information (field meta-data) of the SP-variable. - Spvar_definition field_def; - - /// Field-type of the SP-variable. - const Type_handler *type_handler() const { return field_def.type_handler(); } - -public: - sp_variable(const LEX_CSTRING *name_arg, uint offset_arg) - :Sql_alloc(), - name(*name_arg), - mode(MODE_IN), - offset(offset_arg), - default_value(NULL) - { } - /* - Find a ROW field by its qualified name. - @param var_name - the name of the variable - @param field_name - the name of the variable field - @param[OUT] row_field_offset - the index of the field - - @retval NULL if the variable with the given name was not found, - or it is not a row variable, or it does not have a field - with the given name, or a non-null pointer otherwise. - row_field_offset[0] is set only when the method returns !NULL. - */ - const Spvar_definition *find_row_field(const LEX_CSTRING *var_name, - const LEX_CSTRING *field_name, - uint *row_field_offset); -}; - -/////////////////////////////////////////////////////////////////////////// - -/// This class represents an SQL/PSM label. Can refer to the identifier -/// used with the "label_name:" construct which may precede some SQL/PSM -/// statements, or to an implicit implementation-dependent identifier which -/// the parser inserts before a high-level flow control statement such as -/// IF/WHILE/REPEAT/LOOP, when such statement is rewritten into a -/// combination of low-level jump/jump_if instructions and labels. - - -class sp_label : public Sql_alloc -{ -public: - enum enum_type - { - /// Implicit label generated by parser. - IMPLICIT, - - /// Label at BEGIN. - BEGIN, - - /// Label at iteration control - ITERATION, - - /// Label for jump - GOTO - }; - - /// Name of the label. - LEX_CSTRING name; - - /// Instruction pointer of the label. - uint ip; - - /// Type of the label. - enum_type type; - - /// Scope of the label. - class sp_pcontext *ctx; - -public: - sp_label(const LEX_CSTRING *_name, - uint _ip, enum_type _type, sp_pcontext *_ctx) - :Sql_alloc(), - name(*_name), - ip(_ip), - type(_type), - ctx(_ctx) - { } -}; - - -/////////////////////////////////////////////////////////////////////////// - -/// This class represents condition-value term in DECLARE CONDITION or -/// DECLARE HANDLER statements. sp_condition_value has little to do with -/// SQL-conditions. -/// -/// In some sense, this class is a union -- a set of filled attributes -/// depends on the sp_condition_value::type value. - -class sp_condition_value : public Sql_alloc, public Sql_state_errno -{ - bool m_is_user_defined; -public: - enum enum_type - { - ERROR_CODE, - SQLSTATE, - WARNING, - NOT_FOUND, - EXCEPTION - }; - - /// Type of the condition value. - enum_type type; - -public: - sp_condition_value(uint _mysqlerr) - :Sql_alloc(), - Sql_state_errno(_mysqlerr), - m_is_user_defined(false), - type(ERROR_CODE) - { } - - sp_condition_value(uint _mysqlerr, const char *_sql_state) - :Sql_alloc(), - Sql_state_errno(_mysqlerr, _sql_state), - m_is_user_defined(false), - type(ERROR_CODE) - { } - - sp_condition_value(const char *_sql_state, bool is_user_defined= false) - :Sql_alloc(), - Sql_state_errno(0, _sql_state), - m_is_user_defined(is_user_defined), - type(SQLSTATE) - { } - - sp_condition_value(enum_type _type) - :Sql_alloc(), - m_is_user_defined(false), - type(_type) - { - DBUG_ASSERT(type != ERROR_CODE && type != SQLSTATE); - } - - /// Check if two instances of sp_condition_value are equal or not. - /// - /// @param cv another instance of sp_condition_value to check. - /// - /// @return true if the instances are equal, false otherwise. - bool equals(const sp_condition_value *cv) const; - - - /** - Checks if this condition is OK for search. - See also sp_context::find_handler(). - - @param identity - The condition identity - @param found_cv - A previously found matching condition or NULL. - @return true - If the current value matches identity and - makes a stronger match than the previously - found condition found_cv. - @return false - If the current value does not match identity, - of the current value makes a weaker match than found_cv. - */ - bool matches(const Sql_condition_identity &identity, - const sp_condition_value *found_cv) const; - - Sql_user_condition_identity get_user_condition_identity() const - { - return Sql_user_condition_identity(m_is_user_defined ? this : NULL); - } -}; - - -class sp_condition_value_user_defined: public sp_condition_value -{ -public: - sp_condition_value_user_defined() - :sp_condition_value("45000", true) - { } -}; - - -/////////////////////////////////////////////////////////////////////////// - -/// This class represents 'DECLARE CONDITION' statement. -/// sp_condition has little to do with SQL-conditions. - -class sp_condition : public Sql_alloc -{ -public: - /// Name of the condition. - LEX_CSTRING name; - - /// Value of the condition. - sp_condition_value *value; - -public: - sp_condition(const LEX_CSTRING *name_arg, sp_condition_value *value_arg) - :Sql_alloc(), - name(*name_arg), - value(value_arg) - { } - sp_condition(const char *name_arg, size_t name_length_arg, - sp_condition_value *value_arg) - :value(value_arg) - { - name.str= name_arg; - name.length= name_length_arg; - } - bool eq_name(const LEX_CSTRING *str) const - { - return system_charset_info->strnncoll(name.str, name.length, - str->str, str->length) == 0; - } -}; - - -/////////////////////////////////////////////////////////////////////////// - -/** - class sp_pcursor. - Stores information about a cursor: - - Cursor's name in LEX_STRING. - - Cursor's formal parameter descriptions. - - Formal parameter descriptions reside in a separate context block, - pointed by the "m_param_context" member. - - m_param_context can be NULL. This means a cursor with no parameters. - Otherwise, the number of variables in m_param_context means - the number of cursor's formal parameters. - - Note, m_param_context can be not NULL, but have no variables. - This is also means a cursor with no parameters (similar to NULL). -*/ -class sp_pcursor: public LEX_CSTRING -{ - class sp_pcontext *m_param_context; // Formal parameters - class sp_lex_cursor *m_lex; // The cursor statement LEX -public: - sp_pcursor(const LEX_CSTRING *name, class sp_pcontext *param_ctx, - class sp_lex_cursor *lex) - :LEX_CSTRING(*name), m_param_context(param_ctx), m_lex(lex) - { } - class sp_pcontext *param_context() const { return m_param_context; } - class sp_lex_cursor *lex() const { return m_lex; } - bool check_param_count_with_error(uint param_count) const; -}; - - -/////////////////////////////////////////////////////////////////////////// - -/// This class represents 'DECLARE HANDLER' statement. - -class sp_handler : public Sql_alloc -{ -public: - /// Enumeration of possible handler types. - /// Note: UNDO handlers are not (and have never been) supported. - enum enum_type - { - EXIT, - CONTINUE - }; - - /// Handler type. - enum_type type; - - /// Conditions caught by this handler. - List condition_values; - -public: - /// The constructor. - /// - /// @param _type SQL-handler type. - sp_handler(enum_type _type) - :Sql_alloc(), - type(_type) - { } -}; - -/////////////////////////////////////////////////////////////////////////// - -/// The class represents parse-time context, which keeps track of declared -/// variables/parameters, conditions, handlers, cursors and labels. -/// -/// sp_pcontext objects are organized in a tree according to the following -/// rules: -/// - one sp_pcontext object corresponds for for each BEGIN..END block; -/// - one sp_pcontext object corresponds for each exception handler; -/// - one additional sp_pcontext object is created to contain -/// Stored Program parameters. -/// -/// sp_pcontext objects are used both at parse-time and at runtime. -/// -/// During the parsing stage sp_pcontext objects are used: -/// - to look up defined names (e.g. declared variables and visible -/// labels); -/// - to check for duplicates; -/// - for error checking; -/// - to calculate offsets to be used at runtime. -/// -/// During the runtime phase, a tree of sp_pcontext objects is used: -/// - for error checking (e.g. to check correct number of parameters); -/// - to resolve SQL-handlers. - -class sp_pcontext : public Sql_alloc -{ -public: - enum enum_scope - { - /// REGULAR_SCOPE designates regular BEGIN ... END blocks. - REGULAR_SCOPE, - - /// HANDLER_SCOPE designates SQL-handler blocks. - HANDLER_SCOPE - }; - - class Lex_for_loop: public Lex_for_loop_st - { - public: - Lex_for_loop() { init(); } - }; - -public: - sp_pcontext(); - ~sp_pcontext(); - - - /// Create and push a new context in the tree. - - /// @param thd thread context. - /// @param scope scope of the new parsing context. - /// @return the node created. - sp_pcontext *push_context(THD *thd, enum_scope scope); - - /// Pop a node from the parsing context tree. - /// @return the parent node. - sp_pcontext *pop_context(); - - sp_pcontext *parent_context() const - { return m_parent; } - - sp_pcontext *child_context(uint i) const - { return i < m_children.elements() ? m_children.at(i) : NULL; } - - /// Calculate and return the number of handlers to pop between the given - /// context and this one. - /// - /// @param ctx the other parsing context. - /// @param exclusive specifies if the last scope should be excluded. - /// - /// @return the number of handlers to pop between the given context and - /// this one. If 'exclusive' is true, don't count the last scope we are - /// leaving; this is used for LEAVE where we will jump to the hpop - /// instructions. - uint diff_handlers(const sp_pcontext *ctx, bool exclusive) const; - - /// Calculate and return the number of cursors to pop between the given - /// context and this one. - /// - /// @param ctx the other parsing context. - /// @param exclusive specifies if the last scope should be excluded. - /// - /// @return the number of cursors to pop between the given context and - /// this one. If 'exclusive' is true, don't count the last scope we are - /// leaving; this is used for LEAVE where we will jump to the cpop - /// instructions. - uint diff_cursors(const sp_pcontext *ctx, bool exclusive) const; - - ///////////////////////////////////////////////////////////////////////// - // SP-variables (parameters and variables). - ///////////////////////////////////////////////////////////////////////// - - /// @return the maximum number of variables used in this and all child - /// contexts. For the root parsing context, this gives us the number of - /// slots needed for variables during the runtime phase. - uint max_var_index() const - { return m_max_var_index; } - - /// @return the current number of variables used in the parent contexts - /// (from the root), including this context. - uint current_var_count() const - { return m_var_offset + (uint)m_vars.elements(); } - - /// @return the number of variables in this context alone. - uint context_var_count() const - { return (uint)m_vars.elements(); } - - /// return the i-th variable on the current context - sp_variable *get_context_variable(uint i) const - { - DBUG_ASSERT(i < m_vars.elements()); - return m_vars.at(i); - } - - /* - Return the i-th last context variable. - If i is 0, then return the very last variable in m_vars. - */ - sp_variable *get_last_context_variable(uint i= 0) const - { - DBUG_ASSERT(i < m_vars.elements()); - return m_vars.at(m_vars.elements() - i - 1); - } - - /// Add SP-variable to the parsing context. - /// - /// @param thd Thread context. - /// @param name Name of the SP-variable. - /// - /// @return instance of newly added SP-variable. - sp_variable *add_variable(THD *thd, const LEX_CSTRING *name); - - /// Retrieve full type information about SP-variables in this parsing - /// context and its children. - /// - /// @param field_def_lst[out] Container to store type information. - void retrieve_field_definitions(List *field_def_lst) const; - - /// Find SP-variable by name. - /// - /// The function does a linear search (from newer to older variables, - /// in case we have shadowed names). - /// - /// The function is called only at parsing time. - /// - /// @param name Variable name. - /// @param current_scope_only A flag if we search only in current scope. - /// - /// @return instance of found SP-variable, or NULL if not found. - sp_variable *find_variable(const LEX_CSTRING *name, bool current_scope_only) const; - - /// Find SP-variable by the offset in the root parsing context. - /// - /// The function is used for two things: - /// - When evaluating parameters at the beginning, and setting out parameters - /// at the end, of invocation. (Top frame only, so no recursion then.) - /// - For printing of sp_instr_set. (Debug mode only.) - /// - /// @param offset Variable offset in the root parsing context. - /// - /// @return instance of found SP-variable, or NULL if not found. - sp_variable *find_variable(uint offset) const; - - /// Set the current scope boundary (for default values). - /// - /// @param n The number of variables to skip. - void declare_var_boundary(uint n) - { m_pboundary= n; } - - ///////////////////////////////////////////////////////////////////////// - // CASE expressions. - ///////////////////////////////////////////////////////////////////////// - - int register_case_expr() - { return m_num_case_exprs++; } - - int get_num_case_exprs() const - { return m_num_case_exprs; } - - bool push_case_expr_id(int case_expr_id) - { return m_case_expr_ids.append(case_expr_id); } - - void pop_case_expr_id() - { m_case_expr_ids.pop(); } - - int get_current_case_expr_id() const - { return *m_case_expr_ids.back(); } - - ///////////////////////////////////////////////////////////////////////// - // Labels. - ///////////////////////////////////////////////////////////////////////// - - sp_label *push_label(THD *thd, const LEX_CSTRING *name, uint ip, - sp_label::enum_type type, List * list); - - sp_label *push_label(THD *thd, const LEX_CSTRING *name, uint ip, - sp_label::enum_type type) - { return push_label(thd, name, ip, type, &m_labels); } - - sp_label *push_goto_label(THD *thd, const LEX_CSTRING *name, uint ip, - sp_label::enum_type type) - { return push_label(thd, name, ip, type, &m_goto_labels); } - - sp_label *push_label(THD *thd, const LEX_CSTRING *name, uint ip) - { return push_label(thd, name, ip, sp_label::IMPLICIT); } - - sp_label *push_goto_label(THD *thd, const LEX_CSTRING *name, uint ip) - { return push_goto_label(thd, name, ip, sp_label::GOTO); } - - sp_label *find_label(const LEX_CSTRING *name); - - sp_label *find_goto_label(const LEX_CSTRING *name, bool recusive); - - sp_label *find_goto_label(const LEX_CSTRING *name) - { return find_goto_label(name, true); } - - sp_label *find_label_current_loop_start(); - - sp_label *last_label() - { - sp_label *label= m_labels.head(); - - if (!label && m_parent) - label= m_parent->last_label(); - - return label; - } - - sp_label *last_goto_label() - { - return m_goto_labels.head(); - } - - sp_label *pop_label() - { return m_labels.pop(); } - - bool block_label_declare(LEX_CSTRING *label) - { - sp_label *lab= find_label(label); - if (lab) - { - my_error(ER_SP_LABEL_REDEFINE, MYF(0), label->str); - return true; - } - return false; - } - - ///////////////////////////////////////////////////////////////////////// - // Conditions. - ///////////////////////////////////////////////////////////////////////// - - bool add_condition(THD *thd, const LEX_CSTRING *name, - sp_condition_value *value); - - /// See comment for find_variable() above. - sp_condition_value *find_condition(const LEX_CSTRING *name, - bool current_scope_only) const; - - sp_condition_value * - find_declared_or_predefined_condition(THD *thd, const LEX_CSTRING *name) const; - - bool declare_condition(THD *thd, const LEX_CSTRING *name, - sp_condition_value *val) - { - if (find_condition(name, true)) - { - my_error(ER_SP_DUP_COND, MYF(0), name->str); - return true; - } - return add_condition(thd, name, val); - } - - ///////////////////////////////////////////////////////////////////////// - // Handlers. - ///////////////////////////////////////////////////////////////////////// - - sp_handler *add_handler(THD* thd, sp_handler::enum_type type); - - /// This is an auxilary parsing-time function to check if an SQL-handler - /// exists in the current parsing context (current scope) for the given - /// SQL-condition. This function is used to check for duplicates during - /// the parsing phase. - /// - /// This function can not be used during the runtime phase to check - /// SQL-handler existence because it searches for the SQL-handler in the - /// current scope only (during runtime, current and parent scopes - /// should be checked according to the SQL-handler resolution rules). - /// - /// @param condition_value the handler condition value - /// (not SQL-condition!). - /// - /// @retval true if such SQL-handler exists. - /// @retval false otherwise. - bool check_duplicate_handler(const sp_condition_value *cond_value) const; - - /// Find an SQL handler for the given SQL condition according to the - /// SQL-handler resolution rules. This function is used at runtime. - /// - /// @param value The error code and the SQL state - /// @param level The SQL condition level - /// - /// @return a pointer to the found SQL-handler or NULL. - sp_handler *find_handler(const Sql_condition_identity &identity) const; - - ///////////////////////////////////////////////////////////////////////// - // Cursors. - ///////////////////////////////////////////////////////////////////////// - - bool add_cursor(const LEX_CSTRING *name, sp_pcontext *param_ctx, - class sp_lex_cursor *lex); - - /// See comment for find_variable() above. - const sp_pcursor *find_cursor(const LEX_CSTRING *name, - uint *poff, bool current_scope_only) const; - - const sp_pcursor *find_cursor_with_error(const LEX_CSTRING *name, - uint *poff, - bool current_scope_only) const - { - const sp_pcursor *pcursor= find_cursor(name, poff, current_scope_only); - if (!pcursor) - { - my_error(ER_SP_CURSOR_MISMATCH, MYF(0), name->str); - return NULL; - } - return pcursor; - } - /// Find cursor by offset (for SHOW {PROCEDURE|FUNCTION} CODE only). - const sp_pcursor *find_cursor(uint offset) const; - - const sp_pcursor *get_cursor_by_local_frame_offset(uint offset) const - { return &m_cursors.at(offset); } - - uint cursor_offset() const - { return m_cursor_offset; } - - uint frame_cursor_count() const - { return (uint)m_cursors.elements(); } - - uint max_cursor_index() const - { return m_max_cursor_index + (uint)m_cursors.elements(); } - - uint current_cursor_count() const - { return m_cursor_offset + (uint)m_cursors.elements(); } - - void set_for_loop(const Lex_for_loop_st &for_loop) - { - m_for_loop.init(for_loop); - } - const Lex_for_loop_st &for_loop() - { - return m_for_loop; - } - -private: - /// Constructor for a tree node. - /// @param prev the parent parsing context - /// @param scope scope of this parsing context - sp_pcontext(sp_pcontext *prev, enum_scope scope); - - void init(uint var_offset, uint cursor_offset, int num_case_expressions); - - /* Prevent use of these */ - sp_pcontext(const sp_pcontext &); - void operator=(sp_pcontext &); - - sp_condition_value *find_predefined_condition(const LEX_CSTRING *name) const; - -private: - /// m_max_var_index -- number of variables (including all types of arguments) - /// in this context including all children contexts. - /// - /// m_max_var_index >= m_vars.elements(). - /// - /// m_max_var_index of the root parsing context contains number of all - /// variables (including arguments) in all enclosed contexts. - uint m_max_var_index; - - /// The maximum sub context's framesizes. - uint m_max_cursor_index; - - /// Parent context. - sp_pcontext *m_parent; - - /// An index of the first SP-variable in this parsing context. The index - /// belongs to a runtime table of SP-variables. - /// - /// Note: - /// - m_var_offset is 0 for root parsing context; - /// - m_var_offset is different for all nested parsing contexts. - uint m_var_offset; - - /// Cursor offset for this context. - uint m_cursor_offset; - - /// Boundary for finding variables in this context. This is the number of - /// variables currently "invisible" to default clauses. This is normally 0, - /// but will be larger during parsing of DECLARE ... DEFAULT, to get the - /// scope right for DEFAULT values. - uint m_pboundary; - - int m_num_case_exprs; - - /// SP parameters/variables. - Dynamic_array m_vars; - - /// Stack of CASE expression ids. - Dynamic_array m_case_expr_ids; - - /// Stack of SQL-conditions. - Dynamic_array m_conditions; - - /// Stack of cursors. - Dynamic_array m_cursors; - - /// Stack of SQL-handlers. - Dynamic_array m_handlers; - - /* - In the below example the label <> has two meanings: - - GOTO lab : must go before the beginning of the loop - - CONTINUE lab : must go to the beginning of the loop - We solve this by storing block labels and goto labels into separate lists. - - BEGIN - <> - FOR i IN a..10 LOOP - ... - GOTO lab; - ... - CONTINUE lab; - ... - END LOOP; - END; - */ - /// List of block labels - List m_labels; - /// List of goto labels - List m_goto_labels; - - /// Children contexts, used for destruction. - Dynamic_array m_children; - - /// Scope of this parsing context. - enum_scope m_scope; - - /// FOR LOOP characteristics - Lex_for_loop m_for_loop; -}; // class sp_pcontext : public Sql_alloc - - -#endif /* _SP_PCONTEXT_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_rcontext.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_rcontext.h deleted file mode 100644 index 0e0e892..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sp_rcontext.h +++ /dev/null @@ -1,407 +0,0 @@ -/* -*- C++ -*- */ -/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _SP_RCONTEXT_H_ -#define _SP_RCONTEXT_H_ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_class.h" // select_result_interceptor -#include "sp_pcontext.h" // sp_condition_value - -/////////////////////////////////////////////////////////////////////////// -// sp_rcontext declaration. -/////////////////////////////////////////////////////////////////////////// - -class sp_cursor; -class sp_lex_keeper; -class sp_instr_cpush; -class sp_instr_hpush_jump; -class Query_arena; -class sp_head; -class Item_cache; -class Virtual_tmp_table; - - -/* - This class is a runtime context of a Stored Routine. It is used in an - execution and is intended to contain all dynamic objects (i.e. objects, which - can be changed during execution), such as: - - stored routine variables; - - cursors; - - handlers; - - Runtime context is used with sp_head class. sp_head class is intended to - contain all static things, related to the stored routines (code, for example). - sp_head instance creates runtime context for the execution of a stored - routine. - - There is a parsing context (an instance of sp_pcontext class), which is used - on parsing stage. However, now it contains some necessary for an execution - things, such as definition of used stored routine variables. That's why - runtime context needs a reference to the parsing context. -*/ - -class sp_rcontext : public Sql_alloc -{ -public: - /// Construct and properly initialize a new sp_rcontext instance. The static - /// create-function is needed because we need a way to return an error from - /// the constructor. - /// - /// @param thd Thread handle. - /// @param root_parsing_ctx Top-level parsing context for this stored program. - /// @param return_value_fld Field object to store the return value - /// (for stored functions only). - /// - /// @return valid sp_rcontext object or NULL in case of OOM-error. - static sp_rcontext *create(THD *thd, - const sp_head *owner, - const sp_pcontext *root_parsing_ctx, - Field *return_value_fld, - Row_definition_list &defs); - - ~sp_rcontext(); - -private: - sp_rcontext(const sp_head *owner, - const sp_pcontext *root_parsing_ctx, - Field *return_value_fld, - bool in_sub_stmt); - - // Prevent use of copying constructor and operator. - sp_rcontext(const sp_rcontext &); - void operator=(sp_rcontext &); - -public: - /// This class stores basic information about SQL-condition, such as: - /// - SQL error code; - /// - error level; - /// - SQLSTATE; - /// - text message. - /// - /// It's used to organize runtime SQL-handler call stack. - /// - /// Standard Sql_condition class can not be used, because we don't always have - /// an Sql_condition object for an SQL-condition in Diagnostics_area. - /// - /// Eventually, this class should be moved to sql_error.h, and be a part of - /// standard SQL-condition processing (Diagnostics_area should contain an - /// object for active SQL-condition, not just information stored in DA's - /// fields). - class Sql_condition_info : public Sql_alloc, - public Sql_condition_identity - { - public: - /// Text message. - char *message; - - /// The constructor. - /// - /// @param _sql_condition The SQL condition. - /// @param arena Query arena for SP - Sql_condition_info(const Sql_condition *_sql_condition, - Query_arena *arena) - :Sql_condition_identity(*_sql_condition) - { - message= strdup_root(arena->mem_root, _sql_condition->get_message_text()); - } - }; - -private: - /// This class represents a call frame of SQL-handler (one invocation of a - /// handler). Basically, it's needed to store continue instruction pointer for - /// CONTINUE SQL-handlers. - class Handler_call_frame : public Sql_alloc - { - public: - /// SQL-condition, triggered handler activation. - const Sql_condition_info *sql_condition; - - /// Continue-instruction-pointer for CONTINUE-handlers. - /// The attribute contains 0 for EXIT-handlers. - uint continue_ip; - - /// The constructor. - /// - /// @param _sql_condition SQL-condition, triggered handler activation. - /// @param _continue_ip Continue instruction pointer. - Handler_call_frame(const Sql_condition_info *_sql_condition, - uint _continue_ip) - :sql_condition(_sql_condition), - continue_ip(_continue_ip) - { } - }; - -public: - /// Arena used to (re) allocate items on. E.g. reallocate INOUT/OUT - /// SP-variables when they don't fit into prealloced items. This is common - /// situation with String items. It is used mainly in sp_eval_func_item(). - Query_arena *callers_arena; - - /// Flag to end an open result set before start executing an SQL-handler - /// (if one is found). Otherwise the client will hang due to a violation - /// of the client/server protocol. - bool end_partial_result_set; - bool pause_state; - bool quit_func; - uint instr_ptr; - - /// The stored program for which this runtime context is created. Used for - /// checking if correct runtime context is used for variable handling, - /// and to access the package run-time context. - /// Also used by slow log. - const sp_head *m_sp; - - ///////////////////////////////////////////////////////////////////////// - // SP-variables. - ///////////////////////////////////////////////////////////////////////// - - uint argument_count() const - { - return m_root_parsing_ctx->context_var_count(); - } - - int set_variable(THD *thd, uint var_idx, Item **value); - int set_variable_row_field(THD *thd, uint var_idx, uint field_idx, - Item **value); - int set_variable_row_field_by_name(THD *thd, uint var_idx, - const LEX_CSTRING &field_name, - Item **value); - int set_variable_row(THD *thd, uint var_idx, List &items); - - int set_parameter(THD *thd, uint var_idx, Item **value) - { - DBUG_ASSERT(var_idx < argument_count()); - return set_variable(thd, var_idx, value); - } - - Item_field *get_variable(uint var_idx) const - { return m_var_items[var_idx]; } - - Item **get_variable_addr(uint var_idx) const - { return ((Item **) m_var_items.array()) + var_idx; } - - Item_field *get_parameter(uint var_idx) const - { - DBUG_ASSERT(var_idx < argument_count()); - return get_variable(var_idx); - } - - bool find_row_field_by_name_or_error(uint *field_idx, uint var_idx, - const LEX_CSTRING &field_name); - - bool set_return_value(THD *thd, Item **return_value_item); - - bool is_return_value_set() const - { return m_return_value_set; } - - ///////////////////////////////////////////////////////////////////////// - // SQL-handlers. - ///////////////////////////////////////////////////////////////////////// - - /// Push an sp_instr_hpush_jump instance to the handler call stack. - /// - /// @param entry The condition handler entry - /// - /// @return error flag. - /// @retval false on success. - /// @retval true on error. - bool push_handler(sp_instr_hpush_jump *entry); - - /// Pop and delete given number of instances from the handler - /// call stack. - /// - /// @param count Number of handler entries to pop & delete. - void pop_handlers(size_t count); - - const Sql_condition_info *raised_condition() const - { - return m_handler_call_stack.elements() ? - (*m_handler_call_stack.back())->sql_condition : NULL; - } - - /// Handle current SQL condition (if any). - /// - /// This is the public-interface function to handle SQL conditions in - /// stored routines. - /// - /// @param thd Thread handle. - /// @param ip[out] Instruction pointer to the first handler - /// instruction. - /// @param cur_spi Current SP instruction. - /// - /// @retval true if an SQL-handler has been activated. That means, all of - /// the following conditions are satisfied: - /// - the SP-instruction raised SQL-condition(s), - /// - and there is an SQL-handler to process at least one of those - /// SQL-conditions, - /// - and that SQL-handler has been activated. - /// Note, that the return value has nothing to do with "error flag" - /// semantics. - /// - /// @retval false otherwise. - bool handle_sql_condition(THD *thd, - uint *ip, - const sp_instr *cur_spi); - - /// Remove latest call frame from the handler call stack. - /// - /// @param da Diagnostics area containing handled conditions. - /// - /// @return continue instruction pointer of the removed handler. - uint exit_handler(Diagnostics_area *da); - - ///////////////////////////////////////////////////////////////////////// - // Cursors. - ///////////////////////////////////////////////////////////////////////// - - /// Push a cursor to the cursor stack. - /// - /// @param cursor The cursor - /// - void push_cursor(sp_cursor *cur); - - void pop_cursor(THD *thd); - /// Pop and delete given number of sp_cursor instance from the cursor stack. - /// - /// @param count Number of cursors to pop & delete. - void pop_cursors(THD *thd, size_t count); - - void pop_all_cursors(THD *thd) - { pop_cursors(thd, m_ccount); } - - sp_cursor *get_cursor(uint i) const - { return m_cstack[i]; } - - ///////////////////////////////////////////////////////////////////////// - // CASE expressions. - ///////////////////////////////////////////////////////////////////////// - - /// Set CASE expression to the specified value. - /// - /// @param thd Thread handler. - /// @param case_expr_id The CASE expression identifier. - /// @param case_expr_item The CASE expression value - /// - /// @return error flag. - /// @retval false on success. - /// @retval true on error. - /// - /// @note The idea is to reuse Item_cache for the expression of the one - /// CASE statement. This optimization takes place when there is CASE - /// statement inside of a loop. So, in other words, we will use the same - /// object on each iteration instead of creating a new one for each - /// iteration. - /// - /// TODO - /// Hypothetically, a type of CASE expression can be different for each - /// iteration. For instance, this can happen if the expression contains - /// a session variable (something like @@VAR) and its type is changed - /// from one iteration to another. - /// - /// In order to cope with this problem, we check type each time, when we - /// use already created object. If the type does not match, we re-create - /// Item. This also can (should?) be optimized. - bool set_case_expr(THD *thd, int case_expr_id, Item **case_expr_item_ptr); - - Item *get_case_expr(int case_expr_id) const - { return m_case_expr_holders[case_expr_id]; } - - Item ** get_case_expr_addr(int case_expr_id) const - { return (Item**) m_case_expr_holders.array() + case_expr_id; } - -private: - /// Internal function to allocate memory for arrays. - /// - /// @param thd Thread handle. - /// - /// @return error flag: false on success, true in case of failure. - bool alloc_arrays(THD *thd); - - /// Create and initialize a table to store SP-variables. - /// - /// param thd Thread handle. - /// - /// @return error flag. - /// @retval false on success. - /// @retval true on error. - bool init_var_table(THD *thd, List &defs); - - /// Create and initialize an Item-adapter (Item_field) for each SP-var field. - /// - /// param thd Thread handle. - /// - /// @return error flag. - /// @retval false on success. - /// @retval true on error. - bool init_var_items(THD *thd, List &defs); - - /// Create an instance of appropriate Item_cache class depending on the - /// specified type in the callers arena. - /// - /// @note We should create cache items in the callers arena, as they are - /// used between in several instructions. - /// - /// @param thd Thread handler. - /// @param item Item to get the expression type. - /// - /// @return Pointer to valid object on success, or NULL in case of error. - Item_cache *create_case_expr_holder(THD *thd, const Item *item) const; - - Virtual_tmp_table *virtual_tmp_table_for_row(uint idx); - -private: - /// Top-level (root) parsing context for this runtime context. - const sp_pcontext *m_root_parsing_ctx; - - /// Virtual table for storing SP-variables. - Virtual_tmp_table *m_var_table; - - /// Collection of Item_field proxies, each of them points to the - /// corresponding field in m_var_table. - Bounds_checked_array m_var_items; - - /// This is a pointer to a field, which should contain return value for - /// stored functions (only). For stored procedures, this pointer is NULL. - Field *m_return_value_fld; - - /// Indicates whether the return value (in m_return_value_fld) has been - /// set during execution. - bool m_return_value_set; - - /// Flag to tell if the runtime context is created for a sub-statement. - bool m_in_sub_stmt; - - /// Stack of visible handlers. - Dynamic_array m_handlers; - - /// Stack of caught SQL conditions. - Dynamic_array m_handler_call_stack; - - /// Stack of cursors. - Bounds_checked_array m_cstack; - - /// Current number of cursors in m_cstack. - uint m_ccount; - - /// Array of CASE expression holders. - Bounds_checked_array m_case_expr_holders; -}; // class sp_rcontext : public Sql_alloc - -#endif /* _SP_RCONTEXT_H_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/span.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/span.h deleted file mode 100644 index 0e85169..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/span.h +++ /dev/null @@ -1,161 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2019, 2020 MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -#pragma once - -#include -#include - -namespace st_ -{ - -namespace detail -{ - -template struct remove_cv -{ - typedef T type; -}; -template struct remove_cv -{ - typedef T type; -}; -template struct remove_cv -{ - typedef T type; -}; -template struct remove_cv -{ - typedef T type; -}; - -} // namespace detail - -template class span -{ -public: - typedef ElementType element_type; - typedef typename detail::remove_cv::type value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef element_type *pointer; - typedef const element_type *const_pointer; - typedef element_type &reference; - typedef const element_type &const_reference; - typedef pointer iterator; - typedef const_pointer const_iterator; - typedef std::reverse_iterator reverse_iterator; - - span() : data_(NULL), size_(0) {} - - span(pointer ptr, size_type count) : data_(ptr), size_(count) {} - - span(pointer first, pointer last) : data_(first), size_(last - first) {} - - template span(element_type (&arr)[N]) : data_(arr), size_(N) {} - - template - span(Container &cont) : data_(cont.data()), size_(cont.size()) - { - } - - template - span(const Container &cont) : data_(cont.data()), size_(cont.size()) - { - } - - span(const span &other) : data_(other.data_), size_(other.size_) {} - - ~span(){}; - - span &operator=(const span &other) - { - data_= other.data(); - size_= other.size(); - return *this; - } - - template span first() const - { - assert(!empty()); - return span(data(), 1); - } - template span last() const - { - assert(!empty()); - return span(data() + size() - 1, 1); - } - - span first(size_type count) const - { - assert(!empty()); - return span(data(), 1); - } - span last(size_type count) const - { - assert(!empty()); - return span(data() + size() - 1, 1); - } - span subspan(size_type offset, size_type count) const - { - assert(!empty()); - assert(size() >= offset + count); - return span(data() + offset, count); - } - - size_type size() const { return size_; } - size_type size_bytes() const { return size() * sizeof(ElementType); } - bool empty() const __attribute__((warn_unused_result)) - { - return size() == 0; - } - - reference operator[](size_type idx) const - { - assert(size() > idx); - return data()[idx]; - } - reference front() const - { - assert(!empty()); - return data()[0]; - } - reference back() const - { - assert(!empty()); - return data()[size() - 1]; - } - pointer data() const { return data_; } - - iterator begin() const { return data_; } - iterator end() const { return data_ + size_; } - reverse_iterator rbegin() const - { - return std::reverse_iterator(end()); - } - reverse_iterator rend() const - { - return std::reverse_iterator(begin()); - } - -private: - pointer data_; - size_type size_; -}; - -} // namespace st_ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/spatial.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/spatial.h deleted file mode 100644 index 0b998e2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/spatial.h +++ /dev/null @@ -1,633 +0,0 @@ -/* - Copyright (c) 2002, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2013, Monty Program Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _spatial_h -#define _spatial_h - -#include "sql_string.h" /* String, LEX_STRING */ -#include -#include - -#ifdef HAVE_SPATIAL - -class Gis_read_stream; - -#include "gcalc_tools.h" - -const uint SRID_SIZE= 4; -const uint SIZEOF_STORED_DOUBLE= 8; -const uint POINT_DATA_SIZE= (SIZEOF_STORED_DOUBLE * 2); -const uint WKB_HEADER_SIZE= 1+4; -const uint32 GET_SIZE_ERROR= ((uint32) -1); - -struct st_point_2d -{ - double x; - double y; -}; - -struct st_linear_ring -{ - uint32 n_points; - st_point_2d points; -}; - -/***************************** MBR *******************************/ - - -/* - It's ok that a lot of the functions are inline as these are only used once - in MySQL -*/ - -struct MBR -{ - double xmin, ymin, xmax, ymax; - - MBR() - { - xmin= ymin= DBL_MAX; - xmax= ymax= -DBL_MAX; - } - - MBR(const double xmin_arg, const double ymin_arg, - const double xmax_arg, const double ymax_arg) - :xmin(xmin_arg), ymin(ymin_arg), xmax(xmax_arg), ymax(ymax_arg) - {} - - MBR(const st_point_2d &min, const st_point_2d &max) - :xmin(min.x), ymin(min.y), xmax(max.x), ymax(max.y) - {} - - MBR(const MBR &mbr1, const MBR &mbr2) - :xmin(mbr1.xmin), ymin(mbr1.ymin), xmax(mbr1.xmax), ymax(mbr1.ymax) - { add_mbr(&mbr2); } - - inline void add_xy(double x, double y) - { - /* Not using "else" for proper one point MBR calculation */ - if (x < xmin) - xmin= x; - if (x > xmax) - xmax= x; - if (y < ymin) - ymin= y; - if (y > ymax) - ymax= y; - } - void add_xy(const char *px, const char *py) - { - double x, y; - float8get(x, px); - float8get(y, py); - add_xy(x,y); - } - void add_mbr(const MBR *mbr) - { - if (mbr->xmin < xmin) - xmin= mbr->xmin; - if (mbr->xmax > xmax) - xmax= mbr->xmax; - if (mbr->ymin < ymin) - ymin= mbr->ymin; - if (mbr->ymax > ymax) - ymax= mbr->ymax; - } - void buffer(double d) - { - xmin-= d; - ymin-= d; - xmax+= d; - ymax+= d; - } - - int equals(const MBR *mbr) - { - /* The following should be safe, even if we compare doubles */ - return ((mbr->xmin == xmin) && (mbr->ymin == ymin) && - (mbr->xmax == xmax) && (mbr->ymax == ymax)); - } - - int disjoint(const MBR *mbr) - { - /* The following should be safe, even if we compare doubles */ - return ((mbr->xmin > xmax) || (mbr->ymin > ymax) || - (mbr->xmax < xmin) || (mbr->ymax < ymin)); - } - - int intersects(const MBR *mbr) - { - return !disjoint(mbr); - } - - int touches(const MBR *mbr) - { - /* The following should be safe, even if we compare doubles */ - return ((mbr->xmin == xmax || mbr->xmax == xmin) && - ((mbr->ymin >= ymin && mbr->ymin <= ymax) || - (mbr->ymax >= ymin && mbr->ymax <= ymax))) || - ((mbr->ymin == ymax || mbr->ymax == ymin) && - ((mbr->xmin >= xmin && mbr->xmin <= xmax) || - (mbr->xmax >= xmin && mbr->xmax <= xmax))); - } - - int within(const MBR *mbr); - - int contains(const MBR *mbr) - { - /* The following should be safe, even if we compare doubles */ - return ((mbr->xmin >= xmin) && (mbr->ymin >= ymin) && - (mbr->xmax <= xmax) && (mbr->ymax <= ymax)); - } - - bool inner_point(double x, double y) const - { - /* The following should be safe, even if we compare doubles */ - return (xminx) && (yminy); - } - - /** - The dimension maps to an integer as: - - Polygon -> 2 - - Horizontal or vertical line -> 1 - - Point -> 0 - - Invalid MBR -> -1 - */ - int dimension() const - { - int d= 0; - - if (xmin > xmax) - return -1; - else if (xmin < xmax) - d++; - - if (ymin > ymax) - return -1; - else if (ymin < ymax) - d++; - - return d; - } - - int overlaps(const MBR *mbr) - { - /* - overlaps() requires that some point inside *this is also inside - *mbr, and that both geometries and their intersection are of the - same dimension. - */ - int d = dimension(); - - if (d != mbr->dimension() || d <= 0 || contains(mbr) || within(mbr)) - return 0; - - MBR intersection(MY_MAX(xmin, mbr->xmin), MY_MAX(ymin, mbr->ymin), - MY_MIN(xmax, mbr->xmax), MY_MIN(ymax, mbr->ymax)); - - return (d == intersection.dimension()); - } - - int valid() const - { return xmin <= xmax && ymin <= ymax; } -}; - - -/***************************** Geometry *******************************/ - -struct Geometry_buffer; - -class Geometry -{ -public: - Geometry() {} /* Remove gcc warning */ - virtual ~Geometry() {} /* Remove gcc warning */ - static void *operator new(size_t size, void *buffer) - { - return buffer; - } - - static void operator delete(void *ptr, void *buffer) - {} - - static void operator delete(void *buffer) - {} - - static String bad_geometry_data; - - enum wkbType - { - wkb_point= 1, - wkb_linestring= 2, - wkb_polygon= 3, - wkb_multipoint= 4, - wkb_multilinestring= 5, - wkb_multipolygon= 6, - wkb_geometrycollection= 7, - wkb_last=7 - }; - enum wkbByteOrder - { - wkb_xdr= 0, /* Big Endian */ - wkb_ndr= 1 /* Little Endian */ - }; - enum geojson_errors - { - GEOJ_INCORRECT_GEOJSON= 1, - GEOJ_TOO_FEW_POINTS= 2, - GEOJ_POLYGON_NOT_CLOSED= 3, - GEOJ_DIMENSION_NOT_SUPPORTED= 4, - GEOJ_EMPTY_COORDINATES= 5, - }; - - - /** Callback which creates Geometry objects on top of a given placement. */ - typedef Geometry *(*create_geom_t)(char *); - - class Class_info - { - public: - LEX_STRING m_name; - LEX_STRING m_geojson_name; - int m_type_id; - create_geom_t m_create_func; - Class_info(const char *name, const char *gejson_name, - int type_id, create_geom_t create_func); - }; - - virtual const Class_info *get_class_info() const=0; - virtual uint32 get_data_size() const=0; - virtual bool init_from_wkt(Gis_read_stream *trs, String *wkb)=0; - /* returns the length of the wkb that was read */ - virtual uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, - String *res)=0; - virtual uint init_from_opresult(String *bin, - const char *opres, uint res_len) - { return init_from_wkb(opres + 4, UINT_MAX32, wkb_ndr, bin) + 4; } - virtual bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb) - { return true; } - - virtual bool get_data_as_wkt(String *txt, const char **end) const=0; - virtual bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const=0; - virtual bool get_mbr(MBR *mbr, const char **end) const=0; - virtual bool dimension(uint32 *dim, const char **end) const=0; - virtual int get_x(double *x) const { return -1; } - virtual int get_y(double *y) const { return -1; } - virtual int geom_length(double *len, const char **end) const { return -1; } - virtual int area(double *ar, const char **end) const { return -1;} - virtual int is_closed(int *closed) const { return -1; } - virtual int num_interior_ring(uint32 *n_int_rings) const { return -1; } - virtual int num_points(uint32 *n_points) const { return -1; } - virtual int num_geometries(uint32 *num) const { return -1; } - virtual int start_point(String *point) const { return -1; } - virtual int end_point(String *point) const { return -1; } - virtual int exterior_ring(String *ring) const { return -1; } - virtual int centroid(String *point) const { return -1; } - virtual int point_n(uint32 num, String *result) const { return -1; } - virtual int interior_ring_n(uint32 num, String *result) const { return -1; } - virtual int geometry_n(uint32 num, String *result) const { return -1; } - virtual int store_shapes(Gcalc_shape_transporter *trn) const=0; - -public: - static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id); - - static Geometry *construct(Geometry_buffer *buffer, - const char *data, uint32 data_len); - static Geometry *create_from_wkt(Geometry_buffer *buffer, - Gis_read_stream *trs, String *wkt, - bool init_stream=1); - static Geometry *create_from_wkb(Geometry_buffer *buffer, - const char *wkb, uint32 len, String *res); - static Geometry *create_from_json(Geometry_buffer *buffer, json_engine_t *je, - bool er_on_3D, String *res); - static Geometry *create_from_opresult(Geometry_buffer *g_buf, - String *res, Gcalc_result_receiver &rr); - static uint get_key_image_itMBR(LEX_CSTRING &src, uchar *buff, uint length); - int as_wkt(String *wkt, const char **end); - int as_json(String *wkt, uint max_dec_digits, const char **end); - int bbox_as_json(String *wkt); - - inline void set_data_ptr(const char *data, uint32 data_len) - { - m_data= data; - m_data_end= data + data_len; - } - - inline void shift_wkb_header() - { - m_data+= WKB_HEADER_SIZE; - } - - bool envelope(String *result) const; - static Class_info *ci_collection[wkb_last+1]; - - static bool create_point(String *result, double x, double y); -protected: - static Class_info *find_class(int type_id) - { - return ((type_id < wkb_point) || (type_id > wkb_last)) ? - NULL : ci_collection[type_id]; - } - static Class_info *find_class(const char *name, size_t len); - const char *append_points(String *txt, uint32 n_points, - const char *data, uint32 offset) const; - bool create_point(String *result, const char *data) const; - const char *get_mbr_for_points(MBR *mbr, const char *data, uint offset) - const; - - /** - Check if there're enough data remaining as requested - - @arg cur_data pointer to the position in the binary form - @arg data_amount number of points expected - @return true if not enough data - */ - inline bool no_data(const char *cur_data, size_t data_amount) const - { - return (cur_data + data_amount > m_data_end); - } - - /** - Check if there're enough points remaining as requested - - Need to perform the calculation in logical units, since multiplication - can overflow the size data type. - - @arg data pointer to the beginning of the points array - @arg expected_points number of points expected - @arg extra_point_space extra space for each point element in the array - @return true if there are not enough points - */ - inline bool not_enough_points(const char *data, uint32 expected_points, - uint32 extra_point_space = 0) const - { - return (m_data_end < data || - (expected_points > ((m_data_end - data) / - (POINT_DATA_SIZE + extra_point_space)))); - } - const char *m_data; - const char *m_data_end; -}; - - -/***************************** Point *******************************/ - -class Gis_point: public Geometry -{ -public: - Gis_point() {} /* Remove gcc warning */ - virtual ~Gis_point() {} /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; - bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - - int get_xy(double *x, double *y) const - { - const char *data= m_data; - if (no_data(data, SIZEOF_STORED_DOUBLE * 2)) - return 1; - float8get(*x, data); - float8get(*y, data + SIZEOF_STORED_DOUBLE); - return 0; - } - - int get_x(double *x) const - { - if (no_data(m_data, SIZEOF_STORED_DOUBLE)) - return 1; - float8get(*x, m_data); - return 0; - } - - int get_y(double *y) const - { - const char *data= m_data; - if (no_data(data, SIZEOF_STORED_DOUBLE * 2)) return 1; - float8get(*y, data + SIZEOF_STORED_DOUBLE); - return 0; - } - - int geom_length(double *len, const char **end) const; - int area(double *ar, const char **end) const; - bool dimension(uint32 *dim, const char **end) const - { - *dim= 0; - *end= 0; /* No default end */ - return 0; - } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; -}; - - -/***************************** LineString *******************************/ - -class Gis_line_string: public Geometry -{ -public: - Gis_line_string() {} /* Remove gcc warning */ - virtual ~Gis_line_string() {} /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; - bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int geom_length(double *len, const char **end) const; - int area(double *ar, const char **end) const; - int is_closed(int *closed) const; - int num_points(uint32 *n_points) const; - int start_point(String *point) const; - int end_point(String *point) const; - int point_n(uint32 n, String *result) const; - bool dimension(uint32 *dim, const char **end) const - { - *dim= 1; - *end= 0; /* No default end */ - return 0; - } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; -}; - - -/***************************** Polygon *******************************/ - -class Gis_polygon: public Geometry -{ -public: - Gis_polygon() {} /* Remove gcc warning */ - virtual ~Gis_polygon() {} /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - uint init_from_opresult(String *bin, const char *opres, uint res_len); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; - bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int area(double *ar, const char **end) const; - int exterior_ring(String *result) const; - int num_interior_ring(uint32 *n_int_rings) const; - int interior_ring_n(uint32 num, String *result) const; - int centroid_xy(double *x, double *y) const; - int centroid(String *result) const; - bool dimension(uint32 *dim, const char **end) const - { - *dim= 2; - *end= 0; /* No default end */ - return 0; - } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; -}; - - -/***************************** MultiPoint *******************************/ - -class Gis_multi_point: public Geometry -{ - // Maximum number of points in MultiPoint that can fit into String - static const uint32 max_n_points= - (uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) / - (WKB_HEADER_SIZE + POINT_DATA_SIZE); -public: - Gis_multi_point() {} /* Remove gcc warning */ - virtual ~Gis_multi_point() {} /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - uint init_from_opresult(String *bin, const char *opres, uint res_len); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; - bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int num_geometries(uint32 *num) const; - int geometry_n(uint32 num, String *result) const; - bool dimension(uint32 *dim, const char **end) const - { - *dim= 0; - *end= 0; /* No default end */ - return 0; - } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; -}; - - -/***************************** MultiLineString *******************************/ - -class Gis_multi_line_string: public Geometry -{ -public: - Gis_multi_line_string() {} /* Remove gcc warning */ - virtual ~Gis_multi_line_string() {} /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - uint init_from_opresult(String *bin, const char *opres, uint res_len); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; - bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int num_geometries(uint32 *num) const; - int geometry_n(uint32 num, String *result) const; - int geom_length(double *len, const char **end) const; - int is_closed(int *closed) const; - bool dimension(uint32 *dim, const char **end) const - { - *dim= 1; - *end= 0; /* No default end */ - return 0; - } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; -}; - - -/***************************** MultiPolygon *******************************/ - -class Gis_multi_polygon: public Geometry -{ -public: - Gis_multi_polygon() {} /* Remove gcc warning */ - virtual ~Gis_multi_polygon() {} /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; - bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int num_geometries(uint32 *num) const; - int geometry_n(uint32 num, String *result) const; - int area(double *ar, const char **end) const; - int centroid(String *result) const; - bool dimension(uint32 *dim, const char **end) const - { - *dim= 2; - *end= 0; /* No default end */ - return 0; - } - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; - uint init_from_opresult(String *bin, const char *opres, uint res_len); -}; - - -/*********************** GeometryCollection *******************************/ - -class Gis_geometry_collection: public Geometry -{ -public: - Gis_geometry_collection() {} /* Remove gcc warning */ - virtual ~Gis_geometry_collection() {} /* Remove gcc warning */ - uint32 get_data_size() const; - bool init_from_wkt(Gis_read_stream *trs, String *wkb); - uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); - uint init_from_opresult(String *bin, const char *opres, uint res_len); - bool init_from_json(json_engine_t *je, bool er_on_3D, String *wkb); - bool get_data_as_wkt(String *txt, const char **end) const; - bool get_data_as_json(String *txt, uint max_dec_digits, - const char **end) const; - bool get_mbr(MBR *mbr, const char **end) const; - int area(double *ar, const char **end) const; - int geom_length(double *len, const char **end) const; - int num_geometries(uint32 *num) const; - int geometry_n(uint32 num, String *result) const; - bool dimension(uint32 *dim, const char **end) const; - int store_shapes(Gcalc_shape_transporter *trn) const; - const Class_info *get_class_info() const; -}; - -struct Geometry_buffer : public - my_aligned_storage {}; - -#endif /*HAVE_SPATIAL*/ -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_acl.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_acl.h deleted file mode 100644 index 570da14..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_acl.h +++ /dev/null @@ -1,376 +0,0 @@ -#ifndef SQL_ACL_INCLUDED -#define SQL_ACL_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "violite.h" /* SSL_type */ -#include "sql_class.h" /* LEX_COLUMN */ -#include "grant.h" -#include "sql_cmd.h" /* Sql_cmd */ - - -enum mysql_db_table_field -{ - MYSQL_DB_FIELD_HOST = 0, - MYSQL_DB_FIELD_DB, - MYSQL_DB_FIELD_USER, - MYSQL_DB_FIELD_SELECT_PRIV, - MYSQL_DB_FIELD_INSERT_PRIV, - MYSQL_DB_FIELD_UPDATE_PRIV, - MYSQL_DB_FIELD_DELETE_PRIV, - MYSQL_DB_FIELD_CREATE_PRIV, - MYSQL_DB_FIELD_DROP_PRIV, - MYSQL_DB_FIELD_GRANT_PRIV, - MYSQL_DB_FIELD_REFERENCES_PRIV, - MYSQL_DB_FIELD_INDEX_PRIV, - MYSQL_DB_FIELD_ALTER_PRIV, - MYSQL_DB_FIELD_CREATE_TMP_TABLE_PRIV, - MYSQL_DB_FIELD_LOCK_TABLES_PRIV, - MYSQL_DB_FIELD_CREATE_VIEW_PRIV, - MYSQL_DB_FIELD_SHOW_VIEW_PRIV, - MYSQL_DB_FIELD_CREATE_ROUTINE_PRIV, - MYSQL_DB_FIELD_ALTER_ROUTINE_PRIV, - MYSQL_DB_FIELD_EXECUTE_PRIV, - MYSQL_DB_FIELD_EVENT_PRIV, - MYSQL_DB_FIELD_TRIGGER_PRIV, - MYSQL_DB_FIELD_DELETE_VERSIONING_ROWS_PRIV, - MYSQL_DB_FIELD_COUNT -}; - -extern const TABLE_FIELD_DEF mysql_db_table_def; -extern bool mysql_user_table_is_in_short_password_format; - -extern LEX_CSTRING host_not_specified; -extern LEX_CSTRING current_user; -extern LEX_CSTRING current_role; -extern LEX_CSTRING current_user_and_current_role; - - -static inline int access_denied_error_code(int passwd_used) -{ -#ifdef mysqld_error_find_printf_error_used - return 0; -#else - return passwd_used == 2 ? ER_ACCESS_DENIED_NO_PASSWORD_ERROR - : ER_ACCESS_DENIED_ERROR; -#endif -} - -/* prototypes */ - -bool hostname_requires_resolving(const char *hostname); -bool acl_init(bool dont_read_acl_tables); -bool acl_reload(THD *thd); -void acl_free(bool end=0); -privilege_t acl_get(const char *host, const char *ip, - const char *user, const char *db, my_bool db_is_pattern); -bool acl_authenticate(THD *thd, uint com_change_user_pkt_len); -bool acl_getroot(Security_context *sctx, const char *user, const char *host, - const char *ip, const char *db); -bool acl_check_host(const char *host, const char *ip); -bool check_change_password(THD *thd, LEX_USER *user); -bool change_password(THD *thd, LEX_USER *user); - -bool mysql_grant_role(THD *thd, List &user_list, bool revoke); -bool mysql_grant(THD *thd, const char *db, List &user_list, - privilege_t rights, bool revoke, bool is_proxy); -int mysql_table_grant(THD *thd, TABLE_LIST *table, List &user_list, - List &column_list, privilege_t rights, - bool revoke); -bool mysql_routine_grant(THD *thd, TABLE_LIST *table, const Sp_handler *sph, - List &user_list, privilege_t rights, - bool revoke, bool write_to_binlog); -bool grant_init(); -void grant_free(void); -bool grant_reload(THD *thd); -bool check_grant(THD *thd, privilege_t want_access, TABLE_LIST *tables, - bool any_combination_will_do, uint number, bool no_errors); -bool check_grant_column (THD *thd, GRANT_INFO *grant, - const char *db_name, const char *table_name, - const char *name, size_t length, Security_context *sctx); -bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref, - const char *name, size_t length, Field *fld); -bool check_grant_all_columns(THD *thd, privilege_t want_access, - Field_iterator_table_ref *fields); -bool check_grant_routine(THD *thd, privilege_t want_access, - TABLE_LIST *procs, const Sp_handler *sph, - bool no_error); -bool check_grant_db(THD *thd,const char *db); -bool check_global_access(THD *thd, const privilege_t want_access, bool no_errors= false); -bool check_access(THD *thd, privilege_t want_access, - const char *db, privilege_t *save_priv, - GRANT_INTERNAL_INFO *grant_internal_info, - bool dont_check_global_grants, bool no_errors); -privilege_t get_table_grant(THD *thd, TABLE_LIST *table); -privilege_t get_column_grant(THD *thd, GRANT_INFO *grant, - const char *db_name, const char *table_name, - const char *field_name); -bool get_show_user(THD *thd, LEX_USER *lex_user, const char **username, - const char **hostname, const char **rolename); -void mysql_show_grants_get_fields(THD *thd, List *fields, - const char *name, size_t length); -bool mysql_show_grants(THD *thd, LEX_USER *user); -bool mysql_show_create_user(THD *thd, LEX_USER *user); -int fill_schema_enabled_roles(THD *thd, TABLE_LIST *tables, COND *cond); -int fill_schema_applicable_roles(THD *thd, TABLE_LIST *tables, COND *cond); -void get_privilege_desc(char *to, uint max_length, privilege_t access); -void get_mqh(const char *user, const char *host, USER_CONN *uc); -bool mysql_create_user(THD *thd, List &list, bool handle_as_role); -bool mysql_drop_user(THD *thd, List &list, bool handle_as_role); -bool mysql_rename_user(THD *thd, List &list); -int mysql_alter_user(THD *thd, List &list); -bool mysql_revoke_all(THD *thd, List &list); -void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, - const char *db, const char *table); -bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, - const Sp_handler *sph); -bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, - const Sp_handler *sph); -bool check_routine_level_acl(THD *thd, const char *db, const char *name, - const Sp_handler *sph); -bool is_acl_user(const char *host, const char *user); -int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond); -int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond); -int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond); -int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond); -int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr); - -/** - Result of an access check for an internal schema or table. - Internal ACL checks are always performed *before* using - the grant tables. - This mechanism enforces that the server implementation has full - control on its internal tables. - Depending on the internal check result, the server implementation - can choose to: - - always allow access, - - always deny access, - - delegate the decision to the database administrator, - by using the grant tables. -*/ -enum ACL_internal_access_result -{ - /** - Access granted for all the requested privileges, - do not use the grant tables. - */ - ACL_INTERNAL_ACCESS_GRANTED, - /** Access denied, do not use the grant tables. */ - ACL_INTERNAL_ACCESS_DENIED, - /** No decision yet, use the grant tables. */ - ACL_INTERNAL_ACCESS_CHECK_GRANT -}; - -/** - Per internal table ACL access rules. - This class is an interface. - Per table(s) specific access rule should be implemented in a subclass. - @sa ACL_internal_schema_access -*/ -class ACL_internal_table_access -{ -public: - ACL_internal_table_access() - {} - - virtual ~ACL_internal_table_access() - {} - - /** - Check access to an internal table. - When a privilege is granted, this method add the requested privilege - to save_priv. - @param want_access the privileges requested - @param [in, out] save_priv the privileges granted - @return - @retval ACL_INTERNAL_ACCESS_GRANTED All the requested privileges - are granted, and saved in save_priv. - @retval ACL_INTERNAL_ACCESS_DENIED At least one of the requested - privileges was denied. - @retval ACL_INTERNAL_ACCESS_CHECK_GRANT No requested privilege - was denied, and grant should be checked for at least one - privilege. Requested privileges that are granted, if any, are saved - in save_priv. - */ - virtual ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const= 0; -}; - -/** - Per internal schema ACL access rules. - This class is an interface. - Each per schema specific access rule should be implemented - in a different subclass, and registered. - Per schema access rules can control: - - every schema privileges on schema.* - - every table privileges on schema.table - @sa ACL_internal_schema_registry -*/ -class ACL_internal_schema_access -{ -public: - ACL_internal_schema_access() - {} - - virtual ~ACL_internal_schema_access() - {} - - /** - Check access to an internal schema. - @param want_access the privileges requested - @param [in, out] save_priv the privileges granted - @return - @retval ACL_INTERNAL_ACCESS_GRANTED All the requested privileges - are granted, and saved in save_priv. - @retval ACL_INTERNAL_ACCESS_DENIED At least one of the requested - privileges was denied. - @retval ACL_INTERNAL_ACCESS_CHECK_GRANT No requested privilege - was denied, and grant should be checked for at least one - privilege. Requested privileges that are granted, if any, are saved - in save_priv. - */ - virtual ACL_internal_access_result check(privilege_t want_access, - privilege_t *save_priv) const= 0; - - /** - Search for per table ACL access rules by table name. - @param name the table name - @return per table access rules, or NULL - */ - virtual const ACL_internal_table_access *lookup(const char *name) const= 0; -}; - -/** - A registry for per internal schema ACL. - An 'internal schema' is a database schema maintained by the - server implementation, such as 'performance_schema' and 'INFORMATION_SCHEMA'. -*/ -class ACL_internal_schema_registry -{ -public: - static void register_schema(const LEX_CSTRING *name, - const ACL_internal_schema_access *access); - static const ACL_internal_schema_access *lookup(const char *name); -}; - -const ACL_internal_schema_access * -get_cached_schema_access(GRANT_INTERNAL_INFO *grant_internal_info, - const char *schema_name); - -const ACL_internal_table_access * -get_cached_table_access(GRANT_INTERNAL_INFO *grant_internal_info, - const char *schema_name, - const char *table_name); - -bool acl_check_proxy_grant_access (THD *thd, const char *host, const char *user, - bool with_grant); -int acl_setrole(THD *thd, const char *rolename, privilege_t access); -int acl_check_setrole(THD *thd, const char *rolename, privilege_t *access); -int acl_check_set_default_role(THD *thd, const char *host, const char *user, - const char *role); -int acl_set_default_role(THD *thd, const char *host, const char *user, - const char *rolename); - -extern SHOW_VAR acl_statistics[]; - -/* Check if a role is granted to a user/role. - - If hostname == NULL, search for a role as the starting grantee. -*/ -bool check_role_is_granted(const char *username, - const char *hostname, - const char *rolename); - -#ifndef DBUG_OFF -extern ulong role_global_merges, role_db_merges, role_table_merges, - role_column_merges, role_routine_merges; -#endif - - -class Sql_cmd_grant: public Sql_cmd -{ -protected: - enum_sql_command m_command; -#ifndef NO_EMBEDDED_ACCESS_CHECKS - void warn_hostname_requires_resolving(THD *thd, List &list); - bool user_list_reset_mqh(THD *thd, List &list); - void grant_stage0(THD *thd); -#endif -public: - Sql_cmd_grant(enum_sql_command command) - :m_command(command) - { } - bool is_revoke() const { return m_command == SQLCOM_REVOKE; } - enum_sql_command sql_command_code() const { return m_command; } -}; - - -class Sql_cmd_grant_proxy: public Sql_cmd_grant -{ - privilege_t m_grant_option; -#ifndef NO_EMBEDDED_ACCESS_CHECKS - bool check_access_proxy(THD *thd, List &list); -#endif -public: - Sql_cmd_grant_proxy(enum_sql_command command, privilege_t grant_option) - :Sql_cmd_grant(command), m_grant_option(grant_option) - { } - bool execute(THD *thd); -}; - - -class Sql_cmd_grant_object: public Sql_cmd_grant, public Grant_privilege -{ -protected: -#ifndef NO_EMBEDDED_ACCESS_CHECKS - bool grant_stage0_exact_object(THD *thd, TABLE_LIST *table); -#endif -public: - Sql_cmd_grant_object(enum_sql_command command, const Grant_privilege &grant) - :Sql_cmd_grant(command), Grant_privilege(grant) - { } -}; - - -class Sql_cmd_grant_table: public Sql_cmd_grant_object -{ -#ifndef NO_EMBEDDED_ACCESS_CHECKS - bool execute_table_mask(THD *thd); - bool execute_exact_table(THD *thd, TABLE_LIST *table); -#endif -public: - Sql_cmd_grant_table(enum_sql_command command, const Grant_privilege &grant) - :Sql_cmd_grant_object(command, grant) - { } - bool execute(THD *thd); -}; - - - -class Sql_cmd_grant_sp: public Sql_cmd_grant_object -{ - const Sp_handler &m_sph; -public: - Sql_cmd_grant_sp(enum_sql_command command, const Grant_privilege &grant, - const Sp_handler &sph) - :Sql_cmd_grant_object(command, grant), - m_sph(sph) - { } - bool execute(THD *thd); -}; - -#endif /* SQL_ACL_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_admin.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_admin.h deleted file mode 100644 index d31726d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_admin.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_TABLE_MAINTENANCE_H -#define SQL_TABLE_MAINTENANCE_H - -/* Must be able to hold ALTER TABLE t PARTITION BY ... KEY ALGORITHM = 1 ... */ -#define SQL_ADMIN_MSG_TEXT_SIZE (128 * 1024) - -bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list, - const LEX_CSTRING *key_cache_name); -bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list); -int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache, - KEY_CACHE *dst_cache); - -/** - Sql_cmd_analyze_table represents the ANALYZE TABLE statement. -*/ -class Sql_cmd_analyze_table : public Sql_cmd -{ -public: - /** - Constructor, used to represent a ANALYZE TABLE statement. - */ - Sql_cmd_analyze_table() - {} - - ~Sql_cmd_analyze_table() - {} - - bool execute(THD *thd); - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_ANALYZE; - } -}; - - - -/** - Sql_cmd_check_table represents the CHECK TABLE statement. -*/ -class Sql_cmd_check_table : public Sql_cmd -{ -public: - /** - Constructor, used to represent a CHECK TABLE statement. - */ - Sql_cmd_check_table() - {} - - ~Sql_cmd_check_table() - {} - - bool execute(THD *thd); - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_CHECK; - } -}; - - -/** - Sql_cmd_optimize_table represents the OPTIMIZE TABLE statement. -*/ -class Sql_cmd_optimize_table : public Sql_cmd -{ -public: - /** - Constructor, used to represent a OPTIMIZE TABLE statement. - */ - Sql_cmd_optimize_table() - {} - - ~Sql_cmd_optimize_table() - {} - - bool execute(THD *thd); - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_OPTIMIZE; - } -}; - - - -/** - Sql_cmd_repair_table represents the REPAIR TABLE statement. -*/ -class Sql_cmd_repair_table : public Sql_cmd -{ -public: - /** - Constructor, used to represent a REPAIR TABLE statement. - */ - Sql_cmd_repair_table() - {} - - ~Sql_cmd_repair_table() - {} - - bool execute(THD *thd); - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_REPAIR; - } -}; - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_alloc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_alloc.h deleted file mode 100644 index f475ecd..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_alloc.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef SQL_ALLOC_INCLUDED -#define SQL_ALLOC_INCLUDED -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2017, 2018, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include /* alloc_root, MEM_ROOT, TRASH */ - -THD *thd_get_current_thd(); - -/* mysql standard class memory allocator */ - -class Sql_alloc -{ -public: - static void *operator new(size_t size) throw () - { - return thd_alloc(thd_get_current_thd(), size); - } - static void *operator new[](size_t size) throw () - { - return thd_alloc(thd_get_current_thd(), size); - } - static void *operator new[](size_t size, MEM_ROOT *mem_root) throw () - { return alloc_root(mem_root, size); } - static void *operator new(size_t size, MEM_ROOT *mem_root) throw() - { return alloc_root(mem_root, size); } - static void operator delete(void *ptr, size_t size) { TRASH_FREE(ptr, size); } - static void operator delete(void *, MEM_ROOT *){} - static void operator delete[](void *, MEM_ROOT *) - { /* never called */ } - static void operator delete[](void *ptr, size_t size) { TRASH_FREE(ptr, size); } -#ifdef HAVE_valgrind - bool dummy_for_valgrind; - inline Sql_alloc() :dummy_for_valgrind(0) {} -#endif -}; -#endif /* SQL_ALLOC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_alter.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_alter.h deleted file mode 100644 index 89eb4eb..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_alter.h +++ /dev/null @@ -1,439 +0,0 @@ -/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. - Copyright (c) 2013, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_ALTER_TABLE_H -#define SQL_ALTER_TABLE_H - -class Alter_drop; -class Alter_column; -class Alter_rename_key; -class Key; - -/** - Data describing the table being created by CREATE TABLE or - altered by ALTER TABLE. -*/ - -class Alter_info -{ -public: - - enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE }; - - bool vers_prohibited(THD *thd) const; - - /** - The different values of the ALGORITHM clause. - Describes which algorithm to use when altering the table. - */ - enum enum_alter_table_algorithm - { -/* - Use thd->variables.alter_algorithm for alter method. If this is also - default then use the fastest possible ALTER TABLE method - (INSTANT, NOCOPY, INPLACE, COPY) -*/ - ALTER_TABLE_ALGORITHM_DEFAULT, - - // Copy if supported, error otherwise. - ALTER_TABLE_ALGORITHM_COPY, - - // In-place if supported, error otherwise. - ALTER_TABLE_ALGORITHM_INPLACE, - - // No Copy will refuse any operation which does rebuild. - ALTER_TABLE_ALGORITHM_NOCOPY, - - // Instant should allow any operation that changes metadata only. - ALTER_TABLE_ALGORITHM_INSTANT, - - // When there is no specification of algorithm during alter table. - ALTER_TABLE_ALGORITHM_NONE - }; - - - /** - The different values of the LOCK clause. - Describes the level of concurrency during ALTER TABLE. - */ - enum enum_alter_table_lock - { - // Maximum supported level of concurency for the given operation. - ALTER_TABLE_LOCK_DEFAULT, - - // Allow concurrent reads & writes. If not supported, give error. - ALTER_TABLE_LOCK_NONE, - - // Allow concurrent reads only. If not supported, give error. - ALTER_TABLE_LOCK_SHARED, - - // Block reads and writes. - ALTER_TABLE_LOCK_EXCLUSIVE - }; - - - // Columns and keys to be dropped. - List drop_list; - // Columns for ALTER_CHANGE_COLUMN_DEFAULT. - List alter_list; - // List of keys, used by both CREATE and ALTER TABLE. - List key_list; - // List of keys to be renamed. - List alter_rename_key_list; - // List of columns, used by both CREATE and ALTER TABLE. - List create_list; - List check_constraint_list; - // Type of ALTER TABLE operation. - alter_table_operations flags; - ulong partition_flags; - // Enable or disable keys. - enum_enable_or_disable keys_onoff; - // List of partitions. - List partition_names; - // Number of partitions. - uint num_parts; -private: - // Type of ALTER TABLE algorithm. - enum_alter_table_algorithm requested_algorithm; - -public: - // Type of ALTER TABLE lock. - enum_alter_table_lock requested_lock; - - - Alter_info() : - flags(0), partition_flags(0), - keys_onoff(LEAVE_AS_IS), - num_parts(0), - requested_algorithm(ALTER_TABLE_ALGORITHM_NONE), - requested_lock(ALTER_TABLE_LOCK_DEFAULT) - {} - - void reset() - { - drop_list.empty(); - alter_list.empty(); - key_list.empty(); - alter_rename_key_list.empty(); - create_list.empty(); - check_constraint_list.empty(); - flags= 0; - partition_flags= 0; - keys_onoff= LEAVE_AS_IS; - num_parts= 0; - partition_names.empty(); - requested_algorithm= ALTER_TABLE_ALGORITHM_NONE; - requested_lock= ALTER_TABLE_LOCK_DEFAULT; - } - - - /** - Construct a copy of this object to be used for mysql_alter_table - and mysql_create_table. - - Historically, these two functions modify their Alter_info - arguments. This behaviour breaks re-execution of prepared - statements and stored procedures and is compensated by always - supplying a copy of Alter_info to these functions. - - @param rhs Alter_info to make copy of - @param mem_root Mem_root for new Alter_info - - @note You need to use check the error in THD for out - of memory condition after calling this function. - */ - Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root); - - - /** - Parses the given string and sets requested_algorithm - if the string value matches a supported value. - Supported values: INPLACE, COPY, DEFAULT - - @param str String containing the supplied value - @retval false Supported value found, state updated - @retval true Not supported value, no changes made - */ - bool set_requested_algorithm(const LEX_CSTRING *str); - - - /** - Parses the given string and sets requested_lock - if the string value matches a supported value. - Supported values: NONE, SHARED, EXCLUSIVE, DEFAULT - - @param str String containing the supplied value - @retval false Supported value found, state updated - @retval true Not supported value, no changes made - */ - - bool set_requested_lock(const LEX_CSTRING *str); - - /** - Set the requested algorithm to the given algorithm value - @param algo_value algorithm to be set - */ - void set_requested_algorithm(enum_alter_table_algorithm algo_value); - - /** - Returns the algorithm value in the format "algorithm=value" - */ - const char* algorithm_clause(THD *thd) const; - - /** - Returns the lock value in the format "lock=value" - */ - const char* lock() const; - - /** - Check whether the given result can be supported - with the specified user alter algorithm. - - @param thd Thread handle - @param ha_alter_info Structure describing changes to be done - by ALTER TABLE and holding data during - in-place alter - @retval false Supported operation - @retval true Not supported value - */ - bool supports_algorithm(THD *thd, - const Alter_inplace_info *ha_alter_info); - - /** - Check whether the given result can be supported - with the specified user lock type. - - @param ha_alter_info Structure describing changes to be done - by ALTER TABLE and holding data during - in-place alter - @retval false Supported lock type - @retval true Not supported value - */ - bool supports_lock(THD *thd, const Alter_inplace_info *ha_alter_info); - - /** - Return user requested algorithm. If user does not specify - algorithm then return alter_algorithm variable value. - */ - enum_alter_table_algorithm algorithm(const THD *thd) const; - -private: - Alter_info &operator=(const Alter_info &rhs); // not implemented - Alter_info(const Alter_info &rhs); // not implemented -}; - - -/** Runtime context for ALTER TABLE. */ -class Alter_table_ctx -{ -public: - Alter_table_ctx(); - - Alter_table_ctx(THD *thd, TABLE_LIST *table_list, uint tables_opened_arg, - const LEX_CSTRING *new_db_arg, const LEX_CSTRING *new_name_arg); - - /** - @return true if the table is moved to another database, false otherwise. - */ - bool is_database_changed() const - { return (new_db.str != db.str); }; - - /** - @return true if the table is renamed, false otherwise. - */ - bool is_table_renamed() const - { return (is_database_changed() || new_name.str != table_name.str); }; - - /** - @return filename (including .frm) for the new table. - */ - const char *get_new_filename() const - { - DBUG_ASSERT(!tmp_table); - return new_filename; - } - - /** - @return path to the original table. - */ - const char *get_path() const - { - DBUG_ASSERT(!tmp_table); - return path; - } - - /** - @return path to the new table. - */ - const char *get_new_path() const - { - DBUG_ASSERT(!tmp_table); - return new_path; - } - - /** - @return path to the temporary table created during ALTER TABLE. - */ - const char *get_tmp_path() const - { return tmp_path; } - - /** - Mark ALTER TABLE as needing to produce foreign key error if - it deletes a row from the table being changed. - */ - void set_fk_error_if_delete_row(FOREIGN_KEY_INFO *fk) - { - fk_error_if_delete_row= true; - fk_error_id= fk->foreign_id->str; - fk_error_table= fk->foreign_table->str; - } - - void report_implicit_default_value_error(THD *thd, const TABLE_SHARE *) const; -public: - Create_field *implicit_default_value_error_field; - bool error_if_not_empty; - uint tables_opened; - LEX_CSTRING db; - LEX_CSTRING table_name; - LEX_CSTRING alias; - LEX_CSTRING new_db; - LEX_CSTRING new_name; - LEX_CSTRING new_alias; - LEX_CSTRING tmp_name; - char tmp_buff[80]; - /** - Indicates that if a row is deleted during copying of data from old version - of table to the new version ER_FK_CANNOT_DELETE_PARENT error should be - emitted. - */ - bool fk_error_if_delete_row; - /** Name of foreign key for the above error. */ - const char *fk_error_id; - /** Name of table for the above error. */ - const char *fk_error_table; - -private: - char new_filename[FN_REFLEN + 1]; - char new_alias_buff[NAME_LEN + 1]; - char tmp_name_buff[NAME_LEN + 1]; - char path[FN_REFLEN + 1]; - char new_path[FN_REFLEN + 1]; - char tmp_path[FN_REFLEN + 1]; - -#ifdef DBUG_ASSERT_EXISTS - /** Indicates that we are altering temporary table. Used only in asserts. */ - bool tmp_table; -#endif - - Alter_table_ctx &operator=(const Alter_table_ctx &rhs); // not implemented - Alter_table_ctx(const Alter_table_ctx &rhs); // not implemented -}; - - -/** - Sql_cmd_common_alter_table represents the common properties of the ALTER TABLE - statements. - @todo move Alter_info and other ALTER generic structures from Lex here. -*/ -class Sql_cmd_common_alter_table : public Sql_cmd -{ -protected: - /** - Constructor. - */ - Sql_cmd_common_alter_table() - {} - - virtual ~Sql_cmd_common_alter_table() - {} - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_ALTER_TABLE; - } -}; - -/** - Sql_cmd_alter_table represents the generic ALTER TABLE statement. - @todo move Alter_info and other ALTER specific structures from Lex here. -*/ -class Sql_cmd_alter_table : public Sql_cmd_common_alter_table, - public Storage_engine_name -{ -public: - /** - Constructor, used to represent a ALTER TABLE statement. - */ - Sql_cmd_alter_table() - {} - - ~Sql_cmd_alter_table() - {} - - Storage_engine_name *option_storage_engine_name() { return this; } - - bool execute(THD *thd); -}; - - -/** - Sql_cmd_alter_sequence represents the ALTER SEQUENCE statement. -*/ -class Sql_cmd_alter_sequence : public Sql_cmd, - public DDL_options -{ -public: - /** - Constructor, used to represent a ALTER TABLE statement. - */ - Sql_cmd_alter_sequence(const DDL_options &options) - :DDL_options(options) - {} - - ~Sql_cmd_alter_sequence() - {} - - enum_sql_command sql_command_code() const - { - return SQLCOM_ALTER_SEQUENCE; - } - bool execute(THD *thd); -}; - - -/** - Sql_cmd_alter_table_tablespace represents ALTER TABLE - IMPORT/DISCARD TABLESPACE statements. -*/ -class Sql_cmd_discard_import_tablespace : public Sql_cmd_common_alter_table -{ -public: - enum enum_tablespace_op_type - { - DISCARD_TABLESPACE, IMPORT_TABLESPACE - }; - - Sql_cmd_discard_import_tablespace(enum_tablespace_op_type tablespace_op_arg) - : m_tablespace_op(tablespace_op_arg) - {} - - bool execute(THD *thd); - -private: - const enum_tablespace_op_type m_tablespace_op; -}; - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_analyse.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_analyse.h deleted file mode 100644 index 9cdb93f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_analyse.h +++ /dev/null @@ -1,367 +0,0 @@ -#ifndef SQL_ANALYSE_INCLUDED -#define SQL_ANALYSE_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* Analyse database */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "procedure.h" /* Procedure */ - -#define my_thd_charset default_charset_info - -#define DEC_IN_AVG 4 - -typedef struct st_number_info -{ - // if zerofill is true, the number must be zerofill, or string - bool negative, is_float, zerofill, maybe_zerofill; - int8 integers; - int8 decimals; - double dval; - ulonglong ullval; -} NUM_INFO; - -typedef struct st_extreme_value_number_info -{ - ulonglong ullval; - longlong llval; - double max_dval, min_dval; -} EV_NUM_INFO; - -typedef struct st_tree_info -{ - bool found; - String *str; - Item *item; -} TREE_INFO; - -uint check_ulonglong(const char *str, uint length); -bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num); -bool test_if_number(NUM_INFO *info, const char *str, uint str_len); -int compare_double(const double *s, const double *t); -int compare_double2(void* cmp_arg __attribute__((unused)), - const double *s, const double *t); -int compare_longlong(const longlong *s, const longlong *t); -int compare_longlong2(void* cmp_arg __attribute__((unused)), - const longlong *s, const longlong *t); -int compare_ulonglong(const ulonglong *s, const ulonglong *t); -int compare_ulonglong2(void* cmp_arg __attribute__((unused)), - const ulonglong *s, const ulonglong *t); -int compare_decimal2(int* len, const char *s, const char *t); -Procedure *proc_analyse_init(THD *thd, ORDER *param, select_result *result, - List &field_list); -int free_string(void* str, TREE_FREE, void*); -class analyse; - -class field_info :public Sql_alloc -{ -protected: - ulong treemem, tree_elements, empty, nulls, min_length, max_length; - uint room_in_tree; - bool found; - TREE tree; - Item *item; - analyse *pc; - -public: - field_info(Item* a, analyse* b) : treemem(0), tree_elements(0), empty(0), - nulls(0), min_length(0), max_length(0), room_in_tree(1), - found(0),item(a), pc(b) {}; - - virtual ~field_info() { delete_tree(&tree, 0); } - virtual void add() = 0; - virtual void get_opt_type(String*, ha_rows) = 0; - virtual String *get_min_arg(String *) = 0; - virtual String *get_max_arg(String *) = 0; - virtual String *avg(String*, ha_rows) = 0; - virtual String *std(String*, ha_rows) = 0; - virtual tree_walk_action collect_enum() = 0; - virtual uint decimals() { return 0; } - friend class analyse; -}; - - -int collect_string(String *element, element_count count, - TREE_INFO *info); - -int sortcmp2(void* cmp_arg __attribute__((unused)), - const String *a,const String *b); - -class field_str :public field_info -{ - String min_arg, max_arg; - ulonglong sum; - bool must_be_blob, was_zero_fill, was_maybe_zerofill, - can_be_still_num; - NUM_INFO num_info; - EV_NUM_INFO ev_num_info; - -public: - field_str(Item* a, analyse* b) :field_info(a,b), - min_arg("",default_charset_info), - max_arg("",default_charset_info), sum(0), - must_be_blob(0), was_zero_fill(0), - was_maybe_zerofill(0), can_be_still_num(1) - { init_tree(&tree, 0, 0, sizeof(String), (qsort_cmp2) sortcmp2, - free_string, NULL, MYF(MY_THREAD_SPECIFIC)); }; - - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *not_used __attribute__((unused))) - { return &min_arg; } - String *get_max_arg(String *not_used __attribute__((unused))) - { return &max_arg; } - String *avg(String *s, ha_rows rows) - { - if (!(rows - nulls)) - s->set_real((double) 0.0, 1,my_thd_charset); - else - s->set_real((ulonglong2double(sum) / ulonglong2double(rows - nulls)), - DEC_IN_AVG,my_thd_charset); - return s; - } - friend int collect_string(String *element, element_count count, - TREE_INFO *info); - tree_walk_action collect_enum() - { return (tree_walk_action) collect_string; } - String *std(String *s __attribute__((unused)), - ha_rows rows __attribute__((unused))) - { return (String*) 0; } -}; - - -int collect_decimal(uchar *element, element_count count, - TREE_INFO *info); - -class field_decimal :public field_info -{ - my_decimal min_arg, max_arg; - my_decimal sum[2], sum_sqr[2]; - int cur_sum; - int bin_size; -public: - field_decimal(Item* a, analyse* b) :field_info(a,b) - { - bin_size= my_decimal_get_binary_size(a->max_length, a->decimals); - init_tree(&tree, 0, 0, bin_size, (qsort_cmp2)compare_decimal2, - 0, (void *)&bin_size, MYF(MY_THREAD_SPECIFIC)); - }; - - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *); - String *get_max_arg(String *); - String *avg(String *s, ha_rows rows); - friend int collect_decimal(uchar *element, element_count count, - TREE_INFO *info); - tree_walk_action collect_enum() - { return (tree_walk_action) collect_decimal; } - String *std(String *s, ha_rows rows); -}; - - -int collect_real(double *element, element_count count, TREE_INFO *info); - -class field_real: public field_info -{ - double min_arg, max_arg; - double sum, sum_sqr; - uint max_notzero_dec_len; - -public: - field_real(Item* a, analyse* b) :field_info(a,b), - min_arg(0), max_arg(0), sum(0), sum_sqr(0), max_notzero_dec_len(0) - { init_tree(&tree, 0, 0, sizeof(double), - (qsort_cmp2) compare_double2, NULL, NULL, - MYF(MY_THREAD_SPECIFIC)); } - - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *s) - { - s->set_real(min_arg, item->decimals, my_thd_charset); - return s; - } - String *get_max_arg(String *s) - { - s->set_real(max_arg, item->decimals, my_thd_charset); - return s; - } - String *avg(String *s, ha_rows rows) - { - if (!(rows - nulls)) - s->set_real((double) 0.0, 1,my_thd_charset); - else - s->set_real(((double)sum / (double) (rows - nulls)), item->decimals,my_thd_charset); - return s; - } - String *std(String *s, ha_rows rows) - { - double tmp = ulonglong2double(rows); - if (!(tmp - nulls)) - s->set_real((double) 0.0, 1,my_thd_charset); - else - { - double tmp2 = ((sum_sqr - sum * sum / (tmp - nulls)) / - (tmp - nulls)); - s->set_real(((double) tmp2 <= 0.0 ? 0.0 : sqrt(tmp2)), item->decimals,my_thd_charset); - } - return s; - } - uint decimals() { return item->decimals; } - friend int collect_real(double *element, element_count count, - TREE_INFO *info); - tree_walk_action collect_enum() - { return (tree_walk_action) collect_real;} -}; - -int collect_longlong(longlong *element, element_count count, - TREE_INFO *info); - -class field_longlong: public field_info -{ - longlong min_arg, max_arg; - longlong sum, sum_sqr; - -public: - field_longlong(Item* a, analyse* b) :field_info(a,b), - min_arg(0), max_arg(0), sum(0), sum_sqr(0) - { init_tree(&tree, 0, 0, sizeof(longlong), - (qsort_cmp2) compare_longlong2, NULL, NULL, - MYF(MY_THREAD_SPECIFIC)); } - - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *s) { s->set(min_arg,my_thd_charset); return s; } - String *get_max_arg(String *s) { s->set(max_arg,my_thd_charset); return s; } - String *avg(String *s, ha_rows rows) - { - if (!(rows - nulls)) - s->set_real((double) 0.0, 1,my_thd_charset); - else - s->set_real(((double) sum / (double) (rows - nulls)), DEC_IN_AVG,my_thd_charset); - return s; - } - String *std(String *s, ha_rows rows) - { - double tmp = ulonglong2double(rows); - if (!(tmp - nulls)) - s->set_real((double) 0.0, 1,my_thd_charset); - else - { - double tmp2 = ((sum_sqr - sum * sum / (tmp - nulls)) / - (tmp - nulls)); - s->set_real(((double) tmp2 <= 0.0 ? 0.0 : sqrt(tmp2)), DEC_IN_AVG,my_thd_charset); - } - return s; - } - friend int collect_longlong(longlong *element, element_count count, - TREE_INFO *info); - tree_walk_action collect_enum() - { return (tree_walk_action) collect_longlong;} -}; - -int collect_ulonglong(ulonglong *element, element_count count, - TREE_INFO *info); - -class field_ulonglong: public field_info -{ - ulonglong min_arg, max_arg; - ulonglong sum, sum_sqr; - -public: - field_ulonglong(Item* a, analyse * b) :field_info(a,b), - min_arg(0), max_arg(0), sum(0),sum_sqr(0) - { init_tree(&tree, 0, 0, sizeof(ulonglong), - (qsort_cmp2) compare_ulonglong2, NULL, NULL, - MYF(MY_THREAD_SPECIFIC)); } - void add(); - void get_opt_type(String*, ha_rows); - String *get_min_arg(String *s) { s->set(min_arg,my_thd_charset); return s; } - String *get_max_arg(String *s) { s->set(max_arg,my_thd_charset); return s; } - String *avg(String *s, ha_rows rows) - { - if (!(rows - nulls)) - s->set_real((double) 0.0, 1,my_thd_charset); - else - s->set_real((ulonglong2double(sum) / ulonglong2double(rows - nulls)), - DEC_IN_AVG,my_thd_charset); - return s; - } - String *std(String *s, ha_rows rows) - { - double tmp = ulonglong2double(rows); - if (!(tmp - nulls)) - s->set_real((double) 0.0, 1,my_thd_charset); - else - { - double tmp2 = ((ulonglong2double(sum_sqr) - - ulonglong2double(sum * sum) / (tmp - nulls)) / - (tmp - nulls)); - s->set_real(((double) tmp2 <= 0.0 ? 0.0 : sqrt(tmp2)), DEC_IN_AVG,my_thd_charset); - } - return s; - } - friend int collect_ulonglong(ulonglong *element, element_count count, - TREE_INFO *info); - tree_walk_action collect_enum() - { return (tree_walk_action) collect_ulonglong; } -}; - - -Procedure *proc_analyse_init(THD *thd, ORDER *param, - select_result *result, - List &field_list); - -class analyse: public Procedure -{ -protected: - Item_proc *func_items[10]; - List fields, result_fields; - field_info **f_info, **f_end; - ha_rows rows; - uint output_str_length; - -public: - uint max_tree_elements, max_treemem; - - analyse(select_result *res) :Procedure(res, PROC_NO_SORT), f_info(0), - rows(0), output_str_length(0) {} - - ~analyse() - { - if (f_info) - { - for (field_info **f=f_info; f != f_end; f++) - delete (*f); - } - } - virtual void add() {} - virtual bool change_columns(THD *thd, List &fields); - virtual int send_row(List &field_list); - virtual void end_group(void) {} - virtual int end_of_records(void); - friend Procedure *proc_analyse_init(THD *thd, ORDER *param, - select_result *result, - List &field_list); -}; - -#endif /* SQL_ANALYSE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_analyze_stmt.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_analyze_stmt.h deleted file mode 100644 index 990c79f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_analyze_stmt.h +++ /dev/null @@ -1,427 +0,0 @@ -/* - Copyright (c) 2015, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - -== ANALYZE-stmt classes == - -This file contains classes for supporting "ANALYZE statement" feature. These are -a set of data structures that can be used to store the data about how the -statement executed. - -There are two kinds of data collection: - -1. Various counters. We assume that incrementing counters has very low -overhead. Because of that, execution code increments counters unconditionally -(even when not running "ANALYZE $statement" commands. You run regular SELECT/ -UPDATE/DELETE/etc and the counters are incremented). - -As a free bonus, this lets us print detailed information into the slow query -log, should the query be slow. - -2. Timing data. Measuring the time it took to run parts of query has noticeable -overhead. Because of that, we measure the time only when running "ANALYZE -$stmt"). - -*/ - -class Gap_time_tracker; -void attach_gap_time_tracker(THD *thd, Gap_time_tracker *gap_tracker, ulonglong timeval); -void process_gap_time_tracker(THD *thd, ulonglong timeval); - -/* - A class for tracking time it takes to do a certain action -*/ -class Exec_time_tracker -{ -protected: - ulonglong count; - ulonglong cycles; - ulonglong last_start; - - void cycles_stop_tracking(THD *thd) - { - ulonglong end= my_timer_cycles(); - cycles += end - last_start; - if (unlikely(end < last_start)) - cycles += ULONGLONG_MAX; - - process_gap_time_tracker(thd, end); - if (my_gap_tracker) - attach_gap_time_tracker(thd, my_gap_tracker, end); - } -public: - Exec_time_tracker() : count(0), cycles(0), my_gap_tracker(NULL) {} - - /* - The time spent between stop_tracking() call on this object and any - other time measurement will be billed to this tracker. - */ - Gap_time_tracker *my_gap_tracker; - - // interface for collecting time - void start_tracking(THD *thd) - { - last_start= my_timer_cycles(); - process_gap_time_tracker(thd, last_start); - } - - void stop_tracking(THD *thd) - { - count++; - cycles_stop_tracking(thd); - } - - // interface for getting the time - ulonglong get_loops() const { return count; } - double get_time_ms() const - { - // convert 'cycles' to milliseconds. - return 1000.0 * static_cast(cycles) / - static_cast(sys_timer_info.cycles.frequency); - } -}; - - -/* - Tracker for time spent between the calls to Exec_time_tracker's {start| - stop}_tracking(). - - @seealso Gap_time_tracker_data in sql_class.h -*/ -class Gap_time_tracker -{ - ulonglong cycles; -public: - Gap_time_tracker() : cycles(0) {} - - void log_time(ulonglong start, ulonglong end) { - cycles += end - start; - } - - double get_time_ms() const - { - // convert 'cycles' to milliseconds. - return 1000.0 * static_cast(cycles) / - static_cast(sys_timer_info.cycles.frequency); - } -}; - - - -/* - A class for counting certain actions (in all queries), and optionally - collecting the timings (in ANALYZE queries). -*/ - -class Time_and_counter_tracker: public Exec_time_tracker -{ -public: - const bool timed; - - Time_and_counter_tracker(bool timed_arg) : timed(timed_arg) - {} - - /* Loops are counted in both ANALYZE and regular queries, as this is cheap */ - void incr_loops() { count++; } - - /* - Unlike Exec_time_tracker::stop_tracking, we don't increase loops. - */ - void stop_tracking(THD *thd) - { - cycles_stop_tracking(thd); - } -}; - -#define ANALYZE_START_TRACKING(thd, tracker) \ - { \ - (tracker)->incr_loops(); \ - if (unlikely((tracker)->timed)) \ - { (tracker)->start_tracking(thd); } \ - } - -#define ANALYZE_STOP_TRACKING(thd, tracker) \ - if (unlikely((tracker)->timed)) \ - { (tracker)->stop_tracking(thd); } - -/* - A class for collecting read statistics. - - The idea is that we run several scans. Each scans gets rows, and then filters - some of them out. We count scans, rows, and rows left after filtering. - - (note: at the moment, the class is not actually tied to a physical table. - It can be used to track reading from files, buffers, etc). -*/ - -class Table_access_tracker -{ -public: - Table_access_tracker() : - r_scans(0), r_rows(0), /*r_rows_after_table_cond(0),*/ - r_rows_after_where(0) - {} - - ha_rows r_scans; /* How many scans were ran on this join_tab */ - ha_rows r_rows; /* How many rows we've got after that */ - ha_rows r_rows_after_where; /* Rows after applying attached part of WHERE */ - - bool has_scans() const { return (r_scans != 0); } - ha_rows get_loops() const { return r_scans; } - double get_avg_rows() const - { - return r_scans - ? static_cast(r_rows) / static_cast(r_scans) - : 0; - } - - double get_filtered_after_where() const - { - return r_rows > 0 - ? static_cast(r_rows_after_where) / - static_cast(r_rows) - : 1.0; - } - - inline void on_scan_init() { r_scans++; } - inline void on_record_read() { r_rows++; } - inline void on_record_after_where() { r_rows_after_where++; } -}; - - -class Json_writer; - -/* - This stores the data about how filesort executed. - - A few things from here (e.g. r_used_pq, r_limit) belong to the query plan, - however, these parameters are calculated right during the execution so we - can't easily put them into the query plan. - - The class is designed to handle multiple invocations of filesort(). -*/ - -class Filesort_tracker : public Sql_alloc -{ -public: - Filesort_tracker(bool do_timing) : - time_tracker(do_timing), r_limit(0), r_used_pq(0), - r_examined_rows(0), r_sorted_rows(0), r_output_rows(0), - sort_passes(0), - sort_buffer_size(0), - r_using_addons(false), - r_packed_addon_fields(false), - r_sort_keys_packed(false) - {} - - /* Functions that filesort uses to report various things about its execution */ - - inline void report_use(THD *thd, ha_rows r_limit_arg) - { - if (!time_tracker.get_loops()) - r_limit= r_limit_arg; - else - r_limit= (r_limit != r_limit_arg)? 0: r_limit_arg; - - ANALYZE_START_TRACKING(thd, &time_tracker); - } - inline void incr_pq_used() { r_used_pq++; } - - inline void report_row_numbers(ha_rows examined_rows, - ha_rows sorted_rows, - ha_rows returned_rows) - { - r_examined_rows += examined_rows; - r_sorted_rows += sorted_rows; - r_output_rows += returned_rows; - } - - inline void report_merge_passes_at_start(ulong passes) - { - sort_passes -= passes; - } - inline void report_merge_passes_at_end(THD *thd, ulong passes) - { - ANALYZE_STOP_TRACKING(thd, &time_tracker); - sort_passes += passes; - } - - inline void report_sort_buffer_size(size_t bufsize) - { - if (sort_buffer_size) - sort_buffer_size= ulonglong(-1); // multiple buffers of different sizes - else - sort_buffer_size= bufsize; - } - - inline void report_addon_fields_format(bool addons_packed) - { - r_using_addons= true; - r_packed_addon_fields= addons_packed; - } - inline void report_sort_keys_format(bool sort_keys_packed) - { - r_sort_keys_packed= sort_keys_packed; - } - - void get_data_format(String *str); - - /* Functions to get the statistics */ - void print_json_members(Json_writer *writer); - - ulonglong get_r_loops() const { return time_tracker.get_loops(); } - double get_avg_examined_rows() const - { - return static_cast(r_examined_rows) / - static_cast(get_r_loops()); - } - double get_avg_returned_rows() const - { - return static_cast(r_output_rows) / - static_cast(get_r_loops()); - } - double get_r_filtered() const - { - return r_examined_rows > 0 - ? static_cast(r_sorted_rows) / - static_cast(r_examined_rows) - : 1.0; - } -private: - Time_and_counter_tracker time_tracker; - - //ulonglong r_loops; /* How many times filesort was invoked */ - /* - LIMIT is typically a constant. There is never "LIMIT 0". - HA_POS_ERROR means we never had a limit - 0 means different values of LIMIT were used in - different filesort invocations - other value means the same LIMIT value was used every time. - */ - ulonglong r_limit; - ulonglong r_used_pq; /* How many times PQ was used */ - - /* How many rows were examined (before checking the select->cond) */ - ulonglong r_examined_rows; - - /* - How many rows were put into sorting (this is examined_rows minus rows that - didn't pass the WHERE condition) - */ - ulonglong r_sorted_rows; - - /* - How many rows were returned. This is equal to r_sorted_rows, unless there - was a LIMIT N clause in which case filesort would not have returned more - than N rows. - */ - ulonglong r_output_rows; - - /* How many sorts in total (divide by r_count to get the average) */ - ulonglong sort_passes; - - /* - 0 - means not used (or not known - (ulonglong)-1 - multiple - other - value - */ - ulonglong sort_buffer_size; - bool r_using_addons; - bool r_packed_addon_fields; - bool r_sort_keys_packed; -}; - - -/** - A class to collect data about how rowid filter is executed. - - It stores information about how rowid filter container is filled, - containers size and observed selectivity. - - The observed selectivity is calculated in this way. - Some elements elem_set are checked if they belong to container. - Observed selectivity is calculated as the count of elem_set - elements that belong to container devided by all elem_set elements. -*/ - -class Rowid_filter_tracker : public Sql_alloc -{ -private: - /* A member to track the time to fill the rowid filter */ - Time_and_counter_tracker time_tracker; - - /* Size of the rowid filter container buffer */ - size_t container_buff_size; - - /* Count of elements that were used to fill the rowid filter container */ - uint container_elements; - - /* Elements counts used for observed selectivity calculation */ - uint n_checks; - uint n_positive_checks; -public: - Rowid_filter_tracker(bool do_timing) : - time_tracker(do_timing), container_buff_size(0), - container_elements(0), n_checks(0), n_positive_checks(0) - {} - - inline void start_tracking(THD *thd) - { - ANALYZE_START_TRACKING(thd, &time_tracker); - } - - inline void stop_tracking(THD *thd) - { - ANALYZE_STOP_TRACKING(thd, &time_tracker); - } - - /* Save container buffer size in bytes */ - inline void report_container_buff_size(uint elem_size) - { - container_buff_size= container_elements * elem_size / 8; - } - - Time_and_counter_tracker *get_time_tracker() - { - return &time_tracker; - } - - double get_time_fill_container_ms() const - { - return time_tracker.get_time_ms(); - } - - void increment_checked_elements_count(bool was_checked) - { - n_checks++; - if (was_checked) - n_positive_checks++; - } - - inline void increment_container_elements_count() { container_elements++; } - - uint get_container_elements() const { return container_elements; } - - double get_r_selectivity_pct() const - { - return static_cast(n_positive_checks) / - static_cast(n_checks); - } - - size_t get_container_buff_size() const { return container_buff_size; } -}; - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_array.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_array.h deleted file mode 100644 index b6de1b1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_array.h +++ /dev/null @@ -1,296 +0,0 @@ -#ifndef SQL_ARRAY_INCLUDED -#define SQL_ARRAY_INCLUDED - -/* Copyright (c) 2003, 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include - -/** - A wrapper class which provides array bounds checking. - We do *not* own the array, we simply have a pointer to the first element, - and a length. - - @remark - We want the compiler-generated versions of: - - the copy CTOR (memberwise initialization) - - the assignment operator (memberwise assignment) - - @param Element_type The type of the elements of the container. - */ -template class Bounds_checked_array -{ -public: - Bounds_checked_array()= default; - - Bounds_checked_array(Element_type *el, size_t size_arg) - : m_array(el), m_size(size_arg) - {} - - void reset() { m_array= NULL; m_size= 0; } - - void reset(Element_type *array_arg, size_t size_arg) - { - m_array= array_arg; - m_size= size_arg; - } - - /** - Set a new bound on the array. Does not resize the underlying - array, so the new size must be smaller than or equal to the - current size. - */ - void resize(size_t new_size) - { - DBUG_ASSERT(new_size <= m_size); - m_size= new_size; - } - - Element_type &operator[](size_t n) - { - DBUG_ASSERT(n < m_size); - return m_array[n]; - } - - const Element_type &operator[](size_t n) const - { - DBUG_ASSERT(n < m_size); - return m_array[n]; - } - - size_t element_size() const { return sizeof(Element_type); } - size_t size() const { return m_size; } - - bool is_null() const { return m_array == NULL; } - - void pop_front() - { - DBUG_ASSERT(m_size > 0); - m_array+= 1; - m_size-= 1; - } - - Element_type *array() const { return m_array; } - - Element_type *begin() const { return array(); } - Element_type *end() const { return array() + m_size; } - - - bool operator==(const Bounds_checked_array&rhs) const - { - return m_array == rhs.m_array && m_size == rhs.m_size; - } - bool operator!=(const Bounds_checked_array&rhs) const - { - return m_array != rhs.m_array || m_size != rhs.m_size; - } - -private: - Element_type *m_array= nullptr; - size_t m_size= 0; -}; - -/* - A typesafe wrapper around DYNAMIC_ARRAY - - TODO: Change creator to take a THREAD_SPECIFIC option. -*/ - -template class Dynamic_array -{ - DYNAMIC_ARRAY array; -public: - Dynamic_array(PSI_memory_key psi_key, uint prealloc=16, uint increment=16) - { - init(psi_key, prealloc, increment); - } - - Dynamic_array(MEM_ROOT *root, uint prealloc=16, uint increment=16) - { - void *init_buffer= alloc_root(root, sizeof(Elem) * prealloc); - init_dynamic_array2(root->m_psi_key, &array, sizeof(Elem), init_buffer, - prealloc, increment, MYF(0)); - } - - void init(PSI_memory_key psi_key, uint prealloc=16, uint increment=16) - { - init_dynamic_array2(psi_key, &array, sizeof(Elem), 0, prealloc, increment, MYF(0)); - } - - /** - @note Though formally this could be declared "const" it would be - misleading at it returns a non-const pointer to array's data. - */ - Elem& at(size_t idx) - { - DBUG_ASSERT(idx < array.elements); - return *(((Elem*)array.buffer) + idx); - } - /// Const variant of at(), which cannot change data - const Elem& at(size_t idx) const - { - return *(((Elem*)array.buffer) + idx); - } - - /// @returns pointer to first element - Elem *front() - { - return (Elem*)array.buffer; - } - - /// @returns pointer to first element - const Elem *front() const - { - return (const Elem*)array.buffer; - } - - /// @returns pointer to last element - Elem *back() - { - return ((Elem*)array.buffer) + array.elements - 1; - } - - /// @returns pointer to last element - const Elem *back() const - { - return ((const Elem*)array.buffer) + array.elements - 1; - } - - const Elem *end() const - { - return back() + 1; - } - - /// @returns pointer to n-th element - Elem *get_pos(size_t idx) - { - return ((Elem*)array.buffer) + idx; - } - - /// @returns pointer to n-th element - const Elem *get_pos(size_t idx) const - { - return ((const Elem*)array.buffer) + idx; - } - - /** - @retval false ok - @retval true OOM, @c my_error() has been called. - */ - bool append(const Elem &el) - { - return insert_dynamic(&array, &el); - } - - bool append_val(Elem el) - { - return (insert_dynamic(&array, (uchar*)&el)); - } - - bool push(Elem &el) - { - return append(el); - } - - /// Pops the last element. Does nothing if array is empty. - Elem& pop() - { - return *((Elem*)pop_dynamic(&array)); - } - - void del(size_t idx) - { - DBUG_ASSERT(idx <= array.max_element); - delete_dynamic_element(&array, (uint)idx); - } - - size_t elements() const - { - return array.elements; - } - - void elements(size_t num_elements) - { - DBUG_ASSERT(num_elements <= array.max_element); - array.elements= (uint)num_elements; - } - - void clear() - { - elements(0); - } - - void set(uint idx, const Elem &el) - { - set_dynamic(&array, &el, idx); - } - - void freeze() - { - freeze_size(&array); - } - - bool reserve(size_t new_size) - { - return allocate_dynamic(&array, (uint)new_size); - } - - - bool resize(size_t new_size, Elem default_val) - { - size_t old_size= elements(); - if (reserve(new_size)) - return true; - - if (new_size > old_size) - { - set_dynamic(&array, (uchar*)&default_val, (uint)(new_size - 1)); - /*for (size_t i= old_size; i != new_size; i++) - { - at(i)= default_val; - }*/ - } - return false; - } - - ~Dynamic_array() - { - delete_dynamic(&array); - } - - void free_memory() - { - delete_dynamic(&array); - } - - typedef int (*CMP_FUNC)(const Elem *el1, const Elem *el2); - - void sort(CMP_FUNC cmp_func) - { - my_qsort(array.buffer, array.elements, sizeof(Elem), (qsort_cmp)cmp_func); - } - - typedef int (*CMP_FUNC2)(void *, const Elem *el1, const Elem *el2); - void sort(CMP_FUNC2 cmp_func, void *data) - { - my_qsort2(array.buffer, array.elements, sizeof(Elem), (qsort2_cmp)cmp_func, data); - } -}; - -typedef Bounds_checked_array Ref_ptr_array; - -#endif /* SQL_ARRAY_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_audit.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_audit.h deleted file mode 100644 index 40276c8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_audit.h +++ /dev/null @@ -1,441 +0,0 @@ -#ifndef SQL_AUDIT_INCLUDED -#define SQL_AUDIT_INCLUDED - -/* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#include -#include "sql_class.h" - -extern unsigned long mysql_global_audit_mask[]; - - -extern void mysql_audit_initialize(); -extern void mysql_audit_finalize(); - - -extern void mysql_audit_init_thd(THD *thd); -extern void mysql_audit_free_thd(THD *thd); -extern void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask); - - -#ifndef EMBEDDED_LIBRARY -extern void mysql_audit_notify(THD *thd, uint event_class, const void *event); - -static inline bool mysql_audit_general_enabled() -{ - return mysql_global_audit_mask[0] & MYSQL_AUDIT_GENERAL_CLASSMASK; -} - -static inline bool mysql_audit_connection_enabled() -{ - return mysql_global_audit_mask[0] & MYSQL_AUDIT_CONNECTION_CLASSMASK; -} - -static inline bool mysql_audit_table_enabled() -{ - return mysql_global_audit_mask[0] & MYSQL_AUDIT_TABLE_CLASSMASK; -} - -#else -static inline void mysql_audit_notify(THD *thd, uint event_class, - const void *event) {} -#define mysql_audit_general_enabled() 0 -#define mysql_audit_connection_enabled() 0 -#define mysql_audit_table_enabled() 0 -#endif -extern my_bool mysql_audit_release_required(THD *thd); -extern void mysql_audit_release(THD *thd); - -static inline unsigned int strlen_uint(const char *s) -{ - return (uint)strlen(s); -} - -static inline unsigned int safe_strlen_uint(const char *s) -{ - return (uint)safe_strlen(s); -} - -#define MAX_USER_HOST_SIZE 512 -static inline uint make_user_name(THD *thd, char *buf) -{ - const Security_context *sctx= thd->security_ctx; - char *end= strxnmov(buf, MAX_USER_HOST_SIZE, - sctx->priv_user[0] ? sctx->priv_user : "", "[", - sctx->user ? sctx->user : "", "] @ ", - sctx->host ? sctx->host : "", " [", - sctx->ip ? sctx->ip : "", "]", NullS); - return (uint)(end-buf); -} - -/** - Call audit plugins of GENERAL audit class, MYSQL_AUDIT_GENERAL_LOG subtype. - - @param[in] thd - @param[in] time time that event occurred - @param[in] user User name - @param[in] userlen User name length - @param[in] cmd Command name - @param[in] cmdlen Command name length - @param[in] query Query string - @param[in] querylen Query string length -*/ - -static inline -void mysql_audit_general_log(THD *thd, time_t time, - const char *user, uint userlen, - const char *cmd, uint cmdlen, - const char *query, uint querylen) -{ - if (mysql_audit_general_enabled()) - { - mysql_event_general event; - - event.event_subclass= MYSQL_AUDIT_GENERAL_LOG; - event.general_error_code= 0; - event.general_time= time; - event.general_user= user; - event.general_user_length= userlen; - event.general_command= cmd; - event.general_command_length= cmdlen; - event.general_query= query; - event.general_query_length= querylen; - event.general_rows= 0; - - if (thd) - { - event.general_thread_id= (unsigned long)thd->thread_id; - event.general_charset= thd->variables.character_set_client; - event.database= thd->db; - event.query_id= thd->query_id; - } - else - { - event.general_thread_id= 0; - event.general_charset= global_system_variables.character_set_client; - event.database= null_clex_str; - event.query_id= 0; - } - - mysql_audit_notify(thd, MYSQL_AUDIT_GENERAL_CLASS, &event); - } -} - -/** - Call audit plugins of GENERAL audit class. - event_subtype should be set to one of: - MYSQL_AUDIT_GENERAL_ERROR - MYSQL_AUDIT_GENERAL_RESULT - MYSQL_AUDIT_GENERAL_STATUS - - @param[in] thd - @param[in] event_subtype Type of general audit event. - @param[in] error_code Error code - @param[in] msg Message -*/ -static inline -void mysql_audit_general(THD *thd, uint event_subtype, - int error_code, const char *msg) -{ - DBUG_ENTER("mysql_audit_general"); - if (mysql_audit_general_enabled()) - { - char user_buff[MAX_USER_HOST_SIZE]; - mysql_event_general event; - - event.event_subclass= event_subtype; - event.general_error_code= error_code; - event.general_time= my_time(0); - event.general_command= msg; - event.general_command_length= safe_strlen_uint(msg); - - if (thd) - { - event.general_user= user_buff; - event.general_user_length= make_user_name(thd, user_buff); - event.general_thread_id= (unsigned long)thd->thread_id; - event.general_query= thd->query_string.str(); - event.general_query_length= (unsigned) thd->query_string.length(); - event.general_charset= thd->query_string.charset(); - event.general_rows= thd->get_stmt_da()->current_row_for_warning(); - event.database= thd->db; - event.query_id= thd->query_id; - } - else - { - event.general_user= NULL; - event.general_user_length= 0; - event.general_thread_id= 0; - event.general_query= NULL; - event.general_query_length= 0; - event.general_charset= &my_charset_bin; - event.general_rows= 0; - event.database= null_clex_str; - event.query_id= 0; - } - - mysql_audit_notify(thd, MYSQL_AUDIT_GENERAL_CLASS, &event); - } - DBUG_VOID_RETURN; -} - -static inline -void mysql_audit_notify_connection_connect(THD *thd) -{ - if (mysql_audit_connection_enabled()) - { - const Security_context *sctx= thd->security_ctx; - mysql_event_connection event; - - event.event_subclass= MYSQL_AUDIT_CONNECTION_CONNECT; - event.status= thd->get_stmt_da()->is_error() ? - thd->get_stmt_da()->sql_errno() : 0; - event.thread_id= (unsigned long)thd->thread_id; - event.user= sctx->user; - event.user_length= safe_strlen_uint(sctx->user); - event.priv_user= sctx->priv_user; - event.priv_user_length= strlen_uint(sctx->priv_user); - event.external_user= sctx->external_user; - event.external_user_length= safe_strlen_uint(sctx->external_user); - event.proxy_user= sctx->proxy_user; - event.proxy_user_length= strlen_uint(sctx->proxy_user); - event.host= sctx->host; - event.host_length= safe_strlen_uint(sctx->host); - event.ip= sctx->ip; - event.ip_length= safe_strlen_uint(sctx->ip); - event.database= thd->db; - - mysql_audit_notify(thd, MYSQL_AUDIT_CONNECTION_CLASS, &event); - } -} - -static inline -void mysql_audit_notify_connection_disconnect(THD *thd, int errcode) -{ - if (mysql_audit_connection_enabled()) - { - const Security_context *sctx= thd->security_ctx; - mysql_event_connection event; - - event.event_subclass= MYSQL_AUDIT_CONNECTION_DISCONNECT; - event.status= errcode; - event.thread_id= (unsigned long)thd->thread_id; - event.user= sctx->user; - event.user_length= safe_strlen_uint(sctx->user); - event.priv_user= sctx->priv_user; - event.priv_user_length= strlen_uint(sctx->priv_user); - event.external_user= sctx->external_user; - event.external_user_length= safe_strlen_uint(sctx->external_user); - event.proxy_user= sctx->proxy_user; - event.proxy_user_length= strlen_uint(sctx->proxy_user); - event.host= sctx->host; - event.host_length= safe_strlen_uint(sctx->host); - event.ip= sctx->ip; - event.ip_length= safe_strlen_uint(sctx->ip) ; - event.database= thd->db; - - mysql_audit_notify(thd, MYSQL_AUDIT_CONNECTION_CLASS, &event); - } -} - -static inline -void mysql_audit_notify_connection_change_user(THD *thd, - const Security_context *old_ctx) -{ - if (mysql_audit_connection_enabled()) - { - mysql_event_connection event; - - event.event_subclass= MYSQL_AUDIT_CONNECTION_CHANGE_USER; - event.status= thd->get_stmt_da()->is_error() ? - thd->get_stmt_da()->sql_errno() : 0; - event.thread_id= (unsigned long)thd->thread_id; - event.user= old_ctx->user; - event.user_length= safe_strlen_uint(old_ctx->user); - event.priv_user= old_ctx->priv_user; - event.priv_user_length= strlen_uint(old_ctx->priv_user); - event.external_user= old_ctx->external_user; - event.external_user_length= safe_strlen_uint(old_ctx->external_user); - event.proxy_user= old_ctx->proxy_user; - event.proxy_user_length= strlen_uint(old_ctx->proxy_user); - event.host= old_ctx->host; - event.host_length= safe_strlen_uint(old_ctx->host); - event.ip= old_ctx->ip; - event.ip_length= safe_strlen_uint(old_ctx->ip); - event.database= thd->db; - - mysql_audit_notify(thd, MYSQL_AUDIT_CONNECTION_CLASS, &event); - } -} - - -static inline -void mysql_audit_external_lock_ex(THD *thd, my_thread_id thread_id, - const char *user, const char *host, const char *ip, query_id_t query_id, - TABLE_SHARE *share, int lock) -{ - if (lock != F_UNLCK && mysql_audit_table_enabled()) - { - const Security_context *sctx= thd->security_ctx; - mysql_event_table event; - - event.event_subclass= MYSQL_AUDIT_TABLE_LOCK; - event.read_only= lock == F_RDLCK; - event.thread_id= (unsigned long)thread_id; - event.user= user; - event.priv_user= sctx->priv_user; - event.priv_host= sctx->priv_host; - event.external_user= sctx->external_user; - event.proxy_user= sctx->proxy_user; - event.host= host; - event.ip= ip; - event.database= share->db; - event.table= share->table_name; - event.new_database= null_clex_str; - event.new_table= null_clex_str; - event.query_id= query_id; - - mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, &event); - } -} - -static inline -void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock) -{ - mysql_audit_external_lock_ex(thd, thd->thread_id, thd->security_ctx->user, - thd->security_ctx->host, thd->security_ctx->ip, thd->query_id, - share, lock); -} - -static inline -void mysql_audit_create_table(TABLE *table) -{ - if (mysql_audit_table_enabled()) - { - THD *thd= table->in_use; - const TABLE_SHARE *share= table->s; - const Security_context *sctx= thd->security_ctx; - mysql_event_table event; - - event.event_subclass= MYSQL_AUDIT_TABLE_CREATE; - event.read_only= 0; - event.thread_id= (unsigned long)thd->thread_id; - event.user= sctx->user; - event.priv_user= sctx->priv_user; - event.priv_host= sctx->priv_host; - event.external_user= sctx->external_user; - event.proxy_user= sctx->proxy_user; - event.host= sctx->host; - event.ip= sctx->ip; - event.database= share->db; - event.table= share->table_name; - event.new_database= null_clex_str; - event.new_table= null_clex_str; - event.query_id= thd->query_id; - - mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, &event); - } -} - -static inline -void mysql_audit_drop_table(THD *thd, TABLE_LIST *table) -{ - if (mysql_audit_table_enabled()) - { - const Security_context *sctx= thd->security_ctx; - mysql_event_table event; - - event.event_subclass= MYSQL_AUDIT_TABLE_DROP; - event.read_only= 0; - event.thread_id= (unsigned long)thd->thread_id; - event.user= sctx->user; - event.priv_user= sctx->priv_user; - event.priv_host= sctx->priv_host; - event.external_user= sctx->external_user; - event.proxy_user= sctx->proxy_user; - event.host= sctx->host; - event.ip= sctx->ip; - event.database= table->db; - event.table= table->table_name; - event.new_database= null_clex_str; - event.new_table= null_clex_str; - event.query_id= thd->query_id; - - mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, &event); - } -} - -static inline -void mysql_audit_rename_table(THD *thd, const LEX_CSTRING *old_db, - const LEX_CSTRING *old_tb, - const LEX_CSTRING *new_db, const LEX_CSTRING *new_tb) -{ - if (mysql_audit_table_enabled()) - { - const Security_context *sctx= thd->security_ctx; - mysql_event_table event; - - event.event_subclass= MYSQL_AUDIT_TABLE_RENAME; - event.read_only= 0; - event.thread_id= (unsigned long)thd->thread_id; - event.user= sctx->user; - event.priv_user= sctx->priv_user; - event.priv_host= sctx->priv_host; - event.external_user= sctx->external_user; - event.proxy_user= sctx->proxy_user; - event.host= sctx->host; - event.ip= sctx->ip; - event.database= *old_db; - event.table= *old_tb; - event.new_database= *new_db; - event.new_table= *new_tb; - event.query_id= thd->query_id; - - mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, &event); - } -} - -static inline -void mysql_audit_alter_table(THD *thd, TABLE_LIST *table) -{ - if (mysql_audit_table_enabled()) - { - const Security_context *sctx= thd->security_ctx; - mysql_event_table event; - - event.event_subclass= MYSQL_AUDIT_TABLE_ALTER; - event.read_only= 0; - event.thread_id= (unsigned long)thd->thread_id; - event.user= sctx->user; - event.priv_user= sctx->priv_user; - event.priv_host= sctx->priv_host; - event.external_user= sctx->external_user; - event.proxy_user= sctx->proxy_user; - event.host= sctx->host; - event.ip= sctx->ip; - event.database= table->db; - event.table= table->table_name; - event.new_database= null_clex_str; - event.new_table= null_clex_str; - event.query_id= thd->query_id; - - mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, &event); - } -} - -#endif /* SQL_AUDIT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_base.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_base.h deleted file mode 100644 index ccfacaf..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_base.h +++ /dev/null @@ -1,663 +0,0 @@ -/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2011, 2018, MariaDB - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_BASE_INCLUDED -#define SQL_BASE_INCLUDED - -#include "sql_class.h" /* enum_column_usage */ -#include "sql_trigger.h" /* trg_event_type */ -#include "mysqld.h" /* key_map */ -#include "table_cache.h" - -class Item_ident; -struct Name_resolution_context; -class Open_table_context; -class Open_tables_state; -class Prelocking_strategy; -struct TABLE_LIST; -class THD; -struct handlerton; -struct TABLE; - -typedef class st_select_lex SELECT_LEX; - -typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE; - -/* - This enumeration type is used only by the function find_item_in_list - to return the info on how an item has been resolved against a list - of possibly aliased items. - The item can be resolved: - - against an alias name of the list's element (RESOLVED_AGAINST_ALIAS) - - against non-aliased field name of the list (RESOLVED_WITH_NO_ALIAS) - - against an aliased field name of the list (RESOLVED_BEHIND_ALIAS) - - ignoring the alias name in cases when SQL requires to ignore aliases - (e.g. when the resolved field reference contains a table name or - when the resolved item is an expression) (RESOLVED_IGNORING_ALIAS) -*/ -enum enum_resolution_type { - NOT_RESOLVED=0, - RESOLVED_IGNORING_ALIAS, - RESOLVED_BEHIND_ALIAS, - RESOLVED_WITH_NO_ALIAS, - RESOLVED_AGAINST_ALIAS -}; - -/* Argument to flush_tables() of what to flush */ -enum flush_tables_type { - FLUSH_ALL, - FLUSH_NON_TRANS_TABLES, - FLUSH_SYS_TABLES -}; - -enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND, - IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE, - IGNORE_EXCEPT_NON_UNIQUE}; - -/* Flag bits for unique_table() */ -#define CHECK_DUP_ALLOW_DIFFERENT_ALIAS 1 -#define CHECK_DUP_FOR_CREATE 2 -#define CHECK_DUP_SKIP_TEMP_TABLE 4 - -uint get_table_def_key(const TABLE_LIST *table_list, const char **key); -TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update, - uint lock_flags); - -/* mysql_lock_tables() and open_table() flags bits */ -#define MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK 0x0001 -#define MYSQL_OPEN_IGNORE_FLUSH 0x0002 -/* MYSQL_OPEN_TEMPORARY_ONLY (0x0004) is not used anymore. */ -#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0008 -#define MYSQL_LOCK_LOG_TABLE 0x0010 -/** - Do not try to acquire a metadata lock on the table: we - already have one. -*/ -#define MYSQL_OPEN_HAS_MDL_LOCK 0x0020 -/** - If in locked tables mode, ignore the locked tables and get - a new instance of the table. -*/ -#define MYSQL_OPEN_GET_NEW_TABLE 0x0040 -/* 0x0080 used to be MYSQL_OPEN_SKIP_TEMPORARY */ -/** Fail instead of waiting when conficting metadata lock is discovered. */ -#define MYSQL_OPEN_FAIL_ON_MDL_CONFLICT 0x0100 -/** Open tables using MDL_SHARED lock instead of one specified in parser. */ -#define MYSQL_OPEN_FORCE_SHARED_MDL 0x0200 -/** - Open tables using MDL_SHARED_HIGH_PRIO lock instead of one specified - in parser. -*/ -#define MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL 0x0400 -/** - When opening or locking the table, use the maximum timeout - (LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value. -*/ -#define MYSQL_LOCK_IGNORE_TIMEOUT 0x0800 -/** - When acquiring "strong" (SNW, SNRW, X) metadata locks on tables to - be open do not acquire global and schema-scope IX locks. -*/ -#define MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK 0x1000 -#define MYSQL_LOCK_NOT_TEMPORARY 0x2000 -#define MYSQL_LOCK_USE_MALLOC 0x4000 -/** - Only check THD::killed if waits happen (e.g. wait on MDL, wait on - table flush, wait on thr_lock.c locks) while opening and locking table. -*/ -#define MYSQL_OPEN_IGNORE_KILLED 0x8000 -/** - Don't try to auto-repair table -*/ -#define MYSQL_OPEN_IGNORE_REPAIR 0x10000 - -/** - Don't call decide_logging_format. Used for statistic tables etc -*/ -#define MYSQL_OPEN_IGNORE_LOGGING_FORMAT 0x20000 - -/** Please refer to the internals manual. */ -#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\ - MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |\ - MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |\ - MYSQL_LOCK_IGNORE_TIMEOUT |\ - MYSQL_OPEN_GET_NEW_TABLE |\ - MYSQL_OPEN_HAS_MDL_LOCK) - -bool is_locked_view(THD *thd, TABLE_LIST *t); -bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx); - -bool get_key_map_from_key_list(key_map *map, TABLE *table, - List *index_list); -TABLE *find_locked_table(TABLE *list, const char *db, const char *table_name); -TABLE *find_write_locked_table(TABLE *list, const char *db, - const char *table_name); -thr_lock_type read_lock_type_for_table(THD *thd, - Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, - bool routine_modifies_data); - -my_bool mysql_rm_tmp_tables(void); -void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, - const MDL_savepoint &start_of_statement_svp); -bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_CSTRING *db, - LEX_CSTRING *table, thr_lock_type lock_type); -TABLE_LIST *find_table_in_list(TABLE_LIST *table, - TABLE_LIST *TABLE_LIST::*link, - const LEX_CSTRING *db_name, - const LEX_CSTRING *table_name); -int close_thread_tables(THD *thd); -void switch_to_nullable_trigger_fields(List &items, TABLE *); -void switch_defaults_to_nullable_trigger_fields(TABLE *table); -bool fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, - List &fields, - List &values, - bool ignore_errors, - enum trg_event_type event); -bool fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, - Field **field, - List &values, - bool ignore_errors, - enum trg_event_type event); -bool insert_fields(THD *thd, Name_resolution_context *context, - const char *db_name, const char *table_name, - List_iterator *it, bool any_privileges, - uint *hidden_bit_fields); -void make_leaves_list(THD *thd, List &list, TABLE_LIST *tables, - bool full_table_list, TABLE_LIST *boundary); -int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, - List *sum_func_list, SELECT_LEX *sl); -int setup_returning_fields(THD* thd, TABLE_LIST* table_list); -bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, - List &item, enum_column_usage column_usage, - List *sum_func_list, List *pre_fix, - bool allow_sum_func); -void unfix_fields(List &items); -bool fill_record(THD * thd, TABLE *table_arg, List &fields, - List &values, bool ignore_errors, bool update); -bool fill_record(THD *thd, TABLE *table, Field **field, List &values, - bool ignore_errors, bool use_value); - -Field * -find_field_in_tables(THD *thd, Item_ident *item, - TABLE_LIST *first_table, TABLE_LIST *last_table, - Item **ref, find_item_error_report_type report_error, - bool check_privileges, bool register_tree_change); -Field * -find_field_in_table_ref(THD *thd, TABLE_LIST *table_list, - const char *name, size_t length, - const char *item_name, const char *db_name, - const char *table_name, Item **ref, - bool check_privileges, bool allow_rowid, - uint *cached_field_index_ptr, - bool register_tree_change, TABLE_LIST **actual_table); -Field * -find_field_in_table(THD *thd, TABLE *table, const char *name, size_t length, - bool allow_rowid, uint *cached_field_index_ptr); -Field * -find_field_in_table_sef(TABLE *table, const char *name); -Item ** find_item_in_list(Item *item, List &items, uint *counter, - find_item_error_report_type report_error, - enum_resolution_type *resolution, uint limit= 0); -bool setup_tables(THD *thd, Name_resolution_context *context, - List *from_clause, TABLE_LIST *tables, - List &leaves, bool select_insert, - bool full_table_list); -bool setup_tables_and_check_access(THD *thd, - Name_resolution_context *context, - List *from_clause, - TABLE_LIST *tables, - List &leaves, - bool select_insert, - privilege_t want_access_first, - privilege_t want_access, - bool full_table_list); -bool wait_while_table_is_used(THD *thd, TABLE *table, - enum ha_extra_function function); - -void drop_open_table(THD *thd, TABLE *table, const LEX_CSTRING *db_name, - const LEX_CSTRING *table_name); -void update_non_unique_table_error(TABLE_LIST *update, - const char *operation, - TABLE_LIST *duplicate); -int setup_conds(THD *thd, TABLE_LIST *tables, List &leaves, - COND **conds); -void wrap_ident(THD *thd, Item **conds); -int setup_ftfuncs(SELECT_LEX* select); -void cleanup_ftfuncs(SELECT_LEX *select_lex); -int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order); -bool lock_table_names(THD *thd, const DDL_options_st &options, - TABLE_LIST *table_list, - TABLE_LIST *table_list_end, ulong lock_wait_timeout, - uint flags); -static inline bool -lock_table_names(THD *thd, TABLE_LIST *table_list, - TABLE_LIST *table_list_end, ulong lock_wait_timeout, - uint flags) -{ - return lock_table_names(thd, thd->lex->create_info, table_list, - table_list_end, lock_wait_timeout, flags); -} -bool open_tables(THD *thd, const DDL_options_st &options, - TABLE_LIST **tables, uint *counter, - uint flags, Prelocking_strategy *prelocking_strategy); - -static inline bool -open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags, - Prelocking_strategy *prelocking_strategy) -{ - return open_tables(thd, thd->lex->create_info, tables, counter, flags, - prelocking_strategy); -} -/* open_and_lock_tables with optional derived handling */ -bool open_and_lock_tables(THD *thd, const DDL_options_st &options, - TABLE_LIST *tables, - bool derived, uint flags, - Prelocking_strategy *prelocking_strategy); -static inline bool -open_and_lock_tables(THD *thd, TABLE_LIST *tables, - bool derived, uint flags, - Prelocking_strategy *prelocking_strategy) -{ - return open_and_lock_tables(thd, thd->lex->create_info, - tables, derived, flags, prelocking_strategy); -} -/* simple open_and_lock_tables without derived handling for single table */ -TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l, - thr_lock_type lock_type, uint flags, - Prelocking_strategy *prelocking_strategy); -bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags, - uint dt_phases); -bool open_tables_only_view_structure(THD *thd, TABLE_LIST *tables, - bool can_deadlock); -bool open_and_lock_internal_tables(TABLE *table, bool lock); -bool lock_tables(THD *thd, TABLE_LIST *tables, uint counter, uint flags); -int decide_logging_format(THD *thd, TABLE_LIST *tables); -void close_thread_table(THD *thd, TABLE **table_ptr); -TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, - uint check_flag); -bool is_equal(const LEX_CSTRING *a, const LEX_CSTRING *b); - -class Open_tables_backup; -/* Functions to work with system tables. */ -bool open_system_tables_for_read(THD *thd, TABLE_LIST *table_list); -void close_system_tables(THD *thd); -void close_mysql_tables(THD *thd); -TABLE *open_system_table_for_update(THD *thd, TABLE_LIST *one_table); -TABLE *open_log_table(THD *thd, TABLE_LIST *one_table, Open_tables_backup *backup); -void close_log_table(THD *thd, Open_tables_backup *backup); - -bool close_cached_tables(THD *thd, TABLE_LIST *tables, - bool wait_for_refresh, ulong timeout); -void purge_tables(); -bool flush_tables(THD *thd, flush_tables_type flag); -void close_all_tables_for_name(THD *thd, TABLE_SHARE *share, - ha_extra_function extra, - TABLE *skip_table); -OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild); -bool tdc_open_view(THD *thd, TABLE_LIST *table_list, uint flags); - -TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db, - const char *table_name, - int *p_error); -void mark_tmp_table_for_reuse(TABLE *table); - -int dynamic_column_error_message(enum_dyncol_func_result rc); - -/* open_and_lock_tables with optional derived handling */ -int open_and_lock_tables_derived(THD *thd, TABLE_LIST *tables, bool derived); - -extern "C" int simple_raw_key_cmp(void* arg, const void* key1, - const void* key2); -extern "C" int count_distinct_walk(void *elem, element_count count, void *arg); -int simple_str_key_cmp(void* arg, uchar* key1, uchar* key2); - -extern Item **not_found_item; -extern Field *not_found_field; -extern Field *view_ref_found; - -/** - clean/setup table fields and map. - - @param table TABLE structure pointer (which should be setup) - @param table_list TABLE_LIST structure pointer (owner of TABLE) - @param tablenr table number -*/ - - -inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr) -{ - table->used_fields= 0; - table_list->reset_const_table(); - table->null_row= 0; - table->status= STATUS_NO_RECORD; - table->maybe_null= table_list->outer_join; - TABLE_LIST *embedding= table_list->embedding; - while (!table->maybe_null && embedding) - { - table->maybe_null= embedding->outer_join; - embedding= embedding->embedding; - } - table->tablenr= tablenr; - table->map= (table_map) 1 << tablenr; - table->force_index= table_list->force_index; - table->force_index_order= table->force_index_group= 0; - table->covering_keys= table->s->keys_for_keyread; -} - -inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table, - LEX_CSTRING *db_name, - LEX_CSTRING *table_name) -{ - return find_table_in_list(table, &TABLE_LIST::next_global, - db_name, table_name); -} - -inline bool setup_fields_with_no_wrap(THD *thd, Ref_ptr_array ref_pointer_array, - List &item, - enum_column_usage column_usage, - List *sum_func_list, - bool allow_sum_func) -{ - bool res; - SELECT_LEX *first= thd->lex->first_select_lex(); - DBUG_ASSERT(thd->lex->current_select == first); - first->no_wrap_view_item= TRUE; - res= setup_fields(thd, ref_pointer_array, item, column_usage, - sum_func_list, NULL, allow_sum_func); - first->no_wrap_view_item= FALSE; - return res; -} - -/** - An abstract class for a strategy specifying how the prelocking - algorithm should extend the prelocking set while processing - already existing elements in the set. -*/ - -class Prelocking_strategy -{ -public: - virtual ~Prelocking_strategy() { } - - virtual void reset(THD *thd) { }; - virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, - Sroutine_hash_entry *rt, sp_head *sp, - bool *need_prelocking) = 0; - virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking) = 0; - virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking)= 0; - virtual bool handle_end(THD *thd) { return 0; }; -}; - - -/** - A Strategy for prelocking algorithm suitable for DML statements. - - Ensures that all tables used by all statement's SF/SP/triggers and - required for foreign key checks are prelocked and SF/SPs used are - cached. -*/ - -class DML_prelocking_strategy : public Prelocking_strategy -{ -public: - virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, - Sroutine_hash_entry *rt, sp_head *sp, - bool *need_prelocking); - virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); - virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); -}; - - -/** - A strategy for prelocking algorithm to be used for LOCK TABLES - statement. -*/ - -class Lock_tables_prelocking_strategy : public DML_prelocking_strategy -{ - virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); -}; - - -/** - Strategy for prelocking algorithm to be used for ALTER TABLE statements. - - Unlike DML or LOCK TABLES strategy, it doesn't - prelock triggers, views or stored routines, since they are not - used during ALTER. -*/ - -class Alter_table_prelocking_strategy : public Prelocking_strategy -{ -public: - virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, - Sroutine_hash_entry *rt, sp_head *sp, - bool *need_prelocking); - virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); - virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list, bool *need_prelocking); -}; - - -inline bool -open_tables(THD *thd, const DDL_options_st &options, - TABLE_LIST **tables, uint *counter, uint flags) -{ - DML_prelocking_strategy prelocking_strategy; - - return open_tables(thd, options, tables, counter, flags, - &prelocking_strategy); -} -inline bool -open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags) -{ - DML_prelocking_strategy prelocking_strategy; - - return open_tables(thd, thd->lex->create_info, tables, counter, flags, - &prelocking_strategy); -} - -inline TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l, - thr_lock_type lock_type, uint flags) -{ - DML_prelocking_strategy prelocking_strategy; - - return open_n_lock_single_table(thd, table_l, lock_type, flags, - &prelocking_strategy); -} - - -/* open_and_lock_tables with derived handling */ -inline bool open_and_lock_tables(THD *thd, - const DDL_options_st &options, - TABLE_LIST *tables, - bool derived, uint flags) -{ - DML_prelocking_strategy prelocking_strategy; - - return open_and_lock_tables(thd, options, tables, derived, flags, - &prelocking_strategy); -} -inline bool open_and_lock_tables(THD *thd, TABLE_LIST *tables, - bool derived, uint flags) -{ - DML_prelocking_strategy prelocking_strategy; - - return open_and_lock_tables(thd, thd->lex->create_info, - tables, derived, flags, - &prelocking_strategy); -} - - -bool restart_trans_for_tables(THD *thd, TABLE_LIST *table); - -bool extend_table_list(THD *thd, TABLE_LIST *tables, - Prelocking_strategy *prelocking_strategy, - bool has_prelocking_list); - -/** - A context of open_tables() function, used to recover - from a failed open_table() or open_routine() attempt. -*/ - -class Open_table_context -{ -public: - enum enum_open_table_action - { - OT_NO_ACTION= 0, - OT_BACKOFF_AND_RETRY, - OT_REOPEN_TABLES, - OT_DISCOVER, - OT_REPAIR - }; - Open_table_context(THD *thd, uint flags); - - bool recover_from_failed_open(); - bool request_backoff_action(enum_open_table_action action_arg, - TABLE_LIST *table); - - bool can_recover_from_failed_open() const - { return m_action != OT_NO_ACTION; } - - /** - When doing a back-off, we close all tables acquired by this - statement. Return an MDL savepoint taken at the beginning of - the statement, so that we can rollback to it before waiting on - locks. - */ - const MDL_savepoint &start_of_statement_svp() const - { - return m_start_of_statement_svp; - } - - inline ulong get_timeout() const - { - return m_timeout; - } - - uint get_flags() const { return m_flags; } - - /** - Set flag indicating that we have already acquired metadata lock - protecting this statement against GRL while opening tables. - */ - void set_has_protection_against_grl(enum_mdl_type mdl_type) - { - m_has_protection_against_grl|= MDL_BIT(mdl_type); - } - - bool has_protection_against_grl(enum_mdl_type mdl_type) const - { - return (bool) (m_has_protection_against_grl & MDL_BIT(mdl_type)); - } - -private: - /* THD for which tables are opened. */ - THD *m_thd; - /** - For OT_DISCOVER and OT_REPAIR actions, the table list element for - the table which definition should be re-discovered or which - should be repaired. - */ - TABLE_LIST *m_failed_table; - MDL_savepoint m_start_of_statement_svp; - /** - Lock timeout in seconds. Initialized to LONG_TIMEOUT when opening system - tables or to the "lock_wait_timeout" system variable for regular tables. - */ - ulong m_timeout; - /* open_table() flags. */ - uint m_flags; - /** Back off action. */ - enum enum_open_table_action m_action; - /** - Whether we had any locks when this context was created. - If we did, they are from the previous statement of a transaction, - and we can't safely do back-off (and release them). - */ - bool m_has_locks; - /** - Indicates that in the process of opening tables we have acquired - protection against global read lock. - */ - mdl_bitmap_t m_has_protection_against_grl; -}; - - -/** - Check if a TABLE_LIST instance represents a pre-opened temporary table. -*/ - -inline bool is_temporary_table(TABLE_LIST *tl) -{ - if (tl->view || tl->schema_table) - return FALSE; - - if (!tl->table) - return FALSE; - - /* - NOTE: 'table->s' might be NULL for specially constructed TABLE - instances. See SHOW TRIGGERS for example. - */ - - if (!tl->table->s) - return FALSE; - - return tl->table->s->tmp_table != NO_TMP_TABLE; -} - - -/** - This internal handler is used to trap ER_NO_SUCH_TABLE. -*/ - -class No_such_table_error_handler : public Internal_error_handler -{ -public: - No_such_table_error_handler() - : m_handled_errors(0), m_unhandled_errors(0) - {} - - bool handle_condition(THD *thd, - uint sql_errno, - const char* sqlstate, - Sql_condition::enum_warning_level *level, - const char* msg, - Sql_condition ** cond_hdl); - - /** - Returns TRUE if one or more ER_NO_SUCH_TABLE errors have been - trapped and no other errors have been seen. FALSE otherwise. - */ - bool safely_trapped_errors(); - -private: - int m_handled_errors; - int m_unhandled_errors; -}; - - -#endif /* SQL_BASE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_basic_types.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_basic_types.h deleted file mode 100644 index 3200228..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_basic_types.h +++ /dev/null @@ -1,337 +0,0 @@ -/* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2016, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* File that includes common types used globally in MariaDB */ - -#ifndef SQL_TYPES_INCLUDED -#define SQL_TYPES_INCLUDED - -typedef ulonglong sql_mode_t; -typedef int64 query_id_t; - -enum enum_nullability { NOT_NULL, NULLABLE }; - - -/* - "fuzzydate" with strict data type control. - Represents a mixture of *only* data type conversion flags, without rounding. - Please keep "explicit" in constructors and conversion methods. -*/ -class date_conv_mode_t -{ -public: - enum value_t - { - CONV_NONE= 0U, - /* - FUZZY_DATES is used for the result will only be used for comparison - purposes. Conversion is as relaxed as possible. - */ - FUZZY_DATES= 1U, - TIME_ONLY= 4U, - INTERVAL_hhmmssff= 8U, - INTERVAL_DAY= 16U, - RANGE0_LAST= INTERVAL_DAY, - NO_ZERO_IN_DATE= (1UL << 23), // MODE_NO_ZERO_IN_DATE - NO_ZERO_DATE= (1UL << 24), // MODE_NO_ZERO_DATE - INVALID_DATES= (1UL << 25) // MODE_INVALID_DATES - }; - - /* - BIT-OR for all known values. Let's have a separate enum for it. - - We don't put this value "value_t", to avoid handling it in switch(). - - We don't put this value as a static const inside the class, - because "gdb" would display it every time when we do "print" - for a time_round_mode_t value. - - We can't put into into a function returning this value, because - it's not allowed to use functions in static_assert. - */ - enum known_values_t - { - KNOWN_MODES= FUZZY_DATES | - TIME_ONLY | INTERVAL_hhmmssff | INTERVAL_DAY | - NO_ZERO_IN_DATE | NO_ZERO_DATE | INVALID_DATES - }; -private: - value_t m_mode; -public: - - // Constructors - explicit date_conv_mode_t(ulonglong fuzzydate) - :m_mode((value_t) fuzzydate) - { } - - // Conversion operators - explicit operator ulonglong() const - { - return m_mode; - } - explicit operator bool() const - { - return m_mode != 0; - } - - // Unary operators - ulonglong operator~() const - { - return ~m_mode; - } - - // Dyadic bitwise operators - date_conv_mode_t operator&(const date_conv_mode_t &other) const - { - return date_conv_mode_t(m_mode & other.m_mode); - } - date_conv_mode_t operator&(const ulonglong other) const - { - return date_conv_mode_t(m_mode & other); - } - - date_conv_mode_t operator|(const date_conv_mode_t &other) const - { - return date_conv_mode_t(m_mode | other.m_mode); - } - - // Dyadic bitwise assignment operators - date_conv_mode_t &operator&=(const date_conv_mode_t &other) - { - m_mode= value_t(m_mode & other.m_mode); - return *this; - } - - date_conv_mode_t &operator|=(const date_conv_mode_t &other) - { - m_mode= value_t(m_mode | other.m_mode); - return *this; - } -}; - - -/* - Fractional rounding mode for temporal data types. -*/ -class time_round_mode_t -{ -public: - enum value_t - { - /* - Use FRAC_NONE when the value needs no rounding nor truncation, - because it is already known not to haveany fractional digits outside - of the requested precision. - */ - FRAC_NONE= 0, - FRAC_TRUNCATE= date_conv_mode_t::RANGE0_LAST << 1, // 32 - FRAC_ROUND= date_conv_mode_t::RANGE0_LAST << 2 // 64 - }; - // BIT-OR for all known values. See comments in time_conv_mode_t. - enum known_values_t - { - KNOWN_MODES= FRAC_TRUNCATE | FRAC_ROUND - }; -private: - value_t m_mode; -public: - // Constructors - explicit time_round_mode_t(ulonglong mode) - :m_mode((value_t) mode) - { - DBUG_ASSERT(mode == FRAC_NONE || - mode == FRAC_TRUNCATE || - mode == FRAC_ROUND); - } - // Conversion operators - explicit operator ulonglong() const - { - return m_mode; - } - value_t mode() const - { - return m_mode; - } - // Comparison operators - bool operator==(const time_round_mode_t &other) - { - return m_mode == other.m_mode; - } -}; - - -/* - "fuzzydate" with strict data type control. - Used as a parameter to get_date() and represents a mixture of: - - data type conversion flags - - fractional second rounding flags - Please keep "explicit" in constructors and conversion methods. -*/ -class date_mode_t -{ -public: - enum value_t - { - CONV_NONE= date_conv_mode_t::CONV_NONE, // 0 - FUZZY_DATES= date_conv_mode_t::FUZZY_DATES, // 1 - TIME_ONLY= date_conv_mode_t::TIME_ONLY, // 4 - INTERVAL_hhmmssff= date_conv_mode_t::INTERVAL_hhmmssff, // 8 - INTERVAL_DAY= date_conv_mode_t::INTERVAL_DAY, // 16 - FRAC_TRUNCATE= time_round_mode_t::FRAC_TRUNCATE, // 32 - FRAC_ROUND= time_round_mode_t::FRAC_ROUND, // 64 - NO_ZERO_IN_DATE= date_conv_mode_t::NO_ZERO_IN_DATE, // (1UL << 23) - NO_ZERO_DATE= date_conv_mode_t::NO_ZERO_DATE, // (1UL << 24) - INVALID_DATES= date_conv_mode_t::INVALID_DATES, // (1UL << 25) - }; -protected: - value_t m_mode; -public: - - // Constructors - explicit date_mode_t(ulonglong fuzzydate) - :m_mode((value_t) fuzzydate) - { } - - // Conversion operators - explicit operator ulonglong() const - { - return m_mode; - } - explicit operator bool() const - { - return m_mode != 0; - } - explicit operator date_conv_mode_t() const - { - return date_conv_mode_t(ulonglong(m_mode) & date_conv_mode_t::KNOWN_MODES); - } - explicit operator time_round_mode_t() const - { - return time_round_mode_t(ulonglong(m_mode) & time_round_mode_t::KNOWN_MODES); - } - // Unary operators - ulonglong operator~() const - { - return ~m_mode; - } - bool operator!() const - { - return !m_mode; - } - - // Dyadic bitwise operators - date_mode_t operator&(const date_mode_t &other) const - { - return date_mode_t(m_mode & other.m_mode); - } - date_mode_t operator&(ulonglong other) const - { - return date_mode_t(m_mode & other); - } - - date_mode_t operator|(const date_mode_t &other) const - { - return date_mode_t(m_mode | other.m_mode); - } - - // Dyadic bitwise assignment operators - date_mode_t &operator&=(const date_mode_t &other) - { - m_mode= value_t(m_mode & other.m_mode); - return *this; - } - - date_mode_t &operator|=(const date_mode_t &other) - { - m_mode= value_t(m_mode | other.m_mode); - return *this; - } - - date_mode_t &operator|=(const date_conv_mode_t &other) - { - m_mode= value_t(m_mode | ulonglong(other)); - return *this; - } -}; - - -// Bitwise OR out-of-class operators for data type mixtures -static inline date_mode_t operator|(const date_mode_t &a, - const date_conv_mode_t &b) -{ - return date_mode_t(ulonglong(a) | ulonglong(b)); -} - -static inline date_mode_t operator|(const date_conv_mode_t &a, - const time_round_mode_t &b) -{ - return date_mode_t(ulonglong(a) | ulonglong(b)); -} - - -static inline date_mode_t operator|(const date_conv_mode_t &a, - const date_mode_t &b) -{ - return date_mode_t(ulonglong(a) | ulonglong(b)); -} - - -// Bitwise AND out-of-class operators for data type mixtures -static inline date_conv_mode_t operator&(const date_mode_t &a, - const date_conv_mode_t &b) -{ - return date_conv_mode_t(ulonglong(a) & ulonglong(b)); -} - -static inline date_conv_mode_t operator&(const date_conv_mode_t &a, - const date_mode_t &b) -{ - return date_conv_mode_t(ulonglong(a) & ulonglong(b)); -} - -static inline date_conv_mode_t operator&(sql_mode_t &a, - const date_conv_mode_t &b) -{ - return date_conv_mode_t(a & ulonglong(b)); -} - - -static const date_conv_mode_t - TIME_CONV_NONE (date_conv_mode_t::CONV_NONE), - TIME_FUZZY_DATES (date_conv_mode_t::FUZZY_DATES), - TIME_TIME_ONLY (date_conv_mode_t::TIME_ONLY), - TIME_INTERVAL_hhmmssff (date_conv_mode_t::INTERVAL_hhmmssff), - TIME_INTERVAL_DAY (date_conv_mode_t::INTERVAL_DAY), - TIME_NO_ZERO_IN_DATE (date_conv_mode_t::NO_ZERO_IN_DATE), - TIME_NO_ZERO_DATE (date_conv_mode_t::NO_ZERO_DATE), - TIME_INVALID_DATES (date_conv_mode_t::INVALID_DATES); - -// An often used combination -static const date_conv_mode_t - TIME_NO_ZEROS (date_conv_mode_t::NO_ZERO_DATE| - date_conv_mode_t::NO_ZERO_IN_DATE); - -// Flags understood by str_to_xxx, number_to_xxx, check_date -static const date_conv_mode_t - TIME_MODE_FOR_XXX_TO_DATE (date_mode_t::NO_ZERO_IN_DATE | - date_mode_t::NO_ZERO_DATE | - date_mode_t::INVALID_DATES); - -static const time_round_mode_t - TIME_FRAC_NONE (time_round_mode_t::FRAC_NONE), - TIME_FRAC_TRUNCATE (time_round_mode_t::FRAC_TRUNCATE), - TIME_FRAC_ROUND (time_round_mode_t::FRAC_ROUND); - - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_binlog.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_binlog.h deleted file mode 100644 index d10d78e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_binlog.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_BINLOG_INCLUDED -#define SQL_BINLOG_INCLUDED - -class THD; - -void mysql_client_binlog_statement(THD *thd); - -#endif /* SQL_BINLOG_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_bitmap.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_bitmap.h deleted file mode 100644 index 02dc819..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_bitmap.h +++ /dev/null @@ -1,314 +0,0 @@ -/* Copyright (c) 2003, 2013, Oracle and/or its affiliates - Copyright (c) 2009, 2013, Monty Program Ab. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Implementation of a bitmap type. - The idea with this is to be able to handle any constant number of bits but - also be able to use 32 or 64 bits bitmaps very efficiently -*/ - -#ifndef SQL_BITMAP_INCLUDED -#define SQL_BITMAP_INCLUDED - -#include -#include -#include - - -/* An iterator to quickly walk over bits in ulonglong bitmap. */ -class Table_map_iterator -{ - ulonglong bmp; -public: - Table_map_iterator(ulonglong t): bmp(t){} - uint next_bit() - { - if (!bmp) - return BITMAP_END; - uint bit= my_find_first_bit(bmp); - bmp &= ~(1ULL << bit); - return bit; - } - int operator++(int) { return next_bit(); } - enum { BITMAP_END= 64 }; -}; - -template class Bitmap -{ -/* - Workaround GCC optimizer bug (generating SSE instuctions on unaligned data) -*/ -#if defined (__GNUC__) && defined(__x86_64__) && (__GNUC__ < 6) && !defined(__clang__) -#define NEED_GCC_NO_SSE_WORKAROUND -#endif - -#ifdef NEED_GCC_NO_SSE_WORKAROUND -#pragma GCC push_options -#pragma GCC target ("no-sse") -#endif - -private: - static const int BITS_PER_ELEMENT= sizeof(ulonglong) * 8; - static const int ARRAY_ELEMENTS= (width + BITS_PER_ELEMENT - 1) / BITS_PER_ELEMENT; - static const ulonglong ALL_BITS_SET= ULLONG_MAX; - - ulonglong buffer[ARRAY_ELEMENTS]; - - uint bit_index(uint n) const - { - DBUG_ASSERT(n < width); - return ARRAY_ELEMENTS == 1 ? 0 : n / BITS_PER_ELEMENT; - } - ulonglong bit_mask(uint n) const - { - DBUG_ASSERT(n < width); - return ARRAY_ELEMENTS == 1 ? 1ULL << n : 1ULL << (n % BITS_PER_ELEMENT); - } - ulonglong last_element_mask(int n) const - { - DBUG_ASSERT(n % BITS_PER_ELEMENT != 0); - return bit_mask(n) - 1; - } - -public: - /* - The default constructor does nothing. - The caller is supposed to either zero the memory - or to call set_all()/clear_all()/set_prefix() - to initialize bitmap. - */ - Bitmap() { } - - explicit Bitmap(uint prefix) - { - set_prefix(prefix); - } - void init(uint prefix) - { - set_prefix(prefix); - } - uint length() const - { - return width; - } - void set_bit(uint n) - { - buffer[bit_index(n)] |= bit_mask(n); - } - void clear_bit(uint n) - { - buffer[bit_index(n)] &= ~bit_mask(n); - } - bool is_set(uint n) const - { - return buffer[bit_index(n)] & bit_mask(n); - } - void set_prefix(uint prefix_size) - { - set_if_smaller(prefix_size, width); - - size_t idx= prefix_size / BITS_PER_ELEMENT; - - for (size_t i= 0; i < idx; i++) - buffer[i]= ALL_BITS_SET; - - if (prefix_size % BITS_PER_ELEMENT) - buffer[idx++]= last_element_mask(prefix_size); - - for (size_t i= idx; i < ARRAY_ELEMENTS; i++) - buffer[i]= 0; - } - bool is_prefix(uint prefix_size) const - { - DBUG_ASSERT(prefix_size <= width); - - size_t idx= prefix_size / BITS_PER_ELEMENT; - - for (size_t i= 0; i < idx; i++) - if (buffer[i] != ALL_BITS_SET) - return false; - - if (prefix_size % BITS_PER_ELEMENT) - if (buffer[idx++] != last_element_mask(prefix_size)) - return false; - - for (size_t i= idx; i < ARRAY_ELEMENTS; i++) - if (buffer[i] != 0) - return false; - - return true; - } - void set_all() - { - if (width % BITS_PER_ELEMENT) - set_prefix(width); - else if (ARRAY_ELEMENTS > 1) - memset(buffer, 0xff, sizeof(buffer)); - else - buffer[0] = ALL_BITS_SET; - } - void clear_all() - { - if (ARRAY_ELEMENTS > 1) - memset(buffer, 0, sizeof(buffer)); - else - buffer[0]= 0; - } - void intersect(const Bitmap& map2) - { - for (size_t i= 0; i < ARRAY_ELEMENTS; i++) - buffer[i] &= map2.buffer[i]; - } - -private: - /* - Intersect with a bitmap represented as as longlong. - In addition, pad the rest of the bitmap with 0 or 1 bits - depending on pad_with_ones parameter. - */ - void intersect_and_pad(ulonglong map2buff, bool pad_with_ones) - { - buffer[0] &= map2buff; - - for (size_t i= 1; i < ARRAY_ELEMENTS; i++) - buffer[i]= pad_with_ones ? ALL_BITS_SET : 0; - - if (ARRAY_ELEMENTS > 1 && (width % BITS_PER_ELEMENT) && pad_with_ones) - buffer[ARRAY_ELEMENTS - 1]= last_element_mask(width); - } - -public: - void intersect(ulonglong map2buff) - { - intersect_and_pad(map2buff, 0); - } - /* Use highest bit for all bits above first element. */ - void intersect_extended(ulonglong map2buff) - { - intersect_and_pad(map2buff, (map2buff & (1ULL << 63))); - } - void subtract(const Bitmap& map2) - { - for (size_t i= 0; i < ARRAY_ELEMENTS; i++) - buffer[i] &= ~(map2.buffer[i]); - } - void merge(const Bitmap& map2) - { - for (size_t i= 0; i < ARRAY_ELEMENTS; i++) - buffer[i] |= map2.buffer[i]; - } - bool is_clear_all() const - { - for (size_t i= 0; i < ARRAY_ELEMENTS; i++) - if (buffer[i]) - return false; - return true; - } - bool is_subset(const Bitmap& map2) const - { - for (size_t i= 0; i < ARRAY_ELEMENTS; i++) - if (buffer[i] & ~(map2.buffer[i])) - return false; - return true; - } - bool is_overlapping(const Bitmap& map2) const - { - for (size_t i= 0; i < ARRAY_ELEMENTS; i++) - if (buffer[i] & map2.buffer[i]) - return true; - return false; - } - bool operator==(const Bitmap& map2) const - { - if (ARRAY_ELEMENTS > 1) - return !memcmp(buffer,map2.buffer,sizeof(buffer)); - return buffer[0] == map2.buffer[0]; - } - bool operator!=(const Bitmap& map2) const - { - return !(*this == map2); - } - /* - Print hexadecimal representation of bitmap. - Truncate trailing zeros. - */ - char *print(char *buf) const - { - size_t last; /*index of the last non-zero element, or 0. */ - - for (last= ARRAY_ELEMENTS - 1; last && !buffer[last]; last--){} - - const int HEX_DIGITS_PER_ELEMENT= BITS_PER_ELEMENT / 4; - for (size_t i= 0; i < last; i++) - { - ulonglong num = buffer[i]; - uint shift = BITS_PER_ELEMENT - 4; - size_t pos= i * HEX_DIGITS_PER_ELEMENT; - for (size_t j= 0; j < HEX_DIGITS_PER_ELEMENT; j++) - { - buf[pos + j]= _dig_vec_upper[(num >> shift) & 0xf]; - shift += 4; - } - } - longlong2str(buffer[last], buf, 16); - return buf; - } - ulonglong to_ulonglong() const - { - return buffer[0]; - } - uint bits_set() - { - uint res= 0; - for (size_t i= 0; i < ARRAY_ELEMENTS; i++) - res += my_count_bits(buffer[i]); - return res; - } - class Iterator - { - const Bitmap& map; - uint offset; - Table_map_iterator tmi; - public: - Iterator(const Bitmap& map2) : map(map2), offset(0), tmi(map2.buffer[0]) {} - int operator++(int) - { - for (;;) - { - int nextbit= tmi++; - - if (nextbit != Table_map_iterator::BITMAP_END) - return offset + nextbit; - - if (offset + BITS_PER_ELEMENT >= map.length()) - return BITMAP_END; - - offset += BITS_PER_ELEMENT; - tmi= Table_map_iterator(map.buffer[offset / BITS_PER_ELEMENT]); - } - } - enum { BITMAP_END = width }; - }; - -#ifdef NEED_GCC_NO_SSE_WORKAROUND -#pragma GCC pop_options -#undef NEED_GCC_NO_SSE_WORKAROUND -#endif -}; - -typedef Bitmap key_map; /* Used for finding keys */ - -#endif /* SQL_BITMAP_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_bootstrap.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_bootstrap.h deleted file mode 100644 index f12d66a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_bootstrap.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef SQL_BOOTSTRAP_H -#define SQL_BOOTSTRAP_H - -/** - The maximum size of a bootstrap query. - Increase this size if parsing a longer query during bootstrap is necessary. - The longest query in use depends on the documentation content, - see the file fill_help_tables.sql -*/ -#define MAX_BOOTSTRAP_QUERY_SIZE 20000 -/** - The maximum size of a bootstrap query, expressed in a single line. - Do not increase this size, use the multiline syntax instead. -*/ -#define MAX_BOOTSTRAP_LINE_SIZE 20000 -#define MAX_BOOTSTRAP_ERROR_LEN 256 - -#define READ_BOOTSTRAP_SUCCESS 0 -#define READ_BOOTSTRAP_EOF 1 -#define READ_BOOTSTRAP_ERROR 2 -#define READ_BOOTSTRAP_QUERY_SIZE 3 - -typedef void *fgets_input_t; -typedef char * (*fgets_fn_t)(char *, size_t, fgets_input_t, int *error); - -int read_bootstrap_query(char *query, int *query_length, - fgets_input_t input, fgets_fn_t fgets_fn, int *error); - -#endif - - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cache.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cache.h deleted file mode 100644 index b92b397..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cache.h +++ /dev/null @@ -1,612 +0,0 @@ -/* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _SQL_CACHE_H -#define _SQL_CACHE_H - -#include "hash.h" -#include "my_base.h" /* ha_rows */ - -class MY_LOCALE; -struct TABLE_LIST; -class Time_zone; -struct LEX; -struct TABLE; -typedef struct st_changed_table_list CHANGED_TABLE_LIST; - -/* Query cache */ - -/* - Can't create new free memory block if unused memory in block less - then QUERY_CACHE_MIN_ALLOCATION_UNIT. - if QUERY_CACHE_MIN_ALLOCATION_UNIT == 0 then - QUERY_CACHE_MIN_ALLOCATION_UNIT choosed automaticaly -*/ -#define QUERY_CACHE_MIN_ALLOCATION_UNIT 512 - -/* inittial size of hashes */ -#define QUERY_CACHE_DEF_QUERY_HASH_SIZE 1024 -#define QUERY_CACHE_DEF_TABLE_HASH_SIZE 1024 - -/* minimal result data size when data allocated */ -#define QUERY_CACHE_MIN_RESULT_DATA_SIZE (1024*4) - -/* - start estimation of first result block size only when number of queries - bigger then: -*/ -#define QUERY_CACHE_MIN_ESTIMATED_QUERIES_NUMBER 3 - - - -/* memory bins size spacing (see at Query_cache::init_cache (sql_cache.cc)) */ -#define QUERY_CACHE_MEM_BIN_FIRST_STEP_PWR2 4 -#define QUERY_CACHE_MEM_BIN_STEP_PWR2 2 -#define QUERY_CACHE_MEM_BIN_PARTS_INC 1 -#define QUERY_CACHE_MEM_BIN_PARTS_MUL 1.2 -#define QUERY_CACHE_MEM_BIN_SPC_LIM_PWR2 3 - -/* how many free blocks check when finding most suitable before other 'end' - of list of free blocks */ -#define QUERY_CACHE_MEM_BIN_TRY 5 - -/* packing parameters */ -#define QUERY_CACHE_PACK_ITERATION 2 -#define QUERY_CACHE_PACK_LIMIT (512*1024L) - -#define TABLE_COUNTER_TYPE uint - -struct Query_cache_block; -struct Query_cache_block_table; -struct Query_cache_table; -struct Query_cache_query; -struct Query_cache_result; -class Query_cache; -struct Query_cache_tls; -struct LEX; -class THD; - -typedef my_bool (*qc_engine_callback)(THD *thd, const char *table_key, - uint key_length, - ulonglong *engine_data); - -/** - This class represents a node in the linked chain of queries - belonging to one table. - - @note The root of this linked list is not a query-type block, but the table- - type block which all queries has in common. -*/ -struct Query_cache_block_table -{ - Query_cache_block_table() {} /* Remove gcc warning */ - - /** - This node holds a position in a static table list belonging - to the associated query (base 0). - */ - TABLE_COUNTER_TYPE n; - - /** - Pointers to the next and previous node, linking all queries with - a common table. - */ - Query_cache_block_table *next, *prev; - - /** - A pointer to the table-type block which all - linked queries has in common. - */ - Query_cache_table *parent; - - /** - A method to calculate the address of the query cache block - owning this node. The purpose of this calculation is to - make it easier to move the query cache block without having - to modify all the pointer addresses. - */ - inline Query_cache_block *block(); -}; - -struct Query_cache_block -{ - Query_cache_block() {} /* Remove gcc warning */ - enum block_type {FREE, QUERY, RESULT, RES_CONT, RES_BEG, - RES_INCOMPLETE, TABLE, INCOMPLETE}; - - size_t length; // length of all block - size_t used; // length of data - /* - Not used **pprev, **prev because really needed access to pervious block: - *pprev to join free blocks - *prev to access to opposite side of list in cyclic sorted list - */ - Query_cache_block *pnext,*pprev, // physical next/previous block - *next,*prev; // logical next/previous block - block_type type; - TABLE_COUNTER_TYPE n_tables; // number of tables in query - - inline bool is_free(void) { return type == FREE; } - void init(size_t length); - void destroy(); - uint headers_len(); - uchar* data(void); - Query_cache_query *query(); - Query_cache_table *table(); - Query_cache_result *result(); - Query_cache_block_table *table(TABLE_COUNTER_TYPE n); -}; - -struct Query_cache_query -{ - ulonglong limit_found_rows; - mysql_rwlock_t lock; - Query_cache_block *res; - Query_cache_tls *wri; - size_t len; - unsigned int last_pkt_nr; - uint8 tbls_type; - uint8 ready; - ulonglong hit_count; - - Query_cache_query() {} /* Remove gcc warning */ - inline void init_n_lock(); - void unlock_n_destroy(); - inline ulonglong found_rows() { return limit_found_rows; } - inline void found_rows(ulonglong rows) { limit_found_rows= rows; } - inline Query_cache_block *result() { return res; } - inline void result(Query_cache_block *p) { res= p; } - inline Query_cache_tls *writer() { return wri; } - inline void writer(Query_cache_tls *p) { wri= p; } - inline uint8 tables_type() { return tbls_type; } - inline void tables_type(uint8 type) { tbls_type= type; } - inline size_t length() { return len; } - inline size_t add(size_t packet_len) { return(len+= packet_len); } - inline void length(size_t length_arg) { len= length_arg; } - inline uchar* query() - { - return (((uchar*)this) + ALIGN_SIZE(sizeof(Query_cache_query))); - } - /** - following used to check if result ready in plugin without - locking rw_lock of the query. - */ - inline void set_results_ready() { ready= 1; } - inline bool is_results_ready() { return ready; } - inline void increment_hits() { hit_count++; } - inline ulonglong hits() { return hit_count; } - void lock_writing(); - void lock_reading(); - bool try_lock_writing(); - void unlock_writing(); - void unlock_reading(); -}; - - -struct Query_cache_table -{ - Query_cache_table() {} /* Remove gcc warning */ - char *tbl; - uint32 key_len; - uint8 suffix_len; /* For partitioned tables */ - uint8 table_type; - /* unique for every engine reference */ - qc_engine_callback callback_func; - /* data need by some engines */ - ulonglong engine_data_buff; - - /** - The number of queries depending of this table. - */ - int32 m_cached_query_count; - /** - If table included in the table hash to be found by other queries - */ - my_bool hashed; - - inline char *db() { return (char *) data(); } - inline char *table() { return tbl; } - inline void table(char *table_arg) { tbl= table_arg; } - inline uint32 key_length() { return key_len; } - inline void key_length(uint32 len) { key_len= len; } - inline uint8 suffix_length() { return suffix_len; } - inline void suffix_length(uint8 len) { suffix_len= len; } - inline uint8 type() { return table_type; } - inline void type(uint8 t) { table_type= t; } - inline qc_engine_callback callback() { return callback_func; } - inline void callback(qc_engine_callback fn){ callback_func= fn; } - inline ulonglong engine_data() { return engine_data_buff; } - inline void engine_data(ulonglong data_arg){ engine_data_buff= data_arg; } - inline my_bool is_hashed() { return hashed; } - inline void set_hashed(my_bool hash) { hashed= hash; } - inline uchar* data() - { - return (uchar*)(((uchar*)this)+ - ALIGN_SIZE(sizeof(Query_cache_table))); - } -}; - -struct Query_cache_result -{ - Query_cache_result() {} /* Remove gcc warning */ - Query_cache_block *query; - - inline uchar* data() - { - return (uchar*)(((uchar*) this)+ - ALIGN_SIZE(sizeof(Query_cache_result))); - } - /* data_continue (if not whole packet contained by this block) */ - inline Query_cache_block *parent() { return query; } - inline void parent (Query_cache_block *p) { query=p; } -}; - - -extern "C" -{ - uchar *query_cache_query_get_key(const uchar *record, size_t *length, - my_bool not_used); - uchar *query_cache_table_get_key(const uchar *record, size_t *length, - my_bool not_used); -} -extern "C" void query_cache_invalidate_by_MyISAM_filename(const char* filename); - - -struct Query_cache_memory_bin -{ - Query_cache_memory_bin() {} /* Remove gcc warning */ -#ifndef DBUG_OFF - size_t size; -#endif - uint number; - Query_cache_block *free_blocks; - - inline void init(size_t size_arg) - { -#ifndef DBUG_OFF - size = size_arg; -#endif - number = 0; - free_blocks = 0; - } -}; - -struct Query_cache_memory_bin_step -{ - Query_cache_memory_bin_step() {} /* Remove gcc warning */ - size_t size; - size_t increment; - size_t idx; - inline void init(size_t size_arg, size_t idx_arg, size_t increment_arg) - { - size = size_arg; - idx = idx_arg; - increment = increment_arg; - } -}; - -class Query_cache -{ -public: - /* Info */ - size_t query_cache_size, query_cache_limit; - /* statistics */ - size_t free_memory, queries_in_cache, hits, inserts, refused, - free_memory_blocks, total_blocks, lowmem_prunes; - - -private: -#ifndef DBUG_OFF - my_thread_id m_cache_lock_thread_id; -#endif - mysql_cond_t COND_cache_status_changed; - uint m_requests_in_progress; - enum Cache_lock_status { UNLOCKED, LOCKED_NO_WAIT, LOCKED }; - Cache_lock_status m_cache_lock_status; - enum Cache_staus {OK, DISABLE_REQUEST, DISABLED}; - Cache_staus m_cache_status; - - void free_query_internal(Query_cache_block *point); - void invalidate_table_internal(THD *thd, uchar *key, size_t key_length); - -protected: - /* - The following mutex is locked when searching or changing global - query, tables lists or hashes. When we are operating inside the - query structure we locked an internal query block mutex. - LOCK SEQUENCE (to prevent deadlocks): - 1. structure_guard_mutex - 2. query block (for operation inside query (query block/results)) - - Thread doing cache flush releases the mutex once it sets - m_cache_lock_status flag, so other threads may bypass the cache as - if it is disabled, not waiting for reset to finish. The exception - is other threads that were going to do cache flush---they'll wait - till the end of a flush operation. - */ - mysql_mutex_t structure_guard_mutex; - size_t additional_data_size; - uchar *cache; // cache memory - Query_cache_block *first_block; // physical location block list - Query_cache_block *queries_blocks; // query list (LIFO) - Query_cache_block *tables_blocks; - - Query_cache_memory_bin *bins; // free block lists - Query_cache_memory_bin_step *steps; // bins spacing info - HASH queries, tables; - /* options */ - size_t min_allocation_unit, min_result_data_size; - uint def_query_hash_size, def_table_hash_size; - - size_t mem_bin_num, mem_bin_steps; // See at init_cache & find_bin - - bool initialized; - - /* Exclude/include from cyclic double linked list */ - static void double_linked_list_exclude(Query_cache_block *point, - Query_cache_block **list_pointer); - static void double_linked_list_simple_include(Query_cache_block *point, - Query_cache_block ** - list_pointer); - static void double_linked_list_join(Query_cache_block *head_tail, - Query_cache_block *tail_head); - - /* The following functions require that structure_guard_mutex is locked */ - void flush_cache(); - my_bool free_old_query(); - void free_query(Query_cache_block *point); - my_bool allocate_data_chain(Query_cache_block **result_block, - size_t data_len, - Query_cache_block *query_block, - my_bool first_block); - void invalidate_table(THD *thd, TABLE_LIST *table); - void invalidate_table(THD *thd, TABLE *table); - void invalidate_table(THD *thd, uchar *key, size_t key_length); - void invalidate_table(THD *thd, Query_cache_block *table_block); - void invalidate_query_block_list(THD *thd, - Query_cache_block_table *list_root); - - TABLE_COUNTER_TYPE - register_tables_from_list(THD *thd, TABLE_LIST *tables_used, - TABLE_COUNTER_TYPE counter, - Query_cache_block_table **block_table); - my_bool register_all_tables(THD *thd, Query_cache_block *block, - TABLE_LIST *tables_used, - TABLE_COUNTER_TYPE tables); - void unlink_table(Query_cache_block_table *node); - Query_cache_block *get_free_block (size_t len, my_bool not_less, - size_t min); - void free_memory_block(Query_cache_block *point); - void split_block(Query_cache_block *block, size_t len); - Query_cache_block *join_free_blocks(Query_cache_block *first_block, - Query_cache_block *block_in_list); - my_bool append_next_free_block(Query_cache_block *block, - size_t add_size); - void exclude_from_free_memory_list(Query_cache_block *free_block); - void insert_into_free_memory_list(Query_cache_block *new_block); - my_bool move_by_type(uchar **border, Query_cache_block **before, - size_t *gap, Query_cache_block *i); - uint find_bin(size_t size); - void move_to_query_list_end(Query_cache_block *block); - void insert_into_free_memory_sorted_list(Query_cache_block *new_block, - Query_cache_block **list); - void pack_cache(); - void relink(Query_cache_block *oblock, - Query_cache_block *nblock, - Query_cache_block *next, - Query_cache_block *prev, - Query_cache_block *pnext, - Query_cache_block *pprev); - my_bool join_results(size_t join_limit); - - /* - Following function control structure_guard_mutex - by themself or don't need structure_guard_mutex - */ - size_t init_cache(); - void make_disabled(); - void free_cache(); - Query_cache_block *write_block_data(size_t data_len, uchar* data, - size_t header_len, - Query_cache_block::block_type type, - TABLE_COUNTER_TYPE ntab = 0); - my_bool append_result_data(Query_cache_block **result, - size_t data_len, uchar* data, - Query_cache_block *parent); - my_bool write_result_data(Query_cache_block **result, - size_t data_len, uchar* data, - Query_cache_block *parent, - Query_cache_block::block_type - type=Query_cache_block::RESULT); - inline size_t get_min_first_result_data_size(); - inline size_t get_min_append_result_data_size(); - Query_cache_block *allocate_block(size_t len, my_bool not_less, - size_t min); - /* - If query is cacheable return number tables in query - (query without tables not cached) - */ - TABLE_COUNTER_TYPE is_cacheable(THD *thd, - LEX *lex, TABLE_LIST *tables_used, - uint8 *tables_type); - TABLE_COUNTER_TYPE process_and_count_tables(THD *thd, - TABLE_LIST *tables_used, - uint8 *tables_type); - - static my_bool ask_handler_allowance(THD *thd, TABLE_LIST *tables_used); - public: - - Query_cache(size_t query_cache_limit = ULONG_MAX, - size_t min_allocation_unit = QUERY_CACHE_MIN_ALLOCATION_UNIT, - size_t min_result_data_size = QUERY_CACHE_MIN_RESULT_DATA_SIZE, - uint def_query_hash_size = QUERY_CACHE_DEF_QUERY_HASH_SIZE, - uint def_table_hash_size = QUERY_CACHE_DEF_TABLE_HASH_SIZE); - - inline bool is_disabled(void) { return m_cache_status != OK; } - inline bool is_disable_in_progress(void) - { return m_cache_status == DISABLE_REQUEST; } - - /* initialize cache (mutex) */ - void init(); - /* resize query cache (return real query size, 0 if disabled) */ - size_t resize(size_t query_cache_size); - /* set limit on result size */ - inline void result_size_limit(size_t limit){query_cache_limit=limit;} - /* set minimal result data allocation unit size */ - size_t set_min_res_unit(size_t size); - - /* register query in cache */ - void store_query(THD *thd, TABLE_LIST *used_tables); - - /* - Check if the query is in the cache and if this is true send the - data to client. - */ - int send_result_to_client(THD *thd, char *query, uint query_length); - - /* Remove all queries that uses any of the listed following tables */ - void invalidate(THD *thd, TABLE_LIST *tables_used, - my_bool using_transactions); - void invalidate(THD *thd, CHANGED_TABLE_LIST *tables_used); - void invalidate_locked_for_write(THD *thd, TABLE_LIST *tables_used); - void invalidate(THD *thd, TABLE *table, my_bool using_transactions); - void invalidate(THD *thd, const char *key, size_t key_length, - my_bool using_transactions); - - /* Remove all queries that uses any of the tables in following database */ - void invalidate(THD *thd, const char *db); - - /* Remove all queries that uses any of the listed following table */ - void invalidate_by_MyISAM_filename(const char *filename); - - void flush(); - void pack(THD *thd, - size_t join_limit = QUERY_CACHE_PACK_LIMIT, - uint iteration_limit = QUERY_CACHE_PACK_ITERATION); - - void destroy(); - - void insert(THD *thd, Query_cache_tls *query_cache_tls, - const char *packet, - size_t length, - unsigned pkt_nr); - my_bool insert_table(THD *thd, size_t key_len, const char *key, - Query_cache_block_table *node, - size_t db_length, uint8 suffix_length_arg, - uint8 cache_type, - qc_engine_callback callback, - ulonglong engine_data, - my_bool hash); - - void end_of_result(THD *thd); - void abort(THD *thd, Query_cache_tls *query_cache_tls); - - /* - The following functions are only used when debugging - We don't protect these with ifndef DBUG_OFF to not have to recompile - everything if we want to add checks of the cache at some places. - */ - void wreck(uint line, const char *message); - void bins_dump(); - void cache_dump(); - void queries_dump(); - void tables_dump(); - my_bool check_integrity(bool not_locked); - my_bool in_list(Query_cache_block * root, Query_cache_block * point, - const char *name); - my_bool in_table_list(Query_cache_block_table * root, - Query_cache_block_table * point, - const char *name); - my_bool in_blocks(Query_cache_block * point); - - /* Table key generation */ - static uint filename_2_table_key (char *key, const char *filename, - uint32 *db_langth); - - enum Cache_try_lock_mode {WAIT, TIMEOUT, TRY}; - bool try_lock(THD *thd, Cache_try_lock_mode mode= WAIT); - void lock(THD *thd); - void lock_and_suspend(void); - void unlock(void); - - void disable_query_cache(THD *thd); -}; - -#ifdef HAVE_QUERY_CACHE -struct Query_cache_query_flags -{ - unsigned int client_long_flag:1; - unsigned int client_protocol_41:1; - unsigned int client_depr_eof:1; - unsigned int protocol_type:2; - unsigned int more_results_exists:1; - unsigned int in_trans:1; - unsigned int autocommit:1; - unsigned int pkt_nr; - uint character_set_client_num; - uint character_set_results_num; - uint collation_connection_num; - ha_rows limit; - Time_zone *time_zone; - sql_mode_t sql_mode; - ulonglong max_sort_length; - ulonglong group_concat_max_len; - size_t default_week_format; - size_t div_precision_increment; - MY_LOCALE *lc_time_names; -}; -#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags) -#define QUERY_CACHE_DB_LENGTH_SIZE 2 -#include "sql_cache.h" -#define query_cache_abort(A,B) query_cache.abort(A,B) -#define query_cache_end_of_result(A) query_cache.end_of_result(A) -#define query_cache_store_query(A, B) query_cache.store_query(A, B) -#define query_cache_destroy() query_cache.destroy() -#define query_cache_result_size_limit(A) query_cache.result_size_limit(A) -#define query_cache_init() query_cache.init() -#define query_cache_resize(A) query_cache.resize(A) -#define query_cache_set_min_res_unit(A) query_cache.set_min_res_unit(A) -#define query_cache_invalidate3(A, B, C) query_cache.invalidate(A, B, C) -#define query_cache_invalidate1(A, B) query_cache.invalidate(A, B) -#define query_cache_send_result_to_client(A, B, C) \ - query_cache.send_result_to_client(A, B, C) -#define query_cache_invalidate_by_MyISAM_filename_ref \ - &query_cache_invalidate_by_MyISAM_filename -/* note the "maybe": it's a read without mutex */ -#define query_cache_maybe_disabled(T) \ - (T->variables.query_cache_type == 0 || query_cache.query_cache_size == 0) -#define query_cache_is_cacheable_query(L) \ - (((L)->sql_command == SQLCOM_SELECT) && (L)->safe_to_cache_query) -#else -#define QUERY_CACHE_FLAGS_SIZE 0 -#define query_cache_store_query(A, B) do { } while(0) -#define query_cache_destroy() do { } while(0) -#define query_cache_result_size_limit(A) do { } while(0) -#define query_cache_init() do { } while(0) -#define query_cache_resize(A) do { } while(0) -#define query_cache_set_min_res_unit(A) do { } while(0) -#define query_cache_invalidate3(A, B, C) do { } while(0) -#define query_cache_invalidate1(A,B) do { } while(0) -#define query_cache_send_result_to_client(A, B, C) 0 -#define query_cache_invalidate_by_MyISAM_filename_ref NULL - -#define query_cache_abort(A,B) do { } while(0) -#define query_cache_end_of_result(A) do { } while(0) -#define query_cache_maybe_disabled(T) 1 -#define query_cache_is_cacheable_query(L) 0 -#endif /*HAVE_QUERY_CACHE*/ - -extern MYSQL_PLUGIN_IMPORT Query_cache query_cache; -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_callback.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_callback.h deleted file mode 100644 index 1f798ad..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_callback.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -#ifndef SQL_CALLBACK_INCLUDED -#define SQL_CALLBACK_INCLUDED - -/** - Macro used for an internal callback. - - The macro will check that the object exists and that the function - is defined. If that is the case, it will call the function with the - given parameters. - - If the object or the function is not defined, the callback will be - considered successful (nothing needed to be done) and will - therefore return no error. - */ - -#define MYSQL_CALLBACK(OBJ, FUNC, PARAMS) \ - do { \ - if ((OBJ) && ((OBJ)->FUNC)) \ - (OBJ)->FUNC PARAMS; \ - } while (0) - -#define MYSQL_CALLBACK_ELSE(OBJ, FUNC, PARAMS, ELSE) \ - (((OBJ) && ((OBJ)->FUNC)) ? (OBJ)->FUNC PARAMS : (ELSE)) - -#endif /* SQL_CALLBACK_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_class.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_class.h deleted file mode 100644 index 87773b8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_class.h +++ /dev/null @@ -1,7483 +0,0 @@ -/* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_CLASS_INCLUDED -#define SQL_CLASS_INCLUDED - -/* Classes in mysql */ - -#include -#include "dur_prop.h" -#include -#include "sql_const.h" -#include -#include "log.h" -#include "rpl_tblmap.h" -#include "mdl.h" -#include "field.h" // Create_field -#include "opt_trace_context.h" -#include "probes_mysql.h" -#include "sql_locale.h" /* my_locale_st */ -#include "sql_profile.h" /* PROFILING */ -#include "scheduler.h" /* thd_scheduler */ -#include "protocol.h" /* Protocol_text, Protocol_binary */ -#include "violite.h" /* vio_is_connected */ -#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA, THR_LOCK_INFO */ -#include "thr_timer.h" -#include "thr_malloc.h" -#include "log_slow.h" /* LOG_SLOW_DISABLE_... */ -#include -#include "sql_digest_stream.h" // sql_digest_state -#include -#include -#include -#include -#include -#include "session_tracker.h" -#include "backup.h" -#include "xa.h" - -extern "C" -void set_thd_stage_info(void *thd, - const PSI_stage_info *new_stage, - PSI_stage_info *old_stage, - const char *calling_func, - const char *calling_file, - const unsigned int calling_line); - -#define THD_STAGE_INFO(thd, stage) \ - (thd)->enter_stage(&stage, __func__, __FILE__, __LINE__) - -#include "my_apc.h" -#include "rpl_gtid.h" - -#include "wsrep_mysqld.h" -#ifdef WITH_WSREP -#include -/* wsrep-lib */ -#include "wsrep_client_service.h" -#include "wsrep_client_state.h" -#include "wsrep_mutex.h" -#include "wsrep_condition_variable.h" - -class Wsrep_applier_service; -#endif /* WITH_WSREP */ - -class Reprepare_observer; -class Relay_log_info; -struct rpl_group_info; -class Rpl_filter; -class Query_log_event; -class Load_log_event; -class Log_event_writer; -class sp_rcontext; -class sp_cache; -class Lex_input_stream; -class Parser_state; -class Rows_log_event; -class Sroutine_hash_entry; -class user_var_entry; -struct Trans_binlog_info; -class rpl_io_thread_info; -class rpl_sql_thread_info; -#ifdef HAVE_REPLICATION -struct Slave_info; -#endif - -enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME }; -enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE }; -enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON, - DELAY_KEY_WRITE_ALL }; -enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT, - SLAVE_EXEC_MODE_IDEMPOTENT, - SLAVE_EXEC_MODE_LAST_BIT }; -enum enum_slave_run_triggers_for_rbr { SLAVE_RUN_TRIGGERS_FOR_RBR_NO, - SLAVE_RUN_TRIGGERS_FOR_RBR_YES, - SLAVE_RUN_TRIGGERS_FOR_RBR_LOGGING, - SLAVE_RUN_TRIGGERS_FOR_RBR_ENFORCE}; -enum enum_slave_type_conversions { SLAVE_TYPE_CONVERSIONS_ALL_LOSSY, - SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY}; - -/* - MARK_COLUMNS_READ: A column is goind to be read. - MARK_COLUMNS_WRITE: A column is going to be written to. - MARK_COLUMNS_READ: A column is goind to be read. - A bit in read set is set to inform handler that the field - is to be read. If field list contains duplicates, then - thd->dup_field is set to point to the last found - duplicate. - MARK_COLUMNS_WRITE: A column is going to be written to. - A bit is set in write set to inform handler that it needs - to update this field in write_row and update_row. -*/ -enum enum_column_usage -{ COLUMNS_READ, COLUMNS_WRITE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE}; - -static inline bool should_mark_column(enum_column_usage column_usage) -{ return column_usage >= MARK_COLUMNS_READ; } - -enum enum_filetype { FILETYPE_CSV, FILETYPE_XML }; - -enum enum_binlog_row_image { - /** PKE in the before image and changed columns in the after image */ - BINLOG_ROW_IMAGE_MINIMAL= 0, - /** Whenever possible, before and after image contain all columns except blobs. */ - BINLOG_ROW_IMAGE_NOBLOB= 1, - /** All columns in both before and after image. */ - BINLOG_ROW_IMAGE_FULL= 2 -}; - - -/* Bits for different SQL modes modes (including ANSI mode) */ -#define MODE_REAL_AS_FLOAT (1ULL << 0) -#define MODE_PIPES_AS_CONCAT (1ULL << 1) -#define MODE_ANSI_QUOTES (1ULL << 2) -#define MODE_IGNORE_SPACE (1ULL << 3) -#define MODE_IGNORE_BAD_TABLE_OPTIONS (1ULL << 4) -#define MODE_ONLY_FULL_GROUP_BY (1ULL << 5) -#define MODE_NO_UNSIGNED_SUBTRACTION (1ULL << 6) -#define MODE_NO_DIR_IN_CREATE (1ULL << 7) -#define MODE_POSTGRESQL (1ULL << 8) -#define MODE_ORACLE (1ULL << 9) -#define MODE_MSSQL (1ULL << 10) -#define MODE_DB2 (1ULL << 11) -#define MODE_MAXDB (1ULL << 12) -#define MODE_NO_KEY_OPTIONS (1ULL << 13) -#define MODE_NO_TABLE_OPTIONS (1ULL << 14) -#define MODE_NO_FIELD_OPTIONS (1ULL << 15) -#define MODE_MYSQL323 (1ULL << 16) -#define MODE_MYSQL40 (1ULL << 17) -#define MODE_ANSI (1ULL << 18) -#define MODE_NO_AUTO_VALUE_ON_ZERO (1ULL << 19) -#define MODE_NO_BACKSLASH_ESCAPES (1ULL << 20) -#define MODE_STRICT_TRANS_TABLES (1ULL << 21) -#define MODE_STRICT_ALL_TABLES (1ULL << 22) -#define MODE_NO_ZERO_IN_DATE (1ULL << 23) -#define MODE_NO_ZERO_DATE (1ULL << 24) -#define MODE_INVALID_DATES (1ULL << 25) -#define MODE_ERROR_FOR_DIVISION_BY_ZERO (1ULL << 26) -#define MODE_TRADITIONAL (1ULL << 27) -#define MODE_NO_AUTO_CREATE_USER (1ULL << 28) -#define MODE_HIGH_NOT_PRECEDENCE (1ULL << 29) -#define MODE_NO_ENGINE_SUBSTITUTION (1ULL << 30) -#define MODE_PAD_CHAR_TO_FULL_LENGTH (1ULL << 31) -/* SQL mode bits defined above are common for MariaDB and MySQL */ -#define MODE_MASK_MYSQL_COMPATIBLE 0xFFFFFFFFULL -/* The following modes are specific to MariaDB */ -#define MODE_EMPTY_STRING_IS_NULL (1ULL << 32) -#define MODE_SIMULTANEOUS_ASSIGNMENT (1ULL << 33) -#define MODE_TIME_ROUND_FRACTIONAL (1ULL << 34) -/* The following modes are specific to MySQL */ -#define MODE_MYSQL80_TIME_TRUNCATE_FRACTIONAL (1ULL << 32) - - -/* Bits for different old style modes */ -#define OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE (1 << 0) -#define OLD_MODE_NO_PROGRESS_INFO (1 << 1) -#define OLD_MODE_ZERO_DATE_TIME_CAST (1 << 2) - -extern char internal_table_name[2]; -extern char empty_c_string[1]; -extern MYSQL_PLUGIN_IMPORT const char **errmesg; - -extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd); -extern "C" unsigned long long thd_query_id(const MYSQL_THD thd); -extern "C" size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen); -extern "C" const char *thd_user_name(MYSQL_THD thd); -extern "C" const char *thd_client_host(MYSQL_THD thd); -extern "C" const char *thd_client_ip(MYSQL_THD thd); -extern "C" LEX_CSTRING *thd_current_db(MYSQL_THD thd); -extern "C" int thd_current_status(MYSQL_THD thd); -extern "C" enum enum_server_command thd_current_command(MYSQL_THD thd); - -/** - @class CSET_STRING - @brief Character set armed LEX_STRING -*/ -class CSET_STRING -{ -private: - LEX_STRING string; - CHARSET_INFO *cs; -public: - CSET_STRING() : cs(&my_charset_bin) - { - string.str= NULL; - string.length= 0; - } - CSET_STRING(char *str_arg, size_t length_arg, CHARSET_INFO *cs_arg) : - cs(cs_arg) - { - DBUG_ASSERT(cs_arg != NULL); - string.str= str_arg; - string.length= length_arg; - } - - inline char *str() const { return string.str; } - inline size_t length() const { return string.length; } - CHARSET_INFO *charset() const { return cs; } - - friend LEX_STRING * thd_query_string (MYSQL_THD thd); -}; - - -#define TC_HEURISTIC_RECOVER_COMMIT 1 -#define TC_HEURISTIC_RECOVER_ROLLBACK 2 -extern ulong tc_heuristic_recover; - -typedef struct st_user_var_events -{ - user_var_entry *user_var_event; - char *value; - size_t length; - Item_result type; - uint charset_number; - bool unsigned_flag; -} BINLOG_USER_VAR_EVENT; - -/* - The COPY_INFO structure is used by INSERT/REPLACE code. - The schema of the row counting by the INSERT/INSERT ... ON DUPLICATE KEY - UPDATE code: - If a row is inserted then the copied variable is incremented. - If a row is updated by the INSERT ... ON DUPLICATE KEY UPDATE and the - new data differs from the old one then the copied and the updated - variables are incremented. - The touched variable is incremented if a row was touched by the update part - of the INSERT ... ON DUPLICATE KEY UPDATE no matter whether the row - was actually changed or not. -*/ -typedef struct st_copy_info { - ha_rows records; /**< Number of processed records */ - ha_rows deleted; /**< Number of deleted records */ - ha_rows updated; /**< Number of updated records */ - ha_rows copied; /**< Number of copied records */ - ha_rows error_count; - ha_rows touched; /* Number of touched records */ - enum enum_duplicates handle_duplicates; - int escape_char, last_errno; - bool ignore; - /* for INSERT ... UPDATE */ - List *update_fields; - List *update_values; - /* for VIEW ... WITH CHECK OPTION */ - TABLE_LIST *view; - TABLE_LIST *table_list; /* Normal table */ -} COPY_INFO; - - -class Key_part_spec :public Sql_alloc { -public: - LEX_CSTRING field_name; - uint length; - bool generated; - Key_part_spec(const LEX_CSTRING *name, uint len, bool gen= false) - : field_name(*name), length(len), generated(gen) - {} - bool operator==(const Key_part_spec& other) const; - /** - Construct a copy of this Key_part_spec. field_name is copied - by-pointer as it is known to never change. At the same time - 'length' may be reset in mysql_prepare_create_table, and this - is why we supply it with a copy. - - @return If out of memory, 0 is returned and an error is set in - THD. - */ - Key_part_spec *clone(MEM_ROOT *mem_root) const - { return new (mem_root) Key_part_spec(*this); } - bool check_key_for_blob(const class handler *file) const; - bool check_key_length_for_blob() const; - bool check_primary_key_for_blob(const class handler *file) const - { - return check_key_for_blob(file) || check_key_length_for_blob(); - } - bool check_foreign_key_for_blob(const class handler *file) const - { - return check_key_for_blob(file) || check_key_length_for_blob(); - } - bool init_multiple_key_for_blob(const class handler *file); -}; - - -class Alter_drop :public Sql_alloc { -public: - enum drop_type { KEY, COLUMN, FOREIGN_KEY, CHECK_CONSTRAINT, PERIOD }; - const char *name; - enum drop_type type; - bool drop_if_exists; - Alter_drop(enum drop_type par_type,const char *par_name, bool par_exists) - :name(par_name), type(par_type), drop_if_exists(par_exists) - { - DBUG_ASSERT(par_name != NULL); - } - /** - Used to make a clone of this object for ALTER/CREATE TABLE - @sa comment for Key_part_spec::clone - */ - Alter_drop *clone(MEM_ROOT *mem_root) const - { return new (mem_root) Alter_drop(*this); } - const char *type_name() - { - return type == COLUMN ? "COLUMN" : - type == CHECK_CONSTRAINT ? "CONSTRAINT" : - type == PERIOD ? "PERIOD" : - type == KEY ? "INDEX" : "FOREIGN KEY"; - } -}; - - -class Alter_column :public Sql_alloc { -public: - LEX_CSTRING name; - LEX_CSTRING new_name; - Virtual_column_info *default_value; - bool alter_if_exists; - Alter_column(LEX_CSTRING par_name, Virtual_column_info *expr, bool par_exists) - :name(par_name), new_name{NULL, 0}, default_value(expr), alter_if_exists(par_exists) {} - Alter_column(LEX_CSTRING par_name, LEX_CSTRING _new_name, bool exists) - :name(par_name), new_name(_new_name), default_value(NULL), alter_if_exists(exists) {} - /** - Used to make a clone of this object for ALTER/CREATE TABLE - @sa comment for Key_part_spec::clone - */ - Alter_column *clone(MEM_ROOT *mem_root) const - { return new (mem_root) Alter_column(*this); } - bool is_rename() - { - DBUG_ASSERT(!new_name.str || !default_value); - return new_name.str; - } -}; - - -class Alter_rename_key : public Sql_alloc -{ -public: - LEX_CSTRING old_name; - LEX_CSTRING new_name; - bool alter_if_exists; - - Alter_rename_key(LEX_CSTRING old_name_arg, LEX_CSTRING new_name_arg, bool exists) - : old_name(old_name_arg), new_name(new_name_arg), alter_if_exists(exists) {} - - Alter_rename_key *clone(MEM_ROOT *mem_root) const - { return new (mem_root) Alter_rename_key(*this); } - -}; - - -class Key :public Sql_alloc, public DDL_options { -public: - enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY}; - enum Keytype type; - KEY_CREATE_INFO key_create_info; - List columns; - LEX_CSTRING name; - engine_option_value *option_list; - bool generated; - bool invisible; - bool without_overlaps; - Lex_ident period; - - Key(enum Keytype type_par, const LEX_CSTRING *name_arg, - ha_key_alg algorithm_arg, bool generated_arg, DDL_options_st ddl_options) - :DDL_options(ddl_options), - type(type_par), key_create_info(default_key_create_info), - name(*name_arg), option_list(NULL), generated(generated_arg), - invisible(false), without_overlaps(false) - { - key_create_info.algorithm= algorithm_arg; - } - Key(enum Keytype type_par, const LEX_CSTRING *name_arg, - KEY_CREATE_INFO *key_info_arg, - bool generated_arg, List *cols, - engine_option_value *create_opt, DDL_options_st ddl_options) - :DDL_options(ddl_options), - type(type_par), key_create_info(*key_info_arg), columns(*cols), - name(*name_arg), option_list(create_opt), generated(generated_arg), - invisible(false), without_overlaps(false) - {} - Key(const Key &rhs, MEM_ROOT *mem_root); - virtual ~Key() {} - /* Equality comparison of keys (ignoring name) */ - friend bool foreign_key_prefix(Key *a, Key *b); - /** - Used to make a clone of this object for ALTER/CREATE TABLE - @sa comment for Key_part_spec::clone - */ - virtual Key *clone(MEM_ROOT *mem_root) const - { return new (mem_root) Key(*this, mem_root); } -}; - - -class Foreign_key: public Key { -public: - enum fk_match_opt { FK_MATCH_UNDEF, FK_MATCH_FULL, - FK_MATCH_PARTIAL, FK_MATCH_SIMPLE}; - LEX_CSTRING constraint_name; - LEX_CSTRING ref_db; - LEX_CSTRING ref_table; - List ref_columns; - enum enum_fk_option delete_opt, update_opt; - enum fk_match_opt match_opt; - Foreign_key(const LEX_CSTRING *name_arg, List *cols, - const LEX_CSTRING *constraint_name_arg, - const LEX_CSTRING *ref_db_arg, const LEX_CSTRING *ref_table_arg, - List *ref_cols, - enum_fk_option delete_opt_arg, enum_fk_option update_opt_arg, - fk_match_opt match_opt_arg, - DDL_options ddl_options) - :Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols, NULL, - ddl_options), - constraint_name(*constraint_name_arg), - ref_db(*ref_db_arg), ref_table(*ref_table_arg), ref_columns(*ref_cols), - delete_opt(delete_opt_arg), update_opt(update_opt_arg), - match_opt(match_opt_arg) - { - // We don't check for duplicate FKs. - key_create_info.check_for_duplicate_indexes= false; - } - Foreign_key(const Foreign_key &rhs, MEM_ROOT *mem_root); - /** - Used to make a clone of this object for ALTER/CREATE TABLE - @sa comment for Key_part_spec::clone - */ - virtual Key *clone(MEM_ROOT *mem_root) const - { return new (mem_root) Foreign_key(*this, mem_root); } - /* Used to validate foreign key options */ - bool validate(List &table_fields); -}; - -typedef struct st_mysql_lock -{ - TABLE **table; - THR_LOCK_DATA **locks; - uint table_count,lock_count; - uint flags; -} MYSQL_LOCK; - - -class LEX_COLUMN : public Sql_alloc -{ -public: - String column; - privilege_t rights; - LEX_COLUMN (const String& x,const privilege_t & y ): column (x),rights (y) {} -}; - -class MY_LOCALE; - -/** - Query_cache_tls -- query cache thread local data. -*/ - -struct Query_cache_block; - -struct Query_cache_tls -{ - /* - 'first_query_block' should be accessed only via query cache - functions and methods to maintain proper locking. - */ - Query_cache_block *first_query_block; - void set_first_query_block(Query_cache_block *first_query_block_arg) - { - first_query_block= first_query_block_arg; - } - - Query_cache_tls() :first_query_block(NULL) {} -}; - -/* SIGNAL / RESIGNAL / GET DIAGNOSTICS */ - -/** - This enumeration list all the condition item names of a condition in the - SQL condition area. -*/ -typedef enum enum_diag_condition_item_name -{ - /* - Conditions that can be set by the user (SIGNAL/RESIGNAL), - and by the server implementation. - */ - - DIAG_CLASS_ORIGIN= 0, - FIRST_DIAG_SET_PROPERTY= DIAG_CLASS_ORIGIN, - DIAG_SUBCLASS_ORIGIN= 1, - DIAG_CONSTRAINT_CATALOG= 2, - DIAG_CONSTRAINT_SCHEMA= 3, - DIAG_CONSTRAINT_NAME= 4, - DIAG_CATALOG_NAME= 5, - DIAG_SCHEMA_NAME= 6, - DIAG_TABLE_NAME= 7, - DIAG_COLUMN_NAME= 8, - DIAG_CURSOR_NAME= 9, - DIAG_MESSAGE_TEXT= 10, - DIAG_MYSQL_ERRNO= 11, - LAST_DIAG_SET_PROPERTY= DIAG_MYSQL_ERRNO -} Diag_condition_item_name; - -/** - Name of each diagnostic condition item. - This array is indexed by Diag_condition_item_name. -*/ -extern const LEX_CSTRING Diag_condition_item_names[]; - -/** - These states are bit coded with HARD. For each state there must be a pair - , and _HARD. -*/ -enum killed_state -{ - NOT_KILLED= 0, - KILL_HARD_BIT= 1, /* Bit for HARD KILL */ - KILL_BAD_DATA= 2, - KILL_BAD_DATA_HARD= 3, - KILL_QUERY= 4, - KILL_QUERY_HARD= 5, - /* - ABORT_QUERY signals to the query processor to stop execution ASAP without - issuing an error. Instead a warning is issued, and when possible a partial - query result is returned to the client. - */ - ABORT_QUERY= 6, - ABORT_QUERY_HARD= 7, - KILL_TIMEOUT= 8, - KILL_TIMEOUT_HARD= 9, - /* - When binlog reading thread connects to the server it kills - all the binlog threads with the same ID. - */ - KILL_SLAVE_SAME_ID= 10, - /* - All of the following killed states will kill the connection - KILL_CONNECTION must be the first of these and it must start with - an even number (becasue of HARD bit)! - */ - KILL_CONNECTION= 12, - KILL_CONNECTION_HARD= 13, - KILL_SYSTEM_THREAD= 14, - KILL_SYSTEM_THREAD_HARD= 15, - KILL_SERVER= 16, - KILL_SERVER_HARD= 17, - /* - Used in threadpool to signal wait timeout. - */ - KILL_WAIT_TIMEOUT= 18, - KILL_WAIT_TIMEOUT_HARD= 19 - -}; - -#define killed_mask_hard(killed) ((killed_state) ((killed) & ~KILL_HARD_BIT)) - -enum killed_type -{ - KILL_TYPE_ID, - KILL_TYPE_USER, - KILL_TYPE_QUERY -}; - -#include "sql_lex.h" /* Must be here */ - -class Delayed_insert; -class select_result; -class Time_zone; - -#define THD_SENTRY_MAGIC 0xfeedd1ff -#define THD_SENTRY_GONE 0xdeadbeef - -#define THD_CHECK_SENTRY(thd) DBUG_ASSERT(thd->dbug_sentry == THD_SENTRY_MAGIC) - -typedef struct system_variables -{ - /* - How dynamically allocated system variables are handled: - - The global_system_variables and max_system_variables are "authoritative" - They both should have the same 'version' and 'size'. - When attempting to access a dynamic variable, if the session version - is out of date, then the session version is updated and realloced if - neccessary and bytes copied from global to make up for missing data. - - Note that one should use my_bool instead of bool here, as the variables - are used with my_getopt.c - */ - ulong dynamic_variables_version; - char* dynamic_variables_ptr; - uint dynamic_variables_head; /* largest valid variable offset */ - uint dynamic_variables_size; /* how many bytes are in use */ - - ulonglong max_heap_table_size; - ulonglong tmp_memory_table_size; - ulonglong tmp_disk_table_size; - ulonglong long_query_time; - ulonglong max_statement_time; - ulonglong optimizer_switch; - ulonglong optimizer_trace; - ulong optimizer_trace_max_mem_size; - sql_mode_t sql_mode; ///< which non-standard SQL behaviour should be enabled - sql_mode_t old_behavior; ///< which old SQL behaviour should be enabled - ulonglong option_bits; ///< OPTION_xxx constants, e.g. OPTION_PROFILING - ulonglong join_buff_space_limit; - ulonglong log_slow_filter; - ulonglong log_slow_verbosity; - ulonglong log_slow_disabled_statements; - ulonglong log_disabled_statements; - ulonglong bulk_insert_buff_size; - ulonglong join_buff_size; - ulonglong sortbuff_size; - ulonglong group_concat_max_len; - ulonglong default_regex_flags; - ulonglong max_mem_used; - - /** - Place holders to store Multi-source variables in sys_var.cc during - update and show of variables. - */ - ulonglong slave_skip_counter; - ulonglong max_relay_log_size; - - ha_rows select_limit; - ha_rows max_join_size; - ha_rows expensive_subquery_limit; - ulong auto_increment_increment, auto_increment_offset; -#ifdef WITH_WSREP - /* - Stored values of the auto_increment_increment and auto_increment_offset - that are will be restored when wsrep_auto_increment_control will be set - to 'OFF', because the setting it to 'ON' leads to overwriting of the - original values (which are set by the user) by calculated ones (which - are based on the cluster size): - */ - ulong saved_auto_increment_increment, saved_auto_increment_offset; - ulonglong wsrep_gtid_seq_no; -#endif /* WITH_WSREP */ - uint eq_range_index_dive_limit; - ulong column_compression_zlib_strategy; - ulong lock_wait_timeout; - ulong join_cache_level; - ulong max_allowed_packet; - ulong max_error_count; - ulong max_length_for_sort_data; - ulong max_recursive_iterations; - ulong max_sort_length; - ulong max_tmp_tables; - ulong max_insert_delayed_threads; - ulong min_examined_row_limit; - ulong net_buffer_length; - ulong net_interactive_timeout; - ulong net_read_timeout; - ulong net_retry_count; - ulong net_wait_timeout; - ulong net_write_timeout; - ulong optimizer_prune_level; - ulong optimizer_search_depth; - ulong optimizer_selectivity_sampling_limit; - ulong optimizer_use_condition_selectivity; - ulong use_stat_tables; - double sample_percentage; - ulong histogram_size; - ulong histogram_type; - ulong preload_buff_size; - ulong profiling_history_size; - ulong read_buff_size; - ulong read_rnd_buff_size; - ulong mrr_buff_size; - ulong div_precincrement; - /* Total size of all buffers used by the subselect_rowid_merge_engine. */ - ulong rowid_merge_buff_size; - ulong max_sp_recursion_depth; - ulong default_week_format; - ulong max_seeks_for_key; - ulong range_alloc_block_size; - ulong query_alloc_block_size; - ulong query_prealloc_size; - ulong trans_alloc_block_size; - ulong trans_prealloc_size; - ulong log_warnings; - /* Flags for slow log filtering */ - ulong log_slow_rate_limit; - ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format) - ulong binlog_row_image; - ulong progress_report_time; - ulong completion_type; - ulong query_cache_type; - ulong tx_isolation; - ulong updatable_views_with_limit; - ulong alter_algorithm; - int max_user_connections; - ulong server_id; - /** - In slave thread we need to know in behalf of which - thread the query is being run to replicate temp tables properly - */ - my_thread_id pseudo_thread_id; - /** - When replicating an event group with GTID, keep these values around so - slave binlog can receive the same GTID as the original. - */ - uint32 gtid_domain_id; - uint64 gtid_seq_no; - - /** - Default transaction access mode. READ ONLY (true) or READ WRITE (false). - */ - my_bool tx_read_only; - my_bool low_priority_updates; - my_bool query_cache_wlock_invalidate; - my_bool keep_files_on_create; - - my_bool old_mode; - my_bool old_passwords; - my_bool big_tables; - my_bool only_standard_compliant_cte; - my_bool query_cache_strip_comments; - my_bool sql_log_slow; - my_bool sql_log_bin; - my_bool binlog_annotate_row_events; - my_bool binlog_direct_non_trans_update; - my_bool column_compression_zlib_wrap; - - plugin_ref table_plugin; - plugin_ref tmp_table_plugin; - plugin_ref enforced_table_plugin; - - /* Only charset part of these variables is sensible */ - CHARSET_INFO *character_set_filesystem; - CHARSET_INFO *character_set_client; - CHARSET_INFO *character_set_results; - - /* Both charset and collation parts of these variables are important */ - CHARSET_INFO *collation_server; - CHARSET_INFO *collation_database; - CHARSET_INFO *collation_connection; - - /* Names. These will be allocated in buffers in thd */ - LEX_CSTRING default_master_connection; - - /* Error messages */ - MY_LOCALE *lc_messages; - const char ***errmsgs; /* lc_messages->errmsg->errmsgs */ - - /* Locale Support */ - MY_LOCALE *lc_time_names; - - Time_zone *time_zone; - - my_bool sysdate_is_now; - - /* deadlock detection */ - ulong wt_timeout_short, wt_deadlock_search_depth_short; - ulong wt_timeout_long, wt_deadlock_search_depth_long; - - my_bool wsrep_on; - my_bool wsrep_causal_reads; - uint wsrep_sync_wait; - ulong wsrep_retry_autocommit; - ulonglong wsrep_trx_fragment_size; - ulong wsrep_trx_fragment_unit; - ulong wsrep_OSU_method; - my_bool wsrep_dirty_reads; - double long_query_time_double, max_statement_time_double; - - my_bool pseudo_slave_mode; - - char *session_track_system_variables; - ulong session_track_transaction_info; - my_bool session_track_schema; - my_bool session_track_state_change; -#ifdef USER_VAR_TRACKING - my_bool session_track_user_variables; -#endif // USER_VAR_TRACKING - my_bool tcp_nodelay; - - ulong threadpool_priority; - - uint idle_transaction_timeout; - uint idle_readonly_transaction_timeout; - uint idle_write_transaction_timeout; - uint column_compression_threshold; - uint column_compression_zlib_level; - uint in_subquery_conversion_threshold; - ulonglong max_rowid_filter_size; - - vers_asof_timestamp_t vers_asof_timestamp; - ulong vers_alter_history; -} SV; - -/** - Per thread status variables. - Must be long/ulong up to last_system_status_var so that - add_to_status/add_diff_to_status can work. -*/ - -typedef struct system_status_var -{ - ulong column_compressions; - ulong column_decompressions; - ulong com_stat[(uint) SQLCOM_END]; - ulong com_create_tmp_table; - ulong com_drop_tmp_table; - ulong com_other; - ulong com_multi; - - ulong com_stmt_prepare; - ulong com_stmt_reprepare; - ulong com_stmt_execute; - ulong com_stmt_send_long_data; - ulong com_stmt_fetch; - ulong com_stmt_reset; - ulong com_stmt_close; - - ulong com_register_slave; - ulong created_tmp_disk_tables_; - ulong created_tmp_tables_; - ulong ha_commit_count; - ulong ha_delete_count; - ulong ha_read_first_count; - ulong ha_read_last_count; - ulong ha_read_key_count; - ulong ha_read_next_count; - ulong ha_read_prev_count; - ulong ha_read_retry_count; - ulong ha_read_rnd_count; - ulong ha_read_rnd_next_count; - ulong ha_read_rnd_deleted_count; - - /* - This number doesn't include calls to the default implementation and - calls made by range access. The intent is to count only calls made by - BatchedKeyAccess. - */ - ulong ha_mrr_init_count; - ulong ha_mrr_key_refills_count; - ulong ha_mrr_rowid_refills_count; - - ulong ha_rollback_count; - ulong ha_update_count; - ulong ha_write_count; - /* The following are for internal temporary tables */ - ulong ha_tmp_update_count; - ulong ha_tmp_write_count; - ulong ha_tmp_delete_count; - ulong ha_prepare_count; - ulong ha_icp_attempts; - ulong ha_icp_match; - ulong ha_discover_count; - ulong ha_savepoint_count; - ulong ha_savepoint_rollback_count; - ulong ha_external_lock_count; - - ulong opened_tables; - ulong opened_shares; - ulong opened_views; /* +1 opening a view */ - - ulong select_full_join_count_; - ulong select_full_range_join_count_; - ulong select_range_count_; - ulong select_range_check_count_; - ulong select_scan_count_; - ulong update_scan_count; - ulong delete_scan_count; - ulong executed_triggers; - ulong long_query_count; - ulong filesort_merge_passes_; - ulong filesort_range_count_; - ulong filesort_rows_; - ulong filesort_scan_count_; - ulong filesort_pq_sorts_; - - /* Features used */ - ulong feature_custom_aggregate_functions; /* +1 when custom aggregate - functions are used */ - ulong feature_dynamic_columns; /* +1 when creating a dynamic column */ - ulong feature_fulltext; /* +1 when MATCH is used */ - ulong feature_gis; /* +1 opening a table with GIS features */ - ulong feature_invisible_columns; /* +1 opening a table with invisible column */ - ulong feature_json; /* +1 when JSON function appears in the statement */ - ulong feature_locale; /* +1 when LOCALE is set */ - ulong feature_subquery; /* +1 when subqueries are used */ - ulong feature_system_versioning; /* +1 opening a table WITH SYSTEM VERSIONING */ - ulong feature_application_time_periods; - /* +1 opening a table with application-time period */ - ulong feature_insert_returning; /* +1 when INSERT...RETURNING is used */ - ulong feature_timezone; /* +1 when XPATH is used */ - ulong feature_trigger; /* +1 opening a table with triggers */ - ulong feature_xml; /* +1 when XPATH is used */ - ulong feature_window_functions; /* +1 when window functions are used */ - - /* From MASTER_GTID_WAIT usage */ - ulong master_gtid_wait_timeouts; /* Number of timeouts */ - ulong master_gtid_wait_time; /* Time in microseconds */ - ulong master_gtid_wait_count; - - ulong empty_queries; - ulong access_denied_errors; - ulong lost_connections; - ulong max_statement_time_exceeded; - /* - Number of statements sent from the client - */ - ulong questions; - /* - IMPORTANT! - SEE last_system_status_var DEFINITION BELOW. - Below 'last_system_status_var' are all variables that cannot be handled - automatically by add_to_status()/add_diff_to_status(). - */ - ulonglong bytes_received; - ulonglong bytes_sent; - ulonglong rows_read; - ulonglong rows_sent; - ulonglong rows_tmp_read; - ulonglong binlog_bytes_written; - ulonglong table_open_cache_hits; - ulonglong table_open_cache_misses; - ulonglong table_open_cache_overflows; - double last_query_cost; - double cpu_time, busy_time; - uint32 threads_running; - /* Don't initialize */ - /* Memory used for thread local storage */ - int64 max_local_memory_used; - volatile int64 local_memory_used; - /* Memory allocated for global usage */ - volatile int64 global_memory_used; -} STATUS_VAR; - -/* - This is used for 'SHOW STATUS'. It must be updated to the last ulong - variable in system_status_var which is makes sense to add to the global - counter -*/ - -#define last_system_status_var questions -#define last_cleared_system_status_var local_memory_used - -/** Number of contiguous global status variables */ -constexpr int COUNT_GLOBAL_STATUS_VARS= int(offsetof(STATUS_VAR, - last_system_status_var) / - sizeof(ulong)) + 1; - -/* - Global status variables -*/ - -extern ulong feature_files_opened_with_delayed_keys, feature_check_constraint; - -void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var); - -void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, - STATUS_VAR *dec_var); - -/* - Update global_memory_used. We have to do this with atomic_add as the - global value can change outside of LOCK_status. -*/ -inline void update_global_memory_status(int64 size) -{ - DBUG_PRINT("info", ("global memory_used: %lld size: %lld", - (longlong) global_status_var.global_memory_used, - size)); - // workaround for gcc 4.2.4-1ubuntu4 -fPIE (from DEB_BUILD_HARDENING=1) - int64 volatile * volatile ptr= &global_status_var.global_memory_used; - my_atomic_add64_explicit(ptr, size, MY_MEMORY_ORDER_RELAXED); -} - -/** - Get collation by name, send error to client on failure. - @param name Collation name - @param name_cs Character set of the name string - @return - @retval NULL on error - @retval Pointter to CHARSET_INFO with the given name on success -*/ -inline CHARSET_INFO * -mysqld_collation_get_by_name(const char *name, - CHARSET_INFO *name_cs= system_charset_info) -{ - CHARSET_INFO *cs; - MY_CHARSET_LOADER loader; - my_charset_loader_init_mysys(&loader); - if (!(cs= my_collation_get_by_name(&loader, name, MYF(0)))) - { - ErrConvString err(name, name_cs); - my_error(ER_UNKNOWN_COLLATION, MYF(0), err.ptr()); - if (loader.error[0]) - push_warning_printf(current_thd, - Sql_condition::WARN_LEVEL_WARN, - ER_UNKNOWN_COLLATION, "%s", loader.error); - } - return cs; -} - -inline bool is_supported_parser_charset(CHARSET_INFO *cs) -{ - return MY_TEST(cs->mbminlen == 1); -} - -/** THD registry */ -class THD_list_iterator -{ -protected: - I_List threads; - mutable mysql_rwlock_t lock; - -public: - - /** - Iterates registered threads. - - @param action called for every element - @param argument opque argument passed to action - - @return - @retval 0 iteration completed successfully - @retval 1 iteration was interrupted (action returned 1) - */ - template int iterate(my_bool (*action)(THD *thd, T *arg), T *arg= 0) - { - int res= 0; - mysql_rwlock_rdlock(&lock); - I_List_iterator it(threads); - while (auto tmp= it++) - if ((res= action(tmp, arg))) - break; - mysql_rwlock_unlock(&lock); - return res; - } - static THD_list_iterator *iterator(); -}; - -#ifdef MYSQL_SERVER - -void free_tmp_table(THD *thd, TABLE *entry); - - -/* The following macro is to make init of Query_arena simpler */ -#ifdef DBUG_ASSERT_EXISTS -#define INIT_ARENA_DBUG_INFO is_backup_arena= 0; is_reprepared= FALSE; -#else -#define INIT_ARENA_DBUG_INFO -#endif - -class Query_arena -{ -public: - /* - List of items created in the parser for this query. Every item puts - itself to the list on creation (see Item::Item() for details)) - */ - Item *free_list; - MEM_ROOT *mem_root; // Pointer to current memroot -#ifdef DBUG_ASSERT_EXISTS - bool is_backup_arena; /* True if this arena is used for backup. */ - bool is_reprepared; -#endif - /* - The states relfects three diffrent life cycles for three - different types of statements: - Prepared statement: STMT_INITIALIZED -> STMT_PREPARED -> STMT_EXECUTED. - Stored procedure: STMT_INITIALIZED_FOR_SP -> STMT_EXECUTED. - Other statements: STMT_CONVENTIONAL_EXECUTION never changes. - */ - enum enum_state - { - STMT_INITIALIZED= 0, STMT_INITIALIZED_FOR_SP= 1, STMT_PREPARED= 2, - STMT_CONVENTIONAL_EXECUTION= 3, STMT_EXECUTED= 4, STMT_ERROR= -1 - }; - - enum_state state; - -public: - /* We build without RTTI, so dynamic_cast can't be used. */ - enum Type - { - STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE, TABLE_ARENA - }; - - Query_arena(MEM_ROOT *mem_root_arg, enum enum_state state_arg) : - free_list(0), mem_root(mem_root_arg), state(state_arg) - { INIT_ARENA_DBUG_INFO; } - /* - This constructor is used only when Query_arena is created as - backup storage for another instance of Query_arena. - */ - Query_arena() { INIT_ARENA_DBUG_INFO; } - - virtual Type type() const; - virtual ~Query_arena() {}; - - inline bool is_stmt_prepare() const { return state == STMT_INITIALIZED; } - inline bool is_stmt_prepare_or_first_sp_execute() const - { return (int)state < (int)STMT_PREPARED; } - inline bool is_stmt_prepare_or_first_stmt_execute() const - { return (int)state <= (int)STMT_PREPARED; } - inline bool is_stmt_execute() const - { return state == STMT_PREPARED || state == STMT_EXECUTED; } - inline bool is_conventional() const - { return state == STMT_CONVENTIONAL_EXECUTION; } - - inline void* alloc(size_t size) { return alloc_root(mem_root,size); } - inline void* calloc(size_t size) - { - void *ptr; - if (likely((ptr=alloc_root(mem_root,size)))) - bzero(ptr, size); - return ptr; - } - inline char *strdup(const char *str) - { return strdup_root(mem_root,str); } - inline char *strmake(const char *str, size_t size) - { return strmake_root(mem_root,str,size); } - inline void *memdup(const void *str, size_t size) - { return memdup_root(mem_root,str,size); } - inline void *memdup_w_gap(const void *str, size_t size, size_t gap) - { - void *ptr; - if (likely((ptr= alloc_root(mem_root,size+gap)))) - memcpy(ptr,str,size); - return ptr; - } - - void set_query_arena(Query_arena *set); - - void free_items(); - /* Close the active state associated with execution of this statement */ - virtual void cleanup_stmt(); -}; - - -class Query_arena_memroot: public Query_arena, public Sql_alloc -{ -public: - Query_arena_memroot(MEM_ROOT *mem_root_arg, enum enum_state state_arg) : - Query_arena(mem_root_arg, state_arg) - {} - Query_arena_memroot() : Query_arena() - {} - - virtual ~Query_arena_memroot() {} -}; - - -class Query_arena_stmt -{ - THD *thd; - Query_arena backup; - Query_arena *arena; - -public: - Query_arena_stmt(THD *_thd); - ~Query_arena_stmt(); - bool arena_replaced() - { - return arena != NULL; - } -}; - - -class Server_side_cursor; - -/** - @class Statement - @brief State of a single command executed against this connection. - - One connection can contain a lot of simultaneously running statements, - some of which could be: - - prepared, that is, contain placeholders, - - opened as cursors. We maintain 1 to 1 relationship between - statement and cursor - if user wants to create another cursor for his - query, we create another statement for it. - To perform some action with statement we reset THD part to the state of - that statement, do the action, and then save back modified state from THD - to the statement. It will be changed in near future, and Statement will - be used explicitly. -*/ - -class Statement: public ilink, public Query_arena -{ - Statement(const Statement &rhs); /* not implemented: */ - Statement &operator=(const Statement &rhs); /* non-copyable */ -public: - /* - Uniquely identifies each statement object in thread scope; change during - statement lifetime. FIXME: must be const - */ - ulong id; - - enum enum_column_usage column_usage; - - LEX_CSTRING name; /* name for named prepared statements */ - LEX *lex; // parse tree descriptor - /* - Points to the query associated with this statement. It's const, but - we need to declare it char * because all table handlers are written - in C and need to point to it. - - Note that if we set query = NULL, we must at the same time set - query_length = 0, and protect the whole operation with - LOCK_thd_data mutex. To avoid crashes in races, if we do not - know that thd->query cannot change at the moment, we should print - thd->query like this: - (1) reserve the LOCK_thd_data mutex; - (2) print or copy the value of query and query_length - (3) release LOCK_thd_data mutex. - This printing is needed at least in SHOW PROCESSLIST and SHOW - ENGINE INNODB STATUS. - */ - CSET_STRING query_string; - /* - If opt_query_cache_strip_comments is set, this contains query without - comments. If not set, it contains pointer to query_string. - */ - String base_query; - - - inline char *query() const { return query_string.str(); } - inline uint32 query_length() const - { - return static_cast(query_string.length()); - } - inline char *query_end() const - { - return query_string.str() + query_string.length(); - } - CHARSET_INFO *query_charset() const { return query_string.charset(); } - void set_query_inner(const CSET_STRING &string_arg) - { - query_string= string_arg; - } - void set_query_inner(char *query_arg, uint32 query_length_arg, - CHARSET_INFO *cs_arg) - { - set_query_inner(CSET_STRING(query_arg, query_length_arg, cs_arg)); - } - void reset_query_inner() - { - set_query_inner(CSET_STRING()); - } - /** - Name of the current (default) database. - - If there is the current (default) database, "db.str" contains its name. If - there is no current (default) database, "db.str" is NULL and "db.length" is - 0. In other words, db must either be NULL, or contain a - valid database name. - */ - - LEX_CSTRING db; - - /* This is set to 1 of last call to send_result_to_client() was ok */ - my_bool query_cache_is_applicable; - - /* This constructor is called for backup statements */ - Statement() {} - - Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg, - enum enum_state state_arg, ulong id_arg); - virtual ~Statement(); - - /* Assign execution context (note: not all members) of given stmt to self */ - virtual void set_statement(Statement *stmt); - void set_n_backup_statement(Statement *stmt, Statement *backup); - void restore_backup_statement(Statement *stmt, Statement *backup); - /* return class type */ - virtual Type type() const; -}; - - -/** - Container for all statements created/used in a connection. - Statements in Statement_map have unique Statement::id (guaranteed by id - assignment in Statement::Statement) - Non-empty statement names are unique too: attempt to insert a new statement - with duplicate name causes older statement to be deleted - - Statements are auto-deleted when they are removed from the map and when the - map is deleted. -*/ - -class Statement_map -{ -public: - Statement_map(); - - int insert(THD *thd, Statement *statement); - - Statement *find_by_name(const LEX_CSTRING *name) - { - Statement *stmt; - stmt= (Statement*)my_hash_search(&names_hash, (uchar*)name->str, - name->length); - return stmt; - } - - Statement *find(ulong id) - { - if (last_found_statement == 0 || id != last_found_statement->id) - { - Statement *stmt; - stmt= (Statement *) my_hash_search(&st_hash, (uchar *) &id, sizeof(id)); - if (stmt && stmt->name.str) - return NULL; - last_found_statement= stmt; - } - return last_found_statement; - } - /* - Close all cursors of this connection that use tables of a storage - engine that has transaction-specific state and therefore can not - survive COMMIT or ROLLBACK. Currently all but MyISAM cursors are closed. - */ - void close_transient_cursors(); - void erase(Statement *statement); - /* Erase all statements (calls Statement destructor) */ - void reset(); - ~Statement_map(); -private: - HASH st_hash; - HASH names_hash; - I_List transient_cursor_list; - Statement *last_found_statement; -}; - -struct st_savepoint { - struct st_savepoint *prev; - char *name; - uint length; - Ha_trx_info *ha_list; - /** State of metadata locks before this savepoint was set. */ - MDL_savepoint mdl_savepoint; -}; - -/** - @class Security_context - @brief A set of THD members describing the current authenticated user. -*/ - -class Security_context { -public: - Security_context() - :master_access(NO_ACL), - db_access(NO_ACL) - {} /* Remove gcc warning */ - /* - host - host of the client - user - user of the client, set to NULL until the user has been read from - the connection - priv_user - The user privilege we are using. May be "" for anonymous user. - ip - client IP - */ - const char *host; - const char *user, *ip; - char priv_user[USERNAME_LENGTH]; - char proxy_user[USERNAME_LENGTH + MAX_HOSTNAME + 5]; - /* The host privilege we are using */ - char priv_host[MAX_HOSTNAME]; - /* The role privilege we are using */ - char priv_role[USERNAME_LENGTH]; - /* The external user (if available) */ - char *external_user; - /* points to host if host is available, otherwise points to ip */ - const char *host_or_ip; - privilege_t master_access; /* Global privileges from mysql.user */ - privilege_t db_access; /* Privileges for current db */ - - bool password_expired; - - void init(); - void destroy(); - void skip_grants(); - inline char *priv_host_name() - { - return (*priv_host ? priv_host : (char *)"%"); - } - - bool set_user(char *user_arg); - -#ifndef NO_EMBEDDED_ACCESS_CHECKS - bool - change_security_context(THD *thd, - LEX_CSTRING *definer_user, - LEX_CSTRING *definer_host, - LEX_CSTRING *db, - Security_context **backup); - - void - restore_security_context(THD *thd, Security_context *backup); -#endif - bool user_matches(Security_context *); - /** - Check global access - @param want_access The required privileges - @param match_any if the security context must match all or any of the req. - * privileges. - @return True if the security context fulfills the access requirements. - */ - bool check_access(const privilege_t want_access, bool match_any = false); - bool is_priv_user(const char *user, const char *host); -}; - - -/** - A registry for item tree transformations performed during - query optimization. We register only those changes which require - a rollback to re-execute a prepared statement or stored procedure - yet another time. -*/ - -struct Item_change_record; -class Item_change_list -{ - I_List change_list; -public: - void nocheck_register_item_tree_change(Item **place, Item *old_value, - MEM_ROOT *runtime_memroot); - void check_and_register_item_tree_change(Item **place, Item **new_value, - MEM_ROOT *runtime_memroot); - void rollback_item_tree_changes(); - void move_elements_to(Item_change_list *to) - { - change_list.move_elements_to(&to->change_list); - } - bool is_empty() { return change_list.is_empty(); } -}; - - -class Item_change_list_savepoint: public Item_change_list -{ -public: - Item_change_list_savepoint(Item_change_list *list) - { - list->move_elements_to(this); - } - void rollback(Item_change_list *list) - { - list->rollback_item_tree_changes(); - move_elements_to(list); - } - ~Item_change_list_savepoint() - { - DBUG_ASSERT(is_empty()); - } -}; - - -/** - Type of locked tables mode. - See comment for THD::locked_tables_mode for complete description. -*/ - -enum enum_locked_tables_mode -{ - LTM_NONE= 0, - LTM_LOCK_TABLES, - LTM_PRELOCKED, - LTM_PRELOCKED_UNDER_LOCK_TABLES, - LTM_always_last -}; - -/** - The following structure is an extension to TABLE_SHARE and is - exclusively for temporary tables. - - @note: - Although, TDC_element has data members (like next, prev & - all_tables) to store the list of TABLE_SHARE & TABLE objects - related to a particular TABLE_SHARE, they cannot be moved to - TABLE_SHARE in order to be reused for temporary tables. This - is because, as concurrent threads iterating through hash of - TDC_element's may need access to all_tables, but if all_tables - is made part of TABLE_SHARE, then TDC_element->share->all_tables - is not always guaranteed to be valid, as TDC_element can live - longer than TABLE_SHARE. -*/ -struct TMP_TABLE_SHARE : public TABLE_SHARE -{ -private: - /* - Link to all temporary table shares. Declared as private to - avoid direct manipulation with those objects. One should - use methods of I_P_List template instead. - */ - TMP_TABLE_SHARE *tmp_next; - TMP_TABLE_SHARE **tmp_prev; - - friend struct All_tmp_table_shares; - -public: - /* - Doubly-linked (back-linked) lists of used and unused TABLE objects - for this share. - */ - All_share_tables_list all_tmp_tables; -}; - -/** - Helper class which specifies which members of TMP_TABLE_SHARE are - used for participation in the list of temporary tables. -*/ - -struct All_tmp_table_shares -{ - static inline TMP_TABLE_SHARE **next_ptr(TMP_TABLE_SHARE *l) - { - return &l->tmp_next; - } - static inline TMP_TABLE_SHARE ***prev_ptr(TMP_TABLE_SHARE *l) - { - return &l->tmp_prev; - } -}; - -/* Also used in rpl_rli.h. */ -typedef I_P_List All_tmp_tables_list; - -/** - Class that holds information about tables which were opened and locked - by the thread. It is also used to save/restore this information in - push_open_tables_state()/pop_open_tables_state(). -*/ - -class Open_tables_state -{ -public: - /** - As part of class THD, this member is set during execution - of a prepared statement. When it is set, it is used - by the locking subsystem to report a change in table metadata. - - When Open_tables_state part of THD is reset to open - a system or INFORMATION_SCHEMA table, the member is cleared - to avoid spurious ER_NEED_REPREPARE errors -- system and - INFORMATION_SCHEMA tables are not subject to metadata version - tracking. - @sa check_and_update_table_version() - */ - Reprepare_observer *m_reprepare_observer; - - /** - List of regular tables in use by this thread. Contains temporary and - base tables that were opened with @see open_tables(). - */ - TABLE *open_tables; - - /** - A list of temporary tables used by this thread. This includes - user-level temporary tables, created with CREATE TEMPORARY TABLE, - and internal temporary tables, created, e.g., to resolve a SELECT, - or for an intermediate table used in ALTER. - */ - All_tmp_tables_list *temporary_tables; - - /* - Derived tables. - */ - TABLE *derived_tables; - - /* - Temporary tables created for recursive table references. - */ - TABLE *rec_tables; - - /* - During a MySQL session, one can lock tables in two modes: automatic - or manual. In automatic mode all necessary tables are locked just before - statement execution, and all acquired locks are stored in 'lock' - member. Unlocking takes place automatically as well, when the - statement ends. - Manual mode comes into play when a user issues a 'LOCK TABLES' - statement. In this mode the user can only use the locked tables. - Trying to use any other tables will give an error. - The locked tables are also stored in this member, however, - thd->locked_tables_mode is turned on. Manual locking is described in - the 'LOCK_TABLES' chapter of the MySQL manual. - See also lock_tables() for details. - */ - MYSQL_LOCK *lock; - - /* - CREATE-SELECT keeps an extra lock for the table being - created. This field is used to keep the extra lock available for - lower level routines, which would otherwise miss that lock. - */ - MYSQL_LOCK *extra_lock; - - /* - Enum enum_locked_tables_mode and locked_tables_mode member are - used to indicate whether the so-called "locked tables mode" is on, - and what kind of mode is active. - - Locked tables mode is used when it's necessary to open and - lock many tables at once, for usage across multiple - (sub-)statements. - This may be necessary either for queries that use stored functions - and triggers, in which case the statements inside functions and - triggers may be executed many times, or for implementation of - LOCK TABLES, in which case the opened tables are reused by all - subsequent statements until a call to UNLOCK TABLES. - - The kind of locked tables mode employed for stored functions and - triggers is also called "prelocked mode". - In this mode, first open_tables() call to open the tables used - in a statement analyses all functions used by the statement - and adds all indirectly used tables to the list of tables to - open and lock. - It also marks the parse tree of the statement as requiring - prelocking. After that, lock_tables() locks the entire list - of tables and changes THD::locked_tables_modeto LTM_PRELOCKED. - All statements executed inside functions or triggers - use the prelocked tables, instead of opening their own ones. - Prelocked mode is turned off automatically once close_thread_tables() - of the main statement is called. - */ - enum enum_locked_tables_mode locked_tables_mode; - uint current_tablenr; - - enum enum_flags { - BACKUPS_AVAIL = (1U << 0) /* There are backups available */ - }; - - /* - Flags with information about the open tables state. - */ - uint state_flags; - /** - This constructor initializes Open_tables_state instance which can only - be used as backup storage. To prepare Open_tables_state instance for - operations which open/lock/close tables (e.g. open_table()) one has to - call init_open_tables_state(). - */ - Open_tables_state() : state_flags(0U) { } - - void set_open_tables_state(Open_tables_state *state) - { - *this= *state; - } - - void reset_open_tables_state(THD *thd) - { - open_tables= 0; - temporary_tables= 0; - derived_tables= 0; - rec_tables= 0; - extra_lock= 0; - lock= 0; - locked_tables_mode= LTM_NONE; - state_flags= 0U; - m_reprepare_observer= NULL; - } -}; - - -/** - Storage for backup of Open_tables_state. Must - be used only to open system tables (TABLE_CATEGORY_SYSTEM - and TABLE_CATEGORY_LOG). -*/ - -class Open_tables_backup: public Open_tables_state -{ -public: - /** - When we backup the open tables state to open a system - table or tables, we want to save state of metadata - locks which were acquired before the backup. It is used - to release metadata locks on system tables after they are - no longer used. - */ - MDL_savepoint mdl_system_tables_svp; -}; - -/** - @class Sub_statement_state - @brief Used to save context when executing a function or trigger - - operations on stat tables aren't technically a sub-statement, but they are - similar in a sense that they cannot change the transaction status. -*/ - -/* Defines used for Sub_statement_state::in_sub_stmt */ - -#define SUB_STMT_TRIGGER 1 -#define SUB_STMT_FUNCTION 2 -#define SUB_STMT_STAT_TABLES 4 - - -class Sub_statement_state -{ -public: - Discrete_interval auto_inc_interval_for_cur_row; - Discrete_intervals_list auto_inc_intervals_forced; - SAVEPOINT *savepoints; - ulonglong option_bits; - ulonglong first_successful_insert_id_in_prev_stmt; - ulonglong first_successful_insert_id_in_cur_stmt, insert_id_for_cur_row; - ulonglong limit_found_rows; - ulonglong tmp_tables_size; - ulonglong client_capabilities; - ulonglong cuted_fields, sent_row_count, examined_row_count; - ulonglong affected_rows; - ulonglong bytes_sent_old; - ulong tmp_tables_used; - ulong tmp_tables_disk_used; - ulong query_plan_fsort_passes; - ulong query_plan_flags; - uint in_sub_stmt; /* 0, SUB_STMT_TRIGGER or SUB_STMT_FUNCTION */ - bool enable_slow_log; - bool last_insert_id_used; - enum enum_check_fields count_cuted_fields; -}; - - -/* Flags for the THD::system_thread variable */ -enum enum_thread_type -{ - NON_SYSTEM_THREAD= 0, - SYSTEM_THREAD_DELAYED_INSERT= 1, - SYSTEM_THREAD_SLAVE_IO= 2, - SYSTEM_THREAD_SLAVE_SQL= 4, - SYSTEM_THREAD_EVENT_SCHEDULER= 8, - SYSTEM_THREAD_EVENT_WORKER= 16, - SYSTEM_THREAD_BINLOG_BACKGROUND= 32, - SYSTEM_THREAD_SLAVE_BACKGROUND= 64, - SYSTEM_THREAD_GENERIC= 128, - SYSTEM_THREAD_SEMISYNC_MASTER_BACKGROUND= 256 -}; - -inline char const * -show_system_thread(enum_thread_type thread) -{ -#define RETURN_NAME_AS_STRING(NAME) case (NAME): return #NAME - switch (thread) { - static char buf[64]; - RETURN_NAME_AS_STRING(NON_SYSTEM_THREAD); - RETURN_NAME_AS_STRING(SYSTEM_THREAD_DELAYED_INSERT); - RETURN_NAME_AS_STRING(SYSTEM_THREAD_SLAVE_IO); - RETURN_NAME_AS_STRING(SYSTEM_THREAD_SLAVE_SQL); - RETURN_NAME_AS_STRING(SYSTEM_THREAD_EVENT_SCHEDULER); - RETURN_NAME_AS_STRING(SYSTEM_THREAD_EVENT_WORKER); - RETURN_NAME_AS_STRING(SYSTEM_THREAD_SLAVE_BACKGROUND); - RETURN_NAME_AS_STRING(SYSTEM_THREAD_SEMISYNC_MASTER_BACKGROUND); - default: - sprintf(buf, "", thread); - return buf; - } -#undef RETURN_NAME_AS_STRING -} - -/** - This class represents the interface for internal error handlers. - Internal error handlers are exception handlers used by the server - implementation. -*/ - -class Internal_error_handler -{ -protected: - Internal_error_handler() : - m_prev_internal_handler(NULL) - {} - - virtual ~Internal_error_handler() {} - -public: - /** - Handle a sql condition. - This method can be implemented by a subclass to achieve any of the - following: - - mask a warning/error internally, prevent exposing it to the user, - - mask a warning/error and throw another one instead. - When this method returns true, the sql condition is considered - 'handled', and will not be propagated to upper layers. - It is the responsability of the code installing an internal handler - to then check for trapped conditions, and implement logic to recover - from the anticipated conditions trapped during runtime. - - This mechanism is similar to C++ try/throw/catch: - - 'try' correspond to THD::push_internal_handler(), - - 'throw' correspond to my_error(), - which invokes my_message_sql(), - - 'catch' correspond to checking how/if an internal handler was invoked, - before removing it from the exception stack with - THD::pop_internal_handler(). - - @param thd the calling thread - @param cond the condition raised. - @return true if the condition is handled - */ - virtual bool handle_condition(THD *thd, - uint sql_errno, - const char* sqlstate, - Sql_condition::enum_warning_level *level, - const char* msg, - Sql_condition ** cond_hdl) = 0; - -private: - Internal_error_handler *m_prev_internal_handler; - friend class THD; -}; - - -/** - Implements the trivial error handler which cancels all error states - and prevents an SQLSTATE to be set. -*/ - -class Dummy_error_handler : public Internal_error_handler -{ -public: - bool handle_condition(THD *thd, - uint sql_errno, - const char* sqlstate, - Sql_condition::enum_warning_level *level, - const char* msg, - Sql_condition ** cond_hdl) - { - /* Ignore error */ - return TRUE; - } - Dummy_error_handler() {} /* Remove gcc warning */ -}; - - -/** - Implements the trivial error handler which counts errors as they happen. -*/ - -class Counting_error_handler : public Internal_error_handler -{ -public: - int errors; - bool handle_condition(THD *thd, - uint sql_errno, - const char* sqlstate, - Sql_condition::enum_warning_level *level, - const char* msg, - Sql_condition ** cond_hdl) - { - if (*level == Sql_condition::WARN_LEVEL_ERROR) - errors++; - return false; - } - Counting_error_handler() : errors(0) {} -}; - - -/** - This class is an internal error handler implementation for - DROP TABLE statements. The thing is that there may be warnings during - execution of these statements, which should not be exposed to the user. - This class is intended to silence such warnings. -*/ - -class Drop_table_error_handler : public Internal_error_handler -{ -public: - Drop_table_error_handler() {} - -public: - bool handle_condition(THD *thd, - uint sql_errno, - const char* sqlstate, - Sql_condition::enum_warning_level *level, - const char* msg, - Sql_condition ** cond_hdl); - -private: -}; - - -/** - Internal error handler to process an error from MDL_context::upgrade_lock() - and mysql_lock_tables(). Used by implementations of HANDLER READ and - LOCK TABLES LOCAL. -*/ - -class MDL_deadlock_and_lock_abort_error_handler: public Internal_error_handler -{ -public: - virtual - bool handle_condition(THD *thd, - uint sql_errno, - const char *sqlstate, - Sql_condition::enum_warning_level *level, - const char* msg, - Sql_condition **cond_hdl); - - bool need_reopen() const { return m_need_reopen; }; - void init() { m_need_reopen= FALSE; }; -private: - bool m_need_reopen; -}; - - -/** - Tables that were locked with LOCK TABLES statement. - - Encapsulates a list of TABLE_LIST instances for tables - locked by LOCK TABLES statement, memory root for metadata locks, - and, generally, the context of LOCK TABLES statement. - - In LOCK TABLES mode, the locked tables are kept open between - statements. - Therefore, we can't allocate metadata locks on execution memory - root -- as well as tables, the locks need to stay around till - UNLOCK TABLES is called. - The locks are allocated in the memory root encapsulated in this - class. - - Some SQL commands, like FLUSH TABLE or ALTER TABLE, demand that - the tables they operate on are closed, at least temporarily. - This class encapsulates a list of TABLE_LIST instances, one - for each base table from LOCK TABLES list, - which helps conveniently close the TABLEs when it's necessary - and later reopen them. - - Implemented in sql_base.cc -*/ - -class Locked_tables_list -{ -public: - MEM_ROOT m_locked_tables_root; -private: - TABLE_LIST *m_locked_tables; - TABLE_LIST **m_locked_tables_last; - /** An auxiliary array used only in reopen_tables(). */ - TABLE_LIST **m_reopen_array; - /** - Count the number of tables in m_locked_tables list. We can't - rely on thd->lock->table_count because it excludes - non-transactional temporary tables. We need to know - an exact number of TABLE objects. - */ - uint m_locked_tables_count; -public: - bool some_table_marked_for_reopen; - - Locked_tables_list() - :m_locked_tables(NULL), - m_locked_tables_last(&m_locked_tables), - m_reopen_array(NULL), - m_locked_tables_count(0), - some_table_marked_for_reopen(0) - { - init_sql_alloc(key_memory_locked_table_list, &m_locked_tables_root, - MEM_ROOT_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC)); - } - int unlock_locked_tables(THD *thd); - int unlock_locked_table(THD *thd, MDL_ticket *mdl_ticket); - ~Locked_tables_list() - { - reset(); - } - void reset(); - bool init_locked_tables(THD *thd); - TABLE_LIST *locked_tables() { return m_locked_tables; } - void unlink_from_list(THD *thd, TABLE_LIST *table_list, - bool remove_from_locked_tables); - void unlink_all_closed_tables(THD *thd, - MYSQL_LOCK *lock, - size_t reopen_count); - bool reopen_tables(THD *thd, bool need_reopen); - bool restore_lock(THD *thd, TABLE_LIST *dst_table_list, TABLE *table, - MYSQL_LOCK *lock); - void add_back_last_deleted_lock(TABLE_LIST *dst_table_list); - void mark_table_for_reopen(THD *thd, TABLE *table); -}; - - -/** - Storage engine specific thread local data. -*/ - -struct Ha_data -{ - /** - Storage engine specific thread local data. - Lifetime: one user connection. - */ - void *ha_ptr; - /** - 0: Life time: one statement within a transaction. If @@autocommit is - on, also represents the entire transaction. - @sa trans_register_ha() - - 1: Life time: one transaction within a connection. - If the storage engine does not participate in a transaction, - this should not be used. - @sa trans_register_ha() - */ - Ha_trx_info ha_info[2]; - /** - NULL: engine is not bound to this thread - non-NULL: engine is bound to this thread, engine shutdown forbidden - */ - plugin_ref lock; - Ha_data() :ha_ptr(NULL) {} - - void reset() - { - ha_ptr= nullptr; - for (auto &info : ha_info) - info.reset(); - lock= nullptr; - } -}; - -/** - An instance of the global read lock in a connection. - Implemented in lock.cc. -*/ - -class Global_read_lock -{ -public: - enum enum_grl_state - { - GRL_NONE, - GRL_ACQUIRED, - GRL_ACQUIRED_AND_BLOCKS_COMMIT - }; - - Global_read_lock() - : m_state(GRL_NONE), - m_mdl_global_read_lock(NULL) - {} - - bool lock_global_read_lock(THD *thd); - void unlock_global_read_lock(THD *thd); - bool make_global_read_lock_block_commit(THD *thd); - bool is_acquired() const { return m_state != GRL_NONE; } - void set_explicit_lock_duration(THD *thd); -private: - enum_grl_state m_state; - /** - Global read lock is acquired in two steps: - 1. acquire MDL_BACKUP_FTWRL1 in BACKUP namespace to prohibit DDL and DML - 2. upgrade to MDL_BACKUP_FTWRL2 to prohibit commits - */ - MDL_ticket *m_mdl_global_read_lock; -}; - - -/* - Class to facilitate the commit of one transactions waiting for the commit of - another transaction to complete first. - - This is used during (parallel) replication, to allow different transactions - to be applied in parallel, but still commit in order. - - The transaction that wants to wait for a prior commit must first register - to wait with register_wait_for_prior_commit(waitee). Such registration - must be done holding the waitee->LOCK_wait_commit, to prevent the other - THD from disappearing during the registration. - - Then during commit, if a THD is registered to wait, it will call - wait_for_prior_commit() as part of ha_commit_trans(). If no wait is - registered, or if the waitee for has already completed commit, then - wait_for_prior_commit() returns immediately. - - And when a THD that may be waited for has completed commit (more precisely - commit_ordered()), then it must call wakeup_subsequent_commits() to wake - up any waiters. Note that this must be done at a point that is guaranteed - to be later than any waiters registering themselves. It is safe to call - wakeup_subsequent_commits() multiple times, as waiters are removed from - registration as part of the wakeup. - - The reason for separate register and wait calls is that this allows to - register the wait early, at a point where the waited-for THD is known to - exist. And then the actual wait can be done much later, where the - waited-for THD may have been long gone. By registering early, the waitee - can signal before disappearing. -*/ -struct wait_for_commit -{ - /* - The LOCK_wait_commit protects the fields subsequent_commits_list and - wakeup_subsequent_commits_running (for a waitee), and the pointer - waitee and associated COND_wait_commit (for a waiter). - */ - mysql_mutex_t LOCK_wait_commit; - mysql_cond_t COND_wait_commit; - /* List of threads that did register_wait_for_prior_commit() on us. */ - wait_for_commit *subsequent_commits_list; - /* Link field for entries in subsequent_commits_list. */ - wait_for_commit *next_subsequent_commit; - /* - Our waitee, if we did register_wait_for_prior_commit(), and were not - yet woken up. Else NULL. - - When this is cleared for wakeup, the COND_wait_commit condition is - signalled. - - This pointer is protected by LOCK_wait_commit. But there is also a "fast - path" where the waiter compares this to NULL without holding the lock. - Such read must be done with acquire semantics (and all corresponding - writes done with release semantics). This ensures that a wakeup with error - is reliably detected as (waitee==NULL && wakeup_error != 0). - */ - std::atomic waitee; - /* - Generic pointer for use by the transaction coordinator to optimise the - waiting for improved group commit. - - Currently used by binlog TC to signal that a waiter is ready to commit, so - that the waitee can grab it and group commit it directly. It is free to be - used by another transaction coordinator for similar purposes. - */ - void *opaque_pointer; - /* The wakeup error code from the waitee. 0 means no error. */ - int wakeup_error; - /* - Flag set when wakeup_subsequent_commits_running() is active, see comments - on that function for details. - */ - bool wakeup_subsequent_commits_running; - /* - This flag can be set when a commit starts, but has not completed yet. - It is used by binlog group commit to allow a waiting transaction T2 to - join the group commit of an earlier transaction T1. When T1 has queued - itself for group commit, it will set the commit_started flag. Then when - T2 becomes ready to commit and needs to wait for T1 to commit first, T2 - can queue itself before waiting, and thereby participate in the same - group commit as T1. - */ - bool commit_started; - - void register_wait_for_prior_commit(wait_for_commit *waitee); - int wait_for_prior_commit(THD *thd) - { - /* - Quick inline check, to avoid function call and locking in the common case - where no wakeup is registered, or a registered wait was already signalled. - */ - if (waitee.load(std::memory_order_acquire)) - return wait_for_prior_commit2(thd); - else - { - if (wakeup_error) - my_error(ER_PRIOR_COMMIT_FAILED, MYF(0)); - return wakeup_error; - } - } - void wakeup_subsequent_commits(int wakeup_error_arg) - { - /* - Do the check inline, so only the wakeup case takes the cost of a function - call for every commmit. - - Note that the check is done without locking. It is the responsibility of - the user of the wakeup facility to ensure that no waiters can register - themselves after the last call to wakeup_subsequent_commits(). - - This avoids having to take another lock for every commit, which would be - pointless anyway - even if we check under lock, there is nothing to - prevent a waiter from arriving just after releasing the lock. - */ - if (subsequent_commits_list) - wakeup_subsequent_commits2(wakeup_error_arg); - } - void unregister_wait_for_prior_commit() - { - if (waitee.load(std::memory_order_relaxed)) - unregister_wait_for_prior_commit2(); - else - wakeup_error= 0; - } - /* - Remove a waiter from the list in the waitee. Used to unregister a wait. - The caller must be holding the locks of both waiter and waitee. - */ - void remove_from_list(wait_for_commit **next_ptr_ptr) - { - wait_for_commit *cur; - - while ((cur= *next_ptr_ptr) != NULL) - { - if (cur == this) - { - *next_ptr_ptr= this->next_subsequent_commit; - break; - } - next_ptr_ptr= &cur->next_subsequent_commit; - } - waitee.store(NULL, std::memory_order_relaxed); - } - - void wakeup(int wakeup_error); - - int wait_for_prior_commit2(THD *thd); - void wakeup_subsequent_commits2(int wakeup_error); - void unregister_wait_for_prior_commit2(); - - wait_for_commit(); - ~wait_for_commit(); - void reinit(); -}; - -extern "C" void my_message_sql(uint error, const char *str, myf MyFlags); - - -class Gap_time_tracker; - -/* - Thread context for Gap_time_tracker class. -*/ -class Gap_time_tracker_data -{ -public: - Gap_time_tracker_data(): bill_to(NULL) {} - - Gap_time_tracker *bill_to; - ulonglong start_time; - - void init() { bill_to = NULL; } -}; - -/** - A wrapper around thread_count. - - It must be specified as a first base class of THD, so that increment is - done before any other THD constructors and decrement - after any other THD - destructors. - - Destructor unblocks close_conneciton() if there are no more THD's left. -*/ -struct THD_count -{ - THD_count() { thread_count++; } - ~THD_count() { thread_count--; } -}; - - -/** - @class THD - For each client connection we create a separate thread with THD serving as - a thread/connection descriptor -*/ - -class THD: public THD_count, /* this must be first */ - public Statement, - /* - This is to track items changed during execution of a prepared - statement/stored procedure. It's created by - nocheck_register_item_tree_change() in memory root of THD, - and freed in rollback_item_tree_changes(). - For conventional execution it's always empty. - */ - public Item_change_list, - public MDL_context_owner, - public Open_tables_state -{ -private: - inline bool is_stmt_prepare() const - { DBUG_ASSERT(0); return Statement::is_stmt_prepare(); } - - inline bool is_stmt_prepare_or_first_sp_execute() const - { DBUG_ASSERT(0); return Statement::is_stmt_prepare_or_first_sp_execute(); } - - inline bool is_stmt_prepare_or_first_stmt_execute() const - { DBUG_ASSERT(0); return Statement::is_stmt_prepare_or_first_stmt_execute(); } - - inline bool is_conventional() const - { DBUG_ASSERT(0); return Statement::is_conventional(); } - -public: - MDL_context mdl_context; - - /* Used to execute base64 coded binlog events in MySQL server */ - Relay_log_info* rli_fake; - rpl_group_info* rgi_fake; - /* Slave applier execution context */ - rpl_group_info* rgi_slave; - - union { - rpl_io_thread_info *rpl_io_info; - rpl_sql_thread_info *rpl_sql_info; - } system_thread_info; - /* Used for BACKUP LOCK */ - MDL_ticket *mdl_backup_ticket, *mdl_backup_lock; - /* Used to register that thread has a MDL_BACKUP_WAIT_COMMIT lock */ - MDL_request *backup_commit_lock; - - void reset_for_next_command(bool do_clear_errors= 1); - /* - Constant for THD::where initialization in the beginning of every query. - - It's needed because we do not save/restore THD::where normally during - primary (non subselect) query execution. - */ - static const char * const DEFAULT_WHERE; - -#ifdef EMBEDDED_LIBRARY - struct st_mysql *mysql; - unsigned long client_stmt_id; - unsigned long client_param_count; - struct st_mysql_bind *client_params; - char *extra_data; - ulong extra_length; - struct st_mysql_data *cur_data; - struct st_mysql_data *first_data; - struct st_mysql_data **data_tail; - void clear_data_list(); - struct st_mysql_data *alloc_new_dataset(); - /* - In embedded server it points to the statement that is processed - in the current query. We store some results directly in statement - fields then. - */ - struct st_mysql_stmt *current_stmt; -#endif -#ifdef HAVE_QUERY_CACHE - Query_cache_tls query_cache_tls; -#endif - NET net; // client connection descriptor - /** Aditional network instrumentation for the server only. */ - NET_SERVER m_net_server_extension; - scheduler_functions *scheduler; // Scheduler for this connection - Protocol *protocol; // Current protocol - Protocol_text protocol_text; // Normal protocol - Protocol_binary protocol_binary; // Binary protocol - HASH user_vars; // hash for user variables - String packet; // dynamic buffer for network I/O - String convert_buffer; // buffer for charset conversions - struct my_rnd_struct rand; // used for authentication - struct system_variables variables; // Changeable local variables - struct system_status_var status_var; // Per thread statistic vars - struct system_status_var org_status_var; // For user statistics - struct system_status_var *initial_status_var; /* used by show status */ - THR_LOCK_INFO lock_info; // Locking info of this thread - /** - Protects THD data accessed from other threads: - - thd->query and thd->query_length (used by SHOW ENGINE - INNODB STATUS and SHOW PROCESSLIST - - thd->db (used in SHOW PROCESSLIST) - Is locked when THD is deleted. - */ - mutable mysql_mutex_t LOCK_thd_data; - /* - Protects: - - kill information - - mysys_var (used by KILL statement and shutdown). - - Also ensures that THD is not deleted while mutex is hold - */ - mysql_mutex_t LOCK_thd_kill; - - /* all prepared statements and cursors of this connection */ - Statement_map stmt_map; - - /* Last created prepared statement */ - Statement *last_stmt; - inline void set_last_stmt(Statement *stmt) - { last_stmt= (is_error() ? NULL : stmt); } - inline void clear_last_stmt() { last_stmt= NULL; } - - /* - A pointer to the stack frame of handle_one_connection(), - which is called first in the thread for handling a client - */ - char *thread_stack; - - /** - Currently selected catalog. - */ - char *catalog; - - /** - @note - Some members of THD (currently 'Statement::db', - 'catalog' and 'query') are set and alloced by the slave SQL thread - (for the THD of that thread); that thread is (and must remain, for now) - the only responsible for freeing these 3 members. If you add members - here, and you add code to set them in replication, don't forget to - free_them_and_set_them_to_0 in replication properly. For details see - the 'err:' label of the handle_slave_sql() in sql/slave.cc. - - @see handle_slave_sql - */ - - Security_context main_security_ctx; - Security_context *security_ctx; - Security_context *security_context() const { return security_ctx; } - void set_security_context(Security_context *sctx) { security_ctx = sctx; } - - /* - Points to info-string that we show in SHOW PROCESSLIST - You are supposed to update thd->proc_info only if you have coded - a time-consuming piece that MySQL can get stuck in for a long time. - - Set it using the thd_proc_info(THD *thread, const char *message) - macro/function. - - This member is accessed and assigned without any synchronization. - Therefore, it may point only to constant (statically - allocated) strings, which memory won't go away over time. - */ - const char *proc_info; - - void set_psi(PSI_thread *psi) - { - my_atomic_storeptr((void*volatile*)&m_psi, psi); - } - - PSI_thread* get_psi() - { - return static_cast(my_atomic_loadptr((void*volatile*)&m_psi)); - } - -private: - unsigned int m_current_stage_key; - - /** Performance schema thread instrumentation for this session. */ - PSI_thread *m_psi; - -public: - void enter_stage(const PSI_stage_info *stage, - const char *calling_func, - const char *calling_file, - const unsigned int calling_line) - { - DBUG_PRINT("THD::enter_stage", ("%s at %s:%d", stage->m_name, - calling_file, calling_line)); - DBUG_ASSERT(stage); - m_current_stage_key= stage->m_key; - proc_info= stage->m_name; -#if defined(ENABLED_PROFILING) - profiling.status_change(proc_info, calling_func, calling_file, - calling_line); -#endif -#ifdef HAVE_PSI_THREAD_INTERFACE - m_stage_progress_psi= MYSQL_SET_STAGE(m_current_stage_key, calling_file, calling_line); -#endif - } - - void backup_stage(PSI_stage_info *stage) - { - stage->m_key= m_current_stage_key; - stage->m_name= proc_info; - } - - const char *get_proc_info() const - { return proc_info; } - - /* - Used in error messages to tell user in what part of MySQL we found an - error. E. g. when where= "having clause", if fix_fields() fails, user - will know that the error was in having clause. - */ - const char *where; - - /* Needed by MariaDB semi sync replication */ - Trans_binlog_info *semisync_info; - /* If this is a semisync slave connection. */ - bool semi_sync_slave; - ulonglong client_capabilities; /* What the client supports */ - ulong max_client_packet_length; - - HASH handler_tables_hash; - /* - A thread can hold named user-level locks. This variable - contains granted tickets if a lock is present. See item_func.cc and - chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK. - */ - HASH ull_hash; - /* Hash of used seqeunces (for PREVIOUS value) */ - HASH sequences; -#ifdef DBUG_ASSERT_EXISTS - uint dbug_sentry; // watch out for memory corruption -#endif - struct st_my_thread_var *mysys_var; - - /* Original charset number from the first client packet, or COM_CHANGE_USER*/ - CHARSET_INFO *org_charset; -private: - /* - Type of current query: COM_STMT_PREPARE, COM_QUERY, etc. Set from - first byte of the packet in do_command() - */ - enum enum_server_command m_command; - -public: - uint32 file_id; // for LOAD DATA INFILE - /* remote (peer) port */ - uint16 peer_port; - my_time_t start_time; // start_time and its sec_part - ulong start_time_sec_part; // are almost always used separately - my_hrtime_t user_time; - // track down slow pthread_create - ulonglong prior_thr_create_utime, thr_create_utime; - ulonglong start_utime, utime_after_lock, utime_after_query; - /* This can be used by handlers to send signals to the SQL level */ - ulonglong replication_flags; - // Process indicator - struct { - /* - true, if the currently running command can send progress report - packets to a client. Set by mysql_execute_command() for safe commands - See CF_REPORT_PROGRESS - */ - bool report_to_client; - /* - true, if we will send progress report packets to a client - (client has requested them, see MARIADB_CLIENT_PROGRESS; report_to_client - is true; not in sub-statement) - */ - bool report; - uint stage, max_stage; - ulonglong counter, max_counter; - ulonglong next_report_time; - Query_arena *arena; - } progress; - - thr_lock_type update_lock_default; - Delayed_insert *di; - - /* <> 0 if we are inside of trigger or stored function. */ - uint in_sub_stmt; - /* True when opt_userstat_running is set at start of query */ - bool userstat_running; - /* - True if we have to log all errors. Are set by some engines to temporary - force errors to the error log. - */ - bool log_all_errors; - - /* Do not set socket timeouts for wait_timeout (used with threadpool) */ - bool skip_wait_timeout; - - bool prepare_derived_at_open; - - /* Set to 1 if status of this THD is already in global status */ - bool status_in_global; - - /* - To signal that the tmp table to be created is created for materialized - derived table or a view. - */ - bool create_tmp_table_for_derived; - - bool save_prep_leaf_list; - - /* container for handler's private per-connection data */ - Ha_data ha_data[MAX_HA]; - - /** - Bit field for the state of binlog warnings. - - The first Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types of - unsafeness that the current statement has. - - This must be a member of THD and not of LEX, because warnings are - detected and issued in different places (@c - decide_logging_format() and @c binlog_query(), respectively). - Between these calls, the THD->lex object may change; e.g., if a - stored routine is invoked. Only THD persists between the calls. - */ - uint32 binlog_unsafe_warning_flags; - -#ifndef MYSQL_CLIENT - binlog_cache_mngr * binlog_setup_trx_data(); - - /* - Public interface to write RBR events to the binlog - */ - void binlog_start_trans_and_stmt(); - void binlog_set_stmt_begin(); - int binlog_write_row(TABLE* table, bool is_transactional, - const uchar *buf); - int binlog_delete_row(TABLE* table, bool is_transactional, - const uchar *buf); - int binlog_update_row(TABLE* table, bool is_transactional, - const uchar *old_data, const uchar *new_data); - bool prepare_handlers_for_update(uint flag); - bool binlog_write_annotated_row(Log_event_writer *writer); - void binlog_prepare_for_row_logging(); - bool binlog_write_table_maps(); - bool binlog_write_table_map(TABLE *table, bool with_annotate); - static void binlog_prepare_row_images(TABLE* table); - - void set_server_id(uint32 sid) { variables.server_id = sid; } - - /* - Member functions to handle pending event for row-level logging. - */ - template Rows_log_event* - binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, - size_t needed, - bool is_transactional, - RowsEventT* hint); - Rows_log_event* binlog_get_pending_rows_event(bool is_transactional) const; - void binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional); - inline int binlog_flush_pending_rows_event(bool stmt_end) - { - return (binlog_flush_pending_rows_event(stmt_end, FALSE) || - binlog_flush_pending_rows_event(stmt_end, TRUE)); - } - int binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional); - int binlog_remove_pending_rows_event(bool clear_maps, bool is_transactional); - - /** - Determine the binlog format of the current statement. - - @retval 0 if the current statement will be logged in statement - format. - @retval nonzero if the current statement will be logged in row - format. - */ - int is_current_stmt_binlog_format_row() const { - DBUG_ASSERT(current_stmt_binlog_format == BINLOG_FORMAT_STMT || - current_stmt_binlog_format == BINLOG_FORMAT_ROW); - return current_stmt_binlog_format == BINLOG_FORMAT_ROW; - } - /** - Determine if binlogging is disabled for this session - @retval 0 if the current statement binlogging is disabled - (could be because of binlog closed/binlog option - is set to false). - @retval 1 if the current statement will be binlogged - */ - inline bool is_current_stmt_binlog_disabled() const - { - return (!(variables.option_bits & OPTION_BIN_LOG) || - !mysql_bin_log.is_open()); - } - - enum binlog_filter_state - { - BINLOG_FILTER_UNKNOWN, - BINLOG_FILTER_CLEAR, - BINLOG_FILTER_SET - }; - - inline void reset_binlog_local_stmt_filter() - { - m_binlog_filter_state= BINLOG_FILTER_UNKNOWN; - } - - inline void clear_binlog_local_stmt_filter() - { - DBUG_ASSERT(m_binlog_filter_state == BINLOG_FILTER_UNKNOWN); - m_binlog_filter_state= BINLOG_FILTER_CLEAR; - } - - inline void set_binlog_local_stmt_filter() - { - DBUG_ASSERT(m_binlog_filter_state == BINLOG_FILTER_UNKNOWN); - m_binlog_filter_state= BINLOG_FILTER_SET; - } - - inline binlog_filter_state get_binlog_local_stmt_filter() - { - return m_binlog_filter_state; - } - -private: - /** - Indicate if the current statement should be discarded - instead of written to the binlog. - This is used to discard special statements, such as - DML or DDL that affects only 'local' (non replicated) - tables, such as performance_schema.* - */ - binlog_filter_state m_binlog_filter_state; - - /** - Indicates the format in which the current statement will be - logged. This can only be set from @c decide_logging_format(). - */ - enum_binlog_format current_stmt_binlog_format; - -public: - - /* 1 if binlog table maps has been written */ - bool binlog_table_maps; - - void issue_unsafe_warnings(); - void reset_unsafe_warnings() - { binlog_unsafe_warning_flags= 0; } - - void reset_binlog_for_next_statement() - { - binlog_table_maps= 0; - } - bool binlog_table_should_be_logged(const LEX_CSTRING *db); - -#endif /* MYSQL_CLIENT */ - -public: - - struct st_transactions { - SAVEPOINT *savepoints; - THD_TRANS all; // Trans since BEGIN WORK - THD_TRANS stmt; // Trans for current statement - bool on; // see ha_enable_transaction() - XID_STATE xid_state; - XID implicit_xid; - WT_THD wt; ///< for deadlock detection - Rows_log_event *m_pending_rows_event; - - struct st_trans_time : public timeval - { - void reset(THD *thd) - { - tv_sec= thd->query_start(); - tv_usec= (long) thd->query_start_sec_part(); - } - } start_time; - - /* - Tables changed in transaction (that must be invalidated in query cache). - List contain only transactional tables, that not invalidated in query - cache (instead of full list of changed in transaction tables). - */ - CHANGED_TABLE_LIST* changed_tables; - MEM_ROOT mem_root; // Transaction-life memory allocation pool - void cleanup() - { - DBUG_ENTER("THD::st_transactions::cleanup"); - changed_tables= 0; - savepoints= 0; - implicit_xid.null(); - free_root(&mem_root,MYF(MY_KEEP_PREALLOC)); - DBUG_VOID_RETURN; - } - void free() - { - free_root(&mem_root,MYF(0)); - } - bool is_active() - { - return (all.ha_list != NULL); - } - bool is_empty() - { - return all.is_empty() && stmt.is_empty(); - } - st_transactions() - { - bzero((char*)this, sizeof(*this)); - implicit_xid.null(); - init_sql_alloc(key_memory_thd_transactions, &mem_root, - ALLOC_ROOT_MIN_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC)); - } - } default_transaction, *transaction; - Global_read_lock global_read_lock; - Field *dup_field; -#ifndef __WIN__ - sigset_t signals; -#endif -#ifdef SIGNAL_WITH_VIO_CLOSE - Vio* active_vio; -#endif - - /* - A permanent memory area of the statement. For conventional - execution, the parsed tree and execution runtime reside in the same - memory root. In this case stmt_arena points to THD. In case of - a prepared statement or a stored procedure statement, thd->mem_root - conventionally points to runtime memory, and thd->stmt_arena - points to the memory of the PS/SP, where the parsed tree of the - statement resides. Whenever you need to perform a permanent - transformation of a parsed tree, you should allocate new memory in - stmt_arena, to allow correct re-execution of PS/SP. - Note: in the parser, stmt_arena == thd, even for PS/SP. - */ - Query_arena *stmt_arena; - - void *bulk_param; - - /* - map for tables that will be updated for a multi-table update query - statement, for other query statements, this will be zero. - */ - table_map table_map_for_update; - - /* Tells if LAST_INSERT_ID(#) was called for the current statement */ - bool arg_of_last_insert_id_function; - /* - ALL OVER THIS FILE, "insert_id" means "*automatically generated* value for - insertion into an auto_increment column". - */ - /* - This is the first autogenerated insert id which was *successfully* - inserted by the previous statement (exactly, if the previous statement - didn't successfully insert an autogenerated insert id, then it's the one - of the statement before, etc). - It can also be set by SET LAST_INSERT_ID=# or SELECT LAST_INSERT_ID(#). - It is returned by LAST_INSERT_ID(). - */ - ulonglong first_successful_insert_id_in_prev_stmt; - /* - Variant of the above, used for storing in statement-based binlog. The - difference is that the one above can change as the execution of a stored - function progresses, while the one below is set once and then does not - change (which is the value which statement-based binlog needs). - */ - ulonglong first_successful_insert_id_in_prev_stmt_for_binlog; - /* - This is the first autogenerated insert id which was *successfully* - inserted by the current statement. It is maintained only to set - first_successful_insert_id_in_prev_stmt when statement ends. - */ - ulonglong first_successful_insert_id_in_cur_stmt; - /* - We follow this logic: - - when stmt starts, first_successful_insert_id_in_prev_stmt contains the - first insert id successfully inserted by the previous stmt. - - as stmt makes progress, handler::insert_id_for_cur_row changes; - every time get_auto_increment() is called, - auto_inc_intervals_in_cur_stmt_for_binlog is augmented with the - reserved interval (if statement-based binlogging). - - at first successful insertion of an autogenerated value, - first_successful_insert_id_in_cur_stmt is set to - handler::insert_id_for_cur_row. - - when stmt goes to binlog, - auto_inc_intervals_in_cur_stmt_for_binlog is binlogged if - non-empty. - - when stmt ends, first_successful_insert_id_in_prev_stmt is set to - first_successful_insert_id_in_cur_stmt. - */ - /* - stmt_depends_on_first_successful_insert_id_in_prev_stmt is set when - LAST_INSERT_ID() is used by a statement. - If it is set, first_successful_insert_id_in_prev_stmt_for_binlog will be - stored in the statement-based binlog. - This variable is CUMULATIVE along the execution of a stored function or - trigger: if one substatement sets it to 1 it will stay 1 until the - function/trigger ends, thus making sure that - first_successful_insert_id_in_prev_stmt_for_binlog does not change anymore - and is propagated to the caller for binlogging. - */ - bool stmt_depends_on_first_successful_insert_id_in_prev_stmt; - /* - List of auto_increment intervals reserved by the thread so far, for - storage in the statement-based binlog. - Note that its minimum is not first_successful_insert_id_in_cur_stmt: - assuming a table with an autoinc column, and this happens: - INSERT INTO ... VALUES(3); - SET INSERT_ID=3; INSERT IGNORE ... VALUES (NULL); - then the latter INSERT will insert no rows - (first_successful_insert_id_in_cur_stmt == 0), but storing "INSERT_ID=3" - in the binlog is still needed; the list's minimum will contain 3. - This variable is cumulative: if several statements are written to binlog - as one (stored functions or triggers are used) this list is the - concatenation of all intervals reserved by all statements. - */ - Discrete_intervals_list auto_inc_intervals_in_cur_stmt_for_binlog; - /* Used by replication and SET INSERT_ID */ - Discrete_intervals_list auto_inc_intervals_forced; - /* - There is BUG#19630 where statement-based replication of stored - functions/triggers with two auto_increment columns breaks. - We however ensure that it works when there is 0 or 1 auto_increment - column; our rules are - a) on master, while executing a top statement involving substatements, - first top- or sub- statement to generate auto_increment values wins the - exclusive right to see its values be written to binlog (the write - will be done by the statement or its caller), and the losers won't see - their values be written to binlog. - b) on slave, while replicating a top statement involving substatements, - first top- or sub- statement to need to read auto_increment values from - the master's binlog wins the exclusive right to read them (so the losers - won't read their values from binlog but instead generate on their own). - a) implies that we mustn't backup/restore - auto_inc_intervals_in_cur_stmt_for_binlog. - b) implies that we mustn't backup/restore auto_inc_intervals_forced. - - If there are more than 1 auto_increment columns, then intervals for - different columns may mix into the - auto_inc_intervals_in_cur_stmt_for_binlog list, which is logically wrong, - but there is no point in preventing this mixing by preventing intervals - from the secondly inserted column to come into the list, as such - prevention would be wrong too. - What will happen in the case of - INSERT INTO t1 (auto_inc) VALUES(NULL); - where t1 has a trigger which inserts into an auto_inc column of t2, is - that in binlog we'll store the interval of t1 and the interval of t2 (when - we store intervals, soon), then in slave, t1 will use both intervals, t2 - will use none; if t1 inserts the same number of rows as on master, - normally the 2nd interval will not be used by t1, which is fine. t2's - values will be wrong if t2's internal auto_increment counter is different - from what it was on master (which is likely). In 5.1, in mixed binlogging - mode, row-based binlogging is used for such cases where two - auto_increment columns are inserted. - */ - inline void record_first_successful_insert_id_in_cur_stmt(ulonglong id_arg) - { - if (first_successful_insert_id_in_cur_stmt == 0) - first_successful_insert_id_in_cur_stmt= id_arg; - } - inline ulonglong read_first_successful_insert_id_in_prev_stmt(void) - { - if (!stmt_depends_on_first_successful_insert_id_in_prev_stmt) - { - /* It's the first time we read it */ - first_successful_insert_id_in_prev_stmt_for_binlog= - first_successful_insert_id_in_prev_stmt; - stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1; - } - return first_successful_insert_id_in_prev_stmt; - } - /* - Used by Intvar_log_event::do_apply_event() and by "SET INSERT_ID=#" - (mysqlbinlog). We'll soon add a variant which can take many intervals in - argument. - */ - inline void force_one_auto_inc_interval(ulonglong next_id) - { - auto_inc_intervals_forced.empty(); // in case of multiple SET INSERT_ID - auto_inc_intervals_forced.append(next_id, ULONGLONG_MAX, 0); - } - - ulonglong limit_found_rows; - -private: - /** - Stores the result of ROW_COUNT() function. - - ROW_COUNT() function is a MySQL extention, but we try to keep it - similar to ROW_COUNT member of the GET DIAGNOSTICS stack of the SQL - standard (see SQL99, part 2, search for ROW_COUNT). It's value is - implementation defined for anything except INSERT, DELETE, UPDATE. - - ROW_COUNT is assigned according to the following rules: - - - In my_ok(): - - for DML statements: to the number of affected rows; - - for DDL statements: to 0. - - - In my_eof(): to -1 to indicate that there was a result set. - - We derive this semantics from the JDBC specification, where int - java.sql.Statement.getUpdateCount() is defined to (sic) "return the - current result as an update count; if the result is a ResultSet - object or there are no more results, -1 is returned". - - - In my_error(): to -1 to be compatible with the MySQL C API and - MySQL ODBC driver. - - - For SIGNAL statements: to 0 per WL#2110 specification (see also - sql_signal.cc comment). Zero is used since that's the "default" - value of ROW_COUNT in the diagnostics area. - */ - - longlong m_row_count_func; /* For the ROW_COUNT() function */ - -public: - inline longlong get_row_count_func() const - { - return m_row_count_func; - } - - inline void set_row_count_func(longlong row_count_func) - { - m_row_count_func= row_count_func; - } - inline void set_affected_rows(longlong row_count_func) - { - /* - We have to add to affected_rows (used by slow log), as otherwise - information for 'call' will be wrong - */ - affected_rows+= (row_count_func >= 0 ? row_count_func : 0); - } - - ha_rows cuted_fields; - -private: - /* - number of rows we actually sent to the client, including "synthetic" - rows in ROLLUP etc. - */ - ha_rows m_sent_row_count; - - /** - Number of rows read and/or evaluated for a statement. Used for - slow log reporting. - - An examined row is defined as a row that is read and/or evaluated - according to a statement condition, including in - create_sort_index(). Rows may be counted more than once, e.g., a - statement including ORDER BY could possibly evaluate the row in - filesort() before reading it for e.g. update. - */ - ha_rows m_examined_row_count; - -public: - ha_rows get_sent_row_count() const - { return m_sent_row_count; } - - ha_rows get_examined_row_count() const - { return m_examined_row_count; } - - ulonglong get_affected_rows() const - { return affected_rows; } - - void set_sent_row_count(ha_rows count); - void set_examined_row_count(ha_rows count); - - void inc_sent_row_count(ha_rows count); - void inc_examined_row_count(ha_rows count); - - void inc_status_created_tmp_disk_tables(); - void inc_status_created_tmp_files(); - void inc_status_created_tmp_tables(); - void inc_status_select_full_join(); - void inc_status_select_full_range_join(); - void inc_status_select_range(); - void inc_status_select_range_check(); - void inc_status_select_scan(); - void inc_status_sort_merge_passes(); - void inc_status_sort_range(); - void inc_status_sort_rows(ha_rows count); - void inc_status_sort_scan(); - void set_status_no_index_used(); - void set_status_no_good_index_used(); - - /** - The number of rows and/or keys examined by the query, both read, - changed or written. - */ - ulonglong accessed_rows_and_keys; - - /** - Check if the number of rows accessed by a statement exceeded - LIMIT ROWS EXAMINED. If so, signal the query engine to stop execution. - */ - void check_limit_rows_examined() - { - if (++accessed_rows_and_keys > lex->limit_rows_examined_cnt) - set_killed(ABORT_QUERY); - } - - USER_CONN *user_connect; - CHARSET_INFO *db_charset; -#if defined(ENABLED_PROFILING) - PROFILING profiling; -#endif - - /** Current stage progress instrumentation. */ - PSI_stage_progress *m_stage_progress_psi; - /** Current statement digest. */ - sql_digest_state *m_digest; - /** Current statement digest token array. */ - unsigned char *m_token_array; - /** Top level statement digest. */ - sql_digest_state m_digest_state; - - /** Current statement instrumentation. */ - PSI_statement_locker *m_statement_psi; -#ifdef HAVE_PSI_STATEMENT_INTERFACE - /** Current statement instrumentation state. */ - PSI_statement_locker_state m_statement_state; -#endif /* HAVE_PSI_STATEMENT_INTERFACE */ - - /** Current transaction instrumentation. */ - PSI_transaction_locker *m_transaction_psi; -#ifdef HAVE_PSI_TRANSACTION_INTERFACE - /** Current transaction instrumentation state. */ - PSI_transaction_locker_state m_transaction_state; -#endif /* HAVE_PSI_TRANSACTION_INTERFACE */ - - /** Idle instrumentation. */ - PSI_idle_locker *m_idle_psi; -#ifdef HAVE_PSI_IDLE_INTERFACE - /** Idle instrumentation state. */ - PSI_idle_locker_state m_idle_state; -#endif /* HAVE_PSI_IDLE_INTERFACE */ - - /* - Id of current query. Statement can be reused to execute several queries - query_id is global in context of the whole MySQL server. - ID is automatically generated from mutex-protected counter. - It's used in handler code for various purposes: to check which columns - from table are necessary for this select, to check if it's necessary to - update auto-updatable fields (like auto_increment and timestamp). - */ - query_id_t query_id; - privilege_t col_access; - - /* Statement id is thread-wide. This counter is used to generate ids */ - ulong statement_id_counter; - ulong rand_saved_seed1, rand_saved_seed2; - - /* The following variables are used when printing to slow log */ - ulong query_plan_flags; - ulong query_plan_fsort_passes; - ulong tmp_tables_used; - ulong tmp_tables_disk_used; - ulonglong tmp_tables_size; - ulonglong bytes_sent_old; - ulonglong affected_rows; /* Number of changed rows */ - - Opt_trace_context opt_trace; - pthread_t real_id; /* For debugging */ - my_thread_id thread_id, thread_dbug_id; - uint32 os_thread_id; - uint tmp_table, global_disable_checkpoint; - uint server_status,open_options; - enum enum_thread_type system_thread; - enum backup_stages current_backup_stage; - /* - Current or next transaction isolation level. - When a connection is established, the value is taken from - @@session.tx_isolation (default transaction isolation for - the session), which is in turn taken from @@global.tx_isolation - (the global value). - If there is no transaction started, this variable - holds the value of the next transaction's isolation level. - When a transaction starts, the value stored in this variable - becomes "actual". - At transaction commit or rollback, we assign this variable - again from @@session.tx_isolation. - The only statement that can otherwise change the value - of this variable is SET TRANSACTION ISOLATION LEVEL. - Its purpose is to effect the isolation level of the next - transaction in this session. When this statement is executed, - the value in this variable is changed. However, since - this statement is only allowed when there is no active - transaction, this assignment (naturally) only affects the - upcoming transaction. - At the end of the current active transaction the value is - be reset again from @@session.tx_isolation, as described - above. - */ - enum_tx_isolation tx_isolation; - /* - Current or next transaction access mode. - See comment above regarding tx_isolation. - */ - bool tx_read_only; - enum_check_fields count_cuted_fields; - - DYNAMIC_ARRAY user_var_events; /* For user variables replication */ - MEM_ROOT *user_var_events_alloc; /* Allocate above array elements here */ - - /* - Define durability properties that engines may check to - improve performance. Not yet used in MariaDB - */ - enum durability_properties durability_property; - - /* - If checking this in conjunction with a wait condition, please - include a check after enter_cond() if you want to avoid a race - condition. For details see the implementation of awake(), - especially the "broadcast" part. - */ - killed_state volatile killed; - - /* - The following is used if one wants to have a specific error number and - text for the kill - */ - struct err_info - { - int no; - const char msg[256]; - } *killed_err; - - /* See also thd_killed() */ - inline bool check_killed(bool dont_send_error_message= 0) - { - if (unlikely(killed)) - { - if (!dont_send_error_message) - send_kill_message(); - return TRUE; - } - if (apc_target.have_apc_requests()) - apc_target.process_apc_requests(); - return FALSE; - } - - /* scramble - random string sent to client on handshake */ - char scramble[SCRAMBLE_LENGTH+1]; - - /* - If this is a slave, the name of the connection stored here. - This is used for taging error messages in the log files. - */ - LEX_CSTRING connection_name; - char default_master_connection_buff[MAX_CONNECTION_NAME+1]; - uint8 password; /* 0, 1 or 2 */ - uint8 failed_com_change_user; - bool slave_thread; - bool no_errors; - - /** - Set to TRUE if execution of the current compound statement - can not continue. In particular, disables activation of - CONTINUE or EXIT handlers of stored routines. - Reset in the end of processing of the current user request, in - @see THD::reset_for_next_command(). - */ - bool is_fatal_error; - /** - Set by a storage engine to request the entire - transaction (that possibly spans multiple engines) to - rollback. Reset in ha_rollback. - */ - bool transaction_rollback_request; - /** - TRUE if we are in a sub-statement and the current error can - not be safely recovered until we left the sub-statement mode. - In particular, disables activation of CONTINUE and EXIT - handlers inside sub-statements. E.g. if it is a deadlock - error and requires a transaction-wide rollback, this flag is - raised (traditionally, MySQL first has to close all the reads - via @see handler::ha_index_or_rnd_end() and only then perform - the rollback). - Reset to FALSE when we leave the sub-statement mode. - */ - bool is_fatal_sub_stmt_error; - bool rand_used, time_zone_used; - bool query_start_sec_part_used; - /* for IS NULL => = last_insert_id() fix in remove_eq_conds() */ - bool substitute_null_with_insert_id; - bool in_lock_tables; - bool bootstrap, cleanup_done, free_connection_done; - - /** is set if some thread specific value(s) used in a statement. */ - bool thread_specific_used; - /** - is set if a statement accesses a temporary table created through - CREATE TEMPORARY TABLE. - */ -private: - bool charset_is_system_charset, charset_is_collation_connection; - bool charset_is_character_set_filesystem; -public: - bool enable_slow_log; /* Enable slow log for current statement */ - bool abort_on_warning; - bool got_warning; /* Set on call to push_warning() */ - /* set during loop of derived table processing */ - bool derived_tables_processing; - bool tablespace_op; /* This is TRUE in DISCARD/IMPORT TABLESPACE */ - /* True if we have to log the current statement */ - bool log_current_statement; - /** - True if a slave error. Causes the slave to stop. Not the same - as the statement execution error (is_error()), since - a statement may be expected to return an error, e.g. because - it returned an error on master, and this is OK on the slave. - */ - bool is_slave_error; - /* True if we have printed something to the error log for this statement */ - bool error_printed_to_log; - - /* - True when a transaction is queued up for binlog group commit. - Used so that if another transaction needs to wait for a row lock held by - this transaction, it can signal to trigger the group commit immediately, - skipping the normal --binlog-commit-wait-count wait. - */ - bool waiting_on_group_commit; - /* - Set true when another transaction goes to wait on a row lock held by this - transaction. Used together with waiting_on_group_commit. - */ - bool has_waiter; - /* - In case of a slave, set to the error code the master got when executing - the query. 0 if no error on the master. - */ - int slave_expected_error; - enum_sql_command last_sql_command; // Last sql_command exceuted in mysql_execute_command() - - sp_rcontext *spcont; // SP runtime context - sp_cache *sp_proc_cache; - sp_cache *sp_func_cache; - sp_cache *sp_package_spec_cache; - sp_cache *sp_package_body_cache; - - /** number of name_const() substitutions, see sp_head.cc:subst_spvars() */ - uint query_name_consts; - - NET* slave_net; // network connection from slave -> m. - - /* - Used to update global user stats. The global user stats are updated - occasionally with the 'diff' variables. After the update, the 'diff' - variables are reset to 0. - */ - /* Time when the current thread connected to MySQL. */ - time_t current_connect_time; - /* Last time when THD stats were updated in global_user_stats. */ - time_t last_global_update_time; - /* Number of commands not reflected in global_user_stats yet. */ - uint select_commands, update_commands, other_commands; - ulonglong start_cpu_time; - ulonglong start_bytes_received; - - /* Used by the sys_var class to store temporary values */ - union - { - my_bool my_bool_value; - int int_value; - uint uint_value; - long long_value; - ulong ulong_value; - ulonglong ulonglong_value; - double double_value; - void *ptr_value; - } sys_var_tmp; - - struct { - /* - If true, mysql_bin_log::write(Log_event) call will not write events to - binlog, and maintain 2 below variables instead (use - mysql_bin_log.start_union_events to turn this on) - */ - bool do_union; - /* - If TRUE, at least one mysql_bin_log::write(Log_event) call has been - made after last mysql_bin_log.start_union_events() call. - */ - bool unioned_events; - /* - If TRUE, at least one mysql_bin_log::write(Log_event e), where - e.cache_stmt == TRUE call has been made after last - mysql_bin_log.start_union_events() call. - */ - bool unioned_events_trans; - /* - 'queries' (actually SP statements) that run under inside this binlog - union have thd->query_id >= first_query_id. - */ - query_id_t first_query_id; - } binlog_evt_union; - - /** - Internal parser state. - Note that since the parser is not re-entrant, we keep only one parser - state here. This member is valid only when executing code during parsing. - */ - Parser_state *m_parser_state; - - Locked_tables_list locked_tables_list; - -#ifdef WITH_PARTITION_STORAGE_ENGINE - partition_info *work_part_info; -#endif - -#ifndef EMBEDDED_LIBRARY - /** - Array of active audit plugins which have been used by this THD. - This list is later iterated to invoke release_thd() on those - plugins. - */ - DYNAMIC_ARRAY audit_class_plugins; - /** - Array of bits indicating which audit classes have already been - added to the list of audit plugins which are currently in use. - */ - unsigned long audit_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE]; - int audit_plugin_version; -#endif - -#if defined(ENABLED_DEBUG_SYNC) - /* Debug Sync facility. See debug_sync.cc. */ - struct st_debug_sync_control *debug_sync_control; -#endif /* defined(ENABLED_DEBUG_SYNC) */ - /** - @param id thread identifier - @param is_wsrep_applier thread type - */ - THD(my_thread_id id, bool is_wsrep_applier= false); - - ~THD(); - - void init(); - /* - Initialize memory roots necessary for query processing and (!) - pre-allocate memory for it. We can't do that in THD constructor because - there are use cases (acl_init, delayed inserts, watcher threads, - killing mysqld) where it's vital to not allocate excessive and not used - memory. Note, that we still don't return error from init_for_queries(): - if preallocation fails, we should notice that at the first call to - alloc_root. - */ - void init_for_queries(); - void update_all_stats(); - void update_stats(void); - void change_user(void); - void cleanup(void); - void cleanup_after_query(); - void free_connection(); - void reset_for_reuse(); - void store_globals(); - void reset_globals(); - bool trace_started() - { - return opt_trace.is_started(); - } -#ifdef SIGNAL_WITH_VIO_CLOSE - inline void set_active_vio(Vio* vio) - { - mysql_mutex_lock(&LOCK_thd_data); - active_vio = vio; - mysql_mutex_unlock(&LOCK_thd_data); - } - inline void clear_active_vio() - { - mysql_mutex_lock(&LOCK_thd_data); - active_vio = 0; - mysql_mutex_unlock(&LOCK_thd_data); - } - void close_active_vio(); -#endif - void awake_no_mutex(killed_state state_to_set); - void awake(killed_state state_to_set) - { - bool wsrep_on_local= WSREP_NNULL(this); - /* - mutex locking order (LOCK_thd_data - LOCK_thd_kill)) requires - to grab LOCK_thd_data here - */ - if (wsrep_on_local) - mysql_mutex_lock(&LOCK_thd_data); - mysql_mutex_lock(&LOCK_thd_kill); - awake_no_mutex(state_to_set); - mysql_mutex_unlock(&LOCK_thd_kill); - if (wsrep_on_local) - mysql_mutex_unlock(&LOCK_thd_data); - } - - /** Disconnect the associated communication endpoint. */ - void disconnect(); - - - /* - Allows this thread to serve as a target for others to schedule Async - Procedure Calls on. - - It's possible to schedule any code to be executed this way, by - inheriting from the Apc_call object. Currently, only - Show_explain_request uses this. - */ - Apc_target apc_target; - - Gap_time_tracker_data gap_tracker_data; -#ifndef MYSQL_CLIENT - enum enum_binlog_query_type { - /* The query can be logged in row format or in statement format. */ - ROW_QUERY_TYPE, - - /* The query has to be logged in statement format. */ - STMT_QUERY_TYPE, - - QUERY_TYPE_COUNT - }; - - int binlog_query(enum_binlog_query_type qtype, - char const *query, ulong query_len, bool is_trans, - bool direct, bool suppress_use, - int errcode); - bool binlog_current_query_unfiltered(); -#endif - - inline void - enter_cond(mysql_cond_t *cond, mysql_mutex_t* mutex, - const PSI_stage_info *stage, PSI_stage_info *old_stage, - const char *src_function, const char *src_file, - int src_line) - { - mysql_mutex_assert_owner(mutex); - mysys_var->current_mutex = mutex; - mysys_var->current_cond = cond; - if (old_stage) - backup_stage(old_stage); - if (stage) - enter_stage(stage, src_function, src_file, src_line); - } - inline void exit_cond(const PSI_stage_info *stage, - const char *src_function, const char *src_file, - int src_line) - { - /* - Putting the mutex unlock in thd->exit_cond() ensures that - mysys_var->current_mutex is always unlocked _before_ mysys_var->mutex is - locked (if that would not be the case, you'll get a deadlock if someone - does a THD::awake() on you). - */ - mysql_mutex_unlock(mysys_var->current_mutex); - mysql_mutex_lock(&mysys_var->mutex); - mysys_var->current_mutex = 0; - mysys_var->current_cond = 0; - if (stage) - enter_stage(stage, src_function, src_file, src_line); - mysql_mutex_unlock(&mysys_var->mutex); - return; - } - virtual int is_killed() { return killed; } - virtual THD* get_thd() { return this; } - - /** - A callback to the server internals that is used to address - special cases of the locking protocol. - Invoked when acquiring an exclusive lock, for each thread that - has a conflicting shared metadata lock. - - This function: - - aborts waiting of the thread on a data lock, to make it notice - the pending exclusive lock and back off. - - if the thread is an INSERT DELAYED thread, sends it a KILL - signal to terminate it. - - @note This function does not wait for the thread to give away its - locks. Waiting is done outside for all threads at once. - - @param ctx_in_use The MDL context owner (thread) to wake up. - @param needs_thr_lock_abort Indicates that to wake up thread - this call needs to abort its waiting - on table-level lock. - - @retval TRUE if the thread was woken up - @retval FALSE otherwise. - */ - virtual bool notify_shared_lock(MDL_context_owner *ctx_in_use, - bool needs_thr_lock_abort); - - // End implementation of MDL_context_owner interface. - - inline bool is_strict_mode() const - { - return (bool) (variables.sql_mode & (MODE_STRICT_TRANS_TABLES | - MODE_STRICT_ALL_TABLES)); - } - inline bool backslash_escapes() const - { - return !MY_TEST(variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES); - } - const Type_handler *type_handler_for_datetime() const; - bool timestamp_to_TIME(MYSQL_TIME *ltime, my_time_t ts, - ulong sec_part, date_mode_t fuzzydate); - inline my_time_t query_start() { return start_time; } - inline ulong query_start_sec_part() - { query_start_sec_part_used=1; return start_time_sec_part; } - MYSQL_TIME query_start_TIME(); - time_round_mode_t temporal_round_mode() const - { - return variables.sql_mode & MODE_TIME_ROUND_FRACTIONAL ? - TIME_FRAC_ROUND : TIME_FRAC_TRUNCATE; - } - -private: - struct { - my_hrtime_t start; - my_time_t sec; - ulong sec_part; - } system_time; - - void set_system_time() - { - my_hrtime_t hrtime= my_hrtime(); - my_time_t sec= hrtime_to_my_time(hrtime); - ulong sec_part= hrtime_sec_part(hrtime); - if (sec > system_time.sec || - (sec == system_time.sec && sec_part > system_time.sec_part) || - hrtime.val < system_time.start.val) - { - system_time.sec= sec; - system_time.sec_part= sec_part; - system_time.start= hrtime; - } - else - { - if (system_time.sec_part < TIME_MAX_SECOND_PART) - system_time.sec_part++; - else - { - system_time.sec++; - system_time.sec_part= 0; - } - } - } - -public: - timeval transaction_time() - { - if (!in_multi_stmt_transaction_mode()) - transaction->start_time.reset(this); - return transaction->start_time; - } - - inline void set_start_time() - { - if (user_time.val) - { - start_time= hrtime_to_my_time(user_time); - start_time_sec_part= hrtime_sec_part(user_time); - } - else - { - set_system_time(); - start_time= system_time.sec; - start_time_sec_part= system_time.sec_part; - } - PSI_CALL_set_thread_start_time(start_time); - } - inline void set_time() - { - set_start_time(); - start_utime= utime_after_lock= microsecond_interval_timer(); - } - /* only used in SET @@timestamp=... */ - inline void set_time(my_hrtime_t t) - { - user_time= t; - set_time(); - } - /* - this is only used by replication and BINLOG command. - usecs > TIME_MAX_SECOND_PART means "was not in binlog" - */ - inline void set_time(my_time_t t, ulong sec_part) - { - if (opt_secure_timestamp > (slave_thread ? SECTIME_REPL : SECTIME_SUPER)) - set_time(); // note that BINLOG itself requires SUPER - else - { - if (sec_part <= TIME_MAX_SECOND_PART) - { - start_time= system_time.sec= t; - start_time_sec_part= system_time.sec_part= sec_part; - } - else if (t != system_time.sec) - { - start_time= system_time.sec= t; - start_time_sec_part= system_time.sec_part= 0; - } - else - { - start_time= t; - start_time_sec_part= ++system_time.sec_part; - } - user_time.val= hrtime_from_time(start_time) + start_time_sec_part; - PSI_CALL_set_thread_start_time(start_time); - start_utime= utime_after_lock= microsecond_interval_timer(); - } - } - void set_time_after_lock() - { - utime_after_lock= microsecond_interval_timer(); - MYSQL_SET_STATEMENT_LOCK_TIME(m_statement_psi, - (utime_after_lock - start_utime)); - } - ulonglong current_utime() { return microsecond_interval_timer(); } - - /* Tell SHOW PROCESSLIST to show time from this point */ - inline void set_time_for_next_stage() - { - utime_after_query= current_utime(); - } - - /** - Update server status after execution of a top level statement. - Currently only checks if a query was slow, and assigns - the status accordingly. - Evaluate the current time, and if it exceeds the long-query-time - setting, mark the query as slow. - */ - void update_server_status() - { - set_time_for_next_stage(); - if (utime_after_query >= utime_after_lock + variables.long_query_time) - server_status|= SERVER_QUERY_WAS_SLOW; - } - inline ulonglong found_rows(void) - { - return limit_found_rows; - } - /** - Returns TRUE if session is in a multi-statement transaction mode. - - OPTION_NOT_AUTOCOMMIT: When autocommit is off, a multi-statement - transaction is implicitly started on the first statement after a - previous transaction has been ended. - - OPTION_BEGIN: Regardless of the autocommit status, a multi-statement - transaction can be explicitly started with the statements "START - TRANSACTION", "BEGIN [WORK]", "[COMMIT | ROLLBACK] AND CHAIN", etc. - - Note: this doesn't tell you whether a transaction is active. - A session can be in multi-statement transaction mode, and yet - have no active transaction, e.g., in case of: - set @@autocommit=0; - set @a= 3; <-- these statements don't - set transaction isolation level serializable; <-- start an active - flush tables; <-- transaction - - I.e. for the above scenario this function returns TRUE, even - though no active transaction has begun. - @sa in_active_multi_stmt_transaction() - */ - inline bool in_multi_stmt_transaction_mode() - { - return variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN); - } - /** - TRUE if the session is in a multi-statement transaction mode - (@sa in_multi_stmt_transaction_mode()) *and* there is an - active transaction, i.e. there is an explicit start of a - transaction with BEGIN statement, or implicit with a - statement that uses a transactional engine. - - For example, these scenarios don't start an active transaction - (even though the server is in multi-statement transaction mode): - - set @@autocommit=0; - select * from nontrans_table; - set @var=TRUE; - flush tables; - - Note, that even for a statement that starts a multi-statement - transaction (i.e. select * from trans_table), this - flag won't be set until we open the statement's tables - and the engines register themselves for the transaction - (see trans_register_ha()), - hence this method is reliable to use only after - open_tables() has completed. - - Why do we need a flag? - ---------------------- - We need to maintain a (at first glance redundant) - session flag, rather than looking at thd->transaction.all.ha_list - because of explicit start of a transaction with BEGIN. - - I.e. in case of - BEGIN; - select * from nontrans_t1; <-- in_active_multi_stmt_transaction() is true - */ - inline bool in_active_multi_stmt_transaction() - { - return server_status & SERVER_STATUS_IN_TRANS; - } - /* Commit both statement and full transaction */ - int commit_whole_transaction_and_close_tables(); - void give_protection_error(); - /* - Give an error if any of the following is true for this connection - - BACKUP STAGE is active - - FLUSH TABLE WITH READ LOCK is active - - BACKUP LOCK table_name is active - */ - inline bool has_read_only_protection() - { - if (current_backup_stage == BACKUP_FINISHED && - !global_read_lock.is_acquired() && - !mdl_backup_lock) - return FALSE; - give_protection_error(); - return TRUE; - } - inline bool fill_derived_tables() - { - return !stmt_arena->is_stmt_prepare() && !lex->only_view_structure(); - } - inline bool fill_information_schema_tables() - { - return !stmt_arena->is_stmt_prepare(); - } - inline void* trans_alloc(size_t size) - { - return alloc_root(&transaction->mem_root,size); - } - - LEX_CSTRING strmake_lex_cstring(const char *str, size_t length) - { - const char *tmp= strmake_root(mem_root, str, length); - if (!tmp) - return {0,0}; - return {tmp, length}; - } - LEX_CSTRING strmake_lex_cstring(const LEX_CSTRING &from) - { - return strmake_lex_cstring(from.str, from.length); - } - - LEX_STRING *make_lex_string(LEX_STRING *lex_str, const char* str, size_t length) - { - if (!(lex_str->str= strmake_root(mem_root, str, length))) - { - lex_str->length= 0; - return 0; - } - lex_str->length= length; - return lex_str; - } - LEX_CSTRING *make_lex_string(LEX_CSTRING *lex_str, const char* str, size_t length) - { - if (!(lex_str->str= strmake_root(mem_root, str, length))) - { - lex_str->length= 0; - return 0; - } - lex_str->length= length; - return lex_str; - } - // Remove double quotes: aaa""bbb -> aaa"bbb - bool quote_unescape(LEX_CSTRING *dst, const LEX_CSTRING *src, char quote) - { - const char *tmp= src->str; - const char *tmpend= src->str + src->length; - char *to; - if (!(dst->str= to= (char *) alloc(src->length + 1))) - { - dst->length= 0; // Safety - return true; - } - for ( ; tmp < tmpend; ) - { - if ((*to++= *tmp++) == quote) - tmp++; // Skip double quotes - } - *to= 0; // End null for safety - dst->length= to - dst->str; - return false; - } - - LEX_CSTRING *make_clex_string(const char* str, size_t length) - { - LEX_CSTRING *lex_str; - char *tmp; - if (unlikely(!(lex_str= (LEX_CSTRING *)alloc_root(mem_root, - sizeof(LEX_CSTRING) + - length+1)))) - return 0; - tmp= (char*) (lex_str+1); - lex_str->str= tmp; - memcpy(tmp, str, length); - tmp[length]= 0; - lex_str->length= length; - return lex_str; - } - LEX_CSTRING *make_clex_string(const LEX_CSTRING from) - { - return make_clex_string(from.str, from.length); - } - - // Allocate LEX_STRING for character set conversion - bool alloc_lex_string(LEX_STRING *dst, size_t length) - { - if (likely((dst->str= (char*) alloc(length)))) - return false; - dst->length= 0; // Safety - return true; // EOM - } - bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs, - const char *from, size_t from_length, - CHARSET_INFO *from_cs); - bool convert_string(LEX_CSTRING *to, CHARSET_INFO *to_cs, - const char *from, size_t from_length, - CHARSET_INFO *from_cs) - { - LEX_STRING tmp; - bool rc= convert_string(&tmp, to_cs, from, from_length, from_cs); - to->str= tmp.str; - to->length= tmp.length; - return rc; - } - bool convert_string(LEX_CSTRING *to, CHARSET_INFO *tocs, - const LEX_CSTRING *from, CHARSET_INFO *fromcs, - bool simple_copy_is_possible) - { - if (!simple_copy_is_possible) - return unlikely(convert_string(to, tocs, from->str, from->length, fromcs)); - *to= *from; - return false; - } - /* - Convert a strings between character sets. - Uses my_convert_fix(), which uses an mb_wc .. mc_mb loop internally. - dstcs and srccs cannot be &my_charset_bin. - */ - bool convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst, - CHARSET_INFO *srccs, const char *src, size_t src_length, - String_copier *status); - - /* - Same as above, but additionally sends ER_INVALID_CHARACTER_STRING - in case of bad byte sequences or Unicode conversion problems. - */ - bool convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst, - CHARSET_INFO *srccs, - const char *src, size_t src_length); - /* - If either "dstcs" or "srccs" is &my_charset_bin, - then performs native copying using copy_fix(). - Otherwise, performs Unicode conversion using convert_fix(). - */ - bool copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst, - CHARSET_INFO *srccs, const char *src, size_t src_length, - String_copier *status); - - /* - Same as above, but additionally sends ER_INVALID_CHARACTER_STRING - in case of bad byte sequences or Unicode conversion problems. - */ - bool copy_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst, - CHARSET_INFO *srccs, const char *src, size_t src_length); - - bool convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs); - - /* - Check if the string is wellformed, raise an error if not wellformed. - @param str - The string to check. - @param length - the string length. - */ - bool check_string_for_wellformedness(const char *str, - size_t length, - CHARSET_INFO *cs) const; - - bool to_ident_sys_alloc(Lex_ident_sys_st *to, const Lex_ident_cli_st *from); - - /* - Create a string literal with optional client->connection conversion. - @param str - the string in the client character set - @param length - length of the string - @param repertoire - the repertoire of the string - */ - Item_basic_constant *make_string_literal(const char *str, size_t length, - my_repertoire_t repertoire); - Item_basic_constant *make_string_literal(const Lex_string_with_metadata_st &str) - { - my_repertoire_t repertoire= str.repertoire(variables.character_set_client); - return make_string_literal(str.str, str.length, repertoire); - } - Item_basic_constant *make_string_literal_nchar(const Lex_string_with_metadata_st &str); - Item_basic_constant *make_string_literal_charset(const Lex_string_with_metadata_st &str, - CHARSET_INFO *cs); - bool make_text_string_sys(LEX_CSTRING *to, - const Lex_string_with_metadata_st *from) - { - return convert_string(to, system_charset_info, - from, charset(), charset_is_system_charset); - } - bool make_text_string_connection(LEX_CSTRING *to, - const Lex_string_with_metadata_st *from) - { - return convert_string(to, variables.collation_connection, - from, charset(), charset_is_collation_connection); - } - bool make_text_string_filesystem(LEX_CSTRING *to, - const Lex_string_with_metadata_st *from) - { - return convert_string(to, variables.character_set_filesystem, - from, charset(), charset_is_character_set_filesystem); - } - void add_changed_table(TABLE *table); - void add_changed_table(const char *key, size_t key_length); - CHANGED_TABLE_LIST * changed_table_dup(const char *key, size_t key_length); - int prepare_explain_fields(select_result *result, List *field_list, - uint8 explain_flags, bool is_analyze); - int send_explain_fields(select_result *result, uint8 explain_flags, - bool is_analyze); - void make_explain_field_list(List &field_list, uint8 explain_flags, - bool is_analyze); - void make_explain_json_field_list(List &field_list, bool is_analyze); - - /** - Clear the current error, if any. - We do not clear is_fatal_error or is_fatal_sub_stmt_error since we - assume this is never called if the fatal error is set. - - @todo: To silence an error, one should use Internal_error_handler - mechanism. Issuing an error that can be possibly later "cleared" is not - compatible with other installed error handlers and audit plugins. - */ - inline void clear_error(bool clear_diagnostics= 0) - { - DBUG_ENTER("clear_error"); - if (get_stmt_da()->is_error() || clear_diagnostics) - get_stmt_da()->reset_diagnostics_area(); - is_slave_error= 0; - if (killed == KILL_BAD_DATA) - reset_killed(); - DBUG_VOID_RETURN; - } - -#ifndef EMBEDDED_LIBRARY - inline bool vio_ok() const { return net.vio != 0; } - /** Return FALSE if connection to client is broken. */ - bool is_connected() - { - /* - All system threads (e.g., the slave IO thread) are connected but - not using vio. So this function always returns true for all - system threads. - */ - return system_thread || (vio_ok() ? vio_is_connected(net.vio) : FALSE); - } -#else - inline bool vio_ok() const { return TRUE; } - inline bool is_connected() { return TRUE; } -#endif - /** - Mark the current error as fatal. Warning: this does not - set any error, it sets a property of the error, so must be - followed or prefixed with my_error(). - */ - inline void fatal_error() - { - DBUG_ASSERT(get_stmt_da()->is_error() || killed); - is_fatal_error= 1; - DBUG_PRINT("error",("Fatal error set")); - } - /** - TRUE if there is an error in the error stack. - - Please use this method instead of direct access to - net.report_error. - - If TRUE, the current (sub)-statement should be aborted. - The main difference between this member and is_fatal_error - is that a fatal error can not be handled by a stored - procedure continue handler, whereas a normal error can. - - To raise this flag, use my_error(). - */ - inline bool is_error() const { return m_stmt_da->is_error(); } - void set_bulk_execution(void *bulk) - { - bulk_param= bulk; - m_stmt_da->set_bulk_execution(MY_TEST(bulk)); - } - bool is_bulk_op() const { return MY_TEST(bulk_param); } - - /// Returns Diagnostics-area for the current statement. - Diagnostics_area *get_stmt_da() - { return m_stmt_da; } - - /// Returns Diagnostics-area for the current statement. - const Diagnostics_area *get_stmt_da() const - { return m_stmt_da; } - - /// Sets Diagnostics-area for the current statement. - void set_stmt_da(Diagnostics_area *da) - { m_stmt_da= da; } - - inline CHARSET_INFO *charset() const { return variables.character_set_client; } - void update_charset(); - void update_charset(CHARSET_INFO *character_set_client, - CHARSET_INFO *collation_connection) - { - variables.character_set_client= character_set_client; - variables.collation_connection= collation_connection; - update_charset(); - } - void update_charset(CHARSET_INFO *character_set_client, - CHARSET_INFO *collation_connection, - CHARSET_INFO *character_set_results) - { - variables.character_set_client= character_set_client; - variables.collation_connection= collation_connection; - variables.character_set_results= character_set_results; - update_charset(); - } - - inline Query_arena *activate_stmt_arena_if_needed(Query_arena *backup) - { - /* - Use the persistent arena if we are in a prepared statement or a stored - procedure statement and we have not already changed to use this arena. - */ - if (!stmt_arena->is_conventional() && mem_root != stmt_arena->mem_root) - { - set_n_backup_active_arena(stmt_arena, backup); - return stmt_arena; - } - return 0; - } - - - bool is_item_tree_change_register_required() - { - return !stmt_arena->is_conventional() - || stmt_arena->type() == Query_arena::TABLE_ARENA; - } - - void change_item_tree(Item **place, Item *new_value) - { - DBUG_ENTER("THD::change_item_tree"); - DBUG_PRINT("enter", ("Register: %p (%p) <- %p", - *place, place, new_value)); - /* TODO: check for OOM condition here */ - if (is_item_tree_change_register_required()) - nocheck_register_item_tree_change(place, *place, mem_root); - *place= new_value; - DBUG_VOID_RETURN; - } - /** - Make change in item tree after checking whether it needs registering - - - @param place place where we should assign new value - @param new_value place of the new value - - @details - see check_and_register_item_tree_change details - */ - void check_and_register_item_tree(Item **place, Item **new_value) - { - if (!stmt_arena->is_conventional()) - check_and_register_item_tree_change(place, new_value, mem_root); - /* - We have to use memcpy instead of *place= *new_value merge to - avoid problems with strict aliasing. - */ - memcpy((char*) place, new_value, sizeof(*new_value)); - } - - /* - Cleanup statement parse state (parse tree, lex) and execution - state after execution of a non-prepared SQL statement. - */ - void end_statement(); - - /* - Mark thread to be killed, with optional error number and string. - string is not released, so it has to be allocted on thd mem_root - or be a global string - - Ensure that we don't replace a kill with a lesser one. For example - if user has done 'kill_connection' we shouldn't replace it with - KILL_QUERY. - */ - inline void set_killed(killed_state killed_arg, - int killed_errno_arg= 0, - const char *killed_err_msg_arg= 0) - { - mysql_mutex_lock(&LOCK_thd_kill); - set_killed_no_mutex(killed_arg, killed_errno_arg, killed_err_msg_arg); - mysql_mutex_unlock(&LOCK_thd_kill); - } - /* - This is only used by THD::awake where we need to keep the lock mutex - locked over some time. - It's ok to have this inline, as in most cases killed_errno_arg will - be a constant 0 and most of the function will disappear. - */ - inline void set_killed_no_mutex(killed_state killed_arg, - int killed_errno_arg= 0, - const char *killed_err_msg_arg= 0) - { - if (killed <= killed_arg) - { - killed= killed_arg; - if (killed_errno_arg) - { - /* - If alloc fails, we only remember the killed flag. - The worst things that can happen is that we get - a suboptimal error message. - */ - killed_err= (err_info*) alloc_root(&main_mem_root, sizeof(*killed_err)); - if (likely(killed_err)) - { - killed_err->no= killed_errno_arg; - ::strmake((char*) killed_err->msg, killed_err_msg_arg, - sizeof(killed_err->msg)-1); - } - } - } - } - int killed_errno(); - void reset_killed(); - inline void reset_kill_query() - { - if (killed < KILL_CONNECTION) - { - reset_killed(); - mysys_var->abort= 0; - } - } - inline void send_kill_message() - { - mysql_mutex_lock(&LOCK_thd_kill); - int err= killed_errno(); - if (err) - my_message(err, killed_err ? killed_err->msg : ER_THD(this, err), - MYF(0)); - mysql_mutex_unlock(&LOCK_thd_kill); - } - /* return TRUE if we will abort query if we make a warning now */ - inline bool really_abort_on_warning() - { - return (abort_on_warning && - (!transaction->stmt.modified_non_trans_table || - (variables.sql_mode & MODE_STRICT_ALL_TABLES))); - } - void set_status_var_init(); - void reset_n_backup_open_tables_state(Open_tables_backup *backup); - void restore_backup_open_tables_state(Open_tables_backup *backup); - void reset_sub_statement_state(Sub_statement_state *backup, uint new_state); - void restore_sub_statement_state(Sub_statement_state *backup); - void store_slow_query_state(Sub_statement_state *backup); - void reset_slow_query_state(); - void add_slow_query_state(Sub_statement_state *backup); - void set_n_backup_active_arena(Query_arena *set, Query_arena *backup); - void restore_active_arena(Query_arena *set, Query_arena *backup); - - inline void get_binlog_format(enum_binlog_format *format, - enum_binlog_format *current_format) - { - *format= (enum_binlog_format) variables.binlog_format; - *current_format= current_stmt_binlog_format; - } - inline enum_binlog_format get_current_stmt_binlog_format() - { - return current_stmt_binlog_format; - } - inline void set_binlog_format(enum_binlog_format format, - enum_binlog_format current_format) - { - DBUG_ENTER("set_binlog_format"); - variables.binlog_format= format; - current_stmt_binlog_format= current_format; - DBUG_VOID_RETURN; - } - inline void set_binlog_format_stmt() - { - DBUG_ENTER("set_binlog_format_stmt"); - variables.binlog_format= BINLOG_FORMAT_STMT; - current_stmt_binlog_format= BINLOG_FORMAT_STMT; - DBUG_VOID_RETURN; - } - /* - @todo Make these methods private or remove them completely. Only - decide_logging_format should call them. /Sven - */ - inline void set_current_stmt_binlog_format_row_if_mixed() - { - DBUG_ENTER("set_current_stmt_binlog_format_row_if_mixed"); - /* - This should only be called from decide_logging_format. - - @todo Once we have ensured this, uncomment the following - statement, remove the big comment below that, and remove the - in_sub_stmt==0 condition from the following 'if'. - */ - /* DBUG_ASSERT(in_sub_stmt == 0); */ - /* - If in a stored/function trigger, the caller should already have done the - change. We test in_sub_stmt to prevent introducing bugs where people - wouldn't ensure that, and would switch to row-based mode in the middle - of executing a stored function/trigger (which is too late, see also - reset_current_stmt_binlog_format_row()); this condition will make their - tests fail and so force them to propagate the - lex->binlog_row_based_if_mixed upwards to the caller. - */ - if ((wsrep_binlog_format() == BINLOG_FORMAT_MIXED) && (in_sub_stmt == 0)) - set_current_stmt_binlog_format_row(); - - DBUG_VOID_RETURN; - } - - inline void set_current_stmt_binlog_format(enum_binlog_format format) - { - current_stmt_binlog_format= format; - } - - inline void set_current_stmt_binlog_format_row() - { - DBUG_ENTER("set_current_stmt_binlog_format_row"); - current_stmt_binlog_format= BINLOG_FORMAT_ROW; - DBUG_VOID_RETURN; - } - /* Set binlog format temporarily to statement. Returns old format */ - inline enum_binlog_format set_current_stmt_binlog_format_stmt() - { - enum_binlog_format orig_format= current_stmt_binlog_format; - DBUG_ENTER("set_current_stmt_binlog_format_stmt"); - current_stmt_binlog_format= BINLOG_FORMAT_STMT; - DBUG_RETURN(orig_format); - } - inline void restore_stmt_binlog_format(enum_binlog_format format) - { - DBUG_ENTER("restore_stmt_binlog_format"); - DBUG_ASSERT(!is_current_stmt_binlog_format_row()); - current_stmt_binlog_format= format; - DBUG_VOID_RETURN; - } - inline void reset_current_stmt_binlog_format_row() - { - DBUG_ENTER("reset_current_stmt_binlog_format_row"); - /* - If there are temporary tables, don't reset back to - statement-based. Indeed it could be that: - CREATE TEMPORARY TABLE t SELECT UUID(); # row-based - # and row-based does not store updates to temp tables - # in the binlog. - INSERT INTO u SELECT * FROM t; # stmt-based - and then the INSERT will fail as data inserted into t was not logged. - So we continue with row-based until the temp table is dropped. - If we are in a stored function or trigger, we mustn't reset in the - middle of its execution (as the binary logging way of a stored function - or trigger is decided when it starts executing, depending for example on - the caller (for a stored function: if caller is SELECT or - INSERT/UPDATE/DELETE...). - */ - DBUG_PRINT("debug", - ("temporary_tables: %s, in_sub_stmt: %s, system_thread: %s", - YESNO(has_thd_temporary_tables()), YESNO(in_sub_stmt), - show_system_thread(system_thread))); - if (in_sub_stmt == 0) - { - if (wsrep_binlog_format() == BINLOG_FORMAT_ROW) - set_current_stmt_binlog_format_row(); - else if (!has_thd_temporary_tables()) - set_current_stmt_binlog_format_stmt(); - } - DBUG_VOID_RETURN; - } - - /** - Set the current database; use deep copy of C-string. - - @param new_db a pointer to the new database name. - @param new_db_len length of the new database name. - - Initialize the current database from a NULL-terminated string with - length. If we run out of memory, we free the current database and - return TRUE. This way the user will notice the error as there will be - no current database selected (in addition to the error message set by - malloc). - - @note This operation just sets {db, db_length}. Switching the current - database usually involves other actions, like switching other database - attributes including security context. In the future, this operation - will be made private and more convenient interface will be provided. - - @return Operation status - @retval FALSE Success - @retval TRUE Out-of-memory error - */ - bool set_db(const LEX_CSTRING *new_db); - - /** Set the current database, without copying */ - void reset_db(const LEX_CSTRING *new_db); - - /* - Copy the current database to the argument. Use the current arena to - allocate memory for a deep copy: current database may be freed after - a statement is parsed but before it's executed. - - Can only be called by owner of thd (no mutex protection) - */ - bool copy_db_to(LEX_CSTRING *to) - { - if (db.str == NULL) - { - /* - No default database is set. In this case if it's guaranteed that - no CTE can be used in the statement then we can throw an error right - now at the parser stage. Otherwise the decision about throwing such - a message must be postponed until a post-parser stage when we are able - to resolve all CTE names as we don't need this message to be thrown - for any CTE references. - */ - if (!lex->with_clauses_list) - { - my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); - return TRUE; - } - /* This will allow to throw an error later for non-CTE references */ - to->str= NULL; - to->length= 0; - return FALSE; - } - - to->str= strmake(db.str, db.length); - to->length= db.length; - return to->str == NULL; /* True on error */ - } - /* Get db name or "". Use for printing current db */ - const char *get_db() - { return safe_str(db.str); } - - thd_scheduler event_scheduler; - -public: - inline Internal_error_handler *get_internal_handler() - { return m_internal_handler; } - - /** - Add an internal error handler to the thread execution context. - @param handler the exception handler to add - */ - void push_internal_handler(Internal_error_handler *handler); - -private: - /** - Handle a sql condition. - @param sql_errno the condition error number - @param sqlstate the condition sqlstate - @param level the condition level - @param msg the condition message text - @param[out] cond_hdl the sql condition raised, if any - @return true if the condition is handled - */ - bool handle_condition(uint sql_errno, - const char* sqlstate, - Sql_condition::enum_warning_level *level, - const char* msg, - Sql_condition ** cond_hdl); - -public: - /** - Remove the error handler last pushed. - */ - Internal_error_handler *pop_internal_handler(); - - /** - Raise an exception condition. - @param code the MYSQL_ERRNO error code of the error - */ - void raise_error(uint code); - - /** - Raise an exception condition, with a formatted message. - @param code the MYSQL_ERRNO error code of the error - */ - void raise_error_printf(uint code, ...); - - /** - Raise a completion condition (warning). - @param code the MYSQL_ERRNO error code of the warning - */ - void raise_warning(uint code); - - /** - Raise a completion condition (warning), with a formatted message. - @param code the MYSQL_ERRNO error code of the warning - */ - void raise_warning_printf(uint code, ...); - - /** - Raise a completion condition (note), with a fixed message. - @param code the MYSQL_ERRNO error code of the note - */ - void raise_note(uint code); - - /** - Raise an completion condition (note), with a formatted message. - @param code the MYSQL_ERRNO error code of the note - */ - void raise_note_printf(uint code, ...); - - /** - @brief Push an error message into MySQL error stack with line - and position information. - - This function provides semantic action implementers with a way - to push the famous "You have a syntax error near..." error - message into the error stack, which is normally produced only if - a parse error is discovered internally by the Bison generated - parser. - */ - void parse_error(const char *err_text, const char *yytext) - { - Lex_input_stream *lip= &m_parser_state->m_lip; - if (!yytext && !(yytext= lip->get_tok_start())) - yytext= ""; - /* Push an error into the error stack */ - ErrConvString err(yytext, strlen(yytext), variables.character_set_client); - my_printf_error(ER_PARSE_ERROR, ER_THD(this, ER_PARSE_ERROR), MYF(0), - err_text, err.ptr(), lip->yylineno); - } - void parse_error(uint err_number, const char *yytext= 0) - { - parse_error(ER_THD(this, err_number), yytext); - } - void parse_error() - { - parse_error(ER_SYNTAX_ERROR); - } -#ifdef mysqld_error_find_printf_error_used - void parse_error(const char *t) - { - } -#endif -private: - /* - Only the implementation of the SIGNAL and RESIGNAL statements - is permitted to raise SQL conditions in a generic way, - or to raise them by bypassing handlers (RESIGNAL). - To raise a SQL condition, the code should use the public - raise_error() or raise_warning() methods provided by class THD. - */ - friend class Sql_cmd_common_signal; - friend class Sql_cmd_signal; - friend class Sql_cmd_resignal; - friend void push_warning(THD*, Sql_condition::enum_warning_level, uint, const char*); - friend void my_message_sql(uint, const char *, myf); - - /** - Raise a generic SQL condition. - @param sql_errno the condition error number - @param sqlstate the condition SQLSTATE - @param level the condition level - @param msg the condition message text - @return The condition raised, or NULL - */ - Sql_condition* - raise_condition(uint sql_errno, - const char* sqlstate, - Sql_condition::enum_warning_level level, - const char* msg) - { - return raise_condition(sql_errno, sqlstate, level, - Sql_user_condition_identity(), msg); - } - - /** - Raise a generic or a user defined SQL condition. - @param ucid - the user condition identity - (or an empty identity if not a user condition) - @param sql_errno - the condition error number - @param sqlstate - the condition SQLSTATE - @param level - the condition level - @param msg - the condition message text - @return The condition raised, or NULL - */ - Sql_condition* - raise_condition(uint sql_errno, - const char* sqlstate, - Sql_condition::enum_warning_level level, - const Sql_user_condition_identity &ucid, - const char* msg); - - Sql_condition* - raise_condition(const Sql_condition *cond) - { - Sql_condition *raised= raise_condition(cond->get_sql_errno(), - cond->get_sqlstate(), - cond->get_level(), - *cond/*Sql_user_condition_identity*/, - cond->get_message_text()); - if (raised) - raised->copy_opt_attributes(cond); - return raised; - } - -private: - void push_warning_truncated_priv(Sql_condition::enum_warning_level level, - uint sql_errno, - const char *type_str, const char *val) - { - DBUG_ASSERT(sql_errno == ER_TRUNCATED_WRONG_VALUE || - sql_errno == ER_WRONG_VALUE); - char buff[MYSQL_ERRMSG_SIZE]; - CHARSET_INFO *cs= &my_charset_latin1; - cs->cset->snprintf(cs, buff, sizeof(buff), - ER_THD(this, sql_errno), type_str, val); - /* - Note: the format string can vary between ER_TRUNCATED_WRONG_VALUE - and ER_WRONG_VALUE, but the code passed to push_warning() is - always ER_TRUNCATED_WRONG_VALUE. This is intentional. - */ - push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff); - } -public: - void push_warning_truncated_wrong_value(Sql_condition::enum_warning_level level, - const char *type_str, const char *val) - { - return push_warning_truncated_priv(level, ER_TRUNCATED_WRONG_VALUE, - type_str, val); - } - void push_warning_wrong_value(Sql_condition::enum_warning_level level, - const char *type_str, const char *val) - { - return push_warning_truncated_priv(level, ER_WRONG_VALUE, type_str, val); - } - void push_warning_truncated_wrong_value(const char *type_str, const char *val) - { - return push_warning_truncated_wrong_value(Sql_condition::WARN_LEVEL_WARN, - type_str, val); - } - void push_warning_truncated_value_for_field(Sql_condition::enum_warning_level - level, const char *type_str, - const char *val, - const char *db_name, - const char *table_name, - const char *name) - { - DBUG_ASSERT(name); - char buff[MYSQL_ERRMSG_SIZE]; - CHARSET_INFO *cs= &my_charset_latin1; - - if (!db_name) - db_name= ""; - if (!table_name) - table_name= ""; - cs->cset->snprintf(cs, buff, sizeof(buff), - ER_THD(this, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), - type_str, val, db_name, table_name, name, - (ulong) get_stmt_da()->current_row_for_warning()); - push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff); - - } - void push_warning_wrong_or_truncated_value(Sql_condition::enum_warning_level level, - bool totally_useless_value, - const char *type_str, - const char *val, - const char *db_name, - const char *table_name, - const char *field_name) - { - if (field_name) - push_warning_truncated_value_for_field(level, type_str, val, - db_name, table_name, field_name); - else if (totally_useless_value) - push_warning_wrong_value(level, type_str, val); - else - push_warning_truncated_wrong_value(level, type_str, val); - } - -public: - /** Overloaded to guard query/query_length fields */ - virtual void set_statement(Statement *stmt); - void set_command(enum enum_server_command command) - { - m_command= command; -#ifdef HAVE_PSI_THREAD_INTERFACE - PSI_STATEMENT_CALL(set_thread_command)(m_command); -#endif - } - inline enum enum_server_command get_command() const - { return m_command; } - - /** - Assign a new value to thd->query and thd->query_id and mysys_var. - Protected with LOCK_thd_data mutex. - */ - void set_query(char *query_arg, size_t query_length_arg, - CHARSET_INFO *cs_arg) - { - set_query(CSET_STRING(query_arg, query_length_arg, cs_arg)); - } - void set_query(char *query_arg, size_t query_length_arg) /*Mutex protected*/ - { - set_query(CSET_STRING(query_arg, query_length_arg, charset())); - } - void set_query(const CSET_STRING &string_arg) - { - mysql_mutex_lock(&LOCK_thd_data); - set_query_inner(string_arg); - mysql_mutex_unlock(&LOCK_thd_data); - - PSI_CALL_set_thread_info(query(), query_length()); - } - void reset_query() /* Mutex protected */ - { set_query(CSET_STRING()); } - void set_query_and_id(char *query_arg, uint32 query_length_arg, - CHARSET_INFO *cs, query_id_t new_query_id); - void set_query_id(query_id_t new_query_id) - { - query_id= new_query_id; -#ifdef WITH_WSREP - if (WSREP_NNULL(this)) - { - set_wsrep_next_trx_id(query_id); - WSREP_DEBUG("assigned new next trx id: %" PRIu64, wsrep_next_trx_id()); - } -#endif /* WITH_WSREP */ - } - void set_open_tables(TABLE *open_tables_arg) - { - mysql_mutex_lock(&LOCK_thd_data); - open_tables= open_tables_arg; - mysql_mutex_unlock(&LOCK_thd_data); - } - void set_mysys_var(struct st_my_thread_var *new_mysys_var); - void enter_locked_tables_mode(enum_locked_tables_mode mode_arg) - { - DBUG_ASSERT(locked_tables_mode == LTM_NONE); - - if (mode_arg == LTM_LOCK_TABLES) - { - /* - When entering LOCK TABLES mode we should set explicit duration - for all metadata locks acquired so far in order to avoid releasing - them till UNLOCK TABLES statement. - We don't do this when entering prelocked mode since sub-statements - don't release metadata locks and restoring status-quo after leaving - prelocking mode gets complicated. - */ - mdl_context.set_explicit_duration_for_all_locks(); - } - - locked_tables_mode= mode_arg; - } - void leave_locked_tables_mode(); - int decide_logging_format(TABLE_LIST *tables); - /* - In Some cases when decide_logging_format is called it does not have all - information to decide the logging format. So that cases we call decide_logging_format_2 - at later stages in execution. - One example would be binlog format for IODKU but column with unique key is not inserted. - We don't have inserted columns info when we call decide_logging_format so on later stage we call - decide_logging_format_low - - @returns 0 if no format is changed - 1 if there is change in binlog format - */ - int decide_logging_format_low(TABLE *table); - - enum need_invoker { INVOKER_NONE=0, INVOKER_USER, INVOKER_ROLE}; - void binlog_invoker(bool role) { m_binlog_invoker= role ? INVOKER_ROLE : INVOKER_USER; } - enum need_invoker need_binlog_invoker() { return m_binlog_invoker; } - void get_definer(LEX_USER *definer, bool role); - void set_invoker(const LEX_CSTRING *user, const LEX_CSTRING *host) - { - invoker.user= *user; - invoker.host= *host; - } - LEX_CSTRING get_invoker_user() { return invoker.user; } - LEX_CSTRING get_invoker_host() { return invoker.host; } - bool has_invoker() { return invoker.user.length > 0; } - - void print_aborted_warning(uint threshold, const char *reason) - { - if (global_system_variables.log_warnings > threshold) - { - Security_context *sctx= &main_security_ctx; - sql_print_warning(ER_THD(this, ER_NEW_ABORTING_CONNECTION), - thread_id, (db.str ? db.str : "unconnected"), - sctx->user ? sctx->user : "unauthenticated", - sctx->host_or_ip, reason); - } - } - -public: - void clear_wakeup_ready() { wakeup_ready= false; } - /* - Sleep waiting for others to wake us up with signal_wakeup_ready(). - Must call clear_wakeup_ready() before waiting. - */ - void wait_for_wakeup_ready(); - /* Wake this thread up from wait_for_wakeup_ready(). */ - void signal_wakeup_ready(); - - void add_status_to_global() - { - DBUG_ASSERT(status_in_global == 0); - mysql_mutex_lock(&LOCK_status); - add_to_status(&global_status_var, &status_var); - /* Mark that this THD status has already been added in global status */ - status_var.global_memory_used= 0; - status_in_global= 1; - mysql_mutex_unlock(&LOCK_status); - } - - wait_for_commit *wait_for_commit_ptr; - int wait_for_prior_commit() - { - if (wait_for_commit_ptr) - return wait_for_commit_ptr->wait_for_prior_commit(this); - return 0; - } - void wakeup_subsequent_commits(int wakeup_error) - { - if (wait_for_commit_ptr) - wait_for_commit_ptr->wakeup_subsequent_commits(wakeup_error); - } - wait_for_commit *suspend_subsequent_commits() { - wait_for_commit *suspended= wait_for_commit_ptr; - wait_for_commit_ptr= NULL; - return suspended; - } - void resume_subsequent_commits(wait_for_commit *suspended) { - DBUG_ASSERT(!wait_for_commit_ptr); - wait_for_commit_ptr= suspended; - } - - void mark_transaction_to_rollback(bool all); - bool internal_transaction() { return transaction != &default_transaction; } -private: - - /** The current internal error handler for this thread, or NULL. */ - Internal_error_handler *m_internal_handler; - - /** - The lex to hold the parsed tree of conventional (non-prepared) queries. - Whereas for prepared and stored procedure statements we use an own lex - instance for each new query, for conventional statements we reuse - the same lex. (@see mysql_parse for details). - */ - LEX main_lex; - /** - This memory root is used for two purposes: - - for conventional queries, to allocate structures stored in main_lex - during parsing, and allocate runtime data (execution plan, etc.) - during execution. - - for prepared queries, only to allocate runtime data. The parsed - tree itself is reused between executions and thus is stored elsewhere. - */ - MEM_ROOT main_mem_root; - Diagnostics_area main_da; - Diagnostics_area *m_stmt_da; - - /** - It will be set if CURRENT_USER() or CURRENT_ROLE() is called in account - management statements or default definer is set in CREATE/ALTER SP, SF, - Event, TRIGGER or VIEW statements. - - Current user or role will be binlogged into Query_log_event if - m_binlog_invoker is not NONE; It will be stored into invoker_host and - invoker_user by SQL thread. - */ - enum need_invoker m_binlog_invoker; - - /** - It points to the invoker in the Query_log_event. - SQL thread use it as the default definer in CREATE/ALTER SP, SF, Event, - TRIGGER or VIEW statements or current user in account management - statements if it is not NULL. - */ - AUTHID invoker; - -public: - Session_tracker session_tracker; - /* - Flag, mutex and condition for a thread to wait for a signal from another - thread. - - Currently used to wait for group commit to complete, can also be used for - other purposes. - */ - bool wakeup_ready; - mysql_mutex_t LOCK_wakeup_ready; - mysql_cond_t COND_wakeup_ready; - /* - The GTID assigned to the last commit. If no GTID was assigned to any commit - so far, this is indicated by last_commit_gtid.seq_no == 0. - */ -private: - rpl_gtid m_last_commit_gtid; - -public: - rpl_gtid get_last_commit_gtid() { return m_last_commit_gtid; } - void set_last_commit_gtid(rpl_gtid >id); - - - LF_PINS *tdc_hash_pins; - LF_PINS *xid_hash_pins; - bool fix_xid_hash_pins(); - - const XID *get_xid() const - { -#ifdef WITH_WSREP - if (!wsrep_xid.is_null()) - return &wsrep_xid; -#endif /* WITH_WSREP */ - return (transaction->xid_state.is_explicit_XA() ? - transaction->xid_state.get_xid() : - &transaction->implicit_xid); - } - -/* Members related to temporary tables. */ -public: - /* Opened table states. */ - enum Temporary_table_state { - TMP_TABLE_IN_USE, - TMP_TABLE_NOT_IN_USE, - TMP_TABLE_ANY - }; - bool has_thd_temporary_tables(); - bool has_temporary_tables(); - - TABLE *create_and_open_tmp_table(LEX_CUSTRING *frm, - const char *path, - const char *db, - const char *table_name, - bool open_internal_tables); - - TABLE *find_temporary_table(const char *db, const char *table_name, - Temporary_table_state state= TMP_TABLE_IN_USE); - TABLE *find_temporary_table(const TABLE_LIST *tl, - Temporary_table_state state= TMP_TABLE_IN_USE); - - TMP_TABLE_SHARE *find_tmp_table_share_w_base_key(const char *key, - uint key_length); - TMP_TABLE_SHARE *find_tmp_table_share(const char *db, - const char *table_name); - TMP_TABLE_SHARE *find_tmp_table_share(const TABLE_LIST *tl); - TMP_TABLE_SHARE *find_tmp_table_share(const char *key, size_t key_length); - - bool open_temporary_table(TABLE_LIST *tl); - bool open_temporary_tables(TABLE_LIST *tl); - - bool close_temporary_tables(); - bool rename_temporary_table(TABLE *table, const LEX_CSTRING *db, - const LEX_CSTRING *table_name); - bool drop_temporary_table(TABLE *table, bool *is_trans, bool delete_table); - bool rm_temporary_table(handlerton *hton, const char *path); - void mark_tmp_tables_as_free_for_reuse(); - void mark_tmp_table_as_free_for_reuse(TABLE *table); - - TMP_TABLE_SHARE* save_tmp_table_share(TABLE *table); - void restore_tmp_table_share(TMP_TABLE_SHARE *share); - void close_unused_temporary_table_instances(const TABLE_LIST *tl); - -private: - /* Whether a lock has been acquired? */ - bool m_tmp_tables_locked; - - uint create_tmp_table_def_key(char *key, const char *db, - const char *table_name); - TMP_TABLE_SHARE *create_temporary_table(LEX_CUSTRING *frm, - const char *path, const char *db, - const char *table_name); - TABLE *find_temporary_table(const char *key, uint key_length, - Temporary_table_state state); - TABLE *open_temporary_table(TMP_TABLE_SHARE *share, const char *alias); - bool find_and_use_tmp_table(const TABLE_LIST *tl, TABLE **out_table); - bool use_temporary_table(TABLE *table, TABLE **out_table); - void close_temporary_table(TABLE *table); - bool log_events_and_free_tmp_shares(); - void free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table); - void free_temporary_table(TABLE *table); - bool lock_temporary_tables(); - void unlock_temporary_tables(); - - inline uint tmpkeyval(TMP_TABLE_SHARE *share) - { - return uint4korr(share->table_cache_key.str + - share->table_cache_key.length - 4); - } - - inline TMP_TABLE_SHARE *tmp_table_share(TABLE *table) - { - DBUG_ASSERT(table->s->tmp_table); - return static_cast(table->s); - } - -public: -#ifdef HAVE_REPLICATION - /* - If we do a purge of binary logs, log index info of the threads - that are currently reading it needs to be adjusted. To do that - each thread that is using LOG_INFO needs to adjust the pointer to it - */ - LOG_INFO *current_linfo; - Slave_info *slave_info; - - void set_current_linfo(LOG_INFO *linfo); - void reset_current_linfo() { set_current_linfo(0); } - - int register_slave(uchar *packet, size_t packet_length); - void unregister_slave(); - bool is_binlog_dump_thread(); -#endif - - inline ulong wsrep_binlog_format() const - { - return WSREP_BINLOG_FORMAT(variables.binlog_format); - } - -#ifdef WITH_WSREP - bool wsrep_applier; /* dedicated slave applier thread */ - bool wsrep_applier_closing; /* applier marked to close */ - bool wsrep_client_thread; /* to identify client threads*/ - query_id_t wsrep_last_query_id; - XID wsrep_xid; - - /** This flag denotes that record locking should be skipped during INSERT - and gap locking during SELECT. Only used by the streaming replication thread - that only modifies the wsrep_schema.SR table. */ - my_bool wsrep_skip_locking; - - mysql_cond_t COND_wsrep_thd; - - // changed from wsrep_seqno_t to wsrep_trx_meta_t in wsrep API rev 75 - uint32 wsrep_rand; - rpl_group_info *wsrep_rgi; - bool wsrep_converted_lock_session; - char wsrep_info[128]; /* string for dynamic proc info */ - ulong wsrep_retry_counter; // of autocommit - bool wsrep_PA_safe; - char* wsrep_retry_query; - size_t wsrep_retry_query_len; - enum enum_server_command wsrep_retry_command; - enum wsrep_consistency_check_mode - wsrep_consistency_check; - std::vector wsrep_status_vars; - int wsrep_mysql_replicated; - const char* wsrep_TOI_pre_query; /* a query to apply before - the actual TOI query */ - size_t wsrep_TOI_pre_query_len; - wsrep_po_handle_t wsrep_po_handle; - size_t wsrep_po_cnt; - void *wsrep_apply_format; - uchar* wsrep_rbr_buf; - wsrep_gtid_t wsrep_sync_wait_gtid; - uint64 wsrep_last_written_gtid_seqno; - uint64 wsrep_current_gtid_seqno; - ulong wsrep_affected_rows; - bool wsrep_has_ignored_error; - - /* - When enabled, do not replicate/binlog updates from the current table that's - being processed. At the moment, it is used to keep mysql.gtid_slave_pos - table updates from being replicated to other nodes via galera replication. - */ - bool wsrep_ignore_table; - /* thread who has started kill for this THD protected by LOCK_thd_data*/ - my_thread_id wsrep_aborter; - - /* - Transaction id: - * m_wsrep_next_trx_id is assigned on the first query after - wsrep_next_trx_id() return WSREP_UNDEFINED_TRX_ID - * Each storage engine must assign value of wsrep_next_trx_id() - when the transaction starts. - * Effective transaction id is returned via wsrep_trx_id() - */ - /* - Return effective transaction id - */ - wsrep_trx_id_t wsrep_trx_id() const - { - return m_wsrep_client_state.transaction().id().get(); - } - - - /* - Set next trx id - */ - void set_wsrep_next_trx_id(query_id_t query_id) - { - m_wsrep_next_trx_id = (wsrep_trx_id_t) query_id; - } - /* - Return next trx id - */ - wsrep_trx_id_t wsrep_next_trx_id() const - { - return m_wsrep_next_trx_id; - } - -private: - wsrep_trx_id_t m_wsrep_next_trx_id; /* cast from query_id_t */ - /* wsrep-lib */ - Wsrep_mutex m_wsrep_mutex; - Wsrep_condition_variable m_wsrep_cond; - Wsrep_client_service m_wsrep_client_service; - Wsrep_client_state m_wsrep_client_state; - -public: - Wsrep_client_state& wsrep_cs() { return m_wsrep_client_state; } - const Wsrep_client_state& wsrep_cs() const { return m_wsrep_client_state; } - const wsrep::transaction& wsrep_trx() const - { return m_wsrep_client_state.transaction(); } - const wsrep::streaming_context& wsrep_sr() const - { return m_wsrep_client_state.transaction().streaming_context(); } - /* Pointer to applier service for streaming THDs. This is needed to - be able to delete applier service object in case of background - rollback. */ - Wsrep_applier_service* wsrep_applier_service; - /* wait_for_commit struct for binlog group commit */ - wait_for_commit wsrep_wfc; -#endif /* WITH_WSREP */ - - /* Handling of timeouts for commands */ - thr_timer_t query_timer; - -public: - void set_query_timer() - { -#ifndef EMBEDDED_LIBRARY - /* - Don't start a query timer if - - If timeouts are not set - - if we are in a stored procedure or sub statement - - If this is a slave thread - - If we already have set a timeout (happens when running prepared - statements that calls mysql_execute_command()) - */ - if (!variables.max_statement_time || spcont || in_sub_stmt || - slave_thread || query_timer.expired == 0) - return; - thr_timer_settime(&query_timer, variables.max_statement_time); -#endif - } - void reset_query_timer() - { -#ifndef EMBEDDED_LIBRARY - if (spcont || in_sub_stmt || slave_thread) - return; - if (!query_timer.expired) - thr_timer_end(&query_timer); -#endif - } - void restore_set_statement_var() - { - main_lex.restore_set_statement_var(); - } - /* Copy relevant `stmt` transaction flags to `all` transaction. */ - void merge_unsafe_rollback_flags() - { - if (transaction->stmt.modified_non_trans_table) - transaction->all.modified_non_trans_table= TRUE; - transaction->all.m_unsafe_rollback_flags|= - (transaction->stmt.m_unsafe_rollback_flags & - (THD_TRANS::DID_WAIT | THD_TRANS::CREATED_TEMP_TABLE | - THD_TRANS::DROPPED_TEMP_TABLE | THD_TRANS::DID_DDL)); - } - - - uint get_net_wait_timeout() - { - if (in_active_multi_stmt_transaction()) - { - if (transaction->all.is_trx_read_write()) - { - if (variables.idle_write_transaction_timeout > 0) - return variables.idle_write_transaction_timeout; - } - else - { - if (variables.idle_readonly_transaction_timeout > 0) - return variables.idle_readonly_transaction_timeout; - } - - if (variables.idle_transaction_timeout > 0) - return variables.idle_transaction_timeout; - } - - return variables.net_wait_timeout; - } - - /** - Switch to a sublex, to parse a substatement or an expression. - */ - void set_local_lex(sp_lex_local *sublex) - { - DBUG_ASSERT(lex->sphead); - lex= sublex; - /* Reset part of parser state which needs this. */ - m_parser_state->m_yacc.reset_before_substatement(); - } - - /** - Switch back from a sublex (currently pointed by this->lex) to the old lex. - Sublex is merged to "oldlex" and this->lex is set to "oldlex". - - This method is called after parsing a substatement or an expression. - set_local_lex() must be previously called. - @param oldlex - The old lex which was active before set_local_lex(). - @returns - false on success, true on error (failed to merge LEX's). - - See also sp_head::merge_lex(). - */ - bool restore_from_local_lex_to_old_lex(LEX *oldlex); - - Item *sp_fix_func_item(Item **it_addr); - Item *sp_prepare_func_item(Item **it_addr, uint cols= 1); - bool sp_eval_expr(Field *result_field, Item **expr_item_ptr); - -}; - - -/* - Start a new independent transaction for the THD. - The old one is stored in this object and restored when calling - restore_old_transaction() or when the object is freed -*/ - -class start_new_trans -{ - /* container for handler's private per-connection data */ - Ha_data old_ha_data[MAX_HA]; - struct THD::st_transactions *old_transaction, new_transaction; - Open_tables_backup open_tables_state_backup; - MDL_savepoint mdl_savepoint; - PSI_transaction_locker *m_transaction_psi; - THD *org_thd; - uint in_sub_stmt; - uint server_status; - my_bool wsrep_on; - -public: - start_new_trans(THD *thd); - ~start_new_trans() - { - destroy(); - } - void destroy() - { - if (org_thd) // Safety - restore_old_transaction(); - new_transaction.free(); - } - void restore_old_transaction(); -}; - -/** A short cut for thd->get_stmt_da()->set_ok_status(). */ - -inline void -my_ok(THD *thd, ulonglong affected_rows_arg= 0, ulonglong id= 0, - const char *message= NULL) -{ - thd->set_row_count_func(affected_rows_arg); - thd->set_affected_rows(affected_rows_arg); - thd->get_stmt_da()->set_ok_status(affected_rows_arg, id, message); -} - - -/** A short cut for thd->get_stmt_da()->set_eof_status(). */ - -inline void -my_eof(THD *thd) -{ - thd->set_row_count_func(-1); - thd->get_stmt_da()->set_eof_status(thd); - - TRANSACT_TRACKER(add_trx_state(thd, TX_RESULT_SET)); -} - -#define tmp_disable_binlog(A) \ - {ulonglong tmp_disable_binlog__save_options= (A)->variables.option_bits; \ - (A)->variables.option_bits&= ~OPTION_BIN_LOG; \ - (A)->variables.option_bits|= OPTION_BIN_TMP_LOG_OFF; - -#define reenable_binlog(A) \ - (A)->variables.option_bits= tmp_disable_binlog__save_options; } - - -inline date_conv_mode_t sql_mode_for_dates(THD *thd) -{ - static_assert((date_conv_mode_t::KNOWN_MODES & - time_round_mode_t::KNOWN_MODES) == 0, - "date_conv_mode_t and time_round_mode_t must use different " - "bit values"); - static_assert(MODE_NO_ZERO_DATE == date_mode_t::NO_ZERO_DATE && - MODE_NO_ZERO_IN_DATE == date_mode_t::NO_ZERO_IN_DATE && - MODE_INVALID_DATES == date_mode_t::INVALID_DATES, - "sql_mode_t and date_mode_t values must be equal"); - return date_conv_mode_t(thd->variables.sql_mode & - (MODE_NO_ZERO_DATE | MODE_NO_ZERO_IN_DATE | MODE_INVALID_DATES)); -} - -/* - Used to hold information about file and file structure in exchange - via non-DB file (...INTO OUTFILE..., ...LOAD DATA...) - XXX: We never call destructor for objects of this class. -*/ - -class sql_exchange :public Sql_alloc -{ -public: - enum enum_filetype filetype; /* load XML, Added by Arnold & Erik */ - const char *file_name; - String *field_term,*enclosed,*line_term,*line_start,*escaped; - bool opt_enclosed; - bool dumpfile; - ulong skip_lines; - CHARSET_INFO *cs; - sql_exchange(const char *name, bool dumpfile_flag, - enum_filetype filetype_arg= FILETYPE_CSV); - bool escaped_given(void) const; -}; - -/* - This is used to get result from a select -*/ - -class JOIN; - -/* Pure interface for sending tabular data */ -class select_result_sink: public Sql_alloc -{ -public: - THD *thd; - select_result_sink(THD *thd_arg): thd(thd_arg) {} - inline int send_data_with_check(List &items, - SELECT_LEX_UNIT *u, - ha_rows sent) - { - if (u->lim.check_offset(sent)) - return 0; - - if (u->thd->killed == ABORT_QUERY) - return 0; - - return send_data(items); - } - /* - send_data returns 0 on ok, 1 on error and -1 if data was ignored, for - example for a duplicate row entry written to a temp table. - */ - virtual int send_data(List &items)=0; - virtual ~select_result_sink() {}; - void reset(THD *thd_arg) { thd= thd_arg; } -}; - -class select_result_interceptor; - -/* - Interface for sending tabular data, together with some other stuff: - - - Primary purpose seems to be seding typed tabular data: - = the DDL is sent with send_fields() - = the rows are sent with send_data() - Besides that, - - there seems to be an assumption that the sent data is a result of - SELECT_LEX_UNIT *unit, - - nest_level is used by SQL parser -*/ - -class select_result :public select_result_sink -{ -protected: - /* - All descendant classes have their send_data() skip the first - unit->offset_limit_cnt rows sent. Select_materialize - also uses unit->get_column_types(). - */ - SELECT_LEX_UNIT *unit; - /* Something used only by the parser: */ -public: - ha_rows est_records; /* estimated number of records in the result */ - select_result(THD *thd_arg): select_result_sink(thd_arg), est_records(0) {} - void set_unit(SELECT_LEX_UNIT *unit_arg) { unit= unit_arg; } - virtual ~select_result() {}; - /** - Change wrapped select_result. - - Replace the wrapped result object with new_result and call - prepare() and prepare2() on new_result. - - This base class implementation doesn't wrap other select_results. - - @param new_result The new result object to wrap around - - @retval false Success - @retval true Error - */ - virtual bool change_result(select_result *new_result) - { - return false; - } - virtual int prepare(List &list, SELECT_LEX_UNIT *u) - { - unit= u; - return 0; - } - virtual int prepare2(JOIN *join) { return 0; } - /* - Because of peculiarities of prepared statements protocol - we need to know number of columns in the result set (if - there is a result set) apart from sending columns metadata. - */ - virtual uint field_count(List &fields) const - { return fields.elements; } - virtual bool send_result_set_metadata(List &list, uint flags)=0; - virtual bool initialize_tables (JOIN *join) { return 0; } - virtual bool send_eof()=0; - /** - Check if this query returns a result set and therefore is allowed in - cursors and set an error message if it is not the case. - - @retval FALSE success - @retval TRUE error, an error message is set - */ - virtual bool check_simple_select() const; - virtual void abort_result_set() {} - /* - Cleanup instance of this class for next execution of a prepared - statement/stored procedure. - */ - virtual void cleanup(); - void set_thd(THD *thd_arg) { thd= thd_arg; } - void reset(THD *thd_arg) - { - select_result_sink::reset(thd_arg); - unit= NULL; - } -#ifdef EMBEDDED_LIBRARY - virtual void begin_dataset() {} -#else - void begin_dataset() {} -#endif - virtual void update_used_tables() {} - - /* this method is called just before the first row of the table can be read */ - virtual void prepare_to_read_rows() {} - - void remove_offset_limit() - { - unit->lim.remove_offset(); - } - - /* - This returns - - NULL if the class sends output row to the client - - this if the output is set elsewhere (a file, @variable, or table). - */ - virtual select_result_interceptor *result_interceptor()=0; - - /* - This method is used to distinguish an normal SELECT from the cursor - structure discovery for cursor%ROWTYPE routine variables. - If this method returns "true", then a SELECT execution performs only - all preparation stages, but does not fetch any rows. - */ - virtual bool view_structure_only() const { return false; } -}; - - -/* - This is a select_result_sink which simply writes all data into a (temporary) - table. Creation/deletion of the table is outside of the scope of the class - - It is aimed at capturing SHOW EXPLAIN output, so: - - Unlike select_result class, we don't assume that the sent data is an - output of a SELECT_LEX_UNIT (and so we don't apply "LIMIT x,y" from the - unit) - - We don't try to convert the target table to MyISAM -*/ - -class select_result_explain_buffer : public select_result_sink -{ -public: - select_result_explain_buffer(THD *thd_arg, TABLE *table_arg) : - select_result_sink(thd_arg), dst_table(table_arg) {}; - - TABLE *dst_table; /* table to write into */ - - /* The following is called in the child thread: */ - int send_data(List &items); -}; - - -/* - This is a select_result_sink which stores the data in text form. - - It is only used to save EXPLAIN output. -*/ - -class select_result_text_buffer : public select_result_sink -{ -public: - select_result_text_buffer(THD *thd_arg): select_result_sink(thd_arg) {} - int send_data(List &items); - bool send_result_set_metadata(List &fields, uint flag); - - void save_to(String *res); -private: - int append_row(List &items, bool send_names); - - List rows; - int n_columns; -}; - - -/* - Base class for select_result descendands which intercept and - transform result set rows. As the rows are not sent to the client, - sending of result set metadata should be suppressed as well. -*/ - -class select_result_interceptor: public select_result -{ -public: - select_result_interceptor(THD *thd_arg): - select_result(thd_arg), suppress_my_ok(false) - { - DBUG_ENTER("select_result_interceptor::select_result_interceptor"); - DBUG_PRINT("enter", ("this %p", this)); - DBUG_VOID_RETURN; - } /* Remove gcc warning */ - uint field_count(List &fields) const { return 0; } - bool send_result_set_metadata(List &fields, uint flag) { return FALSE; } - select_result_interceptor *result_interceptor() { return this; } - - /* - Instruct the object to not call my_ok(). Client output will be handled - elsewhere. (this is used by ANALYZE $stmt feature). - */ - void disable_my_ok_calls() { suppress_my_ok= true; } - void reset(THD *thd_arg) - { - select_result::reset(thd_arg); - suppress_my_ok= false; - } -protected: - bool suppress_my_ok; -}; - - -class sp_cursor_statistics -{ -protected: - ulonglong m_fetch_count; // Number of FETCH commands since last OPEN - ulonglong m_row_count; // Number of successful FETCH since last OPEN - bool m_found; // If last FETCH fetched a row -public: - sp_cursor_statistics() - :m_fetch_count(0), - m_row_count(0), - m_found(false) - { } - bool found() const - { return m_found; } - - ulonglong row_count() const - { return m_row_count; } - - ulonglong fetch_count() const - { return m_fetch_count; } - void reset() { *this= sp_cursor_statistics(); } -}; - - -/* A mediator between stored procedures and server side cursors */ -class sp_lex_keeper; -class sp_cursor: public sp_cursor_statistics -{ -private: - /// An interceptor of cursor result set used to implement - /// FETCH INTO . - class Select_fetch_into_spvars: public select_result_interceptor - { - List *spvar_list; - uint field_count; - bool m_view_structure_only; - bool send_data_to_variable_list(List &vars, List &items); - public: - Select_fetch_into_spvars(THD *thd_arg, bool view_structure_only) - :select_result_interceptor(thd_arg), - m_view_structure_only(view_structure_only) - {} - void reset(THD *thd_arg) - { - select_result_interceptor::reset(thd_arg); - spvar_list= NULL; - field_count= 0; - } - uint get_field_count() { return field_count; } - void set_spvar_list(List *vars) { spvar_list= vars; } - - virtual bool send_eof() { return FALSE; } - virtual int send_data(List &items); - virtual int prepare(List &list, SELECT_LEX_UNIT *u); - virtual bool view_structure_only() const { return m_view_structure_only; } -}; - -public: - sp_cursor() - :result(NULL, false), - m_lex_keeper(NULL), - server_side_cursor(NULL) - { } - sp_cursor(THD *thd_arg, sp_lex_keeper *lex_keeper, bool view_structure_only) - :result(thd_arg, view_structure_only), - m_lex_keeper(lex_keeper), - server_side_cursor(NULL) - {} - - virtual ~sp_cursor() - { destroy(); } - - sp_lex_keeper *get_lex_keeper() { return m_lex_keeper; } - - int open(THD *thd); - - int close(THD *thd); - - my_bool is_open() - { return MY_TEST(server_side_cursor); } - - int fetch(THD *, List *vars, bool error_on_no_data); - - bool export_structure(THD *thd, Row_definition_list *list); - - void reset(THD *thd_arg, sp_lex_keeper *lex_keeper) - { - sp_cursor_statistics::reset(); - result.reset(thd_arg); - m_lex_keeper= lex_keeper; - server_side_cursor= NULL; - } - -private: - Select_fetch_into_spvars result; - sp_lex_keeper *m_lex_keeper; - Server_side_cursor *server_side_cursor; - void destroy(); -}; - - -class select_send :public select_result { - /** - True if we have sent result set metadata to the client. - In this case the client always expects us to end the result - set with an eof or error packet - */ - bool is_result_set_started; -public: - select_send(THD *thd_arg): - select_result(thd_arg), is_result_set_started(FALSE) {} - bool send_result_set_metadata(List &list, uint flags); - int send_data(List &items); - bool send_eof(); - virtual bool check_simple_select() const { return FALSE; } - void abort_result_set(); - virtual void cleanup(); - select_result_interceptor *result_interceptor() { return NULL; } -}; - - -/* - We need this class, because select_send::send_eof() will call ::my_eof. - - See also class Protocol_discard. -*/ - -class select_send_analyze : public select_send -{ - bool send_result_set_metadata(List &list, uint flags) { return 0; } - bool send_eof() { return 0; } - void abort_result_set() {} -public: - select_send_analyze(THD *thd_arg): select_send(thd_arg) {} -}; - - -class select_to_file :public select_result_interceptor { -protected: - sql_exchange *exchange; - File file; - IO_CACHE cache; - ha_rows row_count; - char path[FN_REFLEN]; - -public: - select_to_file(THD *thd_arg, sql_exchange *ex): - select_result_interceptor(thd_arg), exchange(ex), file(-1),row_count(0L) - { path[0]=0; } - ~select_to_file(); - bool send_eof(); - void cleanup(); -}; - - -#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape - - -/* - List of all possible characters of a numeric value text representation. -*/ -#define NUMERIC_CHARS ".0123456789e+-" - - -class select_export :public select_to_file { - uint field_term_length; - int field_sep_char,escape_char,line_sep_char; - int field_term_char; // first char of FIELDS TERMINATED BY or MAX_INT - /* - The is_ambiguous_field_sep field is true if a value of the field_sep_char - field is one of the 'n', 't', 'r' etc characters - (see the READ_INFO::unescape method and the ESCAPE_CHARS constant value). - */ - bool is_ambiguous_field_sep; - /* - The is_ambiguous_field_term is true if field_sep_char contains the first - char of the FIELDS TERMINATED BY (ENCLOSED BY is empty), and items can - contain this character. - */ - bool is_ambiguous_field_term; - /* - The is_unsafe_field_sep field is true if a value of the field_sep_char - field is one of the '0'..'9', '+', '-', '.' and 'e' characters - (see the NUMERIC_CHARS constant value). - */ - bool is_unsafe_field_sep; - bool fixed_row_size; - CHARSET_INFO *write_cs; // output charset -public: - select_export(THD *thd_arg, sql_exchange *ex): select_to_file(thd_arg, ex) {} - ~select_export(); - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); -}; - - -class select_dump :public select_to_file { -public: - select_dump(THD *thd_arg, sql_exchange *ex): select_to_file(thd_arg, ex) {} - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); -}; - - -class select_insert :public select_result_interceptor { - public: - select_result *sel_result; - TABLE_LIST *table_list; - TABLE *table; - List *fields; - ulonglong autoinc_value_of_last_inserted_row; // autogenerated or not - COPY_INFO info; - bool insert_into_view; - select_insert(THD *thd_arg, TABLE_LIST *table_list_par, TABLE *table_par, - List *fields_par, List *update_fields, - List *update_values, enum_duplicates duplic, - bool ignore, select_result *sel_ret_list); - ~select_insert(); - int prepare(List &list, SELECT_LEX_UNIT *u); - virtual int prepare2(JOIN *join); - virtual int send_data(List &items); - virtual void store_values(List &values); - virtual bool can_rollback_data() { return 0; } - bool prepare_eof(); - bool send_ok_packet(); - bool send_eof(); - virtual void abort_result_set(); - /* not implemented: select_insert is never re-used in prepared statements */ - void cleanup(); -}; - - -class select_create: public select_insert { - TABLE_LIST *create_table; - Table_specification_st *create_info; - TABLE_LIST *select_tables; - Alter_info *alter_info; - Field **field; - /* lock data for tmp table */ - MYSQL_LOCK *m_lock; - /* m_lock or thd->extra_lock */ - MYSQL_LOCK **m_plock; - bool exit_done; - TMP_TABLE_SHARE *saved_tmp_table_share; - -public: - select_create(THD *thd_arg, TABLE_LIST *table_arg, - Table_specification_st *create_info_par, - Alter_info *alter_info_arg, - List &select_fields,enum_duplicates duplic, bool ignore, - TABLE_LIST *select_tables_arg): - select_insert(thd_arg, table_arg, NULL, &select_fields, 0, 0, duplic, - ignore, NULL), - create_table(table_arg), - create_info(create_info_par), - select_tables(select_tables_arg), - alter_info(alter_info_arg), - m_plock(NULL), exit_done(0), - saved_tmp_table_share(0) - {} - int prepare(List &list, SELECT_LEX_UNIT *u); - - void store_values(List &values); - bool send_eof(); - virtual void abort_result_set(); - virtual bool can_rollback_data() { return 1; } - - // Needed for access from local class MY_HOOKS in prepare(), since thd is proteted. - const THD *get_thd(void) { return thd; } - const HA_CREATE_INFO *get_create_info() { return create_info; }; - int prepare2(JOIN *join) { return 0; } - -private: - TABLE *create_table_from_items(THD *thd, - List *items, - MYSQL_LOCK **lock, - TABLEOP_HOOKS *hooks); -}; - -#include - -#ifdef WITH_ARIA_STORAGE_ENGINE -#include -#else -#undef USE_ARIA_FOR_TMP_TABLES -#endif - -#ifdef USE_ARIA_FOR_TMP_TABLES -#define TMP_ENGINE_COLUMNDEF MARIA_COLUMNDEF -#define TMP_ENGINE_HTON maria_hton -#define TMP_ENGINE_NAME "Aria" -inline uint tmp_table_max_key_length() { return maria_max_key_length(); } -inline uint tmp_table_max_key_parts() { return maria_max_key_segments(); } -#else -#define TMP_ENGINE_COLUMNDEF MI_COLUMNDEF -#define TMP_ENGINE_HTON myisam_hton -#define TMP_ENGINE_NAME "MyISAM" -inline uint tmp_table_max_key_length() { return MI_MAX_KEY_LENGTH; } -inline uint tmp_table_max_key_parts() { return MI_MAX_KEY_SEG; } -#endif - -/* - Param to create temporary tables when doing SELECT:s - NOTE - This structure is copied using memcpy as a part of JOIN. -*/ - -class TMP_TABLE_PARAM :public Sql_alloc -{ -public: - List copy_funcs; - Copy_field *copy_field, *copy_field_end; - uchar *group_buff; - Item **items_to_copy; /* Fields in tmp table */ - TMP_ENGINE_COLUMNDEF *recinfo, *start_recinfo; - KEY *keyinfo; - ha_rows end_write_records; - /** - Number of normal fields in the query, including those referred to - from aggregate functions. Hence, "SELECT `field1`, - SUM(`field2`) from t1" sets this counter to 2. - - @see count_field_types - */ - uint field_count; - /** - Number of fields in the query that have functions. Includes both - aggregate functions (e.g., SUM) and non-aggregates (e.g., RAND). - Also counts functions referred to from aggregate functions, i.e., - "SELECT SUM(RAND())" sets this counter to 2. - - @see count_field_types - */ - uint func_count; - /** - Number of fields in the query that have aggregate functions. Note - that the optimizer may choose to optimize away these fields by - replacing them with constants, in which case sum_func_count will - need to be updated. - - @see opt_sum_query, count_field_types - */ - uint sum_func_count; - uint hidden_field_count; - uint group_parts,group_length,group_null_parts; - uint quick_group; - /** - Enabled when we have atleast one outer_sum_func. Needed when used - along with distinct. - - @see create_tmp_table - */ - bool using_outer_summary_function; - CHARSET_INFO *table_charset; - bool schema_table; - /* TRUE if the temp table is created for subquery materialization. */ - bool materialized_subquery; - /* TRUE if all columns of the table are guaranteed to be non-nullable */ - bool force_not_null_cols; - /* - True if GROUP BY and its aggregate functions are already computed - by a table access method (e.g. by loose index scan). In this case - query execution should not perform aggregation and should treat - aggregate functions as normal functions. - */ - bool precomputed_group_by; - bool force_copy_fields; - /* - If TRUE, create_tmp_field called from create_tmp_table will convert - all BIT fields to 64-bit longs. This is a workaround the limitation - that MEMORY tables cannot index BIT columns. - */ - bool bit_fields_as_long; - /* - Whether to create or postpone actual creation of this temporary table. - TRUE <=> create_tmp_table will create only the TABLE structure. - */ - bool skip_create_table; - - TMP_TABLE_PARAM() - :copy_field(0), group_parts(0), - group_length(0), group_null_parts(0), - using_outer_summary_function(0), - schema_table(0), materialized_subquery(0), force_not_null_cols(0), - precomputed_group_by(0), - force_copy_fields(0), bit_fields_as_long(0), skip_create_table(0) - {} - ~TMP_TABLE_PARAM() - { - cleanup(); - } - void init(void); - inline void cleanup(void) - { - if (copy_field) /* Fix for Intel compiler */ - { - delete [] copy_field; - copy_field= NULL; - copy_field_end= NULL; - } - } -}; - - -class select_unit :public select_result_interceptor -{ -protected: - uint curr_step, prev_step, curr_sel; - enum sub_select_type step; -public: - TMP_TABLE_PARAM tmp_table_param; - /* Number of additional (hidden) field of the used temporary table */ - int addon_cnt; - int write_err; /* Error code from the last send_data->ha_write_row call. */ - TABLE *table; - - select_unit(THD *thd_arg): - select_result_interceptor(thd_arg), addon_cnt(0), table(0) - { - init(); - tmp_table_param.init(); - } - int prepare(List &list, SELECT_LEX_UNIT *u); - /** - Do prepare() and prepare2() if they have been postponed until - column type information is computed (used by select_union_direct). - - @param types Column types - - @return false on success, true on failure - */ - virtual bool postponed_prepare(List &types) - { return false; } - int send_data(List &items); - int write_record(); - int update_counter(Field *counter, longlong value); - int delete_record(); - bool send_eof(); - virtual bool flush(); - void cleanup(); - virtual bool create_result_table(THD *thd, List *column_types, - bool is_distinct, ulonglong options, - const LEX_CSTRING *alias, - bool bit_fields_as_long, - bool create_table, - bool keep_row_order, - uint hidden); - TMP_TABLE_PARAM *get_tmp_table_param() { return &tmp_table_param; } - void init() - { - curr_step= prev_step= 0; - curr_sel= UINT_MAX; - step= UNION_TYPE; - write_err= 0; - } - virtual void change_select(); - virtual bool force_enable_index_if_needed() { return false; } -}; - - -/** - @class select_unit_ext - - The class used when processing rows produced by operands of query expressions - containing INTERSECT ALL and/or EXCEPT all operations. One or two extra fields - of the temporary to store the rows of the partial and final result can be employed. - Both of them contain counters. The second additional field is used only when - the processed query expression contains INTERSECT ALL. - - Consider how these extra fields are used. - - Let - table t1 (f char(8)) - table t2 (f char(8)) - table t3 (f char(8)) - contain the following sets: - ("b"),("a"),("d"),("c"),("b"),("a"),("c"),("a") - ("c"),("b"),("c"),("c"),("a"),("b"),("g") - ("c"),("a"),("b"),("d"),("b"),("e") - - - Let's demonstrate how the the set operation INTERSECT ALL is proceesed - for the query - SELECT f FROM t1 INTERSECT ALL SELECT f FROM t2 - - When send_data() is called for the rows of the first operand we put - the processed record into the temporary table if there was no such record - setting dup_cnt field to 1 and add_cnt field to 0 and increment the - counter in the dup_cnt field by one otherwise. We get - - |add_cnt|dup_cnt| f | - |0 |2 |b | - |0 |3 |a | - |0 |1 |d | - |0 |2 |c | - - The call of send_eof() for the first operand swaps the values stored in - dup_cnt and add_cnt. After this, we'll see the following rows in the - temporary table - - |add_cnt|dup_cnt| f | - |2 |0 |b | - |3 |0 |a | - |1 |0 |d | - |2 |0 |c | - - When send_data() is called for the rows of the second operand we increment - the counter in dup_cnt if the processed row is found in the table and do - nothing otherwise. As a result we get - - |add_cnt|dup_cnt| f | - |2 |2 |b | - |3 |1 |a | - |1 |0 |d | - |2 |3 |c | - - At the call of send_eof() for the second operand first we disable index. - Then for each record, the minimum of counters from dup_cnt and add_cnt m is - taken. If m == 0 then the record is deleted. Otherwise record is replaced - with m copies of it. Yet the counter in this copies are set to 1 for - dup_cnt and to 0 for add_cnt - - |add_cnt|dup_cnt| f | - |0 |1 |b | - |0 |1 |b | - |0 |1 |a | - |0 |1 |c | - |0 |1 |c | - - - Let's demonstrate how the the set operation EXCEPT ALL is proceesed - for the query - SELECT f FROM t1 EXCEPT ALL SELECT f FROM t3 - - Only one additional counter field dup_cnt is used for EXCEPT ALL. - After the first operand has been processed we have in the temporary table - - |dup_cnt| f | - |2 |b | - |3 |a | - |1 |d | - |2 |c | - - When send_data() is called for the rows of the second operand we decrement - the counter in dup_cnt if the processed row is found in the table and do - nothing otherwise. If the counter becomes 0 we delete the record - - |dup_cnt| f | - |2 |a | - |1 |c | - - Finally at the call of send_eof() for the second operand we disable index - unfold rows adding duplicates - - |dup_cnt| f | - |1 |a | - |1 |a | - |1 |c | - */ - -class select_unit_ext :public select_unit -{ -public: - select_unit_ext(THD *thd_arg): - select_unit(thd_arg), increment(0), is_index_enabled(TRUE), - curr_op_type(UNSPECIFIED) - { - }; - int send_data(List &items); - void change_select(); - int unfold_record(ha_rows cnt); - bool send_eof(); - bool force_enable_index_if_needed() - { - is_index_enabled= true; - return true; - } - bool disable_index_if_needed(SELECT_LEX *curr_sl); - - /* - How to change increment/decrement the counter in duplicate_cnt field - when processing a record produced by the current operand in send_data(). - The value can be 1 or -1 - */ - int increment; - /* TRUE <=> the index of the result temporary table is enabled */ - bool is_index_enabled; - /* The type of the set operation currently executed */ - enum set_op_type curr_op_type; - /* - Points to the extra field of the temporary table where - duplicate counters are stored - */ - Field *duplicate_cnt; - /* - Points to the extra field of the temporary table where additional - counters used only for INTERSECT ALL operations are stored - */ - Field *additional_cnt; -}; - -class select_union_recursive :public select_unit -{ - public: - /* The temporary table with the new records generated by one iterative step */ - TABLE *incr_table; - /* One of tables from the list rec_tables (determined dynamically) */ - TABLE *first_rec_table_to_update; - /* The temporary tables used for recursive table references */ - List
rec_tables; - /* - The count of how many times cleanup() was called with cleaned==false - for the unit specifying the recursive CTE for which this object was created - or for the unit specifying a CTE that mutually recursive with this CTE. - */ - uint cleanup_count; - - select_union_recursive(THD *thd_arg): - select_unit(thd_arg), - incr_table(0), first_rec_table_to_update(0), cleanup_count(0) {}; - - int send_data(List &items); - bool create_result_table(THD *thd, List *column_types, - bool is_distinct, ulonglong options, - const LEX_CSTRING *alias, - bool bit_fields_as_long, - bool create_table, - bool keep_row_order, - uint hidden); - void cleanup(); -}; - -/** - UNION result that is passed directly to the receiving select_result - without filling a temporary table. - - Function calls are forwarded to the wrapped select_result, but some - functions are expected to be called only once for each query, so - they are only executed for the first SELECT in the union (execept - for send_eof(), which is executed only for the last SELECT). - - This select_result is used when a UNION is not DISTINCT and doesn't - have a global ORDER BY clause. @see st_select_lex_unit::prepare(). -*/ - -class select_union_direct :public select_unit -{ -private: - /* Result object that receives all rows */ - select_result *result; - /* The last SELECT_LEX of the union */ - SELECT_LEX *last_select_lex; - - /* Wrapped result has received metadata */ - bool done_send_result_set_metadata; - /* Wrapped result has initialized tables */ - bool done_initialize_tables; - - /* Accumulated limit_found_rows */ - ulonglong limit_found_rows; - - /* Number of rows offset */ - ha_rows offset; - /* Number of rows limit + offset, @see select_union_direct::send_data() */ - ha_rows limit; - -public: - /* Number of rows in the union */ - ha_rows send_records; - select_union_direct(THD *thd_arg, select_result *result_arg, - SELECT_LEX *last_select_lex_arg): - select_unit(thd_arg), result(result_arg), - last_select_lex(last_select_lex_arg), - done_send_result_set_metadata(false), done_initialize_tables(false), - limit_found_rows(0) - { send_records= 0; } - bool change_result(select_result *new_result); - uint field_count(List &fields) const - { - // Only called for top-level select_results, usually select_send - DBUG_ASSERT(false); /* purecov: inspected */ - return 0; /* purecov: inspected */ - } - bool postponed_prepare(List &types); - bool send_result_set_metadata(List &list, uint flags); - int send_data(List &items); - bool initialize_tables (JOIN *join); - bool send_eof(); - bool flush() { return false; } - bool check_simple_select() const - { - /* Only called for top-level select_results, usually select_send */ - DBUG_ASSERT(false); /* purecov: inspected */ - return false; /* purecov: inspected */ - } - void abort_result_set() - { - result->abort_result_set(); /* purecov: inspected */ - } - void cleanup() - { - send_records= 0; - } - void set_thd(THD *thd_arg) - { - /* - Only called for top-level select_results, usually select_send, - and for the results of subquery engines - (select__subselect). - */ - DBUG_ASSERT(false); /* purecov: inspected */ - } - void remove_offset_limit() - { - // EXPLAIN should never output to a select_union_direct - DBUG_ASSERT(false); /* purecov: inspected */ - } - void begin_dataset() - { - // Only called for sp_cursor::Select_fetch_into_spvars - DBUG_ASSERT(false); /* purecov: inspected */ - } -}; - - -/* Base subselect interface class */ -class select_subselect :public select_result_interceptor -{ -protected: - Item_subselect *item; -public: - select_subselect(THD *thd_arg, Item_subselect *item_arg): - select_result_interceptor(thd_arg), item(item_arg) {} - int send_data(List &items)=0; - bool send_eof() { return 0; }; -}; - -/* Single value subselect interface class */ -class select_singlerow_subselect :public select_subselect -{ -public: - select_singlerow_subselect(THD *thd_arg, Item_subselect *item_arg): - select_subselect(thd_arg, item_arg) - {} - int send_data(List &items); -}; - - -/* - This class specializes select_union to collect statistics about the - data stored in the temp table. Currently the class collects statistcs - about NULLs. -*/ - -class select_materialize_with_stats : public select_unit -{ -protected: - class Column_statistics - { - public: - /* Count of NULLs per column. */ - ha_rows null_count; - /* The row number that contains the first NULL in a column. */ - ha_rows min_null_row; - /* The row number that contains the last NULL in a column. */ - ha_rows max_null_row; - }; - - /* Array of statistics data per column. */ - Column_statistics* col_stat; - - /* - The number of columns in the biggest sub-row that consists of only - NULL values. - */ - uint max_nulls_in_row; - /* - Count of rows writtent to the temp table. This is redundant as it is - already stored in handler::stats.records, however that one is relatively - expensive to compute (given we need that for evry row). - */ - ha_rows count_rows; - -protected: - void reset(); - -public: - select_materialize_with_stats(THD *thd_arg): select_unit(thd_arg) - { tmp_table_param.init(); } - bool create_result_table(THD *thd, List *column_types, - bool is_distinct, ulonglong options, - const LEX_CSTRING *alias, - bool bit_fields_as_long, - bool create_table, - bool keep_row_order, - uint hidden); - bool init_result_table(ulonglong select_options); - int send_data(List &items); - void cleanup(); - ha_rows get_null_count_of_col(uint idx) - { - DBUG_ASSERT(idx < table->s->fields); - return col_stat[idx].null_count; - } - ha_rows get_max_null_of_col(uint idx) - { - DBUG_ASSERT(idx < table->s->fields); - return col_stat[idx].max_null_row; - } - ha_rows get_min_null_of_col(uint idx) - { - DBUG_ASSERT(idx < table->s->fields); - return col_stat[idx].min_null_row; - } - uint get_max_nulls_in_row() { return max_nulls_in_row; } -}; - - -/* used in independent ALL/ANY optimisation */ -class select_max_min_finder_subselect :public select_subselect -{ - Item_cache *cache; - bool (select_max_min_finder_subselect::*op)(); - bool fmax; - bool is_all; -public: - select_max_min_finder_subselect(THD *thd_arg, Item_subselect *item_arg, - bool mx, bool all): - select_subselect(thd_arg, item_arg), cache(0), fmax(mx), is_all(all) - {} - void cleanup(); - int send_data(List &items); - bool cmp_real(); - bool cmp_int(); - bool cmp_decimal(); - bool cmp_str(); -}; - -/* EXISTS subselect interface class */ -class select_exists_subselect :public select_subselect -{ -public: - select_exists_subselect(THD *thd_arg, Item_subselect *item_arg): - select_subselect(thd_arg, item_arg) {} - int send_data(List &items); -}; - - -/* - Optimizer and executor structure for the materialized semi-join info. This - structure contains - - The sj-materialization temporary table - - Members needed to make index lookup or a full scan of the temptable. -*/ -class SJ_MATERIALIZATION_INFO : public Sql_alloc -{ -public: - /* Optimal join sub-order */ - struct st_position *positions; - - uint tables; /* Number of tables in the sj-nest */ - - /* Number of rows in the materialized table, before the de-duplication */ - double rows_with_duplicates; - - /* Expected #rows in the materialized table, after de-duplication */ - double rows; - - /* - Cost to materialize - execute the sub-join and write rows into temp.table - */ - Cost_estimate materialization_cost; - - /* Cost to make one lookup in the temptable */ - Cost_estimate lookup_cost; - - /* Cost of scanning the materialized table */ - Cost_estimate scan_cost; - - /* --- Execution structures ---------- */ - - /* - TRUE <=> This structure is used for execution. We don't necessarily pick - sj-materialization, so some of SJ_MATERIALIZATION_INFO structures are not - used by materialization - */ - bool is_used; - - bool materialized; /* TRUE <=> materialization already performed */ - /* - TRUE - the temptable is read with full scan - FALSE - we use the temptable for index lookups - */ - bool is_sj_scan; - - /* The temptable and its related info */ - TMP_TABLE_PARAM sjm_table_param; - List sjm_table_cols; - TABLE *table; - - /* Structure used to make index lookups */ - struct st_table_ref *tab_ref; - Item *in_equality; /* See create_subq_in_equalities() */ - - Item *join_cond; /* See comments in make_join_select() */ - Copy_field *copy_field; /* Needed for SJ_Materialization scan */ -}; - - -/* Structs used when sorting */ -struct SORT_FIELD_ATTR -{ - /* - If using mem-comparable fixed-size keys: - length of the mem-comparable image of the field, in bytes. - - If using packed keys: still the same? Not clear what is the use of it. - */ - uint length; - - /* - For most datatypes, this is 0. - The exception are the VARBINARY columns. - For those columns, the comparison actually compares - - (value_prefix(N), suffix=length(value)) - - Here value_prefix is either the whole value or its prefix if it was too - long, and the suffix is the length of the original value. - (this way, for values X and Y: if X=prefix(Y) then X compares as less - than Y - */ - uint suffix_length; - - /* - If using packed keys, number of bytes that are used to store the length - of the packed key. - - */ - uint length_bytes; - - /* Max. length of the original value, in bytes */ - uint original_length; - enum Type { FIXED_SIZE, VARIABLE_SIZE } type; - /* - TRUE : if the item or field is NULLABLE - FALSE : otherwise - */ - bool maybe_null; - CHARSET_INFO *cs; - uint pack_sort_string(uchar *to, const Binary_string *str, - CHARSET_INFO *cs) const; - int compare_packed_fixed_size_vals(uchar *a, size_t *a_len, - uchar *b, size_t *b_len); - int compare_packed_varstrings(uchar *a, size_t *a_len, - uchar *b, size_t *b_len); - bool check_if_packing_possible(THD *thd) const; - bool is_variable_sized() { return type == VARIABLE_SIZE; } - void set_length_and_original_length(THD *thd, uint length_arg); -}; - - -struct SORT_FIELD: public SORT_FIELD_ATTR -{ - Field *field; /* Field to sort */ - Item *item; /* Item if not sorting fields */ - bool reverse; /* if descending sort */ -}; - - -typedef struct st_sort_buffer { - uint index; /* 0 or 1 */ - uint sort_orders; - uint change_pos; /* If sort-fields changed */ - char **buff; - SORT_FIELD *sortorder; -} SORT_BUFFER; - -/* Structure for db & table in sql_yacc */ - -class Table_ident :public Sql_alloc -{ -public: - LEX_CSTRING db; - LEX_CSTRING table; - SELECT_LEX_UNIT *sel; - inline Table_ident(THD *thd, const LEX_CSTRING *db_arg, - const LEX_CSTRING *table_arg, - bool force) - :table(*table_arg), sel((SELECT_LEX_UNIT *)0) - { - if (!force && (thd->client_capabilities & CLIENT_NO_SCHEMA)) - db= null_clex_str; - else - db= *db_arg; - } - inline Table_ident(const LEX_CSTRING *table_arg) - :table(*table_arg), sel((SELECT_LEX_UNIT *)0) - { - db= null_clex_str; - } - /* - This constructor is used only for the case when we create a derived - table. A derived table has no name and doesn't belong to any database. - Later, if there was an alias specified for the table, it will be set - by add_table_to_list. - */ - inline Table_ident(SELECT_LEX_UNIT *s) : sel(s) - { - /* We must have a table name here as this is used with add_table_to_list */ - db.str= empty_c_string; /* a subject to casedn_str */ - db.length= 0; - table.str= internal_table_name; - table.length=1; - } - bool is_derived_table() const { return MY_TEST(sel); } - inline void change_db(LEX_CSTRING *db_name) - { - db= *db_name; - } - bool resolve_table_rowtype_ref(THD *thd, Row_definition_list &defs); - bool append_to(THD *thd, String *to) const; -}; - - -class Qualified_column_ident: public Table_ident -{ -public: - LEX_CSTRING m_column; -public: - Qualified_column_ident(const LEX_CSTRING *column) - :Table_ident(&null_clex_str), - m_column(*column) - { } - Qualified_column_ident(const LEX_CSTRING *table, const LEX_CSTRING *column) - :Table_ident(table), - m_column(*column) - { } - Qualified_column_ident(THD *thd, - const LEX_CSTRING *db, - const LEX_CSTRING *table, - const LEX_CSTRING *column) - :Table_ident(thd, db, table, false), - m_column(*column) - { } - bool resolve_type_ref(THD *thd, Column_definition *def); - bool append_to(THD *thd, String *to) const; -}; - - -// this is needed for user_vars hash -class user_var_entry -{ - CHARSET_INFO *m_charset; - public: - user_var_entry() {} /* Remove gcc warning */ - LEX_CSTRING name; - char *value; - size_t length; - query_id_t update_query_id, used_query_id; - Item_result type; - bool unsigned_flag; - - double val_real(bool *null_value); - longlong val_int(bool *null_value) const; - String *val_str(bool *null_value, String *str, uint decimals) const; - my_decimal *val_decimal(bool *null_value, my_decimal *result); - CHARSET_INFO *charset() const { return m_charset; } - void set_charset(CHARSET_INFO *cs) { m_charset= cs; } -}; - -user_var_entry *get_variable(HASH *hash, LEX_CSTRING *name, - bool create_if_not_exists); - -class SORT_INFO; -class multi_delete :public select_result_interceptor -{ - TABLE_LIST *delete_tables, *table_being_deleted; - Unique **tempfiles; - ha_rows deleted, found; - uint num_of_tables; - int error; - bool do_delete; - /* True if at least one table we delete from is transactional */ - bool transactional_tables; - /* True if at least one table we delete from is not transactional */ - bool normal_tables; - bool delete_while_scanning; - /* - error handling (rollback and binlogging) can happen in send_eof() - so that afterward abort_result_set() needs to find out that. - */ - bool error_handled; - -public: - // Methods used by ColumnStore - uint get_num_of_tables() const { return num_of_tables; } - TABLE_LIST* get_tables() const { return delete_tables; } -public: - multi_delete(THD *thd_arg, TABLE_LIST *dt, uint num_of_tables); - ~multi_delete(); - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); - bool initialize_tables (JOIN *join); - int do_deletes(); - int do_table_deletes(TABLE *table, SORT_INFO *sort_info, bool ignore); - bool send_eof(); - inline ha_rows num_deleted() const { return deleted; } - virtual void abort_result_set(); - void prepare_to_read_rows(); -}; - - -class multi_update :public select_result_interceptor -{ - TABLE_LIST *all_tables; /* query/update command tables */ - List *leaves; /* list of leves of join table tree */ - TABLE_LIST *update_tables; - TABLE **tmp_tables, *main_table, *table_to_update; - TMP_TABLE_PARAM *tmp_table_param; - ha_rows updated, found; - List *fields, *values; - List **fields_for_table, **values_for_table; - uint table_count; - /* - List of tables referenced in the CHECK OPTION condition of - the updated view excluding the updated table. - */ - List
unupdated_check_opt_tables; - Copy_field *copy_field; - enum enum_duplicates handle_duplicates; - bool do_update, trans_safe; - /* True if the update operation has made a change in a transactional table */ - bool transactional_tables; - bool ignore; - /* - error handling (rollback and binlogging) can happen in send_eof() - so that afterward abort_result_set() needs to find out that. - */ - bool error_handled; - - /* Need this to protect against multiple prepare() calls */ - bool prepared; - - // For System Versioning (may need to insert new fields to a table). - ha_rows updated_sys_ver; - - bool has_vers_fields; - -public: - multi_update(THD *thd_arg, TABLE_LIST *ut, List *leaves_list, - List *fields, List *values, - enum_duplicates handle_duplicates, bool ignore); - ~multi_update(); - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); - bool initialize_tables (JOIN *join); - int prepare2(JOIN *join); - int do_updates(); - bool send_eof(); - inline ha_rows num_found() const { return found; } - inline ha_rows num_updated() const { return updated; } - virtual void abort_result_set(); - void update_used_tables(); - void prepare_to_read_rows(); -}; - -class my_var_sp; -class my_var : public Sql_alloc { -public: - const LEX_CSTRING name; - enum type { SESSION_VAR, LOCAL_VAR, PARAM_VAR }; - type scope; - my_var(const LEX_CSTRING *j, enum type s) : name(*j), scope(s) { } - virtual ~my_var() {} - virtual bool set(THD *thd, Item *val) = 0; - virtual my_var_sp *get_my_var_sp() { return NULL; } -}; - -class my_var_sp: public my_var { - const Sp_rcontext_handler *m_rcontext_handler; - const Type_handler *m_type_handler; -public: - uint offset; - /* - Routine to which this Item_splocal belongs. Used for checking if correct - runtime context is used for variable handling. - */ - sp_head *sp; - my_var_sp(const Sp_rcontext_handler *rcontext_handler, - const LEX_CSTRING *j, uint o, const Type_handler *type_handler, - sp_head *s) - : my_var(j, LOCAL_VAR), - m_rcontext_handler(rcontext_handler), - m_type_handler(type_handler), offset(o), sp(s) { } - ~my_var_sp() { } - bool set(THD *thd, Item *val); - my_var_sp *get_my_var_sp() { return this; } - const Type_handler *type_handler() const { return m_type_handler; } - sp_rcontext *get_rcontext(sp_rcontext *local_ctx) const; -}; - -/* - This class handles fields of a ROW SP variable when it's used as a OUT - parameter in a stored procedure. -*/ -class my_var_sp_row_field: public my_var_sp -{ - uint m_field_offset; -public: - my_var_sp_row_field(const Sp_rcontext_handler *rcontext_handler, - const LEX_CSTRING *varname, const LEX_CSTRING *fieldname, - uint var_idx, uint field_idx, sp_head *s) - :my_var_sp(rcontext_handler, varname, var_idx, - &type_handler_double/*Not really used*/, s), - m_field_offset(field_idx) - { } - bool set(THD *thd, Item *val); -}; - -class my_var_user: public my_var { -public: - my_var_user(const LEX_CSTRING *j) - : my_var(j, SESSION_VAR) { } - ~my_var_user() { } - bool set(THD *thd, Item *val); -}; - -class select_dumpvar :public select_result_interceptor { - ha_rows row_count; - my_var_sp *m_var_sp_row; // Not NULL if SELECT INTO row_type_sp_variable - bool send_data_to_var_list(List &items); -public: - List var_list; - select_dumpvar(THD *thd_arg) - :select_result_interceptor(thd_arg), row_count(0), m_var_sp_row(NULL) - { var_list.empty(); } - ~select_dumpvar() {} - int prepare(List &list, SELECT_LEX_UNIT *u); - int send_data(List &items); - bool send_eof(); - virtual bool check_simple_select() const; - void cleanup(); -}; - -/* Bits in sql_command_flags */ - -#define CF_CHANGES_DATA (1U << 0) -#define CF_REPORT_PROGRESS (1U << 1) -#define CF_STATUS_COMMAND (1U << 2) -#define CF_SHOW_TABLE_COMMAND (1U << 3) -#define CF_WRITE_LOGS_COMMAND (1U << 4) - -/** - Must be set for SQL statements that may contain - Item expressions and/or use joins and tables. - Indicates that the parse tree of such statement may - contain rule-based optimizations that depend on metadata - (i.e. number of columns in a table), and consequently - that the statement must be re-prepared whenever - referenced metadata changes. Must not be set for - statements that themselves change metadata, e.g. RENAME, - ALTER and other DDL, since otherwise will trigger constant - reprepare. Consequently, complex item expressions and - joins are currently prohibited in these statements. -*/ -#define CF_REEXECUTION_FRAGILE (1U << 5) -/** - Implicitly commit before the SQL statement is executed. - - Statements marked with this flag will cause any active - transaction to end (commit) before proceeding with the - command execution. - - This flag should be set for statements that probably can't - be rolled back or that do not expect any previously metadata - locked tables. -*/ -#define CF_IMPLICIT_COMMIT_BEGIN (1U << 6) -/** - Implicitly commit after the SQL statement. - - Statements marked with this flag are automatically committed - at the end of the statement. - - This flag should be set for statements that will implicitly - open and take metadata locks on system tables that should not - be carried for the whole duration of a active transaction. -*/ -#define CF_IMPLICIT_COMMIT_END (1U << 7) -/** - CF_IMPLICT_COMMIT_BEGIN and CF_IMPLICIT_COMMIT_END are used - to ensure that the active transaction is implicitly committed - before and after every DDL statement and any statement that - modifies our currently non-transactional system tables. -*/ -#define CF_AUTO_COMMIT_TRANS (CF_IMPLICIT_COMMIT_BEGIN | CF_IMPLICIT_COMMIT_END) - -/** - Diagnostic statement. - Diagnostic statements: - - SHOW WARNING - - SHOW ERROR - - GET DIAGNOSTICS (WL#2111) - do not modify the diagnostics area during execution. -*/ -#define CF_DIAGNOSTIC_STMT (1U << 8) - -/** - Identifies statements that may generate row events - and that may end up in the binary log. -*/ -#define CF_CAN_GENERATE_ROW_EVENTS (1U << 9) - -/** - Identifies statements which may deal with temporary tables and for which - temporary tables should be pre-opened to simplify privilege checks. -*/ -#define CF_PREOPEN_TMP_TABLES (1U << 10) - -/** - Identifies statements for which open handlers should be closed in the - beginning of the statement. -*/ -#define CF_HA_CLOSE (1U << 11) - -/** - Identifies statements that can be explained with EXPLAIN. -*/ -#define CF_CAN_BE_EXPLAINED (1U << 12) - -/** Identifies statements which may generate an optimizer trace */ -#define CF_OPTIMIZER_TRACE (1U << 14) - -/** - Identifies statements that should always be disallowed in - read only transactions. -*/ -#define CF_DISALLOW_IN_RO_TRANS (1U << 15) - -/** - Statement that need the binlog format to be unchanged. -*/ -#define CF_FORCE_ORIGINAL_BINLOG_FORMAT (1U << 16) - -/** - Statement that inserts new rows (INSERT, REPLACE, LOAD, ALTER TABLE) -*/ -#define CF_INSERTS_DATA (1U << 17) - -/** - Statement that updates existing rows (UPDATE, multi-update) -*/ -#define CF_UPDATES_DATA (1U << 18) - -/** - Not logged into slow log as "admin commands" -*/ -#define CF_ADMIN_COMMAND (1U << 19) - -/** - SP Bulk execution safe -*/ -#define CF_PS_ARRAY_BINDING_SAFE (1U << 20) -/** - SP Bulk execution optimized -*/ -#define CF_PS_ARRAY_BINDING_OPTIMIZED (1U << 21) -/** - If command creates or drops a table -*/ -#define CF_SCHEMA_CHANGE (1U << 22) -/** - If command creates or drops a database -*/ -#define CF_DB_CHANGE (1U << 23) - -#ifdef WITH_WSREP -/** - DDL statement that may be subject to error filtering. -*/ -#define CF_WSREP_MAY_IGNORE_ERRORS (1U << 24) -#endif /* WITH_WSREP */ - - -/* Bits in server_command_flags */ - -/** - Statement that deletes existing rows (DELETE, DELETE_MULTI) -*/ -#define CF_DELETES_DATA (1U << 24) - -/** - Skip the increase of the global query id counter. Commonly set for - commands that are stateless (won't cause any change on the server - internal states). -*/ -#define CF_SKIP_QUERY_ID (1U << 0) - -/** - Skip the increase of the number of statements that clients have - sent to the server. Commonly used for commands that will cause - a statement to be executed but the statement might have not been - sent by the user (ie: stored procedure). -*/ -#define CF_SKIP_QUESTIONS (1U << 1) -#ifdef WITH_WSREP -/** - Do not check that wsrep snapshot is ready before allowing this command -*/ -#define CF_SKIP_WSREP_CHECK (1U << 2) -#else -#define CF_SKIP_WSREP_CHECK 0 -#endif /* WITH_WSREP */ - -/** - Do not allow it for COM_MULTI batch -*/ -#define CF_NO_COM_MULTI (1U << 3) - -/* Inline functions */ - -inline bool add_item_to_list(THD *thd, Item *item) -{ - bool res= thd->lex->current_select->add_item_to_list(thd, item); - return res; -} - -inline bool add_value_to_list(THD *thd, Item *value) -{ - return thd->lex->value_list.push_back(value, thd->mem_root); -} - -inline bool add_order_to_list(THD *thd, Item *item, bool asc) -{ - return thd->lex->current_select->add_order_to_list(thd, item, asc); -} - -inline bool add_gorder_to_list(THD *thd, Item *item, bool asc) -{ - return thd->lex->current_select->add_gorder_to_list(thd, item, asc); -} - -inline bool add_group_to_list(THD *thd, Item *item, bool asc) -{ - return thd->lex->current_select->add_group_to_list(thd, item, asc); -} - -inline Item *and_conds(THD *thd, Item *a, Item *b) -{ - if (!b) return a; - if (!a) return b; - return new (thd->mem_root) Item_cond_and(thd, a, b); -} - -/* inline handler methods that need to know TABLE and THD structures */ -inline void handler::increment_statistics(ulong SSV::*offset) const -{ - status_var_increment(table->in_use->status_var.*offset); - table->in_use->check_limit_rows_examined(); -} - -inline void handler::decrement_statistics(ulong SSV::*offset) const -{ - status_var_decrement(table->in_use->status_var.*offset); -} - - -inline int handler::ha_ft_read(uchar *buf) -{ - int error= ft_read(buf); - if (!error) - update_rows_read(); - - table->status=error ? STATUS_NOT_FOUND: 0; - return error; -} - -inline int handler::ha_rnd_pos_by_record(uchar *buf) -{ - int error= rnd_pos_by_record(buf); - table->status=error ? STATUS_NOT_FOUND: 0; - return error; -} - -inline int handler::ha_read_first_row(uchar *buf, uint primary_key) -{ - int error= read_first_row(buf, primary_key); - if (!error) - update_rows_read(); - table->status=error ? STATUS_NOT_FOUND: 0; - return error; -} - -inline int handler::ha_write_tmp_row(uchar *buf) -{ - int error; - MYSQL_INSERT_ROW_START(table_share->db.str, table_share->table_name.str); - increment_statistics(&SSV::ha_tmp_write_count); - TABLE_IO_WAIT(tracker, PSI_TABLE_WRITE_ROW, MAX_KEY, error, - { error= write_row(buf); }) - MYSQL_INSERT_ROW_DONE(error); - return error; -} - -inline int handler::ha_delete_tmp_row(uchar *buf) -{ - int error; - MYSQL_DELETE_ROW_START(table_share->db.str, table_share->table_name.str); - increment_statistics(&SSV::ha_tmp_delete_count); - TABLE_IO_WAIT(tracker, PSI_TABLE_DELETE_ROW, MAX_KEY, error, - { error= delete_row(buf); }) - MYSQL_DELETE_ROW_DONE(error); - return error; -} - -inline int handler::ha_update_tmp_row(const uchar *old_data, uchar *new_data) -{ - int error; - MYSQL_UPDATE_ROW_START(table_share->db.str, table_share->table_name.str); - increment_statistics(&SSV::ha_tmp_update_count); - TABLE_IO_WAIT(tracker, PSI_TABLE_UPDATE_ROW, active_index, error, - { error= update_row(old_data, new_data);}) - MYSQL_UPDATE_ROW_DONE(error); - return error; -} - -inline bool handler::has_long_unique() -{ - return table->s->long_unique_table; -} - -extern pthread_attr_t *get_connection_attrib(void); - -/** - Set thread entering a condition - - This function should be called before putting a thread to wait for - a condition. @a mutex should be held before calling this - function. After being waken up, @f thd_exit_cond should be called. - - @param thd The thread entering the condition, NULL means current thread - @param cond The condition the thread is going to wait for - @param mutex The mutex associated with the condition, this must be - held before call this function - @param stage The new process message for the thread - @param old_stage The old process message for the thread - @param src_function The caller source function name - @param src_file The caller source file name - @param src_line The caller source line number -*/ -void thd_enter_cond(MYSQL_THD thd, mysql_cond_t *cond, mysql_mutex_t *mutex, - const PSI_stage_info *stage, PSI_stage_info *old_stage, - const char *src_function, const char *src_file, - int src_line); - -#define THD_ENTER_COND(P1, P2, P3, P4, P5) \ - thd_enter_cond(P1, P2, P3, P4, P5, __func__, __FILE__, __LINE__) - -/** - Set thread leaving a condition - - This function should be called after a thread being waken up for a - condition. - - @param thd The thread entering the condition, NULL means current thread - @param stage The process message, ususally this should be the old process - message before calling @f thd_enter_cond - @param src_function The caller source function name - @param src_file The caller source file name - @param src_line The caller source line number -*/ -void thd_exit_cond(MYSQL_THD thd, const PSI_stage_info *stage, - const char *src_function, const char *src_file, - int src_line); - -#define THD_EXIT_COND(P1, P2) \ - thd_exit_cond(P1, P2, __func__, __FILE__, __LINE__) - -inline bool binlog_should_compress(size_t len) -{ - return opt_bin_log_compress && - len >= opt_bin_log_compress_min_len; -} - - -/** - Save thd sql_mode on instantiation. - On destruction it resets the mode to the previously stored value. -*/ -class Sql_mode_save -{ - public: - Sql_mode_save(THD *thd) : thd(thd), old_mode(thd->variables.sql_mode) {} - ~Sql_mode_save() { thd->variables.sql_mode = old_mode; } - - private: - THD *thd; - sql_mode_t old_mode; // SQL mode saved at construction time. -}; - -class Switch_to_definer_security_ctx -{ - public: - Switch_to_definer_security_ctx(THD *thd, TABLE_LIST *table) : - m_thd(thd), m_sctx(thd->security_ctx) - { - if (table->security_ctx) - thd->security_ctx= table->security_ctx; - } - ~Switch_to_definer_security_ctx() { m_thd->security_ctx = m_sctx; } - - private: - THD *m_thd; - Security_context *m_sctx; -}; - - -class Sql_mode_instant_set: public Sql_mode_save -{ -public: - Sql_mode_instant_set(THD *thd, sql_mode_t temporary_value) - :Sql_mode_save(thd) - { - thd->variables.sql_mode= temporary_value; - } -}; - - -class Sql_mode_instant_remove: public Sql_mode_save -{ -public: - Sql_mode_instant_remove(THD *thd, sql_mode_t temporary_remove_flags) - :Sql_mode_save(thd) - { - thd->variables.sql_mode&= ~temporary_remove_flags; - } -}; - - -class Abort_on_warning_instant_set -{ - THD *m_thd; - bool m_save_abort_on_warning; -public: - Abort_on_warning_instant_set(THD *thd, bool temporary_value) - :m_thd(thd), m_save_abort_on_warning(thd->abort_on_warning) - { - thd->abort_on_warning= temporary_value; - } - ~Abort_on_warning_instant_set() - { - m_thd->abort_on_warning= m_save_abort_on_warning; - } -}; - - -class Check_level_instant_set -{ - THD *m_thd; - enum_check_fields m_check_level; -public: - Check_level_instant_set(THD *thd, enum_check_fields temporary_value) - :m_thd(thd), m_check_level(thd->count_cuted_fields) - { - thd->count_cuted_fields= temporary_value; - } - ~Check_level_instant_set() - { - m_thd->count_cuted_fields= m_check_level; - } -}; - - -/** - This class resembles the SQL Standard schema qualified object name: - ::= [ ] -*/ -class Database_qualified_name -{ -public: - LEX_CSTRING m_db; - LEX_CSTRING m_name; - Database_qualified_name(const LEX_CSTRING *db, const LEX_CSTRING *name) - :m_db(*db), m_name(*name) - { } - Database_qualified_name(const LEX_CSTRING &db, const LEX_CSTRING &name) - :m_db(db), m_name(name) - { } - Database_qualified_name(const char *db, size_t db_length, - const char *name, size_t name_length) - { - m_db.str= db; - m_db.length= db_length; - m_name.str= name; - m_name.length= name_length; - } - - bool eq(const Database_qualified_name *other) const - { - CHARSET_INFO *cs= lower_case_table_names ? - &my_charset_utf8mb3_general_ci : - &my_charset_utf8mb3_bin; - return - m_db.length == other->m_db.length && - m_name.length == other->m_name.length && - !cs->strnncoll(m_db.str, m_db.length, - other->m_db.str, other->m_db.length) && - !cs->strnncoll(m_name.str, m_name.length, - other->m_name.str, other->m_name.length); - } - void copy(MEM_ROOT *mem_root, const LEX_CSTRING &db, - const LEX_CSTRING &name); - // Export db and name as a qualified name string: 'db.name' - size_t make_qname(char *dst, size_t dstlen) const - { - return my_snprintf(dst, dstlen, "%.*s.%.*s", - (int) m_db.length, m_db.str, - (int) m_name.length, m_name.str); - } - // Export db and name as a qualified name string, allocate on mem_root. - bool make_qname(MEM_ROOT *mem_root, LEX_CSTRING *dst) const - { - const uint dot= !!m_db.length; - char *tmp; - /* format: [database + dot] + name + '\0' */ - dst->length= m_db.length + dot + m_name.length; - if (unlikely(!(dst->str= tmp= (char*) alloc_root(mem_root, - dst->length + 1)))) - return true; - sprintf(tmp, "%.*s%.*s%.*s", - (int) m_db.length, (m_db.length ? m_db.str : ""), - dot, ".", - (int) m_name.length, m_name.str); - DBUG_SLOW_ASSERT(ok_for_lower_case_names(m_db.str)); - return false; - } - - bool make_package_routine_name(MEM_ROOT *mem_root, - const LEX_CSTRING &package, - const LEX_CSTRING &routine) - { - char *tmp; - size_t length= package.length + 1 + routine.length + 1; - if (unlikely(!(tmp= (char *) alloc_root(mem_root, length)))) - return true; - m_name.length= my_snprintf(tmp, length, "%.*s.%.*s", - (int) package.length, package.str, - (int) routine.length, routine.str); - m_name.str= tmp; - return false; - } - - bool make_package_routine_name(MEM_ROOT *mem_root, - const LEX_CSTRING &db, - const LEX_CSTRING &package, - const LEX_CSTRING &routine) - { - if (unlikely(make_package_routine_name(mem_root, package, routine))) - return true; - if (unlikely(!(m_db.str= strmake_root(mem_root, db.str, db.length)))) - return true; - m_db.length= db.length; - return false; - } -}; - - -class ErrConvDQName: public ErrConv -{ - const Database_qualified_name *m_name; -public: - ErrConvDQName(const Database_qualified_name *name) - :m_name(name) - { } - const char *ptr() const - { - m_name->make_qname(err_buffer, sizeof(err_buffer)); - return err_buffer; - } -}; - -class Type_holder: public Sql_alloc, - public Item_args, - public Type_handler_hybrid_field_type, - public Type_all_attributes -{ - const TYPELIB *m_typelib; - bool m_maybe_null; -public: - Type_holder() - :m_typelib(NULL), - m_maybe_null(false) - { } - - void set_maybe_null(bool maybe_null_arg) { m_maybe_null= maybe_null_arg; } - bool get_maybe_null() const { return m_maybe_null; } - - uint decimal_precision() const - { - /* - Type_holder is not used directly to create fields, so - its virtual decimal_precision() is never called. - We should eventually extend create_result_table() to accept - an array of Type_holders directly, without having to allocate - Item_type_holder's and put them into List. - */ - DBUG_ASSERT(0); - return 0; - } - void set_typelib(const TYPELIB *typelib) - { - m_typelib= typelib; - } - const TYPELIB *get_typelib() const - { - return m_typelib; - } - - bool aggregate_attributes(THD *thd) - { - for (uint i= 0; i < arg_count; i++) - m_maybe_null|= args[i]->maybe_null; - return - type_handler()->Item_hybrid_func_fix_attributes(thd, - "UNION", this, this, - args, arg_count); - } -}; - - -/* - A helper class to set THD flags to emit warnings/errors in case of - overflow/type errors during assigning values into the SP variable fields. - Saves original flags values in constructor. - Restores original flags in destructor. -*/ -class Sp_eval_expr_state -{ - THD *m_thd; - enum_check_fields m_count_cuted_fields; - bool m_abort_on_warning; - bool m_stmt_modified_non_trans_table; - void start() - { - m_thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL; - m_thd->abort_on_warning= m_thd->is_strict_mode(); - m_thd->transaction->stmt.modified_non_trans_table= false; - } - void stop() - { - m_thd->count_cuted_fields= m_count_cuted_fields; - m_thd->abort_on_warning= m_abort_on_warning; - m_thd->transaction->stmt.modified_non_trans_table= - m_stmt_modified_non_trans_table; - } -public: - Sp_eval_expr_state(THD *thd) - :m_thd(thd), - m_count_cuted_fields(thd->count_cuted_fields), - m_abort_on_warning(thd->abort_on_warning), - m_stmt_modified_non_trans_table(thd->transaction->stmt. - modified_non_trans_table) - { - start(); - } - ~Sp_eval_expr_state() - { - stop(); - } -}; - - -#ifndef DBUG_OFF -void dbug_serve_apcs(THD *thd, int n_calls); -#endif - -class ScopedStatementReplication -{ -public: - ScopedStatementReplication(THD *thd) : - saved_binlog_format(thd - ? thd->set_current_stmt_binlog_format_stmt() - : BINLOG_FORMAT_MIXED), - thd(thd) - {} - ~ScopedStatementReplication() - { - if (thd) - thd->restore_stmt_binlog_format(saved_binlog_format); - } - -private: - const enum_binlog_format saved_binlog_format; - THD *const thd; -}; - - -/** THD registry */ -class THD_list: public THD_list_iterator -{ -public: - /** - Constructor replacement. - - Unfortunately we can't use fair constructor to initialize mutex - for two reasons: PFS and embedded. The former can probably be fixed, - the latter can probably be dropped. - */ - void init() - { - mysql_rwlock_init(key_rwlock_THD_list, &lock); - } - - /** Destructor replacement. */ - void destroy() - { - mysql_rwlock_destroy(&lock); - } - - /** - Inserts thread to registry. - - @param thd thread - - Thread becomes accessible via server_threads. - */ - void insert(THD *thd) - { - mysql_rwlock_wrlock(&lock); - threads.append(thd); - mysql_rwlock_unlock(&lock); - } - - /** - Removes thread from registry. - - @param thd thread - - Thread becomes not accessible via server_threads. - */ - void erase(THD *thd) - { - thd->assert_linked(); - mysql_rwlock_wrlock(&lock); - thd->unlink(); - mysql_rwlock_unlock(&lock); - } -}; - -extern THD_list server_threads; - -#endif /* MYSQL_SERVER */ -#endif /* SQL_CLASS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cmd.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cmd.h deleted file mode 100644 index ce34852..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cmd.h +++ /dev/null @@ -1,281 +0,0 @@ -/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file Representation of an SQL command. -*/ - -#ifndef SQL_CMD_INCLUDED -#define SQL_CMD_INCLUDED - -/* - When a command is added here, be sure it's also added in mysqld.cc - in "struct show_var_st status_vars[]= {" ... - - If the command returns a result set or is not allowed in stored - functions or triggers, please also make sure that - sp_get_flags_for_command (sp_head.cc) returns proper flags for the - added SQLCOM_. -*/ - -enum enum_sql_command { - SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_ALTER_TABLE, - SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT, - SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX, - - SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS, - SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_STATUS, - SQLCOM_SHOW_ENGINE_LOGS, SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ENGINE_MUTEX, - SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_BINLOG_STAT, SQLCOM_SHOW_SLAVE_STAT, - SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS, - SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS, - SQLCOM_SHOW_TRIGGERS, - - SQLCOM_LOAD,SQLCOM_SET_OPTION,SQLCOM_LOCK_TABLES,SQLCOM_UNLOCK_TABLES, - SQLCOM_GRANT, - SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB, - SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT, - SQLCOM_CREATE_FUNCTION, SQLCOM_DROP_FUNCTION, - SQLCOM_REVOKE,SQLCOM_OPTIMIZE, SQLCOM_CHECK, - SQLCOM_ASSIGN_TO_KEYCACHE, SQLCOM_PRELOAD_KEYS, - SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE, - SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT, - SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT, - SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP, - SQLCOM_BEGIN, SQLCOM_CHANGE_MASTER, - SQLCOM_RENAME_TABLE, - SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_PURGE_BEFORE, SQLCOM_SHOW_BINLOGS, - SQLCOM_SHOW_OPEN_TABLES, - SQLCOM_HA_OPEN, SQLCOM_HA_CLOSE, SQLCOM_HA_READ, - SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI, - SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_DO, - SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS, - SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_PRIVILEGES, - SQLCOM_HELP, SQLCOM_CREATE_USER, SQLCOM_DROP_USER, SQLCOM_RENAME_USER, - SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM, - SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CALL, - SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE,SQLCOM_ALTER_FUNCTION, - SQLCOM_SHOW_CREATE_PROC, SQLCOM_SHOW_CREATE_FUNC, - SQLCOM_SHOW_STATUS_PROC, SQLCOM_SHOW_STATUS_FUNC, - SQLCOM_PREPARE, SQLCOM_EXECUTE, SQLCOM_DEALLOCATE_PREPARE, - SQLCOM_CREATE_VIEW, SQLCOM_DROP_VIEW, - SQLCOM_CREATE_TRIGGER, SQLCOM_DROP_TRIGGER, - SQLCOM_XA_START, SQLCOM_XA_END, SQLCOM_XA_PREPARE, - SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER, - SQLCOM_SHOW_PROC_CODE, SQLCOM_SHOW_FUNC_CODE, - SQLCOM_ALTER_TABLESPACE, - SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN, - SQLCOM_SHOW_AUTHORS, SQLCOM_BINLOG_BASE64_EVENT, - SQLCOM_SHOW_PLUGINS, SQLCOM_SHOW_CONTRIBUTORS, - SQLCOM_CREATE_SERVER, SQLCOM_DROP_SERVER, SQLCOM_ALTER_SERVER, - SQLCOM_CREATE_EVENT, SQLCOM_ALTER_EVENT, SQLCOM_DROP_EVENT, - SQLCOM_SHOW_CREATE_EVENT, SQLCOM_SHOW_EVENTS, - SQLCOM_SHOW_CREATE_TRIGGER, - SQLCOM_ALTER_DB_UPGRADE, - SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES, - SQLCOM_SIGNAL, SQLCOM_RESIGNAL, - SQLCOM_SHOW_RELAYLOG_EVENTS, - SQLCOM_GET_DIAGNOSTICS, - SQLCOM_SLAVE_ALL_START, SQLCOM_SLAVE_ALL_STOP, - SQLCOM_SHOW_EXPLAIN, SQLCOM_SHUTDOWN, - SQLCOM_CREATE_ROLE, SQLCOM_DROP_ROLE, SQLCOM_GRANT_ROLE, SQLCOM_REVOKE_ROLE, - SQLCOM_COMPOUND, - SQLCOM_SHOW_GENERIC, - SQLCOM_ALTER_USER, - SQLCOM_SHOW_CREATE_USER, - SQLCOM_EXECUTE_IMMEDIATE, - SQLCOM_CREATE_SEQUENCE, - SQLCOM_DROP_SEQUENCE, - SQLCOM_ALTER_SEQUENCE, - SQLCOM_CREATE_PACKAGE, - SQLCOM_DROP_PACKAGE, - SQLCOM_CREATE_PACKAGE_BODY, - SQLCOM_DROP_PACKAGE_BODY, - SQLCOM_SHOW_CREATE_PACKAGE, - SQLCOM_SHOW_CREATE_PACKAGE_BODY, - SQLCOM_SHOW_STATUS_PACKAGE, - SQLCOM_SHOW_STATUS_PACKAGE_BODY, - SQLCOM_SHOW_PACKAGE_BODY_CODE, - SQLCOM_BACKUP, SQLCOM_BACKUP_LOCK, - - /* - When a command is added here, be sure it's also added in mysqld.cc - in "struct show_var_st com_status_vars[]= {" ... - */ - /* This should be the last !!! */ - SQLCOM_END -}; - - -class Storage_engine_name -{ -protected: - LEX_CSTRING m_storage_engine_name; -public: - Storage_engine_name() - { - m_storage_engine_name.str= NULL; - m_storage_engine_name.length= 0; - } - Storage_engine_name(const LEX_CSTRING &name) - :m_storage_engine_name(name) - { } - Storage_engine_name(const LEX_STRING &name) - { - m_storage_engine_name.str= name.str; - m_storage_engine_name.length= name.length; - } - bool resolve_storage_engine_with_error(THD *thd, - handlerton **ha, - bool tmp_table); - bool is_set() { return m_storage_engine_name.str != NULL; } -}; - - -/** - @class Sql_cmd - Representation of an SQL command. - - This class is an interface between the parser and the runtime. - The parser builds the appropriate derived classes of Sql_cmd - to represent a SQL statement in the parsed tree. - The execute() method in the derived classes of Sql_cmd contain the runtime - implementation. - Note that this interface is used for SQL statements recently implemented, - the code for older statements tend to load the LEX structure with more - attributes instead. - Implement new statements by sub-classing Sql_cmd, as this improves - code modularity (see the 'big switch' in dispatch_command()), and decreases - the total size of the LEX structure (therefore saving memory in stored - programs). - The recommended name of a derived class of Sql_cmd is Sql_cmd_. - - Notice that the Sql_cmd class should not be confused with the - Statement class. Statement is a class that is used to manage an SQL - command or a set of SQL commands. When the SQL statement text is - analyzed, the parser will create one or more Sql_cmd objects to - represent the actual SQL commands. -*/ -class Sql_cmd : public Sql_alloc -{ -private: - Sql_cmd(const Sql_cmd &); // No copy constructor wanted - void operator=(Sql_cmd &); // No assignment operator wanted - -public: - /** - @brief Return the command code for this statement - */ - virtual enum_sql_command sql_command_code() const = 0; - - /** - Execute this SQL statement. - @param thd the current thread. - @retval false on success. - @retval true on error - */ - virtual bool execute(THD *thd) = 0; - - virtual Storage_engine_name *option_storage_engine_name() - { - return NULL; - } - -protected: - Sql_cmd() - {} - - virtual ~Sql_cmd() - { - /* - Sql_cmd objects are allocated in thd->mem_root. - In MySQL, the C++ destructor is never called, the underlying MEM_ROOT is - simply destroyed instead. - Do not rely on the destructor for any cleanup. - */ - DBUG_ASSERT(FALSE); - } -}; - -class Sql_cmd_show_slave_status: public Sql_cmd -{ -protected: - bool show_all_slaves_status; -public: - Sql_cmd_show_slave_status() - :show_all_slaves_status(false) - {} - - Sql_cmd_show_slave_status(bool status_all) - :show_all_slaves_status(status_all) - {} - - enum_sql_command sql_command_code() const { return SQLCOM_SHOW_SLAVE_STAT; } - - bool execute(THD *thd); - bool is_show_all_slaves_stat() { return show_all_slaves_status; } -}; - - -class Sql_cmd_create_table_like: public Sql_cmd, - public Storage_engine_name -{ -public: - Storage_engine_name *option_storage_engine_name() { return this; } - bool execute(THD *thd); -}; - -class Sql_cmd_create_table: public Sql_cmd_create_table_like -{ -public: - enum_sql_command sql_command_code() const { return SQLCOM_CREATE_TABLE; } -}; - -class Sql_cmd_create_sequence: public Sql_cmd_create_table_like -{ -public: - enum_sql_command sql_command_code() const { return SQLCOM_CREATE_SEQUENCE; } -}; - - -/** - Sql_cmd_call represents the CALL statement. -*/ -class Sql_cmd_call : public Sql_cmd -{ -public: - class sp_name *m_name; - const class Sp_handler *m_handler; - Sql_cmd_call(class sp_name *name, const class Sp_handler *handler) - :m_name(name), - m_handler(handler) - {} - - virtual ~Sql_cmd_call() - {} - - /** - Execute a CALL statement at runtime. - @param thd the current thread. - @return false on success. - */ - bool execute(THD *thd); - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_CALL; - } -}; - -#endif // SQL_CMD_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_connect.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_connect.h deleted file mode 100644 index 152bd71..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_connect.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_CONNECT_INCLUDED -#define SQL_CONNECT_INCLUDED - -#include /* pthread_handler_t */ -#include "mysql_com.h" /* enum_server_command */ -#include "structs.h" -#include -#include -#include "violite.h" - -/* - Object to hold connect information to be given to the newly created thread -*/ - -struct scheduler_functions; - -class CONNECT : public ilink { -public: - MYSQL_SOCKET sock; -#ifdef _WIN32 - HANDLE pipe; - CONNECT(HANDLE pipe_arg): pipe(pipe_arg), vio_type(VIO_TYPE_NAMEDPIPE), - scheduler(thread_scheduler), thread_id(0), prior_thr_create_utime(0) {} -#endif - enum enum_vio_type vio_type; - scheduler_functions *scheduler; - my_thread_id thread_id; - - /* Own variables */ - ulonglong prior_thr_create_utime; - - CONNECT(MYSQL_SOCKET sock_arg, enum enum_vio_type vio_type_arg, - scheduler_functions *scheduler_arg): sock(sock_arg), - vio_type(vio_type_arg), scheduler(scheduler_arg), thread_id(0), - prior_thr_create_utime(0) {} - ~CONNECT() { DBUG_ASSERT(vio_type == VIO_CLOSED); } - void close_and_delete(); - void close_with_error(uint sql_errno, - const char *message, uint close_error); - THD *create_thd(THD *thd); -}; - - -class THD; -typedef struct user_conn USER_CONN; - -void init_max_user_conn(void); -void init_global_user_stats(void); -void init_global_table_stats(void); -void init_global_index_stats(void); -void init_global_client_stats(void); -void free_max_user_conn(void); -void free_global_user_stats(void); -void free_global_table_stats(void); -void free_global_index_stats(void); -void free_global_client_stats(void); - -pthread_handler_t handle_one_connection(void *arg); -void do_handle_one_connection(CONNECT *connect, bool put_in_cache); -bool init_new_connection_handler_thread(); -void reset_mqh(LEX_USER *lu, bool get_them); -bool check_mqh(THD *thd, uint check_command); -void time_out_user_resource_limits(THD *thd, USER_CONN *uc); -#ifndef NO_EMBEDDED_ACCESS_CHECKS -void decrease_user_connections(USER_CONN *uc); -#else -#define decrease_user_connections(X) do { } while(0) /* nothing */ -#endif -bool thd_init_client_charset(THD *thd, uint cs_number); -void setup_connection_thread_globals(THD *thd); -bool thd_prepare_connection(THD *thd); -bool thd_is_connection_alive(THD *thd); -int thd_set_peer_addr(THD *thd, sockaddr_storage *addr, - const char *ip, uint port, - bool check_proxy_networks, - uint *host_errors); - -bool login_connection(THD *thd); -void prepare_new_connection_state(THD* thd); -void end_connection(THD *thd); -void update_global_user_stats(THD* thd, bool create_user, time_t now); -int get_or_create_user_conn(THD *thd, const char *user, - const char *host, const USER_RESOURCES *mqh); -int check_for_max_user_connections(THD *thd, USER_CONN *uc); - -extern HASH global_user_stats; -extern HASH global_client_stats; -extern HASH global_table_stats; -extern HASH global_index_stats; - -extern mysql_mutex_t LOCK_global_user_client_stats; -extern mysql_mutex_t LOCK_global_table_stats; -extern mysql_mutex_t LOCK_global_index_stats; -extern mysql_mutex_t LOCK_stats; - -#endif /* SQL_CONNECT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_const.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_const.h deleted file mode 100644 index 3f053a1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_const.h +++ /dev/null @@ -1,315 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - File containing constants that can be used throughout the server. - - @note This file shall not contain or include any declarations of any kinds. -*/ - -#ifndef SQL_CONST_INCLUDED -#define SQL_CONST_INCLUDED - -#include - -#define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */ -/* extra 4+4 bytes for slave tmp tables */ -#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4) -#define MAX_ALIAS_NAME 256 -#define MAX_FIELD_NAME 34 /* Max colum name length +2 */ -#define MAX_SYS_VAR_LENGTH 32 -#define MAX_KEY MAX_INDEXES /* Max used keys */ -#define MAX_REF_PARTS 32 /* Max parts used as ref */ - -/* - Maximum length of the data part of an index lookup key. - - The "data part" is defined as the value itself, not including the - NULL-indicator bytes or varchar length bytes ("the Extras"). We need this - value because there was a bug where length of the Extras were not counted. - - You probably need MAX_KEY_LENGTH, not this constant. -*/ -#define MAX_DATA_LENGTH_FOR_KEY 3072 -#if SIZEOF_OFF_T > 4 -#define MAX_REFLENGTH 8 /* Max length for record ref */ -#else -#define MAX_REFLENGTH 4 /* Max length for record ref */ -#endif -#define MAX_HOSTNAME 61 /* len+1 in mysql.user */ -#define MAX_CONNECTION_NAME NAME_LEN - -#define MAX_MBWIDTH 3 /* Max multibyte sequence */ -#define MAX_FILENAME_MBWIDTH 5 -#define MAX_FIELD_CHARLENGTH 255 -/* - In MAX_FIELD_VARCHARLENGTH we reserve extra bytes for the overhead: - - 2 bytes for the length - - 1 byte for NULL bits - to avoid the "Row size too large" error for these three corner definitions: - CREATE TABLE t1 (c VARBINARY(65533)); - CREATE TABLE t1 (c VARBINARY(65534)); - CREATE TABLE t1 (c VARBINARY(65535)); - Like VARCHAR(65536), they will be converted to BLOB automatically - in non-strict mode. -*/ -#define MAX_FIELD_VARCHARLENGTH (65535-2-1) -#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */ -#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Threshold *in characters* */ - -/* Max column width +1 */ -#define MAX_FIELD_WIDTH (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1) - -#define MAX_BIT_FIELD_LENGTH 64 /* Max length in bits for bit fields */ - -#define MAX_DATE_WIDTH 10 /* YYYY-MM-DD */ -#define MIN_TIME_WIDTH 10 /* -HHH:MM:SS */ -#define MAX_TIME_WIDTH 16 /* -DDDDDD HH:MM:SS */ -#define MAX_TIME_FULL_WIDTH 23 /* -DDDDDD HH:MM:SS.###### */ -#define MAX_DATETIME_FULL_WIDTH 26 /* YYYY-MM-DD HH:MM:SS.###### */ -#define MAX_DATETIME_WIDTH 19 /* YYYY-MM-DD HH:MM:SS */ -#define MAX_DATETIME_COMPRESSED_WIDTH 14 /* YYYYMMDDHHMMSS */ -#define MAX_DATETIME_PRECISION 6 - -#define MAX_TABLES (sizeof(table_map)*8-3) /* Max tables in join */ -#define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3)) -#define OUTER_REF_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-2)) -#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1)) -#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \ - RAND_TABLE_BIT) -#define CONNECT_STRING_MAXLEN 65535 /* stored in 2 bytes in .frm */ -#define MAX_FIELDS 4096 /* Limit in the .frm file */ -#define MAX_PARTITIONS 8192 - -#define MAX_SELECT_NESTING (SELECT_NESTING_MAP_SIZE - 1) - -#define MAX_SORT_MEMORY 2048*1024 -#define MIN_SORT_MEMORY 1024 - -/* Some portable defines */ - -#define STRING_BUFFER_USUAL_SIZE 80 - -/* Memory allocated when parsing a statement / saving a statement */ -#define MEM_ROOT_BLOCK_SIZE 8192 -#define MEM_ROOT_PREALLOC 8192 -#define TRANS_MEM_ROOT_BLOCK_SIZE 4096 -#define TRANS_MEM_ROOT_PREALLOC 4096 - -#define DEFAULT_ERROR_COUNT 64 -#define EXTRA_RECORDS 10 /* Extra records in sort */ -#define SCROLL_EXTRA 5 /* Extra scroll-rows. */ -#define FIELD_NAME_USED ((uint) 32768) /* Bit set if fieldname used */ -#define FORM_NAME_USED ((uint) 16384) /* Bit set if formname used */ -#define FIELD_NR_MASK 16383 /* To get fieldnumber */ -#define FERR -1 /* Error from my_functions */ -#define CREATE_MODE 0 /* Default mode on new files */ -#define NAMES_SEP_CHAR 255 /* Char to sep. names */ - -#define READ_RECORD_BUFFER (uint) (IO_SIZE*8) /* Pointer_buffer_size */ -#define DISK_BUFFER_SIZE (uint) (IO_SIZE*16) /* Size of diskbuffer */ - -#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */ -#define FRM_VER_EXPRESSSIONS (FRM_VER+5) /* 11 */ -#define FRM_VER_CURRENT FRM_VER_EXPRESSSIONS - -/*************************************************************************** - Configuration parameters -****************************************************************************/ - -#define ACL_CACHE_SIZE 256 -#define MAX_PASSWORD_LENGTH 32 -#define HOST_CACHE_SIZE 128 -#define MAX_ACCEPT_RETRY 10 // Test accept this many times -#define MAX_FIELDS_BEFORE_HASH 32 -#define USER_VARS_HASH_SIZE 16 -#define SEQUENCES_HASH_SIZE 16 -#define TABLE_OPEN_CACHE_MIN 200 -#define TABLE_OPEN_CACHE_DEFAULT 2000 -#define TABLE_DEF_CACHE_DEFAULT 400 -/** - We must have room for at least 400 table definitions in the table - cache, since otherwise there is no chance prepared - statements that use these many tables can work. - Prepared statements use table definition cache ids (table_map_id) - as table version identifiers. If the table definition - cache size is less than the number of tables used in a statement, - the contents of the table definition cache is guaranteed to rotate - between a prepare and execute. This leads to stable validation - errors. In future we shall use more stable version identifiers, - for now the only solution is to ensure that the table definition - cache can contain at least all tables of a given statement. -*/ -#define TABLE_DEF_CACHE_MIN 400 - -/** - Maximum number of connections default value. - 151 is larger than Apache's default max children, - to avoid "too many connections" error in a common setup. -*/ -#define MAX_CONNECTIONS_DEFAULT 151 - -/* - Stack reservation. - Feel free to raise this by the smallest amount you can to get the - "execution_constants" test to pass. -*/ -#define STACK_MIN_SIZE 16000 // Abort if less stack during eval. - -#define STACK_MIN_SIZE_FOR_OPEN (1024*80) -#define STACK_BUFF_ALLOC 352 ///< For stack overrun checks -#ifndef MYSQLD_NET_RETRY_COUNT -#define MYSQLD_NET_RETRY_COUNT 10 ///< Abort read after this many int. -#endif - -#define QUERY_ALLOC_BLOCK_SIZE 16384 -#define QUERY_ALLOC_PREALLOC_SIZE 24576 -#define TRANS_ALLOC_BLOCK_SIZE 8192 -#define TRANS_ALLOC_PREALLOC_SIZE 4096 -#define RANGE_ALLOC_BLOCK_SIZE 4096 -#define ACL_ALLOC_BLOCK_SIZE 1024 -#define UDF_ALLOC_BLOCK_SIZE 1024 -#define TABLE_ALLOC_BLOCK_SIZE 1024 -#define WARN_ALLOC_BLOCK_SIZE 2048 -#define WARN_ALLOC_PREALLOC_SIZE 1024 -/* - Note that if we are using 32K or less, then TCmalloc will use a local - heap without locks! -*/ -#define SHOW_ALLOC_BLOCK_SIZE (32768-MALLOC_OVERHEAD) - -/* - The following parameters is to decide when to use an extra cache to - optimise seeks when reading a big table in sorted order -*/ -#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024) -#define MIN_ROWS_TO_USE_TABLE_CACHE 100 -#define MIN_ROWS_TO_USE_BULK_INSERT 100 - -/** - The following is used to decide if MySQL should use table scanning - instead of reading with keys. The number says how many evaluation of the - WHERE clause is comparable to reading one extra row from a table. -*/ -#define TIME_FOR_COMPARE 5.0 // 5 WHERE compares == one read -#define TIME_FOR_COMPARE_IDX 20.0 - -#define IDX_BLOCK_COPY_COST ((double) 1 / TIME_FOR_COMPARE) -#define IDX_LOOKUP_COST ((double) 1 / 8) -#define MULTI_RANGE_READ_SETUP_COST (IDX_BLOCK_COPY_COST/10) - -/** - Number of comparisons of table rowids equivalent to reading one row from a - table. -*/ -#define TIME_FOR_COMPARE_ROWID (TIME_FOR_COMPARE*100) - -/* cost1 is better that cost2 only if cost1 + COST_EPS < cost2 */ -#define COST_EPS 0.001 - -/* - For sequential disk seeks the cost formula is: - DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip - - The cost of average seek - DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0. -*/ -#define DISK_SEEK_BASE_COST ((double)0.9) - -#define BLOCKS_IN_AVG_SEEK 128 - -#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK) - - -/** - Number of rows in a reference table when refereed through a not unique key. - This value is only used when we don't know anything about the key - distribution. -*/ -#define MATCHING_ROWS_IN_OTHER_TABLE 10 - -/* - Subquery materialization-related constants -*/ -#define HEAP_TEMPTABLE_LOOKUP_COST 0.05 -#define DISK_TEMPTABLE_LOOKUP_COST 1.0 -#define SORT_INDEX_CMP_COST 0.02 - - -#define COST_MAX (DBL_MAX * (1.0 - DBL_EPSILON)) - -#define COST_ADD(c,d) (COST_MAX - (d) > (c) ? (c) + (d) : COST_MAX) - -#define COST_MULT(c,f) (COST_MAX / (f) > (c) ? (c) * (f) : COST_MAX) - - -#define MY_CHARSET_BIN_MB_MAXLEN 1 - -/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */ -#define KEY_DEFAULT_PACK_LENGTH 8 - -/** Characters shown for the command in 'show processlist'. */ -#define PROCESS_LIST_WIDTH 100 -/* Characters shown for the command in 'information_schema.processlist' */ -#define PROCESS_LIST_INFO_WIDTH 65535 - -#define PRECISION_FOR_DOUBLE 53 -#define PRECISION_FOR_FLOAT 24 - -/* -[digits].E+## */ -#define MAX_FLOAT_STR_LENGTH (FLT_DIG + 6) -/* -[digits].E+### */ -#define MAX_DOUBLE_STR_LENGTH (DBL_DIG + 7) - -/* - Default time to wait before aborting a new client connection - that does not respond to "initial server greeting" timely -*/ -#define CONNECT_TIMEOUT 10 - /* Wait 5 minutes before removing thread from thread cache */ -#define THREAD_CACHE_TIMEOUT 5*60 - -/* The following can also be changed from the command line */ -#define DEFAULT_CONCURRENCY 10 -#define DELAYED_LIMIT 100 /**< pause after xxx inserts */ -#define DELAYED_QUEUE_SIZE 1000 -#define DELAYED_WAIT_TIMEOUT (5*60) /**< Wait for delayed insert */ -#define MAX_CONNECT_ERRORS 100 ///< errors before disabling host - -#define LONG_TIMEOUT ((ulong) 3600L*24L*365L) - -/** - Maximum length of time zone name that we support (Time zone name is - char(64) in db). mysqlbinlog needs it. -*/ -#define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1) - -#if defined(__WIN__) - -#define INTERRUPT_PRIOR -2 -#define CONNECT_PRIOR -1 -#define WAIT_PRIOR 0 -#define QUERY_PRIOR 2 -#else -#define INTERRUPT_PRIOR 10 -#define CONNECT_PRIOR 9 -#define WAIT_PRIOR 8 -#define QUERY_PRIOR 6 -#endif /* __WIN92__ */ - -#define SP_PSI_STATEMENT_INFO_COUNT 19 - -#endif /* SQL_CONST_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_crypt.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_crypt.h deleted file mode 100644 index 3c90550..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_crypt.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef SQL_CRYPT_INCLUDED -#define SQL_CRYPT_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_alloc.h" /* Sql_alloc */ -#include "my_rnd.h" /* rand_struct */ - -class SQL_CRYPT :public Sql_alloc -{ - struct my_rnd_struct rand,org_rand; - char decode_buff[256],encode_buff[256]; - uint shift; - public: - SQL_CRYPT() {} - SQL_CRYPT(ulong *seed) - { - init(seed); - } - ~SQL_CRYPT() {} - void init(ulong *seed); - void reinit() { shift=0; rand=org_rand; } - void encode(char *str, uint length); - void decode(char *str, uint length); -}; - -#endif /* SQL_CRYPT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cte.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cte.h deleted file mode 100644 index 4c42dd2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cte.h +++ /dev/null @@ -1,475 +0,0 @@ -/* - Copyright (c) 2016, 2017 MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef SQL_CTE_INCLUDED -#define SQL_CTE_INCLUDED -#include "sql_list.h" -#include "sql_lex.h" -#include "sql_select.h" - -class select_unit; -struct st_unit_ctxt_elem; - - -/** - @class With_element - @brief Definition of a CTE table - - It contains a reference to the name of the table introduced by this with element, - and a reference to the unit that specificies this table. Also it contains - a reference to the with clause to which this element belongs to. -*/ - -class With_element : public Sql_alloc -{ -private: - With_clause *owner; // with clause this object belongs to - With_element *next; // next element in the with clause - uint number; // number of the element in the with clause (starting from 0) - table_map elem_map; // The map where with only one 1 set in this->number - /* - The map base_dep_map has 1 in the i-th position if the query that - specifies this with element contains a reference to the with element number i - in the query FROM list. - (In this case this with element depends directly on the i-th with element.) - */ - table_map base_dep_map; - /* - The map derived_dep_map has 1 in i-th position if this with element depends - directly or indirectly from the i-th with element. - */ - table_map derived_dep_map; - /* - The map sq_dep_map has 1 in i-th position if there is a reference to this - with element somewhere in subqueries of the specifications of the tables - defined in the with clause containing this element; - */ - table_map sq_dep_map; - table_map work_dep_map; // dependency map used for work - /* Dependency map of with elements mutually recursive with this with element */ - table_map mutually_recursive; - /* - Dependency map built only for the top level references i.e. for those that - are encountered in from lists of the selects of the specification unit - */ - table_map top_level_dep_map; - /* - Points to a recursive reference in subqueries. - Used only for specifications without recursive references on the top level. - */ - TABLE_LIST *sq_rec_ref; - /* - The next with element from the circular chain of the with elements - mutually recursive with this with element. - (If This element is simply recursive than next_mutually_recursive contains - the pointer to itself. If it's not recursive than next_mutually_recursive - is set to NULL.) - */ - With_element *next_mutually_recursive; - /* - Total number of references to this element in the FROM lists of - the queries that are in the scope of the element (including - subqueries and specifications of other with elements). - */ - uint references; - /* - Unparsed specification of the query that specifies this element. - It used to build clones of the specification if they are needed. - */ - LEX_CSTRING unparsed_spec; - /* Offset of the specification in the input string */ - my_ptrdiff_t unparsed_spec_offset; - - /* True if the with element is used a prepared statement */ - bool stmt_prepare_mode; - - /* Return the map where 1 is set only in the position for this element */ - table_map get_elem_map() { return (table_map) 1 << number; } - -public: - /* - The name of the table introduced by this with elememt. The name - can be used in FROM lists of the queries in the scope of the element. - */ - LEX_CSTRING *query_name; - /* - Optional list of column names to name the columns of the table introduced - by this with element. It is used in the case when the names are not - inherited from the query that specified the table. Otherwise the list is - always empty. - */ - List column_list; - List *cycle_list; - /* The query that specifies the table introduced by this with element */ - st_select_lex_unit *spec; - /* - Set to true is recursion is used (directly or indirectly) - for the definition of this element - */ - bool is_recursive; - /* - For a simple recursive CTE: the number of references to the CTE from - outside of the CTE specification. - For a CTE mutually recursive with other CTEs : the total number of - references to all these CTEs outside of their specification. - Each of these mutually recursive CTEs has the same value in this field. - */ - uint rec_outer_references; - /* - Any non-recursive select in the specification of a recursive - with element is a called anchor. In the case mutually recursive - elements the specification of some them may be without any anchor. - Yet at least one of them must contain an anchor. - All anchors of any recursivespecification are moved ahead before - the prepare stage. - */ - /* Set to true if this is a recursive element with an anchor */ - bool with_anchor; - /* - Set to the first recursive select of the unit specifying the element - after all anchor have been moved to the head of the unit. - */ - st_select_lex *first_recursive; - - /* - The number of the last performed iteration for recursive table - (the number of the initial non-recursive step is 0, the number - of the first iteration is 1). - */ - uint level; - - /* - The pointer to the object used to materialize this with element - if it's recursive. This object is built at the end of prepare - stage and is used at the execution stage. - */ - select_union_recursive *rec_result; - - /* List of Item_subselects containing recursive references to this CTE */ - SQL_I_List sq_with_rec_ref; - /* List of derived tables containing recursive references to this CTE */ - SQL_I_List derived_with_rec_ref; - - With_element(LEX_CSTRING *name, - List list, - st_select_lex_unit *unit) - : next(NULL), base_dep_map(0), derived_dep_map(0), - sq_dep_map(0), work_dep_map(0), mutually_recursive(0), - top_level_dep_map(0), sq_rec_ref(NULL), - next_mutually_recursive(NULL), references(0), - query_name(name), column_list(list), cycle_list(0), spec(unit), - is_recursive(false), rec_outer_references(0), with_anchor(false), - level(0), rec_result(NULL) - { unit->with_element= this; } - - bool check_dependencies_in_spec(); - - void check_dependencies_in_select(st_select_lex *sl, st_unit_ctxt_elem *ctxt, - bool in_subq, table_map *dep_map); - - void check_dependencies_in_unit(st_select_lex_unit *unit, - st_unit_ctxt_elem *ctxt, - bool in_subq, - table_map *dep_map); - - void check_dependencies_in_with_clause(With_clause *with_clause, - st_unit_ctxt_elem *ctxt, - bool in_subq, - table_map *dep_map); - - void set_dependency_on(With_element *with_elem) - { base_dep_map|= with_elem->get_elem_map(); } - - bool check_dependency_on(With_element *with_elem) - { return base_dep_map & with_elem->get_elem_map(); } - - TABLE_LIST *find_first_sq_rec_ref_in_select(st_select_lex *sel); - - bool set_unparsed_spec(THD *thd, const char *spec_start, const char *spec_end, - my_ptrdiff_t spec_offset); - - st_select_lex_unit *clone_parsed_spec(THD *thd, TABLE_LIST *with_table); - - bool is_referenced() { return references != 0; } - - void inc_references() { references++; } - - bool process_columns_of_derived_unit(THD *thd, st_select_lex_unit *unit); - - bool prepare_unreferenced(THD *thd); - - bool check_unrestricted_recursive(st_select_lex *sel, - table_map &unrestricted, - table_map &encountered); - - void print(THD *thd, String *str, enum_query_type query_type); - - With_clause *get_owner() { return owner; } - - bool contains_sq_with_recursive_reference() - { return sq_dep_map & mutually_recursive; } - - bool no_rec_ref_on_top_level() - { return !(top_level_dep_map & mutually_recursive); } - - table_map get_mutually_recursive() { return mutually_recursive; } - - With_element *get_next_mutually_recursive() - { return next_mutually_recursive; } - - TABLE_LIST *get_sq_rec_ref() { return sq_rec_ref; } - - bool is_anchor(st_select_lex *sel); - - void move_anchors_ahead(); - - bool is_unrestricted(); - - bool is_with_prepared_anchor(); - - void mark_as_with_prepared_anchor(); - - bool is_cleaned(); - - void mark_as_cleaned(); - - void reset_recursive_for_exec(); - - void cleanup_stabilized(); - - void set_as_stabilized(); - - bool is_stabilized(); - - bool all_are_stabilized(); - - bool instantiate_tmp_tables(); - - void prepare_for_next_iteration(); - - void set_cycle_list(List *cycle_list_arg); - - friend class With_clause; -}; - -const uint max_number_of_elements_in_with_clause= sizeof(table_map)*8; - -/** - @class With_clause - @brief Set of with_elements - - It has a reference to the first with element from this with clause. - This reference allows to navigate through all the elements of the with clause. - It contains a reference to the unit to which this with clause is attached. - It also contains a flag saying whether this with clause was specified as recursive. -*/ - -class With_clause : public Sql_alloc -{ -private: - st_select_lex_unit *owner; // the unit this with clause attached to - - /* The list of all with elements from this with clause */ - SQL_I_List with_list; - /* - The with clause immediately containing this with clause if there is any, - otherwise NULL. Now used only at parsing. - */ - With_clause *embedding_with_clause; - /* - The next with the clause of the chain of with clauses encountered - in the current statement - */ - With_clause *next_with_clause; - /* Set to true if dependencies between with elements have been checked */ - bool dependencies_are_checked; - /* - The bitmap of all recursive with elements whose specifications - are not complied with restrictions imposed by the SQL standards - on recursive specifications. - */ - table_map unrestricted; - /* - The bitmap of all recursive with elements whose anchors - has been already prepared. - */ - table_map with_prepared_anchor; - table_map cleaned; - /* - The bitmap of all recursive with elements that - has been already materialized - */ - table_map stabilized; - -public: - /* If true the specifier RECURSIVE is present in the with clause */ - bool with_recursive; - - With_clause(bool recursive_fl, With_clause *emb_with_clause) - : owner(NULL), embedding_with_clause(emb_with_clause), - next_with_clause(NULL), dependencies_are_checked(false), unrestricted(0), - with_prepared_anchor(0), cleaned(0), stabilized(0), - with_recursive(recursive_fl) - { } - - bool add_with_element(With_element *elem); - - /* Add this with clause to the list of with clauses used in the statement */ - void add_to_list(With_clause ** &last_next) - { - *last_next= this; - last_next= &this->next_with_clause; - } - - st_select_lex_unit *get_owner() { return owner; } - - void set_owner(st_select_lex_unit *unit) { owner= unit; } - - void attach_to(st_select_lex *select_lex); - - With_clause *pop() { return embedding_with_clause; } - - bool check_dependencies(); - - bool check_anchors(); - - void move_anchors_ahead(); - - With_element *find_table_def(TABLE_LIST *table, With_element *barrier); - - With_element *find_table_def_in_with_clauses(TABLE_LIST *table); - - bool prepare_unreferenced_elements(THD *thd); - - void add_unrestricted(table_map map) { unrestricted|= map; } - - void print(THD *thd, String *str, enum_query_type query_type); - - friend class With_element; - - friend - bool - check_dependencies_in_with_clauses(With_clause *with_clauses_list); -}; - -inline -bool With_element::is_unrestricted() -{ - return owner->unrestricted & get_elem_map(); -} - -inline -bool With_element::is_with_prepared_anchor() -{ - return owner->with_prepared_anchor & get_elem_map(); -} - -inline -void With_element::mark_as_with_prepared_anchor() -{ - owner->with_prepared_anchor|= mutually_recursive; -} - - -inline -bool With_element::is_cleaned() -{ - return owner->cleaned & get_elem_map(); -} - - -inline -void With_element::mark_as_cleaned() -{ - owner->cleaned|= get_elem_map(); -} - - -inline -void With_element::reset_recursive_for_exec() -{ - DBUG_ASSERT(is_recursive); - level= 0; - owner->with_prepared_anchor&= ~mutually_recursive; - owner->cleaned&= ~get_elem_map(); - cleanup_stabilized(); - spec->columns_are_renamed= false; -} - - - -inline -void With_element::cleanup_stabilized() -{ - owner->stabilized&= ~mutually_recursive; -} - - -inline -void With_element::set_as_stabilized() -{ - owner->stabilized|= get_elem_map(); -} - - -inline -bool With_element::is_stabilized() -{ - return owner->stabilized & get_elem_map(); -} - - -inline -bool With_element::all_are_stabilized() -{ - return (owner->stabilized & mutually_recursive) == mutually_recursive; -} - - -inline -void With_element::prepare_for_next_iteration() -{ - With_element *with_elem= this; - while ((with_elem= with_elem->get_next_mutually_recursive()) != this) - { - TABLE *rec_table= with_elem->rec_result->first_rec_table_to_update; - if (rec_table) - rec_table->reginfo.join_tab->preread_init_done= false; - } -} - - -inline -void With_clause::attach_to(st_select_lex *select_lex) -{ - for (With_element *with_elem= with_list.first; - with_elem; - with_elem= with_elem->next) - { - select_lex->register_unit(with_elem->spec, NULL); - } -} - - -inline -void st_select_lex::set_with_clause(With_clause *with_clause) -{ - master_unit()->with_clause= with_clause; - if (with_clause) - with_clause->set_owner(master_unit()); -} - -#endif /* SQL_CTE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cursor.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cursor.h deleted file mode 100644 index 00b9cd4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_cursor.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _sql_cursor_h_ -#define _sql_cursor_h_ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class interface */ -#endif - -#include "sql_class.h" /* Query_arena */ - -class JOIN; - -/** - @file - - Declarations for implementation of server side cursors. Only - read-only non-scrollable cursors are currently implemented. -*/ - -/** - Server_side_cursor -- an interface for materialized - implementation of cursors. All cursors are self-contained - (created in their own memory root). For that reason they must - be deleted only using a pointer to Server_side_cursor, not to - its base class. -*/ - -class Server_side_cursor: protected Query_arena, public Sql_alloc -{ -protected: - /** Row destination used for fetch */ - select_result *result; -public: - Server_side_cursor(MEM_ROOT *mem_root_arg, select_result *result_arg) - :Query_arena(mem_root_arg, STMT_INITIALIZED), result(result_arg) - {} - - virtual bool is_open() const= 0; - - virtual int open(JOIN *top_level_join)= 0; - virtual void fetch(ulong num_rows)= 0; - virtual void close()= 0; - virtual bool export_structure(THD *thd, Row_definition_list *defs) - { - DBUG_ASSERT(0); - return true; - } - virtual ~Server_side_cursor(); - - static void operator delete(void *ptr, size_t size); - static void operator delete(void *, MEM_ROOT *){} -}; - - -int mysql_open_cursor(THD *thd, select_result *result, - Server_side_cursor **res); - -#endif /* _sql_cusor_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_db.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_db.h deleted file mode 100644 index c9f1ed0..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_db.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_DB_INCLUDED -#define SQL_DB_INCLUDED - -#include "hash.h" /* HASH */ - -class THD; - -int mysql_create_db(THD *thd, const LEX_CSTRING *db, DDL_options_st options, - const Schema_specification_st *create); -bool mysql_alter_db(THD *thd, const LEX_CSTRING *db, - const Schema_specification_st *create); -bool mysql_rm_db(THD *thd, const LEX_CSTRING *db, bool if_exists); -bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db); -uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, - bool force_switch); - -bool mysql_opt_change_db(THD *thd, - const LEX_CSTRING *new_db_name, - LEX_STRING *saved_db_name, - bool force_switch, - bool *cur_db_changed); -bool my_dboptions_cache_init(void); -void my_dboptions_cache_free(void); -bool check_db_dir_existence(const char *db_name); -bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create); -bool load_db_opt_by_name(THD *thd, const char *db_name, - Schema_specification_st *db_create_info); -CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name); -bool my_dbopt_init(void); -void my_dbopt_cleanup(void); - -const char *normalize_db_name(const char *db, char *buffer, - size_t buffer_size); - -#define MY_DB_OPT_FILE "db.opt" - -#endif /* SQL_DB_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_delete.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_delete.h deleted file mode 100644 index 520524c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_delete.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_DELETE_INCLUDED -#define SQL_DELETE_INCLUDED - -#include "my_base.h" /* ha_rows */ - -class THD; -struct TABLE_LIST; -class Item; -class select_result; - -typedef class Item COND; -template class SQL_I_List; - -int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds, - bool *delete_while_scanning); -bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, - SQL_I_List *order, ha_rows rows, - ulonglong options, select_result *result); - -#endif /* SQL_DELETE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_derived.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_derived.h deleted file mode 100644 index 403277d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_derived.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_DERIVED_INCLUDED -#define SQL_DERIVED_INCLUDED - -struct TABLE_LIST; -class THD; -struct LEX; - -bool mysql_handle_derived(LEX *lex, uint phases); -bool mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases); - -bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived); - -#endif /* SQL_DERIVED_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_digest.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_digest.h deleted file mode 100644 index cc786a3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_digest.h +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_DIGEST_H -#define SQL_DIGEST_H - -#include -class String; -#include "my_md5.h" - -#define MAX_DIGEST_STORAGE_SIZE (1024*1024) - -/** - Structure to store token count/array for a statement - on which digest is to be calculated. -*/ -struct sql_digest_storage -{ - bool m_full; - uint m_byte_count; - unsigned char m_md5[MD5_HASH_SIZE]; - /** Character set number. */ - uint m_charset_number; - /** - Token array. - Token array is an array of bytes to store tokens received during parsing. - Following is the way token array is formed. - ... <non-id-token> <non-id-token> <id-token> <id_len> <id_text> ... - For Example: - SELECT * FROM T1; - <SELECT_TOKEN> <*> <FROM_TOKEN> <ID_TOKEN> <2> <T1> - - @note Only the first @c m_byte_count bytes are initialized, - out of @c m_token_array_length. - */ - unsigned char *m_token_array; - /* Length of the token array to be considered for DIGEST_TEXT calculation. */ - uint m_token_array_length; - - sql_digest_storage() - { - reset(NULL, 0); - } - - inline void reset(unsigned char *token_array, size_t length) - { - m_token_array= token_array; - m_token_array_length= (uint)length; - reset(); - } - - inline void reset() - { - m_full= false; - m_byte_count= 0; - m_charset_number= 0; - memset(m_md5, 0, MD5_HASH_SIZE); - } - - inline bool is_empty() - { - return (m_byte_count == 0); - } - - inline void copy(const sql_digest_storage *from) - { - /* - Keep in mind this is a dirty copy of something that may change, - as the thread producing the digest is executing concurrently, - without any lock enforced. - */ - uint byte_count_copy= m_token_array_length < from->m_byte_count ? - m_token_array_length : from->m_byte_count; - - if (byte_count_copy > 0) - { - m_full= from->m_full; - m_byte_count= byte_count_copy; - m_charset_number= from->m_charset_number; - memcpy(m_token_array, from->m_token_array, m_byte_count); - memcpy(m_md5, from->m_md5, MD5_HASH_SIZE); - } - else - { - m_full= false; - m_byte_count= 0; - m_charset_number= 0; - } - } -}; -typedef struct sql_digest_storage sql_digest_storage; - -/** - Compute a digest hash. - @param digest_storage The digest - @param [out] md5 The computed digest hash. This parameter is a buffer of size @c MD5_HASH_SIZE. -*/ -void compute_digest_md5(const sql_digest_storage *digest_storage, unsigned char *md5); - -/** - Compute a digest text. - A 'digest text' is a textual representation of a query, - where: - - comments are removed, - - non significant spaces are removed, - - literal values are replaced with a special '?' marker, - - lists of values are collapsed using a shorter notation - @param digest_storage The digest - @param [out] digest_text - @param digest_text_length Size of @c digest_text. - @param [out] truncated true if the text representation was truncated -*/ -void compute_digest_text(const sql_digest_storage *digest_storage, - String *digest_text); - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_digest_stream.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_digest_stream.h deleted file mode 100644 index 75e534e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_digest_stream.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_DIGEST_STREAM_H -#define SQL_DIGEST_STREAM_H - -#include "sql_digest.h" - -/** - State data storage for @c digest_start, @c digest_add_token. - This structure extends the @c sql_digest_storage structure - with temporary state used only during parsing. -*/ -struct sql_digest_state -{ - /** - Index, in the digest token array, of the last identifier seen. - Reduce rules used in the digest computation can not - apply to tokens seen before an identifier. - @sa digest_add_token - */ - int m_last_id_index; - sql_digest_storage m_digest_storage; - - inline void reset(unsigned char *token_array, uint length) - { - m_last_id_index= 0; - m_digest_storage.reset(token_array, length); - } - - inline bool is_empty() - { - return m_digest_storage.is_empty(); - } -}; -typedef struct sql_digest_state sql_digest_state; - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_do.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_do.h deleted file mode 100644 index 5280a4a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_do.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_DO_INCLUDED -#define SQL_DO_INCLUDED - -#include "sql_list.h" /* List */ - -class THD; -class Item; - -bool mysql_do(THD *thd, List &values); - -#endif /* SQL_DO_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_error.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_error.h deleted file mode 100644 index a0497af..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_error.h +++ /dev/null @@ -1,1294 +0,0 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_ERROR_H -#define SQL_ERROR_H - -#include "sql_list.h" /* Sql_alloc, MEM_ROOT, list */ -#include "sql_type_int.h" // Longlong_hybrid -#include "sql_string.h" /* String */ -#include "sql_plist.h" /* I_P_List */ -#include "mysql_com.h" /* MYSQL_ERRMSG_SIZE */ -#include "my_time.h" /* MYSQL_TIME */ -#include "decimal.h" - -class THD; -class my_decimal; -class sp_condition_value; - -/////////////////////////////////////////////////////////////////////////// - -class Sql_state -{ -protected: - /** - This member is always NUL terminated. - */ - char m_sqlstate[SQLSTATE_LENGTH + 1]; -public: - Sql_state() - { - memset(m_sqlstate, 0, sizeof(m_sqlstate)); - } - - Sql_state(const char *sqlstate) - { - set_sqlstate(sqlstate); - } - - const char* get_sqlstate() const - { return m_sqlstate; } - - void set_sqlstate(const Sql_state *other) - { - *this= *other; - } - void set_sqlstate(const char *sqlstate) - { - memcpy(m_sqlstate, sqlstate, SQLSTATE_LENGTH); - m_sqlstate[SQLSTATE_LENGTH]= '\0'; - } - bool eq(const Sql_state *other) const - { - return strcmp(m_sqlstate, other->m_sqlstate) == 0; - } - - bool has_sql_state() const { return m_sqlstate[0] != '\0'; } - - /** - Checks if this SQL state defines a WARNING condition. - Note: m_sqlstate must contain a valid SQL-state. - - @retval true if this SQL state defines a WARNING condition. - @retval false otherwise. - */ - inline bool is_warning() const - { return m_sqlstate[0] == '0' && m_sqlstate[1] == '1'; } - - - /** - Checks if this SQL state defines a NOT FOUND condition. - Note: m_sqlstate must contain a valid SQL-state. - - @retval true if this SQL state defines a NOT FOUND condition. - @retval false otherwise. - */ - inline bool is_not_found() const - { return m_sqlstate[0] == '0' && m_sqlstate[1] == '2'; } - - - /** - Checks if this SQL state defines an EXCEPTION condition. - Note: m_sqlstate must contain a valid SQL-state. - - @retval true if this SQL state defines an EXCEPTION condition. - @retval false otherwise. - */ - inline bool is_exception() const - { return m_sqlstate[0] != '0' || m_sqlstate[1] > '2'; } - -}; - - -class Sql_state_errno: public Sql_state -{ -protected: - /** - MySQL extension, MYSQL_ERRNO condition item. - SQL error number. One of ER_ codes from share/errmsg.txt. - Set by set_error_status. - */ - uint m_sql_errno; - -public: - Sql_state_errno() - :m_sql_errno(0) - { } - Sql_state_errno(uint sql_errno) - :m_sql_errno(sql_errno) - { } - Sql_state_errno(uint sql_errno, const char *sql_state) - :Sql_state(sql_state), - m_sql_errno(sql_errno) - { } - /** - Get the SQL_ERRNO of this condition. - @return the sql error number condition item. - */ - uint get_sql_errno() const - { return m_sql_errno; } - - void set(uint sql_errno, const char *sqlstate) - { - m_sql_errno= sql_errno; - set_sqlstate(sqlstate); - } - void clear() - { - m_sql_errno= 0; - } -}; - - -class Sql_state_errno_level: public Sql_state_errno -{ -public: - /* - Enumeration value describing the severity of the error. - - Note that these enumeration values must correspond to the indices - of the sql_print_message_handlers array. - */ - enum enum_warning_level - { WARN_LEVEL_NOTE, WARN_LEVEL_WARN, WARN_LEVEL_ERROR, WARN_LEVEL_END}; - -protected: - /** Severity (error, warning, note) of this condition. */ - enum_warning_level m_level; - - void assign_defaults(const Sql_state_errno *value); - -public: - /** - Get the error level of this condition. - @return the error level condition item. - */ - enum_warning_level get_level() const - { return m_level; } - - Sql_state_errno_level() - :m_level(WARN_LEVEL_ERROR) - { } - - Sql_state_errno_level(uint sqlerrno, const char* sqlstate, - enum_warning_level level) - :Sql_state_errno(sqlerrno, sqlstate), - m_level(level) - { } - Sql_state_errno_level(const Sql_state_errno &state_errno, - enum_warning_level level) - :Sql_state_errno(state_errno), - m_level(level) - { } - void clear() - { - m_level= WARN_LEVEL_ERROR; - Sql_state_errno::clear(); - } -}; - - -/* - class Sql_user_condition_identity. - Instances of this class uniquely idetify user defined conditions (EXCEPTION). - - SET sql_mode=ORACLE; - CREATE PROCEDURE p1 - AS - a EXCEPTION; - BEGIN - RAISE a; - EXCEPTION - WHEN a THEN NULL; - END; - - Currently a user defined condition is identified by a pointer to - its parse time sp_condition_value instance. This can change when - we add packages. See MDEV-10591. -*/ -class Sql_user_condition_identity -{ -protected: - const sp_condition_value *m_user_condition_value; -public: - Sql_user_condition_identity() - :m_user_condition_value(NULL) - { } - Sql_user_condition_identity(const sp_condition_value *value) - :m_user_condition_value(value) - { } - const sp_condition_value *get_user_condition_value() const - { return m_user_condition_value; } - - void set(const Sql_user_condition_identity &identity) - { - *this= identity; - } - void clear() - { - m_user_condition_value= NULL; - } -}; - - -/** - class Sql_condition_identity. - Instances of this class uniquely identify conditions - (including user-defined exceptions for sql_mode=ORACLE) - and store everything that is needed for handler search - purposes in sp_pcontext::find_handler(). -*/ -class Sql_condition_identity: public Sql_state_errno_level, - public Sql_user_condition_identity -{ -public: - Sql_condition_identity() - { } - Sql_condition_identity(const Sql_state_errno_level &st, - const Sql_user_condition_identity &ucid) - :Sql_state_errno_level(st), - Sql_user_condition_identity(ucid) - { } - Sql_condition_identity(const Sql_state_errno &st, - enum_warning_level level, - const Sql_user_condition_identity &ucid) - :Sql_state_errno_level(st, level), - Sql_user_condition_identity(ucid) - { } - Sql_condition_identity(uint sqlerrno, - const char* sqlstate, - enum_warning_level level, - const Sql_user_condition_identity &ucid) - :Sql_state_errno_level(sqlerrno, sqlstate, level), - Sql_user_condition_identity(ucid) - { } - void clear() - { - Sql_state_errno_level::clear(); - Sql_user_condition_identity::clear(); - } -}; - - -class Sql_condition_items -{ -protected: - /** SQL CLASS_ORIGIN condition item. */ - String m_class_origin; - - /** SQL SUBCLASS_ORIGIN condition item. */ - String m_subclass_origin; - - /** SQL CONSTRAINT_CATALOG condition item. */ - String m_constraint_catalog; - - /** SQL CONSTRAINT_SCHEMA condition item. */ - String m_constraint_schema; - - /** SQL CONSTRAINT_NAME condition item. */ - String m_constraint_name; - - /** SQL CATALOG_NAME condition item. */ - String m_catalog_name; - - /** SQL SCHEMA_NAME condition item. */ - String m_schema_name; - - /** SQL TABLE_NAME condition item. */ - String m_table_name; - - /** SQL COLUMN_NAME condition item. */ - String m_column_name; - - /** SQL CURSOR_NAME condition item. */ - String m_cursor_name; - - Sql_condition_items() - :m_class_origin((const char*) NULL, 0, & my_charset_utf8mb3_bin), - m_subclass_origin((const char*) NULL, 0, & my_charset_utf8mb3_bin), - m_constraint_catalog((const char*) NULL, 0, & my_charset_utf8mb3_bin), - m_constraint_schema((const char*) NULL, 0, & my_charset_utf8mb3_bin), - m_constraint_name((const char*) NULL, 0, & my_charset_utf8mb3_bin), - m_catalog_name((const char*) NULL, 0, & my_charset_utf8mb3_bin), - m_schema_name((const char*) NULL, 0, & my_charset_utf8mb3_bin), - m_table_name((const char*) NULL, 0, & my_charset_utf8mb3_bin), - m_column_name((const char*) NULL, 0, & my_charset_utf8mb3_bin), - m_cursor_name((const char*) NULL, 0, & my_charset_utf8mb3_bin) - { } - - void clear() - { - m_class_origin.length(0); - m_subclass_origin.length(0); - m_constraint_catalog.length(0); - m_constraint_schema.length(0); - m_constraint_name.length(0); - m_catalog_name.length(0); - m_schema_name.length(0); - m_table_name.length(0); - m_column_name.length(0); - m_cursor_name.length(0); - } -}; - - -/** - Representation of a SQL condition. - A SQL condition can be a completion condition (note, warning), - or an exception condition (error, not found). -*/ -class Sql_condition : public Sql_alloc, - public Sql_condition_identity, - public Sql_condition_items -{ -public: - - /** - Convert a bitmask consisting of MYSQL_TIME_{NOTE|WARN}_XXX bits - to WARN_LEVEL_XXX - */ - static enum_warning_level time_warn_level(uint warnings) - { - return MYSQL_TIME_WARN_HAVE_WARNINGS(warnings) ? - WARN_LEVEL_WARN : WARN_LEVEL_NOTE; - } - - /** - Get the MESSAGE_TEXT of this condition. - @return the message text. - */ - const char* get_message_text() const; - - /** - Get the MESSAGE_OCTET_LENGTH of this condition. - @return the length in bytes of the message text. - */ - int get_message_octet_length() const; - -private: - /* - The interface of Sql_condition is mostly private, by design, - so that only the following code: - - various raise_error() or raise_warning() methods in class THD, - - the implementation of SIGNAL / RESIGNAL / GET DIAGNOSTICS - - catch / re-throw of SQL conditions in stored procedures (sp_rcontext) - is allowed to create / modify a SQL condition. - Enforcing this policy prevents confusion, since the only public - interface available to the rest of the server implementation - is the interface offered by the THD methods (THD::raise_error()), - which should be used. - */ - friend class THD; - friend class Warning_info; - friend class Sql_cmd_common_signal; - friend class Sql_cmd_signal; - friend class Sql_cmd_resignal; - friend class sp_rcontext; - friend class Condition_information_item; - - /** - Default constructor. - This constructor is usefull when allocating arrays. - Note that the init() method should be called to complete the Sql_condition. - */ - Sql_condition() - :m_mem_root(NULL) - { } - - /** - Complete the Sql_condition initialisation. - @param mem_root The memory root to use for the condition items - of this condition - */ - void init(MEM_ROOT *mem_root) - { - DBUG_ASSERT(mem_root != NULL); - DBUG_ASSERT(m_mem_root == NULL); - m_mem_root= mem_root; - } - - /** - Constructor. - @param mem_root The memory root to use for the condition items - of this condition - */ - Sql_condition(MEM_ROOT *mem_root) - :m_mem_root(mem_root) - { - DBUG_ASSERT(mem_root != NULL); - } - - Sql_condition(MEM_ROOT *mem_root, const Sql_user_condition_identity &ucid) - :Sql_condition_identity(Sql_state_errno_level(), ucid), - m_mem_root(mem_root) - { - DBUG_ASSERT(mem_root != NULL); - } - /** - Constructor for a fixed message text. - @param mem_root - memory root - @param value - the error number and the sql state for this condition - @param level - the error level for this condition - @param msg - the message text for this condition - */ - Sql_condition(MEM_ROOT *mem_root, - const Sql_condition_identity &value, - const char *msg) - :Sql_condition_identity(value), - m_mem_root(mem_root) - { - DBUG_ASSERT(mem_root != NULL); - DBUG_ASSERT(value.get_sql_errno() != 0); - DBUG_ASSERT(msg != NULL); - set_builtin_message_text(msg); - } - - /** Destructor. */ - ~Sql_condition() - {} - - /** - Copy optional condition items attributes. - @param cond the condition to copy. - */ - void copy_opt_attributes(const Sql_condition *cond); - - /** - Set the condition message test. - @param str Message text, expressed in the character set derived from - the server --language option - */ - void set_builtin_message_text(const char* str); - - /** Set the CLASS_ORIGIN of this condition. */ - void set_class_origin(); - - /** Set the SUBCLASS_ORIGIN of this condition. */ - void set_subclass_origin(); - - /** - Assign the condition items 'MYSQL_ERRNO', 'level' and 'MESSAGE_TEXT' - default values of a condition. - @param thd - current thread, to access to localized error messages - @param from - copy condition items from here (can be NULL) - */ - void assign_defaults(THD *thd, const Sql_state_errno *from); - - /** - Clear this SQL condition. - */ - void clear() - { - Sql_condition_identity::clear(); - Sql_condition_items::clear(); - m_message_text.length(0); - } - -private: - /** Message text, expressed in the character set implied by --language. */ - String m_message_text; - - /** Pointers for participating in the list of conditions. */ - Sql_condition *next_in_wi; - Sql_condition **prev_in_wi; - - /** Memory root to use to hold condition item values. */ - MEM_ROOT *m_mem_root; -}; - -/////////////////////////////////////////////////////////////////////////// - -/** - Information about warnings of the current connection. -*/ -class Warning_info -{ - /** The type of the counted and doubly linked list of conditions. */ - typedef I_P_List, - I_P_List_counter, - I_P_List_fast_push_back > - Sql_condition_list; - - /** A memory root to allocate warnings and errors */ - MEM_ROOT m_warn_root; - - /** List of warnings of all severities (levels). */ - Sql_condition_list m_warn_list; - - /** A break down of the number of warnings per severity (level). */ - uint m_warn_count[(uint) Sql_condition::WARN_LEVEL_END]; - - /** - The number of warnings of the current statement. Warning_info - life cycle differs from statement life cycle -- it may span - multiple statements. In that case we get - m_current_statement_warn_count 0, whereas m_warn_list is not empty. - */ - uint m_current_statement_warn_count; - - /* - Row counter, to print in errors and warnings. Not increased in - create_sort_index(); may differ from examined_row_count. - */ - ulong m_current_row_for_warning; - - /** Used to optionally clear warnings only once per statement. */ - ulonglong m_warn_id; - - /** - A pointer to an element of m_warn_list. It determines SQL-condition - instance which corresponds to the error state in Diagnostics_area. - - This is needed for properly processing SQL-conditions in SQL-handlers. - When an SQL-handler is found for the current error state in Diagnostics_area, - this pointer is needed to remove the corresponding SQL-condition from the - Warning_info list. - - @note m_error_condition might be NULL in the following cases: - - Diagnostics_area set to fatal error state (like OOM); - - Max number of Warning_info elements has been reached (thus, there is - no corresponding SQL-condition object in Warning_info). - */ - const Sql_condition *m_error_condition; - - /** Indicates if push_warning() allows unlimited number of warnings. */ - bool m_allow_unlimited_warnings; - bool initialized; /* Set to 1 if init() has been called */ - - /** Read only status. */ - bool m_read_only; - - /** Pointers for participating in the stack of Warning_info objects. */ - Warning_info *m_next_in_da; - Warning_info **m_prev_in_da; - - List m_marked_sql_conditions; - -public: - Warning_info(ulonglong warn_id_arg, bool allow_unlimited_warnings, - bool initialized); - ~Warning_info(); - /* Allocate memory for structures */ - void init(); - void free_memory(); - -private: - Warning_info(const Warning_info &rhs); /* Not implemented */ - Warning_info& operator=(const Warning_info &rhs); /* Not implemented */ - - /** - Checks if Warning_info contains SQL-condition with the given message. - - @param message_str Message string. - @param message_length Length of message string. - - @return true if the Warning_info contains an SQL-condition with the given - message. - */ - bool has_sql_condition(const char *message_str, size_t message_length) const; - - /** - Reset the warning information. Clear all warnings, - the number of warnings, reset current row counter - to point to the first row. - - @param new_id new Warning_info id. - */ - void clear(ulonglong new_id); - - /** - Only clear warning info if haven't yet done that already - for the current query. Allows to be issued at any time - during the query, without risk of clearing some warnings - that have been generated by the current statement. - - @todo: This is a sign of sloppy coding. Instead we need to - designate one place in a statement life cycle where we call - Warning_info::clear(). - - @param query_id Current query id. - */ - void opt_clear(ulonglong query_id) - { - if (query_id != m_warn_id) - clear(query_id); - } - - /** - Concatenate the list of warnings. - - It's considered tolerable to lose an SQL-condition in case of OOM-error, - or if the number of SQL-conditions in the Warning_info reached top limit. - - @param thd Thread context. - @param source Warning_info object to copy SQL-conditions from. - */ - void append_warning_info(THD *thd, const Warning_info *source); - - /** - Reset between two COM_ commands. Warnings are preserved - between commands, but statement_warn_count indicates - the number of warnings of this particular statement only. - */ - void reset_for_next_command() - { m_current_statement_warn_count= 0; } - - /** - Mark active SQL-conditions for later removal. - This is done to simulate stacked DAs for HANDLER statements. - */ - void mark_sql_conditions_for_removal(); - - /** - Unmark SQL-conditions, which were marked for later removal. - This is done to simulate stacked DAs for HANDLER statements. - */ - void unmark_sql_conditions_from_removal() - { m_marked_sql_conditions.empty(); } - - /** - Remove SQL-conditions that are marked for deletion. - This is done to simulate stacked DAs for HANDLER statements. - */ - void remove_marked_sql_conditions(); - - /** - Check if the given SQL-condition is marked for removal in this Warning_info - instance. - - @param cond the SQL-condition. - - @retval true if the given SQL-condition is marked for removal in this - Warning_info instance. - @retval false otherwise. - */ - bool is_marked_for_removal(const Sql_condition *cond) const; - - /** - Mark a single SQL-condition for removal (add the given SQL-condition to the - removal list of this Warning_info instance). - */ - void mark_condition_for_removal(Sql_condition *cond) - { m_marked_sql_conditions.push_back(cond, &m_warn_root); } - - /** - Used for @@warning_count system variable, which prints - the number of rows returned by SHOW WARNINGS. - */ - ulong warn_count() const - { - /* - This may be higher than warn_list.elements() if we have - had more warnings than thd->variables.max_error_count. - */ - return (m_warn_count[(uint) Sql_condition::WARN_LEVEL_NOTE] + - m_warn_count[(uint) Sql_condition::WARN_LEVEL_ERROR] + - m_warn_count[(uint) Sql_condition::WARN_LEVEL_WARN]); - } - - /** - The number of errors, or number of rows returned by SHOW ERRORS, - also the value of session variable @@error_count. - */ - ulong error_count() const - { return m_warn_count[(uint) Sql_condition::WARN_LEVEL_ERROR]; } - - /** - The number of conditions (errors, warnings and notes) in the list. - */ - uint cond_count() const - { - return m_warn_list.elements(); - } - - /** Id of the warning information area. */ - ulonglong id() const { return m_warn_id; } - - /** Set id of the warning information area. */ - void id(ulonglong id_arg) { m_warn_id= id_arg; } - - /** Do we have any errors and warnings that we can *show*? */ - bool is_empty() const { return m_warn_list.is_empty(); } - - /** Increment the current row counter to point at the next row. */ - void inc_current_row_for_warning() { m_current_row_for_warning++; } - - /** Reset the current row counter. Start counting from the first row. */ - void reset_current_row_for_warning() { m_current_row_for_warning= 1; } - - /** Return the current counter value. */ - ulong current_row_for_warning() const { return m_current_row_for_warning; } - - /** Return the number of warnings thrown by the current statement. */ - ulong current_statement_warn_count() const - { return m_current_statement_warn_count; } - - /** Make sure there is room for the given number of conditions. */ - void reserve_space(THD *thd, uint count); - - /** - Add a new SQL-condition to the current list and increment the respective - counters. - - @param thd Thread context. - @param identity SQL-condition identity - @param msg SQL-condition message. - - @return a pointer to the added SQL-condition. - */ - Sql_condition *push_warning(THD *thd, - const Sql_condition_identity *identity, - const char* msg); - - /** - Add a new SQL-condition to the current list and increment the respective - counters. - - @param thd Thread context. - @param sql_condition SQL-condition to copy values from. - - @return a pointer to the added SQL-condition. - */ - Sql_condition *push_warning(THD *thd, const Sql_condition *sql_condition); - - /** - Set the read only status for this statement area. - This is a privileged operation, reserved for the implementation of - diagnostics related statements, to enforce that the statement area is - left untouched during execution. - The diagnostics statements are: - - SHOW WARNINGS - - SHOW ERRORS - - GET DIAGNOSTICS - @param read_only the read only property to set. - */ - void set_read_only(bool read_only_arg) - { m_read_only= read_only_arg; } - - /** - Read only status. - @return the read only property. - */ - bool is_read_only() const - { return m_read_only; } - - /** - @return SQL-condition, which corresponds to the error state in - Diagnostics_area. - - @see m_error_condition. - */ - const Sql_condition *get_error_condition() const - { return m_error_condition; } - - /** - Set SQL-condition, which corresponds to the error state in Diagnostics_area. - - @see m_error_condition. - */ - void set_error_condition(const Sql_condition *error_condition) - { m_error_condition= error_condition; } - - /** - Reset SQL-condition, which corresponds to the error state in - Diagnostics_area. - - @see m_error_condition. - */ - void clear_error_condition() - { m_error_condition= NULL; } - - // for: - // - m_next_in_da / m_prev_in_da - // - is_marked_for_removal() - friend class Diagnostics_area; -}; - - -extern char *err_conv(char *buff, uint to_length, const char *from, - uint from_length, CHARSET_INFO *from_cs); - -class ErrBuff -{ -protected: - mutable char err_buffer[MYSQL_ERRMSG_SIZE]; -public: - ErrBuff() - { - err_buffer[0]= '\0'; - } - const char *ptr() const { return err_buffer; } - const char *set_longlong(const Longlong_hybrid &nr) const - { - return nr.is_unsigned() ? ullstr(nr.value(), err_buffer) : - llstr(nr.value(), err_buffer); - } - const char *set_double(double nr) const - { - my_gcvt(nr, MY_GCVT_ARG_DOUBLE, sizeof(err_buffer), err_buffer, 0); - return err_buffer; - } - const char *set_decimal(const decimal_t *d) const - { - int len= sizeof(err_buffer); - decimal2string(d, err_buffer, &len, 0, 0, ' '); - return err_buffer; - } - const char *set_str(const char *str, size_t len, CHARSET_INFO *cs) const - { - DBUG_ASSERT(len < UINT_MAX32); - return err_conv(err_buffer, (uint) sizeof(err_buffer), str, (uint) len, cs); - } - const char *set_mysql_time(const MYSQL_TIME *ltime) const - { - my_TIME_to_str(ltime, err_buffer, AUTO_SEC_PART_DIGITS); - return err_buffer; - } -}; - - -class ErrConv: public ErrBuff -{ -public: - ErrConv() {} - virtual ~ErrConv() {} - virtual const char *ptr() const = 0; -}; - -class ErrConvString : public ErrConv -{ - const char *str; - size_t len; - CHARSET_INFO *cs; -public: - ErrConvString(const char *str_arg, size_t len_arg, CHARSET_INFO *cs_arg) - : ErrConv(), str(str_arg), len(len_arg), cs(cs_arg) {} - ErrConvString(const char *str_arg, CHARSET_INFO *cs_arg) - : ErrConv(), str(str_arg), len(strlen(str_arg)), cs(cs_arg) {} - ErrConvString(const String *s) - : ErrConv(), str(s->ptr()), len(s->length()), cs(s->charset()) {} - const char *ptr() const - { - return set_str(str, len, cs); - } -}; - -class ErrConvInteger : public ErrConv, public Longlong_hybrid -{ -public: - ErrConvInteger(const Longlong_hybrid &nr) - : ErrConv(), Longlong_hybrid(nr) { } - const char *ptr() const - { - return set_longlong(static_cast(*this)); - } -}; - -class ErrConvDouble: public ErrConv -{ - double num; -public: - ErrConvDouble(double num_arg) : ErrConv(), num(num_arg) {} - const char *ptr() const - { - return set_double(num); - } -}; - -class ErrConvTime : public ErrConv -{ - const MYSQL_TIME *ltime; -public: - ErrConvTime(const MYSQL_TIME *ltime_arg) : ErrConv(), ltime(ltime_arg) {} - const char *ptr() const - { - return set_mysql_time(ltime); - } -}; - -class ErrConvDecimal : public ErrConv -{ - const decimal_t *d; -public: - ErrConvDecimal(const decimal_t *d_arg) : ErrConv(), d(d_arg) {} - const char *ptr() const - { - return set_decimal(d); - } -}; - -/////////////////////////////////////////////////////////////////////////// - -/** - Stores status of the currently executed statement. - Cleared at the beginning of the statement, and then - can hold either OK, ERROR, or EOF status. - Can not be assigned twice per statement. -*/ - -class Diagnostics_area: public Sql_state_errno, - public Sql_user_condition_identity -{ -private: - /** The type of the counted and doubly linked list of conditions. */ - typedef I_P_List, - I_P_List_counter, - I_P_List_fast_push_back > - Warning_info_list; - -public: - /** Const iterator used to iterate through the warning list. */ - typedef Warning_info::Sql_condition_list::Const_Iterator - Sql_condition_iterator; - - enum enum_diagnostics_status - { - /** The area is cleared at start of a statement. */ - DA_EMPTY= 0, - /** Set whenever one calls my_ok(). */ - DA_OK, - /** Set whenever one calls my_eof(). */ - DA_EOF, - /** Set whenever one calls my_ok() in PS bulk mode. */ - DA_OK_BULK, - /** Set whenever one calls my_error() or my_message(). */ - DA_ERROR, - /** Set in case of a custom response, such as one from COM_STMT_PREPARE. */ - DA_DISABLED - }; - - void set_overwrite_status(bool can_overwrite_status) - { m_can_overwrite_status= can_overwrite_status; } - - /** True if status information is sent to the client. */ - bool is_sent() const { return m_is_sent; } - - void set_is_sent(bool is_sent_arg) { m_is_sent= is_sent_arg; } - - void set_ok_status(ulonglong affected_rows, - ulonglong last_insert_id, - const char *message); - - void set_eof_status(THD *thd); - - void set_error_status(uint sql_errno); - - void set_error_status(uint sql_errno, - const char *message, - const char *sqlstate, - const Sql_user_condition_identity &ucid, - const Sql_condition *error_condition); - - void set_error_status(uint sql_errno, - const char *message, - const char *sqlstate, - const Sql_condition *error_condition) - { - set_error_status(sql_errno, message, sqlstate, - Sql_user_condition_identity(), - error_condition); - } - - void disable_status(); - - void reset_diagnostics_area(); - - bool is_set() const { return m_status != DA_EMPTY; } - - bool is_error() const { return m_status == DA_ERROR; } - - bool is_eof() const { return m_status == DA_EOF; } - - bool is_ok() const { return m_status == DA_OK; } - - bool is_disabled() const { return m_status == DA_DISABLED; } - - void set_bulk_execution(bool bulk) { is_bulk_execution= bulk; } - - bool is_bulk_op() const { return is_bulk_execution; } - - enum_diagnostics_status status() const { return m_status; } - - const char *message() const - { DBUG_ASSERT(m_status == DA_ERROR || m_status == DA_OK || - m_status == DA_OK_BULK); return m_message; } - - bool skip_flush() const - { - DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK); - return m_skip_flush; - } - - void set_skip_flush() - { m_skip_flush= TRUE; } - - uint sql_errno() const - { - DBUG_ASSERT(m_status == DA_ERROR); - return Sql_state_errno::get_sql_errno(); - } - - const char* get_sqlstate() const - { DBUG_ASSERT(m_status == DA_ERROR); return Sql_state::get_sqlstate(); } - - ulonglong affected_rows() const - { - DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK); - return m_affected_rows; - } - - ulonglong last_insert_id() const - { - DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK); - return m_last_insert_id; - } - - uint statement_warn_count() const - { - DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK || - m_status == DA_EOF); - return m_statement_warn_count; - } - - /** - Get the current errno, state and id of the user defined condition - and return them as Sql_condition_identity. - */ - Sql_condition_identity get_error_condition_identity() const - { - DBUG_ASSERT(m_status == DA_ERROR); - return Sql_condition_identity(*this /*Sql_state_errno*/, - Sql_condition::WARN_LEVEL_ERROR, - *this /*Sql_user_condition_identity*/); - } - - /* Used to count any warnings pushed after calling set_ok_status(). */ - void increment_warning() - { - if (m_status != DA_EMPTY) - m_statement_warn_count++; - } - - Diagnostics_area(bool initialize); - Diagnostics_area(ulonglong warning_info_id, bool allow_unlimited_warnings, - bool initialize); - void init() { m_main_wi.init() ; } - void free_memory() { m_main_wi.free_memory() ; } - - void push_warning_info(Warning_info *wi) - { m_wi_stack.push_front(wi); } - - void pop_warning_info() - { - DBUG_ASSERT(m_wi_stack.elements() > 0); - m_wi_stack.remove(m_wi_stack.front()); - } - - void set_warning_info_id(ulonglong id) - { get_warning_info()->id(id); } - - ulonglong warning_info_id() const - { return get_warning_info()->id(); } - - /** - Compare given current warning info and current warning info - and see if they are different. They will be different if - warnings have been generated or statements that use tables - have been executed. This is checked by comparing m_warn_id. - - @param wi Warning info to compare with current Warning info. - - @return false if they are equal, true if they are not. - */ - bool warning_info_changed(const Warning_info *wi) const - { return get_warning_info()->id() != wi->id(); } - - bool is_warning_info_empty() const - { return get_warning_info()->is_empty(); } - - ulong current_statement_warn_count() const - { return get_warning_info()->current_statement_warn_count(); } - - bool has_sql_condition(const char *message_str, size_t message_length) const - { return get_warning_info()->has_sql_condition(message_str, message_length); } - - void reset_for_next_command() - { get_warning_info()->reset_for_next_command(); } - - void clear_warning_info(ulonglong id) - { get_warning_info()->clear(id); } - - void opt_clear_warning_info(ulonglong query_id) - { get_warning_info()->opt_clear(query_id); } - - ulong current_row_for_warning() const - { return get_warning_info()->current_row_for_warning(); } - - void inc_current_row_for_warning() - { get_warning_info()->inc_current_row_for_warning(); } - - void reset_current_row_for_warning() - { get_warning_info()->reset_current_row_for_warning(); } - - bool is_warning_info_read_only() const - { return get_warning_info()->is_read_only(); } - - void set_warning_info_read_only(bool read_only_arg) - { get_warning_info()->set_read_only(read_only_arg); } - - ulong error_count() const - { return get_warning_info()->error_count(); } - - ulong warn_count() const - { return get_warning_info()->warn_count(); } - - uint cond_count() const - { return get_warning_info()->cond_count(); } - - Sql_condition_iterator sql_conditions() const - { return get_warning_info()->m_warn_list; } - - void reserve_space(THD *thd, uint count) - { get_warning_info()->reserve_space(thd, count); } - - Sql_condition *push_warning(THD *thd, const Sql_condition *sql_condition) - { return get_warning_info()->push_warning(thd, sql_condition); } - - Sql_condition *push_warning(THD *thd, - uint sql_errno_arg, - const char* sqlstate, - Sql_condition::enum_warning_level level, - const Sql_user_condition_identity &ucid, - const char* msg) - { - Sql_condition_identity tmp(sql_errno_arg, sqlstate, level, ucid); - return get_warning_info()->push_warning(thd, &tmp, msg); - } - - Sql_condition *push_warning(THD *thd, - uint sqlerrno, - const char* sqlstate, - Sql_condition::enum_warning_level level, - const char* msg) - { - return push_warning(thd, sqlerrno, sqlstate, level, - Sql_user_condition_identity(), msg); - } - void mark_sql_conditions_for_removal() - { get_warning_info()->mark_sql_conditions_for_removal(); } - - void unmark_sql_conditions_from_removal() - { get_warning_info()->unmark_sql_conditions_from_removal(); } - - void remove_marked_sql_conditions() - { get_warning_info()->remove_marked_sql_conditions(); } - - const Sql_condition *get_error_condition() const - { return get_warning_info()->get_error_condition(); } - - void copy_sql_conditions_to_wi(THD *thd, Warning_info *dst_wi) const - { dst_wi->append_warning_info(thd, get_warning_info()); } - - void copy_sql_conditions_from_wi(THD *thd, const Warning_info *src_wi) - { get_warning_info()->append_warning_info(thd, src_wi); } - - void copy_non_errors_from_wi(THD *thd, const Warning_info *src_wi); - -private: - Warning_info *get_warning_info() { return m_wi_stack.front(); } - - const Warning_info *get_warning_info() const { return m_wi_stack.front(); } - -private: - /** True if status information is sent to the client. */ - bool m_is_sent; - - /** Set to make set_error_status after set_{ok,eof}_status possible. */ - bool m_can_overwrite_status; - - /** Skip flushing network buffer after writing OK (for COM_MULTI) */ - bool m_skip_flush; - - /** Message buffer. Can be used by OK or ERROR status. */ - char m_message[MYSQL_ERRMSG_SIZE]; - - /** - The number of rows affected by the last statement. This is - semantically close to thd->m_row_count_func, but has a different - life cycle. thd->m_row_count_func stores the value returned by - function ROW_COUNT() and is cleared only by statements that - update its value, such as INSERT, UPDATE, DELETE and few others. - This member is cleared at the beginning of the next statement. - - We could possibly merge the two, but life cycle of thd->m_row_count_func - can not be changed. - */ - ulonglong m_affected_rows; - - /** - Similarly to the previous member, this is a replacement of - thd->first_successful_insert_id_in_prev_stmt, which is used - to implement LAST_INSERT_ID(). - */ - - ulonglong m_last_insert_id; - /** - Number of warnings of this last statement. May differ from - the number of warnings returned by SHOW WARNINGS e.g. in case - the statement doesn't clear the warnings, and doesn't generate - them. - */ - uint m_statement_warn_count; - - enum_diagnostics_status m_status; - - my_bool is_bulk_execution; - - Warning_info m_main_wi; - - Warning_info_list m_wi_stack; -}; - -/////////////////////////////////////////////////////////////////////////// - -void convert_error_to_warning(THD *thd); - -void push_warning(THD *thd, Sql_condition::enum_warning_level level, - uint code, const char *msg); - -void push_warning_printf(THD *thd, Sql_condition::enum_warning_level level, - uint code, const char *format, ...); - -bool mysqld_show_warnings(THD *thd, ulong levels_to_show); - -size_t convert_error_message(char *to, size_t to_length, - CHARSET_INFO *to_cs, - const char *from, size_t from_length, - CHARSET_INFO *from_cs, uint *errors); - -extern const LEX_CSTRING warning_level_names[]; - -bool is_sqlstate_valid(const LEX_CSTRING *sqlstate); -/** - Checks if the specified SQL-state-string defines COMPLETION condition. - This function assumes that the given string contains a valid SQL-state. - - @param s the condition SQLSTATE. - - @retval true if the given string defines COMPLETION condition. - @retval false otherwise. -*/ -inline bool is_sqlstate_completion(const char *s) -{ return s[0] == '0' && s[1] == '0'; } - - -#endif // SQL_ERROR_H diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_explain.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_explain.h deleted file mode 100644 index 9090416..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_explain.h +++ /dev/null @@ -1,998 +0,0 @@ -/* - Copyright (c) 2013 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - -== EXPLAIN/ANALYZE architecture == - -=== [SHOW] EXPLAIN data === -Query optimization produces two data structures: -1. execution data structures themselves (eg. JOINs, JOIN_TAB, etc, etc) -2. Explain data structures. - -#2 are self contained set of data structures that has sufficient info to -produce output of SHOW EXPLAIN, EXPLAIN [FORMAT=JSON], or -ANALYZE [FORMAT=JSON], without accessing the execution data structures. - -(the only exception is that Explain data structures keep Item* pointers, -and we require that one might call item->print(QT_EXPLAIN) when printing -FORMAT=JSON output) - -=== ANALYZE data === -EXPLAIN data structures have embedded ANALYZE data structures. These are -objects that are used to track how the parts of query plan were executed: -how many times each part of query plan was invoked, how many rows were -read/returned, etc. - -Each execution data structure keeps a direct pointer to its ANALYZE data -structure. It is needed so that execution code can quickly increment the -counters. - -(note that this increases the set of data that is frequently accessed -during the execution. What is the impact of this?) - -Since ANALYZE/EXPLAIN data structures are separated from execution data -structures, it is easy to have them survive until the end of the query, -where we can return ANALYZE [FORMAT=JSON] output to the user, or print -it into the slow query log. - -*/ - -#ifndef SQL_EXPLAIN_INCLUDED -#define SQL_EXPLAIN_INCLUDED - -class String_list: public List -{ -public: - const char *append_str(MEM_ROOT *mem_root, const char *str); -}; - -class Json_writer; - -/************************************************************************************** - - Data structures for producing EXPLAIN outputs. - - These structures - - Can be produced inexpensively from query plan. - - Store sufficient information to produce tabular EXPLAIN output (the goal is - to be able to produce JSON also) - -*************************************************************************************/ - - -const int FAKE_SELECT_LEX_ID= (int)UINT_MAX; - -class Explain_query; - -/* - A node can be either a SELECT, or a UNION. -*/ -class Explain_node : public Sql_alloc -{ -public: - Explain_node(MEM_ROOT *root) : - cache_tracker(NULL), - connection_type(EXPLAIN_NODE_OTHER), - children(root) - {} - /* A type specifying what kind of node this is */ - enum explain_node_type - { - EXPLAIN_UNION, - EXPLAIN_SELECT, - EXPLAIN_BASIC_JOIN, - EXPLAIN_UPDATE, - EXPLAIN_DELETE, - EXPLAIN_INSERT - }; - - /* How this node is connected */ - enum explain_connection_type { - EXPLAIN_NODE_OTHER, - EXPLAIN_NODE_DERIVED, /* Materialized derived table */ - EXPLAIN_NODE_NON_MERGED_SJ /* aka JTBM semi-join */ - }; - - virtual enum explain_node_type get_type()= 0; - virtual int get_select_id()= 0; - - /** - expression cache statistics - */ - Expression_cache_tracker* cache_tracker; - - /* - How this node is connected to its parent. - (NOTE: EXPLAIN_NODE_NON_MERGED_SJ is set very late currently) - */ - enum explain_connection_type connection_type; - - /* - A node may have children nodes. When a node's explain structure is - created, children nodes may not yet have QPFs. This is why we store ids. - */ - Dynamic_array children; - void add_child(int select_no) - { - children.append(select_no); - } - - virtual int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze)=0; - virtual void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze)= 0; - - int print_explain_for_children(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); - void print_explain_json_for_children(Explain_query *query, - Json_writer *writer, bool is_analyze); - bool print_explain_json_cache(Json_writer *writer, bool is_analyze); - virtual ~Explain_node(){} -}; - - -class Explain_table_access; - - -/* - A basic join. This is only used for SJ-Materialization nests. - - Basic join doesn't have ORDER/GROUP/DISTINCT operations. It also cannot be - degenerate. - - It has its own select_id. -*/ -class Explain_basic_join : public Explain_node -{ -public: - enum explain_node_type get_type() { return EXPLAIN_BASIC_JOIN; } - - Explain_basic_join(MEM_ROOT *root) : Explain_node(root), join_tabs(NULL) {} - ~Explain_basic_join(); - - bool add_table(Explain_table_access *tab, Explain_query *query); - - int get_select_id() { return select_id; } - - int select_id; - - int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); - void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); - - void print_explain_json_interns(Explain_query *query, Json_writer *writer, - bool is_analyze); - - /* A flat array of Explain structs for tables. */ - Explain_table_access** join_tabs; - uint n_join_tabs; -}; - - -class Explain_aggr_node; -/* - EXPLAIN structure for a SELECT. - - A select can be: - 1. A degenerate case. In this case, message!=NULL, and it contains a - description of what kind of degenerate case it is (e.g. "Impossible - WHERE"). - 2. a non-degenrate join. In this case, join_tabs describes the join. - - In the non-degenerate case, a SELECT may have a GROUP BY/ORDER BY operation. - - In both cases, the select may have children nodes. class Explain_node - provides a way get node's children. -*/ - -class Explain_select : public Explain_basic_join -{ -public: - enum explain_node_type get_type() { return EXPLAIN_SELECT; } - - Explain_select(MEM_ROOT *root, bool is_analyze) : - Explain_basic_join(root), -#ifndef DBUG_OFF - select_lex(NULL), -#endif - linkage(UNSPECIFIED_TYPE), - is_lateral(false), - message(NULL), - having(NULL), having_value(Item::COND_UNDEF), - using_temporary(false), using_filesort(false), - time_tracker(is_analyze), - aggr_tree(NULL) - {} - - void add_linkage(Json_writer *writer); - -public: -#ifndef DBUG_OFF - SELECT_LEX *select_lex; -#endif - const char *select_type; - enum sub_select_type linkage; - bool is_lateral; - - /* - If message != NULL, this is a degenerate join plan, and all subsequent - members have no info - */ - const char *message; - - /* Expensive constant condition */ - Item *exec_const_cond; - Item *outer_ref_cond; - Item *pseudo_bits_cond; - - /* HAVING condition */ - Item *having; - Item::cond_result having_value; - - /* Global join attributes. In tabular form, they are printed on the first row */ - bool using_temporary; - bool using_filesort; - - /* ANALYZE members */ - Time_and_counter_tracker time_tracker; - - /* - Part of query plan describing sorting, temp.table usage, and duplicate - removal - */ - Explain_aggr_node* aggr_tree; - - int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); - void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); - - Table_access_tracker *get_using_temporary_read_tracker() - { - return &using_temporary_read_tracker; - } -private: - Table_access_tracker using_temporary_read_tracker; -}; - -///////////////////////////////////////////////////////////////////////////// -// EXPLAIN structures for ORDER/GROUP operations. -///////////////////////////////////////////////////////////////////////////// -typedef enum -{ - AGGR_OP_TEMP_TABLE, - AGGR_OP_FILESORT, - //AGGR_OP_READ_SORTED_FILE, // need this? - AGGR_OP_REMOVE_DUPLICATES, - AGGR_OP_WINDOW_FUNCS - //AGGR_OP_JOIN // Need this? -} enum_explain_aggr_node_type; - - -class Explain_aggr_node : public Sql_alloc -{ -public: - virtual enum_explain_aggr_node_type get_type()= 0; - virtual ~Explain_aggr_node() {} - Explain_aggr_node *child; -}; - -class Explain_aggr_filesort : public Explain_aggr_node -{ - List sort_items; - List sort_directions; -public: - enum_explain_aggr_node_type get_type() { return AGGR_OP_FILESORT; } - Filesort_tracker tracker; - - Explain_aggr_filesort(MEM_ROOT *mem_root, bool is_analyze, - Filesort *filesort); - - void print_json_members(Json_writer *writer, bool is_analyze); -}; - -class Explain_aggr_tmp_table : public Explain_aggr_node -{ -public: - enum_explain_aggr_node_type get_type() { return AGGR_OP_TEMP_TABLE; } -}; - -class Explain_aggr_remove_dups : public Explain_aggr_node -{ -public: - enum_explain_aggr_node_type get_type() { return AGGR_OP_REMOVE_DUPLICATES; } -}; - -class Explain_aggr_window_funcs : public Explain_aggr_node -{ - List sorts; -public: - enum_explain_aggr_node_type get_type() { return AGGR_OP_WINDOW_FUNCS; } - - void print_json_members(Json_writer *writer, bool is_analyze); - friend class Window_funcs_computation; -}; - -///////////////////////////////////////////////////////////////////////////// - -extern const char *unit_operation_text[4]; -extern const char *pushed_derived_text; -extern const char *pushed_select_text; - -/* - Explain structure for a UNION. - - A UNION may or may not have "Using filesort". -*/ - -class Explain_union : public Explain_node -{ -public: - Explain_union(MEM_ROOT *root, bool is_analyze) : - Explain_node(root), union_members(PSI_INSTRUMENT_MEM), - is_recursive_cte(false), - fake_select_lex_explain(root, is_analyze) - {} - - enum explain_node_type get_type() { return EXPLAIN_UNION; } - unit_common_op operation; - - int get_select_id() - { - DBUG_ASSERT(union_members.elements() > 0); - return union_members.at(0); - } - /* - Members of the UNION. Note: these are different from UNION's "children". - Example: - - (select * from t1) union - (select * from t2) order by (select col1 from t3 ...) - - here - - select-from-t1 and select-from-t2 are "union members", - - select-from-t3 is the only "child". - */ - Dynamic_array union_members; - - void add_select(int select_no) - { - union_members.append(select_no); - } - int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); - void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); - - const char *fake_select_type; - bool using_filesort; - bool using_tmp; - bool is_recursive_cte; - - /* - Explain data structure for "fake_select_lex" (i.e. for the degenerate - SELECT that reads UNION result). - It doesn't have a query plan, but we still need execution tracker, etc. - */ - Explain_select fake_select_lex_explain; - - Table_access_tracker *get_fake_select_lex_tracker() - { - return &fake_select_lex_tracker; - } - Table_access_tracker *get_tmptable_read_tracker() - { - return &tmptable_read_tracker; - } -private: - uint make_union_table_name(char *buf); - - Table_access_tracker fake_select_lex_tracker; - /* This one is for reading after ORDER BY */ - Table_access_tracker tmptable_read_tracker; -}; - - -class Explain_update; -class Explain_delete; -class Explain_insert; - - -/* - Explain structure for a query (i.e. a statement). - - This should be able to survive when the query plan was deleted. Currently, - we do not intend for it survive until after query's MEM_ROOT is freed. It - does surivive freeing of query's items. - - For reference, the process of post-query cleanup is as follows: - - >dispatch_command - | >mysql_parse - | | ... - | | lex_end() - | | ... - | | >THD::cleanup_after_query - | | | ... - | | | free_items() - | | | ... - | | dispatch_command - - That is, the order of actions is: - - free query's Items - - write to slow query log - - free query's MEM_ROOT - -*/ - -class Explain_query : public Sql_alloc -{ -public: - Explain_query(THD *thd, MEM_ROOT *root); - ~Explain_query(); - - /* Add a new node */ - void add_node(Explain_node *node); - void add_insert_plan(Explain_insert *insert_plan_arg); - void add_upd_del_plan(Explain_update *upd_del_plan_arg); - - /* This will return a select, or a union */ - Explain_node *get_node(uint select_id); - - /* This will return a select (even if there is a union with this id) */ - Explain_select *get_select(uint select_id); - - Explain_union *get_union(uint select_id); - - /* Produce a tabular EXPLAIN output */ - int print_explain(select_result_sink *output, uint8 explain_flags, - bool is_analyze); - - /* Send tabular EXPLAIN to the client */ - int send_explain(THD *thd); - - /* Return tabular EXPLAIN output as a text string */ - bool print_explain_str(THD *thd, String *out_str, bool is_analyze); - - void print_explain_json(select_result_sink *output, bool is_analyze); - - /* If true, at least part of EXPLAIN can be printed */ - bool have_query_plan() { return insert_plan || upd_del_plan|| get_node(1) != NULL; } - - void query_plan_ready(); - - MEM_ROOT *mem_root; - - Explain_update *get_upd_del_plan() { return upd_del_plan; } -private: - /* Explain_delete inherits from Explain_update */ - Explain_update *upd_del_plan; - - /* Query "plan" for INSERTs */ - Explain_insert *insert_plan; - - Dynamic_array unions; - Dynamic_array selects; - - THD *thd; // for APC start/stop - bool apc_enabled; - /* - Debugging aid: count how many times add_node() was called. Ideally, it - should be one, we currently allow O(1) query plan saves for each - select or union. The goal is not to have O(#rows_in_some_table), which - is unacceptable. - */ - longlong operations; -}; - - -/* - Some of the tags have matching text. See extra_tag_text for text names, and - Explain_table_access::append_tag_name() for code to convert from tag form to text - form. -*/ -enum explain_extra_tag -{ - ET_none= 0, /* not-a-tag */ - ET_USING_INDEX_CONDITION, - ET_USING_INDEX_CONDITION_BKA, - ET_USING, /* For quick selects of various kinds */ - ET_RANGE_CHECKED_FOR_EACH_RECORD, - ET_USING_WHERE_WITH_PUSHED_CONDITION, - ET_USING_WHERE, - ET_NOT_EXISTS, - - ET_USING_INDEX, - ET_FULL_SCAN_ON_NULL_KEY, - ET_SKIP_OPEN_TABLE, - ET_OPEN_FRM_ONLY, - ET_OPEN_FULL_TABLE, - - ET_SCANNED_0_DATABASES, - ET_SCANNED_1_DATABASE, - ET_SCANNED_ALL_DATABASES, - - ET_USING_INDEX_FOR_GROUP_BY, - - ET_USING_MRR, // does not print "Using mrr". - - ET_DISTINCT, - ET_LOOSESCAN, - ET_START_TEMPORARY, - ET_END_TEMPORARY, - ET_FIRST_MATCH, - - ET_USING_JOIN_BUFFER, - - ET_CONST_ROW_NOT_FOUND, - ET_UNIQUE_ROW_NOT_FOUND, - ET_IMPOSSIBLE_ON_CONDITION, - - ET_total -}; - - -/* - Explain data structure describing join buffering use. -*/ - -class EXPLAIN_BKA_TYPE -{ -public: - EXPLAIN_BKA_TYPE() : join_alg(NULL) {} - - size_t join_buffer_size; - - bool incremental; - - /* - NULL if no join buferring used. - Other values: BNL, BNLH, BKA, BKAH. - */ - const char *join_alg; - - /* Information about MRR usage. */ - StringBuffer<64> mrr_type; - - bool is_using_jbuf() { return (join_alg != NULL); } -}; - - -/* - Data about how an index is used by some access method -*/ -class Explain_index_use : public Sql_alloc -{ - char *key_name; - uint key_len; - char *filter_name; - uint filter_len; -public: - String_list key_parts_list; - - Explain_index_use() - { - clear(); - } - - void clear() - { - key_name= NULL; - key_len= (uint)-1; - filter_name= NULL; - filter_len= (uint)-1; - } - bool set(MEM_ROOT *root, KEY *key_name, uint key_len_arg); - bool set_pseudo_key(MEM_ROOT *root, const char *key_name); - - inline const char *get_key_name() const { return key_name; } - inline uint get_key_len() const { return key_len; } - //inline const char *get_filter_name() const { return filter_name; } -}; - - -/* - Query Plan data structure for Rowid filter. -*/ -class Explain_rowid_filter : public Sql_alloc -{ -public: - /* Quick select used to collect the rowids into filter */ - Explain_quick_select *quick; - - /* How many rows the above quick select is expected to return */ - ha_rows rows; - - /* Expected selectivity for the filter */ - double selectivity; - - /* Tracker with the information about how rowid filter is executed */ - Rowid_filter_tracker *tracker; - - void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); - - /* - TODO: - Here should be ANALYZE members: - - r_rows for the quick select - - An object that tracked the table access time - - real selectivity of the filter. - */ -}; - - -/* - QPF for quick range selects, as well as index_merge select -*/ -class Explain_quick_select : public Sql_alloc -{ -public: - Explain_quick_select(int quick_type_arg) : quick_type(quick_type_arg) - {} - - const int quick_type; - - bool is_basic() - { - return (quick_type == QUICK_SELECT_I::QS_TYPE_RANGE || - quick_type == QUICK_SELECT_I::QS_TYPE_RANGE_DESC || - quick_type == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX); - } - - /* This is used when quick_type == QUICK_SELECT_I::QS_TYPE_RANGE */ - Explain_index_use range; - - /* Used in all other cases */ - List children; - - void print_extra(String *str); - void print_key(String *str); - void print_key_len(String *str); - - void print_json(Json_writer *writer); - - void print_extra_recursive(String *str); -private: - const char *get_name_by_type(); -}; - - -/* - Data structure for "range checked for each record". - It's a set of keys, tabular explain prints hex bitmap, json prints key names. -*/ - -typedef const char* NAME; - -class Explain_range_checked_fer : public Sql_alloc -{ -public: - String_list key_set; - key_map keys_map; -private: - ha_rows full_scan, index_merge; - ha_rows *keys_stat; - NAME *keys_stat_names; - uint keys; - -public: - Explain_range_checked_fer() - :Sql_alloc(), full_scan(0), index_merge(0), - keys_stat(0), keys_stat_names(0), keys(0) - {} - - int append_possible_keys_stat(MEM_ROOT *alloc, - TABLE *table, key_map possible_keys); - void collect_data(QUICK_SELECT_I *quick); - void print_json(Json_writer *writer, bool is_analyze); -}; - - -/* - EXPLAIN data structure for a single JOIN_TAB. -*/ - -class Explain_table_access : public Sql_alloc -{ -public: - Explain_table_access(MEM_ROOT *root) : - derived_select_number(0), - non_merged_sjm_number(0), - extra_tags(root), - range_checked_fer(NULL), - full_scan_on_null_key(false), - start_dups_weedout(false), - end_dups_weedout(false), - where_cond(NULL), - cache_cond(NULL), - pushed_index_cond(NULL), - sjm_nest(NULL), - pre_join_sort(NULL), - rowid_filter(NULL) - {} - ~Explain_table_access() { delete sjm_nest; } - - void push_extra(enum explain_extra_tag extra_tag); - - /* Internals */ - - /* id and 'select_type' are cared-of by the parent Explain_select */ - StringBuffer<32> table_name; - StringBuffer<32> used_partitions; - String_list used_partitions_list; - // valid with ET_USING_MRR - StringBuffer<32> mrr_type; - StringBuffer<32> firstmatch_table_name; - - /* - Non-zero number means this is a derived table. The number can be used to - find the query plan for the derived table - */ - int derived_select_number; - /* TODO: join with the previous member. */ - int non_merged_sjm_number; - - enum join_type type; - - bool used_partitions_set; - - /* Empty means "NULL" will be printed */ - String_list possible_keys; - - bool rows_set; /* not set means 'NULL' should be printed */ - bool filtered_set; /* not set means 'NULL' should be printed */ - // Valid if ET_USING_INDEX_FOR_GROUP_BY is present - bool loose_scan_is_scanning; - - /* - Index use: key name and length. - Note: that when one is accessing I_S tables, those may show use of - non-existant indexes. - - key.key_name == NULL means 'NULL' will be shown in tabular output. - key.key_len == (uint)-1 means 'NULL' will be shown in tabular output. - */ - Explain_index_use key; - - /* - when type==JT_HASH_NEXT, 'key' stores the hash join pseudo-key. - hash_next_key stores the table's key. - */ - Explain_index_use hash_next_key; - - String_list ref_list; - - ha_rows rows; - double filtered; - - /* - Contents of the 'Extra' column. Some are converted into strings, some have - parameters, values for which are stored below. - */ - Dynamic_array extra_tags; - - // Valid if ET_USING tag is present - Explain_quick_select *quick_info; - - /* Non-NULL value means this tab uses "range checked for each record" */ - Explain_range_checked_fer *range_checked_fer; - - bool full_scan_on_null_key; - - // valid with ET_USING_JOIN_BUFFER - EXPLAIN_BKA_TYPE bka_type; - - bool start_dups_weedout; - bool end_dups_weedout; - - /* - Note: lifespan of WHERE condition is less than lifespan of this object. - The below two are valid if tags include "ET_USING_WHERE". - (TODO: indexsubquery may put ET_USING_WHERE without setting where_cond?) - */ - Item *where_cond; - Item *cache_cond; - - /* - This is either pushed index condition, or BKA's index condition. - (the latter refers to columns of other tables and so can only be checked by - BKA code). Examine extra_tags to tell which one it is. - */ - Item *pushed_index_cond; - - Explain_basic_join *sjm_nest; - - /* - This describes a possible filesort() call that is done before doing the - join operation. - */ - Explain_aggr_filesort *pre_join_sort; - - /* ANALYZE members */ - - /* Tracker for reading the table */ - Table_access_tracker tracker; - Exec_time_tracker op_tracker; - Gap_time_tracker extra_time_tracker; - - Table_access_tracker jbuf_tracker; - - Explain_rowid_filter *rowid_filter; - - int print_explain(select_result_sink *output, uint8 explain_flags, - bool is_analyze, - uint select_id, const char *select_type, - bool using_temporary, bool using_filesort); - void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); - -private: - void append_tag_name(String *str, enum explain_extra_tag tag); - void fill_key_str(String *key_str, bool is_json) const; - void fill_key_len_str(String *key_len_str, bool is_json) const; - double get_r_filtered(); - void tag_to_json(Json_writer *writer, enum explain_extra_tag tag); -}; - - -/* - EXPLAIN structure for single-table UPDATE. - - This is similar to Explain_table_access, except that it is more restrictive. - Also, it can have UPDATE operation options, but currently there aren't any. - - Explain_delete inherits from this. -*/ - -class Explain_update : public Explain_node -{ -public: - - Explain_update(MEM_ROOT *root, bool is_analyze) : - Explain_node(root), - filesort_tracker(NULL), - command_tracker(is_analyze) - {} - - virtual enum explain_node_type get_type() { return EXPLAIN_UPDATE; } - virtual int get_select_id() { return 1; /* always root */ } - - const char *select_type; - - StringBuffer<32> used_partitions; - String_list used_partitions_list; - bool used_partitions_set; - - bool impossible_where; - bool no_partitions; - StringBuffer<64> table_name; - - enum join_type jtype; - String_list possible_keys; - - /* Used key when doing a full index scan (possibly with limit) */ - Explain_index_use key; - - /* - MRR that's used with quick select. This should probably belong to the - quick select - */ - StringBuffer<64> mrr_type; - - Explain_quick_select *quick_info; - - bool using_where; - Item *where_cond; - - ha_rows rows; - - bool using_io_buffer; - - /* Tracker for doing reads when filling the buffer */ - Table_access_tracker buf_tracker; - - bool is_using_filesort() { return filesort_tracker? true: false; } - /* - Non-null value of filesort_tracker means "using filesort" - - if we are using filesort, then table_tracker is for the io done inside - filesort. - - 'tracker' is for tracking post-filesort reads. - */ - Filesort_tracker *filesort_tracker; - - /* ANALYZE members and methods */ - Table_access_tracker tracker; - - /* This tracks execution of the whole command */ - Time_and_counter_tracker command_tracker; - - /* TODO: This tracks time to read rows from the table */ - Exec_time_tracker table_tracker; - - virtual int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); - virtual void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); -}; - - -/* - EXPLAIN data structure for an INSERT. - - At the moment this doesn't do much as we don't really have any query plans - for INSERT statements. -*/ - -class Explain_insert : public Explain_node -{ -public: - Explain_insert(MEM_ROOT *root) : - Explain_node(root) - {} - - StringBuffer<64> table_name; - - enum explain_node_type get_type() { return EXPLAIN_INSERT; } - int get_select_id() { return 1; /* always root */ } - - int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); - void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); -}; - - -/* - EXPLAIN data of a single-table DELETE. -*/ - -class Explain_delete: public Explain_update -{ -public: - Explain_delete(MEM_ROOT *root, bool is_analyze) : - Explain_update(root, is_analyze) - {} - - /* - TRUE means we're going to call handler->delete_all_rows() and not read any - rows. - */ - bool deleting_all_rows; - - virtual enum explain_node_type get_type() { return EXPLAIN_DELETE; } - virtual int get_select_id() { return 1; /* always root */ } - - virtual int print_explain(Explain_query *query, select_result_sink *output, - uint8 explain_flags, bool is_analyze); - virtual void print_explain_json(Explain_query *query, Json_writer *writer, - bool is_analyze); -}; - - -#endif //SQL_EXPLAIN_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_expression_cache.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_expression_cache.h deleted file mode 100644 index 031773a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_expression_cache.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - Copyright (c) 2010, 2011, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_EXPRESSION_CACHE_INCLUDED -#define SQL_EXPRESSION_CACHE_INCLUDED - -#include "sql_select.h" - - -/** - Interface for expression cache - - @note - Parameters of an expression cache interface are set on the creation of the - cache. They are passed when a cache object of the implementation class is - constructed. That's why they are not visible in this interface. -*/ - -extern ulong subquery_cache_miss, subquery_cache_hit; - -class Expression_cache :public Sql_alloc -{ -public: - enum result {ERROR, HIT, MISS}; - - Expression_cache(){}; - virtual ~Expression_cache() {}; - /** - Shall check the presence of expression value in the cache for a given - set of values of the expression parameters. Return the result of the - expression if it's found in the cache. - */ - virtual result check_value(Item **value)= 0; - /** - Shall put the value of an expression for given set of its parameters - into the expression cache - */ - virtual my_bool put_value(Item *value)= 0; - - /** - Print cache parameters - */ - virtual void print(String *str, enum_query_type query_type)= 0; - - /** - Is this cache initialized - */ - virtual bool is_inited()= 0; - /** - Initialize this cache - */ - virtual void init()= 0; - - /** - Save this object's statistics into Expression_cache_tracker object - */ - virtual void update_tracker()= 0; -}; - -struct st_table_ref; -struct st_join_table; -class Item_field; - - -class Expression_cache_tracker :public Sql_alloc -{ -public: - enum expr_cache_state {UNINITED, STOPPED, OK}; - Expression_cache_tracker(Expression_cache *c) : - cache(c), hit(0), miss(0), state(UNINITED) - {} - - Expression_cache *cache; - ulong hit, miss; - enum expr_cache_state state; - - static const char* state_str[3]; - void set(ulong h, ulong m, enum expr_cache_state s) - {hit= h; miss= m; state= s;} - - void fetch_current_stats() - { - if (cache) - cache->update_tracker(); - } -}; - - -/** - Implementation of expression cache over a temporary table -*/ - -class Expression_cache_tmptable :public Expression_cache -{ -public: - Expression_cache_tmptable(THD *thd, List &dependants, Item *value); - virtual ~Expression_cache_tmptable(); - virtual result check_value(Item **value); - virtual my_bool put_value(Item *value); - - void print(String *str, enum_query_type query_type); - bool is_inited() { return inited; }; - void init(); - - void set_tracker(Expression_cache_tracker *st) - { - tracker= st; - update_tracker(); - } - virtual void update_tracker() - { - if (tracker) - { - tracker->set(hit, miss, (inited ? (cache_table ? - Expression_cache_tracker::OK : - Expression_cache_tracker::STOPPED) : - Expression_cache_tracker::UNINITED)); - } - } - -private: - void disable_cache(); - - /* tmp table parameters */ - TMP_TABLE_PARAM cache_table_param; - /* temporary table to store this cache */ - TABLE *cache_table; - /* Thread handle for the temporary table */ - THD *table_thd; - /* EXPALIN/ANALYZE statistics */ - Expression_cache_tracker *tracker; - /* TABLE_REF for index lookup */ - struct st_table_ref ref; - /* Cached result */ - Item_field *cached_result; - /* List of parameter items */ - List &items; - /* Value Item example */ - Item *val; - /* hit/miss counters */ - ulong hit, miss; - /* Set on if the object has been successfully initialized with init() */ - bool inited; -}; - -#endif /* SQL_EXPRESSION_CACHE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_get_diagnostics.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_get_diagnostics.h deleted file mode 100644 index f283aa5..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_get_diagnostics.h +++ /dev/null @@ -1,318 +0,0 @@ -/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_GET_DIAGNOSTICS_H -#define SQL_GET_DIAGNOSTICS_H - -/** Diagnostics information forward reference. */ -class Diagnostics_information; - - -/** - Sql_cmd_get_diagnostics represents a GET DIAGNOSTICS statement. - - The GET DIAGNOSTICS statement retrieves exception or completion - condition information from a diagnostics area, usually pertaining - to the last non-diagnostic SQL statement that was executed. -*/ -class Sql_cmd_get_diagnostics : public Sql_cmd -{ -public: - /** - Constructor, used to represent a GET DIAGNOSTICS statement. - - @param info Diagnostics information to be obtained. - */ - Sql_cmd_get_diagnostics(Diagnostics_information *info) - : m_info(info) - {} - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_GET_DIAGNOSTICS; - } - - virtual bool execute(THD *thd); - -private: - /** The information to be obtained. */ - Diagnostics_information *m_info; -}; - - -/** - Represents the diagnostics information to be obtained. - - Diagnostic information is made available through statement - information and condition information items. -*/ -class Diagnostics_information : public Sql_alloc -{ -public: - /** - Which diagnostics area to access. - Only CURRENT is supported for now. - */ - enum Which_area - { - /** Access the first diagnostics area. */ - CURRENT_AREA - }; - - /** Set which diagnostics area to access. */ - void set_which_da(Which_area area) - { m_area= area; } - - /** Get which diagnostics area to access. */ - Which_area get_which_da(void) const - { return m_area; } - - /** - Aggregate diagnostics information. - - @param thd The current thread. - @param da The diagnostics area. - - @retval false on success. - @retval true on error - */ - virtual bool aggregate(THD *thd, const Diagnostics_area *da) = 0; - -protected: - /** - Diagnostics_information objects are allocated in thd->mem_root. - Do not rely on the destructor for any cleanup. - */ - virtual ~Diagnostics_information() - { - DBUG_ASSERT(false); - } - - /** - Evaluate a diagnostics information item in a specific context. - - @param thd The current thread. - @param diag_item The diagnostics information item. - @param ctx The context to evaluate the item. - - @retval false on success. - @retval true on error. - */ - template - bool evaluate(THD *thd, Diag_item *diag_item, Context ctx) - { - Item *value; - - /* Get this item's value. */ - if (! (value= diag_item->get_value(thd, ctx))) - return true; - - /* Set variable/parameter value. */ - return diag_item->set_value(thd, &value); - } - -private: - /** Which diagnostics area to access. */ - Which_area m_area; -}; - - -/** - A diagnostics information item. Used to associate a specific - diagnostics information item to a target variable. -*/ -class Diagnostics_information_item : public Sql_alloc -{ -public: - /** - Set a value for this item. - - @param thd The current thread. - @param value The obtained value. - - @retval false on success. - @retval true on error. - */ - bool set_value(THD *thd, Item **value); - -protected: - /** - Constructor, used to represent a diagnostics information item. - - @param target A target that gets the value of this item. - */ - Diagnostics_information_item(Item *target) - : m_target(target) - {} - - /** - Diagnostics_information_item objects are allocated in thd->mem_root. - Do not rely on the destructor for any cleanup. - */ - virtual ~Diagnostics_information_item() - { - DBUG_ASSERT(false); - } - -private: - /** The target variable that will receive the value of this item. */ - Item *m_target; -}; - - -/** - A statement information item. -*/ -class Statement_information_item : public Diagnostics_information_item -{ -public: - /** The name of a statement information item. */ - enum Name - { - NUMBER, - ROW_COUNT - }; - - /** - Constructor, used to represent a statement information item. - - @param name The name of this item. - @param target A target that gets the value of this item. - */ - Statement_information_item(Name name, Item *target) - : Diagnostics_information_item(target), m_name(name) - {} - - /** Obtain value of this statement information item. */ - Item *get_value(THD *thd, const Diagnostics_area *da); - -private: - /** The name of this statement information item. */ - Name m_name; -}; - - -/** - Statement information. - - @remark Provides information about the execution of a statement. -*/ -class Statement_information : public Diagnostics_information -{ -public: - /** - Constructor, used to represent the statement information of a - GET DIAGNOSTICS statement. - - @param items List of requested statement information items. - */ - Statement_information(List *items) - : m_items(items) - {} - - /** Obtain statement information in the context of a diagnostics area. */ - bool aggregate(THD *thd, const Diagnostics_area *da); - -private: - /* List of statement information items. */ - List *m_items; -}; - - -/** - A condition information item. -*/ -class Condition_information_item : public Diagnostics_information_item -{ -public: - /** - The name of a condition information item. - */ - enum Name - { - CLASS_ORIGIN, - SUBCLASS_ORIGIN, - CONSTRAINT_CATALOG, - CONSTRAINT_SCHEMA, - CONSTRAINT_NAME, - CATALOG_NAME, - SCHEMA_NAME, - TABLE_NAME, - COLUMN_NAME, - CURSOR_NAME, - MESSAGE_TEXT, - MYSQL_ERRNO, - RETURNED_SQLSTATE - }; - - /** - Constructor, used to represent a condition information item. - - @param name The name of this item. - @param target A target that gets the value of this item. - */ - Condition_information_item(Name name, Item *target) - : Diagnostics_information_item(target), m_name(name) - {} - - /** Obtain value of this condition information item. */ - Item *get_value(THD *thd, const Sql_condition *cond); - -private: - /** The name of this condition information item. */ - Name m_name; - - /** Create an string item to represent a condition item string. */ - Item *make_utf8_string_item(THD *thd, const String *str); -}; - - -/** - Condition information. - - @remark Provides information about conditions raised during the - execution of a statement. -*/ -class Condition_information : public Diagnostics_information -{ -public: - /** - Constructor, used to represent the condition information of a - GET DIAGNOSTICS statement. - - @param cond_number_expr Number that identifies the diagnostic condition. - @param items List of requested condition information items. - */ - Condition_information(Item *cond_number_expr, - List *items) - : m_cond_number_expr(cond_number_expr), m_items(items) - {} - - /** Obtain condition information in the context of a diagnostics area. */ - bool aggregate(THD *thd, const Diagnostics_area *da); - -private: - /** - Number that identifies the diagnostic condition for which - information is to be obtained. - */ - Item *m_cond_number_expr; - - /** List of condition information items. */ - List *m_items; -}; - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_handler.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_handler.h deleted file mode 100644 index 4ac0d09..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_handler.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef SQL_HANDLER_INCLUDED -#define SQL_HANDLER_INCLUDED -/* Copyright (c) 2006, 2015, Oracle and/or its affiliates. - Copyright (C) 2010, 2015, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_class.h" /* enum_ha_read_mode */ -#include "my_base.h" /* ha_rkey_function, ha_rows */ -#include "sql_list.h" /* List */ - -/* Open handlers are stored here */ - -class SQL_HANDLER { -public: - TABLE *table; - List fields; /* Fields, set on open */ - THD *thd; - LEX_CSTRING handler_name; - LEX_CSTRING db; - LEX_CSTRING table_name; - MEM_ROOT mem_root; - MYSQL_LOCK *lock; - MDL_request mdl_request; - - key_part_map keypart_map; - int keyno; /* Used key */ - uint key_len; - enum enum_ha_read_modes mode; - - /* This is only used when deleting many handler objects */ - SQL_HANDLER *next; - - Query_arena arena; - char *base_data; - SQL_HANDLER(THD *thd_arg) : - thd(thd_arg), arena(&mem_root, Query_arena::STMT_INITIALIZED) - { init(); clear_alloc_root(&mem_root); base_data= 0; } - void init() - { - keyno= -1; - table= 0; - lock= 0; - mdl_request.ticket= 0; - } - void reset(); - - ~SQL_HANDLER(); -}; - -class THD; -struct TABLE_LIST; - -bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen); -bool mysql_ha_close(THD *thd, TABLE_LIST *tables); -bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes, const char *, - List *,enum ha_rkey_function,Item *,ha_rows,ha_rows); -void mysql_ha_flush(THD *thd); -void mysql_ha_flush_tables(THD *thd, TABLE_LIST *all_tables); -void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables); -void mysql_ha_cleanup_no_free(THD *thd); -void mysql_ha_cleanup(THD *thd); -void mysql_ha_set_explicit_lock_duration(THD *thd); -void mysql_ha_rm_temporary_tables(THD *thd); - -SQL_HANDLER *mysql_ha_read_prepare(THD *thd, TABLE_LIST *tables, - enum enum_ha_read_modes mode, - const char *keyname, - List *key_expr, enum ha_rkey_function ha_rkey_mode, - Item *cond); -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_help.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_help.h deleted file mode 100644 index cb3314b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_help.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_HELP_INCLUDED -#define SQL_HELP_INCLUDED - -class THD; - - -/* - Function prototypes -*/ - -bool mysqld_help (THD *thd, const char *text); - -#endif /* SQL_HELP_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_hset.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_hset.h deleted file mode 100644 index b3d8165..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_hset.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef SQL_HSET_INCLUDED -#define SQL_HSET_INCLUDED -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "hash.h" - - -/** - A type-safe wrapper around mysys HASH. -*/ - -template -class Hash_set -{ -public: - enum { START_SIZE= 8 }; - /** - Constructs an empty hash. Does not allocate memory, it is done upon - the first insert. Thus does not cause or return errors. - */ - Hash_set(PSI_memory_key psi_key, uchar *(*K)(const T *, size_t *, my_bool), - CHARSET_INFO *cs= &my_charset_bin) - { - my_hash_clear(&m_hash); - m_hash.get_key= (my_hash_get_key)K; - m_hash.charset= cs; - m_hash.array.m_psi_key= psi_key; - } - Hash_set(PSI_memory_key psi_key, CHARSET_INFO *charset, ulong default_array_elements, - size_t key_offset, size_t key_length, my_hash_get_key get_key, - void (*free_element)(void*), uint flags) - { - my_hash_init(psi_key, &m_hash, charset, default_array_elements, key_offset, - key_length, get_key, free_element, flags); - } - /** - Destroy the hash by freeing the buckets table. Does - not call destructors for the elements. - */ - ~Hash_set() - { - my_hash_free(&m_hash); - } - /** - Insert a single value into a hash. Does not tell whether - the value was inserted -- if an identical value existed, - it is not replaced. - - @retval TRUE Out of memory. - @retval FALSE OK. The value either was inserted or existed - in the hash. - */ - bool insert(T *value) - { - my_hash_init_opt(m_hash.array.m_psi_key, &m_hash, m_hash.charset, - START_SIZE, 0, 0, m_hash.get_key, 0, HASH_UNIQUE); - return my_hash_insert(&m_hash, reinterpret_cast(value)); - } - bool remove(T *value) - { - return my_hash_delete(&m_hash, reinterpret_cast(value)); - } - T *find(const void *key, size_t klen) const - { - return (T*)my_hash_search(&m_hash, reinterpret_cast(key), klen); - } - /** Is this hash set empty? */ - bool is_empty() const { return m_hash.records == 0; } - /** Returns the number of unique elements. */ - size_t size() const { return static_cast(m_hash.records); } - /** Erases all elements from the container */ - void clear() { my_hash_reset(&m_hash); } - const T* at(size_t i) const - { - return reinterpret_cast(my_hash_element(const_cast(&m_hash), i)); - } - /** An iterator over hash elements. Is not insert-stable. */ - class Iterator - { - public: - Iterator(Hash_set &hash_set) - : m_hash(&hash_set.m_hash), - m_idx(0) - {} - /** - Return the current element and reposition the iterator to the next - element. - */ - inline T *operator++(int) - { - if (m_idx < m_hash->records) - return reinterpret_cast(my_hash_element(m_hash, m_idx++)); - return NULL; - } - void rewind() { m_idx= 0; } - private: - HASH *m_hash; - uint m_idx; - }; -private: - HASH m_hash; -}; - -#endif // SQL_HSET_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_i_s.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_i_s.h deleted file mode 100644 index b9a768f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_i_s.h +++ /dev/null @@ -1,360 +0,0 @@ -#ifndef SQL_I_S_INCLUDED -#define SQL_I_S_INCLUDED -/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "sql_const.h" // MAX_FIELD_VARCHARLENGTH -#include "sql_basic_types.h" // enum_nullability -#include "sql_string.h" // strlen, MY_CS_NAME_SIZE -#include "lex_string.h" // LEX_CSTRING -#include "mysql_com.h" // enum_field_types -#include "my_time.h" // TIME_SECOND_PART_DIGITS -#include "sql_type.h" // Type_handler_xxx - -struct TABLE_LIST; -struct TABLE; -typedef class Item COND; - -#ifdef MYSQL_CLIENT -#error MYSQL_CLIENT must not be defined -#endif // MYSQL_CLIENT - - -bool schema_table_store_record(THD *thd, TABLE *table); -COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table); - - -enum enum_show_open_table -{ - SKIP_OPEN_TABLE= 0U, // do not open table - OPEN_FRM_ONLY= 1U, // open FRM file only - OPEN_FULL_TABLE= 2U // open FRM,MYD, MYI files -}; - - -enum enum_show_default -{ - DEFAULT_TYPE_IMPLICIT= 0, - DEFAULT_NONE -}; - - -namespace Show { -class Type -{ - /** - This denotes data type for the column. For the most part, there seems to - be one entry in the enum for each SQL data type, although there seem to - be a number of additional entries in the enum. - */ - const Type_handler *m_type_handler; - /** - For string-type columns, this is the maximum number of - characters. Otherwise, it is the 'display-length' for the column. - */ - uint m_char_length; - uint m_unsigned_flag; - const Typelib *m_typelib; -public: - Type(const Type_handler *th, uint length, uint unsigned_flag, - const Typelib *typelib= NULL) - :m_type_handler(th), m_char_length(length), m_unsigned_flag(unsigned_flag), - m_typelib(typelib) - { } - const Type_handler *type_handler() const { return m_type_handler; } - uint char_length() const { return m_char_length; } - uint decimal_precision() const { return (m_char_length / 100) % 100; } - uint decimal_scale() const { return m_char_length % 10; } - uint fsp() const - { - DBUG_ASSERT(m_char_length <= TIME_SECOND_PART_DIGITS); - return m_char_length; - } - uint unsigned_flag() const { return m_unsigned_flag; } - const Typelib *typelib() const { return m_typelib; } -}; -} // namespace Show - - - -class ST_FIELD_INFO: public Show::Type -{ -protected: - LEX_CSTRING m_name; // I_S column name - enum_nullability m_nullability; // NULLABLE or NOT NULL - enum_show_default m_def; // Whether has a DEFAULT value - LEX_CSTRING m_old_name; // SHOW column name - enum_show_open_table m_open_method; -public: - ST_FIELD_INFO(const LEX_CSTRING &name, const Type &type, - enum_nullability nullability, - enum_show_default def, - LEX_CSTRING &old_name, - enum_show_open_table open_method) - :Type(type), m_name(name), - m_nullability(nullability), - m_def(def), - m_old_name(old_name), - m_open_method(open_method) - { } - ST_FIELD_INFO(const char *name, const Type &type, - enum_nullability nullability, - enum_show_default def, - const char *old_name, - enum_show_open_table open_method) - :Type(type), - m_nullability(nullability), - m_def(def), - m_open_method(open_method) - { - m_name.str= name; - m_name.length= safe_strlen(name); - m_old_name.str= old_name; - m_old_name.length= safe_strlen(old_name); - } - const LEX_CSTRING &name() const { return m_name; } - bool nullable() const { return m_nullability == NULLABLE; } - enum_show_default def() const { return m_def; } - const LEX_CSTRING &old_name() const { return m_old_name; } - enum_show_open_table open_method() const { return m_open_method; } - bool end_marker() const { return m_name.str == NULL; } -}; - - -namespace Show -{ - - -class Enum: public Type -{ -public: - Enum(const Typelib *typelib) :Type(&type_handler_enum, 0, false, typelib) { } -}; - - -class Blob: public Type -{ -public: - Blob(uint length) :Type(&type_handler_blob, length, false) { } -}; - - -class Varchar: public Type -{ -public: - Varchar(uint length) :Type(&type_handler_varchar, length, false) - { - DBUG_ASSERT(length * 3 <= MAX_FIELD_VARCHARLENGTH); - } -}; - - -class Longtext: public Type -{ -public: - Longtext(uint length) :Type(&type_handler_varchar, length, false) { } -}; - - -class Yesno: public Varchar -{ -public: - Yesno(): Varchar(3) { } -}; - - -class Catalog: public Varchar -{ -public: - Catalog(): Varchar(FN_REFLEN) { } -}; - - -class Name: public Varchar -{ -public: - Name(): Varchar(NAME_CHAR_LEN) { } -}; - - -class Definer: public Varchar -{ -public: - Definer(): Varchar(DEFINER_CHAR_LENGTH) { } -}; - - -class Userhost: public Varchar -{ -public: - Userhost(): Varchar(USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 2) { } -}; - - -class CSName: public Varchar -{ -public: - CSName(): Varchar(MY_CS_NAME_SIZE) { } -}; - - -class SQLMode: public Varchar -{ -public: - SQLMode(): Varchar(32*256) { } -}; - - -class Datetime: public Type -{ -public: - Datetime(uint dec) :Type(&type_handler_datetime2, dec, false) { } -}; - - -class Decimal: public Type -{ -public: - Decimal(uint length) :Type(&type_handler_newdecimal, length, false) { } -}; - - -class ULonglong: public Type -{ -public: - ULonglong(uint length) :Type(&type_handler_ulonglong, length, true) { } - ULonglong() :ULonglong(MY_INT64_NUM_DECIMAL_DIGITS) { } -}; - - -class ULong: public Type -{ -public: - ULong(uint length) :Type(&type_handler_ulong, length, true) { } - ULong() :ULong(MY_INT32_NUM_DECIMAL_DIGITS) { } -}; - - -class SLonglong: public Type -{ -public: - SLonglong(uint length) :Type(&type_handler_slonglong, length, false) { } - SLonglong() :SLonglong(MY_INT64_NUM_DECIMAL_DIGITS) { } -}; - - -class SLong: public Type -{ -public: - SLong(uint length) :Type(&type_handler_slong, length, false) { } - SLong() :SLong(MY_INT32_NUM_DECIMAL_DIGITS) { } -}; - - -class SShort: public Type -{ -public: - SShort(uint length) :Type(&type_handler_sshort, length, false) { } -}; - - -class STiny: public Type -{ -public: - STiny(uint length) :Type(&type_handler_stiny, length, false) { } -}; - - -class Double: public Type -{ -public: - Double(uint length) :Type(&type_handler_double, length, false) { } -}; - - -class Float: public Type -{ -public: - Float(uint length) :Type(&type_handler_float, length, false) { } -}; - - - -class Column: public ST_FIELD_INFO -{ -public: - Column(const char *name, const Type &type, - enum_nullability nullability, - enum_show_default def, - const char *old_name, - enum_show_open_table open_method= SKIP_OPEN_TABLE) - :ST_FIELD_INFO(name, type, nullability, def, old_name, open_method) - { } - Column(const char *name, const Type &type, enum_nullability nullability, - enum_show_default def, - enum_show_open_table open_method= SKIP_OPEN_TABLE) - :ST_FIELD_INFO(name, type, nullability, def, NullS, open_method) - { } - Column(const char *name, const Type &type, - enum_nullability nullability, - const char *old_name, - enum_show_open_table open_method= SKIP_OPEN_TABLE) - :ST_FIELD_INFO(name, type, nullability, DEFAULT_TYPE_IMPLICIT, - old_name, open_method) - { } - Column(const char *name, const Type &type, - enum_nullability nullability, - enum_show_open_table open_method= SKIP_OPEN_TABLE) - :ST_FIELD_INFO(name, type, nullability, DEFAULT_TYPE_IMPLICIT, - NullS, open_method) - { } -}; - - -// End marker -class CEnd: public Column -{ -public: - CEnd() :Column(NullS, Varchar(0), NOT_NULL, NullS, SKIP_OPEN_TABLE) { } -}; - - -} // namespace Show - - -struct TABLE_LIST; -typedef class Item COND; - -typedef struct st_schema_table -{ - const char *table_name; - ST_FIELD_INFO *fields_info; - /* for FLUSH table_name */ - int (*reset_table) (); - /* Fill table with data */ - int (*fill_table) (THD *thd, TABLE_LIST *tables, COND *cond); - /* Handle fileds for old SHOW */ - int (*old_format) (THD *thd, struct st_schema_table *schema_table); - int (*process_table) (THD *thd, TABLE_LIST *tables, TABLE *table, - bool res, const LEX_CSTRING *db_name, - const LEX_CSTRING *table_name); - int idx_field1, idx_field2; - bool hidden; - uint i_s_requested_object; /* the object we need to open(TABLE | VIEW) */ -} ST_SCHEMA_TABLE; - - -#endif // SQL_I_S_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_insert.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_insert.h deleted file mode 100644 index 80666a8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_insert.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_INSERT_INCLUDED -#define SQL_INSERT_INCLUDED - -#include "sql_class.h" /* enum_duplicates */ -#include "sql_list.h" - -/* Instead of including sql_lex.h we add this typedef here */ -typedef List List_item; -typedef struct st_copy_info COPY_INFO; - -int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, - List &fields, List_item *values, - List &update_fields, - List &update_values, enum_duplicates duplic, - COND **where, bool select_insert); -bool mysql_insert(THD *thd,TABLE_LIST *table,List &fields, - List &values, List &update_fields, - List &update_values, enum_duplicates flag, - bool ignore, select_result* result); -void upgrade_lock_type_for_insert(THD *thd, thr_lock_type *lock_type, - enum_duplicates duplic, - bool is_multi_insert); -int check_that_all_fields_are_given_values(THD *thd, TABLE *entry, - TABLE_LIST *table_list); -int vers_insert_history_row(TABLE *table); -int check_duplic_insert_without_overlaps(THD *thd, TABLE *table, - enum_duplicates duplic); -int write_record(THD *thd, TABLE *table, COPY_INFO *info, - select_result *returning= NULL); -void kill_delayed_threads(void); -bool binlog_create_table(THD *thd, TABLE *table, bool replace); -bool binlog_drop_table(THD *thd, TABLE *table); - -#ifdef EMBEDDED_LIBRARY -inline void kill_delayed_threads(void) {} -#endif - -#endif /* SQL_INSERT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_join_cache.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_join_cache.h deleted file mode 100644 index 7b8b942..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_join_cache.h +++ /dev/null @@ -1,1443 +0,0 @@ -/* - Copyright (c) 2011, 2012, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - This file contains declarations for implementations - of block based join algorithms -*/ - -#define JOIN_CACHE_INCREMENTAL_BIT 1 -#define JOIN_CACHE_HASHED_BIT 2 -#define JOIN_CACHE_BKA_BIT 4 - -/* - Categories of data fields of variable length written into join cache buffers. - The value of any of these fields is written into cache together with the - prepended length of the value. -*/ -#define CACHE_BLOB 1 /* blob field */ -#define CACHE_STRIPPED 2 /* field stripped of trailing spaces */ -#define CACHE_VARSTR1 3 /* short string value (length takes 1 byte) */ -#define CACHE_VARSTR2 4 /* long string value (length takes 2 bytes) */ -#define CACHE_ROWID 5 /* ROWID field */ - -/* - The CACHE_FIELD structure used to describe fields of records that - are written into a join cache buffer from record buffers and backward. -*/ -typedef struct st_cache_field { - uchar *str; /**< buffer from/to where the field is to be copied */ - uint length; /**< maximal number of bytes to be copied from/to str */ - /* - Field object for the moved field - (0 - for a flag field, see JOIN_CACHE::create_flag_fields). - */ - Field *field; - uint type; /**< category of the of the copied field (CACHE_BLOB et al.) */ - /* - The number of the record offset value for the field in the sequence - of offsets placed after the last field of the record. These - offset values are used to access fields referred to from other caches. - If the value is 0 then no offset for the field is saved in the - trailing sequence of offsets. - */ - uint referenced_field_no; - /* The remaining structure fields are used as containers for temp values */ - uint blob_length; /**< length of the blob to be copied */ - uint offset; /**< field offset to be saved in cache buffer */ -} CACHE_FIELD; - - -class JOIN_TAB_SCAN; - -class EXPLAIN_BKA_TYPE; - -/* - JOIN_CACHE is the base class to support the implementations of - - Block Nested Loop (BNL) Join Algorithm, - - Block Nested Loop Hash (BNLH) Join Algorithm, - - Batched Key Access (BKA) Join Algorithm. - - The first algorithm is supported by the derived class JOIN_CACHE_BNL, - the second algorithm is supported by the derived class JOIN_CACHE_BNLH, - while the third algorithm is implemented in two variant supported by - the classes JOIN_CACHE_BKA and JOIN_CACHE_BKAH. - These three algorithms have a lot in common. Each of them first accumulates - the records of the left join operand in a join buffer and then searches for - matching rows of the second operand for all accumulated records. - For the first two algorithms this strategy saves on logical I/O operations: - the entire set of records from the join buffer requires only one look-through - of the records provided by the second operand. - For the third algorithm the accumulation of records allows to optimize - fetching rows of the second operand from disk for some engines (MyISAM, - InnoDB), or to minimize the number of round-trips between the Server and - the engine nodes. -*/ - -class JOIN_CACHE :public Sql_alloc -{ - -private: - - /* Size of the offset of a record from the cache */ - uint size_of_rec_ofs; - /* Size of the length of a record in the cache */ - uint size_of_rec_len; - /* Size of the offset of a field within a record in the cache */ - uint size_of_fld_ofs; - - /* This structure is used only for explain, not for execution */ - bool for_explain_only; - -protected: - - /* 3 functions below actually do not use the hidden parameter 'this' */ - - /* Calculate the number of bytes used to store an offset value */ - uint offset_size(size_t len) - { return (len < 256 ? 1 : len < 256*256 ? 2 : 4); } - - /* Get the offset value that takes ofs_sz bytes at the position ptr */ - ulong get_offset(uint ofs_sz, uchar *ptr) - { - switch (ofs_sz) { - case 1: return uint(*ptr); - case 2: return uint2korr(ptr); - case 4: return uint4korr(ptr); - } - return 0; - } - - /* Set the offset value ofs that takes ofs_sz bytes at the position ptr */ - void store_offset(uint ofs_sz, uchar *ptr, ulong ofs) - { - switch (ofs_sz) { - case 1: *ptr= (uchar) ofs; return; - case 2: int2store(ptr, (uint16) ofs); return; - case 4: int4store(ptr, (uint32) ofs); return; - } - } - - /* - The maximum total length of the fields stored for a record in the cache. - For blob fields only the sizes of the blob lengths are taken into account. - */ - uint length; - - /* - Representation of the executed multi-way join through which all needed - context can be accessed. - */ - JOIN *join; - - /* - JOIN_TAB of the first table that can have it's fields in the join cache. - That is, tables in the [start_tab, tab) range can have their fields in the - join cache. - If a join tab in the range represents an SJM-nest, then all tables from the - nest can have their fields in the join cache, too. - */ - JOIN_TAB *start_tab; - - /* - The total number of flag and data fields that can appear in a record - written into the cache. Fields with null values are always skipped - to save space. - */ - uint fields; - - /* - The total number of flag fields in a record put into the cache. They are - used for table null bitmaps, table null row flags, and an optional match - flag. Flag fields go before other fields in a cache record with the match - flag field placed always at the very beginning of the record. - */ - uint flag_fields; - - /* The total number of blob fields that are written into the cache */ - uint blobs; - - /* - The total number of fields referenced from field descriptors for other join - caches. These fields are used to construct key values. - When BKA join algorithm is employed the constructed key values serve to - access matching rows with index lookups. - The key values are put into a hash table when the BNLH join algorithm - is employed and when BKAH is used for the join operation. - */ - uint referenced_fields; - - /* - The current number of already created data field descriptors. - This number can be useful for implementations of the init methods. - */ - uint data_field_count; - - /* - The current number of already created pointers to the data field - descriptors. This number can be useful for implementations of - the init methods. - */ - uint data_field_ptr_count; - - /* - Array of the descriptors of fields containing 'fields' elements. - These are all fields that are stored for a record in the cache. - */ - CACHE_FIELD *field_descr; - - /* - Array of pointers to the blob descriptors that contains 'blobs' elements. - */ - CACHE_FIELD **blob_ptr; - - /* - This flag indicates that records written into the join buffer contain - a match flag field. The flag must be set by the init method. - */ - bool with_match_flag; - /* - This flag indicates that any record is prepended with the length of the - record which allows us to skip the record or part of it without reading. - */ - bool with_length; - - /* - The maximal number of bytes used for a record representation in - the cache excluding the space for blob data. - For future derived classes this representation may contains some - redundant info such as a key value associated with the record. - */ - uint pack_length; - /* - The value of pack_length incremented by the total size of all - pointers of a record in the cache to the blob data. - */ - uint pack_length_with_blob_ptrs; - - /* - The total size of the record base prefix. The base prefix of record may - include the following components: - - the length of the record - - the link to a record in a previous buffer. - Each record in the buffer are supplied with the same set of the components. - */ - uint base_prefix_length; - - /* - The expected length of a record in the join buffer together with - all prefixes and postfixes - */ - size_t avg_record_length; - - /* The expected size of the space per record in the auxiliary buffer */ - size_t avg_aux_buffer_incr; - - /* Expected join buffer space used for one record */ - size_t space_per_record; - - /* Pointer to the beginning of the join buffer */ - uchar *buff; - /* - Size of the entire memory allocated for the join buffer. - Part of this memory may be reserved for the auxiliary buffer. - */ - size_t buff_size; - /* The minimal join buffer size when join buffer still makes sense to use */ - size_t min_buff_size; - /* The maximum expected size if the join buffer to be used */ - size_t max_buff_size; - /* Size of the auxiliary buffer */ - size_t aux_buff_size; - - /* The number of records put into the join buffer */ - size_t records; - /* - The number of records in the fully refilled join buffer of - the minimal size equal to min_buff_size - */ - size_t min_records; - /* - The maximum expected number of records to be put in the join buffer - at one refill - */ - size_t max_records; - - /* - Pointer to the current position in the join buffer. - This member is used both when writing to buffer and - when reading from it. - */ - uchar *pos; - /* - Pointer to the first free position in the join buffer, - right after the last record into it. - */ - uchar *end_pos; - - /* - Pointer to the beginning of the first field of the current read/write - record from the join buffer. The value is adjusted by the - get_record/put_record functions. - */ - uchar *curr_rec_pos; - /* - Pointer to the beginning of the first field of the last record - from the join buffer. - */ - uchar *last_rec_pos; - - /* - Flag is set if the blob data for the last record in the join buffer - is in record buffers rather than in the join cache. - */ - bool last_rec_blob_data_is_in_rec_buff; - - /* - Pointer to the position to the current record link. - Record links are used only with linked caches. Record links allow to set - connections between parts of one join record that are stored in different - join buffers. - In the simplest case a record link is just a pointer to the beginning of - the record stored in the buffer. - In a more general case a link could be a reference to an array of pointers - to records in the buffer. - */ - uchar *curr_rec_link; - - /* - This flag is set to TRUE if join_tab is the first inner table of an outer - join and the latest record written to the join buffer is detected to be - null complemented after checking on conditions over the outer tables for - this outer join operation - */ - bool last_written_is_null_compl; - - /* - The number of fields put in the join buffer of the join cache that are - used in building keys to access the table join_tab - */ - uint local_key_arg_fields; - /* - The total number of the fields in the previous caches that are used - in building keys to access the table join_tab - */ - uint external_key_arg_fields; - - /* - This flag indicates that the key values will be read directly from the join - buffer. It will save us building key values in the key buffer. - */ - bool use_emb_key; - /* The length of an embedded key value */ - uint emb_key_length; - - /* - This object provides the methods to iterate over records of - the joined table join_tab when looking for join matches between - records from join buffer and records from join_tab. - BNL and BNLH join algorithms retrieve all records from join_tab, - while BKA/BKAH algorithm iterates only over those records from - join_tab that can be accessed by look-ups with join keys built - from records in join buffer. - */ - JOIN_TAB_SCAN *join_tab_scan; - - void calc_record_fields(); - void collect_info_on_key_args(); - int alloc_fields(); - void create_flag_fields(); - void create_key_arg_fields(); - void create_remaining_fields(); - void set_constants(); - int alloc_buffer(); - - /* Shall reallocate the join buffer */ - virtual int realloc_buffer(); - - /* Check the possibility to read the access keys directly from join buffer */ - bool check_emb_key_usage(); - - uint get_size_of_rec_offset() { return size_of_rec_ofs; } - uint get_size_of_rec_length() { return size_of_rec_len; } - uint get_size_of_fld_offset() { return size_of_fld_ofs; } - - uchar *get_rec_ref(uchar *ptr) - { - return buff+get_offset(size_of_rec_ofs, ptr-size_of_rec_ofs); - } - ulong get_rec_length(uchar *ptr) - { - return (ulong) get_offset(size_of_rec_len, ptr); - } - ulong get_fld_offset(uchar *ptr) - { - return (ulong) get_offset(size_of_fld_ofs, ptr); - } - - void store_rec_ref(uchar *ptr, uchar* ref) - { - store_offset(size_of_rec_ofs, ptr-size_of_rec_ofs, (ulong) (ref-buff)); - } - void store_rec_length(uchar *ptr, ulong len) - { - store_offset(size_of_rec_len, ptr, len); - } - void store_fld_offset(uchar *ptr, ulong ofs) - { - store_offset(size_of_fld_ofs, ptr, ofs); - } - - /* Write record fields and their required offsets into the join buffer */ - uint write_record_data(uchar *link, bool *is_full); - - /* Get the total length of all prefixes of a record in the join buffer */ - virtual uint get_prefix_length() { return base_prefix_length; } - /* Get maximum total length of all affixes of a record in the join buffer */ - virtual uint get_record_max_affix_length(); - - /* - Shall get maximum size of the additional space per record used for - record keys - */ - virtual uint get_max_key_addon_space_per_record() { return 0; } - - /* - This method must determine for how much the auxiliary buffer should be - incremented when a new record is added to the join buffer. - If no auxiliary buffer is needed the function should return 0. - */ - virtual uint aux_buffer_incr(size_t recno); - - /* Shall calculate how much space is remaining in the join buffer */ - virtual size_t rem_space() - { - return MY_MAX(buff_size-(end_pos-buff)-aux_buff_size,0); - } - - /* - Shall calculate how much space is taken by allocation of the key - for a record in the join buffer - */ - virtual uint extra_key_length() { return 0; } - - /* Read all flag and data fields of a record from the join buffer */ - uint read_all_record_fields(); - - /* Read all flag fields of a record from the join buffer */ - uint read_flag_fields(); - - /* Read a data record field from the join buffer */ - uint read_record_field(CACHE_FIELD *copy, bool last_record); - - /* Read a referenced field from the join buffer */ - bool read_referenced_field(CACHE_FIELD *copy, uchar *rec_ptr, uint *len); - - /* - Shall skip record from the join buffer if its match flag - is set to MATCH_FOUND - */ - virtual bool skip_if_matched(); - - /* - Shall skip record from the join buffer if its match flag - commands to do so - */ - virtual bool skip_if_not_needed_match(); - - /* - True if rec_ptr points to the record whose blob data stay in - record buffers - */ - bool blob_data_is_in_rec_buff(uchar *rec_ptr) - { - return rec_ptr == last_rec_pos && last_rec_blob_data_is_in_rec_buff; - } - - /* Find matches from the next table for records from the join buffer */ - virtual enum_nested_loop_state join_matching_records(bool skip_last); - - /* Shall set an auxiliary buffer up (currently used only by BKA joins) */ - virtual int setup_aux_buffer(HANDLER_BUFFER &aux_buff) - { - DBUG_ASSERT(0); - return 0; - } - - /* - Shall get the number of ranges in the cache buffer passed - to the MRR interface - */ - virtual uint get_number_of_ranges_for_mrr() { return 0; }; - - /* - Shall prepare to look for records from the join cache buffer that would - match the record of the joined table read into the record buffer - */ - virtual bool prepare_look_for_matches(bool skip_last)= 0; - /* - Shall return a pointer to the record from join buffer that is checked - as the next candidate for a match with the current record from join_tab. - Each implementation of this virtual function should bare in mind - that the record position it returns shall be exactly the position - passed as the parameter to the implementations of the virtual functions - skip_next_candidate_for_match and read_next_candidate_for_match. - */ - virtual uchar *get_next_candidate_for_match()= 0; - /* - Shall check whether the given record from the join buffer has its match - flag settings commands to skip the record in the buffer. - */ - virtual bool skip_next_candidate_for_match(uchar *rec_ptr)= 0; - /* - Shall read the given record from the join buffer into the - the corresponding record buffer - */ - virtual void read_next_candidate_for_match(uchar *rec_ptr)= 0; - - /* - Shall return the location of the association label returned by - the multi_read_range_next function for the current record loaded - into join_tab's record buffer - */ - virtual uchar **get_curr_association_ptr() { return 0; }; - - /* Add null complements for unmatched outer records from the join buffer */ - virtual enum_nested_loop_state join_null_complements(bool skip_last); - - /* Restore the fields of the last record from the join buffer */ - virtual void restore_last_record(); - - /* Set match flag for a record in join buffer if it has not been set yet */ - bool set_match_flag_if_none(JOIN_TAB *first_inner, uchar *rec_ptr); - - enum_nested_loop_state generate_full_extensions(uchar *rec_ptr); - - /* Check matching to a partial join record from the join buffer */ - bool check_match(uchar *rec_ptr); - - /* - This constructor creates an unlinked join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. - */ - JOIN_CACHE(JOIN *j, JOIN_TAB *tab) - { - join= j; - join_tab= tab; - prev_cache= next_cache= 0; - buff= 0; - } - - /* - This constructor creates a linked join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. The parameter 'prev' specifies the previous - cache object to which this cache is linked. - */ - JOIN_CACHE(JOIN *j, JOIN_TAB *tab, JOIN_CACHE *prev) - { - join= j; - join_tab= tab; - next_cache= 0; - prev_cache= prev; - buff= 0; - if (prev) - prev->next_cache= this; - } - -public: - - /* - The enumeration type Join_algorithm includes a mnemonic constant for - each join algorithm that employs join buffers - */ - - enum Join_algorithm - { - BNL_JOIN_ALG, /* Block Nested Loop Join algorithm */ - BNLH_JOIN_ALG, /* Block Nested Loop Hash Join algorithm */ - BKA_JOIN_ALG, /* Batched Key Access Join algorithm */ - BKAH_JOIN_ALG /* Batched Key Access with Hash Table Join Algorithm */ - }; - - /* - The enumeration type Match_flag describes possible states of the match flag - field stored for the records of the first inner tables of outer joins and - semi-joins in the cases when the first match strategy is used for them. - When a record with match flag field is written into the join buffer the - state of the field usually is MATCH_NOT_FOUND unless this is a record of the - first inner table of the outer join for which the on precondition (the - condition from on expression over outer tables) has turned out not to be - true. In the last case the state of the match flag is MATCH_IMPOSSIBLE. - The state of the match flag field is changed to MATCH_FOUND as soon as - the first full matching combination of inner tables of the outer join or - the semi-join is discovered. - */ - enum Match_flag { MATCH_NOT_FOUND, MATCH_FOUND, MATCH_IMPOSSIBLE }; - - /* Table to be joined with the partial join records from the cache */ - JOIN_TAB *join_tab; - - /* Pointer to the previous join cache if there is any */ - JOIN_CACHE *prev_cache; - /* Pointer to the next join cache if there is any */ - JOIN_CACHE *next_cache; - - /* Shall initialize the join cache structure */ - virtual int init(bool for_explain); - - /* Get the current size of the cache join buffer */ - size_t get_join_buffer_size() { return buff_size; } - /* Set the size of the cache join buffer to a new value */ - void set_join_buffer_size(size_t sz) { buff_size= sz; } - - /* Get the minimum possible size of the cache join buffer */ - virtual size_t get_min_join_buffer_size(); - /* Get the maximum possible size of the cache join buffer */ - virtual size_t get_max_join_buffer_size(bool optimize_buff_size); - - /* Shrink the size if the cache join buffer in a given ratio */ - bool shrink_join_buffer_in_ratio(ulonglong n, ulonglong d); - - /* Shall return the type of the employed join algorithm */ - virtual enum Join_algorithm get_join_alg()= 0; - - /* - The function shall return TRUE only when there is a key access - to the join table - */ - virtual bool is_key_access()= 0; - - /* Shall reset the join buffer for reading/writing */ - virtual void reset(bool for_writing); - - /* - This function shall add a record into the join buffer and return TRUE - if it has been decided that it should be the last record in the buffer. - */ - virtual bool put_record(); - - /* - This function shall read the next record into the join buffer and return - TRUE if there is no more next records. - */ - virtual bool get_record(); - - /* - This function shall read the record at the position rec_ptr - in the join buffer - */ - virtual void get_record_by_pos(uchar *rec_ptr); - - /* Shall return the value of the match flag for the positioned record */ - virtual enum Match_flag get_match_flag_by_pos(uchar *rec_ptr); - - /* Shall return the position of the current record */ - virtual uchar *get_curr_rec() { return curr_rec_pos; } - - /* Shall set the current record link */ - virtual void set_curr_rec_link(uchar *link) { curr_rec_link= link; } - - /* Shall return the current record link */ - virtual uchar *get_curr_rec_link() - { - return (curr_rec_link ? curr_rec_link : get_curr_rec()); - } - - /* Join records from the join buffer with records from the next join table */ - enum_nested_loop_state join_records(bool skip_last); - - /* Add a comment on the join algorithm employed by the join cache */ - virtual bool save_explain_data(EXPLAIN_BKA_TYPE *explain); - - THD *thd(); - - virtual ~JOIN_CACHE() {} - void reset_join(JOIN *j) { join= j; } - void free() - { - my_free(buff); - buff= 0; - } - - friend class JOIN_CACHE_HASHED; - friend class JOIN_CACHE_BNL; - friend class JOIN_CACHE_BKA; - friend class JOIN_TAB_SCAN; - friend class JOIN_TAB_SCAN_MRR; - -}; - - -/* - The class JOIN_CACHE_HASHED is the base class for the classes - JOIN_CACHE_HASHED_BNL and JOIN_CACHE_HASHED_BKA. The first of them supports - an implementation of Block Nested Loop Hash (BNLH) Join Algorithm, - while the second is used for a variant of the BKA Join algorithm that performs - only one lookup for any records from join buffer with the same key value. - For a join cache of this class the records from the join buffer that have - the same access key are linked into a chain attached to a key entry structure - that either itself contains the key value, or, in the case when the keys are - embedded, refers to its occurrence in one of the records from the chain. - To build the chains with the same keys a hash table is employed. It is placed - at the very end of the join buffer. The array of hash entries is allocated - first at the very bottom of the join buffer, while key entries are placed - before this array. - A hash entry contains a header of the list of the key entries with the same - hash value. - Each key entry is a structure of the following type: - struct st_join_cache_key_entry { - union { - uchar[] value; - cache_ref *value_ref; // offset from the beginning of the buffer - } hash_table_key; - key_ref next_key; // offset backward from the beginning of hash table - cache_ref *last_rec // offset from the beginning of the buffer - } - The references linking the records in a chain are always placed at the very - beginning of the record info stored in the join buffer. The records are - linked in a circular list. A new record is always added to the end of this - list. - - The following picture represents a typical layout for the info stored in the - join buffer of a join cache object of the JOIN_CACHE_HASHED class. - - buff - V - +----------------------------------------------------------------------------+ - | |[*]record_1_1| | - | ^ | | - | | +--------------------------------------------------+ | - | | |[*]record_2_1| | | - | | ^ | V | - | | | +------------------+ |[*]record_1_2| | - | | +--------------------+-+ | | - |+--+ +---------------------+ | | +-------------+ | - || | | V | | | - |||[*]record_3_1| |[*]record_1_3| |[*]record_2_2| | | - ||^ ^ ^ | | - ||+----------+ | | | | - ||^ | |<---------------------------+-------------------+ | - |++ | | ... mrr | buffer ... ... | | | - | | | | | - | +-----+--------+ | +-----|-------+ | - | V | | | V | | | - ||key_3|[/]|[*]| | | |key_2|[/]|[*]| | | - | +-+---|-----------------------+ | | - | V | | | | | - | |key_1|[*]|[*]| | | ... |[*]| ... |[*]| ... | | - +----------------------------------------------------------------------------+ - ^ ^ ^ - | i-th entry j-th entry - hash table - - i-th hash entry: - circular record chain for key_1: - record_1_1 - record_1_2 - record_1_3 (points to record_1_1) - circular record chain for key_3: - record_3_1 (points to itself) - - j-th hash entry: - circular record chain for key_2: - record_2_1 - record_2_2 (points to record_2_1) - -*/ - -class JOIN_CACHE_HASHED: public JOIN_CACHE -{ - - typedef uint (JOIN_CACHE_HASHED::*Hash_func) (uchar *key, uint key_len); - typedef bool (JOIN_CACHE_HASHED::*Hash_cmp_func) (uchar *key1, uchar *key2, - uint key_len); - -private: - - /* Size of the offset of a key entry in the hash table */ - uint size_of_key_ofs; - - /* - Length of the key entry in the hash table. - A key entry either contains the key value, or it contains a reference - to the key value if use_emb_key flag is set for the cache. - */ - uint key_entry_length; - - /* The beginning of the hash table in the join buffer */ - uchar *hash_table; - /* Number of hash entries in the hash table */ - uint hash_entries; - - - /* The position of the currently retrieved key entry in the hash table */ - uchar *curr_key_entry; - - /* The offset of the data fields from the beginning of the record fields */ - uint data_fields_offset; - - inline uint get_hash_idx_simple(uchar *key, uint key_len); - inline uint get_hash_idx_complex(uchar *key, uint key_len); - - inline bool equal_keys_simple(uchar *key1, uchar *key2, uint key_len); - inline bool equal_keys_complex(uchar *key1, uchar *key2, uint key_len); - - int init_hash_table(); - void cleanup_hash_table(); - -protected: - - /* - Index info on the TABLE_REF object used by the hash join - to look for matching records - */ - KEY *ref_key_info; - /* - Number of the key parts the TABLE_REF object used by the hash join - to look for matching records - */ - uint ref_used_key_parts; - - /* - The hash function used in the hash table, - usually set by the init() method - */ - Hash_func hash_func; - /* - The function to check whether two key entries in the hash table - are equal or not, usually set by the init() method - */ - Hash_cmp_func hash_cmp_func; - - /* - Length of a key value. - It is assumed that all key values have the same length. - */ - uint key_length; - /* Buffer to store key values for probing */ - uchar *key_buff; - - /* Number of key entries in the hash table (number of distinct keys) */ - uint key_entries; - - /* The position of the last key entry in the hash table */ - uchar *last_key_entry; - - /* - The offset of the record fields from the beginning of the record - representation. The record representation starts with a reference to - the next record in the key record chain followed by the length of - the trailing record data followed by a reference to the record segment - in the previous cache, if any, followed by the record fields. - */ - uint rec_fields_offset; - - uint get_size_of_key_offset() { return size_of_key_ofs; } - - /* - Get the position of the next_key_ptr field pointed to by - a linking reference stored at the position key_ref_ptr. - This reference is actually the offset backward from the - beginning of hash table. - */ - uchar *get_next_key_ref(uchar *key_ref_ptr) - { - return hash_table-get_offset(size_of_key_ofs, key_ref_ptr); - } - - /* - Store the linking reference to the next_key_ptr field at - the position key_ref_ptr. The position of the next_key_ptr - field is pointed to by ref. The stored reference is actually - the offset backward from the beginning of the hash table. - */ - void store_next_key_ref(uchar *key_ref_ptr, uchar *ref) - { - store_offset(size_of_key_ofs, key_ref_ptr, (ulong) (hash_table-ref)); - } - - /* - Check whether the reference to the next_key_ptr field at the position - key_ref_ptr contains a nil value. - */ - bool is_null_key_ref(uchar *key_ref_ptr) - { - ulong nil= 0; - return memcmp(key_ref_ptr, &nil, size_of_key_ofs ) == 0; - } - - /* - Set the reference to the next_key_ptr field at the position - key_ref_ptr equal to nil. - */ - void store_null_key_ref(uchar *key_ref_ptr) - { - ulong nil= 0; - store_offset(size_of_key_ofs, key_ref_ptr, nil); - } - - uchar *get_next_rec_ref(uchar *ref_ptr) - { - return buff+get_offset(get_size_of_rec_offset(), ref_ptr); - } - - void store_next_rec_ref(uchar *ref_ptr, uchar *ref) - { - store_offset(get_size_of_rec_offset(), ref_ptr, (ulong) (ref-buff)); - } - - /* - Get the position of the embedded key value for the current - record pointed to by get_curr_rec(). - */ - uchar *get_curr_emb_key() - { - return get_curr_rec()+data_fields_offset; - } - - /* - Get the position of the embedded key value pointed to by a reference - stored at ref_ptr. The stored reference is actually the offset from - the beginning of the join buffer. - */ - uchar *get_emb_key(uchar *ref_ptr) - { - return buff+get_offset(get_size_of_rec_offset(), ref_ptr); - } - - /* - Store the reference to an embedded key at the position key_ref_ptr. - The position of the embedded key is pointed to by ref. The stored - reference is actually the offset from the beginning of the join buffer. - */ - void store_emb_key_ref(uchar *ref_ptr, uchar *ref) - { - store_offset(get_size_of_rec_offset(), ref_ptr, (ulong) (ref-buff)); - } - - /* Get the total length of all prefixes of a record in hashed join buffer */ - uint get_prefix_length() - { - return base_prefix_length + get_size_of_rec_offset(); - } - - /* - Get maximum size of the additional space per record used for - the hash table with record keys - */ - uint get_max_key_addon_space_per_record(); - - /* - Calculate how much space in the buffer would not be occupied by - records, key entries and additional memory for the MMR buffer. - */ - size_t rem_space() - { - return MY_MAX(last_key_entry-end_pos-aux_buff_size,0); - } - - /* - Calculate how much space is taken by allocation of the key - entry for a record in the join buffer - */ - uint extra_key_length() { return key_entry_length; } - - /* - Skip record from a hashed join buffer if its match flag - is set to MATCH_FOUND - */ - bool skip_if_matched(); - - /* - Skip record from a hashed join buffer if its match flag setting - commands to do so - */ - bool skip_if_not_needed_match(); - - /* Search for a key in the hash table of the join buffer */ - bool key_search(uchar *key, uint key_len, uchar **key_ref_ptr); - - /* Reallocate the join buffer of a hashed join cache */ - int realloc_buffer(); - - /* - This constructor creates an unlinked hashed join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. - */ - JOIN_CACHE_HASHED(JOIN *j, JOIN_TAB *tab) :JOIN_CACHE(j, tab) {} - - /* - This constructor creates a linked hashed join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. The parameter 'prev' specifies the previous - cache object to which this cache is linked. - */ - JOIN_CACHE_HASHED(JOIN *j, JOIN_TAB *tab, JOIN_CACHE *prev) - :JOIN_CACHE(j, tab, prev) {} - -public: - - /* Initialize a hashed join cache */ - int init(bool for_explain); - - /* Reset the buffer of a hashed join cache for reading/writing */ - void reset(bool for_writing); - - /* Add a record into the buffer of a hashed join cache */ - bool put_record(); - - /* Read the next record from the buffer of a hashed join cache */ - bool get_record(); - - /* - Shall check whether all records in a key chain have - their match flags set on - */ - virtual bool check_all_match_flags_for_key(uchar *key_chain_ptr); - - uint get_next_key(uchar **key); - - /* Get the head of the record chain attached to the current key entry */ - uchar *get_curr_key_chain() - { - return get_next_rec_ref(curr_key_entry+key_entry_length- - get_size_of_rec_offset()); - } - -}; - - -/* - The class JOIN_TAB_SCAN is a companion class for the classes JOIN_CACHE_BNL - and JOIN_CACHE_BNLH. Actually the class implements the iterator over the - table joinded by BNL/BNLH join algorithm. - The virtual functions open, next and close are called for any iteration over - the table. The function open is called to initiate the process of the - iteration. The function next shall read the next record from the joined - table. The record is read into the record buffer of the joined table. - The record is to be matched with records from the join cache buffer. - The function close shall perform the finalizing actions for the iteration. -*/ - -class JOIN_TAB_SCAN: public Sql_alloc -{ - -private: - /* TRUE if this is the first record from the joined table to iterate over */ - bool is_first_record; - -protected: - - /* The joined table to be iterated over */ - JOIN_TAB *join_tab; - /* The join cache used to join the table join_tab */ - JOIN_CACHE *cache; - /* - Representation of the executed multi-way join through which - all needed context can be accessed. - */ - JOIN *join; - -public: - - JOIN_TAB_SCAN(JOIN *j, JOIN_TAB *tab) - { - join= j; - join_tab= tab; - cache= join_tab->cache; - } - - virtual ~JOIN_TAB_SCAN() {} - - /* - Shall calculate the increment of the auxiliary buffer for a record - write if such a buffer is used by the table scan object - */ - virtual uint aux_buffer_incr(size_t recno) { return 0; } - - /* Initiate the process of iteration over the joined table */ - virtual int open(); - /* - Shall read the next candidate for matches with records from - the join buffer. - */ - virtual int next(); - /* - Perform the finalizing actions for the process of iteration - over the joined_table. - */ - virtual void close(); - -}; - -/* - The class JOIN_CACHE_BNL is used when the BNL join algorithm is - employed to perform a join operation -*/ - -class JOIN_CACHE_BNL :public JOIN_CACHE -{ -private: - /* - The number of the records in the join buffer that have to be - checked yet for a match with the current record of join_tab - read into the record buffer. - */ - uint rem_records; - -protected: - - bool prepare_look_for_matches(bool skip_last); - - uchar *get_next_candidate_for_match(); - - bool skip_next_candidate_for_match(uchar *rec_ptr); - - void read_next_candidate_for_match(uchar *rec_ptr); - -public: - - /* - This constructor creates an unlinked BNL join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. - */ - JOIN_CACHE_BNL(JOIN *j, JOIN_TAB *tab) :JOIN_CACHE(j, tab) {} - - /* - This constructor creates a linked BNL join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. The parameter 'prev' specifies the previous - cache object to which this cache is linked. - */ - JOIN_CACHE_BNL(JOIN *j, JOIN_TAB *tab, JOIN_CACHE *prev) - :JOIN_CACHE(j, tab, prev) {} - - /* Initialize the BNL cache */ - int init(bool for_explain); - - enum Join_algorithm get_join_alg() { return BNL_JOIN_ALG; } - - bool is_key_access() { return FALSE; } - -}; - - -/* - The class JOIN_CACHE_BNLH is used when the BNLH join algorithm is - employed to perform a join operation -*/ - -class JOIN_CACHE_BNLH :public JOIN_CACHE_HASHED -{ - -protected: - - /* - The pointer to the last record from the circular list of the records - that match the join key built out of the record in the join buffer for - the join_tab table - */ - uchar *last_matching_rec_ref_ptr; - /* - The pointer to the next current record from the circular list of the - records that match the join key built out of the record in the join buffer - for the join_tab table. This pointer is used by the class method - get_next_candidate_for_match to iterate over records from the circular - list. - */ - uchar *next_matching_rec_ref_ptr; - - /* - Get the chain of records from buffer matching the current candidate - record for join - */ - uchar *get_matching_chain_by_join_key(); - - bool prepare_look_for_matches(bool skip_last); - - uchar *get_next_candidate_for_match(); - - bool skip_next_candidate_for_match(uchar *rec_ptr); - - void read_next_candidate_for_match(uchar *rec_ptr); - -public: - - /* - This constructor creates an unlinked BNLH join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. - */ - JOIN_CACHE_BNLH(JOIN *j, JOIN_TAB *tab) : JOIN_CACHE_HASHED(j, tab) {} - - /* - This constructor creates a linked BNLH join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. The parameter 'prev' specifies the previous - cache object to which this cache is linked. - */ - JOIN_CACHE_BNLH(JOIN *j, JOIN_TAB *tab, JOIN_CACHE *prev) - : JOIN_CACHE_HASHED(j, tab, prev) {} - - /* Initialize the BNLH cache */ - int init(bool for_explain); - - enum Join_algorithm get_join_alg() { return BNLH_JOIN_ALG; } - - bool is_key_access() { return TRUE; } - -}; - - -/* - The class JOIN_TAB_SCAN_MRR is a companion class for the classes - JOIN_CACHE_BKA and JOIN_CACHE_BKAH. Actually the class implements the - iterator over the records from join_tab selected by BKA/BKAH join - algorithm as the candidates to be joined. - The virtual functions open, next and close are called for any iteration over - join_tab record candidates. The function open is called to initiate the - process of the iteration. The function next shall read the next record from - the set of the record candidates. The record is read into the record buffer - of the joined table. The function close shall perform the finalizing actions - for the iteration. -*/ - -class JOIN_TAB_SCAN_MRR: public JOIN_TAB_SCAN -{ - /* Interface object to generate key ranges for MRR */ - RANGE_SEQ_IF range_seq_funcs; - - /* Number of ranges to be processed by the MRR interface */ - uint ranges; - - /* Flag to to be passed to the MRR interface */ - uint mrr_mode; - - /* MRR buffer assotiated with this join cache */ - HANDLER_BUFFER mrr_buff; - - /* Shall initialize the MRR buffer */ - virtual void init_mrr_buff() - { - cache->setup_aux_buffer(mrr_buff); - } - -public: - - JOIN_TAB_SCAN_MRR(JOIN *j, JOIN_TAB *tab, uint flags, RANGE_SEQ_IF rs_funcs) - :JOIN_TAB_SCAN(j, tab), range_seq_funcs(rs_funcs), mrr_mode(flags) {} - - uint aux_buffer_incr(size_t recno); - - int open(); - - int next(); - - friend class JOIN_CACHE_BKA; /* it needs to add an mrr_mode flag after JOIN_CACHE::init() call */ -}; - -/* - The class JOIN_CACHE_BKA is used when the BKA join algorithm is - employed to perform a join operation -*/ - -class JOIN_CACHE_BKA :public JOIN_CACHE -{ -private: - - /* Flag to to be passed to the companion JOIN_TAB_SCAN_MRR object */ - uint mrr_mode; - - /* - This value is set to 1 by the class prepare_look_for_matches method - and back to 0 by the class get_next_candidate_for_match method - */ - uint rem_records; - - /* - This field contains the current association label set by a call of - the multi_range_read_next handler function. - See the function JOIN_CACHE_BKA::get_curr_key_association() - */ - uchar *curr_association; - -protected: - - /* - Get the number of ranges in the cache buffer passed to the MRR - interface. For each record its own range is passed. - */ - uint get_number_of_ranges_for_mrr() { return (uint)records; } - - /* - Setup the MRR buffer as the space between the last record put - into the join buffer and the very end of the join buffer - */ - int setup_aux_buffer(HANDLER_BUFFER &aux_buff) - { - aux_buff.buffer= end_pos; - aux_buff.buffer_end= buff+buff_size; - return 0; - } - - bool prepare_look_for_matches(bool skip_last); - - uchar *get_next_candidate_for_match(); - - bool skip_next_candidate_for_match(uchar *rec_ptr); - - void read_next_candidate_for_match(uchar *rec_ptr); - -public: - - /* - This constructor creates an unlinked BKA join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. - The MRR mode initially is set to 'flags'. - */ - JOIN_CACHE_BKA(JOIN *j, JOIN_TAB *tab, uint flags) - :JOIN_CACHE(j, tab), mrr_mode(flags) {} - /* - This constructor creates a linked BKA join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. The parameter 'prev' specifies the previous - cache object to which this cache is linked. - The MRR mode initially is set to 'flags'. - */ - JOIN_CACHE_BKA(JOIN *j, JOIN_TAB *tab, uint flags, JOIN_CACHE *prev) - :JOIN_CACHE(j, tab, prev), mrr_mode(flags) {} - - JOIN_CACHE_BKA(JOIN_CACHE_BKA *bka) - :JOIN_CACHE(bka->join, bka->join_tab, bka->prev_cache), - mrr_mode(bka->mrr_mode) {} - - uchar **get_curr_association_ptr() { return &curr_association; } - - /* Initialize the BKA cache */ - int init(bool for_explain); - - enum Join_algorithm get_join_alg() { return BKA_JOIN_ALG; } - - bool is_key_access() { return TRUE; } - - /* Get the key built over the next record from the join buffer */ - uint get_next_key(uchar **key); - - /* Check index condition of the joined table for a record from BKA cache */ - bool skip_index_tuple(range_id_t range_info); - - bool save_explain_data(EXPLAIN_BKA_TYPE *explain); -}; - - - -/* - The class JOIN_CACHE_BKAH is used when the BKAH join algorithm is - employed to perform a join operation -*/ - -class JOIN_CACHE_BKAH :public JOIN_CACHE_BNLH -{ - -private: - /* Flag to to be passed to the companion JOIN_TAB_SCAN_MRR object */ - uint mrr_mode; - - /* - This flag is set to TRUE if the implementation of the MRR interface cannot - handle range association labels and does not return them to the caller of - the multi_range_read_next handler function. E.g. the implementation of - the MRR inteface for the Falcon engine could not return association - labels to the caller of multi_range_read_next. - The flag is set by JOIN_CACHE_BKA::init() and is not ever changed. - */ - bool no_association; - - /* - This field contains the association label returned by the - multi_range_read_next function. - See the function JOIN_CACHE_BKAH::get_curr_key_association() - */ - uchar *curr_matching_chain; - -protected: - - uint get_number_of_ranges_for_mrr() { return key_entries; } - - /* - Initialize the MRR buffer allocating some space within the join buffer. - The entire space between the last record put into the join buffer and the - last key entry added to the hash table is used for the MRR buffer. - */ - int setup_aux_buffer(HANDLER_BUFFER &aux_buff) - { - aux_buff.buffer= end_pos; - aux_buff.buffer_end= last_key_entry; - return 0; - } - - bool prepare_look_for_matches(bool skip_last); - - /* - The implementations of the methods - - get_next_candidate_for_match - - skip_recurrent_candidate_for_match - - read_next_candidate_for_match - are inherited from the JOIN_CACHE_BNLH class - */ - -public: - - /* - This constructor creates an unlinked BKAH join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. - The MRR mode initially is set to 'flags'. - */ - JOIN_CACHE_BKAH(JOIN *j, JOIN_TAB *tab, uint flags) - :JOIN_CACHE_BNLH(j, tab), mrr_mode(flags) {} - - /* - This constructor creates a linked BKAH join cache. The cache is to be - used to join table 'tab' to the result of joining the previous tables - specified by the 'j' parameter. The parameter 'prev' specifies the previous - cache object to which this cache is linked. - The MRR mode initially is set to 'flags'. - */ - JOIN_CACHE_BKAH(JOIN *j, JOIN_TAB *tab, uint flags, JOIN_CACHE *prev) - :JOIN_CACHE_BNLH(j, tab, prev), mrr_mode(flags) {} - - JOIN_CACHE_BKAH(JOIN_CACHE_BKAH *bkah) - :JOIN_CACHE_BNLH(bkah->join, bkah->join_tab, bkah->prev_cache), - mrr_mode(bkah->mrr_mode) {} - - uchar **get_curr_association_ptr() { return &curr_matching_chain; } - - /* Initialize the BKAH cache */ - int init(bool for_explain); - - enum Join_algorithm get_join_alg() { return BKAH_JOIN_ALG; } - - /* Check index condition of the joined table for a record from BKAH cache */ - bool skip_index_tuple(range_id_t range_info); - - bool save_explain_data(EXPLAIN_BKA_TYPE *explain); -}; diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_lex.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_lex.h deleted file mode 100644 index 3e59ad3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_lex.h +++ /dev/null @@ -1,5037 +0,0 @@ -/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2010, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @defgroup Semantic_Analysis Semantic Analysis -*/ - -#ifndef SQL_LEX_INCLUDED -#define SQL_LEX_INCLUDED - -#include "violite.h" /* SSL_type */ -#include "sql_trigger.h" -#include "thr_lock.h" /* thr_lock_type, TL_UNLOCK */ -#include "mem_root_array.h" -#include "grant.h" -#include "sql_cmd.h" -#include "sql_alter.h" // Alter_info -#include "sql_window.h" -#include "sql_trigger.h" -#include "sp.h" // enum enum_sp_type -#include "sql_tvc.h" -#include "item.h" -#include "sql_limit.h" // Select_limit_counters -#include "sql_schema.h" - -/* Used for flags of nesting constructs */ -#define SELECT_NESTING_MAP_SIZE 64 -typedef Bitmap nesting_map; - -/* YACC and LEX Definitions */ - - -/** - A string with metadata. Usually points to a string in the client - character set, but unlike Lex_ident_cli_st (see below) it does not - necessarily point to a query fragment. It can also point to memory - of other kinds (e.g. an additional THD allocated memory buffer - not overlapping with the current query text). - - We'll add more flags here eventually, to know if the string has, e.g.: - - multi-byte characters - - bad byte sequences - - backslash escapes: 'a\nb' - and reuse the original query fragments instead of making the string - copy too early, in Lex_input_stream::get_text(). - This will allow to avoid unnecessary copying, as well as - create more optimal Item types in sql_yacc.yy -*/ -struct Lex_string_with_metadata_st: public LEX_CSTRING -{ -private: - bool m_is_8bit; // True if the string has 8bit characters - char m_quote; // Quote character, or 0 if not quoted -public: - void set_8bit(bool is_8bit) { m_is_8bit= is_8bit; } - void set_metadata(bool is_8bit, char quote) - { - m_is_8bit= is_8bit; - m_quote= quote; - } - void set(const char *s, size_t len, bool is_8bit, char quote) - { - str= s; - length= len; - set_metadata(is_8bit, quote); - } - void set(const LEX_CSTRING *s, bool is_8bit, char quote) - { - ((LEX_CSTRING &)*this)= *s; - set_metadata(is_8bit, quote); - } - bool is_8bit() const { return m_is_8bit; } - bool is_quoted() const { return m_quote != '\0'; } - char quote() const { return m_quote; } - // Get string repertoire by the 8-bit flag and the character set - my_repertoire_t repertoire(CHARSET_INFO *cs) const - { - return !m_is_8bit && my_charset_is_ascii_based(cs) ? - MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30; - } - // Get string repertoire by the 8-bit flag, for ASCII-based character sets - my_repertoire_t repertoire() const - { - return !m_is_8bit ? MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30; - } -}; - - -/* - Used to store identifiers in the client character set. - Points to a query fragment. -*/ -struct Lex_ident_cli_st: public Lex_string_with_metadata_st -{ -public: - void set_keyword(const char *s, size_t len) - { - set(s, len, false, '\0'); - } - void set_ident(const char *s, size_t len, bool is_8bit) - { - set(s, len, is_8bit, '\0'); - } - void set_ident_quoted(const char *s, size_t len, bool is_8bit, char quote) - { - set(s, len, is_8bit, quote); - } - void set_unquoted(const LEX_CSTRING *s, bool is_8bit) - { - set(s, is_8bit, '\0'); - } - const char *pos() const { return str - is_quoted(); } - const char *end() const { return str + length + is_quoted(); } -}; - - -class Lex_ident_cli: public Lex_ident_cli_st -{ -public: - Lex_ident_cli(const LEX_CSTRING *s, bool is_8bit) - { - set_unquoted(s, is_8bit); - } - Lex_ident_cli(const char *s, size_t len) - { - set_ident(s, len, false); - } -}; - - -struct Lex_ident_sys_st: public LEX_CSTRING -{ -public: - bool copy_ident_cli(THD *thd, const Lex_ident_cli_st *str); - bool copy_keyword(THD *thd, const Lex_ident_cli_st *str); - bool copy_sys(THD *thd, const LEX_CSTRING *str); - bool convert(THD *thd, const LEX_CSTRING *str, CHARSET_INFO *cs); - bool copy_or_convert(THD *thd, const Lex_ident_cli_st *str, CHARSET_INFO *cs); - bool is_null() const { return str == NULL; } - bool to_size_number(ulonglong *to) const; - void set_valid_utf8(const LEX_CSTRING *name) - { - DBUG_ASSERT(Well_formed_prefix(system_charset_info, name->str, - name->length).length() == name->length); - str= name->str ; length= name->length; - } -}; - - -class Lex_ident_sys: public Lex_ident_sys_st -{ -public: - Lex_ident_sys(THD *thd, const Lex_ident_cli_st *str) - { - if (copy_ident_cli(thd, str)) - ((LEX_CSTRING &) *this)= null_clex_str; - } - Lex_ident_sys() - { - ((LEX_CSTRING &) *this)= null_clex_str; - } - Lex_ident_sys(const char *name, size_t length) - { - LEX_CSTRING tmp= {name, length}; - set_valid_utf8(&tmp); - } - Lex_ident_sys & operator=(const Lex_ident_sys_st &name) - { - Lex_ident_sys_st::operator=(name); - return *this; - } -}; - - -struct Lex_column_list_privilege_st -{ - List *m_columns; - privilege_t m_privilege; -}; - - -class Lex_column_list_privilege: public Lex_column_list_privilege_st -{ -public: - Lex_column_list_privilege(List *columns, privilege_t privilege) - { - m_columns= columns; - m_privilege= privilege; - } -}; - - -/** - ORDER BY ... LIMIT parameters; -*/ -class Lex_order_limit_lock: public Sql_alloc -{ -public: - SQL_I_List *order_list; /* ORDER clause */ - Lex_select_lock lock; - Lex_select_limit limit; - - Lex_order_limit_lock() :order_list(NULL) - {} - - bool set_to(st_select_lex *sel); -}; - - -enum sub_select_type -{ - UNSPECIFIED_TYPE, - /* following 3 enums should be as they are*/ - UNION_TYPE, INTERSECT_TYPE, EXCEPT_TYPE, - GLOBAL_OPTIONS_TYPE, DERIVED_TABLE_TYPE, OLAP_TYPE -}; - -enum set_op_type -{ - UNSPECIFIED, - UNION_DISTINCT, UNION_ALL, - EXCEPT_DISTINCT, EXCEPT_ALL, - INTERSECT_DISTINCT, INTERSECT_ALL -}; - -inline int cmp_unit_op(enum sub_select_type op1, enum sub_select_type op2) -{ - DBUG_ASSERT(op1 >= UNION_TYPE && op1 <= EXCEPT_TYPE); - DBUG_ASSERT(op2 >= UNION_TYPE && op2 <= EXCEPT_TYPE); - return (op1 == INTERSECT_TYPE ? 1 : 0) - (op2 == INTERSECT_TYPE ? 1 : 0); -} - -enum unit_common_op {OP_MIX, OP_UNION, OP_INTERSECT, OP_EXCEPT}; - -enum enum_view_suid -{ - VIEW_SUID_INVOKER= 0, - VIEW_SUID_DEFINER= 1, - VIEW_SUID_DEFAULT= 2 -}; - - -enum plsql_cursor_attr_t -{ - PLSQL_CURSOR_ATTR_ISOPEN, - PLSQL_CURSOR_ATTR_FOUND, - PLSQL_CURSOR_ATTR_NOTFOUND, - PLSQL_CURSOR_ATTR_ROWCOUNT -}; - - -enum enum_sp_suid_behaviour -{ - SP_IS_DEFAULT_SUID= 0, - SP_IS_NOT_SUID, - SP_IS_SUID -}; - - -enum enum_sp_aggregate_type -{ - DEFAULT_AGGREGATE= 0, - NOT_AGGREGATE, - GROUP_AGGREGATE -}; - - -/* These may not be declared yet */ -class Table_ident; -class sql_exchange; -class LEX_COLUMN; -class sp_head; -class sp_name; -class sp_instr; -class sp_pcontext; -class sp_variable; -class sp_expr_lex; -class sp_assignment_lex; -class st_alter_tablespace; -class partition_info; -class Event_parse_data; -class set_var_base; -class sys_var; -class Item_func_match; -class File_parser; -class Key_part_spec; -class Item_window_func; -struct sql_digest_state; -class With_clause; -class my_var; -class select_handler; -class Pushdown_select; - -#define ALLOC_ROOT_SET 1024 - -#ifdef MYSQL_SERVER -/* - There are 8 different type of table access so there is no more than - combinations 2^8 = 256: - - . STMT_READS_TRANS_TABLE - - . STMT_READS_NON_TRANS_TABLE - - . STMT_READS_TEMP_TRANS_TABLE - - . STMT_READS_TEMP_NON_TRANS_TABLE - - . STMT_WRITES_TRANS_TABLE - - . STMT_WRITES_NON_TRANS_TABLE - - . STMT_WRITES_TEMP_TRANS_TABLE - - . STMT_WRITES_TEMP_NON_TRANS_TABLE - - The unsafe conditions for each combination is represented within a byte - and stores the status of the option --binlog-direct-non-trans-updates, - whether the trx-cache is empty or not, and whether the isolation level - is lower than ISO_REPEATABLE_READ: - - . option (OFF/ON) - . trx-cache (empty/not empty) - . isolation (>= ISO_REPEATABLE_READ / < ISO_REPEATABLE_READ) - - bits 0 : . OFF, . empty, . >= ISO_REPEATABLE_READ - bits 1 : . OFF, . empty, . < ISO_REPEATABLE_READ - bits 2 : . OFF, . not empty, . >= ISO_REPEATABLE_READ - bits 3 : . OFF, . not empty, . < ISO_REPEATABLE_READ - bits 4 : . ON, . empty, . >= ISO_REPEATABLE_READ - bits 5 : . ON, . empty, . < ISO_REPEATABLE_READ - bits 6 : . ON, . not empty, . >= ISO_REPEATABLE_READ - bits 7 : . ON, . not empty, . < ISO_REPEATABLE_READ -*/ -extern uint binlog_unsafe_map[256]; -/* - Initializes the array with unsafe combinations and its respective - conditions. -*/ -void binlog_unsafe_map_init(); -#endif - -#ifdef MYSQL_SERVER -/* - The following hack is needed because mysql_yacc.cc does not define - YYSTYPE before including this file -*/ -#ifdef MYSQL_YACC -#define LEX_YYSTYPE void * -#else -#include "lex_symbol.h" -#ifdef MYSQL_LEX -#include "item_func.h" /* Cast_target used in sql_yacc.hh */ -#include "sql_get_diagnostics.h" /* Types used in sql_yacc.hh */ -#include "sp_pcontext.h" -#include "sql_yacc.hh" -#define LEX_YYSTYPE YYSTYPE * -#else -#define LEX_YYSTYPE void * -#endif -#endif -#endif - -// describe/explain types -#define DESCRIBE_NORMAL 1 -#define DESCRIBE_EXTENDED 2 -/* - This is not within #ifdef because we want "EXPLAIN PARTITIONS ..." to produce - additional "partitions" column even if partitioning is not compiled in. -*/ -#define DESCRIBE_PARTITIONS 4 -#define DESCRIBE_EXTENDED2 8 - -#ifdef MYSQL_SERVER - -extern const LEX_STRING empty_lex_str; -extern MYSQL_PLUGIN_IMPORT const LEX_CSTRING empty_clex_str; -extern const LEX_CSTRING star_clex_str; -extern const LEX_CSTRING param_clex_str; - -enum enum_sp_data_access -{ - SP_DEFAULT_ACCESS= 0, - SP_CONTAINS_SQL, - SP_NO_SQL, - SP_READS_SQL_DATA, - SP_MODIFIES_SQL_DATA -}; - -const LEX_CSTRING sp_data_access_name[]= -{ - { STRING_WITH_LEN("") }, - { STRING_WITH_LEN("CONTAINS SQL") }, - { STRING_WITH_LEN("NO SQL") }, - { STRING_WITH_LEN("READS SQL DATA") }, - { STRING_WITH_LEN("MODIFIES SQL DATA") } -}; - -#define DERIVED_SUBQUERY 1 -#define DERIVED_VIEW 2 -#define DERIVED_WITH 4 - -enum enum_view_create_mode -{ - VIEW_CREATE_NEW, // check that there are not such VIEW/table - VIEW_ALTER, // check that VIEW .frm with such name exists - VIEW_CREATE_OR_REPLACE // check only that there are not such table -}; - - -class Create_view_info: public Sql_alloc -{ -public: - LEX_CSTRING select; // The SELECT statement of CREATE VIEW - enum enum_view_create_mode mode; - uint16 algorithm; - uint8 check; - enum enum_view_suid suid; - Create_view_info(enum_view_create_mode mode_arg, - uint16 algorithm_arg, - enum_view_suid suid_arg) - :select(null_clex_str), - mode(mode_arg), - algorithm(algorithm_arg), - check(VIEW_CHECK_NONE), - suid(suid_arg) - { } -}; - - -enum enum_drop_mode -{ - DROP_DEFAULT, // mode is not specified - DROP_CASCADE, // CASCADE option - DROP_RESTRICT // RESTRICT option -}; - -/* Options to add_table_to_list() */ -#define TL_OPTION_UPDATING 1 -#define TL_OPTION_FORCE_INDEX 2 -#define TL_OPTION_IGNORE_LEAVES 4 -#define TL_OPTION_ALIAS 8 -#define TL_OPTION_SEQUENCE 16 - -typedef List List_item; -typedef Mem_root_array Group_list_ptrs; - -/* SERVERS CACHE CHANGES */ -typedef struct st_lex_server_options -{ - long port; - LEX_CSTRING server_name, host, db, username, password, scheme, socket, owner; - void reset(LEX_CSTRING name) - { - server_name= name; - host= db= username= password= scheme= socket= owner= null_clex_str; - port= -1; - } -} LEX_SERVER_OPTIONS; - - -/** - Structure to hold parameters for CHANGE MASTER, START SLAVE, and STOP SLAVE. - - Remark: this should not be confused with Master_info (and perhaps - would better be renamed to st_lex_replication_info). Some fields, - e.g., delay, are saved in Relay_log_info, not in Master_info. -*/ -struct LEX_MASTER_INFO -{ - DYNAMIC_ARRAY repl_ignore_server_ids; - DYNAMIC_ARRAY repl_do_domain_ids; - DYNAMIC_ARRAY repl_ignore_domain_ids; - const char *host, *user, *password, *log_file_name; - const char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher; - const char *ssl_crl, *ssl_crlpath; - const char *relay_log_name; - LEX_CSTRING connection_name; - /* Value in START SLAVE UNTIL master_gtid_pos=xxx */ - LEX_CSTRING gtid_pos_str; - ulonglong pos; - ulong relay_log_pos; - ulong server_id; - uint port, connect_retry; - float heartbeat_period; - int sql_delay; - /* - Enum is used for making it possible to detect if the user - changed variable or if it should be left at old value - */ - enum {LEX_MI_UNCHANGED= 0, LEX_MI_DISABLE, LEX_MI_ENABLE} - ssl, ssl_verify_server_cert, heartbeat_opt, repl_ignore_server_ids_opt, - repl_do_domain_ids_opt, repl_ignore_domain_ids_opt; - enum { - LEX_GTID_UNCHANGED, LEX_GTID_NO, LEX_GTID_CURRENT_POS, LEX_GTID_SLAVE_POS - } use_gtid_opt; - - void init() - { - bzero(this, sizeof(*this)); - my_init_dynamic_array(PSI_INSTRUMENT_ME, &repl_ignore_server_ids, - sizeof(::server_id), 0, 16, MYF(0)); - my_init_dynamic_array(PSI_INSTRUMENT_ME, &repl_do_domain_ids, - sizeof(ulong), 0, 16, MYF(0)); - my_init_dynamic_array(PSI_INSTRUMENT_ME, &repl_ignore_domain_ids, - sizeof(ulong), 0, 16, MYF(0)); - sql_delay= -1; - } - void reset(bool is_change_master) - { - if (unlikely(is_change_master)) - { - delete_dynamic(&repl_ignore_server_ids); - /* Free all the array elements. */ - delete_dynamic(&repl_do_domain_ids); - delete_dynamic(&repl_ignore_domain_ids); - } - - host= user= password= log_file_name= ssl_key= ssl_cert= ssl_ca= - ssl_capath= ssl_cipher= relay_log_name= 0; - pos= relay_log_pos= server_id= port= connect_retry= 0; - heartbeat_period= 0; - ssl= ssl_verify_server_cert= heartbeat_opt= - repl_ignore_server_ids_opt= repl_do_domain_ids_opt= - repl_ignore_domain_ids_opt= LEX_MI_UNCHANGED; - gtid_pos_str= null_clex_str; - use_gtid_opt= LEX_GTID_UNCHANGED; - sql_delay= -1; - } -}; - -typedef struct st_lex_reset_slave -{ - bool all; -} LEX_RESET_SLAVE; - -enum olap_type -{ - UNSPECIFIED_OLAP_TYPE, CUBE_TYPE, ROLLUP_TYPE -}; - -/* - String names used to print a statement with index hints. - Keep in sync with index_hint_type. -*/ -extern const char * index_hint_type_name[]; -typedef uchar index_clause_map; - -/* - Bits in index_clause_map : one for each possible FOR clause in - USE/FORCE/IGNORE INDEX index hint specification -*/ -#define INDEX_HINT_MASK_JOIN (1) -#define INDEX_HINT_MASK_GROUP (1 << 1) -#define INDEX_HINT_MASK_ORDER (1 << 2) - -#define INDEX_HINT_MASK_ALL (INDEX_HINT_MASK_JOIN | INDEX_HINT_MASK_GROUP | \ - INDEX_HINT_MASK_ORDER) - -class select_result_sink; - -/* Single element of an USE/FORCE/IGNORE INDEX list specified as a SQL hint */ -class Index_hint : public Sql_alloc -{ -public: - /* The type of the hint : USE/FORCE/IGNORE */ - enum index_hint_type type; - /* Where the hit applies to. A bitmask of INDEX_HINT_MASK_ values */ - index_clause_map clause; - /* - The index name. Empty (str=NULL) name represents an empty list - USE INDEX () clause - */ - LEX_CSTRING key_name; - - Index_hint (enum index_hint_type type_arg, index_clause_map clause_arg, - const char *str, size_t length) : - type(type_arg), clause(clause_arg) - { - key_name.str= str; - key_name.length= length; - } - - void print(THD *thd, String *str); -}; - -/* - The state of the lex parsing for selects - - master and slaves are pointers to select_lex. - master is pointer to upper level node. - slave is pointer to lower level node - select_lex is a SELECT without union - unit is container of either - - One SELECT - - UNION of selects - select_lex and unit are both inherited form st_select_lex_node - neighbors are two select_lex or units on the same level - - All select describing structures linked with following pointers: - - list of neighbors (next/prev) (prev of first element point to slave - pointer of upper structure) - - For select this is a list of UNION's (or one element list) - - For units this is a list of sub queries for the upper level select - - - pointer to master (master), which is - If this is a unit - - pointer to outer select_lex - If this is a select_lex - - pointer to outer unit structure for select - - - pointer to slave (slave), which is either: - If this is a unit: - - first SELECT that belong to this unit - If this is a select_lex - - first unit that belong to this SELECT (subquries or derived tables) - - - list of all select_lex (link_next/link_prev) - This is to be used for things like derived tables creation, where we - go through this list and create the derived tables. - - If unit contain several selects (UNION now, INTERSECT etc later) - then it have special select_lex called fake_select_lex. It used for - storing global parameters (like ORDER BY, LIMIT) and executing union. - Subqueries used in global ORDER BY clause will be attached to this - fake_select_lex, which will allow them correctly resolve fields of - 'upper' UNION and outer selects. - - For example for following query: - - select * - from table1 - where table1.field IN (select * from table1_1_1 union - select * from table1_1_2) - union - select * - from table2 - where table2.field=(select (select f1 from table2_1_1_1_1 - where table2_1_1_1_1.f2=table2_1_1.f3) - from table2_1_1 - where table2_1_1.f1=table2.f2) - union - select * from table3; - - we will have following structure: - - select1: (select * from table1 ...) - select2: (select * from table2 ...) - select3: (select * from table3) - select1.1.1: (select * from table1_1_1) - ... - - main unit - fake0 - select1 select2 select3 - |^^ |^ - s||| ||master - l||| |+---------------------------------+ - a||| +---------------------------------+| - v|||master slave || - e||+-------------------------+ || - V| neighbor | V| - unit1.1<+==================>unit1.2 unit2.1 - fake1.1 - select1.1.1 select 1.1.2 select1.2.1 select2.1.1 - |^ - || - V| - unit2.1.1.1 - select2.1.1.1.1 - - - relation in main unit will be following: - (bigger picture for: - main unit - fake0 - select1 select2 select3 - in the above picture) - - main unit - |^^^^|fake_select_lex - |||||+--------------------------------------------+ - ||||+--------------------------------------------+| - |||+------------------------------+ || - ||+--------------+ | || - slave||master | | || - V| neighbor | neighbor | master|V - select1<========>select2<========>select3 fake0 - - list of all select_lex will be following (as it will be constructed by - parser): - - select1->select2->select3->select2.1.1->select 2.1.2->select2.1.1.1.1-+ - | - +---------------------------------------------------------------------+ - | - +->select1.1.1->select1.1.2 - -*/ - -/* - Base class for st_select_lex (SELECT_LEX) & - st_select_lex_unit (SELECT_LEX_UNIT) -*/ -struct LEX; -class st_select_lex; -class st_select_lex_unit; - - -class st_select_lex_node { -protected: - st_select_lex_node *next, **prev, /* neighbor list */ - *master, *slave, /* vertical links */ - *link_next, **link_prev; /* list of whole SELECT_LEX */ - - void init_query_common(); -public: - - ulonglong options; - - /* - result of this query can't be cached, bit field, can be : - UNCACHEABLE_DEPENDENT_GENERATED - UNCACHEABLE_DEPENDENT_INJECTED - UNCACHEABLE_RAND - UNCACHEABLE_SIDEEFFECT - UNCACHEABLE_EXPLAIN - UNCACHEABLE_PREPARE - */ - uint8 uncacheable; -private: - enum sub_select_type linkage; -public: - bool is_linkage_set() const - { - return linkage == UNION_TYPE || linkage == INTERSECT_TYPE || linkage == EXCEPT_TYPE; - } - enum sub_select_type get_linkage() { return linkage; } - bool distinct; - bool no_table_names_allowed; /* used for global order by */ - - static void *operator new(size_t size, MEM_ROOT *mem_root) throw () - { return (void*) alloc_root(mem_root, (uint) size); } - static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); } - static void operator delete(void *ptr, MEM_ROOT *mem_root) {} - - // Ensures that at least all members used during cleanup() are initialized. - st_select_lex_node() - : next(NULL), prev(NULL), - master(NULL), slave(NULL), - link_next(NULL), link_prev(NULL), - linkage(UNSPECIFIED_TYPE) - { - } - - inline st_select_lex_node* get_master() { return master; } - inline st_select_lex_node* get_slave() { return slave; } - void include_down(st_select_lex_node *upper); - void add_slave(st_select_lex_node *slave_arg); - void include_neighbour(st_select_lex_node *before); - void link_chain_down(st_select_lex_node *first); - void link_neighbour(st_select_lex_node *neighbour) - { - DBUG_ASSERT(next == NULL); - DBUG_ASSERT(neighbour != NULL); - next= neighbour; - neighbour->prev= &next; - } - void cut_next() { next= NULL; } - void include_standalone(st_select_lex_node *sel, st_select_lex_node **ref); - void include_global(st_select_lex_node **plink); - void exclude(); - void exclude_from_tree(); - void exclude_from_global() - { - if (!link_prev) - return; - if (((*link_prev)= link_next)) - link_next->link_prev= link_prev; - link_next= NULL; - link_prev= NULL; - } - - - void set_slave(st_select_lex_node *slave_arg) { slave= slave_arg; } - void move_node(st_select_lex_node *where_to_move) - { - if (where_to_move == this) - return; - if (next) - next->prev= prev; - *prev= next; - *where_to_move->prev= this; - next= where_to_move; - } - st_select_lex_node *insert_chain_before(st_select_lex_node **ptr_pos_to_insert, - st_select_lex_node *end_chain_node); - void move_as_slave(st_select_lex_node *new_master); - void set_linkage(enum sub_select_type l) - { - DBUG_ENTER("st_select_lex_node::set_linkage"); - DBUG_PRINT("info", ("node: %p linkage: %d->%d", this, linkage, l)); - linkage= l; - DBUG_VOID_RETURN; - } - /* - This method created for reiniting LEX in mysql_admin_table() and can be - used only if you are going remove all SELECT_LEX & units except belonger - to LEX (LEX::unit & LEX::select, for other purposes there are - SELECT_LEX_UNIT::exclude_level & SELECT_LEX_UNIT::exclude_tree. - - It is also used in parsing to detach builtin select. - */ - void cut_subtree() { slave= 0; } - friend class st_select_lex_unit; - friend bool mysql_new_select(LEX *lex, bool move_down, SELECT_LEX *sel); - friend bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, - bool open_view_no_parse); - friend class st_select_lex; -private: - void fast_exclude(); -}; -typedef class st_select_lex_node SELECT_LEX_NODE; - -/* - SELECT_LEX_UNIT - unit of selects (UNION, INTERSECT, ...) group - SELECT_LEXs -*/ -class THD; -class select_result; -class JOIN; -class select_unit; -class Procedure; -class Explain_query; - -void delete_explain_query(LEX *lex); -void create_explain_query(LEX *lex, MEM_ROOT *mem_root); -void create_explain_query_if_not_exists(LEX *lex, MEM_ROOT *mem_root); -bool print_explain_for_slow_log(LEX *lex, THD *thd, String *str); - - -class st_select_lex_unit: public st_select_lex_node { -protected: - TABLE_LIST result_table_list; - select_unit *union_result; - ulonglong found_rows_for_union; - bool saved_error; - - bool prepare_join(THD *thd, SELECT_LEX *sl, select_result *result, - ulonglong additional_options, - bool is_union_select); - bool join_union_type_handlers(THD *thd, - class Type_holder *holders, uint count); - bool join_union_type_attributes(THD *thd, - class Type_holder *holders, uint count); -public: - bool join_union_item_types(THD *thd, List &types, uint count); -public: - // Ensures that at least all members used during cleanup() are initialized. - st_select_lex_unit() - : union_result(NULL), table(NULL), result(NULL), - cleaned(false), bag_set_op_optimized(false), - have_except_all_or_intersect_all(false), fake_select_lex(NULL) - { - } - - TABLE *table; /* temporary table using for appending UNION results */ - select_result *result; - st_select_lex *pre_last_parse; - bool prepared, // prepare phase already performed for UNION (unit) - optimized, // optimize phase already performed for UNION (unit) - optimized_2, - executed, // already executed - cleaned, - bag_set_op_optimized; - - bool optimize_started; - bool have_except_all_or_intersect_all; - - // list of fields which points to temporary table for union - List item_list; - /* - list of types of items inside union (used for union & derived tables) - - Item_type_holders from which this list consist may have pointers to Field, - pointers is valid only after preparing SELECTS of this unit and before - any SELECT of this unit execution - */ - List types; - /** - TRUE if the unit contained TVC at the top level that has been wrapped - into SELECT: - VALUES (v1) ... (vn) => SELECT * FROM (VALUES (v1) ... (vn)) as tvc - */ - bool with_wrapped_tvc; - /** - Pointer to 'last' select, or pointer to select where we stored - global parameters for union. - - If this is a union of multiple selects, the parser puts the global - parameters in fake_select_lex. If the union doesn't use a - temporary table, st_select_lex_unit::prepare() nulls out - fake_select_lex, but saves a copy in saved_fake_select_lex in - order to preserve the global parameters. - - If it is not a union, first_select() is the last select. - - @return select containing the global parameters - */ - inline st_select_lex *global_parameters() - { - if (fake_select_lex != NULL) - return fake_select_lex; - else if (saved_fake_select_lex != NULL) - return saved_fake_select_lex; - return first_select(); - }; - //node on which we should return current_select pointer after parsing subquery - st_select_lex *return_to; - /* LIMIT clause runtime counters */ - Select_limit_counters lim; - /* not NULL if unit used in subselect, point to subselect item */ - Item_subselect *item; - /* - TABLE_LIST representing this union in the embedding select. Used for - derived tables/views handling. - */ - TABLE_LIST *derived; - bool is_view; - /* With clause attached to this unit (if any) */ - With_clause *with_clause; - /* With element where this unit is used as the specification (if any) */ - With_element *with_element; - /* thread handler */ - THD *thd; - /* - SELECT_LEX for hidden SELECT in union which process global - ORDER BY and LIMIT - */ - st_select_lex *fake_select_lex; - /** - SELECT_LEX that stores LIMIT and OFFSET for UNION ALL when noq - fake_select_lex is used. - */ - st_select_lex *saved_fake_select_lex; - - /* pointer to the last node before last subsequence of UNION ALL */ - st_select_lex *union_distinct; - bool describe; /* union exec() called for EXPLAIN */ - Procedure *last_procedure; /* Pointer to procedure, if such exists */ - - bool columns_are_renamed; - - void init_query(); - st_select_lex* outer_select(); - st_select_lex* first_select() - { - return reinterpret_cast(slave); - } - void set_with_clause(With_clause *with_cl); - st_select_lex_unit* next_unit() - { - return reinterpret_cast(next); - } - st_select_lex* return_after_parsing() { return return_to; } - void exclude_level(); - // void exclude_tree(); // it is not used for long time - bool is_excluded() { return prev == NULL; } - - /* UNION methods */ - bool prepare(TABLE_LIST *derived_arg, select_result *sel_result, - ulonglong additional_options); - bool optimize(); - void optimize_bag_operation(bool is_outer_distinct); - bool exec(); - bool exec_recursive(); - bool cleanup(); - inline void unclean() { cleaned= 0; } - void reinit_exec_mechanism(); - - void print(String *str, enum_query_type query_type); - - bool add_fake_select_lex(THD *thd); - void init_prepare_fake_select_lex(THD *thd, bool first_execution); - inline bool is_prepared() { return prepared; } - bool change_result(select_result_interceptor *result, - select_result_interceptor *old_result); - void set_limit(st_select_lex *values); - void set_thd(THD *thd_arg) { thd= thd_arg; } - inline bool is_unit_op (); - bool union_needs_tmp_table(); - - void set_unique_exclude(); - bool check_distinct_in_union(); - - friend struct LEX; - friend int subselect_union_engine::exec(); - - List *get_column_types(bool for_cursor); - - select_unit *get_union_result() { return union_result; } - int save_union_explain(Explain_query *output); - int save_union_explain_part2(Explain_query *output); - unit_common_op common_op(); - - bool explainable() const - { - /* - EXPLAIN/ANALYZE unit, when: - (1) if it's a subquery - it's not part of eliminated WHERE/ON clause. - (2) if it's a CTE - it's not hanging (needed for execution) - (3) if it's a derived - it's not merged - if it's not 1/2/3 - it's some weird internal thing, ignore it - */ - return item ? !item->eliminated : // (1) - with_element ? derived && derived->derived_result : // (2) - derived ? derived->is_materialized_derived() : // (3) - false; - } - - void reset_distinct(); - void fix_distinct(); - - void register_select_chain(SELECT_LEX *first_sel); - - bool set_nest_level(int new_nest_level); - bool check_parameters(SELECT_LEX *main_select); - - bool set_lock_to_the_last_select(Lex_select_lock l); - - friend class st_select_lex; -}; - -typedef class st_select_lex_unit SELECT_LEX_UNIT; -typedef Bounds_checked_array Ref_ptr_array; - - -/** - Structure which consists of the field and the item that - corresponds to this field. -*/ - -class Field_pair :public Sql_alloc -{ -public: - Field *field; - Item *corresponding_item; - Field_pair(Field *fld, Item *item) - :field(fld), corresponding_item(item) {} -}; - -Field_pair *get_corresponding_field_pair(Item *item, - List pair_list); -Field_pair *find_matching_field_pair(Item *item, List pair_list); - - -#define TOUCHED_SEL_COND 1/* WHERE/HAVING/ON should be reinited before use */ -#define TOUCHED_SEL_DERIVED (1<<1)/* derived should be reinited before use */ - -#define UNIT_NEST_FL 1 -/* - SELECT_LEX - store information of parsed SELECT statment -*/ -class st_select_lex: public st_select_lex_node -{ -public: - /* - Currently the field first_nested is used only by parser. - It containa either a reference to the first select - of the nest of selects to which 'this' belongs to, or - in the case of priority jump it contains a reference to - the select to which the priority nest has to be attached to. - If there is no priority jump then the first select of the - nest contains the reference to itself in first_nested. - Example: - select1 union select2 intersect select - Here we have a priority jump at select2. - So select2->first_nested points to select1, - while select3->first_nested points to select2 and - select1->first_nested points to select1. - */ - st_select_lex *first_nested; - uint8 nest_flags; - Name_resolution_context context; - LEX_CSTRING db; - Item *where, *having; /* WHERE & HAVING clauses */ - Item *prep_where; /* saved WHERE clause for prepared statement processing */ - Item *prep_having;/* saved HAVING clause for prepared statement processing */ - Item *cond_pushed_into_where; /* condition pushed into the select's WHERE */ - Item *cond_pushed_into_having; /* condition pushed into the select's HAVING */ - List attach_to_conds; - /* Saved values of the WHERE and HAVING clauses*/ - Item::cond_result cond_value, having_value; - /* - Point to the LEX in which it was created, used in view subquery detection. - - TODO: make also st_select_lex::parent_stmt_lex (see LEX::stmt_lex) - and use st_select_lex::parent_lex & st_select_lex::parent_stmt_lex - instead of global (from THD) references where it is possible. - */ - LEX *parent_lex; - enum olap_type olap; - /* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */ - SQL_I_List table_list; - - /* - GROUP BY clause. - This list may be mutated during optimization (by remove_const()), - so for prepared statements, we keep a copy of the ORDER.next pointers in - group_list_ptrs, and re-establish the original list before each execution. - */ - SQL_I_List group_list; - Group_list_ptrs *group_list_ptrs; - - List item_list; /* list of fields & expressions */ - List pre_fix; /* above list before fix_fields */ - bool is_item_list_lookup; - /* - Usualy it is pointer to ftfunc_list_alloc, but in union used to create fake - select_lex for calling mysql_select under results of union - */ - List *ftfunc_list; - List ftfunc_list_alloc; - /* - The list of items to which MIN/MAX optimizations of opt_sum_query() - have been applied. Used to rollback those optimizations if it's needed. - */ - List min_max_opt_list; - JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */ - List top_join_list; /* join list of the top level */ - List *join_list; /* list for the currently parsed join */ - TABLE_LIST *embedding; /* table embedding to the above list */ - List sj_nests; /* Semi-join nests within this join */ - /* - Beginning of the list of leaves in a FROM clause, where the leaves - inlcude all base tables including view tables. The tables are connected - by TABLE_LIST::next_leaf, so leaf_tables points to the left-most leaf. - - List of all base tables local to a subquery including all view - tables. Unlike 'next_local', this in this list views are *not* - leaves. Created in setup_tables() -> make_leaves_list(). - */ - /* - Subqueries that will need to be converted to semi-join nests, including - those converted to jtbm nests. The list is emptied when conversion is done. - */ - List sj_subselects; - /* - List of IN-predicates in this st_select_lex that - can be transformed into IN-subselect defined with TVC. - */ - List in_funcs; - /* - Number of current derived table made with TVC during the - transformation of IN-predicate into IN-subquery for this - st_select_lex. - */ - uint curr_tvc_name; - - /* - Needed to correctly generate 'PRIMARY' or 'SIMPLE' for select_type column - of EXPLAIN - */ - bool have_merged_subqueries; - - List leaf_tables; - List leaf_tables_exec; - List leaf_tables_prep; - enum leaf_list_state {UNINIT, READY, SAVED}; - enum leaf_list_state prep_leaf_list_state; - uint insert_tables; - st_select_lex *merged_into; /* select which this select is merged into */ - /* (not 0 only for views/derived tables) */ - - const char *type; /* type of select for EXPLAIN */ - - SQL_I_List order_list; /* ORDER clause */ - SQL_I_List gorder_list; - Item *select_limit, *offset_limit; /* LIMIT clause parameters */ - bool is_set_query_expr_tail; - - /// Array of pointers to top elements of all_fields list - Ref_ptr_array ref_pointer_array; - - /* - number of items in select_list and HAVING clause used to get number - bigger then can be number of entries that will be added to all item - list during split_sum_func - */ - uint select_n_having_items; - uint cond_count; /* number of sargable Items in where/having/on */ - uint between_count; /* number of between predicates in where/having/on */ - uint max_equal_elems; /* maximal number of elements in multiple equalities */ - /* - Number of fields used in select list or where clause of current select - and all inner subselects. - */ - uint select_n_where_fields; - /* reserved for exists 2 in */ - uint select_n_reserved; - /* - it counts the number of bit fields in the SELECT list. These are used when DISTINCT is - converted to a GROUP BY involving BIT fields. - */ - uint hidden_bit_fields; - /* - Number of fields used in the definition of all the windows functions. - This includes: - 1) Fields in the arguments - 2) Fields in the PARTITION BY clause - 3) Fields in the ORDER BY clause - */ - uint fields_in_window_functions; - enum_parsing_place parsing_place; /* where we are parsing expression */ - enum_parsing_place save_parsing_place; - enum_parsing_place context_analysis_place; /* where we are in prepare */ - bool with_sum_func; /* sum function indicator */ - - ulong table_join_options; - uint in_sum_expr; - uint select_number; /* number of select (used for EXPLAIN) */ - - /* - nest_levels are local to the query or VIEW, - and that view merge procedure does not re-calculate them. - So we also have to remember unit against which we count levels. - */ - SELECT_LEX_UNIT *nest_level_base; - int nest_level; /* nesting level of select */ - Item_sum *inner_sum_func_list; /* list of sum func in nested selects */ - uint with_wild; /* item list contain '*' */ - bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */ - bool automatic_brackets; /* dummy select for INTERSECT precedence */ - /* TRUE when having fix field called in processing of this SELECT */ - bool having_fix_field; - /* - TRUE when fix field is called for a new condition pushed into the - HAVING clause of this SELECT - */ - bool having_fix_field_for_pushed_cond; - /* List of references to fields referenced from inner selects */ - List inner_refs_list; - /* Number of Item_sum-derived objects in this SELECT */ - uint n_sum_items; - /* Number of Item_sum-derived objects in children and descendant SELECTs */ - uint n_child_sum_items; - - /* explicit LIMIT clause was used */ - bool explicit_limit; - /* - This array is used to note whether we have any candidates for - expression caching in the corresponding clauses - */ - bool expr_cache_may_be_used[PARSING_PLACE_SIZE]; - /* - there are subquery in HAVING clause => we can't close tables before - query processing end even if we use temporary table - */ - bool subquery_in_having; - /* TRUE <=> this SELECT is correlated w.r.t. some ancestor select */ - bool with_all_modifier; /* used for selects in union */ - bool is_correlated; - /* - This variable is required to ensure proper work of subqueries and - stored procedures. Generally, one should use the states of - Query_arena to determine if it's a statement prepare or first - execution of a stored procedure. However, in case when there was an - error during the first execution of a stored procedure, the SP body - is not expelled from the SP cache. Therefore, a deeply nested - subquery might be left unoptimized. So we need this per-subquery - variable to inidicate the optimization/execution state of every - subquery. Prepared statements work OK in that regard, as in - case of an error during prepare the PS is not created. - */ - uint8 changed_elements; // see TOUCHED_SEL_* - /* TODO: add foloowing first_* to bitmap above */ - bool first_natural_join_processing; - bool first_cond_optimization; - /* do not wrap view fields with Item_ref */ - bool no_wrap_view_item; - /* exclude this select from check of unique_table() */ - bool exclude_from_table_unique_test; - /* the select is "service-select" and can not have tables*/ - bool is_service_select; - /* index in the select list of the expression currently being fixed */ - int cur_pos_in_select_list; - - List udf_list; /* udf function calls stack */ - - /* - This is a copy of the original JOIN USING list that comes from - the parser. The parser : - 1. Sets the natural_join of the second TABLE_LIST in the join - and the st_select_lex::prev_join_using. - 2. Makes a parent TABLE_LIST and sets its is_natural_join/ - join_using_fields members. - 3. Uses the wrapper TABLE_LIST as a table in the upper level. - We cannot assign directly to join_using_fields in the parser because - at stage (1.) the parent TABLE_LIST is not constructed yet and - the assignment will override the JOIN USING fields of the lower level - joins on the right. - */ - List *prev_join_using; - - /** - The set of those tables whose fields are referenced in the select list of - this select level. - */ - table_map select_list_tables; - - /* namp of nesting SELECT visibility (for aggregate functions check) */ - nesting_map name_visibility_map; - - table_map with_dep; - /* the structure to store fields that are used in the GROUP BY of this select */ - List grouping_tmp_fields; - - /* it is for correct printing SELECT options */ - thr_lock_type lock_type; - - table_value_constr *tvc; - bool in_tvc; - - /* The object used to organize execution of the query by a foreign engine */ - select_handler *pushdown_select; - - /** System Versioning */ -public: - uint versioned_tables; - int vers_setup_conds(THD *thd, TABLE_LIST *tables); - /* push new Item_field into item_list */ - bool vers_push_field(THD *thd, TABLE_LIST *table, const LEX_CSTRING field_name); - - int period_setup_conds(THD *thd, TABLE_LIST *table); - void init_query(); - void init_select(); - st_select_lex_unit* master_unit() { return (st_select_lex_unit*) master; } - inline void set_master_unit(st_select_lex_unit *master_unit) - { - master= (st_select_lex_node *)master_unit; - } - void set_master(st_select_lex *master_arg) - { - master= master_arg; - } - st_select_lex_unit* first_inner_unit() - { - return (st_select_lex_unit*) slave; - } - st_select_lex* outer_select(); - st_select_lex* next_select() { return (st_select_lex*) next; } - st_select_lex* next_select_in_list() - { - return (st_select_lex*) link_next; - } - st_select_lex_node** next_select_in_list_addr() - { - return &link_next; - } - st_select_lex* return_after_parsing() - { - return master_unit()->return_after_parsing(); - } - inline bool is_subquery_function() { return master_unit()->item != 0; } - - bool mark_as_dependent(THD *thd, st_select_lex *last, Item *dependency); - - void set_braces(bool value) - { - braces= value; - } - bool inc_in_sum_expr(); - uint get_in_sum_expr(); - - bool add_item_to_list(THD *thd, Item *item); - bool add_group_to_list(THD *thd, Item *item, bool asc); - bool add_ftfunc_to_list(THD *thd, Item_func_match *func); - bool add_order_to_list(THD *thd, Item *item, bool asc); - bool add_gorder_to_list(THD *thd, Item *item, bool asc); - TABLE_LIST* add_table_to_list(THD *thd, Table_ident *table, - LEX_CSTRING *alias, - ulong table_options, - thr_lock_type flags= TL_UNLOCK, - enum_mdl_type mdl_type= MDL_SHARED_READ, - List *hints= 0, - List *partition_names= 0, - LEX_STRING *option= 0); - TABLE_LIST* get_table_list(); - bool init_nested_join(THD *thd); - TABLE_LIST *end_nested_join(THD *thd); - TABLE_LIST *nest_last_join(THD *thd); - void add_joined_table(TABLE_LIST *table); - bool add_cross_joined_table(TABLE_LIST *left_op, TABLE_LIST *right_op, - bool straight_fl); - TABLE_LIST *convert_right_join(); - List* get_item_list(); - ulong get_table_join_options(); - void set_lock_for_tables(thr_lock_type lock_type, bool for_update); - /* - This method created for reiniting LEX in mysql_admin_table() and can be - used only if you are going remove all SELECT_LEX & units except belonger - to LEX (LEX::unit & LEX::select, for other purposes there are - SELECT_LEX_UNIT::exclude_level & SELECT_LEX_UNIT::exclude_tree - */ - void cut_subtree() { slave= 0; } - bool test_limit(); - /** - Get offset for LIMIT. - - Evaluate offset item if necessary. - - @return Number of rows to skip. - */ - ha_rows get_offset(); - /** - Get limit. - - Evaluate limit item if necessary. - - @return Limit of rows in result. - */ - ha_rows get_limit(); - - friend struct LEX; - st_select_lex() : group_list_ptrs(NULL), braces(0), automatic_brackets(0), - n_sum_items(0), n_child_sum_items(0) - {} - void make_empty_select() - { - init_query(); - init_select(); - } - bool setup_ref_array(THD *thd, uint order_group_num); - void print(THD *thd, String *str, enum_query_type query_type); - static void print_order(String *str, - ORDER *order, - enum_query_type query_type); - void print_limit(THD *thd, String *str, enum_query_type query_type); - void fix_prepare_information(THD *thd, Item **conds, Item **having_conds); - /* - Destroy the used execution plan (JOIN) of this subtree (this - SELECT_LEX and all nested SELECT_LEXes and SELECT_LEX_UNITs). - */ - bool cleanup(); - /* - Recursively cleanup the join of this select lex and of all nested - select lexes. - */ - void cleanup_all_joins(bool full); - - void set_index_hint_type(enum index_hint_type type, index_clause_map clause); - - /* - Add a index hint to the tagged list of hints. The type and clause of the - hint will be the current ones (set by set_index_hint()) - */ - bool add_index_hint (THD *thd, const char *str, size_t length); - - /* make a list to hold index hints */ - void alloc_index_hints (THD *thd); - /* read and clear the index hints */ - List* pop_index_hints(void) - { - List *hints= index_hints; - index_hints= NULL; - return hints; - } - - void clear_index_hints(void) { index_hints= NULL; } - bool is_part_of_union() { return master_unit()->is_unit_op(); } - bool is_top_level_node() - { - return (select_number == 1) && !is_part_of_union(); - } - bool optimize_unflattened_subqueries(bool const_only); - /* Set the EXPLAIN type for this subquery. */ - void set_explain_type(bool on_the_fly); - bool handle_derived(LEX *lex, uint phases); - void append_table_to_list(TABLE_LIST *TABLE_LIST::*link, TABLE_LIST *table); - bool get_free_table_map(table_map *map, uint *tablenr); - void replace_leaf_table(TABLE_LIST *table, List &tbl_list); - void remap_tables(TABLE_LIST *derived, table_map map, - uint tablenr, st_select_lex *parent_lex); - bool merge_subquery(THD *thd, TABLE_LIST *derived, st_select_lex *subq_lex, - uint tablenr, table_map map); - inline bool is_mergeable() - { - return (next_select() == 0 && group_list.elements == 0 && - having == 0 && with_sum_func == 0 && - table_list.elements >= 1 && !(options & SELECT_DISTINCT) && - select_limit == 0); - } - void mark_as_belong_to_derived(TABLE_LIST *derived); - void increase_derived_records(ha_rows records); - void update_used_tables(); - void update_correlated_cache(); - void mark_const_derived(bool empty); - - bool save_leaf_tables(THD *thd); - bool save_prep_leaf_tables(THD *thd); - - bool is_merged_child_of(st_select_lex *ancestor); - - /* - For MODE_ONLY_FULL_GROUP_BY we need to maintain two flags: - - Non-aggregated fields are used in this select. - - Aggregate functions are used in this select. - In MODE_ONLY_FULL_GROUP_BY only one of these may be true. - */ - bool non_agg_field_used() const { return m_non_agg_field_used; } - bool agg_func_used() const { return m_agg_func_used; } - bool custom_agg_func_used() const { return m_custom_agg_func_used; } - - void set_non_agg_field_used(bool val) { m_non_agg_field_used= val; } - void set_agg_func_used(bool val) { m_agg_func_used= val; } - void set_custom_agg_func_used(bool val) { m_custom_agg_func_used= val; } - inline void set_with_clause(With_clause *with_clause); - With_clause *get_with_clause() - { - return master_unit()->with_clause; - } - With_element *get_with_element() - { - return master_unit()->with_element; - } - With_element *find_table_def_in_with_clauses(TABLE_LIST *table); - bool check_unrestricted_recursive(bool only_standard_compliant); - bool check_subqueries_with_recursive_references(); - void collect_grouping_fields_for_derived(THD *thd, ORDER *grouping_list); - bool collect_grouping_fields(THD *thd); - bool collect_fields_equal_to_grouping(THD *thd); - void check_cond_extraction_for_grouping_fields(THD *thd, Item *cond); - Item *build_cond_for_grouping_fields(THD *thd, Item *cond, - bool no_to_clones); - - List window_specs; - void prepare_add_window_spec(THD *thd); - bool add_window_def(THD *thd, LEX_CSTRING *win_name, LEX_CSTRING *win_ref, - SQL_I_List win_partition_list, - SQL_I_List win_order_list, - Window_frame *win_frame); - bool add_window_spec(THD *thd, LEX_CSTRING *win_ref, - SQL_I_List win_partition_list, - SQL_I_List win_order_list, - Window_frame *win_frame); - List window_funcs; - bool add_window_func(Item_window_func *win_func); - - bool have_window_funcs() const { return (window_funcs.elements !=0); } - ORDER *find_common_window_func_partition_fields(THD *thd); - - bool cond_pushdown_is_allowed() const - { return !olap && !explicit_limit && !tvc; } - - bool build_pushable_cond_for_having_pushdown(THD *thd, Item *cond); - void pushdown_cond_into_where_clause(THD *thd, Item *extracted_cond, - Item **remaining_cond, - Item_transformer transformer, - uchar *arg); - Item *pushdown_from_having_into_where(THD *thd, Item *having); - - select_handler *find_select_handler(THD *thd); - - bool is_set_op() - { - return linkage == UNION_TYPE || - linkage == EXCEPT_TYPE || - linkage == INTERSECT_TYPE; - } - -private: - bool m_non_agg_field_used; - bool m_agg_func_used; - bool m_custom_agg_func_used; - - /* current index hint kind. used in filling up index_hints */ - enum index_hint_type current_index_hint_type; - index_clause_map current_index_hint_clause; - /* a list of USE/FORCE/IGNORE INDEX */ - List *index_hints; - -public: - inline void add_where_field(st_select_lex *sel) - { - DBUG_ASSERT(this != sel); - select_n_where_fields+= sel->select_n_where_fields; - } - inline void set_linkage_and_distinct(enum sub_select_type l, bool d) - { - DBUG_ENTER("SELECT_LEX::set_linkage_and_distinct"); - DBUG_PRINT("info", ("select: %p distinct %d", this, d)); - set_linkage(l); - DBUG_ASSERT(l == UNION_TYPE || - l == INTERSECT_TYPE || - l == EXCEPT_TYPE); - if (d && master_unit() && master_unit()->union_distinct != this) - master_unit()->union_distinct= this; - distinct= d; - with_all_modifier= !distinct; - DBUG_VOID_RETURN; - } - bool set_nest_level(int new_nest_level); - bool check_parameters(SELECT_LEX *main_select); - void mark_select() - { - DBUG_ENTER("st_select_lex::mark_select()"); - DBUG_PRINT("info", ("Select #%d", select_number)); - DBUG_VOID_RETURN; - } - void register_unit(SELECT_LEX_UNIT *unit, - Name_resolution_context *outer_context); - SELECT_LEX_UNIT *attach_selects_chain(SELECT_LEX *sel, - Name_resolution_context *context); - void add_statistics(SELECT_LEX_UNIT *unit); - bool make_unique_derived_name(THD *thd, LEX_CSTRING *alias); - void lex_start(LEX *plex); - bool is_unit_nest() { return (nest_flags & UNIT_NEST_FL); } - void mark_as_unit_nest() { nest_flags= UNIT_NEST_FL; } -}; -typedef class st_select_lex SELECT_LEX; - -inline bool st_select_lex_unit::is_unit_op () -{ - if (!first_select()->next_select()) - { - if (first_select()->tvc) - return 1; - else - return 0; - } - - enum sub_select_type linkage= first_select()->next_select()->linkage; - return linkage == UNION_TYPE || linkage == INTERSECT_TYPE || - linkage == EXCEPT_TYPE; -} - - -struct st_sp_chistics -{ - LEX_CSTRING comment; - enum enum_sp_suid_behaviour suid; - bool detistic; - enum enum_sp_data_access daccess; - enum enum_sp_aggregate_type agg_type; - void init() { bzero(this, sizeof(*this)); } - void set(const st_sp_chistics &other) { *this= other; } - bool read_from_mysql_proc_row(THD *thd, TABLE *table); -}; - - -class Sp_chistics: public st_sp_chistics -{ -public: - Sp_chistics() { init(); } -}; - - -struct st_trg_chistics: public st_trg_execution_order -{ - enum trg_action_time_type action_time; - enum trg_event_type event; - - const char *ordering_clause_begin; - const char *ordering_clause_end; - -}; - -enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE, - XA_SUSPEND, XA_FOR_MIGRATE}; - -class Sroutine_hash_entry; - -/* - Class representing list of all tables used by statement and other - information which is necessary for opening and locking its tables, - like SQL command for this statement. - - Also contains information about stored functions used by statement - since during its execution we may have to add all tables used by its - stored functions/triggers to this list in order to pre-open and lock - them. - - Also used by LEX::reset_n_backup/restore_backup_query_tables_list() - methods to save and restore this information. -*/ - -class Query_tables_list -{ -public: - /** - SQL command for this statement. Part of this class since the - process of opening and locking tables for the statement needs - this information to determine correct type of lock for some of - the tables. - */ - enum_sql_command sql_command; - /* Global list of all tables used by this statement */ - TABLE_LIST *query_tables; - /* Pointer to next_global member of last element in the previous list. */ - TABLE_LIST **query_tables_last; - /* - If non-0 then indicates that query requires prelocking and points to - next_global member of last own element in query table list (i.e. last - table which was not added to it as part of preparation to prelocking). - 0 - indicates that this query does not need prelocking. - */ - TABLE_LIST **query_tables_own_last; - /* - Set of stored routines called by statement. - (Note that we use lazy-initialization for this hash). - */ - enum { START_SROUTINES_HASH_SIZE= 16 }; - HASH sroutines; - /* - List linking elements of 'sroutines' set. Allows you to add new elements - to this set as you iterate through the list of existing elements. - 'sroutines_list_own_last' is pointer to ::next member of last element of - this list which represents routine which is explicitly used by query. - 'sroutines_list_own_elements' number of explicitly used routines. - We use these two members for restoring of 'sroutines_list' to the state - in which it was right after query parsing. - */ - SQL_I_List sroutines_list; - Sroutine_hash_entry **sroutines_list_own_last; - uint sroutines_list_own_elements; - - /** - Number of tables which were open by open_tables() and to be locked - by lock_tables(). - Note that we set this member only in some cases, when this value - needs to be passed from open_tables() to lock_tables() which are - separated by some amount of code. - */ - uint table_count; - - /* - These constructor and destructor serve for creation/destruction - of Query_tables_list instances which are used as backup storage. - */ - Query_tables_list() {} - ~Query_tables_list() {} - - /* Initializes (or resets) Query_tables_list object for "real" use. */ - void reset_query_tables_list(bool init); - void destroy_query_tables_list(); - void set_query_tables_list(Query_tables_list *state) - { - *this= *state; - } - - /* - Direct addition to the list of query tables. - If you are using this function, you must ensure that the table - object, in particular table->db member, is initialized. - */ - void add_to_query_tables(TABLE_LIST *table) - { - *(table->prev_global= query_tables_last)= table; - query_tables_last= &table->next_global; - } - bool requires_prelocking() - { - return MY_TEST(query_tables_own_last); - } - void mark_as_requiring_prelocking(TABLE_LIST **tables_own_last) - { - query_tables_own_last= tables_own_last; - } - /* Return pointer to first not-own table in query-tables or 0 */ - TABLE_LIST* first_not_own_table() - { - return ( query_tables_own_last ? *query_tables_own_last : 0); - } - void chop_off_not_own_tables() - { - if (query_tables_own_last) - { - *query_tables_own_last= 0; - query_tables_last= query_tables_own_last; - query_tables_own_last= 0; - } - } - - /** Return a pointer to the last element in query table list. */ - TABLE_LIST *last_table() - { - /* Don't use offsetof() macro in order to avoid warnings. */ - return query_tables ? - (TABLE_LIST*) ((char*) query_tables_last - - ((char*) &(query_tables->next_global) - - (char*) query_tables)) : - 0; - } - - /** - Enumeration listing of all types of unsafe statement. - - @note The order of elements of this enumeration type must - correspond to the order of the elements of the @c explanations - array defined in the body of @c THD::issue_unsafe_warnings. - */ - enum enum_binlog_stmt_unsafe { - /** - SELECT..LIMIT is unsafe because the set of rows returned cannot - be predicted. - */ - BINLOG_STMT_UNSAFE_LIMIT= 0, - /** - INSERT DELAYED is unsafe because the time when rows are inserted - cannot be predicted. - */ - BINLOG_STMT_UNSAFE_INSERT_DELAYED, - /** - Access to log tables is unsafe because slave and master probably - log different things. - */ - BINLOG_STMT_UNSAFE_SYSTEM_TABLE, - /** - Inserting into an autoincrement column in a stored routine is unsafe. - Even with just one autoincrement column, if the routine is invoked more than - once slave is not guaranteed to execute the statement graph same way as - the master. - And since it's impossible to estimate how many times a routine can be invoked at - the query pre-execution phase (see lock_tables), the statement is marked - pessimistically unsafe. - */ - BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS, - /** - Using a UDF (user-defined function) is unsafe. - */ - BINLOG_STMT_UNSAFE_UDF, - /** - Using most system variables is unsafe, because slave may run - with different options than master. - */ - BINLOG_STMT_UNSAFE_SYSTEM_VARIABLE, - /** - Using some functions is unsafe (e.g., UUID). - */ - BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION, - - /** - Mixing transactional and non-transactional statements are unsafe if - non-transactional reads or writes are occur after transactional - reads or writes inside a transaction. - */ - BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS, - - /** - Mixing self-logging and non-self-logging engines in a statement - is unsafe. - */ - BINLOG_STMT_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE, - - /** - Statements that read from both transactional and non-transactional - tables and write to any of them are unsafe. - */ - BINLOG_STMT_UNSAFE_MIXED_STATEMENT, - - /** - INSERT...IGNORE SELECT is unsafe because which rows are ignored depends - on the order that rows are retrieved by SELECT. This order cannot be - predicted and may differ on master and the slave. - */ - BINLOG_STMT_UNSAFE_INSERT_IGNORE_SELECT, - - /** - INSERT...SELECT...UPDATE is unsafe because which rows are updated depends - on the order that rows are retrieved by SELECT. This order cannot be - predicted and may differ on master and the slave. - */ - BINLOG_STMT_UNSAFE_INSERT_SELECT_UPDATE, - - /** - Query that writes to a table with auto_inc column after selecting from - other tables are unsafe as the order in which the rows are retrieved by - select may differ on master and slave. - */ - BINLOG_STMT_UNSAFE_WRITE_AUTOINC_SELECT, - - /** - INSERT...REPLACE SELECT is unsafe because which rows are replaced depends - on the order that rows are retrieved by SELECT. This order cannot be - predicted and may differ on master and the slave. - */ - BINLOG_STMT_UNSAFE_REPLACE_SELECT, - - /** - CREATE TABLE... IGNORE... SELECT is unsafe because which rows are ignored - depends on the order that rows are retrieved by SELECT. This order cannot - be predicted and may differ on master and the slave. - */ - BINLOG_STMT_UNSAFE_CREATE_IGNORE_SELECT, - - /** - CREATE TABLE...REPLACE... SELECT is unsafe because which rows are replaced - depends on the order that rows are retrieved from SELECT. This order - cannot be predicted and may differ on master and the slave - */ - BINLOG_STMT_UNSAFE_CREATE_REPLACE_SELECT, - - /** - CREATE TABLE...SELECT on a table with auto-increment column is unsafe - because which rows are replaced depends on the order that rows are - retrieved from SELECT. This order cannot be predicted and may differ on - master and the slave - */ - BINLOG_STMT_UNSAFE_CREATE_SELECT_AUTOINC, - - /** - UPDATE...IGNORE is unsafe because which rows are ignored depends on the - order that rows are updated. This order cannot be predicted and may differ - on master and the slave. - */ - BINLOG_STMT_UNSAFE_UPDATE_IGNORE, - - /** - INSERT... ON DUPLICATE KEY UPDATE on a table with more than one - UNIQUE KEYS is unsafe. - */ - BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS, - - /** - INSERT into auto-inc field which is not the first part of composed - primary key. - */ - BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST, - - /* The last element of this enumeration type. */ - BINLOG_STMT_UNSAFE_COUNT - }; - /** - This has all flags from 0 (inclusive) to BINLOG_STMT_FLAG_COUNT - (exclusive) set. - */ - static const uint32 BINLOG_STMT_UNSAFE_ALL_FLAGS= - ((1U << BINLOG_STMT_UNSAFE_COUNT) - 1); - - /** - Maps elements of enum_binlog_stmt_unsafe to error codes. - */ - static const int binlog_stmt_unsafe_errcode[BINLOG_STMT_UNSAFE_COUNT]; - - /** - Determine if this statement is marked as unsafe. - - @retval 0 if the statement is not marked as unsafe. - @retval nonzero if the statement is marked as unsafe. - */ - inline bool is_stmt_unsafe() const { - return get_stmt_unsafe_flags() != 0; - } - - inline bool is_stmt_unsafe(enum_binlog_stmt_unsafe unsafe) - { - return binlog_stmt_flags & (1 << unsafe); - } - - /** - Flag the current (top-level) statement as unsafe. - The flag will be reset after the statement has finished. - - @param unsafe_type The type of unsafety: one of the @c - BINLOG_STMT_FLAG_UNSAFE_* flags in @c enum_binlog_stmt_flag. - */ - inline void set_stmt_unsafe(enum_binlog_stmt_unsafe unsafe_type) { - DBUG_ENTER("set_stmt_unsafe"); - DBUG_ASSERT(unsafe_type >= 0 && unsafe_type < BINLOG_STMT_UNSAFE_COUNT); - binlog_stmt_flags|= (1U << unsafe_type); - DBUG_VOID_RETURN; - } - - /** - Set the bits of binlog_stmt_flags determining the type of - unsafeness of the current statement. No existing bits will be - cleared, but new bits may be set. - - @param flags A binary combination of zero or more bits, (1<= ISO_REPEATABLE_READ */ - - /** - Sets the type of table that is about to be accessed while executing a - statement. - - @param accessed_table Enumeration type that defines the type of table, - e.g. temporary, transactional, non-transactional. - */ - inline void set_stmt_accessed_table(enum_stmt_accessed_table accessed_table) - { - DBUG_ENTER("LEX::set_stmt_accessed_table"); - - DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT); - stmt_accessed_table_flag |= (1U << accessed_table); - - DBUG_VOID_RETURN; - } - - /** - Checks if a type of table is about to be accessed while executing a - statement. - - @param accessed_table Enumeration type that defines the type of table, - e.g. temporary, transactional, non-transactional. - - @return - @retval TRUE if the type of the table is about to be accessed - @retval FALSE otherwise - */ - inline bool stmt_accessed_table(enum_stmt_accessed_table accessed_table) - { - DBUG_ENTER("LEX::stmt_accessed_table"); - - DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT); - - DBUG_RETURN((stmt_accessed_table_flag & (1U << accessed_table)) != 0); - } - - /** - Checks either a trans/non trans temporary table is being accessed while - executing a statement. - - @return - @retval TRUE if a temporary table is being accessed - @retval FALSE otherwise - */ - inline bool stmt_accessed_temp_table() - { - DBUG_ENTER("THD::stmt_accessed_temp_table"); - DBUG_RETURN(stmt_accessed_non_trans_temp_table() || - stmt_accessed_trans_temp_table()); - } - - /** - Checks if a temporary transactional table is being accessed while executing - a statement. - - @return - @retval TRUE if a temporary transactional table is being accessed - @retval FALSE otherwise - */ - inline bool stmt_accessed_trans_temp_table() - { - DBUG_ENTER("THD::stmt_accessed_trans_temp_table"); - - DBUG_RETURN((stmt_accessed_table_flag & - ((1U << STMT_READS_TEMP_TRANS_TABLE) | - (1U << STMT_WRITES_TEMP_TRANS_TABLE))) != 0); - } - inline bool stmt_writes_to_non_temp_table() - { - DBUG_ENTER("THD::stmt_writes_to_non_temp_table"); - - DBUG_RETURN((stmt_accessed_table_flag & - ((1U << STMT_WRITES_TRANS_TABLE) | - (1U << STMT_WRITES_NON_TRANS_TABLE)))); - } - - /** - Checks if a temporary non-transactional table is about to be accessed - while executing a statement. - - @return - @retval TRUE if a temporary non-transactional table is about to be - accessed - @retval FALSE otherwise - */ - inline bool stmt_accessed_non_trans_temp_table() - { - DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table"); - - DBUG_RETURN((stmt_accessed_table_flag & - ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) | - (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0); - } - - /* - Checks if a mixed statement is unsafe. - - - @param in_multi_stmt_transaction_mode defines if there is an on-going - multi-transactional statement. - @param binlog_direct defines if --binlog-direct-non-trans-updates is - active. - @param trx_cache_is_not_empty defines if the trx-cache is empty or not. - @param trx_isolation defines the isolation level. - - @return - @retval TRUE if the mixed statement is unsafe - @retval FALSE otherwise - */ - inline bool is_mixed_stmt_unsafe(bool in_multi_stmt_transaction_mode, - bool binlog_direct, - bool trx_cache_is_not_empty, - uint tx_isolation) - { - bool unsafe= FALSE; - - if (in_multi_stmt_transaction_mode) - { - uint condition= - (binlog_direct ? BINLOG_DIRECT_ON : BINLOG_DIRECT_OFF) & - (trx_cache_is_not_empty ? TRX_CACHE_NOT_EMPTY : TRX_CACHE_EMPTY) & - (tx_isolation >= ISO_REPEATABLE_READ ? IL_GTE_REPEATABLE : IL_LT_REPEATABLE); - - unsafe= (binlog_unsafe_map[stmt_accessed_table_flag] & condition); - -#if !defined(DBUG_OFF) - DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("RESULT %02X %02X %02X", condition, - binlog_unsafe_map[stmt_accessed_table_flag], - (binlog_unsafe_map[stmt_accessed_table_flag] & condition))); - - int type_in= 0; - for (; type_in < STMT_ACCESS_TABLE_COUNT; type_in++) - { - if (stmt_accessed_table((enum_stmt_accessed_table) type_in)) - DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("ACCESSED %s ", - stmt_accessed_table_string((enum_stmt_accessed_table) type_in))); - } -#endif - } - - if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) && - stmt_accessed_table(STMT_READS_TRANS_TABLE) && - tx_isolation < ISO_REPEATABLE_READ) - unsafe= TRUE; - else if (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) && - stmt_accessed_table(STMT_READS_TRANS_TABLE) && - tx_isolation < ISO_REPEATABLE_READ) - unsafe= TRUE; - - return(unsafe); - } - - /** - true if the parsed tree contains references to stored procedures - or functions, false otherwise - */ - bool uses_stored_routines() const - { return sroutines_list.elements != 0; } - -private: - - /** - Enumeration listing special types of statements. - - Currently, the only possible type is ROW_INJECTION. - */ - enum enum_binlog_stmt_type { - /** - The statement is a row injection (i.e., either a BINLOG - statement or a row event executed by the slave SQL thread). - */ - BINLOG_STMT_TYPE_ROW_INJECTION = 0, - - /** The last element of this enumeration type. */ - BINLOG_STMT_TYPE_COUNT - }; - - /** - Bit field indicating the type of statement. - - There are two groups of bits: - - - The low BINLOG_STMT_UNSAFE_COUNT bits indicate the types of - unsafeness that the current statement has. - - - The next BINLOG_STMT_TYPE_COUNT bits indicate if the statement - is of some special type. - - This must be a member of LEX, not of THD: each stored procedure - needs to remember its unsafeness state between calls and each - stored procedure has its own LEX object (but no own THD object). - */ - uint32 binlog_stmt_flags; - - /** - Bit field that determines the type of tables that are about to be - be accessed while executing a statement. - */ - uint32 stmt_accessed_table_flag; -}; - - -/* - st_parsing_options contains the flags for constructions that are - allowed in the current statement. -*/ - -struct st_parsing_options -{ - bool allows_variable; - bool lookup_keywords_after_qualifier; - - st_parsing_options() { reset(); } - void reset(); -}; - - -/** - The state of the lexical parser, when parsing comments. -*/ -enum enum_comment_state -{ - /** - Not parsing comments. - */ - NO_COMMENT, - /** - Parsing comments that need to be preserved. - Typically, these are user comments '/' '*' ... '*' '/'. - */ - PRESERVE_COMMENT, - /** - Parsing comments that need to be discarded. - Typically, these are special comments '/' '*' '!' ... '*' '/', - or '/' '*' '!' 'M' 'M' 'm' 'm' 'm' ... '*' '/', where the comment - markers should not be expanded. - */ - DISCARD_COMMENT -}; - - -/** - @brief This class represents the character input stream consumed during - lexical analysis. - - In addition to consuming the input stream, this class performs some - comment pre processing, by filtering out out of bound special text - from the query input stream. - Two buffers, with pointers inside each buffers, are maintained in - parallel. The 'raw' buffer is the original query text, which may - contain out-of-bound comments. The 'cpp' (for comments pre processor) - is the pre-processed buffer that contains only the query text that - should be seen once out-of-bound data is removed. -*/ - -class Lex_input_stream -{ - size_t unescape(CHARSET_INFO *cs, char *to, - const char *str, const char *end, int sep); - my_charset_conv_wc_mb get_escape_func(THD *thd, my_wc_t sep) const; -public: - Lex_input_stream() - { - } - - ~Lex_input_stream() - { - } - - /** - Object initializer. Must be called before usage. - - @retval FALSE OK - @retval TRUE Error - */ - bool init(THD *thd, char *buff, size_t length); - - void reset(char *buff, size_t length); - - /** - The main method to scan the next token, with token contraction processing - for LALR(2) resolution, e.g. translate "WITH" followed by "ROLLUP" - to a single token WITH_ROLLUP_SYM. - */ - int lex_token(union YYSTYPE *yylval, THD *thd); - - void reduce_digest_token(uint token_left, uint token_right); - -private: - /** - Set the echo mode. - - When echo is true, characters parsed from the raw input stream are - preserved. When false, characters parsed are silently ignored. - @param echo the echo mode. - */ - void set_echo(bool echo) - { - m_echo= echo; - } - - void save_in_comment_state() - { - m_echo_saved= m_echo; - in_comment_saved= in_comment; - } - - void restore_in_comment_state() - { - m_echo= m_echo_saved; - in_comment= in_comment_saved; - } - - /** - Skip binary from the input stream. - @param n number of bytes to accept. - */ - void skip_binary(int n) - { - if (m_echo) - { - memcpy(m_cpp_ptr, m_ptr, n); - m_cpp_ptr += n; - } - m_ptr += n; - } - - /** - Get a character, and advance in the stream. - @return the next character to parse. - */ - unsigned char yyGet() - { - char c= *m_ptr++; - if (m_echo) - *m_cpp_ptr++ = c; - return c; - } - - /** - Get the last character accepted. - @return the last character accepted. - */ - unsigned char yyGetLast() - { - return m_ptr[-1]; - } - - /** - Look at the next character to parse, but do not accept it. - */ - unsigned char yyPeek() - { - return m_ptr[0]; - } - - /** - Look ahead at some character to parse. - @param n offset of the character to look up - */ - unsigned char yyPeekn(int n) - { - return m_ptr[n]; - } - - /** - Cancel the effect of the last yyGet() or yySkip(). - Note that the echo mode should not change between calls to yyGet / yySkip - and yyUnget. The caller is responsible for ensuring that. - */ - void yyUnget() - { - m_ptr--; - if (m_echo) - m_cpp_ptr--; - } - - /** - Accept a character, by advancing the input stream. - */ - void yySkip() - { - if (m_echo) - *m_cpp_ptr++ = *m_ptr++; - else - m_ptr++; - } - - /** - Accept multiple characters at once. - @param n the number of characters to accept. - */ - void yySkipn(int n) - { - if (m_echo) - { - memcpy(m_cpp_ptr, m_ptr, n); - m_cpp_ptr += n; - } - m_ptr += n; - } - - /** - Puts a character back into the stream, canceling - the effect of the last yyGet() or yySkip(). - Note that the echo mode should not change between calls - to unput, get, or skip from the stream. - */ - char *yyUnput(char ch) - { - *--m_ptr= ch; - if (m_echo) - m_cpp_ptr--; - return m_ptr; - } - - /** - End of file indicator for the query text to parse. - @param n number of characters expected - @return true if there are less than n characters to parse - */ - bool eof(int n) - { - return ((m_ptr + n) >= m_end_of_query); - } - - /** Mark the stream position as the start of a new token. */ - void start_token() - { - m_tok_start_prev= m_tok_start; - m_tok_start= m_ptr; - m_tok_end= m_ptr; - - m_cpp_tok_start_prev= m_cpp_tok_start; - m_cpp_tok_start= m_cpp_ptr; - m_cpp_tok_end= m_cpp_ptr; - } - - /** - Adjust the starting position of the current token. - This is used to compensate for starting whitespace. - */ - void restart_token() - { - m_tok_start= m_ptr; - m_cpp_tok_start= m_cpp_ptr; - } - - /** - Get the maximum length of the utf8-body buffer. - The utf8 body can grow because of the character set conversion and escaping. - */ - size_t get_body_utf8_maximum_length(THD *thd); - - /** Get the length of the current token, in the raw buffer. */ - uint yyLength() - { - /* - The assumption is that the lexical analyser is always 1 character ahead, - which the -1 account for. - */ - DBUG_ASSERT(m_ptr > m_tok_start); - return (uint) ((m_ptr - m_tok_start) - 1); - } - - /** - Test if a lookahead token was already scanned by lex_token(), - for LALR(2) resolution. - */ - bool has_lookahead() const - { - return lookahead_token >= 0; - } - -public: - - /** - End of file indicator for the query text to parse. - @return true if there are no more characters to parse - */ - bool eof() - { - return (m_ptr >= m_end_of_query); - } - - /** Get the raw query buffer. */ - const char *get_buf() - { - return m_buf; - } - - /** Get the pre-processed query buffer. */ - const char *get_cpp_buf() - { - return m_cpp_buf; - } - - /** Get the end of the raw query buffer. */ - const char *get_end_of_query() - { - return m_end_of_query; - } - - /** Get the token start position, in the raw buffer. */ - const char *get_tok_start() - { - return has_lookahead() ? m_tok_start_prev : m_tok_start; - } - - void set_cpp_tok_start(const char *pos) - { - m_cpp_tok_start= pos; - } - - /** Get the token end position, in the raw buffer. */ - const char *get_tok_end() - { - return m_tok_end; - } - - /** Get the current stream pointer, in the raw buffer. */ - const char *get_ptr() - { - return m_ptr; - } - - /** Get the token start position, in the pre-processed buffer. */ - const char *get_cpp_tok_start() - { - return has_lookahead() ? m_cpp_tok_start_prev : m_cpp_tok_start; - } - - /** Get the token end position, in the pre-processed buffer. */ - const char *get_cpp_tok_end() - { - return m_cpp_tok_end; - } - - /** - Get the token end position in the pre-processed buffer, - with trailing spaces removed. - */ - const char *get_cpp_tok_end_rtrim() - { - const char *p; - for (p= m_cpp_tok_end; - p > m_cpp_buf && my_isspace(system_charset_info, p[-1]); - p--) - { } - return p; - } - - /** Get the current stream pointer, in the pre-processed buffer. */ - const char *get_cpp_ptr() - { - return m_cpp_ptr; - } - - /** - Get the current stream pointer, in the pre-processed buffer, - with traling spaces removed. - */ - const char *get_cpp_ptr_rtrim() - { - const char *p; - for (p= m_cpp_ptr; - p > m_cpp_buf && my_isspace(system_charset_info, p[-1]); - p--) - { } - return p; - } - /** Get the utf8-body string. */ - const char *get_body_utf8_str() - { - return m_body_utf8; - } - - /** Get the utf8-body length. */ - size_t get_body_utf8_length() - { - return (size_t) (m_body_utf8_ptr - m_body_utf8); - } - - void body_utf8_start(THD *thd, const char *begin_ptr); - void body_utf8_append(const char *ptr); - void body_utf8_append(const char *ptr, const char *end_ptr); - void body_utf8_append_ident(THD *thd, - const Lex_string_with_metadata_st *txt, - const char *end_ptr); - void body_utf8_append_escape(THD *thd, - const LEX_CSTRING *txt, - CHARSET_INFO *txt_cs, - const char *end_ptr, - my_wc_t sep); - -private: - /** - LALR(2) resolution, look ahead token. - Value of the next token to return, if any, - or -1, if no token was parsed in advance. - Note: 0 is a legal token, and represents YYEOF. - */ - int lookahead_token; - - /** LALR(2) resolution, value of the look ahead token.*/ - LEX_YYSTYPE lookahead_yylval; - - bool get_text(Lex_string_with_metadata_st *to, - uint sep, int pre_skip, int post_skip); - - void add_digest_token(uint token, LEX_YYSTYPE yylval); - - bool consume_comment(int remaining_recursions_permitted); - int lex_one_token(union YYSTYPE *yylval, THD *thd); - int find_keyword(Lex_ident_cli_st *str, uint len, bool function); - LEX_CSTRING get_token(uint skip, uint length); - int scan_ident_sysvar(THD *thd, Lex_ident_cli_st *str); - int scan_ident_start(THD *thd, Lex_ident_cli_st *str); - int scan_ident_middle(THD *thd, Lex_ident_cli_st *str, - CHARSET_INFO **cs, my_lex_states *); - int scan_ident_delimited(THD *thd, Lex_ident_cli_st *str, uchar quote_char); - bool get_7bit_or_8bit_ident(THD *thd, uchar *last_char); - - /** Current thread. */ - THD *m_thd; - - /** Pointer to the current position in the raw input stream. */ - char *m_ptr; - - /** Starting position of the last token parsed, in the raw buffer. */ - const char *m_tok_start; - - /** Ending position of the previous token parsed, in the raw buffer. */ - const char *m_tok_end; - - /** End of the query text in the input stream, in the raw buffer. */ - const char *m_end_of_query; - - /** Starting position of the previous token parsed, in the raw buffer. */ - const char *m_tok_start_prev; - - /** Begining of the query text in the input stream, in the raw buffer. */ - const char *m_buf; - - /** Length of the raw buffer. */ - size_t m_buf_length; - - /** Echo the parsed stream to the pre-processed buffer. */ - bool m_echo; - bool m_echo_saved; - - /** Pre-processed buffer. */ - char *m_cpp_buf; - - /** Pointer to the current position in the pre-processed input stream. */ - char *m_cpp_ptr; - - /** - Starting position of the last token parsed, - in the pre-processed buffer. - */ - const char *m_cpp_tok_start; - - /** - Starting position of the previous token parsed, - in the pre-procedded buffer. - */ - const char *m_cpp_tok_start_prev; - - /** - Ending position of the previous token parsed, - in the pre-processed buffer. - */ - const char *m_cpp_tok_end; - - /** UTF8-body buffer created during parsing. */ - char *m_body_utf8; - - /** Pointer to the current position in the UTF8-body buffer. */ - char *m_body_utf8_ptr; - - /** - Position in the pre-processed buffer. The query from m_cpp_buf to - m_cpp_utf_processed_ptr is converted to UTF8-body. - */ - const char *m_cpp_utf8_processed_ptr; - -public: - - /** Current state of the lexical analyser. */ - enum my_lex_states next_state; - - /** - Position of ';' in the stream, to delimit multiple queries. - This delimiter is in the raw buffer. - */ - const char *found_semicolon; - - /** SQL_MODE = IGNORE_SPACE. */ - bool ignore_space; - - /** - TRUE if we're parsing a prepared statement: in this mode - we should allow placeholders. - */ - bool stmt_prepare_mode; - /** - TRUE if we should allow multi-statements. - */ - bool multi_statements; - - /** Current line number. */ - uint yylineno; - - /** - Current statement digest instrumentation. - */ - sql_digest_state* m_digest; - -private: - /** State of the lexical analyser for comments. */ - enum_comment_state in_comment; - enum_comment_state in_comment_saved; - - /** - Starting position of the TEXT_STRING or IDENT in the pre-processed - buffer. - - NOTE: this member must be used within MYSQLlex() function only. - */ - const char *m_cpp_text_start; - - /** - Ending position of the TEXT_STRING or IDENT in the pre-processed - buffer. - - NOTE: this member must be used within MYSQLlex() function only. - */ - const char *m_cpp_text_end; - - /** - Character set specified by the character-set-introducer. - - NOTE: this member must be used within MYSQLlex() function only. - */ - CHARSET_INFO *m_underscore_cs; -}; - - -/** - Abstract representation of a statement. - This class is an interface between the parser and the runtime. - The parser builds the appropriate sub classes of Sql_statement - to represent a SQL statement in the parsed tree. - The execute() method in the sub classes contain the runtime implementation. - Note that this interface is used for SQL statement recently implemented, - the code for older statements tend to load the LEX structure with more - attributes instead. - The recommended way to implement new statements is to sub-class - Sql_statement, as this improves code modularity (see the 'big switch' in - dispatch_command()), and decrease the total size of the LEX structure - (therefore saving memory in stored programs). -*/ -class Sql_statement : public Sql_alloc -{ -public: - /** - Execute this SQL statement. - @param thd the current thread. - @return 0 on success. - */ - virtual bool execute(THD *thd) = 0; - -protected: - /** - Constructor. - @param lex the LEX structure that represents parts of this statement. - */ - Sql_statement(LEX *lex) - : m_lex(lex) - {} - - /** Destructor. */ - virtual ~Sql_statement() - { - /* - Sql_statement objects are allocated in thd->mem_root. - In MySQL, the C++ destructor is never called, the underlying MEM_ROOT is - simply destroyed instead. - Do not rely on the destructor for any cleanup. - */ - DBUG_ASSERT(FALSE); - } - -protected: - /** - The legacy LEX structure for this statement. - The LEX structure contains the existing properties of the parsed tree. - TODO: with time, attributes from LEX should move to sub classes of - Sql_statement, so that the parser only builds Sql_statement objects - with the minimum set of attributes, instead of a LEX structure that - contains the collection of every possible attribute. - */ - LEX *m_lex; -}; - - -class Delete_plan; -class SQL_SELECT; - -class Explain_query; -class Explain_update; -class Explain_delete; - -/* - Query plan of a single-table UPDATE. - (This is actually a plan for single-table DELETE also) -*/ - -class Update_plan -{ -protected: - bool impossible_where; - bool no_partitions; -public: - /* Allocate things there */ - MEM_ROOT *mem_root; - - TABLE *table; - SQL_SELECT *select; - uint index; - ha_rows scanned_rows; - /* - Top-level select_lex. Most of its fields are not used, we need it only to - get to the subqueries. - */ - SELECT_LEX *select_lex; - - key_map possible_keys; - bool using_filesort; - bool using_io_buffer; - - /* Set this plan to be a plan to do nothing because of impossible WHERE */ - void set_impossible_where() { impossible_where= true; } - void set_no_partitions() { no_partitions= true; } - - Explain_update* save_explain_update_data(MEM_ROOT *mem_root, THD *thd); -protected: - bool save_explain_data_intern(MEM_ROOT *mem_root, Explain_update *eu, bool is_analyze); -public: - virtual ~Update_plan() {} - - Update_plan(MEM_ROOT *mem_root_arg) : - impossible_where(false), no_partitions(false), - mem_root(mem_root_arg), - using_filesort(false), using_io_buffer(false) - {} -}; - - -/* Query plan of a single-table DELETE */ -class Delete_plan : public Update_plan -{ - bool deleting_all_rows; -public: - - /* Construction functions */ - Delete_plan(MEM_ROOT *mem_root_arg) : - Update_plan(mem_root_arg), - deleting_all_rows(false) - {} - - /* Set this query plan to be a plan to make a call to h->delete_all_rows() */ - void set_delete_all_rows(ha_rows rows_arg) - { - deleting_all_rows= true; - scanned_rows= rows_arg; - } - void cancel_delete_all_rows() - { - deleting_all_rows= false; - } - - Explain_delete* save_explain_delete_data(MEM_ROOT *mem_root, THD *thd); -}; - -enum account_lock_type -{ - ACCOUNTLOCK_UNSPECIFIED= 0, - ACCOUNTLOCK_LOCKED, - ACCOUNTLOCK_UNLOCKED -}; - -enum password_exp_type -{ - PASSWORD_EXPIRE_UNSPECIFIED= 0, - PASSWORD_EXPIRE_NOW, - PASSWORD_EXPIRE_NEVER, - PASSWORD_EXPIRE_DEFAULT, - PASSWORD_EXPIRE_INTERVAL -}; - -struct Account_options: public USER_RESOURCES -{ - Account_options() { } - - void reset() - { - bzero(this, sizeof(*this)); - ssl_type= SSL_TYPE_NOT_SPECIFIED; - } - - enum SSL_type ssl_type; // defined in violite.h - LEX_CSTRING x509_subject, x509_issuer, ssl_cipher; - account_lock_type account_locked; - password_exp_type password_expire; - longlong num_expiration_days; -}; - -class Query_arena_memroot; -/* The state of the lex parsing. This is saved in the THD struct */ - - -class Lex_prepared_stmt -{ - Lex_ident_sys m_name; // Statement name (in all queries) - Item *m_code; // PREPARE or EXECUTE IMMEDIATE source expression - List m_params; // List of parameters for EXECUTE [IMMEDIATE] -public: - - Lex_prepared_stmt() - :m_code(NULL) - { } - const Lex_ident_sys &name() const - { - return m_name; - } - uint param_count() const - { - return m_params.elements; - } - List ¶ms() - { - return m_params; - } - void set(const Lex_ident_sys_st &ident, Item *code, List *params) - { - DBUG_ASSERT(m_params.elements == 0); - m_name= ident; - m_code= code; - if (params) - m_params= *params; - } - bool params_fix_fields(THD *thd) - { - // Fix Items in the EXECUTE..USING list - List_iterator_fast param_it(m_params); - while (Item *param= param_it++) - { - if (param->fix_fields_if_needed_for_scalar(thd, 0)) - return true; - } - return false; - } - bool get_dynamic_sql_string(THD *thd, LEX_CSTRING *dst, String *buffer); - void lex_start() - { - m_params.empty(); - } -}; - - -class Lex_grant_object_name: public Grant_object_name, public Sql_alloc -{ -public: - Lex_grant_object_name(Table_ident *table_ident) - :Grant_object_name(table_ident) - { } - Lex_grant_object_name(const LEX_CSTRING &db, Type type) - :Grant_object_name(db, type) - { } -}; - - -class Lex_grant_privilege: public Grant_privilege, public Sql_alloc -{ -public: - Lex_grant_privilege() {} - Lex_grant_privilege(privilege_t grant, bool all_privileges= false) - :Grant_privilege(grant, all_privileges) - { } -}; - - -struct LEX: public Query_tables_list -{ - SELECT_LEX_UNIT unit; /* most upper unit */ - inline SELECT_LEX *first_select_lex() {return unit.first_select();} - -private: - SELECT_LEX builtin_select; - -public: - /* current SELECT_LEX in parsing */ - SELECT_LEX *current_select; - /* list of all SELECT_LEX */ - SELECT_LEX *all_selects_list; - /* current with clause in parsing if any, otherwise 0*/ - With_clause *curr_with_clause; - /* pointer to the first with clause in the current statement */ - With_clause *with_clauses_list; - /* - (*with_clauses_list_last_next) contains a pointer to the last - with clause in the current statement - */ - With_clause **with_clauses_list_last_next; - /* - When a copy of a with element is parsed this is set to the offset of - the with element in the input string, otherwise it's set to 0 - */ - my_ptrdiff_t clone_spec_offset; - - Create_view_info *create_view; - - /* Query Plan Footprint of a currently running select */ - Explain_query *explain; - - // type information - CHARSET_INFO *charset; - /* - LEX which represents current statement (conventional, SP or PS) - - For example during view parsing THD::lex will point to the views LEX and - lex::stmt_lex will point to LEX of the statement where the view will be - included - - Currently it is used to have always correct select numbering inside - statement (LEX::current_select_number) without storing and restoring a - global counter which was THD::select_number. - - TODO: make some unified statement representation (now SP has different) - to store such data like LEX::current_select_number. - */ - LEX *stmt_lex; - - LEX_CSTRING name; - const char *help_arg; - const char *backup_dir; /* For RESTORE/BACKUP */ - const char* to_log; /* For PURGE MASTER LOGS TO */ - String *wild; /* Wildcard in SHOW {something} LIKE 'wild'*/ - sql_exchange *exchange; - select_result *result; - /** - @c the two may also hold BINLOG arguments: either comment holds a - base64-char string or both represent the BINLOG fragment user variables. - */ - LEX_CSTRING comment, ident; - LEX_USER *grant_user; - XID *xid; - THD *thd; - - /* maintain a list of used plugins for this LEX */ - DYNAMIC_ARRAY plugins; - plugin_ref plugins_static_buffer[INITIAL_LEX_PLUGIN_LIST_SIZE]; - - /** SELECT of CREATE VIEW statement */ - LEX_STRING create_view_select; - - uint current_select_number; // valid for statment LEX (not view) - - /** Start of 'ON table', in trigger statements. */ - const char* raw_trg_on_table_name_begin; - /** End of 'ON table', in trigger statements. */ - const char* raw_trg_on_table_name_end; - - /* Partition info structure filled in by PARTITION BY parse part */ - partition_info *part_info; - - /* - The definer of the object being created (view, trigger, stored routine). - I.e. the value of DEFINER clause. - */ - LEX_USER *definer; - - /* Used in ALTER/CREATE user to store account locking options */ - Account_options account_options; - - Table_type table_type; /* Used for SHOW CREATE */ - List ref_list; - List users_list; - List *insert_list,field_list,value_list,update_list; - List many_values; - List var_list; - List stmt_var_list; //SET_STATEMENT values - List old_var_list; // SET STATEMENT old values -private: - Query_arena_memroot *arena_for_set_stmt; - MEM_ROOT *mem_root_for_set_stmt; - bool sp_block_finalize(THD *thd, const Lex_spblock_st spblock, - class sp_label **splabel); - bool sp_change_context(THD *thd, const sp_pcontext *ctx, bool exclusive); - bool sp_exit_block(THD *thd, sp_label *lab); - bool sp_exit_block(THD *thd, sp_label *lab, Item *when); - - bool sp_continue_loop(THD *thd, sp_label *lab); - - bool sp_for_loop_condition(THD *thd, const Lex_for_loop_st &loop); - bool sp_for_loop_increment(THD *thd, const Lex_for_loop_st &loop); - - /* - Check if Item_field and Item_ref are allowed in the current statement. - @retval false OK (fields are allowed) - @retval true ERROR (fields are not allowed). Error is raised. - */ - bool check_expr_allows_fields_or_error(THD *thd, const char *name) const; - -protected: - bool sp_continue_loop(THD *thd, sp_label *lab, Item *when); - -public: - void parse_error(uint err_number= ER_SYNTAX_ERROR); - inline bool is_arena_for_set_stmt() {return arena_for_set_stmt != 0;} - bool set_arena_for_set_stmt(Query_arena *backup); - void reset_arena_for_set_stmt(Query_arena *backup); - void free_arena_for_set_stmt(); - - void print(String *str, enum_query_type qtype); - List set_var_list; // in-query assignment list - List param_list; - List view_list; // view list (list of field names in view) - List *column_list; // list of column names (in ANALYZE) - List *index_list; // list of index names (in ANALYZE) - /* - A stack of name resolution contexts for the query. This stack is used - at parse time to set local name resolution contexts for various parts - of a query. For example, in a JOIN ... ON (some_condition) clause the - Items in 'some_condition' must be resolved only against the operands - of the the join, and not against the whole clause. Similarly, Items in - subqueries should be resolved against the subqueries (and outer queries). - The stack is used in the following way: when the parser detects that - all Items in some clause need a local context, it creates a new context - and pushes it on the stack. All newly created Items always store the - top-most context in the stack. Once the parser leaves the clause that - required a local context, the parser pops the top-most context. - */ - List context_stack; - SELECT_LEX *select_stack[MAX_SELECT_NESTING + 1]; - uint select_stack_top; - - SQL_I_List proc_list; - SQL_I_List auxiliary_table_list, save_list; - Column_definition *last_field; - Item_sum *in_sum_func; - udf_func udf; - HA_CHECK_OPT check_opt; // check/repair options - Table_specification_st create_info; - Key *last_key; - LEX_MASTER_INFO mi; // used by CHANGE MASTER - LEX_SERVER_OPTIONS server_options; - LEX_CSTRING relay_log_connection_name; - LEX_RESET_SLAVE reset_slave_info; - ulonglong type; - ulong next_binlog_file_number; - /* The following is used by KILL */ - killed_state kill_signal; - killed_type kill_type; - bool is_shutdown_wait_for_slaves; - /* - This variable is used in post-parse stage to declare that sum-functions, - or functions which have sense only if GROUP BY is present, are allowed. - For example in a query - SELECT ... FROM ...WHERE MIN(i) == 1 GROUP BY ... HAVING MIN(i) > 2 - MIN(i) in the WHERE clause is not allowed in the opposite to MIN(i) - in the HAVING clause. Due to possible nesting of select construct - the variable can contain 0 or 1 for each nest level. - */ - nesting_map allow_sum_func; - - Sql_cmd *m_sql_cmd; - - /* - Usually `expr` rule of yacc is quite reused but some commands better - not support subqueries which comes standard with this rule, like - KILL, HA_READ, CREATE/ALTER EVENT etc. Set this to a non-NULL - clause name to get an error. - */ - const char *clause_that_disallows_subselect; - bool selects_allow_into; - bool selects_allow_procedure; - /* - A special command "PARSE_VCOL_EXPR" is defined for the parser - to translate a defining expression of a virtual column into an - Item object. - The following flag is used to prevent other applications to use - this command. - */ - bool parse_vcol_expr; - - enum enum_duplicates duplicates; - enum enum_tx_isolation tx_isolation; - enum enum_ha_read_modes ha_read_mode; - union { - enum ha_rkey_function ha_rkey_mode; - enum xa_option_words xa_opt; - bool with_admin_option; // GRANT role - bool with_persistent_for_clause; // uses PERSISTENT FOR clause (in ANALYZE) - }; - enum enum_var_type option_type; - enum enum_drop_mode drop_mode; - - uint profile_query_id; - uint profile_options; - enum backup_stages backup_stage; - enum Foreign_key::fk_match_opt fk_match_option; - enum_fk_option fk_update_opt; - enum_fk_option fk_delete_opt; - uint slave_thd_opt, start_transaction_opt; - int nest_level; - /* - In LEX representing update which were transformed to multi-update - stores total number of tables. For LEX representing multi-delete - holds number of tables from which we will delete records. - */ - uint table_count; - uint8 describe; - bool analyze_stmt; /* TRUE<=> this is "ANALYZE $stmt" */ - bool explain_json; - /* - A flag that indicates what kinds of derived tables are present in the - query (0 if no derived tables, otherwise a combination of flags - DERIVED_SUBQUERY and DERIVED_VIEW). - */ - uint8 derived_tables; - uint8 context_analysis_only; - bool local_file; - bool check_exists; - bool autocommit; - bool verbose, no_write_to_binlog; - - enum enum_yes_no_unknown tx_chain, tx_release; - bool safe_to_cache_query; - bool ignore; - bool next_is_main; // use "main" SELECT_LEX for nrxt allocation; - bool next_is_down; // use "main" SELECT_LEX for nrxt allocation; - st_parsing_options parsing_options; - uint8 lex_options; // see OPTION_LEX_* - /* - In sql_cache we store SQL_CACHE flag as specified by user to be - able to restore SELECT statement from internal structures. - */ - enum e_sql_cache { SQL_CACHE_UNSPECIFIED, SQL_NO_CACHE, SQL_CACHE }; - e_sql_cache sql_cache; - - Alter_info alter_info; - /* - For CREATE TABLE statement last element of table list which is not - part of SELECT or LIKE part (i.e. either element for table we are - creating or last of tables referenced by foreign keys). - */ - TABLE_LIST *create_last_non_select_table; - Lex_prepared_stmt prepared_stmt; - sp_head *sphead; - sp_name *spname; - bool sp_lex_in_use; // Keep track on lex usage in SPs for error handling - - sp_pcontext *spcont; - - st_sp_chistics sp_chistics; - - Event_parse_data *event_parse_data; - - /* - field_list was created for view and should be removed before PS/SP - rexecuton - */ - bool empty_field_list_on_rset; - /* Characterstics of trigger being created */ - st_trg_chistics trg_chistics; - /* - List of all items (Item_trigger_field objects) representing fields in - old/new version of row in trigger. We use this list for checking whenever - all such fields are valid at trigger creation time and for binding these - fields to TABLE object at table open (altough for latter pointer to table - being opened is probably enough). - */ - SQL_I_List trg_table_fields; - - /* - stmt_definition_begin is intended to point to the next word after - DEFINER-clause in the following statements: - - CREATE TRIGGER (points to "TRIGGER"); - - CREATE PROCEDURE (points to "PROCEDURE"); - - CREATE FUNCTION (points to "FUNCTION" or "AGGREGATE"); - - CREATE EVENT (points to "EVENT") - - This pointer is required to add possibly omitted DEFINER-clause to the - DDL-statement before dumping it to the binlog. - - keyword_delayed_begin_offset is the offset to the beginning of the DELAYED - keyword in INSERT DELAYED statement. keyword_delayed_end_offset is the - offset to the character right after the DELAYED keyword. - */ - union { - const char *stmt_definition_begin; - uint keyword_delayed_begin_offset; - }; - - union { - const char *stmt_definition_end; - uint keyword_delayed_end_offset; - }; - - /** - Collects create options for KEY - */ - engine_option_value *option_list; - - /** - Helper pointer to the end of the list when parsing options for - LEX::create_info.option_list (for table) - LEX::last_field->option_list (for fields) - LEX::option_list (for indexes) - */ - engine_option_value *option_list_last; - - /** - During name resolution search only in the table list given by - Name_resolution_context::first_name_resolution_table and - Name_resolution_context::last_name_resolution_table - (see Item_field::fix_fields()). - */ - bool use_only_table_context; - - /* - Reference to a struct that contains information in various commands - to add/create/drop/change table spaces. - */ - st_alter_tablespace *alter_tablespace_info; - - bool escape_used; - bool default_used; /* using default() function */ - bool is_lex_started; /* If lex_start() did run. For debugging. */ - - /* - The set of those tables whose fields are referenced in all subqueries - of the query. - TODO: possibly this it is incorrect to have used tables in LEX because - with subquery, it is not clear what does the field mean. To fix this - we should aggregate used tables information for selected expressions - into the select_lex. - */ - table_map used_tables; - /** - Maximum number of rows and/or keys examined by the query, both read, - changed or written. This is the argument of LIMIT ROWS EXAMINED. - The limit is represented by two variables - the Item is needed because - in case of parameters we have to delay its evaluation until execution. - Once evaluated, its value is stored in examined_rows_limit_cnt. - */ - Item *limit_rows_examined; - ulonglong limit_rows_examined_cnt; - /** - Holds a set of domain_ids for deletion at FLUSH..DELETE_DOMAIN_ID - */ - DYNAMIC_ARRAY delete_gtid_domain; - static const ulong initial_gtid_domain_buffer_size= 16; - uint32 gtid_domain_static_buffer[initial_gtid_domain_buffer_size]; - - inline void set_limit_rows_examined() - { - if (limit_rows_examined) - limit_rows_examined_cnt= limit_rows_examined->val_uint(); - else - limit_rows_examined_cnt= ULONGLONG_MAX; - } - - - SQL_I_List save_group_list; - SQL_I_List save_order_list; - LEX_CSTRING *win_ref; - Window_frame *win_frame; - Window_frame_bound *frame_top_bound; - Window_frame_bound *frame_bottom_bound; - Window_spec *win_spec; - - /* System Versioning */ - vers_select_conds_t vers_conditions; - vers_select_conds_t period_conditions; - - inline void free_set_stmt_mem_root() - { - DBUG_ASSERT(!is_arena_for_set_stmt()); - if (mem_root_for_set_stmt) - { - free_root(mem_root_for_set_stmt, MYF(0)); - delete mem_root_for_set_stmt; - mem_root_for_set_stmt= 0; - } - } - - LEX(); - - virtual ~LEX() - { - free_set_stmt_mem_root(); - destroy_query_tables_list(); - plugin_unlock_list(NULL, (plugin_ref *)plugins.buffer, plugins.elements); - delete_dynamic(&plugins); - } - - virtual class Query_arena *query_arena() - { - DBUG_ASSERT(0); - return NULL; - } - - void start(THD *thd); - - inline bool is_ps_or_view_context_analysis() - { - return (context_analysis_only & - (CONTEXT_ANALYSIS_ONLY_PREPARE | - CONTEXT_ANALYSIS_ONLY_VCOL_EXPR | - CONTEXT_ANALYSIS_ONLY_VIEW)); - } - - inline bool is_view_context_analysis() - { - return (context_analysis_only & CONTEXT_ANALYSIS_ONLY_VIEW); - } - - inline void uncacheable(uint8 cause) - { - safe_to_cache_query= 0; - - if (current_select) // initialisation SP variables has no SELECT - { - /* - There are no sense to mark select_lex and union fields of LEX, - but we should merk all subselects as uncacheable from current till - most upper - */ - SELECT_LEX *sl; - SELECT_LEX_UNIT *un; - for (sl= current_select, un= sl->master_unit(); - un && un != &unit; - sl= sl->outer_select(), un= (sl ? sl->master_unit() : NULL)) - { - sl->uncacheable|= cause; - un->uncacheable|= cause; - } - if (sl) - sl->uncacheable|= cause; - } - if (first_select_lex()) - first_select_lex()->uncacheable|= cause; - } - void set_trg_event_type_for_tables(); - - TABLE_LIST *unlink_first_table(bool *link_to_local); - void link_first_table_back(TABLE_LIST *first, bool link_to_local); - void first_lists_tables_same(); - void fix_first_select_number(); - - bool can_be_merged(); - bool can_use_merged(); - bool can_not_use_merged(); - bool only_view_structure(); - bool need_correct_ident(); - uint8 get_effective_with_check(TABLE_LIST *view); - /* - Is this update command where 'WHITH CHECK OPTION' clause is important - - SYNOPSIS - LEX::which_check_option_applicable() - - RETURN - TRUE have to take 'WHITH CHECK OPTION' clause into account - FALSE 'WHITH CHECK OPTION' clause do not need - */ - inline bool which_check_option_applicable() - { - switch (sql_command) { - case SQLCOM_UPDATE: - case SQLCOM_UPDATE_MULTI: - case SQLCOM_DELETE: - case SQLCOM_DELETE_MULTI: - case SQLCOM_INSERT: - case SQLCOM_INSERT_SELECT: - case SQLCOM_REPLACE: - case SQLCOM_REPLACE_SELECT: - case SQLCOM_LOAD: - return TRUE; - default: - return FALSE; - } - } - - void cleanup_after_one_table_open(); - - bool push_context(Name_resolution_context *context); - - Name_resolution_context *pop_context(); - - SELECT_LEX *select_stack_head() - { - if (likely(select_stack_top)) - return select_stack[select_stack_top - 1]; - return NULL; - } - - bool push_select(SELECT_LEX *select_lex) - { - DBUG_ENTER("LEX::push_select"); - DBUG_PRINT("info", ("Top Select was %p (%d) depth: %u pushed: %p (%d)", - select_stack_head(), - select_stack_top, - (select_stack_top ? - select_stack_head()->select_number : - 0), - select_lex, select_lex->select_number)); - if (unlikely(select_stack_top > MAX_SELECT_NESTING)) - { - my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT, MYF(0)); - DBUG_RETURN(TRUE); - } - if (push_context(&select_lex->context)) - DBUG_RETURN(TRUE); - select_stack[select_stack_top++]= select_lex; - current_select= select_lex; - DBUG_RETURN(FALSE); - } - - SELECT_LEX *pop_select() - { - DBUG_ENTER("LEX::pop_select"); - SELECT_LEX *select_lex; - if (likely(select_stack_top)) - select_lex= select_stack[--select_stack_top]; - else - select_lex= 0; - DBUG_PRINT("info", ("Top Select is %p (%d) depth: %u poped: %p (%d)", - select_stack_head(), - select_stack_top, - (select_stack_top ? - select_stack_head()->select_number : - 0), - select_lex, - (select_lex ? select_lex->select_number : 0))); - DBUG_ASSERT(select_lex); - - pop_context(); - - if (unlikely(!select_stack_top)) - { - current_select= &builtin_select; - DBUG_PRINT("info", ("Top Select is empty -> sel builtin: %p service: %u", - current_select, builtin_select.is_service_select)); - builtin_select.is_service_select= false; - } - else - current_select= select_stack[select_stack_top - 1]; - - DBUG_RETURN(select_lex); - } - - SELECT_LEX *current_select_or_default() - { - return current_select ? current_select : &builtin_select; - } - - bool copy_db_to(LEX_CSTRING *to); - - Name_resolution_context *current_context() - { - return context_stack.head(); - } - - /* - Restore the LEX and THD in case of a parse error. - */ - static void cleanup_lex_after_parse_error(THD *thd); - - void reset_n_backup_query_tables_list(Query_tables_list *backup); - void restore_backup_query_tables_list(Query_tables_list *backup); - - bool table_or_sp_used(); - - bool is_partition_management() const; - bool part_values_current(THD *thd); - bool part_values_history(THD *thd); - - /** - @brief check if the statement is a single-level join - @return result of the check - @retval TRUE The statement doesn't contain subqueries, unions and - stored procedure calls. - @retval FALSE There are subqueries, UNIONs or stored procedure calls. - */ - bool is_single_level_stmt() - { - /* - This check exploits the fact that the last added to all_select_list is - on its top. So select_lex (as the first added) will be at the tail - of the list. - */ - if (first_select_lex() == all_selects_list && !sroutines.records) - { - return TRUE; - } - return FALSE; - } - - bool save_prep_leaf_tables(); - - int print_explain(select_result_sink *output, uint8 explain_flags, - bool is_analyze, bool *printed_anything); - void restore_set_statement_var(); - - void init_last_field(Column_definition *field, const LEX_CSTRING *name, - const CHARSET_INFO *cs); - bool last_field_generated_always_as_row_start_or_end(Lex_ident *p, - const char *type, - uint flags); - bool last_field_generated_always_as_row_start(); - bool last_field_generated_always_as_row_end(); - bool set_bincmp(CHARSET_INFO *cs, bool bin); - - bool new_sp_instr_stmt(THD *, const LEX_CSTRING &prefix, - const LEX_CSTRING &suffix); - bool sp_proc_stmt_statement_finalize_buf(THD *, const LEX_CSTRING &qbuf); - bool sp_proc_stmt_statement_finalize(THD *, bool no_lookahead); - - sp_variable *sp_param_init(LEX_CSTRING *name); - bool sp_param_fill_definition(sp_variable *spvar, - const Lex_field_type_st &def); - bool sf_return_fill_definition(const Lex_field_type_st &def); - - int case_stmt_action_then(); - bool setup_select_in_parentheses(); - bool set_trigger_new_row(const LEX_CSTRING *name, Item *val); - bool set_trigger_field(const LEX_CSTRING *name1, const LEX_CSTRING *name2, - Item *val); - bool set_system_variable(enum_var_type var_type, sys_var *var, - const Lex_ident_sys_st *base_name, Item *val); - bool set_system_variable(enum_var_type var_type, - const Lex_ident_sys_st *name, Item *val); - bool set_system_variable(THD *thd, enum_var_type var_type, - const Lex_ident_sys_st *name1, - const Lex_ident_sys_st *name2, - Item *val); - bool set_default_system_variable(enum_var_type var_type, - const Lex_ident_sys_st *name, - Item *val); - bool set_user_variable(THD *thd, const LEX_CSTRING *name, Item *val); - void set_stmt_init(); - sp_name *make_sp_name(THD *thd, const LEX_CSTRING *name); - sp_name *make_sp_name(THD *thd, const LEX_CSTRING *name1, - const LEX_CSTRING *name2); - sp_name *make_sp_name_package_routine(THD *thd, const LEX_CSTRING *name); - sp_head *make_sp_head(THD *thd, const sp_name *name, const Sp_handler *sph, - enum_sp_aggregate_type agg_type); - sp_head *make_sp_head_no_recursive(THD *thd, const sp_name *name, - const Sp_handler *sph, - enum_sp_aggregate_type agg_type); - bool sp_body_finalize_routine(THD *); - bool sp_body_finalize_trigger(THD *); - bool sp_body_finalize_event(THD *); - bool sp_body_finalize_function(THD *); - bool sp_body_finalize_procedure(THD *); - bool sp_body_finalize_procedure_standalone(THD *, const sp_name *end_name); - sp_package *create_package_start(THD *thd, - enum_sql_command command, - const Sp_handler *sph, - const sp_name *name, - DDL_options_st options); - bool create_package_finalize(THD *thd, - const sp_name *name, - const sp_name *name2, - const char *body_start, - const char *body_end); - bool call_statement_start(THD *thd, sp_name *name); - bool call_statement_start(THD *thd, const Lex_ident_sys_st *name); - bool call_statement_start(THD *thd, const Lex_ident_sys_st *name1, - const Lex_ident_sys_st *name2); - sp_variable *find_variable(const LEX_CSTRING *name, - sp_pcontext **ctx, - const Sp_rcontext_handler **rh) const; - sp_variable *find_variable(const LEX_CSTRING *name, - const Sp_rcontext_handler **rh) const - { - sp_pcontext *not_used_ctx; - return find_variable(name, ¬_used_ctx, rh); - } - bool set_variable(const Lex_ident_sys_st *name, Item *item); - bool set_variable(const Lex_ident_sys_st *name1, - const Lex_ident_sys_st *name2, Item *item); - void sp_variable_declarations_init(THD *thd, int nvars); - bool sp_variable_declarations_finalize(THD *thd, int nvars, - const Column_definition *cdef, - Item *def); - bool sp_variable_declarations_set_default(THD *thd, int nvars, Item *def); - bool sp_variable_declarations_row_finalize(THD *thd, int nvars, - Row_definition_list *row, - Item *def); - bool sp_variable_declarations_with_ref_finalize(THD *thd, int nvars, - Qualified_column_ident *col, - Item *def); - bool sp_variable_declarations_rowtype_finalize(THD *thd, int nvars, - Qualified_column_ident *, - Item *def); - bool sp_variable_declarations_cursor_rowtype_finalize(THD *thd, int nvars, - uint offset, - Item *def); - bool sp_variable_declarations_table_rowtype_finalize(THD *thd, int nvars, - const LEX_CSTRING &db, - const LEX_CSTRING &table, - Item *def); - bool sp_variable_declarations_column_type_finalize(THD *thd, int nvars, - Qualified_column_ident *ref, - Item *def); - bool sp_variable_declarations_vartype_finalize(THD *thd, int nvars, - const LEX_CSTRING &name, - Item *def); - bool sp_variable_declarations_copy_type_finalize(THD *thd, int nvars, - const Column_definition &ref, - Row_definition_list *fields, - Item *def); - - LEX_USER *current_user_for_set_password(THD *thd); - bool sp_create_set_password_instr(THD *thd, - LEX_USER *user, - USER_AUTH *auth, - bool no_lookahead); - bool sp_create_set_password_instr(THD *thd, - USER_AUTH *auth, - bool no_lookahead) - { - LEX_USER *user; - return !(user= current_user_for_set_password(thd)) || - sp_create_set_password_instr(thd, user, auth, no_lookahead); - } - - bool sp_handler_declaration_init(THD *thd, int type); - bool sp_handler_declaration_finalize(THD *thd, int type); - - bool sp_declare_cursor(THD *thd, const LEX_CSTRING *name, - class sp_lex_cursor *cursor_stmt, - sp_pcontext *param_ctx, bool add_cpush_instr); - - bool sp_open_cursor(THD *thd, const LEX_CSTRING *name, - List *parameters); - Item_splocal *create_item_for_sp_var(const Lex_ident_cli_st *name, - sp_variable *spvar); - - Item *create_item_qualified_asterisk(THD *thd, const Lex_ident_sys_st *name); - Item *create_item_qualified_asterisk(THD *thd, - const Lex_ident_sys_st *a, - const Lex_ident_sys_st *b); - Item *create_item_qualified_asterisk(THD *thd, const Lex_ident_cli_st *cname) - { - Lex_ident_sys name(thd, cname); - if (name.is_null()) - return NULL; // EOM - return create_item_qualified_asterisk(thd, &name); - } - Item *create_item_qualified_asterisk(THD *thd, - const Lex_ident_cli_st *ca, - const Lex_ident_cli_st *cb) - { - Lex_ident_sys a(thd, ca), b(thd, cb); - if (a.is_null() || b.is_null()) - return NULL; // EOM - return create_item_qualified_asterisk(thd, &a, &b); - } - - Item *create_item_ident_field(THD *thd, - const Lex_ident_sys_st &db, - const Lex_ident_sys_st &table, - const Lex_ident_sys_st &name); - Item *create_item_ident_nosp(THD *thd, Lex_ident_sys_st *name) - { - return create_item_ident_field(thd, Lex_ident_sys(), Lex_ident_sys(), *name); - } - Item *create_item_ident_sp(THD *thd, Lex_ident_sys_st *name, - const char *start, const char *end); - Item *create_item_ident(THD *thd, Lex_ident_cli_st *cname) - { - Lex_ident_sys name(thd, cname); - if (name.is_null()) - return NULL; // EOM - return sphead ? - create_item_ident_sp(thd, &name, cname->pos(), cname->end()) : - create_item_ident_nosp(thd, &name); - } - /* - Create an Item corresponding to a qualified name: a.b - when the parser is out of an SP context. - @param THD - THD, for mem_root - @param a - the first name - @param b - the second name - @retval - a pointer to a created item, or NULL on error. - - Possible Item types that can be created: - - Item_trigger_field - - Item_field - - Item_ref - */ - Item *create_item_ident_nospvar(THD *thd, - const Lex_ident_sys_st *a, - const Lex_ident_sys_st *b); - /* - Create an Item corresponding to a ROW field valiable: var.field - @param THD - THD, for mem_root - @param rh [OUT] - the rcontext handler (local vs package variables) - @param var - the ROW variable name - @param field - the ROW variable field name - @param spvar - the variable that was previously found by name - using "var_name". - @param start - position in the query (for binary log) - @param end - end in the query (for binary log) - */ - Item_splocal *create_item_spvar_row_field(THD *thd, - const Sp_rcontext_handler *rh, - const Lex_ident_sys *var, - const Lex_ident_sys *field, - sp_variable *spvar, - const char *start, - const char *end); - /* - Create an item from its qualified name. - Depending on context, it can be either a ROW variable field, - or trigger, table field, table field reference. - See comments to create_item_spvar_row_field() and - create_item_ident_nospvar(). - @param thd - THD, for mem_root - @param a - the first name - @param b - the second name - @retval - NULL on error, or a pointer to a new Item. - */ - Item *create_item_ident(THD *thd, - const Lex_ident_cli_st *a, - const Lex_ident_cli_st *b); - /* - Create an item from its qualified name. - Depending on context, it can be a table field, a table field reference, - or a sequence NEXTVAL and CURRVAL. - @param thd - THD, for mem_root - @param a - the first name - @param b - the second name - @param c - the third name - @retval - NULL on error, or a pointer to a new Item. - */ - Item *create_item_ident(THD *thd, - const Lex_ident_sys_st *a, - const Lex_ident_sys_st *b, - const Lex_ident_sys_st *c); - - Item *create_item_ident(THD *thd, - const Lex_ident_cli_st *ca, - const Lex_ident_cli_st *cb, - const Lex_ident_cli_st *cc) - { - Lex_ident_sys b(thd, cb), c(thd, cc); - if (b.is_null() || c.is_null()) - return NULL; - if (ca->pos() == cb->pos()) // SELECT .t1.col1 - { - DBUG_ASSERT(ca->length == 0); - Lex_ident_sys none; - return create_item_ident(thd, &none, &b, &c); - } - Lex_ident_sys a(thd, ca); - return a.is_null() ? NULL : create_item_ident(thd, &a, &b, &c); - } - - /* - Create an item for "NEXT VALUE FOR sequence_name" - */ - Item *create_item_func_nextval(THD *thd, Table_ident *ident); - Item *create_item_func_nextval(THD *thd, const LEX_CSTRING *db, - const LEX_CSTRING *name); - /* - Create an item for "PREVIOUS VALUE FOR sequence_name" - */ - Item *create_item_func_lastval(THD *thd, Table_ident *ident); - Item *create_item_func_lastval(THD *thd, const LEX_CSTRING *db, - const LEX_CSTRING *name); - - /* - Create an item for "SETVAL(sequence_name, value [, is_used [, round]]) - */ - Item *create_item_func_setval(THD *thd, Table_ident *ident, longlong value, - ulonglong round, bool is_used); - - /* - Create an item for a name in LIMIT clause: LIMIT var - @param THD - THD, for mem_root - @param var_name - the variable name - @retval - a new Item corresponding to the SP variable, - or NULL on error - (non in SP, unknown variable, wrong data type). - */ - Item *create_item_limit(THD *thd, const Lex_ident_cli_st *var_name); - - /* - Create an item for a qualified name in LIMIT clause: LIMIT var.field - @param THD - THD, for mem_root - @param var_name - the variable name - @param field_name - the variable field name - @param start - start in the query (for binary log) - @param end - end in the query (for binary log) - @retval - a new Item corresponding to the SP variable, - or NULL on error - (non in SP, unknown variable, unknown ROW field, - wrong data type). - */ - Item *create_item_limit(THD *thd, - const Lex_ident_cli_st *var_name, - const Lex_ident_cli_st *field_name); - - Item *create_item_query_expression(THD *thd, st_select_lex_unit *unit); - - Item *make_item_func_replace(THD *thd, Item *org, Item *find, Item *replace); - Item *make_item_func_substr(THD *thd, Item *a, Item *b, Item *c); - Item *make_item_func_substr(THD *thd, Item *a, Item *b); - Item *make_item_func_call_generic(THD *thd, Lex_ident_cli_st *db, - Lex_ident_cli_st *name, List *args); - Item *make_item_func_call_native_or_parse_error(THD *thd, - Lex_ident_cli_st &name, - List *args); - my_var *create_outvar(THD *thd, const LEX_CSTRING *name); - - /* - Create a my_var instance for a ROW field variable that was used - as an OUT SP parameter: CALL p1(var.field); - @param THD - THD, for mem_root - @param var_name - the variable name - @param field_name - the variable field name - */ - my_var *create_outvar(THD *thd, - const LEX_CSTRING *var_name, - const LEX_CSTRING *field_name); - - bool is_trigger_new_or_old_reference(const LEX_CSTRING *name) const; - - Item *create_and_link_Item_trigger_field(THD *thd, const LEX_CSTRING *name, - bool new_row); - // For syntax with colon, e.g. :NEW.a or :OLD.a - Item *make_item_colon_ident_ident(THD *thd, - const Lex_ident_cli_st *a, - const Lex_ident_cli_st *b); - // PLSQL: cursor%ISOPEN etc - Item *make_item_plsql_cursor_attr(THD *thd, const LEX_CSTRING *name, - plsql_cursor_attr_t attr); - - // For "SELECT @@var", "SELECT @@var.field" - Item *make_item_sysvar(THD *thd, - enum_var_type type, - const LEX_CSTRING *name) - { - return make_item_sysvar(thd, type, name, &null_clex_str); - } - Item *make_item_sysvar(THD *thd, - enum_var_type type, - const LEX_CSTRING *name, - const LEX_CSTRING *component); - void sp_block_init(THD *thd, const LEX_CSTRING *label); - void sp_block_init(THD *thd) - { - // Unlabeled blocks get an empty label - sp_block_init(thd, &empty_clex_str); - } - bool sp_block_finalize(THD *thd, const Lex_spblock_st spblock) - { - class sp_label *tmp; - return sp_block_finalize(thd, spblock, &tmp); - } - bool sp_block_finalize(THD *thd) - { - return sp_block_finalize(thd, Lex_spblock()); - } - bool sp_block_finalize(THD *thd, const Lex_spblock_st spblock, - const LEX_CSTRING *end_label); - bool sp_block_finalize(THD *thd, const LEX_CSTRING *end_label) - { - return sp_block_finalize(thd, Lex_spblock(), end_label); - } - bool sp_declarations_join(Lex_spblock_st *res, - const Lex_spblock_st b1, - const Lex_spblock_st b2) const - { - if ((b2.vars || b2.conds) && (b1.curs || b1.hndlrs)) - { - my_error(ER_SP_VARCOND_AFTER_CURSHNDLR, MYF(0)); - return true; - } - if (b2.curs && b1.hndlrs) - { - my_error(ER_SP_CURSOR_AFTER_HANDLER, MYF(0)); - return true; - } - res->join(b1, b2); - return false; - } - bool sp_block_with_exceptions_finalize_declarations(THD *thd); - bool sp_block_with_exceptions_finalize_executable_section(THD *thd, - uint executable_section_ip); - bool sp_block_with_exceptions_finalize_exceptions(THD *thd, - uint executable_section_ip, - uint exception_count); - bool sp_block_with_exceptions_add_empty(THD *thd); - bool sp_exit_statement(THD *thd, Item *when); - bool sp_exit_statement(THD *thd, const LEX_CSTRING *label_name, Item *item); - bool sp_leave_statement(THD *thd, const LEX_CSTRING *label_name); - bool sp_goto_statement(THD *thd, const LEX_CSTRING *label_name); - - bool sp_continue_statement(THD *thd); - bool sp_continue_statement(THD *thd, const LEX_CSTRING *label_name); - bool sp_iterate_statement(THD *thd, const LEX_CSTRING *label_name); - - bool maybe_start_compound_statement(THD *thd); - bool sp_push_loop_label(THD *thd, const LEX_CSTRING *label_name); - bool sp_push_loop_empty_label(THD *thd); - bool sp_pop_loop_label(THD *thd, const LEX_CSTRING *label_name); - void sp_pop_loop_empty_label(THD *thd); - bool sp_while_loop_expression(THD *thd, Item *expr); - bool sp_while_loop_finalize(THD *thd); - bool sp_if_after_statements(THD *thd); - bool sp_push_goto_label(THD *thd, const LEX_CSTRING *label_name); - - Item_param *add_placeholder(THD *thd, const LEX_CSTRING *name, - const char *start, const char *end); - - /* Integer range FOR LOOP methods */ - sp_variable *sp_add_for_loop_variable(THD *thd, const LEX_CSTRING *name, - Item *value); - sp_variable *sp_add_for_loop_target_bound(THD *thd, Item *value) - { - LEX_CSTRING name= { STRING_WITH_LEN("[target_bound]") }; - return sp_add_for_loop_variable(thd, &name, value); - } - bool sp_for_loop_intrange_declarations(THD *thd, Lex_for_loop_st *loop, - const LEX_CSTRING *index, - const Lex_for_loop_bounds_st &bounds); - bool sp_for_loop_intrange_condition_test(THD *thd, const Lex_for_loop_st &loop); - bool sp_for_loop_intrange_finalize(THD *thd, const Lex_for_loop_st &loop); - - /* Cursor FOR LOOP methods */ - bool sp_for_loop_cursor_declarations(THD *thd, Lex_for_loop_st *loop, - const LEX_CSTRING *index, - const Lex_for_loop_bounds_st &bounds); - sp_variable *sp_add_for_loop_cursor_variable(THD *thd, - const LEX_CSTRING *name, - const class sp_pcursor *cur, - uint coffset, - sp_assignment_lex *param_lex, - Item_args *parameters); - bool sp_for_loop_implicit_cursor_statement(THD *thd, - Lex_for_loop_bounds_st *bounds, - sp_lex_cursor *cur); - bool sp_for_loop_cursor_condition_test(THD *thd, const Lex_for_loop_st &loop); - bool sp_for_loop_cursor_finalize(THD *thd, const Lex_for_loop_st &); - - /* Generic FOR LOOP methods*/ - - /* - Generate FOR loop declarations and - initialize "loop" from "index" and "bounds". - - @param [IN] thd - current THD, for mem_root and error reporting - @param [OUT] loop - the loop generated SP variables are stored here, - together with additional loop characteristics. - @param [IN] index - the loop index variable name - @param [IN] bounds - the loop bounds (in sp_assignment_lex format) - and additional loop characteristics, - as created by the sp_for_loop_bounds rule. - @retval true - on error - @retval false - on success - - This methods adds declarations: - - An explicit integer or cursor%ROWTYPE "index" variable - - An implicit integer upper bound variable, in case of integer range loops - - A CURSOR, in case of an implicit CURSOR loops - The generated variables are stored into "loop". - Additional loop characteristics are copied from "bounds" to "loop". - */ - bool sp_for_loop_declarations(THD *thd, Lex_for_loop_st *loop, - const LEX_CSTRING *index, - const Lex_for_loop_bounds_st &bounds) - { - return bounds.is_for_loop_cursor() ? - sp_for_loop_cursor_declarations(thd, loop, index, bounds) : - sp_for_loop_intrange_declarations(thd, loop, index, bounds); - } - - /* - Generate a conditional jump instruction to leave the loop, - using a proper condition depending on the loop type: - - Item_func_le -- integer range loops - - Item_func_ge -- integer range reverse loops - - Item_func_cursor_found -- cursor loops - */ - bool sp_for_loop_condition_test(THD *thd, const Lex_for_loop_st &loop) - { - return loop.is_for_loop_cursor() ? - sp_for_loop_cursor_condition_test(thd, loop) : - sp_for_loop_intrange_condition_test(thd, loop); - } - - /* - Generate "increment" instructions followed by a jump to the - condition test in the beginnig of the loop. - "Increment" depends on the loop type and can be: - - index:= index + 1; -- integer range loops - - index:= index - 1; -- integer range reverse loops - - FETCH cursor INTO index; -- cursor loops - */ - bool sp_for_loop_finalize(THD *thd, const Lex_for_loop_st &loop) - { - return loop.is_for_loop_cursor() ? - sp_for_loop_cursor_finalize(thd, loop) : - sp_for_loop_intrange_finalize(thd, loop); - } - bool sp_for_loop_outer_block_finalize(THD *thd, const Lex_for_loop_st &loop); - - /* - Make an Item when an identifier is found in the FOR loop bounds: - FOR rec IN cursor - FOR rec IN var1 .. var2 - FOR rec IN row1.field1 .. xxx - */ - Item *create_item_for_loop_bound(THD *thd, - const LEX_CSTRING *a, - const LEX_CSTRING *b, - const LEX_CSTRING *c); - /* End of FOR LOOP methods */ - - bool add_signal_statement(THD *thd, const class sp_condition_value *value); - bool add_resignal_statement(THD *thd, const class sp_condition_value *value); - - // Check if "KEY IF NOT EXISTS name" used outside of ALTER context - bool check_add_key(DDL_options_st ddl) - { - if (ddl.if_not_exists() && sql_command != SQLCOM_ALTER_TABLE) - { - parse_error(); - return true; - } - return false; - } - // Add a key as a part of CREATE TABLE or ALTER TABLE - bool add_key(Key::Keytype key_type, const LEX_CSTRING *key_name, - ha_key_alg algorithm, DDL_options_st ddl) - { - if (check_add_key(ddl) || - !(last_key= new Key(key_type, key_name, algorithm, false, ddl))) - return true; - alter_info.key_list.push_back(last_key); - return false; - } - // Add a key for a CREATE INDEX statement - bool add_create_index(Key::Keytype key_type, const LEX_CSTRING *key_name, - ha_key_alg algorithm, DDL_options_st ddl) - { - if (check_create_options(ddl) || - !(last_key= new Key(key_type, key_name, algorithm, false, ddl))) - return true; - alter_info.key_list.push_back(last_key); - return false; - } - bool add_create_index_prepare(Table_ident *table) - { - sql_command= SQLCOM_CREATE_INDEX; - if (!current_select->add_table_to_list(thd, table, NULL, - TL_OPTION_UPDATING, - TL_READ_NO_INSERT, - MDL_SHARED_UPGRADABLE)) - return true; - alter_info.reset(); - alter_info.flags= ALTER_ADD_INDEX; - option_list= NULL; - return false; - } - /* - Add an UNIQUE or PRIMARY key which is a part of a column definition: - CREATE TABLE t1 (a INT PRIMARY KEY); - */ - void add_key_to_list(LEX_CSTRING *field_name, - enum Key::Keytype type, bool check_exists); - // Add a constraint as a part of CREATE TABLE or ALTER TABLE - bool add_constraint(const LEX_CSTRING &name, Virtual_column_info *constr, - bool if_not_exists) - { - constr->name= name; - constr->flags= if_not_exists ? VCOL_CHECK_CONSTRAINT_IF_NOT_EXISTS : 0; - alter_info.check_constraint_list.push_back(constr); - return false; - } - bool add_alter_list(LEX_CSTRING par_name, Virtual_column_info *expr, - bool par_exists); - bool add_alter_list(LEX_CSTRING name, LEX_CSTRING new_name, bool exists); - void set_command(enum_sql_command command, - DDL_options_st options) - { - sql_command= command; - create_info.set(options); - } - void set_command(enum_sql_command command, - uint scope, - DDL_options_st options) - { - set_command(command, options); - create_info.options|= scope; // HA_LEX_CREATE_TMP_TABLE or 0 - } - bool check_create_options(DDL_options_st options) - { - if (options.or_replace() && options.if_not_exists()) - { - my_error(ER_WRONG_USAGE, MYF(0), "OR REPLACE", "IF NOT EXISTS"); - return true; - } - return false; - } - bool set_create_options_with_check(DDL_options_st options) - { - create_info.set(options); - return check_create_options(create_info); - } - bool add_create_options_with_check(DDL_options_st options) - { - create_info.add(options); - return check_create_options(create_info); - } - bool sp_add_cfetch(THD *thd, const LEX_CSTRING *name); - bool sp_add_agg_cfetch(); - - bool set_command_with_check(enum_sql_command command, - uint scope, - DDL_options_st options) - { - set_command(command, scope, options); - return check_create_options(options); - } - bool set_command_with_check(enum_sql_command command, DDL_options_st options) - { - set_command(command, options); - return check_create_options(options); - } - /* - DROP shares lex->create_info to store TEMPORARY and IF EXISTS options - to save on extra initialization in lex_start(). - Add some wrappers, to avoid direct use of lex->create_info in the - caller code processing DROP statements (which might look confusing). - */ - bool tmp_table() const { return create_info.tmp_table(); } - bool if_exists() const { return create_info.if_exists(); } - - /* - Run specified phases for derived tables/views in the given list - - @param table_list - list of derived tables/view to handle - @param phase - phases to process tables/views through - - @details - This method runs phases specified by the 'phases' on derived - tables/views found in the 'table_list' with help of the - TABLE_LIST::handle_derived function. - 'this' is passed as an argument to the TABLE_LIST::handle_derived. - - @return false - ok - @return true - error - */ - bool handle_list_of_derived(TABLE_LIST *table_list, uint phases) - { - for (TABLE_LIST *tl= table_list; tl; tl= tl->next_local) - { - if (tl->is_view_or_derived() && tl->handle_derived(this, phases)) - return true; - } - return false; - } - - SELECT_LEX *exclude_last_select(); - SELECT_LEX *exclude_not_first_select(SELECT_LEX *exclude); - void check_automatic_up(enum sub_select_type type); - bool create_or_alter_view_finalize(THD *thd, Table_ident *table_ident); - bool add_alter_view(THD *thd, uint16 algorithm, enum_view_suid suid, - Table_ident *table_ident); - bool add_create_view(THD *thd, DDL_options_st ddl, - uint16 algorithm, enum_view_suid suid, - Table_ident *table_ident); - bool add_grant_command(THD *thd, const List &columns); - - bool stmt_grant_table(THD *thd, - Grant_privilege *grant, - const Lex_grant_object_name &ident, - privilege_t grant_option); - - bool stmt_revoke_table(THD *thd, - Grant_privilege *grant, - const Lex_grant_object_name &ident); - - bool stmt_grant_sp(THD *thd, - Grant_privilege *grant, - const Lex_grant_object_name &ident, - const Sp_handler &sph, - privilege_t grant_option); - - bool stmt_revoke_sp(THD *thd, - Grant_privilege *grant, - const Lex_grant_object_name &ident, - const Sp_handler &sph); - - bool stmt_grant_proxy(THD *thd, LEX_USER *user, privilege_t grant_option); - bool stmt_revoke_proxy(THD *thd, LEX_USER *user); - - Vers_parse_info &vers_get_info() - { - return create_info.vers_info; - } - - int add_period(Lex_ident name, Lex_ident_sys_st start, Lex_ident_sys_st end) - { - Table_period_info &info= create_info.period_info; - - if (check_exists && info.name.streq(name)) - return 0; - - if (info.is_set()) - { - my_error(ER_MORE_THAN_ONE_PERIOD, MYF(0)); - return 1; - } - info.set_period(start, end); - info.name= name; - - info.constr= new Virtual_column_info(); - info.constr->expr= lt_creator.create(thd, - create_item_ident_nosp(thd, &start), - create_item_ident_nosp(thd, &end)); - add_constraint(null_clex_str, info.constr, false); - return 0; - } - - sp_package *get_sp_package() const; - - /** - Check if the select is a simple select (not an union). - @retval - 0 ok - @retval - 1 error ; In this case the error messege is sent to the client - */ - bool check_simple_select(const LEX_CSTRING *option) - { - if (current_select != &builtin_select) - { - char command[80]; - strmake(command, option->str, MY_MIN(option->length, sizeof(command)-1)); - my_error(ER_CANT_USE_OPTION_HERE, MYF(0), command); - return true; - } - return false; - } - - void tvc_start() - { - field_list.empty(); - many_values.empty(); - insert_list= 0; - } - - SELECT_LEX_UNIT *alloc_unit(); - SELECT_LEX *alloc_select(bool is_select); - SELECT_LEX_UNIT *create_unit(SELECT_LEX*); - SELECT_LEX *wrap_unit_into_derived(SELECT_LEX_UNIT *unit); - SELECT_LEX *wrap_select_chain_into_derived(SELECT_LEX *sel); - void init_select() - { - current_select->init_select(); - wild= 0; - exchange= 0; - } - bool main_select_push(bool service= false); - bool insert_select_hack(SELECT_LEX *sel); - SELECT_LEX *create_priority_nest(SELECT_LEX *first_in_nest); - - bool set_main_unit(st_select_lex_unit *u) - { - unit.options= u->options; - unit.uncacheable= u->uncacheable; - unit.register_select_chain(u->first_select()); - unit.first_select()->options|= builtin_select.options; - unit.fake_select_lex= u->fake_select_lex; - unit.union_distinct= u->union_distinct; - unit.set_with_clause(u->with_clause); - builtin_select.exclude_from_global(); - return false; - } - bool check_main_unit_semantics(); - - SELECT_LEX_UNIT *parsed_select_expr_start(SELECT_LEX *s1, SELECT_LEX *s2, - enum sub_select_type unit_type, - bool distinct); - SELECT_LEX_UNIT *parsed_select_expr_cont(SELECT_LEX_UNIT *unit, - SELECT_LEX *s2, - enum sub_select_type unit_type, - bool distinct, bool oracle); - bool parsed_multi_operand_query_expression_body(SELECT_LEX_UNIT *unit); - SELECT_LEX_UNIT *add_tail_to_query_expression_body(SELECT_LEX_UNIT *unit, - Lex_order_limit_lock *l); - SELECT_LEX_UNIT * - add_tail_to_query_expression_body_ext_parens(SELECT_LEX_UNIT *unit, - Lex_order_limit_lock *l); - SELECT_LEX_UNIT *parsed_body_ext_parens_primary(SELECT_LEX_UNIT *unit, - SELECT_LEX *primary, - enum sub_select_type unit_type, - bool distinct); - SELECT_LEX_UNIT * - add_primary_to_query_expression_body(SELECT_LEX_UNIT *unit, - SELECT_LEX *sel, - enum sub_select_type unit_type, - bool distinct, - bool oracle); - SELECT_LEX_UNIT * - add_primary_to_query_expression_body(SELECT_LEX_UNIT *unit, - SELECT_LEX *sel, - enum sub_select_type unit_type, - bool distinct); - SELECT_LEX_UNIT * - add_primary_to_query_expression_body_ext_parens( - SELECT_LEX_UNIT *unit, - SELECT_LEX *sel, - enum sub_select_type unit_type, - bool distinct); - SELECT_LEX *parsed_subselect(SELECT_LEX_UNIT *unit); - bool parsed_insert_select(SELECT_LEX *firs_select); - bool parsed_TVC_start(); - SELECT_LEX *parsed_TVC_end(); - TABLE_LIST *parsed_derived_table(SELECT_LEX_UNIT *unit, - int for_system_time, - LEX_CSTRING *alias); - bool parsed_create_view(SELECT_LEX_UNIT *unit, int check); - bool select_finalize(st_select_lex_unit *expr); - bool select_finalize(st_select_lex_unit *expr, Lex_select_lock l); - void relink_hack(st_select_lex *select_lex); - - bool stmt_install_plugin(const DDL_options_st &opt, - const Lex_ident_sys_st &name, - const LEX_CSTRING &soname); - void stmt_install_plugin(const LEX_CSTRING &soname); - - bool stmt_uninstall_plugin_by_name(const DDL_options_st &opt, - const Lex_ident_sys_st &name); - bool stmt_uninstall_plugin_by_soname(const DDL_options_st &opt, - const LEX_CSTRING &soname); - bool stmt_prepare_validate(const char *stmt_type); - bool stmt_prepare(const Lex_ident_sys_st &ident, Item *code); - bool stmt_execute(const Lex_ident_sys_st &ident, List *params); - bool stmt_execute_immediate(Item *code, List *params); - void stmt_deallocate_prepare(const Lex_ident_sys_st &ident); - - bool stmt_alter_table_exchange_partition(Table_ident *table); - - void stmt_purge_to(const LEX_CSTRING &to); - bool stmt_purge_before(Item *item); - - SELECT_LEX *returning() - { return &builtin_select; } - bool has_returning() - { return !builtin_select.item_list.is_empty(); } - -private: - bool stmt_create_routine_start(const DDL_options_st &options) - { - create_info.set(options); - return main_select_push() || check_create_options(options); - } -public: - bool stmt_create_function_start(const DDL_options_st &options) - { - sql_command= SQLCOM_CREATE_SPFUNCTION; - return stmt_create_routine_start(options); - } - bool stmt_create_procedure_start(const DDL_options_st &options) - { - sql_command= SQLCOM_CREATE_PROCEDURE; - return stmt_create_routine_start(options); - } - void stmt_create_routine_finalize() - { - pop_select(); // main select - } - - bool stmt_create_stored_function_start(const DDL_options_st &options, - enum_sp_aggregate_type, - const sp_name *name); - bool stmt_create_stored_function_finalize_standalone(const sp_name *end_name); - - bool stmt_create_udf_function(const DDL_options_st &options, - enum_sp_aggregate_type agg_type, - const Lex_ident_sys_st &name, - Item_result return_type, - const LEX_CSTRING &soname); - - bool stmt_drop_function(const DDL_options_st &options, - const Lex_ident_sys_st &db, - const Lex_ident_sys_st &name); - - bool stmt_drop_function(const DDL_options_st &options, - const Lex_ident_sys_st &name); - - bool stmt_drop_procedure(const DDL_options_st &options, - sp_name *name); - - bool stmt_alter_function_start(sp_name *name); - bool stmt_alter_procedure_start(sp_name *name); - - sp_condition_value *stmt_signal_value(const Lex_ident_sys_st &ident); - - Spvar_definition *row_field_name(THD *thd, const Lex_ident_sys_st &name); - - bool set_field_type_udt(Lex_field_type_st *type, - const LEX_CSTRING &name, - const Lex_length_and_dec_st &attr); - bool set_cast_type_udt(Lex_cast_type_st *type, - const LEX_CSTRING &name); - - bool map_data_type(const Lex_ident_sys_st &schema, - Lex_field_type_st *type) const; - - void mark_first_table_as_inserting(); - - bool fields_are_impossible() - { - // no select or it is last select with no tables (service select) - return !select_stack_head() || - (select_stack_top == 1 && - select_stack[0]->is_service_select); - } - - bool add_table_foreign_key(const LEX_CSTRING *name, - const LEX_CSTRING *constraint_name, - Table_ident *table_name, - DDL_options ddl_options); - bool add_column_foreign_key(const LEX_CSTRING *name, - const LEX_CSTRING *constraint_name, - Table_ident *ref_table_name, - DDL_options ddl_options); -}; - - -/** - Set_signal_information is a container used in the parsed tree to represent - the collection of assignments to condition items in the SIGNAL and RESIGNAL - statements. -*/ -class Set_signal_information -{ -public: - /** Empty default constructor, use clear() */ - Set_signal_information() {} - - /** Copy constructor. */ - Set_signal_information(const Set_signal_information& set); - - /** Destructor. */ - ~Set_signal_information() - {} - - /** Clear all items. */ - void clear(); - - /** - For each condition item assignment, m_item[] contains the parsed tree - that represents the expression assigned, if any. - m_item[] is an array indexed by Diag_condition_item_name. - */ - Item *m_item[LAST_DIAG_SET_PROPERTY+1]; -}; - - -/** - The internal state of the syntax parser. - This object is only available during parsing, - and is private to the syntax parser implementation (sql_yacc.yy). -*/ -class Yacc_state -{ -public: - Yacc_state() : yacc_yyss(NULL), yacc_yyvs(NULL) { reset(); } - - void reset() - { - if (yacc_yyss != NULL) { - my_free(yacc_yyss); - yacc_yyss = NULL; - } - if (yacc_yyvs != NULL) { - my_free(yacc_yyvs); - yacc_yyvs = NULL; - } - m_set_signal_info.clear(); - m_lock_type= TL_READ_DEFAULT; - m_mdl_type= MDL_SHARED_READ; - } - - ~Yacc_state(); - - /** - Reset part of the state which needs resetting before parsing - substatement. - */ - void reset_before_substatement() - { - m_lock_type= TL_READ_DEFAULT; - m_mdl_type= MDL_SHARED_READ; - } - - /** - Bison internal state stack, yyss, when dynamically allocated using - my_yyoverflow(). - */ - uchar *yacc_yyss; - - /** - Bison internal semantic value stack, yyvs, when dynamically allocated using - my_yyoverflow(). - */ - uchar *yacc_yyvs; - - /** - Fragments of parsed tree, - used during the parsing of SIGNAL and RESIGNAL. - */ - Set_signal_information m_set_signal_info; - - /** - Type of lock to be used for tables being added to the statement's - table list in table_factor, table_alias_ref, single_multi and - table_wild_one rules. - Statements which use these rules but require lock type different - from one specified by this member have to override it by using - st_select_lex::set_lock_for_tables() method. - - The default value of this member is TL_READ_DEFAULT. The only two - cases in which we change it are: - - When parsing SELECT HIGH_PRIORITY. - - Rule for DELETE. In which we use this member to pass information - about type of lock from delete to single_multi part of rule. - - We should try to avoid introducing new use cases as we would like - to get rid of this member eventually. - */ - thr_lock_type m_lock_type; - - /** - The type of requested metadata lock for tables added to - the statement table list. - */ - enum_mdl_type m_mdl_type; - - /* - TODO: move more attributes from the LEX structure here. - */ -}; - -/** - Internal state of the parser. - The complete state consist of: - - state data used during lexical parsing, - - state data used during syntactic parsing. -*/ -class Parser_state -{ -public: - Parser_state() - : m_yacc() - {} - - /** - Object initializer. Must be called before usage. - - @retval FALSE OK - @retval TRUE Error - */ - bool init(THD *thd, char *buff, size_t length) - { - return m_lip.init(thd, buff, length); - } - - ~Parser_state() - {} - - Lex_input_stream m_lip; - Yacc_state m_yacc; - - /** - Current performance digest instrumentation. - */ - PSI_digest_locker* m_digest_psi; - - void reset(char *found_semicolon, unsigned int length) - { - m_lip.reset(found_semicolon, length); - m_yacc.reset(); - } -}; - - -extern sql_digest_state * -digest_add_token(sql_digest_state *state, uint token, LEX_YYSTYPE yylval); - -extern sql_digest_state * -digest_reduce_token(sql_digest_state *state, uint token_left, uint token_right); - -struct st_lex_local: public LEX, public Sql_alloc -{ -}; - - -/** - An st_lex_local extension with automatic initialization for SP purposes. - Used to parse sub-expressions and SP sub-statements. - - This class is reused for: - 1. sp_head::reset_lex() based constructs - - SP variable assignments (e.g. SET x=10;) - - FOR loop conditions and index variable increments - - Cursor statements - - SP statements - - SP function RETURN statements - - CASE statements - - REPEAT..UNTIL expressions - - WHILE expressions - - EXIT..WHEN and CONTINUE..WHEN statements - 2. sp_assignment_lex based constructs: - - CURSOR parameter assignments -*/ -class sp_lex_local: public st_lex_local -{ -public: - sp_lex_local(THD *thd, const LEX *oldlex) - { - /* Reset most stuff. */ - start(thd); - /* Keep the parent SP stuff */ - sphead= oldlex->sphead; - spcont= oldlex->spcont; - /* Keep the parent trigger stuff too */ - trg_chistics= oldlex->trg_chistics; - trg_table_fields.empty(); - sp_lex_in_use= false; - } -}; - - -class sp_lex_set_var: public sp_lex_local -{ -public: - sp_lex_set_var(THD *thd, const LEX *oldlex) - :sp_lex_local(thd, oldlex) - { - // Set new LEX as if we at start of set rule - init_select(); - sql_command= SQLCOM_SET_OPTION; - var_list.empty(); - autocommit= 0; - option_type= oldlex->option_type; // Inherit from the outer lex - } -}; - - -class sp_expr_lex: public sp_lex_local -{ - Item *m_item; // The expression -public: - sp_expr_lex(THD *thd, LEX *oldlex) - :sp_lex_local(thd, oldlex), - m_item(NULL) - { } - void set_item(Item *item) - { - m_item= item; - } - Item *get_item() const - { - return m_item; - } - bool sp_continue_when_statement(THD *thd); - bool sp_continue_when_statement(THD *thd, const LEX_CSTRING *label_name); - int case_stmt_action_expr(); - int case_stmt_action_when(bool simple); - bool sp_while_loop_expression(THD *thd) - { - return LEX::sp_while_loop_expression(thd, get_item()); - } - bool sp_repeat_loop_finalize(THD *thd); - bool sp_if_expr(THD *thd); -}; - - -/** - An assignment specific LEX, which additionally has an Item (an expression) - and an associated with the Item free_list, which is usually freed - after the expression is calculated. - - Note, consider changing some of sp_lex_local to sp_assignment_lex, - as the latter allows to use a simpler grammar in sql_yacc.yy (IMO). - - If the expression is simple (e.g. does not have function calls), - then m_item and m_free_list point to the same Item. - - If the expressions is complex (e.g. have function calls), - then m_item points to the leftmost Item, while m_free_list points - to the rightmost item. - For example: - f1(COALESCE(f2(10), f2(20))) - - m_item points to Item_func_sp for f1 (the leftmost Item) - - m_free_list points to Item_int for 20 (the rightmost Item) - - Note, we could avoid storing m_item at all, as we can always reach - the leftmost item from the rightmost item by iterating through m_free_list. - But with a separate m_item the code should be faster. -*/ -class sp_assignment_lex: public sp_lex_local -{ - Item *m_item; // The expression - Item *m_free_list; // The associated free_list (sub-expressions) -public: - sp_assignment_lex(THD *thd, LEX *oldlex) - :sp_lex_local(thd, oldlex), - m_item(NULL), - m_free_list(NULL) - { } - void set_item_and_free_list(Item *item, Item *free_list) - { - m_item= item; - m_free_list= free_list; - } - Item *get_item() const - { - return m_item; - } - Item *get_free_list() const - { - return m_free_list; - } -}; - - -extern void lex_init(void); -extern void lex_free(void); -extern void lex_start(THD *thd); -extern void lex_end(LEX *lex); -extern void lex_end_stage1(LEX *lex); -extern void lex_end_stage2(LEX *lex); -void end_lex_with_single_table(THD *thd, TABLE *table, LEX *old_lex); -int init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex); -extern int MYSQLlex(union YYSTYPE *yylval, THD *thd); -extern int ORAlex(union YYSTYPE *yylval, THD *thd); - -extern void trim_whitespace(CHARSET_INFO *cs, LEX_CSTRING *str, size_t * prefix_length = 0); - -extern bool is_lex_native_function(const LEX_CSTRING *name); -extern bool is_native_function(THD *thd, const LEX_CSTRING *name); -extern bool is_native_function_with_warn(THD *thd, const LEX_CSTRING *name); - -/** - @} (End of group Semantic_Analysis) -*/ - -void my_missing_function_error(const LEX_CSTRING &token, const char *name); -bool is_keyword(const char *name, uint len); -int set_statement_var_if_exists(THD *thd, const char *var_name, - size_t var_name_length, ulonglong value); - -Virtual_column_info *add_virtual_expression(THD *thd, Item *expr); -Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal, - Item *expr); - -bool sp_create_assignment_lex(THD *thd, const char *pos); -bool sp_create_assignment_instr(THD *thd, bool no_lookahead, - bool need_set_keyword= true); - -void mark_or_conds_to_avoid_pushdown(Item *cond); - -#endif /* MYSQL_SERVER */ -#endif /* SQL_LEX_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_lifo_buffer.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_lifo_buffer.h deleted file mode 100644 index 0347030..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_lifo_buffer.h +++ /dev/null @@ -1,359 +0,0 @@ -/* - Copyright (c) 2010, 2011, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @defgroup Bi-directional LIFO buffers used by DS-MRR implementation - @{ -*/ - -class Forward_lifo_buffer; -class Backward_lifo_buffer; - - -/* - A base class for in-memory buffer used by DS-MRR implementation. Common - properties: - - The buffer is last-in-first-out, i.e. elements that are written last are - read first. - - The buffer contains fixed-size elements. The elements are either atomic - byte sequences or pairs of them. - - The buffer resides in the memory provided by the user. It is possible to - = dynamically (ie. between write operations) add ajacent memory space to - the buffer - = dynamically remove unused space from the buffer. - The intent of this is to allow to have two buffers on adjacent memory - space, one is being read from (and so its space shrinks), while the other - is being written to (and so it needs more and more space). - - There are two concrete classes, Forward_lifo_buffer and Backward_lifo_buffer. -*/ - -class Lifo_buffer -{ -protected: - size_t size1; - size_t size2; - -public: - /** - write() will put into buffer size1 bytes pointed by write_ptr1. If - size2!=0, then they will be accompanied by size2 bytes pointed by - write_ptr2. - */ - uchar *write_ptr1; - uchar *write_ptr2; - - /** - read() will do reading by storing pointers to read data into read_ptr1 or - into (read_ptr1, read_ptr2), depending on whether the buffer was set to - store single objects or pairs. - */ - uchar *read_ptr1; - uchar *read_ptr2; - -protected: - uchar *start; /**< points to start of buffer space */ - uchar *end; /**< points to just beyond the end of buffer space */ -public: - - enum enum_direction { - BACKWARD=-1, /**< buffer is filled/read from bigger to smaller memory addresses */ - FORWARD=1 /**< buffer is filled/read from smaller to bigger memory addresses */ - }; - - virtual enum_direction type() = 0; - - /* Buffer space control functions */ - - /** Let the buffer store data in the given space. */ - void set_buffer_space(uchar *start_arg, uchar *end_arg) - { - start= start_arg; - end= end_arg; - if (end != start) - TRASH_ALLOC(start, size_t(end - start)); - reset(); - } - - /** - Specify where write() should get the source data from, as well as source - data size. - */ - void setup_writing(size_t len1, size_t len2) - { - size1= len1; - size2= len2; - } - - /** - Specify where read() should store pointers to read data, as well as read - data size. The sizes must match those passed to setup_writing(). - */ - void setup_reading(size_t len1, size_t len2) - { - DBUG_ASSERT(len1 == size1); - DBUG_ASSERT(len2 == size2); - } - - bool can_write() - { - return have_space_for(size1 + size2); - } - virtual void write() = 0; - - bool is_empty() { return used_size() == 0; } - virtual bool read() = 0; - - void sort(qsort2_cmp cmp_func, void *cmp_func_arg) - { - size_t elem_size= size1 + size2; - size_t n_elements= used_size() / elem_size; - my_qsort2(used_area(), n_elements, elem_size, cmp_func, cmp_func_arg); - } - - virtual void reset() = 0; - virtual uchar *end_of_space() = 0; -protected: - virtual size_t used_size() = 0; - - /* To be used only by iterator class: */ - virtual uchar *get_pos()= 0; - virtual bool read(uchar **position, uchar **ptr1, uchar **ptr2)= 0; - friend class Lifo_buffer_iterator; -public: - virtual bool have_space_for(size_t bytes) = 0; - - virtual void remove_unused_space(uchar **unused_start, uchar **unused_end)=0; - virtual uchar *used_area() = 0; - virtual ~Lifo_buffer() {}; -}; - - -/** - Forward LIFO buffer - - The buffer that is being written to from start to end and read in the - reverse. 'pos' points to just beyond the end of used space. - - It is possible to grow/shink the buffer at the end bound - - used space unused space - *==============*-----------------* - ^ ^ ^ - | | +--- end - | +---- pos - +--- start -*/ - -class Forward_lifo_buffer: public Lifo_buffer -{ - uchar *pos; -public: - enum_direction type() { return FORWARD; } - size_t used_size() - { - return (size_t)(pos - start); - } - void reset() - { - pos= start; - } - uchar *end_of_space() { return pos; } - bool have_space_for(size_t bytes) - { - return (pos + bytes < end); - } - - void write() - { - write_bytes(write_ptr1, size1); - if (size2) - write_bytes(write_ptr2, size2); - } - void write_bytes(const uchar *data, size_t bytes) - { - DBUG_ASSERT(have_space_for(bytes)); - memcpy(pos, data, bytes); - pos += bytes; - } - bool have_data(uchar *position, size_t bytes) - { - return ((position - start) >= (ptrdiff_t)bytes); - } - uchar *read_bytes(uchar **position, size_t bytes) - { - DBUG_ASSERT(have_data(*position, bytes)); - *position= (*position) - bytes; - return *position; - } - bool read() { return read(&pos, &read_ptr1, &read_ptr2); } - bool read(uchar **position, uchar **ptr1, uchar **ptr2) - { - if (!have_data(*position, size1 + size2)) - return TRUE; - if (size2) - *ptr2= read_bytes(position, size2); - *ptr1= read_bytes(position, size1); - return FALSE; - } - void remove_unused_space(uchar **unused_start, uchar **unused_end) - { - DBUG_ASSERT(0); /* Don't need this yet */ - } - /** - Add more space to the buffer. The caller is responsible that the space - being added is adjacent to the end of the buffer. - - @param unused_start Start of space - @param unused_end End of space - */ - void grow(uchar *unused_start, uchar *unused_end) - { - DBUG_ASSERT(unused_end >= unused_start); - DBUG_ASSERT(end == unused_start); - TRASH_ALLOC(unused_start, size_t(unused_end - unused_start)); - end= unused_end; - } - /* Return pointer to start of the memory area that is occupied by the data */ - uchar *used_area() { return start; } - friend class Lifo_buffer_iterator; - uchar *get_pos() { return pos; } -}; - - - -/** - Backward LIFO buffer - - The buffer that is being written to from start to end and read in the - reverse. 'pos' points to the start of used space. - - It is possible to grow/shink the buffer at the start. - - unused space used space - *--------------*=================* - ^ ^ ^ - | | +--- end - | +---- pos - +--- start -*/ -class Backward_lifo_buffer: public Lifo_buffer -{ - uchar *pos; -public: - enum_direction type() { return BACKWARD; } - - size_t used_size() - { - return (size_t)(end - pos); - } - void reset() - { - pos= end; - } - uchar *end_of_space() { return end; } - bool have_space_for(size_t bytes) - { - return (pos - bytes >= start); - } - void write() - { - if (write_ptr2) - write_bytes(write_ptr2, size2); - write_bytes(write_ptr1, size1); - } - void write_bytes(const uchar *data, size_t bytes) - { - DBUG_ASSERT(have_space_for(bytes)); - pos -= bytes; - memcpy(pos, data, bytes); - } - bool read() - { - return read(&pos, &read_ptr1, &read_ptr2); - } - bool read(uchar **position, uchar **ptr1, uchar **ptr2) - { - if (!have_data(*position, size1 + size2)) - return TRUE; - *ptr1= read_bytes(position, size1); - if (size2) - *ptr2= read_bytes(position, size2); - return FALSE; - } - bool have_data(uchar *position, size_t bytes) - { - return ((end - position) >= (ptrdiff_t)bytes); - } - uchar *read_bytes(uchar **position, size_t bytes) - { - DBUG_ASSERT(have_data(*position, bytes)); - uchar *ret= *position; - *position= *position + bytes; - return ret; - } - /** - Stop using/return the unused part of the space - @param unused_start OUT Start of the unused space - @param unused_end OUT End of the unused space - */ - void remove_unused_space(uchar **unused_start, uchar **unused_end) - { - *unused_start= start; - *unused_end= pos; - start= pos; - } - void grow(uchar *unused_start, uchar *unused_end) - { - DBUG_ASSERT(0); /* Not used for backward buffers */ - } - /* Return pointer to start of the memory area that is occupied by the data */ - uchar *used_area() { return pos; } - friend class Lifo_buffer_iterator; - uchar *get_pos() { return pos; } -}; - - -/** Iterator to walk over contents of the buffer without reading from it */ -class Lifo_buffer_iterator -{ - uchar *pos; - Lifo_buffer *buf; - -public: - /* The data is read to here */ - uchar *read_ptr1; - uchar *read_ptr2; - - void init(Lifo_buffer *buf_arg) - { - buf= buf_arg; - pos= buf->get_pos(); - } - /* - Read the next value. The calling convention is the same as buf->read() - has. - - @retval FALSE - ok - @retval TRUE - EOF, reached the end of the buffer - */ - bool read() - { - return buf->read(&pos, &read_ptr1, &read_ptr2); - } -}; - - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_limit.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_limit.h deleted file mode 100644 index a4fceda..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_limit.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef INCLUDES_MARIADB_SQL_LIMIT_H -#define INCLUDES_MARIADB_SQL_LIMIT_H -/** - LIMIT/OFFSET parameters for execution. -*/ - -class Select_limit_counters -{ - ha_rows select_limit_cnt, offset_limit_cnt; - - public: - Select_limit_counters(): - select_limit_cnt(0), offset_limit_cnt(0) - {}; - Select_limit_counters(Select_limit_counters &orig): - select_limit_cnt(orig.select_limit_cnt), - offset_limit_cnt(orig.offset_limit_cnt) - {}; - - void set_limit(ha_rows limit, ha_rows offset) - { - offset_limit_cnt= offset; - select_limit_cnt= limit; - if (select_limit_cnt + offset_limit_cnt >= - select_limit_cnt) - select_limit_cnt+= offset_limit_cnt; - else - select_limit_cnt= HA_POS_ERROR; - } - - void set_single_row() - { - offset_limit_cnt= 0; - select_limit_cnt= 1; - } - - bool is_unlimited() - { return select_limit_cnt == HA_POS_ERROR; } - bool is_unrestricted() - { return select_limit_cnt == HA_POS_ERROR && offset_limit_cnt == 0; } - void set_unlimited() - { select_limit_cnt= HA_POS_ERROR; offset_limit_cnt= 0; } - - bool check_offset(ha_rows sent) - { - return sent < offset_limit_cnt; - } - void remove_offset() { offset_limit_cnt= 0; } - - ha_rows get_select_limit() - { return select_limit_cnt; } - ha_rows get_offset_limit() - { return offset_limit_cnt; } -}; - -#endif // INCLUDES_MARIADB_SQL_LIMIT_H diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_list.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_list.h deleted file mode 100644 index 91134bc..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_list.h +++ /dev/null @@ -1,875 +0,0 @@ -#ifndef INCLUDES_MYSQL_SQL_LIST_H -#define INCLUDES_MYSQL_SQL_LIST_H -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_alloc.h" -#include - -/** - Simple intrusive linked list. - - @remark Similar in nature to base_list, but intrusive. It keeps a - a pointer to the first element in the list and a indirect - reference to the last element. -*/ - -template -class SQL_I_List :public Sql_alloc -{ -public: - uint elements; - /** The first element in the list. */ - T *first; - /** A reference to the next element in the list. */ - T **next; - - SQL_I_List() { empty(); } - - SQL_I_List(const SQL_I_List &tmp) : Sql_alloc() - { - elements= tmp.elements; - first= tmp.first; - next= elements ? tmp.next : &first; - } - - SQL_I_List& operator=(const SQL_I_List &tmp) - { - elements= tmp.elements; - first= tmp.first; - next= tmp.next; - return *this; - } - - inline void empty() - { - elements= 0; - first= NULL; - next= &first; - } - - inline void link_in_list(T *element, T **next_ptr) - { - elements++; - (*next)= element; - next= next_ptr; - *next= NULL; - } - - inline void save_and_clear(SQL_I_List *save) - { - *save= *this; - empty(); - } - - inline void push_front(SQL_I_List *save) - { - /* link current list last */ - *save->next= first; - first= save->first; - elements+= save->elements; - } - - inline void push_back(SQL_I_List *save) - { - if (save->first) - { - *next= save->first; - next= save->next; - elements+= save->elements; - } - } -}; - - -/* - Basic single linked list - Used for item and item_buffs. - All list ends with a pointer to the 'end_of_list' element, which - data pointer is a null pointer and the next pointer points to itself. - This makes it very fast to traverse lists as we don't have to - test for a specialend condition for list that can't contain a null - pointer. -*/ - - -/** - list_node - a node of a single-linked list. - @note We never call a destructor for instances of this class. -*/ - -struct list_node :public Sql_alloc -{ - list_node *next; - void *info; - list_node(void *info_par,list_node *next_par) - :next(next_par),info(info_par) - {} - list_node() /* For end_of_list */ - { - info= 0; - next= this; - } -}; - -typedef bool List_eq(void *a, void *b); - -extern MYSQL_PLUGIN_IMPORT list_node end_of_list; - -class base_list :public Sql_alloc -{ -protected: - list_node *first,**last; - -public: - uint elements; - - bool operator==(const base_list &rhs) const - { - return - elements == rhs.elements && - first == rhs.first && - last == rhs.last; - } - base_list& operator=(const base_list &rhs) - { - elements= rhs.elements; - first= rhs.first; - last= elements ? rhs.last : &first; - return *this; - } - - inline void empty() { elements=0; first= &end_of_list; last=&first;} - inline base_list() { empty(); } - /** - This is a shallow copy constructor that implicitly passes the ownership - from the source list to the new instance. The old instance is not - updated, so both objects end up sharing the same nodes. If one of - the instances then adds or removes a node, the other becomes out of - sync ('last' pointer), while still operational. Some old code uses and - relies on this behaviour. This logic is quite tricky: please do not use - it in any new code. - */ - inline base_list(const base_list &tmp) :Sql_alloc() - { - *this= tmp; - } - /** - Construct a deep copy of the argument in memory root mem_root. - The elements themselves are copied by pointer. If you also - need to copy elements by value, you should employ - list_copy_and_replace_each_value after creating a copy. - */ - bool copy(const base_list *rhs, MEM_ROOT *mem_root); - base_list(const base_list &rhs, MEM_ROOT *mem_root) { copy(&rhs, mem_root); } - inline base_list(bool) {} - inline bool push_back(void *info) - { - if (((*last)=new list_node(info, &end_of_list))) - { - last= &(*last)->next; - elements++; - return 0; - } - return 1; - } - inline bool push_back(void *info, MEM_ROOT *mem_root) - { - if (((*last)=new (mem_root) list_node(info, &end_of_list))) - { - last= &(*last)->next; - elements++; - return 0; - } - return 1; - } - bool push_front_impl(list_node *node) - { - if (node) - { - if (last == &first) - last= &node->next; - first=node; - elements++; - return 0; - } - return 1; - } - inline bool push_front(void *info) - { return push_front_impl(new list_node(info, first)); } - inline bool push_front(void *info, MEM_ROOT *mem_root) - { return push_front_impl(new (mem_root) list_node(info,first)); } - void remove(list_node **prev) - { - list_node *node=(*prev)->next; - if (!--elements) - last= &first; - else if (last == &(*prev)->next) - last= prev; - delete *prev; - *prev=node; - } - inline void append(base_list *list) - { - if (!list->is_empty()) - { - if (is_empty()) - { - *this= *list; - return; - } - *last= list->first; - last= list->last; - elements+= list->elements; - } - } - inline void *pop(void) - { - if (first == &end_of_list) return 0; - list_node *tmp=first; - first=first->next; - if (!--elements) - last= &first; - return tmp->info; - } - - /* - Remove from this list elements that are contained in the passed list. - We assume that the passed list is a tail of this list (that is, the whole - list_node* elements are shared). - */ - inline void disjoin(const base_list *list) - { - list_node **prev= &first; - list_node *node= first; - list_node *list_first= list->first; - elements=0; - while (node != &end_of_list && node != list_first) - { - prev= &node->next; - node= node->next; - elements++; - if (node == &end_of_list) - return; - } - *prev= &end_of_list; - last= prev; - } - inline void prepend(base_list *list) - { - if (!list->is_empty()) - { - if (is_empty()) - last= list->last; - *list->last= first; - first= list->first; - elements+= list->elements; - } - } - /** - Swap two lists. - */ - inline void swap(base_list &rhs) - { - list_node **rhs_last=rhs.last; - swap_variables(list_node *, first, rhs.first); - swap_variables(uint, elements, rhs.elements); - rhs.last= last == &first ? &rhs.first : last; - last = rhs_last == &rhs.first ? &first : rhs_last; - } - - inline list_node* last_node() { return *last; } - inline list_node* first_node() { return first;} - inline void *head() { return first->info; } - inline void **head_ref() { return first != &end_of_list ? &first->info : 0; } - inline bool is_empty() { return first == &end_of_list ; } - inline list_node *last_ref() { return &end_of_list; } - inline bool add_unique(void *info, List_eq *eq) - { - list_node *node= first; - for (; - node != &end_of_list && (!(*eq)(node->info, info)); - node= node->next) ; - if (node == &end_of_list) - return push_back(info); - return 1; - } - friend class base_list_iterator; - friend class error_list; - friend class error_list_iterator; - - /* - Return N-th element in the list, or NULL if the list has - less than N elements. - */ - void *elem(uint n) - { - list_node *node= first; - void *data= NULL; - for (uint i= 0; i <= n; i++) - { - if (node == &end_of_list) - { - data= NULL; - break; - } - data= node->info; - node= node->next; - } - return data; - } - -#ifdef LIST_EXTRA_DEBUG - /* - Check list invariants and print results into trace. Invariants are: - - (*last) points to end_of_list - - There are no NULLs in the list. - - base_list::elements is the number of elements in the list. - - SYNOPSIS - check_list() - name Name to print to trace file - - RETURN - 1 The list is Ok. - 0 List invariants are not met. - */ - - bool check_list(const char *name) - { - base_list *list= this; - list_node *node= first; - uint cnt= 0; - - while (node->next != &end_of_list) - { - if (!node->info) - { - DBUG_PRINT("list_invariants",("%s: error: NULL element in the list", - name)); - return FALSE; - } - node= node->next; - cnt++; - } - if (last != &(node->next)) - { - DBUG_PRINT("list_invariants", ("%s: error: wrong last pointer", name)); - return FALSE; - } - if (cnt+1 != elements) - { - DBUG_PRINT("list_invariants", ("%s: error: wrong element count", name)); - return FALSE; - } - DBUG_PRINT("list_invariants", ("%s: list is ok", name)); - return TRUE; - } -#endif // LIST_EXTRA_DEBUG - -protected: - void after(void *info,list_node *node) - { - list_node *new_node=new list_node(info,node->next); - node->next=new_node; - elements++; - if (last == &(node->next)) - last= &new_node->next; - } -}; - - -class base_list_iterator -{ -protected: - base_list *list; - list_node **el,**prev,*current; - void sublist(base_list &ls, uint elm) - { - ls.first= *el; - ls.last= list->last; - ls.elements= elm; - } -public: - base_list_iterator() - :list(0), el(0), prev(0), current(0) - {} - - base_list_iterator(base_list &list_par) - { init(list_par); } - - inline void init(base_list &list_par) - { - list= &list_par; - el= &list_par.first; - prev= 0; - current= 0; - } - - inline void *next(void) - { - prev=el; - current= *el; - el= ¤t->next; - return current->info; - } - /* Get what calling next() would return, without moving the iterator */ - inline void *peek() - { - return (*el)->info; - } - inline void *next_fast(void) - { - list_node *tmp; - tmp= *el; - el= &tmp->next; - return tmp->info; - } - inline void rewind(void) - { - el= &list->first; - } - inline void *replace(void *element) - { // Return old element - void *tmp=current->info; - DBUG_ASSERT(current->info != 0); - current->info=element; - return tmp; - } - void *replace(base_list &new_list) - { - void *ret_value=current->info; - if (!new_list.is_empty()) - { - *new_list.last=current->next; - current->info=new_list.first->info; - current->next=new_list.first->next; - if ((list->last == ¤t->next) && (new_list.elements > 1)) - list->last= new_list.last; - list->elements+=new_list.elements-1; - } - return ret_value; // return old element - } - inline void remove(void) // Remove current - { - list->remove(prev); - el=prev; - current=0; // Safeguard - } - void after(void *element) // Insert element after current - { - list->after(element,current); - current=current->next; - el= ¤t->next; - } - inline void **ref(void) // Get reference pointer - { - return ¤t->info; - } - inline bool is_last(void) - { - return el == &list->last_ref()->next; - } - inline bool at_end() - { - return current == &end_of_list; - } - friend class error_list_iterator; -}; - -template class List :public base_list -{ -public: - inline List() :base_list() {} - inline List(const List &tmp, MEM_ROOT *mem_root) : - base_list(tmp, mem_root) {} - inline bool push_back(T *a) { return base_list::push_back(a); } - inline bool push_back(T *a, MEM_ROOT *mem_root) - { return base_list::push_back((void*) a, mem_root); } - inline bool push_front(T *a) { return base_list::push_front(a); } - inline bool push_front(T *a, MEM_ROOT *mem_root) - { return base_list::push_front((void*) a, mem_root); } - inline T* head() {return (T*) base_list::head(); } - inline T** head_ref() {return (T**) base_list::head_ref(); } - inline T* pop() {return (T*) base_list::pop(); } - inline void append(List *list) { base_list::append(list); } - inline void prepend(List *list) { base_list::prepend(list); } - inline void disjoin(List *list) { base_list::disjoin(list); } - inline bool add_unique(T *a, bool (*eq)(T *a, T *b)) - { return base_list::add_unique(a, (List_eq *)eq); } - inline bool copy(const List *list, MEM_ROOT *root) - { return base_list::copy(list, root); } - void delete_elements(void) - { - list_node *element,*next; - for (element=first; element != &end_of_list; element=next) - { - next=element->next; - delete (T*) element->info; - } - empty(); - } - T *elem(uint n) { return (T*) base_list::elem(n); } - // Create a new list with one element - static List *make(MEM_ROOT *mem_root, T *first) - { - List *res= new (mem_root) List; - return res == NULL || res->push_back(first, mem_root) ? NULL : res; - } - - class Iterator; - using value_type= T; - using iterator= Iterator; - using const_iterator= const Iterator; - - Iterator begin() const { return Iterator(first); } - Iterator end() const { return Iterator(); } - - class Iterator - { - public: - using iterator_category= std::forward_iterator_tag; - using value_type= T; - using difference_type= std::ptrdiff_t; - using pointer= T *; - using reference= T &; - - Iterator(list_node *p= &end_of_list) : node{p} {} - - Iterator &operator++() - { - DBUG_ASSERT(node != &end_of_list); - - node= node->next; - return *this; - } - - T operator++(int) - { - Iterator tmp(*this); - operator++(); - return tmp; - } - - T &operator*() { return *static_cast(node->info); } - T *operator->() { return static_cast(node->info); } - - bool operator==(const typename List::iterator &rhs) - { - return node == rhs.node; - } - - bool operator!=(const typename List::iterator &rhs) - { - return node != rhs.node; - } - - private: - list_node *node{&end_of_list}; - }; -}; - - -template class List_iterator :public base_list_iterator -{ -public: - List_iterator(List &a) : base_list_iterator(a) {} - List_iterator() : base_list_iterator() {} - inline void init(List &a) { base_list_iterator::init(a); } - inline T* operator++(int) { return (T*) base_list_iterator::next(); } - inline T* peek() { return (T*) base_list_iterator::peek(); } - inline T *replace(T *a) { return (T*) base_list_iterator::replace(a); } - inline T *replace(List &a) { return (T*) base_list_iterator::replace(a); } - inline void rewind(void) { base_list_iterator::rewind(); } - inline void remove() { base_list_iterator::remove(); } - inline void after(T *a) { base_list_iterator::after(a); } - inline T** ref(void) { return (T**) base_list_iterator::ref(); } -}; - - -template class List_iterator_fast :public base_list_iterator -{ -protected: - inline T *replace(T *) { return (T*) 0; } - inline T *replace(List &) { return (T*) 0; } - inline void remove(void) {} - inline void after(T *) {} - inline T** ref(void) { return (T**) 0; } - -public: - inline List_iterator_fast(List &a) : base_list_iterator(a) {} - inline List_iterator_fast() : base_list_iterator() {} - inline void init(List &a) { base_list_iterator::init(a); } - inline T* operator++(int) { return (T*) base_list_iterator::next_fast(); } - inline void rewind(void) { base_list_iterator::rewind(); } - void sublist(List &list_arg, uint el_arg) - { - base_list_iterator::sublist(list_arg, el_arg); - } -}; - - -/* - Bubble sort algorithm for List. - This sort function is supposed to be used only for very short list. - Currently it is used for the lists of Item_equal objects and - for some lists in the table elimination algorithms. In both - cases the sorted lists are very short. -*/ - -template -inline void bubble_sort(List *list_to_sort, - int (*sort_func)(T *a, T *b, void *arg), void *arg) -{ - bool swap; - T **ref1= 0; - T **ref2= 0; - List_iterator it(*list_to_sort); - do - { - T **last_ref= ref1; - T *item1= it++; - ref1= it.ref(); - T *item2; - - swap= FALSE; - while ((item2= it++) && (ref2= it.ref()) != last_ref) - { - if (sort_func(item1, item2, arg) > 0) - { - *ref1= item2; - *ref2= item1; - swap= TRUE; - } - else - item1= item2; - ref1= ref2; - } - it.rewind(); - } while (swap); -} - - -/* - A simple intrusive list which automaticly removes element from list - on delete (for THD element) -*/ - -struct ilink -{ - struct ilink **prev,*next; - static void *operator new(size_t size) throw () - { - return (void*)my_malloc(PSI_INSTRUMENT_ME, - (uint)size, MYF(MY_WME | MY_FAE | ME_FATAL)); - } - static void operator delete(void* ptr_arg, size_t) - { - my_free(ptr_arg); - } - - inline ilink() - { - prev=0; next=0; - } - inline void unlink() - { - /* Extra tests because element doesn't have to be linked */ - if (prev) *prev= next; - if (next) next->prev=prev; - prev=0 ; next=0; - } - inline void assert_linked() - { - DBUG_ASSERT(prev != 0 && next != 0); - } - inline void assert_not_linked() - { - DBUG_ASSERT(prev == 0 && next == 0); - } - virtual ~ilink() { unlink(); } /*lint -e1740 */ -}; - - -/* Needed to be able to have an I_List of char* strings in mysqld.cc. */ - -class i_string: public ilink -{ -public: - const char* ptr; - i_string():ptr(0) { } - i_string(const char* s) : ptr(s) {} -}; - -/* needed for linked list of two strings for replicate-rewrite-db */ -class i_string_pair: public ilink -{ -public: - const char* key; - const char* val; - i_string_pair():key(0),val(0) { } - i_string_pair(const char* key_arg, const char* val_arg) : - key(key_arg),val(val_arg) {} -}; - - -template class I_List_iterator; - - -class base_ilist -{ - struct ilink *first; - struct ilink last; -public: - inline void empty() { first= &last; last.prev= &first; } - base_ilist() { empty(); } - inline bool is_empty() { return first == &last; } - // Returns true if p is the last "real" object in the list, - // i.e. p->next points to the sentinel. - inline bool is_last(ilink *p) { return p->next == NULL || p->next == &last; } - inline void append(ilink *a) - { - first->prev= &a->next; - a->next=first; a->prev= &first; first=a; - } - inline void push_back(ilink *a) - { - *last.prev= a; - a->next= &last; - a->prev= last.prev; - last.prev= &a->next; - } - inline struct ilink *get() - { - struct ilink *first_link=first; - if (first_link == &last) - return 0; - first_link->unlink(); // Unlink from list - return first_link; - } - inline struct ilink *head() - { - return (first != &last) ? first : 0; - } - - /** - Moves list elements to new owner, and empties current owner (i.e. this). - - @param[in,out] new_owner The new owner of the list elements. - Should be empty in input. - */ - - void move_elements_to(base_ilist *new_owner) - { - DBUG_ASSERT(new_owner->is_empty()); - new_owner->first= first; - new_owner->last= last; - empty(); - } - - friend class base_ilist_iterator; - private: - /* - We don't want to allow copying of this class, as that would give us - two list heads containing the same elements. - So we declare, but don't define copy CTOR and assignment operator. - */ - base_ilist(const base_ilist&); - void operator=(const base_ilist&); -}; - - -class base_ilist_iterator -{ - base_ilist *list; - struct ilink **el,*current; -public: - base_ilist_iterator(base_ilist &list_par) :list(&list_par), - el(&list_par.first),current(0) {} - void *next(void) - { - /* This is coded to allow push_back() while iterating */ - current= *el; - if (current == &list->last) return 0; - el= ¤t->next; - return current; - } -}; - - -template -class I_List :private base_ilist -{ -public: - I_List() :base_ilist() {} - inline bool is_last(T *p) { return base_ilist::is_last(p); } - inline void empty() { base_ilist::empty(); } - inline bool is_empty() { return base_ilist::is_empty(); } - inline void append(T* a) { base_ilist::append(a); } - inline void push_back(T* a) { base_ilist::push_back(a); } - inline T* get() { return (T*) base_ilist::get(); } - inline T* head() { return (T*) base_ilist::head(); } - inline void move_elements_to(I_List* new_owner) { - base_ilist::move_elements_to(new_owner); - } -#ifndef _lint - friend class I_List_iterator; -#endif -}; - - -template class I_List_iterator :public base_ilist_iterator -{ -public: - I_List_iterator(I_List &a) : base_ilist_iterator(a) {} - inline T* operator++(int) { return (T*) base_ilist_iterator::next(); } -}; - -/** - Make a deep copy of each list element. - - @note A template function and not a template method of class List - is employed because of explicit template instantiation: - in server code there are explicit instantiations of List and - an explicit instantiation of a template requires that any method - of the instantiated class used in the template can be resolved. - Evidently not all template arguments have clone() method with - the right signature. - - @return You must query the error state in THD for out-of-memory - situation after calling this function. -*/ - -template -inline -void -list_copy_and_replace_each_value(List &list, MEM_ROOT *mem_root) -{ - /* Make a deep copy of each element */ - List_iterator it(list); - T *el; - while ((el= it++)) - it.replace(el->clone(mem_root)); -} - -void free_list(I_List *list); -void free_list(I_List *list); - -#endif // INCLUDES_MYSQL_SQL_LIST_H diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_load.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_load.h deleted file mode 100644 index 8413d27..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_load.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_LOAD_INCLUDED -#define SQL_LOAD_INCLUDED - -#include "sql_list.h" /* List */ - -class Item; - -#include "sql_class.h" /* enum_duplicates */ - -class sql_exchange; - -int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list, - List &fields_vars, List &set_fields, - List &set_values_list, - enum enum_duplicates handle_duplicates, bool ignore, - bool local_file); - - -#endif /* SQL_LOAD_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_locale.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_locale.h deleted file mode 100644 index b7ce9f7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_locale.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_LOCALE_INCLUDED -#define SQL_LOCALE_INCLUDED - -typedef struct my_locale_errmsgs -{ - const char *language; - const char ***errmsgs; -} MY_LOCALE_ERRMSGS; - - -typedef struct st_typelib TYPELIB; - -class MY_LOCALE -{ -public: - uint number; - const char *name; - const char *description; - const bool is_ascii; - TYPELIB *month_names; - TYPELIB *ab_month_names; - TYPELIB *day_names; - TYPELIB *ab_day_names; - uint max_month_name_length; - uint max_day_name_length; - uint decimal_point; - uint thousand_sep; - const char *grouping; - MY_LOCALE_ERRMSGS *errmsgs; - MY_LOCALE(uint number_par, - const char *name_par, const char *descr_par, bool is_ascii_par, - TYPELIB *month_names_par, TYPELIB *ab_month_names_par, - TYPELIB *day_names_par, TYPELIB *ab_day_names_par, - uint max_month_name_length_par, uint max_day_name_length_par, - uint decimal_point_par, uint thousand_sep_par, - const char *grouping_par, MY_LOCALE_ERRMSGS *errmsgs_par) : - number(number_par), - name(name_par), description(descr_par), is_ascii(is_ascii_par), - month_names(month_names_par), ab_month_names(ab_month_names_par), - day_names(day_names_par), ab_day_names(ab_day_names_par), - max_month_name_length(max_month_name_length_par), - max_day_name_length(max_day_name_length_par), - decimal_point(decimal_point_par), - thousand_sep(thousand_sep_par), - grouping(grouping_par), - errmsgs(errmsgs_par) - {} - my_repertoire_t repertoire() const - { return is_ascii ? MY_REPERTOIRE_ASCII : MY_REPERTOIRE_EXTENDED; } -}; -/* Exported variables */ - -extern MY_LOCALE my_locale_en_US; -extern MYSQL_PLUGIN_IMPORT MY_LOCALE *my_locales[]; -extern MY_LOCALE *my_default_lc_messages; -extern MY_LOCALE *my_default_lc_time_names; - -/* Exported functions */ - -MY_LOCALE *my_locale_by_name(const char *name); -MY_LOCALE *my_locale_by_number(uint number); -void cleanup_errmsgs(void); - -#endif /* SQL_LOCALE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_manager.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_manager.h deleted file mode 100644 index 9c6c844..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_manager.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_MANAGER_INCLUDED -#define SQL_MANAGER_INCLUDED - -void start_handle_manager(); -void stop_handle_manager(); -bool mysql_manager_submit(void (*action)()); - -#endif /* SQL_MANAGER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_mode.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_mode.h deleted file mode 100644 index fb2b7ce..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_mode.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef SQL_MODE_H_INCLUDED -#define SQL_MODE_H_INCLUDED -/* - Copyright (c) 2019, MariaDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_basic_types.h" - -/* - class Sql_mode_dependency - - A combination of hard and soft dependency on sql_mode. - Used to watch if a GENERATED ALWAYS AS expression guarantees consitent - data written to its virtual column. - - A virtual column can appear in an index if: - - the generation expression does not depend on any sql_mode flags, or - - the generation expression has a soft dependency on an sql_mode flag, - and the column knows how to handle this dependeny. - - A virtual column cannot appear in an index if: - - its generation expression has a hard dependency - - its generation expression has a soft dependency, but the column - cannot handle it on store. - An error is reported in such cases. - - How dependencies appear: - - When a column return value depends on some sql_mode flag, - its Item_field adds a corresponding bit to m_soft. For example, - Item_field for a CHAR(N) column adds the PAD_CHAR_TO_FULL_LENGTH flag. - - When an SQL function/operator return value depends on some sql_mode flag, - it adds a corresponding bit to m_soft. For example, Item_func_minus - adds the MODE_NO_UNSIGNED_SUBTRACTION in case of unsigned arguments. - - How dependency are processed (see examples below): - - All SQL functions/operators bit-OR all hard dependencies from all arguments. - - Some soft dependencies can be handled by the underlying Field on store, - e.g. CHAR(N) can handle PAD_CHAR_TO_FULL_LENGTH. - - Some soft dependencies can be handled by SQL functions and operators, - e.g. RTRIM(expr) removes expr's soft dependency on PAD_CHAR_TO_FULL_LENGTH. - If a function or operator handles a soft dependency on a certain sql_mode - flag, it removes the corresponding bit from m_soft (see below). - Note, m_hard is not touched in such cases. - - When an expression with a soft dependency on a certain sql_mode flag - goes as an argument to an SQL function/operator which cannot handle - this flag, the dependency escalates from soft to hard - (by moving the corresponding bit from m_soft to m_hard) and cannot be - handled any more on the upper level, neither by a Field on store, - nor by another SQL function/operator. - - There are four kinds of Items: - 1. Items that generate a soft or hard dependency, e.g. - - Item_field for CHAR(N) - generates soft/PAD_CHAR_TO_FULL_LENGTH - - Item_func_minus - generates soft/NO_UNSIGNED_SUBTRACTION - 2. Items that convert a soft dependency to a hard dependency. - This happens e.g. when an Item_func instance gets a soft dependency - from its arguments, and it does not know how to handle this dependency. - Most Item_func descendants do this. - 3. Items that remove soft dependencies, e.g.: - - Item_func_rtrim - removes soft/PAD_CHAR_TO_FULL_LENGTH - that came from args[0] (under certain conditions) - - Item_func_rpad - removes soft/PAD_CJAR_TO_FULL_LENGTH - that came from args[0] (under certain conditions) - 4. Items that repeat soft dependency from its arguments to the caller. - They are not implemented yet. But functions like Item_func_coalesce, - Item_func_case, Item_func_case_abbreviation2 could do this. - - Examples: - - 1. CREATE OR REPLACE TABLE t1 (a CHAR(5), v CHAR(20) AS(a), KEY(v)); - - Here `v` has a soft dependency on `a`. - The value of `a` depends on PAD_CHAR_TO_FULL_LENGTH, it can return: - - 'a' - if PAD_CHAR_TO_FULL_LENGTH is disabled - - 'a' followed by four spaces - if PAD_CHAR_TO_FULL_LENGTH is enabled - But `v` will pad trailing spaces to the full length on store anyway. - So Field_string handles this soft dependency on store. - This combination of the virtial column data type and its generation - expression is safe and provides consistent data in `v`, which is - 'a' followed by four spaces, no matter what PAD_CHAR_TO_FULL_LENGTH is. - - 2. CREATE OR REPLACE TABLE t1 (a CHAR(5), v VARCHAR(20) AS(a), KEY(v)); - - Here `v` has a soft dependency on `a`. But Field_varstring does - not pad spaces on store, so it cannot handle this dependency. - This combination of the virtual column data type and its generation - expression is not safe. An error is returned. - - 3. CREATE OR REPLACE TABLE t1 (a CHAR(5), v INT AS(LENGTH(a)), KEY(v)); - - Here `v` has a hard dependency on `a`, because the value of `a` - is wrapped to the function LENGTH(). - The value of `LENGTH(a)` depends on PAD_CHAR_TO_FULL_LENGTH, it can return: - - 1 - if PAD_CHAR_TO_FULL_LENGTH is disabled - - 4 - if PAD_CHAR_TO_FULL_LENGTH is enabled - This combination cannot provide consistent data stored to `v`, - therefore it's disallowed. -*/ -class Sql_mode_dependency -{ - sql_mode_t m_hard; - sql_mode_t m_soft; -public: - Sql_mode_dependency() - :m_hard(0), m_soft(0) - { } - Sql_mode_dependency(sql_mode_t hard, sql_mode_t soft) - :m_hard(hard), m_soft(soft) - { } - sql_mode_t hard() const { return m_hard; } - sql_mode_t soft() const { return m_soft; } - operator bool () const - { - return m_hard > 0 || m_soft > 0; - } - Sql_mode_dependency operator|(const Sql_mode_dependency &other) const - { - return Sql_mode_dependency(m_hard | other.m_hard, m_soft | other.m_soft); - } - Sql_mode_dependency operator&(const Sql_mode_dependency &other) const - { - return Sql_mode_dependency(m_hard & other.m_hard, m_soft & other.m_soft); - } - Sql_mode_dependency &operator|=(const Sql_mode_dependency &other) - { - m_hard|= other.m_hard; - m_soft|= other.m_soft; - return *this; - } - Sql_mode_dependency &operator&=(const Sql_mode_dependency &other) - { - m_hard&= other.m_hard; - m_soft&= other.m_soft; - return *this; - } - Sql_mode_dependency &soft_to_hard() - { - m_hard|= m_soft; - m_soft= 0; - return *this; - } - void push_dependency_warnings(THD *thd) const; -}; - - -#endif // SQL_MODE_H_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_parse.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_parse.h deleted file mode 100644 index 0e5cc7f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_parse.h +++ /dev/null @@ -1,188 +0,0 @@ -/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_PARSE_INCLUDED -#define SQL_PARSE_INCLUDED - -#include "sql_acl.h" /* GLOBAL_ACLS */ - -class Comp_creator; -class Item; -class Object_creation_ctx; -class Parser_state; -struct TABLE_LIST; -class THD; -class Table_ident; -struct LEX; - -enum enum_mysql_completiontype { - ROLLBACK_RELEASE=-2, ROLLBACK=1, ROLLBACK_AND_CHAIN=7, - COMMIT_RELEASE=-1, COMMIT=0, COMMIT_AND_CHAIN=6 -}; - -extern "C" int path_starts_from_data_home_dir(const char *dir); -int test_if_data_home_dir(const char *dir); -int error_if_data_home_dir(const char *path, const char *what); -my_bool net_allocate_new_packet(NET *net, void *thd, uint my_flags); - -bool multi_update_precheck(THD *thd, TABLE_LIST *tables); -bool multi_delete_precheck(THD *thd, TABLE_LIST *tables); -int mysql_multi_update_prepare(THD *thd); -int mysql_multi_delete_prepare(THD *thd); -int mysql_insert_select_prepare(THD *thd,select_result *sel_res); -bool update_precheck(THD *thd, TABLE_LIST *tables); -bool delete_precheck(THD *thd, TABLE_LIST *tables); -bool insert_precheck(THD *thd, TABLE_LIST *tables); -bool create_table_precheck(THD *thd, TABLE_LIST *tables, - TABLE_LIST *create_table); -bool check_fk_parent_table_access(THD *thd, - HA_CREATE_INFO *create_info, - Alter_info *alter_info, - const char* create_db); - -bool parse_sql(THD *thd, Parser_state *parser_state, - Object_creation_ctx *creation_ctx, bool do_pfs_digest=false); - -void free_items(Item *item); -void cleanup_items(Item *item); - -Comp_creator *comp_eq_creator(bool invert); -Comp_creator *comp_ge_creator(bool invert); -Comp_creator *comp_gt_creator(bool invert); -Comp_creator *comp_le_creator(bool invert); -Comp_creator *comp_lt_creator(bool invert); -Comp_creator *comp_ne_creator(bool invert); - -int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, - enum enum_schema_tables schema_table_idx); -void get_default_definer(THD *thd, LEX_USER *definer, bool role); -LEX_USER *create_default_definer(THD *thd, bool role); -LEX_USER *create_definer(THD *thd, LEX_CSTRING *user_name, LEX_CSTRING *host_name); -LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock=true); -bool sp_process_definer(THD *thd); -bool check_string_byte_length(const LEX_CSTRING *str, uint err_msg, - size_t max_byte_length); -bool check_string_char_length(const LEX_CSTRING *str, uint err_msg, - size_t max_char_length, CHARSET_INFO *cs, - bool no_error); -bool check_ident_length(const LEX_CSTRING *ident); -CHARSET_INFO* merge_charset_and_collation(CHARSET_INFO *cs, CHARSET_INFO *cl); -CHARSET_INFO *find_bin_collation(CHARSET_INFO *cs); -bool check_host_name(LEX_CSTRING *str); -bool check_identifier_name(LEX_CSTRING *str, uint max_char_length, - uint err_code, const char *param_for_err_msg); -bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length); -bool sqlcom_can_generate_row_events(const THD *thd); -bool stmt_causes_implicit_commit(THD *thd, uint mask); -bool is_update_query(enum enum_sql_command command); -bool is_log_table_write_query(enum enum_sql_command command); -bool alloc_query(THD *thd, const char *packet, size_t packet_length); -void mysql_init_select(LEX *lex); -void mysql_parse(THD *thd, char *rawbuf, uint length, - Parser_state *parser_state, bool is_com_multi, - bool is_next_command); -bool mysql_new_select(LEX *lex, bool move_down, SELECT_LEX *sel); -void create_select_for_variable(THD *thd, LEX_CSTRING *var_name); -void create_table_set_open_action_and_adjust_tables(LEX *lex); -void mysql_init_multi_delete(LEX *lex); -bool multi_delete_set_locks_and_link_aux_tables(LEX *lex); -void create_table_set_open_action_and_adjust_tables(LEX *lex); -int bootstrap(MYSQL_FILE *file); -int mysql_execute_command(THD *thd); -bool do_command(THD *thd); -bool dispatch_command(enum enum_server_command command, THD *thd, - char* packet, uint packet_length, - bool is_com_multi, bool is_next_command); -void log_slow_statement(THD *thd); -bool append_file_to_dir(THD *thd, const char **filename_ptr, - const LEX_CSTRING *table_name); -void execute_init_command(THD *thd, LEX_STRING *init_command, - mysql_rwlock_t *var_lock); -bool add_to_list(THD *thd, SQL_I_List &list, Item *group, bool asc); -void add_join_on(THD *thd, TABLE_LIST *b, Item *expr); -void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List *using_fields, - SELECT_LEX *lex); -bool add_proc_to_list(THD *thd, Item *item); -bool push_new_name_resolution_context(THD *thd, - TABLE_LIST *left_op, - TABLE_LIST *right_op); -void init_update_queries(void); -Item *normalize_cond(THD *thd, Item *cond); -Item *negate_expression(THD *thd, Item *expr); -bool check_stack_overrun(THD *thd, long margin, uchar *dummy); - -/* Variables */ - -extern const char* any_db; -extern uint sql_command_flags[]; -extern uint server_command_flags[]; -extern const LEX_CSTRING command_name[]; -extern uint server_command_flags[]; - -/* Inline functions */ -inline bool check_identifier_name(LEX_CSTRING *str, uint err_code) -{ - return check_identifier_name(str, NAME_CHAR_LEN, err_code, ""); -} - -inline bool check_identifier_name(LEX_CSTRING *str) -{ - return check_identifier_name(str, NAME_CHAR_LEN, 0, ""); -} - -#ifndef NO_EMBEDDED_ACCESS_CHECKS -bool check_one_table_access(THD *thd, privilege_t privilege, TABLE_LIST *tables); -bool check_single_table_access(THD *thd, privilege_t privilege, - TABLE_LIST *tables, bool no_errors); -bool check_routine_access(THD *thd, privilege_t want_access, - const LEX_CSTRING *db, - const LEX_CSTRING *name, - const Sp_handler *sph, bool no_errors); -bool check_some_access(THD *thd, privilege_t want_access, TABLE_LIST *table); -bool check_some_routine_access(THD *thd, const char *db, const char *name, - const Sp_handler *sph); -bool check_table_access(THD *thd, privilege_t requirements,TABLE_LIST *tables, - bool any_combination_of_privileges_will_do, - uint number, - bool no_errors); -#else -inline bool check_one_table_access(THD *thd, privilege_t privilege, TABLE_LIST *tables) -{ return false; } -inline bool check_single_table_access(THD *thd, privilege_t privilege, - TABLE_LIST *tables, bool no_errors) -{ return false; } -inline bool check_routine_access(THD *thd, privilege_t want_access, - const LEX_CSTRING *db, - const LEX_CSTRING *name, - const Sp_handler *sph, bool no_errors) -{ return false; } -inline bool check_some_access(THD *thd, privilege_t want_access, TABLE_LIST *table) -{ - table->grant.privilege= want_access; - return false; -} -inline bool check_some_routine_access(THD *thd, const char *db, - const char *name, - const Sp_handler *sph) -{ return false; } -inline bool -check_table_access(THD *thd, privilege_t requirements,TABLE_LIST *tables, - bool any_combination_of_privileges_will_do, - uint number, - bool no_errors) -{ return false; } -#endif /*NO_EMBEDDED_ACCESS_CHECKS*/ - -#endif /* SQL_PARSE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_partition.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_partition.h deleted file mode 100644 index 58ba82d..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_partition.h +++ /dev/null @@ -1,321 +0,0 @@ -#ifndef SQL_PARTITION_INCLUDED -#define SQL_PARTITION_INCLUDED - -/* Copyright (c) 2006, 2017, Oracle and/or its affiliates. - Copyright (c) 2011, 2017, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "sql_list.h" /* List */ -#include "table.h" /* TABLE_LIST */ - -class Alter_info; -class Alter_table_ctx; -class Field; -class String; -class handler; -class partition_info; -struct TABLE; -struct TABLE_LIST; -typedef struct st_bitmap MY_BITMAP; -typedef struct st_key KEY; -typedef struct st_key_range key_range; - -/* Flags for partition handlers */ -#define HA_CAN_PARTITION (1 << 0) /* Partition support */ -#define HA_CAN_UPDATE_PARTITION_KEY (1 << 1) -#define HA_CAN_PARTITION_UNIQUE (1 << 2) -#define HA_USE_AUTO_PARTITION (1 << 3) -#define HA_ONLY_VERS_PARTITION (1 << 4) - -#define NORMAL_PART_NAME 0 -#define TEMP_PART_NAME 1 -#define RENAMED_PART_NAME 2 - -typedef struct st_lock_param_type -{ - TABLE_LIST *table_list; - ulonglong copied; - ulonglong deleted; - THD *thd; - HA_CREATE_INFO *create_info; - Alter_info *alter_info; - TABLE *table; - KEY *key_info_buffer; - LEX_CSTRING db; - LEX_CSTRING table_name; - uchar *pack_frm_data; - uint key_count; - uint db_options; - size_t pack_frm_len; - partition_info *part_info; -} ALTER_PARTITION_PARAM_TYPE; - -typedef struct { - longlong list_value; - uint32 partition_id; -} LIST_PART_ENTRY; - -typedef struct { - uint32 start_part; - uint32 end_part; -} part_id_range; - -class String_list; -struct st_partition_iter; -#define NOT_A_PARTITION_ID UINT_MAX32 - -bool is_partition_in_list(char *part_name, List list_part_names); -char *are_partitions_in_table(partition_info *new_part_info, - partition_info *old_part_info); -bool check_reorganise_list(partition_info *new_part_info, - partition_info *old_part_info, - List list_part_names); -handler *get_ha_partition(partition_info *part_info); -int get_part_for_buf(const uchar *buf, const uchar *rec0, - partition_info *part_info, uint32 *part_id); -void prune_partition_set(const TABLE *table, part_id_range *part_spec); -bool check_partition_info(partition_info *part_info,handlerton **eng_type, - TABLE *table, handler *file, HA_CREATE_INFO *info); -void set_linear_hash_mask(partition_info *part_info, uint num_parts); -bool fix_partition_func(THD *thd, TABLE *table, bool create_table_ind); -void get_partition_set(const TABLE *table, uchar *buf, const uint index, - const key_range *key_spec, - part_id_range *part_spec); -uint get_partition_field_store_length(Field *field); -void get_full_part_id_from_key(const TABLE *table, uchar *buf, - KEY *key_info, - const key_range *key_spec, - part_id_range *part_spec); -bool mysql_unpack_partition(THD *thd, char *part_buf, - uint part_info_len, - TABLE *table, bool is_create_table_ind, - handlerton *default_db_type, - bool *work_part_info_used); -void make_used_partitions_str(MEM_ROOT *mem_root, - partition_info *part_info, String *parts_str, - String_list &used_partitions_list); -uint32 get_list_array_idx_for_endpoint(partition_info *part_info, - bool left_endpoint, - bool include_endpoint); -uint32 get_partition_id_range_for_endpoint(partition_info *part_info, - bool left_endpoint, - bool include_endpoint); -bool check_part_func_fields(Field **ptr, bool ok_with_charsets); -bool field_is_partition_charset(Field *field); -Item* convert_charset_partition_constant(Item *item, CHARSET_INFO *cs); -/** - Append all fields in read_set to string - - @param[in,out] str String to append to. - @param[in] row Row to append. - @param[in] table Table containing read_set and fields for the row. -*/ -void append_row_to_str(String &str, const uchar *row, TABLE *table); -void truncate_partition_filename(char *path); - -/* - A "Get next" function for partition iterator. - - SYNOPSIS - partition_iter_func() - part_iter Partition iterator, you call only "iter.get_next(&iter)" - - DESCRIPTION - Depending on whether partitions or sub-partitions are iterated, the - function returns next subpartition id/partition number. The sequence of - returned numbers is not ordered and may contain duplicates. - - When the end of sequence is reached, NOT_A_PARTITION_ID is returned, and - the iterator resets itself (so next get_next() call will start to - enumerate the set all over again). - - RETURN - NOT_A_PARTITION_ID if there are no more partitions. - [sub]partition_id of the next partition -*/ - -typedef uint32 (*partition_iter_func)(st_partition_iter* part_iter); - - -/* - Partition set iterator. Used to enumerate a set of [sub]partitions - obtained in partition interval analysis (see get_partitions_in_range_iter). - - For the user, the only meaningful field is get_next, which may be used as - follows: - part_iterator.get_next(&part_iterator); - - Initialization is done by any of the following calls: - - get_partitions_in_range_iter-type function call - - init_single_partition_iterator() - - init_all_partitions_iterator() - Cleanup is not needed. -*/ - -typedef struct st_partition_iter -{ - partition_iter_func get_next; - /* - Valid for "Interval mapping" in LIST partitioning: if true, let the - iterator also produce id of the partition that contains NULL value. - */ - bool ret_null_part, ret_null_part_orig; - /* - We should return DEFAULT partition. - */ - bool ret_default_part, ret_default_part_orig; - struct st_part_num_range - { - uint32 start; - uint32 cur; - uint32 end; - }; - - struct st_field_value_range - { - longlong start; - longlong cur; - longlong end; - }; - - union - { - struct st_part_num_range part_nums; - struct st_field_value_range field_vals; - }; - partition_info *part_info; -} PARTITION_ITERATOR; - - -/* - Get an iterator for set of partitions that match given field-space interval - - SYNOPSIS - get_partitions_in_range_iter() - part_info Partitioning info - is_subpart - store_length_array Length of fields packed in opt_range_key format - min_val Left edge, field value in opt_range_key format - max_val Right edge, field value in opt_range_key format - min_len Length of minimum value - max_len Length of maximum value - flags Some combination of NEAR_MIN, NEAR_MAX, NO_MIN_RANGE, - NO_MAX_RANGE - part_iter Iterator structure to be initialized - - DESCRIPTION - Functions with this signature are used to perform "Partitioning Interval - Analysis". This analysis is applicable for any type of [sub]partitioning - by some function of a single fieldX. The idea is as follows: - Given an interval "const1 <=? fieldX <=? const2", find a set of partitions - that may contain records with value of fieldX within the given interval. - - The min_val, max_val and flags parameters specify the interval. - The set of partitions is returned by initializing an iterator in *part_iter - - NOTES - There are currently three functions of this type: - - get_part_iter_for_interval_via_walking - - get_part_iter_for_interval_cols_via_map - - get_part_iter_for_interval_via_mapping - - RETURN - 0 - No matching partitions, iterator not initialized - 1 - Some partitions would match, iterator intialized for traversing them - -1 - All partitions would match, iterator not initialized -*/ - -typedef int (*get_partitions_in_range_iter)(partition_info *part_info, - bool is_subpart, - uint32 *store_length_array, - uchar *min_val, uchar *max_val, - uint min_len, uint max_len, - uint flags, - PARTITION_ITERATOR *part_iter); - -#include "partition_info.h" - -#ifdef WITH_PARTITION_STORAGE_ENGINE -uint fast_alter_partition_table(THD *thd, TABLE *table, - Alter_info *alter_info, - HA_CREATE_INFO *create_info, - TABLE_LIST *table_list, - const LEX_CSTRING *db, - const LEX_CSTRING *table_name); -bool set_part_state(Alter_info *alter_info, partition_info *tab_part_info, - enum partition_state part_state); -uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, - HA_CREATE_INFO *create_info, - bool *partition_changed, - bool *fast_alter_table); -char *generate_partition_syntax(THD *thd, partition_info *part_info, - uint *buf_length, - bool show_partition_options, - HA_CREATE_INFO *create_info, - Alter_info *alter_info); -char *generate_partition_syntax_for_frm(THD *thd, partition_info *part_info, - uint *buf_length, - HA_CREATE_INFO *create_info, - Alter_info *alter_info); -bool verify_data_with_partition(TABLE *table, TABLE *part_table, - uint32 part_id); -bool compare_partition_options(HA_CREATE_INFO *table_create_info, - partition_element *part_elem); -bool partition_key_modified(TABLE *table, const MY_BITMAP *fields); -#else -#define partition_key_modified(X,Y) 0 -#endif - -int __attribute__((warn_unused_result)) - create_partition_name(char *out, size_t outlen, const char *in1, const char - *in2, uint name_variant, bool translate); -int __attribute__((warn_unused_result)) - create_subpartition_name(char *out, size_t outlen, const char *in1, const - char *in2, const char *in3, uint name_variant); - -void set_key_field_ptr(KEY *key_info, const uchar *new_buf, - const uchar *old_buf); - -/** Set up table for creating a partition. -Copy info from partition to the table share so the created partition -has the correct info. - @param thd THD object - @param share Table share to be updated. - @param info Create info to be updated. - @param part_elem partition_element containing the info. - - @return status - @retval TRUE Error - @retval FALSE Success - - @details - Set up - 1) Comment on partition - 2) MAX_ROWS, MIN_ROWS on partition - 3) Index file name on partition - 4) Data file name on partition -*/ -bool set_up_table_before_create(THD *thd, - TABLE_SHARE *share, - const char *partition_name_with_path, - HA_CREATE_INFO *info, - partition_element *part_elem); - -#endif /* SQL_PARTITION_INCLUDED */ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_partition_admin.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_partition_admin.h deleted file mode 100644 index 4be9e56..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_partition_admin.h +++ /dev/null @@ -1,269 +0,0 @@ -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_PARTITION_ADMIN_H -#define SQL_PARTITION_ADMIN_H - -#ifndef WITH_PARTITION_STORAGE_ENGINE - -/** - Stub class that returns a error if the partition storage engine is - not supported. -*/ -class Sql_cmd_partition_unsupported : public Sql_cmd -{ -public: - Sql_cmd_partition_unsupported() - {} - - ~Sql_cmd_partition_unsupported() - {} - - /* Override SQLCOM_*, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_ALTER_TABLE; - } - - bool execute(THD *thd); -}; - - -class Sql_cmd_alter_table_exchange_partition : - public Sql_cmd_partition_unsupported -{ -public: - Sql_cmd_alter_table_exchange_partition() - {} - - ~Sql_cmd_alter_table_exchange_partition() - {} -}; - - -class Sql_cmd_alter_table_analyze_partition : - public Sql_cmd_partition_unsupported -{ -public: - Sql_cmd_alter_table_analyze_partition() - {} - - ~Sql_cmd_alter_table_analyze_partition() - {} -}; - - -class Sql_cmd_alter_table_check_partition : - public Sql_cmd_partition_unsupported -{ -public: - Sql_cmd_alter_table_check_partition() - {} - - ~Sql_cmd_alter_table_check_partition() - {} -}; - - -class Sql_cmd_alter_table_optimize_partition : - public Sql_cmd_partition_unsupported -{ -public: - Sql_cmd_alter_table_optimize_partition() - {} - - ~Sql_cmd_alter_table_optimize_partition() - {} -}; - - -class Sql_cmd_alter_table_repair_partition : - public Sql_cmd_partition_unsupported -{ -public: - Sql_cmd_alter_table_repair_partition() - {} - - ~Sql_cmd_alter_table_repair_partition() - {} -}; - - -class Sql_cmd_alter_table_truncate_partition : - public Sql_cmd_partition_unsupported -{ -public: - Sql_cmd_alter_table_truncate_partition() - {} - - ~Sql_cmd_alter_table_truncate_partition() - {} -}; - -#else - -/** - Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement. -*/ -class Sql_cmd_alter_table_exchange_partition : public Sql_cmd_common_alter_table -{ -public: - /** - Constructor, used to represent a ALTER TABLE EXCHANGE PARTITION statement. - */ - Sql_cmd_alter_table_exchange_partition() - : Sql_cmd_common_alter_table() - {} - - ~Sql_cmd_alter_table_exchange_partition() - {} - - bool execute(THD *thd); - -private: - bool exchange_partition(THD *thd, TABLE_LIST *, Alter_info *); -}; - - -/** - Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement. -*/ -class Sql_cmd_alter_table_analyze_partition : public Sql_cmd_analyze_table -{ -public: - /** - Constructor, used to represent a ALTER TABLE ANALYZE PARTITION statement. - */ - Sql_cmd_alter_table_analyze_partition() - : Sql_cmd_analyze_table() - {} - - ~Sql_cmd_alter_table_analyze_partition() - {} - - bool execute(THD *thd); - - /* Override SQLCOM_ANALYZE, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_ALTER_TABLE; - } -}; - - -/** - Class that represents the ALTER TABLE t1 CHECK PARTITION p statement. -*/ -class Sql_cmd_alter_table_check_partition : public Sql_cmd_check_table -{ -public: - /** - Constructor, used to represent a ALTER TABLE CHECK PARTITION statement. - */ - Sql_cmd_alter_table_check_partition() - : Sql_cmd_check_table() - {} - - ~Sql_cmd_alter_table_check_partition() - {} - - bool execute(THD *thd); - - /* Override SQLCOM_CHECK, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_ALTER_TABLE; - } -}; - - -/** - Class that represents the ALTER TABLE t1 OPTIMIZE PARTITION p statement. -*/ -class Sql_cmd_alter_table_optimize_partition : public Sql_cmd_optimize_table -{ -public: - /** - Constructor, used to represent a ALTER TABLE OPTIMIZE PARTITION statement. - */ - Sql_cmd_alter_table_optimize_partition() - : Sql_cmd_optimize_table() - {} - - ~Sql_cmd_alter_table_optimize_partition() - {} - - bool execute(THD *thd); - - /* Override SQLCOM_OPTIMIZE, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_ALTER_TABLE; - } -}; - - -/** - Class that represents the ALTER TABLE t1 REPAIR PARTITION p statement. -*/ -class Sql_cmd_alter_table_repair_partition : public Sql_cmd_repair_table -{ -public: - /** - Constructor, used to represent a ALTER TABLE REPAIR PARTITION statement. - */ - Sql_cmd_alter_table_repair_partition() - : Sql_cmd_repair_table() - {} - - ~Sql_cmd_alter_table_repair_partition() - {} - - bool execute(THD *thd); - - /* Override SQLCOM_REPAIR, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_ALTER_TABLE; - } -}; - - -/** - Class that represents the ALTER TABLE t1 TRUNCATE PARTITION p statement. -*/ -class Sql_cmd_alter_table_truncate_partition : public Sql_cmd_truncate_table -{ -public: - /** - Constructor, used to represent a ALTER TABLE TRUNCATE PARTITION statement. - */ - Sql_cmd_alter_table_truncate_partition() - {} - - virtual ~Sql_cmd_alter_table_truncate_partition() - {} - - bool execute(THD *thd); - - /* Override SQLCOM_TRUNCATE, since it is an ALTER command */ - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_ALTER_TABLE; - } -}; - -#endif /* WITH_PARTITION_STORAGE_ENGINE */ -#endif /* SQL_PARTITION_ADMIN_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_plist.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_plist.h deleted file mode 100644 index 7f75208..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_plist.h +++ /dev/null @@ -1,297 +0,0 @@ -#ifndef SQL_PLIST_H -#define SQL_PLIST_H -/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -template -class I_P_List_iterator; -class I_P_List_null_counter; -template class I_P_List_no_push_back; - - -/** - Intrusive parameterized list. - - Unlike I_List does not require its elements to be descendant of ilink - class and therefore allows them to participate in several such lists - simultaneously. - - Unlike List is doubly-linked list and thus supports efficient deletion - of element without iterator. - - @param T Type of elements which will belong to list. - @param B Class which via its methods specifies which members - of T should be used for participating in this list. - Here is typical layout of such class: - - struct B - { - static inline T **next_ptr(T *el) - { - return &el->next; - } - static inline T ***prev_ptr(T *el) - { - return &el->prev; - } - }; - @param C Policy class specifying how counting of elements in the list - should be done. Instance of this class is also used as a place - where information about number of list elements is stored. - @sa I_P_List_null_counter, I_P_List_counter - @param I Policy class specifying whether I_P_List should support - efficient push_back() operation. Instance of this class - is used as place where we store information to support - this operation. - @sa I_P_List_no_push_back, I_P_List_fast_push_back. -*/ - -template > -class I_P_List : public C, public I -{ - T *m_first; - - /* - Do not prohibit copying of I_P_List object to simplify their usage in - backup/restore scenarios. Note that performing any operations on such - is a bad idea. - */ -public: - I_P_List() : I(&m_first), m_first(NULL) {}; - /* - empty() is used in many places in the code instead of a constructor, to - initialize a bzero-ed I_P_List instance. - */ - - inline void empty() { m_first= NULL; C::reset(); I::set_last(&m_first); } - inline bool is_empty() const { return (m_first == NULL); } - inline void push_front(T* a) - { - *B::next_ptr(a)= m_first; - if (m_first) - *B::prev_ptr(m_first)= B::next_ptr(a); - else - I::set_last(B::next_ptr(a)); - m_first= a; - *B::prev_ptr(a)= &m_first; - C::inc(); - } - inline void push_back(T *a) - { - T **last= I::get_last(); - *B::next_ptr(a)= *last; - *last= a; - *B::prev_ptr(a)= last; - I::set_last(B::next_ptr(a)); - C::inc(); - } - inline void insert_after(T *pos, T *a) - { - if (pos == NULL) - push_front(a); - else - { - *B::next_ptr(a)= *B::next_ptr(pos); - *B::prev_ptr(a)= B::next_ptr(pos); - *B::next_ptr(pos)= a; - if (*B::next_ptr(a)) - { - T *old_next= *B::next_ptr(a); - *B::prev_ptr(old_next)= B::next_ptr(a); - } - else - I::set_last(B::next_ptr(a)); - C::inc(); - } - } - inline void remove(T *a) - { - T *next= *B::next_ptr(a); - if (next) - *B::prev_ptr(next)= *B::prev_ptr(a); - else - I::set_last(*B::prev_ptr(a)); - **B::prev_ptr(a)= next; - C::dec(); - } - inline T* front() { return m_first; } - inline const T *front() const { return m_first; } - inline T* pop_front() - { - T *result= front(); - - if (result) - remove(result); - - return result; - } - void swap(I_P_List &rhs) - { - swap_variables(T *, m_first, rhs.m_first); - I::swap(rhs); - if (m_first) - *B::prev_ptr(m_first)= &m_first; - else - I::set_last(&m_first); - if (rhs.m_first) - *B::prev_ptr(rhs.m_first)= &rhs.m_first; - else - I::set_last(&rhs.m_first); - C::swap(rhs); - } - typedef B Adapter; - typedef I_P_List Base; - typedef I_P_List_iterator Iterator; - typedef I_P_List_iterator Const_Iterator; -#ifndef _lint - friend class I_P_List_iterator; - friend class I_P_List_iterator; -#endif -}; - - -/** - Iterator for I_P_List. -*/ - -template -class I_P_List_iterator -{ - const L *list; - T *current; -public: - I_P_List_iterator(const L &a) - : list(&a), current(a.m_first) {} - I_P_List_iterator(const L &a, T* current_arg) - : list(&a), current(current_arg) {} - inline void init(const L &a) - { - list= &a; - current= a.m_first; - } - /** - Operator for it++ - - @note since we save next element pointer, caller may remove current element. - Such modification doesn't invalidate iterator. - */ - inline T* operator++(int) - { - T *result= current; - if (result) - current= *L::Adapter::next_ptr(current); - return result; - } - /* Operator for ++it */ - inline T* operator++() - { - current= *L::Adapter::next_ptr(current); - return current; - } - inline void rewind() - { - current= list->m_first; - } -}; - - -/** - Hook class which via its methods specifies which members - of T should be used for participating in a intrusive list. -*/ - -template -struct I_P_List_adapter -{ - static inline T **next_ptr(T *el) { return &(el->*next); } - static inline const T* const* next_ptr(const T *el) { return &(el->*next); } - static inline T ***prev_ptr(T *el) { return &(el->*prev); } -}; - - -/** - Element counting policy class for I_P_List to be used in - cases when no element counting should be done. -*/ - -class I_P_List_null_counter -{ -protected: - void reset() {} - void inc() {} - void dec() {} - void swap(I_P_List_null_counter &) {} -}; - - -/** - Element counting policy class for I_P_List which provides - basic element counting. -*/ - -class I_P_List_counter -{ - uint m_counter; -protected: - I_P_List_counter() : m_counter (0) {} - void reset() {m_counter= 0;} - void inc() {m_counter++;} - void dec() {m_counter--;} - void swap(I_P_List_counter &rhs) - { swap_variables(uint, m_counter, rhs.m_counter); } -public: - uint elements() const { return m_counter; } -}; - - -/** - A null insertion policy class for I_P_List to be used - in cases when push_back() operation is not necessary. -*/ - -template class I_P_List_no_push_back -{ -protected: - I_P_List_no_push_back(T **) {} - void set_last(T **) {} - /* - T** get_last() const method is intentionally left unimplemented - in order to prohibit usage of push_back() method in lists which - use this policy. - */ - void swap(I_P_List_no_push_back &) {} -}; - - -/** - An insertion policy class for I_P_List which can - be used when fast push_back() operation is required. -*/ - -template class I_P_List_fast_push_back -{ - T **m_last; -protected: - I_P_List_fast_push_back(T **a) : m_last(a) { }; - void set_last(T **a) { m_last= a; } - T** get_last() const { return m_last; } - void swap(I_P_List_fast_push_back &rhs) - { swap_variables(T**, m_last, rhs.m_last); } -}; - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_plugin.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_plugin.h deleted file mode 100644 index e136079..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_plugin.h +++ /dev/null @@ -1,206 +0,0 @@ -/* Copyright (c) 2005, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _sql_plugin_h -#define _sql_plugin_h - -/* - the following #define adds server-only members to enum_mysql_show_type, - that is defined in plugin.h -*/ -#define SHOW_always_last SHOW_KEY_CACHE_LONG, \ - SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, \ - SHOW_HAVE, SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, \ - SHOW_LONG_NOFLUSH, SHOW_LONGLONG_STATUS, SHOW_UINT32_STATUS, \ - SHOW_LEX_STRING, SHOW_ATOMIC_COUNTER_UINT32_T -#include "mariadb.h" -#undef SHOW_always_last - -#include "m_string.h" /* LEX_STRING */ -#include "my_alloc.h" /* MEM_ROOT */ - -class sys_var; -enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED}; -enum enum_plugin_load_option { PLUGIN_OFF, PLUGIN_ON, PLUGIN_FORCE, - PLUGIN_FORCE_PLUS_PERMANENT }; -extern const char *global_plugin_typelib_names[]; - -extern volatile int global_plugin_version; -extern ulong dlopen_count; - -#include -#include "sql_list.h" - -#ifdef DBUG_OFF -#define plugin_ref_to_int(A) A -#define plugin_int_to_ref(A) A -#else -#define plugin_ref_to_int(A) (A ? A[0] : NULL) -#define plugin_int_to_ref(A) &(A) -#endif - -/* - the following flags are valid for plugin_init() -*/ -#define PLUGIN_INIT_SKIP_PLUGIN_TABLE 1U -#define PLUGIN_INIT_SKIP_INITIALIZATION 2U - -#define INITIAL_LEX_PLUGIN_LIST_SIZE 16 - -typedef enum enum_mysql_show_type SHOW_TYPE; -typedef struct st_mysql_show_var SHOW_VAR; - -#define MYSQL_ANY_PLUGIN -1 - -/* - different values of st_plugin_int::state - though they look like a bitmap, plugin may only - be in one of those eigenstates, not in a superposition of them :) - It's a bitmap, because it makes it easier to test - "whether the state is one of those..." -*/ -#define PLUGIN_IS_FREED 1U -#define PLUGIN_IS_DELETED 2U -#define PLUGIN_IS_UNINITIALIZED 4U -#define PLUGIN_IS_READY 8U -#define PLUGIN_IS_DYING 16U -#define PLUGIN_IS_DISABLED 32U - -struct st_ptr_backup { - void **ptr; - void *value; - void save(void **p) { ptr= p; value= *p; } - void save(const char **p) { save((void**)p); } - void restore() { *ptr= value; } -}; - -/* A handle for the dynamic library containing a plugin or plugins. */ - -struct st_plugin_dl -{ - LEX_CSTRING dl; - void *handle; - struct st_maria_plugin *plugins; - st_ptr_backup *ptr_backup; - uint nbackups; - uint ref_count; /* number of plugins loaded from the library */ - int mysqlversion; - int mariaversion; - bool allocated; -}; - -/* A handle of a plugin */ - -struct st_plugin_int -{ - LEX_CSTRING name; - struct st_maria_plugin *plugin; - struct st_plugin_dl *plugin_dl; - st_ptr_backup *ptr_backup; - uint nbackups; - uint state; - uint ref_count; /* number of threads using the plugin */ - uint locks_total; /* how many times the plugin was locked */ - void *data; /* plugin type specific, e.g. handlerton */ - MEM_ROOT mem_root; /* memory for dynamic plugin structures */ - sys_var *system_vars; /* server variables for this plugin */ - enum enum_plugin_load_option load_option; /* OFF, ON, FORCE, F+PERMANENT */ -}; - - -extern mysql_mutex_t LOCK_plugin; - -/* - See intern_plugin_lock() for the explanation for the - conditionally defined plugin_ref type -*/ -#ifdef DBUG_OFF -typedef struct st_plugin_int *plugin_ref; -#define plugin_ref_to_int(A) A -#define plugin_int_to_ref(A) A -#define plugin_decl(pi) ((pi)->plugin) -#define plugin_dlib(pi) ((pi)->plugin_dl) -#define plugin_data(pi,cast) ((cast)((pi)->data)) -#define plugin_name(pi) (&((pi)->name)) -#define plugin_state(pi) ((pi)->state) -#define plugin_load_option(pi) ((pi)->load_option) -#define plugin_equals(p1,p2) ((p1) == (p2)) -#else -typedef struct st_plugin_int **plugin_ref; -#define plugin_ref_to_int(A) (A ? A[0] : NULL) -#define plugin_int_to_ref(A) &(A) -#define plugin_decl(pi) ((pi)[0]->plugin) -#define plugin_dlib(pi) ((pi)[0]->plugin_dl) -#define plugin_data(pi,cast) ((cast)((pi)[0]->data)) -#define plugin_name(pi) (&((pi)[0]->name)) -#define plugin_state(pi) ((pi)[0]->state) -#define plugin_load_option(pi) ((pi)[0]->load_option) -#define plugin_equals(p1,p2) ((p1) && (p2) && (p1)[0] == (p2)[0]) -#endif - -typedef int (*plugin_type_init)(struct st_plugin_int *); - -extern I_List *opt_plugin_load_list_ptr; -extern char *opt_plugin_dir_ptr; -extern MYSQL_PLUGIN_IMPORT char opt_plugin_dir[FN_REFLEN]; -extern const LEX_CSTRING plugin_type_names[]; -extern ulong plugin_maturity; -extern TYPELIB plugin_maturity_values; -extern const char *plugin_maturity_names[]; - -extern int plugin_init(int *argc, char **argv, int init_flags); -extern void plugin_shutdown(void); -void add_plugin_options(DYNAMIC_ARRAY *options, MEM_ROOT *mem_root); -extern bool plugin_is_ready(const LEX_CSTRING *name, int type); -#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C) -#define my_plugin_lock(A,B) plugin_lock(A,B) -extern plugin_ref plugin_lock(THD *thd, plugin_ref ptr); -extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_CSTRING *name, - int type); -extern void plugin_unlock(THD *thd, plugin_ref plugin); -extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count); -extern bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name, - const LEX_CSTRING *dl); -extern bool mysql_uninstall_plugin(THD *thd, const LEX_CSTRING *name, - const LEX_CSTRING *dl); -extern bool plugin_register_builtin(struct st_mysql_plugin *plugin); -extern void plugin_thdvar_init(THD *thd); -extern void plugin_thdvar_cleanup(THD *thd); -sys_var *find_plugin_sysvar(st_plugin_int *plugin, st_mysql_sys_var *var); -void plugin_opt_set_limits(struct my_option *, const struct st_mysql_sys_var *); -extern SHOW_COMP_OPTION plugin_status(const char *name, size_t len, int type); -extern bool check_valid_path(const char *path, size_t length); -extern void plugin_mutex_init(); - -typedef my_bool (plugin_foreach_func)(THD *thd, - plugin_ref plugin, - void *arg); -#define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D) -extern bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, - int type, uint state_mask, void *arg); -extern void sync_dynamic_session_variables(THD* thd, bool global_lock); - -extern bool plugin_dl_foreach(THD *thd, const LEX_CSTRING *dl, - plugin_foreach_func *func, void *arg); - -extern void sync_dynamic_session_variables(THD* thd, bool global_lock); -#endif - -#ifdef WITH_WSREP -extern void wsrep_plugins_pre_init(); -extern void wsrep_plugins_post_init(); -#endif /* WITH_WSREP */ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_plugin_compat.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_plugin_compat.h deleted file mode 100644 index 01b79c5..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_plugin_compat.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (C) 2013 Sergei Golubchik and Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* old plugin api structures, used for backward compatibility */ - -#define upgrade_var(X) latest->X= X -#define upgrade_str(X) strmake_buf(latest->X, X) -#define downgrade_var(X) X= latest->X -#define downgrade_str(X) strmake_buf(X, latest->X) - -/**************************************************************/ -/* Authentication API, version 0x0100 *************************/ -#define MIN_AUTHENTICATION_INTERFACE_VERSION 0x0100 - -struct MYSQL_SERVER_AUTH_INFO_0x0100 { - const char *user_name; - unsigned int user_name_length; - const char *auth_string; - unsigned long auth_string_length; - char authenticated_as[49]; - char external_user[512]; - int password_used; - const char *host_or_ip; - unsigned int host_or_ip_length; - - void upgrade(MYSQL_SERVER_AUTH_INFO *latest) - { - upgrade_var(user_name); - upgrade_var(user_name_length); - upgrade_var(auth_string); - upgrade_var(auth_string_length); - upgrade_str(authenticated_as); - upgrade_str(external_user); - upgrade_var(password_used); - upgrade_var(host_or_ip); - upgrade_var(host_or_ip_length); - } - void downgrade(MYSQL_SERVER_AUTH_INFO *latest) - { - downgrade_var(user_name); - downgrade_var(user_name_length); - downgrade_var(auth_string); - downgrade_var(auth_string_length); - downgrade_str(authenticated_as); - downgrade_str(external_user); - downgrade_var(password_used); - downgrade_var(host_or_ip); - downgrade_var(host_or_ip_length); - } -}; - -/**************************************************************/ - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_prepare.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_prepare.h deleted file mode 100644 index 166be95..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_prepare.h +++ /dev/null @@ -1,354 +0,0 @@ -#ifndef SQL_PREPARE_H -#define SQL_PREPARE_H -/* Copyright (c) 1995-2008 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "sql_error.h" - - -#define LAST_STMT_ID 0xFFFFFFFF -#define STMT_ID_MASK 0x7FFFFFFF - -class THD; -struct LEX; - -/** - An interface that is used to take an action when - the locking module notices that a table version has changed - since the last execution. "Table" here may refer to any kind of - table -- a base table, a temporary table, a view or an - information schema table. - - When we open and lock tables for execution of a prepared - statement, we must verify that they did not change - since statement prepare. If some table did change, the statement - parse tree *may* be no longer valid, e.g. in case it contains - optimizations that depend on table metadata. - - This class provides an interface (a method) that is - invoked when such a situation takes place. - The implementation of the method simply reports an error, but - the exact details depend on the nature of the SQL statement. - - At most 1 instance of this class is active at a time, in which - case THD::m_reprepare_observer is not NULL. - - @sa check_and_update_table_version() for details of the - version tracking algorithm - - @sa Open_tables_state::m_reprepare_observer for the life cycle - of metadata observers. -*/ - -class Reprepare_observer -{ -public: - /** - Check if a change of metadata is OK. In future - the signature of this method may be extended to accept the old - and the new versions, but since currently the check is very - simple, we only need the THD to report an error. - */ - bool report_error(THD *thd); - bool is_invalidated() const { return m_invalidated; } - void reset_reprepare_observer() { m_invalidated= FALSE; } -private: - bool m_invalidated; -}; - - -void mysqld_stmt_prepare(THD *thd, const char *packet, uint packet_length); -void mysqld_stmt_execute(THD *thd, char *packet, uint packet_length); -void mysqld_stmt_execute_bulk(THD *thd, char *packet, uint packet_length); -void mysqld_stmt_bulk_execute(THD *thd, char *packet, uint packet_length); -void mysqld_stmt_close(THD *thd, char *packet); -void mysql_sql_stmt_prepare(THD *thd); -void mysql_sql_stmt_execute(THD *thd); -void mysql_sql_stmt_execute_immediate(THD *thd); -void mysql_sql_stmt_close(THD *thd); -void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length); -void mysqld_stmt_reset(THD *thd, char *packet); -void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length); -void reinit_stmt_before_use(THD *thd, LEX *lex); - -my_bool bulk_parameters_iterations(THD *thd); -my_bool bulk_parameters_set(THD *thd); -/** - Execute a fragment of server code in an isolated context, so that - it doesn't leave any effect on THD. THD must have no open tables. - The code must not leave any open tables around. - The result of execution (if any) is stored in Ed_result. -*/ - -class Server_runnable -{ -public: - virtual bool execute_server_code(THD *thd)= 0; - virtual ~Server_runnable(); -}; - - -/** - Execute direct interface. - - @todo Implement support for prelocked mode. -*/ - -class Ed_row; - -/** - Ed_result_set -- a container with result set rows. - @todo Implement support for result set metadata and - automatic type conversion. -*/ - -class Ed_result_set: public Sql_alloc -{ -public: - operator List&() { return *m_rows; } - unsigned int size() const { return m_rows->elements; } - - Ed_result_set(List *rows_arg, size_t column_count, - MEM_ROOT *mem_root_arg); - - /** We don't call member destructors, they all are POD types. */ - ~Ed_result_set() {} - - size_t get_field_count() const { return m_column_count; } - - static void operator delete(void *ptr, size_t size) throw (); - static void operator delete(void *, MEM_ROOT *){} -private: - Ed_result_set(const Ed_result_set &); /* not implemented */ - Ed_result_set &operator=(Ed_result_set &); /* not implemented */ -private: - MEM_ROOT m_mem_root; - size_t m_column_count; - List *m_rows; - Ed_result_set *m_next_rset; - friend class Ed_connection; -}; - - -class Ed_connection -{ -public: - /** - Construct a new "execute direct" connection. - - The connection can be used to execute SQL statements. - If the connection failed to initialize, the error - will be returned on the attempt to execute a statement. - - @pre thd must have no open tables - while the connection is used. However, - Ed_connection works okay in LOCK TABLES mode. - Other properties of THD, such as the current warning - information, errors, etc. do not matter and are - preserved by Ed_connection. One thread may have many - Ed_connections created for it. - */ - Ed_connection(THD *thd); - - /** - Execute one SQL statement. - - Until this method is executed, no other methods of - Ed_connection can be used. Life cycle of Ed_connection is: - - Initialized -> a statement has been executed -> - look at result, move to next result -> - look at result, move to next result -> - ... - moved beyond the last result == Initialized. - - This method can be called repeatedly. Once it's invoked, - results of the previous execution are lost. - - A result of execute_direct() can be either: - - - success, no result set rows. In this case get_field_count() - returns 0. This happens after execution of INSERT, UPDATE, - DELETE, DROP and similar statements. Some other methods, such - as get_affected_rows() can be used to retrieve additional - result information. - - - success, there are some result set rows (maybe 0). E.g. - happens after SELECT. In this case get_field_count() returns - the number of columns in a result set and store_result() - can be used to retrieve a result set.. - - - an error, methods to retrieve error information can - be used. - - @return execution status - @retval FALSE success, use get_field_count() - to determine what to do next. - @retval TRUE error, use get_last_error() - to see the error number. - */ - bool execute_direct(Protocol *p, LEX_STRING sql_text); - - /** - Same as the previous, but takes an instance of Server_runnable - instead of SQL statement text. - - @return execution status - - @retval FALSE success, use get_field_count() - if your code fragment is supposed to - return a result set - @retval TRUE failure - */ - bool execute_direct(Protocol *p, Server_runnable *server_runnable); - - /** - Get the number of affected (deleted, updated) - rows for the current statement. Can be - used for statements with get_field_count() == 0. - - @sa Documentation for C API function - mysql_affected_rows(). - */ - ulonglong get_affected_rows() const - { - return m_diagnostics_area.affected_rows(); - } - - /** - Get the last insert id, if any. - - @sa Documentation for mysql_insert_id(). - */ - ulonglong get_last_insert_id() const - { - return m_diagnostics_area.last_insert_id(); - } - - /** - Get the total number of warnings for the last executed - statement. Note, that there is only one warning list even - if a statement returns multiple results. - - @sa Documentation for C API function - mysql_num_warnings(). - */ - ulong get_warn_count() const - { - return m_diagnostics_area.warn_count(); - } - - /** - The following members are only valid if execute_direct() - or move_to_next_result() returned an error. - They never fail, but if they are called when there is no - result, or no error, the result is not defined. - */ - const char *get_last_error() const { return m_diagnostics_area.message(); } - unsigned int get_last_errno() const { return m_diagnostics_area.sql_errno(); } - const char *get_last_sqlstate() const { return m_diagnostics_area.get_sqlstate(); } - - /** - Provided get_field_count() is not 0, this never fails. You don't - need to free the result set, this is done automatically when - you advance to the next result set or destroy the connection. - Not returning const because of List iterator not accepting - Should be used when you would like Ed_connection to manage - result set memory for you. - */ - Ed_result_set *use_result_set() { return m_current_rset; } - /** - Provided get_field_count() is not 0, this never fails. You - must free the returned result set. This can be called only - once after execute_direct(). - Should be used when you would like to get the results - and destroy the connection. - */ - Ed_result_set *store_result_set(); - - /** - If the query returns multiple results, this method - can be checked if there is another result beyond the next - one. - Never fails. - */ - bool has_next_result() const { return MY_TEST(m_current_rset->m_next_rset); } - /** - Only valid to call if has_next_result() returned true. - Otherwise the result is undefined. - */ - bool move_to_next_result() - { - m_current_rset= m_current_rset->m_next_rset; - return MY_TEST(m_current_rset); - } - - ~Ed_connection() { free_old_result(); } -private: - Diagnostics_area m_diagnostics_area; - /** - Execute direct interface does not support multi-statements, only - multi-results. So we never have a situation when we have - a mix of result sets and OK or error packets. We either - have a single result set, a single error, or a single OK, - or we have a series of result sets, followed by an OK or error. - */ - THD *m_thd; - Ed_result_set *m_rsets; - Ed_result_set *m_current_rset; -private: - void free_old_result(); - void add_result_set(Ed_result_set *ed_result_set); -private: - Ed_connection(const Ed_connection &); /* not implemented */ - Ed_connection &operator=(Ed_connection &); /* not implemented */ -}; - - -/** One result set column. */ - -struct Ed_column: public LEX_STRING -{ - /** Implementation note: destructor for this class is never called. */ -}; - - -/** One result set record. */ - -class Ed_row: public Sql_alloc -{ -public: - const Ed_column &operator[](const unsigned int column_index) const - { - return *get_column(column_index); - } - const Ed_column *get_column(const unsigned int column_index) const - { - DBUG_ASSERT(column_index < size()); - return m_column_array + column_index; - } - size_t size() const { return m_column_count; } - - Ed_row(Ed_column *column_array_arg, size_t column_count_arg) - :m_column_array(column_array_arg), - m_column_count(column_count_arg) - {} -private: - Ed_column *m_column_array; - size_t m_column_count; /* TODO: change to point to metadata */ -}; - -#endif // SQL_PREPARE_H diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_priv.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_priv.h deleted file mode 100644 index 07f07a7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_priv.h +++ /dev/null @@ -1,435 +0,0 @@ -/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2010, 2019, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - @details - Mostly this file is used in the server. But a little part of it is used in - mysqlbinlog too (definition of SELECT_DISTINCT and others). - The consequence is that 90% of the file is wrapped in \#ifndef MYSQL_CLIENT, - except the part which must be in the server and in the client. -*/ - -#ifndef SQL_PRIV_INCLUDED -#define SQL_PRIV_INCLUDED - -#ifndef MYSQL_CLIENT - -/* - Generates a warning that a feature is deprecated. After a specified - version asserts that the feature is removed. - - Using it as - - WARN_DEPRECATED(thd, 6,2, "BAD", "'GOOD'"); - - Will result in a warning - - "The syntax 'BAD' is deprecated and will be removed in MySQL 6.2. Please - use 'GOOD' instead" - - Note that in macro arguments BAD is not quoted, while 'GOOD' is. - Note that the version is TWO numbers, separated with a comma - (two macro arguments, that is) -*/ -#define WARN_DEPRECATED(Thd,VerHi,VerLo,Old,New) \ - do { \ - compile_time_assert(MYSQL_VERSION_ID < VerHi * 10000 + VerLo * 100); \ - if (((THD *) Thd) != NULL) \ - push_warning_printf(((THD *) Thd), Sql_condition::WARN_LEVEL_WARN, \ - ER_WARN_DEPRECATED_SYNTAX, \ - ER_THD(((THD *) Thd), ER_WARN_DEPRECATED_SYNTAX), \ - (Old), (New)); \ - else \ - sql_print_warning("The syntax '%s' is deprecated and will be removed " \ - "in a future release. Please use %s instead.", \ - (Old), (New)); \ - } while(0) - - -/* - Generates a warning that a feature is deprecated and there is no replacement. - - Using it as - - WARN_DEPRECATED_NO_REPLACEMENT(thd, "BAD"); - - Will result in a warning - - "'BAD' is deprecated and will be removed in a future release." - - Note that in macro arguments BAD is not quoted. -*/ - -#define WARN_DEPRECATED_NO_REPLACEMENT(Thd,Old) \ - do { \ - THD *thd_= ((THD*) Thd); \ - if (thd_ != NULL) \ - push_warning_printf(thd_, Sql_condition::WARN_LEVEL_WARN, \ - ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT, \ - ER_THD(thd_, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT), \ - (Old)); \ - else \ - sql_print_warning("'%s' is deprecated and will be removed " \ - "in a future release.", (Old)); \ - } while(0) - -/*************************************************************************/ - -#endif - -/* - This is included in the server and in the client. - Options for select set by the yacc parser (stored in lex->options). - - NOTE - log_event.h defines OPTIONS_WRITTEN_TO_BIN_LOG to specify what THD - options list are written into binlog. These options can NOT change their - values, or it will break replication between version. - - context is encoded as following: - SELECT - SELECT_LEX_NODE::options - THD - THD::options - intern - neither. used only as - func(..., select_node->options | thd->options | OPTION_XXX, ...) - - TODO: separate three contexts above, move them to separate bitfields. -*/ - -#define SELECT_DISTINCT (1ULL << 0) // SELECT, user -#define SELECT_STRAIGHT_JOIN (1ULL << 1) // SELECT, user -#define SELECT_DESCRIBE (1ULL << 2) // SELECT, user -#define SELECT_SMALL_RESULT (1ULL << 3) // SELECT, user -#define SELECT_BIG_RESULT (1ULL << 4) // SELECT, user -#define OPTION_FOUND_ROWS (1ULL << 5) // SELECT, user -#define OPTION_TO_QUERY_CACHE (1ULL << 6) // SELECT, user -#define SELECT_NO_JOIN_CACHE (1ULL << 7) // intern -/** always the opposite of OPTION_NOT_AUTOCOMMIT except when in fix_autocommit() */ -#define OPTION_AUTOCOMMIT (1ULL << 8) // THD, user -#define OPTION_BIG_SELECTS (1ULL << 9) // THD, user -#define OPTION_LOG_OFF (1ULL << 10) // THD, user -#define OPTION_QUOTE_SHOW_CREATE (1ULL << 11) // THD, user -#define TMP_TABLE_ALL_COLUMNS (1ULL << 12) // SELECT, intern -#define OPTION_WARNINGS (1ULL << 13) // THD, user -#define OPTION_AUTO_IS_NULL (1ULL << 14) // THD, user, binlog -#define OPTION_NO_CHECK_CONSTRAINT_CHECKS (1ULL << 15) -#define OPTION_SAFE_UPDATES (1ULL << 16) // THD, user -#define OPTION_BUFFER_RESULT (1ULL << 17) // SELECT, user -#define OPTION_BIN_LOG (1ULL << 18) // THD, user -#define OPTION_NOT_AUTOCOMMIT (1ULL << 19) // THD, user -#define OPTION_BEGIN (1ULL << 20) // THD, intern -#define OPTION_TABLE_LOCK (1ULL << 21) // THD, intern -#define OPTION_QUICK (1ULL << 22) // SELECT (for DELETE) -#define OPTION_KEEP_LOG (1ULL << 23) // THD, user - -/* The following is used to detect a conflict with DISTINCT */ -#define SELECT_ALL (1ULL << 24) // SELECT, user, parser -#define OPTION_GTID_BEGIN (1ULL << 25) // GTID BEGIN found in log - -/** The following can be set when importing tables in a 'wrong order' - to suppress foreign key checks */ -#define OPTION_NO_FOREIGN_KEY_CHECKS (1ULL << 26) // THD, user, binlog -/** The following speeds up inserts to InnoDB tables by suppressing unique - key checks in some cases */ -#define OPTION_RELAXED_UNIQUE_CHECKS (1ULL << 27) // THD, user, binlog -#define OPTION_IF_EXISTS (1ULL << 28) // binlog -#define OPTION_SCHEMA_TABLE (1ULL << 29) // SELECT, intern -/** Flag set if setup_tables already done */ -#define OPTION_SETUP_TABLES_DONE (1ULL << 30) // intern -/** If not set then the thread will ignore all warnings with level notes. */ -#define OPTION_SQL_NOTES (1ULL << 31) // THD, user -/** - Force the used temporary table to be a MyISAM table (because we will use - fulltext functions when reading from it. -*/ -#define TMP_TABLE_FORCE_MYISAM (1ULL << 32) -#define OPTION_PROFILING (1ULL << 33) -/** - Indicates that this is a HIGH_PRIORITY SELECT. - Currently used only for printing of such selects. - Type of locks to be acquired is specified directly. -*/ -#define SELECT_HIGH_PRIORITY (1ULL << 34) // SELECT, user -/** - Is set in slave SQL thread when there was an - error on master, which, when is not reproducible - on slave (i.e. the query succeeds on slave), - is not terminal to the state of repliation, - and should be ignored. The slave SQL thread, - however, needs to rollback the effects of the - succeeded statement to keep replication consistent. -*/ -#define OPTION_MASTER_SQL_ERROR (1ULL << 35) - -#define OPTION_SKIP_REPLICATION (1ULL << 37) // THD, user -#define OPTION_RPL_SKIP_PARALLEL (1ULL << 38) -#define OPTION_NO_QUERY_CACHE (1ULL << 39) // SELECT, user -#define OPTION_PROCEDURE_CLAUSE (1ULL << 40) // Internal usage -#define SELECT_NO_UNLOCK (1ULL << 41) // SELECT, intern -#define SELECT_NO_UNLOCK (1ULL << 41) // SELECT, intern -#define OPTION_BIN_TMP_LOG_OFF (1ULL << 42) // disable binlog, intern -/* Disable commit of binlog. Used to combine many DDL's and DML's as one */ -#define OPTION_BIN_COMMIT_OFF (1ULL << 43) - -#define OPTION_LEX_FOUND_COMMENT (1ULL << 0) // intern, parser - -/* The rest of the file is included in the server only */ -#ifndef MYSQL_CLIENT - -/* @@optimizer_switch flags. These must be in sync with optimizer_switch_typelib */ -#define OPTIMIZER_SWITCH_INDEX_MERGE (1ULL << 0) -#define OPTIMIZER_SWITCH_INDEX_MERGE_UNION (1ULL << 1) -#define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION (1ULL << 2) -#define OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT (1ULL << 3) -#define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_INTERSECT (1ULL << 4) -#define deprecated_ENGINE_CONDITION_PUSHDOWN (1ULL << 5) -#define OPTIMIZER_SWITCH_INDEX_COND_PUSHDOWN (1ULL << 6) -#define OPTIMIZER_SWITCH_DERIVED_MERGE (1ULL << 7) -#define OPTIMIZER_SWITCH_DERIVED_WITH_KEYS (1ULL << 8) -#define OPTIMIZER_SWITCH_FIRSTMATCH (1ULL << 9) -#define OPTIMIZER_SWITCH_LOOSE_SCAN (1ULL << 10) -#define OPTIMIZER_SWITCH_MATERIALIZATION (1ULL << 11) -#define OPTIMIZER_SWITCH_IN_TO_EXISTS (1ULL << 12) -#define OPTIMIZER_SWITCH_SEMIJOIN (1ULL << 13) -#define OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE (1ULL << 14) -#define OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN (1ULL << 15) -#define OPTIMIZER_SWITCH_SUBQUERY_CACHE (1ULL << 16) -/** If this is off, MRR is never used. */ -#define OPTIMIZER_SWITCH_MRR (1ULL << 17) -/** - If OPTIMIZER_SWITCH_MRR is on and this is on, MRR is used depending on a - cost-based choice ("automatic"). If OPTIMIZER_SWITCH_MRR is on and this is - off, MRR is "forced" (i.e. used as long as the storage engine is capable of - doing it). -*/ -#define OPTIMIZER_SWITCH_MRR_COST_BASED (1ULL << 18) -#define OPTIMIZER_SWITCH_MRR_SORT_KEYS (1ULL << 19) -#define OPTIMIZER_SWITCH_OUTER_JOIN_WITH_CACHE (1ULL << 20) -#define OPTIMIZER_SWITCH_SEMIJOIN_WITH_CACHE (1ULL << 21) -#define OPTIMIZER_SWITCH_JOIN_CACHE_INCREMENTAL (1ULL << 22) -#define OPTIMIZER_SWITCH_JOIN_CACHE_HASHED (1ULL << 23) -#define OPTIMIZER_SWITCH_JOIN_CACHE_BKA (1ULL << 24) -#define OPTIMIZER_SWITCH_OPTIMIZE_JOIN_BUFFER_SIZE (1ULL << 25) -#define OPTIMIZER_SWITCH_TABLE_ELIMINATION (1ULL << 26) -#define OPTIMIZER_SWITCH_EXTENDED_KEYS (1ULL << 27) -#define OPTIMIZER_SWITCH_EXISTS_TO_IN (1ULL << 28) -#define OPTIMIZER_SWITCH_ORDERBY_EQ_PROP (1ULL << 29) -#define OPTIMIZER_SWITCH_COND_PUSHDOWN_FOR_DERIVED (1ULL << 30) -#define OPTIMIZER_SWITCH_SPLIT_MATERIALIZED (1ULL << 31) -#define OPTIMIZER_SWITCH_COND_PUSHDOWN_FOR_SUBQUERY (1ULL << 32) -#define OPTIMIZER_SWITCH_USE_ROWID_FILTER (1ULL << 33) -#define OPTIMIZER_SWITCH_COND_PUSHDOWN_FROM_HAVING (1ULL << 34) -#define OPTIMIZER_SWITCH_NOT_NULL_RANGE_SCAN (1ULL << 35) - -#define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \ - OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \ - OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION | \ - OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT | \ - OPTIMIZER_SWITCH_INDEX_COND_PUSHDOWN | \ - OPTIMIZER_SWITCH_DERIVED_MERGE | \ - OPTIMIZER_SWITCH_DERIVED_WITH_KEYS | \ - OPTIMIZER_SWITCH_TABLE_ELIMINATION | \ - OPTIMIZER_SWITCH_EXTENDED_KEYS | \ - OPTIMIZER_SWITCH_IN_TO_EXISTS | \ - OPTIMIZER_SWITCH_MATERIALIZATION | \ - OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE|\ - OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN|\ - OPTIMIZER_SWITCH_OUTER_JOIN_WITH_CACHE | \ - OPTIMIZER_SWITCH_SEMIJOIN_WITH_CACHE | \ - OPTIMIZER_SWITCH_JOIN_CACHE_INCREMENTAL | \ - OPTIMIZER_SWITCH_JOIN_CACHE_HASHED | \ - OPTIMIZER_SWITCH_JOIN_CACHE_BKA | \ - OPTIMIZER_SWITCH_SUBQUERY_CACHE | \ - OPTIMIZER_SWITCH_SEMIJOIN | \ - OPTIMIZER_SWITCH_FIRSTMATCH | \ - OPTIMIZER_SWITCH_LOOSE_SCAN | \ - OPTIMIZER_SWITCH_EXISTS_TO_IN | \ - OPTIMIZER_SWITCH_ORDERBY_EQ_PROP | \ - OPTIMIZER_SWITCH_COND_PUSHDOWN_FOR_DERIVED | \ - OPTIMIZER_SWITCH_SPLIT_MATERIALIZED | \ - OPTIMIZER_SWITCH_COND_PUSHDOWN_FOR_SUBQUERY | \ - OPTIMIZER_SWITCH_USE_ROWID_FILTER | \ - OPTIMIZER_SWITCH_COND_PUSHDOWN_FROM_HAVING | \ - OPTIMIZER_SWITCH_OPTIMIZE_JOIN_BUFFER_SIZE) - -/* - Replication uses 8 bytes to store SQL_MODE in the binary log. The day you - use strictly more than 64 bits by adding one more define above, you should - contact the replication team because the replication code should then be - updated (to store more bytes on disk). - - NOTE: When adding new SQL_MODE types, make sure to also add them to - the scripts used for creating the MySQL system tables - in scripts/mysql_system_tables.sql and scripts/mysql_system_tables_fix.sql - -*/ - -/* - Flags below are set when we perform - context analysis of the statement and make - subqueries non-const. It prevents subquery - evaluation at context analysis stage. -*/ - -/* - Don't evaluate this subquery during statement prepare even if - it's a constant one. The flag is switched off in the end of - mysqld_stmt_prepare. -*/ -#define CONTEXT_ANALYSIS_ONLY_PREPARE 1 -/* - Special JOIN::prepare mode: changing of query is prohibited. - When creating a view, we need to just check its syntax omitting - any optimizations: afterwards definition of the view will be - reconstructed by means of ::print() methods and written to - to an .frm file. We need this definition to stay untouched. -*/ -#define CONTEXT_ANALYSIS_ONLY_VIEW 2 -/* - Don't evaluate this subquery during derived table prepare even if - it's a constant one. -*/ -#define CONTEXT_ANALYSIS_ONLY_DERIVED 4 -/* - Don't evaluate constant sub-expressions of virtual column - expressions when opening tables -*/ -#define CONTEXT_ANALYSIS_ONLY_VCOL_EXPR 8 - - -/* - Uncachable causes: -*/ -/* This subquery has fields from outer query (put by user) */ -#define UNCACHEABLE_DEPENDENT_GENERATED 1 -/* This subquery contains functions with random result */ -#define UNCACHEABLE_RAND 2 -/* This subquery contains functions with side effect */ -#define UNCACHEABLE_SIDEEFFECT 4 -/* Forcing to save JOIN tables for explain */ -#define UNCACHEABLE_EXPLAIN 8 -/* For uncorrelated SELECT in an UNION with some correlated SELECTs */ -#define UNCACHEABLE_UNITED 16 -#define UNCACHEABLE_CHECKOPTION 32 -/* - This subquery has fields from outer query injected during - transformation process -*/ -#define UNCACHEABLE_DEPENDENT_INJECTED 64 -/* This subquery has fields from outer query (any nature) */ -#define UNCACHEABLE_DEPENDENT (UNCACHEABLE_DEPENDENT_GENERATED | \ - UNCACHEABLE_DEPENDENT_INJECTED) - -/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */ -#define UNDEF_POS (-1) - -#define IN_SUBQUERY_CONVERSION_THRESHOLD 1000 - -#endif /* !MYSQL_CLIENT */ - -/* BINLOG_DUMP options */ - -#define BINLOG_DUMP_NON_BLOCK 1 -#define BINLOG_SEND_ANNOTATE_ROWS_EVENT 2 - -#ifndef MYSQL_CLIENT - -/* - Field::is_equal() return codes. -*/ -#define IS_EQUAL_NO 0 -#define IS_EQUAL_YES 1 -/** - new_field has compatible packed representation with old type, - so it is theoretically possible to perform change by only updating - data dictionary without changing table rows -*/ -#define IS_EQUAL_PACK_LENGTH 2 - -enum enum_parsing_place -{ - NO_MATTER, - IN_HAVING, - SELECT_LIST, - IN_WHERE, - IN_ON, - IN_GROUP_BY, - IN_ORDER_BY, - IN_UPDATE_ON_DUP_KEY, - IN_PART_FUNC, - BEFORE_OPT_LIST, - AFTER_LIST, - FOR_LOOP_BOUND, - PARSING_PLACE_SIZE /* always should be the last */ -}; - - -class sys_var; - -enum enum_yes_no_unknown -{ - TVL_YES, TVL_NO, TVL_UNKNOWN -}; - -#ifdef MYSQL_SERVER - -/* - External variables -*/ - - -/* sql_yacc.cc */ -#ifndef DBUG_OFF -extern void turn_parser_debug_on_MYSQLparse(); -extern void turn_parser_debug_on_ORAparse(); - -#endif - -/** - convert a hex digit into number. -*/ - -inline int hexchar_to_int(char c) -{ - if (c <= '9' && c >= '0') - return c-'0'; - c|=32; - if (c <= 'f' && c >= 'a') - return c-'a'+10; - return -1; -} - -/* This must match the path length limit in the ER_NOT_RW_DIR error msg. */ -#define ER_NOT_RW_DIR_PATHSIZE 200 - -#define IS_TABLESPACES_TABLESPACE_NAME 0 -#define IS_TABLESPACES_ENGINE 1 -#define IS_TABLESPACES_TABLESPACE_TYPE 2 -#define IS_TABLESPACES_LOGFILE_GROUP_NAME 3 -#define IS_TABLESPACES_EXTENT_SIZE 4 -#define IS_TABLESPACES_AUTOEXTEND_SIZE 5 -#define IS_TABLESPACES_MAXIMUM_SIZE 6 -#define IS_TABLESPACES_NODEGROUP_ID 7 -#define IS_TABLESPACES_TABLESPACE_COMMENT 8 - -bool db_name_is_in_ignore_db_dirs_list(const char *dbase); - -#endif /* MYSQL_SERVER */ - -#endif /* MYSQL_CLIENT */ - -#endif /* SQL_PRIV_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_profile.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_profile.h deleted file mode 100644 index 85018a2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_profile.h +++ /dev/null @@ -1,336 +0,0 @@ -/* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _SQL_PROFILE_H -#define _SQL_PROFILE_H - -class Item; -struct TABLE_LIST; -class THD; -class ST_FIELD_INFO; -typedef struct st_schema_table ST_SCHEMA_TABLE; - -namespace Show { -extern ST_FIELD_INFO query_profile_statistics_info[]; -} // namespace Show - -int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond); -int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table); - - -#define PROFILE_NONE (uint)0 -#define PROFILE_CPU (uint)(1<<0) -#define PROFILE_MEMORY (uint)(1<<1) -#define PROFILE_BLOCK_IO (uint)(1<<2) -#define PROFILE_CONTEXT (uint)(1<<3) -#define PROFILE_PAGE_FAULTS (uint)(1<<4) -#define PROFILE_IPC (uint)(1<<5) -#define PROFILE_SWAPS (uint)(1<<6) -#define PROFILE_SOURCE (uint)(1<<16) -#define PROFILE_ALL (uint)(~0) - - -#if defined(ENABLED_PROFILING) -#include "sql_priv.h" -#include "unireg.h" - -#ifdef __WIN__ -#include -#endif - -#ifdef HAVE_SYS_RESOURCE_H -#include -#endif - -extern PSI_memory_key key_memory_queue_item; - -class PROF_MEASUREMENT; -class QUERY_PROFILE; -class PROFILING; - - -/** - Implements a persistent FIFO using server List method names. Not - thread-safe. Intended to be used on thread-local data only. -*/ -template class Queue -{ -private: - - struct queue_item - { - T *payload; - struct queue_item *next, *previous; - }; - - struct queue_item *first, *last; - -public: - Queue() - { - elements= 0; - first= last= NULL; - } - - void empty() - { - struct queue_item *i, *after_i; - for (i= first; i != NULL; i= after_i) - { - after_i= i->next; - my_free(i); - } - elements= 0; - } - - ulong elements; /* The count of items in the Queue */ - - void push_back(T *payload) - { - struct queue_item *new_item; - - new_item= (struct queue_item *) my_malloc(key_memory_queue_item, - sizeof(struct queue_item), MYF(0)); - - new_item->payload= payload; - - if (first == NULL) - first= new_item; - if (last != NULL) - { - DBUG_ASSERT(last->next == NULL); - last->next= new_item; - } - new_item->previous= last; - new_item->next= NULL; - last= new_item; - - elements++; - } - - T *pop() - { - struct queue_item *old_item= first; - T *ret= NULL; - - if (first == NULL) - { - DBUG_PRINT("warning", ("tried to pop nonexistent item from Queue")); - return NULL; - } - - ret= old_item->payload; - if (first->next != NULL) - first->next->previous= NULL; - else - last= NULL; - first= first->next; - - my_free(old_item); - elements--; - - return ret; - } - - bool is_empty() - { - DBUG_ASSERT(((elements > 0) && (first != NULL)) || ((elements == 0) || (first == NULL))); - return (elements == 0); - } - - void *new_iterator() - { - return first; - } - - void *iterator_next(void *current) - { - return ((struct queue_item *) current)->next; - } - - T *iterator_value(void *current) - { - return ((struct queue_item *) current)->payload; - } - -}; - - -/** - A single entry in a single profile. -*/ -class PROF_MEASUREMENT -{ -private: - friend class QUERY_PROFILE; - friend class PROFILING; - - QUERY_PROFILE *profile; - char *status; -#ifdef HAVE_GETRUSAGE - struct rusage rusage; -#elif defined(_WIN32) - FILETIME ftKernel, ftUser; - IO_COUNTERS io_count; - PROCESS_MEMORY_COUNTERS mem_count; -#endif - - char *function; - char *file; - unsigned int line; - - ulong m_seq; - double time_usecs; - char *allocated_status_memory; - - void set_label(const char *status_arg, const char *function_arg, - const char *file_arg, unsigned int line_arg); - void clean_up(); - - PROF_MEASUREMENT(); - PROF_MEASUREMENT(QUERY_PROFILE *profile_arg, const char *status_arg); - PROF_MEASUREMENT(QUERY_PROFILE *profile_arg, const char *status_arg, - const char *function_arg, - const char *file_arg, unsigned int line_arg); - ~PROF_MEASUREMENT(); - void collect(); -}; - - -/** - The full profile for a single query, and includes multiple PROF_MEASUREMENT - objects. -*/ -class QUERY_PROFILE -{ -private: - friend class PROFILING; - - PROFILING *profiling; - - query_id_t profiling_query_id; /* Session-specific id. */ - char *query_source; - - double m_start_time_usecs; - double m_end_time_usecs; - ulong m_seq_counter; - Queue entries; - - - QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg); - ~QUERY_PROFILE(); - - void set_query_source(char *query_source_arg, size_t query_length_arg); - - /* Add a profile status change to the current profile. */ - void new_status(const char *status_arg, - const char *function_arg, - const char *file_arg, unsigned int line_arg); - - /* Reset the contents of this profile entry. */ - void reset(); - - /* Show this profile. This is called by PROFILING. */ - bool show(uint options); -}; - - -/** - Profiling state for a single THD; contains multiple QUERY_PROFILE objects. -*/ -class PROFILING -{ -private: - friend class PROF_MEASUREMENT; - friend class QUERY_PROFILE; - - /* - Not the system query_id, but a counter unique to profiling. - */ - query_id_t profile_id_counter; - THD *thd; - bool keeping; - bool enabled; - - QUERY_PROFILE *current; - QUERY_PROFILE *last; - Queue history; - - query_id_t next_profile_id() { return(profile_id_counter++); } - -public: - PROFILING(); - ~PROFILING(); - - /** - At a point in execution where we know the query source, save the text - of it in the query profile. - - This must be called exactly once per descrete statement. - */ - void set_query_source(char *query_source_arg, size_t query_length_arg) - { - if (unlikely(current)) - current->set_query_source(query_source_arg, query_length_arg); - } - - /** - Prepare to start processing a new query. It is an error to do this - if there's a query already in process; nesting is not supported. - - @param initial_state (optional) name of period before first state change - */ - void start_new_query(const char *initial_state= "Starting") - { - DBUG_ASSERT(!current); - if (unlikely(enabled)) - current= new QUERY_PROFILE(this, initial_state); - } - - void discard_current_query(); - - void finish_current_query() - { - if (unlikely(current)) - finish_current_query_impl(); - } - - void finish_current_query_impl(); - - void status_change(const char *status_arg, - const char *function_arg, - const char *file_arg, unsigned int line_arg) - { - if (unlikely(current)) - current->new_status(status_arg, function_arg, file_arg, line_arg); - } - - inline void set_thd(THD *thd_arg) - { - thd= thd_arg; - reset(); - } - - /* SHOW PROFILES */ - bool show_profiles(); - - /* ... from INFORMATION_SCHEMA.PROFILING ... */ - int fill_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond); - void reset(); - void restart(); -}; - -# endif /* ENABLED_PROFILING */ -#endif /* _SQL_PROFILE_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_reload.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_reload.h deleted file mode 100644 index 699912e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_reload.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef SQL_RELOAD_INCLUDED -#define SQL_RELOAD_INCLUDED -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -class THD; -struct TABLE_LIST; - -bool reload_acl_and_cache(THD *thd, unsigned long long options, - TABLE_LIST *tables, int *write_to_binlog); - -bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables); - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_rename.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_rename.h deleted file mode 100644 index 1f5f94b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_rename.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_RENAME_INCLUDED -#define SQL_RENAME_INCLUDED - -class THD; -struct TABLE_LIST; - -bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent, - bool if_exists); - -#endif /* SQL_RENAME_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_repl.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_repl.h deleted file mode 100644 index 18aa7ea..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_repl.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_REPL_INCLUDED -#define SQL_REPL_INCLUDED - -#include "rpl_filter.h" - -#ifdef HAVE_REPLICATION -#include "slave.h" - -struct slave_connection_state; - -extern my_bool opt_show_slave_auth_info; -extern char *master_host, *master_info_file; - -extern int max_binlog_dump_events; -extern my_bool opt_sporadic_binlog_dump_fail; - -int start_slave(THD* thd, Master_info* mi, bool net_report); -int stop_slave(THD* thd, Master_info* mi, bool net_report); -bool change_master(THD* thd, Master_info* mi, bool *master_info_added); -bool mysql_show_binlog_events(THD* thd); -int reset_slave(THD *thd, Master_info* mi); -int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len, - ulong next_log_number); -bool purge_master_logs(THD* thd, const char* to_log); -bool purge_master_logs_before_date(THD* thd, time_t purge_time); -bool log_in_use(const char* log_name); -void adjust_linfo_offsets(my_off_t purge_offset); -void show_binlogs_get_fields(THD *thd, List *field_list); -bool show_binlogs(THD* thd); -extern int init_master_info(Master_info* mi); -void kill_zombie_dump_threads(uint32 slave_server_id); -int check_binlog_magic(IO_CACHE* log, const char** errmsg); - -struct LOAD_FILE_IO_CACHE : public IO_CACHE -{ - THD* thd; - my_off_t last_pos_in_file; - bool wrote_create_file, log_delayed; - int (*real_read_function)(struct st_io_cache *,uchar *,size_t); -}; - -int log_loaded_block(IO_CACHE* file, uchar *Buffer, size_t Count); -int init_replication_sys_vars(); -void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags); - -#ifdef HAVE_PSI_INTERFACE -extern PSI_mutex_key key_LOCK_slave_state, key_LOCK_binlog_state; -#endif -void rpl_init_gtid_slave_state(); -void rpl_deinit_gtid_slave_state(); -void rpl_init_gtid_waiting(); -void rpl_deinit_gtid_waiting(); -int gtid_state_from_binlog_pos(const char *name, uint32 pos, String *out_str); -int rpl_append_gtid_state(String *dest, bool use_binlog); -int rpl_load_gtid_state(slave_connection_state *state, bool use_binlog); -bool rpl_gtid_pos_check(THD *thd, char *str, size_t len); -bool rpl_gtid_pos_update(THD *thd, char *str, size_t len); -#else - -struct LOAD_FILE_IO_CACHE : public IO_CACHE { }; - -#endif /* HAVE_REPLICATION */ - -#endif /* SQL_REPL_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_schema.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_schema.h deleted file mode 100644 index 886a115..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_schema.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef SQL_SCHEMA_H_INCLUDED -#define SQL_SCHEMA_H_INCLUDED -/* - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "mysqld.h" -#include "lex_string.h" - -class Schema -{ - LEX_CSTRING m_name; -public: - Schema(const LEX_CSTRING &name) - :m_name(name) - { } - virtual ~Schema() { } - const LEX_CSTRING &name() const { return m_name; } - virtual const Type_handler *map_data_type(THD *thd, const Type_handler *src) - const - { - return src; - } - /* - For now we have *hard-coded* compatibility schemas: - schema_mariadb, schema_oracle, schema_maxdb. - But eventually we'll turn then into real databases on disk. - So the code below compares names according to the filesystem - case sensitivity, like it is done for regular databases. - - Note, this is different to information_schema, whose name - is always case insensitive. This is intentional! - The assymetry will be gone when we'll implement SQL standard - regular and delimited identifiers. - */ - bool eq_name(const LEX_CSTRING &name) const - { - return !table_alias_charset->strnncoll(m_name.str, m_name.length, - name.str, name.length); - } - static Schema *find_by_name(const LEX_CSTRING &name); - static Schema *find_implied(THD *thd); -}; - - -extern Schema mariadb_schema; - -#endif // SQL_SCHEMA_H_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_select.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_select.h deleted file mode 100644 index bb9ecf8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_select.h +++ /dev/null @@ -1,2535 +0,0 @@ -#ifndef SQL_SELECT_INCLUDED -#define SQL_SELECT_INCLUDED - -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - - @brief - classes to use when handling where clause -*/ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "procedure.h" -#include "sql_array.h" /* Array */ -#include "records.h" /* READ_RECORD */ -#include "opt_range.h" /* SQL_SELECT, QUICK_SELECT_I */ -#include "filesort.h" - -typedef struct st_join_table JOIN_TAB; -/* Values in optimize */ -#define KEY_OPTIMIZE_EXISTS 1U -#define KEY_OPTIMIZE_REF_OR_NULL 2U -#define KEY_OPTIMIZE_EQ 4U - -inline uint get_hash_join_key_no() { return MAX_KEY; } - -inline bool is_hash_join_key_no(uint key) { return key == MAX_KEY; } - -typedef struct keyuse_t { - TABLE *table; - Item *val; /**< or value if no field */ - table_map used_tables; - uint key, keypart, optimize; - key_part_map keypart_map; - ha_rows ref_table_rows; - /** - If true, the comparison this value was created from will not be - satisfied if val has NULL 'value'. - */ - bool null_rejecting; - /* - !NULL - This KEYUSE was created from an equality that was wrapped into - an Item_func_trig_cond. This means the equality (and validity of - this KEYUSE element) can be turned on and off. The on/off state - is indicted by the pointed value: - *cond_guard == TRUE <=> equality condition is on - *cond_guard == FALSE <=> equality condition is off - - NULL - Otherwise (the source equality can't be turned off) - */ - bool *cond_guard; - /* - 0..64 <=> This was created from semi-join IN-equality # sj_pred_no. - MAX_UINT Otherwise - */ - uint sj_pred_no; - - /* - If this is NULL than KEYUSE is always enabled. - Otherwise it points to the enabling flag for this keyuse (true <=> enabled) - */ - bool *validity_ref; - - bool is_for_hash_join() { return is_hash_join_key_no(key); } -} KEYUSE; - - -struct KEYUSE_EXT: public KEYUSE -{ - /* - This keyuse can be used only when the partial join being extended - contains the tables from this table map - */ - table_map needed_in_prefix; - /* The enabling flag for keyuses usable for splitting */ - bool validity_var; -}; - -/// Used when finding key fields -struct KEY_FIELD { - Field *field; - Item_bool_func *cond; - Item *val; ///< May be empty if diff constant - uint level; - uint optimize; - bool eq_func; - /** - If true, the condition this struct represents will not be satisfied - when val IS NULL. - */ - bool null_rejecting; - bool *cond_guard; /* See KEYUSE::cond_guard */ - uint sj_pred_no; /* See KEYUSE::sj_pred_no */ -}; - - -#define NO_KEYPART ((uint)(-1)) - -class store_key; - -const int NO_REF_PART= uint(-1); - -typedef struct st_table_ref -{ - bool key_err; - /** True if something was read into buffer in join_read_key. */ - bool has_record; - uint key_parts; ///< num of ... - uint key_length; ///< length of key_buff - int key; ///< key no - uchar *key_buff; ///< value to look for with key - uchar *key_buff2; ///< key_buff+key_length - store_key **key_copy; // - - /* - Bitmap of key parts which refer to constants. key_copy only has copiers for - non-const key parts. - */ - key_part_map const_ref_part_map; - - Item **items; ///< val()'s for each keypart - /* - Array of pointers to trigger variables. Some/all of the pointers may be - NULL. The ref access can be used iff - - for each used key part i, (!cond_guards[i] || *cond_guards[i]) - - This array is used by subquery code. The subquery code may inject - triggered conditions, i.e. conditions that can be 'switched off'. A ref - access created from such condition is not valid when at least one of the - underlying conditions is switched off (see subquery code for more details) - */ - bool **cond_guards; - /** - (null_rejecting & (1< disable the "cache" as doing lookup with the same key value may - produce different results (because of Index Condition Pushdown) - - */ - bool disable_cache; - - bool tmp_table_index_lookup_init(THD *thd, KEY *tmp_key, Item_iterator &it, - bool value, uint skip= 0); - bool is_access_triggered(); -} TABLE_REF; - - -/* - The structs which holds the join connections and join states -*/ -enum join_type { JT_UNKNOWN,JT_SYSTEM,JT_CONST,JT_EQ_REF,JT_REF,JT_MAYBE_REF, - JT_ALL, JT_RANGE, JT_NEXT, JT_FT, JT_REF_OR_NULL, - JT_UNIQUE_SUBQUERY, JT_INDEX_SUBQUERY, JT_INDEX_MERGE, - JT_HASH, JT_HASH_RANGE, JT_HASH_NEXT, JT_HASH_INDEX_MERGE}; - -class JOIN; - -enum enum_nested_loop_state -{ - NESTED_LOOP_KILLED= -2, NESTED_LOOP_ERROR= -1, - NESTED_LOOP_OK= 0, NESTED_LOOP_NO_MORE_ROWS= 1, - NESTED_LOOP_QUERY_LIMIT= 3, NESTED_LOOP_CURSOR_LIMIT= 4 -}; - - -/* Possible sj_strategy values */ -enum sj_strategy_enum -{ - SJ_OPT_NONE=0, - SJ_OPT_DUPS_WEEDOUT=1, - SJ_OPT_LOOSE_SCAN =2, - SJ_OPT_FIRST_MATCH =3, - SJ_OPT_MATERIALIZE =4, - SJ_OPT_MATERIALIZE_SCAN=5 -}; - -/* Values for JOIN_TAB::packed_info */ -#define TAB_INFO_HAVE_VALUE 1U -#define TAB_INFO_USING_INDEX 2U -#define TAB_INFO_USING_WHERE 4U -#define TAB_INFO_FULL_SCAN_ON_NULL 8U - -typedef enum_nested_loop_state -(*Next_select_func)(JOIN *, struct st_join_table *, bool); -Next_select_func setup_end_select_func(JOIN *join, JOIN_TAB *tab); -int rr_sequential(READ_RECORD *info); -int rr_sequential_and_unpack(READ_RECORD *info); -Item *remove_pushed_top_conjuncts(THD *thd, Item *cond); -Item *and_new_conditions_to_optimized_cond(THD *thd, Item *cond, - COND_EQUAL **cond_eq, - List &new_conds, - Item::cond_result *cond_value); - -#include "sql_explain.h" - -/************************************************************************************** - * New EXPLAIN structures END - *************************************************************************************/ - -class JOIN_CACHE; -class SJ_TMP_TABLE; -class JOIN_TAB_RANGE; -class AGGR_OP; -class Filesort; -struct SplM_plan_info; -class SplM_opt_info; - -typedef struct st_join_table { - TABLE *table; - TABLE_LIST *tab_list; - KEYUSE *keyuse; /**< pointer to first used key */ - KEY *hj_key; /**< descriptor of the used best hash join key - not supported by any index */ - SQL_SELECT *select; - COND *select_cond; - COND *on_precond; /**< part of on condition to check before - accessing the first inner table */ - QUICK_SELECT_I *quick; - /* - The value of select_cond before we've attempted to do Index Condition - Pushdown. We may need to restore everything back if we first choose one - index but then reconsider (see test_if_skip_sort_order() for such - scenarios). - NULL means no index condition pushdown was performed. - */ - Item *pre_idx_push_select_cond; - /* - Pointer to the associated ON expression. on_expr_ref=!NULL except for - degenerate joins. - - Optimization phase: *on_expr_ref!=NULL for tables that are the single - tables on the inner side of the outer join (t1 LEFT JOIN t2 ON...) - - Execution phase: *on_expr_ref!=NULL for tables that are first inner tables - within an outer join (which may have multiple tables) - */ - Item **on_expr_ref; - COND_EQUAL *cond_equal; /**< multiple equalities for the on expression */ - st_join_table *first_inner; /**< first inner table for including outerjoin */ - bool found; /**< true after all matches or null complement */ - bool not_null_compl;/**< true before null complement is added */ - st_join_table *last_inner; /**< last table table for embedding outer join */ - st_join_table *first_upper; /**< first inner table for embedding outer join */ - st_join_table *first_unmatched; /**< used for optimization purposes only */ - - /* - For join tabs that are inside an SJM bush: root of the bush - */ - st_join_table *bush_root_tab; - - /* TRUE <=> This join_tab is inside an SJM bush and is the last leaf tab here */ - bool last_leaf_in_bush; - - /* - ptr - this is a bush, and ptr points to description of child join_tab - range - NULL - this join tab has no bush children - */ - JOIN_TAB_RANGE *bush_children; - - /* Special content for EXPLAIN 'Extra' column or NULL if none */ - enum explain_extra_tag info; - - Table_access_tracker *tracker; - - Table_access_tracker *jbuf_tracker; - /* - Bitmap of TAB_INFO_* bits that encodes special line for EXPLAIN 'Extra' - column, or 0 if there is no info. - */ - uint packed_info; - - // READ_RECORD::Setup_func materialize_table; - READ_RECORD::Setup_func read_first_record; - Next_select_func next_select; - READ_RECORD read_record; - /* - Currently the following two fields are used only for a [NOT] IN subquery - if it is executed by an alternative full table scan when the left operand of - the subquery predicate is evaluated to NULL. - */ - READ_RECORD::Setup_func save_read_first_record;/* to save read_first_record */ - READ_RECORD::Read_func save_read_record;/* to save read_record.read_record */ - double worst_seeks; - key_map const_keys; /**< Keys with constant part */ - key_map checked_keys; /**< Keys checked in find_best */ - key_map needed_reg; - key_map keys; /**< all keys with can be used */ - - /* Either #rows in the table or 1 for const table. */ - ha_rows records; - /* - Number of records that will be scanned (yes scanned, not returned) by the - best 'independent' access method, i.e. table scan or QUICK_*_SELECT) - */ - ha_rows found_records; - /* - Cost of accessing the table using "ALL" or range/index_merge access - method (but not 'index' for some reason), i.e. this matches method which - E(#records) is in found_records. - */ - double read_time; - - /* Copy of POSITION::records_read, set by get_best_combination() */ - double records_read; - - /* The selectivity of the conditions that can be pushed to the table */ - double cond_selectivity; - - /* Startup cost for execution */ - double startup_cost; - - double partial_join_cardinality; - - table_map dependent,key_dependent; - /* - 1 - use quick select - 2 - use "Range checked for each record" - */ - uint use_quick; - /* - Index to use. Note: this is valid only for 'index' access, but not range or - ref access. - */ - uint index; - uint status; ///< Save status for cache - uint used_fields; - ulong used_fieldlength; - ulong max_used_fieldlength; - uint used_blobs; - uint used_null_fields; - uint used_uneven_bit_fields; - enum join_type type; - bool cached_eq_ref_table,eq_ref_table; - bool shortcut_for_distinct; - bool sorted; - /* - If it's not 0 the number stored this field indicates that the index - scan has been chosen to access the table data and we expect to scan - this number of rows for the table. - */ - ha_rows limit; - TABLE_REF ref; - /* TRUE <=> condition pushdown supports other tables presence */ - bool icp_other_tables_ok; - /* - TRUE <=> condition pushed to the index has to be factored out of - the condition pushed to the table - */ - bool idx_cond_fact_out; - bool use_join_cache; - uint used_join_cache_level; - ulong join_buffer_size_limit; - JOIN_CACHE *cache; - /* - Index condition for BKA access join - */ - Item *cache_idx_cond; - SQL_SELECT *cache_select; - AGGR_OP *aggr; - JOIN *join; - /* - Embedding SJ-nest (may be not the direct parent), or NULL if none. - This variable holds the result of table pullout. - */ - TABLE_LIST *emb_sj_nest; - - /* FirstMatch variables (final QEP) */ - struct st_join_table *first_sj_inner_tab; - struct st_join_table *last_sj_inner_tab; - - /* Variables for semi-join duplicate elimination */ - SJ_TMP_TABLE *flush_weedout_table; - SJ_TMP_TABLE *check_weed_out_table; - /* for EXPLAIN only: */ - SJ_TMP_TABLE *first_weedout_table; - - /** - reference to saved plan and execution statistics - */ - Explain_table_access *explain_plan; - - /* - If set, means we should stop join enumeration after we've got the first - match and return to the specified join tab. May point to - join->join_tab[-1] which means stop join execution after the first - match. - */ - struct st_join_table *do_firstmatch; - - /* - ptr - We're doing a LooseScan, this join tab is the first (i.e. - "driving") join tab), and ptr points to the last join tab - handled by the strategy. loosescan_match_tab->found_match - should be checked to see if the current value group had a match. - NULL - Not doing a loose scan on this join tab. - */ - struct st_join_table *loosescan_match_tab; - - /* TRUE <=> we are inside LooseScan range */ - bool inside_loosescan_range; - - /* Buffer to save index tuple to be able to skip duplicates */ - uchar *loosescan_buf; - - /* - Index used by LooseScan (we store it here separately because ref access - stores it in tab->ref.key, while range scan stores it in tab->index, etc) - */ - uint loosescan_key; - - /* Length of key tuple (depends on #keyparts used) to store in the above */ - uint loosescan_key_len; - - /* Used by LooseScan. TRUE<=> there has been a matching record combination */ - bool found_match; - - /* - Used by DuplicateElimination. tab->table->ref must have the rowid - whenever we have a current record. - */ - int keep_current_rowid; - - /* NestedOuterJoins: Bitmap of nested joins this table is part of */ - nested_join_map embedding_map; - - /* Tmp table info */ - TMP_TABLE_PARAM *tmp_table_param; - - /* Sorting related info */ - Filesort *filesort; - SORT_INFO *filesort_result; - - /* - Non-NULL value means this join_tab must do window function computation - before reading. - */ - Window_funcs_computation* window_funcs_step; - - /** - List of topmost expressions in the select list. The *next* JOIN_TAB - in the plan should use it to obtain correct values. Same applicable to - all_fields. These lists are needed because after tmp tables functions - will be turned to fields. These variables are pointing to - tmp_fields_list[123]. Valid only for tmp tables and the last non-tmp - table in the query plan. - @see JOIN::make_aggr_tables_info() - */ - List *fields; - /** List of all expressions in the select list */ - List *all_fields; - /* - Pointer to the ref array slice which to switch to before sending - records. Valid only for tmp tables. - */ - Ref_ptr_array *ref_array; - - /** Number of records saved in tmp table */ - ha_rows send_records; - - /** HAVING condition for checking prior saving a record into tmp table*/ - Item *having; - - /** TRUE <=> remove duplicates on this table. */ - bool distinct; - - /* - Semi-join strategy to be used for this join table. This is a copy of - POSITION::sj_strategy field. This field is set up by the - fix_semijoin_strategies_for_picked_join_order. - */ - enum sj_strategy_enum sj_strategy; - - uint n_sj_tables; - - bool preread_init_done; - - /* - Cost info to the range filter used when joining this join table - (Defined when the best join order has been already chosen) - */ - Range_rowid_filter_cost_info *range_rowid_filter_info; - /* Rowid filter to be used when joining this join table */ - Rowid_filter *rowid_filter; - /* Becomes true just after the used range filter has been built / filled */ - bool is_rowid_filter_built; - - void build_range_rowid_filter_if_needed(); - - void cleanup(); - inline bool is_using_loose_index_scan() - { - const SQL_SELECT *sel= filesort ? filesort->select : select; - return (sel && sel->quick && - (sel->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)); - } - bool is_using_agg_loose_index_scan () - { - return (is_using_loose_index_scan() && - ((QUICK_GROUP_MIN_MAX_SELECT *)select->quick)->is_agg_distinct()); - } - bool is_inner_table_of_semi_join_with_first_match() - { - return first_sj_inner_tab != NULL; - } - bool is_inner_table_of_semijoin() - { - return emb_sj_nest != NULL; - } - bool is_inner_table_of_outer_join() - { - return first_inner != NULL; - } - bool is_single_inner_of_semi_join_with_first_match() - { - return first_sj_inner_tab == this && last_sj_inner_tab == this; - } - bool is_single_inner_of_outer_join() - { - return first_inner == this && first_inner->last_inner == this; - } - bool is_first_inner_for_outer_join() - { - return first_inner && first_inner == this; - } - bool use_match_flag() - { - return is_first_inner_for_outer_join() || first_sj_inner_tab == this ; - } - bool check_only_first_match() - { - return is_inner_table_of_semi_join_with_first_match() || - (is_inner_table_of_outer_join() && - table->reginfo.not_exists_optimize); - } - bool is_last_inner_table() - { - return (first_inner && first_inner->last_inner == this) || - last_sj_inner_tab == this; - } - /* - Check whether the table belongs to a nest of inner tables of an - outer join or to a nest of inner tables of a semi-join - */ - bool is_nested_inner() - { - if (first_inner && - (first_inner != first_inner->last_inner || first_inner->first_upper)) - return TRUE; - if (first_sj_inner_tab && first_sj_inner_tab != last_sj_inner_tab) - return TRUE; - return FALSE; - } - struct st_join_table *get_first_inner_table() - { - if (first_inner) - return first_inner; - return first_sj_inner_tab; - } - void set_select_cond(COND *to, uint line) - { - DBUG_PRINT("info", ("select_cond changes %p -> %p at line %u tab %p", - select_cond, to, line, this)); - select_cond= to; - } - COND *set_cond(COND *new_cond) - { - COND *tmp_select_cond= select_cond; - set_select_cond(new_cond, __LINE__); - if (select) - select->cond= new_cond; - return tmp_select_cond; - } - void calc_used_field_length(bool max_fl); - ulong get_used_fieldlength() - { - if (!used_fieldlength) - calc_used_field_length(FALSE); - return used_fieldlength; - } - ulong get_max_used_fieldlength() - { - if (!max_used_fieldlength) - calc_used_field_length(TRUE); - return max_used_fieldlength; - } - double get_partial_join_cardinality() { return partial_join_cardinality; } - bool hash_join_is_possible(); - int make_scan_filter(); - bool is_ref_for_hash_join() { return is_hash_join_key_no(ref.key); } - KEY *get_keyinfo_by_key_no(uint key) - { - return (is_hash_join_key_no(key) ? hj_key : table->key_info+key); - } - double scan_time(); - ha_rows get_examined_rows(); - bool preread_init(); - - bool pfs_batch_update(JOIN *join); - - bool is_sjm_nest() { return MY_TEST(bush_children); } - - /* - If this join_tab reads a non-merged semi-join (also called jtbm), return - the select's number. Otherwise, return 0. - */ - int get_non_merged_semijoin_select() const - { - Item_in_subselect *subq; - if (table->pos_in_table_list && - (subq= table->pos_in_table_list->jtbm_subselect)) - { - return subq->unit->first_select()->select_number; - } - return 0; /* Not a merged semi-join */ - } - - bool access_from_tables_is_allowed(table_map used_tables, - table_map sjm_lookup_tables) - { - table_map used_sjm_lookup_tables= used_tables & sjm_lookup_tables; - return !used_sjm_lookup_tables || - (emb_sj_nest && - !(used_sjm_lookup_tables & ~emb_sj_nest->sj_inner_tables)); - } - - bool keyuse_is_valid_for_access_in_chosen_plan(JOIN *join, KEYUSE *keyuse); - - void remove_redundant_bnl_scan_conds(); - - bool save_explain_data(Explain_table_access *eta, table_map prefix_tables, - bool distinct, struct st_join_table *first_top_tab); - - bool use_order() const; ///< Use ordering provided by chosen index? - bool sort_table(); - bool remove_duplicates(); - - void partial_cleanup(); - void add_keyuses_for_splitting(); - SplM_plan_info *choose_best_splitting(double record_count, - table_map remaining_tables); - bool fix_splitting(SplM_plan_info *spl_plan, table_map remaining_tables, - bool is_const_table); -} JOIN_TAB; - - -#include "sql_join_cache.h" - -enum_nested_loop_state -sub_select_cache(JOIN *join, JOIN_TAB *join_tab, bool end_of_records); -enum_nested_loop_state -sub_select(JOIN *join, JOIN_TAB *join_tab, bool end_of_records); -enum_nested_loop_state -sub_select_postjoin_aggr(JOIN *join, JOIN_TAB *join_tab, bool end_of_records); - -enum_nested_loop_state -end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), - bool end_of_records); -enum_nested_loop_state -end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), - bool end_of_records); - - -struct st_position; - -class Semi_join_strategy_picker -{ -public: - /* Called when starting to build a new join prefix */ - virtual void set_empty() = 0; - - /* - Update internal state after another table has been added to the join - prefix - */ - virtual void set_from_prev(struct st_position *prev) = 0; - - virtual bool check_qep(JOIN *join, - uint idx, - table_map remaining_tables, - const JOIN_TAB *new_join_tab, - double *record_count, - double *read_time, - table_map *handled_fanout, - sj_strategy_enum *strategy, - struct st_position *loose_scan_pos) = 0; - - virtual void mark_used() = 0; - - virtual ~Semi_join_strategy_picker() {} -}; - - -/* - Duplicate Weedout strategy optimization state -*/ - -class Duplicate_weedout_picker : public Semi_join_strategy_picker -{ - /* The first table that the strategy will need to handle */ - uint first_dupsweedout_table; - - /* - Tables that we will need to have in the prefix to do the weedout step - (all inner and all outer that the involved semi-joins are correlated with) - */ - table_map dupsweedout_tables; - - bool is_used; -public: - void set_empty() - { - dupsweedout_tables= 0; - first_dupsweedout_table= MAX_TABLES; - is_used= FALSE; - } - void set_from_prev(struct st_position *prev); - - bool check_qep(JOIN *join, - uint idx, - table_map remaining_tables, - const JOIN_TAB *new_join_tab, - double *record_count, - double *read_time, - table_map *handled_fanout, - sj_strategy_enum *stratey, - struct st_position *loose_scan_pos); - - void mark_used() { is_used= TRUE; } - friend void fix_semijoin_strategies_for_picked_join_order(JOIN *join); -}; - - -class Firstmatch_picker : public Semi_join_strategy_picker -{ - /* - Index of the first inner table that we intend to handle with this - strategy - */ - uint first_firstmatch_table; - /* - Tables that were not in the join prefix when we've started considering - FirstMatch strategy. - */ - table_map first_firstmatch_rtbl; - /* - Tables that need to be in the prefix before we can calculate the cost - of using FirstMatch strategy. - */ - table_map firstmatch_need_tables; - - bool is_used; - - bool in_firstmatch_prefix() { return (first_firstmatch_table != MAX_TABLES); } - void invalidate_firstmatch_prefix() { first_firstmatch_table= MAX_TABLES; } -public: - void set_empty() - { - invalidate_firstmatch_prefix(); - is_used= FALSE; - } - - void set_from_prev(struct st_position *prev); - bool check_qep(JOIN *join, - uint idx, - table_map remaining_tables, - const JOIN_TAB *new_join_tab, - double *record_count, - double *read_time, - table_map *handled_fanout, - sj_strategy_enum *strategy, - struct st_position *loose_scan_pos); - - void mark_used() { is_used= TRUE; } - friend void fix_semijoin_strategies_for_picked_join_order(JOIN *join); -}; - - -class LooseScan_picker : public Semi_join_strategy_picker -{ - /* The first (i.e. driving) table we're doing loose scan for */ - uint first_loosescan_table; - /* - Tables that need to be in the prefix before we can calculate the cost - of using LooseScan strategy. - */ - table_map loosescan_need_tables; - - /* - keyno - Planning to do LooseScan on this key. If keyuse is NULL then - this is a full index scan, otherwise this is a ref+loosescan - scan (and keyno matches the KEUSE's) - MAX_KEY - Not doing a LooseScan - */ - uint loosescan_key; // final (one for strategy instance ) - uint loosescan_parts; /* Number of keyparts to be kept distinct */ - - bool is_used; -public: - void set_empty() - { - first_loosescan_table= MAX_TABLES; - is_used= FALSE; - } - - void set_from_prev(struct st_position *prev); - bool check_qep(JOIN *join, - uint idx, - table_map remaining_tables, - const JOIN_TAB *new_join_tab, - double *record_count, - double *read_time, - table_map *handled_fanout, - sj_strategy_enum *strategy, - struct st_position *loose_scan_pos); - void mark_used() { is_used= TRUE; } - - friend class Loose_scan_opt; - friend void best_access_path(JOIN *join, - JOIN_TAB *s, - table_map remaining_tables, - const struct st_position *join_positions, - uint idx, - bool disable_jbuf, - double record_count, - struct st_position *pos, - struct st_position *loose_scan_pos); - friend bool get_best_combination(JOIN *join); - friend int setup_semijoin_loosescan(JOIN *join); - friend void fix_semijoin_strategies_for_picked_join_order(JOIN *join); -}; - - -class Sj_materialization_picker : public Semi_join_strategy_picker -{ - bool is_used; - - /* The last inner table (valid once we're after it) */ - uint sjm_scan_last_inner; - /* - Tables that we need to have in the prefix to calculate the correct cost. - Basically, we need all inner tables and outer tables mentioned in the - semi-join's ON expression so we can correctly account for fanout. - */ - table_map sjm_scan_need_tables; - -public: - void set_empty() - { - sjm_scan_need_tables= 0; - sjm_scan_last_inner= 0; - is_used= FALSE; - } - void set_from_prev(struct st_position *prev); - bool check_qep(JOIN *join, - uint idx, - table_map remaining_tables, - const JOIN_TAB *new_join_tab, - double *record_count, - double *read_time, - table_map *handled_fanout, - sj_strategy_enum *strategy, - struct st_position *loose_scan_pos); - void mark_used() { is_used= TRUE; } - - friend void fix_semijoin_strategies_for_picked_join_order(JOIN *join); -}; - - -class Range_rowid_filter_cost_info; -class Rowid_filter; - - -/** - Information about a position of table within a join order. Used in join - optimization. -*/ -typedef struct st_position -{ - /* The table that's put into join order */ - JOIN_TAB *table; - - /* - The "fanout": number of output rows that will be produced (after - pushed down selection condition is applied) per each row combination of - previous tables. - */ - double records_read; - - /* The selectivity of the pushed down conditions */ - double cond_selectivity; - - /* - Cost accessing the table in course of the entire complete join execution, - i.e. cost of one access method use (e.g. 'range' or 'ref' scan ) times - number the access method will be invoked. - */ - double read_time; - - /* Cumulative cost and record count for the join prefix */ - Cost_estimate prefix_cost; - double prefix_record_count; - - /* - NULL - 'index' or 'range' or 'index_merge' or 'ALL' access is used. - Other - [eq_]ref[_or_null] access is used. Pointer to {t.keypart1 = expr} - */ - KEYUSE *key; - - /* If ref-based access is used: bitmap of tables this table depends on */ - table_map ref_depend_map; - - /* - TRUE <=> join buffering will be used. At the moment this is based on - *very* imprecise guesses made in best_access_path(). - */ - bool use_join_buffer; - - /* - Current optimization state: Semi-join strategy to be used for this - and preceding join tables. - - Join optimizer sets this for the *last* join_tab in the - duplicate-generating range. That is, in order to interpret this field, - one needs to traverse join->[best_]positions array from right to left. - When you see a join table with sj_strategy!= SJ_OPT_NONE, some other - field (depending on the strategy) tells how many preceding positions - this applies to. The values of covered_preceding_positions->sj_strategy - must be ignored. - */ - enum sj_strategy_enum sj_strategy; - - /* - Valid only after fix_semijoin_strategies_for_picked_join_order() call: - if sj_strategy!=SJ_OPT_NONE, this is the number of subsequent tables that - are covered by the specified semi-join strategy - */ - uint n_sj_tables; - - /* - Bitmap of semi-join inner tables that are in the join prefix and for - which there's no provision for how to eliminate semi-join duplicates - they produce. - */ - table_map dups_producing_tables; - - table_map inner_tables_handled_with_other_sjs; - - Duplicate_weedout_picker dups_weedout_picker; - Firstmatch_picker firstmatch_picker; - LooseScan_picker loosescan_picker; - Sj_materialization_picker sjmat_picker; - - /* Info on splitting plan used at this position */ - SplM_plan_info *spl_plan; - - /* Cost info for the range filter used at this position */ - Range_rowid_filter_cost_info *range_rowid_filter_info; - -} POSITION; - -typedef Bounds_checked_array Item_null_array; - -typedef struct st_rollup -{ - enum State { STATE_NONE, STATE_INITED, STATE_READY }; - State state; - Item_null_array null_items; - Ref_ptr_array *ref_pointer_arrays; - List *fields; -} ROLLUP; - - -class JOIN_TAB_RANGE: public Sql_alloc -{ -public: - JOIN_TAB *start; - JOIN_TAB *end; -}; - -class Pushdown_query; - -/** - @brief - Class to perform postjoin aggregation operations - - @details - The result records are obtained on the put_record() call. - The aggrgation process is determined by the write_func, it could be: - end_write Simply store all records in tmp table. - end_write_group Perform grouping using join->group_fields, - records are expected to be sorted. - end_update Perform grouping using the key generated on tmp - table. Input records aren't expected to be sorted. - Tmp table uses the heap engine - end_update_unique Same as above, but the engine is myisam. - - Lazy table initialization is used - the table will be instantiated and - rnd/index scan started on the first put_record() call. - -*/ - -class AGGR_OP :public Sql_alloc -{ -public: - JOIN_TAB *join_tab; - - AGGR_OP(JOIN_TAB *tab) : join_tab(tab), write_func(NULL) - {}; - - enum_nested_loop_state put_record() { return put_record(false); }; - /* - Send the result of operation further (to a next operation/client) - This function is called after all records were put into tmp table. - - @return return one of enum_nested_loop_state values. - */ - enum_nested_loop_state end_send(); - /** write_func setter */ - void set_write_func(Next_select_func new_write_func) - { - write_func= new_write_func; - } - -private: - /** Write function that would be used for saving records in tmp table. */ - Next_select_func write_func; - enum_nested_loop_state put_record(bool end_of_records); - bool prepare_tmp_table(); -}; - - -class JOIN :public Sql_alloc -{ -private: - JOIN(const JOIN &rhs); /**< not implemented */ - JOIN& operator=(const JOIN &rhs); /**< not implemented */ - -protected: - - /** - The subset of the state of a JOIN that represents an optimized query - execution plan. Allows saving/restoring different JOIN plans for the same - query. - */ - class Join_plan_state { - public: - DYNAMIC_ARRAY keyuse; /* Copy of the JOIN::keyuse array. */ - POSITION *best_positions; /* Copy of JOIN::best_positions */ - /* Copies of the JOIN_TAB::keyuse pointers for each JOIN_TAB. */ - KEYUSE **join_tab_keyuse; - /* Copies of JOIN_TAB::checked_keys for each JOIN_TAB. */ - key_map *join_tab_checked_keys; - SJ_MATERIALIZATION_INFO **sj_mat_info; - my_bool error; - public: - Join_plan_state(uint tables) : error(0) - { - keyuse.elements= 0; - keyuse.buffer= NULL; - keyuse.malloc_flags= 0; - best_positions= 0; /* To detect errors */ - error= my_multi_malloc(PSI_INSTRUMENT_ME, MYF(MY_WME), - &best_positions, - sizeof(*best_positions) * (tables + 1), - &join_tab_keyuse, - sizeof(*join_tab_keyuse) * tables, - &join_tab_checked_keys, - sizeof(*join_tab_checked_keys) * tables, - &sj_mat_info, - sizeof(sj_mat_info) * tables, - NullS) == 0; - } - Join_plan_state(JOIN *join); - ~Join_plan_state() - { - delete_dynamic(&keyuse); - my_free(best_positions); - } - }; - - /* Results of reoptimizing a JOIN via JOIN::reoptimize(). */ - enum enum_reopt_result { - REOPT_NEW_PLAN, /* there is a new reoptimized plan */ - REOPT_OLD_PLAN, /* no new improved plan can be found, use the old one */ - REOPT_ERROR, /* an irrecovarable error occurred during reoptimization */ - REOPT_NONE /* not yet reoptimized */ - }; - - /* Support for plan reoptimization with rewritten conditions. */ - enum_reopt_result reoptimize(Item *added_where, table_map join_tables, - Join_plan_state *save_to); - /* Choose a subquery plan for a table-less subquery. */ - bool choose_tableless_subquery_plan(); - void handle_implicit_grouping_with_window_funcs(); - -public: - void save_query_plan(Join_plan_state *save_to); - void reset_query_plan(); - void restore_query_plan(Join_plan_state *restore_from); - -public: - JOIN_TAB *join_tab, **best_ref; - - /* List of fields that aren't under an aggregate function */ - List non_agg_fields; - - JOIN_TAB **map2table; ///< mapping between table indexes and JOIN_TABs - List join_tab_ranges; - - /* - Base tables participating in the join. After join optimization is done, the - tables are stored in the join order (but the only really important part is - that const tables are first). - */ - TABLE **table; - /** - The table which has an index that allows to produce the requried ordering. - A special value of 0x1 means that the ordering will be produced by - passing 1st non-const table to filesort(). NULL means no such table exists. - */ - TABLE *sort_by_table; - /* - Number of tables in the join. - (In MySQL, it is named 'tables' and is also the number of elements in - join->join_tab array. In MariaDB, the latter is not true, so we've renamed - the variable) - */ - uint table_count; - uint outer_tables; /**< Number of tables that are not inside semijoin */ - uint const_tables; - /* - Number of tables in the top join_tab array. Normally this matches - (join_tab_ranges.head()->end - join_tab_ranges.head()->start). - - We keep it here so that it is saved/restored with JOIN::restore_tmp. - */ - uint top_join_tab_count; - uint aggr_tables; ///< Number of post-join tmp tables - uint send_group_parts; - /* - True if the query has GROUP BY. - (that is, if group_by != NULL. when DISTINCT is converted into GROUP BY, it - will set this, too. It is not clear why we need a separate var from - group_list) - */ - bool group; - bool need_distinct; - - /** - Indicates that grouping will be performed on the result set during - query execution. This field belongs to query execution. - - @see make_group_fields, alloc_group_fields, JOIN::exec - */ - bool sort_and_group; - bool first_record,full_join, no_field_update; - bool hash_join; - bool do_send_rows; - table_map const_table_map; - /** - Bitmap of semijoin tables that the current partial plan decided - to materialize and access by lookups - */ - table_map sjm_lookup_tables; - /** - Bitmap of semijoin tables that the chosen plan decided - to materialize to scan the results of materialization - */ - table_map sjm_scan_tables; - /* - Constant tables for which we have found a row (as opposed to those for - which we didn't). - */ - table_map found_const_table_map; - - /* Tables removed by table elimination. Set to 0 before the elimination. */ - table_map eliminated_tables; - /* - Bitmap of all inner tables from outer joins (set at start of - make_join_statistics) - */ - table_map outer_join; - /* Bitmap of tables used in the select list items */ - table_map select_list_used_tables; - ha_rows send_records,found_records,join_examined_rows; - - /* - LIMIT for the JOIN operation. When not using aggregation or DISITNCT, this - is the same as select's LIMIT clause specifies. - Note that this doesn't take sql_calc_found_rows into account. - */ - ha_rows row_limit; - - /* - How many output rows should be produced after GROUP BY. - (if sql_calc_found_rows is used, LIMIT is ignored) - */ - ha_rows select_limit; - /* - Number of duplicate rows found in UNION. - */ - ha_rows duplicate_rows; - /** - Used to fetch no more than given amount of rows per one - fetch operation of server side cursor. - The value is checked in end_send and end_send_group in fashion, similar - to offset_limit_cnt: - - fetch_limit= HA_POS_ERROR if there is no cursor. - - when we open a cursor, we set fetch_limit to 0, - - on each fetch iteration we add num_rows to fetch to fetch_limit - NOTE: currently always HA_POS_ERROR. - */ - ha_rows fetch_limit; - - /* Finally picked QEP. This is result of join optimization */ - POSITION *best_positions; - - Pushdown_query *pushdown_query; - JOIN_TAB *original_join_tab; - uint original_table_count; - -/******* Join optimization state members start *******/ - /* - pointer - we're doing optimization for a semi-join materialization nest. - NULL - otherwise - */ - TABLE_LIST *emb_sjm_nest; - - /* Current join optimization state */ - POSITION *positions; - - /* - Bitmap of nested joins embedding the position at the end of the current - partial join (valid only during join optimizer run). - */ - nested_join_map cur_embedding_map; - - /* - Bitmap of inner tables of semi-join nests that have a proper subset of - their tables in the current join prefix. That is, of those semi-join - nests that have their tables both in and outside of the join prefix. - */ - table_map cur_sj_inner_tables; - - /* We also maintain a stack of join optimization states in * join->positions[] */ -/******* Join optimization state members end *******/ - - /* - Tables within complex firstmatch ranges (i.e. those where inner tables are - interleaved with outer tables). Join buffering cannot be used for these. - */ - table_map complex_firstmatch_tables; - - Next_select_func first_select; - /* - The cost of best complete join plan found so far during optimization, - after optimization phase - cost of picked join order (not taking into - account the changes made by test_if_skip_sort_order()). - */ - double best_read; - /* - Estimated result rows (fanout) of the join operation. If this is a subquery - that is reexecuted multiple times, this value includes the estiamted # of - reexecutions. This value is equal to the multiplication of all - join->positions[i].records_read of a JOIN. - */ - double join_record_count; - List *fields; - List group_fields, group_fields_cache; - THD *thd; - Item_sum **sum_funcs, ***sum_funcs_end; - /** second copy of sumfuncs (for queries with 2 temporary tables */ - Item_sum **sum_funcs2, ***sum_funcs_end2; - Procedure *procedure; - Item *having; - Item *tmp_having; ///< To store having when processed temporary table - Item *having_history; ///< Store having for explain - ORDER *group_list_for_estimates; - bool having_is_correlated; - ulonglong select_options; - /* - Bitmap of allowed types of the join caches that - can be used for join operations - */ - uint allowed_join_cache_types; - bool allowed_semijoin_with_cache; - bool allowed_outer_join_with_cache; - /* Maximum level of the join caches that can be used for join operations */ - uint max_allowed_join_cache_level; - select_result *result; - TMP_TABLE_PARAM tmp_table_param; - MYSQL_LOCK *lock; - /// unit structure (with global parameters) for this select - SELECT_LEX_UNIT *unit; - /// select that processed - SELECT_LEX *select_lex; - /** - TRUE <=> optimizer must not mark any table as a constant table. - This is needed for subqueries in form "a IN (SELECT .. UNION SELECT ..): - when we optimize the select that reads the results of the union from a - temporary table, we must not mark the temp. table as constant because - the number of rows in it may vary from one subquery execution to another. - */ - bool no_const_tables; - /* - This flag is set if we call no_rows_in_result() as par of end_group(). - This is used as a simple speed optimization to avoiding calling - restore_no_rows_in_result() in ::reinit() - */ - bool no_rows_in_result_called; - - /** - This is set if SQL_CALC_ROWS was calculated by filesort() - and should be taken from the appropriate JOIN_TAB - */ - bool filesort_found_rows; - - bool subq_exit_fl; - - ROLLUP rollup; ///< Used with rollup - - bool mixed_implicit_grouping; - bool select_distinct; ///< Set if SELECT DISTINCT - /** - If we have the GROUP BY statement in the query, - but the group_list was emptied by optimizer, this - flag is TRUE. - It happens when fields in the GROUP BY are from - constant table - */ - bool group_optimized_away; - - /* - simple_xxxxx is set if ORDER/GROUP BY doesn't include any references - to other tables than the first non-constant table in the JOIN. - It's also set if ORDER/GROUP BY is empty. - Used for deciding for or against using a temporary table to compute - GROUP/ORDER BY. - */ - bool simple_order, simple_group; - - /* - ordered_index_usage is set if an ordered index access - should be used instead of a filesort when computing - ORDER/GROUP BY. - */ - enum - { - ordered_index_void, // No ordered index avail. - ordered_index_group_by, // Use index for GROUP BY - ordered_index_order_by // Use index for ORDER BY - } ordered_index_usage; - - /** - Is set only in case if we have a GROUP BY clause - and no ORDER BY after constant elimination of 'order'. - */ - bool no_order; - /** Is set if we have a GROUP BY and we have ORDER BY on a constant. */ - bool skip_sort_order; - - bool need_tmp; - bool hidden_group_fields; - /* TRUE if there was full cleunap of the JOIN */ - bool cleaned; - DYNAMIC_ARRAY keyuse; - Item::cond_result cond_value, having_value; - /** - Impossible where after reading const tables - (set in make_join_statistics()) - */ - bool impossible_where; - List all_fields; ///< to store all fields that used in query - ///Above list changed to use temporary table - List tmp_all_fields1, tmp_all_fields2, tmp_all_fields3; - ///Part, shared with list above, emulate following list - List tmp_fields_list1, tmp_fields_list2, tmp_fields_list3; - List &fields_list; ///< hold field list passed to mysql_select - List procedure_fields_list; - int error; - - ORDER *order, *group_list, *proc_param; //hold parameters of mysql_select - COND *conds; // ---"--- - Item *conds_history; // store WHERE for explain - COND *outer_ref_cond; /// *join_list; ///< list of joined tables in reverse order - COND_EQUAL *cond_equal; - COND_EQUAL *having_equal; - /* - Constant codition computed during optimization, but evaluated during - join execution. Typically expensive conditions that should not be - evaluated at optimization time. - */ - Item *exec_const_cond; - /* - Constant ORDER and/or GROUP expressions that contain subqueries. Such - expressions need to evaluated to verify that the subquery indeed - returns a single row. The evaluation of such expressions is delayed - until query execution. - */ - List exec_const_order_group_cond; - SQL_SELECT *select; ///ref_pointer_array contains five "slices" of the same length: - |========|========|========|========|========| - ref_ptrs items0 items1 items2 items3 - */ - Ref_ptr_array ref_ptrs; - // Copy of the initial slice above, to be used with different lists - Ref_ptr_array items0, items1, items2, items3; - // Used by rollup, to restore ref_ptrs after overwriting it. - Ref_ptr_array current_ref_ptrs; - - const char *zero_result_cause; ///< not 0 if exec must return zero result - - bool union_part; ///< this subselect is part of union - - enum join_optimization_state { NOT_OPTIMIZED=0, - OPTIMIZATION_IN_PROGRESS=1, - OPTIMIZATION_PHASE_1_DONE=2, - OPTIMIZATION_DONE=3}; - // state of JOIN optimization - enum join_optimization_state optimization_state; - bool initialized; ///< flag to avoid double init_execution calls - - Explain_select *explain; - - enum { QEP_NOT_PRESENT_YET, QEP_AVAILABLE, QEP_DELETED} have_query_plan; - - // if keep_current_rowid=true, whether they should be saved in temporary table - bool tmp_table_keep_current_rowid; - - /* - Additional WHERE and HAVING predicates to be considered for IN=>EXISTS - subquery transformation of a JOIN object. - */ - Item *in_to_exists_where; - Item *in_to_exists_having; - - /* Temporary tables used to weed-out semi-join duplicates */ - List
sj_tmp_tables; - /* SJM nests that are executed with SJ-Materialization strategy */ - List sjm_info_list; - - /** TRUE <=> ref_pointer_array is set to items3. */ - bool set_group_rpa; - /** Exec time only: TRUE <=> current group has been sent */ - bool group_sent; - /** - TRUE if the query contains an aggregate function but has no GROUP - BY clause. - */ - bool implicit_grouping; - - bool with_two_phase_optimization; - - /* Saved execution plan for this join */ - Join_plan_state *save_qep; - /* Info on splittability of the table materialized by this plan*/ - SplM_opt_info *spl_opt_info; - /* Contains info on keyuses usable for splitting */ - Dynamic_array *ext_keyuses_for_splitting; - - JOIN_TAB *sort_and_group_aggr_tab; - /* - Flag is set to true if select_lex was found to be degenerated before - the optimize_cond() call in JOIN::optimize_inner() method. - */ - bool is_orig_degenerated; - - JOIN(THD *thd_arg, List &fields_arg, ulonglong select_options_arg, - select_result *result_arg) - :fields_list(fields_arg) - { - init(thd_arg, fields_arg, select_options_arg, result_arg); - } - - void init(THD *thd_arg, List &fields_arg, ulonglong select_options_arg, - select_result *result_arg) - { - join_tab= 0; - table= 0; - table_count= 0; - top_join_tab_count= 0; - const_tables= 0; - const_table_map= found_const_table_map= 0; - aggr_tables= 0; - eliminated_tables= 0; - join_list= 0; - implicit_grouping= FALSE; - sort_and_group= 0; - first_record= 0; - do_send_rows= 1; - duplicate_rows= send_records= 0; - found_records= 0; - fetch_limit= HA_POS_ERROR; - thd= thd_arg; - sum_funcs= sum_funcs2= 0; - procedure= 0; - having= tmp_having= having_history= 0; - having_is_correlated= false; - group_list_for_estimates= 0; - select_options= select_options_arg; - result= result_arg; - lock= thd_arg->lock; - select_lex= 0; //for safety - select_distinct= MY_TEST(select_options & SELECT_DISTINCT); - no_order= 0; - simple_order= 0; - simple_group= 0; - ordered_index_usage= ordered_index_void; - need_distinct= 0; - skip_sort_order= 0; - with_two_phase_optimization= 0; - save_qep= 0; - spl_opt_info= 0; - ext_keyuses_for_splitting= 0; - spl_opt_info= 0; - need_tmp= 0; - hidden_group_fields= 0; /*safety*/ - error= 0; - select= 0; - return_tab= 0; - ref_ptrs.reset(); - items0.reset(); - items1.reset(); - items2.reset(); - items3.reset(); - zero_result_cause= 0; - optimization_state= JOIN::NOT_OPTIMIZED; - have_query_plan= QEP_NOT_PRESENT_YET; - initialized= 0; - cleaned= 0; - cond_equal= 0; - having_equal= 0; - exec_const_cond= 0; - group_optimized_away= 0; - no_rows_in_result_called= 0; - positions= best_positions= 0; - pushdown_query= 0; - original_join_tab= 0; - explain= NULL; - tmp_table_keep_current_rowid= 0; - - all_fields= fields_arg; - if (&fields_list != &fields_arg) /* Avoid valgrind-warning */ - fields_list= fields_arg; - non_agg_fields.empty(); - bzero((char*) &keyuse,sizeof(keyuse)); - tmp_table_param.init(); - tmp_table_param.end_write_records= HA_POS_ERROR; - rollup.state= ROLLUP::STATE_NONE; - - no_const_tables= FALSE; - first_select= sub_select; - set_group_rpa= false; - group_sent= 0; - - outer_ref_cond= pseudo_bits_cond= NULL; - in_to_exists_where= NULL; - in_to_exists_having= NULL; - emb_sjm_nest= NULL; - sjm_lookup_tables= 0; - sjm_scan_tables= 0; - is_orig_degenerated= false; - } - - /* True if the plan guarantees that it will be returned zero or one row */ - bool only_const_tables() { return const_tables == table_count; } - /* Number of tables actually joined at the top level */ - uint exec_join_tab_cnt() { return tables_list ? top_join_tab_count : 0; } - - /* - Number of tables in the join which also includes the temporary tables - created for GROUP BY, DISTINCT , WINDOW FUNCTION etc. - */ - uint total_join_tab_cnt() - { - return exec_join_tab_cnt() + aggr_tables - 1; - } - - int prepare(TABLE_LIST *tables, COND *conds, uint og_num, ORDER *order, - bool skip_order_by, ORDER *group, Item *having, - ORDER *proc_param, SELECT_LEX *select, SELECT_LEX_UNIT *unit); - bool prepare_stage2(); - int optimize(); - int optimize_inner(); - int optimize_stage2(); - bool build_explain(); - int reinit(); - int init_execution(); - void exec(); - - void exec_inner(); - bool prepare_result(List **columns_list); - int destroy(); - void restore_tmp(); - bool alloc_func_list(); - bool flatten_subqueries(); - bool optimize_unflattened_subqueries(); - bool optimize_constant_subqueries(); - bool make_range_rowid_filters(); - bool init_range_rowid_filters(); - bool make_sum_func_list(List &all_fields, List &send_fields, - bool before_group_by, bool recompute= FALSE); - - /// Initialzes a slice, see comments for ref_ptrs above. - Ref_ptr_array ref_ptr_array_slice(size_t slice_num) - { - size_t slice_sz= select_lex->ref_pointer_array.size() / 5U; - DBUG_ASSERT(select_lex->ref_pointer_array.size() % 5 == 0); - DBUG_ASSERT(slice_num < 5U); - return Ref_ptr_array(&select_lex->ref_pointer_array[slice_num * slice_sz], - slice_sz); - } - - /** - Overwrites one slice with the contents of another slice. - In the normal case, dst and src have the same size(). - However: the rollup slices may have smaller size than slice_sz. - */ - void copy_ref_ptr_array(Ref_ptr_array dst_arr, Ref_ptr_array src_arr) - { - DBUG_ASSERT(dst_arr.size() >= src_arr.size()); - if (src_arr.size() == 0) - return; - - void *dest= dst_arr.array(); - const void *src= src_arr.array(); - memcpy(dest, src, src_arr.size() * src_arr.element_size()); - } - - /// Overwrites 'ref_ptrs' and remembers the the source as 'current'. - void set_items_ref_array(Ref_ptr_array src_arr) - { - copy_ref_ptr_array(ref_ptrs, src_arr); - current_ref_ptrs= src_arr; - } - - /// Initializes 'items0' and remembers that it is 'current'. - void init_items_ref_array() - { - items0= ref_ptr_array_slice(1); - copy_ref_ptr_array(items0, ref_ptrs); - current_ref_ptrs= items0; - } - - bool rollup_init(); - bool rollup_process_const_fields(); - bool rollup_make_fields(List &all_fields, List &fields, - Item_sum ***func); - int rollup_send_data(uint idx); - int rollup_write_data(uint idx, TMP_TABLE_PARAM *tmp_table_param, TABLE *table); - void join_free(); - /** Cleanup this JOIN, possibly for reuse */ - void cleanup(bool full); - void clear(); - bool send_row_on_empty_set() - { - return (do_send_rows && implicit_grouping && !group_optimized_away && - having_value != Item::COND_FALSE); - } - bool empty_result() { return (zero_result_cause && !implicit_grouping); } - bool change_result(select_result *new_result, select_result *old_result); - bool is_top_level_join() const - { - return (unit == &thd->lex->unit && (unit->fake_select_lex == 0 || - select_lex == unit->fake_select_lex)); - } - void cache_const_exprs(); - inline table_map all_tables_map() - { - return (table_map(1) << table_count) - 1; - } - void drop_unused_derived_keys(); - bool get_best_combination(); - bool add_sorting_to_table(JOIN_TAB *tab, ORDER *order); - inline void eval_select_list_used_tables(); - /* - Return the table for which an index scan can be used to satisfy - the sort order needed by the ORDER BY/(implicit) GROUP BY clause - */ - JOIN_TAB *get_sort_by_join_tab() - { - return (need_tmp || !sort_by_table || skip_sort_order || - ((group || tmp_table_param.sum_func_count) && !group_list)) ? - NULL : join_tab+const_tables; - } - bool setup_subquery_caches(); - bool shrink_join_buffers(JOIN_TAB *jt, - ulonglong curr_space, - ulonglong needed_space); - void set_allowed_join_cache_types(); - bool is_allowed_hash_join_access() - { - return MY_TEST(allowed_join_cache_types & JOIN_CACHE_HASHED_BIT) && - max_allowed_join_cache_level > JOIN_CACHE_HASHED_BIT; - } - /* - Check if we need to create a temporary table. - This has to be done if all tables are not already read (const tables) - and one of the following conditions holds: - - We are using DISTINCT (simple distinct's are already optimized away) - - We are using an ORDER BY or GROUP BY on fields not in the first table - - We are using different ORDER BY and GROUP BY orders - - The user wants us to buffer the result. - - We are using WINDOW functions. - When the WITH ROLLUP modifier is present, we cannot skip temporary table - creation for the DISTINCT clause just because there are only const tables. - */ - bool test_if_need_tmp_table() - { - return ((const_tables != table_count && - ((select_distinct || !simple_order || !simple_group) || - (group_list && order) || - MY_TEST(select_options & OPTION_BUFFER_RESULT))) || - (rollup.state != ROLLUP::STATE_NONE && select_distinct) || - select_lex->have_window_funcs()); - } - bool choose_subquery_plan(table_map join_tables); - void get_partial_cost_and_fanout(int end_tab_idx, - table_map filter_map, - double *read_time_arg, - double *record_count_arg); - void get_prefix_cost_and_fanout(uint n_tables, - double *read_time_arg, - double *record_count_arg); - double get_examined_rows(); - /* defined in opt_subselect.cc */ - bool transform_max_min_subquery(); - /* True if this JOIN is a subquery under an IN predicate. */ - bool is_in_subquery() - { - return (unit->item && unit->item->is_in_predicate()); - } - bool save_explain_data(Explain_query *output, bool can_overwrite, - bool need_tmp_table, bool need_order, bool distinct); - int save_explain_data_intern(Explain_query *output, bool need_tmp_table, - bool need_order, bool distinct, - const char *message); - JOIN_TAB *first_breadth_first_tab() { return join_tab; } - bool check_two_phase_optimization(THD *thd); - bool inject_cond_into_where(Item *injected_cond); - bool check_for_splittable_materialized(); - void add_keyuses_for_splitting(); - bool inject_best_splitting_cond(table_map remaining_tables); - bool fix_all_splittings_in_plan(); - void make_notnull_conds_for_range_scans(); - - bool transform_in_predicates_into_in_subq(THD *thd); -private: - /** - Create a temporary table to be used for processing DISTINCT/ORDER - BY/GROUP BY. - - @note Will modify JOIN object wrt sort/group attributes - - @param tab the JOIN_TAB object to attach created table to - @param tmp_table_fields List of items that will be used to define - column types of the table. - @param tmp_table_group Group key to use for temporary table, NULL if none. - @param save_sum_fields If true, do not replace Item_sum items in - @c tmp_fields list with Item_field items referring - to fields in temporary table. - - @returns false on success, true on failure - */ - bool create_postjoin_aggr_table(JOIN_TAB *tab, List *tmp_table_fields, - ORDER *tmp_table_group, - bool save_sum_fields, - bool distinct, - bool keep_row_ordermake); - /** - Optimize distinct when used on a subset of the tables. - - E.g.,: SELECT DISTINCT t1.a FROM t1,t2 WHERE t1.b=t2.b - In this case we can stop scanning t2 when we have found one t1.a - */ - void optimize_distinct(); - - void cleanup_item_list(List &items) const; - bool add_having_as_table_cond(JOIN_TAB *tab); - bool make_aggr_tables_info(); - bool add_fields_for_current_rowid(JOIN_TAB *cur, List *fields); - void init_join_cache_and_keyread(); -}; - -enum enum_with_bush_roots { WITH_BUSH_ROOTS, WITHOUT_BUSH_ROOTS}; -enum enum_with_const_tables { WITH_CONST_TABLES, WITHOUT_CONST_TABLES}; - -JOIN_TAB *first_linear_tab(JOIN *join, - enum enum_with_bush_roots include_bush_roots, - enum enum_with_const_tables const_tbls); -JOIN_TAB *next_linear_tab(JOIN* join, JOIN_TAB* tab, - enum enum_with_bush_roots include_bush_roots); - -JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables with_const); -JOIN_TAB *next_top_level_tab(JOIN *join, JOIN_TAB *tab); - -typedef struct st_select_check { - uint const_ref,reg_ref; -} SELECT_CHECK; - -extern const char *join_type_str[]; - -/* Extern functions in sql_select.cc */ -void count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param, - List &fields, bool reset_with_sum_func); -bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, - Ref_ptr_array ref_pointer_array, - List &new_list1, List &new_list2, - uint elements, List &fields); -void copy_fields(TMP_TABLE_PARAM *param); -bool copy_funcs(Item **func_ptr, const THD *thd); -uint find_shortest_key(TABLE *table, const key_map *usable_keys); -bool is_indexed_agg_distinct(JOIN *join, List *out_args); - -/* functions from opt_sum.cc */ -bool simple_pred(Item_func *func_item, Item **args, bool *inv_order); -int opt_sum_query(THD* thd, - List &tables, List &all_fields, COND *conds); - -/* from sql_delete.cc, used by opt_range.cc */ -extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b); - -/** class to copying an field/item to a key struct */ - -class store_key :public Sql_alloc -{ -public: - bool null_key; /* TRUE <=> the value of the key has a null part */ - enum store_key_result { STORE_KEY_OK, STORE_KEY_FATAL, STORE_KEY_CONV }; - enum Type { FIELD_STORE_KEY, ITEM_STORE_KEY, CONST_ITEM_STORE_KEY }; - store_key(THD *thd, Field *field_arg, uchar *ptr, uchar *null, uint length) - :null_key(0), null_ptr(null), err(0) - { - to_field=field_arg->new_key_field(thd->mem_root, field_arg->table, - ptr, length, null, 1); - } - store_key(store_key &arg) - :Sql_alloc(), null_key(arg.null_key), to_field(arg.to_field), - null_ptr(arg.null_ptr), err(arg.err) - - {} - virtual ~store_key() {} /** Not actually needed */ - virtual enum Type type() const=0; - virtual const char *name() const=0; - virtual bool store_key_is_const() { return false; } - - /** - @brief sets ignore truncation warnings mode and calls the real copy method - - @details this function makes sure truncation warnings when preparing the - key buffers don't end up as errors (because of an enclosing INSERT/UPDATE). - */ - enum store_key_result copy() - { - enum store_key_result result; - THD *thd= to_field->table->in_use; - enum_check_fields saved_count_cuted_fields= thd->count_cuted_fields; - sql_mode_t orig_sql_mode= thd->variables.sql_mode; - thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE); - thd->variables.sql_mode|= MODE_INVALID_DATES; - - thd->count_cuted_fields= CHECK_FIELD_IGNORE; - - result= copy_inner(); - - thd->count_cuted_fields= saved_count_cuted_fields; - thd->variables.sql_mode= orig_sql_mode; - - return result; - } - - protected: - Field *to_field; // Store data here - uchar *null_ptr; - uchar err; - - virtual enum store_key_result copy_inner()=0; -}; - - -class store_key_field: public store_key -{ - Copy_field copy_field; - const char *field_name; - public: - store_key_field(THD *thd, Field *to_field_arg, uchar *ptr, - uchar *null_ptr_arg, - uint length, Field *from_field, const char *name_arg) - :store_key(thd, to_field_arg,ptr, - null_ptr_arg ? null_ptr_arg : from_field->maybe_null() ? &err - : (uchar*) 0, length), field_name(name_arg) - { - if (to_field) - { - copy_field.set(to_field,from_field,0); - } - } - - enum Type type() const { return FIELD_STORE_KEY; } - const char *name() const { return field_name; } - - void change_source_field(Item_field *fld_item) - { - copy_field.set(to_field, fld_item->field, 0); - field_name= fld_item->full_name(); - } - - protected: - enum store_key_result copy_inner() - { - TABLE *table= copy_field.to_field->table; - my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, - table->write_set); - - /* - It looks like the next statement is needed only for a simplified - hash function over key values used now in BNLH join. - When the implementation of this function will be replaced for a proper - full version this statement probably should be removed. - */ - bzero(copy_field.to_ptr,copy_field.to_length); - - copy_field.do_copy(©_field); - dbug_tmp_restore_column_map(table->write_set, old_map); - null_key= to_field->is_null(); - return err != 0 ? STORE_KEY_FATAL : STORE_KEY_OK; - } -}; - - -class store_key_item :public store_key -{ - protected: - Item *item; - /* - Flag that forces usage of save_val() method which save value of the - item instead of save_in_field() method which saves result. - */ - bool use_value; -public: - store_key_item(THD *thd, Field *to_field_arg, uchar *ptr, - uchar *null_ptr_arg, uint length, Item *item_arg, bool val) - :store_key(thd, to_field_arg, ptr, - null_ptr_arg ? null_ptr_arg : item_arg->maybe_null ? - &err : (uchar*) 0, length), item(item_arg), use_value(val) - {} - store_key_item(store_key &arg, Item *new_item, bool val) - :store_key(arg), item(new_item), use_value(val) - {} - - - enum Type type() const { return ITEM_STORE_KEY; } - const char *name() const { return "func"; } - - protected: - enum store_key_result copy_inner() - { - TABLE *table= to_field->table; - my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, - table->write_set); - int res= FALSE; - - /* - It looks like the next statement is needed only for a simplified - hash function over key values used now in BNLH join. - When the implementation of this function will be replaced for a proper - full version this statement probably should be removed. - */ - to_field->reset(); - - if (use_value) - item->save_val(to_field); - else - res= item->save_in_field(to_field, 1); - /* - Item::save_in_field() may call Item::val_xxx(). And if this is a subquery - we need to check for errors executing it and react accordingly - */ - if (!res && table->in_use->is_error()) - res= 1; /* STORE_KEY_FATAL */ - dbug_tmp_restore_column_map(table->write_set, old_map); - null_key= to_field->is_null() || item->null_value; - return ((err != 0 || res < 0 || res > 2) ? STORE_KEY_FATAL : - (store_key_result) res); - } -}; - - -class store_key_const_item :public store_key_item -{ - bool inited; -public: - store_key_const_item(THD *thd, Field *to_field_arg, uchar *ptr, - uchar *null_ptr_arg, uint length, - Item *item_arg) - :store_key_item(thd, to_field_arg, ptr, - null_ptr_arg ? null_ptr_arg : item_arg->maybe_null ? - &err : (uchar*) 0, length, item_arg, FALSE), inited(0) - { - } - store_key_const_item(store_key &arg, Item *new_item) - :store_key_item(arg, new_item, FALSE), inited(0) - {} - - enum Type type() const { return CONST_ITEM_STORE_KEY; } - const char *name() const { return "const"; } - bool store_key_is_const() { return true; } - -protected: - enum store_key_result copy_inner() - { - int res; - if (!inited) - { - inited=1; - TABLE *table= to_field->table; - my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, - table->write_set); - if ((res= item->save_in_field(to_field, 1))) - { - if (!err) - err= res < 0 ? 1 : res; /* 1=STORE_KEY_FATAL */ - } - /* - Item::save_in_field() may call Item::val_xxx(). And if this is a subquery - we need to check for errors executing it and react accordingly - */ - if (!err && to_field->table->in_use->is_error()) - err= 1; /* STORE_KEY_FATAL */ - dbug_tmp_restore_column_map(table->write_set, old_map); - } - null_key= to_field->is_null() || item->null_value; - return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err); - } -}; - -void best_access_path(JOIN *join, JOIN_TAB *s, - table_map remaining_tables, - const POSITION *join_positions, uint idx, - bool disable_jbuf, double record_count, - POSITION *pos, POSITION *loose_scan_pos); -bool cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref); -bool error_if_full_join(JOIN *join); -int report_error(TABLE *table, int error); -int safe_index_read(JOIN_TAB *tab); -int get_quick_record(SQL_SELECT *select); -int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, - List &fields, List &all_fields, ORDER *order, - bool from_window_spec= false); -int setup_group(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, - List &fields, List &all_fields, ORDER *order, - bool *hidden_group_fields, bool from_window_spec= false); -bool fix_inner_refs(THD *thd, List &all_fields, SELECT_LEX *select, - Ref_ptr_array ref_pointer_array); -int join_read_key2(THD *thd, struct st_join_table *tab, TABLE *table, - struct st_table_ref *table_ref); - -bool handle_select(THD *thd, LEX *lex, select_result *result, - ulong setup_tables_done_option); -bool mysql_select(THD *thd, TABLE_LIST *tables, List &list, - COND *conds, uint og_num, ORDER *order, ORDER *group, - Item *having, ORDER *proc_param, ulonglong select_type, - select_result *result, SELECT_LEX_UNIT *unit, - SELECT_LEX *select_lex); -void free_underlaid_joins(THD *thd, SELECT_LEX *select); -bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, - select_result *result); - -/* - General routine to change field->ptr of a NULL-terminated array of Field - objects. Useful when needed to call val_int, val_str or similar and the - field data is not in table->record[0] but in some other structure. - set_key_field_ptr changes all fields of an index using a key_info object. - All methods presume that there is at least one field to change. -*/ - - -class Virtual_tmp_table: public TABLE -{ - /** - Destruct collected fields. This method can be called on errors, - when we could not make the virtual temporary table completely, - e.g. when some of the fields could not be created or added. - - This is needed to avoid memory leaks, as some fields can be BLOB - variants and thus can have String onboard. Strings must be destructed - as they store data on the heap (not on MEM_ROOT). - */ - void destruct_fields() - { - for (uint i= 0; i < s->fields; i++) - { - field[i]->free(); - delete field[i]; // to invoke the field destructor - } - s->fields= 0; // safety - } - -protected: - /** - The number of the fields that are going to be in the table. - We remember the number of the fields at init() time, and - at open() we check that all of the fields were really added. - */ - uint m_alloced_field_count; - - /** - Setup field pointers and null-bit pointers. - */ - void setup_field_pointers(); - -public: - /** - Create a new empty virtual temporary table on the thread mem_root. - After creation, the caller must: - - call init() - - populate the table with new fields using add(). - - call open(). - @param thd - Current thread. - */ - static void *operator new(size_t size, THD *thd) throw(); - static void operator delete(void *ptr, size_t size) { TRASH_FREE(ptr, size); } - static void operator delete(void *, THD *) throw(){} - - Virtual_tmp_table(THD *thd) : m_alloced_field_count(0) - { - reset(); - temp_pool_slot= MY_BIT_NONE; - in_use= thd; - copy_blobs= true; - alias.set("", 0, &my_charset_bin); - } - - ~Virtual_tmp_table() - { - if (s) - destruct_fields(); - } - - /** - Allocate components for the given number of fields. - - fields[] - - s->blob_fields[], - - bitmaps: def_read_set, def_write_set, tmp_set, eq_join_set, cond_set. - @param field_count - The number of fields we plan to add to the table. - @returns false - on success. - @returns true - on error. - */ - bool init(uint field_count); - - /** - Add one Field to the end of the field array, update members: - s->reclength, s->fields, s->blob_fields, s->null_fuelds. - */ - bool add(Field *new_field) - { - DBUG_ASSERT(s->fields < m_alloced_field_count); - new_field->init(this); - field[s->fields]= new_field; - s->reclength+= new_field->pack_length(); - if (!(new_field->flags & NOT_NULL_FLAG)) - s->null_fields++; - if (new_field->flags & BLOB_FLAG) - { - // Note, s->blob_fields was incremented in Field_blob::Field_blob - DBUG_ASSERT(s->blob_fields); - DBUG_ASSERT(s->blob_fields <= m_alloced_field_count); - s->blob_field[s->blob_fields - 1]= s->fields; - } - new_field->field_index= s->fields++; - return false; - } - - /** - Add fields from a Spvar_definition list - @returns false - on success. - @returns true - on error. - */ - bool add(List &field_list); - - /** - Open a virtual table for read/write: - - Setup end markers in TABLE::field and TABLE_SHARE::blob_fields, - - Allocate a buffer in TABLE::record[0]. - - Set field pointers (Field::ptr, Field::null_pos, Field::null_bit) to - the allocated record. - This method is called when all of the fields have been added to the table. - After calling this method the table is ready for read and write operations. - @return false - on success - @return true - on error (e.g. could not allocate the record buffer). - */ - bool open(); - - void set_all_fields_to_null() - { - for (uint i= 0; i < s->fields; i++) - field[i]->set_null(); - } - /** - Set all fields from a compatible item list. - The number of fields in "this" must be equal to the number - of elements in "value". - */ - bool sp_set_all_fields_from_item_list(THD *thd, List &items); - - /** - Set all fields from a compatible item. - The number of fields in "this" must be the same with the number - of elements in "value". - */ - bool sp_set_all_fields_from_item(THD *thd, Item *value); - - /** - Find a ROW element index by its name - Assumes that "this" is used as a storage for a ROW-type SP variable. - @param [OUT] idx - the index of the found field is returned here - @param [IN] field_name - find a field with this name - @return true - on error (the field was not found) - @return false - on success (idx[0] was set to the field index) - */ - bool sp_find_field_by_name(uint *idx, const LEX_CSTRING &name) const; - - /** - Find a ROW element index by its name. - If the element is not found, and error is issued. - @param [OUT] idx - the index of the found field is returned here - @param [IN] var_name - the name of the ROW variable (for error reporting) - @param [IN] field_name - find a field with this name - @return true - on error (the field was not found) - @return false - on success (idx[0] was set to the field index) - */ - bool sp_find_field_by_name_or_error(uint *idx, - const LEX_CSTRING &var_name, - const LEX_CSTRING &field_name) const; -}; - - -/** - Create a reduced TABLE object with properly set up Field list from a - list of field definitions. - - The created table doesn't have a table handler associated with - it, has no keys, no group/distinct, no copy_funcs array. - The sole purpose of this TABLE object is to use the power of Field - class to read/write data to/from table->record[0]. Then one can store - the record in any container (RB tree, hash, etc). - The table is created in THD mem_root, so are the table's fields. - Consequently, if you don't BLOB fields, you don't need to free it. - - @param thd connection handle - @param field_list list of column definitions - - @return - 0 if out of memory, or a - TABLE object ready for read and write in case of success -*/ - -inline Virtual_tmp_table * -create_virtual_tmp_table(THD *thd, List &field_list) -{ - Virtual_tmp_table *table; - if (!(table= new(thd) Virtual_tmp_table(thd))) - return NULL; - - /* - If "simulate_create_virtual_tmp_table_out_of_memory" debug option - is enabled, we now enable "simulate_out_of_memory". This effectively - makes table->init() fail on OOM inside multi_alloc_root(). - This is done to test that ~Virtual_tmp_table() called from the "delete" - below correcly handles OOM. - */ - DBUG_EXECUTE_IF("simulate_create_virtual_tmp_table_out_of_memory", - DBUG_SET("+d,simulate_out_of_memory");); - - if (table->init(field_list.elements) || - table->add(field_list) || - table->open()) - { - delete table; - return NULL; - } - return table; -} - - -/** - Create a new virtual temporary table consisting of a single field. - SUM(DISTINCT expr) and similar numeric aggregate functions use this. - @param thd - Current thread - @param field - The field that will be added into the table. - @return NULL - On error. - @return !NULL - A pointer to the created table that is ready - for read and write. -*/ -inline TABLE * -create_virtual_tmp_table(THD *thd, Field *field) -{ - Virtual_tmp_table *table; - DBUG_ASSERT(field); - if (!(table= new(thd) Virtual_tmp_table(thd))) - return NULL; - if (table->init(1) || - table->add(field) || - table->open()) - { - delete table; - return NULL; - } - return table; -} - - -int test_if_item_cache_changed(List &list); -int join_init_read_record(JOIN_TAB *tab); -int join_read_record_no_init(JOIN_TAB *tab); -void set_position(JOIN *join,uint idx,JOIN_TAB *table,KEYUSE *key); -inline Item * and_items(THD *thd, Item* cond, Item *item) -{ - return (cond ? (new (thd->mem_root) Item_cond_and(thd, cond, item)) : item); -} -inline Item * or_items(THD *thd, Item* cond, Item *item) -{ - return (cond ? (new (thd->mem_root) Item_cond_or(thd, cond, item)) : item); -} -bool choose_plan(JOIN *join, table_map join_tables); -void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab, - table_map last_remaining_tables, - bool first_alt, uint no_jbuf_before, - double *outer_rec_count, double *reopt_cost); -Item_equal *find_item_equal(COND_EQUAL *cond_equal, Field *field, - bool *inherited_fl); -extern bool test_if_ref(Item *, - Item_field *left_item,Item *right_item); - -inline bool optimizer_flag(THD *thd, ulonglong flag) -{ - return (thd->variables.optimizer_switch & flag); -} - -/* -int print_fake_select_lex_join(select_result_sink *result, bool on_the_fly, - SELECT_LEX *select_lex, uint8 select_options); -*/ - -uint get_index_for_order(ORDER *order, TABLE *table, SQL_SELECT *select, - ha_rows limit, ha_rows *scanned_limit, - bool *need_sort, bool *reverse); -ORDER *simple_remove_const(ORDER *order, COND *where); -bool const_expression_in_where(COND *cond, Item *comp_item, - Field *comp_field= NULL, - Item **const_item= NULL); -bool cond_is_datetime_is_null(Item *cond); -bool cond_has_datetime_is_null(Item *cond); - -/* Table elimination entry point function */ -void eliminate_tables(JOIN *join); - -/* Index Condition Pushdown entry point function */ -void push_index_cond(JOIN_TAB *tab, uint keyno); - -#define OPT_LINK_EQUAL_FIELDS 1 - -/* EXPLAIN-related utility functions */ -int print_explain_message_line(select_result_sink *result, - uint8 options, bool is_analyze, - uint select_number, - const char *select_type, - ha_rows *rows, - const char *message); -void explain_append_mrr_info(QUICK_RANGE_SELECT *quick, String *res); -int append_possible_keys(MEM_ROOT *alloc, String_list &list, TABLE *table, - key_map possible_keys); - -/**************************************************************************** - Temporary table support for SQL Runtime - ***************************************************************************/ - -#define STRING_TOTAL_LENGTH_TO_PACK_ROWS 128 -#define AVG_STRING_LENGTH_TO_PACK_ROWS 64 -#define RATIO_TO_PACK_ROWS 2 -#define MIN_STRING_LENGTH_TO_PACK_ROWS 10 - -void calc_group_buffer(TMP_TABLE_PARAM *param, ORDER *group); -TABLE *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, - ORDER *group, bool distinct, bool save_sum_fields, - ulonglong select_options, ha_rows rows_limit, - const LEX_CSTRING *alias, bool do_not_open=FALSE, - bool keep_row_order= FALSE); -TABLE *create_tmp_table_for_schema(THD *thd, TMP_TABLE_PARAM *param, - const ST_SCHEMA_TABLE &schema_table, - longlong select_options, - const LEX_CSTRING &alias, - bool do_not_open, bool keep_row_order); - -void free_tmp_table(THD *thd, TABLE *entry); -bool create_internal_tmp_table_from_heap(THD *thd, TABLE *table, - TMP_ENGINE_COLUMNDEF *start_recinfo, - TMP_ENGINE_COLUMNDEF **recinfo, - int error, bool ignore_last_dupp_key_error, - bool *is_duplicate); -bool create_internal_tmp_table(TABLE *table, KEY *keyinfo, - TMP_ENGINE_COLUMNDEF *start_recinfo, - TMP_ENGINE_COLUMNDEF **recinfo, - ulonglong options); -bool instantiate_tmp_table(TABLE *table, KEY *keyinfo, - TMP_ENGINE_COLUMNDEF *start_recinfo, - TMP_ENGINE_COLUMNDEF **recinfo, - ulonglong options); -bool open_tmp_table(TABLE *table); -void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps); -double prev_record_reads(const POSITION *positions, uint idx, table_map found_ref); -void fix_list_after_tbl_changes(SELECT_LEX *new_parent, List *tlist); -double get_tmp_table_lookup_cost(THD *thd, double row_count, uint row_size); -double get_tmp_table_write_cost(THD *thd, double row_count, uint row_size); -void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array); -bool sort_and_filter_keyuse(THD *thd, DYNAMIC_ARRAY *keyuse, - bool skip_unprefixed_keyparts); - -struct st_cond_statistic -{ - Item *cond; - Field *field_arg; - ulong positive; -}; -typedef struct st_cond_statistic COND_STATISTIC; - -ulong check_selectivity(THD *thd, - ulong rows_to_read, - TABLE *table, - List *conds); - -class Pushdown_query: public Sql_alloc -{ -public: - SELECT_LEX *select_lex; - bool store_data_in_temp_table; - group_by_handler *handler; - Item *having; - - Pushdown_query(SELECT_LEX *select_lex_arg, group_by_handler *handler_arg) - : select_lex(select_lex_arg), store_data_in_temp_table(0), - handler(handler_arg), having(0) {} - - ~Pushdown_query() { delete handler; } - - /* Function that calls the above scan functions */ - int execute(JOIN *); -}; - -class derived_handler; - -class Pushdown_derived: public Sql_alloc -{ -private: - bool is_analyze; -public: - TABLE_LIST *derived; - derived_handler *handler; - - Pushdown_derived(TABLE_LIST *tbl, derived_handler *h); - - ~Pushdown_derived(); - - int execute(); -}; - - -class select_handler; - - -bool test_if_order_compatible(SQL_I_List &a, SQL_I_List &b); -int test_if_group_changed(List &list); -int create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort); - -JOIN_TAB *first_explain_order_tab(JOIN* join); -JOIN_TAB *next_explain_order_tab(JOIN* join, JOIN_TAB* tab); - -bool check_simple_equality(THD *thd, const Item::Context &ctx, - Item *left_item, Item *right_item, - COND_EQUAL *cond_equal); - -void propagate_new_equalities(THD *thd, Item *cond, - List *new_equalities, - COND_EQUAL *inherited, - bool *is_simplifiable_cond); - -#endif /* SQL_SELECT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_sequence.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_sequence.h deleted file mode 100644 index 2d609d8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_sequence.h +++ /dev/null @@ -1,167 +0,0 @@ -/* Copyright (c) 2017, MariaDB corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef SQL_SEQUENCE_INCLUDED -#define SQL_SEQUENCE_INCLUDED - -#define seq_field_used_min_value 1 -#define seq_field_used_max_value 2 -#define seq_field_used_start 4 -#define seq_field_used_increment 8 -#define seq_field_used_cache 16 -#define seq_field_used_cycle 32 -#define seq_field_used_restart 64 -#define seq_field_used_restart_value 128 - -/* Field position in sequence table for some fields we refer to directly */ -#define NEXT_FIELD_NO 0 -#define MIN_VALUE_FIELD_NO 1 -#define ROUND_FIELD_NO 7 - -/** - sequence_definition is used when defining a sequence as part of create -*/ - -class sequence_definition :public Sql_alloc -{ -public: - sequence_definition(): - min_value(1), max_value(LONGLONG_MAX-1), start(1), increment(1), - cache(1000), round(0), restart(0), cycle(0), used_fields(0) - {} - longlong reserved_until; - longlong min_value; - longlong max_value; - longlong start; - longlong increment; - longlong cache; - ulonglong round; - longlong restart; // alter sequence restart value - bool cycle; - uint used_fields; // Which fields where used in CREATE - - bool check_and_adjust(bool set_reserved_until); - void store_fields(TABLE *table); - void read_fields(TABLE *table); - int write_initial_sequence(TABLE *table); - int write(TABLE *table, bool all_fields); - /* This must be called after sequence data has been updated */ - void adjust_values(longlong next_value); - inline void print_dbug() - { - DBUG_PRINT("sequence", ("reserved: %lld start: %lld increment: %lld min_value: %lld max_value: %lld cache: %lld round: %lld", - reserved_until, start, increment, min_value, - max_value, cache, round)); - } -protected: - /* - The following values are the values from sequence_definition - merged with global auto_increment_offset and auto_increment_increment - */ - longlong real_increment; - longlong next_free_value; -}; - -/** - SEQUENCE is in charge of managing the sequence values. - It's also responsible to generate new values and updating the sequence - table (engine=SQL_SEQUENCE) trough it's specialized handler interface. - - If increment is 0 then the sequence will be be using - auto_increment_increment and auto_increment_offset variables, just like - AUTO_INCREMENT is using. -*/ - -class SEQUENCE :public sequence_definition -{ -public: - enum seq_init { SEQ_UNINTIALIZED, SEQ_IN_PREPARE, SEQ_IN_ALTER, - SEQ_READY_TO_USE }; - SEQUENCE(); - ~SEQUENCE(); - int read_initial_values(TABLE *table); - int read_stored_values(TABLE *table); - void write_lock(TABLE *table); - void write_unlock(TABLE *table); - void read_lock(TABLE *table); - void read_unlock(TABLE *table); - void copy(sequence_definition *seq) - { - sequence_definition::operator= (*seq); - adjust_values(reserved_until); - all_values_used= 0; - } - longlong next_value(TABLE *table, bool second_round, int *error); - int set_value(TABLE *table, longlong next_value, ulonglong round_arg, - bool is_used); - longlong increment_value(longlong value) - { - if (real_increment > 0) - { - if (value + real_increment > max_value || - value > max_value - real_increment) - value= max_value + 1; - else - value+= real_increment; - } - else - { - if (value + real_increment < min_value || - value < min_value - real_increment) - value= min_value - 1; - else - value+= real_increment; - } - return value; - } - - bool all_values_used; - seq_init initialized; - -private: - mysql_rwlock_t mutex; -}; - - -/** - Class to cache last value of NEXT VALUE from the sequence -*/ - -class SEQUENCE_LAST_VALUE -{ -public: - SEQUENCE_LAST_VALUE(uchar *key_arg, uint length_arg) - :key(key_arg), length(length_arg) - {} - ~SEQUENCE_LAST_VALUE() - { my_free((void*) key); } - /* Returns 1 if table hasn't been dropped or re-created */ - bool check_version(TABLE *table); - void set_version(TABLE *table); - - const uchar *key; - uint length; - bool null_value; - longlong value; - uchar table_version[MY_UUID_SIZE]; -}; - - -class Create_field; -extern bool prepare_sequence_fields(THD *thd, List *fields); -extern bool check_sequence_fields(LEX *lex, List *fields); -extern bool sequence_insert(THD *thd, LEX *lex, TABLE_LIST *table_list); -#endif /* SQL_SEQUENCE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_servers.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_servers.h deleted file mode 100644 index cb5703e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_servers.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef SQL_SERVERS_INCLUDED -#define SQL_SERVERS_INCLUDED - -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "slave.h" // for tables_ok(), rpl_filter - -class THD; -typedef struct st_lex_server_options LEX_SERVER_OPTIONS; -typedef struct st_mem_root MEM_ROOT; - -/* structs */ -typedef struct st_federated_server -{ - const char *server_name; - long port; - size_t server_name_length; - const char *db, *scheme, *username, *password, *socket, *owner, *host, *sport; -} FOREIGN_SERVER; - -/* cache handlers */ -bool servers_init(bool dont_read_server_table); -bool servers_reload(THD *thd); -void servers_free(bool end=0); - -/* insert functions */ -int create_server(THD *thd, LEX_SERVER_OPTIONS *server_options); - -/* drop functions */ -int drop_server(THD *thd, LEX_SERVER_OPTIONS *server_options); - -/* update functions */ -int alter_server(THD *thd, LEX_SERVER_OPTIONS *server_options); - -/* lookup functions */ -FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name, - FOREIGN_SERVER *server_buffer); - -#endif /* SQL_SERVERS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_show.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_show.h deleted file mode 100644 index 80588cd..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_show.h +++ /dev/null @@ -1,258 +0,0 @@ -/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. - Copyright (c) 2012, 2016, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_SHOW_H -#define SQL_SHOW_H - -#include "sql_list.h" /* List */ -#include "handler.h" /* enum_schema_tables */ -#include "table.h" /* enum_schema_table_state */ -#include "my_apc.h" - -/* Forward declarations */ -class JOIN; -class String; -class THD; -class sp_name; -struct TABLE_LIST; -typedef class st_select_lex SELECT_LEX; -struct LEX; -typedef struct st_mysql_show_var SHOW_VAR; -typedef struct st_schema_table ST_SCHEMA_TABLE; -struct TABLE; -typedef struct system_status_var STATUS_VAR; - -/* Used by handlers to store things in schema tables */ -#define IS_FILES_FILE_ID 0 -#define IS_FILES_FILE_NAME 1 -#define IS_FILES_FILE_TYPE 2 -#define IS_FILES_TABLESPACE_NAME 3 -#define IS_FILES_TABLE_CATALOG 4 -#define IS_FILES_TABLE_SCHEMA 5 -#define IS_FILES_TABLE_NAME 6 -#define IS_FILES_LOGFILE_GROUP_NAME 7 -#define IS_FILES_LOGFILE_GROUP_NUMBER 8 -#define IS_FILES_ENGINE 9 -#define IS_FILES_FULLTEXT_KEYS 10 -#define IS_FILES_DELETED_ROWS 11 -#define IS_FILES_UPDATE_COUNT 12 -#define IS_FILES_FREE_EXTENTS 13 -#define IS_FILES_TOTAL_EXTENTS 14 -#define IS_FILES_EXTENT_SIZE 15 -#define IS_FILES_INITIAL_SIZE 16 -#define IS_FILES_MAXIMUM_SIZE 17 -#define IS_FILES_AUTOEXTEND_SIZE 18 -#define IS_FILES_CREATION_TIME 19 -#define IS_FILES_LAST_UPDATE_TIME 20 -#define IS_FILES_LAST_ACCESS_TIME 21 -#define IS_FILES_RECOVER_TIME 22 -#define IS_FILES_TRANSACTION_COUNTER 23 -#define IS_FILES_VERSION 24 -#define IS_FILES_ROW_FORMAT 25 -#define IS_FILES_TABLE_ROWS 26 -#define IS_FILES_AVG_ROW_LENGTH 27 -#define IS_FILES_DATA_LENGTH 28 -#define IS_FILES_MAX_DATA_LENGTH 29 -#define IS_FILES_INDEX_LENGTH 30 -#define IS_FILES_DATA_FREE 31 -#define IS_FILES_CREATE_TIME 32 -#define IS_FILES_UPDATE_TIME 33 -#define IS_FILES_CHECK_TIME 34 -#define IS_FILES_CHECKSUM 35 -#define IS_FILES_STATUS 36 -#define IS_FILES_EXTRA 37 - -typedef enum { WITHOUT_DB_NAME, WITH_DB_NAME } enum_with_db_name; - -int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond); - -int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, - Table_specification_st *create_info_arg, - enum_with_db_name with_db_name); - -int show_create_table_ex(THD *thd, TABLE_LIST *table_list, - const char * forced_db, const char *forced_name, - String *packet, - Table_specification_st *create_info_arg, - enum_with_db_name with_db_name); - -int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table); - -bool append_identifier(THD *thd, String *packet, const char *name, size_t length); -static inline bool append_identifier(THD *thd, String *packet, const LEX_CSTRING *name) -{ - return append_identifier(thd, packet, name->str, name->length); -} -void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild); -int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd); -bool mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list, - List *field_list, String *buffer); -bool mysqld_show_create(THD *thd, TABLE_LIST *table_list); -void mysqld_show_create_db_get_fields(THD *thd, List *field_list); -bool mysqld_show_create_db(THD *thd, LEX_CSTRING *db_name, - LEX_CSTRING *orig_db_name, - const DDL_options_st &options); - -void mysqld_list_processes(THD *thd,const char *user,bool verbose); -int mysqld_show_status(THD *thd); -int mysqld_show_variables(THD *thd,const char *wild); -bool mysqld_show_storage_engines(THD *thd); -bool mysqld_show_authors(THD *thd); -bool mysqld_show_contributors(THD *thd); -bool mysqld_show_privileges(THD *thd); -char *make_backup_log_name(char *buff, const char *name, const char* log_ext); -uint calc_sum_of_all_status(STATUS_VAR *to); -bool append_definer(THD *thd, String *buffer, const LEX_CSTRING *definer_user, - const LEX_CSTRING *definer_host); -int add_status_vars(SHOW_VAR *list); -void remove_status_vars(SHOW_VAR *list); -ulonglong get_status_vars_version(void); -void init_status_vars(); -void free_status_vars(); -void reset_status_vars(); -bool show_create_trigger(THD *thd, const sp_name *trg_name); -void view_store_options(THD *thd, TABLE_LIST *table, String *buff); - -void init_fill_schema_files_row(TABLE* table); -void initialize_information_schema_acl(); - -ST_SCHEMA_TABLE *find_schema_table(THD *thd, const LEX_CSTRING *table_name, - bool *in_plugin); -static inline ST_SCHEMA_TABLE *find_schema_table(THD *thd, const LEX_CSTRING *table_name) -{ bool unused; return find_schema_table(thd, table_name, &unused); } - -ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx); -int make_schema_select(THD *thd, SELECT_LEX *sel, - ST_SCHEMA_TABLE *schema_table); -int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list); -bool get_schema_tables_result(JOIN *join, - enum enum_schema_table_state executed_place); -enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table); -TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list); - -const char* get_one_variable(THD *thd, const SHOW_VAR *variable, - enum_var_type value_type, SHOW_TYPE show_type, - system_status_var *status_var, - const CHARSET_INFO **charset, char *buff, - size_t *length); - -/* These functions were under INNODB_COMPATIBILITY_HOOKS */ -int get_quote_char_for_identifier(THD *thd, const char *name, size_t length); -THD *find_thread_by_id(longlong id, bool query_id= false); - -class select_result_explain_buffer; -/* - SHOW EXPLAIN request object. -*/ - -class Show_explain_request : public Apc_target::Apc_call -{ -public: - THD *target_thd; /* thd that we're running SHOW EXPLAIN for */ - THD *request_thd; /* thd that run SHOW EXPLAIN command */ - - /* If true, there was some error when producing EXPLAIN output. */ - bool failed_to_produce; - - /* SHOW EXPLAIN will be stored here */ - select_result_explain_buffer *explain_buf; - - /* Query that we've got SHOW EXPLAIN for */ - String query_str; - - /* Overloaded virtual function */ - void call_in_target_thread(); -}; - -/** - Condition pushdown used for INFORMATION_SCHEMA / SHOW queries. - This structure is to implement an optimization when - accessing data dictionary data in the INFORMATION_SCHEMA - or SHOW commands. - When the query contain a TABLE_SCHEMA or TABLE_NAME clause, - narrow the search for data based on the constraints given. -*/ -typedef struct st_lookup_field_values -{ - /** - Value of a TABLE_SCHEMA clause. - Note that this value length may exceed @c NAME_LEN. - @sa wild_db_value - */ - LEX_CSTRING db_value; - /** - Value of a TABLE_NAME clause. - Note that this value length may exceed @c NAME_LEN. - @sa wild_table_value - */ - LEX_CSTRING table_value; - /** - True when @c db_value is a LIKE clause, - false when @c db_value is an '=' clause. - */ - bool wild_db_value; - /** - True when @c table_value is a LIKE clause, - false when @c table_value is an '=' clause. - */ - bool wild_table_value; -} LOOKUP_FIELD_VALUES; - -/* - INFORMATION_SCHEMA: Execution plan for get_all_tables() call -*/ - -class IS_table_read_plan : public Sql_alloc -{ -public: - IS_table_read_plan() : no_rows(false), trivial_show_command(FALSE) {} - - bool no_rows; - /* - For EXPLAIN only: For SHOW KEYS and SHOW COLUMNS, we know which - db_name.table_name will be read, however for some reason we don't - set the fields in this->lookup_field_vals. - In order to not have JOIN::save_explain_data() walking over uninitialized - data, we set trivial_show_command=true. - */ - bool trivial_show_command; - - LOOKUP_FIELD_VALUES lookup_field_vals; - Item *partial_cond; - - bool has_db_lookup_value() - { - return (lookup_field_vals.db_value.length && - !lookup_field_vals.wild_db_value); - } - bool has_table_lookup_value() - { - return (lookup_field_vals.table_value.length && - !lookup_field_vals.wild_table_value); - } -}; - -bool optimize_schema_tables_reads(JOIN *join); - -/* Handle the ignored database directories list for SHOW/I_S. */ -bool ignore_db_dirs_init(); -void ignore_db_dirs_free(); -void ignore_db_dirs_reset(); -bool ignore_db_dirs_process_additions(); -bool push_ignored_db_dir(char *path); -extern char *opt_ignore_db_dirs; - -#endif /* SQL_SHOW_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_signal.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_signal.h deleted file mode 100644 index bf42cdb..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_signal.h +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright (c) 2008 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_SIGNAL_H -#define SQL_SIGNAL_H - -/** - Sql_cmd_common_signal represents the common properties of the - SIGNAL and RESIGNAL statements. -*/ -class Sql_cmd_common_signal : public Sql_cmd -{ -protected: - /** - Constructor. - @param cond the condition signaled if any, or NULL. - @param set collection of signal condition item assignments. - */ - Sql_cmd_common_signal(const sp_condition_value *cond, - const Set_signal_information& set) - : Sql_cmd(), - m_cond(cond), - m_set_signal_information(set) - {} - - virtual ~Sql_cmd_common_signal() - {} - - /** - Evaluate each signal condition items for this statement. - @param thd the current thread. - @param cond the condition to update. - @return 0 on success. - */ - int eval_signal_informations(THD *thd, Sql_condition *cond); - - /** - Raise a SQL condition. - @param thd the current thread. - @param cond the condition to raise. - @return false on success. - */ - bool raise_condition(THD *thd, Sql_condition *cond); - - /** - The condition to signal or resignal. - This member is optional and can be NULL (RESIGNAL). - */ - const sp_condition_value *m_cond; - - /** - Collection of 'SET item = value' assignments in the - SIGNAL/RESIGNAL statement. - */ - Set_signal_information m_set_signal_information; -}; - -/** - Sql_cmd_signal represents a SIGNAL statement. -*/ -class Sql_cmd_signal : public Sql_cmd_common_signal -{ -public: - /** - Constructor, used to represent a SIGNAL statement. - @param cond the SQL condition to signal (required). - @param set the collection of signal informations to signal. - */ - Sql_cmd_signal(const sp_condition_value *cond, - const Set_signal_information& set) - : Sql_cmd_common_signal(cond, set) - {} - - virtual ~Sql_cmd_signal() - {} - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_SIGNAL; - } - - virtual bool execute(THD *thd); -}; - -/** - Sql_cmd_resignal represents a RESIGNAL statement. -*/ -class Sql_cmd_resignal : public Sql_cmd_common_signal -{ -public: - /** - Constructor, used to represent a RESIGNAL statement. - @param cond the SQL condition to resignal (optional, may be NULL). - @param set the collection of signal informations to resignal. - */ - Sql_cmd_resignal(const sp_condition_value *cond, - const Set_signal_information& set) - : Sql_cmd_common_signal(cond, set) - {} - - virtual ~Sql_cmd_resignal() - {} - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_RESIGNAL; - } - - virtual bool execute(THD *thd); -}; - -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_sort.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_sort.h deleted file mode 100644 index a474d7c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_sort.h +++ /dev/null @@ -1,712 +0,0 @@ -#ifndef SQL_SORT_INCLUDED -#define SQL_SORT_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "my_base.h" /* ha_rows */ -#include /* qsort2_cmp */ -#include "queues.h" -#include "sql_class.h" - -class Field; -struct TABLE; - -/* Defines used by filesort and uniques */ - -#define MERGEBUFF 7 -#define MERGEBUFF2 15 - -/* - The structure SORT_ADDON_FIELD describes a fixed layout - for field values appended to sorted values in records to be sorted - in the sort buffer. - Only fixed layout is supported now. - Null bit maps for the appended values is placed before the values - themselves. Offsets are from the last sorted field, that is from the - record referefence, which is still last component of sorted records. - It is preserved for backward compatiblility. - The structure is used tp store values of the additional fields - in the sort buffer. It is used also when these values are read - from a temporary file/buffer. As the reading procedures are beyond the - scope of the 'filesort' code the values have to be retrieved via - the callback function 'unpack_addon_fields'. -*/ - -typedef struct st_sort_addon_field -{ - /* Sort addon packed field */ - Field *field; /* Original field */ - uint offset; /* Offset from the last sorted field */ - uint null_offset; /* Offset to to null bit from the last sorted field */ - uint length; /* Length in the sort buffer */ - uint8 null_bit; /* Null bit mask for the field */ -} SORT_ADDON_FIELD; - -struct BUFFPEK_COMPARE_CONTEXT -{ - qsort_cmp2 key_compare; - void *key_compare_arg; -}; - - -/** - Descriptor for a merge chunk to be sort-merged. - A merge chunk is a sequence of pre-sorted records, written to a - temporary file. A Merge_chunk instance describes where this chunk is stored - in the file, and where it is located when it is in memory. - - It is a POD because - - we read/write them from/to files. - - We have accessors (getters/setters) for all struct members. - */ - -struct Merge_chunk { -public: - my_off_t file_position() const { return m_file_position; } - void set_file_position(my_off_t val) { m_file_position= val; } - void advance_file_position(my_off_t val) { m_file_position+= val; } - - uchar *buffer_start() { return m_buffer_start; } - const uchar *buffer_end() const { return m_buffer_end; } - - void set_buffer(uchar *start, uchar *end) - { - m_buffer_start= start; - m_buffer_end= end; - } - void set_buffer_start(uchar *start) - { - m_buffer_start= start; - } - void set_buffer_end(uchar *end) - { - DBUG_ASSERT(m_buffer_end == NULL || end <= m_buffer_end); - m_buffer_end= end; - } - - void init_current_key() { m_current_key= m_buffer_start; } - uchar *current_key() { return m_current_key; } - void advance_current_key(uint val) { m_current_key+= val; } - - void decrement_rowcount(ha_rows val) { m_rowcount-= val; } - void set_rowcount(ha_rows val) { m_rowcount= val; } - ha_rows rowcount() const { return m_rowcount; } - - ha_rows mem_count() const { return m_mem_count; } - void set_mem_count(ha_rows val) { m_mem_count= val; } - ha_rows decrement_mem_count() { return --m_mem_count; } - - ha_rows max_keys() const { return m_max_keys; } - void set_max_keys(ha_rows val) { m_max_keys= val; } - - size_t buffer_size() const { return m_buffer_end - m_buffer_start; } - - /** - Tries to merge *this with *mc, returns true if successful. - The assumption is that *this is no longer in use, - and the space it has been allocated can be handed over to a - buffer which is adjacent to it. - */ - bool merge_freed_buff(Merge_chunk *mc) const - { - if (mc->m_buffer_end == m_buffer_start) - { - mc->m_buffer_end= m_buffer_end; - mc->m_max_keys+= m_max_keys; - return true; - } - else if (mc->m_buffer_start == m_buffer_end) - { - mc->m_buffer_start= m_buffer_start; - mc->m_max_keys+= m_max_keys; - return true; - } - return false; - } - - /// The current key for this chunk - uchar *m_current_key= nullptr; - /// Current position in the file to be sorted. - my_off_t m_file_position= 0; - /// Start of main-memory buffer for this chunk. - uchar *m_buffer_start= nullptr; - /// End of main-memory buffer for this chunk. - uchar *m_buffer_end= nullptr; - /// Number of unread rows in this chunk. - ha_rows m_rowcount= 0; - /// Number of rows in the main-memory buffer. - ha_rows m_mem_count= 0; - /// If we have fixed-size rows: max number of rows in buffer. - ha_rows m_max_keys= 0; -}; - -typedef Bounds_checked_array Addon_fields_array; -typedef Bounds_checked_array Sort_keys_array; - -/** - This class wraps information about usage of addon fields. - An Addon_fields object is used both during packing of data in the filesort - buffer, and later during unpacking in 'Filesort_info::unpack_addon_fields'. - - @see documentation for the Sort_addon_field struct. - @see documentation for get_addon_fields() - */ -class Addon_fields { -public: - Addon_fields(Addon_fields_array arr) - : m_field_descriptors(arr), - m_addon_buf(), - m_addon_buf_length(), - m_using_packed_addons(false) - { - DBUG_ASSERT(!arr.is_null()); - } - - SORT_ADDON_FIELD *begin() { return m_field_descriptors.begin(); } - SORT_ADDON_FIELD *end() { return m_field_descriptors.end(); } - - /// rr_unpack_from_tempfile needs an extra buffer when unpacking. - uchar *allocate_addon_buf(uint sz) - { - m_addon_buf= (uchar *)my_malloc(PSI_INSTRUMENT_ME, sz, MYF(MY_WME | MY_THREAD_SPECIFIC)); - if (m_addon_buf) - m_addon_buf_length= sz; - return m_addon_buf; - } - - void free_addon_buff() - { - my_free(m_addon_buf); - m_addon_buf= NULL; - m_addon_buf_length= 0; - } - - uchar *get_addon_buf() { return m_addon_buf; } - uint get_addon_buf_length() const { return m_addon_buf_length; } - - void set_using_packed_addons(bool val) - { - m_using_packed_addons= val; - } - - bool using_packed_addons() const - { - return m_using_packed_addons; - } - - static bool can_pack_addon_fields(uint record_length) - { - return (record_length <= (0xFFFF)); - } - - /** - @returns Total number of bytes used for packed addon fields. - the size of the length field + size of null bits + sum of field sizes. - */ - static uint read_addon_length(uchar *p) - { - return size_of_length_field + uint2korr(p); - } - - /** - Stores the number of bytes used for packed addon fields. - */ - static void store_addon_length(uchar *p, uint sz) - { - // We actually store the length of everything *after* the length field. - int2store(p, sz - size_of_length_field); - } - - static const uint size_of_length_field= 2; - -private: - Addon_fields_array m_field_descriptors; - - uchar *m_addon_buf; ///< Buffer for unpacking addon fields. - uint m_addon_buf_length; ///< Length of the buffer. - bool m_using_packed_addons; ///< Are we packing the addon fields? -}; - -/** - This class wraps information about usage of sort keys. - A Sort_keys object is used both during packing of data in the filesort - buffer, and later during unpacking in 'Filesort_info::unpack_addon_fields'. - - @see SORT_FIELD struct. -*/ - -class Sort_keys :public Sql_alloc, - public Sort_keys_array -{ -public: - Sort_keys(SORT_FIELD* arr, size_t count): - Sort_keys_array(arr, count), - m_using_packed_sortkeys(false), - size_of_packable_fields(0), - sort_length_with_original_values(0), - sort_length_with_memcmp_values(0), - parameters_computed(false) - { - DBUG_ASSERT(!is_null()); - } - - bool using_packed_sortkeys() const - { return m_using_packed_sortkeys; } - - void set_using_packed_sortkeys(bool val) - { - m_using_packed_sortkeys= val; - } - void set_size_of_packable_fields(uint len) - { - size_of_packable_fields= len; - } - - uint get_size_of_packable_fields() - { - return size_of_packable_fields; - } - - void set_sort_length_with_original_values(uint len) - { - sort_length_with_original_values= len; - } - - uint get_sort_length_with_original_values() - { - return sort_length_with_original_values; - } - - void set_sort_length_with_memcmp_values(uint len) - { - sort_length_with_memcmp_values= len; - } - - uint get_sort_length_with_memcmp_values() - { - return sort_length_with_memcmp_values; - } - - static void store_sortkey_length(uchar *p, uint sz) - { - int4store(p, sz - size_of_length_field); - } - - static uint read_sortkey_length(uchar *p) - { - return size_of_length_field + uint4korr(p); - } - - void increment_size_of_packable_fields(uint len) - { - size_of_packable_fields+= len; - } - - void increment_original_sort_length(uint len) - { - sort_length_with_original_values+= len; - } - - bool is_parameters_computed() { return parameters_computed; } - void set_parameters_computed(bool val) { parameters_computed= val; } - - static const uint size_of_length_field= 4; - -private: - bool m_using_packed_sortkeys; // Are we packing sort keys - uint size_of_packable_fields; // Total length bytes for packable columns - - /* - The sort length for all the keyparts storing the original values - */ - uint sort_length_with_original_values; - - /* - The sort length for all the keyparts storing the mem-comparable images - */ - uint sort_length_with_memcmp_values; - - /* - TRUE parameters(like sort_length_* , size_of_packable_field) - are computed - FALSE otherwise. - */ - bool parameters_computed; -}; - - -/** -PACKED SORT KEYS - -Description - -In this optimization where we would like the pack the values of the sort key -inside the sort buffer for each record. - -Contents: -1. Background -1.1 Implementation details -2. Solution : Packed Sort Keys -2.1 Packed key format -2.2 Which format to use -3. Special cases -3.1 Handling very long strings -3.2 Handling for long binary strings -3.3 Handling very long strings with Packed sort keys -4. Sort key columns in addon_fields - -1. Background -Before this optimization of using packed sort keys, filesort() sorted the -data using mem-comparable keys. - -That is, if we wanted to sort by - - ORDER BY col1, col2, ... colN -then the filesort code would for each row generate one "Sort Key" -and then sort the rows by their Sort Keys. - -The Sort Keys are mem-comparable (that is, are compared by memcmp()) and -they are of FIXED SIZE. The sort key has the same length regardless of -what value it represents. This causes INEFFICIENT MEMORY USAGE. - -1.1 Implementation details - -make_sortkey() is the function that produces a sort key -from a record. - -The function treats Field and Item objects differently. - -class Field has: - -a) void make_sort_key(uchar *buff, uint length); - make_sort_key is a non-virtual function which handles encoding of - SQL null values. - -b) virtual void sort_string(uchar *buff,uint length)=0; - sort_string produces mem-comparable image of the field value - for each datatype. - -For Items, Type_handler has a virtual function: - - virtual void make_sort_key(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const= 0; - which various datatypes overload. - - -2. SOLUTION: PACKED SORT KEYS - -Note that one can have mem-comparable keys are that are not fixed-size. -MyRocks uses such encoding for example. - -However for this optimization it was decided to store the original -(non-mem-comparable) values instead and use a datatype-aware -key comparison function. - -2.1 Packed key format -The keys are stored in a new variable-size data format called "packed". - -The format is as follows: - - ....... - - format for a n-part sort key - - is the length of the whole key. -Each packed value is encoded as follows: - - // This is a an SQL NULL - [] // this a non-NULL value -null_byte is present if the field/item is NULLable. -SQL NULL is encoded as just one NULL-indicator byte. The value itself is omitted. - -The format of the packed_value depends on the datatype. -For "non-packable" datatypes it is just their mem-comparable form, as before. - -The "packable" datatypes are currently variable-length strings and the -packed format for them is (for binary blobs, see a note below): - - -2.2 Which format to use - -The advantage of Packed Key Format is potential space savings for -variable-length fields. - -The disadvantages are: - -a) It may actually take more space, because of sort_key_length and - length fields. -b) The comparison function is more expensive. - -Currently the logic is: use Packed Key Format if we would save 128 or more -bytes when constructing a sort key from values that have empty string -for each packable component. - -3. SPECIAL CASES -3.1 HANDLING VERY LONG STRINGS -the size of sort key part was limited by @@max_sort_length variable. -It is defined as: - -The number of bytes to use when sorting data values. The server uses only the -first max_sort_length bytes of each value and ignores the rest. - -3.2 HANDLING VERY LONG BINARY STRINGS -Long binary strings receive special treatment. A sort key for the long -binary string is truncated at max_sort_length bytes like described above, -but then a "suffix" is appended which contains the total length of the -value before the truncation. - -3.3 HANDLING VERY LONG STRINGS WITH PACKED SORT KEY -Truncating multi-byte string at N bytes is not safe because one can cut in the -middle of a character. One is tempted to solve this by discarding the partial -character but that's also not a good idea as in some collations multiple -characters may produce one weight (this is called "contraction"). - -This combination of circumstances: - -The string value is very long, so truncation is necessary -The collation is "complex", so truncation is dangerous -is deemed to be relatively rare so it was decided to just use -the non-packed sort keys in this case. - -4. SORT KEY COLUMNS IN ADDON FIELDS -Currently, each sort key column is actually stored twice -1. as part of the sort key -2. in the addon_fields -This made total sense when sort key stored the mem-comparable image -(from which one cannot restore the original value in general case). -But since we now store the original value, we could also remove it from the -addon_fields and further save space. This is still a limitation and needs -to be fixed later - -@see Sort_keys - -**/ - -/** - The sort record format may use one of two formats for the non-sorted part of - the record: - - 1. Use the rowid - - || | - / / ref_length / - - 2. Use "addon fields" - - |||...| - / / addon_length / - - The packed format for "addon fields" - - ||||...| - / / addon_length / - - The key may use one of the two formats: - A. fixed-size mem-comparable form. The record is always - sort_length bytes long. - B. "PackedKeyFormat" - the records are variable-size. - - Fields are fixed-size, specially encoded with - Field::make_sort_key() so we can do byte-by-byte compare. - - Contains the *actual* packed length (after packing) of - everything after the sort keys. - The size of the length field is 2 bytes, - which should cover most use cases: addon data <= 65535 bytes. - This is the same as max record size in MySQL. - One bit for each nullable field, indicating whether the field - is null or not. May have size zero if no fields are nullable. - Are stored with field->pack(), and retrieved with - field->unpack(). Addon fields within a record are stored - consecutively, with no "holes" or padding. They will have zero - size for NULL values. - -*/ - -class Sort_param { -public: - uint rec_length; // Length of sorted records. - uint sort_length; // Length of sorted columns. - uint ref_length; // Length of record ref. - uint addon_length; // Length of addon_fields - uint res_length; // Length of records in final sorted file/buffer. - uint max_keys_per_buffer; // Max keys / buffer. - uint min_dupl_count; - ha_rows max_rows; // Select limit, or HA_POS_ERROR if unlimited. - ha_rows examined_rows; // Number of examined rows. - TABLE *sort_form; // For quicker make_sortkey. - /** - ORDER BY list with some precalculated info for filesort. - Array is created and owned by a Filesort instance. - */ - Bounds_checked_array local_sortorder; - Addon_fields *addon_fields; // Descriptors for companion fields. - Sort_keys *sort_keys; - bool using_pq; - - uchar *unique_buff; - bool not_killable; - String tmp_buffer; - // The fields below are used only by Unique class. - qsort2_cmp compare; - BUFFPEK_COMPARE_CONTEXT cmp_context; - - Sort_param() - { - memset(reinterpret_cast(this), 0, sizeof(*this)); - tmp_buffer.set_thread_specific(); - /* - Fix memset() clearing the charset. - TODO: The constructor should be eventually rewritten not to use memset(). - */ - tmp_buffer.set_charset(&my_charset_bin); - } - void init_for_filesort(uint sortlen, TABLE *table, - ha_rows maxrows, bool sort_positions); - /// Enables the packing of addons if possible. - void try_to_pack_addons(ulong max_length_for_sort_data); - - /// Are we packing the "addon fields"? - bool using_packed_addons() const - { - DBUG_ASSERT(m_using_packed_addons == - (addon_fields != NULL && - addon_fields->using_packed_addons())); - return m_using_packed_addons; - } - - bool using_packed_sortkeys() const - { - DBUG_ASSERT(m_using_packed_sortkeys == - (sort_keys != NULL && sort_keys->using_packed_sortkeys())); - return m_using_packed_sortkeys; - } - - /// Are we using "addon fields"? - bool using_addon_fields() const - { - return addon_fields != NULL; - } - - uint32 get_result_length(uchar *plen) - { - if (!m_using_packed_addons) - return res_length; - return Addon_fields::read_addon_length(plen); - } - - uint32 get_addon_length(uchar *plen) - { - if (using_packed_addons()) - return Addon_fields::read_addon_length(plen); - else - return addon_length; - } - - uint32 get_sort_length(uchar *plen) - { - if (using_packed_sortkeys()) - return Sort_keys::read_sortkey_length(plen) + - /* - when addon fields are not present, then the sort_length also - includes the res_length. For packed keys here we add - the res_length - */ - (using_addon_fields() ? 0: res_length); - else - return sort_length; - } - - uint get_record_length(uchar *plen) - { - if (m_packed_format) - { - uint sort_len= get_sort_length(plen); - return sort_len + get_addon_length(plen + sort_len); - } - else - return rec_length; - } - - /** - Getter for record length and result length. - @param record_start Pointer to record. - @param [out] recl Store record length here. - @param [out] resl Store result length here. - */ - void get_rec_and_res_len(uchar *record_start, uint *recl, uint *resl) - { - if (m_packed_format) - { - uint sort_len= get_sort_length(record_start); - uint addon_len= get_addon_length(record_start + sort_len); - *recl= sort_len + addon_len; - *resl= using_addon_fields() ? addon_len : res_length; - } - else - { - *recl= rec_length; - *resl= res_length; - } - } - - void try_to_pack_sortkeys(); - - qsort2_cmp get_compare_function() const - { - return using_packed_sortkeys() ? - get_packed_keys_compare_ptr() : - get_ptr_compare(sort_length); - } - void* get_compare_argument(size_t *sort_len) const - { - return using_packed_sortkeys() ? - (void*) this : - (void*) sort_len; - } - - bool is_packed_format() const - { - return m_packed_format; - } - -private: - uint m_packable_length; - bool m_using_packed_addons; ///< caches the value of using_packed_addons() - /* caches the value of using_packed_sortkeys() */ - bool m_using_packed_sortkeys; - bool m_packed_format; -}; - -typedef Bounds_checked_array Sort_buffer; - -int merge_many_buff(Sort_param *param, Sort_buffer sort_buffer, - Merge_chunk *buffpek, uint *maxbuffer, IO_CACHE *t_file); -ulong read_to_buffer(IO_CACHE *fromfile, Merge_chunk *buffpek, - Sort_param *param, bool packing_format); -bool merge_buffers(Sort_param *param,IO_CACHE *from_file, - IO_CACHE *to_file, Sort_buffer sort_buffer, - Merge_chunk *lastbuff, Merge_chunk *Fb, - Merge_chunk *Tb, int flag); -int merge_index(Sort_param *param, Sort_buffer sort_buffer, - Merge_chunk *buffpek, uint maxbuffer, - IO_CACHE *tempfile, IO_CACHE *outfile); -void reuse_freed_buff(QUEUE *queue, Merge_chunk *reuse, uint key_length); - -#endif /* SQL_SORT_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_statistics.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_statistics.h deleted file mode 100644 index 20ecf06..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_statistics.h +++ /dev/null @@ -1,473 +0,0 @@ -/* Copyright 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_STATISTICS_H -#define SQL_STATISTICS_H - -/* - For COMPLEMENTARY_FOR_QUERIES and PREFERABLY_FOR_QUERIES they are - similar to the COMPLEMENTARY and PREFERABLY respectively except that - with these values we would not be collecting EITS for queries like - ANALYZE TABLE t1; - To collect EITS with these values, we have to use PERSISITENT FOR - analyze table t1 persistent for - columns (col1,col2...) index (idx1, idx2...) - or - analyze table t1 persistent for all -*/ - -typedef -enum enum_use_stat_tables_mode -{ - NEVER, - COMPLEMENTARY, - PREFERABLY, - COMPLEMENTARY_FOR_QUERIES, - PREFERABLY_FOR_QUERIES -} Use_stat_tables_mode; - -typedef -enum enum_histogram_type -{ - SINGLE_PREC_HB, - DOUBLE_PREC_HB -} Histogram_type; - -enum enum_stat_tables -{ - TABLE_STAT, - COLUMN_STAT, - INDEX_STAT, -}; - - -/* - These enumeration types comprise the dictionary of three - statistical tables table_stat, column_stat and index_stat - as they defined in ../scripts/mysql_system_tables.sql. - - It would be nice if the declarations of these types were - generated automatically by the table definitions. -*/ - -enum enum_table_stat_col -{ - TABLE_STAT_DB_NAME, - TABLE_STAT_TABLE_NAME, - TABLE_STAT_CARDINALITY, - TABLE_STAT_N_FIELDS -}; - -enum enum_column_stat_col -{ - COLUMN_STAT_DB_NAME, - COLUMN_STAT_TABLE_NAME, - COLUMN_STAT_COLUMN_NAME, - COLUMN_STAT_MIN_VALUE, - COLUMN_STAT_MAX_VALUE, - COLUMN_STAT_NULLS_RATIO, - COLUMN_STAT_AVG_LENGTH, - COLUMN_STAT_AVG_FREQUENCY, - COLUMN_STAT_HIST_SIZE, - COLUMN_STAT_HIST_TYPE, - COLUMN_STAT_HISTOGRAM, - COLUMN_STAT_N_FIELDS -}; - -enum enum_index_stat_col -{ - INDEX_STAT_DB_NAME, - INDEX_STAT_TABLE_NAME, - INDEX_STAT_INDEX_NAME, - INDEX_STAT_PREFIX_ARITY, - INDEX_STAT_AVG_FREQUENCY, - INDEX_STAT_N_FIELDS -}; - -inline -Use_stat_tables_mode get_use_stat_tables_mode(THD *thd) -{ - return (Use_stat_tables_mode) (thd->variables.use_stat_tables); -} -inline -bool check_eits_collection_allowed(THD *thd) -{ - return (get_use_stat_tables_mode(thd) == COMPLEMENTARY || - get_use_stat_tables_mode(thd) == PREFERABLY); -} - -inline -bool check_eits_preferred(THD *thd) -{ - return (get_use_stat_tables_mode(thd) == PREFERABLY || - get_use_stat_tables_mode(thd) == PREFERABLY_FOR_QUERIES); -} - -int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables); -int read_statistics_for_tables(THD *thd, TABLE_LIST *tables); -int collect_statistics_for_table(THD *thd, TABLE *table); -void delete_stat_values_for_table_share(TABLE_SHARE *table_share); -int alloc_statistics_for_table(THD *thd, TABLE *table); -int update_statistics_for_table(THD *thd, TABLE *table); -int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *tab); -int delete_statistics_for_column(THD *thd, TABLE *tab, Field *col); -int delete_statistics_for_index(THD *thd, TABLE *tab, KEY *key_info, - bool ext_prefixes_only); -int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *tab, - const LEX_CSTRING *new_db, const LEX_CSTRING *new_tab); -int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col, - const char *new_name); -void set_statistics_for_table(THD *thd, TABLE *table); - -double get_column_avg_frequency(Field * field); - -double get_column_range_cardinality(Field *field, - key_range *min_endp, - key_range *max_endp, - uint range_flag); -bool is_stat_table(const LEX_CSTRING *db, LEX_CSTRING *table); -bool is_eits_usable(Field* field); - -class Histogram -{ - -private: - Histogram_type type; - uint8 size; /* Size of values array, in bytes */ - uchar *values; - - uint prec_factor() - { - switch (type) { - case SINGLE_PREC_HB: - return ((uint) (1 << 8) - 1); - case DOUBLE_PREC_HB: - return ((uint) (1 << 16) - 1); - } - return 1; - } - -public: - uint get_width() - { - switch (type) { - case SINGLE_PREC_HB: - return size; - case DOUBLE_PREC_HB: - return size / 2; - } - return 0; - } - -private: - uint get_value(uint i) - { - DBUG_ASSERT(i < get_width()); - switch (type) { - case SINGLE_PREC_HB: - return (uint) (((uint8 *) values)[i]); - case DOUBLE_PREC_HB: - return (uint) uint2korr(values + i * 2); - } - return 0; - } - - /* Find the bucket which value 'pos' falls into. */ - uint find_bucket(double pos, bool first) - { - uint val= (uint) (pos * prec_factor()); - int lp= 0; - int rp= get_width() - 1; - int d= get_width() / 2; - uint i= lp + d; - for ( ; d; d= (rp - lp) / 2, i= lp + d) - { - if (val == get_value(i)) - break; - if (val < get_value(i)) - rp= i; - else if (val > get_value(i + 1)) - lp= i + 1; - else - break; - } - - if (val > get_value(i) && i < (get_width() - 1)) - i++; - - if (val == get_value(i)) - { - if (first) - { - while(i && val == get_value(i - 1)) - i--; - } - else - { - while(i + 1 < get_width() && val == get_value(i + 1)) - i++; - } - } - return i; - } - -public: - - uint get_size() { return (uint) size; } - - Histogram_type get_type() { return type; } - - uchar *get_values() { return (uchar *) values; } - - void set_size (ulonglong sz) { size= (uint8) sz; } - - void set_type (Histogram_type t) { type= t; } - - void set_values (uchar *vals) { values= (uchar *) vals; } - - bool is_available() { return get_size() > 0 && get_values(); } - - void set_value(uint i, double val) - { - switch (type) { - case SINGLE_PREC_HB: - ((uint8 *) values)[i]= (uint8) (val * prec_factor()); - return; - case DOUBLE_PREC_HB: - int2store(values + i * 2, val * prec_factor()); - return; - } - } - - void set_prev_value(uint i) - { - switch (type) { - case SINGLE_PREC_HB: - ((uint8 *) values)[i]= ((uint8 *) values)[i-1]; - return; - case DOUBLE_PREC_HB: - int2store(values + i * 2, uint2korr(values + i * 2 - 2)); - return; - } - } - - double range_selectivity(double min_pos, double max_pos) - { - double sel; - double bucket_sel= 1.0/(get_width() + 1); - uint min= find_bucket(min_pos, TRUE); - uint max= find_bucket(max_pos, FALSE); - sel= bucket_sel * (max - min + 1); - return sel; - } - - /* - Estimate selectivity of "col=const" using a histogram - */ - double point_selectivity(double pos, double avg_sel); -}; - - -class Columns_statistics; -class Index_statistics; - -/* Statistical data on a table */ - -class Table_statistics -{ - -public: - my_bool cardinality_is_null; /* TRUE if the cardinality is unknown */ - ha_rows cardinality; /* Number of rows in the table */ - uchar *min_max_record_buffers; /* Record buffers for min/max values */ - Column_statistics *column_stats; /* Array of statistical data for columns */ - Index_statistics *index_stats; /* Array of statistical data for indexes */ - - /* Array of records per key for index prefixes */ - ulonglong *idx_avg_frequency; - uchar *histograms; /* Sequence of histograms */ -}; - - -/* - Statistical data on a column - - Note: objects of this class may be "empty", where they have almost all fields - as zeros, for example, get_avg_frequency() will return 0. - - objects are allocated in alloc_statistics_for_table[_share]. -*/ - -class Column_statistics -{ - -private: - static const uint Scale_factor_nulls_ratio= 100000; - static const uint Scale_factor_avg_length= 100000; - static const uint Scale_factor_avg_frequency= 100000; - -public: - /* - Bitmap indicating what statistical characteristics - are available for the column - */ - uint32 column_stat_nulls; - - /* For the below two, see comments in get_column_range_cardinality() */ - /* Minimum value for the column */ - Field *min_value; - /* Maximum value for the column */ - Field *max_value; - -private: - - /* - The ratio Z/N multiplied by the scale factor Scale_factor_nulls_ratio, - where - N is the total number of rows, - Z is the number of nulls in the column - */ - ulong nulls_ratio; - - /* - Average number of bytes occupied by the representation of a - value of the column in memory buffers such as join buffer - multiplied by the scale factor Scale_factor_avg_length. - CHAR values are stripped of trailing spaces. - Flexible values are stripped of their length prefixes. - */ - ulonglong avg_length; - - /* - The ratio N/D multiplied by the scale factor Scale_factor_avg_frequency, - where - N is the number of rows with not null value in the column, - D the number of distinct values among them - */ - ulonglong avg_frequency; - -public: - - Histogram histogram; - - uint32 no_values_provided_bitmap() - { - return - ((1 << (COLUMN_STAT_HISTOGRAM-COLUMN_STAT_COLUMN_NAME))-1) << - (COLUMN_STAT_COLUMN_NAME+1); - } - - void set_all_nulls() - { - column_stat_nulls= no_values_provided_bitmap(); - } - - void set_not_null(uint stat_field_no) - { - column_stat_nulls&= ~(1 << stat_field_no); - } - - bool is_null(uint stat_field_no) - { - return MY_TEST(column_stat_nulls & (1 << stat_field_no)); - } - - double get_nulls_ratio() - { - return (double) nulls_ratio / Scale_factor_nulls_ratio; - } - - double get_avg_length() - { - return (double) avg_length / Scale_factor_avg_length; - } - - double get_avg_frequency() - { - return (double) avg_frequency / Scale_factor_avg_frequency; - } - - void set_nulls_ratio (double val) - { - nulls_ratio= (ulong) (val * Scale_factor_nulls_ratio); - } - - void set_avg_length (double val) - { - avg_length= (ulonglong) (val * Scale_factor_avg_length); - } - - void set_avg_frequency (double val) - { - avg_frequency= (ulonglong) (val * Scale_factor_avg_frequency); - } - - bool min_max_values_are_provided() - { - return !is_null(COLUMN_STAT_MIN_VALUE) && - !is_null(COLUMN_STAT_MAX_VALUE); - } - /* - This function checks whether the values for the fields of the statistical - tables that were NULL by DEFAULT for a column have changed or not. - - @retval - TRUE: Statistics are not present for a column - FALSE: Statisitics are present for a column - */ - bool no_stat_values_provided() - { - if (column_stat_nulls == no_values_provided_bitmap()) - return true; - return false; - } -}; - - -/* Statistical data on an index prefixes */ - -class Index_statistics -{ - -private: - static const uint Scale_factor_avg_frequency= 100000; - /* - The k-th element of this array contains the ratio N/D - multiplied by the scale factor Scale_factor_avg_frequency, - where N is the number of index entries without nulls - in the first k components, and D is the number of distinct - k-component prefixes among them - */ - ulonglong *avg_frequency; - -public: - - void init_avg_frequency(ulonglong *ptr) { avg_frequency= ptr; } - - bool avg_frequency_is_inited() { return avg_frequency != NULL; } - - double get_avg_frequency(uint i) - { - return (double) avg_frequency[i] / Scale_factor_avg_frequency; - } - - void set_avg_frequency(uint i, double val) - { - avg_frequency[i]= (ulonglong) (val * Scale_factor_avg_frequency); - } - -}; - -#endif /* SQL_STATISTICS_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_string.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_string.h deleted file mode 100644 index b3eca11..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_string.h +++ /dev/null @@ -1,1069 +0,0 @@ -#ifndef SQL_STRING_INCLUDED -#define SQL_STRING_INCLUDED - -/* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* This file is originally from the mysql distribution. Coded by monty */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "m_ctype.h" /* my_charset_bin */ -#include /* alloc_root, my_free, my_realloc */ -#include "m_string.h" /* TRASH */ -#include "sql_list.h" - -class String; -#ifdef MYSQL_SERVER -extern PSI_memory_key key_memory_String_value; -#define STRING_PSI_MEMORY_KEY key_memory_String_value -#else -#define STRING_PSI_MEMORY_KEY PSI_NOT_INSTRUMENTED -#endif - -typedef struct st_io_cache IO_CACHE; -typedef struct st_mem_root MEM_ROOT; - -#include "pack.h" -int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); -String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); -inline uint32 copy_and_convert(char *to, size_t to_length, - CHARSET_INFO *to_cs, - const char *from, size_t from_length, - CHARSET_INFO *from_cs, uint *errors) -{ - return my_convert(to, (uint)to_length, to_cs, from, (uint)from_length, from_cs, errors); -} - - -class String_copy_status: protected MY_STRCOPY_STATUS -{ -public: - const char *source_end_pos() const - { return m_source_end_pos; } - const char *well_formed_error_pos() const - { return m_well_formed_error_pos; } -}; - - -class Well_formed_prefix_status: public String_copy_status -{ -public: - Well_formed_prefix_status(CHARSET_INFO *cs, - const char *str, const char *end, size_t nchars) - { cs->well_formed_char_length(str, end, nchars, this); } -}; - - -class Well_formed_prefix: public Well_formed_prefix_status -{ - const char *m_str; // The beginning of the string -public: - Well_formed_prefix(CHARSET_INFO *cs, const char *str, const char *end, - size_t nchars) - :Well_formed_prefix_status(cs, str, end, nchars), m_str(str) - { } - Well_formed_prefix(CHARSET_INFO *cs, const char *str, size_t length, - size_t nchars) - :Well_formed_prefix_status(cs, str, str + length, nchars), m_str(str) - { } - Well_formed_prefix(CHARSET_INFO *cs, const char *str, size_t length) - :Well_formed_prefix_status(cs, str, str + length, length), m_str(str) - { } - Well_formed_prefix(CHARSET_INFO *cs, LEX_CSTRING str, size_t nchars) - :Well_formed_prefix_status(cs, str.str, str.str + str.length, nchars), - m_str(str.str) - { } - size_t length() const { return m_source_end_pos - m_str; } -}; - - -class String_copier: public String_copy_status, - protected MY_STRCONV_STATUS -{ -public: - const char *cannot_convert_error_pos() const - { return m_cannot_convert_error_pos; } - const char *most_important_error_pos() const - { - return well_formed_error_pos() ? well_formed_error_pos() : - cannot_convert_error_pos(); - } - /* - Convert a string between character sets. - "dstcs" and "srccs" cannot be &my_charset_bin. - */ - size_t convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length, - CHARSET_INFO *srccs, const char *src, size_t src_length, size_t nchars) - { - return my_convert_fix(dstcs, dst, dst_length, - srccs, src, src_length, nchars, this, this); - } - /* - Copy a string. Fix bad bytes/characters to '?'. - */ - uint well_formed_copy(CHARSET_INFO *to_cs, char *to, size_t to_length, - CHARSET_INFO *from_cs, const char *from, size_t from_length, size_t nchars); - // Same as above, but without the "nchars" limit. - uint well_formed_copy(CHARSET_INFO *to_cs, char *to, size_t to_length, - CHARSET_INFO *from_cs, const char *from, size_t from_length) - { - return well_formed_copy(to_cs, to, to_length, - from_cs, from, from_length, - from_length /* No limit on "nchars"*/); - } -}; - - -size_t my_copy_with_hex_escaping(CHARSET_INFO *cs, - char *dst, size_t dstlen, - const char *src, size_t srclen); -uint convert_to_printable(char *to, size_t to_len, - const char *from, size_t from_len, - CHARSET_INFO *from_cs, size_t nbytes= 0); -size_t convert_to_printable_required_length(uint len); - - -class Charset -{ - CHARSET_INFO *m_charset; -public: - Charset() :m_charset(&my_charset_bin) { } - Charset(CHARSET_INFO *cs) :m_charset(cs) { } - - CHARSET_INFO *charset() const { return m_charset; } - bool use_mb() const { return m_charset->use_mb(); } - uint mbminlen() const { return m_charset->mbminlen; } - uint mbmaxlen() const { return m_charset->mbmaxlen; } - bool is_good_for_ft() const - { - // Binary and UCS2/UTF16/UTF32 are not supported - return m_charset != &my_charset_bin && m_charset->mbminlen == 1; - } - - size_t numchars(const char *str, const char *end) const - { - return m_charset->numchars(str, end); - } - size_t lengthsp(const char *str, size_t length) const - { - return m_charset->lengthsp(str, length); - } - size_t charpos(const char *str, const char *end, size_t pos) const - { - return m_charset->charpos(str, end, pos); - } - void set_charset(CHARSET_INFO *charset_arg) - { - m_charset= charset_arg; - } - void set_charset(const Charset &other) - { - m_charset= other.m_charset; - } - void swap(Charset &other) - { - swap_variables(CHARSET_INFO*, m_charset, other.m_charset); - } - bool same_encoding(const Charset &other) const - { - return !strcmp(m_charset->csname, other.m_charset->csname); - } - /* - Collation name without the character set name. - For example, in case of "latin1_swedish_ci", - this method returns "_swedish_ci". - */ - LEX_CSTRING collation_specific_name() const; - bool encoding_allows_reinterpret_as(CHARSET_INFO *cs) const; - bool eq_collation_specific_names(CHARSET_INFO *cs) const; -}; - - -/* - A storage for String. - Should be eventually derived from LEX_STRING. -*/ -class Static_binary_string : public Sql_alloc -{ -protected: - char *Ptr; - uint32 str_length; -public: - Static_binary_string() - :Ptr(NULL), - str_length(0) - { } - Static_binary_string(char *str, size_t length_arg) - :Ptr(str), - str_length((uint32) length_arg) - { - DBUG_ASSERT(length_arg < UINT_MAX32); - } - inline uint32 length() const { return str_length;} - inline char& operator [] (size_t i) const { return Ptr[i]; } - inline void length(size_t len) { str_length=(uint32)len ; } - inline bool is_empty() const { return (str_length == 0); } - inline const char *ptr() const { return Ptr; } - inline const char *end() const { return Ptr + str_length; } - bool has_8bit_bytes() const - { - for (const char *c= ptr(), *c_end= end(); c < c_end; c++) - { - if (!my_isascii(*c)) - return true; - } - return false; - } - - bool bin_eq(const Static_binary_string *other) const - { - return length() == other->length() && - !memcmp(ptr(), other->ptr(), length()); - } - - void set(char *str, size_t len) - { - Ptr= str; - str_length= (uint32) len; - } - - void swap(Static_binary_string &s) - { - swap_variables(char *, Ptr, s.Ptr); - swap_variables(uint32, str_length, s.str_length); - } - - /* - PMG 2004.11.12 - This is a method that works the same as perl's "chop". It simply - drops the last character of a string. This is useful in the case - of the federated storage handler where I'm building a unknown - number, list of values and fields to be used in a sql insert - statement to be run on the remote server, and have a comma after each. - When the list is complete, I "chop" off the trailing comma - - ex. - String stringobj; - stringobj.append("VALUES ('foo', 'fi', 'fo',"); - stringobj.chop(); - stringobj.append(")"); - - In this case, the value of string was: - - VALUES ('foo', 'fi', 'fo', - VALUES ('foo', 'fi', 'fo' - VALUES ('foo', 'fi', 'fo') - */ - inline void chop() - { - str_length--; - Ptr[str_length]= '\0'; - DBUG_ASSERT(strlen(Ptr) == str_length); - } - - // Returns offset to substring or -1 - int strstr(const Static_binary_string &search, uint32 offset=0); - // Returns offset to substring or -1 - int strrstr(const Static_binary_string &search, uint32 offset=0); - - /* - The following append operations do NOT check alloced memory - q_*** methods writes values of parameters itself - qs_*** methods writes string representation of value - */ - void q_append(const char c) - { - Ptr[str_length++] = c; - } - void q_append2b(const uint32 n) - { - int2store(Ptr + str_length, n); - str_length += 2; - } - void q_append(const uint32 n) - { - int4store(Ptr + str_length, n); - str_length += 4; - } - void q_append(double d) - { - float8store(Ptr + str_length, d); - str_length += 8; - } - void q_append(double *d) - { - float8store(Ptr + str_length, *d); - str_length += 8; - } - void q_append(const char *data, size_t data_len) - { - if (data_len) - memcpy(Ptr + str_length, data, data_len); - DBUG_ASSERT(str_length <= UINT_MAX32 - data_len); - str_length += (uint)data_len; - } - void q_append(const LEX_CSTRING *ls) - { - DBUG_ASSERT(ls->length < UINT_MAX32 && - ((ls->length == 0 && !ls->str) || - ls->length == strlen(ls->str))); - q_append(ls->str, (uint32) ls->length); - } - - void write_at_position(int position, uint32 value) - { - int4store(Ptr + position,value); - } - - void qs_append(const char *str) - { - qs_append(str, (uint32)strlen(str)); - } - void qs_append(const LEX_CSTRING *ls) - { - DBUG_ASSERT(ls->length < UINT_MAX32 && - ((ls->length == 0 && !ls->str) || - ls->length == strlen(ls->str))); - qs_append(ls->str, (uint32)ls->length); - } - void qs_append(const char *str, size_t len); - void qs_append_hex(const char *str, uint32 len); - void qs_append(double d); - void qs_append(const double *d); - inline void qs_append(const char c) - { - Ptr[str_length]= c; - str_length++; - } - void qs_append(int i); - void qs_append(uint i) - { - qs_append((ulonglong)i); - } - void qs_append(ulong i) - { - qs_append((ulonglong)i); - } - void qs_append(ulonglong i); - void qs_append(longlong i, int radix) - { - char *buff= Ptr + str_length; - char *end= ll2str(i, buff, radix, 0); - str_length+= uint32(end-buff); - } -}; - - -class Binary_string: public Static_binary_string -{ - uint32 Alloced_length, extra_alloc; - bool alloced, thread_specific; - void init_private_data() - { - Alloced_length= extra_alloc= 0; - alloced= thread_specific= false; - } -public: - Binary_string() - { - init_private_data(); - } - explicit Binary_string(size_t length_arg) - { - init_private_data(); - (void) real_alloc(length_arg); - } - explicit Binary_string(const char *str) - :Binary_string(str, strlen(str)) - { } - /* - NOTE: If one intend to use the c_ptr() method, the following two - contructors need the size of memory for STR to be at least LEN+1 (to make - room for zero termination). - */ - Binary_string(const char *str, size_t len) - :Static_binary_string((char *) str, len) - { - init_private_data(); - } - Binary_string(char *str, size_t len) - :Static_binary_string(str, len) - { - Alloced_length= (uint32) len; - extra_alloc= 0; - alloced= thread_specific= 0; - } - explicit Binary_string(const Binary_string &str) - :Static_binary_string(str) - { - Alloced_length= str.Alloced_length; - extra_alloc= 0; - alloced= thread_specific= 0; - } - - ~Binary_string() { free(); } - - /* Mark variable thread specific it it's not allocated already */ - inline void set_thread_specific() - { - if (!alloced) - thread_specific= 1; - } - bool is_alloced() const { return alloced; } - inline uint32 alloced_length() const { return Alloced_length;} - inline uint32 extra_allocation() const { return extra_alloc;} - inline void extra_allocation(size_t len) { extra_alloc= (uint32)len; } - inline void mark_as_const() { Alloced_length= 0;} - - inline bool uses_buffer_owned_by(const Binary_string *s) const - { - return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length); - } - - /* Swap two string objects. Efficient way to exchange data without memcpy. */ - void swap(Binary_string &s) - { - Static_binary_string::swap(s); - swap_variables(uint32, Alloced_length, s.Alloced_length); - swap_variables(bool, alloced, s.alloced); - } - - /** - Points the internal buffer to the supplied one. The old buffer is freed. - @param str Pointer to the new buffer. - @param arg_length Length of the new buffer in characters, excluding any - null character. - @note The new buffer will not be null terminated. - */ - void set_alloced(char *str, size_t length_arg, size_t alloced_length_arg) - { - free(); - Static_binary_string::set(str, length_arg); - DBUG_ASSERT(alloced_length_arg < UINT_MAX32); - Alloced_length= (uint32) alloced_length_arg; - } - inline void set(char *str, size_t arg_length) - { - set_alloced(str, arg_length, arg_length); - } - inline void set(const char *str, size_t arg_length) - { - free(); - Static_binary_string::set((char *) str, arg_length); - } - - void set(Binary_string &str, size_t offset, size_t arg_length) - { - DBUG_ASSERT(&str != this); - free(); - Static_binary_string::set((char*) str.ptr() + offset, arg_length); - if (str.Alloced_length) - Alloced_length= (uint32) (str.Alloced_length - offset); - } - inline LEX_CSTRING *get_value(LEX_CSTRING *res) - { - res->str= Ptr; - res->length= str_length; - return res; - } - - /* Take over handling of buffer from some other object */ - void reset(char *ptr_arg, size_t length_arg, size_t alloced_length_arg) - { - set_alloced(ptr_arg, length_arg, alloced_length_arg); - alloced= ptr_arg != 0; - } - - /* Forget about the buffer, let some other object handle it */ - char *release() - { - char *old= Ptr; - Static_binary_string::set(NULL, 0); - init_private_data(); - return old; - } - - inline void set_quick(char *str, size_t arg_length) - { - if (!alloced) - { - Static_binary_string::set(str, arg_length); - Alloced_length= (uint32) arg_length; - } - } - - inline Binary_string& operator=(const Binary_string &s) - { - if (&s != this) - { - /* - It is forbidden to do assignments like - some_string = substring_of_that_string - */ - DBUG_ASSERT(!s.uses_buffer_owned_by(this)); - set_alloced((char *) s.Ptr, s.str_length, s.Alloced_length); - } - return *this; - } - - bool set_hex(ulonglong num); - bool set_hex(const char *str, uint32 len); - bool set_fcvt(double num, uint decimals); - - bool copy(); // Alloc string if not alloced - bool copy(const Binary_string &s); // Allocate new string - bool copy(const char *s, size_t arg_length); // Allocate new string - bool copy_or_move(const char *s,size_t arg_length); - - /** - Convert a string to a printable format. - All non-convertable and control characters are replaced to 5-character - sequences '\hhhh'. - */ - bool copy_printable_hhhh(CHARSET_INFO *to_cs, - CHARSET_INFO *from_cs, - const char *from, size_t from_length); - - bool append_ulonglong(ulonglong val); - bool append_longlong(longlong val); - - bool append(const char *s, size_t size) - { - if (!size) - return false; - if (realloc_with_extra_if_needed(str_length + size)) - return true; - q_append(s, size); - return false; - } - bool append(const LEX_CSTRING &s) - { - return append(s.str, s.length); - } - bool append(const Binary_string &s) - { - return append(s.ptr(), s.length()); - } - bool append(IO_CACHE* file, uint32 arg_length); - - inline bool append_char(char chr) - { - if (str_length < Alloced_length) - { - Ptr[str_length++]= chr; - } - else - { - if (unlikely(realloc_with_extra(str_length + 1))) - return true; - Ptr[str_length++]= chr; - } - return false; - } - bool append_hex(const char *src, uint32 srclen) - { - for (const char *src_end= src + srclen ; src != src_end ; src++) - { - if (unlikely(append_char(_dig_vec_lower[((uchar) *src) >> 4])) || - unlikely(append_char(_dig_vec_lower[((uchar) *src) & 0x0F]))) - return true; - } - return false; - } - - bool append_with_step(const char *s, uint32 arg_length, uint32 step_alloc) - { - uint32 new_length= arg_length + str_length; - if (new_length > Alloced_length && - unlikely(realloc(new_length + step_alloc))) - return true; - q_append(s, arg_length); - return false; - } - - inline char *c_ptr() - { - DBUG_ASSERT(!alloced || !Ptr || !Alloced_length || - (Alloced_length >= (str_length + 1))); - - if (!Ptr || Ptr[str_length]) // Should be safe - (void) realloc(str_length); - return Ptr; - } - inline char *c_ptr_quick() - { - if (Ptr && str_length < Alloced_length) - Ptr[str_length]=0; - return Ptr; - } - inline char *c_ptr_safe() - { - if (Ptr && str_length < Alloced_length) - Ptr[str_length]=0; - else - (void) realloc(str_length); - return Ptr; - } - - inline void free() - { - if (alloced) - { - alloced=0; - my_free(Ptr); - } - Alloced_length= extra_alloc= 0; - Static_binary_string::set(NULL, 0); // Safety - } - inline bool alloc(size_t arg_length) - { - if (arg_length < Alloced_length) - return 0; - return real_alloc(arg_length); - } - bool real_alloc(size_t arg_length); // Empties old string - bool realloc_raw(size_t arg_length); - bool realloc(size_t arg_length) - { - if (realloc_raw(arg_length)) - return TRUE; - Ptr[arg_length]= 0; // This make other funcs shorter - return FALSE; - } - bool realloc_with_extra(size_t arg_length) - { - if (extra_alloc < 4096) - extra_alloc= extra_alloc*2+128; - if (realloc_raw(arg_length + extra_alloc)) - return TRUE; - Ptr[arg_length]=0; // This make other funcs shorter - return FALSE; - } - bool realloc_with_extra_if_needed(size_t arg_length) - { - if (arg_length < Alloced_length) - { - Ptr[arg_length]=0; // behave as if realloc was called. - return 0; - } - return realloc_with_extra(arg_length); - } - // Shrink the buffer, but only if it is allocated on the heap. - void shrink(size_t arg_length); - - void move(Binary_string &s) - { - set_alloced(s.Ptr, s.str_length, s.Alloced_length); - extra_alloc= s.extra_alloc; - alloced= s.alloced; - thread_specific= s.thread_specific; - s.alloced= 0; - } - bool fill(uint32 max_length,char fill); - /* - Replace substring with string - If wrong parameter or not enough memory, do nothing - */ - bool replace(uint32 offset,uint32 arg_length, const char *to, uint32 length); - bool replace(uint32 offset,uint32 arg_length, const Static_binary_string &to) - { - return replace(offset,arg_length,to.ptr(),to.length()); - } - - int reserve(size_t space_needed) - { - DBUG_ASSERT((ulonglong) str_length + space_needed < UINT_MAX32); - return realloc(str_length + space_needed); - } - int reserve(size_t space_needed, size_t grow_by); - - inline char *prep_append(uint32 arg_length, uint32 step_alloc) - { - uint32 new_length= arg_length + str_length; - if (new_length > Alloced_length) - { - if (unlikely(realloc(new_length + step_alloc))) - return 0; - } - uint32 old_length= str_length; - str_length+= arg_length; - return Ptr + old_length; // Area to use - } - - - void q_net_store_length(ulonglong length) - { - DBUG_ASSERT(Alloced_length >= (str_length + net_length_size(length))); - char *pos= (char *) net_store_length((uchar *)(Ptr + str_length), length); - str_length= uint32(pos - Ptr); - } - void q_net_store_data(const uchar *from, size_t length) - { - DBUG_ASSERT(length < UINT_MAX32); - DBUG_ASSERT(Alloced_length >= (str_length + length + - net_length_size(length))); - q_net_store_length(length); - q_append((const char *)from, (uint32) length); - } -}; - - -class String: public Charset, public Binary_string -{ -public: - String() { } - String(size_t length_arg) - :Binary_string(length_arg) - { } - String(const char *str, CHARSET_INFO *cs) - :Charset(cs), - Binary_string(str) - { } - /* - NOTE: If one intend to use the c_ptr() method, the following two - contructors need the size of memory for STR to be at least LEN+1 (to make - room for zero termination). - */ - String(const char *str, size_t len, CHARSET_INFO *cs) - :Charset(cs), - Binary_string((char *) str, len) - { } - String(char *str, size_t len, CHARSET_INFO *cs) - :Charset(cs), - Binary_string(str, len) - { } - String(const String &str) - :Charset(str), - Binary_string(str) - { } - - void set(String &str,size_t offset,size_t arg_length) - { - Binary_string::set(str, offset, arg_length); - set_charset(str); - } - inline void set(char *str,size_t arg_length, CHARSET_INFO *cs) - { - Binary_string::set(str, arg_length); - set_charset(cs); - } - inline void set(const char *str,size_t arg_length, CHARSET_INFO *cs) - { - Binary_string::set(str, arg_length); - set_charset(cs); - } - bool set_ascii(const char *str, size_t arg_length); - inline void set_quick(char *str,size_t arg_length, CHARSET_INFO *cs) - { - Binary_string::set_quick(str, arg_length); - set_charset(cs); - } - bool set_int(longlong num, bool unsigned_flag, CHARSET_INFO *cs); - bool set(int num, CHARSET_INFO *cs) { return set_int(num, false, cs); } - bool set(uint num, CHARSET_INFO *cs) { return set_int(num, true, cs); } - bool set(long num, CHARSET_INFO *cs) { return set_int(num, false, cs); } - bool set(ulong num, CHARSET_INFO *cs) { return set_int(num, true, cs); } - bool set(longlong num, CHARSET_INFO *cs) { return set_int(num, false, cs); } - bool set(ulonglong num, CHARSET_INFO *cs) { return set_int((longlong)num, true, cs); } - bool set_real(double num,uint decimals, CHARSET_INFO *cs); - bool set_fcvt(double num, uint decimals) - { - set_charset(&my_charset_latin1); - return Binary_string::set_fcvt(num, decimals); - } - - bool set_hex(ulonglong num) - { - set_charset(&my_charset_latin1); - return Binary_string::set_hex(num); - } - bool set_hex(const char *str, uint32 len) - { - set_charset(&my_charset_latin1); - return Binary_string::set_hex(str, len); - } - - /* Take over handling of buffer from some other object */ - void reset(char *ptr_arg, size_t length_arg, size_t alloced_length_arg, - CHARSET_INFO *cs) - { - Binary_string::reset(ptr_arg, length_arg, alloced_length_arg); - set_charset(cs); - } - - inline String& operator = (const String &s) - { - if (&s != this) - { - set_charset(s); - Binary_string::operator=(s); - } - return *this; - } - - bool copy() - { - return Binary_string::copy(); - } - bool copy(const String &s) - { - set_charset(s); - return Binary_string::copy(s); - } - bool copy(const char *s, size_t arg_length, CHARSET_INFO *cs) - { - set_charset(cs); - return Binary_string::copy(s, arg_length); - } - bool copy_or_move(const char *s, size_t arg_length, CHARSET_INFO *cs) - { - set_charset(cs); - return Binary_string::copy_or_move(s, arg_length); - } - static bool needs_conversion(size_t arg_length, - CHARSET_INFO *cs_from, CHARSET_INFO *cs_to, - uint32 *offset); - static bool needs_conversion_on_storage(size_t arg_length, - CHARSET_INFO *cs_from, - CHARSET_INFO *cs_to); - bool copy_aligned(const char *s, size_t arg_length, size_t offset, - CHARSET_INFO *cs); - bool set_or_copy_aligned(const char *s, size_t arg_length, CHARSET_INFO *cs); - bool can_be_safely_converted_to(CHARSET_INFO *tocs) const - { - if (charset() == &my_charset_bin) - return Well_formed_prefix(tocs, ptr(), length()).length() == length(); - String try_val; - uint try_conv_error= 0; - try_val.copy(ptr(), length(), charset(), tocs, &try_conv_error); - return try_conv_error == 0; - } - bool copy(const char*s, size_t arg_length, CHARSET_INFO *csfrom, - CHARSET_INFO *csto, uint *errors); - bool copy(const String *str, CHARSET_INFO *tocs, uint *errors) - { - return copy(str->ptr(), str->length(), str->charset(), tocs, errors); - } - bool copy(CHARSET_INFO *tocs, - CHARSET_INFO *fromcs, const char *src, size_t src_length, - size_t nchars, String_copier *copier) - { - if (unlikely(alloc(tocs->mbmaxlen * src_length))) - return true; - str_length= copier->well_formed_copy(tocs, Ptr, alloced_length(), - fromcs, src, (uint)src_length, (uint)nchars); - set_charset(tocs); - return false; - } - // Append without character set conversion - bool append(const String &s) - { - return Binary_string::append(s); - } - inline bool append(char chr) - { - return Binary_string::append_char(chr); - } - bool append_hex(const char *src, uint32 srclen) - { - return Binary_string::append_hex(src, srclen); - } - bool append_hex(const uchar *src, uint32 srclen) - { - return Binary_string::append_hex((const char*)src, srclen); - } - bool append_introducer_and_hex(const String *str) - { - return - append(STRING_WITH_LEN("_")) || - append(str->charset()->csname) || - append(STRING_WITH_LEN(" 0x")) || - append_hex(str->ptr(), (uint32) str->length()); - } - bool append(IO_CACHE* file, uint32 arg_length) - { - return Binary_string::append(file, arg_length); - } - inline bool append(const char *s, uint32 arg_length, uint32 step_alloc) - { - return append_with_step(s, arg_length, step_alloc); - } - - // Append with optional character set conversion from ASCII (e.g. to UCS2) - bool append(const char *s) - { - return append(s, strlen(s)); - } - bool append(const LEX_STRING *ls) - { - DBUG_ASSERT(ls->length < UINT_MAX32 && - ((ls->length == 0 && !ls->str) || - ls->length == strlen(ls->str))); - return append(ls->str, (uint32) ls->length); - } - bool append(const LEX_CSTRING *ls) - { - DBUG_ASSERT(ls->length < UINT_MAX32 && - ((ls->length == 0 && !ls->str) || - ls->length == strlen(ls->str))); - return append(ls->str, (uint32) ls->length); - } - bool append(const LEX_CSTRING &ls) - { - return append(&ls); - } - bool append(const char *s, size_t size); - bool append_with_prefill(const char *s, uint32 arg_length, - uint32 full_length, char fill_char); - bool append_parenthesized(long nr, int radix= 10); - - // Append with optional character set conversion from cs to charset() - bool append(const char *s, size_t arg_length, CHARSET_INFO *cs); - bool append(const LEX_CSTRING &s, CHARSET_INFO *cs) - { - return append(s.str, s.length, cs); - } - - void strip_sp(); - friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); - friend int stringcmp(const String *a,const String *b); - friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); - friend class Field; - uint32 numchars() const - { - return (uint32) Charset::numchars(ptr(), end()); - } - int charpos(longlong i, uint32 offset=0) - { - if (i <= 0) - return (int) i; - return (int) Charset::charpos(ptr() + offset, end(), (size_t) i); - } - size_t lengthsp() const - { - return Charset::lengthsp(Ptr, str_length); - } - - void print(String *to) const; - void print_with_conversion(String *to, CHARSET_INFO *cs) const; - void print(String *to, CHARSET_INFO *cs) const - { - if (my_charset_same(charset(), cs)) - print(to); - else - print_with_conversion(to, cs); - } - - bool append_for_single_quote(const char *st, size_t len); - bool append_for_single_quote(const String *s) - { - return append_for_single_quote(s->ptr(), s->length()); - } - bool append_for_single_quote(const char *st) - { - size_t len= strlen(st); - DBUG_ASSERT(len < UINT_MAX32); - return append_for_single_quote(st, (uint32) len); - } - - void swap(String &s) - { - Charset::swap(s); - Binary_string::swap(s); - } - - uint well_formed_length() const - { - return (uint) Well_formed_prefix(charset(), ptr(), length()).length(); - } - bool is_ascii() const - { - if (length() == 0) - return TRUE; - if (charset()->mbminlen > 1) - return FALSE; - return !has_8bit_bytes(); - } - bool eq(const String *other, CHARSET_INFO *cs) const - { - return !sortcmp(this, other, cs); - } -private: - bool append_semi_hex(const char *s, uint len, CHARSET_INFO *cs); -}; - - -// The following class is a backport from MySQL 5.6: -/** - String class wrapper with a preallocated buffer of size buff_sz - - This class allows to replace sequences of: - char buff[12345]; - String str(buff, sizeof(buff)); - str.length(0); - with a simple equivalent declaration: - StringBuffer<12345> str; -*/ - -template -class StringBuffer : public String -{ - char buff[buff_sz]; - -public: - StringBuffer() : String(buff, buff_sz, &my_charset_bin) { length(0); } - explicit StringBuffer(CHARSET_INFO *cs) : String(buff, buff_sz, cs) - { - length(0); - } -}; - - -template -class BinaryStringBuffer : public Binary_string -{ - char buff[buff_sz]; -public: - BinaryStringBuffer() : Binary_string(buff, buff_sz) { length(0); } -}; - - -class String_space: public String -{ -public: - String_space(uint n) - { - if (fill(n, ' ')) - set("", 0, &my_charset_bin); - } -}; - - -static inline bool check_if_only_end_space(CHARSET_INFO *cs, - const char *str, - const char *end) -{ - return str + cs->scan(str, end, MY_SEQ_SPACES) == end; -} - -int append_query_string(CHARSET_INFO *csinfo, String *to, - const char *str, size_t len, bool no_backslash); - -#endif /* SQL_STRING_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_table.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_table.h deleted file mode 100644 index d67ceb6..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_table.h +++ /dev/null @@ -1,296 +0,0 @@ -/* Copyright (c) 2006, 2014, Oracle and/or its affiliates. - Copyright (c) 2011, 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_TABLE_INCLUDED -#define SQL_TABLE_INCLUDED - -#include // pthread_mutex_t -#include "m_string.h" // LEX_CUSTRING - -class Alter_info; -class Alter_table_ctx; -class Column_definition; -class Create_field; -struct TABLE_LIST; -class THD; -struct TABLE; -struct handlerton; -class handler; -class String; -typedef struct st_ha_check_opt HA_CHECK_OPT; -struct HA_CREATE_INFO; -struct Table_specification_st; -typedef struct st_key KEY; -typedef struct st_key_cache KEY_CACHE; -typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE; -typedef struct st_order ORDER; - -enum ddl_log_entry_code -{ - /* - DDL_LOG_EXECUTE_CODE: - This is a code that indicates that this is a log entry to - be executed, from this entry a linked list of log entries - can be found and executed. - DDL_LOG_ENTRY_CODE: - An entry to be executed in a linked list from an execute log - entry. - DDL_IGNORE_LOG_ENTRY_CODE: - An entry that is to be ignored - */ - DDL_LOG_EXECUTE_CODE = 'e', - DDL_LOG_ENTRY_CODE = 'l', - DDL_IGNORE_LOG_ENTRY_CODE = 'i' -}; - -enum ddl_log_action_code -{ - /* - The type of action that a DDL_LOG_ENTRY_CODE entry is to - perform. - DDL_LOG_DELETE_ACTION: - Delete an entity - DDL_LOG_RENAME_ACTION: - Rename an entity - DDL_LOG_REPLACE_ACTION: - Rename an entity after removing the previous entry with the - new name, that is replace this entry. - DDL_LOG_EXCHANGE_ACTION: - Exchange two entities by renaming them a -> tmp, b -> a, tmp -> b. - */ - DDL_LOG_DELETE_ACTION = 'd', - DDL_LOG_RENAME_ACTION = 'r', - DDL_LOG_REPLACE_ACTION = 's', - DDL_LOG_EXCHANGE_ACTION = 'e' -}; - -enum enum_ddl_log_exchange_phase { - EXCH_PHASE_NAME_TO_TEMP= 0, - EXCH_PHASE_FROM_TO_NAME= 1, - EXCH_PHASE_TEMP_TO_FROM= 2 -}; - - -typedef struct st_ddl_log_entry -{ - const char *name; - const char *from_name; - const char *handler_name; - const char *tmp_name; - uint next_entry; - uint entry_pos; - enum ddl_log_entry_code entry_type; - enum ddl_log_action_code action_type; - /* - Most actions have only one phase. REPLACE does however have two - phases. The first phase removes the file with the new name if - there was one there before and the second phase renames the - old name to the new name. - */ - char phase; -} DDL_LOG_ENTRY; - -typedef struct st_ddl_log_memory_entry -{ - uint entry_pos; - struct st_ddl_log_memory_entry *next_log_entry; - struct st_ddl_log_memory_entry *prev_log_entry; - struct st_ddl_log_memory_entry *next_active_log_entry; -} DDL_LOG_MEMORY_ENTRY; - - -enum enum_explain_filename_mode -{ - EXPLAIN_ALL_VERBOSE= 0, - EXPLAIN_PARTITIONS_VERBOSE, - EXPLAIN_PARTITIONS_AS_COMMENT -}; - - -/* depends on errmsg.txt Database `db`, Table `t` ... */ -#define EXPLAIN_FILENAME_MAX_EXTRA_LENGTH 63 - -#define WFRM_WRITE_SHADOW 1 -#define WFRM_INSTALL_SHADOW 2 -#define WFRM_KEEP_SHARE 4 - -/* Flags for conversion functions. */ -static const uint FN_FROM_IS_TMP= 1 << 0; -static const uint FN_TO_IS_TMP= 1 << 1; -static const uint FN_IS_TMP= FN_FROM_IS_TMP | FN_TO_IS_TMP; -static const uint NO_FRM_RENAME= 1 << 2; -static const uint FRM_ONLY= 1 << 3; -/** Don't remove table in engine. Remove only .FRM and maybe .PAR files. */ -static const uint NO_HA_TABLE= 1 << 4; -/** Don't resolve MySQL's fake "foo.sym" symbolic directory names. */ -static const uint SKIP_SYMDIR_ACCESS= 1 << 5; -/** Don't check foreign key constraints while renaming table */ -static const uint NO_FK_CHECKS= 1 << 6; -/* Don't delete .par table in quick_rm_table() */ -static const uint NO_PAR_TABLE= 1 << 7; - -uint filename_to_tablename(const char *from, char *to, size_t to_length, - bool stay_quiet = false); -uint tablename_to_filename(const char *from, char *to, size_t to_length); -uint check_n_cut_mysql50_prefix(const char *from, char *to, size_t to_length); -bool check_mysql50_prefix(const char *name); -uint build_table_filename(char *buff, size_t bufflen, const char *db, - const char *table, const char *ext, uint flags); -uint build_table_shadow_filename(char *buff, size_t bufflen, - ALTER_PARTITION_PARAM_TYPE *lpt); -uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen); -bool mysql_create_table(THD *thd, TABLE_LIST *create_table, - Table_specification_st *create_info, - Alter_info *alter_info); -bool add_keyword_to_query(THD *thd, String *result, const LEX_CSTRING *keyword, - const LEX_CSTRING *add); - -/* - mysql_create_table_no_lock can be called in one of the following - mutually exclusive situations: - - - Just a normal ordinary CREATE TABLE statement that explicitly - defines the table structure. - - - CREATE TABLE ... SELECT. It is special, because only in this case, - the list of fields is allowed to have duplicates, as long as one of the - duplicates comes from the select list, and the other doesn't. For - example in - - CREATE TABLE t1 (a int(5) NOT NUL) SELECT b+10 as a FROM t2; - - the list in alter_info->create_list will have two fields `a`. - - - ALTER TABLE, that creates a temporary table #sql-xxx, which will be later - renamed to replace the original table. - - - ALTER TABLE as above, but which only modifies the frm file, it only - creates an frm file for the #sql-xxx, the table in the engine is not - created. - - - Assisted discovery, CREATE TABLE statement without the table structure. - - These situations are distinguished by the following "create table mode" - values, where a CREATE ... SELECT is denoted by any non-negative number - (which should be the number of fields in the SELECT ... part), and other - cases use constants as defined below. -*/ -#define C_CREATE_SELECT(X) ((X) > 0 ? (X) : 0) -#define C_ORDINARY_CREATE 0 -#define C_ALTER_TABLE -1 -#define C_ALTER_TABLE_FRM_ONLY -2 -#define C_ASSISTED_DISCOVERY -3 - -int mysql_create_table_no_lock(THD *thd, const LEX_CSTRING *db, - const LEX_CSTRING *table_name, - Table_specification_st *create_info, - Alter_info *alter_info, bool *is_trans, - int create_table_mode, TABLE_LIST *table); - -handler *mysql_create_frm_image(THD *thd, - const LEX_CSTRING &db, - const LEX_CSTRING &table_name, - HA_CREATE_INFO *create_info, - Alter_info *alter_info, - int create_table_mode, - KEY **key_info, - uint *key_count, - LEX_CUSTRING *frm); - -int mysql_discard_or_import_tablespace(THD *thd, - TABLE_LIST *table_list, - bool discard); - -bool mysql_prepare_alter_table(THD *thd, TABLE *table, - HA_CREATE_INFO *create_info, - Alter_info *alter_info, - Alter_table_ctx *alter_ctx); -bool mysql_trans_prepare_alter_copy_data(THD *thd); -bool mysql_trans_commit_alter_copy_data(THD *thd); -bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, - const LEX_CSTRING *new_name, - HA_CREATE_INFO *create_info, - TABLE_LIST *table_list, - Alter_info *alter_info, - uint order_num, ORDER *order, bool ignore, - bool if_exists); -bool mysql_compare_tables(TABLE *table, - Alter_info *alter_info, - HA_CREATE_INFO *create_info, - bool *metadata_equal); -bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy); -bool mysql_create_like_table(THD *thd, TABLE_LIST *table, - TABLE_LIST *src_table, - Table_specification_st *create_info); -bool mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db, - const LEX_CSTRING *old_name, const LEX_CSTRING *new_db, - const LEX_CSTRING *new_name, uint flags); - -bool mysql_backup_table(THD* thd, TABLE_LIST* table_list); -bool mysql_restore_table(THD* thd, TABLE_LIST* table_list); - -bool mysql_checksum_table(THD* thd, TABLE_LIST* table_list, - HA_CHECK_OPT* check_opt); -bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists, - bool drop_temporary, bool drop_sequence, - bool dont_log_query); -int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, - bool drop_temporary, bool drop_view, - bool drop_sequence, - bool dont_log_query, bool dont_free_locks); -bool log_drop_table(THD *thd, const LEX_CSTRING *db_name, - const LEX_CSTRING *table_name, bool temporary_table); -bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db, - const LEX_CSTRING *table_name, uint flags, - const char *table_path=0); -void close_cached_table(THD *thd, TABLE *table); -void sp_prepare_create_field(THD *thd, Column_definition *sql_field); -CHARSET_INFO* get_sql_field_charset(Column_definition *sql_field, - HA_CREATE_INFO *create_info); -bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags); -int write_bin_log(THD *thd, bool clear_error, - char const *query, ulong query_length, - bool is_trans= FALSE); -int write_bin_log_with_if_exists(THD *thd, bool clear_error, - bool is_trans, bool add_if_exists); -bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry, - DDL_LOG_MEMORY_ENTRY **active_entry); -bool write_execute_ddl_log_entry(uint first_entry, - bool complete, - DDL_LOG_MEMORY_ENTRY **active_entry); -bool deactivate_ddl_log_entry(uint entry_no); -void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry); -bool sync_ddl_log(); -void release_ddl_log(); -void execute_ddl_log_recovery(); -bool execute_ddl_log_entry(THD *thd, uint first_entry); - -template class List; -void promote_first_timestamp_column(List *column_definitions); - -/* - These prototypes where under INNODB_COMPATIBILITY_HOOKS. -*/ -uint explain_filename(THD* thd, const char *from, char *to, uint to_length, - enum_explain_filename_mode explain_mode); - - -extern MYSQL_PLUGIN_IMPORT const char *primary_key_name; -extern mysql_mutex_t LOCK_gdl; - -bool check_engine(THD *, const char *, const char *, HA_CREATE_INFO *); - -#endif /* SQL_TABLE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_tablespace.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_tablespace.h deleted file mode 100644 index 0760935..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_tablespace.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_TABLESPACE_INCLUDED -#define SQL_TABLESPACE_INCLUDED - -class THD; -class st_alter_tablespace; - -int mysql_alter_tablespace(THD* thd, st_alter_tablespace *ts_info); - -#endif /* SQL_TABLESPACE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_test.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_test.h deleted file mode 100644 index 2ab305a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_test.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_TEST_INCLUDED -#define SQL_TEST_INCLUDED - -#include "mysqld.h" -#include "opt_trace_context.h" - -class JOIN; -struct TABLE_LIST; -typedef class Item COND; -typedef class st_select_lex SELECT_LEX; -struct SORT_FIELD; - -#ifndef DBUG_OFF -void print_where(COND *cond,const char *info, enum_query_type query_type); -void TEST_filesort(SORT_FIELD *sortorder,uint s_length); -void TEST_join(JOIN *join); -void print_plan(JOIN* join,uint idx, double record_count, double read_time, - double current_read_time, const char *info); -void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array); -void print_sjm(SJ_MATERIALIZATION_INFO *sjm); -void dump_TABLE_LIST_graph(SELECT_LEX *select_lex, TABLE_LIST* tl); -#endif -void print_keyuse_array_for_trace(THD *thd, DYNAMIC_ARRAY *keyuse_array); -void mysql_print_status(); - -#endif /* SQL_TEST_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_time.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_time.h deleted file mode 100644 index c918eb6..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_time.h +++ /dev/null @@ -1,190 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. - Copyright (c) 2011, 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_TIME_INCLUDED -#define SQL_TIME_INCLUDED - -#include "sql_basic_types.h" -#include "my_time.h" -#include "mysql_time.h" /* timestamp_type */ -#include "sql_error.h" /* Sql_condition */ -#include "structs.h" /* INTERVAL */ - -typedef enum enum_mysql_timestamp_type timestamp_type; -typedef struct st_date_time_format DATE_TIME_FORMAT; -typedef struct st_known_date_time_format KNOWN_DATE_TIME_FORMAT; - -/* Flags for calc_week() function. */ -#define WEEK_MONDAY_FIRST 1 -#define WEEK_YEAR 2 -#define WEEK_FIRST_WEEKDAY 4 - -ulong convert_period_to_month(ulong period); -ulong convert_month_to_period(ulong month); -void set_current_date(THD *thd, MYSQL_TIME *to); -bool time_to_datetime(MYSQL_TIME *ltime); -bool get_date_from_daynr(long daynr,uint *year, uint *month, uint *day); -my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, uint *error_code); -bool str_to_datetime_with_warn(THD *thd, - CHARSET_INFO *cs, const char *str, size_t length, - MYSQL_TIME *l_time, - date_mode_t flags); -bool double_to_datetime_with_warn(THD *thd, double value, MYSQL_TIME *ltime, - date_mode_t fuzzydate, - const TABLE_SHARE *s, const char *name); -bool decimal_to_datetime_with_warn(THD *thd, - const my_decimal *value, MYSQL_TIME *ltime, - date_mode_t fuzzydate, - const TABLE_SHARE *s, const char *name); -bool int_to_datetime_with_warn(THD *thd, const Longlong_hybrid &nr, - MYSQL_TIME *ltime, - date_mode_t fuzzydate, - const TABLE_SHARE *s, const char *name); - -bool time_to_datetime(THD *thd, const MYSQL_TIME *tm, MYSQL_TIME *dt); -bool time_to_datetime_with_warn(THD *thd, - const MYSQL_TIME *tm, MYSQL_TIME *dt, - date_conv_mode_t fuzzydate); - -inline void datetime_to_date(MYSQL_TIME *ltime) -{ - DBUG_ASSERT(ltime->time_type == MYSQL_TIMESTAMP_DATE || - ltime->time_type == MYSQL_TIMESTAMP_DATETIME); - DBUG_ASSERT(ltime->neg == 0); - ltime->second_part= ltime->hour= ltime->minute= ltime->second= 0; - ltime->time_type= MYSQL_TIMESTAMP_DATE; -} -inline void date_to_datetime(MYSQL_TIME *ltime) -{ - DBUG_ASSERT(ltime->time_type == MYSQL_TIMESTAMP_DATE || - ltime->time_type == MYSQL_TIMESTAMP_DATETIME); - DBUG_ASSERT(ltime->neg == 0); - ltime->time_type= MYSQL_TIMESTAMP_DATETIME; -} -void make_truncated_value_warning(THD *thd, - Sql_condition::enum_warning_level level, - const ErrConv *str_val, - timestamp_type time_type, - const char *db_name, const char *table_name, - const char *field_name); - -extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type, - const char *format_str, - uint format_length); -extern DATE_TIME_FORMAT *date_time_format_copy(THD *thd, - DATE_TIME_FORMAT *format); -const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format, - timestamp_type type); -bool my_TIME_to_str(const MYSQL_TIME *ltime, String *str, uint dec); - -/* MYSQL_TIME operations */ -bool date_add_interval(THD *thd, MYSQL_TIME *ltime, interval_type int_type, - const INTERVAL &interval, bool push_warn= true); -bool calc_time_diff(const MYSQL_TIME *l_time1, const MYSQL_TIME *l_time2, - int l_sign, ulonglong *seconds_out, ulong *microseconds_out); -int append_interval(String *str, interval_type int_type, - const INTERVAL &interval); -/** - Calculate time difference between two MYSQL_TIME values and - store the result as an out MYSQL_TIME value in MYSQL_TIMESTAMP_TIME format. - - The result can be outside of the supported TIME range. - For example, calc_time_diff('2002-01-01 00:00:00', '2001-01-01 00:00:00') - returns '8760:00:00'. So the caller might want to do check_time_range() or - adjust_time_range_with_warn() on the result of a calc_time_diff() call. - - @param l_time1 - the minuend (TIME/DATE/DATETIME value) - @param l_time2 - the subtrahend TIME/DATE/DATETIME value - @param l_sign - +1 if absolute values are to be subtracted, - or -1 if absolute values are to be added. - @param[out] l_time3 - the result - @param fuzzydate - flags - - @return true - if TIME_NO_ZERO_DATE was passed in flags and - the result appeared to be '00:00:00.000000'. - This is important when calc_time_diff() is called - when calculating DATE_ADD(TIMEDIFF(...),...) - @return false - otherwise -*/ -bool calc_time_diff(const MYSQL_TIME *l_time1, const MYSQL_TIME *l_time2, - int lsign, MYSQL_TIME *l_time3, date_mode_t fuzzydate); -int my_time_compare(const MYSQL_TIME *a, const MYSQL_TIME *b); -void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); - -void calc_time_from_sec(MYSQL_TIME *to, ulong seconds, ulong microseconds); -uint calc_week(const MYSQL_TIME *l_time, uint week_behaviour, uint *year); - -int calc_weekday(long daynr,bool sunday_first_day_of_week); -bool parse_date_time_format(timestamp_type format_type, - const char *format, uint format_length, - DATE_TIME_FORMAT *date_time_format); - -/* convenience wrapper */ -inline bool parse_date_time_format(timestamp_type format_type, - DATE_TIME_FORMAT *date_time_format) -{ - return parse_date_time_format(format_type, - date_time_format->format.str, - (uint) date_time_format->format.length, - date_time_format); -} - - -extern DATE_TIME_FORMAT global_date_format; -extern DATE_TIME_FORMAT global_datetime_format; -extern DATE_TIME_FORMAT global_time_format; -extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[]; -extern LEX_CSTRING interval_type_to_name[]; - -static inline bool -non_zero_hhmmssuu(const MYSQL_TIME *ltime) -{ - return ltime->hour || ltime->minute || ltime->second || ltime->second_part; -} -static inline bool -non_zero_YYMMDD(const MYSQL_TIME *ltime) -{ - return ltime->year || ltime->month || ltime->day; -} -static inline bool -non_zero_date(const MYSQL_TIME *ltime) -{ - return non_zero_YYMMDD(ltime) || - (ltime->time_type == MYSQL_TIMESTAMP_DATETIME && - non_zero_hhmmssuu(ltime)); -} -static inline bool -check_date(const MYSQL_TIME *ltime, date_conv_mode_t flags, int *was_cut) -{ - return check_date(ltime, non_zero_date(ltime), - ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE), was_cut); -} -bool check_date_with_warn(THD *thd, const MYSQL_TIME *ltime, - date_conv_mode_t fuzzy_date, timestamp_type ts_type); -static inline bool -check_date_with_warn(THD *thd, const MYSQL_TIME *ltime, - date_mode_t fuzzydate, timestamp_type ts_type) -{ - return check_date_with_warn(thd, ltime, date_conv_mode_t(fuzzydate), ts_type); -} - -bool adjust_time_range_with_warn(THD *thd, MYSQL_TIME *ltime, uint dec); - -longlong pack_time(const MYSQL_TIME *my_time); -void unpack_time(longlong packed, MYSQL_TIME *my_time, - enum_mysql_timestamp_type ts_type); - -#endif /* SQL_TIME_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_trigger.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_trigger.h deleted file mode 100644 index 040d8eb..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_trigger.h +++ /dev/null @@ -1,331 +0,0 @@ -#ifndef SQL_TRIGGER_INCLUDED -#define SQL_TRIGGER_INCLUDED - -/* - Copyright (c) 2004, 2011, Oracle and/or its affiliates. - Copyright (c) 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include - -/* Forward declarations */ - -class Item_trigger_field; -class sp_head; -class sp_name; -class Query_tables_list; -struct TABLE_LIST; -class Query_tables_list; - -/** Event on which trigger is invoked. */ -enum trg_event_type -{ - TRG_EVENT_INSERT= 0, - TRG_EVENT_UPDATE= 1, - TRG_EVENT_DELETE= 2, - TRG_EVENT_MAX -}; - -static inline uint8 trg2bit(enum trg_event_type trg) -{ return static_cast(1 << static_cast(trg)); } - -#include "table.h" /* GRANT_INFO */ - -/* - We need this two enums here instead of sql_lex.h because - at least one of them is used by Item_trigger_field interface. - - Time when trigger is invoked (i.e. before or after row actually - inserted/updated/deleted). -*/ -enum trg_action_time_type -{ - TRG_ACTION_BEFORE= 0, TRG_ACTION_AFTER= 1, TRG_ACTION_MAX -}; - -enum trigger_order_type -{ - TRG_ORDER_NONE= 0, - TRG_ORDER_FOLLOWS= 1, - TRG_ORDER_PRECEDES= 2 -}; - - -struct st_trg_execution_order -{ - /** - FOLLOWS or PRECEDES as specified in the CREATE TRIGGER statement. - */ - enum trigger_order_type ordering_clause; - - /** - Trigger name referenced in the FOLLOWS/PRECEDES clause of the - CREATE TRIGGER statement. - */ - LEX_CSTRING anchor_trigger_name; -}; - - -class Table_triggers_list; - -/** - The trigger object -*/ - -class Trigger :public Sql_alloc -{ -public: - Trigger(Table_triggers_list *base_arg, sp_head *code): - base(base_arg), body(code), next(0), trigger_fields(0), action_order(0) - { - bzero((char *)&subject_table_grants, sizeof(subject_table_grants)); - } - ~Trigger(); - Table_triggers_list *base; - sp_head *body; - Trigger *next; /* Next trigger of same type */ - - /** - Heads of the lists linking items for all fields used in triggers - grouped by event and action_time. - */ - Item_trigger_field *trigger_fields; - LEX_CSTRING name; - LEX_CSTRING on_table_name; /* Raw table name */ - LEX_CSTRING definition; - LEX_CSTRING definer; - - /* Character sets used */ - LEX_CSTRING client_cs_name; - LEX_CSTRING connection_cl_name; - LEX_CSTRING db_cl_name; - - GRANT_INFO subject_table_grants; - sql_mode_t sql_mode; - /* Store create time. Can't be mysql_time_t as this holds also sub seconds */ - ulonglong create_time; - trg_event_type event; - trg_action_time_type action_time; - uint action_order; - - bool is_fields_updated_in_trigger(MY_BITMAP *used_fields); - void get_trigger_info(LEX_CSTRING *stmt, LEX_CSTRING *body, - LEX_STRING *definer); - /* Functions executed over each active trigger */ - bool change_on_table_name(void* param_arg); - bool change_table_name(void* param_arg); - bool add_to_file_list(void* param_arg); -}; - -typedef bool (Trigger::*Triggers_processor)(void *arg); - -/** - This class holds all information about triggers of table. -*/ - -class Table_triggers_list: public Sql_alloc -{ - friend class Trigger; - - /* Points to first trigger for a certain type */ - Trigger *triggers[TRG_EVENT_MAX][TRG_ACTION_MAX]; - /** - Copy of TABLE::Field array which all fields made nullable - (using extra_null_bitmap, if needed). Used for NEW values in - BEFORE INSERT/UPDATE triggers. - */ - Field **record0_field; - uchar *extra_null_bitmap; - /** - Copy of TABLE::Field array with field pointers set to TABLE::record[1] - buffer instead of TABLE::record[0] (used for OLD values in on UPDATE - trigger and DELETE trigger when it is called for REPLACE). - */ - Field **record1_field; - /** - During execution of trigger new_field and old_field should point to the - array of fields representing new or old version of row correspondingly - (so it can point to TABLE::field or to Tale_triggers_list::record1_field) - */ - Field **new_field; - Field **old_field; - - /* TABLE instance for which this triggers list object was created */ - TABLE *trigger_table; - - /** - This flag indicates that one of the triggers was not parsed successfully, - and as a precaution the object has entered a state where all trigger - access results in errors until all such triggers are dropped. It is not - safe to add triggers since we don't know if the broken trigger has the - same name or event type. Nor is it safe to invoke any trigger for the - aforementioned reasons. The only safe operations are drop_trigger and - drop_all_triggers. - - @see Table_triggers_list::set_parse_error - */ - bool m_has_unparseable_trigger; - - /** - This error will be displayed when the user tries to manipulate or invoke - triggers on a table that has broken triggers. It will get set only once - per statement and thus will contain the first parse error encountered in - the trigger file. - */ - char m_parse_error_message[MYSQL_ERRMSG_SIZE]; - uint count; /* Number of triggers */ - -public: - /** - Field responsible for storing triggers definitions in file. - It have to be public because we are using it directly from parser. - */ - List definitions_list; - /** - List of sql modes for triggers - */ - List definition_modes_list; - /** Create times for triggers */ - List create_times; - - List definers_list; - - /* Character set context, used for parsing and executing triggers. */ - - List client_cs_names; - List connection_cl_names; - List db_cl_names; - - /* End of character ser context. */ - - Table_triggers_list(TABLE *table_arg) - :record0_field(0), extra_null_bitmap(0), record1_field(0), - trigger_table(table_arg), - m_has_unparseable_trigger(false), count(0) - { - bzero((char *) triggers, sizeof(triggers)); - } - ~Table_triggers_list(); - - bool create_trigger(THD *thd, TABLE_LIST *table, String *stmt_query); - bool drop_trigger(THD *thd, TABLE_LIST *table, String *stmt_query); - bool process_triggers(THD *thd, trg_event_type event, - trg_action_time_type time_type, - bool old_row_is_record1); - void empty_lists(); - bool create_lists_needed_for_files(MEM_ROOT *root); - bool save_trigger_file(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *table_name); - - static bool check_n_load(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *table_name, - TABLE *table, bool names_only); - static bool drop_all_triggers(THD *thd, const LEX_CSTRING *db, - const LEX_CSTRING *table_name, myf MyFlags); - static bool change_table_name(THD *thd, const LEX_CSTRING *db, - const LEX_CSTRING *old_alias, - const LEX_CSTRING *old_table, - const LEX_CSTRING *new_db, - const LEX_CSTRING *new_table); - void add_trigger(trg_event_type event_type, - trg_action_time_type action_time, - trigger_order_type ordering_clause, - LEX_CSTRING *anchor_trigger_name, - Trigger *trigger); - Trigger *get_trigger(trg_event_type event_type, - trg_action_time_type action_time) - { - return triggers[event_type][action_time]; - } - /* Simpler version of the above, to avoid casts in the code */ - Trigger *get_trigger(uint event_type, uint action_time) - { - return get_trigger((trg_event_type) event_type, - (trg_action_time_type) action_time); - } - - bool has_triggers(trg_event_type event_type, - trg_action_time_type action_time) - { - return get_trigger(event_type,action_time) != 0; - } - bool has_delete_triggers() - { - return (has_triggers(TRG_EVENT_DELETE,TRG_ACTION_BEFORE) || - has_triggers(TRG_EVENT_DELETE,TRG_ACTION_AFTER)); - } - - void mark_fields_used(trg_event_type event); - - void set_parse_error_message(char *error_message); - - friend class Item_trigger_field; - - bool add_tables_and_routines_for_triggers(THD *thd, - Query_tables_list *prelocking_ctx, - TABLE_LIST *table_list); - - Field **nullable_fields() { return record0_field; } - void reset_extra_null_bitmap() - { - size_t null_bytes= (trigger_table->s->fields - - trigger_table->s->null_fields + 7)/8; - bzero(extra_null_bitmap, null_bytes); - } - - Trigger *find_trigger(const LEX_CSTRING *name, bool remove_from_list); - - Trigger* for_all_triggers(Triggers_processor func, void *arg); - -private: - bool prepare_record_accessors(TABLE *table); - Trigger *change_table_name_in_trignames(const LEX_CSTRING *old_db_name, - const LEX_CSTRING *new_db_name, - const LEX_CSTRING *new_table_name, - Trigger *trigger); - bool change_table_name_in_triggers(THD *thd, - const LEX_CSTRING *old_db_name, - const LEX_CSTRING *new_db_name, - const LEX_CSTRING *old_table_name, - const LEX_CSTRING *new_table_name); - - bool check_for_broken_triggers() - { - if (m_has_unparseable_trigger) - { - my_message(ER_PARSE_ERROR, m_parse_error_message, MYF(0)); - return true; - } - return false; - } -}; - -bool add_table_for_trigger(THD *thd, - const sp_name *trg_name, - bool continue_if_not_exist, - TABLE_LIST **table); - -void build_trn_path(THD *thd, const sp_name *trg_name, LEX_STRING *trn_path); - -bool check_trn_exists(const LEX_CSTRING *trn_path); - -bool load_table_name_for_trigger(THD *thd, - const sp_name *trg_name, - const LEX_CSTRING *trn_path, - LEX_CSTRING *tbl_name); -bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create); - -extern const char * const TRG_EXT; -extern const char * const TRN_EXT; - -#endif /* SQL_TRIGGER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_truncate.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_truncate.h deleted file mode 100644 index 7d2ff4b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_truncate.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef SQL_TRUNCATE_INCLUDED -#define SQL_TRUNCATE_INCLUDED -/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -class THD; -struct TABLE_LIST; - -/** - Sql_cmd_truncate_table represents the TRUNCATE statement. -*/ -class Sql_cmd_truncate_table : public Sql_cmd -{ -private: - /* Set if a lock must be downgraded after truncate is done. */ - MDL_ticket *m_ticket_downgrade; - -public: - /** - Constructor, used to represent a TRUNCATE statement. - */ - Sql_cmd_truncate_table() - {} - - virtual ~Sql_cmd_truncate_table() - {} - - /** - Execute a TRUNCATE statement at runtime. - @param thd the current thread. - @return false on success. - */ - bool execute(THD *thd); - - virtual enum_sql_command sql_command_code() const - { - return SQLCOM_TRUNCATE; - } - -protected: - enum truncate_result{ - TRUNCATE_OK=0, - TRUNCATE_FAILED_BUT_BINLOG, - TRUNCATE_FAILED_SKIP_BINLOG - }; - - /** Handle locking a base table for truncate. */ - bool lock_table(THD *, TABLE_LIST *, bool *); - - /** Truncate table via the handler method. */ - enum truncate_result handler_truncate(THD *, TABLE_LIST *, bool); - - /** - Optimized delete of all rows by doing a full regenerate of the table. - Depending on the storage engine, it can be accomplished through a - drop and recreate or via the handler truncate method. - */ - bool truncate_table(THD *, TABLE_LIST *); -}; - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_tvc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_tvc.h deleted file mode 100644 index b5b8b97..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_tvc.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (c) 2017, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef SQL_TVC_INCLUDED -#define SQL_TVC_INCLUDED -#include "sql_type.h" - -typedef List List_item; -typedef bool (Item::*Item_processor) (void *arg); -class select_result; -class Explain_select; -class Explain_query; -class Item_func_in; -class st_select_lex_unit; -typedef class st_select_lex SELECT_LEX; - -/** - @class table_value_constr - @brief Definition of a Table Value Construction(TVC) - - It contains a list of lists of values which this TVC is defined by and - reference on SELECT where this TVC is defined. -*/ -class table_value_constr : public Sql_alloc -{ -public: - List lists_of_values; - select_result *result; - SELECT_LEX *select_lex; - - enum { QEP_NOT_PRESENT_YET, QEP_AVAILABLE} have_query_plan; - - Explain_select *explain; - ulonglong select_options; - - table_value_constr(List tvc_values, SELECT_LEX *sl, - ulonglong select_options_arg) : - lists_of_values(tvc_values), result(0), select_lex(sl), - have_query_plan(QEP_NOT_PRESENT_YET), explain(0), - select_options(select_options_arg) - { }; - - ha_rows get_records() { return lists_of_values.elements; } - - bool prepare(THD *thd_arg, SELECT_LEX *sl, - select_result *tmp_result, - st_select_lex_unit *unit_arg); - - bool to_be_wrapped_as_with_tail(); - - int save_explain_data_intern(THD *thd_arg, - Explain_query *output); - bool optimize(THD *thd_arg); - bool exec(SELECT_LEX *sl); - - void print(THD *thd_arg, String *str, enum_query_type query_type); - bool walk_values(Item_processor processor, bool walk_subquery, void *arg); -}; - -st_select_lex *wrap_tvc_with_tail(THD *thd, st_select_lex *tvc_sl); - -#endif /* SQL_TVC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type.h deleted file mode 100644 index db4f67e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type.h +++ /dev/null @@ -1,7519 +0,0 @@ -#ifndef SQL_TYPE_H_INCLUDED -#define SQL_TYPE_H_INCLUDED -/* - Copyright (c) 2015 MariaDB Foundation. - Copyright (c) 2015, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - - -#include "mysqld.h" -#include "lex_string.h" -#include "sql_array.h" -#include "sql_const.h" -#include "sql_time.h" -#include "sql_type_string.h" -#include "sql_type_real.h" -#include "compat56.h" -C_MODE_START -#include -C_MODE_END - -class Field; -class Column_definition; -class Column_definition_attributes; -class Key_part_spec; -class Item; -class Item_const; -class Item_literal; -class Item_param; -class Item_cache; -class Item_copy; -class Item_func_or_sum; -class Item_sum_hybrid; -class Item_sum_sum; -class Item_sum_avg; -class Item_sum_variance; -class Item_func_hex; -class Item_hybrid_func; -class Item_func_min_max; -class Item_func_hybrid_field_type; -class Item_bool_func2; -class Item_func_between; -class Item_func_in; -class Item_func_round; -class Item_func_int_val; -class Item_func_abs; -class Item_func_neg; -class Item_func_signed; -class Item_func_unsigned; -class Item_double_typecast; -class Item_float_typecast; -class Item_decimal_typecast; -class Item_char_typecast; -class Item_time_typecast; -class Item_date_typecast; -class Item_datetime_typecast; -class Item_func_plus; -class Item_func_minus; -class Item_func_mul; -class Item_func_div; -class Item_func_mod; -class cmp_item; -class in_vector; -class Type_handler_data; -class Type_handler_hybrid_field_type; -class Sort_param; -class Arg_comparator; -class Spvar_definition; -struct st_value; -class Protocol; -class handler; -struct Schema_specification_st; -struct TABLE; -struct SORT_FIELD_ATTR; -struct SORT_FIELD; -class Vers_history_point; -class Virtual_column_info; -class Conv_source; -class ST_FIELD_INFO; -class Type_collection; -class Create_func; - -#define my_charset_numeric my_charset_latin1 - -enum protocol_send_type_t -{ - PROTOCOL_SEND_STRING, - PROTOCOL_SEND_FLOAT, - PROTOCOL_SEND_DOUBLE, - PROTOCOL_SEND_TINY, - PROTOCOL_SEND_SHORT, - PROTOCOL_SEND_LONG, - PROTOCOL_SEND_LONGLONG, - PROTOCOL_SEND_DATETIME, - PROTOCOL_SEND_DATE, - PROTOCOL_SEND_TIME -}; - - -enum scalar_comparison_op -{ - SCALAR_CMP_EQ, - SCALAR_CMP_EQUAL, - SCALAR_CMP_LT, - SCALAR_CMP_LE, - SCALAR_CMP_GE, - SCALAR_CMP_GT -}; - - -enum partition_value_print_mode_t -{ - PARTITION_VALUE_PRINT_MODE_SHOW= 0, - PARTITION_VALUE_PRINT_MODE_FRM= 1 -}; - - -enum column_definition_type_t -{ - COLUMN_DEFINITION_TABLE_FIELD, - COLUMN_DEFINITION_ROUTINE_PARAM, - COLUMN_DEFINITION_ROUTINE_LOCAL, - COLUMN_DEFINITION_FUNCTION_RETURN -}; - - -class Send_field_extended_metadata -{ - LEX_CSTRING m_attr[MARIADB_FIELD_ATTR_LAST+1]; -public: - Send_field_extended_metadata() - { - bzero(this, sizeof(*this)); - } - bool set_data_type_name(const LEX_CSTRING &str) - { - m_attr[MARIADB_FIELD_ATTR_DATA_TYPE_NAME]= str; - return false; - } - bool set_format_name(const LEX_CSTRING &str) - { - m_attr[MARIADB_FIELD_ATTR_FORMAT_NAME]= str; - return false; - } - bool has_extended_metadata() const - { - for (uint i= 0; i <= MARIADB_FIELD_ATTR_LAST; i++) - { - if (m_attr[i].str) - return true; - } - return false; - } - const LEX_CSTRING &attr(uint i) const - { - DBUG_ASSERT(i <= MARIADB_FIELD_ATTR_LAST); - return m_attr[i]; - } -}; - - -class Data_type_statistics -{ -public: - uint m_uneven_bit_length; - uint m_fixed_string_total_length; - uint m_fixed_string_count; - uint m_variable_string_total_length; - uint m_variable_string_count; - uint m_blob_count; - Data_type_statistics() - :m_uneven_bit_length(0), - m_fixed_string_total_length(0), - m_fixed_string_count(0), - m_variable_string_total_length(0), - m_variable_string_count(0), - m_blob_count(0) - { } - uint string_count() const - { - return m_fixed_string_count + m_variable_string_count; - } - uint string_total_length() const - { - return m_fixed_string_total_length + m_variable_string_total_length; - } -}; - - -class Typelib: public TYPELIB -{ -public: - Typelib(uint count, const char **type_names, unsigned int *type_lengths) - { - TYPELIB::count= count; - TYPELIB::name= ""; - TYPELIB::type_names= type_names; - TYPELIB::type_lengths= type_lengths; - } - uint max_octet_length() const - { - uint max_length= 0; - for (uint i= 0; i < TYPELIB::count; i++) - { - const uint length= TYPELIB::type_lengths[i]; - set_if_bigger(max_length, length); - } - return max_length; - } -}; - - -template -class TypelibBuffer: public Typelib -{ - const char *m_type_names[sz + 1]; - uint m_type_lengths[sz + 1]; -public: - TypelibBuffer(uint count, const LEX_CSTRING *values) - :Typelib(count, m_type_names, m_type_lengths) - { - DBUG_ASSERT(sz >= count); - for (uint i= 0; i < count; i++) - { - DBUG_ASSERT(values[i].str != NULL); - m_type_names[i]= values[i].str; - m_type_lengths[i]= (uint) values[i].length; - } - m_type_names[sz]= NullS; // End marker - m_type_lengths[sz]= 0; // End marker - } - TypelibBuffer(const LEX_CSTRING *values) - :TypelibBuffer(sz, values) - { } -}; - - -class Native: public Binary_string -{ -public: - Native(char *str, size_t len) - :Binary_string(str, len) - { } -}; - - -template -class NativeBuffer: public Native -{ - char buff[buff_sz]; -public: - NativeBuffer() : Native(buff, buff_sz) { length(0); } -}; - - -class String_ptr -{ -protected: - String *m_string_ptr; -public: - String_ptr(String *str) - :m_string_ptr(str) - { } - String_ptr(Item *item, String *buffer); - const String *string() const - { - DBUG_ASSERT(m_string_ptr); - return m_string_ptr; - } - bool is_null() const { return m_string_ptr == NULL; } -}; - - -class Ascii_ptr: public String_ptr -{ -public: - Ascii_ptr(Item *item, String *buffer); -}; - - -template -class String_ptr_and_buffer: public StringBuffer, - public String_ptr -{ -public: - String_ptr_and_buffer(Item *item) - :String_ptr(item, this) - { } -}; - - -template -class Ascii_ptr_and_buffer: public StringBuffer, - public Ascii_ptr -{ -public: - Ascii_ptr_and_buffer(Item *item) - :Ascii_ptr(item, this) - { } -}; - - -class Dec_ptr -{ -protected: - my_decimal *m_ptr; - Dec_ptr() { } -public: - Dec_ptr(my_decimal *ptr) :m_ptr(ptr) { } - bool is_null() const { return m_ptr == NULL; } - const my_decimal *ptr() const { return m_ptr; } - const my_decimal *ptr_or(const my_decimal *def) const - { - return m_ptr ? m_ptr : def; - } - my_decimal *to_decimal(my_decimal *to) const - { - if (!m_ptr) - return NULL; - *to= *m_ptr; - return to; - } - double to_double() const { return m_ptr ? m_ptr->to_double() : 0.0; } - longlong to_longlong(bool unsigned_flag) - { return m_ptr ? m_ptr->to_longlong(unsigned_flag) : 0; } - Longlong_null to_xlonglong_null() - { - return m_ptr ? Longlong_null(m_ptr->to_xlonglong()) : Longlong_null(); - } - bool to_bool() const { return m_ptr ? m_ptr->to_bool() : false; } - String *to_string(String *to) const - { - return m_ptr ? m_ptr->to_string(to) : NULL; - } - String *to_string(String *to, uint prec, uint dec, char filler) - { - return m_ptr ? m_ptr->to_string(to, prec, dec, filler) : NULL; - } - int to_binary(uchar *bin, int prec, int scale) const - { - return (m_ptr ? m_ptr : &decimal_zero)->to_binary(bin, prec, scale); - } - int cmp(const my_decimal *dec) const - { - DBUG_ASSERT(m_ptr); - DBUG_ASSERT(dec); - return m_ptr->cmp(dec); - } - int cmp(const Dec_ptr &other) const - { - return cmp(other.m_ptr); - } -}; - - -// A helper class to handle results of val_decimal(), date_op(), etc. -class Dec_ptr_and_buffer: public Dec_ptr -{ -protected: - my_decimal m_buffer; -public: - int round_to(my_decimal *to, int scale, decimal_round_mode mode) - { - DBUG_ASSERT(m_ptr); - return m_ptr->round_to(to, scale, mode); - } - int round_self(uint scale, decimal_round_mode mode) - { - return round_to(&m_buffer, scale, mode); - } - int round_self_if_needed(int scale, decimal_round_mode mode) - { - if (scale >= m_ptr->frac) - return E_DEC_OK; - int res= m_ptr->round_to(&m_buffer, scale, mode); - m_ptr= &m_buffer; - return res; - } - String *to_string_round(String *to, uint dec) - { - /* - decimal_round() allows from==to - So it's save even if m_ptr points to m_buffer before this call: - */ - return m_ptr ? m_ptr->to_string_round(to, dec, &m_buffer) : NULL; - } -}; - - -// A helper class to handle val_decimal() results. -class VDec: public Dec_ptr_and_buffer -{ -public: - VDec(): Dec_ptr_and_buffer() { } - VDec(Item *item); - void set(Item *a); -}; - - -// A helper class to handler decimal_op() results. -class VDec_op: public Dec_ptr_and_buffer -{ -public: - VDec_op(Item_func_hybrid_field_type *item); -}; - - -/* - Get and cache val_decimal() values for two items. - If the first value appears to be NULL, the second value is not evaluated. -*/ -class VDec2_lazy -{ -public: - VDec m_a; - VDec m_b; - VDec2_lazy(Item *a, Item *b) :m_a(a) - { - if (!m_a.is_null()) - m_b.set(b); - } - bool has_null() const - { - return m_a.is_null() || m_b.is_null(); - } -}; - - -/** - Class Sec6 represents a fixed point value with 6 fractional digits. - Used e.g. to convert double and my_decimal values to TIME/DATETIME. -*/ - -class Sec6 -{ -protected: - ulonglong m_sec; // The integer part, between 0 and LONGLONG_MAX - ulong m_usec; // The fractional part, between 0 and 999999 - bool m_neg; // false if positive, true of negative - bool m_truncated; // Indicates if the constructor truncated the value - void make_from_decimal(const my_decimal *d, ulong *nanoseconds); - void make_from_double(double d, ulong *nanoseconds); - void make_from_int(const Longlong_hybrid &nr) - { - m_neg= nr.neg(); - m_sec= nr.abs(); - m_usec= 0; - m_truncated= false; - } - void reset() - { - m_sec= m_usec= m_neg= m_truncated= 0; - } - Sec6() { } - bool add_nanoseconds(uint nanoseconds) - { - DBUG_ASSERT(nanoseconds <= 1000000000); - if (nanoseconds < 500) - return false; - m_usec+= (nanoseconds + 500) / 1000; - if (m_usec < 1000000) - return false; - m_usec%= 1000000; - return true; - } -public: - explicit Sec6(double nr) - { - ulong nanoseconds; - make_from_double(nr, &nanoseconds); - } - explicit Sec6(const my_decimal *d) - { - ulong nanoseconds; - make_from_decimal(d, &nanoseconds); - } - explicit Sec6(const Longlong_hybrid &nr) - { - make_from_int(nr); - } - explicit Sec6(longlong nr, bool unsigned_val) - { - make_from_int(Longlong_hybrid(nr, unsigned_val)); - } - bool neg() const { return m_neg; } - bool truncated() const { return m_truncated; } - ulonglong sec() const { return m_sec; } - long usec() const { return m_usec; } - /** - Converts Sec6 to MYSQL_TIME - @param thd current thd - @param [out] warn conversion warnings will be written here - @param [out] ltime converted value will be written here - @param fuzzydate conversion flags (TIME_INVALID_DATE, etc) - @returns false for success, true for a failure - */ - bool convert_to_mysql_time(THD *thd, - int *warn, - MYSQL_TIME *ltime, - date_mode_t fuzzydate) const; - -protected: - - bool to_interval_hhmmssff_only(MYSQL_TIME *to, int *warn) const - { - return number_to_time_only(m_neg, m_sec, m_usec, - TIME_MAX_INTERVAL_HOUR, to, warn); - } - bool to_datetime_or_to_interval_hhmmssff(MYSQL_TIME *to, int *warn) const - { - /* - Convert a number to a time interval. - The following formats are understood: - - 0 <= x <= 999999995959 - parse as hhhhmmss - - 999999995959 < x <= 99991231235959 - parse as YYYYMMDDhhmmss - (YYMMDDhhmmss) (YYYYMMDDhhmmss) - - Note, these formats are NOT understood: - - YYMMDD - overlaps with INTERVAL range - - YYYYMMDD - overlaps with INTERVAL range - - YYMMDDhhmmss - overlaps with INTERVAL range, partially - (see TIME_MAX_INTERVAL_HOUR) - - If we ever need wider intervals, this code switching between - full datetime and interval-only should be rewised. - */ - DBUG_ASSERT(TIME_MAX_INTERVAL_HOUR <= 999999995959); - /* (YYMMDDhhmmss) */ - if (m_sec > 999999995959ULL && - m_sec <= 99991231235959ULL && m_neg == 0) - return to_datetime_or_date(to, warn, TIME_INVALID_DATES); - if (m_sec / 10000 > TIME_MAX_INTERVAL_HOUR) - { - *warn= MYSQL_TIME_WARN_OUT_OF_RANGE; - return true; - } - return to_interval_hhmmssff_only(to, warn); - } -public: - // [-][DD]hhhmmss.ff, YYMMDDhhmmss.ff, YYYYMMDDhhmmss.ff - bool to_datetime_or_time(MYSQL_TIME *to, int *warn, - date_conv_mode_t mode) const - { - bool rc= m_sec > 9999999 && m_sec <= 99991231235959ULL && !m_neg ? - ::number_to_datetime_or_date(m_sec, m_usec, to, - ulonglong(mode & TIME_MODE_FOR_XXX_TO_DATE), warn) < 0 : - ::number_to_time_only(m_neg, m_sec, m_usec, TIME_MAX_HOUR, to, warn); - DBUG_ASSERT(*warn || !rc); - return rc; - } - /* - Convert a number in formats YYYYMMDDhhmmss.ff or YYMMDDhhmmss.ff to - TIMESTAMP'YYYY-MM-DD hh:mm:ss.ff' - */ - bool to_datetime_or_date(MYSQL_TIME *to, int *warn, - date_conv_mode_t flags) const - { - if (m_neg) - { - *warn= MYSQL_TIME_WARN_OUT_OF_RANGE; - return true; - } - bool rc= number_to_datetime_or_date(m_sec, m_usec, to, - ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE), - warn) == -1; - DBUG_ASSERT(*warn || !rc); - return rc; - } - // Convert elapsed seconds to TIME - bool sec_to_time(MYSQL_TIME *ltime, uint dec) const - { - set_zero_time(ltime, MYSQL_TIMESTAMP_TIME); - ltime->neg= m_neg; - if (m_sec > TIME_MAX_VALUE_SECONDS) - { - // use check_time_range() to set ltime to the max value depending on dec - int unused; - ltime->hour= TIME_MAX_HOUR + 1; - check_time_range(ltime, dec, &unused); - return true; - } - DBUG_ASSERT(usec() <= TIME_MAX_SECOND_PART); - ltime->hour= (uint) (m_sec / 3600); - ltime->minute= (uint) (m_sec % 3600) / 60; - ltime->second= (uint) m_sec % 60; - ltime->second_part= m_usec; - return false; - } - Sec6 &trunc(uint dec) - { - m_usec-= my_time_fraction_remainder(m_usec, dec); - return *this; - } - size_t to_string(char *to, size_t nbytes) const - { - return m_usec ? - my_snprintf(to, nbytes, "%s%llu.%06lu", - m_neg ? "-" : "", m_sec, (uint) m_usec) : - my_snprintf(to, nbytes, "%s%llu", m_neg ? "-" : "", m_sec); - } - void make_truncated_warning(THD *thd, const char *type_str) const; -}; - - -class Sec9: public Sec6 -{ -protected: - ulong m_nsec; // Nanoseconds 0..999 - void make_from_int(const Longlong_hybrid &nr) - { - Sec6::make_from_int(nr); - m_nsec= 0; - } - Sec9() { } -public: - Sec9(const my_decimal *d) - { - Sec6::make_from_decimal(d, &m_nsec); - } - Sec9(double d) - { - Sec6::make_from_double(d, &m_nsec); - } - ulong nsec() const { return m_nsec; } - Sec9 &trunc(uint dec) - { - m_nsec= 0; - Sec6::trunc(dec); - return *this; - } - Sec9 &round(uint dec); - Sec9 &round(uint dec, time_round_mode_t mode) - { - return mode == TIME_FRAC_TRUNCATE ? trunc(dec) : round(dec); - } -}; - - -class VSec9: protected Sec9 -{ - bool m_is_null; - Sec9& to_sec9() - { - DBUG_ASSERT(!is_null()); - return *this; - } -public: - VSec9(THD *thd, Item *item, const char *type_str, ulonglong limit); - bool is_null() const { return m_is_null; } - const Sec9& to_const_sec9() const - { - DBUG_ASSERT(!is_null()); - return *this; - } - bool neg() const { return to_const_sec9().neg(); } - bool truncated() const { return to_const_sec9().truncated(); } - ulonglong sec() const { return to_const_sec9().sec(); } - long usec() const { return to_const_sec9().usec(); } - bool sec_to_time(MYSQL_TIME *ltime, uint dec) const - { - return to_const_sec9().sec_to_time(ltime, dec); - } - void make_truncated_warning(THD *thd, const char *type_str) const - { - return to_const_sec9().make_truncated_warning(thd, type_str); - } - Sec9 &round(uint dec) - { - return to_sec9().round(dec); - } - Sec9 &round(uint dec, time_round_mode_t mode) - { - return to_sec9().round(dec, mode); - } -}; - - -/* - A heler class to perform additive operations between - two MYSQL_TIME structures and return the result as a - combination of seconds, microseconds and sign. -*/ -class Sec6_add -{ - ulonglong m_sec; // number of seconds - ulong m_usec; // number of microseconds - bool m_neg; // false if positive, true if negative - bool m_error; // false if the value is OK, true otherwise - void to_hh24mmssff(MYSQL_TIME *ltime, timestamp_type tstype) const - { - bzero(ltime, sizeof(*ltime)); - ltime->neg= m_neg; - calc_time_from_sec(ltime, (ulong) (m_sec % SECONDS_IN_24H), m_usec); - ltime->time_type= tstype; - } -public: - /* - @param ltime1 - the first value to add (must be a valid DATE,TIME,DATETIME) - @param ltime2 - the second value to add (must be a valid TIME) - @param sign - the sign of the operation - (+1 for addition, -1 for subtraction) - */ - Sec6_add(const MYSQL_TIME *ltime1, const MYSQL_TIME *ltime2, int sign) - { - DBUG_ASSERT(sign == -1 || sign == 1); - DBUG_ASSERT(!ltime1->neg || ltime1->time_type == MYSQL_TIMESTAMP_TIME); - if (!(m_error= (ltime2->time_type != MYSQL_TIMESTAMP_TIME))) - { - if (ltime1->neg != ltime2->neg) - sign= -sign; - m_neg= calc_time_diff(ltime1, ltime2, -sign, &m_sec, &m_usec); - if (ltime1->neg && (m_sec || m_usec)) - m_neg= !m_neg; // Swap sign - } - } - bool to_time(THD *thd, MYSQL_TIME *ltime, uint decimals) const - { - if (m_error) - return true; - to_hh24mmssff(ltime, MYSQL_TIMESTAMP_TIME); - ltime->hour+= static_cast(to_days_abs() * 24); - return adjust_time_range_with_warn(thd, ltime, decimals); - } - bool to_datetime(MYSQL_TIME *ltime) const - { - if (m_error || m_neg) - return true; - to_hh24mmssff(ltime, MYSQL_TIMESTAMP_DATETIME); - return get_date_from_daynr(to_days_abs(), - <ime->year, <ime->month, <ime->day) || - !ltime->day; - } - long to_days_abs() const { return (long) (m_sec / SECONDS_IN_24H); } -}; - - -class Year -{ -protected: - uint m_year; - bool m_truncated; - uint year_precision(const Item *item) const; -public: - Year(): m_year(0), m_truncated(false) { } - Year(longlong value, bool unsigned_flag, uint length); - uint year() const { return m_year; } - uint to_YYYYMMDD() const { return m_year * 10000; } - bool truncated() const { return m_truncated; } -}; - - -class Year_null: public Year, public Null_flag -{ -public: - Year_null(const Longlong_null &nr, bool unsigned_flag, uint length) - :Year(nr.is_null() ? 0 : nr.value(), unsigned_flag, length), - Null_flag(nr.is_null()) - { } -}; - - -class VYear: public Year_null -{ -public: - VYear(Item *item); -}; - - -class VYear_op: public Year_null -{ -public: - VYear_op(Item_func_hybrid_field_type *item); -}; - - -class Double_null: public Null_flag -{ -protected: - double m_value; -public: - Double_null(double value, bool is_null) - :Null_flag(is_null), m_value(value) - { } - double value() const { return m_value; } -}; - - -class Temporal: protected MYSQL_TIME -{ -public: - class Status: public MYSQL_TIME_STATUS - { - public: - Status() { my_time_status_init(this); } - }; - - class Warn: public ErrBuff, - public Status - { - public: - void push_conversion_warnings(THD *thd, bool totally_useless_value, - date_mode_t mode, timestamp_type tstype, - const char *db_name, const char *table_name, - const char *name) - { - const char *typestr= tstype >= 0 ? type_name_by_timestamp_type(tstype) : - mode & (TIME_INTERVAL_hhmmssff | TIME_INTERVAL_DAY) ? - "interval" : - mode & TIME_TIME_ONLY ? "time" : "datetime"; - Temporal::push_conversion_warnings(thd, totally_useless_value, warnings, - typestr, db_name, table_name, name, - ptr()); - } - }; - - class Warn_push: public Warn - { - THD * const m_thd; - const char * const m_db_name; - const char * const m_table_name; - const char * const m_name; - const MYSQL_TIME * const m_ltime; - const date_mode_t m_mode; - public: - Warn_push(THD *thd, const char *db_name, const char *table_name, - const char *name, const MYSQL_TIME *ltime, date_mode_t mode) - : m_thd(thd), m_db_name(db_name), m_table_name(table_name), m_name(name), - m_ltime(ltime), m_mode(mode) - { } - ~Warn_push() - { - if (warnings) - push_conversion_warnings(m_thd, m_ltime->time_type < 0, - m_mode, m_ltime->time_type, - m_db_name, m_table_name, m_name); - } - }; - -public: - static date_conv_mode_t sql_mode_for_dates(THD *thd); - static time_round_mode_t default_round_mode(THD *thd); - class Options: public date_mode_t - { - public: - explicit Options(date_mode_t flags) - :date_mode_t(flags) - { } - Options(date_conv_mode_t flags, time_round_mode_t round_mode) - :date_mode_t(flags | round_mode) - { - DBUG_ASSERT(ulonglong(flags) <= UINT_MAX32); - } - Options(date_conv_mode_t flags, THD *thd) - :Options(flags, default_round_mode(thd)) - { } - }; - - bool is_valid_temporal() const - { - DBUG_ASSERT(time_type != MYSQL_TIMESTAMP_ERROR); - return time_type != MYSQL_TIMESTAMP_NONE; - } - static const char *type_name_by_timestamp_type(timestamp_type time_type) - { - switch (time_type) { - case MYSQL_TIMESTAMP_DATE: return "date"; - case MYSQL_TIMESTAMP_TIME: return "time"; - case MYSQL_TIMESTAMP_DATETIME: // FALLTHROUGH - default: - break; - } - return "datetime"; - } - static void push_conversion_warnings(THD *thd, bool totally_useless_value, int warn, - const char *type_name, - const char *db_name, - const char *table_name, - const char *field_name, - const char *value); - /* - This method is used if the item was not null but convertion to - TIME/DATE/DATETIME failed. We return a zero date if allowed, - otherwise - null. - */ - void make_fuzzy_date(int *warn, date_conv_mode_t fuzzydate) - { - /* - In the following scenario: - - The caller expected to get a TIME value - - Item returned a not NULL string or numeric value - - But then conversion from string or number to TIME failed - we need to change the default time_type from MYSQL_TIMESTAMP_DATE - (which was set in bzero) to MYSQL_TIMESTAMP_TIME and therefore - return TIME'00:00:00' rather than DATE'0000-00-00'. - If we don't do this, methods like Item::get_time_with_conversion() - will erroneously subtract CURRENT_DATE from '0000-00-00 00:00:00' - and return TIME'-838:59:59' instead of TIME'00:00:00' as a result. - */ - timestamp_type tstype= !(fuzzydate & TIME_FUZZY_DATES) ? - MYSQL_TIMESTAMP_NONE : - fuzzydate & TIME_TIME_ONLY ? - MYSQL_TIMESTAMP_TIME : - MYSQL_TIMESTAMP_DATETIME; - set_zero_time(this, tstype); - } - -protected: - my_decimal *bad_to_decimal(my_decimal *to) const; - my_decimal *to_decimal(my_decimal *to) const; - static double to_double(bool negate, ulonglong num, ulong frac) - { - double d= static_cast(num) + static_cast(frac) / - TIME_SECOND_PART_FACTOR; - return negate ? -d : d; - } - longlong to_packed() const { return ::pack_time(this); } - void make_from_out_of_range(int *warn) - { - *warn= MYSQL_TIME_WARN_OUT_OF_RANGE; - time_type= MYSQL_TIMESTAMP_NONE; - } - void make_from_sec6(THD *thd, MYSQL_TIME_STATUS *st, - const Sec6 &nr, date_mode_t mode) - { - if (nr.convert_to_mysql_time(thd, &st->warnings, this, mode)) - make_fuzzy_date(&st->warnings, date_conv_mode_t(mode)); - } - void make_from_sec9(THD *thd, MYSQL_TIME_STATUS *st, - const Sec9 &nr, date_mode_t mode) - { - if (nr.convert_to_mysql_time(thd, &st->warnings, this, mode) || - add_nanoseconds(thd, &st->warnings, mode, nr.nsec())) - make_fuzzy_date(&st->warnings, date_conv_mode_t(mode)); - } - void make_from_str(THD *thd, Warn *warn, - const char *str, size_t length, CHARSET_INFO *cs, - date_mode_t fuzzydate); - void make_from_double(THD *thd, Warn *warn, double nr, date_mode_t mode) - { - make_from_sec9(thd, warn, Sec9(nr), mode); - if (warn->warnings) - warn->set_double(nr); - } - void make_from_longlong_hybrid(THD *thd, Warn *warn, - const Longlong_hybrid &nr, date_mode_t mode) - { - /* - Note: conversion from an integer to TIME can overflow to - '838:59:59.999999', so the conversion result can have fractional digits. - */ - make_from_sec6(thd, warn, Sec6(nr), mode); - if (warn->warnings) - warn->set_longlong(nr); - } - void make_from_decimal(THD *thd, Warn *warn, - const my_decimal *nr, date_mode_t mode) - { - make_from_sec9(thd, warn, Sec9(nr), mode); - if (warn->warnings) - warn->set_decimal(nr); - } - bool ascii_to_temporal(MYSQL_TIME_STATUS *st, - const char *str, size_t length, - date_mode_t mode) - { - if (mode & (TIME_INTERVAL_hhmmssff | TIME_INTERVAL_DAY)) - return ascii_to_datetime_or_date_or_interval_DDhhmmssff(st, str, length, - mode); - if (mode & TIME_TIME_ONLY) - return ascii_to_datetime_or_date_or_time(st, str, length, mode); - return ascii_to_datetime_or_date(st, str, length, mode); - } - bool ascii_to_datetime_or_date_or_interval_DDhhmmssff(MYSQL_TIME_STATUS *st, - const char *str, - size_t length, - date_mode_t mode) - { - longlong cflags= ulonglong(mode & TIME_MODE_FOR_XXX_TO_DATE); - bool rc= mode & TIME_INTERVAL_DAY ? - ::str_to_datetime_or_date_or_interval_day(str, length, this, cflags, st, - TIME_MAX_INTERVAL_HOUR, - TIME_MAX_INTERVAL_HOUR) : - ::str_to_datetime_or_date_or_interval_hhmmssff(str, length, this, - cflags, st, - TIME_MAX_INTERVAL_HOUR, - TIME_MAX_INTERVAL_HOUR); - DBUG_ASSERT(!rc || st->warnings); - return rc; - } - bool ascii_to_datetime_or_date_or_time(MYSQL_TIME_STATUS *status, - const char *str, size_t length, - date_mode_t fuzzydate) - { - ulonglong cflags= ulonglong(fuzzydate & TIME_MODE_FOR_XXX_TO_DATE); - bool rc= ::str_to_datetime_or_date_or_time(str, length, this, - cflags, status, - TIME_MAX_HOUR, UINT_MAX32); - DBUG_ASSERT(!rc || status->warnings); - return rc; - } - bool ascii_to_datetime_or_date(MYSQL_TIME_STATUS *status, - const char *str, size_t length, - date_mode_t fuzzydate) - { - DBUG_ASSERT(bool(fuzzydate & TIME_TIME_ONLY) == false); - bool rc= ::str_to_datetime_or_date(str, length, this, - ulonglong(fuzzydate & TIME_MODE_FOR_XXX_TO_DATE), - status); - DBUG_ASSERT(!rc || status->warnings); - return rc; - } - // Character set aware versions for string conversion routines - bool str_to_temporal(THD *thd, MYSQL_TIME_STATUS *st, - const char *str, size_t length, - CHARSET_INFO *cs, date_mode_t fuzzydate); - bool str_to_datetime_or_date_or_time(THD *thd, MYSQL_TIME_STATUS *st, - const char *str, size_t length, - CHARSET_INFO *cs, date_mode_t mode); - bool str_to_datetime_or_date(THD *thd, MYSQL_TIME_STATUS *st, - const char *str, size_t length, - CHARSET_INFO *cs, date_mode_t mode); - - bool has_valid_mmssff() const - { - return minute <= TIME_MAX_MINUTE && - second <= TIME_MAX_SECOND && - second_part <= TIME_MAX_SECOND_PART; - } - bool has_zero_YYYYMM() const - { - return year == 0 && month == 0; - } - bool has_zero_YYYYMMDD() const - { - return year == 0 && month == 0 && day == 0; - } - bool check_date(date_conv_mode_t flags, int *warn) const - { - return ::check_date(this, flags, warn); - } - void time_hhmmssff_set_max(uint max_hour) - { - hour= max_hour; - minute= TIME_MAX_MINUTE; - second= TIME_MAX_SECOND; - second_part= TIME_MAX_SECOND_PART; - } - /* - Add nanoseconds to ssff - retval true if seconds overflowed (the caller should increment minutes) - false if no overflow happened - */ - bool add_nanoseconds_ssff(uint nanoseconds) - { - DBUG_ASSERT(nanoseconds <= 1000000000); - if (nanoseconds < 500) - return false; - second_part+= (nanoseconds + 500) / 1000; - if (second_part < 1000000) - return false; - second_part%= 1000000; - if (second < 59) - { - second++; - return false; - } - second= 0; - return true; - } - /* - Add nanoseconds to mmssff - retval true if hours overflowed (the caller should increment hours) - false if no overflow happened - */ - bool add_nanoseconds_mmssff(uint nanoseconds) - { - if (!add_nanoseconds_ssff(nanoseconds)) - return false; - if (minute < 59) - { - minute++; - return false; - } - minute= 0; - return true; - } - void time_round_or_set_max(uint dec, int *warn, ulong max_hour, ulong nsec); - bool datetime_add_nanoseconds_or_invalidate(THD *thd, int *warn, ulong nsec); - bool datetime_round_or_invalidate(THD *thd, uint dec, int *warn, ulong nsec); - bool add_nanoseconds_with_round(THD *thd, int *warn, - date_conv_mode_t mode, ulong nsec); - bool add_nanoseconds(THD *thd, int *warn, date_mode_t mode, ulong nsec) - { - date_conv_mode_t cmode= date_conv_mode_t(mode); - return time_round_mode_t(mode) == TIME_FRAC_ROUND ? - add_nanoseconds_with_round(thd, warn, cmode, nsec) : false; - } -public: - static void *operator new(size_t size, MYSQL_TIME *ltime) throw() - { - DBUG_ASSERT(size == sizeof(MYSQL_TIME)); - return ltime; - } - static void operator delete(void *ptr, MYSQL_TIME *ltime) { } - - long fraction_remainder(uint dec) const - { - return my_time_fraction_remainder(second_part, dec); - } -}; - - -/* - Use this class when you need to get a MYSQL_TIME from an Item - using Item's native timestamp type, without automatic timestamp - type conversion. -*/ -class Temporal_hybrid: public Temporal -{ -public: - class Options: public Temporal::Options - { - public: - Options(THD *thd) - :Temporal::Options(sql_mode_for_dates(thd), default_round_mode(thd)) - { } - Options(date_conv_mode_t flags, time_round_mode_t round_mode) - :Temporal::Options(flags, round_mode) - { } - explicit Options(const Temporal::Options &opt) - :Temporal::Options(opt) - { } - explicit Options(date_mode_t fuzzydate) - :Temporal::Options(fuzzydate) - { } - }; - -public: - // Contructors for Item - Temporal_hybrid(THD *thd, Item *item, date_mode_t fuzzydate); - Temporal_hybrid(THD *thd, Item *item) - :Temporal_hybrid(thd, item, Options(thd)) - { } - Temporal_hybrid(Item *item) - :Temporal_hybrid(current_thd, item) - { } - - // Constructors for non-NULL values - Temporal_hybrid(THD *thd, Warn *warn, - const char *str, size_t length, CHARSET_INFO *cs, - date_mode_t fuzzydate) - { - make_from_str(thd, warn, str, length, cs, fuzzydate); - } - Temporal_hybrid(THD *thd, Warn *warn, - const Longlong_hybrid &nr, date_mode_t fuzzydate) - { - make_from_longlong_hybrid(thd, warn, nr, fuzzydate); - } - Temporal_hybrid(THD *thd, Warn *warn, double nr, date_mode_t fuzzydate) - { - make_from_double(thd, warn, nr, fuzzydate); - } - - // Constructors for nullable values - Temporal_hybrid(THD *thd, Warn *warn, const String *str, date_mode_t mode) - { - if (!str) - time_type= MYSQL_TIMESTAMP_NONE; - else - make_from_str(thd, warn, str->ptr(), str->length(), str->charset(), mode); - } - Temporal_hybrid(THD *thd, Warn *warn, - const Longlong_hybrid_null &nr, date_mode_t fuzzydate) - { - if (nr.is_null()) - time_type= MYSQL_TIMESTAMP_NONE; - else - make_from_longlong_hybrid(thd, warn, nr, fuzzydate); - } - Temporal_hybrid(THD *thd, Warn *warn, const Double_null &nr, date_mode_t mode) - { - if (nr.is_null()) - time_type= MYSQL_TIMESTAMP_NONE; - else - make_from_double(thd, warn, nr.value(), mode); - } - Temporal_hybrid(THD *thd, Warn *warn, const my_decimal *nr, date_mode_t mode) - { - if (!nr) - time_type= MYSQL_TIMESTAMP_NONE; - else - make_from_decimal(thd, warn, nr, mode); - } - // End of constuctors - - bool copy_valid_value_to_mysql_time(MYSQL_TIME *ltime) const - { - DBUG_ASSERT(is_valid_temporal()); - *ltime= *this; - return false; - } - - longlong to_longlong() const - { - if (!is_valid_temporal()) - return 0; - ulonglong v= TIME_to_ulonglong(this); - return neg ? -(longlong) v : (longlong) v; - } - double to_double() const - { - return is_valid_temporal() ? TIME_to_double(this) : 0; - } - my_decimal *to_decimal(my_decimal *to) - { - return is_valid_temporal() ? Temporal::to_decimal(to) : bad_to_decimal(to); - } - String *to_string(String *str, uint dec) const - { - if (!is_valid_temporal()) - return NULL; - str->set_charset(&my_charset_numeric); - if (!str->alloc(MAX_DATE_STRING_REP_LENGTH)) - str->length(my_TIME_to_str(this, const_cast(str->ptr()), dec)); - return str; - } - const MYSQL_TIME *get_mysql_time() const - { - DBUG_ASSERT(is_valid_temporal()); - return this; - } -}; - - -/* - This class resembles the SQL standard , - used in extract expressions, e.g: EXTRACT(DAY FROM dt) - ::= - EXTRACT FROM - ::= | -*/ -class Extract_source: public Temporal_hybrid -{ - /* - Convert a TIME value to DAY-TIME interval, e.g. for extraction: - EXTRACT(DAY FROM x), EXTRACT(HOUR FROM x), etc. - Moves full days from ltime->hour to ltime->day. - */ - void time_to_daytime_interval() - { - DBUG_ASSERT(time_type == MYSQL_TIMESTAMP_TIME); - DBUG_ASSERT(has_zero_YYYYMMDD()); - MYSQL_TIME::day= MYSQL_TIME::hour / 24; - MYSQL_TIME::hour%= 24; - } - bool is_valid_extract_source_slow() const - { - return is_valid_temporal() && MYSQL_TIME::hour < 24 && - (has_zero_YYYYMM() || time_type != MYSQL_TIMESTAMP_TIME); - } - bool is_valid_value_slow() const - { - return time_type == MYSQL_TIMESTAMP_NONE || is_valid_extract_source_slow(); - } -public: - Extract_source(THD *thd, Item *item, date_mode_t mode) - :Temporal_hybrid(thd, item, mode) - { - if (MYSQL_TIME::time_type == MYSQL_TIMESTAMP_TIME) - time_to_daytime_interval(); - DBUG_ASSERT(is_valid_value_slow()); - } - inline const MYSQL_TIME *get_mysql_time() const - { - DBUG_ASSERT(is_valid_extract_source_slow()); - return this; - } - bool is_valid_extract_source() const { return is_valid_temporal(); } - int sign() const { return get_mysql_time()->neg ? -1 : 1; } - uint year() const { return get_mysql_time()->year; } - uint month() const { return get_mysql_time()->month; } - int day() const { return (int) get_mysql_time()->day * sign(); } - int hour() const { return (int) get_mysql_time()->hour * sign(); } - int minute() const { return (int) get_mysql_time()->minute * sign(); } - int second() const { return (int) get_mysql_time()->second * sign(); } - int microsecond() const { return (int) get_mysql_time()->second_part * sign(); } - - uint year_month() const { return year() * 100 + month(); } - uint quarter() const { return (month() + 2)/3; } - uint week(THD *thd) const; - - longlong second_microsecond() const - { - return (second() * 1000000LL + microsecond()); - } - - // DAY TO XXX - longlong day_hour() const - { - return (longlong) day() * 100LL + hour(); - } - longlong day_minute() const - { - return day_hour() * 100LL + minute(); - } - longlong day_second() const - { - return day_minute() * 100LL + second(); - } - longlong day_microsecond() const - { - return day_second() * 1000000LL + microsecond(); - } - - // HOUR TO XXX - int hour_minute() const - { - return hour() * 100 + minute(); - } - int hour_second() const - { - return hour_minute() * 100 + second(); - } - longlong hour_microsecond() const - { - return hour_second() * 1000000LL + microsecond(); - } - - // MINUTE TO XXX - int minute_second() const - { - return minute() * 100 + second(); - } - longlong minute_microsecond() const - { - return minute_second() * 1000000LL + microsecond(); - } -}; - - -/* - This class is used for the "time_interval" argument of these SQL functions: - TIMESTAMP(tm,time_interval) - ADDTIME(tm,time_interval) - Features: - - DATE and DATETIME formats are treated as errors - - Preserves hours for TIME format as is, without limiting to TIME_MAX_HOUR -*/ -class Interval_DDhhmmssff: public Temporal -{ - static const LEX_CSTRING m_type_name; - bool str_to_DDhhmmssff(MYSQL_TIME_STATUS *status, - const char *str, size_t length, CHARSET_INFO *cs, - ulong max_hour); - void push_warning_wrong_or_truncated_value(THD *thd, - const ErrConv &str, - int warnings); - bool is_valid_interval_DDhhmmssff_slow() const - { - return time_type == MYSQL_TIMESTAMP_TIME && - has_zero_YYYYMMDD() && has_valid_mmssff(); - } - bool is_valid_value_slow() const - { - return time_type == MYSQL_TIMESTAMP_NONE || - is_valid_interval_DDhhmmssff_slow(); - } -public: - // Get fractional second precision from an Item - static uint fsp(THD *thd, Item *item); - /* - Maximum useful HOUR value: - TIMESTAMP'0001-01-01 00:00:00' + '87649415:59:59' = '9999-12-31 23:59:59' - This gives maximum possible interval values: - - '87649415:59:59.999999' (in 'hh:mm:ss.ff' format) - - '3652058 23:59:59.999999' (in 'DD hh:mm:ss.ff' format) - */ - static uint max_useful_hour() - { - return TIME_MAX_INTERVAL_HOUR; - } - static uint max_int_part_char_length() - { - // e.g. '+3652058 23:59:59' - return 1/*sign*/ + TIME_MAX_INTERVAL_DAY_CHAR_LENGTH + 1 + 8/*hh:mm:ss*/; - } - static uint max_char_length(uint fsp) - { - DBUG_ASSERT(fsp <= TIME_SECOND_PART_DIGITS); - return max_int_part_char_length() + (fsp ? 1 : 0) + fsp; - } - -public: - Interval_DDhhmmssff(THD *thd, Status *st, bool push_warnings, - Item *item, ulong max_hour, - time_round_mode_t mode, uint dec); - Interval_DDhhmmssff(THD *thd, Item *item, uint dec) - { - Status st; - new(this) Interval_DDhhmmssff(thd, &st, true, item, max_useful_hour(), - default_round_mode(thd), dec); - } - Interval_DDhhmmssff(THD *thd, Item *item) - :Interval_DDhhmmssff(thd, item, TIME_SECOND_PART_DIGITS) - { } - const MYSQL_TIME *get_mysql_time() const - { - DBUG_ASSERT(is_valid_interval_DDhhmmssff_slow()); - return this; - } - bool is_valid_interval_DDhhmmssff() const - { - return time_type == MYSQL_TIMESTAMP_TIME; - } - bool is_valid_value() const - { - return time_type == MYSQL_TIMESTAMP_NONE || is_valid_interval_DDhhmmssff(); - } - String *to_string(String *str, uint dec) const - { - if (!is_valid_interval_DDhhmmssff()) - return NULL; - str->set_charset(&my_charset_numeric); - if (!str->alloc(MAX_DATE_STRING_REP_LENGTH)) - str->length(my_interval_DDhhmmssff_to_str(this, - const_cast(str->ptr()), - dec)); - return str; - } -}; - -class Schema; - - -/** - Class Time is designed to store valid TIME values. - - 1. Valid value: - a. MYSQL_TIMESTAMP_TIME - a valid TIME within the supported TIME range - b. MYSQL_TIMESTAMP_NONE - an undefined value - - 2. Invalid value (internally only): - a. MYSQL_TIMESTAMP_TIME outside of the supported TIME range - a. MYSQL_TIMESTAMP_{DATE|DATETIME|ERROR} - - Temporarily Time is allowed to have an invalid value, but only internally, - during initialization time. All constructors and modification methods must - leave the Time value as described above (see "Valid values"). - - Time derives from MYSQL_TIME privately to make sure it is accessed - externally only in the valid state. -*/ -class Time: public Temporal -{ - static uint binary_length_to_precision(uint length); -public: - enum datetime_to_time_mode_t - { - DATETIME_TO_TIME_DISALLOW, - DATETIME_TO_TIME_YYYYMMDD_000000DD_MIX_TO_HOURS, - DATETIME_TO_TIME_YYYYMMDD_TRUNCATE, - DATETIME_TO_TIME_YYYYMMDD_00000000_ONLY, - DATETIME_TO_TIME_MINUS_CURRENT_DATE - }; - class Options: public Temporal::Options - { - datetime_to_time_mode_t m_datetime_to_time_mode; - public: - Options(THD *thd) - :Temporal::Options(default_flags_for_get_date(), default_round_mode(thd)), - m_datetime_to_time_mode(default_datetime_to_time_mode()) - { } - Options(date_conv_mode_t flags, THD *thd) - :Temporal::Options(flags, default_round_mode(thd)), - m_datetime_to_time_mode(default_datetime_to_time_mode()) - { } - Options(date_conv_mode_t flags, THD *thd, datetime_to_time_mode_t dtmode) - :Temporal::Options(flags, default_round_mode(thd)), - m_datetime_to_time_mode(dtmode) - { } - Options(date_conv_mode_t fuzzydate, time_round_mode_t round_mode, - datetime_to_time_mode_t datetime_to_time_mode) - :Temporal::Options(fuzzydate, round_mode), - m_datetime_to_time_mode(datetime_to_time_mode) - { } - - datetime_to_time_mode_t datetime_to_time_mode() const - { return m_datetime_to_time_mode; } - - static datetime_to_time_mode_t default_datetime_to_time_mode() - { - return DATETIME_TO_TIME_YYYYMMDD_000000DD_MIX_TO_HOURS; - } - }; - /* - CAST(AS TIME) historically does not mix days to hours. - This is different comparing to how implicit conversion - in Field::store_time_dec() works (e.g. on INSERT). - */ - class Options_for_cast: public Options - { - public: - Options_for_cast(THD *thd) - :Options(default_flags_for_get_date(), default_round_mode(thd), - DATETIME_TO_TIME_YYYYMMDD_TRUNCATE) - { } - Options_for_cast(date_mode_t mode, THD *thd) - :Options(default_flags_for_get_date() | (mode & TIME_FUZZY_DATES), - default_round_mode(thd), - DATETIME_TO_TIME_YYYYMMDD_TRUNCATE) - { } - }; - - class Options_for_round: public Options - { - public: - Options_for_round(time_round_mode_t round_mode= TIME_FRAC_TRUNCATE) - :Options(Time::default_flags_for_get_date(), round_mode, - Time::DATETIME_TO_TIME_DISALLOW) - { } - }; - class Options_cmp: public Options - { - public: - Options_cmp(THD *thd) - :Options(comparison_flags_for_get_date(), thd) - { } - Options_cmp(THD *thd, datetime_to_time_mode_t dtmode) - :Options(comparison_flags_for_get_date(), - default_round_mode(thd), dtmode) - { } - }; -private: - bool is_valid_value_slow() const - { - return time_type == MYSQL_TIMESTAMP_NONE || is_valid_time_slow(); - } - bool is_valid_time_slow() const - { - return time_type == MYSQL_TIMESTAMP_TIME && - has_zero_YYYYMMDD() && has_valid_mmssff(); - } - void hhmmssff_copy(const MYSQL_TIME *from) - { - hour= from->hour; - minute= from->minute; - second= from->second; - second_part= from->second_part; - } - void datetime_to_time_YYYYMMDD_000000DD_mix_to_hours(int *warn, - uint from_year, - uint from_month, - uint from_day) - { - if (from_year != 0 || from_month != 0) - *warn|= MYSQL_TIME_NOTE_TRUNCATED; - else - hour+= from_day * 24; - } - /* - The result is calculated effectively similar to: - TIMEDIFF(dt, CAST(CURRENT_DATE AS DATETIME)) - If the difference does not fit to the supported TIME range, it's truncated. - */ - void datetime_to_time_minus_current_date(THD *thd) - { - MYSQL_TIME current_date, tmp; - set_current_date(thd, ¤t_date); - calc_time_diff(this, ¤t_date, 1, &tmp, date_mode_t(0)); - static_cast(this)[0]= tmp; - int warnings= 0; - (void) check_time_range(this, TIME_SECOND_PART_DIGITS, &warnings); - DBUG_ASSERT(is_valid_time()); - } - /* - Convert a valid DATE or DATETIME to TIME. - Before this call, "this" must be a valid DATE or DATETIME value, - e.g. returned from Item::get_date(), str_to_xxx(), number_to_xxx(). - After this call, "this" is a valid TIME value. - */ - void valid_datetime_to_valid_time(THD *thd, int *warn, const Options opt) - { - DBUG_ASSERT(time_type == MYSQL_TIMESTAMP_DATE || - time_type == MYSQL_TIMESTAMP_DATETIME); - /* - We're dealing with a DATE or DATETIME returned from - str_to_xxx(), number_to_xxx() or unpack_time(). - Do some asserts to make sure the result hour value - after mixing days to hours does not go out of the valid TIME range. - The maximum hour value after mixing days will be 31*24+23=767, - which is within the supported TIME range. - Thus no adjust_time_range_or_invalidate() is needed here. - */ - DBUG_ASSERT(day < 32); - DBUG_ASSERT(hour < 24); - if (opt.datetime_to_time_mode() == DATETIME_TO_TIME_MINUS_CURRENT_DATE) - { - datetime_to_time_minus_current_date(thd); - } - else - { - if (opt.datetime_to_time_mode() == - DATETIME_TO_TIME_YYYYMMDD_000000DD_MIX_TO_HOURS) - datetime_to_time_YYYYMMDD_000000DD_mix_to_hours(warn, year, month, day); - year= month= day= 0; - time_type= MYSQL_TIMESTAMP_TIME; - } - DBUG_ASSERT(is_valid_time_slow()); - } - /** - Convert valid DATE/DATETIME to valid TIME if needed. - This method is called after Item::get_date(), - str_to_xxx(), number_to_xxx(). - which can return only valid TIME/DATE/DATETIME values. - Before this call, "this" is: - - either a valid TIME/DATE/DATETIME value - (within the supported range for the corresponding type), - - or MYSQL_TIMESTAMP_NONE - After this call, "this" is: - - either a valid TIME (within the supported TIME range), - - or MYSQL_TIMESTAMP_NONE - */ - void valid_MYSQL_TIME_to_valid_value(THD *thd, int *warn, const Options opt) - { - switch (time_type) { - case MYSQL_TIMESTAMP_DATE: - case MYSQL_TIMESTAMP_DATETIME: - if (opt.datetime_to_time_mode() == - DATETIME_TO_TIME_YYYYMMDD_00000000_ONLY && - (year || month || day)) - make_from_out_of_range(warn); - else if (opt.datetime_to_time_mode() == DATETIME_TO_TIME_DISALLOW) - make_from_out_of_range(warn); - else - valid_datetime_to_valid_time(thd, warn, opt); - break; - case MYSQL_TIMESTAMP_NONE: - break; - case MYSQL_TIMESTAMP_ERROR: - set_zero_time(this, MYSQL_TIMESTAMP_TIME); - break; - case MYSQL_TIMESTAMP_TIME: - DBUG_ASSERT(is_valid_time_slow()); - break; - } - } - - /* - This method is called after number_to_xxx() and str_to_xxx(), - which can return DATE or DATETIME values. Convert to TIME if needed. - We trust that xxx_to_time() returns a valid TIME/DATE/DATETIME value, - so here we need to do only simple validation. - */ - void xxx_to_time_result_to_valid_value(THD *thd, int *warn, const Options opt) - { - // str_to_xxx(), number_to_xxx() never return MYSQL_TIMESTAMP_ERROR - DBUG_ASSERT(time_type != MYSQL_TIMESTAMP_ERROR); - valid_MYSQL_TIME_to_valid_value(thd, warn, opt); - } - void adjust_time_range_or_invalidate(int *warn) - { - if (check_time_range(this, TIME_SECOND_PART_DIGITS, warn)) - time_type= MYSQL_TIMESTAMP_NONE; - DBUG_ASSERT(is_valid_value_slow()); - } -public: - void round_or_set_max(uint dec, int *warn, ulong nsec); -private: - void round_or_set_max(uint dec, int *warn); - - /* - All make_from_xxx() methods initialize *warn. - The old value gets lost. - */ - void make_from_datetime_move_day_to_hour(int *warn, const MYSQL_TIME *from); - void make_from_datetime_with_days_diff(int *warn, const MYSQL_TIME *from, - long curdays); - void make_from_time(int *warn, const MYSQL_TIME *from); - void make_from_datetime(int *warn, const MYSQL_TIME *from, long curdays); - void make_from_item(THD *thd, int *warn, Item *item, const Options opt); -public: - /* - All constructors that accept an "int *warn" parameter initialize *warn. - The old value gets lost. - */ - Time(int *warn, bool neg, ulonglong hour, uint minute, const Sec6 &second); - Time() { time_type= MYSQL_TIMESTAMP_NONE; } - Time(const Native &native); - Time(THD *thd, const MYSQL_TIME *ltime, const Options opt) - { - *(static_cast(this))= *ltime; - DBUG_ASSERT(is_valid_temporal()); - int warn= 0; - valid_MYSQL_TIME_to_valid_value(thd, &warn, opt); - } - Time(Item *item) - :Time(current_thd, item) - { } - Time(THD *thd, Item *item, const Options opt) - { - int warn; - make_from_item(thd, &warn, item, opt); - } - Time(THD *thd, Item *item) - :Time(thd, item, Options(thd)) - { } - Time(int *warn, const MYSQL_TIME *from, long curdays); - Time(THD *thd, MYSQL_TIME_STATUS *status, - const char *str, size_t len, CHARSET_INFO *cs, - const Options opt) - { - if (str_to_datetime_or_date_or_time(thd, status, str, len, cs, opt)) - time_type= MYSQL_TIMESTAMP_NONE; - // The below call will optionally add notes to already collected warnings: - else - xxx_to_time_result_to_valid_value(thd, &status->warnings, opt); - } - -protected: - Time(THD *thd, int *warn, const Sec6 &nr, const Options opt) - { - if (nr.to_datetime_or_time(this, warn, TIME_INVALID_DATES)) - time_type= MYSQL_TIMESTAMP_NONE; - xxx_to_time_result_to_valid_value(thd, warn, opt); - } - Time(THD *thd, int *warn, const Sec9 &nr, const Options &opt) - :Time(thd, warn, static_cast(nr), opt) - { - if (is_valid_time() && time_round_mode_t(opt) == TIME_FRAC_ROUND) - round_or_set_max(6, warn, nr.nsec()); - } - -public: - Time(THD *thd, int *warn, const Longlong_hybrid &nr, const Options &opt) - :Time(thd, warn, Sec6(nr), opt) - { } - Time(THD *thd, int *warn, double nr, const Options &opt) - :Time(thd, warn, Sec9(nr), opt) - { } - Time(THD *thd, int *warn, const my_decimal *d, const Options &opt) - :Time(thd, warn, Sec9(d), opt) - { } - - Time(THD *thd, Item *item, const Options opt, uint dec) - :Time(thd, item, opt) - { - round(dec, time_round_mode_t(opt)); - } - Time(int *warn, const MYSQL_TIME *from, long curdays, - const Time::Options &opt, uint dec) - :Time(warn, from, curdays) - { - round(dec, time_round_mode_t(opt), warn); - } - Time(int *warn, bool neg, ulonglong hour, uint minute, const Sec9 &second, - time_round_mode_t mode, uint dec) - :Time(warn, neg, hour, minute, second) - { - DBUG_ASSERT(is_valid_time()); - if ((ulonglong) mode == (ulonglong) TIME_FRAC_ROUND) - round_or_set_max(6, warn, second.nsec()); - round(dec, mode, warn); - } - Time(THD *thd, MYSQL_TIME_STATUS *status, - const char *str, size_t len, CHARSET_INFO *cs, - const Options &opt, uint dec) - :Time(thd, status, str, len, cs, opt) - { - round(dec, time_round_mode_t(opt), &status->warnings); - } - Time(THD *thd, int *warn, const Longlong_hybrid &nr, - const Options &opt, uint dec) - :Time(thd, warn, nr, opt) - { - /* - Decimal digit truncation is needed here in case if nr was out - of the supported TIME range, so "this" was set to '838:59:59.999999'. - We always do truncation (not rounding) here, independently from "opt". - */ - trunc(dec); - } - Time(THD *thd, int *warn, double nr, const Options &opt, uint dec) - :Time(thd, warn, nr, opt) - { - round(dec, time_round_mode_t(opt), warn); - } - Time(THD *thd, int *warn, const my_decimal *d, const Options &opt, uint dec) - :Time(thd, warn, d, opt) - { - round(dec, time_round_mode_t(opt), warn); - } - - static date_conv_mode_t default_flags_for_get_date() - { return TIME_TIME_ONLY | TIME_INVALID_DATES; } - static date_conv_mode_t comparison_flags_for_get_date() - { return TIME_TIME_ONLY | TIME_INVALID_DATES | TIME_FUZZY_DATES; } - bool is_valid_time() const - { - DBUG_ASSERT(is_valid_value_slow()); - return time_type == MYSQL_TIMESTAMP_TIME; - } - const MYSQL_TIME *get_mysql_time() const - { - DBUG_ASSERT(is_valid_time_slow()); - return this; - } - bool copy_to_mysql_time(MYSQL_TIME *ltime) const - { - if (time_type == MYSQL_TIMESTAMP_NONE) - { - ltime->time_type= MYSQL_TIMESTAMP_NONE; - return true; - } - DBUG_ASSERT(is_valid_time_slow()); - *ltime= *this; - return false; - } - int cmp(const Time *other) const - { - DBUG_ASSERT(is_valid_time_slow()); - DBUG_ASSERT(other->is_valid_time_slow()); - longlong p0= to_packed(); - longlong p1= other->to_packed(); - if (p0 < p1) - return -1; - if (p0 > p1) - return 1; - return 0; - } - longlong to_seconds_abs() const - { - DBUG_ASSERT(is_valid_time_slow()); - return hour * 3600L + minute * 60 + second; - } - longlong to_seconds() const - { - return neg ? -to_seconds_abs() : to_seconds_abs(); - } - longlong to_longlong() const - { - if (!is_valid_time()) - return 0; - ulonglong v= TIME_to_ulonglong_time(this); - return neg ? -(longlong) v : (longlong) v; - } - double to_double() const - { - return !is_valid_time() ? 0 : - Temporal::to_double(neg, TIME_to_ulonglong_time(this), second_part); - } - bool to_native(Native *to, uint decimals) const; - String *to_string(String *str, uint dec) const - { - if (!is_valid_time()) - return NULL; - str->set_charset(&my_charset_numeric); - if (!str->alloc(MAX_DATE_STRING_REP_LENGTH)) - str->length(my_time_to_str(this, const_cast(str->ptr()), dec)); - return str; - } - my_decimal *to_decimal(my_decimal *to) - { - return is_valid_time() ? Temporal::to_decimal(to) : bad_to_decimal(to); - } - longlong to_packed() const - { - return is_valid_time() ? Temporal::to_packed() : 0; - } - longlong valid_time_to_packed() const - { - DBUG_ASSERT(is_valid_time_slow()); - return Temporal::to_packed(); - } - long fraction_remainder(uint dec) const - { - DBUG_ASSERT(is_valid_time()); - return Temporal::fraction_remainder(dec); - } - - Time &trunc(uint dec) - { - if (is_valid_time()) - my_time_trunc(this, dec); - DBUG_ASSERT(is_valid_value_slow()); - return *this; - } - Time &ceiling(int *warn) - { - if (is_valid_time()) - { - if (neg) - my_time_trunc(this, 0); - else if (second_part) - round_or_set_max(0, warn, 999999999); - } - DBUG_ASSERT(is_valid_value_slow()); - return *this; - } - Time &ceiling() - { - int warn= 0; - return ceiling(&warn); - } - Time &floor(int *warn) - { - if (is_valid_time()) - { - if (!neg) - my_time_trunc(this, 0); - else if (second_part) - round_or_set_max(0, warn, 999999999); - } - DBUG_ASSERT(is_valid_value_slow()); - return *this; - } - Time &floor() - { - int warn= 0; - return floor(&warn); - } - Time &round(uint dec, int *warn) - { - if (is_valid_time()) - round_or_set_max(dec, warn); - DBUG_ASSERT(is_valid_value_slow()); - return *this; - } - Time &round(uint dec, time_round_mode_t mode, int *warn) - { - switch (mode.mode()) { - case time_round_mode_t::FRAC_NONE: - DBUG_ASSERT(fraction_remainder(dec) == 0); - return trunc(dec); - case time_round_mode_t::FRAC_TRUNCATE: - return trunc(dec); - case time_round_mode_t::FRAC_ROUND: - return round(dec, warn); - } - return *this; - } - Time &round(uint dec, time_round_mode_t mode) - { - int warn= 0; - return round(dec, mode, &warn); - } - -}; - - -/** - Class Temporal_with_date is designed to store valid DATE or DATETIME values. - See also class Time. - - 1. Valid value: - a. MYSQL_TIMESTAMP_{DATE|DATETIME} - a valid DATE or DATETIME value - b. MYSQL_TIMESTAMP_NONE - an undefined value - - 2. Invalid value (internally only): - a. MYSQL_TIMESTAMP_{DATE|DATETIME} - a DATE or DATETIME value, but with - MYSQL_TIME members outside of the - valid/supported range - b. MYSQL_TIMESTAMP_TIME - a TIME value - c. MYSQL_TIMESTAMP_ERROR - error - - Temporarily is allowed to have an invalid value, but only internally, - during initialization time. All constructors and modification methods must - leave the value as described above (see "Valid value"). - - Derives from MYSQL_TIME using "protected" inheritance to make sure - it is accessed externally only in the valid state. -*/ - -class Temporal_with_date: public Temporal -{ -public: - class Options: public Temporal::Options - { - public: - Options(date_conv_mode_t fuzzydate, time_round_mode_t mode): - Temporal::Options(fuzzydate, mode) - {} - explicit Options(const Temporal::Options &opt) - :Temporal::Options(opt) - { } - explicit Options(date_mode_t mode) - :Temporal::Options(mode) - { } - }; -protected: - void check_date_or_invalidate(int *warn, date_conv_mode_t flags); - void make_from_item(THD *thd, Item *item, date_mode_t flags); - - ulong daynr() const - { - return (ulong) ::calc_daynr((uint) year, (uint) month, (uint) day); - } - int weekday(bool sunday_first_day_of_week) const - { - return ::calc_weekday(daynr(), sunday_first_day_of_week); - } - ulong dayofyear() const - { - return (ulong) (daynr() - ::calc_daynr(year, 1, 1) + 1); - } - uint quarter() const - { - return (month + 2) / 3; - } - uint week(uint week_behaviour) const - { - uint year; - return calc_week(this, week_behaviour, &year); - } - uint yearweek(uint week_behaviour) const - { - uint year; - uint week= calc_week(this, week_behaviour, &year); - return week + year * 100; - } -public: - Temporal_with_date() - { - time_type= MYSQL_TIMESTAMP_NONE; - } - Temporal_with_date(THD *thd, Item *item, date_mode_t fuzzydate) - { - make_from_item(thd, item, fuzzydate); - } - Temporal_with_date(int *warn, const Sec6 &nr, date_mode_t flags) - { - DBUG_ASSERT(bool(flags & TIME_TIME_ONLY) == false); - if (nr.to_datetime_or_date(this, warn, date_conv_mode_t(flags))) - time_type= MYSQL_TIMESTAMP_NONE; - } - Temporal_with_date(THD *thd, MYSQL_TIME_STATUS *status, - const char *str, size_t len, CHARSET_INFO *cs, - date_mode_t flags) - { - DBUG_ASSERT(bool(flags & TIME_TIME_ONLY) == false); - if (str_to_datetime_or_date(thd, status, str, len, cs, flags)) - time_type= MYSQL_TIMESTAMP_NONE; - } -public: - bool check_date_with_warn(THD *thd, date_conv_mode_t flags) - { - return ::check_date_with_warn(thd, this, flags, MYSQL_TIMESTAMP_ERROR); - } - bool check_date_with_warn(THD *thd) - { - return ::check_date_with_warn(thd, this, Temporal::sql_mode_for_dates(thd), - MYSQL_TIMESTAMP_ERROR); - } - static date_conv_mode_t comparison_flags_for_get_date() - { return TIME_INVALID_DATES | TIME_FUZZY_DATES; } -}; - - -/** - Class Date is designed to store valid DATE values. - All constructors and modification methods leave instances - of this class in one of the following valid states: - a. MYSQL_TIMESTAMP_DATE - a DATE with all MYSQL_TIME members properly set - b. MYSQL_TIMESTAMP_NONE - an undefined value. - Other MYSQL_TIMESTAMP_XXX are not possible. - MYSQL_TIMESTAMP_DATE with MYSQL_TIME members improperly set is not possible. -*/ -class Date: public Temporal_with_date -{ - bool is_valid_value_slow() const - { - return time_type == MYSQL_TIMESTAMP_NONE || is_valid_date_slow(); - } - bool is_valid_date_slow() const - { - DBUG_ASSERT(time_type == MYSQL_TIMESTAMP_DATE); - return !check_datetime_range(this); - } -public: - class Options: public Temporal_with_date::Options - { - public: - explicit Options(date_conv_mode_t fuzzydate) - :Temporal_with_date::Options(fuzzydate, TIME_FRAC_TRUNCATE) - { } - Options(THD *thd, time_round_mode_t mode) - :Temporal_with_date::Options(sql_mode_for_dates(thd), mode) - { } - explicit Options(THD *thd) - :Temporal_with_date::Options(sql_mode_for_dates(thd), TIME_FRAC_TRUNCATE) - { } - explicit Options(date_mode_t fuzzydate) - :Temporal_with_date::Options(fuzzydate) - { } - }; -public: - Date(Item *item, date_mode_t fuzzydate) - :Date(current_thd, item, fuzzydate) - { } - Date(THD *thd, Item *item, date_mode_t fuzzydate) - :Temporal_with_date(thd, item, fuzzydate) - { - if (time_type == MYSQL_TIMESTAMP_DATETIME) - datetime_to_date(this); - DBUG_ASSERT(is_valid_value_slow()); - } - Date(THD *thd, Item *item, date_conv_mode_t fuzzydate) - :Date(thd, item, Options(fuzzydate)) - { } - Date(THD *thd, Item *item) - :Temporal_with_date(Date(thd, item, Options(thd, TIME_FRAC_TRUNCATE))) - { } - Date(Item *item) - :Temporal_with_date(Date(current_thd, item)) - { } - Date(const Temporal_with_date *d) - :Temporal_with_date(*d) - { - datetime_to_date(this); - DBUG_ASSERT(is_valid_date_slow()); - } - explicit Date(const Temporal_hybrid *from) - { - from->copy_valid_value_to_mysql_time(this); - DBUG_ASSERT(is_valid_date_slow()); - } - bool is_valid_date() const - { - DBUG_ASSERT(is_valid_value_slow()); - return time_type == MYSQL_TIMESTAMP_DATE; - } - bool check_date(date_conv_mode_t flags, int *warnings) const - { - DBUG_ASSERT(is_valid_date_slow()); - return ::check_date(this, (year || month || day), - ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE), - warnings); - } - bool check_date(THD *thd, int *warnings) const - { - return check_date(Temporal::sql_mode_for_dates(thd), warnings); - } - bool check_date(date_conv_mode_t flags) const - { - int dummy; /* unused */ - return check_date(flags, &dummy); - } - bool check_date(THD *thd) const - { - int dummy; - return check_date(Temporal::sql_mode_for_dates(thd), &dummy); - } - const MYSQL_TIME *get_mysql_time() const - { - DBUG_ASSERT(is_valid_date_slow()); - return this; - } - bool copy_to_mysql_time(MYSQL_TIME *ltime) const - { - if (time_type == MYSQL_TIMESTAMP_NONE) - { - ltime->time_type= MYSQL_TIMESTAMP_NONE; - return true; - } - DBUG_ASSERT(is_valid_date_slow()); - *ltime= *this; - return false; - } - ulong daynr() const - { - DBUG_ASSERT(is_valid_date_slow()); - return Temporal_with_date::daynr(); - } - ulong dayofyear() const - { - DBUG_ASSERT(is_valid_date_slow()); - return Temporal_with_date::dayofyear(); - } - uint quarter() const - { - DBUG_ASSERT(is_valid_date_slow()); - return Temporal_with_date::quarter(); - } - uint week(uint week_behaviour) const - { - DBUG_ASSERT(is_valid_date_slow()); - return Temporal_with_date::week(week_behaviour); - } - uint yearweek(uint week_behaviour) const - { - DBUG_ASSERT(is_valid_date_slow()); - return Temporal_with_date::yearweek(week_behaviour); - } - - longlong valid_date_to_packed() const - { - DBUG_ASSERT(is_valid_date_slow()); - return Temporal::to_packed(); - } - longlong to_longlong() const - { - return is_valid_date() ? (longlong) TIME_to_ulonglong_date(this) : 0LL; - } - double to_double() const - { - return (double) to_longlong(); - } - String *to_string(String *str) const - { - if (!is_valid_date()) - return NULL; - str->set_charset(&my_charset_numeric); - if (!str->alloc(MAX_DATE_STRING_REP_LENGTH)) - str->length(my_date_to_str(this, const_cast(str->ptr()))); - return str; - } - my_decimal *to_decimal(my_decimal *to) - { - return is_valid_date() ? Temporal::to_decimal(to) : bad_to_decimal(to); - } -}; - - -/** - Class Datetime is designed to store valid DATETIME values. - All constructors and modification methods leave instances - of this class in one of the following valid states: - a. MYSQL_TIMESTAMP_DATETIME - a DATETIME with all members properly set - b. MYSQL_TIMESTAMP_NONE - an undefined value. - Other MYSQL_TIMESTAMP_XXX are not possible. - MYSQL_TIMESTAMP_DATETIME with MYSQL_TIME members - improperly set is not possible. -*/ -class Datetime: public Temporal_with_date -{ - bool is_valid_value_slow() const - { - return time_type == MYSQL_TIMESTAMP_NONE || is_valid_datetime_slow(); - } - bool is_valid_datetime_slow() const - { - DBUG_ASSERT(time_type == MYSQL_TIMESTAMP_DATETIME); - return !check_datetime_range(this); - } - bool add_nanoseconds_or_invalidate(THD *thd, int *warn, ulong nsec) - { - DBUG_ASSERT(is_valid_datetime_slow()); - bool rc= Temporal::datetime_add_nanoseconds_or_invalidate(thd, warn, nsec); - DBUG_ASSERT(is_valid_value_slow()); - return rc; - } - void date_to_datetime_if_needed() - { - if (time_type == MYSQL_TIMESTAMP_DATE) - date_to_datetime(this); - } - void make_from_time(THD *thd, int *warn, const MYSQL_TIME *from, - date_conv_mode_t flags); - void make_from_datetime(THD *thd, int *warn, const MYSQL_TIME *from, - date_conv_mode_t flags); - bool round_or_invalidate(THD *thd, uint dec, int *warn); - bool round_or_invalidate(THD *thd, uint dec, int *warn, ulong nsec) - { - DBUG_ASSERT(is_valid_datetime_slow()); - bool rc= Temporal::datetime_round_or_invalidate(thd, dec, warn, nsec); - DBUG_ASSERT(is_valid_value_slow()); - return rc; - } -public: - - class Options: public Temporal_with_date::Options - { - public: - Options(date_conv_mode_t fuzzydate, time_round_mode_t nanosecond_rounding) - :Temporal_with_date::Options(fuzzydate, nanosecond_rounding) - { } - Options(THD *thd) - :Temporal_with_date::Options(sql_mode_for_dates(thd), default_round_mode(thd)) - { } - Options(THD *thd, time_round_mode_t rounding_mode) - :Temporal_with_date::Options(sql_mode_for_dates(thd), rounding_mode) - { } - Options(date_conv_mode_t fuzzydate, THD *thd) - :Temporal_with_date::Options(fuzzydate, default_round_mode(thd)) - { } - }; - - class Options_cmp: public Options - { - public: - Options_cmp(THD *thd) - :Options(comparison_flags_for_get_date(), thd) - { } - }; - - static Datetime zero() - { - int warn; - static Longlong_hybrid nr(0, false); - return Datetime(&warn, nr, date_mode_t(0)); - } -public: - Datetime() // NULL value - :Temporal_with_date() - { } - Datetime(THD *thd, Item *item, date_mode_t fuzzydate) - :Temporal_with_date(thd, item, fuzzydate) - { - date_to_datetime_if_needed(); - DBUG_ASSERT(is_valid_value_slow()); - } - Datetime(THD *thd, Item *item) - :Temporal_with_date(Datetime(thd, item, Options(thd))) - { } - Datetime(Item *item) - :Datetime(current_thd, item) - { } - - Datetime(THD *thd, int *warn, const MYSQL_TIME *from, date_conv_mode_t flags); - Datetime(THD *thd, MYSQL_TIME_STATUS *status, - const char *str, size_t len, CHARSET_INFO *cs, - const date_mode_t fuzzydate) - :Temporal_with_date(thd, status, str, len, cs, fuzzydate) - { - date_to_datetime_if_needed(); - DBUG_ASSERT(is_valid_value_slow()); - } - -protected: - Datetime(int *warn, const Sec6 &nr, date_mode_t flags) - :Temporal_with_date(warn, nr, flags) - { - date_to_datetime_if_needed(); - DBUG_ASSERT(is_valid_value_slow()); - } - Datetime(THD *thd, int *warn, const Sec9 &nr, date_mode_t fuzzydate) - :Datetime(warn, static_cast(nr), fuzzydate) - { - if (is_valid_datetime() && - time_round_mode_t(fuzzydate) == TIME_FRAC_ROUND) - round_or_invalidate(thd, 6, warn, nr.nsec()); - DBUG_ASSERT(is_valid_value_slow()); - } - -public: - Datetime(int *warn, const Longlong_hybrid &nr, date_mode_t mode) - :Datetime(warn, Sec6(nr), mode) - { } - Datetime(THD *thd, int *warn, double nr, date_mode_t fuzzydate) - :Datetime(thd, warn, Sec9(nr), fuzzydate) - { } - Datetime(THD *thd, int *warn, const my_decimal *d, date_mode_t fuzzydate) - :Datetime(thd, warn, Sec9(d), fuzzydate) - { } - Datetime(THD *thd, const timeval &tv); - - Datetime(THD *thd, Item *item, date_mode_t fuzzydate, uint dec) - :Datetime(thd, item, fuzzydate) - { - int warn= 0; - round(thd, dec, time_round_mode_t(fuzzydate), &warn); - } - Datetime(THD *thd, MYSQL_TIME_STATUS *status, - const char *str, size_t len, CHARSET_INFO *cs, - date_mode_t fuzzydate, uint dec) - :Datetime(thd, status, str, len, cs, fuzzydate) - { - round(thd, dec, time_round_mode_t(fuzzydate), &status->warnings); - } - Datetime(THD *thd, int *warn, double nr, date_mode_t fuzzydate, uint dec) - :Datetime(thd, warn, nr, fuzzydate) - { - round(thd, dec, time_round_mode_t(fuzzydate), warn); - } - Datetime(THD *thd, int *warn, const my_decimal *d, date_mode_t fuzzydate, uint dec) - :Datetime(thd, warn, d, fuzzydate) - { - round(thd, dec, time_round_mode_t(fuzzydate), warn); - } - Datetime(THD *thd, int *warn, const MYSQL_TIME *from, - date_mode_t fuzzydate, uint dec) - :Datetime(thd, warn, from, date_conv_mode_t(fuzzydate) & ~TIME_TIME_ONLY) - { - round(thd, dec, time_round_mode_t(fuzzydate), warn); - } - explicit Datetime(const Temporal_hybrid *from) - { - from->copy_valid_value_to_mysql_time(this); - DBUG_ASSERT(is_valid_datetime_slow()); - } - explicit Datetime(const MYSQL_TIME *from) - { - *(static_cast(this))= *from; - DBUG_ASSERT(is_valid_datetime_slow()); - } - - bool is_valid_datetime() const - { - /* - Here we quickly check for the type only. - If the type is valid, the rest of value must also be valid. - */ - DBUG_ASSERT(is_valid_value_slow()); - return time_type == MYSQL_TIMESTAMP_DATETIME; - } - bool check_date(date_conv_mode_t flags, int *warnings) const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return ::check_date(this, (year || month || day), - ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE), - warnings); - } - bool check_date(date_conv_mode_t flags) const - { - int dummy; /* unused */ - return check_date(flags, &dummy); - } - bool check_date(THD *thd) const - { - return check_date(Temporal::sql_mode_for_dates(thd)); - } - bool hhmmssff_is_zero() const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return hour == 0 && minute == 0 && second == 0 && second_part == 0; - } - ulong daynr() const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return Temporal_with_date::daynr(); - } - int weekday(bool sunday_first_day_of_week) const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return Temporal_with_date::weekday(sunday_first_day_of_week); - } - ulong dayofyear() const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return Temporal_with_date::dayofyear(); - } - uint quarter() const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return Temporal_with_date::quarter(); - } - uint week(uint week_behaviour) const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return Temporal_with_date::week(week_behaviour); - } - uint yearweek(uint week_behaviour) const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return Temporal_with_date::yearweek(week_behaviour); - } - - longlong hhmmss_to_seconds_abs() const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return hour * 3600L + minute * 60 + second; - } - longlong hhmmss_to_seconds() const - { - return neg ? -hhmmss_to_seconds_abs() : hhmmss_to_seconds_abs(); - } - longlong to_seconds() const - { - return hhmmss_to_seconds() + (longlong) daynr() * 24L * 3600L; - } - - const MYSQL_TIME *get_mysql_time() const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return this; - } - bool copy_to_mysql_time(MYSQL_TIME *ltime) const - { - if (time_type == MYSQL_TIMESTAMP_NONE) - { - ltime->time_type= MYSQL_TIMESTAMP_NONE; - return true; - } - DBUG_ASSERT(is_valid_datetime_slow()); - *ltime= *this; - return false; - } - /** - Copy without data loss, with an optional DATETIME to DATE conversion. - If the value of the "type" argument is MYSQL_TIMESTAMP_DATE, - then "this" must be a datetime with a zero hhmmssff part. - */ - bool copy_to_mysql_time(MYSQL_TIME *ltime, timestamp_type type) - { - DBUG_ASSERT(type == MYSQL_TIMESTAMP_DATE || - type == MYSQL_TIMESTAMP_DATETIME); - if (copy_to_mysql_time(ltime)) - return true; - DBUG_ASSERT(type != MYSQL_TIMESTAMP_DATE || hhmmssff_is_zero()); - ltime->time_type= type; - return false; - } - longlong to_longlong() const - { - return is_valid_datetime() ? - (longlong) TIME_to_ulonglong_datetime(this) : 0LL; - } - double to_double() const - { - return !is_valid_datetime() ? 0 : - Temporal::to_double(neg, TIME_to_ulonglong_datetime(this), second_part); - } - String *to_string(String *str, uint dec) const - { - if (!is_valid_datetime()) - return NULL; - str->set_charset(&my_charset_numeric); - if (!str->alloc(MAX_DATE_STRING_REP_LENGTH)) - str->length(my_datetime_to_str(this, const_cast(str->ptr()), dec)); - return str; - } - my_decimal *to_decimal(my_decimal *to) - { - return is_valid_datetime() ? Temporal::to_decimal(to) : bad_to_decimal(to); - } - longlong to_packed() const - { - return is_valid_datetime() ? Temporal::to_packed() : 0; - } - longlong valid_datetime_to_packed() const - { - DBUG_ASSERT(is_valid_datetime_slow()); - return Temporal::to_packed(); - } - long fraction_remainder(uint dec) const - { - DBUG_ASSERT(is_valid_datetime()); - return Temporal::fraction_remainder(dec); - } - - Datetime &trunc(uint dec) - { - if (is_valid_datetime()) - my_datetime_trunc(this, dec); - DBUG_ASSERT(is_valid_value_slow()); - return *this; - } - Datetime &ceiling(THD *thd, int *warn) - { - if (is_valid_datetime() && second_part) - round_or_invalidate(thd, 0, warn, 999999999); - DBUG_ASSERT(is_valid_value_slow()); - return *this; - } - Datetime &ceiling(THD *thd) - { - int warn= 0; - return ceiling(thd, &warn); - } - Datetime &round(THD *thd, uint dec, int *warn) - { - if (is_valid_datetime()) - round_or_invalidate(thd, dec, warn); - DBUG_ASSERT(is_valid_value_slow()); - return *this; - } - Datetime &round(THD *thd, uint dec, time_round_mode_t mode, int *warn) - { - switch (mode.mode()) { - case time_round_mode_t::FRAC_NONE: - DBUG_ASSERT(fraction_remainder(dec) == 0); - return trunc(dec); - case time_round_mode_t::FRAC_TRUNCATE: - return trunc(dec); - case time_round_mode_t::FRAC_ROUND: - return round(thd, dec, warn); - } - return *this; - } - Datetime &round(THD *thd, uint dec, time_round_mode_t mode) - { - int warn= 0; - return round(thd, dec, mode, &warn); - } - -}; - - -/* - Datetime to be created from an Item who is known to be of a temporal - data type. For temporal data types we don't need nanosecond rounding - or truncation, as their precision is limited. -*/ -class Datetime_from_temporal: public Datetime -{ -public: - // The constructor DBUG_ASSERTs on a proper Item data type. - Datetime_from_temporal(THD *thd, Item *temporal, date_conv_mode_t flags); -}; - - -/* - Datetime to be created from an Item who is known not to have digits outside - of the specified scale. So it's not important which rounding method to use. - TRUNCATE should work. - Typically, Item is of a temporal data type, but this is not strictly required. -*/ -class Datetime_truncation_not_needed: public Datetime -{ -public: - Datetime_truncation_not_needed(THD *thd, Item *item, date_conv_mode_t mode); - Datetime_truncation_not_needed(THD *thd, Item *item, date_mode_t mode) - :Datetime_truncation_not_needed(thd, item, date_conv_mode_t(mode)) - { } -}; - - -class Timestamp: protected Timeval -{ - static uint binary_length_to_precision(uint length); -protected: - void round_or_set_max(uint dec, int *warn); - bool add_nanoseconds_usec(uint nanoseconds) - { - DBUG_ASSERT(nanoseconds <= 1000000000); - if (nanoseconds < 500) - return false; - tv_usec+= (nanoseconds + 500) / 1000; - if (tv_usec < 1000000) - return false; - tv_usec%= 1000000; - return true; - } -public: - static date_conv_mode_t sql_mode_for_timestamp(THD *thd); - static time_round_mode_t default_round_mode(THD *thd); - class DatetimeOptions: public date_mode_t - { - public: - DatetimeOptions(date_conv_mode_t fuzzydate, time_round_mode_t round_mode) - :date_mode_t(fuzzydate | round_mode) - { } - DatetimeOptions(THD *thd) - :DatetimeOptions(sql_mode_for_timestamp(thd), default_round_mode(thd)) - { } - }; -public: - Timestamp(my_time_t timestamp, ulong sec_part) - :Timeval(timestamp, sec_part) - { } - explicit Timestamp(const timeval &tv) - :Timeval(tv) - { } - explicit Timestamp(const Native &native); - Timestamp(THD *thd, const MYSQL_TIME *ltime, uint *error_code); - const struct timeval &tv() const { return *this; } - int cmp(const Timestamp &other) const - { - return tv_sec < other.tv_sec ? -1 : - tv_sec > other.tv_sec ? +1 : - tv_usec < other.tv_usec ? -1 : - tv_usec > other.tv_usec ? +1 : 0; - } - bool to_TIME(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) const; - bool to_native(Native *to, uint decimals) const; - Datetime to_datetime(THD *thd) const - { - return Datetime(thd, *this); - } - long fraction_remainder(uint dec) const - { - return my_time_fraction_remainder(tv_usec, dec); - } - Timestamp &trunc(uint dec) - { - my_timeval_trunc(this, dec); - return *this; - } - Timestamp &round(uint dec, int *warn) - { - round_or_set_max(dec, warn); - return *this; - } - Timestamp &round(uint dec, time_round_mode_t mode, int *warn) - { - switch (mode.mode()) { - case time_round_mode_t::FRAC_NONE: - DBUG_ASSERT(fraction_remainder(dec) == 0); - return trunc(dec); - case time_round_mode_t::FRAC_TRUNCATE: - return trunc(dec); - case time_round_mode_t::FRAC_ROUND: - return round(dec, warn); - } - return *this; - } - Timestamp &round(uint dec, time_round_mode_t mode) - { - int warn= 0; - return round(dec, mode, &warn); - } -}; - - -/** - A helper class to store MariaDB TIMESTAMP values, which can be: - - real TIMESTAMP (seconds and microseconds since epoch), or - - zero datetime '0000-00-00 00:00:00.000000' -*/ -class Timestamp_or_zero_datetime: protected Timestamp -{ - bool m_is_zero_datetime; -public: - Timestamp_or_zero_datetime() - :Timestamp(0,0), m_is_zero_datetime(true) - { } - Timestamp_or_zero_datetime(const Native &native) - :Timestamp(native.length() ? Timestamp(native) : Timestamp(0,0)), - m_is_zero_datetime(native.length() == 0) - { } - Timestamp_or_zero_datetime(const Timestamp &tm, bool is_zero_datetime) - :Timestamp(tm), m_is_zero_datetime(is_zero_datetime) - { } - Timestamp_or_zero_datetime(THD *thd, const MYSQL_TIME *ltime, uint *err_code); - Datetime to_datetime(THD *thd) const - { - if (is_zero_datetime()) - return Datetime::zero(); - return Timestamp::to_datetime(thd); - } - bool is_zero_datetime() const { return m_is_zero_datetime; } - void trunc(uint decimals) - { - if (!is_zero_datetime()) - Timestamp::trunc(decimals); - } - int cmp(const Timestamp_or_zero_datetime &other) const - { - if (is_zero_datetime()) - return other.is_zero_datetime() ? 0 : -1; - if (other.is_zero_datetime()) - return 1; - return Timestamp::cmp(other); - } - bool to_TIME(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) const; - /* - Convert to native format: - - Real timestamps are encoded in the same way how Field_timestamp2 stores - values (big endian seconds followed by big endian microseconds) - - Zero datetime '0000-00-00 00:00:00.000000' is encoded as empty string. - Two native values are binary comparable. - */ - bool to_native(Native *to, uint decimals) const; -}; - - -/** - A helper class to store non-null MariaDB TIMESTAMP values in - the native binary encoded representation. -*/ -class Timestamp_or_zero_datetime_native: - public NativeBuffer -{ -public: - Timestamp_or_zero_datetime_native() { } - Timestamp_or_zero_datetime_native(const Timestamp_or_zero_datetime &ts, - uint decimals) - { - if (ts.to_native(this, decimals)) - length(0); // safety - } - int save_in_field(Field *field, uint decimals) const; - Datetime to_datetime(THD *thd) const - { - return is_zero_datetime() ? - Datetime::zero() : - Datetime(thd, Timestamp(*this).tv()); - } - bool is_zero_datetime() const - { - return length() == 0; - } -}; - - -/** - A helper class to store nullable MariaDB TIMESTAMP values in - the native binary encoded representation. -*/ -class Timestamp_or_zero_datetime_native_null: public Timestamp_or_zero_datetime_native, - public Null_flag -{ -public: - // With optional data type conversion - Timestamp_or_zero_datetime_native_null(THD *thd, Item *item, bool conv); - // Without data type conversion: item is known to be of the TIMESTAMP type - Timestamp_or_zero_datetime_native_null(THD *thd, Item *item) - :Timestamp_or_zero_datetime_native_null(thd, item, false) - { } - Datetime to_datetime(THD *thd) const - { - return is_null() ? Datetime() : - Timestamp_or_zero_datetime_native::to_datetime(thd); - } - void to_TIME(THD *thd, MYSQL_TIME *to) - { - DBUG_ASSERT(!is_null()); - Datetime::Options opt(TIME_CONV_NONE, TIME_FRAC_NONE); - Timestamp_or_zero_datetime(*this).to_TIME(thd, to, opt); - } - bool is_zero_datetime() const - { - DBUG_ASSERT(!is_null()); - return Timestamp_or_zero_datetime_native::is_zero_datetime(); - } -}; - - -/* - Flags for collation aggregation modes, used in TDCollation::agg(): - - MY_COLL_ALLOW_SUPERSET_CONV - allow conversion to a superset - MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value - (i.e. constant). - MY_COLL_ALLOW_CONV - allow any kind of conversion - (combination of the above two) - MY_COLL_ALLOW_NUMERIC_CONV - if all items were numbers, convert to - @@character_set_connection - MY_COLL_DISALLOW_NONE - don't allow return DERIVATION_NONE - (e.g. when aggregating for comparison) - MY_COLL_CMP_CONV - combination of MY_COLL_ALLOW_CONV - and MY_COLL_DISALLOW_NONE -*/ - -#define MY_COLL_ALLOW_SUPERSET_CONV 1 -#define MY_COLL_ALLOW_COERCIBLE_CONV 2 -#define MY_COLL_DISALLOW_NONE 4 -#define MY_COLL_ALLOW_NUMERIC_CONV 8 - -#define MY_COLL_ALLOW_CONV (MY_COLL_ALLOW_SUPERSET_CONV | MY_COLL_ALLOW_COERCIBLE_CONV) -#define MY_COLL_CMP_CONV (MY_COLL_ALLOW_CONV | MY_COLL_DISALLOW_NONE) - - -#define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII - - -static inline my_repertoire_t operator|(const my_repertoire_t a, - const my_repertoire_t b) -{ - return (my_repertoire_t) ((uint) a | (uint) b); -} - -static inline my_repertoire_t &operator|=(my_repertoire_t &a, - const my_repertoire_t b) -{ - return a= (my_repertoire_t) ((uint) a | (uint) b); -} - - -enum Derivation -{ - DERIVATION_IGNORABLE= 6, - DERIVATION_NUMERIC= 5, - DERIVATION_COERCIBLE= 4, - DERIVATION_SYSCONST= 3, - DERIVATION_IMPLICIT= 2, - DERIVATION_NONE= 1, - DERIVATION_EXPLICIT= 0 -}; - - -/** - "Declared Type Collation" - A combination of collation and its derivation. -*/ - -class DTCollation { -public: - CHARSET_INFO *collation; - enum Derivation derivation; - my_repertoire_t repertoire; - - void set_repertoire_from_charset(CHARSET_INFO *cs) - { - repertoire= cs->state & MY_CS_PUREASCII ? - MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30; - } - DTCollation() - { - collation= &my_charset_bin; - derivation= DERIVATION_NONE; - repertoire= MY_REPERTOIRE_UNICODE30; - } - DTCollation(CHARSET_INFO *collation_arg) - { - /* - This constructor version is used in combination with Field constructors, - to pass "CHARSET_INFO" instead of the full DTCollation. - Therefore, derivation is set to DERIVATION_IMPLICIT, which is the - proper derivation for table fields. - We should eventually remove all code pieces that pass "CHARSET_INFO" - (e.g. in storage engine sources) and fix to pass the full DTCollation - instead. Then, this constructor can be removed. - */ - collation= collation_arg; - derivation= DERIVATION_IMPLICIT; - repertoire= my_charset_repertoire(collation_arg); - } - DTCollation(CHARSET_INFO *collation_arg, Derivation derivation_arg) - { - collation= collation_arg; - derivation= derivation_arg; - set_repertoire_from_charset(collation_arg); - } - DTCollation(CHARSET_INFO *collation_arg, - Derivation derivation_arg, - my_repertoire_t repertoire_arg) - :collation(collation_arg), - derivation(derivation_arg), - repertoire(repertoire_arg) - { } - void set(const DTCollation &dt) - { - *this= dt; - } - void set(CHARSET_INFO *collation_arg, Derivation derivation_arg) - { - collation= collation_arg; - derivation= derivation_arg; - set_repertoire_from_charset(collation_arg); - } - void set(CHARSET_INFO *collation_arg, - Derivation derivation_arg, - my_repertoire_t repertoire_arg) - { - collation= collation_arg; - derivation= derivation_arg; - repertoire= repertoire_arg; - } - void set(CHARSET_INFO *collation_arg) - { - collation= collation_arg; - set_repertoire_from_charset(collation_arg); - } - void set(Derivation derivation_arg) - { derivation= derivation_arg; } - bool aggregate(const DTCollation &dt, uint flags= 0); - bool set(DTCollation &dt1, DTCollation &dt2, uint flags= 0) - { set(dt1); return aggregate(dt2, flags); } - const char *derivation_name() const - { - switch(derivation) - { - case DERIVATION_NUMERIC: return "NUMERIC"; - case DERIVATION_IGNORABLE: return "IGNORABLE"; - case DERIVATION_COERCIBLE: return "COERCIBLE"; - case DERIVATION_IMPLICIT: return "IMPLICIT"; - case DERIVATION_SYSCONST: return "SYSCONST"; - case DERIVATION_EXPLICIT: return "EXPLICIT"; - case DERIVATION_NONE: return "NONE"; - default: return "UNKNOWN"; - } - } - int sortcmp(const Binary_string *s, const Binary_string *t) const - { - return collation->strnncollsp(s->ptr(), s->length(), - t->ptr(), t->length()); - } -}; - - -class DTCollation_numeric: public DTCollation -{ -public: - DTCollation_numeric() - :DTCollation(charset_info(), DERIVATION_NUMERIC, MY_REPERTOIRE_NUMERIC) - { } - static const CHARSET_INFO *charset_info() { return &my_charset_numeric; } - static const DTCollation & singleton(); -}; - - -static inline uint32 -char_to_byte_length_safe(size_t char_length_arg, uint32 mbmaxlen_arg) -{ - ulonglong tmp= ((ulonglong) char_length_arg) * mbmaxlen_arg; - return tmp > UINT_MAX32 ? (uint32) UINT_MAX32 : static_cast(tmp); -} - - -class Type_numeric_attributes -{ -public: - static uint count_unsigned(Item **item, uint nitems); - static uint32 find_max_char_length(Item **item, uint nitems); - static uint32 find_max_octet_length(Item **item, uint nitems); - static int find_max_decimal_int_part(Item **item, uint nitems); - static uint find_max_decimals(Item **item, uint nitems); -public: - /* - The maximum value length in characters multiplied by collation->mbmaxlen. - Almost always it's the maximum value length in bytes. - */ - uint32 max_length; - uint decimals; - bool unsigned_flag; -public: - Type_numeric_attributes() - :max_length(0), decimals(0), unsigned_flag(false) - { } - Type_numeric_attributes(uint32 max_length_arg, uint decimals_arg, - bool unsigned_flag_arg) - :max_length(max_length_arg), - decimals(decimals_arg), - unsigned_flag(unsigned_flag_arg) - { } -protected: - void aggregate_numeric_attributes_real(Item **item, uint nitems); - void aggregate_numeric_attributes_decimal(Item **item, uint nitems, - bool unsigned_arg); -}; - - - -class Type_temporal_attributes: public Type_numeric_attributes -{ -public: - Type_temporal_attributes(uint int_part_length, uint dec, bool unsigned_arg) - :Type_numeric_attributes(int_part_length + (dec ? 1 : 0), - MY_MIN(dec, TIME_SECOND_PART_DIGITS), - unsigned_arg) - { - max_length+= decimals; - } -}; - - -class Type_temporal_attributes_not_fixed_dec: public Type_numeric_attributes -{ -public: - Type_temporal_attributes_not_fixed_dec(uint32 int_part_length, uint dec, - bool unsigned_flag) - :Type_numeric_attributes(int_part_length, dec, unsigned_flag) - { - if (decimals == NOT_FIXED_DEC) - max_length+= TIME_SECOND_PART_DIGITS + 1; - else if (decimals) - { - set_if_smaller(decimals, TIME_SECOND_PART_DIGITS); - max_length+= decimals + 1; - } - } -}; - - -/** - A class to store type attributes for the standard data types. - Does not include attributes for the extended data types - such as ENUM, SET, GEOMETRY. -*/ -class Type_std_attributes: public Type_numeric_attributes -{ -public: - DTCollation collation; - Type_std_attributes() - :collation(&my_charset_bin, DERIVATION_COERCIBLE) - { } - Type_std_attributes(const Type_numeric_attributes &nattr, - const DTCollation &dtc) - :Type_numeric_attributes(nattr), collation(dtc) - { } - void set(const Type_std_attributes *other) - { - *this= *other; - } - void set(const Type_std_attributes &other) - { - *this= other; - } - void set(const Type_numeric_attributes &nattr, const DTCollation &dtc) - { - *this= Type_std_attributes(nattr, dtc); - } - uint32 max_char_length() const - { return max_length / collation.collation->mbmaxlen; } - void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs) - { - max_length= char_to_byte_length_safe(max_char_length_arg, cs->mbmaxlen); - collation.collation= cs; - } - void fix_char_length(uint32 max_char_length_arg) - { - max_length= char_to_byte_length_safe(max_char_length_arg, - collation.collation->mbmaxlen); - } - void fix_attributes_temporal(uint32 int_part_length, uint dec) - { - *this= Type_std_attributes( - Type_temporal_attributes(int_part_length, dec, false), - DTCollation_numeric()); - } - void fix_attributes_date() - { - fix_attributes_temporal(MAX_DATE_WIDTH, 0); - } - void fix_attributes_time(uint dec) - { - fix_attributes_temporal(MIN_TIME_WIDTH, dec); - } - void fix_attributes_datetime(uint dec) - { - fix_attributes_temporal(MAX_DATETIME_WIDTH, dec); - } - - void aggregate_attributes_int(Item **items, uint nitems) - { - collation= DTCollation_numeric(); - fix_char_length(find_max_char_length(items, nitems)); - unsigned_flag= count_unsigned(items, nitems) > 0; - decimals= 0; - } - void aggregate_attributes_real(Item **items, uint nitems) - { - collation= DTCollation_numeric(); - aggregate_numeric_attributes_real(items, nitems); - } - void aggregate_attributes_decimal(Item **items, uint nitems, - bool unsigned_arg) - { - collation= DTCollation_numeric(); - aggregate_numeric_attributes_decimal(items, nitems, - (unsigned_flag= unsigned_arg)); - } - bool aggregate_attributes_string(const char *func_name, - Item **item, uint nitems); - void aggregate_attributes_temporal(uint int_part_length, - Item **item, uint nitems) - { - fix_attributes_temporal(int_part_length, find_max_decimals(item, nitems)); - } - - bool agg_item_collations(DTCollation &c, const char *name, - Item **items, uint nitems, - uint flags, int item_sep); - bool agg_item_set_converter(const DTCollation &coll, const char *fname, - Item **args, uint nargs, - uint flags, int item_sep); - - /* - Collect arguments' character sets together. - We allow to apply automatic character set conversion in some cases. - The conditions when conversion is possible are: - - arguments A and B have different charsets - - A wins according to coercibility rules - (i.e. a column is stronger than a string constant, - an explicit COLLATE clause is stronger than a column) - - character set of A is either superset for character set of B, - or B is a string constant which can be converted into the - character set of A without data loss. - - If all of the above is true, then it's possible to convert - B into the character set of A, and then compare according - to the collation of A. - - For functions with more than two arguments: - - collect(A,B,C) ::= collect(collect(A,B),C) - - Since this function calls THD::change_item_tree() on the passed Item ** - pointers, it is necessary to pass the original Item **'s, not copies. - Otherwise their values will not be properly restored (see BUG#20769). - If the items are not consecutive (eg. args[2] and args[5]), use the - item_sep argument, ie. - - agg_item_charsets(coll, fname, &args[2], 2, flags, 3) - */ - bool agg_arg_charsets(DTCollation &c, const char *func_name, - Item **items, uint nitems, - uint flags, int item_sep) - { - if (agg_item_collations(c, func_name, items, nitems, flags, item_sep)) - return true; - return agg_item_set_converter(c, func_name, items, nitems, flags, item_sep); - } - /* - Aggregate arguments for string result, e.g: CONCAT(a,b) - - convert to @@character_set_connection if all arguments are numbers - - allow DERIVATION_NONE - */ - bool agg_arg_charsets_for_string_result(DTCollation &c, const char *func_name, - Item **items, uint nitems, - int item_sep) - { - uint flags= MY_COLL_ALLOW_SUPERSET_CONV | - MY_COLL_ALLOW_COERCIBLE_CONV | - MY_COLL_ALLOW_NUMERIC_CONV; - return agg_arg_charsets(c, func_name, items, nitems, flags, item_sep); - } - /* - Aggregate arguments for string result, when some comparison - is involved internally, e.g: REPLACE(a,b,c) - - convert to @@character_set_connection if all arguments are numbers - - disallow DERIVATION_NONE - */ - bool agg_arg_charsets_for_string_result_with_comparison(DTCollation &c, - const char *func_name, - Item **items, - uint nitems, - int item_sep) - { - uint flags= MY_COLL_ALLOW_SUPERSET_CONV | - MY_COLL_ALLOW_COERCIBLE_CONV | - MY_COLL_ALLOW_NUMERIC_CONV | - MY_COLL_DISALLOW_NONE; - return agg_arg_charsets(c, func_name, items, nitems, flags, item_sep); - } - - /* - Aggregate arguments for comparison, e.g: a=b, a LIKE b, a RLIKE b - - don't convert to @@character_set_connection if all arguments are numbers - - don't allow DERIVATION_NONE - */ - bool agg_arg_charsets_for_comparison(DTCollation &c, - const char *func_name, - Item **items, uint nitems, - int item_sep) - { - uint flags= MY_COLL_ALLOW_SUPERSET_CONV | - MY_COLL_ALLOW_COERCIBLE_CONV | - MY_COLL_DISALLOW_NONE; - return agg_arg_charsets(c, func_name, items, nitems, flags, item_sep); - } - -}; - - -class Type_all_attributes: public Type_std_attributes -{ -public: - Type_all_attributes() - :Type_std_attributes() - { } - Type_all_attributes(const Type_all_attributes &other) - :Type_std_attributes(other) - { } - virtual ~Type_all_attributes() {} - virtual void set_maybe_null(bool maybe_null_arg)= 0; - // Returns total number of decimal digits - virtual uint decimal_precision() const= 0; - virtual const TYPELIB *get_typelib() const= 0; - virtual void set_typelib(const TYPELIB *typelib)= 0; -}; - - -class Type_cmp_attributes -{ -public: - virtual ~Type_cmp_attributes() { } - virtual CHARSET_INFO *compare_collation() const= 0; -}; - - -class Type_cast_attributes -{ - CHARSET_INFO *m_charset; - ulonglong m_length; - ulonglong m_decimals; - bool m_length_specified; - bool m_decimals_specified; -public: - Type_cast_attributes(const char *c_len, const char *c_dec, CHARSET_INFO *cs) - :m_charset(cs), m_length(0), m_decimals(0), - m_length_specified(false), m_decimals_specified(false) - { - set_length_and_dec(c_len, c_dec); - } - Type_cast_attributes(CHARSET_INFO *cs) - :m_charset(cs), m_length(0), m_decimals(0), - m_length_specified(false), m_decimals_specified(false) - { } - void set_length_and_dec(const char *c_len, const char *c_dec) - { - int error; - /* - We don't have to check for error here as sql_yacc.yy has guaranteed - that the values are in range of ulonglong - */ - if ((m_length_specified= (c_len != NULL))) - m_length= (ulonglong) my_strtoll10(c_len, NULL, &error); - if ((m_decimals_specified= (c_dec != NULL))) - m_decimals= (ulonglong) my_strtoll10(c_dec, NULL, &error); - } - CHARSET_INFO *charset() const { return m_charset; } - bool length_specified() const { return m_length_specified; } - bool decimals_specified() const { return m_decimals_specified; } - ulonglong length() const { return m_length; } - ulonglong decimals() const { return m_decimals; } -}; - - -class Name: private LEX_CSTRING -{ -public: - Name(const char *str_arg, uint length_arg) - { - DBUG_ASSERT(length_arg < UINT_MAX32); - LEX_CSTRING::str= str_arg; - LEX_CSTRING::length= length_arg; - } - Name(const LEX_CSTRING &lcs) - { - LEX_CSTRING::str= lcs.str; - LEX_CSTRING::length= lcs.length; - } - const char *ptr() const { return LEX_CSTRING::str; } - uint length() const { return (uint) LEX_CSTRING::length; } - const LEX_CSTRING &lex_cstring() const { return *this; } - bool eq(const LEX_CSTRING &other) const - { - return !system_charset_info->strnncoll(LEX_CSTRING::str, LEX_CSTRING::length, - other.str, other.length); - } -}; - - -class Bit_addr -{ - /** - Byte where the bit is stored inside a record. - If the corresponding Field is a NOT NULL field, this member is NULL. - */ - uchar *m_ptr; - /** - Offset of the bit inside m_ptr[0], in the range 0..7. - */ - uchar m_offs; -public: - Bit_addr() - :m_ptr(NULL), - m_offs(0) - { } - Bit_addr(uchar *ptr, uchar offs) - :m_ptr(ptr), m_offs(offs) - { - DBUG_ASSERT(ptr || offs == 0); - DBUG_ASSERT(offs < 8); - } - Bit_addr(bool maybe_null) - :m_ptr(maybe_null ? (uchar *) "" : NULL), - m_offs(0) - { } - uchar *ptr() const { return m_ptr; } - uchar offs() const { return m_offs; } - uchar bit() const { return static_cast(m_ptr ? 1U << m_offs : 0); } - void inc() - { - DBUG_ASSERT(m_ptr); - m_ptr+= (m_offs == 7); - m_offs= (m_offs + 1) & 7; - } -}; - - -class Record_addr -{ - uchar *m_ptr; // Position of the field in the record - Bit_addr m_null; // Position and offset of the null bit -public: - Record_addr(uchar *ptr_arg, - uchar *null_ptr_arg, - uchar null_bit_arg) - :m_ptr(ptr_arg), - m_null(null_ptr_arg, null_bit_arg) - { } - Record_addr(uchar *ptr, const Bit_addr &null) - :m_ptr(ptr), - m_null(null) - { } - Record_addr(bool maybe_null) - :m_ptr(NULL), - m_null(maybe_null) - { } - uchar *ptr() const { return m_ptr; } - const Bit_addr &null() const { return m_null; } - uchar *null_ptr() const { return m_null.ptr(); } - uchar null_bit() const { return m_null.bit(); } -}; - - -class Information_schema_numeric_attributes -{ - enum enum_attr - { - ATTR_NONE= 0, - ATTR_PRECISION= 1, - ATTR_SCALE= 2, - ATTR_PRECISION_AND_SCALE= (ATTR_PRECISION|ATTR_SCALE) - }; - uint m_precision; - uint m_scale; - enum_attr m_available_attributes; -public: - Information_schema_numeric_attributes() - :m_precision(0), m_scale(0), - m_available_attributes(ATTR_NONE) - { } - Information_schema_numeric_attributes(uint precision) - :m_precision(precision), m_scale(0), - m_available_attributes(ATTR_PRECISION) - { } - Information_schema_numeric_attributes(uint precision, uint scale) - :m_precision(precision), m_scale(scale), - m_available_attributes(ATTR_PRECISION_AND_SCALE) - { } - bool has_precision() const { return m_available_attributes & ATTR_PRECISION; } - bool has_scale() const { return m_available_attributes & ATTR_SCALE; } - uint precision() const - { - DBUG_ASSERT(has_precision()); - return (uint) m_precision; - } - uint scale() const - { - DBUG_ASSERT(has_scale()); - return (uint) m_scale; - } -}; - - -class Information_schema_character_attributes -{ - uint32 m_octet_length; - uint32 m_char_length; - bool m_is_set; -public: - Information_schema_character_attributes() - :m_octet_length(0), m_char_length(0), m_is_set(false) - { } - Information_schema_character_attributes(uint32 octet_length, - uint32 char_length) - :m_octet_length(octet_length), m_char_length(char_length), m_is_set(true) - { } - bool has_octet_length() const { return m_is_set; } - bool has_char_length() const { return m_is_set; } - uint32 octet_length() const - { - DBUG_ASSERT(has_octet_length()); - return m_octet_length; - } - uint char_length() const - { - DBUG_ASSERT(has_char_length()); - return m_char_length; - } -}; - - -enum vers_kind_t -{ - VERS_UNDEFINED= 0, - VERS_TIMESTAMP, - VERS_TRX_ID -}; - - -class Vers_type_handler -{ -protected: - Vers_type_handler() {} -public: - virtual ~Vers_type_handler() {} - virtual vers_kind_t kind() const - { - DBUG_ASSERT(0); - return VERS_UNDEFINED; - } - virtual bool check_sys_fields(const LEX_CSTRING &table_name, - const Column_definition *row_start, - const Column_definition *row_end) const= 0; -}; - - -class Vers_type_timestamp: public Vers_type_handler -{ -public: - virtual vers_kind_t kind() const - { - return VERS_TIMESTAMP; - } - bool check_sys_fields(const LEX_CSTRING &table_name, - const Column_definition *row_start, - const Column_definition *row_end) const; -}; -extern Vers_type_timestamp vers_type_timestamp; - - -class Vers_type_trx: public Vers_type_handler -{ -public: - virtual vers_kind_t kind() const - { - return VERS_TRX_ID; - } - bool check_sys_fields(const LEX_CSTRING &table_name, - const Column_definition *row_start, - const Column_definition *row_end) const; -}; -extern MYSQL_PLUGIN_IMPORT Vers_type_trx vers_type_trx; - - -class Type_handler -{ - Name m_name; -protected: - String *print_item_value_csstr(THD *thd, Item *item, String *str) const; - String *print_item_value_temporal(THD *thd, Item *item, String *str, - const Name &type_name, String *buf) const; - void make_sort_key_longlong(uchar *to, - bool maybe_null, bool null_value, - bool unsigned_flag, - longlong value) const; - void store_sort_key_longlong(uchar *to, bool unsigned_flag, - longlong value) const; - - uint make_packed_sort_key_longlong(uchar *to, bool maybe_null, - bool null_value, bool unsigned_flag, - longlong value, - const SORT_FIELD_ATTR *sort_field) const; - - bool Item_func_or_sum_illegal_param(const char *name) const; - bool Item_func_or_sum_illegal_param(const Item_func_or_sum *) const; - bool check_null(const Item *item, st_value *value) const; - bool Item_send_str(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_tiny(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_short(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_long(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_longlong(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_float(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_double(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_time(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_date(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_timestamp(Item *item, Protocol *protocol, st_value *buf) const; - bool Item_send_datetime(Item *item, Protocol *protocol, st_value *buf) const; - bool Column_definition_prepare_stage2_legacy(Column_definition *c, - enum_field_types type) - const; - bool Column_definition_prepare_stage2_legacy_num(Column_definition *c, - enum_field_types type) - const; - bool Column_definition_prepare_stage2_legacy_real(Column_definition *c, - enum_field_types type) - const; -public: - static const Type_handler *handler_by_name(THD *thd, const LEX_CSTRING &name); - static const Type_handler *handler_by_name_or_error(THD *thd, - const LEX_CSTRING &name); - static const Type_handler *odbc_literal_type_handler(const LEX_CSTRING *str); - static const Type_handler *blob_type_handler(uint max_octet_length); - static const Type_handler *string_type_handler(uint max_octet_length); - static const Type_handler *bit_and_int_mixture_handler(uint max_char_len); - static const Type_handler *type_handler_long_or_longlong(uint max_char_len, - bool unsigned_flag); - /** - Return a string type handler for Item - If too_big_for_varchar() returns a BLOB variant, according to length. - If max_length > 0 create a VARCHAR(n) - If max_length == 0 create a CHAR(0) - @param item - the Item to get the handler to. - */ - static const Type_handler *varstring_type_handler(const Item *item); - static const Type_handler *blob_type_handler(const Item *item); - static const Type_handler *get_handler_by_field_type(enum_field_types type); - static const Type_handler *get_handler_by_real_type(enum_field_types type); - static const Type_handler *get_handler_by_cmp_type(Item_result type); - static const Type_collection * - type_collection_for_aggregation(const Type_handler *h1, - const Type_handler *h2); - virtual const Type_collection *type_collection() const; - static const - Type_handler *aggregate_for_result_traditional(const Type_handler *h1, - const Type_handler *h2); - virtual Schema *schema() const; - static void partition_field_type_not_allowed(const LEX_CSTRING &field_name); - static bool partition_field_check_result_type(Item *item, - Item_result expected_type); - static const Name & version_mysql56(); - static const Name & version_mariadb53(); - - void set_name(Name n) { DBUG_ASSERT(!m_name.ptr()); m_name= n; } - const Name name() const { return m_name; } - virtual const Name version() const; - virtual const Name &default_value() const= 0; - virtual uint32 flags() const { return 0; } - virtual ulong KEY_pack_flags(uint column_nr) const { return 0; } - bool is_unsigned() const { return flags() & UNSIGNED_FLAG; } - virtual enum_field_types field_type() const= 0; - virtual enum_field_types real_field_type() const { return field_type(); } - /** - Type code which is used for merging of traditional data types for result - (for UNION and for hybrid functions such as COALESCE). - Mapping can be done both ways: old->new, new->old, depending - on the particular data type implementation: - - type_handler_var_string (MySQL-4.1 old VARCHAR) is converted to - new VARCHAR before merging. - field_type_merge_rules[][] returns new VARCHAR. - - type_handler_newdate is converted to old DATE before merging. - field_type_merge_rules[][] returns NEWDATE. - - Temporal type_handler_xxx2 (new MySQL-5.6 types) are converted to - corresponding old type codes before merging (e.g. TIME2->TIME). - field_type_merge_rules[][] returns old type codes (e.g. TIME). - Then old types codes are supposed to convert to new type codes somehow, - but they do not. So UNION and COALESCE create old columns. - This is a bug and should be fixed eventually. - */ - virtual enum_field_types traditional_merge_field_type() const - { - DBUG_ASSERT(is_traditional_scalar_type()); - return field_type(); - } - virtual enum_field_types type_code_for_protocol() const - { - return field_type(); - } - virtual protocol_send_type_t protocol_send_type() const= 0; - virtual bool Item_append_extended_type_info(Send_field_extended_metadata *to, - const Item *item) const - { - return false; - } - virtual Item_result result_type() const= 0; - virtual Item_result cmp_type() const= 0; - virtual enum_dynamic_column_type - dyncol_type(const Type_all_attributes *attr) const= 0; - virtual enum_mysql_timestamp_type mysql_timestamp_type() const - { - return MYSQL_TIMESTAMP_ERROR; - } - /* - Return true if the native format is fully implemented for a data type: - - Field_xxx::val_native() - - Item_xxx::val_native() for all classes supporting this data type - - Type_handler_xxx::cmp_native() - */ - virtual bool is_val_native_ready() const - { - return false; - } - /* - If operations such as: - UPDATE t1 SET binary_string_field=this_type_field; - should store this_type_field->val_native() rather than - this_type_field->val_str(). - */ - virtual bool convert_to_binary_using_val_native() const - { - return false; - } - virtual bool is_timestamp_type() const - { - return false; - } - virtual bool is_order_clause_position_type() const - { - return false; - } - virtual bool is_limit_clause_valid_type() const - { - return false; - } - /* - Returns true if this data type supports a hack that - WHERE notnull_column IS NULL - finds zero values, e.g.: - WHERE date_notnull_column IS NULL -> - WHERE date_notnull_column = '0000-00-00' - */ - virtual bool cond_notnull_field_isnull_to_field_eq_zero() const - { - return false; - } - /** - Check whether a field type can be partially indexed by a key. - @param type field type - @retval true Type can have a prefixed key - @retval false Type can not have a prefixed key - */ - virtual bool type_can_have_key_part() const - { - return false; - } - virtual bool type_can_have_auto_increment_attribute() const - { - return false; - } - virtual uint max_octet_length() const { return 0; } - /** - Prepared statement long data: - Check whether this parameter data type is compatible with long data. - Used to detect whether a long data stream has been supplied to a - incompatible data type. - */ - virtual bool is_param_long_data_type() const { return false; } - virtual const Type_handler *type_handler_for_comparison() const= 0; - virtual const Type_handler *type_handler_for_native_format() const - { - return this; - } - virtual const Type_handler *type_handler_for_item_field() const - { - return this; - } - virtual const Type_handler *type_handler_for_tmp_table(const Item *) const - { - return this; - } - virtual const Type_handler *type_handler_for_union(const Item *) const - { - return this; - } - virtual const Type_handler *cast_to_int_type_handler() const - { - return this; - } - virtual const Type_handler *type_handler_unsigned() const - { - return this; - } - virtual const Type_handler *type_handler_signed() const - { - return this; - } - virtual bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const - { - partition_field_type_not_allowed(field_name); - return true; - } - virtual bool partition_field_append_value(String *str, - Item *item_expr, - CHARSET_INFO *field_cs, - partition_value_print_mode_t mode) - const; - virtual int - stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const= 0; - virtual CHARSET_INFO *charset_for_protocol(const Item *item) const; - virtual const Type_handler* - type_handler_adjusted_to_max_octet_length(uint max_octet_length, - CHARSET_INFO *cs) const - { return this; } - virtual bool adjust_spparam_type(Spvar_definition *def, Item *from) const - { - return false; - } - Type_handler() : m_name(0,0) {} - virtual ~Type_handler() {} - /** - Determines MariaDB traditional scalar data types that always present - in the server. - */ - bool is_traditional_scalar_type() const; - virtual bool is_scalar_type() const { return true; } - virtual bool can_return_int() const { return true; } - virtual bool can_return_decimal() const { return true; } - virtual bool can_return_real() const { return true; } - virtual bool can_return_str() const { return true; } - virtual bool can_return_text() const { return true; } - virtual bool can_return_date() const { return true; } - virtual bool can_return_time() const { return true; } - virtual bool can_return_extract_source(interval_type type) const; - virtual bool is_bool_type() const { return false; } - virtual bool is_general_purpose_string_type() const { return false; } - virtual uint Item_time_precision(THD *thd, Item *item) const; - virtual uint Item_datetime_precision(THD *thd, Item *item) const; - virtual uint Item_decimal_scale(const Item *item) const; - virtual uint Item_decimal_precision(const Item *item) const= 0; - /* - Returns how many digits a divisor adds into a division result. - See Item::divisor_precision_increment() in item.h for more comments. - */ - virtual uint Item_divisor_precision_increment(const Item *) const; - /** - Makes a temporary table Field to handle numeric aggregate functions, - e.g. SUM(DISTINCT expr), AVG(DISTINCT expr), etc. - */ - virtual Field *make_num_distinct_aggregator_field(MEM_ROOT *, - const Item *) const; - /** - Makes a temporary table Field to handle RBR replication type conversion. - @param TABLE - The conversion table the field is going to be added to. - It's used to access to table->in_use->mem_root, - to create the new field on the table memory root, - as well as to increment statistics in table->share - (e.g. table->s->blob_count). - @param metadata - Metadata from the binary log. - @param target - The field in the target table on the slave. - - Note, the data types of "target" and of "this" are not necessarily - always the same, in general case it's possible that: - this->field_type() != target->field_type() - and/or - this->real_type( ) != target->real_type() - - This method decodes metadata according to this->real_type() - and creates a new field also according to this->real_type(). - - In some cases it lurks into "target", to get some extra information, e.g.: - - unsigned_flag for numeric fields - - charset() for string fields - - typelib and field_length for SET and ENUM - - geom_type and srid for GEOMETRY - This information is not available in the binary log, so - we assume that these fields are the same on the master and on the slave. - */ - virtual Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, - uint metadata, - const Field *target) const= 0; - virtual void show_binlog_type(const Conv_source &src, const Field &dst, - String *str) const; - virtual uint32 max_display_length_for_field(const Conv_source &src) const= 0; - /* - Performs the final data type validation for a UNION element, - after the regular "aggregation for result" was done. - */ - virtual bool union_element_finalize(const Item * item) const - { - return false; - } - virtual uint Column_definition_gis_options_image(uchar *buff, - const Column_definition &def) - const - { - return 0; - } - virtual bool Column_definition_data_type_info_image(Binary_string *to, - const Column_definition &def) - const; - // Check if the implicit default value is Ok in the current sql_mode - virtual bool validate_implicit_default_value(THD *thd, - const Column_definition &def) - const; - // Automatic upgrade, e.g. for ALTER TABLE t1 FORCE - virtual void Column_definition_implicit_upgrade(Column_definition *c) const - { } - // Validate CHECK constraint after the parser - virtual bool Column_definition_validate_check_constraint(THD *thd, - Column_definition *c) - const; - // Set attributes in the parser - virtual bool Column_definition_set_attributes(THD *thd, - Column_definition *def, - const Lex_field_type_st &attr, - CHARSET_INFO *cs, - column_definition_type_t type) - const; - // Fix attributes after the parser - virtual bool Column_definition_fix_attributes(Column_definition *c) const= 0; - /* - Fix attributes from an existing field. Used for: - - ALTER TABLE (for columns that do not change) - - DECLARE var TYPE OF t1.col1; (anchored SP variables) - */ - virtual void Column_definition_reuse_fix_attributes(THD *thd, - Column_definition *c, - const Field *field) const - { } - virtual bool Column_definition_prepare_stage1(THD *thd, - MEM_ROOT *mem_root, - Column_definition *c, - handler *file, - ulonglong table_flags) const; - /* - This method is called on queries like: - CREATE TABLE t2 (a INT) AS SELECT a FROM t1; - I.e. column "a" is queried from another table, - but its data type is redefined. - @param OUT def - The column definition to be redefined - @param IN dup - The column definition to take the data type from - (i.e. "a INT" in the above example). - @param IN file - Table owner handler. If it does not support certain - data types, some conversion can be applied. - I.g. true BIT to BIT-AS-CHAR. - @param IN schema - the owner schema definition, e.g. for the default - character set and collation. - @retval true - on error - @retval false - on success - */ - virtual bool Column_definition_redefine_stage1(Column_definition *def, - const Column_definition *dup, - const handler *file, - const Schema_specification_st * - schema) - const; - virtual bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const= 0; - virtual bool Key_part_spec_init_primary(Key_part_spec *part, - const Column_definition &def, - const handler *file) const; - virtual bool Key_part_spec_init_unique(Key_part_spec *part, - const Column_definition &def, - const handler *file, - bool *has_key_needed) const; - virtual bool Key_part_spec_init_multiple(Key_part_spec *part, - const Column_definition &def, - const handler *file) const; - virtual bool Key_part_spec_init_foreign(Key_part_spec *part, - const Column_definition &def, - const handler *file) const; - virtual bool Key_part_spec_init_spatial(Key_part_spec *part, - const Column_definition &def) const; - virtual bool Key_part_spec_init_ft(Key_part_spec *part, - const Column_definition &def) const - { - return true; // Error - } - virtual Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const= 0; - Field *make_and_init_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE *table) const; - virtual Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const - { - DBUG_ASSERT(0); - return NULL; - } - virtual Field * - make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const= 0; - virtual void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const; - virtual const Type_handler *type_handler_frm_unpack(const uchar *buffer) const - { - return this; - } - virtual bool - Column_definition_attributes_frm_unpack(Column_definition_attributes *attr, - TABLE_SHARE *share, - const uchar *buffer, - LEX_CUSTRING *gis_options) const; - - /* - Create a fixed size key part for a sort key - */ - virtual void make_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const= 0; - - /* - create a compact size key part for a sort key - */ - virtual uint make_packed_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const=0; - - virtual void sort_length(THD *thd, - const Type_std_attributes *item, - SORT_FIELD_ATTR *attr) const= 0; - virtual bool is_packable() const { return false; } - - virtual uint32 max_display_length(const Item *item) const= 0; - virtual uint32 Item_decimal_notation_int_digits(const Item *item) const { return 0; } - virtual uint32 calc_pack_length(uint32 length) const= 0; - virtual uint calc_key_length(const Column_definition &def) const; - virtual void Item_update_null_value(Item *item) const= 0; - virtual bool Item_save_in_value(THD *thd, Item *item, st_value *value) const= 0; - virtual void Item_param_setup_conversion(THD *thd, Item_param *) const {} - virtual void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const; - virtual bool Item_param_set_from_value(THD *thd, - Item_param *param, - const Type_all_attributes *attr, - const st_value *value) const= 0; - virtual bool Item_param_val_native(THD *thd, - Item_param *item, - Native *to) const; - virtual bool Item_send(Item *item, Protocol *p, st_value *buf) const= 0; - virtual int Item_save_in_field(Item *item, Field *field, - bool no_conversions) const= 0; - - /** - Return a string representation of the Item value. - - @param thd thread handle - @param str string buffer for representation of the value - - @note - If the item has a string result type, the string is escaped - according to its character set. - - @retval - NULL on error - @retval - non-NULL a pointer to a a valid string on success - */ - virtual String *print_item_value(THD *thd, Item *item, String *str) const= 0; - - /** - Check if - WHERE expr=value AND expr=const - can be rewritten as: - WHERE const=value AND expr=const - - "this" is the comparison handler that is used by "target". - - @param target - the predicate expr=value, - whose "expr" argument will be replaced to "const". - @param target_expr - the target's "expr" which will be replaced to "const". - @param target_value - the target's second argument, it will remain unchanged. - @param source - the equality predicate expr=const (or expr<=>const) - that can be used to rewrite the "target" part - (under certain conditions, see the code). - @param source_expr - the source's "expr". It should be exactly equal to - the target's "expr" to make condition rewrite possible. - @param source_const - the source's "const" argument, it will be inserted - into "target" instead of "expr". - */ - virtual bool - can_change_cond_ref_to_const(Item_bool_func2 *target, - Item *target_expr, Item *target_value, - Item_bool_func2 *source, - Item *source_expr, Item *source_const) const= 0; - virtual bool - subquery_type_allows_materialization(const Item *inner, - const Item *outer) const= 0; - /** - Make a simple constant replacement item for a constant "src", - so the new item can futher be used for comparison with "cmp", e.g.: - src = cmp -> replacement = cmp - - "this" is the type handler that is used to compare "src" and "cmp". - - @param thd - current thread, for mem_root - @param src - The item that we want to replace. It's a const item, - but it can be complex enough to calculate on every row. - @param cmp - The src's comparand. - @retval - a pointer to the created replacement Item - @retval - NULL, if could not create a replacement (e.g. on EOM). - NULL is also returned for ROWs, because instead of replacing - a Item_row to a new Item_row, Type_handler_row just replaces - its elements. - */ - virtual Item *make_const_item_for_comparison(THD *thd, - Item *src, - const Item *cmp) const= 0; - virtual Item_cache *Item_get_cache(THD *thd, const Item *item) const= 0; - virtual Item *make_constructor_item(THD *thd, List *args) const - { - return NULL; - } - /** - A builder for literals with data type name prefix, e.g.: - TIME'00:00:00', DATE'2001-01-01', TIMESTAMP'2001-01-01 00:00:00'. - @param thd The current thread - @param str Character literal - @param length Length of str - @param cs Character set of the string - @param send_error Whether to generate an error on failure - - @retval A pointer to a new Item on success - NULL on error (wrong literal value, EOM) - */ - virtual Item_literal *create_literal_item(THD *thd, - const char *str, size_t length, - CHARSET_INFO *cs, - bool send_error) const - { - DBUG_ASSERT(0); - return NULL; - } - Item_literal *create_literal_item(THD *thd, const String *str, - bool send_error) const - { - return create_literal_item(thd, str->ptr(), str->length(), str->charset(), - send_error); - } - virtual Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) const - { - return NULL; - } - virtual Item_copy *create_item_copy(THD *thd, Item *item) const; - virtual int cmp_native(const Native &a, const Native &b) const - { - DBUG_ASSERT(0); - return 0; - } - virtual bool set_comparator_func(Arg_comparator *cmp) const= 0; - virtual bool Item_const_eq(const Item_const *a, const Item_const *b, - bool binary_cmp) const - { - return false; - } - virtual bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, - Item *a, Item *b) const= 0; - virtual bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, - uint nitems) const= 0; - virtual bool Item_func_min_max_fix_attributes(THD *thd, - Item_func_min_max *func, - Item **items, - uint nitems) const; - virtual bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const= 0; - virtual bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const= 0; - virtual bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const= 0; - virtual - bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const= 0; - - virtual bool Item_val_native_with_conversion(THD *thd, Item *item, - Native *to) const - { - return true; - } - virtual bool Item_val_native_with_conversion_result(THD *thd, Item *item, - Native *to) const - { - return true; - } - - virtual bool Item_val_bool(Item *item) const= 0; - virtual void Item_get_date(THD *thd, Item *item, - Temporal::Warn *buff, MYSQL_TIME *ltime, - date_mode_t fuzzydate) const= 0; - bool Item_get_date_with_warn(THD *thd, Item *item, MYSQL_TIME *ltime, - date_mode_t fuzzydate) const; - virtual longlong Item_val_int_signed_typecast(Item *item) const= 0; - virtual longlong Item_val_int_unsigned_typecast(Item *item) const= 0; - - virtual String *Item_func_hex_val_str_ascii(Item_func_hex *item, - String *str) const= 0; - - virtual - String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, - String *) const= 0; - virtual - double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) - const= 0; - virtual - longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) - const= 0; - virtual - my_decimal *Item_func_hybrid_field_type_val_decimal( - Item_func_hybrid_field_type *, - my_decimal *) const= 0; - virtual - void Item_func_hybrid_field_type_get_date(THD *, - Item_func_hybrid_field_type *, - Temporal::Warn *, - MYSQL_TIME *, - date_mode_t fuzzydate) const= 0; - bool Item_func_hybrid_field_type_get_date_with_warn(THD *thd, - Item_func_hybrid_field_type *, - MYSQL_TIME *, - date_mode_t) const; - virtual - String *Item_func_min_max_val_str(Item_func_min_max *, String *) const= 0; - virtual - double Item_func_min_max_val_real(Item_func_min_max *) const= 0; - virtual - longlong Item_func_min_max_val_int(Item_func_min_max *) const= 0; - virtual - my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, - my_decimal *) const= 0; - virtual - bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, - MYSQL_TIME *, date_mode_t fuzzydate) const= 0; - virtual bool - Item_func_between_fix_length_and_dec(Item_func_between *func) const= 0; - virtual longlong - Item_func_between_val_int(Item_func_between *func) const= 0; - - virtual cmp_item * - make_cmp_item(THD *thd, CHARSET_INFO *cs) const= 0; - - virtual in_vector * - make_in_vector(THD *thd, const Item_func_in *func, uint nargs) const= 0; - - virtual bool - Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *) - const= 0; - - virtual bool - Item_func_round_fix_length_and_dec(Item_func_round *round) const= 0; - - virtual bool - Item_func_int_val_fix_length_and_dec(Item_func_int_val *func) const= 0; - - virtual bool - Item_func_abs_fix_length_and_dec(Item_func_abs *func) const= 0; - - virtual bool - Item_func_neg_fix_length_and_dec(Item_func_neg *func) const= 0; - - virtual bool - Item_func_signed_fix_length_and_dec(Item_func_signed *item) const; - virtual bool - Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const; - virtual bool - Item_double_typecast_fix_length_and_dec(Item_double_typecast *item) const; - virtual bool - Item_float_typecast_fix_length_and_dec(Item_float_typecast *item) const; - virtual bool - Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *item) const; - virtual bool - Item_char_typecast_fix_length_and_dec(Item_char_typecast *item) const; - virtual bool - Item_time_typecast_fix_length_and_dec(Item_time_typecast *item) const; - virtual bool - Item_date_typecast_fix_length_and_dec(Item_date_typecast *item) const; - virtual bool - Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *item) const; - - virtual bool - Item_func_plus_fix_length_and_dec(Item_func_plus *func) const= 0; - virtual bool - Item_func_minus_fix_length_and_dec(Item_func_minus *func) const= 0; - virtual bool - Item_func_mul_fix_length_and_dec(Item_func_mul *func) const= 0; - virtual bool - Item_func_div_fix_length_and_dec(Item_func_div *func) const= 0; - virtual bool - Item_func_mod_fix_length_and_dec(Item_func_mod *func) const= 0; - - virtual const Vers_type_handler *vers() const { return NULL; } -}; - - -/* - Special handler for ROW -*/ -class Type_handler_row: public Type_handler -{ -public: - virtual ~Type_handler_row() {} - const Name &default_value() const override; - bool validate_implicit_default_value(THD *thd, - const Column_definition &def) const - override - { - DBUG_ASSERT(0); - return true; - } - const Type_collection *type_collection() const override; - bool is_scalar_type() const override { return false; } - bool can_return_int() const override { return false; } - bool can_return_decimal() const override { return false; } - bool can_return_real() const override { return false; } - bool can_return_str() const override { return false; } - bool can_return_text() const override { return false; } - bool can_return_date() const override { return false; } - bool can_return_time() const override { return false; } - enum_field_types field_type() const override - { - DBUG_ASSERT(0); - return MYSQL_TYPE_NULL; - }; - protocol_send_type_t protocol_send_type() const override - { - DBUG_ASSERT(0); - return PROTOCOL_SEND_STRING; - } - Item_result result_type() const override - { - return ROW_RESULT; - } - Item_result cmp_type() const override - { - return ROW_RESULT; - } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) - const override - { - DBUG_ASSERT(0); - return DYN_COL_NULL; - } - const Type_handler *type_handler_for_comparison() const override; - int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override - { - DBUG_ASSERT(0); - return 0; - } - bool subquery_type_allows_materialization(const Item *inner, - const Item *outer) const override - { - DBUG_ASSERT(0); - return false; - } - Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const override - { - DBUG_ASSERT(0); - return NULL; - } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, - uint metadata, - const Field *target) const override - { - DBUG_ASSERT(0); - return NULL; - } - bool Column_definition_fix_attributes(Column_definition *c) const override - { - return false; - } - void Column_definition_reuse_fix_attributes(THD *thd, - Column_definition *c, - const Field *field) - const override - { - DBUG_ASSERT(0); - } - bool Column_definition_prepare_stage1(THD *thd, - MEM_ROOT *mem_root, - Column_definition *c, - handler *file, - ulonglong table_flags) const override; - bool Column_definition_redefine_stage1(Column_definition *def, - const Column_definition *dup, - const handler *file, - const Schema_specification_st *schema) - const override - { - DBUG_ASSERT(0); - return true; - } - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { - return false; - } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override - { - DBUG_ASSERT(0); - return NULL; - } - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - void make_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override - { - DBUG_ASSERT(0); - } - uint make_packed_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override - { - DBUG_ASSERT(0); - return 0; - } - void sort_length(THD *thd, const Type_std_attributes *item, - SORT_FIELD_ATTR *attr) const override - { - DBUG_ASSERT(0); - } - uint32 max_display_length(const Item *item) const override - { - DBUG_ASSERT(0); - return 0; - } - uint32 max_display_length_for_field(const Conv_source &src) const override - { - DBUG_ASSERT(0); - return 0; - } - uint32 calc_pack_length(uint32 length) const override - { - DBUG_ASSERT(0); - return 0; - } - bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, - Item *a, Item *b) const override; - uint Item_decimal_precision(const Item *item) const override - { - DBUG_ASSERT(0); - return DECIMAL_MAX_PRECISION; - } - bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override; - bool Item_param_set_from_value(THD *thd, - Item_param *param, - const Type_all_attributes *attr, - const st_value *value) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - DBUG_ASSERT(0); - return true; - } - void Item_update_null_value(Item *item) const override; - int Item_save_in_field(Item *item, Field *field, bool no_conversions) - const override - { - DBUG_ASSERT(0); - return 1; - } - String *print_item_value(THD *thd, Item *item, String *str) const override; - bool can_change_cond_ref_to_const(Item_bool_func2 *target, - Item *target_expr, Item *target_value, - Item_bool_func2 *source, - Item *source_expr, Item *source_const) - const override - { - DBUG_ASSERT(0); - return false; - } - Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) - const override; - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - Item_copy *create_item_copy(THD *thd, Item *item) const override - { - DBUG_ASSERT(0); - return NULL; - } - bool set_comparator_func(Arg_comparator *cmp) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) - const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_val_bool(Item *item) const override - { - DBUG_ASSERT(0); - return false; - } - void Item_get_date(THD *thd, Item *item, - Temporal::Warn *warn, MYSQL_TIME *ltime, - date_mode_t fuzzydate) const override - { - DBUG_ASSERT(0); - set_zero_time(ltime, MYSQL_TIMESTAMP_NONE); - } - longlong Item_val_int_signed_typecast(Item *item) const override - { - DBUG_ASSERT(0); - return 0; - } - longlong Item_val_int_unsigned_typecast(Item *item) const override - { - DBUG_ASSERT(0); - return 0; - } - String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) - const override - { - DBUG_ASSERT(0); - return NULL; - } - String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, - String *) const override - { - DBUG_ASSERT(0); - return NULL; - } - double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) - const override - { - DBUG_ASSERT(0); - return 0.0; - } - longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) - const override - { - DBUG_ASSERT(0); - return 0; - } - my_decimal *Item_func_hybrid_field_type_val_decimal( - Item_func_hybrid_field_type *, - my_decimal *) const override - { - DBUG_ASSERT(0); - return NULL; - } - void Item_func_hybrid_field_type_get_date(THD *, - Item_func_hybrid_field_type *, - Temporal::Warn *, - MYSQL_TIME *ltime, - date_mode_t fuzzydate) - const override - { - DBUG_ASSERT(0); - set_zero_time(ltime, MYSQL_TIMESTAMP_NONE); - } - - String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override - { - DBUG_ASSERT(0); - return NULL; - } - double Item_func_min_max_val_real(Item_func_min_max *) const override - { - DBUG_ASSERT(0); - return 0; - } - longlong Item_func_min_max_val_int(Item_func_min_max *) const override - { - DBUG_ASSERT(0); - return 0; - } - my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, - my_decimal *) const override - { - DBUG_ASSERT(0); - return NULL; - } - bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, - MYSQL_TIME *, date_mode_t fuzzydate) - const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_func_between_fix_length_and_dec(Item_func_between *func) - const override - { - DBUG_ASSERT(0); - return true; - } - longlong Item_func_between_val_int(Item_func_between *func) const override; - cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; - in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) - const override; - bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *) - const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override; - bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override; - bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override; - - bool Item_func_signed_fix_length_and_dec(Item_func_signed *) const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *) - const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *) - const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *) - const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) - const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *) - const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *) - const override - { - DBUG_ASSERT(0); - return true; - } - bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *) - const override - { - DBUG_ASSERT(0); - return true; - } - - bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override; - bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override; - bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override; - bool Item_func_div_fix_length_and_dec(Item_func_div *) const override; - bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override; -}; - - -/* - A common parent class for numeric data type handlers -*/ -class Type_handler_numeric: public Type_handler -{ -public: - const Name &default_value() const override; - String *print_item_value(THD *thd, Item *item, String *str) const override; - double Item_func_min_max_val_real(Item_func_min_max *) const override; - longlong Item_func_min_max_val_int(Item_func_min_max *) const override; - my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, - my_decimal *) const override; - bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, - MYSQL_TIME *, date_mode_t fuzzydate) - const override; - virtual ~Type_handler_numeric() { } - bool can_change_cond_ref_to_const(Item_bool_func2 *target, - Item *target_expr, Item *target_value, - Item_bool_func2 *source, - Item *source_expr, Item *source_const) - const override; - bool Item_func_between_fix_length_and_dec(Item_func_between *func) const override; - bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const override; -}; - - -/*** Abstract classes for every XXX_RESULT */ - -class Type_handler_real_result: public Type_handler_numeric -{ -public: - Item_result result_type() const override{ return REAL_RESULT; } - Item_result cmp_type() const override { return REAL_RESULT; } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) - const override - { - return DYN_COL_DOUBLE; - } - virtual ~Type_handler_real_result() {} - const Type_handler *type_handler_for_comparison() const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - void Column_definition_reuse_fix_attributes(THD *thd, - Column_definition *c, - const Field *field) - const override; - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - bool - Column_definition_attributes_frm_unpack(Column_definition_attributes *attr, - TABLE_SHARE *share, - const uchar *buffer, - LEX_CUSTRING *gis_options) - const override; - int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) - const override; - bool subquery_type_allows_materialization(const Item *inner, - const Item *outer) - const override; - void make_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - uint make_packed_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - void sort_length(THD *thd, - const Type_std_attributes *item, - SORT_FIELD_ATTR *attr) const override; - bool Item_const_eq(const Item_const *a, const Item_const *b, - bool binary_cmp) const override; - bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, - Item *a, Item *b) const override; - uint Item_decimal_precision(const Item *item) const override; - bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override; - bool Item_param_set_from_value(THD *thd, - Item_param *param, - const Type_all_attributes *attr, - const st_value *value) const override; - void Item_update_null_value(Item *item) const override; - int Item_save_in_field(Item *item, Field *field, bool no_conversions) - const override; - Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) - const override; - bool set_comparator_func(Arg_comparator *cmp) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) - const override; - bool Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func, - Item **items, uint nitems) - const override; - bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override; - bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override; - bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override; - bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override; - bool Item_func_signed_fix_length_and_dec(Item_func_signed *item) - const override; - bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) - const override; - bool Item_val_bool(Item *item) const override; - void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn, - MYSQL_TIME *ltime, date_mode_t fuzzydate) const override; - longlong Item_val_int_signed_typecast(Item *item) const override; - longlong Item_val_int_unsigned_typecast(Item *item) const override; - String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) - const override; - double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) - const override; - longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) - const override; - my_decimal *Item_func_hybrid_field_type_val_decimal( - Item_func_hybrid_field_type *, - my_decimal *) const override; - void Item_func_hybrid_field_type_get_date(THD *, - Item_func_hybrid_field_type *, - Temporal::Warn *, - MYSQL_TIME *, - date_mode_t fuzzydate) - const override; - longlong Item_func_between_val_int(Item_func_between *func) const override; - cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; - in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) - const override; - bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *) - const override; - - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override; - bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override; - bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override; - bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override; - bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override; - bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override; - bool Item_func_div_fix_length_and_dec(Item_func_div *) const override; - bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override; -}; - - -class Type_handler_decimal_result: public Type_handler_numeric -{ -public: - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_STRING; - } - Item_result result_type() const override { return DECIMAL_RESULT; } - Item_result cmp_type() const override { return DECIMAL_RESULT; } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *) const - override - { - return DYN_COL_DECIMAL; - } - virtual ~Type_handler_decimal_result() {}; - const Type_handler *type_handler_for_comparison() const override; - int stored_field_cmp_to_item(THD *, Field *field, Item *item) const override - { - VDec item_val(item); - return item_val.is_null() ? 0 : my_decimal(field).cmp(item_val.ptr()); - } - bool subquery_type_allows_materialization(const Item *inner, - const Item *outer) const override; - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) - const override; - void make_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - uint make_packed_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - bool - Column_definition_attributes_frm_unpack(Column_definition_attributes *attr, - TABLE_SHARE *share, - const uchar *buffer, - LEX_CUSTRING *gis_options) - const override; - void sort_length(THD *thd, - const Type_std_attributes *item, - SORT_FIELD_ATTR *attr) const override; - uint32 max_display_length(const Item *item) const override; - uint32 Item_decimal_notation_int_digits(const Item *item) const override; - Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) const override; - bool Item_const_eq(const Item_const *a, const Item_const *b, - bool binary_cmp) const override; - bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, - Item *a, Item *b) const override - { - VDec va(a), vb(b); - return va.ptr() && vb.ptr() && !va.cmp(vb); - } - uint Item_decimal_precision(const Item *item) const override; - bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; - bool Item_param_set_from_value(THD *thd, - Item_param *param, - const Type_all_attributes *attr, - const st_value *value) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_str(item, protocol, buf); - } - void Item_update_null_value(Item *item) const override; - int Item_save_in_field(Item *item, Field *field, bool no_conversions) const - override; - Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const - override; - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - bool set_comparator_func(Arg_comparator *cmp) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) - const override; - bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const override; - bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override; - bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override; - bool Item_sum_variance_fix_length_and_dec(Item_sum_variance*) const override; - bool Item_val_bool(Item *item) const override - { - return VDec(item).to_bool(); - } - void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn, - MYSQL_TIME *ltime, date_mode_t fuzzydate) const override; - longlong Item_val_int_signed_typecast(Item *item) const override; - longlong Item_val_int_unsigned_typecast(Item *item) const override - { - return VDec(item).to_longlong(true); - } - String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) - const override; - String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, - String *) const override; - double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) - const override; - longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) - const override; - my_decimal *Item_func_hybrid_field_type_val_decimal( - Item_func_hybrid_field_type *, - my_decimal *) const override; - void Item_func_hybrid_field_type_get_date(THD *, - Item_func_hybrid_field_type *, - Temporal::Warn *, - MYSQL_TIME *, - date_mode_t fuzzydate) - const override; - String *Item_func_min_max_val_str(Item_func_min_max *, String *) - const override; - longlong Item_func_between_val_int(Item_func_between *func) const override; - cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; - in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) - const override; - bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *) - const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; - bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override; - bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override; - bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override; - bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override; - bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override; - bool Item_func_div_fix_length_and_dec(Item_func_div *) const override; - bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override; -}; - - -class Type_limits_int -{ -private: - uint32 m_precision; - uint32 m_char_length; -public: - Type_limits_int(uint32 prec, uint32 nchars) - :m_precision(prec), m_char_length(nchars) - { } - uint32 precision() const { return m_precision; } - uint32 char_length() const { return m_char_length; } -}; - - -/* - UNDIGNED TINYINT: 0..255 digits=3 nchars=3 - SIGNED TINYINT : -128..127 digits=3 nchars=4 -*/ -class Type_limits_uint8: public Type_limits_int -{ -public: - Type_limits_uint8() - :Type_limits_int(MAX_TINYINT_WIDTH, MAX_TINYINT_WIDTH) - { } -}; - - -class Type_limits_sint8: public Type_limits_int -{ -public: - Type_limits_sint8() - :Type_limits_int(MAX_TINYINT_WIDTH, MAX_TINYINT_WIDTH + 1) - { } -}; - - -/* - UNDIGNED SMALLINT: 0..65535 digits=5 nchars=5 - SIGNED SMALLINT: -32768..32767 digits=5 nchars=6 -*/ -class Type_limits_uint16: public Type_limits_int -{ -public: - Type_limits_uint16() - :Type_limits_int(MAX_SMALLINT_WIDTH, MAX_SMALLINT_WIDTH) - { } -}; - - -class Type_limits_sint16: public Type_limits_int -{ -public: - Type_limits_sint16() - :Type_limits_int(MAX_SMALLINT_WIDTH, MAX_SMALLINT_WIDTH + 1) - { } -}; - - -/* - MEDIUMINT UNSIGNED 0 .. 16777215 digits=8 char_length=8 - MEDIUMINT SIGNED: -8388608 .. 8388607 digits=7 char_length=8 -*/ -class Type_limits_uint24: public Type_limits_int -{ -public: - Type_limits_uint24() - :Type_limits_int(MAX_MEDIUMINT_WIDTH, MAX_MEDIUMINT_WIDTH) - { } -}; - - -class Type_limits_sint24: public Type_limits_int -{ -public: - Type_limits_sint24() - :Type_limits_int(MAX_MEDIUMINT_WIDTH - 1, MAX_MEDIUMINT_WIDTH) - { } -}; - - -/* - UNSIGNED INT: 0..4294967295 digits=10 nchars=10 - SIGNED INT: -2147483648..2147483647 digits=10 nchars=11 -*/ -class Type_limits_uint32: public Type_limits_int -{ -public: - Type_limits_uint32() - :Type_limits_int(MAX_INT_WIDTH, MAX_INT_WIDTH) - { } -}; - - - -class Type_limits_sint32: public Type_limits_int -{ -public: - Type_limits_sint32() - :Type_limits_int(MAX_INT_WIDTH, MAX_INT_WIDTH + 1) - { } -}; - - -/* - UNSIGNED BIGINT: 0..18446744073709551615 digits=20 nchars=20 - SIGNED BIGINT: -9223372036854775808..9223372036854775807 digits=19 nchars=20 -*/ -class Type_limits_uint64: public Type_limits_int -{ -public: - Type_limits_uint64(): Type_limits_int(MAX_BIGINT_WIDTH, MAX_BIGINT_WIDTH) - { } -}; - - -class Type_limits_sint64: public Type_limits_int -{ -public: - Type_limits_sint64() - :Type_limits_int(MAX_BIGINT_WIDTH - 1, MAX_BIGINT_WIDTH) - { } -}; - - - -class Type_handler_int_result: public Type_handler_numeric -{ -public: - Item_result result_type() const override { return INT_RESULT; } - Item_result cmp_type() const override { return INT_RESULT; } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) const override - { - return attr->unsigned_flag ? DYN_COL_UINT : DYN_COL_INT; - } - bool is_order_clause_position_type() const override { return true; } - bool is_limit_clause_valid_type() const override { return true; } - virtual ~Type_handler_int_result() {} - const Type_handler *type_handler_for_comparison() const override; - int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override; - bool subquery_type_allows_materialization(const Item *inner, - const Item *outer) const override; - Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - void make_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - uint make_packed_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - void sort_length(THD *thd, - const Type_std_attributes *item, - SORT_FIELD_ATTR *attr) const override; - bool Item_const_eq(const Item_const *a, const Item_const *b, - bool binary_cmp) const override; - bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, - Item *a, Item *b) const override; - uint Item_decimal_precision(const Item *item) const override; - bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override; - bool Item_param_set_from_value(THD *thd, - Item_param *param, - const Type_all_attributes *attr, - const st_value *value) const override; - void Item_update_null_value(Item *item) const override; - int Item_save_in_field(Item *item, Field *field, bool no_conversions) const override; - Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const override; - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - bool set_comparator_func(Arg_comparator *cmp) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) const override; - bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override; - bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override; - bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override; - bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override; - bool Item_val_bool(Item *item) const override; - void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn, - MYSQL_TIME *ltime, date_mode_t fuzzydate) const override; - longlong Item_val_int_signed_typecast(Item *item) const override; - longlong Item_val_int_unsigned_typecast(Item *item) const override; - String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const override; - String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, - String *) const override; - double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) - const override; - longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) - const override; - my_decimal *Item_func_hybrid_field_type_val_decimal( - Item_func_hybrid_field_type *, - my_decimal *) const override; - void Item_func_hybrid_field_type_get_date(THD *, - Item_func_hybrid_field_type *, - Temporal::Warn *, - MYSQL_TIME *, - date_mode_t fuzzydate) const override; - String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override; - longlong Item_func_between_val_int(Item_func_between *func) const override; - cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; - in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const override; - bool Item_func_in_fix_comparator_compatible_types(THD *thd, - Item_func_in *) const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override; - bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override; - bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override; - bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override; - bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override; - bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override; - bool Item_func_div_fix_length_and_dec(Item_func_div *) const override; - bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override; - const Vers_type_handler *vers() const override { return &vers_type_trx; } -}; - - -class Type_handler_general_purpose_int: public Type_handler_int_result -{ -public: - bool type_can_have_auto_increment_attribute() const override { return true; } - virtual const Type_limits_int *type_limits_int() const= 0; - uint32 max_display_length(const Item *item) const override - { - return type_limits_int()->char_length(); - } - uint32 Item_decimal_notation_int_digits(const Item *item) const override; - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override - { - return partition_field_check_result_type(item_expr, INT_RESULT); - } - bool partition_field_append_value(String *str, - Item *item_expr, - CHARSET_INFO *field_cs, - partition_value_print_mode_t) - const override; - const Vers_type_handler *vers() const override { return &vers_type_trx; } -}; - - -class Type_handler_temporal_result: public Type_handler -{ -protected: - uint Item_decimal_scale_with_seconds(const Item *item) const; - uint Item_divisor_precision_increment_with_seconds(const Item *) const; -public: - Item_result result_type() const override { return STRING_RESULT; } - Item_result cmp_type() const override { return TIME_RESULT; } - virtual ~Type_handler_temporal_result() {} - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - void make_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - uint make_packed_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - void sort_length(THD *thd, - const Type_std_attributes *item, - SORT_FIELD_ATTR *attr) const override; - bool Item_const_eq(const Item_const *a, const Item_const *b, - bool binary_cmp) const override; - bool Item_param_set_from_value(THD *thd, - Item_param *param, - const Type_all_attributes *attr, - const st_value *value) const override; - uint32 max_display_length(const Item *item) const override; - uint32 Item_decimal_notation_int_digits(const Item *item) const override; - bool can_change_cond_ref_to_const(Item_bool_func2 *target, - Item *target_expr, Item *target_value, - Item_bool_func2 *source, - Item *source_expr, Item *source_const) - const override; - bool subquery_type_allows_materialization(const Item *inner, - const Item *outer) const override; - bool Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func, - Item **items, uint nitems) - const override; - bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const override; - bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override; - bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override; - bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *)const override; - bool Item_val_bool(Item *item) const override; - void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn, - MYSQL_TIME *ltime, date_mode_t fuzzydate) const override; - longlong Item_val_int_signed_typecast(Item *item) const override; - longlong Item_val_int_unsigned_typecast(Item *item) const override; - String *Item_func_hex_val_str_ascii(Item_func_hex *, String *)const override; - String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, - String *) const override; - double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) - const override; - longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) - const override; - my_decimal *Item_func_hybrid_field_type_val_decimal( - Item_func_hybrid_field_type *, - my_decimal *) const override; - void Item_func_hybrid_field_type_get_date(THD *, - Item_func_hybrid_field_type *, - Temporal::Warn *, - MYSQL_TIME *, - date_mode_t) const override; - bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, - MYSQL_TIME *, date_mode_t) const override; - bool Item_func_between_fix_length_and_dec(Item_func_between *)const override; - bool Item_func_in_fix_comparator_compatible_types(THD *, Item_func_in *) - const override; - bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override; - bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override; - bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override; - bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override; - bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override; - bool Item_func_div_fix_length_and_dec(Item_func_div *) const override; - bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override; - const Vers_type_handler *vers() const override; -}; - - -class Type_handler_string_result: public Type_handler -{ - uint Item_temporal_precision(THD *thd, Item *item, bool is_time) const; -public: - const Name &default_value() const override; - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_STRING; - } - Item_result result_type() const override { return STRING_RESULT; } - Item_result cmp_type() const override { return STRING_RESULT; } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *) const - override - { - return DYN_COL_STRING; - } - CHARSET_INFO *charset_for_protocol(const Item *item) const override; - virtual ~Type_handler_string_result() {} - const Type_handler *type_handler_for_comparison() const override; - int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const - override; - const Type_handler * - type_handler_adjusted_to_max_octet_length(uint max_octet_length, - CHARSET_INFO *cs) const override; - void make_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - uint make_packed_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - void sort_length(THD *thd, - const Type_std_attributes *item, - SORT_FIELD_ATTR *attr) const override; - bool is_packable() const override { return true; } - bool union_element_finalize(const Item * item) const override; - uint calc_key_length(const Column_definition &def) const override; - bool Column_definition_prepare_stage1(THD *thd, - MEM_ROOT *mem_root, - Column_definition *c, - handler *file, - ulonglong table_flags) const override; - bool Column_definition_redefine_stage1(Column_definition *def, - const Column_definition *dup, - const handler *file, - const Schema_specification_st *schema) - const override; - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - uint32 max_display_length(const Item *item) const override; - /* - The next method returns 309 for long stringified doubles in scientific - notation, e.g. FORMAT('1e308', 2). - */ - uint32 Item_decimal_notation_int_digits(const Item *item) const override - { return 309; } - bool Item_const_eq(const Item_const *a, const Item_const *b, - bool binary_cmp) const override; - bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, - Item *a, Item *b) const override; - uint Item_time_precision(THD *thd, Item *item) const override - { - return Item_temporal_precision(thd, item, true); - } - uint Item_datetime_precision(THD *thd, Item *item) const override - { - return Item_temporal_precision(thd, item, false); - } - uint Item_decimal_precision(const Item *item) const override; - void Item_update_null_value(Item *item) const override; - bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override; - void Item_param_setup_conversion(THD *thd, Item_param *) const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; - bool Item_param_set_from_value(THD *thd, - Item_param *param, - const Type_all_attributes *attr, - const st_value *value) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_str(item, protocol, buf); - } - int Item_save_in_field(Item *item, Field *field, bool no_conversions) const - override; - String *print_item_value(THD *thd, Item *item, String *str) const override - { - return print_item_value_csstr(thd, item, str); - } - bool can_change_cond_ref_to_const(Item_bool_func2 *target, - Item *target_expr, Item *target_value, - Item_bool_func2 *source, - Item *source_expr, Item *source_const) const - override; - bool subquery_type_allows_materialization(const Item *inner, - const Item *outer) const override; - Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const - override; - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - bool set_comparator_func(Arg_comparator *cmp) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) const - override; - bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override; - bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override; - bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override; - bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override; - bool Item_func_signed_fix_length_and_dec(Item_func_signed *item) const - override; - bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const - override; - bool Item_val_bool(Item *item) const override; - void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn, - MYSQL_TIME *ltime, date_mode_t fuzzydate) const override; - longlong Item_val_int_signed_typecast(Item *item) const override; - longlong Item_val_int_unsigned_typecast(Item *item) const override; - String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const - override; - String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, - String *) const override; - double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) - const override; - longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) - const override; - my_decimal *Item_func_hybrid_field_type_val_decimal( - Item_func_hybrid_field_type *, - my_decimal *) const override; - void Item_func_hybrid_field_type_get_date(THD *, - Item_func_hybrid_field_type *, - Temporal::Warn *, - MYSQL_TIME *, - date_mode_t fuzzydate) - const override; - String *Item_func_min_max_val_str(Item_func_min_max *, String *) const - override; - double Item_func_min_max_val_real(Item_func_min_max *) const override; - longlong Item_func_min_max_val_int(Item_func_min_max *) const override; - my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, - my_decimal *) const override; - bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, - MYSQL_TIME *, date_mode_t fuzzydate) const - override; - bool Item_func_between_fix_length_and_dec(Item_func_between *func) const - override; - longlong Item_func_between_val_int(Item_func_between *func) const override; - bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const - override; - cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; - in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const - override; - bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *) - const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override; - bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override; - bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override; - bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const override; - bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const override; - bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override; - bool Item_func_div_fix_length_and_dec(Item_func_div *) const override; - bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override; - const Vers_type_handler *vers() const override; -}; - - -class Type_handler_general_purpose_string: public Type_handler_string_result -{ -public: - bool is_general_purpose_string_type() const override { return true; } -}; - - -/*** - Instantiable classes for every MYSQL_TYPE_XXX - - There are no Type_handler_xxx for the following types: - - MYSQL_TYPE_VAR_STRING (old VARCHAR) - mapped to MYSQL_TYPE_VARSTRING - - MYSQL_TYPE_ENUM - mapped to MYSQL_TYPE_VARSTRING - - MYSQL_TYPE_SET: - mapped to MYSQL_TYPE_VARSTRING - - because the functionality that currently uses Type_handler - (e.g. hybrid type functions) does not need to distinguish between - these types and VARCHAR. - For example: - CREATE TABLE t2 AS SELECT COALESCE(enum_column) FROM t1; - creates a VARCHAR column. - - There most likely be Type_handler_enum and Type_handler_set later, - when the Type_handler infrastructure gets used in more pieces of the code. -*/ - - -class Type_handler_tiny: public Type_handler_general_purpose_int -{ -public: - virtual ~Type_handler_tiny() {} - enum_field_types field_type() const override { return MYSQL_TYPE_TINY; } - const Type_handler *type_handler_unsigned() const override; - const Type_handler *type_handler_signed() const override; - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_TINY; - } - const Type_limits_int *type_limits_int() const override; - uint32 calc_pack_length(uint32 length) const override { return 1; } - uint32 max_display_length_for_field(const Conv_source &src) const override - { return 4; } - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_tiny(item, protocol, buf); - } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_TINY); } - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; -}; - - -class Type_handler_utiny: public Type_handler_tiny -{ -public: - uint flags() const override { return UNSIGNED_FLAG; } - const Type_limits_int *type_limits_int() const override; -}; - - -class Type_handler_short: public Type_handler_general_purpose_int -{ -public: - virtual ~Type_handler_short() {} - enum_field_types field_type() const override { return MYSQL_TYPE_SHORT; } - const Type_handler *type_handler_unsigned() const override; - const Type_handler *type_handler_signed() const override; - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_SHORT; - } - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_short(item, protocol, buf); - } - const Type_limits_int *type_limits_int() const override; - uint32 max_display_length_for_field(const Conv_source &src) const override - { return 6; } - uint32 calc_pack_length(uint32 length) const override{ return 2; } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_SHORT); } - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; -}; - - -class Type_handler_ushort: public Type_handler_short -{ -public: - uint flags() const override { return UNSIGNED_FLAG; } - const Type_limits_int *type_limits_int() const override; -}; - - -class Type_handler_long: public Type_handler_general_purpose_int -{ -public: - virtual ~Type_handler_long() {} - enum_field_types field_type() const override { return MYSQL_TYPE_LONG; } - const Type_handler *type_handler_unsigned() const override; - const Type_handler *type_handler_signed() const override; - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_LONG; - } - const Type_limits_int *type_limits_int() const override; - uint32 max_display_length_for_field(const Conv_source &src) const override - { return 11; } - uint32 calc_pack_length(uint32 length) const override { return 4; } - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_long(item, protocol, buf); - } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_LONG); } - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; -}; - - -class Type_handler_ulong: public Type_handler_long -{ -public: - uint flags() const override { return UNSIGNED_FLAG; } - const Type_limits_int *type_limits_int() const override; -}; - - -class Type_handler_bool: public Type_handler_long -{ -public: - bool is_bool_type() const override { return true; } - const Type_handler *type_handler_unsigned() const override; - const Type_handler *type_handler_signed() const override; - void Item_update_null_value(Item *item) const override; - bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const override; -}; - - -class Type_handler_longlong: public Type_handler_general_purpose_int -{ -public: - virtual ~Type_handler_longlong() {} - enum_field_types field_type() const override{ return MYSQL_TYPE_LONGLONG; } - const Type_handler *type_handler_unsigned() const override; - const Type_handler *type_handler_signed() const override; - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_LONGLONG; - } - const Type_limits_int *type_limits_int() const override; - uint32 max_display_length_for_field(const Conv_source &src) const override - { return 20; } - uint32 calc_pack_length(uint32 length) const override { return 8; } - Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_longlong(item, protocol, buf); - } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { - return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_LONGLONG); - } - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; -}; - - -class Type_handler_ulonglong: public Type_handler_longlong -{ -public: - uint flags() const override { return UNSIGNED_FLAG; } - const Type_limits_int *type_limits_int() const override; -}; - - -class Type_handler_vers_trx_id: public Type_handler_ulonglong -{ -public: - virtual ~Type_handler_vers_trx_id() {} - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; -}; - - -class Type_handler_int24: public Type_handler_general_purpose_int -{ -public: - virtual ~Type_handler_int24() {} - enum_field_types field_type() const override { return MYSQL_TYPE_INT24; } - const Type_handler *type_handler_unsigned() const override; - const Type_handler *type_handler_signed() const override; - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_LONG; - } - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_long(item, protocol, buf); - } - const Type_limits_int *type_limits_int() const override; - uint32 max_display_length_for_field(const Conv_source &src) const override - { return 9; } - uint32 calc_pack_length(uint32 length) const override { return 3; } - Field *make_conversion_table_field(MEM_ROOT *mem_root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_INT24); } - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_uint24: public Type_handler_int24 -{ -public: - uint flags() const override { return UNSIGNED_FLAG; } - const Type_limits_int *type_limits_int() const override; -}; - - -class Type_handler_year: public Type_handler_int_result -{ -public: - virtual ~Type_handler_year() {} - enum_field_types field_type() const override { return MYSQL_TYPE_YEAR; } - uint flags() const override { return UNSIGNED_FLAG; } - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_SHORT; - } - uint32 max_display_length(const Item *item) const override; - uint32 Item_decimal_notation_int_digits(const Item *item) const override - { return 4; }; - uint32 max_display_length_for_field(const Conv_source &src) const override - { return 4; } - uint32 calc_pack_length(uint32 length) const override { return 1; } - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_short(item, protocol, buf); - } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - void Column_definition_reuse_fix_attributes(THD *thd, - Column_definition *c, - const Field *field) - const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_YEAR); } - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *)const override; - void Item_get_date(THD *thd, Item *item, Temporal::Warn *warn, - MYSQL_TIME *ltime, date_mode_t fuzzydate) const override; - void Item_func_hybrid_field_type_get_date(THD *, - Item_func_hybrid_field_type *item, - Temporal::Warn *, - MYSQL_TIME *to, - date_mode_t fuzzydate) - const override; - const Vers_type_handler *vers() const override { return NULL; } -}; - - -class Type_handler_bit: public Type_handler_int_result -{ -public: - virtual ~Type_handler_bit() {} - enum_field_types field_type() const override { return MYSQL_TYPE_BIT; } - uint flags() const override { return UNSIGNED_FLAG; } - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_STRING; - } - uint32 max_display_length(const Item *item) const override; - uint32 Item_decimal_notation_int_digits(const Item *item) const override; - static uint32 Bit_decimal_notation_int_digits_by_nbits(uint nbits); - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override { return length / 8; } - uint calc_key_length(const Column_definition &def) const override; - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_str(item, protocol, buf); - } - String *print_item_value(THD *thd, Item *item, String *str) const override - { - return print_item_value_csstr(thd, item, str); - } - void show_binlog_type(const Conv_source &src, const Field &, String *str) - const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage1(THD *thd, - MEM_ROOT *mem_root, - Column_definition *c, - handler *file, - ulonglong table_flags) const override; - bool Column_definition_redefine_stage1(Column_definition *def, - const Column_definition *dup, - const handler *file, - const Schema_specification_st *schema) - const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_float: public Type_handler_real_result -{ -public: - virtual ~Type_handler_float() {} - enum_field_types field_type() const override { return MYSQL_TYPE_FLOAT; } - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_FLOAT; - } - bool type_can_have_auto_increment_attribute() const override { return true; } - uint32 max_display_length(const Item *item) const override { return 25; } - uint32 max_display_length_for_field(const Conv_source &src) const override - { return 12; } - uint32 Item_decimal_notation_int_digits(const Item *item) const override - { return 39; } - uint32 calc_pack_length(uint32 length) const override { return sizeof(float); } - Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_float(item, protocol, buf); - } - Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) - const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_real(c, MYSQL_TYPE_FLOAT); } - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; - - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, - String *) const override; - String *Item_func_min_max_val_str(Item_func_min_max *, String *) - const override; -}; - - -class Type_handler_double: public Type_handler_real_result -{ -public: - virtual ~Type_handler_double() {} - enum_field_types field_type() const override { return MYSQL_TYPE_DOUBLE; } - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_DOUBLE; - } - bool type_can_have_auto_increment_attribute() const override { return true; } - uint32 max_display_length(const Item *item) const override { return 53; } - uint32 Item_decimal_notation_int_digits(const Item *item) const override - { return 309; } - uint32 max_display_length_for_field(const Conv_source &src) const override - { return 22; } - uint32 calc_pack_length(uint32 length) const override - { - return sizeof(double); - } - Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_double(item, protocol, buf); - } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_real(c, MYSQL_TYPE_DOUBLE); } - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; - - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, - String *) const override; - String *Item_func_min_max_val_str(Item_func_min_max *, String *) - const override; -}; - - -class Type_handler_time_common: public Type_handler_temporal_result -{ -public: - virtual ~Type_handler_time_common() { } - const Name &default_value() const override; - enum_field_types field_type() const override { return MYSQL_TYPE_TIME; } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) - const override - { - return DYN_COL_TIME; - } - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_TIME; - } - enum_mysql_timestamp_type mysql_timestamp_type() const override - { - return MYSQL_TIMESTAMP_TIME; - } - bool is_val_native_ready() const override { return true; } - const Type_handler *type_handler_for_native_format() const override; - int cmp_native(const Native &a, const Native &b) const override; - bool Item_val_native_with_conversion(THD *thd, Item *, Native *to) - const override; - bool Item_val_native_with_conversion_result(THD *thd, Item *, Native *to) - const override; - bool Item_param_val_native(THD *thd, Item_param *item, Native *to) - const override; - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override - { - return partition_field_check_result_type(item_expr, STRING_RESULT); - } - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Item_literal *create_literal_item(THD *thd, const char *str, size_t length, - CHARSET_INFO *cs, bool send_error) - const override; - Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) - const override; - bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, - Item *a, Item *b) const override; - uint Item_decimal_scale(const Item *item) const override - { - return Item_decimal_scale_with_seconds(item); - } - uint Item_decimal_precision(const Item *item) const override; - uint Item_divisor_precision_increment(const Item *item) const override - { - return Item_divisor_precision_increment_with_seconds(item); - } - const Type_handler *type_handler_for_comparison() const override; - int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) - const override; - void Column_definition_implicit_upgrade(Column_definition *c) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool - Column_definition_attributes_frm_unpack(Column_definition_attributes *attr, - TABLE_SHARE *share, - const uchar *buffer, - LEX_CUSTRING *gis_options) - const override; - bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_time(item, protocol, buf); - } - void Item_update_null_value(Item *item) const override; - int Item_save_in_field(Item *item, Field *field, bool no_conversions) - const override; - String *print_item_value(THD *thd, Item *item, String *str) const override; - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - longlong Item_val_int_unsigned_typecast(Item *item) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) - const override; - String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, - String *) const override; - double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) - const override; - longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) - const override; - my_decimal *Item_func_hybrid_field_type_val_decimal( - Item_func_hybrid_field_type *, - my_decimal *) const override; - void Item_func_hybrid_field_type_get_date(THD *, - Item_func_hybrid_field_type *, - Temporal::Warn *, - MYSQL_TIME *, - date_mode_t fuzzydate) - const override; - String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override; - double Item_func_min_max_val_real(Item_func_min_max *) const override; - longlong Item_func_min_max_val_int(Item_func_min_max *) const override; - my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, - my_decimal *) const override; - bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, - MYSQL_TIME *, date_mode_t fuzzydate) - const override; - longlong Item_func_between_val_int(Item_func_between *func) const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; - Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) - const override; - bool set_comparator_func(Arg_comparator *cmp) const override; - cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; - in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) - const override; - void Item_param_set_param_func(Item_param *param, uchar **pos, ulong len) - const override; -}; - - -class Type_handler_time: public Type_handler_time_common -{ - /* number of bytes to store TIME(N) */ - static uint m_hires_bytes[MAX_DATETIME_PRECISION+1]; -public: - static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; } - virtual ~Type_handler_time() {} - const Name version() const override { return version_mariadb53(); } - uint32 max_display_length_for_field(const Conv_source &src) const override - { return MIN_TIME_WIDTH; } - uint32 calc_pack_length(uint32 length) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_TIME); } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_time2: public Type_handler_time_common -{ -public: - virtual ~Type_handler_time2() {} - const Name version() const override { return version_mysql56(); } - enum_field_types real_field_type() const override { return MYSQL_TYPE_TIME2; } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_TIME2); } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_temporal_with_date: public Type_handler_temporal_result -{ -public: - virtual ~Type_handler_temporal_with_date() {} - Item_literal *create_literal_item(THD *thd, const char *str, size_t length, - CHARSET_INFO *cs, bool send_error) - const override; - bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, - Item *a, Item *b) const override; - int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) - const override; - bool Item_save_in_value(THD *thd, Item *item, st_value *value) - const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_date(item, protocol, buf); - } - void Item_update_null_value(Item *item) const override; - int Item_save_in_field(Item *item, Field *field, bool no_conversions) - const override; - Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) - const override; - bool set_comparator_func(Arg_comparator *cmp) const override; - cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; - in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) - const override; - longlong Item_func_between_val_int(Item_func_between *func) const override; -}; - - -class Type_handler_date_common: public Type_handler_temporal_with_date -{ -public: - virtual ~Type_handler_date_common() {} - const Name &default_value() const override; - const Type_handler *type_handler_for_comparison() const override; - enum_field_types field_type() const override { return MYSQL_TYPE_DATE; } - uint32 max_display_length_for_field(const Conv_source &src) const override - { return 3; } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) - const override - { - return DYN_COL_DATE; - } - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_DATE; - } - enum_mysql_timestamp_type mysql_timestamp_type() const override - { - return MYSQL_TIMESTAMP_DATE; - } - bool cond_notnull_field_isnull_to_field_eq_zero() const override - { - return true; - } - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override - { - return partition_field_check_result_type(item_expr, STRING_RESULT); - } - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Item_literal *create_literal_item(THD *thd, const char *str, size_t length, - CHARSET_INFO *cs, bool send_error) - const override; - Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) - const override; - bool validate_implicit_default_value(THD *thd, - const Column_definition &def) - const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - uint Item_decimal_precision(const Item *item) const override; - String *print_item_value(THD *thd, Item *item, String *str) const override; - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override; - double Item_func_min_max_val_real(Item_func_min_max *) const override; - longlong Item_func_min_max_val_int(Item_func_min_max *) const override; - my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, - my_decimal *) const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) const - override; - bool Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func, - Item **items, uint nitems) const - override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; -}; - -class Type_handler_date: public Type_handler_date_common -{ -public: - virtual ~Type_handler_date() {} - uint32 calc_pack_length(uint32 length) const override { return 4; } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_DATE); } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_newdate: public Type_handler_date_common -{ -public: - virtual ~Type_handler_newdate() {} - enum_field_types real_field_type() const override - { - return MYSQL_TYPE_NEWDATE; - } - uint32 calc_pack_length(uint32 length) const override { return 3; } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_NEWDATE); } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_datetime_common: public Type_handler_temporal_with_date -{ -public: - virtual ~Type_handler_datetime_common() {} - const Name &default_value() const override; - const Type_handler *type_handler_for_comparison() const override; - enum_field_types field_type() const override - { - return MYSQL_TYPE_DATETIME; - } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) - const override - { - return DYN_COL_DATETIME; - } - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_DATETIME; - } - enum_mysql_timestamp_type mysql_timestamp_type() const override - { - return MYSQL_TIMESTAMP_DATETIME; - } - bool cond_notnull_field_isnull_to_field_eq_zero() const override - { - return true; - } - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override - { - return partition_field_check_result_type(item_expr, STRING_RESULT); - } - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) const override; - bool validate_implicit_default_value(THD *thd, const Column_definition &def) - const override; - void Column_definition_implicit_upgrade(Column_definition *c) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool - Column_definition_attributes_frm_unpack(Column_definition_attributes *attr, - TABLE_SHARE *share, - const uchar *buffer, - LEX_CUSTRING *gis_options) - const override; - uint Item_decimal_scale(const Item *item) const override - { - return Item_decimal_scale_with_seconds(item); - } - uint Item_decimal_precision(const Item *item) const override; - uint Item_divisor_precision_increment(const Item *item) const override - { - return Item_divisor_precision_increment_with_seconds(item); - } - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_datetime(item, protocol, buf); - } - String *print_item_value(THD *thd, Item *item, String *str) const override; - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override; - double Item_func_min_max_val_real(Item_func_min_max *) const override; - longlong Item_func_min_max_val_int(Item_func_min_max *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; - my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, my_decimal *) - const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) - const override; - void Item_param_set_param_func(Item_param *param, uchar **pos, ulong len) - const override; -}; - - -class Type_handler_datetime: public Type_handler_datetime_common -{ - /* number of bytes to store DATETIME(N) */ - static uint m_hires_bytes[MAX_DATETIME_PRECISION + 1]; -public: - static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; } - virtual ~Type_handler_datetime() {} - const Name version() const override { return version_mariadb53(); } - uint32 max_display_length_for_field(const Conv_source &src) const override - { return MAX_DATETIME_WIDTH; } - uint32 calc_pack_length(uint32 length) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_DATETIME); } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_datetime2: public Type_handler_datetime_common -{ -public: - virtual ~Type_handler_datetime2() {} - const Name version() const override { return version_mysql56(); } - enum_field_types real_field_type() const override - { - return MYSQL_TYPE_DATETIME2; - } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_DATETIME2); } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_timestamp_common: public Type_handler_temporal_with_date -{ -protected: - bool TIME_to_native(THD *, const MYSQL_TIME *from, Native *to, uint dec) const; -public: - virtual ~Type_handler_timestamp_common() {} - const Name &default_value() const override; - const Type_handler *type_handler_for_comparison() const override; - const Type_handler *type_handler_for_native_format() const override; - enum_field_types field_type() const override { return MYSQL_TYPE_TIMESTAMP; } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) - const override - { - return DYN_COL_DATETIME; - } - protocol_send_type_t protocol_send_type() const override - { - return PROTOCOL_SEND_DATETIME; - } - enum_mysql_timestamp_type mysql_timestamp_type() const override - { - return MYSQL_TIMESTAMP_DATETIME; - } - bool is_val_native_ready() const override - { - return true; - } - bool is_timestamp_type() const override - { - return true; - } - void Column_definition_implicit_upgrade(Column_definition *c) const override; - bool - Column_definition_attributes_frm_unpack(Column_definition_attributes *attr, - TABLE_SHARE *share, - const uchar *buffer, - LEX_CUSTRING *gis_options) - const override; - bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, - Item *a, Item *b) const override; - bool Item_val_native_with_conversion(THD *thd, Item *, Native *to) - const override; - bool Item_val_native_with_conversion_result(THD *thd, Item *, Native *to) - const override; - bool Item_param_val_native(THD *thd, Item_param *item, Native *to) - const override; - int cmp_native(const Native &a, const Native &b) const override; - longlong Item_func_between_val_int(Item_func_between *func) const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; - cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; - in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) - const override; - void make_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - uint make_packed_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; - void sort_length(THD *thd, - const Type_std_attributes *item, - SORT_FIELD_ATTR *attr) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - uint Item_decimal_scale(const Item *item) const override - { - return Item_decimal_scale_with_seconds(item); - } - uint Item_decimal_precision(const Item *item) const override; - uint Item_divisor_precision_increment(const Item *item) const override - { - return Item_divisor_precision_increment_with_seconds(item); - } - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override - { - return Item_send_timestamp(item, protocol, buf); - } - int Item_save_in_field(Item *item, Field *field, bool no_conversions) - const override; - String *print_item_value(THD *thd, Item *item, String *str) const override; - Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - Item_copy *create_item_copy(THD *thd, Item *item) const override; - String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override; - double Item_func_min_max_val_real(Item_func_min_max *) const override; - longlong Item_func_min_max_val_int(Item_func_min_max *) const override; - my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, - my_decimal *) const override; - bool set_comparator_func(Arg_comparator *cmp) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) - const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; - bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, - MYSQL_TIME *, date_mode_t fuzzydate) - const override; - bool Column_definition_set_attributes(THD *thd, - Column_definition *def, - const Lex_field_type_st &attr, - CHARSET_INFO *cs, - column_definition_type_t type) - const override; -}; - - -class Type_handler_timestamp: public Type_handler_timestamp_common -{ - /* number of bytes to store second_part part of the TIMESTAMP(N) */ - static uint m_sec_part_bytes[MAX_DATETIME_PRECISION + 1]; -public: - static uint sec_part_bytes(uint dec) { return m_sec_part_bytes[dec]; } - virtual ~Type_handler_timestamp() {} - const Name version() const override { return version_mariadb53(); } - uint32 max_display_length_for_field(const Conv_source &src) const override - { return MAX_DATETIME_WIDTH; } - uint32 calc_pack_length(uint32 length) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_TIMESTAMP); } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_timestamp2: public Type_handler_timestamp_common -{ -public: - virtual ~Type_handler_timestamp2() {} - const Name version() const override { return version_mysql56(); } - enum_field_types real_field_type() const override - { - return MYSQL_TYPE_TIMESTAMP2; - } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { - return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_TIMESTAMP2); - } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_olddecimal: public Type_handler_decimal_result -{ -public: - virtual ~Type_handler_olddecimal() {} - enum_field_types field_type() const override { return MYSQL_TYPE_DECIMAL; } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override { return length; } - const Type_handler *type_handler_for_tmp_table(const Item *item) const override; - const Type_handler *type_handler_for_union(const Item *item) const override; - void show_binlog_type(const Conv_source &src, const Field &, String *str) - const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_DECIMAL); } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_newdecimal: public Type_handler_decimal_result -{ -public: - virtual ~Type_handler_newdecimal() {} - enum_field_types field_type() const override { return MYSQL_TYPE_NEWDECIMAL; } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override; - uint calc_key_length(const Column_definition &def) const override; - void show_binlog_type(const Conv_source &src, const Field &, String *str) - const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage1(THD *thd, - MEM_ROOT *mem_root, - Column_definition *c, - handler *file, - ulonglong table_flags) const override; - bool Column_definition_redefine_stage1(Column_definition *def, - const Column_definition *dup, - const handler *file, - const Schema_specification_st *schema) - const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_null: public Type_handler_general_purpose_string -{ -public: - virtual ~Type_handler_null() {} - enum_field_types field_type() const override { return MYSQL_TYPE_NULL; } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) - const override - { - return DYN_COL_NULL; - } - const Type_handler *type_handler_for_comparison() const override; - const Type_handler *type_handler_for_tmp_table(const Item *item) const override; - const Type_handler *type_handler_for_union(const Item *) const override; - uint32 max_display_length(const Item *item) const override { return 0; } - uint32 max_display_length_for_field(const Conv_source &src) const override - { - return 0; - } - uint32 calc_pack_length(uint32 length) const override { return 0; } - bool Item_const_eq(const Item_const *a, const Item_const *b, - bool binary_cmp) const override; - bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage1(THD *thd, - MEM_ROOT *mem_root, - Column_definition *c, - handler *file, - ulonglong table_flags) const override; - bool Column_definition_redefine_stage1(Column_definition *def, - const Column_definition *dup, - const handler *file, - const Schema_specification_st *schema) - const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_NULL); } - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -class Type_handler_longstr: public Type_handler_general_purpose_string -{ -public: - bool type_can_have_key_part() const override - { - return true; - } -}; - - -class Type_handler_string: public Type_handler_longstr -{ -public: - virtual ~Type_handler_string() {} - enum_field_types field_type() const override { return MYSQL_TYPE_STRING; } - ulong KEY_pack_flags(uint column_nr) const override - { - return HA_PACK_KEY; - } - bool is_param_long_data_type() const override { return true; } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override { return length; } - const Type_handler *type_handler_for_tmp_table(const Item *item) const override - { - return varstring_type_handler(item); - } - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override - { - return partition_field_check_result_type(item_expr, STRING_RESULT); - } - void show_binlog_type(const Conv_source &src, const Field &dst, String *str) - const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_set_attributes(THD *thd, - Column_definition *def, - const Lex_field_type_st &attr, - CHARSET_INFO *cs, - column_definition_type_t type) - const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override; - bool Key_part_spec_init_ft(Key_part_spec *part, - const Column_definition &def) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -/* Old varchar */ -class Type_handler_var_string: public Type_handler_string -{ -public: - virtual ~Type_handler_var_string() {} - enum_field_types field_type() const override { return MYSQL_TYPE_VAR_STRING; } - enum_field_types real_field_type() const override { return MYSQL_TYPE_STRING; } - enum_field_types traditional_merge_field_type() const override - { - return MYSQL_TYPE_VARCHAR; - } - const Type_handler *type_handler_for_tmp_table(const Item *item) const override - { - return varstring_type_handler(item); - } - uint32 max_display_length_for_field(const Conv_source &src) const override; - void show_binlog_type(const Conv_source &src, const Field &dst, String *str) - const override; - void Column_definition_implicit_upgrade(Column_definition *c) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override - { return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_STRING); } - const Type_handler *type_handler_for_union(const Item *item) const override - { - return varstring_type_handler(item); - } -}; - - -class Type_handler_varchar: public Type_handler_longstr -{ -public: - virtual ~Type_handler_varchar() {} - enum_field_types field_type() const override { return MYSQL_TYPE_VARCHAR; } - ulong KEY_pack_flags(uint column_nr) const override - { - if (column_nr == 0) - return HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY; - return HA_PACK_KEY; - } - enum_field_types type_code_for_protocol() const override - { - return MYSQL_TYPE_VAR_STRING; // Keep things compatible for old clients - } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override - { - return (length + (length < 256 ? 1: 2)); - } - const Type_handler *type_handler_for_tmp_table(const Item *item) const override - { - return varstring_type_handler(item); - } - const Type_handler *type_handler_for_union(const Item *item) const override - { - return varstring_type_handler(item); - } - bool is_param_long_data_type() const override { return true; } - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override - { - return partition_field_check_result_type(item_expr, STRING_RESULT); - } - void show_binlog_type(const Conv_source &src, const Field &dst, String *str) - const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - bool Column_definition_set_attributes(THD *thd, - Column_definition *def, - const Lex_field_type_st &attr, - CHARSET_INFO *cs, - column_definition_type_t type) - const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override; - bool Key_part_spec_init_ft(Key_part_spec *part, - const Column_definition &def) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - bool adjust_spparam_type(Spvar_definition *def, Item *from) const override; -}; - - -class Type_handler_hex_hybrid: public Type_handler_varchar -{ -public: - virtual ~Type_handler_hex_hybrid() {} - const Type_handler *cast_to_int_type_handler() const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; -}; - - -class Type_handler_varchar_compressed: public Type_handler_varchar -{ -public: - enum_field_types real_field_type() const override - { - return MYSQL_TYPE_VARCHAR_COMPRESSED; - } - ulong KEY_pack_flags(uint column_nr) const override - { - DBUG_ASSERT(0); - return 0; - } - uint32 max_display_length_for_field(const Conv_source &src) const override; - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override - { - partition_field_type_not_allowed(field_name); - return true; - } - void show_binlog_type(const Conv_source &src, const Field &dst, String *str) - const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) - const override - { - DBUG_ASSERT(0); - return DYN_COL_STRING; - } -}; - - -class Type_handler_blob_common: public Type_handler_longstr -{ -public: - virtual ~Type_handler_blob_common() { } - virtual uint length_bytes() const= 0; - ulong KEY_pack_flags(uint column_nr) const override - { - if (column_nr == 0) - return HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY; - return HA_PACK_KEY; - } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - const Type_handler *type_handler_for_tmp_table(const Item *item) const - override - { - return blob_type_handler(item); - } - const Type_handler *type_handler_for_union(const Item *item) const override - { - return blob_type_handler(item); - } - bool subquery_type_allows_materialization(const Item *inner, - const Item *outer) const override - { - return false; // Materialization does not work with BLOB columns - } - bool is_param_long_data_type() const override { return true; } - uint calc_key_length(const Column_definition &def) const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override; - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - bool Key_part_spec_init_ft(Key_part_spec *part, - const Column_definition &def) const override; - bool Key_part_spec_init_primary(Key_part_spec *part, - const Column_definition &def, - const handler *file) const override; - bool Key_part_spec_init_unique(Key_part_spec *part, - const Column_definition &def, - const handler *file, - bool *has_key_needed) const override; - bool Key_part_spec_init_multiple(Key_part_spec *part, - const Column_definition &def, - const handler *file) const override; - bool Key_part_spec_init_foreign(Key_part_spec *part, - const Column_definition &def, - const handler *file) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) const - override; - void Item_param_setup_conversion(THD *thd, Item_param *) const override; - - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override; - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - const Vers_type_handler *vers() const override; -}; - - -class Type_handler_tiny_blob: public Type_handler_blob_common -{ -public: - virtual ~Type_handler_tiny_blob() {} - uint length_bytes() const override { return 1; } - enum_field_types field_type() const override { return MYSQL_TYPE_TINY_BLOB; } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - uint max_octet_length() const override { return UINT_MAX8; } -}; - - -class Type_handler_medium_blob: public Type_handler_blob_common -{ -public: - virtual ~Type_handler_medium_blob() {} - uint length_bytes() const override { return 3; } - enum_field_types field_type() const override { return MYSQL_TYPE_MEDIUM_BLOB; } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - uint max_octet_length() const override { return UINT_MAX24; } -}; - - -class Type_handler_long_blob: public Type_handler_blob_common -{ -public: - virtual ~Type_handler_long_blob() {} - uint length_bytes() const override { return 4; } - enum_field_types field_type() const override { return MYSQL_TYPE_LONG_BLOB; } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override; - Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - uint max_octet_length() const override { return UINT_MAX32; } -}; - - -class Type_handler_blob: public Type_handler_blob_common -{ -public: - virtual ~Type_handler_blob() {} - uint length_bytes() const override { return 2; } - enum_field_types field_type() const override { return MYSQL_TYPE_BLOB; } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - uint max_octet_length() const override { return UINT_MAX16; } -}; - - -class Type_handler_blob_compressed: public Type_handler_blob -{ -public: - enum_field_types real_field_type() const override - { - return MYSQL_TYPE_BLOB_COMPRESSED; - } - ulong KEY_pack_flags(uint column_nr) const override - { - DBUG_ASSERT(0); - return 0; - } - uint32 max_display_length_for_field(const Conv_source &src) const override; - void show_binlog_type(const Conv_source &src, const Field &, String *str) - const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) - const override - { - DBUG_ASSERT(0); - return DYN_COL_STRING; - } -}; - - -class Type_handler_typelib: public Type_handler_general_purpose_string -{ -public: - virtual ~Type_handler_typelib() { } - enum_field_types field_type() const override { return MYSQL_TYPE_STRING; } - const Type_handler *type_handler_for_item_field() const override; - const Type_handler *cast_to_int_type_handler() const override; - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; - uint32 max_display_length_for_field(const Conv_source &src) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *, - Type_all_attributes *atrr, - Item **items, uint nitems) - const override; - void Column_definition_reuse_fix_attributes(THD *thd, - Column_definition *c, - const Field *field) - const override; - bool Column_definition_prepare_stage1(THD *thd, - MEM_ROOT *mem_root, - Column_definition *c, - handler *file, - ulonglong table_flags) - const override; - bool Column_definition_redefine_stage1(Column_definition *def, - const Column_definition *dup, - const handler *file, - const Schema_specification_st *schema) - const override; - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; - const Vers_type_handler *vers() const override { return NULL; } -}; - - -class Type_handler_enum: public Type_handler_typelib -{ -public: - virtual ~Type_handler_enum() {} - enum_field_types real_field_type() const override { return MYSQL_TYPE_ENUM; } - enum_field_types traditional_merge_field_type() const override - { - return MYSQL_TYPE_ENUM; - } - uint32 calc_pack_length(uint32 length) const override; - uint calc_key_length(const Column_definition &def) const override; - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) - const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - Field *make_schema_field(MEM_ROOT *root, - TABLE *table, - const Record_addr &addr, - const ST_FIELD_INFO &def) const override; -}; - - -class Type_handler_set: public Type_handler_typelib -{ -public: - virtual ~Type_handler_set() {} - enum_field_types real_field_type() const override { return MYSQL_TYPE_SET; } - enum_field_types traditional_merge_field_type() const override - { - return MYSQL_TYPE_SET; - } - uint32 calc_pack_length(uint32 length) const override; - uint calc_key_length(const Column_definition &def) const override; - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) - const override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; -}; - - -// A pseudo type handler, mostly for test purposes for now -class Type_handler_interval_DDhhmmssff: public Type_handler_long_blob -{ -public: - Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) const override; -}; - - -class Function_collection -{ -public: - virtual ~Function_collection() {} - virtual bool init()= 0; - virtual void cleanup()= 0; - virtual Create_func *find_native_function_builder(THD *thd, - const LEX_CSTRING &name) - const= 0; -}; - - -class Type_collection -{ -public: - virtual ~Type_collection() {} - virtual bool init(Type_handler_data *data) - { - return false; - } - virtual const Type_handler *handler_by_name(const LEX_CSTRING &name) const= 0; - virtual const Type_handler *aggregate_for_result(const Type_handler *h1, - const Type_handler *h2) - const= 0; - virtual const Type_handler *aggregate_for_comparison(const Type_handler *h1, - const Type_handler *h2) - const= 0; - virtual const Type_handler *aggregate_for_min_max(const Type_handler *h1, - const Type_handler *h2) - const= 0; - virtual const Type_handler *aggregate_for_num_op(const Type_handler *h1, - const Type_handler *h2) - const= 0; -}; - - -/** - A handler for hybrid type functions, e.g. - COALESCE(), IF(), IFNULL(), NULLIF(), CASE, - numeric operators, - UNIX_TIMESTAMP(), TIME_TO_SEC(). - - Makes sure that field_type(), cmp_type() and result_type() - are always in sync to each other for hybrid functions. -*/ -class Type_handler_hybrid_field_type -{ - const Type_handler *m_type_handler; - bool aggregate_for_min_max(const Type_handler *other); - -public: - Type_handler_hybrid_field_type(); - Type_handler_hybrid_field_type(const Type_handler *handler) - :m_type_handler(handler) - { } - Type_handler_hybrid_field_type(const Type_handler_hybrid_field_type *other) - :m_type_handler(other->m_type_handler) - { } - void swap(Type_handler_hybrid_field_type &other) - { - swap_variables(const Type_handler *, m_type_handler, other.m_type_handler); - } - const Type_handler *type_handler() const { return m_type_handler; } - enum_field_types real_field_type() const - { - return m_type_handler->real_field_type(); - } - Item_result cmp_type() const { return m_type_handler->cmp_type(); } - enum_mysql_timestamp_type mysql_timestamp_type() const - { - return m_type_handler->mysql_timestamp_type(); - } - bool is_timestamp_type() const - { - return m_type_handler->is_timestamp_type(); - } - void set_handler(const Type_handler *other) - { - m_type_handler= other; - } - const Type_handler *set_handler_by_field_type(enum_field_types type) - { - return (m_type_handler= Type_handler::get_handler_by_field_type(type)); - } - const Type_handler *set_handler_by_real_type(enum_field_types type) - { - return (m_type_handler= Type_handler::get_handler_by_real_type(type)); - } - bool aggregate_for_comparison(const Type_handler *other); - bool aggregate_for_comparison(const char *funcname, - Item **items, uint nitems, - bool treat_int_to_uint_as_decimal); - bool aggregate_for_result(const Type_handler *other); - bool aggregate_for_result(const char *funcname, - Item **item, uint nitems, bool treat_bit_as_number); - bool aggregate_for_min_max(const char *funcname, Item **item, uint nitems); - - bool aggregate_for_num_op(const class Type_aggregator *aggregator, - const Type_handler *h0, const Type_handler *h1); -}; - -/* - Helper template to simplify creating builtin types with names. - Plugin types inherit from Type_handler_xxx types that do not set the name in - the constructor, as sql_plugin.cc sets the type name from the plugin name. -*/ -template -class Named_type_handler : public TypeHandler -{ - public: - Named_type_handler(const char *n) : TypeHandler() - { Type_handler::set_name(Name(n, static_cast(strlen(n)))); } -}; - -extern Named_type_handler type_handler_row; -extern Named_type_handler type_handler_null; - -extern Named_type_handler type_handler_float; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_double; - -extern Named_type_handler type_handler_bit; - -extern Named_type_handler type_handler_enum; -extern Named_type_handler type_handler_set; - -extern Named_type_handler type_handler_string; -extern Named_type_handler type_handler_var_string; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_varchar; -extern Named_type_handler type_handler_varchar_compressed; -extern Named_type_handler type_handler_hex_hybrid; - -extern Named_type_handler type_handler_tiny_blob; -extern Named_type_handler type_handler_medium_blob; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_long_blob; -extern Named_type_handler type_handler_blob; -extern Named_type_handler type_handler_blob_compressed; - -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_bool; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_stiny; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_sshort; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_sint24; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_slong; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_slonglong; - -extern Named_type_handler type_handler_utiny; -extern Named_type_handler type_handler_ushort; -extern Named_type_handler type_handler_uint24; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_ulong; -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_ulonglong; -extern Named_type_handler type_handler_vers_trx_id; - -extern MYSQL_PLUGIN_IMPORT Named_type_handler type_handler_newdecimal; -extern Named_type_handler type_handler_olddecimal; - -extern Named_type_handler type_handler_year; -extern Named_type_handler type_handler_year2; -extern Named_type_handler type_handler_newdate; -extern Named_type_handler type_handler_date; -extern Named_type_handler type_handler_time; -extern Named_type_handler type_handler_time2; -extern Named_type_handler type_handler_datetime; -extern Named_type_handler type_handler_datetime2; -extern Named_type_handler type_handler_timestamp; -extern Named_type_handler type_handler_timestamp2; - -extern Type_handler_interval_DDhhmmssff type_handler_interval_DDhhmmssff; - -class Type_aggregator -{ - bool m_is_commutative; -public: - class Pair - { - public: - const Type_handler *m_handler1; - const Type_handler *m_handler2; - const Type_handler *m_result; - Pair() { } - Pair(const Type_handler *handler1, - const Type_handler *handler2, - const Type_handler *result) - :m_handler1(handler1), m_handler2(handler2), m_result(result) - { } - bool eq(const Type_handler *handler1, const Type_handler *handler2) const - { - return m_handler1 == handler1 && m_handler2 == handler2; - } - }; - static const Type_handler * - find_handler_in_array(const Type_aggregator::Pair *pairs, - const Type_handler *h1, - const Type_handler *h2, - bool commutative) - { - for (const Type_aggregator::Pair *p= pairs; p->m_result; p++) - { - if (p->eq(h1, h2)) - return p->m_result; - if (commutative && p->eq(h2, h1)) - return p->m_result; - } - return NULL; - } - -private: - Dynamic_array m_array; - const Pair* find_pair(const Type_handler *handler1, - const Type_handler *handler2) const; -public: - Type_aggregator(bool is_commutative= false) - :m_is_commutative(is_commutative), m_array(PSI_INSTRUMENT_MEM) - { } - bool add(const Type_handler *handler1, - const Type_handler *handler2, - const Type_handler *result) - { - return m_array.append(Pair(handler1, handler2, result)); - } - const Type_handler *find_handler(const Type_handler *handler1, - const Type_handler *handler2) const - { - const Pair* el= find_pair(handler1, handler2); - return el ? el->m_result : NULL; - } - bool is_commutative() const { return m_is_commutative; } -}; - - -class Type_aggregator_commutative: public Type_aggregator -{ -public: - Type_aggregator_commutative() - :Type_aggregator(true) - { } -}; - - -class Type_handler_data -{ -public: - Type_aggregator_commutative m_type_aggregator_for_result; - Type_aggregator_commutative m_type_aggregator_for_comparison; - - Type_aggregator_commutative m_type_aggregator_for_plus; - Type_aggregator_commutative m_type_aggregator_for_mul; - - Type_aggregator m_type_aggregator_for_minus; - Type_aggregator m_type_aggregator_for_div; - Type_aggregator m_type_aggregator_for_mod; -#ifndef DBUG_OFF - // This is used for mtr purposes in debug builds - Type_aggregator m_type_aggregator_non_commutative_test; -#endif - bool init(); -}; - -extern Type_handler_data *type_handler_data; - -#endif /* SQL_TYPE_H_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_geom.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_geom.h deleted file mode 100644 index 74290e4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_geom.h +++ /dev/null @@ -1,436 +0,0 @@ -#ifndef SQL_TYPE_GEOM_H_INCLUDED -#define SQL_TYPE_GEOM_H_INCLUDED -/* - Copyright (c) 2015 MariaDB Foundation - Copyright (c) 2019 MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include "mariadb.h" -#include "sql_type.h" - -#ifdef HAVE_SPATIAL -class Type_handler_geometry: public Type_handler_string_result -{ -public: - enum geometry_types - { - GEOM_GEOMETRY = 0, GEOM_POINT = 1, GEOM_LINESTRING = 2, GEOM_POLYGON = 3, - GEOM_MULTIPOINT = 4, GEOM_MULTILINESTRING = 5, GEOM_MULTIPOLYGON = 6, - GEOM_GEOMETRYCOLLECTION = 7 - }; - static bool check_type_geom_or_binary(const char *opname, const Item *item); - static bool check_types_geom_or_binary(const char *opname, - Item * const *args, - uint start, uint end); - static const Type_handler_geometry *type_handler_geom_by_type(uint type); - LEX_CSTRING extended_metadata_data_type_name() const; -public: - virtual ~Type_handler_geometry() {} - enum_field_types field_type() const override { return MYSQL_TYPE_GEOMETRY; } - bool Item_append_extended_type_info(Send_field_extended_metadata *to, - const Item *item) const override - { - LEX_CSTRING tmp= extended_metadata_data_type_name(); - return tmp.length ? to->set_data_type_name(tmp) : false; - } - bool is_param_long_data_type() const override { return true; } - uint32 max_display_length_for_field(const Conv_source &src) const override; - uint32 calc_pack_length(uint32 length) const override; - const Type_collection *type_collection() const override; - const Type_handler *type_handler_for_comparison() const override; - virtual geometry_types geometry_type() const { return GEOM_GEOMETRY; } - virtual Item *create_typecast_item(THD *thd, Item *item, - const Type_cast_attributes &attr) - const override; - const Type_handler *type_handler_frm_unpack(const uchar *buffer) - const override; - bool is_binary_compatible_geom_super_type_for(const Type_handler_geometry *th) - const - { - return geometry_type() == GEOM_GEOMETRY || - geometry_type() == th->geometry_type(); - } - bool type_can_have_key_part() const override { return true; } - bool subquery_type_allows_materialization(const Item *inner, - const Item *outer) const override - { - return false; // Materialization does not work with GEOMETRY columns - } - void Item_param_set_param_func(Item_param *param, - uchar **pos, ulong len) const override; - bool Item_param_set_from_value(THD *thd, - Item_param *param, - const Type_all_attributes *attr, - const st_value *value) const override; - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, uint metadata, - const Field *target) const override; - uint Column_definition_gis_options_image(uchar *buff, - const Column_definition &def) - const override; - bool Column_definition_data_type_info_image(Binary_string *to, - const Column_definition &def) - const override - { - return false; - } - void - Column_definition_attributes_frm_pack(const Column_definition_attributes *at, - uchar *buff) const override; - bool - Column_definition_attributes_frm_unpack(Column_definition_attributes *attr, - TABLE_SHARE *share, - const uchar *buffer, - LEX_CUSTRING *gis_options) const - override; - bool Column_definition_fix_attributes(Column_definition *c) const override; - void Column_definition_reuse_fix_attributes(THD *thd, - Column_definition *c, - const Field *field) const - override; - bool Column_definition_prepare_stage1(THD *thd, - MEM_ROOT *mem_root, - Column_definition *c, - handler *file, - ulonglong table_flags) const override; - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override; - bool Key_part_spec_init_primary(Key_part_spec *part, - const Column_definition &def, - const handler *file) const override; - bool Key_part_spec_init_unique(Key_part_spec *part, - const Column_definition &def, - const handler *file, - bool *has_key_needed) const override; - bool Key_part_spec_init_multiple(Key_part_spec *part, - const Column_definition &def, - const handler *file) const override; - bool Key_part_spec_init_foreign(Key_part_spec *part, - const Column_definition &def, - const handler *file) const override; - bool Key_part_spec_init_spatial(Key_part_spec *part, - const Column_definition &def) const override; - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override; - - Field *make_table_field_from_def(TABLE_SHARE *share, - MEM_ROOT *mem_root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Bit_addr &bit, - const Column_definition_attributes *attr, - uint32 flags) const override; - - bool can_return_int() const override { return false; } - bool can_return_decimal() const override { return false; } - bool can_return_real() const override { return false; } - bool can_return_text() const override { return false; } - bool can_return_date() const override { return false; } - bool can_return_time() const override { return false; } - bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override; - bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override; - bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override; - bool Item_hybrid_func_fix_attributes(THD *thd, - const char *name, - Type_handler_hybrid_field_type *h, - Type_all_attributes *attr, - Item **items, uint nitems) const - override; - bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override; - bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override; - bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override; - - bool Item_func_signed_fix_length_and_dec(Item_func_signed *) const override; - bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const - override; - bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *) const - override; - bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *) const - override; - bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *) const - override; - bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const - override; - bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *) const - override; - bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *) const - override; - bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *) const - override; -}; - - -class Type_handler_point: public Type_handler_geometry -{ - // Binary length of a POINT value: 4 byte SRID + 21 byte WKB POINT - static uint octet_length() { return 25; } -public: - geometry_types geometry_type() const override { return GEOM_POINT; } - Item *make_constructor_item(THD *thd, List *args) const override; - bool Key_part_spec_init_primary(Key_part_spec *part, - const Column_definition &def, - const handler *file) const override; - bool Key_part_spec_init_unique(Key_part_spec *part, - const Column_definition &def, - const handler *file, - bool *has_key_needed) const override; - bool Key_part_spec_init_multiple(Key_part_spec *part, - const Column_definition &def, - const handler *file) const override; - bool Key_part_spec_init_foreign(Key_part_spec *part, - const Column_definition &def, - const handler *file) const override; -}; - - -class Type_handler_linestring: public Type_handler_geometry -{ -public: - geometry_types geometry_type() const override { return GEOM_LINESTRING; } - Item *make_constructor_item(THD *thd, List *args) const override; -}; - - -class Type_handler_polygon: public Type_handler_geometry -{ -public: - geometry_types geometry_type() const override { return GEOM_POLYGON; } - Item *make_constructor_item(THD *thd, List *args) const override; -}; - - -class Type_handler_multipoint: public Type_handler_geometry -{ -public: - geometry_types geometry_type() const override { return GEOM_MULTIPOINT; } - Item *make_constructor_item(THD *thd, List *args) const override; -}; - - -class Type_handler_multilinestring: public Type_handler_geometry -{ -public: - geometry_types geometry_type() const override { return GEOM_MULTILINESTRING; } - Item *make_constructor_item(THD *thd, List *args) const override; -}; - - -class Type_handler_multipolygon: public Type_handler_geometry -{ -public: - geometry_types geometry_type() const override { return GEOM_MULTIPOLYGON; } - Item *make_constructor_item(THD *thd, List *args) const override; -}; - - -class Type_handler_geometrycollection: public Type_handler_geometry -{ -public: - geometry_types geometry_type() const override { return GEOM_GEOMETRYCOLLECTION; } - Item *make_constructor_item(THD *thd, List *args) const override; -}; - -extern Named_type_handler type_handler_geometry; -extern Named_type_handler type_handler_point; -extern Named_type_handler type_handler_linestring; -extern Named_type_handler type_handler_polygon; -extern Named_type_handler type_handler_multipoint; -extern Named_type_handler type_handler_multilinestring; -extern Named_type_handler type_handler_multipolygon; -extern Named_type_handler type_handler_geometrycollection; - -class Type_collection_geometry: public Type_collection -{ - const Type_handler *aggregate_common(const Type_handler *a, - const Type_handler *b) const - { - if (a == b) - return a; - if (dynamic_cast(a) && - dynamic_cast(b)) - return &type_handler_geometry; - return NULL; - } - const Type_handler *aggregate_if_null(const Type_handler *a, - const Type_handler *b) const - { - return a == &type_handler_null ? b : - b == &type_handler_null ? a : - NULL; - } - const Type_handler *aggregate_if_long_blob(const Type_handler *a, - const Type_handler *b) const - { - return a == &type_handler_long_blob ? &type_handler_long_blob : - b == &type_handler_long_blob ? &type_handler_long_blob : - NULL; - } - const Type_handler *aggregate_if_string(const Type_handler *a, - const Type_handler *b) const; -#ifndef DBUG_OFF - bool init_aggregators(Type_handler_data *data, const Type_handler *geom) const; -#endif -public: - bool init(Type_handler_data *data) override; - const Type_handler *handler_by_name(const LEX_CSTRING &name) const override; - const Type_handler *aggregate_for_result(const Type_handler *a, - const Type_handler *b) - const override; - const Type_handler *aggregate_for_comparison(const Type_handler *a, - const Type_handler *b) - const override; - const Type_handler *aggregate_for_min_max(const Type_handler *a, - const Type_handler *b) - const override; - const Type_handler *aggregate_for_num_op(const Type_handler *a, - const Type_handler *b) - const override - { - return NULL; - } -}; - -extern Type_collection_geometry type_collection_geometry; - -#include "field.h" - -class Field_geom :public Field_blob -{ - const Type_handler_geometry *m_type_handler; -public: - uint srid; - uint precision; - enum storage_type { GEOM_STORAGE_WKB= 0, GEOM_STORAGE_BINARY= 1}; - enum storage_type storage; - - Field_geom(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share, uint blob_pack_length, - const Type_handler_geometry *gth, - uint field_srid) - :Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, share, blob_pack_length, &my_charset_bin), - m_type_handler(gth) - { srid= field_srid; } - enum_conv_type rpl_conv_type_from(const Conv_source &source, - const Relay_log_info *rli, - const Conv_param ¶m) const override; - enum ha_base_keytype key_type() const override - { - return HA_KEYTYPE_VARBINARY2; - } - const Type_handler *type_handler() const override - { - return m_type_handler; - } - const Type_handler_geometry *type_handler_geom() const - { - return m_type_handler; - } - void set_type_handler(const Type_handler_geometry *th) - { - m_type_handler= th; - } - enum_field_types type() const override - { - return MYSQL_TYPE_GEOMETRY; - } - enum_field_types real_type() const override - { - return MYSQL_TYPE_GEOMETRY; - } - Information_schema_character_attributes - information_schema_character_attributes() const override - { - return Information_schema_character_attributes(); - } - void make_send_field(Send_field *to) override - { - Field_longstr::make_send_field(to); - LEX_CSTRING tmp= m_type_handler->extended_metadata_data_type_name(); - if (tmp.length) - to->set_data_type_name(tmp); - } - bool can_optimize_range(const Item_bool_func *cond, - const Item *item, - bool is_eq_func) const override; - void sql_type(String &str) const override; - Copy_func *get_copy_func(const Field *from) const override - { - const Type_handler_geometry *fth= - dynamic_cast(from->type_handler()); - if (fth && m_type_handler->is_binary_compatible_geom_super_type_for(fth)) - return get_identical_copy_func(); - return do_conv_blob; - } - bool memcpy_field_possible(const Field *from) const override - { - const Type_handler_geometry *fth= - dynamic_cast(from->type_handler()); - return fth && - m_type_handler->is_binary_compatible_geom_super_type_for(fth) && - !table->copy_blobs; - } - bool is_equal(const Column_definition &new_field) const override; - bool can_be_converted_by_engine(const Column_definition &new_type) - const override - { - return false; // Override the Field_blob behavior - } - - int store(const char *to, size_t length, CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int store_decimal(const my_decimal *) override; - uint size_of() const override{ return sizeof(*this); } - /** - Key length is provided only to support hash joins. (compared byte for byte) - Ex: SELECT .. FROM t1,t2 WHERE t1.field_geom1=t2.field_geom2. - - The comparison is not very relevant, as identical geometry might be - represented differently, but we need to support it either way. - */ - uint32 key_length() const override{ return packlength; } - uint get_key_image(uchar *buff,uint length, - const uchar *ptr_arg, imagetype type_arg) const override; - - /** - Non-nullable GEOMETRY types cannot have defaults, - but the underlying blob must still be reset. - */ - int reset(void) override{ return Field_blob::reset() || !maybe_null(); } - bool load_data_set_null(THD *thd) override; - bool load_data_set_no_data(THD *thd, bool fixed_format) override; - - uint get_srid() const { return srid; } - void print_key_value(String *out, uint32 length) override - { - out->append(STRING_WITH_LEN("unprintable_geometry_value")); - } - Binlog_type_info binlog_type_info() const override; -}; - -#endif // HAVE_SPATIAL - -#endif // SQL_TYPE_GEOM_H_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_int.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_int.h deleted file mode 100644 index 9fd4f0c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_int.h +++ /dev/null @@ -1,200 +0,0 @@ -/* Copyright (c) 2018, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_TYPE_INT_INCLUDED -#define SQL_TYPE_INT_INCLUDED - -#include "my_bit.h" // my_count_bits() - - -class Null_flag -{ -protected: - bool m_is_null; -public: - bool is_null() const { return m_is_null; } - Null_flag(bool is_null) :m_is_null(is_null) { } -}; - - -class Longlong -{ -protected: - longlong m_value; -public: - longlong value() const { return m_value; } - Longlong(longlong nr) :m_value(nr) { } -}; - - -class Longlong_null: public Longlong, public Null_flag -{ -public: - Longlong_null(longlong nr, bool is_null) - :Longlong(nr), Null_flag(is_null) - { } - explicit Longlong_null() - :Longlong(0), Null_flag(true) - { } - explicit Longlong_null(longlong nr) - :Longlong(nr), Null_flag(false) - { } - Longlong_null operator|(const Longlong_null &other) const - { - if (is_null() || other.is_null()) - return Longlong_null(); - return Longlong_null(value() | other.value()); - } - Longlong_null operator&(const Longlong_null &other) const - { - if (is_null() || other.is_null()) - return Longlong_null(); - return Longlong_null(value() & other.value()); - } - Longlong_null operator^(const Longlong_null &other) const - { - if (is_null() || other.is_null()) - return Longlong_null(); - return Longlong_null((longlong) (value() ^ other.value())); - } - Longlong_null operator~() const - { - if (is_null()) - return *this; - return Longlong_null((longlong) ~ (ulonglong) value()); - } - Longlong_null operator<<(const Longlong_null &llshift) const - { - if (is_null() || llshift.is_null()) - return Longlong_null(); - uint shift= (uint) llshift.value(); - ulonglong res= ((ulonglong) value()) << shift; - return Longlong_null(shift < sizeof(longlong) * 8 ? (longlong) res : 0); - } - Longlong_null operator>>(const Longlong_null &llshift) const - { - if (is_null() || llshift.is_null()) - return Longlong_null(); - uint shift= (uint) llshift.value(); - ulonglong res= ((ulonglong) value()) >> shift; - return Longlong_null(shift < sizeof(longlong) * 8 ? (longlong) res : 0); - } - Longlong_null bit_count() const - { - if (is_null()) - return *this; - return Longlong_null((longlong) my_count_bits((ulonglong) value())); - } -}; - - -// A longlong/ulonglong hybrid. Good to store results of val_int(). -class Longlong_hybrid: public Longlong -{ -protected: - bool m_unsigned; - int cmp_signed(const Longlong_hybrid& other) const - { - return m_value < other.m_value ? -1 : m_value == other.m_value ? 0 : 1; - } - int cmp_unsigned(const Longlong_hybrid& other) const - { - return (ulonglong) m_value < (ulonglong) other.m_value ? -1 : - m_value == other.m_value ? 0 : 1; - } -public: - Longlong_hybrid(longlong nr, bool unsigned_flag) - :Longlong(nr), m_unsigned(unsigned_flag) - { } - bool is_unsigned() const { return m_unsigned; } - bool is_unsigned_outside_of_signed_range() const - { - return m_unsigned && ((ulonglong) m_value) > (ulonglong) LONGLONG_MAX; - } - bool neg() const { return m_value < 0 && !m_unsigned; } - ulonglong abs() const - { - if (m_unsigned) - return (ulonglong) m_value; - if (m_value == LONGLONG_MIN) // avoid undefined behavior - return ((ulonglong) LONGLONG_MAX) + 1; - return m_value < 0 ? -m_value : m_value; - } - /* - Convert to an unsigned number: - - Negative numbers are converted to 0. - - Positive numbers bigger than upper_bound are converted to upper_bound. - - Other numbers are returned as is. - */ - ulonglong to_ulonglong(ulonglong upper_bound) const - { - return neg() ? 0 : - (ulonglong) m_value > upper_bound ? upper_bound : - (ulonglong) m_value; - } - uint to_uint(uint upper_bound) const - { - return (uint) to_ulonglong(upper_bound); - } - int cmp(const Longlong_hybrid& other) const - { - if (m_unsigned == other.m_unsigned) - return m_unsigned ? cmp_unsigned(other) : cmp_signed(other); - if (is_unsigned_outside_of_signed_range()) - return 1; - if (other.is_unsigned_outside_of_signed_range()) - return -1; - /* - The unsigned argument is in the range 0..LONGLONG_MAX. - The signed argument is in the range LONGLONG_MIN..LONGLONG_MAX. - Safe to compare as signed. - */ - return cmp_signed(other); - } - bool operator==(const Longlong_hybrid &nr) const - { - return cmp(nr) == 0; - } - bool operator==(ulonglong nr) const - { - return cmp(Longlong_hybrid((longlong) nr, true)) == 0; - } - bool operator==(uint nr) const - { - return cmp(Longlong_hybrid((longlong) nr, true)) == 0; - } - bool operator==(longlong nr) const - { - return cmp(Longlong_hybrid(nr, false)) == 0; - } - bool operator==(int nr) const - { - return cmp(Longlong_hybrid(nr, false)) == 0; - } -}; - - -class Longlong_hybrid_null: public Longlong_hybrid, - public Null_flag -{ -public: - Longlong_hybrid_null(const Longlong_null &nr, bool unsigned_flag) - :Longlong_hybrid(nr.value(), unsigned_flag), - Null_flag(nr.is_null()) - { } -}; - - -#endif // SQL_TYPE_INT_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_json.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_json.h deleted file mode 100644 index 6c4ee8c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_json.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef SQL_TYPE_JSON_INCLUDED -#define SQL_TYPE_JSON_INCLUDED -/* - Copyright (c) 2019, MariaDB - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "mariadb.h" -#include "sql_type.h" - -class Type_handler_json_longtext: public Type_handler_long_blob -{ - Virtual_column_info *make_json_valid_expr(THD *thd, - const LEX_CSTRING *field_name) - const; -public: - virtual ~Type_handler_json_longtext() {} - bool Column_definition_validate_check_constraint(THD *thd, - Column_definition *c) const; -}; - -extern MYSQL_PLUGIN_IMPORT - Type_handler_json_longtext type_handler_json_longtext; - -#endif // SQL_TYPE_JSON_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_real.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_real.h deleted file mode 100644 index 5a484fb..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_real.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2019 MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef SQL_TYPE_REAL_INCLUDED -#define SQL_TYPE_REAL_INCLUDED - -#include - -class Float -{ - float m_value; -public: - Float(float nr) - :m_value(nr) - { - DBUG_ASSERT(!std::isnan(nr)); - DBUG_ASSERT(!std::isinf(nr)); - } - Float(double nr) - :m_value((float) nr) - { - DBUG_ASSERT(!std::isnan(nr)); - DBUG_ASSERT(!std::isinf(nr)); - DBUG_ASSERT(nr <= FLT_MAX); - DBUG_ASSERT(nr >= -FLT_MAX); - } - Float(const uchar *ptr) - { - float4get(m_value, ptr); - } - bool to_string(String *to, uint dec) const; -}; - - -#endif // SQL_TYPE_REAL_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_string.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_string.h deleted file mode 100644 index fca46e9..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_type_string.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2019 MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef SQL_TYPE_STRING_INCLUDED -#define SQL_TYPE_STRING_INCLUDED - -class StringPack -{ - CHARSET_INFO *m_cs; - uint32 m_octet_length; - CHARSET_INFO *charset() const { return m_cs; } - uint mbmaxlen() const { return m_cs->mbmaxlen; }; - uint32 char_length() const { return m_octet_length / mbmaxlen(); } -public: - StringPack(CHARSET_INFO *cs, uint32 octet_length) - :m_cs(cs), - m_octet_length(octet_length) - { } - uchar *pack(uchar *to, const uchar *from, uint max_length) const; - const uchar *unpack(uchar *to, const uchar *from, const uchar *from_end, - uint param_data) const; -public: - static uint max_packed_col_length(uint max_length) - { - return (max_length > 255 ? 2 : 1) + max_length; - } - static uint packed_col_length(const uchar *data_ptr, uint length) - { - if (length > 255) - return uint2korr(data_ptr)+2; - return (uint) *data_ptr + 1; - } -}; - - -#endif // SQL_TYPE_STRING_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_udf.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_udf.h deleted file mode 100644 index cb19543..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_udf.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef SQL_UDF_INCLUDED -#define SQL_UDF_INCLUDED - -/* Copyright (c) 2000, 2003-2007 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -/* This file defines structures needed by udf functions */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface -#endif - -enum Item_udftype {UDFTYPE_FUNCTION=1,UDFTYPE_AGGREGATE}; - -typedef void (*Udf_func_clear)(UDF_INIT *, uchar *, uchar *); -typedef void (*Udf_func_add)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); -typedef void (*Udf_func_deinit)(UDF_INIT*); -typedef my_bool (*Udf_func_init)(UDF_INIT *, UDF_ARGS *, char *); -typedef void (*Udf_func_any)(); -typedef double (*Udf_func_double)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); -typedef longlong (*Udf_func_longlong)(UDF_INIT *, UDF_ARGS *, uchar *, - uchar *); - -typedef struct st_udf_func -{ - LEX_CSTRING name; - Item_result returns; - Item_udftype type; - const char *dl; - void *dlhandle; - Udf_func_any func; - Udf_func_init func_init; - Udf_func_deinit func_deinit; - Udf_func_clear func_clear; - Udf_func_add func_add; - Udf_func_add func_remove; - ulong usage_count; -} udf_func; - -class Item_result_field; - -class udf_handler :public Sql_alloc -{ - protected: - udf_func *u_d; - String *buffers; - UDF_ARGS f_args; - UDF_INIT initid; - char *num_buffer; - uchar error, is_null; - bool initialized; - Item **args; - - public: - bool not_original; - udf_handler(udf_func *udf_arg) :u_d(udf_arg), buffers(0), error(0), - is_null(0), initialized(0), not_original(0) - {} - ~udf_handler(); - const char *name() const { return u_d ? u_d->name.str : "?"; } - Item_result result_type () const - { return u_d ? u_d->returns : STRING_RESULT;} - bool get_arguments(); - bool fix_fields(THD *thd, Item_func_or_sum *item, - uint arg_count, Item **args); - void cleanup(); - double val(my_bool *null_value) - { - is_null= 0; - if (get_arguments()) - { - *null_value=1; - return 0.0; - } - Udf_func_double func= (Udf_func_double) u_d->func; - double tmp=func(&initid, &f_args, &is_null, &error); - if (is_null || error) - { - *null_value=1; - return 0.0; - } - *null_value=0; - return tmp; - } - longlong val_int(my_bool *null_value) - { - is_null= 0; - if (get_arguments()) - { - *null_value=1; - return 0; - } - Udf_func_longlong func= (Udf_func_longlong) u_d->func; - longlong tmp=func(&initid, &f_args, &is_null, &error); - if (is_null || error) - { - *null_value=1; - return 0; - } - *null_value=0; - return tmp; - } - my_decimal *val_decimal(my_bool *null_value, my_decimal *dec_buf); - void clear() - { - is_null= 0; - Udf_func_clear func= u_d->func_clear; - func(&initid, &is_null, &error); - } - void add(my_bool *null_value) - { - if (get_arguments()) - { - *null_value=1; - return; - } - Udf_func_add func= u_d->func_add; - func(&initid, &f_args, &is_null, &error); - *null_value= (my_bool) (is_null || error); - } - bool supports_removal() const - { return MY_TEST(u_d->func_remove); } - void remove(my_bool *null_value) - { - DBUG_ASSERT(u_d->func_remove); - if (get_arguments()) - { - *null_value=1; - return; - } - Udf_func_add func= u_d->func_remove; - func(&initid, &f_args, &is_null, &error); - *null_value= (my_bool) (is_null || error); - } - String *val_str(String *str,String *save_str); -}; - - -#ifdef HAVE_DLOPEN -void udf_init(void),udf_free(void); -udf_func *find_udf(const char *name, size_t size, bool mark_used=0); -void free_udf(udf_func *udf); -int mysql_create_function(THD *thd,udf_func *udf); -enum drop_udf_result -{ - UDF_DEL_RESULT_ABSENT, - UDF_DEL_RESULT_DELETED, - UDF_DEL_RESULT_ERROR -}; -enum drop_udf_result mysql_drop_function(THD *thd, const LEX_CSTRING *name); -#else -static inline void udf_init(void) { } -static inline void udf_free(void) { } -#endif -#endif /* SQL_UDF_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_union.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_union.h deleted file mode 100644 index 3776831..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_union.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_UNION_INCLUDED -#define SQL_UNION_INCLUDED - -class THD; -class select_result; -struct LEX; - -typedef class st_select_lex_unit SELECT_LEX_UNIT; - -bool mysql_union(THD *thd, LEX *lex, select_result *result, - SELECT_LEX_UNIT *unit, ulong setup_tables_done_option); - - -#endif /* SQL_UNION_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_update.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_update.h deleted file mode 100644 index 65e44d1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_update.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef SQL_UPDATE_INCLUDED -#define SQL_UPDATE_INCLUDED - -#include "sql_class.h" /* enum_duplicates */ - -class Item; -struct TABLE_LIST; -class THD; - -typedef class st_select_lex SELECT_LEX; -typedef class st_select_lex_unit SELECT_LEX_UNIT; - -bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list, - Item **conds, uint order_num, ORDER *order); -bool check_unique_table(THD *thd, TABLE_LIST *table_list); -int mysql_update(THD *thd,TABLE_LIST *tables,List &fields, - List &values,COND *conds, - uint order_num, ORDER *order, ha_rows limit, - bool ignore, ha_rows *found_return, ha_rows *updated_return); -bool mysql_multi_update(THD *thd, TABLE_LIST *table_list, - List *fields, List *values, - COND *conds, ulonglong options, - enum enum_duplicates handle_duplicates, bool ignore, - SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex, - multi_update **result); -bool records_are_comparable(const TABLE *table); -bool compare_record(const TABLE *table); - -#endif /* SQL_UPDATE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_view.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_view.h deleted file mode 100644 index c1e5dc4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_view.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef SQL_VIEW_INCLUDED -#define SQL_VIEW_INCLUDED - -/* -*- C++ -*- */ -/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. - Copyright (c) 2015, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -#include "sql_class.h" /* Required by sql_lex.h */ -#include "sql_lex.h" /* enum_view_create_mode, enum_drop_mode */ - -/* Forward declarations */ - -class File_parser; - - -/* Function declarations */ - -bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view, - enum_view_create_mode mode); - -bool mysql_create_view(THD *thd, TABLE_LIST *view, - enum_view_create_mode mode); - -bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, - bool open_view_no_parse); - - -bool mysql_drop_view(THD *thd, TABLE_LIST *view, enum_drop_mode drop_mode); - -bool check_key_in_view(THD *thd, TABLE_LIST * view); - -bool insert_view_fields(THD *thd, List *list, TABLE_LIST *view); - -int view_checksum(THD *thd, TABLE_LIST *view); -int view_check(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt); -int view_repair(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt); - -extern TYPELIB updatable_views_with_limit_typelib; - -bool check_duplicate_names(THD *thd, List& item_list, - bool gen_unique_view_names); -bool mysql_rename_view(THD *thd, const LEX_CSTRING *new_db, const LEX_CSTRING *new_name, - TABLE_LIST *view); - -void make_valid_column_names(THD *thd, List &item_list); - -#define VIEW_ANY_ACL (SELECT_ACL | UPDATE_ACL | INSERT_ACL | DELETE_ACL) - -extern const LEX_CSTRING view_type; - -void make_valid_column_names(List &item_list); - -#endif /* SQL_VIEW_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_window.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_window.h deleted file mode 100644 index 373b367..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sql_window.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - Copyright (c) 2016, 2017 MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef SQL_WINDOW_INCLUDED -#define SQL_WINDOW_INCLUDED - -#include "filesort.h" - -class Item_window_func; - -/* - Window functions module. - - Each instance of window function has its own element in SELECT_LEX::window_specs. -*/ - - -class Window_frame_bound : public Sql_alloc -{ - -public: - - enum Bound_precedence_type - { - PRECEDING, - CURRENT, // Used for CURRENT ROW window frame bounds - FOLLOWING - }; - - Bound_precedence_type precedence_type; - - - /* - For UNBOUNDED PRECEDING / UNBOUNDED FOLLOWING window frame bounds - precedence type is seto to PRECEDING / FOLLOWING and - offset is set to NULL. - The offset is not meaningful with precedence type CURRENT - */ - Item *offset; - - Window_frame_bound(Bound_precedence_type prec_type, - Item *offset_val) - : precedence_type(prec_type), offset(offset_val) {} - - bool is_unbounded() { return offset == NULL; } - - void print(String *str, enum_query_type query_type); - -}; - - -class Window_frame : public Sql_alloc -{ - -public: - - enum Frame_units - { - UNITS_ROWS, - UNITS_RANGE - }; - - enum Frame_exclusion - { - EXCL_NONE, - EXCL_CURRENT_ROW, - EXCL_GROUP, - EXCL_TIES - }; - - Frame_units units; - - Window_frame_bound *top_bound; - - Window_frame_bound *bottom_bound; - - Frame_exclusion exclusion; - - Window_frame(Frame_units win_frame_units, - Window_frame_bound *win_frame_top_bound, - Window_frame_bound *win_frame_bottom_bound, - Frame_exclusion win_frame_exclusion) - : units(win_frame_units), top_bound(win_frame_top_bound), - bottom_bound(win_frame_bottom_bound), exclusion(win_frame_exclusion) {} - - bool check_frame_bounds(); - - void print(String *str, enum_query_type query_type); - -}; - -class Window_spec : public Sql_alloc -{ - bool window_names_are_checked; - public: - virtual ~Window_spec() {} - - LEX_CSTRING *window_ref; - - SQL_I_List *partition_list; - - SQL_I_List *order_list; - - Window_frame *window_frame; - - Window_spec *referenced_win_spec; - - Window_spec(LEX_CSTRING *win_ref, - SQL_I_List *part_list, - SQL_I_List *ord_list, - Window_frame *win_frame) - : window_names_are_checked(false), window_ref(win_ref), - partition_list(part_list), order_list(ord_list), - window_frame(win_frame), referenced_win_spec(NULL) {} - - virtual const char *name() { return NULL; } - - bool check_window_names(List_iterator_fast &it); - - const char *window_reference() - { - return window_ref ? window_ref->str : NULL; - } - - void join_partition_and_order_lists() - { - *(partition_list->next)= order_list->first; - } - - void disjoin_partition_and_order_lists() - { - *(partition_list->next)= NULL; - } - - void print(String *str, enum_query_type query_type); - void print_order(String *str, enum_query_type query_type); - void print_partition(String *str, enum_query_type query_type); - -}; - -class Window_def : public Window_spec -{ - public: - - LEX_CSTRING *window_name; - - Window_def(LEX_CSTRING *win_name, - LEX_CSTRING *win_ref, - SQL_I_List *part_list, - SQL_I_List *ord_list, - Window_frame *win_frame) - : Window_spec(win_ref, part_list, ord_list, win_frame), - window_name(win_name) {} - - const char *name() { return window_name->str; } - -}; - -int setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, - List &fields, List &all_fields, - List &win_specs, List &win_funcs); - - -////////////////////////////////////////////////////////////////////////////// -// Classes that make window functions computation a part of SELECT's query plan -////////////////////////////////////////////////////////////////////////////// - -class Frame_cursor; -/* - This handles computation of one window function. - - Currently, we make a spearate filesort() call for each window function. -*/ - -class Window_func_runner : public Sql_alloc -{ -public: - /* Add the function to be computed during the execution pass */ - bool add_function_to_run(Item_window_func *win_func); - - /* Compute and fill the fields in the table. */ - bool exec(THD *thd, TABLE *tbl, SORT_INFO *filesort_result); - -private: - /* A list of window functions for which this Window_func_runner will compute - values during the execution phase. */ - List window_functions; -}; - - -/* - Represents a group of window functions that require the same sorting of - rows and so share the filesort() call. - -*/ - -class Window_funcs_sort : public Sql_alloc -{ -public: - bool setup(THD *thd, SQL_SELECT *sel, List_iterator &it, - st_join_table *join_tab); - bool exec(JOIN *join, bool keep_filesort_result); - void cleanup() { delete filesort; } - - friend class Window_funcs_computation; - -private: - Window_func_runner runner; - - /* Window functions can be computed over this sorting */ - Filesort *filesort; -}; - - -struct st_join_table; -class Explain_aggr_window_funcs; - -/* - This is a "window function computation phase": a single object of this class - takes care of computing all window functions in a SELECT. - - - JOIN optimizer is exected to call setup() during query optimization. - - JOIN::exec() should call exec() once it has collected join output in a - temporary table. -*/ - -class Window_funcs_computation : public Sql_alloc -{ - List win_func_sorts; -public: - bool setup(THD *thd, List *window_funcs, st_join_table *tab); - bool exec(JOIN *join, bool keep_last_filesort_result); - - Explain_aggr_window_funcs *save_explain_plan(MEM_ROOT *mem_root, bool is_analyze); - void cleanup(); -}; - - -#endif /* SQL_WINDOW_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ssl_compat.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/ssl_compat.h deleted file mode 100644 index 8cc0e6a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/ssl_compat.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (c) 2016, 2017 MariaDB Corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include - -/* OpenSSL version specific definitions */ -#if defined(OPENSSL_VERSION_NUMBER) - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) -#define HAVE_OPENSSL11 1 -#define SSL_LIBRARY OpenSSL_version(OPENSSL_VERSION) -#define ERR_remove_state(X) ERR_clear_error() -#define EVP_CIPHER_CTX_SIZE 176 -#define EVP_MD_CTX_SIZE 48 -#undef EVP_MD_CTX_init -#define EVP_MD_CTX_init(X) do { memset((X), 0, EVP_MD_CTX_SIZE); EVP_MD_CTX_reset(X); } while(0) -#undef EVP_CIPHER_CTX_init -#define EVP_CIPHER_CTX_init(X) do { memset((X), 0, EVP_CIPHER_CTX_SIZE); EVP_CIPHER_CTX_reset(X); } while(0) - -/* - Macros below are deprecated. OpenSSL 1.1 may define them or not, - depending on how it was built. -*/ -#undef ERR_free_strings -#define ERR_free_strings() -#undef EVP_cleanup -#define EVP_cleanup() -#undef CRYPTO_cleanup_all_ex_data -#define CRYPTO_cleanup_all_ex_data() -#undef SSL_load_error_strings -#define SSL_load_error_strings() - -#else -#define HAVE_OPENSSL10 1 -#ifdef HAVE_WOLFSSL -#define SSL_LIBRARY "WolfSSL " WOLFSSL_VERSION -#else -#define SSL_LIBRARY SSLeay_version(SSLEAY_VERSION) -#endif - -#ifdef HAVE_WOLFSSL -#undef ERR_remove_state -#define ERR_remove_state(x) do {} while(0) -#elif defined (HAVE_ERR_remove_thread_state) -#define ERR_remove_state(X) ERR_remove_thread_state(NULL) -#endif /* HAVE_ERR_remove_thread_state */ - -#endif /* HAVE_OPENSSL11 */ -#endif - -#ifdef HAVE_WOLFSSL -#define EVP_MD_CTX_SIZE sizeof(wc_Md5) -#endif - -#ifndef HAVE_OPENSSL11 -#ifndef ASN1_STRING_get0_data -#define ASN1_STRING_get0_data(X) ASN1_STRING_data(X) -#endif -#ifndef EVP_MD_CTX_SIZE -#define EVP_MD_CTX_SIZE sizeof(EVP_MD_CTX) -#endif - -#define OPENSSL_init_ssl(X,Y) SSL_library_init() -#define DH_set0_pqg(D,P,Q,G) ((D)->p= (P), (D)->g= (G)) -#define EVP_CIPHER_CTX_buf_noconst(ctx) ((ctx)->buf) -#define EVP_CIPHER_CTX_encrypting(ctx) ((ctx)->encrypt) -#define EVP_CIPHER_CTX_SIZE sizeof(EVP_CIPHER_CTX) - -#ifndef HAVE_WOLFSSL -#define EVP_MD_CTX_reset(X) EVP_MD_CTX_cleanup(X) -#define EVP_CIPHER_CTX_reset(X) EVP_CIPHER_CTX_cleanup(X) -#endif -#define X509_get0_notBefore(X) X509_get_notBefore(X) -#define X509_get0_notAfter(X) X509_get_notAfter(X) -#endif - -#ifndef TLS1_3_VERSION -#define SSL_CTX_set_ciphersuites(X,Y) 0 -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -int check_openssl_compatibility(); - -#ifdef __cplusplus -} -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/strfunc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/strfunc.h deleted file mode 100644 index b2b293e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/strfunc.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef STRFUNC_INCLUDED -#define STRFUNC_INCLUDED - -typedef struct st_typelib TYPELIB; - -ulonglong find_set(const TYPELIB *lib, - const char *x, size_t length, CHARSET_INFO *cs, - char **err_pos, uint *err_len, bool *set_warning); -ulonglong find_set_from_flags(TYPELIB *lib, uint default_name, - ulonglong cur_set, ulonglong default_set, - const char *str, uint length, CHARSET_INFO *cs, - char **err_pos, uint *err_len, bool *set_warning); -uint find_type(const TYPELIB *lib, const char *find, size_t length, - bool part_match); -uint find_type2(const TYPELIB *lib, const char *find, size_t length, - CHARSET_INFO *cs); -void unhex_type2(TYPELIB *lib); -uint check_word(TYPELIB *lib, const char *val, const char *end, - const char **end_of_word); -int find_string_in_array(LEX_CSTRING * const haystack, - LEX_CSTRING * const needle, - CHARSET_INFO * const cs); -const char *flagset_to_string(THD *thd, LEX_CSTRING *result, ulonglong set, - const char *lib[]); -const char *set_to_string(THD *thd, LEX_CSTRING *result, ulonglong set, - const char *lib[]); - -/* - These functions were protected by INNODB_COMPATIBILITY_HOOKS - */ -uint strconvert(CHARSET_INFO *from_cs, const char *from, size_t from_length, - CHARSET_INFO *to_cs, char *to, size_t to_length, uint *errors); - -#endif /* STRFUNC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/structs.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/structs.h deleted file mode 100644 index 27acb9e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/structs.h +++ /dev/null @@ -1,885 +0,0 @@ -#ifndef STRUCTS_INCLUDED -#define STRUCTS_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - - -/* The old structures from unireg */ - -#include "sql_plugin.h" /* plugin_ref */ -#include "sql_const.h" /* MAX_REFLENGTH */ -#include "my_time.h" /* enum_mysql_timestamp_type */ -#include "thr_lock.h" /* thr_lock_type */ -#include "my_base.h" /* ha_rows, ha_key_alg */ -#include /* USERNAME_LENGTH */ -#include "sql_bitmap.h" - -struct TABLE; -class Type_handler; -class Field; -class Index_statistics; - -class THD; - -typedef struct st_date_time_format { - uchar positions[8]; - char time_separator; /* Separator between hour and minute */ - uint flag; /* For future */ - LEX_CSTRING format; -} DATE_TIME_FORMAT; - - -typedef struct st_keyfile_info { /* used with ha_info() */ - uchar ref[MAX_REFLENGTH]; /* Pointer to current row */ - uchar dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */ - uint ref_length; /* Length of ref (1-8) */ - uint block_size; /* index block size */ - File filenr; /* (uniq) filenr for table */ - ha_rows records; /* Records i datafilen */ - ha_rows deleted; /* Deleted records */ - ulonglong data_file_length; /* Length off data file */ - ulonglong max_data_file_length; /* Length off data file */ - ulonglong index_file_length; - ulonglong max_index_file_length; - ulonglong delete_length; /* Free bytes */ - ulonglong auto_increment_value; - int errkey,sortkey; /* Last errorkey and sorted by */ - time_t create_time; /* When table was created */ - time_t check_time; - time_t update_time; - ulong mean_rec_length; /* physical reclength */ -} KEYFILE_INFO; - - -typedef struct st_key_part_info { /* Info about a key part */ - Field *field; /* the Field object for the indexed - prefix of the original table Field. - NOT necessarily the original Field */ - uint offset; /* Offset in record (from 0) */ - uint null_offset; /* Offset to null_bit in record */ - /* Length of key part in bytes, excluding NULL flag and length bytes */ - uint16 length; - /* - Number of bytes required to store the keypart value. This may be - different from the "length" field as it also counts - - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) - - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length. - */ - uint16 store_length; - uint16 key_type; - uint16 fieldnr; /* Fieldnr begins counting from 1 */ - uint16 key_part_flag; /* 0 or HA_REVERSE_SORT */ - uint8 type; - uint8 null_bit; /* Position to null_bit */ -} KEY_PART_INFO ; - -class engine_option_value; -struct ha_index_option_struct; - -typedef struct st_key { - uint key_length; /* Tot length of key */ - ulong flags; /* dupp key and pack flags */ - uint user_defined_key_parts; /* How many key_parts */ - uint usable_key_parts; /* Should normally be = user_defined_key_parts */ - uint ext_key_parts; /* Number of key parts in extended key */ - ulong ext_key_flags; /* Flags for extended key */ - /* - Parts of primary key that are in the extension of this index. - - Example: if this structure describes idx1, which is defined as - INDEX idx1 (pk2, col2) - and pk is defined as: - PRIMARY KEY (pk1, pk2) - then - pk1 is in the extension idx1, ext_key_part_map.is_set(0) == true - pk2 is explicitly present in idx1, it is not in the extension, so - ext_key_part_map.is_set(1) == false - */ - key_part_map ext_key_part_map; - /* - Bitmap of indexes having common parts with this index - (only key parts from key definitions are taken into account) - */ - key_map overlapped; - /* Set of keys constraint correlated with this key */ - key_map constraint_correlated; - LEX_CSTRING name; - uint block_size; - enum ha_key_alg algorithm; - /* - The flag is on if statistical data for the index prefixes - has to be taken from the system statistical tables. - */ - bool is_statistics_from_stat_tables; - /* - Note that parser is used when the table is opened for use, and - parser_name is used when the table is being created. - */ - union - { - plugin_ref parser; /* Fulltext [pre]parser */ - LEX_CSTRING *parser_name; /* Fulltext [pre]parser name */ - }; - KEY_PART_INFO *key_part; - /* Unique name for cache; db + \0 + table_name + \0 + key_name + \0 */ - uchar *cache_name; - /* - Array of AVG(#records with the same field value) for 1st ... Nth key part. - 0 means 'not known'. - For temporary heap tables this member is NULL. - */ - ulong *rec_per_key; - - /* - This structure is used for statistical data on the index - that has been read from the statistical table index_stat - */ - Index_statistics *read_stats; - /* - This structure is used for statistical data on the index that - is collected by the function collect_statistics_for_table - */ - Index_statistics *collected_stats; - - TABLE *table; - LEX_CSTRING comment; - /** reference to the list of options or NULL */ - engine_option_value *option_list; - ha_index_option_struct *option_struct; /* structure with parsed options */ - - double actual_rec_per_key(uint i); - - bool without_overlaps; -} KEY; - - -struct st_join_table; - -typedef struct st_reginfo { /* Extra info about reg */ - struct st_join_table *join_tab; /* Used by SELECT() */ - enum thr_lock_type lock_type; /* How database is used */ - bool not_exists_optimize; - /* - TRUE <=> range optimizer found that there is no rows satisfying - table conditions. - */ - bool impossible_range; -} REGINFO; - - -/* - Originally MySQL used MYSQL_TIME structure inside server only, but since - 4.1 it's exported to user in the new client API. Define aliases for - new names to keep existing code simple. -*/ - -typedef enum enum_mysql_timestamp_type timestamp_type; - - -typedef struct { - ulong year,month,day,hour; - ulonglong minute,second,second_part; - bool neg; -} INTERVAL; - - -typedef struct st_known_date_time_format { - const char *format_name; - const char *date_format; - const char *datetime_format; - const char *time_format; -} KNOWN_DATE_TIME_FORMAT; - -extern const char *show_comp_option_name[]; - -typedef int *(*update_var)(THD *, struct st_mysql_show_var *); - -struct USER_AUTH : public Sql_alloc -{ - LEX_CSTRING plugin, auth_str, pwtext; - USER_AUTH *next; - USER_AUTH() : next(NULL) - { - plugin.str= auth_str.str= ""; - pwtext.str= NULL; - plugin.length= auth_str.length= pwtext.length= 0; - } -}; - -struct AUTHID -{ - LEX_CSTRING user, host; - void init() { memset(this, 0, sizeof(*this)); } - void copy(MEM_ROOT *root, const LEX_CSTRING *usr, const LEX_CSTRING *host); - bool is_role() const { return user.str[0] && !host.str[0]; } - void set_lex_string(LEX_CSTRING *l, char *buf) - { - if (is_role()) - *l= user; - else - { - l->str= buf; - l->length= strxmov(buf, user.str, "@", host.str, NullS) - buf; - } - } - void parse(const char *str, size_t length); - bool read_from_mysql_proc_row(THD *thd, TABLE *table); -}; - - -struct LEX_USER: public AUTHID -{ - USER_AUTH *auth; - bool has_auth() - { - return auth && (auth->plugin.length || auth->auth_str.length || auth->pwtext.length); - } -}; - -/* - This structure specifies the maximum amount of resources which - can be consumed by each account. Zero value of a member means - there is no limit. -*/ -typedef struct user_resources { - /* Maximum number of queries/statements per hour. */ - uint questions; - /* - Maximum number of updating statements per hour (which statements are - updating is defined by sql_command_flags array). - */ - uint updates; - /* Maximum number of connections established per hour. */ - uint conn_per_hour; - /* - Maximum number of concurrent connections. If -1 then no new - connections allowed - */ - int user_conn; - /* Max query timeout */ - double max_statement_time; - - /* - Values of this enum and specified_limits member are used by the - parser to store which user limits were specified in GRANT statement. - */ - enum {QUERIES_PER_HOUR= 1, UPDATES_PER_HOUR= 2, CONNECTIONS_PER_HOUR= 4, - USER_CONNECTIONS= 8, MAX_STATEMENT_TIME= 16}; - uint specified_limits; -} USER_RESOURCES; - - -/* - This structure is used for counting resources consumed and for checking - them against specified user limits. -*/ -typedef struct user_conn { - /* - Pointer to user+host key (pair separated by '\0') defining the entity - for which resources are counted (By default it is user account thus - priv_user/priv_host pair is used. If --old-style-user-limits option - is enabled, resources are counted for each user+host separately). - */ - char *user; - /* Pointer to host part of the key. */ - char *host; - /** - The moment of time when per hour counters were reset last time - (i.e. start of "hour" for conn_per_hour, updates, questions counters). - */ - ulonglong reset_utime; - /* Total length of the key. */ - uint len; - /* Current amount of concurrent connections for this account. */ - int connections; - /* - Current number of connections per hour, number of updating statements - per hour and total number of statements per hour for this account. - */ - uint conn_per_hour, updates, questions; - /* Maximum amount of resources which account is allowed to consume. */ - USER_RESOURCES user_resources; -} USER_CONN; - -typedef struct st_user_stats -{ - char user[MY_MAX(USERNAME_LENGTH, LIST_PROCESS_HOST_LEN) + 1]; - // Account name the user is mapped to when this is a user from mapped_user. - // Otherwise, the same value as user. - char priv_user[MY_MAX(USERNAME_LENGTH, LIST_PROCESS_HOST_LEN) + 1]; - uint user_name_length; - uint total_connections; - uint total_ssl_connections; - uint concurrent_connections; - time_t connected_time; // in seconds - ha_rows rows_read, rows_sent; - ha_rows rows_updated, rows_deleted, rows_inserted; - ulonglong bytes_received; - ulonglong bytes_sent; - ulonglong binlog_bytes_written; - ulonglong select_commands, update_commands, other_commands; - ulonglong commit_trans, rollback_trans; - ulonglong denied_connections, lost_connections, max_statement_time_exceeded; - ulonglong access_denied_errors; - ulonglong empty_queries; - double busy_time; // in seconds - double cpu_time; // in seconds -} USER_STATS; - -typedef struct st_table_stats -{ - char table[NAME_LEN * 2 + 2]; // [db] + '\0' + [table] + '\0' - size_t table_name_length; - ulonglong rows_read, rows_changed; - ulonglong rows_changed_x_indexes; - /* Stores enum db_type, but forward declarations cannot be done */ - int engine_type; -} TABLE_STATS; - -typedef struct st_index_stats -{ - // [db] + '\0' + [table] + '\0' + [index] + '\0' - char index[NAME_LEN * 3 + 3]; - size_t index_name_length; /* Length of 'index' */ - ulonglong rows_read; -} INDEX_STATS; - - - /* Bits in form->update */ -#define REG_MAKE_DUPP 1U /* Make a copy of record when read */ -#define REG_NEW_RECORD 2U /* Write a new record if not found */ -#define REG_UPDATE 4U /* Uppdate record */ -#define REG_DELETE 8U /* Delete found record */ -#define REG_PROG 16U /* User is updating database */ -#define REG_CLEAR_AFTER_WRITE 32U -#define REG_MAY_BE_UPDATED 64U -#define REG_AUTO_UPDATE 64U /* Used in D-forms for scroll-tables */ -#define REG_OVERWRITE 128U -#define REG_SKIP_DUP 256U - - /* Bits in form->status */ -#define STATUS_NO_RECORD (1U+2U) /* Record isn't usable */ -#define STATUS_GARBAGE 1U -#define STATUS_NOT_FOUND 2U /* No record in database when needed */ -#define STATUS_NO_PARENT 4U /* Parent record wasn't found */ -#define STATUS_NOT_READ 8U /* Record isn't read */ -#define STATUS_UPDATED 16U /* Record is updated by formula */ -#define STATUS_NULL_ROW 32U /* table->null_row is set */ -#define STATUS_DELETED 64U - -/* - Such interval is "discrete": it is the set of - { auto_inc_interval_min + k * increment, - 0 <= k <= (auto_inc_interval_values-1) } - Where "increment" is maintained separately by the user of this class (and is - currently only thd->variables.auto_increment_increment). - It mustn't derive from Sql_alloc, because SET INSERT_ID needs to - allocate memory which must stay allocated for use by the next statement. -*/ -class Discrete_interval { -private: - ulonglong interval_min; - ulonglong interval_values; - ulonglong interval_max; // excluded bound. Redundant. -public: - Discrete_interval *next; // used when linked into Discrete_intervals_list - void replace(ulonglong start, ulonglong val, ulonglong incr) - { - interval_min= start; - interval_values= val; - interval_max= (val == ULONGLONG_MAX) ? val : start + val * incr; - } - Discrete_interval(ulonglong start, ulonglong val, ulonglong incr) : - next(NULL) { replace(start, val, incr); }; - Discrete_interval() : next(NULL) { replace(0, 0, 0); }; - ulonglong minimum() const { return interval_min; }; - ulonglong values() const { return interval_values; }; - ulonglong maximum() const { return interval_max; }; - /* - If appending [3,5] to [1,2], we merge both in [1,5] (they should have the - same increment for that, user of the class has to ensure that). That is - just a space optimization. Returns 0 if merge succeeded. - */ - bool merge_if_contiguous(ulonglong start, ulonglong val, ulonglong incr) - { - if (interval_max == start) - { - if (val == ULONGLONG_MAX) - { - interval_values= interval_max= val; - } - else - { - interval_values+= val; - interval_max= start + val * incr; - } - return 0; - } - return 1; - }; -}; - -/* List of Discrete_interval objects */ -class Discrete_intervals_list { -private: - Discrete_interval *head; - Discrete_interval *tail; - /* - When many intervals are provided at the beginning of the execution of a - statement (in a replication slave or SET INSERT_ID), "current" points to - the interval being consumed by the thread now (so "current" goes from - "head" to "tail" then to NULL). - */ - Discrete_interval *current; - uint elements; // number of elements - void set_members(Discrete_interval *h, Discrete_interval *t, - Discrete_interval *c, uint el) - { - head= h; - tail= t; - current= c; - elements= el; - } - void operator=(Discrete_intervals_list &); /* prevent use of these */ - Discrete_intervals_list(const Discrete_intervals_list &); - -public: - Discrete_intervals_list() : head(NULL), current(NULL), elements(0) {}; - void empty_no_free() - { - set_members(NULL, NULL, NULL, 0); - } - void empty() - { - for (Discrete_interval *i= head; i;) - { - Discrete_interval *next= i->next; - delete i; - i= next; - } - empty_no_free(); - } - void copy_shallow(const Discrete_intervals_list * dli) - { - head= dli->get_head(); - tail= dli->get_tail(); - current= dli->get_current(); - elements= dli->nb_elements(); - } - void swap (Discrete_intervals_list * dli) - { - Discrete_interval *h, *t, *c; - uint el; - h= dli->get_head(); - t= dli->get_tail(); - c= dli->get_current(); - el= dli->nb_elements(); - dli->copy_shallow(this); - set_members(h, t, c, el); - } - const Discrete_interval* get_next() - { - Discrete_interval *tmp= current; - if (current != NULL) - current= current->next; - return tmp; - } - ~Discrete_intervals_list() { empty(); }; - bool append(ulonglong start, ulonglong val, ulonglong incr); - bool append(Discrete_interval *interval); - ulonglong minimum() const { return (head ? head->minimum() : 0); }; - ulonglong maximum() const { return (head ? tail->maximum() : 0); }; - uint nb_elements() const { return elements; } - Discrete_interval* get_head() const { return head; }; - Discrete_interval* get_tail() const { return tail; }; - Discrete_interval* get_current() const { return current; }; -}; - - -/* - DDL options: - - CREATE IF NOT EXISTS - - DROP IF EXISTS - - CREATE LIKE - - REPLACE -*/ -struct DDL_options_st -{ -public: - enum Options - { - OPT_NONE= 0, - OPT_IF_NOT_EXISTS= 2, // CREATE TABLE IF NOT EXISTS - OPT_LIKE= 4, // CREATE TABLE LIKE - OPT_OR_REPLACE= 16, // CREATE OR REPLACE TABLE - OPT_OR_REPLACE_SLAVE_GENERATED= 32,// REPLACE was added on slave, it was - // not in the original query on master. - OPT_IF_EXISTS= 64 - }; - -private: - Options m_options; - -public: - Options create_like_options() const - { - return (DDL_options_st::Options) - (((uint) m_options) & (OPT_IF_NOT_EXISTS | OPT_OR_REPLACE)); - } - void init() { m_options= OPT_NONE; } - void init(Options options) { m_options= options; } - void set(Options other) - { - m_options= other; - } - void set(const DDL_options_st other) - { - m_options= other.m_options; - } - bool if_not_exists() const { return m_options & OPT_IF_NOT_EXISTS; } - bool or_replace() const { return m_options & OPT_OR_REPLACE; } - bool or_replace_slave_generated() const - { return m_options & OPT_OR_REPLACE_SLAVE_GENERATED; } - bool like() const { return m_options & OPT_LIKE; } - bool if_exists() const { return m_options & OPT_IF_EXISTS; } - void add(const DDL_options_st::Options other) - { - m_options= (Options) ((uint) m_options | (uint) other); - } - void add(const DDL_options_st &other) - { - add(other.m_options); - } - DDL_options_st operator|(const DDL_options_st &other) - { - add(other.m_options); - return *this; - } - DDL_options_st operator|=(DDL_options_st::Options other) - { - add(other); - return *this; - } -}; - - -class DDL_options: public DDL_options_st -{ -public: - DDL_options() { init(); } - DDL_options(Options options) { init(options); } - DDL_options(const DDL_options_st &options) - { DDL_options_st::operator=(options); } -}; - - -struct Lex_length_and_dec_st -{ -private: - const char *m_length; - const char *m_dec; -public: - void set(const char *length, const char *dec) - { - m_length= length; - m_dec= dec; - } - const char *length() const { return m_length; } - const char *dec() const { return m_dec; } -}; - - -struct Lex_field_type_st: public Lex_length_and_dec_st -{ -private: - const Type_handler *m_handler; - void set(const Type_handler *handler, const char *length, const char *dec) - { - m_handler= handler; - Lex_length_and_dec_st::set(length, dec); - } -public: - void set(const Type_handler *handler, Lex_length_and_dec_st length_and_dec) - { - m_handler= handler; - Lex_length_and_dec_st::operator=(length_and_dec); - } - void set_handler_length_flags(const Type_handler *handler, const char *length, - uint32 flags); - void set(const Type_handler *handler, const char *length) - { - set(handler, length, 0); - } - void set(const Type_handler *handler) - { - set(handler, 0, 0); - } - void set_handler(const Type_handler *handler) - { - m_handler= handler; - } - const Type_handler *type_handler() const { return m_handler; } -}; - - -struct Lex_dyncol_type_st: public Lex_length_and_dec_st -{ -private: - int m_type; // enum_dynamic_column_type is not visible here, so use int -public: - void set(int type, const char *length, const char *dec) - { - m_type= type; - Lex_length_and_dec_st::set(length, dec); - } - void set(int type, Lex_length_and_dec_st length_and_dec) - { - m_type= type; - Lex_length_and_dec_st::operator=(length_and_dec); - } - void set(int type, const char *length) - { - set(type, length, 0); - } - void set(int type) - { - set(type, 0, 0); - } - int dyncol_type() const { return m_type; } -}; - - -struct Lex_spblock_handlers_st -{ -public: - int hndlrs; - void init(int count) { hndlrs= count; } -}; - - -struct Lex_spblock_st: public Lex_spblock_handlers_st -{ -public: - int vars; - int conds; - int curs; - void init() - { - vars= conds= hndlrs= curs= 0; - } - void init_using_vars(uint nvars) - { - vars= nvars; - conds= hndlrs= curs= 0; - } - void join(const Lex_spblock_st &b1, const Lex_spblock_st &b2) - { - vars= b1.vars + b2.vars; - conds= b1.conds + b2.conds; - hndlrs= b1.hndlrs + b2.hndlrs; - curs= b1.curs + b2.curs; - } -}; - - -class Lex_spblock: public Lex_spblock_st -{ -public: - Lex_spblock() { init(); } - Lex_spblock(const Lex_spblock_handlers_st &other) - { - vars= conds= curs= 0; - hndlrs= other.hndlrs; - } -}; - - -struct Lex_for_loop_bounds_st -{ -public: - class sp_assignment_lex *m_index; // The first iteration value (or cursor) - class sp_assignment_lex *m_target_bound; // The last iteration value - int8 m_direction; - bool m_implicit_cursor; - bool is_for_loop_cursor() const { return m_target_bound == NULL; } -}; - - -class Lex_for_loop_bounds_intrange: public Lex_for_loop_bounds_st -{ -public: - Lex_for_loop_bounds_intrange(int8 direction, - class sp_assignment_lex *left_expr, - class sp_assignment_lex *right_expr) - { - m_direction= direction; - m_index= direction > 0 ? left_expr : right_expr; - m_target_bound= direction > 0 ? right_expr : left_expr; - m_implicit_cursor= false; - } -}; - - -struct Lex_for_loop_st -{ -public: - class sp_variable *m_index; // The first iteration value (or cursor) - class sp_variable *m_target_bound; // The last iteration value - int m_cursor_offset; - int8 m_direction; - bool m_implicit_cursor; - void init() - { - m_index= 0; - m_target_bound= 0; - m_direction= 0; - m_implicit_cursor= false; - } - void init(const Lex_for_loop_st &other) - { - *this= other; - } - bool is_for_loop_cursor() const { return m_target_bound == NULL; } - bool is_for_loop_explicit_cursor() const - { - return is_for_loop_cursor() && !m_implicit_cursor; - } -}; - - -enum trim_spec { TRIM_LEADING, TRIM_TRAILING, TRIM_BOTH }; - -struct Lex_trim_st -{ - Item *m_remove; - Item *m_source; - trim_spec m_spec; -public: - void set(trim_spec spec, Item *remove, Item *source) - { - m_spec= spec; - m_remove= remove; - m_source= source; - } - void set(trim_spec spec, Item *source) - { - set(spec, NULL, source); - } - Item *make_item_func_trim_std(THD *thd) const; - Item *make_item_func_trim_oracle(THD *thd) const; - Item *make_item_func_trim(THD *thd) const; -}; - - -class Lex_trim: public Lex_trim_st -{ -public: - Lex_trim(trim_spec spec, Item *source) { set(spec, source); } -}; - - -class st_select_lex; - -class Lex_select_lock -{ -public: - struct - { - uint defined_lock:1; - uint update_lock:1; - uint defined_timeout:1; - }; - ulong timeout; - - - void empty() - { - defined_lock= update_lock= defined_timeout= FALSE; - timeout= 0; - } - void set_to(st_select_lex *sel); -}; - -class Lex_select_limit -{ -public: - bool explicit_limit; - Item *select_limit, *offset_limit; - - void empty() - { - explicit_limit= FALSE; - select_limit= offset_limit= NULL; - } -}; - -struct st_order; - -class Load_data_param -{ -protected: - CHARSET_INFO *m_charset; // Character set of the file - ulonglong m_fixed_length; // Sum of target field lengths for fixed format - bool m_is_fixed_length; - bool m_use_blobs; -public: - Load_data_param(CHARSET_INFO *cs, bool is_fixed_length): - m_charset(cs), - m_fixed_length(0), - m_is_fixed_length(is_fixed_length), - m_use_blobs(false) - { } - bool add_outvar_field(THD *thd, const Field *field); - bool add_outvar_user_var(THD *thd); - CHARSET_INFO *charset() const { return m_charset; } - bool is_fixed_length() const { return m_is_fixed_length; } - bool use_blobs() const { return m_use_blobs; } -}; - - -class Load_data_outvar -{ -public: - virtual ~Load_data_outvar() {} - virtual bool load_data_set_null(THD *thd, const Load_data_param *param)= 0; - virtual bool load_data_set_value(THD *thd, const char *pos, uint length, - const Load_data_param *param)= 0; - virtual bool load_data_set_no_data(THD *thd, const Load_data_param *param)= 0; - virtual void load_data_print_for_log_event(THD *thd, class String *to) const= 0; - virtual bool load_data_add_outvar(THD *thd, Load_data_param *param) const= 0; - virtual uint load_data_fixed_length() const= 0; -}; - - -class Timeval: public timeval -{ -protected: - Timeval() { } -public: - Timeval(my_time_t sec, ulong usec) - { - tv_sec= sec; - tv_usec= usec; - } - explicit Timeval(const timeval &tv) - :timeval(tv) - { } -}; - - -#endif /* STRUCTS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sys_vars_shared.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/sys_vars_shared.h deleted file mode 100644 index bc48d1f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/sys_vars_shared.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef SYS_VARS_SHARED_INCLUDED -#define SYS_VARS_SHARED_INCLUDED - -/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/** - @file - "protected" interface to sys_var - server configuration variables. - - This header is included by files implementing support and utility - functions of sys_var's (set_var.cc) and files implementing - classes in the sys_var hierarchy (sql_plugin.cc) -*/ - -#include -#include "set_var.h" - -extern bool throw_bounds_warning(THD *thd, const char *name,const char *v); -extern bool throw_bounds_warning(THD *thd, const char *name, - bool fixed, bool is_unsigned, longlong v); -extern bool throw_bounds_warning(THD *thd, const char *name, bool fixed, - double v); -extern sys_var *intern_find_sys_var(const char *str, size_t length); - -extern sys_var_chain all_sys_vars; - -/** wrapper to hide a mutex and an rwlock under a common interface */ -class PolyLock -{ -public: - virtual void rdlock()= 0; - virtual void wrlock()= 0; - virtual void unlock()= 0; - virtual ~PolyLock() {} -}; - -class PolyLock_mutex: public PolyLock -{ - mysql_mutex_t *mutex; -public: - PolyLock_mutex(mysql_mutex_t *arg): mutex(arg) {} - void rdlock() { mysql_mutex_lock(mutex); } - void wrlock() { mysql_mutex_lock(mutex); } - void unlock() { mysql_mutex_unlock(mutex); } -}; - -class PolyLock_rwlock: public PolyLock -{ - mysql_rwlock_t *rwlock; -public: - PolyLock_rwlock(mysql_rwlock_t *arg): rwlock(arg) {} - void rdlock() { mysql_rwlock_rdlock(rwlock); } - void wrlock() { mysql_rwlock_wrlock(rwlock); } - void unlock() { mysql_rwlock_unlock(rwlock); } -}; - -class AutoWLock -{ - PolyLock *lock; -public: - AutoWLock(PolyLock *l) : lock(l) { if (lock) lock->wrlock(); } - ~AutoWLock() { if (lock) lock->unlock(); } -}; - -class AutoRLock -{ - PolyLock *lock; -public: - AutoRLock(PolyLock *l) : lock(l) { if (lock) lock->rdlock(); } - ~AutoRLock() { if (lock) lock->unlock(); } -}; - - -#endif /* SYS_VARS_SHARED_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/t_ctype.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/t_ctype.h deleted file mode 100644 index 9164c62..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/t_ctype.h +++ /dev/null @@ -1,255 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - Use is subject to license terms - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved. - Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved. - Permission to use, copy, modify, distribute and sell this software - and its documentation for any purpose is hereby granted without fee, - provided that the above copyright notice appear in all copies. - Smaphan Raruenrom and Pruet Boonma makes no representations about - the suitability of this software for any purpose. It is provided - "as is" without express or implied warranty. -*/ - -/* LC_COLLATE category + Level information */ - -#ifndef _t_ctype_h -#define _t_ctype_h - -#define TOT_LEVELS 5 -#define LAST_LEVEL 4 /* TOT_LEVELS - 1 */ - -#define IGNORE 0 - - -/* level 1 symbols & order */ -enum l1_symbols { - L1_08 = TOT_LEVELS, - L1_18, - L1_28, - L1_38, - L1_48, - L1_58, - L1_68, - L1_78, - L1_88, - L1_98, - L1_A8, - L1_B8, - L1_C8, - L1_D8, - L1_E8, - L1_F8, - L1_G8, - L1_H8, - L1_I8, - L1_J8, - L1_K8, - L1_L8, - L1_M8, - L1_N8, - L1_O8, - L1_P8, - L1_Q8, - L1_R8, - L1_S8, - L1_T8, - L1_U8, - L1_V8, - L1_W8, - L1_X8, - L1_Y8, - L1_Z8, - L1_KO_KAI, - L1_KHO_KHAI, - L1_KHO_KHUAT, - L1_KHO_KHWAI, - L1_KHO_KHON, - L1_KHO_RAKHANG, - L1_NGO_NGU, - L1_CHO_CHAN, - L1_CHO_CHING, - L1_CHO_CHANG, - L1_SO_SO, - L1_CHO_CHOE, - L1_YO_YING, - L1_DO_CHADA, - L1_TO_PATAK, - L1_THO_THAN, - L1_THO_NANGMONTHO, - L1_THO_PHUTHAO, - L1_NO_NEN, - L1_DO_DEK, - L1_TO_TAO, - L1_THO_THUNG, - L1_THO_THAHAN, - L1_THO_THONG, - L1_NO_NU, - L1_BO_BAIMAI, - L1_PO_PLA, - L1_PHO_PHUNG, - L1_FO_FA, - L1_PHO_PHAN, - L1_FO_FAN, - L1_PHO_SAMPHAO, - L1_MO_MA, - L1_YO_YAK, - L1_RO_RUA, - L1_RU, - L1_LO_LING, - L1_LU, - L1_WO_WAEN, - L1_SO_SALA, - L1_SO_RUSI, - L1_SO_SUA, - L1_HO_HIP, - L1_LO_CHULA, - L1_O_ANG, - L1_HO_NOKHUK, - L1_NKHIT, - L1_SARA_A, - L1_MAI_HAN_AKAT, - L1_SARA_AA, - L1_SARA_AM, - L1_SARA_I, - L1_SARA_II, - L1_SARA_UE, - L1_SARA_UEE, - L1_SARA_U, - L1_SARA_UU, - L1_SARA_E, - L1_SARA_AE, - L1_SARA_O, - L1_SARA_AI_MAIMUAN, - L1_SARA_AI_MAIMALAI -}; - -/* level 2 symbols & order */ -enum l2_symbols { - L2_BLANK = TOT_LEVELS, - L2_THAII, - L2_YAMAK, - L2_PINTHU, - L2_GARAN, - L2_TYKHU, - L2_TONE1, - L2_TONE2, - L2_TONE3, - L2_TONE4 -}; - -/* level 3 symbols & order */ -enum l3_symbols { - L3_BLANK = TOT_LEVELS, - L3_SPACE, - L3_NB_SACE, - L3_LOW_LINE, - L3_HYPHEN, - L3_COMMA, - L3_SEMICOLON, - L3_COLON, - L3_EXCLAMATION, - L3_QUESTION, - L3_SOLIDUS, - L3_FULL_STOP, - L3_PAIYAN_NOI, - L3_MAI_YAMOK, - L3_GRAVE, - L3_CIRCUMFLEX, - L3_TILDE, - L3_APOSTROPHE, - L3_QUOTATION, - L3_L_PARANTHESIS, - L3_L_BRACKET, - L3_L_BRACE, - L3_R_BRACE, - L3_R_BRACKET, - L3_R_PARENTHESIS, - L3_AT, - L3_BAHT, - L3_DOLLAR, - L3_FONGMAN, - L3_ANGKHANKHU, - L3_KHOMUT, - L3_ASTERISK, - L3_BK_SOLIDUS, - L3_AMPERSAND, - L3_NUMBER, - L3_PERCENT, - L3_PLUS, - L3_LESS_THAN, - L3_EQUAL, - L3_GREATER_THAN, - L3_V_LINE -}; - -/* level 4 symbols & order */ -enum l4_symbols { - L4_BLANK = TOT_LEVELS, - L4_MIN, - L4_CAP, - L4_EXT -}; - -enum level_symbols { - L_UPRUPR = TOT_LEVELS, - L_UPPER, - L_MIDDLE, - L_LOWER -}; - -#define _is(c) (t_ctype[(c)][LAST_LEVEL]) -#define _level 8 -#define _consnt 16 -#define _ldvowel 32 -#define _fllwvowel 64 -#define _uprvowel 128 -#define _lwrvowel 256 -#define _tone 512 -#define _diacrt1 1024 -#define _diacrt2 2048 -#define _combine 4096 -#define _stone 8192 -#define _tdig 16384 -#define _rearvowel (_fllwvowel | _uprvowel | _lwrvowel) -#define _diacrt (_diacrt1 | _diacrt2) -#define levelof(c) ( _is(c) & _level ) -#define isthai(c) ( (c) >= 128 ) -#define istalpha(c) ( _is(c) & (_consnt|_ldvowel|_rearvowel|\ - _tone|_diacrt1|_diacrt2) ) -#define isconsnt(c) ( _is(c) & _consnt ) -#define isldvowel(c) ( _is(c) & _ldvowel ) -#define isfllwvowel(c) ( _is(c) & _fllwvowel ) -#define ismidvowel(c) ( _is(c) & (_ldvowel|_fllwvowel) ) -#define isuprvowel(c) ( _is(c) & _uprvowel ) -#define islwrvowel(c) ( _is(c) & _lwrvowel ) -#define isuprlwrvowel(c) ( _is(c) & (_lwrvowel | _uprvowel)) -#define isrearvowel(c) ( _is(c) & _rearvowel ) -#define isvowel(c) ( _is(c) & (_ldvowel|_rearvowel) ) -#define istone(c) ( _is(c) & _tone ) -#define isunldable(c) ( _is(c) & (_rearvowel|_tone|_diacrt1|_diacrt2) ) -#define iscombinable(c) ( _is(c) & _combine ) -#define istdigit(c) ( _is(c) & _tdig ) -#define isstone(c) ( _is(c) & _stone ) -#define isdiacrt1(c) ( _is(c) & _diacrt1) -#define isdiacrt2(c) ( _is(c) & _diacrt2) -#define isdiacrt(c) ( _is(c) & _diacrt) - -/* Function prototype called by sql/field.cc */ -void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length); - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/table.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/table.h deleted file mode 100644 index ec865f2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/table.h +++ /dev/null @@ -1,3348 +0,0 @@ -#ifndef TABLE_INCLUDED -#define TABLE_INCLUDED -/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#include "sql_plist.h" -#include "sql_list.h" /* Sql_alloc */ -#include "mdl.h" -#include "datadict.h" -#include "sql_string.h" /* String */ -#include "lex_string.h" - -#ifndef MYSQL_CLIENT - -#include "my_cpu.h" /* LF_BACKOFF() */ -#include "hash.h" /* HASH */ -#include "handler.h" /* row_type, ha_choice, handler */ -#include "mysql_com.h" /* enum_field_types */ -#include "thr_lock.h" /* thr_lock_type */ -#include "filesort_utils.h" -#include "parse_file.h" -#include "sql_i_s.h" -#include "sql_type.h" /* vers_kind_t */ -#include "privilege.h" /* privilege_t */ - -/* Structs that defines the TABLE */ - -class Item; /* Needed by ORDER */ -typedef Item (*Item_ptr); -class Item_subselect; -class Item_field; -class GRANT_TABLE; -class st_select_lex_unit; -class st_select_lex; -class partition_info; -class COND_EQUAL; -class Security_context; -struct TABLE_LIST; -class ACL_internal_schema_access; -class ACL_internal_table_access; -class Field; -class Table_statistics; -class With_element; -struct TDC_element; -class Virtual_column_info; -class Table_triggers_list; -class TMP_TABLE_PARAM; -class SEQUENCE; -class Range_rowid_filter_cost_info; -class derived_handler; -class Pushdown_derived; -struct Name_resolution_context; - -/* - Used to identify NESTED_JOIN structures within a join (applicable only to - structures that have not been simplified away and embed more the one - element) -*/ -typedef ulonglong nested_join_map; - - -#define tmp_file_prefix "#sql" /**< Prefix for tmp tables */ -#define tmp_file_prefix_length 4 -#define TMP_TABLE_KEY_EXTRA 8 - -/** - Enumerate possible types of a table from re-execution - standpoint. - TABLE_LIST class has a member of this type. - At prepared statement prepare, this member is assigned a value - as of the current state of the database. Before (re-)execution - of a prepared statement, we check that the value recorded at - prepare matches the type of the object we obtained from the - table definition cache. - - @sa check_and_update_table_version() - @sa Execute_observer - @sa Prepared_statement::reprepare() -*/ - -enum enum_table_ref_type -{ - /** Initial value set by the parser */ - TABLE_REF_NULL= 0, - TABLE_REF_VIEW, - TABLE_REF_BASE_TABLE, - TABLE_REF_I_S_TABLE, - TABLE_REF_TMP_TABLE -}; - - -/*************************************************************************/ - -/** - Object_creation_ctx -- interface for creation context of database objects - (views, stored routines, events, triggers). Creation context -- is a set - of attributes, that should be fixed at the creation time and then be used - each time the object is parsed or executed. -*/ - -class Object_creation_ctx -{ -public: - Object_creation_ctx *set_n_backup(THD *thd); - - void restore_env(THD *thd, Object_creation_ctx *backup_ctx); - -protected: - Object_creation_ctx() {} - virtual Object_creation_ctx *create_backup_ctx(THD *thd) const = 0; - - virtual void change_env(THD *thd) const = 0; - -public: - virtual ~Object_creation_ctx() - { } -}; - -/*************************************************************************/ - -/** - Default_object_creation_ctx -- default implementation of - Object_creation_ctx. -*/ - -class Default_object_creation_ctx : public Object_creation_ctx -{ -public: - CHARSET_INFO *get_client_cs() - { - return m_client_cs; - } - - CHARSET_INFO *get_connection_cl() - { - return m_connection_cl; - } - -protected: - Default_object_creation_ctx(THD *thd); - - Default_object_creation_ctx(CHARSET_INFO *client_cs, - CHARSET_INFO *connection_cl); - -protected: - virtual Object_creation_ctx *create_backup_ctx(THD *thd) const; - - virtual void change_env(THD *thd) const; - -protected: - /** - client_cs stores the value of character_set_client session variable. - The only character set attribute is used. - - Client character set is included into query context, because we save - query in the original character set, which is client character set. So, - in order to parse the query properly we have to switch client character - set on parsing. - */ - CHARSET_INFO *m_client_cs; - - /** - connection_cl stores the value of collation_connection session - variable. Both character set and collation attributes are used. - - Connection collation is included into query context, becase it defines - the character set and collation of text literals in internal - representation of query (item-objects). - */ - CHARSET_INFO *m_connection_cl; -}; - -class Query_arena; - -/*************************************************************************/ - -/** - View_creation_ctx -- creation context of view objects. -*/ - -class View_creation_ctx : public Default_object_creation_ctx, - public Sql_alloc -{ -public: - static View_creation_ctx *create(THD *thd); - - static View_creation_ctx *create(THD *thd, - TABLE_LIST *view); - -private: - View_creation_ctx(THD *thd) - : Default_object_creation_ctx(thd) - { } -}; - -/*************************************************************************/ - -/* Order clause list element */ - -typedef int (*fast_field_copier)(Field *to, Field *from); - - -typedef struct st_order { - struct st_order *next; - Item **item; /* Point at item in select fields */ - Item *item_ptr; /* Storage for initial item */ - /* - Reference to the function we are trying to optimize copy to - a temporary table - */ - fast_field_copier fast_field_copier_func; - /* Field for which above optimizer function setup */ - Field *fast_field_copier_setup; - int counter; /* position in SELECT list, correct - only if counter_used is true*/ - enum enum_order { - ORDER_NOT_RELEVANT, - ORDER_ASC, - ORDER_DESC - }; - - enum_order direction; /* Requested direction of ordering */ - bool in_field_list; /* true if in select field list */ - bool counter_used; /* parameter was counter of columns */ - Field *field; /* If tmp-table group */ - char *buff; /* If tmp-table group */ - table_map used; /* NOTE: the below is only set to 0 but is still used by eq_ref_table */ - table_map depend_map; -} ORDER; - -/** - State information for internal tables grants. - This structure is part of the TABLE_LIST, and is updated - during the ACL check process. - @sa GRANT_INFO -*/ -struct st_grant_internal_info -{ - /** True if the internal lookup by schema name was done. */ - bool m_schema_lookup_done; - /** Cached internal schema access. */ - const ACL_internal_schema_access *m_schema_access; - /** True if the internal lookup by table name was done. */ - bool m_table_lookup_done; - /** Cached internal table access. */ - const ACL_internal_table_access *m_table_access; -}; -typedef struct st_grant_internal_info GRANT_INTERNAL_INFO; - -/** - @brief The current state of the privilege checking process for the current - user, SQL statement and SQL object. - - @details The privilege checking process is divided into phases depending on - the level of the privilege to be checked and the type of object to be - accessed. Due to the mentioned scattering of privilege checking - functionality, it is necessary to keep track of the state of the - process. This information is stored in privilege, want_privilege, and - orig_want_privilege. - - A GRANT_INFO also serves as a cache of the privilege hash tables. Relevant - members are grant_table and version. - */ -typedef struct st_grant_info -{ - /** - @brief A copy of the privilege information regarding the current host, - database, object and user. - - @details The version of this copy is found in GRANT_INFO::version. - */ - GRANT_TABLE *grant_table_user; - GRANT_TABLE *grant_table_role; - /** - @brief Used for cache invalidation when caching privilege information. - - @details The privilege information is stored on disk, with dedicated - caches residing in memory: table-level and column-level privileges, - respectively, have their own dedicated caches. - - The GRANT_INFO works as a level 1 cache with this member updated to the - current value of the global variable @c grant_version (@c static variable - in sql_acl.cc). It is updated Whenever the GRANT_INFO is refreshed from - the level 2 cache. The level 2 cache is the @c column_priv_hash structure - (@c static variable in sql_acl.cc) - - @see grant_version - */ - uint version; - /** - @brief The set of privileges that the current user has fulfilled for a - certain host, database, and object. - - @details This field is continually updated throughout the access checking - process. In each step the "wanted privilege" is checked against the - fulfilled privileges. When/if the intersection of these sets is empty, - access is granted. - - The set is implemented as a bitmap, with the bits defined in sql_acl.h. - */ - privilege_t privilege; - /** - @brief the set of privileges that the current user needs to fulfil in - order to carry out the requested operation. - */ - privilege_t want_privilege; - /** - Stores the requested access acl of top level tables list. Is used to - check access rights to the underlying tables of a view. - */ - privilege_t orig_want_privilege; - /** The grant state for internal tables. */ - GRANT_INTERNAL_INFO m_internal; - - st_grant_info() - :privilege(NO_ACL), - want_privilege(NO_ACL), - orig_want_privilege(NO_ACL) - { } -} GRANT_INFO; - -enum tmp_table_type -{ - NO_TMP_TABLE= 0, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE, - INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE -}; -enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP }; - - -enum vcol_init_mode -{ - VCOL_INIT_DEPENDENCY_FAILURE_IS_WARNING= 1, - VCOL_INIT_DEPENDENCY_FAILURE_IS_ERROR= 2 - /* - There may be new flags here. - e.g. to automatically remove sql_mode dependency: - GENERATED ALWAYS AS (char_col) -> - GENERATED ALWAYS AS (RTRIM(char_col)) - */ -}; - - -enum enum_vcol_update_mode -{ - VCOL_UPDATE_FOR_READ= 0, - VCOL_UPDATE_FOR_WRITE, - VCOL_UPDATE_FOR_DELETE, - VCOL_UPDATE_INDEXED, - VCOL_UPDATE_INDEXED_FOR_UPDATE, - VCOL_UPDATE_FOR_REPLACE -}; - -/* Field visibility enums */ - -enum field_visibility_t { - VISIBLE= 0, - INVISIBLE_USER, - /* automatically added by the server. Can be queried explicitly - in SELECT, otherwise invisible from anything" */ - INVISIBLE_SYSTEM, - INVISIBLE_FULL -}; - -#define INVISIBLE_MAX_BITS 3 -#define HA_HASH_FIELD_LENGTH 8 -#define HA_HASH_KEY_LENGTH_WITHOUT_NULL 8 -#define HA_HASH_KEY_LENGTH_WITH_NULL 9 - - -int fields_in_hash_keyinfo(KEY *keyinfo); - -void setup_keyinfo_hash(KEY *key_info); - -void re_setup_keyinfo_hash(KEY *key_info); - -/** - Category of table found in the table share. -*/ -enum enum_table_category -{ - /** - Unknown value. - */ - TABLE_UNKNOWN_CATEGORY=0, - - /** - Temporary table. - The table is visible only in the session. - Therefore, - - FLUSH TABLES WITH READ LOCK - - SET GLOBAL READ_ONLY = ON - do not apply to this table. - Note that LOCK TABLE t FOR READ/WRITE - can be used on temporary tables. - Temporary tables are not part of the table cache. - */ - TABLE_CATEGORY_TEMPORARY=1, - - /** - User table. - These tables do honor: - - LOCK TABLE t FOR READ/WRITE - - FLUSH TABLES WITH READ LOCK - - SET GLOBAL READ_ONLY = ON - User tables are cached in the table cache. - */ - TABLE_CATEGORY_USER=2, - - /** - System table, maintained by the server. - These tables do honor: - - LOCK TABLE t FOR READ/WRITE - - FLUSH TABLES WITH READ LOCK - - SET GLOBAL READ_ONLY = ON - Typically, writes to system tables are performed by - the server implementation, not explicitly be a user. - System tables are cached in the table cache. - */ - TABLE_CATEGORY_SYSTEM=3, - - /** - Log tables. - These tables are an interface provided by the system - to inspect the system logs. - These tables do *not* honor: - - LOCK TABLE t FOR READ/WRITE - - FLUSH TABLES WITH READ LOCK - - SET GLOBAL READ_ONLY = ON - as there is no point in locking explicitly - a LOG table. - An example of LOG tables are: - - mysql.slow_log - - mysql.general_log, - which *are* updated even when there is either - a GLOBAL READ LOCK or a GLOBAL READ_ONLY in effect. - User queries do not write directly to these tables - (there are exceptions for log tables). - The server implementation perform writes. - Log tables are cached in the table cache. - */ - TABLE_CATEGORY_LOG=4, - - /* - Types below are read only tables, not affected by FLUSH TABLES or - MDL locks. - */ - /** - Information schema tables. - These tables are an interface provided by the system - to inspect the system metadata. - These tables do *not* honor: - - LOCK TABLE t FOR READ/WRITE - - FLUSH TABLES WITH READ LOCK - - SET GLOBAL READ_ONLY = ON - as there is no point in locking explicitly - an INFORMATION_SCHEMA table. - Nothing is directly written to information schema tables. - Note that this value is not used currently, - since information schema tables are not shared, - but implemented as session specific temporary tables. - */ - /* - TODO: Fixing the performance issues of I_S will lead - to I_S tables in the table cache, which should use - this table type. - */ - TABLE_CATEGORY_INFORMATION=5, - - /** - Performance schema tables. - These tables are an interface provided by the system - to inspect the system performance data. - These tables do *not* honor: - - LOCK TABLE t FOR READ/WRITE - - FLUSH TABLES WITH READ LOCK - - SET GLOBAL READ_ONLY = ON - as there is no point in locking explicitly - a PERFORMANCE_SCHEMA table. - An example of PERFORMANCE_SCHEMA tables are: - - performance_schema.* - which *are* updated (but not using the handler interface) - even when there is either - a GLOBAL READ LOCK or a GLOBAL READ_ONLY in effect. - User queries do not write directly to these tables - (there are exceptions for SETUP_* tables). - The server implementation perform writes. - Performance tables are cached in the table cache. - */ - TABLE_CATEGORY_PERFORMANCE=6 -}; - -typedef enum enum_table_category TABLE_CATEGORY; - -TABLE_CATEGORY get_table_category(const LEX_CSTRING *db, - const LEX_CSTRING *name); - - -typedef struct st_table_field_type -{ - LEX_CSTRING name; - LEX_CSTRING type; - LEX_CSTRING cset; -} TABLE_FIELD_TYPE; - - -typedef struct st_table_field_def -{ - uint count; - const TABLE_FIELD_TYPE *field; - uint primary_key_parts; - const uint *primary_key_columns; -} TABLE_FIELD_DEF; - - -class Table_check_intact -{ -protected: - bool has_keys; - virtual void report_error(uint code, const char *fmt, ...)= 0; - -public: - Table_check_intact(bool keys= false) : has_keys(keys) {} - virtual ~Table_check_intact() {} - - /** Checks whether a table is intact. */ - bool check(TABLE *table, const TABLE_FIELD_DEF *table_def); -}; - - -/* - If the table isn't valid, report the error to the server log only. -*/ -class Table_check_intact_log_error : public Table_check_intact -{ -protected: - void report_error(uint, const char *fmt, ...); -public: - Table_check_intact_log_error() : Table_check_intact(true) {} -}; - - -/** - Class representing the fact that some thread waits for table - share to be flushed. Is used to represent information about - such waits in MDL deadlock detector. -*/ - -class Wait_for_flush : public MDL_wait_for_subgraph -{ - MDL_context *m_ctx; - TABLE_SHARE *m_share; - uint m_deadlock_weight; -public: - Wait_for_flush(MDL_context *ctx_arg, TABLE_SHARE *share_arg, - uint deadlock_weight_arg) - : m_ctx(ctx_arg), m_share(share_arg), - m_deadlock_weight(deadlock_weight_arg) - {} - - MDL_context *get_ctx() const { return m_ctx; } - - virtual bool accept_visitor(MDL_wait_for_graph_visitor *dvisitor); - - virtual uint get_deadlock_weight() const; - - /** - Pointers for participating in the list of waiters for table share. - */ - Wait_for_flush *next_in_share; - Wait_for_flush **prev_in_share; -}; - - -typedef I_P_List > - Wait_for_flush_list; - - -enum open_frm_error { - OPEN_FRM_OK = 0, - OPEN_FRM_OPEN_ERROR, - OPEN_FRM_READ_ERROR, - OPEN_FRM_CORRUPTED, - OPEN_FRM_DISCOVER, - OPEN_FRM_ERROR_ALREADY_ISSUED, - OPEN_FRM_NOT_A_VIEW, - OPEN_FRM_NOT_A_TABLE, - OPEN_FRM_NEEDS_REBUILD -}; - -/** - Control block to access table statistics loaded - from persistent statistical tables -*/ - -class TABLE_STATISTICS_CB -{ - class Statistics_state - { - enum state_codes - { - EMPTY, /** data is not loaded */ - LOADING, /** data is being loaded in some connection */ - READY /** data is loaded and available for use */ - }; - int32 state; - - public: - /** No state copy */ - Statistics_state &operator=(const Statistics_state &) { return *this; } - - /** Checks if data loading have been completed */ - bool is_ready() const - { - return my_atomic_load32_explicit(const_cast(&state), - MY_MEMORY_ORDER_ACQUIRE) == READY; - } - - /** - Sets mutual exclusion for data loading - - If stats are in LOADING state, waits until state change. - - @return - @retval true atomic EMPTY -> LOADING transfer completed, ok to load - @retval false stats are in READY state, no need to load - */ - bool start_load() - { - for (;;) - { - int32 expected= EMPTY; - if (my_atomic_cas32_weak_explicit(&state, &expected, LOADING, - MY_MEMORY_ORDER_RELAXED, - MY_MEMORY_ORDER_RELAXED)) - return true; - if (expected == READY) - return false; - (void) LF_BACKOFF(); - } - } - - /** Marks data available for subsequent use */ - void end_load() - { - DBUG_ASSERT(my_atomic_load32_explicit(&state, MY_MEMORY_ORDER_RELAXED) == - LOADING); - my_atomic_store32_explicit(&state, READY, MY_MEMORY_ORDER_RELEASE); - } - - /** Restores empty state on error (e.g. OOM) */ - void abort_load() - { - DBUG_ASSERT(my_atomic_load32_explicit(&state, MY_MEMORY_ORDER_RELAXED) == - LOADING); - my_atomic_store32_explicit(&state, EMPTY, MY_MEMORY_ORDER_RELAXED); - } - }; - - class Statistics_state stats_state; - class Statistics_state hist_state; - -public: - MEM_ROOT mem_root; /* MEM_ROOT to allocate statistical data for the table */ - Table_statistics *table_stats; /* Structure to access the statistical data */ - ulong total_hist_size; /* Total size of all histograms */ - - bool histograms_are_ready() const - { - return !total_hist_size || hist_state.is_ready(); - } - - bool start_histograms_load() - { - return total_hist_size && hist_state.start_load(); - } - - void end_histograms_load() { hist_state.end_load(); } - void abort_histograms_load() { hist_state.abort_load(); } - bool stats_are_ready() const { return stats_state.is_ready(); } - bool start_stats_load() { return stats_state.start_load(); } - void end_stats_load() { stats_state.end_load(); } - void abort_stats_load() { stats_state.abort_load(); } -}; - -/** - This structure is shared between different table objects. There is one - instance of table share per one table in the database. -*/ - -struct TABLE_SHARE -{ - TABLE_SHARE() {} /* Remove gcc warning */ - - /** Category of this table. */ - TABLE_CATEGORY table_category; - - /* hash of field names (contains pointers to elements of field array) */ - HASH name_hash; /* hash of field names */ - MEM_ROOT mem_root; - TYPELIB keynames; /* Pointers to keynames */ - TYPELIB fieldnames; /* Pointer to fieldnames */ - TYPELIB *intervals; /* pointer to interval info */ - mysql_mutex_t LOCK_ha_data; /* To protect access to ha_data */ - mysql_mutex_t LOCK_share; /* To protect TABLE_SHARE */ - - TDC_element *tdc; - - LEX_CUSTRING tabledef_version; - - engine_option_value *option_list; /* text options for table */ - ha_table_option_struct *option_struct; /* structure with parsed options */ - - /* The following is copied to each TABLE on OPEN */ - Field **field; - Field **found_next_number_field; - KEY *key_info; /* data of keys in database */ - Virtual_column_info **check_constraints; - uint *blob_field; /* Index to blobs in Field arrray*/ - LEX_CUSTRING vcol_defs; /* definitions of generated columns */ - - TABLE_STATISTICS_CB stats_cb; - - uchar *default_values; /* row with default values */ - LEX_CSTRING comment; /* Comment about table */ - CHARSET_INFO *table_charset; /* Default charset of string fields */ - - MY_BITMAP *check_set; /* Fields used by check constrant */ - MY_BITMAP all_set; - /* - Key which is used for looking-up table in table cache and in the list - of thread's temporary tables. Has the form of: - "database_name\0table_name\0" + optional part for temporary tables. - - Note that all three 'table_cache_key', 'db' and 'table_name' members - must be set (and be non-zero) for tables in table cache. They also - should correspond to each other. - To ensure this one can use set_table_cache() methods. - */ - LEX_CSTRING table_cache_key; - LEX_CSTRING db; /* Pointer to db */ - LEX_CSTRING table_name; /* Table name (for open) */ - LEX_CSTRING path; /* Path to .frm file (from datadir) */ - LEX_CSTRING normalized_path; /* unpack_filename(path) */ - LEX_CSTRING connect_string; - - /* - Set of keys in use, implemented as a Bitmap. - Excludes keys disabled by ALTER TABLE ... DISABLE KEYS. - */ - key_map keys_in_use; - key_map keys_for_keyread; - ha_rows min_rows, max_rows; /* create information */ - ulong avg_row_length; /* create information */ - ulong mysql_version; /* 0 if .frm is created before 5.0 */ - ulong reclength; /* Recordlength */ - /* Stored record length. No generated-only virtual fields are included */ - ulong stored_rec_length; - - plugin_ref db_plugin; /* storage engine plugin */ - inline handlerton *db_type() const /* table_type for handler */ - { - return is_view ? view_pseudo_hton : - db_plugin ? plugin_hton(db_plugin) : NULL; - } - enum row_type row_type; /* How rows are stored */ - enum Table_type table_type; - enum tmp_table_type tmp_table; - - /** Transactional or not. */ - enum ha_choice transactional; - /** Per-page checksums or not. */ - enum ha_choice page_checksum; - - uint key_block_size; /* create key_block_size, if used */ - uint stats_sample_pages; /* number of pages to sample during - stats estimation, if used, otherwise 0. */ - enum_stats_auto_recalc stats_auto_recalc; /* Automatic recalc of stats. */ - uint null_bytes, last_null_bit_pos; - /* - Same as null_bytes, except that if there is only a 'delete-marker' in - the record then this value is 0. - */ - uint null_bytes_for_compare; - uint fields; /* number of fields */ - /* number of stored fields, purely virtual not included */ - uint stored_fields; - uint virtual_fields; /* number of purely virtual fields */ - /* number of purely virtual not stored blobs */ - uint virtual_not_stored_blob_fields; - uint null_fields; /* number of null fields */ - uint blob_fields; /* number of blob fields */ - uint varchar_fields; /* number of varchar fields */ - uint default_fields; /* number of default fields */ - uint visible_fields; /* number of visible fields */ - - uint default_expressions; - uint table_check_constraints, field_check_constraints; - - uint rec_buff_length; /* Size of table->record[] buffer */ - uint keys, key_parts; - uint ext_key_parts; /* Total number of key parts in extended keys */ - uint max_key_length, max_unique_length, total_key_length; - uint uniques; /* Number of UNIQUE index */ - uint db_create_options; /* Create options from database */ - uint db_options_in_use; /* Options in use */ - uint db_record_offset; /* if HA_REC_IN_SEQ */ - uint rowid_field_offset; /* Field_nr +1 to rowid field */ - /* Primary key index number, used in TABLE::key_info[] */ - uint primary_key; - uint next_number_index; /* autoincrement key number */ - uint next_number_key_offset; /* autoinc keypart offset in a key */ - uint next_number_keypart; /* autoinc keypart number in a key */ - enum open_frm_error error; /* error from open_table_def() */ - uint open_errno; /* error from open_table_def() */ - uint column_bitmap_size; - uchar frm_version; - - enum enum_v_keys { NOT_INITIALIZED=0, NO_V_KEYS, V_KEYS }; - enum_v_keys check_set_initialized; - - bool use_ext_keys; /* Extended keys can be used */ - bool null_field_first; - bool system; /* Set if system table (one record) */ - bool not_usable_by_query_cache; - bool online_backup; /* Set if on-line backup supported */ - /* - This is used by log tables, for tables that have their own internal - binary logging or for tables that doesn't support statement or row logging - */ - bool no_replicate; - bool crashed; - bool is_view; - bool can_cmp_whole_record; - /* This is set for temporary tables where CREATE was binary logged */ - bool table_creation_was_logged; - bool non_determinstic_insert; - bool vcols_need_refixing; - bool has_update_default_function; - bool can_do_row_logging; /* 1 if table supports RBR */ - bool long_unique_table; - - ulong table_map_id; /* for row-based replication */ - - /* - Things that are incompatible between the stored version and the - current version. This is a set of HA_CREATE... bits that can be used - to modify create_info->used_fields for ALTER TABLE. - */ - ulong incompatible_version; - - /** - For shares representing views File_parser object with view - definition read from .FRM file. - */ - const File_parser *view_def; - - /* For sequence tables, the current sequence state */ - SEQUENCE *sequence; - -#ifdef WITH_PARTITION_STORAGE_ENGINE - /* filled in when reading from frm */ - bool auto_partitioned; - char *partition_info_str; - uint partition_info_str_len; - uint partition_info_buffer_size; - plugin_ref default_part_plugin; -#endif - - /** - System versioning and application-time periods support. - */ - struct period_info_t - { - uint16 start_fieldno; - uint16 end_fieldno; - Lex_ident name; - Lex_ident constr_name; - uint unique_keys; - Field *start_field(TABLE_SHARE *s) const - { - return s->field[start_fieldno]; - } - Field *end_field(TABLE_SHARE *s) const - { - return s->field[end_fieldno]; - } - }; - - vers_kind_t versioned; - period_info_t vers; - period_info_t period; - - bool init_period_from_extra2(period_info_t *period, const uchar *data, - const uchar *end); - - Field *vers_start_field() - { - DBUG_ASSERT(versioned); - return field[vers.start_fieldno]; - } - - Field *vers_end_field() - { - DBUG_ASSERT(versioned); - return field[vers.end_fieldno]; - } - - Field *period_start_field() const - { - DBUG_ASSERT(period.name); - return field[period.start_fieldno]; - } - - Field *period_end_field() const - { - DBUG_ASSERT(period.name); - return field[period.end_fieldno]; - } - - /** - Cache the checked structure of this table. - - The pointer data is used to describe the structure that - a instance of the table must have. Each element of the - array specifies a field that must exist on the table. - - The pointer is cached in order to perform the check only - once -- when the table is loaded from the disk. - */ - const TABLE_FIELD_DEF *table_field_def_cache; - - /** Main handler's share */ - Handler_share *ha_share; - - /** Instrumentation for this table share. */ - PSI_table_share *m_psi; - - inline void reset() { bzero((void*)this, sizeof(*this)); } - - /* - Set share's table cache key and update its db and table name appropriately. - - SYNOPSIS - set_table_cache_key() - key_buff Buffer with already built table cache key to be - referenced from share. - key_length Key length. - - NOTES - Since 'key_buff' buffer will be referenced from share it should has same - life-time as share itself. - This method automatically ensures that TABLE_SHARE::table_name/db have - appropriate values by using table cache key as their source. - */ - - void set_table_cache_key(char *key_buff, uint key_length) - { - table_cache_key.str= key_buff; - table_cache_key.length= key_length; - /* - Let us use the fact that the key is "db/0/table_name/0" + optional - part for temporary tables. - */ - db.str= table_cache_key.str; - db.length= strlen(db.str); - table_name.str= db.str + db.length + 1; - table_name.length= strlen(table_name.str); - } - - - /* - Set share's table cache key and update its db and table name appropriately. - - SYNOPSIS - set_table_cache_key() - key_buff Buffer to be used as storage for table cache key - (should be at least key_length bytes). - key Value for table cache key. - key_length Key length. - - NOTE - Since 'key_buff' buffer will be used as storage for table cache key - it should has same life-time as share itself. - */ - - void set_table_cache_key(char *key_buff, const char *key, uint key_length) - { - memcpy(key_buff, key, key_length); - set_table_cache_key(key_buff, key_length); - } - - inline bool require_write_privileges() - { - return (table_category == TABLE_CATEGORY_LOG); - } - - inline ulong get_table_def_version() - { - return table_map_id; - } - - /** - Convert unrelated members of TABLE_SHARE to one enum - representing its type. - - @todo perhaps we need to have a member instead of a function. - */ - enum enum_table_ref_type get_table_ref_type() const - { - if (is_view) - return TABLE_REF_VIEW; - switch (tmp_table) { - case NO_TMP_TABLE: - return TABLE_REF_BASE_TABLE; - case SYSTEM_TMP_TABLE: - return TABLE_REF_I_S_TABLE; - default: - return TABLE_REF_TMP_TABLE; - } - } - /** - Return a table metadata version. - * for base tables and views, we return table_map_id. - It is assigned from a global counter incremented for each - new table loaded into the table definition cache (TDC). - * for temporary tables it's table_map_id again. But for - temporary tables table_map_id is assigned from - thd->query_id. The latter is assigned from a thread local - counter incremented for every new SQL statement. Since - temporary tables are thread-local, each temporary table - gets a unique id. - * for everything else (e.g. information schema tables), - the version id is zero. - - This choice of version id is a large compromise - to have a working prepared statement validation in 5.1. In - future version ids will be persistent, as described in WL#4180. - - Let's try to explain why and how this limited solution allows - to validate prepared statements. - - Firstly, sets (in mathematical sense) of version numbers - never intersect for different table types. Therefore, - version id of a temporary table is never compared with - a version id of a view, and vice versa. - - Secondly, for base tables and views, we know that each DDL flushes - the respective share from the TDC. This ensures that whenever - a table is altered or dropped and recreated, it gets a new - version id. - Unfortunately, since elements of the TDC are also flushed on - LRU basis, this choice of version ids leads to false positives. - E.g. when the TDC size is too small, we may have a SELECT - * FROM INFORMATION_SCHEMA.TABLES flush all its elements, which - in turn will lead to a validation error and a subsequent - reprepare of all prepared statements. This is - considered acceptable, since as long as prepared statements are - automatically reprepared, spurious invalidation is only - a performance hit. Besides, no better simple solution exists. - - For temporary tables, using thd->query_id ensures that if - a temporary table was altered or recreated, a new version id is - assigned. This suits validation needs very well and will perhaps - never change. - - Metadata of information schema tables never changes. - Thus we can safely assume 0 for a good enough version id. - - Finally, by taking into account table type, we always - track that a change has taken place when a view is replaced - with a base table, a base table is replaced with a temporary - table and so on. - - @sa TABLE_LIST::is_table_ref_id_equal() - */ - ulong get_table_ref_version() const - { - return (tmp_table == SYSTEM_TMP_TABLE) ? 0 : table_map_id; - } - - bool visit_subgraph(Wait_for_flush *waiting_ticket, - MDL_wait_for_graph_visitor *gvisitor); - - bool wait_for_old_version(THD *thd, struct timespec *abstime, - uint deadlock_weight); - /** Release resources and free memory occupied by the table share. */ - void destroy(); - - void set_use_ext_keys_flag(bool fl) - { - use_ext_keys= fl; - } - - uint actual_n_key_parts(THD *thd); - - LEX_CUSTRING *frm_image; ///< only during CREATE TABLE (@sa ha_create_table) - - /* - populates TABLE_SHARE from the table description in the binary frm image. - if 'write' is true, this frm image is also written into a corresponding - frm file, that serves as a persistent metadata cache to avoid - discovering the table over and over again - */ - int init_from_binary_frm_image(THD *thd, bool write, - const uchar *frm_image, size_t frm_length, - const uchar *par_image=0, - size_t par_length=0); - - /* - populates TABLE_SHARE from the table description, specified as the - complete CREATE TABLE sql statement. - if 'write' is true, this frm image is also written into a corresponding - frm file, that serves as a persistent metadata cache to avoid - discovering the table over and over again - */ - int init_from_sql_statement_string(THD *thd, bool write, - const char *sql, size_t sql_length); - /* - writes the frm image to an frm file, corresponding to this table - */ - bool write_frm_image(const uchar *frm_image, size_t frm_length); - bool write_par_image(const uchar *par_image, size_t par_length); - - /* Only used by tokudb */ - bool write_frm_image(void) - { return frm_image ? write_frm_image(frm_image->str, frm_image->length) : 0; } - - /* - returns an frm image for this table. - the memory is allocated and must be freed later - */ - bool read_frm_image(const uchar **frm_image, size_t *frm_length); - - /* frees the memory allocated in read_frm_image */ - void free_frm_image(const uchar *frm); - - void set_overlapped_keys(); -}; - -/* not NULL, but cannot be dereferenced */ -#define UNUSABLE_TABLE_SHARE ((TABLE_SHARE*)1) - -/** - Class is used as a BLOB field value storage for - intermediate GROUP_CONCAT results. Used only for - GROUP_CONCAT with DISTINCT or ORDER BY options. - */ - -class Blob_mem_storage: public Sql_alloc -{ -private: - MEM_ROOT storage; - /** - Sign that some values were cut - during saving into the storage. - */ - bool truncated_value; -public: - Blob_mem_storage() :truncated_value(false) - { - init_alloc_root(key_memory_blob_mem_storage, - &storage, MAX_FIELD_VARCHARLENGTH, 0, MYF(0)); - } - ~ Blob_mem_storage() - { - free_root(&storage, MYF(0)); - } - void reset() - { - free_root(&storage, MYF(MY_MARK_BLOCKS_FREE)); - truncated_value= false; - } - /** - Fuction creates duplicate of 'from' - string in 'storage' MEM_ROOT. - - @param from string to copy - @param length string length - - @retval Pointer to the copied string. - @retval 0 if an error occurred. - */ - char *store(const char *from, size_t length) - { - return (char*) memdup_root(&storage, from, length); - } - void set_truncated_value(bool is_truncated_value) - { - truncated_value= is_truncated_value; - } - bool is_truncated_value() { return truncated_value; } -}; - - -/* Information for one open table */ -enum index_hint_type -{ - INDEX_HINT_IGNORE, - INDEX_HINT_USE, - INDEX_HINT_FORCE -}; - -struct st_cond_statistic; - -#define CHECK_ROW_FOR_NULLS_TO_REJECT (1 << 0) -#define REJECT_ROW_DUE_TO_NULL_FIELDS (1 << 1) - -class SplM_opt_info; - -struct vers_select_conds_t; - -struct TABLE -{ - TABLE() {} /* Remove gcc warning */ - - TABLE_SHARE *s; - handler *file; - TABLE *next, *prev; - -private: - /** - Links for the list of all TABLE objects for this share. - Declared as private to avoid direct manipulation with those objects. - One should use methods of I_P_List template instead. - */ - TABLE *share_all_next, **share_all_prev; - TABLE *global_free_next, **global_free_prev; - friend struct All_share_tables; - friend struct Table_cache_instance; - -public: - - uint32 instance; /** Table cache instance this TABLE is belonging to */ - THD *in_use; /* Which thread uses this */ - - uchar *record[3]; /* Pointer to records */ - uchar *write_row_record; /* Used as optimisation in - THD::write_row */ - uchar *insert_values; /* used by INSERT ... UPDATE */ - /* - Map of keys that can be used to retrieve all data from this table - needed by the query without reading the row. - */ - key_map covering_keys, intersect_keys; - /* - A set of keys that can be used in the query that references this - table. - - All indexes disabled on the table's TABLE_SHARE (see TABLE::s) will be - subtracted from this set upon instantiation. Thus for any TABLE t it holds - that t.keys_in_use_for_query is a subset of t.s.keys_in_use. Generally we - must not introduce any new keys here (see setup_tables). - - The set is implemented as a bitmap. - */ - key_map keys_in_use_for_query; - /* Map of keys that can be used to calculate GROUP BY without sorting */ - key_map keys_in_use_for_group_by; - /* Map of keys that can be used to calculate ORDER BY without sorting */ - key_map keys_in_use_for_order_by; - /* Map of keys dependent on some constraint */ - key_map constraint_dependent_keys; - KEY *key_info; /* data of keys in database */ - - Field **field; /* Pointer to fields */ - Field **vfield; /* Pointer to virtual fields*/ - Field **default_field; /* Fields with non-constant DEFAULT */ - Field *next_number_field; /* Set if next_number is activated */ - Field *found_next_number_field; /* Set on open */ - Virtual_column_info **check_constraints; - - /* Table's triggers, 0 if there are no of them */ - Table_triggers_list *triggers; - TABLE_LIST *pos_in_table_list;/* Element referring to this table */ - /* Position in thd->locked_table_list under LOCK TABLES */ - TABLE_LIST *pos_in_locked_tables; - /* Tables used in DEFAULT and CHECK CONSTRAINT (normally sequence tables) */ - TABLE_LIST *internal_tables; - - /* - Not-null for temporary tables only. Non-null values means this table is - used to compute GROUP BY, it has a unique of GROUP BY columns. - (set by create_tmp_table) - */ - ORDER *group; - String alias; /* alias or table name */ - uchar *null_flags; - MY_BITMAP def_read_set, def_write_set, tmp_set; - MY_BITMAP def_rpl_write_set; - MY_BITMAP eq_join_set; /* used to mark equi-joined fields */ - MY_BITMAP cond_set; /* used to mark fields from sargable conditions*/ - /* Active column sets */ - MY_BITMAP *read_set, *write_set, *rpl_write_set; - /* On INSERT: fields that the user specified a value for */ - MY_BITMAP has_value_set; - - /* - The ID of the query that opened and is using this table. Has different - meanings depending on the table type. - - Temporary tables: - - table->query_id is set to thd->query_id for the duration of a statement - and is reset to 0 once it is closed by the same statement. A non-zero - table->query_id means that a statement is using the table even if it's - not the current statement (table is in use by some outer statement). - - Non-temporary tables: - - Under pre-locked or LOCK TABLES mode: query_id is set to thd->query_id - for the duration of a statement and is reset to 0 once it is closed by - the same statement. A non-zero query_id is used to control which tables - in the list of pre-opened and locked tables are actually being used. - */ - query_id_t query_id; - - /* - This structure is used for statistical data on the table that - is collected by the function collect_statistics_for_table - */ - Table_statistics *collected_stats; - - /* The estimate of the number of records in the table used by optimizer */ - ha_rows used_stat_records; - - key_map opt_range_keys; - /* - The following structure is filled for each key that has - opt_range_keys.is_set(key) == TRUE - */ - struct OPT_RANGE - { - uint key_parts; - uint ranges; - ha_rows rows; - double cost; - /* - If there is a range access by i-th index then the cost of - index only access for it is stored in index_only_costs[i] - */ - double index_only_cost; - } *opt_range; - /* - Bitmaps of key parts that =const for the duration of join execution. If - we're in a subquery, then the constant may be different across subquery - re-executions. - */ - key_part_map *const_key_parts; - - /* - Estimate of number of records that satisfy SARGable part of the table - condition, or table->file->records if no SARGable condition could be - constructed. - This value is used by join optimizer as an estimate of number of records - that will pass the table condition (condition that depends on fields of - this table and constants) - */ - ha_rows opt_range_condition_rows; - - double cond_selectivity; - List *cond_selectivity_sampling_explain; - - table_map map; /* ID bit of table (1,2,4,8,16...) */ - - uint lock_position; /* Position in MYSQL_LOCK.table */ - uint lock_data_start; /* Start pos. in MYSQL_LOCK.locks */ - uint lock_count; /* Number of locks */ - uint tablenr,used_fields; - uint temp_pool_slot; /* Used by intern temp tables */ - uint status; /* What's in record[0] */ - uint db_stat; /* mode of file as in handler.h */ - /* number of select if it is derived table */ - uint derived_select_number; - /* - Possible values: - - 0 by default - - JOIN_TYPE_{LEFT|RIGHT} if the table is inner w.r.t an outer join - operation - - 1 if the SELECT has mixed_implicit_grouping=1. example: - select max(col1), col2 from t1. In this case, the query produces - one row with all columns having NULL values. - - Interpetation: If maybe_null!=0, all fields of the table are considered - NULLable (and have NULL values when null_row=true) - */ - uint maybe_null; - int current_lock; /* Type of lock on table */ - bool copy_blobs; /* copy_blobs when storing */ - /* - Set if next_number_field is in the UPDATE fields of INSERT ... ON DUPLICATE - KEY UPDATE. - */ - bool next_number_field_updated; - - /* - If true, the current table row is considered to have all columns set to - NULL, including columns declared as "not null" (see maybe_null). - */ - bool null_row; - /* - No rows that contain null values can be placed into this table. - Currently this flag can be set to true only for a temporary table - that used to store the result of materialization of a subquery. - */ - bool no_rows_with_nulls; - /* - This field can contain two bit flags: - CHECK_ROW_FOR_NULLS_TO_REJECT - REJECT_ROW_DUE_TO_NULL_FIELDS - The first flag is set for the dynamic contexts where it is prohibited - to write any null into the table. - The second flag is set only if the first flag is set on. - The informs the outer scope that there was an attept to write null - into a field of the table in the context where it is prohibited. - This flag should be set off as soon as the first flag is set on. - Currently these flags are used only the tables tno_rows_with_nulls set - to true. - */ - uint8 null_catch_flags; - - /* - TODO: Each of the following flags take up 8 bits. They can just as easily - be put into one single unsigned long and instead of taking up 18 - bytes, it would take up 4. - */ - bool force_index; - - /** - Flag set when the statement contains FORCE INDEX FOR ORDER BY - See TABLE_LIST::process_index_hints(). - */ - bool force_index_order; - - /** - Flag set when the statement contains FORCE INDEX FOR GROUP BY - See TABLE_LIST::process_index_hints(). - */ - bool force_index_group; - /* - TRUE<=> this table was created with create_tmp_table(... distinct=TRUE..) - call - */ - bool distinct; - bool const_table,no_rows, used_for_duplicate_elimination; - /** - Forces DYNAMIC Aria row format for internal temporary tables. - */ - bool keep_row_order; - - bool no_keyread; - /** - If set, indicate that the table is not replicated by the server. - */ - bool locked_by_logger; - bool locked_by_name; - bool fulltext_searched; - bool no_cache; - /* To signal that the table is associated with a HANDLER statement */ - bool open_by_handler; - /* - To indicate that a non-null value of the auto_increment field - was provided by the user or retrieved from the current record. - Used only in the MODE_NO_AUTO_VALUE_ON_ZERO mode. - */ - bool auto_increment_field_not_null; - bool insert_or_update; /* Can be used by the handler */ - bool alias_name_used; /* true if table_name is alias */ - bool get_fields_in_item_tree; /* Signal to fix_field */ -private: - bool m_needs_reopen; - bool created; /* For tmp tables. TRUE <=> tmp table was actually created.*/ -public: -#ifdef HAVE_REPLICATION - /* used in RBR Triggers */ - bool master_had_triggers; -#endif - - REGINFO reginfo; /* field connections */ - MEM_ROOT mem_root; - /** - Initialized in Item_func_group_concat::setup for appropriate - temporary table if GROUP_CONCAT is used with ORDER BY | DISTINCT - and BLOB field count > 0. - */ - Blob_mem_storage *blob_storage; - GRANT_INFO grant; - /* - The arena which the items for expressions from the table definition - are associated with. - Currently only the items of the expressions for virtual columns are - associated with this arena. - TODO: To attach the partitioning expressions to this arena. - */ - Query_arena *expr_arena; -#ifdef WITH_PARTITION_STORAGE_ENGINE - partition_info *part_info; /* Partition related information */ - /* If true, all partitions have been pruned away */ - bool all_partitions_pruned_away; -#endif - uint max_keys; /* Size of allocated key_info array. */ - bool stats_is_read; /* Persistent statistics is read for the table */ - bool histograms_are_read; - MDL_ticket *mdl_ticket; - - /* - This is used only for potentially splittable materialized tables and it - points to the info used by the optimizer to apply splitting optimization - */ - SplM_opt_info *spl_opt_info; - key_map keys_usable_for_splitting; - - /* - Conjunction of the predicates of the form IS NOT NULL(f) where f refers to - a column of this TABLE such that they can be inferred from the condition - of the WHERE clause or from some ON expression of the processed select - and can be useful for range optimizer. - */ - Item *notnull_cond; - - inline void reset() { bzero((void*)this, sizeof(*this)); } - void init(THD *thd, TABLE_LIST *tl); - bool fill_item_list(List *item_list) const; - void reset_item_list(List *item_list, uint skip) const; - void clear_column_bitmaps(void); - void prepare_for_position(void); - MY_BITMAP *prepare_for_keyread(uint index, MY_BITMAP *map); - MY_BITMAP *prepare_for_keyread(uint index) - { return prepare_for_keyread(index, &tmp_set); } - void mark_columns_used_by_index(uint index, MY_BITMAP *map); - void mark_columns_used_by_index_no_reset(uint index, MY_BITMAP *map); - void restore_column_maps_after_keyread(MY_BITMAP *backup); - void mark_auto_increment_column(void); - void mark_columns_needed_for_update(void); - void mark_columns_needed_for_delete(void); - void mark_columns_needed_for_insert(void); - void mark_columns_per_binlog_row_image(void); - inline bool mark_column_with_deps(Field *field); - inline bool mark_virtual_column_with_deps(Field *field); - inline void mark_virtual_column_deps(Field *field); - bool mark_virtual_columns_for_write(bool insert_fl); - bool check_virtual_columns_marked_for_read(); - bool check_virtual_columns_marked_for_write(); - void mark_default_fields_for_write(bool insert_fl); - void mark_columns_used_by_virtual_fields(void); - void mark_check_constraint_columns_for_read(void); - int verify_constraints(bool ignore_failure); - inline void column_bitmaps_set(MY_BITMAP *read_set_arg) - { - read_set= read_set_arg; - if (file) - file->column_bitmaps_signal(); - } - inline void column_bitmaps_set(MY_BITMAP *read_set_arg, - MY_BITMAP *write_set_arg) - { - read_set= read_set_arg; - write_set= write_set_arg; - if (file) - file->column_bitmaps_signal(); - } - inline void column_bitmaps_set_no_signal(MY_BITMAP *read_set_arg, - MY_BITMAP *write_set_arg) - { - read_set= read_set_arg; - write_set= write_set_arg; - } - inline void use_all_columns() - { - column_bitmaps_set(&s->all_set, &s->all_set); - } - inline void use_all_stored_columns(); - inline void default_column_bitmaps() - { - read_set= &def_read_set; - write_set= &def_write_set; - rpl_write_set= 0; - } - /** Should this instance of the table be reopened? */ - inline bool needs_reopen() - { return !db_stat || m_needs_reopen; } - /* - Mark that all current connection instances of the table should be - reopen at end of statement - */ - void mark_table_for_reopen(); - /* Should only be called from Locked_tables_list::mark_table_for_reopen() */ - void internal_set_needs_reopen(bool value) - { - m_needs_reopen= value; - } - - bool alloc_keys(uint key_count); - bool check_tmp_key(uint key, uint key_parts, - uint (*next_field_no) (uchar *), uchar *arg); - bool add_tmp_key(uint key, uint key_parts, - uint (*next_field_no) (uchar *), uchar *arg, - bool unique); - void create_key_part_by_field(KEY_PART_INFO *key_part_info, - Field *field, uint fieldnr); - void use_index(int key_to_save); - void set_table_map(table_map map_arg, uint tablenr_arg) - { - map= map_arg; - tablenr= tablenr_arg; - } - - /// Return true if table is instantiated, and false otherwise. - bool is_created() const { return created; } - - /** - Set the table as "created", and enable flags in storage engine - that could not be enabled without an instantiated table. - */ - void set_created() - { - if (created) - return; - if (file->keyread_enabled()) - file->extra(HA_EXTRA_KEYREAD); - created= true; - } - - /* - Returns TRUE if the table is filled at execution phase (and so, the - optimizer must not do anything that depends on the contents of the table, - like range analysis or constant table detection) - */ - bool is_filled_at_execution(); - - bool update_const_key_parts(COND *conds); - - inline void initialize_opt_range_structures(); - - my_ptrdiff_t default_values_offset() const - { return (my_ptrdiff_t) (s->default_values - record[0]); } - - void move_fields(Field **ptr, const uchar *to, const uchar *from); - void remember_blob_values(String *blob_storage); - void restore_blob_values(String *blob_storage); - - uint actual_n_key_parts(KEY *keyinfo); - ulong actual_key_flags(KEY *keyinfo); - int update_virtual_field(Field *vf); - int update_virtual_fields(handler *h, enum_vcol_update_mode update_mode); - int update_default_fields(bool ignore_errors); - void evaluate_update_default_function(); - void reset_default_fields(); - inline ha_rows stat_records() { return used_stat_records; } - - void prepare_triggers_for_insert_stmt_or_event(); - bool prepare_triggers_for_delete_stmt_or_event(); - bool prepare_triggers_for_update_stmt_or_event(); - - Field **field_to_fill(); - bool validate_default_values_of_unset_fields(THD *thd) const; - - bool insert_all_rows_into_tmp_table(THD *thd, - TABLE *tmp_table, - TMP_TABLE_PARAM *tmp_table_param, - bool with_cleanup); - int fix_vcol_exprs(THD *thd); - Field *find_field_by_name(LEX_CSTRING *str) const; - bool export_structure(THD *thd, class Row_definition_list *defs); - bool is_splittable() { return spl_opt_info != NULL; } - void set_spl_opt_info(SplM_opt_info *spl_info); - void deny_splitting(); - double get_materialization_cost(); // Now used only if is_splittable()==true - void add_splitting_info_for_key_field(struct KEY_FIELD *key_field); - - key_map with_impossible_ranges; - - /* Number of cost info elements for possible range filters */ - uint range_rowid_filter_cost_info_elems; - /* Pointer to the array of cost info elements for range filters */ - Range_rowid_filter_cost_info *range_rowid_filter_cost_info; - /* The array of pointers to cost info elements for range filters */ - Range_rowid_filter_cost_info **range_rowid_filter_cost_info_ptr; - - void init_cost_info_for_usable_range_rowid_filters(THD *thd); - void prune_range_rowid_filters(); - void trace_range_rowid_filters(THD *thd) const; - Range_rowid_filter_cost_info * - best_range_rowid_filter_for_partial_join(uint access_key_no, - double records, - double access_cost_factor); - - /** - System Versioning support - */ - bool vers_write; - - bool versioned() const - { - return s->versioned; - } - - bool versioned(vers_kind_t type) const - { - DBUG_ASSERT(type); - return s->versioned == type; - } - - bool versioned_write() const - { - DBUG_ASSERT(versioned() || !vers_write); - return versioned() ? vers_write : false; - } - - bool versioned_write(vers_kind_t type) const - { - DBUG_ASSERT(type); - DBUG_ASSERT(versioned() || !vers_write); - return versioned(type) ? vers_write : false; - } - - Field *vers_start_field() const - { - DBUG_ASSERT(s->versioned); - return field[s->vers.start_fieldno]; - } - - Field *vers_end_field() const - { - DBUG_ASSERT(s->versioned); - return field[s->vers.end_fieldno]; - } - - Field *period_start_field() const - { - DBUG_ASSERT(s->period.name); - return field[s->period.start_fieldno]; - } - - Field *period_end_field() const - { - DBUG_ASSERT(s->period.name); - return field[s->period.end_fieldno]; - } - - - ulonglong vers_start_id() const; - ulonglong vers_end_id() const; - - int update_generated_fields(); - int period_make_insert(Item *src, Field *dst); - int insert_portion_of_time(THD *thd, const vers_select_conds_t &period_conds, - ha_rows *rows_inserted); - bool vers_check_update(List &items); - static bool check_period_overlaps(const KEY &key, const uchar *lhs, const uchar *rhs); - int delete_row(); - void vers_update_fields(); - void vers_update_end(); - void find_constraint_correlated_indexes(); - -/** Number of additional fields used in versioned tables */ -#define VERSIONING_FIELDS 2 -}; - - -/** - Helper class which specifies which members of TABLE are used for - participation in the list of used/unused TABLE objects for the share. -*/ - -struct TABLE_share -{ - static inline TABLE **next_ptr(TABLE *l) - { - return &l->next; - } - static inline TABLE ***prev_ptr(TABLE *l) - { - return (TABLE ***) &l->prev; - } -}; - -struct All_share_tables -{ - static inline TABLE **next_ptr(TABLE *l) - { - return &l->share_all_next; - } - static inline TABLE ***prev_ptr(TABLE *l) - { - return &l->share_all_prev; - } -}; - -typedef I_P_List All_share_tables_list; - -enum enum_schema_table_state -{ - NOT_PROCESSED= 0, - PROCESSED_BY_CREATE_SORT_INDEX, - PROCESSED_BY_JOIN_EXEC -}; - -enum enum_fk_option { FK_OPTION_UNDEF, FK_OPTION_RESTRICT, FK_OPTION_CASCADE, - FK_OPTION_SET_NULL, FK_OPTION_NO_ACTION, FK_OPTION_SET_DEFAULT}; - -typedef struct st_foreign_key_info -{ - LEX_CSTRING *foreign_id; - LEX_CSTRING *foreign_db; - LEX_CSTRING *foreign_table; - LEX_CSTRING *referenced_db; - LEX_CSTRING *referenced_table; - enum_fk_option update_method; - enum_fk_option delete_method; - LEX_CSTRING *referenced_key_name; - List foreign_fields; - List referenced_fields; -} FOREIGN_KEY_INFO; - -LEX_CSTRING *fk_option_name(enum_fk_option opt); -bool fk_modifies_child(enum_fk_option opt); - -class IS_table_read_plan; - -/* - Types of derived tables. The ending part is a bitmap of phases that are - applicable to a derived table of the type. -*/ -#define DTYPE_ALGORITHM_UNDEFINED 0U -#define DTYPE_VIEW 1U -#define DTYPE_TABLE 2U -#define DTYPE_MERGE 4U -#define DTYPE_MATERIALIZE 8U -#define DTYPE_MULTITABLE 16U -#define DTYPE_MASK (DTYPE_VIEW|DTYPE_TABLE|DTYPE_MULTITABLE) - -/* - Phases of derived tables/views handling, see sql_derived.cc - Values are used as parts of a bitmap attached to derived table types. -*/ -#define DT_INIT 1U -#define DT_PREPARE 2U -#define DT_OPTIMIZE 4U -#define DT_MERGE 8U -#define DT_MERGE_FOR_INSERT 16U -#define DT_CREATE 32U -#define DT_FILL 64U -#define DT_REINIT 128U -#define DT_PHASES 8U -/* Phases that are applicable to all derived tables. */ -#define DT_COMMON (DT_INIT + DT_PREPARE + DT_REINIT + DT_OPTIMIZE) -/* Phases that are applicable only to materialized derived tables. */ -#define DT_MATERIALIZE (DT_CREATE + DT_FILL) - -#define DT_PHASES_MERGE (DT_COMMON | DT_MERGE | DT_MERGE_FOR_INSERT) -#define DT_PHASES_MATERIALIZE (DT_COMMON | DT_MATERIALIZE) - -#define VIEW_ALGORITHM_UNDEFINED 0 -/* Special value for ALTER VIEW: inherit original algorithm. */ -#define VIEW_ALGORITHM_INHERIT DTYPE_VIEW -#define VIEW_ALGORITHM_MERGE (DTYPE_VIEW | DTYPE_MERGE) -#define VIEW_ALGORITHM_TMPTABLE (DTYPE_VIEW | DTYPE_MATERIALIZE) - -/* - View algorithm values as stored in the FRM. Values differ from in-memory - representation for backward compatibility. -*/ - -#define VIEW_ALGORITHM_UNDEFINED_FRM 0U -#define VIEW_ALGORITHM_MERGE_FRM 1U -#define VIEW_ALGORITHM_TMPTABLE_FRM 2U - -#define JOIN_TYPE_LEFT 1U -#define JOIN_TYPE_RIGHT 2U -#define JOIN_TYPE_OUTER 4U /* Marker that this is an outer join */ - -/* view WITH CHECK OPTION parameter options */ -#define VIEW_CHECK_NONE 0 -#define VIEW_CHECK_LOCAL 1 -#define VIEW_CHECK_CASCADED 2 - -/* result of view WITH CHECK OPTION parameter check */ -#define VIEW_CHECK_OK 0 -#define VIEW_CHECK_ERROR 1 -#define VIEW_CHECK_SKIP 2 - -/** The threshold size a blob field buffer before it is freed */ -#define MAX_TDC_BLOB_SIZE 65536 - -/** number of bytes used by field positional indexes in frm */ -constexpr uint frm_fieldno_size= 2; -/** number of bytes used by key position number in frm */ -constexpr uint frm_keyno_size= 2; -static inline uint16 read_frm_fieldno(const uchar *data) -{ return uint2korr(data); } -static inline void store_frm_fieldno(uchar *data, uint16 fieldno) -{ int2store(data, fieldno); } -static inline uint16 read_frm_keyno(const uchar *data) -{ return uint2korr(data); } -static inline void store_frm_keyno(uchar *data, uint16 fieldno) -{ int2store(data, fieldno); } -static inline size_t extra2_str_size(size_t len) -{ return (len > 255 ? 3 : 1) + len; } - -class select_unit; -class TMP_TABLE_PARAM; - -Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref, - LEX_CSTRING *name); - -struct Field_translator -{ - Item *item; - LEX_CSTRING name; -}; - - -/* - Column reference of a NATURAL/USING join. Since column references in - joins can be both from views and stored tables, may point to either a - Field (for tables), or a Field_translator (for views). -*/ - -class Natural_join_column: public Sql_alloc -{ -public: - Field_translator *view_field; /* Column reference of merge view. */ - Item_field *table_field; /* Column reference of table or temp view. */ - TABLE_LIST *table_ref; /* Original base table/view reference. */ - /* - True if a common join column of two NATURAL/USING join operands. Notice - that when we have a hierarchy of nested NATURAL/USING joins, a column can - be common at some level of nesting but it may not be common at higher - levels of nesting. Thus this flag may change depending on at which level - we are looking at some column. - */ - bool is_common; -public: - Natural_join_column(Field_translator *field_param, TABLE_LIST *tab); - Natural_join_column(Item_field *field_param, TABLE_LIST *tab); - LEX_CSTRING *name(); - Item *create_item(THD *thd); - Field *field(); - const char *safe_table_name(); - const char *safe_db_name(); - GRANT_INFO *grant(); -}; - - -/** - Type of table which can be open for an element of table list. -*/ - -enum enum_open_type -{ - OT_TEMPORARY_OR_BASE= 0, OT_TEMPORARY_ONLY, OT_BASE_ONLY -}; - - -class SJ_MATERIALIZATION_INFO; -class Index_hint; -class Item_in_subselect; - -/* trivial class, for %union in sql_yacc.yy */ -struct vers_history_point_t -{ - vers_kind_t unit; - Item *item; -}; - -class Vers_history_point : public vers_history_point_t -{ - void fix_item(); - -public: - Vers_history_point() { empty(); } - Vers_history_point(vers_kind_t unit_arg, Item *item_arg) - { - unit= unit_arg; - item= item_arg; - fix_item(); - } - Vers_history_point(vers_history_point_t p) - { - unit= p.unit; - item= p.item; - fix_item(); - } - void empty() { unit= VERS_TIMESTAMP; item= NULL; } - void print(String *str, enum_query_type, const char *prefix, size_t plen) const; - bool check_unit(THD *thd); - void bad_expression_data_type_error(const char *type) const; - bool eq(const vers_history_point_t &point) const; -}; - -struct vers_select_conds_t -{ - vers_system_time_t type; - vers_system_time_t orig_type; - bool used:1; - bool delete_history:1; - Vers_history_point start; - Vers_history_point end; - Lex_ident name; - - Item_field *field_start; - Item_field *field_end; - - const TABLE_SHARE::period_info_t *period; - - void empty() - { - type= SYSTEM_TIME_UNSPECIFIED; - orig_type= SYSTEM_TIME_UNSPECIFIED; - used= false; - delete_history= false; - start.empty(); - end.empty(); - } - - void init(vers_system_time_t _type, - Vers_history_point _start= Vers_history_point(), - Vers_history_point _end= Vers_history_point(), - Lex_ident _name= "SYSTEM_TIME") - { - type= _type; - orig_type= _type; - used= false; - delete_history= (type == SYSTEM_TIME_HISTORY || - type == SYSTEM_TIME_BEFORE); - start= _start; - end= _end; - name= _name; - } - - void set_all() - { - type= SYSTEM_TIME_ALL; - name= "SYSTEM_TIME"; - } - - void print(String *str, enum_query_type query_type) const; - - bool init_from_sysvar(THD *thd); - - bool is_set() const - { - return type != SYSTEM_TIME_UNSPECIFIED; - } - bool check_units(THD *thd); - bool was_set() const - { - return orig_type != SYSTEM_TIME_UNSPECIFIED; - } - bool need_setup() const - { - return type != SYSTEM_TIME_UNSPECIFIED && type != SYSTEM_TIME_ALL; - } - bool eq(const vers_select_conds_t &conds) const; -}; - -/* - Table reference in the FROM clause. - - These table references can be of several types that correspond to - different SQL elements. Below we list all types of TABLE_LISTs with - the necessary conditions to determine when a TABLE_LIST instance - belongs to a certain type. - - 1) table (TABLE_LIST::view == NULL) - - base table - (TABLE_LIST::derived == NULL) - - FROM-clause subquery - TABLE_LIST::table is a temp table - (TABLE_LIST::derived != NULL) - - information schema table - (TABLE_LIST::schema_table != NULL) - NOTICE: for schema tables TABLE_LIST::field_translation may be != NULL - 2) view (TABLE_LIST::view != NULL) - - merge (TABLE_LIST::effective_algorithm == VIEW_ALGORITHM_MERGE) - also (TABLE_LIST::field_translation != NULL) - - tmptable (TABLE_LIST::effective_algorithm == VIEW_ALGORITHM_TMPTABLE) - also (TABLE_LIST::field_translation == NULL) - 2.5) TODO: Add derived tables description here - 3) nested table reference (TABLE_LIST::nested_join != NULL) - - table sequence - e.g. (t1, t2, t3) - TODO: how to distinguish from a JOIN? - - general JOIN - TODO: how to distinguish from a table sequence? - - NATURAL JOIN - (TABLE_LIST::natural_join != NULL) - - JOIN ... USING - (TABLE_LIST::join_using_fields != NULL) - - semi-join nest (sj_on_expr!= NULL && sj_subq_pred!=NULL) - 4) jtbm semi-join (jtbm_subselect != NULL) -*/ - -/** last_leaf_for_name_resolutioning support. */ - -struct LEX; -class Index_hint; -struct TABLE_LIST -{ - TABLE_LIST() {} /* Remove gcc warning */ - - enum prelocking_types - { - PRELOCK_NONE, PRELOCK_ROUTINE, PRELOCK_FK - }; - - /** - Prepare TABLE_LIST that consists of one table instance to use in - open_and_lock_tables - */ - inline void reset() { bzero((void*)this, sizeof(*this)); } - inline void init_one_table(const LEX_CSTRING *db_arg, - const LEX_CSTRING *table_name_arg, - const LEX_CSTRING *alias_arg, - enum thr_lock_type lock_type_arg) - { - enum enum_mdl_type mdl_type; - if (lock_type_arg >= TL_WRITE_ALLOW_WRITE) - mdl_type= MDL_SHARED_WRITE; - else if (lock_type_arg == TL_READ_NO_INSERT) - mdl_type= MDL_SHARED_NO_WRITE; - else - mdl_type= MDL_SHARED_READ; - - reset(); - DBUG_ASSERT(!db_arg->str || strlen(db_arg->str) == db_arg->length); - DBUG_ASSERT(!table_name_arg->str || strlen(table_name_arg->str) == table_name_arg->length); - DBUG_ASSERT(!alias_arg || strlen(alias_arg->str) == alias_arg->length); - db= *db_arg; - table_name= *table_name_arg; - alias= (alias_arg ? *alias_arg : *table_name_arg); - lock_type= lock_type_arg; - updating= lock_type >= TL_WRITE_ALLOW_WRITE; - MDL_REQUEST_INIT(&mdl_request, MDL_key::TABLE, db.str, table_name.str, - mdl_type, MDL_TRANSACTION); - } - - TABLE_LIST(TABLE *table_arg, thr_lock_type lock_type) - { - DBUG_ASSERT(table_arg->s); - init_one_table(&table_arg->s->db, &table_arg->s->table_name, - NULL, lock_type); - table= table_arg; - vers_conditions.name= table->s->vers.name; - } - - inline void init_one_table_for_prelocking(const LEX_CSTRING *db_arg, - const LEX_CSTRING *table_name_arg, - const LEX_CSTRING *alias_arg, - enum thr_lock_type lock_type_arg, - prelocking_types prelocking_type, - TABLE_LIST *belong_to_view_arg, - uint8 trg_event_map_arg, - TABLE_LIST ***last_ptr, - my_bool insert_data) - - { - init_one_table(db_arg, table_name_arg, alias_arg, lock_type_arg); - cacheable_table= 1; - prelocking_placeholder= prelocking_type; - open_type= (prelocking_type == PRELOCK_ROUTINE ? - OT_TEMPORARY_OR_BASE : - OT_BASE_ONLY); - belong_to_view= belong_to_view_arg; - trg_event_map= trg_event_map_arg; - /* MDL is enough for read-only FK checks, we don't need the table */ - if (prelocking_type == PRELOCK_FK && lock_type < TL_WRITE_ALLOW_WRITE) - open_strategy= OPEN_STUB; - - **last_ptr= this; - prev_global= *last_ptr; - *last_ptr= &next_global; - for_insert_data= insert_data; - } - - - /* - List of tables local to a subquery (used by SQL_I_List). Considers - views as leaves (unlike 'next_leaf' below). Created at parse time - in st_select_lex::add_table_to_list() -> table_list.link_in_list(). - */ - TABLE_LIST *next_local; - /* link in a global list of all queries tables */ - TABLE_LIST *next_global, **prev_global; - LEX_CSTRING db; - LEX_CSTRING table_name; - LEX_CSTRING schema_table_name; - LEX_CSTRING alias; - const char *option; /* Used by cache index */ - Item *on_expr; /* Used with outer join */ - Name_resolution_context *on_context; /* For ON expressions */ - - Item *sj_on_expr; - /* - (Valid only for semi-join nests) Bitmap of tables that are within the - semi-join (this is different from bitmap of all nest's children because - tables that were pulled out of the semi-join nest remain listed as - nest's children). - */ - table_map sj_inner_tables; - /* Number of IN-compared expressions */ - uint sj_in_exprs; - - /* If this is a non-jtbm semi-join nest: corresponding subselect predicate */ - Item_in_subselect *sj_subq_pred; - - table_map original_subq_pred_used_tables; - - /* If this is a jtbm semi-join object: corresponding subselect predicate */ - Item_in_subselect *jtbm_subselect; - /* TODO: check if this can be joined with tablenr_exec */ - uint jtbm_table_no; - - SJ_MATERIALIZATION_INFO *sj_mat_info; - - /* - The structure of ON expression presented in the member above - can be changed during certain optimizations. This member - contains a snapshot of AND-OR structure of the ON expression - made after permanent transformations of the parse tree, and is - used to restore ON clause before every reexecution of a prepared - statement or stored procedure. - */ - Item *prep_on_expr; - COND_EQUAL *cond_equal; /* Used with outer join */ - /* - During parsing - left operand of NATURAL/USING join where 'this' is - the right operand. After parsing (this->natural_join == this) iff - 'this' represents a NATURAL or USING join operation. Thus after - parsing 'this' is a NATURAL/USING join iff (natural_join != NULL). - */ - TABLE_LIST *natural_join; - /* - True if 'this' represents a nested join that is a NATURAL JOIN. - For one of the operands of 'this', the member 'natural_join' points - to the other operand of 'this'. - */ - bool is_natural_join; - /* Field names in a USING clause for JOIN ... USING. */ - List *join_using_fields; - /* - Explicitly store the result columns of either a NATURAL/USING join or - an operand of such a join. - */ - List *join_columns; - /* TRUE if join_columns contains all columns of this table reference. */ - bool is_join_columns_complete; - - /* - List of nodes in a nested join tree, that should be considered as - leaves with respect to name resolution. The leaves are: views, - top-most nodes representing NATURAL/USING joins, subqueries, and - base tables. All of these TABLE_LIST instances contain a - materialized list of columns. The list is local to a subquery. - */ - TABLE_LIST *next_name_resolution_table; - /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */ - List *index_hints; - TABLE *table; /* opened table */ - ulonglong table_id; /* table id (from binlog) for opened table */ - /* - select_result for derived table to pass it from table creation to table - filling procedure - */ - select_unit *derived_result; - /* Stub used for materialized derived tables. */ - table_map map; /* ID bit of table (1,2,4,8,16...) */ - table_map get_map() - { - return jtbm_subselect? table_map(1) << jtbm_table_no : table->map; - } - uint get_tablenr() - { - return jtbm_subselect? jtbm_table_no : table->tablenr; - } - void set_tablenr(uint new_tablenr) - { - if (jtbm_subselect) - { - jtbm_table_no= new_tablenr; - } - if (table) - { - table->tablenr= new_tablenr; - table->map= table_map(1) << new_tablenr; - } - } - /* - Reference from aux_tables to local list entry of main select of - multi-delete statement: - delete t1 from t2,t1 where t1.a<'B' and t2.b=t1.b; - here it will be reference of first occurrence of t1 to second (as you - can see this lists can't be merged) - */ - TABLE_LIST *correspondent_table; - /** - @brief Normally, this field is non-null for anonymous derived tables only. - - @details This field is set to non-null for - - - Anonymous derived tables, In this case it points to the SELECT_LEX_UNIT - representing the derived table. E.g. for a query - - @verbatim SELECT * FROM (SELECT a FROM t1) b @endverbatim - - For the @c TABLE_LIST representing the derived table @c b, @c derived - points to the SELECT_LEX_UNIT representing the result of the query within - parenteses. - - - Views. This is set for views with @verbatim ALGORITHM = TEMPTABLE - @endverbatim by mysql_make_view(). - - @note Inside views, a subquery in the @c FROM clause is not allowed. - @note Do not use this field to separate views/base tables/anonymous - derived tables. Use TABLE_LIST::is_anonymous_derived_table(). - */ - st_select_lex_unit *derived; /* SELECT_LEX_UNIT of derived table */ - With_element *with; /* With element defining this table (if any) */ - /* Bitmap of the defining with element */ - table_map with_internal_reference_map; - TABLE_LIST * next_with_rec_ref; - bool is_derived_with_recursive_reference; - bool block_handle_derived; - /* The interface employed to materialize the table by a foreign engine */ - derived_handler *dt_handler; - /* The text of the query specifying the derived table */ - LEX_CSTRING derived_spec; - /* - The object used to organize execution of the query that specifies - the derived table by a foreign engine - */ - Pushdown_derived *pushdown_derived; - ST_SCHEMA_TABLE *schema_table; /* Information_schema table */ - st_select_lex *schema_select_lex; - /* - True when the view field translation table is used to convert - schema table fields for backwards compatibility with SHOW command. - */ - bool schema_table_reformed; - TMP_TABLE_PARAM *schema_table_param; - /* link to select_lex where this table was used */ - st_select_lex *select_lex; - LEX *view; /* link on VIEW lex for merging */ - Field_translator *field_translation; /* array of VIEW fields */ - /* pointer to element after last one in translation table above */ - Field_translator *field_translation_end; - bool field_translation_updated; - /* - List (based on next_local) of underlying tables of this view. I.e. it - does not include the tables of subqueries used in the view. Is set only - for merged views. - */ - TABLE_LIST *merge_underlying_list; - /* - - 0 for base tables - - in case of the view it is the list of all (not only underlying - tables but also used in subquery ones) tables of the view. - */ - List *view_tables; - /* most upper view this table belongs to */ - TABLE_LIST *belong_to_view; - /* A derived table this table belongs to */ - TABLE_LIST *belong_to_derived; - /* - The view directly referencing this table - (non-zero only for merged underlying tables of a view). - */ - TABLE_LIST *referencing_view; - - table_map view_used_tables; - table_map map_exec; - /* TODO: check if this can be joined with jtbm_table_no */ - uint tablenr_exec; - uint maybe_null_exec; - - /* Ptr to parent MERGE table list item. See top comment in ha_myisammrg.cc */ - TABLE_LIST *parent_l; - /* - Security context (non-zero only for tables which belong - to view with SQL SECURITY DEFINER) - */ - Security_context *security_ctx; - /* - This view security context (non-zero only for views with - SQL SECURITY DEFINER) - */ - Security_context *view_sctx; - bool allowed_show; - Item *where; /* VIEW WHERE clause condition */ - Item *check_option; /* WITH CHECK OPTION condition */ - LEX_STRING select_stmt; /* text of (CREATE/SELECT) statement */ - LEX_CSTRING md5; /* md5 of query text */ - LEX_CSTRING source; /* source of CREATE VIEW */ - LEX_CSTRING view_db; /* saved view database */ - LEX_CSTRING view_name; /* saved view name */ - LEX_STRING timestamp; /* GMT time stamp of last operation */ - LEX_USER definer; /* definer of view */ - ulonglong file_version; /* version of file's field set */ - ulonglong mariadb_version; /* version of server on creation */ - ulonglong updatable_view; /* VIEW can be updated */ - /** - @brief The declared algorithm, if this is a view. - @details One of - - VIEW_ALGORITHM_UNDEFINED - - VIEW_ALGORITHM_TMPTABLE - - VIEW_ALGORITHM_MERGE - @to do Replace with an enum - */ - ulonglong algorithm; - ulonglong view_suid; /* view is suid (TRUE dy default) */ - ulonglong with_check; /* WITH CHECK OPTION */ - /* - effective value of WITH CHECK OPTION (differ for temporary table - algorithm) - */ - uint8 effective_with_check; - /** - @brief The view algorithm that is actually used, if this is a view. - @details One of - - VIEW_ALGORITHM_UNDEFINED - - VIEW_ALGORITHM_TMPTABLE - - VIEW_ALGORITHM_MERGE - @to do Replace with an enum - */ - uint8 derived_type; - GRANT_INFO grant; - /* data need by some engines in query cache*/ - ulonglong engine_data; - /* call back function for asking handler about caching in query cache */ - qc_engine_callback callback_func; - thr_lock_type lock_type; - uint outer_join; /* Which join type */ - uint shared; /* Used in multi-upd */ - bool updatable; /* VIEW/TABLE can be updated now */ - bool straight; /* optimize with prev table */ - bool updating; /* for replicate-do/ignore table */ - bool force_index; /* prefer index over table scan */ - bool ignore_leaves; /* preload only non-leaf nodes */ - bool crashed; /* Table was found crashed */ - table_map dep_tables; /* tables the table depends on */ - table_map on_expr_dep_tables; /* tables on expression depends on */ - struct st_nested_join *nested_join; /* if the element is a nested join */ - TABLE_LIST *embedding; /* nested join containing the table */ - List *join_list;/* join list the table belongs to */ - bool lifted; /* set to true when the table is moved to - the upper level at the parsing stage */ - bool cacheable_table; /* stop PS caching */ - /* used in multi-upd/views privilege check */ - bool table_in_first_from_clause; - /** - Specifies which kind of table should be open for this element - of table list. - */ - enum enum_open_type open_type; - /* TRUE if this merged view contain auto_increment field */ - bool contain_auto_increment; - bool compact_view_format; /* Use compact format for SHOW CREATE VIEW */ - /* view where processed */ - bool where_processed; - /* TRUE <=> VIEW CHECK OPTION expression has been processed */ - bool check_option_processed; - /* TABLE_TYPE_UNKNOWN if any type is acceptable */ - Table_type required_type; - handlerton *db_type; /* table_type for handler */ - char timestamp_buffer[MAX_DATETIME_WIDTH + 1]; - /* - This TABLE_LIST object is just placeholder for prelocking, it will be - used for implicit LOCK TABLES only and won't be used in real statement. - */ - prelocking_types prelocking_placeholder; - /** - Indicates that if TABLE_LIST object corresponds to the table/view - which requires special handling. - */ - enum enum_open_strategy - { - /* Normal open. */ - OPEN_NORMAL= 0, - /* Associate a table share only if the the table exists. */ - OPEN_IF_EXISTS, - /* Don't associate a table share. */ - OPEN_STUB - } open_strategy; - /** TRUE if an alias for this table was specified in the SQL. */ - bool is_alias; - /** TRUE if the table is referred to in the statement using a fully - qualified name (.). - */ - bool is_fqtn; - - /* TRUE <=> derived table should be filled right after optimization. */ - bool fill_me; - /* TRUE <=> view/DT is merged. */ - /* TODO: replace with derived_type */ - bool merged; - bool merged_for_insert; - bool sequence; /* Part of NEXTVAL/CURVAL/LASTVAL */ - - /* - Items created by create_view_field and collected to change them in case - of materialization of the view/derived table - */ - List used_items; - /* Sublist (tail) of persistent used_items */ - List persistent_used_items; - - /* View creation context. */ - - View_creation_ctx *view_creation_ctx; - - /* - Attributes to save/load view creation context in/from frm-file. - - Ther are required only to be able to use existing parser to load - view-definition file. As soon as the parser parsed the file, view - creation context is initialized and the attributes become redundant. - - These attributes MUST NOT be used for any purposes but the parsing. - */ - - LEX_CSTRING view_client_cs_name; - LEX_CSTRING view_connection_cl_name; - - /* - View definition (SELECT-statement) in the UTF-form. - */ - - LEX_CSTRING view_body_utf8; - - /* End of view definition context. */ - - /** - Indicates what triggers we need to pre-load for this TABLE_LIST - when opening an associated TABLE. This is filled after - the parsed tree is created. - */ - uint8 trg_event_map; - /* TRUE <=> this table is a const one and was optimized away. */ - bool optimized_away; - - /** - TRUE <=> already materialized. Valid only for materialized derived - tables/views. - */ - bool materialized; - /* I_S: Flags to open_table (e.g. OPEN_TABLE_ONLY or OPEN_VIEW_ONLY) */ - uint i_s_requested_object; - - bool prohibit_cond_pushdown; - - /* - I_S: how to read the tables (SKIP_OPEN_TABLE/OPEN_FRM_ONLY/OPEN_FULL_TABLE) - */ - uint table_open_method; - /* - I_S: where the schema table was filled - (this is a hack. The code should be able to figure out whether reading - from I_S should be done by create_sort_index() or by JOIN::exec.) - */ - enum enum_schema_table_state schema_table_state; - - /* Something like a "query plan" for reading INFORMATION_SCHEMA table */ - IS_table_read_plan *is_table_read_plan; - - MDL_request mdl_request; - -#ifdef WITH_PARTITION_STORAGE_ENGINE - /* List to carry partition names from PARTITION (...) clause in statement */ - List *partition_names; -#endif /* WITH_PARTITION_STORAGE_ENGINE */ - - void calc_md5(const char *buffer); - int view_check_option(THD *thd, bool ignore_failure); - bool create_field_translation(THD *thd); - bool setup_underlying(THD *thd); - void cleanup_items(); - bool placeholder() - { - return derived || view || schema_table || !table; - } - void print(THD *thd, table_map eliminated_tables, String *str, - enum_query_type query_type); - bool check_single_table(TABLE_LIST **table, table_map map, - TABLE_LIST *view); - bool set_insert_values(MEM_ROOT *mem_root); - void hide_view_error(THD *thd); - TABLE_LIST *find_underlying_table(TABLE *table); - TABLE_LIST *first_leaf_for_name_resolution(); - TABLE_LIST *last_leaf_for_name_resolution(); - - /* System Versioning */ - vers_select_conds_t vers_conditions; - vers_select_conds_t period_conditions; - - bool has_period() const - { - return period_conditions.is_set(); - } - - my_bool for_insert_data; - - /** - @brief - Find the bottom in the chain of embedded table VIEWs. - - @detail - This is used for single-table UPDATE/DELETE when they are modifying a - single-table VIEW. - */ - TABLE_LIST *find_table_for_update() - { - TABLE_LIST *tbl= this; - while(!tbl->is_multitable() && tbl->single_table_updatable() && - tbl->merge_underlying_list) - { - tbl= tbl->merge_underlying_list; - } - return tbl; - } - TABLE *get_real_join_table(); - bool is_leaf_for_name_resolution(); - inline TABLE_LIST *top_table() - { return belong_to_view ? belong_to_view : this; } - inline bool prepare_check_option(THD *thd) - { - bool res= FALSE; - if (effective_with_check) - res= prep_check_option(thd, effective_with_check); - return res; - } - inline bool prepare_where(THD *thd, Item **conds, - bool no_where_clause) - { - if (!view || is_merged_derived()) - return prep_where(thd, conds, no_where_clause); - return FALSE; - } - - void register_want_access(privilege_t want_access); - bool prepare_security(THD *thd); -#ifndef NO_EMBEDDED_ACCESS_CHECKS - Security_context *find_view_security_context(THD *thd); - bool prepare_view_security_context(THD *thd); -#endif - /* - Cleanup for re-execution in a prepared statement or a stored - procedure. - */ - void reinit_before_use(THD *thd); - Item_subselect *containing_subselect(); - - /* - Compiles the tagged hints list and fills up TABLE::keys_in_use_for_query, - TABLE::keys_in_use_for_group_by, TABLE::keys_in_use_for_order_by, - TABLE::force_index and TABLE::covering_keys. - */ - bool process_index_hints(TABLE *table); - - /** - Compare the version of metadata from the previous execution - (if any) with values obtained from the current table - definition cache element. - - @sa check_and_update_table_version() - */ - inline bool is_table_ref_id_equal(TABLE_SHARE *s) const - { - return (m_table_ref_type == s->get_table_ref_type() && - m_table_ref_version == s->get_table_ref_version()); - } - - /** - Record the value of metadata version of the corresponding - table definition cache element in this parse tree node. - - @sa check_and_update_table_version() - */ - inline void set_table_ref_id(TABLE_SHARE *s) - { set_table_ref_id(s->get_table_ref_type(), s->get_table_ref_version()); } - - inline void set_table_ref_id(enum_table_ref_type table_ref_type_arg, - ulong table_ref_version_arg) - { - m_table_ref_type= table_ref_type_arg; - m_table_ref_version= table_ref_version_arg; - } - - /* Set of functions returning/setting state of a derived table/view. */ - bool is_non_derived() const { return (!derived_type); } - bool is_view_or_derived() const { return derived_type; } - bool is_view() const { return (derived_type & DTYPE_VIEW); } - bool is_derived() const { return (derived_type & DTYPE_TABLE); } - bool is_with_table(); - bool is_recursive_with_table(); - bool is_with_table_recursive_reference(); - void register_as_derived_with_rec_ref(With_element *rec_elem); - bool is_nonrecursive_derived_with_rec_ref(); - bool fill_recursive(THD *thd); - - inline void set_view() - { - derived_type= DTYPE_VIEW; - } - inline void set_derived() - { - derived_type= DTYPE_TABLE; - } - bool is_merged_derived() const { return (derived_type & DTYPE_MERGE); } - inline void set_merged_derived() - { - DBUG_ENTER("set_merged_derived"); - DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", - (alias.str ? alias.str : ""), - get_unit())); - derived_type= static_cast((derived_type & DTYPE_MASK) | - DTYPE_TABLE | DTYPE_MERGE); - set_check_merged(); - DBUG_VOID_RETURN; - } - bool is_materialized_derived() const - { - return (derived_type & DTYPE_MATERIALIZE); - } - void set_materialized_derived() - { - DBUG_ENTER("set_materialized_derived"); - DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", - (alias.str ? alias.str : ""), - get_unit())); - derived= get_unit(); - derived_type= static_cast((derived_type & - (derived ? DTYPE_MASK : DTYPE_VIEW)) | - DTYPE_TABLE | DTYPE_MATERIALIZE); - set_check_materialized(); - DBUG_VOID_RETURN; - } - bool is_multitable() const { return (derived_type & DTYPE_MULTITABLE); } - inline void set_multitable() - { - derived_type|= DTYPE_MULTITABLE; - } - bool set_as_with_table(THD *thd, With_element *with_elem); - void reset_const_table(); - bool handle_derived(LEX *lex, uint phases); - - /** - @brief True if this TABLE_LIST represents an anonymous derived table, - i.e. the result of a subquery. - */ - bool is_anonymous_derived_table() const { return derived && !view; } - - /** - @brief Returns the name of the database that the referenced table belongs - to. - */ - const char *get_db_name() const { return view != NULL ? view_db.str : db.str; } - - /** - @brief Returns the name of the table that this TABLE_LIST represents. - - @details The unqualified table name or view name for a table or view, - respectively. - */ - const char *get_table_name() const { return view != NULL ? view_name.str : table_name.str; } - bool is_active_sjm(); - bool is_jtbm() { return MY_TEST(jtbm_subselect != NULL); } - st_select_lex_unit *get_unit(); - st_select_lex *get_single_select(); - void wrap_into_nested_join(List &join_list); - bool init_derived(THD *thd, bool init_view); - int fetch_number_of_rows(); - bool change_refs_to_fields(); - - bool single_table_updatable(); - - bool is_inner_table_of_outer_join() - { - for (TABLE_LIST *tbl= this; tbl; tbl= tbl->embedding) - { - if (tbl->outer_join) - return true; - } - return false; - } - void set_lock_type(THD* thd, enum thr_lock_type lock); - - derived_handler *find_derived_handler(THD *thd); - TABLE_LIST *get_first_table(); - - void remove_join_columns() - { - if (join_columns) - { - join_columns->empty(); - join_columns= NULL; - is_join_columns_complete= FALSE; - } - } - -private: - bool prep_check_option(THD *thd, uint8 check_opt_type); - bool prep_where(THD *thd, Item **conds, bool no_where_clause); - void set_check_materialized(); -#ifndef DBUG_OFF - void set_check_merged(); -#else - inline void set_check_merged() {} -#endif - /** See comments for set_table_ref_id() */ - enum enum_table_ref_type m_table_ref_type; - /** See comments for set_table_ref_id() */ - ulong m_table_ref_version; -}; - -class Item; - -/* - Iterator over the fields of a generic table reference. -*/ - -class Field_iterator: public Sql_alloc -{ -public: - Field_iterator() {} /* Remove gcc warning */ - virtual ~Field_iterator() {} - virtual void set(TABLE_LIST *)= 0; - virtual void next()= 0; - virtual bool end_of_fields()= 0; /* Return 1 at end of list */ - virtual LEX_CSTRING *name()= 0; - virtual Item *create_item(THD *)= 0; - virtual Field *field()= 0; -}; - - -/* - Iterator over the fields of a base table, view with temporary - table, or subquery. -*/ - -class Field_iterator_table: public Field_iterator -{ - Field **ptr; -public: - Field_iterator_table() :ptr(0) {} - void set(TABLE_LIST *table) { ptr= table->table->field; } - void set_table(TABLE *table) { ptr= table->field; } - void next() { ptr++; } - bool end_of_fields() { return *ptr == 0; } - LEX_CSTRING *name(); - Item *create_item(THD *thd); - Field *field() { return *ptr; } -}; - - -/* Iterator over the fields of a merge view. */ - -class Field_iterator_view: public Field_iterator -{ - Field_translator *ptr, *array_end; - TABLE_LIST *view; -public: - Field_iterator_view() :ptr(0), array_end(0) {} - void set(TABLE_LIST *table); - void next() { ptr++; } - bool end_of_fields() { return ptr == array_end; } - LEX_CSTRING *name(); - Item *create_item(THD *thd); - Item **item_ptr() {return &ptr->item; } - Field *field() { return 0; } - inline Item *item() { return ptr->item; } - Field_translator *field_translator() { return ptr; } -}; - - -/* - Field_iterator interface to the list of materialized fields of a - NATURAL/USING join. -*/ - -class Field_iterator_natural_join: public Field_iterator -{ - List_iterator_fast column_ref_it; - Natural_join_column *cur_column_ref; -public: - Field_iterator_natural_join() :cur_column_ref(NULL) {} - ~Field_iterator_natural_join() {} - void set(TABLE_LIST *table); - void next(); - bool end_of_fields() { return !cur_column_ref; } - LEX_CSTRING *name() { return cur_column_ref->name(); } - Item *create_item(THD *thd) { return cur_column_ref->create_item(thd); } - Field *field() { return cur_column_ref->field(); } - Natural_join_column *column_ref() { return cur_column_ref; } -}; - - -/* - Generic iterator over the fields of an arbitrary table reference. - - DESCRIPTION - This class unifies the various ways of iterating over the columns - of a table reference depending on the type of SQL entity it - represents. If such an entity represents a nested table reference, - this iterator encapsulates the iteration over the columns of the - members of the table reference. - - IMPLEMENTATION - The implementation assumes that all underlying NATURAL/USING table - references already contain their result columns and are linked into - the list TABLE_LIST::next_name_resolution_table. -*/ - -class Field_iterator_table_ref: public Field_iterator -{ - TABLE_LIST *table_ref, *first_leaf, *last_leaf; - Field_iterator_table table_field_it; - Field_iterator_view view_field_it; - Field_iterator_natural_join natural_join_it; - Field_iterator *field_it; - void set_field_iterator(); -public: - Field_iterator_table_ref() :field_it(NULL) {} - void set(TABLE_LIST *table); - void next(); - bool end_of_fields() - { return (table_ref == last_leaf && field_it->end_of_fields()); } - LEX_CSTRING *name() { return field_it->name(); } - const char *get_table_name(); - const char *get_db_name(); - GRANT_INFO *grant(); - Item *create_item(THD *thd) { return field_it->create_item(thd); } - Field *field() { return field_it->field(); } - Natural_join_column *get_or_create_column_ref(THD *thd, TABLE_LIST *parent_table_ref); - Natural_join_column *get_natural_column_ref(); -}; - - -#define JOIN_OP_NEST 1 -#define REBALANCED_NEST 2 - -typedef struct st_nested_join -{ - List join_list; /* list of elements in the nested join */ - /* - Currently the valid values for nest type are: - JOIN_OP_NEST - for nest created for JOIN operation used as an operand in - a join expression, contains 2 elements; - JOIN_OP_NEST | REBALANCED_NEST - nest created after tree re-balancing - in st_select_lex::add_cross_joined_table(), contains 1 element; - 0 - for all other nests. - Examples: - 1. SELECT * FROM t1 JOIN t2 LEFT JOIN t3 ON t2.a=t3.a; - Here the nest created for LEFT JOIN at first has nest_type==JOIN_OP_NEST. - After re-balancing in st_select_lex::add_cross_joined_table() this nest - has nest_type==JOIN_OP_NEST | REBALANCED_NEST. The nest for JOIN created - in st_select_lex::add_cross_joined_table() has nest_type== JOIN_OP_NEST. - 2. SELECT * FROM t1 JOIN (t2 LEFT JOIN t3 ON t2.a=t3.a) - Here the nest created for LEFT JOIN has nest_type==0, because it's not - an operand in a join expression. The nest created for JOIN has nest_type - set to JOIN_OP_NEST. - */ - uint nest_type; - /* - Bitmap of tables within this nested join (including those embedded within - its children), including tables removed by table elimination. - */ - table_map used_tables; - table_map not_null_tables; /* tables that rejects nulls */ - /** - Used for pointing out the first table in the plan being covered by this - join nest. It is used exclusively within make_outerjoin_info(). - */ - struct st_join_table *first_nested; - /* - Used to count tables in the nested join in 2 isolated places: - 1. In make_outerjoin_info(). - 2. check_interleaving_with_nj/restore_prev_nj_state (these are called - by the join optimizer. - Before each use the counters are zeroed by reset_nj_counters. - */ - uint counter; - - /* - Number of elements in join_list that participate in the join plan choice: - - Base tables that were not removed by table elimination - - Join nests that were not removed by mark_join_nest_as_const - */ - uint n_tables; - nested_join_map nj_map; /* Bit used to identify this nested join*/ - /* - (Valid only for semi-join nests) Bitmap of tables outside the semi-join - that are used within the semi-join's ON condition. - */ - table_map sj_depends_on; - /* Outer non-trivially correlated tables */ - table_map sj_corr_tables; - List sj_outer_expr_list; - /** - True if this join nest node is completely covered by the query execution - plan. This means two things. - - 1. All tables on its @c join_list are covered by the plan. - - 2. All child join nest nodes are fully covered. - */ - bool is_fully_covered() const { return n_tables == counter; } -} NESTED_JOIN; - - -typedef struct st_changed_table_list -{ - struct st_changed_table_list *next; - char *key; - size_t key_length; -} CHANGED_TABLE_LIST; - - -typedef struct st_open_table_list{ - struct st_open_table_list *next; - char *db,*table; - uint32 in_use,locked; -} OPEN_TABLE_LIST; - - -static inline my_bitmap_map *tmp_use_all_columns(TABLE *table, - MY_BITMAP *bitmap) -{ - my_bitmap_map *old= bitmap->bitmap; - bitmap->bitmap= table->s->all_set.bitmap; - return old; -} - - -static inline void tmp_restore_column_map(MY_BITMAP *bitmap, - my_bitmap_map *old) -{ - bitmap->bitmap= old; -} - -/* The following is only needed for debugging */ - -static inline my_bitmap_map *dbug_tmp_use_all_columns(TABLE *table, - MY_BITMAP *bitmap) -{ -#ifdef DBUG_ASSERT_EXISTS - return tmp_use_all_columns(table, bitmap); -#else - return 0; -#endif -} - -static inline void dbug_tmp_restore_column_map(MY_BITMAP *bitmap, - my_bitmap_map *old) -{ -#ifdef DBUG_ASSERT_EXISTS - tmp_restore_column_map(bitmap, old); -#endif -} - - -/* - Variant of the above : handle both read and write sets. - Provide for the possiblity of the read set being the same as the write set -*/ -static inline void dbug_tmp_use_all_columns(TABLE *table, - my_bitmap_map **save, - MY_BITMAP *read_set, - MY_BITMAP *write_set) -{ -#ifdef DBUG_ASSERT_EXISTS - save[0]= read_set->bitmap; - save[1]= write_set->bitmap; - (void) tmp_use_all_columns(table, read_set); - (void) tmp_use_all_columns(table, write_set); -#endif -} - - -static inline void dbug_tmp_restore_column_maps(MY_BITMAP *read_set, - MY_BITMAP *write_set, - my_bitmap_map **old) -{ -#ifdef DBUG_ASSERT_EXISTS - tmp_restore_column_map(read_set, old[0]); - tmp_restore_column_map(write_set, old[1]); -#endif -} - -bool ok_for_lower_case_names(const char *names); - -enum get_table_share_flags { - GTS_TABLE = 1, - GTS_VIEW = 2, - GTS_NOLOCK = 4, - GTS_USE_DISCOVERY = 8, - GTS_FORCE_DISCOVERY = 16 -}; - -size_t max_row_length(TABLE *table, MY_BITMAP const *cols, const uchar *data); - -void init_mdl_requests(TABLE_LIST *table_list); - -enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, - const LEX_CSTRING *alias, uint db_stat, uint prgflag, - uint ha_open_flags, TABLE *outparam, - bool is_create_table, - List *partitions_to_open= NULL); -bool copy_keys_from_share(TABLE *outparam, MEM_ROOT *root); -bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol); -bool fix_session_vcol_expr_for_read(THD *thd, Field *field, - Virtual_column_info *vcol); -bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, - bool *error_reported, vcol_init_mode expr); -TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, - const char *key, uint key_length); -void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key, - uint key_length, - const char *table_name, const char *path); -void free_table_share(TABLE_SHARE *share); -enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, - uint flags = GTS_TABLE); - -void open_table_error(TABLE_SHARE *share, enum open_frm_error error, - int db_errno); -void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); -bool check_db_name(LEX_STRING *db); -bool check_column_name(const char *name); -bool check_table_name(const char *name, size_t length, bool check_for_path_chars); -int rename_file_ext(const char * from,const char * to,const char * ext); -char *get_field(MEM_ROOT *mem, Field *field); -bool get_field(MEM_ROOT *mem, Field *field, class String *res); - -bool validate_comment_length(THD *thd, LEX_CSTRING *comment, size_t max_len, - uint err_code, const char *name); - -int closefrm(TABLE *table); -void free_blobs(TABLE *table); -void free_field_buffers_larger_than(TABLE *table, uint32 size); -ulong get_form_pos(File file, uchar *head, TYPELIB *save_names); -void append_unescaped(String *res, const char *pos, size_t length); -void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo, - HA_CREATE_INFO *create_info, uint keys, KEY *key_info); -const char *fn_frm_ext(const char *name); - -/* Check that the integer is in the internal */ -static inline int set_zone(int nr,int min_zone,int max_zone) -{ - if (nr <= min_zone) - return min_zone; - if (nr >= max_zone) - return max_zone; - return nr; -} - -/* performance schema */ -extern LEX_CSTRING PERFORMANCE_SCHEMA_DB_NAME; - -extern LEX_CSTRING GENERAL_LOG_NAME; -extern LEX_CSTRING SLOW_LOG_NAME; -extern LEX_CSTRING TRANSACTION_REG_NAME; - -/* information schema */ -extern LEX_CSTRING INFORMATION_SCHEMA_NAME; -extern LEX_CSTRING MYSQL_SCHEMA_NAME; - -/* table names */ -extern LEX_CSTRING MYSQL_PROC_NAME; - -inline bool is_infoschema_db(const LEX_CSTRING *name) -{ - return lex_string_eq(&INFORMATION_SCHEMA_NAME, name); -} - -inline bool is_perfschema_db(const LEX_CSTRING *name) -{ - return lex_string_eq(&PERFORMANCE_SCHEMA_DB_NAME, name); -} - -inline void mark_as_null_row(TABLE *table) -{ - table->null_row=1; - table->status|=STATUS_NULL_ROW; - bfill(table->null_flags,table->s->null_bytes,255); -} - -bool is_simple_order(ORDER *order); - -class Open_tables_backup; - -/** Transaction Registry Table (TRT) - - This table holds transaction IDs, their corresponding times and other - transaction-related data which is used for transaction order resolution. - When versioned table marks its records lifetime with transaction IDs, - TRT is used to get their actual timestamps. */ - -class TR_table: public TABLE_LIST -{ - THD *thd; - Open_tables_backup *open_tables_backup; - -public: - enum field_id_t { - FLD_TRX_ID= 0, - FLD_COMMIT_ID, - FLD_BEGIN_TS, - FLD_COMMIT_TS, - FLD_ISO_LEVEL, - FIELD_COUNT - }; - - enum enabled {NO, MAYBE, YES}; - static enum enabled use_transaction_registry; - - /** - @param[in,out] Thread handle - @param[in] Current transaction is read-write. - */ - TR_table(THD *_thd, bool rw= false); - /** - Opens a transaction_registry table. - - @retval true on error, false otherwise. - */ - bool open(); - ~TR_table(); - /** - @retval current thd - */ - THD *get_thd() const { return thd; } - /** - Stores value to internal transaction_registry TABLE object. - - @param[in] field number in a TABLE - @param[in] value to store - */ - void store(uint field_id, ulonglong val); - /** - Stores value to internal transaction_registry TABLE object. - - @param[in] field number in a TABLE - @param[in] value to store - */ - void store(uint field_id, timeval ts); - /** - Update the transaction_registry right before commit. - @param start_id transaction identifier at start - @param end_id transaction identifier at commit - - @retval false on success - @retval true on error (the transaction must be rolled back) - */ - bool update(ulonglong start_id, ulonglong end_id); - // return true if found; false if not found or error - bool query(ulonglong trx_id); - /** - Gets a row from transaction_registry with the closest commit_timestamp to - first argument. We can search for a value which a lesser or greater than - first argument. Also loads a row into an internal TABLE object. - - @param[in] timestamp - @param[in] true if we search for a lesser timestamp, false if greater - @retval true if exists, false it not exists or an error occurred - */ - bool query(MYSQL_TIME &commit_time, bool backwards); - /** - Checks whether transaction1 sees transaction0. - - @param[out] true if transaction1 sees transaction0, undefined on error and - when transaction1=transaction0 and false otherwise - @param[in] transaction_id of transaction1 - @param[in] transaction_id of transaction0 - @param[in] commit time of transaction1 or 0 if we want it to be queried - @param[in] isolation level (from handler.h) of transaction1 - @param[in] commit time of transaction0 or 0 if we want it to be queried - @retval true on error, false otherwise - */ - bool query_sees(bool &result, ulonglong trx_id1, ulonglong trx_id0, - ulonglong commit_id1= 0, - enum_tx_isolation iso_level1= ISO_READ_UNCOMMITTED, - ulonglong commit_id0= 0); - - /** - @retval transaction isolation level of a row from internal TABLE object. - */ - enum_tx_isolation iso_level() const; - /** - Stores transactioin isolation level to internal TABLE object. - */ - void store_iso_level(enum_tx_isolation iso_level) - { - DBUG_ASSERT(iso_level <= ISO_SERIALIZABLE); - store(FLD_ISO_LEVEL, iso_level + 1); - } - - /** - Writes a message to MariaDB log about incorrect transaction_registry schema. - - @param[in] a message explained what's incorrect in schema - */ - void warn_schema_incorrect(const char *reason); - /** - Checks whether transaction_registry table has a correct schema. - - @retval true if schema is incorrect and false otherwise - */ - bool check(bool error); - - TABLE * operator-> () const - { - return table; - } - Field * operator[] (uint field_id) const - { - DBUG_ASSERT(field_id < FIELD_COUNT); - return table->field[field_id]; - } - operator bool () const - { - return table; - } - bool operator== (const TABLE_LIST &subj) const - { - return (!cmp(&db, &subj.db) && !cmp(&table_name, &subj.table_name)); - } - bool operator!= (const TABLE_LIST &subj) const - { - return !(*this == subj); - } -}; - -#endif /* MYSQL_CLIENT */ - -#endif /* TABLE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/table_cache.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/table_cache.h deleted file mode 100644 index 433df5e..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/table_cache.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef TABLE_CACHE_H_INCLUDED -#define TABLE_CACHE_H_INCLUDED -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2010, 2011 Monty Program Ab - Copyright (C) 2013 Sergey Vojtovich and MariaDB Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -struct Share_free_tables -{ - typedef I_P_List List; - List list; - /** Avoid false sharing between instances */ - char pad[CPU_LEVEL1_DCACHE_LINESIZE]; -}; - - -struct TDC_element -{ - uchar m_key[NAME_LEN + 1 + NAME_LEN + 1]; - uint m_key_length; - bool flushed; - TABLE_SHARE *share; - - /** - Protects ref_count, m_flush_tickets, all_tables, flushed, all_tables_refs. - */ - mysql_mutex_t LOCK_table_share; - mysql_cond_t COND_release; - TDC_element *next, **prev; /* Link to unused shares */ - uint ref_count; /* How many TABLE objects uses this */ - uint all_tables_refs; /* Number of refs to all_tables */ - /** - List of tickets representing threads waiting for the share to be flushed. - */ - Wait_for_flush_list m_flush_tickets; - /* - Doubly-linked (back-linked) lists of used and unused TABLE objects - for this share. - */ - All_share_tables_list all_tables; - /** Avoid false sharing between TDC_element and free_tables */ - char pad[CPU_LEVEL1_DCACHE_LINESIZE]; - Share_free_tables free_tables[1]; - - inline void wait_for_refs(uint my_refs); - void flush(THD *thd, bool mark_flushed); - void flush_unused(bool mark_flushed); -}; - - -extern ulong tdc_size; -extern ulong tc_size; -extern uint32 tc_instances; - -extern bool tdc_init(void); -extern void tdc_start_shutdown(void); -extern void tdc_deinit(void); -extern ulong tdc_records(void); -extern void tdc_purge(bool all); -extern TDC_element *tdc_lock_share(THD *thd, const char *db, - const char *table_name); -extern void tdc_unlock_share(TDC_element *element); -int tdc_share_is_cached(THD *thd, const char *db, const char *table_name); -extern TABLE_SHARE *tdc_acquire_share(THD *thd, TABLE_LIST *tl, uint flags, - TABLE **out_table= 0); -extern void tdc_release_share(TABLE_SHARE *share); -void tdc_remove_referenced_share(THD *thd, TABLE_SHARE *share); -void tdc_remove_table(THD *thd, const char *db, const char *table_name); - -extern int tdc_wait_for_old_version(THD *thd, const char *db, - const char *table_name, - ulong wait_timeout, uint deadlock_weight); -extern int tdc_iterate(THD *thd, my_hash_walk_action action, void *argument, - bool no_dups= false); - -extern uint tc_records(void); -int show_tc_active_instances(THD *thd, SHOW_VAR *var, char *buff, - enum enum_var_type scope); -extern void tc_purge(); -extern void tc_add_table(THD *thd, TABLE *table); -extern void tc_release_table(TABLE *table); -extern TABLE *tc_acquire_table(THD *thd, TDC_element *element); - -/** - Create a table cache key for non-temporary table. - - @param key Buffer for key (must be at least NAME_LEN*2+2 bytes). - @param db Database name. - @param table_name Table name. - - @return Length of key. -*/ - -inline uint tdc_create_key(char *key, const char *db, const char *table_name) -{ - /* - In theory caller should ensure that both db and table_name are - not longer than NAME_LEN bytes. In practice we play safe to avoid - buffer overruns. - */ - return (uint) (strmake(strmake(key, db, NAME_LEN) + 1, table_name, - NAME_LEN) - key + 1); -} -#endif /* TABLE_CACHE_H_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_alarm.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_alarm.h deleted file mode 100644 index 250590a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_alarm.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Prototypes when using thr_alarm library functions */ - -#ifndef _thr_alarm_h -#define _thr_alarm_h -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef USE_ALARM_THREAD -#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */ -#endif -#ifdef HAVE_rts_threads -#undef USE_ONE_SIGNAL_HAND -#define USE_ALARM_THREAD -#define THR_SERVER_ALARM SIGUSR1 -#else -#define THR_SERVER_ALARM SIGALRM -#endif - -typedef struct st_alarm_info -{ - time_t next_alarm_time; - uint active_alarms; - uint max_used_alarms; -} ALARM_INFO; - -void thr_alarm_info(ALARM_INFO *info); -extern my_bool my_disable_thr_alarm; - -#ifdef _WIN32 -#define DONT_USE_THR_ALARM -#endif -#if defined(DONT_USE_THR_ALARM) - -#define USE_ALARM_THREAD -#undef USE_ONE_SIGNAL_HAND - -typedef my_bool thr_alarm_t; -typedef my_bool ALARM; - -#define thr_alarm_init(A) (*(A))=0 -#define thr_alarm_in_use(A) (*(A) != 0) -#define thr_end_alarm(A) -#define thr_alarm(A,B,C) ((*(A)=1)-1) -/* The following should maybe be (*(A)) */ -#define thr_got_alarm(A) 0 -#define init_thr_alarm(A) -#define thr_alarm_kill(A) -#define resize_thr_alarm(N) -#define end_thr_alarm(A) - -#else -#if defined(__WIN__) -typedef struct st_thr_alarm_entry -{ - UINT_PTR crono; -} thr_alarm_entry; - -#else /* System with posix threads */ - -typedef int thr_alarm_entry; - -#define thr_got_alarm(thr_alarm) (**(thr_alarm)) - -#endif /* __WIN__ */ - -typedef thr_alarm_entry* thr_alarm_t; - -typedef struct st_alarm { - time_t expire_time; - thr_alarm_entry alarmed; /* set when alarm is due */ - pthread_t thread; - my_thread_id thread_id; - uint index_in_queue; - my_bool malloced; -} ALARM; - -extern uint thr_client_alarm; -extern pthread_t alarm_thread; - -#define thr_alarm_init(A) (*(A))=0 -#define thr_alarm_in_use(A) (*(A)!= 0) -void init_thr_alarm(uint max_alarm); -void resize_thr_alarm(uint max_alarms); -my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff); -void thr_alarm_kill(my_thread_id thread_id); -void thr_end_alarm(thr_alarm_t *alarmed); -void end_thr_alarm(my_bool free_structures); -sig_handler process_alarm(int); -#ifndef thr_got_alarm -my_bool thr_got_alarm(thr_alarm_t *alrm); -#endif - - -#endif /* DONT_USE_THR_ALARM */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* _thr_alarm_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_lock.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_lock.h deleted file mode 100644 index 1ea2413..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_lock.h +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* For use with thr_lock:s */ - -#ifndef _thr_lock_h -#define _thr_lock_h -#ifdef __cplusplus -extern "C" { -#endif -#include -#include - -struct st_thr_lock; -extern ulong locks_immediate,locks_waited ; - -/* - Important: if a new lock type is added, a matching lock description - must be added to sql_test.cc's lock_descriptions array. -*/ -enum thr_lock_type { TL_IGNORE=-1, - TL_UNLOCK, /* UNLOCK ANY LOCK */ - /* - Parser only! At open_tables() becomes TL_READ or - TL_READ_NO_INSERT depending on the binary log format - (SBR/RBR) and on the table category (log table). - Used for tables that are read by statements which - modify tables. - */ - TL_READ_DEFAULT, - TL_READ, /* Read lock */ - TL_READ_WITH_SHARED_LOCKS, - /* High prior. than TL_WRITE. Allow concurrent insert */ - TL_READ_HIGH_PRIORITY, - /* READ, Don't allow concurrent insert */ - TL_READ_NO_INSERT, - /* - Write lock, but allow other threads to read / write. - Used by BDB tables in MySQL to mark that someone is - reading/writing to the table. - */ - TL_WRITE_ALLOW_WRITE, - /* - WRITE lock used by concurrent insert. Will allow - READ, if one could use concurrent insert on table. - */ - TL_WRITE_CONCURRENT_INSERT, - /* Write used by INSERT DELAYED. Allows READ locks */ - TL_WRITE_DELAYED, - /* - parser only! Late bound low_priority flag. - At open_tables() becomes thd->update_lock_default. - */ - TL_WRITE_DEFAULT, - /* WRITE lock that has lower priority than TL_READ */ - TL_WRITE_LOW_PRIORITY, - /* Normal WRITE lock */ - TL_WRITE, - /* Abort new lock request with an error */ - TL_WRITE_ONLY}; - -enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1, - THR_LOCK_WAIT_TIMEOUT= 2, THR_LOCK_DEADLOCK= 3 }; - - -/* Priority for locks */ -#define THR_LOCK_LATE_PRIV 1U /* For locks to be merged with org lock */ -#define THR_LOCK_MERGE_PRIV 2U /* For merge tables */ - -#define THR_UNLOCK_UPDATE_STATUS 1U - -extern ulong max_write_lock_count; -extern my_bool thr_lock_inited; -extern enum thr_lock_type thr_upgraded_concurrent_insert_lock; - -/* - A description of the thread which owns the lock. The address - of an instance of this structure is used to uniquely identify the thread. -*/ - -typedef struct st_thr_lock_info -{ - pthread_t thread; - my_thread_id thread_id; - void *mysql_thd; // THD pointer -} THR_LOCK_INFO; - - -typedef struct st_thr_lock_data { - THR_LOCK_INFO *owner; - struct st_thr_lock_data *next,**prev; - struct st_thr_lock *lock; - mysql_cond_t *cond; - void *status_param; /* Param to status functions */ - void *debug_print_param; /* For error messages */ - struct PSI_table *m_psi; - enum thr_lock_type type; - enum thr_lock_type org_type; /* Cache for MariaDB */ - uint priority; -} THR_LOCK_DATA; - -struct st_lock_list { - THR_LOCK_DATA *data,**last; -}; - -typedef struct st_thr_lock { - LIST list; - mysql_mutex_t mutex; - struct st_lock_list read_wait; - struct st_lock_list read; - struct st_lock_list write_wait; - struct st_lock_list write; - /* write_lock_count is incremented for write locks and reset on read locks */ - ulong write_lock_count; - uint read_no_write_count; - my_bool (*get_status)(void*, my_bool);/* Called when one gets a lock */ - void (*copy_status)(void*,void*); - void (*update_status)(void*); /* Before release of write */ - void (*restore_status)(void*); /* Before release of read */ - my_bool (*start_trans)(void*); /* When all locks are taken */ - my_bool (*check_status)(void *); - void (*fix_status)(void *, void *);/* For thr_merge_locks() */ - const char *name; /* Used for error reporting */ - my_bool allow_multiple_concurrent_insert; -} THR_LOCK; - - -extern LIST *thr_lock_thread_list; -extern mysql_mutex_t THR_LOCK_lock; -struct st_my_thread_var; - -my_bool init_thr_lock(void); /* Must be called once/thread */ -void thr_lock_info_init(THR_LOCK_INFO *info, struct st_my_thread_var *tmp); -void thr_lock_init(THR_LOCK *lock); -void thr_lock_delete(THR_LOCK *lock); -void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data, - void *status_param); -void thr_unlock(THR_LOCK_DATA *data, uint unlock_flags); -enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data, - uint count, THR_LOCK_INFO *owner, - ulong lock_wait_timeout); -void thr_multi_unlock(THR_LOCK_DATA **data,uint count, uint unlock_flags); -void thr_merge_locks(THR_LOCK_DATA **data, uint org_count, uint new_count); -void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock); -my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread); -void thr_print_locks(void); /* For debugging */ -my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data, - enum thr_lock_type new_lock_type, - ulong lock_wait_timeout); -void thr_downgrade_write_lock(THR_LOCK_DATA *data, - enum thr_lock_type new_lock_type); -my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data, - ulong lock_wait_timeout); -void thr_set_lock_wait_callback(void (*before_wait)(void), - void (*after_wait)(void)); - -#ifdef WITH_WSREP - typedef my_bool (* wsrep_thd_is_brute_force_fun)(const MYSQL_THD, my_bool); - typedef my_bool(* wsrep_abort_thd_fun)(MYSQL_THD, MYSQL_THD, my_bool); - typedef my_bool (* wsrep_on_fun)(const MYSQL_THD); - void wsrep_thr_lock_init( - wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun, - my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* _thr_lock_h */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_malloc.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_malloc.h deleted file mode 100644 index cc56666..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_malloc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef THR_MALLOC_INCLUDED -#define THR_MALLOC_INCLUDED - -typedef struct st_mem_root MEM_ROOT; - -void init_sql_alloc(PSI_memory_key key, MEM_ROOT *root, uint block_size, uint - pre_alloc_size, myf my_flags); -char *sql_strmake_with_convert(THD *thd, const char *str, size_t arg_length, - CHARSET_INFO *from_cs, - size_t max_res_length, - CHARSET_INFO *to_cs, size_t *result_length); - -#endif /* THR_MALLOC_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_timer.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_timer.h deleted file mode 100644 index 6bca815..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thr_timer.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2014 Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 or later of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Prototypes when using thr_timer functions */ - -#ifndef THR_TIMER_INCLUDED -#define THR_TIMER_INCLUDED -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct st_timer { - struct timespec expire_time; - ulonglong period; - my_bool expired; - uint index_in_queue; - void (*func)(void*); - void *func_arg; -} thr_timer_t; - -/* Main functions for library */ -my_bool init_thr_timer(uint init_size_for_timer_queue); -void end_thr_timer(); - -/* Functions for handling one timer */ -void thr_timer_init(thr_timer_t *timer_data, void(*function)(void*), - void *arg); -void thr_timer_set_period(thr_timer_t* timer_data, ulonglong microseconds); -my_bool thr_timer_settime(thr_timer_t *timer_data, ulonglong microseconds); -void thr_timer_end(thr_timer_t *timer_data); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* THR_TIMER_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thread_cache.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/thread_cache.h deleted file mode 100644 index 5cb6c0f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thread_cache.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - Copyright (C) 2020 MariaDB Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - - -/** - MariaDB thread cache for "one thread per connection" scheduler. - - Thread cache allows to re-use threads (as well as THD objects) for - subsequent connections. -*/ -class Thread_cache -{ - mutable mysql_cond_t COND_thread_cache; - mutable mysql_cond_t COND_flush_thread_cache; - mutable mysql_mutex_t LOCK_thread_cache; - /** Queue of new connection requests. */ - I_List list; - /** Number of threads parked in the cache. */ - ulong cached_thread_count; - /** Number of active flush requests. */ - uint32_t kill_cached_threads; - /** - PFS stuff, only used during initialization. - Unfortunately needs to survive till destruction. - */ - PSI_cond_key key_COND_thread_cache, key_COND_flush_thread_cache; - PSI_mutex_key key_LOCK_thread_cache; - -public: - void init() - { -#ifdef HAVE_PSI_INTERFACE - PSI_cond_info conds[]= - { - { &key_COND_thread_cache, "COND_thread_cache", PSI_FLAG_GLOBAL }, - { &key_COND_flush_thread_cache, "COND_flush_thread_cache", - PSI_FLAG_GLOBAL } - }; - PSI_mutex_info mutexes[]= - { - { &key_LOCK_thread_cache, "LOCK_thread_cache", PSI_FLAG_GLOBAL } - }; - mysql_mutex_register("sql", mutexes, array_elements(mutexes)); - mysql_cond_register("sql", conds, array_elements(conds)); -#endif - mysql_mutex_init(key_LOCK_thread_cache, &LOCK_thread_cache, - MY_MUTEX_INIT_FAST); - mysql_cond_init(key_COND_thread_cache, &COND_thread_cache, 0); - mysql_cond_init(key_COND_flush_thread_cache, &COND_flush_thread_cache, 0); - list.empty(); - kill_cached_threads= 0; - cached_thread_count= 0; - } - - - void destroy() - { - DBUG_ASSERT(cached_thread_count == 0); - DBUG_ASSERT(list.is_empty()); - mysql_cond_destroy(&COND_flush_thread_cache); - mysql_cond_destroy(&COND_thread_cache); - mysql_mutex_destroy(&LOCK_thread_cache); - } - - - /** - Flushes thread cache. - - Awakes parked threads and requests them to shutdown. - Waits until last parked thread leaves the cache. - */ - void flush() - { - mysql_mutex_lock(&LOCK_thread_cache); - kill_cached_threads++; - while (cached_thread_count) - { - mysql_cond_broadcast(&COND_thread_cache); - mysql_cond_wait(&COND_flush_thread_cache, &LOCK_thread_cache); - } - kill_cached_threads--; - mysql_mutex_unlock(&LOCK_thread_cache); - } - - - /** - Flushes thread cache and forbids threads parking in the cache. - - This is a pre-shutdown hook. - */ - void final_flush() - { - kill_cached_threads++; - flush(); - } - - - /** - Requests parked thread to serve new connection. - - @return - @retval true connection is enqueued and parked thread is about to serve it - @retval false thread cache is empty - */ - bool enqueue(CONNECT *connect) - { - mysql_mutex_lock(&LOCK_thread_cache); - if (cached_thread_count) - { - list.push_back(connect); - cached_thread_count--; - mysql_mutex_unlock(&LOCK_thread_cache); - mysql_cond_signal(&COND_thread_cache); - return true; - } - mysql_mutex_unlock(&LOCK_thread_cache); - return false; - } - - - /** - Parks thread in the cache. - - Thread execution is suspended until either of the following occurs: - - thread is requested to serve new connection; - - thread cache is flushed; - - THREAD_CACHE_TIMEOUT elapsed. - - @return - @retval pointer to CONNECT if requested to serve new connection - @retval 0 if thread cache is flushed or on timeout - */ - CONNECT *park() - { - struct timespec abstime; - CONNECT *connect; - bool flushed= false; - DBUG_ENTER("Thread_cache::park"); - set_timespec(abstime, THREAD_CACHE_TIMEOUT); - - /* - Delete the instrumentation for the job that just completed, - before parking this pthread in the cache (blocked on COND_thread_cache). - */ - PSI_CALL_delete_current_thread(); - -#ifndef DBUG_OFF - while (_db_is_pushed_()) - _db_pop_(); -#endif - - mysql_mutex_lock(&LOCK_thread_cache); - if ((connect= list.get())) - cached_thread_count++; - else if (cached_thread_count < thread_cache_size && !kill_cached_threads) - { - /* Don't kill the thread, just put it in cache for reuse */ - DBUG_PRINT("info", ("Adding thread to cache")); - cached_thread_count++; - for (;;) - { - int error= mysql_cond_timedwait(&COND_thread_cache, &LOCK_thread_cache, - &abstime); - flushed= kill_cached_threads; - if ((connect= list.get())) - break; - else if (flushed || error == ETIMEDOUT || error == ETIME) - { - /* - If timeout, end thread. - If a new thread is requested, we will handle the call, even if we - got a timeout (as we are already awake and free) - */ - cached_thread_count--; - break; - } - } - } - mysql_mutex_unlock(&LOCK_thread_cache); - if (flushed) - mysql_cond_signal(&COND_flush_thread_cache); - DBUG_RETURN(connect); - } - - - /** Returns the number of parked threads. */ - ulong size() const - { - mysql_mutex_lock(&LOCK_thread_cache); - ulong r= cached_thread_count; - mysql_mutex_unlock(&LOCK_thread_cache); - return r; - } -}; - -extern Thread_cache thread_cache; diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thread_pool_priv.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/thread_pool_priv.h deleted file mode 100644 index 769c4a7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/thread_pool_priv.h +++ /dev/null @@ -1,109 +0,0 @@ -#error don't use -/* - Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -*/ - -#ifndef THREAD_POOL_PRIV_INCLUDED -#define THREAD_POOL_PRIV_INCLUDED - -/* - The thread pool requires access to some MySQL server error codes, this is - accessed from mysqld_error.h. - We need access to the struct that defines the thread pool plugin interface - which is accessed through scheduler.h. - All accesses to THD variables and functions are defined in this header file. - A thread pool can also use DEBUG_SYNC and must thus include - debug_sync.h - To handle definitions of Information Schema plugins it is also required - to include sql_profile.h and table.h. -*/ -#include /* To get ER_ERROR_ON_READ */ -#define MYSQL_SERVER 1 -#include -#include -#include -#include -#include - -/* Interface to THD variables and functions */ -void thd_set_killed(THD *thd); -void thd_clear_errors(THD *thd); -void thd_set_thread_stack(THD *thd, char *stack_start); -void thd_lock_thread_count(THD *thd); -void thd_close_connection(THD *thd); -THD *thd_get_current_thd(); -void thd_lock_data(THD *thd); -void thd_unlock_data(THD *thd); -bool thd_is_transaction_active(THD *thd); -int thd_connection_has_data(THD *thd); -void thd_set_net_read_write(THD *thd, uint val); -uint thd_get_net_read_write(THD *thd); -void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var); -my_socket thd_get_fd(THD *thd); -int thd_store_globals(THD* thd); - -/* Print to the MySQL error log */ -void sql_print_error(const char *format, ...); - -/* Store a table record */ -bool schema_table_store_record(THD *thd, TABLE *table); - -/* - The thread pool must be able to execute statements using the connection - state in THD object. This is the main objective of the thread pool to - schedule the start of these commands. -*/ -bool do_command(THD *thd); - -/* - The thread pool requires an interface to the connection logic in the - MySQL Server since the thread pool will maintain the event logic on - the TCP connection of the MySQL Server. Thus new connections, dropped - connections will be discovered by the thread pool and it needs to - ensure that the proper MySQL Server logic attached to these events is - executed. -*/ -/* Set up connection thread before use as execution thread */ -bool setup_connection_thread_globals(THD *thd); -/* Prepare connection as part of connection set-up */ -bool thd_prepare_connection(THD *thd); -/* Release auditing before executing statement */ -void mysql_audit_release(THD *thd); -/* Check if connection is still alive */ -bool thd_is_connection_alive(THD *thd); -/* Close connection with possible error code */ -void close_connection(THD *thd, uint errcode); -/* Destroy THD object */ -void delete_thd(THD *thd); - -/* - thread_created is maintained by thread pool when activated since - user threads are created by the thread pool (and also special - threads to maintain the thread pool). This is done through - inc_thread_created. - - max_connections is needed to calculate the maximum number of threads - that is allowed to be started by the thread pool. The method - get_max_connections() gets reference to this variable. - - connection_attrib is the thread attributes for connection threads, - the method get_connection_attrib provides a reference to these - attributes. -*/ -void inc_thread_created(void); -ulong get_max_connections(void); -pthread_attr_t *get_connection_attrib(void); -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/threadpool.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/threadpool.h deleted file mode 100644 index 27da872..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/threadpool.h +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 2012, 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#pragma once -#ifdef HAVE_POOL_OF_THREADS -#define MAX_THREAD_GROUPS 100000 - -/* Threadpool parameters */ -extern uint threadpool_min_threads; /* Minimum threads in pool */ -extern uint threadpool_idle_timeout; /* Shutdown idle worker threads after this timeout */ -extern uint threadpool_size; /* Number of parallel executing threads */ -extern uint threadpool_max_size; -extern uint threadpool_stall_limit; /* time interval in milliseconds for stall checks*/ -extern uint threadpool_max_threads; /* Maximum threads in pool */ -extern uint threadpool_oversubscribe; /* Maximum active threads in group */ -extern uint threadpool_prio_kickup_timer; /* Time before low prio item gets prio boost */ -extern my_bool threadpool_exact_stats; /* Better queueing time stats for information_schema, at small performance cost */ -extern my_bool threadpool_dedicated_listener; /* Listener thread does not pick up work items. */ -#ifdef _WIN32 -extern uint threadpool_mode; /* Thread pool implementation , windows or generic */ -#define TP_MODE_WINDOWS 0 -#define TP_MODE_GENERIC 1 -#endif - -#define DEFAULT_THREADPOOL_STALL_LIMIT 500U - -struct TP_connection; -extern void tp_callback(TP_connection *c); -extern void tp_timeout_handler(TP_connection *c); - - - -/* - Threadpool statistics -*/ -struct TP_STATISTICS -{ - /* Current number of worker thread. */ - Atomic_counter num_worker_threads; -}; - -extern TP_STATISTICS tp_stats; - - -/* Functions to set threadpool parameters */ -extern void tp_set_min_threads(uint val); -extern void tp_set_max_threads(uint val); -extern void tp_set_threadpool_size(uint val); -extern void tp_set_threadpool_stall_limit(uint val); -extern int tp_get_idle_thread_count(); -extern int tp_get_thread_count(); - - -enum TP_PRIORITY { - TP_PRIORITY_HIGH, - TP_PRIORITY_LOW, - TP_PRIORITY_AUTO -}; - - -enum TP_STATE -{ - TP_STATE_IDLE, - TP_STATE_RUNNING, - TP_STATE_PENDING -}; - -/* - Connection structure, encapsulates THD + structures for asynchronous - IO and pool. - - Platform specific parts are specified in subclasses called connection_t, - inside threadpool_win.cc and threadpool_unix.cc -*/ - -class CONNECT; - -struct TP_connection -{ - THD* thd; - CONNECT* connect; - TP_STATE state; - TP_PRIORITY priority; - TP_connection(CONNECT *c) : - thd(0), - connect(c), - state(TP_STATE_IDLE), - priority(TP_PRIORITY_HIGH) - {} - - virtual ~TP_connection() - {}; - - /* Initialize io structures windows threadpool, epoll etc */ - virtual int init() = 0; - - virtual void set_io_timeout(int sec) = 0; - - /* Read for the next client command (async) with specified timeout */ - virtual int start_io() = 0; - - virtual void wait_begin(int type)= 0; - virtual void wait_end() = 0; - -}; - - -struct TP_pool -{ - virtual ~TP_pool(){}; - virtual int init()= 0; - virtual TP_connection *new_connection(CONNECT *)= 0; - virtual void add(TP_connection *c)= 0; - virtual int set_max_threads(uint){ return 0; } - virtual int set_min_threads(uint){ return 0; } - virtual int set_pool_size(uint){ return 0; } - virtual int set_idle_timeout(uint){ return 0; } - virtual int set_oversubscribe(uint){ return 0; } - virtual int set_stall_limit(uint){ return 0; } - virtual int get_thread_count() { return tp_stats.num_worker_threads; } - virtual int get_idle_thread_count(){ return 0; } -}; - -#ifdef _WIN32 -struct TP_pool_win:TP_pool -{ - TP_pool_win(); - virtual int init(); - virtual ~TP_pool_win(); - virtual TP_connection *new_connection(CONNECT *c); - virtual void add(TP_connection *); - virtual int set_max_threads(uint); - virtual int set_min_threads(uint); -}; -#endif - -struct TP_pool_generic :TP_pool -{ - TP_pool_generic(); - ~TP_pool_generic(); - virtual int init(); - virtual TP_connection *new_connection(CONNECT *c); - virtual void add(TP_connection *); - virtual int set_pool_size(uint); - virtual int set_stall_limit(uint); - virtual int get_idle_thread_count(); -}; - -#endif /* HAVE_POOL_OF_THREADS */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/threadpool_generic.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/threadpool_generic.h deleted file mode 100644 index acf5ec6..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/threadpool_generic.h +++ /dev/null @@ -1,156 +0,0 @@ -/* Copyright(C) 2019, 2020, MariaDB - * - * This program is free software; you can redistribute itand /or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ - -#if defined (HAVE_POOL_OF_THREADS) -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -#include -/* AIX may define this, too ?*/ -#define HAVE_IOCP -#endif - - -#ifdef _WIN32 -typedef HANDLE TP_file_handle; -#else -typedef int TP_file_handle; -#define INVALID_HANDLE_VALUE -1 -#endif - -#ifdef __linux__ -#include -typedef struct epoll_event native_event; -#elif defined(HAVE_KQUEUE) -#include -typedef struct kevent native_event; -#elif defined (__sun) -#include -typedef port_event_t native_event; -#elif defined (HAVE_IOCP) -typedef OVERLAPPED_ENTRY native_event; -#else -#error threadpool is not available on this platform -#endif - -struct thread_group_t; - -/* Per-thread structure for workers */ -struct worker_thread_t -{ - ulonglong event_count; /* number of request handled by this thread */ - thread_group_t* thread_group; - worker_thread_t* next_in_list; - worker_thread_t** prev_in_list; - mysql_cond_t cond; - bool woken; -}; - -typedef I_P_List, - I_P_List_counter -> -worker_list_t; - -struct TP_connection_generic :public TP_connection -{ - TP_connection_generic(CONNECT* c); - ~TP_connection_generic(); - - virtual int init() { return 0; }; - virtual void set_io_timeout(int sec); - virtual int start_io(); - virtual void wait_begin(int type); - virtual void wait_end(); - - thread_group_t* thread_group; - TP_connection_generic* next_in_queue; - TP_connection_generic** prev_in_queue; - ulonglong abs_wait_timeout; - ulonglong enqueue_time; - TP_file_handle fd; - bool bound_to_poll_descriptor; - int waiting; - bool fix_group; -#ifdef HAVE_IOCP - OVERLAPPED overlapped; -#endif -#ifdef _WIN32 - enum_vio_type vio_type; -#endif -}; - - -typedef I_P_List, - I_P_List_counter, - I_P_List_fast_push_back > - connection_queue_t; - -const int NQUEUES = 2; /* We have high and low priority queues*/ - -enum class operation_origin -{ - WORKER, - LISTENER -}; - -struct thread_group_counters_t -{ - ulonglong thread_creations; - ulonglong thread_creations_due_to_stall; - ulonglong wakes; - ulonglong wakes_due_to_stall; - ulonglong throttles; - ulonglong stalls; - ulonglong dequeues[2]; - ulonglong polls[2]; -}; - -struct thread_group_t -{ - mysql_mutex_t mutex; - connection_queue_t queues[NQUEUES]; - worker_list_t waiting_threads; - worker_thread_t* listener; - pthread_attr_t* pthread_attr; - TP_file_handle pollfd; - int thread_count; - int active_thread_count; - int connection_count; - /* Stats for the deadlock detection timer routine.*/ - int io_event_count; - int queue_event_count; - ulonglong last_thread_creation_time; - int shutdown_pipe[2]; - bool shutdown; - bool stalled; - thread_group_counters_t counters; - char pad[CPU_LEVEL1_DCACHE_LINESIZE]; -}; - -#define TP_INCREMENT_GROUP_COUNTER(group,var) do {group->counters.var++;}while(0) - -extern thread_group_t* all_groups; -#endif - diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/transaction.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/transaction.h deleted file mode 100644 index fe0129f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/transaction.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef TRANSACTION_H -#define TRANSACTION_H - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include - -class THD; - -void trans_track_end_trx(THD *thd); - -bool trans_begin(THD *thd, uint flags= 0); -bool trans_commit(THD *thd); -bool trans_commit_implicit(THD *thd); -bool trans_rollback(THD *thd); -bool trans_rollback_implicit(THD *thd); - -bool trans_commit_stmt(THD *thd); -bool trans_rollback_stmt(THD *thd); - -bool trans_savepoint(THD *thd, LEX_CSTRING name); -bool trans_rollback_to_savepoint(THD *thd, LEX_CSTRING name); -bool trans_release_savepoint(THD *thd, LEX_CSTRING name); - -void trans_reset_one_shot_chistics(THD *thd); - -#endif /* TRANSACTION_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/tzfile.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/tzfile.h deleted file mode 100644 index aa03086..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/tzfile.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef TZFILE_INCLUDED -#define TZFILE_INCLUDED - -/* Copyright (c) 2004, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - This file is based on public domain code from ftp://elsie.ncih.nist.gov/ - Initial source code is in the public domain, so clarified as of - 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). -*/ - -/* - Information about time zone files. -*/ - -#ifndef TZDIR -#define TZDIR "/usr/share/zoneinfo" /* Time zone object file directory */ -#endif /* !defined TZDIR */ - -/* - Each file begins with. . . -*/ - -#define TZ_MAGIC "TZif" - -struct tzhead { - uchar tzh_magic[4]; /* TZ_MAGIC */ - uchar tzh_reserved[16]; /* reserved for future use */ - uchar tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ - uchar tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ - uchar tzh_leapcnt[4]; /* coded number of leap seconds */ - uchar tzh_timecnt[4]; /* coded number of transition times */ - uchar tzh_typecnt[4]; /* coded number of local time types */ - uchar tzh_charcnt[4]; /* coded number of abbr. chars */ -}; - -/* - . . .followed by. . . - - tzh_timecnt (char [4])s coded transition times a la time(2) - tzh_timecnt (unsigned char)s types of local time starting at above - tzh_typecnt repetitions of - one (char [4]) coded UTC offset in seconds - one (unsigned char) used to set tm_isdst - one (unsigned char) that's an abbreviation list index - tzh_charcnt (char)s '\0'-terminated zone abbreviations - tzh_leapcnt repetitions of - one (char [4]) coded leap second transition times - one (char [4]) total correction after above - tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition - time is standard time, if FALSE, - transition time is wall clock time - if absent, transition times are - assumed to be wall clock time - tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition - time is UTC, if FALSE, - transition time is local time - if absent, transition times are - assumed to be local time -*/ - -/* - In the current implementation, we refuse to deal with files that - exceed any of the limits below. -*/ - -#ifndef TZ_MAX_TIMES -/* - The TZ_MAX_TIMES value below is enough to handle a bit more than a - year's worth of solar time (corrected daily to the nearest second) or - 138 years of Pacific Presidential Election time - (where there are three time zone transitions every fourth year). -*/ -#define TZ_MAX_TIMES 370 -#endif /* !defined TZ_MAX_TIMES */ - -#ifndef TZ_MAX_TYPES -#ifdef SOLAR -#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ -#else -/* - Must be at least 14 for Europe/Riga as of Jan 12 1995, - as noted by Earl Chew . -*/ -#define TZ_MAX_TYPES 20 /* Maximum number of local time types */ -#endif /* defined SOLAR */ -#endif /* !defined TZ_MAX_TYPES */ - -#ifndef TZ_MAX_CHARS -#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ - /* (limited by what unsigned chars can hold) */ -#endif /* !defined TZ_MAX_CHARS */ - -#ifndef TZ_MAX_LEAPS -#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ -#endif /* !defined TZ_MAX_LEAPS */ - -#ifndef TZ_MAX_REV_RANGES -#ifdef SOLAR -/* Solar (Asia/RiyadhXX) zones need significantly bigger TZ_MAX_REV_RANGES */ -#define TZ_MAX_REV_RANGES (TZ_MAX_TIMES*2+TZ_MAX_LEAPS*2+2) -#else -#define TZ_MAX_REV_RANGES (TZ_MAX_TIMES+TZ_MAX_LEAPS+2) -#endif -#endif - -#define SECS_PER_MIN 60 -#define MINS_PER_HOUR 60 -#define HOURS_PER_DAY 24 -#define DAYS_PER_WEEK 7 -#define DAYS_PER_NYEAR 365 -#define DAYS_PER_LYEAR 366 -#define SECS_PER_HOUR (SECS_PER_MIN * MINS_PER_HOUR) -#define SECS_PER_DAY ((long) SECS_PER_HOUR * HOURS_PER_DAY) -#define MONS_PER_YEAR 12 - -#define TM_YEAR_BASE 1900 - -#define EPOCH_YEAR 1970 - -/* - Accurate only for the past couple of centuries, - that will probably do. -*/ - -#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/tztime.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/tztime.h deleted file mode 100644 index 9e5d469..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/tztime.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef TZTIME_INCLUDED -#define TZTIME_INCLUDED - -/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class interface */ -#endif - -#include "my_time.h" /* my_time_t */ -#include "mysql_time.h" /* MYSQL_TIME */ -#include "sql_list.h" /* Sql_alloc */ -#include "sql_string.h" /* String */ - -class THD; - -#if !defined(TESTTIME) && !defined(TZINFO2SQL) - -class THD; - -/** - This class represents abstract time zone and provides - basic interface for MYSQL_TIME <-> my_time_t conversion. - Actual time zones which are specified by DB, or via offset - or use system functions are its descendants. -*/ -class Time_zone: public Sql_alloc -{ -public: - Time_zone() {} /* Remove gcc warning */ - /** - Converts local time in broken down MYSQL_TIME representation to - my_time_t (UTC seconds since Epoch) represenation. - Returns 0 in case of error. May set error_code to ER_WARN_DATA_OUT_OF_RANGE - or ER_WARN_INVALID_TIMESTAMP, see TIME_to_timestamp()) - */ - virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, - uint *error_code) const = 0; - /** - Converts time in my_time_t representation to local time in - broken down MYSQL_TIME representation. - */ - virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const = 0; - /** - Because of constness of String returned by get_name() time zone name - have to be already zeroended to be able to use String::ptr() instead - of c_ptr(). - */ - virtual const String * get_name() const = 0; - - /** - We need this only for surpressing warnings, objects of this type are - allocated on MEM_ROOT and should not require destruction. - */ - virtual ~Time_zone() {}; - -protected: - static inline void adjust_leap_second(MYSQL_TIME *t); -}; - -extern Time_zone * my_tz_UTC; -extern MYSQL_PLUGIN_IMPORT Time_zone * my_tz_SYSTEM; -extern Time_zone * my_tz_OFFSET0; -extern Time_zone * my_tz_find(THD *thd, const String *name); -extern my_bool my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap); -extern void my_tz_free(); -extern my_time_t sec_since_epoch_TIME(MYSQL_TIME *t); - -/** - Number of elements in table list produced by my_tz_get_table_list() - (this table list contains tables which are needed for dynamical loading - of time zone descriptions). Actually it is imlementation detail that - should not be used anywhere outside of tztime.h and tztime.cc. -*/ - -static const int MY_TZ_TABLES_COUNT= 4; - -#endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */ -#endif /* TZTIME_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/uniques.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/uniques.h deleted file mode 100644 index 7e12a39..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/uniques.h +++ /dev/null @@ -1,110 +0,0 @@ -/* Copyright (c) 2016 MariaDB corporation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef UNIQUE_INCLUDED -#define UNIQUE_INCLUDED - -#include "filesort.h" - -/* - Unique -- class for unique (removing of duplicates). - Puts all values to the TREE. If the tree becomes too big, - it's dumped to the file. User can request sorted values, or - just iterate through them. In the last case tree merging is performed in - memory simultaneously with iteration, so it should be ~2-3x faster. - */ - -class Unique :public Sql_alloc -{ - DYNAMIC_ARRAY file_ptrs; - ulong max_elements; /* Total number of elements that will be stored in-memory */ - size_t max_in_memory_size; - IO_CACHE file; - TREE tree; - /* Number of elements filtered out due to min_dupl_count when storing results - to table. See Unique::get */ - ulong filtered_out_elems; - uint size; - - uint full_size; /* Size of element + space needed to store the number of - duplicates found for the element. */ - uint min_dupl_count; /* Minimum number of occurences of element required for - it to be written to record_pointers. - always 0 for unions, > 0 for intersections */ - bool with_counters; - - bool merge(TABLE *table, uchar *buff, size_t size, bool without_last_merge); - bool flush(); - -public: - ulong elements; - SORT_INFO sort; - Unique(qsort_cmp2 comp_func, void *comp_func_fixed_arg, - uint size_arg, size_t max_in_memory_size_arg, - uint min_dupl_count_arg= 0); - ~Unique(); - ulong elements_in_tree() { return tree.elements_in_tree; } - inline bool unique_add(void *ptr) - { - DBUG_ENTER("unique_add"); - DBUG_PRINT("info", ("tree %u - %lu", tree.elements_in_tree, max_elements)); - if (!(tree.flag & TREE_ONLY_DUPS) && - tree.elements_in_tree >= max_elements && flush()) - DBUG_RETURN(1); - DBUG_RETURN(!tree_insert(&tree, ptr, 0, tree.custom_arg)); - } - - bool is_in_memory() { return (my_b_tell(&file) == 0); } - void close_for_expansion() { tree.flag= TREE_ONLY_DUPS; } - - bool get(TABLE *table); - - /* Cost of searching for an element in the tree */ - inline static double get_search_cost(ulonglong tree_elems, - double compare_factor) - { - return log((double) tree_elems) / (compare_factor * M_LN2); - } - - static double get_use_cost(uint *buffer, size_t nkeys, uint key_size, - size_t max_in_memory_size, double compare_factor, - bool intersect_fl, bool *in_memory); - inline static int get_cost_calc_buff_size(size_t nkeys, uint key_size, - size_t max_in_memory_size) - { - size_t max_elems_in_tree= - max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size); - - if (max_elems_in_tree == 0) - max_elems_in_tree= 1; - return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree)); - } - - void reset(); - bool walk(TABLE *table, tree_walk_action action, void *walk_action_arg); - - uint get_size() const { return size; } - size_t get_max_in_memory_size() const { return max_in_memory_size; } - - friend int unique_write_to_file(uchar* key, element_count count, Unique *unique); - friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique); - - friend int unique_write_to_file_with_count(uchar* key, element_count count, - Unique *unique); - friend int unique_intersect_write_to_ptrs(uchar* key, element_count count, - Unique *unique); -}; - -#endif /* UNIQUE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/unireg.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/unireg.h deleted file mode 100644 index 873d6f6..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/unireg.h +++ /dev/null @@ -1,205 +0,0 @@ -#ifndef UNIREG_INCLUDED -#define UNIREG_INCLUDED - -/* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#include /* FRM_VER */ - -/* Extra functions used by unireg library */ - -#ifndef NO_ALARM_LOOP -#define NO_ALARM_LOOP /* lib5 and popen can't use alarm */ -#endif - -/* These paths are converted to other systems (WIN95) before use */ - -#define LANGUAGE "english/" -#define ERRMSG_FILE "errmsg.sys" -#define TEMP_PREFIX "MY" -#define LOG_PREFIX "ML" -#define PROGDIR "bin/" -#ifndef MYSQL_DATADIR -#define MYSQL_DATADIR "data/" -#endif -#ifndef SHAREDIR -#define SHAREDIR "share/" -#endif -#ifndef PLUGINDIR -#define PLUGINDIR "lib/plugin" -#endif - -#define MAX_ERROR_RANGES 4 /* 1000-2000, 2000-3000, 3000-4000, 4000-5000 */ -#define ERRORS_PER_RANGE 1000 - -#define DEFAULT_ERRMSGS my_default_lc_messages->errmsgs->errmsgs -#define CURRENT_THD_ERRMSGS (current_thd)->variables.errmsgs - -#ifndef mysqld_error_find_printf_error_used -#define ER_DEFAULT(X) DEFAULT_ERRMSGS[((X)-ER_ERROR_FIRST) / ERRORS_PER_RANGE][(X)% ERRORS_PER_RANGE] -#define ER_THD(thd,X) ((thd)->variables.errmsgs[((X)-ER_ERROR_FIRST) / ERRORS_PER_RANGE][(X) % ERRORS_PER_RANGE]) -#define ER(X) ER_THD(current_thd, (X)) -#endif -#define ER_THD_OR_DEFAULT(thd,X) ((thd) ? ER_THD(thd, (X)) : ER_DEFAULT(X)) - -#define SPECIAL_USE_LOCKS 1 /* Lock used databases */ -#define SPECIAL_NO_NEW_FUNC 2 /* Skip new functions */ -#define SPECIAL_SKIP_SHOW_DB 4 /* Don't allow 'show db' */ -#define SPECIAL_WAIT_IF_LOCKED 8 /* Wait if locked database */ -#define SPECIAL_SAME_DB_NAME 16 /* form name = file name */ -#define SPECIAL_ENGLISH 32 /* English error messages */ -#define SPECIAL_NO_RESOLVE 64 /* Don't use gethostname */ -#define SPECIAL_NO_PRIOR 128 /* Obsolete */ -#define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */ -#define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */ -#define SPECIAL_SHORT_LOG_FORMAT 1024 -#define SPECIAL_SAFE_MODE 2048 -#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */ - - /* Extern defines */ -#define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength) -#define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength) -#define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength) -#define empty_record(A) { \ - restore_record((A),s->default_values); \ - bfill((A)->null_flags,(A)->s->null_bytes,255);\ - } - - /* Defines for use with openfrm, openprt and openfrd */ - -#define READ_ALL (1 << 0) /* openfrm: Read all parameters */ -#define EXTRA_RECORD (1 << 3) /* Reserve space for an extra record */ -#define DELAYED_OPEN (1 << 12) /* Open table later */ -#define OPEN_VIEW_NO_PARSE (1 << 14) /* Open frm only if it's a view, - but do not parse view itself */ -/** - This flag is used in function get_all_tables() which fills - I_S tables with data which are retrieved from frm files and storage engine - The flag means that we need to open FRM file only to get necessary data. -*/ -#define OPEN_FRM_FILE_ONLY (1 << 15) -/** - This flag is used in function get_all_tables() which fills - I_S tables with data which are retrieved from frm files and storage engine - The flag means that we need to process tables only to get necessary data. - Views are not processed. -*/ -#define OPEN_TABLE_ONLY (1 << 16) -/** - This flag is used in function get_all_tables() which fills - I_S tables with data which are retrieved from frm files and storage engine - The flag means that we need to process views only to get necessary data. - Tables are not processed. -*/ -#define OPEN_VIEW_ONLY (1 << 17) -/** - This flag is used in function get_all_tables() which fills - I_S tables with data which are retrieved from frm files and storage engine. - The flag means that we need to open a view using - open_normal_and_derived_tables() function. -*/ -#define OPEN_VIEW_FULL (1 << 18) -/** - This flag is used in function get_all_tables() which fills - I_S tables with data which are retrieved from frm files and storage engine. - The flag means that I_S table uses optimization algorithm. -*/ -#define OPTIMIZE_I_S_TABLE (1 << 19) -/** - This flag is used to instruct tdc_open_view() to check metadata version. -*/ -#define CHECK_METADATA_VERSION (1 << 20) - -/* - The flag means that we need to process trigger files only. -*/ -#define OPEN_TRIGGER_ONLY (1 << 21) - -/* - Minimum length pattern before Turbo Boyer-Moore is used - for SELECT "text" LIKE "%pattern%", excluding the two - wildcards in class Item_func_like. -*/ -#define MIN_TURBOBM_PATTERN_LEN 3 - -/* - Defines for binary logging. - Do not decrease the value of BIN_LOG_HEADER_SIZE. - Do not even increase it before checking code. -*/ - -#define BIN_LOG_HEADER_SIZE 4 - -#define DEFAULT_KEY_CACHE_NAME "default" - - -/* Include prototypes for unireg */ - -#include "mysqld_error.h" -#include "structs.h" /* All structs we need */ -#include "sql_list.h" /* List<> */ -#include "field.h" /* Create_field */ - -/* - Types of values in the MariaDB extra2 frm segment. - Each value is written as - type: 1 byte - length: 1 byte (1..255) or \0 and 2 bytes. - binary value of the 'length' bytes. - - Older MariaDB servers can ignore values of unknown types if - the type code is less than 128 (EXTRA2_ENGINE_IMPORTANT). - Otherwise older (but newer than 10.0.1) servers are required - to report an error. -*/ -enum extra2_frm_value_type { - EXTRA2_TABLEDEF_VERSION=0, - EXTRA2_DEFAULT_PART_ENGINE=1, - EXTRA2_GIS=2, - EXTRA2_APPLICATION_TIME_PERIOD=3, - EXTRA2_PERIOD_FOR_SYSTEM_TIME=4, - -#define EXTRA2_ENGINE_IMPORTANT 128 - - EXTRA2_ENGINE_TABLEOPTS=128, - EXTRA2_FIELD_FLAGS=129, - EXTRA2_FIELD_DATA_TYPE_INFO=130, - EXTRA2_PERIOD_WITHOUT_OVERLAPS=131, -}; - -enum extra2_field_flags { - VERS_OPTIMIZED_UPDATE= 1 << INVISIBLE_MAX_BITS, -}; - -LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table, - HA_CREATE_INFO *create_info, - List &create_fields, - uint keys, KEY *key_info, handler *db_file); - -#define FRM_HEADER_SIZE 64 -#define FRM_FORMINFO_SIZE 288 -#define FRM_MAX_SIZE (1024*1024) - -static inline bool is_binary_frm_header(uchar *head) -{ - return head[0] == 254 - && head[1] == 1 - && head[2] >= FRM_VER - && head[2] <= FRM_VER_CURRENT; -} - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/vers_string.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/vers_string.h deleted file mode 100644 index 4e173f8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/vers_string.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (c) 2018, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef VERS_STRING_INCLUDED -#define VERS_STRING_INCLUDED - -#include "lex_string.h" - -/* - LEX_CSTRING with comparison semantics. -*/ - -// db and table names: case sensitive (or insensitive) in table_alias_charset -struct Compare_table_names -{ - int operator()(const LEX_CSTRING& a, const LEX_CSTRING& b) const - { - DBUG_ASSERT(a.str[a.length] == 0); - DBUG_ASSERT(b.str[b.length] == 0); - return table_alias_charset->strnncoll(a.str, a.length, - b.str, b.length); - } -}; - -// column names and other identifiers: case insensitive in system_charset_info -struct Compare_identifiers -{ - int operator()(const LEX_CSTRING& a, const LEX_CSTRING& b) const - { - DBUG_ASSERT(a.str[a.length] == 0); - DBUG_ASSERT(b.str[b.length] == 0); - return my_strcasecmp(system_charset_info, a.str, b.str); - } -}; - - -template -struct Lex_cstring_with_compare : public Lex_cstring -{ -public: - Lex_cstring_with_compare() {} - Lex_cstring_with_compare(const char *_str, size_t _len) : - Lex_cstring(_str, _len) - { } - Lex_cstring_with_compare(const LEX_STRING src) : - Lex_cstring(src.str, src.length) - { } - Lex_cstring_with_compare(const LEX_CSTRING src) : Lex_cstring(src.str, src.length) - { } - Lex_cstring_with_compare(const char *_str) : Lex_cstring(_str, strlen(_str)) - { } - bool streq(const Lex_cstring_with_compare& b) const - { - return Lex_cstring::length == b.length && 0 == Compare()(*this, b); - } - operator const char* () const - { - return str; - } - operator bool () const - { - return str != NULL; - } -}; - -typedef Lex_cstring_with_compare Lex_ident; -typedef Lex_cstring_with_compare Lex_table_name; - -#endif // VERS_STRING_INCLUDED diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/violite.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/violite.h deleted file mode 100644 index 28e3ca0..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/violite.h +++ /dev/null @@ -1,284 +0,0 @@ -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2012, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - * Vio Lite. - * Purpose: include file for Vio that will work with C and C++ - */ - -#ifndef vio_violite_h_ -#define vio_violite_h_ - -#include "my_net.h" /* needed because of struct in_addr */ -#include - -/* Simple vio interface in C; The functions are implemented in violite.c */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifdef __cplusplus -typedef struct st_vio Vio; -#endif /* __cplusplus */ - -enum enum_vio_type -{ - VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE, - VIO_TYPE_SSL - /* see also vio_type_names[] */ -}; -#define FIRST_VIO_TYPE VIO_CLOSED -#define LAST_VIO_TYPE VIO_TYPE_SSL - -/** - VIO I/O events. -*/ -enum enum_vio_io_event -{ - VIO_IO_EVENT_READ, - VIO_IO_EVENT_WRITE, - VIO_IO_EVENT_CONNECT -}; - -struct vio_keepalive_opts -{ - int interval; - int idle; - int probes; -}; - - -#define VIO_TLSv1_0 1 -#define VIO_TLSv1_1 2 -#define VIO_TLSv1_2 4 -#define VIO_TLSv1_3 8 - -#define VIO_LOCALHOST 1U /* a localhost connection */ -#define VIO_BUFFERED_READ 2U /* use buffered read */ -#define VIO_READ_BUFFER_SIZE 16384U /* size of read buffer */ -#define VIO_DESCRIPTION_SIZE 30 /* size of description */ - -Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags); -Vio* mysql_socket_vio_new(MYSQL_SOCKET mysql_socket, enum enum_vio_type type, uint flags); -#ifdef __WIN__ -Vio* vio_new_win32pipe(HANDLE hPipe); -#else -#define HANDLE void * -#endif /* __WIN__ */ - -void vio_delete(Vio* vio); -int vio_close(Vio* vio); -my_bool vio_reset(Vio* vio, enum enum_vio_type type, - my_socket sd, void *ssl, uint flags); -size_t vio_read(Vio *vio, uchar * buf, size_t size); -size_t vio_read_buff(Vio *vio, uchar * buf, size_t size); -size_t vio_write(Vio *vio, const uchar * buf, size_t size); -int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode); -my_bool vio_is_blocking(Vio *vio); -/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */ -int vio_nodelay(Vio *vio, my_bool on); -int vio_fastsend(Vio *vio); -/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */ -int vio_keepalive(Vio *vio, my_bool onoff); -int vio_set_keepalive_options(Vio * vio, const struct vio_keepalive_opts *opts); -/* Whenever we should retry the last read/write operation. */ -my_bool vio_should_retry(Vio *vio); -/* Check that operation was timed out */ -my_bool vio_was_timeout(Vio *vio); -/* Short text description of the socket for those, who are curious.. */ -const char* vio_description(Vio *vio); -/* Return the type of the connection */ -enum enum_vio_type vio_type(Vio* vio); -/* Return last error number */ -int vio_errno(Vio*vio); -/* Get socket number */ -my_socket vio_fd(Vio*vio); -/* Remote peer's address and name in text form */ -my_bool vio_peer_addr(Vio *vio, char *buf, uint16 *port, size_t buflen); -/* Wait for an I/O event notification. */ -int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout); -my_bool vio_is_connected(Vio *vio); -ssize_t vio_pending(Vio *vio); -/* Set timeout for a network operation. */ -extern int vio_timeout(Vio *vio, uint which, int timeout_sec); -extern void vio_set_wait_callback(void (*before_wait)(void), - void (*after_wait)(void)); -/* Connect to a peer. */ -my_bool vio_socket_connect(Vio *vio, struct sockaddr *addr, socklen_t len, - int timeout); - -void vio_get_normalized_ip(const struct sockaddr *src, size_t src_length, struct sockaddr *dst); - -my_bool vio_get_normalized_ip_string(const struct sockaddr *addr, size_t addr_length, - char *ip_string, size_t ip_string_size); - -my_bool vio_is_no_name_error(int err_code); - -int vio_getnameinfo(const struct sockaddr *sa, - char *hostname, size_t hostname_size, - char *port, size_t port_size, - int flags); - -#ifdef HAVE_OPENSSL -/* apple deprecated openssl in MacOSX Lion */ -#ifdef __APPLE__ -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - -#define HEADER_DES_LOCL_H dummy_something -#define YASSL_MYSQL_COMPATIBLE -#ifndef YASSL_PREFIX -#define YASSL_PREFIX -#endif -/* Set yaSSL to use same type as MySQL do for socket handles */ -typedef my_socket YASSL_SOCKET_T; -#define YASSL_SOCKET_T_DEFINED -#define template _template /* bug in WolfSSL 4.4.0, see also my_crypt.cc */ -#include -#undef template -#include -#ifdef DEPRECATED -#undef DEPRECATED -#endif - -enum enum_ssl_init_error -{ - SSL_INITERR_NOERROR= 0, SSL_INITERR_CERT, SSL_INITERR_KEY, - SSL_INITERR_NOMATCH, SSL_INITERR_BAD_PATHS, SSL_INITERR_CIPHERS, - SSL_INITERR_MEMFAIL, SSL_INITERR_DH, SSL_INITERR_PROTOCOL, - SSL_INITERR_LASTERR -}; -const char* sslGetErrString(enum enum_ssl_init_error err); - -struct st_VioSSLFd -{ - SSL_CTX *ssl_context; -}; - -int sslaccept(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr); -int sslconnect(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr); - -void vio_check_ssl_init(); - -struct st_VioSSLFd -*new_VioSSLConnectorFd(const char *key_file, const char *cert_file, - const char *ca_file, const char *ca_path, - const char *cipher, enum enum_ssl_init_error *error, - const char *crl_file, const char *crl_path); -struct st_VioSSLFd -*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, - const char *ca_file,const char *ca_path, - const char *cipher, enum enum_ssl_init_error *error, - const char *crl_file, const char *crl_path, - ulonglong tls_version); -void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd); -#endif /* HAVE_OPENSSL */ - -void vio_end(void); - -const char *vio_type_name(enum enum_vio_type vio_type, size_t *len); - -#ifdef __cplusplus -} -#endif - -#if !defined(DONT_MAP_VIO) -#define vio_delete(vio) (vio)->viodelete(vio) -#define vio_errno(vio) (vio)->vioerrno(vio) -#define vio_read(vio, buf, size) ((vio)->read)(vio,buf,size) -#define vio_write(vio, buf, size) ((vio)->write)(vio, buf, size) -#define vio_blocking(vio, set_blocking_mode, old_mode)\ - (vio)->vioblocking(vio, set_blocking_mode, old_mode) -#define vio_is_blocking(vio) (vio)->is_blocking(vio) -#define vio_fastsend(vio) (vio)->fastsend(vio) -#define vio_keepalive(vio, set_keep_alive) (vio)->viokeepalive(vio, set_keep_alive) -#define vio_should_retry(vio) (vio)->should_retry(vio) -#define vio_was_timeout(vio) (vio)->was_timeout(vio) -#define vio_close(vio) ((vio)->vioclose)(vio) -#define vio_shutdown(vio,how) ((vio)->shutdown)(vio,how) -#define vio_peer_addr(vio, buf, prt, buflen) (vio)->peer_addr(vio, buf, prt, buflen) -#define vio_io_wait(vio, event, timeout) (vio)->io_wait(vio, event, timeout) -#define vio_is_connected(vio) (vio)->is_connected(vio) -#endif /* !defined(DONT_MAP_VIO) */ - -#ifdef _WIN32 - -/* shutdown(2) flags */ -#ifndef SHUT_RD -#define SHUT_RD SD_RECEIVE -#endif - -#endif - -/* This enumerator is used in parser - should be always visible */ -enum SSL_type -{ - SSL_TYPE_NOT_SPECIFIED= -1, - SSL_TYPE_NONE, - SSL_TYPE_ANY, - SSL_TYPE_X509, - SSL_TYPE_SPECIFIED -}; - -/* HFTODO - hide this if we don't want client in embedded server */ -/* This structure is for every connection on both sides */ -struct st_vio -{ - MYSQL_SOCKET mysql_socket; /* Instrumented socket */ - my_bool localhost; /* Are we from localhost? */ - int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */ - struct sockaddr_storage local; /* Local internet address */ - struct sockaddr_storage remote; /* Remote internet address */ - enum enum_vio_type type; /* Type of connection */ - const char *desc; /* String description */ - char *read_buffer; /* buffer for vio_read_buff */ - char *read_pos; /* start of unfetched data in the - read buffer */ - char *read_end; /* end of unfetched data */ - struct mysql_async_context *async_context; /* For non-blocking API */ - int read_timeout; /* Timeout value (ms) for read ops. */ - int write_timeout; /* Timeout value (ms) for write ops. */ - /* function pointers. They are similar for socket/SSL/whatever */ - void (*viodelete)(Vio*); - int (*vioerrno)(Vio*); - size_t (*read)(Vio*, uchar *, size_t); - size_t (*write)(Vio*, const uchar *, size_t); - int (*timeout)(Vio*, uint, my_bool); - int (*vioblocking)(Vio*, my_bool, my_bool *); - my_bool (*is_blocking)(Vio*); - int (*viokeepalive)(Vio*, my_bool); - int (*fastsend)(Vio*); - my_bool (*peer_addr)(Vio*, char *, uint16*, size_t); - void (*in_addr)(Vio*, struct sockaddr_storage*); - my_bool (*should_retry)(Vio*); - my_bool (*was_timeout)(Vio*); - int (*vioclose)(Vio*); - my_bool (*is_connected)(Vio*); - int (*shutdown)(Vio *, int); - my_bool (*has_data) (Vio*); - int (*io_wait)(Vio*, enum enum_vio_io_event, int); - my_bool (*connect)(Vio*, struct sockaddr *, socklen_t, int); -#ifdef HAVE_OPENSSL - void *ssl_arg; -#endif -#ifdef _WIN32 - HANDLE hPipe; - OVERLAPPED overlapped; - int shutdown_flag; -#endif -}; -#endif /* vio_violite_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/waiting_threads.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/waiting_threads.h deleted file mode 100644 index f785cc8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/waiting_threads.h +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright (C) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _waiting_threads_h -#define _waiting_threads_h - -#include - -#include - -C_MODE_START - -typedef struct st_wt_resource_id WT_RESOURCE_ID; -typedef struct st_wt_resource WT_RESOURCE; - -typedef struct st_wt_resource_type { - my_bool (*compare)(const void *a, const void *b); - const void *(*make_key)(const WT_RESOURCE_ID *id, uint *len); /* not used */ -} WT_RESOURCE_TYPE; - -struct st_wt_resource_id { - ulonglong value; - const WT_RESOURCE_TYPE *type; -}; -/* the below differs from sizeof(WT_RESOURCE_ID) by the amount of padding */ -#define sizeof_WT_RESOURCE_ID (sizeof(ulonglong)+sizeof(void*)) - -#define WT_WAIT_STATS 24 -#define WT_CYCLE_STATS 32 -extern ulonglong wt_wait_table[WT_WAIT_STATS]; -extern uint32 wt_wait_stats[WT_WAIT_STATS+1]; -extern uint32 wt_cycle_stats[2][WT_CYCLE_STATS+1]; -extern uint32 wt_success_stats; - -typedef struct st_wt_thd { - /* - XXX - there's no protection (mutex) against concurrent access of the - dynarray below. it is assumed that a caller will have it anyway - (not to protect this array but to protect its own - caller's - - data structures), and we'll get it for free. A caller needs to - ensure that a blocker won't release a resource before a blocked - thread starts waiting, which is usually done with a mutex. - - If the above assumption is wrong, we'll need to add a mutex here. - */ - DYNAMIC_ARRAY my_resources; - /* - 'waiting_for' is modified under waiting_for->lock, and only by thd itself - 'waiting_for' is read lock-free (using pinning protocol), but a thd object - can read its own 'waiting_for' without any locks or tricks. - */ - WT_RESOURCE *waiting_for; - LF_PINS *pins; - - /* pointers to values */ - const ulong *timeout_short; - const ulong *deadlock_search_depth_short; - const ulong *timeout_long; - const ulong *deadlock_search_depth_long; - - /* - weight relates to the desirability of a transaction being killed if it's - part of a deadlock. In a deadlock situation transactions with lower weights - are killed first. - - Examples of using the weight to implement different selection strategies: - - 1. Latest - Keep all weights equal. - 2. Random - Assight weights at random. - (variant: modify a weight randomly before every lock request) - 3. Youngest - Set weight to -NOW() - 4. Minimum locks - count locks granted in your lock manager, store the value as a weight - 5. Minimum work - depends on the definition of "work". For example, store the number - of rows modifies in this transaction (or a length of REDO log for a - transaction) as a weight. - - It is only statistically relevant and is not protected by any locks. - */ - ulong volatile weight; - /* - 'killed' is indirectly protected by waiting_for->lock because - a killed thread needs to clear its 'waiting_for' and thus needs a lock. - That is a thread needs an exclusive lock to read 'killed' reliably. - But other threads may change 'killed' from 0 to 1, a shared - lock is enough for that. - */ - my_bool killed; -#ifndef DBUG_OFF - const char *name; -#endif -} WT_THD; - -#define WT_TIMEOUT ETIMEDOUT -#define WT_OK 0 -#define WT_DEADLOCK -1 -#define WT_DEPTH_EXCEEDED -2 -#define WT_FREE_TO_GO -3 - -void wt_init(void); -void wt_end(void); -void wt_thd_lazy_init(WT_THD *, const ulong *, const ulong *, const ulong *, const ulong *); -void wt_thd_destroy(WT_THD *); -int wt_thd_will_wait_for(WT_THD *, WT_THD *, const WT_RESOURCE_ID *); -int wt_thd_cond_timedwait(WT_THD *, mysql_mutex_t *); -void wt_thd_release(WT_THD *, const WT_RESOURCE_ID *); -#define wt_thd_release_all(THD) wt_thd_release((THD), 0) -my_bool wt_resource_id_memcmp(const void *, const void *); - -C_MODE_END - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/welcome_copyright_notice.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/welcome_copyright_notice.h deleted file mode 100644 index 22d8d20..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/welcome_copyright_notice.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. - Copyright (c) 2011, 2017, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef _welcome_copyright_notice_h_ -#define _welcome_copyright_notice_h_ - -#define COPYRIGHT_NOTICE_CURRENT_YEAR "2018" - -/* - This define specifies copyright notice which is displayed by every MySQL - program on start, or on help screen. -*/ -#define ORACLE_WELCOME_COPYRIGHT_NOTICE(first_year) \ - "Copyright (c) " first_year ", " COPYRIGHT_NOTICE_CURRENT_YEAR \ - ", Oracle, MariaDB Corporation Ab and others.\n" - -#endif /* _welcome_copyright_notice_h_ */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/win_tzname_data.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/win_tzname_data.h deleted file mode 100644 index 0319722..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/win_tzname_data.h +++ /dev/null @@ -1,138 +0,0 @@ -/* This file was generated using gen_win_tzname_data.ps1 */ -{L"Dateline Standard Time","Etc/GMT+12"}, -{L"UTC-11","Etc/GMT+11"}, -{L"Aleutian Standard Time","America/Adak"}, -{L"Hawaiian Standard Time","Pacific/Honolulu"}, -{L"Marquesas Standard Time","Pacific/Marquesas"}, -{L"Alaskan Standard Time","America/Anchorage"}, -{L"UTC-09","Etc/GMT+9"}, -{L"Pacific Standard Time (Mexico)","America/Tijuana"}, -{L"UTC-08","Etc/GMT+8"}, -{L"Pacific Standard Time","America/Los_Angeles"}, -{L"US Mountain Standard Time","America/Phoenix"}, -{L"Mountain Standard Time (Mexico)","America/Chihuahua"}, -{L"Mountain Standard Time","America/Denver"}, -{L"Central America Standard Time","America/Guatemala"}, -{L"Central Standard Time","America/Chicago"}, -{L"Easter Island Standard Time","Pacific/Easter"}, -{L"Central Standard Time (Mexico)","America/Mexico_City"}, -{L"Canada Central Standard Time","America/Regina"}, -{L"SA Pacific Standard Time","America/Bogota"}, -{L"Eastern Standard Time (Mexico)","America/Cancun"}, -{L"Eastern Standard Time","America/New_York"}, -{L"Haiti Standard Time","America/Port-au-Prince"}, -{L"Cuba Standard Time","America/Havana"}, -{L"US Eastern Standard Time","America/Indianapolis"}, -{L"Turks And Caicos Standard Time","America/Grand_Turk"}, -{L"Paraguay Standard Time","America/Asuncion"}, -{L"Atlantic Standard Time","America/Halifax"}, -{L"Venezuela Standard Time","America/Caracas"}, -{L"Central Brazilian Standard Time","America/Cuiaba"}, -{L"SA Western Standard Time","America/La_Paz"}, -{L"Pacific SA Standard Time","America/Santiago"}, -{L"Newfoundland Standard Time","America/St_Johns"}, -{L"Tocantins Standard Time","America/Araguaina"}, -{L"E. South America Standard Time","America/Sao_Paulo"}, -{L"SA Eastern Standard Time","America/Cayenne"}, -{L"Argentina Standard Time","America/Buenos_Aires"}, -{L"Greenland Standard Time","America/Godthab"}, -{L"Montevideo Standard Time","America/Montevideo"}, -{L"Magallanes Standard Time","America/Punta_Arenas"}, -{L"Saint Pierre Standard Time","America/Miquelon"}, -{L"Bahia Standard Time","America/Bahia"}, -{L"UTC-02","Etc/GMT+2"}, -{L"Azores Standard Time","Atlantic/Azores"}, -{L"Cape Verde Standard Time","Atlantic/Cape_Verde"}, -{L"UTC","Etc/GMT"}, -{L"GMT Standard Time","Europe/London"}, -{L"Greenwich Standard Time","Atlantic/Reykjavik"}, -{L"Sao Tome Standard Time","Africa/Sao_Tome"}, -{L"Morocco Standard Time","Africa/Casablanca"}, -{L"W. Europe Standard Time","Europe/Berlin"}, -{L"Central Europe Standard Time","Europe/Budapest"}, -{L"Romance Standard Time","Europe/Paris"}, -{L"Central European Standard Time","Europe/Warsaw"}, -{L"W. Central Africa Standard Time","Africa/Lagos"}, -{L"Jordan Standard Time","Asia/Amman"}, -{L"GTB Standard Time","Europe/Bucharest"}, -{L"Middle East Standard Time","Asia/Beirut"}, -{L"Egypt Standard Time","Africa/Cairo"}, -{L"E. Europe Standard Time","Europe/Chisinau"}, -{L"Syria Standard Time","Asia/Damascus"}, -{L"West Bank Standard Time","Asia/Hebron"}, -{L"South Africa Standard Time","Africa/Johannesburg"}, -{L"FLE Standard Time","Europe/Kiev"}, -{L"Israel Standard Time","Asia/Jerusalem"}, -{L"Kaliningrad Standard Time","Europe/Kaliningrad"}, -{L"Sudan Standard Time","Africa/Khartoum"}, -{L"Libya Standard Time","Africa/Tripoli"}, -{L"Namibia Standard Time","Africa/Windhoek"}, -{L"Arabic Standard Time","Asia/Baghdad"}, -{L"Turkey Standard Time","Europe/Istanbul"}, -{L"Arab Standard Time","Asia/Riyadh"}, -{L"Belarus Standard Time","Europe/Minsk"}, -{L"Russian Standard Time","Europe/Moscow"}, -{L"E. Africa Standard Time","Africa/Nairobi"}, -{L"Iran Standard Time","Asia/Tehran"}, -{L"Arabian Standard Time","Asia/Dubai"}, -{L"Astrakhan Standard Time","Europe/Astrakhan"}, -{L"Azerbaijan Standard Time","Asia/Baku"}, -{L"Russia Time Zone 3","Europe/Samara"}, -{L"Mauritius Standard Time","Indian/Mauritius"}, -{L"Saratov Standard Time","Europe/Saratov"}, -{L"Georgian Standard Time","Asia/Tbilisi"}, -{L"Volgograd Standard Time","Europe/Volgograd"}, -{L"Caucasus Standard Time","Asia/Yerevan"}, -{L"Afghanistan Standard Time","Asia/Kabul"}, -{L"West Asia Standard Time","Asia/Tashkent"}, -{L"Ekaterinburg Standard Time","Asia/Yekaterinburg"}, -{L"Pakistan Standard Time","Asia/Karachi"}, -{L"Qyzylorda Standard Time","Asia/Qyzylorda"}, -{L"India Standard Time","Asia/Calcutta"}, -{L"Sri Lanka Standard Time","Asia/Colombo"}, -{L"Nepal Standard Time","Asia/Katmandu"}, -{L"Central Asia Standard Time","Asia/Almaty"}, -{L"Bangladesh Standard Time","Asia/Dhaka"}, -{L"Omsk Standard Time","Asia/Omsk"}, -{L"Myanmar Standard Time","Asia/Rangoon"}, -{L"SE Asia Standard Time","Asia/Bangkok"}, -{L"Altai Standard Time","Asia/Barnaul"}, -{L"W. Mongolia Standard Time","Asia/Hovd"}, -{L"North Asia Standard Time","Asia/Krasnoyarsk"}, -{L"N. Central Asia Standard Time","Asia/Novosibirsk"}, -{L"Tomsk Standard Time","Asia/Tomsk"}, -{L"China Standard Time","Asia/Shanghai"}, -{L"North Asia East Standard Time","Asia/Irkutsk"}, -{L"Singapore Standard Time","Asia/Singapore"}, -{L"W. Australia Standard Time","Australia/Perth"}, -{L"Taipei Standard Time","Asia/Taipei"}, -{L"Ulaanbaatar Standard Time","Asia/Ulaanbaatar"}, -{L"Aus Central W. Standard Time","Australia/Eucla"}, -{L"Transbaikal Standard Time","Asia/Chita"}, -{L"Tokyo Standard Time","Asia/Tokyo"}, -{L"North Korea Standard Time","Asia/Pyongyang"}, -{L"Korea Standard Time","Asia/Seoul"}, -{L"Yakutsk Standard Time","Asia/Yakutsk"}, -{L"Cen. Australia Standard Time","Australia/Adelaide"}, -{L"AUS Central Standard Time","Australia/Darwin"}, -{L"E. Australia Standard Time","Australia/Brisbane"}, -{L"AUS Eastern Standard Time","Australia/Sydney"}, -{L"West Pacific Standard Time","Pacific/Port_Moresby"}, -{L"Tasmania Standard Time","Australia/Hobart"}, -{L"Vladivostok Standard Time","Asia/Vladivostok"}, -{L"Lord Howe Standard Time","Australia/Lord_Howe"}, -{L"Bougainville Standard Time","Pacific/Bougainville"}, -{L"Russia Time Zone 10","Asia/Srednekolymsk"}, -{L"Magadan Standard Time","Asia/Magadan"}, -{L"Norfolk Standard Time","Pacific/Norfolk"}, -{L"Sakhalin Standard Time","Asia/Sakhalin"}, -{L"Central Pacific Standard Time","Pacific/Guadalcanal"}, -{L"Russia Time Zone 11","Asia/Kamchatka"}, -{L"New Zealand Standard Time","Pacific/Auckland"}, -{L"UTC+12","Etc/GMT-12"}, -{L"Fiji Standard Time","Pacific/Fiji"}, -{L"Chatham Islands Standard Time","Pacific/Chatham"}, -{L"UTC+13","Etc/GMT-13"}, -{L"Tonga Standard Time","Pacific/Tongatapu"}, -{L"Samoa Standard Time","Pacific/Apia"}, -{L"Line Islands Standard Time","Pacific/Kiritimati"}, diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/winservice.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/winservice.h deleted file mode 100644 index f9ab3ed..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/winservice.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (c) 2011, 2012, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* - Extract properties of a windows service binary path -*/ -#ifdef __cplusplus -extern "C" { -#endif - -#include -typedef struct mysqld_service_properties_st -{ - char mysqld_exe[MAX_PATH]; - char inifile[MAX_PATH]; - char datadir[MAX_PATH]; - int version_major; - int version_minor; - int version_patch; -} mysqld_service_properties; - -extern int get_mysql_service_properties(const wchar_t *bin_path, - mysqld_service_properties *props); - -#ifdef __cplusplus -} -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wqueue.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wqueue.h deleted file mode 100644 index de7a717..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wqueue.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 2007, 2008, Sun Microsystems, Inc, - Copyright (c) 2011, 2012, Monty Program Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef WQUEUE_INCLUDED -#define WQUEUE_INCLUDED - -#include - -/* info about requests in a waiting queue */ -typedef struct st_pagecache_wqueue -{ - struct st_my_thread_var *last_thread; /* circular list of waiting - threads */ -} WQUEUE; - -void wqueue_link_into_queue(WQUEUE *wqueue, struct st_my_thread_var *thread); -void wqueue_unlink_from_queue(WQUEUE *wqueue, struct st_my_thread_var *thread); -void wqueue_add_to_queue(WQUEUE *wqueue, struct st_my_thread_var *thread); -void wqueue_add_and_wait(WQUEUE *wqueue, - struct st_my_thread_var *thread, - mysql_mutex_t *lock); -void wqueue_release_queue(WQUEUE *wqueue); -void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue); - -#endif diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep.h deleted file mode 100644 index f8a1863..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2014 Codership Oy & SkySQL Ab - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef WSREP_INCLUDED -#define WSREP_INCLUDED - -#include - -#ifdef WITH_WSREP - -#define IF_WSREP(A,B) A - -#define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A) - -#define WSREP_MYSQL_DB (char *)"mysql" - -#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \ - if (WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \ - goto wsrep_error_label; - -#define WSREP_TO_ISOLATION_BEGIN_CREATE(db_, table_, table_list_, create_info_) \ - if (WSREP(thd) && \ - wsrep_to_isolation_begin(thd, db_, table_, \ - table_list_, NULL, create_info_)) \ - goto wsrep_error_label; - -#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_, create_info_) \ - if (WSREP(thd) && wsrep_thd_is_local(thd) && \ - wsrep_to_isolation_begin(thd, db_, table_, \ - table_list_, alter_info_, create_info_)) \ - goto wsrep_error_label; - -#define WSREP_TO_ISOLATION_END \ - if ((WSREP(thd) && wsrep_thd_is_local_toi(thd)) || \ - wsrep_thd_is_in_rsu(thd)) \ - wsrep_to_isolation_end(thd); - -/* - Checks if lex->no_write_to_binlog is set for statements that use LOCAL or - NO_WRITE_TO_BINLOG. -*/ -#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) \ - if (WSREP(thd) && !thd->lex->no_write_to_binlog \ - && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto wsrep_error_label; - -#define WSREP_SYNC_WAIT(thd_, before_) \ - { if (WSREP_CLIENT(thd_) && \ - wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; } - -#else /* !WITH_WSREP */ - -/* These macros are needed to compile MariaDB without WSREP support - * (e.g. embedded) */ - -#define IF_WSREP(A,B) B -#define WSREP_DEBUG(...) -#define WSREP_ERROR(...) -#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) do { } while(0) -#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_, create_info_) -#define WSREP_TO_ISOLATION_END -#define WSREP_TO_ISOLATION_BEGIN_CREATE(db_, table_, table_list_, create_info_) -#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) -#define WSREP_SYNC_WAIT(thd_, before_) -#endif /* WITH_WSREP */ - -#endif /* WSREP_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_applier.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_applier.h deleted file mode 100644 index fefca30..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_applier.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright 2013-2019 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef WSREP_APPLIER_H -#define WSREP_APPLIER_H - -#include "sql_class.h" // THD class -#include "rpl_rli.h" // Relay_log_info -#include "log_event.h" // Format_description_log_event - -int wsrep_apply_events(THD* thd, - Relay_log_info* rli, - const void* events_buf, - size_t buf_len); - -/* Applier error codes, when nothing better is available. */ -#define WSREP_RET_SUCCESS 0 // Success -#define WSREP_ERR_GENERIC 1 // When in doubt (MySQL default error code) -#define WSREP_ERR_BAD_EVENT 2 // Can't parse event -#define WSREP_ERR_NOT_FOUND 3 // Key. table, schema not found -#define WSREP_ERR_EXISTS 4 // Key, table, schema already exists -#define WSREP_ERR_WRONG_TYPE 5 // Incompatible data type -#define WSREP_ERR_FAILED 6 // Operation failed for some internal reason -#define WSREP_ERR_ABORTED 7 // Operation was aborted externally - -void wsrep_store_error(const THD* thd, wsrep::mutable_buffer& buf); - -class Format_description_log_event; -void wsrep_set_apply_format(THD*, Format_description_log_event*); -Format_description_log_event* wsrep_get_apply_format(THD* thd); - -#endif /* WSREP_APPLIER_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_binlog.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_binlog.h deleted file mode 100644 index 252fbe6..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_binlog.h +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright (C) 2013 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */ - -#ifndef WSREP_BINLOG_H -#define WSREP_BINLOG_H - -#include "my_global.h" -#include "sql_class.h" // THD, IO_CACHE - -#define HEAP_PAGE_SIZE 65536 /* 64K */ -#define WSREP_MAX_WS_SIZE 2147483647 /* 2GB */ - -/* - Write the contents of a cache to a memory buffer. - - This function quite the same as MYSQL_BIN_LOG::write_cache(), - with the exception that here we write in buffer instead of log file. - */ -int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len); - -/* - Write the contents of a cache to wsrep provider. - - This function quite the same as MYSQL_BIN_LOG::write_cache(), - with the exception that here we write in buffer instead of log file. - - @param len total amount of data written - @return wsrep error status - */ -int wsrep_write_cache(THD* thd, - IO_CACHE* cache, - size_t* len); - -/* Dump replication buffer to disk */ -void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len); - -/* Dump replication buffer along with header to a file */ -void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf, - size_t buf_len); - -/** - Write a skip event into binlog. - - @param thd Thread object pointer - @return Zero in case of success, non-zero on failure. -*/ -int wsrep_write_skip_event(THD* thd); - -/* - Write dummy event into binlog in place of unused GTID. - The binlog write is done in thd context. -*/ -int wsrep_write_dummy_event_low(THD *thd, const char *msg); -/* - Write dummy event to binlog in place of unused GTID and - commit. The binlog write and commit are done in temporary - thd context, the original thd state is not altered. -*/ -int wsrep_write_dummy_event(THD* thd, const char *msg); - -void wsrep_register_binlog_handler(THD *thd, bool trx); - -/** - Return true if committing THD will write to binlog during commit. - This is the case for: - - Local THD, binlog is open - - Replaying THD, binlog is open - - Applier THD, log-slave-updates is enabled -*/ -bool wsrep_commit_will_write_binlog(THD *thd); - -/** - Register THD for group commit. The wsrep_trx must be in committing state, - i.e. the call must be done after wsrep_before_commit() but before - commit order is released. - - This call will release commit order critical section if it is - determined that the commit will go through binlog group commit. - */ -void wsrep_register_for_group_commit(THD *thd); - -/** - Deregister THD from group commit. The wsrep_trx must be in committing state, - as for wsrep_register_for_group_commit() above. - - This call must be used only for THDs which will not go through - binlog group commit. -*/ -void wsrep_unregister_from_group_commit(THD *thd); - -#endif /* WSREP_BINLOG_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_client_service.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_client_service.h deleted file mode 100644 index aa58d99..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_client_service.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -/** @file wsrep_client_service.h - - This file provides declaratios for client service implementation. - See wsrep/client_service.hpp for interface documentation. -*/ - -#ifndef WSREP_CLIENT_SERVICE_H -#define WSREP_CLIENT_SERVICE_H - -/* wsrep-lib */ -#include "wsrep/client_service.hpp" -#include "wsrep/client_state.hpp" -#include "wsrep/exception.hpp" /* not_implemented_error, remove when finished */ - -class THD; -class Wsrep_client_state; -class Wsrep_high_priority_context; - -class Wsrep_client_service : public wsrep::client_service -{ -public: - Wsrep_client_service(THD*, Wsrep_client_state&); - - bool interrupted(wsrep::unique_lock&) const; - void reset_globals(); - void store_globals(); - int prepare_data_for_replication(); - void cleanup_transaction(); - bool statement_allowed_for_streaming() const; - size_t bytes_generated() const; - int prepare_fragment_for_replication(wsrep::mutable_buffer&, size_t&); - int remove_fragments(); - void emergency_shutdown() - { throw wsrep::not_implemented_error(); } - void will_replay(); - enum wsrep::provider::status replay(); - void wait_for_replayers(wsrep::unique_lock&); - void debug_sync(const char*); - void debug_crash(const char*); - int bf_rollback(); -private: - friend class Wsrep_server_service; - THD* m_thd; - Wsrep_client_state& m_client_state; -}; - - -#endif /* WSREP_CLIENT_SERVICE_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_client_state.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_client_state.h deleted file mode 100644 index 403bfa8..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_client_state.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef WSREP_CLIENT_STATE_H -#define WSREP_CLIENT_STATE_H - -/* wsrep-lib */ -#include "wsrep/client_state.hpp" -#include "my_global.h" - -class THD; - -class Wsrep_client_state : public wsrep::client_state -{ -public: - Wsrep_client_state(THD* thd, - wsrep::mutex& mutex, - wsrep::condition_variable& cond, - wsrep::server_state& server_state, - wsrep::client_service& client_service, - const wsrep::client_id& id) - : wsrep::client_state(mutex, - cond, - server_state, - client_service, - id, - wsrep::client_state::m_local) - , m_thd(thd) - { } - THD* thd() { return m_thd; } -private: - THD* m_thd; -}; - -#endif /* WSREP_CLIENT_STATE_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_condition_variable.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_condition_variable.h deleted file mode 100644 index 4412154..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_condition_variable.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef WSREP_CONDITION_VARIABLE_H -#define WSREP_CONDITION_VARIABLE_H - -/* wsrep-lib */ -#include "wsrep/condition_variable.hpp" - -/* implementation */ -#include "my_pthread.h" - -class Wsrep_condition_variable : public wsrep::condition_variable -{ -public: - - Wsrep_condition_variable(mysql_cond_t& cond) - : m_cond(cond) - { } - ~Wsrep_condition_variable() - { } - - void notify_one() - { - mysql_cond_signal(&m_cond); - } - - void notify_all() - { - mysql_cond_broadcast(&m_cond); - } - - void wait(wsrep::unique_lock& lock) - { - mysql_mutex_t* mutex= static_cast(lock.mutex().native()); - mysql_cond_wait(&m_cond, mutex); - } -private: - mysql_cond_t& m_cond; -}; - -#endif /* WSREP_CONDITION_VARIABLE_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_high_priority_service.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_high_priority_service.h deleted file mode 100644 index c275c35..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_high_priority_service.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef WSREP_HIGH_PRIORITY_SERVICE_H -#define WSREP_HIGH_PRIORITY_SERVICE_H - -#include "wsrep/high_priority_service.hpp" -#include "my_global.h" -#include "sql_error.h" /* Diagnostics area */ -#include "sql_class.h" /* rpl_group_info */ - -class THD; -class Relay_log_info; -class Wsrep_server_service; - -class Wsrep_high_priority_service : - public wsrep::high_priority_service, - public wsrep::high_priority_context -{ -public: - Wsrep_high_priority_service(THD*); - ~Wsrep_high_priority_service(); - int start_transaction(const wsrep::ws_handle&, - const wsrep::ws_meta&); - int next_fragment(const wsrep::ws_meta&); - const wsrep::transaction& transaction() const; - int adopt_transaction(const wsrep::transaction&); - int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&, - wsrep::mutable_buffer&) = 0; - int append_fragment_and_commit(const wsrep::ws_handle&, - const wsrep::ws_meta&, - const wsrep::const_buffer&, - const wsrep::xid&); - int remove_fragments(const wsrep::ws_meta&); - int commit(const wsrep::ws_handle&, const wsrep::ws_meta&); - int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&); - int apply_toi(const wsrep::ws_meta&, const wsrep::const_buffer&, - wsrep::mutable_buffer&); - void store_globals(); - void reset_globals(); - void switch_execution_context(wsrep::high_priority_service&); - int log_dummy_write_set(const wsrep::ws_handle&, - const wsrep::ws_meta&, - wsrep::mutable_buffer&); - void adopt_apply_error(wsrep::mutable_buffer&); - - virtual bool check_exit_status() const = 0; - void debug_crash(const char*); -protected: - friend Wsrep_server_service; - THD* m_thd; - Relay_log_info* m_rli; - rpl_group_info* m_rgi; - struct shadow - { - ulonglong option_bits; - uint server_status; - struct st_vio* vio; - ulong tx_isolation; - char* db; - size_t db_length; - //struct timeval user_time; - my_hrtime_t user_time; - longlong row_count_func; - bool wsrep_applier; - } m_shadow; -}; - -class Wsrep_applier_service : public Wsrep_high_priority_service -{ -public: - Wsrep_applier_service(THD*); - ~Wsrep_applier_service(); - int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&, - wsrep::mutable_buffer&); - int apply_nbo_begin(const wsrep::ws_meta&, const wsrep::const_buffer& data, - wsrep::mutable_buffer& err); - void after_apply(); - bool is_replaying() const { return false; } - bool check_exit_status() const; -}; - -class Wsrep_replayer_service : public Wsrep_high_priority_service -{ -public: - Wsrep_replayer_service(THD* replayer_thd, THD* orig_thd); - ~Wsrep_replayer_service(); - int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&, - wsrep::mutable_buffer&); - int apply_nbo_begin(const wsrep::ws_meta&, const wsrep::const_buffer& data, - wsrep::mutable_buffer& err) - { - DBUG_ASSERT(0); /* DDL should never cause replaying */ - return 0; - } - void after_apply() { } - bool is_replaying() const { return true; } - void replay_status(enum wsrep::provider::status status) - { m_replay_status = status; } - enum wsrep::provider::status replay_status() const - { return m_replay_status; } - /* Replayer should never be forced to exit */ - bool check_exit_status() const { return false; } -private: - THD* m_orig_thd; - struct da_shadow - { - enum Diagnostics_area::enum_diagnostics_status status; - ulonglong affected_rows; - ulonglong last_insert_id; - char message[MYSQL_ERRMSG_SIZE]; - da_shadow() - : status() - , affected_rows() - , last_insert_id() - , message() - { } - } m_da_shadow; - enum wsrep::provider::status m_replay_status; -}; - -#endif /* WSREP_HIGH_PRIORITY_SERVICE_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_mutex.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_mutex.h deleted file mode 100644 index 3454b44..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_mutex.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef WSREP_MUTEX_H -#define WSREP_MUTEX_H - -/* wsrep-lib */ -#include "wsrep/mutex.hpp" - -/* implementation */ -#include "my_pthread.h" - -class Wsrep_mutex : public wsrep::mutex -{ -public: - Wsrep_mutex(mysql_mutex_t& mutex) - : m_mutex(mutex) - { } - - void lock() - { - mysql_mutex_lock(&m_mutex); - } - - void unlock() - { - mysql_mutex_unlock(&m_mutex); - } - - void* native() - { - return &m_mutex; - } -private: - mysql_mutex_t& m_mutex; -}; - -#endif /* WSREP_MUTEX_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_mysqld.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_mysqld.h deleted file mode 100644 index 4461d73..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_mysqld.h +++ /dev/null @@ -1,635 +0,0 @@ -/* Copyright 2008-2017 Codership Oy - Copyright (c) 2020, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef WSREP_MYSQLD_H -#define WSREP_MYSQLD_H - -#include - -#ifdef WITH_WSREP -extern bool WSREP_ON_; - -#include -#include "mysql/service_wsrep.h" - -#include -#include -#include "log.h" -#include "mysqld.h" - -typedef struct st_mysql_show_var SHOW_VAR; -#include -#include "mdl.h" -#include "sql_table.h" -#include "wsrep_mysqld_c.h" - -#include "wsrep/provider.hpp" -#include "wsrep/streaming_context.hpp" -#include "wsrep_api.h" -#include -#include -#include "wsrep_server_state.h" - -#define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX - -class set_var; -class THD; - -enum wsrep_consistency_check_mode { - NO_CONSISTENCY_CHECK, - CONSISTENCY_CHECK_DECLARED, - CONSISTENCY_CHECK_RUNNING, -}; - -// Global wsrep parameters - -// MySQL wsrep options -extern const char* wsrep_provider; -extern const char* wsrep_provider_options; -extern const char* wsrep_cluster_name; -extern const char* wsrep_cluster_address; -extern const char* wsrep_node_name; -extern const char* wsrep_node_address; -extern const char* wsrep_node_incoming_address; -extern const char* wsrep_data_home_dir; -extern const char* wsrep_dbug_option; -extern long wsrep_slave_threads; -extern int wsrep_slave_count_change; -extern ulong wsrep_debug; -extern my_bool wsrep_convert_LOCK_to_trx; -extern ulong wsrep_retry_autocommit; -extern my_bool wsrep_auto_increment_control; -extern my_bool wsrep_drupal_282555_workaround; -extern my_bool wsrep_incremental_data_collection; -extern const char* wsrep_start_position; -extern ulong wsrep_max_ws_size; -extern ulong wsrep_max_ws_rows; -extern const char* wsrep_notify_cmd; -extern my_bool wsrep_certify_nonPK; -extern long int wsrep_protocol_version; -extern ulong wsrep_forced_binlog_format; -extern my_bool wsrep_desync; -extern ulong wsrep_reject_queries; -extern my_bool wsrep_recovery; -extern my_bool wsrep_replicate_myisam; -extern my_bool wsrep_log_conflicts; -extern ulong wsrep_mysql_replication_bundle; -extern my_bool wsrep_load_data_splitting; -extern my_bool wsrep_restart_slave; -extern my_bool wsrep_restart_slave_activated; -extern my_bool wsrep_slave_FK_checks; -extern my_bool wsrep_slave_UK_checks; -extern ulong wsrep_trx_fragment_unit; -extern ulong wsrep_SR_store_type; -extern uint wsrep_ignore_apply_errors; -extern ulong wsrep_running_threads; -extern ulong wsrep_running_applier_threads; -extern ulong wsrep_running_rollbacker_threads; -extern bool wsrep_new_cluster; -extern bool wsrep_gtid_mode; -extern my_bool wsrep_strict_ddl; - -enum enum_wsrep_reject_types { - WSREP_REJECT_NONE, /* nothing rejected */ - WSREP_REJECT_ALL, /* reject all queries, with UNKNOWN_COMMAND error */ - WSREP_REJECT_ALL_KILL /* kill existing connections and reject all queries*/ -}; - -enum enum_wsrep_OSU_method { - WSREP_OSU_TOI, - WSREP_OSU_RSU, - WSREP_OSU_NONE -}; - -enum enum_wsrep_sync_wait { - WSREP_SYNC_WAIT_NONE= 0x0, - // select, begin - WSREP_SYNC_WAIT_BEFORE_READ= 0x1, - WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE= 0x2, - WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE= 0x4, - WSREP_SYNC_WAIT_BEFORE_SHOW= 0x8, - WSREP_SYNC_WAIT_MAX= 0xF -}; - -enum enum_wsrep_ignore_apply_error { - WSREP_IGNORE_ERRORS_NONE= 0x0, - WSREP_IGNORE_ERRORS_ON_RECONCILING_DDL= 0x1, - WSREP_IGNORE_ERRORS_ON_RECONCILING_DML= 0x2, - WSREP_IGNORE_ERRORS_ON_DDL= 0x4, - WSREP_IGNORE_ERRORS_MAX= 0x7 -}; - -// Streaming Replication -#define WSREP_FRAG_BYTES 0 -#define WSREP_FRAG_ROWS 1 -#define WSREP_FRAG_STATEMENTS 2 - -#define WSREP_SR_STORE_NONE 0 -#define WSREP_SR_STORE_TABLE 1 - -extern const char *wsrep_fragment_units[]; -extern const char *wsrep_SR_store_types[]; - -// MySQL status variables -extern my_bool wsrep_connected; -extern my_bool wsrep_ready; -extern const char* wsrep_cluster_state_uuid; -extern long long wsrep_cluster_conf_id; -extern const char* wsrep_cluster_status; -extern long wsrep_cluster_size; -extern long wsrep_local_index; -extern long long wsrep_local_bf_aborts; -extern const char* wsrep_provider_name; -extern const char* wsrep_provider_version; -extern const char* wsrep_provider_vendor; -extern char* wsrep_provider_capabilities; -extern char* wsrep_cluster_capabilities; - -int wsrep_show_status(THD *thd, SHOW_VAR *var, void *buff, - system_status_var *status_var, enum_var_type scope); -int wsrep_show_ready(THD *thd, SHOW_VAR *var, char *buff); -void wsrep_free_status(THD *thd); -void wsrep_update_cluster_state_uuid(const char* str); - -/* Filters out --wsrep-new-cluster oprtion from argv[] - * should be called in the very beginning of main() */ -void wsrep_filter_new_cluster (int* argc, char* argv[]); - -int wsrep_init(); -void wsrep_deinit(bool free_options); - -/* Initialize wsrep thread LOCKs and CONDs */ -void wsrep_thr_init(); -/* Destroy wsrep thread LOCKs and CONDs */ -void wsrep_thr_deinit(); - -void wsrep_recover(); -bool wsrep_before_SE(); // initialize wsrep before storage - // engines (true) or after (false) -/* wsrep initialization sequence at startup - * @param before wsrep_before_SE() value */ -void wsrep_init_startup(bool before); - -/* Recover streaming transactions from fragment storage */ -void wsrep_recover_sr_from_storage(THD *); - -// Other wsrep global variables -extern my_bool wsrep_inited; // whether wsrep is initialized ? -extern bool wsrep_service_started; - -extern "C" void wsrep_fire_rollbacker(THD *thd); -extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd); -extern "C" time_t wsrep_thd_query_start(THD *thd); -extern void wsrep_close_client_connections(my_bool wait_to_end, - THD *except_caller_thd= NULL); -extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd); -extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id); - -extern int wsrep_wait_committing_connections_close(int wait_time); -extern void wsrep_close_applier(THD *thd); -extern void wsrep_wait_appliers_close(THD *thd); -extern void wsrep_close_applier_threads(int count); - - -/* new defines */ -extern void wsrep_stop_replication(THD *thd); -extern bool wsrep_start_replication(); -extern void wsrep_shutdown_replication(); -extern bool wsrep_must_sync_wait (THD* thd, uint mask= WSREP_SYNC_WAIT_BEFORE_READ); -extern bool wsrep_sync_wait (THD* thd, uint mask= WSREP_SYNC_WAIT_BEFORE_READ); -extern enum wsrep::provider::status -wsrep_sync_wait_upto (THD* thd, wsrep_gtid_t* upto, int timeout); -extern void wsrep_last_committed_id (wsrep_gtid_t* gtid); -extern int wsrep_check_opts(); -extern void wsrep_prepend_PATH (const char* path); - -/* Other global variables */ -extern wsrep_seqno_t wsrep_locked_seqno; -#define WSREP_ON unlikely(WSREP_ON_) - -/* use xxxxxx_NNULL macros when thd pointer is guaranteed to be non-null to - * avoid compiler warnings (GCC 6 and later) */ - -#define WSREP_NNULL(thd) (WSREP_ON && thd->variables.wsrep_on) - -#define WSREP(thd) \ - (thd && WSREP_NNULL(thd)) - -#define WSREP_CLIENT_NNULL(thd) \ - (WSREP_NNULL(thd) && thd->wsrep_client_thread) - -#define WSREP_CLIENT(thd) \ - (WSREP(thd) && thd->wsrep_client_thread) - -#define WSREP_EMULATE_BINLOG_NNULL(thd) \ - (WSREP_NNULL(thd) && wsrep_emulate_bin_log) - -#define WSREP_EMULATE_BINLOG(thd) \ - (WSREP(thd) && wsrep_emulate_bin_log) - -#define WSREP_BINLOG_FORMAT(my_format) \ - ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \ - wsrep_forced_binlog_format : my_format) - -/* A wrapper function for MySQL log functions. The call will prefix - the log message with WSREP and forward the result buffer to fun. */ -void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...); - -#define WSREP_DEBUG(...) \ - if (wsrep_debug) sql_print_information( "WSREP: " __VA_ARGS__) -#define WSREP_INFO(...) sql_print_information( "WSREP: " __VA_ARGS__) -#define WSREP_WARN(...) sql_print_warning( "WSREP: " __VA_ARGS__) -#define WSREP_ERROR(...) sql_print_error( "WSREP: " __VA_ARGS__) - -#define WSREP_LOG_CONFLICT_THD(thd, role) \ - sql_print_information( \ - "WSREP: %s: \n " \ - " THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \ - " SQL: %s", \ - role, \ - thd_get_thread_id(thd), \ - wsrep_thd_client_mode_str(thd), \ - wsrep_thd_client_state_str(thd), \ - wsrep_thd_transaction_state_str(thd), \ - wsrep_thd_trx_seqno(thd), \ - wsrep_thd_query(thd) \ - ); - -#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \ - if (wsrep_debug || wsrep_log_conflicts) \ - { \ - sql_print_information( "WSREP: cluster conflict due to %s for threads:", \ - (bf_abort) ? "high priority abort" : "certification failure" \ - ); \ - if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \ - if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \ - sql_print_information("WSREP: context: %s:%d", __FILE__, __LINE__); \ - } - -#define WSREP_PROVIDER_EXISTS \ - (wsrep_provider && strncasecmp(wsrep_provider, WSREP_NONE, FN_REFLEN)) - -#define WSREP_QUERY(thd) (thd->query()) - -extern my_bool wsrep_ready_get(); -extern void wsrep_ready_wait(); - -class Ha_trx_info; -struct THD_TRANS; - -extern mysql_mutex_t LOCK_wsrep_ready; -extern mysql_cond_t COND_wsrep_ready; -extern mysql_mutex_t LOCK_wsrep_sst; -extern mysql_cond_t COND_wsrep_sst; -extern mysql_mutex_t LOCK_wsrep_sst_init; -extern mysql_cond_t COND_wsrep_sst_init; -extern int wsrep_replaying; -extern mysql_mutex_t LOCK_wsrep_replaying; -extern mysql_cond_t COND_wsrep_replaying; -extern mysql_mutex_t LOCK_wsrep_slave_threads; -extern mysql_cond_t COND_wsrep_slave_threads; -extern mysql_mutex_t LOCK_wsrep_gtid_wait_upto; -extern mysql_mutex_t LOCK_wsrep_cluster_config; -extern mysql_mutex_t LOCK_wsrep_desync; -extern mysql_mutex_t LOCK_wsrep_SR_pool; -extern mysql_mutex_t LOCK_wsrep_SR_store; -extern mysql_mutex_t LOCK_wsrep_config_state; -extern mysql_mutex_t LOCK_wsrep_group_commit; -extern mysql_mutex_t LOCK_wsrep_joiner_monitor; -extern mysql_mutex_t LOCK_wsrep_donor_monitor; -extern mysql_cond_t COND_wsrep_joiner_monitor; -extern mysql_cond_t COND_wsrep_donor_monitor; - -extern my_bool wsrep_emulate_bin_log; -extern int wsrep_to_isolation; -extern my_bool wsrep_preordered_opt; - -#ifdef HAVE_PSI_INTERFACE - -extern PSI_cond_key key_COND_wsrep_thd; - -extern PSI_mutex_key key_LOCK_wsrep_ready; -extern PSI_mutex_key key_COND_wsrep_ready; -extern PSI_mutex_key key_LOCK_wsrep_sst; -extern PSI_cond_key key_COND_wsrep_sst; -extern PSI_mutex_key key_LOCK_wsrep_sst_init; -extern PSI_cond_key key_COND_wsrep_sst_init; -extern PSI_mutex_key key_LOCK_wsrep_sst_thread; -extern PSI_cond_key key_COND_wsrep_sst_thread; -extern PSI_mutex_key key_LOCK_wsrep_replaying; -extern PSI_cond_key key_COND_wsrep_replaying; -extern PSI_mutex_key key_LOCK_wsrep_slave_threads; -extern PSI_cond_key key_COND_wsrep_slave_threads; -extern PSI_mutex_key key_LOCK_wsrep_gtid_wait_upto; -extern PSI_cond_key key_COND_wsrep_gtid_wait_upto; -extern PSI_mutex_key key_LOCK_wsrep_cluster_config; -extern PSI_mutex_key key_LOCK_wsrep_desync; -extern PSI_mutex_key key_LOCK_wsrep_SR_pool; -extern PSI_mutex_key key_LOCK_wsrep_SR_store; -extern PSI_mutex_key key_LOCK_wsrep_global_seqno; -extern PSI_mutex_key key_LOCK_wsrep_thd_queue; -extern PSI_cond_key key_COND_wsrep_thd_queue; -extern PSI_mutex_key key_LOCK_wsrep_joiner_monitor; -extern PSI_mutex_key key_LOCK_wsrep_donor_monitor; - -extern PSI_file_key key_file_wsrep_gra_log; - -extern PSI_thread_key key_wsrep_sst_joiner; -extern PSI_thread_key key_wsrep_sst_donor; -extern PSI_thread_key key_wsrep_rollbacker; -extern PSI_thread_key key_wsrep_applier; -extern PSI_thread_key key_wsrep_sst_joiner_monitor; -extern PSI_thread_key key_wsrep_sst_donor_monitor; -#endif /* HAVE_PSI_INTERFACE */ - - -struct TABLE_LIST; -class Alter_info; -struct HA_CREATE_INFO; - -int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_, - const TABLE_LIST* table_list, - const Alter_info* alter_info= NULL, - const HA_CREATE_INFO* create_info= NULL); - -bool wsrep_should_replicate_ddl(THD* thd, const enum legacy_db_type db_type); -bool wsrep_should_replicate_ddl_iterate(THD* thd, const TABLE_LIST* table_list); - -void wsrep_to_isolation_end(THD *thd); - -bool wsrep_append_SR_keys(THD *thd); -int wsrep_to_buf_helper( - THD* thd, const char *query, uint query_len, uchar** buf, size_t* buf_len); -int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len); -int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len); - -bool wsrep_stmt_rollback_is_safe(THD* thd); - -void wsrep_init_sidno(const wsrep_uuid_t&); -bool wsrep_node_is_donor(); -bool wsrep_node_is_synced(); - -void wsrep_init_SR(); -void wsrep_verify_SE_checkpoint(const wsrep_uuid_t& uuid, wsrep_seqno_t seqno); -int wsrep_replay_from_SR_store(THD*, const wsrep_trx_meta_t&); -void wsrep_node_uuid(wsrep_uuid_t&); - -class Log_event; -int wsrep_ignored_error_code(Log_event* ev, int error); -int wsrep_must_ignore_error(THD* thd); - -struct wsrep_server_gtid_t -{ - uint32 domain_id; - uint32 server_id; - uint64 seqno; -}; -class Wsrep_gtid_server -{ -public: - uint32 domain_id; - uint32 server_id; - Wsrep_gtid_server() - : m_force_signal(false) - , m_seqno(0) - , m_committed_seqno(0) - { } - void gtid(const wsrep_server_gtid_t& gtid) - { - domain_id= gtid.domain_id; - server_id= gtid.server_id; - m_seqno= gtid.seqno; - } - wsrep_server_gtid_t gtid() - { - wsrep_server_gtid_t gtid; - gtid.domain_id= domain_id; - gtid.server_id= server_id; - gtid.seqno= m_seqno; - return gtid; - } - void seqno(const uint64 seqno) { m_seqno= seqno; } - uint64 seqno() const { return m_seqno; } - uint64 seqno_committed() const { return m_committed_seqno; } - uint64 seqno_inc() - { - m_seqno++; - return m_seqno; - } - const wsrep_server_gtid_t& undefined() - { - return m_undefined; - } - int wait_gtid_upto(const uint64_t seqno, uint timeout) - { - int wait_result= 0; - struct timespec wait_time; - int ret= 0; - mysql_cond_t wait_cond; - mysql_cond_init(key_COND_wsrep_gtid_wait_upto, &wait_cond, NULL); - set_timespec(wait_time, timeout); - mysql_mutex_lock(&LOCK_wsrep_gtid_wait_upto); - std::multimap::iterator it; - if (seqno > m_seqno) - { - try - { - it= m_wait_map.insert(std::make_pair(seqno, &wait_cond)); - } - catch (std::bad_alloc& e) - { - ret= ENOMEM; - } - while (!ret && (m_committed_seqno < seqno) && !m_force_signal) - { - wait_result= mysql_cond_timedwait(&wait_cond, - &LOCK_wsrep_gtid_wait_upto, - &wait_time); - if (wait_result == ETIMEDOUT || wait_result == ETIME) - { - ret= wait_result; - break; - } - } - if (ret != ENOMEM) - { - m_wait_map.erase(it); - } - } - mysql_mutex_unlock(&LOCK_wsrep_gtid_wait_upto); - mysql_cond_destroy(&wait_cond); - return ret; - } - void signal_waiters(uint64 seqno, bool signal_all) - { - mysql_mutex_lock(&LOCK_wsrep_gtid_wait_upto); - if (!signal_all && (m_committed_seqno >= seqno)) - { - mysql_mutex_unlock(&LOCK_wsrep_gtid_wait_upto); - return; - } - m_force_signal= true; - std::multimap::iterator it_end; - std::multimap::iterator it_begin; - if (signal_all) - { - it_end= m_wait_map.end(); - } - else - { - it_end= m_wait_map.upper_bound(seqno); - } - if (m_committed_seqno < seqno) - { - m_committed_seqno= seqno; - } - for (it_begin = m_wait_map.begin(); it_begin != it_end; ++it_begin) - { - mysql_cond_signal(it_begin->second); - } - m_force_signal= false; - mysql_mutex_unlock(&LOCK_wsrep_gtid_wait_upto); - } -private: - const wsrep_server_gtid_t m_undefined= {0,0,0}; - std::multimap m_wait_map; - bool m_force_signal; - Atomic_counter m_seqno; - Atomic_counter m_committed_seqno; -}; -extern Wsrep_gtid_server wsrep_gtid_server; -void wsrep_init_gtid(); -bool wsrep_check_gtid_seqno(const uint32&, const uint32&, uint64&); -bool wsrep_get_binlog_gtid_seqno(wsrep_server_gtid_t&); - -typedef struct wsrep_key_arr -{ - wsrep_key_t* keys; - size_t keys_len; -} wsrep_key_arr_t; -bool wsrep_prepare_keys_for_isolation(THD* thd, - const char* db, - const char* table, - const TABLE_LIST* table_list, - wsrep_key_arr_t* ka); -void wsrep_keys_free(wsrep_key_arr_t* key_arr); - -extern void -wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, - const MDL_ticket *ticket, - const MDL_key *key); - -enum wsrep_thread_type { - WSREP_APPLIER_THREAD=1, - WSREP_ROLLBACKER_THREAD=2 -}; - -typedef void (*wsrep_thd_processor_fun)(THD*, void *); -class Wsrep_thd_args -{ - public: - Wsrep_thd_args(wsrep_thd_processor_fun fun, - wsrep_thread_type thread_type, - pthread_t thread_id) - : - fun_ (fun), - thread_type_ (thread_type), - thread_id_ (thread_id) - { } - - wsrep_thd_processor_fun fun() { return fun_; } - pthread_t* thread_id() {return &thread_id_; } - enum wsrep_thread_type thread_type() {return thread_type_;} - - private: - - Wsrep_thd_args(const Wsrep_thd_args&); - Wsrep_thd_args& operator=(const Wsrep_thd_args&); - - wsrep_thd_processor_fun fun_; - enum wsrep_thread_type thread_type_; - pthread_t thread_id_; -}; - -void* start_wsrep_THD(void*); - -void wsrep_close_threads(THD *thd); -bool wsrep_is_show_query(enum enum_sql_command command); -void wsrep_replay_transaction(THD *thd); -bool wsrep_create_like_table(THD* thd, TABLE_LIST* table, - TABLE_LIST* src_table, - HA_CREATE_INFO *create_info); -bool wsrep_node_is_donor(); -bool wsrep_node_is_synced(); - -/** - * Check if the wsrep provider (ie the Galera library) is capable of - * doing streaming replication. - * @return true if SR capable - */ -bool wsrep_provider_is_SR_capable(); - -/** - * Initialize WSREP server instance. - * - * @return Zero on success, non-zero on error. - */ -int wsrep_init_server(); - -/** - * Initialize WSREP globals. This should be done after server initialization - * is complete and the server has joined to the cluster. - * - */ -void wsrep_init_globals(); - -/** - * Deinit and release WSREP resources. - */ -void wsrep_deinit_server(); - -/** - * Convert streaming fragment unit (WSREP_FRAG_BYTES, WSREP_FRAG_ROWS...) - * to corresponding wsrep-lib fragment_unit - */ -enum wsrep::streaming_context::fragment_unit wsrep_fragment_unit(ulong unit); - -#else /* !WITH_WSREP */ - -/* These macros are needed to compile MariaDB without WSREP support - * (e.g. embedded) */ - -#define WSREP_ON false -#define WSREP(T) (0) -#define WSREP_NNULL(T) (0) -#define WSREP_EMULATE_BINLOG(thd) (0) -#define WSREP_EMULATE_BINLOG_NNULL(thd) (0) -#define WSREP_BINLOG_FORMAT(my_format) ((ulong)my_format) -#define WSREP_PROVIDER_EXISTS (0) -#define wsrep_emulate_bin_log (0) -#define wsrep_to_isolation (0) -#define wsrep_before_SE() (0) -#define wsrep_init_startup(X) -#define wsrep_check_opts() (0) -#define wsrep_thr_init() do {} while(0) -#define wsrep_thr_deinit() do {} while(0) -#define wsrep_init_globals() do {} while(0) -#define wsrep_create_appliers(X) do {} while(0) -#define wsrep_should_replicate_ddl(X,Y) (1) - -#endif /* WITH_WSREP */ - -#endif /* WSREP_MYSQLD_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_mysqld_c.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_mysqld_c.h deleted file mode 100644 index 603f2c2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_mysqld_c.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2018-2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef WSREP_MYSQLD_C_H -#define WSREP_MYSQLD_C_H - -enum enum_wsrep_certification_rules { - WSREP_CERTIFICATION_RULES_STRICT, - WSREP_CERTIFICATION_RULES_OPTIMIZED -}; - -/* This is intentionally declared as a weak global symbol, so that -the same ha_innodb.so can be used with the embedded server -(which does not link to the definition of this variable) -and with the regular server built WITH_WSREP. */ -extern ulong wsrep_certification_rules __attribute__((weak)); - -#endif /* WSREP_MYSQLD_C_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_priv.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_priv.h deleted file mode 100644 index e480331..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_priv.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2010 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - */ - -//! @file declares symbols private to wsrep integration layer - -#ifndef WSREP_PRIV_H -#define WSREP_PRIV_H - -#include -#include "wsrep_mysqld.h" -#include "wsrep_schema.h" - -#include -#include -#include - -my_bool wsrep_ready_set (my_bool x); - -ssize_t wsrep_sst_prepare (void** msg); -wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx, - void* recv_ctx, - const wsrep_buf_t* msg, - const wsrep_gtid_t* state_id, - const wsrep_buf_t* state, - bool bypass); - -extern wsrep_uuid_t local_uuid; -extern wsrep_seqno_t local_seqno; -extern Wsrep_schema* wsrep_schema; - -// a helper function -void wsrep_sst_received(THD*, const wsrep_uuid_t&, wsrep_seqno_t, - const void*, size_t); - -void wsrep_notify_status(enum wsrep::server_state::state status, - const wsrep::view* view= 0); - -#endif /* WSREP_PRIV_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_schema.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_schema.h deleted file mode 100644 index 36e2399..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_schema.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright (C) 2015-2019 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - - -#ifndef WSREP_SCHEMA_H -#define WSREP_SCHEMA_H - -/* wsrep-lib */ -#include "wsrep_types.h" - -#include "mysqld.h" -#include "wsrep_mysqld.h" - -/* - Forward decls -*/ -class THD; -class Relay_log_info; -struct TABLE; -struct TABLE_LIST; -struct st_mysql_lex_string; -typedef struct st_mysql_lex_string LEX_STRING; - -/** Name of the table in `wsrep_schema_str` used for storing streaming -replication data. In an InnoDB full format, e.g. "database/tablename". */ -extern const char* wsrep_sr_table_name_full; - -class Wsrep_schema -{ - public: - - Wsrep_schema(); - ~Wsrep_schema(); - - /* - Initialize wsrep schema. Storage engines must be running before - calling this function. - */ - int init(); - - /* - Store wsrep view info into wsrep schema. - */ - int store_view(THD*, const Wsrep_view& view); - - /* - Restore view info from stable storage. - */ - Wsrep_view restore_view(THD* thd, const Wsrep_id& own_id) const; - - /** - Append transaction fragment to fragment storage. - Transaction must have been started for THD before this call. - In order to make changes durable, transaction must be committed - separately after this call. - - @param thd THD object - @param server_id Wsrep server identifier - @param transaction_id Transaction identifier - @param flags Flags for the fragment - @param data Fragment data buffer - - @return Zero in case of success, non-zero on failure. - */ - int append_fragment(THD* thd, - const wsrep::id& server_id, - wsrep::transaction_id transaction_id, - wsrep::seqno seqno, - int flags, - const wsrep::const_buffer& data); - /** - Update existing fragment meta data. The fragment must have been - inserted before using append_fragment(). - - @param thd THD object - @param ws_meta Wsrep meta data - - @return Zero in case of success, non-zero on failure. - */ - int update_fragment_meta(THD* thd, - const wsrep::ws_meta& ws_meta); - - /** - Remove fragments from storage. This method must be called - inside active transaction. Fragment removal will be committed - once the transaction commits. - - @param thd Pointer to THD object - @param server_id Identifier of the running server - @param transaction_id Identifier of the current transaction - @param fragments Vector of fragment seqnos to be removed - */ - int remove_fragments(THD* thd, - const wsrep::id& server_id, - wsrep::transaction_id transaction_id, - const std::vector& fragments); - - /** - Replay a transaction from stored fragments. The caller must have - started a transaction for a thd. - - @param thd Pointer to THD object - @param ws_meta Write set meta data for commit fragment. - @param fragments Vector of fragments to be replayed - - @return Zero on success, non-zero on failure. - */ - int replay_transaction(THD* thd, - Relay_log_info* rli, - const wsrep::ws_meta& ws_meta, - const std::vector& fragments); - - /** - Recover streaming transactions from SR table. - This method should be called after storage enignes are initialized. - It will scan SR table and replay found streaming transactions. - - @param orig_thd The THD object of the calling thread. - - @return Zero on success, non-zero on failure. - */ - int recover_sr_transactions(THD* orig_thd); - - private: - /* Non-copyable */ - Wsrep_schema(const Wsrep_schema&); - Wsrep_schema& operator=(const Wsrep_schema&); -}; - -extern Wsrep_schema* wsrep_schema; - -#endif /* !WSREP_SCHEMA_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_server_service.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_server_service.h deleted file mode 100644 index 168e982..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_server_service.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef WSREP_SERVER_SERVICE_H -#define WSREP_SERVER_SERVICE_H - -/* wsrep-lib */ -#include "wsrep/server_service.hpp" -#include "wsrep/exception.hpp" // not_impemented_error(), remove when finished -#include "wsrep/storage_service.hpp" - -class Wsrep_server_state; - - -/* wsrep::server_service interface implementation */ -class Wsrep_server_service : public wsrep::server_service -{ -public: - Wsrep_server_service(Wsrep_server_state& server_state) - : m_server_state(server_state) - { } - - wsrep::storage_service* storage_service(wsrep::client_service&); - - wsrep::storage_service* storage_service(wsrep::high_priority_service&); - - void release_storage_service(wsrep::storage_service*); - - wsrep::high_priority_service* - streaming_applier_service(wsrep::client_service&); - - wsrep::high_priority_service* - streaming_applier_service(wsrep::high_priority_service&); - - void release_high_priority_service(wsrep::high_priority_service*); - - void background_rollback(wsrep::client_state&); - - void bootstrap(); - void log_message(enum wsrep::log::level, const char*); - - void log_dummy_write_set(wsrep::client_state&, const wsrep::ws_meta&) - { throw wsrep::not_implemented_error(); } - - void log_view(wsrep::high_priority_service*, const wsrep::view&); - - void recover_streaming_appliers(wsrep::client_service&); - void recover_streaming_appliers(wsrep::high_priority_service&); - wsrep::view get_view(wsrep::client_service&, const wsrep::id& own_id); - - wsrep::gtid get_position(wsrep::client_service&); - void set_position(wsrep::client_service&, const wsrep::gtid&); - - void log_state_change(enum wsrep::server_state::state, - enum wsrep::server_state::state); - - bool sst_before_init() const; - - std::string sst_request(); - int start_sst(const std::string&, const wsrep::gtid&, bool); - - int wait_committing_transactions(int); - - void debug_sync(const char*); -private: - Wsrep_server_state& m_server_state; -}; - -/** - Helper method to create new streaming applier. - - @param orig_thd Original thd context to copy operation context from. - @param ctx Context string for debug logging. - */ -class Wsrep_applier_service; -Wsrep_applier_service* -wsrep_create_streaming_applier(THD *orig_thd, const char *ctx); - -/** - Helper method to create new storage service. - - @param orig_thd Original thd context to copy operation context from. - @param ctx Context string for debug logging. -*/ -class Wsrep_storage_service; -Wsrep_storage_service* -wsrep_create_storage_service(THD *orig_thd, const char *ctx); - -#endif /* WSREP_SERVER_SERVICE */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_server_state.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_server_state.h deleted file mode 100644 index 1ef9373..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_server_state.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef WSREP_SERVER_STATE_H -#define WSREP_SERVER_STATE_H - -/* wsrep-lib */ -#include "wsrep/server_state.hpp" -#include "wsrep/provider.hpp" - -/* implementation */ -#include "wsrep_server_service.h" -#include "wsrep_mutex.h" -#include "wsrep_condition_variable.h" - -class Wsrep_server_state : public wsrep::server_state -{ -public: - static void init_once(const std::string& name, - const std::string& incoming_address, - const std::string& address, - const std::string& working_dir, - const wsrep::gtid& initial_position, - int max_protocol_version); - static void destroy(); - - static Wsrep_server_state& instance() - { - return *m_instance; - } - - static bool is_inited() - { - return (m_instance != NULL); - } - - static wsrep::provider& get_provider() - { - return instance().provider(); - } - - static bool has_capability(int capability) - { - return (get_provider().capabilities() & capability); - } - -private: - Wsrep_server_state(const std::string& name, - const std::string& incoming_address, - const std::string& address, - const std::string& working_dir, - const wsrep::gtid& initial_position, - int max_protocol_version); - ~Wsrep_server_state(); - Wsrep_mutex m_mutex; - Wsrep_condition_variable m_cond; - Wsrep_server_service m_service; - static Wsrep_server_state* m_instance; - -}; - -#endif // WSREP_SERVER_STATE_H diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_sst.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_sst.h deleted file mode 100644 index 2389db4..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_sst.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright (C) 2013-2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */ - -#ifndef WSREP_SST_H -#define WSREP_SST_H - -#include - -#include "wsrep/gtid.hpp" -#include -#include - -#define WSREP_SST_OPT_ROLE "--role" -#define WSREP_SST_OPT_ADDR "--address" -#define WSREP_SST_OPT_AUTH "--auth" -#define WSREP_SST_OPT_DATA "--datadir" -#define WSREP_SST_OPT_CONF "--defaults-file" -#define WSREP_SST_OPT_CONF_SUFFIX "--defaults-group-suffix" -#define WSREP_SST_OPT_CONF_EXTRA "--defaults-extra-file" -#define WSREP_SST_OPT_PARENT "--parent" -#define WSREP_SST_OPT_BINLOG "--binlog" -#define WSREP_SST_OPT_BINLOG_INDEX "--binlog-index" -#define WSREP_SST_OPT_MYSQLD "--mysqld-args" - -// mysqldump-specific options -#define WSREP_SST_OPT_USER "--user" -#define WSREP_SST_OPT_PSWD "--password" -#define WSREP_SST_OPT_HOST "--host" -#define WSREP_SST_OPT_PORT "--port" -#define WSREP_SST_OPT_LPORT "--local-port" - -// donor-specific -#define WSREP_SST_OPT_SOCKET "--socket" -#define WSREP_SST_OPT_GTID "--gtid" -#define WSREP_SST_OPT_BYPASS "--bypass" -#define WSREP_SST_OPT_GTID_DOMAIN_ID "--gtid-domain-id" - -#define WSREP_SST_MYSQLDUMP "mysqldump" -#define WSREP_SST_RSYNC "rsync" -#define WSREP_SST_SKIP "skip" -#define WSREP_SST_MARIABACKUP "mariabackup" -#define WSREP_SST_XTRABACKUP "xtrabackup" -#define WSREP_SST_XTRABACKUPV2 "xtrabackupv2" -#define WSREP_SST_DEFAULT WSREP_SST_RSYNC -#define WSREP_SST_ADDRESS_AUTO "AUTO" -#define WSREP_SST_AUTH_MASK "********" - -/* system variables */ -extern const char* wsrep_sst_method; -extern const char* wsrep_sst_receive_address; -extern const char* wsrep_sst_donor; -extern const char* wsrep_sst_auth; -extern my_bool wsrep_sst_donor_rejects_queries; - -/*! Synchronizes applier thread start with init thread */ -extern void wsrep_sst_grab(); -/*! Init thread waits for SST completion */ -extern bool wsrep_sst_wait(); -/*! Signals wsrep that initialization is complete, writesets can be applied */ -extern bool wsrep_sst_continue(); -extern void wsrep_sst_auth_init(); -extern void wsrep_sst_auth_free(); - -extern void wsrep_SE_init_grab(); /*! grab init critical section */ -extern void wsrep_SE_init_wait(); /*! wait for SE init to complete */ -extern void wsrep_SE_init_done(); /*! signal that SE init is complte */ -extern void wsrep_SE_initialized(); /*! mark SE initialization complete */ - -/** - Return a string containing the state transfer request string. - Note that the string may contain a '\0' in the middle. -*/ -std::string wsrep_sst_prepare(); - -/** - Donate a SST. - - @param request SST request string received from the joiner. Note that - the string may contain a '\0' in the middle. - @param gtid Current position of the donor - @param bypass If true, full SST is not needed. Joiner needs to be - notified that it can continue starting from gtid. - */ -int wsrep_sst_donate(const std::string& request, - const wsrep::gtid& gtid, - bool bypass); - -#else -#define wsrep_SE_initialized() do { } while(0) -#define wsrep_SE_init_grab() do { } while(0) -#define wsrep_SE_init_done() do { } while(0) -#define wsrep_sst_continue() (0) - -#endif /* WSREP_SST_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_storage_service.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_storage_service.h deleted file mode 100644 index f39543a..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_storage_service.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef WSREP_STORAGE_SERVICE_H -#define WSREP_STORAGE_SERVICE_H - -#include "wsrep/storage_service.hpp" -#include "wsrep/client_state.hpp" - -class THD; -class Wsrep_server_service; -class Wsrep_storage_service : - public wsrep::storage_service, - public wsrep::high_priority_context -{ -public: - Wsrep_storage_service(THD*); - ~Wsrep_storage_service(); - int start_transaction(const wsrep::ws_handle&); - void adopt_transaction(const wsrep::transaction&); - int append_fragment(const wsrep::id&, - wsrep::transaction_id, - int flags, - const wsrep::const_buffer&, - const wsrep::xid&); - int update_fragment_meta(const wsrep::ws_meta&); - int remove_fragments(); - int commit(const wsrep::ws_handle&, const wsrep::ws_meta&); - int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&); - void store_globals(); - void reset_globals(); -private: - friend class Wsrep_server_service; - THD* m_thd; -}; - -#endif /* WSREP_STORAGE_SERVICE_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_thd.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_thd.h deleted file mode 100644 index c7350c7..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_thd.h +++ /dev/null @@ -1,302 +0,0 @@ -/* Copyright (C) 2013 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */ - -#ifndef WSREP_THD_H -#define WSREP_THD_H - -#include - -#include "mysql/service_wsrep.h" -#include "wsrep/client_state.hpp" -#include "sql_class.h" -#include "wsrep_utils.h" -#include -class Wsrep_thd_queue -{ -public: - Wsrep_thd_queue(THD* t) : thd(t) - { - mysql_mutex_init(key_LOCK_wsrep_thd_queue, - &LOCK_wsrep_thd_queue, - MY_MUTEX_INIT_FAST); - mysql_cond_init(key_COND_wsrep_thd_queue, &COND_wsrep_thd_queue, NULL); - } - ~Wsrep_thd_queue() - { - mysql_mutex_destroy(&LOCK_wsrep_thd_queue); - mysql_cond_destroy(&COND_wsrep_thd_queue); - } - bool push_back(THD* thd) - { - DBUG_ASSERT(thd); - wsp::auto_lock lock(&LOCK_wsrep_thd_queue); - std::deque::iterator it = queue.begin(); - while (it != queue.end()) - { - if (*it == thd) - { - return true; - } - it++; - } - queue.push_back(thd); - mysql_cond_signal(&COND_wsrep_thd_queue); - return false; - } - THD* pop_front() - { - wsp::auto_lock lock(&LOCK_wsrep_thd_queue); - while (queue.empty()) - { - if (thd->killed != NOT_KILLED) - return NULL; - - thd->mysys_var->current_mutex= &LOCK_wsrep_thd_queue; - thd->mysys_var->current_cond= &COND_wsrep_thd_queue; - - mysql_cond_wait(&COND_wsrep_thd_queue, &LOCK_wsrep_thd_queue); - - thd->mysys_var->current_mutex= 0; - thd->mysys_var->current_cond= 0; - } - THD* ret= queue.front(); - queue.pop_front(); - return ret; - } -private: - THD* thd; - std::deque queue; - mysql_mutex_t LOCK_wsrep_thd_queue; - mysql_cond_t COND_wsrep_thd_queue; -}; - -int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff, - enum enum_var_type scope); -bool wsrep_create_appliers(long threads, bool mutex_protected=false); -void wsrep_create_rollbacker(); - -bool wsrep_bf_abort(const THD*, THD*); -int wsrep_abort_thd(THD *bf_thd_ptr, THD *victim_thd_ptr, my_bool signal); - -extern void wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe); - -/* - Helper methods to deal with thread local storage. - The purpose of these methods is to hide the details of thread - local storage handling when operating with wsrep storage access - and streaming applier THDs - - With one-thread-per-connection thread handling thread specific - variables are allocated when the thread is started and deallocated - before thread exits (my_thread_init(), my_thread_end()). However, - with pool-of-threads thread handling new thread specific variables - are allocated for each THD separately (see threadpool_add_connection()), - and the variables in thread local storage are assigned from - currently active thread (see thread_attach()). This must be taken into - account when storing/resetting thread local storage and when creating - streaming applier THDs. -*/ - -/** - Create new variables for thread local storage. With - one-thread-per-connection thread handling this is a no op, - with pool-of-threads new variables are created via my_thread_init(). - It is assumed that the caller has called wsrep_reset_threadvars() to clear - the thread local storage before this call. - - @return Zero in case of success, non-zero otherwise. -*/ -int wsrep_create_threadvars(); - -/** - Delete variables which were created by wsrep_create_threadvars(). - The caller must store variables into thread local storage before - this call via wsrep_store_threadvars(). -*/ -void wsrep_delete_threadvars(); - -/** - Assign variables from current thread local storage into THD. - This should be called for THDs whose lifetime is limited to single - thread execution or which may share the operation context with some - parent THD (e.g. storage access) and thus don't require separately - allocated globals. - - With one-thread-per-connection thread handling this is a no-op, - with pool-of-threads the variables which are currently stored into - thread local storage are assigned to THD. -*/ -void wsrep_assign_from_threadvars(THD *); - -/** - Helper struct to save variables from thread local storage. - */ -struct Wsrep_threadvars -{ - THD* cur_thd; - st_my_thread_var* mysys_var; -}; - -/** - Save variables from thread local storage into Wsrep_threadvars struct. - */ -Wsrep_threadvars wsrep_save_threadvars(); - -/** - Restore variables into thread local storage from Wsrep_threadvars struct. -*/ -void wsrep_restore_threadvars(const Wsrep_threadvars&); - -/** - Store variables into thread local storage. -*/ -void wsrep_store_threadvars(THD *); - -/** - Reset thread local storage. -*/ -void wsrep_reset_threadvars(THD *); - -/** - Helper functions to override error status - - In many contexts it is desirable to mask the original error status - set for THD or it is necessary to change OK status to error. - This function implements the common logic for the most - of the cases. - - Rules: - * If the diagnostics are has OK or EOF status, override it unconditionally - * If the error is either ER_ERROR_DURING_COMMIT or ER_LOCK_DEADLOCK - it is usually the correct error status to be returned to client, - so don't override those by default - */ - -static inline void wsrep_override_error(THD *thd, uint error) -{ - DBUG_ASSERT(error != ER_ERROR_DURING_COMMIT); - Diagnostics_area *da= thd->get_stmt_da(); - if (da->is_ok() || - da->is_eof() || - !da->is_set() || - (da->is_error() && - da->sql_errno() != error && - da->sql_errno() != ER_ERROR_DURING_COMMIT && - da->sql_errno() != ER_LOCK_DEADLOCK)) - { - da->reset_diagnostics_area(); - my_error(error, MYF(0)); - } -} - -/** - Override error with additional wsrep status. - */ -static inline void wsrep_override_error(THD *thd, uint error, - enum wsrep::provider::status status) -{ - Diagnostics_area *da= thd->get_stmt_da(); - if (da->is_ok() || - !da->is_set() || - (da->is_error() && - da->sql_errno() != error && - da->sql_errno() != ER_ERROR_DURING_COMMIT && - da->sql_errno() != ER_LOCK_DEADLOCK)) - { - da->reset_diagnostics_area(); - my_error(error, MYF(0), status); - } -} - -static inline void wsrep_override_error(THD* thd, - wsrep::client_error ce, - enum wsrep::provider::status status) -{ - DBUG_ASSERT(ce != wsrep::e_success); - switch (ce) - { - case wsrep::e_error_during_commit: - wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status); - break; - case wsrep::e_deadlock_error: - wsrep_override_error(thd, ER_LOCK_DEADLOCK); - break; - case wsrep::e_interrupted_error: - wsrep_override_error(thd, ER_QUERY_INTERRUPTED); - break; - case wsrep::e_size_exceeded_error: - wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status); - break; - case wsrep::e_append_fragment_error: - /* TODO: Figure out better error number */ - wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status); - break; - case wsrep::e_not_supported_error: - wsrep_override_error(thd, ER_NOT_SUPPORTED_YET); - break; - case wsrep::e_timeout_error: - wsrep_override_error(thd, ER_LOCK_WAIT_TIMEOUT); - break; - default: - wsrep_override_error(thd, ER_UNKNOWN_ERROR); - break; - } -} - -/** - Helper function to log THD wsrep context. - - @param thd Pointer to THD - @param message Optional message - @param function Function where the call was made from - */ -static inline void wsrep_log_thd(const THD *thd, - const char *message, - const char *function) -{ - WSREP_DEBUG("%s %s\n" - " thd: %llu thd_ptr: %p client_mode: %s client_state: %s trx_state: %s\n" - " next_trx_id: %lld trx_id: %lld seqno: %lld\n" - " is_streaming: %d fragments: %zu\n" - " sql_errno: %u message: %s\n" -#define WSREP_THD_LOG_QUERIES -#ifdef WSREP_THD_LOG_QUERIES - " command: %d query: %.72s" -#endif /* WSREP_OBSERVER_LOG_QUERIES */ - , - function, - message ? message : "", - thd->thread_id, - thd, - wsrep_thd_client_mode_str(thd), - wsrep_thd_client_state_str(thd), - wsrep_thd_transaction_state_str(thd), - (long long)thd->wsrep_next_trx_id(), - (long long)thd->wsrep_trx_id(), - (long long)wsrep_thd_trx_seqno(thd), - thd->wsrep_trx().is_streaming(), - thd->wsrep_sr().fragments().size(), - (thd->get_stmt_da()->is_error() ? thd->get_stmt_da()->sql_errno() : 0), - (thd->get_stmt_da()->is_error() ? thd->get_stmt_da()->message() : "") -#ifdef WSREP_THD_LOG_QUERIES - , thd->lex->sql_command, - WSREP_QUERY(thd) -#endif /* WSREP_OBSERVER_LOG_QUERIES */ - ); -} - -#define WSREP_LOG_THD(thd_, message_) wsrep_log_thd(thd_, message_, __FUNCTION__) - -#endif /* WSREP_THD_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_trans_observer.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_trans_observer.h deleted file mode 100644 index 35b93cb..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_trans_observer.h +++ /dev/null @@ -1,526 +0,0 @@ -/* Copyright 2016-2019 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef WSREP_TRANS_OBSERVER_H -#define WSREP_TRANS_OBSERVER_H - -#include "my_global.h" -#include "mysql/service_wsrep.h" -#include "wsrep_applier.h" /* wsrep_apply_error */ -#include "wsrep_xid.h" -#include "wsrep_thd.h" -#include "wsrep_binlog.h" /* register/deregister group commit */ -#include "my_dbug.h" - -class THD; - -void wsrep_commit_empty(THD* thd, bool all); - -/* - Return true if THD has active wsrep transaction. - */ -static inline bool wsrep_is_active(THD* thd) -{ - return (thd->wsrep_cs().state() != wsrep::client_state::s_none && - thd->wsrep_cs().transaction().active() && - !thd->internal_transaction()); -} - -/* - Return true if transaction is ordered. - */ -static inline bool wsrep_is_ordered(THD* thd) -{ - return thd->wsrep_trx().ordered(); -} - -/* - Return true if transaction has been BF aborted but has not been - rolled back yet. - - It is required that the caller holds thd->LOCK_thd_data. -*/ -static inline bool wsrep_must_abort(THD* thd) -{ - mysql_mutex_assert_owner(&thd->LOCK_thd_data); - return (thd->wsrep_trx().state() == wsrep::transaction::s_must_abort); -} - -/* - Return true if the transaction must be replayed. - */ -static inline bool wsrep_must_replay(THD* thd) -{ - return (thd->wsrep_trx().state() == wsrep::transaction::s_must_replay); -} -/* - Return true if transaction has not been committed. - - Note that we don't require thd->LOCK_thd_data here. Calling this method - makes sense only from codepaths which are past ordered_commit state - and the wsrep transaction is immune to BF aborts at that point. -*/ -static inline bool wsrep_not_committed(THD* thd) -{ - return (thd->wsrep_trx().state() != wsrep::transaction::s_committed); -} - -/* - Return true if THD is either committing a transaction or statement - is autocommit. - */ -static inline bool wsrep_is_real(THD* thd, bool all) -{ - return (all || thd->transaction->all.ha_list == 0); -} - -/* - Check if a transaction has generated changes. - */ -static inline bool wsrep_has_changes(THD* thd) -{ - return (thd->wsrep_trx().is_empty() == false); -} - -/* - Check if an active transaction has been BF aborted. - */ -static inline bool wsrep_is_bf_aborted(THD* thd) -{ - return (thd->wsrep_trx().active() && thd->wsrep_trx().bf_aborted()); -} - -static inline int wsrep_check_pk(THD* thd) -{ - if (!wsrep_certify_nonPK) - { - for (TABLE* table= thd->open_tables; table != NULL; table= table->next) - { - if (table->key_info == NULL || table->s->primary_key == MAX_KEY) - { - WSREP_DEBUG("No primary key found for table %s.%s", - table->s->db.str, table->s->table_name.str); - wsrep_override_error(thd, ER_LOCK_DEADLOCK); - return 1; - } - } - } - return 0; -} - -static inline bool wsrep_streaming_enabled(THD* thd) -{ - return (thd->wsrep_sr().fragment_size() > 0); -} - -/* - Return number of fragments successfully certified for the - current statement. - */ -static inline size_t wsrep_fragments_certified_for_stmt(THD* thd) -{ - return thd->wsrep_trx().fragments_certified_for_statement(); -} - -static inline int wsrep_start_transaction(THD* thd, wsrep_trx_id_t trx_id) -{ - if (thd->wsrep_cs().state() != wsrep::client_state::s_none) { - if (wsrep_is_active(thd) == false) - return thd->wsrep_cs().start_transaction(wsrep::transaction_id(trx_id)); - } - return 0; -} - -/**/ -static inline int wsrep_start_trx_if_not_started(THD* thd) -{ - int ret= 0; - DBUG_ASSERT(thd->wsrep_next_trx_id() != WSREP_UNDEFINED_TRX_ID); - DBUG_ASSERT(thd->wsrep_cs().mode() == Wsrep_client_state::m_local); - if (thd->wsrep_trx().active() == false) - { - ret= wsrep_start_transaction(thd, thd->wsrep_next_trx_id()); - } - return ret; -} - -/* - Called after each row operation. - - Return zero on succes, non-zero on failure. - */ -static inline int wsrep_after_row_internal(THD* thd) -{ - if (thd->wsrep_cs().state() != wsrep::client_state::s_none && - wsrep_thd_is_local(thd)) - { - if (wsrep_check_pk(thd)) - { - return 1; - } - else if (wsrep_streaming_enabled(thd)) - { - return thd->wsrep_cs().after_row(); - } - } - return 0; -} - -/* - Helper method to determine whether commit time hooks - should be run for the transaction. - - Commit hooks must be run in the following cases: - - The transaction is local and has generated write set and is committing. - - The transaction has been BF aborted - - Is running in high priority mode and is ordered. This can be replayer, - applier or storage access. - */ -static inline bool wsrep_run_commit_hook(THD* thd, bool all) -{ - DBUG_ENTER("wsrep_run_commit_hook"); - DBUG_PRINT("wsrep", ("Is_active: %d is_real %d has_changes %d is_applying %d " - "is_ordered: %d", - wsrep_is_active(thd), wsrep_is_real(thd, all), - wsrep_has_changes(thd), wsrep_thd_is_applying(thd), - wsrep_is_ordered(thd))); - /* Is MST commit or autocommit? */ - bool ret= wsrep_is_active(thd) && wsrep_is_real(thd, all); - /* Do not commit if we are aborting */ - ret= ret && (thd->wsrep_trx().state() != wsrep::transaction::s_aborting); - if (ret && !(wsrep_has_changes(thd) || /* Has generated write set */ - /* Is high priority (replay, applier, storage) and the - transaction is scheduled for commit ordering */ - (wsrep_thd_is_applying(thd) && wsrep_is_ordered(thd)))) - { - mysql_mutex_lock(&thd->LOCK_thd_data); - DBUG_PRINT("wsrep", ("state: %s", - wsrep::to_c_string(thd->wsrep_trx().state()))); - /* Transaction is local but has no changes, the commit hooks will - be skipped and the wsrep transaction is terminated in - wsrep_commit_empty() */ - if (thd->wsrep_trx().state() == wsrep::transaction::s_executing) - { - ret= false; - } - mysql_mutex_unlock(&thd->LOCK_thd_data); - } - DBUG_PRINT("wsrep", ("return: %d", ret)); - DBUG_RETURN(ret); -} - -/* - Called before the transaction is prepared. - - Return zero on succes, non-zero on failure. - */ -static inline int wsrep_before_prepare(THD* thd, bool all) -{ - DBUG_ENTER("wsrep_before_prepare"); - WSREP_DEBUG("wsrep_before_prepare: %d", wsrep_is_real(thd, all)); - int ret= 0; - DBUG_ASSERT(wsrep_run_commit_hook(thd, all)); - if ((ret= thd->wsrep_cs().before_prepare()) == 0) - { - DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined()); - wsrep_xid_init(&thd->wsrep_xid, - thd->wsrep_trx().ws_meta().gtid(), - wsrep_gtid_server.gtid()); - } - DBUG_RETURN(ret); -} - -/* - Called after the transaction has been prepared. - - Return zero on succes, non-zero on failure. - */ -static inline int wsrep_after_prepare(THD* thd, bool all) -{ - DBUG_ENTER("wsrep_after_prepare"); - WSREP_DEBUG("wsrep_after_prepare: %d", wsrep_is_real(thd, all)); - DBUG_ASSERT(wsrep_run_commit_hook(thd, all)); - int ret= thd->wsrep_cs().after_prepare(); - DBUG_ASSERT(ret == 0 || thd->wsrep_cs().current_error() || - thd->wsrep_cs().transaction().state() == wsrep::transaction::s_must_replay); - DBUG_RETURN(ret); -} - -/* - Called before the transaction is committed. - - This function must be called from both client and - applier contexts before commit. - - Return zero on succes, non-zero on failure. - */ -static inline int wsrep_before_commit(THD* thd, bool all) -{ - DBUG_ENTER("wsrep_before_commit"); - WSREP_DEBUG("wsrep_before_commit: %d, %lld", - wsrep_is_real(thd, all), - (long long)wsrep_thd_trx_seqno(thd)); - int ret= 0; - DBUG_ASSERT(wsrep_run_commit_hook(thd, all)); - if ((ret= thd->wsrep_cs().before_commit()) == 0) - { - DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined()); - if (!thd->variables.gtid_seq_no && - (thd->wsrep_trx().ws_meta().flags() & wsrep::provider::flag::commit)) - { - uint64 seqno= 0; - if (thd->variables.wsrep_gtid_seq_no && - thd->variables.wsrep_gtid_seq_no > wsrep_gtid_server.seqno()) - { - seqno= thd->variables.wsrep_gtid_seq_no; - wsrep_gtid_server.seqno(thd->variables.wsrep_gtid_seq_no); - } - else - { - seqno= wsrep_gtid_server.seqno_inc(); - } - thd->variables.wsrep_gtid_seq_no= 0; - thd->wsrep_current_gtid_seqno= seqno; - if (mysql_bin_log.is_open() && wsrep_gtid_mode) - { - thd->variables.gtid_seq_no= seqno; - thd->variables.gtid_domain_id= wsrep_gtid_server.domain_id; - thd->variables.server_id= wsrep_gtid_server.server_id; - } - } - - wsrep_xid_init(&thd->wsrep_xid, - thd->wsrep_trx().ws_meta().gtid(), - wsrep_gtid_server.gtid()); - wsrep_register_for_group_commit(thd); - } - DBUG_RETURN(ret); -} - -/* - Called after the transaction has been ordered for commit. - - This function must be called from both client and - applier contexts after the commit has been ordered. - - @param thd Pointer to THD - @param all - @param err Error buffer in case of applying error - - Return zero on succes, non-zero on failure. - */ -static inline int wsrep_ordered_commit(THD* thd, bool all) -{ - DBUG_ENTER("wsrep_ordered_commit"); - WSREP_DEBUG("wsrep_ordered_commit: %d", wsrep_is_real(thd, all)); - DBUG_ASSERT(wsrep_run_commit_hook(thd, all)); - DBUG_RETURN(thd->wsrep_cs().ordered_commit()); -} - -/* - Called after the transaction has been committed. - - Return zero on succes, non-zero on failure. - */ -static inline int wsrep_after_commit(THD* thd, bool all) -{ - DBUG_ENTER("wsrep_after_commit"); - WSREP_DEBUG("wsrep_after_commit: %d, %d, %lld, %d", - wsrep_is_real(thd, all), - wsrep_is_active(thd), - (long long)wsrep_thd_trx_seqno(thd), - wsrep_has_changes(thd)); - DBUG_ASSERT(wsrep_run_commit_hook(thd, all)); - if (thd->internal_transaction()) - DBUG_RETURN(0); - int ret= 0; - if (thd->wsrep_trx().state() == wsrep::transaction::s_committing) - { - ret= thd->wsrep_cs().ordered_commit(); - } - wsrep_unregister_from_group_commit(thd); - thd->wsrep_xid.null(); - DBUG_RETURN(ret || thd->wsrep_cs().after_commit()); -} - -/* - Called before the transaction is rolled back. - - Return zero on succes, non-zero on failure. - */ -static inline int wsrep_before_rollback(THD* thd, bool all) -{ - DBUG_ENTER("wsrep_before_rollback"); - int ret= 0; - if (wsrep_is_active(thd)) - { - if (!all && thd->in_active_multi_stmt_transaction()) - { - if (wsrep_emulate_bin_log) - { - wsrep_thd_binlog_stmt_rollback(thd); - } - - if (thd->wsrep_trx().is_streaming() && - !wsrep_stmt_rollback_is_safe(thd)) - { - /* Non-safe statement rollback during SR multi statement - transasction. Self abort the transaction, the actual rollback - and error handling will be done in after statement phase. */ - wsrep_thd_self_abort(thd); - ret= 0; - } - } - else if (wsrep_is_real(thd, all) && - thd->wsrep_trx().state() != wsrep::transaction::s_aborted) - { - /* Real transaction rolling back and wsrep abort not completed - yet */ - /* Reset XID so that it does not trigger writing serialization - history in InnoDB. This needs to be avoided because rollback - may happen out of order and replay may follow. */ - thd->wsrep_xid.null(); - ret= thd->wsrep_cs().before_rollback(); - } - } - DBUG_RETURN(ret); -} - -/* - Called after the transaction has been rolled back. - - Return zero on succes, non-zero on failure. - */ -static inline int wsrep_after_rollback(THD* thd, bool all) -{ - DBUG_ENTER("wsrep_after_rollback"); - DBUG_RETURN((wsrep_is_real(thd, all) && wsrep_is_active(thd) && - thd->wsrep_cs().transaction().state() != - wsrep::transaction::s_aborted) ? - thd->wsrep_cs().after_rollback() : 0); -} - -static inline int wsrep_before_statement(THD* thd) -{ - return (thd->wsrep_cs().state() != wsrep::client_state::s_none && - !thd->internal_transaction() ? - thd->wsrep_cs().before_statement() : 0); -} - -static inline -int wsrep_after_statement(THD* thd) -{ - DBUG_ENTER("wsrep_after_statement"); - DBUG_RETURN(thd->wsrep_cs().state() != wsrep::client_state::s_none && - !thd->internal_transaction() ? - thd->wsrep_cs().after_statement() : 0); -} - -static inline void wsrep_after_apply(THD* thd) -{ - DBUG_ASSERT(wsrep_thd_is_applying(thd)); - WSREP_DEBUG("wsrep_after_apply %lld", thd->thread_id); - if (!thd->internal_transaction()) - thd->wsrep_cs().after_applying(); -} - -static inline void wsrep_open(THD* thd) -{ - DBUG_ENTER("wsrep_open"); - if (WSREP(thd)) - { - thd->wsrep_cs().open(wsrep::client_id(thd->thread_id)); - thd->wsrep_cs().debug_log_level(wsrep_debug); - if (!thd->wsrep_applier && thd->variables.wsrep_trx_fragment_size) - { - thd->wsrep_cs().enable_streaming( - wsrep_fragment_unit(thd->variables.wsrep_trx_fragment_unit), - size_t(thd->variables.wsrep_trx_fragment_size)); - } - } - DBUG_VOID_RETURN; -} - -static inline void wsrep_close(THD* thd) -{ - DBUG_ENTER("wsrep_close"); - if (thd->wsrep_cs().state() != wsrep::client_state::s_none && - !thd->internal_transaction()) - { - thd->wsrep_cs().close(); - } - DBUG_VOID_RETURN; -} - -static inline void -wsrep_wait_rollback_complete_and_acquire_ownership(THD *thd) -{ - DBUG_ENTER("wsrep_wait_rollback_complete_and_acquire_ownership"); - if (thd->wsrep_cs().state() != wsrep::client_state::s_none && - !thd->internal_transaction()) - { - thd->wsrep_cs().wait_rollback_complete_and_acquire_ownership(); - } - DBUG_VOID_RETURN; -} - -static inline int wsrep_before_command(THD* thd) -{ - return (thd->wsrep_cs().state() != wsrep::client_state::s_none && - !thd->internal_transaction() ? - thd->wsrep_cs().before_command() : 0); -} -/* - Called after each command. - - Return zero on success, non-zero on failure. -*/ -static inline void wsrep_after_command_before_result(THD* thd) -{ - if (thd->wsrep_cs().state() != wsrep::client_state::s_none && - !thd->internal_transaction()) - { - thd->wsrep_cs().after_command_before_result(); - } -} - -static inline void wsrep_after_command_after_result(THD* thd) -{ - if (thd->wsrep_cs().state() != wsrep::client_state::s_none && - !thd->internal_transaction()) - { - thd->wsrep_cs().after_command_after_result(); - } -} - -static inline void wsrep_after_command_ignore_result(THD* thd) -{ - wsrep_after_command_before_result(thd); - DBUG_ASSERT(!thd->wsrep_cs().current_error()); - wsrep_after_command_after_result(thd); -} - -static inline enum wsrep::client_error wsrep_current_error(THD* thd) -{ - return thd->wsrep_cs().current_error(); -} - -static inline enum wsrep::provider::status -wsrep_current_error_status(THD* thd) -{ - return thd->wsrep_cs().current_error_status(); -} - -#endif /* WSREP_TRANS_OBSERVER */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_types.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_types.h deleted file mode 100644 index 9da00e3..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_types.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2018 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -/* - Wsrep typedefs to better conform to coding style. - */ -#ifndef WSREP_TYPES_H -#define WSREP_TYPES_H - -#include "wsrep/seqno.hpp" -#include "wsrep/view.hpp" - -typedef wsrep::id Wsrep_id; -typedef wsrep::seqno Wsrep_seqno; -typedef wsrep::view Wsrep_view; - -#endif /* WSREP_TYPES_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_utils.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_utils.h deleted file mode 100644 index 974c623..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_utils.h +++ /dev/null @@ -1,442 +0,0 @@ -/* Copyright (C) 2013-2015 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */ - -#ifndef WSREP_UTILS_H -#define WSREP_UTILS_H - -#include "wsrep_priv.h" -#include "wsrep_mysqld.h" - -unsigned int wsrep_check_ip (const char* const addr, bool *is_ipv6); -size_t wsrep_guess_ip (char* buf, size_t buf_len); -namespace wsp { -class node_status -{ -public: - node_status() : status(wsrep::server_state::s_disconnected) {} - void set(enum wsrep::server_state::state new_status, - const wsrep::view* view= 0) - { - if (status != new_status || 0 != view) - { - wsrep_notify_status(new_status, view); - status= new_status; - } - } - enum wsrep::server_state::state get() const { return status; } -private: - enum wsrep::server_state::state status; -}; -} /* namespace wsp */ - -extern wsp::node_status local_status; - -/* returns the length of the host part of the address string */ -size_t wsrep_host_len(const char* addr, size_t addr_len); - -namespace wsp { - -class Address { -public: - Address() - : m_address_len(0), m_family(UNSPEC), m_port(0), m_valid(false) - { - memset(m_address, 0, sizeof(m_address)); - } - Address(const char *addr_in) - : m_address_len(0), m_family(UNSPEC), m_port(0), m_valid(false) - { - memset(m_address, 0, sizeof(m_address)); - parse_addr(addr_in); - } - bool is_valid() { return m_valid; } - bool is_ipv6() { return (m_family == INET6); } - - const char* get_address() { return m_address; } - size_t get_address_len() { return m_address_len; } - int get_port() { return m_port; } - -private: - enum family { - UNSPEC= 0, - INET, /* IPv4 */ - INET6, /* IPv6 */ - }; - - char m_address[256]; - size_t m_address_len; - family m_family; - int m_port; - bool m_valid; - - void parse_addr(const char *addr_in) { - const char *start; - const char *end; - const char *port; - const char* open_bracket= strchr(const_cast(addr_in), '['); - const char* close_bracket= strchr(const_cast(addr_in), ']'); - const char* colon= strchr(const_cast(addr_in), ':'); - const char* dot= strchr(const_cast(addr_in), '.'); - - int cc= colon_count(addr_in); - - if (open_bracket != NULL || - dot == NULL || - (colon != NULL && (dot == NULL || colon < dot))) - { - // This could be an IPv6 address or a hostname - if (open_bracket != NULL) { - /* Sanity check: Address with '[' must include ']' */ - if (close_bracket == NULL && - open_bracket < close_bracket) /* Error: malformed address */ - { - m_valid= false; - return; - } - - start= open_bracket + 1; - end= close_bracket; - - /* Check for port */ - port= strchr(close_bracket, ':'); - if ((port != NULL) && parse_port(port + 1)) - { - return; /* Error: invalid port */ - } - m_family= INET6; - } - else - { - switch (cc) { - case 0: - /* Hostname with no port */ - start= addr_in; - end= addr_in + strlen(addr_in); - break; - case 1: - /* Hostname with port (host:port) */ - start= addr_in; - end= colon; - if (parse_port(colon + 1)) - return; /* Error: invalid port */ - break; - default: - /* IPv6 address */ - start= addr_in; - end= addr_in + strlen(addr_in); - m_family= INET6; - break; - } - } - } else { /* IPv4 address or hostname */ - start= addr_in; - if (colon != NULL) { /* Port */ - end= colon; - if (parse_port(colon + 1)) - return; /* Error: invalid port */ - } else { - end= addr_in + strlen(addr_in); - } - } - - size_t len= end - start; - - /* Safety */ - if (len >= sizeof(m_address)) - { - // The supplied address is too large to fit into the internal buffer. - m_valid= false; - return; - } - - memcpy(m_address, start, len); - m_address[len]= '\0'; - m_address_len= ++ len; - m_valid= true; - return; - } - - int colon_count(const char *addr) { - int count= 0, i= 0; - - while(addr[i] != '\0') - { - if (addr[i] == ':') ++count; - ++ i; - } - return count; - } - - bool parse_port(const char *port) { - errno= 0; /* Reset the errno */ - m_port= strtol(port, NULL, 10); - if (errno == EINVAL || errno == ERANGE) - { - m_port= 0; /* Error: invalid port */ - m_valid= false; - return true; - } - return false; - } -}; - -class Config_state -{ -public: - Config_state() : view_(), status_(wsrep::server_state::s_disconnected) - {} - - void set(const wsrep::view& view) - { - wsrep_notify_status(status_, &view); - - lock(); - view_= view; - unlock(); - } - - void set(enum wsrep::server_state::state status) - { - wsrep_notify_status(status); - - lock(); - status_= status; - unlock(); - } - - const wsrep::view& get_view_info() const - { - return view_; - } - - enum wsrep::server_state::state get_status() const - { - return status_; - } - - int lock() - { - return mysql_mutex_lock(&LOCK_wsrep_config_state); - } - - int unlock() - { - return mysql_mutex_unlock(&LOCK_wsrep_config_state); - } - -private: - wsrep::view view_; - enum wsrep::server_state::state status_; -}; - -} /* namespace wsp */ - -extern wsp::Config_state *wsrep_config_state; - -namespace wsp { -/* a class to manage env vars array */ -class env -{ -private: - size_t len_; - char** env_; - int errno_; - bool ctor_common(char** e); - void dtor(); - env& operator =(env); -public: - explicit env(char** env); - explicit env(const env&); - ~env(); - int append(const char* var); /* add a new env. var */ - int error() const { return errno_; } - char** operator()() { return env_; } -}; - -/* A small class to run external programs. */ -class process -{ -private: - const char* const str_; - FILE* io_; - int err_; - pid_t pid_; - -public: -/*! @arg type is a pointer to a null-terminated string which must contain - either the letter 'r' for reading or the letter 'w' for writing. - @arg env optional null-terminated vector of environment variables - */ - process (const char* cmd, const char* type, char** env); - ~process (); - - FILE* pipe () { return io_; } - int error() { return err_; } - int wait (); - const char* cmd() { return str_; } -}; - -class thd -{ - class thd_init - { - public: - thd_init() { my_thread_init(); } - ~thd_init() { my_thread_end(); } - } - init; - - thd (const thd&); - thd& operator= (const thd&); - -public: - - thd(my_bool wsrep_on, bool system_thread=false); - ~thd(); - THD* const ptr; -}; - -class string -{ -public: - string() : string_(0) {} - explicit string(size_t s) : string_(static_cast(malloc(s))) {} - char* operator()() { return string_; } - void set(char* str) { if (string_) free (string_); string_= str; } - ~string() { set (0); } -private: - char* string_; -}; - -/* scope level lock */ -class auto_lock -{ -public: - auto_lock(mysql_mutex_t* m) : m_(m) { mysql_mutex_lock(m_); } - ~auto_lock() { mysql_mutex_unlock(m_); } -private: - mysql_mutex_t& operator =(mysql_mutex_t&); - mysql_mutex_t* const m_; -}; - -#ifdef REMOVED -class lock -{ - pthread_mutex_t* const mtx_; - -public: - - lock (pthread_mutex_t* mtx) : mtx_(mtx) - { - int err= pthread_mutex_lock (mtx_); - - if (err) - { - WSREP_ERROR("Mutex lock failed: %s", strerror(err)); - abort(); - } - } - - virtual ~lock () - { - int err= pthread_mutex_unlock (mtx_); - - if (err) - { - WSREP_ERROR("Mutex unlock failed: %s", strerror(err)); - abort(); - } - } - - inline void wait (pthread_cond_t* cond) - { - pthread_cond_wait (cond, mtx_); - } - -private: - - lock (const lock&); - lock& operator=(const lock&); - -}; - -class monitor -{ - int mutable refcnt; - pthread_mutex_t mutable mtx; - pthread_cond_t mutable cond; - -public: - - monitor() : refcnt(0) - { - pthread_mutex_init (&mtx, NULL); - pthread_cond_init (&cond, NULL); - } - - ~monitor() - { - pthread_mutex_destroy (&mtx); - pthread_cond_destroy (&cond); - } - - void enter() const - { - lock l(&mtx); - - while (refcnt) - { - l.wait(&cond); - } - refcnt++; - } - - void leave() const - { - lock l(&mtx); - - refcnt--; - if (refcnt == 0) - { - pthread_cond_signal (&cond); - } - } - -private: - - monitor (const monitor&); - monitor& operator= (const monitor&); -}; - -class critical -{ - const monitor& mon; - -public: - - critical(const monitor& m) : mon(m) { mon.enter(); } - - ~critical() { mon.leave(); } - -private: - - critical (const critical&); - critical& operator= (const critical&); -}; -#endif - -} // namespace wsrep - -#endif /* WSREP_UTILS_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_var.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_var.h deleted file mode 100644 index 810ed4f..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_var.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 2013 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */ - -#ifndef WSREP_VAR_H -#define WSREP_VAR_H - -#include - -#ifdef WITH_WSREP - -#define WSREP_CLUSTER_NAME "my_wsrep_cluster" -#define WSREP_NODE_INCOMING_AUTO "AUTO" -#define WSREP_START_POSITION_ZERO "00000000-0000-0000-0000-000000000000:-1" -#define WSREP_START_POSITION_ZERO_GTID "00000000-0000-0000-0000-000000000000:-1,0-0-0" - -// MySQL variables funcs - -#include "sql_priv.h" -#include -#include - -class sys_var; -class set_var; -class THD; - -int wsrep_init_vars(); - -#define CHECK_ARGS (sys_var *self, THD* thd, set_var *var) -#define UPDATE_ARGS (sys_var *self, THD* thd, enum_var_type type) -#define DEFAULT_ARGS (THD* thd, enum_var_type var_type) -#define INIT_ARGS (const char* opt) - -extern bool wsrep_causal_reads_update UPDATE_ARGS; -extern bool wsrep_on_check CHECK_ARGS; -extern bool wsrep_on_update UPDATE_ARGS; -extern bool wsrep_sync_wait_update UPDATE_ARGS; -extern bool wsrep_start_position_check CHECK_ARGS; -extern bool wsrep_start_position_update UPDATE_ARGS; -extern bool wsrep_start_position_init INIT_ARGS; - -extern bool wsrep_provider_check CHECK_ARGS; -extern bool wsrep_provider_update UPDATE_ARGS; -extern void wsrep_provider_init INIT_ARGS; - -extern bool wsrep_provider_options_check CHECK_ARGS; -extern bool wsrep_provider_options_update UPDATE_ARGS; -extern void wsrep_provider_options_init INIT_ARGS; - -extern bool wsrep_cluster_address_check CHECK_ARGS; -extern bool wsrep_cluster_address_update UPDATE_ARGS; -extern void wsrep_cluster_address_init INIT_ARGS; - -extern bool wsrep_cluster_name_check CHECK_ARGS; -extern bool wsrep_cluster_name_update UPDATE_ARGS; - -extern bool wsrep_node_name_check CHECK_ARGS; -extern bool wsrep_node_name_update UPDATE_ARGS; - -extern bool wsrep_node_address_check CHECK_ARGS; -extern bool wsrep_node_address_update UPDATE_ARGS; -extern void wsrep_node_address_init INIT_ARGS; - -extern bool wsrep_sst_method_check CHECK_ARGS; -extern bool wsrep_sst_method_update UPDATE_ARGS; -extern void wsrep_sst_method_init INIT_ARGS; - -extern bool wsrep_sst_receive_address_check CHECK_ARGS; -extern bool wsrep_sst_receive_address_update UPDATE_ARGS; - -extern bool wsrep_sst_auth_check CHECK_ARGS; -extern bool wsrep_sst_auth_update UPDATE_ARGS; - -extern bool wsrep_sst_donor_check CHECK_ARGS; -extern bool wsrep_sst_donor_update UPDATE_ARGS; - -extern bool wsrep_slave_threads_check CHECK_ARGS; -extern bool wsrep_slave_threads_update UPDATE_ARGS; - -extern bool wsrep_desync_check CHECK_ARGS; -extern bool wsrep_desync_update UPDATE_ARGS; - -extern bool wsrep_trx_fragment_size_check CHECK_ARGS; -extern bool wsrep_trx_fragment_size_update UPDATE_ARGS; - -extern bool wsrep_trx_fragment_unit_update UPDATE_ARGS; - -extern bool wsrep_max_ws_size_check CHECK_ARGS; -extern bool wsrep_max_ws_size_update UPDATE_ARGS; - -extern bool wsrep_reject_queries_update UPDATE_ARGS; - -extern bool wsrep_debug_update UPDATE_ARGS; - -extern bool wsrep_gtid_seq_no_check CHECK_ARGS; - -#else /* WITH_WSREP */ - -#define wsrep_provider_init(X) -#define wsrep_init_vars() (0) -#define wsrep_start_position_init(X) - -#endif /* WITH_WSREP */ -#endif /* WSREP_VAR_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_xid.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_xid.h deleted file mode 100644 index 45ba6ff..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/wsrep_xid.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2015 Codership Oy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */ - -#ifndef WSREP_XID_H -#define WSREP_XID_H - -#include - -#ifdef WITH_WSREP - -#include "wsrep_mysqld.h" -#include "wsrep/gtid.hpp" -#include "handler.h" // XID typedef - -void wsrep_xid_init(xid_t*, const wsrep::gtid&, const wsrep_server_gtid_t&); -const wsrep::id& wsrep_xid_uuid(const XID&); -wsrep::seqno wsrep_xid_seqno(const XID&); - -template T wsrep_get_SE_checkpoint(); -bool wsrep_set_SE_checkpoint(const wsrep::gtid& gtid, const wsrep_server_gtid_t&); -//void wsrep_get_SE_checkpoint(XID&); /* uncomment if needed */ -//void wsrep_set_SE_checkpoint(XID&); /* uncomment if needed */ - -void wsrep_sort_xid_array(XID *array, int len); - -#endif /* WITH_WSREP */ -#endif /* WSREP_UTILS_H */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/private/xa.h b/VCMP-LUA/modules/mariadb/include/mysql/server/private/xa.h deleted file mode 100644 index 0b2d069..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/private/xa.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef XA_INCLUDED -#define XA_INCLUDED -/* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -*/ - -class XID_cache_element; -enum xa_states -{ - XA_ACTIVE= 0, - XA_IDLE, - XA_PREPARED, - XA_ROLLBACK_ONLY, - XA_NO_STATE -}; - -struct XID_STATE { - XID_cache_element *xid_cache_element; - - bool check_has_uncommitted_xa() const; - bool is_explicit_XA() const { return xid_cache_element != 0; } - void set_error(uint error); - void er_xaer_rmfail() const; - XID *get_xid() const; - enum xa_states get_state_code() const; -}; - -void xid_cache_init(void); -void xid_cache_free(void); -bool xid_cache_insert(XID *xid); -bool xid_cache_insert(THD *thd, XID_STATE *xid_state, XID *xid); -void xid_cache_delete(THD *thd, XID_STATE *xid_state); - -bool trans_xa_start(THD *thd); -bool trans_xa_end(THD *thd); -bool trans_xa_prepare(THD *thd); -bool trans_xa_commit(THD *thd); -bool trans_xa_rollback(THD *thd); -bool trans_xa_detach(THD *thd); -bool mysql_xa_recover(THD *thd); - -#endif /* XA_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/sql_common.h b/VCMP-LUA/modules/mariadb/include/mysql/server/sql_common.h deleted file mode 100644 index 9836d0c..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/sql_common.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef SQL_COMMON_INCLUDED -#define SQL_COMMON_INCLUDED -/* Copyright (c) 2003, 2018, Oracle and/or its affiliates. - Copyright (c) 2010, 2018, MariaDB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern const char *unknown_sqlstate; -extern const char *cant_connect_sqlstate; -extern const char *not_error_sqlstate; - - -struct mysql_async_context; - -struct st_mysql_options_extention { - char *plugin_dir; - char *default_auth; - char *ssl_crl; /* PEM CRL file */ - char *ssl_crlpath; /* PEM directory of CRL-s? */ - void (*report_progress)(const MYSQL *mysql, - unsigned int stage, - unsigned int max_stage, - double progress, - const char *proc_info, - uint proc_info_length); - struct mysql_async_context *async_context; - HASH connection_attributes; - size_t connection_attributes_length; -}; - -typedef struct st_mysql_methods -{ - my_bool (*read_query_result)(MYSQL *mysql); - my_bool (*advanced_command)(MYSQL *mysql, - enum enum_server_command command, - const unsigned char *header, - unsigned long header_length, - const unsigned char *arg, - unsigned long arg_length, - my_bool skip_check, - MYSQL_STMT *stmt); - MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields, - unsigned int fields); - MYSQL_RES * (*use_result)(MYSQL *mysql); - void (*fetch_lengths)(unsigned long *to, - MYSQL_ROW column, unsigned int field_count); - void (*flush_use_result)(MYSQL *mysql, my_bool flush_all_results); - int (*read_change_user_result)(MYSQL *mysql); -#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) - MYSQL_FIELD * (*list_fields)(MYSQL *mysql); - my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); - int (*stmt_execute)(MYSQL_STMT *stmt); - int (*read_binary_rows)(MYSQL_STMT *stmt); - int (*unbuffered_fetch)(MYSQL *mysql, char **row); - void (*free_embedded_thd)(MYSQL *mysql); - const char *(*read_statistics)(MYSQL *mysql); - my_bool (*next_result)(MYSQL *mysql); - int (*read_rows_from_cursor)(MYSQL_STMT *stmt); -#endif -} MYSQL_METHODS; - -#ifdef LIBMARIADB -#define simple_command(mysql, command, arg, length, skip_check) ma_simple_command(mysql, command, (char *)arg, length, skip_check, NULL) -#else -#define simple_command(mysql, command, arg, length, skip_check) \ - (*(mysql)->methods->advanced_command)(mysql, command, 0, \ - 0, arg, length, skip_check, NULL) -#endif -#define stmt_command(mysql, command, arg, length, stmt) \ - (*(mysql)->methods->advanced_command)(mysql, command, 0, \ - 0, arg, length, 1, stmt) - -extern CHARSET_INFO *default_client_charset_info; -MYSQL_FIELD *unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc, - uint fields, my_bool default_value, - uint server_capabilities); -void free_rows(MYSQL_DATA *cur); -void free_old_query(MYSQL *mysql); -void end_server(MYSQL *mysql); -my_bool mysql_reconnect(MYSQL *mysql); -void mysql_read_default_options(struct st_mysql_options *options, - const char *filename,const char *group); -my_bool -cli_advanced_command(MYSQL *mysql, enum enum_server_command command, - const unsigned char *header, ulong header_length, - const unsigned char *arg, ulong arg_length, - my_bool skip_check, MYSQL_STMT *stmt); -unsigned long cli_safe_read(MYSQL *mysql); -unsigned long cli_safe_read_reallen(MYSQL *mysql, ulong* reallen); -void net_clear_error(NET *net); -void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net); -void set_stmt_error(MYSQL_STMT *stmt, int errcode, const char *sqlstate, - const char *err); -void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate); -void set_mysql_extended_error(MYSQL *mysql, int errcode, const char *sqlstate, - const char *format, ...); - -/* client side of the pluggable authentication */ -struct st_vio; -struct st_plugin_vio_info; -void mpvio_info(struct st_vio *vio, struct st_plugin_vio_info *info); -int run_plugin_auth(MYSQL *mysql, char *data, uint data_len, - const char *data_plugin, const char *db); -int mysql_client_plugin_init(); -void mysql_client_plugin_deinit(); -struct st_mysql_client_plugin; -extern struct st_mysql_client_plugin *mysql_client_builtins[]; -uchar * send_client_connect_attrs(MYSQL *mysql, uchar *buf); - -/* Non-blocking client API. */ -void my_context_install_suspend_resume_hook(struct mysql_async_context *b, - void (*)(my_bool, void *), void *); - -#ifdef __cplusplus -} -#endif - -#define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41) - -#endif /* SQL_COMMON_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/sql_state.h b/VCMP-LUA/modules/mariadb/include/mysql/server/sql_state.h deleted file mode 100644 index d015970..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/sql_state.h +++ /dev/null @@ -1,255 +0,0 @@ -/* Autogenerated file, please don't edit */ - -{ ER_DUP_KEY ,"23000", "" }, -{ ER_OUTOFMEMORY ,"HY001", "S1001" }, -{ ER_OUT_OF_SORTMEMORY ,"HY001", "S1001" }, -{ ER_CON_COUNT_ERROR ,"08004", "" }, -{ ER_BAD_HOST_ERROR ,"08S01", "" }, -{ ER_HANDSHAKE_ERROR ,"08S01", "" }, -{ ER_DBACCESS_DENIED_ERROR ,"42000", "" }, -{ ER_ACCESS_DENIED_ERROR ,"28000", "" }, -{ ER_NO_DB_ERROR ,"3D000", "" }, -{ ER_UNKNOWN_COM_ERROR ,"08S01", "" }, -{ ER_BAD_NULL_ERROR ,"23000", "" }, -{ ER_BAD_DB_ERROR ,"42000", "" }, -{ ER_TABLE_EXISTS_ERROR ,"42S01", "" }, -{ ER_BAD_TABLE_ERROR ,"42S02", "" }, -{ ER_NON_UNIQ_ERROR ,"23000", "" }, -{ ER_SERVER_SHUTDOWN ,"08S01", "" }, -{ ER_BAD_FIELD_ERROR ,"42S22", "S0022" }, -{ ER_WRONG_FIELD_WITH_GROUP ,"42000", "S1009" }, -{ ER_WRONG_GROUP_FIELD ,"42000", "S1009" }, -{ ER_WRONG_SUM_SELECT ,"42000", "S1009" }, -{ ER_WRONG_VALUE_COUNT ,"21S01", "" }, -{ ER_TOO_LONG_IDENT ,"42000", "S1009" }, -{ ER_DUP_FIELDNAME ,"42S21", "S1009" }, -{ ER_DUP_KEYNAME ,"42000", "S1009" }, -{ ER_DUP_ENTRY ,"23000", "S1009" }, -{ ER_WRONG_FIELD_SPEC ,"42000", "S1009" }, -{ ER_PARSE_ERROR ,"42000", "s1009" }, -{ ER_EMPTY_QUERY ,"42000", "" }, -{ ER_NONUNIQ_TABLE ,"42000", "S1009" }, -{ ER_INVALID_DEFAULT ,"42000", "S1009" }, -{ ER_MULTIPLE_PRI_KEY ,"42000", "S1009" }, -{ ER_TOO_MANY_KEYS ,"42000", "S1009" }, -{ ER_TOO_MANY_KEY_PARTS ,"42000", "S1009" }, -{ ER_TOO_LONG_KEY ,"42000", "S1009" }, -{ ER_KEY_COLUMN_DOES_NOT_EXITS ,"42000", "S1009" }, -{ ER_BLOB_USED_AS_KEY ,"42000", "S1009" }, -{ ER_TOO_BIG_FIELDLENGTH ,"42000", "S1009" }, -{ ER_WRONG_AUTO_KEY ,"42000", "S1009" }, -{ ER_FORCING_CLOSE ,"08S01", "" }, -{ ER_IPSOCK_ERROR ,"08S01", "" }, -{ ER_NO_SUCH_INDEX ,"42S12", "S1009" }, -{ ER_WRONG_FIELD_TERMINATORS ,"42000", "S1009" }, -{ ER_BLOBS_AND_NO_TERMINATED ,"42000", "S1009" }, -{ ER_CANT_REMOVE_ALL_FIELDS ,"42000", "" }, -{ ER_CANT_DROP_FIELD_OR_KEY ,"42000", "" }, -{ ER_WRONG_DB_NAME ,"42000", "" }, -{ ER_WRONG_TABLE_NAME ,"42000", "" }, -{ ER_TOO_BIG_SELECT ,"42000", "" }, -{ ER_UNKNOWN_PROCEDURE ,"42000", "" }, -{ ER_WRONG_PARAMCOUNT_TO_PROCEDURE ,"42000", "" }, -{ ER_UNKNOWN_TABLE ,"42S02", "" }, -{ ER_FIELD_SPECIFIED_TWICE ,"42000", "" }, -{ ER_UNSUPPORTED_EXTENSION ,"42000", "" }, -{ ER_TABLE_MUST_HAVE_COLUMNS ,"42000", "" }, -{ ER_UNKNOWN_CHARACTER_SET ,"42000", "" }, -{ ER_TOO_BIG_ROWSIZE ,"42000", "" }, -{ ER_WRONG_OUTER_JOIN ,"42000", "" }, -{ ER_NULL_COLUMN_IN_INDEX ,"42000", "" }, -{ ER_PASSWORD_ANONYMOUS_USER ,"42000", "" }, -{ ER_PASSWORD_NOT_ALLOWED ,"42000", "" }, -{ ER_PASSWORD_NO_MATCH ,"28000", "" }, -{ ER_WRONG_VALUE_COUNT_ON_ROW ,"21S01", "" }, -{ ER_INVALID_USE_OF_NULL ,"22004", "" }, -{ ER_REGEXP_ERROR ,"42000", "" }, -{ ER_MIX_OF_GROUP_FUNC_AND_FIELDS ,"42000", "" }, -{ ER_NONEXISTING_GRANT ,"42000", "" }, -{ ER_TABLEACCESS_DENIED_ERROR ,"42000", "" }, -{ ER_COLUMNACCESS_DENIED_ERROR ,"42000", "" }, -{ ER_ILLEGAL_GRANT_FOR_TABLE ,"42000", "" }, -{ ER_GRANT_WRONG_HOST_OR_USER ,"42000", "" }, -{ ER_NO_SUCH_TABLE ,"42S02", "" }, -{ ER_NONEXISTING_TABLE_GRANT ,"42000", "" }, -{ ER_NOT_ALLOWED_COMMAND ,"42000", "" }, -{ ER_SYNTAX_ERROR ,"42000", "" }, -{ ER_ABORTING_CONNECTION ,"08S01", "" }, -{ ER_NET_PACKET_TOO_LARGE ,"08S01", "" }, -{ ER_NET_READ_ERROR_FROM_PIPE ,"08S01", "" }, -{ ER_NET_FCNTL_ERROR ,"08S01", "" }, -{ ER_NET_PACKETS_OUT_OF_ORDER ,"08S01", "" }, -{ ER_NET_UNCOMPRESS_ERROR ,"08S01", "" }, -{ ER_NET_READ_ERROR ,"08S01", "" }, -{ ER_NET_READ_INTERRUPTED ,"08S01", "" }, -{ ER_NET_ERROR_ON_WRITE ,"08S01", "" }, -{ ER_NET_WRITE_INTERRUPTED ,"08S01", "" }, -{ ER_TOO_LONG_STRING ,"42000", "" }, -{ ER_TABLE_CANT_HANDLE_BLOB ,"42000", "" }, -{ ER_TABLE_CANT_HANDLE_AUTO_INCREMENT ,"42000", "" }, -{ ER_WRONG_COLUMN_NAME ,"42000", "" }, -{ ER_WRONG_KEY_COLUMN ,"42000", "" }, -{ ER_DUP_UNIQUE ,"23000", "" }, -{ ER_BLOB_KEY_WITHOUT_LENGTH ,"42000", "" }, -{ ER_PRIMARY_CANT_HAVE_NULL ,"42000", "" }, -{ ER_TOO_MANY_ROWS ,"42000", "" }, -{ ER_REQUIRES_PRIMARY_KEY ,"42000", "" }, -{ ER_KEY_DOES_NOT_EXISTS ,"42000", "S1009" }, -{ ER_CHECK_NO_SUCH_TABLE ,"42000", "" }, -{ ER_CHECK_NOT_IMPLEMENTED ,"42000", "" }, -{ ER_CANT_DO_THIS_DURING_AN_TRANSACTION ,"25000", "" }, -{ ER_NEW_ABORTING_CONNECTION ,"08S01", "" }, -{ ER_MASTER_NET_READ ,"08S01", "" }, -{ ER_MASTER_NET_WRITE ,"08S01", "" }, -{ ER_TOO_MANY_USER_CONNECTIONS ,"42000", "" }, -{ ER_READ_ONLY_TRANSACTION ,"25000", "" }, -{ ER_NO_PERMISSION_TO_CREATE_USER ,"42000", "" }, -{ ER_LOCK_DEADLOCK ,"40001", "" }, -{ ER_NO_REFERENCED_ROW ,"23000", "" }, -{ ER_ROW_IS_REFERENCED ,"23000", "" }, -{ ER_CONNECT_TO_MASTER ,"08S01", "" }, -{ ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT ,"21000", "" }, -{ ER_USER_LIMIT_REACHED ,"42000", "" }, -{ ER_SPECIFIC_ACCESS_DENIED_ERROR ,"42000", "" }, -{ ER_NO_DEFAULT ,"42000", "" }, -{ ER_WRONG_VALUE_FOR_VAR ,"42000", "" }, -{ ER_WRONG_TYPE_FOR_VAR ,"42000", "" }, -{ ER_CANT_USE_OPTION_HERE ,"42000", "" }, -{ ER_NOT_SUPPORTED_YET ,"42000", "" }, -{ ER_WRONG_FK_DEF ,"42000", "" }, -{ ER_OPERAND_COLUMNS ,"21000", "" }, -{ ER_SUBQUERY_NO_1_ROW ,"21000", "" }, -{ ER_ILLEGAL_REFERENCE ,"42S22", "" }, -{ ER_DERIVED_MUST_HAVE_ALIAS ,"42000", "" }, -{ ER_SELECT_REDUCED ,"01000", "" }, -{ ER_TABLENAME_NOT_ALLOWED_HERE ,"42000", "" }, -{ ER_NOT_SUPPORTED_AUTH_MODE ,"08004", "" }, -{ ER_SPATIAL_CANT_HAVE_NULL ,"42000", "" }, -{ ER_COLLATION_CHARSET_MISMATCH ,"42000", "" }, -{ ER_WARN_TOO_FEW_RECORDS ,"01000", "" }, -{ ER_WARN_TOO_MANY_RECORDS ,"01000", "" }, -{ ER_WARN_NULL_TO_NOTNULL ,"22004", "" }, -{ ER_WARN_DATA_OUT_OF_RANGE ,"22003", "" }, -{ WARN_DATA_TRUNCATED ,"01000", "" }, -{ ER_WRONG_NAME_FOR_INDEX ,"42000", "" }, -{ ER_WRONG_NAME_FOR_CATALOG ,"42000", "" }, -{ ER_UNKNOWN_STORAGE_ENGINE ,"42000", "" }, -{ ER_TRUNCATED_WRONG_VALUE ,"22007", "" }, -{ ER_SP_NO_RECURSIVE_CREATE ,"2F003", "" }, -{ ER_SP_ALREADY_EXISTS ,"42000", "" }, -{ ER_SP_DOES_NOT_EXIST ,"42000", "" }, -{ ER_SP_LILABEL_MISMATCH ,"42000", "" }, -{ ER_SP_LABEL_REDEFINE ,"42000", "" }, -{ ER_SP_LABEL_MISMATCH ,"42000", "" }, -{ ER_SP_UNINIT_VAR ,"01000", "" }, -{ ER_SP_BADSELECT ,"0A000", "" }, -{ ER_SP_BADRETURN ,"42000", "" }, -{ ER_SP_BADSTATEMENT ,"0A000", "" }, -{ ER_UPDATE_LOG_DEPRECATED_IGNORED ,"42000", "" }, -{ ER_UPDATE_LOG_DEPRECATED_TRANSLATED ,"42000", "" }, -{ ER_QUERY_INTERRUPTED ,"70100", "" }, -{ ER_SP_WRONG_NO_OF_ARGS ,"42000", "" }, -{ ER_SP_COND_MISMATCH ,"42000", "" }, -{ ER_SP_NORETURN ,"42000", "" }, -{ ER_SP_NORETURNEND ,"2F005", "" }, -{ ER_SP_BAD_CURSOR_QUERY ,"42000", "" }, -{ ER_SP_BAD_CURSOR_SELECT ,"42000", "" }, -{ ER_SP_CURSOR_MISMATCH ,"42000", "" }, -{ ER_SP_CURSOR_ALREADY_OPEN ,"24000", "" }, -{ ER_SP_CURSOR_NOT_OPEN ,"24000", "" }, -{ ER_SP_UNDECLARED_VAR ,"42000", "" }, -{ ER_SP_FETCH_NO_DATA ,"02000", "" }, -{ ER_SP_DUP_PARAM ,"42000", "" }, -{ ER_SP_DUP_VAR ,"42000", "" }, -{ ER_SP_DUP_COND ,"42000", "" }, -{ ER_SP_DUP_CURS ,"42000", "" }, -{ ER_SP_SUBSELECT_NYI ,"0A000", "" }, -{ ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG ,"0A000", "" }, -{ ER_SP_VARCOND_AFTER_CURSHNDLR ,"42000", "" }, -{ ER_SP_CURSOR_AFTER_HANDLER ,"42000", "" }, -{ ER_SP_CASE_NOT_FOUND ,"20000", "" }, -{ ER_DIVISION_BY_ZERO ,"22012", "" }, -{ ER_TRUNCATED_WRONG_VALUE_FOR_FIELD ,"22007", "" }, -{ ER_ILLEGAL_VALUE_FOR_TYPE ,"22007", "" }, -{ ER_VIEW_CHECK_FAILED ,"44000", "" }, -{ ER_PROCACCESS_DENIED_ERROR ,"42000", "" }, -{ ER_XAER_NOTA ,"XAE04", "" }, -{ ER_XAER_INVAL ,"XAE05", "" }, -{ ER_XAER_RMFAIL ,"XAE07", "" }, -{ ER_XAER_OUTSIDE ,"XAE09", "" }, -{ ER_XAER_RMERR ,"XAE03", "" }, -{ ER_XA_RBROLLBACK ,"XA100", "" }, -{ ER_NONEXISTING_PROC_GRANT ,"42000", "" }, -{ ER_DATA_TOO_LONG ,"22001", "" }, -{ ER_SP_BAD_SQLSTATE ,"42000", "" }, -{ ER_CANT_CREATE_USER_WITH_GRANT ,"42000", "" }, -{ ER_SP_DUP_HANDLER ,"42000", "" }, -{ ER_SP_NOT_VAR_ARG ,"42000", "" }, -{ ER_SP_NO_RETSET ,"0A000", "" }, -{ ER_CANT_CREATE_GEOMETRY_OBJECT ,"22003", "" }, -{ ER_TOO_BIG_SCALE ,"42000", "S1009" }, -{ ER_TOO_BIG_PRECISION ,"42000", "S1009" }, -{ ER_M_BIGGER_THAN_D ,"42000", "S1009" }, -{ ER_TOO_LONG_BODY ,"42000", "S1009" }, -{ ER_TOO_BIG_DISPLAYWIDTH ,"42000", "S1009" }, -{ ER_XAER_DUPID ,"XAE08", "" }, -{ ER_DATETIME_FUNCTION_OVERFLOW ,"22008", "" }, -{ ER_MALFORMED_DEFINER ,"0L000", "" }, -{ ER_ROW_IS_REFERENCED_2 ,"23000", "" }, -{ ER_NO_REFERENCED_ROW_2 ,"23000", "" }, -{ ER_SP_BAD_VAR_SHADOW ,"42000", "" }, -{ ER_SP_WRONG_NAME ,"42000", "" }, -{ ER_SP_NO_AGGREGATE ,"42000", "" }, -{ ER_MAX_PREPARED_STMT_COUNT_REACHED ,"42000", "" }, -{ ER_NON_GROUPING_FIELD_USED ,"42000", "" }, -{ ER_CANT_CHANGE_TX_CHARACTERISTICS ,"25001", "" }, -{ ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT ,"42000", "" }, -{ ER_WRONG_PARAMETERS_TO_NATIVE_FCT ,"42000", "" }, -{ ER_WRONG_PARAMETERS_TO_STORED_FCT ,"42000", "" }, -{ ER_DUP_ENTRY_WITH_KEY_NAME ,"23000", "S1009" }, -{ ER_XA_RBTIMEOUT ,"XA106", "" }, -{ ER_XA_RBDEADLOCK ,"XA102", "" }, -{ ER_FUNC_INEXISTENT_NAME_COLLISION ,"42000", "" }, -{ ER_DUP_SIGNAL_SET ,"42000", "" }, -{ ER_SIGNAL_WARN ,"01000", "" }, -{ ER_SIGNAL_NOT_FOUND ,"02000", "" }, -{ ER_SIGNAL_EXCEPTION ,"HY000", "" }, -{ ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER ,"0K000", "" }, -{ ER_SPATIAL_MUST_HAVE_GEOM_COL ,"42000", "" }, -{ ER_DATA_OUT_OF_RANGE ,"22003", "" }, -{ ER_ACCESS_DENIED_NO_PASSWORD_ERROR ,"28000", "" }, -{ ER_TRUNCATE_ILLEGAL_FK ,"42000", "" }, -{ ER_DA_INVALID_CONDITION_NUMBER ,"35000", "" }, -{ ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO,"23000", "S1009" }, -{ ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO,"23000", "S1009" }, -{ ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION,"25006", "" }, -{ ER_ALTER_OPERATION_NOT_SUPPORTED ,"0A000", "" }, -{ ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ,"0A000", "" }, -{ ER_DUP_UNKNOWN_IN_INDEX ,"23000", "" }, -{ ER_ACCESS_DENIED_CHANGE_USER_ERROR ,"28000", "" }, -{ ER_DATA_OVERFLOW ,"22003", "" }, -{ ER_DATA_TRUNCATED ,"22003", "" }, -{ ER_BAD_DATA ,"22007", "" }, -{ ER_DYN_COL_DATA ,"22007", "" }, -{ ER_CONNECTION_KILLED ,"70100", "" }, -{ ER_NO_SUCH_TABLE_IN_ENGINE ,"42S02", "" }, -{ ER_INVALID_ROLE ,"OP000", "" }, -{ ER_INVALID_CURRENT_USER ,"0L000", "" }, -{ ER_IT_IS_A_VIEW ,"42S02", "" }, -{ ER_STATEMENT_TIMEOUT ,"70100", "" }, -{ ER_SUBQUERIES_NOT_SUPPORTED ,"42000", "" }, -{ ER_SET_STATEMENT_NOT_SUPPORTED ,"42000", "" }, -{ ER_INVALID_DEFAULT_VALUE_FOR_FIELD ,"22007", "" }, -{ ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER,"0Z002", "" }, -{ ER_INVALID_ARGUMENT_FOR_LOGARITHM ,"2201E", "" }, -{ ER_GIS_INVALID_DATA ,"22023", "" }, -{ ER_USER_LOCK_WRONG_NAME ,"42000", "" }, -{ ER_COMMULTI_BADCONTEXT ,"0A000", "" }, -{ ER_CONSTRAINT_FAILED ,"23000", "" }, -{ ER_EXPRESSION_REFERS_TO_UNINIT_FIELD ,"01000", "" }, -{ ER_WRONG_PARAMCOUNT_TO_CURSOR ,"42000", "" }, -{ ER_NOT_SEQUENCE ,"42S02", "" }, -{ ER_NOT_SEQUENCE2 ,"42S02", "" }, -{ ER_UNKNOWN_SEQUENCES ,"42S02", "" }, -{ ER_UNKNOWN_VIEW ,"42S02", "" }, -{ ER_TOO_LONG_KEYPART ,"42000", "S1009" }, diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/sslopt-case.h b/VCMP-LUA/modules/mariadb/include/mysql/server/sslopt-case.h deleted file mode 100644 index 72881a2..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/sslopt-case.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef SSLOPT_CASE_INCLUDED -#define SSLOPT_CASE_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) - case OPT_SSL_KEY: - case OPT_SSL_CERT: - case OPT_SSL_CA: - case OPT_SSL_CAPATH: - case OPT_SSL_CIPHER: - case OPT_SSL_CRL: - case OPT_SSL_CRLPATH: - /* - Enable use of SSL if we are using any ssl option - One can disable SSL later by using --skip-ssl or --ssl=0 - */ - opt_use_ssl= 1; -#if defined (HAVE_WOLFSSL) && (!defined (_WIN32) || defined (MYSQL_SERVER)) - /* CRL does not work with WolfSSL */ - opt_ssl_crl= NULL; - opt_ssl_crlpath= NULL; -#endif - break; -#endif -#endif /* SSLOPT_CASE_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/sslopt-longopts.h b/VCMP-LUA/modules/mariadb/include/mysql/server/sslopt-longopts.h deleted file mode 100644 index d0278a1..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/sslopt-longopts.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef SSLOPT_LONGOPTS_INCLUDED -#define SSLOPT_LONGOPTS_INCLUDED - -/* - Copyright (c) 2000, 2010, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) - - {"ssl", OPT_SSL_SSL, - "Enable SSL for connection (automatically enabled with other flags).", - &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"ssl-ca", OPT_SSL_CA, - "CA file in PEM format (check OpenSSL docs, implies --ssl).", - &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - {"ssl-capath", OPT_SSL_CAPATH, - "CA directory (check OpenSSL docs, implies --ssl).", - &opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).", - &opt_ssl_cert, &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - {"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).", - &opt_ssl_cipher, &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).", - &opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - {"ssl-crl", OPT_SSL_KEY, "Certificate revocation list (implies --ssl).", - &opt_ssl_crl, &opt_ssl_crl, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - {"ssl-crlpath", OPT_SSL_KEY, - "Certificate revocation list path (implies --ssl).", - &opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - {"tls-version", OPT_TLS_VERSION, - "TLS protocol version for secure connection.", - &opt_tls_version, &opt_tls_version, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - -#ifdef MYSQL_CLIENT - {"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT, - "Verify server's \"Common Name\" in its cert against hostname used " - "when connecting. This option is disabled by default.", - &opt_ssl_verify_server_cert, &opt_ssl_verify_server_cert, - 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#endif -#endif /* HAVE_OPENSSL */ -#endif /* SSLOPT_LONGOPTS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/sslopt-vars.h b/VCMP-LUA/modules/mariadb/include/mysql/server/sslopt-vars.h deleted file mode 100644 index e28f19b..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/sslopt-vars.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef SSLOPT_VARS_INCLUDED -#define SSLOPT_VARS_INCLUDED - -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) -#ifdef SSL_VARS_NOT_STATIC -#define SSL_STATIC -#else -#define SSL_STATIC static -#endif -SSL_STATIC my_bool opt_use_ssl = 0; -SSL_STATIC char *opt_ssl_ca = 0; -SSL_STATIC char *opt_ssl_capath = 0; -SSL_STATIC char *opt_ssl_cert = 0; -SSL_STATIC char *opt_ssl_cipher = 0; -SSL_STATIC char *opt_ssl_key = 0; -SSL_STATIC char *opt_ssl_crl = 0; -SSL_STATIC char *opt_ssl_crlpath = 0; -SSL_STATIC char *opt_tls_version = 0; -#ifdef MYSQL_CLIENT -SSL_STATIC my_bool opt_ssl_verify_server_cert= 0; -#endif -#endif -#endif /* SSLOPT_VARS_INCLUDED */ diff --git a/VCMP-LUA/modules/mariadb/include/mysql/server/typelib.h b/VCMP-LUA/modules/mariadb/include/mysql/server/typelib.h deleted file mode 100644 index 23df737..0000000 --- a/VCMP-LUA/modules/mariadb/include/mysql/server/typelib.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - - -#ifndef _typelib_h -#define _typelib_h - -#include "my_alloc.h" - -typedef struct st_typelib { /* Different types saved here */ - unsigned int count; /* How many types */ - const char *name; /* Name of typelib */ - const char **type_names; - unsigned int *type_lengths; -} TYPELIB; - -extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); -extern int find_type_with_warning(const char *x, TYPELIB *typelib, - const char *option); -#define FIND_TYPE_BASIC 0 -/** makes @c find_type() require the whole name, no prefix */ -#define FIND_TYPE_NO_PREFIX (1U << 0) -/** always implicitly on, so unused, but old code may pass it */ -#define FIND_TYPE_NO_OVERWRITE 0 -/** makes @c find_type() accept a number. Not used either */ -#define FIND_TYPE_ALLOW_NUMBER 0 -/** makes @c find_type() treat ',' and '=' as terminators */ -#define FIND_TYPE_COMMA_TERM (1U << 3) - -extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); -extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); -extern const char *get_type(TYPELIB *typelib,unsigned int nr); -extern TYPELIB *copy_typelib(MEM_ROOT *root, const TYPELIB *from); - -extern TYPELIB sql_protocol_typelib; - -my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name, - my_ulonglong cur_set, my_ulonglong default_set, - const char *str, unsigned int length, - char **err_pos, unsigned int *err_len); - -#endif /* _typelib_h */ diff --git a/VCMP-LUA/modules/mariadb/lib/libcrypto_static.lib b/VCMP-LUA/modules/mariadb/lib/libcrypto_static.lib deleted file mode 100644 index c68231a..0000000 Binary files a/VCMP-LUA/modules/mariadb/lib/libcrypto_static.lib and /dev/null differ diff --git a/VCMP-LUA/modules/mariadb/lib/libmariadbclient.a b/VCMP-LUA/modules/mariadb/lib/libmariadbclient.a deleted file mode 100644 index 6edfa9c..0000000 Binary files a/VCMP-LUA/modules/mariadb/lib/libmariadbclient.a and /dev/null differ diff --git a/VCMP-LUA/modules/mariadb/lib/libmariadbclient32.a b/VCMP-LUA/modules/mariadb/lib/libmariadbclient32.a deleted file mode 100644 index 376b5ee..0000000 Binary files a/VCMP-LUA/modules/mariadb/lib/libmariadbclient32.a and /dev/null differ diff --git a/VCMP-LUA/modules/mariadb/lib/libssl_static.lib b/VCMP-LUA/modules/mariadb/lib/libssl_static.lib deleted file mode 100644 index 0db37e8..0000000 Binary files a/VCMP-LUA/modules/mariadb/lib/libssl_static.lib and /dev/null differ diff --git a/VCMP-LUA/modules/mariadb/lib/mysqlclient.lib b/VCMP-LUA/modules/mariadb/lib/mysqlclient.lib deleted file mode 100644 index 776e460..0000000 Binary files a/VCMP-LUA/modules/mariadb/lib/mysqlclient.lib and /dev/null differ diff --git a/VCMP-LUA/modules/mariadb/premake5.lua b/VCMP-LUA/modules/mariadb/premake5.lua deleted file mode 100644 index fe54923..0000000 --- a/VCMP-LUA/modules/mariadb/premake5.lua +++ /dev/null @@ -1,31 +0,0 @@ -files -{ - "include/**.hpp", - "include/**.h", - "src/**.hpp", - "**.cpp" -} - -includedirs -{ - "include", - "include/mysql", -} - -filter {"system:windows"} - libdirs { "lib" } - --- filter {"system:windows", "Release32"} --- links { "MariaDBClient32.lib" } - -filter {"system:windows", "Release"} - -- MySQL cancer crap keeps depending on dynamic libssl and libcrypto so even though I link with the static versions, it first looks for the DLLs causing an Error 126 /facepalm - links { "mysqlclient.lib" } - -filter {"system:not windows", "Release32"} - linkoptions { "-L modules/mariadb/lib/mariadbclient32.a" } - -filter {"system:not windows", "Release"} - linkoptions { "-L modules/mariadb/lib/mariadbclient.a" } - -filter {} \ No newline at end of file diff --git a/VCMP-LUA/modules/mariadb/src/account.cpp b/VCMP-LUA/modules/mariadb/src/account.cpp deleted file mode 100644 index d64ca1a..0000000 --- a/VCMP-LUA/modules/mariadb/src/account.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include - -using namespace mariadb; - -account::account(const std::string &host_name, const std::string &user_name, - const std::string &password, const std::string &schema, u32 port, - const std::string &unix_socket) - : m_auto_commit(true), - m_port(port), - m_host_name(host_name), - m_user_name(user_name), - m_password(password), - m_schema(schema), - m_unix_socket(unix_socket) {} - -const std::string &account::host_name() const { return m_host_name; } - -const std::string &account::user_name() const { return m_user_name; } - -const std::string &account::password() const { return m_password; } - -const std::string &account::unix_socket() const { return m_unix_socket; } - -u32 account::port() const { return m_port; } - -const std::string &account::ssl_key() const { return m_ssl_key; } - -const std::string &account::ssl_certificate() const { return m_ssl_certificate; } - -const std::string &account::ssl_ca() const { return m_ssl_ca; } - -const std::string &account::ssl_ca_path() const { return m_ssl_ca_path; } - -const std::string &account::ssl_cipher() const { return m_ssl_cipher; } - -const std::string &account::schema() const { return m_schema; } - -void account::set_schema(const std::string &schema) { m_schema = schema; } - -void account::set_ssl(const std::string &key, const std::string &certificate, const std::string &ca, - const std::string &ca_path, const std::string &cipher) { - m_ssl_key = key; - m_ssl_certificate = certificate; - m_ssl_ca = ca; - m_ssl_ca_path = ca_path; - m_ssl_cipher = cipher; -} - -bool account::auto_commit() const { return m_auto_commit; } - -void account::set_auto_commit(bool auto_commit) { m_auto_commit = auto_commit; } - -bool account::store_result() const { return m_store_result; } - -void account::set_store_result(bool store_result) { m_store_result = store_result; } - -const account::map_options_t &account::options() const { return m_options; } - -const std::string account::option(const std::string &name) const { - const map_options_t::const_iterator value = m_options.find(name); - - // return option value if found - return value == m_options.end() ? "" : value->second; -} - -void account::set_option(const std::string &name, const std::string &value) { - m_options[name] = value; -} - -void account::clear_options() { m_options.clear(); } - -const account::map_connect_options_t &account::connect_options() const { return m_connect_options; } - -void account::clear_connect_options() { m_connect_options.clear(); } - -void account::set_connect_option(mysql_option option, bool arg) { - m_connect_options[option] = std::unique_ptr(new option_arg_bool(arg)); -} - -void account::set_connect_option(mysql_option option, int arg) { - m_connect_options[option] = std::unique_ptr(new option_arg_int(arg)); -} - -void account::set_connect_option(mysql_option option, const std::string &arg) { - m_connect_options[option] = std::unique_ptr(new option_arg_string(arg)); -} - - -account_ref account::create(const std::string &host_name, const std::string &user_name, - const std::string &password, const std::string &schema, u32 port, - const std::string &unix_socket) { - return account_ref(new account(host_name, user_name, password, schema, port, unix_socket)); -} diff --git a/VCMP-LUA/modules/mariadb/src/bind.cpp b/VCMP-LUA/modules/mariadb/src/bind.cpp deleted file mode 100644 index ccaa632..0000000 --- a/VCMP-LUA/modules/mariadb/src/bind.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include - -using namespace mariadb; - -bind::bind(MYSQL_BIND* b) : m_bind(b), m_is_null(0), m_error(0) { - // clear bind - memset(b, 0, sizeof(MYSQL_BIND)); - - // set default data - m_bind->buffer = &m_unsigned64; - m_bind->buffer_length = 0; - m_bind->buffer_type = MYSQL_TYPE_NULL; - m_bind->is_null = &m_is_null; - m_bind->error = &m_error; - m_bind->length = &m_bind->buffer_length; -} - -bind::bind(MYSQL_BIND* b, MYSQL_FIELD* f) : bind(b) { - set(f->type, nullptr, f->max_length, (f->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG); -} - -char* bind::buffer() const { - if (m_data) return m_data->get(); - - return const_cast(reinterpret_cast(&m_unsigned64)); -} - -unsigned long bind::length() const { return m_bind->buffer_length; } - -bool bind::is_null() const { return (m_is_null != 0); } - -void bind::set(enum_field_types type, const char* buffer, unsigned long length, bool us) { - m_bind->buffer_type = type; - m_bind->is_unsigned = us ? 1 : 0; - - switch (type) { - case MYSQL_TYPE_NULL: - m_bind->buffer_length = 1; - break; - - case MYSQL_TYPE_TINY: - case MYSQL_TYPE_BIT: - m_bind->buffer_length = 1; - break; - - case MYSQL_TYPE_YEAR: - case MYSQL_TYPE_SHORT: - m_bind->buffer_length = sizeof(s16); - break; - - case MYSQL_TYPE_INT24: - case MYSQL_TYPE_LONG: - m_bind->buffer_length = sizeof(s32); - break; - - case MYSQL_TYPE_LONGLONG: - m_bind->buffer_length = sizeof(s64); - break; - - case MYSQL_TYPE_FLOAT: - m_bind->buffer_length = sizeof(f32); - break; - - case MYSQL_TYPE_DOUBLE: - m_bind->buffer_length = sizeof(f64); - break; - - case MYSQL_TYPE_NEWDATE: - case MYSQL_TYPE_DATE: - case MYSQL_TYPE_TIME: - case MYSQL_TYPE_TIMESTAMP: - case MYSQL_TYPE_DATETIME: - m_bind->buffer = &m_time; - m_bind->buffer_length = sizeof(MYSQL_TIME); - break; - - default: - case MYSQL_TYPE_DECIMAL: - case MYSQL_TYPE_NEWDECIMAL: - case MYSQL_TYPE_TINY_BLOB: - case MYSQL_TYPE_MEDIUM_BLOB: - case MYSQL_TYPE_LONG_BLOB: - case MYSQL_TYPE_BLOB: - case MYSQL_TYPE_ENUM: - case MYSQL_TYPE_VARCHAR: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_STRING: - m_data = data_ref(new data(length)); - m_bind->buffer = m_data->get(); - m_bind->buffer_length = m_data->size(); - - if (buffer) memcpy(m_bind->buffer, buffer, length); - break; - } -} \ No newline at end of file diff --git a/VCMP-LUA/modules/mariadb/src/concurrency.cpp b/VCMP-LUA/modules/mariadb/src/concurrency.cpp deleted file mode 100644 index 3c3881d..0000000 --- a/VCMP-LUA/modules/mariadb/src/concurrency.cpp +++ /dev/null @@ -1,205 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include - -#include -#include -#include - -#define LOCK_MUTEX() std::lock_guard lock(g_mutex) - -#include "worker.hpp" -#include "private.hpp" - -using namespace mariadb; -using namespace mariadb::concurrency; - -namespace { -handle g_next_handle(0); -account_ref g_account; -std::mutex g_mutex; -std::vector g_querys_in; -std::map g_querys_out; -bool g_thread_running(false); - -typedef std::map map_t; - -// -// Worker thread -// -void worker_thread() { - g_thread_running = true; - - mysql_thread_init(); - - // breaking in infinite loop because checking g_querys_in would result in a race condition - while (true) { - worker* w = NULL; - { - LOCK_MUTEX(); - auto possible_w = g_querys_in.begin(); - if (possible_w == g_querys_in.end()) break; - - w = *possible_w; - g_querys_in.erase(possible_w); - } - - w->execute(); - - if (!w->keep_handle()) delete w; - } - - g_thread_running = false; - mysql_thread_end(); -} - -// -// Start thread if no thread is running -// -void start_thread() { - if (!g_thread_running) { - std::thread t(worker_thread); - t.detach(); - } -} - -// -// Get worker from handle -// -const worker& get_worker(handle h) { - LOCK_MUTEX(); - const map_t::const_iterator w = g_querys_out.find(h); - - if (w != g_querys_out.end()) return *w->second; - - static worker removed; - return removed; -} - -// -// Add / remove a new query / command to the thread -// -handle add(const std::string& query, command::type command, bool keep_handle) { - LOCK_MUTEX(); - worker* w = new worker(g_account, ++g_next_handle, keep_handle, command, query); - g_querys_in.push_back(w); - - if (keep_handle) g_querys_out[g_next_handle] = w; - - start_thread(); - - return g_next_handle; -} - -handle add(statement_ref& statement, command::type command, bool keep_handle) { - LOCK_MUTEX(); - worker* w = new worker(g_account, ++g_next_handle, keep_handle, command, statement); - g_querys_in.push_back(w); - - if (keep_handle) g_querys_out[g_next_handle] = w; - - start_thread(); - - return g_next_handle; -} -} - -// -// Set account for connection -// -void concurrency::set_account(account_ref& account) { g_account = account; } - -// -// Query status -// -status::type concurrency::worker_status(handle h) { - const worker& w = get_worker(h); - return w.status(); -} - -// -// Query executed, result ready to be used -// -u64 concurrency::get_execute_result(handle h) { - const worker& w = get_worker(h); - return w.status() == status::removed ? 0 : w.result(); -} - -u64 concurrency::get_insert_result(handle h) { - const worker& w = get_worker(h); - return w.status() == status::removed ? 0 : w.result(); -} - -result_set_ref concurrency::get_query_result(handle h) { - const worker& w = get_worker(h); - return w.status() == status::removed ? result_set_ref() : w.result_set(); -} - -// -// Execute a query -// -handle concurrency::execute(const std::string& query, bool keep_handle) { - return add(query, command::execute, keep_handle); -} - -handle concurrency::insert(const std::string& query, bool keep_handle) { - return add(query, command::insert, keep_handle); -} - -handle concurrency::query(const std::string& query, bool keep_handle) { - return add(query, command::query, keep_handle); -} - -// -// Execute a query using a statement -// -statement_ref concurrency::create_statement(const std::string& query) { - connection_ref connection = connection::create(g_account); - statement_ref statement = connection->create_statement(query); - statement->set_connection(connection); - return statement; -} - -handle concurrency::execute(statement_ref& statement, bool keep_handle) { - return add(statement, command::execute, keep_handle); -} - -handle concurrency::insert(statement_ref& statement, bool keep_handle) { - return add(statement, command::insert, keep_handle); -} - -handle concurrency::query(statement_ref& statement, bool keep_handle) { - return add(statement, command::query, keep_handle); -} - -// -// Remove a query -// -// Please note, if a result_set is used, it must be done after the result_set is used... -// -void concurrency::release_handle(handle h) { - LOCK_MUTEX(); - map_t::iterator w = g_querys_out.find(h); - - if (w == g_querys_out.end()) return; - - delete w->second; - g_querys_out.erase(w); -} - -bool concurrency::wait_handle(handle h, u64 wait_time_ms) { - while (worker_status(h) < status::succeed) { - std::this_thread::sleep_for(std::chrono::milliseconds(wait_time_ms)); - } - - return worker_status(h) == status::succeed; -} diff --git a/VCMP-LUA/modules/mariadb/src/connection.cpp b/VCMP-LUA/modules/mariadb/src/connection.cpp deleted file mode 100644 index 024e807..0000000 --- a/VCMP-LUA/modules/mariadb/src/connection.cpp +++ /dev/null @@ -1,200 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include "private.hpp" - -using namespace mariadb; - -#define MYSQL_ERROR_DISCONNECT(mysql) \ - { \ - m_last_error_no = mysql_errno(mysql); \ - m_last_error = mysql_error(mysql); \ - disconnect(); \ - MARIADB_ERROR(m_last_error_no, m_last_error); \ - } - -connection::connection(const account_ref& account) - : m_mysql(NULL), m_auto_commit(true), m_account(account) {} - -connection_ref connection::create(const account_ref& account) { - return connection_ref(new connection(account)); -} - -connection::~connection() { disconnect(); } - -const std::string& connection::schema() const { return m_schema; } - -bool connection::set_schema(const std::string& schema) { - if (!connect()) return false; - - if (mysql_select_db(m_mysql, schema.c_str())) MYSQL_ERROR(m_mysql); - - m_schema = schema; - return true; -} - -const std::string& connection::charset() const { return m_charset; } - -bool connection::set_charset(const std::string& value) { - if (!connect()) return false; - - if (mysql_set_character_set(m_mysql, value.c_str())) MYSQL_ERROR(m_mysql); - - m_charset = value; - return true; -} - -bool connection::connected() const { - if (m_mysql == nullptr) - return false; - else - return !mysql_ping(m_mysql); -} - -account_ref connection::account() const { return m_account; } - -bool connection::auto_commit() const { return m_auto_commit; } - -bool connection::set_auto_commit(bool auto_commit) { - if (m_auto_commit == auto_commit) return true; - - if (!connect()) return false; - - if (mysql_autocommit(m_mysql, auto_commit)) MYSQL_ERROR(m_mysql); - - m_auto_commit = auto_commit; - return true; -} - -bool connection::connect() { - if (connected()) return true; - - if (m_mysql == nullptr) { - m_mysql = mysql_init(nullptr); - - if (!m_mysql) { - MARIADB_ERROR(0, "Cannot create MYSQL object."); - } - } - - if (!m_account->ssl_key().empty()) { - if (mysql_ssl_set(m_mysql, m_account->ssl_key().c_str(), - m_account->ssl_certificate().c_str(), m_account->ssl_ca().c_str(), - m_account->ssl_ca_path().c_str(), m_account->ssl_cipher().c_str())) - MYSQL_ERROR(m_mysql); - } - - // - // set connect options - // - for (auto& pair : m_account->connect_options()) { - if (0 != mysql_options(m_mysql, pair.first, pair.second->value())) - MYSQL_ERROR_DISCONNECT(m_mysql); - } - - if (!mysql_real_connect( - m_mysql, m_account->host_name().c_str(), m_account->user_name().c_str(), - m_account->password().c_str(), nullptr, m_account->port(), - m_account->unix_socket().empty() ? nullptr : m_account->unix_socket().c_str(), - CLIENT_MULTI_STATEMENTS)) - MYSQL_ERROR(m_mysql); - - if (!set_auto_commit(m_account->auto_commit())) MYSQL_ERROR_DISCONNECT(m_mysql); - - if (!m_account->schema().empty()) { - if (!set_schema(m_account->schema().c_str())) MYSQL_ERROR_DISCONNECT(m_mysql); - } - - // - // Set options - // - for (auto& pair : m_account->options()) { - if (1 != execute("SET OPTION " + pair.first + "=" + pair.second)) - MYSQL_ERROR_DISCONNECT(m_mysql); - } - - return true; -} - -void connection::disconnect() { - if (!m_mysql) return; - - mysql_close(m_mysql); - mysql_thread_end(); // mysql_init() call mysql_thread_init therefor it needed to clear memory - // when closed msql handle - m_mysql = nullptr; -} - -result_set_ref connection::query(const std::string& query) { - result_set_ref rs; - - if (!connect()) return rs; - - if (mysql_real_query(m_mysql, query.c_str(), query.size())) { - MYSQL_ERROR_NO_BRAKET(m_mysql); - } - - rs.reset(new result_set(this)); - return rs; -} - -u64 connection::execute(const std::string& query) { - if (!connect()) return 0; - - u64 affected_rows = 0; - - if (mysql_real_query(m_mysql, query.c_str(), query.size())) { - MYSQL_ERROR_NO_BRAKET(m_mysql); - } - - int status; - do { - MYSQL_RES* result = mysql_store_result(m_mysql); - - if (result) - mysql_free_result(result); - else if (mysql_field_count(m_mysql) == 0) - affected_rows += mysql_affected_rows(m_mysql); - else { - MYSQL_ERROR_NO_BRAKET(m_mysql); - } - - status = mysql_next_result(m_mysql); - if (status > 0) { - MYSQL_ERROR_NO_BRAKET(m_mysql); - } - } while (status == 0); - - return affected_rows; -} - -u64 connection::insert(const std::string& query) { - if (!connect()) return 0; - - if (mysql_real_query(m_mysql, query.c_str(), query.size())) { - MYSQL_ERROR_NO_BRAKET(m_mysql); - } - - return mysql_insert_id(m_mysql); -} - -statement_ref connection::create_statement(const std::string& query) { - if (!connect()) return statement_ref(); - - return statement_ref(new statement(this, query)); -} - -transaction_ref connection::create_transaction(isolation::level level, bool consistent_snapshot) { - if (!connect()) return transaction_ref(); - - return transaction_ref(new transaction(this, level, consistent_snapshot)); -} diff --git a/VCMP-LUA/modules/mariadb/src/date_time.cpp b/VCMP-LUA/modules/mariadb/src/date_time.cpp deleted file mode 100644 index c4e1c3a..0000000 --- a/VCMP-LUA/modules/mariadb/src/date_time.cpp +++ /dev/null @@ -1,590 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2020. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include -#include -#include -#include -#include -#include "private.hpp" - -using namespace mariadb; - -namespace { -const u8 g_month_lengths[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; -} - -#define MS_PER_SEC 1000 -#define MS_PER_MIN (MS_PER_SEC * 60) -#define MS_PER_HOUR (MS_PER_MIN * 60) -#define MS_PER_DAY (MS_PER_HOUR * 24) - -date_time::date_time(u16 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond) : time() { - set(year, month, day, hour, minute, second, millisecond); -} - -date_time::date_time(const date_time& dt) : time() { - set(dt.year(), dt.month(), dt.day(), dt.hour(), dt.minute(), dt.second(), dt.millisecond()); -} - -date_time::date_time(const time& t) : time() { - set(1900, 1, 1, t.hour(), t.minute(), t.second(), t.millisecond()); -} - -date_time::date_time(const tm& t) : time() { - set(t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, 0); -} - -date_time::date_time(const time_t& time) : mariadb::time() { - tm t; - localtime_safe(&t, &time); - - set(t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, 0); -} - -date_time::date_time(const MYSQL_TIME& t) : time() { - set(t.year, t.month, t.day, t.hour, t.minute, t.second, t.second_part / 1000); -} - -date_time::date_time(const std::string& dt) : time() { set(dt); } - -int date_time::compare(const date_time& dt) const { - if (year() < dt.year()) return -1; - - if (year() > dt.year()) return 1; - - if (month() < dt.month()) return -1; - - if (month() > dt.month()) return 1; - - if (day() < dt.day()) return -1; - - if (day() > dt.day()) return 1; - - return time::compare(dt); -} - -date_time& date_time::operator=(const date_time& dt) { - set(dt.year(), dt.month(), dt.day(), dt.hour(), dt.minute(), dt.second(), dt.millisecond()); - return *this; -} - -bool date_time::operator==(const date_time& dt) const { return compare(dt) == 0; } - -bool date_time::operator!=(const date_time& dt) const { return compare(dt) != 0; } - -bool date_time::operator<(const date_time& dt) const { return compare(dt) < 0; } - -bool date_time::operator<=(const date_time& dt) const { return compare(dt) <= 0; } - -bool date_time::operator>(const date_time& dt) const { return compare(dt) > 0; } - -bool date_time::operator>=(const date_time& dt) const { return compare(dt) >= 0; } - -bool date_time::set(u16 year, u8 month, u8 day) { - m_year = year; - m_month = month; - m_day = day; - return true; -} - -bool date_time::set(u16 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond) { - m_year = year; - m_month = month; - m_day = day; - - return time::set(hour, minute, second, millisecond); -} - -u16 date_time::year() const { return m_year; } - -u16 date_time::year(u16 year) { - if (year == 0) - MARIADB_ERROR_THROW_DATE(year, month(), day(), hour(), minute(), second(), millisecond()); - - m_year = year; - - if (!valid_date(year, month(), day())) { - m_month = 1; - m_day = 1; - } - - return m_year; -} - -u8 date_time::month() const { return m_month; } - -u8 date_time::month(u8 month) { - if (month == 0 || month > 12) - MARIADB_ERROR_THROW_DATE(year(), month, day(), hour(), minute(), second(), millisecond()); - - m_month = month; - - u8 days_inmonth = days_in_month(year(), month); - - if (day() > days_inmonth) m_day = 1; - - return m_month; -} - -u8 date_time::day() const { return m_day; } - -u8 date_time::day(u8 day) { - u8 days_inmonth = days_in_month(year(), month()); - - if (day == 0 || day > days_inmonth) - MARIADB_ERROR_THROW_DATE(year(), month(), day, hour(), minute(), second(), millisecond()); - - m_day = day; - - return m_day; -} - -u16 date_time::day_of_year() const { return day_of_year(year(), month(), day()); } - -u16 date_time::day_of_year(u16 day_of_year) { - date_time new_date = reverse_day_of_year(year(), day_of_year); - - month(new_date.month()); - day(new_date.day()); - - return day_of_year; -} - -date_time date_time::add_years(s32 years) const { - date_time tmp = *this; - - if (!years) return tmp; - - tmp.year(m_year + years); - return tmp; -} - -date_time date_time::add_months(s32 months) const { - date_time tmp = *this; - - if (!months) return tmp; - - s32 years = months / 12; - - months = (months % 12) + month(); - - if (months >= 12) { - ++years; - months %= 12; - } else if (months < 0) { - --years; - months = 12 - months; - } - - if (years) tmp = tmp.add_years(years); - - tmp.month(months); - return tmp; -} - -date_time date_time::add_days(s32 days) const { - date_time tmp = *this; - - if (!days) return tmp; - - s32 dir = days > 0 ? 1 : -1; - u16 y = year(); - s32 days_in = days_in_year(y); - s32 day_of = day_of_year() + days; - - while (day_of > days_in || day_of < 0) { - day_of -= days_in * dir; - y += dir; - days_in = days_in_year(y); - } - - tmp.year(y); - tmp.day_of_year(day_of); - return tmp; -} - -date_time date_time::add_hours(s32 hours) const { - date_time tmp = *this; - - if (!hours) return tmp; - - s32 days = hours / 24; - - hours = (hours % 24) + hour(); - - if (hours >= 24) { - ++days; - hours %= 24; - } else if (hours < 0) { - --days; - hours = 24 - hours; - } - - if (days) tmp = tmp.add_days(days); - - tmp.hour(hours); - return tmp; -} - -date_time date_time::add_minutes(s32 minutes) const { - date_time tmp = *this; - - if (!minutes) return tmp; - - s32 hours = minutes / 60; - - minutes = (minutes % 60) + minute(); - - if (minutes >= 60) { - ++hours; - minutes %= 60; - } else if (minutes < 0) { - --hours; - minutes = 60 - minutes; - } - - if (hours > 0) tmp = tmp.add_hours(hours); - - tmp.minute(minutes); - return tmp; -} - -date_time date_time::add_seconds(s32 seconds) const { - date_time tmp = *this; - - if (!seconds) return tmp; - - s32 minutes = seconds / 60; - - seconds = (seconds % 60) + second(); - - if (seconds >= 60) { - ++minutes; - seconds %= 60; - } else if (seconds < 0) { - --minutes; - seconds = 60 - seconds; - } - - if (minutes > 0) tmp = tmp.add_minutes(minutes); - - tmp.second(seconds); - return tmp; -} - -date_time date_time::add_milliseconds(s32 milliseconds) const { - date_time tmp = *this; - - if (!milliseconds) return tmp; - - s32 seconds = milliseconds / 1000; - - milliseconds = (milliseconds % 1000) + millisecond(); - - if (milliseconds >= 1000) { - ++seconds; - milliseconds %= 1000; - } else if (milliseconds < 0) { - --seconds; - milliseconds = 1000 - milliseconds; - } - - if (seconds > 0) tmp = tmp.add_seconds(seconds); - - tmp.millisecond(milliseconds); - return tmp; -} - -date_time date_time::subtract(const time_span& dur) const { - bool negative = !dur.negative(); - - time_span tmp = dur; - tmp.negative(negative); - return add(tmp); -} - -date_time date_time::add(const time_span& dur) const { - s32 negate = dur.negative() ? -1 : 1; - date_time tmp = *this; - - tmp = tmp.add_days(negate * dur.days()); - tmp = tmp.add_hours(negate * dur.hours()); - tmp = tmp.add_minutes(negate * dur.minutes()); - tmp = tmp.add_seconds(negate * dur.seconds()); - tmp = tmp.add_milliseconds(negate * dur.milliseconds()); - return tmp; -} - -date_time date_time::add(const time& t) const { - date_time tmp = *this; - - tmp = tmp.add_hours(t.hour()); - tmp = tmp.add_minutes(t.minute()); - tmp = tmp.add_seconds(t.second()); - tmp = tmp.add_milliseconds(t.millisecond()); - return tmp; -} - -date_time date_time::substract(const time& t) const { - date_time tmp = *this; - - tmp = tmp.add_hours(-1 * t.hour()); - tmp = tmp.add_minutes(-1 * t.minute()); - tmp = tmp.add_seconds(-1 * t.second()); - tmp = tmp.add_milliseconds(-1 * t.millisecond()); - return tmp; -} - -time_span date_time::time_between(const date_time& dt) const { - if (dt == *this) return time_span(); - - if (dt > *this) { - time_span dur = dt.time_between(*this); - dur.negative(true); - return dur; - } - - s64 ms = - (hour() * MS_PER_HOUR) + (minute() * MS_PER_MIN) + (second() * MS_PER_SEC) + millisecond(); - s64 dt_ms = (dt.hour() * MS_PER_HOUR) + (dt.minute() * MS_PER_MIN) + - (dt.second() * MS_PER_SEC) + dt.millisecond(); - s64 total_ms = 0; - date_time stop_date_time; - - // - // Need to stop one day after in this case - // - if (dt_ms > ms) { - stop_date_time = dt.add_days(1); - total_ms = MS_PER_DAY - (dt_ms - ms); - } else { - stop_date_time = dt; - total_ms = ms - dt_ms; - } - - u32 hours = static_cast(total_ms / MS_PER_HOUR); - total_ms = total_ms % MS_PER_HOUR; - - u32 minutes = static_cast(total_ms / MS_PER_MIN); - total_ms = total_ms % MS_PER_MIN; - - u32 seconds = static_cast(total_ms / MS_PER_SEC); - total_ms = total_ms % MS_PER_SEC; - - u32 milliseconds = static_cast(total_ms); - - u32 totaldays = 0; - u16 currentyear = year(); - - while (currentyear > stop_date_time.year()) { - if (currentyear == year()) - totaldays += day_of_year(); - else - totaldays += days_in_year(currentyear); - - currentyear--; - } - - if (year() == stop_date_time.year()) - totaldays += day_of_year() - stop_date_time.day_of_year(); - else - totaldays += days_in_year(currentyear) - stop_date_time.day_of_year(); - - /*while (currentday > stop_date_time.day_of_year()) - { - totaldays++; - currentday--; - }*/ - - return time_span(totaldays, hours, minutes, seconds, milliseconds, false); -} - -bool date_time::is_valid() const { - return valid_date(year(), month(), day()) && time::is_valid(); -} - -bool date_time::is_leap_year(u16 year) { - /* - * Leap year rule: - * every year divisible by 400 is a leap year - * every year divisible by 4 is a leap year if its not divisible by 100 - */ - return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0); -} - -bool date_time::valid_date(u16 year, u8 month, u8 day) { - if (year == 0 || month == 0 || day == 0) return false; - - if (month > 12) return false; - - return day <= days_in_month(year, month); -} - -u16 date_time::days_in_year(u16 year) { return is_leap_year(year) ? u16(366) : u16(365); } - -u8 date_time::days_in_month(u16 year, u8 month) { - u8 days_in_month = g_month_lengths[month - 1]; - - if (month == 2 && is_leap_year(year)) days_in_month++; - - return days_in_month; -} - -u16 date_time::day_of_year(u16 year, u8 _month, u8 day) { - u16 day_of_year = 0; - - for (u8 month = 1; month < _month; month++) - day_of_year += date_time::days_in_month(year, month); - - day_of_year += day; - - return day_of_year; -} - -date_time date_time::reverse_day_of_year(u16 year, u16 day_of_year) { - u8 month; - - for (month = 1; month < 12; month++) { - u32 days = date_time::days_in_month(year, month); - - if (days >= day_of_year) break; - - day_of_year -= days; - } - - return date_time(year, month, static_cast(day_of_year)); -} - -time_t date_time::mktime() const { - tm t; - - t.tm_year = year() - 1900; - t.tm_mon = month() - 1; - t.tm_mday = day(); - t.tm_hour = hour(); - t.tm_min = minute(); - t.tm_sec = second(); - - return ::mktime(&t); -} - -MYSQL_TIME date_time::mysql_time() const { - MYSQL_TIME t; - - t.year = year(); - t.month = month(); - t.day = day(); - t.hour = hour(); - t.minute = minute(); - t.second = second(); - t.second_part = millisecond() * 1000u; - t.neg = false; - t.time_type = - !t.hour && !t.minute && !t.second ? MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME; - - return t; -} - -double date_time::diff_time(const date_time& dt) const { - time_t time_val = mktime(); - time_t dt_time_val = dt.mktime(); - - return ::difftime(time_val, dt_time_val); -} - -date_time date_time::date() const { return date_time(year(), month(), day()); } - -date_time date_time::now() { - using namespace std::chrono; - auto now = system_clock::now(); - - time_t local_time = system_clock::to_time_t(now); - tm ts; - localtime_safe(&ts, &local_time); - - auto millis = duration_cast(now.time_since_epoch()).count() % 1000; - return date_time(ts).add_milliseconds(static_cast(millis)); -} - -date_time date_time::now_utc() { - using namespace std::chrono; - auto now = system_clock::now(); - - time_t utc_time = system_clock::to_time_t(now); - tm ts; - gmtime_safe(&ts, &utc_time); - - auto millis = duration_cast(now.time_since_epoch()).count() % 1000; - return date_time(ts).add_milliseconds(static_cast(millis)); -} - -bool date_time::set(const std::string& dt) { - std::stringstream stream(dt); - - u8 m, d; - u16 s_y = 0, s_m = 0, s_d = 0; - char delim; - - // read formatted years, check overflow before cast - if (stream >> s_y) { - if (stream.eof()) return set(s_y, 0, 0); - - // read formatted months, check overflow before cast - if (stream >> delim && stream >> s_m && s_m < 13) { - m = static_cast(s_m); - if (stream.eof()) return set(s_y, m, 0); - - // read formatted days, check overflow before cast - if (stream >> delim && stream >> s_d && s_d < 32) { - d = static_cast(s_d); - if (stream.eof()) return set(s_y, m, d); - - // extract remaining string - std::string rest; - std::getline(stream, rest); - - // set time from string - return set(s_y, m, d) && time::set(rest); - } - } - } - - throw std::invalid_argument("invalid date format"); -} - -const std::string date_time::str(bool with_millisecond) const { - std::stringstream stream; - stream.fill('0'); - - stream << str_date() << " " << time::str_time(with_millisecond); - return stream.str(); -} - -const std::string date_time::str_date() const { - std::stringstream stream; - stream.fill('0'); - - /* - * Note: the magic unary + forces conversion of unsigned char (u8) to a numeric printing type, - * otherwise it will - * be printed as char - */ - stream << std::setw(4) << year() << "-" << std::setw(2) << +month() << "-" << std::setw(2) - << +day(); - return stream.str(); -} - -std::ostream& mariadb::operator<<(std::ostream& os, const date_time& dt) { - os << dt.str(true); - return os; -} diff --git a/VCMP-LUA/modules/mariadb/src/exceptions.cpp b/VCMP-LUA/modules/mariadb/src/exceptions.cpp deleted file mode 100644 index 20faa44..0000000 --- a/VCMP-LUA/modules/mariadb/src/exceptions.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include - -using namespace mariadb; - -// -// Constructors -// -exception::date_time::date_time(u16 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, - u16 millisecond) throw() : base() { - std::ostringstream oss; - oss << "Invalid date time: " << std::setfill('0') << std::setw(4) << year - << "-" << std::setw(2) << int(month) - << "-" << std::setw(2) << int(day) - << "T" << std::setw(2) << int(hour) - << ":" << std::setw(2) << int(minute) - << ":" << std::setw(2) << int(second) - << "." << std::setw(3) << millisecond; - - m_error = oss.str(); -} - -exception::time::time(u8 hour, u8 minute, u8 second, u16 millisecond) throw() : base() { - std::ostringstream oss; - oss << "Invalid time: " << std::setfill('0') << std::setw(2) << int(hour) - << ":" << std::setw(2) << int(minute) - << ":" << std::setw(2) << int(second) - << "." << std::setw(3) << millisecond; - - m_error = oss.str(); -} diff --git a/VCMP-LUA/modules/mariadb/src/last_error.cpp b/VCMP-LUA/modules/mariadb/src/last_error.cpp deleted file mode 100644 index 379dd57..0000000 --- a/VCMP-LUA/modules/mariadb/src/last_error.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -using namespace mariadb; - -// -// Constructor -// -last_error::last_error() : m_last_error_no(0) {} - -// -// Get last error -// -u32 last_error::error_no() const { return m_last_error_no; } - -const std::string& last_error::error() const { return m_last_error; } diff --git a/VCMP-LUA/modules/mariadb/src/private.hpp b/VCMP-LUA/modules/mariadb/src/private.hpp deleted file mode 100644 index ed35e78..0000000 --- a/VCMP-LUA/modules/mariadb/src/private.hpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_PRIVATE_HPP_ -#define _MARIADB_PRIVATE_HPP_ - -#include -#include - -namespace mariadb { -#if _WIN32 -inline int localtime_safe(struct tm* _tm, const time_t* _time) { return localtime_s(_tm, _time); } - -inline int gmtime_safe(struct tm* _tm, const time_t* _time) { return gmtime_s(_tm, _time); } -#else -inline int localtime_safe(struct tm* _tm, const time_t* _time) { - return localtime_r(_time, _tm) ? 0 : -1; -} - -inline int gmtime_safe(struct tm* _tm, const time_t* _time) { - return gmtime_r(_time, _tm) ? 0 : -1; -} -#endif -} -#if _WIN32 - -#if __MINGW32__ -// this is needed because on mingw sprintf_s is broken (due to msvcrt not following c99 standard -// with sprintf...) -#define snprintf(buffer, szbuffer, format, ...) __mingw_sprintf(buffer, format, ##__VA_ARGS__) -#else -#define snprintf sprintf_s -#endif - -#endif - -#define MARIADB_ERROR_THROW_CONNECTION(error_id, error) \ - throw exception::connection(error_id, error); -#define MARIADB_ERROR_THROW_DATE(_year, _month, _day, _hour, _minute, _second, _millisecond) \ - throw exception::date_time(_year, _month, _day, _hour, _minute, _second, _millisecond); -#define MARIADB_ERROR_THROW_TIME(_hour, _minute, _second, _millisecond) \ - throw exception::time(_hour, _minute, _second, _millisecond); - -#define MARIADB_ERROR(error_id, error) \ - std::cerr << "MariaDB Error(" << error_id << "): " << error \ - << "\nIn function: " << __FUNCTION__ << "\nIn file " << __FILE__ << "\nOn line " \ - << __LINE__ << '\n'; \ - MARIADB_ERROR_THROW_CONNECTION(error_id, error) - -#define MYSQL_ERROR_NO_BRAKET(mysql) \ - m_last_error_no = mysql_errno(mysql); \ - m_last_error = mysql_error(mysql); \ - MARIADB_ERROR(m_last_error_no, m_last_error); - -#define MYSQL_ERROR(mysql) \ - { MYSQL_ERROR_NO_BRAKET(mysql) } - -#define STMT_ERROR_NO_BRAKET(statement) \ - m_last_error_no = mysql_stmt_errno(statement); \ - m_last_error = mysql_stmt_error(statement); \ - MARIADB_ERROR(m_last_error_no, m_last_error); - -#define STMT_ERROR(statement) \ - { STMT_ERROR_NO_BRAKET(statement) } - -#endif diff --git a/VCMP-LUA/modules/mariadb/src/result_set.cpp b/VCMP-LUA/modules/mariadb/src/result_set.cpp deleted file mode 100644 index 1c51eb4..0000000 --- a/VCMP-LUA/modules/mariadb/src/result_set.cpp +++ /dev/null @@ -1,388 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include -#include -#include -#include -#include "private.hpp" - -using namespace mariadb; - -result_set::result_set(connection *conn) - : m_result_set((conn->account()->store_result() ? mysql_store_result : mysql_use_result)(conn->m_mysql)), - m_fields(nullptr), - m_row(nullptr), - m_raw_binds(nullptr), - m_stmt_data(nullptr), - m_lengths(nullptr), - m_field_count(0), - m_was_fetched(false) { - - if (m_result_set) { - m_field_count = mysql_num_fields(m_result_set); - m_fields = mysql_fetch_fields(m_result_set); - - for (u32 i = 0; i < m_field_count; ++i) m_indexes[m_fields[i].name] = i; - } -} - -result_set::result_set(connection* conn, const statement_data_ref &stmt_data) - : m_result_set(nullptr), - m_fields(nullptr), - m_row(nullptr), - m_raw_binds(nullptr), - m_stmt_data(stmt_data), - m_lengths(nullptr), - m_field_count(0), - m_was_fetched(false) { - - int max_length = 1; - mysql_stmt_attr_set(stmt_data->m_statement, STMT_ATTR_UPDATE_MAX_LENGTH, &max_length); - - if (conn->account()->store_result() && mysql_stmt_store_result(stmt_data->m_statement)) - STMT_ERROR(stmt_data->m_statement) - else { - m_field_count = mysql_stmt_field_count(stmt_data->m_statement); - m_result_set = mysql_stmt_result_metadata(stmt_data->m_statement); - - if (m_field_count > 0) { - m_fields = mysql_fetch_fields(m_result_set); - m_raw_binds = new MYSQL_BIND[m_field_count]; - m_row = new char *[m_field_count]; - - for (u32 i = 0; i < m_field_count; ++i) { - m_indexes[m_fields[i].name] = i; - m_binds.emplace_back(new bind(&m_raw_binds[i], &m_fields[i])); - m_row[i] = m_binds[i]->buffer(); - } - - mysql_stmt_bind_result(stmt_data->m_statement, m_raw_binds); - } - } -} - -statement_data::~statement_data() { - delete[] m_raw_binds; - - if (m_statement) mysql_stmt_close(m_statement); -} - -result_set::~result_set() { - if (m_result_set) mysql_free_result(m_result_set); - - delete[] m_raw_binds; - - if (m_stmt_data) { - delete[] m_row; - - mysql_stmt_free_result(m_stmt_data->m_statement); - } -} - -u32 result_set::column_count() const { return m_field_count; } - -value::type result_set::column_type(u32 index) const { - if (index >= m_field_count) throw std::out_of_range("Column index out of range"); - - bool is_unsigned = (m_fields[index].flags & UNSIGNED_FLAG) == UNSIGNED_FLAG; - - switch (m_fields[index].type) { - case MYSQL_TYPE_NULL: - return value::null; - - case MYSQL_TYPE_BIT: - return value::boolean; - - case MYSQL_TYPE_FLOAT: - return value::float32; - - case MYSQL_TYPE_DECIMAL: - case MYSQL_TYPE_NEWDECIMAL: - return value::decimal; - - case MYSQL_TYPE_DOUBLE: - return value::double64; - - case MYSQL_TYPE_NEWDATE: - case MYSQL_TYPE_DATE: - return value::date; - - case MYSQL_TYPE_TIME: - return value::time; - - case MYSQL_TYPE_TIMESTAMP: - case MYSQL_TYPE_DATETIME: - return value::date_time; - - case MYSQL_TYPE_TINY: - return (is_unsigned ? value::unsigned8 : value::signed8); - - case MYSQL_TYPE_YEAR: - case MYSQL_TYPE_SHORT: - return (is_unsigned ? value::unsigned16 : value::signed16); - - case MYSQL_TYPE_INT24: - case MYSQL_TYPE_LONG: - return (is_unsigned ? value::unsigned32 : value::signed32); - - case MYSQL_TYPE_LONGLONG: - return (is_unsigned ? value::unsigned64 : value::signed64); - - case MYSQL_TYPE_TINY_BLOB: - case MYSQL_TYPE_MEDIUM_BLOB: - case MYSQL_TYPE_LONG_BLOB: - case MYSQL_TYPE_BLOB: - return value::blob; - - case MYSQL_TYPE_ENUM: - return value::enumeration; - - default: - case MYSQL_TYPE_VARCHAR: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_STRING: - return value::string; - } -} - -const std::string result_set::column_name(u32 index) { - if (index >= m_field_count) throw std::out_of_range("Column index out of range"); - - return m_fields[index].name; -} - -u32 result_set::column_index(const std::string &name) const { - const map_indexes_t::const_iterator i = m_indexes.find(name); - - if (i == m_indexes.end()) return 0xffffffff; - - return i->second; -} - -unsigned long result_set::column_size(u32 index) const { - if (index >= m_field_count) throw std::out_of_range("Column index out of range"); - - return m_stmt_data ? m_binds.at(index)->length() : m_lengths[index]; -} - -bool result_set::set_row_index(u64 index) { - if (m_stmt_data) - mysql_stmt_data_seek(m_stmt_data->m_statement, index); - else - mysql_data_seek(m_result_set, index); - return next(); -} - -bool result_set::next() { - if (!m_result_set) return (m_was_fetched = false); - - if (m_stmt_data) return (m_was_fetched = !mysql_stmt_fetch(m_stmt_data->m_statement)); - - m_row = mysql_fetch_row(m_result_set); - m_lengths = mysql_fetch_lengths(m_result_set); - - // make sure no access to results is possible until a result is successfully fetched - return (m_was_fetched = m_row != nullptr); -} - -u64 result_set::row_index() const { - if (m_stmt_data) return reinterpret_cast(mysql_stmt_row_tell(m_stmt_data->m_statement)); - - return reinterpret_cast(mysql_row_tell(m_result_set)); -} - -u64 result_set::row_count() const { - if (m_stmt_data) return mysql_stmt_num_rows(m_stmt_data->m_statement); - - return mysql_num_rows(m_result_set); -} - -void result_set::check_row_fetched() const { - if (!m_was_fetched) throw std::out_of_range("No row was fetched"); -} - -void result_set::check_type(u32 index, value::type requested) const { - value::type actual = column_type(index); - bool type_error; - - // check requested type vs actual type. - switch (requested) { - // these types require exact type match - case value::type::float32: - case value::type::double64: - case value::type::decimal: - - case value::type::time: - case value::type::date_time: - case value::type::date: - - case value::type::enumeration: - type_error = actual != requested; - break; - - // these types require size match - case value::type::unsigned8: - case value::type::signed8: - type_error = actual != value::type::signed8 && actual != value::type::unsigned8; - break; - case value::type::unsigned16: - case value::type::signed16: - type_error = actual != value::type::signed16 && actual != value::type::unsigned16; - break; - case value::type::unsigned32: - case value::type::signed32: - type_error = actual != value::type::signed32 && actual != value::type::unsigned32; - break; - case value::type::unsigned64: - case value::type::signed64: - type_error = actual != value::type::signed64 && actual != value::type::unsigned64; - break; - - // bool can also be a signed8 - case value::type::boolean: - type_error = actual != requested && actual != value::type::signed8; - break; - - // only string, blob, data and null are interchangeable - case value::type::string: - case value::type::blob: - case value::type::data: - type_error = actual != value::type::string && - actual != value::type::blob && - actual != value::type::data && - actual != value::type::null; - break; - - default: - type_error = false; - } - - if (type_error) { - printf("requested type %d does not match actual type %d", +requested, +actual); - MARIADB_ERROR_THROW_CONNECTION(12, "type error"); - } -} - -MAKE_GETTER(blob, stream_ref, value::type::blob) - size_t len = column_size(index); - - if (len == 0) return stream_ref(); - - auto *ss = new std::istringstream(); - ss->rdbuf()->pubsetbuf(m_row[index], len); - return stream_ref(ss); -} - -MAKE_GETTER(data, data_ref, value::type::data) - size_t len = column_size(index); - - return len == 0 ? data_ref() : data_ref(new data(m_row[index], len)); -} - -MAKE_GETTER(string, std::string, value::type::string) - return std::string(m_row[index], column_size(index)); -} - -MAKE_GETTER(date, date_time, value::type::date) - if (m_stmt_data) return mariadb::date_time(m_binds[index]->m_time); - - return date_time(std::string(m_row[index], column_size(index))).date(); -} - -MAKE_GETTER(date_time, date_time, value::type::date_time) - if (m_stmt_data) return mariadb::date_time(m_binds[index]->m_time); - - return date_time(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(time, mariadb::time, value::type::time) - if (m_stmt_data) return mariadb::time(m_binds[index]->m_time); - - return mariadb::time(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(decimal, decimal, value::type::decimal) - return decimal(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(boolean, bool, value::type::boolean) - if (m_stmt_data) return (m_binds[index]->m_uchar8[0] != 0); - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(unsigned8, u8, value::type::unsigned8) - if (m_stmt_data) return checked_cast(0x00000000000000ff & m_binds[index]->m_unsigned64); - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(signed8, s8, value::type::signed8) - if (m_stmt_data) return checked_cast(0x00000000000000ff & m_binds[index]->m_signed64); - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(unsigned16, u16, value::type::unsigned16) - if (m_stmt_data) return checked_cast(0x000000000000ffff & m_binds[index]->m_unsigned64); - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(signed16, s16, value::type::signed16) - if (m_stmt_data) return checked_cast(0x000000000000ffff & m_binds[index]->m_signed64); - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(unsigned32, u32, value::type::unsigned32) - if (m_stmt_data) return checked_cast(0x00000000ffffffff & m_binds[index]->m_unsigned64); - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(signed32, s32, value::type::signed32) - if (m_stmt_data) return m_binds[index]->m_signed32[0]; - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(unsigned64, u64, value::type::unsigned64) - if (m_stmt_data) return m_binds[index]->m_unsigned64; - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(signed64, s64, value::type::signed64) - if (m_stmt_data) return m_binds[index]->m_signed64; - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(float, f32, value::type::float32) - if (m_stmt_data) return m_binds[index]->m_float32[0]; - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(double, f64, value::type::double64) - if (m_stmt_data) return checked_cast(m_binds[index]->m_double64); - - return string_cast(std::string(m_row[index], column_size(index))); -} - -MAKE_GETTER(is_null, bool, value::type::null) - if (m_stmt_data) return m_binds[index]->is_null(); - - return !m_row[index]; -} diff --git a/VCMP-LUA/modules/mariadb/src/save_point.cpp b/VCMP-LUA/modules/mariadb/src/save_point.cpp deleted file mode 100644 index 50d11ff..0000000 --- a/VCMP-LUA/modules/mariadb/src/save_point.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include - -using namespace mariadb; - -namespace { -handle g_save_point_id = 0; - -const char* g_save_point_create = "SAVEPOINT "; -const char* g_save_point_rollback = "ROLLBACK TO SAVEPOINT "; -const char* g_save_point_release = "RELEASE SAVEPOINT "; -} - -// -// Constructor -// -save_point::save_point(transaction* trans) : m_transaction(trans) { - m_name = "SP" + std::to_string(++g_save_point_id); - m_transaction->m_connection->execute(g_save_point_create + m_name); -} - -// -// Destructor -// -save_point::~save_point() { - if (!m_transaction) return; - - m_transaction->remove_save_point(this); - m_transaction->m_connection->execute(g_save_point_rollback + m_name); -} - -// -// Commit the change -// -void save_point::commit() { - if (!m_transaction) return; - - m_transaction->remove_save_point(this); - m_transaction->m_connection->execute(g_save_point_release + m_name); - m_transaction = NULL; -} diff --git a/VCMP-LUA/modules/mariadb/src/statement.cpp b/VCMP-LUA/modules/mariadb/src/statement.cpp deleted file mode 100644 index 014f869..0000000 --- a/VCMP-LUA/modules/mariadb/src/statement.cpp +++ /dev/null @@ -1,176 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include -#include -#include -#include -#include "private.hpp" - -using namespace mariadb; - -#define STMT_ERROR_RETURN_RS(statement) \ - { \ - STMT_ERROR_NO_BRAKET(statement) \ - } - -statement::statement(connection* conn, const std::string& query) - : m_parent(conn), m_data(statement_data_ref(new statement_data(mysql_stmt_init(conn->m_mysql)))) { - if (!m_data->m_statement) - MYSQL_ERROR(conn->m_mysql) - else if (mysql_stmt_prepare(m_data->m_statement, query.c_str(), query.size())) - STMT_ERROR(m_data->m_statement) - else { - m_data->m_bind_count = mysql_stmt_param_count(m_data->m_statement); - - if (m_data->m_bind_count > 0) { - m_data->m_raw_binds = new MYSQL_BIND[m_data->m_bind_count]; - - for (uint32_t i = 0; i < m_data->m_bind_count; i++) - m_data->m_binds.emplace_back(new bind(&m_data->m_raw_binds[i])); - } - } -} - -void statement::set_connection(connection_ref& connection) { m_connection = connection; } - -u64 statement::execute() { - if (m_data->m_raw_binds && mysql_stmt_bind_param(m_data->m_statement, m_data->m_raw_binds)) - STMT_ERROR(m_data->m_statement); - - if (mysql_stmt_execute(m_data->m_statement)) STMT_ERROR(m_data->m_statement); - - return mysql_stmt_affected_rows(m_data->m_statement); -} - -u64 statement::insert() { - if (m_data->m_raw_binds && mysql_stmt_bind_param(m_data->m_statement, m_data->m_raw_binds)) - STMT_ERROR(m_data->m_statement); - - if (mysql_stmt_execute(m_data->m_statement)) STMT_ERROR(m_data->m_statement); - - return mysql_stmt_insert_id(m_data->m_statement); -} - -result_set_ref statement::query() { - result_set_ref rs; - - if (m_data->m_raw_binds && mysql_stmt_bind_param(m_data->m_statement, m_data->m_raw_binds)) - STMT_ERROR_RETURN_RS(m_data->m_statement); - - if (mysql_stmt_execute(m_data->m_statement)) STMT_ERROR_RETURN_RS(m_data->m_statement); - - rs.reset(new result_set(m_parent, m_data)); - return rs; -} - -MAKE_SETTER(blob, stream_ref) - if (!value) return; - - value->seekg(0, std::ios_base::end); - u64 size = value->tellg(); - value->seekg(0); - - // allocate empty buffer - bind.set(MYSQL_TYPE_BLOB, nullptr, static_cast(size)); - // copy stream over - value->read(bind.buffer(), bind.length()); -} - -MAKE_SETTER(data, const data_ref&) - if (!value) return; - bind.set(MYSQL_TYPE_BLOB, value->get(), value->size()); -} - -MAKE_SETTER(date_time, const date_time&) - bind.m_time = value.mysql_time(); - bind.set(MYSQL_TYPE_DATETIME); -} - -MAKE_SETTER(date, const date_time&) - bind.m_time = value.date().mysql_time(); - bind.set(MYSQL_TYPE_DATE); -} - -MAKE_SETTER(time, const mariadb::time&) - bind.m_time = value.mysql_time(); - bind.set(MYSQL_TYPE_TIME); -} - -MAKE_SETTER(decimal, const decimal&) - std::string str = value.str(); - bind.set(MYSQL_TYPE_STRING, str.c_str(), str.size()); -} - -MAKE_SETTER(string, const std::string&) - bind.set(MYSQL_TYPE_STRING, value.c_str(), value.size()); -} - -MAKE_SETTER(boolean, bool) - bind.m_unsigned64 = value; - bind.set(MYSQL_TYPE_TINY); -} - -MAKE_SETTER(unsigned8, u8) - bind.m_unsigned64 = value; - bind.set(MYSQL_TYPE_TINY, nullptr, 0, true); -} - -MAKE_SETTER(signed8, s8) - bind.m_signed64 = value; - bind.set(MYSQL_TYPE_TINY); -} - -MAKE_SETTER(unsigned16, u16) - bind.m_unsigned64 = value; - bind.set(MYSQL_TYPE_SHORT, nullptr, 0, true); -} - -MAKE_SETTER(signed16, s16) - bind.m_signed64 = value; - bind.set(MYSQL_TYPE_SHORT); -} - -MAKE_SETTER(unsigned32, u32) - bind.m_unsigned64 = value; - bind.set(MYSQL_TYPE_LONG, nullptr, 0, true); -} - -MAKE_SETTER(signed32, s32) - bind.m_signed64 = value; - bind.set(MYSQL_TYPE_LONG); -} - -MAKE_SETTER(unsigned64, u64) - bind.m_unsigned64 = value; - bind.set(MYSQL_TYPE_LONGLONG, nullptr, 0, true); -} - -MAKE_SETTER(signed64, s64) - bind.m_signed64 = value; - bind.set(MYSQL_TYPE_LONGLONG); -} - -MAKE_SETTER(float, f32) - bind.m_float32[0] = value; - bind.set(MYSQL_TYPE_FLOAT); -} - -MAKE_SETTER(double, f64) - bind.m_double64 = value; - bind.set(MYSQL_TYPE_DOUBLE); -} - -void statement::set_null(u32 index) { - MAKE_SETTER_BODY - bind.set(MYSQL_TYPE_NULL); -} diff --git a/VCMP-LUA/modules/mariadb/src/time.cpp b/VCMP-LUA/modules/mariadb/src/time.cpp deleted file mode 100644 index 7fdab19..0000000 --- a/VCMP-LUA/modules/mariadb/src/time.cpp +++ /dev/null @@ -1,377 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2020. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include -#include -#include -#include -#include -#include -#include "private.hpp" - -#define MS_PER_SEC 1000 -#define MS_PER_MIN (MS_PER_SEC * 60) -#define MS_PER_HOUR (MS_PER_MIN * 60) -#define MS_PER_DAY (MS_PER_HOUR * 24) - -mariadb::time::time(u8 hour, u8 minute, u8 second, u16 millisecond) { - set(hour, minute, second, millisecond); -} - -mariadb::time::time(const time& t) { set(t.hour(), t.minute(), t.second(), t.millisecond()); } - -mariadb::time::time(const tm& t) { set(t.tm_hour, t.tm_min, t.tm_sec, 0); } - -mariadb::time::time(const time_t& t) { - tm ts; - localtime_safe(&ts, &t); - - set(ts.tm_hour, ts.tm_min, ts.tm_sec, 0); -} - -mariadb::time::time(const MYSQL_TIME& t) { set(t.hour, t.minute, t.second, t.second_part / 1000); } - -mariadb::time::time(const std::string& t) { set(t); } - -int mariadb::time::compare(const time& t) const { - if (hour() < t.hour()) return -1; - - if (hour() > t.hour()) return 1; - - if (minute() < t.minute()) return -1; - - if (minute() > t.minute()) return 1; - - if (second() < t.second()) return -1; - - if (second() > t.second()) return 1; - - if (millisecond() < t.millisecond()) return -1; - - return millisecond() == t.millisecond() ? 0 : 1; -} - -mariadb::time& mariadb::time::operator=(const time& t) { - set(t.hour(), t.minute(), t.second(), t.millisecond()); - return *this; -} - -bool mariadb::time::operator==(const time& t) const { return compare(t) == 0; } - -bool mariadb::time::operator!=(const time& t) const { return compare(t) != 0; } - -bool mariadb::time::operator<(const time& t) const { return compare(t) < 0; } - -bool mariadb::time::operator<=(const time& t) const { return compare(t) <= 0; } - -bool mariadb::time::operator>(const time& t) const { return compare(t) > 0; } - -bool mariadb::time::operator>=(const time& t) const { return compare(t) >= 0; } - -bool mariadb::time::set(u8 hour, u8 minute, u8 second, u16 millisecond) { - m_hour = hour; - m_minute = minute; - m_second = second; - m_millisecond = millisecond; - return true; -} - -mariadb::u8 mariadb::time::hour() const { return m_hour; } - -mariadb::u8 mariadb::time::hour(u8 hour) { - if (hour > 23) - MARIADB_ERROR_THROW_TIME(hour, minute(), second(), millisecond()); - - m_hour = hour; - - return m_hour; -} - -mariadb::u8 mariadb::time::minute() const { return m_minute; } - -mariadb::u8 mariadb::time::minute(u8 minute) { - if (minute > 59) - MARIADB_ERROR_THROW_TIME(hour(), minute, second(), millisecond()); - - m_minute = minute; - - return m_minute; -} - -mariadb::u8 mariadb::time::second() const { return m_second; } - -mariadb::u8 mariadb::time::second(u8 second) { - if (second > 61) - MARIADB_ERROR_THROW_TIME(hour(), minute(), second, millisecond()); - - m_second = second; - - return m_second; -} - -mariadb::u16 mariadb::time::millisecond() const { return m_millisecond; } - -mariadb::u16 mariadb::time::millisecond(u16 millisecond) { - if (millisecond > 999) - MARIADB_ERROR_THROW_TIME(hour(), minute(), second(), millisecond); - - m_millisecond = millisecond; - - return m_millisecond; -} - -mariadb::time mariadb::time::add_hours(s32 hours) const { - mariadb::time tmp = *this; - - if (hours == 0) return tmp; - - // hour overflow does not matter, as we dont care about days - hours = (hours + hour() + 24) % 24; - tmp.hour(hours); - return tmp; -} - -mariadb::time mariadb::time::add_minutes(s32 minutes) const { - mariadb::time tmp = *this; - - if (minutes == 0) return tmp; - - s32 hours = minutes / 60; - minutes = (minutes % 60) + minute(); - - if (minutes >= 60) - ++hours; - else if (minutes < 0) - --hours; - - if (hours != 0) tmp = tmp.add_hours(hours); - - tmp.minute((minutes + 60) % 60); - return tmp; -} - -mariadb::time mariadb::time::add_seconds(s32 seconds) const { - mariadb::time tmp = *this; - - if (seconds == 0) return tmp; - - s32 minutes = seconds / 60; - seconds = (seconds % 60) + second(); - - if (seconds >= 60) - ++minutes; - else if (seconds < 0) - --minutes; - - if (minutes != 0) tmp = tmp.add_minutes(minutes); - - tmp.second((seconds + 60) % 60); - return tmp; -} - -mariadb::time mariadb::time::add_milliseconds(s32 milliseconds) const { - mariadb::time tmp = *this; - - if (milliseconds == 0) return tmp; - - s32 seconds = milliseconds / 1000; - milliseconds = (milliseconds % 1000) + millisecond(); - - if (milliseconds > 999) - ++seconds; - else if (milliseconds < 0) - --seconds; - - if (seconds != 0) tmp = tmp.add_seconds(seconds); - - tmp.millisecond((milliseconds + 1000) % 1000); - return tmp; -} - -mariadb::time mariadb::time::subtract(const time_span& dur) const { - // copy and negate timespan - time_span tmp = dur; - tmp.negative(!dur.negative()); - - // add negated - return add(tmp); -} - -mariadb::time mariadb::time::add(const time_span& dur) const { - // negate if needed - s32 negative = dur.negative() ? -1 : 1; - time tmp = *this; - - tmp.add_hours(negative * dur.hours()); - tmp.add_minutes(negative * dur.minutes()); - tmp.add_seconds(negative * dur.seconds()); - tmp.add_milliseconds(negative * dur.milliseconds()); - return tmp; -} - -mariadb::time_span mariadb::time::time_between(const time& t) const { - // equal - if (t == *this) return time_span(0, 0, 0, 0, 0); - - // recursive call with negation - if (t > *this) { - time_span dur = t.time_between(*this); - dur.negative(true); - return dur; - } - - // calculate the ms representation of both - s64 ms = - (hour() * MS_PER_HOUR) + (minute() * MS_PER_MIN) + (second() * MS_PER_SEC) + millisecond(); - s64 t_ms = (t.hour() * MS_PER_HOUR) + (t.minute() * MS_PER_MIN) + (t.second() * MS_PER_SEC) + - t.millisecond(); - s64 total_ms = 0; - - // subtract the lesser from greater // TODO: is this case ever reached since we have recusive - // call on t > this? - if (t_ms > ms) - total_ms = MS_PER_DAY - (t_ms - ms); - else - total_ms = ms - t_ms; - - u32 hours = static_cast(total_ms / MS_PER_HOUR); - total_ms = total_ms % MS_PER_HOUR; - - u32 minutes = static_cast(total_ms / MS_PER_MIN); - total_ms = total_ms % MS_PER_MIN; - - u32 seconds = static_cast(total_ms / MS_PER_SEC); - total_ms = total_ms % MS_PER_SEC; - - return time_span(0, hours, minutes, seconds, static_cast(total_ms), false); -} - -time_t mariadb::time::mktime() const { - tm time_struct; - - time_struct.tm_year = 1900; - time_struct.tm_mon = 0; - time_struct.tm_mday = 1; - time_struct.tm_hour = hour(); - time_struct.tm_min = minute(); - time_struct.tm_sec = second(); - - return ::mktime(&time_struct); -} - -MYSQL_TIME mariadb::time::mysql_time() const { - MYSQL_TIME t; - - t.year = 0; - t.month = 0; - t.day = 0; - t.hour = hour(); - t.minute = minute(); - t.second = second(); - t.second_part = millisecond() * 1000u; - t.neg = false; - t.time_type = MYSQL_TIMESTAMP_TIME; - return t; -} - -double mariadb::time::diff_time(const time& t) const { - time_t time_val = mktime(); - time_t t_time_val = t.mktime(); - - return ::difftime(time_val, t_time_val); -} - -bool mariadb::time::is_valid() const { - return time::valid_time(hour(), minute(), second(), millisecond()); -} - -bool mariadb::time::valid_time(u8 hour, u8 minute, u8 second, u16 millisecond) { - // seconds go up to 61 to allow for leap seconds - return hour < 24 && minute < 60 && second <= 61 && millisecond < 1000; -} - -mariadb::time mariadb::time::now() { - using namespace std::chrono; - auto now = system_clock::now(); - - time_t local_time = system_clock::to_time_t(now); - tm ts; - localtime_safe(&ts, &local_time); - - auto millis = duration_cast(now.time_since_epoch()).count() % 1000; - return mariadb::time(ts).add_milliseconds(static_cast(millis)); -} - -mariadb::time mariadb::time::now_utc() { - using namespace std::chrono; - auto now = system_clock::now(); - - time_t utc_time = system_clock::to_time_t(now); - tm ts; - gmtime_safe(&ts, &utc_time); - - auto millis = duration_cast(now.time_since_epoch()).count() % 1000; - return mariadb::time(ts).add_milliseconds(static_cast(millis)); -} - -bool mariadb::time::set(const std::string& t) { - std::stringstream stream(t); - - u8 h, m, s; - u16 s_h = 0, s_m = 0, s_s = 0, s_ms = 0; - char delim; - - // read formatted hours, check overflow before cast - if (stream >> s_h && s_h < 24) { - h = static_cast(s_h); - if (stream.eof()) return set(h, 0, 0, 0); - - // read formatted minutes, check overflow before cast - if (stream >> delim && stream >> s_m && s_m < 60) { - m = static_cast(s_m); - if (stream.eof()) return set(h, m, 0, 0); - - // read formatted seconds, check overflow before cast - if (stream >> delim && stream >> s_s && s_s < 62) { - s = static_cast(s_s); - if (stream.eof()) return set(h, m, s, 0); - - // read formatted millis - if (stream >> delim && stream >> s_ms) return set(h, m, s, s_ms); - } - } - } - - throw std::invalid_argument("invalid time format"); -} - -const std::string mariadb::time::str_time(bool with_millisecond) const { - std::stringstream stream; - stream.fill('0'); - - /* - * Note: the magic unary + forces conversion of unsigned char (u8) to a numeric printing type, - * otherwise it will - * be printed as char - */ - stream << std::setw(2) << +hour() << ":" << std::setw(2) << +minute() << ":" << std::setw(2) - << +second(); - - if (with_millisecond) stream << "." << std::setw(3) << millisecond(); - - return stream.str(); -} - -std::ostream& mariadb::operator<<(std::ostream& os, const time& t) { - os << t.str_time(true); - return os; -} diff --git a/VCMP-LUA/modules/mariadb/src/time_span.cpp b/VCMP-LUA/modules/mariadb/src/time_span.cpp deleted file mode 100644 index 7db0a10..0000000 --- a/VCMP-LUA/modules/mariadb/src/time_span.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -using namespace mariadb; - -time_span::time_span(u32 days, u8 hours, u8 minutes, u8 seconds, u16 milliseconds, bool negative) { - set(days, hours, minutes, seconds, milliseconds, negative); -} - -time_span::time_span(const time_span& dur) { - set(dur.days(), dur.hours(), dur.minutes(), dur.seconds(), dur.milliseconds(), dur.negative()); -} - -int time_span::compare(const time_span& ts) const { - if (negative() && !ts.negative()) return -1; - - if (!negative() && ts.negative()) return 1; - - if (zero() && ts.zero()) return 0; - - if (days() < ts.days()) return -1; - - if (days() > ts.days()) return 1; - - if (hours() < ts.hours()) return -1; - - if (hours() > ts.hours()) return 1; - - if (minutes() < ts.minutes()) return -1; - - if (minutes() > ts.minutes()) return 1; - - if (seconds() < ts.seconds()) return -1; - - if (seconds() > ts.seconds()) return 1; - - if (milliseconds() < ts.milliseconds()) return -1; - - return milliseconds() == ts.milliseconds() ? 0 : 1; -} - -time_span& time_span::operator=(const time_span& ts) { - set(ts.days(), ts.hours(), ts.minutes(), ts.seconds(), ts.milliseconds(), ts.negative()); - - return *this; -} - -bool time_span::operator==(const time_span& ts) const { return compare(ts) == 0; } - -bool time_span::operator!=(const time_span& ts) const { return compare(ts) != 0; } - -bool time_span::operator<(const time_span& ts) const { return compare(ts) < 0; } - -bool time_span::operator<=(const time_span& ts) const { return compare(ts) <= 0; } - -bool time_span::operator>(const time_span& ts) const { return compare(ts) > 0; } - -bool time_span::operator>=(const time_span& ts) const { return compare(ts) >= 0; } - -void time_span::set(u32 _days, u8 _hours, u8 _minutes, u8 _seconds, u16 _milliseconds, - bool _negative) { - negative(_negative); - days(_days); - hours(_hours); - minutes(_minutes); - seconds(_seconds); - milliseconds(_milliseconds); -} - -bool time_span::zero() const { - return m_days == 0 && m_hours == 0 && m_minutes == 0 && m_seconds == 0 && m_milliseconds == 0; -} - -u32 time_span::days() const { return m_days; } - -u32 time_span::days(u32 days) { return (m_days = days); } - -u8 time_span::hours() const { return m_hours; } - -u8 time_span::hours(u8 hours) { - if (hours > 23) throw std::invalid_argument("Hours must be < 24"); - - return (m_hours = hours); -} - -u8 time_span::minutes() const { return m_minutes; } - -u8 time_span::minutes(u8 minutes) { - if (minutes > 59) throw std::invalid_argument("Hours must be < 60"); - - return (m_minutes = minutes); -} - -u8 time_span::seconds() const { return m_seconds; } - -u8 time_span::seconds(u8 seconds) { - if (seconds > 60) throw std::invalid_argument("Hours must be < 61"); - - return (m_seconds = seconds); -} - -u16 time_span::milliseconds() const { return m_milliseconds; } - -u16 time_span::milliseconds(u16 milliseconds) { - if (milliseconds > 999) throw std::invalid_argument("Hours must be < 1000"); - - return (m_milliseconds = milliseconds); -} - -bool time_span::negative() const { return m_negative; } - -bool time_span::negative(bool negative) { return (m_negative = negative); } - -u64 time_span::total_hours() const { return m_days * 24u + m_hours; } - -u64 time_span::total_minutes() const { return total_hours() * 60u + m_minutes; } - -u64 time_span::total_seconds() const { return total_minutes() * 60u + m_seconds; } - -u64 time_span::total_milliseconds() const { return total_seconds() * 1000u + m_milliseconds; } - -std::ostream& mariadb::operator<<(std::ostream& os, const time_span& ts) { - if (ts.negative()) os << "negative "; - - os << ts.days() << " days, " << +ts.hours() << " hours, " << +ts.minutes() << " minutes, " - << +ts.seconds() << " seconds, " << ts.milliseconds() << " milliseconds"; - - return os; -} diff --git a/VCMP-LUA/modules/mariadb/src/transaction.cpp b/VCMP-LUA/modules/mariadb/src/transaction.cpp deleted file mode 100644 index 0ca8d9a..0000000 --- a/VCMP-LUA/modules/mariadb/src/transaction.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include - -using namespace mariadb; - -namespace { -const char* g_isolation_level[] = { - "SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;", - "SET TRANSACTION ISOLATION LEVEL READ COMMITTED;", - "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;", - "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;", -}; - -const char* g_consistent_snapshot[] = { - "START TRANSACTION;", "START TRANSACTION WITH CONSISTENT SNAPSHOT;", -}; -} - -transaction::transaction(connection* conn, isolation::level level, bool consistent_snapshot) - : m_connection(conn) { - conn->execute(g_isolation_level[level]); - conn->execute(g_consistent_snapshot[consistent_snapshot]); -} - -transaction::~transaction() { - if (!m_connection) return; - - mysql_rollback(m_connection->m_mysql); - cleanup(); -} - -void transaction::cleanup() { - for (save_point* save_point : m_save_points) save_point->m_transaction = nullptr; - - m_save_points.clear(); -} - -void transaction::commit() { - if (!m_connection) return; - - mysql_commit(m_connection->m_mysql); - cleanup(); - m_connection = nullptr; -} - -save_point_ref transaction::create_save_point() { - if (!m_connection) return save_point_ref(); - - save_point* sp = new save_point(this); - m_save_points.push_back(sp); - return save_point_ref(sp); -} - -void transaction::remove_save_point(save_point* sv_point) { - m_save_points.erase(std::remove(m_save_points.begin(), m_save_points.end(), sv_point)); -} diff --git a/VCMP-LUA/modules/mariadb/src/worker.cpp b/VCMP-LUA/modules/mariadb/src/worker.cpp deleted file mode 100644 index 4a770ac..0000000 --- a/VCMP-LUA/modules/mariadb/src/worker.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include "worker.hpp" -#include - -using namespace mariadb; -using namespace mariadb::concurrency; - -// -// Constructors -// -worker::worker() - : m_keep_handle(false), - m_handle(0), - m_status(status::removed), - m_command(command::query), - m_result(0) {} - -worker::worker(account_ref& account, handle handle, bool keep_handle, command::type command, - const std::string& query) - : m_keep_handle(keep_handle), - m_handle(handle), - m_status(handle > 0 ? status::waiting : status::removed), - m_command(command), - m_result(0), - m_query(query), - m_account(account) {} - -worker::worker(account_ref& account, handle handle, bool keep_handle, command::type command, - statement_ref& statement) - : m_keep_handle(keep_handle), - m_handle(handle), - m_status(handle > 0 ? status::waiting : status::removed), - m_command(command), - m_result(0), - m_account(account), - m_statement(statement) {} - -// -// Get informations -// -status::type worker::status() const { return m_status; } - -bool worker::keep_handle() const { return m_keep_handle; } - -mariadb::handle worker::get_handle() const { return m_handle; } - -// -// Get result / result_set -// -u64 worker::result() const { return m_result; } - -result_set_ref worker::result_set() const { return m_result_set; } - -// -// Do the actual job -// -void worker::execute() { - m_status = status::executing; - - try { - connection_ref connection = - m_statement ? m_statement->m_connection : connection::create(m_account); - - // - // Make sure auto commit mode is on before continuing... - // - connection->set_auto_commit(true); - connection->connect(); - - switch (m_command) { - case command::execute: - if (m_statement) - m_result = m_statement->execute(); - else - m_result = connection->execute(m_query.c_str()); - break; - - case command::insert: - if (m_statement) - m_result = m_statement->insert(); - else - m_result = connection->insert(m_query.c_str()); - break; - - case command::query: - if (m_statement) - m_result_set = m_statement->query(); - else - m_result_set = connection->query(m_query.c_str()); - break; - } - - m_status = status::succeed; - } catch (const std::exception& e) { - std::cout << e.what() << std::endl; - m_status = status::failed; - } -} diff --git a/VCMP-LUA/modules/mariadb/src/worker.hpp b/VCMP-LUA/modules/mariadb/src/worker.hpp deleted file mode 100644 index bc5b02f..0000000 --- a/VCMP-LUA/modules/mariadb/src/worker.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// -// M A R I A D B + + -// -// Copyright Sylvain Rochette Langlois 2013, -// Frantisek Boranek 2015, -// The ViaDuck Project 2016 - 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef _MARIADB_WORKER_HPP_ -#define _MARIADB_WORKER_HPP_ - -#include -#include - -namespace mariadb { -using namespace concurrency; - -namespace command { -enum type { execute, insert, query }; -} - -// -// Worker entity used by concurrency namespace -// -class worker { - public: - // - // Constructor - // - worker(); - worker(account_ref& account, handle hnd, bool keep_handle, command::type command, - const std::string& query); - worker(account_ref& account, handle hnd, bool keep_handle, command::type command, - statement_ref& statement); - - // - // Get informations - // - status::type status() const; - handle get_handle() const; - bool keep_handle() const; - - // - // Get result / result_set - // - u64 result() const; - result_set_ref result_set() const; - - // - // Do the actual job - // - void execute(); - - private: - bool m_keep_handle; - handle m_handle; - status::type m_status; - command::type m_command; - u64 m_result; - std::string m_query; - account_ref m_account; - result_set_ref m_result_set; - statement_ref m_statement; -}; -} - -#endif diff --git a/VCMP-LUA/modules/postgresql/include/ecpg_config.h b/VCMP-LUA/modules/postgresql/include/ecpg_config.h new file mode 100644 index 0000000..1fcc971 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/ecpg_config.h @@ -0,0 +1,13 @@ +/* + * Autogenerated by the Meson build system. + * Do not edit, your changes will be lost. + */ + +#pragma once + +#define ENABLE_THREAD_SAFETY 1 + +#define SIZEOF_LONG 4 + +#define SIZEOF_LONG_LONG 8 + diff --git a/VCMP-LUA/modules/postgresql/include/ecpg_informix.h b/VCMP-LUA/modules/postgresql/include/ecpg_informix.h new file mode 100644 index 0000000..5d918c3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/ecpg_informix.h @@ -0,0 +1,90 @@ +/* + * This file contains stuff needed to be as compatible to Informix as possible. + * src/interfaces/ecpg/include/ecpg_informix.h + */ +#ifndef _ECPG_INFORMIX_H +#define _ECPG_INFORMIX_H + +#include +#include +#include +#include +#include + +#define SQLNOTFOUND 100 + +#define ECPG_INFORMIX_NUM_OVERFLOW -1200 +#define ECPG_INFORMIX_NUM_UNDERFLOW -1201 +#define ECPG_INFORMIX_DIVIDE_ZERO -1202 +#define ECPG_INFORMIX_BAD_YEAR -1204 +#define ECPG_INFORMIX_BAD_MONTH -1205 +#define ECPG_INFORMIX_BAD_DAY -1206 +#define ECPG_INFORMIX_ENOSHORTDATE -1209 +#define ECPG_INFORMIX_DATE_CONVERT -1210 +#define ECPG_INFORMIX_OUT_OF_MEMORY -1211 +#define ECPG_INFORMIX_ENOTDMY -1212 +#define ECPG_INFORMIX_BAD_NUMERIC -1213 +#define ECPG_INFORMIX_BAD_EXPONENT -1216 +#define ECPG_INFORMIX_BAD_DATE -1218 +#define ECPG_INFORMIX_EXTRA_CHARS -1264 + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern int rdatestr(date d, char *str); +extern void rtoday(date * d); +extern int rjulmdy(date d, short *mdy); +extern int rdefmtdate(date * d, const char *fmt, const char *str); +extern int rfmtdate(date d, const char *fmt, char *str); +extern int rmdyjul(short *mdy, date * d); +extern int rstrdate(const char *str, date * d); +extern int rdayofweek(date d); + +extern int rfmtlong(long lng_val, const char *fmt, char *outbuf); +extern int rgetmsg(int msgnum, char *s, int maxsize); +extern int risnull(int t, const char *ptr); +extern int rsetnull(int t, char *ptr); +extern int rtypalign(int offset, int type); +extern int rtypmsize(int type, int len); +extern int rtypwidth(int sqltype, int sqllen); +extern void rupshift(char *str); + +extern int byleng(char *str, int len); +extern void ldchar(char *src, int len, char *dest); + +extern void ECPG_informix_set_var(int number, void *pointer, int lineno); +extern void *ECPG_informix_get_var(int number); +extern void ECPG_informix_reset_sqlca(void); + +/* Informix defines these in decimal.h */ +int decadd(decimal *arg1, decimal *arg2, decimal *sum); +int deccmp(decimal *arg1, decimal *arg2); +void deccopy(decimal *src, decimal *target); +int deccvasc(const char *cp, int len, decimal *np); +int deccvdbl(double dbl, decimal *np); +int deccvint(int in, decimal *np); +int deccvlong(long lng, decimal *np); +int decdiv(decimal *n1, decimal *n2, decimal *result); +int decmul(decimal *n1, decimal *n2, decimal *result); +int decsub(decimal *n1, decimal *n2, decimal *result); +int dectoasc(decimal *np, char *cp, int len, int right); +int dectodbl(decimal *np, double *dblp); +int dectoint(decimal *np, int *ip); +int dectolong(decimal *np, long *lngp); + +/* Informix defines these in datetime.h */ +extern void dtcurrent(timestamp * ts); +extern int dtcvasc(char *str, timestamp * ts); +extern int dtsub(timestamp * ts1, timestamp * ts2, interval * iv); +extern int dttoasc(timestamp * ts, char *output); +extern int dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr); +extern int intoasc(interval * i, char *str); +extern int dtcvfmtasc(char *inbuf, char *fmtstr, timestamp * dtvalue); + +#ifdef __cplusplus +} +#endif + +#endif /* ndef _ECPG_INFORMIX_H */ diff --git a/VCMP-LUA/modules/postgresql/include/ecpgerrno.h b/VCMP-LUA/modules/postgresql/include/ecpgerrno.h new file mode 100644 index 0000000..c4bc526 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/ecpgerrno.h @@ -0,0 +1,79 @@ +/* src/interfaces/ecpg/include/ecpgerrno.h */ + +#ifndef _ECPG_ERRNO_H +#define _ECPG_ERRNO_H + +#include + +/* This is a list of all error codes the embedded SQL program can return */ +#define ECPG_NO_ERROR 0 +#define ECPG_NOT_FOUND 100 + +/* system error codes returned by ecpglib get the correct number, + * but are made negative + */ +#define ECPG_OUT_OF_MEMORY -ENOMEM + +/* first we have a set of ecpg messages, they start at 200 */ +#define ECPG_UNSUPPORTED -200 +#define ECPG_TOO_MANY_ARGUMENTS -201 +#define ECPG_TOO_FEW_ARGUMENTS -202 +#define ECPG_TOO_MANY_MATCHES -203 +#define ECPG_INT_FORMAT -204 +#define ECPG_UINT_FORMAT -205 +#define ECPG_FLOAT_FORMAT -206 +#define ECPG_NUMERIC_FORMAT -207 +#define ECPG_INTERVAL_FORMAT -208 +#define ECPG_DATE_FORMAT -209 +#define ECPG_TIMESTAMP_FORMAT -210 +#define ECPG_CONVERT_BOOL -211 +#define ECPG_EMPTY -212 +#define ECPG_MISSING_INDICATOR -213 +#define ECPG_NO_ARRAY -214 +#define ECPG_DATA_NOT_ARRAY -215 +#define ECPG_ARRAY_INSERT -216 + +#define ECPG_NO_CONN -220 +#define ECPG_NOT_CONN -221 + +#define ECPG_INVALID_STMT -230 + +/* dynamic SQL related */ +#define ECPG_UNKNOWN_DESCRIPTOR -240 +#define ECPG_INVALID_DESCRIPTOR_INDEX -241 +#define ECPG_UNKNOWN_DESCRIPTOR_ITEM -242 +#define ECPG_VAR_NOT_NUMERIC -243 +#define ECPG_VAR_NOT_CHAR -244 + +/* finally the backend error messages, they start at 400 */ +#define ECPG_PGSQL -400 +#define ECPG_TRANS -401 +#define ECPG_CONNECT -402 +#define ECPG_DUPLICATE_KEY -403 +#define ECPG_SUBSELECT_NOT_ONE -404 + +/* for compatibility we define some different error codes for the same error + * if adding a new one make sure to not double define it */ +#define ECPG_INFORMIX_DUPLICATE_KEY -239 +#define ECPG_INFORMIX_SUBSELECT_NOT_ONE -284 + +/* backend WARNINGs, starting at 600 */ +#define ECPG_WARNING_UNRECOGNIZED -600 + /* WARNING: (transaction aborted): queries ignored until END */ + + /* + * WARNING: current transaction is aborted, queries ignored until end of + * transaction block + */ +#define ECPG_WARNING_QUERY_IGNORED -601 + /* WARNING: PerformPortalClose: portal "*" not found */ +#define ECPG_WARNING_UNKNOWN_PORTAL -602 + /* WARNING: BEGIN: already a transaction in progress */ +#define ECPG_WARNING_IN_TRANSACTION -603 + /* WARNING: AbortTransaction and not in in-progress state */ + /* WARNING: COMMIT: no transaction in progress */ +#define ECPG_WARNING_NO_TRANSACTION -604 + /* WARNING: BlankPortalAssignName: portal * already exists */ +#define ECPG_WARNING_PORTAL_EXISTS -605 + +#endif /* !_ECPG_ERRNO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/ecpglib.h b/VCMP-LUA/modules/postgresql/include/ecpglib.h new file mode 100644 index 0000000..dbf3cc3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/ecpglib.h @@ -0,0 +1,79 @@ +/* + * Client-visible declarations for ecpglib + * + * src/interfaces/ecpg/include/ecpglib.h + */ + +#ifndef _ECPGLIB_H +#define _ECPGLIB_H + +#include +#include + +#include "ecpg_config.h" +#include "ecpgtype.h" +#include "libpq-fe.h" +#include "sqlca.h" + + +#ifdef __cplusplus +extern "C" +{ +#endif + +void ECPGdebug(int n, FILE *dbgs); +bool ECPGstatus(int lineno, const char *connection_name); +bool ECPGsetcommit(int lineno, const char *mode, const char *connection_name); +bool ECPGsetconn(int lineno, const char *connection_name); +bool ECPGconnect(int lineno, int c, const char *name, const char *user, + const char *passwd, const char *connection_name, int autocommit); +bool ECPGdo(const int lineno, const int compat, const int force_indicator, + const char *connection_name, const bool questionmarks, + const int st, const char *query,...); +bool ECPGtrans(int lineno, const char *connection_name, const char *transaction); +bool ECPGdisconnect(int lineno, const char *connection_name); +bool ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, + const char *name, const char *variable); +bool ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name); +bool ECPGdeallocate_all(int lineno, int compat, const char *connection_name); +char *ECPGprepared_statement(const char *connection_name, const char *name, int lineno); +PGconn *ECPGget_PGconn(const char *connection_name); +PGTransactionStatusType ECPGtransactionStatus(const char *connection_name); + + /* print an error message */ +void sqlprint(void); + +/* define this for simplicity as well as compatibility */ + +#define SQLCODE sqlca.sqlcode +#define SQLSTATE sqlca.sqlstate + +/* dynamic SQL */ + +bool ECPGdo_descriptor(int line, const char *connection, + const char *descriptor, const char *query); +bool ECPGdeallocate_desc(int line, const char *name); +bool ECPGallocate_desc(int line, const char *name); +bool ECPGget_desc_header(int lineno, const char *desc_name, int *count); +bool ECPGget_desc(int lineno, const char *desc_name, int index,...); +bool ECPGset_desc_header(int lineno, const char *desc_name, int count); +bool ECPGset_desc(int lineno, const char *desc_name, int index,...); + +void ECPGset_noind_null(enum ECPGttype type, void *ptr); +bool ECPGis_noind_null(enum ECPGttype type, const void *ptr); +bool ECPGdescribe(int line, int compat, bool input, + const char *connection_name, const char *stmt_name,...); + +void ECPGset_var(int number, void *pointer, int lineno); +void *ECPGget_var(int number); + +/* dynamic result allocation */ +void ECPGfree_auto_mem(void); + +void ecpg_pthreads_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _ECPGLIB_H */ diff --git a/VCMP-LUA/modules/postgresql/include/ecpgtype.h b/VCMP-LUA/modules/postgresql/include/ecpgtype.h new file mode 100644 index 0000000..3a57508 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/ecpgtype.h @@ -0,0 +1,109 @@ +/* + * This file implements a data structure that is built and maintained by the + * preprocessor. + * + * All types that can be handled for host variable declarations has to + * be handled eventually. + * + * src/interfaces/ecpg/include/ecpgtype.h + */ + +/* + * Here are all the types that we are to handle. Note that it is the type + * that is registered and that has nothing whatsoever to do with the storage + * class. + * + * Simple types + * integers: char, short, int, long (signed and unsigned) + * floats: float, double + * + * Complex types: + * VARCHAR, VARCHAR2 - Strings with length (maxlen is given in the declaration) + * Arrays of simple types and of VARCHAR, VARCHAR2 (size given in declaration) + * Records build of simple types, arrays and other structs. + * + * Complicating things: + * typedefs and struct names! + * + * Conclusion: + * This is a typically recursive definition. A structure of typed list elements + * would probably work fine: + */ + +#ifndef _ECPGTYPE_H +#define _ECPGTYPE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +enum ECPGttype +{ + ECPGt_char = 1, ECPGt_unsigned_char, ECPGt_short, ECPGt_unsigned_short, + ECPGt_int, ECPGt_unsigned_int, ECPGt_long, ECPGt_unsigned_long, + ECPGt_long_long, ECPGt_unsigned_long_long, + ECPGt_bool, + ECPGt_float, ECPGt_double, + ECPGt_varchar, ECPGt_varchar2, + ECPGt_numeric, /* this is a decimal that stores its digits in + * a malloced array */ + ECPGt_decimal, /* this is a decimal that stores its digits in + * a fixed array */ + ECPGt_date, + ECPGt_timestamp, + ECPGt_interval, + ECPGt_array, + ECPGt_struct, + ECPGt_union, + ECPGt_descriptor, /* sql descriptor, no C variable */ + ECPGt_char_variable, + ECPGt_const, /* a constant is needed sometimes */ + ECPGt_EOIT, /* End of insert types. */ + ECPGt_EORT, /* End of result types. */ + ECPGt_NO_INDICATOR, /* no indicator */ + ECPGt_string, /* trimmed (char *) type */ + ECPGt_sqlda, /* C struct descriptor */ + ECPGt_bytea +}; + + /* descriptor items */ +enum ECPGdtype +{ + ECPGd_count = 1, + ECPGd_data, + ECPGd_di_code, + ECPGd_di_precision, + ECPGd_indicator, + ECPGd_key_member, + ECPGd_length, + ECPGd_name, + ECPGd_nullable, + ECPGd_octet, + ECPGd_precision, + ECPGd_ret_length, + ECPGd_ret_octet, + ECPGd_scale, + ECPGd_type, + ECPGd_EODT, /* End of descriptor types. */ + ECPGd_cardinality +}; + +#define IS_SIMPLE_TYPE(type) (((type) >= ECPGt_char && (type) <= ECPGt_interval) || ((type) == ECPGt_string) || ((type) == ECPGt_bytea)) + +/* we also have to handle different statement types */ +enum ECPG_statement_type +{ + ECPGst_normal, + ECPGst_execute, + ECPGst_exec_immediate, + ECPGst_prepnormal, + ECPGst_prepare, + ECPGst_exec_with_exprlist +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _ECPGTYPE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/libpq-events.h b/VCMP-LUA/modules/postgresql/include/libpq-events.h new file mode 100644 index 0000000..38dba29 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/libpq-events.h @@ -0,0 +1,94 @@ +/*------------------------------------------------------------------------- + * + * libpq-events.h + * This file contains definitions that are useful to applications + * that invoke the libpq "events" API, but are not interesting to + * ordinary users of libpq. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/interfaces/libpq/libpq-events.h + * + *------------------------------------------------------------------------- + */ + +#ifndef LIBPQ_EVENTS_H +#define LIBPQ_EVENTS_H + +#include "libpq-fe.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Callback Event Ids */ +typedef enum +{ + PGEVT_REGISTER, + PGEVT_CONNRESET, + PGEVT_CONNDESTROY, + PGEVT_RESULTCREATE, + PGEVT_RESULTCOPY, + PGEVT_RESULTDESTROY +} PGEventId; + +typedef struct +{ + PGconn *conn; +} PGEventRegister; + +typedef struct +{ + PGconn *conn; +} PGEventConnReset; + +typedef struct +{ + PGconn *conn; +} PGEventConnDestroy; + +typedef struct +{ + PGconn *conn; + PGresult *result; +} PGEventResultCreate; + +typedef struct +{ + const PGresult *src; + PGresult *dest; +} PGEventResultCopy; + +typedef struct +{ + PGresult *result; +} PGEventResultDestroy; + +typedef int (*PGEventProc) (PGEventId evtId, void *evtInfo, void *passThrough); + +/* Registers an event proc with the given PGconn. */ +extern int PQregisterEventProc(PGconn *conn, PGEventProc proc, + const char *name, void *passThrough); + +/* Sets the PGconn instance data for the provided proc to data. */ +extern int PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data); + +/* Gets the PGconn instance data for the provided proc. */ +extern void *PQinstanceData(const PGconn *conn, PGEventProc proc); + +/* Sets the PGresult instance data for the provided proc to data. */ +extern int PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data); + +/* Gets the PGresult instance data for the provided proc. */ +extern void *PQresultInstanceData(const PGresult *result, PGEventProc proc); + +/* Fires RESULTCREATE events for an application-created PGresult. */ +extern int PQfireResultCreateEvents(PGconn *conn, PGresult *res); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBPQ_EVENTS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/libpq-fe.h b/VCMP-LUA/modules/postgresql/include/libpq-fe.h new file mode 100644 index 0000000..877a648 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/libpq-fe.h @@ -0,0 +1,837 @@ +/*------------------------------------------------------------------------- + * + * libpq-fe.h + * This file contains definitions for structures and + * externs for functions used by frontend postgres applications. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/interfaces/libpq/libpq-fe.h + * + *------------------------------------------------------------------------- + */ + +#ifndef LIBPQ_FE_H +#define LIBPQ_FE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include +#include + +/* + * postgres_ext.h defines the backend's externally visible types, + * such as Oid. + */ +#include "postgres_ext.h" + +/* + * These symbols may be used in compile-time #ifdef tests for the availability + * of v14-and-newer libpq features. + */ +/* Features added in PostgreSQL v14: */ +/* Indicates presence of PQenterPipelineMode and friends */ +#define LIBPQ_HAS_PIPELINING 1 +/* Indicates presence of PQsetTraceFlags; also new PQtrace output format */ +#define LIBPQ_HAS_TRACE_FLAGS 1 + +/* Features added in PostgreSQL v15: */ +/* Indicates that PQsslAttribute(NULL, "library") is useful */ +#define LIBPQ_HAS_SSL_LIBRARY_DETECTION 1 + +/* Features added in PostgreSQL v17: */ +/* Indicates presence of PGcancelConn typedef and associated routines */ +#define LIBPQ_HAS_ASYNC_CANCEL 1 +/* Indicates presence of PQchangePassword */ +#define LIBPQ_HAS_CHANGE_PASSWORD 1 +/* Indicates presence of PQsetChunkedRowsMode, PGRES_TUPLES_CHUNK */ +#define LIBPQ_HAS_CHUNK_MODE 1 +/* Indicates presence of PQclosePrepared, PQclosePortal, etc */ +#define LIBPQ_HAS_CLOSE_PREPARED 1 +/* Indicates presence of PQsendPipelineSync */ +#define LIBPQ_HAS_SEND_PIPELINE_SYNC 1 +/* Indicates presence of PQsocketPoll, PQgetCurrentTimeUSec */ +#define LIBPQ_HAS_SOCKET_POLL 1 + +/* Features added in PostgreSQL v18: */ +/* Indicates presence of PQfullProtocolVersion */ +#define LIBPQ_HAS_FULL_PROTOCOL_VERSION 1 +/* Indicates presence of the PQAUTHDATA_PROMPT_OAUTH_DEVICE authdata hook */ +#define LIBPQ_HAS_PROMPT_OAUTH_DEVICE 1 + +/* + * Option flags for PQcopyResult + */ +#define PG_COPYRES_ATTRS 0x01 +#define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */ +#define PG_COPYRES_EVENTS 0x04 +#define PG_COPYRES_NOTICEHOOKS 0x08 + +/* Application-visible enum types */ + +/* + * Although it is okay to add to these lists, values which become unused + * should never be removed, nor should constants be redefined - that would + * break compatibility with existing code. + */ + +typedef enum +{ + CONNECTION_OK, + CONNECTION_BAD, + /* Non-blocking mode only below here */ + + /* + * The existence of these should never be relied upon - they should only + * be used for user feedback or similar purposes. + */ + CONNECTION_STARTED, /* Waiting for connection to be made. */ + CONNECTION_MADE, /* Connection OK; waiting to send. */ + CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the + * postmaster. */ + CONNECTION_AUTH_OK, /* Received authentication; waiting for + * backend startup. */ + CONNECTION_SETENV, /* This state is no longer used. */ + CONNECTION_SSL_STARTUP, /* Performing SSL handshake. */ + CONNECTION_NEEDED, /* Internal state: connect() needed. */ + CONNECTION_CHECK_WRITABLE, /* Checking if session is read-write. */ + CONNECTION_CONSUME, /* Consuming any extra messages. */ + CONNECTION_GSS_STARTUP, /* Negotiating GSSAPI. */ + CONNECTION_CHECK_TARGET, /* Internal state: checking target server + * properties. */ + CONNECTION_CHECK_STANDBY, /* Checking if server is in standby mode. */ + CONNECTION_ALLOCATED, /* Waiting for connection attempt to be + * started. */ + CONNECTION_AUTHENTICATING, /* Authentication is in progress with some + * external system. */ +} ConnStatusType; + +typedef enum +{ + PGRES_POLLING_FAILED = 0, + PGRES_POLLING_READING, /* These two indicate that one may */ + PGRES_POLLING_WRITING, /* use select before polling again. */ + PGRES_POLLING_OK, + PGRES_POLLING_ACTIVE /* unused; keep for backwards compatibility */ +} PostgresPollingStatusType; + +typedef enum +{ + PGRES_EMPTY_QUERY = 0, /* empty query string was executed */ + PGRES_COMMAND_OK, /* a query command that doesn't return + * anything was executed properly by the + * backend */ + PGRES_TUPLES_OK, /* a query command that returns tuples was + * executed properly by the backend, PGresult + * contains the result tuples */ + PGRES_COPY_OUT, /* Copy Out data transfer in progress */ + PGRES_COPY_IN, /* Copy In data transfer in progress */ + PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the + * backend */ + PGRES_NONFATAL_ERROR, /* notice or warning message */ + PGRES_FATAL_ERROR, /* query failed */ + PGRES_COPY_BOTH, /* Copy In/Out data transfer in progress */ + PGRES_SINGLE_TUPLE, /* single tuple from larger resultset */ + PGRES_PIPELINE_SYNC, /* pipeline synchronization point */ + PGRES_PIPELINE_ABORTED, /* Command didn't run because of an abort + * earlier in a pipeline */ + PGRES_TUPLES_CHUNK /* chunk of tuples from larger resultset */ +} ExecStatusType; + +typedef enum +{ + PQTRANS_IDLE, /* connection idle */ + PQTRANS_ACTIVE, /* command in progress */ + PQTRANS_INTRANS, /* idle, within transaction block */ + PQTRANS_INERROR, /* idle, within failed transaction */ + PQTRANS_UNKNOWN /* cannot determine status */ +} PGTransactionStatusType; + +typedef enum +{ + PQERRORS_TERSE, /* single-line error messages */ + PQERRORS_DEFAULT, /* recommended style */ + PQERRORS_VERBOSE, /* all the facts, ma'am */ + PQERRORS_SQLSTATE /* only error severity and SQLSTATE code */ +} PGVerbosity; + +typedef enum +{ + PQSHOW_CONTEXT_NEVER, /* never show CONTEXT field */ + PQSHOW_CONTEXT_ERRORS, /* show CONTEXT for errors only (default) */ + PQSHOW_CONTEXT_ALWAYS /* always show CONTEXT field */ +} PGContextVisibility; + +/* + * PGPing - The ordering of this enum should not be altered because the + * values are exposed externally via pg_isready. + */ + +typedef enum +{ + PQPING_OK, /* server is accepting connections */ + PQPING_REJECT, /* server is alive but rejecting connections */ + PQPING_NO_RESPONSE, /* could not establish connection */ + PQPING_NO_ATTEMPT /* connection not attempted (bad params) */ +} PGPing; + +/* + * PGpipelineStatus - Current status of pipeline mode + */ +typedef enum +{ + PQ_PIPELINE_OFF, + PQ_PIPELINE_ON, + PQ_PIPELINE_ABORTED +} PGpipelineStatus; + +typedef enum +{ + PQAUTHDATA_PROMPT_OAUTH_DEVICE, /* user must visit a device-authorization + * URL */ + PQAUTHDATA_OAUTH_BEARER_TOKEN, /* server requests an OAuth Bearer token */ +} PGauthData; + +/* PGconn encapsulates a connection to the backend. + * The contents of this struct are not supposed to be known to applications. + */ +typedef struct pg_conn PGconn; + +/* PGcancelConn encapsulates a cancel connection to the backend. + * The contents of this struct are not supposed to be known to applications. + */ +typedef struct pg_cancel_conn PGcancelConn; + +/* PGresult encapsulates the result of a query (or more precisely, of a single + * SQL command --- a query string given to PQsendQuery can contain multiple + * commands and thus return multiple PGresult objects). + * The contents of this struct are not supposed to be known to applications. + */ +typedef struct pg_result PGresult; + +/* PGcancel encapsulates the information needed to cancel a running + * query on an existing connection. + * The contents of this struct are not supposed to be known to applications. + */ +typedef struct pg_cancel PGcancel; + +/* PGnotify represents the occurrence of a NOTIFY message. + * Ideally this would be an opaque typedef, but it's so simple that it's + * unlikely to change. + * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's, + * whereas in earlier versions it was always your own backend's PID. + */ +typedef struct pgNotify +{ + char *relname; /* notification condition name */ + int be_pid; /* process ID of notifying server process */ + char *extra; /* notification parameter */ + /* Fields below here are private to libpq; apps should not use 'em */ + struct pgNotify *next; /* list link */ +} PGnotify; + +/* pg_usec_time_t is like time_t, but with microsecond resolution */ +typedef int64_t pg_usec_time_t; + +/* Function types for notice-handling callbacks */ +typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res); +typedef void (*PQnoticeProcessor) (void *arg, const char *message); + +/* Print options for PQprint() */ +typedef char pqbool; + +typedef struct _PQprintOpt +{ + pqbool header; /* print output field headings and row count */ + pqbool align; /* fill align the fields */ + pqbool standard; /* old brain dead format */ + pqbool html3; /* output html tables */ + pqbool expanded; /* expand tables */ + pqbool pager; /* use pager for output if needed */ + char *fieldSep; /* field separator */ + char *tableOpt; /* insert to HTML
*/ + char *caption; /* HTML
*/ + char **fieldName; /* null terminated array of replacement field + * names */ +} PQprintOpt; + +/* ---------------- + * Structure for the conninfo parameter definitions returned by PQconndefaults + * or PQconninfoParse. + * + * All fields except "val" point at static strings which must not be altered. + * "val" is either NULL or a malloc'd current-value string. PQconninfoFree() + * will release both the val strings and the PQconninfoOption array itself. + * ---------------- + */ +typedef struct _PQconninfoOption +{ + char *keyword; /* The keyword of the option */ + char *envvar; /* Fallback environment variable name */ + char *compiled; /* Fallback compiled in default value */ + char *val; /* Option's current value, or NULL */ + char *label; /* Label for field in connect dialog */ + char *dispchar; /* Indicates how to display this field in a + * connect dialog. Values are: "" Display + * entered value as is "*" Password field - + * hide value "D" Debug option - don't show + * by default */ + int dispsize; /* Field size in characters for dialog */ +} PQconninfoOption; + +/* ---------------- + * PQArgBlock -- structure for PQfn() arguments + * ---------------- + */ +typedef struct +{ + int len; + int isint; + union + { + int *ptr; /* can't use void (dec compiler barfs) */ + int integer; + } u; +} PQArgBlock; + +/* ---------------- + * PGresAttDesc -- Data about a single attribute (column) of a query result + * ---------------- + */ +typedef struct pgresAttDesc +{ + char *name; /* column name */ + Oid tableid; /* source table, if known */ + int columnid; /* source column, if known */ + int format; /* format code for value (text/binary) */ + Oid typid; /* type id */ + int typlen; /* type size */ + int atttypmod; /* type-specific modifier info */ +} PGresAttDesc; + +/* ---------------- + * Exported functions of libpq + * ---------------- + */ + +/* === in fe-connect.c === */ + +/* make a new client connection to the backend */ +/* Asynchronous (non-blocking) */ +extern PGconn *PQconnectStart(const char *conninfo); +extern PGconn *PQconnectStartParams(const char *const *keywords, + const char *const *values, int expand_dbname); +extern PostgresPollingStatusType PQconnectPoll(PGconn *conn); + +/* Synchronous (blocking) */ +extern PGconn *PQconnectdb(const char *conninfo); +extern PGconn *PQconnectdbParams(const char *const *keywords, + const char *const *values, int expand_dbname); +extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport, + const char *pgoptions, const char *pgtty, + const char *dbName, + const char *login, const char *pwd); + +#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \ + PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL) + +/* close the current connection and free the PGconn data structure */ +extern void PQfinish(PGconn *conn); + +/* get info about connection options known to PQconnectdb */ +extern PQconninfoOption *PQconndefaults(void); + +/* parse connection options in same way as PQconnectdb */ +extern PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg); + +/* return the connection options used by a live connection */ +extern PQconninfoOption *PQconninfo(PGconn *conn); + +/* free the data structure returned by PQconndefaults() or PQconninfoParse() */ +extern void PQconninfoFree(PQconninfoOption *connOptions); + +/* + * close the current connection and reestablish a new one with the same + * parameters + */ +/* Asynchronous (non-blocking) */ +extern int PQresetStart(PGconn *conn); +extern PostgresPollingStatusType PQresetPoll(PGconn *conn); + +/* Synchronous (blocking) */ +extern void PQreset(PGconn *conn); + +/* Create a PGcancelConn that's used to cancel a query on the given PGconn */ +extern PGcancelConn *PQcancelCreate(PGconn *conn); + +/* issue a cancel request in a non-blocking manner */ +extern int PQcancelStart(PGcancelConn *cancelConn); + +/* issue a blocking cancel request */ +extern int PQcancelBlocking(PGcancelConn *cancelConn); + +/* poll a non-blocking cancel request */ +extern PostgresPollingStatusType PQcancelPoll(PGcancelConn *cancelConn); +extern ConnStatusType PQcancelStatus(const PGcancelConn *cancelConn); +extern int PQcancelSocket(const PGcancelConn *cancelConn); +extern char *PQcancelErrorMessage(const PGcancelConn *cancelConn); +extern void PQcancelReset(PGcancelConn *cancelConn); +extern void PQcancelFinish(PGcancelConn *cancelConn); + + +/* request a cancel structure */ +extern PGcancel *PQgetCancel(PGconn *conn); + +/* free a cancel structure */ +extern void PQfreeCancel(PGcancel *cancel); + +/* deprecated version of PQcancelBlocking, but one which is signal-safe */ +extern int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize); + +/* deprecated version of PQcancel; not thread-safe */ +extern int PQrequestCancel(PGconn *conn); + +/* Accessor functions for PGconn objects */ +extern char *PQdb(const PGconn *conn); +extern char *PQuser(const PGconn *conn); +extern char *PQpass(const PGconn *conn); +extern char *PQhost(const PGconn *conn); +extern char *PQhostaddr(const PGconn *conn); +extern char *PQport(const PGconn *conn); +extern char *PQtty(const PGconn *conn); +extern char *PQoptions(const PGconn *conn); +extern ConnStatusType PQstatus(const PGconn *conn); +extern PGTransactionStatusType PQtransactionStatus(const PGconn *conn); +extern const char *PQparameterStatus(const PGconn *conn, + const char *paramName); +extern int PQprotocolVersion(const PGconn *conn); +extern int PQfullProtocolVersion(const PGconn *conn); +extern int PQserverVersion(const PGconn *conn); +extern char *PQerrorMessage(const PGconn *conn); +extern int PQsocket(const PGconn *conn); +extern int PQbackendPID(const PGconn *conn); +extern PGpipelineStatus PQpipelineStatus(const PGconn *conn); +extern int PQconnectionNeedsPassword(const PGconn *conn); +extern int PQconnectionUsedPassword(const PGconn *conn); +extern int PQconnectionUsedGSSAPI(const PGconn *conn); +extern int PQclientEncoding(const PGconn *conn); +extern int PQsetClientEncoding(PGconn *conn, const char *encoding); + +/* SSL information functions */ +extern int PQsslInUse(PGconn *conn); +extern void *PQsslStruct(PGconn *conn, const char *struct_name); +extern const char *PQsslAttribute(PGconn *conn, const char *attribute_name); +extern const char *const *PQsslAttributeNames(PGconn *conn); + +/* Get the OpenSSL structure associated with a connection. Returns NULL for + * unencrypted connections or if any other TLS library is in use. */ +extern void *PQgetssl(PGconn *conn); + +/* Tell libpq whether it needs to initialize OpenSSL */ +extern void PQinitSSL(int do_init); + +/* More detailed way to tell libpq whether it needs to initialize OpenSSL */ +extern void PQinitOpenSSL(int do_ssl, int do_crypto); + +/* Return true if GSSAPI encryption is in use */ +extern int PQgssEncInUse(PGconn *conn); + +/* Returns GSSAPI context if GSSAPI is in use */ +extern void *PQgetgssctx(PGconn *conn); + +/* Set verbosity for PQerrorMessage and PQresultErrorMessage */ +extern PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity); + +/* Set CONTEXT visibility for PQerrorMessage and PQresultErrorMessage */ +extern PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, + PGContextVisibility show_context); + +/* Override default notice handling routines */ +extern PQnoticeReceiver PQsetNoticeReceiver(PGconn *conn, + PQnoticeReceiver proc, + void *arg); +extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, + PQnoticeProcessor proc, + void *arg); + +/* + * Used to set callback that prevents concurrent access to + * non-thread safe functions that libpq needs. + * The default implementation uses a libpq internal mutex. + * Only required for multithreaded apps that use kerberos + * both within their app and for postgresql connections. + */ +typedef void (*pgthreadlock_t) (int acquire); + +extern pgthreadlock_t PQregisterThreadLock(pgthreadlock_t newhandler); + +/* === in fe-trace.c === */ +extern void PQtrace(PGconn *conn, FILE *debug_port); +extern void PQuntrace(PGconn *conn); + +/* flags controlling trace output: */ +/* omit timestamps from each line */ +#define PQTRACE_SUPPRESS_TIMESTAMPS (1<<0) +/* redact portions of some messages, for testing frameworks */ +#define PQTRACE_REGRESS_MODE (1<<1) +extern void PQsetTraceFlags(PGconn *conn, int flags); + +/* === in fe-exec.c === */ + +/* Simple synchronous query */ +extern PGresult *PQexec(PGconn *conn, const char *query); +extern PGresult *PQexecParams(PGconn *conn, + const char *command, + int nParams, + const Oid *paramTypes, + const char *const *paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); +extern PGresult *PQprepare(PGconn *conn, const char *stmtName, + const char *query, int nParams, + const Oid *paramTypes); +extern PGresult *PQexecPrepared(PGconn *conn, + const char *stmtName, + int nParams, + const char *const *paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); + +/* Interface for multiple-result or asynchronous queries */ +#define PQ_QUERY_PARAM_MAX_LIMIT 65535 + +extern int PQsendQuery(PGconn *conn, const char *query); +extern int PQsendQueryParams(PGconn *conn, + const char *command, + int nParams, + const Oid *paramTypes, + const char *const *paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); +extern int PQsendPrepare(PGconn *conn, const char *stmtName, + const char *query, int nParams, + const Oid *paramTypes); +extern int PQsendQueryPrepared(PGconn *conn, + const char *stmtName, + int nParams, + const char *const *paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); +extern int PQsetSingleRowMode(PGconn *conn); +extern int PQsetChunkedRowsMode(PGconn *conn, int chunkSize); +extern PGresult *PQgetResult(PGconn *conn); + +/* Routines for managing an asynchronous query */ +extern int PQisBusy(PGconn *conn); +extern int PQconsumeInput(PGconn *conn); + +/* Routines for pipeline mode management */ +extern int PQenterPipelineMode(PGconn *conn); +extern int PQexitPipelineMode(PGconn *conn); +extern int PQpipelineSync(PGconn *conn); +extern int PQsendFlushRequest(PGconn *conn); +extern int PQsendPipelineSync(PGconn *conn); + +/* LISTEN/NOTIFY support */ +extern PGnotify *PQnotifies(PGconn *conn); + +/* Routines for copy in/out */ +extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes); +extern int PQputCopyEnd(PGconn *conn, const char *errormsg); +extern int PQgetCopyData(PGconn *conn, char **buffer, int async); + +/* Deprecated routines for copy in/out */ +extern int PQgetline(PGconn *conn, char *buffer, int length); +extern int PQputline(PGconn *conn, const char *string); +extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize); +extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes); +extern int PQendcopy(PGconn *conn); + +/* Set blocking/nonblocking connection to the backend */ +extern int PQsetnonblocking(PGconn *conn, int arg); +extern int PQisnonblocking(const PGconn *conn); +extern int PQisthreadsafe(void); +extern PGPing PQping(const char *conninfo); +extern PGPing PQpingParams(const char *const *keywords, + const char *const *values, int expand_dbname); + +/* Force the write buffer to be written (or at least try) */ +extern int PQflush(PGconn *conn); + +/* + * "Fast path" interface --- not really recommended for application + * use + */ +extern PGresult *PQfn(PGconn *conn, + int fnid, + int *result_buf, + int *result_len, + int result_is_int, + const PQArgBlock *args, + int nargs); + +/* Accessor functions for PGresult objects */ +extern ExecStatusType PQresultStatus(const PGresult *res); +extern char *PQresStatus(ExecStatusType status); +extern char *PQresultErrorMessage(const PGresult *res); +extern char *PQresultVerboseErrorMessage(const PGresult *res, + PGVerbosity verbosity, + PGContextVisibility show_context); +extern char *PQresultErrorField(const PGresult *res, int fieldcode); +extern int PQntuples(const PGresult *res); +extern int PQnfields(const PGresult *res); +extern int PQbinaryTuples(const PGresult *res); +extern char *PQfname(const PGresult *res, int field_num); +extern int PQfnumber(const PGresult *res, const char *field_name); +extern Oid PQftable(const PGresult *res, int field_num); +extern int PQftablecol(const PGresult *res, int field_num); +extern int PQfformat(const PGresult *res, int field_num); +extern Oid PQftype(const PGresult *res, int field_num); +extern int PQfsize(const PGresult *res, int field_num); +extern int PQfmod(const PGresult *res, int field_num); +extern char *PQcmdStatus(PGresult *res); +extern char *PQoidStatus(const PGresult *res); /* old and ugly */ +extern Oid PQoidValue(const PGresult *res); /* new and improved */ +extern char *PQcmdTuples(PGresult *res); +extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num); +extern int PQgetlength(const PGresult *res, int tup_num, int field_num); +extern int PQgetisnull(const PGresult *res, int tup_num, int field_num); +extern int PQnparams(const PGresult *res); +extern Oid PQparamtype(const PGresult *res, int param_num); + +/* Describe prepared statements and portals */ +extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt); +extern PGresult *PQdescribePortal(PGconn *conn, const char *portal); +extern int PQsendDescribePrepared(PGconn *conn, const char *stmt); +extern int PQsendDescribePortal(PGconn *conn, const char *portal); + +/* Close prepared statements and portals */ +extern PGresult *PQclosePrepared(PGconn *conn, const char *stmt); +extern PGresult *PQclosePortal(PGconn *conn, const char *portal); +extern int PQsendClosePrepared(PGconn *conn, const char *stmt); +extern int PQsendClosePortal(PGconn *conn, const char *portal); + +/* Delete a PGresult */ +extern void PQclear(PGresult *res); + +/* For freeing other alloc'd results, such as PGnotify structs */ +extern void PQfreemem(void *ptr); + +/* Exists for backward compatibility. bjm 2003-03-24 */ +#define PQfreeNotify(ptr) PQfreemem(ptr) + +/* Error when no password was given. */ +/* Note: depending on this is deprecated; use PQconnectionNeedsPassword(). */ +#define PQnoPasswordSupplied "fe_sendauth: no password supplied\n" + +/* Create and manipulate PGresults */ +extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status); +extern PGresult *PQcopyResult(const PGresult *src, int flags); +extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs); +extern void *PQresultAlloc(PGresult *res, size_t nBytes); +extern size_t PQresultMemorySize(const PGresult *res); +extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len); + +/* Quoting strings before inclusion in queries. */ +extern size_t PQescapeStringConn(PGconn *conn, + char *to, const char *from, size_t length, + int *error); +extern char *PQescapeLiteral(PGconn *conn, const char *str, size_t len); +extern char *PQescapeIdentifier(PGconn *conn, const char *str, size_t len); +extern unsigned char *PQescapeByteaConn(PGconn *conn, + const unsigned char *from, size_t from_length, + size_t *to_length); +extern unsigned char *PQunescapeBytea(const unsigned char *strtext, + size_t *retbuflen); + +/* These forms are deprecated! */ +extern size_t PQescapeString(char *to, const char *from, size_t length); +extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length, + size_t *to_length); + + + +/* === in fe-print.c === */ + +extern void PQprint(FILE *fout, /* output stream */ + const PGresult *res, + const PQprintOpt *po); /* option structure */ + +/* + * really old printing routines + */ +extern void PQdisplayTuples(const PGresult *res, + FILE *fp, /* where to send the output */ + int fillAlign, /* pad the fields with spaces */ + const char *fieldSep, /* field separator */ + int printHeader, /* display headers? */ + int quiet); + +extern void PQprintTuples(const PGresult *res, + FILE *fout, /* output stream */ + int PrintAttNames, /* print attribute names */ + int TerseOutput, /* delimiter bars */ + int colWidth); /* width of column, if 0, use + * variable width */ + + +/* === in fe-lobj.c === */ + +/* Large-object access routines */ +extern int lo_open(PGconn *conn, Oid lobjId, int mode); +extern int lo_close(PGconn *conn, int fd); +extern int lo_read(PGconn *conn, int fd, char *buf, size_t len); +extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len); +extern int lo_lseek(PGconn *conn, int fd, int offset, int whence); +extern int64_t lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence); +extern Oid lo_creat(PGconn *conn, int mode); +extern Oid lo_create(PGconn *conn, Oid lobjId); +extern int lo_tell(PGconn *conn, int fd); +extern int64_t lo_tell64(PGconn *conn, int fd); +extern int lo_truncate(PGconn *conn, int fd, size_t len); +extern int lo_truncate64(PGconn *conn, int fd, int64_t len); +extern int lo_unlink(PGconn *conn, Oid lobjId); +extern Oid lo_import(PGconn *conn, const char *filename); +extern Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId); +extern int lo_export(PGconn *conn, Oid lobjId, const char *filename); + +/* === in fe-misc.c === */ + +/* Get the version of the libpq library in use */ +extern int PQlibVersion(void); + +/* Poll a socket for reading and/or writing with an optional timeout */ +extern int PQsocketPoll(int sock, int forRead, int forWrite, + pg_usec_time_t end_time); + +/* Get current time in the form PQsocketPoll wants */ +extern pg_usec_time_t PQgetCurrentTimeUSec(void); + +/* Determine length of multibyte encoded char at *s */ +extern int PQmblen(const char *s, int encoding); + +/* Same, but not more than the distance to the end of string s */ +extern int PQmblenBounded(const char *s, int encoding); + +/* Determine display length of multibyte encoded char at *s */ +extern int PQdsplen(const char *s, int encoding); + +/* Get encoding id from environment variable PGCLIENTENCODING */ +extern int PQenv2encoding(void); + +/* === in fe-auth.c === */ + +typedef struct _PGpromptOAuthDevice +{ + const char *verification_uri; /* verification URI to visit */ + const char *user_code; /* user code to enter */ + const char *verification_uri_complete; /* optional combination of URI and + * code, or NULL */ + int expires_in; /* seconds until user code expires */ +} PGpromptOAuthDevice; + +/* + * For PGoauthBearerRequest.async(). This macro just allows clients to avoid + * depending on libpq-int.h or Winsock for the "socket" type; it's undefined + * immediately below. + */ +#ifdef _WIN32 +#define PQ_SOCKTYPE uintptr_t /* avoids depending on winsock2.h for SOCKET */ +#else +#define PQ_SOCKTYPE int +#endif + +typedef struct PGoauthBearerRequest +{ + /* Hook inputs (constant across all calls) */ + const char *openid_configuration; /* OIDC discovery URI */ + const char *scope; /* required scope(s), or NULL */ + + /* Hook outputs */ + + /*--------- + * Callback implementing a custom asynchronous OAuth flow. + * + * The callback may return + * - PGRES_POLLING_READING/WRITING, to indicate that a socket descriptor + * has been stored in *altsock and libpq should wait until it is + * readable or writable before calling back; + * - PGRES_POLLING_OK, to indicate that the flow is complete and + * request->token has been set; or + * - PGRES_POLLING_FAILED, to indicate that token retrieval has failed. + * + * This callback is optional. If the token can be obtained without + * blocking during the original call to the PQAUTHDATA_OAUTH_BEARER_TOKEN + * hook, it may be returned directly, but one of request->async or + * request->token must be set by the hook. + * + * The (PQ_SOCKTYPE *) in the signature is a placeholder for the platform's + * native socket type: (SOCKET *) on Windows, and (int *) everywhere else. + */ + PostgresPollingStatusType (*async) (PGconn *conn, + struct PGoauthBearerRequest *request, + PQ_SOCKTYPE * altsock); + + /* + * Callback to clean up custom allocations. A hook implementation may use + * this to free request->token and any resources in request->user. + * + * This is technically optional, but highly recommended, because there is + * no other indication as to when it is safe to free the token. + */ + void (*cleanup) (PGconn *conn, struct PGoauthBearerRequest *request); + + /* + * The hook should set this to the Bearer token contents for the + * connection, once the flow is completed. The token contents must remain + * available to libpq until the hook's cleanup callback is called. + */ + char *token; + + /* + * Hook-defined data. libpq will not modify this pointer across calls to + * the async callback, so it can be used to keep track of + * application-specific state. Resources allocated here should be freed by + * the cleanup callback. + */ + void *user; +} PGoauthBearerRequest; + +#undef PQ_SOCKTYPE + +extern char *PQencryptPassword(const char *passwd, const char *user); +extern char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm); +extern PGresult *PQchangePassword(PGconn *conn, const char *user, const char *passwd); + +typedef int (*PQauthDataHook_type) (PGauthData type, PGconn *conn, void *data); +extern void PQsetAuthDataHook(PQauthDataHook_type hook); +extern PQauthDataHook_type PQgetAuthDataHook(void); +extern int PQdefaultAuthDataHook(PGauthData type, PGconn *conn, void *data); + +/* === in encnames.c === */ + +extern int pg_char_to_encoding(const char *name); +extern const char *pg_encoding_to_char(int encoding); +extern int pg_valid_server_encoding_id(int encoding); + +/* === in fe-secure-openssl.c === */ + +/* Support for overriding sslpassword handling with a callback */ +typedef int (*PQsslKeyPassHook_OpenSSL_type) (char *buf, int size, PGconn *conn); +extern PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void); +extern void PQsetSSLKeyPassHook_OpenSSL(PQsslKeyPassHook_OpenSSL_type hook); +extern int PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBPQ_FE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/libpq/libpq-fs.h b/VCMP-LUA/modules/postgresql/include/libpq/libpq-fs.h new file mode 100644 index 0000000..26fa50c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/libpq/libpq-fs.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * libpq-fs.h + * definitions for using Inversion file system routines (ie, large objects) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq-fs.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_FS_H +#define LIBPQ_FS_H + +/* + * Read/write mode flags for inversion (large object) calls + */ + +#define INV_WRITE 0x00020000 +#define INV_READ 0x00040000 + +#endif /* LIBPQ_FS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/lz4.h b/VCMP-LUA/modules/postgresql/include/lz4.h new file mode 100644 index 0000000..d7cad85 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/lz4.h @@ -0,0 +1,884 @@ +/* + * LZ4 - Fast LZ compression algorithm + * Header File + * Copyright (C) 2011-2023, Yann Collet. + + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - LZ4 homepage : http://www.lz4.org + - LZ4 source repository : https://github.com/lz4/lz4 +*/ +#if defined (__cplusplus) +extern "C" { +#endif + +#ifndef LZ4_H_2983827168210 +#define LZ4_H_2983827168210 + +/* --- Dependency --- */ +#include /* size_t */ + + +/** + Introduction + + LZ4 is lossless compression algorithm, providing compression speed >500 MB/s per core, + scalable with multi-cores CPU. It features an extremely fast decoder, with speed in + multiple GB/s per core, typically reaching RAM speed limits on multi-core systems. + + The LZ4 compression library provides in-memory compression and decompression functions. + It gives full buffer control to user. + Compression can be done in: + - a single step (described as Simple Functions) + - a single step, reusing a context (described in Advanced Functions) + - unbounded multiple steps (described as Streaming compression) + + lz4.h generates and decodes LZ4-compressed blocks (doc/lz4_Block_format.md). + Decompressing such a compressed block requires additional metadata. + Exact metadata depends on exact decompression function. + For the typical case of LZ4_decompress_safe(), + metadata includes block's compressed size, and maximum bound of decompressed size. + Each application is free to encode and pass such metadata in whichever way it wants. + + lz4.h only handle blocks, it can not generate Frames. + + Blocks are different from Frames (doc/lz4_Frame_format.md). + Frames bundle both blocks and metadata in a specified manner. + Embedding metadata is required for compressed data to be self-contained and portable. + Frame format is delivered through a companion API, declared in lz4frame.h. + The `lz4` CLI can only manage frames. +*/ + +/*^*************************************************************** +* Export parameters +*****************************************************************/ +/* +* LZ4_DLL_EXPORT : +* Enable exporting of functions when building a Windows DLL +* LZ4LIB_VISIBILITY : +* Control library symbols visibility. +*/ +#ifndef LZ4LIB_VISIBILITY +# if defined(__GNUC__) && (__GNUC__ >= 4) +# define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default"))) +# else +# define LZ4LIB_VISIBILITY +# endif +#endif +#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) +# define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY +#elif 0 +# define LZ4LIB_API __declspec(dllimport) LZ4LIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ +#else +# define LZ4LIB_API LZ4LIB_VISIBILITY +#endif + +/*! LZ4_FREESTANDING : + * When this macro is set to 1, it enables "freestanding mode" that is + * suitable for typical freestanding environment which doesn't support + * standard C library. + * + * - LZ4_FREESTANDING is a compile-time switch. + * - It requires the following macros to be defined: + * LZ4_memcpy, LZ4_memmove, LZ4_memset. + * - It only enables LZ4/HC functions which don't use heap. + * All LZ4F_* functions are not supported. + * - See tests/freestanding.c to check its basic setup. + */ +#if defined(LZ4_FREESTANDING) && (LZ4_FREESTANDING == 1) +# define LZ4_HEAPMODE 0 +# define LZ4HC_HEAPMODE 0 +# define LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION 1 +# if !defined(LZ4_memcpy) +# error "LZ4_FREESTANDING requires macro 'LZ4_memcpy'." +# endif +# if !defined(LZ4_memset) +# error "LZ4_FREESTANDING requires macro 'LZ4_memset'." +# endif +# if !defined(LZ4_memmove) +# error "LZ4_FREESTANDING requires macro 'LZ4_memmove'." +# endif +#elif ! defined(LZ4_FREESTANDING) +# define LZ4_FREESTANDING 0 +#endif + + +/*------ Version ------*/ +#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */ +#define LZ4_VERSION_MINOR 10 /* for new (non-breaking) interface capabilities */ +#define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */ + +#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE) + +#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE +#define LZ4_QUOTE(str) #str +#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str) +#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION) /* requires v1.7.3+ */ + +LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version; requires v1.3.0+ */ +LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; useful to check dll version; requires v1.7.5+ */ + + +/*-************************************ +* Tuning memory usage +**************************************/ +/*! + * LZ4_MEMORY_USAGE : + * Can be selected at compile time, by setting LZ4_MEMORY_USAGE. + * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB) + * Increasing memory usage improves compression ratio, generally at the cost of speed. + * Reduced memory usage may improve speed at the cost of ratio, thanks to better cache locality. + * Default value is 14, for 16KB, which nicely fits into most L1 caches. + */ +#ifndef LZ4_MEMORY_USAGE +# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT +#endif + +/* These are absolute limits, they should not be changed by users */ +#define LZ4_MEMORY_USAGE_MIN 10 +#define LZ4_MEMORY_USAGE_DEFAULT 14 +#define LZ4_MEMORY_USAGE_MAX 20 + +#if (LZ4_MEMORY_USAGE < LZ4_MEMORY_USAGE_MIN) +# error "LZ4_MEMORY_USAGE is too small !" +#endif + +#if (LZ4_MEMORY_USAGE > LZ4_MEMORY_USAGE_MAX) +# error "LZ4_MEMORY_USAGE is too large !" +#endif + +/*-************************************ +* Simple Functions +**************************************/ +/*! LZ4_compress_default() : + * Compresses 'srcSize' bytes from buffer 'src' + * into already allocated 'dst' buffer of size 'dstCapacity'. + * Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize). + * It also runs faster, so it's a recommended setting. + * If the function cannot compress 'src' into a more limited 'dst' budget, + * compression stops *immediately*, and the function result is zero. + * In which case, 'dst' content is undefined (invalid). + * srcSize : max supported value is LZ4_MAX_INPUT_SIZE. + * dstCapacity : size of buffer 'dst' (which must be already allocated) + * @return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity) + * or 0 if compression fails + * Note : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer). + */ +LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity); + +/*! LZ4_decompress_safe() : + * @compressedSize : is the exact complete size of the compressed block. + * @dstCapacity : is the size of destination buffer (which must be already allocated), + * presumed an upper bound of decompressed size. + * @return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity) + * If destination buffer is not large enough, decoding will stop and output an error code (negative value). + * If the source stream is detected malformed, the function will stop decoding and return a negative result. + * Note 1 : This function is protected against malicious data packets : + * it will never writes outside 'dst' buffer, nor read outside 'source' buffer, + * even if the compressed block is maliciously modified to order the decoder to do these actions. + * In such case, the decoder stops immediately, and considers the compressed block malformed. + * Note 2 : compressedSize and dstCapacity must be provided to the function, the compressed block does not contain them. + * The implementation is free to send / store / derive this information in whichever way is most beneficial. + * If there is a need for a different format which bundles together both compressed data and its metadata, consider looking at lz4frame.h instead. + */ +LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity); + + +/*-************************************ +* Advanced Functions +**************************************/ +#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */ +#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16) + +/*! LZ4_compressBound() : + Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible) + This function is primarily useful for memory allocation purposes (destination buffer size). + Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example). + Note that LZ4_compress_default() compresses faster when dstCapacity is >= LZ4_compressBound(srcSize) + inputSize : max supported value is LZ4_MAX_INPUT_SIZE + return : maximum output size in a "worst case" scenario + or 0, if input size is incorrect (too large or negative) +*/ +LZ4LIB_API int LZ4_compressBound(int inputSize); + +/*! LZ4_compress_fast() : + Same as LZ4_compress_default(), but allows selection of "acceleration" factor. + The larger the acceleration value, the faster the algorithm, but also the lesser the compression. + It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed. + An acceleration value of "1" is the same as regular LZ4_compress_default() + Values <= 0 will be replaced by LZ4_ACCELERATION_DEFAULT (currently == 1, see lz4.c). + Values > LZ4_ACCELERATION_MAX will be replaced by LZ4_ACCELERATION_MAX (currently == 65537, see lz4.c). +*/ +LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); + + +/*! LZ4_compress_fast_extState() : + * Same as LZ4_compress_fast(), using an externally allocated memory space for its state. + * Use LZ4_sizeofState() to know how much memory must be allocated, + * and allocate it on 8-bytes boundaries (using `malloc()` typically). + * Then, provide this buffer as `void* state` to compression function. + */ +LZ4LIB_API int LZ4_sizeofState(void); +LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); + +/*! LZ4_compress_destSize() : + * Reverse the logic : compresses as much data as possible from 'src' buffer + * into already allocated buffer 'dst', of size >= 'dstCapacity'. + * This function either compresses the entire 'src' content into 'dst' if it's large enough, + * or fill 'dst' buffer completely with as much data as possible from 'src'. + * note: acceleration parameter is fixed to "default". + * + * *srcSizePtr : in+out parameter. Initially contains size of input. + * Will be modified to indicate how many bytes where read from 'src' to fill 'dst'. + * New value is necessarily <= input value. + * @return : Nb bytes written into 'dst' (necessarily <= dstCapacity) + * or 0 if compression fails. + * + * Note : from v1.8.2 to v1.9.1, this function had a bug (fixed in v1.9.2+): + * the produced compressed content could, in specific circumstances, + * require to be decompressed into a destination buffer larger + * by at least 1 byte than the content to decompress. + * If an application uses `LZ4_compress_destSize()`, + * it's highly recommended to update liblz4 to v1.9.2 or better. + * If this can't be done or ensured, + * the receiving decompression function should provide + * a dstCapacity which is > decompressedSize, by at least 1 byte. + * See https://github.com/lz4/lz4/issues/859 for details + */ +LZ4LIB_API int LZ4_compress_destSize(const char* src, char* dst, int* srcSizePtr, int targetDstSize); + +/*! LZ4_decompress_safe_partial() : + * Decompress an LZ4 compressed block, of size 'srcSize' at position 'src', + * into destination buffer 'dst' of size 'dstCapacity'. + * Up to 'targetOutputSize' bytes will be decoded. + * The function stops decoding on reaching this objective. + * This can be useful to boost performance + * whenever only the beginning of a block is required. + * + * @return : the number of bytes decoded in `dst` (necessarily <= targetOutputSize) + * If source stream is detected malformed, function returns a negative result. + * + * Note 1 : @return can be < targetOutputSize, if compressed block contains less data. + * + * Note 2 : targetOutputSize must be <= dstCapacity + * + * Note 3 : this function effectively stops decoding on reaching targetOutputSize, + * so dstCapacity is kind of redundant. + * This is because in older versions of this function, + * decoding operation would still write complete sequences. + * Therefore, there was no guarantee that it would stop writing at exactly targetOutputSize, + * it could write more bytes, though only up to dstCapacity. + * Some "margin" used to be required for this operation to work properly. + * Thankfully, this is no longer necessary. + * The function nonetheless keeps the same signature, in an effort to preserve API compatibility. + * + * Note 4 : If srcSize is the exact size of the block, + * then targetOutputSize can be any value, + * including larger than the block's decompressed size. + * The function will, at most, generate block's decompressed size. + * + * Note 5 : If srcSize is _larger_ than block's compressed size, + * then targetOutputSize **MUST** be <= block's decompressed size. + * Otherwise, *silent corruption will occur*. + */ +LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity); + + +/*-********************************************* +* Streaming Compression Functions +***********************************************/ +typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */ + +/*! + Note about RC_INVOKED + + - RC_INVOKED is predefined symbol of rc.exe (the resource compiler which is part of MSVC/Visual Studio). + https://docs.microsoft.com/en-us/windows/win32/menurc/predefined-macros + + - Since rc.exe is a legacy compiler, it truncates long symbol (> 30 chars) + and reports warning "RC4011: identifier truncated". + + - To eliminate the warning, we surround long preprocessor symbol with + "#if !defined(RC_INVOKED) ... #endif" block that means + "skip this block when rc.exe is trying to read it". +*/ +#if !defined(RC_INVOKED) /* https://docs.microsoft.com/en-us/windows/win32/menurc/predefined-macros */ +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) +LZ4LIB_API LZ4_stream_t* LZ4_createStream(void); +LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr); +#endif /* !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) */ +#endif + +/*! LZ4_resetStream_fast() : v1.9.0+ + * Use this to prepare an LZ4_stream_t for a new chain of dependent blocks + * (e.g., LZ4_compress_fast_continue()). + * + * An LZ4_stream_t must be initialized once before usage. + * This is automatically done when created by LZ4_createStream(). + * However, should the LZ4_stream_t be simply declared on stack (for example), + * it's necessary to initialize it first, using LZ4_initStream(). + * + * After init, start any new stream with LZ4_resetStream_fast(). + * A same LZ4_stream_t can be re-used multiple times consecutively + * and compress multiple streams, + * provided that it starts each new stream with LZ4_resetStream_fast(). + * + * LZ4_resetStream_fast() is much faster than LZ4_initStream(), + * but is not compatible with memory regions containing garbage data. + * + * Note: it's only useful to call LZ4_resetStream_fast() + * in the context of streaming compression. + * The *extState* functions perform their own resets. + * Invoking LZ4_resetStream_fast() before is redundant, and even counterproductive. + */ +LZ4LIB_API void LZ4_resetStream_fast (LZ4_stream_t* streamPtr); + +/*! LZ4_loadDict() : + * Use this function to reference a static dictionary into LZ4_stream_t. + * The dictionary must remain available during compression. + * LZ4_loadDict() triggers a reset, so any previous data will be forgotten. + * The same dictionary will have to be loaded on decompression side for successful decoding. + * Dictionary are useful for better compression of small data (KB range). + * While LZ4 itself accepts any input as dictionary, dictionary efficiency is also a topic. + * When in doubt, employ the Zstandard's Dictionary Builder. + * Loading a size of 0 is allowed, and is the same as reset. + * @return : loaded dictionary size, in bytes (note: only the last 64 KB are loaded) + */ +LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize); + +/*! LZ4_loadDictSlow() : v1.10.0+ + * Same as LZ4_loadDict(), + * but uses a bit more cpu to reference the dictionary content more thoroughly. + * This is expected to slightly improve compression ratio. + * The extra-cpu cost is likely worth it if the dictionary is re-used across multiple sessions. + * @return : loaded dictionary size, in bytes (note: only the last 64 KB are loaded) + */ +LZ4LIB_API int LZ4_loadDictSlow(LZ4_stream_t* streamPtr, const char* dictionary, int dictSize); + +/*! LZ4_attach_dictionary() : stable since v1.10.0 + * + * This allows efficient re-use of a static dictionary multiple times. + * + * Rather than re-loading the dictionary buffer into a working context before + * each compression, or copying a pre-loaded dictionary's LZ4_stream_t into a + * working LZ4_stream_t, this function introduces a no-copy setup mechanism, + * in which the working stream references @dictionaryStream in-place. + * + * Several assumptions are made about the state of @dictionaryStream. + * Currently, only states which have been prepared by LZ4_loadDict() or + * LZ4_loadDictSlow() should be expected to work. + * + * Alternatively, the provided @dictionaryStream may be NULL, + * in which case any existing dictionary stream is unset. + * + * If a dictionary is provided, it replaces any pre-existing stream history. + * The dictionary contents are the only history that can be referenced and + * logically immediately precede the data compressed in the first subsequent + * compression call. + * + * The dictionary will only remain attached to the working stream through the + * first compression call, at the end of which it is cleared. + * @dictionaryStream stream (and source buffer) must remain in-place / accessible / unchanged + * through the completion of the compression session. + * + * Note: there is no equivalent LZ4_attach_*() method on the decompression side + * because there is no initialization cost, hence no need to share the cost across multiple sessions. + * To decompress LZ4 blocks using dictionary, attached or not, + * just employ the regular LZ4_setStreamDecode() for streaming, + * or the stateless LZ4_decompress_safe_usingDict() for one-shot decompression. + */ +LZ4LIB_API void +LZ4_attach_dictionary(LZ4_stream_t* workingStream, + const LZ4_stream_t* dictionaryStream); + +/*! LZ4_compress_fast_continue() : + * Compress 'src' content using data from previously compressed blocks, for better compression ratio. + * 'dst' buffer must be already allocated. + * If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster. + * + * @return : size of compressed block + * or 0 if there is an error (typically, cannot fit into 'dst'). + * + * Note 1 : Each invocation to LZ4_compress_fast_continue() generates a new block. + * Each block has precise boundaries. + * Each block must be decompressed separately, calling LZ4_decompress_*() with relevant metadata. + * It's not possible to append blocks together and expect a single invocation of LZ4_decompress_*() to decompress them together. + * + * Note 2 : The previous 64KB of source data is __assumed__ to remain present, unmodified, at same address in memory ! + * + * Note 3 : When input is structured as a double-buffer, each buffer can have any size, including < 64 KB. + * Make sure that buffers are separated, by at least one byte. + * This construction ensures that each block only depends on previous block. + * + * Note 4 : If input buffer is a ring-buffer, it can have any size, including < 64 KB. + * + * Note 5 : After an error, the stream status is undefined (invalid), it can only be reset or freed. + */ +LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); + +/*! LZ4_saveDict() : + * If last 64KB data cannot be guaranteed to remain available at its current memory location, + * save it into a safer place (char* safeBuffer). + * This is schematically equivalent to a memcpy() followed by LZ4_loadDict(), + * but is much faster, because LZ4_saveDict() doesn't need to rebuild tables. + * @return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error. + */ +LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int maxDictSize); + + +/*-********************************************** +* Streaming Decompression Functions +* Bufferless synchronous API +************************************************/ +typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* tracking context */ + +/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() : + * creation / destruction of streaming decompression tracking context. + * A tracking context can be re-used multiple times. + */ +#if !defined(RC_INVOKED) /* https://docs.microsoft.com/en-us/windows/win32/menurc/predefined-macros */ +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) +LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void); +LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream); +#endif /* !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) */ +#endif + +/*! LZ4_setStreamDecode() : + * An LZ4_streamDecode_t context can be allocated once and re-used multiple times. + * Use this function to start decompression of a new stream of blocks. + * A dictionary can optionally be set. Use NULL or size 0 for a reset order. + * Dictionary is presumed stable : it must remain accessible and unmodified during next decompression. + * @return : 1 if OK, 0 if error + */ +LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize); + +/*! LZ4_decoderRingBufferSize() : v1.8.2+ + * Note : in a ring buffer scenario (optional), + * blocks are presumed decompressed next to each other + * up to the moment there is not enough remaining space for next block (remainingSize < maxBlockSize), + * at which stage it resumes from beginning of ring buffer. + * When setting such a ring buffer for streaming decompression, + * provides the minimum size of this ring buffer + * to be compatible with any source respecting maxBlockSize condition. + * @return : minimum ring buffer size, + * or 0 if there is an error (invalid maxBlockSize). + */ +LZ4LIB_API int LZ4_decoderRingBufferSize(int maxBlockSize); +#define LZ4_DECODER_RING_BUFFER_SIZE(maxBlockSize) (65536 + 14 + (maxBlockSize)) /* for static allocation; maxBlockSize presumed valid */ + +/*! LZ4_decompress_safe_continue() : + * This decoding function allows decompression of consecutive blocks in "streaming" mode. + * The difference with the usual independent blocks is that + * new blocks are allowed to find references into former blocks. + * A block is an unsplittable entity, and must be presented entirely to the decompression function. + * LZ4_decompress_safe_continue() only accepts one block at a time. + * It's modeled after `LZ4_decompress_safe()` and behaves similarly. + * + * @LZ4_streamDecode : decompression state, tracking the position in memory of past data + * @compressedSize : exact complete size of one compressed block. + * @dstCapacity : size of destination buffer (which must be already allocated), + * must be an upper bound of decompressed size. + * @return : number of bytes decompressed into destination buffer (necessarily <= dstCapacity) + * If destination buffer is not large enough, decoding will stop and output an error code (negative value). + * If the source stream is detected malformed, the function will stop decoding and return a negative result. + * + * The last 64KB of previously decoded data *must* remain available and unmodified + * at the memory position where they were previously decoded. + * If less than 64KB of data has been decoded, all the data must be present. + * + * Special : if decompression side sets a ring buffer, it must respect one of the following conditions : + * - Decompression buffer size is _at least_ LZ4_decoderRingBufferSize(maxBlockSize). + * maxBlockSize is the maximum size of any single block. It can have any value > 16 bytes. + * In which case, encoding and decoding buffers do not need to be synchronized. + * Actually, data can be produced by any source compliant with LZ4 format specification, and respecting maxBlockSize. + * - Synchronized mode : + * Decompression buffer size is _exactly_ the same as compression buffer size, + * and follows exactly same update rule (block boundaries at same positions), + * and decoding function is provided with exact decompressed size of each block (exception for last block of the stream), + * _then_ decoding & encoding ring buffer can have any size, including small ones ( < 64 KB). + * - Decompression buffer is larger than encoding buffer, by a minimum of maxBlockSize more bytes. + * In which case, encoding and decoding buffers do not need to be synchronized, + * and encoding ring buffer can have any size, including small ones ( < 64 KB). + * + * Whenever these conditions are not possible, + * save the last 64KB of decoded data into a safe buffer where it can't be modified during decompression, + * then indicate where this data is saved using LZ4_setStreamDecode(), before decompressing next block. +*/ +LZ4LIB_API int +LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, + const char* src, char* dst, + int srcSize, int dstCapacity); + + +/*! LZ4_decompress_safe_usingDict() : + * Works the same as + * a combination of LZ4_setStreamDecode() followed by LZ4_decompress_safe_continue() + * However, it's stateless: it doesn't need any LZ4_streamDecode_t state. + * Dictionary is presumed stable : it must remain accessible and unmodified during decompression. + * Performance tip : Decompression speed can be substantially increased + * when dst == dictStart + dictSize. + */ +LZ4LIB_API int +LZ4_decompress_safe_usingDict(const char* src, char* dst, + int srcSize, int dstCapacity, + const char* dictStart, int dictSize); + +/*! LZ4_decompress_safe_partial_usingDict() : + * Behaves the same as LZ4_decompress_safe_partial() + * with the added ability to specify a memory segment for past data. + * Performance tip : Decompression speed can be substantially increased + * when dst == dictStart + dictSize. + */ +LZ4LIB_API int +LZ4_decompress_safe_partial_usingDict(const char* src, char* dst, + int compressedSize, + int targetOutputSize, int maxOutputSize, + const char* dictStart, int dictSize); + +#endif /* LZ4_H_2983827168210 */ + + +/*^************************************* + * !!!!!! STATIC LINKING ONLY !!!!!! + ***************************************/ + +/*-**************************************************************************** + * Experimental section + * + * Symbols declared in this section must be considered unstable. Their + * signatures or semantics may change, or they may be removed altogether in the + * future. They are therefore only safe to depend on when the caller is + * statically linked against the library. + * + * To protect against unsafe usage, not only are the declarations guarded, + * the definitions are hidden by default + * when building LZ4 as a shared/dynamic library. + * + * In order to access these declarations, + * define LZ4_STATIC_LINKING_ONLY in your application + * before including LZ4's headers. + * + * In order to make their implementations accessible dynamically, you must + * define LZ4_PUBLISH_STATIC_FUNCTIONS when building the LZ4 library. + ******************************************************************************/ + +#ifdef LZ4_STATIC_LINKING_ONLY + +#ifndef LZ4_STATIC_3504398509 +#define LZ4_STATIC_3504398509 + +#ifdef LZ4_PUBLISH_STATIC_FUNCTIONS +# define LZ4LIB_STATIC_API LZ4LIB_API +#else +# define LZ4LIB_STATIC_API +#endif + + +/*! LZ4_compress_fast_extState_fastReset() : + * A variant of LZ4_compress_fast_extState(). + * + * Using this variant avoids an expensive initialization step. + * It is only safe to call if the state buffer is known to be correctly initialized already + * (see above comment on LZ4_resetStream_fast() for a definition of "correctly initialized"). + * From a high level, the difference is that + * this function initializes the provided state with a call to something like LZ4_resetStream_fast() + * while LZ4_compress_fast_extState() starts with a call to LZ4_resetStream(). + */ +LZ4LIB_STATIC_API int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); + +/*! LZ4_compress_destSize_extState() : introduced in v1.10.0 + * Same as LZ4_compress_destSize(), but using an externally allocated state. + * Also: exposes @acceleration + */ +int LZ4_compress_destSize_extState(void* state, const char* src, char* dst, int* srcSizePtr, int targetDstSize, int acceleration); + +/*! In-place compression and decompression + * + * It's possible to have input and output sharing the same buffer, + * for highly constrained memory environments. + * In both cases, it requires input to lay at the end of the buffer, + * and decompression to start at beginning of the buffer. + * Buffer size must feature some margin, hence be larger than final size. + * + * |<------------------------buffer--------------------------------->| + * |<-----------compressed data--------->| + * |<-----------decompressed size------------------>| + * |<----margin---->| + * + * This technique is more useful for decompression, + * since decompressed size is typically larger, + * and margin is short. + * + * In-place decompression will work inside any buffer + * which size is >= LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize). + * This presumes that decompressedSize > compressedSize. + * Otherwise, it means compression actually expanded data, + * and it would be more efficient to store such data with a flag indicating it's not compressed. + * This can happen when data is not compressible (already compressed, or encrypted). + * + * For in-place compression, margin is larger, as it must be able to cope with both + * history preservation, requiring input data to remain unmodified up to LZ4_DISTANCE_MAX, + * and data expansion, which can happen when input is not compressible. + * As a consequence, buffer size requirements are much higher, + * and memory savings offered by in-place compression are more limited. + * + * There are ways to limit this cost for compression : + * - Reduce history size, by modifying LZ4_DISTANCE_MAX. + * Note that it is a compile-time constant, so all compressions will apply this limit. + * Lower values will reduce compression ratio, except when input_size < LZ4_DISTANCE_MAX, + * so it's a reasonable trick when inputs are known to be small. + * - Require the compressor to deliver a "maximum compressed size". + * This is the `dstCapacity` parameter in `LZ4_compress*()`. + * When this size is < LZ4_COMPRESSBOUND(inputSize), then compression can fail, + * in which case, the return code will be 0 (zero). + * The caller must be ready for these cases to happen, + * and typically design a backup scheme to send data uncompressed. + * The combination of both techniques can significantly reduce + * the amount of margin required for in-place compression. + * + * In-place compression can work in any buffer + * which size is >= (maxCompressedSize) + * with maxCompressedSize == LZ4_COMPRESSBOUND(srcSize) for guaranteed compression success. + * LZ4_COMPRESS_INPLACE_BUFFER_SIZE() depends on both maxCompressedSize and LZ4_DISTANCE_MAX, + * so it's possible to reduce memory requirements by playing with them. + */ + +#define LZ4_DECOMPRESS_INPLACE_MARGIN(compressedSize) (((compressedSize) >> 8) + 32) +#define LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize) ((decompressedSize) + LZ4_DECOMPRESS_INPLACE_MARGIN(decompressedSize)) /**< note: presumes that compressedSize < decompressedSize. note2: margin is overestimated a bit, since it could use compressedSize instead */ + +#ifndef LZ4_DISTANCE_MAX /* history window size; can be user-defined at compile time */ +# define LZ4_DISTANCE_MAX 65535 /* set to maximum value by default */ +#endif + +#define LZ4_COMPRESS_INPLACE_MARGIN (LZ4_DISTANCE_MAX + 32) /* LZ4_DISTANCE_MAX can be safely replaced by srcSize when it's smaller */ +#define LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCompressedSize) ((maxCompressedSize) + LZ4_COMPRESS_INPLACE_MARGIN) /**< maxCompressedSize is generally LZ4_COMPRESSBOUND(inputSize), but can be set to any lower value, with the risk that compression can fail (return code 0(zero)) */ + +#endif /* LZ4_STATIC_3504398509 */ +#endif /* LZ4_STATIC_LINKING_ONLY */ + + + +#ifndef LZ4_H_98237428734687 +#define LZ4_H_98237428734687 + +/*-************************************************************ + * Private Definitions + ************************************************************** + * Do not use these definitions directly. + * They are only exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`. + * Accessing members will expose user code to API and/or ABI break in future versions of the library. + **************************************************************/ +#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2) +#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE) +#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */ + +#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) +# include + typedef int8_t LZ4_i8; + typedef uint8_t LZ4_byte; + typedef uint16_t LZ4_u16; + typedef uint32_t LZ4_u32; +#else + typedef signed char LZ4_i8; + typedef unsigned char LZ4_byte; + typedef unsigned short LZ4_u16; + typedef unsigned int LZ4_u32; +#endif + +/*! LZ4_stream_t : + * Never ever use below internal definitions directly ! + * These definitions are not API/ABI safe, and may change in future versions. + * If you need static allocation, declare or allocate an LZ4_stream_t object. +**/ + +typedef struct LZ4_stream_t_internal LZ4_stream_t_internal; +struct LZ4_stream_t_internal { + LZ4_u32 hashTable[LZ4_HASH_SIZE_U32]; + const LZ4_byte* dictionary; + const LZ4_stream_t_internal* dictCtx; + LZ4_u32 currentOffset; + LZ4_u32 tableType; + LZ4_u32 dictSize; + /* Implicit padding to ensure structure is aligned */ +}; + +#define LZ4_STREAM_MINSIZE ((1UL << (LZ4_MEMORY_USAGE)) + 32) /* static size, for inter-version compatibility */ +union LZ4_stream_u { + char minStateSize[LZ4_STREAM_MINSIZE]; + LZ4_stream_t_internal internal_donotuse; +}; /* previously typedef'd to LZ4_stream_t */ + + +/*! LZ4_initStream() : v1.9.0+ + * An LZ4_stream_t structure must be initialized at least once. + * This is automatically done when invoking LZ4_createStream(), + * but it's not when the structure is simply declared on stack (for example). + * + * Use LZ4_initStream() to properly initialize a newly declared LZ4_stream_t. + * It can also initialize any arbitrary buffer of sufficient size, + * and will @return a pointer of proper type upon initialization. + * + * Note : initialization fails if size and alignment conditions are not respected. + * In which case, the function will @return NULL. + * Note2: An LZ4_stream_t structure guarantees correct alignment and size. + * Note3: Before v1.9.0, use LZ4_resetStream() instead +**/ +LZ4LIB_API LZ4_stream_t* LZ4_initStream (void* stateBuffer, size_t size); + + +/*! LZ4_streamDecode_t : + * Never ever use below internal definitions directly ! + * These definitions are not API/ABI safe, and may change in future versions. + * If you need static allocation, declare or allocate an LZ4_streamDecode_t object. +**/ +typedef struct { + const LZ4_byte* externalDict; + const LZ4_byte* prefixEnd; + size_t extDictSize; + size_t prefixSize; +} LZ4_streamDecode_t_internal; + +#define LZ4_STREAMDECODE_MINSIZE 32 +union LZ4_streamDecode_u { + char minStateSize[LZ4_STREAMDECODE_MINSIZE]; + LZ4_streamDecode_t_internal internal_donotuse; +} ; /* previously typedef'd to LZ4_streamDecode_t */ + + + +/*-************************************ +* Obsolete Functions +**************************************/ + +/*! Deprecation warnings + * + * Deprecated functions make the compiler generate a warning when invoked. + * This is meant to invite users to update their source code. + * Should deprecation warnings be a problem, it is generally possible to disable them, + * typically with -Wno-deprecated-declarations for gcc + * or _CRT_SECURE_NO_WARNINGS in Visual. + * + * Another method is to define LZ4_DISABLE_DEPRECATE_WARNINGS + * before including the header file. + */ +#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS +# define LZ4_DEPRECATED(message) /* disable deprecation warnings */ +#else +# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ +# define LZ4_DEPRECATED(message) [[deprecated(message)]] +# elif defined(_MSC_VER) +# define LZ4_DEPRECATED(message) __declspec(deprecated(message)) +# elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 45)) +# define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) +# elif defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 31) +# define LZ4_DEPRECATED(message) __attribute__((deprecated)) +# else +# pragma message("WARNING: LZ4_DEPRECATED needs custom implementation for this compiler") +# define LZ4_DEPRECATED(message) /* disabled */ +# endif +#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */ + +/*! Obsolete compression functions (since v1.7.3) */ +LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* src, char* dest, int srcSize); +LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* src, char* dest, int srcSize, int maxOutputSize); +LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize); +LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); +LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize); +LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize); + +/*! Obsolete decompression functions (since v1.8.0) */ +LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize); +LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize); + +/* Obsolete streaming functions (since v1.7.0) + * degraded functionality; do not use! + * + * In order to perform streaming compression, these functions depended on data + * that is no longer tracked in the state. They have been preserved as well as + * possible: using them will still produce a correct output. However, they don't + * actually retain any history between compression calls. The compression ratio + * achieved will therefore be no better than compressing each chunk + * independently. + */ +LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API void* LZ4_create (char* inputBuffer); +LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStreamState(void); +LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void* state, char* inputBuffer); +LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API char* LZ4_slideInputBuffer (void* state); + +/*! Obsolete streaming decoding functions (since v1.7.0) */ +LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize); +LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize); + +/*! Obsolete LZ4_decompress_fast variants (since v1.9.0) : + * These functions used to be faster than LZ4_decompress_safe(), + * but this is no longer the case. They are now slower. + * This is because LZ4_decompress_fast() doesn't know the input size, + * and therefore must progress more cautiously into the input buffer to not read beyond the end of block. + * On top of that `LZ4_decompress_fast()` is not protected vs malformed or malicious inputs, making it a security liability. + * As a consequence, LZ4_decompress_fast() is strongly discouraged, and deprecated. + * + * The last remaining LZ4_decompress_fast() specificity is that + * it can decompress a block without knowing its compressed size. + * Such functionality can be achieved in a more secure manner + * by employing LZ4_decompress_safe_partial(). + * + * Parameters: + * originalSize : is the uncompressed size to regenerate. + * `dst` must be already allocated, its size must be >= 'originalSize' bytes. + * @return : number of bytes read from source buffer (== compressed size). + * The function expects to finish at block's end exactly. + * If the source stream is detected malformed, the function stops decoding and returns a negative result. + * note : LZ4_decompress_fast*() requires originalSize. Thanks to this information, it never writes past the output buffer. + * However, since it doesn't know its 'src' size, it may read an unknown amount of input, past input buffer bounds. + * Also, since match offsets are not validated, match reads from 'src' may underflow too. + * These issues never happen if input (compressed) data is correct. + * But they may happen if input data is invalid (error or intentional tampering). + * As a consequence, use these functions in trusted environments with trusted data **only**. + */ +LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_partial() instead") +LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize); +LZ4_DEPRECATED("This function is deprecated and unsafe. Consider migrating towards LZ4_decompress_safe_continue() instead. " + "Note that the contract will change (requires block's compressed size, instead of decompressed size)") +LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize); +LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_partial_usingDict() instead") +LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize); + +/*! LZ4_resetStream() : + * An LZ4_stream_t structure must be initialized at least once. + * This is done with LZ4_initStream(), or LZ4_resetStream(). + * Consider switching to LZ4_initStream(), + * invoking LZ4_resetStream() will trigger deprecation warnings in the future. + */ +LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr); + + +#endif /* LZ4_H_98237428734687 */ + + +#if defined (__cplusplus) +} +#endif diff --git a/VCMP-LUA/modules/postgresql/include/lz4file.h b/VCMP-LUA/modules/postgresql/include/lz4file.h new file mode 100644 index 0000000..598ad70 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/lz4file.h @@ -0,0 +1,93 @@ +/* + LZ4 file library + Header File + Copyright (C) 2022, Xiaomi Inc. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - LZ4 source repository : https://github.com/lz4/lz4 + - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c +*/ +#if defined (__cplusplus) +extern "C" { +#endif + +#ifndef LZ4FILE_H +#define LZ4FILE_H + +#include /* FILE* */ +#include "lz4frame_static.h" + +typedef struct LZ4_readFile_s LZ4_readFile_t; +typedef struct LZ4_writeFile_s LZ4_writeFile_t; + +/*! LZ4F_readOpen() : + * Set read lz4file handle. + * `lz4f` will set a lz4file handle. + * `fp` must be the return value of the lz4 file opened by fopen. + */ +LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_readOpen(LZ4_readFile_t** lz4fRead, FILE* fp); + +/*! LZ4F_read() : + * Read lz4file content to buffer. + * `lz4f` must use LZ4_readOpen to set first. + * `buf` read data buffer. + * `size` read data buffer size. + */ +LZ4FLIB_STATIC_API size_t LZ4F_read(LZ4_readFile_t* lz4fRead, void* buf, size_t size); + +/*! LZ4F_readClose() : + * Close lz4file handle. + * `lz4f` must use LZ4_readOpen to set first. + */ +LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_readClose(LZ4_readFile_t* lz4fRead); + +/*! LZ4F_writeOpen() : + * Set write lz4file handle. + * `lz4f` will set a lz4file handle. + * `fp` must be the return value of the lz4 file opened by fopen. + */ +LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeOpen(LZ4_writeFile_t** lz4fWrite, FILE* fp, const LZ4F_preferences_t* prefsPtr); + +/*! LZ4F_write() : + * Write buffer to lz4file. + * `lz4f` must use LZ4F_writeOpen to set first. + * `buf` write data buffer. + * `size` write data buffer size. + */ +LZ4FLIB_STATIC_API size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, const void* buf, size_t size); + +/*! LZ4F_writeClose() : + * Close lz4file handle. + * `lz4f` must use LZ4F_writeOpen to set first. + */ +LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeClose(LZ4_writeFile_t* lz4fWrite); + +#endif /* LZ4FILE_H */ + +#if defined (__cplusplus) +} +#endif diff --git a/VCMP-LUA/modules/postgresql/include/lz4frame.h b/VCMP-LUA/modules/postgresql/include/lz4frame.h new file mode 100644 index 0000000..bebf438 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/lz4frame.h @@ -0,0 +1,751 @@ +/* + LZ4F - LZ4-Frame library + Header File + Copyright (C) 2011-2020, Yann Collet. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - LZ4 source repository : https://github.com/lz4/lz4 + - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c +*/ + +/* LZ4F is a stand-alone API able to create and decode LZ4 frames + * conformant with specification v1.6.1 in doc/lz4_Frame_format.md . + * Generated frames are compatible with `lz4` CLI. + * + * LZ4F also offers streaming capabilities. + * + * lz4.h is not required when using lz4frame.h, + * except to extract common constants such as LZ4_VERSION_NUMBER. + * */ + +#ifndef LZ4F_H_09782039843 +#define LZ4F_H_09782039843 + +#if defined (__cplusplus) +extern "C" { +#endif + +/* --- Dependency --- */ +#include /* size_t */ + + +/** + * Introduction + * + * lz4frame.h implements LZ4 frame specification: see doc/lz4_Frame_format.md . + * LZ4 Frames are compatible with `lz4` CLI, + * and designed to be interoperable with any system. +**/ + +/*-*************************************************************** + * Compiler specifics + *****************************************************************/ +/* LZ4_DLL_EXPORT : + * Enable exporting of functions when building a Windows DLL + * LZ4FLIB_VISIBILITY : + * Control library symbols visibility. + */ +#ifndef LZ4FLIB_VISIBILITY +# if defined(__GNUC__) && (__GNUC__ >= 4) +# define LZ4FLIB_VISIBILITY __attribute__ ((visibility ("default"))) +# else +# define LZ4FLIB_VISIBILITY +# endif +#endif +#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) +# define LZ4FLIB_API __declspec(dllexport) LZ4FLIB_VISIBILITY +#elif 0 +# define LZ4FLIB_API __declspec(dllimport) LZ4FLIB_VISIBILITY +#else +# define LZ4FLIB_API LZ4FLIB_VISIBILITY +#endif + +#ifdef LZ4F_DISABLE_DEPRECATE_WARNINGS +# define LZ4F_DEPRECATE(x) x +#else +# if defined(_MSC_VER) +# define LZ4F_DEPRECATE(x) x /* __declspec(deprecated) x - only works with C++ */ +# elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6)) +# define LZ4F_DEPRECATE(x) x __attribute__((deprecated)) +# else +# define LZ4F_DEPRECATE(x) x /* no deprecation warning for this compiler */ +# endif +#endif + + +/*-************************************ + * Error management + **************************************/ +typedef size_t LZ4F_errorCode_t; + +LZ4FLIB_API unsigned LZ4F_isError(LZ4F_errorCode_t code); /**< tells when a function result is an error code */ +LZ4FLIB_API const char* LZ4F_getErrorName(LZ4F_errorCode_t code); /**< return error code string; for debugging */ + + +/*-************************************ + * Frame compression types + ************************************* */ +/* #define LZ4F_ENABLE_OBSOLETE_ENUMS // uncomment to enable obsolete enums */ +#ifdef LZ4F_ENABLE_OBSOLETE_ENUMS +# define LZ4F_OBSOLETE_ENUM(x) , LZ4F_DEPRECATE(x) = LZ4F_##x +#else +# define LZ4F_OBSOLETE_ENUM(x) +#endif + +/* The larger the block size, the (slightly) better the compression ratio, + * though there are diminishing returns. + * Larger blocks also increase memory usage on both compression and decompression sides. + */ +typedef enum { + LZ4F_default=0, + LZ4F_max64KB=4, + LZ4F_max256KB=5, + LZ4F_max1MB=6, + LZ4F_max4MB=7 + LZ4F_OBSOLETE_ENUM(max64KB) + LZ4F_OBSOLETE_ENUM(max256KB) + LZ4F_OBSOLETE_ENUM(max1MB) + LZ4F_OBSOLETE_ENUM(max4MB) +} LZ4F_blockSizeID_t; + +/* Linked blocks sharply reduce inefficiencies when using small blocks, + * they compress better. + * However, some LZ4 decoders are only compatible with independent blocks */ +typedef enum { + LZ4F_blockLinked=0, + LZ4F_blockIndependent + LZ4F_OBSOLETE_ENUM(blockLinked) + LZ4F_OBSOLETE_ENUM(blockIndependent) +} LZ4F_blockMode_t; + +typedef enum { + LZ4F_noContentChecksum=0, + LZ4F_contentChecksumEnabled + LZ4F_OBSOLETE_ENUM(noContentChecksum) + LZ4F_OBSOLETE_ENUM(contentChecksumEnabled) +} LZ4F_contentChecksum_t; + +typedef enum { + LZ4F_noBlockChecksum=0, + LZ4F_blockChecksumEnabled +} LZ4F_blockChecksum_t; + +typedef enum { + LZ4F_frame=0, + LZ4F_skippableFrame + LZ4F_OBSOLETE_ENUM(skippableFrame) +} LZ4F_frameType_t; + +#ifdef LZ4F_ENABLE_OBSOLETE_ENUMS +typedef LZ4F_blockSizeID_t blockSizeID_t; +typedef LZ4F_blockMode_t blockMode_t; +typedef LZ4F_frameType_t frameType_t; +typedef LZ4F_contentChecksum_t contentChecksum_t; +#endif + +/*! LZ4F_frameInfo_t : + * makes it possible to set or read frame parameters. + * Structure must be first init to 0, using memset() or LZ4F_INIT_FRAMEINFO, + * setting all parameters to default. + * It's then possible to update selectively some parameters */ +typedef struct { + LZ4F_blockSizeID_t blockSizeID; /* max64KB, max256KB, max1MB, max4MB; 0 == default (LZ4F_max64KB) */ + LZ4F_blockMode_t blockMode; /* LZ4F_blockLinked, LZ4F_blockIndependent; 0 == default (LZ4F_blockLinked) */ + LZ4F_contentChecksum_t contentChecksumFlag; /* 1: add a 32-bit checksum of frame's decompressed data; 0 == default (disabled) */ + LZ4F_frameType_t frameType; /* read-only field : LZ4F_frame or LZ4F_skippableFrame */ + unsigned long long contentSize; /* Size of uncompressed content ; 0 == unknown */ + unsigned dictID; /* Dictionary ID, sent by compressor to help decoder select correct dictionary; 0 == no dictID provided */ + LZ4F_blockChecksum_t blockChecksumFlag; /* 1: each block followed by a checksum of block's compressed data; 0 == default (disabled) */ +} LZ4F_frameInfo_t; + +#define LZ4F_INIT_FRAMEINFO { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum } /* v1.8.3+ */ + +/*! LZ4F_preferences_t : + * makes it possible to supply advanced compression instructions to streaming interface. + * Structure must be first init to 0, using memset() or LZ4F_INIT_PREFERENCES, + * setting all parameters to default. + * All reserved fields must be set to zero. */ +typedef struct { + LZ4F_frameInfo_t frameInfo; + int compressionLevel; /* 0: default (fast mode); values > LZ4HC_CLEVEL_MAX count as LZ4HC_CLEVEL_MAX; values < 0 trigger "fast acceleration" */ + unsigned autoFlush; /* 1: always flush; reduces usage of internal buffers */ + unsigned favorDecSpeed; /* 1: parser favors decompression speed vs compression ratio. Only works for high compression modes (>= LZ4HC_CLEVEL_OPT_MIN) */ /* v1.8.2+ */ + unsigned reserved[3]; /* must be zero for forward compatibility */ +} LZ4F_preferences_t; + +#define LZ4F_INIT_PREFERENCES { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } } /* v1.8.3+ */ + + +/*-********************************* +* Simple compression function +***********************************/ + +/*! LZ4F_compressFrame() : + * Compress srcBuffer content into an LZ4-compressed frame. + * It's a one shot operation, all input content is consumed, and all output is generated. + * + * Note : it's a stateless operation (no LZ4F_cctx state needed). + * In order to reduce load on the allocator, LZ4F_compressFrame(), by default, + * uses the stack to allocate space for the compression state and some table. + * If this usage of the stack is too much for your application, + * consider compiling `lz4frame.c` with compile-time macro LZ4F_HEAPMODE set to 1 instead. + * All state allocations will use the Heap. + * It also means each invocation of LZ4F_compressFrame() will trigger several internal alloc/free invocations. + * + * @dstCapacity MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr). + * @preferencesPtr is optional : one can provide NULL, in which case all preferences are set to default. + * @return : number of bytes written into dstBuffer. + * or an error code if it fails (can be tested using LZ4F_isError()) + */ +LZ4FLIB_API size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity, + const void* srcBuffer, size_t srcSize, + const LZ4F_preferences_t* preferencesPtr); + +/*! LZ4F_compressFrameBound() : + * Returns the maximum possible compressed size with LZ4F_compressFrame() given srcSize and preferences. + * `preferencesPtr` is optional. It can be replaced by NULL, in which case, the function will assume default preferences. + * Note : this result is only usable with LZ4F_compressFrame(). + * It may also be relevant to LZ4F_compressUpdate() _only if_ no flush() operation is ever performed. + */ +LZ4FLIB_API size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr); + + +/*! LZ4F_compressionLevel_max() : + * @return maximum allowed compression level (currently: 12) + */ +LZ4FLIB_API int LZ4F_compressionLevel_max(void); /* v1.8.0+ */ + + +/*-*********************************** +* Advanced compression functions +*************************************/ +typedef struct LZ4F_cctx_s LZ4F_cctx; /* incomplete type */ +typedef LZ4F_cctx* LZ4F_compressionContext_t; /* for compatibility with older APIs, prefer using LZ4F_cctx */ + +typedef struct { + unsigned stableSrc; /* 1 == src content will remain present on future calls to LZ4F_compress(); skip copying src content within tmp buffer */ + unsigned reserved[3]; +} LZ4F_compressOptions_t; + +/*--- Resource Management ---*/ + +#define LZ4F_VERSION 100 /* This number can be used to check for an incompatible API breaking change */ +LZ4FLIB_API unsigned LZ4F_getVersion(void); + +/*! LZ4F_createCompressionContext() : + * The first thing to do is to create a compressionContext object, + * which will keep track of operation state during streaming compression. + * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version, + * and a pointer to LZ4F_cctx*, to write the resulting pointer into. + * @version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL. + * The function provides a pointer to a fully allocated LZ4F_cctx object. + * @cctxPtr MUST be != NULL. + * If @return != zero, context creation failed. + * A created compression context can be employed multiple times for consecutive streaming operations. + * Once all streaming compression jobs are completed, + * the state object can be released using LZ4F_freeCompressionContext(). + * Note1 : LZ4F_freeCompressionContext() is always successful. Its return value can be ignored. + * Note2 : LZ4F_freeCompressionContext() works fine with NULL input pointers (do nothing). +**/ +LZ4FLIB_API LZ4F_errorCode_t LZ4F_createCompressionContext(LZ4F_cctx** cctxPtr, unsigned version); +LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx); + + +/*---- Compression ----*/ + +#define LZ4F_HEADER_SIZE_MIN 7 /* LZ4 Frame header size can vary, depending on selected parameters */ +#define LZ4F_HEADER_SIZE_MAX 19 + +/* Size in bytes of a block header in little-endian format. Highest bit indicates if block data is uncompressed */ +#define LZ4F_BLOCK_HEADER_SIZE 4 + +/* Size in bytes of a block checksum footer in little-endian format. */ +#define LZ4F_BLOCK_CHECKSUM_SIZE 4 + +/* Size in bytes of the content checksum. */ +#define LZ4F_CONTENT_CHECKSUM_SIZE 4 + +/*! LZ4F_compressBegin() : + * will write the frame header into dstBuffer. + * dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes. + * `prefsPtr` is optional : NULL can be provided to set all preferences to default. + * @return : number of bytes written into dstBuffer for the header + * or an error code (which can be tested using LZ4F_isError()) + */ +LZ4FLIB_API size_t LZ4F_compressBegin(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const LZ4F_preferences_t* prefsPtr); + +/*! LZ4F_compressBound() : + * Provides minimum dstCapacity required to guarantee success of + * LZ4F_compressUpdate(), given a srcSize and preferences, for a worst case scenario. + * When srcSize==0, LZ4F_compressBound() provides an upper bound for LZ4F_flush() and LZ4F_compressEnd() instead. + * Note that the result is only valid for a single invocation of LZ4F_compressUpdate(). + * When invoking LZ4F_compressUpdate() multiple times, + * if the output buffer is gradually filled up instead of emptied and re-used from its start, + * one must check if there is enough remaining capacity before each invocation, using LZ4F_compressBound(). + * @return is always the same for a srcSize and prefsPtr. + * prefsPtr is optional : when NULL is provided, preferences will be set to cover worst case scenario. + * tech details : + * @return if automatic flushing is not enabled, includes the possibility that internal buffer might already be filled by up to (blockSize-1) bytes. + * It also includes frame footer (ending + checksum), since it might be generated by LZ4F_compressEnd(). + * @return doesn't include frame header, as it was already generated by LZ4F_compressBegin(). + */ +LZ4FLIB_API size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* prefsPtr); + +/*! LZ4F_compressUpdate() : + * LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. + * Important rule: dstCapacity MUST be large enough to ensure operation success even in worst case situations. + * This value is provided by LZ4F_compressBound(). + * If this condition is not respected, LZ4F_compress() will fail (result is an errorCode). + * After an error, the state is left in a UB state, and must be re-initialized or freed. + * If previously an uncompressed block was written, buffered data is flushed + * before appending compressed data is continued. + * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default. + * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). + * or an error code if it fails (which can be tested using LZ4F_isError()) + */ +LZ4FLIB_API size_t LZ4F_compressUpdate(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const void* srcBuffer, size_t srcSize, + const LZ4F_compressOptions_t* cOptPtr); + +/*! LZ4F_flush() : + * When data must be generated and sent immediately, without waiting for a block to be completely filled, + * it's possible to call LZ4_flush(). It will immediately compress any data buffered within cctx. + * `dstCapacity` must be large enough to ensure the operation will be successful. + * `cOptPtr` is optional : it's possible to provide NULL, all options will be set to default. + * @return : nb of bytes written into dstBuffer (can be zero, when there is no data stored within cctx) + * or an error code if it fails (which can be tested using LZ4F_isError()) + * Note : LZ4F_flush() is guaranteed to be successful when dstCapacity >= LZ4F_compressBound(0, prefsPtr). + */ +LZ4FLIB_API size_t LZ4F_flush(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const LZ4F_compressOptions_t* cOptPtr); + +/*! LZ4F_compressEnd() : + * To properly finish an LZ4 frame, invoke LZ4F_compressEnd(). + * It will flush whatever data remained within `cctx` (like LZ4_flush()) + * and properly finalize the frame, with an endMark and a checksum. + * `cOptPtr` is optional : NULL can be provided, in which case all options will be set to default. + * @return : nb of bytes written into dstBuffer, necessarily >= 4 (endMark), + * or an error code if it fails (which can be tested using LZ4F_isError()) + * Note : LZ4F_compressEnd() is guaranteed to be successful when dstCapacity >= LZ4F_compressBound(0, prefsPtr). + * A successful call to LZ4F_compressEnd() makes `cctx` available again for another compression task. + */ +LZ4FLIB_API size_t LZ4F_compressEnd(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const LZ4F_compressOptions_t* cOptPtr); + + +/*-********************************* +* Decompression functions +***********************************/ +typedef struct LZ4F_dctx_s LZ4F_dctx; /* incomplete type */ +typedef LZ4F_dctx* LZ4F_decompressionContext_t; /* compatibility with previous API versions */ + +typedef struct { + unsigned stableDst; /* pledges that last 64KB decompressed data is present right before @dstBuffer pointer. + * This optimization skips internal storage operations. + * Once set, this pledge must remain valid up to the end of current frame. */ + unsigned skipChecksums; /* disable checksum calculation and verification, even when one is present in frame, to save CPU time. + * Setting this option to 1 once disables all checksums for the rest of the frame. */ + unsigned reserved1; /* must be set to zero for forward compatibility */ + unsigned reserved0; /* idem */ +} LZ4F_decompressOptions_t; + + +/* Resource management */ + +/*! LZ4F_createDecompressionContext() : + * Create an LZ4F_dctx object, to track all decompression operations. + * @version provided MUST be LZ4F_VERSION. + * @dctxPtr MUST be valid. + * The function fills @dctxPtr with the value of a pointer to an allocated and initialized LZ4F_dctx object. + * The @return is an errorCode, which can be tested using LZ4F_isError(). + * dctx memory can be released using LZ4F_freeDecompressionContext(); + * Result of LZ4F_freeDecompressionContext() indicates current state of decompressionContext when being released. + * That is, it should be == 0 if decompression has been completed fully and correctly. + */ +LZ4FLIB_API LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx** dctxPtr, unsigned version); +LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* dctx); + + +/*-*********************************** +* Streaming decompression functions +*************************************/ + +#define LZ4F_MAGICNUMBER 0x184D2204U +#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U +#define LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH 5 + +/*! LZ4F_headerSize() : v1.9.0+ + * Provide the header size of a frame starting at `src`. + * `srcSize` must be >= LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH, + * which is enough to decode the header length. + * @return : size of frame header + * or an error code, which can be tested using LZ4F_isError() + * note : Frame header size is variable, but is guaranteed to be + * >= LZ4F_HEADER_SIZE_MIN bytes, and <= LZ4F_HEADER_SIZE_MAX bytes. + */ +LZ4FLIB_API size_t LZ4F_headerSize(const void* src, size_t srcSize); + +/*! LZ4F_getFrameInfo() : + * This function extracts frame parameters (max blockSize, dictID, etc.). + * Its usage is optional: user can also invoke LZ4F_decompress() directly. + * + * Extracted information will fill an existing LZ4F_frameInfo_t structure. + * This can be useful for allocation and dictionary identification purposes. + * + * LZ4F_getFrameInfo() can work in the following situations : + * + * 1) At the beginning of a new frame, before any invocation of LZ4F_decompress(). + * It will decode header from `srcBuffer`, + * consuming the header and starting the decoding process. + * + * Input size must be large enough to contain the full frame header. + * Frame header size can be known beforehand by LZ4F_headerSize(). + * Frame header size is variable, but is guaranteed to be >= LZ4F_HEADER_SIZE_MIN bytes, + * and not more than <= LZ4F_HEADER_SIZE_MAX bytes. + * Hence, blindly providing LZ4F_HEADER_SIZE_MAX bytes or more will always work. + * It's allowed to provide more input data than the header size, + * LZ4F_getFrameInfo() will only consume the header. + * + * If input size is not large enough, + * aka if it's smaller than header size, + * function will fail and return an error code. + * + * 2) After decoding has been started, + * it's possible to invoke LZ4F_getFrameInfo() anytime + * to extract already decoded frame parameters stored within dctx. + * + * Note that, if decoding has barely started, + * and not yet read enough information to decode the header, + * LZ4F_getFrameInfo() will fail. + * + * The number of bytes consumed from srcBuffer will be updated in *srcSizePtr (necessarily <= original value). + * LZ4F_getFrameInfo() only consumes bytes when decoding has not yet started, + * and when decoding the header has been successful. + * Decompression must then resume from (srcBuffer + *srcSizePtr). + * + * @return : a hint about how many srcSize bytes LZ4F_decompress() expects for next call, + * or an error code which can be tested using LZ4F_isError(). + * note 1 : in case of error, dctx is not modified. Decoding operation can resume from beginning safely. + * note 2 : frame parameters are *copied into* an already allocated LZ4F_frameInfo_t structure. + */ +LZ4FLIB_API size_t +LZ4F_getFrameInfo(LZ4F_dctx* dctx, + LZ4F_frameInfo_t* frameInfoPtr, + const void* srcBuffer, size_t* srcSizePtr); + +/*! LZ4F_decompress() : + * Call this function repetitively to regenerate data compressed in `srcBuffer`. + * + * The function requires a valid dctx state. + * It will read up to *srcSizePtr bytes from srcBuffer, + * and decompress data into dstBuffer, of capacity *dstSizePtr. + * + * The nb of bytes consumed from srcBuffer will be written into *srcSizePtr (necessarily <= original value). + * The nb of bytes decompressed into dstBuffer will be written into *dstSizePtr (necessarily <= original value). + * + * The function does not necessarily read all input bytes, so always check value in *srcSizePtr. + * Unconsumed source data must be presented again in subsequent invocations. + * + * `dstBuffer` can freely change between each consecutive function invocation. + * `dstBuffer` content will be overwritten. + * + * Note: if `LZ4F_getFrameInfo()` is called before `LZ4F_decompress()`, srcBuffer must be updated to reflect + * the number of bytes consumed after reading the frame header. Failure to update srcBuffer before calling + * `LZ4F_decompress()` will cause decompression failure or, even worse, successful but incorrect decompression. + * See the `LZ4F_getFrameInfo()` docs for details. + * + * @return : an hint of how many `srcSize` bytes LZ4F_decompress() expects for next call. + * Schematically, it's the size of the current (or remaining) compressed block + header of next block. + * Respecting the hint provides some small speed benefit, because it skips intermediate buffers. + * This is just a hint though, it's always possible to provide any srcSize. + * + * When a frame is fully decoded, @return will be 0 (no more data expected). + * When provided with more bytes than necessary to decode a frame, + * LZ4F_decompress() will stop reading exactly at end of current frame, and @return 0. + * + * If decompression failed, @return is an error code, which can be tested using LZ4F_isError(). + * After a decompression error, the `dctx` context is not resumable. + * Use LZ4F_resetDecompressionContext() to return to clean state. + * + * After a frame is fully decoded, dctx can be used again to decompress another frame. + */ +LZ4FLIB_API size_t +LZ4F_decompress(LZ4F_dctx* dctx, + void* dstBuffer, size_t* dstSizePtr, + const void* srcBuffer, size_t* srcSizePtr, + const LZ4F_decompressOptions_t* dOptPtr); + + +/*! LZ4F_resetDecompressionContext() : added in v1.8.0 + * In case of an error, the context is left in "undefined" state. + * In which case, it's necessary to reset it, before re-using it. + * This method can also be used to abruptly stop any unfinished decompression, + * and start a new one using same context resources. */ +LZ4FLIB_API void LZ4F_resetDecompressionContext(LZ4F_dctx* dctx); /* always successful */ + + +/********************************** + * Dictionary compression API + *********************************/ + +/* A Dictionary is useful for the compression of small messages (KB range). + * It dramatically improves compression efficiency. + * + * LZ4 can ingest any input as dictionary, though only the last 64 KB are useful. + * Better results are generally achieved by using Zstandard's Dictionary Builder + * to generate a high-quality dictionary from a set of samples. + * + * The same dictionary will have to be used on the decompression side + * for decoding to be successful. + * To help identify the correct dictionary at decoding stage, + * the frame header allows optional embedding of a dictID field. + */ + +/*! LZ4F_compressBegin_usingDict() : stable since v1.10 + * Inits dictionary compression streaming, and writes the frame header into dstBuffer. + * @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes. + * @prefsPtr is optional : one may provide NULL as argument, + * however, it's the only way to provide dictID in the frame header. + * @dictBuffer must outlive the compression session. + * @return : number of bytes written into dstBuffer for the header, + * or an error code (which can be tested using LZ4F_isError()) + * NOTE: The LZ4Frame spec allows each independent block to be compressed with the dictionary, + * but this entry supports a more limited scenario, where only the first block uses the dictionary. + * This is still useful for small data, which only need one block anyway. + * For larger inputs, one may be more interested in LZ4F_compressFrame_usingCDict() below. + */ +LZ4FLIB_API size_t +LZ4F_compressBegin_usingDict(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const void* dictBuffer, size_t dictSize, + const LZ4F_preferences_t* prefsPtr); + +/*! LZ4F_decompress_usingDict() : stable since v1.10 + * Same as LZ4F_decompress(), using a predefined dictionary. + * Dictionary is used "in place", without any preprocessing. +** It must remain accessible throughout the entire frame decoding. */ +LZ4FLIB_API size_t +LZ4F_decompress_usingDict(LZ4F_dctx* dctxPtr, + void* dstBuffer, size_t* dstSizePtr, + const void* srcBuffer, size_t* srcSizePtr, + const void* dict, size_t dictSize, + const LZ4F_decompressOptions_t* decompressOptionsPtr); + +/***************************************** + * Bulk processing dictionary compression + *****************************************/ + +/* Loading a dictionary has a cost, since it involves construction of tables. + * The Bulk processing dictionary API makes it possible to share this cost + * over an arbitrary number of compression jobs, even concurrently, + * markedly improving compression latency for these cases. + * + * Note that there is no corresponding bulk API for the decompression side, + * because dictionary does not carry any initialization cost for decompression. + * Use the regular LZ4F_decompress_usingDict() there. + */ +typedef struct LZ4F_CDict_s LZ4F_CDict; + +/*! LZ4_createCDict() : stable since v1.10 + * When compressing multiple messages / blocks using the same dictionary, it's recommended to initialize it just once. + * LZ4_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay. + * LZ4_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. + * @dictBuffer can be released after LZ4_CDict creation, since its content is copied within CDict. */ +LZ4FLIB_API LZ4F_CDict* LZ4F_createCDict(const void* dictBuffer, size_t dictSize); +LZ4FLIB_API void LZ4F_freeCDict(LZ4F_CDict* CDict); + +/*! LZ4_compressFrame_usingCDict() : stable since v1.10 + * Compress an entire srcBuffer into a valid LZ4 frame using a digested Dictionary. + * @cctx must point to a context created by LZ4F_createCompressionContext(). + * If @cdict==NULL, compress without a dictionary. + * @dstBuffer MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr). + * If this condition is not respected, function will fail (@return an errorCode). + * The LZ4F_preferences_t structure is optional : one may provide NULL as argument, + * but it's not recommended, as it's the only way to provide @dictID in the frame header. + * @return : number of bytes written into dstBuffer. + * or an error code if it fails (can be tested using LZ4F_isError()) + * Note: for larger inputs generating multiple independent blocks, + * this entry point uses the dictionary for each block. */ +LZ4FLIB_API size_t +LZ4F_compressFrame_usingCDict(LZ4F_cctx* cctx, + void* dst, size_t dstCapacity, + const void* src, size_t srcSize, + const LZ4F_CDict* cdict, + const LZ4F_preferences_t* preferencesPtr); + +/*! LZ4F_compressBegin_usingCDict() : stable since v1.10 + * Inits streaming dictionary compression, and writes the frame header into dstBuffer. + * @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes. + * @prefsPtr is optional : one may provide NULL as argument, + * note however that it's the only way to insert a @dictID in the frame header. + * @cdict must outlive the compression session. + * @return : number of bytes written into dstBuffer for the header, + * or an error code, which can be tested using LZ4F_isError(). */ +LZ4FLIB_API size_t +LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const LZ4F_CDict* cdict, + const LZ4F_preferences_t* prefsPtr); + + +#if defined (__cplusplus) +} +#endif + +#endif /* LZ4F_H_09782039843 */ + +#if defined(LZ4F_STATIC_LINKING_ONLY) && !defined(LZ4F_H_STATIC_09782039843) +#define LZ4F_H_STATIC_09782039843 + +/* Note : + * The below declarations are not stable and may change in the future. + * They are therefore only safe to depend on + * when the caller is statically linked against the library. + * To access their declarations, define LZ4F_STATIC_LINKING_ONLY. + * + * By default, these symbols aren't published into shared/dynamic libraries. + * You can override this behavior and force them to be published + * by defining LZ4F_PUBLISH_STATIC_FUNCTIONS. + * Use at your own risk. + */ + +#if defined (__cplusplus) +extern "C" { +#endif + +#ifdef LZ4F_PUBLISH_STATIC_FUNCTIONS +# define LZ4FLIB_STATIC_API LZ4FLIB_API +#else +# define LZ4FLIB_STATIC_API +#endif + + +/* --- Error List --- */ +#define LZ4F_LIST_ERRORS(ITEM) \ + ITEM(OK_NoError) \ + ITEM(ERROR_GENERIC) \ + ITEM(ERROR_maxBlockSize_invalid) \ + ITEM(ERROR_blockMode_invalid) \ + ITEM(ERROR_parameter_invalid) \ + ITEM(ERROR_compressionLevel_invalid) \ + ITEM(ERROR_headerVersion_wrong) \ + ITEM(ERROR_blockChecksum_invalid) \ + ITEM(ERROR_reservedFlag_set) \ + ITEM(ERROR_allocation_failed) \ + ITEM(ERROR_srcSize_tooLarge) \ + ITEM(ERROR_dstMaxSize_tooSmall) \ + ITEM(ERROR_frameHeader_incomplete) \ + ITEM(ERROR_frameType_unknown) \ + ITEM(ERROR_frameSize_wrong) \ + ITEM(ERROR_srcPtr_wrong) \ + ITEM(ERROR_decompressionFailed) \ + ITEM(ERROR_headerChecksum_invalid) \ + ITEM(ERROR_contentChecksum_invalid) \ + ITEM(ERROR_frameDecoding_alreadyStarted) \ + ITEM(ERROR_compressionState_uninitialized) \ + ITEM(ERROR_parameter_null) \ + ITEM(ERROR_io_write) \ + ITEM(ERROR_io_read) \ + ITEM(ERROR_maxCode) + +#define LZ4F_GENERATE_ENUM(ENUM) LZ4F_##ENUM, + +/* enum list is exposed, to handle specific errors */ +typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM) + _LZ4F_dummy_error_enum_for_c89_never_used } LZ4F_errorCodes; + +LZ4FLIB_STATIC_API LZ4F_errorCodes LZ4F_getErrorCode(size_t functionResult); + +/********************************** + * Advanced compression operations + *********************************/ + +/*! LZ4F_getBlockSize() : + * @return, in scalar format (size_t), + * the maximum block size associated with @blockSizeID, + * or an error code (can be tested using LZ4F_isError()) if @blockSizeID is invalid. +**/ +LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(LZ4F_blockSizeID_t blockSizeID); + +/*! LZ4F_uncompressedUpdate() : + * LZ4F_uncompressedUpdate() can be called repetitively to add data stored as uncompressed blocks. + * Important rule: dstCapacity MUST be large enough to store the entire source buffer as + * no compression is done for this operation + * If this condition is not respected, LZ4F_uncompressedUpdate() will fail (result is an errorCode). + * After an error, the state is left in a UB state, and must be re-initialized or freed. + * If previously a compressed block was written, buffered data is flushed first, + * before appending uncompressed data is continued. + * This operation is only supported when LZ4F_blockIndependent is used. + * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default. + * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). + * or an error code if it fails (which can be tested using LZ4F_isError()) + */ +LZ4FLIB_STATIC_API size_t +LZ4F_uncompressedUpdate(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const void* srcBuffer, size_t srcSize, + const LZ4F_compressOptions_t* cOptPtr); + +/********************************** + * Custom memory allocation + *********************************/ + +/*! Custom memory allocation : v1.9.4+ + * These prototypes make it possible to pass custom allocation/free functions. + * LZ4F_customMem is provided at state creation time, using LZ4F_create*_advanced() listed below. + * All allocation/free operations will be completed using these custom variants instead of regular ones. + */ +typedef void* (*LZ4F_AllocFunction) (void* opaqueState, size_t size); +typedef void* (*LZ4F_CallocFunction) (void* opaqueState, size_t size); +typedef void (*LZ4F_FreeFunction) (void* opaqueState, void* address); +typedef struct { + LZ4F_AllocFunction customAlloc; + LZ4F_CallocFunction customCalloc; /* optional; when not defined, uses customAlloc + memset */ + LZ4F_FreeFunction customFree; + void* opaqueState; +} LZ4F_CustomMem; +static +#ifdef __GNUC__ +__attribute__((__unused__)) +#endif +LZ4F_CustomMem const LZ4F_defaultCMem = { NULL, NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */ + +LZ4FLIB_STATIC_API LZ4F_cctx* LZ4F_createCompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version); +LZ4FLIB_STATIC_API LZ4F_dctx* LZ4F_createDecompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version); +LZ4FLIB_STATIC_API LZ4F_CDict* LZ4F_createCDict_advanced(LZ4F_CustomMem customMem, const void* dictBuffer, size_t dictSize); + + +#if defined (__cplusplus) +} +#endif + +#endif /* defined(LZ4F_STATIC_LINKING_ONLY) && !defined(LZ4F_H_STATIC_09782039843) */ diff --git a/VCMP-LUA/modules/postgresql/include/lz4hc.h b/VCMP-LUA/modules/postgresql/include/lz4hc.h new file mode 100644 index 0000000..992bc8c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/lz4hc.h @@ -0,0 +1,414 @@ +/* + LZ4 HC - High Compression Mode of LZ4 + Header File + Copyright (C) 2011-2020, Yann Collet. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - LZ4 source repository : https://github.com/lz4/lz4 + - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c +*/ +#ifndef LZ4_HC_H_19834876238432 +#define LZ4_HC_H_19834876238432 + +#if defined (__cplusplus) +extern "C" { +#endif + +/* --- Dependency --- */ +/* note : lz4hc requires lz4.h/lz4.c for compilation */ +#include "lz4.h" /* stddef, LZ4LIB_API, LZ4_DEPRECATED */ + + +/* --- Useful constants --- */ +#define LZ4HC_CLEVEL_MIN 2 +#define LZ4HC_CLEVEL_DEFAULT 9 +#define LZ4HC_CLEVEL_OPT_MIN 10 +#define LZ4HC_CLEVEL_MAX 12 + + +/*-************************************ + * Block Compression + **************************************/ +/*! LZ4_compress_HC() : + * Compress data from `src` into `dst`, using the powerful but slower "HC" algorithm. + * `dst` must be already allocated. + * Compression is guaranteed to succeed if `dstCapacity >= LZ4_compressBound(srcSize)` (see "lz4.h") + * Max supported `srcSize` value is LZ4_MAX_INPUT_SIZE (see "lz4.h") + * `compressionLevel` : any value between 1 and LZ4HC_CLEVEL_MAX will work. + * Values > LZ4HC_CLEVEL_MAX behave the same as LZ4HC_CLEVEL_MAX. + * @return : the number of bytes written into 'dst' + * or 0 if compression fails. + */ +LZ4LIB_API int LZ4_compress_HC (const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel); + + +/* Note : + * Decompression functions are provided within "lz4.h" (BSD license) + */ + + +/*! LZ4_compress_HC_extStateHC() : + * Same as LZ4_compress_HC(), but using an externally allocated memory segment for `state`. + * `state` size is provided by LZ4_sizeofStateHC(). + * Memory segment must be aligned on 8-bytes boundaries (which a normal malloc() should do properly). + */ +LZ4LIB_API int LZ4_sizeofStateHC(void); +LZ4LIB_API int LZ4_compress_HC_extStateHC(void* stateHC, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel); + + +/*! LZ4_compress_HC_destSize() : v1.9.0+ + * Will compress as much data as possible from `src` + * to fit into `targetDstSize` budget. + * Result is provided in 2 parts : + * @return : the number of bytes written into 'dst' (necessarily <= targetDstSize) + * or 0 if compression fails. + * `srcSizePtr` : on success, *srcSizePtr is updated to indicate how much bytes were read from `src` + */ +LZ4LIB_API int LZ4_compress_HC_destSize(void* stateHC, + const char* src, char* dst, + int* srcSizePtr, int targetDstSize, + int compressionLevel); + + +/*-************************************ + * Streaming Compression + * Bufferless synchronous API + **************************************/ + typedef union LZ4_streamHC_u LZ4_streamHC_t; /* incomplete type (defined later) */ + +/*! LZ4_createStreamHC() and LZ4_freeStreamHC() : + * These functions create and release memory for LZ4 HC streaming state. + * Newly created states are automatically initialized. + * A same state can be used multiple times consecutively, + * starting with LZ4_resetStreamHC_fast() to start a new stream of blocks. + */ +LZ4LIB_API LZ4_streamHC_t* LZ4_createStreamHC(void); +LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr); + +/* + These functions compress data in successive blocks of any size, + using previous blocks as dictionary, to improve compression ratio. + One key assumption is that previous blocks (up to 64 KB) remain read-accessible while compressing next blocks. + There is an exception for ring buffers, which can be smaller than 64 KB. + Ring-buffer scenario is automatically detected and handled within LZ4_compress_HC_continue(). + + Before starting compression, state must be allocated and properly initialized. + LZ4_createStreamHC() does both, though compression level is set to LZ4HC_CLEVEL_DEFAULT. + + Selecting the compression level can be done with LZ4_resetStreamHC_fast() (starts a new stream) + or LZ4_setCompressionLevel() (anytime, between blocks in the same stream) (experimental). + LZ4_resetStreamHC_fast() only works on states which have been properly initialized at least once, + which is automatically the case when state is created using LZ4_createStreamHC(). + + After reset, a first "fictional block" can be designated as initial dictionary, + using LZ4_loadDictHC() (Optional). + Note: In order for LZ4_loadDictHC() to create the correct data structure, + it is essential to set the compression level _before_ loading the dictionary. + + Invoke LZ4_compress_HC_continue() to compress each successive block. + The number of blocks is unlimited. + Previous input blocks, including initial dictionary when present, + must remain accessible and unmodified during compression. + + It's allowed to update compression level anytime between blocks, + using LZ4_setCompressionLevel() (experimental). + + @dst buffer should be sized to handle worst case scenarios + (see LZ4_compressBound(), it ensures compression success). + In case of failure, the API does not guarantee recovery, + so the state _must_ be reset. + To ensure compression success + whenever @dst buffer size cannot be made >= LZ4_compressBound(), + consider using LZ4_compress_HC_continue_destSize(). + + Whenever previous input blocks can't be preserved unmodified in-place during compression of next blocks, + it's possible to copy the last blocks into a more stable memory space, using LZ4_saveDictHC(). + Return value of LZ4_saveDictHC() is the size of dictionary effectively saved into 'safeBuffer' (<= 64 KB) + + After completing a streaming compression, + it's possible to start a new stream of blocks, using the same LZ4_streamHC_t state, + just by resetting it, using LZ4_resetStreamHC_fast(). +*/ + +LZ4LIB_API void LZ4_resetStreamHC_fast(LZ4_streamHC_t* streamHCPtr, int compressionLevel); /* v1.9.0+ */ +LZ4LIB_API int LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize); + +LZ4LIB_API int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr, + const char* src, char* dst, + int srcSize, int maxDstSize); + +/*! LZ4_compress_HC_continue_destSize() : v1.9.0+ + * Similar to LZ4_compress_HC_continue(), + * but will read as much data as possible from `src` + * to fit into `targetDstSize` budget. + * Result is provided into 2 parts : + * @return : the number of bytes written into 'dst' (necessarily <= targetDstSize) + * or 0 if compression fails. + * `srcSizePtr` : on success, *srcSizePtr will be updated to indicate how much bytes were read from `src`. + * Note that this function may not consume the entire input. + */ +LZ4LIB_API int LZ4_compress_HC_continue_destSize(LZ4_streamHC_t* LZ4_streamHCPtr, + const char* src, char* dst, + int* srcSizePtr, int targetDstSize); + +LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize); + + +/*! LZ4_attach_HC_dictionary() : stable since v1.10.0 + * This API allows for the efficient re-use of a static dictionary many times. + * + * Rather than re-loading the dictionary buffer into a working context before + * each compression, or copying a pre-loaded dictionary's LZ4_streamHC_t into a + * working LZ4_streamHC_t, this function introduces a no-copy setup mechanism, + * in which the working stream references the dictionary stream in-place. + * + * Several assumptions are made about the state of the dictionary stream. + * Currently, only streams which have been prepared by LZ4_loadDictHC() should + * be expected to work. + * + * Alternatively, the provided dictionary stream pointer may be NULL, in which + * case any existing dictionary stream is unset. + * + * A dictionary should only be attached to a stream without any history (i.e., + * a stream that has just been reset). + * + * The dictionary will remain attached to the working stream only for the + * current stream session. Calls to LZ4_resetStreamHC(_fast) will remove the + * dictionary context association from the working stream. The dictionary + * stream (and source buffer) must remain in-place / accessible / unchanged + * through the lifetime of the stream session. + */ +LZ4LIB_API void +LZ4_attach_HC_dictionary(LZ4_streamHC_t* working_stream, + const LZ4_streamHC_t* dictionary_stream); + + +/*^********************************************** + * !!!!!! STATIC LINKING ONLY !!!!!! + ***********************************************/ + +/*-****************************************************************** + * PRIVATE DEFINITIONS : + * Do not use these definitions directly. + * They are merely exposed to allow static allocation of `LZ4_streamHC_t`. + * Declare an `LZ4_streamHC_t` directly, rather than any type below. + * Even then, only do so in the context of static linking, as definitions may change between versions. + ********************************************************************/ + +#define LZ4HC_DICTIONARY_LOGSIZE 16 +#define LZ4HC_MAXD (1<= LZ4HC_CLEVEL_OPT_MIN. + */ +LZ4LIB_STATIC_API void LZ4_favorDecompressionSpeed( + LZ4_streamHC_t* LZ4_streamHCPtr, int favor); + +/*! LZ4_resetStreamHC_fast() : v1.9.0+ + * When an LZ4_streamHC_t is known to be in a internally coherent state, + * it can often be prepared for a new compression with almost no work, only + * sometimes falling back to the full, expensive reset that is always required + * when the stream is in an indeterminate state (i.e., the reset performed by + * LZ4_resetStreamHC()). + * + * LZ4_streamHCs are guaranteed to be in a valid state when: + * - returned from LZ4_createStreamHC() + * - reset by LZ4_resetStreamHC() + * - memset(stream, 0, sizeof(LZ4_streamHC_t)) + * - the stream was in a valid state and was reset by LZ4_resetStreamHC_fast() + * - the stream was in a valid state and was then used in any compression call + * that returned success + * - the stream was in an indeterminate state and was used in a compression + * call that fully reset the state (LZ4_compress_HC_extStateHC()) and that + * returned success + * + * Note: + * A stream that was last used in a compression call that returned an error + * may be passed to this function. However, it will be fully reset, which will + * clear any existing history and settings from the context. + */ +LZ4LIB_STATIC_API void LZ4_resetStreamHC_fast( + LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel); + +/*! LZ4_compress_HC_extStateHC_fastReset() : + * A variant of LZ4_compress_HC_extStateHC(). + * + * Using this variant avoids an expensive initialization step. It is only safe + * to call if the state buffer is known to be correctly initialized already + * (see above comment on LZ4_resetStreamHC_fast() for a definition of + * "correctly initialized"). From a high level, the difference is that this + * function initializes the provided state with a call to + * LZ4_resetStreamHC_fast() while LZ4_compress_HC_extStateHC() starts with a + * call to LZ4_resetStreamHC(). + */ +LZ4LIB_STATIC_API int LZ4_compress_HC_extStateHC_fastReset ( + void* state, + const char* src, char* dst, + int srcSize, int dstCapacity, + int compressionLevel); + +#if defined (__cplusplus) +} +#endif + +#endif /* LZ4_HC_SLO_098092834 */ +#endif /* LZ4_HC_STATIC_LINKING_ONLY */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/__DECC_INCLUDE_EPILOGUE.H b/VCMP-LUA/modules/postgresql/include/openssl/__DECC_INCLUDE_EPILOGUE.H new file mode 100644 index 0000000..d251d0a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/__DECC_INCLUDE_EPILOGUE.H @@ -0,0 +1,22 @@ +/* + * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * This file is only used by HP C/C++ on VMS, and is included automatically + * after each header file from this directory + */ + +/* + * The C++ compiler doesn't understand these pragmas, even though it + * understands the corresponding command line qualifier. + */ +#ifndef __cplusplus +/* restore state. Must correspond to the save in __decc_include_prologue.h */ +# pragma names restore +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/__DECC_INCLUDE_PROLOGUE.H b/VCMP-LUA/modules/postgresql/include/openssl/__DECC_INCLUDE_PROLOGUE.H new file mode 100644 index 0000000..91ac6b3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/__DECC_INCLUDE_PROLOGUE.H @@ -0,0 +1,26 @@ +/* + * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * This file is only used by HP C/C++ on VMS, and is included automatically + * after each header file from this directory + */ + +/* + * The C++ compiler doesn't understand these pragmas, even though it + * understands the corresponding command line qualifier. + */ +#ifndef __cplusplus +/* save state */ +# pragma names save +/* have the compiler shorten symbols larger than 31 chars to 23 chars + * followed by a 8 hex char CRC + */ +# pragma names as_is,shortened +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/aes.h b/VCMP-LUA/modules/postgresql/include/openssl/aes.h new file mode 100644 index 0000000..2b6c683 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/aes.h @@ -0,0 +1,109 @@ +/* + * Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_AES_H +#define OPENSSL_AES_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_AES_H +#endif + +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define AES_BLOCK_SIZE 16 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + +#define AES_ENCRYPT 1 +#define AES_DECRYPT 0 + +#define AES_MAXNR 14 + +/* This should be a hidden type, but EVP requires that the size be known */ +struct aes_key_st { +#ifdef AES_LONG + unsigned long rd_key[4 * (AES_MAXNR + 1)]; +#else + unsigned int rd_key[4 * (AES_MAXNR + 1)]; +#endif + int rounds; +}; +typedef struct aes_key_st AES_KEY; + +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 const char *AES_options(void); +OSSL_DEPRECATEDIN_3_0 +int AES_set_encrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); +OSSL_DEPRECATEDIN_3_0 +int AES_set_decrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); +OSSL_DEPRECATEDIN_3_0 +void AES_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); +OSSL_DEPRECATEDIN_3_0 +void AES_decrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); +OSSL_DEPRECATEDIN_3_0 +void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key, const int enc); +OSSL_DEPRECATEDIN_3_0 +void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, const int enc); +OSSL_DEPRECATEDIN_3_0 +void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +OSSL_DEPRECATEDIN_3_0 +void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +OSSL_DEPRECATEDIN_3_0 +void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +OSSL_DEPRECATEDIN_3_0 +void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num); + +/* NB: the IV is _two_ blocks long */ +OSSL_DEPRECATEDIN_3_0 +void AES_ige_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, const int enc); +/* NB: the IV is _four_ blocks long */ +OSSL_DEPRECATEDIN_3_0 +void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, const AES_KEY *key2, + const unsigned char *ivec, const int enc); +OSSL_DEPRECATEDIN_3_0 +int AES_wrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, const unsigned char *in, + unsigned int inlen); +OSSL_DEPRECATEDIN_3_0 +int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, const unsigned char *in, + unsigned int inlen); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/asn1.h b/VCMP-LUA/modules/postgresql/include/openssl/asn1.h new file mode 100644 index 0000000..1b44ea2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/asn1.h @@ -0,0 +1,1125 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\asn1.h.in + * + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_ASN1_H +#define OPENSSL_ASN1_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_ASN1_H +#endif + +#ifndef OPENSSL_NO_STDIO +#include +#endif +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +#undef OPENSSL_EXTERN +#define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define V_ASN1_UNIVERSAL 0x00 +#define V_ASN1_APPLICATION 0x40 +#define V_ASN1_CONTEXT_SPECIFIC 0x80 +#define V_ASN1_PRIVATE 0xc0 + +#define V_ASN1_CONSTRUCTED 0x20 +#define V_ASN1_PRIMITIVE_TAG 0x1f +#define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG + +#define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ +#define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ +#define V_ASN1_ANY -4 /* used in ASN1 template code */ + +#define V_ASN1_UNDEF -1 +/* ASN.1 tag values */ +#define V_ASN1_EOC 0 +#define V_ASN1_BOOLEAN 1 +#define V_ASN1_INTEGER 2 +#define V_ASN1_BIT_STRING 3 +#define V_ASN1_OCTET_STRING 4 +#define V_ASN1_NULL 5 +#define V_ASN1_OBJECT 6 +#define V_ASN1_OBJECT_DESCRIPTOR 7 +#define V_ASN1_EXTERNAL 8 +#define V_ASN1_REAL 9 +#define V_ASN1_ENUMERATED 10 +#define V_ASN1_UTF8STRING 12 +#define V_ASN1_SEQUENCE 16 +#define V_ASN1_SET 17 +#define V_ASN1_NUMERICSTRING 18 +#define V_ASN1_PRINTABLESTRING 19 +#define V_ASN1_T61STRING 20 +#define V_ASN1_TELETEXSTRING 20 /* alias */ +#define V_ASN1_VIDEOTEXSTRING 21 +#define V_ASN1_IA5STRING 22 +#define V_ASN1_UTCTIME 23 +#define V_ASN1_GENERALIZEDTIME 24 +#define V_ASN1_GRAPHICSTRING 25 +#define V_ASN1_ISO64STRING 26 +#define V_ASN1_VISIBLESTRING 26 /* alias */ +#define V_ASN1_GENERALSTRING 27 +#define V_ASN1_UNIVERSALSTRING 28 +#define V_ASN1_BMPSTRING 30 + +/* + * NB the constants below are used internally by ASN1_INTEGER + * and ASN1_ENUMERATED to indicate the sign. They are *not* on + * the wire tag values. + */ + +#define V_ASN1_NEG 0x100 +#define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) +#define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) + +/* For use with d2i_ASN1_type_bytes() */ +#define B_ASN1_NUMERICSTRING 0x0001 +#define B_ASN1_PRINTABLESTRING 0x0002 +#define B_ASN1_T61STRING 0x0004 +#define B_ASN1_TELETEXSTRING 0x0004 +#define B_ASN1_VIDEOTEXSTRING 0x0008 +#define B_ASN1_IA5STRING 0x0010 +#define B_ASN1_GRAPHICSTRING 0x0020 +#define B_ASN1_ISO64STRING 0x0040 +#define B_ASN1_VISIBLESTRING 0x0040 +#define B_ASN1_GENERALSTRING 0x0080 +#define B_ASN1_UNIVERSALSTRING 0x0100 +#define B_ASN1_OCTET_STRING 0x0200 +#define B_ASN1_BIT_STRING 0x0400 +#define B_ASN1_BMPSTRING 0x0800 +#define B_ASN1_UNKNOWN 0x1000 +#define B_ASN1_UTF8STRING 0x2000 +#define B_ASN1_UTCTIME 0x4000 +#define B_ASN1_GENERALIZEDTIME 0x8000 +#define B_ASN1_SEQUENCE 0x10000 +/* For use with ASN1_mbstring_copy() */ +#define MBSTRING_FLAG 0x1000 +#define MBSTRING_UTF8 (MBSTRING_FLAG) +#define MBSTRING_ASC (MBSTRING_FLAG | 1) +#define MBSTRING_BMP (MBSTRING_FLAG | 2) +#define MBSTRING_UNIV (MBSTRING_FLAG | 4) +#define SMIME_OLDMIME 0x400 +#define SMIME_CRLFEOL 0x800 +#define SMIME_STREAM 0x1000 + +/* Stacks for types not otherwise defined in this header */ +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_ALGOR, X509_ALGOR, X509_ALGOR) +#define sk_X509_ALGOR_num(sk) OPENSSL_sk_num(ossl_check_const_X509_ALGOR_sk_type(sk)) +#define sk_X509_ALGOR_value(sk, idx) ((X509_ALGOR *)OPENSSL_sk_value(ossl_check_const_X509_ALGOR_sk_type(sk), (idx))) +#define sk_X509_ALGOR_new(cmp) ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_new(ossl_check_X509_ALGOR_compfunc_type(cmp))) +#define sk_X509_ALGOR_new_null() ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_new_null()) +#define sk_X509_ALGOR_new_reserve(cmp, n) ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_new_reserve(ossl_check_X509_ALGOR_compfunc_type(cmp), (n))) +#define sk_X509_ALGOR_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_ALGOR_sk_type(sk), (n)) +#define sk_X509_ALGOR_free(sk) OPENSSL_sk_free(ossl_check_X509_ALGOR_sk_type(sk)) +#define sk_X509_ALGOR_zero(sk) OPENSSL_sk_zero(ossl_check_X509_ALGOR_sk_type(sk)) +#define sk_X509_ALGOR_delete(sk, i) ((X509_ALGOR *)OPENSSL_sk_delete(ossl_check_X509_ALGOR_sk_type(sk), (i))) +#define sk_X509_ALGOR_delete_ptr(sk, ptr) ((X509_ALGOR *)OPENSSL_sk_delete_ptr(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr))) +#define sk_X509_ALGOR_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr)) +#define sk_X509_ALGOR_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr)) +#define sk_X509_ALGOR_pop(sk) ((X509_ALGOR *)OPENSSL_sk_pop(ossl_check_X509_ALGOR_sk_type(sk))) +#define sk_X509_ALGOR_shift(sk) ((X509_ALGOR *)OPENSSL_sk_shift(ossl_check_X509_ALGOR_sk_type(sk))) +#define sk_X509_ALGOR_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_freefunc_type(freefunc)) +#define sk_X509_ALGOR_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr), (idx)) +#define sk_X509_ALGOR_set(sk, idx, ptr) ((X509_ALGOR *)OPENSSL_sk_set(ossl_check_X509_ALGOR_sk_type(sk), (idx), ossl_check_X509_ALGOR_type(ptr))) +#define sk_X509_ALGOR_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr)) +#define sk_X509_ALGOR_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr)) +#define sk_X509_ALGOR_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr), pnum) +#define sk_X509_ALGOR_sort(sk) OPENSSL_sk_sort(ossl_check_X509_ALGOR_sk_type(sk)) +#define sk_X509_ALGOR_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_ALGOR_sk_type(sk)) +#define sk_X509_ALGOR_dup(sk) ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_dup(ossl_check_const_X509_ALGOR_sk_type(sk))) +#define sk_X509_ALGOR_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_copyfunc_type(copyfunc), ossl_check_X509_ALGOR_freefunc_type(freefunc))) +#define sk_X509_ALGOR_set_cmp_func(sk, cmp) ((sk_X509_ALGOR_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_compfunc_type(cmp))) + +/* clang-format on */ + +#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ +/* + * This indicates that the ASN1_STRING is not a real value but just a place + * holder for the location where indefinite length constructed data should be + * inserted in the memory buffer + */ +#define ASN1_STRING_FLAG_NDEF 0x010 + +/* + * This flag is used by the CMS code to indicate that a string is not + * complete and is a place holder for content when it had all been accessed. + * The flag will be reset when content has been written to it. + */ + +#define ASN1_STRING_FLAG_CONT 0x020 +/* + * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING + * type. + */ +#define ASN1_STRING_FLAG_MSTRING 0x040 +/* String is embedded and only content should be freed */ +#define ASN1_STRING_FLAG_EMBED 0x080 +/* String should be parsed in RFC 5280's time format */ +#define ASN1_STRING_FLAG_X509_TIME 0x100 +/* This is the base type that holds just about everything :-) */ +struct asn1_string_st { + int length; + int type; + unsigned char *data; + /* + * The value of the following field depends on the type being held. It + * is mostly being used for BIT_STRING so if the input data has a + * non-zero 'unused bits' value, it will be handled correctly + */ + long flags; +}; + +/* + * ASN1_ENCODING structure: this is used to save the received encoding of an + * ASN1 type. This is useful to get round problems with invalid encodings + * which can break signatures. + */ + +typedef struct ASN1_ENCODING_st { + unsigned char *enc; /* DER encoding */ + long len; /* Length of encoding */ + int modified; /* set to 1 if 'enc' is invalid */ +} ASN1_ENCODING; + +/* Used with ASN1 LONG type: if a long is set to this it is omitted */ +#define ASN1_LONG_UNDEF 0x7fffffffL + +#define STABLE_FLAGS_MALLOC 0x01 +/* + * A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted + * as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting + * STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias + * STABLE_FLAGS_CLEAR to reflect this. + */ +#define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC +#define STABLE_NO_MASK 0x02 +#define DIRSTRING_TYPE \ + (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING) +#define PKCS9STRING_TYPE (DIRSTRING_TYPE | B_ASN1_IA5STRING) + +struct asn1_string_table_st { + int nid; + long minsize; + long maxsize; + unsigned long mask; + unsigned long flags; +}; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ASN1_STRING_TABLE, ASN1_STRING_TABLE, ASN1_STRING_TABLE) +#define sk_ASN1_STRING_TABLE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk)) +#define sk_ASN1_STRING_TABLE_value(sk, idx) ((ASN1_STRING_TABLE *)OPENSSL_sk_value(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk), (idx))) +#define sk_ASN1_STRING_TABLE_new(cmp) ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_new(ossl_check_ASN1_STRING_TABLE_compfunc_type(cmp))) +#define sk_ASN1_STRING_TABLE_new_null() ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_new_null()) +#define sk_ASN1_STRING_TABLE_new_reserve(cmp, n) ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_STRING_TABLE_compfunc_type(cmp), (n))) +#define sk_ASN1_STRING_TABLE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_STRING_TABLE_sk_type(sk), (n)) +#define sk_ASN1_STRING_TABLE_free(sk) OPENSSL_sk_free(ossl_check_ASN1_STRING_TABLE_sk_type(sk)) +#define sk_ASN1_STRING_TABLE_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_STRING_TABLE_sk_type(sk)) +#define sk_ASN1_STRING_TABLE_delete(sk, i) ((ASN1_STRING_TABLE *)OPENSSL_sk_delete(ossl_check_ASN1_STRING_TABLE_sk_type(sk), (i))) +#define sk_ASN1_STRING_TABLE_delete_ptr(sk, ptr) ((ASN1_STRING_TABLE *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr))) +#define sk_ASN1_STRING_TABLE_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr)) +#define sk_ASN1_STRING_TABLE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr)) +#define sk_ASN1_STRING_TABLE_pop(sk) ((ASN1_STRING_TABLE *)OPENSSL_sk_pop(ossl_check_ASN1_STRING_TABLE_sk_type(sk))) +#define sk_ASN1_STRING_TABLE_shift(sk) ((ASN1_STRING_TABLE *)OPENSSL_sk_shift(ossl_check_ASN1_STRING_TABLE_sk_type(sk))) +#define sk_ASN1_STRING_TABLE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_freefunc_type(freefunc)) +#define sk_ASN1_STRING_TABLE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr), (idx)) +#define sk_ASN1_STRING_TABLE_set(sk, idx, ptr) ((ASN1_STRING_TABLE *)OPENSSL_sk_set(ossl_check_ASN1_STRING_TABLE_sk_type(sk), (idx), ossl_check_ASN1_STRING_TABLE_type(ptr))) +#define sk_ASN1_STRING_TABLE_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr)) +#define sk_ASN1_STRING_TABLE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr)) +#define sk_ASN1_STRING_TABLE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr), pnum) +#define sk_ASN1_STRING_TABLE_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_STRING_TABLE_sk_type(sk)) +#define sk_ASN1_STRING_TABLE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk)) +#define sk_ASN1_STRING_TABLE_dup(sk) ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_dup(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk))) +#define sk_ASN1_STRING_TABLE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_copyfunc_type(copyfunc), ossl_check_ASN1_STRING_TABLE_freefunc_type(freefunc))) +#define sk_ASN1_STRING_TABLE_set_cmp_func(sk, cmp) ((sk_ASN1_STRING_TABLE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_compfunc_type(cmp))) + +/* clang-format on */ + +/* size limits: this stuff is taken straight from RFC 5280 */ + +#define ub_name 32768 +#define ub_common_name 64 +#define ub_locality_name 128 +#define ub_state_name 128 +#define ub_organization_name 64 +#define ub_organization_unit_name 64 +#define ub_title 64 +#define ub_email_address 128 + +/* + * Declarations for template structures: for full definitions see asn1t.h + */ +typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; +typedef struct ASN1_TLC_st ASN1_TLC; +/* This is just an opaque pointer */ +typedef struct ASN1_VALUE_st ASN1_VALUE; + +/* Declare ASN1 functions: the implement macro is in asn1t.h */ + +/* + * The mysterious 'extern' that's passed to some macros is innocuous, + * and is there to quiet pre-C99 compilers that may complain about empty + * arguments in macro calls. + */ + +#define DECLARE_ASN1_FUNCTIONS_attr(attr, type) \ + DECLARE_ASN1_FUNCTIONS_name_attr(attr, type, type) +#define DECLARE_ASN1_FUNCTIONS(type) \ + DECLARE_ASN1_FUNCTIONS_attr(extern, type) + +#define DECLARE_ASN1_ALLOC_FUNCTIONS_attr(attr, type) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name_attr(attr, type, type) +#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_attr(extern, type) + +#define DECLARE_ASN1_FUNCTIONS_name_attr(attr, type, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name_attr(attr, type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(attr, type, name) +#define DECLARE_ASN1_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_FUNCTIONS_name_attr(extern, type, name) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS_attr(attr, type, itname, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(attr, type, name) \ + DECLARE_ASN1_ITEM_attr(attr, itname) +#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_attr(extern, type, itname, name) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(attr, type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_attr(attr, type, name, name) +#define DECLARE_ASN1_ENCODE_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(extern, type, name) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(attr, type, name) \ + attr type *d2i_##name(type **a, const unsigned char **in, long len); \ + attr int i2d_##name(const type *a, unsigned char **out); +#define DECLARE_ASN1_ENCODE_FUNCTIONS_only(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(extern, type, name) + +#define DECLARE_ASN1_NDEF_FUNCTION_attr(attr, name) \ + attr int i2d_##name##_NDEF(const name *a, unsigned char **out); +#define DECLARE_ASN1_NDEF_FUNCTION(name) \ + DECLARE_ASN1_NDEF_FUNCTION_attr(extern, name) + +#define DECLARE_ASN1_ALLOC_FUNCTIONS_name_attr(attr, type, name) \ + attr type *name##_new(void); \ + attr void name##_free(type *a); +#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name_attr(extern, type, name) + +#define DECLARE_ASN1_DUP_FUNCTION_attr(attr, type) \ + DECLARE_ASN1_DUP_FUNCTION_name_attr(attr, type, type) +#define DECLARE_ASN1_DUP_FUNCTION(type) \ + DECLARE_ASN1_DUP_FUNCTION_attr(extern, type) + +#define DECLARE_ASN1_DUP_FUNCTION_name_attr(attr, type, name) \ + attr type *name##_dup(const type *a); +#define DECLARE_ASN1_DUP_FUNCTION_name(type, name) \ + DECLARE_ASN1_DUP_FUNCTION_name_attr(extern, type, name) + +#define DECLARE_ASN1_PRINT_FUNCTION_attr(attr, stname) \ + DECLARE_ASN1_PRINT_FUNCTION_fname_attr(attr, stname, stname) +#define DECLARE_ASN1_PRINT_FUNCTION(stname) \ + DECLARE_ASN1_PRINT_FUNCTION_attr(extern, stname) + +#define DECLARE_ASN1_PRINT_FUNCTION_fname_attr(attr, stname, fname) \ + attr int fname##_print_ctx(BIO *out, const stname *x, int indent, \ + const ASN1_PCTX *pctx); +#define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ + DECLARE_ASN1_PRINT_FUNCTION_fname_attr(extern, stname, fname) + +#define D2I_OF(type) type *(*)(type **, const unsigned char **, long) +#define I2D_OF(type) int (*)(const type *, unsigned char **) + +#define CHECKED_D2I_OF(type, d2i) \ + ((d2i_of_void *)(1 ? d2i : ((D2I_OF(type))0))) +#define CHECKED_I2D_OF(type, i2d) \ + ((i2d_of_void *)(1 ? i2d : ((I2D_OF(type))0))) +#define CHECKED_NEW_OF(type, xnew) \ + ((void *(*)(void))(1 ? xnew : ((type * (*)(void))0))) +#define CHECKED_PTR_OF(type, p) \ + ((void *)(1 ? p : (type *)0)) +#define CHECKED_PPTR_OF(type, p) \ + ((void **)(1 ? p : (type **)0)) + +#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **, const unsigned char **, long) +#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(const type *, unsigned char **) +#define TYPEDEF_D2I2D_OF(type) \ + TYPEDEF_D2I_OF(type); \ + TYPEDEF_I2D_OF(type) + +typedef void *d2i_of_void(void **, const unsigned char **, long); +typedef int i2d_of_void(const void *, unsigned char **); +typedef int OSSL_i2d_of_void_ctx(const void *, unsigned char **, void *vctx); + +/*- + * The following macros and typedefs allow an ASN1_ITEM + * to be embedded in a structure and referenced. Since + * the ASN1_ITEM pointers need to be globally accessible + * (possibly from shared libraries) they may exist in + * different forms. On platforms that support it the + * ASN1_ITEM structure itself will be globally exported. + * Other platforms will export a function that returns + * an ASN1_ITEM pointer. + * + * To handle both cases transparently the macros below + * should be used instead of hard coding an ASN1_ITEM + * pointer in a structure. + * + * The structure will look like this: + * + * typedef struct SOMETHING_st { + * ... + * ASN1_ITEM_EXP *iptr; + * ... + * } SOMETHING; + * + * It would be initialised as e.g.: + * + * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; + * + * and the actual pointer extracted with: + * + * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); + * + * Finally an ASN1_ITEM pointer can be extracted from an + * appropriate reference with: ASN1_ITEM_rptr(X509). This + * would be used when a function takes an ASN1_ITEM * argument. + * + */ + +/* + * Platforms that can't easily handle shared global variables are declared as + * functions returning ASN1_ITEM pointers. + */ + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM *ASN1_ITEM_EXP(void); + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +#define ASN1_ITEM_ptr(iptr) (iptr()) + +/* Macro to include ASN1_ITEM pointer from base type */ +#define ASN1_ITEM_ref(iptr) (iptr##_it) + +#define ASN1_ITEM_rptr(ref) (ref##_it()) + +#define DECLARE_ASN1_ITEM_attr(attr, name) \ + attr const ASN1_ITEM *name##_it(void); +#define DECLARE_ASN1_ITEM(name) \ + DECLARE_ASN1_ITEM_attr(extern, name) + +/* Parameters used by ASN1_STRING_print_ex() */ + +/* + * These determine which characters to escape: RFC2253 special characters, + * control characters and MSB set characters + */ + +#define ASN1_STRFLGS_ESC_2253 1 +#define ASN1_STRFLGS_ESC_CTRL 2 +#define ASN1_STRFLGS_ESC_MSB 4 + +/* Lower 8 bits are reserved as an output type specifier */ +#define ASN1_DTFLGS_TYPE_MASK 0x0FUL +#define ASN1_DTFLGS_RFC822 0x00UL +#define ASN1_DTFLGS_ISO8601 0x01UL + +/* + * This flag determines how we do escaping: normally RC2253 backslash only, + * set this to use backslash and quote. + */ + +#define ASN1_STRFLGS_ESC_QUOTE 8 + +/* These three flags are internal use only. */ + +/* Character is a valid PrintableString character */ +#define CHARTYPE_PRINTABLESTRING 0x10 +/* Character needs escaping if it is the first character */ +#define CHARTYPE_FIRST_ESC_2253 0x20 +/* Character needs escaping if it is the last character */ +#define CHARTYPE_LAST_ESC_2253 0x40 + +/* + * NB the internal flags are safely reused below by flags handled at the top + * level. + */ + +/* + * If this is set we convert all character strings to UTF8 first + */ + +#define ASN1_STRFLGS_UTF8_CONVERT 0x10 + +/* + * If this is set we don't attempt to interpret content: just assume all + * strings are 1 byte per character. This will produce some pretty odd + * looking output! + */ + +#define ASN1_STRFLGS_IGNORE_TYPE 0x20 + +/* If this is set we include the string type in the output */ +#define ASN1_STRFLGS_SHOW_TYPE 0x40 + +/* + * This determines which strings to display and which to 'dump' (hex dump of + * content octets or DER encoding). We can only dump non character strings or + * everything. If we don't dump 'unknown' they are interpreted as character + * strings with 1 octet per character and are subject to the usual escaping + * options. + */ + +#define ASN1_STRFLGS_DUMP_ALL 0x80 +#define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 + +/* + * These determine what 'dumping' does, we can dump the content octets or the + * DER encoding: both use the RFC2253 #XXXXX notation. + */ + +#define ASN1_STRFLGS_DUMP_DER 0x200 + +/* + * This flag specifies that RC2254 escaping shall be performed. + */ +#define ASN1_STRFLGS_ESC_2254 0x400 + +/* + * All the string flags consistent with RFC2253, escaping control characters + * isn't essential in RFC2253 but it is advisable anyway. + */ + +#define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER) + +struct asn1_type_st { + int type; + union { + char *ptr; + ASN1_BOOLEAN boolean; + ASN1_STRING *asn1_string; + ASN1_OBJECT *object; + ASN1_INTEGER *integer; + ASN1_ENUMERATED *enumerated; + ASN1_BIT_STRING *bit_string; + ASN1_OCTET_STRING *octet_string; + ASN1_PRINTABLESTRING *printablestring; + ASN1_T61STRING *t61string; + ASN1_IA5STRING *ia5string; + ASN1_GENERALSTRING *generalstring; + ASN1_BMPSTRING *bmpstring; + ASN1_UNIVERSALSTRING *universalstring; + ASN1_UTCTIME *utctime; + ASN1_GENERALIZEDTIME *generalizedtime; + ASN1_VISIBLESTRING *visiblestring; + ASN1_UTF8STRING *utf8string; + /* + * set and sequence are left complete and still contain the set or + * sequence bytes + */ + ASN1_STRING *set; + ASN1_STRING *sequence; + ASN1_VALUE *asn1_value; + } value; +}; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ASN1_TYPE, ASN1_TYPE, ASN1_TYPE) +#define sk_ASN1_TYPE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_TYPE_sk_type(sk)) +#define sk_ASN1_TYPE_value(sk, idx) ((ASN1_TYPE *)OPENSSL_sk_value(ossl_check_const_ASN1_TYPE_sk_type(sk), (idx))) +#define sk_ASN1_TYPE_new(cmp) ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_new(ossl_check_ASN1_TYPE_compfunc_type(cmp))) +#define sk_ASN1_TYPE_new_null() ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_new_null()) +#define sk_ASN1_TYPE_new_reserve(cmp, n) ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_TYPE_compfunc_type(cmp), (n))) +#define sk_ASN1_TYPE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_TYPE_sk_type(sk), (n)) +#define sk_ASN1_TYPE_free(sk) OPENSSL_sk_free(ossl_check_ASN1_TYPE_sk_type(sk)) +#define sk_ASN1_TYPE_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_TYPE_sk_type(sk)) +#define sk_ASN1_TYPE_delete(sk, i) ((ASN1_TYPE *)OPENSSL_sk_delete(ossl_check_ASN1_TYPE_sk_type(sk), (i))) +#define sk_ASN1_TYPE_delete_ptr(sk, ptr) ((ASN1_TYPE *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr))) +#define sk_ASN1_TYPE_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr)) +#define sk_ASN1_TYPE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr)) +#define sk_ASN1_TYPE_pop(sk) ((ASN1_TYPE *)OPENSSL_sk_pop(ossl_check_ASN1_TYPE_sk_type(sk))) +#define sk_ASN1_TYPE_shift(sk) ((ASN1_TYPE *)OPENSSL_sk_shift(ossl_check_ASN1_TYPE_sk_type(sk))) +#define sk_ASN1_TYPE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_freefunc_type(freefunc)) +#define sk_ASN1_TYPE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr), (idx)) +#define sk_ASN1_TYPE_set(sk, idx, ptr) ((ASN1_TYPE *)OPENSSL_sk_set(ossl_check_ASN1_TYPE_sk_type(sk), (idx), ossl_check_ASN1_TYPE_type(ptr))) +#define sk_ASN1_TYPE_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr)) +#define sk_ASN1_TYPE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr)) +#define sk_ASN1_TYPE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr), pnum) +#define sk_ASN1_TYPE_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_TYPE_sk_type(sk)) +#define sk_ASN1_TYPE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_TYPE_sk_type(sk)) +#define sk_ASN1_TYPE_dup(sk) ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_dup(ossl_check_const_ASN1_TYPE_sk_type(sk))) +#define sk_ASN1_TYPE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_copyfunc_type(copyfunc), ossl_check_ASN1_TYPE_freefunc_type(freefunc))) +#define sk_ASN1_TYPE_set_cmp_func(sk, cmp) ((sk_ASN1_TYPE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_compfunc_type(cmp))) + +/* clang-format on */ + +typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; + +DECLARE_ASN1_ENCODE_FUNCTIONS_name(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) +DECLARE_ASN1_ENCODE_FUNCTIONS_name(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) + +/* This is used to contain a list of bit names */ +typedef struct BIT_STRING_BITNAME_st { + int bitnum; + const char *lname; + const char *sname; +} BIT_STRING_BITNAME; + +#define B_ASN1_TIME \ + B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME + +#define B_ASN1_PRINTABLE \ + B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN + +#define B_ASN1_DIRECTORYSTRING \ + B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING + +#define B_ASN1_DISPLAYTEXT \ + B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING + +DECLARE_ASN1_ALLOC_FUNCTIONS_name(ASN1_TYPE, ASN1_TYPE) +DECLARE_ASN1_ENCODE_FUNCTIONS(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) + +int ASN1_TYPE_get(const ASN1_TYPE *a); +void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); +int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); +int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); + +ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t); +void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t); + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ASN1_OBJECT, ASN1_OBJECT, ASN1_OBJECT) +#define sk_ASN1_OBJECT_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_OBJECT_sk_type(sk)) +#define sk_ASN1_OBJECT_value(sk, idx) ((ASN1_OBJECT *)OPENSSL_sk_value(ossl_check_const_ASN1_OBJECT_sk_type(sk), (idx))) +#define sk_ASN1_OBJECT_new(cmp) ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_new(ossl_check_ASN1_OBJECT_compfunc_type(cmp))) +#define sk_ASN1_OBJECT_new_null() ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_new_null()) +#define sk_ASN1_OBJECT_new_reserve(cmp, n) ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_OBJECT_compfunc_type(cmp), (n))) +#define sk_ASN1_OBJECT_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_OBJECT_sk_type(sk), (n)) +#define sk_ASN1_OBJECT_free(sk) OPENSSL_sk_free(ossl_check_ASN1_OBJECT_sk_type(sk)) +#define sk_ASN1_OBJECT_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_OBJECT_sk_type(sk)) +#define sk_ASN1_OBJECT_delete(sk, i) ((ASN1_OBJECT *)OPENSSL_sk_delete(ossl_check_ASN1_OBJECT_sk_type(sk), (i))) +#define sk_ASN1_OBJECT_delete_ptr(sk, ptr) ((ASN1_OBJECT *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr))) +#define sk_ASN1_OBJECT_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr)) +#define sk_ASN1_OBJECT_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr)) +#define sk_ASN1_OBJECT_pop(sk) ((ASN1_OBJECT *)OPENSSL_sk_pop(ossl_check_ASN1_OBJECT_sk_type(sk))) +#define sk_ASN1_OBJECT_shift(sk) ((ASN1_OBJECT *)OPENSSL_sk_shift(ossl_check_ASN1_OBJECT_sk_type(sk))) +#define sk_ASN1_OBJECT_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_freefunc_type(freefunc)) +#define sk_ASN1_OBJECT_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr), (idx)) +#define sk_ASN1_OBJECT_set(sk, idx, ptr) ((ASN1_OBJECT *)OPENSSL_sk_set(ossl_check_ASN1_OBJECT_sk_type(sk), (idx), ossl_check_ASN1_OBJECT_type(ptr))) +#define sk_ASN1_OBJECT_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr)) +#define sk_ASN1_OBJECT_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr)) +#define sk_ASN1_OBJECT_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr), pnum) +#define sk_ASN1_OBJECT_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_OBJECT_sk_type(sk)) +#define sk_ASN1_OBJECT_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_OBJECT_sk_type(sk)) +#define sk_ASN1_OBJECT_dup(sk) ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_dup(ossl_check_const_ASN1_OBJECT_sk_type(sk))) +#define sk_ASN1_OBJECT_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_copyfunc_type(copyfunc), ossl_check_ASN1_OBJECT_freefunc_type(freefunc))) +#define sk_ASN1_OBJECT_set_cmp_func(sk, cmp) ((sk_ASN1_OBJECT_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_compfunc_type(cmp))) + +/* clang-format on */ + +DECLARE_ASN1_FUNCTIONS(ASN1_OBJECT) + +ASN1_STRING *ASN1_STRING_new(void); +void ASN1_STRING_free(ASN1_STRING *a); +void ASN1_STRING_clear_free(ASN1_STRING *a); +int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); +DECLARE_ASN1_DUP_FUNCTION(ASN1_STRING) +ASN1_STRING *ASN1_STRING_type_new(int type); +int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); +/* + * Since this is used to store all sorts of things, via macros, for now, + * make its data void * + */ +int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); +void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); +int ASN1_STRING_length(const ASN1_STRING *x); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 void ASN1_STRING_length_set(ASN1_STRING *x, int n); +#endif +int ASN1_STRING_type(const ASN1_STRING *x); +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 unsigned char *ASN1_STRING_data(ASN1_STRING *x); +#endif +const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); + +DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) +int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); +int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); +int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, + const unsigned char *flags, int flags_len); + +int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, + BIT_STRING_BITNAME *tbl, int indent); +int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); +int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, + BIT_STRING_BITNAME *tbl); + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ASN1_INTEGER, ASN1_INTEGER, ASN1_INTEGER) +#define sk_ASN1_INTEGER_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_INTEGER_sk_type(sk)) +#define sk_ASN1_INTEGER_value(sk, idx) ((ASN1_INTEGER *)OPENSSL_sk_value(ossl_check_const_ASN1_INTEGER_sk_type(sk), (idx))) +#define sk_ASN1_INTEGER_new(cmp) ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_new(ossl_check_ASN1_INTEGER_compfunc_type(cmp))) +#define sk_ASN1_INTEGER_new_null() ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_new_null()) +#define sk_ASN1_INTEGER_new_reserve(cmp, n) ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_INTEGER_compfunc_type(cmp), (n))) +#define sk_ASN1_INTEGER_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_INTEGER_sk_type(sk), (n)) +#define sk_ASN1_INTEGER_free(sk) OPENSSL_sk_free(ossl_check_ASN1_INTEGER_sk_type(sk)) +#define sk_ASN1_INTEGER_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_INTEGER_sk_type(sk)) +#define sk_ASN1_INTEGER_delete(sk, i) ((ASN1_INTEGER *)OPENSSL_sk_delete(ossl_check_ASN1_INTEGER_sk_type(sk), (i))) +#define sk_ASN1_INTEGER_delete_ptr(sk, ptr) ((ASN1_INTEGER *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr))) +#define sk_ASN1_INTEGER_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr)) +#define sk_ASN1_INTEGER_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr)) +#define sk_ASN1_INTEGER_pop(sk) ((ASN1_INTEGER *)OPENSSL_sk_pop(ossl_check_ASN1_INTEGER_sk_type(sk))) +#define sk_ASN1_INTEGER_shift(sk) ((ASN1_INTEGER *)OPENSSL_sk_shift(ossl_check_ASN1_INTEGER_sk_type(sk))) +#define sk_ASN1_INTEGER_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_freefunc_type(freefunc)) +#define sk_ASN1_INTEGER_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr), (idx)) +#define sk_ASN1_INTEGER_set(sk, idx, ptr) ((ASN1_INTEGER *)OPENSSL_sk_set(ossl_check_ASN1_INTEGER_sk_type(sk), (idx), ossl_check_ASN1_INTEGER_type(ptr))) +#define sk_ASN1_INTEGER_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr)) +#define sk_ASN1_INTEGER_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr)) +#define sk_ASN1_INTEGER_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr), pnum) +#define sk_ASN1_INTEGER_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_INTEGER_sk_type(sk)) +#define sk_ASN1_INTEGER_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_INTEGER_sk_type(sk)) +#define sk_ASN1_INTEGER_dup(sk) ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_dup(ossl_check_const_ASN1_INTEGER_sk_type(sk))) +#define sk_ASN1_INTEGER_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_copyfunc_type(copyfunc), ossl_check_ASN1_INTEGER_freefunc_type(freefunc))) +#define sk_ASN1_INTEGER_set_cmp_func(sk, cmp) ((sk_ASN1_INTEGER_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_compfunc_type(cmp))) + +/* clang-format on */ + +DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) +ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, + long length); +DECLARE_ASN1_DUP_FUNCTION(ASN1_INTEGER) +int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); + +DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) + +int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); +ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); +ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, + int offset_day, long offset_sec); +int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); +int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); + +int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, + time_t t); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, + time_t t, int offset_day, + long offset_sec); +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); + +int ASN1_TIME_diff(int *pday, int *psec, + const ASN1_TIME *from, const ASN1_TIME *to); + +DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) +DECLARE_ASN1_DUP_FUNCTION(ASN1_OCTET_STRING) +int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, + const ASN1_OCTET_STRING *b); +int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, + int len); + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ASN1_UTF8STRING, ASN1_UTF8STRING, ASN1_UTF8STRING) +#define sk_ASN1_UTF8STRING_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_UTF8STRING_sk_type(sk)) +#define sk_ASN1_UTF8STRING_value(sk, idx) ((ASN1_UTF8STRING *)OPENSSL_sk_value(ossl_check_const_ASN1_UTF8STRING_sk_type(sk), (idx))) +#define sk_ASN1_UTF8STRING_new(cmp) ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_new(ossl_check_ASN1_UTF8STRING_compfunc_type(cmp))) +#define sk_ASN1_UTF8STRING_new_null() ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_new_null()) +#define sk_ASN1_UTF8STRING_new_reserve(cmp, n) ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_UTF8STRING_compfunc_type(cmp), (n))) +#define sk_ASN1_UTF8STRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_UTF8STRING_sk_type(sk), (n)) +#define sk_ASN1_UTF8STRING_free(sk) OPENSSL_sk_free(ossl_check_ASN1_UTF8STRING_sk_type(sk)) +#define sk_ASN1_UTF8STRING_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_UTF8STRING_sk_type(sk)) +#define sk_ASN1_UTF8STRING_delete(sk, i) ((ASN1_UTF8STRING *)OPENSSL_sk_delete(ossl_check_ASN1_UTF8STRING_sk_type(sk), (i))) +#define sk_ASN1_UTF8STRING_delete_ptr(sk, ptr) ((ASN1_UTF8STRING *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr))) +#define sk_ASN1_UTF8STRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr)) +#define sk_ASN1_UTF8STRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr)) +#define sk_ASN1_UTF8STRING_pop(sk) ((ASN1_UTF8STRING *)OPENSSL_sk_pop(ossl_check_ASN1_UTF8STRING_sk_type(sk))) +#define sk_ASN1_UTF8STRING_shift(sk) ((ASN1_UTF8STRING *)OPENSSL_sk_shift(ossl_check_ASN1_UTF8STRING_sk_type(sk))) +#define sk_ASN1_UTF8STRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_freefunc_type(freefunc)) +#define sk_ASN1_UTF8STRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr), (idx)) +#define sk_ASN1_UTF8STRING_set(sk, idx, ptr) ((ASN1_UTF8STRING *)OPENSSL_sk_set(ossl_check_ASN1_UTF8STRING_sk_type(sk), (idx), ossl_check_ASN1_UTF8STRING_type(ptr))) +#define sk_ASN1_UTF8STRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr)) +#define sk_ASN1_UTF8STRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr)) +#define sk_ASN1_UTF8STRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr), pnum) +#define sk_ASN1_UTF8STRING_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_UTF8STRING_sk_type(sk)) +#define sk_ASN1_UTF8STRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_UTF8STRING_sk_type(sk)) +#define sk_ASN1_UTF8STRING_dup(sk) ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_dup(ossl_check_const_ASN1_UTF8STRING_sk_type(sk))) +#define sk_ASN1_UTF8STRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_copyfunc_type(copyfunc), ossl_check_ASN1_UTF8STRING_freefunc_type(freefunc))) +#define sk_ASN1_UTF8STRING_set_cmp_func(sk, cmp) ((sk_ASN1_UTF8STRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_compfunc_type(cmp))) + +/* clang-format on */ + +DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_NULL) +DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) + +int UTF8_getc(const unsigned char *str, int len, unsigned long *val); +int UTF8_putc(unsigned char *str, int len, unsigned long value); + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ASN1_GENERALSTRING, ASN1_GENERALSTRING, ASN1_GENERALSTRING) +#define sk_ASN1_GENERALSTRING_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk)) +#define sk_ASN1_GENERALSTRING_value(sk, idx) ((ASN1_GENERALSTRING *)OPENSSL_sk_value(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk), (idx))) +#define sk_ASN1_GENERALSTRING_new(cmp) ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_new(ossl_check_ASN1_GENERALSTRING_compfunc_type(cmp))) +#define sk_ASN1_GENERALSTRING_new_null() ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_new_null()) +#define sk_ASN1_GENERALSTRING_new_reserve(cmp, n) ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_GENERALSTRING_compfunc_type(cmp), (n))) +#define sk_ASN1_GENERALSTRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_GENERALSTRING_sk_type(sk), (n)) +#define sk_ASN1_GENERALSTRING_free(sk) OPENSSL_sk_free(ossl_check_ASN1_GENERALSTRING_sk_type(sk)) +#define sk_ASN1_GENERALSTRING_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_GENERALSTRING_sk_type(sk)) +#define sk_ASN1_GENERALSTRING_delete(sk, i) ((ASN1_GENERALSTRING *)OPENSSL_sk_delete(ossl_check_ASN1_GENERALSTRING_sk_type(sk), (i))) +#define sk_ASN1_GENERALSTRING_delete_ptr(sk, ptr) ((ASN1_GENERALSTRING *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr))) +#define sk_ASN1_GENERALSTRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr)) +#define sk_ASN1_GENERALSTRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr)) +#define sk_ASN1_GENERALSTRING_pop(sk) ((ASN1_GENERALSTRING *)OPENSSL_sk_pop(ossl_check_ASN1_GENERALSTRING_sk_type(sk))) +#define sk_ASN1_GENERALSTRING_shift(sk) ((ASN1_GENERALSTRING *)OPENSSL_sk_shift(ossl_check_ASN1_GENERALSTRING_sk_type(sk))) +#define sk_ASN1_GENERALSTRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_freefunc_type(freefunc)) +#define sk_ASN1_GENERALSTRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr), (idx)) +#define sk_ASN1_GENERALSTRING_set(sk, idx, ptr) ((ASN1_GENERALSTRING *)OPENSSL_sk_set(ossl_check_ASN1_GENERALSTRING_sk_type(sk), (idx), ossl_check_ASN1_GENERALSTRING_type(ptr))) +#define sk_ASN1_GENERALSTRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr)) +#define sk_ASN1_GENERALSTRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr)) +#define sk_ASN1_GENERALSTRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr), pnum) +#define sk_ASN1_GENERALSTRING_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_GENERALSTRING_sk_type(sk)) +#define sk_ASN1_GENERALSTRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk)) +#define sk_ASN1_GENERALSTRING_dup(sk) ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_dup(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk))) +#define sk_ASN1_GENERALSTRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_copyfunc_type(copyfunc), ossl_check_ASN1_GENERALSTRING_freefunc_type(freefunc))) +#define sk_ASN1_GENERALSTRING_set_cmp_func(sk, cmp) ((sk_ASN1_GENERALSTRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_compfunc_type(cmp))) + +/* clang-format on */ + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) +DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_TIME) + +DECLARE_ASN1_DUP_FUNCTION(ASN1_TIME) +DECLARE_ASN1_DUP_FUNCTION(ASN1_UTCTIME) +DECLARE_ASN1_DUP_FUNCTION(ASN1_GENERALIZEDTIME) + +DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) + +ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); +ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, + int offset_day, long offset_sec); +int ASN1_TIME_check(const ASN1_TIME *t); +ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, + ASN1_GENERALIZEDTIME **out); +int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); +int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str); +int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm); +int ASN1_TIME_normalize(ASN1_TIME *s); +int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t); +int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b); + +int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); +int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); +int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a); +int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); +int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a); +int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); +int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type); +int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a); + +int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); +ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, + const char *sn, const char *ln); + +int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); +int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); +int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); +int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); + +int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); +long ASN1_INTEGER_get(const ASN1_INTEGER *a); +ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); +BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); + +int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); +int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); + +int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); +long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); +ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); +BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn); + +/* General */ +/* given a string, return the correct type, max is the maximum length */ +int ASN1_PRINTABLE_type(const unsigned char *s, int max); + +unsigned long ASN1_tag2bit(int tag); + +/* SPECIALS */ +int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, + int *pclass, long omax); +int ASN1_check_infinite_end(unsigned char **p, long len); +int ASN1_const_check_infinite_end(const unsigned char **p, long len); +void ASN1_put_object(unsigned char **pp, int constructed, int length, + int tag, int xclass); +int ASN1_put_eoc(unsigned char **pp); +int ASN1_object_size(int constructed, int length, int tag); + +/* Used to implement other functions */ +void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, const void *x); + +#define ASN1_dup_of(type, i2d, d2i, x) \ + ((type *)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(const type, x))) + +void *ASN1_item_dup(const ASN1_ITEM *it, const void *x); +int ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + const void *data, const ASN1_OCTET_STRING *id, + EVP_PKEY *pkey, const EVP_MD *md, OSSL_LIB_CTX *libctx, + const char *propq); +int ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg, + const ASN1_BIT_STRING *signature, const void *data, + const ASN1_OCTET_STRING *id, EVP_PKEY *pkey, + OSSL_LIB_CTX *libctx, const char *propq); + +/* ASN1 alloc/free macros for when a type is only used internally */ + +#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) +#define M_ASN1_free_of(x, type) \ + ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) + +#ifndef OPENSSL_NO_STDIO +void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); + +#define ASN1_d2i_fp_of(type, xnew, d2i, in, x) \ + ((type *)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_fp_ex(const ASN1_ITEM *it, FILE *in, void *x, + OSSL_LIB_CTX *libctx, const char *propq); +void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); +int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, const void *x); + +#define ASN1_i2d_fp_of(type, i2d, out, x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, const void *x); +int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); +#endif + +int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in); + +void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x); + +#define ASN1_d2i_bio_of(type, xnew, d2i, in, x) \ + ((type *)ASN1_d2i_bio(CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_bio_ex(const ASN1_ITEM *it, BIO *in, void *pval, + OSSL_LIB_CTX *libctx, const char *propq); +void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *pval); +int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, const void *x); + +#define ASN1_i2d_bio_of(type, i2d, out, x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, const void *x); +BIO *ASN1_item_i2d_mem_bio(const ASN1_ITEM *it, const ASN1_VALUE *val); +int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); +int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); +int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm); +int ASN1_TIME_print_ex(BIO *bp, const ASN1_TIME *tm, unsigned long flags); +int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); +int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); +int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off); +int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, + unsigned char *buf, int off); +int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); +int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, + int dump); +const char *ASN1_tag2str(int tag); + +/* Used to load and write Netscape format cert */ + +int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); + +int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); +int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len); +int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, + unsigned char *data, int len); +int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, + unsigned char *data, int max_len); + +void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it); +void *ASN1_item_unpack_ex(const ASN1_STRING *oct, const ASN1_ITEM *it, + OSSL_LIB_CTX *libctx, const char *propq); + +ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, + ASN1_OCTET_STRING **oct); + +void ASN1_STRING_set_default_mask(unsigned long mask); +int ASN1_STRING_set_default_mask_asc(const char *p); +unsigned long ASN1_STRING_get_default_mask(void); +int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask); +int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask, + long minsize, long maxsize); + +ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, + const unsigned char *in, int inlen, + int inform, int nid); +ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); +int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); +void ASN1_STRING_TABLE_cleanup(void); + +/* ASN1 template functions */ + +/* Old API compatible functions */ +ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); +ASN1_VALUE *ASN1_item_new_ex(const ASN1_ITEM *it, OSSL_LIB_CTX *libctx, + const char *propq); +void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); +ASN1_VALUE *ASN1_item_d2i_ex(ASN1_VALUE **val, const unsigned char **in, + long len, const ASN1_ITEM *it, + OSSL_LIB_CTX *libctx, const char *propq); +ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, + long len, const ASN1_ITEM *it); +int ASN1_item_i2d(const ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); +int ASN1_item_ndef_i2d(const ASN1_VALUE *val, unsigned char **out, + const ASN1_ITEM *it); + +void ASN1_add_oid_module(void); +void ASN1_add_stable_module(void); + +ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf); +ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf); +int ASN1_str2mask(const char *str, unsigned long *pmask); + +/* ASN1 Print flags */ + +/* Indicate missing OPTIONAL fields */ +#define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 +/* Mark start and end of SEQUENCE */ +#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 +/* Mark start and end of SEQUENCE/SET OF */ +#define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 +/* Show the ASN1 type of primitives */ +#define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 +/* Don't show ASN1 type of ANY */ +#define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 +/* Don't show ASN1 type of MSTRINGs */ +#define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 +/* Don't show field names in SEQUENCE */ +#define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 +/* Show structure names of each SEQUENCE field */ +#define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 +/* Don't show structure name even at top level */ +#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 + +int ASN1_item_print(BIO *out, const ASN1_VALUE *ifld, int indent, + const ASN1_ITEM *it, const ASN1_PCTX *pctx); +ASN1_PCTX *ASN1_PCTX_new(void); +void ASN1_PCTX_free(ASN1_PCTX *p); +unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); + +ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb)(ASN1_SCTX *ctx)); +void ASN1_SCTX_free(ASN1_SCTX *p); +const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p); +const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p); +unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); +void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); +void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); + +const BIO_METHOD *BIO_f_asn1(void); + +/* cannot constify val because of CMS_stream() */ +BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); + +int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, + const ASN1_ITEM *it); +int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, + const char *hdr, const ASN1_ITEM *it); +/* cannot constify val because of CMS_dataFinal() */ +int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, + int ctype_nid, int econt_nid, + STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); +int SMIME_write_ASN1_ex(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, + int ctype_nid, int econt_nid, + STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it, + OSSL_LIB_CTX *libctx, const char *propq); +ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); +ASN1_VALUE *SMIME_read_ASN1_ex(BIO *bio, int flags, BIO **bcont, + const ASN1_ITEM *it, ASN1_VALUE **x, + OSSL_LIB_CTX *libctx, const char *propq); +int SMIME_crlf_copy(BIO *in, BIO *out, int flags); +int SMIME_text(BIO *in, BIO *out); + +const ASN1_ITEM *ASN1_ITEM_lookup(const char *name); +const ASN1_ITEM *ASN1_ITEM_get(size_t i); + +/* Legacy compatibility */ +#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) +#define DECLARE_ASN1_FUNCTIONS_const(type) DECLARE_ASN1_FUNCTIONS(type) +#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, name) +#define I2D_OF_const(type) I2D_OF(type) +#define ASN1_dup_of_const(type, i2d, d2i, x) ASN1_dup_of(type, i2d, d2i, x) +#define ASN1_i2d_fp_of_const(type, i2d, out, x) ASN1_i2d_fp_of(type, i2d, out, x) +#define ASN1_i2d_bio_of_const(type, i2d, out, x) ASN1_i2d_bio_of(type, i2d, out, x) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/asn1err.h b/VCMP-LUA/modules/postgresql/include/openssl/asn1err.h new file mode 100644 index 0000000..9175614 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/asn1err.h @@ -0,0 +1,140 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_ASN1ERR_H +#define OPENSSL_ASN1ERR_H +#pragma once + +#include +#include +#include + +/* + * ASN1 reason codes. + */ +#define ASN1_R_ADDING_OBJECT 171 +#define ASN1_R_ASN1_PARSE_ERROR 203 +#define ASN1_R_ASN1_SIG_PARSE_ERROR 204 +#define ASN1_R_AUX_ERROR 100 +#define ASN1_R_BAD_OBJECT_HEADER 102 +#define ASN1_R_BAD_TEMPLATE 230 +#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214 +#define ASN1_R_BN_LIB 105 +#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 +#define ASN1_R_BUFFER_TOO_SMALL 107 +#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 +#define ASN1_R_CONTEXT_NOT_INITIALISED 217 +#define ASN1_R_DATA_IS_WRONG 109 +#define ASN1_R_DECODE_ERROR 110 +#define ASN1_R_DEPTH_EXCEEDED 174 +#define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198 +#define ASN1_R_ENCODE_ERROR 112 +#define ASN1_R_ERROR_GETTING_TIME 173 +#define ASN1_R_ERROR_LOADING_SECTION 172 +#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 +#define ASN1_R_EXPECTING_AN_INTEGER 115 +#define ASN1_R_EXPECTING_AN_OBJECT 116 +#define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 +#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 +#define ASN1_R_FIELD_MISSING 121 +#define ASN1_R_FIRST_NUM_TOO_LARGE 122 +#define ASN1_R_GENERALIZEDTIME_IS_TOO_SHORT 232 +#define ASN1_R_HEADER_TOO_LONG 123 +#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 +#define ASN1_R_ILLEGAL_BOOLEAN 176 +#define ASN1_R_ILLEGAL_CHARACTERS 124 +#define ASN1_R_ILLEGAL_FORMAT 177 +#define ASN1_R_ILLEGAL_HEX 178 +#define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 +#define ASN1_R_ILLEGAL_INTEGER 180 +#define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226 +#define ASN1_R_ILLEGAL_NESTED_TAGGING 181 +#define ASN1_R_ILLEGAL_NULL 125 +#define ASN1_R_ILLEGAL_NULL_VALUE 182 +#define ASN1_R_ILLEGAL_OBJECT 183 +#define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 +#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 +#define ASN1_R_ILLEGAL_PADDING 221 +#define ASN1_R_ILLEGAL_TAGGED_ANY 127 +#define ASN1_R_ILLEGAL_TIME_VALUE 184 +#define ASN1_R_ILLEGAL_ZERO_CONTENT 222 +#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 +#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 +#define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220 +#define ASN1_R_INVALID_BMPSTRING_LENGTH 129 +#define ASN1_R_INVALID_DIGIT 130 +#define ASN1_R_INVALID_MIME_TYPE 205 +#define ASN1_R_INVALID_MODIFIER 186 +#define ASN1_R_INVALID_NUMBER 187 +#define ASN1_R_INVALID_OBJECT_ENCODING 216 +#define ASN1_R_INVALID_SCRYPT_PARAMETERS 227 +#define ASN1_R_INVALID_SEPARATOR 131 +#define ASN1_R_INVALID_STRING_TABLE_VALUE 218 +#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 +#define ASN1_R_INVALID_UTF8STRING 134 +#define ASN1_R_INVALID_VALUE 219 +#define ASN1_R_LENGTH_TOO_LONG 231 +#define ASN1_R_LIST_ERROR 188 +#define ASN1_R_MIME_NO_CONTENT_TYPE 206 +#define ASN1_R_MIME_PARSE_ERROR 207 +#define ASN1_R_MIME_SIG_PARSE_ERROR 208 +#define ASN1_R_MISSING_EOC 137 +#define ASN1_R_MISSING_SECOND_NUMBER 138 +#define ASN1_R_MISSING_VALUE 189 +#define ASN1_R_MSTRING_NOT_UNIVERSAL 139 +#define ASN1_R_MSTRING_WRONG_TAG 140 +#define ASN1_R_NESTED_ASN1_STRING 197 +#define ASN1_R_NESTED_TOO_DEEP 201 +#define ASN1_R_NON_HEX_CHARACTERS 141 +#define ASN1_R_NOT_ASCII_FORMAT 190 +#define ASN1_R_NOT_ENOUGH_DATA 142 +#define ASN1_R_NO_CONTENT_TYPE 209 +#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 +#define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 +#define ASN1_R_NO_MULTIPART_BOUNDARY 211 +#define ASN1_R_NO_SIG_CONTENT_TYPE 212 +#define ASN1_R_NULL_IS_WRONG_LENGTH 144 +#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 +#define ASN1_R_ODD_NUMBER_OF_CHARS 145 +#define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 +#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 +#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 +#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 +#define ASN1_R_SHORT_LINE 150 +#define ASN1_R_SIG_INVALID_MIME_TYPE 213 +#define ASN1_R_STREAMING_NOT_SUPPORTED 202 +#define ASN1_R_STRING_TOO_LONG 151 +#define ASN1_R_STRING_TOO_SHORT 152 +#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 +#define ASN1_R_TIME_NOT_ASCII_FORMAT 193 +#define ASN1_R_TOO_LARGE 223 +#define ASN1_R_TOO_LONG 155 +#define ASN1_R_TOO_SMALL 224 +#define ASN1_R_TYPE_NOT_CONSTRUCTED 156 +#define ASN1_R_TYPE_NOT_PRIMITIVE 195 +#define ASN1_R_UNEXPECTED_EOC 159 +#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215 +#define ASN1_R_UNKNOWN_DIGEST 229 +#define ASN1_R_UNKNOWN_FORMAT 160 +#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 +#define ASN1_R_UNKNOWN_OBJECT_TYPE 162 +#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 +#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199 +#define ASN1_R_UNKNOWN_TAG 194 +#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 +#define ASN1_R_UNSUPPORTED_CIPHER 228 +#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 +#define ASN1_R_UNSUPPORTED_TYPE 196 +#define ASN1_R_UTCTIME_IS_TOO_SHORT 233 +#define ASN1_R_WRONG_INTEGER_TYPE 225 +#define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200 +#define ASN1_R_WRONG_TAG 168 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/asn1t.h b/VCMP-LUA/modules/postgresql/include/openssl/asn1t.h new file mode 100644 index 0000000..556c99b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/asn1t.h @@ -0,0 +1,935 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\asn1t.h.in + * + * Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_ASN1T_H +#define OPENSSL_ASN1T_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_ASN1T_H +#endif + +#include +#include +#include + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +#undef OPENSSL_EXTERN +#define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +/* ASN1 template defines, structures and functions */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * These are the possible values for the itype field of the + * ASN1_ITEM structure and determine how it is interpreted. + * + * For PRIMITIVE types the underlying type + * determines the behaviour if items is NULL. + * + * Otherwise templates must contain a single + * template and the type is treated in the + * same way as the type specified in the template. + * + * For SEQUENCE types the templates field points + * to the members, the size field is the + * structure size. + * + * For CHOICE types the templates field points + * to each possible member (typically a union) + * and the 'size' field is the offset of the + * selector. + * + * The 'funcs' field is used for application-specific + * data and functions. + * + * The EXTERN type uses a new style d2i/i2d. + * The new style should be used where possible + * because it avoids things like the d2i IMPLICIT + * hack. + * + * MSTRING is a multiple string type, it is used + * for a CHOICE of character strings where the + * actual strings all occupy an ASN1_STRING + * structure. In this case the 'utype' field + * has a special meaning, it is used as a mask + * of acceptable types using the B_ASN1 constants. + * + * NDEF_SEQUENCE is the same as SEQUENCE except + * that it will use indefinite length constructed + * encoding if requested. + * + */ + +#define ASN1_ITYPE_PRIMITIVE 0x0 +#define ASN1_ITYPE_SEQUENCE 0x1 +#define ASN1_ITYPE_CHOICE 0x2 +/* unused value 0x3 */ +#define ASN1_ITYPE_EXTERN 0x4 +#define ASN1_ITYPE_MSTRING 0x5 +#define ASN1_ITYPE_NDEF_SEQUENCE 0x6 + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)())) + +/* Macros for start and end of ASN1_ITEM definition */ + +#define ASN1_ITEM_start(itname) \ + const ASN1_ITEM *itname##_it(void) \ + { \ + static const ASN1_ITEM local_it = { + +#define static_ASN1_ITEM_start(itname) \ + static ASN1_ITEM_start(itname) + +#define ASN1_ITEM_end(itname) \ + } \ + ; \ + return &local_it; \ + } + +/* Macros to aid ASN1 template writing */ + +#define ASN1_ITEM_TEMPLATE(tname) \ + static const ASN1_TEMPLATE tname##_item_tt + +#define ASN1_ITEM_TEMPLATE_END(tname) \ + ; \ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE, \ + -1, \ + &tname##_item_tt, \ + 0, \ + NULL, \ + 0, \ + #tname ASN1_ITEM_end(tname) +#define static_ASN1_ITEM_TEMPLATE_END(tname) \ + ; \ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE, \ + -1, \ + &tname##_item_tt, \ + 0, \ + NULL, \ + 0, \ + #tname ASN1_ITEM_end(tname) + +/* This is a ASN1 type which just embeds a template */ + +/*- + * This pair helps declare a SEQUENCE. We can do: + * + * ASN1_SEQUENCE(stname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END(stname) + * + * This will produce an ASN1_ITEM called stname_it + * for a structure called stname. + * + * If you want the same structure but a different + * name then use: + * + * ASN1_SEQUENCE(itname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END_name(stname, itname) + * + * This will create an item called itname_it using + * a structure called stname. + */ + +#define ASN1_SEQUENCE(tname) \ + static const ASN1_TEMPLATE tname##_seq_tt[] + +#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) + +#define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) + +#define ASN1_SEQUENCE_END_name(stname, tname) \ + ; \ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE, \ + V_ASN1_SEQUENCE, \ + tname##_seq_tt, \ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), \ + NULL, \ + sizeof(stname), \ + #tname ASN1_ITEM_end(tname) + +#define static_ASN1_SEQUENCE_END_name(stname, tname) \ + ; \ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE, \ + V_ASN1_SEQUENCE, \ + tname##_seq_tt, \ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), \ + NULL, \ + sizeof(stname), \ + #stname ASN1_ITEM_end(tname) + +#define ASN1_NDEF_SEQUENCE(tname) \ + ASN1_SEQUENCE(tname) + +#define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ + ASN1_SEQUENCE_cb(tname, cb) + +#define ASN1_SEQUENCE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = { NULL, 0, 0, 0, cb, 0, NULL }; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_const_cb(tname, const_cb) \ + static const ASN1_AUX tname##_aux = { NULL, ASN1_AFLG_CONST_CB, 0, 0, NULL, 0, const_cb }; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_cb_const_cb(tname, cb, const_cb) \ + static const ASN1_AUX tname##_aux = { NULL, ASN1_AFLG_CONST_CB, 0, 0, cb, 0, const_cb }; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_ref(tname, cb) \ + static const ASN1_AUX tname##_aux = { NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0, NULL }; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_enc(tname, enc, cb) \ + static const ASN1_AUX tname##_aux = { NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc), NULL }; \ + ASN1_SEQUENCE(tname) + +#define ASN1_NDEF_SEQUENCE_END(tname) \ + ; \ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE, \ + V_ASN1_SEQUENCE, \ + tname##_seq_tt, \ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), \ + NULL, \ + sizeof(tname), \ + #tname ASN1_ITEM_end(tname) +#define static_ASN1_NDEF_SEQUENCE_END(tname) \ + ; \ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE, \ + V_ASN1_SEQUENCE, \ + tname##_seq_tt, \ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), \ + NULL, \ + sizeof(tname), \ + #tname ASN1_ITEM_end(tname) + +#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) +#define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_ref(stname, tname) \ + ; \ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE, \ + V_ASN1_SEQUENCE, \ + tname##_seq_tt, \ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), \ + &tname##_aux, \ + sizeof(stname), \ + #tname ASN1_ITEM_end(tname) +#define static_ASN1_SEQUENCE_END_ref(stname, tname) \ + ; \ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE, \ + V_ASN1_SEQUENCE, \ + tname##_seq_tt, \ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), \ + &tname##_aux, \ + sizeof(stname), \ + #stname ASN1_ITEM_end(tname) + +#define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ + ; \ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE, \ + V_ASN1_SEQUENCE, \ + tname##_seq_tt, \ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), \ + &tname##_aux, \ + sizeof(stname), \ + #stname ASN1_ITEM_end(tname) + +/*- + * This pair helps declare a CHOICE type. We can do: + * + * ASN1_CHOICE(chname) = { + * ... CHOICE options ... + * ASN1_CHOICE_END(chname) + * + * This will produce an ASN1_ITEM called chname_it + * for a structure called chname. The structure + * definition must look like this: + * typedef struct { + * int type; + * union { + * ASN1_SOMETHING *opt1; + * ASN1_SOMEOTHER *opt2; + * } value; + * } chname; + * + * the name of the selector must be 'type'. + * to use an alternative selector name use the + * ASN1_CHOICE_END_selector() version. + */ + +#define ASN1_CHOICE(tname) \ + static const ASN1_TEMPLATE tname##_ch_tt[] + +#define ASN1_CHOICE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = { NULL, 0, 0, 0, cb, 0, NULL }; \ + ASN1_CHOICE(tname) + +#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) + +#define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) + +#define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) + +#define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) + +#define ASN1_CHOICE_END_selector(stname, tname, selname) \ + ; \ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE, \ + offsetof(stname, selname), \ + tname##_ch_tt, \ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE), \ + NULL, \ + sizeof(stname), \ + #stname ASN1_ITEM_end(tname) + +#define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ + ; \ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE, \ + offsetof(stname, selname), \ + tname##_ch_tt, \ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE), \ + NULL, \ + sizeof(stname), \ + #stname ASN1_ITEM_end(tname) + +#define ASN1_CHOICE_END_cb(stname, tname, selname) \ + ; \ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE, \ + offsetof(stname, selname), \ + tname##_ch_tt, \ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE), \ + &tname##_aux, \ + sizeof(stname), \ + #stname ASN1_ITEM_end(tname) + +/* This helps with the template wrapper form of ASN1_ITEM */ + +#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ + (flags), (tag), 0, \ + #name, ASN1_ITEM_ref(type) \ +} + +/* These help with SEQUENCE or CHOICE components */ + +/* used to declare other types */ + +#define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ + (flags), (tag), offsetof(stname, field), \ + #field, ASN1_ITEM_ref(type) \ +} + +/* implicit and explicit helper macros */ + +#define ASN1_IMP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type) + +#define ASN1_EXP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type) + +/* Any defined by macros: the field used is in the table itself */ + +#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } +#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } + +/* Plain simple type */ +#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0, 0, stname, field, type) +/* Embedded simple type */ +#define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED, 0, stname, field, type) + +/* OPTIONAL simple type */ +#define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) +#define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL | ASN1_TFLG_EMBED, 0, stname, field, type) + +/* IMPLICIT tagged simple type */ +#define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) +#define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) + +/* IMPLICIT tagged OPTIONAL simple type */ +#define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) +#define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL | ASN1_TFLG_EMBED) + +/* Same as above but EXPLICIT */ + +#define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) +#define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) +#define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) +#define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL | ASN1_TFLG_EMBED) + +/* SEQUENCE OF type */ +#define ASN1_SEQUENCE_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) + +/* OPTIONAL SEQUENCE OF */ +#define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Same as above but for SET OF */ + +#define ASN1_SET_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) + +#define ASN1_SET_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ + +#define ASN1_IMP_SET_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_EXP_SET_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL) + +#define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_OPTIONAL) + +/* EXPLICIT using indefinite length constructed form */ +#define ASN1_NDEF_EXP(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) + +/* EXPLICIT OPTIONAL using indefinite length constructed form */ +#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL | ASN1_TFLG_NDEF) + +/* Macros for the ASN1_ADB structure */ + +#define ASN1_ADB(name) \ + static const ASN1_ADB_TABLE name##_adbtbl[] + +#define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ + ; \ + static const ASN1_ITEM *name##_adb(void) \ + { \ + static const ASN1_ADB internal_adb = { \ + flags, \ + offsetof(name, field), \ + adb_cb, \ + name##_adbtbl, \ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE), \ + def, \ + none \ + }; \ + return (const ASN1_ITEM *)&internal_adb; \ + } \ + void dummy_function(void) + +#define ADB_ENTRY(val, template) { val, template } + +#define ASN1_ADB_TEMPLATE(name) \ + static const ASN1_TEMPLATE name##_tt + +/* + * This is the ASN1 template structure that defines a wrapper round the + * actual type. It determines the actual position of the field in the value + * structure, various flags such as OPTIONAL and the field name. + */ + +struct ASN1_TEMPLATE_st { + unsigned long flags; /* Various flags */ + long tag; /* tag, not used if no tagging */ + unsigned long offset; /* Offset of this field in structure */ + const char *field_name; /* Field name */ + ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ +}; + +/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ + +#define ASN1_TEMPLATE_item(t) (t->item_ptr) +#define ASN1_TEMPLATE_adb(t) (t->item_ptr) + +typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; +typedef struct ASN1_ADB_st ASN1_ADB; + +struct ASN1_ADB_st { + unsigned long flags; /* Various flags */ + unsigned long offset; /* Offset of selector field */ + int (*adb_cb)(long *psel); /* Application callback */ + const ASN1_ADB_TABLE *tbl; /* Table of possible types */ + long tblcount; /* Number of entries in tbl */ + const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ + const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ +}; + +struct ASN1_ADB_TABLE_st { + long value; /* NID for an object or value for an int */ + const ASN1_TEMPLATE tt; /* item for this value */ +}; + +/* template flags */ + +/* Field is optional */ +#define ASN1_TFLG_OPTIONAL (0x1) + +/* Field is a SET OF */ +#define ASN1_TFLG_SET_OF (0x1 << 1) + +/* Field is a SEQUENCE OF */ +#define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) + +/* + * Special case: this refers to a SET OF that will be sorted into DER order + * when encoded *and* the corresponding STACK will be modified to match the + * new order. + */ +#define ASN1_TFLG_SET_ORDER (0x3 << 1) + +/* Mask for SET OF or SEQUENCE OF */ +#define ASN1_TFLG_SK_MASK (0x3 << 1) + +/* + * These flags mean the tag should be taken from the tag field. If EXPLICIT + * then the underlying type is used for the inner tag. + */ + +/* IMPLICIT tagging */ +#define ASN1_TFLG_IMPTAG (0x1 << 3) + +/* EXPLICIT tagging, inner tag from underlying type */ +#define ASN1_TFLG_EXPTAG (0x2 << 3) + +#define ASN1_TFLG_TAG_MASK (0x3 << 3) + +/* context specific IMPLICIT */ +#define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG | ASN1_TFLG_CONTEXT) + +/* context specific EXPLICIT */ +#define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG | ASN1_TFLG_CONTEXT) + +/* + * If tagging is in force these determine the type of tag to use. Otherwise + * the tag is determined by the underlying type. These values reflect the + * actual octet format. + */ + +/* Universal tag */ +#define ASN1_TFLG_UNIVERSAL (0x0 << 6) +/* Application tag */ +#define ASN1_TFLG_APPLICATION (0x1 << 6) +/* Context specific tag */ +#define ASN1_TFLG_CONTEXT (0x2 << 6) +/* Private tag */ +#define ASN1_TFLG_PRIVATE (0x3 << 6) + +#define ASN1_TFLG_TAG_CLASS (0x3 << 6) + +/* + * These are for ANY DEFINED BY type. In this case the 'item' field points to + * an ASN1_ADB structure which contains a table of values to decode the + * relevant type + */ + +#define ASN1_TFLG_ADB_MASK (0x3 << 8) + +#define ASN1_TFLG_ADB_OID (0x1 << 8) + +#define ASN1_TFLG_ADB_INT (0x1 << 9) + +/* + * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes + * indefinite length constructed encoding to be used if required. + */ + +#define ASN1_TFLG_NDEF (0x1 << 11) + +/* Field is embedded and not a pointer */ +#define ASN1_TFLG_EMBED (0x1 << 12) + +/* This is the actual ASN1 item itself */ + +struct ASN1_ITEM_st { + char itype; /* The item type, primitive, SEQUENCE, CHOICE + * or extern */ + long utype; /* underlying type */ + const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains + * the contents */ + long tcount; /* Number of templates if SEQUENCE or CHOICE */ + const void *funcs; /* further data and type-specific functions */ + /* funcs can be ASN1_PRIMITIVE_FUNCS*, ASN1_EXTERN_FUNCS*, or ASN1_AUX* */ + long size; /* Structure size (usually) */ + const char *sname; /* Structure name */ +}; + +/* + * Cache for ASN1 tag and length, so we don't keep re-reading it for things + * like CHOICE + */ + +struct ASN1_TLC_st { + char valid; /* Values below are valid */ + int ret; /* return value */ + long plen; /* length */ + int ptag; /* class value */ + int pclass; /* class value */ + int hdrlen; /* header length */ +}; + +/* Typedefs for ASN1 function pointers */ +typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, + const ASN1_ITEM *it, int tag, int aclass, char opt, + ASN1_TLC *ctx); + +typedef int ASN1_ex_d2i_ex(ASN1_VALUE **pval, const unsigned char **in, long len, + const ASN1_ITEM *it, int tag, int aclass, char opt, + ASN1_TLC *ctx, OSSL_LIB_CTX *libctx, + const char *propq); +typedef int ASN1_ex_i2d(const ASN1_VALUE **pval, unsigned char **out, + const ASN1_ITEM *it, int tag, int aclass); +typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); +typedef int ASN1_ex_new_ex_func(ASN1_VALUE **pval, const ASN1_ITEM *it, + OSSL_LIB_CTX *libctx, const char *propq); +typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); + +typedef int ASN1_ex_print_func(BIO *out, const ASN1_VALUE **pval, + int indent, const char *fname, + const ASN1_PCTX *pctx); + +typedef int ASN1_primitive_i2c(const ASN1_VALUE **pval, unsigned char *cont, + int *putype, const ASN1_ITEM *it); +typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, + int len, int utype, char *free_cont, + const ASN1_ITEM *it); +typedef int ASN1_primitive_print(BIO *out, const ASN1_VALUE **pval, + const ASN1_ITEM *it, int indent, + const ASN1_PCTX *pctx); + +typedef struct ASN1_EXTERN_FUNCS_st { + void *app_data; + ASN1_ex_new_func *asn1_ex_new; + ASN1_ex_free_func *asn1_ex_free; + ASN1_ex_free_func *asn1_ex_clear; + ASN1_ex_d2i *asn1_ex_d2i; + ASN1_ex_i2d *asn1_ex_i2d; + ASN1_ex_print_func *asn1_ex_print; + ASN1_ex_new_ex_func *asn1_ex_new_ex; + ASN1_ex_d2i_ex *asn1_ex_d2i_ex; +} ASN1_EXTERN_FUNCS; + +typedef struct ASN1_PRIMITIVE_FUNCS_st { + void *app_data; + unsigned long flags; + ASN1_ex_new_func *prim_new; + ASN1_ex_free_func *prim_free; + ASN1_ex_free_func *prim_clear; + ASN1_primitive_c2i *prim_c2i; + ASN1_primitive_i2c *prim_i2c; + ASN1_primitive_print *prim_print; +} ASN1_PRIMITIVE_FUNCS; + +/* + * This is the ASN1_AUX structure: it handles various miscellaneous + * requirements. For example the use of reference counts and an informational + * callback. The "informational callback" is called at various points during + * the ASN1 encoding and decoding. It can be used to provide minor + * customisation of the structures used. This is most useful where the + * supplied routines *almost* do the right thing but need some extra help at + * a few points. If the callback returns zero then it is assumed a fatal + * error has occurred and the main operation should be abandoned. If major + * changes in the default behaviour are required then an external type is + * more appropriate. + * For the operations ASN1_OP_I2D_PRE, ASN1_OP_I2D_POST, ASN1_OP_PRINT_PRE, and + * ASN1_OP_PRINT_POST, meanwhile a variant of the callback with const parameter + * 'in' is provided to make clear statically that its input is not modified. If + * and only if this variant is in use the flag ASN1_AFLG_CONST_CB must be set. + */ + +typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, + void *exarg); +typedef int ASN1_aux_const_cb(int operation, const ASN1_VALUE **in, + const ASN1_ITEM *it, void *exarg); + +typedef struct ASN1_AUX_st { + void *app_data; + int flags; + int ref_offset; /* Offset of reference value */ + int ref_lock; /* Offset of lock value */ + ASN1_aux_cb *asn1_cb; + int enc_offset; /* Offset of ASN1_ENCODING structure */ + ASN1_aux_const_cb *asn1_const_cb; /* for ASN1_OP_I2D_ and ASN1_OP_PRINT_ */ +} ASN1_AUX; + +/* For print related callbacks exarg points to this structure */ +typedef struct ASN1_PRINT_ARG_st { + BIO *out; + int indent; + const ASN1_PCTX *pctx; +} ASN1_PRINT_ARG; + +/* For streaming related callbacks exarg points to this structure */ +typedef struct ASN1_STREAM_ARG_st { + /* BIO to stream through */ + BIO *out; + /* BIO with filters appended */ + BIO *ndef_bio; + /* Streaming I/O boundary */ + unsigned char **boundary; +} ASN1_STREAM_ARG; + +/* Flags in ASN1_AUX */ + +/* Use a reference count */ +#define ASN1_AFLG_REFCOUNT 1 +/* Save the encoding of structure (useful for signatures) */ +#define ASN1_AFLG_ENCODING 2 +/* The Sequence length is invalid */ +#define ASN1_AFLG_BROKEN 4 +/* Use the new asn1_const_cb */ +#define ASN1_AFLG_CONST_CB 8 + +/* operation values for asn1_cb */ + +#define ASN1_OP_NEW_PRE 0 +#define ASN1_OP_NEW_POST 1 +#define ASN1_OP_FREE_PRE 2 +#define ASN1_OP_FREE_POST 3 +#define ASN1_OP_D2I_PRE 4 +#define ASN1_OP_D2I_POST 5 +#define ASN1_OP_I2D_PRE 6 +#define ASN1_OP_I2D_POST 7 +#define ASN1_OP_PRINT_PRE 8 +#define ASN1_OP_PRINT_POST 9 +#define ASN1_OP_STREAM_PRE 10 +#define ASN1_OP_STREAM_POST 11 +#define ASN1_OP_DETACHED_PRE 12 +#define ASN1_OP_DETACHED_POST 13 +#define ASN1_OP_DUP_PRE 14 +#define ASN1_OP_DUP_POST 15 +#define ASN1_OP_GET0_LIBCTX 16 +#define ASN1_OP_GET0_PROPQ 17 + +/* Macro to implement a primitive type */ +#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) +#define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_PRIMITIVE, \ + V_##vname, NULL, 0, NULL, ex, #itname ASN1_ITEM_end(itname) + +/* Macro to implement a multi string type */ +#define IMPLEMENT_ASN1_MSTRING(itname, mask) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_MSTRING, \ + mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname ASN1_ITEM_end(itname) + +#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_EXTERN, \ + tag, \ + NULL, \ + 0, \ + &fptrs, \ + 0, \ + #sname ASN1_ITEM_end(sname) + +/* Macro to implement standard functions in terms of ASN1_ITEM structures */ + +#define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) + +#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ + IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) + +#define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ + pre stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + pre void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ + stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname)); \ + } \ + int i2d_##fname(const stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ + int i2d_##stname##_NDEF(const stname *a, unsigned char **out) \ + { \ + return ASN1_item_ndef_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname)); \ + } + +#define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \ + static stname *d2i_##stname(stname **a, \ + const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \ + ASN1_ITEM_rptr(stname)); \ + } \ + static int i2d_##stname(const stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((const ASN1_VALUE *)a, out, \ + ASN1_ITEM_rptr(stname)); \ + } + +#define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ + stname *stname##_dup(const stname *x) \ + { \ + return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ + } + +#define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ + IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ + int fname##_print_ctx(BIO *out, const stname *x, int indent, \ + const ASN1_PCTX *pctx) \ + { \ + return ASN1_item_print(out, (const ASN1_VALUE *)x, indent, \ + ASN1_ITEM_rptr(itname), pctx); \ + } + +/* external definitions for primitive types */ + +DECLARE_ASN1_ITEM(ASN1_BOOLEAN) +DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_SEQUENCE) +DECLARE_ASN1_ITEM(CBIGNUM) +DECLARE_ASN1_ITEM(BIGNUM) +DECLARE_ASN1_ITEM(INT32) +DECLARE_ASN1_ITEM(ZINT32) +DECLARE_ASN1_ITEM(UINT32) +DECLARE_ASN1_ITEM(ZUINT32) +DECLARE_ASN1_ITEM(INT64) +DECLARE_ASN1_ITEM(ZINT64) +DECLARE_ASN1_ITEM(UINT64) +DECLARE_ASN1_ITEM(ZUINT64) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* + * LONG and ZLONG are strongly discouraged for use as stored data, as the + * underlying C type (long) differs in size depending on the architecture. + * They are designed with 32-bit longs in mind. + */ +DECLARE_ASN1_ITEM(LONG) +DECLARE_ASN1_ITEM(ZLONG) +#endif + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ASN1_VALUE, ASN1_VALUE, ASN1_VALUE) +#define sk_ASN1_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_VALUE_sk_type(sk)) +#define sk_ASN1_VALUE_value(sk, idx) ((ASN1_VALUE *)OPENSSL_sk_value(ossl_check_const_ASN1_VALUE_sk_type(sk), (idx))) +#define sk_ASN1_VALUE_new(cmp) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new(ossl_check_ASN1_VALUE_compfunc_type(cmp))) +#define sk_ASN1_VALUE_new_null() ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_null()) +#define sk_ASN1_VALUE_new_reserve(cmp, n) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_VALUE_compfunc_type(cmp), (n))) +#define sk_ASN1_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_VALUE_sk_type(sk), (n)) +#define sk_ASN1_VALUE_free(sk) OPENSSL_sk_free(ossl_check_ASN1_VALUE_sk_type(sk)) +#define sk_ASN1_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_VALUE_sk_type(sk)) +#define sk_ASN1_VALUE_delete(sk, i) ((ASN1_VALUE *)OPENSSL_sk_delete(ossl_check_ASN1_VALUE_sk_type(sk), (i))) +#define sk_ASN1_VALUE_delete_ptr(sk, ptr) ((ASN1_VALUE *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))) +#define sk_ASN1_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr)) +#define sk_ASN1_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr)) +#define sk_ASN1_VALUE_pop(sk) ((ASN1_VALUE *)OPENSSL_sk_pop(ossl_check_ASN1_VALUE_sk_type(sk))) +#define sk_ASN1_VALUE_shift(sk) ((ASN1_VALUE *)OPENSSL_sk_shift(ossl_check_ASN1_VALUE_sk_type(sk))) +#define sk_ASN1_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_freefunc_type(freefunc)) +#define sk_ASN1_VALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr), (idx)) +#define sk_ASN1_VALUE_set(sk, idx, ptr) ((ASN1_VALUE *)OPENSSL_sk_set(ossl_check_ASN1_VALUE_sk_type(sk), (idx), ossl_check_ASN1_VALUE_type(ptr))) +#define sk_ASN1_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr)) +#define sk_ASN1_VALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr)) +#define sk_ASN1_VALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr), pnum) +#define sk_ASN1_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_VALUE_sk_type(sk)) +#define sk_ASN1_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_VALUE_sk_type(sk)) +#define sk_ASN1_VALUE_dup(sk) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_dup(ossl_check_const_ASN1_VALUE_sk_type(sk))) +#define sk_ASN1_VALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_copyfunc_type(copyfunc), ossl_check_ASN1_VALUE_freefunc_type(freefunc))) +#define sk_ASN1_VALUE_set_cmp_func(sk, cmp) ((sk_ASN1_VALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_compfunc_type(cmp))) + +/* clang-format on */ + +/* Functions used internally by the ASN1 code */ + +int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); +void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); + +int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, + const ASN1_ITEM *it, int tag, int aclass, char opt, + ASN1_TLC *ctx); + +int ASN1_item_ex_i2d(const ASN1_VALUE **pval, unsigned char **out, + const ASN1_ITEM *it, int tag, int aclass); + +/* Legacy compatibility */ +#define IMPLEMENT_ASN1_FUNCTIONS_const(name) IMPLEMENT_ASN1_FUNCTIONS(name) +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/async.h b/VCMP-LUA/modules/postgresql/include/openssl/async.h new file mode 100644 index 0000000..9044385 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/async.h @@ -0,0 +1,102 @@ +/* + * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include + +#ifndef OPENSSL_ASYNC_H +#define OPENSSL_ASYNC_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_ASYNC_H +#endif + +#if defined(_WIN32) +#if defined(BASETYPES) || defined(_WINDEF_H) +/* application has to include to use this */ +#define OSSL_ASYNC_FD HANDLE +#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE +#endif +#else +#define OSSL_ASYNC_FD int +#define OSSL_BAD_ASYNC_FD -1 +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct async_job_st ASYNC_JOB; +typedef struct async_wait_ctx_st ASYNC_WAIT_CTX; +typedef int (*ASYNC_callback_fn)(void *arg); + +#define ASYNC_ERR 0 +#define ASYNC_NO_JOBS 1 +#define ASYNC_PAUSE 2 +#define ASYNC_FINISH 3 + +#define ASYNC_STATUS_UNSUPPORTED 0 +#define ASYNC_STATUS_ERR 1 +#define ASYNC_STATUS_OK 2 +#define ASYNC_STATUS_EAGAIN 3 + +int ASYNC_init_thread(size_t max_size, size_t init_size); +void ASYNC_cleanup_thread(void); + +#ifdef OSSL_ASYNC_FD +ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void); +void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx); +int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, + OSSL_ASYNC_FD fd, + void *custom_data, + void (*cleanup)(ASYNC_WAIT_CTX *, const void *, + OSSL_ASYNC_FD, void *)); +int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key, + OSSL_ASYNC_FD *fd, void **custom_data); +int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd, + size_t *numfds); +int ASYNC_WAIT_CTX_get_callback(ASYNC_WAIT_CTX *ctx, + ASYNC_callback_fn *callback, + void **callback_arg); +int ASYNC_WAIT_CTX_set_callback(ASYNC_WAIT_CTX *ctx, + ASYNC_callback_fn callback, + void *callback_arg); +int ASYNC_WAIT_CTX_set_status(ASYNC_WAIT_CTX *ctx, int status); +int ASYNC_WAIT_CTX_get_status(ASYNC_WAIT_CTX *ctx); +int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd, + size_t *numaddfds, OSSL_ASYNC_FD *delfd, + size_t *numdelfds); +int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key); +#endif + +int ASYNC_is_capable(void); + +typedef void *(*ASYNC_stack_alloc_fn)(size_t *num); +typedef void (*ASYNC_stack_free_fn)(void *addr); + +int ASYNC_set_mem_functions(ASYNC_stack_alloc_fn alloc_fn, + ASYNC_stack_free_fn free_fn); +void ASYNC_get_mem_functions(ASYNC_stack_alloc_fn *alloc_fn, + ASYNC_stack_free_fn *free_fn); + +int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret, + int (*func)(void *), void *args, size_t size); +int ASYNC_pause_job(void); + +ASYNC_JOB *ASYNC_get_current_job(void); +ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job); +void ASYNC_block_pause(void); +void ASYNC_unblock_pause(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/asyncerr.h b/VCMP-LUA/modules/postgresql/include/openssl/asyncerr.h new file mode 100644 index 0000000..41bd4a0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/asyncerr.h @@ -0,0 +1,27 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_ASYNCERR_H +#define OPENSSL_ASYNCERR_H +#pragma once + +#include +#include +#include + +/* + * ASYNC reason codes. + */ +#define ASYNC_R_FAILED_TO_SET_POOL 101 +#define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102 +#define ASYNC_R_INIT_FAILED 105 +#define ASYNC_R_INVALID_POOL_SIZE 103 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/bio.h b/VCMP-LUA/modules/postgresql/include/openssl/bio.h new file mode 100644 index 0000000..46dce51 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/bio.h @@ -0,0 +1,1028 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\bio.h.in + * + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_BIO_H +#define OPENSSL_BIO_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_BIO_H +#endif + +#include + +#ifndef OPENSSL_NO_STDIO +#include +#endif +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* There are the classes of BIOs */ +#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ +#define BIO_TYPE_FILTER 0x0200 +#define BIO_TYPE_SOURCE_SINK 0x0400 + +/* These are the 'types' of BIOs */ +#define BIO_TYPE_NONE 0 +#define BIO_TYPE_MEM (1 | BIO_TYPE_SOURCE_SINK) +#define BIO_TYPE_FILE (2 | BIO_TYPE_SOURCE_SINK) + +#define BIO_TYPE_FD (4 | BIO_TYPE_SOURCE_SINK | BIO_TYPE_DESCRIPTOR) +#define BIO_TYPE_SOCKET (5 | BIO_TYPE_SOURCE_SINK | BIO_TYPE_DESCRIPTOR) +#define BIO_TYPE_NULL (6 | BIO_TYPE_SOURCE_SINK) +#define BIO_TYPE_SSL (7 | BIO_TYPE_FILTER) +#define BIO_TYPE_MD (8 | BIO_TYPE_FILTER) +#define BIO_TYPE_BUFFER (9 | BIO_TYPE_FILTER) +#define BIO_TYPE_CIPHER (10 | BIO_TYPE_FILTER) +#define BIO_TYPE_BASE64 (11 | BIO_TYPE_FILTER) +#define BIO_TYPE_CONNECT (12 | BIO_TYPE_SOURCE_SINK | BIO_TYPE_DESCRIPTOR) +#define BIO_TYPE_ACCEPT (13 | BIO_TYPE_SOURCE_SINK | BIO_TYPE_DESCRIPTOR) + +#define BIO_TYPE_NBIO_TEST (16 | BIO_TYPE_FILTER) /* server proxy BIO */ +#define BIO_TYPE_NULL_FILTER (17 | BIO_TYPE_FILTER) +#define BIO_TYPE_BIO (19 | BIO_TYPE_SOURCE_SINK) /* half a BIO pair */ +#define BIO_TYPE_LINEBUFFER (20 | BIO_TYPE_FILTER) +#define BIO_TYPE_DGRAM (21 | BIO_TYPE_SOURCE_SINK | BIO_TYPE_DESCRIPTOR) +#define BIO_TYPE_ASN1 (22 | BIO_TYPE_FILTER) +#define BIO_TYPE_COMP (23 | BIO_TYPE_FILTER) +#ifndef OPENSSL_NO_SCTP +#define BIO_TYPE_DGRAM_SCTP (24 | BIO_TYPE_SOURCE_SINK | BIO_TYPE_DESCRIPTOR) +#endif +#define BIO_TYPE_CORE_TO_PROV (25 | BIO_TYPE_SOURCE_SINK) +#define BIO_TYPE_DGRAM_PAIR (26 | BIO_TYPE_SOURCE_SINK) +#define BIO_TYPE_DGRAM_MEM (27 | BIO_TYPE_SOURCE_SINK) + +/* Custom type starting index returned by BIO_get_new_index() */ +#define BIO_TYPE_START 128 +/* Custom type maximum index that can be returned by BIO_get_new_index() */ +#define BIO_TYPE_MASK 0xFF + +/* + * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. + * BIO_set_fp(in,stdin,BIO_NOCLOSE); + */ +#define BIO_NOCLOSE 0x00 +#define BIO_CLOSE 0x01 + +/* + * These are used in the following macros and are passed to BIO_ctrl() + */ +#define BIO_CTRL_RESET 1 /* opt - rewind/zero etc */ +#define BIO_CTRL_EOF 2 /* opt - are we at the eof */ +#define BIO_CTRL_INFO 3 /* opt - extra tit-bits */ +#define BIO_CTRL_SET 4 /* man - set the 'IO' type */ +#define BIO_CTRL_GET 5 /* man - get the 'IO' type */ +#define BIO_CTRL_PUSH 6 /* opt - internal, used to signify change */ +#define BIO_CTRL_POP 7 /* opt - internal, used to signify change */ +#define BIO_CTRL_GET_CLOSE 8 /* man - set the 'close' on free */ +#define BIO_CTRL_SET_CLOSE 9 /* man - set the 'close' on free */ +#define BIO_CTRL_PENDING 10 /* opt - is their more data buffered */ +#define BIO_CTRL_FLUSH 11 /* opt - 'flush' buffered output */ +#define BIO_CTRL_DUP 12 /* man - extra stuff for 'duped' BIO */ +#define BIO_CTRL_WPENDING 13 /* opt - number of bytes still to write */ +#define BIO_CTRL_SET_CALLBACK 14 /* opt - set callback function */ +#define BIO_CTRL_GET_CALLBACK 15 /* opt - set callback function */ + +#define BIO_CTRL_PEEK 29 /* BIO_f_buffer special */ +#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ + +/* dgram BIO stuff */ +#define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ +#define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally connected \ + * socket to be passed in */ +#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ +#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ +#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ +#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ + +#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ +#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation timed out */ + +/* #ifdef IP_MTU_DISCOVER */ +#define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ +/* #endif */ + +#define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU */ +#define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 +#define BIO_CTRL_DGRAM_GET_MTU 41 /* get cached value for MTU */ +#define BIO_CTRL_DGRAM_SET_MTU 42 /* set cached value for MTU. \ + * want to use this if asking \ + * the kernel fails */ + +#define BIO_CTRL_DGRAM_MTU_EXCEEDED 43 /* check whether the MTU was \ + * exceed in the previous write \ + * operation */ + +#define BIO_CTRL_DGRAM_GET_PEER 46 +#define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */ + +#define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45 /* Next DTLS handshake timeout \ + * to adjust socket timeouts */ +#define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 + +#define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 + +/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ +#define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 +#ifndef OPENSSL_NO_SCTP +/* SCTP stuff */ +#define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 +#define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 +#define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 +#define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 +#define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 +#define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 +#define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 +#define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 +#define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 +#define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 +#endif + +#define BIO_CTRL_DGRAM_SET_PEEK_MODE 71 + +/* + * internal BIO: + * # define BIO_CTRL_SET_KTLS_SEND 72 + * # define BIO_CTRL_SET_KTLS_SEND_CTRL_MSG 74 + * # define BIO_CTRL_CLEAR_KTLS_CTRL_MSG 75 + */ + +#define BIO_CTRL_GET_KTLS_SEND 73 +#define BIO_CTRL_GET_KTLS_RECV 76 + +#define BIO_CTRL_DGRAM_SCTP_WAIT_FOR_DRY 77 +#define BIO_CTRL_DGRAM_SCTP_MSG_WAITING 78 + +/* BIO_f_prefix controls */ +#define BIO_CTRL_SET_PREFIX 79 +#define BIO_CTRL_SET_INDENT 80 +#define BIO_CTRL_GET_INDENT 81 + +#define BIO_CTRL_DGRAM_GET_LOCAL_ADDR_CAP 82 +#define BIO_CTRL_DGRAM_GET_LOCAL_ADDR_ENABLE 83 +#define BIO_CTRL_DGRAM_SET_LOCAL_ADDR_ENABLE 84 +#define BIO_CTRL_DGRAM_GET_EFFECTIVE_CAPS 85 +#define BIO_CTRL_DGRAM_GET_CAPS 86 +#define BIO_CTRL_DGRAM_SET_CAPS 87 +#define BIO_CTRL_DGRAM_GET_NO_TRUNC 88 +#define BIO_CTRL_DGRAM_SET_NO_TRUNC 89 + +/* + * internal BIO: + * # define BIO_CTRL_SET_KTLS_TX_ZEROCOPY_SENDFILE 90 + */ + +#define BIO_CTRL_GET_RPOLL_DESCRIPTOR 91 +#define BIO_CTRL_GET_WPOLL_DESCRIPTOR 92 +#define BIO_CTRL_DGRAM_DETECT_PEER_ADDR 93 +#define BIO_CTRL_DGRAM_SET0_LOCAL_ADDR 94 + +#define BIO_DGRAM_CAP_NONE 0U +#define BIO_DGRAM_CAP_HANDLES_SRC_ADDR (1U << 0) +#define BIO_DGRAM_CAP_HANDLES_DST_ADDR (1U << 1) +#define BIO_DGRAM_CAP_PROVIDES_SRC_ADDR (1U << 2) +#define BIO_DGRAM_CAP_PROVIDES_DST_ADDR (1U << 3) + +#ifndef OPENSSL_NO_KTLS +#define BIO_get_ktls_send(b) \ + (BIO_ctrl(b, BIO_CTRL_GET_KTLS_SEND, 0, NULL) > 0) +#define BIO_get_ktls_recv(b) \ + (BIO_ctrl(b, BIO_CTRL_GET_KTLS_RECV, 0, NULL) > 0) +#else +#define BIO_get_ktls_send(b) (0) +#define BIO_get_ktls_recv(b) (0) +#endif + +/* modifiers */ +#define BIO_FP_READ 0x02 +#define BIO_FP_WRITE 0x04 +#define BIO_FP_APPEND 0x08 +#define BIO_FP_TEXT 0x10 + +#define BIO_FLAGS_READ 0x01 +#define BIO_FLAGS_WRITE 0x02 +#define BIO_FLAGS_IO_SPECIAL 0x04 +#define BIO_FLAGS_RWS (BIO_FLAGS_READ | BIO_FLAGS_WRITE | BIO_FLAGS_IO_SPECIAL) +#define BIO_FLAGS_SHOULD_RETRY 0x08 +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* This #define was replaced by an internal constant and should not be used. */ +#define BIO_FLAGS_UPLINK 0 +#endif + +#define BIO_FLAGS_BASE64_NO_NL 0x100 + +/* + * This is used with memory BIOs: + * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; + * BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. + */ +#define BIO_FLAGS_MEM_RDONLY 0x200 +#define BIO_FLAGS_NONCLEAR_RST 0x400 +#define BIO_FLAGS_IN_EOF 0x800 + +/* the BIO FLAGS values 0x1000 to 0x8000 are reserved for internal KTLS flags */ + +typedef union bio_addr_st BIO_ADDR; +typedef struct bio_addrinfo_st BIO_ADDRINFO; + +int BIO_get_new_index(void); +void BIO_set_flags(BIO *b, int flags); +int BIO_test_flags(const BIO *b, int flags); +void BIO_clear_flags(BIO *b, int flags); + +#define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) +#define BIO_set_retry_special(b) \ + BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL | BIO_FLAGS_SHOULD_RETRY)) +#define BIO_set_retry_read(b) \ + BIO_set_flags(b, (BIO_FLAGS_READ | BIO_FLAGS_SHOULD_RETRY)) +#define BIO_set_retry_write(b) \ + BIO_set_flags(b, (BIO_FLAGS_WRITE | BIO_FLAGS_SHOULD_RETRY)) + +/* These are normally used internally in BIOs */ +#define BIO_clear_retry_flags(b) \ + BIO_clear_flags(b, (BIO_FLAGS_RWS | BIO_FLAGS_SHOULD_RETRY)) +#define BIO_get_retry_flags(b) \ + BIO_test_flags(b, (BIO_FLAGS_RWS | BIO_FLAGS_SHOULD_RETRY)) + +/* These should be used by the application to tell why we should retry */ +#define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) +#define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) +#define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) +#define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) +#define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) + +/* + * The next three are used in conjunction with the BIO_should_io_special() + * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int + * *reason); will walk the BIO stack and return the 'reason' for the special + * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return + * the code. + */ +/* + * Returned from the SSL bio when the certificate retrieval code had an error + */ +#define BIO_RR_SSL_X509_LOOKUP 0x01 +/* Returned from the connect BIO when a connect would have blocked */ +#define BIO_RR_CONNECT 0x02 +/* Returned from the accept BIO when an accept would have blocked */ +#define BIO_RR_ACCEPT 0x03 + +/* These are passed by the BIO callback */ +#define BIO_CB_FREE 0x01 +#define BIO_CB_READ 0x02 +#define BIO_CB_WRITE 0x03 +#define BIO_CB_PUTS 0x04 +#define BIO_CB_GETS 0x05 +#define BIO_CB_CTRL 0x06 +#define BIO_CB_RECVMMSG 0x07 +#define BIO_CB_SENDMMSG 0x08 + +/* + * The callback is called before and after the underling operation, The + * BIO_CB_RETURN flag indicates if it is after the call + */ +#define BIO_CB_RETURN 0x80 +#define BIO_CB_return(a) ((a) | BIO_CB_RETURN) +#define BIO_cb_pre(a) (!((a) & BIO_CB_RETURN)) +#define BIO_cb_post(a) ((a) & BIO_CB_RETURN) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, + long argl, long ret); +OSSL_DEPRECATEDIN_3_0 BIO_callback_fn BIO_get_callback(const BIO *b); +OSSL_DEPRECATEDIN_3_0 void BIO_set_callback(BIO *b, BIO_callback_fn callback); +OSSL_DEPRECATEDIN_3_0 long BIO_debug_callback(BIO *bio, int cmd, + const char *argp, int argi, + long argl, long ret); +#endif + +typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, + size_t len, int argi, + long argl, int ret, size_t *processed); +BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); +void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); +long BIO_debug_callback_ex(BIO *bio, int oper, const char *argp, size_t len, + int argi, long argl, int ret, size_t *processed); + +char *BIO_get_callback_arg(const BIO *b); +void BIO_set_callback_arg(BIO *b, char *arg); + +typedef struct bio_method_st BIO_METHOD; + +const char *BIO_method_name(const BIO *b); +int BIO_method_type(const BIO *b); + +typedef int BIO_info_cb(BIO *, int, int); +typedef BIO_info_cb bio_info_cb; /* backward compatibility */ + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(BIO, BIO, BIO) +#define sk_BIO_num(sk) OPENSSL_sk_num(ossl_check_const_BIO_sk_type(sk)) +#define sk_BIO_value(sk, idx) ((BIO *)OPENSSL_sk_value(ossl_check_const_BIO_sk_type(sk), (idx))) +#define sk_BIO_new(cmp) ((STACK_OF(BIO) *)OPENSSL_sk_new(ossl_check_BIO_compfunc_type(cmp))) +#define sk_BIO_new_null() ((STACK_OF(BIO) *)OPENSSL_sk_new_null()) +#define sk_BIO_new_reserve(cmp, n) ((STACK_OF(BIO) *)OPENSSL_sk_new_reserve(ossl_check_BIO_compfunc_type(cmp), (n))) +#define sk_BIO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_BIO_sk_type(sk), (n)) +#define sk_BIO_free(sk) OPENSSL_sk_free(ossl_check_BIO_sk_type(sk)) +#define sk_BIO_zero(sk) OPENSSL_sk_zero(ossl_check_BIO_sk_type(sk)) +#define sk_BIO_delete(sk, i) ((BIO *)OPENSSL_sk_delete(ossl_check_BIO_sk_type(sk), (i))) +#define sk_BIO_delete_ptr(sk, ptr) ((BIO *)OPENSSL_sk_delete_ptr(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr))) +#define sk_BIO_push(sk, ptr) OPENSSL_sk_push(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr)) +#define sk_BIO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr)) +#define sk_BIO_pop(sk) ((BIO *)OPENSSL_sk_pop(ossl_check_BIO_sk_type(sk))) +#define sk_BIO_shift(sk) ((BIO *)OPENSSL_sk_shift(ossl_check_BIO_sk_type(sk))) +#define sk_BIO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_BIO_sk_type(sk), ossl_check_BIO_freefunc_type(freefunc)) +#define sk_BIO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr), (idx)) +#define sk_BIO_set(sk, idx, ptr) ((BIO *)OPENSSL_sk_set(ossl_check_BIO_sk_type(sk), (idx), ossl_check_BIO_type(ptr))) +#define sk_BIO_find(sk, ptr) OPENSSL_sk_find(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr)) +#define sk_BIO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr)) +#define sk_BIO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr), pnum) +#define sk_BIO_sort(sk) OPENSSL_sk_sort(ossl_check_BIO_sk_type(sk)) +#define sk_BIO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_BIO_sk_type(sk)) +#define sk_BIO_dup(sk) ((STACK_OF(BIO) *)OPENSSL_sk_dup(ossl_check_const_BIO_sk_type(sk))) +#define sk_BIO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(BIO) *)OPENSSL_sk_deep_copy(ossl_check_const_BIO_sk_type(sk), ossl_check_BIO_copyfunc_type(copyfunc), ossl_check_BIO_freefunc_type(freefunc))) +#define sk_BIO_set_cmp_func(sk, cmp) ((sk_BIO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_BIO_sk_type(sk), ossl_check_BIO_compfunc_type(cmp))) + +/* clang-format on */ + +/* Prefix and suffix callback in ASN1 BIO */ +typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, + void *parg); + +typedef void (*BIO_dgram_sctp_notification_handler_fn)(BIO *b, + void *context, + void *buf); +#ifndef OPENSSL_NO_SCTP +/* SCTP parameter structs */ +struct bio_dgram_sctp_sndinfo { + uint16_t snd_sid; + uint16_t snd_flags; + uint32_t snd_ppid; + uint32_t snd_context; +}; + +struct bio_dgram_sctp_rcvinfo { + uint16_t rcv_sid; + uint16_t rcv_ssn; + uint16_t rcv_flags; + uint32_t rcv_ppid; + uint32_t rcv_tsn; + uint32_t rcv_cumtsn; + uint32_t rcv_context; +}; + +struct bio_dgram_sctp_prinfo { + uint16_t pr_policy; + uint32_t pr_value; +}; +#endif + +/* BIO_sendmmsg/BIO_recvmmsg-related definitions */ +typedef struct bio_msg_st { + void *data; + size_t data_len; + BIO_ADDR *peer, *local; + uint64_t flags; +} BIO_MSG; + +typedef struct bio_mmsg_cb_args_st { + BIO_MSG *msg; + size_t stride, num_msg; + uint64_t flags; + size_t *msgs_processed; +} BIO_MMSG_CB_ARGS; + +#define BIO_POLL_DESCRIPTOR_TYPE_NONE 0 +#define BIO_POLL_DESCRIPTOR_TYPE_SOCK_FD 1 +#define BIO_POLL_DESCRIPTOR_TYPE_SSL 2 +#define BIO_POLL_DESCRIPTOR_CUSTOM_START 8192 + +typedef struct bio_poll_descriptor_st { + uint32_t type; + union { + int fd; + void *custom; + uintptr_t custom_ui; + SSL *ssl; + } value; +} BIO_POLL_DESCRIPTOR; + +/* + * #define BIO_CONN_get_param_hostname BIO_ctrl + */ + +#define BIO_C_SET_CONNECT 100 +#define BIO_C_DO_STATE_MACHINE 101 +#define BIO_C_SET_NBIO 102 +/* # define BIO_C_SET_PROXY_PARAM 103 */ +#define BIO_C_SET_FD 104 +#define BIO_C_GET_FD 105 +#define BIO_C_SET_FILE_PTR 106 +#define BIO_C_GET_FILE_PTR 107 +#define BIO_C_SET_FILENAME 108 +#define BIO_C_SET_SSL 109 +#define BIO_C_GET_SSL 110 +#define BIO_C_SET_MD 111 +#define BIO_C_GET_MD 112 +#define BIO_C_GET_CIPHER_STATUS 113 +#define BIO_C_SET_BUF_MEM 114 +#define BIO_C_GET_BUF_MEM_PTR 115 +#define BIO_C_GET_BUFF_NUM_LINES 116 +#define BIO_C_SET_BUFF_SIZE 117 +#define BIO_C_SET_ACCEPT 118 +#define BIO_C_SSL_MODE 119 +#define BIO_C_GET_MD_CTX 120 +/* # define BIO_C_GET_PROXY_PARAM 121 */ +#define BIO_C_SET_BUFF_READ_DATA 122 /* data to read first */ +#define BIO_C_GET_CONNECT 123 +#define BIO_C_GET_ACCEPT 124 +#define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 +#define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 +#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 +#define BIO_C_FILE_SEEK 128 +#define BIO_C_GET_CIPHER_CTX 129 +#define BIO_C_SET_BUF_MEM_EOF_RETURN 130 /* return end of input \ + * value */ +#define BIO_C_SET_BIND_MODE 131 +#define BIO_C_GET_BIND_MODE 132 +#define BIO_C_FILE_TELL 133 +#define BIO_C_GET_SOCKS 134 +#define BIO_C_SET_SOCKS 135 + +#define BIO_C_SET_WRITE_BUF_SIZE 136 /* for BIO_s_bio */ +#define BIO_C_GET_WRITE_BUF_SIZE 137 +#define BIO_C_MAKE_BIO_PAIR 138 +#define BIO_C_DESTROY_BIO_PAIR 139 +#define BIO_C_GET_WRITE_GUARANTEE 140 +#define BIO_C_GET_READ_REQUEST 141 +#define BIO_C_SHUTDOWN_WR 142 +#define BIO_C_NREAD0 143 +#define BIO_C_NREAD 144 +#define BIO_C_NWRITE0 145 +#define BIO_C_NWRITE 146 +#define BIO_C_RESET_READ_REQUEST 147 +#define BIO_C_SET_MD_CTX 148 + +#define BIO_C_SET_PREFIX 149 +#define BIO_C_GET_PREFIX 150 +#define BIO_C_SET_SUFFIX 151 +#define BIO_C_GET_SUFFIX 152 + +#define BIO_C_SET_EX_ARG 153 +#define BIO_C_GET_EX_ARG 154 + +#define BIO_C_SET_CONNECT_MODE 155 + +#define BIO_C_SET_TFO 156 /* like BIO_C_SET_NBIO */ + +#define BIO_C_SET_SOCK_TYPE 157 +#define BIO_C_GET_SOCK_TYPE 158 +#define BIO_C_GET_DGRAM_BIO 159 + +#define BIO_set_app_data(s, arg) BIO_set_ex_data(s, 0, arg) +#define BIO_get_app_data(s) BIO_get_ex_data(s, 0) + +#define BIO_set_nbio(b, n) BIO_ctrl(b, BIO_C_SET_NBIO, (n), NULL) +#define BIO_set_tfo(b, n) BIO_ctrl(b, BIO_C_SET_TFO, (n), NULL) + +#ifndef OPENSSL_NO_SOCK +/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ +/* Note: the underlying operating system may not support some of them */ +#define BIO_FAMILY_IPV4 4 +#define BIO_FAMILY_IPV6 6 +#define BIO_FAMILY_IPANY 256 + +/* BIO_s_connect() */ +#define BIO_set_conn_hostname(b, name) BIO_ctrl(b, BIO_C_SET_CONNECT, 0, \ + (char *)(name)) +#define BIO_set_conn_port(b, port) BIO_ctrl(b, BIO_C_SET_CONNECT, 1, \ + (char *)(port)) +#define BIO_set_conn_address(b, addr) BIO_ctrl(b, BIO_C_SET_CONNECT, 2, \ + (char *)(addr)) +#define BIO_set_conn_ip_family(b, f) BIO_int_ctrl(b, BIO_C_SET_CONNECT, 3, f) +#define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b, BIO_C_GET_CONNECT, 0)) +#define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b, BIO_C_GET_CONNECT, 1)) +#define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b, BIO_C_GET_CONNECT, 2)) +#define BIO_get_conn_ip_family(b) BIO_ctrl(b, BIO_C_GET_CONNECT, 3, NULL) +#define BIO_get_conn_mode(b) BIO_ctrl(b, BIO_C_GET_CONNECT, 4, NULL) +#define BIO_set_conn_mode(b, n) BIO_ctrl(b, BIO_C_SET_CONNECT_MODE, (n), NULL) +#define BIO_set_sock_type(b, t) BIO_ctrl(b, BIO_C_SET_SOCK_TYPE, (t), NULL) +#define BIO_get_sock_type(b) BIO_ctrl(b, BIO_C_GET_SOCK_TYPE, 0, NULL) +#define BIO_get0_dgram_bio(b, p) BIO_ctrl(b, BIO_C_GET_DGRAM_BIO, 0, (void *)(BIO **)(p)) + +/* BIO_s_accept() */ +#define BIO_set_accept_name(b, name) BIO_ctrl(b, BIO_C_SET_ACCEPT, 0, \ + (char *)(name)) +#define BIO_set_accept_port(b, port) BIO_ctrl(b, BIO_C_SET_ACCEPT, 1, \ + (char *)(port)) +#define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b, BIO_C_GET_ACCEPT, 0)) +#define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b, BIO_C_GET_ACCEPT, 1)) +#define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b, BIO_C_GET_ACCEPT, 2)) +#define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b, BIO_C_GET_ACCEPT, 3)) +/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ +#define BIO_set_nbio_accept(b, n) BIO_ctrl(b, BIO_C_SET_ACCEPT, 2, (n) ? (void *)"a" : NULL) +#define BIO_set_accept_bios(b, bio) BIO_ctrl(b, BIO_C_SET_ACCEPT, 3, \ + (char *)(bio)) +#define BIO_set_accept_ip_family(b, f) BIO_int_ctrl(b, BIO_C_SET_ACCEPT, 4, f) +#define BIO_get_accept_ip_family(b) BIO_ctrl(b, BIO_C_GET_ACCEPT, 4, NULL) +#define BIO_set_tfo_accept(b, n) BIO_ctrl(b, BIO_C_SET_ACCEPT, 5, (n) ? (void *)"a" : NULL) + +/* Aliases kept for backward compatibility */ +#define BIO_BIND_NORMAL 0 +#define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR +#define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR +#define BIO_set_bind_mode(b, mode) BIO_ctrl(b, BIO_C_SET_BIND_MODE, mode, NULL) +#define BIO_get_bind_mode(b) BIO_ctrl(b, BIO_C_GET_BIND_MODE, 0, NULL) +#endif /* OPENSSL_NO_SOCK */ + +#define BIO_do_connect(b) BIO_do_handshake(b) +#define BIO_do_accept(b) BIO_do_handshake(b) + +#define BIO_do_handshake(b) BIO_ctrl(b, BIO_C_DO_STATE_MACHINE, 0, NULL) + +/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ +#define BIO_set_fd(b, fd, c) BIO_int_ctrl(b, BIO_C_SET_FD, c, fd) +#define BIO_get_fd(b, c) BIO_ctrl(b, BIO_C_GET_FD, 0, (char *)(c)) + +/* BIO_s_file() */ +#define BIO_set_fp(b, fp, c) BIO_ctrl(b, BIO_C_SET_FILE_PTR, c, (char *)(fp)) +#define BIO_get_fp(b, fpp) BIO_ctrl(b, BIO_C_GET_FILE_PTR, 0, (char *)(fpp)) + +/* BIO_s_fd() and BIO_s_file() */ +#define BIO_seek(b, ofs) (int)BIO_ctrl(b, BIO_C_FILE_SEEK, ofs, NULL) +#define BIO_tell(b) (int)BIO_ctrl(b, BIO_C_FILE_TELL, 0, NULL) + +/* + * name is cast to lose const, but might be better to route through a + * function so we can do it safely + */ +#ifdef CONST_STRICT +/* + * If you are wondering why this isn't defined, its because CONST_STRICT is + * purely a compile-time kludge to allow const to be checked. + */ +int BIO_read_filename(BIO *b, const char *name); +#else +#define BIO_read_filename(b, name) (int)BIO_ctrl(b, BIO_C_SET_FILENAME, \ + BIO_CLOSE | BIO_FP_READ, (char *)(name)) +#endif +#define BIO_write_filename(b, name) (int)BIO_ctrl(b, BIO_C_SET_FILENAME, \ + BIO_CLOSE | BIO_FP_WRITE, name) +#define BIO_append_filename(b, name) (int)BIO_ctrl(b, BIO_C_SET_FILENAME, \ + BIO_CLOSE | BIO_FP_APPEND, name) +#define BIO_rw_filename(b, name) (int)BIO_ctrl(b, BIO_C_SET_FILENAME, \ + BIO_CLOSE | BIO_FP_READ | BIO_FP_WRITE, name) + +/* + * WARNING WARNING, this ups the reference count on the read bio of the SSL + * structure. This is because the ssl read BIO is now pointed to by the + * next_bio field in the bio. So when you free the BIO, make sure you are + * doing a BIO_free_all() to catch the underlying BIO. + */ +#define BIO_set_ssl(b, ssl, c) BIO_ctrl(b, BIO_C_SET_SSL, c, (char *)(ssl)) +#define BIO_get_ssl(b, sslp) BIO_ctrl(b, BIO_C_GET_SSL, 0, (char *)(sslp)) +#define BIO_set_ssl_mode(b, client) BIO_ctrl(b, BIO_C_SSL_MODE, client, NULL) +#define BIO_set_ssl_renegotiate_bytes(b, num) \ + BIO_ctrl(b, BIO_C_SET_SSL_RENEGOTIATE_BYTES, num, NULL) +#define BIO_get_num_renegotiates(b) \ + BIO_ctrl(b, BIO_C_GET_SSL_NUM_RENEGOTIATES, 0, NULL) +#define BIO_set_ssl_renegotiate_timeout(b, seconds) \ + BIO_ctrl(b, BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT, seconds, NULL) + +/* defined in evp.h */ +/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ + +#define BIO_get_mem_data(b, pp) BIO_ctrl(b, BIO_CTRL_INFO, 0, (char *)(pp)) +#define BIO_set_mem_buf(b, bm, c) BIO_ctrl(b, BIO_C_SET_BUF_MEM, c, (char *)(bm)) +#define BIO_get_mem_ptr(b, pp) BIO_ctrl(b, BIO_C_GET_BUF_MEM_PTR, 0, \ + (char *)(pp)) +#define BIO_set_mem_eof_return(b, v) \ + BIO_ctrl(b, BIO_C_SET_BUF_MEM_EOF_RETURN, v, NULL) + +/* For the BIO_f_buffer() type */ +#define BIO_get_buffer_num_lines(b) BIO_ctrl(b, BIO_C_GET_BUFF_NUM_LINES, 0, NULL) +#define BIO_set_buffer_size(b, size) BIO_ctrl(b, BIO_C_SET_BUFF_SIZE, size, NULL) +#define BIO_set_read_buffer_size(b, size) BIO_int_ctrl(b, BIO_C_SET_BUFF_SIZE, size, 0) +#define BIO_set_write_buffer_size(b, size) BIO_int_ctrl(b, BIO_C_SET_BUFF_SIZE, size, 1) +#define BIO_set_buffer_read_data(b, buf, num) BIO_ctrl(b, BIO_C_SET_BUFF_READ_DATA, num, buf) + +/* Don't use the next one unless you know what you are doing :-) */ +#define BIO_dup_state(b, ret) BIO_ctrl(b, BIO_CTRL_DUP, 0, (char *)(ret)) + +#define BIO_reset(b) (int)BIO_ctrl(b, BIO_CTRL_RESET, 0, NULL) +#define BIO_eof(b) (int)BIO_ctrl(b, BIO_CTRL_EOF, 0, NULL) +#define BIO_set_close(b, c) (int)BIO_ctrl(b, BIO_CTRL_SET_CLOSE, (c), NULL) +#define BIO_get_close(b) (int)BIO_ctrl(b, BIO_CTRL_GET_CLOSE, 0, NULL) +#define BIO_pending(b) (int)BIO_ctrl(b, BIO_CTRL_PENDING, 0, NULL) +#define BIO_wpending(b) (int)BIO_ctrl(b, BIO_CTRL_WPENDING, 0, NULL) +/* ...pending macros have inappropriate return type */ +size_t BIO_ctrl_pending(BIO *b); +size_t BIO_ctrl_wpending(BIO *b); +#define BIO_flush(b) (int)BIO_ctrl(b, BIO_CTRL_FLUSH, 0, NULL) +#define BIO_get_info_callback(b, cbp) (int)BIO_ctrl(b, BIO_CTRL_GET_CALLBACK, 0, \ + cbp) +#define BIO_set_info_callback(b, cb) (int)BIO_callback_ctrl(b, BIO_CTRL_SET_CALLBACK, cb) + +/* For the BIO_f_buffer() type */ +#define BIO_buffer_get_num_lines(b) BIO_ctrl(b, BIO_CTRL_GET, 0, NULL) +#define BIO_buffer_peek(b, s, l) BIO_ctrl(b, BIO_CTRL_PEEK, (l), (s)) + +/* For BIO_s_bio() */ +#define BIO_set_write_buf_size(b, size) (int)BIO_ctrl(b, BIO_C_SET_WRITE_BUF_SIZE, size, NULL) +#define BIO_get_write_buf_size(b, size) (size_t)BIO_ctrl(b, BIO_C_GET_WRITE_BUF_SIZE, size, NULL) +#define BIO_make_bio_pair(b1, b2) (int)BIO_ctrl(b1, BIO_C_MAKE_BIO_PAIR, 0, b2) +#define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b, BIO_C_DESTROY_BIO_PAIR, 0, NULL) +#define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) +/* macros with inappropriate type -- but ...pending macros use int too: */ +#define BIO_get_write_guarantee(b) (int)BIO_ctrl(b, BIO_C_GET_WRITE_GUARANTEE, 0, NULL) +#define BIO_get_read_request(b) (int)BIO_ctrl(b, BIO_C_GET_READ_REQUEST, 0, NULL) +size_t BIO_ctrl_get_write_guarantee(BIO *b); +size_t BIO_ctrl_get_read_request(BIO *b); +int BIO_ctrl_reset_read_request(BIO *b); + +/* ctrl macros for dgram */ +#define BIO_ctrl_dgram_connect(b, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_CONNECT, 0, (char *)(peer)) +#define BIO_ctrl_set_connected(b, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer)) +#define BIO_dgram_recv_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) +#define BIO_dgram_send_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) +#define BIO_dgram_get_peer(b, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer)) +#define BIO_dgram_set_peer(b, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer)) +#define BIO_dgram_detect_peer_addr(b, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_DETECT_PEER_ADDR, 0, (char *)(peer)) +#define BIO_dgram_get_mtu_overhead(b) \ + (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) +#define BIO_dgram_get_local_addr_cap(b) \ + (int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_LOCAL_ADDR_CAP, 0, NULL) +#define BIO_dgram_get_local_addr_enable(b, penable) \ + (int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_LOCAL_ADDR_ENABLE, 0, (char *)(penable)) +#define BIO_dgram_set_local_addr_enable(b, enable) \ + (int)BIO_ctrl((b), BIO_CTRL_DGRAM_SET_LOCAL_ADDR_ENABLE, (enable), NULL) +#define BIO_dgram_get_effective_caps(b) \ + (uint32_t)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_EFFECTIVE_CAPS, 0, NULL) +#define BIO_dgram_get_caps(b) \ + (uint32_t)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_CAPS, 0, NULL) +#define BIO_dgram_set_caps(b, caps) \ + (int)BIO_ctrl((b), BIO_CTRL_DGRAM_SET_CAPS, (long)(caps), NULL) +#define BIO_dgram_get_no_trunc(b) \ + (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_NO_TRUNC, 0, NULL) +#define BIO_dgram_set_no_trunc(b, enable) \ + (int)BIO_ctrl((b), BIO_CTRL_DGRAM_SET_NO_TRUNC, (enable), NULL) +#define BIO_dgram_get_mtu(b) \ + (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU, 0, NULL) +#define BIO_dgram_set_mtu(b, mtu) \ + (int)BIO_ctrl((b), BIO_CTRL_DGRAM_SET_MTU, (mtu), NULL) +#define BIO_dgram_set0_local_addr(b, addr) \ + (int)BIO_ctrl((b), BIO_CTRL_DGRAM_SET0_LOCAL_ADDR, 0, (addr)) + +/* ctrl macros for BIO_f_prefix */ +#define BIO_set_prefix(b, p) BIO_ctrl((b), BIO_CTRL_SET_PREFIX, 0, (void *)(p)) +#define BIO_set_indent(b, i) BIO_ctrl((b), BIO_CTRL_SET_INDENT, (i), NULL) +#define BIO_get_indent(b) BIO_ctrl((b), BIO_CTRL_GET_INDENT, 0, NULL) + +#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef) +int BIO_set_ex_data(BIO *bio, int idx, void *data); +void *BIO_get_ex_data(const BIO *bio, int idx); +uint64_t BIO_number_read(BIO *bio); +uint64_t BIO_number_written(BIO *bio); + +/* For BIO_f_asn1() */ +int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, + asn1_ps_func *prefix_free); +int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, + asn1_ps_func **pprefix_free); +int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, + asn1_ps_func *suffix_free); +int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, + asn1_ps_func **psuffix_free); + +const BIO_METHOD *BIO_s_file(void); +BIO *BIO_new_file(const char *filename, const char *mode); +BIO *BIO_new_from_core_bio(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio); +#ifndef OPENSSL_NO_STDIO +BIO *BIO_new_fp(FILE *stream, int close_flag); +#endif +BIO *BIO_new_ex(OSSL_LIB_CTX *libctx, const BIO_METHOD *method); +BIO *BIO_new(const BIO_METHOD *type); +int BIO_free(BIO *a); +void BIO_set_data(BIO *a, void *ptr); +void *BIO_get_data(BIO *a); +void BIO_set_init(BIO *a, int init); +int BIO_get_init(BIO *a); +void BIO_set_shutdown(BIO *a, int shut); +int BIO_get_shutdown(BIO *a); +void BIO_vfree(BIO *a); +int BIO_up_ref(BIO *a); +int BIO_read(BIO *b, void *data, int dlen); +int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); +__owur int BIO_recvmmsg(BIO *b, BIO_MSG *msg, + size_t stride, size_t num_msg, uint64_t flags, + size_t *msgs_processed); +int BIO_gets(BIO *bp, char *buf, int size); +int BIO_get_line(BIO *bio, char *buf, int size); +int BIO_write(BIO *b, const void *data, int dlen); +int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); +__owur int BIO_sendmmsg(BIO *b, BIO_MSG *msg, + size_t stride, size_t num_msg, uint64_t flags, + size_t *msgs_processed); +__owur int BIO_get_rpoll_descriptor(BIO *b, BIO_POLL_DESCRIPTOR *desc); +__owur int BIO_get_wpoll_descriptor(BIO *b, BIO_POLL_DESCRIPTOR *desc); +int BIO_puts(BIO *bp, const char *buf); +int BIO_indent(BIO *b, int indent, int max); +long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); +long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); +void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); +long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); +BIO *BIO_push(BIO *b, BIO *append); +BIO *BIO_pop(BIO *b); +void BIO_free_all(BIO *a); +BIO *BIO_find_type(BIO *b, int bio_type); +BIO *BIO_next(BIO *b); +void BIO_set_next(BIO *b, BIO *next); +BIO *BIO_get_retry_BIO(BIO *bio, int *reason); +int BIO_get_retry_reason(BIO *bio); +void BIO_set_retry_reason(BIO *bio, int reason); +BIO *BIO_dup_chain(BIO *in); + +int BIO_nread0(BIO *bio, char **buf); +int BIO_nread(BIO *bio, char **buf, int num); +int BIO_nwrite0(BIO *bio, char **buf); +int BIO_nwrite(BIO *bio, char **buf, int num); + +const BIO_METHOD *BIO_s_mem(void); +#ifndef OPENSSL_NO_DGRAM +const BIO_METHOD *BIO_s_dgram_mem(void); +#endif +const BIO_METHOD *BIO_s_secmem(void); +BIO *BIO_new_mem_buf(const void *buf, int len); +#ifndef OPENSSL_NO_SOCK +const BIO_METHOD *BIO_s_socket(void); +const BIO_METHOD *BIO_s_connect(void); +const BIO_METHOD *BIO_s_accept(void); +#endif +const BIO_METHOD *BIO_s_fd(void); +const BIO_METHOD *BIO_s_log(void); +const BIO_METHOD *BIO_s_bio(void); +const BIO_METHOD *BIO_s_null(void); +const BIO_METHOD *BIO_f_null(void); +const BIO_METHOD *BIO_f_buffer(void); +const BIO_METHOD *BIO_f_readbuffer(void); +const BIO_METHOD *BIO_f_linebuffer(void); +const BIO_METHOD *BIO_f_nbio_test(void); +const BIO_METHOD *BIO_f_prefix(void); +const BIO_METHOD *BIO_s_core(void); +#ifndef OPENSSL_NO_DGRAM +const BIO_METHOD *BIO_s_dgram_pair(void); +const BIO_METHOD *BIO_s_datagram(void); +int BIO_dgram_non_fatal_error(int error); +BIO *BIO_new_dgram(int fd, int close_flag); +#ifndef OPENSSL_NO_SCTP +const BIO_METHOD *BIO_s_datagram_sctp(void); +BIO *BIO_new_dgram_sctp(int fd, int close_flag); +int BIO_dgram_is_sctp(BIO *bio); +int BIO_dgram_sctp_notification_cb(BIO *b, + BIO_dgram_sctp_notification_handler_fn handle_notifications, + void *context); +int BIO_dgram_sctp_wait_for_dry(BIO *b); +int BIO_dgram_sctp_msg_waiting(BIO *b); +#endif +#endif + +#ifndef OPENSSL_NO_SOCK +int BIO_sock_should_retry(int i); +int BIO_sock_non_fatal_error(int error); +int BIO_err_is_non_fatal(unsigned int errcode); +int BIO_socket_wait(int fd, int for_read, time_t max_time); +#endif +int BIO_wait(BIO *bio, time_t max_time, unsigned int nap_milliseconds); +int BIO_do_connect_retry(BIO *bio, int timeout, int nap_milliseconds); + +int BIO_fd_should_retry(int i); +int BIO_fd_non_fatal_error(int error); +int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u), + void *u, const void *s, int len); +int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), + void *u, const void *s, int len, int indent); +int BIO_dump(BIO *b, const void *bytes, int len); +int BIO_dump_indent(BIO *b, const void *bytes, int len, int indent); +#ifndef OPENSSL_NO_STDIO +int BIO_dump_fp(FILE *fp, const void *s, int len); +int BIO_dump_indent_fp(FILE *fp, const void *s, int len, int indent); +#endif +int BIO_hex_string(BIO *out, int indent, int width, const void *data, + int datalen); + +#ifndef OPENSSL_NO_SOCK +BIO_ADDR *BIO_ADDR_new(void); +int BIO_ADDR_copy(BIO_ADDR *dst, const BIO_ADDR *src); +BIO_ADDR *BIO_ADDR_dup(const BIO_ADDR *ap); +int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, + const void *where, size_t wherelen, unsigned short port); +void BIO_ADDR_free(BIO_ADDR *); +void BIO_ADDR_clear(BIO_ADDR *ap); +int BIO_ADDR_family(const BIO_ADDR *ap); +int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); +unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); +char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); +char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); +char *BIO_ADDR_path_string(const BIO_ADDR *ap); + +const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); +const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); +void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); + +enum BIO_hostserv_priorities { + BIO_PARSE_PRIO_HOST, + BIO_PARSE_PRIO_SERV +}; +int BIO_parse_hostserv(const char *hostserv, char **host, char **service, + enum BIO_hostserv_priorities hostserv_prio); +enum BIO_lookup_type { + BIO_LOOKUP_CLIENT, + BIO_LOOKUP_SERVER +}; +int BIO_lookup(const char *host, const char *service, + enum BIO_lookup_type lookup_type, + int family, int socktype, BIO_ADDRINFO **res); +int BIO_lookup_ex(const char *host, const char *service, + int lookup_type, int family, int socktype, int protocol, + BIO_ADDRINFO **res); +int BIO_sock_error(int sock); +int BIO_socket_ioctl(int fd, long type, void *arg); +int BIO_socket_nbio(int fd, int mode); +int BIO_sock_init(void); +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define BIO_sock_cleanup() \ + while (0) \ + continue +#endif +int BIO_set_tcp_ndelay(int sock, int turn_on); +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 struct hostent *BIO_gethostbyname(const char *name); +OSSL_DEPRECATEDIN_1_1_0 int BIO_get_port(const char *str, unsigned short *port_ptr); +OSSL_DEPRECATEDIN_1_1_0 int BIO_get_host_ip(const char *str, unsigned char *ip); +OSSL_DEPRECATEDIN_1_1_0 int BIO_get_accept_socket(char *host_port, int mode); +OSSL_DEPRECATEDIN_1_1_0 int BIO_accept(int sock, char **ip_port); +#endif + +union BIO_sock_info_u { + BIO_ADDR *addr; +}; +enum BIO_sock_info_type { + BIO_SOCK_INFO_ADDRESS +}; +int BIO_sock_info(int sock, + enum BIO_sock_info_type type, union BIO_sock_info_u *info); + +#define BIO_SOCK_REUSEADDR 0x01 +#define BIO_SOCK_V6_ONLY 0x02 +#define BIO_SOCK_KEEPALIVE 0x04 +#define BIO_SOCK_NONBLOCK 0x08 +#define BIO_SOCK_NODELAY 0x10 +#define BIO_SOCK_TFO 0x20 + +int BIO_socket(int domain, int socktype, int protocol, int options); +int BIO_connect(int sock, const BIO_ADDR *addr, int options); +int BIO_bind(int sock, const BIO_ADDR *addr, int options); +int BIO_listen(int sock, const BIO_ADDR *addr, int options); +int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); +int BIO_closesocket(int sock); + +BIO *BIO_new_socket(int sock, int close_flag); +BIO *BIO_new_connect(const char *host_port); +BIO *BIO_new_accept(const char *host_port); +#endif /* OPENSSL_NO_SOCK*/ + +BIO *BIO_new_fd(int fd, int close_flag); + +int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, + BIO **bio2, size_t writebuf2); +#ifndef OPENSSL_NO_DGRAM +int BIO_new_bio_dgram_pair(BIO **bio1, size_t writebuf1, + BIO **bio2, size_t writebuf2); +#endif + +/* + * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. + * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default + * value. + */ + +void BIO_copy_next_retry(BIO *b); + +/* + * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); + */ + +#define ossl_bio__attr__(x) +#if defined(__GNUC__) && defined(__STDC_VERSION__) \ + && !defined(__MINGW32__) && !defined(__MINGW64__) \ + && !defined(__APPLE__) +/* + * Because we support the 'z' modifier, which made its appearance in C99, + * we can't use __attribute__ with pre C99 dialects. + */ +#if __STDC_VERSION__ >= 199901L +#undef ossl_bio__attr__ +#define ossl_bio__attr__ __attribute__ +#if __GNUC__ * 10 + __GNUC_MINOR__ >= 44 +#define ossl_bio__printf__ __gnu_printf__ +#else +#define ossl_bio__printf__ __printf__ +#endif +#endif +#endif +int BIO_printf(BIO *bio, const char *format, ...) + ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); +int BIO_vprintf(BIO *bio, const char *format, va_list args) + ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); +int BIO_snprintf(char *buf, size_t n, const char *format, ...) + ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); +int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) + ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); +#undef ossl_bio__attr__ +#undef ossl_bio__printf__ + +BIO_METHOD *BIO_meth_new(int type, const char *name); +void BIO_meth_free(BIO_METHOD *biom); +int BIO_meth_set_write(BIO_METHOD *biom, + int (*write)(BIO *, const char *, int)); +int BIO_meth_set_write_ex(BIO_METHOD *biom, + int (*bwrite)(BIO *, const char *, size_t, size_t *)); +int BIO_meth_set_sendmmsg(BIO_METHOD *biom, + int (*f)(BIO *, BIO_MSG *, size_t, size_t, + uint64_t, size_t *)); +int BIO_meth_set_read(BIO_METHOD *biom, + int (*read)(BIO *, char *, int)); +int BIO_meth_set_read_ex(BIO_METHOD *biom, + int (*bread)(BIO *, char *, size_t, size_t *)); +int BIO_meth_set_recvmmsg(BIO_METHOD *biom, + int (*f)(BIO *, BIO_MSG *, size_t, size_t, + uint64_t, size_t *)); +int BIO_meth_set_puts(BIO_METHOD *biom, + int (*puts)(BIO *, const char *)); +int BIO_meth_set_gets(BIO_METHOD *biom, + int (*ossl_gets)(BIO *, char *, int)); +int BIO_meth_set_ctrl(BIO_METHOD *biom, + long (*ctrl)(BIO *, int, long, void *)); +int BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *)); +int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *)); +int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, + long (*callback_ctrl)(BIO *, int, + BIO_info_cb *)); +#ifndef OPENSSL_NO_DEPRECATED_3_5 +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_write(const BIO_METHOD *biom))(BIO *, const char *, + int); +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_write_ex(const BIO_METHOD *biom))(BIO *, const char *, + size_t, size_t *); +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_sendmmsg(const BIO_METHOD *biom))(BIO *, BIO_MSG *, + size_t, size_t, + uint64_t, size_t *); +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_read(const BIO_METHOD *biom))(BIO *, char *, int); +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_read_ex(const BIO_METHOD *biom))(BIO *, char *, + size_t, size_t *); +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_recvmmsg(const BIO_METHOD *biom))(BIO *, BIO_MSG *, + size_t, size_t, + uint64_t, size_t *); +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_puts(const BIO_METHOD *biom))(BIO *, const char *); +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_gets(const BIO_METHOD *biom))(BIO *, char *, int); +OSSL_DEPRECATEDIN_3_5 long (*BIO_meth_get_ctrl(const BIO_METHOD *biom))(BIO *, int, + long, void *); +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_create(const BIO_METHOD *bion))(BIO *); +OSSL_DEPRECATEDIN_3_5 int (*BIO_meth_get_destroy(const BIO_METHOD *biom))(BIO *); +OSSL_DEPRECATEDIN_3_5 long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom))(BIO *, int, + BIO_info_cb *); +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/bioerr.h b/VCMP-LUA/modules/postgresql/include/openssl/bioerr.h new file mode 100644 index 0000000..b4ee5c6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/bioerr.h @@ -0,0 +1,70 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_BIOERR_H +#define OPENSSL_BIOERR_H +#pragma once + +#include +#include +#include + +/* + * BIO reason codes. + */ +#define BIO_R_ACCEPT_ERROR 100 +#define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141 +#define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129 +#define BIO_R_BAD_FOPEN_MODE 101 +#define BIO_R_BROKEN_PIPE 124 +#define BIO_R_CONNECT_ERROR 103 +#define BIO_R_CONNECT_TIMEOUT 147 +#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 +#define BIO_R_GETSOCKNAME_ERROR 132 +#define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133 +#define BIO_R_GETTING_SOCKTYPE 134 +#define BIO_R_INVALID_ARGUMENT 125 +#define BIO_R_INVALID_SOCKET 135 +#define BIO_R_IN_USE 123 +#define BIO_R_LENGTH_TOO_LONG 102 +#define BIO_R_LISTEN_V6_ONLY 136 +#define BIO_R_LOCAL_ADDR_NOT_AVAILABLE 111 +#define BIO_R_LOOKUP_RETURNED_NOTHING 142 +#define BIO_R_MALFORMED_HOST_OR_SERVICE 130 +#define BIO_R_NBIO_CONNECT_ERROR 110 +#define BIO_R_NON_FATAL 112 +#define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143 +#define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144 +#define BIO_R_NO_PORT_DEFINED 113 +#define BIO_R_NO_SUCH_FILE 128 +#define BIO_R_NULL_PARAMETER 115 /* unused */ +#define BIO_R_TFO_DISABLED 106 +#define BIO_R_TFO_NO_KERNEL_SUPPORT 108 +#define BIO_R_TRANSFER_ERROR 104 +#define BIO_R_TRANSFER_TIMEOUT 105 +#define BIO_R_UNABLE_TO_BIND_SOCKET 117 +#define BIO_R_UNABLE_TO_CREATE_SOCKET 118 +#define BIO_R_UNABLE_TO_KEEPALIVE 137 +#define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 +#define BIO_R_UNABLE_TO_NODELAY 138 +#define BIO_R_UNABLE_TO_REUSEADDR 139 +#define BIO_R_UNABLE_TO_TFO 109 +#define BIO_R_UNAVAILABLE_IP_FAMILY 145 +#define BIO_R_UNINITIALIZED 120 +#define BIO_R_UNKNOWN_INFO_TYPE 140 +#define BIO_R_UNSUPPORTED_IP_FAMILY 146 +#define BIO_R_UNSUPPORTED_METHOD 121 +#define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131 +#define BIO_R_WRITE_TO_READ_ONLY_BIO 126 +#define BIO_R_WSASTARTUP 122 +#define BIO_R_PORT_MISMATCH 150 +#define BIO_R_PEER_ADDR_NOT_AVAILABLE 151 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/blowfish.h b/VCMP-LUA/modules/postgresql/include/openssl/blowfish.h new file mode 100644 index 0000000..49c74e9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/blowfish.h @@ -0,0 +1,78 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_BLOWFISH_H +#define OPENSSL_BLOWFISH_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_BLOWFISH_H +#endif + +#include + +#ifndef OPENSSL_NO_BF +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define BF_BLOCK 8 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + +#define BF_ENCRYPT 1 +#define BF_DECRYPT 0 + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! BF_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +#define BF_LONG unsigned int + +#define BF_ROUNDS 16 + +typedef struct bf_key_st { + BF_LONG P[BF_ROUNDS + 2]; + BF_LONG S[4 * 256]; +} BF_KEY; + +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 void BF_set_key(BF_KEY *key, int len, + const unsigned char *data); +OSSL_DEPRECATEDIN_3_0 void BF_encrypt(BF_LONG *data, const BF_KEY *key); +OSSL_DEPRECATEDIN_3_0 void BF_decrypt(BF_LONG *data, const BF_KEY *key); +OSSL_DEPRECATEDIN_3_0 void BF_ecb_encrypt(const unsigned char *in, + unsigned char *out, const BF_KEY *key, + int enc); +OSSL_DEPRECATEDIN_3_0 void BF_cbc_encrypt(const unsigned char *in, + unsigned char *out, long length, + const BF_KEY *schedule, + unsigned char *ivec, int enc); +OSSL_DEPRECATEDIN_3_0 void BF_cfb64_encrypt(const unsigned char *in, + unsigned char *out, + long length, const BF_KEY *schedule, + unsigned char *ivec, int *num, + int enc); +OSSL_DEPRECATEDIN_3_0 void BF_ofb64_encrypt(const unsigned char *in, + unsigned char *out, + long length, const BF_KEY *schedule, + unsigned char *ivec, int *num); +OSSL_DEPRECATEDIN_3_0 const char *BF_options(void); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/bn.h b/VCMP-LUA/modules/postgresql/include/openssl/bn.h new file mode 100644 index 0000000..d210b8b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/bn.h @@ -0,0 +1,588 @@ +/* + * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_BN_H +#define OPENSSL_BN_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_BN_H +#endif + +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 64-bit processor with LP64 ABI + */ +#ifdef SIXTY_FOUR_BIT_LONG +#define BN_ULONG unsigned long +#define BN_BYTES 8 +#endif + +/* + * 64-bit processor other than LP64 ABI + */ +#ifdef SIXTY_FOUR_BIT +#define BN_ULONG unsigned long long +#define BN_BYTES 8 +#endif + +#ifdef THIRTY_TWO_BIT +#define BN_ULONG unsigned int +#define BN_BYTES 4 +#endif + +#define BN_BITS2 (BN_BYTES * 8) +#define BN_BITS (BN_BITS2 * 2) +#define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1)) + +#define BN_FLG_MALLOCED 0x01 +#define BN_FLG_STATIC_DATA 0x02 + +/* + * avoid leaking exponent information through timing, + * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, + * BN_div() will call BN_div_no_branch, + * BN_mod_inverse() will call bn_mod_inverse_no_branch. + */ +#define BN_FLG_CONSTTIME 0x04 +#define BN_FLG_SECURE 0x08 + +#ifndef OPENSSL_NO_DEPRECATED_0_9_8 +/* deprecated name for the flag */ +#define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME +#define BN_FLG_FREE 0x8000 /* used for debugging */ +#endif + +void BN_set_flags(BIGNUM *b, int n); +int BN_get_flags(const BIGNUM *b, int n); + +/* Values for |top| in BN_rand() */ +#define BN_RAND_TOP_ANY -1 +#define BN_RAND_TOP_ONE 0 +#define BN_RAND_TOP_TWO 1 + +/* Values for |bottom| in BN_rand() */ +#define BN_RAND_BOTTOM_ANY 0 +#define BN_RAND_BOTTOM_ODD 1 + +/* + * get a clone of a BIGNUM with changed flags, for *temporary* use only (the + * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The + * value |dest| should be a newly allocated BIGNUM obtained via BN_new() that + * has not been otherwise initialised or used. + */ +void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); + +/* Wrapper function to make using BN_GENCB easier */ +int BN_GENCB_call(BN_GENCB *cb, int a, int b); + +BN_GENCB *BN_GENCB_new(void); +void BN_GENCB_free(BN_GENCB *cb); + +/* Populate a BN_GENCB structure with an "old"-style callback */ +void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback)(int, int, void *), + void *cb_arg); + +/* Populate a BN_GENCB structure with a "new"-style callback */ +void BN_GENCB_set(BN_GENCB *gencb, int (*callback)(int, int, BN_GENCB *), + void *cb_arg); + +void *BN_GENCB_get_arg(BN_GENCB *cb); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define BN_prime_checks 0 /* default: select number of iterations based \ + * on the size of the number */ + +/* + * BN_prime_checks_for_size() returns the number of Miller-Rabin iterations + * that will be done for checking that a random number is probably prime. The + * error rate for accepting a composite number as prime depends on the size of + * the prime |b|. The error rates used are for calculating an RSA key with 2 primes, + * and so the level is what you would expect for a key of double the size of the + * prime. + * + * This table is generated using the algorithm of FIPS PUB 186-4 + * Digital Signature Standard (DSS), section F.1, page 117. + * (https://dx.doi.org/10.6028/NIST.FIPS.186-4) + * + * The following magma script was used to generate the output: + * securitybits:=125; + * k:=1024; + * for t:=1 to 65 do + * for M:=3 to Floor(2*Sqrt(k-1)-1) do + * S:=0; + * // Sum over m + * for m:=3 to M do + * s:=0; + * // Sum over j + * for j:=2 to m do + * s+:=(RealField(32)!2)^-(j+(k-1)/j); + * end for; + * S+:=2^(m-(m-1)*t)*s; + * end for; + * A:=2^(k-2-M*t); + * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S; + * pkt:=2.00743*Log(2)*k*2^-k*(A+B); + * seclevel:=Floor(-Log(2,pkt)); + * if seclevel ge securitybits then + * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M; + * break; + * end if; + * end for; + * if seclevel ge securitybits then break; end if; + * end for; + * + * It can be run online at: + * http://magma.maths.usyd.edu.au/calc + * + * And will output: + * k: 1024, security: 129 bits (t: 6, M: 23) + * + * k is the number of bits of the prime, securitybits is the level we want to + * reach. + * + * prime length | RSA key size | # MR tests | security level + * -------------+--------------|------------+--------------- + * (b) >= 6394 | >= 12788 | 3 | 256 bit + * (b) >= 3747 | >= 7494 | 3 | 192 bit + * (b) >= 1345 | >= 2690 | 4 | 128 bit + * (b) >= 1080 | >= 2160 | 5 | 128 bit + * (b) >= 852 | >= 1704 | 5 | 112 bit + * (b) >= 476 | >= 952 | 5 | 80 bit + * (b) >= 400 | >= 800 | 6 | 80 bit + * (b) >= 347 | >= 694 | 7 | 80 bit + * (b) >= 308 | >= 616 | 8 | 80 bit + * (b) >= 55 | >= 110 | 27 | 64 bit + * (b) >= 6 | >= 12 | 34 | 64 bit + */ + +#define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : (b) >= 1345 ? 4 \ + : (b) >= 476 ? 5 \ + : (b) >= 400 ? 6 \ + : (b) >= 347 ? 7 \ + : (b) >= 308 ? 8 \ + : (b) >= 55 ? 27 \ + : /* b >= 6 */ 34) +#endif + +#define BN_num_bytes(a) ((BN_num_bits(a) + 7) / 8) + +int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); +int BN_is_zero(const BIGNUM *a); +int BN_is_one(const BIGNUM *a); +int BN_is_word(const BIGNUM *a, const BN_ULONG w); +int BN_is_odd(const BIGNUM *a); + +#define BN_one(a) (BN_set_word((a), 1)) + +void BN_zero_ex(BIGNUM *a); + +#if OPENSSL_API_LEVEL > 908 +#define BN_zero(a) BN_zero_ex(a) +#else +#define BN_zero(a) (BN_set_word((a), 0)) +#endif + +const BIGNUM *BN_value_one(void); +char *BN_options(void); +BN_CTX *BN_CTX_new_ex(OSSL_LIB_CTX *ctx); +BN_CTX *BN_CTX_new(void); +BN_CTX *BN_CTX_secure_new_ex(OSSL_LIB_CTX *ctx); +BN_CTX *BN_CTX_secure_new(void); +void BN_CTX_free(BN_CTX *c); +void BN_CTX_start(BN_CTX *ctx); +BIGNUM *BN_CTX_get(BN_CTX *ctx); +void BN_CTX_end(BN_CTX *ctx); +int BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, + unsigned int strength, BN_CTX *ctx); +int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, + unsigned int strength, BN_CTX *ctx); +int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_rand_range_ex(BIGNUM *r, const BIGNUM *range, unsigned int strength, + BN_CTX *ctx); +int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_priv_rand_range_ex(BIGNUM *r, const BIGNUM *range, + unsigned int strength, BN_CTX *ctx); +int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); +OSSL_DEPRECATEDIN_3_0 +int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); +#endif +int BN_num_bits(const BIGNUM *a); +int BN_num_bits_word(BN_ULONG l); +int BN_security_bits(int L, int N); +BIGNUM *BN_new(void); +BIGNUM *BN_secure_new(void); +void BN_clear_free(BIGNUM *a); +BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); +void BN_swap(BIGNUM *a, BIGNUM *b); +BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); +BIGNUM *BN_signed_bin2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2bin(const BIGNUM *a, unsigned char *to); +int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); +int BN_signed_bn2bin(const BIGNUM *a, unsigned char *to, int tolen); +BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); +BIGNUM *BN_signed_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); +int BN_signed_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen); +BIGNUM *BN_native2bn(const unsigned char *s, int len, BIGNUM *ret); +BIGNUM *BN_signed_native2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2nativepad(const BIGNUM *a, unsigned char *to, int tolen); +int BN_signed_bn2native(const BIGNUM *a, unsigned char *to, int tolen); +BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2mpi(const BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); +/** BN_set_negative sets sign of a BIGNUM + * \param b pointer to the BIGNUM object + * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise + */ +void BN_set_negative(BIGNUM *b, int n); +/** BN_is_negative returns 1 if the BIGNUM is negative + * \param b pointer to the BIGNUM object + * \return 1 if a < 0 and 0 otherwise + */ +int BN_is_negative(const BIGNUM *b); + +int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, + BN_CTX *ctx); +#define BN_mod(rem, m, d, ctx) BN_div(NULL, (rem), (m), (d), (ctx)) +int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); +int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); +int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); +int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); +int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); + +BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); +BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); +int BN_mul_word(BIGNUM *a, BN_ULONG w); +int BN_add_word(BIGNUM *a, BN_ULONG w); +int BN_sub_word(BIGNUM *a, BN_ULONG w); +int BN_set_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_get_word(const BIGNUM *a); + +int BN_cmp(const BIGNUM *a, const BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(const BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, const BIGNUM *a); +int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *in_mont); +int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, + const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, + BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1, const BIGNUM *p1, + const BIGNUM *m1, BN_MONT_CTX *in_mont1, + BIGNUM *rr2, const BIGNUM *a2, const BIGNUM *p2, + const BIGNUM *m2, BN_MONT_CTX *in_mont2, + BN_CTX *ctx); + +int BN_mask_bits(BIGNUM *a, int n); +#ifndef OPENSSL_NO_STDIO +int BN_print_fp(FILE *fp, const BIGNUM *a); +#endif +int BN_print(BIO *bio, const BIGNUM *a); +int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, const BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *BN_dup(const BIGNUM *a); +int BN_ucmp(const BIGNUM *a, const BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +char *BN_bn2hex(const BIGNUM *a); +char *BN_bn2dec(const BIGNUM *a); +int BN_hex2bn(BIGNUM **a, const char *str); +int BN_dec2bn(BIGNUM **a, const char *str); +int BN_asc2bn(BIGNUM **a, const char *str); +int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns + * -2 for + * error */ +int BN_are_coprime(BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +BIGNUM *BN_mod_inverse(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); +BIGNUM *BN_mod_sqrt(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); + +void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); + +/* Deprecated versions */ +#ifndef OPENSSL_NO_DEPRECATED_0_9_8 +OSSL_DEPRECATEDIN_0_9_8 +BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, + const BIGNUM *add, const BIGNUM *rem, + void (*callback)(int, int, void *), + void *cb_arg); +OSSL_DEPRECATEDIN_0_9_8 +int BN_is_prime(const BIGNUM *p, int nchecks, + void (*callback)(int, int, void *), + BN_CTX *ctx, void *cb_arg); +OSSL_DEPRECATEDIN_0_9_8 +int BN_is_prime_fasttest(const BIGNUM *p, int nchecks, + void (*callback)(int, int, void *), + BN_CTX *ctx, void *cb_arg, + int do_trial_division); +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); +OSSL_DEPRECATEDIN_3_0 +int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, + int do_trial_division, BN_GENCB *cb); +#endif +/* Newer versions */ +int BN_generate_prime_ex2(BIGNUM *ret, int bits, int safe, + const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb, + BN_CTX *ctx); +int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, + const BIGNUM *rem, BN_GENCB *cb); +int BN_check_prime(const BIGNUM *p, BN_CTX *ctx, BN_GENCB *cb); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); + +OSSL_DEPRECATEDIN_3_0 +int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, + const BIGNUM *Xp, const BIGNUM *Xp1, + const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, + BN_GENCB *cb); +OSSL_DEPRECATEDIN_3_0 +int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, + BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, + BN_CTX *ctx, BN_GENCB *cb); +#endif + +BN_MONT_CTX *BN_MONT_CTX_new(void); +int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + BN_MONT_CTX *mont, BN_CTX *ctx); +int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, + BN_CTX *ctx); +int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, + BN_CTX *ctx); +void BN_MONT_CTX_free(BN_MONT_CTX *mont); +int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); +BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); +BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, + const BIGNUM *mod, BN_CTX *ctx); + +/* BN_BLINDING flags */ +#define BN_BLINDING_NO_UPDATE 0x00000001 +#define BN_BLINDING_NO_RECREATE 0x00000002 + +BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); +void BN_BLINDING_free(BN_BLINDING *b); +int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); +int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, + BN_CTX *); + +int BN_BLINDING_is_current_thread(BN_BLINDING *b); +void BN_BLINDING_set_current_thread(BN_BLINDING *b); +int BN_BLINDING_lock(BN_BLINDING *b); +int BN_BLINDING_unlock(BN_BLINDING *b); + +unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); +void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); +BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, + const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, + int (*bn_mod_exp)(BIGNUM *r, + const BIGNUM *a, + const BIGNUM *p, + const BIGNUM *m, + BN_CTX *ctx, + BN_MONT_CTX *m_ctx), + BN_MONT_CTX *m_ctx); +#ifndef OPENSSL_NO_DEPRECATED_0_9_8 +OSSL_DEPRECATEDIN_0_9_8 +void BN_set_params(int mul, int high, int low, int mont); +OSSL_DEPRECATEDIN_0_9_8 +int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */ +#endif + +BN_RECP_CTX *BN_RECP_CTX_new(void); +void BN_RECP_CTX_free(BN_RECP_CTX *recp); +int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); +int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, + BN_RECP_CTX *recp, BN_CTX *ctx); +int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, + BN_RECP_CTX *recp, BN_CTX *ctx); + +#ifndef OPENSSL_NO_EC2M + +/* + * Functions for arithmetic over binary polynomials represented by BIGNUMs. + * The BIGNUM::neg property of BIGNUMs representing binary polynomials is + * ignored. Note that input arguments are not const so that their bit arrays + * can be expanded to the appropriate size if needed. + */ + +/* + * r = a + b + */ +int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +#define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) +/* + * r=a mod p + */ +int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); +#define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) +/*- + * Some functions allow for representation of the irreducible polynomials + * as an unsigned int[], say p. The irreducible f(t) is then of the form: + * t^p[0] + t^p[1] + ... + t^p[k] + * where m = p[0] > p[1] > ... > p[k] = 0. + */ +/* r = a mod p */ +int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], + BN_CTX *ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], + BN_CTX *ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, + const int p[], BN_CTX *ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, + const int p[], BN_CTX *ctx); +int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); +int BN_GF2m_arr2poly(const int p[], BIGNUM *a); + +#endif + +/* + * faster mod functions for the 'NIST primes' 0 <= a < p^2 + */ +int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +const BIGNUM *BN_get0_nist_prime_192(void); +const BIGNUM *BN_get0_nist_prime_224(void); +const BIGNUM *BN_get0_nist_prime_256(void); +const BIGNUM *BN_get0_nist_prime_384(void); +const BIGNUM *BN_get0_nist_prime_521(void); + +int (*BN_nist_mod_func(const BIGNUM *p))(BIGNUM *r, const BIGNUM *a, + const BIGNUM *field, BN_CTX *ctx); + +int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, + const BIGNUM *priv, const unsigned char *message, + size_t message_len, BN_CTX *ctx); + +/* Primes from RFC 2409 */ +BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn); +BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn); + +/* Primes from RFC 3526 */ +BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define get_rfc2409_prime_768 BN_get_rfc2409_prime_768 +#define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024 +#define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536 +#define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048 +#define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072 +#define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096 +#define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144 +#define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192 +#endif + +int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/bnerr.h b/VCMP-LUA/modules/postgresql/include/openssl/bnerr.h new file mode 100644 index 0000000..dbbcd69 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/bnerr.h @@ -0,0 +1,45 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_BNERR_H +#define OPENSSL_BNERR_H +#pragma once + +#include +#include +#include + +/* + * BN reason codes. + */ +#define BN_R_ARG2_LT_ARG3 100 +#define BN_R_BAD_RECIPROCAL 101 +#define BN_R_BIGNUM_TOO_LONG 114 +#define BN_R_BITS_TOO_SMALL 118 +#define BN_R_CALLED_WITH_EVEN_MODULUS 102 +#define BN_R_DIV_BY_ZERO 103 +#define BN_R_ENCODING_ERROR 104 +#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 +#define BN_R_INPUT_NOT_REDUCED 110 +#define BN_R_INVALID_LENGTH 106 +#define BN_R_INVALID_RANGE 115 +#define BN_R_INVALID_SHIFT 119 +#define BN_R_NOT_A_SQUARE 111 +#define BN_R_NOT_INITIALIZED 107 +#define BN_R_NO_INVERSE 108 +#define BN_R_NO_PRIME_CANDIDATE 121 +#define BN_R_NO_SOLUTION 116 +#define BN_R_NO_SUITABLE_DIGEST 120 +#define BN_R_PRIVATE_KEY_TOO_LARGE 117 +#define BN_R_P_IS_NOT_PRIME 112 +#define BN_R_TOO_MANY_ITERATIONS 113 +#define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/buffer.h b/VCMP-LUA/modules/postgresql/include/openssl/buffer.h new file mode 100644 index 0000000..09b35e8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/buffer.h @@ -0,0 +1,60 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_BUFFER_H +#define OPENSSL_BUFFER_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_BUFFER_H +#endif + +#include +#ifndef OPENSSL_CRYPTO_H +#include +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define BUF_strdup(s) OPENSSL_strdup(s) +#define BUF_strndup(s, size) OPENSSL_strndup(s, size) +#define BUF_memdup(data, size) OPENSSL_memdup(data, size) +#define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) +#define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) +#define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) +#endif + +struct buf_mem_st { + size_t length; /* current number of bytes */ + char *data; + size_t max; /* size of buffer */ + unsigned long flags; +}; + +#define BUF_MEM_FLAG_SECURE 0x01 + +BUF_MEM *BUF_MEM_new(void); +BUF_MEM *BUF_MEM_new_ex(unsigned long flags); +void BUF_MEM_free(BUF_MEM *a); +size_t BUF_MEM_grow(BUF_MEM *str, size_t len); +size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); +void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/buffererr.h b/VCMP-LUA/modules/postgresql/include/openssl/buffererr.h new file mode 100644 index 0000000..4fa0da4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/buffererr.h @@ -0,0 +1,23 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_BUFFERERR_H +#define OPENSSL_BUFFERERR_H +#pragma once + +#include +#include +#include + +/* + * BUF reason codes. + */ + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/byteorder.h b/VCMP-LUA/modules/postgresql/include/openssl/byteorder.h new file mode 100644 index 0000000..393f34b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/byteorder.h @@ -0,0 +1,339 @@ +/* + * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_BYTEORDER_H +#define OPENSSL_BYTEORDER_H +#pragma once + +#include +#include + +/* + * "Modern" compilers do a decent job of optimising these functions to just a + * couple of instruction ([swap +] store, or load [+ swap]) when either no + * swapping is required, or a suitable swap instruction is available. + */ + +#if defined(_MSC_VER) && _MSC_VER >= 1300 +#include +#pragma intrinsic(_byteswap_ushort) +#pragma intrinsic(_byteswap_ulong) +#pragma intrinsic(_byteswap_uint64) +#define OSSL_HTOBE16(x) _byteswap_ushort(x) +#define OSSL_HTOBE32(x) _byteswap_ulong(x) +#define OSSL_HTOBE64(x) _byteswap_uint64(x) +#define OSSL_BE16TOH(x) _byteswap_ushort(x) +#define OSSL_BE32TOH(x) _byteswap_ulong(x) +#define OSSL_BE64TOH(x) _byteswap_uint64(x) +#define OSSL_HTOLE16(x) (x) +#define OSSL_HTOLE32(x) (x) +#define OSSL_HTOLE64(x) (x) +#define OSSL_LE16TOH(x) (x) +#define OSSL_LE32TOH(x) (x) +#define OSSL_LE64TOH(x) (x) + +#elif defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if (__GLIBC_PREREQ(2, 19)) && defined(_DEFAULT_SOURCE) +#include +#define OSSL_HTOBE16(x) htobe16(x) +#define OSSL_HTOBE32(x) htobe32(x) +#define OSSL_HTOBE64(x) htobe64(x) +#define OSSL_BE16TOH(x) be16toh(x) +#define OSSL_BE32TOH(x) be32toh(x) +#define OSSL_BE64TOH(x) be64toh(x) +#define OSSL_HTOLE16(x) htole16(x) +#define OSSL_HTOLE32(x) htole32(x) +#define OSSL_HTOLE64(x) htole64(x) +#define OSSL_LE16TOH(x) le16toh(x) +#define OSSL_LE32TOH(x) le32toh(x) +#define OSSL_LE64TOH(x) le64toh(x) +#endif + +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__OpenBSD__) +#include +#else +#include +#endif +#define OSSL_HTOBE16(x) htobe16(x) +#define OSSL_HTOBE32(x) htobe32(x) +#define OSSL_HTOBE64(x) htobe64(x) +#define OSSL_BE16TOH(x) be16toh(x) +#define OSSL_BE32TOH(x) be32toh(x) +#define OSSL_BE64TOH(x) be64toh(x) +#define OSSL_HTOLE16(x) htole16(x) +#define OSSL_HTOLE32(x) htole32(x) +#define OSSL_HTOLE64(x) htole64(x) +#define OSSL_LE16TOH(x) le16toh(x) +#define OSSL_LE32TOH(x) le32toh(x) +#define OSSL_LE64TOH(x) le64toh(x) + +#elif defined(__APPLE__) +#include +#define OSSL_HTOBE16(x) OSSwapHostToBigInt16(x) +#define OSSL_HTOBE32(x) OSSwapHostToBigInt32(x) +#define OSSL_HTOBE64(x) OSSwapHostToBigInt64(x) +#define OSSL_BE16TOH(x) OSSwapBigToHostInt16(x) +#define OSSL_BE32TOH(x) OSSwapBigToHostInt32(x) +#define OSSL_BE64TOH(x) OSSwapBigToHostInt64(x) +#define OSSL_HTOLE16(x) OSSwapHostToLittleInt16(x) +#define OSSL_HTOLE32(x) OSSwapHostToLittleInt32(x) +#define OSSL_HTOLE64(x) OSSwapHostToLittleInt64(x) +#define OSSL_LE16TOH(x) OSSwapLittleToHostInt16(x) +#define OSSL_LE32TOH(x) OSSwapLittleToHostInt32(x) +#define OSSL_LE64TOH(x) OSSwapLittleToHostInt64(x) + +#endif + +static ossl_inline ossl_unused unsigned char * +OPENSSL_store_u16_le(unsigned char *out, uint16_t val) +{ +#ifdef OSSL_HTOLE16 + uint16_t t = OSSL_HTOLE16(val); + + memcpy(out, (unsigned char *)&t, 2); + return out + 2; +#else + *out++ = (val & 0xff); + *out++ = (val >> 8) & 0xff; + return out; +#endif +} + +static ossl_inline ossl_unused unsigned char * +OPENSSL_store_u16_be(unsigned char *out, uint16_t val) +{ +#ifdef OSSL_HTOBE16 + uint16_t t = OSSL_HTOBE16(val); + + memcpy(out, (unsigned char *)&t, 2); + return out + 2; +#else + *out++ = (val >> 8) & 0xff; + *out++ = (val & 0xff); + return out; +#endif +} + +static ossl_inline ossl_unused unsigned char * +OPENSSL_store_u32_le(unsigned char *out, uint32_t val) +{ +#ifdef OSSL_HTOLE32 + uint32_t t = OSSL_HTOLE32(val); + + memcpy(out, (unsigned char *)&t, 4); + return out + 4; +#else + *out++ = (val & 0xff); + *out++ = (val >> 8) & 0xff; + *out++ = (val >> 16) & 0xff; + *out++ = (val >> 24) & 0xff; + return out; +#endif +} + +static ossl_inline ossl_unused unsigned char * +OPENSSL_store_u32_be(unsigned char *out, uint32_t val) +{ +#ifdef OSSL_HTOBE32 + uint32_t t = OSSL_HTOBE32(val); + + memcpy(out, (unsigned char *)&t, 4); + return out + 4; +#else + *out++ = (val >> 24) & 0xff; + *out++ = (val >> 16) & 0xff; + *out++ = (val >> 8) & 0xff; + *out++ = (val & 0xff); + return out; +#endif +} + +static ossl_inline ossl_unused unsigned char * +OPENSSL_store_u64_le(unsigned char *out, uint64_t val) +{ +#ifdef OSSL_HTOLE64 + uint64_t t = OSSL_HTOLE64(val); + + memcpy(out, (unsigned char *)&t, 8); + return out + 8; +#else + *out++ = (val & 0xff); + *out++ = (val >> 8) & 0xff; + *out++ = (val >> 16) & 0xff; + *out++ = (val >> 24) & 0xff; + *out++ = (val >> 32) & 0xff; + *out++ = (val >> 40) & 0xff; + *out++ = (val >> 48) & 0xff; + *out++ = (val >> 56) & 0xff; + return out; +#endif +} + +static ossl_inline ossl_unused unsigned char * +OPENSSL_store_u64_be(unsigned char *out, uint64_t val) +{ +#ifdef OSSL_HTOLE64 + uint64_t t = OSSL_HTOBE64(val); + + memcpy(out, (unsigned char *)&t, 8); + return out + 8; +#else + *out++ = (val >> 56) & 0xff; + *out++ = (val >> 48) & 0xff; + *out++ = (val >> 40) & 0xff; + *out++ = (val >> 32) & 0xff; + *out++ = (val >> 24) & 0xff; + *out++ = (val >> 16) & 0xff; + *out++ = (val >> 8) & 0xff; + *out++ = (val & 0xff); + return out; +#endif +} + +static ossl_inline ossl_unused const unsigned char * +OPENSSL_load_u16_le(uint16_t *val, const unsigned char *in) +{ +#ifdef OSSL_LE16TOH + uint16_t t; + + memcpy((unsigned char *)&t, in, 2); + *val = OSSL_LE16TOH(t); + return in + 2; +#else + uint16_t b0 = *in++; + uint16_t b1 = *in++; + + *val = b0 | (b1 << 8); + return in; +#endif +} + +static ossl_inline ossl_unused const unsigned char * +OPENSSL_load_u16_be(uint16_t *val, const unsigned char *in) +{ +#ifdef OSSL_LE16TOH + uint16_t t; + + memcpy((unsigned char *)&t, in, 2); + *val = OSSL_BE16TOH(t); + return in + 2; +#else + uint16_t b1 = *in++; + uint16_t b0 = *in++; + + *val = b0 | (b1 << 8); + return in; +#endif +} + +static ossl_inline ossl_unused const unsigned char * +OPENSSL_load_u32_le(uint32_t *val, const unsigned char *in) +{ +#ifdef OSSL_LE32TOH + uint32_t t; + + memcpy((unsigned char *)&t, in, 4); + *val = OSSL_LE32TOH(t); + return in + 4; +#else + uint32_t b0 = *in++; + uint32_t b1 = *in++; + uint32_t b2 = *in++; + uint32_t b3 = *in++; + + *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24); + return in; +#endif +} + +static ossl_inline ossl_unused const unsigned char * +OPENSSL_load_u32_be(uint32_t *val, const unsigned char *in) +{ +#ifdef OSSL_LE32TOH + uint32_t t; + + memcpy((unsigned char *)&t, in, 4); + *val = OSSL_BE32TOH(t); + return in + 4; +#else + uint32_t b3 = *in++; + uint32_t b2 = *in++; + uint32_t b1 = *in++; + uint32_t b0 = *in++; + + *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24); + return in; +#endif +} + +static ossl_inline ossl_unused const unsigned char * +OPENSSL_load_u64_le(uint64_t *val, const unsigned char *in) +{ +#ifdef OSSL_LE64TOH + uint64_t t; + + memcpy((unsigned char *)&t, in, 8); + *val = OSSL_LE64TOH(t); + return in + 8; +#else + uint64_t b0 = *in++; + uint64_t b1 = *in++; + uint64_t b2 = *in++; + uint64_t b3 = *in++; + uint64_t b4 = *in++; + uint64_t b5 = *in++; + uint64_t b6 = *in++; + uint64_t b7 = *in++; + + *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24) + | (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56); + return in; +#endif +} + +static ossl_inline ossl_unused const unsigned char * +OPENSSL_load_u64_be(uint64_t *val, const unsigned char *in) +{ +#ifdef OSSL_LE64TOH + uint64_t t; + + memcpy((unsigned char *)&t, in, 8); + *val = OSSL_BE64TOH(t); + return in + 8; +#else + uint64_t b7 = *in++; + uint64_t b6 = *in++; + uint64_t b5 = *in++; + uint64_t b4 = *in++; + uint64_t b3 = *in++; + uint64_t b2 = *in++; + uint64_t b1 = *in++; + uint64_t b0 = *in++; + + *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24) + | (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56); + return in; +#endif +} + +#undef OSSL_HTOBE16 +#undef OSSL_HTOBE32 +#undef OSSL_HTOBE64 +#undef OSSL_BE16TOH +#undef OSSL_BE32TOH +#undef OSSL_BE64TOH +#undef OSSL_HTOLE16 +#undef OSSL_HTOLE32 +#undef OSSL_HTOLE64 +#undef OSSL_LE16TOH +#undef OSSL_LE32TOH +#undef OSSL_LE64TOH + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/camellia.h b/VCMP-LUA/modules/postgresql/include/openssl/camellia.h new file mode 100644 index 0000000..aec94e4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/camellia.h @@ -0,0 +1,117 @@ +/* + * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CAMELLIA_H +#define OPENSSL_CAMELLIA_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_CAMELLIA_H +#endif + +#include + +#ifndef OPENSSL_NO_CAMELLIA +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define CAMELLIA_BLOCK_SIZE 16 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + +#define CAMELLIA_ENCRYPT 1 +#define CAMELLIA_DECRYPT 0 + +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ + +/* This should be a hidden type, but EVP requires that the size be known */ + +#define CAMELLIA_TABLE_BYTE_LEN 272 +#define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) + +typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match + * with WORD */ + +struct camellia_key_st { + union { + double d; /* ensures 64-bit align */ + KEY_TABLE_TYPE rd_key; + } u; + int grand_rounds; +}; +typedef struct camellia_key_st CAMELLIA_KEY; + +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int Camellia_set_key(const unsigned char *userKey, + const int bits, + CAMELLIA_KEY *key); +OSSL_DEPRECATEDIN_3_0 void Camellia_encrypt(const unsigned char *in, + unsigned char *out, + const CAMELLIA_KEY *key); +OSSL_DEPRECATEDIN_3_0 void Camellia_decrypt(const unsigned char *in, + unsigned char *out, + const CAMELLIA_KEY *key); +OSSL_DEPRECATEDIN_3_0 void Camellia_ecb_encrypt(const unsigned char *in, + unsigned char *out, + const CAMELLIA_KEY *key, + const int enc); +OSSL_DEPRECATEDIN_3_0 void Camellia_cbc_encrypt(const unsigned char *in, + unsigned char *out, + size_t length, + const CAMELLIA_KEY *key, + unsigned char *ivec, + const int enc); +OSSL_DEPRECATEDIN_3_0 void Camellia_cfb128_encrypt(const unsigned char *in, + unsigned char *out, + size_t length, + const CAMELLIA_KEY *key, + unsigned char *ivec, + int *num, + const int enc); +OSSL_DEPRECATEDIN_3_0 void Camellia_cfb1_encrypt(const unsigned char *in, + unsigned char *out, + size_t length, + const CAMELLIA_KEY *key, + unsigned char *ivec, + int *num, + const int enc); +OSSL_DEPRECATEDIN_3_0 void Camellia_cfb8_encrypt(const unsigned char *in, + unsigned char *out, + size_t length, + const CAMELLIA_KEY *key, + unsigned char *ivec, + int *num, + const int enc); +OSSL_DEPRECATEDIN_3_0 void Camellia_ofb128_encrypt(const unsigned char *in, + unsigned char *out, + size_t length, + const CAMELLIA_KEY *key, + unsigned char *ivec, + int *num); +OSSL_DEPRECATEDIN_3_0 +void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char ivec[CAMELLIA_BLOCK_SIZE], + unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], + unsigned int *num); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cast.h b/VCMP-LUA/modules/postgresql/include/openssl/cast.h new file mode 100644 index 0000000..af94312 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cast.h @@ -0,0 +1,71 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CAST_H +#define OPENSSL_CAST_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_CAST_H +#endif + +#include + +#ifndef OPENSSL_NO_CAST +#ifdef __cplusplus +extern "C" { +#endif + +#define CAST_BLOCK 8 +#define CAST_KEY_LENGTH 16 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + +#define CAST_ENCRYPT 1 +#define CAST_DECRYPT 0 + +#define CAST_LONG unsigned int + +typedef struct cast_key_st { + CAST_LONG data[32]; + int short_key; /* Use reduced rounds for short key */ +} CAST_KEY; + +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); +OSSL_DEPRECATEDIN_3_0 +void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, + const CAST_KEY *key, int enc); +OSSL_DEPRECATEDIN_3_0 +void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); +OSSL_DEPRECATEDIN_3_0 +void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); +OSSL_DEPRECATEDIN_3_0 +void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *ks, unsigned char *iv, + int enc); +OSSL_DEPRECATEDIN_3_0 +void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, + unsigned char *ivec, int *num, int enc); +OSSL_DEPRECATEDIN_3_0 +void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, + unsigned char *ivec, int *num); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cmac.h b/VCMP-LUA/modules/postgresql/include/openssl/cmac.h new file mode 100644 index 0000000..c72da7e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cmac.h @@ -0,0 +1,52 @@ +/* + * Copyright 2010-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CMAC_H +#define OPENSSL_CMAC_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_CMAC_H +#endif + +#ifndef OPENSSL_NO_CMAC + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* Opaque */ +typedef struct CMAC_CTX_st CMAC_CTX; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 CMAC_CTX *CMAC_CTX_new(void); +OSSL_DEPRECATEDIN_3_0 void CMAC_CTX_cleanup(CMAC_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 void CMAC_CTX_free(CMAC_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); +OSSL_DEPRECATEDIN_3_0 int CMAC_Init(CMAC_CTX *ctx, + const void *key, size_t keylen, + const EVP_CIPHER *cipher, ENGINE *impl); +OSSL_DEPRECATEDIN_3_0 int CMAC_Update(CMAC_CTX *ctx, + const void *data, size_t dlen); +OSSL_DEPRECATEDIN_3_0 int CMAC_Final(CMAC_CTX *ctx, + unsigned char *out, size_t *poutlen); +OSSL_DEPRECATEDIN_3_0 int CMAC_resume(CMAC_CTX *ctx); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cmp.h b/VCMP-LUA/modules/postgresql/include/openssl/cmp.h new file mode 100644 index 0000000..b2ac29a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cmp.h @@ -0,0 +1,741 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\cmp.h.in + * + * Copyright 2007-2026 The OpenSSL Project Authors. All Rights Reserved. + * Copyright Nokia 2007-2019 + * Copyright Siemens AG 2015-2019 + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_CMP_H +#define OPENSSL_CMP_H + +#include +#ifndef OPENSSL_NO_CMP + +#include +#include +#include +#include + +/* explicit #includes not strictly needed since implied by the above: */ +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OSSL_CMP_PVNO_2 2 +#define OSSL_CMP_PVNO_3 3 +#define OSSL_CMP_PVNO OSSL_CMP_PVNO_2 /* v2 is the default */ + +/*- + * PKIFailureInfo ::= BIT STRING { + * -- since we can fail in more than one way! + * -- More codes may be added in the future if/when required. + * badAlg (0), + * -- unrecognized or unsupported Algorithm Identifier + * badMessageCheck (1), + * -- integrity check failed (e.g., signature did not verify) + * badRequest (2), + * -- transaction not permitted or supported + * badTime (3), + * -- messageTime was not sufficiently close to the system time, + * -- as defined by local policy + * badCertId (4), + * -- no certificate could be found matching the provided criteria + * badDataFormat (5), + * -- the data submitted has the wrong format + * wrongAuthority (6), + * -- the authority indicated in the request is different from the + * -- one creating the response token + * incorrectData (7), + * -- the requester's data is incorrect (for notary services) + * missingTimeStamp (8), + * -- when the timestamp is missing but should be there + * -- (by policy) + * badPOP (9), + * -- the proof-of-possession failed + * certRevoked (10), + * -- the certificate has already been revoked + * certConfirmed (11), + * -- the certificate has already been confirmed + * wrongIntegrity (12), + * -- invalid integrity, password based instead of signature or + * -- vice versa + * badRecipientNonce (13), + * -- invalid recipient nonce, either missing or wrong value + * timeNotAvailable (14), + * -- the TSA's time source is not available + * unacceptedPolicy (15), + * -- the requested TSA policy is not supported by the TSA. + * unacceptedExtension (16), + * -- the requested extension is not supported by the TSA. + * addInfoNotAvailable (17), + * -- the additional information requested could not be + * -- understood or is not available + * badSenderNonce (18), + * -- invalid sender nonce, either missing or wrong size + * badCertTemplate (19), + * -- invalid cert. template or missing mandatory information + * signerNotTrusted (20), + * -- signer of the message unknown or not trusted + * transactionIdInUse (21), + * -- the transaction identifier is already in use + * unsupportedVersion (22), + * -- the version of the message is not supported + * notAuthorized (23), + * -- the sender was not authorized to make the preceding + * -- request or perform the preceding action + * systemUnavail (24), + * -- the request cannot be handled due to system unavailability + * systemFailure (25), + * -- the request cannot be handled due to system failure + * duplicateCertReq (26) + * -- certificate cannot be issued because a duplicate + * -- certificate already exists + * } + */ +#define OSSL_CMP_PKIFAILUREINFO_badAlg 0 +#define OSSL_CMP_PKIFAILUREINFO_badMessageCheck 1 +#define OSSL_CMP_PKIFAILUREINFO_badRequest 2 +#define OSSL_CMP_PKIFAILUREINFO_badTime 3 +#define OSSL_CMP_PKIFAILUREINFO_badCertId 4 +#define OSSL_CMP_PKIFAILUREINFO_badDataFormat 5 +#define OSSL_CMP_PKIFAILUREINFO_wrongAuthority 6 +#define OSSL_CMP_PKIFAILUREINFO_incorrectData 7 +#define OSSL_CMP_PKIFAILUREINFO_missingTimeStamp 8 +#define OSSL_CMP_PKIFAILUREINFO_badPOP 9 +#define OSSL_CMP_PKIFAILUREINFO_certRevoked 10 +#define OSSL_CMP_PKIFAILUREINFO_certConfirmed 11 +#define OSSL_CMP_PKIFAILUREINFO_wrongIntegrity 12 +#define OSSL_CMP_PKIFAILUREINFO_badRecipientNonce 13 +#define OSSL_CMP_PKIFAILUREINFO_timeNotAvailable 14 +#define OSSL_CMP_PKIFAILUREINFO_unacceptedPolicy 15 +#define OSSL_CMP_PKIFAILUREINFO_unacceptedExtension 16 +#define OSSL_CMP_PKIFAILUREINFO_addInfoNotAvailable 17 +#define OSSL_CMP_PKIFAILUREINFO_badSenderNonce 18 +#define OSSL_CMP_PKIFAILUREINFO_badCertTemplate 19 +#define OSSL_CMP_PKIFAILUREINFO_signerNotTrusted 20 +#define OSSL_CMP_PKIFAILUREINFO_transactionIdInUse 21 +#define OSSL_CMP_PKIFAILUREINFO_unsupportedVersion 22 +#define OSSL_CMP_PKIFAILUREINFO_notAuthorized 23 +#define OSSL_CMP_PKIFAILUREINFO_systemUnavail 24 +#define OSSL_CMP_PKIFAILUREINFO_systemFailure 25 +#define OSSL_CMP_PKIFAILUREINFO_duplicateCertReq 26 +#define OSSL_CMP_PKIFAILUREINFO_MAX 26 +#define OSSL_CMP_PKIFAILUREINFO_MAX_BIT_PATTERN \ + ((1 << (OSSL_CMP_PKIFAILUREINFO_MAX + 1)) - 1) +#if OSSL_CMP_PKIFAILUREINFO_MAX_BIT_PATTERN > INT_MAX +#error CMP_PKIFAILUREINFO_MAX bit pattern does not fit in type int +#endif +typedef ASN1_BIT_STRING OSSL_CMP_PKIFAILUREINFO; + +#define OSSL_CMP_CTX_FAILINFO_badAlg (1 << 0) +#define OSSL_CMP_CTX_FAILINFO_badMessageCheck (1 << 1) +#define OSSL_CMP_CTX_FAILINFO_badRequest (1 << 2) +#define OSSL_CMP_CTX_FAILINFO_badTime (1 << 3) +#define OSSL_CMP_CTX_FAILINFO_badCertId (1 << 4) +#define OSSL_CMP_CTX_FAILINFO_badDataFormat (1 << 5) +#define OSSL_CMP_CTX_FAILINFO_wrongAuthority (1 << 6) +#define OSSL_CMP_CTX_FAILINFO_incorrectData (1 << 7) +#define OSSL_CMP_CTX_FAILINFO_missingTimeStamp (1 << 8) +#define OSSL_CMP_CTX_FAILINFO_badPOP (1 << 9) +#define OSSL_CMP_CTX_FAILINFO_certRevoked (1 << 10) +#define OSSL_CMP_CTX_FAILINFO_certConfirmed (1 << 11) +#define OSSL_CMP_CTX_FAILINFO_wrongIntegrity (1 << 12) +#define OSSL_CMP_CTX_FAILINFO_badRecipientNonce (1 << 13) +#define OSSL_CMP_CTX_FAILINFO_timeNotAvailable (1 << 14) +#define OSSL_CMP_CTX_FAILINFO_unacceptedPolicy (1 << 15) +#define OSSL_CMP_CTX_FAILINFO_unacceptedExtension (1 << 16) +#define OSSL_CMP_CTX_FAILINFO_addInfoNotAvailable (1 << 17) +#define OSSL_CMP_CTX_FAILINFO_badSenderNonce (1 << 18) +#define OSSL_CMP_CTX_FAILINFO_badCertTemplate (1 << 19) +#define OSSL_CMP_CTX_FAILINFO_signerNotTrusted (1 << 20) +#define OSSL_CMP_CTX_FAILINFO_transactionIdInUse (1 << 21) +#define OSSL_CMP_CTX_FAILINFO_unsupportedVersion (1 << 22) +#define OSSL_CMP_CTX_FAILINFO_notAuthorized (1 << 23) +#define OSSL_CMP_CTX_FAILINFO_systemUnavail (1 << 24) +#define OSSL_CMP_CTX_FAILINFO_systemFailure (1 << 25) +#define OSSL_CMP_CTX_FAILINFO_duplicateCertReq (1 << 26) + +/*- + * PKIStatus ::= INTEGER { + * accepted (0), + * -- you got exactly what you asked for + * grantedWithMods (1), + * -- you got something like what you asked for; the + * -- requester is responsible for ascertaining the differences + * rejection (2), + * -- you don't get it, more information elsewhere in the message + * waiting (3), + * -- the request body part has not yet been processed; expect to + * -- hear more later (note: proper handling of this status + * -- response MAY use the polling req/rep PKIMessages specified + * -- in Section 5.3.22; alternatively, polling in the underlying + * -- transport layer MAY have some utility in this regard) + * revocationWarning (4), + * -- this message contains a warning that a revocation is + * -- imminent + * revocationNotification (5), + * -- notification that a revocation has occurred + * keyUpdateWarning (6) + * -- update already done for the oldCertId specified in + * -- CertReqMsg + * } + */ +#define OSSL_CMP_PKISTATUS_rejected_by_client -5 +#define OSSL_CMP_PKISTATUS_checking_response -4 +#define OSSL_CMP_PKISTATUS_request -3 +#define OSSL_CMP_PKISTATUS_trans -2 +#define OSSL_CMP_PKISTATUS_unspecified -1 +#define OSSL_CMP_PKISTATUS_accepted 0 +#define OSSL_CMP_PKISTATUS_grantedWithMods 1 +#define OSSL_CMP_PKISTATUS_rejection 2 +#define OSSL_CMP_PKISTATUS_waiting 3 +#define OSSL_CMP_PKISTATUS_revocationWarning 4 +#define OSSL_CMP_PKISTATUS_revocationNotification 5 +#define OSSL_CMP_PKISTATUS_keyUpdateWarning 6 +typedef ASN1_INTEGER OSSL_CMP_PKISTATUS; + +DECLARE_ASN1_ITEM(OSSL_CMP_PKISTATUS) + +#define OSSL_CMP_CERTORENCCERT_CERTIFICATE 0 +#define OSSL_CMP_CERTORENCCERT_ENCRYPTEDCERT 1 + +/* data type declarations */ +typedef struct ossl_cmp_ctx_st OSSL_CMP_CTX; +typedef struct ossl_cmp_pkiheader_st OSSL_CMP_PKIHEADER; +DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PKIHEADER) +typedef struct ossl_cmp_msg_st OSSL_CMP_MSG; +DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_MSG) +DECLARE_ASN1_ENCODE_FUNCTIONS(OSSL_CMP_MSG, OSSL_CMP_MSG, OSSL_CMP_MSG) +typedef struct ossl_cmp_certstatus_st OSSL_CMP_CERTSTATUS; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CERTSTATUS, OSSL_CMP_CERTSTATUS, OSSL_CMP_CERTSTATUS) +#define sk_OSSL_CMP_CERTSTATUS_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CERTSTATUS_value(sk, idx) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk), (idx))) +#define sk_OSSL_CMP_CERTSTATUS_new(cmp) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CERTSTATUS_compfunc_type(cmp))) +#define sk_OSSL_CMP_CERTSTATUS_new_null() ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_new_null()) +#define sk_OSSL_CMP_CERTSTATUS_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CERTSTATUS_compfunc_type(cmp), (n))) +#define sk_OSSL_CMP_CERTSTATUS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), (n)) +#define sk_OSSL_CMP_CERTSTATUS_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CERTSTATUS_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CERTSTATUS_delete(sk, i) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), (i))) +#define sk_OSSL_CMP_CERTSTATUS_delete_ptr(sk, ptr) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))) +#define sk_OSSL_CMP_CERTSTATUS_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr)) +#define sk_OSSL_CMP_CERTSTATUS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr)) +#define sk_OSSL_CMP_CERTSTATUS_pop(sk) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk))) +#define sk_OSSL_CMP_CERTSTATUS_shift(sk) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk))) +#define sk_OSSL_CMP_CERTSTATUS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_freefunc_type(freefunc)) +#define sk_OSSL_CMP_CERTSTATUS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr), (idx)) +#define sk_OSSL_CMP_CERTSTATUS_set(sk, idx, ptr) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), (idx), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))) +#define sk_OSSL_CMP_CERTSTATUS_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr)) +#define sk_OSSL_CMP_CERTSTATUS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr)) +#define sk_OSSL_CMP_CERTSTATUS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr), pnum) +#define sk_OSSL_CMP_CERTSTATUS_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CERTSTATUS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CERTSTATUS_dup(sk) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk))) +#define sk_OSSL_CMP_CERTSTATUS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CERTSTATUS_freefunc_type(freefunc))) +#define sk_OSSL_CMP_CERTSTATUS_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CERTSTATUS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_compfunc_type(cmp))) + +/* clang-format on */ +typedef struct ossl_cmp_itav_st OSSL_CMP_ITAV; +DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_ITAV) +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_ITAV, OSSL_CMP_ITAV, OSSL_CMP_ITAV) +#define sk_OSSL_CMP_ITAV_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk)) +#define sk_OSSL_CMP_ITAV_value(sk, idx) ((OSSL_CMP_ITAV *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk), (idx))) +#define sk_OSSL_CMP_ITAV_new(cmp) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_ITAV_compfunc_type(cmp))) +#define sk_OSSL_CMP_ITAV_new_null() ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_new_null()) +#define sk_OSSL_CMP_ITAV_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_ITAV_compfunc_type(cmp), (n))) +#define sk_OSSL_CMP_ITAV_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_ITAV_sk_type(sk), (n)) +#define sk_OSSL_CMP_ITAV_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_ITAV_sk_type(sk)) +#define sk_OSSL_CMP_ITAV_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_ITAV_sk_type(sk)) +#define sk_OSSL_CMP_ITAV_delete(sk, i) ((OSSL_CMP_ITAV *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_ITAV_sk_type(sk), (i))) +#define sk_OSSL_CMP_ITAV_delete_ptr(sk, ptr) ((OSSL_CMP_ITAV *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr))) +#define sk_OSSL_CMP_ITAV_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr)) +#define sk_OSSL_CMP_ITAV_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr)) +#define sk_OSSL_CMP_ITAV_pop(sk) ((OSSL_CMP_ITAV *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_ITAV_sk_type(sk))) +#define sk_OSSL_CMP_ITAV_shift(sk) ((OSSL_CMP_ITAV *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_ITAV_sk_type(sk))) +#define sk_OSSL_CMP_ITAV_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_freefunc_type(freefunc)) +#define sk_OSSL_CMP_ITAV_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr), (idx)) +#define sk_OSSL_CMP_ITAV_set(sk, idx, ptr) ((OSSL_CMP_ITAV *)OPENSSL_sk_set(ossl_check_OSSL_CMP_ITAV_sk_type(sk), (idx), ossl_check_OSSL_CMP_ITAV_type(ptr))) +#define sk_OSSL_CMP_ITAV_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr)) +#define sk_OSSL_CMP_ITAV_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr)) +#define sk_OSSL_CMP_ITAV_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr), pnum) +#define sk_OSSL_CMP_ITAV_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_ITAV_sk_type(sk)) +#define sk_OSSL_CMP_ITAV_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk)) +#define sk_OSSL_CMP_ITAV_dup(sk) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk))) +#define sk_OSSL_CMP_ITAV_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_ITAV_freefunc_type(freefunc))) +#define sk_OSSL_CMP_ITAV_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_ITAV_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct ossl_cmp_crlstatus_st OSSL_CMP_CRLSTATUS; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CRLSTATUS, OSSL_CMP_CRLSTATUS, OSSL_CMP_CRLSTATUS) +#define sk_OSSL_CMP_CRLSTATUS_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CRLSTATUS_value(sk, idx) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk), (idx))) +#define sk_OSSL_CMP_CRLSTATUS_new(cmp) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CRLSTATUS_compfunc_type(cmp))) +#define sk_OSSL_CMP_CRLSTATUS_new_null() ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_new_null()) +#define sk_OSSL_CMP_CRLSTATUS_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CRLSTATUS_compfunc_type(cmp), (n))) +#define sk_OSSL_CMP_CRLSTATUS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), (n)) +#define sk_OSSL_CMP_CRLSTATUS_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CRLSTATUS_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CRLSTATUS_delete(sk, i) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), (i))) +#define sk_OSSL_CMP_CRLSTATUS_delete_ptr(sk, ptr) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))) +#define sk_OSSL_CMP_CRLSTATUS_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr)) +#define sk_OSSL_CMP_CRLSTATUS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr)) +#define sk_OSSL_CMP_CRLSTATUS_pop(sk) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk))) +#define sk_OSSL_CMP_CRLSTATUS_shift(sk) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk))) +#define sk_OSSL_CMP_CRLSTATUS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_freefunc_type(freefunc)) +#define sk_OSSL_CMP_CRLSTATUS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr), (idx)) +#define sk_OSSL_CMP_CRLSTATUS_set(sk, idx, ptr) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), (idx), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))) +#define sk_OSSL_CMP_CRLSTATUS_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr)) +#define sk_OSSL_CMP_CRLSTATUS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr)) +#define sk_OSSL_CMP_CRLSTATUS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr), pnum) +#define sk_OSSL_CMP_CRLSTATUS_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CRLSTATUS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk)) +#define sk_OSSL_CMP_CRLSTATUS_dup(sk) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk))) +#define sk_OSSL_CMP_CRLSTATUS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CRLSTATUS_freefunc_type(freefunc))) +#define sk_OSSL_CMP_CRLSTATUS_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CRLSTATUS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_compfunc_type(cmp))) + +/* clang-format on */ + +typedef OSSL_CRMF_ATTRIBUTETYPEANDVALUE OSSL_CMP_ATAV; +#define OSSL_CMP_ATAV_free OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free +typedef STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) OSSL_CMP_ATAVS; +DECLARE_ASN1_FUNCTIONS(OSSL_CMP_ATAVS) +#define stack_st_OSSL_CMP_ATAV stack_st_OSSL_CRMF_ATTRIBUTETYPEANDVALUE +#define sk_OSSL_CMP_ATAV_num sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_num +#define sk_OSSL_CMP_ATAV_value sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_value +#define sk_OSSL_CMP_ATAV_push sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_push +#define sk_OSSL_CMP_ATAV_pop_free sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_pop_free + +typedef struct ossl_cmp_revrepcontent_st OSSL_CMP_REVREPCONTENT; +typedef struct ossl_cmp_pkisi_st OSSL_CMP_PKISI; +DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PKISI) +DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_PKISI) +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_PKISI, OSSL_CMP_PKISI, OSSL_CMP_PKISI) +#define sk_OSSL_CMP_PKISI_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk)) +#define sk_OSSL_CMP_PKISI_value(sk, idx) ((OSSL_CMP_PKISI *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk), (idx))) +#define sk_OSSL_CMP_PKISI_new(cmp) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_PKISI_compfunc_type(cmp))) +#define sk_OSSL_CMP_PKISI_new_null() ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_new_null()) +#define sk_OSSL_CMP_PKISI_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_PKISI_compfunc_type(cmp), (n))) +#define sk_OSSL_CMP_PKISI_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_PKISI_sk_type(sk), (n)) +#define sk_OSSL_CMP_PKISI_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_PKISI_sk_type(sk)) +#define sk_OSSL_CMP_PKISI_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_PKISI_sk_type(sk)) +#define sk_OSSL_CMP_PKISI_delete(sk, i) ((OSSL_CMP_PKISI *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_PKISI_sk_type(sk), (i))) +#define sk_OSSL_CMP_PKISI_delete_ptr(sk, ptr) ((OSSL_CMP_PKISI *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr))) +#define sk_OSSL_CMP_PKISI_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr)) +#define sk_OSSL_CMP_PKISI_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr)) +#define sk_OSSL_CMP_PKISI_pop(sk) ((OSSL_CMP_PKISI *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_PKISI_sk_type(sk))) +#define sk_OSSL_CMP_PKISI_shift(sk) ((OSSL_CMP_PKISI *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_PKISI_sk_type(sk))) +#define sk_OSSL_CMP_PKISI_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_freefunc_type(freefunc)) +#define sk_OSSL_CMP_PKISI_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr), (idx)) +#define sk_OSSL_CMP_PKISI_set(sk, idx, ptr) ((OSSL_CMP_PKISI *)OPENSSL_sk_set(ossl_check_OSSL_CMP_PKISI_sk_type(sk), (idx), ossl_check_OSSL_CMP_PKISI_type(ptr))) +#define sk_OSSL_CMP_PKISI_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr)) +#define sk_OSSL_CMP_PKISI_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr)) +#define sk_OSSL_CMP_PKISI_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr), pnum) +#define sk_OSSL_CMP_PKISI_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_PKISI_sk_type(sk)) +#define sk_OSSL_CMP_PKISI_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk)) +#define sk_OSSL_CMP_PKISI_dup(sk) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk))) +#define sk_OSSL_CMP_PKISI_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_PKISI_freefunc_type(freefunc))) +#define sk_OSSL_CMP_PKISI_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_PKISI_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_compfunc_type(cmp))) + +/* clang-format on */ +typedef struct ossl_cmp_certrepmessage_st OSSL_CMP_CERTREPMESSAGE; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CERTREPMESSAGE, OSSL_CMP_CERTREPMESSAGE, OSSL_CMP_CERTREPMESSAGE) +#define sk_OSSL_CMP_CERTREPMESSAGE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)) +#define sk_OSSL_CMP_CERTREPMESSAGE_value(sk, idx) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (idx))) +#define sk_OSSL_CMP_CERTREPMESSAGE_new(cmp) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CERTREPMESSAGE_compfunc_type(cmp))) +#define sk_OSSL_CMP_CERTREPMESSAGE_new_null() ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_new_null()) +#define sk_OSSL_CMP_CERTREPMESSAGE_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CERTREPMESSAGE_compfunc_type(cmp), (n))) +#define sk_OSSL_CMP_CERTREPMESSAGE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (n)) +#define sk_OSSL_CMP_CERTREPMESSAGE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)) +#define sk_OSSL_CMP_CERTREPMESSAGE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)) +#define sk_OSSL_CMP_CERTREPMESSAGE_delete(sk, i) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (i))) +#define sk_OSSL_CMP_CERTREPMESSAGE_delete_ptr(sk, ptr) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))) +#define sk_OSSL_CMP_CERTREPMESSAGE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr)) +#define sk_OSSL_CMP_CERTREPMESSAGE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr)) +#define sk_OSSL_CMP_CERTREPMESSAGE_pop(sk) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))) +#define sk_OSSL_CMP_CERTREPMESSAGE_shift(sk) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))) +#define sk_OSSL_CMP_CERTREPMESSAGE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_freefunc_type(freefunc)) +#define sk_OSSL_CMP_CERTREPMESSAGE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr), (idx)) +#define sk_OSSL_CMP_CERTREPMESSAGE_set(sk, idx, ptr) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (idx), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))) +#define sk_OSSL_CMP_CERTREPMESSAGE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr)) +#define sk_OSSL_CMP_CERTREPMESSAGE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr)) +#define sk_OSSL_CMP_CERTREPMESSAGE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr), pnum) +#define sk_OSSL_CMP_CERTREPMESSAGE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)) +#define sk_OSSL_CMP_CERTREPMESSAGE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)) +#define sk_OSSL_CMP_CERTREPMESSAGE_dup(sk) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))) +#define sk_OSSL_CMP_CERTREPMESSAGE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CERTREPMESSAGE_freefunc_type(freefunc))) +#define sk_OSSL_CMP_CERTREPMESSAGE_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CERTREPMESSAGE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_compfunc_type(cmp))) + +/* clang-format on */ +typedef struct ossl_cmp_pollrep_st OSSL_CMP_POLLREP; +typedef STACK_OF(OSSL_CMP_POLLREP) OSSL_CMP_POLLREPCONTENT; +typedef struct ossl_cmp_certresponse_st OSSL_CMP_CERTRESPONSE; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CERTRESPONSE, OSSL_CMP_CERTRESPONSE, OSSL_CMP_CERTRESPONSE) +#define sk_OSSL_CMP_CERTRESPONSE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk)) +#define sk_OSSL_CMP_CERTRESPONSE_value(sk, idx) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk), (idx))) +#define sk_OSSL_CMP_CERTRESPONSE_new(cmp) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CERTRESPONSE_compfunc_type(cmp))) +#define sk_OSSL_CMP_CERTRESPONSE_new_null() ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_new_null()) +#define sk_OSSL_CMP_CERTRESPONSE_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CERTRESPONSE_compfunc_type(cmp), (n))) +#define sk_OSSL_CMP_CERTRESPONSE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), (n)) +#define sk_OSSL_CMP_CERTRESPONSE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk)) +#define sk_OSSL_CMP_CERTRESPONSE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk)) +#define sk_OSSL_CMP_CERTRESPONSE_delete(sk, i) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), (i))) +#define sk_OSSL_CMP_CERTRESPONSE_delete_ptr(sk, ptr) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))) +#define sk_OSSL_CMP_CERTRESPONSE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr)) +#define sk_OSSL_CMP_CERTRESPONSE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr)) +#define sk_OSSL_CMP_CERTRESPONSE_pop(sk) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk))) +#define sk_OSSL_CMP_CERTRESPONSE_shift(sk) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk))) +#define sk_OSSL_CMP_CERTRESPONSE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_freefunc_type(freefunc)) +#define sk_OSSL_CMP_CERTRESPONSE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr), (idx)) +#define sk_OSSL_CMP_CERTRESPONSE_set(sk, idx, ptr) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), (idx), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))) +#define sk_OSSL_CMP_CERTRESPONSE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr)) +#define sk_OSSL_CMP_CERTRESPONSE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr)) +#define sk_OSSL_CMP_CERTRESPONSE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr), pnum) +#define sk_OSSL_CMP_CERTRESPONSE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk)) +#define sk_OSSL_CMP_CERTRESPONSE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk)) +#define sk_OSSL_CMP_CERTRESPONSE_dup(sk) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk))) +#define sk_OSSL_CMP_CERTRESPONSE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CERTRESPONSE_freefunc_type(freefunc))) +#define sk_OSSL_CMP_CERTRESPONSE_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CERTRESPONSE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_compfunc_type(cmp))) + +/* clang-format on */ +typedef STACK_OF(ASN1_UTF8STRING) OSSL_CMP_PKIFREETEXT; + +/* + * function DECLARATIONS + */ + +/* from cmp_asn.c */ +OSSL_CMP_ITAV *OSSL_CMP_ITAV_create(ASN1_OBJECT *type, ASN1_TYPE *value); +void OSSL_CMP_ITAV_set0(OSSL_CMP_ITAV *itav, ASN1_OBJECT *type, + ASN1_TYPE *value); +ASN1_OBJECT *OSSL_CMP_ITAV_get0_type(const OSSL_CMP_ITAV *itav); +ASN1_TYPE *OSSL_CMP_ITAV_get0_value(const OSSL_CMP_ITAV *itav); +int OSSL_CMP_ITAV_push0_stack_item(STACK_OF(OSSL_CMP_ITAV) **sk_p, + OSSL_CMP_ITAV *itav); +void OSSL_CMP_ITAV_free(OSSL_CMP_ITAV *itav); + +OSSL_CMP_ITAV *OSSL_CMP_ITAV_new0_certProfile(STACK_OF(ASN1_UTF8STRING) + *certProfile); +int OSSL_CMP_ITAV_get0_certProfile(const OSSL_CMP_ITAV *itav, + STACK_OF(ASN1_UTF8STRING) **out); +OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_caCerts(const STACK_OF(X509) *caCerts); +int OSSL_CMP_ITAV_get0_caCerts(const OSSL_CMP_ITAV *itav, STACK_OF(X509) **out); + +OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_rootCaCert(const X509 *rootCaCert); +int OSSL_CMP_ITAV_get0_rootCaCert(const OSSL_CMP_ITAV *itav, X509 **out); +OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_rootCaKeyUpdate(const X509 *newWithNew, + const X509 *newWithOld, + const X509 *oldWithNew); +int OSSL_CMP_ITAV_get0_rootCaKeyUpdate(const OSSL_CMP_ITAV *itav, + X509 **newWithNew, + X509 **newWithOld, + X509 **oldWithNew); + +OSSL_CMP_CRLSTATUS *OSSL_CMP_CRLSTATUS_create(const X509_CRL *crl, + const X509 *cert, int only_DN); +OSSL_CMP_CRLSTATUS *OSSL_CMP_CRLSTATUS_new1(const DIST_POINT_NAME *dpn, + const GENERAL_NAMES *issuer, + const ASN1_TIME *thisUpdate); +int OSSL_CMP_CRLSTATUS_get0(const OSSL_CMP_CRLSTATUS *crlstatus, + DIST_POINT_NAME **dpn, GENERAL_NAMES **issuer, + ASN1_TIME **thisUpdate); +void OSSL_CMP_CRLSTATUS_free(OSSL_CMP_CRLSTATUS *crlstatus); +OSSL_CMP_ITAV +*OSSL_CMP_ITAV_new0_crlStatusList(STACK_OF(OSSL_CMP_CRLSTATUS) *crlStatusList); +int OSSL_CMP_ITAV_get0_crlStatusList(const OSSL_CMP_ITAV *itav, + STACK_OF(OSSL_CMP_CRLSTATUS) **out); +OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_crls(const X509_CRL *crls); +int OSSL_CMP_ITAV_get0_crls(const OSSL_CMP_ITAV *it, STACK_OF(X509_CRL) **out); +OSSL_CMP_ITAV +*OSSL_CMP_ITAV_new0_certReqTemplate(OSSL_CRMF_CERTTEMPLATE *certTemplate, + OSSL_CMP_ATAVS *keySpec); +int OSSL_CMP_ITAV_get1_certReqTemplate(const OSSL_CMP_ITAV *itav, + OSSL_CRMF_CERTTEMPLATE **certTemplate, + OSSL_CMP_ATAVS **keySpec); + +OSSL_CMP_ATAV *OSSL_CMP_ATAV_create(ASN1_OBJECT *type, ASN1_TYPE *value); +void OSSL_CMP_ATAV_set0(OSSL_CMP_ATAV *itav, ASN1_OBJECT *type, + ASN1_TYPE *value); +ASN1_OBJECT *OSSL_CMP_ATAV_get0_type(const OSSL_CMP_ATAV *itav); +ASN1_TYPE *OSSL_CMP_ATAV_get0_value(const OSSL_CMP_ATAV *itav); +OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_algId(const X509_ALGOR *alg); +X509_ALGOR *OSSL_CMP_ATAV_get0_algId(const OSSL_CMP_ATAV *atav); +OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_rsaKeyLen(int len); +int OSSL_CMP_ATAV_get_rsaKeyLen(const OSSL_CMP_ATAV *atav); +int OSSL_CMP_ATAV_push1(OSSL_CMP_ATAVS **sk_p, const OSSL_CMP_ATAV *atav); + +void OSSL_CMP_MSG_free(OSSL_CMP_MSG *msg); + +/* from cmp_ctx.c */ +OSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq); +void OSSL_CMP_CTX_free(OSSL_CMP_CTX *ctx); +int OSSL_CMP_CTX_reinit(OSSL_CMP_CTX *ctx); +OSSL_LIB_CTX *OSSL_CMP_CTX_get0_libctx(const OSSL_CMP_CTX *ctx); +const char *OSSL_CMP_CTX_get0_propq(const OSSL_CMP_CTX *ctx); +/* CMP general options: */ +#define OSSL_CMP_OPT_LOG_VERBOSITY 0 +/* CMP transfer options: */ +#define OSSL_CMP_OPT_KEEP_ALIVE 10 +#define OSSL_CMP_OPT_MSG_TIMEOUT 11 +#define OSSL_CMP_OPT_TOTAL_TIMEOUT 12 +#define OSSL_CMP_OPT_USE_TLS 13 +/* CMP request options: */ +#define OSSL_CMP_OPT_VALIDITY_DAYS 20 +#define OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT 21 +#define OSSL_CMP_OPT_SUBJECTALTNAME_CRITICAL 22 +#define OSSL_CMP_OPT_POLICIES_CRITICAL 23 +#define OSSL_CMP_OPT_POPO_METHOD 24 +#define OSSL_CMP_OPT_IMPLICIT_CONFIRM 25 +#define OSSL_CMP_OPT_DISABLE_CONFIRM 26 +#define OSSL_CMP_OPT_REVOCATION_REASON 27 +/* CMP protection options: */ +#define OSSL_CMP_OPT_UNPROTECTED_SEND 30 +#define OSSL_CMP_OPT_UNPROTECTED_ERRORS 31 +#define OSSL_CMP_OPT_OWF_ALGNID 32 +#define OSSL_CMP_OPT_MAC_ALGNID 33 +#define OSSL_CMP_OPT_DIGEST_ALGNID 34 +#define OSSL_CMP_OPT_IGNORE_KEYUSAGE 35 +#define OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR 36 +#define OSSL_CMP_OPT_NO_CACHE_EXTRACERTS 37 +int OSSL_CMP_CTX_set_option(OSSL_CMP_CTX *ctx, int opt, int val); +int OSSL_CMP_CTX_get_option(const OSSL_CMP_CTX *ctx, int opt); +/* CMP-specific callback for logging and outputting the error queue: */ +int OSSL_CMP_CTX_set_log_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_log_cb_t cb); +#define OSSL_CMP_CTX_set_log_verbosity(ctx, level) \ + OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_LOG_VERBOSITY, level) +void OSSL_CMP_CTX_print_errors(const OSSL_CMP_CTX *ctx); +/* message transfer: */ +int OSSL_CMP_CTX_set1_serverPath(OSSL_CMP_CTX *ctx, const char *path); +int OSSL_CMP_CTX_set1_server(OSSL_CMP_CTX *ctx, const char *address); +int OSSL_CMP_CTX_set_serverPort(OSSL_CMP_CTX *ctx, int port); +int OSSL_CMP_CTX_set1_proxy(OSSL_CMP_CTX *ctx, const char *name); +int OSSL_CMP_CTX_set1_no_proxy(OSSL_CMP_CTX *ctx, const char *names); +#ifndef OPENSSL_NO_HTTP +int OSSL_CMP_CTX_set_http_cb(OSSL_CMP_CTX *ctx, OSSL_HTTP_bio_cb_t cb); +int OSSL_CMP_CTX_set_http_cb_arg(OSSL_CMP_CTX *ctx, void *arg); +void *OSSL_CMP_CTX_get_http_cb_arg(const OSSL_CMP_CTX *ctx); +#endif +typedef OSSL_CMP_MSG *(*OSSL_CMP_transfer_cb_t)(OSSL_CMP_CTX *ctx, + const OSSL_CMP_MSG *req); +int OSSL_CMP_CTX_set_transfer_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_transfer_cb_t cb); +int OSSL_CMP_CTX_set_transfer_cb_arg(OSSL_CMP_CTX *ctx, void *arg); +void *OSSL_CMP_CTX_get_transfer_cb_arg(const OSSL_CMP_CTX *ctx); +/* server authentication: */ +int OSSL_CMP_CTX_set1_srvCert(OSSL_CMP_CTX *ctx, X509 *cert); +int OSSL_CMP_CTX_set1_expected_sender(OSSL_CMP_CTX *ctx, const X509_NAME *name); +int OSSL_CMP_CTX_set0_trustedStore(OSSL_CMP_CTX *ctx, X509_STORE *store); +#define OSSL_CMP_CTX_set0_trusted OSSL_CMP_CTX_set0_trustedStore +X509_STORE *OSSL_CMP_CTX_get0_trustedStore(const OSSL_CMP_CTX *ctx); +#define OSSL_CMP_CTX_get0_trusted OSSL_CMP_CTX_get0_trustedStore +int OSSL_CMP_CTX_set1_untrusted(OSSL_CMP_CTX *ctx, STACK_OF(X509) *certs); +STACK_OF(X509) *OSSL_CMP_CTX_get0_untrusted(const OSSL_CMP_CTX *ctx); +/* client authentication: */ +int OSSL_CMP_CTX_set1_cert(OSSL_CMP_CTX *ctx, X509 *cert); +int OSSL_CMP_CTX_build_cert_chain(OSSL_CMP_CTX *ctx, X509_STORE *own_trusted, + STACK_OF(X509) *candidates); +int OSSL_CMP_CTX_set1_pkey(OSSL_CMP_CTX *ctx, EVP_PKEY *pkey); +int OSSL_CMP_CTX_set1_referenceValue(OSSL_CMP_CTX *ctx, + const unsigned char *ref, int len); +int OSSL_CMP_CTX_set1_secretValue(OSSL_CMP_CTX *ctx, + const unsigned char *sec, int len); +/* CMP message header and extra certificates: */ +int OSSL_CMP_CTX_set1_recipient(OSSL_CMP_CTX *ctx, const X509_NAME *name); +int OSSL_CMP_CTX_push0_geninfo_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav); +int OSSL_CMP_CTX_reset_geninfo_ITAVs(OSSL_CMP_CTX *ctx); +STACK_OF(OSSL_CMP_ITAV) +*OSSL_CMP_CTX_get0_geninfo_ITAVs(const OSSL_CMP_CTX *ctx); +int OSSL_CMP_CTX_set1_extraCertsOut(OSSL_CMP_CTX *ctx, + STACK_OF(X509) *extraCertsOut); +/* certificate template: */ +int OSSL_CMP_CTX_set0_newPkey(OSSL_CMP_CTX *ctx, int priv, EVP_PKEY *pkey); +EVP_PKEY *OSSL_CMP_CTX_get0_newPkey(const OSSL_CMP_CTX *ctx, int priv); +int OSSL_CMP_CTX_set1_issuer(OSSL_CMP_CTX *ctx, const X509_NAME *name); +int OSSL_CMP_CTX_set1_serialNumber(OSSL_CMP_CTX *ctx, const ASN1_INTEGER *sn); +int OSSL_CMP_CTX_set1_subjectName(OSSL_CMP_CTX *ctx, const X509_NAME *name); +int OSSL_CMP_CTX_push1_subjectAltName(OSSL_CMP_CTX *ctx, + const GENERAL_NAME *name); +int OSSL_CMP_CTX_set0_reqExtensions(OSSL_CMP_CTX *ctx, X509_EXTENSIONS *exts); +int OSSL_CMP_CTX_reqExtensions_have_SAN(OSSL_CMP_CTX *ctx); +int OSSL_CMP_CTX_push0_policy(OSSL_CMP_CTX *ctx, POLICYINFO *pinfo); +int OSSL_CMP_CTX_set1_oldCert(OSSL_CMP_CTX *ctx, X509 *cert); +int OSSL_CMP_CTX_set1_p10CSR(OSSL_CMP_CTX *ctx, const X509_REQ *csr); +/* misc body contents: */ +int OSSL_CMP_CTX_push0_genm_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav); +/* certificate confirmation: */ +typedef int (*OSSL_CMP_certConf_cb_t)(OSSL_CMP_CTX *ctx, X509 *cert, + int fail_info, const char **txt); +int OSSL_CMP_certConf_cb(OSSL_CMP_CTX *ctx, X509 *cert, int fail_info, + const char **text); +int OSSL_CMP_CTX_set_certConf_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_certConf_cb_t cb); +int OSSL_CMP_CTX_set_certConf_cb_arg(OSSL_CMP_CTX *ctx, void *arg); +void *OSSL_CMP_CTX_get_certConf_cb_arg(const OSSL_CMP_CTX *ctx); +/* result fetching: */ +int OSSL_CMP_CTX_get_status(const OSSL_CMP_CTX *ctx); +OSSL_CMP_PKIFREETEXT *OSSL_CMP_CTX_get0_statusString(const OSSL_CMP_CTX *ctx); +int OSSL_CMP_CTX_get_failInfoCode(const OSSL_CMP_CTX *ctx); +#define OSSL_CMP_PKISI_BUFLEN 1024 +X509 *OSSL_CMP_CTX_get0_validatedSrvCert(const OSSL_CMP_CTX *ctx); +X509 *OSSL_CMP_CTX_get0_newCert(const OSSL_CMP_CTX *ctx); +STACK_OF(X509) *OSSL_CMP_CTX_get1_newChain(const OSSL_CMP_CTX *ctx); +STACK_OF(X509) *OSSL_CMP_CTX_get1_caPubs(const OSSL_CMP_CTX *ctx); +STACK_OF(X509) *OSSL_CMP_CTX_get1_extraCertsIn(const OSSL_CMP_CTX *ctx); +int OSSL_CMP_CTX_set1_transactionID(OSSL_CMP_CTX *ctx, + const ASN1_OCTET_STRING *id); +int OSSL_CMP_CTX_set1_senderNonce(OSSL_CMP_CTX *ctx, + const ASN1_OCTET_STRING *nonce); + +/* from cmp_status.c */ +char *OSSL_CMP_CTX_snprint_PKIStatus(const OSSL_CMP_CTX *ctx, char *buf, + size_t bufsize); +char *OSSL_CMP_snprint_PKIStatusInfo(const OSSL_CMP_PKISI *statusInfo, + char *buf, size_t bufsize); +OSSL_CMP_PKISI * +OSSL_CMP_STATUSINFO_new(int status, int fail_info, const char *text); + +/* from cmp_hdr.c */ +ASN1_OCTET_STRING *OSSL_CMP_HDR_get0_transactionID(const OSSL_CMP_PKIHEADER *hdr); +ASN1_OCTET_STRING *OSSL_CMP_HDR_get0_recipNonce(const OSSL_CMP_PKIHEADER *hdr); +STACK_OF(OSSL_CMP_ITAV) +*OSSL_CMP_HDR_get0_geninfo_ITAVs(const OSSL_CMP_PKIHEADER *hdr); + +/* from cmp_msg.c */ +OSSL_CMP_PKIHEADER *OSSL_CMP_MSG_get0_header(const OSSL_CMP_MSG *msg); +int OSSL_CMP_MSG_get_bodytype(const OSSL_CMP_MSG *msg); +X509_PUBKEY *OSSL_CMP_MSG_get0_certreq_publickey(const OSSL_CMP_MSG *msg); +int OSSL_CMP_MSG_update_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg); +int OSSL_CMP_MSG_update_recipNonce(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg); +OSSL_CRMF_MSG *OSSL_CMP_CTX_setup_CRM(OSSL_CMP_CTX *ctx, int for_KUR, int rid); +OSSL_CMP_MSG *OSSL_CMP_MSG_read(const char *file, OSSL_LIB_CTX *libctx, + const char *propq); +int OSSL_CMP_MSG_write(const char *file, const OSSL_CMP_MSG *msg); +OSSL_CMP_MSG *d2i_OSSL_CMP_MSG_bio(BIO *bio, OSSL_CMP_MSG **msg); +int i2d_OSSL_CMP_MSG_bio(BIO *bio, const OSSL_CMP_MSG *msg); + +/* from cmp_vfy.c */ +int OSSL_CMP_validate_msg(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg); +int OSSL_CMP_validate_cert_path(const OSSL_CMP_CTX *ctx, + X509_STORE *trusted_store, X509 *cert); + +/* from cmp_http.c */ +#ifndef OPENSSL_NO_HTTP +OSSL_CMP_MSG *OSSL_CMP_MSG_http_perform(OSSL_CMP_CTX *ctx, + const OSSL_CMP_MSG *req); +#endif + +/* from cmp_server.c */ +typedef struct ossl_cmp_srv_ctx_st OSSL_CMP_SRV_CTX; +OSSL_CMP_MSG *OSSL_CMP_SRV_process_request(OSSL_CMP_SRV_CTX *srv_ctx, + const OSSL_CMP_MSG *req); +OSSL_CMP_MSG *OSSL_CMP_CTX_server_perform(OSSL_CMP_CTX *client_ctx, + const OSSL_CMP_MSG *req); +OSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OSSL_LIB_CTX *libctx, const char *propq); +void OSSL_CMP_SRV_CTX_free(OSSL_CMP_SRV_CTX *srv_ctx); +typedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_cert_request_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx, const OSSL_CMP_MSG *req, int certReqId, + const OSSL_CRMF_MSG *crm, const X509_REQ *p10cr, + X509 **certOut, STACK_OF(X509) **chainOut, STACK_OF(X509) **caPubs); +typedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_rr_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx, + const OSSL_CMP_MSG *req, + const X509_NAME *issuer, + const ASN1_INTEGER *serial); +typedef int (*OSSL_CMP_SRV_genm_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx, + const OSSL_CMP_MSG *req, + const STACK_OF(OSSL_CMP_ITAV) *in, + STACK_OF(OSSL_CMP_ITAV) **out); +typedef void (*OSSL_CMP_SRV_error_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx, + const OSSL_CMP_MSG *req, + const OSSL_CMP_PKISI *statusInfo, + const ASN1_INTEGER *errorCode, + const OSSL_CMP_PKIFREETEXT *errDetails); +typedef int (*OSSL_CMP_SRV_certConf_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx, + const OSSL_CMP_MSG *req, + int certReqId, + const ASN1_OCTET_STRING *certHash, + const OSSL_CMP_PKISI *si); +typedef int (*OSSL_CMP_SRV_pollReq_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx, + const OSSL_CMP_MSG *req, int certReqId, + OSSL_CMP_MSG **certReq, + int64_t *check_after); +int OSSL_CMP_SRV_CTX_init(OSSL_CMP_SRV_CTX *srv_ctx, void *custom_ctx, + OSSL_CMP_SRV_cert_request_cb_t process_cert_request, + OSSL_CMP_SRV_rr_cb_t process_rr, + OSSL_CMP_SRV_genm_cb_t process_genm, + OSSL_CMP_SRV_error_cb_t process_error, + OSSL_CMP_SRV_certConf_cb_t process_certConf, + OSSL_CMP_SRV_pollReq_cb_t process_pollReq); +typedef int (*OSSL_CMP_SRV_delayed_delivery_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx, + const OSSL_CMP_MSG *req); +typedef int (*OSSL_CMP_SRV_clean_transaction_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx, + const ASN1_OCTET_STRING *id); +int OSSL_CMP_SRV_CTX_init_trans(OSSL_CMP_SRV_CTX *srv_ctx, + OSSL_CMP_SRV_delayed_delivery_cb_t delay, + OSSL_CMP_SRV_clean_transaction_cb_t clean); +OSSL_CMP_CTX *OSSL_CMP_SRV_CTX_get0_cmp_ctx(const OSSL_CMP_SRV_CTX *srv_ctx); +void *OSSL_CMP_SRV_CTX_get0_custom_ctx(const OSSL_CMP_SRV_CTX *srv_ctx); +int OSSL_CMP_SRV_CTX_set_send_unprotected_errors(OSSL_CMP_SRV_CTX *srv_ctx, + int val); +int OSSL_CMP_SRV_CTX_set_accept_unprotected(OSSL_CMP_SRV_CTX *srv_ctx, int val); +int OSSL_CMP_SRV_CTX_set_accept_raverified(OSSL_CMP_SRV_CTX *srv_ctx, int val); +int OSSL_CMP_SRV_CTX_set_grant_implicit_confirm(OSSL_CMP_SRV_CTX *srv_ctx, + int val); + +/* from cmp_client.c */ +X509 *OSSL_CMP_exec_certreq(OSSL_CMP_CTX *ctx, int req_type, + const OSSL_CRMF_MSG *crm); +#define OSSL_CMP_IR 0 +#define OSSL_CMP_CR 2 +#define OSSL_CMP_P10CR 4 +#define OSSL_CMP_KUR 7 +#define OSSL_CMP_GENM 21 +#define OSSL_CMP_ERROR 23 +#define OSSL_CMP_exec_IR_ses(ctx) \ + OSSL_CMP_exec_certreq(ctx, OSSL_CMP_IR, NULL) +#define OSSL_CMP_exec_CR_ses(ctx) \ + OSSL_CMP_exec_certreq(ctx, OSSL_CMP_CR, NULL) +#define OSSL_CMP_exec_P10CR_ses(ctx) \ + OSSL_CMP_exec_certreq(ctx, OSSL_CMP_P10CR, NULL) +#define OSSL_CMP_exec_KUR_ses(ctx) \ + OSSL_CMP_exec_certreq(ctx, OSSL_CMP_KUR, NULL) +int OSSL_CMP_try_certreq(OSSL_CMP_CTX *ctx, int req_type, + const OSSL_CRMF_MSG *crm, int *checkAfter); +int OSSL_CMP_exec_RR_ses(OSSL_CMP_CTX *ctx); +STACK_OF(OSSL_CMP_ITAV) *OSSL_CMP_exec_GENM_ses(OSSL_CMP_CTX *ctx); + +/* from cmp_genm.c */ +int OSSL_CMP_get1_caCerts(OSSL_CMP_CTX *ctx, STACK_OF(X509) **out); +int OSSL_CMP_get1_rootCaKeyUpdate(OSSL_CMP_CTX *ctx, + const X509 *oldWithOld, X509 **newWithNew, + X509 **newWithOld, X509 **oldWithNew); +int OSSL_CMP_get1_crlUpdate(OSSL_CMP_CTX *ctx, const X509 *crlcert, + const X509_CRL *last_crl, + X509_CRL **crl); +int OSSL_CMP_get1_certReqTemplate(OSSL_CMP_CTX *ctx, + OSSL_CRMF_CERTTEMPLATE **certTemplate, + OSSL_CMP_ATAVS **keySpec); + +#ifdef __cplusplus +} +#endif +#endif /* !defined(OPENSSL_NO_CMP) */ +#endif /* !defined(OPENSSL_CMP_H) */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cmp_util.h b/VCMP-LUA/modules/postgresql/include/openssl/cmp_util.h new file mode 100644 index 0000000..a0ee20f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cmp_util.h @@ -0,0 +1,56 @@ +/* + * Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright Nokia 2007-2019 + * Copyright Siemens AG 2015-2019 + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CMP_UTIL_H +#define OPENSSL_CMP_UTIL_H +#pragma once + +#include +#ifndef OPENSSL_NO_CMP + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int OSSL_CMP_log_open(void); +void OSSL_CMP_log_close(void); +#define OSSL_CMP_LOG_PREFIX "CMP " + +/* + * generalized logging/error callback mirroring the severity levels of syslog.h + */ +typedef int OSSL_CMP_severity; +#define OSSL_CMP_LOG_EMERG 0 +#define OSSL_CMP_LOG_ALERT 1 +#define OSSL_CMP_LOG_CRIT 2 +#define OSSL_CMP_LOG_ERR 3 +#define OSSL_CMP_LOG_WARNING 4 +#define OSSL_CMP_LOG_NOTICE 5 +#define OSSL_CMP_LOG_INFO 6 +#define OSSL_CMP_LOG_DEBUG 7 +#define OSSL_CMP_LOG_TRACE 8 +#define OSSL_CMP_LOG_MAX OSSL_CMP_LOG_TRACE +typedef int (*OSSL_CMP_log_cb_t)(const char *func, const char *file, int line, + OSSL_CMP_severity level, const char *msg); + +int OSSL_CMP_print_to_bio(BIO *bio, const char *component, const char *file, + int line, OSSL_CMP_severity level, const char *msg); +/* use of the logging callback for outputting error queue */ +void OSSL_CMP_print_errors_cb(OSSL_CMP_log_cb_t log_fn); + +#ifdef __cplusplus +} +#endif +#endif /* !defined(OPENSSL_NO_CMP) */ +#endif /* !defined(OPENSSL_CMP_UTIL_H) */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cmperr.h b/VCMP-LUA/modules/postgresql/include/openssl/cmperr.h new file mode 100644 index 0000000..b07ac6d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cmperr.h @@ -0,0 +1,132 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CMPERR_H +#define OPENSSL_CMPERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_CMP + +/* + * CMP reason codes. + */ +#define CMP_R_ALGORITHM_NOT_SUPPORTED 139 +#define CMP_R_BAD_CHECKAFTER_IN_POLLREP 167 +#define CMP_R_BAD_REQUEST_ID 108 +#define CMP_R_CERTHASH_UNMATCHED 156 +#define CMP_R_CERTID_NOT_FOUND 109 +#define CMP_R_CERTIFICATE_NOT_ACCEPTED 169 +#define CMP_R_CERTIFICATE_NOT_FOUND 112 +#define CMP_R_CERTREQMSG_NOT_FOUND 157 +#define CMP_R_CERTRESPONSE_NOT_FOUND 113 +#define CMP_R_CERT_AND_KEY_DO_NOT_MATCH 114 +#define CMP_R_CHECKAFTER_OUT_OF_RANGE 181 +#define CMP_R_ENCOUNTERED_KEYUPDATEWARNING 176 +#define CMP_R_ENCOUNTERED_WAITING 162 +#define CMP_R_ERROR_CALCULATING_PROTECTION 115 +#define CMP_R_ERROR_CREATING_CERTCONF 116 +#define CMP_R_ERROR_CREATING_CERTREP 117 +#define CMP_R_ERROR_CREATING_CERTREQ 163 +#define CMP_R_ERROR_CREATING_ERROR 118 +#define CMP_R_ERROR_CREATING_GENM 119 +#define CMP_R_ERROR_CREATING_GENP 120 +#define CMP_R_ERROR_CREATING_PKICONF 122 +#define CMP_R_ERROR_CREATING_POLLREP 123 +#define CMP_R_ERROR_CREATING_POLLREQ 124 +#define CMP_R_ERROR_CREATING_RP 125 +#define CMP_R_ERROR_CREATING_RR 126 +#define CMP_R_ERROR_PARSING_PKISTATUS 107 +#define CMP_R_ERROR_PROCESSING_MESSAGE 158 +#define CMP_R_ERROR_PROTECTING_MESSAGE 127 +#define CMP_R_ERROR_SETTING_CERTHASH 128 +#define CMP_R_ERROR_UNEXPECTED_CERTCONF 160 +#define CMP_R_ERROR_VALIDATING_PROTECTION 140 +#define CMP_R_ERROR_VALIDATING_SIGNATURE 171 +#define CMP_R_EXPECTED_POLLREQ 104 +#define CMP_R_FAILED_BUILDING_OWN_CHAIN 164 +#define CMP_R_FAILED_EXTRACTING_CENTRAL_GEN_KEY 203 +#define CMP_R_FAILED_EXTRACTING_PUBKEY 141 +#define CMP_R_FAILURE_OBTAINING_RANDOM 110 +#define CMP_R_FAIL_INFO_OUT_OF_RANGE 129 +#define CMP_R_GENERATE_CERTREQTEMPLATE 197 +#define CMP_R_GENERATE_CRLSTATUS 198 +#define CMP_R_GETTING_GENP 192 +#define CMP_R_GET_ITAV 199 +#define CMP_R_INVALID_ARGS 100 +#define CMP_R_INVALID_GENP 193 +#define CMP_R_INVALID_KEYSPEC 202 +#define CMP_R_INVALID_OPTION 174 +#define CMP_R_INVALID_ROOTCAKEYUPDATE 195 +#define CMP_R_MISSING_CENTRAL_GEN_KEY 204 +#define CMP_R_MISSING_CERTID 165 +#define CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION 130 +#define CMP_R_MISSING_KEY_USAGE_DIGITALSIGNATURE 142 +#define CMP_R_MISSING_P10CSR 121 +#define CMP_R_MISSING_PBM_SECRET 166 +#define CMP_R_MISSING_PRIVATE_KEY 131 +#define CMP_R_MISSING_PRIVATE_KEY_FOR_POPO 190 +#define CMP_R_MISSING_PROTECTION 143 +#define CMP_R_MISSING_PUBLIC_KEY 183 +#define CMP_R_MISSING_REFERENCE_CERT 168 +#define CMP_R_MISSING_SECRET 178 +#define CMP_R_MISSING_SENDER_IDENTIFICATION 111 +#define CMP_R_MISSING_TRUST_ANCHOR 179 +#define CMP_R_MISSING_TRUST_STORE 144 +#define CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED 161 +#define CMP_R_MULTIPLE_RESPONSES_NOT_SUPPORTED 170 +#define CMP_R_MULTIPLE_SAN_SOURCES 102 +#define CMP_R_NO_STDIO 194 +#define CMP_R_NO_SUITABLE_SENDER_CERT 145 +#define CMP_R_NULL_ARGUMENT 103 +#define CMP_R_PKIBODY_ERROR 146 +#define CMP_R_PKISTATUSINFO_NOT_FOUND 132 +#define CMP_R_POLLING_FAILED 172 +#define CMP_R_POTENTIALLY_INVALID_CERTIFICATE 147 +#define CMP_R_RECEIVED_ERROR 180 +#define CMP_R_RECIPNONCE_UNMATCHED 148 +#define CMP_R_REQUEST_NOT_ACCEPTED 149 +#define CMP_R_REQUEST_REJECTED_BY_SERVER 182 +#define CMP_R_SENDER_GENERALNAME_TYPE_NOT_SUPPORTED 150 +#define CMP_R_SRVCERT_DOES_NOT_VALIDATE_MSG 151 +#define CMP_R_TOTAL_TIMEOUT 184 +#define CMP_R_TRANSACTIONID_UNMATCHED 152 +#define CMP_R_TRANSFER_ERROR 159 +#define CMP_R_UNCLEAN_CTX 191 +#define CMP_R_UNEXPECTED_CENTRAL_GEN_KEY 205 +#define CMP_R_UNEXPECTED_CERTPROFILE 196 +#define CMP_R_UNEXPECTED_CRLSTATUSLIST 201 +#define CMP_R_UNEXPECTED_PKIBODY 133 +#define CMP_R_UNEXPECTED_PKISTATUS 185 +#define CMP_R_UNEXPECTED_POLLREQ 105 +#define CMP_R_UNEXPECTED_PVNO 153 +#define CMP_R_UNEXPECTED_SENDER 106 +#define CMP_R_UNKNOWN_ALGORITHM_ID 134 +#define CMP_R_UNKNOWN_CERT_TYPE 135 +#define CMP_R_UNKNOWN_CRL_ISSUER 200 +#define CMP_R_UNKNOWN_PKISTATUS 186 +#define CMP_R_UNSUPPORTED_ALGORITHM 136 +#define CMP_R_UNSUPPORTED_KEY_TYPE 137 +#define CMP_R_UNSUPPORTED_PKIBODY 101 +#define CMP_R_UNSUPPORTED_PROTECTION_ALG_DHBASEDMAC 154 +#define CMP_R_VALUE_TOO_LARGE 175 +#define CMP_R_VALUE_TOO_SMALL 177 +#define CMP_R_WRONG_ALGORITHM_OID 138 +#define CMP_R_WRONG_CERTID 189 +#define CMP_R_WRONG_CERTID_IN_RP 187 +#define CMP_R_WRONG_PBM_VALUE 155 +#define CMP_R_WRONG_RP_COMPONENT_COUNT 188 +#define CMP_R_WRONG_SERIAL_IN_RP 173 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cms.h b/VCMP-LUA/modules/postgresql/include/openssl/cms.h new file mode 100644 index 0000000..fd64e5d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cms.h @@ -0,0 +1,524 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\cms.h.in + * + * Copyright 2008-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_CMS_H +#define OPENSSL_CMS_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_CMS_H +#endif + +#include + +#ifndef OPENSSL_NO_CMS +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CMS_EnvelopedData_st CMS_EnvelopedData; +typedef struct CMS_ContentInfo_st CMS_ContentInfo; +typedef struct CMS_SignerInfo_st CMS_SignerInfo; +typedef struct CMS_SignedData_st CMS_SignedData; +typedef struct CMS_CertificateChoices CMS_CertificateChoices; +typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; +typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; +typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; +typedef struct CMS_Receipt_st CMS_Receipt; +typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; +typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(CMS_SignerInfo, CMS_SignerInfo, CMS_SignerInfo) +#define sk_CMS_SignerInfo_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_SignerInfo_sk_type(sk)) +#define sk_CMS_SignerInfo_value(sk, idx) ((CMS_SignerInfo *)OPENSSL_sk_value(ossl_check_const_CMS_SignerInfo_sk_type(sk), (idx))) +#define sk_CMS_SignerInfo_new(cmp) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new(ossl_check_CMS_SignerInfo_compfunc_type(cmp))) +#define sk_CMS_SignerInfo_new_null() ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new_null()) +#define sk_CMS_SignerInfo_new_reserve(cmp, n) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new_reserve(ossl_check_CMS_SignerInfo_compfunc_type(cmp), (n))) +#define sk_CMS_SignerInfo_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_SignerInfo_sk_type(sk), (n)) +#define sk_CMS_SignerInfo_free(sk) OPENSSL_sk_free(ossl_check_CMS_SignerInfo_sk_type(sk)) +#define sk_CMS_SignerInfo_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_SignerInfo_sk_type(sk)) +#define sk_CMS_SignerInfo_delete(sk, i) ((CMS_SignerInfo *)OPENSSL_sk_delete(ossl_check_CMS_SignerInfo_sk_type(sk), (i))) +#define sk_CMS_SignerInfo_delete_ptr(sk, ptr) ((CMS_SignerInfo *)OPENSSL_sk_delete_ptr(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))) +#define sk_CMS_SignerInfo_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr)) +#define sk_CMS_SignerInfo_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr)) +#define sk_CMS_SignerInfo_pop(sk) ((CMS_SignerInfo *)OPENSSL_sk_pop(ossl_check_CMS_SignerInfo_sk_type(sk))) +#define sk_CMS_SignerInfo_shift(sk) ((CMS_SignerInfo *)OPENSSL_sk_shift(ossl_check_CMS_SignerInfo_sk_type(sk))) +#define sk_CMS_SignerInfo_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_freefunc_type(freefunc)) +#define sk_CMS_SignerInfo_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr), (idx)) +#define sk_CMS_SignerInfo_set(sk, idx, ptr) ((CMS_SignerInfo *)OPENSSL_sk_set(ossl_check_CMS_SignerInfo_sk_type(sk), (idx), ossl_check_CMS_SignerInfo_type(ptr))) +#define sk_CMS_SignerInfo_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr)) +#define sk_CMS_SignerInfo_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr)) +#define sk_CMS_SignerInfo_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr), pnum) +#define sk_CMS_SignerInfo_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_SignerInfo_sk_type(sk)) +#define sk_CMS_SignerInfo_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_SignerInfo_sk_type(sk)) +#define sk_CMS_SignerInfo_dup(sk) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_dup(ossl_check_const_CMS_SignerInfo_sk_type(sk))) +#define sk_CMS_SignerInfo_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_copyfunc_type(copyfunc), ossl_check_CMS_SignerInfo_freefunc_type(freefunc))) +#define sk_CMS_SignerInfo_set_cmp_func(sk, cmp) ((sk_CMS_SignerInfo_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(CMS_RecipientEncryptedKey, CMS_RecipientEncryptedKey, CMS_RecipientEncryptedKey) +#define sk_CMS_RecipientEncryptedKey_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk)) +#define sk_CMS_RecipientEncryptedKey_value(sk, idx) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_value(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk), (idx))) +#define sk_CMS_RecipientEncryptedKey_new(cmp) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new(ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp))) +#define sk_CMS_RecipientEncryptedKey_new_null() ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new_null()) +#define sk_CMS_RecipientEncryptedKey_new_reserve(cmp, n) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp), (n))) +#define sk_CMS_RecipientEncryptedKey_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (n)) +#define sk_CMS_RecipientEncryptedKey_free(sk) OPENSSL_sk_free(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk)) +#define sk_CMS_RecipientEncryptedKey_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk)) +#define sk_CMS_RecipientEncryptedKey_delete(sk, i) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_delete(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (i))) +#define sk_CMS_RecipientEncryptedKey_delete_ptr(sk, ptr) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))) +#define sk_CMS_RecipientEncryptedKey_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr)) +#define sk_CMS_RecipientEncryptedKey_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr)) +#define sk_CMS_RecipientEncryptedKey_pop(sk) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_pop(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))) +#define sk_CMS_RecipientEncryptedKey_shift(sk) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_shift(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))) +#define sk_CMS_RecipientEncryptedKey_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_freefunc_type(freefunc)) +#define sk_CMS_RecipientEncryptedKey_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr), (idx)) +#define sk_CMS_RecipientEncryptedKey_set(sk, idx, ptr) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_set(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (idx), ossl_check_CMS_RecipientEncryptedKey_type(ptr))) +#define sk_CMS_RecipientEncryptedKey_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr)) +#define sk_CMS_RecipientEncryptedKey_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr)) +#define sk_CMS_RecipientEncryptedKey_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr), pnum) +#define sk_CMS_RecipientEncryptedKey_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk)) +#define sk_CMS_RecipientEncryptedKey_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk)) +#define sk_CMS_RecipientEncryptedKey_dup(sk) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_dup(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk))) +#define sk_CMS_RecipientEncryptedKey_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_copyfunc_type(copyfunc), ossl_check_CMS_RecipientEncryptedKey_freefunc_type(freefunc))) +#define sk_CMS_RecipientEncryptedKey_set_cmp_func(sk, cmp) ((sk_CMS_RecipientEncryptedKey_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(CMS_RecipientInfo, CMS_RecipientInfo, CMS_RecipientInfo) +#define sk_CMS_RecipientInfo_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RecipientInfo_sk_type(sk)) +#define sk_CMS_RecipientInfo_value(sk, idx) ((CMS_RecipientInfo *)OPENSSL_sk_value(ossl_check_const_CMS_RecipientInfo_sk_type(sk), (idx))) +#define sk_CMS_RecipientInfo_new(cmp) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new(ossl_check_CMS_RecipientInfo_compfunc_type(cmp))) +#define sk_CMS_RecipientInfo_new_null() ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new_null()) +#define sk_CMS_RecipientInfo_new_reserve(cmp, n) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RecipientInfo_compfunc_type(cmp), (n))) +#define sk_CMS_RecipientInfo_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RecipientInfo_sk_type(sk), (n)) +#define sk_CMS_RecipientInfo_free(sk) OPENSSL_sk_free(ossl_check_CMS_RecipientInfo_sk_type(sk)) +#define sk_CMS_RecipientInfo_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RecipientInfo_sk_type(sk)) +#define sk_CMS_RecipientInfo_delete(sk, i) ((CMS_RecipientInfo *)OPENSSL_sk_delete(ossl_check_CMS_RecipientInfo_sk_type(sk), (i))) +#define sk_CMS_RecipientInfo_delete_ptr(sk, ptr) ((CMS_RecipientInfo *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))) +#define sk_CMS_RecipientInfo_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr)) +#define sk_CMS_RecipientInfo_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr)) +#define sk_CMS_RecipientInfo_pop(sk) ((CMS_RecipientInfo *)OPENSSL_sk_pop(ossl_check_CMS_RecipientInfo_sk_type(sk))) +#define sk_CMS_RecipientInfo_shift(sk) ((CMS_RecipientInfo *)OPENSSL_sk_shift(ossl_check_CMS_RecipientInfo_sk_type(sk))) +#define sk_CMS_RecipientInfo_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_freefunc_type(freefunc)) +#define sk_CMS_RecipientInfo_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr), (idx)) +#define sk_CMS_RecipientInfo_set(sk, idx, ptr) ((CMS_RecipientInfo *)OPENSSL_sk_set(ossl_check_CMS_RecipientInfo_sk_type(sk), (idx), ossl_check_CMS_RecipientInfo_type(ptr))) +#define sk_CMS_RecipientInfo_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr)) +#define sk_CMS_RecipientInfo_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr)) +#define sk_CMS_RecipientInfo_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr), pnum) +#define sk_CMS_RecipientInfo_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RecipientInfo_sk_type(sk)) +#define sk_CMS_RecipientInfo_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RecipientInfo_sk_type(sk)) +#define sk_CMS_RecipientInfo_dup(sk) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_dup(ossl_check_const_CMS_RecipientInfo_sk_type(sk))) +#define sk_CMS_RecipientInfo_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_copyfunc_type(copyfunc), ossl_check_CMS_RecipientInfo_freefunc_type(freefunc))) +#define sk_CMS_RecipientInfo_set_cmp_func(sk, cmp) ((sk_CMS_RecipientInfo_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(CMS_RevocationInfoChoice, CMS_RevocationInfoChoice, CMS_RevocationInfoChoice) +#define sk_CMS_RevocationInfoChoice_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk)) +#define sk_CMS_RevocationInfoChoice_value(sk, idx) ((CMS_RevocationInfoChoice *)OPENSSL_sk_value(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk), (idx))) +#define sk_CMS_RevocationInfoChoice_new(cmp) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new(ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp))) +#define sk_CMS_RevocationInfoChoice_new_null() ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new_null()) +#define sk_CMS_RevocationInfoChoice_new_reserve(cmp, n) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp), (n))) +#define sk_CMS_RevocationInfoChoice_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (n)) +#define sk_CMS_RevocationInfoChoice_free(sk) OPENSSL_sk_free(ossl_check_CMS_RevocationInfoChoice_sk_type(sk)) +#define sk_CMS_RevocationInfoChoice_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RevocationInfoChoice_sk_type(sk)) +#define sk_CMS_RevocationInfoChoice_delete(sk, i) ((CMS_RevocationInfoChoice *)OPENSSL_sk_delete(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (i))) +#define sk_CMS_RevocationInfoChoice_delete_ptr(sk, ptr) ((CMS_RevocationInfoChoice *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))) +#define sk_CMS_RevocationInfoChoice_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr)) +#define sk_CMS_RevocationInfoChoice_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr)) +#define sk_CMS_RevocationInfoChoice_pop(sk) ((CMS_RevocationInfoChoice *)OPENSSL_sk_pop(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))) +#define sk_CMS_RevocationInfoChoice_shift(sk) ((CMS_RevocationInfoChoice *)OPENSSL_sk_shift(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))) +#define sk_CMS_RevocationInfoChoice_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_freefunc_type(freefunc)) +#define sk_CMS_RevocationInfoChoice_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr), (idx)) +#define sk_CMS_RevocationInfoChoice_set(sk, idx, ptr) ((CMS_RevocationInfoChoice *)OPENSSL_sk_set(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (idx), ossl_check_CMS_RevocationInfoChoice_type(ptr))) +#define sk_CMS_RevocationInfoChoice_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr)) +#define sk_CMS_RevocationInfoChoice_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr)) +#define sk_CMS_RevocationInfoChoice_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr), pnum) +#define sk_CMS_RevocationInfoChoice_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RevocationInfoChoice_sk_type(sk)) +#define sk_CMS_RevocationInfoChoice_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk)) +#define sk_CMS_RevocationInfoChoice_dup(sk) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_dup(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk))) +#define sk_CMS_RevocationInfoChoice_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_copyfunc_type(copyfunc), ossl_check_CMS_RevocationInfoChoice_freefunc_type(freefunc))) +#define sk_CMS_RevocationInfoChoice_set_cmp_func(sk, cmp) ((sk_CMS_RevocationInfoChoice_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp))) + +/* clang-format on */ + +DECLARE_ASN1_ITEM(CMS_EnvelopedData) +DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_SignedData) +DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) +DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) +DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) + +DECLARE_ASN1_DUP_FUNCTION(CMS_EnvelopedData) + +CMS_ContentInfo *CMS_ContentInfo_new_ex(OSSL_LIB_CTX *libctx, const char *propq); + +#define CMS_SIGNERINFO_ISSUER_SERIAL 0 +#define CMS_SIGNERINFO_KEYIDENTIFIER 1 + +#define CMS_RECIPINFO_NONE -1 +#define CMS_RECIPINFO_TRANS 0 +#define CMS_RECIPINFO_AGREE 1 +#define CMS_RECIPINFO_KEK 2 +#define CMS_RECIPINFO_PASS 3 +#define CMS_RECIPINFO_OTHER 4 +#define CMS_RECIPINFO_KEM 5 + +/* S/MIME related flags */ + +#define CMS_TEXT 0x1 +#define CMS_NOCERTS 0x2 +#define CMS_NO_CONTENT_VERIFY 0x4 +#define CMS_NO_ATTR_VERIFY 0x8 +#define CMS_NOSIGS \ + (CMS_NO_CONTENT_VERIFY | CMS_NO_ATTR_VERIFY) +#define CMS_NOINTERN 0x10 +#define CMS_NO_SIGNER_CERT_VERIFY 0x20 +#define CMS_NOVERIFY 0x20 +#define CMS_DETACHED 0x40 +#define CMS_BINARY 0x80 +#define CMS_NOATTR 0x100 +#define CMS_NOSMIMECAP 0x200 +#define CMS_NOOLDMIMETYPE 0x400 +#define CMS_CRLFEOL 0x800 +#define CMS_STREAM 0x1000 +#define CMS_NOCRL 0x2000 +#define CMS_PARTIAL 0x4000 +#define CMS_REUSE_DIGEST 0x8000 +#define CMS_USE_KEYID 0x10000 +#define CMS_DEBUG_DECRYPT 0x20000 +#define CMS_KEY_PARAM 0x40000 +#define CMS_ASCIICRLF 0x80000 +#define CMS_CADES 0x100000 +#define CMS_USE_ORIGINATOR_KEYID 0x200000 +#define CMS_NO_SIGNING_TIME 0x400000 + +const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms); + +BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); +int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); + +ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); +int CMS_is_detached(CMS_ContentInfo *cms); +int CMS_set_detached(CMS_ContentInfo *cms, int detached); + +#ifdef OPENSSL_PEM_H +DECLARE_PEM_rw(CMS, CMS_ContentInfo) +#endif +int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms); +CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms); +int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms); + +BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); +int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); +int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, + int flags); +CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont); +CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont, CMS_ContentInfo **ci); +int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags); + +int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, + unsigned int flags); +int CMS_final_digest(CMS_ContentInfo *cms, + const unsigned char *md, unsigned int mdlen, BIO *dcont, + unsigned int flags); + +CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, BIO *data, + unsigned int flags); +CMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, BIO *data, + unsigned int flags, OSSL_LIB_CTX *libctx, + const char *propq); + +CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, + X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, unsigned int flags); + +int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags); +CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags); +CMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags, + OSSL_LIB_CTX *libctx, const char *propq); + +int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, + unsigned int flags); +CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, + unsigned int flags); +CMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md, + unsigned int flags, OSSL_LIB_CTX *libctx, + const char *propq); + +int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, + const unsigned char *key, size_t keylen, + BIO *dcont, BIO *out, unsigned int flags); +CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, + const unsigned char *key, + size_t keylen, unsigned int flags); +CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, const EVP_CIPHER *cipher, + const unsigned char *key, + size_t keylen, unsigned int flags, + OSSL_LIB_CTX *libctx, + const char *propq); + +int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, + const unsigned char *key, size_t keylen); + +int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, + X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags); + +int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, + STACK_OF(X509) *certs, + X509_STORE *store, unsigned int flags); + +STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); + +CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, + const EVP_CIPHER *cipher, unsigned int flags); +CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *in, + const EVP_CIPHER *cipher, unsigned int flags, + OSSL_LIB_CTX *libctx, const char *propq); + +int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, + BIO *dcont, BIO *out, unsigned int flags); + +int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert); +int CMS_decrypt_set1_pkey_and_peer(CMS_ContentInfo *cms, EVP_PKEY *pk, + X509 *cert, X509 *peer); +int CMS_decrypt_set1_key(CMS_ContentInfo *cms, + unsigned char *key, size_t keylen, + const unsigned char *id, size_t idlen); +int CMS_decrypt_set1_password(CMS_ContentInfo *cms, + unsigned char *pass, ossl_ssize_t passlen); + +STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); +int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); +EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri); +CMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher); +CMS_ContentInfo * +CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx, + const char *propq); +CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); +CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher, + OSSL_LIB_CTX *libctx, + const char *propq); +BIO *CMS_EnvelopedData_decrypt(CMS_EnvelopedData *env, BIO *detached_data, + EVP_PKEY *pkey, X509 *cert, + ASN1_OCTET_STRING *secret, unsigned int flags, + OSSL_LIB_CTX *libctx, const char *propq); + +CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, + X509 *recip, unsigned int flags); +CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip, + EVP_PKEY *originatorPrivKey, X509 *originator, unsigned int flags); +int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); +int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); +int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, + EVP_PKEY **pk, X509 **recip, + X509_ALGOR **palg); +int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, + ASN1_INTEGER **sno); + +CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, + unsigned char *key, size_t keylen, + unsigned char *id, size_t idlen, + ASN1_GENERALIZEDTIME *date, + ASN1_OBJECT *otherTypeId, + ASN1_TYPE *otherType); + +int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, + X509_ALGOR **palg, + ASN1_OCTET_STRING **pid, + ASN1_GENERALIZEDTIME **pdate, + ASN1_OBJECT **potherid, + ASN1_TYPE **pothertype); + +int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, + unsigned char *key, size_t keylen); + +int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, + const unsigned char *id, size_t idlen); + +int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, + unsigned char *pass, + ossl_ssize_t passlen); + +CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, + int iter, int wrap_nid, + int pbe_nid, + unsigned char *pass, + ossl_ssize_t passlen, + const EVP_CIPHER *kekciph); + +int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); +int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri); + +int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, + unsigned int flags); +CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); + +int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); +const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); + +CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms); +int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); +int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); +STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); + +CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms); +int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); +int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); +STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); + +int CMS_SignedData_init(CMS_ContentInfo *cms); +CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, + X509 *signer, EVP_PKEY *pk, const EVP_MD *md, + unsigned int flags); +EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si); +EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si); +STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); + +void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); +int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, ASN1_INTEGER **sno); +int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); +int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs, + unsigned int flags); +void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, + X509 **signer, X509_ALGOR **pdig, + X509_ALGOR **psig); +ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); +int CMS_SignerInfo_sign(CMS_SignerInfo *si); +int CMS_SignerInfo_verify(CMS_SignerInfo *si); +int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain); +BIO *CMS_SignedData_verify(CMS_SignedData *sd, BIO *detached_data, + STACK_OF(X509) *scerts, X509_STORE *store, + STACK_OF(X509) *extra, STACK_OF(X509_CRL) *crls, + unsigned int flags, + OSSL_LIB_CTX *libctx, const char *propq); + +int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs); +int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, + int algnid, int keysize); +int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap); + +int CMS_signed_get_attr_count(const CMS_SignerInfo *si); +int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, + int lastpos); +int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc); +X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc); +int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); +int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int type, + const void *bytes, int len); +int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, + int nid, int type, + const void *bytes, int len); +int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, + const char *attrname, int type, + const void *bytes, int len); +void *CMS_signed_get0_data_by_OBJ(const CMS_SignerInfo *si, + const ASN1_OBJECT *oid, + int lastpos, int type); + +int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si); +int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, + int lastpos); +int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int lastpos); +X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc); +X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc); +int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); +int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int type, + const void *bytes, int len); +int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, + int nid, int type, + const void *bytes, int len); +int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, + const char *attrname, int type, + const void *bytes, int len); +void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, + int lastpos, int type); + +int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); +CMS_ReceiptRequest *CMS_ReceiptRequest_create0( + unsigned char *id, int idlen, int allorfirst, + STACK_OF(GENERAL_NAMES) *receiptList, + STACK_OF(GENERAL_NAMES) *receiptsTo); +CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex( + unsigned char *id, int idlen, int allorfirst, + STACK_OF(GENERAL_NAMES) *receiptList, + STACK_OF(GENERAL_NAMES) *receiptsTo, + OSSL_LIB_CTX *libctx); + +int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); +void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, + ASN1_STRING **pcid, + int *pallorfirst, + STACK_OF(GENERAL_NAMES) **plist, + STACK_OF(GENERAL_NAMES) **prto); +int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, + X509_ALGOR **palg, + ASN1_OCTET_STRING **pukm); +STACK_OF(CMS_RecipientEncryptedKey) +*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri); + +int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, + X509_ALGOR **pubalg, + ASN1_BIT_STRING **pubkey, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, + ASN1_INTEGER **sno); + +int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert); + +int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, + ASN1_OCTET_STRING **keyid, + ASN1_GENERALIZEDTIME **tm, + CMS_OtherKeyAttribute **other, + X509_NAME **issuer, ASN1_INTEGER **sno); +int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, + X509 *cert); +int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); +int CMS_RecipientInfo_kari_set0_pkey_and_peer(CMS_RecipientInfo *ri, EVP_PKEY *pk, X509 *peer); +EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri); +int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, + CMS_RecipientInfo *ri, + CMS_RecipientEncryptedKey *rek); + +int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, + ASN1_OCTET_STRING *ukm, int keylen); + +int CMS_RecipientInfo_kemri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); +int CMS_RecipientInfo_kemri_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); +EVP_CIPHER_CTX *CMS_RecipientInfo_kemri_get0_ctx(CMS_RecipientInfo *ri); +X509_ALGOR *CMS_RecipientInfo_kemri_get0_kdf_alg(CMS_RecipientInfo *ri); +int CMS_RecipientInfo_kemri_set_ukm(CMS_RecipientInfo *ri, + const unsigned char *ukm, + int ukmLength); + +/* Backward compatibility for spelling errors. */ +#define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM +#define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \ + CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cmserr.h b/VCMP-LUA/modules/postgresql/include/openssl/cmserr.h new file mode 100644 index 0000000..49c22c2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cmserr.h @@ -0,0 +1,128 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CMSERR_H +#define OPENSSL_CMSERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_CMS + +/* + * CMS reason codes. + */ +#define CMS_R_ADD_SIGNER_ERROR 99 +#define CMS_R_ATTRIBUTE_ERROR 161 +#define CMS_R_CERTIFICATE_ALREADY_PRESENT 175 +#define CMS_R_CERTIFICATE_HAS_NO_KEYID 160 +#define CMS_R_CERTIFICATE_VERIFY_ERROR 100 +#define CMS_R_CIPHER_AEAD_IN_ENVELOPED_DATA 200 +#define CMS_R_CIPHER_AEAD_SET_TAG_ERROR 184 +#define CMS_R_CIPHER_GET_TAG 185 +#define CMS_R_CIPHER_INITIALISATION_ERROR 101 +#define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102 +#define CMS_R_CMS_DATAFINAL_ERROR 103 +#define CMS_R_CMS_LIB 104 +#define CMS_R_CONTENTIDENTIFIER_MISMATCH 170 +#define CMS_R_CONTENT_NOT_FOUND 105 +#define CMS_R_CONTENT_TYPE_MISMATCH 171 +#define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106 +#define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107 +#define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108 +#define CMS_R_CONTENT_VERIFY_ERROR 109 +#define CMS_R_CTRL_ERROR 110 +#define CMS_R_CTRL_FAILURE 111 +#define CMS_R_DECODE_ERROR 187 +#define CMS_R_DECRYPT_ERROR 112 +#define CMS_R_ERROR_GETTING_PUBLIC_KEY 113 +#define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114 +#define CMS_R_ERROR_SETTING_KEY 115 +#define CMS_R_ERROR_SETTING_RECIPIENTINFO 116 +#define CMS_R_ERROR_UNSUPPORTED_STATIC_KEY_AGREEMENT 196 +#define CMS_R_ESS_SIGNING_CERTID_MISMATCH_ERROR 183 +#define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117 +#define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176 +#define CMS_R_INVALID_KEY_LENGTH 118 +#define CMS_R_INVALID_LABEL 190 +#define CMS_R_INVALID_OAEP_PARAMETERS 191 +#define CMS_R_KDF_PARAMETER_ERROR 186 +#define CMS_R_MD_BIO_INIT_ERROR 119 +#define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120 +#define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121 +#define CMS_R_MSGSIGDIGEST_ERROR 172 +#define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162 +#define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163 +#define CMS_R_NEED_ONE_SIGNER 164 +#define CMS_R_NOT_A_SIGNED_RECEIPT 165 +#define CMS_R_NOT_ENCRYPTED_DATA 122 +#define CMS_R_NOT_KEK 123 +#define CMS_R_NOT_KEM 197 +#define CMS_R_NOT_KEY_AGREEMENT 181 +#define CMS_R_NOT_KEY_TRANSPORT 124 +#define CMS_R_NOT_PWRI 177 +#define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125 +#define CMS_R_NO_CIPHER 126 +#define CMS_R_NO_CONTENT 127 +#define CMS_R_NO_CONTENT_TYPE 173 +#define CMS_R_NO_DEFAULT_DIGEST 128 +#define CMS_R_NO_DIGEST_SET 129 +#define CMS_R_NO_KEY 130 +#define CMS_R_NO_KEY_OR_CERT 174 +#define CMS_R_NO_MATCHING_DIGEST 131 +#define CMS_R_NO_MATCHING_RECIPIENT 132 +#define CMS_R_NO_MATCHING_SIGNATURE 166 +#define CMS_R_NO_MSGSIGDIGEST 167 +#define CMS_R_NO_PASSWORD 178 +#define CMS_R_NO_PRIVATE_KEY 133 +#define CMS_R_NO_PUBLIC_KEY 134 +#define CMS_R_NO_RECEIPT_REQUEST 168 +#define CMS_R_NO_SIGNERS 135 +#define CMS_R_OPERATION_UNSUPPORTED 182 +#define CMS_R_PEER_KEY_ERROR 188 +#define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136 +#define CMS_R_RECEIPT_DECODE_ERROR 169 +#define CMS_R_RECIPIENT_ERROR 137 +#define CMS_R_SHARED_INFO_ERROR 189 +#define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138 +#define CMS_R_SIGNFINAL_ERROR 139 +#define CMS_R_SMIME_TEXT_ERROR 140 +#define CMS_R_STORE_INIT_ERROR 141 +#define CMS_R_TYPE_NOT_COMPRESSED_DATA 142 +#define CMS_R_TYPE_NOT_DATA 143 +#define CMS_R_TYPE_NOT_DIGESTED_DATA 144 +#define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145 +#define CMS_R_TYPE_NOT_ENVELOPED_DATA 146 +#define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147 +#define CMS_R_UNKNOWN_CIPHER 148 +#define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149 +#define CMS_R_UNKNOWN_ID 150 +#define CMS_R_UNKNOWN_KDF_ALGORITHM 198 +#define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151 +#define CMS_R_UNSUPPORTED_CONTENT_ENCRYPTION_ALGORITHM 194 +#define CMS_R_UNSUPPORTED_CONTENT_TYPE 152 +#define CMS_R_UNSUPPORTED_ENCRYPTION_TYPE 192 +#define CMS_R_UNSUPPORTED_KDF_ALGORITHM 199 +#define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153 +#define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179 +#define CMS_R_UNSUPPORTED_LABEL_SOURCE 193 +#define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155 +#define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154 +#define CMS_R_UNSUPPORTED_SIGNATURE_ALGORITHM 195 +#define CMS_R_UNSUPPORTED_TYPE 156 +#define CMS_R_UNWRAP_ERROR 157 +#define CMS_R_UNWRAP_FAILURE 180 +#define CMS_R_VERIFICATION_FAILURE 158 +#define CMS_R_WRAP_ERROR 159 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/comp.h b/VCMP-LUA/modules/postgresql/include/openssl/comp.h new file mode 100644 index 0000000..0363a33 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/comp.h @@ -0,0 +1,101 @@ +/* + * Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_COMP_H +#define OPENSSL_COMP_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_COMP_H +#endif + +#include + +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_COMP + +COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); +const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx); +int COMP_CTX_get_type(const COMP_CTX *comp); +int COMP_get_type(const COMP_METHOD *meth); +const char *COMP_get_name(const COMP_METHOD *meth); +void COMP_CTX_free(COMP_CTX *ctx); + +int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); +int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); + +COMP_METHOD *COMP_zlib(void); +COMP_METHOD *COMP_zlib_oneshot(void); +COMP_METHOD *COMP_brotli(void); +COMP_METHOD *COMP_brotli_oneshot(void); +COMP_METHOD *COMP_zstd(void); +COMP_METHOD *COMP_zstd_oneshot(void); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define COMP_zlib_cleanup() \ + while (0) \ + continue +#endif + +#ifdef OPENSSL_BIO_H +const BIO_METHOD *BIO_f_zlib(void); +const BIO_METHOD *BIO_f_brotli(void); +const BIO_METHOD *BIO_f_zstd(void); +#endif + +#endif + +typedef struct ssl_comp_st SSL_COMP; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(SSL_COMP, SSL_COMP, SSL_COMP) +#define sk_SSL_COMP_num(sk) OPENSSL_sk_num(ossl_check_const_SSL_COMP_sk_type(sk)) +#define sk_SSL_COMP_value(sk, idx) ((SSL_COMP *)OPENSSL_sk_value(ossl_check_const_SSL_COMP_sk_type(sk), (idx))) +#define sk_SSL_COMP_new(cmp) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new(ossl_check_SSL_COMP_compfunc_type(cmp))) +#define sk_SSL_COMP_new_null() ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new_null()) +#define sk_SSL_COMP_new_reserve(cmp, n) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new_reserve(ossl_check_SSL_COMP_compfunc_type(cmp), (n))) +#define sk_SSL_COMP_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SSL_COMP_sk_type(sk), (n)) +#define sk_SSL_COMP_free(sk) OPENSSL_sk_free(ossl_check_SSL_COMP_sk_type(sk)) +#define sk_SSL_COMP_zero(sk) OPENSSL_sk_zero(ossl_check_SSL_COMP_sk_type(sk)) +#define sk_SSL_COMP_delete(sk, i) ((SSL_COMP *)OPENSSL_sk_delete(ossl_check_SSL_COMP_sk_type(sk), (i))) +#define sk_SSL_COMP_delete_ptr(sk, ptr) ((SSL_COMP *)OPENSSL_sk_delete_ptr(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))) +#define sk_SSL_COMP_push(sk, ptr) OPENSSL_sk_push(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr)) +#define sk_SSL_COMP_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr)) +#define sk_SSL_COMP_pop(sk) ((SSL_COMP *)OPENSSL_sk_pop(ossl_check_SSL_COMP_sk_type(sk))) +#define sk_SSL_COMP_shift(sk) ((SSL_COMP *)OPENSSL_sk_shift(ossl_check_SSL_COMP_sk_type(sk))) +#define sk_SSL_COMP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_freefunc_type(freefunc)) +#define sk_SSL_COMP_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr), (idx)) +#define sk_SSL_COMP_set(sk, idx, ptr) ((SSL_COMP *)OPENSSL_sk_set(ossl_check_SSL_COMP_sk_type(sk), (idx), ossl_check_SSL_COMP_type(ptr))) +#define sk_SSL_COMP_find(sk, ptr) OPENSSL_sk_find(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr)) +#define sk_SSL_COMP_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr)) +#define sk_SSL_COMP_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr), pnum) +#define sk_SSL_COMP_sort(sk) OPENSSL_sk_sort(ossl_check_SSL_COMP_sk_type(sk)) +#define sk_SSL_COMP_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SSL_COMP_sk_type(sk)) +#define sk_SSL_COMP_dup(sk) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_dup(ossl_check_const_SSL_COMP_sk_type(sk))) +#define sk_SSL_COMP_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_deep_copy(ossl_check_const_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_copyfunc_type(copyfunc), ossl_check_SSL_COMP_freefunc_type(freefunc))) +#define sk_SSL_COMP_set_cmp_func(sk, cmp) ((sk_SSL_COMP_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_compfunc_type(cmp))) + +/* clang-format on */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/comperr.h b/VCMP-LUA/modules/postgresql/include/openssl/comperr.h new file mode 100644 index 0000000..90ec7c1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/comperr.h @@ -0,0 +1,36 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_COMPERR_H +#define OPENSSL_COMPERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_COMP + +/* + * COMP reason codes. + */ +#define COMP_R_BROTLI_DECODE_ERROR 102 +#define COMP_R_BROTLI_ENCODE_ERROR 103 +#define COMP_R_BROTLI_NOT_SUPPORTED 104 +#define COMP_R_ZLIB_DEFLATE_ERROR 99 +#define COMP_R_ZLIB_INFLATE_ERROR 100 +#define COMP_R_ZLIB_NOT_SUPPORTED 101 +#define COMP_R_ZSTD_COMPRESS_ERROR 105 +#define COMP_R_ZSTD_DECODE_ERROR 106 +#define COMP_R_ZSTD_DECOMPRESS_ERROR 107 +#define COMP_R_ZSTD_NOT_SUPPORTED 108 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/conf.h b/VCMP-LUA/modules/postgresql/include/openssl/conf.h new file mode 100644 index 0000000..f7ac8cb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/conf.h @@ -0,0 +1,219 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\conf.h.in + * + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_CONF_H +#define OPENSSL_CONF_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_CONF_H +#endif + +#include +#include +#include +#include +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + char *section; + char *name; + char *value; +} CONF_VALUE; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(CONF_VALUE, CONF_VALUE, CONF_VALUE) +#define sk_CONF_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_CONF_VALUE_sk_type(sk)) +#define sk_CONF_VALUE_value(sk, idx) ((CONF_VALUE *)OPENSSL_sk_value(ossl_check_const_CONF_VALUE_sk_type(sk), (idx))) +#define sk_CONF_VALUE_new(cmp) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new(ossl_check_CONF_VALUE_compfunc_type(cmp))) +#define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_null()) +#define sk_CONF_VALUE_new_reserve(cmp, n) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_CONF_VALUE_compfunc_type(cmp), (n))) +#define sk_CONF_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CONF_VALUE_sk_type(sk), (n)) +#define sk_CONF_VALUE_free(sk) OPENSSL_sk_free(ossl_check_CONF_VALUE_sk_type(sk)) +#define sk_CONF_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_CONF_VALUE_sk_type(sk)) +#define sk_CONF_VALUE_delete(sk, i) ((CONF_VALUE *)OPENSSL_sk_delete(ossl_check_CONF_VALUE_sk_type(sk), (i))) +#define sk_CONF_VALUE_delete_ptr(sk, ptr) ((CONF_VALUE *)OPENSSL_sk_delete_ptr(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))) +#define sk_CONF_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr)) +#define sk_CONF_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr)) +#define sk_CONF_VALUE_pop(sk) ((CONF_VALUE *)OPENSSL_sk_pop(ossl_check_CONF_VALUE_sk_type(sk))) +#define sk_CONF_VALUE_shift(sk) ((CONF_VALUE *)OPENSSL_sk_shift(ossl_check_CONF_VALUE_sk_type(sk))) +#define sk_CONF_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_freefunc_type(freefunc)) +#define sk_CONF_VALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr), (idx)) +#define sk_CONF_VALUE_set(sk, idx, ptr) ((CONF_VALUE *)OPENSSL_sk_set(ossl_check_CONF_VALUE_sk_type(sk), (idx), ossl_check_CONF_VALUE_type(ptr))) +#define sk_CONF_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr)) +#define sk_CONF_VALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr)) +#define sk_CONF_VALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr), pnum) +#define sk_CONF_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_CONF_VALUE_sk_type(sk)) +#define sk_CONF_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CONF_VALUE_sk_type(sk)) +#define sk_CONF_VALUE_dup(sk) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_dup(ossl_check_const_CONF_VALUE_sk_type(sk))) +#define sk_CONF_VALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_copyfunc_type(copyfunc), ossl_check_CONF_VALUE_freefunc_type(freefunc))) +#define sk_CONF_VALUE_set_cmp_func(sk, cmp) ((sk_CONF_VALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_compfunc_type(cmp))) +DEFINE_LHASH_OF_INTERNAL(CONF_VALUE); +#define lh_CONF_VALUE_new(hfn, cmp) ((LHASH_OF(CONF_VALUE) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_CONF_VALUE_lh_hashfunc_type(hfn), ossl_check_CONF_VALUE_lh_compfunc_type(cmp)), lh_CONF_VALUE_hash_thunk, lh_CONF_VALUE_comp_thunk, lh_CONF_VALUE_doall_thunk, lh_CONF_VALUE_doall_arg_thunk)) +#define lh_CONF_VALUE_free(lh) OPENSSL_LH_free(ossl_check_CONF_VALUE_lh_type(lh)) +#define lh_CONF_VALUE_flush(lh) OPENSSL_LH_flush(ossl_check_CONF_VALUE_lh_type(lh)) +#define lh_CONF_VALUE_insert(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_insert(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_CONF_VALUE_lh_plain_type(ptr))) +#define lh_CONF_VALUE_delete(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_delete(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_const_CONF_VALUE_lh_plain_type(ptr))) +#define lh_CONF_VALUE_retrieve(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_retrieve(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_const_CONF_VALUE_lh_plain_type(ptr))) +#define lh_CONF_VALUE_error(lh) OPENSSL_LH_error(ossl_check_CONF_VALUE_lh_type(lh)) +#define lh_CONF_VALUE_num_items(lh) OPENSSL_LH_num_items(ossl_check_CONF_VALUE_lh_type(lh)) +#define lh_CONF_VALUE_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out) +#define lh_CONF_VALUE_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out) +#define lh_CONF_VALUE_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out) +#define lh_CONF_VALUE_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_CONF_VALUE_lh_type(lh)) +#define lh_CONF_VALUE_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_CONF_VALUE_lh_type(lh), dl) +#define lh_CONF_VALUE_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_CONF_VALUE_lh_doallfunc_type(dfn)) + +/* clang-format on */ + +struct conf_st; +struct conf_method_st; +typedef struct conf_method_st CONF_METHOD; + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#include +#endif + +/* Module definitions */ +typedef struct conf_imodule_st CONF_IMODULE; +typedef struct conf_module_st CONF_MODULE; + +STACK_OF(CONF_MODULE); +STACK_OF(CONF_IMODULE); + +/* DSO module function typedefs */ +typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); +typedef void conf_finish_func(CONF_IMODULE *md); + +#define CONF_MFLAGS_IGNORE_ERRORS 0x1 +#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 +#define CONF_MFLAGS_SILENT 0x4 +#define CONF_MFLAGS_NO_DSO 0x8 +#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 +#define CONF_MFLAGS_DEFAULT_SECTION 0x20 + +int CONF_set_default_method(CONF_METHOD *meth); +void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); +LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, + long *eline); +#ifndef OPENSSL_NO_STDIO +LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, + long *eline); +#endif +LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, + long *eline); +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, + const char *section); +char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, + const char *name); +long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, + const char *name); +void CONF_free(LHASH_OF(CONF_VALUE) *conf); +#ifndef OPENSSL_NO_STDIO +int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); +#endif +int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 void OPENSSL_config(const char *config_name); +#endif + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define OPENSSL_no_config() \ + OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) +#endif + +/* + * New conf code. The semantics are different from the functions above. If + * that wasn't the case, the above functions would have been replaced + */ + +CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth); +OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf); +CONF *NCONF_new(CONF_METHOD *meth); +CONF_METHOD *NCONF_default(void); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 CONF_METHOD *NCONF_WIN32(void); +#endif +void NCONF_free(CONF *conf); +void NCONF_free_data(CONF *conf); + +int NCONF_load(CONF *conf, const char *file, long *eline); +#ifndef OPENSSL_NO_STDIO +int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); +#endif +int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); +STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf); +STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, + const char *section); +char *NCONF_get_string(const CONF *conf, const char *group, const char *name); +int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, + long *result); +#ifndef OPENSSL_NO_STDIO +int NCONF_dump_fp(const CONF *conf, FILE *out); +#endif +int NCONF_dump_bio(const CONF *conf, BIO *out); + +#define NCONF_get_number(c, g, n, r) NCONF_get_number_e(c, g, n, r) + +/* Module functions */ + +int CONF_modules_load(const CONF *cnf, const char *appname, + unsigned long flags); +int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename, + const char *appname, unsigned long flags); +int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags); +void CONF_modules_unload(int all); +void CONF_modules_finish(void); +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define CONF_modules_free() \ + while (0) \ + continue +#endif +int CONF_module_add(const char *name, conf_init_func *ifunc, + conf_finish_func *ffunc); + +const char *CONF_imodule_get_name(const CONF_IMODULE *md); +const char *CONF_imodule_get_value(const CONF_IMODULE *md); +void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); +void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); +CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); +unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); +void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); +void *CONF_module_get_usr_data(CONF_MODULE *pmod); +void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); + +char *CONF_get1_default_config_file(void); + +int CONF_parse_list(const char *list, int sep, int nospc, + int (*list_cb)(const char *elem, int len, void *usr), + void *arg); + +void OPENSSL_load_builtin_modules(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/conf_api.h b/VCMP-LUA/modules/postgresql/include/openssl/conf_api.h new file mode 100644 index 0000000..f3f3c64 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/conf_api.h @@ -0,0 +1,46 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CONF_API_H +#define OPENSSL_CONF_API_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_CONF_API_H +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Up until OpenSSL 0.9.5a, this was new_section */ +CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was get_section */ +CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ +STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, + const char *section); + +int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); +char *_CONF_get_string(const CONF *conf, const char *section, + const char *name); +long _CONF_get_number(const CONF *conf, const char *section, + const char *name); + +int _CONF_new_data(CONF *conf); +void _CONF_free_data(CONF *conf); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/conferr.h b/VCMP-LUA/modules/postgresql/include/openssl/conferr.h new file mode 100644 index 0000000..0b984dd --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/conferr.h @@ -0,0 +1,50 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CONFERR_H +#define OPENSSL_CONFERR_H +#pragma once + +#include +#include +#include + +/* + * CONF reason codes. + */ +#define CONF_R_ERROR_LOADING_DSO 110 +#define CONF_R_INVALID_PRAGMA 122 +#define CONF_R_LIST_CANNOT_BE_NULL 115 +#define CONF_R_MANDATORY_BRACES_IN_VARIABLE_EXPANSION 123 +#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 +#define CONF_R_MISSING_EQUAL_SIGN 101 +#define CONF_R_MISSING_INIT_FUNCTION 112 +#define CONF_R_MODULE_INITIALIZATION_ERROR 109 +#define CONF_R_NO_CLOSE_BRACE 102 +#define CONF_R_NO_CONF 105 +#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 +#define CONF_R_NO_SECTION 107 +#define CONF_R_NO_SUCH_FILE 114 +#define CONF_R_NO_VALUE 108 +#define CONF_R_NUMBER_TOO_LARGE 121 +#define CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION 124 +#define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111 +#define CONF_R_RECURSIVE_SECTION_REFERENCE 126 +#define CONF_R_RELATIVE_PATH 125 +#define CONF_R_SSL_COMMAND_SECTION_EMPTY 117 +#define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118 +#define CONF_R_SSL_SECTION_EMPTY 119 +#define CONF_R_SSL_SECTION_NOT_FOUND 120 +#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 +#define CONF_R_UNKNOWN_MODULE_NAME 113 +#define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116 +#define CONF_R_VARIABLE_HAS_NO_VALUE 104 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/configuration.h b/VCMP-LUA/modules/postgresql/include/openssl/configuration.h new file mode 100644 index 0000000..1d303df --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/configuration.h @@ -0,0 +1,220 @@ +/* + * WARNING: do not edit! + * Generated by configdata.pm from Configurations\common0.tmpl, Configurations\windows-makefile.tmpl + * via makefile.in + * + * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CONFIGURATION_H +#define OPENSSL_CONFIGURATION_H +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_ALGORITHM_DEFINES +#error OPENSSL_ALGORITHM_DEFINES no longer supported +#endif + +/* + * OpenSSL was configured with the following options: + */ + +/* clang-format off */ +# ifndef OPENSSL_SYS_WIN64A +# define OPENSSL_SYS_WIN64A 1 +# endif +# define OPENSSL_CONFIGURED_API 30600 +# ifndef OPENSSL_RAND_SEED_OS +# define OPENSSL_RAND_SEED_OS +# endif +# ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +# endif +# ifndef OPENSSL_NO_ACVP_TESTS +# define OPENSSL_NO_ACVP_TESTS +# endif +# ifndef OPENSSL_NO_AFALGENG +# define OPENSSL_NO_AFALGENG +# endif +# ifndef OPENSSL_NO_ALLOCFAIL_TESTS +# define OPENSSL_NO_ALLOCFAIL_TESTS +# endif +# ifndef OPENSSL_NO_APPS +# define OPENSSL_NO_APPS +# endif +# ifndef OPENSSL_NO_ASAN +# define OPENSSL_NO_ASAN +# endif +# ifndef OPENSSL_NO_BROTLI +# define OPENSSL_NO_BROTLI +# endif +# ifndef OPENSSL_NO_BROTLI_DYNAMIC +# define OPENSSL_NO_BROTLI_DYNAMIC +# endif +# ifndef OPENSSL_NO_CRYPTO_MDEBUG +# define OPENSSL_NO_CRYPTO_MDEBUG +# endif +# ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +# endif +# ifndef OPENSSL_NO_DEMOS +# define OPENSSL_NO_DEMOS +# endif +# ifndef OPENSSL_NO_DEVCRYPTOENG +# define OPENSSL_NO_DEVCRYPTOENG +# endif +# ifndef OPENSSL_NO_DOCS +# define OPENSSL_NO_DOCS +# endif +# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +# define OPENSSL_NO_EC_NISTP_64_GCC_128 +# endif +# ifndef OPENSSL_NO_EGD +# define OPENSSL_NO_EGD +# endif +# ifndef OPENSSL_NO_EXTERNAL_TESTS +# define OPENSSL_NO_EXTERNAL_TESTS +# endif +# ifndef OPENSSL_NO_FIPS_JITTER +# define OPENSSL_NO_FIPS_JITTER +# endif +# ifndef OPENSSL_NO_FIPS_POST +# define OPENSSL_NO_FIPS_POST +# endif +# ifndef OPENSSL_NO_FIPS_SECURITYCHECKS +# define OPENSSL_NO_FIPS_SECURITYCHECKS +# endif +# ifndef OPENSSL_NO_FUZZ_AFL +# define OPENSSL_NO_FUZZ_AFL +# endif +# ifndef OPENSSL_NO_FUZZ_LIBFUZZER +# define OPENSSL_NO_FUZZ_LIBFUZZER +# endif +# ifndef OPENSSL_NO_H3DEMO +# define OPENSSL_NO_H3DEMO +# endif +# ifndef OPENSSL_NO_HQINTEROP +# define OPENSSL_NO_HQINTEROP +# endif +# ifndef OPENSSL_NO_JITTER +# define OPENSSL_NO_JITTER +# endif +# ifndef OPENSSL_NO_KTLS +# define OPENSSL_NO_KTLS +# endif +# ifndef OPENSSL_NO_LMS +# define OPENSSL_NO_LMS +# endif +# ifndef OPENSSL_NO_LOADERENG +# define OPENSSL_NO_LOADERENG +# endif +# ifndef OPENSSL_NO_MD2 +# define OPENSSL_NO_MD2 +# endif +# ifndef OPENSSL_NO_MSAN +# define OPENSSL_NO_MSAN +# endif +# ifndef OPENSSL_NO_PIE +# define OPENSSL_NO_PIE +# endif +# ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +# endif +# ifndef OPENSSL_NO_SCTP +# define OPENSSL_NO_SCTP +# endif +# ifndef OPENSSL_NO_SSL3 +# define OPENSSL_NO_SSL3 +# endif +# ifndef OPENSSL_NO_SSL3_METHOD +# define OPENSSL_NO_SSL3_METHOD +# endif +# ifndef OPENSSL_NO_SSLKEYLOG +# define OPENSSL_NO_SSLKEYLOG +# endif +# ifndef OPENSSL_NO_TESTS +# define OPENSSL_NO_TESTS +# endif +# ifndef OPENSSL_NO_TFO +# define OPENSSL_NO_TFO +# endif +# ifndef OPENSSL_NO_TRACE +# define OPENSSL_NO_TRACE +# endif +# ifndef OPENSSL_NO_UBSAN +# define OPENSSL_NO_UBSAN +# endif +# ifndef OPENSSL_NO_UNIT_TEST +# define OPENSSL_NO_UNIT_TEST +# endif +# ifndef OPENSSL_NO_UPLINK +# define OPENSSL_NO_UPLINK +# endif +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +# endif +# ifndef OPENSSL_NO_ZLIB +# define OPENSSL_NO_ZLIB +# endif +# ifndef OPENSSL_NO_ZLIB_DYNAMIC +# define OPENSSL_NO_ZLIB_DYNAMIC +# endif +# ifndef OPENSSL_NO_ZSTD +# define OPENSSL_NO_ZSTD +# endif +# ifndef OPENSSL_NO_ZSTD_DYNAMIC +# define OPENSSL_NO_ZSTD_DYNAMIC +# endif +# ifndef OPENSSL_NO_DYNAMIC_ENGINE +# define OPENSSL_NO_DYNAMIC_ENGINE +# endif + +/* clang-format on */ + +/* Generate 80386 code? */ +/* clang-format off */ +# undef I386_ONLY +/* clang-format on */ + +/* + * The following are cipher-specific, but are part of the public API. + */ +#if !defined(OPENSSL_SYS_UEFI) + /* clang-format off */ +# undef BN_LLONG + /* clang-format on */ + /* Only one for the following should be defined */ + /* clang-format off */ +# undef SIXTY_FOUR_BIT_LONG + /* clang-format on */ + /* clang-format off */ +# define SIXTY_FOUR_BIT + /* clang-format on */ + /* clang-format off */ +# undef THIRTY_TWO_BIT +/* clang-format on */ +#endif + +/* clang-format off */ +# define RC4_INT unsigned int +/* clang-format on */ + +#if defined(OPENSSL_NO_COMP) || (defined(OPENSSL_NO_BROTLI) && defined(OPENSSL_NO_ZSTD) && defined(OPENSSL_NO_ZLIB)) +#define OPENSSL_NO_COMP_ALG +#else +#undef OPENSSL_NO_COMP_ALG +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* OPENSSL_CONFIGURATION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/conftypes.h b/VCMP-LUA/modules/postgresql/include/openssl/conftypes.h new file mode 100644 index 0000000..f2d2be1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/conftypes.h @@ -0,0 +1,44 @@ +/* + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CONFTYPES_H +#define OPENSSL_CONFTYPES_H +#pragma once + +#ifndef OPENSSL_CONF_H +#include +#endif + +/* + * The contents of this file are deprecated and will be made opaque + */ +struct conf_method_st { + const char *name; + CONF *(*create)(CONF_METHOD *meth); + int (*init)(CONF *conf); + int (*destroy)(CONF *conf); + int (*destroy_data)(CONF *conf); + int (*load_bio)(CONF *conf, BIO *bp, long *eline); + int (*dump)(const CONF *conf, BIO *bp); + int (*is_number)(const CONF *conf, char c); + int (*to_int)(const CONF *conf, char c); + int (*load)(CONF *conf, const char *name, long *eline); +}; + +struct conf_st { + CONF_METHOD *meth; + void *meth_data; + LHASH_OF(CONF_VALUE) *data; + int flag_dollarid; + int flag_abspath; + char *includedir; + OSSL_LIB_CTX *libctx; +}; + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/core.h b/VCMP-LUA/modules/postgresql/include/openssl/core.h new file mode 100644 index 0000000..a883173 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/core.h @@ -0,0 +1,235 @@ +/* + * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CORE_H +#define OPENSSL_CORE_H +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * Base types + * ---------- + * + * These are the types that the OpenSSL core and providers have in common + * to communicate data between them. + */ + +/* Opaque handles to be used with core upcall functions from providers */ +typedef struct ossl_core_handle_st OSSL_CORE_HANDLE; +typedef struct openssl_core_ctx_st OPENSSL_CORE_CTX; +typedef struct ossl_core_bio_st OSSL_CORE_BIO; + +/* + * Dispatch table element. function_id numbers and the functions are defined + * in core_dispatch.h, see macros with 'OSSL_CORE_MAKE_FUNC' in their names. + * + * An array of these is always terminated by function_id == 0 + */ +struct ossl_dispatch_st { + int function_id; + void (*function)(void); +}; + +#define OSSL_DISPATCH_END \ + { 0, NULL } + +/* + * Other items, essentially an int<->pointer map element. + * + * We make this type distinct from OSSL_DISPATCH to ensure that dispatch + * tables remain tables with function pointers only. + * + * This is used whenever we need to pass things like a table of error reason + * codes <-> reason string maps, ... + * + * Usage determines which field works as key if any, rather than field order. + * + * An array of these is always terminated by id == 0 && ptr == NULL + */ +struct ossl_item_st { + unsigned int id; + void *ptr; +}; + +/* + * Type to tie together algorithm names, property definition string and + * the algorithm implementation in the form of a dispatch table. + * + * An array of these is always terminated by algorithm_names == NULL + */ +struct ossl_algorithm_st { + const char *algorithm_names; /* key */ + const char *property_definition; /* key */ + const OSSL_DISPATCH *implementation; + const char *algorithm_description; +}; + +/* + * Type to pass object data in a uniform way, without exposing the object + * structure. + * + * An array of these is always terminated by key == NULL + */ +struct ossl_param_st { + const char *key; /* the name of the parameter */ + unsigned int data_type; /* declare what kind of content is in buffer */ + void *data; /* value being passed in or out */ + size_t data_size; /* data size */ + size_t return_size; /* returned content size */ +}; + +/* Currently supported OSSL_PARAM data types */ +/* + * OSSL_PARAM_INTEGER and OSSL_PARAM_UNSIGNED_INTEGER + * are arbitrary length and therefore require an arbitrarily sized buffer, + * since they may be used to pass numbers larger than what is natively + * available. + * + * The number must be buffered in native form, i.e. MSB first on B_ENDIAN + * systems and LSB first on L_ENDIAN systems. This means that arbitrary + * native integers can be stored in the buffer, just make sure that the + * buffer size is correct and the buffer itself is properly aligned (for + * example by having the buffer field point at a C integer). + */ +#define OSSL_PARAM_INTEGER 1 +#define OSSL_PARAM_UNSIGNED_INTEGER 2 +/*- + * OSSL_PARAM_REAL + * is a C binary floating point values in native form and alignment. + */ +#define OSSL_PARAM_REAL 3 +/*- + * OSSL_PARAM_UTF8_STRING + * is a printable string. It is expected to be printed as it is. + */ +#define OSSL_PARAM_UTF8_STRING 4 +/*- + * OSSL_PARAM_OCTET_STRING + * is a string of bytes with no further specification. It is expected to be + * printed as a hexdump. + */ +#define OSSL_PARAM_OCTET_STRING 5 +/*- + * OSSL_PARAM_UTF8_PTR + * is a pointer to a printable string. It is expected to be printed as it is. + * + * The difference between this and OSSL_PARAM_UTF8_STRING is that only pointers + * are manipulated for this type. + * + * This is more relevant for parameter requests, where the responding + * function doesn't need to copy the data to the provided buffer, but + * sets the provided buffer to point at the actual data instead. + * + * WARNING! Using these is FRAGILE, as it assumes that the actual + * data and its location are constant. + * + * EXTRA WARNING! If you are not completely sure you most likely want + * to use the OSSL_PARAM_UTF8_STRING type. + */ +#define OSSL_PARAM_UTF8_PTR 6 +/*- + * OSSL_PARAM_OCTET_PTR + * is a pointer to a string of bytes with no further specification. It is + * expected to be printed as a hexdump. + * + * The difference between this and OSSL_PARAM_OCTET_STRING is that only pointers + * are manipulated for this type. + * + * This is more relevant for parameter requests, where the responding + * function doesn't need to copy the data to the provided buffer, but + * sets the provided buffer to point at the actual data instead. + * + * WARNING! Using these is FRAGILE, as it assumes that the actual + * data and its location are constant. + * + * EXTRA WARNING! If you are not completely sure you most likely want + * to use the OSSL_PARAM_OCTET_STRING type. + */ +#define OSSL_PARAM_OCTET_PTR 7 + +/* + * Typedef for the thread stop handling callback. Used both internally and by + * providers. + * + * Providers may register for notifications about threads stopping by + * registering a callback to hear about such events. Providers register the + * callback using the OSSL_FUNC_CORE_THREAD_START function in the |in| dispatch + * table passed to OSSL_provider_init(). The arg passed back to a provider will + * be the provider side context object. + */ +typedef void (*OSSL_thread_stop_handler_fn)(void *arg); + +/*- + * Provider entry point + * -------------------- + * + * This function is expected to be present in any dynamically loadable + * provider module. By definition, if this function doesn't exist in a + * module, that module is not an OpenSSL provider module. + */ +/*- + * |handle| pointer to opaque type OSSL_CORE_HANDLE. This can be used + * together with some functions passed via |in| to query data. + * |in| is the array of functions that the Core passes to the provider. + * |out| will be the array of base functions that the provider passes + * back to the Core. + * |provctx| a provider side context object, optionally created if the + * provider needs it. This value is passed to other provider + * functions, notably other context constructors. + */ +typedef int(OSSL_provider_init_fn)(const OSSL_CORE_HANDLE *handle, + const OSSL_DISPATCH *in, + const OSSL_DISPATCH **out, + void **provctx); +#ifdef __VMS +#pragma names save +#pragma names uppercase, truncated +#endif +OPENSSL_EXPORT OSSL_provider_init_fn OSSL_provider_init; +#ifdef __VMS +#pragma names restore +#endif + +/* + * Generic callback function signature. + * + * The expectation is that any provider function that wants to offer + * a callback / hook can do so by taking an argument with this type, + * as well as a pointer to caller-specific data. When calling the + * callback, the provider function can populate an OSSL_PARAM array + * with data of its choice and pass that in the callback call, along + * with the caller data argument. + * + * libcrypto may use the OSSL_PARAM array to create arguments for an + * application callback it knows about. + */ +typedef int(OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg); +typedef int(OSSL_INOUT_CALLBACK)(const OSSL_PARAM in_params[], + OSSL_PARAM out_params[], void *arg); +/* + * Passphrase callback function signature + * + * This is similar to the generic callback function above, but adds a + * result parameter. + */ +typedef int(OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size, + size_t *pass_len, + const OSSL_PARAM params[], void *arg); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/core_dispatch.h b/VCMP-LUA/modules/postgresql/include/openssl/core_dispatch.h new file mode 100644 index 0000000..d645916 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/core_dispatch.h @@ -0,0 +1,1061 @@ +/* + * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CORE_NUMBERS_H +#define OPENSSL_CORE_NUMBERS_H +#pragma once + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Generic function pointer for provider method arrays, or other contexts where + * functions of various signatures must occupy a common slot in an array of + * structures. + */ +typedef void (*OSSL_FUNC)(void); + +/*- + * Identities + * ---------- + * + * All series start with 1, to allow 0 to be an array terminator. + * For any FUNC identity, we also provide a function signature typedef + * and a static inline function to extract a function pointer from a + * OSSL_DISPATCH element in a type safe manner. + * + * Names: + * for any function base name 'foo' (uppercase form 'FOO'), we will have + * the following: + * - a macro for the identity with the name OSSL_FUNC_'FOO' or derivatives + * thereof (to be specified further down) + * - a function signature typedef with the name OSSL_FUNC_'foo'_fn + * - a function pointer extractor function with the name OSSL_FUNC_'foo' + */ + +/* + * Helper macro to create the function signature typedef and the extractor + * |type| is the return-type of the function, |name| is the name of the + * function to fetch, and |args| is a parenthesized list of parameters + * for the function (that is, it is |name|'s function signature). + * Note: This is considered a "reserved" internal macro. Applications should + * not use this or assume its existence. + */ +#define OSSL_CORE_MAKE_FUNC(type, name, args) \ + typedef type(OSSL_FUNC_##name##_fn) args; \ + static ossl_unused ossl_inline \ + OSSL_FUNC_##name##_fn * \ + OSSL_FUNC_##name(const OSSL_DISPATCH *opf) \ + { \ + return (OSSL_FUNC_##name##_fn *)opf->function; \ + } + +/* + * Core function identities, for the two OSSL_DISPATCH tables being passed + * in the OSSL_provider_init call. + * + * 0 serves as a marker for the end of the OSSL_DISPATCH array, and must + * therefore NEVER be used as a function identity. + */ +/* Functions provided by the Core to the provider, reserved numbers 1-1023 */ +#define OSSL_FUNC_CORE_GETTABLE_PARAMS 1 +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, + core_gettable_params, (const OSSL_CORE_HANDLE *prov)) +#define OSSL_FUNC_CORE_GET_PARAMS 2 +OSSL_CORE_MAKE_FUNC(int, core_get_params, (const OSSL_CORE_HANDLE *prov, OSSL_PARAM params[])) +#define OSSL_FUNC_CORE_THREAD_START 3 +OSSL_CORE_MAKE_FUNC(int, core_thread_start, (const OSSL_CORE_HANDLE *prov, OSSL_thread_stop_handler_fn handfn, void *arg)) +#define OSSL_FUNC_CORE_GET_LIBCTX 4 +OSSL_CORE_MAKE_FUNC(OPENSSL_CORE_CTX *, core_get_libctx, + (const OSSL_CORE_HANDLE *prov)) +#define OSSL_FUNC_CORE_NEW_ERROR 5 +OSSL_CORE_MAKE_FUNC(void, core_new_error, (const OSSL_CORE_HANDLE *prov)) +#define OSSL_FUNC_CORE_SET_ERROR_DEBUG 6 +OSSL_CORE_MAKE_FUNC(void, core_set_error_debug, + (const OSSL_CORE_HANDLE *prov, + const char *file, int line, const char *func)) +#define OSSL_FUNC_CORE_VSET_ERROR 7 +OSSL_CORE_MAKE_FUNC(void, core_vset_error, + (const OSSL_CORE_HANDLE *prov, + uint32_t reason, const char *fmt, va_list args)) +#define OSSL_FUNC_CORE_SET_ERROR_MARK 8 +OSSL_CORE_MAKE_FUNC(int, core_set_error_mark, (const OSSL_CORE_HANDLE *prov)) +#define OSSL_FUNC_CORE_CLEAR_LAST_ERROR_MARK 9 +OSSL_CORE_MAKE_FUNC(int, core_clear_last_error_mark, + (const OSSL_CORE_HANDLE *prov)) +#define OSSL_FUNC_CORE_POP_ERROR_TO_MARK 10 +OSSL_CORE_MAKE_FUNC(int, core_pop_error_to_mark, (const OSSL_CORE_HANDLE *prov)) + +/* Functions to access the OBJ database */ + +#define OSSL_FUNC_CORE_OBJ_ADD_SIGID 11 +#define OSSL_FUNC_CORE_OBJ_CREATE 12 + +OSSL_CORE_MAKE_FUNC(int, core_obj_add_sigid, + (const OSSL_CORE_HANDLE *prov, const char *sign_name, + const char *digest_name, const char *pkey_name)) +OSSL_CORE_MAKE_FUNC(int, core_obj_create, + (const OSSL_CORE_HANDLE *prov, const char *oid, + const char *sn, const char *ln)) + +/* Memory allocation, freeing, clearing. */ +#define OSSL_FUNC_CRYPTO_MALLOC 20 +OSSL_CORE_MAKE_FUNC(void *, + CRYPTO_malloc, (size_t num, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_ZALLOC 21 +OSSL_CORE_MAKE_FUNC(void *, + CRYPTO_zalloc, (size_t num, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_FREE 22 +OSSL_CORE_MAKE_FUNC(void, + CRYPTO_free, (void *ptr, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_CLEAR_FREE 23 +OSSL_CORE_MAKE_FUNC(void, + CRYPTO_clear_free, (void *ptr, size_t num, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_REALLOC 24 +OSSL_CORE_MAKE_FUNC(void *, + CRYPTO_realloc, (void *addr, size_t num, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_CLEAR_REALLOC 25 +OSSL_CORE_MAKE_FUNC(void *, + CRYPTO_clear_realloc, (void *addr, size_t old_num, size_t num, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_SECURE_MALLOC 26 +OSSL_CORE_MAKE_FUNC(void *, + CRYPTO_secure_malloc, (size_t num, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_SECURE_ZALLOC 27 +OSSL_CORE_MAKE_FUNC(void *, + CRYPTO_secure_zalloc, (size_t num, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_SECURE_FREE 28 +OSSL_CORE_MAKE_FUNC(void, + CRYPTO_secure_free, (void *ptr, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_SECURE_CLEAR_FREE 29 +OSSL_CORE_MAKE_FUNC(void, + CRYPTO_secure_clear_free, (void *ptr, size_t num, const char *file, int line)) +#define OSSL_FUNC_CRYPTO_SECURE_ALLOCATED 30 +OSSL_CORE_MAKE_FUNC(int, + CRYPTO_secure_allocated, (const void *ptr)) +#define OSSL_FUNC_OPENSSL_CLEANSE 31 +OSSL_CORE_MAKE_FUNC(void, + OPENSSL_cleanse, (void *ptr, size_t len)) + +/* Bio functions provided by the core */ +#define OSSL_FUNC_BIO_NEW_FILE 40 +#define OSSL_FUNC_BIO_NEW_MEMBUF 41 +#define OSSL_FUNC_BIO_READ_EX 42 +#define OSSL_FUNC_BIO_WRITE_EX 43 +#define OSSL_FUNC_BIO_UP_REF 44 +#define OSSL_FUNC_BIO_FREE 45 +#define OSSL_FUNC_BIO_VPRINTF 46 +#define OSSL_FUNC_BIO_VSNPRINTF 47 +#define OSSL_FUNC_BIO_PUTS 48 +#define OSSL_FUNC_BIO_GETS 49 +#define OSSL_FUNC_BIO_CTRL 50 + +OSSL_CORE_MAKE_FUNC(OSSL_CORE_BIO *, BIO_new_file, (const char *filename, const char *mode)) +OSSL_CORE_MAKE_FUNC(OSSL_CORE_BIO *, BIO_new_membuf, (const void *buf, int len)) +OSSL_CORE_MAKE_FUNC(int, BIO_read_ex, (OSSL_CORE_BIO *bio, void *data, size_t data_len, size_t *bytes_read)) +OSSL_CORE_MAKE_FUNC(int, BIO_write_ex, (OSSL_CORE_BIO *bio, const void *data, size_t data_len, size_t *written)) +OSSL_CORE_MAKE_FUNC(int, BIO_gets, (OSSL_CORE_BIO *bio, char *buf, int size)) +OSSL_CORE_MAKE_FUNC(int, BIO_puts, (OSSL_CORE_BIO *bio, const char *str)) +OSSL_CORE_MAKE_FUNC(int, BIO_up_ref, (OSSL_CORE_BIO *bio)) +OSSL_CORE_MAKE_FUNC(int, BIO_free, (OSSL_CORE_BIO *bio)) +OSSL_CORE_MAKE_FUNC(int, BIO_vprintf, (OSSL_CORE_BIO *bio, const char *format, va_list args)) +OSSL_CORE_MAKE_FUNC(int, BIO_vsnprintf, + (char *buf, size_t n, const char *fmt, va_list args)) +OSSL_CORE_MAKE_FUNC(int, BIO_ctrl, (OSSL_CORE_BIO *bio, int cmd, long num, void *ptr)) + +/* New seeding functions prototypes with the 101-104 series */ +#define OSSL_FUNC_CLEANUP_USER_ENTROPY 96 +#define OSSL_FUNC_CLEANUP_USER_NONCE 97 +#define OSSL_FUNC_GET_USER_ENTROPY 98 +#define OSSL_FUNC_GET_USER_NONCE 99 + +#define OSSL_FUNC_INDICATOR_CB 95 +OSSL_CORE_MAKE_FUNC(void, indicator_cb, (OPENSSL_CORE_CTX *ctx, OSSL_INDICATOR_CALLBACK **cb)) +#define OSSL_FUNC_SELF_TEST_CB 100 +OSSL_CORE_MAKE_FUNC(void, self_test_cb, (OPENSSL_CORE_CTX *ctx, OSSL_CALLBACK **cb, void **cbarg)) + +/* Functions to get seed material from the operating system */ +#define OSSL_FUNC_GET_ENTROPY 101 +#define OSSL_FUNC_CLEANUP_ENTROPY 102 +#define OSSL_FUNC_GET_NONCE 103 +#define OSSL_FUNC_CLEANUP_NONCE 104 +OSSL_CORE_MAKE_FUNC(size_t, get_entropy, (const OSSL_CORE_HANDLE *handle, unsigned char **pout, int entropy, size_t min_len, size_t max_len)) +OSSL_CORE_MAKE_FUNC(size_t, get_user_entropy, (const OSSL_CORE_HANDLE *handle, unsigned char **pout, int entropy, size_t min_len, size_t max_len)) +OSSL_CORE_MAKE_FUNC(void, cleanup_entropy, (const OSSL_CORE_HANDLE *handle, unsigned char *buf, size_t len)) +OSSL_CORE_MAKE_FUNC(void, cleanup_user_entropy, (const OSSL_CORE_HANDLE *handle, unsigned char *buf, size_t len)) +OSSL_CORE_MAKE_FUNC(size_t, get_nonce, (const OSSL_CORE_HANDLE *handle, unsigned char **pout, size_t min_len, size_t max_len, const void *salt, size_t salt_len)) +OSSL_CORE_MAKE_FUNC(size_t, get_user_nonce, (const OSSL_CORE_HANDLE *handle, unsigned char **pout, size_t min_len, size_t max_len, const void *salt, size_t salt_len)) +OSSL_CORE_MAKE_FUNC(void, cleanup_nonce, (const OSSL_CORE_HANDLE *handle, unsigned char *buf, size_t len)) +OSSL_CORE_MAKE_FUNC(void, cleanup_user_nonce, (const OSSL_CORE_HANDLE *handle, unsigned char *buf, size_t len)) + +/* Functions to access the core's providers */ +#define OSSL_FUNC_PROVIDER_REGISTER_CHILD_CB 105 +#define OSSL_FUNC_PROVIDER_DEREGISTER_CHILD_CB 106 +#define OSSL_FUNC_PROVIDER_NAME 107 +#define OSSL_FUNC_PROVIDER_GET0_PROVIDER_CTX 108 +#define OSSL_FUNC_PROVIDER_GET0_DISPATCH 109 +#define OSSL_FUNC_PROVIDER_UP_REF 110 +#define OSSL_FUNC_PROVIDER_FREE 111 + +OSSL_CORE_MAKE_FUNC(int, provider_register_child_cb, + (const OSSL_CORE_HANDLE *handle, + int (*create_cb)(const OSSL_CORE_HANDLE *provider, void *cbdata), + int (*remove_cb)(const OSSL_CORE_HANDLE *provider, void *cbdata), + int (*global_props_cb)(const char *props, void *cbdata), + void *cbdata)) +OSSL_CORE_MAKE_FUNC(void, provider_deregister_child_cb, + (const OSSL_CORE_HANDLE *handle)) +OSSL_CORE_MAKE_FUNC(const char *, provider_name, + (const OSSL_CORE_HANDLE *prov)) +OSSL_CORE_MAKE_FUNC(void *, provider_get0_provider_ctx, + (const OSSL_CORE_HANDLE *prov)) +OSSL_CORE_MAKE_FUNC(const OSSL_DISPATCH *, provider_get0_dispatch, + (const OSSL_CORE_HANDLE *prov)) +OSSL_CORE_MAKE_FUNC(int, provider_up_ref, + (const OSSL_CORE_HANDLE *prov, int activate)) +OSSL_CORE_MAKE_FUNC(int, provider_free, + (const OSSL_CORE_HANDLE *prov, int deactivate)) + +/* Additional error functions provided by the core */ +#define OSSL_FUNC_CORE_COUNT_TO_MARK 120 +OSSL_CORE_MAKE_FUNC(int, core_count_to_mark, (const OSSL_CORE_HANDLE *prov)) + +/* Functions provided by the provider to the Core, reserved numbers 1024-1535 */ +#define OSSL_FUNC_PROVIDER_TEARDOWN 1024 +OSSL_CORE_MAKE_FUNC(void, provider_teardown, (void *provctx)) +#define OSSL_FUNC_PROVIDER_GETTABLE_PARAMS 1025 +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, + provider_gettable_params, (void *provctx)) +#define OSSL_FUNC_PROVIDER_GET_PARAMS 1026 +OSSL_CORE_MAKE_FUNC(int, provider_get_params, (void *provctx, OSSL_PARAM params[])) +#define OSSL_FUNC_PROVIDER_QUERY_OPERATION 1027 +OSSL_CORE_MAKE_FUNC(const OSSL_ALGORITHM *, provider_query_operation, + (void *provctx, int operation_id, int *no_store)) +#define OSSL_FUNC_PROVIDER_UNQUERY_OPERATION 1028 +OSSL_CORE_MAKE_FUNC(void, provider_unquery_operation, + (void *provctx, int operation_id, const OSSL_ALGORITHM *)) +#define OSSL_FUNC_PROVIDER_GET_REASON_STRINGS 1029 +OSSL_CORE_MAKE_FUNC(const OSSL_ITEM *, provider_get_reason_strings, + (void *provctx)) +#define OSSL_FUNC_PROVIDER_GET_CAPABILITIES 1030 +OSSL_CORE_MAKE_FUNC(int, provider_get_capabilities, (void *provctx, const char *capability, OSSL_CALLBACK *cb, void *arg)) +#define OSSL_FUNC_PROVIDER_SELF_TEST 1031 +OSSL_CORE_MAKE_FUNC(int, provider_self_test, (void *provctx)) +#define OSSL_FUNC_PROVIDER_RANDOM_BYTES 1032 +OSSL_CORE_MAKE_FUNC(int, provider_random_bytes, (void *provctx, int which, void *buf, size_t n, unsigned int strength)) + +/* Libssl related functions */ +#define OSSL_FUNC_SSL_QUIC_TLS_CRYPTO_SEND 2001 +OSSL_CORE_MAKE_FUNC(int, SSL_QUIC_TLS_crypto_send, + (SSL *s, const unsigned char *buf, size_t buf_len, + size_t *consumed, void *arg)) +#define OSSL_FUNC_SSL_QUIC_TLS_CRYPTO_RECV_RCD 2002 +OSSL_CORE_MAKE_FUNC(int, SSL_QUIC_TLS_crypto_recv_rcd, + (SSL *s, const unsigned char **buf, size_t *bytes_read, + void *arg)) +#define OSSL_FUNC_SSL_QUIC_TLS_CRYPTO_RELEASE_RCD 2003 +OSSL_CORE_MAKE_FUNC(int, SSL_QUIC_TLS_crypto_release_rcd, + (SSL *s, size_t bytes_read, void *arg)) +#define OSSL_FUNC_SSL_QUIC_TLS_YIELD_SECRET 2004 +OSSL_CORE_MAKE_FUNC(int, SSL_QUIC_TLS_yield_secret, + (SSL *s, uint32_t prot_level, int direction, + const unsigned char *secret, size_t secret_len, void *arg)) +#define OSSL_FUNC_SSL_QUIC_TLS_GOT_TRANSPORT_PARAMS 2005 +OSSL_CORE_MAKE_FUNC(int, SSL_QUIC_TLS_got_transport_params, + (SSL *s, const unsigned char *params, size_t params_len, + void *arg)) +#define OSSL_FUNC_SSL_QUIC_TLS_ALERT 2006 +OSSL_CORE_MAKE_FUNC(int, SSL_QUIC_TLS_alert, + (SSL *s, unsigned char alert_code, void *arg)) + +/* Operations */ + +#define OSSL_OP_DIGEST 1 +#define OSSL_OP_CIPHER 2 /* Symmetric Ciphers */ +#define OSSL_OP_MAC 3 +#define OSSL_OP_KDF 4 +#define OSSL_OP_RAND 5 +#define OSSL_OP_KEYMGMT 10 +#define OSSL_OP_KEYEXCH 11 +#define OSSL_OP_SIGNATURE 12 +#define OSSL_OP_ASYM_CIPHER 13 +#define OSSL_OP_KEM 14 +#define OSSL_OP_SKEYMGMT 15 +/* New section for non-EVP operations */ +#define OSSL_OP_ENCODER 20 +#define OSSL_OP_DECODER 21 +#define OSSL_OP_STORE 22 +/* Highest known operation number */ +#define OSSL_OP__HIGHEST 22 + +/* Digests */ + +#define OSSL_FUNC_DIGEST_NEWCTX 1 +#define OSSL_FUNC_DIGEST_INIT 2 +#define OSSL_FUNC_DIGEST_UPDATE 3 +#define OSSL_FUNC_DIGEST_FINAL 4 +#define OSSL_FUNC_DIGEST_DIGEST 5 +#define OSSL_FUNC_DIGEST_FREECTX 6 +#define OSSL_FUNC_DIGEST_DUPCTX 7 +#define OSSL_FUNC_DIGEST_GET_PARAMS 8 +#define OSSL_FUNC_DIGEST_SET_CTX_PARAMS 9 +#define OSSL_FUNC_DIGEST_GET_CTX_PARAMS 10 +#define OSSL_FUNC_DIGEST_GETTABLE_PARAMS 11 +#define OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS 12 +#define OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS 13 +#define OSSL_FUNC_DIGEST_SQUEEZE 14 +#define OSSL_FUNC_DIGEST_COPYCTX 15 + +OSSL_CORE_MAKE_FUNC(void *, digest_newctx, (void *provctx)) +OSSL_CORE_MAKE_FUNC(int, digest_init, (void *dctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, digest_update, + (void *dctx, const unsigned char *in, size_t inl)) +OSSL_CORE_MAKE_FUNC(int, digest_final, + (void *dctx, + unsigned char *out, size_t *outl, size_t outsz)) +OSSL_CORE_MAKE_FUNC(int, digest_squeeze, + (void *dctx, + unsigned char *out, size_t *outl, size_t outsz)) +OSSL_CORE_MAKE_FUNC(int, digest_digest, + (void *provctx, const unsigned char *in, size_t inl, + unsigned char *out, size_t *outl, size_t outsz)) + +OSSL_CORE_MAKE_FUNC(void, digest_freectx, (void *dctx)) +OSSL_CORE_MAKE_FUNC(void *, digest_dupctx, (void *dctx)) +OSSL_CORE_MAKE_FUNC(void, digest_copyctx, (void *outctx, void *inctx)) + +OSSL_CORE_MAKE_FUNC(int, digest_get_params, (OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, digest_set_ctx_params, + (void *vctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, digest_get_ctx_params, + (void *vctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, digest_gettable_params, + (void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, digest_settable_ctx_params, + (void *dctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, digest_gettable_ctx_params, + (void *dctx, void *provctx)) + +/* Symmetric Ciphers */ + +#define OSSL_FUNC_CIPHER_NEWCTX 1 +#define OSSL_FUNC_CIPHER_ENCRYPT_INIT 2 +#define OSSL_FUNC_CIPHER_DECRYPT_INIT 3 +#define OSSL_FUNC_CIPHER_UPDATE 4 +#define OSSL_FUNC_CIPHER_FINAL 5 +#define OSSL_FUNC_CIPHER_CIPHER 6 +#define OSSL_FUNC_CIPHER_FREECTX 7 +#define OSSL_FUNC_CIPHER_DUPCTX 8 +#define OSSL_FUNC_CIPHER_GET_PARAMS 9 +#define OSSL_FUNC_CIPHER_GET_CTX_PARAMS 10 +#define OSSL_FUNC_CIPHER_SET_CTX_PARAMS 11 +#define OSSL_FUNC_CIPHER_GETTABLE_PARAMS 12 +#define OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS 13 +#define OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS 14 +#define OSSL_FUNC_CIPHER_PIPELINE_ENCRYPT_INIT 15 +#define OSSL_FUNC_CIPHER_PIPELINE_DECRYPT_INIT 16 +#define OSSL_FUNC_CIPHER_PIPELINE_UPDATE 17 +#define OSSL_FUNC_CIPHER_PIPELINE_FINAL 18 +#define OSSL_FUNC_CIPHER_ENCRYPT_SKEY_INIT 19 +#define OSSL_FUNC_CIPHER_DECRYPT_SKEY_INIT 20 + +OSSL_CORE_MAKE_FUNC(void *, cipher_newctx, (void *provctx)) +OSSL_CORE_MAKE_FUNC(int, cipher_encrypt_init, (void *cctx, const unsigned char *key, size_t keylen, const unsigned char *iv, size_t ivlen, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, cipher_decrypt_init, (void *cctx, const unsigned char *key, size_t keylen, const unsigned char *iv, size_t ivlen, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, cipher_update, + (void *cctx, + unsigned char *out, size_t *outl, size_t outsize, + const unsigned char *in, size_t inl)) +OSSL_CORE_MAKE_FUNC(int, cipher_final, + (void *cctx, + unsigned char *out, size_t *outl, size_t outsize)) +OSSL_CORE_MAKE_FUNC(int, cipher_cipher, + (void *cctx, + unsigned char *out, size_t *outl, size_t outsize, + const unsigned char *in, size_t inl)) +OSSL_CORE_MAKE_FUNC(int, cipher_pipeline_encrypt_init, + (void *cctx, + const unsigned char *key, size_t keylen, + size_t numpipes, const unsigned char **iv, size_t ivlen, + const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, cipher_pipeline_decrypt_init, + (void *cctx, + const unsigned char *key, size_t keylen, + size_t numpipes, const unsigned char **iv, size_t ivlen, + const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, cipher_pipeline_update, + (void *cctx, size_t numpipes, + unsigned char **out, size_t *outl, const size_t *outsize, + const unsigned char **in, const size_t *inl)) +OSSL_CORE_MAKE_FUNC(int, cipher_pipeline_final, + (void *cctx, size_t numpipes, + unsigned char **out, size_t *outl, const size_t *outsize)) +OSSL_CORE_MAKE_FUNC(void, cipher_freectx, (void *cctx)) +OSSL_CORE_MAKE_FUNC(void *, cipher_dupctx, (void *cctx)) +OSSL_CORE_MAKE_FUNC(int, cipher_get_params, (OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, cipher_get_ctx_params, (void *cctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, cipher_set_ctx_params, (void *cctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, cipher_gettable_params, + (void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, cipher_settable_ctx_params, + (void *cctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, cipher_gettable_ctx_params, + (void *cctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, cipher_encrypt_skey_init, (void *cctx, void *skeydata, const unsigned char *iv, size_t ivlen, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, cipher_decrypt_skey_init, (void *cctx, void *skeydata, const unsigned char *iv, size_t ivlen, const OSSL_PARAM params[])) + +/* MACs */ + +#define OSSL_FUNC_MAC_NEWCTX 1 +#define OSSL_FUNC_MAC_DUPCTX 2 +#define OSSL_FUNC_MAC_FREECTX 3 +#define OSSL_FUNC_MAC_INIT 4 +#define OSSL_FUNC_MAC_UPDATE 5 +#define OSSL_FUNC_MAC_FINAL 6 +#define OSSL_FUNC_MAC_GET_PARAMS 7 +#define OSSL_FUNC_MAC_GET_CTX_PARAMS 8 +#define OSSL_FUNC_MAC_SET_CTX_PARAMS 9 +#define OSSL_FUNC_MAC_GETTABLE_PARAMS 10 +#define OSSL_FUNC_MAC_GETTABLE_CTX_PARAMS 11 +#define OSSL_FUNC_MAC_SETTABLE_CTX_PARAMS 12 +#define OSSL_FUNC_MAC_INIT_SKEY 13 + +OSSL_CORE_MAKE_FUNC(void *, mac_newctx, (void *provctx)) +OSSL_CORE_MAKE_FUNC(void *, mac_dupctx, (void *src)) +OSSL_CORE_MAKE_FUNC(void, mac_freectx, (void *mctx)) +OSSL_CORE_MAKE_FUNC(int, mac_init, (void *mctx, const unsigned char *key, size_t keylen, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, mac_update, + (void *mctx, const unsigned char *in, size_t inl)) +OSSL_CORE_MAKE_FUNC(int, mac_final, + (void *mctx, + unsigned char *out, size_t *outl, size_t outsize)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, mac_gettable_params, (void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, mac_gettable_ctx_params, + (void *mctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, mac_settable_ctx_params, + (void *mctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, mac_get_params, (OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, mac_get_ctx_params, + (void *mctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, mac_set_ctx_params, + (void *mctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, mac_init_skey, (void *mctx, void *key, const OSSL_PARAM params[])) + +/*- + * Symmetric key management + * + * The Key Management takes care of provider side of symmetric key objects, and + * includes essentially everything that manipulates the keys themselves and + * their parameters. + * + * The key objects are commonly referred to as |keydata|, and it MUST be able + * to contain parameters if the key has any, and the secret key. + * + * Key objects are created with OSSL_FUNC_skeymgmt_import() (there is no + * dedicated memory allocation function), exported with + * OSSL_FUNC_skeymgmt_export() and destroyed with OSSL_FUNC_keymgmt_free(). + * + */ + +/* Key data subset selection - individual bits */ +#define OSSL_SKEYMGMT_SELECT_PARAMETERS 0x01 +#define OSSL_SKEYMGMT_SELECT_SECRET_KEY 0x02 + +/* Key data subset selection - combinations */ +#define OSSL_SKEYMGMT_SELECT_ALL \ + (OSSL_SKEYMGMT_SELECT_PARAMETERS | OSSL_SKEYMGMT_SELECT_SECRET_KEY) + +#define OSSL_FUNC_SKEYMGMT_FREE 1 +#define OSSL_FUNC_SKEYMGMT_IMPORT 2 +#define OSSL_FUNC_SKEYMGMT_EXPORT 3 +#define OSSL_FUNC_SKEYMGMT_GENERATE 4 +#define OSSL_FUNC_SKEYMGMT_GET_KEY_ID 5 +#define OSSL_FUNC_SKEYMGMT_IMP_SETTABLE_PARAMS 6 +#define OSSL_FUNC_SKEYMGMT_GEN_SETTABLE_PARAMS 7 + +OSSL_CORE_MAKE_FUNC(void, skeymgmt_free, (void *keydata)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, + skeymgmt_imp_settable_params, (void *provctx)) +OSSL_CORE_MAKE_FUNC(void *, skeymgmt_import, (void *provctx, int selection, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, skeymgmt_export, + (void *keydata, int selection, + OSSL_CALLBACK *param_cb, void *cbarg)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, + skeymgmt_gen_settable_params, (void *provctx)) +OSSL_CORE_MAKE_FUNC(void *, skeymgmt_generate, (void *provctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const char *, skeymgmt_get_key_id, (void *keydata)) + +/* KDFs and PRFs */ + +#define OSSL_FUNC_KDF_NEWCTX 1 +#define OSSL_FUNC_KDF_DUPCTX 2 +#define OSSL_FUNC_KDF_FREECTX 3 +#define OSSL_FUNC_KDF_RESET 4 +#define OSSL_FUNC_KDF_DERIVE 5 +#define OSSL_FUNC_KDF_GETTABLE_PARAMS 6 +#define OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS 7 +#define OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS 8 +#define OSSL_FUNC_KDF_GET_PARAMS 9 +#define OSSL_FUNC_KDF_GET_CTX_PARAMS 10 +#define OSSL_FUNC_KDF_SET_CTX_PARAMS 11 +#define OSSL_FUNC_KDF_SET_SKEY 12 +#define OSSL_FUNC_KDF_DERIVE_SKEY 13 + +OSSL_CORE_MAKE_FUNC(void *, kdf_newctx, (void *provctx)) +OSSL_CORE_MAKE_FUNC(void *, kdf_dupctx, (void *src)) +OSSL_CORE_MAKE_FUNC(void, kdf_freectx, (void *kctx)) +OSSL_CORE_MAKE_FUNC(void, kdf_reset, (void *kctx)) +OSSL_CORE_MAKE_FUNC(int, kdf_derive, (void *kctx, unsigned char *key, size_t keylen, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, kdf_gettable_params, (void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, kdf_gettable_ctx_params, + (void *kctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, kdf_settable_ctx_params, + (void *kctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, kdf_get_params, (OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, kdf_get_ctx_params, + (void *kctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, kdf_set_ctx_params, + (void *kctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, kdf_set_skey, + (void *kctx, void *skeydata, const char *paramname)) +OSSL_CORE_MAKE_FUNC(void *, kdf_derive_skey, (void *ctx, const char *key_type, void *provctx, OSSL_FUNC_skeymgmt_import_fn *import, size_t keylen, const OSSL_PARAM params[])) + +/* RAND */ + +#define OSSL_FUNC_RAND_NEWCTX 1 +#define OSSL_FUNC_RAND_FREECTX 2 +#define OSSL_FUNC_RAND_INSTANTIATE 3 +#define OSSL_FUNC_RAND_UNINSTANTIATE 4 +#define OSSL_FUNC_RAND_GENERATE 5 +#define OSSL_FUNC_RAND_RESEED 6 +#define OSSL_FUNC_RAND_NONCE 7 +#define OSSL_FUNC_RAND_ENABLE_LOCKING 8 +#define OSSL_FUNC_RAND_LOCK 9 +#define OSSL_FUNC_RAND_UNLOCK 10 +#define OSSL_FUNC_RAND_GETTABLE_PARAMS 11 +#define OSSL_FUNC_RAND_GETTABLE_CTX_PARAMS 12 +#define OSSL_FUNC_RAND_SETTABLE_CTX_PARAMS 13 +#define OSSL_FUNC_RAND_GET_PARAMS 14 +#define OSSL_FUNC_RAND_GET_CTX_PARAMS 15 +#define OSSL_FUNC_RAND_SET_CTX_PARAMS 16 +#define OSSL_FUNC_RAND_VERIFY_ZEROIZATION 17 +#define OSSL_FUNC_RAND_GET_SEED 18 +#define OSSL_FUNC_RAND_CLEAR_SEED 19 + +OSSL_CORE_MAKE_FUNC(void *, rand_newctx, + (void *provctx, void *parent, + const OSSL_DISPATCH *parent_calls)) +OSSL_CORE_MAKE_FUNC(void, rand_freectx, (void *vctx)) +OSSL_CORE_MAKE_FUNC(int, rand_instantiate, + (void *vdrbg, unsigned int strength, + int prediction_resistance, + const unsigned char *pstr, size_t pstr_len, + const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, rand_uninstantiate, (void *vdrbg)) +OSSL_CORE_MAKE_FUNC(int, rand_generate, + (void *vctx, unsigned char *out, size_t outlen, + unsigned int strength, int prediction_resistance, + const unsigned char *addin, size_t addin_len)) +OSSL_CORE_MAKE_FUNC(int, rand_reseed, + (void *vctx, int prediction_resistance, + const unsigned char *ent, size_t ent_len, + const unsigned char *addin, size_t addin_len)) +OSSL_CORE_MAKE_FUNC(size_t, rand_nonce, + (void *vctx, unsigned char *out, unsigned int strength, + size_t min_noncelen, size_t max_noncelen)) +OSSL_CORE_MAKE_FUNC(int, rand_enable_locking, (void *vctx)) +OSSL_CORE_MAKE_FUNC(int, rand_lock, (void *vctx)) +OSSL_CORE_MAKE_FUNC(void, rand_unlock, (void *vctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, rand_gettable_params, (void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, rand_gettable_ctx_params, + (void *vctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, rand_settable_ctx_params, + (void *vctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, rand_get_params, (OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, rand_get_ctx_params, + (void *vctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, rand_set_ctx_params, + (void *vctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(void, rand_set_callbacks, + (void *vctx, OSSL_INOUT_CALLBACK *get_entropy, + OSSL_CALLBACK *cleanup_entropy, + OSSL_INOUT_CALLBACK *get_nonce, + OSSL_CALLBACK *cleanup_nonce, void *arg)) +OSSL_CORE_MAKE_FUNC(int, rand_verify_zeroization, + (void *vctx)) +OSSL_CORE_MAKE_FUNC(size_t, rand_get_seed, + (void *vctx, unsigned char **buffer, + int entropy, size_t min_len, size_t max_len, + int prediction_resistance, + const unsigned char *adin, size_t adin_len)) +OSSL_CORE_MAKE_FUNC(void, rand_clear_seed, + (void *vctx, unsigned char *buffer, size_t b_len)) + +/*- + * Key management + * + * The Key Management takes care of provider side key objects, and includes + * all current functionality to create them, destroy them, set parameters + * and key material, etc, essentially everything that manipulates the keys + * themselves and their parameters. + * + * The key objects are commonly referred to as |keydata|, and it MUST be able + * to contain parameters if the key has any, the public key and the private + * key. All parts are optional, but their presence determines what can be + * done with the key object in terms of encryption, signature, and so on. + * The assumption from libcrypto is that the key object contains any of the + * following data combinations: + * + * - parameters only + * - public key only + * - public key + private key + * - parameters + public key + * - parameters + public key + private key + * + * What "parameters", "public key" and "private key" means in detail is left + * to the implementation. In the case of DH and DSA, they would typically + * include domain parameters, while for certain variants of RSA, they would + * typically include PSS or OAEP parameters. + * + * Key objects are created with OSSL_FUNC_keymgmt_new() and destroyed with + * OSSL_FUNC_keymgmt_free(). Key objects can have data filled in with + * OSSL_FUNC_keymgmt_import(). + * + * Three functions are made available to check what selection of data is + * present in a key object: OSSL_FUNC_keymgmt_has_parameters(), + * OSSL_FUNC_keymgmt_has_public_key(), and OSSL_FUNC_keymgmt_has_private_key(), + */ + +/* Key data subset selection - individual bits */ +#define OSSL_KEYMGMT_SELECT_PRIVATE_KEY 0x01 +#define OSSL_KEYMGMT_SELECT_PUBLIC_KEY 0x02 +#define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS 0x04 +#define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS 0x80 + +/* Key data subset selection - combinations */ +#define OSSL_KEYMGMT_SELECT_ALL_PARAMETERS \ + (OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS \ + | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) +#define OSSL_KEYMGMT_SELECT_KEYPAIR \ + (OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY) +#define OSSL_KEYMGMT_SELECT_ALL \ + (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS) + +#define OSSL_KEYMGMT_VALIDATE_FULL_CHECK 0 +#define OSSL_KEYMGMT_VALIDATE_QUICK_CHECK 1 + +/* Basic key object creation */ +#define OSSL_FUNC_KEYMGMT_NEW 1 +OSSL_CORE_MAKE_FUNC(void *, keymgmt_new, (void *provctx)) + +/* Generation, a more complex constructor */ +#define OSSL_FUNC_KEYMGMT_GEN_INIT 2 +#define OSSL_FUNC_KEYMGMT_GEN_SET_TEMPLATE 3 +#define OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS 4 +#define OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS 5 +#define OSSL_FUNC_KEYMGMT_GEN 6 +#define OSSL_FUNC_KEYMGMT_GEN_CLEANUP 7 +#define OSSL_FUNC_KEYMGMT_GEN_GET_PARAMS 15 +#define OSSL_FUNC_KEYMGMT_GEN_GETTABLE_PARAMS 16 + +OSSL_CORE_MAKE_FUNC(void *, keymgmt_gen_init, + (void *provctx, int selection, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, keymgmt_gen_set_template, + (void *genctx, void *templ)) +OSSL_CORE_MAKE_FUNC(int, keymgmt_gen_set_params, + (void *genctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, + keymgmt_gen_settable_params, + (void *genctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, keymgmt_gen_get_params, + (void *genctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keymgmt_gen_gettable_params, + (void *genctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(void *, keymgmt_gen, + (void *genctx, OSSL_CALLBACK *cb, void *cbarg)) +OSSL_CORE_MAKE_FUNC(void, keymgmt_gen_cleanup, (void *genctx)) + +/* Key loading by object reference */ +#define OSSL_FUNC_KEYMGMT_LOAD 8 +OSSL_CORE_MAKE_FUNC(void *, keymgmt_load, + (const void *reference, size_t reference_sz)) + +/* Basic key object destruction */ +#define OSSL_FUNC_KEYMGMT_FREE 10 +OSSL_CORE_MAKE_FUNC(void, keymgmt_free, (void *keydata)) + +/* Key object information, with discovery */ +#define OSSL_FUNC_KEYMGMT_GET_PARAMS 11 +#define OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS 12 +OSSL_CORE_MAKE_FUNC(int, keymgmt_get_params, + (void *keydata, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keymgmt_gettable_params, + (void *provctx)) + +#define OSSL_FUNC_KEYMGMT_SET_PARAMS 13 +#define OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS 14 +OSSL_CORE_MAKE_FUNC(int, keymgmt_set_params, + (void *keydata, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keymgmt_settable_params, + (void *provctx)) + +/* Key checks - discovery of supported operations */ +#define OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME 20 +OSSL_CORE_MAKE_FUNC(const char *, keymgmt_query_operation_name, + (int operation_id)) + +/* Key checks - key data content checks */ +#define OSSL_FUNC_KEYMGMT_HAS 21 +OSSL_CORE_MAKE_FUNC(int, keymgmt_has, (const void *keydata, int selection)) + +/* Key checks - validation */ +#define OSSL_FUNC_KEYMGMT_VALIDATE 22 +OSSL_CORE_MAKE_FUNC(int, keymgmt_validate, (const void *keydata, int selection, int checktype)) + +/* Key checks - matching */ +#define OSSL_FUNC_KEYMGMT_MATCH 23 +OSSL_CORE_MAKE_FUNC(int, keymgmt_match, + (const void *keydata1, const void *keydata2, + int selection)) + +/* Import and export functions, with discovery */ +#define OSSL_FUNC_KEYMGMT_IMPORT 40 +#define OSSL_FUNC_KEYMGMT_IMPORT_TYPES 41 +#define OSSL_FUNC_KEYMGMT_EXPORT 42 +#define OSSL_FUNC_KEYMGMT_EXPORT_TYPES 43 +OSSL_CORE_MAKE_FUNC(int, keymgmt_import, + (void *keydata, int selection, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keymgmt_import_types, + (int selection)) +OSSL_CORE_MAKE_FUNC(int, keymgmt_export, + (void *keydata, int selection, + OSSL_CALLBACK *param_cb, void *cbarg)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keymgmt_export_types, + (int selection)) + +/* Dup function, constructor */ +#define OSSL_FUNC_KEYMGMT_DUP 44 +OSSL_CORE_MAKE_FUNC(void *, keymgmt_dup, + (const void *keydata_from, int selection)) + +/* Extended import and export functions */ +#define OSSL_FUNC_KEYMGMT_IMPORT_TYPES_EX 45 +#define OSSL_FUNC_KEYMGMT_EXPORT_TYPES_EX 46 +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keymgmt_import_types_ex, + (void *provctx, int selection)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keymgmt_export_types_ex, + (void *provctx, int selection)) + +/* Key Exchange */ + +#define OSSL_FUNC_KEYEXCH_NEWCTX 1 +#define OSSL_FUNC_KEYEXCH_INIT 2 +#define OSSL_FUNC_KEYEXCH_DERIVE 3 +#define OSSL_FUNC_KEYEXCH_SET_PEER 4 +#define OSSL_FUNC_KEYEXCH_FREECTX 5 +#define OSSL_FUNC_KEYEXCH_DUPCTX 6 +#define OSSL_FUNC_KEYEXCH_SET_CTX_PARAMS 7 +#define OSSL_FUNC_KEYEXCH_SETTABLE_CTX_PARAMS 8 +#define OSSL_FUNC_KEYEXCH_GET_CTX_PARAMS 9 +#define OSSL_FUNC_KEYEXCH_GETTABLE_CTX_PARAMS 10 +#define OSSL_FUNC_KEYEXCH_DERIVE_SKEY 11 + +OSSL_CORE_MAKE_FUNC(void *, keyexch_newctx, (void *provctx)) +OSSL_CORE_MAKE_FUNC(int, keyexch_init, (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, keyexch_derive, (void *ctx, unsigned char *secret, size_t *secretlen, size_t outlen)) +OSSL_CORE_MAKE_FUNC(int, keyexch_set_peer, (void *ctx, void *provkey)) +OSSL_CORE_MAKE_FUNC(void, keyexch_freectx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(void *, keyexch_dupctx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(int, keyexch_set_ctx_params, (void *ctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keyexch_settable_ctx_params, + (void *ctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, keyexch_get_ctx_params, (void *ctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keyexch_gettable_ctx_params, + (void *ctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(void *, keyexch_derive_skey, (void *ctx, const char *key_type, void *provctx, OSSL_FUNC_skeymgmt_import_fn *import, size_t keylen, const OSSL_PARAM params[])) + +/* Signature */ + +#define OSSL_FUNC_SIGNATURE_NEWCTX 1 +#define OSSL_FUNC_SIGNATURE_SIGN_INIT 2 +#define OSSL_FUNC_SIGNATURE_SIGN 3 +#define OSSL_FUNC_SIGNATURE_VERIFY_INIT 4 +#define OSSL_FUNC_SIGNATURE_VERIFY 5 +#define OSSL_FUNC_SIGNATURE_VERIFY_RECOVER_INIT 6 +#define OSSL_FUNC_SIGNATURE_VERIFY_RECOVER 7 +#define OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT 8 +#define OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE 9 +#define OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL 10 +#define OSSL_FUNC_SIGNATURE_DIGEST_SIGN 11 +#define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT 12 +#define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE 13 +#define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL 14 +#define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY 15 +#define OSSL_FUNC_SIGNATURE_FREECTX 16 +#define OSSL_FUNC_SIGNATURE_DUPCTX 17 +#define OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS 18 +#define OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS 19 +#define OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS 20 +#define OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS 21 +#define OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS 22 +#define OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS 23 +#define OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS 24 +#define OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS 25 +#define OSSL_FUNC_SIGNATURE_QUERY_KEY_TYPES 26 +#define OSSL_FUNC_SIGNATURE_SIGN_MESSAGE_INIT 27 +#define OSSL_FUNC_SIGNATURE_SIGN_MESSAGE_UPDATE 28 +#define OSSL_FUNC_SIGNATURE_SIGN_MESSAGE_FINAL 29 +#define OSSL_FUNC_SIGNATURE_VERIFY_MESSAGE_INIT 30 +#define OSSL_FUNC_SIGNATURE_VERIFY_MESSAGE_UPDATE 31 +#define OSSL_FUNC_SIGNATURE_VERIFY_MESSAGE_FINAL 32 + +OSSL_CORE_MAKE_FUNC(void *, signature_newctx, (void *provctx, const char *propq)) +OSSL_CORE_MAKE_FUNC(int, signature_sign_init, (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, signature_sign, (void *ctx, unsigned char *sig, size_t *siglen, size_t sigsize, const unsigned char *tbs, size_t tbslen)) +OSSL_CORE_MAKE_FUNC(int, signature_sign_message_init, + (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, signature_sign_message_update, + (void *ctx, const unsigned char *in, size_t inlen)) +OSSL_CORE_MAKE_FUNC(int, signature_sign_message_final, + (void *ctx, unsigned char *sig, + size_t *siglen, size_t sigsize)) +OSSL_CORE_MAKE_FUNC(int, signature_verify_init, (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, signature_verify, (void *ctx, const unsigned char *sig, size_t siglen, const unsigned char *tbs, size_t tbslen)) +OSSL_CORE_MAKE_FUNC(int, signature_verify_message_init, + (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, signature_verify_message_update, + (void *ctx, const unsigned char *in, size_t inlen)) +/* + * signature_verify_final requires that the signature to be verified against + * is specified via an OSSL_PARAM. + */ +OSSL_CORE_MAKE_FUNC(int, signature_verify_message_final, (void *ctx)) +OSSL_CORE_MAKE_FUNC(int, signature_verify_recover_init, + (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, signature_verify_recover, + (void *ctx, unsigned char *rout, size_t *routlen, + size_t routsize, const unsigned char *sig, size_t siglen)) +OSSL_CORE_MAKE_FUNC(int, signature_digest_sign_init, + (void *ctx, const char *mdname, void *provkey, + const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, signature_digest_sign_update, + (void *ctx, const unsigned char *data, size_t datalen)) +OSSL_CORE_MAKE_FUNC(int, signature_digest_sign_final, + (void *ctx, unsigned char *sig, size_t *siglen, + size_t sigsize)) +OSSL_CORE_MAKE_FUNC(int, signature_digest_sign, + (void *ctx, unsigned char *sigret, size_t *siglen, + size_t sigsize, const unsigned char *tbs, size_t tbslen)) +OSSL_CORE_MAKE_FUNC(int, signature_digest_verify_init, + (void *ctx, const char *mdname, void *provkey, + const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, signature_digest_verify_update, + (void *ctx, const unsigned char *data, size_t datalen)) +OSSL_CORE_MAKE_FUNC(int, signature_digest_verify_final, + (void *ctx, const unsigned char *sig, size_t siglen)) +OSSL_CORE_MAKE_FUNC(int, signature_digest_verify, + (void *ctx, const unsigned char *sig, size_t siglen, + const unsigned char *tbs, size_t tbslen)) +OSSL_CORE_MAKE_FUNC(void, signature_freectx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(void *, signature_dupctx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(int, signature_get_ctx_params, + (void *ctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, signature_gettable_ctx_params, + (void *ctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, signature_set_ctx_params, + (void *ctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, signature_settable_ctx_params, + (void *ctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, signature_get_ctx_md_params, + (void *ctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, signature_gettable_ctx_md_params, + (void *ctx)) +OSSL_CORE_MAKE_FUNC(int, signature_set_ctx_md_params, + (void *ctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, signature_settable_ctx_md_params, + (void *ctx)) +OSSL_CORE_MAKE_FUNC(const char **, signature_query_key_types, (void)) + +/* Asymmetric Ciphers */ + +#define OSSL_FUNC_ASYM_CIPHER_NEWCTX 1 +#define OSSL_FUNC_ASYM_CIPHER_ENCRYPT_INIT 2 +#define OSSL_FUNC_ASYM_CIPHER_ENCRYPT 3 +#define OSSL_FUNC_ASYM_CIPHER_DECRYPT_INIT 4 +#define OSSL_FUNC_ASYM_CIPHER_DECRYPT 5 +#define OSSL_FUNC_ASYM_CIPHER_FREECTX 6 +#define OSSL_FUNC_ASYM_CIPHER_DUPCTX 7 +#define OSSL_FUNC_ASYM_CIPHER_GET_CTX_PARAMS 8 +#define OSSL_FUNC_ASYM_CIPHER_GETTABLE_CTX_PARAMS 9 +#define OSSL_FUNC_ASYM_CIPHER_SET_CTX_PARAMS 10 +#define OSSL_FUNC_ASYM_CIPHER_SETTABLE_CTX_PARAMS 11 + +OSSL_CORE_MAKE_FUNC(void *, asym_cipher_newctx, (void *provctx)) +OSSL_CORE_MAKE_FUNC(int, asym_cipher_encrypt_init, (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, asym_cipher_encrypt, (void *ctx, unsigned char *out, size_t *outlen, size_t outsize, const unsigned char *in, size_t inlen)) +OSSL_CORE_MAKE_FUNC(int, asym_cipher_decrypt_init, (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, asym_cipher_decrypt, (void *ctx, unsigned char *out, size_t *outlen, size_t outsize, const unsigned char *in, size_t inlen)) +OSSL_CORE_MAKE_FUNC(void, asym_cipher_freectx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(void *, asym_cipher_dupctx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(int, asym_cipher_get_ctx_params, + (void *ctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, asym_cipher_gettable_ctx_params, + (void *ctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, asym_cipher_set_ctx_params, + (void *ctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, asym_cipher_settable_ctx_params, + (void *ctx, void *provctx)) + +/* Asymmetric Key encapsulation */ +#define OSSL_FUNC_KEM_NEWCTX 1 +#define OSSL_FUNC_KEM_ENCAPSULATE_INIT 2 +#define OSSL_FUNC_KEM_ENCAPSULATE 3 +#define OSSL_FUNC_KEM_DECAPSULATE_INIT 4 +#define OSSL_FUNC_KEM_DECAPSULATE 5 +#define OSSL_FUNC_KEM_FREECTX 6 +#define OSSL_FUNC_KEM_DUPCTX 7 +#define OSSL_FUNC_KEM_GET_CTX_PARAMS 8 +#define OSSL_FUNC_KEM_GETTABLE_CTX_PARAMS 9 +#define OSSL_FUNC_KEM_SET_CTX_PARAMS 10 +#define OSSL_FUNC_KEM_SETTABLE_CTX_PARAMS 11 +#define OSSL_FUNC_KEM_AUTH_ENCAPSULATE_INIT 12 +#define OSSL_FUNC_KEM_AUTH_DECAPSULATE_INIT 13 + +OSSL_CORE_MAKE_FUNC(void *, kem_newctx, (void *provctx)) +OSSL_CORE_MAKE_FUNC(int, kem_encapsulate_init, (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, kem_auth_encapsulate_init, (void *ctx, void *provkey, void *authprivkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, kem_encapsulate, (void *ctx, unsigned char *out, size_t *outlen, unsigned char *secret, size_t *secretlen)) +OSSL_CORE_MAKE_FUNC(int, kem_decapsulate_init, (void *ctx, void *provkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, kem_auth_decapsulate_init, (void *ctx, void *provkey, void *authpubkey, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, kem_decapsulate, (void *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen)) +OSSL_CORE_MAKE_FUNC(void, kem_freectx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(void *, kem_dupctx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(int, kem_get_ctx_params, (void *ctx, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, kem_gettable_ctx_params, + (void *ctx, void *provctx)) +OSSL_CORE_MAKE_FUNC(int, kem_set_ctx_params, + (void *ctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, kem_settable_ctx_params, + (void *ctx, void *provctx)) + +/* Encoders and decoders */ +#define OSSL_FUNC_ENCODER_NEWCTX 1 +#define OSSL_FUNC_ENCODER_FREECTX 2 +#define OSSL_FUNC_ENCODER_GET_PARAMS 3 +#define OSSL_FUNC_ENCODER_GETTABLE_PARAMS 4 +#define OSSL_FUNC_ENCODER_SET_CTX_PARAMS 5 +#define OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS 6 +#define OSSL_FUNC_ENCODER_DOES_SELECTION 10 +#define OSSL_FUNC_ENCODER_ENCODE 11 +#define OSSL_FUNC_ENCODER_IMPORT_OBJECT 20 +#define OSSL_FUNC_ENCODER_FREE_OBJECT 21 +OSSL_CORE_MAKE_FUNC(void *, encoder_newctx, (void *provctx)) +OSSL_CORE_MAKE_FUNC(void, encoder_freectx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(int, encoder_get_params, (OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, encoder_gettable_params, + (void *provctx)) +OSSL_CORE_MAKE_FUNC(int, encoder_set_ctx_params, + (void *ctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, encoder_settable_ctx_params, + (void *provctx)) + +OSSL_CORE_MAKE_FUNC(int, encoder_does_selection, + (void *provctx, int selection)) +OSSL_CORE_MAKE_FUNC(int, encoder_encode, + (void *ctx, OSSL_CORE_BIO *out, + const void *obj_raw, const OSSL_PARAM obj_abstract[], + int selection, + OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)) + +OSSL_CORE_MAKE_FUNC(void *, encoder_import_object, + (void *ctx, int selection, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(void, encoder_free_object, (void *obj)) + +#define OSSL_FUNC_DECODER_NEWCTX 1 +#define OSSL_FUNC_DECODER_FREECTX 2 +#define OSSL_FUNC_DECODER_GET_PARAMS 3 +#define OSSL_FUNC_DECODER_GETTABLE_PARAMS 4 +#define OSSL_FUNC_DECODER_SET_CTX_PARAMS 5 +#define OSSL_FUNC_DECODER_SETTABLE_CTX_PARAMS 6 +#define OSSL_FUNC_DECODER_DOES_SELECTION 10 +#define OSSL_FUNC_DECODER_DECODE 11 +#define OSSL_FUNC_DECODER_EXPORT_OBJECT 20 +OSSL_CORE_MAKE_FUNC(void *, decoder_newctx, (void *provctx)) +OSSL_CORE_MAKE_FUNC(void, decoder_freectx, (void *ctx)) +OSSL_CORE_MAKE_FUNC(int, decoder_get_params, (OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, decoder_gettable_params, + (void *provctx)) +OSSL_CORE_MAKE_FUNC(int, decoder_set_ctx_params, + (void *ctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, decoder_settable_ctx_params, + (void *provctx)) + +OSSL_CORE_MAKE_FUNC(int, decoder_does_selection, + (void *provctx, int selection)) +OSSL_CORE_MAKE_FUNC(int, decoder_decode, + (void *ctx, OSSL_CORE_BIO *in, int selection, + OSSL_CALLBACK *data_cb, void *data_cbarg, + OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg)) +OSSL_CORE_MAKE_FUNC(int, decoder_export_object, + (void *ctx, const void *objref, size_t objref_sz, + OSSL_CALLBACK *export_cb, void *export_cbarg)) + +/*- + * Store + * + * Objects are scanned by using the 'open', 'load', 'eof' and 'close' + * functions, which implement an OSSL_STORE loader. + * + * store_load() works in a way that's very similar to the decoders, in + * that they pass an abstract object through a callback, either as a DER + * octet string or as an object reference, which libcrypto will have to + * deal with. + */ + +#define OSSL_FUNC_STORE_OPEN 1 +#define OSSL_FUNC_STORE_ATTACH 2 +#define OSSL_FUNC_STORE_SETTABLE_CTX_PARAMS 3 +#define OSSL_FUNC_STORE_SET_CTX_PARAMS 4 +#define OSSL_FUNC_STORE_LOAD 5 +#define OSSL_FUNC_STORE_EOF 6 +#define OSSL_FUNC_STORE_CLOSE 7 +#define OSSL_FUNC_STORE_EXPORT_OBJECT 8 +#define OSSL_FUNC_STORE_DELETE 9 +#define OSSL_FUNC_STORE_OPEN_EX 10 +OSSL_CORE_MAKE_FUNC(void *, store_open, (void *provctx, const char *uri)) +OSSL_CORE_MAKE_FUNC(void *, store_attach, (void *provctx, OSSL_CORE_BIO *in)) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, store_settable_ctx_params, + (void *provctx)) +OSSL_CORE_MAKE_FUNC(int, store_set_ctx_params, + (void *loaderctx, const OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(int, store_load, + (void *loaderctx, + OSSL_CALLBACK *object_cb, void *object_cbarg, + OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg)) +OSSL_CORE_MAKE_FUNC(int, store_eof, (void *loaderctx)) +OSSL_CORE_MAKE_FUNC(int, store_close, (void *loaderctx)) +OSSL_CORE_MAKE_FUNC(int, store_export_object, + (void *loaderctx, const void *objref, size_t objref_sz, + OSSL_CALLBACK *export_cb, void *export_cbarg)) +OSSL_CORE_MAKE_FUNC(int, store_delete, + (void *provctx, const char *uri, const OSSL_PARAM params[], + OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg)) +OSSL_CORE_MAKE_FUNC(void *, store_open_ex, + (void *provctx, const char *uri, const OSSL_PARAM params[], + OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg)) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/core_names.h b/VCMP-LUA/modules/postgresql/include/openssl/core_names.h new file mode 100644 index 0000000..4c55606 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/core_names.h @@ -0,0 +1,588 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\core_names.h.in + * + * Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_CORE_NAMES_H +#define OPENSSL_CORE_NAMES_H +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/* OSSL_CIPHER_PARAM_CTS_MODE Values */ +#define OSSL_CIPHER_CTS_MODE_CS1 "CS1" +#define OSSL_CIPHER_CTS_MODE_CS2 "CS2" +#define OSSL_CIPHER_CTS_MODE_CS3 "CS3" + +/* Known CIPHER names (not a complete list) */ +#define OSSL_CIPHER_NAME_AES_128_GCM_SIV "AES-128-GCM-SIV" +#define OSSL_CIPHER_NAME_AES_192_GCM_SIV "AES-192-GCM-SIV" +#define OSSL_CIPHER_NAME_AES_256_GCM_SIV "AES-256-GCM-SIV" + +/* Known DIGEST names (not a complete list) */ +#define OSSL_DIGEST_NAME_MD5 "MD5" +#define OSSL_DIGEST_NAME_MD5_SHA1 "MD5-SHA1" +#define OSSL_DIGEST_NAME_SHA1 "SHA1" +#define OSSL_DIGEST_NAME_SHA2_224 "SHA2-224" +#define OSSL_DIGEST_NAME_SHA2_256 "SHA2-256" +#define OSSL_DIGEST_NAME_SHA2_256_192 "SHA2-256/192" +#define OSSL_DIGEST_NAME_SHA2_384 "SHA2-384" +#define OSSL_DIGEST_NAME_SHA2_512 "SHA2-512" +#define OSSL_DIGEST_NAME_SHA2_512_224 "SHA2-512/224" +#define OSSL_DIGEST_NAME_SHA2_512_256 "SHA2-512/256" +#define OSSL_DIGEST_NAME_MD2 "MD2" +#define OSSL_DIGEST_NAME_MD4 "MD4" +#define OSSL_DIGEST_NAME_MDC2 "MDC2" +#define OSSL_DIGEST_NAME_RIPEMD160 "RIPEMD160" +#define OSSL_DIGEST_NAME_SHA3_224 "SHA3-224" +#define OSSL_DIGEST_NAME_SHA3_256 "SHA3-256" +#define OSSL_DIGEST_NAME_SHA3_384 "SHA3-384" +#define OSSL_DIGEST_NAME_SHA3_512 "SHA3-512" +#define OSSL_DIGEST_NAME_KECCAK_KMAC128 "KECCAK-KMAC-128" +#define OSSL_DIGEST_NAME_KECCAK_KMAC256 "KECCAK-KMAC-256" +#define OSSL_DIGEST_NAME_SM3 "SM3" + +/* Known MAC names */ +#define OSSL_MAC_NAME_BLAKE2BMAC "BLAKE2BMAC" +#define OSSL_MAC_NAME_BLAKE2SMAC "BLAKE2SMAC" +#define OSSL_MAC_NAME_CMAC "CMAC" +#define OSSL_MAC_NAME_GMAC "GMAC" +#define OSSL_MAC_NAME_HMAC "HMAC" +#define OSSL_MAC_NAME_KMAC128 "KMAC128" +#define OSSL_MAC_NAME_KMAC256 "KMAC256" +#define OSSL_MAC_NAME_POLY1305 "POLY1305" +#define OSSL_MAC_NAME_SIPHASH "SIPHASH" + +/* Known KDF names */ +#define OSSL_KDF_NAME_HKDF "HKDF" +#define OSSL_KDF_NAME_HKDF_SHA256 "HKDF-SHA256" +#define OSSL_KDF_NAME_HKDF_SHA384 "HKDF-SHA384" +#define OSSL_KDF_NAME_HKDF_SHA512 "HKDF-SHA512" +#define OSSL_KDF_NAME_TLS1_3_KDF "TLS13-KDF" +#define OSSL_KDF_NAME_PBKDF1 "PBKDF1" +#define OSSL_KDF_NAME_PBKDF2 "PBKDF2" +#define OSSL_KDF_NAME_SCRYPT "SCRYPT" +#define OSSL_KDF_NAME_SSHKDF "SSHKDF" +#define OSSL_KDF_NAME_SSKDF "SSKDF" +#define OSSL_KDF_NAME_TLS1_PRF "TLS1-PRF" +#define OSSL_KDF_NAME_X942KDF_ASN1 "X942KDF-ASN1" +#define OSSL_KDF_NAME_X942KDF_CONCAT "X942KDF-CONCAT" +#define OSSL_KDF_NAME_X963KDF "X963KDF" +#define OSSL_KDF_NAME_KBKDF "KBKDF" +#define OSSL_KDF_NAME_KRB5KDF "KRB5KDF" +#define OSSL_KDF_NAME_HMACDRBGKDF "HMAC-DRBG-KDF" + +/* RSA padding modes */ +#define OSSL_PKEY_RSA_PAD_MODE_NONE "none" +#define OSSL_PKEY_RSA_PAD_MODE_PKCSV15 "pkcs1" +#define OSSL_PKEY_RSA_PAD_MODE_OAEP "oaep" +#define OSSL_PKEY_RSA_PAD_MODE_X931 "x931" +#define OSSL_PKEY_RSA_PAD_MODE_PSS "pss" + +/* RSA pss padding salt length */ +#define OSSL_PKEY_RSA_PSS_SALT_LEN_DIGEST "digest" +#define OSSL_PKEY_RSA_PSS_SALT_LEN_MAX "max" +#define OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO "auto" +#define OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO_DIGEST_MAX "auto-digestmax" + +/* OSSL_PKEY_PARAM_EC_ENCODING values */ +#define OSSL_PKEY_EC_ENCODING_EXPLICIT "explicit" +#define OSSL_PKEY_EC_ENCODING_GROUP "named_curve" + +#define OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_UNCOMPRESSED "uncompressed" +#define OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_COMPRESSED "compressed" +#define OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_HYBRID "hybrid" + +#define OSSL_PKEY_EC_GROUP_CHECK_DEFAULT "default" +#define OSSL_PKEY_EC_GROUP_CHECK_NAMED "named" +#define OSSL_PKEY_EC_GROUP_CHECK_NAMED_NIST "named-nist" + +/* PROV_SKEY well known key types */ +#define OSSL_SKEY_TYPE_GENERIC "GENERIC-SECRET" +#define OSSL_SKEY_TYPE_AES "AES" + +/* OSSL_KEM_PARAM_OPERATION values */ +#define OSSL_KEM_PARAM_OPERATION_RSASVE "RSASVE" +#define OSSL_KEM_PARAM_OPERATION_DHKEM "DHKEM" + +/* Provider configuration variables */ +#define OSSL_PKEY_RETAIN_SEED "pkey_retain_seed" + +/* Parameter name definitions - generated by util/perl/OpenSSL/paramnames.pm */ +/* clang-format off */ +# define OSSL_ALG_PARAM_ALGORITHM_ID "algorithm-id" +# define OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS "algorithm-id-params" +# define OSSL_ALG_PARAM_CIPHER "cipher" +# define OSSL_ALG_PARAM_DIGEST "digest" +# define OSSL_ALG_PARAM_ENGINE "engine" +# define OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR "fips-indicator" +# define OSSL_ALG_PARAM_MAC "mac" +# define OSSL_ALG_PARAM_PROPERTIES "properties" +# define OSSL_ALG_PARAM_SECURITY_CATEGORY "security-category" +# define OSSL_ASYM_CIPHER_PARAM_DIGEST OSSL_PKEY_PARAM_DIGEST +# define OSSL_ASYM_CIPHER_PARAM_ENGINE OSSL_PKEY_PARAM_ENGINE +# define OSSL_ASYM_CIPHER_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_ASYM_CIPHER_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK +# define OSSL_ASYM_CIPHER_PARAM_FIPS_RSA_PKCS15_PAD_DISABLED OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED +# define OSSL_ASYM_CIPHER_PARAM_IMPLICIT_REJECTION "implicit-rejection" +# define OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST +# define OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS OSSL_PKEY_PARAM_MGF1_PROPERTIES +# define OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST OSSL_ALG_PARAM_DIGEST +# define OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS "digest-props" +# define OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL "oaep-label" +# define OSSL_ASYM_CIPHER_PARAM_PAD_MODE OSSL_PKEY_PARAM_PAD_MODE +# define OSSL_ASYM_CIPHER_PARAM_PROPERTIES OSSL_PKEY_PARAM_PROPERTIES +# define OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION "tls-client-version" +# define OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION "tls-negotiated-version" +# define OSSL_CAPABILITY_TLS_GROUP_ALG "tls-group-alg" +# define OSSL_CAPABILITY_TLS_GROUP_ID "tls-group-id" +# define OSSL_CAPABILITY_TLS_GROUP_IS_KEM "tls-group-is-kem" +# define OSSL_CAPABILITY_TLS_GROUP_MAX_DTLS "tls-max-dtls" +# define OSSL_CAPABILITY_TLS_GROUP_MAX_TLS "tls-max-tls" +# define OSSL_CAPABILITY_TLS_GROUP_MIN_DTLS "tls-min-dtls" +# define OSSL_CAPABILITY_TLS_GROUP_MIN_TLS "tls-min-tls" +# define OSSL_CAPABILITY_TLS_GROUP_NAME "tls-group-name" +# define OSSL_CAPABILITY_TLS_GROUP_NAME_INTERNAL "tls-group-name-internal" +# define OSSL_CAPABILITY_TLS_GROUP_SECURITY_BITS "tls-group-sec-bits" +# define OSSL_CAPABILITY_TLS_SIGALG_CODE_POINT "tls-sigalg-code-point" +# define OSSL_CAPABILITY_TLS_SIGALG_HASH_NAME "tls-sigalg-hash-name" +# define OSSL_CAPABILITY_TLS_SIGALG_HASH_OID "tls-sigalg-hash-oid" +# define OSSL_CAPABILITY_TLS_SIGALG_IANA_NAME "tls-sigalg-iana-name" +# define OSSL_CAPABILITY_TLS_SIGALG_KEYTYPE "tls-sigalg-keytype" +# define OSSL_CAPABILITY_TLS_SIGALG_KEYTYPE_OID "tls-sigalg-keytype-oid" +# define OSSL_CAPABILITY_TLS_SIGALG_MAX_DTLS "tls-max-dtls" +# define OSSL_CAPABILITY_TLS_SIGALG_MAX_TLS "tls-max-tls" +# define OSSL_CAPABILITY_TLS_SIGALG_MIN_DTLS "tls-min-dtls" +# define OSSL_CAPABILITY_TLS_SIGALG_MIN_TLS "tls-min-tls" +# define OSSL_CAPABILITY_TLS_SIGALG_NAME "tls-sigalg-name" +# define OSSL_CAPABILITY_TLS_SIGALG_OID "tls-sigalg-oid" +# define OSSL_CAPABILITY_TLS_SIGALG_SECURITY_BITS "tls-sigalg-sec-bits" +# define OSSL_CAPABILITY_TLS_SIGALG_SIG_NAME "tls-sigalg-sig-name" +# define OSSL_CAPABILITY_TLS_SIGALG_SIG_OID "tls-sigalg-sig-oid" +# define OSSL_CIPHER_HMAC_PARAM_MAC OSSL_CIPHER_PARAM_AEAD_TAG +# define OSSL_CIPHER_PARAM_AEAD "aead" +# define OSSL_CIPHER_PARAM_AEAD_IVLEN OSSL_CIPHER_PARAM_IVLEN +# define OSSL_CIPHER_PARAM_AEAD_IV_GENERATED "iv-generated" +# define OSSL_CIPHER_PARAM_AEAD_MAC_KEY "mackey" +# define OSSL_CIPHER_PARAM_AEAD_TAG "tag" +# define OSSL_CIPHER_PARAM_AEAD_TAGLEN "taglen" +# define OSSL_CIPHER_PARAM_AEAD_TLS1_AAD "tlsaad" +# define OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD "tlsaadpad" +# define OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN "tlsivgen" +# define OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED "tlsivfixed" +# define OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV "tlsivinv" +# define OSSL_CIPHER_PARAM_ALGORITHM_ID OSSL_ALG_PARAM_ALGORITHM_ID +# define OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS +# define OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS_OLD "alg_id_param" +# define OSSL_CIPHER_PARAM_BLOCK_SIZE "blocksize" +# define OSSL_CIPHER_PARAM_CTS "cts" +# define OSSL_CIPHER_PARAM_CTS_MODE "cts_mode" +# define OSSL_CIPHER_PARAM_CUSTOM_IV "custom-iv" +# define OSSL_CIPHER_PARAM_DECRYPT_ONLY "decrypt-only" +# define OSSL_CIPHER_PARAM_ENCRYPT_THEN_MAC "encrypt-then-mac" +# define OSSL_CIPHER_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_CIPHER_PARAM_FIPS_ENCRYPT_CHECK "encrypt-check" +# define OSSL_CIPHER_PARAM_HAS_RAND_KEY "has-randkey" +# define OSSL_CIPHER_PARAM_IV "iv" +# define OSSL_CIPHER_PARAM_IVLEN "ivlen" +# define OSSL_CIPHER_PARAM_KEYLEN "keylen" +# define OSSL_CIPHER_PARAM_MODE "mode" +# define OSSL_CIPHER_PARAM_NUM "num" +# define OSSL_CIPHER_PARAM_PADDING "padding" +# define OSSL_CIPHER_PARAM_PIPELINE_AEAD_TAG "pipeline-tag" +# define OSSL_CIPHER_PARAM_RANDOM_KEY "randkey" +# define OSSL_CIPHER_PARAM_RC2_KEYBITS "keybits" +# define OSSL_CIPHER_PARAM_ROUNDS "rounds" +# define OSSL_CIPHER_PARAM_SPEED "speed" +# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK "tls-multi" +# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD "tls1multi_aad" +# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN "tls1multi_aadpacklen" +# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC "tls1multi_enc" +# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN "tls1multi_encin" +# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN "tls1multi_enclen" +# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE "tls1multi_interleave" +# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE "tls1multi_maxbufsz" +# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT "tls1multi_maxsndfrag" +# define OSSL_CIPHER_PARAM_TLS_MAC "tls-mac" +# define OSSL_CIPHER_PARAM_TLS_MAC_SIZE "tls-mac-size" +# define OSSL_CIPHER_PARAM_TLS_VERSION "tls-version" +# define OSSL_CIPHER_PARAM_UPDATED_IV "updated-iv" +# define OSSL_CIPHER_PARAM_USE_BITS "use-bits" +# define OSSL_CIPHER_PARAM_XTS_STANDARD "xts_standard" +# define OSSL_DECODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES +# define OSSL_DIGEST_PARAM_ALGID_ABSENT "algid-absent" +# define OSSL_DIGEST_PARAM_BLOCK_SIZE "blocksize" +# define OSSL_DIGEST_PARAM_MICALG "micalg" +# define OSSL_DIGEST_PARAM_PAD_TYPE "pad-type" +# define OSSL_DIGEST_PARAM_SIZE "size" +# define OSSL_DIGEST_PARAM_SSL3_MS "ssl3-ms" +# define OSSL_DIGEST_PARAM_XOF "xof" +# define OSSL_DIGEST_PARAM_XOFLEN "xoflen" +# define OSSL_DRBG_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER +# define OSSL_DRBG_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST +# define OSSL_DRBG_PARAM_ENTROPY_REQUIRED "entropy_required" +# define OSSL_DRBG_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_DRBG_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK +# define OSSL_DRBG_PARAM_MAC OSSL_ALG_PARAM_MAC +# define OSSL_DRBG_PARAM_MAX_ADINLEN "max_adinlen" +# define OSSL_DRBG_PARAM_MAX_ENTROPYLEN "max_entropylen" +# define OSSL_DRBG_PARAM_MAX_LENGTH "maxium_length" +# define OSSL_DRBG_PARAM_MAX_NONCELEN "max_noncelen" +# define OSSL_DRBG_PARAM_MAX_PERSLEN "max_perslen" +# define OSSL_DRBG_PARAM_MIN_ENTROPYLEN "min_entropylen" +# define OSSL_DRBG_PARAM_MIN_LENGTH "minium_length" +# define OSSL_DRBG_PARAM_MIN_NONCELEN "min_noncelen" +# define OSSL_DRBG_PARAM_PREDICTION_RESISTANCE "prediction_resistance" +# define OSSL_DRBG_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES +# define OSSL_DRBG_PARAM_RANDOM_DATA "random_data" +# define OSSL_DRBG_PARAM_RESEED_COUNTER "reseed_counter" +# define OSSL_DRBG_PARAM_RESEED_REQUESTS "reseed_requests" +# define OSSL_DRBG_PARAM_RESEED_TIME "reseed_time" +# define OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL "reseed_time_interval" +# define OSSL_DRBG_PARAM_SIZE "size" +# define OSSL_DRBG_PARAM_USE_DF "use_derivation_function" +# define OSSL_ENCODER_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER +# define OSSL_ENCODER_PARAM_ENCRYPT_LEVEL "encrypt-level" +# define OSSL_ENCODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES +# define OSSL_ENCODER_PARAM_SAVE_PARAMETERS "save-parameters" +# define OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE "ecdh-cofactor-mode" +# define OSSL_EXCHANGE_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_EXCHANGE_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK +# define OSSL_EXCHANGE_PARAM_FIPS_ECDH_COFACTOR_CHECK OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK +# define OSSL_EXCHANGE_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK +# define OSSL_EXCHANGE_PARAM_KDF_DIGEST "kdf-digest" +# define OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS "kdf-digest-props" +# define OSSL_EXCHANGE_PARAM_KDF_OUTLEN "kdf-outlen" +# define OSSL_EXCHANGE_PARAM_KDF_TYPE "kdf-type" +# define OSSL_EXCHANGE_PARAM_KDF_UKM "kdf-ukm" +# define OSSL_EXCHANGE_PARAM_PAD "pad" +# define OSSL_GEN_PARAM_ITERATION "iteration" +# define OSSL_GEN_PARAM_POTENTIAL "potential" +# define OSSL_KDF_PARAM_ARGON2_AD "ad" +# define OSSL_KDF_PARAM_ARGON2_LANES "lanes" +# define OSSL_KDF_PARAM_ARGON2_MEMCOST "memcost" +# define OSSL_KDF_PARAM_ARGON2_VERSION "version" +# define OSSL_KDF_PARAM_CEK_ALG "cekalg" +# define OSSL_KDF_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER +# define OSSL_KDF_PARAM_CONSTANT "constant" +# define OSSL_KDF_PARAM_DATA "data" +# define OSSL_KDF_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST +# define OSSL_KDF_PARAM_EARLY_CLEAN "early_clean" +# define OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_KDF_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK +# define OSSL_KDF_PARAM_FIPS_EMS_CHECK "ems_check" +# define OSSL_KDF_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK +# define OSSL_KDF_PARAM_HMACDRBG_ENTROPY "entropy" +# define OSSL_KDF_PARAM_HMACDRBG_NONCE "nonce" +# define OSSL_KDF_PARAM_INFO "info" +# define OSSL_KDF_PARAM_ITER "iter" +# define OSSL_KDF_PARAM_KBKDF_R "r" +# define OSSL_KDF_PARAM_KBKDF_USE_L "use-l" +# define OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR "use-separator" +# define OSSL_KDF_PARAM_KEY "key" +# define OSSL_KDF_PARAM_LABEL "label" +# define OSSL_KDF_PARAM_MAC OSSL_ALG_PARAM_MAC +# define OSSL_KDF_PARAM_MAC_SIZE "maclen" +# define OSSL_KDF_PARAM_MODE "mode" +# define OSSL_KDF_PARAM_PASSWORD "pass" +# define OSSL_KDF_PARAM_PKCS12_ID "id" +# define OSSL_KDF_PARAM_PKCS5 "pkcs5" +# define OSSL_KDF_PARAM_PREFIX "prefix" +# define OSSL_KDF_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES +# define OSSL_KDF_PARAM_SALT "salt" +# define OSSL_KDF_PARAM_SCRYPT_MAXMEM "maxmem_bytes" +# define OSSL_KDF_PARAM_SCRYPT_N "n" +# define OSSL_KDF_PARAM_SCRYPT_P "p" +# define OSSL_KDF_PARAM_SCRYPT_R "r" +# define OSSL_KDF_PARAM_SECRET "secret" +# define OSSL_KDF_PARAM_SEED "seed" +# define OSSL_KDF_PARAM_SIZE "size" +# define OSSL_KDF_PARAM_SSHKDF_SESSION_ID "session_id" +# define OSSL_KDF_PARAM_SSHKDF_TYPE "type" +# define OSSL_KDF_PARAM_SSHKDF_XCGHASH "xcghash" +# define OSSL_KDF_PARAM_THREADS "threads" +# define OSSL_KDF_PARAM_UKM "ukm" +# define OSSL_KDF_PARAM_X942_ACVPINFO "acvp-info" +# define OSSL_KDF_PARAM_X942_PARTYUINFO "partyu-info" +# define OSSL_KDF_PARAM_X942_PARTYVINFO "partyv-info" +# define OSSL_KDF_PARAM_X942_SUPP_PRIVINFO "supp-privinfo" +# define OSSL_KDF_PARAM_X942_SUPP_PUBINFO "supp-pubinfo" +# define OSSL_KDF_PARAM_X942_USE_KEYBITS "use-keybits" +# define OSSL_KEM_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_KEM_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK +# define OSSL_KEM_PARAM_IKME "ikme" +# define OSSL_KEM_PARAM_OPERATION "operation" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_BLOCK_PADDING "block_padding" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_HS_PADDING "hs_padding" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_EARLY_DATA "max_early_data" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_FRAG_LEN "max_frag_len" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_MODE "mode" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_OPTIONS "options" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_READ_AHEAD "read_ahead" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_STREAM_MAC "stream_mac" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_TLSTREE "tlstree" +# define OSSL_LIBSSL_RECORD_LAYER_PARAM_USE_ETM "use_etm" +# define OSSL_LIBSSL_RECORD_LAYER_READ_BUFFER_LEN "read_buffer_len" +# define OSSL_MAC_PARAM_BLOCK_SIZE "block-size" +# define OSSL_MAC_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER +# define OSSL_MAC_PARAM_CUSTOM "custom" +# define OSSL_MAC_PARAM_C_ROUNDS "c-rounds" +# define OSSL_MAC_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST +# define OSSL_MAC_PARAM_DIGEST_NOINIT "digest-noinit" +# define OSSL_MAC_PARAM_DIGEST_ONESHOT "digest-oneshot" +# define OSSL_MAC_PARAM_D_ROUNDS "d-rounds" +# define OSSL_MAC_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_MAC_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK +# define OSSL_MAC_PARAM_FIPS_NO_SHORT_MAC OSSL_PROV_PARAM_NO_SHORT_MAC +# define OSSL_MAC_PARAM_IV "iv" +# define OSSL_MAC_PARAM_KEY "key" +# define OSSL_MAC_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES +# define OSSL_MAC_PARAM_SALT "salt" +# define OSSL_MAC_PARAM_SIZE "size" +# define OSSL_MAC_PARAM_TLS_DATA_SIZE "tls-data-size" +# define OSSL_MAC_PARAM_XOF "xof" +# define OSSL_OBJECT_PARAM_DATA "data" +# define OSSL_OBJECT_PARAM_DATA_STRUCTURE "data-structure" +# define OSSL_OBJECT_PARAM_DATA_TYPE "data-type" +# define OSSL_OBJECT_PARAM_DESC "desc" +# define OSSL_OBJECT_PARAM_INPUT_TYPE "input-type" +# define OSSL_OBJECT_PARAM_REFERENCE "reference" +# define OSSL_OBJECT_PARAM_TYPE "type" +# define OSSL_PASSPHRASE_PARAM_INFO "info" +# define OSSL_PKEY_PARAM_ALGORITHM_ID OSSL_ALG_PARAM_ALGORITHM_ID +# define OSSL_PKEY_PARAM_ALGORITHM_ID_PARAMS OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS +# define OSSL_PKEY_PARAM_BITS "bits" +# define OSSL_PKEY_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER +# define OSSL_PKEY_PARAM_CMS_KEMRI_KDF_ALGORITHM "kemri-kdf-alg" +# define OSSL_PKEY_PARAM_CMS_RI_TYPE "ri-type" +# define OSSL_PKEY_PARAM_DEFAULT_DIGEST "default-digest" +# define OSSL_PKEY_PARAM_DHKEM_IKM "dhkem-ikm" +# define OSSL_PKEY_PARAM_DH_GENERATOR "safeprime-generator" +# define OSSL_PKEY_PARAM_DH_PRIV_LEN "priv_len" +# define OSSL_PKEY_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST +# define OSSL_PKEY_PARAM_DIGEST_SIZE "digest-size" +# define OSSL_PKEY_PARAM_DIST_ID "distid" +# define OSSL_PKEY_PARAM_EC_A "a" +# define OSSL_PKEY_PARAM_EC_B "b" +# define OSSL_PKEY_PARAM_EC_CHAR2_M "m" +# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K1 "k1" +# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K2 "k2" +# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K3 "k3" +# define OSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS "tp" +# define OSSL_PKEY_PARAM_EC_CHAR2_TYPE "basis-type" +# define OSSL_PKEY_PARAM_EC_COFACTOR "cofactor" +# define OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS "decoded-from-explicit" +# define OSSL_PKEY_PARAM_EC_ENCODING "encoding" +# define OSSL_PKEY_PARAM_EC_FIELD_TYPE "field-type" +# define OSSL_PKEY_PARAM_EC_GENERATOR "generator" +# define OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE "group-check" +# define OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC "include-public" +# define OSSL_PKEY_PARAM_EC_ORDER "order" +# define OSSL_PKEY_PARAM_EC_P "p" +# define OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT "point-format" +# define OSSL_PKEY_PARAM_EC_PUB_X "qx" +# define OSSL_PKEY_PARAM_EC_PUB_Y "qy" +# define OSSL_PKEY_PARAM_EC_SEED "seed" +# define OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY "encoded-pub-key" +# define OSSL_PKEY_PARAM_ENGINE OSSL_ALG_PARAM_ENGINE +# define OSSL_PKEY_PARAM_FFC_COFACTOR "j" +# define OSSL_PKEY_PARAM_FFC_DIGEST OSSL_PKEY_PARAM_DIGEST +# define OSSL_PKEY_PARAM_FFC_DIGEST_PROPS OSSL_PKEY_PARAM_PROPERTIES +# define OSSL_PKEY_PARAM_FFC_G "g" +# define OSSL_PKEY_PARAM_FFC_GINDEX "gindex" +# define OSSL_PKEY_PARAM_FFC_H "hindex" +# define OSSL_PKEY_PARAM_FFC_P "p" +# define OSSL_PKEY_PARAM_FFC_PBITS "pbits" +# define OSSL_PKEY_PARAM_FFC_PCOUNTER "pcounter" +# define OSSL_PKEY_PARAM_FFC_Q "q" +# define OSSL_PKEY_PARAM_FFC_QBITS "qbits" +# define OSSL_PKEY_PARAM_FFC_SEED "seed" +# define OSSL_PKEY_PARAM_FFC_TYPE "type" +# define OSSL_PKEY_PARAM_FFC_VALIDATE_G "validate-g" +# define OSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY "validate-legacy" +# define OSSL_PKEY_PARAM_FFC_VALIDATE_PQ "validate-pq" +# define OSSL_PKEY_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK "digest-check" +# define OSSL_PKEY_PARAM_FIPS_KEY_CHECK "key-check" +# define OSSL_PKEY_PARAM_FIPS_SIGN_CHECK "sign-check" +# define OSSL_PKEY_PARAM_GROUP_NAME "group" +# define OSSL_PKEY_PARAM_IMPLICIT_REJECTION "implicit-rejection" +# define OSSL_PKEY_PARAM_MANDATORY_DIGEST "mandatory-digest" +# define OSSL_PKEY_PARAM_MASKGENFUNC "mgf" +# define OSSL_PKEY_PARAM_MAX_SIZE "max-size" +# define OSSL_PKEY_PARAM_MGF1_DIGEST "mgf1-digest" +# define OSSL_PKEY_PARAM_MGF1_PROPERTIES "mgf1-properties" +# define OSSL_PKEY_PARAM_ML_DSA_INPUT_FORMATS "ml-dsa.input_formats" +# define OSSL_PKEY_PARAM_ML_DSA_OUTPUT_FORMATS "ml-dsa.output_formats" +# define OSSL_PKEY_PARAM_ML_DSA_PREFER_SEED "ml-dsa.prefer_seed" +# define OSSL_PKEY_PARAM_ML_DSA_RETAIN_SEED "ml-dsa.retain_seed" +# define OSSL_PKEY_PARAM_ML_DSA_SEED "seed" +# define OSSL_PKEY_PARAM_ML_KEM_IMPORT_PCT_TYPE "ml-kem.import_pct_type" +# define OSSL_PKEY_PARAM_ML_KEM_INPUT_FORMATS "ml-kem.input_formats" +# define OSSL_PKEY_PARAM_ML_KEM_OUTPUT_FORMATS "ml-kem.output_formats" +# define OSSL_PKEY_PARAM_ML_KEM_PREFER_SEED "ml-kem.prefer_seed" +# define OSSL_PKEY_PARAM_ML_KEM_RETAIN_SEED "ml-kem.retain_seed" +# define OSSL_PKEY_PARAM_ML_KEM_SEED "seed" +# define OSSL_PKEY_PARAM_PAD_MODE "pad-mode" +# define OSSL_PKEY_PARAM_PRIV_KEY "priv" +# define OSSL_PKEY_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES +# define OSSL_PKEY_PARAM_PUB_KEY "pub" +# define OSSL_PKEY_PARAM_RSA_BITS OSSL_PKEY_PARAM_BITS +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT "rsa-coefficient" +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT1 "rsa-coefficient1" +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT2 "rsa-coefficient2" +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT3 "rsa-coefficient3" +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT4 "rsa-coefficient4" +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT5 "rsa-coefficient5" +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT6 "rsa-coefficient6" +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT7 "rsa-coefficient7" +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT8 "rsa-coefficient8" +# define OSSL_PKEY_PARAM_RSA_COEFFICIENT9 "rsa-coefficient9" +# define OSSL_PKEY_PARAM_RSA_D "d" +# define OSSL_PKEY_PARAM_RSA_DERIVE_FROM_PQ "rsa-derive-from-pq" +# define OSSL_PKEY_PARAM_RSA_DIGEST OSSL_PKEY_PARAM_DIGEST +# define OSSL_PKEY_PARAM_RSA_DIGEST_PROPS OSSL_PKEY_PARAM_PROPERTIES +# define OSSL_PKEY_PARAM_RSA_E "e" +# define OSSL_PKEY_PARAM_RSA_EXPONENT "rsa-exponent" +# define OSSL_PKEY_PARAM_RSA_EXPONENT1 "rsa-exponent1" +# define OSSL_PKEY_PARAM_RSA_EXPONENT10 "rsa-exponent10" +# define OSSL_PKEY_PARAM_RSA_EXPONENT2 "rsa-exponent2" +# define OSSL_PKEY_PARAM_RSA_EXPONENT3 "rsa-exponent3" +# define OSSL_PKEY_PARAM_RSA_EXPONENT4 "rsa-exponent4" +# define OSSL_PKEY_PARAM_RSA_EXPONENT5 "rsa-exponent5" +# define OSSL_PKEY_PARAM_RSA_EXPONENT6 "rsa-exponent6" +# define OSSL_PKEY_PARAM_RSA_EXPONENT7 "rsa-exponent7" +# define OSSL_PKEY_PARAM_RSA_EXPONENT8 "rsa-exponent8" +# define OSSL_PKEY_PARAM_RSA_EXPONENT9 "rsa-exponent9" +# define OSSL_PKEY_PARAM_RSA_FACTOR "rsa-factor" +# define OSSL_PKEY_PARAM_RSA_FACTOR1 "rsa-factor1" +# define OSSL_PKEY_PARAM_RSA_FACTOR10 "rsa-factor10" +# define OSSL_PKEY_PARAM_RSA_FACTOR2 "rsa-factor2" +# define OSSL_PKEY_PARAM_RSA_FACTOR3 "rsa-factor3" +# define OSSL_PKEY_PARAM_RSA_FACTOR4 "rsa-factor4" +# define OSSL_PKEY_PARAM_RSA_FACTOR5 "rsa-factor5" +# define OSSL_PKEY_PARAM_RSA_FACTOR6 "rsa-factor6" +# define OSSL_PKEY_PARAM_RSA_FACTOR7 "rsa-factor7" +# define OSSL_PKEY_PARAM_RSA_FACTOR8 "rsa-factor8" +# define OSSL_PKEY_PARAM_RSA_FACTOR9 "rsa-factor9" +# define OSSL_PKEY_PARAM_RSA_MASKGENFUNC OSSL_PKEY_PARAM_MASKGENFUNC +# define OSSL_PKEY_PARAM_RSA_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST +# define OSSL_PKEY_PARAM_RSA_N "n" +# define OSSL_PKEY_PARAM_RSA_PRIMES "primes" +# define OSSL_PKEY_PARAM_RSA_PSS_SALTLEN "saltlen" +# define OSSL_PKEY_PARAM_RSA_TEST_P1 "p1" +# define OSSL_PKEY_PARAM_RSA_TEST_P2 "p2" +# define OSSL_PKEY_PARAM_RSA_TEST_Q1 "q1" +# define OSSL_PKEY_PARAM_RSA_TEST_Q2 "q2" +# define OSSL_PKEY_PARAM_RSA_TEST_XP "xp" +# define OSSL_PKEY_PARAM_RSA_TEST_XP1 "xp1" +# define OSSL_PKEY_PARAM_RSA_TEST_XP2 "xp2" +# define OSSL_PKEY_PARAM_RSA_TEST_XQ "xq" +# define OSSL_PKEY_PARAM_RSA_TEST_XQ1 "xq1" +# define OSSL_PKEY_PARAM_RSA_TEST_XQ2 "xq2" +# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits" +# define OSSL_PKEY_PARAM_SECURITY_CATEGORY OSSL_ALG_PARAM_SECURITY_CATEGORY +# define OSSL_PKEY_PARAM_SLH_DSA_SEED "seed" +# define OSSL_PKEY_PARAM_USE_COFACTOR_ECDH OSSL_PKEY_PARAM_USE_COFACTOR_FLAG +# define OSSL_PKEY_PARAM_USE_COFACTOR_FLAG "use-cofactor-flag" +# define OSSL_PROV_PARAM_BUILDINFO "buildinfo" +# define OSSL_PROV_PARAM_CORE_MODULE_FILENAME "module-filename" +# define OSSL_PROV_PARAM_CORE_PROV_NAME "provider-name" +# define OSSL_PROV_PARAM_CORE_VERSION "openssl-version" +# define OSSL_PROV_PARAM_DRBG_TRUNC_DIGEST "drbg-no-trunc-md" +# define OSSL_PROV_PARAM_DSA_SIGN_DISABLED "dsa-sign-disabled" +# define OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK "ecdh-cofactor-check" +# define OSSL_PROV_PARAM_HKDF_DIGEST_CHECK "hkdf-digest-check" +# define OSSL_PROV_PARAM_HKDF_KEY_CHECK "hkdf-key-check" +# define OSSL_PROV_PARAM_HMAC_KEY_CHECK "hmac-key-check" +# define OSSL_PROV_PARAM_KBKDF_KEY_CHECK "kbkdf-key-check" +# define OSSL_PROV_PARAM_KMAC_KEY_CHECK "kmac-key-check" +# define OSSL_PROV_PARAM_NAME "name" +# define OSSL_PROV_PARAM_NO_SHORT_MAC "no-short-mac" +# define OSSL_PROV_PARAM_PBKDF2_LOWER_BOUND_CHECK "pbkdf2-lower-bound-check" +# define OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED "rsa-pkcs15-pad-disabled" +# define OSSL_PROV_PARAM_RSA_PSS_SALTLEN_CHECK "rsa-pss-saltlen-check" +# define OSSL_PROV_PARAM_RSA_SIGN_X931_PAD_DISABLED "rsa-sign-x931-pad-disabled" +# define OSSL_PROV_PARAM_SECURITY_CHECKS "security-checks" +# define OSSL_PROV_PARAM_SELF_TEST_DESC "st-desc" +# define OSSL_PROV_PARAM_SELF_TEST_PHASE "st-phase" +# define OSSL_PROV_PARAM_SELF_TEST_TYPE "st-type" +# define OSSL_PROV_PARAM_SIGNATURE_DIGEST_CHECK "signature-digest-check" +# define OSSL_PROV_PARAM_SSHKDF_DIGEST_CHECK "sshkdf-digest-check" +# define OSSL_PROV_PARAM_SSHKDF_KEY_CHECK "sshkdf-key-check" +# define OSSL_PROV_PARAM_SSKDF_DIGEST_CHECK "sskdf-digest-check" +# define OSSL_PROV_PARAM_SSKDF_KEY_CHECK "sskdf-key-check" +# define OSSL_PROV_PARAM_STATUS "status" +# define OSSL_PROV_PARAM_TDES_ENCRYPT_DISABLED "tdes-encrypt-disabled" +# define OSSL_PROV_PARAM_TLS13_KDF_DIGEST_CHECK "tls13-kdf-digest-check" +# define OSSL_PROV_PARAM_TLS13_KDF_KEY_CHECK "tls13-kdf-key-check" +# define OSSL_PROV_PARAM_TLS1_PRF_DIGEST_CHECK "tls1-prf-digest-check" +# define OSSL_PROV_PARAM_TLS1_PRF_EMS_CHECK "tls1-prf-ems-check" +# define OSSL_PROV_PARAM_TLS1_PRF_KEY_CHECK "tls1-prf-key-check" +# define OSSL_PROV_PARAM_VERSION "version" +# define OSSL_PROV_PARAM_X942KDF_KEY_CHECK "x942kdf-key-check" +# define OSSL_PROV_PARAM_X963KDF_DIGEST_CHECK "x963kdf-digest-check" +# define OSSL_PROV_PARAM_X963KDF_KEY_CHECK "x963kdf-key-check" +# define OSSL_RAND_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_RAND_PARAM_GENERATE "generate" +# define OSSL_RAND_PARAM_MAX_REQUEST "max_request" +# define OSSL_RAND_PARAM_STATE "state" +# define OSSL_RAND_PARAM_STRENGTH "strength" +# define OSSL_RAND_PARAM_TEST_ENTROPY "test_entropy" +# define OSSL_RAND_PARAM_TEST_NONCE "test_nonce" +# define OSSL_SIGNATURE_PARAM_ADD_RANDOM "additional-random" +# define OSSL_SIGNATURE_PARAM_ALGORITHM_ID OSSL_PKEY_PARAM_ALGORITHM_ID +# define OSSL_SIGNATURE_PARAM_ALGORITHM_ID_PARAMS OSSL_PKEY_PARAM_ALGORITHM_ID_PARAMS +# define OSSL_SIGNATURE_PARAM_CONTEXT_STRING "context-string" +# define OSSL_SIGNATURE_PARAM_DETERMINISTIC "deterministic" +# define OSSL_SIGNATURE_PARAM_DIGEST OSSL_PKEY_PARAM_DIGEST +# define OSSL_SIGNATURE_PARAM_DIGEST_SIZE OSSL_PKEY_PARAM_DIGEST_SIZE +# define OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR +# define OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK +# define OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK +# define OSSL_SIGNATURE_PARAM_FIPS_RSA_PSS_SALTLEN_CHECK "rsa-pss-saltlen-check" +# define OSSL_SIGNATURE_PARAM_FIPS_SIGN_CHECK OSSL_PKEY_PARAM_FIPS_SIGN_CHECK +# define OSSL_SIGNATURE_PARAM_FIPS_SIGN_X931_PAD_CHECK "sign-x931-pad-check" +# define OSSL_SIGNATURE_PARAM_FIPS_VERIFY_MESSAGE "verify-message" +# define OSSL_SIGNATURE_PARAM_INSTANCE "instance" +# define OSSL_SIGNATURE_PARAM_KAT "kat" +# define OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING "message-encoding" +# define OSSL_SIGNATURE_PARAM_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST +# define OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES OSSL_PKEY_PARAM_MGF1_PROPERTIES +# define OSSL_SIGNATURE_PARAM_MU "mu" +# define OSSL_SIGNATURE_PARAM_NONCE_TYPE "nonce-type" +# define OSSL_SIGNATURE_PARAM_PAD_MODE OSSL_PKEY_PARAM_PAD_MODE +# define OSSL_SIGNATURE_PARAM_PROPERTIES OSSL_PKEY_PARAM_PROPERTIES +# define OSSL_SIGNATURE_PARAM_PSS_SALTLEN "saltlen" +# define OSSL_SIGNATURE_PARAM_SIGNATURE "signature" +# define OSSL_SIGNATURE_PARAM_TEST_ENTROPY "test-entropy" +# define OSSL_SKEY_PARAM_KEY_LENGTH "key-length" +# define OSSL_SKEY_PARAM_RAW_BYTES "raw-bytes" +# define OSSL_STORE_PARAM_ALIAS "alias" +# define OSSL_STORE_PARAM_DIGEST "digest" +# define OSSL_STORE_PARAM_EXPECT "expect" +# define OSSL_STORE_PARAM_FINGERPRINT "fingerprint" +# define OSSL_STORE_PARAM_INPUT_TYPE "input-type" +# define OSSL_STORE_PARAM_ISSUER "name" +# define OSSL_STORE_PARAM_PROPERTIES "properties" +# define OSSL_STORE_PARAM_SERIAL "serial" +# define OSSL_STORE_PARAM_SUBJECT "subject" +/* clang-format on */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/core_object.h b/VCMP-LUA/modules/postgresql/include/openssl/core_object.h new file mode 100644 index 0000000..df0c794 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/core_object.h @@ -0,0 +1,41 @@ +/* + * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CORE_OBJECT_H +#define OPENSSL_CORE_OBJECT_H +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * Known object types + * + * These numbers are used as values for the OSSL_PARAM parameter + * OSSL_OBJECT_PARAM_TYPE. + * + * For most of these types, there's a corresponding libcrypto object type. + * The corresponding type is indicated with a comment after the number. + */ +#define OSSL_OBJECT_UNKNOWN 0 +#define OSSL_OBJECT_NAME 1 /* char * */ +#define OSSL_OBJECT_PKEY 2 /* EVP_PKEY * */ +#define OSSL_OBJECT_CERT 3 /* X509 * */ +#define OSSL_OBJECT_CRL 4 /* X509_CRL * */ + +/* + * The rest of the associated OSSL_PARAM elements is described in core_names.h + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/crmf.h b/VCMP-LUA/modules/postgresql/include/openssl/crmf.h new file mode 100644 index 0000000..cab19eb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/crmf.h @@ -0,0 +1,279 @@ +/*- + * WARNING: do not edit! + * Generated by makefile from include\openssl\crmf.h.in + * + * Copyright 2007-2025 The OpenSSL Project Authors. All Rights Reserved. + * Copyright Nokia 2007-2019 + * Copyright Siemens AG 2015-2019 + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + * + * CRMF (RFC 4211) implementation by M. Peylo, M. Viljanen, and D. von Oheimb. + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_CRMF_H +#define OPENSSL_CRMF_H + +#include + +#ifndef OPENSSL_NO_CRMF +#include +#include +#include +#include /* for GENERAL_NAME etc. */ +#include + +/* explicit #includes not strictly needed since implied by the above: */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OSSL_CRMF_POPOPRIVKEY_THISMESSAGE 0 +#define OSSL_CRMF_POPOPRIVKEY_SUBSEQUENTMESSAGE 1 +#define OSSL_CRMF_POPOPRIVKEY_DHMAC 2 +#define OSSL_CRMF_POPOPRIVKEY_AGREEMAC 3 +#define OSSL_CRMF_POPOPRIVKEY_ENCRYPTEDKEY 4 + +#define OSSL_CRMF_SUBSEQUENTMESSAGE_ENCRCERT 0 +#define OSSL_CRMF_SUBSEQUENTMESSAGE_CHALLENGERESP 1 +typedef struct ossl_crmf_encryptedvalue_st OSSL_CRMF_ENCRYPTEDVALUE; +DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_ENCRYPTEDVALUE) + +typedef struct ossl_crmf_encryptedkey_st OSSL_CRMF_ENCRYPTEDKEY; +DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_ENCRYPTEDKEY) + +typedef struct ossl_crmf_msg_st OSSL_CRMF_MSG; +DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_MSG) +DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_MSG) +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_MSG, OSSL_CRMF_MSG, OSSL_CRMF_MSG) +#define sk_OSSL_CRMF_MSG_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk)) +#define sk_OSSL_CRMF_MSG_value(sk, idx) ((OSSL_CRMF_MSG *)OPENSSL_sk_value(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk), (idx))) +#define sk_OSSL_CRMF_MSG_new(cmp) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_new(ossl_check_OSSL_CRMF_MSG_compfunc_type(cmp))) +#define sk_OSSL_CRMF_MSG_new_null() ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_new_null()) +#define sk_OSSL_CRMF_MSG_new_reserve(cmp, n) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CRMF_MSG_compfunc_type(cmp), (n))) +#define sk_OSSL_CRMF_MSG_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CRMF_MSG_sk_type(sk), (n)) +#define sk_OSSL_CRMF_MSG_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CRMF_MSG_sk_type(sk)) +#define sk_OSSL_CRMF_MSG_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CRMF_MSG_sk_type(sk)) +#define sk_OSSL_CRMF_MSG_delete(sk, i) ((OSSL_CRMF_MSG *)OPENSSL_sk_delete(ossl_check_OSSL_CRMF_MSG_sk_type(sk), (i))) +#define sk_OSSL_CRMF_MSG_delete_ptr(sk, ptr) ((OSSL_CRMF_MSG *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr))) +#define sk_OSSL_CRMF_MSG_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr)) +#define sk_OSSL_CRMF_MSG_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr)) +#define sk_OSSL_CRMF_MSG_pop(sk) ((OSSL_CRMF_MSG *)OPENSSL_sk_pop(ossl_check_OSSL_CRMF_MSG_sk_type(sk))) +#define sk_OSSL_CRMF_MSG_shift(sk) ((OSSL_CRMF_MSG *)OPENSSL_sk_shift(ossl_check_OSSL_CRMF_MSG_sk_type(sk))) +#define sk_OSSL_CRMF_MSG_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_freefunc_type(freefunc)) +#define sk_OSSL_CRMF_MSG_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr), (idx)) +#define sk_OSSL_CRMF_MSG_set(sk, idx, ptr) ((OSSL_CRMF_MSG *)OPENSSL_sk_set(ossl_check_OSSL_CRMF_MSG_sk_type(sk), (idx), ossl_check_OSSL_CRMF_MSG_type(ptr))) +#define sk_OSSL_CRMF_MSG_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr)) +#define sk_OSSL_CRMF_MSG_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr)) +#define sk_OSSL_CRMF_MSG_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr), pnum) +#define sk_OSSL_CRMF_MSG_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CRMF_MSG_sk_type(sk)) +#define sk_OSSL_CRMF_MSG_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk)) +#define sk_OSSL_CRMF_MSG_dup(sk) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk))) +#define sk_OSSL_CRMF_MSG_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_copyfunc_type(copyfunc), ossl_check_OSSL_CRMF_MSG_freefunc_type(freefunc))) +#define sk_OSSL_CRMF_MSG_set_cmp_func(sk, cmp) ((sk_OSSL_CRMF_MSG_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_compfunc_type(cmp))) + +/* clang-format on */ +typedef struct ossl_crmf_attributetypeandvalue_st OSSL_CRMF_ATTRIBUTETYPEANDVALUE; +void OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(OSSL_CRMF_ATTRIBUTETYPEANDVALUE *v); +DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_value(sk, idx) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_value(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (idx))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_new(cmp) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_new(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc_type(cmp))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_new_null() ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_new_null()) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_new_reserve(cmp, n) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc_type(cmp), (n))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (n)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_delete(sk, i) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_delete(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (i))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_delete_ptr(sk, ptr) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_pop(sk) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_pop(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_shift(sk) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_shift(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_freefunc_type(freefunc)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr), (idx)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_set(sk, idx, ptr) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_set(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (idx), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr), pnum) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_dup(sk) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_copyfunc_type(copyfunc), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_freefunc_type(freefunc))) +#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_set_cmp_func(sk, cmp) ((sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct ossl_crmf_pbmparameter_st OSSL_CRMF_PBMPARAMETER; +DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) +typedef struct ossl_crmf_poposigningkey_st OSSL_CRMF_POPOSIGNINGKEY; +typedef struct ossl_crmf_certrequest_st OSSL_CRMF_CERTREQUEST; +typedef struct ossl_crmf_certid_st OSSL_CRMF_CERTID; +DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_CERTID) +DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_CERTID) +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_CERTID, OSSL_CRMF_CERTID, OSSL_CRMF_CERTID) +#define sk_OSSL_CRMF_CERTID_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk)) +#define sk_OSSL_CRMF_CERTID_value(sk, idx) ((OSSL_CRMF_CERTID *)OPENSSL_sk_value(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk), (idx))) +#define sk_OSSL_CRMF_CERTID_new(cmp) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_new(ossl_check_OSSL_CRMF_CERTID_compfunc_type(cmp))) +#define sk_OSSL_CRMF_CERTID_new_null() ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_new_null()) +#define sk_OSSL_CRMF_CERTID_new_reserve(cmp, n) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CRMF_CERTID_compfunc_type(cmp), (n))) +#define sk_OSSL_CRMF_CERTID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), (n)) +#define sk_OSSL_CRMF_CERTID_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CRMF_CERTID_sk_type(sk)) +#define sk_OSSL_CRMF_CERTID_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CRMF_CERTID_sk_type(sk)) +#define sk_OSSL_CRMF_CERTID_delete(sk, i) ((OSSL_CRMF_CERTID *)OPENSSL_sk_delete(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), (i))) +#define sk_OSSL_CRMF_CERTID_delete_ptr(sk, ptr) ((OSSL_CRMF_CERTID *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr))) +#define sk_OSSL_CRMF_CERTID_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr)) +#define sk_OSSL_CRMF_CERTID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr)) +#define sk_OSSL_CRMF_CERTID_pop(sk) ((OSSL_CRMF_CERTID *)OPENSSL_sk_pop(ossl_check_OSSL_CRMF_CERTID_sk_type(sk))) +#define sk_OSSL_CRMF_CERTID_shift(sk) ((OSSL_CRMF_CERTID *)OPENSSL_sk_shift(ossl_check_OSSL_CRMF_CERTID_sk_type(sk))) +#define sk_OSSL_CRMF_CERTID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_freefunc_type(freefunc)) +#define sk_OSSL_CRMF_CERTID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr), (idx)) +#define sk_OSSL_CRMF_CERTID_set(sk, idx, ptr) ((OSSL_CRMF_CERTID *)OPENSSL_sk_set(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), (idx), ossl_check_OSSL_CRMF_CERTID_type(ptr))) +#define sk_OSSL_CRMF_CERTID_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr)) +#define sk_OSSL_CRMF_CERTID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr)) +#define sk_OSSL_CRMF_CERTID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr), pnum) +#define sk_OSSL_CRMF_CERTID_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CRMF_CERTID_sk_type(sk)) +#define sk_OSSL_CRMF_CERTID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk)) +#define sk_OSSL_CRMF_CERTID_dup(sk) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk))) +#define sk_OSSL_CRMF_CERTID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_copyfunc_type(copyfunc), ossl_check_OSSL_CRMF_CERTID_freefunc_type(freefunc))) +#define sk_OSSL_CRMF_CERTID_set_cmp_func(sk, cmp) ((sk_OSSL_CRMF_CERTID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct ossl_crmf_pkipublicationinfo_st OSSL_CRMF_PKIPUBLICATIONINFO; +DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PKIPUBLICATIONINFO) +typedef struct ossl_crmf_singlepubinfo_st OSSL_CRMF_SINGLEPUBINFO; +DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_SINGLEPUBINFO) +typedef struct ossl_crmf_certtemplate_st OSSL_CRMF_CERTTEMPLATE; +DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_CERTTEMPLATE) +DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_CERTTEMPLATE) +typedef STACK_OF(OSSL_CRMF_MSG) OSSL_CRMF_MSGS; +DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_MSGS) + +typedef struct ossl_crmf_optionalvalidity_st OSSL_CRMF_OPTIONALVALIDITY; + +/* crmf_pbm.c */ +OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OSSL_LIB_CTX *libctx, size_t slen, + int owfnid, size_t itercnt, + int macnid); +int OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq, + const OSSL_CRMF_PBMPARAMETER *pbmp, + const unsigned char *msg, size_t msglen, + const unsigned char *sec, size_t seclen, + unsigned char **mac, size_t *maclen); + +/* crmf_lib.c */ +int OSSL_CRMF_MSG_set1_regCtrl_regToken(OSSL_CRMF_MSG *msg, + const ASN1_UTF8STRING *tok); +ASN1_UTF8STRING +*OSSL_CRMF_MSG_get0_regCtrl_regToken(const OSSL_CRMF_MSG *msg); +int OSSL_CRMF_MSG_set1_regCtrl_authenticator(OSSL_CRMF_MSG *msg, + const ASN1_UTF8STRING *auth); +ASN1_UTF8STRING +*OSSL_CRMF_MSG_get0_regCtrl_authenticator(const OSSL_CRMF_MSG *msg); +int OSSL_CRMF_MSG_PKIPublicationInfo_push0_SinglePubInfo(OSSL_CRMF_PKIPUBLICATIONINFO *pi, + OSSL_CRMF_SINGLEPUBINFO *spi); +#define OSSL_CRMF_PUB_METHOD_DONTCARE 0 +#define OSSL_CRMF_PUB_METHOD_X500 1 +#define OSSL_CRMF_PUB_METHOD_WEB 2 +#define OSSL_CRMF_PUB_METHOD_LDAP 3 +int OSSL_CRMF_MSG_set0_SinglePubInfo(OSSL_CRMF_SINGLEPUBINFO *spi, + int method, GENERAL_NAME *nm); +#define OSSL_CRMF_PUB_ACTION_DONTPUBLISH 0 +#define OSSL_CRMF_PUB_ACTION_PLEASEPUBLISH 1 +int OSSL_CRMF_MSG_set_PKIPublicationInfo_action(OSSL_CRMF_PKIPUBLICATIONINFO *pi, + int action); +int OSSL_CRMF_MSG_set1_regCtrl_pkiPublicationInfo(OSSL_CRMF_MSG *msg, + const OSSL_CRMF_PKIPUBLICATIONINFO *pi); +OSSL_CRMF_PKIPUBLICATIONINFO +*OSSL_CRMF_MSG_get0_regCtrl_pkiPublicationInfo(const OSSL_CRMF_MSG *msg); +int OSSL_CRMF_MSG_set1_regCtrl_protocolEncrKey(OSSL_CRMF_MSG *msg, + const X509_PUBKEY *pubkey); +X509_PUBKEY +*OSSL_CRMF_MSG_get0_regCtrl_protocolEncrKey(const OSSL_CRMF_MSG *msg); +int OSSL_CRMF_MSG_set1_regCtrl_oldCertID(OSSL_CRMF_MSG *msg, + const OSSL_CRMF_CERTID *cid); +OSSL_CRMF_CERTID +*OSSL_CRMF_MSG_get0_regCtrl_oldCertID(const OSSL_CRMF_MSG *msg); +OSSL_CRMF_CERTID *OSSL_CRMF_CERTID_gen(const X509_NAME *issuer, + const ASN1_INTEGER *serial); + +int OSSL_CRMF_MSG_set1_regInfo_utf8Pairs(OSSL_CRMF_MSG *msg, + const ASN1_UTF8STRING *utf8pairs); +ASN1_UTF8STRING +*OSSL_CRMF_MSG_get0_regInfo_utf8Pairs(const OSSL_CRMF_MSG *msg); +int OSSL_CRMF_MSG_set1_regInfo_certReq(OSSL_CRMF_MSG *msg, + const OSSL_CRMF_CERTREQUEST *cr); +OSSL_CRMF_CERTREQUEST +*OSSL_CRMF_MSG_get0_regInfo_certReq(const OSSL_CRMF_MSG *msg); + +int OSSL_CRMF_MSG_set0_validity(OSSL_CRMF_MSG *crm, + ASN1_TIME *notBefore, ASN1_TIME *notAfter); +int OSSL_CRMF_MSG_set_certReqId(OSSL_CRMF_MSG *crm, int rid); +int OSSL_CRMF_MSG_get_certReqId(const OSSL_CRMF_MSG *crm); +int OSSL_CRMF_MSG_set0_extensions(OSSL_CRMF_MSG *crm, X509_EXTENSIONS *exts); + +int OSSL_CRMF_MSG_push0_extension(OSSL_CRMF_MSG *crm, X509_EXTENSION *ext); +#define OSSL_CRMF_POPO_NONE -1 +#define OSSL_CRMF_POPO_RAVERIFIED 0 +#define OSSL_CRMF_POPO_SIGNATURE 1 +#define OSSL_CRMF_POPO_KEYENC 2 +#define OSSL_CRMF_POPO_KEYAGREE 3 +int OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm, + EVP_PKEY *pkey, const EVP_MD *digest, + OSSL_LIB_CTX *libctx, const char *propq); +int OSSL_CRMF_MSGS_verify_popo(const OSSL_CRMF_MSGS *reqs, + int rid, int acceptRAVerified, + OSSL_LIB_CTX *libctx, const char *propq); +OSSL_CRMF_CERTTEMPLATE *OSSL_CRMF_MSG_get0_tmpl(const OSSL_CRMF_MSG *crm); +X509_PUBKEY +*OSSL_CRMF_CERTTEMPLATE_get0_publicKey(const OSSL_CRMF_CERTTEMPLATE *tmpl); +const X509_NAME *OSSL_CRMF_CERTTEMPLATE_get0_subject(const OSSL_CRMF_CERTTEMPLATE *tmpl); +const X509_NAME *OSSL_CRMF_CERTTEMPLATE_get0_issuer(const OSSL_CRMF_CERTTEMPLATE *tmpl); +const ASN1_INTEGER *OSSL_CRMF_CERTTEMPLATE_get0_serialNumber(const OSSL_CRMF_CERTTEMPLATE *tmpl); +X509_EXTENSIONS +*OSSL_CRMF_CERTTEMPLATE_get0_extensions(const OSSL_CRMF_CERTTEMPLATE *tmpl); +const X509_NAME *OSSL_CRMF_CERTID_get0_issuer(const OSSL_CRMF_CERTID *cid); +const ASN1_INTEGER *OSSL_CRMF_CERTID_get0_serialNumber(const OSSL_CRMF_CERTID *cid); +int OSSL_CRMF_CERTTEMPLATE_fill(OSSL_CRMF_CERTTEMPLATE *tmpl, + EVP_PKEY *pubkey, + const X509_NAME *subject, + const X509_NAME *issuer, + const ASN1_INTEGER *serial); +X509 *OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(const OSSL_CRMF_ENCRYPTEDVALUE *ecert, + OSSL_LIB_CTX *libctx, const char *propq, + EVP_PKEY *pkey); +X509 *OSSL_CRMF_ENCRYPTEDKEY_get1_encCert(const OSSL_CRMF_ENCRYPTEDKEY *ecert, + OSSL_LIB_CTX *libctx, const char *propq, + EVP_PKEY *pkey, unsigned int flags); +unsigned char *OSSL_CRMF_ENCRYPTEDVALUE_decrypt(const OSSL_CRMF_ENCRYPTEDVALUE *enc, + OSSL_LIB_CTX *libctx, const char *propq, + EVP_PKEY *pkey, int *outlen); +EVP_PKEY *OSSL_CRMF_ENCRYPTEDKEY_get1_pkey(const OSSL_CRMF_ENCRYPTEDKEY *encryptedKey, + X509_STORE *ts, STACK_OF(X509) *extra, EVP_PKEY *pkey, + X509 *cert, ASN1_OCTET_STRING *secret, + OSSL_LIB_CTX *libctx, const char *propq); +int OSSL_CRMF_MSG_centralkeygen_requested(const OSSL_CRMF_MSG *crm, const X509_REQ *p10cr); +#ifndef OPENSSL_NO_CMS +OSSL_CRMF_ENCRYPTEDKEY *OSSL_CRMF_ENCRYPTEDKEY_init_envdata(CMS_EnvelopedData *envdata); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !defined(OPENSSL_NO_CRMF) */ +#endif /* !defined(OPENSSL_CRMF_H) */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/crmferr.h b/VCMP-LUA/modules/postgresql/include/openssl/crmferr.h new file mode 100644 index 0000000..2215394 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/crmferr.h @@ -0,0 +1,55 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CRMFERR_H +#define OPENSSL_CRMFERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_CRMF + +/* + * CRMF reason codes. + */ +#define CRMF_R_BAD_PBM_ITERATIONCOUNT 100 +#define CRMF_R_CMS_NOT_SUPPORTED 122 +#define CRMF_R_CRMFERROR 102 +#define CRMF_R_ERROR 103 +#define CRMF_R_ERROR_DECODING_CERTIFICATE 104 +#define CRMF_R_ERROR_DECODING_ENCRYPTEDKEY 123 +#define CRMF_R_ERROR_DECRYPTING_CERTIFICATE 105 +#define CRMF_R_ERROR_DECRYPTING_ENCRYPTEDKEY 124 +#define CRMF_R_ERROR_DECRYPTING_ENCRYPTEDVALUE 125 +#define CRMF_R_ERROR_DECRYPTING_SYMMETRIC_KEY 106 +#define CRMF_R_ERROR_SETTING_PURPOSE 126 +#define CRMF_R_ERROR_VERIFYING_ENCRYPTEDKEY 127 +#define CRMF_R_FAILURE_OBTAINING_RANDOM 107 +#define CRMF_R_ITERATIONCOUNT_BELOW_100 108 +#define CRMF_R_MALFORMED_IV 101 +#define CRMF_R_NULL_ARGUMENT 109 +#define CRMF_R_POPOSKINPUT_NOT_SUPPORTED 113 +#define CRMF_R_POPO_INCONSISTENT_CENTRAL_KEYGEN 128 +#define CRMF_R_POPO_INCONSISTENT_PUBLIC_KEY 117 +#define CRMF_R_POPO_MISSING 121 +#define CRMF_R_POPO_MISSING_PUBLIC_KEY 118 +#define CRMF_R_POPO_MISSING_SUBJECT 119 +#define CRMF_R_POPO_RAVERIFIED_NOT_ACCEPTED 120 +#define CRMF_R_SETTING_MAC_ALGOR_FAILURE 110 +#define CRMF_R_SETTING_OWF_ALGOR_FAILURE 111 +#define CRMF_R_UNSUPPORTED_ALGORITHM 112 +#define CRMF_R_UNSUPPORTED_CIPHER 114 +#define CRMF_R_UNSUPPORTED_METHOD_FOR_CREATING_POPO 115 +#define CRMF_R_UNSUPPORTED_POPO_METHOD 116 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/crypto.h b/VCMP-LUA/modules/postgresql/include/openssl/crypto.h new file mode 100644 index 0000000..d3dfec2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/crypto.h @@ -0,0 +1,619 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\crypto.h.in + * + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_CRYPTO_H +#define OPENSSL_CRYPTO_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_CRYPTO_H +#endif + +#include +#include + +#include + +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef CHARSET_EBCDIC +#include +#endif + +/* + * Resolve problems on some operating systems with symbol names that clash + * one way or another + */ +#include + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define SSLeay OpenSSL_version_num +#define SSLeay_version OpenSSL_version +#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER +#define SSLEAY_VERSION OPENSSL_VERSION +#define SSLEAY_CFLAGS OPENSSL_CFLAGS +#define SSLEAY_BUILT_ON OPENSSL_BUILT_ON +#define SSLEAY_PLATFORM OPENSSL_PLATFORM +#define SSLEAY_DIR OPENSSL_DIR + +/* + * Old type for allocating dynamic locks. No longer used. Use the new thread + * API instead. + */ +typedef struct { + int dummy; +} CRYPTO_dynlock; + +#endif /* OPENSSL_NO_DEPRECATED_1_1_0 */ + +typedef void CRYPTO_RWLOCK; + +CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void); +__owur int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock); +__owur int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock); +int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock); +void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock); + +int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock); +int CRYPTO_atomic_add64(uint64_t *val, uint64_t op, uint64_t *ret, + CRYPTO_RWLOCK *lock); +int CRYPTO_atomic_and(uint64_t *val, uint64_t op, uint64_t *ret, + CRYPTO_RWLOCK *lock); +int CRYPTO_atomic_or(uint64_t *val, uint64_t op, uint64_t *ret, + CRYPTO_RWLOCK *lock); +int CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock); +int CRYPTO_atomic_load_int(int *val, int *ret, CRYPTO_RWLOCK *lock); +int CRYPTO_atomic_store(uint64_t *dst, uint64_t val, CRYPTO_RWLOCK *lock); + +/* No longer needed, so this is a no-op */ +#define OPENSSL_malloc_init() \ + while (0) \ + continue + +#define OPENSSL_malloc(num) \ + CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_zalloc(num) \ + CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_malloc_array(num, size) \ + CRYPTO_malloc_array(num, size, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_calloc(num, size) \ + CRYPTO_calloc(num, size, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_aligned_alloc(num, alignment, freeptr) \ + CRYPTO_aligned_alloc(num, alignment, freeptr, \ + OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_aligned_alloc_array(num, size, alignment, freeptr) \ + CRYPTO_aligned_alloc_array(num, size, alignment, freeptr, \ + OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_realloc(addr, num) \ + CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_clear_realloc(addr, old_num, num) \ + CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_realloc_array(addr, num, size) \ + CRYPTO_realloc_array(addr, num, size, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_clear_realloc_array(addr, old_num, num, size) \ + CRYPTO_clear_realloc_array(addr, old_num, num, size, \ + OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_clear_free(addr, num) \ + CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_free(addr) \ + CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_memdup(str, s) \ + CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_strdup(str) \ + CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_strndup(str, n) \ + CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_secure_malloc(num) \ + CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_secure_zalloc(num) \ + CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_secure_malloc_array(num, size) \ + CRYPTO_secure_malloc_array(num, size, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_secure_calloc(num, size) \ + CRYPTO_secure_calloc(num, size, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_secure_free(addr) \ + CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_secure_clear_free(addr, num) \ + CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_secure_actual_size(ptr) \ + CRYPTO_secure_actual_size(ptr) + +size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz); +size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz); +size_t OPENSSL_strnlen(const char *str, size_t maxlen); +int OPENSSL_strtoul(const char *str, char **endptr, int base, unsigned long *num); +int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlength, + const unsigned char *buf, size_t buflen, + const char sep); +char *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen); +int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, size_t *buflen, + const char *str, const char sep); +unsigned char *OPENSSL_hexstr2buf(const char *str, long *buflen); +int OPENSSL_hexchar2int(unsigned char c); +int OPENSSL_strcasecmp(const char *s1, const char *s2); +int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n); + +#define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U << (sizeof(int) * 8 - 1)) - 1) / sizeof(type)) + +/* + * These functions return the values of OPENSSL_VERSION_MAJOR, + * OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE + * and OPENSSL_VERSION_BUILD_METADATA, respectively. + */ +unsigned int OPENSSL_version_major(void); +unsigned int OPENSSL_version_minor(void); +unsigned int OPENSSL_version_patch(void); +const char *OPENSSL_version_pre_release(void); +const char *OPENSSL_version_build_metadata(void); + +unsigned long OpenSSL_version_num(void); +const char *OpenSSL_version(int type); +#define OPENSSL_VERSION 0 +#define OPENSSL_CFLAGS 1 +#define OPENSSL_BUILT_ON 2 +#define OPENSSL_PLATFORM 3 +#define OPENSSL_DIR 4 +#define OPENSSL_ENGINES_DIR 5 +#define OPENSSL_VERSION_STRING 6 +#define OPENSSL_FULL_VERSION_STRING 7 +#define OPENSSL_MODULES_DIR 8 +#define OPENSSL_CPU_INFO 9 +#define OPENSSL_WINCTX 10 + +const char *OPENSSL_info(int type); +/* + * The series starts at 1001 to avoid confusion with the OpenSSL_version + * types. + */ +#define OPENSSL_INFO_CONFIG_DIR 1001 +#define OPENSSL_INFO_ENGINES_DIR 1002 +#define OPENSSL_INFO_MODULES_DIR 1003 +#define OPENSSL_INFO_DSO_EXTENSION 1004 +#define OPENSSL_INFO_DIR_FILENAME_SEPARATOR 1005 +#define OPENSSL_INFO_LIST_SEPARATOR 1006 +#define OPENSSL_INFO_SEED_SOURCE 1007 +#define OPENSSL_INFO_CPU_SETTINGS 1008 +#define OPENSSL_INFO_WINDOWS_CONTEXT 1009 + +int OPENSSL_issetugid(void); + +struct crypto_ex_data_st { + OSSL_LIB_CTX *ctx; + STACK_OF(void) *sk; +}; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(void, void, void) +#define sk_void_num(sk) OPENSSL_sk_num(ossl_check_const_void_sk_type(sk)) +#define sk_void_value(sk, idx) ((void *)OPENSSL_sk_value(ossl_check_const_void_sk_type(sk), (idx))) +#define sk_void_new(cmp) ((STACK_OF(void) *)OPENSSL_sk_new(ossl_check_void_compfunc_type(cmp))) +#define sk_void_new_null() ((STACK_OF(void) *)OPENSSL_sk_new_null()) +#define sk_void_new_reserve(cmp, n) ((STACK_OF(void) *)OPENSSL_sk_new_reserve(ossl_check_void_compfunc_type(cmp), (n))) +#define sk_void_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_void_sk_type(sk), (n)) +#define sk_void_free(sk) OPENSSL_sk_free(ossl_check_void_sk_type(sk)) +#define sk_void_zero(sk) OPENSSL_sk_zero(ossl_check_void_sk_type(sk)) +#define sk_void_delete(sk, i) ((void *)OPENSSL_sk_delete(ossl_check_void_sk_type(sk), (i))) +#define sk_void_delete_ptr(sk, ptr) ((void *)OPENSSL_sk_delete_ptr(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))) +#define sk_void_push(sk, ptr) OPENSSL_sk_push(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr)) +#define sk_void_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr)) +#define sk_void_pop(sk) ((void *)OPENSSL_sk_pop(ossl_check_void_sk_type(sk))) +#define sk_void_shift(sk) ((void *)OPENSSL_sk_shift(ossl_check_void_sk_type(sk))) +#define sk_void_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_void_sk_type(sk), ossl_check_void_freefunc_type(freefunc)) +#define sk_void_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr), (idx)) +#define sk_void_set(sk, idx, ptr) ((void *)OPENSSL_sk_set(ossl_check_void_sk_type(sk), (idx), ossl_check_void_type(ptr))) +#define sk_void_find(sk, ptr) OPENSSL_sk_find(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr)) +#define sk_void_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr)) +#define sk_void_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr), pnum) +#define sk_void_sort(sk) OPENSSL_sk_sort(ossl_check_void_sk_type(sk)) +#define sk_void_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_void_sk_type(sk)) +#define sk_void_dup(sk) ((STACK_OF(void) *)OPENSSL_sk_dup(ossl_check_const_void_sk_type(sk))) +#define sk_void_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(void) *)OPENSSL_sk_deep_copy(ossl_check_const_void_sk_type(sk), ossl_check_void_copyfunc_type(copyfunc), ossl_check_void_freefunc_type(freefunc))) +#define sk_void_set_cmp_func(sk, cmp) ((sk_void_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_void_sk_type(sk), ossl_check_void_compfunc_type(cmp))) + +/* clang-format on */ + +/* + * Per class, we have a STACK of function pointers. + */ +#define CRYPTO_EX_INDEX_SSL 0 +#define CRYPTO_EX_INDEX_SSL_CTX 1 +#define CRYPTO_EX_INDEX_SSL_SESSION 2 +#define CRYPTO_EX_INDEX_X509 3 +#define CRYPTO_EX_INDEX_X509_STORE 4 +#define CRYPTO_EX_INDEX_X509_STORE_CTX 5 +#define CRYPTO_EX_INDEX_DH 6 +#define CRYPTO_EX_INDEX_DSA 7 +#define CRYPTO_EX_INDEX_EC_KEY 8 +#define CRYPTO_EX_INDEX_RSA 9 +#define CRYPTO_EX_INDEX_ENGINE 10 +#define CRYPTO_EX_INDEX_UI 11 +#define CRYPTO_EX_INDEX_BIO 12 +#define CRYPTO_EX_INDEX_APP 13 +#define CRYPTO_EX_INDEX_UI_METHOD 14 +#define CRYPTO_EX_INDEX_RAND_DRBG 15 +#define CRYPTO_EX_INDEX_DRBG CRYPTO_EX_INDEX_RAND_DRBG +#define CRYPTO_EX_INDEX_OSSL_LIB_CTX 16 +#define CRYPTO_EX_INDEX_EVP_PKEY 17 +#define CRYPTO_EX_INDEX__COUNT 18 + +typedef void CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, + void **from_d, int idx, long argl, void *argp); +__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +/* No longer use an index. */ +int CRYPTO_free_ex_index(int class_index, int idx); + +/* + * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a + * given class (invokes whatever per-class callbacks are applicable) + */ +int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); +int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, + const CRYPTO_EX_DATA *from); + +void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); + +/* Allocate a single item in the CRYPTO_EX_DATA variable */ +int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad, + int idx); + +/* + * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular + * index (relative to the class type involved) + */ +int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); +void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +/* + * This function cleans up all "ex_data" state. It mustn't be called under + * potential race-conditions. + */ +#define CRYPTO_cleanup_all_ex_data() \ + while (0) \ + continue + +/* + * The old locking functions have been removed completely without compatibility + * macros. This is because the old functions either could not properly report + * errors, or the returned error values were not clearly documented. + * Replacing the locking functions with no-ops would cause race condition + * issues in the affected applications. It is far better for them to fail at + * compile time. + * On the other hand, the locking callbacks are no longer used. Consequently, + * the callback management functions can be safely replaced with no-op macros. + */ +#define CRYPTO_num_locks() (1) +#define CRYPTO_set_locking_callback(func) +#define CRYPTO_get_locking_callback() (NULL) +#define CRYPTO_set_add_lock_callback(func) +#define CRYPTO_get_add_lock_callback() (NULL) + +/* + * These defines where used in combination with the old locking callbacks, + * they are not called anymore, but old code that's not called might still + * use them. + */ +#define CRYPTO_LOCK 1 +#define CRYPTO_UNLOCK 2 +#define CRYPTO_READ 4 +#define CRYPTO_WRITE 8 + +/* This structure is no longer used */ +typedef struct crypto_threadid_st { + int dummy; +} CRYPTO_THREADID; +/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ +#define CRYPTO_THREADID_set_numeric(id, val) +#define CRYPTO_THREADID_set_pointer(id, ptr) +#define CRYPTO_THREADID_set_callback(threadid_func) (0) +#define CRYPTO_THREADID_get_callback() (NULL) +#define CRYPTO_THREADID_current(id) +#define CRYPTO_THREADID_cmp(a, b) (-1) +#define CRYPTO_THREADID_cpy(dest, src) +#define CRYPTO_THREADID_hash(id) (0UL) + +#ifndef OPENSSL_NO_DEPRECATED_1_0_0 +#define CRYPTO_set_id_callback(func) +#define CRYPTO_get_id_callback() (NULL) +#define CRYPTO_thread_id() (0UL) +#endif /* OPENSSL_NO_DEPRECATED_1_0_0 */ + +#define CRYPTO_set_dynlock_create_callback(dyn_create_function) +#define CRYPTO_set_dynlock_lock_callback(dyn_lock_function) +#define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function) +#define CRYPTO_get_dynlock_create_callback() (NULL) +#define CRYPTO_get_dynlock_lock_callback() (NULL) +#define CRYPTO_get_dynlock_destroy_callback() (NULL) +#endif /* OPENSSL_NO_DEPRECATED_1_1_0 */ + +typedef void *(*CRYPTO_malloc_fn)(size_t num, const char *file, int line); +typedef void *(*CRYPTO_realloc_fn)(void *addr, size_t num, const char *file, + int line); +typedef void (*CRYPTO_free_fn)(void *addr, const char *file, int line); +int CRYPTO_set_mem_functions(CRYPTO_malloc_fn malloc_fn, + CRYPTO_realloc_fn realloc_fn, + CRYPTO_free_fn free_fn); +void CRYPTO_get_mem_functions(CRYPTO_malloc_fn *malloc_fn, + CRYPTO_realloc_fn *realloc_fn, + CRYPTO_free_fn *free_fn); + +OSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int line); +OSSL_CRYPTO_ALLOC void *CRYPTO_zalloc(size_t num, const char *file, int line); +OSSL_CRYPTO_ALLOC void *CRYPTO_malloc_array(size_t num, size_t size, + const char *file, int line); +OSSL_CRYPTO_ALLOC void *CRYPTO_calloc(size_t num, size_t size, + const char *file, int line); +OSSL_CRYPTO_ALLOC void *CRYPTO_aligned_alloc(size_t num, size_t align, + void **freeptr, const char *file, + int line); +OSSL_CRYPTO_ALLOC void *CRYPTO_aligned_alloc_array(size_t num, size_t size, + size_t align, void **freeptr, + const char *file, int line); +void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); +char *CRYPTO_strdup(const char *str, const char *file, int line); +char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); +void CRYPTO_free(void *ptr, const char *file, int line); +void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line); +void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); +void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num, + const char *file, int line); +void *CRYPTO_realloc_array(void *addr, size_t num, size_t size, + const char *file, int line); +void *CRYPTO_clear_realloc_array(void *addr, size_t old_num, size_t num, + size_t size, const char *file, int line); + +int CRYPTO_secure_malloc_init(size_t sz, size_t minsize); +int CRYPTO_secure_malloc_done(void); +OSSL_CRYPTO_ALLOC void *CRYPTO_secure_malloc(size_t num, const char *file, int line); +OSSL_CRYPTO_ALLOC void *CRYPTO_secure_zalloc(size_t num, const char *file, int line); +OSSL_CRYPTO_ALLOC void *CRYPTO_secure_malloc_array(size_t num, size_t size, + const char *file, int line); +OSSL_CRYPTO_ALLOC void *CRYPTO_secure_calloc(size_t num, size_t size, + const char *file, int line); +void CRYPTO_secure_free(void *ptr, const char *file, int line); +void CRYPTO_secure_clear_free(void *ptr, size_t num, + const char *file, int line); +int CRYPTO_secure_allocated(const void *ptr); +int CRYPTO_secure_malloc_initialized(void); +size_t CRYPTO_secure_actual_size(void *ptr); +size_t CRYPTO_secure_used(void); + +void OPENSSL_cleanse(void *ptr, size_t len); + +#ifndef OPENSSL_NO_CRYPTO_MDEBUG +/* + * The following can be used to detect memory leaks in the library. If + * used, it turns on malloc checking + */ +#define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */ +#define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */ +#define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */ +#define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */ + +/* max allowed length for value of OPENSSL_MALLOC_FAILURES env var. */ +#define CRYPTO_MEM_CHECK_MAX_FS 256 + +void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define OPENSSL_mem_debug_push(info) \ + CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE) +#define OPENSSL_mem_debug_pop() \ + CRYPTO_mem_debug_pop() +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int CRYPTO_set_mem_debug(int flag); +OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_ctrl(int mode); +OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_debug_push(const char *info, + const char *file, int line); +OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_debug_pop(void); +OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_malloc(void *addr, size_t num, + int flag, + const char *file, int line); +OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, + size_t num, int flag, + const char *file, int line); +OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_free(void *addr, int flag, + const char *file, int line); +OSSL_DEPRECATEDIN_3_0 +int CRYPTO_mem_leaks_cb(int (*cb)(const char *str, size_t len, void *u), + void *u); +#endif +#ifndef OPENSSL_NO_STDIO +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_leaks_fp(FILE *); +#endif +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_leaks(BIO *bio); +#endif +#endif /* OPENSSL_NO_CRYPTO_MDEBUG */ + +/* die if we have to */ +ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line); +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define OpenSSLDie(f, l, a) OPENSSL_die((a), (f), (l)) +#endif +#define OPENSSL_assert(e) \ + (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1)) + +int OPENSSL_isservice(void); + +void OPENSSL_init(void); +#ifdef OPENSSL_SYS_UNIX +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_prepare(void); +OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_parent(void); +OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_child(void); +#endif +#endif + +struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); +int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); +int OPENSSL_gmtime_diff(int *pday, int *psec, + const struct tm *from, const struct tm *to); + +/* + * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. + * It takes an amount of time dependent on |len|, but independent of the + * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements + * into a defined order as the return value when a != b is undefined, other + * than to be non-zero. + */ +int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len); + +/* Standard initialisation options */ +#define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L +#define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L +#define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L +#define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L +#define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L +#define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L +#define OPENSSL_INIT_LOAD_CONFIG 0x00000040L +#define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L +#define OPENSSL_INIT_ASYNC 0x00000100L +#define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L +#define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L +#define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L +#define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L +#define OPENSSL_INIT_ENGINE_CAPI 0x00002000L +#define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L +#define OPENSSL_INIT_ENGINE_AFALG 0x00008000L +/* FREE: 0x00010000L */ +#define OPENSSL_INIT_ATFORK 0x00020000L +/* OPENSSL_INIT_BASE_ONLY 0x00040000L */ +#define OPENSSL_INIT_NO_ATEXIT 0x00080000L +/* OPENSSL_INIT flag range 0x03f00000 reserved for OPENSSL_init_ssl() */ +/* FREE: 0x04000000L */ +/* FREE: 0x08000000L */ +/* FREE: 0x10000000L */ +/* FREE: 0x20000000L */ +/* FREE: 0x40000000L */ +/* FREE: 0x80000000L */ +/* Max OPENSSL_INIT flag value is 0x80000000 */ + +/* openssl and dasync not counted as builtin */ +#define OPENSSL_INIT_ENGINE_ALL_BUILTIN \ + (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \ + | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | OPENSSL_INIT_ENGINE_PADLOCK) + +/* Library initialisation functions */ +void OPENSSL_cleanup(void); +int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); +int OPENSSL_atexit(void (*handler)(void)); +void OPENSSL_thread_stop(void); +void OPENSSL_thread_stop_ex(OSSL_LIB_CTX *ctx); + +/* Low-level control of initialization */ +OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void); +#ifndef OPENSSL_NO_STDIO +int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, + const char *config_filename); +void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, + unsigned long flags); +int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, + const char *config_appname); +#endif +void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings); + +#if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) +#if defined(_WIN32) +#if defined(BASETYPES) || defined(_WINDEF_H) +/* application has to include in order to use this */ +typedef DWORD CRYPTO_THREAD_LOCAL; +typedef DWORD CRYPTO_THREAD_ID; + +typedef LONG CRYPTO_ONCE; +#define CRYPTO_ONCE_STATIC_INIT 0 +#endif +#else +#if defined(__TANDEM) && defined(_SPT_MODEL_) +#define SPT_THREAD_SIGNAL 1 +#define SPT_THREAD_AWARE 1 +#include +#else +#include +#endif +typedef pthread_once_t CRYPTO_ONCE; +typedef pthread_key_t CRYPTO_THREAD_LOCAL; +typedef pthread_t CRYPTO_THREAD_ID; + +#define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT +#endif +#endif + +#if !defined(CRYPTO_ONCE_STATIC_INIT) +typedef unsigned int CRYPTO_ONCE; +typedef unsigned int CRYPTO_THREAD_LOCAL; +typedef unsigned int CRYPTO_THREAD_ID; +#define CRYPTO_ONCE_STATIC_INIT 0 +#endif + +int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)); + +int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)); +void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key); +int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val); +int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key); + +CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void); +int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); + +OSSL_LIB_CTX *OSSL_LIB_CTX_new(void); +OSSL_LIB_CTX *OSSL_LIB_CTX_new_from_dispatch(const OSSL_CORE_HANDLE *handle, + const OSSL_DISPATCH *in); +OSSL_LIB_CTX *OSSL_LIB_CTX_new_child(const OSSL_CORE_HANDLE *handle, + const OSSL_DISPATCH *in); +int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file); +void OSSL_LIB_CTX_free(OSSL_LIB_CTX *); +OSSL_LIB_CTX *OSSL_LIB_CTX_get0_global_default(void); +OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *libctx); +int OSSL_LIB_CTX_get_conf_diagnostics(OSSL_LIB_CTX *ctx); +void OSSL_LIB_CTX_set_conf_diagnostics(OSSL_LIB_CTX *ctx, int value); + +void OSSL_sleep(uint64_t millis); + +void *OSSL_LIB_CTX_get_data(OSSL_LIB_CTX *ctx, int index); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cryptoerr.h b/VCMP-LUA/modules/postgresql/include/openssl/cryptoerr.h new file mode 100644 index 0000000..626e3e9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cryptoerr.h @@ -0,0 +1,54 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CRYPTOERR_H +#define OPENSSL_CRYPTOERR_H +#pragma once + +#include +#include +#include + +/* + * CRYPTO reason codes. + */ +#define CRYPTO_R_BAD_ALGORITHM_NAME 117 +#define CRYPTO_R_CONFLICTING_NAMES 118 +#define CRYPTO_R_HEX_STRING_TOO_SHORT 121 +#define CRYPTO_R_ILLEGAL_HEX_DIGIT 102 +#define CRYPTO_R_INSUFFICIENT_DATA_SPACE 106 +#define CRYPTO_R_INSUFFICIENT_PARAM_SIZE 107 +#define CRYPTO_R_INSUFFICIENT_SECURE_DATA_SPACE 108 +#define CRYPTO_R_INTEGER_OVERFLOW 127 +#define CRYPTO_R_INVALID_NEGATIVE_VALUE 122 +#define CRYPTO_R_INVALID_NULL_ARGUMENT 109 +#define CRYPTO_R_INVALID_OSSL_PARAM_TYPE 110 +#define CRYPTO_R_NO_PARAMS_TO_MERGE 131 +#define CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL 128 +#define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103 +#define CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY 123 +#define CRYPTO_R_PARAM_NOT_INTEGER_TYPE 124 +#define CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE 129 +#define CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED 125 +#define CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT 130 +#define CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION 126 +#define CRYPTO_R_PROVIDER_ALREADY_EXISTS 104 +#define CRYPTO_R_PROVIDER_SECTION_ERROR 105 +#define CRYPTO_R_RANDOM_SECTION_ERROR 119 +#define CRYPTO_R_SECURE_MALLOC_FAILURE 111 +#define CRYPTO_R_STRING_TOO_LONG 112 +#define CRYPTO_R_TOO_MANY_BYTES 113 +#define CRYPTO_R_TOO_MANY_NAMES 132 +#define CRYPTO_R_TOO_MANY_RECORDS 114 +#define CRYPTO_R_TOO_SMALL_BUFFER 116 +#define CRYPTO_R_UNKNOWN_NAME_IN_RANDOM_SECTION 120 +#define CRYPTO_R_ZERO_LENGTH_NUMBER 115 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cryptoerr_legacy.h b/VCMP-LUA/modules/postgresql/include/openssl/cryptoerr_legacy.h new file mode 100644 index 0000000..b1388a5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cryptoerr_legacy.h @@ -0,0 +1,1466 @@ +/* + * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * This header file preserves symbols from pre-3.0 OpenSSL. + * It should never be included directly, as it's already included + * by the public {lib}err.h headers, and since it will go away some + * time in the future. + */ + +#ifndef OPENSSL_CRYPTOERR_LEGACY_H +#define OPENSSL_CRYPTOERR_LEGACY_H +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ERR_load_ASN1_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_ASYNC_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_BIO_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_BN_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_BUF_strings(void); +#ifndef OPENSSL_NO_CMS +OSSL_DEPRECATEDIN_3_0 int ERR_load_CMS_strings(void); +#endif +#ifndef OPENSSL_NO_COMP +OSSL_DEPRECATEDIN_3_0 int ERR_load_COMP_strings(void); +#endif +OSSL_DEPRECATEDIN_3_0 int ERR_load_CONF_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_CRYPTO_strings(void); +#ifndef OPENSSL_NO_CT +OSSL_DEPRECATEDIN_3_0 int ERR_load_CT_strings(void); +#endif +#ifndef OPENSSL_NO_DH +OSSL_DEPRECATEDIN_3_0 int ERR_load_DH_strings(void); +#endif +#ifndef OPENSSL_NO_DSA +OSSL_DEPRECATEDIN_3_0 int ERR_load_DSA_strings(void); +#endif +#ifndef OPENSSL_NO_EC +OSSL_DEPRECATEDIN_3_0 int ERR_load_EC_strings(void); +#endif +#ifndef OPENSSL_NO_ENGINE +OSSL_DEPRECATEDIN_3_0 int ERR_load_ENGINE_strings(void); +#endif +OSSL_DEPRECATEDIN_3_0 int ERR_load_ERR_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_EVP_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_KDF_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_OBJ_strings(void); +#ifndef OPENSSL_NO_OCSP +OSSL_DEPRECATEDIN_3_0 int ERR_load_OCSP_strings(void); +#endif +OSSL_DEPRECATEDIN_3_0 int ERR_load_PEM_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_PKCS12_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_PKCS7_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_RAND_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_RSA_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_OSSL_STORE_strings(void); +#ifndef OPENSSL_NO_TS +OSSL_DEPRECATEDIN_3_0 int ERR_load_TS_strings(void); +#endif +OSSL_DEPRECATEDIN_3_0 int ERR_load_UI_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_X509_strings(void); +OSSL_DEPRECATEDIN_3_0 int ERR_load_X509V3_strings(void); + +/* Collected _F_ macros from OpenSSL 1.1.1 */ + +/* + * ASN1 function codes. + */ +#define ASN1_F_A2D_ASN1_OBJECT 0 +#define ASN1_F_A2I_ASN1_INTEGER 0 +#define ASN1_F_A2I_ASN1_STRING 0 +#define ASN1_F_APPEND_EXP 0 +#define ASN1_F_ASN1_BIO_INIT 0 +#define ASN1_F_ASN1_BIT_STRING_SET_BIT 0 +#define ASN1_F_ASN1_CB 0 +#define ASN1_F_ASN1_CHECK_TLEN 0 +#define ASN1_F_ASN1_COLLECT 0 +#define ASN1_F_ASN1_D2I_EX_PRIMITIVE 0 +#define ASN1_F_ASN1_D2I_FP 0 +#define ASN1_F_ASN1_D2I_READ_BIO 0 +#define ASN1_F_ASN1_DIGEST 0 +#define ASN1_F_ASN1_DO_ADB 0 +#define ASN1_F_ASN1_DO_LOCK 0 +#define ASN1_F_ASN1_DUP 0 +#define ASN1_F_ASN1_ENC_SAVE 0 +#define ASN1_F_ASN1_EX_C2I 0 +#define ASN1_F_ASN1_FIND_END 0 +#define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 0 +#define ASN1_F_ASN1_GENERATE_V3 0 +#define ASN1_F_ASN1_GET_INT64 0 +#define ASN1_F_ASN1_GET_OBJECT 0 +#define ASN1_F_ASN1_GET_UINT64 0 +#define ASN1_F_ASN1_I2D_BIO 0 +#define ASN1_F_ASN1_I2D_FP 0 +#define ASN1_F_ASN1_ITEM_D2I_FP 0 +#define ASN1_F_ASN1_ITEM_DUP 0 +#define ASN1_F_ASN1_ITEM_EMBED_D2I 0 +#define ASN1_F_ASN1_ITEM_EMBED_NEW 0 +#define ASN1_F_ASN1_ITEM_FLAGS_I2D 0 +#define ASN1_F_ASN1_ITEM_I2D_BIO 0 +#define ASN1_F_ASN1_ITEM_I2D_FP 0 +#define ASN1_F_ASN1_ITEM_PACK 0 +#define ASN1_F_ASN1_ITEM_SIGN 0 +#define ASN1_F_ASN1_ITEM_SIGN_CTX 0 +#define ASN1_F_ASN1_ITEM_UNPACK 0 +#define ASN1_F_ASN1_ITEM_VERIFY 0 +#define ASN1_F_ASN1_MBSTRING_NCOPY 0 +#define ASN1_F_ASN1_OBJECT_NEW 0 +#define ASN1_F_ASN1_OUTPUT_DATA 0 +#define ASN1_F_ASN1_PCTX_NEW 0 +#define ASN1_F_ASN1_PRIMITIVE_NEW 0 +#define ASN1_F_ASN1_SCTX_NEW 0 +#define ASN1_F_ASN1_SIGN 0 +#define ASN1_F_ASN1_STR2TYPE 0 +#define ASN1_F_ASN1_STRING_GET_INT64 0 +#define ASN1_F_ASN1_STRING_GET_UINT64 0 +#define ASN1_F_ASN1_STRING_SET 0 +#define ASN1_F_ASN1_STRING_TABLE_ADD 0 +#define ASN1_F_ASN1_STRING_TO_BN 0 +#define ASN1_F_ASN1_STRING_TYPE_NEW 0 +#define ASN1_F_ASN1_TEMPLATE_EX_D2I 0 +#define ASN1_F_ASN1_TEMPLATE_NEW 0 +#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 0 +#define ASN1_F_ASN1_TIME_ADJ 0 +#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 0 +#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 0 +#define ASN1_F_ASN1_UTCTIME_ADJ 0 +#define ASN1_F_ASN1_VERIFY 0 +#define ASN1_F_B64_READ_ASN1 0 +#define ASN1_F_B64_WRITE_ASN1 0 +#define ASN1_F_BIO_NEW_NDEF 0 +#define ASN1_F_BITSTR_CB 0 +#define ASN1_F_BN_TO_ASN1_STRING 0 +#define ASN1_F_C2I_ASN1_BIT_STRING 0 +#define ASN1_F_C2I_ASN1_INTEGER 0 +#define ASN1_F_C2I_ASN1_OBJECT 0 +#define ASN1_F_C2I_IBUF 0 +#define ASN1_F_C2I_UINT64_INT 0 +#define ASN1_F_COLLECT_DATA 0 +#define ASN1_F_D2I_ASN1_OBJECT 0 +#define ASN1_F_D2I_ASN1_UINTEGER 0 +#define ASN1_F_D2I_AUTOPRIVATEKEY 0 +#define ASN1_F_D2I_PRIVATEKEY 0 +#define ASN1_F_D2I_PUBLICKEY 0 +#define ASN1_F_DO_BUF 0 +#define ASN1_F_DO_CREATE 0 +#define ASN1_F_DO_DUMP 0 +#define ASN1_F_DO_TCREATE 0 +#define ASN1_F_I2A_ASN1_OBJECT 0 +#define ASN1_F_I2D_ASN1_BIO_STREAM 0 +#define ASN1_F_I2D_ASN1_OBJECT 0 +#define ASN1_F_I2D_DSA_PUBKEY 0 +#define ASN1_F_I2D_EC_PUBKEY 0 +#define ASN1_F_I2D_PRIVATEKEY 0 +#define ASN1_F_I2D_PUBLICKEY 0 +#define ASN1_F_I2D_RSA_PUBKEY 0 +#define ASN1_F_LONG_C2I 0 +#define ASN1_F_NDEF_PREFIX 0 +#define ASN1_F_NDEF_SUFFIX 0 +#define ASN1_F_OID_MODULE_INIT 0 +#define ASN1_F_PARSE_TAGGING 0 +#define ASN1_F_PKCS5_PBE2_SET_IV 0 +#define ASN1_F_PKCS5_PBE2_SET_SCRYPT 0 +#define ASN1_F_PKCS5_PBE_SET 0 +#define ASN1_F_PKCS5_PBE_SET0_ALGOR 0 +#define ASN1_F_PKCS5_PBKDF2_SET 0 +#define ASN1_F_PKCS5_SCRYPT_SET 0 +#define ASN1_F_SMIME_READ_ASN1 0 +#define ASN1_F_SMIME_TEXT 0 +#define ASN1_F_STABLE_GET 0 +#define ASN1_F_STBL_MODULE_INIT 0 +#define ASN1_F_UINT32_C2I 0 +#define ASN1_F_UINT32_NEW 0 +#define ASN1_F_UINT64_C2I 0 +#define ASN1_F_UINT64_NEW 0 +#define ASN1_F_X509_CRL_ADD0_REVOKED 0 +#define ASN1_F_X509_INFO_NEW 0 +#define ASN1_F_X509_NAME_ENCODE 0 +#define ASN1_F_X509_NAME_EX_D2I 0 +#define ASN1_F_X509_NAME_EX_NEW 0 +#define ASN1_F_X509_PKEY_NEW 0 + +/* + * ASYNC function codes. + */ +#define ASYNC_F_ASYNC_CTX_NEW 0 +#define ASYNC_F_ASYNC_INIT_THREAD 0 +#define ASYNC_F_ASYNC_JOB_NEW 0 +#define ASYNC_F_ASYNC_PAUSE_JOB 0 +#define ASYNC_F_ASYNC_START_FUNC 0 +#define ASYNC_F_ASYNC_START_JOB 0 +#define ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD 0 + +/* + * BIO function codes. + */ +#define BIO_F_ACPT_STATE 0 +#define BIO_F_ADDRINFO_WRAP 0 +#define BIO_F_ADDR_STRINGS 0 +#define BIO_F_BIO_ACCEPT 0 +#define BIO_F_BIO_ACCEPT_EX 0 +#define BIO_F_BIO_ACCEPT_NEW 0 +#define BIO_F_BIO_ADDR_NEW 0 +#define BIO_F_BIO_BIND 0 +#define BIO_F_BIO_CALLBACK_CTRL 0 +#define BIO_F_BIO_CONNECT 0 +#define BIO_F_BIO_CONNECT_NEW 0 +#define BIO_F_BIO_CTRL 0 +#define BIO_F_BIO_GETS 0 +#define BIO_F_BIO_GET_HOST_IP 0 +#define BIO_F_BIO_GET_NEW_INDEX 0 +#define BIO_F_BIO_GET_PORT 0 +#define BIO_F_BIO_LISTEN 0 +#define BIO_F_BIO_LOOKUP 0 +#define BIO_F_BIO_LOOKUP_EX 0 +#define BIO_F_BIO_MAKE_PAIR 0 +#define BIO_F_BIO_METH_NEW 0 +#define BIO_F_BIO_NEW 0 +#define BIO_F_BIO_NEW_DGRAM_SCTP 0 +#define BIO_F_BIO_NEW_FILE 0 +#define BIO_F_BIO_NEW_MEM_BUF 0 +#define BIO_F_BIO_NREAD 0 +#define BIO_F_BIO_NREAD0 0 +#define BIO_F_BIO_NWRITE 0 +#define BIO_F_BIO_NWRITE0 0 +#define BIO_F_BIO_PARSE_HOSTSERV 0 +#define BIO_F_BIO_PUTS 0 +#define BIO_F_BIO_READ 0 +#define BIO_F_BIO_READ_EX 0 +#define BIO_F_BIO_READ_INTERN 0 +#define BIO_F_BIO_SOCKET 0 +#define BIO_F_BIO_SOCKET_NBIO 0 +#define BIO_F_BIO_SOCK_INFO 0 +#define BIO_F_BIO_SOCK_INIT 0 +#define BIO_F_BIO_WRITE 0 +#define BIO_F_BIO_WRITE_EX 0 +#define BIO_F_BIO_WRITE_INTERN 0 +#define BIO_F_BUFFER_CTRL 0 +#define BIO_F_CONN_CTRL 0 +#define BIO_F_CONN_STATE 0 +#define BIO_F_DGRAM_SCTP_NEW 0 +#define BIO_F_DGRAM_SCTP_READ 0 +#define BIO_F_DGRAM_SCTP_WRITE 0 +#define BIO_F_DOAPR_OUTCH 0 +#define BIO_F_FILE_CTRL 0 +#define BIO_F_FILE_READ 0 +#define BIO_F_LINEBUFFER_CTRL 0 +#define BIO_F_LINEBUFFER_NEW 0 +#define BIO_F_MEM_WRITE 0 +#define BIO_F_NBIOF_NEW 0 +#define BIO_F_SLG_WRITE 0 +#define BIO_F_SSL_NEW 0 + +/* + * BN function codes. + */ +#define BN_F_BNRAND 0 +#define BN_F_BNRAND_RANGE 0 +#define BN_F_BN_BLINDING_CONVERT_EX 0 +#define BN_F_BN_BLINDING_CREATE_PARAM 0 +#define BN_F_BN_BLINDING_INVERT_EX 0 +#define BN_F_BN_BLINDING_NEW 0 +#define BN_F_BN_BLINDING_UPDATE 0 +#define BN_F_BN_BN2DEC 0 +#define BN_F_BN_BN2HEX 0 +#define BN_F_BN_COMPUTE_WNAF 0 +#define BN_F_BN_CTX_GET 0 +#define BN_F_BN_CTX_NEW 0 +#define BN_F_BN_CTX_START 0 +#define BN_F_BN_DIV 0 +#define BN_F_BN_DIV_RECP 0 +#define BN_F_BN_EXP 0 +#define BN_F_BN_EXPAND_INTERNAL 0 +#define BN_F_BN_GENCB_NEW 0 +#define BN_F_BN_GENERATE_DSA_NONCE 0 +#define BN_F_BN_GENERATE_PRIME_EX 0 +#define BN_F_BN_GF2M_MOD 0 +#define BN_F_BN_GF2M_MOD_EXP 0 +#define BN_F_BN_GF2M_MOD_MUL 0 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD 0 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 0 +#define BN_F_BN_GF2M_MOD_SQR 0 +#define BN_F_BN_GF2M_MOD_SQRT 0 +#define BN_F_BN_LSHIFT 0 +#define BN_F_BN_MOD_EXP2_MONT 0 +#define BN_F_BN_MOD_EXP_MONT 0 +#define BN_F_BN_MOD_EXP_MONT_CONSTTIME 0 +#define BN_F_BN_MOD_EXP_MONT_WORD 0 +#define BN_F_BN_MOD_EXP_RECP 0 +#define BN_F_BN_MOD_EXP_SIMPLE 0 +#define BN_F_BN_MOD_INVERSE 0 +#define BN_F_BN_MOD_INVERSE_NO_BRANCH 0 +#define BN_F_BN_MOD_LSHIFT_QUICK 0 +#define BN_F_BN_MOD_SQRT 0 +#define BN_F_BN_MONT_CTX_NEW 0 +#define BN_F_BN_MPI2BN 0 +#define BN_F_BN_NEW 0 +#define BN_F_BN_POOL_GET 0 +#define BN_F_BN_RAND 0 +#define BN_F_BN_RAND_RANGE 0 +#define BN_F_BN_RECP_CTX_NEW 0 +#define BN_F_BN_RSHIFT 0 +#define BN_F_BN_SET_WORDS 0 +#define BN_F_BN_STACK_PUSH 0 +#define BN_F_BN_USUB 0 + +/* + * BUF function codes. + */ +#define BUF_F_BUF_MEM_GROW 0 +#define BUF_F_BUF_MEM_GROW_CLEAN 0 +#define BUF_F_BUF_MEM_NEW 0 + +#ifndef OPENSSL_NO_CMS +/* + * CMS function codes. + */ +#define CMS_F_CHECK_CONTENT 0 +#define CMS_F_CMS_ADD0_CERT 0 +#define CMS_F_CMS_ADD0_RECIPIENT_KEY 0 +#define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 0 +#define CMS_F_CMS_ADD1_RECEIPTREQUEST 0 +#define CMS_F_CMS_ADD1_RECIPIENT_CERT 0 +#define CMS_F_CMS_ADD1_SIGNER 0 +#define CMS_F_CMS_ADD1_SIGNINGTIME 0 +#define CMS_F_CMS_COMPRESS 0 +#define CMS_F_CMS_COMPRESSEDDATA_CREATE 0 +#define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 0 +#define CMS_F_CMS_COPY_CONTENT 0 +#define CMS_F_CMS_COPY_MESSAGEDIGEST 0 +#define CMS_F_CMS_DATA 0 +#define CMS_F_CMS_DATAFINAL 0 +#define CMS_F_CMS_DATAINIT 0 +#define CMS_F_CMS_DECRYPT 0 +#define CMS_F_CMS_DECRYPT_SET1_KEY 0 +#define CMS_F_CMS_DECRYPT_SET1_PASSWORD 0 +#define CMS_F_CMS_DECRYPT_SET1_PKEY 0 +#define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 0 +#define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 0 +#define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 0 +#define CMS_F_CMS_DIGEST_VERIFY 0 +#define CMS_F_CMS_ENCODE_RECEIPT 0 +#define CMS_F_CMS_ENCRYPT 0 +#define CMS_F_CMS_ENCRYPTEDCONTENT_INIT 0 +#define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 0 +#define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 0 +#define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 0 +#define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 0 +#define CMS_F_CMS_ENVELOPEDDATA_CREATE 0 +#define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 0 +#define CMS_F_CMS_ENVELOPED_DATA_INIT 0 +#define CMS_F_CMS_ENV_ASN1_CTRL 0 +#define CMS_F_CMS_FINAL 0 +#define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 0 +#define CMS_F_CMS_GET0_CONTENT 0 +#define CMS_F_CMS_GET0_ECONTENT_TYPE 0 +#define CMS_F_CMS_GET0_ENVELOPED 0 +#define CMS_F_CMS_GET0_REVOCATION_CHOICES 0 +#define CMS_F_CMS_GET0_SIGNED 0 +#define CMS_F_CMS_MSGSIGDIGEST_ADD1 0 +#define CMS_F_CMS_RECEIPTREQUEST_CREATE0 0 +#define CMS_F_CMS_RECEIPT_VERIFY 0 +#define CMS_F_CMS_RECIPIENTINFO_DECRYPT 0 +#define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 0 +#define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 0 +#define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 0 +#define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 0 +#define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 0 +#define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 0 +#define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 0 +#define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 0 +#define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 0 +#define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 0 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 0 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 0 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 0 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 0 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 0 +#define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 0 +#define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 0 +#define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 0 +#define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 0 +#define CMS_F_CMS_SD_ASN1_CTRL 0 +#define CMS_F_CMS_SET1_IAS 0 +#define CMS_F_CMS_SET1_KEYID 0 +#define CMS_F_CMS_SET1_SIGNERIDENTIFIER 0 +#define CMS_F_CMS_SET_DETACHED 0 +#define CMS_F_CMS_SIGN 0 +#define CMS_F_CMS_SIGNED_DATA_INIT 0 +#define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 0 +#define CMS_F_CMS_SIGNERINFO_SIGN 0 +#define CMS_F_CMS_SIGNERINFO_VERIFY 0 +#define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 0 +#define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 0 +#define CMS_F_CMS_SIGN_RECEIPT 0 +#define CMS_F_CMS_SI_CHECK_ATTRIBUTES 0 +#define CMS_F_CMS_STREAM 0 +#define CMS_F_CMS_UNCOMPRESS 0 +#define CMS_F_CMS_VERIFY 0 +#define CMS_F_KEK_UNWRAP_KEY 0 +#endif + +#ifndef OPENSSL_NO_COMP +/* + * COMP function codes. + */ +#define COMP_F_BIO_ZLIB_FLUSH 0 +#define COMP_F_BIO_ZLIB_NEW 0 +#define COMP_F_BIO_ZLIB_READ 0 +#define COMP_F_BIO_ZLIB_WRITE 0 +#define COMP_F_COMP_CTX_NEW 0 +#endif + +/* + * CONF function codes. + */ +#define CONF_F_CONF_DUMP_FP 0 +#define CONF_F_CONF_LOAD 0 +#define CONF_F_CONF_LOAD_FP 0 +#define CONF_F_CONF_PARSE_LIST 0 +#define CONF_F_DEF_LOAD 0 +#define CONF_F_DEF_LOAD_BIO 0 +#define CONF_F_GET_NEXT_FILE 0 +#define CONF_F_MODULE_ADD 0 +#define CONF_F_MODULE_INIT 0 +#define CONF_F_MODULE_LOAD_DSO 0 +#define CONF_F_MODULE_RUN 0 +#define CONF_F_NCONF_DUMP_BIO 0 +#define CONF_F_NCONF_DUMP_FP 0 +#define CONF_F_NCONF_GET_NUMBER_E 0 +#define CONF_F_NCONF_GET_SECTION 0 +#define CONF_F_NCONF_GET_STRING 0 +#define CONF_F_NCONF_LOAD 0 +#define CONF_F_NCONF_LOAD_BIO 0 +#define CONF_F_NCONF_LOAD_FP 0 +#define CONF_F_NCONF_NEW 0 +#define CONF_F_PROCESS_INCLUDE 0 +#define CONF_F_SSL_MODULE_INIT 0 +#define CONF_F_STR_COPY 0 + +/* + * CRYPTO function codes. + */ +#define CRYPTO_F_CMAC_CTX_NEW 0 +#define CRYPTO_F_CRYPTO_DUP_EX_DATA 0 +#define CRYPTO_F_CRYPTO_FREE_EX_DATA 0 +#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 0 +#define CRYPTO_F_CRYPTO_MEMDUP 0 +#define CRYPTO_F_CRYPTO_NEW_EX_DATA 0 +#define CRYPTO_F_CRYPTO_OCB128_COPY_CTX 0 +#define CRYPTO_F_CRYPTO_OCB128_INIT 0 +#define CRYPTO_F_CRYPTO_SET_EX_DATA 0 +#define CRYPTO_F_GET_AND_LOCK 0 +#define CRYPTO_F_OPENSSL_ATEXIT 0 +#define CRYPTO_F_OPENSSL_BUF2HEXSTR 0 +#define CRYPTO_F_OPENSSL_FOPEN 0 +#define CRYPTO_F_OPENSSL_HEXSTR2BUF 0 +#define CRYPTO_F_OPENSSL_INIT_CRYPTO 0 +#define CRYPTO_F_OPENSSL_LH_NEW 0 +#define CRYPTO_F_OPENSSL_SK_DEEP_COPY 0 +#define CRYPTO_F_OPENSSL_SK_DUP 0 +#define CRYPTO_F_PKEY_HMAC_INIT 0 +#define CRYPTO_F_PKEY_POLY1305_INIT 0 +#define CRYPTO_F_PKEY_SIPHASH_INIT 0 +#define CRYPTO_F_SK_RESERVE 0 + +#ifndef OPENSSL_NO_CT +/* + * CT function codes. + */ +#define CT_F_CTLOG_NEW 0 +#define CT_F_CTLOG_NEW_FROM_BASE64 0 +#define CT_F_CTLOG_NEW_FROM_CONF 0 +#define CT_F_CTLOG_STORE_LOAD_CTX_NEW 0 +#define CT_F_CTLOG_STORE_LOAD_FILE 0 +#define CT_F_CTLOG_STORE_LOAD_LOG 0 +#define CT_F_CTLOG_STORE_NEW 0 +#define CT_F_CT_BASE64_DECODE 0 +#define CT_F_CT_POLICY_EVAL_CTX_NEW 0 +#define CT_F_CT_V1_LOG_ID_FROM_PKEY 0 +#define CT_F_I2O_SCT 0 +#define CT_F_I2O_SCT_LIST 0 +#define CT_F_I2O_SCT_SIGNATURE 0 +#define CT_F_O2I_SCT 0 +#define CT_F_O2I_SCT_LIST 0 +#define CT_F_O2I_SCT_SIGNATURE 0 +#define CT_F_SCT_CTX_NEW 0 +#define CT_F_SCT_CTX_VERIFY 0 +#define CT_F_SCT_NEW 0 +#define CT_F_SCT_NEW_FROM_BASE64 0 +#define CT_F_SCT_SET0_LOG_ID 0 +#define CT_F_SCT_SET1_EXTENSIONS 0 +#define CT_F_SCT_SET1_LOG_ID 0 +#define CT_F_SCT_SET1_SIGNATURE 0 +#define CT_F_SCT_SET_LOG_ENTRY_TYPE 0 +#define CT_F_SCT_SET_SIGNATURE_NID 0 +#define CT_F_SCT_SET_VERSION 0 +#endif + +#ifndef OPENSSL_NO_DH +/* + * DH function codes. + */ +#define DH_F_COMPUTE_KEY 0 +#define DH_F_DHPARAMS_PRINT_FP 0 +#define DH_F_DH_BUILTIN_GENPARAMS 0 +#define DH_F_DH_CHECK_EX 0 +#define DH_F_DH_CHECK_PARAMS_EX 0 +#define DH_F_DH_CHECK_PUB_KEY_EX 0 +#define DH_F_DH_CMS_DECRYPT 0 +#define DH_F_DH_CMS_SET_PEERKEY 0 +#define DH_F_DH_CMS_SET_SHARED_INFO 0 +#define DH_F_DH_METH_DUP 0 +#define DH_F_DH_METH_NEW 0 +#define DH_F_DH_METH_SET1_NAME 0 +#define DH_F_DH_NEW_BY_NID 0 +#define DH_F_DH_NEW_METHOD 0 +#define DH_F_DH_PARAM_DECODE 0 +#define DH_F_DH_PKEY_PUBLIC_CHECK 0 +#define DH_F_DH_PRIV_DECODE 0 +#define DH_F_DH_PRIV_ENCODE 0 +#define DH_F_DH_PUB_DECODE 0 +#define DH_F_DH_PUB_ENCODE 0 +#define DH_F_DO_DH_PRINT 0 +#define DH_F_GENERATE_KEY 0 +#define DH_F_PKEY_DH_CTRL_STR 0 +#define DH_F_PKEY_DH_DERIVE 0 +#define DH_F_PKEY_DH_INIT 0 +#define DH_F_PKEY_DH_KEYGEN 0 +#endif + +#ifndef OPENSSL_NO_DSA +/* + * DSA function codes. + */ +#define DSA_F_DSAPARAMS_PRINT 0 +#define DSA_F_DSAPARAMS_PRINT_FP 0 +#define DSA_F_DSA_BUILTIN_PARAMGEN 0 +#define DSA_F_DSA_BUILTIN_PARAMGEN2 0 +#define DSA_F_DSA_DO_SIGN 0 +#define DSA_F_DSA_DO_VERIFY 0 +#define DSA_F_DSA_METH_DUP 0 +#define DSA_F_DSA_METH_NEW 0 +#define DSA_F_DSA_METH_SET1_NAME 0 +#define DSA_F_DSA_NEW_METHOD 0 +#define DSA_F_DSA_PARAM_DECODE 0 +#define DSA_F_DSA_PRINT_FP 0 +#define DSA_F_DSA_PRIV_DECODE 0 +#define DSA_F_DSA_PRIV_ENCODE 0 +#define DSA_F_DSA_PUB_DECODE 0 +#define DSA_F_DSA_PUB_ENCODE 0 +#define DSA_F_DSA_SIGN 0 +#define DSA_F_DSA_SIGN_SETUP 0 +#define DSA_F_DSA_SIG_NEW 0 +#define DSA_F_OLD_DSA_PRIV_DECODE 0 +#define DSA_F_PKEY_DSA_CTRL 0 +#define DSA_F_PKEY_DSA_CTRL_STR 0 +#define DSA_F_PKEY_DSA_KEYGEN 0 +#endif + +#ifndef OPENSSL_NO_EC +/* + * EC function codes. + */ +#define EC_F_BN_TO_FELEM 0 +#define EC_F_D2I_ECPARAMETERS 0 +#define EC_F_D2I_ECPKPARAMETERS 0 +#define EC_F_D2I_ECPRIVATEKEY 0 +#define EC_F_DO_EC_KEY_PRINT 0 +#define EC_F_ECDH_CMS_DECRYPT 0 +#define EC_F_ECDH_CMS_SET_SHARED_INFO 0 +#define EC_F_ECDH_COMPUTE_KEY 0 +#define EC_F_ECDH_SIMPLE_COMPUTE_KEY 0 +#define EC_F_ECDSA_DO_SIGN_EX 0 +#define EC_F_ECDSA_DO_VERIFY 0 +#define EC_F_ECDSA_SIGN_EX 0 +#define EC_F_ECDSA_SIGN_SETUP 0 +#define EC_F_ECDSA_SIG_NEW 0 +#define EC_F_ECDSA_VERIFY 0 +#define EC_F_ECD_ITEM_VERIFY 0 +#define EC_F_ECKEY_PARAM2TYPE 0 +#define EC_F_ECKEY_PARAM_DECODE 0 +#define EC_F_ECKEY_PRIV_DECODE 0 +#define EC_F_ECKEY_PRIV_ENCODE 0 +#define EC_F_ECKEY_PUB_DECODE 0 +#define EC_F_ECKEY_PUB_ENCODE 0 +#define EC_F_ECKEY_TYPE2PARAM 0 +#define EC_F_ECPARAMETERS_PRINT 0 +#define EC_F_ECPARAMETERS_PRINT_FP 0 +#define EC_F_ECPKPARAMETERS_PRINT 0 +#define EC_F_ECPKPARAMETERS_PRINT_FP 0 +#define EC_F_ECP_NISTZ256_GET_AFFINE 0 +#define EC_F_ECP_NISTZ256_INV_MOD_ORD 0 +#define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE 0 +#define EC_F_ECP_NISTZ256_POINTS_MUL 0 +#define EC_F_ECP_NISTZ256_PRE_COMP_NEW 0 +#define EC_F_ECP_NISTZ256_WINDOWED_MUL 0 +#define EC_F_ECX_KEY_OP 0 +#define EC_F_ECX_PRIV_ENCODE 0 +#define EC_F_ECX_PUB_ENCODE 0 +#define EC_F_EC_ASN1_GROUP2CURVE 0 +#define EC_F_EC_ASN1_GROUP2FIELDID 0 +#define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 0 +#define EC_F_EC_GF2M_SIMPLE_FIELD_INV 0 +#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 0 +#define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 0 +#define EC_F_EC_GF2M_SIMPLE_LADDER_POST 0 +#define EC_F_EC_GF2M_SIMPLE_LADDER_PRE 0 +#define EC_F_EC_GF2M_SIMPLE_OCT2POINT 0 +#define EC_F_EC_GF2M_SIMPLE_POINT2OCT 0 +#define EC_F_EC_GF2M_SIMPLE_POINTS_MUL 0 +#define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 0 +#define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 0 +#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 0 +#define EC_F_EC_GFP_MONT_FIELD_DECODE 0 +#define EC_F_EC_GFP_MONT_FIELD_ENCODE 0 +#define EC_F_EC_GFP_MONT_FIELD_INV 0 +#define EC_F_EC_GFP_MONT_FIELD_MUL 0 +#define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 0 +#define EC_F_EC_GFP_MONT_FIELD_SQR 0 +#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 0 +#define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 0 +#define EC_F_EC_GFP_NISTP224_POINTS_MUL 0 +#define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 0 +#define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 0 +#define EC_F_EC_GFP_NISTP256_POINTS_MUL 0 +#define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 0 +#define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 0 +#define EC_F_EC_GFP_NISTP521_POINTS_MUL 0 +#define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 0 +#define EC_F_EC_GFP_NIST_FIELD_MUL 0 +#define EC_F_EC_GFP_NIST_FIELD_SQR 0 +#define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 0 +#define EC_F_EC_GFP_SIMPLE_BLIND_COORDINATES 0 +#define EC_F_EC_GFP_SIMPLE_FIELD_INV 0 +#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 0 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 0 +#define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 0 +#define EC_F_EC_GFP_SIMPLE_OCT2POINT 0 +#define EC_F_EC_GFP_SIMPLE_POINT2OCT 0 +#define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 0 +#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 0 +#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 0 +#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 0 +#define EC_F_EC_GROUP_CHECK 0 +#define EC_F_EC_GROUP_CHECK_DISCRIMINANT 0 +#define EC_F_EC_GROUP_COPY 0 +#define EC_F_EC_GROUP_GET_CURVE 0 +#define EC_F_EC_GROUP_GET_CURVE_GF2M 0 +#define EC_F_EC_GROUP_GET_CURVE_GFP 0 +#define EC_F_EC_GROUP_GET_DEGREE 0 +#define EC_F_EC_GROUP_GET_ECPARAMETERS 0 +#define EC_F_EC_GROUP_GET_ECPKPARAMETERS 0 +#define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 0 +#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 0 +#define EC_F_EC_GROUP_NEW 0 +#define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 0 +#define EC_F_EC_GROUP_NEW_FROM_DATA 0 +#define EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS 0 +#define EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS 0 +#define EC_F_EC_GROUP_SET_CURVE 0 +#define EC_F_EC_GROUP_SET_CURVE_GF2M 0 +#define EC_F_EC_GROUP_SET_CURVE_GFP 0 +#define EC_F_EC_GROUP_SET_GENERATOR 0 +#define EC_F_EC_GROUP_SET_SEED 0 +#define EC_F_EC_KEY_CHECK_KEY 0 +#define EC_F_EC_KEY_COPY 0 +#define EC_F_EC_KEY_GENERATE_KEY 0 +#define EC_F_EC_KEY_NEW 0 +#define EC_F_EC_KEY_NEW_METHOD 0 +#define EC_F_EC_KEY_OCT2PRIV 0 +#define EC_F_EC_KEY_PRINT 0 +#define EC_F_EC_KEY_PRINT_FP 0 +#define EC_F_EC_KEY_PRIV2BUF 0 +#define EC_F_EC_KEY_PRIV2OCT 0 +#define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 0 +#define EC_F_EC_KEY_SIMPLE_CHECK_KEY 0 +#define EC_F_EC_KEY_SIMPLE_OCT2PRIV 0 +#define EC_F_EC_KEY_SIMPLE_PRIV2OCT 0 +#define EC_F_EC_PKEY_CHECK 0 +#define EC_F_EC_PKEY_PARAM_CHECK 0 +#define EC_F_EC_POINTS_MAKE_AFFINE 0 +#define EC_F_EC_POINTS_MUL 0 +#define EC_F_EC_POINT_ADD 0 +#define EC_F_EC_POINT_BN2POINT 0 +#define EC_F_EC_POINT_CMP 0 +#define EC_F_EC_POINT_COPY 0 +#define EC_F_EC_POINT_DBL 0 +#define EC_F_EC_POINT_GET_AFFINE_COORDINATES 0 +#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 0 +#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 0 +#define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 0 +#define EC_F_EC_POINT_INVERT 0 +#define EC_F_EC_POINT_IS_AT_INFINITY 0 +#define EC_F_EC_POINT_IS_ON_CURVE 0 +#define EC_F_EC_POINT_MAKE_AFFINE 0 +#define EC_F_EC_POINT_NEW 0 +#define EC_F_EC_POINT_OCT2POINT 0 +#define EC_F_EC_POINT_POINT2BUF 0 +#define EC_F_EC_POINT_POINT2OCT 0 +#define EC_F_EC_POINT_SET_AFFINE_COORDINATES 0 +#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 0 +#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 0 +#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES 0 +#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 0 +#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 0 +#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 0 +#define EC_F_EC_POINT_SET_TO_INFINITY 0 +#define EC_F_EC_PRE_COMP_NEW 0 +#define EC_F_EC_SCALAR_MUL_LADDER 0 +#define EC_F_EC_WNAF_MUL 0 +#define EC_F_EC_WNAF_PRECOMPUTE_MULT 0 +#define EC_F_I2D_ECPARAMETERS 0 +#define EC_F_I2D_ECPKPARAMETERS 0 +#define EC_F_I2D_ECPRIVATEKEY 0 +#define EC_F_I2O_ECPUBLICKEY 0 +#define EC_F_NISTP224_PRE_COMP_NEW 0 +#define EC_F_NISTP256_PRE_COMP_NEW 0 +#define EC_F_NISTP521_PRE_COMP_NEW 0 +#define EC_F_O2I_ECPUBLICKEY 0 +#define EC_F_OLD_EC_PRIV_DECODE 0 +#define EC_F_OSSL_ECDH_COMPUTE_KEY 0 +#define EC_F_OSSL_ECDSA_SIGN_SIG 0 +#define EC_F_OSSL_ECDSA_VERIFY_SIG 0 +#define EC_F_PKEY_ECD_CTRL 0 +#define EC_F_PKEY_ECD_DIGESTSIGN 0 +#define EC_F_PKEY_ECD_DIGESTSIGN25519 0 +#define EC_F_PKEY_ECD_DIGESTSIGN448 0 +#define EC_F_PKEY_ECX_DERIVE 0 +#define EC_F_PKEY_EC_CTRL 0 +#define EC_F_PKEY_EC_CTRL_STR 0 +#define EC_F_PKEY_EC_DERIVE 0 +#define EC_F_PKEY_EC_INIT 0 +#define EC_F_PKEY_EC_KDF_DERIVE 0 +#define EC_F_PKEY_EC_KEYGEN 0 +#define EC_F_PKEY_EC_PARAMGEN 0 +#define EC_F_PKEY_EC_SIGN 0 +#define EC_F_VALIDATE_ECX_DERIVE 0 +#endif + +#ifndef OPENSSL_NO_ENGINE +/* + * ENGINE function codes. + */ +#define ENGINE_F_DIGEST_UPDATE 0 +#define ENGINE_F_DYNAMIC_CTRL 0 +#define ENGINE_F_DYNAMIC_GET_DATA_CTX 0 +#define ENGINE_F_DYNAMIC_LOAD 0 +#define ENGINE_F_DYNAMIC_SET_DATA_CTX 0 +#define ENGINE_F_ENGINE_ADD 0 +#define ENGINE_F_ENGINE_BY_ID 0 +#define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 0 +#define ENGINE_F_ENGINE_CTRL 0 +#define ENGINE_F_ENGINE_CTRL_CMD 0 +#define ENGINE_F_ENGINE_CTRL_CMD_STRING 0 +#define ENGINE_F_ENGINE_FINISH 0 +#define ENGINE_F_ENGINE_GET_CIPHER 0 +#define ENGINE_F_ENGINE_GET_DIGEST 0 +#define ENGINE_F_ENGINE_GET_FIRST 0 +#define ENGINE_F_ENGINE_GET_LAST 0 +#define ENGINE_F_ENGINE_GET_NEXT 0 +#define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 0 +#define ENGINE_F_ENGINE_GET_PKEY_METH 0 +#define ENGINE_F_ENGINE_GET_PREV 0 +#define ENGINE_F_ENGINE_INIT 0 +#define ENGINE_F_ENGINE_LIST_ADD 0 +#define ENGINE_F_ENGINE_LIST_REMOVE 0 +#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 0 +#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 0 +#define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 0 +#define ENGINE_F_ENGINE_NEW 0 +#define ENGINE_F_ENGINE_PKEY_ASN1_FIND_STR 0 +#define ENGINE_F_ENGINE_REMOVE 0 +#define ENGINE_F_ENGINE_SET_DEFAULT_STRING 0 +#define ENGINE_F_ENGINE_SET_ID 0 +#define ENGINE_F_ENGINE_SET_NAME 0 +#define ENGINE_F_ENGINE_TABLE_REGISTER 0 +#define ENGINE_F_ENGINE_UNLOCKED_FINISH 0 +#define ENGINE_F_ENGINE_UP_REF 0 +#define ENGINE_F_INT_CLEANUP_ITEM 0 +#define ENGINE_F_INT_CTRL_HELPER 0 +#define ENGINE_F_INT_ENGINE_CONFIGURE 0 +#define ENGINE_F_INT_ENGINE_MODULE_INIT 0 +#define ENGINE_F_OSSL_HMAC_INIT 0 +#endif + +/* + * EVP function codes. + */ +#define EVP_F_AESNI_INIT_KEY 0 +#define EVP_F_AESNI_XTS_INIT_KEY 0 +#define EVP_F_AES_GCM_CTRL 0 +#define EVP_F_AES_INIT_KEY 0 +#define EVP_F_AES_OCB_CIPHER 0 +#define EVP_F_AES_T4_INIT_KEY 0 +#define EVP_F_AES_T4_XTS_INIT_KEY 0 +#define EVP_F_AES_WRAP_CIPHER 0 +#define EVP_F_AES_XTS_INIT_KEY 0 +#define EVP_F_ALG_MODULE_INIT 0 +#define EVP_F_ARIA_CCM_INIT_KEY 0 +#define EVP_F_ARIA_GCM_CTRL 0 +#define EVP_F_ARIA_GCM_INIT_KEY 0 +#define EVP_F_ARIA_INIT_KEY 0 +#define EVP_F_B64_NEW 0 +#define EVP_F_CAMELLIA_INIT_KEY 0 +#define EVP_F_CHACHA20_POLY1305_CTRL 0 +#define EVP_F_CMLL_T4_INIT_KEY 0 +#define EVP_F_DES_EDE3_WRAP_CIPHER 0 +#define EVP_F_DO_SIGVER_INIT 0 +#define EVP_F_ENC_NEW 0 +#define EVP_F_EVP_CIPHERINIT_EX 0 +#define EVP_F_EVP_CIPHER_ASN1_TO_PARAM 0 +#define EVP_F_EVP_CIPHER_CTX_COPY 0 +#define EVP_F_EVP_CIPHER_CTX_CTRL 0 +#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 0 +#define EVP_F_EVP_CIPHER_PARAM_TO_ASN1 0 +#define EVP_F_EVP_DECRYPTFINAL_EX 0 +#define EVP_F_EVP_DECRYPTUPDATE 0 +#define EVP_F_EVP_DIGESTFINALXOF 0 +#define EVP_F_EVP_DIGESTINIT_EX 0 +#define EVP_F_EVP_ENCRYPTDECRYPTUPDATE 0 +#define EVP_F_EVP_ENCRYPTFINAL_EX 0 +#define EVP_F_EVP_ENCRYPTUPDATE 0 +#define EVP_F_EVP_MD_CTX_COPY_EX 0 +#define EVP_F_EVP_MD_SIZE 0 +#define EVP_F_EVP_OPENINIT 0 +#define EVP_F_EVP_PBE_ALG_ADD 0 +#define EVP_F_EVP_PBE_ALG_ADD_TYPE 0 +#define EVP_F_EVP_PBE_CIPHERINIT 0 +#define EVP_F_EVP_PBE_SCRYPT 0 +#define EVP_F_EVP_PKCS82PKEY 0 +#define EVP_F_EVP_PKEY2PKCS8 0 +#define EVP_F_EVP_PKEY_ASN1_ADD0 0 +#define EVP_F_EVP_PKEY_CHECK 0 +#define EVP_F_EVP_PKEY_COPY_PARAMETERS 0 +#define EVP_F_EVP_PKEY_CTX_CTRL 0 +#define EVP_F_EVP_PKEY_CTX_CTRL_STR 0 +#define EVP_F_EVP_PKEY_CTX_DUP 0 +#define EVP_F_EVP_PKEY_CTX_MD 0 +#define EVP_F_EVP_PKEY_DECRYPT 0 +#define EVP_F_EVP_PKEY_DECRYPT_INIT 0 +#define EVP_F_EVP_PKEY_DECRYPT_OLD 0 +#define EVP_F_EVP_PKEY_DERIVE 0 +#define EVP_F_EVP_PKEY_DERIVE_INIT 0 +#define EVP_F_EVP_PKEY_DERIVE_SET_PEER 0 +#define EVP_F_EVP_PKEY_ENCRYPT 0 +#define EVP_F_EVP_PKEY_ENCRYPT_INIT 0 +#define EVP_F_EVP_PKEY_ENCRYPT_OLD 0 +#define EVP_F_EVP_PKEY_GET0_DH 0 +#define EVP_F_EVP_PKEY_GET0_DSA 0 +#define EVP_F_EVP_PKEY_GET0_EC_KEY 0 +#define EVP_F_EVP_PKEY_GET0_HMAC 0 +#define EVP_F_EVP_PKEY_GET0_POLY1305 0 +#define EVP_F_EVP_PKEY_GET0_RSA 0 +#define EVP_F_EVP_PKEY_GET0_SIPHASH 0 +#define EVP_F_EVP_PKEY_GET_RAW_PRIVATE_KEY 0 +#define EVP_F_EVP_PKEY_GET_RAW_PUBLIC_KEY 0 +#define EVP_F_EVP_PKEY_KEYGEN 0 +#define EVP_F_EVP_PKEY_KEYGEN_INIT 0 +#define EVP_F_EVP_PKEY_METH_ADD0 0 +#define EVP_F_EVP_PKEY_METH_NEW 0 +#define EVP_F_EVP_PKEY_NEW 0 +#define EVP_F_EVP_PKEY_NEW_CMAC_KEY 0 +#define EVP_F_EVP_PKEY_NEW_RAW_PRIVATE_KEY 0 +#define EVP_F_EVP_PKEY_NEW_RAW_PUBLIC_KEY 0 +#define EVP_F_EVP_PKEY_PARAMGEN 0 +#define EVP_F_EVP_PKEY_PARAMGEN_INIT 0 +#define EVP_F_EVP_PKEY_PARAM_CHECK 0 +#define EVP_F_EVP_PKEY_PUBLIC_CHECK 0 +#define EVP_F_EVP_PKEY_SET1_ENGINE 0 +#define EVP_F_EVP_PKEY_SET_ALIAS_TYPE 0 +#define EVP_F_EVP_PKEY_SIGN 0 +#define EVP_F_EVP_PKEY_SIGN_INIT 0 +#define EVP_F_EVP_PKEY_VERIFY 0 +#define EVP_F_EVP_PKEY_VERIFY_INIT 0 +#define EVP_F_EVP_PKEY_VERIFY_RECOVER 0 +#define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 0 +#define EVP_F_EVP_SIGNFINAL 0 +#define EVP_F_EVP_VERIFYFINAL 0 +#define EVP_F_INT_CTX_NEW 0 +#define EVP_F_OK_NEW 0 +#define EVP_F_PKCS5_PBE_KEYIVGEN 0 +#define EVP_F_PKCS5_V2_PBE_KEYIVGEN 0 +#define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 0 +#define EVP_F_PKCS5_V2_SCRYPT_KEYIVGEN 0 +#define EVP_F_PKEY_SET_TYPE 0 +#define EVP_F_RC2_MAGIC_TO_METH 0 +#define EVP_F_RC5_CTRL 0 +#define EVP_F_R_32_12_16_INIT_KEY 0 +#define EVP_F_S390X_AES_GCM_CTRL 0 +#define EVP_F_UPDATE 0 + +/* + * KDF function codes. + */ +#define KDF_F_PKEY_HKDF_CTRL_STR 0 +#define KDF_F_PKEY_HKDF_DERIVE 0 +#define KDF_F_PKEY_HKDF_INIT 0 +#define KDF_F_PKEY_SCRYPT_CTRL_STR 0 +#define KDF_F_PKEY_SCRYPT_CTRL_UINT64 0 +#define KDF_F_PKEY_SCRYPT_DERIVE 0 +#define KDF_F_PKEY_SCRYPT_INIT 0 +#define KDF_F_PKEY_SCRYPT_SET_MEMBUF 0 +#define KDF_F_PKEY_TLS1_PRF_CTRL_STR 0 +#define KDF_F_PKEY_TLS1_PRF_DERIVE 0 +#define KDF_F_PKEY_TLS1_PRF_INIT 0 +#define KDF_F_TLS1_PRF_ALG 0 + +/* + * KDF reason codes. + */ +#define KDF_R_INVALID_DIGEST 0 +#define KDF_R_MISSING_ITERATION_COUNT 0 +#define KDF_R_MISSING_KEY 0 +#define KDF_R_MISSING_MESSAGE_DIGEST 0 +#define KDF_R_MISSING_PARAMETER 0 +#define KDF_R_MISSING_PASS 0 +#define KDF_R_MISSING_SALT 0 +#define KDF_R_MISSING_SECRET 0 +#define KDF_R_MISSING_SEED 0 +#define KDF_R_UNKNOWN_PARAMETER_TYPE 0 +#define KDF_R_VALUE_ERROR 0 +#define KDF_R_VALUE_MISSING 0 + +/* + * OBJ function codes. + */ +#define OBJ_F_OBJ_ADD_OBJECT 0 +#define OBJ_F_OBJ_ADD_SIGID 0 +#define OBJ_F_OBJ_CREATE 0 +#define OBJ_F_OBJ_DUP 0 +#define OBJ_F_OBJ_NAME_NEW_INDEX 0 +#define OBJ_F_OBJ_NID2LN 0 +#define OBJ_F_OBJ_NID2OBJ 0 +#define OBJ_F_OBJ_NID2SN 0 +#define OBJ_F_OBJ_TXT2OBJ 0 + +#ifndef OPENSSL_NO_OCSP +/* + * OCSP function codes. + */ +#define OCSP_F_D2I_OCSP_NONCE 0 +#define OCSP_F_OCSP_BASIC_ADD1_STATUS 0 +#define OCSP_F_OCSP_BASIC_SIGN 0 +#define OCSP_F_OCSP_BASIC_SIGN_CTX 0 +#define OCSP_F_OCSP_BASIC_VERIFY 0 +#define OCSP_F_OCSP_CERT_ID_NEW 0 +#define OCSP_F_OCSP_CHECK_DELEGATED 0 +#define OCSP_F_OCSP_CHECK_IDS 0 +#define OCSP_F_OCSP_CHECK_ISSUER 0 +#define OCSP_F_OCSP_CHECK_VALIDITY 0 +#define OCSP_F_OCSP_MATCH_ISSUERID 0 +#define OCSP_F_OCSP_PARSE_URL 0 +#define OCSP_F_OCSP_REQUEST_SIGN 0 +#define OCSP_F_OCSP_REQUEST_VERIFY 0 +#define OCSP_F_OCSP_RESPONSE_GET1_BASIC 0 +#define OCSP_F_PARSE_HTTP_LINE1 0 +#endif + +/* + * PEM function codes. + */ +#define PEM_F_B2I_DSS 0 +#define PEM_F_B2I_PVK_BIO 0 +#define PEM_F_B2I_RSA 0 +#define PEM_F_CHECK_BITLEN_DSA 0 +#define PEM_F_CHECK_BITLEN_RSA 0 +#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 0 +#define PEM_F_D2I_PKCS8PRIVATEKEY_FP 0 +#define PEM_F_DO_B2I 0 +#define PEM_F_DO_B2I_BIO 0 +#define PEM_F_DO_BLOB_HEADER 0 +#define PEM_F_DO_I2B 0 +#define PEM_F_DO_PK8PKEY 0 +#define PEM_F_DO_PK8PKEY_FP 0 +#define PEM_F_DO_PVK_BODY 0 +#define PEM_F_DO_PVK_HEADER 0 +#define PEM_F_GET_HEADER_AND_DATA 0 +#define PEM_F_GET_NAME 0 +#define PEM_F_I2B_PVK 0 +#define PEM_F_I2B_PVK_BIO 0 +#define PEM_F_LOAD_IV 0 +#define PEM_F_PEM_ASN1_READ 0 +#define PEM_F_PEM_ASN1_READ_BIO 0 +#define PEM_F_PEM_ASN1_WRITE 0 +#define PEM_F_PEM_ASN1_WRITE_BIO 0 +#define PEM_F_PEM_DEF_CALLBACK 0 +#define PEM_F_PEM_DO_HEADER 0 +#define PEM_F_PEM_GET_EVP_CIPHER_INFO 0 +#define PEM_F_PEM_READ 0 +#define PEM_F_PEM_READ_BIO 0 +#define PEM_F_PEM_READ_BIO_DHPARAMS 0 +#define PEM_F_PEM_READ_BIO_EX 0 +#define PEM_F_PEM_READ_BIO_PARAMETERS 0 +#define PEM_F_PEM_READ_BIO_PRIVATEKEY 0 +#define PEM_F_PEM_READ_DHPARAMS 0 +#define PEM_F_PEM_READ_PRIVATEKEY 0 +#define PEM_F_PEM_SIGNFINAL 0 +#define PEM_F_PEM_WRITE 0 +#define PEM_F_PEM_WRITE_BIO 0 +#define PEM_F_PEM_WRITE_BIO_PRIVATEKEY_TRADITIONAL 0 +#define PEM_F_PEM_WRITE_PRIVATEKEY 0 +#define PEM_F_PEM_X509_INFO_READ 0 +#define PEM_F_PEM_X509_INFO_READ_BIO 0 +#define PEM_F_PEM_X509_INFO_WRITE_BIO 0 + +/* + * PKCS12 function codes. + */ +#define PKCS12_F_OPENSSL_ASC2UNI 0 +#define PKCS12_F_OPENSSL_UNI2ASC 0 +#define PKCS12_F_OPENSSL_UNI2UTF8 0 +#define PKCS12_F_OPENSSL_UTF82UNI 0 +#define PKCS12_F_PKCS12_CREATE 0 +#define PKCS12_F_PKCS12_GEN_MAC 0 +#define PKCS12_F_PKCS12_INIT 0 +#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 0 +#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 0 +#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 0 +#define PKCS12_F_PKCS12_KEY_GEN_ASC 0 +#define PKCS12_F_PKCS12_KEY_GEN_UNI 0 +#define PKCS12_F_PKCS12_KEY_GEN_UTF8 0 +#define PKCS12_F_PKCS12_NEWPASS 0 +#define PKCS12_F_PKCS12_PACK_P7DATA 0 +#define PKCS12_F_PKCS12_PACK_P7ENCDATA 0 +#define PKCS12_F_PKCS12_PARSE 0 +#define PKCS12_F_PKCS12_PBE_CRYPT 0 +#define PKCS12_F_PKCS12_PBE_KEYIVGEN 0 +#define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 0 +#define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 0 +#define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 0 +#define PKCS12_F_PKCS12_SETUP_MAC 0 +#define PKCS12_F_PKCS12_SET_MAC 0 +#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 0 +#define PKCS12_F_PKCS12_UNPACK_P7DATA 0 +#define PKCS12_F_PKCS12_VERIFY_MAC 0 +#define PKCS12_F_PKCS8_ENCRYPT 0 +#define PKCS12_F_PKCS8_SET0_PBE 0 + +/* + * PKCS7 function codes. + */ +#define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 0 +#define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 0 +#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 0 +#define PKCS7_F_PKCS7_ADD_CERTIFICATE 0 +#define PKCS7_F_PKCS7_ADD_CRL 0 +#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 0 +#define PKCS7_F_PKCS7_ADD_SIGNATURE 0 +#define PKCS7_F_PKCS7_ADD_SIGNER 0 +#define PKCS7_F_PKCS7_BIO_ADD_DIGEST 0 +#define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 0 +#define PKCS7_F_PKCS7_CTRL 0 +#define PKCS7_F_PKCS7_DATADECODE 0 +#define PKCS7_F_PKCS7_DATAFINAL 0 +#define PKCS7_F_PKCS7_DATAINIT 0 +#define PKCS7_F_PKCS7_DATAVERIFY 0 +#define PKCS7_F_PKCS7_DECRYPT 0 +#define PKCS7_F_PKCS7_DECRYPT_RINFO 0 +#define PKCS7_F_PKCS7_ENCODE_RINFO 0 +#define PKCS7_F_PKCS7_ENCRYPT 0 +#define PKCS7_F_PKCS7_FINAL 0 +#define PKCS7_F_PKCS7_FIND_DIGEST 0 +#define PKCS7_F_PKCS7_GET0_SIGNERS 0 +#define PKCS7_F_PKCS7_RECIP_INFO_SET 0 +#define PKCS7_F_PKCS7_SET_CIPHER 0 +#define PKCS7_F_PKCS7_SET_CONTENT 0 +#define PKCS7_F_PKCS7_SET_DIGEST 0 +#define PKCS7_F_PKCS7_SET_TYPE 0 +#define PKCS7_F_PKCS7_SIGN 0 +#define PKCS7_F_PKCS7_SIGNATUREVERIFY 0 +#define PKCS7_F_PKCS7_SIGNER_INFO_SET 0 +#define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 0 +#define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 0 +#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 0 +#define PKCS7_F_PKCS7_VERIFY 0 + +/* + * RAND function codes. + */ +#define RAND_F_DATA_COLLECT_METHOD 0 +#define RAND_F_DRBG_BYTES 0 +#define RAND_F_DRBG_GET_ENTROPY 0 +#define RAND_F_DRBG_SETUP 0 +#define RAND_F_GET_ENTROPY 0 +#define RAND_F_RAND_BYTES 0 +#define RAND_F_RAND_DRBG_ENABLE_LOCKING 0 +#define RAND_F_RAND_DRBG_GENERATE 0 +#define RAND_F_RAND_DRBG_GET_ENTROPY 0 +#define RAND_F_RAND_DRBG_GET_NONCE 0 +#define RAND_F_RAND_DRBG_INSTANTIATE 0 +#define RAND_F_RAND_DRBG_NEW 0 +#define RAND_F_RAND_DRBG_RESEED 0 +#define RAND_F_RAND_DRBG_RESTART 0 +#define RAND_F_RAND_DRBG_SET 0 +#define RAND_F_RAND_DRBG_SET_DEFAULTS 0 +#define RAND_F_RAND_DRBG_UNINSTANTIATE 0 +#define RAND_F_RAND_LOAD_FILE 0 +#define RAND_F_RAND_POOL_ACQUIRE_ENTROPY 0 +#define RAND_F_RAND_POOL_ADD 0 +#define RAND_F_RAND_POOL_ADD_BEGIN 0 +#define RAND_F_RAND_POOL_ADD_END 0 +#define RAND_F_RAND_POOL_ATTACH 0 +#define RAND_F_RAND_POOL_BYTES_NEEDED 0 +#define RAND_F_RAND_POOL_GROW 0 +#define RAND_F_RAND_POOL_NEW 0 +#define RAND_F_RAND_PSEUDO_BYTES 0 +#define RAND_F_RAND_WRITE_FILE 0 + +/* + * RSA function codes. + */ +#define RSA_F_CHECK_PADDING_MD 0 +#define RSA_F_ENCODE_PKCS1 0 +#define RSA_F_INT_RSA_VERIFY 0 +#define RSA_F_OLD_RSA_PRIV_DECODE 0 +#define RSA_F_PKEY_PSS_INIT 0 +#define RSA_F_PKEY_RSA_CTRL 0 +#define RSA_F_PKEY_RSA_CTRL_STR 0 +#define RSA_F_PKEY_RSA_SIGN 0 +#define RSA_F_PKEY_RSA_VERIFY 0 +#define RSA_F_PKEY_RSA_VERIFYRECOVER 0 +#define RSA_F_RSA_ALGOR_TO_MD 0 +#define RSA_F_RSA_BUILTIN_KEYGEN 0 +#define RSA_F_RSA_CHECK_KEY 0 +#define RSA_F_RSA_CHECK_KEY_EX 0 +#define RSA_F_RSA_CMS_DECRYPT 0 +#define RSA_F_RSA_CMS_VERIFY 0 +#define RSA_F_RSA_ITEM_VERIFY 0 +#define RSA_F_RSA_METH_DUP 0 +#define RSA_F_RSA_METH_NEW 0 +#define RSA_F_RSA_METH_SET1_NAME 0 +#define RSA_F_RSA_MGF1_TO_MD 0 +#define RSA_F_RSA_MULTIP_INFO_NEW 0 +#define RSA_F_RSA_NEW_METHOD 0 +#define RSA_F_RSA_NULL 0 +#define RSA_F_RSA_NULL_PRIVATE_DECRYPT 0 +#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 0 +#define RSA_F_RSA_NULL_PUBLIC_DECRYPT 0 +#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 0 +#define RSA_F_RSA_OSSL_PRIVATE_DECRYPT 0 +#define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 0 +#define RSA_F_RSA_OSSL_PUBLIC_DECRYPT 0 +#define RSA_F_RSA_OSSL_PUBLIC_ENCRYPT 0 +#define RSA_F_RSA_PADDING_ADD_NONE 0 +#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 0 +#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 0 +#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 0 +#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 0 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 0 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 0 +#define RSA_F_RSA_PADDING_ADD_SSLV23 0 +#define RSA_F_RSA_PADDING_ADD_X931 0 +#define RSA_F_RSA_PADDING_CHECK_NONE 0 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 0 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 0 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 0 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 0 +#define RSA_F_RSA_PADDING_CHECK_SSLV23 0 +#define RSA_F_RSA_PADDING_CHECK_X931 0 +#define RSA_F_RSA_PARAM_DECODE 0 +#define RSA_F_RSA_PRINT 0 +#define RSA_F_RSA_PRINT_FP 0 +#define RSA_F_RSA_PRIV_DECODE 0 +#define RSA_F_RSA_PRIV_ENCODE 0 +#define RSA_F_RSA_PSS_GET_PARAM 0 +#define RSA_F_RSA_PSS_TO_CTX 0 +#define RSA_F_RSA_PUB_DECODE 0 +#define RSA_F_RSA_SETUP_BLINDING 0 +#define RSA_F_RSA_SIGN 0 +#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 0 +#define RSA_F_RSA_VERIFY 0 +#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 0 +#define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 0 +#define RSA_F_SETUP_TBUF 0 + +/* + * OSSL_STORE function codes. + */ +#define OSSL_STORE_F_FILE_CTRL 0 +#define OSSL_STORE_F_FILE_FIND 0 +#define OSSL_STORE_F_FILE_GET_PASS 0 +#define OSSL_STORE_F_FILE_LOAD 0 +#define OSSL_STORE_F_FILE_LOAD_TRY_DECODE 0 +#define OSSL_STORE_F_FILE_NAME_TO_URI 0 +#define OSSL_STORE_F_FILE_OPEN 0 +#define OSSL_STORE_F_OSSL_STORE_ATTACH_PEM_BIO 0 +#define OSSL_STORE_F_OSSL_STORE_EXPECT 0 +#define OSSL_STORE_F_OSSL_STORE_FILE_ATTACH_PEM_BIO_INT 0 +#define OSSL_STORE_F_OSSL_STORE_FIND 0 +#define OSSL_STORE_F_OSSL_STORE_GET0_LOADER_INT 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CERT 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CRL 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME_DESCRIPTION 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PARAMS 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PKEY 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CERT 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CRL 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_NEW_EMBEDDED 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_NEW_NAME 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PARAMS 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PKEY 0 +#define OSSL_STORE_F_OSSL_STORE_INFO_SET0_NAME_DESCRIPTION 0 +#define OSSL_STORE_F_OSSL_STORE_INIT_ONCE 0 +#define OSSL_STORE_F_OSSL_STORE_LOADER_NEW 0 +#define OSSL_STORE_F_OSSL_STORE_OPEN 0 +#define OSSL_STORE_F_OSSL_STORE_OPEN_INT 0 +#define OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT 0 +#define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ALIAS 0 +#define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 0 +#define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 0 +#define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_NAME 0 +#define OSSL_STORE_F_OSSL_STORE_UNREGISTER_LOADER_INT 0 +#define OSSL_STORE_F_TRY_DECODE_PARAMS 0 +#define OSSL_STORE_F_TRY_DECODE_PKCS12 0 +#define OSSL_STORE_F_TRY_DECODE_PKCS8ENCRYPTED 0 + +#ifndef OPENSSL_NO_TS +/* + * TS function codes. + */ +#define TS_F_DEF_SERIAL_CB 0 +#define TS_F_DEF_TIME_CB 0 +#define TS_F_ESS_ADD_SIGNING_CERT 0 +#define TS_F_ESS_ADD_SIGNING_CERT_V2 0 +#define TS_F_ESS_CERT_ID_NEW_INIT 0 +#define TS_F_ESS_CERT_ID_V2_NEW_INIT 0 +#define TS_F_ESS_SIGNING_CERT_NEW_INIT 0 +#define TS_F_ESS_SIGNING_CERT_V2_NEW_INIT 0 +#define TS_F_INT_TS_RESP_VERIFY_TOKEN 0 +#define TS_F_PKCS7_TO_TS_TST_INFO 0 +#define TS_F_TS_ACCURACY_SET_MICROS 0 +#define TS_F_TS_ACCURACY_SET_MILLIS 0 +#define TS_F_TS_ACCURACY_SET_SECONDS 0 +#define TS_F_TS_CHECK_IMPRINTS 0 +#define TS_F_TS_CHECK_NONCES 0 +#define TS_F_TS_CHECK_POLICY 0 +#define TS_F_TS_CHECK_SIGNING_CERTS 0 +#define TS_F_TS_CHECK_STATUS_INFO 0 +#define TS_F_TS_COMPUTE_IMPRINT 0 +#define TS_F_TS_CONF_INVALID 0 +#define TS_F_TS_CONF_LOAD_CERT 0 +#define TS_F_TS_CONF_LOAD_CERTS 0 +#define TS_F_TS_CONF_LOAD_KEY 0 +#define TS_F_TS_CONF_LOOKUP_FAIL 0 +#define TS_F_TS_CONF_SET_DEFAULT_ENGINE 0 +#define TS_F_TS_GET_STATUS_TEXT 0 +#define TS_F_TS_MSG_IMPRINT_SET_ALGO 0 +#define TS_F_TS_REQ_SET_MSG_IMPRINT 0 +#define TS_F_TS_REQ_SET_NONCE 0 +#define TS_F_TS_REQ_SET_POLICY_ID 0 +#define TS_F_TS_RESP_CREATE_RESPONSE 0 +#define TS_F_TS_RESP_CREATE_TST_INFO 0 +#define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 0 +#define TS_F_TS_RESP_CTX_ADD_MD 0 +#define TS_F_TS_RESP_CTX_ADD_POLICY 0 +#define TS_F_TS_RESP_CTX_NEW 0 +#define TS_F_TS_RESP_CTX_SET_ACCURACY 0 +#define TS_F_TS_RESP_CTX_SET_CERTS 0 +#define TS_F_TS_RESP_CTX_SET_DEF_POLICY 0 +#define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 0 +#define TS_F_TS_RESP_CTX_SET_STATUS_INFO 0 +#define TS_F_TS_RESP_GET_POLICY 0 +#define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 0 +#define TS_F_TS_RESP_SET_STATUS_INFO 0 +#define TS_F_TS_RESP_SET_TST_INFO 0 +#define TS_F_TS_RESP_SIGN 0 +#define TS_F_TS_RESP_VERIFY_SIGNATURE 0 +#define TS_F_TS_TST_INFO_SET_ACCURACY 0 +#define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 0 +#define TS_F_TS_TST_INFO_SET_NONCE 0 +#define TS_F_TS_TST_INFO_SET_POLICY_ID 0 +#define TS_F_TS_TST_INFO_SET_SERIAL 0 +#define TS_F_TS_TST_INFO_SET_TIME 0 +#define TS_F_TS_TST_INFO_SET_TSA 0 +#define TS_F_TS_VERIFY 0 +#define TS_F_TS_VERIFY_CERT 0 +#define TS_F_TS_VERIFY_CTX_NEW 0 +#endif + +/* + * UI function codes. + */ +#define UI_F_CLOSE_CONSOLE 0 +#define UI_F_ECHO_CONSOLE 0 +#define UI_F_GENERAL_ALLOCATE_BOOLEAN 0 +#define UI_F_GENERAL_ALLOCATE_PROMPT 0 +#define UI_F_NOECHO_CONSOLE 0 +#define UI_F_OPEN_CONSOLE 0 +#define UI_F_UI_CONSTRUCT_PROMPT 0 +#define UI_F_UI_CREATE_METHOD 0 +#define UI_F_UI_CTRL 0 +#define UI_F_UI_DUP_ERROR_STRING 0 +#define UI_F_UI_DUP_INFO_STRING 0 +#define UI_F_UI_DUP_INPUT_BOOLEAN 0 +#define UI_F_UI_DUP_INPUT_STRING 0 +#define UI_F_UI_DUP_USER_DATA 0 +#define UI_F_UI_DUP_VERIFY_STRING 0 +#define UI_F_UI_GET0_RESULT 0 +#define UI_F_UI_GET_RESULT_LENGTH 0 +#define UI_F_UI_NEW_METHOD 0 +#define UI_F_UI_PROCESS 0 +#define UI_F_UI_SET_RESULT 0 +#define UI_F_UI_SET_RESULT_EX 0 + +/* + * X509 function codes. + */ +#define X509_F_ADD_CERT_DIR 0 +#define X509_F_BUILD_CHAIN 0 +#define X509_F_BY_FILE_CTRL 0 +#define X509_F_CHECK_NAME_CONSTRAINTS 0 +#define X509_F_CHECK_POLICY 0 +#define X509_F_DANE_I2D 0 +#define X509_F_DIR_CTRL 0 +#define X509_F_GET_CERT_BY_SUBJECT 0 +#define X509_F_I2D_X509_AUX 0 +#define X509_F_LOOKUP_CERTS_SK 0 +#define X509_F_NETSCAPE_SPKI_B64_DECODE 0 +#define X509_F_NETSCAPE_SPKI_B64_ENCODE 0 +#define X509_F_NEW_DIR 0 +#define X509_F_X509AT_ADD1_ATTR 0 +#define X509_F_X509V3_ADD_EXT 0 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 0 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 0 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 0 +#define X509_F_X509_ATTRIBUTE_GET0_DATA 0 +#define X509_F_X509_ATTRIBUTE_SET1_DATA 0 +#define X509_F_X509_CHECK_PRIVATE_KEY 0 +#define X509_F_X509_CRL_DIFF 0 +#define X509_F_X509_CRL_METHOD_NEW 0 +#define X509_F_X509_CRL_PRINT_FP 0 +#define X509_F_X509_EXTENSION_CREATE_BY_NID 0 +#define X509_F_X509_EXTENSION_CREATE_BY_OBJ 0 +#define X509_F_X509_GET_PUBKEY_PARAMETERS 0 +#define X509_F_X509_LOAD_CERT_CRL_FILE 0 +#define X509_F_X509_LOAD_CERT_FILE 0 +#define X509_F_X509_LOAD_CRL_FILE 0 +#define X509_F_X509_LOOKUP_METH_NEW 0 +#define X509_F_X509_LOOKUP_NEW 0 +#define X509_F_X509_NAME_ADD_ENTRY 0 +#define X509_F_X509_NAME_CANON 0 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 0 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 0 +#define X509_F_X509_NAME_ENTRY_SET_OBJECT 0 +#define X509_F_X509_NAME_ONELINE 0 +#define X509_F_X509_NAME_PRINT 0 +#define X509_F_X509_OBJECT_NEW 0 +#define X509_F_X509_PRINT_EX_FP 0 +#define X509_F_X509_PUBKEY_DECODE 0 +#define X509_F_X509_PUBKEY_GET 0 +#define X509_F_X509_PUBKEY_GET0 0 +#define X509_F_X509_PUBKEY_SET 0 +#define X509_F_X509_REQ_CHECK_PRIVATE_KEY 0 +#define X509_F_X509_REQ_PRINT_EX 0 +#define X509_F_X509_REQ_PRINT_FP 0 +#define X509_F_X509_REQ_TO_X509 0 +#define X509_F_X509_STORE_ADD_CERT 0 +#define X509_F_X509_STORE_ADD_CRL 0 +#define X509_F_X509_STORE_ADD_LOOKUP 0 +#define X509_F_X509_STORE_CTX_GET1_ISSUER 0 +#define X509_F_X509_STORE_CTX_INIT 0 +#define X509_F_X509_STORE_CTX_NEW 0 +#define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 0 +#define X509_F_X509_STORE_NEW 0 +#define X509_F_X509_TO_X509_REQ 0 +#define X509_F_X509_TRUST_ADD 0 +#define X509_F_X509_TRUST_SET 0 +#define X509_F_X509_VERIFY_CERT 0 +#define X509_F_X509_VERIFY_PARAM_NEW 0 + +/* + * X509V3 function codes. + */ +#define X509V3_F_A2I_GENERAL_NAME 0 +#define X509V3_F_ADDR_VALIDATE_PATH_INTERNAL 0 +#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 0 +#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 0 +#define X509V3_F_BIGNUM_TO_STRING 0 +#define X509V3_F_COPY_EMAIL 0 +#define X509V3_F_COPY_ISSUER 0 +#define X509V3_F_DO_DIRNAME 0 +#define X509V3_F_DO_EXT_I2D 0 +#define X509V3_F_DO_EXT_NCONF 0 +#define X509V3_F_GNAMES_FROM_SECTNAME 0 +#define X509V3_F_I2S_ASN1_ENUMERATED 0 +#define X509V3_F_I2S_ASN1_IA5STRING 0 +#define X509V3_F_I2S_ASN1_INTEGER 0 +#define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 0 +#define X509V3_F_LEVEL_ADD_NODE 0 +#define X509V3_F_NOTICE_SECTION 0 +#define X509V3_F_NREF_NOS 0 +#define X509V3_F_POLICY_CACHE_CREATE 0 +#define X509V3_F_POLICY_CACHE_NEW 0 +#define X509V3_F_POLICY_DATA_NEW 0 +#define X509V3_F_POLICY_SECTION 0 +#define X509V3_F_PROCESS_PCI_VALUE 0 +#define X509V3_F_R2I_CERTPOL 0 +#define X509V3_F_R2I_PCI 0 +#define X509V3_F_S2I_ASN1_IA5STRING 0 +#define X509V3_F_S2I_ASN1_INTEGER 0 +#define X509V3_F_S2I_ASN1_OCTET_STRING 0 +#define X509V3_F_S2I_SKEY_ID 0 +#define X509V3_F_SET_DIST_POINT_NAME 0 +#define X509V3_F_SXNET_ADD_ID_ASC 0 +#define X509V3_F_SXNET_ADD_ID_INTEGER 0 +#define X509V3_F_SXNET_ADD_ID_ULONG 0 +#define X509V3_F_SXNET_GET_ID_ASC 0 +#define X509V3_F_SXNET_GET_ID_ULONG 0 +#define X509V3_F_TREE_INIT 0 +#define X509V3_F_V2I_ASIDENTIFIERS 0 +#define X509V3_F_V2I_ASN1_BIT_STRING 0 +#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 0 +#define X509V3_F_V2I_AUTHORITY_KEYID 0 +#define X509V3_F_V2I_BASIC_CONSTRAINTS 0 +#define X509V3_F_V2I_CRLD 0 +#define X509V3_F_V2I_EXTENDED_KEY_USAGE 0 +#define X509V3_F_V2I_GENERAL_NAMES 0 +#define X509V3_F_V2I_GENERAL_NAME_EX 0 +#define X509V3_F_V2I_IDP 0 +#define X509V3_F_V2I_IPADDRBLOCKS 0 +#define X509V3_F_V2I_ISSUER_ALT 0 +#define X509V3_F_V2I_NAME_CONSTRAINTS 0 +#define X509V3_F_V2I_POLICY_CONSTRAINTS 0 +#define X509V3_F_V2I_POLICY_MAPPINGS 0 +#define X509V3_F_V2I_SUBJECT_ALT 0 +#define X509V3_F_V2I_TLS_FEATURE 0 +#define X509V3_F_V3_GENERIC_EXTENSION 0 +#define X509V3_F_X509V3_ADD1_I2D 0 +#define X509V3_F_X509V3_ADD_VALUE 0 +#define X509V3_F_X509V3_EXT_ADD 0 +#define X509V3_F_X509V3_EXT_ADD_ALIAS 0 +#define X509V3_F_X509V3_EXT_I2D 0 +#define X509V3_F_X509V3_EXT_NCONF 0 +#define X509V3_F_X509V3_GET_SECTION 0 +#define X509V3_F_X509V3_GET_STRING 0 +#define X509V3_F_X509V3_GET_VALUE_BOOL 0 +#define X509V3_F_X509V3_PARSE_LIST 0 +#define X509V3_F_X509_PURPOSE_ADD 0 +#define X509V3_F_X509_PURPOSE_SET 0 + +/* + * Compatibility defines. + */ +#define EVP_R_OPERATON_NOT_INITIALIZED EVP_R_OPERATION_NOT_INITIALIZED + +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ct.h b/VCMP-LUA/modules/postgresql/include/openssl/ct.h new file mode 100644 index 0000000..78f8ef7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ct.h @@ -0,0 +1,574 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\ct.h.in + * + * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_CT_H +#define OPENSSL_CT_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_CT_H +#endif + +#include + +#ifndef OPENSSL_NO_CT +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* Minimum RSA key size, from RFC6962 */ +#define SCT_MIN_RSA_BITS 2048 + +/* All hashes are SHA256 in v1 of Certificate Transparency */ +#define CT_V1_HASHLEN SHA256_DIGEST_LENGTH + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(SCT, SCT, SCT) +#define sk_SCT_num(sk) OPENSSL_sk_num(ossl_check_const_SCT_sk_type(sk)) +#define sk_SCT_value(sk, idx) ((SCT *)OPENSSL_sk_value(ossl_check_const_SCT_sk_type(sk), (idx))) +#define sk_SCT_new(cmp) ((STACK_OF(SCT) *)OPENSSL_sk_new(ossl_check_SCT_compfunc_type(cmp))) +#define sk_SCT_new_null() ((STACK_OF(SCT) *)OPENSSL_sk_new_null()) +#define sk_SCT_new_reserve(cmp, n) ((STACK_OF(SCT) *)OPENSSL_sk_new_reserve(ossl_check_SCT_compfunc_type(cmp), (n))) +#define sk_SCT_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SCT_sk_type(sk), (n)) +#define sk_SCT_free(sk) OPENSSL_sk_free(ossl_check_SCT_sk_type(sk)) +#define sk_SCT_zero(sk) OPENSSL_sk_zero(ossl_check_SCT_sk_type(sk)) +#define sk_SCT_delete(sk, i) ((SCT *)OPENSSL_sk_delete(ossl_check_SCT_sk_type(sk), (i))) +#define sk_SCT_delete_ptr(sk, ptr) ((SCT *)OPENSSL_sk_delete_ptr(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr))) +#define sk_SCT_push(sk, ptr) OPENSSL_sk_push(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr)) +#define sk_SCT_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr)) +#define sk_SCT_pop(sk) ((SCT *)OPENSSL_sk_pop(ossl_check_SCT_sk_type(sk))) +#define sk_SCT_shift(sk) ((SCT *)OPENSSL_sk_shift(ossl_check_SCT_sk_type(sk))) +#define sk_SCT_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SCT_sk_type(sk), ossl_check_SCT_freefunc_type(freefunc)) +#define sk_SCT_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr), (idx)) +#define sk_SCT_set(sk, idx, ptr) ((SCT *)OPENSSL_sk_set(ossl_check_SCT_sk_type(sk), (idx), ossl_check_SCT_type(ptr))) +#define sk_SCT_find(sk, ptr) OPENSSL_sk_find(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr)) +#define sk_SCT_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr)) +#define sk_SCT_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr), pnum) +#define sk_SCT_sort(sk) OPENSSL_sk_sort(ossl_check_SCT_sk_type(sk)) +#define sk_SCT_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SCT_sk_type(sk)) +#define sk_SCT_dup(sk) ((STACK_OF(SCT) *)OPENSSL_sk_dup(ossl_check_const_SCT_sk_type(sk))) +#define sk_SCT_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SCT) *)OPENSSL_sk_deep_copy(ossl_check_const_SCT_sk_type(sk), ossl_check_SCT_copyfunc_type(copyfunc), ossl_check_SCT_freefunc_type(freefunc))) +#define sk_SCT_set_cmp_func(sk, cmp) ((sk_SCT_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SCT_sk_type(sk), ossl_check_SCT_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(CTLOG, CTLOG, CTLOG) +#define sk_CTLOG_num(sk) OPENSSL_sk_num(ossl_check_const_CTLOG_sk_type(sk)) +#define sk_CTLOG_value(sk, idx) ((CTLOG *)OPENSSL_sk_value(ossl_check_const_CTLOG_sk_type(sk), (idx))) +#define sk_CTLOG_new(cmp) ((STACK_OF(CTLOG) *)OPENSSL_sk_new(ossl_check_CTLOG_compfunc_type(cmp))) +#define sk_CTLOG_new_null() ((STACK_OF(CTLOG) *)OPENSSL_sk_new_null()) +#define sk_CTLOG_new_reserve(cmp, n) ((STACK_OF(CTLOG) *)OPENSSL_sk_new_reserve(ossl_check_CTLOG_compfunc_type(cmp), (n))) +#define sk_CTLOG_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CTLOG_sk_type(sk), (n)) +#define sk_CTLOG_free(sk) OPENSSL_sk_free(ossl_check_CTLOG_sk_type(sk)) +#define sk_CTLOG_zero(sk) OPENSSL_sk_zero(ossl_check_CTLOG_sk_type(sk)) +#define sk_CTLOG_delete(sk, i) ((CTLOG *)OPENSSL_sk_delete(ossl_check_CTLOG_sk_type(sk), (i))) +#define sk_CTLOG_delete_ptr(sk, ptr) ((CTLOG *)OPENSSL_sk_delete_ptr(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr))) +#define sk_CTLOG_push(sk, ptr) OPENSSL_sk_push(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr)) +#define sk_CTLOG_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr)) +#define sk_CTLOG_pop(sk) ((CTLOG *)OPENSSL_sk_pop(ossl_check_CTLOG_sk_type(sk))) +#define sk_CTLOG_shift(sk) ((CTLOG *)OPENSSL_sk_shift(ossl_check_CTLOG_sk_type(sk))) +#define sk_CTLOG_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_freefunc_type(freefunc)) +#define sk_CTLOG_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr), (idx)) +#define sk_CTLOG_set(sk, idx, ptr) ((CTLOG *)OPENSSL_sk_set(ossl_check_CTLOG_sk_type(sk), (idx), ossl_check_CTLOG_type(ptr))) +#define sk_CTLOG_find(sk, ptr) OPENSSL_sk_find(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr)) +#define sk_CTLOG_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr)) +#define sk_CTLOG_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr), pnum) +#define sk_CTLOG_sort(sk) OPENSSL_sk_sort(ossl_check_CTLOG_sk_type(sk)) +#define sk_CTLOG_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CTLOG_sk_type(sk)) +#define sk_CTLOG_dup(sk) ((STACK_OF(CTLOG) *)OPENSSL_sk_dup(ossl_check_const_CTLOG_sk_type(sk))) +#define sk_CTLOG_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CTLOG) *)OPENSSL_sk_deep_copy(ossl_check_const_CTLOG_sk_type(sk), ossl_check_CTLOG_copyfunc_type(copyfunc), ossl_check_CTLOG_freefunc_type(freefunc))) +#define sk_CTLOG_set_cmp_func(sk, cmp) ((sk_CTLOG_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_compfunc_type(cmp))) + +/* clang-format on */ + +typedef enum { + CT_LOG_ENTRY_TYPE_NOT_SET = -1, + CT_LOG_ENTRY_TYPE_X509 = 0, + CT_LOG_ENTRY_TYPE_PRECERT = 1 +} ct_log_entry_type_t; + +typedef enum { + SCT_VERSION_NOT_SET = -1, + SCT_VERSION_V1 = 0 +} sct_version_t; + +typedef enum { + SCT_SOURCE_UNKNOWN, + SCT_SOURCE_TLS_EXTENSION, + SCT_SOURCE_X509V3_EXTENSION, + SCT_SOURCE_OCSP_STAPLED_RESPONSE +} sct_source_t; + +typedef enum { + SCT_VALIDATION_STATUS_NOT_SET, + SCT_VALIDATION_STATUS_UNKNOWN_LOG, + SCT_VALIDATION_STATUS_VALID, + SCT_VALIDATION_STATUS_INVALID, + SCT_VALIDATION_STATUS_UNVERIFIED, + SCT_VALIDATION_STATUS_UNKNOWN_VERSION +} sct_validation_status_t; + +/****************************************** + * CT policy evaluation context functions * + ******************************************/ + +/* + * Creates a new, empty policy evaluation context associated with the given + * library context and property query string. + * The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished + * with the CT_POLICY_EVAL_CTX. + */ +CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OSSL_LIB_CTX *libctx, + const char *propq); + +/* + * The same as CT_POLICY_EVAL_CTX_new_ex() but the default library + * context and property query string is used. + */ +CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void); + +/* Deletes a policy evaluation context and anything it owns. */ +void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx); + +/* Gets the peer certificate that the SCTs are for */ +X509 *CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the certificate associated with the received SCTs. + * Increments the reference count of cert. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert); + +/* Gets the issuer of the aforementioned certificate */ +X509 *CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the issuer of the certificate associated with the received SCTs. + * Increments the reference count of issuer. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer); + +/* Gets the CT logs that are trusted sources of SCTs */ +const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx); + +/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */ +void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx, + CTLOG_STORE *log_store); + +/* + * Gets the time, in milliseconds since the Unix epoch, that will be used as the + * current time when checking whether an SCT was issued in the future. + * Such SCTs will fail validation, as required by RFC6962. + */ +uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch. + * If an SCT's timestamp is after this time, it will be interpreted as having + * been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs + * whose timestamp is in the future", so an SCT will not validate in this case. + */ +void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms); + +/***************** + * SCT functions * + *****************/ + +/* + * Creates a new, blank SCT. + * The caller is responsible for calling SCT_free when finished with the SCT. + */ +SCT *SCT_new(void); + +/* + * Creates a new SCT from some base64-encoded strings. + * The caller is responsible for calling SCT_free when finished with the SCT. + */ +SCT *SCT_new_from_base64(unsigned char version, + const char *logid_base64, + ct_log_entry_type_t entry_type, + uint64_t timestamp, + const char *extensions_base64, + const char *signature_base64); + +/* + * Frees the SCT and the underlying data structures. + */ +void SCT_free(SCT *sct); + +/* + * Free a stack of SCTs, and the underlying SCTs themselves. + * Intended to be compatible with X509V3_EXT_FREE. + */ +void SCT_LIST_free(STACK_OF(SCT) *a); + +/* + * Returns the version of the SCT. + */ +sct_version_t SCT_get_version(const SCT *sct); + +/* + * Set the version of an SCT. + * Returns 1 on success, 0 if the version is unrecognized. + */ +__owur int SCT_set_version(SCT *sct, sct_version_t version); + +/* + * Returns the log entry type of the SCT. + */ +ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct); + +/* + * Set the log entry type of an SCT. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type); + +/* + * Gets the ID of the log that an SCT came from. + * Ownership of the log ID remains with the SCT. + * Returns the length of the log ID. + */ +size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id); + +/* + * Set the log ID of an SCT to point directly to the *log_id specified. + * The SCT takes ownership of the specified pointer. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len); + +/* + * Set the log ID of an SCT. + * This makes a copy of the log_id. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id, + size_t log_id_len); + +/* + * Returns the timestamp for the SCT (epoch time in milliseconds). + */ +uint64_t SCT_get_timestamp(const SCT *sct); + +/* + * Set the timestamp of an SCT (epoch time in milliseconds). + */ +void SCT_set_timestamp(SCT *sct, uint64_t timestamp); + +/* + * Return the NID for the signature used by the SCT. + * For CT v1, this will be either NID_sha256WithRSAEncryption or + * NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset). + */ +int SCT_get_signature_nid(const SCT *sct); + +/* + * Set the signature type of an SCT + * For CT v1, this should be either NID_sha256WithRSAEncryption or + * NID_ecdsa_with_SHA256. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_signature_nid(SCT *sct, int nid); + +/* + * Set *ext to point to the extension data for the SCT. ext must not be NULL. + * The SCT retains ownership of this pointer. + * Returns length of the data pointed to. + */ +size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext); + +/* + * Set the extensions of an SCT to point directly to the *ext specified. + * The SCT takes ownership of the specified pointer. + */ +void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len); + +/* + * Set the extensions of an SCT. + * This takes a copy of the ext. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext, + size_t ext_len); + +/* + * Set *sig to point to the signature for the SCT. sig must not be NULL. + * The SCT retains ownership of this pointer. + * Returns length of the data pointed to. + */ +size_t SCT_get0_signature(const SCT *sct, unsigned char **sig); + +/* + * Set the signature of an SCT to point directly to the *sig specified. + * The SCT takes ownership of the specified pointer. + */ +void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len); + +/* + * Set the signature of an SCT to be a copy of the *sig specified. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig, + size_t sig_len); + +/* + * The origin of this SCT, e.g. TLS extension, OCSP response, etc. + */ +sct_source_t SCT_get_source(const SCT *sct); + +/* + * Set the origin of this SCT, e.g. TLS extension, OCSP response, etc. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_source(SCT *sct, sct_source_t source); + +/* + * Returns a text string describing the validation status of |sct|. + */ +const char *SCT_validation_status_string(const SCT *sct); + +/* + * Pretty-prints an |sct| to |out|. + * It will be indented by the number of spaces specified by |indent|. + * If |logs| is not NULL, it will be used to lookup the CT log that the SCT came + * from, so that the log name can be printed. + */ +void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs); + +/* + * Pretty-prints an |sct_list| to |out|. + * It will be indented by the number of spaces specified by |indent|. + * SCTs will be delimited by |separator|. + * If |logs| is not NULL, it will be used to lookup the CT log that each SCT + * came from, so that the log names can be printed. + */ +void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent, + const char *separator, const CTLOG_STORE *logs); + +/* + * Gets the last result of validating this SCT. + * If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET. + */ +sct_validation_status_t SCT_get_validation_status(const SCT *sct); + +/* + * Validates the given SCT with the provided context. + * Sets the "validation_status" field of the SCT. + * Returns 1 if the SCT is valid and the signature verifies. + * Returns 0 if the SCT is invalid or could not be verified. + * Returns -1 if an error occurs. + */ +__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx); + +/* + * Validates the given list of SCTs with the provided context. + * Sets the "validation_status" field of each SCT. + * Returns 1 if there are no invalid SCTs and all signatures verify. + * Returns 0 if at least one SCT is invalid or could not be verified. + * Returns a negative integer if an error occurs. + */ +__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts, + CT_POLICY_EVAL_CTX *ctx); + +/********************************* + * SCT parsing and serialization * + *********************************/ + +/* + * Serialize (to TLS format) a stack of SCTs and return the length. + * "a" must not be NULL. + * If "pp" is NULL, just return the length of what would have been serialized. + * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer + * for data that caller is responsible for freeing (only if function returns + * successfully). + * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring + * that "*pp" is large enough to accept all of the serialized data. + * Returns < 0 on error, >= 0 indicating bytes written (or would have been) + * on success. + */ +__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp); + +/* + * Convert TLS format SCT list to a stack of SCTs. + * If "a" or "*a" is NULL, a new stack will be created that the caller is + * responsible for freeing (by calling SCT_LIST_free). + * "**pp" and "*pp" must not be NULL. + * Upon success, "*pp" will point to after the last bytes read, and a stack + * will be returned. + * Upon failure, a NULL pointer will be returned, and the position of "*pp" is + * not defined. + */ +STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, + size_t len); + +/* + * Serialize (to DER format) a stack of SCTs and return the length. + * "a" must not be NULL. + * If "pp" is NULL, just returns the length of what would have been serialized. + * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer + * for data that caller is responsible for freeing (only if function returns + * successfully). + * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring + * that "*pp" is large enough to accept all of the serialized data. + * Returns < 0 on error, >= 0 indicating bytes written (or would have been) + * on success. + */ +__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp); + +/* + * Parses an SCT list in DER format and returns it. + * If "a" or "*a" is NULL, a new stack will be created that the caller is + * responsible for freeing (by calling SCT_LIST_free). + * "**pp" and "*pp" must not be NULL. + * Upon success, "*pp" will point to after the last bytes read, and a stack + * will be returned. + * Upon failure, a NULL pointer will be returned, and the position of "*pp" is + * not defined. + */ +STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, + long len); + +/* + * Serialize (to TLS format) an |sct| and write it to |out|. + * If |out| is null, no SCT will be output but the length will still be returned. + * If |out| points to a null pointer, a string will be allocated to hold the + * TLS-format SCT. It is the responsibility of the caller to free it. + * If |out| points to an allocated string, the TLS-format SCT will be written + * to it. + * The length of the SCT in TLS format will be returned. + */ +__owur int i2o_SCT(const SCT *sct, unsigned char **out); + +/* + * Parses an SCT in TLS format and returns it. + * If |psct| is not null, it will end up pointing to the parsed SCT. If it + * already points to a non-null pointer, the pointer will be free'd. + * |in| should be a pointer to a string containing the TLS-format SCT. + * |in| will be advanced to the end of the SCT if parsing succeeds. + * |len| should be the length of the SCT in |in|. + * Returns NULL if an error occurs. + * If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len' + * fields will be populated (with |in| and |len| respectively). + */ +SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len); + +/******************** + * CT log functions * + ********************/ + +/* + * Creates a new CT log instance with the given |public_key| and |name| and + * associates it with the give library context |libctx| and property query + * string |propq|. + * Takes ownership of |public_key| but copies |name|. + * Returns NULL if malloc fails or if |public_key| cannot be converted to DER. + * Should be deleted by the caller using CTLOG_free when no longer needed. + */ +CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name, OSSL_LIB_CTX *libctx, + const char *propq); + +/* + * The same as CTLOG_new_ex except that the default library context and + * property query string are used. + */ +CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name); + +/* + * Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER + * in |pkey_base64| and associated with the given library context |libctx| and + * property query string |propq|. The |name| is a string to help users identify + * this log. + * Returns 1 on success, 0 on failure. + * Should be deleted by the caller using CTLOG_free when no longer needed. + */ +int CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64, + const char *name, OSSL_LIB_CTX *libctx, + const char *propq); + +/* + * The same as CTLOG_new_from_base64_ex() except that the default + * library context and property query string are used. + * Returns 1 on success, 0 on failure. + */ +int CTLOG_new_from_base64(CTLOG **ct_log, + const char *pkey_base64, const char *name); + +/* + * Deletes a CT log instance and its fields. + */ +void CTLOG_free(CTLOG *log); + +/* Gets the name of the CT log */ +const char *CTLOG_get0_name(const CTLOG *log); +/* Gets the ID of the CT log */ +void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id, + size_t *log_id_len); +/* Gets the public key of the CT log */ +EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log); + +/************************** + * CT log store functions * + **************************/ + +/* + * Creates a new CT log store and associates it with the given libctx and + * property query string. + * Should be deleted by the caller using CTLOG_STORE_free when no longer needed. + */ +CTLOG_STORE *CTLOG_STORE_new_ex(OSSL_LIB_CTX *libctx, const char *propq); + +/* + * Same as CTLOG_STORE_new_ex except that the default libctx and + * property query string are used. + * Should be deleted by the caller using CTLOG_STORE_free when no longer needed. + */ +CTLOG_STORE *CTLOG_STORE_new(void); + +/* + * Deletes a CT log store and all of the CT log instances held within. + */ +void CTLOG_STORE_free(CTLOG_STORE *store); + +/* + * Finds a CT log in the store based on its log ID. + * Returns the CT log, or NULL if no match is found. + */ +const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store, + const uint8_t *log_id, + size_t log_id_len); + +/* + * Loads a CT log list into a |store| from a |file|. + * Returns 1 if loading is successful, or 0 otherwise. + */ +__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file); + +/* + * Loads the default CT log list into a |store|. + * Returns 1 if loading is successful, or 0 otherwise. + */ +__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store); + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/cterr.h b/VCMP-LUA/modules/postgresql/include/openssl/cterr.h new file mode 100644 index 0000000..950b7b3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/cterr.h @@ -0,0 +1,43 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_CTERR_H +#define OPENSSL_CTERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_CT + +/* + * CT reason codes. + */ +#define CT_R_BASE64_DECODE_ERROR 108 +#define CT_R_INVALID_LOG_ID_LENGTH 100 +#define CT_R_LOG_CONF_INVALID 109 +#define CT_R_LOG_CONF_INVALID_KEY 110 +#define CT_R_LOG_CONF_MISSING_DESCRIPTION 111 +#define CT_R_LOG_CONF_MISSING_KEY 112 +#define CT_R_LOG_KEY_INVALID 113 +#define CT_R_SCT_FUTURE_TIMESTAMP 116 +#define CT_R_SCT_INVALID 104 +#define CT_R_SCT_INVALID_SIGNATURE 107 +#define CT_R_SCT_LIST_INVALID 105 +#define CT_R_SCT_LOG_ID_MISMATCH 114 +#define CT_R_SCT_NOT_SET 106 +#define CT_R_SCT_UNSUPPORTED_VERSION 115 +#define CT_R_UNRECOGNIZED_SIGNATURE_NID 101 +#define CT_R_UNSUPPORTED_ENTRY_TYPE 102 +#define CT_R_UNSUPPORTED_VERSION 103 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/decoder.h b/VCMP-LUA/modules/postgresql/include/openssl/decoder.h new file mode 100644 index 0000000..8194c24 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/decoder.h @@ -0,0 +1,133 @@ +/* + * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_DECODER_H +#define OPENSSL_DECODER_H +#pragma once + +#include + +#ifndef OPENSSL_NO_STDIO +#include +#endif +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *libctx, const char *name, + const char *properties); +int OSSL_DECODER_up_ref(OSSL_DECODER *encoder); +void OSSL_DECODER_free(OSSL_DECODER *encoder); + +const OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *encoder); +const char *OSSL_DECODER_get0_properties(const OSSL_DECODER *encoder); +const char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder); +const char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder); +int OSSL_DECODER_is_a(const OSSL_DECODER *encoder, const char *name); + +void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(OSSL_DECODER *encoder, void *arg), + void *arg); +int OSSL_DECODER_names_do_all(const OSSL_DECODER *encoder, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder); +int OSSL_DECODER_get_params(OSSL_DECODER *decoder, OSSL_PARAM params[]); + +const OSSL_PARAM *OSSL_DECODER_settable_ctx_params(OSSL_DECODER *encoder); +OSSL_DECODER_CTX *OSSL_DECODER_CTX_new(void); +int OSSL_DECODER_CTX_set_params(OSSL_DECODER_CTX *ctx, + const OSSL_PARAM params[]); +void OSSL_DECODER_CTX_free(OSSL_DECODER_CTX *ctx); + +/* Utilities that help set specific parameters */ +int OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx, + const unsigned char *kstr, size_t klen); +int OSSL_DECODER_CTX_set_pem_password_cb(OSSL_DECODER_CTX *ctx, + pem_password_cb *cb, void *cbarg); +int OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx, + OSSL_PASSPHRASE_CALLBACK *cb, + void *cbarg); +int OSSL_DECODER_CTX_set_passphrase_ui(OSSL_DECODER_CTX *ctx, + const UI_METHOD *ui_method, + void *ui_data); + +/* + * Utilities to read the object to decode, with the result sent to cb. + * These will discover all provided methods + */ + +int OSSL_DECODER_CTX_set_selection(OSSL_DECODER_CTX *ctx, int selection); +int OSSL_DECODER_CTX_set_input_type(OSSL_DECODER_CTX *ctx, + const char *input_type); +int OSSL_DECODER_CTX_set_input_structure(OSSL_DECODER_CTX *ctx, + const char *input_structure); +int OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder); +int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx, + OSSL_LIB_CTX *libctx, const char *propq); +int OSSL_DECODER_CTX_get_num_decoders(OSSL_DECODER_CTX *ctx); + +typedef struct ossl_decoder_instance_st OSSL_DECODER_INSTANCE; +OSSL_DECODER * +OSSL_DECODER_INSTANCE_get_decoder(OSSL_DECODER_INSTANCE *decoder_inst); +void * +OSSL_DECODER_INSTANCE_get_decoder_ctx(OSSL_DECODER_INSTANCE *decoder_inst); +const char * +OSSL_DECODER_INSTANCE_get_input_type(OSSL_DECODER_INSTANCE *decoder_inst); +const char * +OSSL_DECODER_INSTANCE_get_input_structure(OSSL_DECODER_INSTANCE *decoder_inst, + int *was_set); + +typedef int OSSL_DECODER_CONSTRUCT(OSSL_DECODER_INSTANCE *decoder_inst, + const OSSL_PARAM *params, + void *construct_data); +typedef void OSSL_DECODER_CLEANUP(void *construct_data); + +int OSSL_DECODER_CTX_set_construct(OSSL_DECODER_CTX *ctx, + OSSL_DECODER_CONSTRUCT *construct); +int OSSL_DECODER_CTX_set_construct_data(OSSL_DECODER_CTX *ctx, + void *construct_data); +int OSSL_DECODER_CTX_set_cleanup(OSSL_DECODER_CTX *ctx, + OSSL_DECODER_CLEANUP *cleanup); +OSSL_DECODER_CONSTRUCT *OSSL_DECODER_CTX_get_construct(OSSL_DECODER_CTX *ctx); +void *OSSL_DECODER_CTX_get_construct_data(OSSL_DECODER_CTX *ctx); +OSSL_DECODER_CLEANUP *OSSL_DECODER_CTX_get_cleanup(OSSL_DECODER_CTX *ctx); + +int OSSL_DECODER_export(OSSL_DECODER_INSTANCE *decoder_inst, + void *reference, size_t reference_sz, + OSSL_CALLBACK *export_cb, void *export_cbarg); + +int OSSL_DECODER_from_bio(OSSL_DECODER_CTX *ctx, BIO *in); +#ifndef OPENSSL_NO_STDIO +int OSSL_DECODER_from_fp(OSSL_DECODER_CTX *ctx, FILE *in); +#endif +int OSSL_DECODER_from_data(OSSL_DECODER_CTX *ctx, const unsigned char **pdata, + size_t *pdata_len); + +/* + * Create the OSSL_DECODER_CTX with an associated type. This will perform + * an implicit OSSL_DECODER_fetch(), suitable for the object of that type. + */ +OSSL_DECODER_CTX * +OSSL_DECODER_CTX_new_for_pkey(EVP_PKEY **pkey, + const char *input_type, + const char *input_struct, + const char *keytype, int selection, + OSSL_LIB_CTX *libctx, const char *propquery); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/decodererr.h b/VCMP-LUA/modules/postgresql/include/openssl/decodererr.h new file mode 100644 index 0000000..5fdeace --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/decodererr.h @@ -0,0 +1,26 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_DECODERERR_H +#define OPENSSL_DECODERERR_H +#pragma once + +#include +#include +#include + +/* + * OSSL_DECODER reason codes. + */ +#define OSSL_DECODER_R_COULD_NOT_DECODE_OBJECT 101 +#define OSSL_DECODER_R_DECODER_NOT_FOUND 102 +#define OSSL_DECODER_R_MISSING_GET_PARAMS 100 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/des.h b/VCMP-LUA/modules/postgresql/include/openssl/des.h new file mode 100644 index 0000000..daaef4e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/des.h @@ -0,0 +1,211 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_DES_H +#define OPENSSL_DES_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_DES_H +#endif + +#include + +#ifndef OPENSSL_NO_DES +#ifdef __cplusplus +extern "C" { +#endif +#include + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +typedef unsigned int DES_LONG; + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +#undef OPENSSL_EXTERN +#define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +typedef unsigned char DES_cblock[8]; +typedef /* const */ unsigned char const_DES_cblock[8]; +/* + * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and + * const_DES_cblock * are incompatible pointer types. + */ + +typedef struct DES_ks { + union { + DES_cblock cblock; + /* + * make sure things are correct size on machines with 8 byte longs + */ + DES_LONG deslong[2]; + } ks[16]; +} DES_key_schedule; + +#define DES_KEY_SZ (sizeof(DES_cblock)) +#define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) + +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#define DES_CBC_MODE 0 +#define DES_PCBC_MODE 1 + +#define DES_ecb2_encrypt(i, o, k1, k2, e) \ + DES_ecb3_encrypt((i), (o), (k1), (k2), (k1), (e)) + +#define DES_ede2_cbc_encrypt(i, o, l, k1, k2, iv, e) \ + DES_ede3_cbc_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (e)) + +#define DES_ede2_cfb64_encrypt(i, o, l, k1, k2, iv, n, e) \ + DES_ede3_cfb64_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (n), (e)) + +#define DES_ede2_ofb64_encrypt(i, o, l, k1, k2, iv, n) \ + DES_ede3_ofb64_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (n)) + +#define DES_fixup_key_parity DES_set_odd_parity +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 const char *DES_options(void); +OSSL_DEPRECATEDIN_3_0 +void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, int enc); +OSSL_DEPRECATEDIN_3_0 +DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, + long length, DES_key_schedule *schedule, + const_DES_cblock *ivec); +#endif +/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + int enc); +OSSL_DEPRECATEDIN_3_0 +void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + int enc); +OSSL_DEPRECATEDIN_3_0 +void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + const_DES_cblock *inw, const_DES_cblock *outw, int enc); +OSSL_DEPRECATEDIN_3_0 +void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, DES_cblock *ivec, + int enc); +OSSL_DEPRECATEDIN_3_0 +void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks, int enc); +#endif + +/* + * This is the DES encryption function that gets called by just about every + * other DES routine in the library. You should not use this function except + * to implement 'modes' of DES. I say this because the functions that call + * this routine do the conversion from 'char *' to long, and this needs to be + * done to make sure 'non-aligned' memory access do not occur. The + * characters are loaded 'little endian'. Data is a pointer to 2 unsigned + * long's and ks is the DES_key_schedule to use. enc, is non zero specifies + * encryption, zero if decryption. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); +#endif + +/* + * This functions is the same as DES_encrypt1() except that the DES initial + * permutation (IP) and final permutation (FP) have been left out. As for + * DES_encrypt1(), you should not use this function. It is used by the + * routines in the library that implement triple DES. IP() DES_encrypt2() + * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() + * DES_encrypt1() DES_encrypt1() except faster :-). + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); +OSSL_DEPRECATEDIN_3_0 +void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3); +OSSL_DEPRECATEDIN_3_0 +void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3); +OSSL_DEPRECATEDIN_3_0 +void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int enc); +OSSL_DEPRECATEDIN_3_0 +void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num, int enc); +OSSL_DEPRECATEDIN_3_0 +void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, + int numbits, long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int enc); +OSSL_DEPRECATEDIN_3_0 +void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num); +OSSL_DEPRECATEDIN_3_0 +char *DES_fcrypt(const char *buf, const char *salt, char *ret); +OSSL_DEPRECATEDIN_3_0 +char *DES_crypt(const char *buf, const char *salt); +OSSL_DEPRECATEDIN_3_0 +void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, DES_cblock *ivec); +OSSL_DEPRECATEDIN_3_0 +void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +OSSL_DEPRECATEDIN_3_0 +DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], + long length, int out_count, DES_cblock *seed); +OSSL_DEPRECATEDIN_3_0 int DES_random_key(DES_cblock *ret); +OSSL_DEPRECATEDIN_3_0 void DES_set_odd_parity(DES_cblock *key); +OSSL_DEPRECATEDIN_3_0 int DES_check_key_parity(const_DES_cblock *key); +OSSL_DEPRECATEDIN_3_0 int DES_is_weak_key(const_DES_cblock *key); +#endif +/* + * DES_set_key (= set_key = DES_key_sched = key_sched) calls + * DES_set_key_checked + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); +OSSL_DEPRECATEDIN_3_0 +int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); +OSSL_DEPRECATEDIN_3_0 +int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); +OSSL_DEPRECATEDIN_3_0 +void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); +OSSL_DEPRECATEDIN_3_0 void DES_string_to_key(const char *str, DES_cblock *key); +OSSL_DEPRECATEDIN_3_0 +void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); +OSSL_DEPRECATEDIN_3_0 +void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num, int enc); +OSSL_DEPRECATEDIN_3_0 +void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/dh.h b/VCMP-LUA/modules/postgresql/include/openssl/dh.h new file mode 100644 index 0000000..6d0abe2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/dh.h @@ -0,0 +1,333 @@ +/* + * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_DH_H +#define OPENSSL_DH_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_DH_H +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * DH parameter generation types used by EVP_PKEY_CTX_set_dh_paramgen_type() + * Note that additions/changes to this set of values requires corresponding + * adjustments to range checks in dh_gen() + */ +#define DH_PARAMGEN_TYPE_GENERATOR 0 /* Use a safe prime generator */ +#define DH_PARAMGEN_TYPE_FIPS_186_2 1 /* Use FIPS186-2 standard */ +#define DH_PARAMGEN_TYPE_FIPS_186_4 2 /* Use FIPS186-4 standard */ +#define DH_PARAMGEN_TYPE_GROUP 3 /* Use a named safe prime group */ + +int EVP_PKEY_CTX_set_dh_paramgen_type(EVP_PKEY_CTX *ctx, int typ); +int EVP_PKEY_CTX_set_dh_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex); +int EVP_PKEY_CTX_set_dh_paramgen_seed(EVP_PKEY_CTX *ctx, + const unsigned char *seed, + size_t seedlen); +int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int pbits); +int EVP_PKEY_CTX_set_dh_paramgen_subprime_len(EVP_PKEY_CTX *ctx, int qlen); +int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen); +int EVP_PKEY_CTX_set_dh_nid(EVP_PKEY_CTX *ctx, int nid); +int EVP_PKEY_CTX_set_dh_rfc5114(EVP_PKEY_CTX *ctx, int gen); +int EVP_PKEY_CTX_set_dhx_rfc5114(EVP_PKEY_CTX *ctx, int gen); +int EVP_PKEY_CTX_set_dh_pad(EVP_PKEY_CTX *ctx, int pad); + +int EVP_PKEY_CTX_set_dh_kdf_type(EVP_PKEY_CTX *ctx, int kdf); +int EVP_PKEY_CTX_get_dh_kdf_type(EVP_PKEY_CTX *ctx); +int EVP_PKEY_CTX_set0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT *oid); +int EVP_PKEY_CTX_get0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT **oid); +int EVP_PKEY_CTX_set_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); +int EVP_PKEY_CTX_get_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md); +int EVP_PKEY_CTX_set_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int len); +int EVP_PKEY_CTX_get_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len); +int EVP_PKEY_CTX_set0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_CTX_get0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm); +#endif + +#define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) +#define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) +#define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) +#define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) +#define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) +#define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) +#define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) +#define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) +#define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) +#define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) +#define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) +#define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) +#define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) +#define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) +#define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15) +#define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16) + +/* KDF types */ +#define EVP_PKEY_DH_KDF_NONE 1 +#define EVP_PKEY_DH_KDF_X9_42 2 + +#ifndef OPENSSL_NO_STDIO +#include +#endif +#ifndef OPENSSL_NO_DH +#include +#include +#include +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#include +#endif +#include + +#ifndef OPENSSL_DH_MAX_MODULUS_BITS +#define OPENSSL_DH_MAX_MODULUS_BITS 10000 +#endif + +#ifndef OPENSSL_DH_CHECK_MAX_MODULUS_BITS +#define OPENSSL_DH_CHECK_MAX_MODULUS_BITS 32768 +#endif + +#define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 + +#define DH_FLAG_CACHE_MONT_P 0x01 + +#define DH_FLAG_TYPE_MASK 0xF000 +#define DH_FLAG_TYPE_DH 0x0000 +#define DH_FLAG_TYPE_DHX 0x1000 + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +#define DH_FLAG_NO_EXP_CONSTTIME 0x00 +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* + * If this flag is set the DH method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +#define DH_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +#define DH_FLAG_NON_FIPS_ALLOW 0x0400 +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct dh_st DH; */ +/* typedef struct dh_method DH_METHOD; */ + +DECLARE_ASN1_ITEM(DHparams) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define DH_GENERATOR_2 2 +#define DH_GENERATOR_3 3 +#define DH_GENERATOR_5 5 + +/* DH_check error codes, some of them shared with DH_check_pub_key */ +/* + * NB: These values must align with the equivalently named macros in + * internal/ffc.h. + */ +#define DH_CHECK_P_NOT_PRIME 0x01 +#define DH_CHECK_P_NOT_SAFE_PRIME 0x02 +#define DH_UNABLE_TO_CHECK_GENERATOR 0x04 +#define DH_NOT_SUITABLE_GENERATOR 0x08 +#define DH_CHECK_Q_NOT_PRIME 0x10 +#define DH_CHECK_INVALID_Q_VALUE 0x20 /* +DH_check_pub_key */ +#define DH_CHECK_INVALID_J_VALUE 0x40 +#define DH_MODULUS_TOO_SMALL 0x80 +#define DH_MODULUS_TOO_LARGE 0x100 /* +DH_check_pub_key */ + +/* DH_check_pub_key error codes */ +#define DH_CHECK_PUBKEY_TOO_SMALL 0x01 +#define DH_CHECK_PUBKEY_TOO_LARGE 0x02 +#define DH_CHECK_PUBKEY_INVALID 0x04 + +/* + * primes p where (p-1)/2 is prime too are called "safe"; we define this for + * backward compatibility: + */ +#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME + +#define d2i_DHparams_fp(fp, x) \ + (DH *)ASN1_d2i_fp((void *(*)(void))DH_new, \ + (d2i_of_void *)d2i_DHparams, \ + (fp), \ + (void **)(x)) +#define i2d_DHparams_fp(fp, x) \ + ASN1_i2d_fp(i2d_DHparams, (fp), (unsigned char *)(x)) +#define d2i_DHparams_bio(bp, x) \ + ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) +#define i2d_DHparams_bio(bp, x) \ + ASN1_i2d_bio_of(DH, i2d_DHparams, bp, x) + +#define d2i_DHxparams_fp(fp, x) \ + (DH *)ASN1_d2i_fp((void *(*)(void))DH_new, \ + (d2i_of_void *)d2i_DHxparams, \ + (fp), \ + (void **)(x)) +#define i2d_DHxparams_fp(fp, x) \ + ASN1_i2d_fp(i2d_DHxparams, (fp), (unsigned char *)(x)) +#define d2i_DHxparams_bio(bp, x) \ + ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) +#define i2d_DHxparams_bio(bp, x) \ + ASN1_i2d_bio_of(DH, i2d_DHxparams, bp, x) + +DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, DH, DHparams) + +OSSL_DEPRECATEDIN_3_0 const DH_METHOD *DH_OpenSSL(void); + +OSSL_DEPRECATEDIN_3_0 void DH_set_default_method(const DH_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 const DH_METHOD *DH_get_default_method(void); +OSSL_DEPRECATEDIN_3_0 int DH_set_method(DH *dh, const DH_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 DH *DH_new_method(ENGINE *engine); + +OSSL_DEPRECATEDIN_3_0 DH *DH_new(void); +OSSL_DEPRECATEDIN_3_0 void DH_free(DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_up_ref(DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_bits(const DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_size(const DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_security_bits(const DH *dh); + +#define DH_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef) + +OSSL_DEPRECATEDIN_3_0 int DH_set_ex_data(DH *d, int idx, void *arg); +OSSL_DEPRECATEDIN_3_0 void *DH_get_ex_data(const DH *d, int idx); + +OSSL_DEPRECATEDIN_3_0 int DH_generate_parameters_ex(DH *dh, int prime_len, + int generator, + BN_GENCB *cb); + +OSSL_DEPRECATEDIN_3_0 int DH_check_params_ex(const DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_check_ex(const DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key); +OSSL_DEPRECATEDIN_3_0 int DH_check_params(const DH *dh, int *ret); +OSSL_DEPRECATEDIN_3_0 int DH_check(const DH *dh, int *codes); +OSSL_DEPRECATEDIN_3_0 int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, + int *codes); +OSSL_DEPRECATEDIN_3_0 int DH_generate_key(DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_compute_key(unsigned char *key, + const BIGNUM *pub_key, DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_compute_key_padded(unsigned char *key, + const BIGNUM *pub_key, DH *dh); + +DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DH, DHparams) +DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DH, DHxparams) + +#ifndef OPENSSL_NO_STDIO +OSSL_DEPRECATEDIN_3_0 int DHparams_print_fp(FILE *fp, const DH *x); +#endif +OSSL_DEPRECATEDIN_3_0 int DHparams_print(BIO *bp, const DH *x); + +/* RFC 5114 parameters */ +OSSL_DEPRECATEDIN_3_0 DH *DH_get_1024_160(void); +OSSL_DEPRECATEDIN_3_0 DH *DH_get_2048_224(void); +OSSL_DEPRECATEDIN_3_0 DH *DH_get_2048_256(void); + +/* Named parameters, currently RFC7919 and RFC3526 */ +OSSL_DEPRECATEDIN_3_0 DH *DH_new_by_nid(int nid); +OSSL_DEPRECATEDIN_3_0 int DH_get_nid(const DH *dh); + +/* RFC2631 KDF */ +OSSL_DEPRECATEDIN_3_0 int DH_KDF_X9_42(unsigned char *out, size_t outlen, + const unsigned char *Z, size_t Zlen, + ASN1_OBJECT *key_oid, + const unsigned char *ukm, + size_t ukmlen, const EVP_MD *md); + +OSSL_DEPRECATEDIN_3_0 void DH_get0_pqg(const DH *dh, const BIGNUM **p, + const BIGNUM **q, const BIGNUM **g); +OSSL_DEPRECATEDIN_3_0 int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); +OSSL_DEPRECATEDIN_3_0 void DH_get0_key(const DH *dh, const BIGNUM **pub_key, + const BIGNUM **priv_key); +OSSL_DEPRECATEDIN_3_0 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_p(const DH *dh); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_q(const DH *dh); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_g(const DH *dh); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_priv_key(const DH *dh); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_pub_key(const DH *dh); +OSSL_DEPRECATEDIN_3_0 void DH_clear_flags(DH *dh, int flags); +OSSL_DEPRECATEDIN_3_0 int DH_test_flags(const DH *dh, int flags); +OSSL_DEPRECATEDIN_3_0 void DH_set_flags(DH *dh, int flags); +OSSL_DEPRECATEDIN_3_0 ENGINE *DH_get0_engine(DH *d); +OSSL_DEPRECATEDIN_3_0 long DH_get_length(const DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_set_length(DH *dh, long length); + +OSSL_DEPRECATEDIN_3_0 DH_METHOD *DH_meth_new(const char *name, int flags); +OSSL_DEPRECATEDIN_3_0 void DH_meth_free(DH_METHOD *dhm); +OSSL_DEPRECATEDIN_3_0 DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); +OSSL_DEPRECATEDIN_3_0 const char *DH_meth_get0_name(const DH_METHOD *dhm); +OSSL_DEPRECATEDIN_3_0 int DH_meth_set1_name(DH_METHOD *dhm, const char *name); +OSSL_DEPRECATEDIN_3_0 int DH_meth_get_flags(const DH_METHOD *dhm); +OSSL_DEPRECATEDIN_3_0 int DH_meth_set_flags(DH_METHOD *dhm, int flags); +OSSL_DEPRECATEDIN_3_0 void *DH_meth_get0_app_data(const DH_METHOD *dhm); +OSSL_DEPRECATEDIN_3_0 int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); +OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_generate_key(const DH_METHOD *dhm))(DH *); +OSSL_DEPRECATEDIN_3_0 int DH_meth_set_generate_key(DH_METHOD *dhm, + int (*generate_key)(DH *)); +OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_compute_key(const DH_METHOD *dhm))(unsigned char *key, + const BIGNUM *pub_key, + DH *dh); +OSSL_DEPRECATEDIN_3_0 int DH_meth_set_compute_key(DH_METHOD *dhm, + int (*compute_key)(unsigned char *key, + const BIGNUM *pub_key, + DH *dh)); +OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm))(const DH *, BIGNUM *, + const BIGNUM *, + const BIGNUM *, + const BIGNUM *, BN_CTX *, + BN_MONT_CTX *); +OSSL_DEPRECATEDIN_3_0 int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, + int (*bn_mod_exp)(const DH *, BIGNUM *, + const BIGNUM *, const BIGNUM *, + const BIGNUM *, BN_CTX *, + BN_MONT_CTX *)); +OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); +OSSL_DEPRECATEDIN_3_0 int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); +OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_finish(const DH_METHOD *dhm))(DH *); +OSSL_DEPRECATEDIN_3_0 int DH_meth_set_finish(DH_METHOD *dhm, int (*finish)(DH *)); +OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_generate_params(const DH_METHOD *dhm))(DH *, int, int, + BN_GENCB *); +OSSL_DEPRECATEDIN_3_0 int DH_meth_set_generate_params(DH_METHOD *dhm, + int (*generate_params)(DH *, int, int, + BN_GENCB *)); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +#ifndef OPENSSL_NO_DEPRECATED_0_9_8 +OSSL_DEPRECATEDIN_0_9_8 DH *DH_generate_parameters(int prime_len, int generator, + void (*callback)(int, int, + void *), + void *cb_arg); +#endif + +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/dherr.h b/VCMP-LUA/modules/postgresql/include/openssl/dherr.h new file mode 100644 index 0000000..753659b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/dherr.h @@ -0,0 +1,57 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_DHERR_H +#define OPENSSL_DHERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_DH + +/* + * DH reason codes. + */ +#define DH_R_BAD_FFC_PARAMETERS 127 +#define DH_R_BAD_GENERATOR 101 +#define DH_R_BN_DECODE_ERROR 109 +#define DH_R_BN_ERROR 106 +#define DH_R_CHECK_INVALID_J_VALUE 115 +#define DH_R_CHECK_INVALID_Q_VALUE 116 +#define DH_R_CHECK_PUBKEY_INVALID 122 +#define DH_R_CHECK_PUBKEY_TOO_LARGE 123 +#define DH_R_CHECK_PUBKEY_TOO_SMALL 124 +#define DH_R_CHECK_P_NOT_PRIME 117 +#define DH_R_CHECK_P_NOT_SAFE_PRIME 118 +#define DH_R_CHECK_Q_NOT_PRIME 119 +#define DH_R_DECODE_ERROR 104 +#define DH_R_INVALID_PARAMETER_NAME 110 +#define DH_R_INVALID_PARAMETER_NID 114 +#define DH_R_INVALID_PUBKEY 102 +#define DH_R_INVALID_SECRET 128 +#define DH_R_INVALID_SIZE 129 +#define DH_R_KDF_PARAMETER_ERROR 112 +#define DH_R_KEYS_NOT_SET 108 +#define DH_R_MISSING_PUBKEY 125 +#define DH_R_MODULUS_TOO_LARGE 103 +#define DH_R_MODULUS_TOO_SMALL 126 +#define DH_R_NOT_SUITABLE_GENERATOR 120 +#define DH_R_NO_PARAMETERS_SET 107 +#define DH_R_NO_PRIVATE_VALUE 100 +#define DH_R_PARAMETER_ENCODING_ERROR 105 +#define DH_R_PEER_KEY_ERROR 111 +#define DH_R_Q_TOO_LARGE 130 +#define DH_R_SHARED_INFO_ERROR 113 +#define DH_R_UNABLE_TO_CHECK_GENERATOR 121 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/dsa.h b/VCMP-LUA/modules/postgresql/include/openssl/dsa.h new file mode 100644 index 0000000..61baa64 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/dsa.h @@ -0,0 +1,273 @@ +/* + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_DSA_H +#define OPENSSL_DSA_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_DSA_H +#endif + +#include +#include + +#include + +#ifndef OPENSSL_NO_DSA +#include +#include +#include +#include +#include +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#include +#endif +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits); +int EVP_PKEY_CTX_set_dsa_paramgen_q_bits(EVP_PKEY_CTX *ctx, int qbits); +int EVP_PKEY_CTX_set_dsa_paramgen_md_props(EVP_PKEY_CTX *ctx, + const char *md_name, + const char *md_properties); +int EVP_PKEY_CTX_set_dsa_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex); +int EVP_PKEY_CTX_set_dsa_paramgen_type(EVP_PKEY_CTX *ctx, const char *name); +int EVP_PKEY_CTX_set_dsa_paramgen_seed(EVP_PKEY_CTX *ctx, + const unsigned char *seed, + size_t seedlen); +int EVP_PKEY_CTX_set_dsa_paramgen_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); + +#define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) +#define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) +#define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) + +#ifndef OPENSSL_NO_DSA +#ifndef OPENSSL_DSA_MAX_MODULUS_BITS +#define OPENSSL_DSA_MAX_MODULUS_BITS 10000 +#endif + +#define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 + +typedef struct DSA_SIG_st DSA_SIG; +DSA_SIG *DSA_SIG_new(void); +void DSA_SIG_free(DSA_SIG *a); +DECLARE_ASN1_ENCODE_FUNCTIONS_only(DSA_SIG, DSA_SIG) +void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); +int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +#define DSA_FLAG_NO_EXP_CONSTTIME 0x00 +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define DSA_FLAG_CACHE_MONT_P 0x01 + +/* + * If this flag is set the DSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +#define DSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +#define DSA_FLAG_NON_FIPS_ALLOW 0x0400 +#define DSA_FLAG_FIPS_CHECKED 0x0800 + +/* Already defined in ossl_typ.h */ +/* typedef struct dsa_st DSA; */ +/* typedef struct dsa_method DSA_METHOD; */ + +#define d2i_DSAparams_fp(fp, x) \ + (DSA *)ASN1_d2i_fp((void *(*)(void))DSA_new, \ + (d2i_of_void *)d2i_DSAparams, (fp), \ + (void **)(x)) +#define i2d_DSAparams_fp(fp, x) \ + ASN1_i2d_fp(i2d_DSAparams, (fp), (unsigned char *)(x)) +#define d2i_DSAparams_bio(bp, x) \ + ASN1_d2i_bio_of(DSA, DSA_new, d2i_DSAparams, bp, x) +#define i2d_DSAparams_bio(bp, x) \ + ASN1_i2d_bio_of(DSA, i2d_DSAparams, bp, x) + +DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, DSA, DSAparams) +OSSL_DEPRECATEDIN_3_0 DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, + DSA *dsa); +OSSL_DEPRECATEDIN_3_0 int DSA_do_verify(const unsigned char *dgst, int dgst_len, + DSA_SIG *sig, DSA *dsa); + +OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *DSA_OpenSSL(void); + +OSSL_DEPRECATEDIN_3_0 void DSA_set_default_method(const DSA_METHOD *); +OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *DSA_get_default_method(void); +OSSL_DEPRECATEDIN_3_0 int DSA_set_method(DSA *dsa, const DSA_METHOD *); +OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *DSA_get_method(DSA *d); + +OSSL_DEPRECATEDIN_3_0 DSA *DSA_new(void); +OSSL_DEPRECATEDIN_3_0 DSA *DSA_new_method(ENGINE *engine); +OSSL_DEPRECATEDIN_3_0 void DSA_free(DSA *r); +/* "up" the DSA object's reference count */ +OSSL_DEPRECATEDIN_3_0 int DSA_up_ref(DSA *r); +OSSL_DEPRECATEDIN_3_0 int DSA_size(const DSA *); +OSSL_DEPRECATEDIN_3_0 int DSA_bits(const DSA *d); +OSSL_DEPRECATEDIN_3_0 int DSA_security_bits(const DSA *d); +/* next 4 return -1 on error */ +OSSL_DEPRECATEDIN_3_0 int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, + BIGNUM **kinvp, BIGNUM **rp); +OSSL_DEPRECATEDIN_3_0 int DSA_sign(int type, const unsigned char *dgst, + int dlen, unsigned char *sig, + unsigned int *siglen, DSA *dsa); +OSSL_DEPRECATEDIN_3_0 int DSA_verify(int type, const unsigned char *dgst, + int dgst_len, const unsigned char *sigbuf, + int siglen, DSA *dsa); + +#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef) +OSSL_DEPRECATEDIN_3_0 int DSA_set_ex_data(DSA *d, int idx, void *arg); +OSSL_DEPRECATEDIN_3_0 void *DSA_get_ex_data(const DSA *d, int idx); + +DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, + DSA, DSAPublicKey) +DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, + DSA, DSAPrivateKey) +DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, + DSA, DSAparams) +#endif + +#ifndef OPENSSL_NO_DEPRECATED_0_9_8 +/* Deprecated version */ +OSSL_DEPRECATEDIN_0_9_8 +DSA *DSA_generate_parameters(int bits, unsigned char *seed, int seed_len, + int *counter_ret, unsigned long *h_ret, + void (*callback)(int, int, void *), + void *cb_arg); +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* New version */ +OSSL_DEPRECATEDIN_3_0 int DSA_generate_parameters_ex(DSA *dsa, int bits, + const unsigned char *seed, + int seed_len, + int *counter_ret, + unsigned long *h_ret, + BN_GENCB *cb); + +OSSL_DEPRECATEDIN_3_0 int DSA_generate_key(DSA *a); + +OSSL_DEPRECATEDIN_3_0 int DSAparams_print(BIO *bp, const DSA *x); +OSSL_DEPRECATEDIN_3_0 int DSA_print(BIO *bp, const DSA *x, int off); +#ifndef OPENSSL_NO_STDIO +OSSL_DEPRECATEDIN_3_0 int DSAparams_print_fp(FILE *fp, const DSA *x); +OSSL_DEPRECATEDIN_3_0 int DSA_print_fp(FILE *bp, const DSA *x, int off); +#endif + +#define DSS_prime_checks 64 +/* + * Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only + * have one value here we set the number of checks to 64 which is the 128 bit + * security level that is the highest level and valid for creating a 3072 bit + * DSA key. + */ +#define DSA_is_prime(n, callback, cb_arg) \ + BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) + +#ifndef OPENSSL_NO_DH +/* + * Convert DSA structure (key or just parameters) into DH structure (be + * careful to avoid small subgroup attacks when using this!) + */ +OSSL_DEPRECATEDIN_3_0 DH *DSA_dup_DH(const DSA *r); +#endif + +OSSL_DEPRECATEDIN_3_0 void DSA_get0_pqg(const DSA *d, const BIGNUM **p, + const BIGNUM **q, const BIGNUM **g); +OSSL_DEPRECATEDIN_3_0 int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); +OSSL_DEPRECATEDIN_3_0 void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, + const BIGNUM **priv_key); +OSSL_DEPRECATEDIN_3_0 int DSA_set0_key(DSA *d, BIGNUM *pub_key, + BIGNUM *priv_key); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_p(const DSA *d); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_q(const DSA *d); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_g(const DSA *d); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_pub_key(const DSA *d); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_priv_key(const DSA *d); +OSSL_DEPRECATEDIN_3_0 void DSA_clear_flags(DSA *d, int flags); +OSSL_DEPRECATEDIN_3_0 int DSA_test_flags(const DSA *d, int flags); +OSSL_DEPRECATEDIN_3_0 void DSA_set_flags(DSA *d, int flags); +OSSL_DEPRECATEDIN_3_0 ENGINE *DSA_get0_engine(DSA *d); + +OSSL_DEPRECATEDIN_3_0 DSA_METHOD *DSA_meth_new(const char *name, int flags); +OSSL_DEPRECATEDIN_3_0 void DSA_meth_free(DSA_METHOD *dsam); +OSSL_DEPRECATEDIN_3_0 DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam); +OSSL_DEPRECATEDIN_3_0 const char *DSA_meth_get0_name(const DSA_METHOD *dsam); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set1_name(DSA_METHOD *dsam, + const char *name); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_get_flags(const DSA_METHOD *dsam); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_flags(DSA_METHOD *dsam, int flags); +OSSL_DEPRECATEDIN_3_0 void *DSA_meth_get0_app_data(const DSA_METHOD *dsam); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set0_app_data(DSA_METHOD *dsam, + void *app_data); +OSSL_DEPRECATEDIN_3_0 DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))(const unsigned char *, int, DSA *); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_sign(DSA_METHOD *dsam, + DSA_SIG *(*sign)(const unsigned char *, int, DSA *)); +OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))(DSA *, BN_CTX *, BIGNUM **, BIGNUM **); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_sign_setup(DSA_METHOD *dsam, + int (*sign_setup)(DSA *, BN_CTX *, BIGNUM **, BIGNUM **)); +OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_verify(const DSA_METHOD *dsam))(const unsigned char *, int, DSA_SIG *, DSA *); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_verify(DSA_METHOD *dsam, + int (*verify)(const unsigned char *, int, DSA_SIG *, DSA *)); +OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_mod_exp(DSA_METHOD *dsam, + int (*mod_exp)(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, + BN_MONT_CTX *)); +OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + BN_CTX *, BN_MONT_CTX *); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, + int (*bn_mod_exp)(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); +OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_init(DSA_METHOD *dsam, + int (*init)(DSA *)); +OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_finish(const DSA_METHOD *dsam))(DSA *); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_finish(DSA_METHOD *dsam, + int (*finish)(DSA *)); +OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))(DSA *, int, const unsigned char *, int, int *, unsigned long *, + BN_GENCB *); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_paramgen(DSA_METHOD *dsam, + int (*paramgen)(DSA *, int, const unsigned char *, int, int *, + unsigned long *, BN_GENCB *)); +OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_keygen(const DSA_METHOD *dsam))(DSA *); +OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_keygen(DSA_METHOD *dsam, + int (*keygen)(DSA *)); + +#endif +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/dsaerr.h b/VCMP-LUA/modules/postgresql/include/openssl/dsaerr.h new file mode 100644 index 0000000..cc5f4bf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/dsaerr.h @@ -0,0 +1,42 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_DSAERR_H +#define OPENSSL_DSAERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_DSA + +/* + * DSA reason codes. + */ +#define DSA_R_BAD_FFC_PARAMETERS 114 +#define DSA_R_BAD_Q_VALUE 102 +#define DSA_R_BN_DECODE_ERROR 108 +#define DSA_R_BN_ERROR 109 +#define DSA_R_DECODE_ERROR 104 +#define DSA_R_INVALID_DIGEST_TYPE 106 +#define DSA_R_INVALID_PARAMETERS 112 +#define DSA_R_MISSING_PARAMETERS 101 +#define DSA_R_MISSING_PRIVATE_KEY 111 +#define DSA_R_MODULUS_TOO_LARGE 103 +#define DSA_R_NO_PARAMETERS_SET 107 +#define DSA_R_PARAMETER_ENCODING_ERROR 105 +#define DSA_R_P_NOT_PRIME 115 +#define DSA_R_Q_NOT_PRIME 113 +#define DSA_R_SEED_LEN_SMALL 110 +#define DSA_R_TOO_MANY_RETRIES 116 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/dtls1.h b/VCMP-LUA/modules/postgresql/include/openssl/dtls1.h new file mode 100644 index 0000000..0b42948 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/dtls1.h @@ -0,0 +1,57 @@ +/* + * Copyright 2005-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_DTLS1_H +#define OPENSSL_DTLS1_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_DTLS1_H +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* DTLS*_VERSION constants are defined in prov_ssl.h */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define DTLS_MIN_VERSION DTLS1_VERSION +#define DTLS_MAX_VERSION DTLS1_2_VERSION +#endif +#define DTLS1_VERSION_MAJOR 0xFE + +/* Special value for method supporting multiple versions */ +#define DTLS_ANY_VERSION 0x1FFFF + +/* lengths of messages */ + +#define DTLS1_COOKIE_LENGTH 255 + +#define DTLS1_RT_HEADER_LENGTH 13 + +#define DTLS1_HM_HEADER_LENGTH 12 + +#define DTLS1_HM_BAD_FRAGMENT -2 +#define DTLS1_HM_FRAGMENT_RETRY -3 + +#define DTLS1_CCS_HEADER_LENGTH 1 + +#define DTLS1_AL_HEADER_LENGTH 2 + +#define DTLS1_TMO_ALERT_COUNT 12 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/e_os2.h b/VCMP-LUA/modules/postgresql/include/openssl/e_os2.h new file mode 100644 index 0000000..86a572b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/e_os2.h @@ -0,0 +1,306 @@ +/* + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_E_OS2_H +#define OPENSSL_E_OS2_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_E_OS2_H +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * Detect operating systems. This probably needs completing. + * The result is that at least one OPENSSL_SYS_os macro should be defined. + * However, if none is defined, Unix is assumed. + **/ + +#define OPENSSL_SYS_UNIX + +/* --------------------- Microsoft operating systems ---------------------- */ + +/* + * Note that MSDOS actually denotes 32-bit environments running on top of + * MS-DOS, such as DJGPP one. + */ +#if defined(OPENSSL_SYS_MSDOS) +#undef OPENSSL_SYS_UNIX +#endif + +/* + * For 32 bit environment, there seems to be the CygWin environment and then + * all the others that try to do the same thing Microsoft does... + */ +/* + * UEFI lives here because it might be built with a Microsoft toolchain and + * we need to avoid the false positive match on Windows. + */ +#if defined(OPENSSL_SYS_UEFI) +#undef OPENSSL_SYS_UNIX +#elif defined(OPENSSL_SYS_UWIN) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_WIN32_UWIN +#else +#if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN) +#define OPENSSL_SYS_WIN32_CYGWIN +#else +#if defined(_WIN32) || defined(OPENSSL_SYS_WIN32) +#undef OPENSSL_SYS_UNIX +#if !defined(OPENSSL_SYS_WIN32) +#define OPENSSL_SYS_WIN32 +#endif +#endif +#if defined(_WIN64) || defined(OPENSSL_SYS_WIN64) +#undef OPENSSL_SYS_UNIX +#if !defined(OPENSSL_SYS_WIN64) +#define OPENSSL_SYS_WIN64 +#endif +#endif +#if defined(OPENSSL_SYS_WINNT) +#undef OPENSSL_SYS_UNIX +#endif +#if defined(OPENSSL_SYS_WINCE) +#undef OPENSSL_SYS_UNIX +#endif +#endif +#endif + +/* Anything that tries to look like Microsoft is "Windows" */ +#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_WINDOWS +#ifndef OPENSSL_SYS_MSDOS +#define OPENSSL_SYS_MSDOS +#endif +#endif + +/* + * DLL settings. This part is a bit tough, because it's up to the + * application implementer how he or she will link the application, so it + * requires some macro to be used. + */ +#ifdef OPENSSL_SYS_WINDOWS +#ifndef OPENSSL_OPT_WINDLL +#if defined(_WINDLL) /* This is used when building OpenSSL to \ + * indicate that DLL linkage should be used */ +#define OPENSSL_OPT_WINDLL +#endif +#endif +#endif + +/* ------------------------------- OpenVMS -------------------------------- */ +#if defined(__VMS) || defined(VMS) +#if !defined(OPENSSL_SYS_VMS) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_VMS +#endif +#if defined(__DECC) +#define OPENSSL_SYS_VMS_DECC +#elif defined(__DECCXX) +#define OPENSSL_SYS_VMS_DECC +#define OPENSSL_SYS_VMS_DECCXX +#else +#define OPENSSL_SYS_VMS_NODECC +#endif +#endif + +/* -------------------------------- Unix ---------------------------------- */ +#ifdef OPENSSL_SYS_UNIX +#if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX) +#define OPENSSL_SYS_LINUX +#endif +#if defined(_AIX) && !defined(OPENSSL_SYS_AIX) +#define OPENSSL_SYS_AIX +#endif +#endif + +/* -------------------------------- VOS ----------------------------------- */ +#if defined(__VOS__) && !defined(OPENSSL_SYS_VOS) +#define OPENSSL_SYS_VOS +#ifdef __HPPA__ +#define OPENSSL_SYS_VOS_HPPA +#endif +#ifdef __IA32__ +#define OPENSSL_SYS_VOS_IA32 +#endif +#endif + +/* ---------------------------- HP NonStop -------------------------------- */ +#ifdef __TANDEM +#ifdef _STRING +#include +#endif +#define OPENSSL_USE_BUILD_DATE +#if defined(OPENSSL_THREADS) && defined(_SPT_MODEL_) +#define SPT_THREAD_SIGNAL 1 +#define SPT_THREAD_AWARE 1 +#include +#elif defined(OPENSSL_THREADS) && defined(_PUT_MODEL_) +#include +#endif +#endif + +/** + * That's it for OS-specific stuff + *****************************************************************************/ + +/*- + * OPENSSL_EXTERN is normally used to declare a symbol with possible extra + * attributes to handle its presence in a shared library. + * OPENSSL_EXPORT is used to define a symbol with extra possible attributes + * to make it visible in a shared library. + * Care needs to be taken when a header file is used both to declare and + * define symbols. Basically, for any library that exports some global + * variables, the following code must be present in the header file that + * declares them, before OPENSSL_EXTERN is used: + * + * #ifdef SOME_BUILD_FLAG_MACRO + * # undef OPENSSL_EXTERN + * # define OPENSSL_EXTERN OPENSSL_EXPORT + * #endif + * + * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN + * have some generally sensible values. + */ + +#if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) +#define OPENSSL_EXPORT extern __declspec(dllexport) +#define OPENSSL_EXTERN extern __declspec(dllimport) +#else +#define OPENSSL_EXPORT extern +#define OPENSSL_EXTERN extern +#endif + +#ifdef _WIN32 +#ifdef _WIN64 +#define ossl_ssize_t __int64 +#define OSSL_SSIZE_MAX _I64_MAX +#else +#define ossl_ssize_t int +#define OSSL_SSIZE_MAX INT_MAX +#endif +#endif + +#if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t) +#define ossl_ssize_t INTN +#define OSSL_SSIZE_MAX MAX_INTN +#endif + +#ifndef ossl_ssize_t +#include +#define ossl_ssize_t ssize_t +#if defined(SSIZE_MAX) +#define OSSL_SSIZE_MAX SSIZE_MAX +#elif defined(_POSIX_SSIZE_MAX) +#define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX +#else +#define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1)) +#endif +#endif + +#if defined(UNUSEDRESULT_DEBUG) +#define __owur __attribute__((__warn_unused_result__)) +#else +#define __owur +#endif + +/* Standard integer types */ +#define OPENSSL_NO_INTTYPES_H +#define OPENSSL_NO_STDINT_H +#if defined(OPENSSL_SYS_UEFI) +typedef INT8 int8_t; +typedef UINT8 uint8_t; +typedef INT16 int16_t; +typedef UINT16 uint16_t; +typedef INT32 int32_t; +typedef UINT32 uint32_t; +typedef INT64 int64_t; +typedef UINT64 uint64_t; +typedef UINTN uintptr_t; +#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__osf__) || defined(__sgi) || defined(__hpux) || defined(OPENSSL_SYS_VMS) || defined(__OpenBSD__) +#include +#undef OPENSSL_NO_INTTYPES_H +/* Because the specs say that inttypes.h includes stdint.h if present */ +#undef OPENSSL_NO_STDINT_H +#elif defined(_MSC_VER) && _MSC_VER < 1600 +/* + * minimally required typdefs for systems not supporting inttypes.h or + * stdint.h: currently just older VC++ + */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#elif defined(OPENSSL_SYS_TANDEM) +#include +#include +#else +#include +#undef OPENSSL_NO_STDINT_H +#endif +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && defined(INTMAX_MAX) && defined(UINTMAX_MAX) +typedef intmax_t ossl_intmax_t; +typedef uintmax_t ossl_uintmax_t; +#else +/* Fall back to the largest we know we require and can handle */ +typedef int64_t ossl_intmax_t; +typedef uint64_t ossl_uintmax_t; +#endif + +/* ossl_inline: portable inline definition usable in public headers */ +#if !defined(inline) && !defined(__cplusplus) +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +/* just use inline */ +#define ossl_inline inline +#elif defined(__GNUC__) && __GNUC__ >= 2 +#define ossl_inline __inline__ +#elif defined(_MSC_VER) +/* + * Visual Studio: inline is available in C++ only, however + * __inline is available for C, see + * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx + */ +#define ossl_inline __inline +#else +#define ossl_inline +#endif +#else +#define ossl_inline inline +#endif + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus) +#define ossl_noreturn _Noreturn +#elif defined(__GNUC__) && __GNUC__ >= 2 +#define ossl_noreturn __attribute__((noreturn)) +#else +#define ossl_noreturn +#endif + +/* ossl_unused: portable unused attribute for use in public headers */ +#if defined(__GNUC__) +#define ossl_unused __attribute__((unused)) +#else +#define ossl_unused +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/e_ostime.h b/VCMP-LUA/modules/postgresql/include/openssl/e_ostime.h new file mode 100644 index 0000000..c0f1c54 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/e_ostime.h @@ -0,0 +1,38 @@ +/* + * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_E_OSTIME_H +#define OPENSSL_E_OSTIME_H +#pragma once + +#include +#include +#include + +/* + * This header guarantees that 'struct timeval' will be available. It includes + * the minimum headers needed to facilitate this. This may still be a + * substantial set of headers on some platforms (e.g. on Win32). + */ + +#if defined(OPENSSL_SYS_WINDOWS) +#if !defined(_WINSOCKAPI_) +/* + * winsock2.h defines _WINSOCK2API_ and both winsock2.h and winsock.h define + * _WINSOCKAPI_. Both of these provide struct timeval. Don't include + * winsock2.h if either header has been included to avoid breakage with + * applications that prefer to use over . + */ +#include +#endif +#else +#include +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ebcdic.h b/VCMP-LUA/modules/postgresql/include/openssl/ebcdic.h new file mode 100644 index 0000000..f2171bb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ebcdic.h @@ -0,0 +1,39 @@ +/* + * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_EBCDIC_H +#define OPENSSL_EBCDIC_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_EBCDIC_H +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid name clashes with other applications */ +#define os_toascii _openssl_os_toascii +#define os_toebcdic _openssl_os_toebcdic +#define ebcdic2ascii _openssl_ebcdic2ascii +#define ascii2ebcdic _openssl_ascii2ebcdic + +extern const unsigned char os_toascii[256]; +extern const unsigned char os_toebcdic[256]; +void *ebcdic2ascii(void *dest, const void *srce, size_t count); +void *ascii2ebcdic(void *dest, const void *srce, size_t count); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ec.h b/VCMP-LUA/modules/postgresql/include/openssl/ec.h new file mode 100644 index 0000000..cdde09c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ec.h @@ -0,0 +1,1569 @@ +/* + * Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_EC_H +#define OPENSSL_EC_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_EC_H +#endif + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Values for EVP_PKEY_CTX_set_ec_param_enc() */ +#define OPENSSL_EC_EXPLICIT_CURVE 0x000 +#define OPENSSL_EC_NAMED_CURVE 0x001 + +int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid); +int EVP_PKEY_CTX_set_ec_param_enc(EVP_PKEY_CTX *ctx, int param_enc); +int EVP_PKEY_CTX_set_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx, int cofactor_mode); +int EVP_PKEY_CTX_get_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_set_ecdh_kdf_type(EVP_PKEY_CTX *ctx, int kdf); +int EVP_PKEY_CTX_get_ecdh_kdf_type(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_set_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); +int EVP_PKEY_CTX_get_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md); + +int EVP_PKEY_CTX_set_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int len); +int EVP_PKEY_CTX_get_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len); + +int EVP_PKEY_CTX_set0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, + int len); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_CTX_get0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm); +#endif + +#define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) +#define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) +#define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) +#define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) +#define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) +#define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) +#define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) +#define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) +#define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) +#define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) + +/* KDF types */ +#define EVP_PKEY_ECDH_KDF_NONE 1 +#define EVP_PKEY_ECDH_KDF_X9_63 2 +/* + * The old name for EVP_PKEY_ECDH_KDF_X9_63 + * The ECDH KDF specification has been mistakenly attributed to ANSI X9.62, + * it is actually specified in ANSI X9.63. + * This identifier is retained for backwards compatibility + */ +#define EVP_PKEY_ECDH_KDF_X9_62 EVP_PKEY_ECDH_KDF_X9_63 + +/** Enum for the point conversion form as defined in X9.62 (ECDSA) + * for the encoding of a elliptic curve point (x,y) */ +typedef enum { + /** the point is encoded as z||x, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_COMPRESSED = 2, + /** the point is encoded as z||x||y, where z is the octet 0x04 */ + POINT_CONVERSION_UNCOMPRESSED = 4, + /** the point is encoded as z||x||y, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_HYBRID = 6 +} point_conversion_form_t; + +const char *OSSL_EC_curve_nid2name(int nid); + +#ifndef OPENSSL_NO_STDIO +#include +#endif +#ifndef OPENSSL_NO_EC +#include +#include +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#include +#endif +#include + +#ifndef OPENSSL_ECC_MAX_FIELD_BITS +#define OPENSSL_ECC_MAX_FIELD_BITS 661 +#endif + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +typedef struct ec_method_st EC_METHOD; +#endif +typedef struct ec_group_st EC_GROUP; +typedef struct ec_point_st EC_POINT; +typedef struct ecpk_parameters_st ECPKPARAMETERS; +typedef struct ec_parameters_st ECPARAMETERS; + +/********************************************************************/ +/* EC_METHODs for curves over GF(p) */ +/********************************************************************/ + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/** Returns the basic GFp ec methods which provides the basis for the + * optimized methods. + * \return EC_METHOD object + */ +OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_simple_method(void); + +/** Returns GFp methods using montgomery multiplication. + * \return EC_METHOD object + */ +OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_mont_method(void); + +/** Returns GFp methods using optimized methods for NIST recommended curves + * \return EC_METHOD object + */ +OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_nist_method(void); + +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +/** Returns 64-bit optimized methods for nistp224 + * \return EC_METHOD object + */ +OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_nistp224_method(void); + +/** Returns 64-bit optimized methods for nistp256 + * \return EC_METHOD object + */ +OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_nistp256_method(void); + +/** Returns 64-bit optimized methods for nistp521 + * \return EC_METHOD object + */ +OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_nistp521_method(void); +#endif /* OPENSSL_NO_EC_NISTP_64_GCC_128 */ + +#ifndef OPENSSL_NO_EC2M +/********************************************************************/ +/* EC_METHOD for curves over GF(2^m) */ +/********************************************************************/ + +/** Returns the basic GF2m ec method + * \return EC_METHOD object + */ +OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GF2m_simple_method(void); + +#endif + +/********************************************************************/ +/* EC_GROUP functions */ +/********************************************************************/ + +/** + * Creates a new EC_GROUP object + * \param meth EC_METHOD to use + * \return newly created EC_GROUP object or NULL in case of an error. + */ +OSSL_DEPRECATEDIN_3_0 EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); + +/** Clears and frees a EC_GROUP object + * \param group EC_GROUP object to be cleared and freed. + */ +OSSL_DEPRECATEDIN_3_0 void EC_GROUP_clear_free(EC_GROUP *group); + +/** Returns the EC_METHOD of the EC_GROUP object. + * \param group EC_GROUP object + * \return EC_METHOD used in this EC_GROUP object. + */ +OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); + +/** Returns the field type of the EC_METHOD. + * \param meth EC_METHOD object + * \return NID of the underlying field type OID. + */ +OSSL_DEPRECATEDIN_3_0 int EC_METHOD_get_field_type(const EC_METHOD *meth); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +/** Frees a EC_GROUP object + * \param group EC_GROUP object to be freed. + */ +void EC_GROUP_free(EC_GROUP *group); + +/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. + * \param dst destination EC_GROUP object + * \param src source EC_GROUP object + * \return 1 on success and 0 if an error occurred. + */ +int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); + +/** Creates a new EC_GROUP object and copies the content + * form src to the newly created EC_KEY object + * \param src source EC_GROUP object + * \return newly created EC_GROUP object or NULL in case of an error. + */ +EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); + +/** Sets the generator and its order/cofactor of a EC_GROUP object. + * \param group EC_GROUP object + * \param generator EC_POINT object with the generator. + * \param order the order of the group generated by the generator. + * \param cofactor the index of the sub-group generated by the generator + * in the group of all points on the elliptic curve. + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, + const BIGNUM *order, const BIGNUM *cofactor); + +/** Returns the generator of a EC_GROUP object. + * \param group EC_GROUP object + * \return the currently used generator (possibly NULL). + */ +const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); + +/** Returns the montgomery data for order(Generator) + * \param group EC_GROUP object + * \return the currently used montgomery data (possibly NULL). + */ +BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); + +/** Gets the order of a EC_GROUP + * \param group EC_GROUP object + * \param order BIGNUM to which the order is copied + * \param ctx unused + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); + +/** Gets the order of an EC_GROUP + * \param group EC_GROUP object + * \return the group order + */ +const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); + +/** Gets the number of bits of the order of an EC_GROUP + * \param group EC_GROUP object + * \return number of bits of group order. + */ +int EC_GROUP_order_bits(const EC_GROUP *group); + +/** Gets the cofactor of a EC_GROUP + * \param group EC_GROUP object + * \param cofactor BIGNUM to which the cofactor is copied + * \param ctx unused + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, + BN_CTX *ctx); + +/** Gets the cofactor of an EC_GROUP + * \param group EC_GROUP object + * \return the group cofactor + */ +const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group); + +/** Sets the name of a EC_GROUP object + * \param group EC_GROUP object + * \param nid NID of the curve name OID + */ +void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); + +/** Returns the curve name of a EC_GROUP object + * \param group EC_GROUP object + * \return NID of the curve name OID or 0 if not set. + */ +int EC_GROUP_get_curve_name(const EC_GROUP *group); + +/** Gets the field of an EC_GROUP + * \param group EC_GROUP object + * \return the group field + */ +const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group); + +/** Returns the field type of the EC_GROUP. + * \param group EC_GROUP object + * \return NID of the underlying field type OID. + */ +int EC_GROUP_get_field_type(const EC_GROUP *group); + +void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); +int EC_GROUP_get_asn1_flag(const EC_GROUP *group); + +void EC_GROUP_set_point_conversion_form(EC_GROUP *group, + point_conversion_form_t form); +point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); + +unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); +size_t EC_GROUP_get_seed_len(const EC_GROUP *); +size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); + +/** Sets the parameters of an ec curve defined by y^2 = x^3 + a*x + b (for GFp) + * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); + +/** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp) + * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, + BN_CTX *ctx); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_GROUP_set_curve_GFp(EC_GROUP *group, + const BIGNUM *p, + const BIGNUM *a, + const BIGNUM *b, + BN_CTX *ctx); + +/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_GROUP_get_curve_GFp(const EC_GROUP *group, + BIGNUM *p, + BIGNUM *a, BIGNUM *b, + BN_CTX *ctx); + +#ifndef OPENSSL_NO_EC2M +/** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_GROUP_set_curve_GF2m(EC_GROUP *group, + const BIGNUM *p, + const BIGNUM *a, + const BIGNUM *b, + BN_CTX *ctx); + +/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, + BIGNUM *p, + BIGNUM *a, BIGNUM *b, + BN_CTX *ctx); +#endif /* OPENSSL_NO_EC2M */ +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +/** Returns the number of bits needed to represent a field element + * \param group EC_GROUP object + * \return number of bits needed to represent a field element + */ +int EC_GROUP_get_degree(const EC_GROUP *group); + +/** Checks whether the parameter in the EC_GROUP define a valid ec group + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if group is a valid ec group and 0 otherwise + */ +int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); + +/** Checks whether the discriminant of the elliptic curve is zero or not + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if the discriminant is not zero and 0 otherwise + */ +int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); + +/** Compares two EC_GROUP objects + * \param a first EC_GROUP object + * \param b second EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 0 if the groups are equal, 1 if not, or -1 on error + */ +int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); + +/* + * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after + * choosing an appropriate EC_METHOD + */ + +/** Creates a new EC_GROUP object with the specified parameters defined + * over GFp (defined by the equation y^2 = x^3 + a*x + b) + * \param p BIGNUM with the prime number + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); +#ifndef OPENSSL_NO_EC2M +/** Creates a new EC_GROUP object with the specified parameters defined + * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) + * \param p BIGNUM with the polynomial defining the underlying field + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); +#endif + +/** + * Creates a EC_GROUP object with a curve specified by parameters. + * The parameters may be explicit or a named curve, + * \param params A list of parameters describing the group. + * \param libctx The associated library context or NULL for the default + * context + * \param propq A property query string + * \return newly created EC_GROUP object with specified parameters or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[], + OSSL_LIB_CTX *libctx, const char *propq); + +/** + * Creates an OSSL_PARAM array with the parameters describing the given + * EC_GROUP. + * The resulting parameters may contain an explicit or a named curve depending + * on the EC_GROUP. + * \param group pointer to the EC_GROUP object + * \param libctx The associated library context or NULL for the default + * context + * \param propq A property query string + * \param bnctx BN_CTX object (optional) + * \return newly created OSSL_PARAM array with the parameters + * describing the given EC_GROUP or NULL if an error occurred + */ +OSSL_PARAM *EC_GROUP_to_params(const EC_GROUP *group, OSSL_LIB_CTX *libctx, + const char *propq, BN_CTX *bnctx); + +/** + * Creates a EC_GROUP object with a curve specified by a NID + * \param libctx The associated library context or NULL for the default + * context + * \param propq A property query string + * \param nid NID of the OID of the curve name + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_by_curve_name_ex(OSSL_LIB_CTX *libctx, const char *propq, + int nid); + +/** + * Creates a EC_GROUP object with a curve specified by a NID. Same as + * EC_GROUP_new_by_curve_name_ex but the libctx and propq are always + * NULL. + * \param nid NID of the OID of the curve name + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_by_curve_name(int nid); + +/** Creates a new EC_GROUP object from an ECPARAMETERS object + * \param params pointer to the ECPARAMETERS object + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params); + +/** Creates an ECPARAMETERS object for the given EC_GROUP object. + * \param group pointer to the EC_GROUP object + * \param params pointer to an existing ECPARAMETERS object or NULL + * \return pointer to the new ECPARAMETERS object or NULL + * if an error occurred. + */ +ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, + ECPARAMETERS *params); + +/** Creates a new EC_GROUP object from an ECPKPARAMETERS object + * \param params pointer to an existing ECPKPARAMETERS object, or NULL + * \return newly created EC_GROUP object with specified curve, or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params); + +/** Creates an ECPKPARAMETERS object for the given EC_GROUP object. + * \param group pointer to the EC_GROUP object + * \param params pointer to an existing ECPKPARAMETERS object or NULL + * \return pointer to the new ECPKPARAMETERS object or NULL + * if an error occurred. + */ +ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, + ECPKPARAMETERS *params); + +/********************************************************************/ +/* handling of internal curves */ +/********************************************************************/ + +typedef struct { + int nid; + const char *comment; +} EC_builtin_curve; + +/* + * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all + * available curves or zero if a error occurred. In case r is not zero, + * nitems EC_builtin_curve structures are filled with the data of the first + * nitems internal groups + */ +size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); + +const char *EC_curve_nid2nist(int nid); +int EC_curve_nist2nid(const char *name); +int EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only, + BN_CTX *ctx); + +/********************************************************************/ +/* EC_POINT functions */ +/********************************************************************/ + +/** Creates a new EC_POINT object for the specified EC_GROUP + * \param group EC_GROUP the underlying EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT *EC_POINT_new(const EC_GROUP *group); + +/** Frees a EC_POINT object + * \param point EC_POINT object to be freed + */ +void EC_POINT_free(EC_POINT *point); + +/** Clears and frees a EC_POINT object + * \param point EC_POINT object to be cleared and freed + */ +void EC_POINT_clear_free(EC_POINT *point); + +/** Copies EC_POINT object + * \param dst destination EC_POINT object + * \param src source EC_POINT object + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); + +/** Creates a new EC_POINT object and copies the content of the supplied + * EC_POINT + * \param src source EC_POINT object + * \param group underlying the EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); + +/** Sets a point to infinity (neutral element) + * \param group underlying EC_GROUP object + * \param point EC_POINT to set to infinity + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/** Returns the EC_METHOD used in EC_POINT object + * \param point EC_POINT object + * \return the EC_METHOD used + */ +OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); + +/** Sets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param z BIGNUM with the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, + BN_CTX *ctx); + +/** Gets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param z BIGNUM for the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, const EC_POINT *p, + BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +/** Sets the affine coordinates of an EC_POINT + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, const BIGNUM *y, + BN_CTX *ctx); + +/** Gets the affine coordinates of an EC_POINT. + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p, + BIGNUM *x, BIGNUM *y, BN_CTX *ctx); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/** Sets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_set_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); + +/** Gets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_get_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *p, + BIGNUM *x, BIGNUM *y, BN_CTX *ctx); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +/** Sets the x9.62 compressed coordinates of a EC_POINT + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, int y_bit, + BN_CTX *ctx); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of + * EC_POINT_set_compressed_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, int y_bit, BN_CTX *ctx); +#ifndef OPENSSL_NO_EC2M +/** Sets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_set_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); + +/** Gets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_get_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, const EC_POINT *p, + BIGNUM *x, BIGNUM *y, BN_CTX *ctx); + +/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of + * EC_POINT_set_compressed_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, int y_bit, BN_CTX *ctx); +#endif +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +/** Encodes a EC_POINT object to a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param form point conversion form + * \param buf memory buffer for the result. If NULL the function returns + * required buffer size. + * \param len length of the memory buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, + point_conversion_form_t form, + unsigned char *buf, size_t len, BN_CTX *ctx); + +/** Decodes a EC_POINT from a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param buf memory buffer with the encoded ec point + * \param len length of the encoded ec point + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, + const unsigned char *buf, size_t len, BN_CTX *ctx); + +/** Encodes an EC_POINT object to an allocated octet string + * \param group underlying EC_GROUP object + * \param point EC_POINT object + * \param form point conversion form + * \param pbuf returns pointer to allocated buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point, + point_conversion_form_t form, + unsigned char **pbuf, BN_CTX *ctx); + +/* other interfaces to point2oct/oct2point: */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 BIGNUM *EC_POINT_point2bn(const EC_GROUP *, + const EC_POINT *, + point_conversion_form_t form, + BIGNUM *, BN_CTX *); +OSSL_DEPRECATEDIN_3_0 EC_POINT *EC_POINT_bn2point(const EC_GROUP *, + const BIGNUM *, + EC_POINT *, BN_CTX *); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, + point_conversion_form_t form, BN_CTX *); +EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, + EC_POINT *, BN_CTX *); + +/********************************************************************/ +/* functions for doing EC_POINT arithmetic */ +/********************************************************************/ + +/** Computes the sum of two EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = a + b) + * \param a EC_POINT object with the first summand + * \param b EC_POINT object with the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, + const EC_POINT *b, BN_CTX *ctx); + +/** Computes the double of a EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = 2 * a) + * \param a EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, + BN_CTX *ctx); + +/** Computes the inverse of a EC_POINT + * \param group underlying EC_GROUP object + * \param a EC_POINT object to be inverted (it's used for the result as well) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); + +/** Checks whether the point is the neutral element of the group + * \param group the underlying EC_GROUP object + * \param p EC_POINT object + * \return 1 if the point is the neutral element and 0 otherwise + */ +int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); + +/** Checks whether the point is on the curve + * \param group underlying EC_GROUP object + * \param point EC_POINT object to check + * \param ctx BN_CTX object (optional) + * \return 1 if the point is on the curve, 0 if not, or -1 on error + */ +int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, + BN_CTX *ctx); + +/** Compares two EC_POINTs + * \param group underlying EC_GROUP object + * \param a first EC_POINT object + * \param b second EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 1 if the points are not equal, 0 if they are, or -1 on error + */ +int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, + BN_CTX *ctx); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int EC_POINT_make_affine(const EC_GROUP *group, + EC_POINT *point, BN_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, + EC_POINT *points[], BN_CTX *ctx); + +/** Computes r = generator * n + sum_{i=0}^{num-1} p[i] * m[i] + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param num number further summands + * \param p array of size num of EC_POINT objects + * \param m array of size num of BIGNUM objects + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, + const BIGNUM *n, size_t num, + const EC_POINT *p[], const BIGNUM *m[], + BN_CTX *ctx); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +/** Computes r = generator * n + q * m + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param q EC_POINT object with the first factor of the second summand + * \param m BIGNUM with the second factor of the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, + const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/** Stores multiples of generator for faster point multiplication + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); + +/** Reports whether a precomputation has been done + * \param group EC_GROUP object + * \return 1 if a pre-computation has been done and 0 otherwise + */ +OSSL_DEPRECATEDIN_3_0 int EC_GROUP_have_precompute_mult(const EC_GROUP *group); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +/********************************************************************/ +/* ASN1 stuff */ +/********************************************************************/ + +DECLARE_ASN1_ITEM(ECPKPARAMETERS) +DECLARE_ASN1_ALLOC_FUNCTIONS(ECPKPARAMETERS) +DECLARE_ASN1_ITEM(ECPARAMETERS) +DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) + +/* + * EC_GROUP_get_basis_type() returns the NID of the basis type used to + * represent the field elements + */ +int EC_GROUP_get_basis_type(const EC_GROUP *); +#ifndef OPENSSL_NO_EC2M +int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); +int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, + unsigned int *k2, unsigned int *k3); +#endif + +EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); +int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); + +#define d2i_ECPKParameters_bio(bp, x) \ + ASN1_d2i_bio_of(EC_GROUP, NULL, d2i_ECPKParameters, bp, x) +#define i2d_ECPKParameters_bio(bp, x) \ + ASN1_i2d_bio_of(EC_GROUP, i2d_ECPKParameters, bp, x) +#define d2i_ECPKParameters_fp(fp, x) \ + (EC_GROUP *)ASN1_d2i_fp(NULL, (d2i_of_void *)d2i_ECPKParameters, (fp), \ + (void **)(x)) +#define i2d_ECPKParameters_fp(fp, x) \ + ASN1_i2d_fp((i2d_of_void *)i2d_ECPKParameters, (fp), (void *)(x)) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ECPKParameters_print(BIO *bp, const EC_GROUP *x, + int off); +#ifndef OPENSSL_NO_STDIO +OSSL_DEPRECATEDIN_3_0 int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, + int off); +#endif +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +/********************************************************************/ +/* EC_KEY functions */ +/********************************************************************/ + +/* some values for the encoding_flag */ +#define EC_PKEY_NO_PARAMETERS 0x001 +#define EC_PKEY_NO_PUBKEY 0x002 + +/* some values for the flags field */ +#define EC_FLAG_SM2_RANGE 0x0004 +#define EC_FLAG_COFACTOR_ECDH 0x1000 +#define EC_FLAG_CHECK_NAMED_GROUP 0x2000 +#define EC_FLAG_CHECK_NAMED_GROUP_NIST 0x4000 +#define EC_FLAG_CHECK_NAMED_GROUP_MASK \ + (EC_FLAG_CHECK_NAMED_GROUP | EC_FLAG_CHECK_NAMED_GROUP_NIST) + +/* Deprecated flags - it was using 0x01..0x02 */ +#define EC_FLAG_NON_FIPS_ALLOW 0x0000 +#define EC_FLAG_FIPS_CHECKED 0x0000 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/** + * Creates a new EC_KEY object. + * \param ctx The library context for to use for this EC_KEY. May be NULL in + * which case the default library context is used. + * \return EC_KEY object or NULL if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_ex(OSSL_LIB_CTX *ctx, const char *propq); + +/** + * Creates a new EC_KEY object. Same as calling EC_KEY_new_ex with a + * NULL library context + * \return EC_KEY object or NULL if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new(void); + +OSSL_DEPRECATEDIN_3_0 int EC_KEY_get_flags(const EC_KEY *key); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_flags(EC_KEY *key, int flags); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_clear_flags(EC_KEY *key, int flags); + +OSSL_DEPRECATEDIN_3_0 int EC_KEY_decoded_from_explicit_params(const EC_KEY *key); + +/** + * Creates a new EC_KEY object using a named curve as underlying + * EC_GROUP object. + * \param ctx The library context for to use for this EC_KEY. May be NULL in + * which case the default library context is used. + * \param propq Any property query string + * \param nid NID of the named curve. + * \return EC_KEY object or NULL if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_by_curve_name_ex(OSSL_LIB_CTX *ctx, + const char *propq, + int nid); + +/** + * Creates a new EC_KEY object using a named curve as underlying + * EC_GROUP object. Same as calling EC_KEY_new_by_curve_name_ex with a NULL + * library context and property query string. + * \param nid NID of the named curve. + * \return EC_KEY object or NULL if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_by_curve_name(int nid); + +/** Frees a EC_KEY object. + * \param key EC_KEY object to be freed. + */ +OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key); + +/** Copies a EC_KEY object. + * \param dst destination EC_KEY object + * \param src src EC_KEY object + * \return dst or NULL if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); + +/** Creates a new EC_KEY object and copies the content from src to it. + * \param src the source EC_KEY object + * \return newly created EC_KEY object or NULL if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_dup(const EC_KEY *src); + +/** Increases the internal reference count of a EC_KEY object. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_up_ref(EC_KEY *key); + +/** Returns the ENGINE object of a EC_KEY object + * \param eckey EC_KEY object + * \return the ENGINE object (possibly NULL). + */ +OSSL_DEPRECATEDIN_3_0 ENGINE *EC_KEY_get0_engine(const EC_KEY *eckey); + +/** Returns the EC_GROUP object of a EC_KEY object + * \param key EC_KEY object + * \return the EC_GROUP object (possibly NULL). + */ +OSSL_DEPRECATEDIN_3_0 const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); + +/** Sets the EC_GROUP of a EC_KEY object. + * \param key EC_KEY object + * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY + * object will use an own copy of the EC_GROUP). + * \return 1 on success and 0 if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); + +/** Returns the private key of a EC_KEY object. + * \param key EC_KEY object + * \return a BIGNUM with the private key (possibly NULL). + */ +OSSL_DEPRECATEDIN_3_0 const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); + +/** Sets the private key of a EC_KEY object. + * \param key EC_KEY object + * \param prv BIGNUM with the private key (note: the EC_KEY object + * will use an own copy of the BIGNUM). + * \return 1 on success and 0 if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); + +/** Returns the public key of a EC_KEY object. + * \param key the EC_KEY object + * \return a EC_POINT object with the public key (possibly NULL) + */ +OSSL_DEPRECATEDIN_3_0 const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); + +/** Sets the public key of a EC_KEY object. + * \param key EC_KEY object + * \param pub EC_POINT object with the public key (note: the EC_KEY object + * will use an own copy of the EC_POINT object). + * \return 1 on success and 0 if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); + +OSSL_DEPRECATEDIN_3_0 unsigned EC_KEY_get_enc_flags(const EC_KEY *key); +OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); +OSSL_DEPRECATEDIN_3_0 point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); +OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_conv_form(EC_KEY *eckey, + point_conversion_form_t cform); +#endif /*OPENSSL_NO_DEPRECATED_3_0 */ + +#define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg); +OSSL_DEPRECATEDIN_3_0 void *EC_KEY_get_ex_data(const EC_KEY *key, int idx); + +/* wrapper functions for the underlying EC_GROUP object */ +OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); + +/** Creates a table of pre-computed multiples of the generator to + * accelerate further EC_KEY operations. + * \param key EC_KEY object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); + +/** Creates a new ec private (and optional a new public) key. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_generate_key(EC_KEY *key); + +/** Verifies that a private and/or public key is valid. + * \param key the EC_KEY object + * \return 1 on success and 0 otherwise. + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_check_key(const EC_KEY *key); + +/** Indicates if an EC_KEY can be used for signing. + * \param eckey the EC_KEY object + * \return 1 if can sign and 0 otherwise. + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_can_sign(const EC_KEY *eckey); + +/** Sets a public key from affine coordinates performing + * necessary NIST PKV tests. + * \param key the EC_KEY object + * \param x public key x coordinate + * \param y public key y coordinate + * \return 1 on success and 0 otherwise. + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, + BIGNUM *x, + BIGNUM *y); + +/** Encodes an EC_KEY public key to an allocated octet string + * \param key key to encode + * \param form point conversion form + * \param pbuf returns pointer to allocated buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 size_t EC_KEY_key2buf(const EC_KEY *key, + point_conversion_form_t form, + unsigned char **pbuf, BN_CTX *ctx); + +/** Decodes a EC_KEY public key from a octet string + * \param key key to decode + * \param buf memory buffer with the encoded ec point + * \param len length of the encoded ec point + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ + +OSSL_DEPRECATEDIN_3_0 int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, + size_t len, BN_CTX *ctx); + +/** Decodes an EC_KEY private key from an octet string + * \param key key to decode + * \param buf memory buffer with the encoded private key + * \param len length of the encoded key + * \return 1 on success and 0 if an error occurred + */ + +OSSL_DEPRECATEDIN_3_0 int EC_KEY_oct2priv(EC_KEY *key, const unsigned char *buf, + size_t len); + +/** Encodes a EC_KEY private key to an octet string + * \param key key to encode + * \param buf memory buffer for the result. If NULL the function returns + * required buffer size. + * \param len length of the memory buffer + * \return the length of the encoded octet string or 0 if an error occurred + */ + +OSSL_DEPRECATEDIN_3_0 size_t EC_KEY_priv2oct(const EC_KEY *key, + unsigned char *buf, size_t len); + +/** Encodes an EC_KEY private key to an allocated octet string + * \param eckey key to encode + * \param pbuf returns pointer to allocated buffer + * \return the length of the encoded octet string or 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 size_t EC_KEY_priv2buf(const EC_KEY *eckey, + unsigned char **pbuf); + +/********************************************************************/ +/* de- and encoding functions for SEC1 ECPrivateKey */ +/********************************************************************/ + +/** Decodes a private key from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded private key + * \param len length of the DER encoded private key + * \return the decoded private key or NULL if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey(EC_KEY **key, + const unsigned char **in, + long len); + +/** Encodes a private key object and stores the result in a buffer. + * \param key the EC_KEY object to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey(const EC_KEY *key, + unsigned char **out); + +/********************************************************************/ +/* de- and encoding functions for EC parameters */ +/********************************************************************/ + +/** Decodes ec parameter from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded ec parameters + * \param len length of the DER encoded ec parameters + * \return a EC_KEY object with the decoded parameters or NULL if an error + * occurred. + */ +OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECParameters(EC_KEY **key, + const unsigned char **in, + long len); + +/** Encodes ec parameter and stores the result in a buffer. + * \param key the EC_KEY object with ec parameters to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +OSSL_DEPRECATEDIN_3_0 int i2d_ECParameters(const EC_KEY *key, + unsigned char **out); + +/********************************************************************/ +/* de- and encoding functions for EC public key */ +/* (octet string, not DER -- hence 'o2i' and 'i2o') */ +/********************************************************************/ + +/** Decodes an ec public key from a octet string. + * \param key a pointer to a EC_KEY object which should be used + * \param in memory buffer with the encoded public key + * \param len length of the encoded public key + * \return EC_KEY object with decoded public key or NULL if an error + * occurred. + */ +OSSL_DEPRECATEDIN_3_0 EC_KEY *o2i_ECPublicKey(EC_KEY **key, + const unsigned char **in, long len); + +/** Encodes an ec public key in an octet string. + * \param key the EC_KEY object with the public key + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out); + +/** Prints out the ec parameters on human readable form. + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int ECParameters_print(BIO *bp, const EC_KEY *key); + +/** Prints out the contents of a EC_KEY object + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); + +#ifndef OPENSSL_NO_STDIO +/** Prints out the ec parameters on human readable form. + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int ECParameters_print_fp(FILE *fp, const EC_KEY *key); + +/** Prints out the contents of a EC_KEY object + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); +#endif /* OPENSSL_NO_STDIO */ + +OSSL_DEPRECATEDIN_3_0 const EC_KEY_METHOD *EC_KEY_OpenSSL(void); +OSSL_DEPRECATEDIN_3_0 const EC_KEY_METHOD *EC_KEY_get_default_method(void); +OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_default_method(const EC_KEY_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key); +OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_method(ENGINE *engine); + +/** The old name for ecdh_KDF_X9_63 + * The ECDH KDF specification has been mistakenly attributed to ANSI X9.62, + * it is actually specified in ANSI X9.63. + * This identifier is retained for backwards compatibility + */ +OSSL_DEPRECATEDIN_3_0 int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, + const unsigned char *Z, size_t Zlen, + const unsigned char *sinfo, + size_t sinfolen, const EVP_MD *md); + +OSSL_DEPRECATEDIN_3_0 int ECDH_compute_key(void *out, size_t outlen, + const EC_POINT *pub_key, + const EC_KEY *ecdh, + void *(*KDF)(const void *in, + size_t inlen, void *out, + size_t *outlen)); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +typedef struct ECDSA_SIG_st ECDSA_SIG; + +/** Allocates and initialize a ECDSA_SIG structure + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_SIG_new(void); + +/** frees a ECDSA_SIG structure + * \param sig pointer to the ECDSA_SIG structure + */ +void ECDSA_SIG_free(ECDSA_SIG *sig); + +/** i2d_ECDSA_SIG encodes content of ECDSA_SIG (note: this function modifies *pp + * (*pp += length of the DER encoded signature)). + * \param sig pointer to the ECDSA_SIG object + * \param pp pointer to a unsigned char pointer for the output or NULL + * \return the length of the DER encoded ECDSA_SIG object or a negative value + * on error + */ +DECLARE_ASN1_ENCODE_FUNCTIONS_only(ECDSA_SIG, ECDSA_SIG) + +/** d2i_ECDSA_SIG decodes an ECDSA signature (note: this function modifies *pp + * (*pp += len)). + * \param sig pointer to ECDSA_SIG pointer (may be NULL) + * \param pp memory buffer with the DER encoded signature + * \param len length of the buffer + * \return pointer to the decoded ECDSA_SIG structure (or NULL) + */ + +/** Accessor for r and s fields of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + * \param pr pointer to BIGNUM pointer for r (may be NULL) + * \param ps pointer to BIGNUM pointer for s (may be NULL) + */ +void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); + +/** Accessor for r field of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + */ +const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); + +/** Accessor for s field of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + */ +const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); + +/** Setter for r and s fields of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + * \param r pointer to BIGNUM for r + * \param s pointer to BIGNUM for s + */ +int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/** Computes the ECDSA signature of the given hash value using + * the supplied private key and returns the created signature. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, + int dgst_len, EC_KEY *eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optional), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +OSSL_DEPRECATEDIN_3_0 ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, + int dgstlen, const BIGNUM *kinv, + const BIGNUM *rp, EC_KEY *eckey); + +/** Verifies that the supplied signature is a valid ECDSA + * signature of the supplied hash value using the supplied public key. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param sig ECDSA_SIG structure + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +OSSL_DEPRECATEDIN_3_0 int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, + const ECDSA_SIG *sig, EC_KEY *eckey); + +/** Precompute parts of the signing operation + * \param eckey EC_KEY object containing a private EC key + * \param ctx BN_CTX object (optional) + * \param kinv BIGNUM pointer for the inverse of k + * \param rp BIGNUM pointer for x coordinate of k * generator + * \return 1 on success and 0 otherwise + */ +OSSL_DEPRECATEDIN_3_0 int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, + BIGNUM **kinv, BIGNUM **rp); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig memory for the DER encoded created signature + * \param siglen pointer to the length of the returned signature + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +OSSL_DEPRECATEDIN_3_0 int ECDSA_sign(int type, const unsigned char *dgst, + int dgstlen, unsigned char *sig, + unsigned int *siglen, EC_KEY *eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig buffer to hold the DER encoded signature + * \param siglen pointer to the length of the returned signature + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optional), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +OSSL_DEPRECATEDIN_3_0 int ECDSA_sign_ex(int type, const unsigned char *dgst, + int dgstlen, unsigned char *sig, + unsigned int *siglen, const BIGNUM *kinv, + const BIGNUM *rp, EC_KEY *eckey); + +/** Verifies that the given signature is valid ECDSA signature + * of the supplied hash value using the specified public key. + * \param type this parameter is ignored + * \param dgst pointer to the hash value + * \param dgstlen length of the hash value + * \param sig pointer to the DER encoded signature + * \param siglen length of the DER encoded signature + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +OSSL_DEPRECATEDIN_3_0 int ECDSA_verify(int type, const unsigned char *dgst, + int dgstlen, const unsigned char *sig, + int siglen, EC_KEY *eckey); + +/** Returns the maximum length of the DER encoded signature + * \param eckey EC_KEY object + * \return numbers of bytes required for the DER encoded signature + */ +OSSL_DEPRECATEDIN_3_0 int ECDSA_size(const EC_KEY *eckey); + +/********************************************************************/ +/* EC_KEY_METHOD constructors, destructors, writers and accessors */ +/********************************************************************/ + +OSSL_DEPRECATEDIN_3_0 EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_free(EC_KEY_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, + int (*init)(EC_KEY *key), + void (*finish)(EC_KEY *key), + int (*copy)(EC_KEY *dest, const EC_KEY *src), + int (*set_group)(EC_KEY *key, const EC_GROUP *grp), + int (*set_private)(EC_KEY *key, const BIGNUM *priv_key), + int (*set_public)(EC_KEY *key, const EC_POINT *pub_key)); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, + int (*keygen)(EC_KEY *key)); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, + int (*ckey)(unsigned char **psec, size_t *pseclen, + const EC_POINT *pub_key, const EC_KEY *ecdh)); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, + int (*sign)(int type, const unsigned char *dgst, + int dlen, unsigned char *sig, + unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *r, + EC_KEY *eckey), + int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, + BIGNUM **kinvp, BIGNUM **rp), + ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, + int dgst_len, + const BIGNUM *in_kinv, + const BIGNUM *in_r, + EC_KEY *eckey)); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, + int (*verify)(int type, const unsigned char *dgst, int dgst_len, + const unsigned char *sigbuf, + int sig_len, EC_KEY *eckey), + int (*verify_sig)(const unsigned char *dgst, + int dgst_len, const ECDSA_SIG *sig, + EC_KEY *eckey)); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth, + int (**pinit)(EC_KEY *key), + void (**pfinish)(EC_KEY *key), + int (**pcopy)(EC_KEY *dest, const EC_KEY *src), + int (**pset_group)(EC_KEY *key, const EC_GROUP *grp), + int (**pset_private)(EC_KEY *key, const BIGNUM *priv_key), + int (**pset_public)(EC_KEY *key, const EC_POINT *pub_key)); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, int (**pkeygen)(EC_KEY *key)); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, + int (**pck)(unsigned char **psec, + size_t *pseclen, + const EC_POINT *pub_key, + const EC_KEY *ecdh)); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, + int (**psign)(int type, const unsigned char *dgst, + int dlen, unsigned char *sig, + unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *r, + EC_KEY *eckey), + int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, + BIGNUM **kinvp, BIGNUM **rp), + ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, + int dgst_len, + const BIGNUM *in_kinv, + const BIGNUM *in_r, + EC_KEY *eckey)); + +OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, + int (**pverify)(int type, const unsigned char *dgst, int dgst_len, + const unsigned char *sigbuf, + int sig_len, EC_KEY *eckey), + int (**pverify_sig)(const unsigned char *dgst, + int dgst_len, + const ECDSA_SIG *sig, + EC_KEY *eckey)); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +#define EVP_EC_gen(curve) \ + EVP_PKEY_Q_keygen(NULL, NULL, "EC", (char *)(strstr(curve, ""))) +/* strstr is used to enable type checking for the variadic string arg */ +#define ECParameters_dup(x) ASN1_dup_of(EC_KEY, i2d_ECParameters, \ + d2i_ECParameters, x) + +#ifndef __cplusplus +#if defined(__SUNPRO_C) +#if __SUNPRO_C >= 0x520 +#pragma error_messages(default, E_ARRAY_OF_INCOMPLETE_NONAME, E_ARRAY_OF_INCOMPLETE) +#endif +#endif +#endif + +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ecdh.h b/VCMP-LUA/modules/postgresql/include/openssl/ecdh.h new file mode 100644 index 0000000..56bd4cc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ecdh.h @@ -0,0 +1,10 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ecdsa.h b/VCMP-LUA/modules/postgresql/include/openssl/ecdsa.h new file mode 100644 index 0000000..56bd4cc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ecdsa.h @@ -0,0 +1,10 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ecerr.h b/VCMP-LUA/modules/postgresql/include/openssl/ecerr.h new file mode 100644 index 0000000..e4d26aa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ecerr.h @@ -0,0 +1,102 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_ECERR_H +#define OPENSSL_ECERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_EC + +/* + * EC reason codes. + */ +#define EC_R_ASN1_ERROR 115 +#define EC_R_BAD_SIGNATURE 156 +#define EC_R_BIGNUM_OUT_OF_RANGE 144 +#define EC_R_BUFFER_TOO_SMALL 100 +#define EC_R_CANNOT_INVERT 165 +#define EC_R_COORDINATES_OUT_OF_RANGE 146 +#define EC_R_CURVE_DOES_NOT_SUPPORT_ECDH 160 +#define EC_R_CURVE_DOES_NOT_SUPPORT_ECDSA 170 +#define EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 159 +#define EC_R_DECODE_ERROR 142 +#define EC_R_DISCRIMINANT_IS_ZERO 118 +#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 +#define EC_R_EXPLICIT_PARAMS_NOT_SUPPORTED 127 +#define EC_R_FAILED_MAKING_PUBLIC_KEY 166 +#define EC_R_FIELD_TOO_LARGE 143 +#define EC_R_GF2M_NOT_SUPPORTED 147 +#define EC_R_GROUP2PKPARAMETERS_FAILURE 120 +#define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 +#define EC_R_INCOMPATIBLE_OBJECTS 101 +#define EC_R_INVALID_A 168 +#define EC_R_INVALID_ARGUMENT 112 +#define EC_R_INVALID_B 169 +#define EC_R_INVALID_COFACTOR 171 +#define EC_R_INVALID_COMPRESSED_POINT 110 +#define EC_R_INVALID_COMPRESSION_BIT 109 +#define EC_R_INVALID_CURVE 141 +#define EC_R_INVALID_DIGEST 151 +#define EC_R_INVALID_DIGEST_TYPE 138 +#define EC_R_INVALID_ENCODING 102 +#define EC_R_INVALID_FIELD 103 +#define EC_R_INVALID_FORM 104 +#define EC_R_INVALID_GENERATOR 173 +#define EC_R_INVALID_GROUP_ORDER 122 +#define EC_R_INVALID_KEY 116 +#define EC_R_INVALID_LENGTH 117 +#define EC_R_INVALID_NAMED_GROUP_CONVERSION 174 +#define EC_R_INVALID_OUTPUT_LENGTH 161 +#define EC_R_INVALID_P 172 +#define EC_R_INVALID_PEER_KEY 133 +#define EC_R_INVALID_PENTANOMIAL_BASIS 132 +#define EC_R_INVALID_PRIVATE_KEY 123 +#define EC_R_INVALID_SEED 175 +#define EC_R_INVALID_TRINOMIAL_BASIS 137 +#define EC_R_KDF_PARAMETER_ERROR 148 +#define EC_R_KEYS_NOT_SET 140 +#define EC_R_LADDER_POST_FAILURE 136 +#define EC_R_LADDER_PRE_FAILURE 153 +#define EC_R_LADDER_STEP_FAILURE 162 +#define EC_R_MISSING_OID 167 +#define EC_R_MISSING_PARAMETERS 124 +#define EC_R_MISSING_PRIVATE_KEY 125 +#define EC_R_NEED_NEW_SETUP_VALUES 157 +#define EC_R_NOT_A_NIST_PRIME 135 +#define EC_R_NOT_IMPLEMENTED 126 +#define EC_R_NOT_INITIALIZED 111 +#define EC_R_NO_PARAMETERS_SET 139 +#define EC_R_NO_PRIVATE_VALUE 154 +#define EC_R_OPERATION_NOT_SUPPORTED 152 +#define EC_R_PASSED_NULL_PARAMETER 134 +#define EC_R_PEER_KEY_ERROR 149 +#define EC_R_POINT_ARITHMETIC_FAILURE 155 +#define EC_R_POINT_AT_INFINITY 106 +#define EC_R_POINT_COORDINATES_BLIND_FAILURE 163 +#define EC_R_POINT_IS_NOT_ON_CURVE 107 +#define EC_R_RANDOM_NUMBER_GENERATION_FAILED 158 +#define EC_R_SHARED_INFO_ERROR 150 +#define EC_R_SLOT_FULL 108 +#define EC_R_TOO_MANY_RETRIES 176 +#define EC_R_UNDEFINED_GENERATOR 113 +#define EC_R_UNDEFINED_ORDER 128 +#define EC_R_UNKNOWN_COFACTOR 164 +#define EC_R_UNKNOWN_GROUP 129 +#define EC_R_UNKNOWN_ORDER 114 +#define EC_R_UNSUPPORTED_FIELD 131 +#define EC_R_WRONG_CURVE_PARAMETERS 145 +#define EC_R_WRONG_ORDER 130 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/encoder.h b/VCMP-LUA/modules/postgresql/include/openssl/encoder.h new file mode 100644 index 0000000..9138c07 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/encoder.h @@ -0,0 +1,124 @@ +/* + * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_ENCODER_H +#define OPENSSL_ENCODER_H +#pragma once + +#include + +#ifndef OPENSSL_NO_STDIO +#include +#endif +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *libctx, const char *name, + const char *properties); +int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder); +void OSSL_ENCODER_free(OSSL_ENCODER *encoder); + +const OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder); +const char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder); +const char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *kdf); +const char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *kdf); +int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name); + +void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(OSSL_ENCODER *encoder, void *arg), + void *arg); +int OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder); +int OSSL_ENCODER_get_params(OSSL_ENCODER *encoder, OSSL_PARAM params[]); + +const OSSL_PARAM *OSSL_ENCODER_settable_ctx_params(OSSL_ENCODER *encoder); +OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new(void); +int OSSL_ENCODER_CTX_set_params(OSSL_ENCODER_CTX *ctx, + const OSSL_PARAM params[]); +void OSSL_ENCODER_CTX_free(OSSL_ENCODER_CTX *ctx); + +/* Utilities that help set specific parameters */ +int OSSL_ENCODER_CTX_set_passphrase(OSSL_ENCODER_CTX *ctx, + const unsigned char *kstr, size_t klen); +int OSSL_ENCODER_CTX_set_pem_password_cb(OSSL_ENCODER_CTX *ctx, + pem_password_cb *cb, void *cbarg); +int OSSL_ENCODER_CTX_set_passphrase_cb(OSSL_ENCODER_CTX *ctx, + OSSL_PASSPHRASE_CALLBACK *cb, + void *cbarg); +int OSSL_ENCODER_CTX_set_passphrase_ui(OSSL_ENCODER_CTX *ctx, + const UI_METHOD *ui_method, + void *ui_data); +int OSSL_ENCODER_CTX_set_cipher(OSSL_ENCODER_CTX *ctx, + const char *cipher_name, + const char *propquery); +int OSSL_ENCODER_CTX_set_selection(OSSL_ENCODER_CTX *ctx, int selection); +int OSSL_ENCODER_CTX_set_output_type(OSSL_ENCODER_CTX *ctx, + const char *output_type); +int OSSL_ENCODER_CTX_set_output_structure(OSSL_ENCODER_CTX *ctx, + const char *output_structure); + +/* Utilities to add encoders */ +int OSSL_ENCODER_CTX_add_encoder(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER *encoder); +int OSSL_ENCODER_CTX_add_extra(OSSL_ENCODER_CTX *ctx, + OSSL_LIB_CTX *libctx, const char *propq); +int OSSL_ENCODER_CTX_get_num_encoders(OSSL_ENCODER_CTX *ctx); + +typedef struct ossl_encoder_instance_st OSSL_ENCODER_INSTANCE; +OSSL_ENCODER * +OSSL_ENCODER_INSTANCE_get_encoder(OSSL_ENCODER_INSTANCE *encoder_inst); +void * +OSSL_ENCODER_INSTANCE_get_encoder_ctx(OSSL_ENCODER_INSTANCE *encoder_inst); +const char * +OSSL_ENCODER_INSTANCE_get_output_type(OSSL_ENCODER_INSTANCE *encoder_inst); +const char * +OSSL_ENCODER_INSTANCE_get_output_structure(OSSL_ENCODER_INSTANCE *encoder_inst); + +typedef const void *OSSL_ENCODER_CONSTRUCT(OSSL_ENCODER_INSTANCE *encoder_inst, + void *construct_data); +typedef void OSSL_ENCODER_CLEANUP(void *construct_data); + +int OSSL_ENCODER_CTX_set_construct(OSSL_ENCODER_CTX *ctx, + OSSL_ENCODER_CONSTRUCT *construct); +int OSSL_ENCODER_CTX_set_construct_data(OSSL_ENCODER_CTX *ctx, + void *construct_data); +int OSSL_ENCODER_CTX_set_cleanup(OSSL_ENCODER_CTX *ctx, + OSSL_ENCODER_CLEANUP *cleanup); + +/* Utilities to output the object to encode */ +int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out); +#ifndef OPENSSL_NO_STDIO +int OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp); +#endif +int OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata, + size_t *pdata_len); + +/* + * Create the OSSL_ENCODER_CTX with an associated type. This will perform + * an implicit OSSL_ENCODER_fetch(), suitable for the object of that type. + * This is more useful than calling OSSL_ENCODER_CTX_new(). + */ +OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new_for_pkey(const EVP_PKEY *pkey, + int selection, + const char *output_type, + const char *output_struct, + const char *propquery); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/encodererr.h b/VCMP-LUA/modules/postgresql/include/openssl/encodererr.h new file mode 100644 index 0000000..e07174c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/encodererr.h @@ -0,0 +1,26 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_ENCODERERR_H +#define OPENSSL_ENCODERERR_H +#pragma once + +#include +#include +#include + +/* + * OSSL_ENCODER reason codes. + */ +#define OSSL_ENCODER_R_ENCODER_NOT_FOUND 101 +#define OSSL_ENCODER_R_INCORRECT_PROPERTY_QUERY 100 +#define OSSL_ENCODER_R_MISSING_GET_PARAMS 102 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/engine.h b/VCMP-LUA/modules/postgresql/include/openssl/engine.h new file mode 100644 index 0000000..73f6d86 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/engine.h @@ -0,0 +1,841 @@ +/* + * Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_ENGINE_H +#define OPENSSL_ENGINE_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_ENGINE_H +#endif + +#include + +#ifndef OPENSSL_NO_ENGINE +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#include +#include +#include +#include +#include +#include +#include +#include +#endif +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These flags are used to control combinations of algorithm (methods) by + * bitwise "OR"ing. + */ +#define ENGINE_METHOD_RSA (unsigned int)0x0001 +#define ENGINE_METHOD_DSA (unsigned int)0x0002 +#define ENGINE_METHOD_DH (unsigned int)0x0004 +#define ENGINE_METHOD_RAND (unsigned int)0x0008 +#define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 +#define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 +#define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 +#define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 +#define ENGINE_METHOD_EC (unsigned int)0x0800 +/* Obvious all-or-nothing cases. */ +#define ENGINE_METHOD_ALL (unsigned int)0xFFFF +#define ENGINE_METHOD_NONE (unsigned int)0x0000 + +/* + * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used + * internally to control registration of ENGINE implementations, and can be + * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to + * initialise registered ENGINEs if they are not already initialised. + */ +#define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 + +/* ENGINE flags that can be set by ENGINE_set_flags(). */ +/* Not used */ +/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ + +/* + * This flag is for ENGINEs that wish to handle the various 'CMD'-related + * control commands on their own. Without this flag, ENGINE_ctrl() handles + * these control commands on behalf of the ENGINE using their "cmd_defns" + * data. + */ +#define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 + +/* + * This flag is for ENGINEs who return new duplicate structures when found + * via "ENGINE_by_id()". When an ENGINE must store state (eg. if + * ENGINE_ctrl() commands are called in sequence as part of some stateful + * process like key-generation setup and execution), it can set this flag - + * then each attempt to obtain the ENGINE will result in it being copied into + * a new structure. Normally, ENGINEs don't declare this flag so + * ENGINE_by_id() just increments the existing ENGINE's structural reference + * count. + */ +#define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 + +/* + * This flag is for an ENGINE that does not want its methods registered as + * part of ENGINE_register_all_complete() for example if the methods are not + * usable as default methods. + */ + +#define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 + +/* + * ENGINEs can support their own command types, and these flags are used in + * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input + * each command expects. Currently only numeric and string input is + * supported. If a control command supports none of the _NUMERIC, _STRING, or + * _NO_INPUT options, then it is regarded as an "internal" control command - + * and not for use in config setting situations. As such, they're not + * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() + * access. Changes to this list of 'command types' should be reflected + * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). + */ + +/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ +#define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 +/* + * accepts string input (cast from 'void*' to 'const char *', 4th parameter + * to ENGINE_ctrl) + */ +#define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 +/* + * Indicates that the control command takes *no* input. Ie. the control + * command is unparameterised. + */ +#define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 +/* + * Indicates that the control command is internal. This control command won't + * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() + * function. + */ +#define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 + +/* + * NB: These 3 control commands are deprecated and should not be used. + * ENGINEs relying on these commands should compile conditional support for + * compatibility (eg. if these symbols are defined) but should also migrate + * the same functionality to their own ENGINE-specific control functions that + * can be "discovered" by calling applications. The fact these control + * commands wouldn't be "executable" (ie. usable by text-based config) + * doesn't change the fact that application code can find and use them + * without requiring per-ENGINE hacking. + */ + +/* + * These flags are used to tell the ctrl function what should be done. All + * command numbers are shared between all engines, even if some don't make + * sense to some engines. In such a case, they do nothing but return the + * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. + */ +#define ENGINE_CTRL_SET_LOGSTREAM 1 +#define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 +#define ENGINE_CTRL_HUP 3 /* Close and reinitialise \ + * any handles/connections \ + * etc. */ +#define ENGINE_CTRL_SET_USER_INTERFACE 4 /* Alternative to callback */ +#define ENGINE_CTRL_SET_CALLBACK_DATA 5 /* User-specific data, used \ + * when calling the password \ + * callback and the user \ + * interface */ +#define ENGINE_CTRL_LOAD_CONFIGURATION 6 /* Load a configuration, \ + * given a string that \ + * represents a file name \ + * or so */ +#define ENGINE_CTRL_LOAD_SECTION 7 /* Load data from a given \ + * section in the already \ + * loaded configuration */ + +/* + * These control commands allow an application to deal with an arbitrary + * engine in a dynamic way. Warn: Negative return values indicate errors FOR + * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other + * commands, including ENGINE-specific command types, return zero for an + * error. An ENGINE can choose to implement these ctrl functions, and can + * internally manage things however it chooses - it does so by setting the + * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise + * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the + * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's + * ctrl() handler need only implement its own commands - the above "meta" + * commands will be taken care of. + */ + +/* + * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", + * then all the remaining control commands will return failure, so it is + * worth checking this first if the caller is trying to "discover" the + * engine's capabilities and doesn't want errors generated unnecessarily. + */ +#define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 +/* + * Returns a positive command number for the first command supported by the + * engine. Returns zero if no ctrl commands are supported. + */ +#define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 +/* + * The 'long' argument specifies a command implemented by the engine, and the + * return value is the next command supported, or zero if there are no more. + */ +#define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 +/* + * The 'void*' argument is a command name (cast from 'const char *'), and the + * return value is the command that corresponds to it. + */ +#define ENGINE_CTRL_GET_CMD_FROM_NAME 13 +/* + * The next two allow a command to be converted into its corresponding string + * form. In each case, the 'long' argument supplies the command. In the + * NAME_LEN case, the return value is the length of the command name (not + * counting a trailing EOL). In the NAME case, the 'void*' argument must be a + * string buffer large enough, and it will be populated with the name of the + * command (WITH a trailing EOL). + */ +#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 +#define ENGINE_CTRL_GET_NAME_FROM_CMD 15 +/* The next two are similar but give a "short description" of a command. */ +#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 +#define ENGINE_CTRL_GET_DESC_FROM_CMD 17 +/* + * With this command, the return value is the OR'd combination of + * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given + * engine-specific ctrl command expects. + */ +#define ENGINE_CTRL_GET_CMD_FLAGS 18 + +/* + * ENGINE implementations should start the numbering of their own control + * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). + */ +#define ENGINE_CMD_BASE 200 + +/* + * NB: These 2 nCipher "chil" control commands are deprecated, and their + * functionality is now available through ENGINE-specific control commands + * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 + * commands should be migrated to the more general command handling before + * these are removed. + */ + +/* Flags specific to the nCipher "chil" engine */ +#define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 +/* + * Depending on the value of the (long)i argument, this sets or + * unsets the SimpleForkCheck flag in the CHIL API to enable or + * disable checking and workarounds for applications that fork(). + */ +#define ENGINE_CTRL_CHIL_NO_LOCKING 101 +/* + * This prevents the initialisation function from providing mutex + * callbacks to the nCipher library. + */ + +/* + * If an ENGINE supports its own specific control commands and wishes the + * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on + * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN + * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() + * handler that supports the stated commands (ie. the "cmd_num" entries as + * described by the array). NB: The array must be ordered in increasing order + * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element + * has cmd_num set to zero and/or cmd_name set to NULL. + */ +typedef struct ENGINE_CMD_DEFN_st { + unsigned int cmd_num; /* The command number */ + const char *cmd_name; /* The command name itself */ + const char *cmd_desc; /* A short description of the command */ + unsigned int cmd_flags; /* The input the command expects */ +} ENGINE_CMD_DEFN; + +/* Generic function pointer */ +typedef int (*ENGINE_GEN_FUNC_PTR)(void); +/* Generic function pointer taking no arguments */ +typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *); +/* Specific control function pointer */ +typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, + void (*f)(void)); +/* Generic load_key function pointer */ +typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, + UI_METHOD *ui_method, + void *callback_data); +typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl, + STACK_OF(X509_NAME) *ca_dn, + X509 **pcert, EVP_PKEY **pkey, + STACK_OF(X509) **pother, + UI_METHOD *ui_method, + void *callback_data); +/*- + * These callback types are for an ENGINE's handler for cipher and digest logic. + * These handlers have these prototypes; + * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); + * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); + * Looking at how to implement these handlers in the case of cipher support, if + * the framework wants the EVP_CIPHER for 'nid', it will call; + * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) + * If the framework wants a list of supported 'nid's, it will call; + * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) + */ +/* + * Returns to a pointer to the array of supported cipher 'nid's. If the + * second parameter is non-NULL it is set to the size of the returned array. + */ +typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, + const int **, int); +typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, + int); +typedef int (*ENGINE_PKEY_METHS_PTR)(ENGINE *, EVP_PKEY_METHOD **, + const int **, int); +typedef int (*ENGINE_PKEY_ASN1_METHS_PTR)(ENGINE *, EVP_PKEY_ASN1_METHOD **, + const int **, int); +/* + * STRUCTURE functions ... all of these functions deal with pointers to + * ENGINE structures where the pointers have a "structural reference". This + * means that their reference is to allowed access to the structure but it + * does not imply that the structure is functional. To simply increment or + * decrement the structural reference count, use ENGINE_by_id and + * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next + * as it will automatically decrement the structural reference count of the + * "current" ENGINE and increment the structural reference count of the + * ENGINE it returns (unless it is NULL). + */ + +/* Get the first/last "ENGINE" type available. */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_first(void); +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_last(void); +#endif +/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_next(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_prev(ENGINE *e); +#endif +/* Add another "ENGINE" type into the array. */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_add(ENGINE *e); +#endif +/* Remove an existing "ENGINE" type from the array. */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_remove(ENGINE *e); +#endif +/* Retrieve an engine from the list by its unique "id" value. */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_by_id(const char *id); +#endif + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define ENGINE_load_openssl() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL) +#define ENGINE_load_dynamic() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL) +#ifndef OPENSSL_NO_STATIC_ENGINE +#define ENGINE_load_padlock() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL) +#define ENGINE_load_capi() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL) +#define ENGINE_load_afalg() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL) +#endif +#define ENGINE_load_cryptodev() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) +#define ENGINE_load_rdrand() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL) +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 void ENGINE_load_builtin_engines(void); +#endif + +/* + * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation + * "registry" handling. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 unsigned int ENGINE_get_table_flags(void); +OSSL_DEPRECATEDIN_3_0 void ENGINE_set_table_flags(unsigned int flags); +#endif + +/*- Manage registration of ENGINEs per "table". For each type, there are 3 + * functions; + * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) + * ENGINE_unregister_***(e) - unregister the implementation from 'e' + * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list + * Cleanup is automatically registered from each table when required. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_RSA(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_RSA(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_RSA(void); +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_DSA(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_DSA(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_DSA(void); +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_EC(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_EC(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_EC(void); +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_DH(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_DH(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_DH(void); +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_RAND(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_RAND(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_RAND(void); +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_ciphers(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_ciphers(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_ciphers(void); +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_digests(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_digests(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_digests(void); +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_pkey_meths(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_pkey_meths(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_pkey_meths(void); +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_pkey_asn1_meths(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_pkey_asn1_meths(void); +#endif + +/* + * These functions register all support from the above categories. Note, use + * of these functions can result in static linkage of code your application + * may not need. If you only need a subset of functionality, consider using + * more selective initialisation. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_complete(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_register_all_complete(void); +#endif + +/* + * Send parameterised control commands to the engine. The possibilities to + * send down an integer, a pointer to data or a function pointer are + * provided. Any of the parameters may or may not be NULL, depending on the + * command number. In actuality, this function only requires a structural + * (rather than functional) reference to an engine, but many control commands + * may require the engine be functional. The caller should be aware of trying + * commands that require an operational ENGINE, and only use functional + * references in such situations. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, + void (*f)(void)); +#endif + +/* + * This function tests if an ENGINE-specific command is usable as a + * "setting". Eg. in an application's config file that gets processed through + * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to + * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_cmd_is_executable(ENGINE *e, int cmd); +#endif + +/* + * This function works like ENGINE_ctrl() with the exception of taking a + * command name instead of a command number, and can handle optional + * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation + * on how to use the cmd_name and cmd_optional. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, + long i, void *p, void (*f)(void), + int cmd_optional); +#endif + +/* + * This function passes a command-name and argument to an ENGINE. The + * cmd_name is converted to a command number and the control command is + * called using 'arg' as an argument (unless the ENGINE doesn't support such + * a command, in which case no control command is called). The command is + * checked for input flags, and if necessary the argument will be converted + * to a numeric value. If cmd_optional is non-zero, then if the ENGINE + * doesn't support the given cmd_name the return value will be success + * anyway. This function is intended for applications to use so that users + * (or config files) can supply engine-specific config data to the ENGINE at + * run-time to control behaviour of specific engines. As such, it shouldn't + * be used for calling ENGINE_ctrl() functions that return data, deal with + * binary data, or that are otherwise supposed to be used directly through + * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() + * operation in this function will be lost - the return value is interpreted + * as failure if the return value is zero, success otherwise, and this + * function returns a boolean value as a result. In other words, vendors of + * 'ENGINE'-enabled devices should write ENGINE implementations with + * parameterisations that work in this scheme, so that compliant ENGINE-based + * applications can work consistently with the same configuration for the + * same ENGINE-enabled devices, across applications. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, + int cmd_optional); +#endif + +/* + * These functions are useful for manufacturing new ENGINE structures. They + * don't address reference counting at all - one uses them to populate an + * ENGINE structure with personalised implementations of things prior to + * using it directly or adding it to the builtin ENGINE list in OpenSSL. + * These are also here so that the ENGINE structure doesn't have to be + * exposed and break binary compatibility! + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_new(void); +OSSL_DEPRECATEDIN_3_0 int ENGINE_free(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_up_ref(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_id(ENGINE *e, const char *id); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_name(ENGINE *e, const char *name); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, + ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_flags(ENGINE *e, int flags); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_cmd_defns(ENGINE *e, + const ENGINE_CMD_DEFN *defns); +#endif +/* These functions allow control over any per-structure ENGINE data. */ +#define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef) +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); +OSSL_DEPRECATEDIN_3_0 void *ENGINE_get_ex_data(const ENGINE *e, int idx); +#endif + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +/* + * This function previously cleaned up anything that needs it. Auto-deinit will + * now take care of it so it is no longer required to call this function. + */ +#define ENGINE_cleanup() \ + while (0) \ + continue +#endif + +/* + * These return values from within the ENGINE structure. These can be useful + * with functional references as well as structural references - it depends + * which you obtained. Using the result for functional purposes if you only + * obtained a structural reference may be problematic! + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 const char *ENGINE_get_id(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 const char *ENGINE_get_name(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 const DH_METHOD *ENGINE_get_DH(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); +OSSL_DEPRECATEDIN_3_0 +const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); +OSSL_DEPRECATEDIN_3_0 +const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); +OSSL_DEPRECATEDIN_3_0 +const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); +OSSL_DEPRECATEDIN_3_0 +const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, + const char *str, + int len); +OSSL_DEPRECATEDIN_3_0 +const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, + const char *str, int len); +OSSL_DEPRECATEDIN_3_0 +const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_get_flags(const ENGINE *e); +#endif + +/* + * FUNCTIONAL functions. These functions deal with ENGINE structures that + * have (or will) be initialised for use. Broadly speaking, the structural + * functions are useful for iterating the list of available engine types, + * creating new engine types, and other "list" operations. These functions + * actually deal with ENGINEs that are to be used. As such these functions + * can fail (if applicable) when particular engines are unavailable - eg. if + * a hardware accelerator is not attached or not functioning correctly. Each + * ENGINE has 2 reference counts; structural and functional. Every time a + * functional reference is obtained or released, a corresponding structural + * reference is automatically obtained or released too. + */ + +/* + * Initialise an engine type for use (or up its reference count if it's + * already in use). This will fail if the engine is not currently operational + * and cannot initialise. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_init(ENGINE *e); +#endif +/* + * Free a functional reference to an engine type. This does not require a + * corresponding call to ENGINE_free as it also releases a structural + * reference. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_finish(ENGINE *e); +#endif + +/* + * The following functions handle keys that are stored in some secondary + * location, handled by the engine. The storage may be on a card or + * whatever. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +OSSL_DEPRECATEDIN_3_0 +EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +OSSL_DEPRECATEDIN_3_0 +int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, STACK_OF(X509_NAME) *ca_dn, + X509 **pcert, EVP_PKEY **ppkey, + STACK_OF(X509) **pother, + UI_METHOD *ui_method, void *callback_data); +#endif + +/* + * This returns a pointer for the current ENGINE structure that is (by + * default) performing any RSA operations. The value returned is an + * incremented reference, so it should be free'd (ENGINE_finish) before it is + * discarded. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_RSA(void); +#endif +/* Same for the other "methods" */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_DSA(void); +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_EC(void); +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_DH(void); +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_RAND(void); +#endif +/* + * These functions can be used to get a functional reference to perform + * ciphering or digesting corresponding to "nid". + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_cipher_engine(int nid); +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_digest_engine(int nid); +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_pkey_meth_engine(int nid); +OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); +#endif + +/* + * This sets a new default ENGINE structure for performing RSA operations. If + * the result is non-zero (success) then the ENGINE structure will have had + * its reference count up'd so the caller should still free their own + * reference 'e'. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_RSA(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_string(ENGINE *e, + const char *def_list); +#endif +/* Same for the other "methods" */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_DSA(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_EC(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_DH(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_RAND(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_ciphers(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_digests(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_pkey_meths(ENGINE *e); +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); +#endif + +/* + * The combination "set" - the flags are bitwise "OR"d from the + * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" + * function, this function can result in unnecessary static linkage. If your + * application requires only specific functionality, consider using more + * selective functions. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default(ENGINE *e, unsigned int flags); +OSSL_DEPRECATEDIN_3_0 void ENGINE_add_conf_module(void); +#endif + +/* Deprecated functions ... */ +/* int ENGINE_clear_defaults(void); */ + +/**************************/ +/* DYNAMIC ENGINE SUPPORT */ +/**************************/ + +/* Binary/behaviour compatibility levels */ +#define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000 +/* + * Binary versions older than this are too old for us (whether we're a loader + * or a loadee) + */ +#define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000 + +/* + * When compiling an ENGINE entirely as an external shared library, loadable + * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' + * structure type provides the calling application's (or library's) error + * functionality and memory management function pointers to the loaded + * library. These should be used/set in the loaded library code so that the + * loading application's 'state' will be used/changed in all operations. The + * 'static_state' pointer allows the loaded library to know if it shares the + * same static data as the calling application (or library), and thus whether + * these callbacks need to be set or not. + */ +typedef void *(*dyn_MEM_malloc_fn)(size_t, const char *, int); +typedef void *(*dyn_MEM_realloc_fn)(void *, size_t, const char *, int); +typedef void (*dyn_MEM_free_fn)(void *, const char *, int); +typedef struct st_dynamic_MEM_fns { + dyn_MEM_malloc_fn malloc_fn; + dyn_MEM_realloc_fn realloc_fn; + dyn_MEM_free_fn free_fn; +} dynamic_MEM_fns; +/* + * FIXME: Perhaps the memory and locking code (crypto.h) should declare and + * use these types so we (and any other dependent code) can simplify a bit?? + */ +/* The top-level structure */ +typedef struct st_dynamic_fns { + void *static_state; + dynamic_MEM_fns mem_fns; +} dynamic_fns; + +/* + * The version checking function should be of this prototype. NB: The + * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading + * code. If this function returns zero, it indicates a (potential) version + * incompatibility and the loaded library doesn't believe it can proceed. + * Otherwise, the returned value is the (latest) version supported by the + * loading library. The loader may still decide that the loaded code's + * version is unsatisfactory and could veto the load. The function is + * expected to be implemented with the symbol name "v_check", and a default + * implementation can be fully instantiated with + * IMPLEMENT_DYNAMIC_CHECK_FN(). + */ +typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version); +#define IMPLEMENT_DYNAMIC_CHECK_FN() \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v) \ + { \ + if (v >= OSSL_DYNAMIC_OLDEST) \ + return OSSL_DYNAMIC_VERSION; \ + return 0; \ + } + +/* + * This function is passed the ENGINE structure to initialise with its own + * function and command settings. It should not adjust the structural or + * functional reference counts. If this function returns zero, (a) the load + * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto + * the structure, and (c) the shared library will be unloaded. So + * implementations should do their own internal cleanup in failure + * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, + * represents the ENGINE id that the loader is looking for. If this is NULL, + * the shared library can choose to return failure or to initialise a + * 'default' ENGINE. If non-NULL, the shared library must initialise only an + * ENGINE matching the passed 'id'. The function is expected to be + * implemented with the symbol name "bind_engine". A standard implementation + * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter + * 'fn' is a callback function that populates the ENGINE structure and + * returns an int value (zero for failure). 'fn' should have prototype; + * [static] int fn(ENGINE *e, const char *id); + */ +typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id, + const dynamic_fns *fns); +#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) \ + { \ + if (ENGINE_get_static_state() == fns->static_state) \ + goto skip_cbs; \ + CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \ + fns->mem_fns.realloc_fn, \ + fns->mem_fns.free_fn); \ + OPENSSL_init_crypto(OPENSSL_INIT_NO_ATEXIT, NULL); \ + skip_cbs: \ + if (!fn(e, id)) \ + return 0; \ + return 1; \ + } + +/* + * If the loading application (or library) and the loaded ENGINE library + * share the same static data (eg. they're both dynamically linked to the + * same libcrypto.so) we need a way to avoid trying to set system callbacks - + * this would fail, and for the same reason that it's unnecessary to try. If + * the loaded ENGINE has (or gets from through the loader) its own copy of + * the libcrypto static data, we will need to set the callbacks. The easiest + * way to detect this is to have a function that returns a pointer to some + * static data and let the loading application and loaded ENGINE compare + * their respective values. + */ +void *ENGINE_get_static_state(void); + +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 void ENGINE_setup_bsd_cryptodev(void); +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif /* OPENSSL_NO_ENGINE */ +#endif /* OPENSSL_ENGINE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/engineerr.h b/VCMP-LUA/modules/postgresql/include/openssl/engineerr.h new file mode 100644 index 0000000..7cdfb8a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/engineerr.h @@ -0,0 +1,61 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_ENGINEERR_H +#define OPENSSL_ENGINEERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_ENGINE + +/* + * ENGINE reason codes. + */ +#define ENGINE_R_ALREADY_LOADED 100 +#define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 +#define ENGINE_R_CMD_NOT_EXECUTABLE 134 +#define ENGINE_R_COMMAND_TAKES_INPUT 135 +#define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 +#define ENGINE_R_CONFLICTING_ENGINE_ID 103 +#define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 +#define ENGINE_R_DSO_FAILURE 104 +#define ENGINE_R_DSO_NOT_FOUND 132 +#define ENGINE_R_ENGINES_SECTION_ERROR 148 +#define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 +#define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 +#define ENGINE_R_ENGINE_SECTION_ERROR 149 +#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 +#define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 +#define ENGINE_R_FINISH_FAILED 106 +#define ENGINE_R_ID_OR_NAME_MISSING 108 +#define ENGINE_R_INIT_FAILED 109 +#define ENGINE_R_INTERNAL_LIST_ERROR 110 +#define ENGINE_R_INVALID_ARGUMENT 143 +#define ENGINE_R_INVALID_CMD_NAME 137 +#define ENGINE_R_INVALID_CMD_NUMBER 138 +#define ENGINE_R_INVALID_INIT_VALUE 151 +#define ENGINE_R_INVALID_STRING 150 +#define ENGINE_R_NOT_INITIALISED 117 +#define ENGINE_R_NOT_LOADED 112 +#define ENGINE_R_NO_CONTROL_FUNCTION 120 +#define ENGINE_R_NO_INDEX 144 +#define ENGINE_R_NO_LOAD_FUNCTION 125 +#define ENGINE_R_NO_REFERENCE 130 +#define ENGINE_R_NO_SUCH_ENGINE 116 +#define ENGINE_R_UNIMPLEMENTED_CIPHER 146 +#define ENGINE_R_UNIMPLEMENTED_DIGEST 147 +#define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 +#define ENGINE_R_VERSION_INCOMPATIBILITY 145 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/err.h b/VCMP-LUA/modules/postgresql/include/openssl/err.h new file mode 100644 index 0000000..a15ac6a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/err.h @@ -0,0 +1,517 @@ +/* + * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_ERR_H +#define OPENSSL_ERR_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_ERR_H +#endif + +#include + +#ifndef OPENSSL_NO_STDIO +#include +#include +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_FILENAMES +#define ERR_PUT_error(l, f, r, fn, ln) ERR_put_error(l, f, r, fn, ln) +#else +#define ERR_PUT_error(l, f, r, fn, ln) ERR_put_error(l, f, r, NULL, 0) +#endif +#endif + +#include +#include + +#define ERR_TXT_MALLOCED 0x01 +#define ERR_TXT_STRING 0x02 + +#if !defined(OPENSSL_NO_DEPRECATED_3_0) || defined(OSSL_FORCE_ERR_STATE) +#define ERR_FLAG_MARK 0x01 +#define ERR_FLAG_CLEAR 0x02 + +#define ERR_NUM_ERRORS 16 +struct err_state_st { + int err_flags[ERR_NUM_ERRORS]; + int err_marks[ERR_NUM_ERRORS]; + unsigned long err_buffer[ERR_NUM_ERRORS]; + char *err_data[ERR_NUM_ERRORS]; + size_t err_data_size[ERR_NUM_ERRORS]; + int err_data_flags[ERR_NUM_ERRORS]; + char *err_file[ERR_NUM_ERRORS]; + int err_line[ERR_NUM_ERRORS]; + char *err_func[ERR_NUM_ERRORS]; + int top, bottom; +}; +#endif + +/* library */ +#define ERR_LIB_NONE 1 +#define ERR_LIB_SYS 2 +#define ERR_LIB_BN 3 +#define ERR_LIB_RSA 4 +#define ERR_LIB_DH 5 +#define ERR_LIB_EVP 6 +#define ERR_LIB_BUF 7 +#define ERR_LIB_OBJ 8 +#define ERR_LIB_PEM 9 +#define ERR_LIB_DSA 10 +#define ERR_LIB_X509 11 +/* #define ERR_LIB_METH 12 */ +#define ERR_LIB_ASN1 13 +#define ERR_LIB_CONF 14 +#define ERR_LIB_CRYPTO 15 +#define ERR_LIB_EC 16 +#define ERR_LIB_SSL 20 +/* #define ERR_LIB_SSL23 21 */ +/* #define ERR_LIB_SSL2 22 */ +/* #define ERR_LIB_SSL3 23 */ +/* #define ERR_LIB_RSAREF 30 */ +/* #define ERR_LIB_PROXY 31 */ +#define ERR_LIB_BIO 32 +#define ERR_LIB_PKCS7 33 +#define ERR_LIB_X509V3 34 +#define ERR_LIB_PKCS12 35 +#define ERR_LIB_RAND 36 +#define ERR_LIB_DSO 37 +#define ERR_LIB_ENGINE 38 +#define ERR_LIB_OCSP 39 +#define ERR_LIB_UI 40 +#define ERR_LIB_COMP 41 +#define ERR_LIB_ECDSA 42 +#define ERR_LIB_ECDH 43 +#define ERR_LIB_OSSL_STORE 44 +#define ERR_LIB_FIPS 45 +#define ERR_LIB_CMS 46 +#define ERR_LIB_TS 47 +#define ERR_LIB_HMAC 48 +/* # define ERR_LIB_JPAKE 49 */ +#define ERR_LIB_CT 50 +#define ERR_LIB_ASYNC 51 +#define ERR_LIB_KDF 52 +#define ERR_LIB_SM2 53 +#define ERR_LIB_ESS 54 +#define ERR_LIB_PROP 55 +#define ERR_LIB_CRMF 56 +#define ERR_LIB_PROV 57 +#define ERR_LIB_CMP 58 +#define ERR_LIB_OSSL_ENCODER 59 +#define ERR_LIB_OSSL_DECODER 60 +#define ERR_LIB_HTTP 61 + +#define ERR_LIB_USER 128 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define ASN1err(f, r) ERR_raise_data(ERR_LIB_ASN1, (r), NULL) +#define ASYNCerr(f, r) ERR_raise_data(ERR_LIB_ASYNC, (r), NULL) +#define BIOerr(f, r) ERR_raise_data(ERR_LIB_BIO, (r), NULL) +#define BNerr(f, r) ERR_raise_data(ERR_LIB_BN, (r), NULL) +#define BUFerr(f, r) ERR_raise_data(ERR_LIB_BUF, (r), NULL) +#define CMPerr(f, r) ERR_raise_data(ERR_LIB_CMP, (r), NULL) +#define CMSerr(f, r) ERR_raise_data(ERR_LIB_CMS, (r), NULL) +#define COMPerr(f, r) ERR_raise_data(ERR_LIB_COMP, (r), NULL) +#define CONFerr(f, r) ERR_raise_data(ERR_LIB_CONF, (r), NULL) +#define CRMFerr(f, r) ERR_raise_data(ERR_LIB_CRMF, (r), NULL) +#define CRYPTOerr(f, r) ERR_raise_data(ERR_LIB_CRYPTO, (r), NULL) +#define CTerr(f, r) ERR_raise_data(ERR_LIB_CT, (r), NULL) +#define DHerr(f, r) ERR_raise_data(ERR_LIB_DH, (r), NULL) +#define DSAerr(f, r) ERR_raise_data(ERR_LIB_DSA, (r), NULL) +#define DSOerr(f, r) ERR_raise_data(ERR_LIB_DSO, (r), NULL) +#define ECDHerr(f, r) ERR_raise_data(ERR_LIB_ECDH, (r), NULL) +#define ECDSAerr(f, r) ERR_raise_data(ERR_LIB_ECDSA, (r), NULL) +#define ECerr(f, r) ERR_raise_data(ERR_LIB_EC, (r), NULL) +#define ENGINEerr(f, r) ERR_raise_data(ERR_LIB_ENGINE, (r), NULL) +#define ESSerr(f, r) ERR_raise_data(ERR_LIB_ESS, (r), NULL) +#define EVPerr(f, r) ERR_raise_data(ERR_LIB_EVP, (r), NULL) +#define FIPSerr(f, r) ERR_raise_data(ERR_LIB_FIPS, (r), NULL) +#define HMACerr(f, r) ERR_raise_data(ERR_LIB_HMAC, (r), NULL) +#define HTTPerr(f, r) ERR_raise_data(ERR_LIB_HTTP, (r), NULL) +#define KDFerr(f, r) ERR_raise_data(ERR_LIB_KDF, (r), NULL) +#define OBJerr(f, r) ERR_raise_data(ERR_LIB_OBJ, (r), NULL) +#define OCSPerr(f, r) ERR_raise_data(ERR_LIB_OCSP, (r), NULL) +#define OSSL_STOREerr(f, r) ERR_raise_data(ERR_LIB_OSSL_STORE, (r), NULL) +#define PEMerr(f, r) ERR_raise_data(ERR_LIB_PEM, (r), NULL) +#define PKCS12err(f, r) ERR_raise_data(ERR_LIB_PKCS12, (r), NULL) +#define PKCS7err(f, r) ERR_raise_data(ERR_LIB_PKCS7, (r), NULL) +#define PROPerr(f, r) ERR_raise_data(ERR_LIB_PROP, (r), NULL) +#define PROVerr(f, r) ERR_raise_data(ERR_LIB_PROV, (r), NULL) +#define RANDerr(f, r) ERR_raise_data(ERR_LIB_RAND, (r), NULL) +#define RSAerr(f, r) ERR_raise_data(ERR_LIB_RSA, (r), NULL) +#define KDFerr(f, r) ERR_raise_data(ERR_LIB_KDF, (r), NULL) +#define SM2err(f, r) ERR_raise_data(ERR_LIB_SM2, (r), NULL) +#define SSLerr(f, r) ERR_raise_data(ERR_LIB_SSL, (r), NULL) +#define SYSerr(f, r) ERR_raise_data(ERR_LIB_SYS, (r), NULL) +#define TSerr(f, r) ERR_raise_data(ERR_LIB_TS, (r), NULL) +#define UIerr(f, r) ERR_raise_data(ERR_LIB_UI, (r), NULL) +#define X509V3err(f, r) ERR_raise_data(ERR_LIB_X509V3, (r), NULL) +#define X509err(f, r) ERR_raise_data(ERR_LIB_X509, (r), NULL) +#endif + +/*- + * The error code packs differently depending on if it records a system + * error or an OpenSSL error. + * + * A system error packs like this (we follow POSIX and only allow positive + * numbers that fit in an |int|): + * + * +-+-------------------------------------------------------------+ + * |1| system error number | + * +-+-------------------------------------------------------------+ + * + * An OpenSSL error packs like this: + * + * <---------------------------- 32 bits --------------------------> + * <--- 8 bits ---><------------------ 23 bits -----------------> + * +-+---------------+---------------------------------------------+ + * |0| library | reason | + * +-+---------------+---------------------------------------------+ + * + * A few of the reason bits are reserved as flags with special meaning: + * + * <5 bits-<>--------- 19 bits -----------------> + * +-------+-+-----------------------------------+ + * | rflags| | reason | + * +-------+-+-----------------------------------+ + * ^ + * | + * ERR_RFLAG_FATAL = ERR_R_FATAL + * + * The reason flags are part of the overall reason code for practical + * reasons, as they provide an easy way to place different types of + * reason codes in different numeric ranges. + * + * The currently known reason flags are: + * + * ERR_RFLAG_FATAL Flags that the reason code is considered fatal. + * For backward compatibility reasons, this flag + * is also the code for ERR_R_FATAL (that reason + * code served the dual purpose of flag and reason + * code in one in pre-3.0 OpenSSL). + * ERR_RFLAG_COMMON Flags that the reason code is common to all + * libraries. All ERR_R_ macros must use this flag, + * and no other _R_ macro is allowed to use it. + */ + +/* Macros to help decode recorded system errors */ +#define ERR_SYSTEM_FLAG ((unsigned int)INT_MAX + 1) +#define ERR_SYSTEM_MASK ((unsigned int)INT_MAX) + +/* + * Macros to help decode recorded OpenSSL errors + * As expressed above, RFLAGS and REASON overlap by one bit to allow + * ERR_R_FATAL to use ERR_RFLAG_FATAL as its reason code. + */ +#define ERR_LIB_OFFSET 23L +#define ERR_LIB_MASK 0xFF +#define ERR_RFLAGS_OFFSET 18L +#define ERR_RFLAGS_MASK 0x1F +#define ERR_REASON_MASK 0X7FFFFF + +/* + * Reason flags are defined pre-shifted to easily combine with the reason + * number. + */ +#define ERR_RFLAG_FATAL (0x1 << ERR_RFLAGS_OFFSET) +#define ERR_RFLAG_COMMON (0x2 << ERR_RFLAGS_OFFSET) + +#define ERR_SYSTEM_ERROR(errcode) (((errcode) & ERR_SYSTEM_FLAG) != 0) + +static ossl_unused ossl_inline int ERR_GET_LIB(unsigned long errcode) +{ + if (ERR_SYSTEM_ERROR(errcode)) + return ERR_LIB_SYS; + return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK; +} + +static ossl_unused ossl_inline int ERR_GET_RFLAGS(unsigned long errcode) +{ + if (ERR_SYSTEM_ERROR(errcode)) + return 0; + return errcode & (ERR_RFLAGS_MASK << ERR_RFLAGS_OFFSET); +} + +static ossl_unused ossl_inline int ERR_GET_REASON(unsigned long errcode) +{ + if (ERR_SYSTEM_ERROR(errcode)) + return errcode & ERR_SYSTEM_MASK; + return errcode & ERR_REASON_MASK; +} + +static ossl_unused ossl_inline int ERR_FATAL_ERROR(unsigned long errcode) +{ + return (ERR_GET_RFLAGS(errcode) & ERR_RFLAG_FATAL) != 0; +} + +static ossl_unused ossl_inline int ERR_COMMON_ERROR(unsigned long errcode) +{ + return (ERR_GET_RFLAGS(errcode) & ERR_RFLAG_COMMON) != 0; +} + +/* + * ERR_PACK is a helper macro to properly pack OpenSSL error codes and may + * only be used for that purpose. System errors are packed internally. + * ERR_PACK takes reason flags and reason code combined in |reason|. + * ERR_PACK ignores |func|, that parameter is just legacy from pre-3.0 OpenSSL. + */ +#define ERR_PACK(lib, func, reason) \ + ((((unsigned long)(lib) & ERR_LIB_MASK) << ERR_LIB_OFFSET) | (((unsigned long)(reason) & ERR_REASON_MASK))) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SYS_F_FOPEN 0 +#define SYS_F_CONNECT 0 +#define SYS_F_GETSERVBYNAME 0 +#define SYS_F_SOCKET 0 +#define SYS_F_IOCTLSOCKET 0 +#define SYS_F_BIND 0 +#define SYS_F_LISTEN 0 +#define SYS_F_ACCEPT 0 +#define SYS_F_WSASTARTUP 0 +#define SYS_F_OPENDIR 0 +#define SYS_F_FREAD 0 +#define SYS_F_GETADDRINFO 0 +#define SYS_F_GETNAMEINFO 0 +#define SYS_F_SETSOCKOPT 0 +#define SYS_F_GETSOCKOPT 0 +#define SYS_F_GETSOCKNAME 0 +#define SYS_F_GETHOSTBYNAME 0 +#define SYS_F_FFLUSH 0 +#define SYS_F_OPEN 0 +#define SYS_F_CLOSE 0 +#define SYS_F_IOCTL 0 +#define SYS_F_STAT 0 +#define SYS_F_FCNTL 0 +#define SYS_F_FSTAT 0 +#define SYS_F_SENDFILE 0 +#endif + +/* + * All ERR_R_ codes must be combined with ERR_RFLAG_COMMON. + */ + +/* "we came from here" global reason codes, range 1..255 */ +#define ERR_R_SYS_LIB (ERR_LIB_SYS /* 2 */ | ERR_RFLAG_COMMON) +#define ERR_R_BN_LIB (ERR_LIB_BN /* 3 */ | ERR_RFLAG_COMMON) +#define ERR_R_RSA_LIB (ERR_LIB_RSA /* 4 */ | ERR_RFLAG_COMMON) +#define ERR_R_DH_LIB (ERR_LIB_DH /* 5 */ | ERR_RFLAG_COMMON) +#define ERR_R_EVP_LIB (ERR_LIB_EVP /* 6 */ | ERR_RFLAG_COMMON) +#define ERR_R_BUF_LIB (ERR_LIB_BUF /* 7 */ | ERR_RFLAG_COMMON) +#define ERR_R_OBJ_LIB (ERR_LIB_OBJ /* 8 */ | ERR_RFLAG_COMMON) +#define ERR_R_PEM_LIB (ERR_LIB_PEM /* 9 */ | ERR_RFLAG_COMMON) +#define ERR_R_DSA_LIB (ERR_LIB_DSA /* 10 */ | ERR_RFLAG_COMMON) +#define ERR_R_X509_LIB (ERR_LIB_X509 /* 11 */ | ERR_RFLAG_COMMON) +#define ERR_R_ASN1_LIB (ERR_LIB_ASN1 /* 13 */ | ERR_RFLAG_COMMON) +#define ERR_R_CONF_LIB (ERR_LIB_CONF /* 14 */ | ERR_RFLAG_COMMON) +#define ERR_R_CRYPTO_LIB (ERR_LIB_CRYPTO /* 15 */ | ERR_RFLAG_COMMON) +#define ERR_R_EC_LIB (ERR_LIB_EC /* 16 */ | ERR_RFLAG_COMMON) +#define ERR_R_SSL_LIB (ERR_LIB_SSL /* 20 */ | ERR_RFLAG_COMMON) +#define ERR_R_BIO_LIB (ERR_LIB_BIO /* 32 */ | ERR_RFLAG_COMMON) +#define ERR_R_PKCS7_LIB (ERR_LIB_PKCS7 /* 33 */ | ERR_RFLAG_COMMON) +#define ERR_R_X509V3_LIB (ERR_LIB_X509V3 /* 34 */ | ERR_RFLAG_COMMON) +#define ERR_R_PKCS12_LIB (ERR_LIB_PKCS12 /* 35 */ | ERR_RFLAG_COMMON) +#define ERR_R_RAND_LIB (ERR_LIB_RAND /* 36 */ | ERR_RFLAG_COMMON) +#define ERR_R_DSO_LIB (ERR_LIB_DSO /* 37 */ | ERR_RFLAG_COMMON) +#define ERR_R_ENGINE_LIB (ERR_LIB_ENGINE /* 38 */ | ERR_RFLAG_COMMON) +#define ERR_R_UI_LIB (ERR_LIB_UI /* 40 */ | ERR_RFLAG_COMMON) +#define ERR_R_ECDSA_LIB (ERR_LIB_ECDSA /* 42 */ | ERR_RFLAG_COMMON) +#define ERR_R_OSSL_STORE_LIB (ERR_LIB_OSSL_STORE /* 44 */ | ERR_RFLAG_COMMON) +#define ERR_R_CMS_LIB (ERR_LIB_CMS /* 46 */ | ERR_RFLAG_COMMON) +#define ERR_R_TS_LIB (ERR_LIB_TS /* 47 */ | ERR_RFLAG_COMMON) +#define ERR_R_CT_LIB (ERR_LIB_CT /* 50 */ | ERR_RFLAG_COMMON) +#define ERR_R_PROV_LIB (ERR_LIB_PROV /* 57 */ | ERR_RFLAG_COMMON) +#define ERR_R_ESS_LIB (ERR_LIB_ESS /* 54 */ | ERR_RFLAG_COMMON) +#define ERR_R_CMP_LIB (ERR_LIB_CMP /* 58 */ | ERR_RFLAG_COMMON) +#define ERR_R_OSSL_ENCODER_LIB (ERR_LIB_OSSL_ENCODER /* 59 */ | ERR_RFLAG_COMMON) +#define ERR_R_OSSL_DECODER_LIB (ERR_LIB_OSSL_DECODER /* 60 */ | ERR_RFLAG_COMMON) + +/* Other common error codes, range 256..2^ERR_RFLAGS_OFFSET-1 */ +#define ERR_R_FATAL (ERR_RFLAG_FATAL | ERR_RFLAG_COMMON) +#define ERR_R_MALLOC_FAILURE (256 | ERR_R_FATAL) +#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (257 | ERR_R_FATAL) +#define ERR_R_PASSED_NULL_PARAMETER (258 | ERR_R_FATAL) +#define ERR_R_INTERNAL_ERROR (259 | ERR_R_FATAL) +#define ERR_R_DISABLED (260 | ERR_R_FATAL) +#define ERR_R_INIT_FAIL (261 | ERR_R_FATAL) +#define ERR_R_PASSED_INVALID_ARGUMENT (262 | ERR_RFLAG_COMMON) +#define ERR_R_OPERATION_FAIL (263 | ERR_R_FATAL) +#define ERR_R_INVALID_PROVIDER_FUNCTIONS (264 | ERR_R_FATAL) +#define ERR_R_INTERRUPTED_OR_CANCELLED (265 | ERR_RFLAG_COMMON) +#define ERR_R_NESTED_ASN1_ERROR (266 | ERR_RFLAG_COMMON) +#define ERR_R_MISSING_ASN1_EOS (267 | ERR_RFLAG_COMMON) +#define ERR_R_UNSUPPORTED (268 | ERR_RFLAG_COMMON) +#define ERR_R_FETCH_FAILED (269 | ERR_RFLAG_COMMON) +#define ERR_R_INVALID_PROPERTY_DEFINITION (270 | ERR_RFLAG_COMMON) +#define ERR_R_UNABLE_TO_GET_READ_LOCK (271 | ERR_R_FATAL) +#define ERR_R_UNABLE_TO_GET_WRITE_LOCK (272 | ERR_R_FATAL) + +typedef struct ERR_string_data_st { + unsigned long error; + const char *string; +} ERR_STRING_DATA; + +/* clang-format off */ +DEFINE_LHASH_OF_INTERNAL(ERR_STRING_DATA); +#define lh_ERR_STRING_DATA_new(hfn, cmp) ((LHASH_OF(ERR_STRING_DATA) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_ERR_STRING_DATA_lh_hashfunc_type(hfn), ossl_check_ERR_STRING_DATA_lh_compfunc_type(cmp)), lh_ERR_STRING_DATA_hash_thunk, lh_ERR_STRING_DATA_comp_thunk, lh_ERR_STRING_DATA_doall_thunk, lh_ERR_STRING_DATA_doall_arg_thunk)) +#define lh_ERR_STRING_DATA_free(lh) OPENSSL_LH_free(ossl_check_ERR_STRING_DATA_lh_type(lh)) +#define lh_ERR_STRING_DATA_flush(lh) OPENSSL_LH_flush(ossl_check_ERR_STRING_DATA_lh_type(lh)) +#define lh_ERR_STRING_DATA_insert(lh, ptr) ((ERR_STRING_DATA *)OPENSSL_LH_insert(ossl_check_ERR_STRING_DATA_lh_type(lh), ossl_check_ERR_STRING_DATA_lh_plain_type(ptr))) +#define lh_ERR_STRING_DATA_delete(lh, ptr) ((ERR_STRING_DATA *)OPENSSL_LH_delete(ossl_check_ERR_STRING_DATA_lh_type(lh), ossl_check_const_ERR_STRING_DATA_lh_plain_type(ptr))) +#define lh_ERR_STRING_DATA_retrieve(lh, ptr) ((ERR_STRING_DATA *)OPENSSL_LH_retrieve(ossl_check_ERR_STRING_DATA_lh_type(lh), ossl_check_const_ERR_STRING_DATA_lh_plain_type(ptr))) +#define lh_ERR_STRING_DATA_error(lh) OPENSSL_LH_error(ossl_check_ERR_STRING_DATA_lh_type(lh)) +#define lh_ERR_STRING_DATA_num_items(lh) OPENSSL_LH_num_items(ossl_check_ERR_STRING_DATA_lh_type(lh)) +#define lh_ERR_STRING_DATA_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_ERR_STRING_DATA_lh_type(lh), out) +#define lh_ERR_STRING_DATA_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_ERR_STRING_DATA_lh_type(lh), out) +#define lh_ERR_STRING_DATA_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_ERR_STRING_DATA_lh_type(lh), out) +#define lh_ERR_STRING_DATA_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_ERR_STRING_DATA_lh_type(lh)) +#define lh_ERR_STRING_DATA_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_ERR_STRING_DATA_lh_type(lh), dl) +#define lh_ERR_STRING_DATA_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_ERR_STRING_DATA_lh_type(lh), ossl_check_ERR_STRING_DATA_lh_doallfunc_type(dfn)) + +/* clang-format on */ + +/* 12 lines and some on an 80 column terminal */ +#define ERR_MAX_DATA_SIZE 1024 + +/* Building blocks */ +void ERR_new(void); +void ERR_set_debug(const char *file, int line, const char *func); +void ERR_set_error(int lib, int reason, const char *fmt, ...); +void ERR_vset_error(int lib, int reason, const char *fmt, va_list args); + +/* Main error raising functions */ +#define ERR_raise(lib, reason) ERR_raise_data((lib), (reason), NULL) +#define ERR_raise_data \ + (ERR_new(), \ + ERR_set_debug(OPENSSL_FILE, OPENSSL_LINE, OPENSSL_FUNC), \ + ERR_set_error) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* Backward compatibility */ +#define ERR_put_error(lib, func, reason, file, line) \ + (ERR_new(), \ + ERR_set_debug((file), (line), OPENSSL_FUNC), \ + ERR_set_error((lib), (reason), NULL)) +#endif + +void ERR_set_error_data(char *data, int flags); + +unsigned long ERR_get_error(void); +unsigned long ERR_get_error_all(const char **file, int *line, + const char **func, + const char **data, int *flags); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +unsigned long ERR_get_error_line(const char **file, int *line); +OSSL_DEPRECATEDIN_3_0 +unsigned long ERR_get_error_line_data(const char **file, int *line, + const char **data, int *flags); +#endif +unsigned long ERR_peek_error(void); +unsigned long ERR_peek_error_line(const char **file, int *line); +unsigned long ERR_peek_error_func(const char **func); +unsigned long ERR_peek_error_data(const char **data, int *flags); +unsigned long ERR_peek_error_all(const char **file, int *line, + const char **func, + const char **data, int *flags); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +unsigned long ERR_peek_error_line_data(const char **file, int *line, + const char **data, int *flags); +#endif +unsigned long ERR_peek_last_error(void); +unsigned long ERR_peek_last_error_line(const char **file, int *line); +unsigned long ERR_peek_last_error_func(const char **func); +unsigned long ERR_peek_last_error_data(const char **data, int *flags); +unsigned long ERR_peek_last_error_all(const char **file, int *line, + const char **func, + const char **data, int *flags); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +unsigned long ERR_peek_last_error_line_data(const char **file, int *line, + const char **data, int *flags); +#endif + +void ERR_clear_error(void); + +char *ERR_error_string(unsigned long e, char *buf); +void ERR_error_string_n(unsigned long e, char *buf, size_t len); +const char *ERR_lib_error_string(unsigned long e); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 const char *ERR_func_error_string(unsigned long e); +#endif +const char *ERR_reason_error_string(unsigned long e); + +void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), + void *u); +#ifndef OPENSSL_NO_STDIO +void ERR_print_errors_fp(FILE *fp); +#endif +void ERR_print_errors(BIO *bp); + +void ERR_add_error_data(int num, ...); +void ERR_add_error_vdata(int num, va_list args); +void ERR_add_error_txt(const char *sepr, const char *txt); +void ERR_add_error_mem_bio(const char *sep, BIO *bio); + +int ERR_load_strings(int lib, ERR_STRING_DATA *str); +int ERR_load_strings_const(const ERR_STRING_DATA *str); +int ERR_unload_strings(int lib, ERR_STRING_DATA *str); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define ERR_load_crypto_strings() \ + OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) +#define ERR_free_strings() \ + while (0) \ + continue +#endif +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 void ERR_remove_thread_state(void *); +#endif +#ifndef OPENSSL_NO_DEPRECATED_1_0_0 +OSSL_DEPRECATEDIN_1_0_0 void ERR_remove_state(unsigned long pid); +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 ERR_STATE *ERR_get_state(void); +#endif + +int ERR_get_next_error_library(void); + +int ERR_set_mark(void); +int ERR_pop_to_mark(void); +int ERR_clear_last_mark(void); +int ERR_count_to_mark(void); +int ERR_pop(void); + +ERR_STATE *OSSL_ERR_STATE_new(void); +void OSSL_ERR_STATE_save(ERR_STATE *es); +void OSSL_ERR_STATE_save_to_mark(ERR_STATE *es); +void OSSL_ERR_STATE_restore(const ERR_STATE *es); +void OSSL_ERR_STATE_free(ERR_STATE *es); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ess.h b/VCMP-LUA/modules/postgresql/include/openssl/ess.h new file mode 100644 index 0000000..867af25 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ess.h @@ -0,0 +1,131 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\ess.h.in + * + * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_ESS_H +#define OPENSSL_ESS_H +#pragma once + +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL; +typedef struct ESS_cert_id ESS_CERT_ID; +typedef struct ESS_signing_cert ESS_SIGNING_CERT; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ESS_CERT_ID, ESS_CERT_ID, ESS_CERT_ID) +#define sk_ESS_CERT_ID_num(sk) OPENSSL_sk_num(ossl_check_const_ESS_CERT_ID_sk_type(sk)) +#define sk_ESS_CERT_ID_value(sk, idx) ((ESS_CERT_ID *)OPENSSL_sk_value(ossl_check_const_ESS_CERT_ID_sk_type(sk), (idx))) +#define sk_ESS_CERT_ID_new(cmp) ((STACK_OF(ESS_CERT_ID) *)OPENSSL_sk_new(ossl_check_ESS_CERT_ID_compfunc_type(cmp))) +#define sk_ESS_CERT_ID_new_null() ((STACK_OF(ESS_CERT_ID) *)OPENSSL_sk_new_null()) +#define sk_ESS_CERT_ID_new_reserve(cmp, n) ((STACK_OF(ESS_CERT_ID) *)OPENSSL_sk_new_reserve(ossl_check_ESS_CERT_ID_compfunc_type(cmp), (n))) +#define sk_ESS_CERT_ID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ESS_CERT_ID_sk_type(sk), (n)) +#define sk_ESS_CERT_ID_free(sk) OPENSSL_sk_free(ossl_check_ESS_CERT_ID_sk_type(sk)) +#define sk_ESS_CERT_ID_zero(sk) OPENSSL_sk_zero(ossl_check_ESS_CERT_ID_sk_type(sk)) +#define sk_ESS_CERT_ID_delete(sk, i) ((ESS_CERT_ID *)OPENSSL_sk_delete(ossl_check_ESS_CERT_ID_sk_type(sk), (i))) +#define sk_ESS_CERT_ID_delete_ptr(sk, ptr) ((ESS_CERT_ID *)OPENSSL_sk_delete_ptr(ossl_check_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_type(ptr))) +#define sk_ESS_CERT_ID_push(sk, ptr) OPENSSL_sk_push(ossl_check_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_type(ptr)) +#define sk_ESS_CERT_ID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_type(ptr)) +#define sk_ESS_CERT_ID_pop(sk) ((ESS_CERT_ID *)OPENSSL_sk_pop(ossl_check_ESS_CERT_ID_sk_type(sk))) +#define sk_ESS_CERT_ID_shift(sk) ((ESS_CERT_ID *)OPENSSL_sk_shift(ossl_check_ESS_CERT_ID_sk_type(sk))) +#define sk_ESS_CERT_ID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_freefunc_type(freefunc)) +#define sk_ESS_CERT_ID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_type(ptr), (idx)) +#define sk_ESS_CERT_ID_set(sk, idx, ptr) ((ESS_CERT_ID *)OPENSSL_sk_set(ossl_check_ESS_CERT_ID_sk_type(sk), (idx), ossl_check_ESS_CERT_ID_type(ptr))) +#define sk_ESS_CERT_ID_find(sk, ptr) OPENSSL_sk_find(ossl_check_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_type(ptr)) +#define sk_ESS_CERT_ID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_type(ptr)) +#define sk_ESS_CERT_ID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_type(ptr), pnum) +#define sk_ESS_CERT_ID_sort(sk) OPENSSL_sk_sort(ossl_check_ESS_CERT_ID_sk_type(sk)) +#define sk_ESS_CERT_ID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ESS_CERT_ID_sk_type(sk)) +#define sk_ESS_CERT_ID_dup(sk) ((STACK_OF(ESS_CERT_ID) *)OPENSSL_sk_dup(ossl_check_const_ESS_CERT_ID_sk_type(sk))) +#define sk_ESS_CERT_ID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ESS_CERT_ID) *)OPENSSL_sk_deep_copy(ossl_check_const_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_copyfunc_type(copyfunc), ossl_check_ESS_CERT_ID_freefunc_type(freefunc))) +#define sk_ESS_CERT_ID_set_cmp_func(sk, cmp) ((sk_ESS_CERT_ID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ESS_CERT_ID_sk_type(sk), ossl_check_ESS_CERT_ID_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct ESS_signing_cert_v2_st ESS_SIGNING_CERT_V2; +typedef struct ESS_cert_id_v2_st ESS_CERT_ID_V2; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ESS_CERT_ID_V2, ESS_CERT_ID_V2, ESS_CERT_ID_V2) +#define sk_ESS_CERT_ID_V2_num(sk) OPENSSL_sk_num(ossl_check_const_ESS_CERT_ID_V2_sk_type(sk)) +#define sk_ESS_CERT_ID_V2_value(sk, idx) ((ESS_CERT_ID_V2 *)OPENSSL_sk_value(ossl_check_const_ESS_CERT_ID_V2_sk_type(sk), (idx))) +#define sk_ESS_CERT_ID_V2_new(cmp) ((STACK_OF(ESS_CERT_ID_V2) *)OPENSSL_sk_new(ossl_check_ESS_CERT_ID_V2_compfunc_type(cmp))) +#define sk_ESS_CERT_ID_V2_new_null() ((STACK_OF(ESS_CERT_ID_V2) *)OPENSSL_sk_new_null()) +#define sk_ESS_CERT_ID_V2_new_reserve(cmp, n) ((STACK_OF(ESS_CERT_ID_V2) *)OPENSSL_sk_new_reserve(ossl_check_ESS_CERT_ID_V2_compfunc_type(cmp), (n))) +#define sk_ESS_CERT_ID_V2_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ESS_CERT_ID_V2_sk_type(sk), (n)) +#define sk_ESS_CERT_ID_V2_free(sk) OPENSSL_sk_free(ossl_check_ESS_CERT_ID_V2_sk_type(sk)) +#define sk_ESS_CERT_ID_V2_zero(sk) OPENSSL_sk_zero(ossl_check_ESS_CERT_ID_V2_sk_type(sk)) +#define sk_ESS_CERT_ID_V2_delete(sk, i) ((ESS_CERT_ID_V2 *)OPENSSL_sk_delete(ossl_check_ESS_CERT_ID_V2_sk_type(sk), (i))) +#define sk_ESS_CERT_ID_V2_delete_ptr(sk, ptr) ((ESS_CERT_ID_V2 *)OPENSSL_sk_delete_ptr(ossl_check_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_type(ptr))) +#define sk_ESS_CERT_ID_V2_push(sk, ptr) OPENSSL_sk_push(ossl_check_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_type(ptr)) +#define sk_ESS_CERT_ID_V2_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_type(ptr)) +#define sk_ESS_CERT_ID_V2_pop(sk) ((ESS_CERT_ID_V2 *)OPENSSL_sk_pop(ossl_check_ESS_CERT_ID_V2_sk_type(sk))) +#define sk_ESS_CERT_ID_V2_shift(sk) ((ESS_CERT_ID_V2 *)OPENSSL_sk_shift(ossl_check_ESS_CERT_ID_V2_sk_type(sk))) +#define sk_ESS_CERT_ID_V2_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_freefunc_type(freefunc)) +#define sk_ESS_CERT_ID_V2_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_type(ptr), (idx)) +#define sk_ESS_CERT_ID_V2_set(sk, idx, ptr) ((ESS_CERT_ID_V2 *)OPENSSL_sk_set(ossl_check_ESS_CERT_ID_V2_sk_type(sk), (idx), ossl_check_ESS_CERT_ID_V2_type(ptr))) +#define sk_ESS_CERT_ID_V2_find(sk, ptr) OPENSSL_sk_find(ossl_check_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_type(ptr)) +#define sk_ESS_CERT_ID_V2_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_type(ptr)) +#define sk_ESS_CERT_ID_V2_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_type(ptr), pnum) +#define sk_ESS_CERT_ID_V2_sort(sk) OPENSSL_sk_sort(ossl_check_ESS_CERT_ID_V2_sk_type(sk)) +#define sk_ESS_CERT_ID_V2_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ESS_CERT_ID_V2_sk_type(sk)) +#define sk_ESS_CERT_ID_V2_dup(sk) ((STACK_OF(ESS_CERT_ID_V2) *)OPENSSL_sk_dup(ossl_check_const_ESS_CERT_ID_V2_sk_type(sk))) +#define sk_ESS_CERT_ID_V2_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ESS_CERT_ID_V2) *)OPENSSL_sk_deep_copy(ossl_check_const_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_copyfunc_type(copyfunc), ossl_check_ESS_CERT_ID_V2_freefunc_type(freefunc))) +#define sk_ESS_CERT_ID_V2_set_cmp_func(sk, cmp) ((sk_ESS_CERT_ID_V2_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ESS_CERT_ID_V2_sk_type(sk), ossl_check_ESS_CERT_ID_V2_compfunc_type(cmp))) + +/* clang-format on */ + +DECLARE_ASN1_ALLOC_FUNCTIONS(ESS_ISSUER_SERIAL) +DECLARE_ASN1_ENCODE_FUNCTIONS_only(ESS_ISSUER_SERIAL, ESS_ISSUER_SERIAL) +DECLARE_ASN1_DUP_FUNCTION(ESS_ISSUER_SERIAL) + +DECLARE_ASN1_ALLOC_FUNCTIONS(ESS_CERT_ID) +DECLARE_ASN1_ENCODE_FUNCTIONS_only(ESS_CERT_ID, ESS_CERT_ID) +DECLARE_ASN1_DUP_FUNCTION(ESS_CERT_ID) + +DECLARE_ASN1_FUNCTIONS(ESS_SIGNING_CERT) +DECLARE_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT) + +DECLARE_ASN1_ALLOC_FUNCTIONS(ESS_CERT_ID_V2) +DECLARE_ASN1_ENCODE_FUNCTIONS_only(ESS_CERT_ID_V2, ESS_CERT_ID_V2) +DECLARE_ASN1_DUP_FUNCTION(ESS_CERT_ID_V2) + +DECLARE_ASN1_FUNCTIONS(ESS_SIGNING_CERT_V2) +DECLARE_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT_V2) + +ESS_SIGNING_CERT *OSSL_ESS_signing_cert_new_init(const X509 *signcert, + const STACK_OF(X509) *certs, + int set_issuer_serial); +ESS_SIGNING_CERT_V2 *OSSL_ESS_signing_cert_v2_new_init(const EVP_MD *hash_alg, + const X509 *signcert, + const STACK_OF(X509) *certs, + int set_issuer_serial); +int OSSL_ESS_check_signing_certs(const ESS_SIGNING_CERT *ss, + const ESS_SIGNING_CERT_V2 *ssv2, + const STACK_OF(X509) *chain, + int require_signing_cert); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/esserr.h b/VCMP-LUA/modules/postgresql/include/openssl/esserr.h new file mode 100644 index 0000000..4688129 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/esserr.h @@ -0,0 +1,32 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_ESSERR_H +#define OPENSSL_ESSERR_H +#pragma once + +#include +#include +#include + +/* + * ESS reason codes. + */ +#define ESS_R_EMPTY_ESS_CERT_ID_LIST 107 +#define ESS_R_ESS_CERT_DIGEST_ERROR 103 +#define ESS_R_ESS_CERT_ID_NOT_FOUND 104 +#define ESS_R_ESS_CERT_ID_WRONG_ORDER 105 +#define ESS_R_ESS_DIGEST_ALG_UNKNOWN 106 +#define ESS_R_ESS_SIGNING_CERTIFICATE_ERROR 102 +#define ESS_R_ESS_SIGNING_CERT_ADD_ERROR 100 +#define ESS_R_ESS_SIGNING_CERT_V2_ADD_ERROR 101 +#define ESS_R_MISSING_SIGNING_CERTIFICATE_ATTRIBUTE 108 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/evp.h b/VCMP-LUA/modules/postgresql/include/openssl/evp.h new file mode 100644 index 0000000..de6f503 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/evp.h @@ -0,0 +1,2290 @@ +/* + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_EVP_H +#define OPENSSL_EVP_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_ENVELOPE_H +#endif + +#include + +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */ +#define EVP_MAX_KEY_LENGTH 64 +#define EVP_MAX_IV_LENGTH 16 +#define EVP_MAX_BLOCK_LENGTH 32 +#define EVP_MAX_AEAD_TAG_LENGTH 16 + +/* Maximum pipes in cipher pipelining */ +#define EVP_MAX_PIPES 32 + +#define PKCS5_SALT_LEN 8 +/* Default PKCS#5 iteration count */ +#define PKCS5_DEFAULT_ITER 2048 + +#include + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define EVP_PK_RSA 0x0001 +#define EVP_PK_DSA 0x0002 +#define EVP_PK_DH 0x0004 +#define EVP_PK_EC 0x0008 +#define EVP_PKT_SIGN 0x0010 +#define EVP_PKT_ENC 0x0020 +#define EVP_PKT_EXCH 0x0040 +#define EVP_PKS_RSA 0x0100 +#define EVP_PKS_DSA 0x0200 +#define EVP_PKS_EC 0x0400 +#endif + +#define EVP_PKEY_NONE NID_undef +#define EVP_PKEY_RSA NID_rsaEncryption +#define EVP_PKEY_RSA2 NID_rsa +#define EVP_PKEY_RSA_PSS NID_rsassaPss +#define EVP_PKEY_DSA NID_dsa +#define EVP_PKEY_DSA1 NID_dsa_2 +#define EVP_PKEY_DSA2 NID_dsaWithSHA +#define EVP_PKEY_DSA3 NID_dsaWithSHA1 +#define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 +#define EVP_PKEY_DH NID_dhKeyAgreement +#define EVP_PKEY_DHX NID_dhpublicnumber +#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey +#define EVP_PKEY_SM2 NID_sm2 +#define EVP_PKEY_HMAC NID_hmac +#define EVP_PKEY_CMAC NID_cmac +#define EVP_PKEY_SCRYPT NID_id_scrypt +#define EVP_PKEY_TLS1_PRF NID_tls1_prf +#define EVP_PKEY_HKDF NID_hkdf +#define EVP_PKEY_POLY1305 NID_poly1305 +#define EVP_PKEY_SIPHASH NID_siphash +#define EVP_PKEY_X25519 NID_X25519 +#define EVP_PKEY_ED25519 NID_ED25519 +#define EVP_PKEY_X448 NID_X448 +#define EVP_PKEY_ED448 NID_ED448 +#define EVP_PKEY_ML_DSA_44 NID_ML_DSA_44 +#define EVP_PKEY_ML_DSA_65 NID_ML_DSA_65 +#define EVP_PKEY_ML_DSA_87 NID_ML_DSA_87 +#define EVP_PKEY_SLH_DSA_SHA2_128S NID_SLH_DSA_SHA2_128s +#define EVP_PKEY_SLH_DSA_SHA2_128F NID_SLH_DSA_SHA2_128f +#define EVP_PKEY_SLH_DSA_SHA2_192S NID_SLH_DSA_SHA2_192s +#define EVP_PKEY_SLH_DSA_SHA2_192F NID_SLH_DSA_SHA2_192f +#define EVP_PKEY_SLH_DSA_SHA2_256S NID_SLH_DSA_SHA2_256s +#define EVP_PKEY_SLH_DSA_SHA2_256F NID_SLH_DSA_SHA2_256f +#define EVP_PKEY_SLH_DSA_SHAKE_128S NID_SLH_DSA_SHAKE_128s +#define EVP_PKEY_SLH_DSA_SHAKE_128F NID_SLH_DSA_SHAKE_128f +#define EVP_PKEY_SLH_DSA_SHAKE_192S NID_SLH_DSA_SHAKE_192s +#define EVP_PKEY_SLH_DSA_SHAKE_192F NID_SLH_DSA_SHAKE_192f +#define EVP_PKEY_SLH_DSA_SHAKE_256S NID_SLH_DSA_SHAKE_256s +#define EVP_PKEY_SLH_DSA_SHAKE_256F NID_SLH_DSA_SHAKE_256f + +/* Special indicator that the object is uniquely provider side */ +#define EVP_PKEY_KEYMGMT -1 + +/* Easy to use macros for EVP_PKEY related selections */ +#define EVP_PKEY_KEY_PARAMETERS \ + (OSSL_KEYMGMT_SELECT_ALL_PARAMETERS) +#define EVP_PKEY_PRIVATE_KEY \ + (EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PRIVATE_KEY) +#define EVP_PKEY_PUBLIC_KEY \ + (EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY) +#define EVP_PKEY_KEYPAIR \ + (EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY) + +#ifdef __cplusplus +extern "C" { +#endif + +int EVP_set_default_properties(OSSL_LIB_CTX *libctx, const char *propq); +char *EVP_get1_default_properties(OSSL_LIB_CTX *libctx); +int EVP_default_properties_is_fips_enabled(OSSL_LIB_CTX *libctx); +int EVP_default_properties_enable_fips(OSSL_LIB_CTX *libctx, int enable); + +#define EVP_PKEY_MO_SIGN 0x0001 +#define EVP_PKEY_MO_VERIFY 0x0002 +#define EVP_PKEY_MO_ENCRYPT 0x0004 +#define EVP_PKEY_MO_DECRYPT 0x0008 + +#ifndef EVP_MD +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); +OSSL_DEPRECATEDIN_3_0 EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); +OSSL_DEPRECATEDIN_3_0 void EVP_MD_meth_free(EVP_MD *md); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count)); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, unsigned char *md)); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, const EVP_MD_CTX *from)); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); +OSSL_DEPRECATEDIN_3_0 +int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2)); +OSSL_DEPRECATEDIN_3_0 int EVP_MD_meth_get_input_blocksize(const EVP_MD *md); +OSSL_DEPRECATEDIN_3_0 int EVP_MD_meth_get_result_size(const EVP_MD *md); +OSSL_DEPRECATEDIN_3_0 int EVP_MD_meth_get_app_datasize(const EVP_MD *md); +OSSL_DEPRECATEDIN_3_0 unsigned long EVP_MD_meth_get_flags(const EVP_MD *md); +OSSL_DEPRECATEDIN_3_0 +int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 +int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, + const void *data, size_t count); +OSSL_DEPRECATEDIN_3_0 +int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, + unsigned char *md); +OSSL_DEPRECATEDIN_3_0 +int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, + const EVP_MD_CTX *from); +OSSL_DEPRECATEDIN_3_0 +int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 +int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, + int p1, void *p2); +#endif +/* digest can only handle a single block */ +#define EVP_MD_FLAG_ONESHOT 0x0001 + +/* digest is extensible-output function, XOF */ +#define EVP_MD_FLAG_XOF 0x0002 + +/* DigestAlgorithmIdentifier flags... */ + +#define EVP_MD_FLAG_DIGALGID_MASK 0x0018 + +/* NULL or absent parameter accepted. Use NULL */ + +#define EVP_MD_FLAG_DIGALGID_NULL 0x0000 + +/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ + +#define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 + +/* Custom handling via ctrl */ + +#define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 + +/* Note if suitable for use in FIPS mode */ +#define EVP_MD_FLAG_FIPS 0x0400 + +/* Digest ctrls */ + +#define EVP_MD_CTRL_DIGALGID 0x1 +#define EVP_MD_CTRL_MICALG 0x2 +#define EVP_MD_CTRL_XOF_LEN 0x3 +#define EVP_MD_CTRL_TLSTREE 0x4 + +/* Minimum Algorithm specific ctrl value */ + +#define EVP_MD_CTRL_ALG_CTRL 0x1000 + +#endif /* !EVP_MD */ + +/* values for EVP_MD_CTX flags */ + +#define EVP_MD_CTX_FLAG_ONESHOT 0x0001 /* digest update will be \ + * called once only */ +#define EVP_MD_CTX_FLAG_CLEANED 0x0002 /* context has already been \ + * cleaned */ +#define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data \ + * in EVP_MD_CTX_reset */ +/* + * FIPS and pad options are ignored in 1.0.0, definitions are here so we + * don't accidentally reuse the values for other purposes. + */ + +/* This flag has no effect from openssl-3.0 onwards */ +#define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008 + +/* + * The following PAD options are also currently ignored in 1.0.0, digest + * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() + * instead. + */ +#define EVP_MD_CTX_FLAG_PAD_MASK 0xF0 /* RSA mode to use */ +#define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00 /* PKCS#1 v1.5 mode */ +#define EVP_MD_CTX_FLAG_PAD_X931 0x10 /* X9.31 mode */ +#define EVP_MD_CTX_FLAG_PAD_PSS 0x20 /* PSS mode */ + +#define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ +/* + * Some functions such as EVP_DigestSign only finalise copies of internal + * contexts so additional data can be included after the finalisation call. + * This is inefficient if this functionality is not required: it is disabled + * if the following flag is set. + */ +#define EVP_MD_CTX_FLAG_FINALISE 0x0200 +/* NOTE: 0x0400 and 0x0800 are reserved for internal usage */ + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); +OSSL_DEPRECATEDIN_3_0 +EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); +OSSL_DEPRECATEDIN_3_0 +void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, + int (*init)(EVP_CIPHER_CTX *ctx, + const unsigned char *key, + const unsigned char *iv, + int enc)); +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, + int (*do_cipher)(EVP_CIPHER_CTX *ctx, + unsigned char *out, + const unsigned char *in, + size_t inl)); +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, + int (*cleanup)(EVP_CIPHER_CTX *)); +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, + int (*set_asn1_parameters)(EVP_CIPHER_CTX *, + ASN1_TYPE *)); +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, + int (*get_asn1_parameters)(EVP_CIPHER_CTX *, + ASN1_TYPE *)); +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, + int (*ctrl)(EVP_CIPHER_CTX *, int type, + int arg, void *ptr)); +OSSL_DEPRECATEDIN_3_0 int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, + const unsigned char *key, + const unsigned char *iv, + int enc); +OSSL_DEPRECATEDIN_3_0 int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, + unsigned char *out, + const unsigned char *in, + size_t inl); +OSSL_DEPRECATEDIN_3_0 int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); +OSSL_DEPRECATEDIN_3_0 int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + ASN1_TYPE *); +OSSL_DEPRECATEDIN_3_0 int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + ASN1_TYPE *); +OSSL_DEPRECATEDIN_3_0 int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, int type, + int arg, void *ptr); +#endif + +/* Values for cipher flags */ + +/* Modes for ciphers */ + +#define EVP_CIPH_STREAM_CIPHER 0x0 +#define EVP_CIPH_ECB_MODE 0x1 +#define EVP_CIPH_CBC_MODE 0x2 +#define EVP_CIPH_CFB_MODE 0x3 +#define EVP_CIPH_OFB_MODE 0x4 +#define EVP_CIPH_CTR_MODE 0x5 +#define EVP_CIPH_GCM_MODE 0x6 +#define EVP_CIPH_CCM_MODE 0x7 +#define EVP_CIPH_XTS_MODE 0x10001 +#define EVP_CIPH_WRAP_MODE 0x10002 +#define EVP_CIPH_OCB_MODE 0x10003 +#define EVP_CIPH_SIV_MODE 0x10004 +#define EVP_CIPH_GCM_SIV_MODE 0x10005 +#define EVP_CIPH_MODE 0xF0007 +/* Set if variable length cipher */ +#define EVP_CIPH_VARIABLE_LENGTH 0x8 +/* Set if the iv handling should be done by the cipher itself */ +#define EVP_CIPH_CUSTOM_IV 0x10 +/* Set if the cipher's init() function should be called if key is NULL */ +#define EVP_CIPH_ALWAYS_CALL_INIT 0x20 +/* Call ctrl() to init cipher parameters */ +#define EVP_CIPH_CTRL_INIT 0x40 +/* Don't use standard key length function */ +#define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 +/* Don't use standard block padding */ +#define EVP_CIPH_NO_PADDING 0x100 +/* cipher handles random key generation */ +#define EVP_CIPH_RAND_KEY 0x200 +/* cipher has its own additional copying logic */ +#define EVP_CIPH_CUSTOM_COPY 0x400 +/* Don't use standard iv length function */ +#define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 +/* Legacy and no longer relevant: Allow use default ASN1 get/set iv */ +#define EVP_CIPH_FLAG_DEFAULT_ASN1 0 +/* Free: 0x1000 */ +/* Buffer length in bits not bytes: CFB1 mode only */ +#define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 +/* Deprecated FIPS flag: was 0x4000 */ +#define EVP_CIPH_FLAG_FIPS 0 +/* Deprecated FIPS flag: was 0x8000 */ +#define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0 + +/* + * Cipher handles any and all padding logic as well as finalisation. + */ +#define EVP_CIPH_FLAG_CTS 0x4000 +#define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 +#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 +#define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 +/* Cipher can handle pipeline operations */ +#define EVP_CIPH_FLAG_PIPELINE 0X800000 +/* For provider implementations that handle ASN1 get/set param themselves */ +#define EVP_CIPH_FLAG_CUSTOM_ASN1 0x1000000 +/* For ciphers generating unprotected CMS attributes */ +#define EVP_CIPH_FLAG_CIPHER_WITH_MAC 0x2000000 +/* For supplementary wrap cipher support */ +#define EVP_CIPH_FLAG_GET_WRAP_CIPHER 0x4000000 +#define EVP_CIPH_FLAG_INVERSE_CIPHER 0x8000000 +#define EVP_CIPH_FLAG_ENC_THEN_MAC 0x10000000 + +/* + * Cipher context flag to indicate we can handle wrap mode: if allowed in + * older applications it could overflow buffers. + */ + +#define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 + +/* ctrl() values */ + +#define EVP_CTRL_INIT 0x0 +#define EVP_CTRL_SET_KEY_LENGTH 0x1 +#define EVP_CTRL_GET_RC2_KEY_BITS 0x2 +#define EVP_CTRL_SET_RC2_KEY_BITS 0x3 +#define EVP_CTRL_GET_RC5_ROUNDS 0x4 +#define EVP_CTRL_SET_RC5_ROUNDS 0x5 +#define EVP_CTRL_RAND_KEY 0x6 +#define EVP_CTRL_PBE_PRF_NID 0x7 +#define EVP_CTRL_COPY 0x8 +#define EVP_CTRL_AEAD_SET_IVLEN 0x9 +#define EVP_CTRL_AEAD_GET_TAG 0x10 +#define EVP_CTRL_AEAD_SET_TAG 0x11 +#define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 +#define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN +#define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG +#define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG +#define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED +#define EVP_CTRL_GCM_IV_GEN 0x13 +#define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN +#define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG +#define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG +#define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED +#define EVP_CTRL_CCM_SET_L 0x14 +#define EVP_CTRL_CCM_SET_MSGLEN 0x15 +/* + * AEAD cipher deduces payload length and returns number of bytes required to + * store MAC and eventual padding. Subsequent call to EVP_Cipher even + * appends/verifies MAC. + */ +#define EVP_CTRL_AEAD_TLS1_AAD 0x16 +/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ +#define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 +/* Set the GCM invocation field, decrypt only */ +#define EVP_CTRL_GCM_SET_IV_INV 0x18 + +#define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 +#define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a +#define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b +#define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c + +#define EVP_CTRL_SSL3_MASTER_SECRET 0x1d + +/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ +#define EVP_CTRL_SET_SBOX 0x1e +/* + * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a + * pre-allocated buffer with specified size + */ +#define EVP_CTRL_SBOX_USED 0x1f +/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, + * 0 switches meshing off + */ +#define EVP_CTRL_KEY_MESH 0x20 +/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ +#define EVP_CTRL_BLOCK_PADDING_MODE 0x21 + +/* Set the output buffers to use for a pipelined operation */ +#define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 +/* Set the input buffers to use for a pipelined operation */ +#define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 +/* Set the input buffer lengths to use for a pipelined operation */ +#define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 +/* Get the IV length used by the cipher */ +#define EVP_CTRL_GET_IVLEN 0x25 +/* 0x26 is unused */ +/* Tell the cipher it's doing a speed test (SIV disallows multiple ops) */ +#define EVP_CTRL_SET_SPEED 0x27 +/* Get the unprotectedAttrs from cipher ctx */ +#define EVP_CTRL_PROCESS_UNPROTECTED 0x28 +/* Get the supplementary wrap cipher */ +#define EVP_CTRL_GET_WRAP_CIPHER 0x29 +/* TLSTREE key diversification */ +#define EVP_CTRL_TLSTREE 0x2A + +/* Padding modes */ +#define EVP_PADDING_PKCS7 1 +#define EVP_PADDING_ISO7816_4 2 +#define EVP_PADDING_ANSI923 3 +#define EVP_PADDING_ISO10126 4 +#define EVP_PADDING_ZERO 5 + +/* RFC 5246 defines additional data to be 13 bytes in length */ +#define EVP_AEAD_TLS1_AAD_LEN 13 + +typedef struct { + unsigned char *out; + const unsigned char *inp; + size_t len; + unsigned int interleave; +} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; + +/* GCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +#define EVP_GCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +#define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 +/* Length of tag for TLS */ +#define EVP_GCM_TLS_TAG_LEN 16 + +/* CCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +#define EVP_CCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +#define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 +/* Total length of CCM IV length for TLS */ +#define EVP_CCM_TLS_IV_LEN 12 +/* Length of tag for TLS */ +#define EVP_CCM_TLS_TAG_LEN 16 +/* Length of CCM8 tag for TLS */ +#define EVP_CCM8_TLS_TAG_LEN 8 + +/* Length of tag for TLS */ +#define EVP_CHACHAPOLY_TLS_TAG_LEN 16 + +typedef struct evp_cipher_info_st { + const EVP_CIPHER *cipher; + unsigned char iv[EVP_MAX_IV_LENGTH]; +} EVP_CIPHER_INFO; + +/* Password based encryption function */ +typedef int(EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *cipher, const EVP_MD *md, + int en_de); + +typedef int(EVP_PBE_KEYGEN_EX)(EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *cipher, const EVP_MD *md, + int en_de, OSSL_LIB_CTX *libctx, const char *propq); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define EVP_PKEY_assign_RSA(pkey, rsa) EVP_PKEY_assign((pkey), EVP_PKEY_RSA, \ + (rsa)) +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_6 +#ifndef OPENSSL_NO_DSA +#define EVP_PKEY_assign_DSA(pkey, dsa) EVP_PKEY_assign((pkey), EVP_PKEY_DSA, \ + (dsa)) +#endif +#endif + +#if !defined(OPENSSL_NO_DH) && !defined(OPENSSL_NO_DEPRECATED_3_0) +#define EVP_PKEY_assign_DH(pkey, dh) EVP_PKEY_assign((pkey), EVP_PKEY_DH, (dh)) +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_EC +#define EVP_PKEY_assign_EC_KEY(pkey, eckey) EVP_PKEY_assign((pkey), \ + EVP_PKEY_EC, \ + (eckey)) +#endif +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_6 +#ifndef OPENSSL_NO_SIPHASH +#define EVP_PKEY_assign_SIPHASH(pkey, shkey) EVP_PKEY_assign((pkey), \ + EVP_PKEY_SIPHASH, \ + (shkey)) +#endif + +#ifndef OPENSSL_NO_POLY1305 +#define EVP_PKEY_assign_POLY1305(pkey, polykey) EVP_PKEY_assign((pkey), \ + EVP_PKEY_POLY1305, \ + (polykey)) +#endif +#endif + +/* Add some extra combinations */ +#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) +#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) +#define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) +#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) + +int EVP_MD_get_type(const EVP_MD *md); +#define EVP_MD_type EVP_MD_get_type +#define EVP_MD_nid EVP_MD_get_type +const char *EVP_MD_get0_name(const EVP_MD *md); +#define EVP_MD_name EVP_MD_get0_name +const char *EVP_MD_get0_description(const EVP_MD *md); +int EVP_MD_is_a(const EVP_MD *md, const char *name); +int EVP_MD_names_do_all(const EVP_MD *md, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PROVIDER *EVP_MD_get0_provider(const EVP_MD *md); +int EVP_MD_get_pkey_type(const EVP_MD *md); +#define EVP_MD_pkey_type EVP_MD_get_pkey_type +int EVP_MD_get_size(const EVP_MD *md); +#define EVP_MD_size EVP_MD_get_size +int EVP_MD_get_block_size(const EVP_MD *md); +#define EVP_MD_block_size EVP_MD_get_block_size +unsigned long EVP_MD_get_flags(const EVP_MD *md); +#define EVP_MD_flags EVP_MD_get_flags +int EVP_MD_xof(const EVP_MD *md); + +const EVP_MD *EVP_MD_CTX_get0_md(const EVP_MD_CTX *ctx); +EVP_MD *EVP_MD_CTX_get1_md(EVP_MD_CTX *ctx); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 +int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, + const void *data, size_t count); +OSSL_DEPRECATEDIN_3_0 +void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, + int (*update)(EVP_MD_CTX *ctx, + const void *data, size_t count)); +#endif +int EVP_MD_CTX_get_size_ex(const EVP_MD_CTX *ctx); + +#define EVP_MD_CTX_get0_name(e) EVP_MD_get0_name(EVP_MD_CTX_get0_md(e)) +#define EVP_MD_CTX_get_size(e) EVP_MD_CTX_get_size_ex(e) +#define EVP_MD_CTX_size EVP_MD_CTX_get_size_ex +#define EVP_MD_CTX_get_block_size(e) EVP_MD_get_block_size(EVP_MD_CTX_get0_md(e)) +#define EVP_MD_CTX_block_size EVP_MD_CTX_get_block_size +#define EVP_MD_CTX_get_type(e) EVP_MD_get_type(EVP_MD_CTX_get0_md(e)) +#define EVP_MD_CTX_type EVP_MD_CTX_get_type +EVP_PKEY_CTX *EVP_MD_CTX_get_pkey_ctx(const EVP_MD_CTX *ctx); +#define EVP_MD_CTX_pkey_ctx EVP_MD_CTX_get_pkey_ctx +void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); +void *EVP_MD_CTX_get0_md_data(const EVP_MD_CTX *ctx); +#define EVP_MD_CTX_md_data EVP_MD_CTX_get0_md_data + +int EVP_CIPHER_get_nid(const EVP_CIPHER *cipher); +#define EVP_CIPHER_nid EVP_CIPHER_get_nid +const char *EVP_CIPHER_get0_name(const EVP_CIPHER *cipher); +#define EVP_CIPHER_name EVP_CIPHER_get0_name +const char *EVP_CIPHER_get0_description(const EVP_CIPHER *cipher); +int EVP_CIPHER_is_a(const EVP_CIPHER *cipher, const char *name); +int EVP_CIPHER_names_do_all(const EVP_CIPHER *cipher, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PROVIDER *EVP_CIPHER_get0_provider(const EVP_CIPHER *cipher); +int EVP_CIPHER_get_block_size(const EVP_CIPHER *cipher); +#define EVP_CIPHER_block_size EVP_CIPHER_get_block_size +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); +#endif +int EVP_CIPHER_get_key_length(const EVP_CIPHER *cipher); +#define EVP_CIPHER_key_length EVP_CIPHER_get_key_length +int EVP_CIPHER_get_iv_length(const EVP_CIPHER *cipher); +#define EVP_CIPHER_iv_length EVP_CIPHER_get_iv_length +unsigned long EVP_CIPHER_get_flags(const EVP_CIPHER *cipher); +#define EVP_CIPHER_flags EVP_CIPHER_get_flags +int EVP_CIPHER_get_mode(const EVP_CIPHER *cipher); +#define EVP_CIPHER_mode EVP_CIPHER_get_mode +int EVP_CIPHER_get_type(const EVP_CIPHER *cipher); +#define EVP_CIPHER_type EVP_CIPHER_get_type +EVP_CIPHER *EVP_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, + const char *properties); +int EVP_CIPHER_can_pipeline(const EVP_CIPHER *cipher, int enc); +int EVP_CIPHER_up_ref(EVP_CIPHER *cipher); +void EVP_CIPHER_free(EVP_CIPHER *cipher); + +const EVP_CIPHER *EVP_CIPHER_CTX_get0_cipher(const EVP_CIPHER_CTX *ctx); +EVP_CIPHER *EVP_CIPHER_CTX_get1_cipher(EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_is_encrypting(const EVP_CIPHER_CTX *ctx); +#define EVP_CIPHER_CTX_encrypting EVP_CIPHER_CTX_is_encrypting +int EVP_CIPHER_CTX_get_nid(const EVP_CIPHER_CTX *ctx); +#define EVP_CIPHER_CTX_nid EVP_CIPHER_CTX_get_nid +int EVP_CIPHER_CTX_get_block_size(const EVP_CIPHER_CTX *ctx); +#define EVP_CIPHER_CTX_block_size EVP_CIPHER_CTX_get_block_size +int EVP_CIPHER_CTX_get_key_length(const EVP_CIPHER_CTX *ctx); +#define EVP_CIPHER_CTX_key_length EVP_CIPHER_CTX_get_key_length +int EVP_CIPHER_CTX_get_iv_length(const EVP_CIPHER_CTX *ctx); +#define EVP_CIPHER_CTX_iv_length EVP_CIPHER_CTX_get_iv_length +int EVP_CIPHER_CTX_get_tag_length(const EVP_CIPHER_CTX *ctx); +#define EVP_CIPHER_CTX_tag_length EVP_CIPHER_CTX_get_tag_length +#ifndef OPENSSL_NO_DEPRECATED_3_0 +const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); +#endif +int EVP_CIPHER_CTX_get_updated_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len); +int EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); +#endif +int EVP_CIPHER_CTX_get_num(const EVP_CIPHER_CTX *ctx); +#define EVP_CIPHER_CTX_num EVP_CIPHER_CTX_get_num +int EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); +EVP_CIPHER_CTX *EVP_CIPHER_CTX_dup(const EVP_CIPHER_CTX *in); +int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); +void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); +void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); +void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); +void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); +#define EVP_CIPHER_CTX_get0_name(c) EVP_CIPHER_get0_name(EVP_CIPHER_CTX_get0_cipher(c)) +#define EVP_CIPHER_CTX_get_type(c) EVP_CIPHER_get_type(EVP_CIPHER_CTX_get0_cipher(c)) +#define EVP_CIPHER_CTX_type EVP_CIPHER_CTX_get_type +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(c)) +#endif +#define EVP_CIPHER_CTX_get_mode(c) EVP_CIPHER_get_mode(EVP_CIPHER_CTX_get0_cipher(c)) +#define EVP_CIPHER_CTX_mode EVP_CIPHER_CTX_get_mode + +#define EVP_ENCODE_LENGTH(l) ((((l) + 2) / 3 * 4) + ((l) / 48 + 1) * 2 + 80) +#define EVP_DECODE_LENGTH(l) (((l) + 3) / 4 * 3 + 80) + +#define EVP_SignInit_ex(a, b, c) EVP_DigestInit_ex(a, b, c) +#define EVP_SignInit(a, b) EVP_DigestInit(a, b) +#define EVP_SignUpdate(a, b, c) EVP_DigestUpdate(a, b, c) +#define EVP_VerifyInit_ex(a, b, c) EVP_DigestInit_ex(a, b, c) +#define EVP_VerifyInit(a, b) EVP_DigestInit(a, b) +#define EVP_VerifyUpdate(a, b, c) EVP_DigestUpdate(a, b, c) +#define EVP_OpenUpdate(a, b, c, d, e) EVP_DecryptUpdate(a, b, c, d, e) +#define EVP_SealUpdate(a, b, c, d, e) EVP_EncryptUpdate(a, b, c, d, e) + +#ifdef CONST_STRICT +void BIO_set_md(BIO *, const EVP_MD *md); +#else +#define BIO_set_md(b, md) BIO_ctrl(b, BIO_C_SET_MD, 0, (void *)(md)) +#endif +#define BIO_get_md(b, mdp) BIO_ctrl(b, BIO_C_GET_MD, 0, (mdp)) +#define BIO_get_md_ctx(b, mdcp) BIO_ctrl(b, BIO_C_GET_MD_CTX, 0, (mdcp)) +#define BIO_set_md_ctx(b, mdcp) BIO_ctrl(b, BIO_C_SET_MD_CTX, 0, (mdcp)) +#define BIO_get_cipher_status(b) BIO_ctrl(b, BIO_C_GET_CIPHER_STATUS, 0, NULL) +#define BIO_get_cipher_ctx(b, c_pp) BIO_ctrl(b, BIO_C_GET_CIPHER_CTX, 0, (c_pp)) + +__owur int EVP_Cipher(EVP_CIPHER_CTX *c, + unsigned char *out, + const unsigned char *in, unsigned int inl); + +#define EVP_add_cipher_alias(n, alias) \ + OBJ_NAME_add((alias), OBJ_NAME_TYPE_CIPHER_METH | OBJ_NAME_ALIAS, (n)) +#define EVP_add_digest_alias(n, alias) \ + OBJ_NAME_add((alias), OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, (n)) +#define EVP_delete_cipher_alias(alias) \ + OBJ_NAME_remove(alias, OBJ_NAME_TYPE_CIPHER_METH | OBJ_NAME_ALIAS); +#define EVP_delete_digest_alias(alias) \ + OBJ_NAME_remove(alias, OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS); + +int EVP_MD_get_params(const EVP_MD *digest, OSSL_PARAM params[]); +int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]); +int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]); +const OSSL_PARAM *EVP_MD_gettable_params(const EVP_MD *digest); +const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md); +const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md); +const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx); +const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx); +int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); +EVP_MD_CTX *EVP_MD_CTX_new(void); +int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); +void EVP_MD_CTX_free(EVP_MD_CTX *ctx); +#define EVP_MD_CTX_create() EVP_MD_CTX_new() +#define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) +#define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) +__owur EVP_MD_CTX *EVP_MD_CTX_dup(const EVP_MD_CTX *in); +__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); +void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); +void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); +int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); +__owur int EVP_DigestInit_ex2(EVP_MD_CTX *ctx, const EVP_MD *type, + const OSSL_PARAM params[]); +__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, + ENGINE *impl); +__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, + size_t cnt); +__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, + unsigned int *s); +__owur int EVP_Digest(const void *data, size_t count, + unsigned char *md, unsigned int *size, + const EVP_MD *type, ENGINE *impl); +__owur int EVP_Q_digest(OSSL_LIB_CTX *libctx, const char *name, + const char *propq, const void *data, size_t datalen, + unsigned char *md, size_t *mdlen); + +__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); +__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); +__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, + unsigned int *s); +__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *out, + size_t outlen); +__owur int EVP_DigestSqueeze(EVP_MD_CTX *ctx, unsigned char *out, + size_t outlen); + +__owur EVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, + const char *properties); + +int EVP_MD_up_ref(EVP_MD *md); +void EVP_MD_free(EVP_MD *md); + +int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); +int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, + const char *prompt, int verify); +void EVP_set_pw_prompt(const char *prompt); +char *EVP_get_pw_prompt(void); + +__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, + const unsigned char *salt, + const unsigned char *data, int datal, int count, + unsigned char *key, unsigned char *iv); + +void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); +void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); +int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); + +__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +__owur int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv); +__owur int EVP_EncryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, + const unsigned char *iv, + const OSSL_PARAM params[]); +__owur int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +__owur int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); +__owur int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); + +__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +__owur int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv); +__owur int EVP_DecryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, + const unsigned char *iv, + const OSSL_PARAM params[]); +__owur int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); +__owur int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); + +__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv, + int enc); +__owur int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv, int enc); +__owur int EVP_CipherInit_SKEY(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + EVP_SKEY *skey, const unsigned char *iv, size_t iv_len, + int enc, const OSSL_PARAM params[]); +__owur int EVP_CipherInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv, + int enc, const OSSL_PARAM params[]); +__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); +__owur int EVP_CipherPipelineEncryptInit(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, + const unsigned char *key, size_t keylen, + size_t numpipes, + const unsigned char **iv, size_t ivlen); +__owur int EVP_CipherPipelineDecryptInit(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, + const unsigned char *key, size_t keylen, + size_t numpipes, + const unsigned char **iv, size_t ivlen); +__owur int EVP_CipherPipelineUpdate(EVP_CIPHER_CTX *ctx, + unsigned char **out, size_t *outl, + const size_t *outsize, + const unsigned char **in, const size_t *inl); +__owur int EVP_CipherPipelineFinal(EVP_CIPHER_CTX *ctx, + unsigned char **outm, size_t *outl, + const size_t *outsize); +__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); + +__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, + EVP_PKEY *pkey); +__owur int EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, + EVP_PKEY *pkey, OSSL_LIB_CTX *libctx, + const char *propq); + +__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, + size_t *siglen, const unsigned char *tbs, + size_t tbslen); + +__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, + unsigned int siglen, EVP_PKEY *pkey); +__owur int EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf, + unsigned int siglen, EVP_PKEY *pkey, + OSSL_LIB_CTX *libctx, const char *propq); + +__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, + size_t siglen, const unsigned char *tbs, + size_t tbslen); + +__owur int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const char *mdname, OSSL_LIB_CTX *libctx, + const char *props, EVP_PKEY *pkey, + const OSSL_PARAM params[]); +__owur int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); +__owur int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize); +__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + size_t *siglen); + +__owur int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const char *mdname, OSSL_LIB_CTX *libctx, + const char *props, EVP_PKEY *pkey, + const OSSL_PARAM params[]); +__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); +int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize); +__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, + size_t siglen); + +__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + const unsigned char *ek, int ekl, + const unsigned char *iv, EVP_PKEY *priv); +__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); + +__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + unsigned char **ek, int *ekl, unsigned char *iv, + EVP_PKEY **pubk, int npubk); +__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); + +EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); +void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); +int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, const EVP_ENCODE_CTX *sctx); +int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); +void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); +int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); +void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); +int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); + +void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); +int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); +int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); +int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) +#define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) +#endif +EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); +int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); +void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); +int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); +int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); +int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); +int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); +int EVP_CIPHER_get_params(EVP_CIPHER *cipher, OSSL_PARAM params[]); +int EVP_CIPHER_CTX_set_params(EVP_CIPHER_CTX *ctx, const OSSL_PARAM params[]); +int EVP_CIPHER_CTX_get_params(EVP_CIPHER_CTX *ctx, OSSL_PARAM params[]); +const OSSL_PARAM *EVP_CIPHER_gettable_params(const EVP_CIPHER *cipher); +const OSSL_PARAM *EVP_CIPHER_settable_ctx_params(const EVP_CIPHER *cipher); +const OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher); +const OSSL_PARAM *EVP_CIPHER_CTX_settable_params(EVP_CIPHER_CTX *ctx); +const OSSL_PARAM *EVP_CIPHER_CTX_gettable_params(EVP_CIPHER_CTX *ctx); + +int EVP_CIPHER_CTX_set_algor_params(EVP_CIPHER_CTX *ctx, const X509_ALGOR *alg); +int EVP_CIPHER_CTX_get_algor_params(EVP_CIPHER_CTX *ctx, X509_ALGOR *alg); +int EVP_CIPHER_CTX_get_algor(EVP_CIPHER_CTX *ctx, X509_ALGOR **alg); + +const BIO_METHOD *BIO_f_md(void); +const BIO_METHOD *BIO_f_base64(void); +const BIO_METHOD *BIO_f_cipher(void); +const BIO_METHOD *BIO_f_reliable(void); +__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, + const unsigned char *i, int enc); + +const EVP_MD *EVP_md_null(void); +#ifndef OPENSSL_NO_MD2 +const EVP_MD *EVP_md2(void); +#endif +#ifndef OPENSSL_NO_MD4 +const EVP_MD *EVP_md4(void); +#endif +#ifndef OPENSSL_NO_MD5 +const EVP_MD *EVP_md5(void); +const EVP_MD *EVP_md5_sha1(void); +#endif +#ifndef OPENSSL_NO_BLAKE2 +const EVP_MD *EVP_blake2b512(void); +const EVP_MD *EVP_blake2s256(void); +#endif +const EVP_MD *EVP_sha1(void); +const EVP_MD *EVP_sha224(void); +const EVP_MD *EVP_sha256(void); +const EVP_MD *EVP_sha384(void); +const EVP_MD *EVP_sha512(void); +const EVP_MD *EVP_sha512_224(void); +const EVP_MD *EVP_sha512_256(void); +const EVP_MD *EVP_sha3_224(void); +const EVP_MD *EVP_sha3_256(void); +const EVP_MD *EVP_sha3_384(void); +const EVP_MD *EVP_sha3_512(void); +const EVP_MD *EVP_shake128(void); +const EVP_MD *EVP_shake256(void); + +#ifndef OPENSSL_NO_MDC2 +const EVP_MD *EVP_mdc2(void); +#endif +#ifndef OPENSSL_NO_RMD160 +const EVP_MD *EVP_ripemd160(void); +#endif +#ifndef OPENSSL_NO_WHIRLPOOL +const EVP_MD *EVP_whirlpool(void); +#endif +#ifndef OPENSSL_NO_SM3 +const EVP_MD *EVP_sm3(void); +#endif +const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ +#ifndef OPENSSL_NO_DES +const EVP_CIPHER *EVP_des_ecb(void); +const EVP_CIPHER *EVP_des_ede(void); +const EVP_CIPHER *EVP_des_ede3(void); +const EVP_CIPHER *EVP_des_ede_ecb(void); +const EVP_CIPHER *EVP_des_ede3_ecb(void); +const EVP_CIPHER *EVP_des_cfb64(void); +#define EVP_des_cfb EVP_des_cfb64 +const EVP_CIPHER *EVP_des_cfb1(void); +const EVP_CIPHER *EVP_des_cfb8(void); +const EVP_CIPHER *EVP_des_ede_cfb64(void); +#define EVP_des_ede_cfb EVP_des_ede_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb64(void); +#define EVP_des_ede3_cfb EVP_des_ede3_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb1(void); +const EVP_CIPHER *EVP_des_ede3_cfb8(void); +const EVP_CIPHER *EVP_des_ofb(void); +const EVP_CIPHER *EVP_des_ede_ofb(void); +const EVP_CIPHER *EVP_des_ede3_ofb(void); +const EVP_CIPHER *EVP_des_cbc(void); +const EVP_CIPHER *EVP_des_ede_cbc(void); +const EVP_CIPHER *EVP_des_ede3_cbc(void); +const EVP_CIPHER *EVP_desx_cbc(void); +const EVP_CIPHER *EVP_des_ede3_wrap(void); +/* + * This should now be supported through the dev_crypto ENGINE. But also, why + * are rc4 and md5 declarations made here inside a "NO_DES" precompiler + * branch? + */ +#endif +#ifndef OPENSSL_NO_RC4 +const EVP_CIPHER *EVP_rc4(void); +const EVP_CIPHER *EVP_rc4_40(void); +#ifndef OPENSSL_NO_MD5 +const EVP_CIPHER *EVP_rc4_hmac_md5(void); +#endif +#endif +#ifndef OPENSSL_NO_IDEA +const EVP_CIPHER *EVP_idea_ecb(void); +const EVP_CIPHER *EVP_idea_cfb64(void); +#define EVP_idea_cfb EVP_idea_cfb64 +const EVP_CIPHER *EVP_idea_ofb(void); +const EVP_CIPHER *EVP_idea_cbc(void); +#endif +#ifndef OPENSSL_NO_RC2 +const EVP_CIPHER *EVP_rc2_ecb(void); +const EVP_CIPHER *EVP_rc2_cbc(void); +const EVP_CIPHER *EVP_rc2_40_cbc(void); +const EVP_CIPHER *EVP_rc2_64_cbc(void); +const EVP_CIPHER *EVP_rc2_cfb64(void); +#define EVP_rc2_cfb EVP_rc2_cfb64 +const EVP_CIPHER *EVP_rc2_ofb(void); +#endif +#ifndef OPENSSL_NO_BF +const EVP_CIPHER *EVP_bf_ecb(void); +const EVP_CIPHER *EVP_bf_cbc(void); +const EVP_CIPHER *EVP_bf_cfb64(void); +#define EVP_bf_cfb EVP_bf_cfb64 +const EVP_CIPHER *EVP_bf_ofb(void); +#endif +#ifndef OPENSSL_NO_CAST +const EVP_CIPHER *EVP_cast5_ecb(void); +const EVP_CIPHER *EVP_cast5_cbc(void); +const EVP_CIPHER *EVP_cast5_cfb64(void); +#define EVP_cast5_cfb EVP_cast5_cfb64 +const EVP_CIPHER *EVP_cast5_ofb(void); +#endif +#ifndef OPENSSL_NO_RC5 +const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); +const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); +const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); +#define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 +const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); +#endif +const EVP_CIPHER *EVP_aes_128_ecb(void); +const EVP_CIPHER *EVP_aes_128_cbc(void); +const EVP_CIPHER *EVP_aes_128_cfb1(void); +const EVP_CIPHER *EVP_aes_128_cfb8(void); +const EVP_CIPHER *EVP_aes_128_cfb128(void); +#define EVP_aes_128_cfb EVP_aes_128_cfb128 +const EVP_CIPHER *EVP_aes_128_ofb(void); +const EVP_CIPHER *EVP_aes_128_ctr(void); +const EVP_CIPHER *EVP_aes_128_ccm(void); +const EVP_CIPHER *EVP_aes_128_gcm(void); +const EVP_CIPHER *EVP_aes_128_xts(void); +const EVP_CIPHER *EVP_aes_128_wrap(void); +const EVP_CIPHER *EVP_aes_128_wrap_pad(void); +#ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_128_ocb(void); +#endif +const EVP_CIPHER *EVP_aes_192_ecb(void); +const EVP_CIPHER *EVP_aes_192_cbc(void); +const EVP_CIPHER *EVP_aes_192_cfb1(void); +const EVP_CIPHER *EVP_aes_192_cfb8(void); +const EVP_CIPHER *EVP_aes_192_cfb128(void); +#define EVP_aes_192_cfb EVP_aes_192_cfb128 +const EVP_CIPHER *EVP_aes_192_ofb(void); +const EVP_CIPHER *EVP_aes_192_ctr(void); +const EVP_CIPHER *EVP_aes_192_ccm(void); +const EVP_CIPHER *EVP_aes_192_gcm(void); +const EVP_CIPHER *EVP_aes_192_wrap(void); +const EVP_CIPHER *EVP_aes_192_wrap_pad(void); +#ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_192_ocb(void); +#endif +const EVP_CIPHER *EVP_aes_256_ecb(void); +const EVP_CIPHER *EVP_aes_256_cbc(void); +const EVP_CIPHER *EVP_aes_256_cfb1(void); +const EVP_CIPHER *EVP_aes_256_cfb8(void); +const EVP_CIPHER *EVP_aes_256_cfb128(void); +#define EVP_aes_256_cfb EVP_aes_256_cfb128 +const EVP_CIPHER *EVP_aes_256_ofb(void); +const EVP_CIPHER *EVP_aes_256_ctr(void); +const EVP_CIPHER *EVP_aes_256_ccm(void); +const EVP_CIPHER *EVP_aes_256_gcm(void); +const EVP_CIPHER *EVP_aes_256_xts(void); +const EVP_CIPHER *EVP_aes_256_wrap(void); +const EVP_CIPHER *EVP_aes_256_wrap_pad(void); +#ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_256_ocb(void); +#endif +const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); +const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); +const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); +const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); +#ifndef OPENSSL_NO_ARIA +const EVP_CIPHER *EVP_aria_128_ecb(void); +const EVP_CIPHER *EVP_aria_128_cbc(void); +const EVP_CIPHER *EVP_aria_128_cfb1(void); +const EVP_CIPHER *EVP_aria_128_cfb8(void); +const EVP_CIPHER *EVP_aria_128_cfb128(void); +#define EVP_aria_128_cfb EVP_aria_128_cfb128 +const EVP_CIPHER *EVP_aria_128_ctr(void); +const EVP_CIPHER *EVP_aria_128_ofb(void); +const EVP_CIPHER *EVP_aria_128_gcm(void); +const EVP_CIPHER *EVP_aria_128_ccm(void); +const EVP_CIPHER *EVP_aria_192_ecb(void); +const EVP_CIPHER *EVP_aria_192_cbc(void); +const EVP_CIPHER *EVP_aria_192_cfb1(void); +const EVP_CIPHER *EVP_aria_192_cfb8(void); +const EVP_CIPHER *EVP_aria_192_cfb128(void); +#define EVP_aria_192_cfb EVP_aria_192_cfb128 +const EVP_CIPHER *EVP_aria_192_ctr(void); +const EVP_CIPHER *EVP_aria_192_ofb(void); +const EVP_CIPHER *EVP_aria_192_gcm(void); +const EVP_CIPHER *EVP_aria_192_ccm(void); +const EVP_CIPHER *EVP_aria_256_ecb(void); +const EVP_CIPHER *EVP_aria_256_cbc(void); +const EVP_CIPHER *EVP_aria_256_cfb1(void); +const EVP_CIPHER *EVP_aria_256_cfb8(void); +const EVP_CIPHER *EVP_aria_256_cfb128(void); +#define EVP_aria_256_cfb EVP_aria_256_cfb128 +const EVP_CIPHER *EVP_aria_256_ctr(void); +const EVP_CIPHER *EVP_aria_256_ofb(void); +const EVP_CIPHER *EVP_aria_256_gcm(void); +const EVP_CIPHER *EVP_aria_256_ccm(void); +#endif +#ifndef OPENSSL_NO_CAMELLIA +const EVP_CIPHER *EVP_camellia_128_ecb(void); +const EVP_CIPHER *EVP_camellia_128_cbc(void); +const EVP_CIPHER *EVP_camellia_128_cfb1(void); +const EVP_CIPHER *EVP_camellia_128_cfb8(void); +const EVP_CIPHER *EVP_camellia_128_cfb128(void); +#define EVP_camellia_128_cfb EVP_camellia_128_cfb128 +const EVP_CIPHER *EVP_camellia_128_ofb(void); +const EVP_CIPHER *EVP_camellia_128_ctr(void); +const EVP_CIPHER *EVP_camellia_192_ecb(void); +const EVP_CIPHER *EVP_camellia_192_cbc(void); +const EVP_CIPHER *EVP_camellia_192_cfb1(void); +const EVP_CIPHER *EVP_camellia_192_cfb8(void); +const EVP_CIPHER *EVP_camellia_192_cfb128(void); +#define EVP_camellia_192_cfb EVP_camellia_192_cfb128 +const EVP_CIPHER *EVP_camellia_192_ofb(void); +const EVP_CIPHER *EVP_camellia_192_ctr(void); +const EVP_CIPHER *EVP_camellia_256_ecb(void); +const EVP_CIPHER *EVP_camellia_256_cbc(void); +const EVP_CIPHER *EVP_camellia_256_cfb1(void); +const EVP_CIPHER *EVP_camellia_256_cfb8(void); +const EVP_CIPHER *EVP_camellia_256_cfb128(void); +#define EVP_camellia_256_cfb EVP_camellia_256_cfb128 +const EVP_CIPHER *EVP_camellia_256_ofb(void); +const EVP_CIPHER *EVP_camellia_256_ctr(void); +#endif +#ifndef OPENSSL_NO_CHACHA +const EVP_CIPHER *EVP_chacha20(void); +#ifndef OPENSSL_NO_POLY1305 +const EVP_CIPHER *EVP_chacha20_poly1305(void); +#endif +#endif + +#ifndef OPENSSL_NO_SEED +const EVP_CIPHER *EVP_seed_ecb(void); +const EVP_CIPHER *EVP_seed_cbc(void); +const EVP_CIPHER *EVP_seed_cfb128(void); +#define EVP_seed_cfb EVP_seed_cfb128 +const EVP_CIPHER *EVP_seed_ofb(void); +#endif + +#ifndef OPENSSL_NO_SM4 +const EVP_CIPHER *EVP_sm4_ecb(void); +const EVP_CIPHER *EVP_sm4_cbc(void); +const EVP_CIPHER *EVP_sm4_cfb128(void); +#define EVP_sm4_cfb EVP_sm4_cfb128 +const EVP_CIPHER *EVP_sm4_ofb(void); +const EVP_CIPHER *EVP_sm4_ctr(void); +#endif + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define OPENSSL_add_all_algorithms_conf() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS \ + | OPENSSL_INIT_LOAD_CONFIG, \ + NULL) +#define OPENSSL_add_all_algorithms_noconf() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS, \ + NULL) + +#ifdef OPENSSL_LOAD_CONF +#define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() +#else +#define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() +#endif + +#define OpenSSL_add_all_ciphers() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) +#define OpenSSL_add_all_digests() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) + +#define EVP_cleanup() \ + while (0) \ + continue +#endif + +int EVP_add_cipher(const EVP_CIPHER *cipher); +int EVP_add_digest(const EVP_MD *digest); + +const EVP_CIPHER *EVP_get_cipherbyname(const char *name); +const EVP_MD *EVP_get_digestbyname(const char *name); + +void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph, + const char *from, const char *to, void *x), + void *arg); +void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph, const char *from, + const char *to, void *x), + void *arg); +void EVP_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_CIPHER *cipher, void *arg), + void *arg); + +void EVP_MD_do_all(void (*fn)(const EVP_MD *ciph, + const char *from, const char *to, void *x), + void *arg); +void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph, const char *from, + const char *to, void *x), + void *arg); +void EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_MD *md, void *arg), + void *arg); + +/* MAC stuff */ + +EVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm, + const char *properties); +int EVP_MAC_up_ref(EVP_MAC *mac); +void EVP_MAC_free(EVP_MAC *mac); +const char *EVP_MAC_get0_name(const EVP_MAC *mac); +const char *EVP_MAC_get0_description(const EVP_MAC *mac); +int EVP_MAC_is_a(const EVP_MAC *mac, const char *name); +const OSSL_PROVIDER *EVP_MAC_get0_provider(const EVP_MAC *mac); +int EVP_MAC_get_params(EVP_MAC *mac, OSSL_PARAM params[]); + +EVP_MAC_CTX *EVP_MAC_CTX_new(EVP_MAC *mac); +void EVP_MAC_CTX_free(EVP_MAC_CTX *ctx); +EVP_MAC_CTX *EVP_MAC_CTX_dup(const EVP_MAC_CTX *src); +EVP_MAC *EVP_MAC_CTX_get0_mac(EVP_MAC_CTX *ctx); +int EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]); +int EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]); + +size_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx); +size_t EVP_MAC_CTX_get_block_size(EVP_MAC_CTX *ctx); +unsigned char *EVP_Q_mac(OSSL_LIB_CTX *libctx, const char *name, const char *propq, + const char *subalg, const OSSL_PARAM *params, + const void *key, size_t keylen, + const unsigned char *data, size_t datalen, + unsigned char *out, size_t outsize, size_t *outlen); +int EVP_MAC_init(EVP_MAC_CTX *ctx, const unsigned char *key, size_t keylen, + const OSSL_PARAM params[]); +int EVP_MAC_init_SKEY(EVP_MAC_CTX *ctx, EVP_SKEY *skey, const OSSL_PARAM params[]); +int EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen); +int EVP_MAC_final(EVP_MAC_CTX *ctx, + unsigned char *out, size_t *outl, size_t outsize); +int EVP_MAC_finalXOF(EVP_MAC_CTX *ctx, unsigned char *out, size_t outsize); +const OSSL_PARAM *EVP_MAC_gettable_params(const EVP_MAC *mac); +const OSSL_PARAM *EVP_MAC_gettable_ctx_params(const EVP_MAC *mac); +const OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac); +const OSSL_PARAM *EVP_MAC_CTX_gettable_params(EVP_MAC_CTX *ctx); +const OSSL_PARAM *EVP_MAC_CTX_settable_params(EVP_MAC_CTX *ctx); + +void EVP_MAC_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_MAC *mac, void *arg), + void *arg); +int EVP_MAC_names_do_all(const EVP_MAC *mac, + void (*fn)(const char *name, void *data), + void *data); + +/* RAND stuff */ +EVP_RAND *EVP_RAND_fetch(OSSL_LIB_CTX *libctx, const char *algorithm, + const char *properties); +int EVP_RAND_up_ref(EVP_RAND *rand); +void EVP_RAND_free(EVP_RAND *rand); +const char *EVP_RAND_get0_name(const EVP_RAND *rand); +const char *EVP_RAND_get0_description(const EVP_RAND *md); +int EVP_RAND_is_a(const EVP_RAND *rand, const char *name); +const OSSL_PROVIDER *EVP_RAND_get0_provider(const EVP_RAND *rand); +int EVP_RAND_get_params(EVP_RAND *rand, OSSL_PARAM params[]); + +EVP_RAND_CTX *EVP_RAND_CTX_new(EVP_RAND *rand, EVP_RAND_CTX *parent); +int EVP_RAND_CTX_up_ref(EVP_RAND_CTX *ctx); +void EVP_RAND_CTX_free(EVP_RAND_CTX *ctx); +EVP_RAND *EVP_RAND_CTX_get0_rand(EVP_RAND_CTX *ctx); +int EVP_RAND_CTX_get_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[]); +int EVP_RAND_CTX_set_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[]); +const OSSL_PARAM *EVP_RAND_gettable_params(const EVP_RAND *rand); +const OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand); +const OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand); +const OSSL_PARAM *EVP_RAND_CTX_gettable_params(EVP_RAND_CTX *ctx); +const OSSL_PARAM *EVP_RAND_CTX_settable_params(EVP_RAND_CTX *ctx); + +void EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_RAND *rand, void *arg), + void *arg); +int EVP_RAND_names_do_all(const EVP_RAND *rand, + void (*fn)(const char *name, void *data), + void *data); + +__owur int EVP_RAND_instantiate(EVP_RAND_CTX *ctx, unsigned int strength, + int prediction_resistance, + const unsigned char *pstr, size_t pstr_len, + const OSSL_PARAM params[]); +int EVP_RAND_uninstantiate(EVP_RAND_CTX *ctx); +__owur int EVP_RAND_generate(EVP_RAND_CTX *ctx, unsigned char *out, + size_t outlen, unsigned int strength, + int prediction_resistance, + const unsigned char *addin, size_t addin_len); +int EVP_RAND_reseed(EVP_RAND_CTX *ctx, int prediction_resistance, + const unsigned char *ent, size_t ent_len, + const unsigned char *addin, size_t addin_len); +__owur int EVP_RAND_nonce(EVP_RAND_CTX *ctx, unsigned char *out, size_t outlen); +__owur int EVP_RAND_enable_locking(EVP_RAND_CTX *ctx); + +int EVP_RAND_verify_zeroization(EVP_RAND_CTX *ctx); +unsigned int EVP_RAND_get_strength(EVP_RAND_CTX *ctx); +int EVP_RAND_get_state(EVP_RAND_CTX *ctx); + +#define EVP_RAND_STATE_UNINITIALISED 0 +#define EVP_RAND_STATE_READY 1 +#define EVP_RAND_STATE_ERROR 2 + +/* PKEY stuff */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_decrypt_old(unsigned char *dec_key, + const unsigned char *enc_key, + int enc_key_len, + EVP_PKEY *private_key); +OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_encrypt_old(unsigned char *enc_key, + const unsigned char *key, + int key_len, EVP_PKEY *pub_key); +#endif +int EVP_PKEY_is_a(const EVP_PKEY *pkey, const char *name); +int EVP_PKEY_type_names_do_all(const EVP_PKEY *pkey, + void (*fn)(const char *name, void *data), + void *data); +int EVP_PKEY_type(int type); +int EVP_PKEY_get_id(const EVP_PKEY *pkey); +#define EVP_PKEY_id EVP_PKEY_get_id +int EVP_PKEY_get_base_id(const EVP_PKEY *pkey); +#define EVP_PKEY_base_id EVP_PKEY_get_base_id +int EVP_PKEY_get_bits(const EVP_PKEY *pkey); +#define EVP_PKEY_bits EVP_PKEY_get_bits +int EVP_PKEY_get_security_bits(const EVP_PKEY *pkey); +#define EVP_PKEY_security_bits EVP_PKEY_get_security_bits +int EVP_PKEY_get_security_category(const EVP_PKEY *pkey); +int EVP_PKEY_get_size(const EVP_PKEY *pkey); +#define EVP_PKEY_size EVP_PKEY_get_size +int EVP_PKEY_can_sign(const EVP_PKEY *pkey); +int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); +int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); +int EVP_PKEY_set_type_by_keymgmt(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_ENGINE +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); +OSSL_DEPRECATEDIN_3_0 +ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); +#endif +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); +OSSL_DEPRECATEDIN_3_0 +void *EVP_PKEY_get0(const EVP_PKEY *pkey); +OSSL_DEPRECATEDIN_3_0 +const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); +#ifndef OPENSSL_NO_POLY1305 +OSSL_DEPRECATEDIN_3_0 +const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); +#endif +#ifndef OPENSSL_NO_SIPHASH +OSSL_DEPRECATEDIN_3_0 +const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); +#endif + +struct rsa_st; +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); +OSSL_DEPRECATEDIN_3_0 +const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey); +OSSL_DEPRECATEDIN_3_0 +struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); + +#ifndef OPENSSL_NO_DSA +struct dsa_st; +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); +OSSL_DEPRECATEDIN_3_0 +const struct dsa_st *EVP_PKEY_get0_DSA(const EVP_PKEY *pkey); +OSSL_DEPRECATEDIN_3_0 +struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); +#endif + +#ifndef OPENSSL_NO_DH +struct dh_st; +OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); +OSSL_DEPRECATEDIN_3_0 const struct dh_st *EVP_PKEY_get0_DH(const EVP_PKEY *pkey); +OSSL_DEPRECATEDIN_3_0 struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); +#endif + +#ifndef OPENSSL_NO_EC +struct ec_key_st; +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); +OSSL_DEPRECATEDIN_3_0 +const struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey); +OSSL_DEPRECATEDIN_3_0 +struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); +#endif +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +EVP_PKEY *EVP_PKEY_new(void); +int EVP_PKEY_up_ref(EVP_PKEY *pkey); +EVP_PKEY *EVP_PKEY_dup(EVP_PKEY *pkey); +void EVP_PKEY_free(EVP_PKEY *pkey); +const char *EVP_PKEY_get0_description(const EVP_PKEY *pkey); +const OSSL_PROVIDER *EVP_PKEY_get0_provider(const EVP_PKEY *key); + +EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PublicKey(const EVP_PKEY *a, unsigned char **pp); + +EVP_PKEY *d2i_PrivateKey_ex(int type, EVP_PKEY **a, const unsigned char **pp, + long length, OSSL_LIB_CTX *libctx, + const char *propq); +EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, + long length); +EVP_PKEY *d2i_AutoPrivateKey_ex(EVP_PKEY **a, const unsigned char **pp, + long length, OSSL_LIB_CTX *libctx, + const char *propq); +EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PrivateKey(const EVP_PKEY *a, unsigned char **pp); +int i2d_PKCS8PrivateKey(const EVP_PKEY *a, unsigned char **pp); + +int i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp); +EVP_PKEY *d2i_KeyParams(int type, EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_KeyParams_bio(BIO *bp, const EVP_PKEY *pkey); +EVP_PKEY *d2i_KeyParams_bio(int type, EVP_PKEY **a, BIO *in); + +int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); +int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); +int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); +int EVP_PKEY_parameters_eq(const EVP_PKEY *a, const EVP_PKEY *b); +int EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); +#endif + +int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +#ifndef OPENSSL_NO_STDIO +int EVP_PKEY_print_public_fp(FILE *fp, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_private_fp(FILE *fp, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_params_fp(FILE *fp, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +#endif + +int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); +int EVP_PKEY_get_default_digest_name(EVP_PKEY *pkey, + char *mdname, size_t mdname_sz); +int EVP_PKEY_digestsign_supports_digest(EVP_PKEY *pkey, OSSL_LIB_CTX *libctx, + const char *name, const char *propq); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* + * For backwards compatibility. Use EVP_PKEY_set1_encoded_public_key in + * preference + */ +#define EVP_PKEY_set1_tls_encodedpoint(pkey, pt, ptlen) \ + EVP_PKEY_set1_encoded_public_key((pkey), (pt), (ptlen)) +#endif + +int EVP_PKEY_set1_encoded_public_key(EVP_PKEY *pkey, + const unsigned char *pub, size_t publen); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* + * For backwards compatibility. Use EVP_PKEY_get1_encoded_public_key in + * preference + */ +#define EVP_PKEY_get1_tls_encodedpoint(pkey, ppt) \ + EVP_PKEY_get1_encoded_public_key((pkey), (ppt)) +#endif + +size_t EVP_PKEY_get1_encoded_public_key(EVP_PKEY *pkey, unsigned char **ppub); + +/* calls methods */ +int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* These are used by EVP_CIPHER methods */ +int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* PKCS5 password based encryption */ +int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); +int PKCS5_PBE_keyivgen_ex(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de, OSSL_LIB_CTX *libctx, + const char *propq); +int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + int keylen, unsigned char *out); +int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + const EVP_MD *digest, int keylen, unsigned char *out); +int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); +int PKCS5_v2_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de, + OSSL_LIB_CTX *libctx, const char *propq); + +#ifndef OPENSSL_NO_SCRYPT +int EVP_PBE_scrypt(const char *pass, size_t passlen, + const unsigned char *salt, size_t saltlen, + uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, + unsigned char *key, size_t keylen); +int EVP_PBE_scrypt_ex(const char *pass, size_t passlen, + const unsigned char *salt, size_t saltlen, + uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, + unsigned char *key, size_t keylen, + OSSL_LIB_CTX *ctx, const char *propq); + +int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *c, const EVP_MD *md, int en_de); +int PKCS5_v2_scrypt_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *c, const EVP_MD *md, int en_de, + OSSL_LIB_CTX *libctx, const char *propq); +#endif + +void PKCS5_PBE_add(void); + +int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); + +int EVP_PBE_CipherInit_ex(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de, + OSSL_LIB_CTX *libctx, const char *propq); + +/* PBE type */ + +/* Can appear as the outermost AlgorithmIdentifier */ +#define EVP_PBE_TYPE_OUTER 0x0 +/* Is an PRF type OID */ +#define EVP_PBE_TYPE_PRF 0x1 +/* Is a PKCS#5 v2.0 KDF */ +#define EVP_PBE_TYPE_KDF 0x2 + +int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, + int md_nid, EVP_PBE_KEYGEN *keygen); +int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, + EVP_PBE_KEYGEN *keygen); +int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, + EVP_PBE_KEYGEN **pkeygen); +int EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid, + EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **pkeygen_ex); +void EVP_PBE_cleanup(void); +int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); + +#define ASN1_PKEY_ALIAS 0x1 +#define ASN1_PKEY_DYNAMIC 0x2 +#define ASN1_PKEY_SIGPARAM_NULL 0x4 + +#define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 +#define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 +#define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 +#define ASN1_PKEY_CTRL_CMS_SIGN 0x5 +#define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 +#define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 + +#define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 +#define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa +#define ASN1_PKEY_CTRL_CMS_IS_RI_TYPE_SUPPORTED 0xb + +#ifndef OPENSSL_NO_DEPRECATED_3_6 +OSSL_DEPRECATEDIN_3_6 int EVP_PKEY_asn1_get_count(void); +OSSL_DEPRECATEDIN_3_6 const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); +OSSL_DEPRECATEDIN_3_6 +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); +OSSL_DEPRECATEDIN_3_6 +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, + const char *str, int len); +OSSL_DEPRECATEDIN_3_6 int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); +OSSL_DEPRECATEDIN_3_6 int EVP_PKEY_asn1_add_alias(int to, int from); +OSSL_DEPRECATEDIN_3_6 +int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, + int *ppkey_flags, const char **pinfo, + const char **ppem_str, + const EVP_PKEY_ASN1_METHOD *ameth); + +OSSL_DEPRECATEDIN_3_6 const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); +OSSL_DEPRECATEDIN_3_6 EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, + const char *pem_str, + const char *info); +OSSL_DEPRECATEDIN_3_6 void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, + const EVP_PKEY_ASN1_METHOD *src); +OSSL_DEPRECATEDIN_3_6 void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, + int (*pub_decode)(EVP_PKEY *pk, + const X509_PUBKEY *pub), + int (*pub_encode)(X509_PUBKEY *pub, + const EVP_PKEY *pk), + int (*pub_cmp)(const EVP_PKEY *a, + const EVP_PKEY *b), + int (*pub_print)(BIO *out, + const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx), + int (*pkey_size)(const EVP_PKEY *pk), + int (*pkey_bits)(const EVP_PKEY *pk)); +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, + int (*priv_decode)(EVP_PKEY *pk, + const PKCS8_PRIV_KEY_INFO + *p8inf), + int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, + const EVP_PKEY *pk), + int (*priv_print)(BIO *out, + const EVP_PKEY *pkey, + int indent, + ASN1_PCTX *pctx)); +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, + int (*param_decode)(EVP_PKEY *pkey, + const unsigned char **pder, + int derlen), + int (*param_encode)(const EVP_PKEY *pkey, + unsigned char **pder), + int (*param_missing)(const EVP_PKEY *pk), + int (*param_copy)(EVP_PKEY *to, + const EVP_PKEY *from), + int (*param_cmp)(const EVP_PKEY *a, + const EVP_PKEY *b), + int (*param_print)(BIO *out, + const EVP_PKEY *pkey, + int indent, + ASN1_PCTX *pctx)); + +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, + void (*pkey_free)(EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_ctrl)(EVP_PKEY *pkey, int op, + long arg1, void *arg2)); +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, + int (*item_verify)(EVP_MD_CTX *ctx, + const ASN1_ITEM *it, + const void *data, + const X509_ALGOR *a, + const ASN1_BIT_STRING *sig, + EVP_PKEY *pkey), + int (*item_sign)(EVP_MD_CTX *ctx, + const ASN1_ITEM *it, + const void *data, + X509_ALGOR *alg1, + X509_ALGOR *alg2, + ASN1_BIT_STRING *sig)); + +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, + int (*siginf_set)(X509_SIG_INFO *siginf, + const X509_ALGOR *alg, + const ASN1_STRING *sig)); + +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_check)(const EVP_PKEY *pk)); + +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_pub_check)(const EVP_PKEY *pk)); + +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_param_check)(const EVP_PKEY *pk)); + +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_priv_key)(EVP_PKEY *pk, + const unsigned char + *priv, + size_t len)); +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_pub_key)(EVP_PKEY *pk, + const unsigned char *pub, + size_t len)); +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*get_priv_key)(const EVP_PKEY *pk, + unsigned char *priv, + size_t *len)); +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*get_pub_key)(const EVP_PKEY *pk, + unsigned char *pub, + size_t *len)); + +OSSL_DEPRECATEDIN_3_6 +void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_security_bits)(const EVP_PKEY + *pk)); +#endif /* OPENSSL_NO_DEPRECATED_3_6 */ + +int EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD **md); +int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); + +int EVP_PKEY_CTX_set1_id(EVP_PKEY_CTX *ctx, const void *id, int len); +int EVP_PKEY_CTX_get1_id(EVP_PKEY_CTX *ctx, void *id); +int EVP_PKEY_CTX_get1_id_len(EVP_PKEY_CTX *ctx, size_t *id_len); + +int EVP_PKEY_CTX_set_kem_op(EVP_PKEY_CTX *ctx, const char *op); + +const char *EVP_PKEY_get0_type_name(const EVP_PKEY *key); + +#define EVP_PKEY_OP_UNDEFINED 0 +#define EVP_PKEY_OP_PARAMGEN (1 << 1) +#define EVP_PKEY_OP_KEYGEN (1 << 2) +#define EVP_PKEY_OP_FROMDATA (1 << 3) +#define EVP_PKEY_OP_SIGN (1 << 4) +#define EVP_PKEY_OP_VERIFY (1 << 5) +#define EVP_PKEY_OP_VERIFYRECOVER (1 << 6) +#define EVP_PKEY_OP_SIGNCTX (1 << 7) +#define EVP_PKEY_OP_VERIFYCTX (1 << 8) +#define EVP_PKEY_OP_ENCRYPT (1 << 9) +#define EVP_PKEY_OP_DECRYPT (1 << 10) +#define EVP_PKEY_OP_DERIVE (1 << 11) +#define EVP_PKEY_OP_ENCAPSULATE (1 << 12) +#define EVP_PKEY_OP_DECAPSULATE (1 << 13) +#define EVP_PKEY_OP_SIGNMSG (1 << 14) +#define EVP_PKEY_OP_VERIFYMSG (1 << 15) +/* Update the following when adding new EVP_PKEY_OPs */ +#define EVP_PKEY_OP_ALL ((1 << 16) - 1) + +#define EVP_PKEY_OP_TYPE_SIG \ + (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_SIGNMSG \ + | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYMSG \ + | EVP_PKEY_OP_VERIFYRECOVER \ + | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) + +#define EVP_PKEY_OP_TYPE_CRYPT \ + (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) + +#define EVP_PKEY_OP_TYPE_DERIVE \ + (EVP_PKEY_OP_DERIVE) + +#define EVP_PKEY_OP_TYPE_DATA \ + (EVP_PKEY_OP_FROMDATA) + +#define EVP_PKEY_OP_TYPE_KEM \ + (EVP_PKEY_OP_ENCAPSULATE | EVP_PKEY_OP_DECAPSULATE) + +#define EVP_PKEY_OP_TYPE_GEN \ + (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) + +#define EVP_PKEY_OP_TYPE_NOGEN \ + (EVP_PKEY_OP_ALL & ~EVP_PKEY_OP_TYPE_GEN) + +int EVP_PKEY_CTX_set_mac_key(EVP_PKEY_CTX *ctx, const unsigned char *key, + int keylen); + +#define EVP_PKEY_CTRL_MD 1 +#define EVP_PKEY_CTRL_PEER_KEY 2 +#define EVP_PKEY_CTRL_SET_MAC_KEY 6 +#define EVP_PKEY_CTRL_DIGESTINIT 7 +/* Used by GOST key encryption in TLS */ +#define EVP_PKEY_CTRL_SET_IV 8 +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 +#define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 +#define EVP_PKEY_CTRL_PKCS7_SIGN 5 +#define EVP_PKEY_CTRL_CMS_ENCRYPT 9 +#define EVP_PKEY_CTRL_CMS_DECRYPT 10 +#define EVP_PKEY_CTRL_CMS_SIGN 11 +#endif +#define EVP_PKEY_CTRL_CIPHER 12 +#define EVP_PKEY_CTRL_GET_MD 13 +#define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 +#define EVP_PKEY_CTRL_SET1_ID 15 +#define EVP_PKEY_CTRL_GET1_ID 16 +#define EVP_PKEY_CTRL_GET1_ID_LEN 17 + +#define EVP_PKEY_ALG_CTRL 0x1000 + +#define EVP_PKEY_FLAG_AUTOARGLEN 2 +/* + * Method handles all operations: don't assume any digest related defaults. + */ +#define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); +OSSL_DEPRECATEDIN_3_0 EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, + const EVP_PKEY_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, + const EVP_PKEY_METHOD *src); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); +OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); +OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); +OSSL_DEPRECATEDIN_3_0 size_t EVP_PKEY_meth_get_count(void); +OSSL_DEPRECATEDIN_3_0 const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); +#endif + +EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, + const char *properties); +int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt); +void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt); +const OSSL_PROVIDER *EVP_KEYMGMT_get0_provider(const EVP_KEYMGMT *keymgmt); +const char *EVP_KEYMGMT_get0_name(const EVP_KEYMGMT *keymgmt); +const char *EVP_KEYMGMT_get0_description(const EVP_KEYMGMT *keymgmt); +int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name); +void EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_KEYMGMT *keymgmt, void *arg), + void *arg); +int EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt); +const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt); +const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt); +const OSSL_PARAM *EVP_KEYMGMT_gen_gettable_params(const EVP_KEYMGMT *keymgmt); + +EVP_SKEYMGMT *EVP_SKEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, + const char *properties); +int EVP_SKEYMGMT_up_ref(EVP_SKEYMGMT *keymgmt); +void EVP_SKEYMGMT_free(EVP_SKEYMGMT *keymgmt); +const OSSL_PROVIDER *EVP_SKEYMGMT_get0_provider(const EVP_SKEYMGMT *keymgmt); +const char *EVP_SKEYMGMT_get0_name(const EVP_SKEYMGMT *keymgmt); +const char *EVP_SKEYMGMT_get0_description(const EVP_SKEYMGMT *keymgmt); +int EVP_SKEYMGMT_is_a(const EVP_SKEYMGMT *keymgmt, const char *name); +void EVP_SKEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_SKEYMGMT *keymgmt, void *arg), + void *arg); +int EVP_SKEYMGMT_names_do_all(const EVP_SKEYMGMT *keymgmt, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PARAM *EVP_SKEYMGMT_get0_gen_settable_params(const EVP_SKEYMGMT *skeymgmt); +const OSSL_PARAM *EVP_SKEYMGMT_get0_imp_settable_params(const EVP_SKEYMGMT *skeymgmt); + +EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); +EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); +EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OSSL_LIB_CTX *libctx, + const char *name, + const char *propquery); +EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OSSL_LIB_CTX *libctx, + EVP_PKEY *pkey, const char *propquery); +EVP_PKEY_CTX *EVP_PKEY_CTX_dup(const EVP_PKEY_CTX *ctx); +void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); +int EVP_PKEY_CTX_is_a(EVP_PKEY_CTX *ctx, const char *keytype); + +int EVP_PKEY_CTX_get_params(EVP_PKEY_CTX *ctx, OSSL_PARAM *params); +const OSSL_PARAM *EVP_PKEY_CTX_gettable_params(const EVP_PKEY_CTX *ctx); +int EVP_PKEY_CTX_set_params(EVP_PKEY_CTX *ctx, const OSSL_PARAM *params); +const OSSL_PARAM *EVP_PKEY_CTX_settable_params(const EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_set_algor_params(EVP_PKEY_CTX *ctx, const X509_ALGOR *alg); +int EVP_PKEY_CTX_get_algor_params(EVP_PKEY_CTX *ctx, X509_ALGOR *alg); +int EVP_PKEY_CTX_get_algor(EVP_PKEY_CTX *ctx, X509_ALGOR **alg); + +int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, + int cmd, int p1, void *p2); +int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, + const char *value); +int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, + int cmd, uint64_t value); + +int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); +int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); + +int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); + +int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); +void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); + +EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, + const unsigned char *key, int keylen); +EVP_PKEY *EVP_PKEY_new_raw_private_key_ex(OSSL_LIB_CTX *libctx, + const char *keytype, + const char *propq, + const unsigned char *priv, size_t len); +EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, + const unsigned char *priv, + size_t len); +EVP_PKEY *EVP_PKEY_new_raw_public_key_ex(OSSL_LIB_CTX *libctx, + const char *keytype, const char *propq, + const unsigned char *pub, size_t len); +EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, + const unsigned char *pub, + size_t len); +int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, + size_t *len); +int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, + size_t *len); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, + size_t len, const EVP_CIPHER *cipher); +#endif + +void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); +void *EVP_PKEY_CTX_get_data(const EVP_PKEY_CTX *ctx); +EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); + +EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); + +void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); +void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_set_signature(EVP_PKEY_CTX *pctx, + const unsigned char *sig, size_t siglen); + +void EVP_SIGNATURE_free(EVP_SIGNATURE *signature); +int EVP_SIGNATURE_up_ref(EVP_SIGNATURE *signature); +OSSL_PROVIDER *EVP_SIGNATURE_get0_provider(const EVP_SIGNATURE *signature); +EVP_SIGNATURE *EVP_SIGNATURE_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, + const char *properties); +int EVP_SIGNATURE_is_a(const EVP_SIGNATURE *signature, const char *name); +const char *EVP_SIGNATURE_get0_name(const EVP_SIGNATURE *signature); +const char *EVP_SIGNATURE_get0_description(const EVP_SIGNATURE *signature); +void EVP_SIGNATURE_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_SIGNATURE *signature, + void *data), + void *data); +int EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig); +const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig); + +void EVP_ASYM_CIPHER_free(EVP_ASYM_CIPHER *cipher); +int EVP_ASYM_CIPHER_up_ref(EVP_ASYM_CIPHER *cipher); +OSSL_PROVIDER *EVP_ASYM_CIPHER_get0_provider(const EVP_ASYM_CIPHER *cipher); +EVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, + const char *properties); +int EVP_ASYM_CIPHER_is_a(const EVP_ASYM_CIPHER *cipher, const char *name); +const char *EVP_ASYM_CIPHER_get0_name(const EVP_ASYM_CIPHER *cipher); +const char *EVP_ASYM_CIPHER_get0_description(const EVP_ASYM_CIPHER *cipher); +void EVP_ASYM_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_ASYM_CIPHER *cipher, + void *arg), + void *arg); +int EVP_ASYM_CIPHER_names_do_all(const EVP_ASYM_CIPHER *cipher, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PARAM *EVP_ASYM_CIPHER_gettable_ctx_params(const EVP_ASYM_CIPHER *ciph); +const OSSL_PARAM *EVP_ASYM_CIPHER_settable_ctx_params(const EVP_ASYM_CIPHER *ciph); + +void EVP_KEM_free(EVP_KEM *wrap); +int EVP_KEM_up_ref(EVP_KEM *wrap); +OSSL_PROVIDER *EVP_KEM_get0_provider(const EVP_KEM *wrap); +EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, + const char *properties); +int EVP_KEM_is_a(const EVP_KEM *wrap, const char *name); +const char *EVP_KEM_get0_name(const EVP_KEM *wrap); +const char *EVP_KEM_get0_description(const EVP_KEM *wrap); +void EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_KEM *wrap, void *arg), void *arg); +int EVP_KEM_names_do_all(const EVP_KEM *wrap, + void (*fn)(const char *name, void *data), void *data); +const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem); +const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem); + +int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_sign_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]); +int EVP_PKEY_sign_init_ex2(EVP_PKEY_CTX *ctx, + EVP_SIGNATURE *algo, const OSSL_PARAM params[]); +int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_sign_message_init(EVP_PKEY_CTX *ctx, + EVP_SIGNATURE *algo, const OSSL_PARAM params[]); +int EVP_PKEY_sign_message_update(EVP_PKEY_CTX *ctx, + const unsigned char *in, size_t inlen); +int EVP_PKEY_sign_message_final(EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen); +int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_verify_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]); +int EVP_PKEY_verify_init_ex2(EVP_PKEY_CTX *ctx, + EVP_SIGNATURE *algo, const OSSL_PARAM params[]); +int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, + const unsigned char *sig, size_t siglen, + const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_verify_message_init(EVP_PKEY_CTX *ctx, + EVP_SIGNATURE *algo, const OSSL_PARAM params[]); +int EVP_PKEY_verify_message_update(EVP_PKEY_CTX *ctx, + const unsigned char *in, size_t inlen); +int EVP_PKEY_verify_message_final(EVP_PKEY_CTX *ctx); +int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_verify_recover_init_ex(EVP_PKEY_CTX *ctx, + const OSSL_PARAM params[]); +int EVP_PKEY_verify_recover_init_ex2(EVP_PKEY_CTX *ctx, + EVP_SIGNATURE *algo, + const OSSL_PARAM params[]); +int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, + unsigned char *rout, size_t *routlen, + const unsigned char *sig, size_t siglen); +int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_encrypt_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]); +int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); +int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_decrypt_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]); +int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); + +int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_derive_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]); +int EVP_PKEY_derive_set_peer_ex(EVP_PKEY_CTX *ctx, EVP_PKEY *peer, + int validate_peer); +int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); +int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); +EVP_SKEY *EVP_PKEY_derive_SKEY(EVP_PKEY_CTX *ctx, EVP_SKEYMGMT *mgmt, + const char *key_type, const char *propquery, + size_t keylen, const OSSL_PARAM params[]); + +int EVP_PKEY_encapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]); +int EVP_PKEY_auth_encapsulate_init(EVP_PKEY_CTX *ctx, EVP_PKEY *authpriv, + const OSSL_PARAM params[]); +int EVP_PKEY_encapsulate(EVP_PKEY_CTX *ctx, + unsigned char *wrappedkey, size_t *wrappedkeylen, + unsigned char *genkey, size_t *genkeylen); +int EVP_PKEY_decapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]); +int EVP_PKEY_auth_decapsulate_init(EVP_PKEY_CTX *ctx, EVP_PKEY *authpub, + const OSSL_PARAM params[]); +int EVP_PKEY_decapsulate(EVP_PKEY_CTX *ctx, + unsigned char *unwrapped, size_t *unwrappedlen, + const unsigned char *wrapped, size_t wrappedlen); +typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_fromdata_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_fromdata(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey, int selection, + OSSL_PARAM param[]); +const OSSL_PARAM *EVP_PKEY_fromdata_settable(EVP_PKEY_CTX *ctx, int selection); + +int EVP_PKEY_todata(const EVP_PKEY *pkey, int selection, OSSL_PARAM **params); +int EVP_PKEY_export(const EVP_PKEY *pkey, int selection, + OSSL_CALLBACK *export_cb, void *export_cbarg); + +const OSSL_PARAM *EVP_PKEY_gettable_params(const EVP_PKEY *pkey); +int EVP_PKEY_get_params(const EVP_PKEY *pkey, OSSL_PARAM params[]); +int EVP_PKEY_get_int_param(const EVP_PKEY *pkey, const char *key_name, + int *out); +int EVP_PKEY_get_size_t_param(const EVP_PKEY *pkey, const char *key_name, + size_t *out); +int EVP_PKEY_get_bn_param(const EVP_PKEY *pkey, const char *key_name, + BIGNUM **bn); +int EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey, const char *key_name, + char *str, size_t max_buf_sz, size_t *out_sz); +int EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey, const char *key_name, + unsigned char *buf, size_t max_buf_sz, + size_t *out_sz); + +const OSSL_PARAM *EVP_PKEY_settable_params(const EVP_PKEY *pkey); +int EVP_PKEY_set_params(EVP_PKEY *pkey, OSSL_PARAM params[]); +int EVP_PKEY_set_int_param(EVP_PKEY *pkey, const char *key_name, int in); +int EVP_PKEY_set_size_t_param(EVP_PKEY *pkey, const char *key_name, size_t in); +int EVP_PKEY_set_bn_param(EVP_PKEY *pkey, const char *key_name, + const BIGNUM *bn); +int EVP_PKEY_set_utf8_string_param(EVP_PKEY *pkey, const char *key_name, + const char *str); +int EVP_PKEY_set_octet_string_param(EVP_PKEY *pkey, const char *key_name, + const unsigned char *buf, size_t bsize); + +int EVP_PKEY_get_ec_point_conv_form(const EVP_PKEY *pkey); +int EVP_PKEY_get_field_type(const EVP_PKEY *pkey); + +EVP_PKEY *EVP_PKEY_Q_keygen(OSSL_LIB_CTX *libctx, const char *propq, + const char *type, ...); +int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); +int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); +int EVP_PKEY_generate(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); +int EVP_PKEY_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_public_check_quick(EVP_PKEY_CTX *ctx); +int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_param_check_quick(EVP_PKEY_CTX *ctx); +int EVP_PKEY_private_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_pairwise_check(EVP_PKEY_CTX *ctx); + +#define EVP_PKEY_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EVP_PKEY, l, p, newf, dupf, freef) +int EVP_PKEY_set_ex_data(EVP_PKEY *key, int idx, void *arg); +void *EVP_PKEY_get_ex_data(const EVP_PKEY *key, int idx); + +void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); +EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, + int (*init)(EVP_PKEY_CTX *ctx)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, int (*copy)(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, void (*cleanup)(EVP_PKEY_CTX *ctx)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, int (*paramgen_init)(EVP_PKEY_CTX *ctx), + int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, int (*keygen_init)(EVP_PKEY_CTX *ctx), + int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, int (*sign_init)(EVP_PKEY_CTX *ctx), + int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, + const unsigned char *tbs, size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, int (*verify_init)(EVP_PKEY_CTX *ctx), + int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, + const unsigned char *tbs, size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, int (*verify_recover_init)(EVP_PKEY_CTX *ctx), + int (*verify_recover)(EVP_PKEY_CTX *ctx, unsigned char *sig, + size_t *siglen, const unsigned char *tbs, + size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), + int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, + EVP_MD_CTX *mctx)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), + int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen, + EVP_MD_CTX *mctx)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, int (*encrypt_init)(EVP_PKEY_CTX *ctx), + int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, int (*decrypt_init)(EVP_PKEY_CTX *ctx), + int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, int (*derive_init)(EVP_PKEY_CTX *ctx), + int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), + int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth, + int (*digestsign)(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen, + const unsigned char *tbs, size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth, + int (*digestverify)(EVP_MD_CTX *ctx, const unsigned char *sig, + size_t siglen, const unsigned char *tbs, + size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, int (*check)(EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, int (*check)(EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, int (*check)(EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, int (*digest_custom)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, int (**pinit)(EVP_PKEY_CTX *ctx)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, int (**pcopy)(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, void (**pcleanup)(EVP_PKEY_CTX *ctx)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, int (**pparamgen_init)(EVP_PKEY_CTX *ctx), + int (**pparamgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, int (**pkeygen_init)(EVP_PKEY_CTX *ctx), + int (**pkeygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, int (**psign_init)(EVP_PKEY_CTX *ctx), + int (**psign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, + const unsigned char *tbs, size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, int (**pverify_init)(EVP_PKEY_CTX *ctx), + int (**pverify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, + size_t siglen, const unsigned char *tbs, size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, + int (**pverify_recover_init)(EVP_PKEY_CTX *ctx), + int (**pverify_recover)(EVP_PKEY_CTX *ctx, unsigned char *sig, + size_t *siglen, const unsigned char *tbs, + size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, + int (**psignctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), + int (**psignctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, + EVP_MD_CTX *mctx)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, + int (**pverifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), + int (**pverifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, + int siglen, EVP_MD_CTX *mctx)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, int (**pencrypt_init)(EVP_PKEY_CTX *ctx), + int (**pencryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, int (**pdecrypt_init)(EVP_PKEY_CTX *ctx), + int (**pdecrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, int (**pderive_init)(EVP_PKEY_CTX *ctx), + int (**pderive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, + int (**pctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), + int (**pctrl_str)(EVP_PKEY_CTX *ctx, const char *type, + const char *value)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_digestsign(const EVP_PKEY_METHOD *pmeth, + int (**digestsign)(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen, + const unsigned char *tbs, size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_digestverify(const EVP_PKEY_METHOD *pmeth, + int (**digestverify)(EVP_MD_CTX *ctx, const unsigned char *sig, + size_t siglen, const unsigned char *tbs, + size_t tbslen)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, int (**pcheck)(EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, int (**pcheck)(EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, int (**pcheck)(EVP_PKEY *pkey)); +OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_digest_custom(const EVP_PKEY_METHOD *pmeth, + int (**pdigest_custom)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)); +#endif + +void EVP_KEYEXCH_free(EVP_KEYEXCH *exchange); +int EVP_KEYEXCH_up_ref(EVP_KEYEXCH *exchange); +EVP_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, + const char *properties); +OSSL_PROVIDER *EVP_KEYEXCH_get0_provider(const EVP_KEYEXCH *exchange); +int EVP_KEYEXCH_is_a(const EVP_KEYEXCH *keyexch, const char *name); +const char *EVP_KEYEXCH_get0_name(const EVP_KEYEXCH *keyexch); +const char *EVP_KEYEXCH_get0_description(const EVP_KEYEXCH *keyexch); +void EVP_KEYEXCH_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_KEYEXCH *keyexch, void *data), + void *data); +int EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *keyexch, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch); +const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch); + +void EVP_add_alg_module(void); + +int EVP_PKEY_CTX_set_group_name(EVP_PKEY_CTX *ctx, const char *name); +int EVP_PKEY_CTX_get_group_name(EVP_PKEY_CTX *ctx, char *name, size_t namelen); +int EVP_PKEY_get_group_name(const EVP_PKEY *pkey, char *name, size_t name_sz, + size_t *gname_len); + +OSSL_LIB_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx); +const char *EVP_PKEY_CTX_get0_propq(const EVP_PKEY_CTX *ctx); +const OSSL_PROVIDER *EVP_PKEY_CTX_get0_provider(const EVP_PKEY_CTX *ctx); + +int EVP_SKEY_is_a(const EVP_SKEY *skey, const char *name); +EVP_SKEY *EVP_SKEY_import(OSSL_LIB_CTX *libctx, const char *skeymgmtname, const char *propquery, + int selection, const OSSL_PARAM *params); +EVP_SKEY *EVP_SKEY_generate(OSSL_LIB_CTX *libctx, const char *skeymgmtname, + const char *propquery, const OSSL_PARAM *params); +EVP_SKEY *EVP_SKEY_import_raw_key(OSSL_LIB_CTX *libctx, const char *skeymgmtname, + unsigned char *key, size_t keylen, + const char *propquery); +EVP_SKEY *EVP_SKEY_import_SKEYMGMT(OSSL_LIB_CTX *libctx, EVP_SKEYMGMT *skeymgmt, + int selection, const OSSL_PARAM *params); +int EVP_SKEY_get0_raw_key(const EVP_SKEY *skey, const unsigned char **key, + size_t *len); +const char *EVP_SKEY_get0_key_id(const EVP_SKEY *skey); +int EVP_SKEY_export(const EVP_SKEY *skey, int selection, + OSSL_CALLBACK *export_cb, void *export_cbarg); +int EVP_SKEY_up_ref(EVP_SKEY *skey); +void EVP_SKEY_free(EVP_SKEY *skey); +const char *EVP_SKEY_get0_skeymgmt_name(const EVP_SKEY *skey); +const char *EVP_SKEY_get0_provider_name(const EVP_SKEY *skey); +EVP_SKEY *EVP_SKEY_to_provider(EVP_SKEY *skey, OSSL_LIB_CTX *libctx, + OSSL_PROVIDER *prov, const char *propquery); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/evperr.h b/VCMP-LUA/modules/postgresql/include/openssl/evperr.h new file mode 100644 index 0000000..06dd95f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/evperr.h @@ -0,0 +1,146 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_EVPERR_H +#define OPENSSL_EVPERR_H +#pragma once + +#include +#include +#include + +/* + * EVP reason codes. + */ +#define EVP_R_AES_KEY_SETUP_FAILED 143 +#define EVP_R_ARIA_KEY_SETUP_FAILED 176 +#define EVP_R_BAD_ALGORITHM_NAME 200 +#define EVP_R_BAD_DECRYPT 100 +#define EVP_R_BAD_KEY_LENGTH 195 +#define EVP_R_BUFFER_TOO_SMALL 155 +#define EVP_R_CACHE_CONSTANTS_FAILED 225 +#define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 +#define EVP_R_CANNOT_GET_PARAMETERS 197 +#define EVP_R_CANNOT_SET_PARAMETERS 198 +#define EVP_R_CIPHER_NOT_GCM_MODE 184 +#define EVP_R_CIPHER_PARAMETER_ERROR 122 +#define EVP_R_COMMAND_NOT_SUPPORTED 147 +#define EVP_R_CONFLICTING_ALGORITHM_NAME 201 +#define EVP_R_COPY_ERROR 173 +#define EVP_R_CTRL_NOT_IMPLEMENTED 132 +#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 +#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 +#define EVP_R_DECODE_ERROR 114 +#define EVP_R_DEFAULT_QUERY_PARSE_ERROR 210 +#define EVP_R_DIFFERENT_KEY_TYPES 101 +#define EVP_R_DIFFERENT_PARAMETERS 153 +#define EVP_R_ERROR_LOADING_SECTION 165 +#define EVP_R_EXPECTING_AN_HMAC_KEY 174 +#define EVP_R_EXPECTING_AN_RSA_KEY 127 +#define EVP_R_EXPECTING_A_DH_KEY 128 +#define EVP_R_EXPECTING_A_DSA_KEY 129 +#define EVP_R_EXPECTING_A_ECX_KEY 219 +#define EVP_R_EXPECTING_A_EC_KEY 142 +#define EVP_R_EXPECTING_A_POLY1305_KEY 164 +#define EVP_R_EXPECTING_A_SIPHASH_KEY 175 +#define EVP_R_FINAL_ERROR 188 +#define EVP_R_GENERATE_ERROR 214 +#define EVP_R_GETTING_ALGORITHMIDENTIFIER_NOT_SUPPORTED 229 +#define EVP_R_GET_RAW_KEY_FAILED 182 +#define EVP_R_ILLEGAL_SCRYPT_PARAMETERS 171 +#define EVP_R_INACCESSIBLE_DOMAIN_PARAMETERS 204 +#define EVP_R_INACCESSIBLE_KEY 203 +#define EVP_R_INITIALIZATION_ERROR 134 +#define EVP_R_INPUT_NOT_INITIALIZED 111 +#define EVP_R_INVALID_CUSTOM_LENGTH 185 +#define EVP_R_INVALID_DIGEST 152 +#define EVP_R_INVALID_IV_LENGTH 194 +#define EVP_R_INVALID_KEY 163 +#define EVP_R_INVALID_KEY_LENGTH 130 +#define EVP_R_INVALID_LENGTH 221 +#define EVP_R_INVALID_NULL_ALGORITHM 218 +#define EVP_R_INVALID_OPERATION 148 +#define EVP_R_INVALID_PROVIDER_FUNCTIONS 193 +#define EVP_R_INVALID_SALT_LENGTH 186 +#define EVP_R_INVALID_SECRET_LENGTH 223 +#define EVP_R_INVALID_SEED_LENGTH 220 +#define EVP_R_INVALID_VALUE 222 +#define EVP_R_KEYMGMT_EXPORT_FAILURE 205 +#define EVP_R_KEY_SETUP_FAILED 180 +#define EVP_R_LOCKING_NOT_SUPPORTED 213 +#define EVP_R_MEMORY_LIMIT_EXCEEDED 172 +#define EVP_R_MESSAGE_DIGEST_IS_NULL 159 +#define EVP_R_METHOD_NOT_SUPPORTED 144 +#define EVP_R_MISSING_PARAMETERS 103 +#define EVP_R_NOT_ABLE_TO_COPY_CTX 190 +#define EVP_R_NOT_XOF_OR_INVALID_LENGTH 178 +#define EVP_R_NO_CIPHER_SET 131 +#define EVP_R_NO_DEFAULT_DIGEST 158 +#define EVP_R_NO_DIGEST_SET 139 +#define EVP_R_NO_IMPORT_FUNCTION 206 +#define EVP_R_NO_KEYMGMT_AVAILABLE 199 +#define EVP_R_NO_KEYMGMT_PRESENT 196 +#define EVP_R_NO_KEY_SET 154 +#define EVP_R_NO_OPERATION_SET 149 +#define EVP_R_NULL_MAC_PKEY_CTX 208 +#define EVP_R_ONLY_ONESHOT_SUPPORTED 177 +#define EVP_R_OPERATION_NOT_INITIALIZED 151 +#define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150 +#define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_SIGNATURE_TYPE 226 +#define EVP_R_OUTPUT_WOULD_OVERFLOW 202 +#define EVP_R_PARAMETER_TOO_LARGE 187 +#define EVP_R_PARTIALLY_OVERLAPPING 162 +#define EVP_R_PBKDF2_ERROR 181 +#define EVP_R_PIPELINE_NOT_SUPPORTED 230 +#define EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED 179 +#define EVP_R_PRIVATE_KEY_DECODE_ERROR 145 +#define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146 +#define EVP_R_PROVIDER_ASYM_CIPHER_FAILURE 232 +#define EVP_R_PROVIDER_ASYM_CIPHER_NOT_SUPPORTED 235 +#define EVP_R_PROVIDER_KEYMGMT_FAILURE 233 +#define EVP_R_PROVIDER_KEYMGMT_NOT_SUPPORTED 236 +#define EVP_R_PROVIDER_SIGNATURE_FAILURE 234 +#define EVP_R_PROVIDER_SIGNATURE_NOT_SUPPORTED 237 +#define EVP_R_PUBLIC_KEY_NOT_RSA 106 +#define EVP_R_SETTING_XOF_FAILED 227 +#define EVP_R_SET_DEFAULT_PROPERTY_FAILURE 209 +#define EVP_R_SIGNATURE_TYPE_AND_KEY_TYPE_INCOMPATIBLE 228 +#define EVP_R_TOO_MANY_PIPES 231 +#define EVP_R_TOO_MANY_RECORDS 183 +#define EVP_R_UNABLE_TO_ENABLE_LOCKING 212 +#define EVP_R_UNABLE_TO_GET_MAXIMUM_REQUEST_SIZE 215 +#define EVP_R_UNABLE_TO_GET_RANDOM_STRENGTH 216 +#define EVP_R_UNABLE_TO_LOCK_CONTEXT 211 +#define EVP_R_UNABLE_TO_SET_CALLBACKS 217 +#define EVP_R_UNKNOWN_BITS 166 +#define EVP_R_UNKNOWN_CIPHER 160 +#define EVP_R_UNKNOWN_DIGEST 161 +#define EVP_R_UNKNOWN_KEY_TYPE 207 +#define EVP_R_UNKNOWN_MAX_SIZE 167 +#define EVP_R_UNKNOWN_OPTION 169 +#define EVP_R_UNKNOWN_PBE_ALGORITHM 121 +#define EVP_R_UNKNOWN_SECURITY_BITS 168 +#define EVP_R_UNSUPPORTED_ALGORITHM 156 +#define EVP_R_UNSUPPORTED_CIPHER 107 +#define EVP_R_UNSUPPORTED_KEYLENGTH 123 +#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 +#define EVP_R_UNSUPPORTED_KEY_SIZE 108 +#define EVP_R_UNSUPPORTED_KEY_TYPE 224 +#define EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS 135 +#define EVP_R_UNSUPPORTED_PRF 125 +#define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 +#define EVP_R_UNSUPPORTED_SALT_TYPE 126 +#define EVP_R_UPDATE_ERROR 189 +#define EVP_R_WRAP_MODE_NOT_ALLOWED 170 +#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 +#define EVP_R_XTS_DATA_UNIT_IS_TOO_LARGE 191 +#define EVP_R_XTS_DUPLICATED_KEYS 192 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/fips_names.h b/VCMP-LUA/modules/postgresql/include/openssl/fips_names.h new file mode 100644 index 0000000..3e310bb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/fips_names.h @@ -0,0 +1,50 @@ +/* + * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_FIPS_NAMES_H +#define OPENSSL_FIPS_NAMES_H +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Parameter names that the FIPS Provider defines + * All parameters are of type: OSSL_PARAM_UTF8_STRING + */ + +/* The following 4 Parameters are used for FIPS Self Testing */ + +/* The calculated MAC of the module file */ +#define OSSL_PROV_FIPS_PARAM_MODULE_MAC "module-mac" +/* The Version number for the fips install process */ +#define OSSL_PROV_FIPS_PARAM_INSTALL_VERSION "install-version" +/* The calculated MAC of the install status indicator */ +#define OSSL_PROV_FIPS_PARAM_INSTALL_MAC "install-mac" +/* The install status indicator */ +#define OSSL_PROV_FIPS_PARAM_INSTALL_STATUS "install-status" + +/* + * A boolean that determines if the FIPS conditional test errors result in + * the module entering an error state. + * Type: OSSL_PARAM_UTF8_STRING + */ +#define OSSL_PROV_FIPS_PARAM_CONDITIONAL_ERRORS "conditional-errors" + +/* The following are provided for backwards compatibility */ +#define OSSL_PROV_FIPS_PARAM_SECURITY_CHECKS OSSL_PROV_PARAM_SECURITY_CHECKS +#define OSSL_PROV_FIPS_PARAM_TLS1_PRF_EMS_CHECK OSSL_PROV_PARAM_TLS1_PRF_EMS_CHECK +#define OSSL_PROV_FIPS_PARAM_DRBG_TRUNC_DIGEST OSSL_PROV_PARAM_DRBG_TRUNC_DIGEST + +#ifdef __cplusplus +} +#endif + +#endif /* OPENSSL_FIPS_NAMES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/fipskey.h b/VCMP-LUA/modules/postgresql/include/openssl/fipskey.h new file mode 100644 index 0000000..a525ec3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/fipskey.h @@ -0,0 +1,47 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\fipskey.h.in + * + * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_FIPSKEY_H +#define OPENSSL_FIPSKEY_H +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The FIPS validation HMAC key, usable as an array initializer. + */ +/* clang-format off */ +#define FIPS_KEY_ELEMENTS \ + 0xf4, 0x55, 0x66, 0x50, 0xac, 0x31, 0xd3, 0x54, 0x61, 0x61, 0x0b, 0xac, 0x4e, 0xd8, 0x1b, 0x1a, 0x18, 0x1b, 0x2d, 0x8a, 0x43, 0xea, 0x28, 0x54, 0xcb, 0xae, 0x22, 0xca, 0x74, 0x56, 0x08, 0x13 +/* clang-format on */ + +/* + * The FIPS validation key, as a string. + */ +/* clang-format off */ +#define FIPS_KEY_STRING "f4556650ac31d35461610bac4ed81b1a181b2d8a43ea2854cbae22ca74560813" +/* clang-format on */ + +/* + * The FIPS provider vendor name, as a string. + */ +/* clang-format off */ +#define FIPS_VENDOR "OpenSSL non-compliant FIPS Provider" +/* clang-format on */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/hmac.h b/VCMP-LUA/modules/postgresql/include/openssl/hmac.h new file mode 100644 index 0000000..cb866b2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/hmac.h @@ -0,0 +1,62 @@ +/* + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_HMAC_H +#define OPENSSL_HMAC_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_HMAC_H +#endif + +#include + +#include + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HMAC_MAX_MD_CBLOCK 200 /* Deprecated */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 size_t HMAC_size(const HMAC_CTX *e); +OSSL_DEPRECATEDIN_3_0 HMAC_CTX *HMAC_CTX_new(void); +OSSL_DEPRECATEDIN_3_0 int HMAC_CTX_reset(HMAC_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 void HMAC_CTX_free(HMAC_CTX *ctx); +#endif +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 __owur int HMAC_Init(HMAC_CTX *ctx, + const void *key, int len, + const EVP_MD *md); +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md, ENGINE *impl); +OSSL_DEPRECATEDIN_3_0 int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, + size_t len); +OSSL_DEPRECATEDIN_3_0 int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, + unsigned int *len); +OSSL_DEPRECATEDIN_3_0 __owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); +OSSL_DEPRECATEDIN_3_0 void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); +OSSL_DEPRECATEDIN_3_0 const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); +#endif + +unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, + const unsigned char *data, size_t data_len, + unsigned char *md, unsigned int *md_len); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/hpke.h b/VCMP-LUA/modules/postgresql/include/openssl/hpke.h new file mode 100644 index 0000000..12496ff --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/hpke.h @@ -0,0 +1,169 @@ +/* + * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* APIs and data structures for HPKE (RFC9180) */ +#ifndef OSSL_HPKE_H +#define OSSL_HPKE_H +#pragma once + +#include + +/* HPKE modes */ +#define OSSL_HPKE_MODE_BASE 0 /* Base mode */ +#define OSSL_HPKE_MODE_PSK 1 /* Pre-shared key mode */ +#define OSSL_HPKE_MODE_AUTH 2 /* Authenticated mode */ +#define OSSL_HPKE_MODE_PSKAUTH 3 /* PSK+authenticated mode */ + +/* + * Max for ikm, psk, pskid, info and exporter contexts. + * RFC9180, section 7.2.1 RECOMMENDS 64 octets but we have test vectors from + * Appendix A.6.1 with a 66 octet IKM so we'll allow that. + */ +#define OSSL_HPKE_MAX_PARMLEN 66 +#define OSSL_HPKE_MIN_PSKLEN 32 +#define OSSL_HPKE_MAX_INFOLEN 1024 + +/* + * The (16bit) HPKE algorithm ID IANA codepoints + * If/when new IANA codepoints are added there are tables in + * crypto/hpke/hpke_util.c that must also be updated. + */ +#define OSSL_HPKE_KEM_ID_RESERVED 0x0000 /* not used */ +#define OSSL_HPKE_KEM_ID_P256 0x0010 /* NIST P-256 */ +#define OSSL_HPKE_KEM_ID_P384 0x0011 /* NIST P-384 */ +#define OSSL_HPKE_KEM_ID_P521 0x0012 /* NIST P-521 */ +#define OSSL_HPKE_KEM_ID_X25519 0x0020 /* Curve25519 */ +#define OSSL_HPKE_KEM_ID_X448 0x0021 /* Curve448 */ + +#define OSSL_HPKE_KDF_ID_RESERVED 0x0000 /* not used */ +#define OSSL_HPKE_KDF_ID_HKDF_SHA256 0x0001 /* HKDF-SHA256 */ +#define OSSL_HPKE_KDF_ID_HKDF_SHA384 0x0002 /* HKDF-SHA384 */ +#define OSSL_HPKE_KDF_ID_HKDF_SHA512 0x0003 /* HKDF-SHA512 */ + +#define OSSL_HPKE_AEAD_ID_RESERVED 0x0000 /* not used */ +#define OSSL_HPKE_AEAD_ID_AES_GCM_128 0x0001 /* AES-GCM-128 */ +#define OSSL_HPKE_AEAD_ID_AES_GCM_256 0x0002 /* AES-GCM-256 */ +#define OSSL_HPKE_AEAD_ID_CHACHA_POLY1305 0x0003 /* Chacha20-Poly1305 */ +#define OSSL_HPKE_AEAD_ID_EXPORTONLY 0xFFFF /* export-only fake ID */ + +/* strings for suite components */ +#define OSSL_HPKE_KEMSTR_P256 "P-256" /* KEM id 0x10 */ +#define OSSL_HPKE_KEMSTR_P384 "P-384" /* KEM id 0x11 */ +#define OSSL_HPKE_KEMSTR_P521 "P-521" /* KEM id 0x12 */ +#define OSSL_HPKE_KEMSTR_X25519 "X25519" /* KEM id 0x20 */ +#define OSSL_HPKE_KEMSTR_X448 "X448" /* KEM id 0x21 */ +#define OSSL_HPKE_KDFSTR_256 "hkdf-sha256" /* KDF id 1 */ +#define OSSL_HPKE_KDFSTR_384 "hkdf-sha384" /* KDF id 2 */ +#define OSSL_HPKE_KDFSTR_512 "hkdf-sha512" /* KDF id 3 */ +#define OSSL_HPKE_AEADSTR_AES128GCM "aes-128-gcm" /* AEAD id 1 */ +#define OSSL_HPKE_AEADSTR_AES256GCM "aes-256-gcm" /* AEAD id 2 */ +#define OSSL_HPKE_AEADSTR_CP "chacha20-poly1305" /* AEAD id 3 */ +#define OSSL_HPKE_AEADSTR_EXP "exporter" /* AEAD id 0xff */ + +/* + * Roles for use in creating an OSSL_HPKE_CTX, most + * important use of this is to control nonce reuse. + */ +#define OSSL_HPKE_ROLE_SENDER 0 +#define OSSL_HPKE_ROLE_RECEIVER 1 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + uint16_t kem_id; /* Key Encapsulation Method id */ + uint16_t kdf_id; /* Key Derivation Function id */ + uint16_t aead_id; /* AEAD alg id */ +} OSSL_HPKE_SUITE; + +/** + * Suite constants, use this like: + * OSSL_HPKE_SUITE myvar = OSSL_HPKE_SUITE_DEFAULT; + */ +#ifndef OPENSSL_NO_ECX +#define OSSL_HPKE_SUITE_DEFAULT \ + { \ + OSSL_HPKE_KEM_ID_X25519, \ + OSSL_HPKE_KDF_ID_HKDF_SHA256, \ + OSSL_HPKE_AEAD_ID_AES_GCM_128 \ + } +#else +#define OSSL_HPKE_SUITE_DEFAULT \ + { \ + OSSL_HPKE_KEM_ID_P256, \ + OSSL_HPKE_KDF_ID_HKDF_SHA256, \ + OSSL_HPKE_AEAD_ID_AES_GCM_128 \ + } +#endif + +typedef struct ossl_hpke_ctx_st OSSL_HPKE_CTX; + +OSSL_HPKE_CTX *OSSL_HPKE_CTX_new(int mode, OSSL_HPKE_SUITE suite, int role, + OSSL_LIB_CTX *libctx, const char *propq); +void OSSL_HPKE_CTX_free(OSSL_HPKE_CTX *ctx); + +int OSSL_HPKE_encap(OSSL_HPKE_CTX *ctx, + unsigned char *enc, size_t *enclen, + const unsigned char *pub, size_t publen, + const unsigned char *info, size_t infolen); +int OSSL_HPKE_seal(OSSL_HPKE_CTX *ctx, + unsigned char *ct, size_t *ctlen, + const unsigned char *aad, size_t aadlen, + const unsigned char *pt, size_t ptlen); + +int OSSL_HPKE_keygen(OSSL_HPKE_SUITE suite, + unsigned char *pub, size_t *publen, EVP_PKEY **priv, + const unsigned char *ikm, size_t ikmlen, + OSSL_LIB_CTX *libctx, const char *propq); +int OSSL_HPKE_decap(OSSL_HPKE_CTX *ctx, + const unsigned char *enc, size_t enclen, + EVP_PKEY *recippriv, + const unsigned char *info, size_t infolen); +int OSSL_HPKE_open(OSSL_HPKE_CTX *ctx, + unsigned char *pt, size_t *ptlen, + const unsigned char *aad, size_t aadlen, + const unsigned char *ct, size_t ctlen); + +int OSSL_HPKE_export(OSSL_HPKE_CTX *ctx, + unsigned char *secret, + size_t secretlen, + const unsigned char *label, + size_t labellen); + +int OSSL_HPKE_CTX_set1_authpriv(OSSL_HPKE_CTX *ctx, EVP_PKEY *priv); +int OSSL_HPKE_CTX_set1_authpub(OSSL_HPKE_CTX *ctx, + const unsigned char *pub, + size_t publen); +int OSSL_HPKE_CTX_set1_psk(OSSL_HPKE_CTX *ctx, + const char *pskid, + const unsigned char *psk, size_t psklen); + +int OSSL_HPKE_CTX_set1_ikme(OSSL_HPKE_CTX *ctx, + const unsigned char *ikme, size_t ikmelen); + +int OSSL_HPKE_CTX_set_seq(OSSL_HPKE_CTX *ctx, uint64_t seq); +int OSSL_HPKE_CTX_get_seq(OSSL_HPKE_CTX *ctx, uint64_t *seq); + +int OSSL_HPKE_suite_check(OSSL_HPKE_SUITE suite); +int OSSL_HPKE_get_grease_value(const OSSL_HPKE_SUITE *suite_in, + OSSL_HPKE_SUITE *suite, + unsigned char *enc, size_t *enclen, + unsigned char *ct, size_t ctlen, + OSSL_LIB_CTX *libctx, const char *propq); +int OSSL_HPKE_str2suite(const char *str, OSSL_HPKE_SUITE *suite); +size_t OSSL_HPKE_get_ciphertext_size(OSSL_HPKE_SUITE suite, size_t clearlen); +size_t OSSL_HPKE_get_public_encap_size(OSSL_HPKE_SUITE suite); +size_t OSSL_HPKE_get_recommended_ikmelen(OSSL_HPKE_SUITE suite); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/http.h b/VCMP-LUA/modules/postgresql/include/openssl/http.h new file mode 100644 index 0000000..91aa923 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/http.h @@ -0,0 +1,117 @@ +/* + * Copyright 2000-2025 The OpenSSL Project Authors. All Rights Reserved. + * Copyright Siemens AG 2018-2020 + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_HTTP_H +#define OPENSSL_HTTP_H +#pragma once + +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OSSL_HTTP_NAME "http" +#define OSSL_HTTPS_NAME "https" +#define OSSL_HTTP_PREFIX OSSL_HTTP_NAME "://" +#define OSSL_HTTPS_PREFIX OSSL_HTTPS_NAME "://" +#define OSSL_HTTP_PORT "80" +#define OSSL_HTTPS_PORT "443" +#define OPENSSL_NO_PROXY "NO_PROXY" +#define OPENSSL_HTTP_PROXY "HTTP_PROXY" +#define OPENSSL_HTTPS_PROXY "HTTPS_PROXY" + +/* We want to have this even in case of OPENSSL_NO_HTTP */ +int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost, + char **pport, int *pport_num, + char **ppath, char **pquery, char **pfrag); + +#ifndef OPENSSL_NO_HTTP + +#define OSSL_HTTP_DEFAULT_MAX_LINE_LEN (4 * 1024) +#define OSSL_HTTP_DEFAULT_MAX_RESP_LEN (100 * 1024) +#define OSSL_HTTP_DEFAULT_MAX_CRL_LEN (32 * 1024 * 1024) +#define OSSL_HTTP_DEFAULT_MAX_RESP_HDR_LINES 256 + +/* Low-level HTTP API */ +OSSL_HTTP_REQ_CTX *OSSL_HTTP_REQ_CTX_new(BIO *wbio, BIO *rbio, int buf_size); +void OSSL_HTTP_REQ_CTX_free(OSSL_HTTP_REQ_CTX *rctx); +int OSSL_HTTP_REQ_CTX_set_request_line(OSSL_HTTP_REQ_CTX *rctx, int method_POST, + const char *server, const char *port, + const char *path); +int OSSL_HTTP_REQ_CTX_add1_header(OSSL_HTTP_REQ_CTX *rctx, + const char *name, const char *value); +int OSSL_HTTP_REQ_CTX_set_expected(OSSL_HTTP_REQ_CTX *rctx, + const char *content_type, int asn1, + int timeout, int keep_alive); +int OSSL_HTTP_REQ_CTX_set1_req(OSSL_HTTP_REQ_CTX *rctx, const char *content_type, + const ASN1_ITEM *it, const ASN1_VALUE *req); +int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx); +int OSSL_HTTP_REQ_CTX_nbio_d2i(OSSL_HTTP_REQ_CTX *rctx, + ASN1_VALUE **pval, const ASN1_ITEM *it); +BIO *OSSL_HTTP_REQ_CTX_exchange(OSSL_HTTP_REQ_CTX *rctx); +BIO *OSSL_HTTP_REQ_CTX_get0_mem_bio(const OSSL_HTTP_REQ_CTX *rctx); +size_t OSSL_HTTP_REQ_CTX_get_resp_len(const OSSL_HTTP_REQ_CTX *rctx); +void OSSL_HTTP_REQ_CTX_set_max_response_length(OSSL_HTTP_REQ_CTX *rctx, + unsigned long len); +void OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines(OSSL_HTTP_REQ_CTX *rctx, + size_t count); +int OSSL_HTTP_is_alive(const OSSL_HTTP_REQ_CTX *rctx); + +/* High-level HTTP API */ +typedef BIO *(*OSSL_HTTP_bio_cb_t)(BIO *bio, void *arg, int connect, int detail); +OSSL_HTTP_REQ_CTX *OSSL_HTTP_open(const char *server, const char *port, + const char *proxy, const char *no_proxy, + int use_ssl, BIO *bio, BIO *rbio, + OSSL_HTTP_bio_cb_t bio_update_fn, void *arg, + int buf_size, int overall_timeout); +int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port, + const char *proxyuser, const char *proxypass, + int timeout, BIO *bio_err, const char *prog); +int OSSL_HTTP_set1_request(OSSL_HTTP_REQ_CTX *rctx, const char *path, + const STACK_OF(CONF_VALUE) *headers, + const char *content_type, BIO *req, + const char *expected_content_type, int expect_asn1, + size_t max_resp_len, int timeout, int keep_alive); +BIO *OSSL_HTTP_exchange(OSSL_HTTP_REQ_CTX *rctx, char **redirection_url); +BIO *OSSL_HTTP_get(const char *url, const char *proxy, const char *no_proxy, + BIO *bio, BIO *rbio, + OSSL_HTTP_bio_cb_t bio_update_fn, void *arg, + int buf_size, const STACK_OF(CONF_VALUE) *headers, + const char *expected_content_type, int expect_asn1, + size_t max_resp_len, int timeout); +BIO *OSSL_HTTP_transfer(OSSL_HTTP_REQ_CTX **prctx, + const char *server, const char *port, + const char *path, int use_ssl, + const char *proxy, const char *no_proxy, + BIO *bio, BIO *rbio, + OSSL_HTTP_bio_cb_t bio_update_fn, void *arg, + int buf_size, const STACK_OF(CONF_VALUE) *headers, + const char *content_type, BIO *req, + const char *expected_content_type, int expect_asn1, + size_t max_resp_len, int timeout, int keep_alive); +int OSSL_HTTP_close(OSSL_HTTP_REQ_CTX *rctx, int ok); + +/* Auxiliary functions */ +int OSSL_HTTP_parse_url(const char *url, int *pssl, char **puser, char **phost, + char **pport, int *pport_num, + char **ppath, char **pquery, char **pfrag); +const char *OSSL_HTTP_adapt_proxy(const char *proxy, const char *no_proxy, + const char *server, int use_ssl); + +#endif /* !defined(OPENSSL_NO_HTTP) */ +#ifdef __cplusplus +} +#endif +#endif /* !defined(OPENSSL_HTTP_H) */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/httperr.h b/VCMP-LUA/modules/postgresql/include/openssl/httperr.h new file mode 100644 index 0000000..4c1cc6a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/httperr.h @@ -0,0 +1,55 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_HTTPERR_H +#define OPENSSL_HTTPERR_H +#pragma once + +#include +#include +#include + +/* + * HTTP reason codes. + */ +#define HTTP_R_ASN1_LEN_EXCEEDS_MAX_RESP_LEN 108 +#define HTTP_R_CONNECT_FAILURE 100 +#define HTTP_R_CONTENT_TYPE_MISMATCH 131 +#define HTTP_R_ERROR_PARSING_ASN1_LENGTH 109 +#define HTTP_R_ERROR_PARSING_CONTENT_LENGTH 119 +#define HTTP_R_ERROR_PARSING_URL 101 +#define HTTP_R_ERROR_RECEIVING 103 +#define HTTP_R_ERROR_SENDING 102 +#define HTTP_R_FAILED_READING_DATA 128 +#define HTTP_R_HEADER_PARSE_ERROR 126 +#define HTTP_R_INCONSISTENT_CONTENT_LENGTH 120 +#define HTTP_R_INVALID_PORT_NUMBER 123 +#define HTTP_R_INVALID_URL_PATH 125 +#define HTTP_R_INVALID_URL_SCHEME 124 +#define HTTP_R_MAX_RESP_LEN_EXCEEDED 117 +#define HTTP_R_MISSING_ASN1_ENCODING 110 +#define HTTP_R_MISSING_CONTENT_TYPE 121 +#define HTTP_R_MISSING_REDIRECT_LOCATION 111 +#define HTTP_R_RECEIVED_ERROR 105 +#define HTTP_R_RECEIVED_WRONG_HTTP_VERSION 106 +#define HTTP_R_REDIRECTION_FROM_HTTPS_TO_HTTP 112 +#define HTTP_R_REDIRECTION_NOT_ENABLED 116 +#define HTTP_R_RESPONSE_LINE_TOO_LONG 113 +#define HTTP_R_RESPONSE_PARSE_ERROR 104 +#define HTTP_R_RESPONSE_TOO_MANY_HDRLINES 130 +#define HTTP_R_RETRY_TIMEOUT 129 +#define HTTP_R_SERVER_CANCELED_CONNECTION 127 +#define HTTP_R_SOCK_NOT_SUPPORTED 122 +#define HTTP_R_STATUS_CODE_UNSUPPORTED 114 +#define HTTP_R_TLS_NOT_ENABLED 107 +#define HTTP_R_TOO_MANY_REDIRECTIONS 115 +#define HTTP_R_UNEXPECTED_CONTENT_TYPE 118 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/idea.h b/VCMP-LUA/modules/postgresql/include/openssl/idea.h new file mode 100644 index 0000000..674a941 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/idea.h @@ -0,0 +1,82 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_IDEA_H +#define OPENSSL_IDEA_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_IDEA_H +#endif + +#include + +#ifndef OPENSSL_NO_IDEA +#ifdef __cplusplus +extern "C" { +#endif + +#define IDEA_BLOCK 8 +#define IDEA_KEY_LENGTH 16 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + +typedef unsigned int IDEA_INT; + +#define IDEA_ENCRYPT 1 +#define IDEA_DECRYPT 0 + +typedef struct idea_key_st { + IDEA_INT data[9][6]; +} IDEA_KEY_SCHEDULE; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 const char *IDEA_options(void); +OSSL_DEPRECATEDIN_3_0 void IDEA_ecb_encrypt(const unsigned char *in, + unsigned char *out, + IDEA_KEY_SCHEDULE *ks); +OSSL_DEPRECATEDIN_3_0 void IDEA_set_encrypt_key(const unsigned char *key, + IDEA_KEY_SCHEDULE *ks); +OSSL_DEPRECATEDIN_3_0 void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, + IDEA_KEY_SCHEDULE *dk); +OSSL_DEPRECATEDIN_3_0 void IDEA_cbc_encrypt(const unsigned char *in, + unsigned char *out, long length, + IDEA_KEY_SCHEDULE *ks, + unsigned char *iv, int enc); +OSSL_DEPRECATEDIN_3_0 void IDEA_cfb64_encrypt(const unsigned char *in, + unsigned char *out, long length, + IDEA_KEY_SCHEDULE *ks, + unsigned char *iv, int *num, + int enc); +OSSL_DEPRECATEDIN_3_0 void IDEA_ofb64_encrypt(const unsigned char *in, + unsigned char *out, long length, + IDEA_KEY_SCHEDULE *ks, + unsigned char *iv, int *num); +OSSL_DEPRECATEDIN_3_0 void IDEA_encrypt(unsigned long *in, + IDEA_KEY_SCHEDULE *ks); +#endif + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define idea_options IDEA_options +#define idea_ecb_encrypt IDEA_ecb_encrypt +#define idea_set_encrypt_key IDEA_set_encrypt_key +#define idea_set_decrypt_key IDEA_set_decrypt_key +#define idea_cbc_encrypt IDEA_cbc_encrypt +#define idea_cfb64_encrypt IDEA_cfb64_encrypt +#define idea_ofb64_encrypt IDEA_ofb64_encrypt +#define idea_encrypt IDEA_encrypt +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/indicator.h b/VCMP-LUA/modules/postgresql/include/openssl/indicator.h new file mode 100644 index 0000000..66d6f42 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/indicator.h @@ -0,0 +1,31 @@ +/* + * Copyright 2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_INDICATOR_H +#define OPENSSL_INDICATOR_H +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef int(OSSL_INDICATOR_CALLBACK)(const char *type, const char *desc, + const OSSL_PARAM params[]); + +void OSSL_INDICATOR_set_callback(OSSL_LIB_CTX *libctx, + OSSL_INDICATOR_CALLBACK *cb); +void OSSL_INDICATOR_get_callback(OSSL_LIB_CTX *libctx, + OSSL_INDICATOR_CALLBACK **cb); + +#ifdef __cplusplus +} +#endif +#endif /* OPENSSL_INDICATOR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/kdf.h b/VCMP-LUA/modules/postgresql/include/openssl/kdf.h new file mode 100644 index 0000000..f3267ea --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/kdf.h @@ -0,0 +1,141 @@ +/* + * Copyright 2016-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_KDF_H +#define OPENSSL_KDF_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_KDF_H +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int EVP_KDF_up_ref(EVP_KDF *kdf); +void EVP_KDF_free(EVP_KDF *kdf); +EVP_KDF *EVP_KDF_fetch(OSSL_LIB_CTX *libctx, const char *algorithm, + const char *properties); + +EVP_KDF_CTX *EVP_KDF_CTX_new(EVP_KDF *kdf); +void EVP_KDF_CTX_free(EVP_KDF_CTX *ctx); +EVP_KDF_CTX *EVP_KDF_CTX_dup(const EVP_KDF_CTX *src); +const char *EVP_KDF_get0_description(const EVP_KDF *kdf); +int EVP_KDF_is_a(const EVP_KDF *kdf, const char *name); +const char *EVP_KDF_get0_name(const EVP_KDF *kdf); +const OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf); +const EVP_KDF *EVP_KDF_CTX_kdf(EVP_KDF_CTX *ctx); + +void EVP_KDF_CTX_reset(EVP_KDF_CTX *ctx); +size_t EVP_KDF_CTX_get_kdf_size(EVP_KDF_CTX *ctx); +int EVP_KDF_derive(EVP_KDF_CTX *ctx, unsigned char *key, size_t keylen, + const OSSL_PARAM params[]); +int EVP_KDF_CTX_set_SKEY(EVP_KDF_CTX *ctx, EVP_SKEY *key, const char *paramname); +EVP_SKEY *EVP_KDF_derive_SKEY(EVP_KDF_CTX *ctx, EVP_SKEYMGMT *mgmt, + const char *key_type, const char *propquery, + size_t keylen, const OSSL_PARAM params[]); +int EVP_KDF_get_params(EVP_KDF *kdf, OSSL_PARAM params[]); +int EVP_KDF_CTX_get_params(EVP_KDF_CTX *ctx, OSSL_PARAM params[]); +int EVP_KDF_CTX_set_params(EVP_KDF_CTX *ctx, const OSSL_PARAM params[]); +const OSSL_PARAM *EVP_KDF_gettable_params(const EVP_KDF *kdf); +const OSSL_PARAM *EVP_KDF_gettable_ctx_params(const EVP_KDF *kdf); +const OSSL_PARAM *EVP_KDF_settable_ctx_params(const EVP_KDF *kdf); +const OSSL_PARAM *EVP_KDF_CTX_gettable_params(EVP_KDF_CTX *ctx); +const OSSL_PARAM *EVP_KDF_CTX_settable_params(EVP_KDF_CTX *ctx); + +void EVP_KDF_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(EVP_KDF *kdf, void *arg), + void *arg); +int EVP_KDF_names_do_all(const EVP_KDF *kdf, + void (*fn)(const char *name, void *data), + void *data); + +#define EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND 0 +#define EVP_KDF_HKDF_MODE_EXTRACT_ONLY 1 +#define EVP_KDF_HKDF_MODE_EXPAND_ONLY 2 + +#define EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV 65 +#define EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI 66 +#define EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV 67 +#define EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI 68 +#define EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV 69 +#define EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI 70 + +/**** The legacy PKEY-based KDF API follows. ****/ + +#define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL) +#define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1) +#define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2) +#define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3) +#define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4) +#define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5) +#define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6) +#define EVP_PKEY_CTRL_HKDF_MODE (EVP_PKEY_ALG_CTRL + 7) +#define EVP_PKEY_CTRL_PASS (EVP_PKEY_ALG_CTRL + 8) +#define EVP_PKEY_CTRL_SCRYPT_SALT (EVP_PKEY_ALG_CTRL + 9) +#define EVP_PKEY_CTRL_SCRYPT_N (EVP_PKEY_ALG_CTRL + 10) +#define EVP_PKEY_CTRL_SCRYPT_R (EVP_PKEY_ALG_CTRL + 11) +#define EVP_PKEY_CTRL_SCRYPT_P (EVP_PKEY_ALG_CTRL + 12) +#define EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES (EVP_PKEY_ALG_CTRL + 13) + +#define EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND \ + EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND +#define EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY \ + EVP_KDF_HKDF_MODE_EXTRACT_ONLY +#define EVP_PKEY_HKDEF_MODE_EXPAND_ONLY \ + EVP_KDF_HKDF_MODE_EXPAND_ONLY + +int EVP_PKEY_CTX_set_tls1_prf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); + +int EVP_PKEY_CTX_set1_tls1_prf_secret(EVP_PKEY_CTX *pctx, + const unsigned char *sec, int seclen); + +int EVP_PKEY_CTX_add1_tls1_prf_seed(EVP_PKEY_CTX *pctx, + const unsigned char *seed, int seedlen); + +int EVP_PKEY_CTX_set_hkdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); + +int EVP_PKEY_CTX_set1_hkdf_salt(EVP_PKEY_CTX *ctx, + const unsigned char *salt, int saltlen); + +int EVP_PKEY_CTX_set1_hkdf_key(EVP_PKEY_CTX *ctx, + const unsigned char *key, int keylen); + +int EVP_PKEY_CTX_add1_hkdf_info(EVP_PKEY_CTX *ctx, + const unsigned char *info, int infolen); + +int EVP_PKEY_CTX_set_hkdf_mode(EVP_PKEY_CTX *ctx, int mode); +#define EVP_PKEY_CTX_hkdf_mode EVP_PKEY_CTX_set_hkdf_mode + +int EVP_PKEY_CTX_set1_pbe_pass(EVP_PKEY_CTX *ctx, const char *pass, + int passlen); + +int EVP_PKEY_CTX_set1_scrypt_salt(EVP_PKEY_CTX *ctx, + const unsigned char *salt, int saltlen); + +int EVP_PKEY_CTX_set_scrypt_N(EVP_PKEY_CTX *ctx, uint64_t n); + +int EVP_PKEY_CTX_set_scrypt_r(EVP_PKEY_CTX *ctx, uint64_t r); + +int EVP_PKEY_CTX_set_scrypt_p(EVP_PKEY_CTX *ctx, uint64_t p); + +int EVP_PKEY_CTX_set_scrypt_maxmem_bytes(EVP_PKEY_CTX *ctx, + uint64_t maxmem_bytes); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/kdferr.h b/VCMP-LUA/modules/postgresql/include/openssl/kdferr.h new file mode 100644 index 0000000..a2c1f24 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/kdferr.h @@ -0,0 +1,16 @@ +/* + * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_KDFERR_H +#define OPENSSL_KDFERR_H +#pragma once + +#include + +#endif /* !defined(OPENSSL_KDFERR_H) */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/lhash.h b/VCMP-LUA/modules/postgresql/include/openssl/lhash.h new file mode 100644 index 0000000..dab9372 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/lhash.h @@ -0,0 +1,417 @@ +/* + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +/* + * Header for dynamic hash table routines Author - Eric Young + */ + +#ifndef OPENSSL_LHASH_H +#define OPENSSL_LHASH_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_LHASH_H +#endif + +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lhash_node_st OPENSSL_LH_NODE; +typedef int (*OPENSSL_LH_COMPFUNC)(const void *, const void *); +typedef int (*OPENSSL_LH_COMPFUNCTHUNK)(const void *, const void *, OPENSSL_LH_COMPFUNC cfn); +typedef unsigned long (*OPENSSL_LH_HASHFUNC)(const void *); +typedef unsigned long (*OPENSSL_LH_HASHFUNCTHUNK)(const void *, OPENSSL_LH_HASHFUNC hfn); +typedef void (*OPENSSL_LH_DOALL_FUNC)(void *); +typedef void (*OPENSSL_LH_DOALL_FUNC_THUNK)(void *, OPENSSL_LH_DOALL_FUNC doall); +typedef void (*OPENSSL_LH_DOALL_FUNCARG)(void *, void *); +typedef void (*OPENSSL_LH_DOALL_FUNCARG_THUNK)(void *, void *, OPENSSL_LH_DOALL_FUNCARG doall); +typedef struct lhash_st OPENSSL_LHASH; + +/* + * Macros for declaring and implementing type-safe wrappers for LHASH + * callbacks. This way, callbacks can be provided to LHASH structures without + * function pointer casting and the macro-defined callbacks provide + * per-variable casting before deferring to the underlying type-specific + * callbacks. NB: It is possible to place a "static" in front of both the + * DECLARE and IMPLEMENT macros if the functions are strictly internal. + */ + +/* First: "hash" functions */ +#define DECLARE_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void *); +#define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void *arg) \ + { \ + const o_type *a = arg; \ + return name##_hash(a); \ + } +#define LHASH_HASH_FN(name) name##_LHASH_HASH + +/* Second: "compare" functions */ +#define DECLARE_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void *, const void *); +#define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void *arg1, const void *arg2) \ + { \ + const o_type *a = arg1; \ + const o_type *b = arg2; \ + return name##_cmp(a, b); \ + } +#define LHASH_COMP_FN(name) name##_LHASH_COMP + +/* Fourth: "doall_arg" functions */ +#define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void *, void *); +#define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) \ + { \ + o_type *a = arg1; \ + a_type *b = arg2; \ + name##_doall_arg(a, b); \ + } +#define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG + +#define LH_LOAD_MULT 256 + +int OPENSSL_LH_error(OPENSSL_LHASH *lh); +OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c); +OPENSSL_LHASH *OPENSSL_LH_set_thunks(OPENSSL_LHASH *lh, + OPENSSL_LH_HASHFUNCTHUNK hw, + OPENSSL_LH_COMPFUNCTHUNK cw, + OPENSSL_LH_DOALL_FUNC_THUNK daw, + OPENSSL_LH_DOALL_FUNCARG_THUNK daaw); +void OPENSSL_LH_free(OPENSSL_LHASH *lh); +void OPENSSL_LH_flush(OPENSSL_LHASH *lh); +void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data); +void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data); +void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data); +void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func); +void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, + OPENSSL_LH_DOALL_FUNCARG func, void *arg); +void OPENSSL_LH_doall_arg_thunk(OPENSSL_LHASH *lh, + OPENSSL_LH_DOALL_FUNCARG_THUNK daaw, + OPENSSL_LH_DOALL_FUNCARG fn, void *arg); + +unsigned long OPENSSL_LH_strhash(const char *c); +unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh); +unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh); +void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load); + +#ifndef OPENSSL_NO_STDIO +#ifndef OPENSSL_NO_DEPRECATED_3_1 +OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp); +OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp); +OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp); +#endif +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_1 +OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out); +OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out); +OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out); +#endif + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define _LHASH OPENSSL_LHASH +#define LHASH_NODE OPENSSL_LH_NODE +#define lh_error OPENSSL_LH_error +#define lh_new OPENSSL_LH_new +#define lh_free OPENSSL_LH_free +#define lh_insert OPENSSL_LH_insert +#define lh_delete OPENSSL_LH_delete +#define lh_retrieve OPENSSL_LH_retrieve +#define lh_doall OPENSSL_LH_doall +#define lh_doall_arg OPENSSL_LH_doall_arg +#define lh_strhash OPENSSL_LH_strhash +#define lh_num_items OPENSSL_LH_num_items +#ifndef OPENSSL_NO_STDIO +#define lh_stats OPENSSL_LH_stats +#define lh_node_stats OPENSSL_LH_node_stats +#define lh_node_usage_stats OPENSSL_LH_node_usage_stats +#endif +#define lh_stats_bio OPENSSL_LH_stats_bio +#define lh_node_stats_bio OPENSSL_LH_node_stats_bio +#define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio +#endif + +/* Type checking... */ + +#define LHASH_OF(type) struct lhash_st_##type + +/* Helper macro for internal use */ +#define DEFINE_LHASH_OF_INTERNAL(type) \ + LHASH_OF(type) \ + { \ + union lh_##type##_dummy { \ + void *d1; \ + unsigned long d2; \ + int d3; \ + } dummy; \ + }; \ + typedef int (*lh_##type##_compfunc)(const type *a, const type *b); \ + typedef unsigned long (*lh_##type##_hashfunc)(const type *a); \ + typedef void (*lh_##type##_doallfunc)(type * a); \ + static ossl_inline unsigned long lh_##type##_hash_thunk(const void *data, OPENSSL_LH_HASHFUNC hfn) \ + { \ + unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \ + return hfn_conv((const type *)data); \ + } \ + static ossl_inline int lh_##type##_comp_thunk(const void *da, const void *db, OPENSSL_LH_COMPFUNC cfn) \ + { \ + int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn; \ + return cfn_conv((const type *)da, (const type *)db); \ + } \ + static ossl_inline void lh_##type##_doall_thunk(void *node, OPENSSL_LH_DOALL_FUNC doall) \ + { \ + void (*doall_conv)(type *) = (void (*)(type *))doall; \ + doall_conv((type *)node); \ + } \ + static ossl_inline void lh_##type##_doall_arg_thunk(void *node, void *arg, OPENSSL_LH_DOALL_FUNCARG doall) \ + { \ + void (*doall_conv)(type *, void *) = (void (*)(type *, void *))doall; \ + doall_conv((type *)node, arg); \ + } \ + static ossl_unused ossl_inline type * \ + ossl_check_##type##_lh_plain_type(type *ptr) \ + { \ + return ptr; \ + } \ + static ossl_unused ossl_inline const type * \ + ossl_check_const_##type##_lh_plain_type(const type *ptr) \ + { \ + return ptr; \ + } \ + static ossl_unused ossl_inline const OPENSSL_LHASH * \ + ossl_check_const_##type##_lh_type(const LHASH_OF(type) *lh) \ + { \ + return (const OPENSSL_LHASH *)lh; \ + } \ + static ossl_unused ossl_inline OPENSSL_LHASH * \ + ossl_check_##type##_lh_type(LHASH_OF(type) *lh) \ + { \ + return (OPENSSL_LHASH *)lh; \ + } \ + static ossl_unused ossl_inline OPENSSL_LH_COMPFUNC \ + ossl_check_##type##_lh_compfunc_type(lh_##type##_compfunc cmp) \ + { \ + return (OPENSSL_LH_COMPFUNC)cmp; \ + } \ + static ossl_unused ossl_inline OPENSSL_LH_HASHFUNC \ + ossl_check_##type##_lh_hashfunc_type(lh_##type##_hashfunc hfn) \ + { \ + return (OPENSSL_LH_HASHFUNC)hfn; \ + } \ + static ossl_unused ossl_inline OPENSSL_LH_DOALL_FUNC \ + ossl_check_##type##_lh_doallfunc_type(lh_##type##_doallfunc dfn) \ + { \ + return (OPENSSL_LH_DOALL_FUNC)dfn; \ + } \ + LHASH_OF(type) + +#ifndef OPENSSL_NO_DEPRECATED_3_1 +#define DEFINE_LHASH_OF_DEPRECATED(type) \ + static ossl_unused ossl_inline void \ + lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } +#else +#define DEFINE_LHASH_OF_DEPRECATED(type) +#endif + +#define DEFINE_LHASH_OF_EX(type) \ + LHASH_OF(type) \ + { \ + union lh_##type##_dummy { \ + void *d1; \ + unsigned long d2; \ + int d3; \ + } dummy; \ + }; \ + static unsigned long \ + lh_##type##_hfn_thunk(const void *data, OPENSSL_LH_HASHFUNC hfn) \ + { \ + unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \ + return hfn_conv((const type *)data); \ + } \ + static int lh_##type##_cfn_thunk(const void *da, const void *db, OPENSSL_LH_COMPFUNC cfn) \ + { \ + int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn; \ + return cfn_conv((const type *)da, (const type *)db); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_free(LHASH_OF(type) *lh) \ + { \ + OPENSSL_LH_free((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_flush(LHASH_OF(type) *lh) \ + { \ + OPENSSL_LH_flush((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline type * \ + lh_##type##_insert(LHASH_OF(type) *lh, type *d) \ + { \ + return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline type * \ + lh_##type##_delete(LHASH_OF(type) *lh, const type *d) \ + { \ + return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline type * \ + lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d) \ + { \ + return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline int \ + lh_##type##_error(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline unsigned long \ + lh_##type##_num_items(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline unsigned long \ + lh_##type##_get_down_load(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl) \ + { \ + OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_doall_thunk(void *node, OPENSSL_LH_DOALL_FUNC doall) \ + { \ + void (*doall_conv)(type *) = (void (*)(type *))doall; \ + doall_conv((type *)node); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_doall_arg_thunk(void *node, void *arg, OPENSSL_LH_DOALL_FUNCARG doall) \ + { \ + void (*doall_conv)(type *, void *) = (void (*)(type *, void *))doall; \ + doall_conv((type *)node, arg); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_doall(LHASH_OF(type) *lh, void (*doall)(type *)) \ + { \ + OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \ + } \ + static ossl_unused ossl_inline LHASH_OF(type) * \ + lh_##type##_new(unsigned long (*hfn)(const type *), \ + int (*cfn)(const type *, const type *)) \ + { \ + return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \ + lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \ + lh_##type##_doall_thunk, \ + lh_##type##_doall_arg_thunk); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_doall_arg(LHASH_OF(type) *lh, \ + void (*doallarg)(type *, void *), void *arg) \ + { \ + OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, \ + (OPENSSL_LH_DOALL_FUNCARG)doallarg, arg); \ + } \ + LHASH_OF(type) + +#define DEFINE_LHASH_OF(type) \ + DEFINE_LHASH_OF_EX(type); \ + DEFINE_LHASH_OF_DEPRECATED(type) \ + LHASH_OF(type) + +#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \ + int_implement_lhash_doall(type, argtype, const type) + +#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \ + int_implement_lhash_doall(type, argtype, type) + +#define int_implement_lhash_doall(type, argtype, cbargtype) \ + static ossl_unused ossl_inline void \ + lh_##type##_doall_##argtype##_thunk(void *node, void *arg, OPENSSL_LH_DOALL_FUNCARG fn) \ + { \ + void (*fn_conv)(cbargtype *, argtype *) = (void (*)(cbargtype *, argtype *))fn; \ + fn_conv((cbargtype *)node, (argtype *)arg); \ + } \ + static ossl_unused ossl_inline void \ + lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \ + void (*fn)(cbargtype *, argtype *), \ + argtype *arg) \ + { \ + OPENSSL_LH_doall_arg_thunk((OPENSSL_LHASH *)lh, \ + lh_##type##_doall_##argtype##_thunk, \ + (OPENSSL_LH_DOALL_FUNCARG)fn, \ + (void *)arg); \ + } \ + LHASH_OF(type) + +/* clang-format off */ +DEFINE_LHASH_OF_INTERNAL(OPENSSL_STRING); +#define lh_OPENSSL_STRING_new(hfn, cmp) ((LHASH_OF(OPENSSL_STRING) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_OPENSSL_STRING_lh_hashfunc_type(hfn), ossl_check_OPENSSL_STRING_lh_compfunc_type(cmp)), lh_OPENSSL_STRING_hash_thunk, lh_OPENSSL_STRING_comp_thunk, lh_OPENSSL_STRING_doall_thunk, lh_OPENSSL_STRING_doall_arg_thunk)) +#define lh_OPENSSL_STRING_free(lh) OPENSSL_LH_free(ossl_check_OPENSSL_STRING_lh_type(lh)) +#define lh_OPENSSL_STRING_flush(lh) OPENSSL_LH_flush(ossl_check_OPENSSL_STRING_lh_type(lh)) +#define lh_OPENSSL_STRING_insert(lh, ptr) ((OPENSSL_STRING *)OPENSSL_LH_insert(ossl_check_OPENSSL_STRING_lh_type(lh), ossl_check_OPENSSL_STRING_lh_plain_type(ptr))) +#define lh_OPENSSL_STRING_delete(lh, ptr) ((OPENSSL_STRING *)OPENSSL_LH_delete(ossl_check_OPENSSL_STRING_lh_type(lh), ossl_check_const_OPENSSL_STRING_lh_plain_type(ptr))) +#define lh_OPENSSL_STRING_retrieve(lh, ptr) ((OPENSSL_STRING *)OPENSSL_LH_retrieve(ossl_check_OPENSSL_STRING_lh_type(lh), ossl_check_const_OPENSSL_STRING_lh_plain_type(ptr))) +#define lh_OPENSSL_STRING_error(lh) OPENSSL_LH_error(ossl_check_OPENSSL_STRING_lh_type(lh)) +#define lh_OPENSSL_STRING_num_items(lh) OPENSSL_LH_num_items(ossl_check_OPENSSL_STRING_lh_type(lh)) +#define lh_OPENSSL_STRING_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_OPENSSL_STRING_lh_type(lh), out) +#define lh_OPENSSL_STRING_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_OPENSSL_STRING_lh_type(lh), out) +#define lh_OPENSSL_STRING_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_OPENSSL_STRING_lh_type(lh), out) +#define lh_OPENSSL_STRING_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_OPENSSL_STRING_lh_type(lh)) +#define lh_OPENSSL_STRING_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_OPENSSL_STRING_lh_type(lh), dl) +#define lh_OPENSSL_STRING_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_OPENSSL_STRING_lh_type(lh), ossl_check_OPENSSL_STRING_lh_doallfunc_type(dfn)) +DEFINE_LHASH_OF_INTERNAL(OPENSSL_CSTRING); +#define lh_OPENSSL_CSTRING_new(hfn, cmp) ((LHASH_OF(OPENSSL_CSTRING) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_OPENSSL_CSTRING_lh_hashfunc_type(hfn), ossl_check_OPENSSL_CSTRING_lh_compfunc_type(cmp)), lh_OPENSSL_CSTRING_hash_thunk, lh_OPENSSL_CSTRING_comp_thunk, lh_OPENSSL_CSTRING_doall_thunk, lh_OPENSSL_CSTRING_doall_arg_thunk)) +#define lh_OPENSSL_CSTRING_free(lh) OPENSSL_LH_free(ossl_check_OPENSSL_CSTRING_lh_type(lh)) +#define lh_OPENSSL_CSTRING_flush(lh) OPENSSL_LH_flush(ossl_check_OPENSSL_CSTRING_lh_type(lh)) +#define lh_OPENSSL_CSTRING_insert(lh, ptr) ((OPENSSL_CSTRING *)OPENSSL_LH_insert(ossl_check_OPENSSL_CSTRING_lh_type(lh), ossl_check_OPENSSL_CSTRING_lh_plain_type(ptr))) +#define lh_OPENSSL_CSTRING_delete(lh, ptr) ((OPENSSL_CSTRING *)OPENSSL_LH_delete(ossl_check_OPENSSL_CSTRING_lh_type(lh), ossl_check_const_OPENSSL_CSTRING_lh_plain_type(ptr))) +#define lh_OPENSSL_CSTRING_retrieve(lh, ptr) ((OPENSSL_CSTRING *)OPENSSL_LH_retrieve(ossl_check_OPENSSL_CSTRING_lh_type(lh), ossl_check_const_OPENSSL_CSTRING_lh_plain_type(ptr))) +#define lh_OPENSSL_CSTRING_error(lh) OPENSSL_LH_error(ossl_check_OPENSSL_CSTRING_lh_type(lh)) +#define lh_OPENSSL_CSTRING_num_items(lh) OPENSSL_LH_num_items(ossl_check_OPENSSL_CSTRING_lh_type(lh)) +#define lh_OPENSSL_CSTRING_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_OPENSSL_CSTRING_lh_type(lh), out) +#define lh_OPENSSL_CSTRING_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_OPENSSL_CSTRING_lh_type(lh), out) +#define lh_OPENSSL_CSTRING_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_OPENSSL_CSTRING_lh_type(lh), out) +#define lh_OPENSSL_CSTRING_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_OPENSSL_CSTRING_lh_type(lh)) +#define lh_OPENSSL_CSTRING_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_OPENSSL_CSTRING_lh_type(lh), dl) +#define lh_OPENSSL_CSTRING_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_OPENSSL_CSTRING_lh_type(lh), ossl_check_OPENSSL_CSTRING_lh_doallfunc_type(dfn)) + +/* clang-format on */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/macros.h b/VCMP-LUA/modules/postgresql/include/openssl/macros.h new file mode 100644 index 0000000..598d3fc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/macros.h @@ -0,0 +1,361 @@ +/* + * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_MACROS_H +#define OPENSSL_MACROS_H +#pragma once + +#include +#include + +/* Helper macros for CPP string composition */ +#define OPENSSL_MSTR_HELPER(x) #x +#define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x) + +/* + * Sometimes OPENSSL_NO_xxx ends up with an empty file and some compilers + * don't like that. This will hopefully silence them. + */ +#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; + +/* + * Generic deprecation macro + * + * If OPENSSL_SUPPRESS_DEPRECATED is defined, then OSSL_DEPRECATED and + * OSSL_DEPRECATED_FOR become no-ops + */ +#ifndef OSSL_DEPRECATED +#undef OSSL_DEPRECATED_FOR +#ifndef OPENSSL_SUPPRESS_DEPRECATED +#if defined(_MSC_VER) +/* + * MSVC supports __declspec(deprecated) since MSVC 2003 (13.10), + * and __declspec(deprecated(message)) since MSVC 2005 (14.00) + */ +#if _MSC_VER >= 1400 +#define OSSL_DEPRECATED(since) \ + __declspec(deprecated("Since OpenSSL " #since)) +#define OSSL_DEPRECATED_FOR(since, message) \ + __declspec(deprecated("Since OpenSSL " #since ";" message)) +#elif _MSC_VER >= 1310 +#define OSSL_DEPRECATED(since) __declspec(deprecated) +#define OSSL_DEPRECATED_FOR(since, message) __declspec(deprecated) +#endif +#elif defined(__GNUC__) +/* + * According to GCC documentation, deprecations with message appeared in + * GCC 4.5.0 + */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +#define OSSL_DEPRECATED(since) \ + __attribute__((deprecated("Since OpenSSL " #since))) +#define OSSL_DEPRECATED_FOR(since, message) \ + __attribute__((deprecated("Since OpenSSL " #since ";" message))) +#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) +#define OSSL_DEPRECATED(since) __attribute__((deprecated)) +#define OSSL_DEPRECATED_FOR(since, message) __attribute__((deprecated)) +#endif +#elif defined(__SUNPRO_C) +#if (__SUNPRO_C >= 0x5130) +#define OSSL_DEPRECATED(since) __attribute__((deprecated)) +#define OSSL_DEPRECATED_FOR(since, message) __attribute__((deprecated)) +#endif +#endif +#endif +#endif + +/* + * Still not defined? Then define no-op macros. This means these macros + * are unsuitable for use in a typedef. + */ +#ifndef OSSL_DEPRECATED +#define OSSL_DEPRECATED(since) extern +#define OSSL_DEPRECATED_FOR(since, message) extern +#endif + +/* + * Applications should use -DOPENSSL_API_COMPAT= to suppress the + * declarations of functions deprecated in or before . If this is + * undefined, the value of the macro OPENSSL_CONFIGURED_API (defined in + * ) is the default. + * + * For any version number up until version 1.1.x, is expected to be + * the calculated version number 0xMNNFFPPSL. + * For version numbers 3.0 and on, is expected to be a computation + * of the major and minor numbers in decimal using this formula: + * + * MAJOR * 10000 + MINOR * 100 + * + * So version 3.0 becomes 30000, version 3.2 becomes 30200, etc. + */ + +/* + * We use the OPENSSL_API_COMPAT value to define API level macros. These + * macros are used to enable or disable features at that API version boundary. + */ + +#ifdef OPENSSL_API_LEVEL +#error "OPENSSL_API_LEVEL must not be defined by application" +#endif + +/* + * We figure out what API level was intended by simple numeric comparison. + * The lowest old style number we recognise is 0x00908000L, so we take some + * safety margin and assume that anything below 0x00900000L is a new style + * number. This allows new versions up to and including v943.71.83. + */ +#ifdef OPENSSL_API_COMPAT +#if OPENSSL_API_COMPAT < 0x900000L +#define OPENSSL_API_LEVEL (OPENSSL_API_COMPAT) +#else +#define OPENSSL_API_LEVEL \ + (((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \ + + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \ + + ((OPENSSL_API_COMPAT >> 12) & 0xFF)) +#endif +#endif + +/* + * If OPENSSL_API_COMPAT wasn't given, we use default numbers to set + * the API compatibility level. + */ +#ifndef OPENSSL_API_LEVEL +#if OPENSSL_CONFIGURED_API > 0 +#define OPENSSL_API_LEVEL (OPENSSL_CONFIGURED_API) +#else +#define OPENSSL_API_LEVEL \ + (OPENSSL_VERSION_MAJOR * 10000 + OPENSSL_VERSION_MINOR * 100) +#endif +#endif + +#if OPENSSL_API_LEVEL > OPENSSL_CONFIGURED_API +#error "The requested API level higher than the configured API compatibility level" +#endif + +/* + * Check of sane values. + */ +/* Can't go higher than the current version. */ +#if OPENSSL_API_LEVEL > (OPENSSL_VERSION_MAJOR * 10000 + OPENSSL_VERSION_MINOR * 100) +#error "OPENSSL_API_COMPAT expresses an impossible API compatibility level" +#endif +/* OpenSSL will have no version 2.y.z */ +#if OPENSSL_API_LEVEL < 30000 && OPENSSL_API_LEVEL >= 20000 +#error "OPENSSL_API_COMPAT expresses an impossible API compatibility level" +#endif +/* Below 0.9.8 is unacceptably low */ +#if OPENSSL_API_LEVEL < 908 +#error "OPENSSL_API_COMPAT expresses an impossible API compatibility level" +#endif + +/* + * Define macros for deprecation and simulated removal purposes. + * + * The macros OSSL_DEPRECATEDIN_{major}_{minor} are always defined for + * all OpenSSL versions we care for. They can be used as attributes + * in function declarations where appropriate. + * + * The macros OPENSSL_NO_DEPRECATED_{major}_{minor} are defined for + * all OpenSSL versions up to or equal to the version given with + * OPENSSL_API_COMPAT. They are used as guards around anything that's + * deprecated up to that version, as an effect of the developer option + * 'no-deprecated'. + */ + +#undef OPENSSL_NO_DEPRECATED_3_6 +#undef OPENSSL_NO_DEPRECATED_3_5 +#undef OPENSSL_NO_DEPRECATED_3_4 +#undef OPENSSL_NO_DEPRECATED_3_1 +#undef OPENSSL_NO_DEPRECATED_3_0 +#undef OPENSSL_NO_DEPRECATED_1_1_1 +#undef OPENSSL_NO_DEPRECATED_1_1_0 +#undef OPENSSL_NO_DEPRECATED_1_0_2 +#undef OPENSSL_NO_DEPRECATED_1_0_1 +#undef OPENSSL_NO_DEPRECATED_1_0_0 +#undef OPENSSL_NO_DEPRECATED_0_9_8 + +#if OPENSSL_API_LEVEL >= 30600 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_3_6 OSSL_DEPRECATED(3.6) +#define OSSL_DEPRECATEDIN_3_6_FOR(msg) OSSL_DEPRECATED_FOR(3.6, msg) +#else +#define OPENSSL_NO_DEPRECATED_3_6 +#endif +#else +#define OSSL_DEPRECATEDIN_3_6 +#define OSSL_DEPRECATEDIN_3_6_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 30500 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_3_5 OSSL_DEPRECATED(3.5) +#define OSSL_DEPRECATEDIN_3_5_FOR(msg) OSSL_DEPRECATED_FOR(3.5, msg) +#else +#define OPENSSL_NO_DEPRECATED_3_5 +#endif +#else +#define OSSL_DEPRECATEDIN_3_5 +#define OSSL_DEPRECATEDIN_3_5_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 30400 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_3_4 OSSL_DEPRECATED(3.4) +#define OSSL_DEPRECATEDIN_3_4_FOR(msg) OSSL_DEPRECATED_FOR(3.4, msg) +#else +#define OPENSSL_NO_DEPRECATED_3_4 +#endif +#else +#define OSSL_DEPRECATEDIN_3_4 +#define OSSL_DEPRECATEDIN_3_4_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 30100 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_3_1 OSSL_DEPRECATED(3.1) +#define OSSL_DEPRECATEDIN_3_1_FOR(msg) OSSL_DEPRECATED_FOR(3.1, msg) +#else +#define OPENSSL_NO_DEPRECATED_3_1 +#endif +#else +#define OSSL_DEPRECATEDIN_3_1 +#define OSSL_DEPRECATEDIN_3_1_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 30000 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_3_0 OSSL_DEPRECATED(3.0) +#define OSSL_DEPRECATEDIN_3_0_FOR(msg) OSSL_DEPRECATED_FOR(3.0, msg) +#else +#define OPENSSL_NO_DEPRECATED_3_0 +#endif +#else +#define OSSL_DEPRECATEDIN_3_0 +#define OSSL_DEPRECATEDIN_3_0_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 10101 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_1_1_1 OSSL_DEPRECATED(1.1.1) +#define OSSL_DEPRECATEDIN_1_1_1_FOR(msg) OSSL_DEPRECATED_FOR(1.1.1, msg) +#else +#define OPENSSL_NO_DEPRECATED_1_1_1 +#endif +#else +#define OSSL_DEPRECATEDIN_1_1_1 +#define OSSL_DEPRECATEDIN_1_1_1_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 10100 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_1_1_0 OSSL_DEPRECATED(1.1.0) +#define OSSL_DEPRECATEDIN_1_1_0_FOR(msg) OSSL_DEPRECATED_FOR(1.1.0, msg) +#else +#define OPENSSL_NO_DEPRECATED_1_1_0 +#endif +#else +#define OSSL_DEPRECATEDIN_1_1_0 +#define OSSL_DEPRECATEDIN_1_1_0_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 10002 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_1_0_2 OSSL_DEPRECATED(1.0.2) +#define OSSL_DEPRECATEDIN_1_0_2_FOR(msg) OSSL_DEPRECATED_FOR(1.0.2, msg) +#else +#define OPENSSL_NO_DEPRECATED_1_0_2 +#endif +#else +#define OSSL_DEPRECATEDIN_1_0_2 +#define OSSL_DEPRECATEDIN_1_0_2_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 10001 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_1_0_1 OSSL_DEPRECATED(1.0.1) +#define OSSL_DEPRECATEDIN_1_0_1_FOR(msg) OSSL_DEPRECATED_FOR(1.0.1, msg) +#else +#define OPENSSL_NO_DEPRECATED_1_0_1 +#endif +#else +#define OSSL_DEPRECATEDIN_1_0_1 +#define OSSL_DEPRECATEDIN_1_0_1_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 10000 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_1_0_0 OSSL_DEPRECATED(1.0.0) +#define OSSL_DEPRECATEDIN_1_0_0_FOR(msg) OSSL_DEPRECATED_FOR(1.0.0, msg) +#else +#define OPENSSL_NO_DEPRECATED_1_0_0 +#endif +#else +#define OSSL_DEPRECATEDIN_1_0_0 +#define OSSL_DEPRECATEDIN_1_0_0_FOR(msg) +#endif +#if OPENSSL_API_LEVEL >= 908 +#ifndef OPENSSL_NO_DEPRECATED +#define OSSL_DEPRECATEDIN_0_9_8 OSSL_DEPRECATED(0.9.8) +#define OSSL_DEPRECATEDIN_0_9_8_FOR(msg) OSSL_DEPRECATED_FOR(0.9.8, msg) +#else +#define OPENSSL_NO_DEPRECATED_0_9_8 +#endif +#else +#define OSSL_DEPRECATEDIN_0_9_8 +#define OSSL_DEPRECATEDIN_0_9_8_FOR(msg) +#endif + +/* + * Make our own variants of __FILE__ and __LINE__, depending on configuration + */ + +#ifndef OPENSSL_FILE +#ifdef OPENSSL_NO_FILENAMES +#define OPENSSL_FILE "" +#define OPENSSL_LINE 0 +#else +#define OPENSSL_FILE __FILE__ +#define OPENSSL_LINE __LINE__ +#endif +#endif + +/* + * __func__ was standardized in C99, so for any compiler that claims + * to implement that language level or newer, we assume we can safely + * use that symbol. + * + * GNU C also provides __FUNCTION__ since version 2, which predates + * C99. We can, however, only use this if __STDC_VERSION__ exists, + * as it's otherwise not allowed according to ISO C standards (C90). + * (compiling with GNU C's -pedantic tells us so) + * + * If none of the above applies, we check if the compiler is MSVC, + * and use __FUNCTION__ if that's the case. + */ +#ifndef OPENSSL_FUNC +#if defined(__STDC_VERSION__) +#if __STDC_VERSION__ >= 199901L +#define OPENSSL_FUNC __func__ +#elif defined(__GNUC__) && __GNUC__ >= 2 +#define OPENSSL_FUNC __FUNCTION__ +#endif +#elif defined(_MSC_VER) +#define OPENSSL_FUNC __FUNCTION__ +#endif +/* + * If all these possibilities are exhausted, we give up and use a + * static string. + */ +#ifndef OPENSSL_FUNC +#define OPENSSL_FUNC "(unknown function)" +#endif +#endif + +#ifndef OSSL_CRYPTO_ALLOC +#if defined(__GNUC__) +#define OSSL_CRYPTO_ALLOC __attribute__((__malloc__)) +#elif defined(_MSC_VER) +#define OSSL_CRYPTO_ALLOC __declspec(restrict) +#else +#define OSSL_CRYPTO_ALLOC +#endif +#endif + +#endif /* OPENSSL_MACROS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/md2.h b/VCMP-LUA/modules/postgresql/include/openssl/md2.h new file mode 100644 index 0000000..10d9a0f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/md2.h @@ -0,0 +1,56 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_MD2_H +#define OPENSSL_MD2_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_MD2_H +#endif + +#include + +#ifndef OPENSSL_NO_MD2 +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define MD2_DIGEST_LENGTH 16 + +#if !defined(OPENSSL_NO_DEPRECATED_3_0) + +typedef unsigned char MD2_INT; + +#define MD2_BLOCK 16 + +typedef struct MD2state_st { + unsigned int num; + unsigned char data[MD2_BLOCK]; + MD2_INT cksm[MD2_BLOCK]; + MD2_INT state[MD2_BLOCK]; +} MD2_CTX; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 const char *MD2_options(void); +OSSL_DEPRECATEDIN_3_0 int MD2_Init(MD2_CTX *c); +OSSL_DEPRECATEDIN_3_0 int MD2_Update(MD2_CTX *c, const unsigned char *data, + size_t len); +OSSL_DEPRECATEDIN_3_0 int MD2_Final(unsigned char *md, MD2_CTX *c); +OSSL_DEPRECATEDIN_3_0 unsigned char *MD2(const unsigned char *d, size_t n, + unsigned char *md); +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/md4.h b/VCMP-LUA/modules/postgresql/include/openssl/md4.h new file mode 100644 index 0000000..d60fe4a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/md4.h @@ -0,0 +1,63 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_MD4_H +#define OPENSSL_MD4_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_MD4_H +#endif + +#include + +#ifndef OPENSSL_NO_MD4 +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define MD4_DIGEST_LENGTH 16 + +#if !defined(OPENSSL_NO_DEPRECATED_3_0) + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD4_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +#define MD4_LONG unsigned int + +#define MD4_CBLOCK 64 +#define MD4_LBLOCK (MD4_CBLOCK / 4) + +typedef struct MD4state_st { + MD4_LONG A, B, C, D; + MD4_LONG Nl, Nh; + MD4_LONG data[MD4_LBLOCK]; + unsigned int num; +} MD4_CTX; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int MD4_Init(MD4_CTX *c); +OSSL_DEPRECATEDIN_3_0 int MD4_Update(MD4_CTX *c, const void *data, size_t len); +OSSL_DEPRECATEDIN_3_0 int MD4_Final(unsigned char *md, MD4_CTX *c); +OSSL_DEPRECATEDIN_3_0 unsigned char *MD4(const unsigned char *d, size_t n, + unsigned char *md); +OSSL_DEPRECATEDIN_3_0 void MD4_Transform(MD4_CTX *c, const unsigned char *b); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/md5.h b/VCMP-LUA/modules/postgresql/include/openssl/md5.h new file mode 100644 index 0000000..0ec3d1c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/md5.h @@ -0,0 +1,62 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_MD5_H +#define OPENSSL_MD5_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_MD5_H +#endif + +#include + +#ifndef OPENSSL_NO_MD5 +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define MD5_DIGEST_LENGTH 16 + +#if !defined(OPENSSL_NO_DEPRECATED_3_0) +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD5_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +#define MD5_LONG unsigned int + +#define MD5_CBLOCK 64 +#define MD5_LBLOCK (MD5_CBLOCK / 4) + +typedef struct MD5state_st { + MD5_LONG A, B, C, D; + MD5_LONG Nl, Nh; + MD5_LONG data[MD5_LBLOCK]; + unsigned int num; +} MD5_CTX; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c); +OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len); +OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c); +OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n, + unsigned char *md); +OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/mdc2.h b/VCMP-LUA/modules/postgresql/include/openssl/mdc2.h new file mode 100644 index 0000000..46c9652 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/mdc2.h @@ -0,0 +1,55 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_MDC2_H +#define OPENSSL_MDC2_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_MDC2_H +#endif + +#include + +#ifndef OPENSSL_NO_MDC2 +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define MDC2_DIGEST_LENGTH 16 + +#if !defined(OPENSSL_NO_DEPRECATED_3_0) + +#define MDC2_BLOCK 8 + +typedef struct mdc2_ctx_st { + unsigned int num; + unsigned char data[MDC2_BLOCK]; + DES_cblock h, hh; + unsigned int pad_type; /* either 1 or 2, default 1 */ +} MDC2_CTX; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int MDC2_Init(MDC2_CTX *c); +OSSL_DEPRECATEDIN_3_0 int MDC2_Update(MDC2_CTX *c, const unsigned char *data, + size_t len); +OSSL_DEPRECATEDIN_3_0 int MDC2_Final(unsigned char *md, MDC2_CTX *c); +OSSL_DEPRECATEDIN_3_0 unsigned char *MDC2(const unsigned char *d, size_t n, + unsigned char *md); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ml_kem.h b/VCMP-LUA/modules/postgresql/include/openssl/ml_kem.h new file mode 100644 index 0000000..fe5b0e2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ml_kem.h @@ -0,0 +1,31 @@ +/* + * Copyright 2024-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_ML_KEM_H +#define OPENSSL_ML_KEM_H +#pragma once + +#define OSSL_ML_KEM_SHARED_SECRET_BYTES 32 + +#define OSSL_ML_KEM_512_BITS 512 +#define OSSL_ML_KEM_512_SECURITY_BITS 128 +#define OSSL_ML_KEM_512_CIPHERTEXT_BYTES 768 +#define OSSL_ML_KEM_512_PUBLIC_KEY_BYTES 800 + +#define OSSL_ML_KEM_768_BITS 768 +#define OSSL_ML_KEM_768_SECURITY_BITS 192 +#define OSSL_ML_KEM_768_CIPHERTEXT_BYTES 1088 +#define OSSL_ML_KEM_768_PUBLIC_KEY_BYTES 1184 + +#define OSSL_ML_KEM_1024_BITS 1024 +#define OSSL_ML_KEM_1024_SECURITY_BITS 256 +#define OSSL_ML_KEM_1024_CIPHERTEXT_BYTES 1568 +#define OSSL_ML_KEM_1024_PUBLIC_KEY_BYTES 1568 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/modes.h b/VCMP-LUA/modules/postgresql/include/openssl/modes.h new file mode 100644 index 0000000..df11114 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/modes.h @@ -0,0 +1,219 @@ +/* + * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_MODES_H +#define OPENSSL_MODES_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_MODES_H +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +typedef void (*block128_f)(const unsigned char in[16], + unsigned char out[16], const void *key); + +typedef void (*cbc128_f)(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int enc); + +typedef void (*ecb128_f)(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + int enc); + +typedef void (*ctr128_f)(const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + const unsigned char ivec[16]); + +typedef void (*ccm128_f)(const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + const unsigned char ivec[16], + unsigned char cmac[16]); + +void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], block128_f block); +void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], block128_f block); + +void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], + unsigned char ecount_buf[16], unsigned int *num, + block128_f block); + +void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], + unsigned char ecount_buf[16], + unsigned int *num, ctr128_f ctr); + +void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + block128_f block); + +void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); +void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); +void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, + size_t bits, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); + +size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); +size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); + +size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); +size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); + +typedef struct gcm128_context GCM128_CONTEXT; + +GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); +void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); +void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, + size_t len); +int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, + size_t len); +int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); +int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); +int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, + size_t len); +void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); +void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); + +typedef struct ccm128_context CCM128_CONTEXT; + +void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, + unsigned int M, unsigned int L, void *key, + block128_f block); +int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, + size_t nlen, size_t mlen); +void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, + size_t alen); +int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len); +int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len); +int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len, + ccm128_f stream); +int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len, + ccm128_f stream); +size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); + +typedef struct xts128_context XTS128_CONTEXT; + +int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, + const unsigned char iv[16], + const unsigned char *inp, unsigned char *out, + size_t len, int enc); + +size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, size_t inlen, + block128_f block); + +size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, size_t inlen, + block128_f block); +size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, + unsigned char *out, const unsigned char *in, + size_t inlen, block128_f block); +size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, + unsigned char *out, const unsigned char *in, + size_t inlen, block128_f block); + +#ifndef OPENSSL_NO_OCB +typedef struct ocb128_context OCB128_CONTEXT; + +typedef void (*ocb128_f)(const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + size_t start_block_num, + unsigned char offset_i[16], + const unsigned char L_[][16], + unsigned char checksum[16]); + +OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, + block128_f encrypt, block128_f decrypt, + ocb128_f stream); +int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, + block128_f encrypt, block128_f decrypt, + ocb128_f stream); +int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, + void *keyenc, void *keydec); +int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, + size_t len, size_t taglen); +int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, + size_t len); +int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in, + unsigned char *out, size_t len); +int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in, + unsigned char *out, size_t len); +int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag, + size_t len); +int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len); +void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx); +#endif /* OPENSSL_NO_OCB */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/obj_mac.h b/VCMP-LUA/modules/postgresql/include/openssl/obj_mac.h new file mode 100644 index 0000000..236e88f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/obj_mac.h @@ -0,0 +1,6695 @@ +/* + * WARNING: do not edit! + * Generated by crypto/objects/objects.pl + * + * Copyright 2000-2025 The OpenSSL Project Authors. All Rights Reserved. + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_OBJ_MAC_H +# define OPENSSL_OBJ_MAC_H +# pragma once + +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_itu_t "ITU-T" +#define LN_itu_t "itu-t" +#define NID_itu_t 645 +#define OBJ_itu_t 0L + +#define NID_ccitt 404 +#define OBJ_ccitt OBJ_itu_t + +#define SN_iso "ISO" +#define LN_iso "iso" +#define NID_iso 181 +#define OBJ_iso 1L + +#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" +#define LN_joint_iso_itu_t "joint-iso-itu-t" +#define NID_joint_iso_itu_t 646 +#define OBJ_joint_iso_itu_t 2L + +#define NID_joint_iso_ccitt 393 +#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t + +#define SN_member_body "member-body" +#define LN_member_body "ISO Member Body" +#define NID_member_body 182 +#define OBJ_member_body OBJ_iso,2L + +#define SN_identified_organization "identified-organization" +#define NID_identified_organization 676 +#define OBJ_identified_organization OBJ_iso,3L + +#define SN_gmac "GMAC" +#define LN_gmac "gmac" +#define NID_gmac 1195 +#define OBJ_gmac OBJ_iso,0L,9797L,3L,4L + +#define SN_hmac_md5 "HMAC-MD5" +#define LN_hmac_md5 "hmac-md5" +#define NID_hmac_md5 780 +#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L + +#define SN_hmac_sha1 "HMAC-SHA1" +#define LN_hmac_sha1 "hmac-sha1" +#define NID_hmac_sha1 781 +#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L + +#define SN_x509ExtAdmission "x509ExtAdmission" +#define LN_x509ExtAdmission "Professional Information or basis for Admission" +#define NID_x509ExtAdmission 1093 +#define OBJ_x509ExtAdmission OBJ_identified_organization,36L,8L,3L,3L + +#define SN_certicom_arc "certicom-arc" +#define NID_certicom_arc 677 +#define OBJ_certicom_arc OBJ_identified_organization,132L + +#define SN_ieee "ieee" +#define NID_ieee 1170 +#define OBJ_ieee OBJ_identified_organization,111L + +#define SN_ieee_siswg "ieee-siswg" +#define LN_ieee_siswg "IEEE Security in Storage Working Group" +#define NID_ieee_siswg 1171 +#define OBJ_ieee_siswg OBJ_ieee,2L,1619L + +#define SN_international_organizations "international-organizations" +#define LN_international_organizations "International Organizations" +#define NID_international_organizations 647 +#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L + +#define SN_wap "wap" +#define NID_wap 678 +#define OBJ_wap OBJ_international_organizations,43L + +#define SN_wap_wsg "wap-wsg" +#define NID_wap_wsg 679 +#define OBJ_wap_wsg OBJ_wap,1L + +#define SN_selected_attribute_types "selected-attribute-types" +#define LN_selected_attribute_types "Selected Attribute Types" +#define NID_selected_attribute_types 394 +#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L + +#define SN_clearance "clearance" +#define NID_clearance 395 +#define OBJ_clearance OBJ_selected_attribute_types,55L + +#define SN_ISO_US "ISO-US" +#define LN_ISO_US "ISO US Member Body" +#define NID_ISO_US 183 +#define OBJ_ISO_US OBJ_member_body,840L + +#define SN_X9_57 "X9-57" +#define LN_X9_57 "X9.57" +#define NID_X9_57 184 +#define OBJ_X9_57 OBJ_ISO_US,10040L + +#define SN_X9cm "X9cm" +#define LN_X9cm "X9.57 CM ?" +#define NID_X9cm 185 +#define OBJ_X9cm OBJ_X9_57,4L + +#define SN_ISO_CN "ISO-CN" +#define LN_ISO_CN "ISO CN Member Body" +#define NID_ISO_CN 1140 +#define OBJ_ISO_CN OBJ_member_body,156L + +#define SN_oscca "oscca" +#define NID_oscca 1141 +#define OBJ_oscca OBJ_ISO_CN,10197L + +#define SN_sm_scheme "sm-scheme" +#define NID_sm_scheme 1142 +#define OBJ_sm_scheme OBJ_oscca,1L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa OBJ_X9cm,1L + +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 OBJ_X9cm,3L + +#define SN_ansi_X9_62 "ansi-X9-62" +#define LN_ansi_X9_62 "ANSI X9.62" +#define NID_ansi_X9_62 405 +#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L + +#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L + +#define SN_X9_62_prime_field "prime-field" +#define NID_X9_62_prime_field 406 +#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L + +#define SN_X9_62_characteristic_two_field "characteristic-two-field" +#define NID_X9_62_characteristic_two_field 407 +#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L + +#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" +#define NID_X9_62_id_characteristic_two_basis 680 +#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L + +#define SN_X9_62_onBasis "onBasis" +#define NID_X9_62_onBasis 681 +#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L + +#define SN_X9_62_tpBasis "tpBasis" +#define NID_X9_62_tpBasis 682 +#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L + +#define SN_X9_62_ppBasis "ppBasis" +#define NID_X9_62_ppBasis 683 +#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L + +#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L + +#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" +#define NID_X9_62_id_ecPublicKey 408 +#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L + +#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L + +#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L + +#define SN_X9_62_c2pnb163v1 "c2pnb163v1" +#define NID_X9_62_c2pnb163v1 684 +#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L + +#define SN_X9_62_c2pnb163v2 "c2pnb163v2" +#define NID_X9_62_c2pnb163v2 685 +#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L + +#define SN_X9_62_c2pnb163v3 "c2pnb163v3" +#define NID_X9_62_c2pnb163v3 686 +#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L + +#define SN_X9_62_c2pnb176v1 "c2pnb176v1" +#define NID_X9_62_c2pnb176v1 687 +#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L + +#define SN_X9_62_c2tnb191v1 "c2tnb191v1" +#define NID_X9_62_c2tnb191v1 688 +#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L + +#define SN_X9_62_c2tnb191v2 "c2tnb191v2" +#define NID_X9_62_c2tnb191v2 689 +#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L + +#define SN_X9_62_c2tnb191v3 "c2tnb191v3" +#define NID_X9_62_c2tnb191v3 690 +#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L + +#define SN_X9_62_c2onb191v4 "c2onb191v4" +#define NID_X9_62_c2onb191v4 691 +#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L + +#define SN_X9_62_c2onb191v5 "c2onb191v5" +#define NID_X9_62_c2onb191v5 692 +#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L + +#define SN_X9_62_c2pnb208w1 "c2pnb208w1" +#define NID_X9_62_c2pnb208w1 693 +#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L + +#define SN_X9_62_c2tnb239v1 "c2tnb239v1" +#define NID_X9_62_c2tnb239v1 694 +#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L + +#define SN_X9_62_c2tnb239v2 "c2tnb239v2" +#define NID_X9_62_c2tnb239v2 695 +#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L + +#define SN_X9_62_c2tnb239v3 "c2tnb239v3" +#define NID_X9_62_c2tnb239v3 696 +#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L + +#define SN_X9_62_c2onb239v4 "c2onb239v4" +#define NID_X9_62_c2onb239v4 697 +#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L + +#define SN_X9_62_c2onb239v5 "c2onb239v5" +#define NID_X9_62_c2onb239v5 698 +#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L + +#define SN_X9_62_c2pnb272w1 "c2pnb272w1" +#define NID_X9_62_c2pnb272w1 699 +#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L + +#define SN_X9_62_c2pnb304w1 "c2pnb304w1" +#define NID_X9_62_c2pnb304w1 700 +#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L + +#define SN_X9_62_c2tnb359v1 "c2tnb359v1" +#define NID_X9_62_c2tnb359v1 701 +#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L + +#define SN_X9_62_c2pnb368w1 "c2pnb368w1" +#define NID_X9_62_c2pnb368w1 702 +#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L + +#define SN_X9_62_c2tnb431r1 "c2tnb431r1" +#define NID_X9_62_c2tnb431r1 703 +#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L + +#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L + +#define SN_X9_62_prime192v1 "prime192v1" +#define NID_X9_62_prime192v1 409 +#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L + +#define SN_X9_62_prime192v2 "prime192v2" +#define NID_X9_62_prime192v2 410 +#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L + +#define SN_X9_62_prime192v3 "prime192v3" +#define NID_X9_62_prime192v3 411 +#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L + +#define SN_X9_62_prime239v1 "prime239v1" +#define NID_X9_62_prime239v1 412 +#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L + +#define SN_X9_62_prime239v2 "prime239v2" +#define NID_X9_62_prime239v2 413 +#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L + +#define SN_X9_62_prime239v3 "prime239v3" +#define NID_X9_62_prime239v3 414 +#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L + +#define SN_X9_62_prime256v1 "prime256v1" +#define NID_X9_62_prime256v1 415 +#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L + +#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L + +#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" +#define NID_ecdsa_with_SHA1 416 +#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L + +#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" +#define NID_ecdsa_with_Recommended 791 +#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L + +#define SN_ecdsa_with_Specified "ecdsa-with-Specified" +#define NID_ecdsa_with_Specified 792 +#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L + +#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" +#define NID_ecdsa_with_SHA224 793 +#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L + +#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" +#define NID_ecdsa_with_SHA256 794 +#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L + +#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" +#define NID_ecdsa_with_SHA384 795 +#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L + +#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" +#define NID_ecdsa_with_SHA512 796 +#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L + +#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L + +#define SN_secp112r1 "secp112r1" +#define NID_secp112r1 704 +#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L + +#define SN_secp112r2 "secp112r2" +#define NID_secp112r2 705 +#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L + +#define SN_secp128r1 "secp128r1" +#define NID_secp128r1 706 +#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L + +#define SN_secp128r2 "secp128r2" +#define NID_secp128r2 707 +#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L + +#define SN_secp160k1 "secp160k1" +#define NID_secp160k1 708 +#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L + +#define SN_secp160r1 "secp160r1" +#define NID_secp160r1 709 +#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L + +#define SN_secp160r2 "secp160r2" +#define NID_secp160r2 710 +#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L + +#define SN_secp192k1 "secp192k1" +#define NID_secp192k1 711 +#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L + +#define SN_secp224k1 "secp224k1" +#define NID_secp224k1 712 +#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L + +#define SN_secp224r1 "secp224r1" +#define NID_secp224r1 713 +#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L + +#define SN_secp256k1 "secp256k1" +#define NID_secp256k1 714 +#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L + +#define SN_secp384r1 "secp384r1" +#define NID_secp384r1 715 +#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L + +#define SN_secp521r1 "secp521r1" +#define NID_secp521r1 716 +#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L + +#define SN_sect113r1 "sect113r1" +#define NID_sect113r1 717 +#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L + +#define SN_sect113r2 "sect113r2" +#define NID_sect113r2 718 +#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L + +#define SN_sect131r1 "sect131r1" +#define NID_sect131r1 719 +#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L + +#define SN_sect131r2 "sect131r2" +#define NID_sect131r2 720 +#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L + +#define SN_sect163k1 "sect163k1" +#define NID_sect163k1 721 +#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L + +#define SN_sect163r1 "sect163r1" +#define NID_sect163r1 722 +#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L + +#define SN_sect163r2 "sect163r2" +#define NID_sect163r2 723 +#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L + +#define SN_sect193r1 "sect193r1" +#define NID_sect193r1 724 +#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L + +#define SN_sect193r2 "sect193r2" +#define NID_sect193r2 725 +#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L + +#define SN_sect233k1 "sect233k1" +#define NID_sect233k1 726 +#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L + +#define SN_sect233r1 "sect233r1" +#define NID_sect233r1 727 +#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L + +#define SN_sect239k1 "sect239k1" +#define NID_sect239k1 728 +#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L + +#define SN_sect283k1 "sect283k1" +#define NID_sect283k1 729 +#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L + +#define SN_sect283r1 "sect283r1" +#define NID_sect283r1 730 +#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L + +#define SN_sect409k1 "sect409k1" +#define NID_sect409k1 731 +#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L + +#define SN_sect409r1 "sect409r1" +#define NID_sect409r1 732 +#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L + +#define SN_sect571k1 "sect571k1" +#define NID_sect571k1 733 +#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L + +#define SN_sect571r1 "sect571r1" +#define NID_sect571r1 734 +#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L + +#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L + +#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" +#define NID_wap_wsg_idm_ecid_wtls1 735 +#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L + +#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" +#define NID_wap_wsg_idm_ecid_wtls3 736 +#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L + +#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" +#define NID_wap_wsg_idm_ecid_wtls4 737 +#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L + +#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" +#define NID_wap_wsg_idm_ecid_wtls5 738 +#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L + +#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" +#define NID_wap_wsg_idm_ecid_wtls6 739 +#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L + +#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" +#define NID_wap_wsg_idm_ecid_wtls7 740 +#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L + +#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" +#define NID_wap_wsg_idm_ecid_wtls8 741 +#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L + +#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" +#define NID_wap_wsg_idm_ecid_wtls9 742 +#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L + +#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" +#define NID_wap_wsg_idm_ecid_wtls10 743 +#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L + +#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" +#define NID_wap_wsg_idm_ecid_wtls11 744 +#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L + +#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" +#define NID_wap_wsg_idm_ecid_wtls12 745 +#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L + +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L + +#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" +#define LN_id_PasswordBasedMAC "password based MAC" +#define NID_id_PasswordBasedMAC 782 +#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L + +#define SN_id_DHBasedMac "id-DHBasedMac" +#define LN_id_DHBasedMac "Diffie-Hellman based MAC" +#define NID_id_DHBasedMac 783 +#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L + +#define SN_rsadsi "rsadsi" +#define LN_rsadsi "RSA Data Security, Inc." +#define NID_rsadsi 1 +#define OBJ_rsadsi OBJ_ISO_US,113549L + +#define SN_pkcs "pkcs" +#define LN_pkcs "RSA Data Security, Inc. PKCS" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi,1L + +#define SN_pkcs1 "pkcs1" +#define NID_pkcs1 186 +#define OBJ_pkcs1 OBJ_pkcs,1L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs1,1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L + +#define SN_md4WithRSAEncryption "RSA-MD4" +#define LN_md4WithRSAEncryption "md4WithRSAEncryption" +#define NID_md4WithRSAEncryption 396 +#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L + +#define SN_rsaesOaep "RSAES-OAEP" +#define LN_rsaesOaep "rsaesOaep" +#define NID_rsaesOaep 919 +#define OBJ_rsaesOaep OBJ_pkcs1,7L + +#define SN_mgf1 "MGF1" +#define LN_mgf1 "mgf1" +#define NID_mgf1 911 +#define OBJ_mgf1 OBJ_pkcs1,8L + +#define SN_pSpecified "PSPECIFIED" +#define LN_pSpecified "pSpecified" +#define NID_pSpecified 935 +#define OBJ_pSpecified OBJ_pkcs1,9L + +#define SN_rsassaPss "RSASSA-PSS" +#define LN_rsassaPss "rsassaPss" +#define NID_rsassaPss 912 +#define OBJ_rsassaPss OBJ_pkcs1,10L + +#define SN_sha256WithRSAEncryption "RSA-SHA256" +#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" +#define NID_sha256WithRSAEncryption 668 +#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L + +#define SN_sha384WithRSAEncryption "RSA-SHA384" +#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" +#define NID_sha384WithRSAEncryption 669 +#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L + +#define SN_sha512WithRSAEncryption "RSA-SHA512" +#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" +#define NID_sha512WithRSAEncryption 670 +#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L + +#define SN_sha224WithRSAEncryption "RSA-SHA224" +#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" +#define NID_sha224WithRSAEncryption 671 +#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L + +#define SN_sha512_224WithRSAEncryption "RSA-SHA512/224" +#define LN_sha512_224WithRSAEncryption "sha512-224WithRSAEncryption" +#define NID_sha512_224WithRSAEncryption 1145 +#define OBJ_sha512_224WithRSAEncryption OBJ_pkcs1,15L + +#define SN_sha512_256WithRSAEncryption "RSA-SHA512/256" +#define LN_sha512_256WithRSAEncryption "sha512-256WithRSAEncryption" +#define NID_sha512_256WithRSAEncryption 1146 +#define OBJ_sha512_256WithRSAEncryption OBJ_pkcs1,16L + +#define SN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs,3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3,1L + +#define SN_pkcs5 "pkcs5" +#define NID_pkcs5 187 +#define OBJ_pkcs5 OBJ_pkcs,5L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L + +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L + +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs5,12L + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs5,13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs5,14L + +#define SN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs,7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7,1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7,2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7,5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L + +#define SN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs,9L + +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9,3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L + +#define SN_ext_req "extReq" +#define LN_ext_req "Extension Request" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9,14L + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9,15L + +#define SN_SMIME "SMIME" +#define LN_SMIME "S/MIME" +#define NID_SMIME 188 +#define OBJ_SMIME OBJ_pkcs9,16L + +#define SN_id_smime_mod "id-smime-mod" +#define NID_id_smime_mod 189 +#define OBJ_id_smime_mod OBJ_SMIME,0L + +#define SN_id_smime_ct "id-smime-ct" +#define NID_id_smime_ct 190 +#define OBJ_id_smime_ct OBJ_SMIME,1L + +#define SN_id_smime_aa "id-smime-aa" +#define NID_id_smime_aa 191 +#define OBJ_id_smime_aa OBJ_SMIME,2L + +#define SN_id_smime_alg "id-smime-alg" +#define NID_id_smime_alg 192 +#define OBJ_id_smime_alg OBJ_SMIME,3L + +#define SN_id_smime_cd "id-smime-cd" +#define NID_id_smime_cd 193 +#define OBJ_id_smime_cd OBJ_SMIME,4L + +#define SN_id_smime_spq "id-smime-spq" +#define NID_id_smime_spq 194 +#define OBJ_id_smime_spq OBJ_SMIME,5L + +#define SN_id_smime_cti "id-smime-cti" +#define NID_id_smime_cti 195 +#define OBJ_id_smime_cti OBJ_SMIME,6L + +#define SN_id_smime_ori "id-smime-ori" +#define NID_id_smime_ori 1499 +#define OBJ_id_smime_ori OBJ_SMIME,13L + +#define SN_id_smime_mod_cms "id-smime-mod-cms" +#define NID_id_smime_mod_cms 196 +#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L + +#define SN_id_smime_mod_ess "id-smime-mod-ess" +#define NID_id_smime_mod_ess 197 +#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L + +#define SN_id_smime_mod_oid "id-smime-mod-oid" +#define NID_id_smime_mod_oid 198 +#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L + +#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" +#define NID_id_smime_mod_msg_v3 199 +#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L + +#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" +#define NID_id_smime_mod_ets_eSignature_88 200 +#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L + +#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" +#define NID_id_smime_mod_ets_eSignature_97 201 +#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L + +#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" +#define NID_id_smime_mod_ets_eSigPolicy_88 202 +#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L + +#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" +#define NID_id_smime_mod_ets_eSigPolicy_97 203 +#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L + +#define SN_id_smime_ct_receipt "id-smime-ct-receipt" +#define NID_id_smime_ct_receipt 204 +#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L + +#define SN_id_smime_ct_authData "id-smime-ct-authData" +#define NID_id_smime_ct_authData 205 +#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L + +#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" +#define NID_id_smime_ct_publishCert 206 +#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L + +#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" +#define NID_id_smime_ct_TSTInfo 207 +#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L + +#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" +#define NID_id_smime_ct_TDTInfo 208 +#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L + +#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" +#define NID_id_smime_ct_contentInfo 209 +#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L + +#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" +#define NID_id_smime_ct_DVCSRequestData 210 +#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L + +#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" +#define NID_id_smime_ct_DVCSResponseData 211 +#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L + +#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" +#define NID_id_smime_ct_compressedData 786 +#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L + +#define SN_id_smime_ct_contentCollection "id-smime-ct-contentCollection" +#define NID_id_smime_ct_contentCollection 1058 +#define OBJ_id_smime_ct_contentCollection OBJ_id_smime_ct,19L + +#define SN_id_smime_ct_authEnvelopedData "id-smime-ct-authEnvelopedData" +#define NID_id_smime_ct_authEnvelopedData 1059 +#define OBJ_id_smime_ct_authEnvelopedData OBJ_id_smime_ct,23L + +#define SN_id_ct_routeOriginAuthz "id-ct-routeOriginAuthz" +#define NID_id_ct_routeOriginAuthz 1234 +#define OBJ_id_ct_routeOriginAuthz OBJ_id_smime_ct,24L + +#define SN_id_ct_rpkiManifest "id-ct-rpkiManifest" +#define NID_id_ct_rpkiManifest 1235 +#define OBJ_id_ct_rpkiManifest OBJ_id_smime_ct,26L + +#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" +#define NID_id_ct_asciiTextWithCRLF 787 +#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L + +#define SN_id_ct_xml "id-ct-xml" +#define NID_id_ct_xml 1060 +#define OBJ_id_ct_xml OBJ_id_smime_ct,28L + +#define SN_id_ct_rpkiGhostbusters "id-ct-rpkiGhostbusters" +#define NID_id_ct_rpkiGhostbusters 1236 +#define OBJ_id_ct_rpkiGhostbusters OBJ_id_smime_ct,35L + +#define SN_id_ct_resourceTaggedAttest "id-ct-resourceTaggedAttest" +#define NID_id_ct_resourceTaggedAttest 1237 +#define OBJ_id_ct_resourceTaggedAttest OBJ_id_smime_ct,36L + +#define SN_id_ct_geofeedCSVwithCRLF "id-ct-geofeedCSVwithCRLF" +#define NID_id_ct_geofeedCSVwithCRLF 1246 +#define OBJ_id_ct_geofeedCSVwithCRLF OBJ_id_smime_ct,47L + +#define SN_id_ct_signedChecklist "id-ct-signedChecklist" +#define NID_id_ct_signedChecklist 1247 +#define OBJ_id_ct_signedChecklist OBJ_id_smime_ct,48L + +#define SN_id_ct_ASPA "id-ct-ASPA" +#define NID_id_ct_ASPA 1250 +#define OBJ_id_ct_ASPA OBJ_id_smime_ct,49L + +#define SN_id_ct_signedTAL "id-ct-signedTAL" +#define NID_id_ct_signedTAL 1284 +#define OBJ_id_ct_signedTAL OBJ_id_smime_ct,50L + +#define SN_id_ct_rpkiSignedPrefixList "id-ct-rpkiSignedPrefixList" +#define NID_id_ct_rpkiSignedPrefixList 1320 +#define OBJ_id_ct_rpkiSignedPrefixList OBJ_id_smime_ct,51L + +#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" +#define NID_id_smime_aa_receiptRequest 212 +#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L + +#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" +#define NID_id_smime_aa_securityLabel 213 +#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L + +#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" +#define NID_id_smime_aa_mlExpandHistory 214 +#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L + +#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" +#define NID_id_smime_aa_contentHint 215 +#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L + +#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" +#define NID_id_smime_aa_msgSigDigest 216 +#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L + +#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" +#define NID_id_smime_aa_encapContentType 217 +#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L + +#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" +#define NID_id_smime_aa_contentIdentifier 218 +#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L + +#define SN_id_smime_aa_macValue "id-smime-aa-macValue" +#define NID_id_smime_aa_macValue 219 +#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L + +#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" +#define NID_id_smime_aa_equivalentLabels 220 +#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L + +#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" +#define NID_id_smime_aa_contentReference 221 +#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L + +#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" +#define NID_id_smime_aa_encrypKeyPref 222 +#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L + +#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" +#define NID_id_smime_aa_signingCertificate 223 +#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L + +#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" +#define NID_id_smime_aa_smimeEncryptCerts 224 +#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L + +#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" +#define NID_id_smime_aa_timeStampToken 225 +#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L + +#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" +#define NID_id_smime_aa_ets_sigPolicyId 226 +#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L + +#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" +#define NID_id_smime_aa_ets_commitmentType 227 +#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L + +#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" +#define NID_id_smime_aa_ets_signerLocation 228 +#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L + +#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" +#define NID_id_smime_aa_ets_signerAttr 229 +#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L + +#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" +#define NID_id_smime_aa_ets_otherSigCert 230 +#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L + +#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" +#define NID_id_smime_aa_ets_contentTimestamp 231 +#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L + +#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" +#define NID_id_smime_aa_ets_CertificateRefs 232 +#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L + +#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" +#define NID_id_smime_aa_ets_RevocationRefs 233 +#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L + +#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" +#define NID_id_smime_aa_ets_certValues 234 +#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L + +#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" +#define NID_id_smime_aa_ets_revocationValues 235 +#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L + +#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" +#define NID_id_smime_aa_ets_escTimeStamp 236 +#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L + +#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" +#define NID_id_smime_aa_ets_certCRLTimestamp 237 +#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L + +#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" +#define NID_id_smime_aa_ets_archiveTimeStamp 238 +#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L + +#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" +#define NID_id_smime_aa_signatureType 239 +#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L + +#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" +#define NID_id_smime_aa_dvcs_dvc 240 +#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L + +#define SN_id_aa_ets_attrCertificateRefs "id-aa-ets-attrCertificateRefs" +#define NID_id_aa_ets_attrCertificateRefs 1261 +#define OBJ_id_aa_ets_attrCertificateRefs OBJ_id_smime_aa,44L + +#define SN_id_aa_ets_attrRevocationRefs "id-aa-ets-attrRevocationRefs" +#define NID_id_aa_ets_attrRevocationRefs 1262 +#define OBJ_id_aa_ets_attrRevocationRefs OBJ_id_smime_aa,45L + +#define SN_id_smime_aa_signingCertificateV2 "id-smime-aa-signingCertificateV2" +#define NID_id_smime_aa_signingCertificateV2 1086 +#define OBJ_id_smime_aa_signingCertificateV2 OBJ_id_smime_aa,47L + +#define SN_id_aa_ets_archiveTimestampV2 "id-aa-ets-archiveTimestampV2" +#define NID_id_aa_ets_archiveTimestampV2 1280 +#define OBJ_id_aa_ets_archiveTimestampV2 OBJ_id_smime_aa,48L + +#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" +#define NID_id_smime_alg_ESDHwith3DES 241 +#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L + +#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" +#define NID_id_smime_alg_ESDHwithRC2 242 +#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L + +#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" +#define NID_id_smime_alg_3DESwrap 243 +#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L + +#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" +#define NID_id_smime_alg_RC2wrap 244 +#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L + +#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" +#define NID_id_smime_alg_ESDH 245 +#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L + +#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" +#define NID_id_smime_alg_CMS3DESwrap 246 +#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L + +#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" +#define NID_id_smime_alg_CMSRC2wrap 247 +#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L + +#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" +#define NID_id_alg_PWRI_KEK 893 +#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L + +#define SN_HKDF_SHA256 "id-alg-hkdf-with-sha256" +#define LN_HKDF_SHA256 "HKDF-SHA256" +#define NID_HKDF_SHA256 1496 +#define OBJ_HKDF_SHA256 OBJ_id_smime_alg,28L + +#define SN_HKDF_SHA384 "id-alg-hkdf-with-sha384" +#define LN_HKDF_SHA384 "HKDF-SHA384" +#define NID_HKDF_SHA384 1497 +#define OBJ_HKDF_SHA384 OBJ_id_smime_alg,29L + +#define SN_HKDF_SHA512 "id-alg-hkdf-with-sha512" +#define LN_HKDF_SHA512 "HKDF-SHA512" +#define NID_HKDF_SHA512 1498 +#define OBJ_HKDF_SHA512 OBJ_id_smime_alg,30L + +#define SN_id_smime_cd_ldap "id-smime-cd-ldap" +#define NID_id_smime_cd_ldap 248 +#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L + +#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" +#define NID_id_smime_spq_ets_sqt_uri 249 +#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L + +#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" +#define NID_id_smime_spq_ets_sqt_unotice 250 +#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L + +#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" +#define NID_id_smime_cti_ets_proofOfOrigin 251 +#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L + +#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" +#define NID_id_smime_cti_ets_proofOfReceipt 252 +#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L + +#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" +#define NID_id_smime_cti_ets_proofOfDelivery 253 +#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L + +#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" +#define NID_id_smime_cti_ets_proofOfSender 254 +#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L + +#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" +#define NID_id_smime_cti_ets_proofOfApproval 255 +#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L + +#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" +#define NID_id_smime_cti_ets_proofOfCreation 256 +#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L + +#define SN_id_smime_ori_kem "id-smime-ori-kem" +#define NID_id_smime_ori_kem 1500 +#define OBJ_id_smime_ori_kem OBJ_id_smime_ori,3L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9,20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9,21L + +#define OBJ_ms_corp 1L,3L,6L,1L,4L,1L,311L + +#define SN_ms_csp_name "CSPName" +#define LN_ms_csp_name "Microsoft CSP Name" +#define NID_ms_csp_name 417 +#define OBJ_ms_csp_name OBJ_ms_corp,17L,1L + +#define SN_LocalKeySet "LocalKeySet" +#define LN_LocalKeySet "Microsoft Local Key set" +#define NID_LocalKeySet 856 +#define OBJ_LocalKeySet OBJ_ms_corp,17L,2L + +#define OBJ_certTypes OBJ_pkcs9,22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes,1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes,2L + +#define OBJ_crlTypes OBJ_pkcs9,23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes,1L + +#define SN_id_aa_CMSAlgorithmProtection "id-aa-CMSAlgorithmProtection" +#define NID_id_aa_CMSAlgorithmProtection 1263 +#define OBJ_id_aa_CMSAlgorithmProtection OBJ_pkcs9,52L + +#define OBJ_pkcs12 OBJ_pkcs,12L + +#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds,1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds,3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds,4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds,5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi,2L,2L + +#define SN_md4 "MD4" +#define LN_md4 "md4" +#define NID_md4 257 +#define OBJ_md4 OBJ_rsadsi,2L,4L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi,2L,5L + +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" +#define NID_md5_sha1 114 + +#define LN_hmacWithMD5 "hmacWithMD5" +#define NID_hmacWithMD5 797 +#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L + +#define SN_sm2 "SM2" +#define LN_sm2 "sm2" +#define NID_sm2 1172 +#define OBJ_sm2 OBJ_sm_scheme,301L + +#define SN_sm3 "SM3" +#define LN_sm3 "sm3" +#define NID_sm3 1143 +#define OBJ_sm3 OBJ_sm_scheme,401L + +#define SN_sm3WithRSAEncryption "RSA-SM3" +#define LN_sm3WithRSAEncryption "sm3WithRSAEncryption" +#define NID_sm3WithRSAEncryption 1144 +#define OBJ_sm3WithRSAEncryption OBJ_sm_scheme,504L + +#define SN_SM2_with_SM3 "SM2-SM3" +#define LN_SM2_with_SM3 "SM2-with-SM3" +#define NID_SM2_with_SM3 1204 +#define OBJ_SM2_with_SM3 OBJ_sm_scheme,501L + +#define LN_hmacWithSM3 "hmacWithSM3" +#define NID_hmacWithSM3 1281 +#define OBJ_hmacWithSM3 OBJ_sm3,3L,1L + +#define LN_hmacWithSHA224 "hmacWithSHA224" +#define NID_hmacWithSHA224 798 +#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L + +#define LN_hmacWithSHA256 "hmacWithSHA256" +#define NID_hmacWithSHA256 799 +#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L + +#define LN_hmacWithSHA384 "hmacWithSHA384" +#define NID_hmacWithSHA384 800 +#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L + +#define LN_hmacWithSHA512 "hmacWithSHA512" +#define NID_hmacWithSHA512 801 +#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L + +#define LN_hmacWithSHA512_224 "hmacWithSHA512-224" +#define NID_hmacWithSHA512_224 1193 +#define OBJ_hmacWithSHA512_224 OBJ_rsadsi,2L,12L + +#define LN_hmacWithSHA512_256 "hmacWithSHA512-256" +#define NID_hmacWithSHA512_256 1194 +#define OBJ_hmacWithSHA512_256 OBJ_rsadsi,2L,13L + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi,3L,4L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L + +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_ms_ext_req "msExtReq" +#define LN_ms_ext_req "Microsoft Extension Request" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req OBJ_ms_corp,2L,1L,14L + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind OBJ_ms_corp,2L,1L,21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com OBJ_ms_corp,2L,1L,22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign OBJ_ms_corp,10L,3L,1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc OBJ_ms_corp,10L,3L,3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs OBJ_ms_corp,10L,3L,4L + +#define SN_ms_smartcard_login "msSmartcardLogin" +#define LN_ms_smartcard_login "Microsoft Smartcard Login" +#define NID_ms_smartcard_login 648 +#define OBJ_ms_smartcard_login OBJ_ms_corp,20L,2L,2L + +#define SN_ms_upn "msUPN" +#define LN_ms_upn "Microsoft User Principal Name" +#define NID_ms_upn 649 +#define OBJ_ms_upn OBJ_ms_corp,20L,2L,3L + +#define SN_ms_ntds_sec_ext "ms-ntds-sec-ext" +#define LN_ms_ntds_sec_ext "Microsoft NTDS CA Extension" +#define NID_ms_ntds_sec_ext 1292 +#define OBJ_ms_ntds_sec_ext OBJ_ms_corp,25L,2L + +#define SN_ms_ntds_obj_sid "ms-ntds-obj-sid" +#define LN_ms_ntds_obj_sid "Microsoft NTDS AD objectSid" +#define NID_ms_ntds_obj_sid 1291 +#define OBJ_ms_ntds_obj_sid OBJ_ms_corp,25L,2L,1L + +#define SN_ms_cert_templ "ms-cert-templ" +#define LN_ms_cert_templ "Microsoft certificate template" +#define NID_ms_cert_templ 1293 +#define OBJ_ms_cert_templ OBJ_ms_corp,21L,7L + +#define SN_ms_app_policies "ms-app-policies" +#define LN_ms_app_policies "Microsoft Application Policies Extension" +#define NID_ms_app_policies 1294 +#define OBJ_ms_app_policies OBJ_ms_corp,21L,10L + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L + +#define SN_id_pkix_mod "id-pkix-mod" +#define NID_id_pkix_mod 258 +#define OBJ_id_pkix_mod OBJ_id_pkix,0L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix,1L + +#define SN_id_qt "id-qt" +#define NID_id_qt 259 +#define OBJ_id_qt OBJ_id_pkix,2L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix,3L + +#define SN_id_it "id-it" +#define NID_id_it 260 +#define OBJ_id_it OBJ_id_pkix,4L + +#define SN_id_pkip "id-pkip" +#define NID_id_pkip 261 +#define OBJ_id_pkip OBJ_id_pkix,5L + +#define SN_id_alg "id-alg" +#define NID_id_alg 262 +#define OBJ_id_alg OBJ_id_pkix,6L + +#define SN_id_cmc "id-cmc" +#define NID_id_cmc 263 +#define OBJ_id_cmc OBJ_id_pkix,7L + +#define SN_id_on "id-on" +#define NID_id_on 264 +#define OBJ_id_on OBJ_id_pkix,8L + +#define SN_id_pda "id-pda" +#define NID_id_pda 265 +#define OBJ_id_pda OBJ_id_pkix,9L + +#define SN_id_aca "id-aca" +#define NID_id_aca 266 +#define OBJ_id_aca OBJ_id_pkix,10L + +#define SN_id_qcs "id-qcs" +#define NID_id_qcs 267 +#define OBJ_id_qcs OBJ_id_pkix,11L + +#define SN_id_cp "id-cp" +#define NID_id_cp 1238 +#define OBJ_id_cp OBJ_id_pkix,14L + +#define SN_id_cct "id-cct" +#define NID_id_cct 268 +#define OBJ_id_cct OBJ_id_pkix,12L + +#define SN_id_ppl "id-ppl" +#define NID_id_ppl 662 +#define OBJ_id_ppl OBJ_id_pkix,21L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix,48L + +#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" +#define NID_id_pkix1_explicit_88 269 +#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L + +#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" +#define NID_id_pkix1_implicit_88 270 +#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L + +#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" +#define NID_id_pkix1_explicit_93 271 +#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L + +#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" +#define NID_id_pkix1_implicit_93 272 +#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L + +#define SN_id_mod_crmf "id-mod-crmf" +#define NID_id_mod_crmf 273 +#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L + +#define SN_id_mod_cmc "id-mod-cmc" +#define NID_id_mod_cmc 274 +#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L + +#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" +#define NID_id_mod_kea_profile_88 275 +#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L + +#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" +#define NID_id_mod_kea_profile_93 276 +#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L + +#define SN_id_mod_cmp "id-mod-cmp" +#define NID_id_mod_cmp 277 +#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L + +#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" +#define NID_id_mod_qualified_cert_88 278 +#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L + +#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" +#define NID_id_mod_qualified_cert_93 279 +#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L + +#define SN_id_mod_attribute_cert "id-mod-attribute-cert" +#define NID_id_mod_attribute_cert 280 +#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L + +#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" +#define NID_id_mod_timestamp_protocol 281 +#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L + +#define SN_id_mod_ocsp "id-mod-ocsp" +#define NID_id_mod_ocsp 282 +#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L + +#define SN_id_mod_dvcs "id-mod-dvcs" +#define NID_id_mod_dvcs 283 +#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L + +#define SN_id_mod_cmp2000 "id-mod-cmp2000" +#define NID_id_mod_cmp2000 284 +#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L + +#define SN_id_mod_cmp2000_02 "id-mod-cmp2000-02" +#define NID_id_mod_cmp2000_02 1251 +#define OBJ_id_mod_cmp2000_02 OBJ_id_pkix_mod,50L + +#define SN_id_mod_cmp2021_88 "id-mod-cmp2021-88" +#define NID_id_mod_cmp2021_88 1252 +#define OBJ_id_mod_cmp2021_88 OBJ_id_pkix_mod,99L + +#define SN_id_mod_cmp2021_02 "id-mod-cmp2021-02" +#define NID_id_mod_cmp2021_02 1253 +#define OBJ_id_mod_cmp2021_02 OBJ_id_pkix_mod,100L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe,1L + +#define SN_biometricInfo "biometricInfo" +#define LN_biometricInfo "Biometric Info" +#define NID_biometricInfo 285 +#define OBJ_biometricInfo OBJ_id_pe,2L + +#define SN_qcStatements "qcStatements" +#define NID_qcStatements 286 +#define OBJ_qcStatements OBJ_id_pe,3L + +#define SN_ac_auditIdentity "ac-auditIdentity" +#define LN_ac_auditIdentity "X509v3 Audit Identity" +#define NID_ac_auditIdentity 287 +#define OBJ_ac_auditIdentity OBJ_id_pe,4L + +#define NID_ac_auditEntity 1323 +#define OBJ_ac_auditEntity OBJ_ac_auditIdentity + +#define SN_ac_targeting "ac-targeting" +#define NID_ac_targeting 288 +#define OBJ_ac_targeting OBJ_id_pe,5L + +#define SN_aaControls "aaControls" +#define NID_aaControls 289 +#define OBJ_aaControls OBJ_id_pe,6L + +#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" +#define NID_sbgp_ipAddrBlock 290 +#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L + +#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" +#define NID_sbgp_autonomousSysNum 291 +#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L + +#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" +#define NID_sbgp_routerIdentifier 292 +#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L + +#define SN_ac_proxying "ac-proxying" +#define NID_ac_proxying 397 +#define OBJ_ac_proxying OBJ_id_pe,10L + +#define SN_sinfo_access "subjectInfoAccess" +#define LN_sinfo_access "Subject Information Access" +#define NID_sinfo_access 398 +#define OBJ_sinfo_access OBJ_id_pe,11L + +#define SN_proxyCertInfo "proxyCertInfo" +#define LN_proxyCertInfo "Proxy Certificate Information" +#define NID_proxyCertInfo 663 +#define OBJ_proxyCertInfo OBJ_id_pe,14L + +#define SN_tlsfeature "tlsfeature" +#define LN_tlsfeature "TLS Feature" +#define NID_tlsfeature 1020 +#define OBJ_tlsfeature OBJ_id_pe,24L + +#define SN_sbgp_ipAddrBlockv2 "sbgp-ipAddrBlockv2" +#define NID_sbgp_ipAddrBlockv2 1239 +#define OBJ_sbgp_ipAddrBlockv2 OBJ_id_pe,28L + +#define SN_sbgp_autonomousSysNumv2 "sbgp-autonomousSysNumv2" +#define NID_sbgp_autonomousSysNumv2 1240 +#define OBJ_sbgp_autonomousSysNumv2 OBJ_id_pe,29L + +#define SN_id_qt_cps "id-qt-cps" +#define LN_id_qt_cps "Policy Qualifier CPS" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_qt,1L + +#define SN_id_qt_unotice "id-qt-unotice" +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_qt,2L + +#define SN_textNotice "textNotice" +#define NID_textNotice 293 +#define OBJ_textNotice OBJ_id_qt,3L + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp,1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp,2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp,3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp,4L + +#define SN_ipsecEndSystem "ipsecEndSystem" +#define LN_ipsecEndSystem "IPSec End System" +#define NID_ipsecEndSystem 294 +#define OBJ_ipsecEndSystem OBJ_id_kp,5L + +#define SN_ipsecTunnel "ipsecTunnel" +#define LN_ipsecTunnel "IPSec Tunnel" +#define NID_ipsecTunnel 295 +#define OBJ_ipsecTunnel OBJ_id_kp,6L + +#define SN_ipsecUser "ipsecUser" +#define LN_ipsecUser "IPSec User" +#define NID_ipsecUser 296 +#define OBJ_ipsecUser OBJ_id_kp,7L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp,8L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp,9L + +#define SN_dvcs "DVCS" +#define LN_dvcs "dvcs" +#define NID_dvcs 297 +#define OBJ_dvcs OBJ_id_kp,10L + +#define SN_ipsec_IKE "ipsecIKE" +#define LN_ipsec_IKE "ipsec Internet Key Exchange" +#define NID_ipsec_IKE 1022 +#define OBJ_ipsec_IKE OBJ_id_kp,17L + +#define SN_capwapAC "capwapAC" +#define LN_capwapAC "Ctrl/provision WAP Access" +#define NID_capwapAC 1023 +#define OBJ_capwapAC OBJ_id_kp,18L + +#define SN_capwapWTP "capwapWTP" +#define LN_capwapWTP "Ctrl/Provision WAP Termination" +#define NID_capwapWTP 1024 +#define OBJ_capwapWTP OBJ_id_kp,19L + +#define SN_sshClient "secureShellClient" +#define LN_sshClient "SSH Client" +#define NID_sshClient 1025 +#define OBJ_sshClient OBJ_id_kp,21L + +#define SN_sshServer "secureShellServer" +#define LN_sshServer "SSH Server" +#define NID_sshServer 1026 +#define OBJ_sshServer OBJ_id_kp,22L + +#define SN_sendRouter "sendRouter" +#define LN_sendRouter "Send Router" +#define NID_sendRouter 1027 +#define OBJ_sendRouter OBJ_id_kp,23L + +#define SN_sendProxiedRouter "sendProxiedRouter" +#define LN_sendProxiedRouter "Send Proxied Router" +#define NID_sendProxiedRouter 1028 +#define OBJ_sendProxiedRouter OBJ_id_kp,24L + +#define SN_sendOwner "sendOwner" +#define LN_sendOwner "Send Owner" +#define NID_sendOwner 1029 +#define OBJ_sendOwner OBJ_id_kp,25L + +#define SN_sendProxiedOwner "sendProxiedOwner" +#define LN_sendProxiedOwner "Send Proxied Owner" +#define NID_sendProxiedOwner 1030 +#define OBJ_sendProxiedOwner OBJ_id_kp,26L + +#define SN_cmcCA "cmcCA" +#define LN_cmcCA "CMC Certificate Authority" +#define NID_cmcCA 1131 +#define OBJ_cmcCA OBJ_id_kp,27L + +#define SN_cmcRA "cmcRA" +#define LN_cmcRA "CMC Registration Authority" +#define NID_cmcRA 1132 +#define OBJ_cmcRA OBJ_id_kp,28L + +#define SN_cmcArchive "cmcArchive" +#define LN_cmcArchive "CMC Archive Server" +#define NID_cmcArchive 1219 +#define OBJ_cmcArchive OBJ_id_kp,29L + +#define SN_id_kp_bgpsec_router "id-kp-bgpsec-router" +#define LN_id_kp_bgpsec_router "BGPsec Router" +#define NID_id_kp_bgpsec_router 1220 +#define OBJ_id_kp_bgpsec_router OBJ_id_kp,30L + +#define SN_id_kp_BrandIndicatorforMessageIdentification "id-kp-BrandIndicatorforMessageIdentification" +#define LN_id_kp_BrandIndicatorforMessageIdentification "Brand Indicator for Message Identification" +#define NID_id_kp_BrandIndicatorforMessageIdentification 1221 +#define OBJ_id_kp_BrandIndicatorforMessageIdentification OBJ_id_kp,31L + +#define SN_cmKGA "cmKGA" +#define LN_cmKGA "Certificate Management Key Generation Authority" +#define NID_cmKGA 1222 +#define OBJ_cmKGA OBJ_id_kp,32L + +#define SN_id_it_caProtEncCert "id-it-caProtEncCert" +#define NID_id_it_caProtEncCert 298 +#define OBJ_id_it_caProtEncCert OBJ_id_it,1L + +#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" +#define NID_id_it_signKeyPairTypes 299 +#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L + +#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" +#define NID_id_it_encKeyPairTypes 300 +#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L + +#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" +#define NID_id_it_preferredSymmAlg 301 +#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L + +#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" +#define NID_id_it_caKeyUpdateInfo 302 +#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L + +#define SN_id_it_currentCRL "id-it-currentCRL" +#define NID_id_it_currentCRL 303 +#define OBJ_id_it_currentCRL OBJ_id_it,6L + +#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" +#define NID_id_it_unsupportedOIDs 304 +#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L + +#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" +#define NID_id_it_subscriptionRequest 305 +#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L + +#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" +#define NID_id_it_subscriptionResponse 306 +#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L + +#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" +#define NID_id_it_keyPairParamReq 307 +#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L + +#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" +#define NID_id_it_keyPairParamRep 308 +#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L + +#define SN_id_it_revPassphrase "id-it-revPassphrase" +#define NID_id_it_revPassphrase 309 +#define OBJ_id_it_revPassphrase OBJ_id_it,12L + +#define SN_id_it_implicitConfirm "id-it-implicitConfirm" +#define NID_id_it_implicitConfirm 310 +#define OBJ_id_it_implicitConfirm OBJ_id_it,13L + +#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" +#define NID_id_it_confirmWaitTime 311 +#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L + +#define SN_id_it_origPKIMessage "id-it-origPKIMessage" +#define NID_id_it_origPKIMessage 312 +#define OBJ_id_it_origPKIMessage OBJ_id_it,15L + +#define SN_id_it_suppLangTags "id-it-suppLangTags" +#define NID_id_it_suppLangTags 784 +#define OBJ_id_it_suppLangTags OBJ_id_it,16L + +#define SN_id_it_caCerts "id-it-caCerts" +#define NID_id_it_caCerts 1223 +#define OBJ_id_it_caCerts OBJ_id_it,17L + +#define SN_id_it_rootCaKeyUpdate "id-it-rootCaKeyUpdate" +#define NID_id_it_rootCaKeyUpdate 1224 +#define OBJ_id_it_rootCaKeyUpdate OBJ_id_it,18L + +#define SN_id_it_certReqTemplate "id-it-certReqTemplate" +#define NID_id_it_certReqTemplate 1225 +#define OBJ_id_it_certReqTemplate OBJ_id_it,19L + +#define SN_id_it_rootCaCert "id-it-rootCaCert" +#define NID_id_it_rootCaCert 1254 +#define OBJ_id_it_rootCaCert OBJ_id_it,20L + +#define SN_id_it_certProfile "id-it-certProfile" +#define NID_id_it_certProfile 1255 +#define OBJ_id_it_certProfile OBJ_id_it,21L + +#define SN_id_it_crlStatusList "id-it-crlStatusList" +#define NID_id_it_crlStatusList 1256 +#define OBJ_id_it_crlStatusList OBJ_id_it,22L + +#define SN_id_it_crls "id-it-crls" +#define NID_id_it_crls 1257 +#define OBJ_id_it_crls OBJ_id_it,23L + +#define SN_id_regCtrl "id-regCtrl" +#define NID_id_regCtrl 313 +#define OBJ_id_regCtrl OBJ_id_pkip,1L + +#define SN_id_regInfo "id-regInfo" +#define NID_id_regInfo 314 +#define OBJ_id_regInfo OBJ_id_pkip,2L + +#define SN_id_regCtrl_regToken "id-regCtrl-regToken" +#define NID_id_regCtrl_regToken 315 +#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L + +#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" +#define NID_id_regCtrl_authenticator 316 +#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L + +#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" +#define NID_id_regCtrl_pkiPublicationInfo 317 +#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L + +#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" +#define NID_id_regCtrl_pkiArchiveOptions 318 +#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L + +#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" +#define NID_id_regCtrl_oldCertID 319 +#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L + +#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" +#define NID_id_regCtrl_protocolEncrKey 320 +#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L + +#define SN_id_regCtrl_altCertTemplate "id-regCtrl-altCertTemplate" +#define NID_id_regCtrl_altCertTemplate 1258 +#define OBJ_id_regCtrl_altCertTemplate OBJ_id_regCtrl,7L + +#define SN_id_regCtrl_algId "id-regCtrl-algId" +#define NID_id_regCtrl_algId 1259 +#define OBJ_id_regCtrl_algId OBJ_id_regCtrl,11L + +#define SN_id_regCtrl_rsaKeyLen "id-regCtrl-rsaKeyLen" +#define NID_id_regCtrl_rsaKeyLen 1260 +#define OBJ_id_regCtrl_rsaKeyLen OBJ_id_regCtrl,12L + +#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" +#define NID_id_regInfo_utf8Pairs 321 +#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L + +#define SN_id_regInfo_certReq "id-regInfo-certReq" +#define NID_id_regInfo_certReq 322 +#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L + +#define SN_id_alg_des40 "id-alg-des40" +#define NID_id_alg_des40 323 +#define OBJ_id_alg_des40 OBJ_id_alg,1L + +#define SN_id_alg_noSignature "id-alg-noSignature" +#define NID_id_alg_noSignature 324 +#define OBJ_id_alg_noSignature OBJ_id_alg,2L + +#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" +#define NID_id_alg_dh_sig_hmac_sha1 325 +#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L + +#define SN_id_alg_dh_pop "id-alg-dh-pop" +#define NID_id_alg_dh_pop 326 +#define OBJ_id_alg_dh_pop OBJ_id_alg,4L + +#define SN_id_cmc_statusInfo "id-cmc-statusInfo" +#define NID_id_cmc_statusInfo 327 +#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L + +#define SN_id_cmc_identification "id-cmc-identification" +#define NID_id_cmc_identification 328 +#define OBJ_id_cmc_identification OBJ_id_cmc,2L + +#define SN_id_cmc_identityProof "id-cmc-identityProof" +#define NID_id_cmc_identityProof 329 +#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L + +#define SN_id_cmc_dataReturn "id-cmc-dataReturn" +#define NID_id_cmc_dataReturn 330 +#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L + +#define SN_id_cmc_transactionId "id-cmc-transactionId" +#define NID_id_cmc_transactionId 331 +#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L + +#define SN_id_cmc_senderNonce "id-cmc-senderNonce" +#define NID_id_cmc_senderNonce 332 +#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L + +#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" +#define NID_id_cmc_recipientNonce 333 +#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L + +#define SN_id_cmc_addExtensions "id-cmc-addExtensions" +#define NID_id_cmc_addExtensions 334 +#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L + +#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" +#define NID_id_cmc_encryptedPOP 335 +#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L + +#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" +#define NID_id_cmc_decryptedPOP 336 +#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L + +#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" +#define NID_id_cmc_lraPOPWitness 337 +#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L + +#define SN_id_cmc_getCert "id-cmc-getCert" +#define NID_id_cmc_getCert 338 +#define OBJ_id_cmc_getCert OBJ_id_cmc,15L + +#define SN_id_cmc_getCRL "id-cmc-getCRL" +#define NID_id_cmc_getCRL 339 +#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L + +#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" +#define NID_id_cmc_revokeRequest 340 +#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L + +#define SN_id_cmc_regInfo "id-cmc-regInfo" +#define NID_id_cmc_regInfo 341 +#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L + +#define SN_id_cmc_responseInfo "id-cmc-responseInfo" +#define NID_id_cmc_responseInfo 342 +#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L + +#define SN_id_cmc_queryPending "id-cmc-queryPending" +#define NID_id_cmc_queryPending 343 +#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L + +#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" +#define NID_id_cmc_popLinkRandom 344 +#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L + +#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" +#define NID_id_cmc_popLinkWitness 345 +#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L + +#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" +#define NID_id_cmc_confirmCertAcceptance 346 +#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L + +#define SN_id_on_personalData "id-on-personalData" +#define NID_id_on_personalData 347 +#define OBJ_id_on_personalData OBJ_id_on,1L + +#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" +#define LN_id_on_permanentIdentifier "Permanent Identifier" +#define NID_id_on_permanentIdentifier 858 +#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L + +#define SN_id_on_hardwareModuleName "id-on-hardwareModuleName" +#define LN_id_on_hardwareModuleName "Hardware Module Name" +#define NID_id_on_hardwareModuleName 1321 +#define OBJ_id_on_hardwareModuleName OBJ_id_on,4L + +#define SN_XmppAddr "id-on-xmppAddr" +#define LN_XmppAddr "XmppAddr" +#define NID_XmppAddr 1209 +#define OBJ_XmppAddr OBJ_id_on,5L + +#define SN_SRVName "id-on-dnsSRV" +#define LN_SRVName "SRVName" +#define NID_SRVName 1210 +#define OBJ_SRVName OBJ_id_on,7L + +#define SN_NAIRealm "id-on-NAIRealm" +#define LN_NAIRealm "NAIRealm" +#define NID_NAIRealm 1211 +#define OBJ_NAIRealm OBJ_id_on,8L + +#define SN_id_on_SmtpUTF8Mailbox "id-on-SmtpUTF8Mailbox" +#define LN_id_on_SmtpUTF8Mailbox "Smtp UTF8 Mailbox" +#define NID_id_on_SmtpUTF8Mailbox 1208 +#define OBJ_id_on_SmtpUTF8Mailbox OBJ_id_on,9L + +#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" +#define NID_id_pda_dateOfBirth 348 +#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L + +#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" +#define NID_id_pda_placeOfBirth 349 +#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L + +#define SN_id_pda_gender "id-pda-gender" +#define NID_id_pda_gender 351 +#define OBJ_id_pda_gender OBJ_id_pda,3L + +#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" +#define NID_id_pda_countryOfCitizenship 352 +#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L + +#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" +#define NID_id_pda_countryOfResidence 353 +#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L + +#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" +#define NID_id_aca_authenticationInfo 354 +#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L + +#define SN_id_aca_accessIdentity "id-aca-accessIdentity" +#define NID_id_aca_accessIdentity 355 +#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L + +#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" +#define NID_id_aca_chargingIdentity 356 +#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L + +#define SN_id_aca_group "id-aca-group" +#define NID_id_aca_group 357 +#define OBJ_id_aca_group OBJ_id_aca,4L + +#define SN_id_aca_role "id-aca-role" +#define NID_id_aca_role 358 +#define OBJ_id_aca_role OBJ_id_aca,5L + +#define SN_id_aca_encAttrs "id-aca-encAttrs" +#define NID_id_aca_encAttrs 399 +#define OBJ_id_aca_encAttrs OBJ_id_aca,6L + +#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" +#define NID_id_qcs_pkixQCSyntax_v1 359 +#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L + +#define SN_ipAddr_asNumber "ipAddr-asNumber" +#define NID_ipAddr_asNumber 1241 +#define OBJ_ipAddr_asNumber OBJ_id_cp,2L + +#define SN_ipAddr_asNumberv2 "ipAddr-asNumberv2" +#define NID_ipAddr_asNumberv2 1242 +#define OBJ_ipAddr_asNumberv2 OBJ_id_cp,3L + +#define SN_id_cct_crs "id-cct-crs" +#define NID_id_cct_crs 360 +#define OBJ_id_cct_crs OBJ_id_cct,1L + +#define SN_id_cct_PKIData "id-cct-PKIData" +#define NID_id_cct_PKIData 361 +#define OBJ_id_cct_PKIData OBJ_id_cct,2L + +#define SN_id_cct_PKIResponse "id-cct-PKIResponse" +#define NID_id_cct_PKIResponse 362 +#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L + +#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" +#define LN_id_ppl_anyLanguage "Any language" +#define NID_id_ppl_anyLanguage 664 +#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L + +#define SN_id_ppl_inheritAll "id-ppl-inheritAll" +#define LN_id_ppl_inheritAll "Inherit all" +#define NID_id_ppl_inheritAll 665 +#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L + +#define SN_Independent "id-ppl-independent" +#define LN_Independent "Independent" +#define NID_Independent 667 +#define OBJ_Independent OBJ_id_ppl,2L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad,1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad,2L + +#define SN_ad_timeStamping "ad_timestamping" +#define LN_ad_timeStamping "AD Time Stamping" +#define NID_ad_timeStamping 363 +#define OBJ_ad_timeStamping OBJ_id_ad,3L + +#define SN_ad_dvcs "AD_DVCS" +#define LN_ad_dvcs "ad dvcs" +#define NID_ad_dvcs 364 +#define OBJ_ad_dvcs OBJ_id_ad,4L + +#define SN_caRepository "caRepository" +#define LN_caRepository "CA Repository" +#define NID_caRepository 785 +#define OBJ_caRepository OBJ_id_ad,5L + +#define SN_rpkiManifest "rpkiManifest" +#define LN_rpkiManifest "RPKI Manifest" +#define NID_rpkiManifest 1243 +#define OBJ_rpkiManifest OBJ_id_ad,10L + +#define SN_signedObject "signedObject" +#define LN_signedObject "Signed Object" +#define NID_signedObject 1244 +#define OBJ_signedObject OBJ_id_ad,11L + +#define SN_rpkiNotify "rpkiNotify" +#define LN_rpkiNotify "RPKI Notify" +#define NID_rpkiNotify 1245 +#define OBJ_rpkiNotify OBJ_id_ad,13L + +#define OBJ_id_pkix_OCSP OBJ_ad_OCSP + +#define SN_id_pkix_OCSP_basic "basicOCSPResponse" +#define LN_id_pkix_OCSP_basic "Basic OCSP Response" +#define NID_id_pkix_OCSP_basic 365 +#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L + +#define SN_id_pkix_OCSP_Nonce "Nonce" +#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" +#define NID_id_pkix_OCSP_Nonce 366 +#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L + +#define SN_id_pkix_OCSP_CrlID "CrlID" +#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" +#define NID_id_pkix_OCSP_CrlID 367 +#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L + +#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" +#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" +#define NID_id_pkix_OCSP_acceptableResponses 368 +#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L + +#define SN_id_pkix_OCSP_noCheck "noCheck" +#define LN_id_pkix_OCSP_noCheck "OCSP No Check" +#define NID_id_pkix_OCSP_noCheck 369 +#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L + +#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" +#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" +#define NID_id_pkix_OCSP_archiveCutoff 370 +#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L + +#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" +#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" +#define NID_id_pkix_OCSP_serviceLocator 371 +#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L + +#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" +#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" +#define NID_id_pkix_OCSP_extendedStatus 372 +#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L + +#define SN_id_pkix_OCSP_valid "valid" +#define NID_id_pkix_OCSP_valid 373 +#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L + +#define SN_id_pkix_OCSP_path "path" +#define NID_id_pkix_OCSP_path 374 +#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L + +#define SN_id_pkix_OCSP_trustRoot "trustRoot" +#define LN_id_pkix_OCSP_trustRoot "Trust Root" +#define NID_id_pkix_OCSP_trustRoot 375 +#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L + +#define SN_algorithm "algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 376 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm,3L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm,6L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +#define OBJ_des_cbc OBJ_algorithm,7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm,8L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +#define OBJ_des_cfb64 OBJ_algorithm,9L + +#define SN_rsaSignature "rsaSignature" +#define NID_rsaSignature 377 +#define OBJ_rsaSignature OBJ_algorithm,11L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm,12L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm,13L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L + +#define SN_des_ede_ecb "DES-EDE" +#define LN_des_ede_ecb "des-ede" +#define NID_des_ede_ecb 32 +#define OBJ_des_ede_ecb OBJ_algorithm,17L + +#define SN_des_ede3_ecb "DES-EDE3" +#define LN_des_ede3_ecb "des-ede3" +#define NID_des_ede3_ecb 33 + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm,18L + +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm,26L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm,29L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L + +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L + +#define SN_blake2bmac "BLAKE2BMAC" +#define LN_blake2bmac "blake2bmac" +#define NID_blake2bmac 1201 +#define OBJ_blake2bmac 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L + +#define SN_blake2smac "BLAKE2SMAC" +#define LN_blake2smac "blake2smac" +#define NID_blake2smac 1202 +#define OBJ_blake2smac 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L + +#define SN_blake2b512 "BLAKE2b512" +#define LN_blake2b512 "blake2b512" +#define NID_blake2b512 1056 +#define OBJ_blake2b512 OBJ_blake2bmac,16L + +#define SN_blake2s256 "BLAKE2s256" +#define LN_blake2s256 "blake2s256" +#define NID_blake2s256 1057 +#define OBJ_blake2s256 OBJ_blake2smac,8L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L,3L,101L,1L,4L,1L + +#define SN_X500 "X500" +#define LN_X500 "directory services (X.500)" +#define NID_X500 11 +#define OBJ_X500 2L,5L + +#define SN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500,4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509,3L + +#define SN_surname "SN" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509,4L + +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509,5L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509,6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509,7L + +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509,8L + +#define SN_streetAddress "street" +#define LN_streetAddress "streetAddress" +#define NID_streetAddress 660 +#define OBJ_streetAddress OBJ_X509,9L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509,10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509,11L + +#define SN_title "title" +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509,12L + +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509,13L + +#define LN_searchGuide "searchGuide" +#define NID_searchGuide 859 +#define OBJ_searchGuide OBJ_X509,14L + +#define LN_businessCategory "businessCategory" +#define NID_businessCategory 860 +#define OBJ_businessCategory OBJ_X509,15L + +#define LN_postalAddress "postalAddress" +#define NID_postalAddress 861 +#define OBJ_postalAddress OBJ_X509,16L + +#define LN_postalCode "postalCode" +#define NID_postalCode 661 +#define OBJ_postalCode OBJ_X509,17L + +#define LN_postOfficeBox "postOfficeBox" +#define NID_postOfficeBox 862 +#define OBJ_postOfficeBox OBJ_X509,18L + +#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" +#define NID_physicalDeliveryOfficeName 863 +#define OBJ_physicalDeliveryOfficeName OBJ_X509,19L + +#define LN_telephoneNumber "telephoneNumber" +#define NID_telephoneNumber 864 +#define OBJ_telephoneNumber OBJ_X509,20L + +#define LN_telexNumber "telexNumber" +#define NID_telexNumber 865 +#define OBJ_telexNumber OBJ_X509,21L + +#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" +#define NID_teletexTerminalIdentifier 866 +#define OBJ_teletexTerminalIdentifier OBJ_X509,22L + +#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" +#define NID_facsimileTelephoneNumber 867 +#define OBJ_facsimileTelephoneNumber OBJ_X509,23L + +#define LN_x121Address "x121Address" +#define NID_x121Address 868 +#define OBJ_x121Address OBJ_X509,24L + +#define LN_internationaliSDNNumber "internationaliSDNNumber" +#define NID_internationaliSDNNumber 869 +#define OBJ_internationaliSDNNumber OBJ_X509,25L + +#define LN_registeredAddress "registeredAddress" +#define NID_registeredAddress 870 +#define OBJ_registeredAddress OBJ_X509,26L + +#define LN_destinationIndicator "destinationIndicator" +#define NID_destinationIndicator 871 +#define OBJ_destinationIndicator OBJ_X509,27L + +#define LN_preferredDeliveryMethod "preferredDeliveryMethod" +#define NID_preferredDeliveryMethod 872 +#define OBJ_preferredDeliveryMethod OBJ_X509,28L + +#define LN_presentationAddress "presentationAddress" +#define NID_presentationAddress 873 +#define OBJ_presentationAddress OBJ_X509,29L + +#define LN_supportedApplicationContext "supportedApplicationContext" +#define NID_supportedApplicationContext 874 +#define OBJ_supportedApplicationContext OBJ_X509,30L + +#define SN_member "member" +#define NID_member 875 +#define OBJ_member OBJ_X509,31L + +#define SN_owner "owner" +#define NID_owner 876 +#define OBJ_owner OBJ_X509,32L + +#define LN_roleOccupant "roleOccupant" +#define NID_roleOccupant 877 +#define OBJ_roleOccupant OBJ_X509,33L + +#define SN_seeAlso "seeAlso" +#define NID_seeAlso 878 +#define OBJ_seeAlso OBJ_X509,34L + +#define LN_userPassword "userPassword" +#define NID_userPassword 879 +#define OBJ_userPassword OBJ_X509,35L + +#define LN_userCertificate "userCertificate" +#define NID_userCertificate 880 +#define OBJ_userCertificate OBJ_X509,36L + +#define LN_cACertificate "cACertificate" +#define NID_cACertificate 881 +#define OBJ_cACertificate OBJ_X509,37L + +#define LN_authorityRevocationList "authorityRevocationList" +#define NID_authorityRevocationList 882 +#define OBJ_authorityRevocationList OBJ_X509,38L + +#define LN_certificateRevocationList "certificateRevocationList" +#define NID_certificateRevocationList 883 +#define OBJ_certificateRevocationList OBJ_X509,39L + +#define LN_crossCertificatePair "crossCertificatePair" +#define NID_crossCertificatePair 884 +#define OBJ_crossCertificatePair OBJ_X509,40L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509,41L + +#define SN_givenName "GN" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509,42L + +#define SN_initials "initials" +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509,43L + +#define LN_generationQualifier "generationQualifier" +#define NID_generationQualifier 509 +#define OBJ_generationQualifier OBJ_X509,44L + +#define LN_x500UniqueIdentifier "x500UniqueIdentifier" +#define NID_x500UniqueIdentifier 503 +#define OBJ_x500UniqueIdentifier OBJ_X509,45L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509,46L + +#define LN_enhancedSearchGuide "enhancedSearchGuide" +#define NID_enhancedSearchGuide 885 +#define OBJ_enhancedSearchGuide OBJ_X509,47L + +#define LN_protocolInformation "protocolInformation" +#define NID_protocolInformation 886 +#define OBJ_protocolInformation OBJ_X509,48L + +#define LN_distinguishedName "distinguishedName" +#define NID_distinguishedName 887 +#define OBJ_distinguishedName OBJ_X509,49L + +#define LN_uniqueMember "uniqueMember" +#define NID_uniqueMember 888 +#define OBJ_uniqueMember OBJ_X509,50L + +#define LN_houseIdentifier "houseIdentifier" +#define NID_houseIdentifier 889 +#define OBJ_houseIdentifier OBJ_X509,51L + +#define LN_supportedAlgorithms "supportedAlgorithms" +#define NID_supportedAlgorithms 890 +#define OBJ_supportedAlgorithms OBJ_X509,52L + +#define LN_deltaRevocationList "deltaRevocationList" +#define NID_deltaRevocationList 891 +#define OBJ_deltaRevocationList OBJ_X509,53L + +#define SN_dmdName "dmdName" +#define NID_dmdName 892 +#define OBJ_dmdName OBJ_X509,54L + +#define LN_pseudonym "pseudonym" +#define NID_pseudonym 510 +#define OBJ_pseudonym OBJ_X509,65L + +#define SN_role "role" +#define LN_role "role" +#define NID_role 400 +#define OBJ_role OBJ_X509,72L + +#define LN_organizationIdentifier "organizationIdentifier" +#define NID_organizationIdentifier 1089 +#define OBJ_organizationIdentifier OBJ_X509,97L + +#define SN_countryCode3c "c3" +#define LN_countryCode3c "countryCode3c" +#define NID_countryCode3c 1090 +#define OBJ_countryCode3c OBJ_X509,98L + +#define SN_countryCode3n "n3" +#define LN_countryCode3n "countryCode3n" +#define NID_countryCode3n 1091 +#define OBJ_countryCode3n OBJ_X509,99L + +#define LN_dnsName "dnsName" +#define NID_dnsName 1092 +#define OBJ_dnsName OBJ_X509,100L + +#define SN_X500algorithms "X500algorithms" +#define LN_X500algorithms "directory services - algorithms" +#define NID_X500algorithms 378 +#define OBJ_X500algorithms OBJ_X500,8L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500algorithms,1L,1L + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2WithRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 OBJ_X500algorithms,3L,101L + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce OBJ_X500,29L + +#define SN_subject_directory_attributes "subjectDirectoryAttributes" +#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" +#define NID_subject_directory_attributes 769 +#define OBJ_subject_directory_attributes OBJ_id_ce,9L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce,14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce,15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce,16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce,17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce,18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce,19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce,20L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "X509v3 CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce,21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce,24L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce,27L + +#define SN_issuing_distribution_point "issuingDistributionPoint" +#define LN_issuing_distribution_point "X509v3 Issuing Distribution Point" +#define NID_issuing_distribution_point 770 +#define OBJ_issuing_distribution_point OBJ_id_ce,28L + +#define SN_certificate_issuer "certificateIssuer" +#define LN_certificate_issuer "X509v3 Certificate Issuer" +#define NID_certificate_issuer 771 +#define OBJ_certificate_issuer OBJ_id_ce,29L + +#define SN_name_constraints "nameConstraints" +#define LN_name_constraints "X509v3 Name Constraints" +#define NID_name_constraints 666 +#define OBJ_name_constraints OBJ_id_ce,30L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce,31L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce,32L + +#define SN_any_policy "anyPolicy" +#define LN_any_policy "X509v3 Any Policy" +#define NID_any_policy 746 +#define OBJ_any_policy OBJ_certificate_policies,0L + +#define SN_policy_mappings "policyMappings" +#define LN_policy_mappings "X509v3 Policy Mappings" +#define NID_policy_mappings 747 +#define OBJ_policy_mappings OBJ_id_ce,33L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce,35L + +#define SN_policy_constraints "policyConstraints" +#define LN_policy_constraints "X509v3 Policy Constraints" +#define NID_policy_constraints 401 +#define OBJ_policy_constraints OBJ_id_ce,36L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce,37L + +#define SN_authority_attribute_identifier "authorityAttributeIdentifier" +#define LN_authority_attribute_identifier "X509v3 Authority Attribute Identifier" +#define NID_authority_attribute_identifier 1295 +#define OBJ_authority_attribute_identifier OBJ_id_ce,38L + +#define SN_role_spec_cert_identifier "roleSpecCertIdentifier" +#define LN_role_spec_cert_identifier "X509v3 Role Specification Certificate Identifier" +#define NID_role_spec_cert_identifier 1296 +#define OBJ_role_spec_cert_identifier OBJ_id_ce,39L + +#define SN_basic_att_constraints "basicAttConstraints" +#define LN_basic_att_constraints "X509v3 Basic Attribute Certificate Constraints" +#define NID_basic_att_constraints 1297 +#define OBJ_basic_att_constraints OBJ_id_ce,41L + +#define SN_delegated_name_constraints "delegatedNameConstraints" +#define LN_delegated_name_constraints "X509v3 Delegated Name Constraints" +#define NID_delegated_name_constraints 1298 +#define OBJ_delegated_name_constraints OBJ_id_ce,42L + +#define SN_time_specification "timeSpecification" +#define LN_time_specification "X509v3 Time Specification" +#define NID_time_specification 1299 +#define OBJ_time_specification OBJ_id_ce,43L + +#define SN_freshest_crl "freshestCRL" +#define LN_freshest_crl "X509v3 Freshest CRL" +#define NID_freshest_crl 857 +#define OBJ_freshest_crl OBJ_id_ce,46L + +#define SN_attribute_descriptor "attributeDescriptor" +#define LN_attribute_descriptor "X509v3 Attribute Descriptor" +#define NID_attribute_descriptor 1300 +#define OBJ_attribute_descriptor OBJ_id_ce,48L + +#define SN_user_notice "userNotice" +#define LN_user_notice "X509v3 User Notice" +#define NID_user_notice 1301 +#define OBJ_user_notice OBJ_id_ce,49L + +#define SN_soa_identifier "sOAIdentifier" +#define LN_soa_identifier "X509v3 Source of Authority Identifier" +#define NID_soa_identifier 1302 +#define OBJ_soa_identifier OBJ_id_ce,50L + +#define SN_acceptable_cert_policies "acceptableCertPolicies" +#define LN_acceptable_cert_policies "X509v3 Acceptable Certification Policies" +#define NID_acceptable_cert_policies 1303 +#define OBJ_acceptable_cert_policies OBJ_id_ce,52L + +#define SN_inhibit_any_policy "inhibitAnyPolicy" +#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" +#define NID_inhibit_any_policy 748 +#define OBJ_inhibit_any_policy OBJ_id_ce,54L + +#define SN_target_information "targetInformation" +#define LN_target_information "X509v3 AC Targeting" +#define NID_target_information 402 +#define OBJ_target_information OBJ_id_ce,55L + +#define SN_no_rev_avail "noRevAvail" +#define LN_no_rev_avail "X509v3 No Revocation Available" +#define NID_no_rev_avail 403 +#define OBJ_no_rev_avail OBJ_id_ce,56L + +#define SN_acceptable_privilege_policies "acceptablePrivPolicies" +#define LN_acceptable_privilege_policies "X509v3 Acceptable Privilege Policies" +#define NID_acceptable_privilege_policies 1304 +#define OBJ_acceptable_privilege_policies OBJ_id_ce,57L + +#define SN_indirect_issuer "indirectIssuer" +#define LN_indirect_issuer "X509v3 Indirect Issuer" +#define NID_indirect_issuer 1305 +#define OBJ_indirect_issuer OBJ_id_ce,61L + +#define SN_no_assertion "noAssertion" +#define LN_no_assertion "X509v3 No Assertion" +#define NID_no_assertion 1306 +#define OBJ_no_assertion OBJ_id_ce,62L + +#define SN_id_aa_issuing_distribution_point "aAissuingDistributionPoint" +#define LN_id_aa_issuing_distribution_point "X509v3 Attribute Authority Issuing Distribution Point" +#define NID_id_aa_issuing_distribution_point 1307 +#define OBJ_id_aa_issuing_distribution_point OBJ_id_ce,63L + +#define SN_issued_on_behalf_of "issuedOnBehalfOf" +#define LN_issued_on_behalf_of "X509v3 Issued On Behalf Of" +#define NID_issued_on_behalf_of 1308 +#define OBJ_issued_on_behalf_of OBJ_id_ce,64L + +#define SN_single_use "singleUse" +#define LN_single_use "X509v3 Single Use" +#define NID_single_use 1309 +#define OBJ_single_use OBJ_id_ce,65L + +#define SN_group_ac "groupAC" +#define LN_group_ac "X509v3 Group Attribute Certificate" +#define NID_group_ac 1310 +#define OBJ_group_ac OBJ_id_ce,66L + +#define SN_allowed_attribute_assignments "allowedAttributeAssignments" +#define LN_allowed_attribute_assignments "X509v3 Allowed Attribute Assignments" +#define NID_allowed_attribute_assignments 1311 +#define OBJ_allowed_attribute_assignments OBJ_id_ce,67L + +#define SN_attribute_mappings "attributeMappings" +#define LN_attribute_mappings "X509v3 Attribute Mappings" +#define NID_attribute_mappings 1312 +#define OBJ_attribute_mappings OBJ_id_ce,68L + +#define SN_holder_name_constraints "holderNameConstraints" +#define LN_holder_name_constraints "X509v3 Holder Name Constraints" +#define NID_holder_name_constraints 1313 +#define OBJ_holder_name_constraints OBJ_id_ce,69L + +#define SN_authorization_validation "authorizationValidation" +#define LN_authorization_validation "X509v3 Authorization Validation" +#define NID_authorization_validation 1314 +#define OBJ_authorization_validation OBJ_id_ce,70L + +#define SN_prot_restrict "protRestrict" +#define LN_prot_restrict "X509v3 Protocol Restriction" +#define NID_prot_restrict 1315 +#define OBJ_prot_restrict OBJ_id_ce,71L + +#define SN_subject_alt_public_key_info "subjectAltPublicKeyInfo" +#define LN_subject_alt_public_key_info "X509v3 Subject Alternative Public Key Info" +#define NID_subject_alt_public_key_info 1316 +#define OBJ_subject_alt_public_key_info OBJ_id_ce,72L + +#define SN_alt_signature_algorithm "altSignatureAlgorithm" +#define LN_alt_signature_algorithm "X509v3 Alternative Signature Algorithm" +#define NID_alt_signature_algorithm 1317 +#define OBJ_alt_signature_algorithm OBJ_id_ce,73L + +#define SN_alt_signature_value "altSignatureValue" +#define LN_alt_signature_value "X509v3 Alternative Signature Value" +#define NID_alt_signature_value 1318 +#define OBJ_alt_signature_value OBJ_id_ce,74L + +#define SN_associated_information "associatedInformation" +#define LN_associated_information "X509v3 Associated Information" +#define NID_associated_information 1319 +#define OBJ_associated_information OBJ_id_ce,75L + +#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" +#define LN_anyExtendedKeyUsage "Any Extended Key Usage" +#define NID_anyExtendedKeyUsage 910 +#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L,16L,840L,1L,113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape,1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape,2L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape,4L,1L + +#define SN_org "ORG" +#define LN_org "org" +#define NID_org 379 +#define OBJ_org OBJ_iso,3L + +#define SN_dod "DOD" +#define LN_dod "dod" +#define NID_dod 380 +#define OBJ_dod OBJ_org,6L + +#define SN_iana "IANA" +#define LN_iana "iana" +#define NID_iana 381 +#define OBJ_iana OBJ_dod,1L + +#define OBJ_internet OBJ_iana + +#define SN_Directory "directory" +#define LN_Directory "Directory" +#define NID_Directory 382 +#define OBJ_Directory OBJ_internet,1L + +#define SN_Management "mgmt" +#define LN_Management "Management" +#define NID_Management 383 +#define OBJ_Management OBJ_internet,2L + +#define SN_Experimental "experimental" +#define LN_Experimental "Experimental" +#define NID_Experimental 384 +#define OBJ_Experimental OBJ_internet,3L + +#define SN_Private "private" +#define LN_Private "Private" +#define NID_Private 385 +#define OBJ_Private OBJ_internet,4L + +#define SN_Security "security" +#define LN_Security "Security" +#define NID_Security 386 +#define OBJ_Security OBJ_internet,5L + +#define SN_SNMPv2 "snmpv2" +#define LN_SNMPv2 "SNMPv2" +#define NID_SNMPv2 387 +#define OBJ_SNMPv2 OBJ_internet,6L + +#define LN_Mail "Mail" +#define NID_Mail 388 +#define OBJ_Mail OBJ_internet,7L + +#define SN_Enterprises "enterprises" +#define LN_Enterprises "Enterprises" +#define NID_Enterprises 389 +#define OBJ_Enterprises OBJ_Private,1L + +#define SN_dcObject "dcobject" +#define LN_dcObject "dcObject" +#define NID_dcObject 390 +#define OBJ_dcObject OBJ_Enterprises,1466L,344L + +#define SN_id_kp_wisun_fan_device "id-kp-wisun-fan-device" +#define LN_id_kp_wisun_fan_device "Wi-SUN Alliance Field Area Network (FAN)" +#define NID_id_kp_wisun_fan_device 1322 +#define OBJ_id_kp_wisun_fan_device OBJ_Enterprises,45605L,1L + +#define SN_mime_mhs "mime-mhs" +#define LN_mime_mhs "MIME MHS" +#define NID_mime_mhs 504 +#define OBJ_mime_mhs OBJ_Mail,1L + +#define SN_mime_mhs_headings "mime-mhs-headings" +#define LN_mime_mhs_headings "mime-mhs-headings" +#define NID_mime_mhs_headings 505 +#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L + +#define SN_mime_mhs_bodies "mime-mhs-bodies" +#define LN_mime_mhs_bodies "mime-mhs-bodies" +#define NID_mime_mhs_bodies 506 +#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L + +#define SN_id_hex_partial_message "id-hex-partial-message" +#define LN_id_hex_partial_message "id-hex-partial-message" +#define NID_id_hex_partial_message 507 +#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L + +#define SN_id_hex_multipart_message "id-hex-multipart-message" +#define LN_id_hex_multipart_message "id-hex-multipart-message" +#define NID_id_hex_multipart_message 508 +#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression OBJ_id_smime_alg,8L + +#define OBJ_csor 2L,16L,840L,1L,101L,3L + +#define OBJ_nistAlgorithms OBJ_csor,4L + +#define OBJ_aes OBJ_nistAlgorithms,1L + +#define SN_aes_128_ecb "AES-128-ECB" +#define LN_aes_128_ecb "aes-128-ecb" +#define NID_aes_128_ecb 418 +#define OBJ_aes_128_ecb OBJ_aes,1L + +#define SN_aes_128_cbc "AES-128-CBC" +#define LN_aes_128_cbc "aes-128-cbc" +#define NID_aes_128_cbc 419 +#define OBJ_aes_128_cbc OBJ_aes,2L + +#define SN_aes_128_ofb128 "AES-128-OFB" +#define LN_aes_128_ofb128 "aes-128-ofb" +#define NID_aes_128_ofb128 420 +#define OBJ_aes_128_ofb128 OBJ_aes,3L + +#define SN_aes_128_cfb128 "AES-128-CFB" +#define LN_aes_128_cfb128 "aes-128-cfb" +#define NID_aes_128_cfb128 421 +#define OBJ_aes_128_cfb128 OBJ_aes,4L + +#define SN_id_aes128_wrap "id-aes128-wrap" +#define NID_id_aes128_wrap 788 +#define OBJ_id_aes128_wrap OBJ_aes,5L + +#define SN_aes_128_gcm "id-aes128-GCM" +#define LN_aes_128_gcm "aes-128-gcm" +#define NID_aes_128_gcm 895 +#define OBJ_aes_128_gcm OBJ_aes,6L + +#define SN_aes_128_ccm "id-aes128-CCM" +#define LN_aes_128_ccm "aes-128-ccm" +#define NID_aes_128_ccm 896 +#define OBJ_aes_128_ccm OBJ_aes,7L + +#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" +#define NID_id_aes128_wrap_pad 897 +#define OBJ_id_aes128_wrap_pad OBJ_aes,8L + +#define SN_aes_192_ecb "AES-192-ECB" +#define LN_aes_192_ecb "aes-192-ecb" +#define NID_aes_192_ecb 422 +#define OBJ_aes_192_ecb OBJ_aes,21L + +#define SN_aes_192_cbc "AES-192-CBC" +#define LN_aes_192_cbc "aes-192-cbc" +#define NID_aes_192_cbc 423 +#define OBJ_aes_192_cbc OBJ_aes,22L + +#define SN_aes_192_ofb128 "AES-192-OFB" +#define LN_aes_192_ofb128 "aes-192-ofb" +#define NID_aes_192_ofb128 424 +#define OBJ_aes_192_ofb128 OBJ_aes,23L + +#define SN_aes_192_cfb128 "AES-192-CFB" +#define LN_aes_192_cfb128 "aes-192-cfb" +#define NID_aes_192_cfb128 425 +#define OBJ_aes_192_cfb128 OBJ_aes,24L + +#define SN_id_aes192_wrap "id-aes192-wrap" +#define NID_id_aes192_wrap 789 +#define OBJ_id_aes192_wrap OBJ_aes,25L + +#define SN_aes_192_gcm "id-aes192-GCM" +#define LN_aes_192_gcm "aes-192-gcm" +#define NID_aes_192_gcm 898 +#define OBJ_aes_192_gcm OBJ_aes,26L + +#define SN_aes_192_ccm "id-aes192-CCM" +#define LN_aes_192_ccm "aes-192-ccm" +#define NID_aes_192_ccm 899 +#define OBJ_aes_192_ccm OBJ_aes,27L + +#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" +#define NID_id_aes192_wrap_pad 900 +#define OBJ_id_aes192_wrap_pad OBJ_aes,28L + +#define SN_aes_256_ecb "AES-256-ECB" +#define LN_aes_256_ecb "aes-256-ecb" +#define NID_aes_256_ecb 426 +#define OBJ_aes_256_ecb OBJ_aes,41L + +#define SN_aes_256_cbc "AES-256-CBC" +#define LN_aes_256_cbc "aes-256-cbc" +#define NID_aes_256_cbc 427 +#define OBJ_aes_256_cbc OBJ_aes,42L + +#define SN_aes_256_ofb128 "AES-256-OFB" +#define LN_aes_256_ofb128 "aes-256-ofb" +#define NID_aes_256_ofb128 428 +#define OBJ_aes_256_ofb128 OBJ_aes,43L + +#define SN_aes_256_cfb128 "AES-256-CFB" +#define LN_aes_256_cfb128 "aes-256-cfb" +#define NID_aes_256_cfb128 429 +#define OBJ_aes_256_cfb128 OBJ_aes,44L + +#define SN_id_aes256_wrap "id-aes256-wrap" +#define NID_id_aes256_wrap 790 +#define OBJ_id_aes256_wrap OBJ_aes,45L + +#define SN_aes_256_gcm "id-aes256-GCM" +#define LN_aes_256_gcm "aes-256-gcm" +#define NID_aes_256_gcm 901 +#define OBJ_aes_256_gcm OBJ_aes,46L + +#define SN_aes_256_ccm "id-aes256-CCM" +#define LN_aes_256_ccm "aes-256-ccm" +#define NID_aes_256_ccm 902 +#define OBJ_aes_256_ccm OBJ_aes,47L + +#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" +#define NID_id_aes256_wrap_pad 903 +#define OBJ_id_aes256_wrap_pad OBJ_aes,48L + +#define SN_aes_128_xts "AES-128-XTS" +#define LN_aes_128_xts "aes-128-xts" +#define NID_aes_128_xts 913 +#define OBJ_aes_128_xts OBJ_ieee_siswg,0L,1L,1L + +#define SN_aes_256_xts "AES-256-XTS" +#define LN_aes_256_xts "aes-256-xts" +#define NID_aes_256_xts 914 +#define OBJ_aes_256_xts OBJ_ieee_siswg,0L,1L,2L + +#define SN_aes_128_cfb1 "AES-128-CFB1" +#define LN_aes_128_cfb1 "aes-128-cfb1" +#define NID_aes_128_cfb1 650 + +#define SN_aes_192_cfb1 "AES-192-CFB1" +#define LN_aes_192_cfb1 "aes-192-cfb1" +#define NID_aes_192_cfb1 651 + +#define SN_aes_256_cfb1 "AES-256-CFB1" +#define LN_aes_256_cfb1 "aes-256-cfb1" +#define NID_aes_256_cfb1 652 + +#define SN_aes_128_cfb8 "AES-128-CFB8" +#define LN_aes_128_cfb8 "aes-128-cfb8" +#define NID_aes_128_cfb8 653 + +#define SN_aes_192_cfb8 "AES-192-CFB8" +#define LN_aes_192_cfb8 "aes-192-cfb8" +#define NID_aes_192_cfb8 654 + +#define SN_aes_256_cfb8 "AES-256-CFB8" +#define LN_aes_256_cfb8 "aes-256-cfb8" +#define NID_aes_256_cfb8 655 + +#define SN_aes_128_ctr "AES-128-CTR" +#define LN_aes_128_ctr "aes-128-ctr" +#define NID_aes_128_ctr 904 + +#define SN_aes_192_ctr "AES-192-CTR" +#define LN_aes_192_ctr "aes-192-ctr" +#define NID_aes_192_ctr 905 + +#define SN_aes_256_ctr "AES-256-CTR" +#define LN_aes_256_ctr "aes-256-ctr" +#define NID_aes_256_ctr 906 + +#define SN_aes_128_ocb "AES-128-OCB" +#define LN_aes_128_ocb "aes-128-ocb" +#define NID_aes_128_ocb 958 + +#define SN_aes_192_ocb "AES-192-OCB" +#define LN_aes_192_ocb "aes-192-ocb" +#define NID_aes_192_ocb 959 + +#define SN_aes_256_ocb "AES-256-OCB" +#define LN_aes_256_ocb "aes-256-ocb" +#define NID_aes_256_ocb 960 + +#define SN_des_cfb1 "DES-CFB1" +#define LN_des_cfb1 "des-cfb1" +#define NID_des_cfb1 656 + +#define SN_des_cfb8 "DES-CFB8" +#define LN_des_cfb8 "des-cfb8" +#define NID_des_cfb8 657 + +#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" +#define LN_des_ede3_cfb1 "des-ede3-cfb1" +#define NID_des_ede3_cfb1 658 + +#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" +#define LN_des_ede3_cfb8 "des-ede3-cfb8" +#define NID_des_ede3_cfb8 659 + +#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L + +#define SN_sha256 "SHA256" +#define LN_sha256 "sha256" +#define NID_sha256 672 +#define OBJ_sha256 OBJ_nist_hashalgs,1L + +#define SN_sha384 "SHA384" +#define LN_sha384 "sha384" +#define NID_sha384 673 +#define OBJ_sha384 OBJ_nist_hashalgs,2L + +#define SN_sha512 "SHA512" +#define LN_sha512 "sha512" +#define NID_sha512 674 +#define OBJ_sha512 OBJ_nist_hashalgs,3L + +#define SN_sha224 "SHA224" +#define LN_sha224 "sha224" +#define NID_sha224 675 +#define OBJ_sha224 OBJ_nist_hashalgs,4L + +#define SN_sha512_224 "SHA512-224" +#define LN_sha512_224 "sha512-224" +#define NID_sha512_224 1094 +#define OBJ_sha512_224 OBJ_nist_hashalgs,5L + +#define SN_sha512_256 "SHA512-256" +#define LN_sha512_256 "sha512-256" +#define NID_sha512_256 1095 +#define OBJ_sha512_256 OBJ_nist_hashalgs,6L + +#define SN_sha3_224 "SHA3-224" +#define LN_sha3_224 "sha3-224" +#define NID_sha3_224 1096 +#define OBJ_sha3_224 OBJ_nist_hashalgs,7L + +#define SN_sha3_256 "SHA3-256" +#define LN_sha3_256 "sha3-256" +#define NID_sha3_256 1097 +#define OBJ_sha3_256 OBJ_nist_hashalgs,8L + +#define SN_sha3_384 "SHA3-384" +#define LN_sha3_384 "sha3-384" +#define NID_sha3_384 1098 +#define OBJ_sha3_384 OBJ_nist_hashalgs,9L + +#define SN_sha3_512 "SHA3-512" +#define LN_sha3_512 "sha3-512" +#define NID_sha3_512 1099 +#define OBJ_sha3_512 OBJ_nist_hashalgs,10L + +#define SN_shake128 "SHAKE128" +#define LN_shake128 "shake128" +#define NID_shake128 1100 +#define OBJ_shake128 OBJ_nist_hashalgs,11L + +#define SN_shake256 "SHAKE256" +#define LN_shake256 "shake256" +#define NID_shake256 1101 +#define OBJ_shake256 OBJ_nist_hashalgs,12L + +#define SN_hmac_sha3_224 "id-hmacWithSHA3-224" +#define LN_hmac_sha3_224 "hmac-sha3-224" +#define NID_hmac_sha3_224 1102 +#define OBJ_hmac_sha3_224 OBJ_nist_hashalgs,13L + +#define SN_hmac_sha3_256 "id-hmacWithSHA3-256" +#define LN_hmac_sha3_256 "hmac-sha3-256" +#define NID_hmac_sha3_256 1103 +#define OBJ_hmac_sha3_256 OBJ_nist_hashalgs,14L + +#define SN_hmac_sha3_384 "id-hmacWithSHA3-384" +#define LN_hmac_sha3_384 "hmac-sha3-384" +#define NID_hmac_sha3_384 1104 +#define OBJ_hmac_sha3_384 OBJ_nist_hashalgs,15L + +#define SN_hmac_sha3_512 "id-hmacWithSHA3-512" +#define LN_hmac_sha3_512 "hmac-sha3-512" +#define NID_hmac_sha3_512 1105 +#define OBJ_hmac_sha3_512 OBJ_nist_hashalgs,16L + +#define SN_kmac128 "KMAC128" +#define LN_kmac128 "kmac128" +#define NID_kmac128 1196 +#define OBJ_kmac128 OBJ_nist_hashalgs,19L + +#define SN_kmac256 "KMAC256" +#define LN_kmac256 "kmac256" +#define NID_kmac256 1197 +#define OBJ_kmac256 OBJ_nist_hashalgs,20L + +#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA224 "dsa_with_SHA224" +#define NID_dsa_with_SHA224 802 +#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L + +#define SN_dsa_with_SHA256 "dsa_with_SHA256" +#define NID_dsa_with_SHA256 803 +#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L + +#define OBJ_sigAlgs OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA384 "id-dsa-with-sha384" +#define LN_dsa_with_SHA384 "dsa_with_SHA384" +#define NID_dsa_with_SHA384 1106 +#define OBJ_dsa_with_SHA384 OBJ_sigAlgs,3L + +#define SN_dsa_with_SHA512 "id-dsa-with-sha512" +#define LN_dsa_with_SHA512 "dsa_with_SHA512" +#define NID_dsa_with_SHA512 1107 +#define OBJ_dsa_with_SHA512 OBJ_sigAlgs,4L + +#define SN_dsa_with_SHA3_224 "id-dsa-with-sha3-224" +#define LN_dsa_with_SHA3_224 "dsa_with_SHA3-224" +#define NID_dsa_with_SHA3_224 1108 +#define OBJ_dsa_with_SHA3_224 OBJ_sigAlgs,5L + +#define SN_dsa_with_SHA3_256 "id-dsa-with-sha3-256" +#define LN_dsa_with_SHA3_256 "dsa_with_SHA3-256" +#define NID_dsa_with_SHA3_256 1109 +#define OBJ_dsa_with_SHA3_256 OBJ_sigAlgs,6L + +#define SN_dsa_with_SHA3_384 "id-dsa-with-sha3-384" +#define LN_dsa_with_SHA3_384 "dsa_with_SHA3-384" +#define NID_dsa_with_SHA3_384 1110 +#define OBJ_dsa_with_SHA3_384 OBJ_sigAlgs,7L + +#define SN_dsa_with_SHA3_512 "id-dsa-with-sha3-512" +#define LN_dsa_with_SHA3_512 "dsa_with_SHA3-512" +#define NID_dsa_with_SHA3_512 1111 +#define OBJ_dsa_with_SHA3_512 OBJ_sigAlgs,8L + +#define SN_ecdsa_with_SHA3_224 "id-ecdsa-with-sha3-224" +#define LN_ecdsa_with_SHA3_224 "ecdsa_with_SHA3-224" +#define NID_ecdsa_with_SHA3_224 1112 +#define OBJ_ecdsa_with_SHA3_224 OBJ_sigAlgs,9L + +#define SN_ecdsa_with_SHA3_256 "id-ecdsa-with-sha3-256" +#define LN_ecdsa_with_SHA3_256 "ecdsa_with_SHA3-256" +#define NID_ecdsa_with_SHA3_256 1113 +#define OBJ_ecdsa_with_SHA3_256 OBJ_sigAlgs,10L + +#define SN_ecdsa_with_SHA3_384 "id-ecdsa-with-sha3-384" +#define LN_ecdsa_with_SHA3_384 "ecdsa_with_SHA3-384" +#define NID_ecdsa_with_SHA3_384 1114 +#define OBJ_ecdsa_with_SHA3_384 OBJ_sigAlgs,11L + +#define SN_ecdsa_with_SHA3_512 "id-ecdsa-with-sha3-512" +#define LN_ecdsa_with_SHA3_512 "ecdsa_with_SHA3-512" +#define NID_ecdsa_with_SHA3_512 1115 +#define OBJ_ecdsa_with_SHA3_512 OBJ_sigAlgs,12L + +#define SN_RSA_SHA3_224 "id-rsassa-pkcs1-v1_5-with-sha3-224" +#define LN_RSA_SHA3_224 "RSA-SHA3-224" +#define NID_RSA_SHA3_224 1116 +#define OBJ_RSA_SHA3_224 OBJ_sigAlgs,13L + +#define SN_RSA_SHA3_256 "id-rsassa-pkcs1-v1_5-with-sha3-256" +#define LN_RSA_SHA3_256 "RSA-SHA3-256" +#define NID_RSA_SHA3_256 1117 +#define OBJ_RSA_SHA3_256 OBJ_sigAlgs,14L + +#define SN_RSA_SHA3_384 "id-rsassa-pkcs1-v1_5-with-sha3-384" +#define LN_RSA_SHA3_384 "RSA-SHA3-384" +#define NID_RSA_SHA3_384 1118 +#define OBJ_RSA_SHA3_384 OBJ_sigAlgs,15L + +#define SN_RSA_SHA3_512 "id-rsassa-pkcs1-v1_5-with-sha3-512" +#define LN_RSA_SHA3_512 "RSA-SHA3-512" +#define NID_RSA_SHA3_512 1119 +#define OBJ_RSA_SHA3_512 OBJ_sigAlgs,16L + +#define SN_ML_DSA_44 "id-ml-dsa-44" +#define LN_ML_DSA_44 "ML-DSA-44" +#define NID_ML_DSA_44 1457 +#define OBJ_ML_DSA_44 OBJ_sigAlgs,17L + +#define SN_ML_DSA_65 "id-ml-dsa-65" +#define LN_ML_DSA_65 "ML-DSA-65" +#define NID_ML_DSA_65 1458 +#define OBJ_ML_DSA_65 OBJ_sigAlgs,18L + +#define SN_ML_DSA_87 "id-ml-dsa-87" +#define LN_ML_DSA_87 "ML-DSA-87" +#define NID_ML_DSA_87 1459 +#define OBJ_ML_DSA_87 OBJ_sigAlgs,19L + +#define SN_SLH_DSA_SHA2_128s "id-slh-dsa-sha2-128s" +#define LN_SLH_DSA_SHA2_128s "SLH-DSA-SHA2-128s" +#define NID_SLH_DSA_SHA2_128s 1460 +#define OBJ_SLH_DSA_SHA2_128s OBJ_sigAlgs,20L + +#define SN_SLH_DSA_SHA2_128f "id-slh-dsa-sha2-128f" +#define LN_SLH_DSA_SHA2_128f "SLH-DSA-SHA2-128f" +#define NID_SLH_DSA_SHA2_128f 1461 +#define OBJ_SLH_DSA_SHA2_128f OBJ_sigAlgs,21L + +#define SN_SLH_DSA_SHA2_192s "id-slh-dsa-sha2-192s" +#define LN_SLH_DSA_SHA2_192s "SLH-DSA-SHA2-192s" +#define NID_SLH_DSA_SHA2_192s 1462 +#define OBJ_SLH_DSA_SHA2_192s OBJ_sigAlgs,22L + +#define SN_SLH_DSA_SHA2_192f "id-slh-dsa-sha2-192f" +#define LN_SLH_DSA_SHA2_192f "SLH-DSA-SHA2-192f" +#define NID_SLH_DSA_SHA2_192f 1463 +#define OBJ_SLH_DSA_SHA2_192f OBJ_sigAlgs,23L + +#define SN_SLH_DSA_SHA2_256s "id-slh-dsa-sha2-256s" +#define LN_SLH_DSA_SHA2_256s "SLH-DSA-SHA2-256s" +#define NID_SLH_DSA_SHA2_256s 1464 +#define OBJ_SLH_DSA_SHA2_256s OBJ_sigAlgs,24L + +#define SN_SLH_DSA_SHA2_256f "id-slh-dsa-sha2-256f" +#define LN_SLH_DSA_SHA2_256f "SLH-DSA-SHA2-256f" +#define NID_SLH_DSA_SHA2_256f 1465 +#define OBJ_SLH_DSA_SHA2_256f OBJ_sigAlgs,25L + +#define SN_SLH_DSA_SHAKE_128s "id-slh-dsa-shake-128s" +#define LN_SLH_DSA_SHAKE_128s "SLH-DSA-SHAKE-128s" +#define NID_SLH_DSA_SHAKE_128s 1466 +#define OBJ_SLH_DSA_SHAKE_128s OBJ_sigAlgs,26L + +#define SN_SLH_DSA_SHAKE_128f "id-slh-dsa-shake-128f" +#define LN_SLH_DSA_SHAKE_128f "SLH-DSA-SHAKE-128f" +#define NID_SLH_DSA_SHAKE_128f 1467 +#define OBJ_SLH_DSA_SHAKE_128f OBJ_sigAlgs,27L + +#define SN_SLH_DSA_SHAKE_192s "id-slh-dsa-shake-192s" +#define LN_SLH_DSA_SHAKE_192s "SLH-DSA-SHAKE-192s" +#define NID_SLH_DSA_SHAKE_192s 1468 +#define OBJ_SLH_DSA_SHAKE_192s OBJ_sigAlgs,28L + +#define SN_SLH_DSA_SHAKE_192f "id-slh-dsa-shake-192f" +#define LN_SLH_DSA_SHAKE_192f "SLH-DSA-SHAKE-192f" +#define NID_SLH_DSA_SHAKE_192f 1469 +#define OBJ_SLH_DSA_SHAKE_192f OBJ_sigAlgs,29L + +#define SN_SLH_DSA_SHAKE_256s "id-slh-dsa-shake-256s" +#define LN_SLH_DSA_SHAKE_256s "SLH-DSA-SHAKE-256s" +#define NID_SLH_DSA_SHAKE_256s 1470 +#define OBJ_SLH_DSA_SHAKE_256s OBJ_sigAlgs,30L + +#define SN_SLH_DSA_SHAKE_256f "id-slh-dsa-shake-256f" +#define LN_SLH_DSA_SHAKE_256f "SLH-DSA-SHAKE-256f" +#define NID_SLH_DSA_SHAKE_256f 1471 +#define OBJ_SLH_DSA_SHAKE_256f OBJ_sigAlgs,31L + +#define SN_HASH_ML_DSA_44_WITH_SHA512 "id-hash-ml-dsa-44-with-sha512" +#define LN_HASH_ML_DSA_44_WITH_SHA512 "HASH-ML-DSA-44-WITH-SHA512" +#define NID_HASH_ML_DSA_44_WITH_SHA512 1472 +#define OBJ_HASH_ML_DSA_44_WITH_SHA512 OBJ_sigAlgs,32L + +#define SN_HASH_ML_DSA_65_WITH_SHA512 "id-hash-ml-dsa-65-with-sha512" +#define LN_HASH_ML_DSA_65_WITH_SHA512 "HASH-ML-DSA-65-WITH-SHA512" +#define NID_HASH_ML_DSA_65_WITH_SHA512 1473 +#define OBJ_HASH_ML_DSA_65_WITH_SHA512 OBJ_sigAlgs,33L + +#define SN_HASH_ML_DSA_87_WITH_SHA512 "id-hash-ml-dsa-87-with-sha512" +#define LN_HASH_ML_DSA_87_WITH_SHA512 "HASH-ML-DSA-87-WITH-SHA512" +#define NID_HASH_ML_DSA_87_WITH_SHA512 1474 +#define OBJ_HASH_ML_DSA_87_WITH_SHA512 OBJ_sigAlgs,34L + +#define SN_SLH_DSA_SHA2_128s_WITH_SHA256 "id-hash-slh-dsa-sha2-128s-with-sha256" +#define LN_SLH_DSA_SHA2_128s_WITH_SHA256 "SLH-DSA-SHA2-128s-WITH-SHA256" +#define NID_SLH_DSA_SHA2_128s_WITH_SHA256 1475 +#define OBJ_SLH_DSA_SHA2_128s_WITH_SHA256 OBJ_sigAlgs,35L + +#define SN_SLH_DSA_SHA2_128f_WITH_SHA256 "id-hash-slh-dsa-sha2-128f-with-sha256" +#define LN_SLH_DSA_SHA2_128f_WITH_SHA256 "SLH-DSA-SHA2-128f-WITH-SHA256" +#define NID_SLH_DSA_SHA2_128f_WITH_SHA256 1476 +#define OBJ_SLH_DSA_SHA2_128f_WITH_SHA256 OBJ_sigAlgs,36L + +#define SN_SLH_DSA_SHA2_192s_WITH_SHA512 "id-hash-slh-dsa-sha2-192s-with-sha512" +#define LN_SLH_DSA_SHA2_192s_WITH_SHA512 "SLH-DSA-SHA2-192s-WITH-SHA512" +#define NID_SLH_DSA_SHA2_192s_WITH_SHA512 1477 +#define OBJ_SLH_DSA_SHA2_192s_WITH_SHA512 OBJ_sigAlgs,37L + +#define SN_SLH_DSA_SHA2_192f_WITH_SHA512 "id-hash-slh-dsa-sha2-192f-with-sha512" +#define LN_SLH_DSA_SHA2_192f_WITH_SHA512 "SLH-DSA-SHA2-192f-WITH-SHA512" +#define NID_SLH_DSA_SHA2_192f_WITH_SHA512 1478 +#define OBJ_SLH_DSA_SHA2_192f_WITH_SHA512 OBJ_sigAlgs,38L + +#define SN_SLH_DSA_SHA2_256s_WITH_SHA512 "id-hash-slh-dsa-sha2-256s-with-sha512" +#define LN_SLH_DSA_SHA2_256s_WITH_SHA512 "SLH-DSA-SHA2-256s-WITH-SHA512" +#define NID_SLH_DSA_SHA2_256s_WITH_SHA512 1479 +#define OBJ_SLH_DSA_SHA2_256s_WITH_SHA512 OBJ_sigAlgs,39L + +#define SN_SLH_DSA_SHA2_256f_WITH_SHA512 "id-hash-slh-dsa-sha2-256f-with-sha512" +#define LN_SLH_DSA_SHA2_256f_WITH_SHA512 "SLH-DSA-SHA2-256f-WITH-SHA512" +#define NID_SLH_DSA_SHA2_256f_WITH_SHA512 1480 +#define OBJ_SLH_DSA_SHA2_256f_WITH_SHA512 OBJ_sigAlgs,40L + +#define SN_SLH_DSA_SHAKE_128s_WITH_SHAKE128 "id-hash-slh-dsa-shake-128s-with-shake128" +#define LN_SLH_DSA_SHAKE_128s_WITH_SHAKE128 "SLH-DSA-SHAKE-128s-WITH-SHAKE128" +#define NID_SLH_DSA_SHAKE_128s_WITH_SHAKE128 1481 +#define OBJ_SLH_DSA_SHAKE_128s_WITH_SHAKE128 OBJ_sigAlgs,41L + +#define SN_SLH_DSA_SHAKE_128f_WITH_SHAKE128 "id-hash-slh-dsa-shake-128f-with-shake128" +#define LN_SLH_DSA_SHAKE_128f_WITH_SHAKE128 "SLH-DSA-SHAKE-128f-WITH-SHAKE128" +#define NID_SLH_DSA_SHAKE_128f_WITH_SHAKE128 1482 +#define OBJ_SLH_DSA_SHAKE_128f_WITH_SHAKE128 OBJ_sigAlgs,42L + +#define SN_SLH_DSA_SHAKE_192s_WITH_SHAKE256 "id-hash-slh-dsa-shake-192s-with-shake256" +#define LN_SLH_DSA_SHAKE_192s_WITH_SHAKE256 "SLH-DSA-SHAKE-192s-WITH-SHAKE256" +#define NID_SLH_DSA_SHAKE_192s_WITH_SHAKE256 1483 +#define OBJ_SLH_DSA_SHAKE_192s_WITH_SHAKE256 OBJ_sigAlgs,43L + +#define SN_SLH_DSA_SHAKE_192f_WITH_SHAKE256 "id-hash-slh-dsa-shake-192f-with-shake256" +#define LN_SLH_DSA_SHAKE_192f_WITH_SHAKE256 "SLH-DSA-SHAKE-192f-WITH-SHAKE256" +#define NID_SLH_DSA_SHAKE_192f_WITH_SHAKE256 1484 +#define OBJ_SLH_DSA_SHAKE_192f_WITH_SHAKE256 OBJ_sigAlgs,44L + +#define SN_SLH_DSA_SHAKE_256s_WITH_SHAKE256 "id-hash-slh-dsa-shake-256s-with-shake256" +#define LN_SLH_DSA_SHAKE_256s_WITH_SHAKE256 "SLH-DSA-SHAKE-256s-WITH-SHAKE256" +#define NID_SLH_DSA_SHAKE_256s_WITH_SHAKE256 1485 +#define OBJ_SLH_DSA_SHAKE_256s_WITH_SHAKE256 OBJ_sigAlgs,45L + +#define SN_SLH_DSA_SHAKE_256f_WITH_SHAKE256 "id-hash-slh-dsa-shake-256f-with-shake256" +#define LN_SLH_DSA_SHAKE_256f_WITH_SHAKE256 "SLH-DSA-SHAKE-256f-WITH-SHAKE256" +#define NID_SLH_DSA_SHAKE_256f_WITH_SHAKE256 1486 +#define OBJ_SLH_DSA_SHAKE_256f_WITH_SHAKE256 OBJ_sigAlgs,46L + +#define SN_hold_instruction_code "holdInstructionCode" +#define LN_hold_instruction_code "Hold Instruction Code" +#define NID_hold_instruction_code 430 +#define OBJ_hold_instruction_code OBJ_id_ce,23L + +#define OBJ_holdInstruction OBJ_X9_57,2L + +#define SN_hold_instruction_none "holdInstructionNone" +#define LN_hold_instruction_none "Hold Instruction None" +#define NID_hold_instruction_none 431 +#define OBJ_hold_instruction_none OBJ_holdInstruction,1L + +#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" +#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" +#define NID_hold_instruction_call_issuer 432 +#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L + +#define SN_hold_instruction_reject "holdInstructionReject" +#define LN_hold_instruction_reject "Hold Instruction Reject" +#define NID_hold_instruction_reject 433 +#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L + +#define SN_itu_t_identified_organization "itu-t-identified-organization" +#define NID_itu_t_identified_organization 1264 +#define OBJ_itu_t_identified_organization OBJ_itu_t,4L + +#define SN_etsi "etsi" +#define NID_etsi 1265 +#define OBJ_etsi OBJ_itu_t_identified_organization,0L + +#define SN_electronic_signature_standard "electronic-signature-standard" +#define NID_electronic_signature_standard 1266 +#define OBJ_electronic_signature_standard OBJ_etsi,1733L + +#define SN_ess_attributes "ess-attributes" +#define NID_ess_attributes 1267 +#define OBJ_ess_attributes OBJ_electronic_signature_standard,2L + +#define SN_id_aa_ets_mimeType "id-aa-ets-mimeType" +#define NID_id_aa_ets_mimeType 1268 +#define OBJ_id_aa_ets_mimeType OBJ_ess_attributes,1L + +#define SN_id_aa_ets_longTermValidation "id-aa-ets-longTermValidation" +#define NID_id_aa_ets_longTermValidation 1269 +#define OBJ_id_aa_ets_longTermValidation OBJ_ess_attributes,2L + +#define SN_id_aa_ets_SignaturePolicyDocument "id-aa-ets-SignaturePolicyDocument" +#define NID_id_aa_ets_SignaturePolicyDocument 1270 +#define OBJ_id_aa_ets_SignaturePolicyDocument OBJ_ess_attributes,3L + +#define SN_id_aa_ets_archiveTimestampV3 "id-aa-ets-archiveTimestampV3" +#define NID_id_aa_ets_archiveTimestampV3 1271 +#define OBJ_id_aa_ets_archiveTimestampV3 OBJ_ess_attributes,4L + +#define SN_id_aa_ATSHashIndex "id-aa-ATSHashIndex" +#define NID_id_aa_ATSHashIndex 1272 +#define OBJ_id_aa_ATSHashIndex OBJ_ess_attributes,5L + +#define SN_cades "cades" +#define NID_cades 1273 +#define OBJ_cades OBJ_etsi,19122L + +#define SN_cades_attributes "cades-attributes" +#define NID_cades_attributes 1274 +#define OBJ_cades_attributes OBJ_cades,1L + +#define SN_id_aa_ets_signerAttrV2 "id-aa-ets-signerAttrV2" +#define NID_id_aa_ets_signerAttrV2 1275 +#define OBJ_id_aa_ets_signerAttrV2 OBJ_cades_attributes,1L + +#define SN_id_aa_ets_sigPolicyStore "id-aa-ets-sigPolicyStore" +#define NID_id_aa_ets_sigPolicyStore 1276 +#define OBJ_id_aa_ets_sigPolicyStore OBJ_cades_attributes,3L + +#define SN_id_aa_ATSHashIndex_v2 "id-aa-ATSHashIndex-v2" +#define NID_id_aa_ATSHashIndex_v2 1277 +#define OBJ_id_aa_ATSHashIndex_v2 OBJ_cades_attributes,4L + +#define SN_id_aa_ATSHashIndex_v3 "id-aa-ATSHashIndex-v3" +#define NID_id_aa_ATSHashIndex_v3 1278 +#define OBJ_id_aa_ATSHashIndex_v3 OBJ_cades_attributes,5L + +#define SN_signedAssertion "signedAssertion" +#define NID_signedAssertion 1279 +#define OBJ_signedAssertion OBJ_cades_attributes,6L + +#define SN_data "data" +#define NID_data 434 +#define OBJ_data OBJ_itu_t,9L + +#define SN_pss "pss" +#define NID_pss 435 +#define OBJ_pss OBJ_data,2342L + +#define SN_ucl "ucl" +#define NID_ucl 436 +#define OBJ_ucl OBJ_pss,19200300L + +#define SN_pilot "pilot" +#define NID_pilot 437 +#define OBJ_pilot OBJ_ucl,100L + +#define LN_pilotAttributeType "pilotAttributeType" +#define NID_pilotAttributeType 438 +#define OBJ_pilotAttributeType OBJ_pilot,1L + +#define LN_pilotAttributeSyntax "pilotAttributeSyntax" +#define NID_pilotAttributeSyntax 439 +#define OBJ_pilotAttributeSyntax OBJ_pilot,3L + +#define LN_pilotObjectClass "pilotObjectClass" +#define NID_pilotObjectClass 440 +#define OBJ_pilotObjectClass OBJ_pilot,4L + +#define LN_pilotGroups "pilotGroups" +#define NID_pilotGroups 441 +#define OBJ_pilotGroups OBJ_pilot,10L + +#define LN_iA5StringSyntax "iA5StringSyntax" +#define NID_iA5StringSyntax 442 +#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L + +#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" +#define NID_caseIgnoreIA5StringSyntax 443 +#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L + +#define LN_pilotObject "pilotObject" +#define NID_pilotObject 444 +#define OBJ_pilotObject OBJ_pilotObjectClass,3L + +#define LN_pilotPerson "pilotPerson" +#define NID_pilotPerson 445 +#define OBJ_pilotPerson OBJ_pilotObjectClass,4L + +#define SN_account "account" +#define NID_account 446 +#define OBJ_account OBJ_pilotObjectClass,5L + +#define SN_document "document" +#define NID_document 447 +#define OBJ_document OBJ_pilotObjectClass,6L + +#define SN_room "room" +#define NID_room 448 +#define OBJ_room OBJ_pilotObjectClass,7L + +#define LN_documentSeries "documentSeries" +#define NID_documentSeries 449 +#define OBJ_documentSeries OBJ_pilotObjectClass,9L + +#define SN_Domain "domain" +#define LN_Domain "Domain" +#define NID_Domain 392 +#define OBJ_Domain OBJ_pilotObjectClass,13L + +#define LN_rFC822localPart "rFC822localPart" +#define NID_rFC822localPart 450 +#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L + +#define LN_dNSDomain "dNSDomain" +#define NID_dNSDomain 451 +#define OBJ_dNSDomain OBJ_pilotObjectClass,15L + +#define LN_domainRelatedObject "domainRelatedObject" +#define NID_domainRelatedObject 452 +#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L + +#define LN_friendlyCountry "friendlyCountry" +#define NID_friendlyCountry 453 +#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L + +#define LN_simpleSecurityObject "simpleSecurityObject" +#define NID_simpleSecurityObject 454 +#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L + +#define LN_pilotOrganization "pilotOrganization" +#define NID_pilotOrganization 455 +#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L + +#define LN_pilotDSA "pilotDSA" +#define NID_pilotDSA 456 +#define OBJ_pilotDSA OBJ_pilotObjectClass,21L + +#define LN_qualityLabelledData "qualityLabelledData" +#define NID_qualityLabelledData 457 +#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L + +#define SN_userId "UID" +#define LN_userId "userId" +#define NID_userId 458 +#define OBJ_userId OBJ_pilotAttributeType,1L + +#define LN_textEncodedORAddress "textEncodedORAddress" +#define NID_textEncodedORAddress 459 +#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L + +#define SN_rfc822Mailbox "mail" +#define LN_rfc822Mailbox "rfc822Mailbox" +#define NID_rfc822Mailbox 460 +#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L + +#define SN_info "info" +#define NID_info 461 +#define OBJ_info OBJ_pilotAttributeType,4L + +#define LN_favouriteDrink "favouriteDrink" +#define NID_favouriteDrink 462 +#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L + +#define LN_roomNumber "roomNumber" +#define NID_roomNumber 463 +#define OBJ_roomNumber OBJ_pilotAttributeType,6L + +#define SN_photo "photo" +#define NID_photo 464 +#define OBJ_photo OBJ_pilotAttributeType,7L + +#define LN_userClass "userClass" +#define NID_userClass 465 +#define OBJ_userClass OBJ_pilotAttributeType,8L + +#define SN_host "host" +#define NID_host 466 +#define OBJ_host OBJ_pilotAttributeType,9L + +#define SN_manager "manager" +#define NID_manager 467 +#define OBJ_manager OBJ_pilotAttributeType,10L + +#define LN_documentIdentifier "documentIdentifier" +#define NID_documentIdentifier 468 +#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L + +#define LN_documentTitle "documentTitle" +#define NID_documentTitle 469 +#define OBJ_documentTitle OBJ_pilotAttributeType,12L + +#define LN_documentVersion "documentVersion" +#define NID_documentVersion 470 +#define OBJ_documentVersion OBJ_pilotAttributeType,13L + +#define LN_documentAuthor "documentAuthor" +#define NID_documentAuthor 471 +#define OBJ_documentAuthor OBJ_pilotAttributeType,14L + +#define LN_documentLocation "documentLocation" +#define NID_documentLocation 472 +#define OBJ_documentLocation OBJ_pilotAttributeType,15L + +#define LN_homeTelephoneNumber "homeTelephoneNumber" +#define NID_homeTelephoneNumber 473 +#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L + +#define SN_secretary "secretary" +#define NID_secretary 474 +#define OBJ_secretary OBJ_pilotAttributeType,21L + +#define LN_otherMailbox "otherMailbox" +#define NID_otherMailbox 475 +#define OBJ_otherMailbox OBJ_pilotAttributeType,22L + +#define LN_lastModifiedTime "lastModifiedTime" +#define NID_lastModifiedTime 476 +#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L + +#define LN_lastModifiedBy "lastModifiedBy" +#define NID_lastModifiedBy 477 +#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L + +#define SN_domainComponent "DC" +#define LN_domainComponent "domainComponent" +#define NID_domainComponent 391 +#define OBJ_domainComponent OBJ_pilotAttributeType,25L + +#define LN_aRecord "aRecord" +#define NID_aRecord 478 +#define OBJ_aRecord OBJ_pilotAttributeType,26L + +#define LN_pilotAttributeType27 "pilotAttributeType27" +#define NID_pilotAttributeType27 479 +#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L + +#define LN_mXRecord "mXRecord" +#define NID_mXRecord 480 +#define OBJ_mXRecord OBJ_pilotAttributeType,28L + +#define LN_nSRecord "nSRecord" +#define NID_nSRecord 481 +#define OBJ_nSRecord OBJ_pilotAttributeType,29L + +#define LN_sOARecord "sOARecord" +#define NID_sOARecord 482 +#define OBJ_sOARecord OBJ_pilotAttributeType,30L + +#define LN_cNAMERecord "cNAMERecord" +#define NID_cNAMERecord 483 +#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L + +#define LN_associatedDomain "associatedDomain" +#define NID_associatedDomain 484 +#define OBJ_associatedDomain OBJ_pilotAttributeType,37L + +#define LN_associatedName "associatedName" +#define NID_associatedName 485 +#define OBJ_associatedName OBJ_pilotAttributeType,38L + +#define LN_homePostalAddress "homePostalAddress" +#define NID_homePostalAddress 486 +#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L + +#define LN_personalTitle "personalTitle" +#define NID_personalTitle 487 +#define OBJ_personalTitle OBJ_pilotAttributeType,40L + +#define LN_mobileTelephoneNumber "mobileTelephoneNumber" +#define NID_mobileTelephoneNumber 488 +#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L + +#define LN_pagerTelephoneNumber "pagerTelephoneNumber" +#define NID_pagerTelephoneNumber 489 +#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L + +#define LN_friendlyCountryName "friendlyCountryName" +#define NID_friendlyCountryName 490 +#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L + +#define SN_uniqueIdentifier "uid" +#define LN_uniqueIdentifier "uniqueIdentifier" +#define NID_uniqueIdentifier 102 +#define OBJ_uniqueIdentifier OBJ_pilotAttributeType,44L + +#define LN_organizationalStatus "organizationalStatus" +#define NID_organizationalStatus 491 +#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L + +#define LN_janetMailbox "janetMailbox" +#define NID_janetMailbox 492 +#define OBJ_janetMailbox OBJ_pilotAttributeType,46L + +#define LN_mailPreferenceOption "mailPreferenceOption" +#define NID_mailPreferenceOption 493 +#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L + +#define LN_buildingName "buildingName" +#define NID_buildingName 494 +#define OBJ_buildingName OBJ_pilotAttributeType,48L + +#define LN_dSAQuality "dSAQuality" +#define NID_dSAQuality 495 +#define OBJ_dSAQuality OBJ_pilotAttributeType,49L + +#define LN_singleLevelQuality "singleLevelQuality" +#define NID_singleLevelQuality 496 +#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L + +#define LN_subtreeMinimumQuality "subtreeMinimumQuality" +#define NID_subtreeMinimumQuality 497 +#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L + +#define LN_subtreeMaximumQuality "subtreeMaximumQuality" +#define NID_subtreeMaximumQuality 498 +#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L + +#define LN_personalSignature "personalSignature" +#define NID_personalSignature 499 +#define OBJ_personalSignature OBJ_pilotAttributeType,53L + +#define LN_dITRedirect "dITRedirect" +#define NID_dITRedirect 500 +#define OBJ_dITRedirect OBJ_pilotAttributeType,54L + +#define SN_audio "audio" +#define NID_audio 501 +#define OBJ_audio OBJ_pilotAttributeType,55L + +#define LN_documentPublisher "documentPublisher" +#define NID_documentPublisher 502 +#define OBJ_documentPublisher OBJ_pilotAttributeType,56L + +#define SN_id_set "id-set" +#define LN_id_set "Secure Electronic Transactions" +#define NID_id_set 512 +#define OBJ_id_set OBJ_international_organizations,42L + +#define SN_set_ctype "set-ctype" +#define LN_set_ctype "content types" +#define NID_set_ctype 513 +#define OBJ_set_ctype OBJ_id_set,0L + +#define SN_set_msgExt "set-msgExt" +#define LN_set_msgExt "message extensions" +#define NID_set_msgExt 514 +#define OBJ_set_msgExt OBJ_id_set,1L + +#define SN_set_attr "set-attr" +#define NID_set_attr 515 +#define OBJ_set_attr OBJ_id_set,3L + +#define SN_set_policy "set-policy" +#define NID_set_policy 516 +#define OBJ_set_policy OBJ_id_set,5L + +#define SN_set_certExt "set-certExt" +#define LN_set_certExt "certificate extensions" +#define NID_set_certExt 517 +#define OBJ_set_certExt OBJ_id_set,7L + +#define SN_set_brand "set-brand" +#define NID_set_brand 518 +#define OBJ_set_brand OBJ_id_set,8L + +#define SN_setct_PANData "setct-PANData" +#define NID_setct_PANData 519 +#define OBJ_setct_PANData OBJ_set_ctype,0L + +#define SN_setct_PANToken "setct-PANToken" +#define NID_setct_PANToken 520 +#define OBJ_setct_PANToken OBJ_set_ctype,1L + +#define SN_setct_PANOnly "setct-PANOnly" +#define NID_setct_PANOnly 521 +#define OBJ_setct_PANOnly OBJ_set_ctype,2L + +#define SN_setct_OIData "setct-OIData" +#define NID_setct_OIData 522 +#define OBJ_setct_OIData OBJ_set_ctype,3L + +#define SN_setct_PI "setct-PI" +#define NID_setct_PI 523 +#define OBJ_setct_PI OBJ_set_ctype,4L + +#define SN_setct_PIData "setct-PIData" +#define NID_setct_PIData 524 +#define OBJ_setct_PIData OBJ_set_ctype,5L + +#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" +#define NID_setct_PIDataUnsigned 525 +#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L + +#define SN_setct_HODInput "setct-HODInput" +#define NID_setct_HODInput 526 +#define OBJ_setct_HODInput OBJ_set_ctype,7L + +#define SN_setct_AuthResBaggage "setct-AuthResBaggage" +#define NID_setct_AuthResBaggage 527 +#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L + +#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" +#define NID_setct_AuthRevReqBaggage 528 +#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L + +#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" +#define NID_setct_AuthRevResBaggage 529 +#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L + +#define SN_setct_CapTokenSeq "setct-CapTokenSeq" +#define NID_setct_CapTokenSeq 530 +#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L + +#define SN_setct_PInitResData "setct-PInitResData" +#define NID_setct_PInitResData 531 +#define OBJ_setct_PInitResData OBJ_set_ctype,12L + +#define SN_setct_PI_TBS "setct-PI-TBS" +#define NID_setct_PI_TBS 532 +#define OBJ_setct_PI_TBS OBJ_set_ctype,13L + +#define SN_setct_PResData "setct-PResData" +#define NID_setct_PResData 533 +#define OBJ_setct_PResData OBJ_set_ctype,14L + +#define SN_setct_AuthReqTBS "setct-AuthReqTBS" +#define NID_setct_AuthReqTBS 534 +#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L + +#define SN_setct_AuthResTBS "setct-AuthResTBS" +#define NID_setct_AuthResTBS 535 +#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L + +#define SN_setct_AuthResTBSX "setct-AuthResTBSX" +#define NID_setct_AuthResTBSX 536 +#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L + +#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" +#define NID_setct_AuthTokenTBS 537 +#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L + +#define SN_setct_CapTokenData "setct-CapTokenData" +#define NID_setct_CapTokenData 538 +#define OBJ_setct_CapTokenData OBJ_set_ctype,20L + +#define SN_setct_CapTokenTBS "setct-CapTokenTBS" +#define NID_setct_CapTokenTBS 539 +#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L + +#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" +#define NID_setct_AcqCardCodeMsg 540 +#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L + +#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" +#define NID_setct_AuthRevReqTBS 541 +#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L + +#define SN_setct_AuthRevResData "setct-AuthRevResData" +#define NID_setct_AuthRevResData 542 +#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L + +#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" +#define NID_setct_AuthRevResTBS 543 +#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L + +#define SN_setct_CapReqTBS "setct-CapReqTBS" +#define NID_setct_CapReqTBS 544 +#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L + +#define SN_setct_CapReqTBSX "setct-CapReqTBSX" +#define NID_setct_CapReqTBSX 545 +#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L + +#define SN_setct_CapResData "setct-CapResData" +#define NID_setct_CapResData 546 +#define OBJ_setct_CapResData OBJ_set_ctype,28L + +#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" +#define NID_setct_CapRevReqTBS 547 +#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L + +#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" +#define NID_setct_CapRevReqTBSX 548 +#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L + +#define SN_setct_CapRevResData "setct-CapRevResData" +#define NID_setct_CapRevResData 549 +#define OBJ_setct_CapRevResData OBJ_set_ctype,31L + +#define SN_setct_CredReqTBS "setct-CredReqTBS" +#define NID_setct_CredReqTBS 550 +#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L + +#define SN_setct_CredReqTBSX "setct-CredReqTBSX" +#define NID_setct_CredReqTBSX 551 +#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L + +#define SN_setct_CredResData "setct-CredResData" +#define NID_setct_CredResData 552 +#define OBJ_setct_CredResData OBJ_set_ctype,34L + +#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" +#define NID_setct_CredRevReqTBS 553 +#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L + +#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" +#define NID_setct_CredRevReqTBSX 554 +#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L + +#define SN_setct_CredRevResData "setct-CredRevResData" +#define NID_setct_CredRevResData 555 +#define OBJ_setct_CredRevResData OBJ_set_ctype,37L + +#define SN_setct_PCertReqData "setct-PCertReqData" +#define NID_setct_PCertReqData 556 +#define OBJ_setct_PCertReqData OBJ_set_ctype,38L + +#define SN_setct_PCertResTBS "setct-PCertResTBS" +#define NID_setct_PCertResTBS 557 +#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L + +#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" +#define NID_setct_BatchAdminReqData 558 +#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L + +#define SN_setct_BatchAdminResData "setct-BatchAdminResData" +#define NID_setct_BatchAdminResData 559 +#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L + +#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" +#define NID_setct_CardCInitResTBS 560 +#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L + +#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" +#define NID_setct_MeAqCInitResTBS 561 +#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L + +#define SN_setct_RegFormResTBS "setct-RegFormResTBS" +#define NID_setct_RegFormResTBS 562 +#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L + +#define SN_setct_CertReqData "setct-CertReqData" +#define NID_setct_CertReqData 563 +#define OBJ_setct_CertReqData OBJ_set_ctype,45L + +#define SN_setct_CertReqTBS "setct-CertReqTBS" +#define NID_setct_CertReqTBS 564 +#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L + +#define SN_setct_CertResData "setct-CertResData" +#define NID_setct_CertResData 565 +#define OBJ_setct_CertResData OBJ_set_ctype,47L + +#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" +#define NID_setct_CertInqReqTBS 566 +#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L + +#define SN_setct_ErrorTBS "setct-ErrorTBS" +#define NID_setct_ErrorTBS 567 +#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L + +#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" +#define NID_setct_PIDualSignedTBE 568 +#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L + +#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" +#define NID_setct_PIUnsignedTBE 569 +#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L + +#define SN_setct_AuthReqTBE "setct-AuthReqTBE" +#define NID_setct_AuthReqTBE 570 +#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L + +#define SN_setct_AuthResTBE "setct-AuthResTBE" +#define NID_setct_AuthResTBE 571 +#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L + +#define SN_setct_AuthResTBEX "setct-AuthResTBEX" +#define NID_setct_AuthResTBEX 572 +#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L + +#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" +#define NID_setct_AuthTokenTBE 573 +#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L + +#define SN_setct_CapTokenTBE "setct-CapTokenTBE" +#define NID_setct_CapTokenTBE 574 +#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L + +#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" +#define NID_setct_CapTokenTBEX 575 +#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L + +#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" +#define NID_setct_AcqCardCodeMsgTBE 576 +#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L + +#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" +#define NID_setct_AuthRevReqTBE 577 +#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L + +#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" +#define NID_setct_AuthRevResTBE 578 +#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L + +#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" +#define NID_setct_AuthRevResTBEB 579 +#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L + +#define SN_setct_CapReqTBE "setct-CapReqTBE" +#define NID_setct_CapReqTBE 580 +#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L + +#define SN_setct_CapReqTBEX "setct-CapReqTBEX" +#define NID_setct_CapReqTBEX 581 +#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L + +#define SN_setct_CapResTBE "setct-CapResTBE" +#define NID_setct_CapResTBE 582 +#define OBJ_setct_CapResTBE OBJ_set_ctype,64L + +#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" +#define NID_setct_CapRevReqTBE 583 +#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L + +#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" +#define NID_setct_CapRevReqTBEX 584 +#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L + +#define SN_setct_CapRevResTBE "setct-CapRevResTBE" +#define NID_setct_CapRevResTBE 585 +#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L + +#define SN_setct_CredReqTBE "setct-CredReqTBE" +#define NID_setct_CredReqTBE 586 +#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L + +#define SN_setct_CredReqTBEX "setct-CredReqTBEX" +#define NID_setct_CredReqTBEX 587 +#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L + +#define SN_setct_CredResTBE "setct-CredResTBE" +#define NID_setct_CredResTBE 588 +#define OBJ_setct_CredResTBE OBJ_set_ctype,70L + +#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" +#define NID_setct_CredRevReqTBE 589 +#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L + +#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" +#define NID_setct_CredRevReqTBEX 590 +#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L + +#define SN_setct_CredRevResTBE "setct-CredRevResTBE" +#define NID_setct_CredRevResTBE 591 +#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L + +#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" +#define NID_setct_BatchAdminReqTBE 592 +#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L + +#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" +#define NID_setct_BatchAdminResTBE 593 +#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L + +#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" +#define NID_setct_RegFormReqTBE 594 +#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L + +#define SN_setct_CertReqTBE "setct-CertReqTBE" +#define NID_setct_CertReqTBE 595 +#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L + +#define SN_setct_CertReqTBEX "setct-CertReqTBEX" +#define NID_setct_CertReqTBEX 596 +#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L + +#define SN_setct_CertResTBE "setct-CertResTBE" +#define NID_setct_CertResTBE 597 +#define OBJ_setct_CertResTBE OBJ_set_ctype,79L + +#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" +#define NID_setct_CRLNotificationTBS 598 +#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L + +#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" +#define NID_setct_CRLNotificationResTBS 599 +#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L + +#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" +#define NID_setct_BCIDistributionTBS 600 +#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L + +#define SN_setext_genCrypt "setext-genCrypt" +#define LN_setext_genCrypt "generic cryptogram" +#define NID_setext_genCrypt 601 +#define OBJ_setext_genCrypt OBJ_set_msgExt,1L + +#define SN_setext_miAuth "setext-miAuth" +#define LN_setext_miAuth "merchant initiated auth" +#define NID_setext_miAuth 602 +#define OBJ_setext_miAuth OBJ_set_msgExt,3L + +#define SN_setext_pinSecure "setext-pinSecure" +#define NID_setext_pinSecure 603 +#define OBJ_setext_pinSecure OBJ_set_msgExt,4L + +#define SN_setext_pinAny "setext-pinAny" +#define NID_setext_pinAny 604 +#define OBJ_setext_pinAny OBJ_set_msgExt,5L + +#define SN_setext_track2 "setext-track2" +#define NID_setext_track2 605 +#define OBJ_setext_track2 OBJ_set_msgExt,7L + +#define SN_setext_cv "setext-cv" +#define LN_setext_cv "additional verification" +#define NID_setext_cv 606 +#define OBJ_setext_cv OBJ_set_msgExt,8L + +#define SN_set_policy_root "set-policy-root" +#define NID_set_policy_root 607 +#define OBJ_set_policy_root OBJ_set_policy,0L + +#define SN_setCext_hashedRoot "setCext-hashedRoot" +#define NID_setCext_hashedRoot 608 +#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L + +#define SN_setCext_certType "setCext-certType" +#define NID_setCext_certType 609 +#define OBJ_setCext_certType OBJ_set_certExt,1L + +#define SN_setCext_merchData "setCext-merchData" +#define NID_setCext_merchData 610 +#define OBJ_setCext_merchData OBJ_set_certExt,2L + +#define SN_setCext_cCertRequired "setCext-cCertRequired" +#define NID_setCext_cCertRequired 611 +#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L + +#define SN_setCext_tunneling "setCext-tunneling" +#define NID_setCext_tunneling 612 +#define OBJ_setCext_tunneling OBJ_set_certExt,4L + +#define SN_setCext_setExt "setCext-setExt" +#define NID_setCext_setExt 613 +#define OBJ_setCext_setExt OBJ_set_certExt,5L + +#define SN_setCext_setQualf "setCext-setQualf" +#define NID_setCext_setQualf 614 +#define OBJ_setCext_setQualf OBJ_set_certExt,6L + +#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" +#define NID_setCext_PGWYcapabilities 615 +#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L + +#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" +#define NID_setCext_TokenIdentifier 616 +#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L + +#define SN_setCext_Track2Data "setCext-Track2Data" +#define NID_setCext_Track2Data 617 +#define OBJ_setCext_Track2Data OBJ_set_certExt,9L + +#define SN_setCext_TokenType "setCext-TokenType" +#define NID_setCext_TokenType 618 +#define OBJ_setCext_TokenType OBJ_set_certExt,10L + +#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" +#define NID_setCext_IssuerCapabilities 619 +#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L + +#define SN_setAttr_Cert "setAttr-Cert" +#define NID_setAttr_Cert 620 +#define OBJ_setAttr_Cert OBJ_set_attr,0L + +#define SN_setAttr_PGWYcap "setAttr-PGWYcap" +#define LN_setAttr_PGWYcap "payment gateway capabilities" +#define NID_setAttr_PGWYcap 621 +#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L + +#define SN_setAttr_TokenType "setAttr-TokenType" +#define NID_setAttr_TokenType 622 +#define OBJ_setAttr_TokenType OBJ_set_attr,2L + +#define SN_setAttr_IssCap "setAttr-IssCap" +#define LN_setAttr_IssCap "issuer capabilities" +#define NID_setAttr_IssCap 623 +#define OBJ_setAttr_IssCap OBJ_set_attr,3L + +#define SN_set_rootKeyThumb "set-rootKeyThumb" +#define NID_set_rootKeyThumb 624 +#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L + +#define SN_set_addPolicy "set-addPolicy" +#define NID_set_addPolicy 625 +#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L + +#define SN_setAttr_Token_EMV "setAttr-Token-EMV" +#define NID_setAttr_Token_EMV 626 +#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L + +#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" +#define NID_setAttr_Token_B0Prime 627 +#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L + +#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" +#define NID_setAttr_IssCap_CVM 628 +#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L + +#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" +#define NID_setAttr_IssCap_T2 629 +#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L + +#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" +#define NID_setAttr_IssCap_Sig 630 +#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L + +#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" +#define LN_setAttr_GenCryptgrm "generate cryptogram" +#define NID_setAttr_GenCryptgrm 631 +#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L + +#define SN_setAttr_T2Enc "setAttr-T2Enc" +#define LN_setAttr_T2Enc "encrypted track 2" +#define NID_setAttr_T2Enc 632 +#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L + +#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" +#define LN_setAttr_T2cleartxt "cleartext track 2" +#define NID_setAttr_T2cleartxt 633 +#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L + +#define SN_setAttr_TokICCsig "setAttr-TokICCsig" +#define LN_setAttr_TokICCsig "ICC or token signature" +#define NID_setAttr_TokICCsig 634 +#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L + +#define SN_setAttr_SecDevSig "setAttr-SecDevSig" +#define LN_setAttr_SecDevSig "secure device signature" +#define NID_setAttr_SecDevSig 635 +#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L + +#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" +#define NID_set_brand_IATA_ATA 636 +#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L + +#define SN_set_brand_Diners "set-brand-Diners" +#define NID_set_brand_Diners 637 +#define OBJ_set_brand_Diners OBJ_set_brand,30L + +#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" +#define NID_set_brand_AmericanExpress 638 +#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L + +#define SN_set_brand_JCB "set-brand-JCB" +#define NID_set_brand_JCB 639 +#define OBJ_set_brand_JCB OBJ_set_brand,35L + +#define SN_set_brand_Visa "set-brand-Visa" +#define NID_set_brand_Visa 640 +#define OBJ_set_brand_Visa OBJ_set_brand,4L + +#define SN_set_brand_MasterCard "set-brand-MasterCard" +#define NID_set_brand_MasterCard 641 +#define OBJ_set_brand_MasterCard OBJ_set_brand,5L + +#define SN_set_brand_Novus "set-brand-Novus" +#define NID_set_brand_Novus 642 +#define OBJ_set_brand_Novus OBJ_set_brand,6011L + +#define SN_des_cdmf "DES-CDMF" +#define LN_des_cdmf "des-cdmf" +#define NID_des_cdmf 643 +#define OBJ_des_cdmf OBJ_rsadsi,3L,10L + +#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" +#define NID_rsaOAEPEncryptionSET 644 +#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L + +#define SN_ipsec3 "Oakley-EC2N-3" +#define LN_ipsec3 "ipsec3" +#define NID_ipsec3 749 + +#define SN_ipsec4 "Oakley-EC2N-4" +#define LN_ipsec4 "ipsec4" +#define NID_ipsec4 750 + +#define SN_whirlpool "whirlpool" +#define NID_whirlpool 804 +#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L + +#define SN_cryptopro "cryptopro" +#define NID_cryptopro 805 +#define OBJ_cryptopro OBJ_member_body,643L,2L,2L + +#define SN_cryptocom "cryptocom" +#define NID_cryptocom 806 +#define OBJ_cryptocom OBJ_member_body,643L,2L,9L + +#define SN_id_tc26 "id-tc26" +#define NID_id_tc26 974 +#define OBJ_id_tc26 OBJ_member_body,643L,7L,1L + +#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" +#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" +#define NID_id_GostR3411_94_with_GostR3410_2001 807 +#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L + +#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" +#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" +#define NID_id_GostR3411_94_with_GostR3410_94 808 +#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L + +#define SN_id_GostR3411_94 "md_gost94" +#define LN_id_GostR3411_94 "GOST R 34.11-94" +#define NID_id_GostR3411_94 809 +#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L + +#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" +#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" +#define NID_id_HMACGostR3411_94 810 +#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L + +#define SN_id_GostR3410_2001 "gost2001" +#define LN_id_GostR3410_2001 "GOST R 34.10-2001" +#define NID_id_GostR3410_2001 811 +#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L + +#define SN_id_GostR3410_94 "gost94" +#define LN_id_GostR3410_94 "GOST R 34.10-94" +#define NID_id_GostR3410_94 812 +#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L + +#define SN_id_Gost28147_89 "gost89" +#define LN_id_Gost28147_89 "GOST 28147-89" +#define NID_id_Gost28147_89 813 +#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L + +#define SN_gost89_cnt "gost89-cnt" +#define NID_gost89_cnt 814 + +#define SN_gost89_cnt_12 "gost89-cnt-12" +#define NID_gost89_cnt_12 975 + +#define SN_gost89_cbc "gost89-cbc" +#define NID_gost89_cbc 1009 + +#define SN_gost89_ecb "gost89-ecb" +#define NID_gost89_ecb 1010 + +#define SN_gost89_ctr "gost89-ctr" +#define NID_gost89_ctr 1011 + +#define SN_id_Gost28147_89_MAC "gost-mac" +#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" +#define NID_id_Gost28147_89_MAC 815 +#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L + +#define SN_gost_mac_12 "gost-mac-12" +#define NID_gost_mac_12 976 + +#define SN_id_GostR3411_94_prf "prf-gostr3411-94" +#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" +#define NID_id_GostR3411_94_prf 816 +#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L + +#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" +#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" +#define NID_id_GostR3410_2001DH 817 +#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L + +#define SN_id_GostR3410_94DH "id-GostR3410-94DH" +#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" +#define NID_id_GostR3410_94DH 818 +#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L + +#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" +#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 +#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L + +#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" +#define NID_id_Gost28147_89_None_KeyMeshing 820 +#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L + +#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" +#define NID_id_GostR3411_94_TestParamSet 821 +#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L + +#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" +#define NID_id_GostR3411_94_CryptoProParamSet 822 +#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L + +#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" +#define NID_id_Gost28147_89_TestParamSet 823 +#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L + +#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 +#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L + +#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 +#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L + +#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 +#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L + +#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 +#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L + +#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 +#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L + +#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" +#define NID_id_GostR3410_94_TestParamSet 831 +#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L + +#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 +#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L + +#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 +#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L + +#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 +#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L + +#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 +#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L + +#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 +#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L + +#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 +#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L + +#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 +#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L + +#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" +#define NID_id_GostR3410_2001_TestParamSet 839 +#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L + +#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 +#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L + +#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 +#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L + +#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 +#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L + +#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 +#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L + +#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 +#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L + +#define SN_id_GostR3410_94_a "id-GostR3410-94-a" +#define NID_id_GostR3410_94_a 845 +#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L + +#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" +#define NID_id_GostR3410_94_aBis 846 +#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L + +#define SN_id_GostR3410_94_b "id-GostR3410-94-b" +#define NID_id_GostR3410_94_b 847 +#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L + +#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" +#define NID_id_GostR3410_94_bBis 848 +#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L + +#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" +#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" +#define NID_id_Gost28147_89_cc 849 +#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L + +#define SN_id_GostR3410_94_cc "gost94cc" +#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" +#define NID_id_GostR3410_94_cc 850 +#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L + +#define SN_id_GostR3410_2001_cc "gost2001cc" +#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" +#define NID_id_GostR3410_2001_cc 851 +#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L + +#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" +#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 +#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L + +#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" +#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 +#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L + +#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" +#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" +#define NID_id_GostR3410_2001_ParamSet_cc 854 +#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L + +#define SN_id_tc26_algorithms "id-tc26-algorithms" +#define NID_id_tc26_algorithms 977 +#define OBJ_id_tc26_algorithms OBJ_id_tc26,1L + +#define SN_id_tc26_sign "id-tc26-sign" +#define NID_id_tc26_sign 978 +#define OBJ_id_tc26_sign OBJ_id_tc26_algorithms,1L + +#define SN_id_GostR3410_2012_256 "gost2012_256" +#define LN_id_GostR3410_2012_256 "GOST R 34.10-2012 with 256 bit modulus" +#define NID_id_GostR3410_2012_256 979 +#define OBJ_id_GostR3410_2012_256 OBJ_id_tc26_sign,1L + +#define SN_id_GostR3410_2012_512 "gost2012_512" +#define LN_id_GostR3410_2012_512 "GOST R 34.10-2012 with 512 bit modulus" +#define NID_id_GostR3410_2012_512 980 +#define OBJ_id_GostR3410_2012_512 OBJ_id_tc26_sign,2L + +#define SN_id_tc26_digest "id-tc26-digest" +#define NID_id_tc26_digest 981 +#define OBJ_id_tc26_digest OBJ_id_tc26_algorithms,2L + +#define SN_id_GostR3411_2012_256 "md_gost12_256" +#define LN_id_GostR3411_2012_256 "GOST R 34.11-2012 with 256 bit hash" +#define NID_id_GostR3411_2012_256 982 +#define OBJ_id_GostR3411_2012_256 OBJ_id_tc26_digest,2L + +#define SN_id_GostR3411_2012_512 "md_gost12_512" +#define LN_id_GostR3411_2012_512 "GOST R 34.11-2012 with 512 bit hash" +#define NID_id_GostR3411_2012_512 983 +#define OBJ_id_GostR3411_2012_512 OBJ_id_tc26_digest,3L + +#define SN_id_tc26_signwithdigest "id-tc26-signwithdigest" +#define NID_id_tc26_signwithdigest 984 +#define OBJ_id_tc26_signwithdigest OBJ_id_tc26_algorithms,3L + +#define SN_id_tc26_signwithdigest_gost3410_2012_256 "id-tc26-signwithdigest-gost3410-2012-256" +#define LN_id_tc26_signwithdigest_gost3410_2012_256 "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" +#define NID_id_tc26_signwithdigest_gost3410_2012_256 985 +#define OBJ_id_tc26_signwithdigest_gost3410_2012_256 OBJ_id_tc26_signwithdigest,2L + +#define SN_id_tc26_signwithdigest_gost3410_2012_512 "id-tc26-signwithdigest-gost3410-2012-512" +#define LN_id_tc26_signwithdigest_gost3410_2012_512 "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" +#define NID_id_tc26_signwithdigest_gost3410_2012_512 986 +#define OBJ_id_tc26_signwithdigest_gost3410_2012_512 OBJ_id_tc26_signwithdigest,3L + +#define SN_id_tc26_mac "id-tc26-mac" +#define NID_id_tc26_mac 987 +#define OBJ_id_tc26_mac OBJ_id_tc26_algorithms,4L + +#define SN_id_tc26_hmac_gost_3411_2012_256 "id-tc26-hmac-gost-3411-2012-256" +#define LN_id_tc26_hmac_gost_3411_2012_256 "HMAC GOST 34.11-2012 256 bit" +#define NID_id_tc26_hmac_gost_3411_2012_256 988 +#define OBJ_id_tc26_hmac_gost_3411_2012_256 OBJ_id_tc26_mac,1L + +#define SN_id_tc26_hmac_gost_3411_2012_512 "id-tc26-hmac-gost-3411-2012-512" +#define LN_id_tc26_hmac_gost_3411_2012_512 "HMAC GOST 34.11-2012 512 bit" +#define NID_id_tc26_hmac_gost_3411_2012_512 989 +#define OBJ_id_tc26_hmac_gost_3411_2012_512 OBJ_id_tc26_mac,2L + +#define SN_id_tc26_cipher "id-tc26-cipher" +#define NID_id_tc26_cipher 990 +#define OBJ_id_tc26_cipher OBJ_id_tc26_algorithms,5L + +#define SN_id_tc26_cipher_gostr3412_2015_magma "id-tc26-cipher-gostr3412-2015-magma" +#define NID_id_tc26_cipher_gostr3412_2015_magma 1173 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma OBJ_id_tc26_cipher,1L + +#define SN_magma_ctr_acpkm "magma-ctr-acpkm" +#define NID_magma_ctr_acpkm 1174 +#define OBJ_magma_ctr_acpkm OBJ_id_tc26_cipher_gostr3412_2015_magma,1L + +#define SN_magma_ctr_acpkm_omac "magma-ctr-acpkm-omac" +#define NID_magma_ctr_acpkm_omac 1175 +#define OBJ_magma_ctr_acpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_magma,2L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik "id-tc26-cipher-gostr3412-2015-kuznyechik" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik 1176 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik OBJ_id_tc26_cipher,2L + +#define SN_kuznyechik_ctr_acpkm "kuznyechik-ctr-acpkm" +#define NID_kuznyechik_ctr_acpkm 1177 +#define OBJ_kuznyechik_ctr_acpkm OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,1L + +#define SN_kuznyechik_ctr_acpkm_omac "kuznyechik-ctr-acpkm-omac" +#define NID_kuznyechik_ctr_acpkm_omac 1178 +#define OBJ_kuznyechik_ctr_acpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,2L + +#define SN_id_tc26_agreement "id-tc26-agreement" +#define NID_id_tc26_agreement 991 +#define OBJ_id_tc26_agreement OBJ_id_tc26_algorithms,6L + +#define SN_id_tc26_agreement_gost_3410_2012_256 "id-tc26-agreement-gost-3410-2012-256" +#define NID_id_tc26_agreement_gost_3410_2012_256 992 +#define OBJ_id_tc26_agreement_gost_3410_2012_256 OBJ_id_tc26_agreement,1L + +#define SN_id_tc26_agreement_gost_3410_2012_512 "id-tc26-agreement-gost-3410-2012-512" +#define NID_id_tc26_agreement_gost_3410_2012_512 993 +#define OBJ_id_tc26_agreement_gost_3410_2012_512 OBJ_id_tc26_agreement,2L + +#define SN_id_tc26_wrap "id-tc26-wrap" +#define NID_id_tc26_wrap 1179 +#define OBJ_id_tc26_wrap OBJ_id_tc26_algorithms,7L + +#define SN_id_tc26_wrap_gostr3412_2015_magma "id-tc26-wrap-gostr3412-2015-magma" +#define NID_id_tc26_wrap_gostr3412_2015_magma 1180 +#define OBJ_id_tc26_wrap_gostr3412_2015_magma OBJ_id_tc26_wrap,1L + +#define SN_magma_kexp15 "magma-kexp15" +#define NID_magma_kexp15 1181 +#define OBJ_magma_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_magma,1L + +#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik "id-tc26-wrap-gostr3412-2015-kuznyechik" +#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik 1182 +#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik OBJ_id_tc26_wrap,2L + +#define SN_kuznyechik_kexp15 "kuznyechik-kexp15" +#define NID_kuznyechik_kexp15 1183 +#define OBJ_kuznyechik_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik,1L + +#define SN_id_tc26_constants "id-tc26-constants" +#define NID_id_tc26_constants 994 +#define OBJ_id_tc26_constants OBJ_id_tc26,2L + +#define SN_id_tc26_sign_constants "id-tc26-sign-constants" +#define NID_id_tc26_sign_constants 995 +#define OBJ_id_tc26_sign_constants OBJ_id_tc26_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_constants "id-tc26-gost-3410-2012-256-constants" +#define NID_id_tc26_gost_3410_2012_256_constants 1147 +#define OBJ_id_tc26_gost_3410_2012_256_constants OBJ_id_tc26_sign_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_paramSetA "id-tc26-gost-3410-2012-256-paramSetA" +#define LN_id_tc26_gost_3410_2012_256_paramSetA "GOST R 34.10-2012 (256 bit) ParamSet A" +#define NID_id_tc26_gost_3410_2012_256_paramSetA 1148 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetA OBJ_id_tc26_gost_3410_2012_256_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_paramSetB "id-tc26-gost-3410-2012-256-paramSetB" +#define LN_id_tc26_gost_3410_2012_256_paramSetB "GOST R 34.10-2012 (256 bit) ParamSet B" +#define NID_id_tc26_gost_3410_2012_256_paramSetB 1184 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetB OBJ_id_tc26_gost_3410_2012_256_constants,2L + +#define SN_id_tc26_gost_3410_2012_256_paramSetC "id-tc26-gost-3410-2012-256-paramSetC" +#define LN_id_tc26_gost_3410_2012_256_paramSetC "GOST R 34.10-2012 (256 bit) ParamSet C" +#define NID_id_tc26_gost_3410_2012_256_paramSetC 1185 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetC OBJ_id_tc26_gost_3410_2012_256_constants,3L + +#define SN_id_tc26_gost_3410_2012_256_paramSetD "id-tc26-gost-3410-2012-256-paramSetD" +#define LN_id_tc26_gost_3410_2012_256_paramSetD "GOST R 34.10-2012 (256 bit) ParamSet D" +#define NID_id_tc26_gost_3410_2012_256_paramSetD 1186 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetD OBJ_id_tc26_gost_3410_2012_256_constants,4L + +#define SN_id_tc26_gost_3410_2012_512_constants "id-tc26-gost-3410-2012-512-constants" +#define NID_id_tc26_gost_3410_2012_512_constants 996 +#define OBJ_id_tc26_gost_3410_2012_512_constants OBJ_id_tc26_sign_constants,2L + +#define SN_id_tc26_gost_3410_2012_512_paramSetTest "id-tc26-gost-3410-2012-512-paramSetTest" +#define LN_id_tc26_gost_3410_2012_512_paramSetTest "GOST R 34.10-2012 (512 bit) testing parameter set" +#define NID_id_tc26_gost_3410_2012_512_paramSetTest 997 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetTest OBJ_id_tc26_gost_3410_2012_512_constants,0L + +#define SN_id_tc26_gost_3410_2012_512_paramSetA "id-tc26-gost-3410-2012-512-paramSetA" +#define LN_id_tc26_gost_3410_2012_512_paramSetA "GOST R 34.10-2012 (512 bit) ParamSet A" +#define NID_id_tc26_gost_3410_2012_512_paramSetA 998 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetA OBJ_id_tc26_gost_3410_2012_512_constants,1L + +#define SN_id_tc26_gost_3410_2012_512_paramSetB "id-tc26-gost-3410-2012-512-paramSetB" +#define LN_id_tc26_gost_3410_2012_512_paramSetB "GOST R 34.10-2012 (512 bit) ParamSet B" +#define NID_id_tc26_gost_3410_2012_512_paramSetB 999 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetB OBJ_id_tc26_gost_3410_2012_512_constants,2L + +#define SN_id_tc26_gost_3410_2012_512_paramSetC "id-tc26-gost-3410-2012-512-paramSetC" +#define LN_id_tc26_gost_3410_2012_512_paramSetC "GOST R 34.10-2012 (512 bit) ParamSet C" +#define NID_id_tc26_gost_3410_2012_512_paramSetC 1149 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetC OBJ_id_tc26_gost_3410_2012_512_constants,3L + +#define SN_id_tc26_digest_constants "id-tc26-digest-constants" +#define NID_id_tc26_digest_constants 1000 +#define OBJ_id_tc26_digest_constants OBJ_id_tc26_constants,2L + +#define SN_id_tc26_cipher_constants "id-tc26-cipher-constants" +#define NID_id_tc26_cipher_constants 1001 +#define OBJ_id_tc26_cipher_constants OBJ_id_tc26_constants,5L + +#define SN_id_tc26_gost_28147_constants "id-tc26-gost-28147-constants" +#define NID_id_tc26_gost_28147_constants 1002 +#define OBJ_id_tc26_gost_28147_constants OBJ_id_tc26_cipher_constants,1L + +#define SN_id_tc26_gost_28147_param_Z "id-tc26-gost-28147-param-Z" +#define LN_id_tc26_gost_28147_param_Z "GOST 28147-89 TC26 parameter set" +#define NID_id_tc26_gost_28147_param_Z 1003 +#define OBJ_id_tc26_gost_28147_param_Z OBJ_id_tc26_gost_28147_constants,1L + +#define SN_INN "INN" +#define LN_INN "INN" +#define NID_INN 1004 +#define OBJ_INN OBJ_member_body,643L,3L,131L,1L,1L + +#define SN_OGRN "OGRN" +#define LN_OGRN "OGRN" +#define NID_OGRN 1005 +#define OBJ_OGRN OBJ_member_body,643L,100L,1L + +#define SN_SNILS "SNILS" +#define LN_SNILS "SNILS" +#define NID_SNILS 1006 +#define OBJ_SNILS OBJ_member_body,643L,100L,3L + +#define SN_OGRNIP "OGRNIP" +#define LN_OGRNIP "OGRNIP" +#define NID_OGRNIP 1226 +#define OBJ_OGRNIP OBJ_member_body,643L,100L,5L + +#define SN_subjectSignTool "subjectSignTool" +#define LN_subjectSignTool "Signing Tool of Subject" +#define NID_subjectSignTool 1007 +#define OBJ_subjectSignTool OBJ_member_body,643L,100L,111L + +#define SN_issuerSignTool "issuerSignTool" +#define LN_issuerSignTool "Signing Tool of Issuer" +#define NID_issuerSignTool 1008 +#define OBJ_issuerSignTool OBJ_member_body,643L,100L,112L + +#define SN_classSignTool "classSignTool" +#define LN_classSignTool "Class of Signing Tool" +#define NID_classSignTool 1227 +#define OBJ_classSignTool OBJ_member_body,643L,100L,113L + +#define SN_classSignToolKC1 "classSignToolKC1" +#define LN_classSignToolKC1 "Class of Signing Tool KC1" +#define NID_classSignToolKC1 1228 +#define OBJ_classSignToolKC1 OBJ_member_body,643L,100L,113L,1L + +#define SN_classSignToolKC2 "classSignToolKC2" +#define LN_classSignToolKC2 "Class of Signing Tool KC2" +#define NID_classSignToolKC2 1229 +#define OBJ_classSignToolKC2 OBJ_member_body,643L,100L,113L,2L + +#define SN_classSignToolKC3 "classSignToolKC3" +#define LN_classSignToolKC3 "Class of Signing Tool KC3" +#define NID_classSignToolKC3 1230 +#define OBJ_classSignToolKC3 OBJ_member_body,643L,100L,113L,3L + +#define SN_classSignToolKB1 "classSignToolKB1" +#define LN_classSignToolKB1 "Class of Signing Tool KB1" +#define NID_classSignToolKB1 1231 +#define OBJ_classSignToolKB1 OBJ_member_body,643L,100L,113L,4L + +#define SN_classSignToolKB2 "classSignToolKB2" +#define LN_classSignToolKB2 "Class of Signing Tool KB2" +#define NID_classSignToolKB2 1232 +#define OBJ_classSignToolKB2 OBJ_member_body,643L,100L,113L,5L + +#define SN_classSignToolKA1 "classSignToolKA1" +#define LN_classSignToolKA1 "Class of Signing Tool KA1" +#define NID_classSignToolKA1 1233 +#define OBJ_classSignToolKA1 OBJ_member_body,643L,100L,113L,6L + +#define SN_kuznyechik_ecb "kuznyechik-ecb" +#define NID_kuznyechik_ecb 1012 + +#define SN_kuznyechik_ctr "kuznyechik-ctr" +#define NID_kuznyechik_ctr 1013 + +#define SN_kuznyechik_ofb "kuznyechik-ofb" +#define NID_kuznyechik_ofb 1014 + +#define SN_kuznyechik_cbc "kuznyechik-cbc" +#define NID_kuznyechik_cbc 1015 + +#define SN_kuznyechik_cfb "kuznyechik-cfb" +#define NID_kuznyechik_cfb 1016 + +#define SN_kuznyechik_mac "kuznyechik-mac" +#define NID_kuznyechik_mac 1017 + +#define SN_magma_ecb "magma-ecb" +#define NID_magma_ecb 1187 + +#define SN_magma_ctr "magma-ctr" +#define NID_magma_ctr 1188 + +#define SN_magma_ofb "magma-ofb" +#define NID_magma_ofb 1189 + +#define SN_magma_cbc "magma-cbc" +#define NID_magma_cbc 1190 + +#define SN_magma_cfb "magma-cfb" +#define NID_magma_cfb 1191 + +#define SN_magma_mac "magma-mac" +#define NID_magma_mac 1192 + +#define SN_camellia_128_cbc "CAMELLIA-128-CBC" +#define LN_camellia_128_cbc "camellia-128-cbc" +#define NID_camellia_128_cbc 751 +#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L + +#define SN_camellia_192_cbc "CAMELLIA-192-CBC" +#define LN_camellia_192_cbc "camellia-192-cbc" +#define NID_camellia_192_cbc 752 +#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L + +#define SN_camellia_256_cbc "CAMELLIA-256-CBC" +#define LN_camellia_256_cbc "camellia-256-cbc" +#define NID_camellia_256_cbc 753 +#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L + +#define SN_id_camellia128_wrap "id-camellia128-wrap" +#define NID_id_camellia128_wrap 907 +#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L + +#define SN_id_camellia192_wrap "id-camellia192-wrap" +#define NID_id_camellia192_wrap 908 +#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L + +#define SN_id_camellia256_wrap "id-camellia256-wrap" +#define NID_id_camellia256_wrap 909 +#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L + +#define OBJ_ntt_ds 0L,3L,4401L,5L + +#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L + +#define SN_camellia_128_ecb "CAMELLIA-128-ECB" +#define LN_camellia_128_ecb "camellia-128-ecb" +#define NID_camellia_128_ecb 754 +#define OBJ_camellia_128_ecb OBJ_camellia,1L + +#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" +#define LN_camellia_128_ofb128 "camellia-128-ofb" +#define NID_camellia_128_ofb128 766 +#define OBJ_camellia_128_ofb128 OBJ_camellia,3L + +#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" +#define LN_camellia_128_cfb128 "camellia-128-cfb" +#define NID_camellia_128_cfb128 757 +#define OBJ_camellia_128_cfb128 OBJ_camellia,4L + +#define SN_camellia_128_gcm "CAMELLIA-128-GCM" +#define LN_camellia_128_gcm "camellia-128-gcm" +#define NID_camellia_128_gcm 961 +#define OBJ_camellia_128_gcm OBJ_camellia,6L + +#define SN_camellia_128_ccm "CAMELLIA-128-CCM" +#define LN_camellia_128_ccm "camellia-128-ccm" +#define NID_camellia_128_ccm 962 +#define OBJ_camellia_128_ccm OBJ_camellia,7L + +#define SN_camellia_128_ctr "CAMELLIA-128-CTR" +#define LN_camellia_128_ctr "camellia-128-ctr" +#define NID_camellia_128_ctr 963 +#define OBJ_camellia_128_ctr OBJ_camellia,9L + +#define SN_camellia_128_cmac "CAMELLIA-128-CMAC" +#define LN_camellia_128_cmac "camellia-128-cmac" +#define NID_camellia_128_cmac 964 +#define OBJ_camellia_128_cmac OBJ_camellia,10L + +#define SN_camellia_192_ecb "CAMELLIA-192-ECB" +#define LN_camellia_192_ecb "camellia-192-ecb" +#define NID_camellia_192_ecb 755 +#define OBJ_camellia_192_ecb OBJ_camellia,21L + +#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" +#define LN_camellia_192_ofb128 "camellia-192-ofb" +#define NID_camellia_192_ofb128 767 +#define OBJ_camellia_192_ofb128 OBJ_camellia,23L + +#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" +#define LN_camellia_192_cfb128 "camellia-192-cfb" +#define NID_camellia_192_cfb128 758 +#define OBJ_camellia_192_cfb128 OBJ_camellia,24L + +#define SN_camellia_192_gcm "CAMELLIA-192-GCM" +#define LN_camellia_192_gcm "camellia-192-gcm" +#define NID_camellia_192_gcm 965 +#define OBJ_camellia_192_gcm OBJ_camellia,26L + +#define SN_camellia_192_ccm "CAMELLIA-192-CCM" +#define LN_camellia_192_ccm "camellia-192-ccm" +#define NID_camellia_192_ccm 966 +#define OBJ_camellia_192_ccm OBJ_camellia,27L + +#define SN_camellia_192_ctr "CAMELLIA-192-CTR" +#define LN_camellia_192_ctr "camellia-192-ctr" +#define NID_camellia_192_ctr 967 +#define OBJ_camellia_192_ctr OBJ_camellia,29L + +#define SN_camellia_192_cmac "CAMELLIA-192-CMAC" +#define LN_camellia_192_cmac "camellia-192-cmac" +#define NID_camellia_192_cmac 968 +#define OBJ_camellia_192_cmac OBJ_camellia,30L + +#define SN_camellia_256_ecb "CAMELLIA-256-ECB" +#define LN_camellia_256_ecb "camellia-256-ecb" +#define NID_camellia_256_ecb 756 +#define OBJ_camellia_256_ecb OBJ_camellia,41L + +#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" +#define LN_camellia_256_ofb128 "camellia-256-ofb" +#define NID_camellia_256_ofb128 768 +#define OBJ_camellia_256_ofb128 OBJ_camellia,43L + +#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" +#define LN_camellia_256_cfb128 "camellia-256-cfb" +#define NID_camellia_256_cfb128 759 +#define OBJ_camellia_256_cfb128 OBJ_camellia,44L + +#define SN_camellia_256_gcm "CAMELLIA-256-GCM" +#define LN_camellia_256_gcm "camellia-256-gcm" +#define NID_camellia_256_gcm 969 +#define OBJ_camellia_256_gcm OBJ_camellia,46L + +#define SN_camellia_256_ccm "CAMELLIA-256-CCM" +#define LN_camellia_256_ccm "camellia-256-ccm" +#define NID_camellia_256_ccm 970 +#define OBJ_camellia_256_ccm OBJ_camellia,47L + +#define SN_camellia_256_ctr "CAMELLIA-256-CTR" +#define LN_camellia_256_ctr "camellia-256-ctr" +#define NID_camellia_256_ctr 971 +#define OBJ_camellia_256_ctr OBJ_camellia,49L + +#define SN_camellia_256_cmac "CAMELLIA-256-CMAC" +#define LN_camellia_256_cmac "camellia-256-cmac" +#define NID_camellia_256_cmac 972 +#define OBJ_camellia_256_cmac OBJ_camellia,50L + +#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" +#define LN_camellia_128_cfb1 "camellia-128-cfb1" +#define NID_camellia_128_cfb1 760 + +#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" +#define LN_camellia_192_cfb1 "camellia-192-cfb1" +#define NID_camellia_192_cfb1 761 + +#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" +#define LN_camellia_256_cfb1 "camellia-256-cfb1" +#define NID_camellia_256_cfb1 762 + +#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" +#define LN_camellia_128_cfb8 "camellia-128-cfb8" +#define NID_camellia_128_cfb8 763 + +#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" +#define LN_camellia_192_cfb8 "camellia-192-cfb8" +#define NID_camellia_192_cfb8 764 + +#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" +#define LN_camellia_256_cfb8 "camellia-256-cfb8" +#define NID_camellia_256_cfb8 765 + +#define OBJ_aria 1L,2L,410L,200046L,1L,1L + +#define SN_aria_128_ecb "ARIA-128-ECB" +#define LN_aria_128_ecb "aria-128-ecb" +#define NID_aria_128_ecb 1065 +#define OBJ_aria_128_ecb OBJ_aria,1L + +#define SN_aria_128_cbc "ARIA-128-CBC" +#define LN_aria_128_cbc "aria-128-cbc" +#define NID_aria_128_cbc 1066 +#define OBJ_aria_128_cbc OBJ_aria,2L + +#define SN_aria_128_cfb128 "ARIA-128-CFB" +#define LN_aria_128_cfb128 "aria-128-cfb" +#define NID_aria_128_cfb128 1067 +#define OBJ_aria_128_cfb128 OBJ_aria,3L + +#define SN_aria_128_ofb128 "ARIA-128-OFB" +#define LN_aria_128_ofb128 "aria-128-ofb" +#define NID_aria_128_ofb128 1068 +#define OBJ_aria_128_ofb128 OBJ_aria,4L + +#define SN_aria_128_ctr "ARIA-128-CTR" +#define LN_aria_128_ctr "aria-128-ctr" +#define NID_aria_128_ctr 1069 +#define OBJ_aria_128_ctr OBJ_aria,5L + +#define SN_aria_192_ecb "ARIA-192-ECB" +#define LN_aria_192_ecb "aria-192-ecb" +#define NID_aria_192_ecb 1070 +#define OBJ_aria_192_ecb OBJ_aria,6L + +#define SN_aria_192_cbc "ARIA-192-CBC" +#define LN_aria_192_cbc "aria-192-cbc" +#define NID_aria_192_cbc 1071 +#define OBJ_aria_192_cbc OBJ_aria,7L + +#define SN_aria_192_cfb128 "ARIA-192-CFB" +#define LN_aria_192_cfb128 "aria-192-cfb" +#define NID_aria_192_cfb128 1072 +#define OBJ_aria_192_cfb128 OBJ_aria,8L + +#define SN_aria_192_ofb128 "ARIA-192-OFB" +#define LN_aria_192_ofb128 "aria-192-ofb" +#define NID_aria_192_ofb128 1073 +#define OBJ_aria_192_ofb128 OBJ_aria,9L + +#define SN_aria_192_ctr "ARIA-192-CTR" +#define LN_aria_192_ctr "aria-192-ctr" +#define NID_aria_192_ctr 1074 +#define OBJ_aria_192_ctr OBJ_aria,10L + +#define SN_aria_256_ecb "ARIA-256-ECB" +#define LN_aria_256_ecb "aria-256-ecb" +#define NID_aria_256_ecb 1075 +#define OBJ_aria_256_ecb OBJ_aria,11L + +#define SN_aria_256_cbc "ARIA-256-CBC" +#define LN_aria_256_cbc "aria-256-cbc" +#define NID_aria_256_cbc 1076 +#define OBJ_aria_256_cbc OBJ_aria,12L + +#define SN_aria_256_cfb128 "ARIA-256-CFB" +#define LN_aria_256_cfb128 "aria-256-cfb" +#define NID_aria_256_cfb128 1077 +#define OBJ_aria_256_cfb128 OBJ_aria,13L + +#define SN_aria_256_ofb128 "ARIA-256-OFB" +#define LN_aria_256_ofb128 "aria-256-ofb" +#define NID_aria_256_ofb128 1078 +#define OBJ_aria_256_ofb128 OBJ_aria,14L + +#define SN_aria_256_ctr "ARIA-256-CTR" +#define LN_aria_256_ctr "aria-256-ctr" +#define NID_aria_256_ctr 1079 +#define OBJ_aria_256_ctr OBJ_aria,15L + +#define SN_aria_128_cfb1 "ARIA-128-CFB1" +#define LN_aria_128_cfb1 "aria-128-cfb1" +#define NID_aria_128_cfb1 1080 + +#define SN_aria_192_cfb1 "ARIA-192-CFB1" +#define LN_aria_192_cfb1 "aria-192-cfb1" +#define NID_aria_192_cfb1 1081 + +#define SN_aria_256_cfb1 "ARIA-256-CFB1" +#define LN_aria_256_cfb1 "aria-256-cfb1" +#define NID_aria_256_cfb1 1082 + +#define SN_aria_128_cfb8 "ARIA-128-CFB8" +#define LN_aria_128_cfb8 "aria-128-cfb8" +#define NID_aria_128_cfb8 1083 + +#define SN_aria_192_cfb8 "ARIA-192-CFB8" +#define LN_aria_192_cfb8 "aria-192-cfb8" +#define NID_aria_192_cfb8 1084 + +#define SN_aria_256_cfb8 "ARIA-256-CFB8" +#define LN_aria_256_cfb8 "aria-256-cfb8" +#define NID_aria_256_cfb8 1085 + +#define SN_aria_128_ccm "ARIA-128-CCM" +#define LN_aria_128_ccm "aria-128-ccm" +#define NID_aria_128_ccm 1120 +#define OBJ_aria_128_ccm OBJ_aria,37L + +#define SN_aria_192_ccm "ARIA-192-CCM" +#define LN_aria_192_ccm "aria-192-ccm" +#define NID_aria_192_ccm 1121 +#define OBJ_aria_192_ccm OBJ_aria,38L + +#define SN_aria_256_ccm "ARIA-256-CCM" +#define LN_aria_256_ccm "aria-256-ccm" +#define NID_aria_256_ccm 1122 +#define OBJ_aria_256_ccm OBJ_aria,39L + +#define SN_aria_128_gcm "ARIA-128-GCM" +#define LN_aria_128_gcm "aria-128-gcm" +#define NID_aria_128_gcm 1123 +#define OBJ_aria_128_gcm OBJ_aria,34L + +#define SN_aria_192_gcm "ARIA-192-GCM" +#define LN_aria_192_gcm "aria-192-gcm" +#define NID_aria_192_gcm 1124 +#define OBJ_aria_192_gcm OBJ_aria,35L + +#define SN_aria_256_gcm "ARIA-256-GCM" +#define LN_aria_256_gcm "aria-256-gcm" +#define NID_aria_256_gcm 1125 +#define OBJ_aria_256_gcm OBJ_aria,36L + +#define SN_kisa "KISA" +#define LN_kisa "kisa" +#define NID_kisa 773 +#define OBJ_kisa OBJ_member_body,410L,200004L + +#define SN_seed_ecb "SEED-ECB" +#define LN_seed_ecb "seed-ecb" +#define NID_seed_ecb 776 +#define OBJ_seed_ecb OBJ_kisa,1L,3L + +#define SN_seed_cbc "SEED-CBC" +#define LN_seed_cbc "seed-cbc" +#define NID_seed_cbc 777 +#define OBJ_seed_cbc OBJ_kisa,1L,4L + +#define SN_seed_cfb128 "SEED-CFB" +#define LN_seed_cfb128 "seed-cfb" +#define NID_seed_cfb128 779 +#define OBJ_seed_cfb128 OBJ_kisa,1L,5L + +#define SN_seed_ofb128 "SEED-OFB" +#define LN_seed_ofb128 "seed-ofb" +#define NID_seed_ofb128 778 +#define OBJ_seed_ofb128 OBJ_kisa,1L,6L + +#define SN_sm4_ecb "SM4-ECB" +#define LN_sm4_ecb "sm4-ecb" +#define NID_sm4_ecb 1133 +#define OBJ_sm4_ecb OBJ_sm_scheme,104L,1L + +#define SN_sm4_cbc "SM4-CBC" +#define LN_sm4_cbc "sm4-cbc" +#define NID_sm4_cbc 1134 +#define OBJ_sm4_cbc OBJ_sm_scheme,104L,2L + +#define SN_sm4_ofb128 "SM4-OFB" +#define LN_sm4_ofb128 "sm4-ofb" +#define NID_sm4_ofb128 1135 +#define OBJ_sm4_ofb128 OBJ_sm_scheme,104L,3L + +#define SN_sm4_cfb128 "SM4-CFB" +#define LN_sm4_cfb128 "sm4-cfb" +#define NID_sm4_cfb128 1137 +#define OBJ_sm4_cfb128 OBJ_sm_scheme,104L,4L + +#define SN_sm4_cfb1 "SM4-CFB1" +#define LN_sm4_cfb1 "sm4-cfb1" +#define NID_sm4_cfb1 1136 +#define OBJ_sm4_cfb1 OBJ_sm_scheme,104L,5L + +#define SN_sm4_cfb8 "SM4-CFB8" +#define LN_sm4_cfb8 "sm4-cfb8" +#define NID_sm4_cfb8 1138 +#define OBJ_sm4_cfb8 OBJ_sm_scheme,104L,6L + +#define SN_sm4_ctr "SM4-CTR" +#define LN_sm4_ctr "sm4-ctr" +#define NID_sm4_ctr 1139 +#define OBJ_sm4_ctr OBJ_sm_scheme,104L,7L + +#define SN_sm4_gcm "SM4-GCM" +#define LN_sm4_gcm "sm4-gcm" +#define NID_sm4_gcm 1248 +#define OBJ_sm4_gcm OBJ_sm_scheme,104L,8L + +#define SN_sm4_ccm "SM4-CCM" +#define LN_sm4_ccm "sm4-ccm" +#define NID_sm4_ccm 1249 +#define OBJ_sm4_ccm OBJ_sm_scheme,104L,9L + +#define SN_sm4_xts "SM4-XTS" +#define LN_sm4_xts "sm4-xts" +#define NID_sm4_xts 1290 +#define OBJ_sm4_xts OBJ_sm_scheme,104L,10L + +#define SN_hmac "HMAC" +#define LN_hmac "hmac" +#define NID_hmac 855 + +#define SN_cmac "CMAC" +#define LN_cmac "cmac" +#define NID_cmac 894 + +#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" +#define LN_rc4_hmac_md5 "rc4-hmac-md5" +#define NID_rc4_hmac_md5 915 + +#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" +#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" +#define NID_aes_128_cbc_hmac_sha1 916 + +#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" +#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" +#define NID_aes_192_cbc_hmac_sha1 917 + +#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" +#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" +#define NID_aes_256_cbc_hmac_sha1 918 + +#define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" +#define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" +#define NID_aes_128_cbc_hmac_sha256 948 + +#define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" +#define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" +#define NID_aes_192_cbc_hmac_sha256 949 + +#define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" +#define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" +#define NID_aes_256_cbc_hmac_sha256 950 + +#define SN_chacha20_poly1305 "ChaCha20-Poly1305" +#define LN_chacha20_poly1305 "chacha20-poly1305" +#define NID_chacha20_poly1305 1018 + +#define SN_chacha20 "ChaCha20" +#define LN_chacha20 "chacha20" +#define NID_chacha20 1019 + +#define SN_aes_128_cbc_hmac_sha1_etm "AES-128-CBC-HMAC-SHA1-ETM" +#define LN_aes_128_cbc_hmac_sha1_etm "aes-128-cbc-hmac-sha1-etm" +#define NID_aes_128_cbc_hmac_sha1_etm 1487 + +#define SN_aes_192_cbc_hmac_sha1_etm "AES-192-CBC-HMAC-SHA1-ETM" +#define LN_aes_192_cbc_hmac_sha1_etm "aes-192-cbc-hmac-sha1-etm" +#define NID_aes_192_cbc_hmac_sha1_etm 1488 + +#define SN_aes_256_cbc_hmac_sha1_etm "AES-256-CBC-HMAC-SHA1-ETM" +#define LN_aes_256_cbc_hmac_sha1_etm "aes-256-cbc-hmac-sha1-etm" +#define NID_aes_256_cbc_hmac_sha1_etm 1489 + +#define SN_aes_128_cbc_hmac_sha256_etm "AES-128-CBC-HMAC-SHA256-ETM" +#define LN_aes_128_cbc_hmac_sha256_etm "aes-128-cbc-hmac-sha256-etm" +#define NID_aes_128_cbc_hmac_sha256_etm 1490 + +#define SN_aes_192_cbc_hmac_sha256_etm "AES-192-CBC-HMAC-SHA256-ETM" +#define LN_aes_192_cbc_hmac_sha256_etm "aes-192-cbc-hmac-sha256-etm" +#define NID_aes_192_cbc_hmac_sha256_etm 1491 + +#define SN_aes_256_cbc_hmac_sha256_etm "AES-256-CBC-HMAC-SHA256-ETM" +#define LN_aes_256_cbc_hmac_sha256_etm "aes-256-cbc-hmac-sha256-etm" +#define NID_aes_256_cbc_hmac_sha256_etm 1492 + +#define SN_aes_128_cbc_hmac_sha512_etm "AES-128-CBC-HMAC-SHA512-ETM" +#define LN_aes_128_cbc_hmac_sha512_etm "aes-128-cbc-hmac-sha512-etm" +#define NID_aes_128_cbc_hmac_sha512_etm 1493 + +#define SN_aes_192_cbc_hmac_sha512_etm "AES-192-CBC-HMAC-SHA512-ETM" +#define LN_aes_192_cbc_hmac_sha512_etm "aes-192-cbc-hmac-sha512-etm" +#define NID_aes_192_cbc_hmac_sha512_etm 1494 + +#define SN_aes_256_cbc_hmac_sha512_etm "AES-256-CBC-HMAC-SHA512-ETM" +#define LN_aes_256_cbc_hmac_sha512_etm "aes-256-cbc-hmac-sha512-etm" +#define NID_aes_256_cbc_hmac_sha512_etm 1495 + +#define SN_dhpublicnumber "dhpublicnumber" +#define LN_dhpublicnumber "X9.42 DH" +#define NID_dhpublicnumber 920 +#define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L + +#define SN_brainpoolP160r1 "brainpoolP160r1" +#define NID_brainpoolP160r1 921 +#define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L + +#define SN_brainpoolP160t1 "brainpoolP160t1" +#define NID_brainpoolP160t1 922 +#define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L + +#define SN_brainpoolP192r1 "brainpoolP192r1" +#define NID_brainpoolP192r1 923 +#define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L + +#define SN_brainpoolP192t1 "brainpoolP192t1" +#define NID_brainpoolP192t1 924 +#define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L + +#define SN_brainpoolP224r1 "brainpoolP224r1" +#define NID_brainpoolP224r1 925 +#define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L + +#define SN_brainpoolP224t1 "brainpoolP224t1" +#define NID_brainpoolP224t1 926 +#define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L + +#define SN_brainpoolP256r1 "brainpoolP256r1" +#define NID_brainpoolP256r1 927 +#define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L + +#define SN_brainpoolP256r1tls13 "brainpoolP256r1tls13" +#define NID_brainpoolP256r1tls13 1285 + +#define SN_brainpoolP256t1 "brainpoolP256t1" +#define NID_brainpoolP256t1 928 +#define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L + +#define SN_brainpoolP320r1 "brainpoolP320r1" +#define NID_brainpoolP320r1 929 +#define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L + +#define SN_brainpoolP320t1 "brainpoolP320t1" +#define NID_brainpoolP320t1 930 +#define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L + +#define SN_brainpoolP384r1 "brainpoolP384r1" +#define NID_brainpoolP384r1 931 +#define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L + +#define SN_brainpoolP384r1tls13 "brainpoolP384r1tls13" +#define NID_brainpoolP384r1tls13 1286 + +#define SN_brainpoolP384t1 "brainpoolP384t1" +#define NID_brainpoolP384t1 932 +#define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L + +#define SN_brainpoolP512r1 "brainpoolP512r1" +#define NID_brainpoolP512r1 933 +#define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L + +#define SN_brainpoolP512r1tls13 "brainpoolP512r1tls13" +#define NID_brainpoolP512r1tls13 1287 + +#define SN_brainpoolP512t1 "brainpoolP512t1" +#define NID_brainpoolP512t1 934 +#define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L + +#define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L + +#define OBJ_secg_scheme OBJ_certicom_arc,1L + +#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" +#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 +#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L + +#define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" +#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 +#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L + +#define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" +#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 +#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L + +#define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" +#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 +#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L + +#define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" +#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 +#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L + +#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 +#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L + +#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 +#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L + +#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 +#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L + +#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 +#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L + +#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 +#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L + +#define SN_dh_std_kdf "dh-std-kdf" +#define NID_dh_std_kdf 946 + +#define SN_dh_cofactor_kdf "dh-cofactor-kdf" +#define NID_dh_cofactor_kdf 947 + +#define SN_ct_precert_scts "ct_precert_scts" +#define LN_ct_precert_scts "CT Precertificate SCTs" +#define NID_ct_precert_scts 951 +#define OBJ_ct_precert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,2L + +#define SN_ct_precert_poison "ct_precert_poison" +#define LN_ct_precert_poison "CT Precertificate Poison" +#define NID_ct_precert_poison 952 +#define OBJ_ct_precert_poison 1L,3L,6L,1L,4L,1L,11129L,2L,4L,3L + +#define SN_ct_precert_signer "ct_precert_signer" +#define LN_ct_precert_signer "CT Precertificate Signer" +#define NID_ct_precert_signer 953 +#define OBJ_ct_precert_signer 1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L + +#define SN_ct_cert_scts "ct_cert_scts" +#define LN_ct_cert_scts "CT Certificate SCTs" +#define NID_ct_cert_scts 954 +#define OBJ_ct_cert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L + +#define SN_jurisdictionLocalityName "jurisdictionL" +#define LN_jurisdictionLocalityName "jurisdictionLocalityName" +#define NID_jurisdictionLocalityName 955 +#define OBJ_jurisdictionLocalityName OBJ_ms_corp,60L,2L,1L,1L + +#define SN_jurisdictionStateOrProvinceName "jurisdictionST" +#define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" +#define NID_jurisdictionStateOrProvinceName 956 +#define OBJ_jurisdictionStateOrProvinceName OBJ_ms_corp,60L,2L,1L,2L + +#define SN_jurisdictionCountryName "jurisdictionC" +#define LN_jurisdictionCountryName "jurisdictionCountryName" +#define NID_jurisdictionCountryName 957 +#define OBJ_jurisdictionCountryName OBJ_ms_corp,60L,2L,1L,3L + +#define SN_id_scrypt "id-scrypt" +#define LN_id_scrypt "scrypt" +#define NID_id_scrypt 973 +#define OBJ_id_scrypt 1L,3L,6L,1L,4L,1L,11591L,4L,11L + +#define SN_tls1_prf "TLS1-PRF" +#define LN_tls1_prf "tls1-prf" +#define NID_tls1_prf 1021 + +#define SN_hkdf "HKDF" +#define LN_hkdf "hkdf" +#define NID_hkdf 1036 + +#define SN_sshkdf "SSHKDF" +#define LN_sshkdf "sshkdf" +#define NID_sshkdf 1203 + +#define SN_sskdf "SSKDF" +#define LN_sskdf "sskdf" +#define NID_sskdf 1205 + +#define SN_x942kdf "X942KDF" +#define LN_x942kdf "x942kdf" +#define NID_x942kdf 1207 + +#define SN_x963kdf "X963KDF" +#define LN_x963kdf "x963kdf" +#define NID_x963kdf 1206 + +#define SN_id_pkinit "id-pkinit" +#define NID_id_pkinit 1031 +#define OBJ_id_pkinit 1L,3L,6L,1L,5L,2L,3L + +#define SN_pkInitClientAuth "pkInitClientAuth" +#define LN_pkInitClientAuth "PKINIT Client Auth" +#define NID_pkInitClientAuth 1032 +#define OBJ_pkInitClientAuth OBJ_id_pkinit,4L + +#define SN_pkInitKDC "pkInitKDC" +#define LN_pkInitKDC "Signing KDC Response" +#define NID_pkInitKDC 1033 +#define OBJ_pkInitKDC OBJ_id_pkinit,5L + +#define SN_X25519 "X25519" +#define NID_X25519 1034 +#define OBJ_X25519 1L,3L,101L,110L + +#define SN_X448 "X448" +#define NID_X448 1035 +#define OBJ_X448 1L,3L,101L,111L + +#define SN_ED25519 "ED25519" +#define NID_ED25519 1087 +#define OBJ_ED25519 1L,3L,101L,112L + +#define SN_ED448 "ED448" +#define NID_ED448 1088 +#define OBJ_ED448 1L,3L,101L,113L + +#define SN_kx_rsa "KxRSA" +#define LN_kx_rsa "kx-rsa" +#define NID_kx_rsa 1037 + +#define SN_kx_ecdhe "KxECDHE" +#define LN_kx_ecdhe "kx-ecdhe" +#define NID_kx_ecdhe 1038 + +#define SN_kx_dhe "KxDHE" +#define LN_kx_dhe "kx-dhe" +#define NID_kx_dhe 1039 + +#define SN_kx_ecdhe_psk "KxECDHE-PSK" +#define LN_kx_ecdhe_psk "kx-ecdhe-psk" +#define NID_kx_ecdhe_psk 1040 + +#define SN_kx_dhe_psk "KxDHE-PSK" +#define LN_kx_dhe_psk "kx-dhe-psk" +#define NID_kx_dhe_psk 1041 + +#define SN_kx_rsa_psk "KxRSA_PSK" +#define LN_kx_rsa_psk "kx-rsa-psk" +#define NID_kx_rsa_psk 1042 + +#define SN_kx_psk "KxPSK" +#define LN_kx_psk "kx-psk" +#define NID_kx_psk 1043 + +#define SN_kx_srp "KxSRP" +#define LN_kx_srp "kx-srp" +#define NID_kx_srp 1044 + +#define SN_kx_gost "KxGOST" +#define LN_kx_gost "kx-gost" +#define NID_kx_gost 1045 + +#define SN_kx_gost18 "KxGOST18" +#define LN_kx_gost18 "kx-gost18" +#define NID_kx_gost18 1218 + +#define SN_kx_any "KxANY" +#define LN_kx_any "kx-any" +#define NID_kx_any 1063 + +#define SN_auth_rsa "AuthRSA" +#define LN_auth_rsa "auth-rsa" +#define NID_auth_rsa 1046 + +#define SN_auth_ecdsa "AuthECDSA" +#define LN_auth_ecdsa "auth-ecdsa" +#define NID_auth_ecdsa 1047 + +#define SN_auth_psk "AuthPSK" +#define LN_auth_psk "auth-psk" +#define NID_auth_psk 1048 + +#define SN_auth_dss "AuthDSS" +#define LN_auth_dss "auth-dss" +#define NID_auth_dss 1049 + +#define SN_auth_gost01 "AuthGOST01" +#define LN_auth_gost01 "auth-gost01" +#define NID_auth_gost01 1050 + +#define SN_auth_gost12 "AuthGOST12" +#define LN_auth_gost12 "auth-gost12" +#define NID_auth_gost12 1051 + +#define SN_auth_srp "AuthSRP" +#define LN_auth_srp "auth-srp" +#define NID_auth_srp 1052 + +#define SN_auth_null "AuthNULL" +#define LN_auth_null "auth-null" +#define NID_auth_null 1053 + +#define SN_auth_any "AuthANY" +#define LN_auth_any "auth-any" +#define NID_auth_any 1064 + +#define SN_poly1305 "Poly1305" +#define LN_poly1305 "poly1305" +#define NID_poly1305 1061 + +#define SN_siphash "SipHash" +#define LN_siphash "siphash" +#define NID_siphash 1062 + +#define SN_ffdhe2048 "ffdhe2048" +#define NID_ffdhe2048 1126 + +#define SN_ffdhe3072 "ffdhe3072" +#define NID_ffdhe3072 1127 + +#define SN_ffdhe4096 "ffdhe4096" +#define NID_ffdhe4096 1128 + +#define SN_ffdhe6144 "ffdhe6144" +#define NID_ffdhe6144 1129 + +#define SN_ffdhe8192 "ffdhe8192" +#define NID_ffdhe8192 1130 + +#define SN_modp_1536 "modp_1536" +#define NID_modp_1536 1212 + +#define SN_modp_2048 "modp_2048" +#define NID_modp_2048 1213 + +#define SN_modp_3072 "modp_3072" +#define NID_modp_3072 1214 + +#define SN_modp_4096 "modp_4096" +#define NID_modp_4096 1215 + +#define SN_modp_6144 "modp_6144" +#define NID_modp_6144 1216 + +#define SN_modp_8192 "modp_8192" +#define NID_modp_8192 1217 + +#define SN_ISO_UA "ISO-UA" +#define NID_ISO_UA 1150 +#define OBJ_ISO_UA OBJ_member_body,804L + +#define SN_ua_pki "ua-pki" +#define NID_ua_pki 1151 +#define OBJ_ua_pki OBJ_ISO_UA,2L,1L,1L,1L + +#define SN_dstu28147 "dstu28147" +#define LN_dstu28147 "DSTU Gost 28147-2009" +#define NID_dstu28147 1152 +#define OBJ_dstu28147 OBJ_ua_pki,1L,1L,1L + +#define SN_dstu28147_ofb "dstu28147-ofb" +#define LN_dstu28147_ofb "DSTU Gost 28147-2009 OFB mode" +#define NID_dstu28147_ofb 1153 +#define OBJ_dstu28147_ofb OBJ_dstu28147,2L + +#define SN_dstu28147_cfb "dstu28147-cfb" +#define LN_dstu28147_cfb "DSTU Gost 28147-2009 CFB mode" +#define NID_dstu28147_cfb 1154 +#define OBJ_dstu28147_cfb OBJ_dstu28147,3L + +#define SN_dstu28147_wrap "dstu28147-wrap" +#define LN_dstu28147_wrap "DSTU Gost 28147-2009 key wrap" +#define NID_dstu28147_wrap 1155 +#define OBJ_dstu28147_wrap OBJ_dstu28147,5L + +#define SN_hmacWithDstu34311 "hmacWithDstu34311" +#define LN_hmacWithDstu34311 "HMAC DSTU Gost 34311-95" +#define NID_hmacWithDstu34311 1156 +#define OBJ_hmacWithDstu34311 OBJ_ua_pki,1L,1L,2L + +#define SN_dstu34311 "dstu34311" +#define LN_dstu34311 "DSTU Gost 34311-95" +#define NID_dstu34311 1157 +#define OBJ_dstu34311 OBJ_ua_pki,1L,2L,1L + +#define SN_dstu4145le "dstu4145le" +#define LN_dstu4145le "DSTU 4145-2002 little endian" +#define NID_dstu4145le 1158 +#define OBJ_dstu4145le OBJ_ua_pki,1L,3L,1L,1L + +#define SN_dstu4145be "dstu4145be" +#define LN_dstu4145be "DSTU 4145-2002 big endian" +#define NID_dstu4145be 1159 +#define OBJ_dstu4145be OBJ_dstu4145le,1L,1L + +#define SN_uacurve0 "uacurve0" +#define LN_uacurve0 "DSTU curve 0" +#define NID_uacurve0 1160 +#define OBJ_uacurve0 OBJ_dstu4145le,2L,0L + +#define SN_uacurve1 "uacurve1" +#define LN_uacurve1 "DSTU curve 1" +#define NID_uacurve1 1161 +#define OBJ_uacurve1 OBJ_dstu4145le,2L,1L + +#define SN_uacurve2 "uacurve2" +#define LN_uacurve2 "DSTU curve 2" +#define NID_uacurve2 1162 +#define OBJ_uacurve2 OBJ_dstu4145le,2L,2L + +#define SN_uacurve3 "uacurve3" +#define LN_uacurve3 "DSTU curve 3" +#define NID_uacurve3 1163 +#define OBJ_uacurve3 OBJ_dstu4145le,2L,3L + +#define SN_uacurve4 "uacurve4" +#define LN_uacurve4 "DSTU curve 4" +#define NID_uacurve4 1164 +#define OBJ_uacurve4 OBJ_dstu4145le,2L,4L + +#define SN_uacurve5 "uacurve5" +#define LN_uacurve5 "DSTU curve 5" +#define NID_uacurve5 1165 +#define OBJ_uacurve5 OBJ_dstu4145le,2L,5L + +#define SN_uacurve6 "uacurve6" +#define LN_uacurve6 "DSTU curve 6" +#define NID_uacurve6 1166 +#define OBJ_uacurve6 OBJ_dstu4145le,2L,6L + +#define SN_uacurve7 "uacurve7" +#define LN_uacurve7 "DSTU curve 7" +#define NID_uacurve7 1167 +#define OBJ_uacurve7 OBJ_dstu4145le,2L,7L + +#define SN_uacurve8 "uacurve8" +#define LN_uacurve8 "DSTU curve 8" +#define NID_uacurve8 1168 +#define OBJ_uacurve8 OBJ_dstu4145le,2L,8L + +#define SN_uacurve9 "uacurve9" +#define LN_uacurve9 "DSTU curve 9" +#define NID_uacurve9 1169 +#define OBJ_uacurve9 OBJ_dstu4145le,2L,9L + +#define SN_aes_128_siv "AES-128-SIV" +#define LN_aes_128_siv "aes-128-siv" +#define NID_aes_128_siv 1198 + +#define SN_aes_192_siv "AES-192-SIV" +#define LN_aes_192_siv "aes-192-siv" +#define NID_aes_192_siv 1199 + +#define SN_aes_256_siv "AES-256-SIV" +#define LN_aes_256_siv "aes-256-siv" +#define NID_aes_256_siv 1200 + +#define SN_oracle "oracle-organization" +#define LN_oracle "Oracle organization" +#define NID_oracle 1282 +#define OBJ_oracle OBJ_joint_iso_itu_t,16L,840L,1L,113894L + +#define SN_oracle_jdk_trustedkeyusage "oracle-jdk-trustedkeyusage" +#define LN_oracle_jdk_trustedkeyusage "Trusted key usage (Oracle)" +#define NID_oracle_jdk_trustedkeyusage 1283 +#define OBJ_oracle_jdk_trustedkeyusage OBJ_oracle,746875L,1L,1L + +#define SN_brotli "brotli" +#define LN_brotli "Brotli compression" +#define NID_brotli 1288 + +#define SN_zstd "zstd" +#define LN_zstd "Zstandard compression" +#define NID_zstd 1289 + +#define SN_tcg "tcg" +#define LN_tcg "Trusted Computing Group" +#define NID_tcg 1324 +#define OBJ_tcg 2L,23L,133L + +#define SN_tcg_tcpaSpecVersion "tcg-tcpaSpecVersion" +#define NID_tcg_tcpaSpecVersion 1325 +#define OBJ_tcg_tcpaSpecVersion OBJ_tcg,1L + +#define SN_tcg_attribute "tcg-attribute" +#define LN_tcg_attribute "Trusted Computing Group Attributes" +#define NID_tcg_attribute 1326 +#define OBJ_tcg_attribute OBJ_tcg,2L + +#define SN_tcg_protocol "tcg-protocol" +#define LN_tcg_protocol "Trusted Computing Group Protocols" +#define NID_tcg_protocol 1327 +#define OBJ_tcg_protocol OBJ_tcg,3L + +#define SN_tcg_algorithm "tcg-algorithm" +#define LN_tcg_algorithm "Trusted Computing Group Algorithms" +#define NID_tcg_algorithm 1328 +#define OBJ_tcg_algorithm OBJ_tcg,4L + +#define SN_tcg_platformClass "tcg-platformClass" +#define LN_tcg_platformClass "Trusted Computing Group Platform Classes" +#define NID_tcg_platformClass 1329 +#define OBJ_tcg_platformClass OBJ_tcg,5L + +#define SN_tcg_ce "tcg-ce" +#define LN_tcg_ce "Trusted Computing Group Certificate Extensions" +#define NID_tcg_ce 1330 +#define OBJ_tcg_ce OBJ_tcg,6L + +#define SN_tcg_kp "tcg-kp" +#define LN_tcg_kp "Trusted Computing Group Key Purposes" +#define NID_tcg_kp 1331 +#define OBJ_tcg_kp OBJ_tcg,8L + +#define SN_tcg_ca "tcg-ca" +#define LN_tcg_ca "Trusted Computing Group Certificate Policies" +#define NID_tcg_ca 1332 +#define OBJ_tcg_ca OBJ_tcg,11L + +#define SN_tcg_address "tcg-address" +#define LN_tcg_address "Trusted Computing Group Address Formats" +#define NID_tcg_address 1333 +#define OBJ_tcg_address OBJ_tcg,17L + +#define SN_tcg_registry "tcg-registry" +#define LN_tcg_registry "Trusted Computing Group Registry" +#define NID_tcg_registry 1334 +#define OBJ_tcg_registry OBJ_tcg,18L + +#define SN_tcg_traits "tcg-traits" +#define LN_tcg_traits "Trusted Computing Group Traits" +#define NID_tcg_traits 1335 +#define OBJ_tcg_traits OBJ_tcg,19L + +#define SN_tcg_common "tcg-common" +#define LN_tcg_common "Trusted Computing Group Common" +#define NID_tcg_common 1336 +#define OBJ_tcg_common OBJ_tcg_platformClass,1L + +#define SN_tcg_at_platformManufacturerStr "tcg-at-platformManufacturerStr" +#define LN_tcg_at_platformManufacturerStr "TCG Platform Manufacturer String" +#define NID_tcg_at_platformManufacturerStr 1337 +#define OBJ_tcg_at_platformManufacturerStr OBJ_tcg_common,1L + +#define SN_tcg_at_platformManufacturerId "tcg-at-platformManufacturerId" +#define LN_tcg_at_platformManufacturerId "TCG Platform Manufacturer ID" +#define NID_tcg_at_platformManufacturerId 1338 +#define OBJ_tcg_at_platformManufacturerId OBJ_tcg_common,2L + +#define SN_tcg_at_platformConfigUri "tcg-at-platformConfigUri" +#define LN_tcg_at_platformConfigUri "TCG Platform Configuration URI" +#define NID_tcg_at_platformConfigUri 1339 +#define OBJ_tcg_at_platformConfigUri OBJ_tcg_common,3L + +#define SN_tcg_at_platformModel "tcg-at-platformModel" +#define LN_tcg_at_platformModel "TCG Platform Model" +#define NID_tcg_at_platformModel 1340 +#define OBJ_tcg_at_platformModel OBJ_tcg_common,4L + +#define SN_tcg_at_platformVersion "tcg-at-platformVersion" +#define LN_tcg_at_platformVersion "TCG Platform Version" +#define NID_tcg_at_platformVersion 1341 +#define OBJ_tcg_at_platformVersion OBJ_tcg_common,5L + +#define SN_tcg_at_platformSerial "tcg-at-platformSerial" +#define LN_tcg_at_platformSerial "TCG Platform Serial Number" +#define NID_tcg_at_platformSerial 1342 +#define OBJ_tcg_at_platformSerial OBJ_tcg_common,6L + +#define SN_tcg_at_platformConfiguration "tcg-at-platformConfiguration" +#define LN_tcg_at_platformConfiguration "TCG Platform Configuration" +#define NID_tcg_at_platformConfiguration 1343 +#define OBJ_tcg_at_platformConfiguration OBJ_tcg_common,7L + +#define SN_tcg_at_platformIdentifier "tcg-at-platformIdentifier" +#define LN_tcg_at_platformIdentifier "TCG Platform Identifier" +#define NID_tcg_at_platformIdentifier 1344 +#define OBJ_tcg_at_platformIdentifier OBJ_tcg_common,8L + +#define SN_tcg_at_tpmManufacturer "tcg-at-tpmManufacturer" +#define LN_tcg_at_tpmManufacturer "TPM Manufacturer" +#define NID_tcg_at_tpmManufacturer 1345 +#define OBJ_tcg_at_tpmManufacturer OBJ_tcg_attribute,1L + +#define SN_tcg_at_tpmModel "tcg-at-tpmModel" +#define LN_tcg_at_tpmModel "TPM Model" +#define NID_tcg_at_tpmModel 1346 +#define OBJ_tcg_at_tpmModel OBJ_tcg_attribute,2L + +#define SN_tcg_at_tpmVersion "tcg-at-tpmVersion" +#define LN_tcg_at_tpmVersion "TPM Version" +#define NID_tcg_at_tpmVersion 1347 +#define OBJ_tcg_at_tpmVersion OBJ_tcg_attribute,3L + +#define SN_tcg_at_securityQualities "tcg-at-securityQualities" +#define LN_tcg_at_securityQualities "Security Qualities" +#define NID_tcg_at_securityQualities 1348 +#define OBJ_tcg_at_securityQualities OBJ_tcg_attribute,10L + +#define SN_tcg_at_tpmProtectionProfile "tcg-at-tpmProtectionProfile" +#define LN_tcg_at_tpmProtectionProfile "TPM Protection Profile" +#define NID_tcg_at_tpmProtectionProfile 1349 +#define OBJ_tcg_at_tpmProtectionProfile OBJ_tcg_attribute,11L + +#define SN_tcg_at_tpmSecurityTarget "tcg-at-tpmSecurityTarget" +#define LN_tcg_at_tpmSecurityTarget "TPM Security Target" +#define NID_tcg_at_tpmSecurityTarget 1350 +#define OBJ_tcg_at_tpmSecurityTarget OBJ_tcg_attribute,12L + +#define SN_tcg_at_tbbProtectionProfile "tcg-at-tbbProtectionProfile" +#define LN_tcg_at_tbbProtectionProfile "TBB Protection Profile" +#define NID_tcg_at_tbbProtectionProfile 1351 +#define OBJ_tcg_at_tbbProtectionProfile OBJ_tcg_attribute,13L + +#define SN_tcg_at_tbbSecurityTarget "tcg-at-tbbSecurityTarget" +#define LN_tcg_at_tbbSecurityTarget "TBB Security Target" +#define NID_tcg_at_tbbSecurityTarget 1352 +#define OBJ_tcg_at_tbbSecurityTarget OBJ_tcg_attribute,14L + +#define SN_tcg_at_tpmIdLabel "tcg-at-tpmIdLabel" +#define LN_tcg_at_tpmIdLabel "TPM ID Label" +#define NID_tcg_at_tpmIdLabel 1353 +#define OBJ_tcg_at_tpmIdLabel OBJ_tcg_attribute,15L + +#define SN_tcg_at_tpmSpecification "tcg-at-tpmSpecification" +#define LN_tcg_at_tpmSpecification "TPM Specification" +#define NID_tcg_at_tpmSpecification 1354 +#define OBJ_tcg_at_tpmSpecification OBJ_tcg_attribute,16L + +#define SN_tcg_at_tcgPlatformSpecification "tcg-at-tcgPlatformSpecification" +#define LN_tcg_at_tcgPlatformSpecification "TPM Platform Specification" +#define NID_tcg_at_tcgPlatformSpecification 1355 +#define OBJ_tcg_at_tcgPlatformSpecification OBJ_tcg_attribute,17L + +#define SN_tcg_at_tpmSecurityAssertions "tcg-at-tpmSecurityAssertions" +#define LN_tcg_at_tpmSecurityAssertions "TPM Security Assertions" +#define NID_tcg_at_tpmSecurityAssertions 1356 +#define OBJ_tcg_at_tpmSecurityAssertions OBJ_tcg_attribute,18L + +#define SN_tcg_at_tbbSecurityAssertions "tcg-at-tbbSecurityAssertions" +#define LN_tcg_at_tbbSecurityAssertions "TBB Security Assertions" +#define NID_tcg_at_tbbSecurityAssertions 1357 +#define OBJ_tcg_at_tbbSecurityAssertions OBJ_tcg_attribute,19L + +#define SN_tcg_at_tcgCredentialSpecification "tcg-at-tcgCredentialSpecification" +#define LN_tcg_at_tcgCredentialSpecification "TCG Credential Specification" +#define NID_tcg_at_tcgCredentialSpecification 1358 +#define OBJ_tcg_at_tcgCredentialSpecification OBJ_tcg_attribute,23L + +#define SN_tcg_at_tcgCredentialType "tcg-at-tcgCredentialType" +#define LN_tcg_at_tcgCredentialType "TCG Credential Type" +#define NID_tcg_at_tcgCredentialType 1359 +#define OBJ_tcg_at_tcgCredentialType OBJ_tcg_attribute,25L + +#define SN_tcg_at_previousPlatformCertificates "tcg-at-previousPlatformCertificates" +#define LN_tcg_at_previousPlatformCertificates "TCG Previous Platform Certificates" +#define NID_tcg_at_previousPlatformCertificates 1360 +#define OBJ_tcg_at_previousPlatformCertificates OBJ_tcg_attribute,26L + +#define SN_tcg_at_tbbSecurityAssertions_v3 "tcg-at-tbbSecurityAssertions-v3" +#define LN_tcg_at_tbbSecurityAssertions_v3 "TCG TBB Security Assertions V3" +#define NID_tcg_at_tbbSecurityAssertions_v3 1361 +#define OBJ_tcg_at_tbbSecurityAssertions_v3 OBJ_tcg_attribute,27L + +#define SN_tcg_at_cryptographicAnchors "tcg-at-cryptographicAnchors" +#define LN_tcg_at_cryptographicAnchors "TCG Cryptographic Anchors" +#define NID_tcg_at_cryptographicAnchors 1362 +#define OBJ_tcg_at_cryptographicAnchors OBJ_tcg_attribute,28L + +#define SN_tcg_at_platformConfiguration_v1 "tcg-at-platformConfiguration-v1" +#define LN_tcg_at_platformConfiguration_v1 "Platform Configuration Version 1" +#define NID_tcg_at_platformConfiguration_v1 1363 +#define OBJ_tcg_at_platformConfiguration_v1 OBJ_tcg_at_platformConfiguration,1L + +#define SN_tcg_at_platformConfiguration_v2 "tcg-at-platformConfiguration-v2" +#define LN_tcg_at_platformConfiguration_v2 "Platform Configuration Version 2" +#define NID_tcg_at_platformConfiguration_v2 1364 +#define OBJ_tcg_at_platformConfiguration_v2 OBJ_tcg_at_platformConfiguration,2L + +#define SN_tcg_at_platformConfiguration_v3 "tcg-at-platformConfiguration-v3" +#define LN_tcg_at_platformConfiguration_v3 "Platform Configuration Version 3" +#define NID_tcg_at_platformConfiguration_v3 1365 +#define OBJ_tcg_at_platformConfiguration_v3 OBJ_tcg_at_platformConfiguration,3L + +#define SN_tcg_at_platformConfigUri_v3 "tcg-at-platformConfigUri-v3" +#define LN_tcg_at_platformConfigUri_v3 "Platform Configuration URI Version 3" +#define NID_tcg_at_platformConfigUri_v3 1366 +#define OBJ_tcg_at_platformConfigUri_v3 OBJ_tcg_at_platformConfiguration,4L + +#define SN_tcg_algorithm_null "tcg-algorithm-null" +#define LN_tcg_algorithm_null "TCG NULL Algorithm" +#define NID_tcg_algorithm_null 1367 +#define OBJ_tcg_algorithm_null OBJ_tcg_algorithm,1L + +#define SN_tcg_kp_EKCertificate "tcg-kp-EKCertificate" +#define LN_tcg_kp_EKCertificate "Endorsement Key Certificate" +#define NID_tcg_kp_EKCertificate 1368 +#define OBJ_tcg_kp_EKCertificate OBJ_tcg_kp,1L + +#define SN_tcg_kp_PlatformAttributeCertificate "tcg-kp-PlatformAttributeCertificate" +#define LN_tcg_kp_PlatformAttributeCertificate "Platform Attribute Certificate" +#define NID_tcg_kp_PlatformAttributeCertificate 1369 +#define OBJ_tcg_kp_PlatformAttributeCertificate OBJ_tcg_kp,2L + +#define SN_tcg_kp_AIKCertificate "tcg-kp-AIKCertificate" +#define LN_tcg_kp_AIKCertificate "Attestation Identity Key Certificate" +#define NID_tcg_kp_AIKCertificate 1370 +#define OBJ_tcg_kp_AIKCertificate OBJ_tcg_kp,3L + +#define SN_tcg_kp_PlatformKeyCertificate "tcg-kp-PlatformKeyCertificate" +#define LN_tcg_kp_PlatformKeyCertificate "Platform Key Certificate" +#define NID_tcg_kp_PlatformKeyCertificate 1371 +#define OBJ_tcg_kp_PlatformKeyCertificate OBJ_tcg_kp,4L + +#define SN_tcg_kp_DeltaPlatformAttributeCertificate "tcg-kp-DeltaPlatformAttributeCertificate" +#define LN_tcg_kp_DeltaPlatformAttributeCertificate "Delta Platform Attribute Certificate" +#define NID_tcg_kp_DeltaPlatformAttributeCertificate 1372 +#define OBJ_tcg_kp_DeltaPlatformAttributeCertificate OBJ_tcg_kp,5L + +#define SN_tcg_kp_DeltaPlatformKeyCertificate "tcg-kp-DeltaPlatformKeyCertificate" +#define LN_tcg_kp_DeltaPlatformKeyCertificate "Delta Platform Key Certificate" +#define NID_tcg_kp_DeltaPlatformKeyCertificate 1373 +#define OBJ_tcg_kp_DeltaPlatformKeyCertificate OBJ_tcg_kp,6L + +#define SN_tcg_kp_AdditionalPlatformAttributeCertificate "tcg-kp-AdditionalPlatformAttributeCertificate" +#define LN_tcg_kp_AdditionalPlatformAttributeCertificate "Additional Platform Attribute Certificate" +#define NID_tcg_kp_AdditionalPlatformAttributeCertificate 1374 +#define OBJ_tcg_kp_AdditionalPlatformAttributeCertificate OBJ_tcg_kp,7L + +#define SN_tcg_kp_AdditionalPlatformKeyCertificate "tcg-kp-AdditionalPlatformKeyCertificate" +#define LN_tcg_kp_AdditionalPlatformKeyCertificate "Additional Platform Key Certificate" +#define NID_tcg_kp_AdditionalPlatformKeyCertificate 1375 +#define OBJ_tcg_kp_AdditionalPlatformKeyCertificate OBJ_tcg_kp,8L + +#define SN_tcg_ce_relevantCredentials "tcg-ce-relevantCredentials" +#define LN_tcg_ce_relevantCredentials "Relevant Credentials" +#define NID_tcg_ce_relevantCredentials 1376 +#define OBJ_tcg_ce_relevantCredentials OBJ_tcg_ce,2L + +#define SN_tcg_ce_relevantManifests "tcg-ce-relevantManifests" +#define LN_tcg_ce_relevantManifests "Relevant Manifests" +#define NID_tcg_ce_relevantManifests 1377 +#define OBJ_tcg_ce_relevantManifests OBJ_tcg_ce,3L + +#define SN_tcg_ce_virtualPlatformAttestationService "tcg-ce-virtualPlatformAttestationService" +#define LN_tcg_ce_virtualPlatformAttestationService "Virtual Platform Attestation Service" +#define NID_tcg_ce_virtualPlatformAttestationService 1378 +#define OBJ_tcg_ce_virtualPlatformAttestationService OBJ_tcg_ce,4L + +#define SN_tcg_ce_migrationControllerAttestationService "tcg-ce-migrationControllerAttestationService" +#define LN_tcg_ce_migrationControllerAttestationService "Migration Controller Attestation Service" +#define NID_tcg_ce_migrationControllerAttestationService 1379 +#define OBJ_tcg_ce_migrationControllerAttestationService OBJ_tcg_ce,5L + +#define SN_tcg_ce_migrationControllerRegistrationService "tcg-ce-migrationControllerRegistrationService" +#define LN_tcg_ce_migrationControllerRegistrationService "Migration Controller Registration Service" +#define NID_tcg_ce_migrationControllerRegistrationService 1380 +#define OBJ_tcg_ce_migrationControllerRegistrationService OBJ_tcg_ce,6L + +#define SN_tcg_ce_virtualPlatformBackupService "tcg-ce-virtualPlatformBackupService" +#define LN_tcg_ce_virtualPlatformBackupService "Virtual Platform Backup Service" +#define NID_tcg_ce_virtualPlatformBackupService 1381 +#define OBJ_tcg_ce_virtualPlatformBackupService OBJ_tcg_ce,7L + +#define SN_tcg_prt_tpmIdProtocol "tcg-prt-tpmIdProtocol" +#define LN_tcg_prt_tpmIdProtocol "TCG TPM Protocol" +#define NID_tcg_prt_tpmIdProtocol 1382 +#define OBJ_tcg_prt_tpmIdProtocol OBJ_tcg_protocol,1L + +#define SN_tcg_address_ethernetmac "tcg-address-ethernetmac" +#define LN_tcg_address_ethernetmac "Ethernet MAC Address" +#define NID_tcg_address_ethernetmac 1383 +#define OBJ_tcg_address_ethernetmac OBJ_tcg_address,1L + +#define SN_tcg_address_wlanmac "tcg-address-wlanmac" +#define LN_tcg_address_wlanmac "WLAN MAC Address" +#define NID_tcg_address_wlanmac 1384 +#define OBJ_tcg_address_wlanmac OBJ_tcg_address,2L + +#define SN_tcg_address_bluetoothmac "tcg-address-bluetoothmac" +#define LN_tcg_address_bluetoothmac "Bluetooth MAC Address" +#define NID_tcg_address_bluetoothmac 1385 +#define OBJ_tcg_address_bluetoothmac OBJ_tcg_address,3L + +#define SN_tcg_registry_componentClass "tcg-registry-componentClass" +#define LN_tcg_registry_componentClass "TCG Component Class" +#define NID_tcg_registry_componentClass 1386 +#define OBJ_tcg_registry_componentClass OBJ_tcg_registry,3L + +#define SN_tcg_registry_componentClass_tcg "tcg-registry-componentClass-tcg" +#define LN_tcg_registry_componentClass_tcg "Trusted Computed Group Registry" +#define NID_tcg_registry_componentClass_tcg 1387 +#define OBJ_tcg_registry_componentClass_tcg OBJ_tcg_registry_componentClass,1L + +#define SN_tcg_registry_componentClass_ietf "tcg-registry-componentClass-ietf" +#define LN_tcg_registry_componentClass_ietf "Internet Engineering Task Force Registry" +#define NID_tcg_registry_componentClass_ietf 1388 +#define OBJ_tcg_registry_componentClass_ietf OBJ_tcg_registry_componentClass,2L + +#define SN_tcg_registry_componentClass_dmtf "tcg-registry-componentClass-dmtf" +#define LN_tcg_registry_componentClass_dmtf "Distributed Management Task Force Registry" +#define NID_tcg_registry_componentClass_dmtf 1389 +#define OBJ_tcg_registry_componentClass_dmtf OBJ_tcg_registry_componentClass,3L + +#define SN_tcg_registry_componentClass_pcie "tcg-registry-componentClass-pcie" +#define LN_tcg_registry_componentClass_pcie "PCIE Component Class" +#define NID_tcg_registry_componentClass_pcie 1390 +#define OBJ_tcg_registry_componentClass_pcie OBJ_tcg_registry_componentClass,4L + +#define SN_tcg_registry_componentClass_disk "tcg-registry-componentClass-disk" +#define LN_tcg_registry_componentClass_disk "Disk Component Class" +#define NID_tcg_registry_componentClass_disk 1391 +#define OBJ_tcg_registry_componentClass_disk OBJ_tcg_registry_componentClass,5L + +#define SN_tcg_cap_verifiedPlatformCertificate "tcg-cap-verifiedPlatformCertificate" +#define LN_tcg_cap_verifiedPlatformCertificate "TCG Verified Platform Certificate CA Policy" +#define NID_tcg_cap_verifiedPlatformCertificate 1392 +#define OBJ_tcg_cap_verifiedPlatformCertificate OBJ_tcg_ca,4L + +#define SN_tcg_tr_ID "tcg-tr-ID" +#define LN_tcg_tr_ID "TCG Trait Identifiers" +#define NID_tcg_tr_ID 1393 +#define OBJ_tcg_tr_ID OBJ_tcg_traits,1L + +#define SN_tcg_tr_category "tcg-tr-category" +#define LN_tcg_tr_category "TCG Trait Categories" +#define NID_tcg_tr_category 1394 +#define OBJ_tcg_tr_category OBJ_tcg_traits,2L + +#define SN_tcg_tr_registry "tcg-tr-registry" +#define LN_tcg_tr_registry "TCG Trait Registries" +#define NID_tcg_tr_registry 1395 +#define OBJ_tcg_tr_registry OBJ_tcg_traits,3L + +#define SN_tcg_tr_ID_Boolean "tcg-tr-ID-Boolean" +#define LN_tcg_tr_ID_Boolean "Boolean Trait" +#define NID_tcg_tr_ID_Boolean 1396 +#define OBJ_tcg_tr_ID_Boolean OBJ_tcg_tr_ID,1L + +#define SN_tcg_tr_ID_CertificateIdentifier "tcg-tr-ID-CertificateIdentifier" +#define LN_tcg_tr_ID_CertificateIdentifier "Certificate Identifier Trait" +#define NID_tcg_tr_ID_CertificateIdentifier 1397 +#define OBJ_tcg_tr_ID_CertificateIdentifier OBJ_tcg_tr_ID,2L + +#define SN_tcg_tr_ID_CommonCriteria "tcg-tr-ID-CommonCriteria" +#define LN_tcg_tr_ID_CommonCriteria "Common Criteria Trait" +#define NID_tcg_tr_ID_CommonCriteria 1398 +#define OBJ_tcg_tr_ID_CommonCriteria OBJ_tcg_tr_ID,3L + +#define SN_tcg_tr_ID_componentClass "tcg-tr-ID-componentClass" +#define LN_tcg_tr_ID_componentClass "Component Class Trait" +#define NID_tcg_tr_ID_componentClass 1399 +#define OBJ_tcg_tr_ID_componentClass OBJ_tcg_tr_ID,4L + +#define SN_tcg_tr_ID_componentIdentifierV11 "tcg-tr-ID-componentIdentifierV11" +#define LN_tcg_tr_ID_componentIdentifierV11 "Component Identifier V1.1 Trait" +#define NID_tcg_tr_ID_componentIdentifierV11 1400 +#define OBJ_tcg_tr_ID_componentIdentifierV11 OBJ_tcg_tr_ID,5L + +#define SN_tcg_tr_ID_FIPSLevel "tcg-tr-ID-FIPSLevel" +#define LN_tcg_tr_ID_FIPSLevel "FIPS Level Trait" +#define NID_tcg_tr_ID_FIPSLevel 1401 +#define OBJ_tcg_tr_ID_FIPSLevel OBJ_tcg_tr_ID,6L + +#define SN_tcg_tr_ID_ISO9000Level "tcg-tr-ID-ISO9000Level" +#define LN_tcg_tr_ID_ISO9000Level "ISO 9000 Level Trait" +#define NID_tcg_tr_ID_ISO9000Level 1402 +#define OBJ_tcg_tr_ID_ISO9000Level OBJ_tcg_tr_ID,7L + +#define SN_tcg_tr_ID_networkMAC "tcg-tr-ID-networkMAC" +#define LN_tcg_tr_ID_networkMAC "Network MAC Trait" +#define NID_tcg_tr_ID_networkMAC 1403 +#define OBJ_tcg_tr_ID_networkMAC OBJ_tcg_tr_ID,8L + +#define SN_tcg_tr_ID_OID "tcg-tr-ID-OID" +#define LN_tcg_tr_ID_OID "Object Identifier Trait" +#define NID_tcg_tr_ID_OID 1404 +#define OBJ_tcg_tr_ID_OID OBJ_tcg_tr_ID,9L + +#define SN_tcg_tr_ID_PEN "tcg-tr-ID-PEN" +#define LN_tcg_tr_ID_PEN "Private Enterprise Number Trait" +#define NID_tcg_tr_ID_PEN 1405 +#define OBJ_tcg_tr_ID_PEN OBJ_tcg_tr_ID,10L + +#define SN_tcg_tr_ID_platformFirmwareCapabilities "tcg-tr-ID-platformFirmwareCapabilities" +#define LN_tcg_tr_ID_platformFirmwareCapabilities "Platform Firmware Capabilities Trait" +#define NID_tcg_tr_ID_platformFirmwareCapabilities 1406 +#define OBJ_tcg_tr_ID_platformFirmwareCapabilities OBJ_tcg_tr_ID,11L + +#define SN_tcg_tr_ID_platformFirmwareSignatureVerification "tcg-tr-ID-platformFirmwareSignatureVerification" +#define LN_tcg_tr_ID_platformFirmwareSignatureVerification "Platform Firmware Signature Verification Trait" +#define NID_tcg_tr_ID_platformFirmwareSignatureVerification 1407 +#define OBJ_tcg_tr_ID_platformFirmwareSignatureVerification OBJ_tcg_tr_ID,12L + +#define SN_tcg_tr_ID_platformFirmwareUpdateCompliance "tcg-tr-ID-platformFirmwareUpdateCompliance" +#define LN_tcg_tr_ID_platformFirmwareUpdateCompliance "Platform Firmware Update Compliance Trait" +#define NID_tcg_tr_ID_platformFirmwareUpdateCompliance 1408 +#define OBJ_tcg_tr_ID_platformFirmwareUpdateCompliance OBJ_tcg_tr_ID,13L + +#define SN_tcg_tr_ID_platformHardwareCapabilities "tcg-tr-ID-platformHardwareCapabilities" +#define LN_tcg_tr_ID_platformHardwareCapabilities "Platform Hardware Capabilities Trait" +#define NID_tcg_tr_ID_platformHardwareCapabilities 1409 +#define OBJ_tcg_tr_ID_platformHardwareCapabilities OBJ_tcg_tr_ID,14L + +#define SN_tcg_tr_ID_RTM "tcg-tr-ID-RTM" +#define LN_tcg_tr_ID_RTM "Root of Trust for Measurement Trait" +#define NID_tcg_tr_ID_RTM 1410 +#define OBJ_tcg_tr_ID_RTM OBJ_tcg_tr_ID,15L + +#define SN_tcg_tr_ID_status "tcg-tr-ID-status" +#define LN_tcg_tr_ID_status "Attribute Status Trait" +#define NID_tcg_tr_ID_status 1411 +#define OBJ_tcg_tr_ID_status OBJ_tcg_tr_ID,16L + +#define SN_tcg_tr_ID_URI "tcg-tr-ID-URI" +#define LN_tcg_tr_ID_URI "Uniform Resource Identifier Trait" +#define NID_tcg_tr_ID_URI 1412 +#define OBJ_tcg_tr_ID_URI OBJ_tcg_tr_ID,17L + +#define SN_tcg_tr_ID_UTF8String "tcg-tr-ID-UTF8String" +#define LN_tcg_tr_ID_UTF8String "UTF8String Trait" +#define NID_tcg_tr_ID_UTF8String 1413 +#define OBJ_tcg_tr_ID_UTF8String OBJ_tcg_tr_ID,18L + +#define SN_tcg_tr_ID_IA5String "tcg-tr-ID-IA5String" +#define LN_tcg_tr_ID_IA5String "IA5String Trait" +#define NID_tcg_tr_ID_IA5String 1414 +#define OBJ_tcg_tr_ID_IA5String OBJ_tcg_tr_ID,19L + +#define SN_tcg_tr_ID_PEMCertString "tcg-tr-ID-PEMCertString" +#define LN_tcg_tr_ID_PEMCertString "PEM-Encoded Certificate String Trait" +#define NID_tcg_tr_ID_PEMCertString 1415 +#define OBJ_tcg_tr_ID_PEMCertString OBJ_tcg_tr_ID,20L + +#define SN_tcg_tr_ID_PublicKey "tcg-tr-ID-PublicKey" +#define LN_tcg_tr_ID_PublicKey "Public Key Trait" +#define NID_tcg_tr_ID_PublicKey 1416 +#define OBJ_tcg_tr_ID_PublicKey OBJ_tcg_tr_ID,21L + +#define SN_tcg_tr_cat_platformManufacturer "tcg-tr-cat-platformManufacturer" +#define LN_tcg_tr_cat_platformManufacturer "Platform Manufacturer Trait Category" +#define NID_tcg_tr_cat_platformManufacturer 1417 +#define OBJ_tcg_tr_cat_platformManufacturer OBJ_tcg_tr_category,1L + +#define SN_tcg_tr_cat_platformModel "tcg-tr-cat-platformModel" +#define LN_tcg_tr_cat_platformModel "Platform Model Trait Category" +#define NID_tcg_tr_cat_platformModel 1418 +#define OBJ_tcg_tr_cat_platformModel OBJ_tcg_tr_category,2L + +#define SN_tcg_tr_cat_platformVersion "tcg-tr-cat-platformVersion" +#define LN_tcg_tr_cat_platformVersion "Platform Version Trait Category" +#define NID_tcg_tr_cat_platformVersion 1419 +#define OBJ_tcg_tr_cat_platformVersion OBJ_tcg_tr_category,3L + +#define SN_tcg_tr_cat_platformSerial "tcg-tr-cat-platformSerial" +#define LN_tcg_tr_cat_platformSerial "Platform Serial Trait Category" +#define NID_tcg_tr_cat_platformSerial 1420 +#define OBJ_tcg_tr_cat_platformSerial OBJ_tcg_tr_category,4L + +#define SN_tcg_tr_cat_platformManufacturerIdentifier "tcg-tr-cat-platformManufacturerIdentifier" +#define LN_tcg_tr_cat_platformManufacturerIdentifier "Platform Manufacturer Identifier Trait Category" +#define NID_tcg_tr_cat_platformManufacturerIdentifier 1421 +#define OBJ_tcg_tr_cat_platformManufacturerIdentifier OBJ_tcg_tr_category,5L + +#define SN_tcg_tr_cat_platformOwnership "tcg-tr-cat-platformOwnership" +#define LN_tcg_tr_cat_platformOwnership "Platform Ownership Trait Category" +#define NID_tcg_tr_cat_platformOwnership 1422 +#define OBJ_tcg_tr_cat_platformOwnership OBJ_tcg_tr_category,6L + +#define SN_tcg_tr_cat_componentClass "tcg-tr-cat-componentClass" +#define LN_tcg_tr_cat_componentClass "Component Class Trait Category" +#define NID_tcg_tr_cat_componentClass 1423 +#define OBJ_tcg_tr_cat_componentClass OBJ_tcg_tr_category,7L + +#define SN_tcg_tr_cat_componentManufacturer "tcg-tr-cat-componentManufacturer" +#define LN_tcg_tr_cat_componentManufacturer "Component Manufacturer Trait Category" +#define NID_tcg_tr_cat_componentManufacturer 1424 +#define OBJ_tcg_tr_cat_componentManufacturer OBJ_tcg_tr_category,8L + +#define SN_tcg_tr_cat_componentModel "tcg-tr-cat-componentModel" +#define LN_tcg_tr_cat_componentModel "Component Model Trait Category" +#define NID_tcg_tr_cat_componentModel 1425 +#define OBJ_tcg_tr_cat_componentModel OBJ_tcg_tr_category,9L + +#define SN_tcg_tr_cat_componentSerial "tcg-tr-cat-componentSerial" +#define LN_tcg_tr_cat_componentSerial "Component Serial Trait Category" +#define NID_tcg_tr_cat_componentSerial 1426 +#define OBJ_tcg_tr_cat_componentSerial OBJ_tcg_tr_category,10L + +#define SN_tcg_tr_cat_componentStatus "tcg-tr-cat-componentStatus" +#define LN_tcg_tr_cat_componentStatus "Component Status Trait Category" +#define NID_tcg_tr_cat_componentStatus 1427 +#define OBJ_tcg_tr_cat_componentStatus OBJ_tcg_tr_category,11L + +#define SN_tcg_tr_cat_componentLocation "tcg-tr-cat-componentLocation" +#define LN_tcg_tr_cat_componentLocation "Component Location Trait Category" +#define NID_tcg_tr_cat_componentLocation 1428 +#define OBJ_tcg_tr_cat_componentLocation OBJ_tcg_tr_category,12L + +#define SN_tcg_tr_cat_componentRevision "tcg-tr-cat-componentRevision" +#define LN_tcg_tr_cat_componentRevision "Component Revision Trait Category" +#define NID_tcg_tr_cat_componentRevision 1429 +#define OBJ_tcg_tr_cat_componentRevision OBJ_tcg_tr_category,13L + +#define SN_tcg_tr_cat_componentFieldReplaceable "tcg-tr-cat-componentFieldReplaceable" +#define LN_tcg_tr_cat_componentFieldReplaceable "Component Field Replaceable Trait Category" +#define NID_tcg_tr_cat_componentFieldReplaceable 1430 +#define OBJ_tcg_tr_cat_componentFieldReplaceable OBJ_tcg_tr_category,14L + +#define SN_tcg_tr_cat_EKCertificate "tcg-tr-cat-EKCertificate" +#define LN_tcg_tr_cat_EKCertificate "EK Certificate Trait Category" +#define NID_tcg_tr_cat_EKCertificate 1431 +#define OBJ_tcg_tr_cat_EKCertificate OBJ_tcg_tr_category,15L + +#define SN_tcg_tr_cat_IAKCertificate "tcg-tr-cat-IAKCertificate" +#define LN_tcg_tr_cat_IAKCertificate "IAK Certificate Trait Category" +#define NID_tcg_tr_cat_IAKCertificate 1432 +#define OBJ_tcg_tr_cat_IAKCertificate OBJ_tcg_tr_category,16L + +#define SN_tcg_tr_cat_IDevIDCertificate "tcg-tr-cat-IDevIDCertificate" +#define LN_tcg_tr_cat_IDevIDCertificate "IDevID Certificate Trait Category" +#define NID_tcg_tr_cat_IDevIDCertificate 1433 +#define OBJ_tcg_tr_cat_IDevIDCertificate OBJ_tcg_tr_category,17L + +#define SN_tcg_tr_cat_DICECertificate "tcg-tr-cat-DICECertificate" +#define LN_tcg_tr_cat_DICECertificate "DICE Certificate Trait Category" +#define NID_tcg_tr_cat_DICECertificate 1434 +#define OBJ_tcg_tr_cat_DICECertificate OBJ_tcg_tr_category,18L + +#define SN_tcg_tr_cat_SPDMCertificate "tcg-tr-cat-SPDMCertificate" +#define LN_tcg_tr_cat_SPDMCertificate "SPDM Certificate Trait Category" +#define NID_tcg_tr_cat_SPDMCertificate 1435 +#define OBJ_tcg_tr_cat_SPDMCertificate OBJ_tcg_tr_category,19L + +#define SN_tcg_tr_cat_PEMCertificate "tcg-tr-cat-PEMCertificate" +#define LN_tcg_tr_cat_PEMCertificate "PEM Certificate Trait Category" +#define NID_tcg_tr_cat_PEMCertificate 1436 +#define OBJ_tcg_tr_cat_PEMCertificate OBJ_tcg_tr_category,20L + +#define SN_tcg_tr_cat_PlatformCertificate "tcg-tr-cat-PlatformCertificate" +#define LN_tcg_tr_cat_PlatformCertificate "Platform Certificate Trait Category" +#define NID_tcg_tr_cat_PlatformCertificate 1437 +#define OBJ_tcg_tr_cat_PlatformCertificate OBJ_tcg_tr_category,21L + +#define SN_tcg_tr_cat_DeltaPlatformCertificate "tcg-tr-cat-DeltaPlatformCertificate" +#define LN_tcg_tr_cat_DeltaPlatformCertificate "Delta Platform Certificate Trait Category" +#define NID_tcg_tr_cat_DeltaPlatformCertificate 1438 +#define OBJ_tcg_tr_cat_DeltaPlatformCertificate OBJ_tcg_tr_category,22L + +#define SN_tcg_tr_cat_RebasePlatformCertificate "tcg-tr-cat-RebasePlatformCertificate" +#define LN_tcg_tr_cat_RebasePlatformCertificate "Rebase Platform Certificate Trait Category" +#define NID_tcg_tr_cat_RebasePlatformCertificate 1439 +#define OBJ_tcg_tr_cat_RebasePlatformCertificate OBJ_tcg_tr_category,23L + +#define SN_tcg_tr_cat_genericCertificate "tcg-tr-cat-genericCertificate" +#define LN_tcg_tr_cat_genericCertificate "Generic Certificate Trait Category" +#define NID_tcg_tr_cat_genericCertificate 1440 +#define OBJ_tcg_tr_cat_genericCertificate OBJ_tcg_tr_category,24L + +#define SN_tcg_tr_cat_CommonCriteria "tcg-tr-cat-CommonCriteria" +#define LN_tcg_tr_cat_CommonCriteria "Common Criteria Trait Category" +#define NID_tcg_tr_cat_CommonCriteria 1441 +#define OBJ_tcg_tr_cat_CommonCriteria OBJ_tcg_tr_category,25L + +#define SN_tcg_tr_cat_componentIdentifierV11 "tcg-tr-cat-componentIdentifierV11" +#define LN_tcg_tr_cat_componentIdentifierV11 "Component Identifier V1.1 Trait Category" +#define NID_tcg_tr_cat_componentIdentifierV11 1442 +#define OBJ_tcg_tr_cat_componentIdentifierV11 OBJ_tcg_tr_category,26L + +#define SN_tcg_tr_cat_FIPSLevel "tcg-tr-cat-FIPSLevel" +#define LN_tcg_tr_cat_FIPSLevel "FIPS Level Trait Category" +#define NID_tcg_tr_cat_FIPSLevel 1443 +#define OBJ_tcg_tr_cat_FIPSLevel OBJ_tcg_tr_category,27L + +#define SN_tcg_tr_cat_ISO9000 "tcg-tr-cat-ISO9000" +#define LN_tcg_tr_cat_ISO9000 "ISO 9000 Trait Category" +#define NID_tcg_tr_cat_ISO9000 1444 +#define OBJ_tcg_tr_cat_ISO9000 OBJ_tcg_tr_category,28L + +#define SN_tcg_tr_cat_networkMAC "tcg-tr-cat-networkMAC" +#define LN_tcg_tr_cat_networkMAC "Network MAC Trait Category" +#define NID_tcg_tr_cat_networkMAC 1445 +#define OBJ_tcg_tr_cat_networkMAC OBJ_tcg_tr_category,29L + +#define SN_tcg_tr_cat_attestationProtocol "tcg-tr-cat-attestationProtocol" +#define LN_tcg_tr_cat_attestationProtocol "Attestation Protocol Trait Category" +#define NID_tcg_tr_cat_attestationProtocol 1446 +#define OBJ_tcg_tr_cat_attestationProtocol OBJ_tcg_tr_category,30L + +#define SN_tcg_tr_cat_PEN "tcg-tr-cat-PEN" +#define LN_tcg_tr_cat_PEN "Private Enterprise Number Trait Category" +#define NID_tcg_tr_cat_PEN 1447 +#define OBJ_tcg_tr_cat_PEN OBJ_tcg_tr_category,31L + +#define SN_tcg_tr_cat_platformFirmwareCapabilities "tcg-tr-cat-platformFirmwareCapabilities" +#define LN_tcg_tr_cat_platformFirmwareCapabilities "Platform Firmware Capabilities Trait Category" +#define NID_tcg_tr_cat_platformFirmwareCapabilities 1448 +#define OBJ_tcg_tr_cat_platformFirmwareCapabilities OBJ_tcg_tr_category,32L + +#define SN_tcg_tr_cat_platformHardwareCapabilities "tcg-tr-cat-platformHardwareCapabilities" +#define LN_tcg_tr_cat_platformHardwareCapabilities "Platform Hardware Capabilities Trait Category" +#define NID_tcg_tr_cat_platformHardwareCapabilities 1449 +#define OBJ_tcg_tr_cat_platformHardwareCapabilities OBJ_tcg_tr_category,33L + +#define SN_tcg_tr_cat_platformFirmwareSignatureVerification "tcg-tr-cat-platformFirmwareSignatureVerification" +#define LN_tcg_tr_cat_platformFirmwareSignatureVerification "Platform Firmware Signature Verification Trait Category" +#define NID_tcg_tr_cat_platformFirmwareSignatureVerification 1450 +#define OBJ_tcg_tr_cat_platformFirmwareSignatureVerification OBJ_tcg_tr_category,34L + +#define SN_tcg_tr_cat_platformFirmwareUpdateCompliance "tcg-tr-cat-platformFirmwareUpdateCompliance" +#define LN_tcg_tr_cat_platformFirmwareUpdateCompliance "Platform Firmware Update Compliance Trait Category" +#define NID_tcg_tr_cat_platformFirmwareUpdateCompliance 1451 +#define OBJ_tcg_tr_cat_platformFirmwareUpdateCompliance OBJ_tcg_tr_category,35L + +#define SN_tcg_tr_cat_RTM "tcg-tr-cat-RTM" +#define LN_tcg_tr_cat_RTM "Root of Trust of Measurement Trait Category" +#define NID_tcg_tr_cat_RTM 1452 +#define OBJ_tcg_tr_cat_RTM OBJ_tcg_tr_category,36L + +#define SN_tcg_tr_cat_PublicKey "tcg-tr-cat-PublicKey" +#define LN_tcg_tr_cat_PublicKey "Public Key Trait Category" +#define NID_tcg_tr_cat_PublicKey 1453 +#define OBJ_tcg_tr_cat_PublicKey OBJ_tcg_tr_category,37L + +#define OBJ_nistKems OBJ_nistAlgorithms,4L + +#define SN_ML_KEM_512 "id-alg-ml-kem-512" +#define LN_ML_KEM_512 "ML-KEM-512" +#define NID_ML_KEM_512 1454 +#define OBJ_ML_KEM_512 OBJ_nistKems,1L + +#define SN_ML_KEM_768 "id-alg-ml-kem-768" +#define LN_ML_KEM_768 "ML-KEM-768" +#define NID_ML_KEM_768 1455 +#define OBJ_ML_KEM_768 OBJ_nistKems,2L + +#define SN_ML_KEM_1024 "id-alg-ml-kem-1024" +#define LN_ML_KEM_1024 "ML-KEM-1024" +#define NID_ML_KEM_1024 1456 +#define OBJ_ML_KEM_1024 OBJ_nistKems,3L + +#endif /* OPENSSL_OBJ_MAC_H */ + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm SN_magma_ctr_acpkm +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm NID_magma_ctr_acpkm +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_magma_ctr_acpkm + +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac SN_magma_ctr_acpkm_omac +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac NID_magma_ctr_acpkm_omac +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_magma_ctr_acpkm_omac + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm SN_kuznyechik_ctr_acpkm +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm NID_kuznyechik_ctr_acpkm +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_kuznyechik_ctr_acpkm + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac SN_kuznyechik_ctr_acpkm_omac +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac NID_kuznyechik_ctr_acpkm_omac +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_kuznyechik_ctr_acpkm_omac + +#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 SN_magma_kexp15 +#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 NID_magma_kexp15 +#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_magma_kexp15 + +#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 SN_kuznyechik_kexp15 +#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 NID_kuznyechik_kexp15 +#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_kuznyechik_kexp15 + +#define SN_grasshopper_ecb SN_kuznyechik_ecb +#define NID_grasshopper_ecb NID_kuznyechik_ecb + +#define SN_grasshopper_ctr SN_kuznyechik_ctr +#define NID_grasshopper_ctr NID_kuznyechik_ctr + +#define SN_grasshopper_ofb SN_kuznyechik_ofb +#define NID_grasshopper_ofb NID_kuznyechik_ofb + +#define SN_grasshopper_cbc SN_kuznyechik_cbc +#define NID_grasshopper_cbc NID_kuznyechik_cbc + +#define SN_grasshopper_cfb SN_kuznyechik_cfb +#define NID_grasshopper_cfb NID_kuznyechik_cfb + +#define SN_grasshopper_mac SN_kuznyechik_mac +#define NID_grasshopper_mac NID_kuznyechik_mac + +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/objects.h b/VCMP-LUA/modules/postgresql/include/openssl/objects.h new file mode 100644 index 0000000..de1f1db --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/objects.h @@ -0,0 +1,186 @@ +/* + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_OBJECTS_H +#define OPENSSL_OBJECTS_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_OBJECTS_H +#endif + +#include +#include +#include +#include + +#define OBJ_NAME_TYPE_UNDEF 0x00 +#define OBJ_NAME_TYPE_MD_METH 0x01 +#define OBJ_NAME_TYPE_CIPHER_METH 0x02 +#define OBJ_NAME_TYPE_PKEY_METH 0x03 +#define OBJ_NAME_TYPE_COMP_METH 0x04 +#define OBJ_NAME_TYPE_MAC_METH 0x05 +#define OBJ_NAME_TYPE_KDF_METH 0x06 +#define OBJ_NAME_TYPE_NUM 0x07 + +#define OBJ_NAME_ALIAS 0x8000 + +#define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 +#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct obj_name_st { + int type; + int alias; + const char *name; + const char *data; +} OBJ_NAME; + +#define OBJ_create_and_add_object(a, b, c) OBJ_create(a, b, c) + +int OBJ_NAME_init(void); +int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), + int (*cmp_func)(const char *, const char *), + void (*free_func)(const char *, int, const char *)); +const char *OBJ_NAME_get(const char *name, int type); +int OBJ_NAME_add(const char *name, int type, const char *data); +int OBJ_NAME_remove(const char *name, int type); +void OBJ_NAME_cleanup(int type); /* -1 for everything */ +void OBJ_NAME_do_all(int type, void (*fn)(const OBJ_NAME *, void *arg), + void *arg); +void OBJ_NAME_do_all_sorted(int type, + void (*fn)(const OBJ_NAME *, void *arg), + void *arg); + +DECLARE_ASN1_DUP_FUNCTION_name(ASN1_OBJECT, OBJ) +ASN1_OBJECT *OBJ_nid2obj(int n); +const char *OBJ_nid2ln(int n); +const char *OBJ_nid2sn(int n); +int OBJ_obj2nid(const ASN1_OBJECT *o); +ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); +int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); +int OBJ_txt2nid(const char *s); +int OBJ_ln2nid(const char *s); +int OBJ_sn2nid(const char *s); +int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); +const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, + int (*cmp)(const void *, const void *)); +const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, + int size, + int (*cmp)(const void *, const void *), + int flags); + +#define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ + static int nm##_cmp(type1 const *, type2 const *); \ + scope type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) + +#define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ + _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) +#define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) + +/*- + * Unsolved problem: if a type is actually a pointer type, like + * nid_triple is, then its impossible to get a const where you need + * it. Consider: + * + * typedef int nid_triple[3]; + * const void *a_; + * const nid_triple const *a = a_; + * + * The assignment discards a const because what you really want is: + * + * const int const * const *a = a_; + * + * But if you do that, you lose the fact that a is an array of 3 ints, + * which breaks comparison functions. + * + * Thus we end up having to cast, sadly, or unpack the + * declarations. Or, as I finally did in this case, declare nid_triple + * to be a struct, which it should have been in the first place. + * + * Ben, August 2008. + * + * Also, strictly speaking not all types need be const, but handling + * the non-constness means a lot of complication, and in practice + * comparison routines do always not touch their arguments. + */ + +#define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ + { \ + type1 const *a = a_; \ + type2 const *b = b_; \ + return nm##_cmp(a, b); \ + } \ + static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ + { \ + return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ + nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +#define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ + { \ + type1 const *a = a_; \ + type2 const *b = b_; \ + return nm##_cmp(a, b); \ + } \ + type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ + { \ + return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ + nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +#define OBJ_bsearch(type1, key, type2, base, num, cmp) \ + ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1, key), CHECKED_PTR_OF(type2, base), \ + num, sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1, cmp##_type_1), \ + (void)CHECKED_PTR_OF(type2, cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN))) + +#define OBJ_bsearch_ex(type1, key, type2, base, num, cmp, flags) \ + ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1, key), CHECKED_PTR_OF(type2, base), \ + num, sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1, cmp##_type_1), \ + (void)type_2 = CHECKED_PTR_OF(type2, cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN)), \ + flags) + +int OBJ_new_nid(int num); +int OBJ_add_object(const ASN1_OBJECT *obj); +int OBJ_create(const char *oid, const char *sn, const char *ln); +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define OBJ_cleanup() \ + while (0) \ + continue +#endif +int OBJ_create_objects(BIO *in); + +size_t OBJ_length(const ASN1_OBJECT *obj); +const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); + +int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); +int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); +int OBJ_add_sigid(int signid, int dig_id, int pkey_id); +void OBJ_sigid_free(void); + +#define SN_ac_auditEntity SN_ac_auditIdentity + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/objectserr.h b/VCMP-LUA/modules/postgresql/include/openssl/objectserr.h new file mode 100644 index 0000000..2927561 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/objectserr.h @@ -0,0 +1,26 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_OBJECTSERR_H +#define OPENSSL_OBJECTSERR_H +#pragma once + +#include +#include +#include + +/* + * OBJ reason codes. + */ +#define OBJ_R_OID_EXISTS 102 +#define OBJ_R_UNKNOWN_NID 101 +#define OBJ_R_UNKNOWN_OBJECT_NAME 103 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ocsp.h b/VCMP-LUA/modules/postgresql/include/openssl/ocsp.h new file mode 100644 index 0000000..07c9400 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ocsp.h @@ -0,0 +1,487 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\ocsp.h.in + * + * Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_OCSP_H +#define OPENSSL_OCSP_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_OCSP_H +#endif + +#include +#include +#include + +/* + * These definitions are outside the OPENSSL_NO_OCSP guard because although for + * historical reasons they have OCSP_* names, they can actually be used + * independently of OCSP. E.g. see RFC5280 + */ +/*- + * CRLReason ::= ENUMERATED { + * unspecified (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6), + * -- value 7 is not used + * removeFromCRL (8), + * privilegeWithdrawn (9), + * aACompromise (10) } + */ +#define OCSP_REVOKED_STATUS_NOSTATUS -1 +#define OCSP_REVOKED_STATUS_UNSPECIFIED 0 +#define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 +#define OCSP_REVOKED_STATUS_CACOMPROMISE 2 +#define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 +#define OCSP_REVOKED_STATUS_SUPERSEDED 4 +#define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 +#define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 +#define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 +#define OCSP_REVOKED_STATUS_PRIVILEGEWITHDRAWN 9 +#define OCSP_REVOKED_STATUS_AACOMPROMISE 10 + +#ifndef OPENSSL_NO_OCSP + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Various flags and values */ + +#define OCSP_DEFAULT_NONCE_LENGTH 16 + +#define OCSP_NOCERTS 0x1 +#define OCSP_NOINTERN 0x2 +#define OCSP_NOSIGS 0x4 +#define OCSP_NOCHAIN 0x8 +#define OCSP_NOVERIFY 0x10 +#define OCSP_NOEXPLICIT 0x20 +#define OCSP_NOCASIGN 0x40 +#define OCSP_NODELEGATED 0x80 +#define OCSP_NOCHECKS 0x100 +#define OCSP_TRUSTOTHER 0x200 +#define OCSP_RESPID_KEY 0x400 +#define OCSP_NOTIME 0x800 +#define OCSP_PARTIAL_CHAIN 0x1000 + +typedef struct ocsp_cert_id_st OCSP_CERTID; +typedef struct ocsp_one_request_st OCSP_ONEREQ; +typedef struct ocsp_req_info_st OCSP_REQINFO; +typedef struct ocsp_signature_st OCSP_SIGNATURE; +typedef struct ocsp_request_st OCSP_REQUEST; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OCSP_CERTID, OCSP_CERTID, OCSP_CERTID) +#define sk_OCSP_CERTID_num(sk) OPENSSL_sk_num(ossl_check_const_OCSP_CERTID_sk_type(sk)) +#define sk_OCSP_CERTID_value(sk, idx) ((OCSP_CERTID *)OPENSSL_sk_value(ossl_check_const_OCSP_CERTID_sk_type(sk), (idx))) +#define sk_OCSP_CERTID_new(cmp) ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_new(ossl_check_OCSP_CERTID_compfunc_type(cmp))) +#define sk_OCSP_CERTID_new_null() ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_new_null()) +#define sk_OCSP_CERTID_new_reserve(cmp, n) ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_new_reserve(ossl_check_OCSP_CERTID_compfunc_type(cmp), (n))) +#define sk_OCSP_CERTID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OCSP_CERTID_sk_type(sk), (n)) +#define sk_OCSP_CERTID_free(sk) OPENSSL_sk_free(ossl_check_OCSP_CERTID_sk_type(sk)) +#define sk_OCSP_CERTID_zero(sk) OPENSSL_sk_zero(ossl_check_OCSP_CERTID_sk_type(sk)) +#define sk_OCSP_CERTID_delete(sk, i) ((OCSP_CERTID *)OPENSSL_sk_delete(ossl_check_OCSP_CERTID_sk_type(sk), (i))) +#define sk_OCSP_CERTID_delete_ptr(sk, ptr) ((OCSP_CERTID *)OPENSSL_sk_delete_ptr(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr))) +#define sk_OCSP_CERTID_push(sk, ptr) OPENSSL_sk_push(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr)) +#define sk_OCSP_CERTID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr)) +#define sk_OCSP_CERTID_pop(sk) ((OCSP_CERTID *)OPENSSL_sk_pop(ossl_check_OCSP_CERTID_sk_type(sk))) +#define sk_OCSP_CERTID_shift(sk) ((OCSP_CERTID *)OPENSSL_sk_shift(ossl_check_OCSP_CERTID_sk_type(sk))) +#define sk_OCSP_CERTID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_freefunc_type(freefunc)) +#define sk_OCSP_CERTID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr), (idx)) +#define sk_OCSP_CERTID_set(sk, idx, ptr) ((OCSP_CERTID *)OPENSSL_sk_set(ossl_check_OCSP_CERTID_sk_type(sk), (idx), ossl_check_OCSP_CERTID_type(ptr))) +#define sk_OCSP_CERTID_find(sk, ptr) OPENSSL_sk_find(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr)) +#define sk_OCSP_CERTID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr)) +#define sk_OCSP_CERTID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr), pnum) +#define sk_OCSP_CERTID_sort(sk) OPENSSL_sk_sort(ossl_check_OCSP_CERTID_sk_type(sk)) +#define sk_OCSP_CERTID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OCSP_CERTID_sk_type(sk)) +#define sk_OCSP_CERTID_dup(sk) ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_dup(ossl_check_const_OCSP_CERTID_sk_type(sk))) +#define sk_OCSP_CERTID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_deep_copy(ossl_check_const_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_copyfunc_type(copyfunc), ossl_check_OCSP_CERTID_freefunc_type(freefunc))) +#define sk_OCSP_CERTID_set_cmp_func(sk, cmp) ((sk_OCSP_CERTID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(OCSP_ONEREQ, OCSP_ONEREQ, OCSP_ONEREQ) +#define sk_OCSP_ONEREQ_num(sk) OPENSSL_sk_num(ossl_check_const_OCSP_ONEREQ_sk_type(sk)) +#define sk_OCSP_ONEREQ_value(sk, idx) ((OCSP_ONEREQ *)OPENSSL_sk_value(ossl_check_const_OCSP_ONEREQ_sk_type(sk), (idx))) +#define sk_OCSP_ONEREQ_new(cmp) ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_new(ossl_check_OCSP_ONEREQ_compfunc_type(cmp))) +#define sk_OCSP_ONEREQ_new_null() ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_new_null()) +#define sk_OCSP_ONEREQ_new_reserve(cmp, n) ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_new_reserve(ossl_check_OCSP_ONEREQ_compfunc_type(cmp), (n))) +#define sk_OCSP_ONEREQ_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OCSP_ONEREQ_sk_type(sk), (n)) +#define sk_OCSP_ONEREQ_free(sk) OPENSSL_sk_free(ossl_check_OCSP_ONEREQ_sk_type(sk)) +#define sk_OCSP_ONEREQ_zero(sk) OPENSSL_sk_zero(ossl_check_OCSP_ONEREQ_sk_type(sk)) +#define sk_OCSP_ONEREQ_delete(sk, i) ((OCSP_ONEREQ *)OPENSSL_sk_delete(ossl_check_OCSP_ONEREQ_sk_type(sk), (i))) +#define sk_OCSP_ONEREQ_delete_ptr(sk, ptr) ((OCSP_ONEREQ *)OPENSSL_sk_delete_ptr(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr))) +#define sk_OCSP_ONEREQ_push(sk, ptr) OPENSSL_sk_push(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr)) +#define sk_OCSP_ONEREQ_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr)) +#define sk_OCSP_ONEREQ_pop(sk) ((OCSP_ONEREQ *)OPENSSL_sk_pop(ossl_check_OCSP_ONEREQ_sk_type(sk))) +#define sk_OCSP_ONEREQ_shift(sk) ((OCSP_ONEREQ *)OPENSSL_sk_shift(ossl_check_OCSP_ONEREQ_sk_type(sk))) +#define sk_OCSP_ONEREQ_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_freefunc_type(freefunc)) +#define sk_OCSP_ONEREQ_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr), (idx)) +#define sk_OCSP_ONEREQ_set(sk, idx, ptr) ((OCSP_ONEREQ *)OPENSSL_sk_set(ossl_check_OCSP_ONEREQ_sk_type(sk), (idx), ossl_check_OCSP_ONEREQ_type(ptr))) +#define sk_OCSP_ONEREQ_find(sk, ptr) OPENSSL_sk_find(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr)) +#define sk_OCSP_ONEREQ_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr)) +#define sk_OCSP_ONEREQ_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr), pnum) +#define sk_OCSP_ONEREQ_sort(sk) OPENSSL_sk_sort(ossl_check_OCSP_ONEREQ_sk_type(sk)) +#define sk_OCSP_ONEREQ_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OCSP_ONEREQ_sk_type(sk)) +#define sk_OCSP_ONEREQ_dup(sk) ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_dup(ossl_check_const_OCSP_ONEREQ_sk_type(sk))) +#define sk_OCSP_ONEREQ_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_deep_copy(ossl_check_const_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_copyfunc_type(copyfunc), ossl_check_OCSP_ONEREQ_freefunc_type(freefunc))) +#define sk_OCSP_ONEREQ_set_cmp_func(sk, cmp) ((sk_OCSP_ONEREQ_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_compfunc_type(cmp))) + +/* clang-format on */ + +#define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 +#define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 +#define OCSP_RESPONSE_STATUS_INTERNALERROR 2 +#define OCSP_RESPONSE_STATUS_TRYLATER 3 +#define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 +#define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 + +typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES; + +#define V_OCSP_RESPID_NAME 0 +#define V_OCSP_RESPID_KEY 1 + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OCSP_RESPID, OCSP_RESPID, OCSP_RESPID) +#define sk_OCSP_RESPID_num(sk) OPENSSL_sk_num(ossl_check_const_OCSP_RESPID_sk_type(sk)) +#define sk_OCSP_RESPID_value(sk, idx) ((OCSP_RESPID *)OPENSSL_sk_value(ossl_check_const_OCSP_RESPID_sk_type(sk), (idx))) +#define sk_OCSP_RESPID_new(cmp) ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_new(ossl_check_OCSP_RESPID_compfunc_type(cmp))) +#define sk_OCSP_RESPID_new_null() ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_new_null()) +#define sk_OCSP_RESPID_new_reserve(cmp, n) ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_new_reserve(ossl_check_OCSP_RESPID_compfunc_type(cmp), (n))) +#define sk_OCSP_RESPID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OCSP_RESPID_sk_type(sk), (n)) +#define sk_OCSP_RESPID_free(sk) OPENSSL_sk_free(ossl_check_OCSP_RESPID_sk_type(sk)) +#define sk_OCSP_RESPID_zero(sk) OPENSSL_sk_zero(ossl_check_OCSP_RESPID_sk_type(sk)) +#define sk_OCSP_RESPID_delete(sk, i) ((OCSP_RESPID *)OPENSSL_sk_delete(ossl_check_OCSP_RESPID_sk_type(sk), (i))) +#define sk_OCSP_RESPID_delete_ptr(sk, ptr) ((OCSP_RESPID *)OPENSSL_sk_delete_ptr(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr))) +#define sk_OCSP_RESPID_push(sk, ptr) OPENSSL_sk_push(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr)) +#define sk_OCSP_RESPID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr)) +#define sk_OCSP_RESPID_pop(sk) ((OCSP_RESPID *)OPENSSL_sk_pop(ossl_check_OCSP_RESPID_sk_type(sk))) +#define sk_OCSP_RESPID_shift(sk) ((OCSP_RESPID *)OPENSSL_sk_shift(ossl_check_OCSP_RESPID_sk_type(sk))) +#define sk_OCSP_RESPID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_freefunc_type(freefunc)) +#define sk_OCSP_RESPID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr), (idx)) +#define sk_OCSP_RESPID_set(sk, idx, ptr) ((OCSP_RESPID *)OPENSSL_sk_set(ossl_check_OCSP_RESPID_sk_type(sk), (idx), ossl_check_OCSP_RESPID_type(ptr))) +#define sk_OCSP_RESPID_find(sk, ptr) OPENSSL_sk_find(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr)) +#define sk_OCSP_RESPID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr)) +#define sk_OCSP_RESPID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr), pnum) +#define sk_OCSP_RESPID_sort(sk) OPENSSL_sk_sort(ossl_check_OCSP_RESPID_sk_type(sk)) +#define sk_OCSP_RESPID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OCSP_RESPID_sk_type(sk)) +#define sk_OCSP_RESPID_dup(sk) ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_dup(ossl_check_const_OCSP_RESPID_sk_type(sk))) +#define sk_OCSP_RESPID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_deep_copy(ossl_check_const_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_copyfunc_type(copyfunc), ossl_check_OCSP_RESPID_freefunc_type(freefunc))) +#define sk_OCSP_RESPID_set_cmp_func(sk, cmp) ((sk_OCSP_RESPID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO; + +#define V_OCSP_CERTSTATUS_GOOD 0 +#define V_OCSP_CERTSTATUS_REVOKED 1 +#define V_OCSP_CERTSTATUS_UNKNOWN 2 + +typedef struct ocsp_cert_status_st OCSP_CERTSTATUS; +typedef struct ocsp_single_response_st OCSP_SINGLERESP; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OCSP_SINGLERESP, OCSP_SINGLERESP, OCSP_SINGLERESP) +#define sk_OCSP_SINGLERESP_num(sk) OPENSSL_sk_num(ossl_check_const_OCSP_SINGLERESP_sk_type(sk)) +#define sk_OCSP_SINGLERESP_value(sk, idx) ((OCSP_SINGLERESP *)OPENSSL_sk_value(ossl_check_const_OCSP_SINGLERESP_sk_type(sk), (idx))) +#define sk_OCSP_SINGLERESP_new(cmp) ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_new(ossl_check_OCSP_SINGLERESP_compfunc_type(cmp))) +#define sk_OCSP_SINGLERESP_new_null() ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_new_null()) +#define sk_OCSP_SINGLERESP_new_reserve(cmp, n) ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_new_reserve(ossl_check_OCSP_SINGLERESP_compfunc_type(cmp), (n))) +#define sk_OCSP_SINGLERESP_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OCSP_SINGLERESP_sk_type(sk), (n)) +#define sk_OCSP_SINGLERESP_free(sk) OPENSSL_sk_free(ossl_check_OCSP_SINGLERESP_sk_type(sk)) +#define sk_OCSP_SINGLERESP_zero(sk) OPENSSL_sk_zero(ossl_check_OCSP_SINGLERESP_sk_type(sk)) +#define sk_OCSP_SINGLERESP_delete(sk, i) ((OCSP_SINGLERESP *)OPENSSL_sk_delete(ossl_check_OCSP_SINGLERESP_sk_type(sk), (i))) +#define sk_OCSP_SINGLERESP_delete_ptr(sk, ptr) ((OCSP_SINGLERESP *)OPENSSL_sk_delete_ptr(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr))) +#define sk_OCSP_SINGLERESP_push(sk, ptr) OPENSSL_sk_push(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr)) +#define sk_OCSP_SINGLERESP_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr)) +#define sk_OCSP_SINGLERESP_pop(sk) ((OCSP_SINGLERESP *)OPENSSL_sk_pop(ossl_check_OCSP_SINGLERESP_sk_type(sk))) +#define sk_OCSP_SINGLERESP_shift(sk) ((OCSP_SINGLERESP *)OPENSSL_sk_shift(ossl_check_OCSP_SINGLERESP_sk_type(sk))) +#define sk_OCSP_SINGLERESP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_freefunc_type(freefunc)) +#define sk_OCSP_SINGLERESP_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr), (idx)) +#define sk_OCSP_SINGLERESP_set(sk, idx, ptr) ((OCSP_SINGLERESP *)OPENSSL_sk_set(ossl_check_OCSP_SINGLERESP_sk_type(sk), (idx), ossl_check_OCSP_SINGLERESP_type(ptr))) +#define sk_OCSP_SINGLERESP_find(sk, ptr) OPENSSL_sk_find(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr)) +#define sk_OCSP_SINGLERESP_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr)) +#define sk_OCSP_SINGLERESP_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr), pnum) +#define sk_OCSP_SINGLERESP_sort(sk) OPENSSL_sk_sort(ossl_check_OCSP_SINGLERESP_sk_type(sk)) +#define sk_OCSP_SINGLERESP_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OCSP_SINGLERESP_sk_type(sk)) +#define sk_OCSP_SINGLERESP_dup(sk) ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_dup(ossl_check_const_OCSP_SINGLERESP_sk_type(sk))) +#define sk_OCSP_SINGLERESP_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_deep_copy(ossl_check_const_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_copyfunc_type(copyfunc), ossl_check_OCSP_SINGLERESP_freefunc_type(freefunc))) +#define sk_OCSP_SINGLERESP_set_cmp_func(sk, cmp) ((sk_OCSP_SINGLERESP_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct ocsp_response_data_st OCSP_RESPDATA; + +typedef struct ocsp_basic_response_st OCSP_BASICRESP; + +typedef struct ocsp_crl_id_st OCSP_CRLID; +typedef struct ocsp_service_locator_st OCSP_SERVICELOC; + +#define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" +#define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" + +#define d2i_OCSP_REQUEST_bio(bp, p) ASN1_d2i_bio_of(OCSP_REQUEST, OCSP_REQUEST_new, d2i_OCSP_REQUEST, bp, p) + +#define d2i_OCSP_RESPONSE_bio(bp, p) ASN1_d2i_bio_of(OCSP_RESPONSE, OCSP_RESPONSE_new, d2i_OCSP_RESPONSE, bp, p) + +#define PEM_read_bio_OCSP_REQUEST(bp, x, cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ + (d2i_of_void *)d2i_OCSP_REQUEST, PEM_STRING_OCSP_REQUEST, \ + bp, (char **)(x), cb, NULL) + +#define PEM_read_bio_OCSP_RESPONSE(bp, x, cb) (OCSP_RESPONSE *)PEM_ASN1_read_bio( \ + (d2i_of_void *)d2i_OCSP_RESPONSE, PEM_STRING_OCSP_RESPONSE, \ + bp, (char **)(x), cb, NULL) + +#define PEM_write_bio_OCSP_REQUEST(bp, o) \ + PEM_ASN1_write_bio((i2d_of_void *)i2d_OCSP_REQUEST, PEM_STRING_OCSP_REQUEST, \ + bp, (char *)(o), NULL, NULL, 0, NULL, NULL) + +#define PEM_write_bio_OCSP_RESPONSE(bp, o) \ + PEM_ASN1_write_bio((i2d_of_void *)i2d_OCSP_RESPONSE, PEM_STRING_OCSP_RESPONSE, \ + bp, (char *)(o), NULL, NULL, 0, NULL, NULL) + +#define i2d_OCSP_RESPONSE_bio(bp, o) ASN1_i2d_bio_of(OCSP_RESPONSE, i2d_OCSP_RESPONSE, bp, o) + +#define i2d_OCSP_REQUEST_bio(bp, o) ASN1_i2d_bio_of(OCSP_REQUEST, i2d_OCSP_REQUEST, bp, o) + +#define ASN1_BIT_STRING_digest(data, type, md, len) \ + ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING), type, data, md, len) + +#define OCSP_CERTSTATUS_dup(cs) \ + (OCSP_CERTSTATUS *)ASN1_dup((i2d_of_void *)i2d_OCSP_CERTSTATUS, \ + (d2i_of_void *)d2i_OCSP_CERTSTATUS, (char *)(cs)) + +DECLARE_ASN1_DUP_FUNCTION(OCSP_CERTID) + +OSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, + const OCSP_REQUEST *req, int buf_size); +OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +typedef OSSL_HTTP_REQ_CTX OCSP_REQ_CTX; +#define OCSP_REQ_CTX_new(io, buf_size) \ + OSSL_HTTP_REQ_CTX_new(io, io, buf_size) +#define OCSP_REQ_CTX_free OSSL_HTTP_REQ_CTX_free +#define OCSP_REQ_CTX_http(rctx, op, path) \ + (OSSL_HTTP_REQ_CTX_set_expected(rctx, NULL, 1 /* asn1 */, 0, 0) && OSSL_HTTP_REQ_CTX_set_request_line(rctx, strcmp(op, "POST") == 0, NULL, NULL, path)) +#define OCSP_REQ_CTX_add1_header OSSL_HTTP_REQ_CTX_add1_header +#define OCSP_REQ_CTX_i2d(r, it, req) \ + OSSL_HTTP_REQ_CTX_set1_req(r, "application/ocsp-request", it, req) +#define OCSP_REQ_CTX_set1_req(r, req) \ + OCSP_REQ_CTX_i2d(r, ASN1_ITEM_rptr(OCSP_REQUEST), (ASN1_VALUE *)(req)) +#define OCSP_REQ_CTX_nbio OSSL_HTTP_REQ_CTX_nbio +#define OCSP_REQ_CTX_nbio_d2i OSSL_HTTP_REQ_CTX_nbio_d2i +#define OCSP_sendreq_nbio(p, r) \ + OSSL_HTTP_REQ_CTX_nbio_d2i(r, (ASN1_VALUE **)(p), \ + ASN1_ITEM_rptr(OCSP_RESPONSE)) +#define OCSP_REQ_CTX_get0_mem_bio OSSL_HTTP_REQ_CTX_get0_mem_bio +#define OCSP_set_max_response_length OSSL_HTTP_REQ_CTX_set_max_response_length +#endif + +OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject, + const X509 *issuer); + +OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, + const X509_NAME *issuerName, + const ASN1_BIT_STRING *issuerKey, + const ASN1_INTEGER *serialNumber); + +OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); + +int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); +int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); +int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); +int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); + +int OCSP_request_set1_name(OCSP_REQUEST *req, const X509_NAME *nm); +int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); + +int OCSP_request_sign(OCSP_REQUEST *req, + X509 *signer, + EVP_PKEY *key, + const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); + +int OCSP_response_status(OCSP_RESPONSE *resp); +OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); + +const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs); +const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs); +const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs); +int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, + STACK_OF(X509) *extra_certs); + +int OCSP_resp_count(OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); +const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP *bs); +const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs); +int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, + const ASN1_OCTET_STRING **pid, + const X509_NAME **pname); +int OCSP_resp_get1_id(const OCSP_BASICRESP *bs, + ASN1_OCTET_STRING **pid, + X509_NAME **pname); + +int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); +int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, + int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, + ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); + +int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, + X509_STORE *store, unsigned long flags); + +#define OCSP_parse_url(url, host, port, path, ssl) \ + OSSL_HTTP_parse_url(url, ssl, NULL, host, port, NULL, path, NULL, NULL) + +int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); +int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); + +int OCSP_request_onereq_count(OCSP_REQUEST *req); +OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); +OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); +int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, + ASN1_OCTET_STRING **pikeyHash, + ASN1_INTEGER **pserial, OCSP_CERTID *cid); +int OCSP_request_is_signed(OCSP_REQUEST *req); +OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, + OCSP_CERTID *cid, + int status, int reason, + ASN1_TIME *revtime, + ASN1_TIME *thisupd, + ASN1_TIME *nextupd); +int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); +int OCSP_basic_sign(OCSP_BASICRESP *brsp, + X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); +int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, + X509 *signer, EVP_MD_CTX *ctx, + STACK_OF(X509) *certs, unsigned long flags); +int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert); +int OCSP_RESPID_set_by_key_ex(OCSP_RESPID *respid, X509 *cert, + OSSL_LIB_CTX *libctx, const char *propq); +int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert); +int OCSP_RESPID_match_ex(OCSP_RESPID *respid, X509 *cert, OSSL_LIB_CTX *libctx, + const char *propq); +int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert); + +X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim); + +X509_EXTENSION *OCSP_accept_responses_new(char **oids); + +X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); + +X509_EXTENSION *OCSP_url_svcloc_new(const X509_NAME *issuer, const char **urls); + +int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); +int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); +int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); +X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); +X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); +void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, + int *idx); +int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); + +int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); +int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); +int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos); +int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); +X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); +X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); +void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); +int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); + +int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); +int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); +int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, + int lastpos); +X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); +X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); +void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, + int *idx); +int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, + int crit, unsigned long flags); +int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); + +int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); +int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); +int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, + int lastpos); +X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); +X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); +void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, + int *idx); +int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, + int crit, unsigned long flags); +int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); +const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x); + +DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) +DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) +DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) +DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) +DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) +DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) +DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) + +const char *OCSP_response_status_str(long s); +const char *OCSP_cert_status_str(long s); +const char *OCSP_crl_reason_str(long s); + +int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); +int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); + +int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, + X509_STORE *st, unsigned long flags); + +#ifdef __cplusplus +} +#endif +#endif /* !defined(OPENSSL_NO_OCSP) */ +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ocsperr.h b/VCMP-LUA/modules/postgresql/include/openssl/ocsperr.h new file mode 100644 index 0000000..18e035e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ocsperr.h @@ -0,0 +1,51 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_OCSPERR_H +#define OPENSSL_OCSPERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_OCSP + +/* + * OCSP reason codes. + */ +#define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 +#define OCSP_R_DIGEST_ERR 102 +#define OCSP_R_DIGEST_NAME_ERR 106 +#define OCSP_R_DIGEST_SIZE_ERR 107 +#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 +#define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 +#define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 +#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 +#define OCSP_R_NOT_BASIC_RESPONSE 104 +#define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 +#define OCSP_R_NO_RESPONSE_DATA 108 +#define OCSP_R_NO_REVOKED_TIME 109 +#define OCSP_R_NO_SIGNER_KEY 130 +#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 +#define OCSP_R_REQUEST_NOT_SIGNED 128 +#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 +#define OCSP_R_ROOT_CA_NOT_TRUSTED 112 +#define OCSP_R_SIGNATURE_FAILURE 117 +#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 +#define OCSP_R_STATUS_EXPIRED 125 +#define OCSP_R_STATUS_NOT_YET_VALID 126 +#define OCSP_R_STATUS_TOO_OLD 127 +#define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 +#define OCSP_R_UNKNOWN_NID 120 +#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/opensslconf.h b/VCMP-LUA/modules/postgresql/include/openssl/opensslconf.h new file mode 100644 index 0000000..4a8d78e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/opensslconf.h @@ -0,0 +1,17 @@ +/* + * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_OPENSSLCONF_H +#define OPENSSL_OPENSSLCONF_H +#pragma once + +#include +#include + +#endif /* OPENSSL_OPENSSLCONF_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/opensslv.h b/VCMP-LUA/modules/postgresql/include/openssl/opensslv.h new file mode 100644 index 0000000..90a300b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/opensslv.h @@ -0,0 +1,131 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\opensslv.h.in + * + * Copyright 1999-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_OPENSSLV_H +#define OPENSSL_OPENSSLV_H +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SECTION 1: VERSION DATA. These will change for each release + */ + +/* + * Base version macros + * + * These macros express version number MAJOR.MINOR.PATCH exactly + */ +/* clang-format off */ +# define OPENSSL_VERSION_MAJOR 3 +/* clang-format on */ +/* clang-format off */ +# define OPENSSL_VERSION_MINOR 6 +/* clang-format on */ +/* clang-format off */ +# define OPENSSL_VERSION_PATCH 2 +/* clang-format on */ + +/* + * Additional version information + * + * These are also part of the new version scheme, but aren't part + * of the version number itself. + */ + +/* Could be: #define OPENSSL_VERSION_PRE_RELEASE "-alpha.1" */ +/* clang-format off */ +# define OPENSSL_VERSION_PRE_RELEASE "" +/* clang-format on */ +/* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+fips" */ +/* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+vendor.1" */ +/* clang-format off */ +# define OPENSSL_VERSION_BUILD_METADATA "" +/* clang-format on */ + +/* + * Note: The OpenSSL Project will never define OPENSSL_VERSION_BUILD_METADATA + * to be anything but the empty string. Its use is entirely reserved for + * others + */ + +/* + * Shared library version + * + * This is strictly to express ABI version, which may or may not + * be related to the API version expressed with the macros above. + * This is defined in free form. + */ +/* clang-format off */ +# define OPENSSL_SHLIB_VERSION 3 +/* clang-format on */ + +/* + * SECTION 2: USEFUL MACROS + */ + +/* For checking general API compatibility when preprocessing */ +#define OPENSSL_VERSION_PREREQ(maj, min) \ + ((OPENSSL_VERSION_MAJOR << 16) + OPENSSL_VERSION_MINOR >= ((maj) << 16) + (min)) + +/* + * Macros to get the version in easily digested string form, both the short + * "MAJOR.MINOR.PATCH" variant (where MAJOR, MINOR and PATCH are replaced + * with the values from the corresponding OPENSSL_VERSION_ macros) and the + * longer variant with OPENSSL_VERSION_PRE_RELEASE_STR and + * OPENSSL_VERSION_BUILD_METADATA_STR appended. + */ +/* clang-format off */ +# define OPENSSL_VERSION_STR "3.6.2" +/* clang-format on */ +/* clang-format off */ +# define OPENSSL_FULL_VERSION_STR "3.6.2" +/* clang-format on */ + +/* + * SECTION 3: ADDITIONAL METADATA + * + * These strings are defined separately to allow them to be parsable. + */ +/* clang-format off */ +# define OPENSSL_RELEASE_DATE "7 Apr 2026" +/* clang-format on */ + +/* + * SECTION 4: BACKWARD COMPATIBILITY + */ + +/* clang-format off */ +# define OPENSSL_VERSION_TEXT "OpenSSL 3.6.2 7 Apr 2026" +/* clang-format on */ + +/* clang-format off */ +/* Synthesize OPENSSL_VERSION_NUMBER with the layout 0xMNN00PP0L */ +# define OPENSSL_VERSION_NUMBER \ + ( (OPENSSL_VERSION_MAJOR<<28) \ + |(OPENSSL_VERSION_MINOR<<20) \ + |(OPENSSL_VERSION_PATCH<<4) \ + |0x0L ) +/* clang-format on */ + +#ifdef __cplusplus +} +#endif + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_OPENSSLV_H +#endif + +#endif /* OPENSSL_OPENSSLV_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ossl_typ.h b/VCMP-LUA/modules/postgresql/include/openssl/ossl_typ.h new file mode 100644 index 0000000..a562299 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ossl_typ.h @@ -0,0 +1,16 @@ +/* + * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * The original was renamed to + * + * This header file only exists for compatibility reasons with older + * applications which #include . + */ +#include diff --git a/VCMP-LUA/modules/postgresql/include/openssl/param_build.h b/VCMP-LUA/modules/postgresql/include/openssl/param_build.h new file mode 100644 index 0000000..be6a025 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/param_build.h @@ -0,0 +1,63 @@ +/* + * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PARAM_BUILD_H +#define OPENSSL_PARAM_BUILD_H +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +OSSL_PARAM_BLD *OSSL_PARAM_BLD_new(void); +OSSL_PARAM *OSSL_PARAM_BLD_to_param(OSSL_PARAM_BLD *bld); +void OSSL_PARAM_BLD_free(OSSL_PARAM_BLD *bld); + +int OSSL_PARAM_BLD_push_int(OSSL_PARAM_BLD *bld, const char *key, int val); +int OSSL_PARAM_BLD_push_uint(OSSL_PARAM_BLD *bld, const char *key, + unsigned int val); +int OSSL_PARAM_BLD_push_long(OSSL_PARAM_BLD *bld, const char *key, + long int val); +int OSSL_PARAM_BLD_push_ulong(OSSL_PARAM_BLD *bld, const char *key, + unsigned long int val); +int OSSL_PARAM_BLD_push_int32(OSSL_PARAM_BLD *bld, const char *key, + int32_t val); +int OSSL_PARAM_BLD_push_uint32(OSSL_PARAM_BLD *bld, const char *key, + uint32_t val); +int OSSL_PARAM_BLD_push_int64(OSSL_PARAM_BLD *bld, const char *key, + int64_t val); +int OSSL_PARAM_BLD_push_uint64(OSSL_PARAM_BLD *bld, const char *key, + uint64_t val); +int OSSL_PARAM_BLD_push_size_t(OSSL_PARAM_BLD *bld, const char *key, + size_t val); +int OSSL_PARAM_BLD_push_time_t(OSSL_PARAM_BLD *bld, const char *key, + time_t val); +int OSSL_PARAM_BLD_push_double(OSSL_PARAM_BLD *bld, const char *key, + double val); +int OSSL_PARAM_BLD_push_BN(OSSL_PARAM_BLD *bld, const char *key, + const BIGNUM *bn); +int OSSL_PARAM_BLD_push_BN_pad(OSSL_PARAM_BLD *bld, const char *key, + const BIGNUM *bn, size_t sz); +int OSSL_PARAM_BLD_push_utf8_string(OSSL_PARAM_BLD *bld, const char *key, + const char *buf, size_t bsize); +int OSSL_PARAM_BLD_push_utf8_ptr(OSSL_PARAM_BLD *bld, const char *key, + char *buf, size_t bsize); +int OSSL_PARAM_BLD_push_octet_string(OSSL_PARAM_BLD *bld, const char *key, + const void *buf, size_t bsize); +int OSSL_PARAM_BLD_push_octet_ptr(OSSL_PARAM_BLD *bld, const char *key, + void *buf, size_t bsize); + +#ifdef __cplusplus +} +#endif +#endif /* OPENSSL_PARAM_BUILD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/params.h b/VCMP-LUA/modules/postgresql/include/openssl/params.h new file mode 100644 index 0000000..6772c40 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/params.h @@ -0,0 +1,166 @@ +/* + * Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PARAMS_H +#define OPENSSL_PARAMS_H +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OSSL_PARAM_UNMODIFIED ((size_t)-1) + +#define OSSL_PARAM_END \ + { NULL, 0, NULL, 0, 0 } + +#define OSSL_PARAM_DEFN(key, type, addr, sz) \ + { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED } + +/* Basic parameter types without return sizes */ +#define OSSL_PARAM_int(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int)) +#define OSSL_PARAM_uint(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \ + sizeof(unsigned int)) +#define OSSL_PARAM_long(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(long int)) +#define OSSL_PARAM_ulong(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \ + sizeof(unsigned long int)) +#define OSSL_PARAM_int32(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int32_t)) +#define OSSL_PARAM_uint32(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \ + sizeof(uint32_t)) +#define OSSL_PARAM_int64(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int64_t)) +#define OSSL_PARAM_uint64(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \ + sizeof(uint64_t)) +#define OSSL_PARAM_size_t(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), sizeof(size_t)) +#define OSSL_PARAM_time_t(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(time_t)) +#define OSSL_PARAM_double(key, addr) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_REAL, (addr), sizeof(double)) + +#define OSSL_PARAM_BN(key, bn, sz) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (bn), (sz)) +#define OSSL_PARAM_utf8_string(key, addr, sz) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_UTF8_STRING, (addr), sz) +#define OSSL_PARAM_octet_string(key, addr, sz) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_OCTET_STRING, (addr), sz) + +#define OSSL_PARAM_utf8_ptr(key, addr, sz) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_UTF8_PTR, (addr), sz) +#define OSSL_PARAM_octet_ptr(key, addr, sz) \ + OSSL_PARAM_DEFN((key), OSSL_PARAM_OCTET_PTR, (addr), sz) + +/* Search an OSSL_PARAM array for a matching name */ +OSSL_PARAM *OSSL_PARAM_locate(OSSL_PARAM *p, const char *key); +const OSSL_PARAM *OSSL_PARAM_locate_const(const OSSL_PARAM *p, const char *key); + +/* Basic parameter type run-time construction */ +OSSL_PARAM OSSL_PARAM_construct_int(const char *key, int *buf); +OSSL_PARAM OSSL_PARAM_construct_uint(const char *key, unsigned int *buf); +OSSL_PARAM OSSL_PARAM_construct_long(const char *key, long int *buf); +OSSL_PARAM OSSL_PARAM_construct_ulong(const char *key, unsigned long int *buf); +OSSL_PARAM OSSL_PARAM_construct_int32(const char *key, int32_t *buf); +OSSL_PARAM OSSL_PARAM_construct_uint32(const char *key, uint32_t *buf); +OSSL_PARAM OSSL_PARAM_construct_int64(const char *key, int64_t *buf); +OSSL_PARAM OSSL_PARAM_construct_uint64(const char *key, uint64_t *buf); +OSSL_PARAM OSSL_PARAM_construct_size_t(const char *key, size_t *buf); +OSSL_PARAM OSSL_PARAM_construct_time_t(const char *key, time_t *buf); +OSSL_PARAM OSSL_PARAM_construct_BN(const char *key, unsigned char *buf, + size_t bsize); +OSSL_PARAM OSSL_PARAM_construct_double(const char *key, double *buf); +OSSL_PARAM OSSL_PARAM_construct_utf8_string(const char *key, char *buf, + size_t bsize); +OSSL_PARAM OSSL_PARAM_construct_utf8_ptr(const char *key, char **buf, + size_t bsize); +OSSL_PARAM OSSL_PARAM_construct_octet_string(const char *key, void *buf, + size_t bsize); +OSSL_PARAM OSSL_PARAM_construct_octet_ptr(const char *key, void **buf, + size_t bsize); +OSSL_PARAM OSSL_PARAM_construct_end(void); + +int OSSL_PARAM_allocate_from_text(OSSL_PARAM *to, + const OSSL_PARAM *paramdefs, + const char *key, const char *value, + size_t value_n, int *found); + +int OSSL_PARAM_print_to_bio(const OSSL_PARAM *params, BIO *bio, + int print_values); + +int OSSL_PARAM_get_int(const OSSL_PARAM *p, int *val); +int OSSL_PARAM_get_uint(const OSSL_PARAM *p, unsigned int *val); +int OSSL_PARAM_get_long(const OSSL_PARAM *p, long int *val); +int OSSL_PARAM_get_ulong(const OSSL_PARAM *p, unsigned long int *val); +int OSSL_PARAM_get_int32(const OSSL_PARAM *p, int32_t *val); +int OSSL_PARAM_get_uint32(const OSSL_PARAM *p, uint32_t *val); +int OSSL_PARAM_get_int64(const OSSL_PARAM *p, int64_t *val); +int OSSL_PARAM_get_uint64(const OSSL_PARAM *p, uint64_t *val); +int OSSL_PARAM_get_size_t(const OSSL_PARAM *p, size_t *val); +int OSSL_PARAM_get_time_t(const OSSL_PARAM *p, time_t *val); + +int OSSL_PARAM_set_int(OSSL_PARAM *p, int val); +int OSSL_PARAM_set_uint(OSSL_PARAM *p, unsigned int val); +int OSSL_PARAM_set_long(OSSL_PARAM *p, long int val); +int OSSL_PARAM_set_ulong(OSSL_PARAM *p, unsigned long int val); +int OSSL_PARAM_set_int32(OSSL_PARAM *p, int32_t val); +int OSSL_PARAM_set_uint32(OSSL_PARAM *p, uint32_t val); +int OSSL_PARAM_set_int64(OSSL_PARAM *p, int64_t val); +int OSSL_PARAM_set_uint64(OSSL_PARAM *p, uint64_t val); +int OSSL_PARAM_set_size_t(OSSL_PARAM *p, size_t val); +int OSSL_PARAM_set_time_t(OSSL_PARAM *p, time_t val); + +int OSSL_PARAM_get_double(const OSSL_PARAM *p, double *val); +int OSSL_PARAM_set_double(OSSL_PARAM *p, double val); + +int OSSL_PARAM_get_BN(const OSSL_PARAM *p, BIGNUM **val); +int OSSL_PARAM_set_BN(OSSL_PARAM *p, const BIGNUM *val); + +int OSSL_PARAM_get_utf8_string(const OSSL_PARAM *p, char **val, size_t max_len); +int OSSL_PARAM_set_utf8_string(OSSL_PARAM *p, const char *val); + +int OSSL_PARAM_get_octet_string(const OSSL_PARAM *p, void **val, size_t max_len, + size_t *used_len); +int OSSL_PARAM_set_octet_string(OSSL_PARAM *p, const void *val, size_t len); + +int OSSL_PARAM_get_utf8_ptr(const OSSL_PARAM *p, const char **val); +int OSSL_PARAM_set_utf8_ptr(OSSL_PARAM *p, const char *val); + +int OSSL_PARAM_get_octet_ptr(const OSSL_PARAM *p, const void **val, + size_t *used_len); +int OSSL_PARAM_set_octet_ptr(OSSL_PARAM *p, const void *val, + size_t used_len); + +int OSSL_PARAM_get_utf8_string_ptr(const OSSL_PARAM *p, const char **val); +int OSSL_PARAM_get_octet_string_ptr(const OSSL_PARAM *p, const void **val, + size_t *used_len); + +int OSSL_PARAM_modified(const OSSL_PARAM *p); +void OSSL_PARAM_set_all_unmodified(OSSL_PARAM *p); + +OSSL_PARAM *OSSL_PARAM_dup(const OSSL_PARAM *p); +OSSL_PARAM *OSSL_PARAM_merge(const OSSL_PARAM *p1, const OSSL_PARAM *p2); +void OSSL_PARAM_free(OSSL_PARAM *p); + +int OSSL_PARAM_set_octet_string_or_ptr(OSSL_PARAM *p, const void *val, + size_t len); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/pem.h b/VCMP-LUA/modules/postgresql/include/openssl/pem.h new file mode 100644 index 0000000..fa64aaf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/pem.h @@ -0,0 +1,548 @@ +/* + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PEM_H +#define OPENSSL_PEM_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_PEM_H +#endif + +#include +#include +#include +#include +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define PEM_BUFSIZE 1024 + +#define PEM_STRING_X509_OLD "X509 CERTIFICATE" +#define PEM_STRING_X509 "CERTIFICATE" +#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" +#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +#define PEM_STRING_X509_CRL "X509 CRL" +#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" +#define PEM_STRING_PUBLIC "PUBLIC KEY" +#define PEM_STRING_RSA "RSA PRIVATE KEY" +#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +#define PEM_STRING_DSA "DSA PRIVATE KEY" +#define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" +#define PEM_STRING_PKCS7 "PKCS7" +#define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" +#define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" +#define PEM_STRING_PKCS8INF "PRIVATE KEY" +#define PEM_STRING_DHPARAMS "DH PARAMETERS" +#define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" +#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +#define PEM_STRING_DSAPARAMS "DSA PARAMETERS" +#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" +#define PEM_STRING_ECPARAMETERS "EC PARAMETERS" +#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" +#define PEM_STRING_PARAMETERS "PARAMETERS" +#define PEM_STRING_CMS "CMS" +#define PEM_STRING_SM2PRIVATEKEY "SM2 PRIVATE KEY" +#define PEM_STRING_SM2PARAMETERS "SM2 PARAMETERS" +#define PEM_STRING_ACERT "ATTRIBUTE CERTIFICATE" + +#define PEM_TYPE_ENCRYPTED 10 +#define PEM_TYPE_MIC_ONLY 20 +#define PEM_TYPE_MIC_CLEAR 30 +#define PEM_TYPE_CLEAR 40 + +/* + * These macros make the PEM_read/PEM_write functions easier to maintain and + * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or + * IMPLEMENT_PEM_rw_cb(...) + */ + +#define PEM_read_cb_fnsig(name, type, INTYPE, readname) \ + type *PEM_##readname##_##name(INTYPE *out, type **x, \ + pem_password_cb *cb, void *u) +#define PEM_read_cb_ex_fnsig(name, type, INTYPE, readname) \ + type *PEM_##readname##_##name##_ex(INTYPE *out, type **x, \ + pem_password_cb *cb, void *u, \ + OSSL_LIB_CTX *libctx, \ + const char *propq) + +#define PEM_write_fnsig(name, type, OUTTYPE, writename) \ + int PEM_##writename##_##name(OUTTYPE *out, const type *x) +#define PEM_write_cb_fnsig(name, type, OUTTYPE, writename) \ + int PEM_##writename##_##name(OUTTYPE *out, const type *x, \ + const EVP_CIPHER *enc, \ + const unsigned char *kstr, int klen, \ + pem_password_cb *cb, void *u) +#define PEM_write_ex_fnsig(name, type, OUTTYPE, writename) \ + int PEM_##writename##_##name##_ex(OUTTYPE *out, const type *x, \ + OSSL_LIB_CTX *libctx, \ + const char *propq) +#define PEM_write_cb_ex_fnsig(name, type, OUTTYPE, writename) \ + int PEM_##writename##_##name##_ex(OUTTYPE *out, const type *x, \ + const EVP_CIPHER *enc, \ + const unsigned char *kstr, int klen, \ + pem_password_cb *cb, void *u, \ + OSSL_LIB_CTX *libctx, \ + const char *propq) + +#ifdef OPENSSL_NO_STDIO + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ +#endif +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ +#endif +#else + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ + type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str, fp, \ + (void **)x, cb, u); \ + } + +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ + PEM_write_fnsig(name, type, FILE, write) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1, str, out, \ + x, NULL, NULL, 0, NULL, NULL); \ + } + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp(name, type, str, asn1) +#endif + +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ + PEM_write_cb_fnsig(name, type, FILE, write) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1, str, out, \ + x, enc, kstr, klen, cb, u); \ + } + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) +#endif +#endif + +#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + type *PEM_read_bio_##name(BIO *bp, type **x, \ + pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str, bp, \ + (void **)x, cb, u); \ + } + +#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + PEM_write_fnsig(name, type, BIO, write_bio) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1, str, out, \ + x, NULL, NULL, 0, NULL, NULL); \ + } + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio(name, type, str, asn1) +#endif + +#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + PEM_write_cb_fnsig(name, type, BIO, write_bio) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1, str, out, \ + x, enc, kstr, klen, cb, u); \ + } + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) +#endif + +#define IMPLEMENT_PEM_write(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp(name, type, str, asn1) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) +#endif + +#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) +#endif + +#define IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_read_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write(name, type, str, asn1) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_const(name, type, str, asn1) +#endif + +#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb(name, type, str, asn1) + +/* These are the same except they are for the declarations */ + +/* + * The mysterious 'extern' that's passed to some macros is innocuous, + * and is there to quiet pre-C99 compilers that may complain about empty + * arguments in macro calls. + */ +#if defined(OPENSSL_NO_STDIO) + +#define DECLARE_PEM_read_fp_attr(attr, name, type) /**/ +#define DECLARE_PEM_read_fp_ex_attr(attr, name, type) /**/ +#define DECLARE_PEM_write_fp_attr(attr, name, type) /**/ +#define DECLARE_PEM_write_fp_ex_attr(attr, name, type) /**/ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define DECLARE_PEM_write_fp_const_attr(attr, name, type) /**/ +#endif +#define DECLARE_PEM_write_cb_fp_attr(attr, name, type) /**/ +#define DECLARE_PEM_write_cb_fp_ex_attr(attr, name, type) /**/ + +#else + +#define DECLARE_PEM_read_fp_attr(attr, name, type) \ + attr PEM_read_cb_fnsig(name, type, FILE, read); +#define DECLARE_PEM_read_fp_ex_attr(attr, name, type) \ + attr PEM_read_cb_fnsig(name, type, FILE, read); \ + attr PEM_read_cb_ex_fnsig(name, type, FILE, read); + +#define DECLARE_PEM_write_fp_attr(attr, name, type) \ + attr PEM_write_fnsig(name, type, FILE, write); +#define DECLARE_PEM_write_fp_ex_attr(attr, name, type) \ + attr PEM_write_fnsig(name, type, FILE, write); \ + attr PEM_write_ex_fnsig(name, type, FILE, write); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define DECLARE_PEM_write_fp_const_attr(attr, name, type) \ + attr PEM_write_fnsig(name, type, FILE, write); +#endif +#define DECLARE_PEM_write_cb_fp_attr(attr, name, type) \ + attr PEM_write_cb_fnsig(name, type, FILE, write); +#define DECLARE_PEM_write_cb_fp_ex_attr(attr, name, type) \ + attr PEM_write_cb_fnsig(name, type, FILE, write); \ + attr PEM_write_cb_ex_fnsig(name, type, FILE, write); + +#endif + +#define DECLARE_PEM_read_fp(name, type) \ + DECLARE_PEM_read_fp_attr(extern, name, type) +#define DECLARE_PEM_write_fp(name, type) \ + DECLARE_PEM_write_fp_attr(extern, name, type) +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define DECLARE_PEM_write_fp_const(name, type) \ + DECLARE_PEM_write_fp_const_attr(extern, name, type) +#endif +#define DECLARE_PEM_write_cb_fp(name, type) \ + DECLARE_PEM_write_cb_fp_attr(extern, name, type) + +#define DECLARE_PEM_read_bio_attr(attr, name, type) \ + attr PEM_read_cb_fnsig(name, type, BIO, read_bio); +#define DECLARE_PEM_read_bio_ex_attr(attr, name, type) \ + attr PEM_read_cb_fnsig(name, type, BIO, read_bio); \ + attr PEM_read_cb_ex_fnsig(name, type, BIO, read_bio); +#define DECLARE_PEM_read_bio(name, type) \ + DECLARE_PEM_read_bio_attr(extern, name, type) +#define DECLARE_PEM_read_bio_ex(name, type) \ + DECLARE_PEM_read_bio_ex_attr(extern, name, type) + +#define DECLARE_PEM_write_bio_attr(attr, name, type) \ + attr PEM_write_fnsig(name, type, BIO, write_bio); +#define DECLARE_PEM_write_bio_ex_attr(attr, name, type) \ + attr PEM_write_fnsig(name, type, BIO, write_bio); \ + attr PEM_write_ex_fnsig(name, type, BIO, write_bio); +#define DECLARE_PEM_write_bio(name, type) \ + DECLARE_PEM_write_bio_attr(extern, name, type) +#define DECLARE_PEM_write_bio_ex(name, type) \ + DECLARE_PEM_write_bio_ex_attr(extern, name, type) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define DECLARE_PEM_write_bio_const_attr(attr, name, type) \ + attr PEM_write_fnsig(name, type, BIO, write_bio); +#define DECLARE_PEM_write_bio_const(name, type) \ + DECLARE_PEM_write_bio_const_attr(extern, name, type) +#endif + +#define DECLARE_PEM_write_cb_bio_attr(attr, name, type) \ + attr PEM_write_cb_fnsig(name, type, BIO, write_bio); +#define DECLARE_PEM_write_cb_bio_ex_attr(attr, name, type) \ + attr PEM_write_cb_fnsig(name, type, BIO, write_bio); \ + attr PEM_write_cb_ex_fnsig(name, type, BIO, write_bio); +#define DECLARE_PEM_write_cb_bio(name, type) \ + DECLARE_PEM_write_cb_bio_attr(extern, name, type) +#define DECLARE_PEM_write_cb_ex_bio(name, type) \ + DECLARE_PEM_write_cb_bio_ex_attr(extern, name, type) + +#define DECLARE_PEM_write_attr(attr, name, type) \ + DECLARE_PEM_write_bio_attr(attr, name, type) \ + DECLARE_PEM_write_fp_attr(attr, name, type) +#define DECLARE_PEM_write_ex_attr(attr, name, type) \ + DECLARE_PEM_write_bio_ex_attr(attr, name, type) \ + DECLARE_PEM_write_fp_ex_attr(attr, name, type) +#define DECLARE_PEM_write(name, type) \ + DECLARE_PEM_write_attr(extern, name, type) +#define DECLARE_PEM_write_ex(name, type) \ + DECLARE_PEM_write_ex_attr(extern, name, type) +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define DECLARE_PEM_write_const_attr(attr, name, type) \ + DECLARE_PEM_write_bio_const_attr(attr, name, type) \ + DECLARE_PEM_write_fp_const_attr(attr, name, type) +#define DECLARE_PEM_write_const(name, type) \ + DECLARE_PEM_write_const_attr(extern, name, type) +#endif +#define DECLARE_PEM_write_cb_attr(attr, name, type) \ + DECLARE_PEM_write_cb_bio_attr(attr, name, type) \ + DECLARE_PEM_write_cb_fp_attr(attr, name, type) +#define DECLARE_PEM_write_cb_ex_attr(attr, name, type) \ + DECLARE_PEM_write_cb_bio_ex_attr(attr, name, type) \ + DECLARE_PEM_write_cb_fp_ex_attr(attr, name, type) +#define DECLARE_PEM_write_cb(name, type) \ + DECLARE_PEM_write_cb_attr(extern, name, type) +#define DECLARE_PEM_write_cb_ex(name, type) \ + DECLARE_PEM_write_cb_ex_attr(extern, name, type) +#define DECLARE_PEM_read_attr(attr, name, type) \ + DECLARE_PEM_read_bio_attr(attr, name, type) \ + DECLARE_PEM_read_fp_attr(attr, name, type) +#define DECLARE_PEM_read_ex_attr(attr, name, type) \ + DECLARE_PEM_read_bio_ex_attr(attr, name, type) \ + DECLARE_PEM_read_fp_ex_attr(attr, name, type) +#define DECLARE_PEM_read(name, type) \ + DECLARE_PEM_read_attr(extern, name, type) +#define DECLARE_PEM_read_ex(name, type) \ + DECLARE_PEM_read_ex_attr(extern, name, type) +#define DECLARE_PEM_rw_attr(attr, name, type) \ + DECLARE_PEM_read_attr(attr, name, type) \ + DECLARE_PEM_write_attr(attr, name, type) +#define DECLARE_PEM_rw_ex_attr(attr, name, type) \ + DECLARE_PEM_read_ex_attr(attr, name, type) \ + DECLARE_PEM_write_ex_attr(attr, name, type) +#define DECLARE_PEM_rw(name, type) \ + DECLARE_PEM_rw_attr(extern, name, type) +#define DECLARE_PEM_rw_ex(name, type) \ + DECLARE_PEM_rw_ex_attr(extern, name, type) +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define DECLARE_PEM_rw_const_attr(attr, name, type) \ + DECLARE_PEM_read_attr(attr, name, type) \ + DECLARE_PEM_write_const_attr(attr, name, type) +#define DECLARE_PEM_rw_const(name, type) \ + DECLARE_PEM_rw_const_attr(extern, name, type) +#endif +#define DECLARE_PEM_rw_cb_attr(attr, name, type) \ + DECLARE_PEM_read_attr(attr, name, type) \ + DECLARE_PEM_write_cb_attr(attr, name, type) +#define DECLARE_PEM_rw_cb_ex_attr(attr, name, type) \ + DECLARE_PEM_read_ex_attr(attr, name, type) \ + DECLARE_PEM_write_cb_ex_attr(attr, name, type) +#define DECLARE_PEM_rw_cb(name, type) \ + DECLARE_PEM_rw_cb_attr(extern, name, type) +#define DECLARE_PEM_rw_cb_ex(name, type) \ + DECLARE_PEM_rw_cb_ex_attr(extern, name, type) + +int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); +int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, + pem_password_cb *callback, void *u); + +int PEM_read_bio(BIO *bp, char **name, char **header, + unsigned char **data, long *len); +#define PEM_FLAG_SECURE 0x1 +#define PEM_FLAG_EAY_COMPATIBLE 0x2 +#define PEM_FLAG_ONLY_B64 0x4 +int PEM_read_bio_ex(BIO *bp, char **name, char **header, + unsigned char **data, long *len, unsigned int flags); +int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, + const char *name, BIO *bp, pem_password_cb *cb, + void *u); +int PEM_write_bio(BIO *bp, const char *name, const char *hdr, + const unsigned char *data, long len); +int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, + const char *name, BIO *bp, pem_password_cb *cb, + void *u); +void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, + const void *x, const EVP_CIPHER *enc, + const unsigned char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_ASN1_write_bio_ctx(OSSL_i2d_of_void_ctx *i2d, void *vctx, + const char *name, BIO *bp, const void *x, + const EVP_CIPHER *enc, const unsigned char *kstr, + int klen, pem_password_cb *cb, void *u); + +STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +STACK_OF(X509_INFO) +*PEM_X509_INFO_read_bio_ex(BIO *bp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u, OSSL_LIB_CTX *libctx, + const char *propq); + +int PEM_X509_INFO_write_bio(BIO *bp, const X509_INFO *xi, EVP_CIPHER *enc, + const unsigned char *kstr, int klen, + pem_password_cb *cd, void *u); + +#ifndef OPENSSL_NO_STDIO +int PEM_read(FILE *fp, char **name, char **header, + unsigned char **data, long *len); +int PEM_write(FILE *fp, const char *name, const char *hdr, + const unsigned char *data, long len); +void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, + const void *x, const EVP_CIPHER *enc, + const unsigned char *kstr, int klen, + pem_password_cb *callback, void *u); +STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +STACK_OF(X509_INFO) +*PEM_X509_INFO_read_ex(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, + void *u, OSSL_LIB_CTX *libctx, const char *propq); +#endif + +int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); +int PEM_SignUpdate(EVP_MD_CTX *ctx, const unsigned char *d, unsigned int cnt); +int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, EVP_PKEY *pkey); + +/* The default pem_password_cb that's used internally */ +int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); +void PEM_proc_type(char *buf, int type); +void PEM_dek_info(char *buf, const char *type, int len, const char *str); + +#include + +DECLARE_PEM_rw(X509, X509) +DECLARE_PEM_rw(X509_AUX, X509) +DECLARE_PEM_rw(X509_REQ, X509_REQ) +DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) +DECLARE_PEM_rw(X509_CRL, X509_CRL) +DECLARE_PEM_rw(X509_PUBKEY, X509_PUBKEY) +DECLARE_PEM_rw(PKCS7, PKCS7) +DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) +DECLARE_PEM_rw(PKCS8, X509_SIG) +DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) +#ifndef OPENSSL_NO_DEPRECATED_3_0 +DECLARE_PEM_rw_cb_attr(OSSL_DEPRECATEDIN_3_0, RSAPrivateKey, RSA) +DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, RSAPublicKey, RSA) +DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, RSA_PUBKEY, RSA) +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_DSA +DECLARE_PEM_rw_cb_attr(OSSL_DEPRECATEDIN_3_0, DSAPrivateKey, DSA) +DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, DSA_PUBKEY, DSA) +DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, DSAparams, DSA) +#endif +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_EC +DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, ECPKParameters, EC_GROUP) +DECLARE_PEM_rw_cb_attr(OSSL_DEPRECATEDIN_3_0, ECPrivateKey, EC_KEY) +DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, EC_PUBKEY, EC_KEY) +#endif +#endif + +#ifndef OPENSSL_NO_DH +#ifndef OPENSSL_NO_DEPRECATED_3_0 +DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, DHparams, DH) +DECLARE_PEM_write_attr(OSSL_DEPRECATEDIN_3_0, DHxparams, DH) +#endif +#endif +DECLARE_PEM_rw_cb_ex(PrivateKey, EVP_PKEY) +DECLARE_PEM_rw_ex(PUBKEY, EVP_PKEY) + +int PEM_write_bio_PrivateKey_traditional(BIO *bp, const EVP_PKEY *x, + const EVP_CIPHER *enc, + const unsigned char *kstr, int klen, + pem_password_cb *cb, void *u); + +/* Why do these take a signed char *kstr? */ +int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, const EVP_PKEY *x, int nid, + const char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_bio_PKCS8PrivateKey(BIO *, const EVP_PKEY *, const EVP_CIPHER *, + const char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_bio(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc, + const char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, const EVP_PKEY *x, int nid, + const char *kstr, int klen, + pem_password_cb *cb, void *u); +EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, + void *u); + +#ifndef OPENSSL_NO_STDIO +int i2d_PKCS8PrivateKey_fp(FILE *fp, const EVP_PKEY *x, const EVP_CIPHER *enc, + const char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, const EVP_PKEY *x, int nid, + const char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_PKCS8PrivateKey_nid(FILE *fp, const EVP_PKEY *x, int nid, + const char *kstr, int klen, + pem_password_cb *cb, void *u); + +EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, + void *u); + +int PEM_write_PKCS8PrivateKey(FILE *fp, const EVP_PKEY *x, const EVP_CIPHER *enc, + const char *kstr, int klen, + pem_password_cb *cd, void *u); +#endif +EVP_PKEY *PEM_read_bio_Parameters_ex(BIO *bp, EVP_PKEY **x, + OSSL_LIB_CTX *libctx, const char *propq); +EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); +int PEM_write_bio_Parameters(BIO *bp, const EVP_PKEY *x); + +EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); +EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); +EVP_PKEY *b2i_PrivateKey_bio(BIO *in); +EVP_PKEY *b2i_PublicKey_bio(BIO *in); +int i2b_PrivateKey_bio(BIO *out, const EVP_PKEY *pk); +int i2b_PublicKey_bio(BIO *out, const EVP_PKEY *pk); +EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); +EVP_PKEY *b2i_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u, + OSSL_LIB_CTX *libctx, const char *propq); +int i2b_PVK_bio(BIO *out, const EVP_PKEY *pk, int enclevel, + pem_password_cb *cb, void *u); +int i2b_PVK_bio_ex(BIO *out, const EVP_PKEY *pk, int enclevel, + pem_password_cb *cb, void *u, + OSSL_LIB_CTX *libctx, const char *propq); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/pem2.h b/VCMP-LUA/modules/postgresql/include/openssl/pem2.h new file mode 100644 index 0000000..6d3ab2a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/pem2.h @@ -0,0 +1,19 @@ +/* + * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PEM2_H +#define OPENSSL_PEM2_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_PEM2_H +#endif +#include +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/pemerr.h b/VCMP-LUA/modules/postgresql/include/openssl/pemerr.h new file mode 100644 index 0000000..eb3c9a1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/pemerr.h @@ -0,0 +1,57 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PEMERR_H +#define OPENSSL_PEMERR_H +#pragma once + +#include +#include +#include + +/* + * PEM reason codes. + */ +#define PEM_R_BAD_BASE64_DECODE 100 +#define PEM_R_BAD_DECRYPT 101 +#define PEM_R_BAD_END_LINE 102 +#define PEM_R_BAD_IV_CHARS 103 +#define PEM_R_BAD_MAGIC_NUMBER 116 +#define PEM_R_BAD_PASSWORD_READ 104 +#define PEM_R_BAD_VERSION_NUMBER 117 +#define PEM_R_BIO_WRITE_FAILURE 118 +#define PEM_R_CIPHER_IS_NULL 127 +#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 +#define PEM_R_EXPECTING_DSS_KEY_BLOB 131 +#define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 +#define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 +#define PEM_R_EXPECTING_RSA_KEY_BLOB 132 +#define PEM_R_HEADER_TOO_LONG 128 +#define PEM_R_INCONSISTENT_HEADER 121 +#define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 +#define PEM_R_KEYBLOB_TOO_SHORT 123 +#define PEM_R_MISSING_DEK_IV 129 +#define PEM_R_NOT_DEK_INFO 105 +#define PEM_R_NOT_ENCRYPTED 106 +#define PEM_R_NOT_PROC_TYPE 107 +#define PEM_R_NO_START_LINE 108 +#define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +#define PEM_R_PVK_DATA_TOO_SHORT 124 +#define PEM_R_PVK_TOO_SHORT 125 +#define PEM_R_READ_KEY 111 +#define PEM_R_SHORT_HEADER 112 +#define PEM_R_UNEXPECTED_DEK_IV 130 +#define PEM_R_UNSUPPORTED_CIPHER 113 +#define PEM_R_UNSUPPORTED_ENCRYPTION 114 +#define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 +#define PEM_R_UNSUPPORTED_PUBLIC_KEY_TYPE 110 +#define PEM_R_UNSUPPORTED_PVK_KEY_TYPE 133 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/pkcs12.h b/VCMP-LUA/modules/postgresql/include/openssl/pkcs12.h new file mode 100644 index 0000000..e970b5e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/pkcs12.h @@ -0,0 +1,376 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\pkcs12.h.in + * + * Copyright 1999-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_PKCS12_H +#define OPENSSL_PKCS12_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_PKCS12_H +#endif + +#include +#include +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define PKCS12_KEY_ID 1 +#define PKCS12_IV_ID 2 +#define PKCS12_MAC_ID 3 + +/* Default iteration count */ +#ifndef PKCS12_DEFAULT_ITER +#define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER +#endif + +#define PKCS12_MAC_KEY_LENGTH 20 + +/* + * The macro is expected to be used only internally. Kept for + * backwards compatibility. NIST requires 16, previous value was + * 8. Allow to override this at compile time. + */ +#ifndef PKCS12_SALT_LEN +#define PKCS12_SALT_LEN 16 +#endif + +/* It's not clear if these are actually needed... */ +#define PKCS12_key_gen PKCS12_key_gen_utf8 +#define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8 + +/* MS key usage constants */ + +#define KEY_EX 0x10 +#define KEY_SIG 0x80 + +typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; + +typedef struct PKCS12_st PKCS12; + +typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(PKCS12_SAFEBAG, PKCS12_SAFEBAG, PKCS12_SAFEBAG) +#define sk_PKCS12_SAFEBAG_num(sk) OPENSSL_sk_num(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk)) +#define sk_PKCS12_SAFEBAG_value(sk, idx) ((PKCS12_SAFEBAG *)OPENSSL_sk_value(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk), (idx))) +#define sk_PKCS12_SAFEBAG_new(cmp) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_new(ossl_check_PKCS12_SAFEBAG_compfunc_type(cmp))) +#define sk_PKCS12_SAFEBAG_new_null() ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_new_null()) +#define sk_PKCS12_SAFEBAG_new_reserve(cmp, n) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_new_reserve(ossl_check_PKCS12_SAFEBAG_compfunc_type(cmp), (n))) +#define sk_PKCS12_SAFEBAG_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PKCS12_SAFEBAG_sk_type(sk), (n)) +#define sk_PKCS12_SAFEBAG_free(sk) OPENSSL_sk_free(ossl_check_PKCS12_SAFEBAG_sk_type(sk)) +#define sk_PKCS12_SAFEBAG_zero(sk) OPENSSL_sk_zero(ossl_check_PKCS12_SAFEBAG_sk_type(sk)) +#define sk_PKCS12_SAFEBAG_delete(sk, i) ((PKCS12_SAFEBAG *)OPENSSL_sk_delete(ossl_check_PKCS12_SAFEBAG_sk_type(sk), (i))) +#define sk_PKCS12_SAFEBAG_delete_ptr(sk, ptr) ((PKCS12_SAFEBAG *)OPENSSL_sk_delete_ptr(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr))) +#define sk_PKCS12_SAFEBAG_push(sk, ptr) OPENSSL_sk_push(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr)) +#define sk_PKCS12_SAFEBAG_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr)) +#define sk_PKCS12_SAFEBAG_pop(sk) ((PKCS12_SAFEBAG *)OPENSSL_sk_pop(ossl_check_PKCS12_SAFEBAG_sk_type(sk))) +#define sk_PKCS12_SAFEBAG_shift(sk) ((PKCS12_SAFEBAG *)OPENSSL_sk_shift(ossl_check_PKCS12_SAFEBAG_sk_type(sk))) +#define sk_PKCS12_SAFEBAG_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_freefunc_type(freefunc)) +#define sk_PKCS12_SAFEBAG_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr), (idx)) +#define sk_PKCS12_SAFEBAG_set(sk, idx, ptr) ((PKCS12_SAFEBAG *)OPENSSL_sk_set(ossl_check_PKCS12_SAFEBAG_sk_type(sk), (idx), ossl_check_PKCS12_SAFEBAG_type(ptr))) +#define sk_PKCS12_SAFEBAG_find(sk, ptr) OPENSSL_sk_find(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr)) +#define sk_PKCS12_SAFEBAG_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr)) +#define sk_PKCS12_SAFEBAG_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr), pnum) +#define sk_PKCS12_SAFEBAG_sort(sk) OPENSSL_sk_sort(ossl_check_PKCS12_SAFEBAG_sk_type(sk)) +#define sk_PKCS12_SAFEBAG_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk)) +#define sk_PKCS12_SAFEBAG_dup(sk) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_dup(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk))) +#define sk_PKCS12_SAFEBAG_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_deep_copy(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_copyfunc_type(copyfunc), ossl_check_PKCS12_SAFEBAG_freefunc_type(freefunc))) +#define sk_PKCS12_SAFEBAG_set_cmp_func(sk, cmp) ((sk_PKCS12_SAFEBAG_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct pkcs12_bag_st PKCS12_BAGS; + +#define PKCS12_ERROR 0 +#define PKCS12_OK 1 + +/* Compatibility macros */ + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 + +#define M_PKCS12_bag_type PKCS12_bag_type +#define M_PKCS12_cert_bag_type PKCS12_cert_bag_type +#define M_PKCS12_crl_bag_type PKCS12_cert_bag_type + +#define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert +#define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl +#define PKCS12_bag_type PKCS12_SAFEBAG_get_nid +#define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid +#define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert +#define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl +#define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf +#define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt + +#endif +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, + int attr_nid); +#endif + +ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid); +int PKCS12_mac_present(const PKCS12 *p12); +void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, + const X509_ALGOR **pmacalg, + const ASN1_OCTET_STRING **psalt, + const ASN1_INTEGER **piter, + const PKCS12 *p12); + +const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, + int attr_nid); +const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); +int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag); +int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag); +const ASN1_TYPE *PKCS12_SAFEBAG_get0_bag_obj(const PKCS12_SAFEBAG *bag); +const ASN1_OBJECT *PKCS12_SAFEBAG_get0_bag_type(const PKCS12_SAFEBAG *bag); + +X509 *PKCS12_SAFEBAG_get1_cert_ex(const PKCS12_SAFEBAG *bag, OSSL_LIB_CTX *libctx, const char *propq); +X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag); +X509_CRL *PKCS12_SAFEBAG_get1_crl_ex(const PKCS12_SAFEBAG *bag, OSSL_LIB_CTX *libctx, const char *propq); +X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag); +const STACK_OF(PKCS12_SAFEBAG) * +PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); +const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag); +const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag); + +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype, const unsigned char *value, int len); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, + const char *pass, + int passlen, + unsigned char *salt, + int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8inf); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(int pbe_nid, + const char *pass, + int passlen, + unsigned char *salt, + int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8inf, + OSSL_LIB_CTX *ctx, + const char *propq); + +PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, + int nid1, int nid2); +PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, + int passlen); +PKCS8_PRIV_KEY_INFO *PKCS8_decrypt_ex(const X509_SIG *p8, const char *pass, + int passlen, OSSL_LIB_CTX *ctx, + const char *propq); +PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag, + const char *pass, int passlen); +PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey_ex(const PKCS12_SAFEBAG *bag, + const char *pass, int passlen, + OSSL_LIB_CTX *ctx, + const char *propq); +X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int passlen, unsigned char *salt, + int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); +X509_SIG *PKCS8_encrypt_ex(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int passlen, unsigned char *salt, + int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8, + OSSL_LIB_CTX *ctx, const char *propq); +X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen, + PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe); +X509_SIG *PKCS8_set0_pbe_ex(const char *pass, int passlen, + PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe, + OSSL_LIB_CTX *ctx, const char *propq); +PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); +PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + STACK_OF(PKCS12_SAFEBAG) *bags); +PKCS7 *PKCS12_pack_p7encdata_ex(int pbe_nid, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + STACK_OF(PKCS12_SAFEBAG) *bags, + OSSL_LIB_CTX *ctx, const char *propq); + +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, + int passlen); + +int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); +STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12); + +int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, + int namelen); +int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, + const unsigned char *name, int namelen); +int PKCS12_add1_attr_by_NID(PKCS12_SAFEBAG *bag, int nid, int type, + const unsigned char *bytes, int len); +int PKCS12_add1_attr_by_txt(PKCS12_SAFEBAG *bag, const char *attrname, int type, + const unsigned char *bytes, int len); +int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); +ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, + int attr_nid); +char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); +const STACK_OF(X509_ATTRIBUTE) * +PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag); +void PKCS12_SAFEBAG_set0_attrs(PKCS12_SAFEBAG *bag, STACK_OF(X509_ATTRIBUTE) *attrs); +unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, + const char *pass, int passlen, + const unsigned char *in, int inlen, + unsigned char **data, int *datalen, + int en_de); +unsigned char *PKCS12_pbe_crypt_ex(const X509_ALGOR *algor, + const char *pass, int passlen, + const unsigned char *in, int inlen, + unsigned char **data, int *datalen, + int en_de, OSSL_LIB_CTX *libctx, + const char *propq); +void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, + const char *pass, int passlen, + const ASN1_OCTET_STRING *oct, int zbuf); +void *PKCS12_item_decrypt_d2i_ex(const X509_ALGOR *algor, const ASN1_ITEM *it, + const char *pass, int passlen, + const ASN1_OCTET_STRING *oct, int zbuf, + OSSL_LIB_CTX *libctx, + const char *propq); +ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, + const ASN1_ITEM *it, + const char *pass, int passlen, + void *obj, int zbuf); +ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt_ex(X509_ALGOR *algor, + const ASN1_ITEM *it, + const char *pass, int passlen, + void *obj, int zbuf, + OSSL_LIB_CTX *ctx, + const char *propq); +PKCS12 *PKCS12_init(int mode); +PKCS12 *PKCS12_init_ex(int mode, OSSL_LIB_CTX *ctx, const char *propq); + +int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_asc_ex(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type, + OSSL_LIB_CTX *ctx, const char *propq); +int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_uni_ex(unsigned char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type, + OSSL_LIB_CTX *ctx, const char *propq); +int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_utf8_ex(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type, + OSSL_LIB_CTX *ctx, const char *propq); + +int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md_type, int en_de); +int PKCS12_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md_type, int en_de, + OSSL_LIB_CTX *libctx, const char *propq); +int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *mac, unsigned int *maclen); +int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); +int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + const EVP_MD *md_type); +int PKCS12_set_pbmac1_pbkdf2(PKCS12 *p12, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + const EVP_MD *md_type, const char *prf_md_name); +int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, + int saltlen, const EVP_MD *md_type); +unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, + unsigned char **uni, int *unilen); +char *OPENSSL_uni2asc(const unsigned char *uni, int unilen); +unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, + unsigned char **uni, int *unilen); +char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen); + +DECLARE_ASN1_FUNCTIONS(PKCS12) +DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) +DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) +DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) + +DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) +DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) + +void PKCS12_PBE_add(void); +int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, + STACK_OF(X509) **ca); +typedef int PKCS12_create_cb(PKCS12_SAFEBAG *bag, void *cbarg); +PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, + X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, + int iter, int mac_iter, int keytype); +PKCS12 *PKCS12_create_ex(const char *pass, const char *name, EVP_PKEY *pkey, + X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, + int iter, int mac_iter, int keytype, + OSSL_LIB_CTX *ctx, const char *propq); +PKCS12 *PKCS12_create_ex2(const char *pass, const char *name, EVP_PKEY *pkey, + X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, + int iter, int mac_iter, int keytype, + OSSL_LIB_CTX *ctx, const char *propq, + PKCS12_create_cb *cb, void *cbarg); + +PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); +PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, + EVP_PKEY *key, int key_usage, int iter, + int key_nid, const char *pass); +PKCS12_SAFEBAG *PKCS12_add_key_ex(STACK_OF(PKCS12_SAFEBAG) **pbags, + EVP_PKEY *key, int key_usage, int iter, + int key_nid, const char *pass, + OSSL_LIB_CTX *ctx, const char *propq); + +PKCS12_SAFEBAG *PKCS12_add_secret(STACK_OF(PKCS12_SAFEBAG) **pbags, + int nid_type, const unsigned char *value, int len); +int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, + int safe_nid, int iter, const char *pass); +int PKCS12_add_safe_ex(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, + int safe_nid, int iter, const char *pass, + OSSL_LIB_CTX *ctx, const char *propq); + +PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); +PKCS12 *PKCS12_add_safes_ex(STACK_OF(PKCS7) *safes, int p7_nid, + OSSL_LIB_CTX *ctx, const char *propq); + +int i2d_PKCS12_bio(BIO *bp, const PKCS12 *p12); +#ifndef OPENSSL_NO_STDIO +int i2d_PKCS12_fp(FILE *fp, const PKCS12 *p12); +#endif +PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); +#ifndef OPENSSL_NO_STDIO +PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); +#endif +int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/pkcs12err.h b/VCMP-LUA/modules/postgresql/include/openssl/pkcs12err.h new file mode 100644 index 0000000..2ad38f8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/pkcs12err.h @@ -0,0 +1,44 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PKCS12ERR_H +#define OPENSSL_PKCS12ERR_H +#pragma once + +#include +#include +#include + +/* + * PKCS12 reason codes. + */ +#define PKCS12_R_CALLBACK_FAILED 115 +#define PKCS12_R_CANT_PACK_STRUCTURE 100 +#define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 +#define PKCS12_R_DECODE_ERROR 101 +#define PKCS12_R_ENCODE_ERROR 102 +#define PKCS12_R_ENCRYPT_ERROR 103 +#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 +#define PKCS12_R_INVALID_NULL_ARGUMENT 104 +#define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 +#define PKCS12_R_INVALID_TYPE 112 +#define PKCS12_R_IV_GEN_ERROR 106 +#define PKCS12_R_KEY_GEN_ERROR 107 +#define PKCS12_R_MAC_ABSENT 108 +#define PKCS12_R_MAC_GENERATION_ERROR 109 +#define PKCS12_R_MAC_SETUP_ERROR 110 +#define PKCS12_R_MAC_STRING_SET_ERROR 111 +#define PKCS12_R_MAC_VERIFY_FAILURE 113 +#define PKCS12_R_PARSE_ERROR 114 +#define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 +#define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 +#define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/pkcs7.h b/VCMP-LUA/modules/postgresql/include/openssl/pkcs7.h new file mode 100644 index 0000000..46158d5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/pkcs7.h @@ -0,0 +1,435 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\pkcs7.h.in + * + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_PKCS7_H +#define OPENSSL_PKCS7_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_PKCS7_H +#endif + +#include +#include +#include + +#include +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*- +Encryption_ID DES-CBC +Digest_ID MD5 +Digest_Encryption_ID rsaEncryption +Key_Encryption_ID rsaEncryption +*/ + +typedef struct PKCS7_CTX_st { + OSSL_LIB_CTX *libctx; + char *propq; +} PKCS7_CTX; + +typedef struct pkcs7_issuer_and_serial_st { + X509_NAME *issuer; + ASN1_INTEGER *serial; +} PKCS7_ISSUER_AND_SERIAL; + +typedef struct pkcs7_signer_info_st { + ASN1_INTEGER *version; /* version 1 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *digest_alg; + STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ + X509_ALGOR *digest_enc_alg; /* confusing name, actually used for signing */ + ASN1_OCTET_STRING *enc_digest; /* confusing name, actually signature */ + STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ + /* The private key to sign with */ + EVP_PKEY *pkey; + const PKCS7_CTX *ctx; +} PKCS7_SIGNER_INFO; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(PKCS7_SIGNER_INFO, PKCS7_SIGNER_INFO, PKCS7_SIGNER_INFO) +#define sk_PKCS7_SIGNER_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk)) +#define sk_PKCS7_SIGNER_INFO_value(sk, idx) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_value(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk), (idx))) +#define sk_PKCS7_SIGNER_INFO_new(cmp) ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_new(ossl_check_PKCS7_SIGNER_INFO_compfunc_type(cmp))) +#define sk_PKCS7_SIGNER_INFO_new_null() ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_new_null()) +#define sk_PKCS7_SIGNER_INFO_new_reserve(cmp, n) ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_new_reserve(ossl_check_PKCS7_SIGNER_INFO_compfunc_type(cmp), (n))) +#define sk_PKCS7_SIGNER_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), (n)) +#define sk_PKCS7_SIGNER_INFO_free(sk) OPENSSL_sk_free(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk)) +#define sk_PKCS7_SIGNER_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk)) +#define sk_PKCS7_SIGNER_INFO_delete(sk, i) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_delete(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), (i))) +#define sk_PKCS7_SIGNER_INFO_delete_ptr(sk, ptr) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_delete_ptr(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr))) +#define sk_PKCS7_SIGNER_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr)) +#define sk_PKCS7_SIGNER_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr)) +#define sk_PKCS7_SIGNER_INFO_pop(sk) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_pop(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk))) +#define sk_PKCS7_SIGNER_INFO_shift(sk) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_shift(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk))) +#define sk_PKCS7_SIGNER_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_freefunc_type(freefunc)) +#define sk_PKCS7_SIGNER_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr), (idx)) +#define sk_PKCS7_SIGNER_INFO_set(sk, idx, ptr) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_set(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), (idx), ossl_check_PKCS7_SIGNER_INFO_type(ptr))) +#define sk_PKCS7_SIGNER_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr)) +#define sk_PKCS7_SIGNER_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr)) +#define sk_PKCS7_SIGNER_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr), pnum) +#define sk_PKCS7_SIGNER_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk)) +#define sk_PKCS7_SIGNER_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk)) +#define sk_PKCS7_SIGNER_INFO_dup(sk) ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_dup(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk))) +#define sk_PKCS7_SIGNER_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_copyfunc_type(copyfunc), ossl_check_PKCS7_SIGNER_INFO_freefunc_type(freefunc))) +#define sk_PKCS7_SIGNER_INFO_set_cmp_func(sk, cmp) ((sk_PKCS7_SIGNER_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct pkcs7_recip_info_st { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *key_enc_algor; + ASN1_OCTET_STRING *enc_key; + X509 *cert; /* get the pub-key from this */ + const PKCS7_CTX *ctx; +} PKCS7_RECIP_INFO; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(PKCS7_RECIP_INFO, PKCS7_RECIP_INFO, PKCS7_RECIP_INFO) +#define sk_PKCS7_RECIP_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk)) +#define sk_PKCS7_RECIP_INFO_value(sk, idx) ((PKCS7_RECIP_INFO *)OPENSSL_sk_value(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk), (idx))) +#define sk_PKCS7_RECIP_INFO_new(cmp) ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_new(ossl_check_PKCS7_RECIP_INFO_compfunc_type(cmp))) +#define sk_PKCS7_RECIP_INFO_new_null() ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_new_null()) +#define sk_PKCS7_RECIP_INFO_new_reserve(cmp, n) ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_new_reserve(ossl_check_PKCS7_RECIP_INFO_compfunc_type(cmp), (n))) +#define sk_PKCS7_RECIP_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), (n)) +#define sk_PKCS7_RECIP_INFO_free(sk) OPENSSL_sk_free(ossl_check_PKCS7_RECIP_INFO_sk_type(sk)) +#define sk_PKCS7_RECIP_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_PKCS7_RECIP_INFO_sk_type(sk)) +#define sk_PKCS7_RECIP_INFO_delete(sk, i) ((PKCS7_RECIP_INFO *)OPENSSL_sk_delete(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), (i))) +#define sk_PKCS7_RECIP_INFO_delete_ptr(sk, ptr) ((PKCS7_RECIP_INFO *)OPENSSL_sk_delete_ptr(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr))) +#define sk_PKCS7_RECIP_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr)) +#define sk_PKCS7_RECIP_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr)) +#define sk_PKCS7_RECIP_INFO_pop(sk) ((PKCS7_RECIP_INFO *)OPENSSL_sk_pop(ossl_check_PKCS7_RECIP_INFO_sk_type(sk))) +#define sk_PKCS7_RECIP_INFO_shift(sk) ((PKCS7_RECIP_INFO *)OPENSSL_sk_shift(ossl_check_PKCS7_RECIP_INFO_sk_type(sk))) +#define sk_PKCS7_RECIP_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_freefunc_type(freefunc)) +#define sk_PKCS7_RECIP_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr), (idx)) +#define sk_PKCS7_RECIP_INFO_set(sk, idx, ptr) ((PKCS7_RECIP_INFO *)OPENSSL_sk_set(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), (idx), ossl_check_PKCS7_RECIP_INFO_type(ptr))) +#define sk_PKCS7_RECIP_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr)) +#define sk_PKCS7_RECIP_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr)) +#define sk_PKCS7_RECIP_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr), pnum) +#define sk_PKCS7_RECIP_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_PKCS7_RECIP_INFO_sk_type(sk)) +#define sk_PKCS7_RECIP_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk)) +#define sk_PKCS7_RECIP_INFO_dup(sk) ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_dup(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk))) +#define sk_PKCS7_RECIP_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_copyfunc_type(copyfunc), ossl_check_PKCS7_RECIP_INFO_freefunc_type(freefunc))) +#define sk_PKCS7_RECIP_INFO_set_cmp_func(sk, cmp) ((sk_PKCS7_RECIP_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct pkcs7_signed_st { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ /* name should be 'certificates' */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ /* name should be 'crls' */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + struct pkcs7_st *contents; +} PKCS7_SIGNED; +/* + * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about + * merging the two + */ + +typedef struct pkcs7_enc_content_st { + ASN1_OBJECT *content_type; + X509_ALGOR *algorithm; + ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ + const EVP_CIPHER *cipher; + const PKCS7_CTX *ctx; +} PKCS7_ENC_CONTENT; + +typedef struct pkcs7_enveloped_st { + ASN1_INTEGER *version; /* version 0 */ + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; + PKCS7_ENC_CONTENT *enc_data; +} PKCS7_ENVELOPE; + +typedef struct pkcs7_signedandenveloped_st { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ /* name should be 'certificates' */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ /* name should be 'crls' */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + PKCS7_ENC_CONTENT *enc_data; + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; +} PKCS7_SIGN_ENVELOPE; + +typedef struct pkcs7_digest_st { + ASN1_INTEGER *version; /* version 0 */ + X509_ALGOR *md; /* md used */ + struct pkcs7_st *contents; + ASN1_OCTET_STRING *digest; +} PKCS7_DIGEST; + +typedef struct pkcs7_encrypted_st { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ENC_CONTENT *enc_data; +} PKCS7_ENCRYPT; + +typedef struct pkcs7_st { + /* + * The following is non NULL if it contains ASN1 encoding of this + * structure + */ + unsigned char *asn1; + long length; +#define PKCS7_S_HEADER 0 +#define PKCS7_S_BODY 1 +#define PKCS7_S_TAIL 2 + int state; /* used during processing */ + int detached; + ASN1_OBJECT *type; + /* content as defined by the type */ + /* + * all encryption/message digests are applied to the 'contents', leaving + * out the 'type' field. + */ + union { + char *ptr; + /* NID_pkcs7_data */ + ASN1_OCTET_STRING *data; + /* NID_pkcs7_signed */ + PKCS7_SIGNED *sign; /* field name 'signed' would clash with C keyword */ + /* NID_pkcs7_enveloped */ + PKCS7_ENVELOPE *enveloped; + /* NID_pkcs7_signedAndEnveloped */ + PKCS7_SIGN_ENVELOPE *signed_and_enveloped; + /* NID_pkcs7_digest */ + PKCS7_DIGEST *digest; + /* NID_pkcs7_encrypted */ + PKCS7_ENCRYPT *encrypted; + /* Anything else */ + ASN1_TYPE *other; + } d; + PKCS7_CTX ctx; +} PKCS7; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(PKCS7, PKCS7, PKCS7) +#define sk_PKCS7_num(sk) OPENSSL_sk_num(ossl_check_const_PKCS7_sk_type(sk)) +#define sk_PKCS7_value(sk, idx) ((PKCS7 *)OPENSSL_sk_value(ossl_check_const_PKCS7_sk_type(sk), (idx))) +#define sk_PKCS7_new(cmp) ((STACK_OF(PKCS7) *)OPENSSL_sk_new(ossl_check_PKCS7_compfunc_type(cmp))) +#define sk_PKCS7_new_null() ((STACK_OF(PKCS7) *)OPENSSL_sk_new_null()) +#define sk_PKCS7_new_reserve(cmp, n) ((STACK_OF(PKCS7) *)OPENSSL_sk_new_reserve(ossl_check_PKCS7_compfunc_type(cmp), (n))) +#define sk_PKCS7_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PKCS7_sk_type(sk), (n)) +#define sk_PKCS7_free(sk) OPENSSL_sk_free(ossl_check_PKCS7_sk_type(sk)) +#define sk_PKCS7_zero(sk) OPENSSL_sk_zero(ossl_check_PKCS7_sk_type(sk)) +#define sk_PKCS7_delete(sk, i) ((PKCS7 *)OPENSSL_sk_delete(ossl_check_PKCS7_sk_type(sk), (i))) +#define sk_PKCS7_delete_ptr(sk, ptr) ((PKCS7 *)OPENSSL_sk_delete_ptr(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr))) +#define sk_PKCS7_push(sk, ptr) OPENSSL_sk_push(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr)) +#define sk_PKCS7_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr)) +#define sk_PKCS7_pop(sk) ((PKCS7 *)OPENSSL_sk_pop(ossl_check_PKCS7_sk_type(sk))) +#define sk_PKCS7_shift(sk) ((PKCS7 *)OPENSSL_sk_shift(ossl_check_PKCS7_sk_type(sk))) +#define sk_PKCS7_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_freefunc_type(freefunc)) +#define sk_PKCS7_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr), (idx)) +#define sk_PKCS7_set(sk, idx, ptr) ((PKCS7 *)OPENSSL_sk_set(ossl_check_PKCS7_sk_type(sk), (idx), ossl_check_PKCS7_type(ptr))) +#define sk_PKCS7_find(sk, ptr) OPENSSL_sk_find(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr)) +#define sk_PKCS7_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr)) +#define sk_PKCS7_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr), pnum) +#define sk_PKCS7_sort(sk) OPENSSL_sk_sort(ossl_check_PKCS7_sk_type(sk)) +#define sk_PKCS7_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PKCS7_sk_type(sk)) +#define sk_PKCS7_dup(sk) ((STACK_OF(PKCS7) *)OPENSSL_sk_dup(ossl_check_const_PKCS7_sk_type(sk))) +#define sk_PKCS7_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PKCS7) *)OPENSSL_sk_deep_copy(ossl_check_const_PKCS7_sk_type(sk), ossl_check_PKCS7_copyfunc_type(copyfunc), ossl_check_PKCS7_freefunc_type(freefunc))) +#define sk_PKCS7_set_cmp_func(sk, cmp) ((sk_PKCS7_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_compfunc_type(cmp))) + +/* clang-format on */ + +#define PKCS7_OP_SET_DETACHED_SIGNATURE 1 +#define PKCS7_OP_GET_DETACHED_SIGNATURE 2 + +#define PKCS7_get_signed_attributes(si) ((si)->auth_attr) +#define PKCS7_get_attributes(si) ((si)->unauth_attr) + +#define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) +#define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) +#define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) +#define PKCS7_type_is_signedAndEnveloped(a) \ + (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) +#define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) +#define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) + +#define PKCS7_set_detached(p, v) \ + PKCS7_ctrl(p, PKCS7_OP_SET_DETACHED_SIGNATURE, v, NULL) +#define PKCS7_get_detached(p) \ + PKCS7_ctrl(p, PKCS7_OP_GET_DETACHED_SIGNATURE, 0, NULL) + +#define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) + +/* S/MIME related flags */ + +#define PKCS7_TEXT 0x1 +#define PKCS7_NOCERTS 0x2 +#define PKCS7_NOSIGS 0x4 +#define PKCS7_NOCHAIN 0x8 +#define PKCS7_NOINTERN 0x10 +#define PKCS7_NOVERIFY 0x20 +#define PKCS7_DETACHED 0x40 +#define PKCS7_BINARY 0x80 +#define PKCS7_NOATTR 0x100 +#define PKCS7_NOSMIMECAP 0x200 +#define PKCS7_NOOLDMIMETYPE 0x400 +#define PKCS7_CRLFEOL 0x800 +#define PKCS7_STREAM 0x1000 +#define PKCS7_NOCRL 0x2000 +#define PKCS7_PARTIAL 0x4000 +#define PKCS7_REUSE_DIGEST 0x8000 +#define PKCS7_NO_DUAL_CONTENT 0x10000 + +/* Flags: for compatibility with older code */ + +#define SMIME_TEXT PKCS7_TEXT +#define SMIME_NOCERTS PKCS7_NOCERTS +#define SMIME_NOSIGS PKCS7_NOSIGS +#define SMIME_NOCHAIN PKCS7_NOCHAIN +#define SMIME_NOINTERN PKCS7_NOINTERN +#define SMIME_NOVERIFY PKCS7_NOVERIFY +#define SMIME_DETACHED PKCS7_DETACHED +#define SMIME_BINARY PKCS7_BINARY +#define SMIME_NOATTR PKCS7_NOATTR + +/* CRLF ASCII canonicalisation */ +#define SMIME_ASCIICRLF 0x80000 + +DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) + +int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, + const EVP_MD *type, unsigned char *md, + unsigned int *len); +#ifndef OPENSSL_NO_STDIO +PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7); +int i2d_PKCS7_fp(FILE *fp, const PKCS7 *p7); +#endif +DECLARE_ASN1_DUP_FUNCTION(PKCS7) +PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7); +int i2d_PKCS7_bio(BIO *bp, const PKCS7 *p7); +int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); +int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); + +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) +DECLARE_ASN1_FUNCTIONS(PKCS7) +PKCS7 *PKCS7_new_ex(OSSL_LIB_CTX *libctx, const char *propq); + +DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) +DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) + +DECLARE_ASN1_NDEF_FUNCTION(PKCS7) +DECLARE_ASN1_PRINT_FUNCTION(PKCS7) + +long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); + +int PKCS7_type_is_other(PKCS7 *p7); +int PKCS7_set_type(PKCS7 *p7, int type); +int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); +int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); +int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, + const EVP_MD *dgst); +int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); +int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); +int PKCS7_add_certificate(PKCS7 *p7, X509 *cert); +int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl); +int PKCS7_content_new(PKCS7 *p7, int nid); +int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, + BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, + X509 *signer); + +BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); +int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); +BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); + +PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, + EVP_PKEY *pkey, const EVP_MD *dgst); +X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); +STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); + +PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); +void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, + X509_ALGOR **pdig, X509_ALGOR **psig); +void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); +int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); +int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); +int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); +int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); + +PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); +ASN1_OCTET_STRING *PKCS7_get_octet_string(PKCS7 *p7); +ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, + void *data); +int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, + void *value); +ASN1_TYPE *PKCS7_get_attribute(const PKCS7_SIGNER_INFO *si, int nid); +ASN1_TYPE *PKCS7_get_signed_attribute(const PKCS7_SIGNER_INFO *si, int nid); +int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); + +PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, + BIO *data, int flags); +PKCS7 *PKCS7_sign_ex(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, + BIO *data, int flags, OSSL_LIB_CTX *libctx, + const char *propq); + +PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, + X509 *signcert, EVP_PKEY *pkey, + const EVP_MD *md, int flags); + +int PKCS7_final(PKCS7 *p7, BIO *data, int flags); +int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, + BIO *indata, BIO *out, int flags); +STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, + int flags); +PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, + int flags); +PKCS7 *PKCS7_encrypt_ex(STACK_OF(X509) *certs, BIO *in, + const EVP_CIPHER *cipher, int flags, + OSSL_LIB_CTX *libctx, const char *propq); +int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, + int flags); + +int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, + STACK_OF(X509_ALGOR) *cap); +STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); +int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); + +int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); +int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); +int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, + const unsigned char *md, int mdlen); + +int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); +PKCS7 *SMIME_read_PKCS7_ex(BIO *bio, BIO **bcont, PKCS7 **p7); +PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); + +BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/pkcs7err.h b/VCMP-LUA/modules/postgresql/include/openssl/pkcs7err.h new file mode 100644 index 0000000..358fe10 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/pkcs7err.h @@ -0,0 +1,61 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PKCS7ERR_H +#define OPENSSL_PKCS7ERR_H +#pragma once + +#include +#include +#include + +/* + * PKCS7 reason codes. + */ +#define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 +#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 +#define PKCS7_R_CIPHER_NOT_INITIALIZED 116 +#define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 +#define PKCS7_R_CTRL_ERROR 152 +#define PKCS7_R_DECRYPT_ERROR 119 +#define PKCS7_R_DIGEST_FAILURE 101 +#define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 +#define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 +#define PKCS7_R_ERROR_ADDING_RECIPIENT 120 +#define PKCS7_R_ERROR_SETTING_CIPHER 121 +#define PKCS7_R_INVALID_NULL_POINTER 143 +#define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 +#define PKCS7_R_NO_CONTENT 122 +#define PKCS7_R_NO_DEFAULT_DIGEST 151 +#define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 +#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 +#define PKCS7_R_NO_SIGNATURES_ON_DATA 123 +#define PKCS7_R_NO_SIGNERS 142 +#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 +#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 +#define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 +#define PKCS7_R_PKCS7_DATASIGN 145 +#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 +#define PKCS7_R_SIGNATURE_FAILURE 105 +#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 +#define PKCS7_R_SIGNING_CTRL_FAILURE 147 +#define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 +#define PKCS7_R_SMIME_TEXT_ERROR 129 +#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 +#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 +#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 +#define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 +#define PKCS7_R_UNKNOWN_OPERATION 110 +#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 +#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 +#define PKCS7_R_WRONG_CONTENT_TYPE 113 +#define PKCS7_R_WRONG_PKCS7_TYPE 114 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/prov_ssl.h b/VCMP-LUA/modules/postgresql/include/openssl/prov_ssl.h new file mode 100644 index 0000000..269c3b8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/prov_ssl.h @@ -0,0 +1,38 @@ +/* + * Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PROV_SSL_H +#define OPENSSL_PROV_SSL_H +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/* SSL/TLS related defines useful to providers */ + +#define SSL_MAX_MASTER_KEY_LENGTH 48 + +/* SSL/TLS uses a 2 byte unsigned version number */ +#define SSL3_VERSION 0x0300 +#define TLS1_VERSION 0x0301 +#define TLS1_1_VERSION 0x0302 +#define TLS1_2_VERSION 0x0303 +#define TLS1_3_VERSION 0x0304 +#define DTLS1_VERSION 0xFEFF +#define DTLS1_2_VERSION 0xFEFD +#define DTLS1_BAD_VER 0x0100 + +/* QUIC uses a 4 byte unsigned version number */ +#define OSSL_QUIC1_VERSION 0x0000001 + +#ifdef __cplusplus +} +#endif +#endif /* OPENSSL_PROV_SSL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/proverr.h b/VCMP-LUA/modules/postgresql/include/openssl/proverr.h new file mode 100644 index 0000000..a82b8e4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/proverr.h @@ -0,0 +1,169 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PROVERR_H +#define OPENSSL_PROVERR_H +#pragma once + +#include +#include +#include + +/* + * PROV reason codes. + */ +#define PROV_R_ADDITIONAL_INPUT_TOO_LONG 184 +#define PROV_R_ALGORITHM_MISMATCH 173 +#define PROV_R_ALREADY_INSTANTIATED 185 +#define PROV_R_BAD_DECRYPT 100 +#define PROV_R_BAD_ENCODING 141 +#define PROV_R_BAD_LENGTH 142 +#define PROV_R_BAD_TLS_CLIENT_VERSION 161 +#define PROV_R_BN_ERROR 160 +#define PROV_R_CIPHER_OPERATION_FAILED 102 +#define PROV_R_COFACTOR_REQUIRED 236 +#define PROV_R_DERIVATION_FUNCTION_INIT_FAILED 205 +#define PROV_R_DIGEST_NOT_ALLOWED 174 +#define PROV_R_EMS_NOT_ENABLED 233 +#define PROV_R_ENTROPY_SOURCE_FAILED_CONTINUOUS_TESTS 244 +#define PROV_R_ENTROPY_SOURCE_STRENGTH_TOO_WEAK 186 +#define PROV_R_ERROR_INSTANTIATING_DRBG 188 +#define PROV_R_ERROR_RETRIEVING_ENTROPY 189 +#define PROV_R_ERROR_RETRIEVING_NONCE 190 +#define PROV_R_FAILED_DURING_DERIVATION 164 +#define PROV_R_FAILED_TO_CREATE_LOCK 180 +#define PROV_R_FAILED_TO_DECRYPT 162 +#define PROV_R_FAILED_TO_GENERATE_KEY 121 +#define PROV_R_FAILED_TO_GET_PARAMETER 103 +#define PROV_R_FAILED_TO_SET_PARAMETER 104 +#define PROV_R_FAILED_TO_SIGN 175 +#define PROV_R_FINAL_CALL_OUT_OF_ORDER 237 +#define PROV_R_FIPS_MODULE_CONDITIONAL_ERROR 227 +#define PROV_R_FIPS_MODULE_ENTERING_ERROR_STATE 224 +#define PROV_R_FIPS_MODULE_IMPORT_PCT_ERROR 253 +#define PROV_R_FIPS_MODULE_IN_ERROR_STATE 225 +#define PROV_R_GENERATE_ERROR 191 +#define PROV_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 165 +#define PROV_R_INDICATOR_INTEGRITY_FAILURE 210 +#define PROV_R_INIT_CALL_OUT_OF_ORDER 238 +#define PROV_R_INSUFFICIENT_DRBG_STRENGTH 181 +#define PROV_R_INVALID_AAD 108 +#define PROV_R_INVALID_AEAD 231 +#define PROV_R_INVALID_CONFIG_DATA 211 +#define PROV_R_INVALID_CONSTANT_LENGTH 157 +#define PROV_R_INVALID_CURVE 176 +#define PROV_R_INVALID_CUSTOM_LENGTH 111 +#define PROV_R_INVALID_DATA 115 +#define PROV_R_INVALID_DIGEST 122 +#define PROV_R_INVALID_DIGEST_LENGTH 166 +#define PROV_R_INVALID_DIGEST_SIZE 218 +#define PROV_R_INVALID_EDDSA_INSTANCE_FOR_ATTEMPTED_OPERATION 243 +#define PROV_R_INVALID_INPUT_LENGTH 230 +#define PROV_R_INVALID_ITERATION_COUNT 123 +#define PROV_R_INVALID_IV_LENGTH 109 +#define PROV_R_INVALID_KDF 232 +#define PROV_R_INVALID_KEY 158 +#define PROV_R_INVALID_KEY_LENGTH 105 +#define PROV_R_INVALID_MAC 151 +#define PROV_R_INVALID_MEMORY_SIZE 235 +#define PROV_R_INVALID_MGF1_MD 167 +#define PROV_R_INVALID_MODE 125 +#define PROV_R_INVALID_OUTPUT_LENGTH 217 +#define PROV_R_INVALID_PADDING_MODE 168 +#define PROV_R_INVALID_PREHASHED_DIGEST_LENGTH 241 +#define PROV_R_INVALID_PUBINFO 198 +#define PROV_R_INVALID_SALT_LENGTH 112 +#define PROV_R_INVALID_SEED_LENGTH 154 +#define PROV_R_INVALID_SIGNATURE_SIZE 179 +#define PROV_R_INVALID_STATE 212 +#define PROV_R_INVALID_TAG 110 +#define PROV_R_INVALID_TAG_LENGTH 118 +#define PROV_R_INVALID_THREAD_POOL_SIZE 234 +#define PROV_R_INVALID_UKM_LENGTH 200 +#define PROV_R_INVALID_X931_DIGEST 170 +#define PROV_R_IN_ERROR_STATE 192 +#define PROV_R_KEY_SETUP_FAILED 101 +#define PROV_R_KEY_SIZE_TOO_SMALL 171 +#define PROV_R_LENGTH_TOO_LARGE 202 +#define PROV_R_MISMATCHING_DOMAIN_PARAMETERS 203 +#define PROV_R_MISSING_CEK_ALG 144 +#define PROV_R_MISSING_CIPHER 155 +#define PROV_R_MISSING_CONFIG_DATA 213 +#define PROV_R_MISSING_CONSTANT 156 +#define PROV_R_MISSING_KEY 128 +#define PROV_R_MISSING_MAC 150 +#define PROV_R_MISSING_MESSAGE_DIGEST 129 +#define PROV_R_MISSING_OID 209 +#define PROV_R_MISSING_PASS 130 +#define PROV_R_MISSING_SALT 131 +#define PROV_R_MISSING_SECRET 132 +#define PROV_R_MISSING_SEED 140 +#define PROV_R_MISSING_SESSION_ID 133 +#define PROV_R_MISSING_TYPE 134 +#define PROV_R_MISSING_XCGHASH 135 +#define PROV_R_ML_DSA_NO_FORMAT 245 +#define PROV_R_ML_KEM_NO_FORMAT 246 +#define PROV_R_MODULE_INTEGRITY_FAILURE 214 +#define PROV_R_NOT_A_PRIVATE_KEY 221 +#define PROV_R_NOT_A_PUBLIC_KEY 220 +#define PROV_R_NOT_INSTANTIATED 193 +#define PROV_R_NOT_PARAMETERS 226 +#define PROV_R_NOT_SUPPORTED 136 +#define PROV_R_NOT_XOF_OR_INVALID_LENGTH 113 +#define PROV_R_NO_INSTANCE_ALLOWED 242 +#define PROV_R_NO_KEY_SET 114 +#define PROV_R_NO_PARAMETERS_SET 177 +#define PROV_R_NULL_LENGTH_POINTER 247 +#define PROV_R_NULL_OUTPUT_BUFFER 248 +#define PROV_R_ONESHOT_CALL_OUT_OF_ORDER 239 +#define PROV_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 178 +#define PROV_R_OUTPUT_BUFFER_TOO_SMALL 106 +#define PROV_R_PARENT_CANNOT_GENERATE_RANDOM_NUMBERS 228 +#define PROV_R_PARENT_CANNOT_SUPPLY_ENTROPY_SEED 187 +#define PROV_R_PARENT_LOCKING_NOT_ENABLED 182 +#define PROV_R_PARENT_STRENGTH_TOO_WEAK 194 +#define PROV_R_PATH_MUST_BE_ABSOLUTE 219 +#define PROV_R_PERSONALISATION_STRING_TOO_LONG 195 +#define PROV_R_PSS_SALTLEN_TOO_SMALL 172 +#define PROV_R_REPEATED_PARAMETER 252 +#define PROV_R_REQUEST_TOO_LARGE_FOR_DRBG 196 +#define PROV_R_REQUIRE_CTR_MODE_CIPHER 206 +#define PROV_R_RESEED_ERROR 197 +#define PROV_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 222 +#define PROV_R_SEED_SOURCES_MUST_NOT_HAVE_A_PARENT 229 +#define PROV_R_SELF_TEST_KAT_FAILURE 215 +#define PROV_R_SELF_TEST_POST_FAILURE 216 +#define PROV_R_TAG_NOT_NEEDED 120 +#define PROV_R_TAG_NOT_SET 119 +#define PROV_R_TOO_MANY_RECORDS 126 +#define PROV_R_UNABLE_TO_FIND_CIPHERS 207 +#define PROV_R_UNABLE_TO_GET_PARENT_STRENGTH 199 +#define PROV_R_UNABLE_TO_GET_PASSPHRASE 159 +#define PROV_R_UNABLE_TO_INITIALISE_CIPHERS 208 +#define PROV_R_UNABLE_TO_LOAD_SHA256 147 +#define PROV_R_UNABLE_TO_LOCK_PARENT 201 +#define PROV_R_UNABLE_TO_RESEED 204 +#define PROV_R_UNEXPECTED_KEY_PARAMETERS 249 +#define PROV_R_UNSUPPORTED_CEK_ALG 145 +#define PROV_R_UNSUPPORTED_KEY_SIZE 153 +#define PROV_R_UNSUPPORTED_MAC_TYPE 137 +#define PROV_R_UNSUPPORTED_NUMBER_OF_ROUNDS 152 +#define PROV_R_UNSUPPORTED_SELECTION 250 +#define PROV_R_UPDATE_CALL_OUT_OF_ORDER 240 +#define PROV_R_URI_AUTHORITY_UNSUPPORTED 223 +#define PROV_R_VALUE_ERROR 138 +#define PROV_R_WRONG_CIPHERTEXT_SIZE 251 +#define PROV_R_WRONG_FINAL_BLOCK_LENGTH 107 +#define PROV_R_WRONG_OUTPUT_BUFFER_SIZE 139 +#define PROV_R_XOF_DIGESTS_NOT_ALLOWED 183 +#define PROV_R_XTS_DATA_UNIT_IS_TOO_LARGE 148 +#define PROV_R_XTS_DUPLICATED_KEYS 149 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/provider.h b/VCMP-LUA/modules/postgresql/include/openssl/provider.h new file mode 100644 index 0000000..c34beea --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/provider.h @@ -0,0 +1,94 @@ +/* + * Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_PROVIDER_H +#define OPENSSL_PROVIDER_H +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Set and Get a library context search path */ +int OSSL_PROVIDER_set_default_search_path(OSSL_LIB_CTX *, const char *path); +const char *OSSL_PROVIDER_get0_default_search_path(OSSL_LIB_CTX *libctx); + +/* Load and unload a provider */ +OSSL_PROVIDER *OSSL_PROVIDER_load(OSSL_LIB_CTX *, const char *name); +OSSL_PROVIDER *OSSL_PROVIDER_load_ex(OSSL_LIB_CTX *, const char *name, + OSSL_PARAM *params); +OSSL_PROVIDER *OSSL_PROVIDER_try_load(OSSL_LIB_CTX *, const char *name, + int retain_fallbacks); +OSSL_PROVIDER *OSSL_PROVIDER_try_load_ex(OSSL_LIB_CTX *, const char *name, + OSSL_PARAM *params, + int retain_fallbacks); +int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov); +int OSSL_PROVIDER_available(OSSL_LIB_CTX *, const char *name); +int OSSL_PROVIDER_do_all(OSSL_LIB_CTX *ctx, + int (*cb)(OSSL_PROVIDER *provider, void *cbdata), + void *cbdata); + +const OSSL_PARAM *OSSL_PROVIDER_gettable_params(const OSSL_PROVIDER *prov); +int OSSL_PROVIDER_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]); +int OSSL_PROVIDER_self_test(const OSSL_PROVIDER *prov); +int OSSL_PROVIDER_get_capabilities(const OSSL_PROVIDER *prov, + const char *capability, + OSSL_CALLBACK *cb, + void *arg); + +/*- + * Provider configuration parameters are normally set in the configuration file, + * but can also be set early in the main program before a provider is in use by + * multiple threads. + * + * Only UTF8-string values are supported. + */ +int OSSL_PROVIDER_add_conf_parameter(OSSL_PROVIDER *prov, const char *name, + const char *value); +/* + * Retrieves any of the requested configuration parameters for the given + * provider that were set in the configuration file or via the above + * OSSL_PROVIDER_add_parameter() function. + * + * The |params| array elements MUST have type OSSL_PARAM_UTF8_PTR, values are + * returned by reference, not as copies. + */ +int OSSL_PROVIDER_get_conf_parameters(const OSSL_PROVIDER *prov, + OSSL_PARAM params[]); +/* + * Parse a provider configuration parameter as a boolean value, + * or return a default value if unable to retrieve the parameter. + * Values like "1", "yes", "true", ... are true (nonzero). + * Values like "0", "no", "false", ... are false (zero). + */ +int OSSL_PROVIDER_conf_get_bool(const OSSL_PROVIDER *prov, + const char *name, int defval); + +const OSSL_ALGORITHM *OSSL_PROVIDER_query_operation(const OSSL_PROVIDER *prov, + int operation_id, + int *no_cache); +void OSSL_PROVIDER_unquery_operation(const OSSL_PROVIDER *prov, + int operation_id, const OSSL_ALGORITHM *algs); +void *OSSL_PROVIDER_get0_provider_ctx(const OSSL_PROVIDER *prov); +const OSSL_DISPATCH *OSSL_PROVIDER_get0_dispatch(const OSSL_PROVIDER *prov); + +/* Add a built in providers */ +int OSSL_PROVIDER_add_builtin(OSSL_LIB_CTX *, const char *name, + OSSL_provider_init_fn *init_fn); + +/* Information */ +const char *OSSL_PROVIDER_get0_name(const OSSL_PROVIDER *prov); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/quic.h b/VCMP-LUA/modules/postgresql/include/openssl/quic.h new file mode 100644 index 0000000..657969b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/quic.h @@ -0,0 +1,75 @@ +/* + * Copyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_QUIC_H +#define OPENSSL_QUIC_H +#pragma once + +#include +#include + +#ifndef OPENSSL_NO_QUIC + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Method used for non-thread-assisted QUIC client operation. + */ +__owur const SSL_METHOD *OSSL_QUIC_client_method(void); + +/* + * Method used for thread-assisted QUIC client operation. + */ +__owur const SSL_METHOD *OSSL_QUIC_client_thread_method(void); + +/* + * QUIC transport error codes (RFC 9000 s. 20.1) + */ +#define OSSL_QUIC_ERR_NO_ERROR 0x00 +#define OSSL_QUIC_ERR_INTERNAL_ERROR 0x01 +#define OSSL_QUIC_ERR_CONNECTION_REFUSED 0x02 +#define OSSL_QUIC_ERR_FLOW_CONTROL_ERROR 0x03 +#define OSSL_QUIC_ERR_STREAM_LIMIT_ERROR 0x04 +#define OSSL_QUIC_ERR_STREAM_STATE_ERROR 0x05 +#define OSSL_QUIC_ERR_FINAL_SIZE_ERROR 0x06 +#define OSSL_QUIC_ERR_FRAME_ENCODING_ERROR 0x07 +#define OSSL_QUIC_ERR_TRANSPORT_PARAMETER_ERROR 0x08 +#define OSSL_QUIC_ERR_CONNECTION_ID_LIMIT_ERROR 0x09 +#define OSSL_QUIC_ERR_PROTOCOL_VIOLATION 0x0A +#define OSSL_QUIC_ERR_INVALID_TOKEN 0x0B +#define OSSL_QUIC_ERR_APPLICATION_ERROR 0x0C +#define OSSL_QUIC_ERR_CRYPTO_BUFFER_EXCEEDED 0x0D +#define OSSL_QUIC_ERR_KEY_UPDATE_ERROR 0x0E +#define OSSL_QUIC_ERR_AEAD_LIMIT_REACHED 0x0F +#define OSSL_QUIC_ERR_NO_VIABLE_PATH 0x10 + +/* Inclusive range for handshake-specific errors. */ +#define OSSL_QUIC_ERR_CRYPTO_ERR_BEGIN 0x0100 +#define OSSL_QUIC_ERR_CRYPTO_ERR_END 0x01FF + +#define OSSL_QUIC_ERR_CRYPTO_ERR(X) \ + (OSSL_QUIC_ERR_CRYPTO_ERR_BEGIN + (X)) + +/* Local errors. */ +#define OSSL_QUIC_LOCAL_ERR_IDLE_TIMEOUT \ + ((uint64_t)0xFFFFFFFFFFFFFFFFULL) + +/* + * Method used for QUIC server operation. + */ +__owur const SSL_METHOD *OSSL_QUIC_server_method(void); + +#ifdef __cplusplus +} +#endif + +#endif /* OPENSSL_NO_QUIC */ +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/rand.h b/VCMP-LUA/modules/postgresql/include/openssl/rand.h new file mode 100644 index 0000000..7272309 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/rand.h @@ -0,0 +1,133 @@ +/* + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_RAND_H +#define OPENSSL_RAND_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_RAND_H +#endif + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Default security strength (in the sense of [NIST SP 800-90Ar1]) + * + * NIST SP 800-90Ar1 supports the strength of the DRBG being smaller than that + * of the cipher by collecting less entropy. The current DRBG implementation + * does not take RAND_DRBG_STRENGTH into account and sets the strength of the + * DRBG to that of the cipher. + */ +#define RAND_DRBG_STRENGTH 256 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +struct rand_meth_st { + int (*seed)(const void *buf, int num); + int (*bytes)(unsigned char *buf, int num); + void (*cleanup)(void); + int (*add)(const void *buf, int num, double randomness); + int (*pseudorand)(unsigned char *buf, int num); + int (*status)(void); +}; + +OSSL_DEPRECATEDIN_3_0 int RAND_set_rand_method(const RAND_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 const RAND_METHOD *RAND_get_rand_method(void); +#ifndef OPENSSL_NO_ENGINE +OSSL_DEPRECATEDIN_3_0 int RAND_set_rand_engine(ENGINE *engine); +#endif + +OSSL_DEPRECATEDIN_3_0 RAND_METHOD *RAND_OpenSSL(void); +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define RAND_cleanup() \ + while (0) \ + continue +#endif +int RAND_bytes(unsigned char *buf, int num); +int RAND_priv_bytes(unsigned char *buf, int num); + +/* + * Equivalent of RAND_priv_bytes() but additionally taking an OSSL_LIB_CTX and + * a strength. + */ +int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num, + unsigned int strength); + +/* + * Equivalent of RAND_bytes() but additionally taking an OSSL_LIB_CTX and + * a strength. + */ +int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num, + unsigned int strength); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 int RAND_pseudo_bytes(unsigned char *buf, int num); +#endif + +EVP_RAND_CTX *RAND_get0_primary(OSSL_LIB_CTX *ctx); +EVP_RAND_CTX *RAND_get0_public(OSSL_LIB_CTX *ctx); +EVP_RAND_CTX *RAND_get0_private(OSSL_LIB_CTX *ctx); +int RAND_set0_public(OSSL_LIB_CTX *ctx, EVP_RAND_CTX *rand); +int RAND_set0_private(OSSL_LIB_CTX *ctx, EVP_RAND_CTX *rand); + +int RAND_set_DRBG_type(OSSL_LIB_CTX *ctx, const char *drbg, const char *propq, + const char *cipher, const char *digest); +int RAND_set_seed_source_type(OSSL_LIB_CTX *ctx, const char *seed, + const char *propq); + +void RAND_seed(const void *buf, int num); +void RAND_keep_random_devices_open(int keep); + +#if defined(__ANDROID__) && defined(__NDK_FPABI__) +__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ +#endif + void RAND_add(const void *buf, int num, double randomness); +int RAND_load_file(const char *file, long max_bytes); +int RAND_write_file(const char *file); +const char *RAND_file_name(char *file, size_t num); +int RAND_status(void); + +#ifndef OPENSSL_NO_EGD +int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); +int RAND_egd(const char *path); +int RAND_egd_bytes(const char *path, int bytes); +#endif + +int RAND_poll(void); + +#if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) +/* application has to include in order to use these */ +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 void RAND_screen(void); +OSSL_DEPRECATEDIN_1_1_0 int RAND_event(UINT, WPARAM, LPARAM); +#endif +#endif + +int RAND_set1_random_provider(OSSL_LIB_CTX *ctx, OSSL_PROVIDER *p); + +/* Which parameter to provider_random call */ +#define OSSL_PROV_RANDOM_PUBLIC 0 +#define OSSL_PROV_RANDOM_PRIVATE 1 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/randerr.h b/VCMP-LUA/modules/postgresql/include/openssl/randerr.h new file mode 100644 index 0000000..6107cdd --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/randerr.h @@ -0,0 +1,68 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_RANDERR_H +#define OPENSSL_RANDERR_H +#pragma once + +#include +#include +#include + +/* + * RAND reason codes. + */ +#define RAND_R_ADDITIONAL_INPUT_TOO_LONG 102 +#define RAND_R_ALREADY_INSTANTIATED 103 +#define RAND_R_ARGUMENT_OUT_OF_RANGE 105 +#define RAND_R_CANNOT_OPEN_FILE 121 +#define RAND_R_DRBG_ALREADY_INITIALIZED 129 +#define RAND_R_DRBG_NOT_INITIALISED 104 +#define RAND_R_ENTROPY_INPUT_TOO_LONG 106 +#define RAND_R_ENTROPY_OUT_OF_RANGE 124 +#define RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED 127 +#define RAND_R_ERROR_INITIALISING_DRBG 107 +#define RAND_R_ERROR_INSTANTIATING_DRBG 108 +#define RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 109 +#define RAND_R_ERROR_RETRIEVING_ENTROPY 110 +#define RAND_R_ERROR_RETRIEVING_NONCE 111 +#define RAND_R_FAILED_TO_CREATE_LOCK 126 +#define RAND_R_FUNC_NOT_IMPLEMENTED 101 +#define RAND_R_FWRITE_ERROR 123 +#define RAND_R_GENERATE_ERROR 112 +#define RAND_R_INSUFFICIENT_DRBG_STRENGTH 139 +#define RAND_R_INTERNAL_ERROR 113 +#define RAND_R_INVALID_PROPERTY_QUERY 137 +#define RAND_R_IN_ERROR_STATE 114 +#define RAND_R_NOT_A_REGULAR_FILE 122 +#define RAND_R_NOT_INSTANTIATED 115 +#define RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED 128 +#define RAND_R_PARENT_LOCKING_NOT_ENABLED 130 +#define RAND_R_PARENT_STRENGTH_TOO_WEAK 131 +#define RAND_R_PERSONALISATION_STRING_TOO_LONG 116 +#define RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED 133 +#define RAND_R_PRNG_NOT_SEEDED 100 +#define RAND_R_RANDOM_POOL_IS_EMPTY 142 +#define RAND_R_RANDOM_POOL_OVERFLOW 125 +#define RAND_R_RANDOM_POOL_UNDERFLOW 134 +#define RAND_R_REQUEST_TOO_LARGE_FOR_DRBG 117 +#define RAND_R_RESEED_ERROR 118 +#define RAND_R_SELFTEST_FAILURE 119 +#define RAND_R_TOO_LITTLE_NONCE_REQUESTED 135 +#define RAND_R_TOO_MUCH_NONCE_REQUESTED 136 +#define RAND_R_UNABLE_TO_CREATE_DRBG 143 +#define RAND_R_UNABLE_TO_FETCH_DRBG 144 +#define RAND_R_UNABLE_TO_GET_PARENT_RESEED_PROP_COUNTER 141 +#define RAND_R_UNABLE_TO_GET_PARENT_STRENGTH 138 +#define RAND_R_UNABLE_TO_LOCK_PARENT 140 +#define RAND_R_UNSUPPORTED_DRBG_FLAGS 132 +#define RAND_R_UNSUPPORTED_DRBG_TYPE 120 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/rc2.h b/VCMP-LUA/modules/postgresql/include/openssl/rc2.h new file mode 100644 index 0000000..7da28f7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/rc2.h @@ -0,0 +1,68 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_RC2_H +#define OPENSSL_RC2_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_RC2_H +#endif + +#include + +#ifndef OPENSSL_NO_RC2 +#ifdef __cplusplus +extern "C" { +#endif + +#define RC2_BLOCK 8 +#define RC2_KEY_LENGTH 16 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +typedef unsigned int RC2_INT; + +#define RC2_ENCRYPT 1 +#define RC2_DECRYPT 0 + +typedef struct rc2_key_st { + RC2_INT data[64]; +} RC2_KEY; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 void RC2_set_key(RC2_KEY *key, int len, + const unsigned char *data, int bits); +OSSL_DEPRECATEDIN_3_0 void RC2_ecb_encrypt(const unsigned char *in, + unsigned char *out, RC2_KEY *key, + int enc); +OSSL_DEPRECATEDIN_3_0 void RC2_encrypt(unsigned long *data, RC2_KEY *key); +OSSL_DEPRECATEDIN_3_0 void RC2_decrypt(unsigned long *data, RC2_KEY *key); +OSSL_DEPRECATEDIN_3_0 void RC2_cbc_encrypt(const unsigned char *in, + unsigned char *out, long length, + RC2_KEY *ks, unsigned char *iv, + int enc); +OSSL_DEPRECATEDIN_3_0 void RC2_cfb64_encrypt(const unsigned char *in, + unsigned char *out, long length, + RC2_KEY *schedule, + unsigned char *ivec, + int *num, int enc); +OSSL_DEPRECATEDIN_3_0 void RC2_ofb64_encrypt(const unsigned char *in, + unsigned char *out, long length, + RC2_KEY *schedule, + unsigned char *ivec, + int *num); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/rc4.h b/VCMP-LUA/modules/postgresql/include/openssl/rc4.h new file mode 100644 index 0000000..92dce0c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/rc4.h @@ -0,0 +1,47 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_RC4_H +#define OPENSSL_RC4_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_RC4_H +#endif + +#include + +#ifndef OPENSSL_NO_RC4 +#include +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +typedef struct rc4_key_st { + RC4_INT x, y; + RC4_INT data[256]; +} RC4_KEY; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 const char *RC4_options(void); +OSSL_DEPRECATEDIN_3_0 void RC4_set_key(RC4_KEY *key, int len, + const unsigned char *data); +OSSL_DEPRECATEDIN_3_0 void RC4(RC4_KEY *key, size_t len, + const unsigned char *indata, + unsigned char *outdata); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/rc5.h b/VCMP-LUA/modules/postgresql/include/openssl/rc5.h new file mode 100644 index 0000000..2e91e98 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/rc5.h @@ -0,0 +1,79 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_RC5_H +#define OPENSSL_RC5_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_RC5_H +#endif + +#include + +#ifndef OPENSSL_NO_RC5 +#ifdef __cplusplus +extern "C" { +#endif + +#define RC5_32_BLOCK 8 +#define RC5_32_KEY_LENGTH 16 /* This is a default, max is 255 */ + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define RC5_ENCRYPT 1 +#define RC5_DECRYPT 0 + +#define RC5_32_INT unsigned int + +/* + * This are the only values supported. Tweak the code if you want more The + * most supported modes will be RC5-32/12/16 RC5-32/16/8 + */ +#define RC5_8_ROUNDS 8 +#define RC5_12_ROUNDS 12 +#define RC5_16_ROUNDS 16 + +typedef struct rc5_key_st { + /* Number of rounds */ + int rounds; + RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; +} RC5_32_KEY; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int RC5_32_set_key(RC5_32_KEY *key, int len, + const unsigned char *data, + int rounds); +OSSL_DEPRECATEDIN_3_0 void RC5_32_ecb_encrypt(const unsigned char *in, + unsigned char *out, + RC5_32_KEY *key, + int enc); +OSSL_DEPRECATEDIN_3_0 void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); +OSSL_DEPRECATEDIN_3_0 void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); +OSSL_DEPRECATEDIN_3_0 void RC5_32_cbc_encrypt(const unsigned char *in, + unsigned char *out, long length, + RC5_32_KEY *ks, unsigned char *iv, + int enc); +OSSL_DEPRECATEDIN_3_0 void RC5_32_cfb64_encrypt(const unsigned char *in, + unsigned char *out, long length, + RC5_32_KEY *schedule, + unsigned char *ivec, int *num, + int enc); +OSSL_DEPRECATEDIN_3_0 void RC5_32_ofb64_encrypt(const unsigned char *in, + unsigned char *out, long length, + RC5_32_KEY *schedule, + unsigned char *ivec, int *num); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ripemd.h b/VCMP-LUA/modules/postgresql/include/openssl/ripemd.h new file mode 100644 index 0000000..a72d1da --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ripemd.h @@ -0,0 +1,59 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_RIPEMD_H +#define OPENSSL_RIPEMD_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_RIPEMD_H +#endif + +#include + +#ifndef OPENSSL_NO_RMD160 +#include +#include + +#define RIPEMD160_DIGEST_LENGTH 20 + +#ifdef __cplusplus +extern "C" { +#endif +#if !defined(OPENSSL_NO_DEPRECATED_3_0) + +#define RIPEMD160_LONG unsigned int + +#define RIPEMD160_CBLOCK 64 +#define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK / 4) + +typedef struct RIPEMD160state_st { + RIPEMD160_LONG A, B, C, D, E; + RIPEMD160_LONG Nl, Nh; + RIPEMD160_LONG data[RIPEMD160_LBLOCK]; + unsigned int num; +} RIPEMD160_CTX; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int RIPEMD160_Init(RIPEMD160_CTX *c); +OSSL_DEPRECATEDIN_3_0 int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, + size_t len); +OSSL_DEPRECATEDIN_3_0 int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); +OSSL_DEPRECATEDIN_3_0 unsigned char *RIPEMD160(const unsigned char *d, size_t n, + unsigned char *md); +OSSL_DEPRECATEDIN_3_0 void RIPEMD160_Transform(RIPEMD160_CTX *c, + const unsigned char *b); +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/rsa.h b/VCMP-LUA/modules/postgresql/include/openssl/rsa.h new file mode 100644 index 0000000..08335e0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/rsa.h @@ -0,0 +1,614 @@ +/* + * Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_RSA_H +#define OPENSSL_RSA_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_RSA_H +#endif + +#include + +#include +#include +#include +#include +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#include +#endif +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_RSA_MAX_MODULUS_BITS +#define OPENSSL_RSA_MAX_MODULUS_BITS 16384 +#endif + +#define RSA_3 0x3L +#define RSA_F4 0x10001L + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* The types RSA and RSA_METHOD are defined in ossl_typ.h */ + +#define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 2048 + +#ifndef OPENSSL_RSA_SMALL_MODULUS_BITS +#define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 +#endif + +/* exponent limit enforced for "large" modulus only */ +#ifndef OPENSSL_RSA_MAX_PUBEXP_BITS +#define OPENSSL_RSA_MAX_PUBEXP_BITS 64 +#endif +/* based on RFC 8017 appendix A.1.2 */ +#define RSA_ASN1_VERSION_DEFAULT 0 +#define RSA_ASN1_VERSION_MULTI 1 + +#define RSA_DEFAULT_PRIME_NUM 2 + +#define RSA_METHOD_FLAG_NO_CHECK 0x0001 +#define RSA_FLAG_CACHE_PUBLIC 0x0002 +#define RSA_FLAG_CACHE_PRIVATE 0x0004 +#define RSA_FLAG_BLINDING 0x0008 +#define RSA_FLAG_THREAD_SAFE 0x0010 +/* + * This flag means the private key operations will be handled by rsa_mod_exp + * and that they do not depend on the private key components being present: + * for example a key stored in external hardware. Without this flag + * bn_mod_exp gets called when private key components are absent. + */ +#define RSA_FLAG_EXT_PKEY 0x0020 + +/* + * new with 0.9.6j and 0.9.7b; the built-in + * RSA implementation now uses blinding by + * default (ignoring RSA_FLAG_BLINDING), + * but other engines might not need it + */ +#define RSA_FLAG_NO_BLINDING 0x0080 +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define RSA_FLAG_NO_CONSTTIME 0x0000 +#endif +/* deprecated name for the flag*/ +/* + * new with 0.9.7h; the built-in RSA + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ +#ifndef OPENSSL_NO_DEPRECATED_0_9_8 +#define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME +#endif + +/*- + * New with 3.0: use part of the flags to denote exact type of RSA key, + * some of which are limited to specific signature and encryption schemes. + * These different types share the same RSA structure, but indicate the + * use of certain fields in that structure. + * Currently known are: + * RSA - this is the "normal" unlimited RSA structure (typenum 0) + * RSASSA-PSS - indicates that the PSS parameters are used. + * RSAES-OAEP - no specific field used for the moment, but OAEP padding + * is expected. (currently unused) + * + * 4 bits allow for 16 types + */ +#define RSA_FLAG_TYPE_MASK 0xF000 +#define RSA_FLAG_TYPE_RSA 0x0000 +#define RSA_FLAG_TYPE_RSASSAPSS 0x1000 +#define RSA_FLAG_TYPE_RSAESOAEP 0x2000 + +int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad_mode); +int EVP_PKEY_CTX_get_rsa_padding(EVP_PKEY_CTX *ctx, int *pad_mode); + +int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int saltlen); +int EVP_PKEY_CTX_get_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int *saltlen); + +int EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int bits); +int EVP_PKEY_CTX_set1_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp); +int EVP_PKEY_CTX_set_rsa_keygen_primes(EVP_PKEY_CTX *ctx, int primes); +int EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(EVP_PKEY_CTX *ctx, int saltlen); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp); +#endif + +/* Salt length matches digest */ +#define RSA_PSS_SALTLEN_DIGEST -1 +/* Verify only: auto detect salt length */ +#define RSA_PSS_SALTLEN_AUTO -2 +/* Set salt length to maximum possible */ +#define RSA_PSS_SALTLEN_MAX -3 +/* Auto-detect on verify, set salt length to min(maximum possible, digest + * length) on sign */ +#define RSA_PSS_SALTLEN_AUTO_DIGEST_MAX -4 +/* Old compatible max salt length for sign only */ +#define RSA_PSS_SALTLEN_MAX_SIGN -2 + +int EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); +int EVP_PKEY_CTX_set_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, const char *mdname, + const char *mdprops); +int EVP_PKEY_CTX_get_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD **md); +int EVP_PKEY_CTX_get_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, char *name, + size_t namelen); +int EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); +int EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name(EVP_PKEY_CTX *ctx, + const char *mdname); + +int EVP_PKEY_CTX_set_rsa_pss_keygen_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); +int EVP_PKEY_CTX_set_rsa_pss_keygen_md_name(EVP_PKEY_CTX *ctx, + const char *mdname, + const char *mdprops); + +int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); +int EVP_PKEY_CTX_set_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, const char *mdname, + const char *mdprops); +int EVP_PKEY_CTX_get_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD **md); +int EVP_PKEY_CTX_get_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, char *name, + size_t namelen); +int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, void *label, int llen); +int EVP_PKEY_CTX_get0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char **label); + +#define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) +#define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) + +#define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) +#define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) +#define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) + +#define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) +#define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) +#define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) + +#define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) +#define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) + +#define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) +#define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) + +#define EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES (EVP_PKEY_ALG_CTRL + 13) + +#define EVP_PKEY_CTRL_RSA_IMPLICIT_REJECTION (EVP_PKEY_ALG_CTRL + 14) + +#define RSA_PKCS1_PADDING 1 +#define RSA_NO_PADDING 3 +#define RSA_PKCS1_OAEP_PADDING 4 +#define RSA_X931_PADDING 5 + +/* EVP_PKEY_ only */ +#define RSA_PKCS1_PSS_PADDING 6 +#define RSA_PKCS1_WITH_TLS_PADDING 7 + +/* internal RSA_ only */ +#define RSA_PKCS1_NO_IMPLICIT_REJECT_PADDING 8 + +#define RSA_PKCS1_PADDING_SIZE 11 + +#define RSA_set_app_data(s, arg) RSA_set_ex_data(s, 0, arg) +#define RSA_get_app_data(s) RSA_get_ex_data(s, 0) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 RSA *RSA_new(void); +OSSL_DEPRECATEDIN_3_0 RSA *RSA_new_method(ENGINE *engine); +OSSL_DEPRECATEDIN_3_0 int RSA_bits(const RSA *rsa); +OSSL_DEPRECATEDIN_3_0 int RSA_size(const RSA *rsa); +OSSL_DEPRECATEDIN_3_0 int RSA_security_bits(const RSA *rsa); + +OSSL_DEPRECATEDIN_3_0 int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); +OSSL_DEPRECATEDIN_3_0 int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); +OSSL_DEPRECATEDIN_3_0 int RSA_set0_crt_params(RSA *r, + BIGNUM *dmp1, BIGNUM *dmq1, + BIGNUM *iqmp); +OSSL_DEPRECATEDIN_3_0 int RSA_set0_multi_prime_params(RSA *r, + BIGNUM *primes[], + BIGNUM *exps[], + BIGNUM *coeffs[], + int pnum); +OSSL_DEPRECATEDIN_3_0 void RSA_get0_key(const RSA *r, + const BIGNUM **n, const BIGNUM **e, + const BIGNUM **d); +OSSL_DEPRECATEDIN_3_0 void RSA_get0_factors(const RSA *r, + const BIGNUM **p, const BIGNUM **q); +OSSL_DEPRECATEDIN_3_0 int RSA_get_multi_prime_extra_count(const RSA *r); +OSSL_DEPRECATEDIN_3_0 int RSA_get0_multi_prime_factors(const RSA *r, + const BIGNUM *primes[]); +OSSL_DEPRECATEDIN_3_0 void RSA_get0_crt_params(const RSA *r, + const BIGNUM **dmp1, + const BIGNUM **dmq1, + const BIGNUM **iqmp); +OSSL_DEPRECATEDIN_3_0 +int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[], + const BIGNUM *coeffs[]); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_n(const RSA *d); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_e(const RSA *d); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_d(const RSA *d); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_p(const RSA *d); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_q(const RSA *d); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_dmp1(const RSA *r); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_dmq1(const RSA *r); +OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_iqmp(const RSA *r); +OSSL_DEPRECATEDIN_3_0 const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); +OSSL_DEPRECATEDIN_3_0 void RSA_clear_flags(RSA *r, int flags); +OSSL_DEPRECATEDIN_3_0 int RSA_test_flags(const RSA *r, int flags); +OSSL_DEPRECATEDIN_3_0 void RSA_set_flags(RSA *r, int flags); +OSSL_DEPRECATEDIN_3_0 int RSA_get_version(RSA *r); +OSSL_DEPRECATEDIN_3_0 ENGINE *RSA_get0_engine(const RSA *r); +#endif /* !OPENSSL_NO_DEPRECATED_3_0 */ + +#define EVP_RSA_gen(bits) \ + EVP_PKEY_Q_keygen(NULL, NULL, "RSA", (size_t)(0 + (bits))) + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED_0_9_8 +OSSL_DEPRECATEDIN_0_9_8 RSA *RSA_generate_key(int bits, unsigned long e, void (*callback)(int, int, void *), + void *cb_arg); +#endif + +/* New version */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, + BN_GENCB *cb); +/* Multi-prime version */ +OSSL_DEPRECATEDIN_3_0 int RSA_generate_multi_prime_key(RSA *rsa, int bits, + int primes, BIGNUM *e, + BN_GENCB *cb); + +OSSL_DEPRECATEDIN_3_0 +int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, + BIGNUM *q1, BIGNUM *q2, + const BIGNUM *Xp1, const BIGNUM *Xp2, + const BIGNUM *Xp, const BIGNUM *Xq1, + const BIGNUM *Xq2, const BIGNUM *Xq, + const BIGNUM *e, BN_GENCB *cb); +OSSL_DEPRECATEDIN_3_0 int RSA_X931_generate_key_ex(RSA *rsa, int bits, + const BIGNUM *e, + BN_GENCB *cb); + +OSSL_DEPRECATEDIN_3_0 int RSA_check_key(const RSA *); +OSSL_DEPRECATEDIN_3_0 int RSA_check_key_ex(const RSA *, BN_GENCB *cb); +/* next 4 return -1 on error */ +OSSL_DEPRECATEDIN_3_0 +int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, + RSA *rsa, int padding); +OSSL_DEPRECATEDIN_3_0 +int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to, + RSA *rsa, int padding); +OSSL_DEPRECATEDIN_3_0 +int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to, + RSA *rsa, int padding); +OSSL_DEPRECATEDIN_3_0 +int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, + RSA *rsa, int padding); +OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r); +/* "up" the RSA object's reference count */ +OSSL_DEPRECATEDIN_3_0 int RSA_up_ref(RSA *r); +OSSL_DEPRECATEDIN_3_0 int RSA_flags(const RSA *r); + +OSSL_DEPRECATEDIN_3_0 void RSA_set_default_method(const RSA_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *RSA_get_default_method(void); +OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *RSA_null_method(void); +OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *RSA_get_method(const RSA *rsa); +OSSL_DEPRECATEDIN_3_0 int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); + +/* these are the actual RSA functions */ +OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *RSA_PKCS1_OpenSSL(void); + +DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(OSSL_DEPRECATEDIN_3_0, + RSA, RSAPublicKey) +DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(OSSL_DEPRECATEDIN_3_0, + RSA, RSAPrivateKey) +#endif /* !OPENSSL_NO_DEPRECATED_3_0 */ + +int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); + +struct rsa_pss_params_st { + X509_ALGOR *hashAlgorithm; + X509_ALGOR *maskGenAlgorithm; + ASN1_INTEGER *saltLength; + ASN1_INTEGER *trailerField; + /* Decoded hash algorithm from maskGenAlgorithm */ + X509_ALGOR *maskHash; +}; + +DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) +DECLARE_ASN1_DUP_FUNCTION(RSA_PSS_PARAMS) + +struct rsa_oaep_params_st { + X509_ALGOR *hashFunc; + X509_ALGOR *maskGenFunc; + X509_ALGOR *pSourceFunc; + /* Decoded hash algorithm from maskGenFunc */ + X509_ALGOR *maskHash; +}; + +DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_STDIO +OSSL_DEPRECATEDIN_3_0 int RSA_print_fp(FILE *fp, const RSA *r, int offset); +#endif + +OSSL_DEPRECATEDIN_3_0 int RSA_print(BIO *bp, const RSA *r, int offset); + +/* + * The following 2 functions sign and verify a X509_SIG ASN1 object inside + * PKCS#1 padded RSA encryption + */ +OSSL_DEPRECATEDIN_3_0 int RSA_sign(int type, const unsigned char *m, + unsigned int m_length, unsigned char *sigret, + unsigned int *siglen, RSA *rsa); +OSSL_DEPRECATEDIN_3_0 int RSA_verify(int type, const unsigned char *m, + unsigned int m_length, + const unsigned char *sigbuf, + unsigned int siglen, RSA *rsa); + +/* + * The following 2 function sign and verify a ASN1_OCTET_STRING object inside + * PKCS#1 padded RSA encryption + */ +OSSL_DEPRECATEDIN_3_0 +int RSA_sign_ASN1_OCTET_STRING(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + RSA *rsa); +OSSL_DEPRECATEDIN_3_0 +int RSA_verify_ASN1_OCTET_STRING(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigbuf, unsigned int siglen, + RSA *rsa); + +OSSL_DEPRECATEDIN_3_0 int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 void RSA_blinding_off(RSA *rsa); +OSSL_DEPRECATEDIN_3_0 BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); + +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, + const unsigned char *f, int fl); +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, + const unsigned char *f, int fl); +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +OSSL_DEPRECATEDIN_3_0 int PKCS1_MGF1(unsigned char *mask, long len, + const unsigned char *seed, long seedlen, + const EVP_MD *dgst); +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, + const unsigned char *f, int fl, + const unsigned char *p, int pl); +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len, + const unsigned char *p, int pl); +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, + const unsigned char *from, int flen, + const unsigned char *param, int plen, + const EVP_MD *md, const EVP_MD *mgf1md); +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, + const unsigned char *from, int flen, + int num, + const unsigned char *param, int plen, + const EVP_MD *md, const EVP_MD *mgf1md); +OSSL_DEPRECATEDIN_3_0 int RSA_padding_add_none(unsigned char *to, int tlen, + const unsigned char *f, int fl); +OSSL_DEPRECATEDIN_3_0 int RSA_padding_check_none(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +OSSL_DEPRECATEDIN_3_0 int RSA_padding_add_X931(unsigned char *to, int tlen, + const unsigned char *f, int fl); +OSSL_DEPRECATEDIN_3_0 int RSA_padding_check_X931(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +OSSL_DEPRECATEDIN_3_0 int RSA_X931_hash_id(int nid); + +OSSL_DEPRECATEDIN_3_0 +int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const unsigned char *EM, + int sLen); +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, const EVP_MD *Hash, + int sLen); + +OSSL_DEPRECATEDIN_3_0 +int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const EVP_MD *mgf1Hash, + const unsigned char *EM, int sLen); + +OSSL_DEPRECATEDIN_3_0 +int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, + const EVP_MD *Hash, const EVP_MD *mgf1Hash, + int sLen); + +#define RSA_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef) +OSSL_DEPRECATEDIN_3_0 int RSA_set_ex_data(RSA *r, int idx, void *arg); +OSSL_DEPRECATEDIN_3_0 void *RSA_get_ex_data(const RSA *r, int idx); + +DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, RSA, RSAPublicKey) +DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, RSA, RSAPrivateKey) + +/* + * If this flag is set the RSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +#define RSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +#define RSA_FLAG_NON_FIPS_ALLOW 0x0400 +/* + * Application has decided PRNG is good enough to generate a key: don't + * check. + */ +#define RSA_FLAG_CHECKED 0x0800 + +OSSL_DEPRECATEDIN_3_0 RSA_METHOD *RSA_meth_new(const char *name, int flags); +OSSL_DEPRECATEDIN_3_0 void RSA_meth_free(RSA_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 const char *RSA_meth_get0_name(const RSA_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 int RSA_meth_set1_name(RSA_METHOD *meth, + const char *name); +OSSL_DEPRECATEDIN_3_0 int RSA_meth_get_flags(const RSA_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 int RSA_meth_set_flags(RSA_METHOD *meth, int flags); +OSSL_DEPRECATEDIN_3_0 void *RSA_meth_get0_app_data(const RSA_METHOD *meth); +OSSL_DEPRECATEDIN_3_0 int RSA_meth_set0_app_data(RSA_METHOD *meth, + void *app_data); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth))(int flen, + const unsigned char *from, + unsigned char *to, + RSA *rsa, int padding); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_pub_enc(RSA_METHOD *rsa, + int (*pub_enc)(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth))(int flen, + const unsigned char *from, + unsigned char *to, + RSA *rsa, int padding); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_pub_dec(RSA_METHOD *rsa, + int (*pub_dec)(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth))(int flen, + const unsigned char *from, + unsigned char *to, + RSA *rsa, int padding); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_priv_enc(RSA_METHOD *rsa, + int (*priv_enc)(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth))(int flen, + const unsigned char *from, + unsigned char *to, + RSA *rsa, int padding); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_priv_dec(RSA_METHOD *rsa, + int (*priv_dec)(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth))(BIGNUM *r0, + const BIGNUM *i, + RSA *rsa, BN_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_mod_exp(RSA_METHOD *rsa, + int (*mod_exp)(BIGNUM *r0, const BIGNUM *i, RSA *rsa, + BN_CTX *ctx)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth))(BIGNUM *r, + const BIGNUM *a, + const BIGNUM *p, + const BIGNUM *m, + BN_CTX *ctx, + BN_MONT_CTX *m_ctx); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa, + int (*bn_mod_exp)(BIGNUM *r, + const BIGNUM *a, + const BIGNUM *p, + const BIGNUM *m, + BN_CTX *ctx, + BN_MONT_CTX *m_ctx)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_init(const RSA_METHOD *meth))(RSA *rsa); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_init(RSA_METHOD *rsa, int (*init)(RSA *rsa)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish)(RSA *rsa)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_sign(const RSA_METHOD *meth))(int type, + const unsigned char *m, + unsigned int m_length, + unsigned char *sigret, + unsigned int *siglen, + const RSA *rsa); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_sign(RSA_METHOD *rsa, + int (*sign)(int type, const unsigned char *m, + unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + const RSA *rsa)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_verify(const RSA_METHOD *meth))(int dtype, + const unsigned char *m, + unsigned int m_length, + const unsigned char *sigbuf, + unsigned int siglen, + const RSA *rsa); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_verify(RSA_METHOD *rsa, + int (*verify)(int dtype, const unsigned char *m, + unsigned int m_length, + const unsigned char *sigbuf, + unsigned int siglen, const RSA *rsa)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_keygen(const RSA_METHOD *meth))(RSA *rsa, int bits, + BIGNUM *e, BN_GENCB *cb); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_keygen(RSA_METHOD *rsa, + int (*keygen)(RSA *rsa, int bits, BIGNUM *e, + BN_GENCB *cb)); +OSSL_DEPRECATEDIN_3_0 +int (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth))(RSA *rsa, + int bits, + int primes, + BIGNUM *e, + BN_GENCB *cb); +OSSL_DEPRECATEDIN_3_0 +int RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth, + int (*keygen)(RSA *rsa, int bits, + int primes, BIGNUM *e, + BN_GENCB *cb)); +#endif /* !OPENSSL_NO_DEPRECATED_3_0 */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/rsaerr.h b/VCMP-LUA/modules/postgresql/include/openssl/rsaerr.h new file mode 100644 index 0000000..8432f5f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/rsaerr.h @@ -0,0 +1,105 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_RSAERR_H +#define OPENSSL_RSAERR_H +#pragma once + +#include +#include +#include + +/* + * RSA reason codes. + */ +#define RSA_R_ALGORITHM_MISMATCH 100 +#define RSA_R_BAD_E_VALUE 101 +#define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 +#define RSA_R_BAD_PAD_BYTE_COUNT 103 +#define RSA_R_BAD_SIGNATURE 104 +#define RSA_R_BLOCK_TYPE_IS_NOT_01 106 +#define RSA_R_BLOCK_TYPE_IS_NOT_02 107 +#define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 +#define RSA_R_DATA_TOO_LARGE 109 +#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 +#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 +#define RSA_R_DATA_TOO_SMALL 111 +#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 +#define RSA_R_DIGEST_DOES_NOT_MATCH 158 +#define RSA_R_DIGEST_NOT_ALLOWED 145 +#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 +#define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 +#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 +#define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 +#define RSA_R_FIRST_OCTET_INVALID 133 +#define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 +#define RSA_R_INVALID_DIGEST 157 +#define RSA_R_INVALID_DIGEST_LENGTH 143 +#define RSA_R_INVALID_HEADER 137 +#define RSA_R_INVALID_KEYPAIR 171 +#define RSA_R_INVALID_KEY_LENGTH 173 +#define RSA_R_INVALID_LABEL 160 +#define RSA_R_INVALID_LENGTH 181 +#define RSA_R_INVALID_MESSAGE_LENGTH 131 +#define RSA_R_INVALID_MGF1_MD 156 +#define RSA_R_INVALID_MODULUS 174 +#define RSA_R_INVALID_MULTI_PRIME_KEY 167 +#define RSA_R_INVALID_OAEP_PARAMETERS 161 +#define RSA_R_INVALID_PADDING 138 +#define RSA_R_INVALID_PADDING_MODE 141 +#define RSA_R_INVALID_PSS_PARAMETERS 149 +#define RSA_R_INVALID_PSS_SALTLEN 146 +#define RSA_R_INVALID_REQUEST 175 +#define RSA_R_INVALID_SALT_LENGTH 150 +#define RSA_R_INVALID_STRENGTH 176 +#define RSA_R_INVALID_TRAILER 139 +#define RSA_R_INVALID_X931_DIGEST 142 +#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 +#define RSA_R_KEY_PRIME_NUM_INVALID 165 +#define RSA_R_KEY_SIZE_TOO_SMALL 120 +#define RSA_R_LAST_OCTET_INVALID 134 +#define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 +#define RSA_R_MISSING_PRIVATE_KEY 179 +#define RSA_R_MODULUS_TOO_LARGE 105 +#define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 +#define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 +#define RSA_R_MP_R_NOT_PRIME 170 +#define RSA_R_NO_PUBLIC_EXPONENT 140 +#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 +#define RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES 172 +#define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 +#define RSA_R_OAEP_DECODING_ERROR 121 +#define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 +#define RSA_R_PADDING_CHECK_FAILED 114 +#define RSA_R_PAIRWISE_TEST_FAILURE 177 +#define RSA_R_PKCS_DECODING_ERROR 159 +#define RSA_R_PSS_SALTLEN_TOO_SMALL 164 +#define RSA_R_PUB_EXPONENT_OUT_OF_RANGE 178 +#define RSA_R_P_NOT_PRIME 128 +#define RSA_R_Q_NOT_PRIME 129 +#define RSA_R_RANDOMNESS_SOURCE_STRENGTH_INSUFFICIENT 180 +#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 +#define RSA_R_SLEN_CHECK_FAILED 136 +#define RSA_R_SLEN_RECOVERY_FAILED 135 +#define RSA_R_SSLV3_ROLLBACK_ATTACK 115 +#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 +#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 +#define RSA_R_UNKNOWN_DIGEST 166 +#define RSA_R_UNKNOWN_MASK_DIGEST 151 +#define RSA_R_UNKNOWN_PADDING_TYPE 118 +#define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162 +#define RSA_R_UNSUPPORTED_LABEL_SOURCE 163 +#define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 +#define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 +#define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 +#define RSA_R_VALUE_MISSING 147 +#define RSA_R_WRONG_SIGNATURE_LENGTH 119 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/safestack.h b/VCMP-LUA/modules/postgresql/include/openssl/safestack.h new file mode 100644 index 0000000..5b9cf42 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/safestack.h @@ -0,0 +1,326 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\safestack.h.in + * + * Copyright 1999-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_SAFESTACK_H +#define OPENSSL_SAFESTACK_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_SAFESTACK_H +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define STACK_OF(type) struct stack_st_##type + +/* Helper macro for internal use */ +#define SKM_DEFINE_STACK_OF_INTERNAL(t1, t2, t3) \ + STACK_OF(t1); \ + typedef int (*sk_##t1##_compfunc)(const t3 *const *a, const t3 *const *b); \ + typedef void (*sk_##t1##_freefunc)(t3 * a); \ + typedef t3 *(*sk_##t1##_copyfunc)(const t3 *a); \ + static ossl_inline void sk_##t1##_freefunc_thunk(OPENSSL_sk_freefunc freefunc_arg, void *ptr) \ + { \ + sk_##t1##_freefunc freefunc = (sk_##t1##_freefunc)freefunc_arg; \ + freefunc((t3 *)ptr); \ + } \ + static ossl_unused ossl_inline t2 *ossl_check_##t1##_type(t2 *ptr) \ + { \ + return ptr; \ + } \ + static ossl_unused ossl_inline const OPENSSL_STACK *ossl_check_const_##t1##_sk_type(const STACK_OF(t1) *sk) \ + { \ + return (const OPENSSL_STACK *)sk; \ + } \ + static ossl_unused ossl_inline OPENSSL_STACK *ossl_check_##t1##_sk_type(STACK_OF(t1) *sk) \ + { \ + return (OPENSSL_STACK *)sk; \ + } \ + static ossl_unused ossl_inline OPENSSL_sk_compfunc ossl_check_##t1##_compfunc_type(sk_##t1##_compfunc cmp) \ + { \ + return (OPENSSL_sk_compfunc)cmp; \ + } \ + static ossl_unused ossl_inline OPENSSL_sk_copyfunc ossl_check_##t1##_copyfunc_type(sk_##t1##_copyfunc cpy) \ + { \ + return (OPENSSL_sk_copyfunc)cpy; \ + } \ + static ossl_unused ossl_inline OPENSSL_sk_freefunc ossl_check_##t1##_freefunc_type(sk_##t1##_freefunc fr) \ + { \ + return (OPENSSL_sk_freefunc)fr; \ + } + +#define SKM_DEFINE_STACK_OF(t1, t2, t3) \ + STACK_OF(t1); \ + typedef int (*sk_##t1##_compfunc)(const t3 *const *a, const t3 *const *b); \ + typedef void (*sk_##t1##_freefunc)(t3 * a); \ + typedef t3 *(*sk_##t1##_copyfunc)(const t3 *a); \ + static ossl_inline void sk_##t1##_freefunc_thunk(OPENSSL_sk_freefunc freefunc_arg, void *ptr) \ + { \ + sk_##t1##_freefunc freefunc = (sk_##t1##_freefunc)freefunc_arg; \ + freefunc((t3 *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk) \ + { \ + return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx) \ + { \ + return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare) \ + { \ + OPENSSL_STACK *ret = OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \ + OPENSSL_sk_freefunc_thunk f_thunk; \ + \ + f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \ + return (STACK_OF(t1) *)OPENSSL_sk_set_thunks(ret, f_thunk); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n) \ + { \ + OPENSSL_STACK *ret = OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n); \ + OPENSSL_sk_freefunc_thunk f_thunk; \ + \ + f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \ + return (STACK_OF(t1) *)OPENSSL_sk_set_thunks(ret, f_thunk); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n) \ + { \ + return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_free((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_zero((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i) \ + { \ + return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \ + (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \ + { \ + return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk) \ + { \ + return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc) \ + { \ + OPENSSL_sk_freefunc_thunk f_thunk; \ + \ + f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \ + sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \ + \ + OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \ + { \ + return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \ + { \ + return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_find_all(STACK_OF(t1) *sk, t2 *ptr, int *pnum) \ + { \ + return OPENSSL_sk_find_all((OPENSSL_STACK *)sk, (const void *)ptr, pnum); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_sort((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk) \ + { \ + return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_dup(const STACK_OF(t1) *sk) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \ + sk_##t1##_copyfunc copyfunc, \ + sk_##t1##_freefunc freefunc) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \ + (OPENSSL_sk_copyfunc)copyfunc, \ + (OPENSSL_sk_freefunc)freefunc); \ + } \ + static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare) \ + { \ + return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare); \ + } + +#define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t) +#define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t) +#define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2) +#define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \ + SKM_DEFINE_STACK_OF(t1, const t2, t2) + +/*- + * Strings are special: normally an lhash entry will point to a single + * (somewhat) mutable object. In the case of strings: + * + * a) Instead of a single char, there is an array of chars, NUL-terminated. + * b) The string may have be immutable. + * + * So, they need their own declarations. Especially important for + * type-checking tools, such as Deputy. + * + * In practice, however, it appears to be hard to have a const + * string. For now, I'm settling for dealing with the fact it is a + * string at all. + */ +typedef char *OPENSSL_STRING; +typedef const char *OPENSSL_CSTRING; + +/*- + * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but + * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned + * above, instead of a single char each entry is a NUL-terminated array of + * chars. So, we have to implement STRING specially for STACK_OF. This is + * dealt with in the autogenerated macros below. + */ +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OPENSSL_STRING, char, char) +#define sk_OPENSSL_STRING_num(sk) OPENSSL_sk_num(ossl_check_const_OPENSSL_STRING_sk_type(sk)) +#define sk_OPENSSL_STRING_value(sk, idx) ((char *)OPENSSL_sk_value(ossl_check_const_OPENSSL_STRING_sk_type(sk), (idx))) +#define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)OPENSSL_sk_new(ossl_check_OPENSSL_STRING_compfunc_type(cmp))) +#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)OPENSSL_sk_new_null()) +#define sk_OPENSSL_STRING_new_reserve(cmp, n) ((STACK_OF(OPENSSL_STRING) *)OPENSSL_sk_new_reserve(ossl_check_OPENSSL_STRING_compfunc_type(cmp), (n))) +#define sk_OPENSSL_STRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OPENSSL_STRING_sk_type(sk), (n)) +#define sk_OPENSSL_STRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_STRING_sk_type(sk)) +#define sk_OPENSSL_STRING_zero(sk) OPENSSL_sk_zero(ossl_check_OPENSSL_STRING_sk_type(sk)) +#define sk_OPENSSL_STRING_delete(sk, i) ((char *)OPENSSL_sk_delete(ossl_check_OPENSSL_STRING_sk_type(sk), (i))) +#define sk_OPENSSL_STRING_delete_ptr(sk, ptr) ((char *)OPENSSL_sk_delete_ptr(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_type(ptr))) +#define sk_OPENSSL_STRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_type(ptr)) +#define sk_OPENSSL_STRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_type(ptr)) +#define sk_OPENSSL_STRING_pop(sk) ((char *)OPENSSL_sk_pop(ossl_check_OPENSSL_STRING_sk_type(sk))) +#define sk_OPENSSL_STRING_shift(sk) ((char *)OPENSSL_sk_shift(ossl_check_OPENSSL_STRING_sk_type(sk))) +#define sk_OPENSSL_STRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_freefunc_type(freefunc)) +#define sk_OPENSSL_STRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_type(ptr), (idx)) +#define sk_OPENSSL_STRING_set(sk, idx, ptr) ((char *)OPENSSL_sk_set(ossl_check_OPENSSL_STRING_sk_type(sk), (idx), ossl_check_OPENSSL_STRING_type(ptr))) +#define sk_OPENSSL_STRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_type(ptr)) +#define sk_OPENSSL_STRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_type(ptr)) +#define sk_OPENSSL_STRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_type(ptr), pnum) +#define sk_OPENSSL_STRING_sort(sk) OPENSSL_sk_sort(ossl_check_OPENSSL_STRING_sk_type(sk)) +#define sk_OPENSSL_STRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OPENSSL_STRING_sk_type(sk)) +#define sk_OPENSSL_STRING_dup(sk) ((STACK_OF(OPENSSL_STRING) *)OPENSSL_sk_dup(ossl_check_const_OPENSSL_STRING_sk_type(sk))) +#define sk_OPENSSL_STRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OPENSSL_STRING) *)OPENSSL_sk_deep_copy(ossl_check_const_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_copyfunc_type(copyfunc), ossl_check_OPENSSL_STRING_freefunc_type(freefunc))) +#define sk_OPENSSL_STRING_set_cmp_func(sk, cmp) ((sk_OPENSSL_STRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OPENSSL_STRING_sk_type(sk), ossl_check_OPENSSL_STRING_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(OPENSSL_CSTRING, const char, char) +#define sk_OPENSSL_CSTRING_num(sk) OPENSSL_sk_num(ossl_check_const_OPENSSL_CSTRING_sk_type(sk)) +#define sk_OPENSSL_CSTRING_value(sk, idx) ((const char *)OPENSSL_sk_value(ossl_check_const_OPENSSL_CSTRING_sk_type(sk), (idx))) +#define sk_OPENSSL_CSTRING_new(cmp) ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new(ossl_check_OPENSSL_CSTRING_compfunc_type(cmp))) +#define sk_OPENSSL_CSTRING_new_null() ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new_null()) +#define sk_OPENSSL_CSTRING_new_reserve(cmp, n) ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new_reserve(ossl_check_OPENSSL_CSTRING_compfunc_type(cmp), (n))) +#define sk_OPENSSL_CSTRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OPENSSL_CSTRING_sk_type(sk), (n)) +#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk)) +#define sk_OPENSSL_CSTRING_zero(sk) OPENSSL_sk_zero(ossl_check_OPENSSL_CSTRING_sk_type(sk)) +#define sk_OPENSSL_CSTRING_delete(sk, i) ((const char *)OPENSSL_sk_delete(ossl_check_OPENSSL_CSTRING_sk_type(sk), (i))) +#define sk_OPENSSL_CSTRING_delete_ptr(sk, ptr) ((const char *)OPENSSL_sk_delete_ptr(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr))) +#define sk_OPENSSL_CSTRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr)) +#define sk_OPENSSL_CSTRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr)) +#define sk_OPENSSL_CSTRING_pop(sk) ((const char *)OPENSSL_sk_pop(ossl_check_OPENSSL_CSTRING_sk_type(sk))) +#define sk_OPENSSL_CSTRING_shift(sk) ((const char *)OPENSSL_sk_shift(ossl_check_OPENSSL_CSTRING_sk_type(sk))) +#define sk_OPENSSL_CSTRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_freefunc_type(freefunc)) +#define sk_OPENSSL_CSTRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr), (idx)) +#define sk_OPENSSL_CSTRING_set(sk, idx, ptr) ((const char *)OPENSSL_sk_set(ossl_check_OPENSSL_CSTRING_sk_type(sk), (idx), ossl_check_OPENSSL_CSTRING_type(ptr))) +#define sk_OPENSSL_CSTRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr)) +#define sk_OPENSSL_CSTRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr)) +#define sk_OPENSSL_CSTRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr), pnum) +#define sk_OPENSSL_CSTRING_sort(sk) OPENSSL_sk_sort(ossl_check_OPENSSL_CSTRING_sk_type(sk)) +#define sk_OPENSSL_CSTRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OPENSSL_CSTRING_sk_type(sk)) +#define sk_OPENSSL_CSTRING_dup(sk) ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_dup(ossl_check_const_OPENSSL_CSTRING_sk_type(sk))) +#define sk_OPENSSL_CSTRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_deep_copy(ossl_check_const_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_copyfunc_type(copyfunc), ossl_check_OPENSSL_CSTRING_freefunc_type(freefunc))) +#define sk_OPENSSL_CSTRING_set_cmp_func(sk, cmp) ((sk_OPENSSL_CSTRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_compfunc_type(cmp))) + +/* clang-format on */ + +#if !defined(OPENSSL_NO_DEPRECATED_3_0) +/* + * This is not used by OpenSSL. A block of bytes, NOT nul-terminated. + * These should also be distinguished from "normal" stacks. + */ +typedef void *OPENSSL_BLOCK; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OPENSSL_BLOCK, void, void) +#define sk_OPENSSL_BLOCK_num(sk) OPENSSL_sk_num(ossl_check_const_OPENSSL_BLOCK_sk_type(sk)) +#define sk_OPENSSL_BLOCK_value(sk, idx) ((void *)OPENSSL_sk_value(ossl_check_const_OPENSSL_BLOCK_sk_type(sk), (idx))) +#define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)OPENSSL_sk_new(ossl_check_OPENSSL_BLOCK_compfunc_type(cmp))) +#define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)OPENSSL_sk_new_null()) +#define sk_OPENSSL_BLOCK_new_reserve(cmp, n) ((STACK_OF(OPENSSL_BLOCK) *)OPENSSL_sk_new_reserve(ossl_check_OPENSSL_BLOCK_compfunc_type(cmp), (n))) +#define sk_OPENSSL_BLOCK_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OPENSSL_BLOCK_sk_type(sk), (n)) +#define sk_OPENSSL_BLOCK_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_BLOCK_sk_type(sk)) +#define sk_OPENSSL_BLOCK_zero(sk) OPENSSL_sk_zero(ossl_check_OPENSSL_BLOCK_sk_type(sk)) +#define sk_OPENSSL_BLOCK_delete(sk, i) ((void *)OPENSSL_sk_delete(ossl_check_OPENSSL_BLOCK_sk_type(sk), (i))) +#define sk_OPENSSL_BLOCK_delete_ptr(sk, ptr) ((void *)OPENSSL_sk_delete_ptr(ossl_check_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_type(ptr))) +#define sk_OPENSSL_BLOCK_push(sk, ptr) OPENSSL_sk_push(ossl_check_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_type(ptr)) +#define sk_OPENSSL_BLOCK_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_type(ptr)) +#define sk_OPENSSL_BLOCK_pop(sk) ((void *)OPENSSL_sk_pop(ossl_check_OPENSSL_BLOCK_sk_type(sk))) +#define sk_OPENSSL_BLOCK_shift(sk) ((void *)OPENSSL_sk_shift(ossl_check_OPENSSL_BLOCK_sk_type(sk))) +#define sk_OPENSSL_BLOCK_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_freefunc_type(freefunc)) +#define sk_OPENSSL_BLOCK_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_type(ptr), (idx)) +#define sk_OPENSSL_BLOCK_set(sk, idx, ptr) ((void *)OPENSSL_sk_set(ossl_check_OPENSSL_BLOCK_sk_type(sk), (idx), ossl_check_OPENSSL_BLOCK_type(ptr))) +#define sk_OPENSSL_BLOCK_find(sk, ptr) OPENSSL_sk_find(ossl_check_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_type(ptr)) +#define sk_OPENSSL_BLOCK_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_type(ptr)) +#define sk_OPENSSL_BLOCK_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_type(ptr), pnum) +#define sk_OPENSSL_BLOCK_sort(sk) OPENSSL_sk_sort(ossl_check_OPENSSL_BLOCK_sk_type(sk)) +#define sk_OPENSSL_BLOCK_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OPENSSL_BLOCK_sk_type(sk)) +#define sk_OPENSSL_BLOCK_dup(sk) ((STACK_OF(OPENSSL_BLOCK) *)OPENSSL_sk_dup(ossl_check_const_OPENSSL_BLOCK_sk_type(sk))) +#define sk_OPENSSL_BLOCK_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OPENSSL_BLOCK) *)OPENSSL_sk_deep_copy(ossl_check_const_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_copyfunc_type(copyfunc), ossl_check_OPENSSL_BLOCK_freefunc_type(freefunc))) +#define sk_OPENSSL_BLOCK_set_cmp_func(sk, cmp) ((sk_OPENSSL_BLOCK_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OPENSSL_BLOCK_sk_type(sk), ossl_check_OPENSSL_BLOCK_compfunc_type(cmp))) + +/* clang-format on */ +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/seed.h b/VCMP-LUA/modules/postgresql/include/openssl/seed.h new file mode 100644 index 0000000..8c2b20a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/seed.h @@ -0,0 +1,112 @@ +/* + * Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Neither the name of author nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef OPENSSL_SEED_H +#define OPENSSL_SEED_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_SEED_H +#endif + +#include + +#ifndef OPENSSL_NO_SEED +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SEED_BLOCK_SIZE 16 +#define SEED_KEY_LENGTH 16 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* look whether we need 'long' to get 32 bits */ +#ifdef AES_LONG +#ifndef SEED_LONG +#define SEED_LONG 1 +#endif +#endif + +typedef struct seed_key_st { +#ifdef SEED_LONG + unsigned long data[32]; +#else + unsigned int data[32]; +#endif +} SEED_KEY_SCHEDULE; +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], + SEED_KEY_SCHEDULE *ks); +OSSL_DEPRECATEDIN_3_0 +void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE *ks); +OSSL_DEPRECATEDIN_3_0 +void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE *ks); +OSSL_DEPRECATEDIN_3_0 +void SEED_ecb_encrypt(const unsigned char *in, + unsigned char *out, + const SEED_KEY_SCHEDULE *ks, int enc); +OSSL_DEPRECATEDIN_3_0 +void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, + const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], + int enc); +OSSL_DEPRECATEDIN_3_0 +void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], + int *num, int enc); +OSSL_DEPRECATEDIN_3_0 +void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], + int *num); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/self_test.h b/VCMP-LUA/modules/postgresql/include/openssl/self_test.h new file mode 100644 index 0000000..6e671c1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/self_test.h @@ -0,0 +1,116 @@ +/* + * Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_SELF_TEST_H +#define OPENSSL_SELF_TEST_H +#pragma once + +#include /* OSSL_CALLBACK */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* The test event phases */ +#define OSSL_SELF_TEST_PHASE_NONE "None" +#define OSSL_SELF_TEST_PHASE_START "Start" +#define OSSL_SELF_TEST_PHASE_CORRUPT "Corrupt" +#define OSSL_SELF_TEST_PHASE_PASS "Pass" +#define OSSL_SELF_TEST_PHASE_FAIL "Fail" + +/* Test event categories */ +#define OSSL_SELF_TEST_TYPE_NONE "None" +#define OSSL_SELF_TEST_TYPE_MODULE_INTEGRITY "Module_Integrity" +#define OSSL_SELF_TEST_TYPE_INSTALL_INTEGRITY "Install_Integrity" +#define OSSL_SELF_TEST_TYPE_CRNG "Continuous_RNG_Test" +#define OSSL_SELF_TEST_TYPE_PCT "Conditional_PCT" +#define OSSL_SELF_TEST_TYPE_PCT_KAT "Conditional_KAT" +#define OSSL_SELF_TEST_TYPE_PCT_IMPORT "Import_PCT" +#define OSSL_SELF_TEST_TYPE_KAT_INTEGRITY "KAT_Integrity" +#define OSSL_SELF_TEST_TYPE_KAT_CIPHER "KAT_Cipher" +#define OSSL_SELF_TEST_TYPE_KAT_ASYM_CIPHER "KAT_AsymmetricCipher" +#define OSSL_SELF_TEST_TYPE_KAT_ASYM_KEYGEN "KAT_AsymmetricKeyGeneration" +#define OSSL_SELF_TEST_TYPE_KAT_KEM "KAT_KEM" +#define OSSL_SELF_TEST_TYPE_KAT_DIGEST "KAT_Digest" +#define OSSL_SELF_TEST_TYPE_KAT_SIGNATURE "KAT_Signature" +#define OSSL_SELF_TEST_TYPE_PCT_SIGNATURE "PCT_Signature" +#define OSSL_SELF_TEST_TYPE_KAT_KDF "KAT_KDF" +#define OSSL_SELF_TEST_TYPE_KAT_KA "KAT_KA" +#define OSSL_SELF_TEST_TYPE_DRBG "DRBG" + +/* Test event sub categories */ +#define OSSL_SELF_TEST_DESC_NONE "None" +#define OSSL_SELF_TEST_DESC_INTEGRITY_HMAC "HMAC" +#define OSSL_SELF_TEST_DESC_PCT_RSA "RSA" +#define OSSL_SELF_TEST_DESC_PCT_RSA_PKCS1 "RSA" +#define OSSL_SELF_TEST_DESC_PCT_ECDSA "ECDSA" +#define OSSL_SELF_TEST_DESC_PCT_EDDSA "EDDSA" +#define OSSL_SELF_TEST_DESC_PCT_DH "DH" +#define OSSL_SELF_TEST_DESC_PCT_DSA "DSA" +#define OSSL_SELF_TEST_DESC_PCT_ML_DSA "ML-DSA" +#define OSSL_SELF_TEST_DESC_PCT_ML_KEM "ML-KEM" +#define OSSL_SELF_TEST_DESC_PCT_SLH_DSA "SLH-DSA" +#define OSSL_SELF_TEST_DESC_CIPHER_AES_GCM "AES_GCM" +#define OSSL_SELF_TEST_DESC_CIPHER_AES_ECB "AES_ECB_Decrypt" +#define OSSL_SELF_TEST_DESC_CIPHER_TDES "TDES" +#define OSSL_SELF_TEST_DESC_ASYM_RSA_ENC "RSA_Encrypt" +#define OSSL_SELF_TEST_DESC_ASYM_RSA_DEC "RSA_Decrypt" +#define OSSL_SELF_TEST_DESC_MD_SHA1 "SHA1" +#define OSSL_SELF_TEST_DESC_MD_SHA2 "SHA2" +#define OSSL_SELF_TEST_DESC_MD_SHA3 "SHA3" +#define OSSL_SELF_TEST_DESC_SIGN_DSA "DSA" +#define OSSL_SELF_TEST_DESC_SIGN_RSA "RSA" +#define OSSL_SELF_TEST_DESC_SIGN_ECDSA "ECDSA" +#define OSSL_SELF_TEST_DESC_SIGN_DetECDSA "DetECDSA" +#define OSSL_SELF_TEST_DESC_SIGN_EDDSA "EDDSA" +#define OSSL_SELF_TEST_DESC_SIGN_LMS "LMS" +#define OSSL_SELF_TEST_DESC_SIGN_ML_DSA "ML-DSA" +#define OSSL_SELF_TEST_DESC_SIGN_SLH_DSA "SLH-DSA" +#define OSSL_SELF_TEST_DESC_KEM "KEM" +#define OSSL_SELF_TEST_DESC_DRBG_CTR "CTR" +#define OSSL_SELF_TEST_DESC_DRBG_HASH "HASH" +#define OSSL_SELF_TEST_DESC_DRBG_HMAC "HMAC" +#define OSSL_SELF_TEST_DESC_KA_DH "DH" +#define OSSL_SELF_TEST_DESC_KA_ECDH "ECDH" +#define OSSL_SELF_TEST_DESC_KDF_HKDF "HKDF" +#define OSSL_SELF_TEST_DESC_KDF_SSKDF "SSKDF" +#define OSSL_SELF_TEST_DESC_KDF_X963KDF "X963KDF" +#define OSSL_SELF_TEST_DESC_KDF_X942KDF "X942KDF" +#define OSSL_SELF_TEST_DESC_KDF_PBKDF2 "PBKDF2" +#define OSSL_SELF_TEST_DESC_KDF_SSHKDF "SSHKDF" +#define OSSL_SELF_TEST_DESC_KDF_TLS12_PRF "TLS12_PRF" +#define OSSL_SELF_TEST_DESC_KDF_KBKDF "KBKDF" +#define OSSL_SELF_TEST_DESC_KDF_KBKDF_KMAC "KBKDF_KMAC" +#define OSSL_SELF_TEST_DESC_KDF_TLS13_EXTRACT "TLS13_KDF_EXTRACT" +#define OSSL_SELF_TEST_DESC_KDF_TLS13_EXPAND "TLS13_KDF_EXPAND" +#define OSSL_SELF_TEST_DESC_RNG "RNG" +#define OSSL_SELF_TEST_DESC_KEYGEN_ML_DSA "ML-DSA" +#define OSSL_SELF_TEST_DESC_KEYGEN_ML_KEM "ML-KEM" +#define OSSL_SELF_TEST_DESC_KEYGEN_SLH_DSA "SLH-DSA" +#define OSSL_SELF_TEST_DESC_ENCAP_KEM "KEM_Encap" +#define OSSL_SELF_TEST_DESC_DECAP_KEM "KEM_Decap" +#define OSSL_SELF_TEST_DESC_DECAP_KEM_FAIL "KEM_Decap_Reject" + +void OSSL_SELF_TEST_set_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK *cb, + void *cbarg); +void OSSL_SELF_TEST_get_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK **cb, + void **cbarg); + +OSSL_SELF_TEST *OSSL_SELF_TEST_new(OSSL_CALLBACK *cb, void *cbarg); +void OSSL_SELF_TEST_free(OSSL_SELF_TEST *st); + +void OSSL_SELF_TEST_onbegin(OSSL_SELF_TEST *st, const char *type, + const char *desc); +int OSSL_SELF_TEST_oncorrupt_byte(OSSL_SELF_TEST *st, unsigned char *bytes); +void OSSL_SELF_TEST_onend(OSSL_SELF_TEST *st, int ret); + +#ifdef __cplusplus +} +#endif +#endif /* OPENSSL_SELF_TEST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/sha.h b/VCMP-LUA/modules/postgresql/include/openssl/sha.h new file mode 100644 index 0000000..52b0266 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/sha.h @@ -0,0 +1,139 @@ +/* + * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_SHA_H +#define OPENSSL_SHA_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_SHA_H +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SHA_DIGEST_LENGTH 20 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! SHA_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +#define SHA_LONG unsigned int + +#define SHA_LBLOCK 16 +#define SHA_CBLOCK (SHA_LBLOCK * 4) /* SHA treats input data as a \ + * contiguous array of 32 bit wide \ + * big-endian values. */ +#define SHA_LAST_BLOCK (SHA_CBLOCK - 8) + +typedef struct SHAstate_st { + SHA_LONG h0, h1, h2, h3, h4; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num; +} SHA_CTX; + +OSSL_DEPRECATEDIN_3_0 int SHA1_Init(SHA_CTX *c); +OSSL_DEPRECATEDIN_3_0 int SHA1_Update(SHA_CTX *c, const void *data, size_t len); +OSSL_DEPRECATEDIN_3_0 int SHA1_Final(unsigned char *md, SHA_CTX *c); +OSSL_DEPRECATEDIN_3_0 void SHA1_Transform(SHA_CTX *c, const unsigned char *data); +#endif + +unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SHA256_CBLOCK (SHA_LBLOCK * 4) /* SHA-256 treats input data as a \ + * contiguous array of 32 bit wide \ + * big-endian values. */ + +typedef struct SHA256state_st { + SHA_LONG h[8]; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num, md_len; +} SHA256_CTX; + +OSSL_DEPRECATEDIN_3_0 int SHA224_Init(SHA256_CTX *c); +OSSL_DEPRECATEDIN_3_0 int SHA224_Update(SHA256_CTX *c, + const void *data, size_t len); +OSSL_DEPRECATEDIN_3_0 int SHA224_Final(unsigned char *md, SHA256_CTX *c); +OSSL_DEPRECATEDIN_3_0 int SHA256_Init(SHA256_CTX *c); +OSSL_DEPRECATEDIN_3_0 int SHA256_Update(SHA256_CTX *c, + const void *data, size_t len); +OSSL_DEPRECATEDIN_3_0 int SHA256_Final(unsigned char *md, SHA256_CTX *c); +OSSL_DEPRECATEDIN_3_0 void SHA256_Transform(SHA256_CTX *c, + const unsigned char *data); +#endif + +unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); +unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); + +#define SHA256_192_DIGEST_LENGTH 24 +#define SHA224_DIGEST_LENGTH 28 +#define SHA256_DIGEST_LENGTH 32 +#define SHA384_DIGEST_LENGTH 48 +#define SHA512_DIGEST_LENGTH 64 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* + * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 + * being exactly 64-bit wide. See Implementation Notes in sha512.c + * for further details. + */ +/* + * SHA-512 treats input data as a + * contiguous array of 64 bit + * wide big-endian values. + */ +#define SHA512_CBLOCK (SHA_LBLOCK * 8) +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) +#define SHA_LONG64 unsigned __int64 +#elif defined(__arch64__) +#define SHA_LONG64 unsigned long +#else +#define SHA_LONG64 unsigned long long +#endif + +typedef struct SHA512state_st { + SHA_LONG64 h[8]; + SHA_LONG64 Nl, Nh; + union { + SHA_LONG64 d[SHA_LBLOCK]; + unsigned char p[SHA512_CBLOCK]; + } u; + unsigned int num, md_len; +} SHA512_CTX; + +OSSL_DEPRECATEDIN_3_0 int SHA384_Init(SHA512_CTX *c); +OSSL_DEPRECATEDIN_3_0 int SHA384_Update(SHA512_CTX *c, + const void *data, size_t len); +OSSL_DEPRECATEDIN_3_0 int SHA384_Final(unsigned char *md, SHA512_CTX *c); +OSSL_DEPRECATEDIN_3_0 int SHA512_Init(SHA512_CTX *c); +OSSL_DEPRECATEDIN_3_0 int SHA512_Update(SHA512_CTX *c, + const void *data, size_t len); +OSSL_DEPRECATEDIN_3_0 int SHA512_Final(unsigned char *md, SHA512_CTX *c); +OSSL_DEPRECATEDIN_3_0 void SHA512_Transform(SHA512_CTX *c, + const unsigned char *data); +#endif + +unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); +unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/srp.h b/VCMP-LUA/modules/postgresql/include/openssl/srp.h new file mode 100644 index 0000000..a0fdc89 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/srp.h @@ -0,0 +1,291 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\srp.h.in + * + * Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2004, EdelKey Project. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + * + * Originally written by Christophe Renou and Peter Sylvester, + * for the EdelKey project. + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_SRP_H +#define OPENSSL_SRP_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_SRP_H +#endif + +#include + +#ifndef OPENSSL_NO_SRP +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + +typedef struct SRP_gN_cache_st { + char *b64_bn; + BIGNUM *bn; +} SRP_gN_cache; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(SRP_gN_cache, SRP_gN_cache, SRP_gN_cache) +#define sk_SRP_gN_cache_num(sk) OPENSSL_sk_num(ossl_check_const_SRP_gN_cache_sk_type(sk)) +#define sk_SRP_gN_cache_value(sk, idx) ((SRP_gN_cache *)OPENSSL_sk_value(ossl_check_const_SRP_gN_cache_sk_type(sk), (idx))) +#define sk_SRP_gN_cache_new(cmp) ((STACK_OF(SRP_gN_cache) *)OPENSSL_sk_new(ossl_check_SRP_gN_cache_compfunc_type(cmp))) +#define sk_SRP_gN_cache_new_null() ((STACK_OF(SRP_gN_cache) *)OPENSSL_sk_new_null()) +#define sk_SRP_gN_cache_new_reserve(cmp, n) ((STACK_OF(SRP_gN_cache) *)OPENSSL_sk_new_reserve(ossl_check_SRP_gN_cache_compfunc_type(cmp), (n))) +#define sk_SRP_gN_cache_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SRP_gN_cache_sk_type(sk), (n)) +#define sk_SRP_gN_cache_free(sk) OPENSSL_sk_free(ossl_check_SRP_gN_cache_sk_type(sk)) +#define sk_SRP_gN_cache_zero(sk) OPENSSL_sk_zero(ossl_check_SRP_gN_cache_sk_type(sk)) +#define sk_SRP_gN_cache_delete(sk, i) ((SRP_gN_cache *)OPENSSL_sk_delete(ossl_check_SRP_gN_cache_sk_type(sk), (i))) +#define sk_SRP_gN_cache_delete_ptr(sk, ptr) ((SRP_gN_cache *)OPENSSL_sk_delete_ptr(ossl_check_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_type(ptr))) +#define sk_SRP_gN_cache_push(sk, ptr) OPENSSL_sk_push(ossl_check_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_type(ptr)) +#define sk_SRP_gN_cache_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_type(ptr)) +#define sk_SRP_gN_cache_pop(sk) ((SRP_gN_cache *)OPENSSL_sk_pop(ossl_check_SRP_gN_cache_sk_type(sk))) +#define sk_SRP_gN_cache_shift(sk) ((SRP_gN_cache *)OPENSSL_sk_shift(ossl_check_SRP_gN_cache_sk_type(sk))) +#define sk_SRP_gN_cache_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_freefunc_type(freefunc)) +#define sk_SRP_gN_cache_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_type(ptr), (idx)) +#define sk_SRP_gN_cache_set(sk, idx, ptr) ((SRP_gN_cache *)OPENSSL_sk_set(ossl_check_SRP_gN_cache_sk_type(sk), (idx), ossl_check_SRP_gN_cache_type(ptr))) +#define sk_SRP_gN_cache_find(sk, ptr) OPENSSL_sk_find(ossl_check_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_type(ptr)) +#define sk_SRP_gN_cache_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_type(ptr)) +#define sk_SRP_gN_cache_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_type(ptr), pnum) +#define sk_SRP_gN_cache_sort(sk) OPENSSL_sk_sort(ossl_check_SRP_gN_cache_sk_type(sk)) +#define sk_SRP_gN_cache_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SRP_gN_cache_sk_type(sk)) +#define sk_SRP_gN_cache_dup(sk) ((STACK_OF(SRP_gN_cache) *)OPENSSL_sk_dup(ossl_check_const_SRP_gN_cache_sk_type(sk))) +#define sk_SRP_gN_cache_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SRP_gN_cache) *)OPENSSL_sk_deep_copy(ossl_check_const_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_copyfunc_type(copyfunc), ossl_check_SRP_gN_cache_freefunc_type(freefunc))) +#define sk_SRP_gN_cache_set_cmp_func(sk, cmp) ((sk_SRP_gN_cache_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SRP_gN_cache_sk_type(sk), ossl_check_SRP_gN_cache_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct SRP_user_pwd_st { + /* Owned by us. */ + char *id; + BIGNUM *s; + BIGNUM *v; + /* Not owned by us. */ + const BIGNUM *g; + const BIGNUM *N; + /* Owned by us. */ + char *info; +} SRP_user_pwd; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(SRP_user_pwd, SRP_user_pwd, SRP_user_pwd) +#define sk_SRP_user_pwd_num(sk) OPENSSL_sk_num(ossl_check_const_SRP_user_pwd_sk_type(sk)) +#define sk_SRP_user_pwd_value(sk, idx) ((SRP_user_pwd *)OPENSSL_sk_value(ossl_check_const_SRP_user_pwd_sk_type(sk), (idx))) +#define sk_SRP_user_pwd_new(cmp) ((STACK_OF(SRP_user_pwd) *)OPENSSL_sk_new(ossl_check_SRP_user_pwd_compfunc_type(cmp))) +#define sk_SRP_user_pwd_new_null() ((STACK_OF(SRP_user_pwd) *)OPENSSL_sk_new_null()) +#define sk_SRP_user_pwd_new_reserve(cmp, n) ((STACK_OF(SRP_user_pwd) *)OPENSSL_sk_new_reserve(ossl_check_SRP_user_pwd_compfunc_type(cmp), (n))) +#define sk_SRP_user_pwd_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SRP_user_pwd_sk_type(sk), (n)) +#define sk_SRP_user_pwd_free(sk) OPENSSL_sk_free(ossl_check_SRP_user_pwd_sk_type(sk)) +#define sk_SRP_user_pwd_zero(sk) OPENSSL_sk_zero(ossl_check_SRP_user_pwd_sk_type(sk)) +#define sk_SRP_user_pwd_delete(sk, i) ((SRP_user_pwd *)OPENSSL_sk_delete(ossl_check_SRP_user_pwd_sk_type(sk), (i))) +#define sk_SRP_user_pwd_delete_ptr(sk, ptr) ((SRP_user_pwd *)OPENSSL_sk_delete_ptr(ossl_check_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_type(ptr))) +#define sk_SRP_user_pwd_push(sk, ptr) OPENSSL_sk_push(ossl_check_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_type(ptr)) +#define sk_SRP_user_pwd_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_type(ptr)) +#define sk_SRP_user_pwd_pop(sk) ((SRP_user_pwd *)OPENSSL_sk_pop(ossl_check_SRP_user_pwd_sk_type(sk))) +#define sk_SRP_user_pwd_shift(sk) ((SRP_user_pwd *)OPENSSL_sk_shift(ossl_check_SRP_user_pwd_sk_type(sk))) +#define sk_SRP_user_pwd_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_freefunc_type(freefunc)) +#define sk_SRP_user_pwd_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_type(ptr), (idx)) +#define sk_SRP_user_pwd_set(sk, idx, ptr) ((SRP_user_pwd *)OPENSSL_sk_set(ossl_check_SRP_user_pwd_sk_type(sk), (idx), ossl_check_SRP_user_pwd_type(ptr))) +#define sk_SRP_user_pwd_find(sk, ptr) OPENSSL_sk_find(ossl_check_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_type(ptr)) +#define sk_SRP_user_pwd_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_type(ptr)) +#define sk_SRP_user_pwd_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_type(ptr), pnum) +#define sk_SRP_user_pwd_sort(sk) OPENSSL_sk_sort(ossl_check_SRP_user_pwd_sk_type(sk)) +#define sk_SRP_user_pwd_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SRP_user_pwd_sk_type(sk)) +#define sk_SRP_user_pwd_dup(sk) ((STACK_OF(SRP_user_pwd) *)OPENSSL_sk_dup(ossl_check_const_SRP_user_pwd_sk_type(sk))) +#define sk_SRP_user_pwd_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SRP_user_pwd) *)OPENSSL_sk_deep_copy(ossl_check_const_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_copyfunc_type(copyfunc), ossl_check_SRP_user_pwd_freefunc_type(freefunc))) +#define sk_SRP_user_pwd_set_cmp_func(sk, cmp) ((sk_SRP_user_pwd_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SRP_user_pwd_sk_type(sk), ossl_check_SRP_user_pwd_compfunc_type(cmp))) + +/* clang-format on */ + +OSSL_DEPRECATEDIN_3_0 +SRP_user_pwd *SRP_user_pwd_new(void); +OSSL_DEPRECATEDIN_3_0 +void SRP_user_pwd_free(SRP_user_pwd *user_pwd); + +OSSL_DEPRECATEDIN_3_0 +void SRP_user_pwd_set_gN(SRP_user_pwd *user_pwd, const BIGNUM *g, + const BIGNUM *N); +OSSL_DEPRECATEDIN_3_0 +int SRP_user_pwd_set1_ids(SRP_user_pwd *user_pwd, const char *id, + const char *info); +OSSL_DEPRECATEDIN_3_0 +int SRP_user_pwd_set0_sv(SRP_user_pwd *user_pwd, BIGNUM *s, BIGNUM *v); + +typedef struct SRP_VBASE_st { + STACK_OF(SRP_user_pwd) *users_pwd; + STACK_OF(SRP_gN_cache) *gN_cache; + /* to simulate a user */ + char *seed_key; + const BIGNUM *default_g; + const BIGNUM *default_N; +} SRP_VBASE; + +/* + * Internal structure storing N and g pair + */ +typedef struct SRP_gN_st { + char *id; + const BIGNUM *g; + const BIGNUM *N; +} SRP_gN; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(SRP_gN, SRP_gN, SRP_gN) +#define sk_SRP_gN_num(sk) OPENSSL_sk_num(ossl_check_const_SRP_gN_sk_type(sk)) +#define sk_SRP_gN_value(sk, idx) ((SRP_gN *)OPENSSL_sk_value(ossl_check_const_SRP_gN_sk_type(sk), (idx))) +#define sk_SRP_gN_new(cmp) ((STACK_OF(SRP_gN) *)OPENSSL_sk_new(ossl_check_SRP_gN_compfunc_type(cmp))) +#define sk_SRP_gN_new_null() ((STACK_OF(SRP_gN) *)OPENSSL_sk_new_null()) +#define sk_SRP_gN_new_reserve(cmp, n) ((STACK_OF(SRP_gN) *)OPENSSL_sk_new_reserve(ossl_check_SRP_gN_compfunc_type(cmp), (n))) +#define sk_SRP_gN_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SRP_gN_sk_type(sk), (n)) +#define sk_SRP_gN_free(sk) OPENSSL_sk_free(ossl_check_SRP_gN_sk_type(sk)) +#define sk_SRP_gN_zero(sk) OPENSSL_sk_zero(ossl_check_SRP_gN_sk_type(sk)) +#define sk_SRP_gN_delete(sk, i) ((SRP_gN *)OPENSSL_sk_delete(ossl_check_SRP_gN_sk_type(sk), (i))) +#define sk_SRP_gN_delete_ptr(sk, ptr) ((SRP_gN *)OPENSSL_sk_delete_ptr(ossl_check_SRP_gN_sk_type(sk), ossl_check_SRP_gN_type(ptr))) +#define sk_SRP_gN_push(sk, ptr) OPENSSL_sk_push(ossl_check_SRP_gN_sk_type(sk), ossl_check_SRP_gN_type(ptr)) +#define sk_SRP_gN_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SRP_gN_sk_type(sk), ossl_check_SRP_gN_type(ptr)) +#define sk_SRP_gN_pop(sk) ((SRP_gN *)OPENSSL_sk_pop(ossl_check_SRP_gN_sk_type(sk))) +#define sk_SRP_gN_shift(sk) ((SRP_gN *)OPENSSL_sk_shift(ossl_check_SRP_gN_sk_type(sk))) +#define sk_SRP_gN_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SRP_gN_sk_type(sk), ossl_check_SRP_gN_freefunc_type(freefunc)) +#define sk_SRP_gN_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SRP_gN_sk_type(sk), ossl_check_SRP_gN_type(ptr), (idx)) +#define sk_SRP_gN_set(sk, idx, ptr) ((SRP_gN *)OPENSSL_sk_set(ossl_check_SRP_gN_sk_type(sk), (idx), ossl_check_SRP_gN_type(ptr))) +#define sk_SRP_gN_find(sk, ptr) OPENSSL_sk_find(ossl_check_SRP_gN_sk_type(sk), ossl_check_SRP_gN_type(ptr)) +#define sk_SRP_gN_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SRP_gN_sk_type(sk), ossl_check_SRP_gN_type(ptr)) +#define sk_SRP_gN_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SRP_gN_sk_type(sk), ossl_check_SRP_gN_type(ptr), pnum) +#define sk_SRP_gN_sort(sk) OPENSSL_sk_sort(ossl_check_SRP_gN_sk_type(sk)) +#define sk_SRP_gN_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SRP_gN_sk_type(sk)) +#define sk_SRP_gN_dup(sk) ((STACK_OF(SRP_gN) *)OPENSSL_sk_dup(ossl_check_const_SRP_gN_sk_type(sk))) +#define sk_SRP_gN_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SRP_gN) *)OPENSSL_sk_deep_copy(ossl_check_const_SRP_gN_sk_type(sk), ossl_check_SRP_gN_copyfunc_type(copyfunc), ossl_check_SRP_gN_freefunc_type(freefunc))) +#define sk_SRP_gN_set_cmp_func(sk, cmp) ((sk_SRP_gN_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SRP_gN_sk_type(sk), ossl_check_SRP_gN_compfunc_type(cmp))) + +/* clang-format on */ + +OSSL_DEPRECATEDIN_3_0 +SRP_VBASE *SRP_VBASE_new(char *seed_key); +OSSL_DEPRECATEDIN_3_0 +void SRP_VBASE_free(SRP_VBASE *vb); +OSSL_DEPRECATEDIN_3_0 +int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); + +OSSL_DEPRECATEDIN_3_0 +int SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd); + +/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ +OSSL_DEPRECATEDIN_3_0 +SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); + +OSSL_DEPRECATEDIN_3_0 +char *SRP_create_verifier_ex(const char *user, const char *pass, char **salt, + char **verifier, const char *N, const char *g, + OSSL_LIB_CTX *libctx, const char *propq); +OSSL_DEPRECATEDIN_3_0 +char *SRP_create_verifier(const char *user, const char *pass, char **salt, + char **verifier, const char *N, const char *g); +OSSL_DEPRECATEDIN_3_0 +int SRP_create_verifier_BN_ex(const char *user, const char *pass, BIGNUM **salt, + BIGNUM **verifier, const BIGNUM *N, + const BIGNUM *g, OSSL_LIB_CTX *libctx, + const char *propq); +OSSL_DEPRECATEDIN_3_0 +int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, + BIGNUM **verifier, const BIGNUM *N, + const BIGNUM *g); + +#define SRP_NO_ERROR 0 +#define SRP_ERR_VBASE_INCOMPLETE_FILE 1 +#define SRP_ERR_VBASE_BN_LIB 2 +#define SRP_ERR_OPEN_FILE 3 +#define SRP_ERR_MEMORY 4 + +#define DB_srptype 0 +#define DB_srpverifier 1 +#define DB_srpsalt 2 +#define DB_srpid 3 +#define DB_srpgN 4 +#define DB_srpinfo 5 +#undef DB_NUMBER +#define DB_NUMBER 6 + +#define DB_SRP_INDEX 'I' +#define DB_SRP_VALID 'V' +#define DB_SRP_REVOKED 'R' +#define DB_SRP_MODIF 'v' + +/* see srp.c */ +OSSL_DEPRECATEDIN_3_0 +char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N); +OSSL_DEPRECATEDIN_3_0 +SRP_gN *SRP_get_default_gN(const char *id); + +/* server side .... */ +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, + const BIGNUM *b, const BIGNUM *N); +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_B_ex(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, + const BIGNUM *v, OSSL_LIB_CTX *libctx, const char *propq); +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, + const BIGNUM *v); + +OSSL_DEPRECATEDIN_3_0 +int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N); +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_u_ex(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N, + OSSL_LIB_CTX *libctx, const char *propq); +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N); + +/* client side .... */ + +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_x_ex(const BIGNUM *s, const char *user, const char *pass, + OSSL_LIB_CTX *libctx, const char *propq); +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass); +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g); +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_client_key_ex(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, + const BIGNUM *x, const BIGNUM *a, const BIGNUM *u, + OSSL_LIB_CTX *libctx, const char *propq); +OSSL_DEPRECATEDIN_3_0 +BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, + const BIGNUM *x, const BIGNUM *a, const BIGNUM *u); +OSSL_DEPRECATEDIN_3_0 +int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N); + +#define SRP_MINIMAL_N 1024 + +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +/* This method ignores the configured seed and fails for an unknown user. */ +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 +SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/srtp.h b/VCMP-LUA/modules/postgresql/include/openssl/srtp.h new file mode 100644 index 0000000..3b716e1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/srtp.h @@ -0,0 +1,68 @@ +/* + * Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * DTLS code by Eric Rescorla + * + * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. + */ + +#ifndef OPENSSL_SRTP_H +#define OPENSSL_SRTP_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_D1_SRTP_H +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SRTP_AES128_CM_SHA1_80 0x0001 +#define SRTP_AES128_CM_SHA1_32 0x0002 +#define SRTP_AES128_F8_SHA1_80 0x0003 +#define SRTP_AES128_F8_SHA1_32 0x0004 +#define SRTP_NULL_SHA1_80 0x0005 +#define SRTP_NULL_SHA1_32 0x0006 + +/* AEAD SRTP protection profiles from RFC 7714 */ +#define SRTP_AEAD_AES_128_GCM 0x0007 +#define SRTP_AEAD_AES_256_GCM 0x0008 + +/* DOUBLE AEAD SRTP protection profiles from RFC 8723 */ +#define SRTP_DOUBLE_AEAD_AES_128_GCM_AEAD_AES_128_GCM 0x0009 +#define SRTP_DOUBLE_AEAD_AES_256_GCM_AEAD_AES_256_GCM 0x000A + +/* ARIA SRTP protection profiles from RFC 8269 */ +#define SRTP_ARIA_128_CTR_HMAC_SHA1_80 0x000B +#define SRTP_ARIA_128_CTR_HMAC_SHA1_32 0x000C +#define SRTP_ARIA_256_CTR_HMAC_SHA1_80 0x000D +#define SRTP_ARIA_256_CTR_HMAC_SHA1_32 0x000E +#define SRTP_AEAD_ARIA_128_GCM 0x000F +#define SRTP_AEAD_ARIA_256_GCM 0x0010 + +#ifndef OPENSSL_NO_SRTP + +__owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); +__owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); + +__owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); +__owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ssl.h b/VCMP-LUA/modules/postgresql/include/openssl/ssl.h new file mode 100644 index 0000000..2f4e1f1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ssl.h @@ -0,0 +1,2947 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\ssl.h.in + * + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * Copyright 2005 Nokia. All rights reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_SSL_H +#define OPENSSL_SSL_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_SSL_H +#endif + +#include +#include +#include +#include +#include +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#include +#include +#include +#endif +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* OpenSSL version number for ASN.1 encoding of the session information */ +/*- + * Version 0 - initial version + * Version 1 - added the optional peer certificate + */ +#define SSL_SESSION_ASN1_VERSION 0x0001 + +#define SSL_MAX_SSL_SESSION_ID_LENGTH 32 +#define SSL_MAX_SID_CTX_LENGTH 32 + +#define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512 / 8) +#define SSL_MAX_KEY_ARG_LENGTH 8 +/* SSL_MAX_MASTER_KEY_LENGTH is defined in prov_ssl.h */ + +/* The maximum number of encrypt/decrypt pipelines we can support */ +#define SSL_MAX_PIPELINES 32 + +/* text strings for the ciphers */ + +/* These are used to specify which ciphers to use and not to use */ + +#define SSL_TXT_LOW "LOW" +#define SSL_TXT_MEDIUM "MEDIUM" +#define SSL_TXT_HIGH "HIGH" +#define SSL_TXT_FIPS "FIPS" + +#define SSL_TXT_aNULL "aNULL" +#define SSL_TXT_eNULL "eNULL" +#define SSL_TXT_NULL "NULL" + +#define SSL_TXT_kRSA "kRSA" +#define SSL_TXT_kDHr "kDHr" /* this cipher class has been removed */ +#define SSL_TXT_kDHd "kDHd" /* this cipher class has been removed */ +#define SSL_TXT_kDH "kDH" /* this cipher class has been removed */ +#define SSL_TXT_kEDH "kEDH" /* alias for kDHE */ +#define SSL_TXT_kDHE "kDHE" +#define SSL_TXT_kECDHr "kECDHr" /* this cipher class has been removed */ +#define SSL_TXT_kECDHe "kECDHe" /* this cipher class has been removed */ +#define SSL_TXT_kECDH "kECDH" /* this cipher class has been removed */ +#define SSL_TXT_kEECDH "kEECDH" /* alias for kECDHE */ +#define SSL_TXT_kECDHE "kECDHE" +#define SSL_TXT_kPSK "kPSK" +#define SSL_TXT_kRSAPSK "kRSAPSK" +#define SSL_TXT_kECDHEPSK "kECDHEPSK" +#define SSL_TXT_kDHEPSK "kDHEPSK" +#define SSL_TXT_kGOST "kGOST" +#define SSL_TXT_kGOST18 "kGOST18" +#define SSL_TXT_kSRP "kSRP" + +#define SSL_TXT_aRSA "aRSA" +#define SSL_TXT_aDSS "aDSS" +#define SSL_TXT_aDH "aDH" /* this cipher class has been removed */ +#define SSL_TXT_aECDH "aECDH" /* this cipher class has been removed */ +#define SSL_TXT_aECDSA "aECDSA" +#define SSL_TXT_aPSK "aPSK" +#define SSL_TXT_aGOST94 "aGOST94" +#define SSL_TXT_aGOST01 "aGOST01" +#define SSL_TXT_aGOST12 "aGOST12" +#define SSL_TXT_aGOST "aGOST" +#define SSL_TXT_aSRP "aSRP" + +#define SSL_TXT_DSS "DSS" +#define SSL_TXT_DH "DH" +#define SSL_TXT_DHE "DHE" /* same as "kDHE:-ADH" */ +#define SSL_TXT_EDH "EDH" /* alias for DHE */ +#define SSL_TXT_ADH "ADH" +#define SSL_TXT_RSA "RSA" +#define SSL_TXT_ECDH "ECDH" +#define SSL_TXT_EECDH "EECDH" /* alias for ECDHE" */ +#define SSL_TXT_ECDHE "ECDHE" /* same as "kECDHE:-AECDH" */ +#define SSL_TXT_AECDH "AECDH" +#define SSL_TXT_ECDSA "ECDSA" +#define SSL_TXT_PSK "PSK" +#define SSL_TXT_SRP "SRP" + +#define SSL_TXT_DES "DES" +#define SSL_TXT_3DES "3DES" +#define SSL_TXT_RC4 "RC4" +#define SSL_TXT_RC2 "RC2" +#define SSL_TXT_IDEA "IDEA" +#define SSL_TXT_SEED "SEED" +#define SSL_TXT_AES128 "AES128" +#define SSL_TXT_AES256 "AES256" +#define SSL_TXT_AES "AES" +#define SSL_TXT_AES_GCM "AESGCM" +#define SSL_TXT_AES_CCM "AESCCM" +#define SSL_TXT_AES_CCM_8 "AESCCM8" +#define SSL_TXT_CAMELLIA128 "CAMELLIA128" +#define SSL_TXT_CAMELLIA256 "CAMELLIA256" +#define SSL_TXT_CAMELLIA "CAMELLIA" +#define SSL_TXT_CHACHA20 "CHACHA20" +#define SSL_TXT_GOST "GOST89" +#define SSL_TXT_ARIA "ARIA" +#define SSL_TXT_ARIA_GCM "ARIAGCM" +#define SSL_TXT_ARIA128 "ARIA128" +#define SSL_TXT_ARIA256 "ARIA256" +#define SSL_TXT_GOST2012_GOST8912_GOST8912 "GOST2012-GOST8912-GOST8912" +#define SSL_TXT_CBC "CBC" + +#define SSL_TXT_MD5 "MD5" +#define SSL_TXT_SHA1 "SHA1" +#define SSL_TXT_SHA "SHA" /* same as "SHA1" */ +#define SSL_TXT_GOST94 "GOST94" +#define SSL_TXT_GOST89MAC "GOST89MAC" +#define SSL_TXT_GOST12 "GOST12" +#define SSL_TXT_GOST89MAC12 "GOST89MAC12" +#define SSL_TXT_SHA256 "SHA256" +#define SSL_TXT_SHA384 "SHA384" + +#define SSL_TXT_SSLV3 "SSLv3" +#define SSL_TXT_TLSV1 "TLSv1" +#define SSL_TXT_TLSV1_1 "TLSv1.1" +#define SSL_TXT_TLSV1_2 "TLSv1.2" + +#define SSL_TXT_ALL "ALL" + +/*- + * COMPLEMENTOF* definitions. These identifiers are used to (de-select) + * ciphers normally not being used. + * Example: "RC4" will activate all ciphers using RC4 including ciphers + * without authentication, which would normally disabled by DEFAULT (due + * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" + * will make sure that it is also disabled in the specific selection. + * COMPLEMENTOF* identifiers are portable between version, as adjustments + * to the default cipher setup will also be included here. + * + * COMPLEMENTOFDEFAULT does not experience the same special treatment that + * DEFAULT gets, as only selection is being done and no sorting as needed + * for DEFAULT. + */ +#define SSL_TXT_CMPALL "COMPLEMENTOFALL" +#define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" + +/* + * The following cipher list is used by default. It also is substituted when + * an application-defined cipher list string starts with 'DEFAULT'. + * This applies to ciphersuites for TLSv1.2 and below. + * DEPRECATED IN 3.0.0, in favor of OSSL_default_cipher_list() + * Update both macro and function simultaneously + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SSL_DEFAULT_CIPHER_LIST "ALL:!COMPLEMENTOFDEFAULT:!eNULL" +/* + * This is the default set of TLSv1.3 ciphersuites + * DEPRECATED IN 3.0.0, in favor of OSSL_default_ciphersuites() + * Update both macro and function simultaneously + */ +#define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ + "TLS_CHACHA20_POLY1305_SHA256:" \ + "TLS_AES_128_GCM_SHA256" +#endif +/* + * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always + * starts with a reasonable order, and all we have to do for DEFAULT is + * throwing out anonymous and unencrypted ciphersuites! (The latter are not + * actually enabled by ALL, but "ALL:RSA" would enable some of them.) + */ + +/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ +#define SSL_SENT_SHUTDOWN 1 +#define SSL_RECEIVED_SHUTDOWN 2 + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 +#define SSL_FILETYPE_PEM X509_FILETYPE_PEM + +/* + * This is needed to stop compilers complaining about the 'struct ssl_st *' + * function parameters used to prototype callbacks in SSL_CTX. + */ +typedef struct ssl_st *ssl_crock_st; +typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; +typedef struct ssl_method_st SSL_METHOD; +typedef struct ssl_cipher_st SSL_CIPHER; +typedef struct ssl_session_st SSL_SESSION; +typedef struct tls_sigalgs_st TLS_SIGALGS; +typedef struct ssl_conf_ctx_st SSL_CONF_CTX; + +STACK_OF(SSL_CIPHER); + +/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ +typedef struct srtp_protection_profile_st { + const char *name; + unsigned long id; +} SRTP_PROTECTION_PROFILE; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(SRTP_PROTECTION_PROFILE, SRTP_PROTECTION_PROFILE, SRTP_PROTECTION_PROFILE) +#define sk_SRTP_PROTECTION_PROFILE_num(sk) OPENSSL_sk_num(ossl_check_const_SRTP_PROTECTION_PROFILE_sk_type(sk)) +#define sk_SRTP_PROTECTION_PROFILE_value(sk, idx) ((SRTP_PROTECTION_PROFILE *)OPENSSL_sk_value(ossl_check_const_SRTP_PROTECTION_PROFILE_sk_type(sk), (idx))) +#define sk_SRTP_PROTECTION_PROFILE_new(cmp) ((STACK_OF(SRTP_PROTECTION_PROFILE) *)OPENSSL_sk_new(ossl_check_SRTP_PROTECTION_PROFILE_compfunc_type(cmp))) +#define sk_SRTP_PROTECTION_PROFILE_new_null() ((STACK_OF(SRTP_PROTECTION_PROFILE) *)OPENSSL_sk_new_null()) +#define sk_SRTP_PROTECTION_PROFILE_new_reserve(cmp, n) ((STACK_OF(SRTP_PROTECTION_PROFILE) *)OPENSSL_sk_new_reserve(ossl_check_SRTP_PROTECTION_PROFILE_compfunc_type(cmp), (n))) +#define sk_SRTP_PROTECTION_PROFILE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), (n)) +#define sk_SRTP_PROTECTION_PROFILE_free(sk) OPENSSL_sk_free(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk)) +#define sk_SRTP_PROTECTION_PROFILE_zero(sk) OPENSSL_sk_zero(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk)) +#define sk_SRTP_PROTECTION_PROFILE_delete(sk, i) ((SRTP_PROTECTION_PROFILE *)OPENSSL_sk_delete(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), (i))) +#define sk_SRTP_PROTECTION_PROFILE_delete_ptr(sk, ptr) ((SRTP_PROTECTION_PROFILE *)OPENSSL_sk_delete_ptr(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_type(ptr))) +#define sk_SRTP_PROTECTION_PROFILE_push(sk, ptr) OPENSSL_sk_push(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_type(ptr)) +#define sk_SRTP_PROTECTION_PROFILE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_type(ptr)) +#define sk_SRTP_PROTECTION_PROFILE_pop(sk) ((SRTP_PROTECTION_PROFILE *)OPENSSL_sk_pop(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk))) +#define sk_SRTP_PROTECTION_PROFILE_shift(sk) ((SRTP_PROTECTION_PROFILE *)OPENSSL_sk_shift(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk))) +#define sk_SRTP_PROTECTION_PROFILE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_freefunc_type(freefunc)) +#define sk_SRTP_PROTECTION_PROFILE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_type(ptr), (idx)) +#define sk_SRTP_PROTECTION_PROFILE_set(sk, idx, ptr) ((SRTP_PROTECTION_PROFILE *)OPENSSL_sk_set(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), (idx), ossl_check_SRTP_PROTECTION_PROFILE_type(ptr))) +#define sk_SRTP_PROTECTION_PROFILE_find(sk, ptr) OPENSSL_sk_find(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_type(ptr)) +#define sk_SRTP_PROTECTION_PROFILE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_type(ptr)) +#define sk_SRTP_PROTECTION_PROFILE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_type(ptr), pnum) +#define sk_SRTP_PROTECTION_PROFILE_sort(sk) OPENSSL_sk_sort(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk)) +#define sk_SRTP_PROTECTION_PROFILE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SRTP_PROTECTION_PROFILE_sk_type(sk)) +#define sk_SRTP_PROTECTION_PROFILE_dup(sk) ((STACK_OF(SRTP_PROTECTION_PROFILE) *)OPENSSL_sk_dup(ossl_check_const_SRTP_PROTECTION_PROFILE_sk_type(sk))) +#define sk_SRTP_PROTECTION_PROFILE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SRTP_PROTECTION_PROFILE) *)OPENSSL_sk_deep_copy(ossl_check_const_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_copyfunc_type(copyfunc), ossl_check_SRTP_PROTECTION_PROFILE_freefunc_type(freefunc))) +#define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(sk, cmp) ((sk_SRTP_PROTECTION_PROFILE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SRTP_PROTECTION_PROFILE_sk_type(sk), ossl_check_SRTP_PROTECTION_PROFILE_compfunc_type(cmp))) + +/* clang-format on */ + +typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, + int len, void *arg); +typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, + STACK_OF(SSL_CIPHER) *peer_ciphers, + const SSL_CIPHER **cipher, void *arg); + +/* Extension context codes */ +/* This extension is only allowed in TLS */ +#define SSL_EXT_TLS_ONLY 0x00001 +/* This extension is only allowed in DTLS */ +#define SSL_EXT_DTLS_ONLY 0x00002 +/* Some extensions may be allowed in DTLS but we don't implement them for it */ +#define SSL_EXT_TLS_IMPLEMENTATION_ONLY 0x00004 +/* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */ +#define SSL_EXT_SSL3_ALLOWED 0x00008 +/* Extension is only defined for TLS1.2 and below */ +#define SSL_EXT_TLS1_2_AND_BELOW_ONLY 0x00010 +/* Extension is only defined for TLS1.3 and above */ +#define SSL_EXT_TLS1_3_ONLY 0x00020 +/* Ignore this extension during parsing if we are resuming */ +#define SSL_EXT_IGNORE_ON_RESUMPTION 0x00040 +#define SSL_EXT_CLIENT_HELLO 0x00080 +/* Really means TLS1.2 or below */ +#define SSL_EXT_TLS1_2_SERVER_HELLO 0x00100 +#define SSL_EXT_TLS1_3_SERVER_HELLO 0x00200 +#define SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS 0x00400 +#define SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST 0x00800 +#define SSL_EXT_TLS1_3_CERTIFICATE 0x01000 +#define SSL_EXT_TLS1_3_NEW_SESSION_TICKET 0x02000 +#define SSL_EXT_TLS1_3_CERTIFICATE_REQUEST 0x04000 +#define SSL_EXT_TLS1_3_CERTIFICATE_COMPRESSION 0x08000 +/* When sending a raw public key in a certificate message */ +#define SSL_EXT_TLS1_3_RAW_PUBLIC_KEY 0x10000 + +/* Typedefs for handling custom extensions */ + +typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type, + const unsigned char **out, size_t *outlen, + int *al, void *add_arg); + +typedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type, + const unsigned char *out, void *add_arg); + +typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type, + const unsigned char *in, size_t inlen, + int *al, void *parse_arg); + +typedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char **out, + size_t *outlen, X509 *x, + size_t chainidx, + int *al, void *add_arg); + +typedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char *out, + void *add_arg); + +typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char *in, + size_t inlen, X509 *x, + size_t chainidx, + int *al, void *parse_arg); + +/* Typedef for verification callback */ +typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); + +/* Typedef for SSL async callback */ +typedef int (*SSL_async_callback_fn)(SSL *s, void *arg); + +#define SSL_OP_BIT(n) ((uint64_t)1 << (uint64_t)n) + +/* + * SSL/TLS connection options. + */ +/* Disable Extended master secret */ +#define SSL_OP_NO_EXTENDED_MASTER_SECRET SSL_OP_BIT(0) +/* Cleanse plaintext copies of data delivered to the application */ +#define SSL_OP_CLEANSE_PLAINTEXT SSL_OP_BIT(1) +/* Allow initial connection to servers that don't support RI */ +#define SSL_OP_LEGACY_SERVER_CONNECT SSL_OP_BIT(2) +/* Enable support for Kernel TLS */ +#define SSL_OP_ENABLE_KTLS SSL_OP_BIT(3) +#define SSL_OP_TLSEXT_PADDING SSL_OP_BIT(4) +#define SSL_OP_SAFARI_ECDHE_ECDSA_BUG SSL_OP_BIT(6) +#define SSL_OP_IGNORE_UNEXPECTED_EOF SSL_OP_BIT(7) +#define SSL_OP_ALLOW_CLIENT_RENEGOTIATION SSL_OP_BIT(8) +#define SSL_OP_DISABLE_TLSEXT_CA_NAMES SSL_OP_BIT(9) +/* In TLSv1.3 allow a non-(ec)dhe based kex_mode */ +#define SSL_OP_ALLOW_NO_DHE_KEX SSL_OP_BIT(10) +/* + * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added + * in OpenSSL 0.9.6d. Usually (depending on the application protocol) + * the workaround is not needed. Unfortunately some broken SSL/TLS + * implementations cannot handle it at all, which is why we include it + * in SSL_OP_ALL. Added in 0.9.6e + */ +#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS SSL_OP_BIT(11) +/* DTLS options */ +#define SSL_OP_NO_QUERY_MTU SSL_OP_BIT(12) +/* Turn on Cookie Exchange (on relevant for servers) */ +#define SSL_OP_COOKIE_EXCHANGE SSL_OP_BIT(13) +/* Don't use RFC4507 ticket extension */ +#define SSL_OP_NO_TICKET SSL_OP_BIT(14) +#ifndef OPENSSL_NO_DTLS1_METHOD +/* + * Use Cisco's version identifier of DTLS_BAD_VER + * (only with deprecated DTLSv1_client_method()) + */ +#define SSL_OP_CISCO_ANYCONNECT SSL_OP_BIT(15) +#endif +/* As server, disallow session resumption on renegotiation */ +#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION SSL_OP_BIT(16) +/* Don't use compression even if supported */ +#define SSL_OP_NO_COMPRESSION SSL_OP_BIT(17) +/* Permit unsafe legacy renegotiation */ +#define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION SSL_OP_BIT(18) +/* Disable encrypt-then-mac */ +#define SSL_OP_NO_ENCRYPT_THEN_MAC SSL_OP_BIT(19) +/* + * Enable TLSv1.3 Compatibility mode. This is on by default. A future + * version of OpenSSL may have this disabled by default. + */ +#define SSL_OP_ENABLE_MIDDLEBOX_COMPAT SSL_OP_BIT(20) +/* + * Prioritize Chacha20Poly1305 when client does. + * Modifies SSL_OP_SERVER_PREFERENCE + */ +#define SSL_OP_PRIORITIZE_CHACHA SSL_OP_BIT(21) +/* + * Set on servers to choose cipher, curve or group according to server's + * preferences. + */ +#define SSL_OP_SERVER_PREFERENCE SSL_OP_BIT(22) +/* Equivalent definition for backwards compatibility: */ +#define SSL_OP_CIPHER_SERVER_PREFERENCE SSL_OP_SERVER_PREFERENCE +/* + * If set, a server will allow a client to issue an SSLv3.0 version + * number as latest version supported in the premaster secret, even when + * TLSv1.0 (version 3.1) was announced in the client hello. Normally + * this is forbidden to prevent version rollback attacks. + */ +#define SSL_OP_TLS_ROLLBACK_BUG SSL_OP_BIT(23) +/* + * Switches off automatic TLSv1.3 anti-replay protection for early data. + * This is a server-side option only (no effect on the client). + */ +#define SSL_OP_NO_ANTI_REPLAY SSL_OP_BIT(24) +#define SSL_OP_NO_SSLv3 SSL_OP_BIT(25) +#define SSL_OP_NO_TLSv1 SSL_OP_BIT(26) +#define SSL_OP_NO_TLSv1_2 SSL_OP_BIT(27) +#define SSL_OP_NO_TLSv1_1 SSL_OP_BIT(28) +#define SSL_OP_NO_TLSv1_3 SSL_OP_BIT(29) +#define SSL_OP_NO_DTLSv1 SSL_OP_BIT(26) +#define SSL_OP_NO_DTLSv1_2 SSL_OP_BIT(27) +/* Disallow all renegotiation */ +#define SSL_OP_NO_RENEGOTIATION SSL_OP_BIT(30) +/* + * Make server add server-hello extension from early version of + * cryptopro draft, when GOST ciphersuite is negotiated. Required for + * interoperability with CryptoPro CSP 3.x + */ +#define SSL_OP_CRYPTOPRO_TLSEXT_BUG SSL_OP_BIT(31) +/* + * Disable RFC8879 certificate compression + * SSL_OP_NO_TX_CERTIFICATE_COMPRESSION: don't send compressed certificates, + * and ignore the extension when received. + * SSL_OP_NO_RX_CERTIFICATE_COMPRESSION: don't send the extension, and + * subsequently indicating that receiving is not supported + */ +#define SSL_OP_NO_TX_CERTIFICATE_COMPRESSION SSL_OP_BIT(32) +#define SSL_OP_NO_RX_CERTIFICATE_COMPRESSION SSL_OP_BIT(33) +/* Enable KTLS TX zerocopy on Linux */ +#define SSL_OP_ENABLE_KTLS_TX_ZEROCOPY_SENDFILE SSL_OP_BIT(34) +#define SSL_OP_PREFER_NO_DHE_KEX SSL_OP_BIT(35) +#define SSL_OP_LEGACY_EC_POINT_FORMATS SSL_OP_BIT(36) + +/* + * Option "collections." + */ +#define SSL_OP_NO_SSL_MASK \ + (SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 \ + | SSL_OP_NO_TLSv1_2 | SSL_OP_NO_TLSv1_3) +#define SSL_OP_NO_DTLS_MASK \ + (SSL_OP_NO_DTLSv1 | SSL_OP_NO_DTLSv1_2) + +/* Various bug workarounds that should be rather harmless. */ +#define SSL_OP_ALL \ + (SSL_OP_CRYPTOPRO_TLSEXT_BUG | SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS \ + | SSL_OP_TLSEXT_PADDING | SSL_OP_SAFARI_ECDHE_ECDSA_BUG) + +/* + * OBSOLETE OPTIONS retained for compatibility + */ + +#define SSL_OP_MICROSOFT_SESS_ID_BUG 0x0 +#define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x0 +#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x0 +#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 +#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x0 +#define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 +#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x0 +#define SSL_OP_TLS_D5_BUG 0x0 +#define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 +#define SSL_OP_SINGLE_ECDH_USE 0x0 +#define SSL_OP_SINGLE_DH_USE 0x0 +#define SSL_OP_EPHEMERAL_RSA 0x0 +#define SSL_OP_NO_SSLv2 0x0 +#define SSL_OP_PKCS1_CHECK_1 0x0 +#define SSL_OP_PKCS1_CHECK_2 0x0 +#define SSL_OP_NETSCAPE_CA_DN_BUG 0x0 +#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x0 + +/* + * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success + * when just a single record has been written): + */ +#define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001U +/* + * Make it possible to retry SSL_write() with changed buffer location (buffer + * contents must stay the same!); this is not the default to avoid the + * misconception that non-blocking SSL_write() behaves like non-blocking + * write(): + */ +#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002U +/* + * Never bother the application with retries if the transport is blocking: + */ +#define SSL_MODE_AUTO_RETRY 0x00000004U +/* Don't attempt to automatically build certificate chain */ +#define SSL_MODE_NO_AUTO_CHAIN 0x00000008U +/* + * Save RAM by releasing read and write buffers when they're empty. (SSL3 and + * TLS only.) Released buffers are freed. + */ +#define SSL_MODE_RELEASE_BUFFERS 0x00000010U +/* + * Send the current time in the Random fields of the ClientHello and + * ServerHello records for compatibility with hypothetical implementations + * that require it. + */ +#define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020U +#define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040U +/* + * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications + * that reconnect with a downgraded protocol version; see + * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your + * application attempts a normal handshake. Only use this in explicit + * fallback retries, following the guidance in + * draft-ietf-tls-downgrade-scsv-00. + */ +#define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U +/* + * Support Asynchronous operation + */ +#define SSL_MODE_ASYNC 0x00000100U + +/* + * When using DTLS/SCTP, include the terminating zero in the label + * used for computing the endpoint-pair shared secret. Required for + * interoperability with implementations having this bug like these + * older version of OpenSSL: + * - OpenSSL 1.0.0 series + * - OpenSSL 1.0.1 series + * - OpenSSL 1.0.2 series + * - OpenSSL 1.1.0 series + * - OpenSSL 1.1.1 and 1.1.1a + */ +#define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U + +/* Cert related flags */ +/* + * Many implementations ignore some aspects of the TLS standards such as + * enforcing certificate chain algorithms. When this is set we enforce them. + */ +#define SSL_CERT_FLAG_TLS_STRICT 0x00000001U + +/* Suite B modes, takes same values as certificate verify flags */ +#define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +#define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +#define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 + +/* Perform all sorts of protocol violations for testing purposes */ +#define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 + +/* Flags for building certificate chains */ +/* Treat any existing certificates as untrusted CAs */ +#define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 +/* Don't include root CA in chain */ +#define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 +/* Just check certificates already there */ +#define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 +/* Ignore verification errors */ +#define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 +/* Clear verification errors from queue */ +#define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 + +/* Flags returned by SSL_check_chain */ +/* Certificate can be used with this session */ +#define CERT_PKEY_VALID 0x1 +/* Certificate can also be used for signing */ +#define CERT_PKEY_SIGN 0x2 +/* EE certificate signing algorithm OK */ +#define CERT_PKEY_EE_SIGNATURE 0x10 +/* CA signature algorithms OK */ +#define CERT_PKEY_CA_SIGNATURE 0x20 +/* EE certificate parameters OK */ +#define CERT_PKEY_EE_PARAM 0x40 +/* CA certificate parameters OK */ +#define CERT_PKEY_CA_PARAM 0x80 +/* Signing explicitly allowed as opposed to SHA1 fallback */ +#define CERT_PKEY_EXPLICIT_SIGN 0x100 +/* Client CA issuer names match (always set for server cert) */ +#define CERT_PKEY_ISSUER_NAME 0x200 +/* Cert type matches client types (always set for server cert) */ +#define CERT_PKEY_CERT_TYPE 0x400 +/* Cert chain suitable to Suite B */ +#define CERT_PKEY_SUITEB 0x800 +/* Cert pkey valid for raw public key use */ +#define CERT_PKEY_RPK 0x1000 + +#define SSL_CONF_FLAG_CMDLINE 0x1 +#define SSL_CONF_FLAG_FILE 0x2 +#define SSL_CONF_FLAG_CLIENT 0x4 +#define SSL_CONF_FLAG_SERVER 0x8 +#define SSL_CONF_FLAG_SHOW_ERRORS 0x10 +#define SSL_CONF_FLAG_CERTIFICATE 0x20 +#define SSL_CONF_FLAG_REQUIRE_PRIVATE 0x40 +/* Configuration value types */ +#define SSL_CONF_TYPE_UNKNOWN 0x0 +#define SSL_CONF_TYPE_STRING 0x1 +#define SSL_CONF_TYPE_FILE 0x2 +#define SSL_CONF_TYPE_DIR 0x3 +#define SSL_CONF_TYPE_NONE 0x4 +#define SSL_CONF_TYPE_STORE 0x5 + +/* Maximum length of the application-controlled segment of a a TLSv1.3 cookie */ +#define SSL_COOKIE_LENGTH 4096 + +/* + * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they + * cannot be used to clear bits. + */ + +uint64_t SSL_CTX_get_options(const SSL_CTX *ctx); +uint64_t SSL_get_options(const SSL *s); +uint64_t SSL_CTX_clear_options(SSL_CTX *ctx, uint64_t op); +uint64_t SSL_clear_options(SSL *s, uint64_t op); +uint64_t SSL_CTX_set_options(SSL_CTX *ctx, uint64_t op); +uint64_t SSL_set_options(SSL *s, uint64_t op); + +#define SSL_CTX_set_mode(ctx, op) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_MODE, (op), NULL) +#define SSL_CTX_clear_mode(ctx, op) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_CLEAR_MODE, (op), NULL) +#define SSL_CTX_get_mode(ctx) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_MODE, 0, NULL) +#define SSL_clear_mode(ssl, op) \ + SSL_ctrl((ssl), SSL_CTRL_CLEAR_MODE, (op), NULL) +#define SSL_set_mode(ssl, op) \ + SSL_ctrl((ssl), SSL_CTRL_MODE, (op), NULL) +#define SSL_get_mode(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_MODE, 0, NULL) +#define SSL_set_mtu(ssl, mtu) \ + SSL_ctrl((ssl), SSL_CTRL_SET_MTU, (mtu), NULL) +#define DTLS_set_link_mtu(ssl, mtu) \ + SSL_ctrl((ssl), DTLS_CTRL_SET_LINK_MTU, (mtu), NULL) +#define DTLS_get_link_min_mtu(ssl) \ + SSL_ctrl((ssl), DTLS_CTRL_GET_LINK_MIN_MTU, 0, NULL) + +#define SSL_get_secure_renegotiation_support(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) + +#define SSL_CTX_set_cert_flags(ctx, op) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_CERT_FLAGS, (op), NULL) +#define SSL_set_cert_flags(s, op) \ + SSL_ctrl((s), SSL_CTRL_CERT_FLAGS, (op), NULL) +#define SSL_CTX_clear_cert_flags(ctx, op) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_CLEAR_CERT_FLAGS, (op), NULL) +#define SSL_clear_cert_flags(s, op) \ + SSL_ctrl((s), SSL_CTRL_CLEAR_CERT_FLAGS, (op), NULL) + +void SSL_CTX_set_msg_callback(SSL_CTX *ctx, + void (*cb)(int write_p, int version, + int content_type, const void *buf, + size_t len, SSL *ssl, void *arg)); +void SSL_set_msg_callback(SSL *ssl, + void (*cb)(int write_p, int version, + int content_type, const void *buf, + size_t len, SSL *ssl, void *arg)); +#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) +#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) + +#define SSL_get_extms_support(s) \ + SSL_ctrl((s), SSL_CTRL_GET_EXTMS_SUPPORT, 0, NULL) + +#ifndef OPENSSL_NO_SRP +/* see tls_srp.c */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 __owur int SSL_SRP_CTX_init(SSL *s); +OSSL_DEPRECATEDIN_3_0 __owur int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 int SSL_SRP_CTX_free(SSL *ctx); +OSSL_DEPRECATEDIN_3_0 int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); +OSSL_DEPRECATEDIN_3_0 __owur int SSL_srp_server_param_with_username(SSL *s, + int *ad); +OSSL_DEPRECATEDIN_3_0 __owur int SRP_Calc_A_param(SSL *s); +#endif +#endif + +/* 100k max cert list */ +#define SSL_MAX_CERT_LIST_DEFAULT (1024 * 100) + +#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024 * 20) + +/* + * This callback type is used inside SSL_CTX, SSL, and in the functions that + * set them. It is used to override the generation of SSL/TLS session IDs in + * a server. Return value should be zero on an error, non-zero to proceed. + * Also, callbacks should themselves check if the id they generate is unique + * otherwise the SSL handshake will fail with an error - callbacks can do + * this using the 'ssl' value they're passed by; + * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in + * is set at the maximum size the session ID can be. In SSLv3/TLSv1 it is 32 + * bytes. The callback can alter this length to be less if desired. It is + * also an error for the callback to set the size to zero. + */ +typedef int (*GEN_SESSION_CB)(SSL *ssl, unsigned char *id, + unsigned int *id_len); + +#define SSL_SESS_CACHE_OFF 0x0000 +#define SSL_SESS_CACHE_CLIENT 0x0001 +#define SSL_SESS_CACHE_SERVER 0x0002 +#define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT | SSL_SESS_CACHE_SERVER) +#define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 +/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ +#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 +#define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 +#define SSL_SESS_CACHE_NO_INTERNAL \ + (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | SSL_SESS_CACHE_NO_INTERNAL_STORE) +#define SSL_SESS_CACHE_UPDATE_TIME 0x0400 + +LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); +#define SSL_CTX_sess_number(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_NUMBER, 0, NULL) +#define SSL_CTX_sess_connect(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CONNECT, 0, NULL) +#define SSL_CTX_sess_connect_good(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CONNECT_GOOD, 0, NULL) +#define SSL_CTX_sess_connect_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CONNECT_RENEGOTIATE, 0, NULL) +#define SSL_CTX_sess_accept(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_ACCEPT, 0, NULL) +#define SSL_CTX_sess_accept_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_ACCEPT_RENEGOTIATE, 0, NULL) +#define SSL_CTX_sess_accept_good(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_ACCEPT_GOOD, 0, NULL) +#define SSL_CTX_sess_hits(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_HIT, 0, NULL) +#define SSL_CTX_sess_cb_hits(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CB_HIT, 0, NULL) +#define SSL_CTX_sess_misses(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_MISSES, 0, NULL) +#define SSL_CTX_sess_timeouts(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_TIMEOUTS, 0, NULL) +#define SSL_CTX_sess_cache_full(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CACHE_FULL, 0, NULL) + +void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, + int (*new_session_cb)(struct ssl_st *ssl, + SSL_SESSION *sess)); +int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, + SSL_SESSION *sess); +void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, + void (*remove_session_cb)(struct ssl_ctx_st + *ctx, + SSL_SESSION *sess)); +void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, + SSL_SESSION *sess); +void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, + SSL_SESSION *(*get_session_cb)(struct ssl_st + *ssl, + const unsigned char + *data, + int len, + int *copy)); +SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, + const unsigned char *data, + int len, int *copy); +void SSL_CTX_set_info_callback(SSL_CTX *ctx, + void (*cb)(const SSL *ssl, int type, int val)); +void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, int type, + int val); +void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, + int (*client_cert_cb)(SSL *ssl, X509 **x509, + EVP_PKEY **pkey)); +int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, + EVP_PKEY **pkey); +#ifndef OPENSSL_NO_ENGINE +__owur int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); +#endif +void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, + int (*app_gen_cookie_cb)(SSL *ssl, + unsigned char + *cookie, + unsigned int + *cookie_len)); +void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, + int (*app_verify_cookie_cb)(SSL *ssl, + const unsigned char *cookie, + unsigned int + cookie_len)); + +void SSL_CTX_set_stateless_cookie_generate_cb( + SSL_CTX *ctx, + int (*gen_stateless_cookie_cb)(SSL *ssl, + unsigned char *cookie, + size_t *cookie_len)); +void SSL_CTX_set_stateless_cookie_verify_cb( + SSL_CTX *ctx, + int (*verify_stateless_cookie_cb)(SSL *ssl, + const unsigned char *cookie, + size_t cookie_len)); +#ifndef OPENSSL_NO_NEXTPROTONEG + +typedef int (*SSL_CTX_npn_advertised_cb_func)(SSL *ssl, + const unsigned char **out, + unsigned int *outlen, + void *arg); +void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, + SSL_CTX_npn_advertised_cb_func cb, + void *arg); +#define SSL_CTX_set_npn_advertised_cb SSL_CTX_set_next_protos_advertised_cb + +typedef int (*SSL_CTX_npn_select_cb_func)(SSL *s, + unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg); +void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, + SSL_CTX_npn_select_cb_func cb, + void *arg); +#define SSL_CTX_set_npn_select_cb SSL_CTX_set_next_proto_select_cb + +void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, + unsigned *len); +#define SSL_get0_npn_negotiated SSL_get0_next_proto_negotiated +#endif + +__owur int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, + const unsigned char *server, unsigned int server_len, + const unsigned char *client, + unsigned int client_len); + +#define OPENSSL_NPN_UNSUPPORTED 0 +#define OPENSSL_NPN_NEGOTIATED 1 +#define OPENSSL_NPN_NO_OVERLAP 2 + +__owur int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, + unsigned int protos_len); +__owur int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, + unsigned int protos_len); +typedef int (*SSL_CTX_alpn_select_cb_func)(SSL *ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg); +void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, + SSL_CTX_alpn_select_cb_func cb, + void *arg); +void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, + unsigned int *len); + +#ifndef OPENSSL_NO_PSK +/* + * the maximum length of the buffer given to callbacks containing the + * resulting identity/psk + */ +#define PSK_MAX_IDENTITY_LEN 256 +#define PSK_MAX_PSK_LEN 512 +typedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl, + const char *hint, + char *identity, + unsigned int max_identity_len, + unsigned char *psk, + unsigned int max_psk_len); +void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb); +void SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb); + +typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl, + const char *identity, + unsigned char *psk, + unsigned int max_psk_len); +void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb); +void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb); + +__owur int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); +__owur int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); +const char *SSL_get_psk_identity_hint(const SSL *s); +const char *SSL_get_psk_identity(const SSL *s); +#endif + +typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl, + const unsigned char *identity, + size_t identity_len, + SSL_SESSION **sess); +typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md, + const unsigned char **id, + size_t *idlen, + SSL_SESSION **sess); + +void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb); +void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, + SSL_psk_find_session_cb_func cb); +void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb); +void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, + SSL_psk_use_session_cb_func cb); + +/* Register callbacks to handle custom TLS Extensions for client or server. */ + +__owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, + unsigned int ext_type); + +__owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void *add_arg, + custom_ext_parse_cb parse_cb, + void *parse_arg); + +__owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void *add_arg, + custom_ext_parse_cb parse_cb, + void *parse_arg); + +__owur int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, + unsigned int context, + SSL_custom_ext_add_cb_ex add_cb, + SSL_custom_ext_free_cb_ex free_cb, + void *add_arg, + SSL_custom_ext_parse_cb_ex parse_cb, + void *parse_arg); + +__owur int SSL_extension_supported(unsigned int ext_type); + +#define SSL_NOTHING 1 +#define SSL_WRITING 2 +#define SSL_READING 3 +#define SSL_X509_LOOKUP 4 +#define SSL_ASYNC_PAUSED 5 +#define SSL_ASYNC_NO_JOBS 6 +#define SSL_CLIENT_HELLO_CB 7 +#define SSL_RETRY_VERIFY 8 + +/* These will only be used when doing non-blocking IO */ +#define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) +#define SSL_want_read(s) (SSL_want(s) == SSL_READING) +#define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) +#define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) +#define SSL_want_retry_verify(s) (SSL_want(s) == SSL_RETRY_VERIFY) +#define SSL_want_async(s) (SSL_want(s) == SSL_ASYNC_PAUSED) +#define SSL_want_async_job(s) (SSL_want(s) == SSL_ASYNC_NO_JOBS) +#define SSL_want_client_hello_cb(s) (SSL_want(s) == SSL_CLIENT_HELLO_CB) + +#define SSL_MAC_FLAG_READ_MAC_STREAM 1 +#define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 +#define SSL_MAC_FLAG_READ_MAC_TLSTREE 4 +#define SSL_MAC_FLAG_WRITE_MAC_TLSTREE 8 + +/* + * A callback for logging out TLS key material. This callback should log out + * |line| followed by a newline. + */ +typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line); + +/* + * SSL_CTX_set_keylog_callback configures a callback to log key material. This + * is intended for debugging use with tools like Wireshark. The cb function + * should log line followed by a newline. + */ +void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb); + +/* + * SSL_CTX_get_keylog_callback returns the callback configured by + * SSL_CTX_set_keylog_callback. + */ +SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx); + +int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data); +uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); +int SSL_set_max_early_data(SSL *s, uint32_t max_early_data); +uint32_t SSL_get_max_early_data(const SSL *s); +int SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data); +uint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx); +int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data); +uint32_t SSL_get_recv_max_early_data(const SSL *s); + +#ifdef __cplusplus +} +#endif + +#include +#include +#include /* This is mostly sslv3 with a few tweaks */ +#include /* Datagram TLS */ +#include /* Support for the use_srtp extension */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These need to be after the above set of includes due to a compiler bug + * in VisualStudio 2015 + */ +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(SSL_CIPHER, const SSL_CIPHER, SSL_CIPHER) +#define sk_SSL_CIPHER_num(sk) OPENSSL_sk_num(ossl_check_const_SSL_CIPHER_sk_type(sk)) +#define sk_SSL_CIPHER_value(sk, idx) ((const SSL_CIPHER *)OPENSSL_sk_value(ossl_check_const_SSL_CIPHER_sk_type(sk), (idx))) +#define sk_SSL_CIPHER_new(cmp) ((STACK_OF(SSL_CIPHER) *)OPENSSL_sk_new(ossl_check_SSL_CIPHER_compfunc_type(cmp))) +#define sk_SSL_CIPHER_new_null() ((STACK_OF(SSL_CIPHER) *)OPENSSL_sk_new_null()) +#define sk_SSL_CIPHER_new_reserve(cmp, n) ((STACK_OF(SSL_CIPHER) *)OPENSSL_sk_new_reserve(ossl_check_SSL_CIPHER_compfunc_type(cmp), (n))) +#define sk_SSL_CIPHER_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SSL_CIPHER_sk_type(sk), (n)) +#define sk_SSL_CIPHER_free(sk) OPENSSL_sk_free(ossl_check_SSL_CIPHER_sk_type(sk)) +#define sk_SSL_CIPHER_zero(sk) OPENSSL_sk_zero(ossl_check_SSL_CIPHER_sk_type(sk)) +#define sk_SSL_CIPHER_delete(sk, i) ((const SSL_CIPHER *)OPENSSL_sk_delete(ossl_check_SSL_CIPHER_sk_type(sk), (i))) +#define sk_SSL_CIPHER_delete_ptr(sk, ptr) ((const SSL_CIPHER *)OPENSSL_sk_delete_ptr(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_type(ptr))) +#define sk_SSL_CIPHER_push(sk, ptr) OPENSSL_sk_push(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_type(ptr)) +#define sk_SSL_CIPHER_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_type(ptr)) +#define sk_SSL_CIPHER_pop(sk) ((const SSL_CIPHER *)OPENSSL_sk_pop(ossl_check_SSL_CIPHER_sk_type(sk))) +#define sk_SSL_CIPHER_shift(sk) ((const SSL_CIPHER *)OPENSSL_sk_shift(ossl_check_SSL_CIPHER_sk_type(sk))) +#define sk_SSL_CIPHER_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_freefunc_type(freefunc)) +#define sk_SSL_CIPHER_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_type(ptr), (idx)) +#define sk_SSL_CIPHER_set(sk, idx, ptr) ((const SSL_CIPHER *)OPENSSL_sk_set(ossl_check_SSL_CIPHER_sk_type(sk), (idx), ossl_check_SSL_CIPHER_type(ptr))) +#define sk_SSL_CIPHER_find(sk, ptr) OPENSSL_sk_find(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_type(ptr)) +#define sk_SSL_CIPHER_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_type(ptr)) +#define sk_SSL_CIPHER_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_type(ptr), pnum) +#define sk_SSL_CIPHER_sort(sk) OPENSSL_sk_sort(ossl_check_SSL_CIPHER_sk_type(sk)) +#define sk_SSL_CIPHER_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SSL_CIPHER_sk_type(sk)) +#define sk_SSL_CIPHER_dup(sk) ((STACK_OF(SSL_CIPHER) *)OPENSSL_sk_dup(ossl_check_const_SSL_CIPHER_sk_type(sk))) +#define sk_SSL_CIPHER_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SSL_CIPHER) *)OPENSSL_sk_deep_copy(ossl_check_const_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_copyfunc_type(copyfunc), ossl_check_SSL_CIPHER_freefunc_type(freefunc))) +#define sk_SSL_CIPHER_set_cmp_func(sk, cmp) ((sk_SSL_CIPHER_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_compfunc_type(cmp))) + +/* clang-format on */ + +/* compatibility */ +#define SSL_set_app_data(s, arg) (SSL_set_ex_data(s, 0, (char *)(arg))) +#define SSL_get_app_data(s) (SSL_get_ex_data(s, 0)) +#define SSL_SESSION_set_app_data(s, a) (SSL_SESSION_set_ex_data(s, 0, \ + (char *)(a))) +#define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s, 0)) +#define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx, 0)) +#define SSL_CTX_set_app_data(ctx, arg) (SSL_CTX_set_ex_data(ctx, 0, \ + (char *)(arg))) +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 void SSL_set_debug(SSL *s, int debug); +#endif + +/* TLSv1.3 KeyUpdate message types */ +/* -1 used so that this is an invalid value for the on-the-wire protocol */ +#define SSL_KEY_UPDATE_NONE -1 +/* Values as defined for the on-the-wire protocol */ +#define SSL_KEY_UPDATE_NOT_REQUESTED 0 +#define SSL_KEY_UPDATE_REQUESTED 1 + +/* + * The valid handshake states (one for each type message sent and one for each + * type of message received). There are also two "special" states: + * TLS = TLS or DTLS state + * DTLS = DTLS specific state + * CR/SR = Client Read/Server Read + * CW/SW = Client Write/Server Write + * + * The "special" states are: + * TLS_ST_BEFORE = No handshake has been initiated yet + * TLS_ST_OK = A handshake has been successfully completed + */ +typedef enum { + TLS_ST_BEFORE, + TLS_ST_OK, + DTLS_ST_CR_HELLO_VERIFY_REQUEST, + TLS_ST_CR_SRVR_HELLO, + TLS_ST_CR_CERT, + TLS_ST_CR_COMP_CERT, + TLS_ST_CR_CERT_STATUS, + TLS_ST_CR_KEY_EXCH, + TLS_ST_CR_CERT_REQ, + TLS_ST_CR_SRVR_DONE, + TLS_ST_CR_SESSION_TICKET, + TLS_ST_CR_CHANGE, + TLS_ST_CR_FINISHED, + TLS_ST_CW_CLNT_HELLO, + TLS_ST_CW_CERT, + TLS_ST_CW_COMP_CERT, + TLS_ST_CW_KEY_EXCH, + TLS_ST_CW_CERT_VRFY, + TLS_ST_CW_CHANGE, + TLS_ST_CW_NEXT_PROTO, + TLS_ST_CW_FINISHED, + TLS_ST_SW_HELLO_REQ, + TLS_ST_SR_CLNT_HELLO, + DTLS_ST_SW_HELLO_VERIFY_REQUEST, + TLS_ST_SW_SRVR_HELLO, + TLS_ST_SW_CERT, + TLS_ST_SW_COMP_CERT, + TLS_ST_SW_KEY_EXCH, + TLS_ST_SW_CERT_REQ, + TLS_ST_SW_SRVR_DONE, + TLS_ST_SR_CERT, + TLS_ST_SR_COMP_CERT, + TLS_ST_SR_KEY_EXCH, + TLS_ST_SR_CERT_VRFY, + TLS_ST_SR_NEXT_PROTO, + TLS_ST_SR_CHANGE, + TLS_ST_SR_FINISHED, + TLS_ST_SW_SESSION_TICKET, + TLS_ST_SW_CERT_STATUS, + TLS_ST_SW_CHANGE, + TLS_ST_SW_FINISHED, + TLS_ST_SW_ENCRYPTED_EXTENSIONS, + TLS_ST_CR_ENCRYPTED_EXTENSIONS, + TLS_ST_CR_CERT_VRFY, + TLS_ST_SW_CERT_VRFY, + TLS_ST_CR_HELLO_REQ, + TLS_ST_SW_KEY_UPDATE, + TLS_ST_CW_KEY_UPDATE, + TLS_ST_SR_KEY_UPDATE, + TLS_ST_CR_KEY_UPDATE, + TLS_ST_EARLY_DATA, + TLS_ST_PENDING_EARLY_DATA_END, + TLS_ST_CW_END_OF_EARLY_DATA, + TLS_ST_SR_END_OF_EARLY_DATA +} OSSL_HANDSHAKE_STATE; + +/* + * Most of the following state values are no longer used and are defined to be + * the closest equivalent value in the current state machine code. Not all + * defines have an equivalent and are set to a dummy value (-1). SSL_ST_CONNECT + * and SSL_ST_ACCEPT are still in use in the definition of SSL_CB_ACCEPT_LOOP, + * SSL_CB_ACCEPT_EXIT, SSL_CB_CONNECT_LOOP and SSL_CB_CONNECT_EXIT. + */ + +#define SSL_ST_CONNECT 0x1000 +#define SSL_ST_ACCEPT 0x2000 + +#define SSL_ST_MASK 0x0FFF + +#define SSL_CB_LOOP 0x01 +#define SSL_CB_EXIT 0x02 +#define SSL_CB_READ 0x04 +#define SSL_CB_WRITE 0x08 +#define SSL_CB_ALERT 0x4000 /* used in callback */ +#define SSL_CB_READ_ALERT (SSL_CB_ALERT | SSL_CB_READ) +#define SSL_CB_WRITE_ALERT (SSL_CB_ALERT | SSL_CB_WRITE) +#define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT | SSL_CB_LOOP) +#define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT | SSL_CB_EXIT) +#define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT | SSL_CB_LOOP) +#define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT | SSL_CB_EXIT) +#define SSL_CB_HANDSHAKE_START 0x10 +#define SSL_CB_HANDSHAKE_DONE 0x20 + +/* Is the SSL_connection established? */ +#define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a)) +#define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a)) +int SSL_in_init(const SSL *s); +int SSL_in_before(const SSL *s); +int SSL_is_init_finished(const SSL *s); + +/* + * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you + * should not need these + */ +#define SSL_ST_READ_HEADER 0xF0 +#define SSL_ST_READ_BODY 0xF1 +#define SSL_ST_READ_DONE 0xF2 + +/*- + * Obtain latest Finished message + * -- that we sent (SSL_get_finished) + * -- that we expected from peer (SSL_get_peer_finished). + * Returns length (0 == no Finished so far), copies up to 'count' bytes. + */ +size_t SSL_get_finished(const SSL *s, void *buf, size_t count); +size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); + +/* + * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options are + * 'ored' with SSL_VERIFY_PEER if they are desired + */ +#define SSL_VERIFY_NONE 0x00 +#define SSL_VERIFY_PEER 0x01 +#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 +#define SSL_VERIFY_CLIENT_ONCE 0x04 +#define SSL_VERIFY_POST_HANDSHAKE 0x08 + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define OpenSSL_add_ssl_algorithms() SSL_library_init() +#define SSLeay_add_ssl_algorithms() SSL_library_init() +#endif + +/* More backward compatibility */ +#define SSL_get_cipher(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_cipher_bits(s, np) \ + SSL_CIPHER_get_bits(SSL_get_current_cipher(s), np) +#define SSL_get_cipher_version(s) \ + SSL_CIPHER_get_version(SSL_get_current_cipher(s)) +#define SSL_get_cipher_name(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_time(a) SSL_SESSION_get_time(a) +#define SSL_set_time(a, b) SSL_SESSION_set_time((a), (b)) +#define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) +#define SSL_set_timeout(a, b) SSL_SESSION_set_timeout((a), (b)) + +#define d2i_SSL_SESSION_bio(bp, s_id) ASN1_d2i_bio_of(SSL_SESSION, SSL_SESSION_new, d2i_SSL_SESSION, bp, s_id) +#define i2d_SSL_SESSION_bio(bp, s_id) ASN1_i2d_bio_of(SSL_SESSION, i2d_SSL_SESSION, bp, s_id) + +DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) +#define SSL_AD_REASON_OFFSET 1000 /* offset to get SSL_R_... value \ + * from SSL_AD_... */ +/* These alert types are for SSLv3 and TLSv1 */ +#define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY +/* fatal */ +#define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE +/* fatal */ +#define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC +#define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED +#define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW +/* fatal */ +#define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE +/* fatal */ +#define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE +/* Not for TLS */ +#define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE +#define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE +#define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE +#define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED +#define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED +#define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN +/* fatal */ +#define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER +/* fatal */ +#define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA +/* fatal */ +#define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED +/* fatal */ +#define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR +#define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR +/* fatal */ +#define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION +/* fatal */ +#define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION +/* fatal */ +#define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY +/* fatal */ +#define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR +#define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED +#define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION +#define SSL_AD_MISSING_EXTENSION TLS13_AD_MISSING_EXTENSION +#define SSL_AD_CERTIFICATE_REQUIRED TLS13_AD_CERTIFICATE_REQUIRED +#define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION +#define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE +#define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME +#define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE +#define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE +/* fatal */ +#define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY +/* fatal */ +#define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK +#define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL +#define SSL_ERROR_NONE 0 +#define SSL_ERROR_SSL 1 +#define SSL_ERROR_WANT_READ 2 +#define SSL_ERROR_WANT_WRITE 3 +#define SSL_ERROR_WANT_X509_LOOKUP 4 +#define SSL_ERROR_SYSCALL 5 /* look at error stack/return \ + * value/errno */ +#define SSL_ERROR_ZERO_RETURN 6 +#define SSL_ERROR_WANT_CONNECT 7 +#define SSL_ERROR_WANT_ACCEPT 8 +#define SSL_ERROR_WANT_ASYNC 9 +#define SSL_ERROR_WANT_ASYNC_JOB 10 +#define SSL_ERROR_WANT_CLIENT_HELLO_CB 11 +#define SSL_ERROR_WANT_RETRY_VERIFY 12 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SSL_CTRL_SET_TMP_DH 3 +#define SSL_CTRL_SET_TMP_ECDH 4 +#define SSL_CTRL_SET_TMP_DH_CB 6 +#endif + +#define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 +#define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 +#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 +#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 +#define SSL_CTRL_GET_FLAGS 13 +#define SSL_CTRL_EXTRA_CHAIN_CERT 14 +#define SSL_CTRL_SET_MSG_CALLBACK 15 +#define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 +/* only applies to datagram connections */ +#define SSL_CTRL_SET_MTU 17 +/* Stats */ +#define SSL_CTRL_SESS_NUMBER 20 +#define SSL_CTRL_SESS_CONNECT 21 +#define SSL_CTRL_SESS_CONNECT_GOOD 22 +#define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 +#define SSL_CTRL_SESS_ACCEPT 24 +#define SSL_CTRL_SESS_ACCEPT_GOOD 25 +#define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 +#define SSL_CTRL_SESS_HIT 27 +#define SSL_CTRL_SESS_CB_HIT 28 +#define SSL_CTRL_SESS_MISSES 29 +#define SSL_CTRL_SESS_TIMEOUTS 30 +#define SSL_CTRL_SESS_CACHE_FULL 31 +#define SSL_CTRL_MODE 33 +#define SSL_CTRL_GET_READ_AHEAD 40 +#define SSL_CTRL_SET_READ_AHEAD 41 +#define SSL_CTRL_SET_SESS_CACHE_SIZE 42 +#define SSL_CTRL_GET_SESS_CACHE_SIZE 43 +#define SSL_CTRL_SET_SESS_CACHE_MODE 44 +#define SSL_CTRL_GET_SESS_CACHE_MODE 45 +#define SSL_CTRL_GET_MAX_CERT_LIST 50 +#define SSL_CTRL_SET_MAX_CERT_LIST 51 +#define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 +/* see tls1.h for macros based on these */ +#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 +#define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 +#define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 +#define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 +#define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 +#define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 +#define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 */ +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 */ +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 */ +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 +#endif +#define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 +#define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 +#define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 +#define SSL_CTRL_SET_SRP_ARG 78 +#define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 +#define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 +#define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 +#define DTLS_CTRL_GET_TIMEOUT 73 +#define DTLS_CTRL_HANDLE_TIMEOUT 74 +#define SSL_CTRL_GET_RI_SUPPORT 76 +#define SSL_CTRL_CLEAR_MODE 78 +#define SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB 79 +#define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 +#define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 +#define SSL_CTRL_CHAIN 88 +#define SSL_CTRL_CHAIN_CERT 89 +#define SSL_CTRL_GET_GROUPS 90 +#define SSL_CTRL_SET_GROUPS 91 +#define SSL_CTRL_SET_GROUPS_LIST 92 +#define SSL_CTRL_GET_SHARED_GROUP 93 +#define SSL_CTRL_SET_SIGALGS 97 +#define SSL_CTRL_SET_SIGALGS_LIST 98 +#define SSL_CTRL_CERT_FLAGS 99 +#define SSL_CTRL_CLEAR_CERT_FLAGS 100 +#define SSL_CTRL_SET_CLIENT_SIGALGS 101 +#define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 +#define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 +#define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 +#define SSL_CTRL_BUILD_CERT_CHAIN 105 +#define SSL_CTRL_SET_VERIFY_CERT_STORE 106 +#define SSL_CTRL_SET_CHAIN_CERT_STORE 107 +#define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 +#define SSL_CTRL_GET_PEER_TMP_KEY 109 +#define SSL_CTRL_GET_RAW_CIPHERLIST 110 +#define SSL_CTRL_GET_EC_POINT_FORMATS 111 +#define SSL_CTRL_GET_CHAIN_CERTS 115 +#define SSL_CTRL_SELECT_CURRENT_CERT 116 +#define SSL_CTRL_SET_CURRENT_CERT 117 +#define SSL_CTRL_SET_DH_AUTO 118 +#define DTLS_CTRL_SET_LINK_MTU 120 +#define DTLS_CTRL_GET_LINK_MIN_MTU 121 +#define SSL_CTRL_GET_EXTMS_SUPPORT 122 +#define SSL_CTRL_SET_MIN_PROTO_VERSION 123 +#define SSL_CTRL_SET_MAX_PROTO_VERSION 124 +#define SSL_CTRL_SET_SPLIT_SEND_FRAGMENT 125 +#define SSL_CTRL_SET_MAX_PIPELINES 126 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 127 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129 +#define SSL_CTRL_GET_MIN_PROTO_VERSION 130 +#define SSL_CTRL_GET_MAX_PROTO_VERSION 131 +#define SSL_CTRL_GET_SIGNATURE_NID 132 +#define SSL_CTRL_GET_TMP_KEY 133 +#define SSL_CTRL_GET_NEGOTIATED_GROUP 134 +#define SSL_CTRL_GET_IANA_GROUPS 135 +#define SSL_CTRL_SET_RETRY_VERIFY 136 +#define SSL_CTRL_GET_VERIFY_CERT_STORE 137 +#define SSL_CTRL_GET_CHAIN_CERT_STORE 138 +#define SSL_CTRL_GET0_IMPLEMENTED_GROUPS 139 +#define SSL_CTRL_GET_SIGNATURE_NAME 140 +#define SSL_CTRL_GET_PEER_SIGNATURE_NAME 141 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP_EX 142 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP_EX 143 +#define SSL_CERT_SET_FIRST 1 +#define SSL_CERT_SET_NEXT 2 +#define SSL_CERT_SET_SERVER 3 +#define DTLSv1_get_timeout(ssl, arg) \ + SSL_ctrl(ssl, DTLS_CTRL_GET_TIMEOUT, 0, (void *)(arg)) +#define DTLSv1_handle_timeout(ssl) \ + SSL_ctrl(ssl, DTLS_CTRL_HANDLE_TIMEOUT, 0, NULL) +#define SSL_num_renegotiations(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_NUM_RENEGOTIATIONS, 0, NULL) +#define SSL_clear_num_renegotiations(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS, 0, NULL) +#define SSL_total_renegotiations(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_TOTAL_RENEGOTIATIONS, 0, NULL) +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SSL_CTX_set_tmp_dh(ctx, dh) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TMP_DH, 0, (char *)(dh)) +#endif +#define SSL_CTX_set_dh_auto(ctx, onoff) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_DH_AUTO, onoff, NULL) +#define SSL_set_dh_auto(s, onoff) \ + SSL_ctrl(s, SSL_CTRL_SET_DH_AUTO, onoff, NULL) +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SSL_set_tmp_dh(ssl, dh) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TMP_DH, 0, (char *)(dh)) +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SSL_CTX_set_tmp_ecdh(ctx, ecdh) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TMP_ECDH, 0, (char *)(ecdh)) +#define SSL_set_tmp_ecdh(ssl, ecdh) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TMP_ECDH, 0, (char *)(ecdh)) +#endif +#define SSL_CTX_add_extra_chain_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_EXTRA_CHAIN_CERT, 0, (char *)(x509)) +#define SSL_CTX_get_extra_chain_certs(ctx, px509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 0, px509) +#define SSL_CTX_get_extra_chain_certs_only(ctx, px509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 1, px509) +#define SSL_CTX_clear_extra_chain_certs(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS, 0, NULL) +#define SSL_CTX_set0_chain(ctx, sk) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN, 0, (char *)(sk)) +#define SSL_CTX_set1_chain(ctx, sk) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN, 1, (char *)(sk)) +#define SSL_CTX_add0_chain_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 0, (char *)(x509)) +#define SSL_CTX_add1_chain_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 1, (char *)(x509)) +#define SSL_CTX_get0_chain_certs(ctx, px509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_CHAIN_CERTS, 0, px509) +#define SSL_CTX_clear_chain_certs(ctx) \ + SSL_CTX_set0_chain(ctx, NULL) +#define SSL_CTX_build_cert_chain(ctx, flags) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +#define SSL_CTX_select_current_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SELECT_CURRENT_CERT, 0, (char *)(x509)) +#define SSL_CTX_set_current_cert(ctx, op) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CURRENT_CERT, op, NULL) +#define SSL_CTX_set0_verify_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_VERIFY_CERT_STORE, 0, (char *)(st)) +#define SSL_CTX_set1_verify_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_VERIFY_CERT_STORE, 1, (char *)(st)) +#define SSL_CTX_get0_verify_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_VERIFY_CERT_STORE, 0, (char *)(st)) +#define SSL_CTX_set0_chain_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CHAIN_CERT_STORE, 0, (char *)(st)) +#define SSL_CTX_set1_chain_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CHAIN_CERT_STORE, 1, (char *)(st)) +#define SSL_CTX_get0_chain_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_CHAIN_CERT_STORE, 0, (char *)(st)) +#define SSL_set0_chain(s, sk) \ + SSL_ctrl(s, SSL_CTRL_CHAIN, 0, (char *)(sk)) +#define SSL_set1_chain(s, sk) \ + SSL_ctrl(s, SSL_CTRL_CHAIN, 1, (char *)(sk)) +#define SSL_add0_chain_cert(s, x509) \ + SSL_ctrl(s, SSL_CTRL_CHAIN_CERT, 0, (char *)(x509)) +#define SSL_add1_chain_cert(s, x509) \ + SSL_ctrl(s, SSL_CTRL_CHAIN_CERT, 1, (char *)(x509)) +#define SSL_get0_chain_certs(s, px509) \ + SSL_ctrl(s, SSL_CTRL_GET_CHAIN_CERTS, 0, px509) +#define SSL_clear_chain_certs(s) \ + SSL_set0_chain(s, NULL) +#define SSL_build_cert_chain(s, flags) \ + SSL_ctrl(s, SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +#define SSL_select_current_cert(s, x509) \ + SSL_ctrl(s, SSL_CTRL_SELECT_CURRENT_CERT, 0, (char *)(x509)) +#define SSL_set_current_cert(s, op) \ + SSL_ctrl(s, SSL_CTRL_SET_CURRENT_CERT, op, NULL) +#define SSL_set0_verify_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_VERIFY_CERT_STORE, 0, (char *)(st)) +#define SSL_set1_verify_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_VERIFY_CERT_STORE, 1, (char *)(st)) +#define SSL_get0_verify_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_GET_VERIFY_CERT_STORE, 0, (char *)(st)) +#define SSL_set0_chain_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_CHAIN_CERT_STORE, 0, (char *)(st)) +#define SSL_set1_chain_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_CHAIN_CERT_STORE, 1, (char *)(st)) +#define SSL_get0_chain_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_GET_CHAIN_CERT_STORE, 0, (char *)(st)) + +#define SSL_get1_groups(s, glist) \ + SSL_ctrl(s, SSL_CTRL_GET_GROUPS, 0, (int *)(glist)) +#define SSL_get0_iana_groups(s, plst) \ + SSL_ctrl(s, SSL_CTRL_GET_IANA_GROUPS, 0, (uint16_t **)(plst)) +#define SSL_CTX_set1_groups(ctx, glist, glistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_GROUPS, glistlen, (int *)(glist)) +#define SSL_CTX_set1_groups_list(ctx, s) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_GROUPS_LIST, 0, (char *)(s)) +#define SSL_CTX_get0_implemented_groups(ctx, all, out) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET0_IMPLEMENTED_GROUPS, all, \ + (STACK_OF(OPENSSL_CSTRING) *)(out)) +#define SSL_set1_groups(s, glist, glistlen) \ + SSL_ctrl(s, SSL_CTRL_SET_GROUPS, glistlen, (char *)(glist)) +#define SSL_set1_groups_list(s, str) \ + SSL_ctrl(s, SSL_CTRL_SET_GROUPS_LIST, 0, (char *)(str)) +#define SSL_get_shared_group(s, n) \ + SSL_ctrl(s, SSL_CTRL_GET_SHARED_GROUP, n, NULL) +#define SSL_get_negotiated_group(s) \ + SSL_ctrl(s, SSL_CTRL_GET_NEGOTIATED_GROUP, 0, NULL) +#define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SIGALGS, slistlen, (int *)(slist)) +#define SSL_CTX_set1_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SIGALGS_LIST, 0, (char *)(s)) +#define SSL_set1_sigalgs(s, slist, slistlen) \ + SSL_ctrl(s, SSL_CTRL_SET_SIGALGS, slistlen, (int *)(slist)) +#define SSL_set1_sigalgs_list(s, str) \ + SSL_ctrl(s, SSL_CTRL_SET_SIGALGS_LIST, 0, (char *)(str)) +#define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS, slistlen, (int *)(slist)) +#define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS_LIST, 0, (char *)(s)) +#define SSL_set1_client_sigalgs(s, slist, slistlen) \ + SSL_ctrl(s, SSL_CTRL_SET_CLIENT_SIGALGS, slistlen, (int *)(slist)) +#define SSL_set1_client_sigalgs_list(s, str) \ + SSL_ctrl(s, SSL_CTRL_SET_CLIENT_SIGALGS_LIST, 0, (char *)(str)) +#define SSL_get0_certificate_types(s, clist) \ + SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)(clist)) +#define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CLIENT_CERT_TYPES, clistlen, \ + (char *)(clist)) +#define SSL_set1_client_certificate_types(s, clist, clistlen) \ + SSL_ctrl(s, SSL_CTRL_SET_CLIENT_CERT_TYPES, clistlen, (char *)(clist)) +#define SSL_get0_signature_name(s, str) \ + SSL_ctrl(s, SSL_CTRL_GET_SIGNATURE_NAME, 0, (1 ? (str) : (const char **)NULL)) +#define SSL_get_signature_nid(s, pn) \ + SSL_ctrl(s, SSL_CTRL_GET_SIGNATURE_NID, 0, pn) +#define SSL_get0_peer_signature_name(s, str) \ + SSL_ctrl(s, SSL_CTRL_GET_PEER_SIGNATURE_NAME, 0, (1 ? (str) : (const char **)NULL)) +#define SSL_get_peer_signature_nid(s, pn) \ + SSL_ctrl(s, SSL_CTRL_GET_PEER_SIGNATURE_NID, 0, pn) +#define SSL_get_peer_tmp_key(s, pk) \ + SSL_ctrl(s, SSL_CTRL_GET_PEER_TMP_KEY, 0, pk) +#define SSL_get_tmp_key(s, pk) \ + SSL_ctrl(s, SSL_CTRL_GET_TMP_KEY, 0, pk) +#define SSL_get0_raw_cipherlist(s, plst) \ + SSL_ctrl(s, SSL_CTRL_GET_RAW_CIPHERLIST, 0, plst) +#define SSL_get0_ec_point_formats(s, plst) \ + SSL_ctrl(s, SSL_CTRL_GET_EC_POINT_FORMATS, 0, plst) +#define SSL_CTX_set_min_proto_version(ctx, version) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) +#define SSL_CTX_set_max_proto_version(ctx, version) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) +#define SSL_CTX_get_min_proto_version(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) +#define SSL_CTX_get_max_proto_version(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) +#define SSL_set_min_proto_version(s, version) \ + SSL_ctrl(s, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) +#define SSL_set_max_proto_version(s, version) \ + SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) +#define SSL_get_min_proto_version(s) \ + SSL_ctrl(s, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) +#define SSL_get_max_proto_version(s) \ + SSL_ctrl(s, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) + +const char *SSL_get0_group_name(SSL *s); +const char *SSL_group_to_name(SSL *s, int id); + +/* Backwards compatibility, original 1.1.0 names */ +#define SSL_CTRL_GET_SERVER_TMP_KEY \ + SSL_CTRL_GET_PEER_TMP_KEY +#define SSL_get_server_tmp_key(s, pk) \ + SSL_get_peer_tmp_key(s, pk) + +int SSL_set0_tmp_dh_pkey(SSL *s, EVP_PKEY *dhpkey); +int SSL_CTX_set0_tmp_dh_pkey(SSL_CTX *ctx, EVP_PKEY *dhpkey); + +/* + * The following symbol names are old and obsolete. They are kept + * for compatibility reasons only and should not be used anymore. + */ +#define SSL_CTRL_GET_CURVES SSL_CTRL_GET_GROUPS +#define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS +#define SSL_CTRL_SET_CURVES_LIST SSL_CTRL_SET_GROUPS_LIST +#define SSL_CTRL_GET_SHARED_CURVE SSL_CTRL_GET_SHARED_GROUP + +#define SSL_get1_curves SSL_get1_groups +#define SSL_CTX_set1_curves SSL_CTX_set1_groups +#define SSL_CTX_set1_curves_list SSL_CTX_set1_groups_list +#define SSL_set1_curves SSL_set1_groups +#define SSL_set1_curves_list SSL_set1_groups_list +#define SSL_get_shared_curve SSL_get_shared_group + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +/* Provide some compatibility macros for removed functionality. */ +#define SSL_CTX_need_tmp_RSA(ctx) 0 +#define SSL_CTX_set_tmp_rsa(ctx, rsa) 1 +#define SSL_need_tmp_RSA(ssl) 0 +#define SSL_set_tmp_rsa(ssl, rsa) 1 +#define SSL_CTX_set_ecdh_auto(dummy, onoff) ((onoff) != 0) +#define SSL_set_ecdh_auto(dummy, onoff) ((onoff) != 0) +/* + * We "pretend" to call the callback to avoid warnings about unused static + * functions. + */ +#define SSL_CTX_set_tmp_rsa_callback(ctx, cb) \ + while (0) \ + (cb)(NULL, 0, 0) +#define SSL_set_tmp_rsa_callback(ssl, cb) \ + while (0) \ + (cb)(NULL, 0, 0) +#endif +__owur const BIO_METHOD *BIO_f_ssl(void); +__owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client); +__owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx); +__owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); +__owur int BIO_ssl_copy_session_id(BIO *to, BIO *from); +void BIO_ssl_shutdown(BIO *ssl_bio); + +__owur int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); +__owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); +__owur SSL_CTX *SSL_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq, + const SSL_METHOD *meth); +int SSL_CTX_up_ref(SSL_CTX *ctx); +void SSL_CTX_free(SSL_CTX *); +__owur long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); +__owur long SSL_CTX_get_timeout(const SSL_CTX *ctx); +__owur X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); +void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); +void SSL_CTX_set1_cert_store(SSL_CTX *, X509_STORE *); +__owur int SSL_want(const SSL *s); +__owur int SSL_clear(SSL *s); + +#ifndef OPENSSL_NO_DEPRECATED_3_4 +OSSL_DEPRECATEDIN_3_4_FOR("not Y2038-safe, replace with SSL_CTX_flush_sessions_ex()") +void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); +#endif +void SSL_CTX_flush_sessions_ex(SSL_CTX *ctx, time_t tm); + +__owur const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); +__owur const SSL_CIPHER *SSL_get_pending_cipher(const SSL *s); +__owur int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); +__owur const char *SSL_CIPHER_get_version(const SSL_CIPHER *c); +__owur const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); +__owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); +__owur const char *OPENSSL_cipher_name(const char *rfc_name); +__owur uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c); +__owur uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c); +__owur int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c); +__owur int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c); +__owur const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c); +__owur int SSL_CIPHER_is_aead(const SSL_CIPHER *c); + +__owur int SSL_get_fd(const SSL *s); +__owur int SSL_get_rfd(const SSL *s); +__owur int SSL_get_wfd(const SSL *s); +__owur const char *SSL_get_cipher_list(const SSL *s, int n); +__owur char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size); +__owur int SSL_get_read_ahead(const SSL *s); +__owur int SSL_pending(const SSL *s); +__owur int SSL_has_pending(const SSL *s); +#ifndef OPENSSL_NO_SOCK +__owur int SSL_set_fd(SSL *s, int fd); +__owur int SSL_set_rfd(SSL *s, int fd); +__owur int SSL_set_wfd(SSL *s, int fd); +#endif +void SSL_set0_rbio(SSL *s, BIO *rbio); +void SSL_set0_wbio(SSL *s, BIO *wbio); +void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); +__owur BIO *SSL_get_rbio(const SSL *s); +__owur BIO *SSL_get_wbio(const SSL *s); +__owur int SSL_set_cipher_list(SSL *s, const char *str); +__owur int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); +__owur int SSL_set_ciphersuites(SSL *s, const char *str); +void SSL_set_read_ahead(SSL *s, int yes); +__owur int SSL_get_verify_mode(const SSL *s); +__owur int SSL_get_verify_depth(const SSL *s); +__owur SSL_verify_cb SSL_get_verify_callback(const SSL *s); +void SSL_set_verify(SSL *s, int mode, SSL_verify_cb callback); +void SSL_set_verify_depth(SSL *s, int depth); +void SSL_set_cert_cb(SSL *s, int (*cb)(SSL *ssl, void *arg), void *arg); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 __owur int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); +OSSL_DEPRECATEDIN_3_0 +__owur int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, + const unsigned char *d, long len); +#endif +__owur int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); +__owur int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, + long len); +__owur int SSL_use_certificate(SSL *ssl, X509 *x); +__owur int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); +__owur int SSL_use_cert_and_key(SSL *ssl, X509 *x509, EVP_PKEY *privatekey, + STACK_OF(X509) *chain, int override); + +/* serverinfo file format versions */ +#define SSL_SERVERINFOV1 1 +#define SSL_SERVERINFOV2 2 + +/* Set serverinfo data for the current active cert. */ +__owur int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, + size_t serverinfo_length); +__owur int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version, + const unsigned char *serverinfo, + size_t serverinfo_length); +__owur int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +__owur int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); +#endif + +__owur int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); +__owur int SSL_use_certificate_file(SSL *ssl, const char *file, int type); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +__owur int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, + int type); +#endif +__owur int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, + int type); +__owur int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, + int type); +/* PEM type */ +__owur int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); +__owur int SSL_use_certificate_chain_file(SSL *ssl, const char *file); +__owur STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); +__owur STACK_OF(X509_NAME) *SSL_load_client_CA_file_ex(const char *file, OSSL_LIB_CTX *libctx, + const char *propq); +__owur int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *file); +int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *dir); +int SSL_add_store_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *uri); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define SSL_load_error_strings() \ + OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ + | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, \ + NULL) +#endif + +__owur const char *SSL_state_string(const SSL *s); +__owur const char *SSL_rstate_string(const SSL *s); +__owur const char *SSL_state_string_long(const SSL *s); +__owur const char *SSL_rstate_string_long(const SSL *s); + +#ifndef OPENSSL_NO_DEPRECATED_3_4 +OSSL_DEPRECATEDIN_3_4_FOR("not Y2038-safe, replace with SSL_SESSION_get_time_ex()") +__owur long SSL_SESSION_get_time(const SSL_SESSION *s); +OSSL_DEPRECATEDIN_3_4_FOR("not Y2038-safe, replace with SSL_SESSION_set_time_ex()") +__owur long SSL_SESSION_set_time(SSL_SESSION *s, long t); +#endif +__owur long SSL_SESSION_get_timeout(const SSL_SESSION *s); +__owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); +__owur int SSL_SESSION_get_protocol_version(const SSL_SESSION *s); +__owur int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version); + +__owur time_t SSL_SESSION_get_time_ex(const SSL_SESSION *s); +__owur time_t SSL_SESSION_set_time_ex(SSL_SESSION *s, time_t t); + +__owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s); +__owur int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname); +void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s, + const unsigned char **alpn, + size_t *len); +__owur int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, + const unsigned char *alpn, + size_t len); +__owur const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s); +__owur int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher); +__owur int SSL_SESSION_has_ticket(const SSL_SESSION *s); +__owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s); +void SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick, + size_t *len); +__owur uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s); +__owur int SSL_SESSION_set_max_early_data(SSL_SESSION *s, + uint32_t max_early_data); +__owur int SSL_copy_session_id(SSL *to, const SSL *from); +__owur X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); +__owur int SSL_SESSION_set1_id_context(SSL_SESSION *s, + const unsigned char *sid_ctx, + unsigned int sid_ctx_len); +__owur int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, + unsigned int sid_len); +__owur int SSL_SESSION_is_resumable(const SSL_SESSION *s); + +__owur SSL_SESSION *SSL_SESSION_new(void); +__owur SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src); +const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, + unsigned int *len); +const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s, + unsigned int *len); +__owur unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); +#ifndef OPENSSL_NO_STDIO +int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); +#endif +int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); +int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x); +int SSL_SESSION_up_ref(SSL_SESSION *ses); +void SSL_SESSION_free(SSL_SESSION *ses); +__owur int i2d_SSL_SESSION(const SSL_SESSION *in, unsigned char **pp); +__owur int SSL_set_session(SSL *to, SSL_SESSION *session); +int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session); +int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session); +__owur int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); +__owur int SSL_set_generate_session_id(SSL *s, GEN_SESSION_CB cb); +__owur int SSL_has_matching_session_id(const SSL *s, + const unsigned char *id, + unsigned int id_len); +SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, + long length); +SSL_SESSION *d2i_SSL_SESSION_ex(SSL_SESSION **a, const unsigned char **pp, + long length, OSSL_LIB_CTX *libctx, + const char *propq); + +#ifdef OPENSSL_X509_H +__owur X509 *SSL_get0_peer_certificate(const SSL *s); +__owur X509 *SSL_get1_peer_certificate(const SSL *s); +/* Deprecated in 3.0.0 */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SSL_get_peer_certificate SSL_get1_peer_certificate +#endif +#endif + +__owur STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); + +__owur int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); +__owur int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); +__owur SSL_verify_cb SSL_CTX_get_verify_callback(const SSL_CTX *ctx); +void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb callback); +void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); +void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, + int (*cb)(X509_STORE_CTX *, void *), + void *arg); +void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb)(SSL *ssl, void *arg), + void *arg); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +__owur int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); +OSSL_DEPRECATEDIN_3_0 +__owur int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, + long len); +#endif +__owur int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); +__owur int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, + const unsigned char *d, long len); +__owur int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); +__owur int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, + const unsigned char *d); +__owur int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey, + STACK_OF(X509) *chain, int override); + +void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); +pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx); +void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx); +void SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb); +void SSL_set_default_passwd_cb_userdata(SSL *s, void *u); +pem_password_cb *SSL_get_default_passwd_cb(SSL *s); +void *SSL_get_default_passwd_cb_userdata(SSL *s); + +__owur int SSL_CTX_check_private_key(const SSL_CTX *ctx); +__owur int SSL_check_private_key(const SSL *ctx); + +__owur int SSL_CTX_set_session_id_context(SSL_CTX *ctx, + const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +SSL *SSL_new(SSL_CTX *ctx); +int SSL_up_ref(SSL *s); +int SSL_is_dtls(const SSL *s); +int SSL_is_tls(const SSL *s); +int SSL_is_quic(const SSL *s); +__owur int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +__owur int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose); +__owur int SSL_set_purpose(SSL *ssl, int purpose); +__owur int SSL_CTX_set_trust(SSL_CTX *ctx, int trust); +__owur int SSL_set_trust(SSL *ssl, int trust); + +__owur int SSL_set1_host(SSL *s, const char *host); +__owur int SSL_add1_host(SSL *s, const char *host); +__owur const char *SSL_get0_peername(SSL *s); +void SSL_set_hostflags(SSL *s, unsigned int flags); + +__owur int SSL_CTX_dane_enable(SSL_CTX *ctx); +__owur int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, + uint8_t mtype, uint8_t ord); +__owur int SSL_dane_enable(SSL *s, const char *basedomain); +__owur int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector, + uint8_t mtype, const unsigned char *data, size_t dlen); +__owur int SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki); +__owur int SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector, + uint8_t *mtype, const unsigned char **data, + size_t *dlen); +/* + * Bridge opacity barrier between libcrypt and libssl, also needed to support + * offline testing in test/danetest.c + */ +SSL_DANE *SSL_get0_dane(SSL *ssl); +/* + * DANE flags + */ +unsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags); +unsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags); +unsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags); +unsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags); + +__owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); +__owur int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); + +__owur X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); +__owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); + +#ifndef OPENSSL_NO_SRP +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); +OSSL_DEPRECATEDIN_3_0 int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); +OSSL_DEPRECATEDIN_3_0 int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); +OSSL_DEPRECATEDIN_3_0 +int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, + char *(*cb)(SSL *, void *)); +OSSL_DEPRECATEDIN_3_0 +int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, + int (*cb)(SSL *, void *)); +OSSL_DEPRECATEDIN_3_0 +int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, + int (*cb)(SSL *, int *, void *)); +OSSL_DEPRECATEDIN_3_0 int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); + +OSSL_DEPRECATEDIN_3_0 +int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, + BIGNUM *sa, BIGNUM *v, char *info); +OSSL_DEPRECATEDIN_3_0 +int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, + const char *grp); + +OSSL_DEPRECATEDIN_3_0 __owur BIGNUM *SSL_get_srp_g(SSL *s); +OSSL_DEPRECATEDIN_3_0 __owur BIGNUM *SSL_get_srp_N(SSL *s); + +OSSL_DEPRECATEDIN_3_0 __owur char *SSL_get_srp_username(SSL *s); +OSSL_DEPRECATEDIN_3_0 __owur char *SSL_get_srp_userinfo(SSL *s); +#endif +#endif + +/* + * ClientHello callback and helpers. + */ + +#define SSL_CLIENT_HELLO_SUCCESS 1 +#define SSL_CLIENT_HELLO_ERROR 0 +#define SSL_CLIENT_HELLO_RETRY (-1) + +typedef int (*SSL_client_hello_cb_fn)(SSL *s, int *al, void *arg); +void SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn cb, + void *arg); +typedef int (*SSL_new_pending_conn_cb_fn)(SSL_CTX *ctx, SSL *new_ssl, + void *arg); +void SSL_CTX_set_new_pending_conn_cb(SSL_CTX *c, SSL_new_pending_conn_cb_fn cb, + void *arg); + +int SSL_client_hello_isv2(SSL *s); +unsigned int SSL_client_hello_get0_legacy_version(SSL *s); +size_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_compression_methods(SSL *s, + const unsigned char **out); +int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen); +int SSL_client_hello_get_extension_order(SSL *s, uint16_t *exts, + size_t *num_exts); +int SSL_client_hello_get0_ext(SSL *s, unsigned int type, + const unsigned char **out, size_t *outlen); + +void SSL_certs_clear(SSL *s); +void SSL_free(SSL *ssl); +#ifdef OSSL_ASYNC_FD +/* + * Windows application developer has to include windows.h to use these. + */ +__owur int SSL_waiting_for_async(SSL *s); +__owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds); +__owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, + size_t *numaddfds, OSSL_ASYNC_FD *delfd, + size_t *numdelfds); +__owur int SSL_CTX_set_async_callback(SSL_CTX *ctx, SSL_async_callback_fn callback); +__owur int SSL_CTX_set_async_callback_arg(SSL_CTX *ctx, void *arg); +__owur int SSL_set_async_callback(SSL *s, SSL_async_callback_fn callback); +__owur int SSL_set_async_callback_arg(SSL *s, void *arg); +__owur int SSL_get_async_status(SSL *s, int *status); + +#endif +__owur int SSL_accept(SSL *ssl); +__owur int SSL_stateless(SSL *s); +__owur int SSL_connect(SSL *ssl); +__owur int SSL_read(SSL *ssl, void *buf, int num); +__owur int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); + +#define SSL_READ_EARLY_DATA_ERROR 0 +#define SSL_READ_EARLY_DATA_SUCCESS 1 +#define SSL_READ_EARLY_DATA_FINISH 2 + +__owur int SSL_read_early_data(SSL *s, void *buf, size_t num, + size_t *readbytes); +__owur int SSL_peek(SSL *ssl, void *buf, int num); +__owur int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); +__owur ossl_ssize_t SSL_sendfile(SSL *s, int fd, off_t offset, size_t size, + int flags); +__owur int SSL_write(SSL *ssl, const void *buf, int num); +__owur int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written); +__owur int SSL_write_early_data(SSL *s, const void *buf, size_t num, + size_t *written); +long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); +long SSL_callback_ctrl(SSL *, int, void (*)(void)); +long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); +long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); + +#define SSL_WRITE_FLAG_CONCLUDE (1U << 0) + +__owur int SSL_write_ex2(SSL *s, const void *buf, size_t num, + uint64_t flags, + size_t *written); + +#define SSL_EARLY_DATA_NOT_SENT 0 +#define SSL_EARLY_DATA_REJECTED 1 +#define SSL_EARLY_DATA_ACCEPTED 2 + +__owur int SSL_get_early_data_status(const SSL *s); + +__owur int SSL_get_error(const SSL *s, int ret_code); +__owur const char *SSL_get_version(const SSL *s); +__owur int SSL_get_handshake_rtt(const SSL *s, uint64_t *rtt); + +/* This sets the 'default' SSL version that SSL_new() will create */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +__owur int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); +#endif + +#ifndef OPENSSL_NO_SSL3_METHOD +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *SSLv3_method(void); /* SSLv3 */ +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *SSLv3_server_method(void); +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *SSLv3_client_method(void); +#endif +#endif + +#define SSLv23_method TLS_method +#define SSLv23_server_method TLS_server_method +#define SSLv23_client_method TLS_client_method + +/* Negotiate highest available SSL/TLS version */ +__owur const SSL_METHOD *TLS_method(void); +__owur const SSL_METHOD *TLS_server_method(void); +__owur const SSL_METHOD *TLS_client_method(void); + +#ifndef OPENSSL_NO_TLS1_METHOD +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */ +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_server_method(void); +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_client_method(void); +#endif +#endif + +#ifndef OPENSSL_NO_TLS1_1_METHOD +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_1_method(void); /* TLSv1.1 */ +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_1_server_method(void); +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_1_client_method(void); +#endif +#endif + +#ifndef OPENSSL_NO_TLS1_2_METHOD +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_2_method(void); /* TLSv1.2 */ +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_2_server_method(void); +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_2_client_method(void); +#endif +#endif + +#ifndef OPENSSL_NO_DTLS1_METHOD +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */ +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_server_method(void); +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_client_method(void); +#endif +#endif + +#ifndef OPENSSL_NO_DTLS1_2_METHOD +/* DTLSv1.2 */ +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_2_method(void); +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_2_server_method(void); +OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_2_client_method(void); +#endif +#endif + +__owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ +__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ +__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ + +__owur size_t DTLS_get_data_mtu(const SSL *s); + +__owur STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); +__owur STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx); +__owur STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *s); +__owur STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s); + +__owur int SSL_do_handshake(SSL *s); +int SSL_key_update(SSL *s, int updatetype); +int SSL_get_key_update_type(const SSL *s); +int SSL_renegotiate(SSL *s); +int SSL_renegotiate_abbreviated(SSL *s); +__owur int SSL_renegotiate_pending(const SSL *s); +int SSL_new_session_ticket(SSL *s); +int SSL_shutdown(SSL *s); +__owur int SSL_verify_client_post_handshake(SSL *s); +void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val); +void SSL_set_post_handshake_auth(SSL *s, int val); + +__owur const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx); +__owur const SSL_METHOD *SSL_get_ssl_method(const SSL *s); +__owur int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); +__owur const char *SSL_alert_type_string_long(int value); +__owur const char *SSL_alert_type_string(int value); +__owur const char *SSL_alert_desc_string_long(int value); +__owur const char *SSL_alert_desc_string(int value); + +void SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +__owur const STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s); +__owur const STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx); +__owur int SSL_add1_to_CA_list(SSL *ssl, const X509 *x); +__owur int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x); +__owur const STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s); + +void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +__owur STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); +__owur STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); +__owur int SSL_add_client_CA(SSL *ssl, X509 *x); +__owur int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); + +void SSL_set_connect_state(SSL *s); +void SSL_set_accept_state(SSL *s); + +__owur long SSL_get_default_timeout(const SSL *s); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define SSL_library_init() OPENSSL_init_ssl(0, NULL) +#endif + +__owur char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); +__owur STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk); + +__owur SSL *SSL_dup(SSL *ssl); + +__owur X509 *SSL_get_certificate(const SSL *ssl); +/* + * EVP_PKEY + */ +struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); + +__owur X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); +__owur EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); + +void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); +__owur int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); +void SSL_set_quiet_shutdown(SSL *ssl, int mode); +__owur int SSL_get_quiet_shutdown(const SSL *ssl); +void SSL_set_shutdown(SSL *ssl, int mode); +__owur int SSL_get_shutdown(const SSL *ssl); +__owur int SSL_version(const SSL *ssl); +__owur int SSL_client_version(const SSL *s); +__owur int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); +__owur int SSL_CTX_set_default_verify_dir(SSL_CTX *ctx); +__owur int SSL_CTX_set_default_verify_file(SSL_CTX *ctx); +__owur int SSL_CTX_set_default_verify_store(SSL_CTX *ctx); +__owur int SSL_CTX_load_verify_file(SSL_CTX *ctx, const char *CAfile); +__owur int SSL_CTX_load_verify_dir(SSL_CTX *ctx, const char *CApath); +__owur int SSL_CTX_load_verify_store(SSL_CTX *ctx, const char *CAstore); +__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx, + const char *CAfile, + const char *CApath); +#define SSL_get0_session SSL_get_session /* just peek at pointer */ +__owur SSL_SESSION *SSL_get_session(const SSL *ssl); +__owur SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ +__owur SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); +SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); +void SSL_set_info_callback(SSL *ssl, + void (*cb)(const SSL *ssl, int type, int val)); +void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type, + int val); +__owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl); + +void SSL_set_verify_result(SSL *ssl, long v); +__owur long SSL_get_verify_result(const SSL *ssl); +__owur STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s); + +__owur size_t SSL_get_client_random(const SSL *ssl, unsigned char *out, + size_t outlen); +__owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out, + size_t outlen); +__owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess, + unsigned char *out, size_t outlen); +__owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess, + const unsigned char *in, size_t len); +uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *sess); + +#define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) +__owur int SSL_set_ex_data(SSL *ssl, int idx, void *data); +void *SSL_get_ex_data(const SSL *ssl, int idx); +#define SSL_SESSION_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef) +__owur int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); +void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); +#define SSL_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef) +__owur int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); +void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); + +__owur int SSL_get_ex_data_X509_STORE_CTX_idx(void); + +#define SSL_CTX_sess_set_cache_size(ctx, t) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SESS_CACHE_SIZE, t, NULL) +#define SSL_CTX_sess_get_cache_size(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_SESS_CACHE_SIZE, 0, NULL) +#define SSL_CTX_set_session_cache_mode(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SESS_CACHE_MODE, m, NULL) +#define SSL_CTX_get_session_cache_mode(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_SESS_CACHE_MODE, 0, NULL) + +#define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) +#define SSL_CTX_set_default_read_ahead(ctx, m) SSL_CTX_set_read_ahead(ctx, m) +#define SSL_CTX_get_read_ahead(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_READ_AHEAD, 0, NULL) +#define SSL_CTX_set_read_ahead(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_READ_AHEAD, m, NULL) +#define SSL_CTX_get_max_cert_list(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_CERT_LIST, 0, NULL) +#define SSL_CTX_set_max_cert_list(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_CERT_LIST, m, NULL) +#define SSL_get_max_cert_list(ssl) \ + SSL_ctrl(ssl, SSL_CTRL_GET_MAX_CERT_LIST, 0, NULL) +#define SSL_set_max_cert_list(ssl, m) \ + SSL_ctrl(ssl, SSL_CTRL_SET_MAX_CERT_LIST, m, NULL) + +#define SSL_CTX_set_max_send_fragment(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_SEND_FRAGMENT, m, NULL) +#define SSL_set_max_send_fragment(ssl, m) \ + SSL_ctrl(ssl, SSL_CTRL_SET_MAX_SEND_FRAGMENT, m, NULL) +#define SSL_CTX_set_split_send_fragment(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SPLIT_SEND_FRAGMENT, m, NULL) +#define SSL_set_split_send_fragment(ssl, m) \ + SSL_ctrl(ssl, SSL_CTRL_SET_SPLIT_SEND_FRAGMENT, m, NULL) +#define SSL_CTX_set_max_pipelines(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PIPELINES, m, NULL) +#define SSL_set_max_pipelines(ssl, m) \ + SSL_ctrl(ssl, SSL_CTRL_SET_MAX_PIPELINES, m, NULL) +#define SSL_set_retry_verify(ssl) \ + (SSL_ctrl(ssl, SSL_CTRL_SET_RETRY_VERIFY, 0, NULL) > 0) + +void SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len); +void SSL_set_default_read_buffer_len(SSL *s, size_t len); + +#ifndef OPENSSL_NO_DH +#ifndef OPENSSL_NO_DEPRECATED_3_0 +/* NB: the |keylength| is only applicable when is_export is true */ +OSSL_DEPRECATEDIN_3_0 +void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, + DH *(*dh)(SSL *ssl, int is_export, + int keylength)); +OSSL_DEPRECATEDIN_3_0 +void SSL_set_tmp_dh_callback(SSL *ssl, + DH *(*dh)(SSL *ssl, int is_export, + int keylength)); +#endif +#endif + +__owur const COMP_METHOD *SSL_get_current_compression(const SSL *s); +__owur const COMP_METHOD *SSL_get_current_expansion(const SSL *s); +__owur const char *SSL_COMP_get_name(const COMP_METHOD *comp); +__owur const char *SSL_COMP_get0_name(const SSL_COMP *comp); +__owur int SSL_COMP_get_id(const SSL_COMP *comp); +STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); +__owur STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) + *meths); +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define SSL_COMP_free_compression_methods() \ + while (0) \ + continue +#endif +__owur int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); + +const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); +int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); +int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c); +int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len, + int isv2format, STACK_OF(SSL_CIPHER) **sk, + STACK_OF(SSL_CIPHER) **scsvs); + +/* TLS extensions functions */ +__owur int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); + +__owur int SSL_set_session_ticket_ext_cb(SSL *s, + tls_session_ticket_ext_cb_fn cb, + void *arg); + +/* Pre-shared secret session resumption functions */ +__owur int SSL_set_session_secret_cb(SSL *s, + tls_session_secret_cb_fn session_secret_cb, + void *arg); + +void SSL_CTX_set_not_resumable_session_callback(SSL_CTX *ctx, + int (*cb)(SSL *ssl, + int + is_forward_secure)); + +void SSL_set_not_resumable_session_callback(SSL *ssl, + int (*cb)(SSL *ssl, + int is_forward_secure)); + +void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, + size_t (*cb)(SSL *ssl, int type, + size_t len, void *arg)); +void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg); +void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx); +int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size); +int SSL_CTX_set_block_padding_ex(SSL_CTX *ctx, size_t app_block_size, + size_t hs_block_size); + +int SSL_set_record_padding_callback(SSL *ssl, + size_t (*cb)(SSL *ssl, int type, + size_t len, void *arg)); +void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg); +void *SSL_get_record_padding_callback_arg(const SSL *ssl); +int SSL_set_block_padding(SSL *ssl, size_t block_size); +int SSL_set_block_padding_ex(SSL *ssl, size_t app_block_size, + size_t hs_block_size); +int SSL_set_num_tickets(SSL *s, size_t num_tickets); +size_t SSL_get_num_tickets(const SSL *s); +int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); +size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); + +/* QUIC support */ +int SSL_handle_events(SSL *s); +__owur int SSL_get_event_timeout(SSL *s, struct timeval *tv, int *is_infinite); +__owur int SSL_get_rpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc); +__owur int SSL_get_wpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc); +__owur int SSL_net_read_desired(SSL *s); +__owur int SSL_net_write_desired(SSL *s); +__owur int SSL_set_blocking_mode(SSL *s, int blocking); +__owur int SSL_get_blocking_mode(SSL *s); +__owur int SSL_set1_initial_peer_addr(SSL *s, const BIO_ADDR *peer_addr); +__owur SSL *SSL_get0_connection(SSL *s); +__owur int SSL_is_connection(SSL *s); + +__owur int SSL_is_listener(SSL *ssl); +__owur SSL *SSL_get0_listener(SSL *s); +#define SSL_LISTENER_FLAG_NO_VALIDATE (1UL << 1) +__owur SSL *SSL_new_listener(SSL_CTX *ctx, uint64_t flags); +__owur SSL *SSL_new_listener_from(SSL *ssl, uint64_t flags); +__owur SSL *SSL_new_from_listener(SSL *ssl, uint64_t flags); +#define SSL_ACCEPT_CONNECTION_NO_BLOCK (1UL << 0) +__owur SSL *SSL_accept_connection(SSL *ssl, uint64_t flags); +__owur size_t SSL_get_accept_connection_queue_len(SSL *ssl); +__owur int SSL_listen(SSL *ssl); + +__owur int SSL_is_domain(SSL *s); +__owur SSL *SSL_get0_domain(SSL *s); +__owur SSL *SSL_new_domain(SSL_CTX *ctx, uint64_t flags); + +#define SSL_DOMAIN_FLAG_SINGLE_THREAD (1U << 0) +#define SSL_DOMAIN_FLAG_MULTI_THREAD (1U << 1) +#define SSL_DOMAIN_FLAG_THREAD_ASSISTED (1U << 2) +#define SSL_DOMAIN_FLAG_BLOCKING (1U << 3) +#define SSL_DOMAIN_FLAG_LEGACY_BLOCKING (1U << 4) + +__owur int SSL_CTX_set_domain_flags(SSL_CTX *ctx, uint64_t domain_flags); +__owur int SSL_CTX_get_domain_flags(const SSL_CTX *ctx, uint64_t *domain_flags); +__owur int SSL_get_domain_flags(const SSL *ssl, uint64_t *domain_flags); + +#define SSL_STREAM_TYPE_NONE 0 +#define SSL_STREAM_TYPE_READ (1U << 0) +#define SSL_STREAM_TYPE_WRITE (1U << 1) +#define SSL_STREAM_TYPE_BIDI (SSL_STREAM_TYPE_READ | SSL_STREAM_TYPE_WRITE) +__owur int SSL_get_stream_type(SSL *s); + +__owur uint64_t SSL_get_stream_id(SSL *s); +__owur int SSL_is_stream_local(SSL *s); + +#define SSL_DEFAULT_STREAM_MODE_NONE 0 +#define SSL_DEFAULT_STREAM_MODE_AUTO_BIDI 1 +#define SSL_DEFAULT_STREAM_MODE_AUTO_UNI 2 +__owur int SSL_set_default_stream_mode(SSL *s, uint32_t mode); + +#define SSL_STREAM_FLAG_UNI (1U << 0) +#define SSL_STREAM_FLAG_NO_BLOCK (1U << 1) +#define SSL_STREAM_FLAG_ADVANCE (1U << 2) +__owur SSL *SSL_new_stream(SSL *s, uint64_t flags); + +#define SSL_INCOMING_STREAM_POLICY_AUTO 0 +#define SSL_INCOMING_STREAM_POLICY_ACCEPT 1 +#define SSL_INCOMING_STREAM_POLICY_REJECT 2 +__owur int SSL_set_incoming_stream_policy(SSL *s, int policy, uint64_t aec); + +#define SSL_ACCEPT_STREAM_NO_BLOCK (1U << 0) +#define SSL_ACCEPT_STREAM_UNI (1U << 1) +#define SSL_ACCEPT_STREAM_BIDI (1U << 2) +__owur SSL *SSL_accept_stream(SSL *s, uint64_t flags); +__owur size_t SSL_get_accept_stream_queue_len(SSL *s); + +#ifndef OPENSSL_NO_QUIC +__owur int SSL_inject_net_dgram(SSL *s, const unsigned char *buf, + size_t buf_len, + const BIO_ADDR *peer, + const BIO_ADDR *local); +#endif + +typedef struct ssl_shutdown_ex_args_st { + uint64_t quic_error_code; + const char *quic_reason; +} SSL_SHUTDOWN_EX_ARGS; + +#define SSL_SHUTDOWN_FLAG_RAPID (1U << 0) +#define SSL_SHUTDOWN_FLAG_NO_STREAM_FLUSH (1U << 1) +#define SSL_SHUTDOWN_FLAG_NO_BLOCK (1U << 2) +#define SSL_SHUTDOWN_FLAG_WAIT_PEER (1U << 3) + +__owur int SSL_shutdown_ex(SSL *ssl, uint64_t flags, + const SSL_SHUTDOWN_EX_ARGS *args, + size_t args_len); + +__owur int SSL_stream_conclude(SSL *ssl, uint64_t flags); + +typedef struct ssl_stream_reset_args_st { + uint64_t quic_error_code; +} SSL_STREAM_RESET_ARGS; + +__owur int SSL_stream_reset(SSL *ssl, + const SSL_STREAM_RESET_ARGS *args, + size_t args_len); + +#define SSL_STREAM_STATE_NONE 0 +#define SSL_STREAM_STATE_OK 1 +#define SSL_STREAM_STATE_WRONG_DIR 2 +#define SSL_STREAM_STATE_FINISHED 3 +#define SSL_STREAM_STATE_RESET_LOCAL 4 +#define SSL_STREAM_STATE_RESET_REMOTE 5 +#define SSL_STREAM_STATE_CONN_CLOSED 6 +__owur int SSL_get_stream_read_state(SSL *ssl); +__owur int SSL_get_stream_write_state(SSL *ssl); + +__owur int SSL_get_stream_read_error_code(SSL *ssl, uint64_t *app_error_code); +__owur int SSL_get_stream_write_error_code(SSL *ssl, uint64_t *app_error_code); + +#define SSL_CONN_CLOSE_FLAG_LOCAL (1U << 0) +#define SSL_CONN_CLOSE_FLAG_TRANSPORT (1U << 1) + +typedef struct ssl_conn_close_info_st { + uint64_t error_code, frame_type; + const char *reason; + size_t reason_len; + uint32_t flags; +} SSL_CONN_CLOSE_INFO; + +__owur int SSL_get_conn_close_info(SSL *ssl, + SSL_CONN_CLOSE_INFO *info, + size_t info_len); + +#define SSL_VALUE_CLASS_GENERIC 0 +#define SSL_VALUE_CLASS_FEATURE_REQUEST 1 +#define SSL_VALUE_CLASS_FEATURE_PEER_REQUEST 2 +#define SSL_VALUE_CLASS_FEATURE_NEGOTIATED 3 + +#define SSL_VALUE_NONE 0 +#define SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL 1 +#define SSL_VALUE_QUIC_STREAM_BIDI_REMOTE_AVAIL 2 +#define SSL_VALUE_QUIC_STREAM_UNI_LOCAL_AVAIL 3 +#define SSL_VALUE_QUIC_STREAM_UNI_REMOTE_AVAIL 4 +#define SSL_VALUE_QUIC_IDLE_TIMEOUT 5 +#define SSL_VALUE_EVENT_HANDLING_MODE 6 +#define SSL_VALUE_STREAM_WRITE_BUF_SIZE 7 +#define SSL_VALUE_STREAM_WRITE_BUF_USED 8 +#define SSL_VALUE_STREAM_WRITE_BUF_AVAIL 9 + +#define SSL_VALUE_EVENT_HANDLING_MODE_INHERIT 0 +#define SSL_VALUE_EVENT_HANDLING_MODE_IMPLICIT 1 +#define SSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT 2 + +int SSL_get_value_uint(SSL *s, uint32_t class_, uint32_t id, uint64_t *v); +int SSL_set_value_uint(SSL *s, uint32_t class_, uint32_t id, uint64_t v); + +#define SSL_get_generic_value_uint(ssl, id, v) \ + SSL_get_value_uint((ssl), SSL_VALUE_CLASS_GENERIC, (id), (v)) +#define SSL_set_generic_value_uint(ssl, id, v) \ + SSL_set_value_uint((ssl), SSL_VALUE_CLASS_GENERIC, (id), (v)) +#define SSL_get_feature_request_uint(ssl, id, v) \ + SSL_get_value_uint((ssl), SSL_VALUE_CLASS_FEATURE_REQUEST, (id), (v)) +#define SSL_set_feature_request_uint(ssl, id, v) \ + SSL_set_value_uint((ssl), SSL_VALUE_CLASS_FEATURE_REQUEST, (id), (v)) +#define SSL_get_feature_peer_request_uint(ssl, id, v) \ + SSL_get_value_uint((ssl), SSL_VALUE_CLASS_FEATURE_PEER_REQUEST, (id), (v)) +#define SSL_get_feature_negotiated_uint(ssl, id, v) \ + SSL_get_value_uint((ssl), SSL_VALUE_CLASS_FEATURE_NEGOTIATED, (id), (v)) + +#define SSL_get_quic_stream_bidi_local_avail(ssl, value) \ + SSL_get_generic_value_uint((ssl), SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL, \ + (value)) +#define SSL_get_quic_stream_bidi_remote_avail(ssl, value) \ + SSL_get_generic_value_uint((ssl), SSL_VALUE_QUIC_STREAM_BIDI_REMOTE_AVAIL, \ + (value)) +#define SSL_get_quic_stream_uni_local_avail(ssl, value) \ + SSL_get_generic_value_uint((ssl), SSL_VALUE_QUIC_STREAM_UNI_LOCAL_AVAIL, \ + (value)) +#define SSL_get_quic_stream_uni_remote_avail(ssl, value) \ + SSL_get_generic_value_uint((ssl), SSL_VALUE_QUIC_STREAM_UNI_REMOTE_AVAIL, \ + (value)) + +#define SSL_get_event_handling_mode(ssl, value) \ + SSL_get_generic_value_uint((ssl), SSL_VALUE_EVENT_HANDLING_MODE, \ + (value)) +#define SSL_set_event_handling_mode(ssl, value) \ + SSL_set_generic_value_uint((ssl), SSL_VALUE_EVENT_HANDLING_MODE, \ + (value)) + +#define SSL_get_stream_write_buf_size(ssl, value) \ + SSL_get_generic_value_uint((ssl), SSL_VALUE_STREAM_WRITE_BUF_SIZE, \ + (value)) +#define SSL_get_stream_write_buf_used(ssl, value) \ + SSL_get_generic_value_uint((ssl), SSL_VALUE_STREAM_WRITE_BUF_USED, \ + (value)) +#define SSL_get_stream_write_buf_avail(ssl, value) \ + SSL_get_generic_value_uint((ssl), SSL_VALUE_STREAM_WRITE_BUF_AVAIL, \ + (value)) + +#define SSL_POLL_EVENT_NONE 0 + +#define SSL_POLL_EVENT_F (1U << 0) /* F (Failure) */ +#define SSL_POLL_EVENT_EL (1U << 1) /* EL (Exception on Listener) */ +#define SSL_POLL_EVENT_EC (1U << 2) /* EC (Exception on Conn) */ +#define SSL_POLL_EVENT_ECD (1U << 3) /* ECD (Exception on Conn Drained) */ +#define SSL_POLL_EVENT_ER (1U << 4) /* ER (Exception on Read) */ +#define SSL_POLL_EVENT_EW (1U << 5) /* EW (Exception on Write) */ +#define SSL_POLL_EVENT_R (1U << 6) /* R (Readable) */ +#define SSL_POLL_EVENT_W (1U << 7) /* W (Writable) */ +#define SSL_POLL_EVENT_IC (1U << 8) /* IC (Incoming Connection) */ +#define SSL_POLL_EVENT_ISB (1U << 9) /* ISB (Incoming Stream: Bidi) */ +#define SSL_POLL_EVENT_ISU (1U << 10) /* ISU (Incoming Stream: Uni) */ +#define SSL_POLL_EVENT_OSB (1U << 11) /* OSB (Outgoing Stream: Bidi) */ +#define SSL_POLL_EVENT_OSU (1U << 12) /* OSU (Outgoing Stream: Uni) */ + +#define SSL_POLL_EVENT_RW (SSL_POLL_EVENT_R | SSL_POLL_EVENT_W) +#define SSL_POLL_EVENT_RE (SSL_POLL_EVENT_R | SSL_POLL_EVENT_ER) +#define SSL_POLL_EVENT_WE (SSL_POLL_EVENT_W | SSL_POLL_EVENT_EW) +#define SSL_POLL_EVENT_RWE (SSL_POLL_EVENT_RE | SSL_POLL_EVENT_WE) +#define SSL_POLL_EVENT_E (SSL_POLL_EVENT_EL | SSL_POLL_EVENT_EC \ + | SSL_POLL_EVENT_ER | SSL_POLL_EVENT_EW) +#define SSL_POLL_EVENT_IS (SSL_POLL_EVENT_ISB | SSL_POLL_EVENT_ISU) +#define SSL_POLL_EVENT_ISE (SSL_POLL_EVENT_IS | SSL_POLL_EVENT_EC) +#define SSL_POLL_EVENT_I (SSL_POLL_EVENT_IS | SSL_POLL_EVENT_IC) +#define SSL_POLL_EVENT_OS (SSL_POLL_EVENT_OSB | SSL_POLL_EVENT_OSU) +#define SSL_POLL_EVENT_OSE (SSL_POLL_EVENT_OS | SSL_POLL_EVENT_EC) + +typedef struct ssl_poll_item_st { + BIO_POLL_DESCRIPTOR desc; + uint64_t events, revents; +} SSL_POLL_ITEM; + +#define SSL_POLL_FLAG_NO_HANDLE_EVENTS (1U << 0) + +__owur int SSL_poll(SSL_POLL_ITEM *items, + size_t num_items, + size_t stride, + const struct timeval *timeout, + uint64_t flags, + size_t *result_count); + +static ossl_inline ossl_unused BIO_POLL_DESCRIPTOR +SSL_as_poll_descriptor(SSL *s) +{ + BIO_POLL_DESCRIPTOR d; + + d.type = BIO_POLL_DESCRIPTOR_TYPE_SSL; + d.value.ssl = s; + return d; +} + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define SSL_cache_hit(s) SSL_session_reused(s) +#endif + +__owur int SSL_session_reused(const SSL *s); +__owur int SSL_is_server(const SSL *s); + +__owur __owur SSL_CONF_CTX *SSL_CONF_CTX_new(void); +int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); +void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); +unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); +__owur unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, + unsigned int flags); +__owur int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); + +void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); +void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); + +__owur int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); +__owur int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); +__owur int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); + +void SSL_add_ssl_module(void); +int SSL_config(SSL *s, const char *name); +int SSL_CTX_config(SSL_CTX *ctx, const char *name); + +#ifndef OPENSSL_NO_SSL_TRACE +void SSL_trace(int write_p, int version, int content_type, + const void *buf, size_t len, SSL *ssl, void *arg); +#endif + +#ifndef OPENSSL_NO_SOCK +int DTLSv1_listen(SSL *s, BIO_ADDR *client); +#endif + +#ifndef OPENSSL_NO_CT + +/* + * A callback for verifying that the received SCTs are sufficient. + * Expected to return 1 if they are sufficient, otherwise 0. + * May return a negative integer if an error occurs. + * A connection should be aborted if the SCTs are deemed insufficient. + */ +typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx, + const STACK_OF(SCT) *scts, void *arg); + +/* + * Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate + * the received SCTs. + * If the callback returns a non-positive result, the connection is terminated. + * Call this function before beginning a handshake. + * If a NULL |callback| is provided, SCT validation is disabled. + * |arg| is arbitrary userdata that will be passed to the callback whenever it + * is invoked. Ownership of |arg| remains with the caller. + * + * NOTE: A side-effect of setting a CT callback is that an OCSP stapled response + * will be requested. + */ +int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback, + void *arg); +int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx, + ssl_ct_validation_cb callback, + void *arg); +#define SSL_disable_ct(s) \ + ((void)SSL_set_validation_callback((s), NULL, NULL)) +#define SSL_CTX_disable_ct(ctx) \ + ((void)SSL_CTX_set_validation_callback((ctx), NULL, NULL)) + +/* + * The validation type enumerates the available behaviours of the built-in SSL + * CT validation callback selected via SSL_enable_ct() and SSL_CTX_enable_ct(). + * The underlying callback is a static function in libssl. + */ +enum { + SSL_CT_VALIDATION_PERMISSIVE = 0, + SSL_CT_VALIDATION_STRICT +}; + +/* + * Enable CT by setting up a callback that implements one of the built-in + * validation variants. The SSL_CT_VALIDATION_PERMISSIVE variant always + * continues the handshake, the application can make appropriate decisions at + * handshake completion. The SSL_CT_VALIDATION_STRICT variant requires at + * least one valid SCT, or else handshake termination will be requested. The + * handshake may continue anyway if SSL_VERIFY_NONE is in effect. + */ +int SSL_enable_ct(SSL *s, int validation_mode); +int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode); + +/* + * Report whether a non-NULL callback is enabled. + */ +int SSL_ct_is_enabled(const SSL *s); +int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx); + +/* Gets the SCTs received from a connection */ +const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s); + +/* + * Loads the CT log list from the default location. + * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, + * the log information loaded from this file will be appended to the + * CTLOG_STORE. + * Returns 1 on success, 0 otherwise. + */ +int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx); + +/* + * Loads the CT log list from the specified file path. + * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, + * the log information loaded from this file will be appended to the + * CTLOG_STORE. + * Returns 1 on success, 0 otherwise. + */ +int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path); + +/* + * Sets the CT log list used by all SSL connections created from this SSL_CTX. + * Ownership of the CTLOG_STORE is transferred to the SSL_CTX. + */ +void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs); + +/* + * Gets the CT log list used by all SSL connections created from this SSL_CTX. + * This will be NULL unless one of the following functions has been called: + * - SSL_CTX_set_default_ctlog_list_file + * - SSL_CTX_set_ctlog_list_file + * - SSL_CTX_set_ctlog_store + */ +const CTLOG_STORE *SSL_CTX_get0_ctlog_store(const SSL_CTX *ctx); + +#endif /* OPENSSL_NO_CT */ + +/* What the "other" parameter contains in security callback */ +/* Mask for type */ +#define SSL_SECOP_OTHER_TYPE 0xffff0000 +#define SSL_SECOP_OTHER_NONE 0 +#define SSL_SECOP_OTHER_CIPHER (1 << 16) +#define SSL_SECOP_OTHER_CURVE (2 << 16) +#define SSL_SECOP_OTHER_DH (3 << 16) +#define SSL_SECOP_OTHER_PKEY (4 << 16) +#define SSL_SECOP_OTHER_SIGALG (5 << 16) +#define SSL_SECOP_OTHER_CERT (6 << 16) + +/* Indicated operation refers to peer key or certificate */ +#define SSL_SECOP_PEER 0x1000 + +/* Values for "op" parameter in security callback */ + +/* Called to filter ciphers */ +/* Ciphers client supports */ +#define SSL_SECOP_CIPHER_SUPPORTED (1 | SSL_SECOP_OTHER_CIPHER) +/* Cipher shared by client/server */ +#define SSL_SECOP_CIPHER_SHARED (2 | SSL_SECOP_OTHER_CIPHER) +/* Sanity check of cipher server selects */ +#define SSL_SECOP_CIPHER_CHECK (3 | SSL_SECOP_OTHER_CIPHER) +/* Curves supported by client */ +#define SSL_SECOP_CURVE_SUPPORTED (4 | SSL_SECOP_OTHER_CURVE) +/* Curves shared by client/server */ +#define SSL_SECOP_CURVE_SHARED (5 | SSL_SECOP_OTHER_CURVE) +/* Sanity check of curve server selects */ +#define SSL_SECOP_CURVE_CHECK (6 | SSL_SECOP_OTHER_CURVE) +/* Temporary DH key */ +#define SSL_SECOP_TMP_DH (7 | SSL_SECOP_OTHER_PKEY) +/* SSL/TLS version */ +#define SSL_SECOP_VERSION (9 | SSL_SECOP_OTHER_NONE) +/* Session tickets */ +#define SSL_SECOP_TICKET (10 | SSL_SECOP_OTHER_NONE) +/* Supported signature algorithms sent to peer */ +#define SSL_SECOP_SIGALG_SUPPORTED (11 | SSL_SECOP_OTHER_SIGALG) +/* Shared signature algorithm */ +#define SSL_SECOP_SIGALG_SHARED (12 | SSL_SECOP_OTHER_SIGALG) +/* Sanity check signature algorithm allowed */ +#define SSL_SECOP_SIGALG_CHECK (13 | SSL_SECOP_OTHER_SIGALG) +/* Used to get mask of supported public key signature algorithms */ +#define SSL_SECOP_SIGALG_MASK (14 | SSL_SECOP_OTHER_SIGALG) +/* Use to see if compression is allowed */ +#define SSL_SECOP_COMPRESSION (15 | SSL_SECOP_OTHER_NONE) +/* EE key in certificate */ +#define SSL_SECOP_EE_KEY (16 | SSL_SECOP_OTHER_CERT) +/* CA key in certificate */ +#define SSL_SECOP_CA_KEY (17 | SSL_SECOP_OTHER_CERT) +/* CA digest algorithm in certificate */ +#define SSL_SECOP_CA_MD (18 | SSL_SECOP_OTHER_CERT) +/* Peer EE key in certificate */ +#define SSL_SECOP_PEER_EE_KEY (SSL_SECOP_EE_KEY | SSL_SECOP_PEER) +/* Peer CA key in certificate */ +#define SSL_SECOP_PEER_CA_KEY (SSL_SECOP_CA_KEY | SSL_SECOP_PEER) +/* Peer CA digest algorithm in certificate */ +#define SSL_SECOP_PEER_CA_MD (SSL_SECOP_CA_MD | SSL_SECOP_PEER) + +void SSL_set_security_level(SSL *s, int level); +__owur int SSL_get_security_level(const SSL *s); +void SSL_set_security_callback(SSL *s, + int (*cb)(const SSL *s, const SSL_CTX *ctx, + int op, int bits, int nid, + void *other, void *ex)); +int (*SSL_get_security_callback(const SSL *s))(const SSL *s, + const SSL_CTX *ctx, int op, + int bits, int nid, void *other, + void *ex); +void SSL_set0_security_ex_data(SSL *s, void *ex); +__owur void *SSL_get0_security_ex_data(const SSL *s); + +void SSL_CTX_set_security_level(SSL_CTX *ctx, int level); +__owur int SSL_CTX_get_security_level(const SSL_CTX *ctx); +void SSL_CTX_set_security_callback(SSL_CTX *ctx, + int (*cb)(const SSL *s, const SSL_CTX *ctx, + int op, int bits, int nid, + void *other, void *ex)); +int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx))(const SSL *s, + const SSL_CTX *ctx, + int op, int bits, + int nid, + void *other, + void *ex); +void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex); +__owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx); + +/* OPENSSL_INIT flag 0x010000 reserved for internal use */ +#define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x00100000L +#define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L + +#define OPENSSL_INIT_SSL_DEFAULT \ + (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS) + +int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); + +#ifndef OPENSSL_NO_UNIT_TEST +__owur const struct openssl_ssl_test_functions *SSL_test_functions(void); +#endif + +__owur int SSL_free_buffers(SSL *ssl); +__owur int SSL_alloc_buffers(SSL *ssl); + +/* Status codes passed to the decrypt session ticket callback. Some of these + * are for internal use only and are never passed to the callback. */ +typedef int SSL_TICKET_STATUS; + +/* Support for ticket appdata */ +/* fatal error, malloc failure */ +#define SSL_TICKET_FATAL_ERR_MALLOC 0 +/* fatal error, either from parsing or decrypting the ticket */ +#define SSL_TICKET_FATAL_ERR_OTHER 1 +/* No ticket present */ +#define SSL_TICKET_NONE 2 +/* Empty ticket present */ +#define SSL_TICKET_EMPTY 3 +/* the ticket couldn't be decrypted */ +#define SSL_TICKET_NO_DECRYPT 4 +/* a ticket was successfully decrypted */ +#define SSL_TICKET_SUCCESS 5 +/* same as above but the ticket needs to be renewed */ +#define SSL_TICKET_SUCCESS_RENEW 6 + +/* Return codes for the decrypt session ticket callback */ +typedef int SSL_TICKET_RETURN; + +/* An error occurred */ +#define SSL_TICKET_RETURN_ABORT 0 +/* Do not use the ticket, do not send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_IGNORE 1 +/* Do not use the ticket, send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_IGNORE_RENEW 2 +/* Use the ticket, do not send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_USE 3 +/* Use the ticket, send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_USE_RENEW 4 + +typedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg); +typedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss, + const unsigned char *keyname, + size_t keyname_length, + SSL_TICKET_STATUS status, + void *arg); +int SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx, + SSL_CTX_generate_session_ticket_fn gen_cb, + SSL_CTX_decrypt_session_ticket_fn dec_cb, + void *arg); +int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len); +int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len); + +typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us); + +void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb); + +typedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg); +void SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx, + SSL_allow_early_data_cb_fn cb, + void *arg); +void SSL_set_allow_early_data_cb(SSL *s, + SSL_allow_early_data_cb_fn cb, + void *arg); + +/* store the default cipher strings inside the library */ +const char *OSSL_default_cipher_list(void); +const char *OSSL_default_ciphersuites(void); + +/* RFC8879 Certificate compression APIs */ + +int SSL_CTX_compress_certs(SSL_CTX *ctx, int alg); +int SSL_compress_certs(SSL *ssl, int alg); + +int SSL_CTX_set1_cert_comp_preference(SSL_CTX *ctx, int *algs, size_t len); +int SSL_set1_cert_comp_preference(SSL *ssl, int *algs, size_t len); + +int SSL_CTX_set1_compressed_cert(SSL_CTX *ctx, int algorithm, unsigned char *comp_data, + size_t comp_length, size_t orig_length); +int SSL_set1_compressed_cert(SSL *ssl, int algorithm, unsigned char *comp_data, + size_t comp_length, size_t orig_length); +size_t SSL_CTX_get1_compressed_cert(SSL_CTX *ctx, int alg, unsigned char **data, size_t *orig_len); +size_t SSL_get1_compressed_cert(SSL *ssl, int alg, unsigned char **data, size_t *orig_len); + +__owur int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk); +__owur EVP_PKEY *SSL_get0_peer_rpk(const SSL *s); +__owur EVP_PKEY *SSL_SESSION_get0_peer_rpk(SSL_SESSION *s); +__owur int SSL_get_negotiated_client_cert_type(const SSL *s); +__owur int SSL_get_negotiated_server_cert_type(const SSL *s); + +__owur int SSL_set1_client_cert_type(SSL *s, const unsigned char *val, size_t len); +__owur int SSL_set1_server_cert_type(SSL *s, const unsigned char *val, size_t len); +__owur int SSL_CTX_set1_client_cert_type(SSL_CTX *ctx, const unsigned char *val, size_t len); +__owur int SSL_CTX_set1_server_cert_type(SSL_CTX *ctx, const unsigned char *val, size_t len); +__owur int SSL_get0_client_cert_type(const SSL *s, unsigned char **t, size_t *len); +__owur int SSL_get0_server_cert_type(const SSL *s, unsigned char **t, size_t *len); +__owur int SSL_CTX_get0_client_cert_type(const SSL_CTX *ctx, unsigned char **t, size_t *len); +__owur int SSL_CTX_get0_server_cert_type(const SSL_CTX *s, unsigned char **t, size_t *len); + +/* + * Protection level. For <= TLSv1.2 only "NONE" and "APPLICATION" are used. + */ +#define OSSL_RECORD_PROTECTION_LEVEL_NONE 0 +#define OSSL_RECORD_PROTECTION_LEVEL_EARLY 1 +#define OSSL_RECORD_PROTECTION_LEVEL_HANDSHAKE 2 +#define OSSL_RECORD_PROTECTION_LEVEL_APPLICATION 3 + +int SSL_set_quic_tls_cbs(SSL *s, const OSSL_DISPATCH *qtdis, void *arg); +int SSL_set_quic_tls_transport_params(SSL *s, + const unsigned char *params, + size_t params_len); + +int SSL_set_quic_tls_early_data_enabled(SSL *s, int enabled); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ssl2.h b/VCMP-LUA/modules/postgresql/include/openssl/ssl2.h new file mode 100644 index 0000000..67d1d02 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ssl2.h @@ -0,0 +1,30 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_SSL2_H +#define OPENSSL_SSL2_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_SSL2_H +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define SSL2_VERSION 0x0002 + +#define SSL2_MT_CLIENT_HELLO 1 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ssl3.h b/VCMP-LUA/modules/postgresql/include/openssl/ssl3.h new file mode 100644 index 0000000..f35b6ea --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ssl3.h @@ -0,0 +1,357 @@ +/* + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_SSL3_H +#define OPENSSL_SSL3_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_SSL3_H +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Signalling cipher suite value from RFC 5746 + * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) + */ +#define SSL3_CK_SCSV 0x030000FF + +/* + * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 + * (TLS_FALLBACK_SCSV) + */ +#define SSL3_CK_FALLBACK_SCSV 0x03005600 + +#define SSL3_CK_RSA_NULL_MD5 0x03000001 +#define SSL3_CK_RSA_NULL_SHA 0x03000002 +#define SSL3_CK_RSA_RC4_40_MD5 0x03000003 +#define SSL3_CK_RSA_RC4_128_MD5 0x03000004 +#define SSL3_CK_RSA_RC4_128_SHA 0x03000005 +#define SSL3_CK_RSA_RC2_40_MD5 0x03000006 +#define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 +#define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 +#define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 +#define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A + +#define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B +#define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C +#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D +#define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E +#define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F +#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 + +#define SSL3_CK_DHE_DSS_DES_40_CBC_SHA 0x03000011 +#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA SSL3_CK_DHE_DSS_DES_40_CBC_SHA +#define SSL3_CK_DHE_DSS_DES_64_CBC_SHA 0x03000012 +#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA SSL3_CK_DHE_DSS_DES_64_CBC_SHA +#define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA 0x03000013 +#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA SSL3_CK_DHE_DSS_DES_192_CBC3_SHA +#define SSL3_CK_DHE_RSA_DES_40_CBC_SHA 0x03000014 +#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA SSL3_CK_DHE_RSA_DES_40_CBC_SHA +#define SSL3_CK_DHE_RSA_DES_64_CBC_SHA 0x03000015 +#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA SSL3_CK_DHE_RSA_DES_64_CBC_SHA +#define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA 0x03000016 +#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA SSL3_CK_DHE_RSA_DES_192_CBC3_SHA + +#define SSL3_CK_ADH_RC4_40_MD5 0x03000017 +#define SSL3_CK_ADH_RC4_128_MD5 0x03000018 +#define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 +#define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A +#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B + +/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ +#define SSL3_RFC_RSA_NULL_MD5 "TLS_RSA_WITH_NULL_MD5" +#define SSL3_RFC_RSA_NULL_SHA "TLS_RSA_WITH_NULL_SHA" +#define SSL3_RFC_RSA_DES_192_CBC3_SHA "TLS_RSA_WITH_3DES_EDE_CBC_SHA" +#define SSL3_RFC_DHE_DSS_DES_192_CBC3_SHA "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" +#define SSL3_RFC_DHE_RSA_DES_192_CBC3_SHA "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA" +#define SSL3_RFC_ADH_DES_192_CBC_SHA "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA" +#define SSL3_RFC_RSA_IDEA_128_SHA "TLS_RSA_WITH_IDEA_CBC_SHA" +#define SSL3_RFC_RSA_RC4_128_MD5 "TLS_RSA_WITH_RC4_128_MD5" +#define SSL3_RFC_RSA_RC4_128_SHA "TLS_RSA_WITH_RC4_128_SHA" +#define SSL3_RFC_ADH_RC4_128_MD5 "TLS_DH_anon_WITH_RC4_128_MD5" + +#define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" +#define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" +#define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" +#define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" +#define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" +#define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" + +#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" +#define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" +#define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" +#define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" +#define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" +#define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" + +/* + * This next block of six "EDH" labels is for backward compatibility with + * older versions of OpenSSL. New code should use the six "DHE" labels above + * instead: + */ +#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" +#define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" +#define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" + +#define SSL3_SSL_SESSION_ID_LENGTH 32 +#define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 + +#define SSL3_MASTER_SECRET_SIZE 48 +#define SSL3_RANDOM_SIZE 32 +#define SSL3_SESSION_ID_SIZE 32 +#define SSL3_RT_HEADER_LENGTH 5 + +#define SSL3_HM_HEADER_LENGTH 4 + +#ifndef SSL3_ALIGN_PAYLOAD +/* + * Some will argue that this increases memory footprint, but it's not + * actually true. Point is that malloc has to return at least 64-bit aligned + * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. + * Suggested pre-gaping simply moves these wasted bytes from the end of + * allocated region to its front, but makes data payload aligned, which + * improves performance:-) + */ +#define SSL3_ALIGN_PAYLOAD 8 +#else +#if (SSL3_ALIGN_PAYLOAD & (SSL3_ALIGN_PAYLOAD - 1)) != 0 +#error "insane SSL3_ALIGN_PAYLOAD" +#undef SSL3_ALIGN_PAYLOAD +#endif +#endif + +/* + * This is the maximum MAC (digest) size used by the SSL library. Currently + * maximum of 20 is used by SHA1, but we reserve for future extension for + * 512-bit hashes. + */ + +#define SSL3_RT_MAX_MD_SIZE 64 + +/* + * Maximum block size used in all ciphersuites. Currently 16 for AES. + */ + +#define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 + +#define SSL3_RT_MAX_EXTRA (16384) + +/* Maximum plaintext length: defined by SSL/TLS standards */ +#define SSL3_RT_MAX_PLAIN_LENGTH 16384 +/* Maximum compression overhead: defined by SSL/TLS standards */ +#define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 + +/* + * The standards give a maximum encryption overhead of 1024 bytes. In + * practice the value is lower than this. The overhead is the maximum number + * of padding bytes (256) plus the mac size. + */ +#define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) +#define SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD 256 + +/* + * OpenSSL currently only uses a padding length of at most one block so the + * send overhead is smaller. + */ + +#define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ + (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) + +/* If compression isn't used don't include the compression overhead */ + +#ifdef OPENSSL_NO_COMP +#define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH +#else +#define SSL3_RT_MAX_COMPRESSED_LENGTH \ + (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_COMPRESSED_OVERHEAD) +#endif +#define SSL3_RT_MAX_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_ENCRYPTED_OVERHEAD + SSL3_RT_MAX_COMPRESSED_LENGTH) +#define SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD) +#define SSL3_RT_MAX_PACKET_SIZE \ + (SSL3_RT_MAX_ENCRYPTED_LENGTH + SSL3_RT_HEADER_LENGTH) + +#define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" +#define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" + +/* SSL3_VERSION is defined in prov_ssl.h */ +#define SSL3_VERSION_MAJOR 0x03 +#define SSL3_VERSION_MINOR 0x00 + +#define SSL3_RT_CHANGE_CIPHER_SPEC 20 +#define SSL3_RT_ALERT 21 +#define SSL3_RT_HANDSHAKE 22 +#define SSL3_RT_APPLICATION_DATA 23 + +/* Pseudo content types to indicate additional parameters */ +#define TLS1_RT_CRYPTO 0x1000 +#define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) +#define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) +#define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) +#define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) + +#define TLS1_RT_CRYPTO_READ 0x0000 +#define TLS1_RT_CRYPTO_WRITE 0x0100 +#define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) +#define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) +#define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) +#define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) + +/* Pseudo content types for SSL/TLS header info */ +#define SSL3_RT_HEADER 0x100 +#define SSL3_RT_INNER_CONTENT_TYPE 0x101 + +/* Pseudo content types for QUIC */ +#define SSL3_RT_QUIC_DATAGRAM 0x200 +#define SSL3_RT_QUIC_PACKET 0x201 +#define SSL3_RT_QUIC_FRAME_FULL 0x202 +#define SSL3_RT_QUIC_FRAME_HEADER 0x203 +#define SSL3_RT_QUIC_FRAME_PADDING 0x204 + +#define SSL3_AL_WARNING 1 +#define SSL3_AL_FATAL 2 + +#define SSL3_AD_CLOSE_NOTIFY 0 +#define SSL3_AD_UNEXPECTED_MESSAGE 10 /* fatal */ +#define SSL3_AD_BAD_RECORD_MAC 20 /* fatal */ +#define SSL3_AD_DECOMPRESSION_FAILURE 30 /* fatal */ +#define SSL3_AD_HANDSHAKE_FAILURE 40 /* fatal */ +#define SSL3_AD_NO_CERTIFICATE 41 +#define SSL3_AD_BAD_CERTIFICATE 42 +#define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 +#define SSL3_AD_CERTIFICATE_REVOKED 44 +#define SSL3_AD_CERTIFICATE_EXPIRED 45 +#define SSL3_AD_CERTIFICATE_UNKNOWN 46 +#define SSL3_AD_ILLEGAL_PARAMETER 47 /* fatal */ + +#define TLS1_HB_REQUEST 1 +#define TLS1_HB_RESPONSE 2 + +#define SSL3_CT_RSA_SIGN 1 +#define SSL3_CT_DSS_SIGN 2 +#define SSL3_CT_RSA_FIXED_DH 3 +#define SSL3_CT_DSS_FIXED_DH 4 +#define SSL3_CT_RSA_EPHEMERAL_DH 5 +#define SSL3_CT_DSS_EPHEMERAL_DH 6 +#define SSL3_CT_FORTEZZA_DMS 20 +/* + * SSL3_CT_NUMBER is used to size arrays and it must be large enough to + * contain all of the cert types defined for *either* SSLv3 and TLSv1. + */ +#define SSL3_CT_NUMBER 12 + +#if defined(TLS_CT_NUMBER) +#if TLS_CT_NUMBER != SSL3_CT_NUMBER +#error "SSL/TLS CT_NUMBER values do not match" +#endif +#endif + +/* No longer used as of OpenSSL 1.1.1 */ +#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 + +/* Removed from OpenSSL 1.1.0 */ +#define TLS1_FLAGS_TLS_PADDING_BUG 0x0 + +#define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 + +/* Set if we encrypt then mac instead of usual mac then encrypt */ +#define TLS1_FLAGS_ENCRYPT_THEN_MAC_READ 0x0100 +#define TLS1_FLAGS_ENCRYPT_THEN_MAC TLS1_FLAGS_ENCRYPT_THEN_MAC_READ + +/* Set if extended master secret extension received from peer */ +#define TLS1_FLAGS_RECEIVED_EXTMS 0x0200 + +#define TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE 0x0400 + +#define TLS1_FLAGS_STATELESS 0x0800 + +/* Set if extended master secret extension required on renegotiation */ +#define TLS1_FLAGS_REQUIRED_EXTMS 0x1000 + +/* 0x2000 is reserved for TLS1_FLAGS_QUIC (internal) */ +/* 0x4000 is reserved for TLS1_FLAGS_QUIC_INTERNAL (internal) */ + +#define SSL3_MT_HELLO_REQUEST 0 +#define SSL3_MT_CLIENT_HELLO 1 +#define SSL3_MT_SERVER_HELLO 2 +#define SSL3_MT_NEWSESSION_TICKET 4 +#define SSL3_MT_END_OF_EARLY_DATA 5 +#define SSL3_MT_ENCRYPTED_EXTENSIONS 8 +#define SSL3_MT_CERTIFICATE 11 +#define SSL3_MT_SERVER_KEY_EXCHANGE 12 +#define SSL3_MT_CERTIFICATE_REQUEST 13 +#define SSL3_MT_SERVER_DONE 14 +#define SSL3_MT_CERTIFICATE_VERIFY 15 +#define SSL3_MT_CLIENT_KEY_EXCHANGE 16 +#define SSL3_MT_FINISHED 20 +#define SSL3_MT_CERTIFICATE_URL 21 +#define SSL3_MT_CERTIFICATE_STATUS 22 +#define SSL3_MT_SUPPLEMENTAL_DATA 23 +#define SSL3_MT_KEY_UPDATE 24 +#define SSL3_MT_COMPRESSED_CERTIFICATE 25 +#ifndef OPENSSL_NO_NEXTPROTONEG +#define SSL3_MT_NEXT_PROTO 67 +#endif +#define SSL3_MT_MESSAGE_HASH 254 +#define DTLS1_MT_HELLO_VERIFY_REQUEST 3 + +/* Dummy message type for handling CCS like a normal handshake message */ +#define SSL3_MT_CHANGE_CIPHER_SPEC 0x0101 + +#define SSL3_MT_CCS 1 + +/* These are used when changing over to a new cipher */ +#define SSL3_CC_READ 0x001 +#define SSL3_CC_WRITE 0x002 +#define SSL3_CC_CLIENT 0x010 +#define SSL3_CC_SERVER 0x020 +#define SSL3_CC_EARLY 0x040 +#define SSL3_CC_HANDSHAKE 0x080 +#define SSL3_CC_APPLICATION 0x100 +#define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT | SSL3_CC_WRITE) +#define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER | SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT | SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER | SSL3_CC_WRITE) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/sslerr.h b/VCMP-LUA/modules/postgresql/include/openssl/sslerr.h new file mode 100644 index 0000000..6993255 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/sslerr.h @@ -0,0 +1,380 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_SSLERR_H +#define OPENSSL_SSLERR_H +#pragma once + +#include +#include +#include + +/* + * SSL reason codes. + */ +#define SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY 291 +#define SSL_R_APP_DATA_IN_HANDSHAKE 100 +#define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 +#define SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE 158 +#define SSL_R_BAD_CERTIFICATE 348 +#define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 +#define SSL_R_BAD_CIPHER 186 +#define SSL_R_BAD_COMPRESSION_ALGORITHM 326 +#define SSL_R_BAD_DATA 390 +#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 +#define SSL_R_BAD_DECOMPRESSION 107 +#define SSL_R_BAD_DH_VALUE 102 +#define SSL_R_BAD_DIGEST_LENGTH 111 +#define SSL_R_BAD_EARLY_DATA 233 +#define SSL_R_BAD_ECC_CERT 304 +#define SSL_R_BAD_ECPOINT 306 +#define SSL_R_BAD_EXTENSION 110 +#define SSL_R_BAD_HANDSHAKE_LENGTH 332 +#define SSL_R_BAD_HANDSHAKE_STATE 236 +#define SSL_R_BAD_HELLO_REQUEST 105 +#define SSL_R_BAD_HRR_VERSION 263 +#define SSL_R_BAD_KEY_SHARE 108 +#define SSL_R_BAD_KEY_UPDATE 122 +#define SSL_R_BAD_LEGACY_VERSION 292 +#define SSL_R_BAD_LENGTH 271 +#define SSL_R_BAD_PACKET 240 +#define SSL_R_BAD_PACKET_LENGTH 115 +#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 +#define SSL_R_BAD_PSK 219 +#define SSL_R_BAD_PSK_IDENTITY 114 +#define SSL_R_BAD_RECORD_TYPE 443 +#define SSL_R_BAD_RSA_ENCRYPT 119 +#define SSL_R_BAD_SIGNATURE 123 +#define SSL_R_BAD_SRP_A_LENGTH 347 +#define SSL_R_BAD_SRP_PARAMETERS 371 +#define SSL_R_BAD_SRTP_MKI_VALUE 352 +#define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 +#define SSL_R_BAD_SSL_FILETYPE 124 +#define SSL_R_BAD_VALUE 384 +#define SSL_R_BAD_WRITE_RETRY 127 +#define SSL_R_BINDER_DOES_NOT_VERIFY 253 +#define SSL_R_BIO_NOT_SET 128 +#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 +#define SSL_R_BN_LIB 130 +#define SSL_R_CALLBACK_FAILED 234 +#define SSL_R_CANNOT_CHANGE_CIPHER 109 +#define SSL_R_CANNOT_GET_GROUP_NAME 299 +#define SSL_R_CA_DN_LENGTH_MISMATCH 131 +#define SSL_R_CA_KEY_TOO_SMALL 397 +#define SSL_R_CA_MD_TOO_WEAK 398 +#define SSL_R_CCS_RECEIVED_EARLY 133 +#define SSL_R_CERTIFICATE_VERIFY_FAILED 134 +#define SSL_R_CERT_CB_ERROR 377 +#define SSL_R_CERT_LENGTH_MISMATCH 135 +#define SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED 218 +#define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 +#define SSL_R_CLIENTHELLO_TLSEXT 226 +#define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 +#define SSL_R_COMPRESSION_DISABLED 343 +#define SSL_R_COMPRESSION_FAILURE 141 +#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 +#define SSL_R_COMPRESSION_LIBRARY_ERROR 142 +#define SSL_R_CONNECTION_TYPE_NOT_SET 144 +#define SSL_R_CONN_USE_ONLY 356 +#define SSL_R_CONTEXT_NOT_DANE_ENABLED 167 +#define SSL_R_COOKIE_GEN_CALLBACK_FAILURE 400 +#define SSL_R_COOKIE_MISMATCH 308 +#define SSL_R_COPY_PARAMETERS_FAILED 296 +#define SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED 206 +#define SSL_R_DANE_ALREADY_ENABLED 172 +#define SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL 173 +#define SSL_R_DANE_NOT_ENABLED 175 +#define SSL_R_DANE_TLSA_BAD_CERTIFICATE 180 +#define SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE 184 +#define SSL_R_DANE_TLSA_BAD_DATA_LENGTH 189 +#define SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH 192 +#define SSL_R_DANE_TLSA_BAD_MATCHING_TYPE 200 +#define SSL_R_DANE_TLSA_BAD_PUBLIC_KEY 201 +#define SSL_R_DANE_TLSA_BAD_SELECTOR 202 +#define SSL_R_DANE_TLSA_NULL_DATA 203 +#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 +#define SSL_R_DATA_LENGTH_TOO_LONG 146 +#define SSL_R_DECRYPTION_FAILED 147 +#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 +#define SSL_R_DH_KEY_TOO_SMALL 394 +#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 +#define SSL_R_DIGEST_CHECK_FAILED 149 +#define SSL_R_DOMAIN_USE_ONLY 422 +#define SSL_R_DTLS_MESSAGE_TOO_BIG 334 +#define SSL_R_DUPLICATE_COMPRESSION_ID 309 +#define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 +#define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 +#define SSL_R_EE_KEY_TOO_SMALL 399 +#define SSL_R_EMPTY_RAW_PUBLIC_KEY 349 +#define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 +#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 +#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 +#define SSL_R_ERROR_IN_SYSTEM_DEFAULT_CONFIG 419 +#define SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN 204 +#define SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE 194 +#define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 +#define SSL_R_EXTENSION_NOT_RECEIVED 279 +#define SSL_R_EXTRA_DATA_IN_MESSAGE 153 +#define SSL_R_EXT_LENGTH_MISMATCH 163 +#define SSL_R_FAILED_TO_GET_PARAMETER 316 +#define SSL_R_FAILED_TO_INIT_ASYNC 405 +#define SSL_R_FEATURE_NEGOTIATION_NOT_COMPLETE 417 +#define SSL_R_FEATURE_NOT_RENEGOTIABLE 413 +#define SSL_R_FRAGMENTED_CLIENT_HELLO 401 +#define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 +#define SSL_R_HTTPS_PROXY_REQUEST 155 +#define SSL_R_HTTP_REQUEST 156 +#define SSL_R_ILLEGAL_POINT_COMPRESSION 162 +#define SSL_R_ILLEGAL_SUITEB_DIGEST 380 +#define SSL_R_INAPPROPRIATE_FALLBACK 373 +#define SSL_R_INCONSISTENT_COMPRESSION 340 +#define SSL_R_INCONSISTENT_EARLY_DATA_ALPN 222 +#define SSL_R_INCONSISTENT_EARLY_DATA_SNI 231 +#define SSL_R_INCONSISTENT_EXTMS 104 +#define SSL_R_INSUFFICIENT_SECURITY 241 +#define SSL_R_INVALID_ALERT 205 +#define SSL_R_INVALID_CCS_MESSAGE 260 +#define SSL_R_INVALID_CERTIFICATE_OR_ALG 238 +#define SSL_R_INVALID_COMMAND 280 +#define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 +#define SSL_R_INVALID_CONFIG 283 +#define SSL_R_INVALID_CONFIGURATION_NAME 113 +#define SSL_R_INVALID_CONTEXT 282 +#define SSL_R_INVALID_CT_VALIDATION_TYPE 212 +#define SSL_R_INVALID_KEY_UPDATE_TYPE 120 +#define SSL_R_INVALID_MAX_EARLY_DATA 174 +#define SSL_R_INVALID_NULL_CMD_NAME 385 +#define SSL_R_INVALID_RAW_PUBLIC_KEY 350 +#define SSL_R_INVALID_RECORD 317 +#define SSL_R_INVALID_SEQUENCE_NUMBER 402 +#define SSL_R_INVALID_SERVERINFO_DATA 388 +#define SSL_R_INVALID_SESSION_ID 999 +#define SSL_R_INVALID_SRP_USERNAME 357 +#define SSL_R_INVALID_STATUS_RESPONSE 328 +#define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 +#define SSL_R_LEGACY_SIGALG_DISALLOWED_OR_UNSUPPORTED 333 +#define SSL_R_LENGTH_MISMATCH 159 +#define SSL_R_LENGTH_TOO_LONG 404 +#define SSL_R_LENGTH_TOO_SHORT 160 +#define SSL_R_LIBRARY_BUG 274 +#define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 +#define SSL_R_LISTENER_USE_ONLY 421 +#define SSL_R_MAXIMUM_ENCRYPTED_PKTS_REACHED 395 +#define SSL_R_MISSING_DSA_SIGNING_CERT 165 +#define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 +#define SSL_R_MISSING_FATAL 256 +#define SSL_R_MISSING_PARAMETERS 290 +#define SSL_R_MISSING_PSK_KEX_MODES_EXTENSION 310 +#define SSL_R_MISSING_QUIC_TLS_FUNCTIONS 423 +#define SSL_R_MISSING_RSA_CERTIFICATE 168 +#define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 +#define SSL_R_MISSING_RSA_SIGNING_CERT 170 +#define SSL_R_MISSING_SIGALGS_EXTENSION 112 +#define SSL_R_MISSING_SIGNING_CERT 221 +#define SSL_R_MISSING_SRP_PARAM 358 +#define SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION 209 +#define SSL_R_MISSING_SUPPORTED_VERSIONS_EXTENSION 420 +#define SSL_R_MISSING_TMP_DH_KEY 171 +#define SSL_R_MISSING_TMP_ECDH_KEY 311 +#define SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA 293 +#define SSL_R_NOT_ON_RECORD_BOUNDARY 182 +#define SSL_R_NOT_REPLACING_CERTIFICATE 289 +#define SSL_R_NOT_SERVER 284 +#define SSL_R_NO_APPLICATION_PROTOCOL 235 +#define SSL_R_NO_CERTIFICATES_RETURNED 176 +#define SSL_R_NO_CERTIFICATE_ASSIGNED 177 +#define SSL_R_NO_CERTIFICATE_SET 179 +#define SSL_R_NO_CHANGE_FOLLOWING_HRR 214 +#define SSL_R_NO_CIPHERS_AVAILABLE 181 +#define SSL_R_NO_CIPHERS_SPECIFIED 183 +#define SSL_R_NO_CIPHER_MATCH 185 +#define SSL_R_NO_CLIENT_CERT_METHOD 331 +#define SSL_R_NO_COMPRESSION_SPECIFIED 187 +#define SSL_R_NO_COOKIE_CALLBACK_SET 287 +#define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 +#define SSL_R_NO_METHOD_SPECIFIED 188 +#define SSL_R_NO_PEM_EXTENSIONS 389 +#define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 +#define SSL_R_NO_PROTOCOLS_AVAILABLE 191 +#define SSL_R_NO_RENEGOTIATION 339 +#define SSL_R_NO_REQUIRED_DIGEST 324 +#define SSL_R_NO_SHARED_CIPHER 193 +#define SSL_R_NO_SHARED_GROUPS 410 +#define SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS 376 +#define SSL_R_NO_SRTP_PROFILES 359 +#define SSL_R_NO_STREAM 355 +#define SSL_R_NO_SUITABLE_DIGEST_ALGORITHM 297 +#define SSL_R_NO_SUITABLE_GROUPS 295 +#define SSL_R_NO_SUITABLE_KEY_SHARE 101 +#define SSL_R_NO_SUITABLE_RECORD_LAYER 322 +#define SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM 118 +#define SSL_R_NO_VALID_SCTS 216 +#define SSL_R_NO_VERIFY_COOKIE_CALLBACK 403 +#define SSL_R_NULL_SSL_CTX 195 +#define SSL_R_NULL_SSL_METHOD_PASSED 196 +#define SSL_R_OCSP_CALLBACK_FAILURE 305 +#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 +#define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 +#define SSL_R_OVERFLOW_ERROR 237 +#define SSL_R_PACKET_LENGTH_TOO_LONG 198 +#define SSL_R_PARSE_TLSEXT 227 +#define SSL_R_PATH_TOO_LONG 270 +#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 +#define SSL_R_PEM_NAME_BAD_PREFIX 391 +#define SSL_R_PEM_NAME_TOO_SHORT 392 +#define SSL_R_PIPELINE_FAILURE 406 +#define SSL_R_POLL_REQUEST_NOT_SUPPORTED 418 +#define SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR 278 +#define SSL_R_PRIVATE_KEY_MISMATCH 288 +#define SSL_R_PROTOCOL_IS_SHUTDOWN 207 +#define SSL_R_PSK_IDENTITY_NOT_FOUND 223 +#define SSL_R_PSK_NO_CLIENT_CB 224 +#define SSL_R_PSK_NO_SERVER_CB 225 +#define SSL_R_QUIC_HANDSHAKE_LAYER_ERROR 393 +#define SSL_R_QUIC_NETWORK_ERROR 387 +#define SSL_R_QUIC_PROTOCOL_ERROR 382 +#define SSL_R_READ_BIO_NOT_SET 211 +#define SSL_R_READ_TIMEOUT_EXPIRED 312 +#define SSL_R_RECORDS_NOT_RELEASED 321 +#define SSL_R_RECORD_LAYER_FAILURE 313 +#define SSL_R_RECORD_LENGTH_MISMATCH 213 +#define SSL_R_RECORD_TOO_SMALL 298 +#define SSL_R_REMOTE_PEER_ADDRESS_NOT_SET 346 +#define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 +#define SSL_R_RENEGOTIATION_ENCODING_ERR 336 +#define SSL_R_RENEGOTIATION_MISMATCH 337 +#define SSL_R_REQUEST_PENDING 285 +#define SSL_R_REQUEST_SENT 286 +#define SSL_R_REQUIRED_CIPHER_MISSING 215 +#define SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING 342 +#define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 +#define SSL_R_SCT_VERIFICATION_FAILED 208 +#define SSL_R_SEQUENCE_CTR_WRAPPED 327 +#define SSL_R_SERVERHELLO_TLSEXT 275 +#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 +#define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 +#define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 +#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 +#define SSL_R_SRP_A_CALC 361 +#define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 +#define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 +#define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 +#define SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH 232 +#define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 +#define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 +#define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 +#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 +#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +#define SSL_R_SSL_COMMAND_SECTION_EMPTY 117 +#define SSL_R_SSL_COMMAND_SECTION_NOT_FOUND 125 +#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 +#define SSL_R_SSL_HANDSHAKE_FAILURE 229 +#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 +#define SSL_R_SSL_NEGATIVE_LENGTH 372 +#define SSL_R_SSL_SECTION_EMPTY 126 +#define SSL_R_SSL_SECTION_NOT_FOUND 136 +#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 +#define SSL_R_SSL_SESSION_ID_CONFLICT 302 +#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 +#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 +#define SSL_R_SSL_SESSION_ID_TOO_LONG 408 +#define SSL_R_SSL_SESSION_VERSION_MISMATCH 210 +#define SSL_R_STILL_IN_INIT 121 +#define SSL_R_STREAM_COUNT_LIMITED 411 +#define SSL_R_STREAM_FINISHED 365 +#define SSL_R_STREAM_RECV_ONLY 366 +#define SSL_R_STREAM_RESET 375 +#define SSL_R_STREAM_SEND_ONLY 379 +#define SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED 1116 +#define SSL_R_TLSV13_ALERT_MISSING_EXTENSION 1109 +#define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 +#define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 +#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 +#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 +#define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +#define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 +#define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 +#define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +#define SSL_R_TLSV1_ALERT_NO_APPLICATION_PROTOCOL 1120 +#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 +#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 +#define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 +#define SSL_R_TLSV1_ALERT_UNKNOWN_PSK_IDENTITY 1115 +#define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 +#define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 +#define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 +#define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 +#define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 +#define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 +#define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 +#define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 +#define SSL_R_TOO_MANY_KEY_UPDATES 132 +#define SSL_R_TOO_MANY_WARN_ALERTS 409 +#define SSL_R_TOO_MUCH_EARLY_DATA 164 +#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 +#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 +#define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 +#define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 +#define SSL_R_UNEXPECTED_CCS_MESSAGE 262 +#define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178 +#define SSL_R_UNEXPECTED_EOF_WHILE_READING 294 +#define SSL_R_UNEXPECTED_MESSAGE 244 +#define SSL_R_UNEXPECTED_RECORD 245 +#define SSL_R_UNINITIALIZED 276 +#define SSL_R_UNKNOWN_ALERT_TYPE 246 +#define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 +#define SSL_R_UNKNOWN_CIPHER_RETURNED 248 +#define SSL_R_UNKNOWN_CIPHER_TYPE 249 +#define SSL_R_UNKNOWN_CMD_NAME 386 +#define SSL_R_UNKNOWN_COMMAND 139 +#define SSL_R_UNKNOWN_DIGEST 368 +#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 +#define SSL_R_UNKNOWN_MANDATORY_PARAMETER 323 +#define SSL_R_UNKNOWN_PKEY_TYPE 251 +#define SSL_R_UNKNOWN_PROTOCOL 252 +#define SSL_R_UNKNOWN_SSL_VERSION 254 +#define SSL_R_UNKNOWN_STATE 255 +#define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 +#define SSL_R_UNSOLICITED_EXTENSION 217 +#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 +#define SSL_R_UNSUPPORTED_CONFIG_VALUE 414 +#define SSL_R_UNSUPPORTED_CONFIG_VALUE_CLASS 415 +#define SSL_R_UNSUPPORTED_CONFIG_VALUE_OP 416 +#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 +#define SSL_R_UNSUPPORTED_PROTOCOL 258 +#define SSL_R_UNSUPPORTED_SSL_VERSION 259 +#define SSL_R_UNSUPPORTED_STATUS_TYPE 329 +#define SSL_R_UNSUPPORTED_WRITE_FLAG 412 +#define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 +#define SSL_R_VERSION_TOO_HIGH 166 +#define SSL_R_VERSION_TOO_LOW 396 +#define SSL_R_WRONG_CERTIFICATE_TYPE 383 +#define SSL_R_WRONG_CIPHER_RETURNED 261 +#define SSL_R_WRONG_CURVE 378 +#define SSL_R_WRONG_RPK_TYPE 351 +#define SSL_R_WRONG_SIGNATURE_LENGTH 264 +#define SSL_R_WRONG_SIGNATURE_SIZE 265 +#define SSL_R_WRONG_SIGNATURE_TYPE 370 +#define SSL_R_WRONG_SSL_VERSION 266 +#define SSL_R_WRONG_VERSION_NUMBER 267 +#define SSL_R_X509_LIB 268 +#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/sslerr_legacy.h b/VCMP-LUA/modules/postgresql/include/openssl/sslerr_legacy.h new file mode 100644 index 0000000..8cf1ebd --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/sslerr_legacy.h @@ -0,0 +1,467 @@ +/* + * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * This header file preserves symbols from pre-3.0 OpenSSL. + * It should never be included directly, as it's already included + * by the public sslerr.h headers, and since it will go away some + * time in the future. + */ + +#ifndef OPENSSL_SSLERR_LEGACY_H +#define OPENSSL_SSLERR_LEGACY_H +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int ERR_load_SSL_strings(void); + +/* Collected _F_ macros from OpenSSL 1.1.1 */ + +/* + * SSL function codes. + */ +#define SSL_F_ADD_CLIENT_KEY_SHARE_EXT 0 +#define SSL_F_ADD_KEY_SHARE 0 +#define SSL_F_BYTES_TO_CIPHER_LIST 0 +#define SSL_F_CHECK_SUITEB_CIPHER_LIST 0 +#define SSL_F_CIPHERSUITE_CB 0 +#define SSL_F_CONSTRUCT_CA_NAMES 0 +#define SSL_F_CONSTRUCT_KEY_EXCHANGE_TBS 0 +#define SSL_F_CONSTRUCT_STATEFUL_TICKET 0 +#define SSL_F_CONSTRUCT_STATELESS_TICKET 0 +#define SSL_F_CREATE_SYNTHETIC_MESSAGE_HASH 0 +#define SSL_F_CREATE_TICKET_PREQUEL 0 +#define SSL_F_CT_MOVE_SCTS 0 +#define SSL_F_CT_STRICT 0 +#define SSL_F_CUSTOM_EXT_ADD 0 +#define SSL_F_CUSTOM_EXT_PARSE 0 +#define SSL_F_D2I_SSL_SESSION 0 +#define SSL_F_DANE_CTX_ENABLE 0 +#define SSL_F_DANE_MTYPE_SET 0 +#define SSL_F_DANE_TLSA_ADD 0 +#define SSL_F_DERIVE_SECRET_KEY_AND_IV 0 +#define SSL_F_DO_DTLS1_WRITE 0 +#define SSL_F_DO_SSL3_WRITE 0 +#define SSL_F_DTLS1_BUFFER_RECORD 0 +#define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 0 +#define SSL_F_DTLS1_HEARTBEAT 0 +#define SSL_F_DTLS1_HM_FRAGMENT_NEW 0 +#define SSL_F_DTLS1_PREPROCESS_FRAGMENT 0 +#define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 0 +#define SSL_F_DTLS1_PROCESS_RECORD 0 +#define SSL_F_DTLS1_READ_BYTES 0 +#define SSL_F_DTLS1_READ_FAILED 0 +#define SSL_F_DTLS1_RETRANSMIT_MESSAGE 0 +#define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 0 +#define SSL_F_DTLS1_WRITE_BYTES 0 +#define SSL_F_DTLSV1_LISTEN 0 +#define SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC 0 +#define SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST 0 +#define SSL_F_DTLS_GET_REASSEMBLED_MESSAGE 0 +#define SSL_F_DTLS_PROCESS_HELLO_VERIFY 0 +#define SSL_F_DTLS_RECORD_LAYER_NEW 0 +#define SSL_F_DTLS_WAIT_FOR_DRY 0 +#define SSL_F_EARLY_DATA_COUNT_OK 0 +#define SSL_F_FINAL_EARLY_DATA 0 +#define SSL_F_FINAL_EC_PT_FORMATS 0 +#define SSL_F_FINAL_EMS 0 +#define SSL_F_FINAL_KEY_SHARE 0 +#define SSL_F_FINAL_MAXFRAGMENTLEN 0 +#define SSL_F_FINAL_RENEGOTIATE 0 +#define SSL_F_FINAL_SERVER_NAME 0 +#define SSL_F_FINAL_SIG_ALGS 0 +#define SSL_F_GET_CERT_VERIFY_TBS_DATA 0 +#define SSL_F_NSS_KEYLOG_INT 0 +#define SSL_F_OPENSSL_INIT_SSL 0 +#define SSL_F_OSSL_STATEM_CLIENT13_READ_TRANSITION 0 +#define SSL_F_OSSL_STATEM_CLIENT13_WRITE_TRANSITION 0 +#define SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE 0 +#define SSL_F_OSSL_STATEM_CLIENT_POST_PROCESS_MESSAGE 0 +#define SSL_F_OSSL_STATEM_CLIENT_PROCESS_MESSAGE 0 +#define SSL_F_OSSL_STATEM_CLIENT_READ_TRANSITION 0 +#define SSL_F_OSSL_STATEM_CLIENT_WRITE_TRANSITION 0 +#define SSL_F_OSSL_STATEM_SERVER13_READ_TRANSITION 0 +#define SSL_F_OSSL_STATEM_SERVER13_WRITE_TRANSITION 0 +#define SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE 0 +#define SSL_F_OSSL_STATEM_SERVER_POST_PROCESS_MESSAGE 0 +#define SSL_F_OSSL_STATEM_SERVER_POST_WORK 0 +#define SSL_F_OSSL_STATEM_SERVER_PRE_WORK 0 +#define SSL_F_OSSL_STATEM_SERVER_PROCESS_MESSAGE 0 +#define SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION 0 +#define SSL_F_OSSL_STATEM_SERVER_WRITE_TRANSITION 0 +#define SSL_F_PARSE_CA_NAMES 0 +#define SSL_F_PITEM_NEW 0 +#define SSL_F_PQUEUE_NEW 0 +#define SSL_F_PROCESS_KEY_SHARE_EXT 0 +#define SSL_F_READ_STATE_MACHINE 0 +#define SSL_F_SET_CLIENT_CIPHERSUITE 0 +#define SSL_F_SRP_GENERATE_CLIENT_MASTER_SECRET 0 +#define SSL_F_SRP_GENERATE_SERVER_MASTER_SECRET 0 +#define SSL_F_SRP_VERIFY_SERVER_PARAM 0 +#define SSL_F_SSL3_CHANGE_CIPHER_STATE 0 +#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 0 +#define SSL_F_SSL3_CTRL 0 +#define SSL_F_SSL3_CTX_CTRL 0 +#define SSL_F_SSL3_DIGEST_CACHED_RECORDS 0 +#define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 0 +#define SSL_F_SSL3_ENC 0 +#define SSL_F_SSL3_FINAL_FINISH_MAC 0 +#define SSL_F_SSL3_FINISH_MAC 0 +#define SSL_F_SSL3_GENERATE_KEY_BLOCK 0 +#define SSL_F_SSL3_GENERATE_MASTER_SECRET 0 +#define SSL_F_SSL3_GET_RECORD 0 +#define SSL_F_SSL3_INIT_FINISHED_MAC 0 +#define SSL_F_SSL3_OUTPUT_CERT_CHAIN 0 +#define SSL_F_SSL3_READ_BYTES 0 +#define SSL_F_SSL3_READ_N 0 +#define SSL_F_SSL3_SETUP_KEY_BLOCK 0 +#define SSL_F_SSL3_SETUP_READ_BUFFER 0 +#define SSL_F_SSL3_SETUP_WRITE_BUFFER 0 +#define SSL_F_SSL3_WRITE_BYTES 0 +#define SSL_F_SSL3_WRITE_PENDING 0 +#define SSL_F_SSL_ADD_CERT_CHAIN 0 +#define SSL_F_SSL_ADD_CERT_TO_BUF 0 +#define SSL_F_SSL_ADD_CERT_TO_WPACKET 0 +#define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 0 +#define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 0 +#define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 0 +#define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 0 +#define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 0 +#define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 0 +#define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 0 +#define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 0 +#define SSL_F_SSL_BUILD_CERT_CHAIN 0 +#define SSL_F_SSL_BYTES_TO_CIPHER_LIST 0 +#define SSL_F_SSL_CACHE_CIPHERLIST 0 +#define SSL_F_SSL_CERT_ADD0_CHAIN_CERT 0 +#define SSL_F_SSL_CERT_DUP 0 +#define SSL_F_SSL_CERT_NEW 0 +#define SSL_F_SSL_CERT_SET0_CHAIN 0 +#define SSL_F_SSL_CHECK_PRIVATE_KEY 0 +#define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 0 +#define SSL_F_SSL_CHECK_SRP_EXT_CLIENTHELLO 0 +#define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 0 +#define SSL_F_SSL_CHOOSE_CLIENT_VERSION 0 +#define SSL_F_SSL_CIPHER_DESCRIPTION 0 +#define SSL_F_SSL_CIPHER_LIST_TO_BYTES 0 +#define SSL_F_SSL_CIPHER_PROCESS_RULESTR 0 +#define SSL_F_SSL_CIPHER_STRENGTH_SORT 0 +#define SSL_F_SSL_CLEAR 0 +#define SSL_F_SSL_CLIENT_HELLO_GET1_EXTENSIONS_PRESENT 0 +#define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 0 +#define SSL_F_SSL_CONF_CMD 0 +#define SSL_F_SSL_CREATE_CIPHER_LIST 0 +#define SSL_F_SSL_CTRL 0 +#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 0 +#define SSL_F_SSL_CTX_ENABLE_CT 0 +#define SSL_F_SSL_CTX_MAKE_PROFILES 0 +#define SSL_F_SSL_CTX_NEW 0 +#define SSL_F_SSL_CTX_SET_ALPN_PROTOS 0 +#define SSL_F_SSL_CTX_SET_CIPHER_LIST 0 +#define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 0 +#define SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK 0 +#define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 0 +#define SSL_F_SSL_CTX_SET_SSL_VERSION 0 +#define SSL_F_SSL_CTX_SET_TLSEXT_MAX_FRAGMENT_LENGTH 0 +#define SSL_F_SSL_CTX_USE_CERTIFICATE 0 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 0 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 0 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY 0 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 0 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 0 +#define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 0 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 0 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 0 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 0 +#define SSL_F_SSL_CTX_USE_SERVERINFO 0 +#define SSL_F_SSL_CTX_USE_SERVERINFO_EX 0 +#define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 0 +#define SSL_F_SSL_DANE_DUP 0 +#define SSL_F_SSL_DANE_ENABLE 0 +#define SSL_F_SSL_DERIVE 0 +#define SSL_F_SSL_DO_CONFIG 0 +#define SSL_F_SSL_DO_HANDSHAKE 0 +#define SSL_F_SSL_DUP_CA_LIST 0 +#define SSL_F_SSL_ENABLE_CT 0 +#define SSL_F_SSL_GENERATE_PKEY_GROUP 0 +#define SSL_F_SSL_GENERATE_SESSION_ID 0 +#define SSL_F_SSL_GET_NEW_SESSION 0 +#define SSL_F_SSL_GET_PREV_SESSION 0 +#define SSL_F_SSL_GET_SERVER_CERT_INDEX 0 +#define SSL_F_SSL_GET_SIGN_PKEY 0 +#define SSL_F_SSL_HANDSHAKE_HASH 0 +#define SSL_F_SSL_INIT_WBIO_BUFFER 0 +#define SSL_F_SSL_KEY_UPDATE 0 +#define SSL_F_SSL_LOAD_CLIENT_CA_FILE 0 +#define SSL_F_SSL_LOG_MASTER_SECRET 0 +#define SSL_F_SSL_LOG_RSA_CLIENT_KEY_EXCHANGE 0 +#define SSL_F_SSL_MODULE_INIT 0 +#define SSL_F_SSL_NEW 0 +#define SSL_F_SSL_NEXT_PROTO_VALIDATE 0 +#define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 0 +#define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 0 +#define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 0 +#define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 0 +#define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 0 +#define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 0 +#define SSL_F_SSL_PEEK 0 +#define SSL_F_SSL_PEEK_EX 0 +#define SSL_F_SSL_PEEK_INTERNAL 0 +#define SSL_F_SSL_READ 0 +#define SSL_F_SSL_READ_EARLY_DATA 0 +#define SSL_F_SSL_READ_EX 0 +#define SSL_F_SSL_READ_INTERNAL 0 +#define SSL_F_SSL_RENEGOTIATE 0 +#define SSL_F_SSL_RENEGOTIATE_ABBREVIATED 0 +#define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 0 +#define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 0 +#define SSL_F_SSL_SESSION_DUP 0 +#define SSL_F_SSL_SESSION_NEW 0 +#define SSL_F_SSL_SESSION_PRINT_FP 0 +#define SSL_F_SSL_SESSION_SET1_ID 0 +#define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 0 +#define SSL_F_SSL_SET_ALPN_PROTOS 0 +#define SSL_F_SSL_SET_CERT 0 +#define SSL_F_SSL_SET_CERT_AND_KEY 0 +#define SSL_F_SSL_SET_CIPHER_LIST 0 +#define SSL_F_SSL_SET_CT_VALIDATION_CALLBACK 0 +#define SSL_F_SSL_SET_FD 0 +#define SSL_F_SSL_SET_PKEY 0 +#define SSL_F_SSL_SET_RFD 0 +#define SSL_F_SSL_SET_SESSION 0 +#define SSL_F_SSL_SET_SESSION_ID_CONTEXT 0 +#define SSL_F_SSL_SET_SESSION_TICKET_EXT 0 +#define SSL_F_SSL_SET_TLSEXT_MAX_FRAGMENT_LENGTH 0 +#define SSL_F_SSL_SET_WFD 0 +#define SSL_F_SSL_SHUTDOWN 0 +#define SSL_F_SSL_SRP_CTX_INIT 0 +#define SSL_F_SSL_START_ASYNC_JOB 0 +#define SSL_F_SSL_UNDEFINED_FUNCTION 0 +#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 0 +#define SSL_F_SSL_USE_CERTIFICATE 0 +#define SSL_F_SSL_USE_CERTIFICATE_ASN1 0 +#define SSL_F_SSL_USE_CERTIFICATE_FILE 0 +#define SSL_F_SSL_USE_PRIVATEKEY 0 +#define SSL_F_SSL_USE_PRIVATEKEY_ASN1 0 +#define SSL_F_SSL_USE_PRIVATEKEY_FILE 0 +#define SSL_F_SSL_USE_PSK_IDENTITY_HINT 0 +#define SSL_F_SSL_USE_RSAPRIVATEKEY 0 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 0 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 0 +#define SSL_F_SSL_VALIDATE_CT 0 +#define SSL_F_SSL_VERIFY_CERT_CHAIN 0 +#define SSL_F_SSL_VERIFY_CLIENT_POST_HANDSHAKE 0 +#define SSL_F_SSL_WRITE 0 +#define SSL_F_SSL_WRITE_EARLY_DATA 0 +#define SSL_F_SSL_WRITE_EARLY_FINISH 0 +#define SSL_F_SSL_WRITE_EX 0 +#define SSL_F_SSL_WRITE_INTERNAL 0 +#define SSL_F_STATE_MACHINE 0 +#define SSL_F_TLS12_CHECK_PEER_SIGALG 0 +#define SSL_F_TLS12_COPY_SIGALGS 0 +#define SSL_F_TLS13_CHANGE_CIPHER_STATE 0 +#define SSL_F_TLS13_ENC 0 +#define SSL_F_TLS13_FINAL_FINISH_MAC 0 +#define SSL_F_TLS13_GENERATE_SECRET 0 +#define SSL_F_TLS13_HKDF_EXPAND 0 +#define SSL_F_TLS13_RESTORE_HANDSHAKE_DIGEST_FOR_PHA 0 +#define SSL_F_TLS13_SAVE_HANDSHAKE_DIGEST_FOR_PHA 0 +#define SSL_F_TLS13_SETUP_KEY_BLOCK 0 +#define SSL_F_TLS1_CHANGE_CIPHER_STATE 0 +#define SSL_F_TLS1_CHECK_DUPLICATE_EXTENSIONS 0 +#define SSL_F_TLS1_ENC 0 +#define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 0 +#define SSL_F_TLS1_GET_CURVELIST 0 +#define SSL_F_TLS1_PRF 0 +#define SSL_F_TLS1_SAVE_U16 0 +#define SSL_F_TLS1_SETUP_KEY_BLOCK 0 +#define SSL_F_TLS1_SET_GROUPS 0 +#define SSL_F_TLS1_SET_RAW_SIGALGS 0 +#define SSL_F_TLS1_SET_SERVER_SIGALGS 0 +#define SSL_F_TLS1_SET_SHARED_SIGALGS 0 +#define SSL_F_TLS1_SET_SIGALGS 0 +#define SSL_F_TLS_CHOOSE_SIGALG 0 +#define SSL_F_TLS_CLIENT_KEY_EXCHANGE_POST_WORK 0 +#define SSL_F_TLS_COLLECT_EXTENSIONS 0 +#define SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES 0 +#define SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST 0 +#define SSL_F_TLS_CONSTRUCT_CERT_STATUS 0 +#define SSL_F_TLS_CONSTRUCT_CERT_STATUS_BODY 0 +#define SSL_F_TLS_CONSTRUCT_CERT_VERIFY 0 +#define SSL_F_TLS_CONSTRUCT_CHANGE_CIPHER_SPEC 0 +#define SSL_F_TLS_CONSTRUCT_CKE_DHE 0 +#define SSL_F_TLS_CONSTRUCT_CKE_ECDHE 0 +#define SSL_F_TLS_CONSTRUCT_CKE_GOST 0 +#define SSL_F_TLS_CONSTRUCT_CKE_PSK_PREAMBLE 0 +#define SSL_F_TLS_CONSTRUCT_CKE_RSA 0 +#define SSL_F_TLS_CONSTRUCT_CKE_SRP 0 +#define SSL_F_TLS_CONSTRUCT_CLIENT_CERTIFICATE 0 +#define SSL_F_TLS_CONSTRUCT_CLIENT_HELLO 0 +#define SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE 0 +#define SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_ALPN 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_CERTIFICATE 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_COOKIE 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_EMS 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_ETM 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_HELLO 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_KEY_EXCHANGE 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_NPN 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_PADDING 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_POST_HANDSHAKE_AUTH 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_PSK 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_PSK_KEX_MODES 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_RENEGOTIATE 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_SCT 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_SERVER_NAME 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_SIG_ALGS 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_SRP 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP 0 +#define SSL_F_TLS_CONSTRUCT_CTOS_VERIFY 0 +#define SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS 0 +#define SSL_F_TLS_CONSTRUCT_END_OF_EARLY_DATA 0 +#define SSL_F_TLS_CONSTRUCT_EXTENSIONS 0 +#define SSL_F_TLS_CONSTRUCT_FINISHED 0 +#define SSL_F_TLS_CONSTRUCT_HELLO_REQUEST 0 +#define SSL_F_TLS_CONSTRUCT_HELLO_RETRY_REQUEST 0 +#define SSL_F_TLS_CONSTRUCT_KEY_UPDATE 0 +#define SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET 0 +#define SSL_F_TLS_CONSTRUCT_NEXT_PROTO 0 +#define SSL_F_TLS_CONSTRUCT_SERVER_CERTIFICATE 0 +#define SSL_F_TLS_CONSTRUCT_SERVER_HELLO 0 +#define SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE 0 +#define SSL_F_TLS_CONSTRUCT_STOC_ALPN 0 +#define SSL_F_TLS_CONSTRUCT_STOC_CERTIFICATE 0 +#define SSL_F_TLS_CONSTRUCT_STOC_COOKIE 0 +#define SSL_F_TLS_CONSTRUCT_STOC_CRYPTOPRO_BUG 0 +#define SSL_F_TLS_CONSTRUCT_STOC_DONE 0 +#define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA 0 +#define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA_INFO 0 +#define SSL_F_TLS_CONSTRUCT_STOC_EC_PT_FORMATS 0 +#define SSL_F_TLS_CONSTRUCT_STOC_EMS 0 +#define SSL_F_TLS_CONSTRUCT_STOC_ETM 0 +#define SSL_F_TLS_CONSTRUCT_STOC_HELLO 0 +#define SSL_F_TLS_CONSTRUCT_STOC_KEY_EXCHANGE 0 +#define SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE 0 +#define SSL_F_TLS_CONSTRUCT_STOC_MAXFRAGMENTLEN 0 +#define SSL_F_TLS_CONSTRUCT_STOC_NEXT_PROTO_NEG 0 +#define SSL_F_TLS_CONSTRUCT_STOC_PSK 0 +#define SSL_F_TLS_CONSTRUCT_STOC_RENEGOTIATE 0 +#define SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME 0 +#define SSL_F_TLS_CONSTRUCT_STOC_SESSION_TICKET 0 +#define SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST 0 +#define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_GROUPS 0 +#define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_VERSIONS 0 +#define SSL_F_TLS_CONSTRUCT_STOC_USE_SRTP 0 +#define SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO 0 +#define SSL_F_TLS_FINISH_HANDSHAKE 0 +#define SSL_F_TLS_GET_MESSAGE_BODY 0 +#define SSL_F_TLS_GET_MESSAGE_HEADER 0 +#define SSL_F_TLS_HANDLE_ALPN 0 +#define SSL_F_TLS_HANDLE_STATUS_REQUEST 0 +#define SSL_F_TLS_PARSE_CERTIFICATE_AUTHORITIES 0 +#define SSL_F_TLS_PARSE_CLIENTHELLO_TLSEXT 0 +#define SSL_F_TLS_PARSE_CTOS_ALPN 0 +#define SSL_F_TLS_PARSE_CTOS_COOKIE 0 +#define SSL_F_TLS_PARSE_CTOS_EARLY_DATA 0 +#define SSL_F_TLS_PARSE_CTOS_EC_PT_FORMATS 0 +#define SSL_F_TLS_PARSE_CTOS_EMS 0 +#define SSL_F_TLS_PARSE_CTOS_KEY_SHARE 0 +#define SSL_F_TLS_PARSE_CTOS_MAXFRAGMENTLEN 0 +#define SSL_F_TLS_PARSE_CTOS_POST_HANDSHAKE_AUTH 0 +#define SSL_F_TLS_PARSE_CTOS_PSK 0 +#define SSL_F_TLS_PARSE_CTOS_PSK_KEX_MODES 0 +#define SSL_F_TLS_PARSE_CTOS_RENEGOTIATE 0 +#define SSL_F_TLS_PARSE_CTOS_SERVER_NAME 0 +#define SSL_F_TLS_PARSE_CTOS_SESSION_TICKET 0 +#define SSL_F_TLS_PARSE_CTOS_SIG_ALGS 0 +#define SSL_F_TLS_PARSE_CTOS_SIG_ALGS_CERT 0 +#define SSL_F_TLS_PARSE_CTOS_SRP 0 +#define SSL_F_TLS_PARSE_CTOS_STATUS_REQUEST 0 +#define SSL_F_TLS_PARSE_CTOS_SUPPORTED_GROUPS 0 +#define SSL_F_TLS_PARSE_CTOS_USE_SRTP 0 +#define SSL_F_TLS_PARSE_STOC_ALPN 0 +#define SSL_F_TLS_PARSE_STOC_COOKIE 0 +#define SSL_F_TLS_PARSE_STOC_EARLY_DATA 0 +#define SSL_F_TLS_PARSE_STOC_EARLY_DATA_INFO 0 +#define SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS 0 +#define SSL_F_TLS_PARSE_STOC_KEY_SHARE 0 +#define SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN 0 +#define SSL_F_TLS_PARSE_STOC_NPN 0 +#define SSL_F_TLS_PARSE_STOC_PSK 0 +#define SSL_F_TLS_PARSE_STOC_RENEGOTIATE 0 +#define SSL_F_TLS_PARSE_STOC_SCT 0 +#define SSL_F_TLS_PARSE_STOC_SERVER_NAME 0 +#define SSL_F_TLS_PARSE_STOC_SESSION_TICKET 0 +#define SSL_F_TLS_PARSE_STOC_STATUS_REQUEST 0 +#define SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS 0 +#define SSL_F_TLS_PARSE_STOC_USE_SRTP 0 +#define SSL_F_TLS_POST_PROCESS_CLIENT_HELLO 0 +#define SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE 0 +#define SSL_F_TLS_PREPARE_CLIENT_CERTIFICATE 0 +#define SSL_F_TLS_PROCESS_AS_HELLO_RETRY_REQUEST 0 +#define SSL_F_TLS_PROCESS_CERTIFICATE_REQUEST 0 +#define SSL_F_TLS_PROCESS_CERT_STATUS 0 +#define SSL_F_TLS_PROCESS_CERT_STATUS_BODY 0 +#define SSL_F_TLS_PROCESS_CERT_VERIFY 0 +#define SSL_F_TLS_PROCESS_CHANGE_CIPHER_SPEC 0 +#define SSL_F_TLS_PROCESS_CKE_DHE 0 +#define SSL_F_TLS_PROCESS_CKE_ECDHE 0 +#define SSL_F_TLS_PROCESS_CKE_GOST 0 +#define SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE 0 +#define SSL_F_TLS_PROCESS_CKE_RSA 0 +#define SSL_F_TLS_PROCESS_CKE_SRP 0 +#define SSL_F_TLS_PROCESS_CLIENT_CERTIFICATE 0 +#define SSL_F_TLS_PROCESS_CLIENT_HELLO 0 +#define SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE 0 +#define SSL_F_TLS_PROCESS_ENCRYPTED_EXTENSIONS 0 +#define SSL_F_TLS_PROCESS_END_OF_EARLY_DATA 0 +#define SSL_F_TLS_PROCESS_FINISHED 0 +#define SSL_F_TLS_PROCESS_HELLO_REQ 0 +#define SSL_F_TLS_PROCESS_HELLO_RETRY_REQUEST 0 +#define SSL_F_TLS_PROCESS_INITIAL_SERVER_FLIGHT 0 +#define SSL_F_TLS_PROCESS_KEY_EXCHANGE 0 +#define SSL_F_TLS_PROCESS_KEY_UPDATE 0 +#define SSL_F_TLS_PROCESS_NEW_SESSION_TICKET 0 +#define SSL_F_TLS_PROCESS_NEXT_PROTO 0 +#define SSL_F_TLS_PROCESS_SERVER_CERTIFICATE 0 +#define SSL_F_TLS_PROCESS_SERVER_DONE 0 +#define SSL_F_TLS_PROCESS_SERVER_HELLO 0 +#define SSL_F_TLS_PROCESS_SKE_DHE 0 +#define SSL_F_TLS_PROCESS_SKE_ECDHE 0 +#define SSL_F_TLS_PROCESS_SKE_PSK_PREAMBLE 0 +#define SSL_F_TLS_PROCESS_SKE_SRP 0 +#define SSL_F_TLS_PSK_DO_BINDER 0 +#define SSL_F_TLS_SCAN_CLIENTHELLO_TLSEXT 0 +#define SSL_F_TLS_SETUP_HANDSHAKE 0 +#define SSL_F_USE_CERTIFICATE_CHAIN_FILE 0 +#define SSL_F_WPACKET_INTERN_INIT_LEN 0 +#define SSL_F_WPACKET_START_SUB_PACKET_LEN__ 0 +#define SSL_F_WRITE_STATE_MACHINE 0 +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/stack.h b/VCMP-LUA/modules/postgresql/include/openssl/stack.h new file mode 100644 index 0000000..542de76 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/stack.h @@ -0,0 +1,92 @@ +/* + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_STACK_H +#define OPENSSL_STACK_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_STACK_H +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */ + +typedef int (*OPENSSL_sk_compfunc)(const void *, const void *); +typedef void (*OPENSSL_sk_freefunc)(void *); +typedef void (*OPENSSL_sk_freefunc_thunk)(OPENSSL_sk_freefunc, void *); +typedef void *(*OPENSSL_sk_copyfunc)(const void *); + +int OPENSSL_sk_num(const OPENSSL_STACK *); +void *OPENSSL_sk_value(const OPENSSL_STACK *, int); + +void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data); + +OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp); +OPENSSL_STACK *OPENSSL_sk_new_null(void); +OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n); +OPENSSL_STACK *OPENSSL_sk_set_thunks(OPENSSL_STACK *st, OPENSSL_sk_freefunc_thunk f_thunk); +int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n); +void OPENSSL_sk_free(OPENSSL_STACK *); +void OPENSSL_sk_pop_free(OPENSSL_STACK *st, OPENSSL_sk_freefunc func); +OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, + OPENSSL_sk_copyfunc c, + OPENSSL_sk_freefunc f); +int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where); +void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc); +void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p); +int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_find_all(OPENSSL_STACK *st, const void *data, int *pnum); +int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data); +void *OPENSSL_sk_shift(OPENSSL_STACK *st); +void *OPENSSL_sk_pop(OPENSSL_STACK *st); +void OPENSSL_sk_zero(OPENSSL_STACK *st); +OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, + OPENSSL_sk_compfunc cmp); +OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st); +void OPENSSL_sk_sort(OPENSSL_STACK *st); +int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define _STACK OPENSSL_STACK +#define sk_num OPENSSL_sk_num +#define sk_value OPENSSL_sk_value +#define sk_set OPENSSL_sk_set +#define sk_new OPENSSL_sk_new +#define sk_new_null OPENSSL_sk_new_null +#define sk_free OPENSSL_sk_free +#define sk_pop_free OPENSSL_sk_pop_free +#define sk_deep_copy OPENSSL_sk_deep_copy +#define sk_insert OPENSSL_sk_insert +#define sk_delete OPENSSL_sk_delete +#define sk_delete_ptr OPENSSL_sk_delete_ptr +#define sk_find OPENSSL_sk_find +#define sk_find_ex OPENSSL_sk_find_ex +#define sk_push OPENSSL_sk_push +#define sk_unshift OPENSSL_sk_unshift +#define sk_shift OPENSSL_sk_shift +#define sk_pop OPENSSL_sk_pop +#define sk_zero OPENSSL_sk_zero +#define sk_set_cmp_func OPENSSL_sk_set_cmp_func +#define sk_dup OPENSSL_sk_dup +#define sk_sort OPENSSL_sk_sort +#define sk_is_sorted OPENSSL_sk_is_sorted +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/store.h b/VCMP-LUA/modules/postgresql/include/openssl/store.h new file mode 100644 index 0000000..2f14704 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/store.h @@ -0,0 +1,372 @@ +/* + * Copyright 2016-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_STORE_H +#define OPENSSL_STORE_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_OSSL_STORE_H +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * The main OSSL_STORE functions. + * ------------------------------ + * + * These allow applications to open a channel to a resource with supported + * data (keys, certs, crls, ...), read the data a piece at a time and decide + * what to do with it, and finally close. + */ + +typedef struct ossl_store_ctx_st OSSL_STORE_CTX; + +/* + * Typedef for the OSSL_STORE_INFO post processing callback. This can be used + * to massage the given OSSL_STORE_INFO, or to drop it entirely (by returning + * NULL). + */ +typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *, + void *); + +/* + * Open a channel given a URI. The given UI method will be used any time the + * loader needs extra input, for example when a password or pin is needed, and + * will be passed the same user data every time it's needed in this context. + * + * Returns a context reference which represents the channel to communicate + * through. + */ +OSSL_STORE_CTX * +OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method, void *ui_data, + OSSL_STORE_post_process_info_fn post_process, + void *post_process_data); +OSSL_STORE_CTX * +OSSL_STORE_open_ex(const char *uri, OSSL_LIB_CTX *libctx, const char *propq, + const UI_METHOD *ui_method, void *ui_data, + const OSSL_PARAM params[], + OSSL_STORE_post_process_info_fn post_process, + void *post_process_data); + +/* + * Control / fine tune the OSSL_STORE channel. |cmd| determines what is to be + * done, and depends on the underlying loader (use OSSL_STORE_get0_scheme to + * determine which loader is used), except for common commands (see below). + * Each command takes different arguments. + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, + ... /* args */); +OSSL_DEPRECATEDIN_3_0 int OSSL_STORE_vctrl(OSSL_STORE_CTX *ctx, int cmd, + va_list args); +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + +/* + * Common ctrl commands that different loaders may choose to support. + */ +/* int on = 0 or 1; STORE_ctrl(ctx, STORE_C_USE_SECMEM, &on); */ +#define OSSL_STORE_C_USE_SECMEM 1 +/* Where custom commands start */ +#define OSSL_STORE_C_CUSTOM_START 100 + +#endif + +/* + * Read one data item (a key, a cert, a CRL) that is supported by the OSSL_STORE + * functionality, given a context. + * Returns a OSSL_STORE_INFO pointer, from which OpenSSL typed data can be + * extracted with OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), ... + * NULL is returned on error, which may include that the data found at the URI + * can't be figured out for certain or is ambiguous. + */ +OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx); + +/* + * Deletes the object in the store by URI. + * Returns 1 on success, 0 otherwise. + */ +int OSSL_STORE_delete(const char *uri, OSSL_LIB_CTX *libctx, const char *propq, + const UI_METHOD *ui_method, void *ui_data, + const OSSL_PARAM params[]); + +/* + * Check if end of data (end of file) is reached + * Returns 1 on end, 0 otherwise. + */ +int OSSL_STORE_eof(OSSL_STORE_CTX *ctx); + +/* + * Check if an error occurred + * Returns 1 if it did, 0 otherwise. + */ +int OSSL_STORE_error(OSSL_STORE_CTX *ctx); + +/* + * Close the channel + * Returns 1 on success, 0 on error. + */ +int OSSL_STORE_close(OSSL_STORE_CTX *ctx); + +/* + * Attach to a BIO. This works like OSSL_STORE_open() except it takes a + * BIO instead of a uri, along with a scheme to use when reading. + * The given UI method will be used any time the loader needs extra input, + * for example when a password or pin is needed, and will be passed the + * same user data every time it's needed in this context. + * + * Returns a context reference which represents the channel to communicate + * through. + * + * Note that this function is considered unsafe, all depending on what the + * BIO actually reads. + */ +OSSL_STORE_CTX *OSSL_STORE_attach(BIO *bio, const char *scheme, + OSSL_LIB_CTX *libctx, const char *propq, + const UI_METHOD *ui_method, void *ui_data, + const OSSL_PARAM params[], + OSSL_STORE_post_process_info_fn post_process, + void *post_process_data); + +/*- + * Extracting OpenSSL types from and creating new OSSL_STORE_INFOs + * --------------------------------------------------------------- + */ + +/* + * Types of data that can be ossl_stored in a OSSL_STORE_INFO. + * OSSL_STORE_INFO_NAME is typically found when getting a listing of + * available "files" / "tokens" / what have you. + */ +#define OSSL_STORE_INFO_NAME 1 /* char * */ +#define OSSL_STORE_INFO_PARAMS 2 /* EVP_PKEY * */ +#define OSSL_STORE_INFO_PUBKEY 3 /* EVP_PKEY * */ +#define OSSL_STORE_INFO_PKEY 4 /* EVP_PKEY * */ +#define OSSL_STORE_INFO_CERT 5 /* X509 * */ +#define OSSL_STORE_INFO_CRL 6 /* X509_CRL * */ + +/* + * Functions to generate OSSL_STORE_INFOs, one function for each type we + * support having in them, as well as a generic constructor. + * + * In all cases, ownership of the object is transferred to the OSSL_STORE_INFO + * and will therefore be freed when the OSSL_STORE_INFO is freed. + */ +OSSL_STORE_INFO *OSSL_STORE_INFO_new(int type, void *data); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name); +int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(EVP_PKEY *params); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_PUBKEY(EVP_PKEY *pubkey); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl); + +/* + * Functions to try to extract data from a OSSL_STORE_INFO. + */ +int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *info); +void *OSSL_STORE_INFO_get0_data(int type, const OSSL_STORE_INFO *info); +const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *info); +char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *info); +const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO *info); +char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get0_PUBKEY(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get1_PUBKEY(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *info); +X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *info); +X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *info); +X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *info); +X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *info); + +const char *OSSL_STORE_INFO_type_string(int type); + +/* + * Free the OSSL_STORE_INFO + */ +void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info); + +/*- + * Functions to construct a search URI from a base URI and search criteria + * ----------------------------------------------------------------------- + */ + +/* OSSL_STORE search types */ +#define OSSL_STORE_SEARCH_BY_NAME 1 /* subject in certs, issuer in CRLs */ +#define OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 2 +#define OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 3 +#define OSSL_STORE_SEARCH_BY_ALIAS 4 + +/* To check what search types the scheme handler supports */ +int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type); + +/* Search term constructors */ +/* + * The input is considered to be owned by the caller, and must therefore + * remain present throughout the lifetime of the returned OSSL_STORE_SEARCH + */ +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name, + const ASN1_INTEGER + *serial); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest, + const unsigned char + *bytes, + size_t len); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias); + +/* Search term destructor */ +void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search); + +/* Search term accessors */ +int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion); +X509_NAME *OSSL_STORE_SEARCH_get0_name(const OSSL_STORE_SEARCH *criterion); +const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH + *criterion); +const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH + *criterion, + size_t *length); +const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion); +const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH *criterion); + +/* + * Add search criterion and expected return type (which can be unspecified) + * to the loading channel. This MUST happen before the first OSSL_STORE_load(). + */ +int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type); +int OSSL_STORE_find(OSSL_STORE_CTX *ctx, const OSSL_STORE_SEARCH *search); + +/*- + * Function to fetch a loader and extract data from it + * --------------------------------------------------- + */ + +typedef struct ossl_store_loader_st OSSL_STORE_LOADER; + +OSSL_STORE_LOADER *OSSL_STORE_LOADER_fetch(OSSL_LIB_CTX *libctx, + const char *scheme, + const char *properties); +int OSSL_STORE_LOADER_up_ref(OSSL_STORE_LOADER *loader); +void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader); +const OSSL_PROVIDER *OSSL_STORE_LOADER_get0_provider(const OSSL_STORE_LOADER * + loader); +const char *OSSL_STORE_LOADER_get0_properties(const OSSL_STORE_LOADER *loader); +const char *OSSL_STORE_LOADER_get0_description(const OSSL_STORE_LOADER *loader); +int OSSL_STORE_LOADER_is_a(const OSSL_STORE_LOADER *loader, + const char *scheme); +void OSSL_STORE_LOADER_do_all_provided(OSSL_LIB_CTX *libctx, + void (*fn)(OSSL_STORE_LOADER *loader, + void *arg), + void *arg); +int OSSL_STORE_LOADER_names_do_all(const OSSL_STORE_LOADER *loader, + void (*fn)(const char *name, void *data), + void *data); +const OSSL_PARAM * +OSSL_STORE_LOADER_settable_ctx_params(const OSSL_STORE_LOADER *loader); + +/*- + * Function to register a loader for the given URI scheme. + * ------------------------------------------------------- + * + * The loader receives all the main components of an URI except for the + * scheme. + */ + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + +/* struct ossl_store_loader_ctx_st is defined differently by each loader */ +typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX; +typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(const OSSL_STORE_LOADER *loader, const char *uri, + const UI_METHOD *ui_method, void *ui_data); +typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_ex_fn)(const OSSL_STORE_LOADER *loader, + const char *uri, OSSL_LIB_CTX *libctx, const char *propq, + const UI_METHOD *ui_method, void *ui_data); + +typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_attach_fn)(const OSSL_STORE_LOADER *loader, BIO *bio, + OSSL_LIB_CTX *libctx, const char *propq, + const UI_METHOD *ui_method, void *ui_data); +typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd, va_list args); +typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected); +typedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx, const OSSL_STORE_SEARCH *criteria); +typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx, const UI_METHOD *ui_method, void *ui_data); +typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx); +typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx); +typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx); + +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader, + OSSL_STORE_open_fn open_function); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_open_ex(OSSL_STORE_LOADER *loader, + OSSL_STORE_open_ex_fn open_ex_function); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_attach(OSSL_STORE_LOADER *loader, + OSSL_STORE_attach_fn attach_function); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader, + OSSL_STORE_ctrl_fn ctrl_function); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader, + OSSL_STORE_expect_fn expect_function); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader, + OSSL_STORE_find_fn find_function); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *loader, + OSSL_STORE_load_fn load_function); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *loader, + OSSL_STORE_eof_fn eof_function); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader, + OSSL_STORE_error_fn error_function); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader, + OSSL_STORE_close_fn close_function); +OSSL_DEPRECATEDIN_3_0 +const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader); +OSSL_DEPRECATEDIN_3_0 +const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader); +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader); +OSSL_DEPRECATEDIN_3_0 +OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme); +#endif + +/*- + * Functions to list STORE loaders + * ------------------------------- + */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int OSSL_STORE_do_all_loaders(void (*do_function)(const OSSL_STORE_LOADER *loader, + void *do_arg), + void *do_arg); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/storeerr.h b/VCMP-LUA/modules/postgresql/include/openssl/storeerr.h new file mode 100644 index 0000000..a61bee1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/storeerr.h @@ -0,0 +1,47 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_STOREERR_H +#define OPENSSL_STOREERR_H +#pragma once + +#include +#include +#include + +/* + * OSSL_STORE reason codes. + */ +#define OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE 107 +#define OSSL_STORE_R_BAD_PASSWORD_READ 115 +#define OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC 113 +#define OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST 121 +#define OSSL_STORE_R_INVALID_SCHEME 106 +#define OSSL_STORE_R_IS_NOT_A 112 +#define OSSL_STORE_R_LOADER_INCOMPLETE 116 +#define OSSL_STORE_R_LOADING_STARTED 117 +#define OSSL_STORE_R_NOT_A_CERTIFICATE 100 +#define OSSL_STORE_R_NOT_A_CRL 101 +#define OSSL_STORE_R_NOT_A_NAME 103 +#define OSSL_STORE_R_NOT_A_PRIVATE_KEY 102 +#define OSSL_STORE_R_NOT_A_PUBLIC_KEY 122 +#define OSSL_STORE_R_NOT_PARAMETERS 104 +#define OSSL_STORE_R_NO_LOADERS_FOUND 123 +#define OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR 114 +#define OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE 108 +#define OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 119 +#define OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED 109 +#define OSSL_STORE_R_UNREGISTERED_SCHEME 105 +#define OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE 110 +#define OSSL_STORE_R_UNSUPPORTED_OPERATION 118 +#define OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE 120 +#define OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED 111 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/symhacks.h b/VCMP-LUA/modules/postgresql/include/openssl/symhacks.h new file mode 100644 index 0000000..d041395 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/symhacks.h @@ -0,0 +1,39 @@ +/* + * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_SYMHACKS_H +#define OPENSSL_SYMHACKS_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_SYMHACKS_H +#endif + +#include + +/* Case insensitive linking causes problems.... */ +#if defined(OPENSSL_SYS_VMS) +#undef ERR_load_CRYPTO_strings +#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings +#undef OCSP_crlID_new +#define OCSP_crlID_new OCSP_crlID2_new + +#undef d2i_ECPARAMETERS +#define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS +#undef i2d_ECPARAMETERS +#define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS +#undef d2i_ECPKPARAMETERS +#define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS +#undef i2d_ECPKPARAMETERS +#define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS + +#endif + +#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/thread.h b/VCMP-LUA/modules/postgresql/include/openssl/thread.h new file mode 100644 index 0000000..6d86e0e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/thread.h @@ -0,0 +1,31 @@ +/* + * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_THREAD_H +#define OPENSSL_THREAD_H + +#define OSSL_THREAD_SUPPORT_FLAG_THREAD_POOL (1U << 0) +#define OSSL_THREAD_SUPPORT_FLAG_DEFAULT_SPAWN (1U << 1) + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t OSSL_get_thread_support_flags(void); +int OSSL_set_max_threads(OSSL_LIB_CTX *ctx, uint64_t max_threads); +uint64_t OSSL_get_max_threads(OSSL_LIB_CTX *ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* OPENSSL_THREAD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/tls1.h b/VCMP-LUA/modules/postgresql/include/openssl/tls1.h new file mode 100644 index 0000000..34d3768 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/tls1.h @@ -0,0 +1,1222 @@ +/* + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * Copyright 2005 Nokia. All rights reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_TLS1_H +#define OPENSSL_TLS1_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_TLS1_H +#endif + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Default security level if not overridden at config time */ +#ifndef OPENSSL_TLS_SECURITY_LEVEL +#define OPENSSL_TLS_SECURITY_LEVEL 2 +#endif + +/* TLS*_VERSION constants are defined in prov_ssl.h */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define TLS_MAX_VERSION TLS1_3_VERSION +#endif + +/* Special value for method supporting multiple versions */ +#define TLS_ANY_VERSION 0x10000 + +#define TLS1_VERSION_MAJOR 0x03 +#define TLS1_VERSION_MINOR 0x01 + +#define TLS1_1_VERSION_MAJOR 0x03 +#define TLS1_1_VERSION_MINOR 0x02 + +#define TLS1_2_VERSION_MAJOR 0x03 +#define TLS1_2_VERSION_MINOR 0x03 + +#define TLS1_get_version(s) \ + ((SSL_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_version(s) : 0) + +#define TLS1_get_client_version(s) \ + ((SSL_client_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_client_version(s) : 0) + +#define TLS1_AD_DECRYPTION_FAILED 21 +#define TLS1_AD_RECORD_OVERFLOW 22 +#define TLS1_AD_UNKNOWN_CA 48 /* fatal */ +#define TLS1_AD_ACCESS_DENIED 49 /* fatal */ +#define TLS1_AD_DECODE_ERROR 50 /* fatal */ +#define TLS1_AD_DECRYPT_ERROR 51 +#define TLS1_AD_EXPORT_RESTRICTION 60 /* fatal */ +#define TLS1_AD_PROTOCOL_VERSION 70 /* fatal */ +#define TLS1_AD_INSUFFICIENT_SECURITY 71 /* fatal */ +#define TLS1_AD_INTERNAL_ERROR 80 /* fatal */ +#define TLS1_AD_INAPPROPRIATE_FALLBACK 86 /* fatal */ +#define TLS1_AD_USER_CANCELLED 90 +#define TLS1_AD_NO_RENEGOTIATION 100 +/* TLSv1.3 alerts */ +#define TLS13_AD_MISSING_EXTENSION 109 /* fatal */ +#define TLS13_AD_CERTIFICATE_REQUIRED 116 /* fatal */ +/* codes 110-114 are from RFC3546 */ +#define TLS1_AD_UNSUPPORTED_EXTENSION 110 +#define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 +#define TLS1_AD_UNRECOGNIZED_NAME 112 +#define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 +#define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 +#define TLS1_AD_UNKNOWN_PSK_IDENTITY 115 /* fatal */ +#define TLS1_AD_NO_APPLICATION_PROTOCOL 120 /* fatal */ + +/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ +#define TLSEXT_TYPE_server_name 0 +#define TLSEXT_TYPE_max_fragment_length 1 +#define TLSEXT_TYPE_client_certificate_url 2 +#define TLSEXT_TYPE_trusted_ca_keys 3 +#define TLSEXT_TYPE_truncated_hmac 4 +#define TLSEXT_TYPE_status_request 5 +/* ExtensionType values from RFC4681 */ +#define TLSEXT_TYPE_user_mapping 6 +/* ExtensionType values from RFC5878 */ +#define TLSEXT_TYPE_client_authz 7 +#define TLSEXT_TYPE_server_authz 8 +/* ExtensionType values from RFC6091 */ +#define TLSEXT_TYPE_cert_type 9 + +/* ExtensionType values from RFC4492 */ +/* + * Prior to TLSv1.3 the supported_groups extension was known as + * elliptic_curves + */ +#define TLSEXT_TYPE_supported_groups 10 +#define TLSEXT_TYPE_elliptic_curves TLSEXT_TYPE_supported_groups +#define TLSEXT_TYPE_ec_point_formats 11 + +/* ExtensionType value from RFC5054 */ +#define TLSEXT_TYPE_srp 12 + +/* ExtensionType values from RFC5246 */ +#define TLSEXT_TYPE_signature_algorithms 13 + +/* ExtensionType value from RFC5764 */ +#define TLSEXT_TYPE_use_srtp 14 + +/* ExtensionType value from RFC7301 */ +#define TLSEXT_TYPE_application_layer_protocol_negotiation 16 + +/* + * Extension type for Certificate Transparency + * https://tools.ietf.org/html/rfc6962#section-3.3.1 + */ +#define TLSEXT_TYPE_signed_certificate_timestamp 18 + +/* + * Extension type for Raw Public Keys + * https://tools.ietf.org/html/rfc7250 + * https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml + */ +#define TLSEXT_TYPE_client_cert_type 19 +#define TLSEXT_TYPE_server_cert_type 20 + +/* + * ExtensionType value for TLS padding extension. + * http://tools.ietf.org/html/draft-agl-tls-padding + */ +#define TLSEXT_TYPE_padding 21 + +/* ExtensionType value from RFC7366 */ +#define TLSEXT_TYPE_encrypt_then_mac 22 + +/* ExtensionType value from RFC7627 */ +#define TLSEXT_TYPE_extended_master_secret 23 + +/* ExtensionType value from RFC8879 */ +#define TLSEXT_TYPE_compress_certificate 27 + +/* ExtensionType value from RFC4507 */ +#define TLSEXT_TYPE_session_ticket 35 + +/* As defined for TLS1.3 */ +#define TLSEXT_TYPE_psk 41 +#define TLSEXT_TYPE_early_data 42 +#define TLSEXT_TYPE_supported_versions 43 +#define TLSEXT_TYPE_cookie 44 +#define TLSEXT_TYPE_psk_kex_modes 45 +#define TLSEXT_TYPE_certificate_authorities 47 +#define TLSEXT_TYPE_post_handshake_auth 49 +#define TLSEXT_TYPE_signature_algorithms_cert 50 +#define TLSEXT_TYPE_key_share 51 +#define TLSEXT_TYPE_quic_transport_parameters 57 + +/* Temporary extension type */ +#define TLSEXT_TYPE_renegotiate 0xff01 + +#ifndef OPENSSL_NO_NEXTPROTONEG +/* This is not an IANA defined extension number */ +#define TLSEXT_TYPE_next_proto_neg 13172 +#endif + +/* NameType value from RFC3546 */ +#define TLSEXT_NAMETYPE_host_name 0 +/* status request value from RFC3546 */ +#define TLSEXT_STATUSTYPE_ocsp 1 + +/* ECPointFormat values from RFC4492 */ +#define TLSEXT_ECPOINTFORMAT_first 0 +#define TLSEXT_ECPOINTFORMAT_uncompressed 0 +#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 +#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 +#define TLSEXT_ECPOINTFORMAT_last 2 + +/* Signature and hash algorithms from RFC5246 */ +#define TLSEXT_signature_anonymous 0 +#define TLSEXT_signature_rsa 1 +#define TLSEXT_signature_dsa 2 +#define TLSEXT_signature_ecdsa 3 +#define TLSEXT_signature_gostr34102001 237 +#define TLSEXT_signature_gostr34102012_256 238 +#define TLSEXT_signature_gostr34102012_512 239 + +/* Total number of different signature algorithms */ +#define TLSEXT_signature_num 7 + +#define TLSEXT_hash_none 0 +#define TLSEXT_hash_md5 1 +#define TLSEXT_hash_sha1 2 +#define TLSEXT_hash_sha224 3 +#define TLSEXT_hash_sha256 4 +#define TLSEXT_hash_sha384 5 +#define TLSEXT_hash_sha512 6 +#define TLSEXT_hash_gostr3411 237 +#define TLSEXT_hash_gostr34112012_256 238 +#define TLSEXT_hash_gostr34112012_512 239 + +/* Total number of different digest algorithms */ + +#define TLSEXT_hash_num 10 + +/* Possible compression values from RFC8879 */ +/* Not defined in RFC8879, but used internally for no-compression */ +#define TLSEXT_comp_cert_none 0 +#define TLSEXT_comp_cert_zlib 1 +#define TLSEXT_comp_cert_brotli 2 +#define TLSEXT_comp_cert_zstd 3 +/* one more than the number of defined values - used as size of 0-terminated array */ +#define TLSEXT_comp_cert_limit 4 + +/* Flag set for unrecognised algorithms */ +#define TLSEXT_nid_unknown 0x1000000 + +/* ECC curves */ + +#define TLSEXT_curve_P_256 23 +#define TLSEXT_curve_P_384 24 + +/* OpenSSL value to disable maximum fragment length extension */ +#define TLSEXT_max_fragment_length_DISABLED 0 +/* Allowed values for max fragment length extension */ +#define TLSEXT_max_fragment_length_512 1 +#define TLSEXT_max_fragment_length_1024 2 +#define TLSEXT_max_fragment_length_2048 3 +#define TLSEXT_max_fragment_length_4096 4 +/* OpenSSL value for unset maximum fragment length extension */ +#define TLSEXT_max_fragment_length_UNSPECIFIED 255 + +/* + * TLS Certificate Type (for RFC7250) + * https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#tls-extensiontype-values-3 + */ +#define TLSEXT_cert_type_x509 0 +#define TLSEXT_cert_type_pgp 1 /* recognized, but not supported */ +#define TLSEXT_cert_type_rpk 2 +#define TLSEXT_cert_type_1609dot2 3 /* recognized, but not supported */ + +int SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode); +int SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode); + +#define TLSEXT_MAXLEN_host_name 255 + +__owur const char *SSL_get_servername(const SSL *s, const int type); +__owur int SSL_get_servername_type(const SSL *s); +/* + * SSL_export_keying_material exports a value derived from the master secret, + * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and + * optional context. (Since a zero length context is allowed, the |use_context| + * flag controls whether a context is included.) It returns 1 on success and + * 0 or -1 otherwise. + */ +__owur int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, + const char *label, size_t llen, + const unsigned char *context, + size_t contextlen, int use_context); + +/* + * SSL_export_keying_material_early exports a value derived from the + * early exporter master secret, as specified in + * https://tools.ietf.org/html/draft-ietf-tls-tls13-23. It writes + * |olen| bytes to |out| given a label and optional context. It + * returns 1 on success and 0 otherwise. + */ +__owur int SSL_export_keying_material_early(SSL *s, unsigned char *out, + size_t olen, const char *label, + size_t llen, + const unsigned char *context, + size_t contextlen); + +int SSL_get_peer_signature_type_nid(const SSL *s, int *pnid); +int SSL_get_signature_type_nid(const SSL *s, int *pnid); + +int SSL_get_sigalgs(SSL *s, int idx, + int *psign, int *phash, int *psignandhash, + unsigned char *rsig, unsigned char *rhash); + +char *SSL_get1_builtin_sigalgs(OSSL_LIB_CTX *libctx); + +int SSL_get_shared_sigalgs(SSL *s, int idx, + int *psign, int *phash, int *psignandhash, + unsigned char *rsig, unsigned char *rhash); + +__owur int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain); + +#define SSL_set_tlsext_host_name(s, name) \ + SSL_ctrl(s, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, \ + (void *)name) + +#define SSL_set_tlsext_debug_callback(ssl, cb) \ + SSL_callback_ctrl(ssl, SSL_CTRL_SET_TLSEXT_DEBUG_CB, \ + (void (*)(void))cb) + +#define SSL_set_tlsext_debug_arg(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_DEBUG_ARG, 0, arg) + +#define SSL_get_tlsext_status_type(ssl) \ + SSL_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE, 0, NULL) + +#define SSL_set_tlsext_status_type(ssl, type) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE, type, NULL) + +#define SSL_get_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS, 0, arg) + +#define SSL_set_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS, 0, arg) + +#define SSL_get_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS, 0, arg) + +#define SSL_set_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS, 0, arg) + +#define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP, 0, arg) + +#define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP, arglen, arg) + +#define SSL_get0_tlsext_status_ocsp_resp_ex(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP_EX, 0, arg) + +#define SSL_set0_tlsext_status_ocsp_resp_ex(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP_EX, 0, arg) + +#define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ + SSL_CTX_callback_ctrl(ctx, SSL_CTRL_SET_TLSEXT_SERVERNAME_CB, \ + (void (*)(void))cb) + +#define SSL_TLSEXT_ERR_OK 0 +#define SSL_TLSEXT_ERR_ALERT_WARNING 1 +#define SSL_TLSEXT_ERR_ALERT_FATAL 2 +#define SSL_TLSEXT_ERR_NOACK 3 + +#define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG, 0, arg) + +#define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_TLSEXT_TICKET_KEYS, keylen, keys) +#define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TLSEXT_TICKET_KEYS, keylen, keys) + +#define SSL_CTX_get_tlsext_status_cb(ssl, cb) \ + SSL_CTX_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB, 0, (void *)cb) +#define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ + SSL_CTX_callback_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB, \ + (void (*)(void))cb) + +#define SSL_CTX_get_tlsext_status_arg(ssl, arg) \ + SSL_CTX_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG, 0, arg) +#define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ + SSL_CTX_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG, 0, arg) + +#define SSL_CTX_set_tlsext_status_type(ssl, type) \ + SSL_CTX_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE, type, NULL) + +#define SSL_CTX_get_tlsext_status_type(ssl) \ + SSL_CTX_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE, 0, NULL) + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ + SSL_CTX_callback_ctrl(ssl, SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB, \ + (void (*)(void))cb) +#endif +int SSL_CTX_set_tlsext_ticket_key_evp_cb(SSL_CTX *ctx, int (*fp)(SSL *, unsigned char *, unsigned char *, EVP_CIPHER_CTX *, EVP_MAC_CTX *, int)); + +/* PSK ciphersuites from 4279 */ +#define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A +#define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B +#define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C +#define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D +#define TLS1_CK_DHE_PSK_WITH_RC4_128_SHA 0x0300008E +#define TLS1_CK_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008F +#define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA 0x03000090 +#define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA 0x03000091 +#define TLS1_CK_RSA_PSK_WITH_RC4_128_SHA 0x03000092 +#define TLS1_CK_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x03000093 +#define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA 0x03000094 +#define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA 0x03000095 + +/* PSK ciphersuites from 5487 */ +#define TLS1_CK_PSK_WITH_AES_128_GCM_SHA256 0x030000A8 +#define TLS1_CK_PSK_WITH_AES_256_GCM_SHA384 0x030000A9 +#define TLS1_CK_DHE_PSK_WITH_AES_128_GCM_SHA256 0x030000AA +#define TLS1_CK_DHE_PSK_WITH_AES_256_GCM_SHA384 0x030000AB +#define TLS1_CK_RSA_PSK_WITH_AES_128_GCM_SHA256 0x030000AC +#define TLS1_CK_RSA_PSK_WITH_AES_256_GCM_SHA384 0x030000AD +#define TLS1_CK_PSK_WITH_AES_128_CBC_SHA256 0x030000AE +#define TLS1_CK_PSK_WITH_AES_256_CBC_SHA384 0x030000AF +#define TLS1_CK_PSK_WITH_NULL_SHA256 0x030000B0 +#define TLS1_CK_PSK_WITH_NULL_SHA384 0x030000B1 +#define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA256 0x030000B2 +#define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA384 0x030000B3 +#define TLS1_CK_DHE_PSK_WITH_NULL_SHA256 0x030000B4 +#define TLS1_CK_DHE_PSK_WITH_NULL_SHA384 0x030000B5 +#define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA256 0x030000B6 +#define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA384 0x030000B7 +#define TLS1_CK_RSA_PSK_WITH_NULL_SHA256 0x030000B8 +#define TLS1_CK_RSA_PSK_WITH_NULL_SHA384 0x030000B9 + +/* NULL PSK ciphersuites from RFC4785 */ +#define TLS1_CK_PSK_WITH_NULL_SHA 0x0300002C +#define TLS1_CK_DHE_PSK_WITH_NULL_SHA 0x0300002D +#define TLS1_CK_RSA_PSK_WITH_NULL_SHA 0x0300002E + +/* AES ciphersuites from RFC3268 */ +#define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F +#define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 +#define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 +#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 +#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 +#define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 +#define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 +#define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 +#define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 +#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 +#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 +#define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A + +/* TLS v1.2 ciphersuites */ +#define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B +#define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C +#define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D +#define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E +#define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F +#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 +#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 + +/* TLS v1.2 ciphersuites */ +#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 +#define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 +#define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 +#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A +#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B +#define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C +#define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 +#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 + +/* SEED ciphersuites from RFC4162 */ +#define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 +#define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 +#define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 +#define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 +#define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A +#define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +#define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C +#define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D +#define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E +#define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F +#define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 +#define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 +#define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 +#define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 +#define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 +#define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 +#define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 +#define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 + +/* CCM ciphersuites from RFC6655 */ +#define TLS1_CK_RSA_WITH_AES_128_CCM 0x0300C09C +#define TLS1_CK_RSA_WITH_AES_256_CCM 0x0300C09D +#define TLS1_CK_DHE_RSA_WITH_AES_128_CCM 0x0300C09E +#define TLS1_CK_DHE_RSA_WITH_AES_256_CCM 0x0300C09F +#define TLS1_CK_RSA_WITH_AES_128_CCM_8 0x0300C0A0 +#define TLS1_CK_RSA_WITH_AES_256_CCM_8 0x0300C0A1 +#define TLS1_CK_DHE_RSA_WITH_AES_128_CCM_8 0x0300C0A2 +#define TLS1_CK_DHE_RSA_WITH_AES_256_CCM_8 0x0300C0A3 +#define TLS1_CK_PSK_WITH_AES_128_CCM 0x0300C0A4 +#define TLS1_CK_PSK_WITH_AES_256_CCM 0x0300C0A5 +#define TLS1_CK_DHE_PSK_WITH_AES_128_CCM 0x0300C0A6 +#define TLS1_CK_DHE_PSK_WITH_AES_256_CCM 0x0300C0A7 +#define TLS1_CK_PSK_WITH_AES_128_CCM_8 0x0300C0A8 +#define TLS1_CK_PSK_WITH_AES_256_CCM_8 0x0300C0A9 +#define TLS1_CK_DHE_PSK_WITH_AES_128_CCM_8 0x0300C0AA +#define TLS1_CK_DHE_PSK_WITH_AES_256_CCM_8 0x0300C0AB + +/* CCM ciphersuites from RFC7251 */ +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM 0x0300C0AC +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM 0x0300C0AD +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM_8 0x0300C0AE +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM_8 0x0300C0AF + +/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ +#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BA +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BB +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BC +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BD +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BE +#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256 0x030000BF + +#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C0 +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C1 +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C2 +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C3 +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4 +#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5 + +/* ECC ciphersuites from RFC4492 */ +#define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 +#define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 +#define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 + +#define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 +#define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 +#define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A + +#define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B +#define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C +#define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D +#define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E +#define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F + +#define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 +#define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 +#define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 + +#define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 +#define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 +#define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 +#define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 +#define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 + +/* SRP ciphersuites from RFC 5054 */ +#define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A +#define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B +#define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C +#define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D +#define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E +#define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F +#define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 +#define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 +#define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 + +/* ECDH HMAC based ciphersuites from RFC5289 */ +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 +#define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 +#define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A + +/* ECDH GCM based ciphersuites from RFC5289 */ +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 +#define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 +#define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 + +/* ECDHE PSK ciphersuites from RFC5489 */ +#define TLS1_CK_ECDHE_PSK_WITH_RC4_128_SHA 0x0300C033 +#define TLS1_CK_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300C034 +#define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035 +#define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036 + +#define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0x0300C037 +#define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0x0300C038 + +/* NULL PSK ciphersuites from RFC4785 */ +#define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA 0x0300C039 +#define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA256 0x0300C03A +#define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA384 0x0300C03B + +/* Camellia-CBC ciphersuites from RFC6367 */ +#define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C072 +#define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C073 +#define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C074 +#define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C075 +#define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C076 +#define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C077 +#define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C078 +#define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C079 + +#define TLS1_CK_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C094 +#define TLS1_CK_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C095 +#define TLS1_CK_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C096 +#define TLS1_CK_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C097 +#define TLS1_CK_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C098 +#define TLS1_CK_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C099 +#define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C09A +#define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C09B + +/* draft-ietf-tls-chacha20-poly1305-03 */ +#define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCA8 +#define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0x0300CCA9 +#define TLS1_CK_DHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCAA +#define TLS1_CK_PSK_WITH_CHACHA20_POLY1305 0x0300CCAB +#define TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAC +#define TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAD +#define TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305 0x0300CCAE + +/* TLS v1.3 ciphersuites */ +#define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301 +#define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302 +#define TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x03001303 +#define TLS1_3_CK_AES_128_CCM_SHA256 0x03001304 +#define TLS1_3_CK_AES_128_CCM_8_SHA256 0x03001305 + +/* Integrity-only ciphersuites from RFC 9150 */ +#define TLS1_3_CK_SHA256_SHA256 0x0300C0B4 +#define TLS1_3_CK_SHA384_SHA384 0x0300C0B5 + +/* Aria ciphersuites from RFC6209 */ +#define TLS1_CK_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C050 +#define TLS1_CK_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C051 +#define TLS1_CK_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C052 +#define TLS1_CK_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C053 +#define TLS1_CK_DH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C054 +#define TLS1_CK_DH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C055 +#define TLS1_CK_DHE_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C056 +#define TLS1_CK_DHE_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C057 +#define TLS1_CK_DH_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C058 +#define TLS1_CK_DH_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C059 +#define TLS1_CK_DH_anon_WITH_ARIA_128_GCM_SHA256 0x0300C05A +#define TLS1_CK_DH_anon_WITH_ARIA_256_GCM_SHA384 0x0300C05B +#define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05C +#define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05D +#define TLS1_CK_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05E +#define TLS1_CK_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05F +#define TLS1_CK_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C060 +#define TLS1_CK_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C061 +#define TLS1_CK_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C062 +#define TLS1_CK_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C063 +#define TLS1_CK_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06A +#define TLS1_CK_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06B +#define TLS1_CK_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06C +#define TLS1_CK_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06D +#define TLS1_CK_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06E +#define TLS1_CK_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06F + +/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ +#define TLS1_RFC_RSA_WITH_AES_128_SHA "TLS_RSA_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_ADH_WITH_AES_128_SHA "TLS_DH_anon_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_RSA_WITH_AES_256_SHA "TLS_RSA_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_ADH_WITH_AES_256_SHA "TLS_DH_anon_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_RSA_WITH_NULL_SHA256 "TLS_RSA_WITH_NULL_SHA256" +#define TLS1_RFC_RSA_WITH_AES_128_SHA256 "TLS_RSA_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_RSA_WITH_AES_256_SHA256 "TLS_RSA_WITH_AES_256_CBC_SHA256" +#define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA256 "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA256 "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA256 "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" +#define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA256 "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256" +#define TLS1_RFC_ADH_WITH_AES_128_SHA256 "TLS_DH_anon_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_ADH_WITH_AES_256_SHA256 "TLS_DH_anon_WITH_AES_256_CBC_SHA256" +#define TLS1_RFC_RSA_WITH_AES_128_GCM_SHA256 "TLS_RSA_WITH_AES_128_GCM_SHA256" +#define TLS1_RFC_RSA_WITH_AES_256_GCM_SHA384 "TLS_RSA_WITH_AES_256_GCM_SHA384" +#define TLS1_RFC_DHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" +#define TLS1_RFC_DHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" +#define TLS1_RFC_DHE_DSS_WITH_AES_128_GCM_SHA256 "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256" +#define TLS1_RFC_DHE_DSS_WITH_AES_256_GCM_SHA384 "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" +#define TLS1_RFC_ADH_WITH_AES_128_GCM_SHA256 "TLS_DH_anon_WITH_AES_128_GCM_SHA256" +#define TLS1_RFC_ADH_WITH_AES_256_GCM_SHA384 "TLS_DH_anon_WITH_AES_256_GCM_SHA384" +#define TLS1_RFC_RSA_WITH_AES_128_CCM "TLS_RSA_WITH_AES_128_CCM" +#define TLS1_RFC_RSA_WITH_AES_256_CCM "TLS_RSA_WITH_AES_256_CCM" +#define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM "TLS_DHE_RSA_WITH_AES_128_CCM" +#define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM "TLS_DHE_RSA_WITH_AES_256_CCM" +#define TLS1_RFC_RSA_WITH_AES_128_CCM_8 "TLS_RSA_WITH_AES_128_CCM_8" +#define TLS1_RFC_RSA_WITH_AES_256_CCM_8 "TLS_RSA_WITH_AES_256_CCM_8" +#define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM_8 "TLS_DHE_RSA_WITH_AES_128_CCM_8" +#define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM_8 "TLS_DHE_RSA_WITH_AES_256_CCM_8" +#define TLS1_RFC_PSK_WITH_AES_128_CCM "TLS_PSK_WITH_AES_128_CCM" +#define TLS1_RFC_PSK_WITH_AES_256_CCM "TLS_PSK_WITH_AES_256_CCM" +#define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM "TLS_DHE_PSK_WITH_AES_128_CCM" +#define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM "TLS_DHE_PSK_WITH_AES_256_CCM" +#define TLS1_RFC_PSK_WITH_AES_128_CCM_8 "TLS_PSK_WITH_AES_128_CCM_8" +#define TLS1_RFC_PSK_WITH_AES_256_CCM_8 "TLS_PSK_WITH_AES_256_CCM_8" +#define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM_8 "TLS_PSK_DHE_WITH_AES_128_CCM_8" +#define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM_8 "TLS_PSK_DHE_WITH_AES_256_CCM_8" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM "TLS_ECDHE_ECDSA_WITH_AES_128_CCM" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM "TLS_ECDHE_ECDSA_WITH_AES_256_CCM" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8" +#define TLS1_3_RFC_AES_128_GCM_SHA256 "TLS_AES_128_GCM_SHA256" +#define TLS1_3_RFC_AES_256_GCM_SHA384 "TLS_AES_256_GCM_SHA384" +#define TLS1_3_RFC_CHACHA20_POLY1305_SHA256 "TLS_CHACHA20_POLY1305_SHA256" +#define TLS1_3_RFC_SHA256_SHA256 "TLS_SHA256_SHA256" +#define TLS1_3_RFC_SHA384_SHA384 "TLS_SHA384_SHA384" +#define TLS1_3_RFC_AES_128_CCM_SHA256 "TLS_AES_128_CCM_SHA256" +#define TLS1_3_RFC_AES_128_CCM_8_SHA256 "TLS_AES_128_CCM_8_SHA256" +#define TLS1_RFC_ECDHE_ECDSA_WITH_NULL_SHA "TLS_ECDHE_ECDSA_WITH_NULL_SHA" +#define TLS1_RFC_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_ECDHE_RSA_WITH_NULL_SHA "TLS_ECDHE_RSA_WITH_NULL_SHA" +#define TLS1_RFC_ECDHE_RSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_ECDHE_RSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_ECDHE_RSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_ECDH_anon_WITH_NULL_SHA "TLS_ECDH_anon_WITH_NULL_SHA" +#define TLS1_RFC_ECDH_anon_WITH_DES_192_CBC3_SHA "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_ECDH_anon_WITH_AES_128_CBC_SHA "TLS_ECDH_anon_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_ECDH_anon_WITH_AES_256_CBC_SHA "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" +#define TLS1_RFC_ECDHE_RSA_WITH_AES_128_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_ECDHE_RSA_WITH_AES_256_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" +#define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" +#define TLS1_RFC_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" +#define TLS1_RFC_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" +#define TLS1_RFC_PSK_WITH_NULL_SHA "TLS_PSK_WITH_NULL_SHA" +#define TLS1_RFC_DHE_PSK_WITH_NULL_SHA "TLS_DHE_PSK_WITH_NULL_SHA" +#define TLS1_RFC_RSA_PSK_WITH_NULL_SHA "TLS_RSA_PSK_WITH_NULL_SHA" +#define TLS1_RFC_PSK_WITH_3DES_EDE_CBC_SHA "TLS_PSK_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA "TLS_PSK_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA "TLS_PSK_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_DHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA "TLS_DHE_PSK_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA "TLS_DHE_PSK_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_RSA_PSK_WITH_3DES_EDE_CBC_SHA "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA "TLS_RSA_PSK_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA "TLS_RSA_PSK_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_PSK_WITH_AES_128_GCM_SHA256 "TLS_PSK_WITH_AES_128_GCM_SHA256" +#define TLS1_RFC_PSK_WITH_AES_256_GCM_SHA384 "TLS_PSK_WITH_AES_256_GCM_SHA384" +#define TLS1_RFC_DHE_PSK_WITH_AES_128_GCM_SHA256 "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256" +#define TLS1_RFC_DHE_PSK_WITH_AES_256_GCM_SHA384 "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384" +#define TLS1_RFC_RSA_PSK_WITH_AES_128_GCM_SHA256 "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256" +#define TLS1_RFC_RSA_PSK_WITH_AES_256_GCM_SHA384 "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384" +#define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA256 "TLS_PSK_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA384 "TLS_PSK_WITH_AES_256_CBC_SHA384" +#define TLS1_RFC_PSK_WITH_NULL_SHA256 "TLS_PSK_WITH_NULL_SHA256" +#define TLS1_RFC_PSK_WITH_NULL_SHA384 "TLS_PSK_WITH_NULL_SHA384" +#define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384" +#define TLS1_RFC_DHE_PSK_WITH_NULL_SHA256 "TLS_DHE_PSK_WITH_NULL_SHA256" +#define TLS1_RFC_DHE_PSK_WITH_NULL_SHA384 "TLS_DHE_PSK_WITH_NULL_SHA384" +#define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA256 "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA384 "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384" +#define TLS1_RFC_RSA_PSK_WITH_NULL_SHA256 "TLS_RSA_PSK_WITH_NULL_SHA256" +#define TLS1_RFC_RSA_PSK_WITH_NULL_SHA384 "TLS_RSA_PSK_WITH_NULL_SHA384" +#define TLS1_RFC_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256" +#define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384" +#define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA "TLS_ECDHE_PSK_WITH_NULL_SHA" +#define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA256 "TLS_ECDHE_PSK_WITH_NULL_SHA256" +#define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA384 "TLS_ECDHE_PSK_WITH_NULL_SHA384" +#define TLS1_RFC_SRP_SHA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA" +#define TLS1_RFC_SRP_SHA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA" +#define TLS1_RFC_SRP_SHA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA" +#define TLS1_RFC_DHE_RSA_WITH_CHACHA20_POLY1305 "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256" +#define TLS1_RFC_ECDHE_RSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" +#define TLS1_RFC_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" +#define TLS1_RFC_PSK_WITH_CHACHA20_POLY1305 "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256" +#define TLS1_RFC_ECDHE_PSK_WITH_CHACHA20_POLY1305 "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256" +#define TLS1_RFC_DHE_PSK_WITH_CHACHA20_POLY1305 "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256" +#define TLS1_RFC_RSA_PSK_WITH_CHACHA20_POLY1305 "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256" +#define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256" +#define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256" +#define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256" +#define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256" +#define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA" +#define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA" +#define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA" +#define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA" +#define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" +#define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA" +#define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA" +#define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA" +#define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384" +#define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384" +#define TLS1_RFC_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384" +#define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" +#define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384" +#define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" +#define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" +#define TLS1_RFC_RSA_WITH_SEED_SHA "TLS_RSA_WITH_SEED_CBC_SHA" +#define TLS1_RFC_DHE_DSS_WITH_SEED_SHA "TLS_DHE_DSS_WITH_SEED_CBC_SHA" +#define TLS1_RFC_DHE_RSA_WITH_SEED_SHA "TLS_DHE_RSA_WITH_SEED_CBC_SHA" +#define TLS1_RFC_ADH_WITH_SEED_SHA "TLS_DH_anon_WITH_SEED_CBC_SHA" +#define TLS1_RFC_ECDHE_PSK_WITH_RC4_128_SHA "TLS_ECDHE_PSK_WITH_RC4_128_SHA" +#define TLS1_RFC_ECDH_anon_WITH_RC4_128_SHA "TLS_ECDH_anon_WITH_RC4_128_SHA" +#define TLS1_RFC_ECDHE_ECDSA_WITH_RC4_128_SHA "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA" +#define TLS1_RFC_ECDHE_RSA_WITH_RC4_128_SHA "TLS_ECDHE_RSA_WITH_RC4_128_SHA" +#define TLS1_RFC_PSK_WITH_RC4_128_SHA "TLS_PSK_WITH_RC4_128_SHA" +#define TLS1_RFC_RSA_PSK_WITH_RC4_128_SHA "TLS_RSA_PSK_WITH_RC4_128_SHA" +#define TLS1_RFC_DHE_PSK_WITH_RC4_128_SHA "TLS_DHE_PSK_WITH_RC4_128_SHA" +#define TLS1_RFC_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_DH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_DH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_DH_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_DH_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_DH_anon_WITH_ARIA_128_GCM_SHA256 "TLS_DH_anon_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_DH_anon_WITH_ARIA_256_GCM_SHA384 "TLS_DH_anon_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_PSK_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_PSK_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384" +#define TLS1_RFC_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256" +#define TLS1_RFC_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384" + +/* + * XXX Backward compatibility alert: Older versions of OpenSSL gave some DHE + * ciphers names with "EDH" instead of "DHE". Going forward, we should be + * using DHE everywhere, though we may indefinitely maintain aliases for + * users or configurations that used "EDH" + */ +#define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" + +#define TLS1_TXT_PSK_WITH_NULL_SHA "PSK-NULL-SHA" +#define TLS1_TXT_DHE_PSK_WITH_NULL_SHA "DHE-PSK-NULL-SHA" +#define TLS1_TXT_RSA_PSK_WITH_NULL_SHA "RSA-PSK-NULL-SHA" + +/* AES ciphersuites from RFC3268 */ +#define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" +#define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" + +#define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" +#define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" + +/* ECC ciphersuites from RFC4492 */ +#define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" + +#define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" + +#define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" + +#define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" + +#define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" +#define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" +#define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" +#define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" + +/* PSK ciphersuites from RFC 4279 */ +#define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" +#define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" +#define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" +#define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" + +#define TLS1_TXT_DHE_PSK_WITH_RC4_128_SHA "DHE-PSK-RC4-SHA" +#define TLS1_TXT_DHE_PSK_WITH_3DES_EDE_CBC_SHA "DHE-PSK-3DES-EDE-CBC-SHA" +#define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA "DHE-PSK-AES128-CBC-SHA" +#define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA "DHE-PSK-AES256-CBC-SHA" +#define TLS1_TXT_RSA_PSK_WITH_RC4_128_SHA "RSA-PSK-RC4-SHA" +#define TLS1_TXT_RSA_PSK_WITH_3DES_EDE_CBC_SHA "RSA-PSK-3DES-EDE-CBC-SHA" +#define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA "RSA-PSK-AES128-CBC-SHA" +#define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA "RSA-PSK-AES256-CBC-SHA" + +/* PSK ciphersuites from RFC 5487 */ +#define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" +#define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" +#define TLS1_TXT_DHE_PSK_WITH_AES_128_GCM_SHA256 "DHE-PSK-AES128-GCM-SHA256" +#define TLS1_TXT_DHE_PSK_WITH_AES_256_GCM_SHA384 "DHE-PSK-AES256-GCM-SHA384" +#define TLS1_TXT_RSA_PSK_WITH_AES_128_GCM_SHA256 "RSA-PSK-AES128-GCM-SHA256" +#define TLS1_TXT_RSA_PSK_WITH_AES_256_GCM_SHA384 "RSA-PSK-AES256-GCM-SHA384" + +#define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA256 "PSK-AES128-CBC-SHA256" +#define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA384 "PSK-AES256-CBC-SHA384" +#define TLS1_TXT_PSK_WITH_NULL_SHA256 "PSK-NULL-SHA256" +#define TLS1_TXT_PSK_WITH_NULL_SHA384 "PSK-NULL-SHA384" + +#define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA256 "DHE-PSK-AES128-CBC-SHA256" +#define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA384 "DHE-PSK-AES256-CBC-SHA384" +#define TLS1_TXT_DHE_PSK_WITH_NULL_SHA256 "DHE-PSK-NULL-SHA256" +#define TLS1_TXT_DHE_PSK_WITH_NULL_SHA384 "DHE-PSK-NULL-SHA384" + +#define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA256 "RSA-PSK-AES128-CBC-SHA256" +#define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA384 "RSA-PSK-AES256-CBC-SHA384" +#define TLS1_TXT_RSA_PSK_WITH_NULL_SHA256 "RSA-PSK-NULL-SHA256" +#define TLS1_TXT_RSA_PSK_WITH_NULL_SHA384 "RSA-PSK-NULL-SHA384" + +/* SRP ciphersuite from RFC 5054 */ +#define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" +#define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" +#define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" +#define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" +#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" +#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" +#define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" +#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" +#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" +#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" + +#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" +#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" + +/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ +#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256 "CAMELLIA128-SHA256" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DH-DSS-CAMELLIA128-SHA256" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DH-RSA-CAMELLIA128-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DHE-DSS-CAMELLIA128-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DHE-RSA-CAMELLIA128-SHA256" +#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256 "ADH-CAMELLIA128-SHA256" + +#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256 "CAMELLIA256-SHA256" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DH-DSS-CAMELLIA256-SHA256" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DH-RSA-CAMELLIA256-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DHE-DSS-CAMELLIA256-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DHE-RSA-CAMELLIA256-SHA256" +#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256 "ADH-CAMELLIA256-SHA256" + +#define TLS1_TXT_PSK_WITH_CAMELLIA_128_CBC_SHA256 "PSK-CAMELLIA128-SHA256" +#define TLS1_TXT_PSK_WITH_CAMELLIA_256_CBC_SHA384 "PSK-CAMELLIA256-SHA384" +#define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "DHE-PSK-CAMELLIA128-SHA256" +#define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "DHE-PSK-CAMELLIA256-SHA384" +#define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "RSA-PSK-CAMELLIA128-SHA256" +#define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "RSA-PSK-CAMELLIA256-SHA384" +#define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-PSK-CAMELLIA128-SHA256" +#define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-PSK-CAMELLIA256-SHA384" + +/* SEED ciphersuites from RFC4162 */ +#define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" +#define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" +#define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" +#define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" +#define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" +#define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" + +/* TLS v1.2 ciphersuites */ +#define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" +#define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" +#define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" +#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" +#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" +#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" +#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" +#define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" +#define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +#define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" +#define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" +#define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" +#define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" +#define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" +#define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" +#define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" + +/* CCM ciphersuites from RFC6655 */ +#define TLS1_TXT_RSA_WITH_AES_128_CCM "AES128-CCM" +#define TLS1_TXT_RSA_WITH_AES_256_CCM "AES256-CCM" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM "DHE-RSA-AES128-CCM" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM "DHE-RSA-AES256-CCM" + +#define TLS1_TXT_RSA_WITH_AES_128_CCM_8 "AES128-CCM8" +#define TLS1_TXT_RSA_WITH_AES_256_CCM_8 "AES256-CCM8" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM_8 "DHE-RSA-AES128-CCM8" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM_8 "DHE-RSA-AES256-CCM8" + +#define TLS1_TXT_PSK_WITH_AES_128_CCM "PSK-AES128-CCM" +#define TLS1_TXT_PSK_WITH_AES_256_CCM "PSK-AES256-CCM" +#define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM "DHE-PSK-AES128-CCM" +#define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM "DHE-PSK-AES256-CCM" + +#define TLS1_TXT_PSK_WITH_AES_128_CCM_8 "PSK-AES128-CCM8" +#define TLS1_TXT_PSK_WITH_AES_256_CCM_8 "PSK-AES256-CCM8" +#define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM_8 "DHE-PSK-AES128-CCM8" +#define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM_8 "DHE-PSK-AES256-CCM8" + +/* CCM ciphersuites from RFC7251 */ +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM "ECDHE-ECDSA-AES128-CCM" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM "ECDHE-ECDSA-AES256-CCM" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM_8 "ECDHE-ECDSA-AES128-CCM8" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8 "ECDHE-ECDSA-AES256-CCM8" + +/* ECDH HMAC based ciphersuites from RFC5289 */ +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" + +/* ECDH GCM based ciphersuites from RFC5289 */ +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256-GCM-SHA384" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" + +/* TLS v1.2 PSK GCM ciphersuites from RFC5487 */ +#define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" +#define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" + +/* ECDHE PSK ciphersuites from RFC 5489 */ +#define TLS1_TXT_ECDHE_PSK_WITH_RC4_128_SHA "ECDHE-PSK-RC4-SHA" +#define TLS1_TXT_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "ECDHE-PSK-3DES-EDE-CBC-SHA" +#define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA" +#define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA "ECDHE-PSK-AES256-CBC-SHA" + +#define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "ECDHE-PSK-AES128-CBC-SHA256" +#define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "ECDHE-PSK-AES256-CBC-SHA384" + +#define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA "ECDHE-PSK-NULL-SHA" +#define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA256 "ECDHE-PSK-NULL-SHA256" +#define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA384 "ECDHE-PSK-NULL-SHA384" + +/* Camellia-CBC ciphersuites from RFC6367 */ +#define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-ECDSA-CAMELLIA128-SHA256" +#define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-ECDSA-CAMELLIA256-SHA384" +#define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-ECDSA-CAMELLIA128-SHA256" +#define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-ECDSA-CAMELLIA256-SHA384" +#define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-RSA-CAMELLIA128-SHA256" +#define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-RSA-CAMELLIA256-SHA384" +#define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-RSA-CAMELLIA128-SHA256" +#define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-RSA-CAMELLIA256-SHA384" + +/* draft-ietf-tls-chacha20-poly1305-03 */ +#define TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305 "ECDHE-RSA-CHACHA20-POLY1305" +#define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305" +#define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" +#define TLS1_TXT_PSK_WITH_CHACHA20_POLY1305 "PSK-CHACHA20-POLY1305" +#define TLS1_TXT_ECDHE_PSK_WITH_CHACHA20_POLY1305 "ECDHE-PSK-CHACHA20-POLY1305" +#define TLS1_TXT_DHE_PSK_WITH_CHACHA20_POLY1305 "DHE-PSK-CHACHA20-POLY1305" +#define TLS1_TXT_RSA_PSK_WITH_CHACHA20_POLY1305 "RSA-PSK-CHACHA20-POLY1305" + +/* Aria ciphersuites from RFC6209 */ +#define TLS1_TXT_RSA_WITH_ARIA_128_GCM_SHA256 "ARIA128-GCM-SHA256" +#define TLS1_TXT_RSA_WITH_ARIA_256_GCM_SHA384 "ARIA256-GCM-SHA384" +#define TLS1_TXT_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "DHE-RSA-ARIA128-GCM-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "DHE-RSA-ARIA256-GCM-SHA384" +#define TLS1_TXT_DH_RSA_WITH_ARIA_128_GCM_SHA256 "DH-RSA-ARIA128-GCM-SHA256" +#define TLS1_TXT_DH_RSA_WITH_ARIA_256_GCM_SHA384 "DH-RSA-ARIA256-GCM-SHA384" +#define TLS1_TXT_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "DHE-DSS-ARIA128-GCM-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "DHE-DSS-ARIA256-GCM-SHA384" +#define TLS1_TXT_DH_DSS_WITH_ARIA_128_GCM_SHA256 "DH-DSS-ARIA128-GCM-SHA256" +#define TLS1_TXT_DH_DSS_WITH_ARIA_256_GCM_SHA384 "DH-DSS-ARIA256-GCM-SHA384" +#define TLS1_TXT_DH_anon_WITH_ARIA_128_GCM_SHA256 "ADH-ARIA128-GCM-SHA256" +#define TLS1_TXT_DH_anon_WITH_ARIA_256_GCM_SHA384 "ADH-ARIA256-GCM-SHA384" +#define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ECDSA-ARIA128-GCM-SHA256" +#define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ECDSA-ARIA256-GCM-SHA384" +#define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ECDSA-ARIA128-GCM-SHA256" +#define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ECDSA-ARIA256-GCM-SHA384" +#define TLS1_TXT_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ARIA128-GCM-SHA256" +#define TLS1_TXT_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ARIA256-GCM-SHA384" +#define TLS1_TXT_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ARIA128-GCM-SHA256" +#define TLS1_TXT_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ARIA256-GCM-SHA384" +#define TLS1_TXT_PSK_WITH_ARIA_128_GCM_SHA256 "PSK-ARIA128-GCM-SHA256" +#define TLS1_TXT_PSK_WITH_ARIA_256_GCM_SHA384 "PSK-ARIA256-GCM-SHA384" +#define TLS1_TXT_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "DHE-PSK-ARIA128-GCM-SHA256" +#define TLS1_TXT_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "DHE-PSK-ARIA256-GCM-SHA384" +#define TLS1_TXT_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "RSA-PSK-ARIA128-GCM-SHA256" +#define TLS1_TXT_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "RSA-PSK-ARIA256-GCM-SHA384" + +#define TLS_CT_RSA_SIGN 1 +#define TLS_CT_DSS_SIGN 2 +#define TLS_CT_RSA_FIXED_DH 3 +#define TLS_CT_DSS_FIXED_DH 4 +#define TLS_CT_ECDSA_SIGN 64 +#define TLS_CT_RSA_FIXED_ECDH 65 +#define TLS_CT_ECDSA_FIXED_ECDH 66 +#define TLS_CT_GOST01_SIGN 22 +#define TLS_CT_GOST12_IANA_SIGN 67 +#define TLS_CT_GOST12_IANA_512_SIGN 68 +#define TLS_CT_GOST12_LEGACY_SIGN 238 +#define TLS_CT_GOST12_LEGACY_512_SIGN 239 + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define TLS_CT_GOST12_SIGN TLS_CT_GOST12_LEGACY_SIGN +#define TLS_CT_GOST12_512_SIGN TLS_CT_GOST12_LEGACY_512_SIGN +#endif + +/* + * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see + * comment there) + */ +#define TLS_CT_NUMBER 12 + +#if defined(SSL3_CT_NUMBER) +#if TLS_CT_NUMBER != SSL3_CT_NUMBER +#error "SSL/TLS CT_NUMBER values do not match" +#endif +#endif + +#define TLS1_FINISH_MAC_LENGTH 12 + +#define TLS_MD_MAX_CONST_SIZE 22 + +/* ASCII: "client finished", in hex for EBCDIC compatibility */ +#define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" +#define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 +/* ASCII: "server finished", in hex for EBCDIC compatibility */ +#define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" +#define TLS_MD_SERVER_FINISH_CONST_SIZE 15 +/* ASCII: "server write key", in hex for EBCDIC compatibility */ +#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" +#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +/* ASCII: "key expansion", in hex for EBCDIC compatibility */ +#define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" +#define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 +/* ASCII: "client write key", in hex for EBCDIC compatibility */ +#define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" +#define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 +/* ASCII: "server write key", in hex for EBCDIC compatibility */ +#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" +#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +/* ASCII: "IV block", in hex for EBCDIC compatibility */ +#define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" +#define TLS_MD_IV_BLOCK_CONST_SIZE 8 +/* ASCII: "master secret", in hex for EBCDIC compatibility */ +#define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" +#define TLS_MD_MASTER_SECRET_CONST_SIZE 13 +/* ASCII: "extended master secret", in hex for EBCDIC compatibility */ +#define TLS_MD_EXTENDED_MASTER_SECRET_CONST "\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" +#define TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE 22 + +/* TLS Session Ticket extension struct */ +struct tls_session_ticket_ext_st { + unsigned short length; + void *data; +}; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/trace.h b/VCMP-LUA/modules/postgresql/include/openssl/trace.h new file mode 100644 index 0000000..ff0fba7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/trace.h @@ -0,0 +1,325 @@ +/* + * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_TRACE_H +#define OPENSSL_TRACE_H +#pragma once + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * TRACE CATEGORIES + */ + +/* + * The trace messages of the OpenSSL libraries are organized into different + * categories. For every trace category, the application can register a separate + * tracer callback. When a callback is registered, a so called trace channel is + * created for this category. This channel consists essentially of an internal + * BIO which sends all trace output it receives to the registered application + * callback. + * + * The ALL category can be used as a fallback category to register a single + * channel which receives the output from all categories. However, if the + * application intends to print the trace channel name in the line prefix, + * it is better to register channels for all categories separately. + * (This is how the openssl application does it.) + */ +#define OSSL_TRACE_CATEGORY_ALL 0 /* The fallback */ +#define OSSL_TRACE_CATEGORY_TRACE 1 +#define OSSL_TRACE_CATEGORY_INIT 2 +#define OSSL_TRACE_CATEGORY_TLS 3 +#define OSSL_TRACE_CATEGORY_TLS_CIPHER 4 +#define OSSL_TRACE_CATEGORY_CONF 5 +#define OSSL_TRACE_CATEGORY_ENGINE_TABLE 6 +#define OSSL_TRACE_CATEGORY_ENGINE_REF_COUNT 7 +#define OSSL_TRACE_CATEGORY_PKCS5V2 8 +#define OSSL_TRACE_CATEGORY_PKCS12_KEYGEN 9 +#define OSSL_TRACE_CATEGORY_PKCS12_DECRYPT 10 +#define OSSL_TRACE_CATEGORY_X509V3_POLICY 11 +#define OSSL_TRACE_CATEGORY_BN_CTX 12 +#define OSSL_TRACE_CATEGORY_CMP 13 +#define OSSL_TRACE_CATEGORY_STORE 14 +#define OSSL_TRACE_CATEGORY_DECODER 15 +#define OSSL_TRACE_CATEGORY_ENCODER 16 +#define OSSL_TRACE_CATEGORY_REF_COUNT 17 +#define OSSL_TRACE_CATEGORY_HTTP 18 +#define OSSL_TRACE_CATEGORY_PROVIDER 19 +#define OSSL_TRACE_CATEGORY_QUERY 20 +#define OSSL_TRACE_CATEGORY_NUM 21 +/* KEEP THIS LIST IN SYNC with trace_categories[] in crypto/trace.c */ + +/* Returns the trace category number for the given |name| */ +int OSSL_trace_get_category_num(const char *name); + +/* Returns the trace category name for the given |num| */ +const char *OSSL_trace_get_category_name(int num); + +/* + * TRACE CONSUMERS + */ + +/* + * Enables tracing for the given |category| by providing a BIO sink + * as |channel|. If a null pointer is passed as |channel|, an existing + * trace channel is removed and tracing for the category is disabled. + * + * Returns 1 on success and 0 on failure + */ +int OSSL_trace_set_channel(int category, BIO *channel); + +/* + * Attach a prefix and a suffix to the given |category|, to be printed at the + * beginning and at the end of each trace output group, i.e. when + * OSSL_trace_begin() and OSSL_trace_end() are called. + * If a null pointer is passed as argument, the existing prefix or suffix is + * removed. + * + * They return 1 on success and 0 on failure + */ +int OSSL_trace_set_prefix(int category, const char *prefix); +int OSSL_trace_set_suffix(int category, const char *suffix); + +/* + * OSSL_trace_cb is the type tracing callback provided by the application. + * It MUST return the number of bytes written, or 0 on error (in other words, + * it can never write zero bytes). + * + * The |buffer| will always contain text, which may consist of several lines. + * The |data| argument points to whatever data was provided by the application + * when registering the tracer function. + * + * The |category| number is given, as well as a |cmd| number, described below. + */ +typedef size_t (*OSSL_trace_cb)(const char *buffer, size_t count, + int category, int cmd, void *data); +/* + * Possible |cmd| numbers. + */ +#define OSSL_TRACE_CTRL_BEGIN 0 +#define OSSL_TRACE_CTRL_WRITE 1 +#define OSSL_TRACE_CTRL_END 2 + +/* + * Enables tracing for the given |category| by creating an internal + * trace channel which sends the output to the given |callback|. + * If a null pointer is passed as callback, an existing trace channel + * is removed and tracing for the category is disabled. + * + * NOTE: OSSL_trace_set_channel() and OSSL_trace_set_callback() are mutually + * exclusive. + * + * Returns 1 on success and 0 on failure + */ +int OSSL_trace_set_callback(int category, OSSL_trace_cb callback, void *data); + +/* + * TRACE PRODUCERS + */ + +/* + * Returns 1 if tracing for the specified category is enabled, otherwise 0 + */ +int OSSL_trace_enabled(int category); + +/* + * Wrap a group of tracing output calls. OSSL_trace_begin() locks tracing and + * returns the trace channel associated with the given category, or NULL if no + * channel is associated with the category. OSSL_trace_end() unlocks tracing. + * + * Usage: + * + * BIO *out; + * if ((out = OSSL_trace_begin(category)) != NULL) { + * ... + * BIO_fprintf(out, ...); + * ... + * OSSL_trace_end(category, out); + * } + * + * See also the convenience macros OSSL_TRACE_BEGIN and OSSL_TRACE_END below. + */ +BIO *OSSL_trace_begin(int category); +void OSSL_trace_end(int category, BIO *channel); + +/* + * OSSL_TRACE* Convenience Macros + */ + +/* + * When the tracing feature is disabled, these macros are defined to + * produce dead code, which a good compiler should eliminate. + */ + +/* + * OSSL_TRACE_BEGIN, OSSL_TRACE_END - Define a Trace Group + * + * These two macros can be used to create a block which is executed only + * if the corresponding trace category is enabled. Inside this block, a + * local variable named |trc_out| is defined, which points to the channel + * associated with the given trace category. + * + * Usage: (using 'TLS' as an example category) + * + * OSSL_TRACE_BEGIN(TLS) { + * + * BIO_fprintf(trc_out, ... ); + * + * } OSSL_TRACE_END(TLS); + * + * + * This expands to the following code + * + * do { + * BIO *trc_out = OSSL_trace_begin(OSSL_TRACE_CATEGORY_TLS); + * if (trc_out != NULL) { + * ... + * BIO_fprintf(trc_out, ...); + * } + * OSSL_trace_end(OSSL_TRACE_CATEGORY_TLS, trc_out); + * } while (0); + * + * The use of the inner '{...}' group and the trailing ';' is enforced + * by the definition of the macros in order to make the code look as much + * like C code as possible. + * + * Before returning from inside the trace block, it is necessary to + * call OSSL_TRACE_CANCEL(category). + */ + +#if !defined OPENSSL_NO_TRACE && !defined FIPS_MODULE + +#define OSSL_TRACE_BEGIN(category) \ + do { \ + BIO *trc_out = OSSL_trace_begin(OSSL_TRACE_CATEGORY_##category); \ + \ + if (trc_out != NULL) + +#define OSSL_TRACE_END(category) \ + OSSL_trace_end(OSSL_TRACE_CATEGORY_##category, trc_out); \ + } \ + while (0) + +#define OSSL_TRACE_CANCEL(category) \ + OSSL_trace_end(OSSL_TRACE_CATEGORY_##category, trc_out) + +#else + +#define OSSL_TRACE_BEGIN(category) \ + do { \ + BIO *trc_out = NULL; \ + if (0) + +#define OSSL_TRACE_END(category) \ + } \ + while (0) + +#define OSSL_TRACE_CANCEL(category) \ + ((void)0) + +#endif + +/* + * OSSL_TRACE_ENABLED() - Check whether tracing is enabled for |category| + * + * Usage: + * + * if (OSSL_TRACE_ENABLED(TLS)) { + * ... + * } + */ +#if !defined OPENSSL_NO_TRACE && !defined FIPS_MODULE + +#define OSSL_TRACE_ENABLED(category) \ + OSSL_trace_enabled(OSSL_TRACE_CATEGORY_##category) + +#else + +#define OSSL_TRACE_ENABLED(category) (0) + +#endif + +/* + * OSSL_TRACE*() - OneShot Trace Macros + * + * These macros are intended to produce a simple printf-style trace output. + * Unfortunately, C90 macros don't support variable arguments, so the + * "vararg" OSSL_TRACEV() macro has a rather weird usage pattern: + * + * OSSL_TRACEV(category, (trc_out, "format string", ...args...)); + * + * Where 'channel' is the literal symbol of this name, not a variable. + * For that reason, it is currently not intended to be used directly, + * but only as helper macro for the other oneshot trace macros + * OSSL_TRACE(), OSSL_TRACE1(), OSSL_TRACE2(), ... + * + * Usage: + * + * OSSL_TRACE(INIT, "Hello world!\n"); + * OSSL_TRACE1(TLS, "The answer is %d\n", 42); + * OSSL_TRACE2(TLS, "The ultimate question to answer %d is '%s'\n", + * 42, "What do you get when you multiply six by nine?"); + */ + +#if !defined OPENSSL_NO_TRACE && !defined FIPS_MODULE + +#define OSSL_TRACEV(category, args) \ + OSSL_TRACE_BEGIN(category) \ + BIO_printf args; \ + OSSL_TRACE_END(category) + +#else + +#define OSSL_TRACEV(category, args) ((void)0) + +#endif + +#define OSSL_TRACE(category, text) \ + OSSL_TRACEV(category, (trc_out, "%s", text)) + +#define OSSL_TRACE1(category, format, arg1) \ + OSSL_TRACEV(category, (trc_out, format, arg1)) +#define OSSL_TRACE2(category, format, arg1, arg2) \ + OSSL_TRACEV(category, (trc_out, format, arg1, arg2)) +#define OSSL_TRACE3(category, format, arg1, arg2, arg3) \ + OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3)) +#define OSSL_TRACE4(category, format, arg1, arg2, arg3, arg4) \ + OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4)) +#define OSSL_TRACE5(category, format, arg1, arg2, arg3, arg4, arg5) \ + OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4, arg5)) +#define OSSL_TRACE6(category, format, arg1, arg2, arg3, arg4, arg5, arg6) \ + OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4, arg5, arg6)) +#define OSSL_TRACE7(category, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) +#define OSSL_TRACE8(category, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ + OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) +#define OSSL_TRACE9(category, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \ + OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)) + +#define OSSL_TRACE_STRING_MAX 80 +int OSSL_trace_string(BIO *out, int text, int full, + const unsigned char *data, size_t size); +#define OSSL_TRACE_STRING(category, text, full, data, len) \ + OSSL_TRACE_BEGIN(category) \ + { \ + OSSL_trace_string(trc_out, text, full, data, len); \ + } \ + OSSL_TRACE_END(category) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ts.h b/VCMP-LUA/modules/postgresql/include/openssl/ts.h new file mode 100644 index 0000000..edb6ca1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ts.h @@ -0,0 +1,521 @@ +/* + * Copyright 2006-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_TS_H +#define OPENSSL_TS_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_TS_H +#endif + +#include + +#ifndef OPENSSL_NO_TS +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct TS_msg_imprint_st TS_MSG_IMPRINT; +typedef struct TS_req_st TS_REQ; +typedef struct TS_accuracy_st TS_ACCURACY; +typedef struct TS_tst_info_st TS_TST_INFO; + +/* Possible values for status. */ +#define TS_STATUS_GRANTED 0 +#define TS_STATUS_GRANTED_WITH_MODS 1 +#define TS_STATUS_REJECTION 2 +#define TS_STATUS_WAITING 3 +#define TS_STATUS_REVOCATION_WARNING 4 +#define TS_STATUS_REVOCATION_NOTIFICATION 5 + +/* Possible values for failure_info. */ +#define TS_INFO_BAD_ALG 0 +#define TS_INFO_BAD_REQUEST 2 +#define TS_INFO_BAD_DATA_FORMAT 5 +#define TS_INFO_TIME_NOT_AVAILABLE 14 +#define TS_INFO_UNACCEPTED_POLICY 15 +#define TS_INFO_UNACCEPTED_EXTENSION 16 +#define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 +#define TS_INFO_SYSTEM_FAILURE 25 + +typedef struct TS_status_info_st TS_STATUS_INFO; + +typedef struct TS_resp_st TS_RESP; + +DECLARE_ASN1_ALLOC_FUNCTIONS(TS_REQ) +DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_REQ, TS_REQ) +DECLARE_ASN1_DUP_FUNCTION(TS_REQ) + +#ifndef OPENSSL_NO_STDIO +TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); +int i2d_TS_REQ_fp(FILE *fp, const TS_REQ *a); +#endif +TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); +int i2d_TS_REQ_bio(BIO *fp, const TS_REQ *a); + +DECLARE_ASN1_ALLOC_FUNCTIONS(TS_MSG_IMPRINT) +DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_MSG_IMPRINT, TS_MSG_IMPRINT) +DECLARE_ASN1_DUP_FUNCTION(TS_MSG_IMPRINT) + +#ifndef OPENSSL_NO_STDIO +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); +int i2d_TS_MSG_IMPRINT_fp(FILE *fp, const TS_MSG_IMPRINT *a); +#endif +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a); +int i2d_TS_MSG_IMPRINT_bio(BIO *bio, const TS_MSG_IMPRINT *a); + +DECLARE_ASN1_ALLOC_FUNCTIONS(TS_RESP) +DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_RESP, TS_RESP) +DECLARE_ASN1_DUP_FUNCTION(TS_RESP) + +#ifndef OPENSSL_NO_STDIO +TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); +int i2d_TS_RESP_fp(FILE *fp, const TS_RESP *a); +#endif +TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a); +int i2d_TS_RESP_bio(BIO *bio, const TS_RESP *a); + +DECLARE_ASN1_ALLOC_FUNCTIONS(TS_STATUS_INFO) +DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_STATUS_INFO, TS_STATUS_INFO) +DECLARE_ASN1_DUP_FUNCTION(TS_STATUS_INFO) + +DECLARE_ASN1_ALLOC_FUNCTIONS(TS_TST_INFO) +DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_TST_INFO, TS_TST_INFO) +DECLARE_ASN1_DUP_FUNCTION(TS_TST_INFO) +TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); + +#ifndef OPENSSL_NO_STDIO +TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); +int i2d_TS_TST_INFO_fp(FILE *fp, const TS_TST_INFO *a); +#endif +TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a); +int i2d_TS_TST_INFO_bio(BIO *bio, const TS_TST_INFO *a); + +DECLARE_ASN1_ALLOC_FUNCTIONS(TS_ACCURACY) +DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_ACCURACY, TS_ACCURACY) +DECLARE_ASN1_DUP_FUNCTION(TS_ACCURACY) + +int TS_REQ_set_version(TS_REQ *a, long version); +long TS_REQ_get_version(const TS_REQ *a); + +int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i); +const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a); + +const STACK_OF(ASN1_UTF8STRING) * +TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a); + +const ASN1_BIT_STRING * +TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a); + +int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); +TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); + +int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); +X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); + +int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); +ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); + +int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy); +ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); + +int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); +const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); + +int TS_REQ_set_cert_req(TS_REQ *a, int cert_req); +int TS_REQ_get_cert_req(const TS_REQ *a); + +STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); +void TS_REQ_ext_free(TS_REQ *a); +int TS_REQ_get_ext_count(TS_REQ *a); +int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); +int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos); +int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); +X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); +X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); +int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); +void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); + +/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ + +int TS_REQ_print_bio(BIO *bio, TS_REQ *a); + +/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ + +int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); +TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); + +/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ +void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); +PKCS7 *TS_RESP_get_token(TS_RESP *a); +TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); + +int TS_TST_INFO_set_version(TS_TST_INFO *a, long version); +long TS_TST_INFO_get_version(const TS_TST_INFO *a); + +int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); +ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); + +int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); +TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); + +int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); +const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); + +int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); +const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); + +int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); +TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); + +int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); +const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); + +int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); +const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); + +int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); +const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); + +int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); +int TS_TST_INFO_get_ordering(const TS_TST_INFO *a); + +int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); +const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); + +int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); +GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); + +STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); +void TS_TST_INFO_ext_free(TS_TST_INFO *a); +int TS_TST_INFO_get_ext_count(TS_TST_INFO *a); +int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); +int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, + int lastpos); +int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); +X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); +X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); +int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); +void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); + +/* + * Declarations related to response generation, defined in ts/ts_resp_sign.c. + */ + +/* Optional flags for response generation. */ + +/* Don't include the TSA name in response. */ +#define TS_TSA_NAME 0x01 + +/* Set ordering to true in response. */ +#define TS_ORDERING 0x02 + +/* + * Include the signer certificate and the other specified certificates in + * the ESS signing certificate attribute beside the PKCS7 signed data. + * Only the signer certificates is included by default. + */ +#define TS_ESS_CERT_ID_CHAIN 0x04 + +/* Forward declaration. */ +struct TS_resp_ctx; + +/* This must return a unique number less than 160 bits long. */ +typedef ASN1_INTEGER *(*TS_serial_cb)(struct TS_resp_ctx *, void *); + +/* + * This must return the seconds and microseconds since Jan 1, 1970 in the sec + * and usec variables allocated by the caller. Return non-zero for success + * and zero for failure. + */ +typedef int (*TS_time_cb)(struct TS_resp_ctx *, void *, long *sec, + long *usec); + +/* + * This must process the given extension. It can modify the TS_TST_INFO + * object of the context. Return values: !0 (processed), 0 (error, it must + * set the status info/failure info of the response). + */ +typedef int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, + void *); + +typedef struct TS_resp_ctx TS_RESP_CTX; + +/* Creates a response context that can be used for generating responses. */ +TS_RESP_CTX *TS_RESP_CTX_new(void); +TS_RESP_CTX *TS_RESP_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq); +void TS_RESP_CTX_free(TS_RESP_CTX *ctx); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); + +int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx, + const EVP_MD *signer_digest); +int TS_RESP_CTX_set_ess_cert_id_digest(TS_RESP_CTX *ctx, const EVP_MD *md); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy); + +/* No additional certs are included in the response by default. */ +int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); + +/* + * Adds a new acceptable policy, only the default policy is accepted by + * default. + */ +int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy); + +/* + * Adds a new acceptable message digest. Note that no message digests are + * accepted by default. The md argument is shared with the caller. + */ +int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); + +/* Accuracy is not included by default. */ +int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, + int secs, int millis, int micros); + +/* + * Clock precision digits, i.e. the number of decimal digits: '0' means sec, + * '3' msec, '6' usec, and so on. Default is 0. + */ +int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, + unsigned clock_precision_digits); +/* At most we accept usec precision. */ +#define TS_MAX_CLOCK_PRECISION_DIGITS 6 + +/* Maximum status message length */ +#define TS_MAX_STATUS_LENGTH (1024 * 1024) + +/* No flags are set by default. */ +void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); + +/* Default callback always returns a constant. */ +void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); + +/* Default callback uses the gettimeofday() and gmtime() system calls. */ +void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); + +/* + * Default callback rejects all extensions. The extension callback is called + * when the TS_TST_INFO object is already set up and not signed yet. + */ +/* FIXME: extension handling is not tested yet. */ +void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, + TS_extension_cb cb, void *data); + +/* The following methods can be used in the callbacks. */ +int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, + int status, const char *text); + +/* Sets the status info only if it is still TS_STATUS_GRANTED. */ +int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, + int status, const char *text); + +int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); + +/* The get methods below can be used in the extension callback. */ +TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); + +TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); + +/* + * Creates the signed TS_TST_INFO and puts it in TS_RESP. + * In case of errors it sets the status info properly. + * Returns NULL only in case of memory allocation/fatal error. + */ +TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); + +/* + * Declarations related to response verification, + * they are defined in ts/ts_resp_verify.c. + */ + +int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, + X509_STORE *store, X509 **signer_out); + +/* Context structure for the generic verify method. */ + +/* Verify the signer's certificate and the signature of the response. */ +#define TS_VFY_SIGNATURE (1u << 0) +/* Verify the version number of the response. */ +#define TS_VFY_VERSION (1u << 1) +/* Verify if the policy supplied by the user matches the policy of the TSA. */ +#define TS_VFY_POLICY (1u << 2) +/* + * Verify the message imprint provided by the user. This flag should not be + * specified with TS_VFY_DATA. + */ +#define TS_VFY_IMPRINT (1u << 3) +/* + * Verify the message imprint computed by the verify method from the user + * provided data and the MD algorithm of the response. This flag should not + * be specified with TS_VFY_IMPRINT. + */ +#define TS_VFY_DATA (1u << 4) +/* Verify the nonce value. */ +#define TS_VFY_NONCE (1u << 5) +/* Verify if the TSA name field matches the signer certificate. */ +#define TS_VFY_SIGNER (1u << 6) +/* Verify if the TSA name field equals to the user provided name. */ +#define TS_VFY_TSA_NAME (1u << 7) + +/* You can use the following convenience constants. */ +#define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ + | TS_VFY_VERSION \ + | TS_VFY_POLICY \ + | TS_VFY_IMPRINT \ + | TS_VFY_NONCE \ + | TS_VFY_SIGNER \ + | TS_VFY_TSA_NAME) +#define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ + | TS_VFY_VERSION \ + | TS_VFY_POLICY \ + | TS_VFY_DATA \ + | TS_VFY_NONCE \ + | TS_VFY_SIGNER \ + | TS_VFY_TSA_NAME) + +typedef struct TS_verify_ctx TS_VERIFY_CTX; + +int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); +int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); + +/* + * Declarations related to response verification context, + */ +TS_VERIFY_CTX *TS_VERIFY_CTX_new(void); +void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); +void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); +void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); +int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f); +int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f); +#ifndef OPENSSL_NO_DEPRECATED_3_4 +OSSL_DEPRECATEDIN_3_4_FOR("Unclear semantics, replace with TS_VERIFY_CTX_set0_data().") +BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b); +#endif +int TS_VERIFY_CTX_set0_data(TS_VERIFY_CTX *ctx, BIO *b); +#ifndef OPENSSL_NO_DEPRECATED_3_4 +OSSL_DEPRECATEDIN_3_4_FOR("Unclear semantics, replace with TS_VERIFY_CTX_set0_imprint().") +unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, + unsigned char *hexstr, long len); +#endif +int TS_VERIFY_CTX_set0_imprint(TS_VERIFY_CTX *ctx, + unsigned char *hexstr, long len); +#ifndef OPENSSL_NO_DEPRECATED_3_4 +OSSL_DEPRECATEDIN_3_4_FOR("Unclear semantics, replace with TS_VERIFY_CTX_set0_store().") +X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s); +#endif +int TS_VERIFY_CTX_set0_store(TS_VERIFY_CTX *ctx, X509_STORE *s); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define TS_VERIFY_CTS_set_certs(ctx, cert) TS_VERIFY_CTX_set_certs(ctx, cert) +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_4 +OSSL_DEPRECATEDIN_3_4_FOR("Unclear semantics, replace with TS_VERIFY_CTX_set0_certs().") +STACK_OF(X509) *TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs); +#endif +int TS_VERIFY_CTX_set0_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs); + +/*- + * If ctx is NULL, it allocates and returns a new object, otherwise + * it returns ctx. It initialises all the members as follows: + * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) + * certs = NULL + * store = NULL + * policy = policy from the request or NULL if absent (in this case + * TS_VFY_POLICY is cleared from flags as well) + * md_alg = MD algorithm from request + * imprint, imprint_len = imprint from request + * data = NULL + * nonce, nonce_len = nonce from the request or NULL if absent (in this case + * TS_VFY_NONCE is cleared from flags as well) + * tsa_name = NULL + * Important: after calling this method TS_VFY_SIGNATURE should be added! + */ +TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); + +/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ + +int TS_RESP_print_bio(BIO *bio, TS_RESP *a); +int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); +int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); + +/* Common utility functions defined in ts/ts_lib.c */ + +int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); +int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); +int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); +int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); +int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); + +/* + * Function declarations for handling configuration options, defined in + * ts/ts_conf.c + */ + +X509 *TS_CONF_load_cert(const char *file); +STACK_OF(X509) *TS_CONF_load_certs(const char *file); +EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); +const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); +int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, + TS_RESP_CTX *ctx); +#ifndef OPENSSL_NO_ENGINE +int TS_CONF_set_crypto_device(CONF *conf, const char *section, + const char *device); +int TS_CONF_set_default_engine(const char *name); +#endif +int TS_CONF_set_signer_cert(CONF *conf, const char *section, + const char *cert, TS_RESP_CTX *ctx); +int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, + TS_RESP_CTX *ctx); +int TS_CONF_set_signer_key(CONF *conf, const char *section, + const char *key, const char *pass, + TS_RESP_CTX *ctx); +int TS_CONF_set_signer_digest(CONF *conf, const char *section, + const char *md, TS_RESP_CTX *ctx); +int TS_CONF_set_def_policy(CONF *conf, const char *section, + const char *policy, TS_RESP_CTX *ctx); +int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_clock_precision_digits(const CONF *conf, const char *section, + TS_RESP_CTX *ctx); +int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, + TS_RESP_CTX *ctx); +int TS_CONF_set_ess_cert_id_digest(CONF *conf, const char *section, + TS_RESP_CTX *ctx); + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/tserr.h b/VCMP-LUA/modules/postgresql/include/openssl/tserr.h new file mode 100644 index 0000000..0bec94a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/tserr.h @@ -0,0 +1,65 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_TSERR_H +#define OPENSSL_TSERR_H +#pragma once + +#include +#include +#include + +#ifndef OPENSSL_NO_TS + +/* + * TS reason codes. + */ +#define TS_R_BAD_PKCS7_TYPE 132 +#define TS_R_BAD_TYPE 133 +#define TS_R_CANNOT_LOAD_CERT 137 +#define TS_R_CANNOT_LOAD_KEY 138 +#define TS_R_CERTIFICATE_VERIFY_ERROR 100 +#define TS_R_COULD_NOT_SET_ENGINE 127 +#define TS_R_COULD_NOT_SET_TIME 115 +#define TS_R_DETACHED_CONTENT 134 +#define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 +#define TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR 139 +#define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 +#define TS_R_INVALID_NULL_POINTER 102 +#define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 +#define TS_R_MESSAGE_IMPRINT_MISMATCH 103 +#define TS_R_NONCE_MISMATCH 104 +#define TS_R_NONCE_NOT_RETURNED 105 +#define TS_R_NO_CONTENT 106 +#define TS_R_NO_TIME_STAMP_TOKEN 107 +#define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 +#define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 +#define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 +#define TS_R_POLICY_MISMATCH 108 +#define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 +#define TS_R_RESPONSE_SETUP_ERROR 121 +#define TS_R_SIGNATURE_FAILURE 109 +#define TS_R_THERE_MUST_BE_ONE_SIGNER 110 +#define TS_R_TIME_SYSCALL_ERROR 122 +#define TS_R_TOKEN_NOT_PRESENT 130 +#define TS_R_TOKEN_PRESENT 131 +#define TS_R_TSA_NAME_MISMATCH 111 +#define TS_R_TSA_UNTRUSTED 112 +#define TS_R_TST_INFO_SETUP_ERROR 123 +#define TS_R_TS_DATASIGN 124 +#define TS_R_UNACCEPTABLE_POLICY 125 +#define TS_R_UNSUPPORTED_MD_ALGORITHM 126 +#define TS_R_UNSUPPORTED_VERSION 113 +#define TS_R_VAR_BAD_VALUE 135 +#define TS_R_VAR_LOOKUP_FAILURE 136 +#define TS_R_WRONG_CONTENT_TYPE 114 + +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/txt_db.h b/VCMP-LUA/modules/postgresql/include/openssl/txt_db.h new file mode 100644 index 0000000..64e9d4c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/txt_db.h @@ -0,0 +1,63 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_TXT_DB_H +#define OPENSSL_TXT_DB_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_TXT_DB_H +#endif + +#include +#include +#include +#include + +#define DB_ERROR_OK 0 +#define DB_ERROR_MALLOC 1 +#define DB_ERROR_INDEX_CLASH 2 +#define DB_ERROR_INDEX_OUT_OF_RANGE 3 +#define DB_ERROR_NO_INDEX 4 +#define DB_ERROR_INSERT_INDEX_CLASH 5 +#define DB_ERROR_WRONG_NUM_FIELDS 6 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OPENSSL_STRING *OPENSSL_PSTRING; +DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) + +typedef struct txt_db_st { + int num_fields; + STACK_OF(OPENSSL_PSTRING) *data; + LHASH_OF(OPENSSL_STRING) **index; + int (**qual)(OPENSSL_STRING *); + long error; + long arg1; + long arg2; + OPENSSL_STRING *arg_row; +} TXT_DB; + +TXT_DB *TXT_DB_read(BIO *in, int num); +long TXT_DB_write(BIO *out, TXT_DB *db); +int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(OPENSSL_STRING *), + OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); +void TXT_DB_free(TXT_DB *db); +OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, + OPENSSL_STRING *value); +int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/types.h b/VCMP-LUA/modules/postgresql/include/openssl/types.h new file mode 100644 index 0000000..f9c4373 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/types.h @@ -0,0 +1,250 @@ +/* + * Copyright 2001-2026 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * Unfortunate workaround to avoid symbol conflict with wincrypt.h + * See https://github.com/openssl/openssl/issues/9981 + */ +#ifdef _WIN32 +#define WINCRYPT_USE_SYMBOL_PREFIX +#undef X509_NAME +#undef X509_EXTENSIONS +#undef PKCS7_SIGNER_INFO +#undef OCSP_REQUEST +#undef OCSP_RESPONSE +#endif + +#ifndef OPENSSL_TYPES_H +#define OPENSSL_TYPES_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#if OPENSSL_VERSION_MAJOR >= 4 +#define OSSL_FUTURE_CONST const +#else +#define OSSL_FUTURE_CONST +#endif + +typedef struct ossl_provider_st OSSL_PROVIDER; /* Provider Object */ + +#ifdef NO_ASN1_TYPEDEFS +#define ASN1_INTEGER ASN1_STRING +#define ASN1_ENUMERATED ASN1_STRING +#define ASN1_BIT_STRING ASN1_STRING +#define ASN1_OCTET_STRING ASN1_STRING +#define ASN1_PRINTABLESTRING ASN1_STRING +#define ASN1_T61STRING ASN1_STRING +#define ASN1_IA5STRING ASN1_STRING +#define ASN1_UTCTIME ASN1_STRING +#define ASN1_GENERALIZEDTIME ASN1_STRING +#define ASN1_TIME ASN1_STRING +#define ASN1_GENERALSTRING ASN1_STRING +#define ASN1_UNIVERSALSTRING ASN1_STRING +#define ASN1_BMPSTRING ASN1_STRING +#define ASN1_VISIBLESTRING ASN1_STRING +#define ASN1_UTF8STRING ASN1_STRING +#define ASN1_BOOLEAN int +#define ASN1_NULL int +#else +typedef struct asn1_string_st ASN1_INTEGER; +typedef struct asn1_string_st ASN1_ENUMERATED; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct asn1_string_st ASN1_OCTET_STRING; +typedef struct asn1_string_st ASN1_PRINTABLESTRING; +typedef struct asn1_string_st ASN1_T61STRING; +typedef struct asn1_string_st ASN1_IA5STRING; +typedef struct asn1_string_st ASN1_GENERALSTRING; +typedef struct asn1_string_st ASN1_UNIVERSALSTRING; +typedef struct asn1_string_st ASN1_BMPSTRING; +typedef struct asn1_string_st ASN1_UTCTIME; +typedef struct asn1_string_st ASN1_TIME; +typedef struct asn1_string_st ASN1_GENERALIZEDTIME; +typedef struct asn1_string_st ASN1_VISIBLESTRING; +typedef struct asn1_string_st ASN1_UTF8STRING; +typedef struct asn1_string_st ASN1_STRING; +typedef int ASN1_BOOLEAN; +typedef int ASN1_NULL; +#endif + +typedef struct asn1_type_st ASN1_TYPE; +typedef struct asn1_object_st ASN1_OBJECT; +typedef struct asn1_string_table_st ASN1_STRING_TABLE; + +typedef struct ASN1_ITEM_st ASN1_ITEM; +typedef struct asn1_pctx_st ASN1_PCTX; +typedef struct asn1_sctx_st ASN1_SCTX; + +#ifdef BIGNUM +#undef BIGNUM +#endif + +typedef struct bio_st BIO; +typedef struct bignum_st BIGNUM; +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; + +typedef struct buf_mem_st BUF_MEM; + +STACK_OF(BIGNUM); +STACK_OF(BIGNUM_const); + +typedef struct err_state_st ERR_STATE; + +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; +typedef struct evp_md_st EVP_MD; +typedef struct evp_md_ctx_st EVP_MD_CTX; +typedef struct evp_mac_st EVP_MAC; +typedef struct evp_mac_ctx_st EVP_MAC_CTX; +typedef struct evp_pkey_st EVP_PKEY; +typedef struct evp_skey_st EVP_SKEY; + +typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; + +typedef struct evp_pkey_method_st EVP_PKEY_METHOD; +typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; + +typedef struct evp_keymgmt_st EVP_KEYMGMT; + +typedef struct evp_kdf_st EVP_KDF; +typedef struct evp_kdf_ctx_st EVP_KDF_CTX; + +typedef struct evp_rand_st EVP_RAND; +typedef struct evp_rand_ctx_st EVP_RAND_CTX; + +typedef struct evp_keyexch_st EVP_KEYEXCH; + +typedef struct evp_signature_st EVP_SIGNATURE; + +typedef struct evp_skeymgmt_st EVP_SKEYMGMT; + +typedef struct evp_asym_cipher_st EVP_ASYM_CIPHER; + +typedef struct evp_kem_st EVP_KEM; + +typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; + +typedef struct hmac_ctx_st HMAC_CTX; + +typedef struct dh_st DH; +typedef struct dh_method DH_METHOD; + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +typedef struct dsa_st DSA; +typedef struct dsa_method DSA_METHOD; +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +typedef struct rsa_st RSA; +typedef struct rsa_meth_st RSA_METHOD; +#endif + +typedef struct rsa_pss_params_st RSA_PSS_PARAMS; +typedef struct rsa_oaep_params_st RSA_OAEP_PARAMS; + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +typedef struct ec_key_st EC_KEY; +typedef struct ec_key_method_st EC_KEY_METHOD; +#endif + +typedef struct rand_meth_st RAND_METHOD; +typedef struct rand_drbg_st RAND_DRBG; + +typedef struct ssl_dane_st SSL_DANE; +typedef struct x509_st X509; +typedef struct X509_algor_st X509_ALGOR; +typedef struct X509_crl_st X509_CRL; +typedef struct x509_crl_method_st X509_CRL_METHOD; +typedef struct x509_revoked_st X509_REVOKED; +typedef struct X509_name_st X509_NAME; +typedef struct X509_pubkey_st X509_PUBKEY; +typedef struct x509_store_st X509_STORE; +typedef struct x509_store_ctx_st X509_STORE_CTX; + +typedef struct x509_object_st X509_OBJECT; +typedef struct x509_lookup_st X509_LOOKUP; +typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; +typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; + +typedef struct x509_sig_info_st X509_SIG_INFO; + +typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; + +typedef struct v3_ext_ctx X509V3_CTX; +typedef struct conf_st CONF; +typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS; + +typedef struct ui_st UI; +typedef struct ui_method_st UI_METHOD; + +typedef struct engine_st ENGINE; +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; + +typedef struct comp_ctx_st COMP_CTX; +typedef struct comp_method_st COMP_METHOD; + +typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; +typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; +typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; +typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; + +typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; +typedef struct DIST_POINT_st DIST_POINT; +typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; +typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; + +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; + +typedef struct ossl_http_req_ctx_st OSSL_HTTP_REQ_CTX; +typedef struct ocsp_response_st OCSP_RESPONSE; +typedef struct ocsp_responder_id_st OCSP_RESPID; + +typedef struct sct_st SCT; +typedef struct sct_ctx_st SCT_CTX; +typedef struct ctlog_st CTLOG; +typedef struct ctlog_store_st CTLOG_STORE; +typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX; + +typedef struct ossl_store_info_st OSSL_STORE_INFO; +typedef struct ossl_store_search_st OSSL_STORE_SEARCH; + +typedef struct ossl_lib_ctx_st OSSL_LIB_CTX; + +typedef struct ossl_dispatch_st OSSL_DISPATCH; +typedef struct ossl_item_st OSSL_ITEM; +typedef struct ossl_algorithm_st OSSL_ALGORITHM; +typedef struct ossl_param_st OSSL_PARAM; +typedef struct ossl_param_bld_st OSSL_PARAM_BLD; + +typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); + +typedef struct ossl_encoder_st OSSL_ENCODER; +typedef struct ossl_encoder_ctx_st OSSL_ENCODER_CTX; +typedef struct ossl_decoder_st OSSL_DECODER; +typedef struct ossl_decoder_ctx_st OSSL_DECODER_CTX; + +typedef struct ossl_self_test_st OSSL_SELF_TEST; + +#ifdef __cplusplus +} +#endif + +#endif /* OPENSSL_TYPES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/openssl/ui.h b/VCMP-LUA/modules/postgresql/include/openssl/ui.h new file mode 100644 index 0000000..be95885 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/ui.h @@ -0,0 +1,409 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\ui.h.in + * + * Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_UI_H +#define OPENSSL_UI_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_UI_H +#endif + +#include + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#include +#endif +#include +#include +#include +#include + +/* For compatibility reasons, the macro OPENSSL_NO_UI is currently retained */ +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifdef OPENSSL_NO_UI_CONSOLE +#define OPENSSL_NO_UI +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * All the following functions return -1 or NULL on error and in some cases + * (UI_process()) -2 if interrupted or in some other way cancelled. When + * everything is fine, they return 0, a positive value or a non-NULL pointer, + * all depending on their purpose. + */ + +/* Creators and destructor. */ +UI *UI_new(void); +UI *UI_new_method(const UI_METHOD *method); +void UI_free(UI *ui); + +/*- + The following functions are used to add strings to be printed and prompt + strings to prompt for data. The names are UI_{add,dup}__string + and UI_{add,dup}_input_boolean. + + UI_{add,dup}__string have the following meanings: + add add a text or prompt string. The pointers given to these + functions are used verbatim, no copying is done. + dup make a copy of the text or prompt string, then add the copy + to the collection of strings in the user interface. + + The function is a name for the functionality that the given + string shall be used for. It can be one of: + input use the string as data prompt. + verify use the string as verification prompt. This + is used to verify a previous input. + info use the string for informational output. + error use the string for error output. + Honestly, there's currently no difference between info and error for the + moment. + + UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", + and are typically used when one wants to prompt for a yes/no response. + + All of the functions in this group take a UI and a prompt string. + The string input and verify addition functions also take a flag argument, + a buffer for the result to end up with, a minimum input size and a maximum + input size (the result buffer MUST be large enough to be able to contain + the maximum number of characters). Additionally, the verify addition + functions takes another buffer to compare the result against. + The boolean input functions take an action description string (which should + be safe to ignore if the expected user action is obvious, for example with + a dialog box with an OK button and a Cancel button), a string of acceptable + characters to mean OK and to mean Cancel. The two last strings are checked + to make sure they don't have common characters. Additionally, the same + flag argument as for the string input is taken, as well as a result buffer. + The result buffer is required to be at least one byte long. Depending on + the answer, the first character from the OK or the Cancel character strings + will be stored in the first byte of the result buffer. No NUL will be + added, so the result is *not* a string. + + On success, the all return an index of the added information. That index + is useful when retrieving results with UI_get0_result(). */ +int UI_add_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_dup_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_add_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, + const char *test_buf); +int UI_dup_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, + const char *test_buf); +int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_add_info_string(UI *ui, const char *text); +int UI_dup_info_string(UI *ui, const char *text); +int UI_add_error_string(UI *ui, const char *text); +int UI_dup_error_string(UI *ui, const char *text); + +/* These are the possible flags. They can be or'ed together. */ +/* Use to have echoing of input */ +#define UI_INPUT_FLAG_ECHO 0x01 +/* + * Use a default password. Where that password is found is completely up to + * the application, it might for example be in the user data set with + * UI_add_user_data(). It is not recommended to have more than one input in + * each UI being marked with this flag, or the application might get + * confused. + */ +#define UI_INPUT_FLAG_DEFAULT_PWD 0x02 + +/*- + * The user of these routines may want to define flags of their own. The core + * UI won't look at those, but will pass them on to the method routines. They + * must use higher bits so they don't get confused with the UI bits above. + * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good + * example of use is this: + * + * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) + * + */ +#define UI_INPUT_FLAG_USER_BASE 16 + +/*- + * The following function helps construct a prompt. + * phrase_desc is a textual short description of the phrase to enter, + * for example "pass phrase", and + * object_name is the name of the object + * (which might be a card name or a file name) or NULL. + * The returned string shall always be allocated on the heap with + * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). + * + * If the ui_method doesn't contain a pointer to a user-defined prompt + * constructor, a default string is built, looking like this: + * + * "Enter {phrase_desc} for {object_name}:" + * + * So, if phrase_desc has the value "pass phrase" and object_name has + * the value "foo.key", the resulting string is: + * + * "Enter pass phrase for foo.key:" + */ +char *UI_construct_prompt(UI *ui_method, + const char *phrase_desc, const char *object_name); + +/* + * The following function is used to store a pointer to user-specific data. + * Any previous such pointer will be returned and replaced. + * + * For callback purposes, this function makes a lot more sense than using + * ex_data, since the latter requires that different parts of OpenSSL or + * applications share the same ex_data index. + * + * Note that the UI_OpenSSL() method completely ignores the user data. Other + * methods may not, however. + */ +void *UI_add_user_data(UI *ui, void *user_data); +/* + * Alternatively, this function is used to duplicate the user data. + * This uses the duplicator method function. The destroy function will + * be used to free the user data in this case. + */ +int UI_dup_user_data(UI *ui, void *user_data); +/* We need a user data retrieving function as well. */ +void *UI_get0_user_data(UI *ui); + +/* Return the result associated with a prompt given with the index i. */ +const char *UI_get0_result(UI *ui, int i); +int UI_get_result_length(UI *ui, int i); + +/* When all strings have been added, process the whole thing. */ +int UI_process(UI *ui); + +/* + * Give a user interface parameterised control commands. This can be used to + * send down an integer, a data pointer or a function pointer, as well as be + * used to get information from a UI. + */ +int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void)); + +/* The commands */ +/* + * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the + * OpenSSL error stack before printing any info or added error messages and + * before any prompting. + */ +#define UI_CTRL_PRINT_ERRORS 1 +/* + * Check if a UI_process() is possible to do again with the same instance of + * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 + * if not. + */ +#define UI_CTRL_IS_REDOABLE 2 + +/* Some methods may use extra data */ +#define UI_set_app_data(s, arg) UI_set_ex_data(s, 0, arg) +#define UI_get_app_data(s) UI_get_ex_data(s, 0) + +#define UI_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef) +int UI_set_ex_data(UI *r, int idx, void *arg); +void *UI_get_ex_data(const UI *r, int idx); + +/* Use specific methods instead of the built-in one */ +void UI_set_default_method(const UI_METHOD *meth); +const UI_METHOD *UI_get_default_method(void); +const UI_METHOD *UI_get_method(UI *ui); +const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); + +#ifndef OPENSSL_NO_UI_CONSOLE + +/* The method with all the built-in thingies */ +UI_METHOD *UI_OpenSSL(void); + +#endif + +/* + * NULL method. Literally does nothing, but may serve as a placeholder + * to avoid internal default. + */ +const UI_METHOD *UI_null(void); + +/* ---------- For method writers ---------- */ +/*- + A method contains a number of functions that implement the low level + of the User Interface. The functions are: + + an opener This function starts a session, maybe by opening + a channel to a tty, or by opening a window. + a writer This function is called to write a given string, + maybe to the tty, maybe as a field label in a + window. + a flusher This function is called to flush everything that + has been output so far. It can be used to actually + display a dialog box after it has been built. + a reader This function is called to read a given prompt, + maybe from the tty, maybe from a field in a + window. Note that it's called with all string + structures, not only the prompt ones, so it must + check such things itself. + a closer This function closes the session, maybe by closing + the channel to the tty, or closing the window. + + All these functions are expected to return: + + 0 on error. + 1 on success. + -1 on out-of-band events, for example if some prompting has + been canceled (by pressing Ctrl-C, for example). This is + only checked when returned by the flusher or the reader. + + The way this is used, the opener is first called, then the writer for all + strings, then the flusher, then the reader for all strings and finally the + closer. Note that if you want to prompt from a terminal or other command + line interface, the best is to have the reader also write the prompts + instead of having the writer do it. If you want to prompt from a dialog + box, the writer can be used to build up the contents of the box, and the + flusher to actually display the box and run the event loop until all data + has been given, after which the reader only grabs the given data and puts + them back into the UI strings. + + All method functions take a UI as argument. Additionally, the writer and + the reader take a UI_STRING. +*/ + +/* + * The UI_STRING type is the data structure that contains all the needed info + * about a string or a prompt, including test data for a verification prompt. + */ +typedef struct ui_string_st UI_STRING; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(UI_STRING, UI_STRING, UI_STRING) +#define sk_UI_STRING_num(sk) OPENSSL_sk_num(ossl_check_const_UI_STRING_sk_type(sk)) +#define sk_UI_STRING_value(sk, idx) ((UI_STRING *)OPENSSL_sk_value(ossl_check_const_UI_STRING_sk_type(sk), (idx))) +#define sk_UI_STRING_new(cmp) ((STACK_OF(UI_STRING) *)OPENSSL_sk_new(ossl_check_UI_STRING_compfunc_type(cmp))) +#define sk_UI_STRING_new_null() ((STACK_OF(UI_STRING) *)OPENSSL_sk_new_null()) +#define sk_UI_STRING_new_reserve(cmp, n) ((STACK_OF(UI_STRING) *)OPENSSL_sk_new_reserve(ossl_check_UI_STRING_compfunc_type(cmp), (n))) +#define sk_UI_STRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_UI_STRING_sk_type(sk), (n)) +#define sk_UI_STRING_free(sk) OPENSSL_sk_free(ossl_check_UI_STRING_sk_type(sk)) +#define sk_UI_STRING_zero(sk) OPENSSL_sk_zero(ossl_check_UI_STRING_sk_type(sk)) +#define sk_UI_STRING_delete(sk, i) ((UI_STRING *)OPENSSL_sk_delete(ossl_check_UI_STRING_sk_type(sk), (i))) +#define sk_UI_STRING_delete_ptr(sk, ptr) ((UI_STRING *)OPENSSL_sk_delete_ptr(ossl_check_UI_STRING_sk_type(sk), ossl_check_UI_STRING_type(ptr))) +#define sk_UI_STRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_UI_STRING_sk_type(sk), ossl_check_UI_STRING_type(ptr)) +#define sk_UI_STRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_UI_STRING_sk_type(sk), ossl_check_UI_STRING_type(ptr)) +#define sk_UI_STRING_pop(sk) ((UI_STRING *)OPENSSL_sk_pop(ossl_check_UI_STRING_sk_type(sk))) +#define sk_UI_STRING_shift(sk) ((UI_STRING *)OPENSSL_sk_shift(ossl_check_UI_STRING_sk_type(sk))) +#define sk_UI_STRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_UI_STRING_sk_type(sk), ossl_check_UI_STRING_freefunc_type(freefunc)) +#define sk_UI_STRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_UI_STRING_sk_type(sk), ossl_check_UI_STRING_type(ptr), (idx)) +#define sk_UI_STRING_set(sk, idx, ptr) ((UI_STRING *)OPENSSL_sk_set(ossl_check_UI_STRING_sk_type(sk), (idx), ossl_check_UI_STRING_type(ptr))) +#define sk_UI_STRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_UI_STRING_sk_type(sk), ossl_check_UI_STRING_type(ptr)) +#define sk_UI_STRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_UI_STRING_sk_type(sk), ossl_check_UI_STRING_type(ptr)) +#define sk_UI_STRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_UI_STRING_sk_type(sk), ossl_check_UI_STRING_type(ptr), pnum) +#define sk_UI_STRING_sort(sk) OPENSSL_sk_sort(ossl_check_UI_STRING_sk_type(sk)) +#define sk_UI_STRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_UI_STRING_sk_type(sk)) +#define sk_UI_STRING_dup(sk) ((STACK_OF(UI_STRING) *)OPENSSL_sk_dup(ossl_check_const_UI_STRING_sk_type(sk))) +#define sk_UI_STRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(UI_STRING) *)OPENSSL_sk_deep_copy(ossl_check_const_UI_STRING_sk_type(sk), ossl_check_UI_STRING_copyfunc_type(copyfunc), ossl_check_UI_STRING_freefunc_type(freefunc))) +#define sk_UI_STRING_set_cmp_func(sk, cmp) ((sk_UI_STRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_UI_STRING_sk_type(sk), ossl_check_UI_STRING_compfunc_type(cmp))) + +/* clang-format on */ + +/* + * The different types of strings that are currently supported. This is only + * needed by method authors. + */ +enum UI_string_types { + UIT_NONE = 0, + UIT_PROMPT, /* Prompt for a string */ + UIT_VERIFY, /* Prompt for a string and verify */ + UIT_BOOLEAN, /* Prompt for a yes/no response */ + UIT_INFO, /* Send info to the user */ + UIT_ERROR /* Send an error message to the user */ +}; + +/* Create and manipulate methods */ +UI_METHOD *UI_create_method(const char *name); +void UI_destroy_method(UI_METHOD *ui_method); +int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui)); +int UI_method_set_writer(UI_METHOD *method, + int (*writer)(UI *ui, UI_STRING *uis)); +int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui)); +int UI_method_set_reader(UI_METHOD *method, + int (*reader)(UI *ui, UI_STRING *uis)); +int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)); +int UI_method_set_data_duplicator(UI_METHOD *method, + void *(*duplicator)(UI *ui, void *ui_data), + void (*destructor)(UI *ui, void *ui_data)); +int UI_method_set_prompt_constructor(UI_METHOD *method, + char *(*prompt_constructor)(UI *ui, + const char + *phrase_desc, + const char + *object_name)); +int UI_method_set_ex_data(UI_METHOD *method, int idx, void *data); +int (*UI_method_get_opener(const UI_METHOD *method))(UI *); +int (*UI_method_get_writer(const UI_METHOD *method))(UI *, UI_STRING *); +int (*UI_method_get_flusher(const UI_METHOD *method))(UI *); +int (*UI_method_get_reader(const UI_METHOD *method))(UI *, UI_STRING *); +int (*UI_method_get_closer(const UI_METHOD *method))(UI *); +char *(*UI_method_get_prompt_constructor(const UI_METHOD *method))(UI *, const char *, const char *); +void *(*UI_method_get_data_duplicator(const UI_METHOD *method))(UI *, void *); +void (*UI_method_get_data_destructor(const UI_METHOD *method))(UI *, void *); +const void *UI_method_get_ex_data(const UI_METHOD *method, int idx); + +/* + * The following functions are helpers for method writers to access relevant + * data from a UI_STRING. + */ + +/* Return type of the UI_STRING */ +enum UI_string_types UI_get_string_type(UI_STRING *uis); +/* Return input flags of the UI_STRING */ +int UI_get_input_flags(UI_STRING *uis); +/* Return the actual string to output (the prompt, info or error) */ +const char *UI_get0_output_string(UI_STRING *uis); +/* + * Return the optional action string to output (the boolean prompt + * instruction) + */ +const char *UI_get0_action_string(UI_STRING *uis); +/* Return the result of a prompt */ +const char *UI_get0_result_string(UI_STRING *uis); +int UI_get_result_string_length(UI_STRING *uis); +/* + * Return the string to test the result against. Only useful with verifies. + */ +const char *UI_get0_test_string(UI_STRING *uis); +/* Return the required minimum size of the result */ +int UI_get_result_minsize(UI_STRING *uis); +/* Return the required maximum size of the result */ +int UI_get_result_maxsize(UI_STRING *uis); +/* Set the result of a UI_STRING. */ +int UI_set_result(UI *ui, UI_STRING *uis, const char *result); +int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len); + +/* A couple of popular utility functions */ +int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, + int verify); +int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, + int verify); +UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/uierr.h b/VCMP-LUA/modules/postgresql/include/openssl/uierr.h new file mode 100644 index 0000000..5201b03 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/uierr.h @@ -0,0 +1,36 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_UIERR_H +#define OPENSSL_UIERR_H +#pragma once + +#include +#include +#include + +/* + * UI reason codes. + */ +#define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 +#define UI_R_INDEX_TOO_LARGE 102 +#define UI_R_INDEX_TOO_SMALL 103 +#define UI_R_NO_RESULT_BUFFER 105 +#define UI_R_PROCESSING_ERROR 107 +#define UI_R_RESULT_TOO_LARGE 100 +#define UI_R_RESULT_TOO_SMALL 101 +#define UI_R_SYSASSIGN_ERROR 109 +#define UI_R_SYSDASSGN_ERROR 110 +#define UI_R_SYSQIOW_ERROR 111 +#define UI_R_UNKNOWN_CONTROL_COMMAND 106 +#define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 +#define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/whrlpool.h b/VCMP-LUA/modules/postgresql/include/openssl/whrlpool.h new file mode 100644 index 0000000..cff9134 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/whrlpool.h @@ -0,0 +1,62 @@ +/* + * Copyright 2005-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_WHRLPOOL_H +#define OPENSSL_WHRLPOOL_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_WHRLPOOL_H +#endif + +#include + +#ifndef OPENSSL_NO_WHIRLPOOL +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define WHIRLPOOL_DIGEST_LENGTH (512 / 8) + +#if !defined(OPENSSL_NO_DEPRECATED_3_0) + +#define WHIRLPOOL_BBLOCK 512 +#define WHIRLPOOL_COUNTER (256 / 8) + +typedef struct { + union { + unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; + /* double q is here to ensure 64-bit alignment */ + double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; + } H; + unsigned char data[WHIRLPOOL_BBLOCK / 8]; + unsigned int bitoff; + size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; +} WHIRLPOOL_CTX; +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); +OSSL_DEPRECATEDIN_3_0 int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, + const void *inp, size_t bytes); +OSSL_DEPRECATEDIN_3_0 void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, + const void *inp, size_t bits); +OSSL_DEPRECATEDIN_3_0 int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); +OSSL_DEPRECATEDIN_3_0 unsigned char *WHIRLPOOL(const void *inp, size_t bytes, + unsigned char *md); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/x509.h b/VCMP-LUA/modules/postgresql/include/openssl/x509.h new file mode 100644 index 0000000..69ff983 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/x509.h @@ -0,0 +1,1302 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\x509.h.in + * + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_X509_H +#define OPENSSL_X509_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_X509_H +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#include +#include +#include +#endif + +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Needed stacks for types defined in other headers */ +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_NAME, X509_NAME, X509_NAME) +#define sk_X509_NAME_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_sk_type(sk)) +#define sk_X509_NAME_value(sk, idx) ((X509_NAME *)OPENSSL_sk_value(ossl_check_const_X509_NAME_sk_type(sk), (idx))) +#define sk_X509_NAME_new(cmp) ((STACK_OF(X509_NAME) *)OPENSSL_sk_new(ossl_check_X509_NAME_compfunc_type(cmp))) +#define sk_X509_NAME_new_null() ((STACK_OF(X509_NAME) *)OPENSSL_sk_new_null()) +#define sk_X509_NAME_new_reserve(cmp, n) ((STACK_OF(X509_NAME) *)OPENSSL_sk_new_reserve(ossl_check_X509_NAME_compfunc_type(cmp), (n))) +#define sk_X509_NAME_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_NAME_sk_type(sk), (n)) +#define sk_X509_NAME_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_sk_type(sk)) +#define sk_X509_NAME_zero(sk) OPENSSL_sk_zero(ossl_check_X509_NAME_sk_type(sk)) +#define sk_X509_NAME_delete(sk, i) ((X509_NAME *)OPENSSL_sk_delete(ossl_check_X509_NAME_sk_type(sk), (i))) +#define sk_X509_NAME_delete_ptr(sk, ptr) ((X509_NAME *)OPENSSL_sk_delete_ptr(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))) +#define sk_X509_NAME_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)) +#define sk_X509_NAME_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)) +#define sk_X509_NAME_pop(sk) ((X509_NAME *)OPENSSL_sk_pop(ossl_check_X509_NAME_sk_type(sk))) +#define sk_X509_NAME_shift(sk) ((X509_NAME *)OPENSSL_sk_shift(ossl_check_X509_NAME_sk_type(sk))) +#define sk_X509_NAME_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_freefunc_type(freefunc)) +#define sk_X509_NAME_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr), (idx)) +#define sk_X509_NAME_set(sk, idx, ptr) ((X509_NAME *)OPENSSL_sk_set(ossl_check_X509_NAME_sk_type(sk), (idx), ossl_check_X509_NAME_type(ptr))) +#define sk_X509_NAME_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)) +#define sk_X509_NAME_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)) +#define sk_X509_NAME_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr), pnum) +#define sk_X509_NAME_sort(sk) OPENSSL_sk_sort(ossl_check_X509_NAME_sk_type(sk)) +#define sk_X509_NAME_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_NAME_sk_type(sk)) +#define sk_X509_NAME_dup(sk) ((STACK_OF(X509_NAME) *)OPENSSL_sk_dup(ossl_check_const_X509_NAME_sk_type(sk))) +#define sk_X509_NAME_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_NAME) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_NAME_sk_type(sk), ossl_check_X509_NAME_copyfunc_type(copyfunc), ossl_check_X509_NAME_freefunc_type(freefunc))) +#define sk_X509_NAME_set_cmp_func(sk, cmp) ((sk_X509_NAME_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(X509, X509, X509) +#define sk_X509_num(sk) OPENSSL_sk_num(ossl_check_const_X509_sk_type(sk)) +#define sk_X509_value(sk, idx) ((X509 *)OPENSSL_sk_value(ossl_check_const_X509_sk_type(sk), (idx))) +#define sk_X509_new(cmp) ((STACK_OF(X509) *)OPENSSL_sk_new(ossl_check_X509_compfunc_type(cmp))) +#define sk_X509_new_null() ((STACK_OF(X509) *)OPENSSL_sk_new_null()) +#define sk_X509_new_reserve(cmp, n) ((STACK_OF(X509) *)OPENSSL_sk_new_reserve(ossl_check_X509_compfunc_type(cmp), (n))) +#define sk_X509_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_sk_type(sk), (n)) +#define sk_X509_free(sk) OPENSSL_sk_free(ossl_check_X509_sk_type(sk)) +#define sk_X509_zero(sk) OPENSSL_sk_zero(ossl_check_X509_sk_type(sk)) +#define sk_X509_delete(sk, i) ((X509 *)OPENSSL_sk_delete(ossl_check_X509_sk_type(sk), (i))) +#define sk_X509_delete_ptr(sk, ptr) ((X509 *)OPENSSL_sk_delete_ptr(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))) +#define sk_X509_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)) +#define sk_X509_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)) +#define sk_X509_pop(sk) ((X509 *)OPENSSL_sk_pop(ossl_check_X509_sk_type(sk))) +#define sk_X509_shift(sk) ((X509 *)OPENSSL_sk_shift(ossl_check_X509_sk_type(sk))) +#define sk_X509_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_sk_type(sk), ossl_check_X509_freefunc_type(freefunc)) +#define sk_X509_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr), (idx)) +#define sk_X509_set(sk, idx, ptr) ((X509 *)OPENSSL_sk_set(ossl_check_X509_sk_type(sk), (idx), ossl_check_X509_type(ptr))) +#define sk_X509_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)) +#define sk_X509_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)) +#define sk_X509_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr), pnum) +#define sk_X509_sort(sk) OPENSSL_sk_sort(ossl_check_X509_sk_type(sk)) +#define sk_X509_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_sk_type(sk)) +#define sk_X509_dup(sk) ((STACK_OF(X509) *)OPENSSL_sk_dup(ossl_check_const_X509_sk_type(sk))) +#define sk_X509_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_sk_type(sk), ossl_check_X509_copyfunc_type(copyfunc), ossl_check_X509_freefunc_type(freefunc))) +#define sk_X509_set_cmp_func(sk, cmp) ((sk_X509_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_sk_type(sk), ossl_check_X509_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(X509_REVOKED, X509_REVOKED, X509_REVOKED) +#define sk_X509_REVOKED_num(sk) OPENSSL_sk_num(ossl_check_const_X509_REVOKED_sk_type(sk)) +#define sk_X509_REVOKED_value(sk, idx) ((X509_REVOKED *)OPENSSL_sk_value(ossl_check_const_X509_REVOKED_sk_type(sk), (idx))) +#define sk_X509_REVOKED_new(cmp) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_new(ossl_check_X509_REVOKED_compfunc_type(cmp))) +#define sk_X509_REVOKED_new_null() ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_new_null()) +#define sk_X509_REVOKED_new_reserve(cmp, n) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_new_reserve(ossl_check_X509_REVOKED_compfunc_type(cmp), (n))) +#define sk_X509_REVOKED_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_REVOKED_sk_type(sk), (n)) +#define sk_X509_REVOKED_free(sk) OPENSSL_sk_free(ossl_check_X509_REVOKED_sk_type(sk)) +#define sk_X509_REVOKED_zero(sk) OPENSSL_sk_zero(ossl_check_X509_REVOKED_sk_type(sk)) +#define sk_X509_REVOKED_delete(sk, i) ((X509_REVOKED *)OPENSSL_sk_delete(ossl_check_X509_REVOKED_sk_type(sk), (i))) +#define sk_X509_REVOKED_delete_ptr(sk, ptr) ((X509_REVOKED *)OPENSSL_sk_delete_ptr(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))) +#define sk_X509_REVOKED_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)) +#define sk_X509_REVOKED_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)) +#define sk_X509_REVOKED_pop(sk) ((X509_REVOKED *)OPENSSL_sk_pop(ossl_check_X509_REVOKED_sk_type(sk))) +#define sk_X509_REVOKED_shift(sk) ((X509_REVOKED *)OPENSSL_sk_shift(ossl_check_X509_REVOKED_sk_type(sk))) +#define sk_X509_REVOKED_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_freefunc_type(freefunc)) +#define sk_X509_REVOKED_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr), (idx)) +#define sk_X509_REVOKED_set(sk, idx, ptr) ((X509_REVOKED *)OPENSSL_sk_set(ossl_check_X509_REVOKED_sk_type(sk), (idx), ossl_check_X509_REVOKED_type(ptr))) +#define sk_X509_REVOKED_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)) +#define sk_X509_REVOKED_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)) +#define sk_X509_REVOKED_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr), pnum) +#define sk_X509_REVOKED_sort(sk) OPENSSL_sk_sort(ossl_check_X509_REVOKED_sk_type(sk)) +#define sk_X509_REVOKED_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_REVOKED_sk_type(sk)) +#define sk_X509_REVOKED_dup(sk) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_dup(ossl_check_const_X509_REVOKED_sk_type(sk))) +#define sk_X509_REVOKED_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_copyfunc_type(copyfunc), ossl_check_X509_REVOKED_freefunc_type(freefunc))) +#define sk_X509_REVOKED_set_cmp_func(sk, cmp) ((sk_X509_REVOKED_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(X509_CRL, X509_CRL, X509_CRL) +#define sk_X509_CRL_num(sk) OPENSSL_sk_num(ossl_check_const_X509_CRL_sk_type(sk)) +#define sk_X509_CRL_value(sk, idx) ((X509_CRL *)OPENSSL_sk_value(ossl_check_const_X509_CRL_sk_type(sk), (idx))) +#define sk_X509_CRL_new(cmp) ((STACK_OF(X509_CRL) *)OPENSSL_sk_new(ossl_check_X509_CRL_compfunc_type(cmp))) +#define sk_X509_CRL_new_null() ((STACK_OF(X509_CRL) *)OPENSSL_sk_new_null()) +#define sk_X509_CRL_new_reserve(cmp, n) ((STACK_OF(X509_CRL) *)OPENSSL_sk_new_reserve(ossl_check_X509_CRL_compfunc_type(cmp), (n))) +#define sk_X509_CRL_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_CRL_sk_type(sk), (n)) +#define sk_X509_CRL_free(sk) OPENSSL_sk_free(ossl_check_X509_CRL_sk_type(sk)) +#define sk_X509_CRL_zero(sk) OPENSSL_sk_zero(ossl_check_X509_CRL_sk_type(sk)) +#define sk_X509_CRL_delete(sk, i) ((X509_CRL *)OPENSSL_sk_delete(ossl_check_X509_CRL_sk_type(sk), (i))) +#define sk_X509_CRL_delete_ptr(sk, ptr) ((X509_CRL *)OPENSSL_sk_delete_ptr(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))) +#define sk_X509_CRL_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)) +#define sk_X509_CRL_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)) +#define sk_X509_CRL_pop(sk) ((X509_CRL *)OPENSSL_sk_pop(ossl_check_X509_CRL_sk_type(sk))) +#define sk_X509_CRL_shift(sk) ((X509_CRL *)OPENSSL_sk_shift(ossl_check_X509_CRL_sk_type(sk))) +#define sk_X509_CRL_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_freefunc_type(freefunc)) +#define sk_X509_CRL_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr), (idx)) +#define sk_X509_CRL_set(sk, idx, ptr) ((X509_CRL *)OPENSSL_sk_set(ossl_check_X509_CRL_sk_type(sk), (idx), ossl_check_X509_CRL_type(ptr))) +#define sk_X509_CRL_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)) +#define sk_X509_CRL_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)) +#define sk_X509_CRL_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr), pnum) +#define sk_X509_CRL_sort(sk) OPENSSL_sk_sort(ossl_check_X509_CRL_sk_type(sk)) +#define sk_X509_CRL_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_CRL_sk_type(sk)) +#define sk_X509_CRL_dup(sk) ((STACK_OF(X509_CRL) *)OPENSSL_sk_dup(ossl_check_const_X509_CRL_sk_type(sk))) +#define sk_X509_CRL_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_CRL) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_CRL_sk_type(sk), ossl_check_X509_CRL_copyfunc_type(copyfunc), ossl_check_X509_CRL_freefunc_type(freefunc))) +#define sk_X509_CRL_set_cmp_func(sk, cmp) ((sk_X509_CRL_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_compfunc_type(cmp))) + +/* clang-format on */ + +/* Flags for X509_get_signature_info() */ +/* Signature info is valid */ +#define X509_SIG_INFO_VALID 0x1 +/* Signature is suitable for TLS use */ +#define X509_SIG_INFO_TLS 0x2 + +#define X509_FILETYPE_PEM 1 +#define X509_FILETYPE_ASN1 2 +#define X509_FILETYPE_DEFAULT 3 + +/*- + * : + * The KeyUsage BITSTRING is treated as a little-endian integer, hence bit `0` + * is 0x80, while bit `7` is 0x01 (the LSB of the integer value), bit `8` is + * then the MSB of the second octet, or 0x8000. + */ +#define X509v3_KU_DIGITAL_SIGNATURE 0x0080 /* (0) */ +#define X509v3_KU_NON_REPUDIATION 0x0040 /* (1) */ +#define X509v3_KU_KEY_ENCIPHERMENT 0x0020 /* (2) */ +#define X509v3_KU_DATA_ENCIPHERMENT 0x0010 /* (3) */ +#define X509v3_KU_KEY_AGREEMENT 0x0008 /* (4) */ +#define X509v3_KU_KEY_CERT_SIGN 0x0004 /* (5) */ +#define X509v3_KU_CRL_SIGN 0x0002 /* (6) */ +#define X509v3_KU_ENCIPHER_ONLY 0x0001 /* (7) */ +#define X509v3_KU_DECIPHER_ONLY 0x8000 /* (8) */ +#ifndef OPENSSL_NO_DEPRECATED_3_4 +#define X509v3_KU_UNDEF 0xffff /* vestigial, not used */ +#endif + +struct X509_algor_st { + ASN1_OBJECT *algorithm; + ASN1_TYPE *parameter; +} /* X509_ALGOR */; + +typedef STACK_OF(X509_ALGOR) X509_ALGORS; + +typedef struct X509_val_st { + ASN1_TIME *notBefore; + ASN1_TIME *notAfter; +} X509_VAL; + +typedef struct X509_sig_st X509_SIG; + +typedef struct X509_name_entry_st X509_NAME_ENTRY; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_NAME_ENTRY, X509_NAME_ENTRY, X509_NAME_ENTRY) +#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk)) +#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx))) +#define sk_X509_NAME_ENTRY_new(cmp) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new(ossl_check_X509_NAME_ENTRY_compfunc_type(cmp))) +#define sk_X509_NAME_ENTRY_new_null() ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new_null()) +#define sk_X509_NAME_ENTRY_new_reserve(cmp, n) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new_reserve(ossl_check_X509_NAME_ENTRY_compfunc_type(cmp), (n))) +#define sk_X509_NAME_ENTRY_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_NAME_ENTRY_sk_type(sk), (n)) +#define sk_X509_NAME_ENTRY_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_ENTRY_sk_type(sk)) +#define sk_X509_NAME_ENTRY_zero(sk) OPENSSL_sk_zero(ossl_check_X509_NAME_ENTRY_sk_type(sk)) +#define sk_X509_NAME_ENTRY_delete(sk, i) ((X509_NAME_ENTRY *)OPENSSL_sk_delete(ossl_check_X509_NAME_ENTRY_sk_type(sk), (i))) +#define sk_X509_NAME_ENTRY_delete_ptr(sk, ptr) ((X509_NAME_ENTRY *)OPENSSL_sk_delete_ptr(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))) +#define sk_X509_NAME_ENTRY_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)) +#define sk_X509_NAME_ENTRY_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)) +#define sk_X509_NAME_ENTRY_pop(sk) ((X509_NAME_ENTRY *)OPENSSL_sk_pop(ossl_check_X509_NAME_ENTRY_sk_type(sk))) +#define sk_X509_NAME_ENTRY_shift(sk) ((X509_NAME_ENTRY *)OPENSSL_sk_shift(ossl_check_X509_NAME_ENTRY_sk_type(sk))) +#define sk_X509_NAME_ENTRY_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc)) +#define sk_X509_NAME_ENTRY_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr), (idx)) +#define sk_X509_NAME_ENTRY_set(sk, idx, ptr) ((X509_NAME_ENTRY *)OPENSSL_sk_set(ossl_check_X509_NAME_ENTRY_sk_type(sk), (idx), ossl_check_X509_NAME_ENTRY_type(ptr))) +#define sk_X509_NAME_ENTRY_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)) +#define sk_X509_NAME_ENTRY_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)) +#define sk_X509_NAME_ENTRY_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr), pnum) +#define sk_X509_NAME_ENTRY_sort(sk) OPENSSL_sk_sort(ossl_check_X509_NAME_ENTRY_sk_type(sk)) +#define sk_X509_NAME_ENTRY_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_NAME_ENTRY_sk_type(sk)) +#define sk_X509_NAME_ENTRY_dup(sk) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_dup(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))) +#define sk_X509_NAME_ENTRY_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_copyfunc_type(copyfunc), ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc))) +#define sk_X509_NAME_ENTRY_set_cmp_func(sk, cmp) ((sk_X509_NAME_ENTRY_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_compfunc_type(cmp))) + +/* clang-format on */ + +#define X509_EX_V_NETSCAPE_HACK 0x8000 +#define X509_EX_V_INIT 0x0001 +typedef struct X509_extension_st X509_EXTENSION; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_EXTENSION, X509_EXTENSION, X509_EXTENSION) +#define sk_X509_EXTENSION_num(sk) OPENSSL_sk_num(ossl_check_const_X509_EXTENSION_sk_type(sk)) +#define sk_X509_EXTENSION_value(sk, idx) ((X509_EXTENSION *)OPENSSL_sk_value(ossl_check_const_X509_EXTENSION_sk_type(sk), (idx))) +#define sk_X509_EXTENSION_new(cmp) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_new(ossl_check_X509_EXTENSION_compfunc_type(cmp))) +#define sk_X509_EXTENSION_new_null() ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_new_null()) +#define sk_X509_EXTENSION_new_reserve(cmp, n) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_new_reserve(ossl_check_X509_EXTENSION_compfunc_type(cmp), (n))) +#define sk_X509_EXTENSION_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_EXTENSION_sk_type(sk), (n)) +#define sk_X509_EXTENSION_free(sk) OPENSSL_sk_free(ossl_check_X509_EXTENSION_sk_type(sk)) +#define sk_X509_EXTENSION_zero(sk) OPENSSL_sk_zero(ossl_check_X509_EXTENSION_sk_type(sk)) +#define sk_X509_EXTENSION_delete(sk, i) ((X509_EXTENSION *)OPENSSL_sk_delete(ossl_check_X509_EXTENSION_sk_type(sk), (i))) +#define sk_X509_EXTENSION_delete_ptr(sk, ptr) ((X509_EXTENSION *)OPENSSL_sk_delete_ptr(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))) +#define sk_X509_EXTENSION_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)) +#define sk_X509_EXTENSION_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)) +#define sk_X509_EXTENSION_pop(sk) ((X509_EXTENSION *)OPENSSL_sk_pop(ossl_check_X509_EXTENSION_sk_type(sk))) +#define sk_X509_EXTENSION_shift(sk) ((X509_EXTENSION *)OPENSSL_sk_shift(ossl_check_X509_EXTENSION_sk_type(sk))) +#define sk_X509_EXTENSION_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_freefunc_type(freefunc)) +#define sk_X509_EXTENSION_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr), (idx)) +#define sk_X509_EXTENSION_set(sk, idx, ptr) ((X509_EXTENSION *)OPENSSL_sk_set(ossl_check_X509_EXTENSION_sk_type(sk), (idx), ossl_check_X509_EXTENSION_type(ptr))) +#define sk_X509_EXTENSION_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)) +#define sk_X509_EXTENSION_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)) +#define sk_X509_EXTENSION_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr), pnum) +#define sk_X509_EXTENSION_sort(sk) OPENSSL_sk_sort(ossl_check_X509_EXTENSION_sk_type(sk)) +#define sk_X509_EXTENSION_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_EXTENSION_sk_type(sk)) +#define sk_X509_EXTENSION_dup(sk) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_dup(ossl_check_const_X509_EXTENSION_sk_type(sk))) +#define sk_X509_EXTENSION_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_copyfunc_type(copyfunc), ossl_check_X509_EXTENSION_freefunc_type(freefunc))) +#define sk_X509_EXTENSION_set_cmp_func(sk, cmp) ((sk_X509_EXTENSION_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_compfunc_type(cmp))) + +/* clang-format on */ +typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; +typedef struct x509_attributes_st X509_ATTRIBUTE; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_ATTRIBUTE, X509_ATTRIBUTE, X509_ATTRIBUTE) +#define sk_X509_ATTRIBUTE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_ATTRIBUTE_sk_type(sk)) +#define sk_X509_ATTRIBUTE_value(sk, idx) ((X509_ATTRIBUTE *)OPENSSL_sk_value(ossl_check_const_X509_ATTRIBUTE_sk_type(sk), (idx))) +#define sk_X509_ATTRIBUTE_new(cmp) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new(ossl_check_X509_ATTRIBUTE_compfunc_type(cmp))) +#define sk_X509_ATTRIBUTE_new_null() ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new_null()) +#define sk_X509_ATTRIBUTE_new_reserve(cmp, n) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new_reserve(ossl_check_X509_ATTRIBUTE_compfunc_type(cmp), (n))) +#define sk_X509_ATTRIBUTE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_ATTRIBUTE_sk_type(sk), (n)) +#define sk_X509_ATTRIBUTE_free(sk) OPENSSL_sk_free(ossl_check_X509_ATTRIBUTE_sk_type(sk)) +#define sk_X509_ATTRIBUTE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_ATTRIBUTE_sk_type(sk)) +#define sk_X509_ATTRIBUTE_delete(sk, i) ((X509_ATTRIBUTE *)OPENSSL_sk_delete(ossl_check_X509_ATTRIBUTE_sk_type(sk), (i))) +#define sk_X509_ATTRIBUTE_delete_ptr(sk, ptr) ((X509_ATTRIBUTE *)OPENSSL_sk_delete_ptr(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))) +#define sk_X509_ATTRIBUTE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)) +#define sk_X509_ATTRIBUTE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)) +#define sk_X509_ATTRIBUTE_pop(sk) ((X509_ATTRIBUTE *)OPENSSL_sk_pop(ossl_check_X509_ATTRIBUTE_sk_type(sk))) +#define sk_X509_ATTRIBUTE_shift(sk) ((X509_ATTRIBUTE *)OPENSSL_sk_shift(ossl_check_X509_ATTRIBUTE_sk_type(sk))) +#define sk_X509_ATTRIBUTE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_freefunc_type(freefunc)) +#define sk_X509_ATTRIBUTE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr), (idx)) +#define sk_X509_ATTRIBUTE_set(sk, idx, ptr) ((X509_ATTRIBUTE *)OPENSSL_sk_set(ossl_check_X509_ATTRIBUTE_sk_type(sk), (idx), ossl_check_X509_ATTRIBUTE_type(ptr))) +#define sk_X509_ATTRIBUTE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)) +#define sk_X509_ATTRIBUTE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)) +#define sk_X509_ATTRIBUTE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr), pnum) +#define sk_X509_ATTRIBUTE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_ATTRIBUTE_sk_type(sk)) +#define sk_X509_ATTRIBUTE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_ATTRIBUTE_sk_type(sk)) +#define sk_X509_ATTRIBUTE_dup(sk) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_dup(ossl_check_const_X509_ATTRIBUTE_sk_type(sk))) +#define sk_X509_ATTRIBUTE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_copyfunc_type(copyfunc), ossl_check_X509_ATTRIBUTE_freefunc_type(freefunc))) +#define sk_X509_ATTRIBUTE_set_cmp_func(sk, cmp) ((sk_X509_ATTRIBUTE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_compfunc_type(cmp))) + +/* clang-format on */ +typedef struct X509_req_info_st X509_REQ_INFO; +typedef struct X509_req_st X509_REQ; +typedef struct x509_cert_aux_st X509_CERT_AUX; +typedef struct x509_cinf_st X509_CINF; + +/* Flags for X509_print_ex() */ + +#define X509_FLAG_COMPAT 0 +#define X509_FLAG_NO_HEADER 1L +#define X509_FLAG_NO_VERSION (1L << 1) +#define X509_FLAG_NO_SERIAL (1L << 2) +#define X509_FLAG_NO_SIGNAME (1L << 3) +#define X509_FLAG_NO_ISSUER (1L << 4) +#define X509_FLAG_NO_VALIDITY (1L << 5) +#define X509_FLAG_NO_SUBJECT (1L << 6) +#define X509_FLAG_NO_PUBKEY (1L << 7) +#define X509_FLAG_NO_EXTENSIONS (1L << 8) +#define X509_FLAG_NO_SIGDUMP (1L << 9) +#define X509_FLAG_NO_AUX (1L << 10) +#define X509_FLAG_NO_ATTRIBUTES (1L << 11) +#define X509_FLAG_NO_IDS (1L << 12) +#define X509_FLAG_EXTENSIONS_ONLY_KID (1L << 13) + +/* Flags specific to X509_NAME_print_ex() */ + +/* The field separator information */ + +#define XN_FLAG_SEP_MASK (0xf << 16) + +#define XN_FLAG_COMPAT 0 /* Traditional; use old X509_NAME_print */ +#define XN_FLAG_SEP_COMMA_PLUS (1 << 16) /* RFC2253 ,+ */ +#define XN_FLAG_SEP_CPLUS_SPC (2 << 16) /* ,+ spaced: more readable */ +#define XN_FLAG_SEP_SPLUS_SPC (3 << 16) /* ;+ spaced */ +#define XN_FLAG_SEP_MULTILINE (4 << 16) /* One line per field */ + +#define XN_FLAG_DN_REV (1 << 20) /* Reverse DN order */ + +/* How the field name is shown */ + +#define XN_FLAG_FN_MASK (0x3 << 21) + +#define XN_FLAG_FN_SN 0 /* Object short name */ +#define XN_FLAG_FN_LN (1 << 21) /* Object long name */ +#define XN_FLAG_FN_OID (2 << 21) /* Always use OIDs */ +#define XN_FLAG_FN_NONE (3 << 21) /* No field names */ + +#define XN_FLAG_SPC_EQ (1 << 23) /* Put spaces round '=' */ + +/* + * This determines if we dump fields we don't recognise: RFC2253 requires + * this. + */ + +#define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) + +#define XN_FLAG_FN_ALIGN (1 << 25) /* Align field names to 20 \ + * characters */ + +/* Complete set of RFC2253 flags */ + +#define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS) + +/* readable oneline form */ + +#define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN) + +/* readable multiline form */ + +#define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN) + +typedef struct X509_crl_info_st X509_CRL_INFO; + +typedef struct private_key_st { + int version; + /* The PKCS#8 data types */ + X509_ALGOR *enc_algor; + ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ + /* When decrypted, the following will not be NULL */ + EVP_PKEY *dec_pkey; + /* used to encrypt and decrypt */ + int key_length; + char *key_data; + int key_free; /* true if we should auto free key_data */ + /* expanded version of 'enc_algor' */ + EVP_CIPHER_INFO cipher; +} X509_PKEY; + +typedef struct X509_info_st { + X509 *x509; + X509_CRL *crl; + X509_PKEY *x_pkey; + EVP_CIPHER_INFO enc_cipher; + int enc_len; + char *enc_data; +} X509_INFO; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_INFO, X509_INFO, X509_INFO) +#define sk_X509_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_X509_INFO_sk_type(sk)) +#define sk_X509_INFO_value(sk, idx) ((X509_INFO *)OPENSSL_sk_value(ossl_check_const_X509_INFO_sk_type(sk), (idx))) +#define sk_X509_INFO_new(cmp) ((STACK_OF(X509_INFO) *)OPENSSL_sk_new(ossl_check_X509_INFO_compfunc_type(cmp))) +#define sk_X509_INFO_new_null() ((STACK_OF(X509_INFO) *)OPENSSL_sk_new_null()) +#define sk_X509_INFO_new_reserve(cmp, n) ((STACK_OF(X509_INFO) *)OPENSSL_sk_new_reserve(ossl_check_X509_INFO_compfunc_type(cmp), (n))) +#define sk_X509_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_INFO_sk_type(sk), (n)) +#define sk_X509_INFO_free(sk) OPENSSL_sk_free(ossl_check_X509_INFO_sk_type(sk)) +#define sk_X509_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_X509_INFO_sk_type(sk)) +#define sk_X509_INFO_delete(sk, i) ((X509_INFO *)OPENSSL_sk_delete(ossl_check_X509_INFO_sk_type(sk), (i))) +#define sk_X509_INFO_delete_ptr(sk, ptr) ((X509_INFO *)OPENSSL_sk_delete_ptr(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))) +#define sk_X509_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)) +#define sk_X509_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)) +#define sk_X509_INFO_pop(sk) ((X509_INFO *)OPENSSL_sk_pop(ossl_check_X509_INFO_sk_type(sk))) +#define sk_X509_INFO_shift(sk) ((X509_INFO *)OPENSSL_sk_shift(ossl_check_X509_INFO_sk_type(sk))) +#define sk_X509_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_freefunc_type(freefunc)) +#define sk_X509_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr), (idx)) +#define sk_X509_INFO_set(sk, idx, ptr) ((X509_INFO *)OPENSSL_sk_set(ossl_check_X509_INFO_sk_type(sk), (idx), ossl_check_X509_INFO_type(ptr))) +#define sk_X509_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)) +#define sk_X509_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)) +#define sk_X509_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr), pnum) +#define sk_X509_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_X509_INFO_sk_type(sk)) +#define sk_X509_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_INFO_sk_type(sk)) +#define sk_X509_INFO_dup(sk) ((STACK_OF(X509_INFO) *)OPENSSL_sk_dup(ossl_check_const_X509_INFO_sk_type(sk))) +#define sk_X509_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_INFO_sk_type(sk), ossl_check_X509_INFO_copyfunc_type(copyfunc), ossl_check_X509_INFO_freefunc_type(freefunc))) +#define sk_X509_INFO_set_cmp_func(sk, cmp) ((sk_X509_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_compfunc_type(cmp))) + +/* clang-format on */ + +/* + * The next 2 structures and their 8 routines are used to manipulate Netscape's + * spki structures - useful if you are writing a CA web page + */ +typedef struct Netscape_spkac_st { + X509_PUBKEY *pubkey; + ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ +} NETSCAPE_SPKAC; + +typedef struct Netscape_spki_st { + NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ + X509_ALGOR sig_algor; + ASN1_BIT_STRING *signature; +} NETSCAPE_SPKI; + +/* Netscape certificate sequence structure */ +typedef struct Netscape_certificate_sequence { + ASN1_OBJECT *type; + STACK_OF(X509) *certs; +} NETSCAPE_CERT_SEQUENCE; + +/*- Unused (and iv length is wrong) +typedef struct CBCParameter_st + { + unsigned char iv[8]; + } CBC_PARAM; +*/ + +/* Password based encryption structure */ + +typedef struct PBEPARAM_st { + ASN1_OCTET_STRING *salt; + ASN1_INTEGER *iter; +} PBEPARAM; + +/* Password based encryption V2 structures */ + +typedef struct PBE2PARAM_st { + X509_ALGOR *keyfunc; + X509_ALGOR *encryption; +} PBE2PARAM; + +typedef struct PBKDF2PARAM_st { + /* Usually OCTET STRING but could be anything */ + ASN1_TYPE *salt; + ASN1_INTEGER *iter; + ASN1_INTEGER *keylength; + X509_ALGOR *prf; +} PBKDF2PARAM; + +typedef struct { + X509_ALGOR *keyDerivationFunc; + X509_ALGOR *messageAuthScheme; +} PBMAC1PARAM; + +#ifndef OPENSSL_NO_SCRYPT +typedef struct SCRYPT_PARAMS_st { + ASN1_OCTET_STRING *salt; + ASN1_INTEGER *costParameter; + ASN1_INTEGER *blockSize; + ASN1_INTEGER *parallelizationParameter; + ASN1_INTEGER *keyLength; +} SCRYPT_PARAMS; +#endif + +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define X509_EXT_PACK_UNKNOWN 1 +#define X509_EXT_PACK_STRING 2 + +#define X509_extract_key(x) X509_get_pubkey(x) /*****/ +#define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) +#define X509_name_cmp(a, b) X509_NAME_cmp((a), (b)) + +void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); +X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init)(X509_CRL *crl), + int (*crl_free)(X509_CRL *crl), + int (*crl_lookup)(X509_CRL *crl, + X509_REVOKED **ret, + const ASN1_INTEGER *serial, + const X509_NAME *issuer), + int (*crl_verify)(X509_CRL *crl, + EVP_PKEY *pk)); +void X509_CRL_METHOD_free(X509_CRL_METHOD *m); + +void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); +void *X509_CRL_get_meth_data(X509_CRL *crl); + +const char *X509_verify_cert_error_string(long n); + +int X509_verify(X509 *a, EVP_PKEY *r); +int X509_self_signed(X509 *cert, int verify_signature); + +int X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *r, OSSL_LIB_CTX *libctx, + const char *propq); +int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); +int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); +int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); + +NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); +char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); +EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); +int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); + +int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); + +int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); +int X509_signature_print(BIO *bp, const X509_ALGOR *alg, + const ASN1_STRING *sig); + +int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); +int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); +int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); +int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); + +int X509_pubkey_digest(const X509 *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_digest(const X509 *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +ASN1_OCTET_STRING *X509_digest_sig(const X509 *cert, + EVP_MD **md_used, int *md_is_fallback); +int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); + +X509 *X509_load_http(const char *url, BIO *bio, BIO *rbio, int timeout); +X509_CRL *X509_CRL_load_http(const char *url, BIO *bio, BIO *rbio, int timeout); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#include /* OSSL_HTTP_REQ_CTX_nbio_d2i */ +#define X509_http_nbio(rctx, pcert) \ + OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcert, ASN1_ITEM_rptr(X509)) +#define X509_CRL_http_nbio(rctx, pcrl) \ + OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcrl, ASN1_ITEM_rptr(X509_CRL)) +#endif + +#ifndef OPENSSL_NO_STDIO +X509 *d2i_X509_fp(FILE *fp, X509 **x509); +int i2d_X509_fp(FILE *fp, const X509 *x509); +X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); +int i2d_X509_CRL_fp(FILE *fp, const X509_CRL *crl); +X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); +int i2d_X509_REQ_fp(FILE *fp, const X509_REQ *req); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); +OSSL_DEPRECATEDIN_3_0 int i2d_RSAPrivateKey_fp(FILE *fp, const RSA *rsa); +OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); +OSSL_DEPRECATEDIN_3_0 int i2d_RSAPublicKey_fp(FILE *fp, const RSA *rsa); +OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); +OSSL_DEPRECATEDIN_3_0 int i2d_RSA_PUBKEY_fp(FILE *fp, const RSA *rsa); +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_DSA +OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); +OSSL_DEPRECATEDIN_3_0 int i2d_DSA_PUBKEY_fp(FILE *fp, const DSA *dsa); +OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); +OSSL_DEPRECATEDIN_3_0 int i2d_DSAPrivateKey_fp(FILE *fp, const DSA *dsa); +#endif +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_EC +OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); +OSSL_DEPRECATEDIN_3_0 int i2d_EC_PUBKEY_fp(FILE *fp, const EC_KEY *eckey); +OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); +OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey_fp(FILE *fp, const EC_KEY *eckey); +#endif /* OPENSSL_NO_EC */ +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ +X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); +int i2d_PKCS8_fp(FILE *fp, const X509_SIG *p8); +X509_PUBKEY *d2i_X509_PUBKEY_fp(FILE *fp, X509_PUBKEY **xpk); +int i2d_X509_PUBKEY_fp(FILE *fp, const X509_PUBKEY *xpk); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, const PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, const EVP_PKEY *key); +int i2d_PrivateKey_fp(FILE *fp, const EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_ex_fp(FILE *fp, EVP_PKEY **a, OSSL_LIB_CTX *libctx, + const char *propq); +EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); +int i2d_PUBKEY_fp(FILE *fp, const EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_ex_fp(FILE *fp, EVP_PKEY **a, OSSL_LIB_CTX *libctx, + const char *propq); +EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); +#endif + +X509 *d2i_X509_bio(BIO *bp, X509 **x509); +int i2d_X509_bio(BIO *bp, const X509 *x509); +X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); +int i2d_X509_CRL_bio(BIO *bp, const X509_CRL *crl); +X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); +int i2d_X509_REQ_bio(BIO *bp, const X509_REQ *req); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); +OSSL_DEPRECATEDIN_3_0 int i2d_RSAPrivateKey_bio(BIO *bp, const RSA *rsa); +OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); +OSSL_DEPRECATEDIN_3_0 int i2d_RSAPublicKey_bio(BIO *bp, const RSA *rsa); +OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); +OSSL_DEPRECATEDIN_3_0 int i2d_RSA_PUBKEY_bio(BIO *bp, const RSA *rsa); +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_DSA +OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); +OSSL_DEPRECATEDIN_3_0 int i2d_DSA_PUBKEY_bio(BIO *bp, const DSA *dsa); +OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); +OSSL_DEPRECATEDIN_3_0 int i2d_DSAPrivateKey_bio(BIO *bp, const DSA *dsa); +#endif +#endif + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_EC +OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); +OSSL_DEPRECATEDIN_3_0 int i2d_EC_PUBKEY_bio(BIO *bp, const EC_KEY *eckey); +OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); +OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey_bio(BIO *bp, const EC_KEY *eckey); +#endif /* OPENSSL_NO_EC */ +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ + +X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); +int i2d_PKCS8_bio(BIO *bp, const X509_SIG *p8); +X509_PUBKEY *d2i_X509_PUBKEY_bio(BIO *bp, X509_PUBKEY **xpk); +int i2d_X509_PUBKEY_bio(BIO *bp, const X509_PUBKEY *xpk); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, const PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, const EVP_PKEY *key); +int i2d_PrivateKey_bio(BIO *bp, const EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_ex_bio(BIO *bp, EVP_PKEY **a, OSSL_LIB_CTX *libctx, + const char *propq); +EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); +int i2d_PUBKEY_bio(BIO *bp, const EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_ex_bio(BIO *bp, EVP_PKEY **a, OSSL_LIB_CTX *libctx, + const char *propq); +EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); + +DECLARE_ASN1_DUP_FUNCTION(X509) +DECLARE_ASN1_DUP_FUNCTION(X509_ALGOR) +DECLARE_ASN1_DUP_FUNCTION(X509_ATTRIBUTE) +DECLARE_ASN1_DUP_FUNCTION(X509_CRL) +DECLARE_ASN1_DUP_FUNCTION(X509_EXTENSION) +DECLARE_ASN1_DUP_FUNCTION(X509_PUBKEY) +DECLARE_ASN1_DUP_FUNCTION(X509_REQ) +DECLARE_ASN1_DUP_FUNCTION(X509_REVOKED) +int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, + void *pval); +void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, + const void **ppval, const X509_ALGOR *algor); +void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); +int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); +int X509_ALGOR_copy(X509_ALGOR *dest, const X509_ALGOR *src); + +DECLARE_ASN1_DUP_FUNCTION(X509_NAME) +DECLARE_ASN1_DUP_FUNCTION(X509_NAME_ENTRY) + +int X509_cmp_time(const ASN1_TIME *s, time_t *t); +int X509_cmp_current_time(const ASN1_TIME *s); +int X509_cmp_timeframe(const X509_VERIFY_PARAM *vpm, + const ASN1_TIME *start, const ASN1_TIME *end); +ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t); +ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, + int offset_day, long offset_sec, time_t *t); +ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); + +const char *X509_get_default_cert_area(void); +const char *X509_get_default_cert_dir(void); +const char *X509_get_default_cert_file(void); +const char *X509_get_default_cert_dir_env(void); +const char *X509_get_default_cert_file_env(void); +const char *X509_get_default_private_dir(void); + +X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); + +DECLARE_ASN1_FUNCTIONS(X509_ALGOR) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) +DECLARE_ASN1_FUNCTIONS(X509_VAL) + +DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) + +X509_PUBKEY *X509_PUBKEY_new_ex(OSSL_LIB_CTX *libctx, const char *propq); +int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); +EVP_PKEY *X509_PUBKEY_get0(const X509_PUBKEY *key); +EVP_PKEY *X509_PUBKEY_get(const X509_PUBKEY *key); +int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain); +long X509_get_pathlen(X509 *x); +DECLARE_ASN1_ENCODE_FUNCTIONS_only(EVP_PKEY, PUBKEY) +EVP_PKEY *d2i_PUBKEY_ex(EVP_PKEY **a, const unsigned char **pp, long length, + OSSL_LIB_CTX *libctx, const char *propq); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, RSA, RSA_PUBKEY) +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_DSA +DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DSA, DSA_PUBKEY) +#endif +#endif +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#ifndef OPENSSL_NO_EC +DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, EC_KEY, EC_PUBKEY) +#endif +#endif + +DECLARE_ASN1_FUNCTIONS(X509_SIG) +void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, + const ASN1_OCTET_STRING **pdigest); +void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, + ASN1_OCTET_STRING **pdigest); + +DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) +DECLARE_ASN1_FUNCTIONS(X509_REQ) +X509_REQ *X509_REQ_new_ex(OSSL_LIB_CTX *libctx, const char *propq); + +DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) +X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); + +DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) + +DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) + +DECLARE_ASN1_FUNCTIONS(X509_NAME) + +int X509_NAME_set(X509_NAME **xn, const X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(X509_CINF) +DECLARE_ASN1_FUNCTIONS(X509) +X509 *X509_new_ex(OSSL_LIB_CTX *libctx, const char *propq); +DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) + +#define X509_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef) +int X509_set_ex_data(X509 *r, int idx, void *arg); +void *X509_get_ex_data(const X509 *r, int idx); +DECLARE_ASN1_ENCODE_FUNCTIONS_only(X509, X509_AUX) + +int i2d_re_X509_tbs(X509 *x, unsigned char **pp); + +int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid, + int *secbits, uint32_t *flags); +void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid, + int secbits, uint32_t flags); + +int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits, + uint32_t *flags); + +void X509_get0_signature(const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg, const X509 *x); +int X509_get_signature_nid(const X509 *x); + +void X509_set0_distinguishing_id(X509 *x, ASN1_OCTET_STRING *d_id); +ASN1_OCTET_STRING *X509_get0_distinguishing_id(X509 *x); +void X509_REQ_set0_distinguishing_id(X509_REQ *x, ASN1_OCTET_STRING *d_id); +ASN1_OCTET_STRING *X509_REQ_get0_distinguishing_id(X509_REQ *x); + +int X509_alias_set1(X509 *x, const unsigned char *name, int len); +int X509_keyid_set1(X509 *x, const unsigned char *id, int len); +unsigned char *X509_alias_get0(X509 *x, int *len); +unsigned char *X509_keyid_get0(X509 *x, int *len); + +DECLARE_ASN1_FUNCTIONS(X509_REVOKED) +DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) +DECLARE_ASN1_FUNCTIONS(X509_CRL) +X509_CRL *X509_CRL_new_ex(OSSL_LIB_CTX *libctx, const char *propq); + +int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); +int X509_CRL_get0_by_serial(X509_CRL *crl, + X509_REVOKED **ret, const ASN1_INTEGER *serial); +int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); + +X509_PKEY *X509_PKEY_new(void); +void X509_PKEY_free(X509_PKEY *a); + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) + +X509_INFO *X509_INFO_new(void); +void X509_INFO_free(X509_INFO *a); +char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size); + +#ifndef OPENSSL_NO_DEPRECATED_3_0 +OSSL_DEPRECATEDIN_3_0 +int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); +OSSL_DEPRECATEDIN_3_0 +int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, + unsigned char *md, unsigned int *len); +OSSL_DEPRECATEDIN_3_0 +int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2, + ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey, + const EVP_MD *type); +#endif +int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, + unsigned char *md, unsigned int *len); +int ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *alg, + const ASN1_BIT_STRING *signature, const void *data, + EVP_PKEY *pkey); +int ASN1_item_verify_ctx(const ASN1_ITEM *it, const X509_ALGOR *alg, + const ASN1_BIT_STRING *signature, const void *data, + EVP_MD_CTX *ctx); +int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, + ASN1_BIT_STRING *signature, const void *data, + EVP_PKEY *pkey, const EVP_MD *md); +int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + const void *data, EVP_MD_CTX *ctx); + +#define X509_VERSION_1 0 +#define X509_VERSION_2 1 +#define X509_VERSION_3 2 + +long X509_get_version(const X509 *x); +int X509_set_version(X509 *x, long version); +int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); +ASN1_INTEGER *X509_get_serialNumber(X509 *x); +const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); +int X509_set_issuer_name(X509 *x, const X509_NAME *name); +X509_NAME *X509_get_issuer_name(const X509 *a); +int X509_set_subject_name(X509 *x, const X509_NAME *name); +X509_NAME *X509_get_subject_name(const X509 *a); +const ASN1_TIME *X509_get0_notBefore(const X509 *x); +ASN1_TIME *X509_getm_notBefore(const X509 *x); +int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); +const ASN1_TIME *X509_get0_notAfter(const X509 *x); +ASN1_TIME *X509_getm_notAfter(const X509 *x); +int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); +int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); +int X509_up_ref(X509 *x); +int X509_get_signature_type(const X509 *x); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define X509_get_notBefore X509_getm_notBefore +#define X509_get_notAfter X509_getm_notAfter +#define X509_set_notBefore X509_set1_notBefore +#define X509_set_notAfter X509_set1_notAfter +#endif + +/* + * This one is only used so that a binary form can output, as in + * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf) + */ +X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); +const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); +void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid, + const ASN1_BIT_STRING **psuid); +const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); + +EVP_PKEY *X509_get0_pubkey(const X509 *x); +EVP_PKEY *X509_get_pubkey(X509 *x); +ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); + +#define X509_REQ_VERSION_1 0 + +long X509_REQ_get_version(const X509_REQ *req); +int X509_REQ_set_version(X509_REQ *x, long version); +X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req); +int X509_REQ_set_subject_name(X509_REQ *req, const X509_NAME *name); +void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); +void X509_REQ_set0_signature(X509_REQ *req, ASN1_BIT_STRING *psig); +int X509_REQ_set1_signature_algo(X509_REQ *req, X509_ALGOR *palg); +int X509_REQ_get_signature_nid(const X509_REQ *req); +int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); +int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); +EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); +EVP_PKEY *X509_REQ_get0_pubkey(const X509_REQ *req); +X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req); +int X509_REQ_extension_nid(int nid); +int *X509_REQ_get_extension_nids(void); +void X509_REQ_set_extension_nids(int *nids); +STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(OSSL_FUTURE_CONST X509_REQ *req); +int X509_REQ_add_extensions_nid(X509_REQ *req, + const STACK_OF(X509_EXTENSION) *exts, int nid); +int X509_REQ_add_extensions(X509_REQ *req, const STACK_OF(X509_EXTENSION) *ext); +int X509_REQ_get_attr_count(const X509_REQ *req); +int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); +int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); +X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); +int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); +int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_NID(X509_REQ *req, + int nid, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_txt(X509_REQ *req, + const char *attrname, int type, + const unsigned char *bytes, int len); + +#define X509_CRL_VERSION_1 0 +#define X509_CRL_VERSION_2 1 + +int X509_CRL_set_version(X509_CRL *x, long version); +int X509_CRL_set_issuer_name(X509_CRL *x, const X509_NAME *name); +int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); +int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); +int X509_CRL_sort(X509_CRL *crl); +int X509_CRL_up_ref(X509_CRL *crl); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate +#define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate +#endif + +long X509_CRL_get_version(const X509_CRL *crl); +const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); +const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +OSSL_DEPRECATEDIN_1_1_0 ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl); +OSSL_DEPRECATEDIN_1_1_0 ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl); +#endif +X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); +const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); +STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); +const X509_ALGOR *X509_CRL_get0_tbs_sigalg(const X509_CRL *crl); +void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); +int X509_CRL_get_signature_nid(const X509_CRL *crl); +int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); + +const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); +int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); +const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); +int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); +const STACK_OF(X509_EXTENSION) * +X509_REVOKED_get0_extensions(const X509_REVOKED *r); + +X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, + EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); + +int X509_REQ_check_private_key(const X509_REQ *req, EVP_PKEY *pkey); + +int X509_check_private_key(const X509 *cert, const EVP_PKEY *pkey); +int X509_chain_check_suiteb(int *perror_depth, + X509 *x, STACK_OF(X509) *chain, + unsigned long flags); +int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); +void OSSL_STACK_OF_X509_free(STACK_OF(X509) *certs); +STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); + +int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_and_serial_hash(X509 *a); + +int X509_issuer_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_name_hash(X509 *a); + +int X509_subject_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_subject_name_hash(X509 *x); + +#ifndef OPENSSL_NO_MD5 +unsigned long X509_issuer_name_hash_old(X509 *a); +unsigned long X509_subject_name_hash_old(X509 *x); +#endif + +#define X509_ADD_FLAG_DEFAULT 0 +#define X509_ADD_FLAG_UP_REF 0x1 +#define X509_ADD_FLAG_PREPEND 0x2 +#define X509_ADD_FLAG_NO_DUP 0x4 +#define X509_ADD_FLAG_NO_SS 0x8 +int X509_add_cert(STACK_OF(X509) *sk, X509 *cert, int flags); +int X509_add_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs, int flags); + +int X509_cmp(const X509 *a, const X509 *b); +int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define X509_NAME_hash(x) X509_NAME_hash_ex(x, NULL, NULL, NULL) +OSSL_DEPRECATEDIN_3_0 int X509_certificate_type(const X509 *x, + const EVP_PKEY *pubkey); +#endif +unsigned long X509_NAME_hash_ex(const X509_NAME *x, OSSL_LIB_CTX *libctx, + const char *propq, int *ok); +unsigned long X509_NAME_hash_old(const X509_NAME *x); + +int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); +int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); +int X509_aux_print(BIO *out, X509 *x, int indent); +#ifndef OPENSSL_NO_STDIO +int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, + unsigned long cflag); +int X509_print_fp(FILE *bp, X509 *x); +int X509_CRL_print_fp(FILE *bp, X509_CRL *x); +int X509_REQ_print_fp(FILE *bp, X509_REQ *req); +int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, + unsigned long flags); +#endif + +int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase); +int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, + unsigned long flags); +int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, + unsigned long cflag); +int X509_print(BIO *bp, X509 *x); +int X509_ocspid_print(BIO *bp, X509 *x); +int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag); +int X509_CRL_print(BIO *bp, X509_CRL *x); +int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, + unsigned long cflag); +int X509_REQ_print(BIO *bp, X509_REQ *req); + +int X509_NAME_entry_count(const X509_NAME *name); +int X509_NAME_get_text_by_NID(const X509_NAME *name, int nid, + char *buf, int len); +int X509_NAME_get_text_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj, + char *buf, int len); + +/* + * NOTE: you should be passing -1, not 0 as lastpos. The functions that use + * lastpos, search after that position on. + */ +int X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, int lastpos); +int X509_NAME_get_index_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj, + int lastpos); +X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); +X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); +int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, + int loc, int set); +int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len, int loc, + int set); +int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, + const unsigned char *bytes, int len, int loc, + int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, + const char *field, int type, + const unsigned char *bytes, + int len); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, + int type, + const unsigned char *bytes, + int len); +int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, + const unsigned char *bytes, int len, int loc, + int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, + int len); +int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj); +int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, + const unsigned char *bytes, int len); +ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); +ASN1_STRING *X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); +int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); + +int X509_NAME_get0_der(const X509_NAME *nm, const unsigned char **pder, + size_t *pderlen); + +int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); +int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, + int nid, int lastpos); +int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, + const ASN1_OBJECT *obj, int lastpos); +int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, + int crit, int lastpos); +X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); +X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); +STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, + X509_EXTENSION *ex, int loc); +STACK_OF(X509_EXTENSION) *X509v3_add_extensions(STACK_OF(X509_EXTENSION) **target, + const STACK_OF(X509_EXTENSION) *exts); + +int X509_get_ext_count(const X509 *x); +int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); +int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos); +int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); +X509_EXTENSION *X509_get_ext(const X509 *x, int loc); +X509_EXTENSION *X509_delete_ext(X509 *x, int loc); +int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); +void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); +int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_CRL_get_ext_count(const X509_CRL *x); +int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos); +int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, + int lastpos); +int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos); +X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); +X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); +int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); +void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx); +int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_REVOKED_get_ext_count(const X509_REVOKED *x); +int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos); +int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj, + int lastpos); +int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, + int lastpos); +X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); +X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); +int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); +void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, + int *idx); +int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, + unsigned long flags); + +X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, + int nid, int crit, + ASN1_OCTET_STRING *data); +X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, + const ASN1_OBJECT *obj, int crit, + ASN1_OCTET_STRING *data); +int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); +int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); +int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); +ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); +ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); +int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); + +int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); +int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, + int lastpos); +int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, + const ASN1_OBJECT *obj, int lastpos); +X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); +X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, + X509_ATTRIBUTE *attr); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) + **x, + const ASN1_OBJECT *obj, + int type, + const unsigned char *bytes, + int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) + **x, + int nid, int type, + const unsigned char *bytes, + int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) + **x, + const char *attrname, + int type, + const unsigned char *bytes, + int len); +void *X509at_get0_data_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *x, + const ASN1_OBJECT *obj, int lastpos, int type); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, + int atrtype, const void *data, + int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, + const ASN1_OBJECT *obj, + int atrtype, const void *data, + int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, + const char *atrname, int type, + const unsigned char *bytes, + int len); +int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); +int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, + const void *data, int len); +void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype, + void *data); +int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); +ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); +ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); + +int EVP_PKEY_get_attr_count(const EVP_PKEY *key); +int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); +int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); +X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); +int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); +int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, + int nid, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, + const char *attrname, int type, + const unsigned char *bytes, int len); + +/* lookup a cert from a X509 STACK */ +X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, const X509_NAME *name, + const ASN1_INTEGER *serial); +X509 *X509_find_by_subject(STACK_OF(X509) *sk, const X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(PBEPARAM) +DECLARE_ASN1_FUNCTIONS(PBE2PARAM) +DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) +DECLARE_ASN1_FUNCTIONS(PBMAC1PARAM) +#ifndef OPENSSL_NO_SCRYPT +DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS) +#endif + +int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, + const unsigned char *salt, int saltlen); +int PKCS5_pbe_set0_algor_ex(X509_ALGOR *algor, int alg, int iter, + const unsigned char *salt, int saltlen, + OSSL_LIB_CTX *libctx); + +X509_ALGOR *PKCS5_pbe_set(int alg, int iter, + const unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe_set_ex(int alg, int iter, + const unsigned char *salt, int saltlen, + OSSL_LIB_CTX *libctx); + +X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen, + unsigned char *aiv, int prf_nid); +X509_ALGOR *PKCS5_pbe2_set_iv_ex(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen, + unsigned char *aiv, int prf_nid, + OSSL_LIB_CTX *libctx); + +#ifndef OPENSSL_NO_SCRYPT +X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, + const unsigned char *salt, int saltlen, + unsigned char *aiv, uint64_t N, uint64_t r, + uint64_t p); +#endif + +X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, + int prf_nid, int keylen); +X509_ALGOR *PKCS5_pbkdf2_set_ex(int iter, unsigned char *salt, int saltlen, + int prf_nid, int keylen, + OSSL_LIB_CTX *libctx); + +PBKDF2PARAM *PBMAC1_get1_pbkdf2_param(const X509_ALGOR *macalg); +/* PKCS#8 utilities */ + +DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) + +EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); +EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OSSL_LIB_CTX *libctx, + const char *propq); +PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(const EVP_PKEY *pkey); + +int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, + int version, int ptype, void *pval, + unsigned char *penc, int penclen); +int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); + +const STACK_OF(X509_ATTRIBUTE) * +PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); +int PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr); +int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, + const unsigned char *bytes, int len); +int PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj, + int type, const unsigned char *bytes, int len); + +void X509_PUBKEY_set0_public_key(X509_PUBKEY *pub, + unsigned char *penc, int penclen); +int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, + int ptype, void *pval, + unsigned char *penc, int penclen); +int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + X509_ALGOR **pa, const X509_PUBKEY *pub); +int X509_PUBKEY_eq(const X509_PUBKEY *a, const X509_PUBKEY *b); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/x509_acert.h b/VCMP-LUA/modules/postgresql/include/openssl/x509_acert.h new file mode 100644 index 0000000..5a6dd1d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/x509_acert.h @@ -0,0 +1,304 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\x509_acert.h.in + * + * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_X509_ACERT_H +#define OPENSSL_X509_ACERT_H +#pragma once + +#include +#include +#include + +typedef struct X509_acert_st X509_ACERT; +typedef struct X509_acert_info_st X509_ACERT_INFO; +typedef struct ossl_object_digest_info_st OSSL_OBJECT_DIGEST_INFO; +typedef struct ossl_issuer_serial_st OSSL_ISSUER_SERIAL; +typedef struct X509_acert_issuer_v2form_st X509_ACERT_ISSUER_V2FORM; + +DECLARE_ASN1_FUNCTIONS(X509_ACERT) +DECLARE_ASN1_DUP_FUNCTION(X509_ACERT) +DECLARE_ASN1_ITEM(X509_ACERT_INFO) +DECLARE_ASN1_ALLOC_FUNCTIONS(X509_ACERT_INFO) +DECLARE_ASN1_ALLOC_FUNCTIONS(OSSL_OBJECT_DIGEST_INFO) +DECLARE_ASN1_ALLOC_FUNCTIONS(OSSL_ISSUER_SERIAL) +DECLARE_ASN1_ALLOC_FUNCTIONS(X509_ACERT_ISSUER_V2FORM) + +#ifndef OPENSSL_NO_STDIO +X509_ACERT *d2i_X509_ACERT_fp(FILE *fp, X509_ACERT **acert); +int i2d_X509_ACERT_fp(FILE *fp, const X509_ACERT *acert); +#endif + +DECLARE_PEM_rw(X509_ACERT, X509_ACERT) + +X509_ACERT *d2i_X509_ACERT_bio(BIO *bp, X509_ACERT **acert); +int i2d_X509_ACERT_bio(BIO *bp, const X509_ACERT *acert); + +int X509_ACERT_sign(X509_ACERT *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_ACERT_sign_ctx(X509_ACERT *x, EVP_MD_CTX *ctx); +int X509_ACERT_verify(X509_ACERT *a, EVP_PKEY *r); + +#define X509_ACERT_VERSION_2 1 + +const GENERAL_NAMES *X509_ACERT_get0_holder_entityName(const X509_ACERT *x); +const OSSL_ISSUER_SERIAL *X509_ACERT_get0_holder_baseCertId(const X509_ACERT *x); +const OSSL_OBJECT_DIGEST_INFO *X509_ACERT_get0_holder_digest(const X509_ACERT *x); +const X509_NAME *X509_ACERT_get0_issuerName(const X509_ACERT *x); +long X509_ACERT_get_version(const X509_ACERT *x); +void X509_ACERT_get0_signature(const X509_ACERT *x, + const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); +int X509_ACERT_get_signature_nid(const X509_ACERT *x); +const X509_ALGOR *X509_ACERT_get0_info_sigalg(const X509_ACERT *x); +const ASN1_INTEGER *X509_ACERT_get0_serialNumber(const X509_ACERT *x); +const ASN1_TIME *X509_ACERT_get0_notBefore(const X509_ACERT *x); +const ASN1_TIME *X509_ACERT_get0_notAfter(const X509_ACERT *x); +const ASN1_BIT_STRING *X509_ACERT_get0_issuerUID(const X509_ACERT *x); + +int X509_ACERT_print(BIO *bp, X509_ACERT *x); +int X509_ACERT_print_ex(BIO *bp, X509_ACERT *x, unsigned long nmflags, + unsigned long cflag); + +int X509_ACERT_get_attr_count(const X509_ACERT *x); +int X509_ACERT_get_attr_by_NID(const X509_ACERT *x, int nid, int lastpos); +int X509_ACERT_get_attr_by_OBJ(const X509_ACERT *x, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509_ACERT_get_attr(const X509_ACERT *x, int loc); +X509_ATTRIBUTE *X509_ACERT_delete_attr(X509_ACERT *x, int loc); + +void *X509_ACERT_get_ext_d2i(const X509_ACERT *x, int nid, int *crit, int *idx); +int X509_ACERT_add1_ext_i2d(X509_ACERT *x, int nid, void *value, int crit, + unsigned long flags); +const STACK_OF(X509_EXTENSION) *X509_ACERT_get0_extensions(const X509_ACERT *x); + +#define OSSL_OBJECT_DIGEST_INFO_PUBLIC_KEY 0 +#define OSSL_OBJECT_DIGEST_INFO_PUBLIC_KEY_CERT 1 +#define OSSL_OBJECT_DIGEST_INFO_OTHER 2 /* must not be used in RFC 5755 profile */ +int X509_ACERT_set_version(X509_ACERT *x, long version); +void X509_ACERT_set0_holder_entityName(X509_ACERT *x, GENERAL_NAMES *name); +void X509_ACERT_set0_holder_baseCertId(X509_ACERT *x, OSSL_ISSUER_SERIAL *isss); +void X509_ACERT_set0_holder_digest(X509_ACERT *x, + OSSL_OBJECT_DIGEST_INFO *dinfo); + +int X509_ACERT_add1_attr(X509_ACERT *x, X509_ATTRIBUTE *attr); +int X509_ACERT_add1_attr_by_OBJ(X509_ACERT *x, const ASN1_OBJECT *obj, + int type, const void *bytes, int len); +int X509_ACERT_add1_attr_by_NID(X509_ACERT *x, int nid, int type, + const void *bytes, int len); +int X509_ACERT_add1_attr_by_txt(X509_ACERT *x, const char *attrname, int type, + const unsigned char *bytes, int len); +int X509_ACERT_add_attr_nconf(CONF *conf, const char *section, + X509_ACERT *acert); + +int X509_ACERT_set1_issuerName(X509_ACERT *x, const X509_NAME *name); +int X509_ACERT_set1_serialNumber(X509_ACERT *x, const ASN1_INTEGER *serial); +int X509_ACERT_set1_notBefore(X509_ACERT *x, const ASN1_GENERALIZEDTIME *time); +int X509_ACERT_set1_notAfter(X509_ACERT *x, const ASN1_GENERALIZEDTIME *time); + +void OSSL_OBJECT_DIGEST_INFO_get0_digest(const OSSL_OBJECT_DIGEST_INFO *o, + int *digestedObjectType, + const X509_ALGOR **digestAlgorithm, + const ASN1_BIT_STRING **digest); + +int OSSL_OBJECT_DIGEST_INFO_set1_digest(OSSL_OBJECT_DIGEST_INFO *o, + int digestedObjectType, + X509_ALGOR *digestAlgorithm, + ASN1_BIT_STRING *digest); + +const X509_NAME *OSSL_ISSUER_SERIAL_get0_issuer(const OSSL_ISSUER_SERIAL *isss); +const ASN1_INTEGER *OSSL_ISSUER_SERIAL_get0_serial(const OSSL_ISSUER_SERIAL *isss); +const ASN1_BIT_STRING *OSSL_ISSUER_SERIAL_get0_issuerUID(const OSSL_ISSUER_SERIAL *isss); + +int OSSL_ISSUER_SERIAL_set1_issuer(OSSL_ISSUER_SERIAL *isss, + const X509_NAME *issuer); +int OSSL_ISSUER_SERIAL_set1_serial(OSSL_ISSUER_SERIAL *isss, + const ASN1_INTEGER *serial); +int OSSL_ISSUER_SERIAL_set1_issuerUID(OSSL_ISSUER_SERIAL *isss, + const ASN1_BIT_STRING *uid); + +#define OSSL_IETFAS_OCTETS 0 +#define OSSL_IETFAS_OID 1 +#define OSSL_IETFAS_STRING 2 + +typedef struct OSSL_IETF_ATTR_SYNTAX_VALUE_st OSSL_IETF_ATTR_SYNTAX_VALUE; +typedef struct OSSL_IETF_ATTR_SYNTAX_st OSSL_IETF_ATTR_SYNTAX; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_IETF_ATTR_SYNTAX_VALUE, OSSL_IETF_ATTR_SYNTAX_VALUE, OSSL_IETF_ATTR_SYNTAX_VALUE) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_value(sk, idx) ((OSSL_IETF_ATTR_SYNTAX_VALUE *)OPENSSL_sk_value(ossl_check_const_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), (idx))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_new(cmp) ((STACK_OF(OSSL_IETF_ATTR_SYNTAX_VALUE) *)OPENSSL_sk_new(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_compfunc_type(cmp))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_new_null() ((STACK_OF(OSSL_IETF_ATTR_SYNTAX_VALUE) *)OPENSSL_sk_new_null()) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_new_reserve(cmp, n) ((STACK_OF(OSSL_IETF_ATTR_SYNTAX_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_compfunc_type(cmp), (n))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), (n)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_delete(sk, i) ((OSSL_IETF_ATTR_SYNTAX_VALUE *)OPENSSL_sk_delete(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), (i))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_delete_ptr(sk, ptr) ((OSSL_IETF_ATTR_SYNTAX_VALUE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_type(ptr))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_type(ptr)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_type(ptr)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_pop(sk) ((OSSL_IETF_ATTR_SYNTAX_VALUE *)OPENSSL_sk_pop(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_shift(sk) ((OSSL_IETF_ATTR_SYNTAX_VALUE *)OPENSSL_sk_shift(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_freefunc_type(freefunc)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_type(ptr), (idx)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_set(sk, idx, ptr) ((OSSL_IETF_ATTR_SYNTAX_VALUE *)OPENSSL_sk_set(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), (idx), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_type(ptr))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_type(ptr)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_type(ptr)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_type(ptr), pnum) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk)) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_dup(sk) ((STACK_OF(OSSL_IETF_ATTR_SYNTAX_VALUE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_IETF_ATTR_SYNTAX_VALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_copyfunc_type(copyfunc), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_freefunc_type(freefunc))) +#define sk_OSSL_IETF_ATTR_SYNTAX_VALUE_set_cmp_func(sk, cmp) ((sk_OSSL_IETF_ATTR_SYNTAX_VALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_sk_type(sk), ossl_check_OSSL_IETF_ATTR_SYNTAX_VALUE_compfunc_type(cmp))) + +/* clang-format on */ + +DECLARE_ASN1_ITEM(OSSL_IETF_ATTR_SYNTAX_VALUE) +DECLARE_ASN1_ALLOC_FUNCTIONS(OSSL_IETF_ATTR_SYNTAX_VALUE) +DECLARE_ASN1_FUNCTIONS(OSSL_IETF_ATTR_SYNTAX) + +const GENERAL_NAMES * +OSSL_IETF_ATTR_SYNTAX_get0_policyAuthority(const OSSL_IETF_ATTR_SYNTAX *a); +void OSSL_IETF_ATTR_SYNTAX_set0_policyAuthority(OSSL_IETF_ATTR_SYNTAX *a, + GENERAL_NAMES *names); + +int OSSL_IETF_ATTR_SYNTAX_get_value_num(const OSSL_IETF_ATTR_SYNTAX *a); +void *OSSL_IETF_ATTR_SYNTAX_get0_value(const OSSL_IETF_ATTR_SYNTAX *a, + int ind, int *type); +int OSSL_IETF_ATTR_SYNTAX_add1_value(OSSL_IETF_ATTR_SYNTAX *a, int type, + void *data); +int OSSL_IETF_ATTR_SYNTAX_print(BIO *bp, OSSL_IETF_ATTR_SYNTAX *a, int indent); + +struct TARGET_CERT_st { + OSSL_ISSUER_SERIAL *targetCertificate; + GENERAL_NAME *targetName; + OSSL_OBJECT_DIGEST_INFO *certDigestInfo; +}; + +typedef struct TARGET_CERT_st OSSL_TARGET_CERT; + +#define OSSL_TGT_TARGET_NAME 0 +#define OSSL_TGT_TARGET_GROUP 1 +#define OSSL_TGT_TARGET_CERT 2 + +typedef struct TARGET_st { + int type; + union { + GENERAL_NAME *targetName; + GENERAL_NAME *targetGroup; + OSSL_TARGET_CERT *targetCert; + } choice; +} OSSL_TARGET; + +typedef STACK_OF(OSSL_TARGET) OSSL_TARGETS; +typedef STACK_OF(OSSL_TARGETS) OSSL_TARGETING_INFORMATION; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_TARGET, OSSL_TARGET, OSSL_TARGET) +#define sk_OSSL_TARGET_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_TARGET_sk_type(sk)) +#define sk_OSSL_TARGET_value(sk, idx) ((OSSL_TARGET *)OPENSSL_sk_value(ossl_check_const_OSSL_TARGET_sk_type(sk), (idx))) +#define sk_OSSL_TARGET_new(cmp) ((STACK_OF(OSSL_TARGET) *)OPENSSL_sk_new(ossl_check_OSSL_TARGET_compfunc_type(cmp))) +#define sk_OSSL_TARGET_new_null() ((STACK_OF(OSSL_TARGET) *)OPENSSL_sk_new_null()) +#define sk_OSSL_TARGET_new_reserve(cmp, n) ((STACK_OF(OSSL_TARGET) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_TARGET_compfunc_type(cmp), (n))) +#define sk_OSSL_TARGET_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_TARGET_sk_type(sk), (n)) +#define sk_OSSL_TARGET_free(sk) OPENSSL_sk_free(ossl_check_OSSL_TARGET_sk_type(sk)) +#define sk_OSSL_TARGET_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_TARGET_sk_type(sk)) +#define sk_OSSL_TARGET_delete(sk, i) ((OSSL_TARGET *)OPENSSL_sk_delete(ossl_check_OSSL_TARGET_sk_type(sk), (i))) +#define sk_OSSL_TARGET_delete_ptr(sk, ptr) ((OSSL_TARGET *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_type(ptr))) +#define sk_OSSL_TARGET_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_type(ptr)) +#define sk_OSSL_TARGET_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_type(ptr)) +#define sk_OSSL_TARGET_pop(sk) ((OSSL_TARGET *)OPENSSL_sk_pop(ossl_check_OSSL_TARGET_sk_type(sk))) +#define sk_OSSL_TARGET_shift(sk) ((OSSL_TARGET *)OPENSSL_sk_shift(ossl_check_OSSL_TARGET_sk_type(sk))) +#define sk_OSSL_TARGET_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_freefunc_type(freefunc)) +#define sk_OSSL_TARGET_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_type(ptr), (idx)) +#define sk_OSSL_TARGET_set(sk, idx, ptr) ((OSSL_TARGET *)OPENSSL_sk_set(ossl_check_OSSL_TARGET_sk_type(sk), (idx), ossl_check_OSSL_TARGET_type(ptr))) +#define sk_OSSL_TARGET_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_type(ptr)) +#define sk_OSSL_TARGET_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_type(ptr)) +#define sk_OSSL_TARGET_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_type(ptr), pnum) +#define sk_OSSL_TARGET_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_TARGET_sk_type(sk)) +#define sk_OSSL_TARGET_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_TARGET_sk_type(sk)) +#define sk_OSSL_TARGET_dup(sk) ((STACK_OF(OSSL_TARGET) *)OPENSSL_sk_dup(ossl_check_const_OSSL_TARGET_sk_type(sk))) +#define sk_OSSL_TARGET_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_TARGET) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_copyfunc_type(copyfunc), ossl_check_OSSL_TARGET_freefunc_type(freefunc))) +#define sk_OSSL_TARGET_set_cmp_func(sk, cmp) ((sk_OSSL_TARGET_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_TARGET_sk_type(sk), ossl_check_OSSL_TARGET_compfunc_type(cmp))) + +/* clang-format on */ + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_TARGETS, OSSL_TARGETS, OSSL_TARGETS) +#define sk_OSSL_TARGETS_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_TARGETS_sk_type(sk)) +#define sk_OSSL_TARGETS_value(sk, idx) ((OSSL_TARGETS *)OPENSSL_sk_value(ossl_check_const_OSSL_TARGETS_sk_type(sk), (idx))) +#define sk_OSSL_TARGETS_new(cmp) ((STACK_OF(OSSL_TARGETS) *)OPENSSL_sk_new(ossl_check_OSSL_TARGETS_compfunc_type(cmp))) +#define sk_OSSL_TARGETS_new_null() ((STACK_OF(OSSL_TARGETS) *)OPENSSL_sk_new_null()) +#define sk_OSSL_TARGETS_new_reserve(cmp, n) ((STACK_OF(OSSL_TARGETS) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_TARGETS_compfunc_type(cmp), (n))) +#define sk_OSSL_TARGETS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_TARGETS_sk_type(sk), (n)) +#define sk_OSSL_TARGETS_free(sk) OPENSSL_sk_free(ossl_check_OSSL_TARGETS_sk_type(sk)) +#define sk_OSSL_TARGETS_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_TARGETS_sk_type(sk)) +#define sk_OSSL_TARGETS_delete(sk, i) ((OSSL_TARGETS *)OPENSSL_sk_delete(ossl_check_OSSL_TARGETS_sk_type(sk), (i))) +#define sk_OSSL_TARGETS_delete_ptr(sk, ptr) ((OSSL_TARGETS *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_type(ptr))) +#define sk_OSSL_TARGETS_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_type(ptr)) +#define sk_OSSL_TARGETS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_type(ptr)) +#define sk_OSSL_TARGETS_pop(sk) ((OSSL_TARGETS *)OPENSSL_sk_pop(ossl_check_OSSL_TARGETS_sk_type(sk))) +#define sk_OSSL_TARGETS_shift(sk) ((OSSL_TARGETS *)OPENSSL_sk_shift(ossl_check_OSSL_TARGETS_sk_type(sk))) +#define sk_OSSL_TARGETS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_freefunc_type(freefunc)) +#define sk_OSSL_TARGETS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_type(ptr), (idx)) +#define sk_OSSL_TARGETS_set(sk, idx, ptr) ((OSSL_TARGETS *)OPENSSL_sk_set(ossl_check_OSSL_TARGETS_sk_type(sk), (idx), ossl_check_OSSL_TARGETS_type(ptr))) +#define sk_OSSL_TARGETS_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_type(ptr)) +#define sk_OSSL_TARGETS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_type(ptr)) +#define sk_OSSL_TARGETS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_type(ptr), pnum) +#define sk_OSSL_TARGETS_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_TARGETS_sk_type(sk)) +#define sk_OSSL_TARGETS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_TARGETS_sk_type(sk)) +#define sk_OSSL_TARGETS_dup(sk) ((STACK_OF(OSSL_TARGETS) *)OPENSSL_sk_dup(ossl_check_const_OSSL_TARGETS_sk_type(sk))) +#define sk_OSSL_TARGETS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_TARGETS) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_copyfunc_type(copyfunc), ossl_check_OSSL_TARGETS_freefunc_type(freefunc))) +#define sk_OSSL_TARGETS_set_cmp_func(sk, cmp) ((sk_OSSL_TARGETS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_TARGETS_sk_type(sk), ossl_check_OSSL_TARGETS_compfunc_type(cmp))) + +/* clang-format on */ + +DECLARE_ASN1_FUNCTIONS(OSSL_TARGET) +DECLARE_ASN1_FUNCTIONS(OSSL_TARGETS) +DECLARE_ASN1_FUNCTIONS(OSSL_TARGETING_INFORMATION) + +typedef STACK_OF(OSSL_ISSUER_SERIAL) OSSL_AUTHORITY_ATTRIBUTE_ID_SYNTAX; +DECLARE_ASN1_FUNCTIONS(OSSL_AUTHORITY_ATTRIBUTE_ID_SYNTAX) + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_ISSUER_SERIAL, OSSL_ISSUER_SERIAL, OSSL_ISSUER_SERIAL) +#define sk_OSSL_ISSUER_SERIAL_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_ISSUER_SERIAL_sk_type(sk)) +#define sk_OSSL_ISSUER_SERIAL_value(sk, idx) ((OSSL_ISSUER_SERIAL *)OPENSSL_sk_value(ossl_check_const_OSSL_ISSUER_SERIAL_sk_type(sk), (idx))) +#define sk_OSSL_ISSUER_SERIAL_new(cmp) ((STACK_OF(OSSL_ISSUER_SERIAL) *)OPENSSL_sk_new(ossl_check_OSSL_ISSUER_SERIAL_compfunc_type(cmp))) +#define sk_OSSL_ISSUER_SERIAL_new_null() ((STACK_OF(OSSL_ISSUER_SERIAL) *)OPENSSL_sk_new_null()) +#define sk_OSSL_ISSUER_SERIAL_new_reserve(cmp, n) ((STACK_OF(OSSL_ISSUER_SERIAL) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_ISSUER_SERIAL_compfunc_type(cmp), (n))) +#define sk_OSSL_ISSUER_SERIAL_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), (n)) +#define sk_OSSL_ISSUER_SERIAL_free(sk) OPENSSL_sk_free(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk)) +#define sk_OSSL_ISSUER_SERIAL_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk)) +#define sk_OSSL_ISSUER_SERIAL_delete(sk, i) ((OSSL_ISSUER_SERIAL *)OPENSSL_sk_delete(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), (i))) +#define sk_OSSL_ISSUER_SERIAL_delete_ptr(sk, ptr) ((OSSL_ISSUER_SERIAL *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_type(ptr))) +#define sk_OSSL_ISSUER_SERIAL_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_type(ptr)) +#define sk_OSSL_ISSUER_SERIAL_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_type(ptr)) +#define sk_OSSL_ISSUER_SERIAL_pop(sk) ((OSSL_ISSUER_SERIAL *)OPENSSL_sk_pop(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk))) +#define sk_OSSL_ISSUER_SERIAL_shift(sk) ((OSSL_ISSUER_SERIAL *)OPENSSL_sk_shift(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk))) +#define sk_OSSL_ISSUER_SERIAL_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_freefunc_type(freefunc)) +#define sk_OSSL_ISSUER_SERIAL_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_type(ptr), (idx)) +#define sk_OSSL_ISSUER_SERIAL_set(sk, idx, ptr) ((OSSL_ISSUER_SERIAL *)OPENSSL_sk_set(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), (idx), ossl_check_OSSL_ISSUER_SERIAL_type(ptr))) +#define sk_OSSL_ISSUER_SERIAL_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_type(ptr)) +#define sk_OSSL_ISSUER_SERIAL_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_type(ptr)) +#define sk_OSSL_ISSUER_SERIAL_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_type(ptr), pnum) +#define sk_OSSL_ISSUER_SERIAL_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk)) +#define sk_OSSL_ISSUER_SERIAL_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_ISSUER_SERIAL_sk_type(sk)) +#define sk_OSSL_ISSUER_SERIAL_dup(sk) ((STACK_OF(OSSL_ISSUER_SERIAL) *)OPENSSL_sk_dup(ossl_check_const_OSSL_ISSUER_SERIAL_sk_type(sk))) +#define sk_OSSL_ISSUER_SERIAL_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_ISSUER_SERIAL) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_copyfunc_type(copyfunc), ossl_check_OSSL_ISSUER_SERIAL_freefunc_type(freefunc))) +#define sk_OSSL_ISSUER_SERIAL_set_cmp_func(sk, cmp) ((sk_OSSL_ISSUER_SERIAL_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_ISSUER_SERIAL_sk_type(sk), ossl_check_OSSL_ISSUER_SERIAL_compfunc_type(cmp))) + +/* clang-format on */ + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/x509_vfy.h b/VCMP-LUA/modules/postgresql/include/openssl/x509_vfy.h new file mode 100644 index 0000000..60c421e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/x509_vfy.h @@ -0,0 +1,922 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\x509_vfy.h.in + * + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_X509_VFY_H +#define OPENSSL_X509_VFY_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_X509_VFY_H +#endif + +/* + * Protect against recursion, x509.h and x509_vfy.h each include the other. + */ +#ifndef OPENSSL_X509_H +#include +#endif + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +DEFINE_STACK_OF(OCSP_RESPONSE) + +/*- +SSL_CTX -> X509_STORE + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + +SSL -> X509_STORE_CTX + ->X509_STORE + +The X509_STORE holds the tables etc for verification stuff. +A X509_STORE_CTX is used while validating a single certificate. +The X509_STORE has X509_LOOKUPs for looking up certs. +The X509_STORE then calls a function to actually verify the +certificate chain. +*/ + +typedef enum { + X509_LU_NONE = 0, + X509_LU_X509, + X509_LU_CRL +} X509_LOOKUP_TYPE; + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define X509_LU_RETRY -1 +#define X509_LU_FAIL 0 +#endif + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_LOOKUP, X509_LOOKUP, X509_LOOKUP) +#define sk_X509_LOOKUP_num(sk) OPENSSL_sk_num(ossl_check_const_X509_LOOKUP_sk_type(sk)) +#define sk_X509_LOOKUP_value(sk, idx) ((X509_LOOKUP *)OPENSSL_sk_value(ossl_check_const_X509_LOOKUP_sk_type(sk), (idx))) +#define sk_X509_LOOKUP_new(cmp) ((STACK_OF(X509_LOOKUP) *)OPENSSL_sk_new(ossl_check_X509_LOOKUP_compfunc_type(cmp))) +#define sk_X509_LOOKUP_new_null() ((STACK_OF(X509_LOOKUP) *)OPENSSL_sk_new_null()) +#define sk_X509_LOOKUP_new_reserve(cmp, n) ((STACK_OF(X509_LOOKUP) *)OPENSSL_sk_new_reserve(ossl_check_X509_LOOKUP_compfunc_type(cmp), (n))) +#define sk_X509_LOOKUP_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_LOOKUP_sk_type(sk), (n)) +#define sk_X509_LOOKUP_free(sk) OPENSSL_sk_free(ossl_check_X509_LOOKUP_sk_type(sk)) +#define sk_X509_LOOKUP_zero(sk) OPENSSL_sk_zero(ossl_check_X509_LOOKUP_sk_type(sk)) +#define sk_X509_LOOKUP_delete(sk, i) ((X509_LOOKUP *)OPENSSL_sk_delete(ossl_check_X509_LOOKUP_sk_type(sk), (i))) +#define sk_X509_LOOKUP_delete_ptr(sk, ptr) ((X509_LOOKUP *)OPENSSL_sk_delete_ptr(ossl_check_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_type(ptr))) +#define sk_X509_LOOKUP_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_type(ptr)) +#define sk_X509_LOOKUP_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_type(ptr)) +#define sk_X509_LOOKUP_pop(sk) ((X509_LOOKUP *)OPENSSL_sk_pop(ossl_check_X509_LOOKUP_sk_type(sk))) +#define sk_X509_LOOKUP_shift(sk) ((X509_LOOKUP *)OPENSSL_sk_shift(ossl_check_X509_LOOKUP_sk_type(sk))) +#define sk_X509_LOOKUP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_freefunc_type(freefunc)) +#define sk_X509_LOOKUP_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_type(ptr), (idx)) +#define sk_X509_LOOKUP_set(sk, idx, ptr) ((X509_LOOKUP *)OPENSSL_sk_set(ossl_check_X509_LOOKUP_sk_type(sk), (idx), ossl_check_X509_LOOKUP_type(ptr))) +#define sk_X509_LOOKUP_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_type(ptr)) +#define sk_X509_LOOKUP_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_type(ptr)) +#define sk_X509_LOOKUP_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_type(ptr), pnum) +#define sk_X509_LOOKUP_sort(sk) OPENSSL_sk_sort(ossl_check_X509_LOOKUP_sk_type(sk)) +#define sk_X509_LOOKUP_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_LOOKUP_sk_type(sk)) +#define sk_X509_LOOKUP_dup(sk) ((STACK_OF(X509_LOOKUP) *)OPENSSL_sk_dup(ossl_check_const_X509_LOOKUP_sk_type(sk))) +#define sk_X509_LOOKUP_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_LOOKUP) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_copyfunc_type(copyfunc), ossl_check_X509_LOOKUP_freefunc_type(freefunc))) +#define sk_X509_LOOKUP_set_cmp_func(sk, cmp) ((sk_X509_LOOKUP_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_LOOKUP_sk_type(sk), ossl_check_X509_LOOKUP_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(X509_OBJECT, X509_OBJECT, X509_OBJECT) +#define sk_X509_OBJECT_num(sk) OPENSSL_sk_num(ossl_check_const_X509_OBJECT_sk_type(sk)) +#define sk_X509_OBJECT_value(sk, idx) ((X509_OBJECT *)OPENSSL_sk_value(ossl_check_const_X509_OBJECT_sk_type(sk), (idx))) +#define sk_X509_OBJECT_new(cmp) ((STACK_OF(X509_OBJECT) *)OPENSSL_sk_new(ossl_check_X509_OBJECT_compfunc_type(cmp))) +#define sk_X509_OBJECT_new_null() ((STACK_OF(X509_OBJECT) *)OPENSSL_sk_new_null()) +#define sk_X509_OBJECT_new_reserve(cmp, n) ((STACK_OF(X509_OBJECT) *)OPENSSL_sk_new_reserve(ossl_check_X509_OBJECT_compfunc_type(cmp), (n))) +#define sk_X509_OBJECT_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_OBJECT_sk_type(sk), (n)) +#define sk_X509_OBJECT_free(sk) OPENSSL_sk_free(ossl_check_X509_OBJECT_sk_type(sk)) +#define sk_X509_OBJECT_zero(sk) OPENSSL_sk_zero(ossl_check_X509_OBJECT_sk_type(sk)) +#define sk_X509_OBJECT_delete(sk, i) ((X509_OBJECT *)OPENSSL_sk_delete(ossl_check_X509_OBJECT_sk_type(sk), (i))) +#define sk_X509_OBJECT_delete_ptr(sk, ptr) ((X509_OBJECT *)OPENSSL_sk_delete_ptr(ossl_check_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_type(ptr))) +#define sk_X509_OBJECT_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_type(ptr)) +#define sk_X509_OBJECT_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_type(ptr)) +#define sk_X509_OBJECT_pop(sk) ((X509_OBJECT *)OPENSSL_sk_pop(ossl_check_X509_OBJECT_sk_type(sk))) +#define sk_X509_OBJECT_shift(sk) ((X509_OBJECT *)OPENSSL_sk_shift(ossl_check_X509_OBJECT_sk_type(sk))) +#define sk_X509_OBJECT_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_freefunc_type(freefunc)) +#define sk_X509_OBJECT_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_type(ptr), (idx)) +#define sk_X509_OBJECT_set(sk, idx, ptr) ((X509_OBJECT *)OPENSSL_sk_set(ossl_check_X509_OBJECT_sk_type(sk), (idx), ossl_check_X509_OBJECT_type(ptr))) +#define sk_X509_OBJECT_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_type(ptr)) +#define sk_X509_OBJECT_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_type(ptr)) +#define sk_X509_OBJECT_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_type(ptr), pnum) +#define sk_X509_OBJECT_sort(sk) OPENSSL_sk_sort(ossl_check_X509_OBJECT_sk_type(sk)) +#define sk_X509_OBJECT_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_OBJECT_sk_type(sk)) +#define sk_X509_OBJECT_dup(sk) ((STACK_OF(X509_OBJECT) *)OPENSSL_sk_dup(ossl_check_const_X509_OBJECT_sk_type(sk))) +#define sk_X509_OBJECT_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_OBJECT) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_copyfunc_type(copyfunc), ossl_check_X509_OBJECT_freefunc_type(freefunc))) +#define sk_X509_OBJECT_set_cmp_func(sk, cmp) ((sk_X509_OBJECT_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_OBJECT_sk_type(sk), ossl_check_X509_OBJECT_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(X509_VERIFY_PARAM, X509_VERIFY_PARAM, X509_VERIFY_PARAM) +#define sk_X509_VERIFY_PARAM_num(sk) OPENSSL_sk_num(ossl_check_const_X509_VERIFY_PARAM_sk_type(sk)) +#define sk_X509_VERIFY_PARAM_value(sk, idx) ((X509_VERIFY_PARAM *)OPENSSL_sk_value(ossl_check_const_X509_VERIFY_PARAM_sk_type(sk), (idx))) +#define sk_X509_VERIFY_PARAM_new(cmp) ((STACK_OF(X509_VERIFY_PARAM) *)OPENSSL_sk_new(ossl_check_X509_VERIFY_PARAM_compfunc_type(cmp))) +#define sk_X509_VERIFY_PARAM_new_null() ((STACK_OF(X509_VERIFY_PARAM) *)OPENSSL_sk_new_null()) +#define sk_X509_VERIFY_PARAM_new_reserve(cmp, n) ((STACK_OF(X509_VERIFY_PARAM) *)OPENSSL_sk_new_reserve(ossl_check_X509_VERIFY_PARAM_compfunc_type(cmp), (n))) +#define sk_X509_VERIFY_PARAM_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_VERIFY_PARAM_sk_type(sk), (n)) +#define sk_X509_VERIFY_PARAM_free(sk) OPENSSL_sk_free(ossl_check_X509_VERIFY_PARAM_sk_type(sk)) +#define sk_X509_VERIFY_PARAM_zero(sk) OPENSSL_sk_zero(ossl_check_X509_VERIFY_PARAM_sk_type(sk)) +#define sk_X509_VERIFY_PARAM_delete(sk, i) ((X509_VERIFY_PARAM *)OPENSSL_sk_delete(ossl_check_X509_VERIFY_PARAM_sk_type(sk), (i))) +#define sk_X509_VERIFY_PARAM_delete_ptr(sk, ptr) ((X509_VERIFY_PARAM *)OPENSSL_sk_delete_ptr(ossl_check_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_type(ptr))) +#define sk_X509_VERIFY_PARAM_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_type(ptr)) +#define sk_X509_VERIFY_PARAM_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_type(ptr)) +#define sk_X509_VERIFY_PARAM_pop(sk) ((X509_VERIFY_PARAM *)OPENSSL_sk_pop(ossl_check_X509_VERIFY_PARAM_sk_type(sk))) +#define sk_X509_VERIFY_PARAM_shift(sk) ((X509_VERIFY_PARAM *)OPENSSL_sk_shift(ossl_check_X509_VERIFY_PARAM_sk_type(sk))) +#define sk_X509_VERIFY_PARAM_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_freefunc_type(freefunc)) +#define sk_X509_VERIFY_PARAM_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_type(ptr), (idx)) +#define sk_X509_VERIFY_PARAM_set(sk, idx, ptr) ((X509_VERIFY_PARAM *)OPENSSL_sk_set(ossl_check_X509_VERIFY_PARAM_sk_type(sk), (idx), ossl_check_X509_VERIFY_PARAM_type(ptr))) +#define sk_X509_VERIFY_PARAM_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_type(ptr)) +#define sk_X509_VERIFY_PARAM_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_type(ptr)) +#define sk_X509_VERIFY_PARAM_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_type(ptr), pnum) +#define sk_X509_VERIFY_PARAM_sort(sk) OPENSSL_sk_sort(ossl_check_X509_VERIFY_PARAM_sk_type(sk)) +#define sk_X509_VERIFY_PARAM_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_VERIFY_PARAM_sk_type(sk)) +#define sk_X509_VERIFY_PARAM_dup(sk) ((STACK_OF(X509_VERIFY_PARAM) *)OPENSSL_sk_dup(ossl_check_const_X509_VERIFY_PARAM_sk_type(sk))) +#define sk_X509_VERIFY_PARAM_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_VERIFY_PARAM) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_copyfunc_type(copyfunc), ossl_check_X509_VERIFY_PARAM_freefunc_type(freefunc))) +#define sk_X509_VERIFY_PARAM_set_cmp_func(sk, cmp) ((sk_X509_VERIFY_PARAM_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_VERIFY_PARAM_sk_type(sk), ossl_check_X509_VERIFY_PARAM_compfunc_type(cmp))) + +/* clang-format on */ + +/* This is used for a table of trust checking functions */ +typedef struct x509_trust_st { + int trust; + int flags; + int (*check_trust)(struct x509_trust_st *, X509 *, int); + char *name; + int arg1; + void *arg2; +} X509_TRUST; +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_TRUST, X509_TRUST, X509_TRUST) +#define sk_X509_TRUST_num(sk) OPENSSL_sk_num(ossl_check_const_X509_TRUST_sk_type(sk)) +#define sk_X509_TRUST_value(sk, idx) ((X509_TRUST *)OPENSSL_sk_value(ossl_check_const_X509_TRUST_sk_type(sk), (idx))) +#define sk_X509_TRUST_new(cmp) ((STACK_OF(X509_TRUST) *)OPENSSL_sk_new(ossl_check_X509_TRUST_compfunc_type(cmp))) +#define sk_X509_TRUST_new_null() ((STACK_OF(X509_TRUST) *)OPENSSL_sk_new_null()) +#define sk_X509_TRUST_new_reserve(cmp, n) ((STACK_OF(X509_TRUST) *)OPENSSL_sk_new_reserve(ossl_check_X509_TRUST_compfunc_type(cmp), (n))) +#define sk_X509_TRUST_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_TRUST_sk_type(sk), (n)) +#define sk_X509_TRUST_free(sk) OPENSSL_sk_free(ossl_check_X509_TRUST_sk_type(sk)) +#define sk_X509_TRUST_zero(sk) OPENSSL_sk_zero(ossl_check_X509_TRUST_sk_type(sk)) +#define sk_X509_TRUST_delete(sk, i) ((X509_TRUST *)OPENSSL_sk_delete(ossl_check_X509_TRUST_sk_type(sk), (i))) +#define sk_X509_TRUST_delete_ptr(sk, ptr) ((X509_TRUST *)OPENSSL_sk_delete_ptr(ossl_check_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_type(ptr))) +#define sk_X509_TRUST_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_type(ptr)) +#define sk_X509_TRUST_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_type(ptr)) +#define sk_X509_TRUST_pop(sk) ((X509_TRUST *)OPENSSL_sk_pop(ossl_check_X509_TRUST_sk_type(sk))) +#define sk_X509_TRUST_shift(sk) ((X509_TRUST *)OPENSSL_sk_shift(ossl_check_X509_TRUST_sk_type(sk))) +#define sk_X509_TRUST_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_freefunc_type(freefunc)) +#define sk_X509_TRUST_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_type(ptr), (idx)) +#define sk_X509_TRUST_set(sk, idx, ptr) ((X509_TRUST *)OPENSSL_sk_set(ossl_check_X509_TRUST_sk_type(sk), (idx), ossl_check_X509_TRUST_type(ptr))) +#define sk_X509_TRUST_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_type(ptr)) +#define sk_X509_TRUST_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_type(ptr)) +#define sk_X509_TRUST_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_type(ptr), pnum) +#define sk_X509_TRUST_sort(sk) OPENSSL_sk_sort(ossl_check_X509_TRUST_sk_type(sk)) +#define sk_X509_TRUST_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_TRUST_sk_type(sk)) +#define sk_X509_TRUST_dup(sk) ((STACK_OF(X509_TRUST) *)OPENSSL_sk_dup(ossl_check_const_X509_TRUST_sk_type(sk))) +#define sk_X509_TRUST_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_TRUST) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_copyfunc_type(copyfunc), ossl_check_X509_TRUST_freefunc_type(freefunc))) +#define sk_X509_TRUST_set_cmp_func(sk, cmp) ((sk_X509_TRUST_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_TRUST_sk_type(sk), ossl_check_X509_TRUST_compfunc_type(cmp))) + +/* clang-format on */ + +/* standard trust ids */ +#define X509_TRUST_DEFAULT 0 /* Only valid in purpose settings */ +#define X509_TRUST_COMPAT 1 +#define X509_TRUST_SSL_CLIENT 2 +#define X509_TRUST_SSL_SERVER 3 +#define X509_TRUST_EMAIL 4 +#define X509_TRUST_OBJECT_SIGN 5 +#define X509_TRUST_OCSP_SIGN 6 +#define X509_TRUST_OCSP_REQUEST 7 +#define X509_TRUST_TSA 8 +/* Keep these up to date! */ +#define X509_TRUST_MIN 1 +#define X509_TRUST_MAX 8 + +/* trust_flags values */ +#define X509_TRUST_DYNAMIC (1U << 0) +#define X509_TRUST_DYNAMIC_NAME (1U << 1) +/* No compat trust if self-signed, preempts "DO_SS" */ +#define X509_TRUST_NO_SS_COMPAT (1U << 2) +/* Compat trust if no explicit accepted trust EKUs */ +#define X509_TRUST_DO_SS_COMPAT (1U << 3) +/* Accept "anyEKU" as a wildcard rejection OID and as a wildcard trust OID */ +#define X509_TRUST_OK_ANY_EKU (1U << 4) + +/* check_trust return codes */ +#define X509_TRUST_TRUSTED 1 +#define X509_TRUST_REJECTED 2 +#define X509_TRUST_UNTRUSTED 3 + +int X509_TRUST_set(int *t, int trust); +int X509_TRUST_get_count(void); +X509_TRUST *X509_TRUST_get0(int idx); +int X509_TRUST_get_by_id(int id); +int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int), + const char *name, int arg1, void *arg2); +void X509_TRUST_cleanup(void); +int X509_TRUST_get_flags(const X509_TRUST *xp); +char *X509_TRUST_get0_name(const X509_TRUST *xp); +int X509_TRUST_get_trust(const X509_TRUST *xp); + +int X509_trusted(const X509 *x); +int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); +int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj); +void X509_trust_clear(X509 *x); +void X509_reject_clear(X509 *x); +STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x); +STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x); + +int (*X509_TRUST_set_default(int (*trust)(int, X509 *, int)))(int, X509 *, + int); +int X509_check_trust(X509 *x, int id, int flags); + +int X509_verify_cert(X509_STORE_CTX *ctx); +int X509_STORE_CTX_verify(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_build_chain(X509 *target, STACK_OF(X509) *certs, + X509_STORE *store, int with_self_signed, + OSSL_LIB_CTX *libctx, const char *propq); + +int X509_STORE_set_depth(X509_STORE *store, int depth); + +typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *); +int X509_STORE_CTX_print_verify_cb(int ok, X509_STORE_CTX *ctx); +typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); +typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer, + X509_STORE_CTX *ctx, X509 *x); +typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx, + X509 *x, X509 *issuer); +typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx); +typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx, + X509_CRL **crl, X509 *x); +typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl); +typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx, + X509_CRL *crl, X509 *x); +typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx); +typedef STACK_OF(X509) + *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx, + const X509_NAME *nm); +typedef STACK_OF(X509_CRL) + *(*X509_STORE_CTX_lookup_crls_fn)(const X509_STORE_CTX *ctx, + const X509_NAME *nm); +typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx); + +void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); + +#define X509_STORE_CTX_set_app_data(ctx, data) \ + X509_STORE_CTX_set_ex_data(ctx, 0, data) +#define X509_STORE_CTX_get_app_data(ctx) \ + X509_STORE_CTX_get_ex_data(ctx, 0) + +#define X509_L_FILE_LOAD 1 +#define X509_L_ADD_DIR 2 +#define X509_L_ADD_STORE 3 +#define X509_L_LOAD_STORE 4 + +#define X509_LOOKUP_load_file(x, name, type) \ + X509_LOOKUP_ctrl((x), X509_L_FILE_LOAD, (name), (long)(type), NULL) + +#define X509_LOOKUP_add_dir(x, name, type) \ + X509_LOOKUP_ctrl((x), X509_L_ADD_DIR, (name), (long)(type), NULL) + +#define X509_LOOKUP_add_store(x, name) \ + X509_LOOKUP_ctrl((x), X509_L_ADD_STORE, (name), 0, NULL) + +#define X509_LOOKUP_load_store(x, name) \ + X509_LOOKUP_ctrl((x), X509_L_LOAD_STORE, (name), 0, NULL) + +#define X509_LOOKUP_load_file_ex(x, name, type, libctx, propq) \ + X509_LOOKUP_ctrl_ex((x), X509_L_FILE_LOAD, (name), (long)(type), NULL, \ + (libctx), (propq)) + +#define X509_LOOKUP_load_store_ex(x, name, libctx, propq) \ + X509_LOOKUP_ctrl_ex((x), X509_L_LOAD_STORE, (name), 0, NULL, \ + (libctx), (propq)) + +#define X509_LOOKUP_add_store_ex(x, name, libctx, propq) \ + X509_LOOKUP_ctrl_ex((x), X509_L_ADD_STORE, (name), 0, NULL, \ + (libctx), (propq)) + +#define X509_V_OK 0 +#define X509_V_ERR_UNSPECIFIED 1 +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 +#define X509_V_ERR_UNABLE_TO_GET_CRL 3 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +#define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +#define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 +#define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 +#define X509_V_ERR_CERT_NOT_YET_VALID 9 +#define X509_V_ERR_CERT_HAS_EXPIRED 10 +#define X509_V_ERR_CRL_NOT_YET_VALID 11 +#define X509_V_ERR_CRL_HAS_EXPIRED 12 +#define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +#define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +#define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +#define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +#define X509_V_ERR_OUT_OF_MEM 17 +#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +#define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +#define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +#define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 +#define X509_V_ERR_CERT_REVOKED 23 +#define X509_V_ERR_NO_ISSUER_PUBLIC_KEY 24 +#define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 +#define X509_V_ERR_INVALID_PURPOSE 26 +#define X509_V_ERR_CERT_UNTRUSTED 27 +#define X509_V_ERR_CERT_REJECTED 28 + +/* These are 'informational' when looking for issuer cert */ +#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 +#define X509_V_ERR_AKID_SKID_MISMATCH 30 +#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 +#define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 +#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 +#define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 +#define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +#define X509_V_ERR_INVALID_NON_CA 37 +#define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +#define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 +#define X509_V_ERR_INVALID_EXTENSION 41 +#define X509_V_ERR_INVALID_POLICY_EXTENSION 42 +#define X509_V_ERR_NO_EXPLICIT_POLICY 43 +#define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 +#define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 +#define X509_V_ERR_UNNESTED_RESOURCE 46 +#define X509_V_ERR_PERMITTED_VIOLATION 47 +#define X509_V_ERR_EXCLUDED_VIOLATION 48 +#define X509_V_ERR_SUBTREE_MINMAX 49 +/* The application is not happy */ +#define X509_V_ERR_APPLICATION_VERIFICATION 50 +#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 +#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 +#define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 +#define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 +/* Another issuer check debug option */ +#define X509_V_ERR_PATH_LOOP 55 +/* Suite B mode algorithm violation */ +#define X509_V_ERR_SUITE_B_INVALID_VERSION 56 +#define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 +#define X509_V_ERR_SUITE_B_INVALID_CURVE 58 +#define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 +#define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 +#define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 +/* Host, email and IP check errors */ +#define X509_V_ERR_HOSTNAME_MISMATCH 62 +#define X509_V_ERR_EMAIL_MISMATCH 63 +#define X509_V_ERR_IP_ADDRESS_MISMATCH 64 +/* DANE TLSA errors */ +#define X509_V_ERR_DANE_NO_MATCH 65 +/* security level errors */ +#define X509_V_ERR_EE_KEY_TOO_SMALL 66 +#define X509_V_ERR_CA_KEY_TOO_SMALL 67 +#define X509_V_ERR_CA_MD_TOO_WEAK 68 +/* Caller error */ +#define X509_V_ERR_INVALID_CALL 69 +/* Issuer lookup error */ +#define X509_V_ERR_STORE_LOOKUP 70 +/* Certificate transparency */ +#define X509_V_ERR_NO_VALID_SCTS 71 + +#define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72 +/* OCSP status errors */ +#define X509_V_ERR_OCSP_VERIFY_NEEDED 73 /* Need OCSP verification */ +#define X509_V_ERR_OCSP_VERIFY_FAILED 74 /* Couldn't verify cert through OCSP */ +#define X509_V_ERR_OCSP_CERT_UNKNOWN 75 /* Certificate wasn't recognized by the OCSP responder */ + +#define X509_V_ERR_UNSUPPORTED_SIGNATURE_ALGORITHM 76 +#define X509_V_ERR_SIGNATURE_ALGORITHM_MISMATCH 77 + +/* Errors in case a check in X509_V_FLAG_X509_STRICT mode fails */ +#define X509_V_ERR_SIGNATURE_ALGORITHM_INCONSISTENCY 78 +#define X509_V_ERR_INVALID_CA 79 +#define X509_V_ERR_PATHLEN_INVALID_FOR_NON_CA 80 +#define X509_V_ERR_PATHLEN_WITHOUT_KU_KEY_CERT_SIGN 81 +#define X509_V_ERR_KU_KEY_CERT_SIGN_INVALID_FOR_NON_CA 82 +#define X509_V_ERR_ISSUER_NAME_EMPTY 83 +#define X509_V_ERR_SUBJECT_NAME_EMPTY 84 +#define X509_V_ERR_MISSING_AUTHORITY_KEY_IDENTIFIER 85 +#define X509_V_ERR_MISSING_SUBJECT_KEY_IDENTIFIER 86 +#define X509_V_ERR_EMPTY_SUBJECT_ALT_NAME 87 +#define X509_V_ERR_EMPTY_SUBJECT_SAN_NOT_CRITICAL 88 +#define X509_V_ERR_CA_BCONS_NOT_CRITICAL 89 +#define X509_V_ERR_AUTHORITY_KEY_IDENTIFIER_CRITICAL 90 +#define X509_V_ERR_SUBJECT_KEY_IDENTIFIER_CRITICAL 91 +#define X509_V_ERR_CA_CERT_MISSING_KEY_USAGE 92 +#define X509_V_ERR_EXTENSIONS_REQUIRE_VERSION_3 93 +#define X509_V_ERR_EC_KEY_EXPLICIT_PARAMS 94 +#define X509_V_ERR_RPK_UNTRUSTED 95 + +/* additional OCSP status errors */ +#define X509_V_ERR_OCSP_RESP_INVALID 96 +#define X509_V_ERR_OCSP_SIGNATURE_FAILURE 97 +#define X509_V_ERR_OCSP_NOT_YET_VALID 98 +#define X509_V_ERR_OCSP_HAS_EXPIRED 99 +#define X509_V_ERR_OCSP_NO_RESPONSE 100 +#define X509_V_ERR_CRL_VERIFY_FAILED 101 + +/* Certificate verify flags */ +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define X509_V_FLAG_CB_ISSUER_CHECK 0x0 /* Deprecated */ +#endif +/* Use check time instead of current time */ +#define X509_V_FLAG_USE_CHECK_TIME 0x2 +/* Lookup CRLs */ +#define X509_V_FLAG_CRL_CHECK 0x4 +/* Lookup CRLs for whole chain */ +#define X509_V_FLAG_CRL_CHECK_ALL 0x8 +/* Ignore unhandled critical extensions */ +#define X509_V_FLAG_IGNORE_CRITICAL 0x10 +/* Disable workarounds for broken certificates */ +#define X509_V_FLAG_X509_STRICT 0x20 +/* Enable proxy certificate validation */ +#define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 +/* Enable policy checking */ +#define X509_V_FLAG_POLICY_CHECK 0x80 +/* Policy variable require-explicit-policy */ +#define X509_V_FLAG_EXPLICIT_POLICY 0x100 +/* Policy variable inhibit-any-policy */ +#define X509_V_FLAG_INHIBIT_ANY 0x200 +/* Policy variable inhibit-policy-mapping */ +#define X509_V_FLAG_INHIBIT_MAP 0x400 +/* Notify callback that policy is OK */ +#define X509_V_FLAG_NOTIFY_POLICY 0x800 +/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ +#define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 +/* Delta CRL support */ +#define X509_V_FLAG_USE_DELTAS 0x2000 +/* Check self-signed CA signature */ +#define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 +/* Use trusted store first */ +#define X509_V_FLAG_TRUSTED_FIRST 0x8000 +/* Suite B 128 bit only mode: not normally used */ +#define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +#define X509_V_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +#define X509_V_FLAG_SUITEB_128_LOS 0x30000 +/* Allow partial chains if at least one certificate is in trusted store */ +#define X509_V_FLAG_PARTIAL_CHAIN 0x80000 +/* + * If the initial chain is not trusted, do not attempt to build an alternative + * chain. Alternate chain checking was introduced in 1.1.0. Setting this flag + * will force the behaviour to match that of previous versions. + */ +#define X509_V_FLAG_NO_ALT_CHAINS 0x100000 +/* Do not check certificate/CRL validity against current time */ +#define X509_V_FLAG_NO_CHECK_TIME 0x200000 + +/* Verify OCSP stapling response for server certificate */ +#define X509_V_FLAG_OCSP_RESP_CHECK 0x400000 +/* Verify OCSP stapling responses for whole chain */ +#define X509_V_FLAG_OCSP_RESP_CHECK_ALL 0x800000 + +#define X509_VP_FLAG_DEFAULT 0x1 +#define X509_VP_FLAG_OVERWRITE 0x2 +#define X509_VP_FLAG_RESET_FLAGS 0x4 +#define X509_VP_FLAG_LOCKED 0x8 +#define X509_VP_FLAG_ONCE 0x10 + +/* Internal use: mask of policy related options */ +#define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ + | X509_V_FLAG_EXPLICIT_POLICY \ + | X509_V_FLAG_INHIBIT_ANY \ + | X509_V_FLAG_INHIBIT_MAP) + +int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, + const X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, + X509_LOOKUP_TYPE type, + const X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, + X509_OBJECT *x); +int X509_OBJECT_up_ref_count(X509_OBJECT *a); +X509_OBJECT *X509_OBJECT_new(void); +void X509_OBJECT_free(X509_OBJECT *a); +X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); +X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a); +int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj); +X509_CRL *X509_OBJECT_get0_X509_CRL(const X509_OBJECT *a); +int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj); +X509_STORE *X509_STORE_new(void); +void X509_STORE_free(X509_STORE *xs); +int X509_STORE_lock(X509_STORE *xs); +int X509_STORE_unlock(X509_STORE *xs); +int X509_STORE_up_ref(X509_STORE *xs); +STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(const X509_STORE *xs); +STACK_OF(X509_OBJECT) *X509_STORE_get1_objects(X509_STORE *xs); +STACK_OF(X509) *X509_STORE_get1_all_certs(X509_STORE *xs); +STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *xs, + const X509_NAME *nm); +STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(const X509_STORE_CTX *st, + const X509_NAME *nm); +int X509_STORE_set_flags(X509_STORE *xs, unsigned long flags); +int X509_STORE_set_purpose(X509_STORE *xs, int purpose); +int X509_STORE_set_trust(X509_STORE *xs, int trust); +int X509_STORE_set1_param(X509_STORE *xs, const X509_VERIFY_PARAM *pm); +X509_VERIFY_PARAM *X509_STORE_get0_param(const X509_STORE *xs); + +void X509_STORE_set_verify(X509_STORE *xs, X509_STORE_CTX_verify_fn verify); +#define X509_STORE_set_verify_func(ctx, func) \ + X509_STORE_set_verify((ctx), (func)) +void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, + X509_STORE_CTX_verify_fn verify); +X509_STORE_CTX_verify_fn X509_STORE_get_verify(const X509_STORE *xs); +void X509_STORE_set_verify_cb(X509_STORE *xs, + X509_STORE_CTX_verify_cb verify_cb); +#define X509_STORE_set_verify_cb_func(ctx, func) \ + X509_STORE_set_verify_cb((ctx), (func)) +X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(const X509_STORE *xs); +void X509_STORE_set_get_issuer(X509_STORE *xs, + X509_STORE_CTX_get_issuer_fn get_issuer); +X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(const X509_STORE *xs); +void X509_STORE_set_check_issued(X509_STORE *xs, + X509_STORE_CTX_check_issued_fn check_issued); +X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(const X509_STORE *s); +void X509_STORE_set_check_revocation(X509_STORE *xs, + X509_STORE_CTX_check_revocation_fn check_revocation); +X509_STORE_CTX_check_revocation_fn +X509_STORE_get_check_revocation(const X509_STORE *xs); +void X509_STORE_set_get_crl(X509_STORE *xs, + X509_STORE_CTX_get_crl_fn get_crl); +X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(const X509_STORE *xs); +void X509_STORE_set_check_crl(X509_STORE *xs, + X509_STORE_CTX_check_crl_fn check_crl); +X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(const X509_STORE *xs); +void X509_STORE_set_cert_crl(X509_STORE *xs, + X509_STORE_CTX_cert_crl_fn cert_crl); +X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(const X509_STORE *xs); +void X509_STORE_set_check_policy(X509_STORE *xs, + X509_STORE_CTX_check_policy_fn check_policy); +X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(const X509_STORE *s); +void X509_STORE_set_lookup_certs(X509_STORE *xs, + X509_STORE_CTX_lookup_certs_fn lookup_certs); +X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(const X509_STORE *s); +void X509_STORE_set_lookup_crls(X509_STORE *xs, + X509_STORE_CTX_lookup_crls_fn lookup_crls); +#define X509_STORE_set_lookup_crls_cb(ctx, func) \ + X509_STORE_set_lookup_crls((ctx), (func)) +X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(const X509_STORE *xs); +void X509_STORE_set_cleanup(X509_STORE *xs, + X509_STORE_CTX_cleanup_fn cleanup); +X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(const X509_STORE *xs); + +#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, l, p, newf, dupf, freef) +int X509_STORE_set_ex_data(X509_STORE *xs, int idx, void *data); +void *X509_STORE_get_ex_data(const X509_STORE *xs, int idx); + +X509_STORE_CTX *X509_STORE_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq); +X509_STORE_CTX *X509_STORE_CTX_new(void); + +int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); + +void X509_STORE_CTX_free(X509_STORE_CTX *ctx); +int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *trust_store, + X509 *target, STACK_OF(X509) *untrusted); +int X509_STORE_CTX_init_rpk(X509_STORE_CTX *ctx, X509_STORE *trust_store, + EVP_PKEY *rpk); +void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); + +X509_STORE *X509_STORE_CTX_get0_store(const X509_STORE_CTX *ctx); +X509 *X509_STORE_CTX_get0_cert(const X509_STORE_CTX *ctx); +EVP_PKEY *X509_STORE_CTX_get0_rpk(const X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get0_untrusted(const X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, + X509_STORE_CTX_verify_cb verify); +X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(const X509_STORE_CTX *ctx); +X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(const X509_STORE_CTX *ctx); +X509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(const X509_STORE_CTX *ctx); +X509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(const X509_STORE_CTX *ctx); +X509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(const X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_get_crl(X509_STORE_CTX *ctx, + X509_STORE_CTX_get_crl_fn get_crl); +X509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(const X509_STORE_CTX *ctx); +X509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(const X509_STORE_CTX *ctx); +X509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(const X509_STORE_CTX *ctx); +X509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(const X509_STORE_CTX *ctx); +X509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(const X509_STORE_CTX *ctx); +X509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(const X509_STORE_CTX *ctx); +X509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(const X509_STORE_CTX *ctx); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +#define X509_STORE_CTX_get_chain X509_STORE_CTX_get0_chain +#define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted +#define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack +#define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject +#define X509_STORE_get1_certs X509_STORE_CTX_get1_certs +#define X509_STORE_get1_crls X509_STORE_CTX_get1_crls +/* the following macro is misspelled; use X509_STORE_get1_certs instead */ +#define X509_STORE_get1_cert X509_STORE_CTX_get1_certs +/* the following macro is misspelled; use X509_STORE_get1_crls instead */ +#define X509_STORE_get1_crl X509_STORE_CTX_get1_crls +#endif + +X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *xs, X509_LOOKUP_METHOD *m); +X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); +X509_LOOKUP_METHOD *X509_LOOKUP_file(void); +X509_LOOKUP_METHOD *X509_LOOKUP_store(void); + +typedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); +typedef int (*X509_LOOKUP_ctrl_ex_fn)( + X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret, + OSSL_LIB_CTX *libctx, const char *propq); + +typedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const X509_NAME *name, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_subject_ex_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const X509_NAME *name, + X509_OBJECT *ret, + OSSL_LIB_CTX *libctx, + const char *propq); +typedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const X509_NAME *name, + const ASN1_INTEGER *serial, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const unsigned char *bytes, + int len, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const char *str, + int len, + X509_OBJECT *ret); + +X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name); +void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method, + int (*new_item)(X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD *method))(X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method, + void (*free_fn)(X509_LOOKUP *ctx)); +void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD *method))(X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method, + int (*init)(X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD *method))(X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method, + int (*shutdown)(X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD *method))(X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method, + X509_LOOKUP_ctrl_fn ctrl_fn); +X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_subject_fn fn); +X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_issuer_serial(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_issuer_serial_fn fn); +X509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_fingerprint_fn fn); +X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_alias_fn fn); +X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias( + const X509_LOOKUP_METHOD *method); + +int X509_STORE_add_cert(X509_STORE *xs, X509 *x); +int X509_STORE_add_crl(X509_STORE *xs, X509_CRL *x); + +int X509_STORE_CTX_get_by_subject(const X509_STORE_CTX *vs, + X509_LOOKUP_TYPE type, + const X509_NAME *name, X509_OBJECT *ret); +X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, + X509_LOOKUP_TYPE type, + const X509_NAME *name); + +int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); +int X509_LOOKUP_ctrl_ex(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, + char **ret, OSSL_LIB_CTX *libctx, const char *propq); + +int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_cert_file_ex(X509_LOOKUP *ctx, const char *file, int type, + OSSL_LIB_CTX *libctx, const char *propq); +int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_cert_crl_file_ex(X509_LOOKUP *ctx, const char *file, int type, + OSSL_LIB_CTX *libctx, const char *propq); + +X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); +void X509_LOOKUP_free(X509_LOOKUP *ctx); +int X509_LOOKUP_init(X509_LOOKUP *ctx); +int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const X509_NAME *name, X509_OBJECT *ret); +int X509_LOOKUP_by_subject_ex(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const X509_NAME *name, X509_OBJECT *ret, + OSSL_LIB_CTX *libctx, const char *propq); +int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const X509_NAME *name, + const ASN1_INTEGER *serial, + X509_OBJECT *ret); +int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const unsigned char *bytes, int len, + X509_OBJECT *ret); +int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const char *str, int len, X509_OBJECT *ret); +int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data); +void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx); +X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx); +int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); + +int X509_STORE_load_file(X509_STORE *xs, const char *file); +int X509_STORE_load_path(X509_STORE *xs, const char *path); +int X509_STORE_load_store(X509_STORE *xs, const char *store); +int X509_STORE_load_locations(X509_STORE *s, const char *file, const char *dir); +int X509_STORE_set_default_paths(X509_STORE *xs); + +int X509_STORE_load_file_ex(X509_STORE *xs, const char *file, + OSSL_LIB_CTX *libctx, const char *propq); +int X509_STORE_load_store_ex(X509_STORE *xs, const char *store, + OSSL_LIB_CTX *libctx, const char *propq); +int X509_STORE_load_locations_ex(X509_STORE *xs, + const char *file, const char *dir, + OSSL_LIB_CTX *libctx, const char *propq); +int X509_STORE_set_default_paths_ex(X509_STORE *xs, + OSSL_LIB_CTX *libctx, const char *propq); + +#define X509_STORE_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE_CTX, l, p, newf, dupf, freef) +int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data); +void *X509_STORE_CTX_get_ex_data(const X509_STORE_CTX *ctx, int idx); +int X509_STORE_CTX_get_error(const X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s); +int X509_STORE_CTX_get_error_depth(const X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth); +X509 *X509_STORE_CTX_get_current_cert(const X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x); +X509 *X509_STORE_CTX_get0_current_issuer(const X509_STORE_CTX *ctx); +X509_CRL *X509_STORE_CTX_get0_current_crl(const X509_STORE_CTX *ctx); +X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(const X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get0_chain(const X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get1_chain(const X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *target); +void X509_STORE_CTX_set0_rpk(X509_STORE_CTX *ctx, EVP_PKEY *target); +void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk); +void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk); +#ifndef OPENSSL_NO_OCSP +void X509_STORE_CTX_set_ocsp_resp(X509_STORE_CTX *ctx, STACK_OF(OCSP_RESPONSE) *sk); +#endif +int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); +int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); +int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, + int purpose, int trust); +void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); +void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, + time_t t); +void X509_STORE_CTX_set_current_reasons(X509_STORE_CTX *ctx, + unsigned int current_reasons); + +X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(const X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_explicit_policy(const X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_num_untrusted(const X509_STORE_CTX *ctx); + +X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(const X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); +int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); + +/* + * Bridge opacity barrier between libcrypt and libssl, also needed to support + * offline testing in test/danetest.c + */ +void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane); +#define DANE_FLAG_NO_DANE_EE_NAMECHECKS (1L << 0) + +/* X509_VERIFY_PARAM functions */ + +X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); +void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); +int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +unsigned long X509_VERIFY_PARAM_get_flags(const X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); +int X509_VERIFY_PARAM_get_purpose(const X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); +void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); +void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level); +time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param); +void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); +int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, + ASN1_OBJECT *policy); +int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, + STACK_OF(ASN1_OBJECT) *policies); + +int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, + uint32_t flags); +uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param); + +char *X509_VERIFY_PARAM_get0_host(X509_VERIFY_PARAM *param, int idx); +int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, + const char *name, size_t namelen); +int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, + const char *name, size_t namelen); +void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, + unsigned int flags); +unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param); +char *X509_VERIFY_PARAM_get0_peername(const X509_VERIFY_PARAM *param); +void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *, X509_VERIFY_PARAM *); +char *X509_VERIFY_PARAM_get0_email(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, + const char *email, size_t emaillen); +char *X509_VERIFY_PARAM_get1_ip_asc(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, + const unsigned char *ip, size_t iplen); +int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, + const char *ipasc); + +int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param); +const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); + +int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_get_count(void); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); +void X509_VERIFY_PARAM_table_cleanup(void); + +/* Non positive return values are errors */ +#define X509_PCY_TREE_FAILURE -2 /* Failure to satisfy explicit policy */ +#define X509_PCY_TREE_INVALID -1 /* Inconsistent or invalid extensions */ +#define X509_PCY_TREE_INTERNAL 0 /* Internal error, most likely malloc */ + +/* + * Positive return values form a bit mask, all but the first are internal to + * the library and don't appear in results from X509_policy_check(). + */ +#define X509_PCY_TREE_VALID 1 /* The policy tree is valid */ +#define X509_PCY_TREE_EMPTY 2 /* The policy tree is empty */ +#define X509_PCY_TREE_EXPLICIT 4 /* Explicit policy required */ + +int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, + STACK_OF(X509) *certs, + STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags); + +void X509_policy_tree_free(X509_POLICY_TREE *tree); + +int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); +X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, + int i); + +STACK_OF(X509_POLICY_NODE) +*X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree); + +STACK_OF(X509_POLICY_NODE) +*X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree); + +int X509_policy_level_node_count(X509_POLICY_LEVEL *level); + +X509_POLICY_NODE *X509_policy_level_get0_node(const X509_POLICY_LEVEL *level, + int i); + +const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); + +STACK_OF(POLICYQUALINFO) +*X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node); +const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE *node); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/x509err.h b/VCMP-LUA/modules/postgresql/include/openssl/x509err.h new file mode 100644 index 0000000..7123a72 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/x509err.h @@ -0,0 +1,68 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_X509ERR_H +#define OPENSSL_X509ERR_H +#pragma once + +#include +#include +#include + +/* + * X509 reason codes. + */ +#define X509_R_AKID_MISMATCH 110 +#define X509_R_BAD_SELECTOR 133 +#define X509_R_BAD_X509_FILETYPE 100 +#define X509_R_BASE64_DECODE_ERROR 118 +#define X509_R_CANT_CHECK_DH_KEY 114 +#define X509_R_CERTIFICATE_VERIFICATION_FAILED 139 +#define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +#define X509_R_CRL_ALREADY_DELTA 127 +#define X509_R_CRL_VERIFY_FAILURE 131 +#define X509_R_DUPLICATE_ATTRIBUTE 140 +#define X509_R_ERROR_GETTING_MD_BY_NID 141 +#define X509_R_ERROR_USING_SIGINF_SET 142 +#define X509_R_IDP_MISMATCH 128 +#define X509_R_INVALID_ATTRIBUTES 138 +#define X509_R_INVALID_DIRECTORY 113 +#define X509_R_INVALID_DISTPOINT 143 +#define X509_R_INVALID_FIELD_NAME 119 +#define X509_R_INVALID_TRUST 123 +#define X509_R_ISSUER_MISMATCH 129 +#define X509_R_KEY_TYPE_MISMATCH 115 +#define X509_R_KEY_VALUES_MISMATCH 116 +#define X509_R_LOADING_CERT_DIR 103 +#define X509_R_LOADING_DEFAULTS 104 +#define X509_R_METHOD_NOT_SUPPORTED 124 +#define X509_R_NAME_TOO_LONG 134 +#define X509_R_NEWER_CRL_NOT_NEWER 132 +#define X509_R_NO_CERTIFICATE_FOUND 135 +#define X509_R_NO_CERTIFICATE_OR_CRL_FOUND 136 +#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 +#define X509_R_NO_CRL_FOUND 137 +#define X509_R_NO_CRL_NUMBER 130 +#define X509_R_PUBLIC_KEY_DECODE_ERROR 125 +#define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 +#define X509_R_SHOULD_RETRY 106 +#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 +#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 +#define X509_R_UNKNOWN_KEY_TYPE 117 +#define X509_R_UNKNOWN_NID 109 +#define X509_R_UNKNOWN_PURPOSE_ID 121 +#define X509_R_UNKNOWN_SIGID_ALGS 144 +#define X509_R_UNKNOWN_TRUST_ID 120 +#define X509_R_UNSUPPORTED_ALGORITHM 111 +#define X509_R_UNSUPPORTED_VERSION 145 +#define X509_R_WRONG_LOOKUP_TYPE 112 +#define X509_R_WRONG_TYPE 122 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/x509v3.h b/VCMP-LUA/modules/postgresql/include/openssl/x509v3.h new file mode 100644 index 0000000..25fb8f9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/x509v3.h @@ -0,0 +1,2013 @@ +/* + * WARNING: do not edit! + * Generated by makefile from include\openssl\x509v3.h.in + * + * Copyright 1999-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* clang-format off */ + +/* clang-format on */ + +#ifndef OPENSSL_X509V3_H +#define OPENSSL_X509V3_H +#pragma once + +#include +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define HEADER_X509V3_H +#endif + +#include +#include +#include +#include +#ifndef OPENSSL_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward reference */ +struct v3_ext_method; +struct v3_ext_ctx; + +/* Useful typedefs */ + +typedef void *(*X509V3_EXT_NEW)(void); +typedef void (*X509V3_EXT_FREE)(void *); +typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); +typedef int (*X509V3_EXT_I2D)(const void *, unsigned char **); +typedef STACK_OF(CONF_VALUE) *(*X509V3_EXT_I2V)(const struct v3_ext_method *method, void *ext, + STACK_OF(CONF_VALUE) *extlist); +typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, + STACK_OF(CONF_VALUE) *values); +typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, + void *ext); +typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); +typedef int (*X509V3_EXT_I2R)(const struct v3_ext_method *method, void *ext, + BIO *out, int indent); +typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); + +/* V3 extension structure */ + +struct v3_ext_method { + int ext_nid; + int ext_flags; + /* If this is set the following four fields are ignored */ + ASN1_ITEM_EXP *it; + /* Old style ASN1 calls */ + X509V3_EXT_NEW ext_new; + X509V3_EXT_FREE ext_free; + X509V3_EXT_D2I d2i; + X509V3_EXT_I2D i2d; + /* The following pair is used for string extensions */ + X509V3_EXT_I2S i2s; + X509V3_EXT_S2I s2i; + /* The following pair is used for multi-valued extensions */ + X509V3_EXT_I2V i2v; + X509V3_EXT_V2I v2i; + /* The following are used for raw extensions */ + X509V3_EXT_I2R i2r; + X509V3_EXT_R2I r2i; + void *usr_data; /* Any extension specific data */ +}; + +typedef struct X509V3_CONF_METHOD_st { + char *(*get_string)(void *db, const char *section, const char *value); + STACK_OF(CONF_VALUE) *(*get_section)(void *db, const char *section); + void (*free_string)(void *db, char *string); + void (*free_section)(void *db, STACK_OF(CONF_VALUE) *section); +} X509V3_CONF_METHOD; + +/* Context specific info for producing X509 v3 extensions*/ +struct v3_ext_ctx { +#define X509V3_CTX_TEST 0x1 +#ifndef OPENSSL_NO_DEPRECATED_3_0 +#define CTX_TEST X509V3_CTX_TEST +#endif +#define X509V3_CTX_REPLACE 0x2 + int flags; + X509 *issuer_cert; + X509 *subject_cert; + X509_REQ *subject_req; + X509_CRL *crl; + X509V3_CONF_METHOD *db_meth; + void *db; + EVP_PKEY *issuer_pkey; + /* Maybe more here */ +}; + +typedef struct v3_ext_method X509V3_EXT_METHOD; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509V3_EXT_METHOD, X509V3_EXT_METHOD, X509V3_EXT_METHOD) +#define sk_X509V3_EXT_METHOD_num(sk) OPENSSL_sk_num(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk)) +#define sk_X509V3_EXT_METHOD_value(sk, idx) ((X509V3_EXT_METHOD *)OPENSSL_sk_value(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk), (idx))) +#define sk_X509V3_EXT_METHOD_new(cmp) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_new(ossl_check_X509V3_EXT_METHOD_compfunc_type(cmp))) +#define sk_X509V3_EXT_METHOD_new_null() ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_new_null()) +#define sk_X509V3_EXT_METHOD_new_reserve(cmp, n) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_new_reserve(ossl_check_X509V3_EXT_METHOD_compfunc_type(cmp), (n))) +#define sk_X509V3_EXT_METHOD_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509V3_EXT_METHOD_sk_type(sk), (n)) +#define sk_X509V3_EXT_METHOD_free(sk) OPENSSL_sk_free(ossl_check_X509V3_EXT_METHOD_sk_type(sk)) +#define sk_X509V3_EXT_METHOD_zero(sk) OPENSSL_sk_zero(ossl_check_X509V3_EXT_METHOD_sk_type(sk)) +#define sk_X509V3_EXT_METHOD_delete(sk, i) ((X509V3_EXT_METHOD *)OPENSSL_sk_delete(ossl_check_X509V3_EXT_METHOD_sk_type(sk), (i))) +#define sk_X509V3_EXT_METHOD_delete_ptr(sk, ptr) ((X509V3_EXT_METHOD *)OPENSSL_sk_delete_ptr(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr))) +#define sk_X509V3_EXT_METHOD_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr)) +#define sk_X509V3_EXT_METHOD_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr)) +#define sk_X509V3_EXT_METHOD_pop(sk) ((X509V3_EXT_METHOD *)OPENSSL_sk_pop(ossl_check_X509V3_EXT_METHOD_sk_type(sk))) +#define sk_X509V3_EXT_METHOD_shift(sk) ((X509V3_EXT_METHOD *)OPENSSL_sk_shift(ossl_check_X509V3_EXT_METHOD_sk_type(sk))) +#define sk_X509V3_EXT_METHOD_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_freefunc_type(freefunc)) +#define sk_X509V3_EXT_METHOD_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr), (idx)) +#define sk_X509V3_EXT_METHOD_set(sk, idx, ptr) ((X509V3_EXT_METHOD *)OPENSSL_sk_set(ossl_check_X509V3_EXT_METHOD_sk_type(sk), (idx), ossl_check_X509V3_EXT_METHOD_type(ptr))) +#define sk_X509V3_EXT_METHOD_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr)) +#define sk_X509V3_EXT_METHOD_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr)) +#define sk_X509V3_EXT_METHOD_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr), pnum) +#define sk_X509V3_EXT_METHOD_sort(sk) OPENSSL_sk_sort(ossl_check_X509V3_EXT_METHOD_sk_type(sk)) +#define sk_X509V3_EXT_METHOD_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk)) +#define sk_X509V3_EXT_METHOD_dup(sk) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_dup(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk))) +#define sk_X509V3_EXT_METHOD_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_deep_copy(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_copyfunc_type(copyfunc), ossl_check_X509V3_EXT_METHOD_freefunc_type(freefunc))) +#define sk_X509V3_EXT_METHOD_set_cmp_func(sk, cmp) ((sk_X509V3_EXT_METHOD_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_compfunc_type(cmp))) + +/* clang-format on */ + +/* ext_flags values */ +#define X509V3_EXT_DYNAMIC 0x1 +#define X509V3_EXT_CTX_DEP 0x2 +#define X509V3_EXT_MULTILINE 0x4 + +typedef BIT_STRING_BITNAME ENUMERATED_NAMES; + +typedef struct BASIC_CONSTRAINTS_st { + int ca; + ASN1_INTEGER *pathlen; +} BASIC_CONSTRAINTS; + +typedef struct OSSL_BASIC_ATTR_CONSTRAINTS_st { + int authority; + ASN1_INTEGER *pathlen; +} OSSL_BASIC_ATTR_CONSTRAINTS; + +typedef struct PKEY_USAGE_PERIOD_st { + ASN1_GENERALIZEDTIME *notBefore; + ASN1_GENERALIZEDTIME *notAfter; +} PKEY_USAGE_PERIOD; + +typedef struct otherName_st { + ASN1_OBJECT *type_id; + ASN1_TYPE *value; +} OTHERNAME; + +typedef struct EDIPartyName_st { + ASN1_STRING *nameAssigner; + ASN1_STRING *partyName; +} EDIPARTYNAME; + +typedef struct GENERAL_NAME_st { +#define GEN_OTHERNAME 0 +#define GEN_EMAIL 1 +#define GEN_DNS 2 +#define GEN_X400 3 +#define GEN_DIRNAME 4 +#define GEN_EDIPARTY 5 +#define GEN_URI 6 +#define GEN_IPADD 7 +#define GEN_RID 8 + int type; + union { + char *ptr; + OTHERNAME *otherName; /* otherName */ + ASN1_IA5STRING *rfc822Name; + ASN1_IA5STRING *dNSName; + ASN1_STRING *x400Address; + X509_NAME *directoryName; + EDIPARTYNAME *ediPartyName; + ASN1_IA5STRING *uniformResourceIdentifier; + ASN1_OCTET_STRING *iPAddress; + ASN1_OBJECT *registeredID; + /* Old names */ + ASN1_OCTET_STRING *ip; /* iPAddress */ + X509_NAME *dirn; /* dirn */ + ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, + * uniformResourceIdentifier */ + ASN1_OBJECT *rid; /* registeredID */ + ASN1_TYPE *other; /* x400Address */ + } d; +} GENERAL_NAME; + +typedef struct ACCESS_DESCRIPTION_st { + ASN1_OBJECT *method; + GENERAL_NAME *location; +} ACCESS_DESCRIPTION; + +int GENERAL_NAME_set1_X509_NAME(GENERAL_NAME **tgt, const X509_NAME *src); + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ACCESS_DESCRIPTION, ACCESS_DESCRIPTION, ACCESS_DESCRIPTION) +#define sk_ACCESS_DESCRIPTION_num(sk) OPENSSL_sk_num(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk)) +#define sk_ACCESS_DESCRIPTION_value(sk, idx) ((ACCESS_DESCRIPTION *)OPENSSL_sk_value(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk), (idx))) +#define sk_ACCESS_DESCRIPTION_new(cmp) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_new(ossl_check_ACCESS_DESCRIPTION_compfunc_type(cmp))) +#define sk_ACCESS_DESCRIPTION_new_null() ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_new_null()) +#define sk_ACCESS_DESCRIPTION_new_reserve(cmp, n) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_new_reserve(ossl_check_ACCESS_DESCRIPTION_compfunc_type(cmp), (n))) +#define sk_ACCESS_DESCRIPTION_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), (n)) +#define sk_ACCESS_DESCRIPTION_free(sk) OPENSSL_sk_free(ossl_check_ACCESS_DESCRIPTION_sk_type(sk)) +#define sk_ACCESS_DESCRIPTION_zero(sk) OPENSSL_sk_zero(ossl_check_ACCESS_DESCRIPTION_sk_type(sk)) +#define sk_ACCESS_DESCRIPTION_delete(sk, i) ((ACCESS_DESCRIPTION *)OPENSSL_sk_delete(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), (i))) +#define sk_ACCESS_DESCRIPTION_delete_ptr(sk, ptr) ((ACCESS_DESCRIPTION *)OPENSSL_sk_delete_ptr(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr))) +#define sk_ACCESS_DESCRIPTION_push(sk, ptr) OPENSSL_sk_push(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr)) +#define sk_ACCESS_DESCRIPTION_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr)) +#define sk_ACCESS_DESCRIPTION_pop(sk) ((ACCESS_DESCRIPTION *)OPENSSL_sk_pop(ossl_check_ACCESS_DESCRIPTION_sk_type(sk))) +#define sk_ACCESS_DESCRIPTION_shift(sk) ((ACCESS_DESCRIPTION *)OPENSSL_sk_shift(ossl_check_ACCESS_DESCRIPTION_sk_type(sk))) +#define sk_ACCESS_DESCRIPTION_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_freefunc_type(freefunc)) +#define sk_ACCESS_DESCRIPTION_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr), (idx)) +#define sk_ACCESS_DESCRIPTION_set(sk, idx, ptr) ((ACCESS_DESCRIPTION *)OPENSSL_sk_set(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), (idx), ossl_check_ACCESS_DESCRIPTION_type(ptr))) +#define sk_ACCESS_DESCRIPTION_find(sk, ptr) OPENSSL_sk_find(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr)) +#define sk_ACCESS_DESCRIPTION_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr)) +#define sk_ACCESS_DESCRIPTION_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr), pnum) +#define sk_ACCESS_DESCRIPTION_sort(sk) OPENSSL_sk_sort(ossl_check_ACCESS_DESCRIPTION_sk_type(sk)) +#define sk_ACCESS_DESCRIPTION_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk)) +#define sk_ACCESS_DESCRIPTION_dup(sk) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_dup(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk))) +#define sk_ACCESS_DESCRIPTION_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_deep_copy(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_copyfunc_type(copyfunc), ossl_check_ACCESS_DESCRIPTION_freefunc_type(freefunc))) +#define sk_ACCESS_DESCRIPTION_set_cmp_func(sk, cmp) ((sk_ACCESS_DESCRIPTION_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(GENERAL_NAME, GENERAL_NAME, GENERAL_NAME) +#define sk_GENERAL_NAME_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_NAME_sk_type(sk)) +#define sk_GENERAL_NAME_value(sk, idx) ((GENERAL_NAME *)OPENSSL_sk_value(ossl_check_const_GENERAL_NAME_sk_type(sk), (idx))) +#define sk_GENERAL_NAME_new(cmp) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_new(ossl_check_GENERAL_NAME_compfunc_type(cmp))) +#define sk_GENERAL_NAME_new_null() ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_new_null()) +#define sk_GENERAL_NAME_new_reserve(cmp, n) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_new_reserve(ossl_check_GENERAL_NAME_compfunc_type(cmp), (n))) +#define sk_GENERAL_NAME_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_GENERAL_NAME_sk_type(sk), (n)) +#define sk_GENERAL_NAME_free(sk) OPENSSL_sk_free(ossl_check_GENERAL_NAME_sk_type(sk)) +#define sk_GENERAL_NAME_zero(sk) OPENSSL_sk_zero(ossl_check_GENERAL_NAME_sk_type(sk)) +#define sk_GENERAL_NAME_delete(sk, i) ((GENERAL_NAME *)OPENSSL_sk_delete(ossl_check_GENERAL_NAME_sk_type(sk), (i))) +#define sk_GENERAL_NAME_delete_ptr(sk, ptr) ((GENERAL_NAME *)OPENSSL_sk_delete_ptr(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr))) +#define sk_GENERAL_NAME_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr)) +#define sk_GENERAL_NAME_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr)) +#define sk_GENERAL_NAME_pop(sk) ((GENERAL_NAME *)OPENSSL_sk_pop(ossl_check_GENERAL_NAME_sk_type(sk))) +#define sk_GENERAL_NAME_shift(sk) ((GENERAL_NAME *)OPENSSL_sk_shift(ossl_check_GENERAL_NAME_sk_type(sk))) +#define sk_GENERAL_NAME_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_freefunc_type(freefunc)) +#define sk_GENERAL_NAME_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr), (idx)) +#define sk_GENERAL_NAME_set(sk, idx, ptr) ((GENERAL_NAME *)OPENSSL_sk_set(ossl_check_GENERAL_NAME_sk_type(sk), (idx), ossl_check_GENERAL_NAME_type(ptr))) +#define sk_GENERAL_NAME_find(sk, ptr) OPENSSL_sk_find(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr)) +#define sk_GENERAL_NAME_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr)) +#define sk_GENERAL_NAME_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr), pnum) +#define sk_GENERAL_NAME_sort(sk) OPENSSL_sk_sort(ossl_check_GENERAL_NAME_sk_type(sk)) +#define sk_GENERAL_NAME_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_GENERAL_NAME_sk_type(sk)) +#define sk_GENERAL_NAME_dup(sk) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_dup(ossl_check_const_GENERAL_NAME_sk_type(sk))) +#define sk_GENERAL_NAME_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_deep_copy(ossl_check_const_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_copyfunc_type(copyfunc), ossl_check_GENERAL_NAME_freefunc_type(freefunc))) +#define sk_GENERAL_NAME_set_cmp_func(sk, cmp) ((sk_GENERAL_NAME_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_compfunc_type(cmp))) + +/* clang-format on */ + +typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; +typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; +typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; +typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(GENERAL_NAMES, GENERAL_NAMES, GENERAL_NAMES) +#define sk_GENERAL_NAMES_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_NAMES_sk_type(sk)) +#define sk_GENERAL_NAMES_value(sk, idx) ((GENERAL_NAMES *)OPENSSL_sk_value(ossl_check_const_GENERAL_NAMES_sk_type(sk), (idx))) +#define sk_GENERAL_NAMES_new(cmp) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new(ossl_check_GENERAL_NAMES_compfunc_type(cmp))) +#define sk_GENERAL_NAMES_new_null() ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new_null()) +#define sk_GENERAL_NAMES_new_reserve(cmp, n) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new_reserve(ossl_check_GENERAL_NAMES_compfunc_type(cmp), (n))) +#define sk_GENERAL_NAMES_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_GENERAL_NAMES_sk_type(sk), (n)) +#define sk_GENERAL_NAMES_free(sk) OPENSSL_sk_free(ossl_check_GENERAL_NAMES_sk_type(sk)) +#define sk_GENERAL_NAMES_zero(sk) OPENSSL_sk_zero(ossl_check_GENERAL_NAMES_sk_type(sk)) +#define sk_GENERAL_NAMES_delete(sk, i) ((GENERAL_NAMES *)OPENSSL_sk_delete(ossl_check_GENERAL_NAMES_sk_type(sk), (i))) +#define sk_GENERAL_NAMES_delete_ptr(sk, ptr) ((GENERAL_NAMES *)OPENSSL_sk_delete_ptr(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr))) +#define sk_GENERAL_NAMES_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr)) +#define sk_GENERAL_NAMES_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr)) +#define sk_GENERAL_NAMES_pop(sk) ((GENERAL_NAMES *)OPENSSL_sk_pop(ossl_check_GENERAL_NAMES_sk_type(sk))) +#define sk_GENERAL_NAMES_shift(sk) ((GENERAL_NAMES *)OPENSSL_sk_shift(ossl_check_GENERAL_NAMES_sk_type(sk))) +#define sk_GENERAL_NAMES_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_freefunc_type(freefunc)) +#define sk_GENERAL_NAMES_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr), (idx)) +#define sk_GENERAL_NAMES_set(sk, idx, ptr) ((GENERAL_NAMES *)OPENSSL_sk_set(ossl_check_GENERAL_NAMES_sk_type(sk), (idx), ossl_check_GENERAL_NAMES_type(ptr))) +#define sk_GENERAL_NAMES_find(sk, ptr) OPENSSL_sk_find(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr)) +#define sk_GENERAL_NAMES_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr)) +#define sk_GENERAL_NAMES_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr), pnum) +#define sk_GENERAL_NAMES_sort(sk) OPENSSL_sk_sort(ossl_check_GENERAL_NAMES_sk_type(sk)) +#define sk_GENERAL_NAMES_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_GENERAL_NAMES_sk_type(sk)) +#define sk_GENERAL_NAMES_dup(sk) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_dup(ossl_check_const_GENERAL_NAMES_sk_type(sk))) +#define sk_GENERAL_NAMES_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_deep_copy(ossl_check_const_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_copyfunc_type(copyfunc), ossl_check_GENERAL_NAMES_freefunc_type(freefunc))) +#define sk_GENERAL_NAMES_set_cmp_func(sk, cmp) ((sk_GENERAL_NAMES_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct DIST_POINT_NAME_st { + int type; + union { + GENERAL_NAMES *fullname; + STACK_OF(X509_NAME_ENTRY) *relativename; + } name; + /* If relativename then this contains the full distribution point name */ + X509_NAME *dpname; +} DIST_POINT_NAME; +DECLARE_ASN1_DUP_FUNCTION(DIST_POINT_NAME) +/* All existing reasons */ +#define CRLDP_ALL_REASONS 0x807f + +#define CRL_REASON_NONE -1 +#define CRL_REASON_UNSPECIFIED 0 +#define CRL_REASON_KEY_COMPROMISE 1 +#define CRL_REASON_CA_COMPROMISE 2 +#define CRL_REASON_AFFILIATION_CHANGED 3 +#define CRL_REASON_SUPERSEDED 4 +#define CRL_REASON_CESSATION_OF_OPERATION 5 +#define CRL_REASON_CERTIFICATE_HOLD 6 +#define CRL_REASON_REMOVE_FROM_CRL 8 +#define CRL_REASON_PRIVILEGE_WITHDRAWN 9 +#define CRL_REASON_AA_COMPROMISE 10 + +struct DIST_POINT_st { + DIST_POINT_NAME *distpoint; + ASN1_BIT_STRING *reasons; + GENERAL_NAMES *CRLissuer; + int dp_reasons; +}; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(DIST_POINT, DIST_POINT, DIST_POINT) +#define sk_DIST_POINT_num(sk) OPENSSL_sk_num(ossl_check_const_DIST_POINT_sk_type(sk)) +#define sk_DIST_POINT_value(sk, idx) ((DIST_POINT *)OPENSSL_sk_value(ossl_check_const_DIST_POINT_sk_type(sk), (idx))) +#define sk_DIST_POINT_new(cmp) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_new(ossl_check_DIST_POINT_compfunc_type(cmp))) +#define sk_DIST_POINT_new_null() ((STACK_OF(DIST_POINT) *)OPENSSL_sk_new_null()) +#define sk_DIST_POINT_new_reserve(cmp, n) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_new_reserve(ossl_check_DIST_POINT_compfunc_type(cmp), (n))) +#define sk_DIST_POINT_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_DIST_POINT_sk_type(sk), (n)) +#define sk_DIST_POINT_free(sk) OPENSSL_sk_free(ossl_check_DIST_POINT_sk_type(sk)) +#define sk_DIST_POINT_zero(sk) OPENSSL_sk_zero(ossl_check_DIST_POINT_sk_type(sk)) +#define sk_DIST_POINT_delete(sk, i) ((DIST_POINT *)OPENSSL_sk_delete(ossl_check_DIST_POINT_sk_type(sk), (i))) +#define sk_DIST_POINT_delete_ptr(sk, ptr) ((DIST_POINT *)OPENSSL_sk_delete_ptr(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr))) +#define sk_DIST_POINT_push(sk, ptr) OPENSSL_sk_push(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr)) +#define sk_DIST_POINT_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr)) +#define sk_DIST_POINT_pop(sk) ((DIST_POINT *)OPENSSL_sk_pop(ossl_check_DIST_POINT_sk_type(sk))) +#define sk_DIST_POINT_shift(sk) ((DIST_POINT *)OPENSSL_sk_shift(ossl_check_DIST_POINT_sk_type(sk))) +#define sk_DIST_POINT_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_freefunc_type(freefunc)) +#define sk_DIST_POINT_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr), (idx)) +#define sk_DIST_POINT_set(sk, idx, ptr) ((DIST_POINT *)OPENSSL_sk_set(ossl_check_DIST_POINT_sk_type(sk), (idx), ossl_check_DIST_POINT_type(ptr))) +#define sk_DIST_POINT_find(sk, ptr) OPENSSL_sk_find(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr)) +#define sk_DIST_POINT_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr)) +#define sk_DIST_POINT_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr), pnum) +#define sk_DIST_POINT_sort(sk) OPENSSL_sk_sort(ossl_check_DIST_POINT_sk_type(sk)) +#define sk_DIST_POINT_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_DIST_POINT_sk_type(sk)) +#define sk_DIST_POINT_dup(sk) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_dup(ossl_check_const_DIST_POINT_sk_type(sk))) +#define sk_DIST_POINT_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_deep_copy(ossl_check_const_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_copyfunc_type(copyfunc), ossl_check_DIST_POINT_freefunc_type(freefunc))) +#define sk_DIST_POINT_set_cmp_func(sk, cmp) ((sk_DIST_POINT_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_compfunc_type(cmp))) + +/* clang-format on */ + +typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; + +struct AUTHORITY_KEYID_st { + ASN1_OCTET_STRING *keyid; + GENERAL_NAMES *issuer; + ASN1_INTEGER *serial; +}; + +/* Strong extranet structures */ + +typedef struct SXNET_ID_st { + ASN1_INTEGER *zone; + ASN1_OCTET_STRING *user; +} SXNETID; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(SXNETID, SXNETID, SXNETID) +#define sk_SXNETID_num(sk) OPENSSL_sk_num(ossl_check_const_SXNETID_sk_type(sk)) +#define sk_SXNETID_value(sk, idx) ((SXNETID *)OPENSSL_sk_value(ossl_check_const_SXNETID_sk_type(sk), (idx))) +#define sk_SXNETID_new(cmp) ((STACK_OF(SXNETID) *)OPENSSL_sk_new(ossl_check_SXNETID_compfunc_type(cmp))) +#define sk_SXNETID_new_null() ((STACK_OF(SXNETID) *)OPENSSL_sk_new_null()) +#define sk_SXNETID_new_reserve(cmp, n) ((STACK_OF(SXNETID) *)OPENSSL_sk_new_reserve(ossl_check_SXNETID_compfunc_type(cmp), (n))) +#define sk_SXNETID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SXNETID_sk_type(sk), (n)) +#define sk_SXNETID_free(sk) OPENSSL_sk_free(ossl_check_SXNETID_sk_type(sk)) +#define sk_SXNETID_zero(sk) OPENSSL_sk_zero(ossl_check_SXNETID_sk_type(sk)) +#define sk_SXNETID_delete(sk, i) ((SXNETID *)OPENSSL_sk_delete(ossl_check_SXNETID_sk_type(sk), (i))) +#define sk_SXNETID_delete_ptr(sk, ptr) ((SXNETID *)OPENSSL_sk_delete_ptr(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr))) +#define sk_SXNETID_push(sk, ptr) OPENSSL_sk_push(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr)) +#define sk_SXNETID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr)) +#define sk_SXNETID_pop(sk) ((SXNETID *)OPENSSL_sk_pop(ossl_check_SXNETID_sk_type(sk))) +#define sk_SXNETID_shift(sk) ((SXNETID *)OPENSSL_sk_shift(ossl_check_SXNETID_sk_type(sk))) +#define sk_SXNETID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_freefunc_type(freefunc)) +#define sk_SXNETID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr), (idx)) +#define sk_SXNETID_set(sk, idx, ptr) ((SXNETID *)OPENSSL_sk_set(ossl_check_SXNETID_sk_type(sk), (idx), ossl_check_SXNETID_type(ptr))) +#define sk_SXNETID_find(sk, ptr) OPENSSL_sk_find(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr)) +#define sk_SXNETID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr)) +#define sk_SXNETID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr), pnum) +#define sk_SXNETID_sort(sk) OPENSSL_sk_sort(ossl_check_SXNETID_sk_type(sk)) +#define sk_SXNETID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SXNETID_sk_type(sk)) +#define sk_SXNETID_dup(sk) ((STACK_OF(SXNETID) *)OPENSSL_sk_dup(ossl_check_const_SXNETID_sk_type(sk))) +#define sk_SXNETID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SXNETID) *)OPENSSL_sk_deep_copy(ossl_check_const_SXNETID_sk_type(sk), ossl_check_SXNETID_copyfunc_type(copyfunc), ossl_check_SXNETID_freefunc_type(freefunc))) +#define sk_SXNETID_set_cmp_func(sk, cmp) ((sk_SXNETID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct SXNET_st { + ASN1_INTEGER *version; + STACK_OF(SXNETID) *ids; +} SXNET; + +typedef struct ISSUER_SIGN_TOOL_st { + ASN1_UTF8STRING *signTool; + ASN1_UTF8STRING *cATool; + ASN1_UTF8STRING *signToolCert; + ASN1_UTF8STRING *cAToolCert; +} ISSUER_SIGN_TOOL; + +typedef struct NOTICEREF_st { + ASN1_STRING *organization; + STACK_OF(ASN1_INTEGER) *noticenos; +} NOTICEREF; + +typedef struct USERNOTICE_st { + NOTICEREF *noticeref; + ASN1_STRING *exptext; +} USERNOTICE; + +typedef struct POLICYQUALINFO_st { + ASN1_OBJECT *pqualid; + union { + ASN1_IA5STRING *cpsuri; + USERNOTICE *usernotice; + ASN1_TYPE *other; + } d; +} POLICYQUALINFO; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(POLICYQUALINFO, POLICYQUALINFO, POLICYQUALINFO) +#define sk_POLICYQUALINFO_num(sk) OPENSSL_sk_num(ossl_check_const_POLICYQUALINFO_sk_type(sk)) +#define sk_POLICYQUALINFO_value(sk, idx) ((POLICYQUALINFO *)OPENSSL_sk_value(ossl_check_const_POLICYQUALINFO_sk_type(sk), (idx))) +#define sk_POLICYQUALINFO_new(cmp) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_new(ossl_check_POLICYQUALINFO_compfunc_type(cmp))) +#define sk_POLICYQUALINFO_new_null() ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_new_null()) +#define sk_POLICYQUALINFO_new_reserve(cmp, n) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_new_reserve(ossl_check_POLICYQUALINFO_compfunc_type(cmp), (n))) +#define sk_POLICYQUALINFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_POLICYQUALINFO_sk_type(sk), (n)) +#define sk_POLICYQUALINFO_free(sk) OPENSSL_sk_free(ossl_check_POLICYQUALINFO_sk_type(sk)) +#define sk_POLICYQUALINFO_zero(sk) OPENSSL_sk_zero(ossl_check_POLICYQUALINFO_sk_type(sk)) +#define sk_POLICYQUALINFO_delete(sk, i) ((POLICYQUALINFO *)OPENSSL_sk_delete(ossl_check_POLICYQUALINFO_sk_type(sk), (i))) +#define sk_POLICYQUALINFO_delete_ptr(sk, ptr) ((POLICYQUALINFO *)OPENSSL_sk_delete_ptr(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr))) +#define sk_POLICYQUALINFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr)) +#define sk_POLICYQUALINFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr)) +#define sk_POLICYQUALINFO_pop(sk) ((POLICYQUALINFO *)OPENSSL_sk_pop(ossl_check_POLICYQUALINFO_sk_type(sk))) +#define sk_POLICYQUALINFO_shift(sk) ((POLICYQUALINFO *)OPENSSL_sk_shift(ossl_check_POLICYQUALINFO_sk_type(sk))) +#define sk_POLICYQUALINFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_freefunc_type(freefunc)) +#define sk_POLICYQUALINFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr), (idx)) +#define sk_POLICYQUALINFO_set(sk, idx, ptr) ((POLICYQUALINFO *)OPENSSL_sk_set(ossl_check_POLICYQUALINFO_sk_type(sk), (idx), ossl_check_POLICYQUALINFO_type(ptr))) +#define sk_POLICYQUALINFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr)) +#define sk_POLICYQUALINFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr)) +#define sk_POLICYQUALINFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr), pnum) +#define sk_POLICYQUALINFO_sort(sk) OPENSSL_sk_sort(ossl_check_POLICYQUALINFO_sk_type(sk)) +#define sk_POLICYQUALINFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_POLICYQUALINFO_sk_type(sk)) +#define sk_POLICYQUALINFO_dup(sk) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_dup(ossl_check_const_POLICYQUALINFO_sk_type(sk))) +#define sk_POLICYQUALINFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_deep_copy(ossl_check_const_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_copyfunc_type(copyfunc), ossl_check_POLICYQUALINFO_freefunc_type(freefunc))) +#define sk_POLICYQUALINFO_set_cmp_func(sk, cmp) ((sk_POLICYQUALINFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct POLICYINFO_st { + ASN1_OBJECT *policyid; + STACK_OF(POLICYQUALINFO) *qualifiers; +} POLICYINFO; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(POLICYINFO, POLICYINFO, POLICYINFO) +#define sk_POLICYINFO_num(sk) OPENSSL_sk_num(ossl_check_const_POLICYINFO_sk_type(sk)) +#define sk_POLICYINFO_value(sk, idx) ((POLICYINFO *)OPENSSL_sk_value(ossl_check_const_POLICYINFO_sk_type(sk), (idx))) +#define sk_POLICYINFO_new(cmp) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_new(ossl_check_POLICYINFO_compfunc_type(cmp))) +#define sk_POLICYINFO_new_null() ((STACK_OF(POLICYINFO) *)OPENSSL_sk_new_null()) +#define sk_POLICYINFO_new_reserve(cmp, n) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_new_reserve(ossl_check_POLICYINFO_compfunc_type(cmp), (n))) +#define sk_POLICYINFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_POLICYINFO_sk_type(sk), (n)) +#define sk_POLICYINFO_free(sk) OPENSSL_sk_free(ossl_check_POLICYINFO_sk_type(sk)) +#define sk_POLICYINFO_zero(sk) OPENSSL_sk_zero(ossl_check_POLICYINFO_sk_type(sk)) +#define sk_POLICYINFO_delete(sk, i) ((POLICYINFO *)OPENSSL_sk_delete(ossl_check_POLICYINFO_sk_type(sk), (i))) +#define sk_POLICYINFO_delete_ptr(sk, ptr) ((POLICYINFO *)OPENSSL_sk_delete_ptr(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr))) +#define sk_POLICYINFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr)) +#define sk_POLICYINFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr)) +#define sk_POLICYINFO_pop(sk) ((POLICYINFO *)OPENSSL_sk_pop(ossl_check_POLICYINFO_sk_type(sk))) +#define sk_POLICYINFO_shift(sk) ((POLICYINFO *)OPENSSL_sk_shift(ossl_check_POLICYINFO_sk_type(sk))) +#define sk_POLICYINFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_freefunc_type(freefunc)) +#define sk_POLICYINFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr), (idx)) +#define sk_POLICYINFO_set(sk, idx, ptr) ((POLICYINFO *)OPENSSL_sk_set(ossl_check_POLICYINFO_sk_type(sk), (idx), ossl_check_POLICYINFO_type(ptr))) +#define sk_POLICYINFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr)) +#define sk_POLICYINFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr)) +#define sk_POLICYINFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr), pnum) +#define sk_POLICYINFO_sort(sk) OPENSSL_sk_sort(ossl_check_POLICYINFO_sk_type(sk)) +#define sk_POLICYINFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_POLICYINFO_sk_type(sk)) +#define sk_POLICYINFO_dup(sk) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_dup(ossl_check_const_POLICYINFO_sk_type(sk))) +#define sk_POLICYINFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_deep_copy(ossl_check_const_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_copyfunc_type(copyfunc), ossl_check_POLICYINFO_freefunc_type(freefunc))) +#define sk_POLICYINFO_set_cmp_func(sk, cmp) ((sk_POLICYINFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_compfunc_type(cmp))) + +/* clang-format on */ + +typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; + +typedef struct POLICY_MAPPING_st { + ASN1_OBJECT *issuerDomainPolicy; + ASN1_OBJECT *subjectDomainPolicy; +} POLICY_MAPPING; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(POLICY_MAPPING, POLICY_MAPPING, POLICY_MAPPING) +#define sk_POLICY_MAPPING_num(sk) OPENSSL_sk_num(ossl_check_const_POLICY_MAPPING_sk_type(sk)) +#define sk_POLICY_MAPPING_value(sk, idx) ((POLICY_MAPPING *)OPENSSL_sk_value(ossl_check_const_POLICY_MAPPING_sk_type(sk), (idx))) +#define sk_POLICY_MAPPING_new(cmp) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_new(ossl_check_POLICY_MAPPING_compfunc_type(cmp))) +#define sk_POLICY_MAPPING_new_null() ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_new_null()) +#define sk_POLICY_MAPPING_new_reserve(cmp, n) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_new_reserve(ossl_check_POLICY_MAPPING_compfunc_type(cmp), (n))) +#define sk_POLICY_MAPPING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_POLICY_MAPPING_sk_type(sk), (n)) +#define sk_POLICY_MAPPING_free(sk) OPENSSL_sk_free(ossl_check_POLICY_MAPPING_sk_type(sk)) +#define sk_POLICY_MAPPING_zero(sk) OPENSSL_sk_zero(ossl_check_POLICY_MAPPING_sk_type(sk)) +#define sk_POLICY_MAPPING_delete(sk, i) ((POLICY_MAPPING *)OPENSSL_sk_delete(ossl_check_POLICY_MAPPING_sk_type(sk), (i))) +#define sk_POLICY_MAPPING_delete_ptr(sk, ptr) ((POLICY_MAPPING *)OPENSSL_sk_delete_ptr(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr))) +#define sk_POLICY_MAPPING_push(sk, ptr) OPENSSL_sk_push(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr)) +#define sk_POLICY_MAPPING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr)) +#define sk_POLICY_MAPPING_pop(sk) ((POLICY_MAPPING *)OPENSSL_sk_pop(ossl_check_POLICY_MAPPING_sk_type(sk))) +#define sk_POLICY_MAPPING_shift(sk) ((POLICY_MAPPING *)OPENSSL_sk_shift(ossl_check_POLICY_MAPPING_sk_type(sk))) +#define sk_POLICY_MAPPING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_freefunc_type(freefunc)) +#define sk_POLICY_MAPPING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr), (idx)) +#define sk_POLICY_MAPPING_set(sk, idx, ptr) ((POLICY_MAPPING *)OPENSSL_sk_set(ossl_check_POLICY_MAPPING_sk_type(sk), (idx), ossl_check_POLICY_MAPPING_type(ptr))) +#define sk_POLICY_MAPPING_find(sk, ptr) OPENSSL_sk_find(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr)) +#define sk_POLICY_MAPPING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr)) +#define sk_POLICY_MAPPING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr), pnum) +#define sk_POLICY_MAPPING_sort(sk) OPENSSL_sk_sort(ossl_check_POLICY_MAPPING_sk_type(sk)) +#define sk_POLICY_MAPPING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_POLICY_MAPPING_sk_type(sk)) +#define sk_POLICY_MAPPING_dup(sk) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_dup(ossl_check_const_POLICY_MAPPING_sk_type(sk))) +#define sk_POLICY_MAPPING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_deep_copy(ossl_check_const_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_copyfunc_type(copyfunc), ossl_check_POLICY_MAPPING_freefunc_type(freefunc))) +#define sk_POLICY_MAPPING_set_cmp_func(sk, cmp) ((sk_POLICY_MAPPING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_compfunc_type(cmp))) + +/* clang-format on */ + +typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; + +typedef struct GENERAL_SUBTREE_st { + GENERAL_NAME *base; + ASN1_INTEGER *minimum; + ASN1_INTEGER *maximum; +} GENERAL_SUBTREE; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(GENERAL_SUBTREE, GENERAL_SUBTREE, GENERAL_SUBTREE) +#define sk_GENERAL_SUBTREE_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_SUBTREE_sk_type(sk)) +#define sk_GENERAL_SUBTREE_value(sk, idx) ((GENERAL_SUBTREE *)OPENSSL_sk_value(ossl_check_const_GENERAL_SUBTREE_sk_type(sk), (idx))) +#define sk_GENERAL_SUBTREE_new(cmp) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_new(ossl_check_GENERAL_SUBTREE_compfunc_type(cmp))) +#define sk_GENERAL_SUBTREE_new_null() ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_new_null()) +#define sk_GENERAL_SUBTREE_new_reserve(cmp, n) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_new_reserve(ossl_check_GENERAL_SUBTREE_compfunc_type(cmp), (n))) +#define sk_GENERAL_SUBTREE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_GENERAL_SUBTREE_sk_type(sk), (n)) +#define sk_GENERAL_SUBTREE_free(sk) OPENSSL_sk_free(ossl_check_GENERAL_SUBTREE_sk_type(sk)) +#define sk_GENERAL_SUBTREE_zero(sk) OPENSSL_sk_zero(ossl_check_GENERAL_SUBTREE_sk_type(sk)) +#define sk_GENERAL_SUBTREE_delete(sk, i) ((GENERAL_SUBTREE *)OPENSSL_sk_delete(ossl_check_GENERAL_SUBTREE_sk_type(sk), (i))) +#define sk_GENERAL_SUBTREE_delete_ptr(sk, ptr) ((GENERAL_SUBTREE *)OPENSSL_sk_delete_ptr(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr))) +#define sk_GENERAL_SUBTREE_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr)) +#define sk_GENERAL_SUBTREE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr)) +#define sk_GENERAL_SUBTREE_pop(sk) ((GENERAL_SUBTREE *)OPENSSL_sk_pop(ossl_check_GENERAL_SUBTREE_sk_type(sk))) +#define sk_GENERAL_SUBTREE_shift(sk) ((GENERAL_SUBTREE *)OPENSSL_sk_shift(ossl_check_GENERAL_SUBTREE_sk_type(sk))) +#define sk_GENERAL_SUBTREE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_freefunc_type(freefunc)) +#define sk_GENERAL_SUBTREE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr), (idx)) +#define sk_GENERAL_SUBTREE_set(sk, idx, ptr) ((GENERAL_SUBTREE *)OPENSSL_sk_set(ossl_check_GENERAL_SUBTREE_sk_type(sk), (idx), ossl_check_GENERAL_SUBTREE_type(ptr))) +#define sk_GENERAL_SUBTREE_find(sk, ptr) OPENSSL_sk_find(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr)) +#define sk_GENERAL_SUBTREE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr)) +#define sk_GENERAL_SUBTREE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr), pnum) +#define sk_GENERAL_SUBTREE_sort(sk) OPENSSL_sk_sort(ossl_check_GENERAL_SUBTREE_sk_type(sk)) +#define sk_GENERAL_SUBTREE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_GENERAL_SUBTREE_sk_type(sk)) +#define sk_GENERAL_SUBTREE_dup(sk) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_dup(ossl_check_const_GENERAL_SUBTREE_sk_type(sk))) +#define sk_GENERAL_SUBTREE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_deep_copy(ossl_check_const_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_copyfunc_type(copyfunc), ossl_check_GENERAL_SUBTREE_freefunc_type(freefunc))) +#define sk_GENERAL_SUBTREE_set_cmp_func(sk, cmp) ((sk_GENERAL_SUBTREE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_compfunc_type(cmp))) + +/* clang-format on */ + +struct NAME_CONSTRAINTS_st { + STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; + STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; +}; + +typedef struct POLICY_CONSTRAINTS_st { + ASN1_INTEGER *requireExplicitPolicy; + ASN1_INTEGER *inhibitPolicyMapping; +} POLICY_CONSTRAINTS; + +/* Proxy certificate structures, see RFC 3820 */ +typedef struct PROXY_POLICY_st { + ASN1_OBJECT *policyLanguage; + ASN1_OCTET_STRING *policy; +} PROXY_POLICY; + +typedef struct PROXY_CERT_INFO_EXTENSION_st { + ASN1_INTEGER *pcPathLengthConstraint; + PROXY_POLICY *proxyPolicy; +} PROXY_CERT_INFO_EXTENSION; + +DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) +DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) + +struct ISSUING_DIST_POINT_st { + DIST_POINT_NAME *distpoint; + int onlyuser; + int onlyCA; + ASN1_BIT_STRING *onlysomereasons; + int indirectCRL; + int onlyattr; +}; + +/* Values in idp_flags field */ +/* IDP present */ +#define IDP_PRESENT 0x1 +/* IDP values inconsistent */ +#define IDP_INVALID 0x2 +/* onlyuser true */ +#define IDP_ONLYUSER 0x4 +/* onlyCA true */ +#define IDP_ONLYCA 0x8 +/* onlyattr true */ +#define IDP_ONLYATTR 0x10 +/* indirectCRL true */ +#define IDP_INDIRECT 0x20 +/* onlysomereasons present */ +#define IDP_REASONS 0x40 + +#define X509V3_conf_err(val) ERR_add_error_data(6, \ + "section:", (val)->section, \ + ",name:", (val)->name, ",value:", (val)->value) + +#define X509V3_set_ctx_test(ctx) \ + X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, X509V3_CTX_TEST) +#define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; + +#define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ + 0, 0, 0, 0, \ + 0, 0, \ + (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ + (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ + NULL, NULL, \ + table } + +#define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ + 0, 0, 0, 0, \ + (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ + (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ + 0, 0, 0, 0, \ + NULL } + +#define EXT_UTF8STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_UTF8STRING), \ + 0, 0, 0, 0, \ + (X509V3_EXT_I2S)i2s_ASN1_UTF8STRING, \ + (X509V3_EXT_S2I)s2i_ASN1_UTF8STRING, \ + 0, 0, 0, 0, \ + NULL } + +/* clang-format off */ +# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +/* clang-format on */ + +/* X509_PURPOSE stuff */ + +#define EXFLAG_BCONS 0x1 +#define EXFLAG_KUSAGE 0x2 +#define EXFLAG_XKUSAGE 0x4 +#define EXFLAG_NSCERT 0x8 + +#define EXFLAG_CA 0x10 +#define EXFLAG_SI 0x20 /* self-issued, maybe not self-signed */ +#define EXFLAG_V1 0x40 +#define EXFLAG_INVALID 0x80 +/* EXFLAG_SET is set to indicate that some values have been precomputed */ +#define EXFLAG_SET 0x100 +#define EXFLAG_CRITICAL 0x200 +#define EXFLAG_PROXY 0x400 + +#define EXFLAG_INVALID_POLICY 0x800 +#define EXFLAG_FRESHEST 0x1000 +#define EXFLAG_SS 0x2000 /* cert is apparently self-signed */ + +#define EXFLAG_BCONS_CRITICAL 0x10000 +#define EXFLAG_AKID_CRITICAL 0x20000 +#define EXFLAG_SKID_CRITICAL 0x40000 +#define EXFLAG_SAN_CRITICAL 0x80000 +#define EXFLAG_NO_FINGERPRINT 0x100000 + +/* https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3 */ +#define KU_DIGITAL_SIGNATURE X509v3_KU_DIGITAL_SIGNATURE +#define KU_NON_REPUDIATION X509v3_KU_NON_REPUDIATION +#define KU_KEY_ENCIPHERMENT X509v3_KU_KEY_ENCIPHERMENT +#define KU_DATA_ENCIPHERMENT X509v3_KU_DATA_ENCIPHERMENT +#define KU_KEY_AGREEMENT X509v3_KU_KEY_AGREEMENT +#define KU_KEY_CERT_SIGN X509v3_KU_KEY_CERT_SIGN +#define KU_CRL_SIGN X509v3_KU_CRL_SIGN +#define KU_ENCIPHER_ONLY X509v3_KU_ENCIPHER_ONLY +#define KU_DECIPHER_ONLY X509v3_KU_DECIPHER_ONLY + +#define NS_SSL_CLIENT 0x80 +#define NS_SSL_SERVER 0x40 +#define NS_SMIME 0x20 +#define NS_OBJSIGN 0x10 +#define NS_SSL_CA 0x04 +#define NS_SMIME_CA 0x02 +#define NS_OBJSIGN_CA 0x01 +#define NS_ANY_CA (NS_SSL_CA | NS_SMIME_CA | NS_OBJSIGN_CA) + +#define XKU_SSL_SERVER 0x1 +#define XKU_SSL_CLIENT 0x2 +#define XKU_SMIME 0x4 +#define XKU_CODE_SIGN 0x8 +#define XKU_SGC 0x10 /* Netscape or MS Server-Gated Crypto */ +#define XKU_OCSP_SIGN 0x20 +#define XKU_TIMESTAMP 0x40 +#define XKU_DVCS 0x80 +#define XKU_ANYEKU 0x100 + +#define X509_PURPOSE_DYNAMIC 0x1 +#define X509_PURPOSE_DYNAMIC_NAME 0x2 + +typedef struct x509_purpose_st { + int purpose; + int trust; /* Default trust ID */ + int flags; + int (*check_purpose)(const struct x509_purpose_st *, const X509 *, int); + char *name; + char *sname; + void *usr_data; +} X509_PURPOSE; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_PURPOSE, X509_PURPOSE, X509_PURPOSE) +#define sk_X509_PURPOSE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_PURPOSE_sk_type(sk)) +#define sk_X509_PURPOSE_value(sk, idx) ((X509_PURPOSE *)OPENSSL_sk_value(ossl_check_const_X509_PURPOSE_sk_type(sk), (idx))) +#define sk_X509_PURPOSE_new(cmp) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_new(ossl_check_X509_PURPOSE_compfunc_type(cmp))) +#define sk_X509_PURPOSE_new_null() ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_new_null()) +#define sk_X509_PURPOSE_new_reserve(cmp, n) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_new_reserve(ossl_check_X509_PURPOSE_compfunc_type(cmp), (n))) +#define sk_X509_PURPOSE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_PURPOSE_sk_type(sk), (n)) +#define sk_X509_PURPOSE_free(sk) OPENSSL_sk_free(ossl_check_X509_PURPOSE_sk_type(sk)) +#define sk_X509_PURPOSE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_PURPOSE_sk_type(sk)) +#define sk_X509_PURPOSE_delete(sk, i) ((X509_PURPOSE *)OPENSSL_sk_delete(ossl_check_X509_PURPOSE_sk_type(sk), (i))) +#define sk_X509_PURPOSE_delete_ptr(sk, ptr) ((X509_PURPOSE *)OPENSSL_sk_delete_ptr(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr))) +#define sk_X509_PURPOSE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr)) +#define sk_X509_PURPOSE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr)) +#define sk_X509_PURPOSE_pop(sk) ((X509_PURPOSE *)OPENSSL_sk_pop(ossl_check_X509_PURPOSE_sk_type(sk))) +#define sk_X509_PURPOSE_shift(sk) ((X509_PURPOSE *)OPENSSL_sk_shift(ossl_check_X509_PURPOSE_sk_type(sk))) +#define sk_X509_PURPOSE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_freefunc_type(freefunc)) +#define sk_X509_PURPOSE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr), (idx)) +#define sk_X509_PURPOSE_set(sk, idx, ptr) ((X509_PURPOSE *)OPENSSL_sk_set(ossl_check_X509_PURPOSE_sk_type(sk), (idx), ossl_check_X509_PURPOSE_type(ptr))) +#define sk_X509_PURPOSE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr)) +#define sk_X509_PURPOSE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr)) +#define sk_X509_PURPOSE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr), pnum) +#define sk_X509_PURPOSE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_PURPOSE_sk_type(sk)) +#define sk_X509_PURPOSE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_PURPOSE_sk_type(sk)) +#define sk_X509_PURPOSE_dup(sk) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_dup(ossl_check_const_X509_PURPOSE_sk_type(sk))) +#define sk_X509_PURPOSE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_copyfunc_type(copyfunc), ossl_check_X509_PURPOSE_freefunc_type(freefunc))) +#define sk_X509_PURPOSE_set_cmp_func(sk, cmp) ((sk_X509_PURPOSE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_compfunc_type(cmp))) + +/* clang-format on */ + +#define X509_PURPOSE_DEFAULT_ANY 0 +#define X509_PURPOSE_SSL_CLIENT 1 +#define X509_PURPOSE_SSL_SERVER 2 +#define X509_PURPOSE_NS_SSL_SERVER 3 +#define X509_PURPOSE_SMIME_SIGN 4 +#define X509_PURPOSE_SMIME_ENCRYPT 5 +#define X509_PURPOSE_CRL_SIGN 6 +#define X509_PURPOSE_ANY 7 +#define X509_PURPOSE_OCSP_HELPER 8 +#define X509_PURPOSE_TIMESTAMP_SIGN 9 +#define X509_PURPOSE_CODE_SIGN 10 + +#define X509_PURPOSE_MIN 1 +#define X509_PURPOSE_MAX 10 + +/* Flags for X509V3_EXT_print() */ + +#define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) +/* Return error for unknown extensions */ +#define X509V3_EXT_DEFAULT 0 +/* Print error for unknown extensions */ +#define X509V3_EXT_ERROR_UNKNOWN (1L << 16) +/* ASN1 parse unknown extensions */ +#define X509V3_EXT_PARSE_UNKNOWN (2L << 16) +/* BIO_dump unknown extensions */ +#define X509V3_EXT_DUMP_UNKNOWN (3L << 16) + +/* Flags for X509V3_add1_i2d */ + +#define X509V3_ADD_OP_MASK 0xfL +#define X509V3_ADD_DEFAULT 0L +#define X509V3_ADD_APPEND 1L +#define X509V3_ADD_REPLACE 2L +#define X509V3_ADD_REPLACE_EXISTING 3L +#define X509V3_ADD_KEEP_EXISTING 4L +#define X509V3_ADD_DELETE 5L +#define X509V3_ADD_SILENT 0x10 + +DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) +DECLARE_ASN1_FUNCTIONS(OSSL_BASIC_ATTR_CONSTRAINTS) + +DECLARE_ASN1_FUNCTIONS(SXNET) +DECLARE_ASN1_FUNCTIONS(SXNETID) + +DECLARE_ASN1_FUNCTIONS(ISSUER_SIGN_TOOL) + +int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); +int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, + int userlen); +int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, + int userlen); + +ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); +ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); +ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); + +DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) + +DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) +DECLARE_ASN1_DUP_FUNCTION(GENERAL_NAME) +int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); + +ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, + STACK_OF(CONF_VALUE) *nval); +STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + ASN1_BIT_STRING *bits, + STACK_OF(CONF_VALUE) *extlist); +char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); +ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, const char *str); +char *i2s_ASN1_UTF8STRING(X509V3_EXT_METHOD *method, ASN1_UTF8STRING *utf8); +ASN1_UTF8STRING *s2i_ASN1_UTF8STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, const char *str); + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, + GENERAL_NAME *gen, + STACK_OF(CONF_VALUE) *ret); +int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, + GENERAL_NAMES *gen, + STACK_OF(CONF_VALUE) *extlist); +GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); + +DECLARE_ASN1_FUNCTIONS(OTHERNAME) +DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) +int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); +void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); +void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); +int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, + ASN1_OBJECT *oid, ASN1_TYPE *value); +int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, + ASN1_OBJECT **poid, ASN1_TYPE **pvalue); + +char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, + const ASN1_OCTET_STRING *ia5); +ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, const char *str); + +DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) +int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); + +DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) + +DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) +DECLARE_ASN1_FUNCTIONS(POLICYINFO) +DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) +DECLARE_ASN1_FUNCTIONS(USERNOTICE) +DECLARE_ASN1_FUNCTIONS(NOTICEREF) + +DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) +DECLARE_ASN1_FUNCTIONS(DIST_POINT) +DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) +DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) + +int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, const X509_NAME *iname); + +int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); +int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); + +DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) +DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) + +DECLARE_ASN1_ITEM(POLICY_MAPPING) +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) +DECLARE_ASN1_ITEM(POLICY_MAPPINGS) + +DECLARE_ASN1_ITEM(GENERAL_SUBTREE) +DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) + +DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) +DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) + +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) +DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) + +GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, int gen_type, + const char *value, int is_nc); + +#ifdef OPENSSL_CONF_H +GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf); +GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf, + int is_nc); + +void X509V3_conf_free(CONF_VALUE *val); + +X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, + const char *value); +X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, + const char *value); +int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, + STACK_OF(X509_EXTENSION) **sk); +int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509 *cert); +int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509_REQ *req); +int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509_CRL *crl); + +X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, + X509V3_CTX *ctx, int ext_nid, + const char *value); +X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *name, const char *value); +int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509 *cert); +int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509_REQ *req); +int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509_CRL *crl); + +int X509V3_add_value_bool_nf(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); +int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); +void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); +void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); +#endif + +char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); +STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); +void X509V3_string_free(X509V3_CTX *ctx, char *str); +void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); +void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, + X509_REQ *req, X509_CRL *crl, int flags); +/* For API backward compatibility, this is separate from X509V3_set_ctx(): */ +int X509V3_set_issuer_pkey(X509V3_CTX *ctx, EVP_PKEY *pkey); + +int X509V3_add_value(const char *name, const char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_uchar(const char *name, const unsigned char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_bool(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, + STACK_OF(CONF_VALUE) **extlist); +char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); +ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); +char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); +char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, + const ASN1_ENUMERATED *aint); +int X509V3_EXT_add(X509V3_EXT_METHOD *ext); +int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); +int X509V3_EXT_add_alias(int nid_to, int nid_from); +void X509V3_EXT_cleanup(void); + +const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); +const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); +int X509V3_add_standard_extensions(void); +STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); +void *X509V3_EXT_d2i(X509_EXTENSION *ext); +void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, + int *idx); + +X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); +int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, + int crit, unsigned long flags); + +#ifndef OPENSSL_NO_DEPRECATED_1_1_0 +/* The new declarations are in crypto.h, but the old ones were here. */ +#define hex_to_string OPENSSL_buf2hexstr +#define string_to_hex OPENSSL_hexstr2buf +#endif + +void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, + int ml); +int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, + int indent); +#ifndef OPENSSL_NO_STDIO +int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); +#endif +int X509V3_extensions_print(BIO *out, const char *title, + const STACK_OF(X509_EXTENSION) *exts, + unsigned long flag, int indent); + +int X509_check_ca(X509 *x); +int X509_check_purpose(X509 *x, int id, int ca); +int X509_supported_extension(X509_EXTENSION *ex); +int X509_check_issued(X509 *issuer, X509 *subject); +int X509_check_akid(const X509 *issuer, const AUTHORITY_KEYID *akid); +void X509_set_proxy_flag(X509 *x); +void X509_set_proxy_pathlen(X509 *x, long l); +long X509_get_proxy_pathlen(X509 *x); + +uint32_t X509_get_extension_flags(X509 *x); +uint32_t X509_get_key_usage(X509 *x); +uint32_t X509_get_extended_key_usage(X509 *x); +const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); +const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); +const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); +const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); + +int X509_PURPOSE_get_count(void); +int X509_PURPOSE_get_unused_id(OSSL_LIB_CTX *libctx); +int X509_PURPOSE_get_by_sname(const char *sname); +int X509_PURPOSE_get_by_id(int id); +int X509_PURPOSE_add(int id, int trust, int flags, + int (*ck)(const X509_PURPOSE *, const X509 *, int), + const char *name, const char *sname, void *arg); +void X509_PURPOSE_cleanup(void); + +X509_PURPOSE *X509_PURPOSE_get0(int idx); +int X509_PURPOSE_get_id(const X509_PURPOSE *); +char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); +char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); +int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); +int X509_PURPOSE_set(int *p, int purpose); + +STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); +STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); +void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); +STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); + +/* Flags for X509_check_* functions */ + +/* + * Always check subject name for host match even if subject alt names present + */ +#define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 +/* Disable wildcard matching for dnsName fields and common name. */ +#define X509_CHECK_FLAG_NO_WILDCARDS 0x2 +/* Wildcards must not match a partial label. */ +#define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 +/* Allow (non-partial) wildcards to match multiple labels. */ +#define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 +/* Constraint verifier subdomain patterns to match a single labels. */ +#define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 +/* Never check the subject CN */ +#define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 +/* + * Match reference identifiers starting with "." to any sub-domain. + * This is a non-public flag, turned on implicitly when the subject + * reference identity is a DNS name. + */ +#define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 + +int X509_check_host(X509 *x, const char *chk, size_t chklen, + unsigned int flags, char **peername); +int X509_check_email(X509 *x, const char *chk, size_t chklen, + unsigned int flags); +int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, + unsigned int flags); +int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); + +ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); +ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); +int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, + unsigned long chtype); + +void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(X509_POLICY_NODE, X509_POLICY_NODE, X509_POLICY_NODE) +#define sk_X509_POLICY_NODE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_POLICY_NODE_sk_type(sk)) +#define sk_X509_POLICY_NODE_value(sk, idx) ((X509_POLICY_NODE *)OPENSSL_sk_value(ossl_check_const_X509_POLICY_NODE_sk_type(sk), (idx))) +#define sk_X509_POLICY_NODE_new(cmp) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_new(ossl_check_X509_POLICY_NODE_compfunc_type(cmp))) +#define sk_X509_POLICY_NODE_new_null() ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_new_null()) +#define sk_X509_POLICY_NODE_new_reserve(cmp, n) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_new_reserve(ossl_check_X509_POLICY_NODE_compfunc_type(cmp), (n))) +#define sk_X509_POLICY_NODE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_POLICY_NODE_sk_type(sk), (n)) +#define sk_X509_POLICY_NODE_free(sk) OPENSSL_sk_free(ossl_check_X509_POLICY_NODE_sk_type(sk)) +#define sk_X509_POLICY_NODE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_POLICY_NODE_sk_type(sk)) +#define sk_X509_POLICY_NODE_delete(sk, i) ((X509_POLICY_NODE *)OPENSSL_sk_delete(ossl_check_X509_POLICY_NODE_sk_type(sk), (i))) +#define sk_X509_POLICY_NODE_delete_ptr(sk, ptr) ((X509_POLICY_NODE *)OPENSSL_sk_delete_ptr(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr))) +#define sk_X509_POLICY_NODE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr)) +#define sk_X509_POLICY_NODE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr)) +#define sk_X509_POLICY_NODE_pop(sk) ((X509_POLICY_NODE *)OPENSSL_sk_pop(ossl_check_X509_POLICY_NODE_sk_type(sk))) +#define sk_X509_POLICY_NODE_shift(sk) ((X509_POLICY_NODE *)OPENSSL_sk_shift(ossl_check_X509_POLICY_NODE_sk_type(sk))) +#define sk_X509_POLICY_NODE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_freefunc_type(freefunc)) +#define sk_X509_POLICY_NODE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr), (idx)) +#define sk_X509_POLICY_NODE_set(sk, idx, ptr) ((X509_POLICY_NODE *)OPENSSL_sk_set(ossl_check_X509_POLICY_NODE_sk_type(sk), (idx), ossl_check_X509_POLICY_NODE_type(ptr))) +#define sk_X509_POLICY_NODE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr)) +#define sk_X509_POLICY_NODE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr)) +#define sk_X509_POLICY_NODE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr), pnum) +#define sk_X509_POLICY_NODE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_POLICY_NODE_sk_type(sk)) +#define sk_X509_POLICY_NODE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_POLICY_NODE_sk_type(sk)) +#define sk_X509_POLICY_NODE_dup(sk) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_dup(ossl_check_const_X509_POLICY_NODE_sk_type(sk))) +#define sk_X509_POLICY_NODE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_copyfunc_type(copyfunc), ossl_check_X509_POLICY_NODE_freefunc_type(freefunc))) +#define sk_X509_POLICY_NODE_set_cmp_func(sk, cmp) ((sk_X509_POLICY_NODE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_compfunc_type(cmp))) + +/* clang-format on */ + +#ifndef OPENSSL_NO_RFC3779 +typedef struct ASRange_st { + ASN1_INTEGER *min, *max; +} ASRange; + +#define ASIdOrRange_id 0 +#define ASIdOrRange_range 1 + +typedef struct ASIdOrRange_st { + int type; + union { + ASN1_INTEGER *id; + ASRange *range; + } u; +} ASIdOrRange; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ASIdOrRange, ASIdOrRange, ASIdOrRange) +#define sk_ASIdOrRange_num(sk) OPENSSL_sk_num(ossl_check_const_ASIdOrRange_sk_type(sk)) +#define sk_ASIdOrRange_value(sk, idx) ((ASIdOrRange *)OPENSSL_sk_value(ossl_check_const_ASIdOrRange_sk_type(sk), (idx))) +#define sk_ASIdOrRange_new(cmp) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_new(ossl_check_ASIdOrRange_compfunc_type(cmp))) +#define sk_ASIdOrRange_new_null() ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_new_null()) +#define sk_ASIdOrRange_new_reserve(cmp, n) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_new_reserve(ossl_check_ASIdOrRange_compfunc_type(cmp), (n))) +#define sk_ASIdOrRange_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASIdOrRange_sk_type(sk), (n)) +#define sk_ASIdOrRange_free(sk) OPENSSL_sk_free(ossl_check_ASIdOrRange_sk_type(sk)) +#define sk_ASIdOrRange_zero(sk) OPENSSL_sk_zero(ossl_check_ASIdOrRange_sk_type(sk)) +#define sk_ASIdOrRange_delete(sk, i) ((ASIdOrRange *)OPENSSL_sk_delete(ossl_check_ASIdOrRange_sk_type(sk), (i))) +#define sk_ASIdOrRange_delete_ptr(sk, ptr) ((ASIdOrRange *)OPENSSL_sk_delete_ptr(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr))) +#define sk_ASIdOrRange_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr)) +#define sk_ASIdOrRange_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr)) +#define sk_ASIdOrRange_pop(sk) ((ASIdOrRange *)OPENSSL_sk_pop(ossl_check_ASIdOrRange_sk_type(sk))) +#define sk_ASIdOrRange_shift(sk) ((ASIdOrRange *)OPENSSL_sk_shift(ossl_check_ASIdOrRange_sk_type(sk))) +#define sk_ASIdOrRange_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_freefunc_type(freefunc)) +#define sk_ASIdOrRange_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr), (idx)) +#define sk_ASIdOrRange_set(sk, idx, ptr) ((ASIdOrRange *)OPENSSL_sk_set(ossl_check_ASIdOrRange_sk_type(sk), (idx), ossl_check_ASIdOrRange_type(ptr))) +#define sk_ASIdOrRange_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr)) +#define sk_ASIdOrRange_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr)) +#define sk_ASIdOrRange_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr), pnum) +#define sk_ASIdOrRange_sort(sk) OPENSSL_sk_sort(ossl_check_ASIdOrRange_sk_type(sk)) +#define sk_ASIdOrRange_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASIdOrRange_sk_type(sk)) +#define sk_ASIdOrRange_dup(sk) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_dup(ossl_check_const_ASIdOrRange_sk_type(sk))) +#define sk_ASIdOrRange_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_deep_copy(ossl_check_const_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_copyfunc_type(copyfunc), ossl_check_ASIdOrRange_freefunc_type(freefunc))) +#define sk_ASIdOrRange_set_cmp_func(sk, cmp) ((sk_ASIdOrRange_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_compfunc_type(cmp))) + +/* clang-format on */ + +typedef STACK_OF(ASIdOrRange) ASIdOrRanges; + +#define ASIdentifierChoice_inherit 0 +#define ASIdentifierChoice_asIdsOrRanges 1 + +typedef struct ASIdentifierChoice_st { + int type; + union { + ASN1_NULL *inherit; + ASIdOrRanges *asIdsOrRanges; + } u; +} ASIdentifierChoice; + +typedef struct ASIdentifiers_st { + ASIdentifierChoice *asnum, *rdi; +} ASIdentifiers; + +DECLARE_ASN1_FUNCTIONS(ASRange) +DECLARE_ASN1_FUNCTIONS(ASIdOrRange) +DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) +DECLARE_ASN1_FUNCTIONS(ASIdentifiers) + +typedef struct IPAddressRange_st { + ASN1_BIT_STRING *min, *max; +} IPAddressRange; + +#define IPAddressOrRange_addressPrefix 0 +#define IPAddressOrRange_addressRange 1 + +typedef struct IPAddressOrRange_st { + int type; + union { + ASN1_BIT_STRING *addressPrefix; + IPAddressRange *addressRange; + } u; +} IPAddressOrRange; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(IPAddressOrRange, IPAddressOrRange, IPAddressOrRange) +#define sk_IPAddressOrRange_num(sk) OPENSSL_sk_num(ossl_check_const_IPAddressOrRange_sk_type(sk)) +#define sk_IPAddressOrRange_value(sk, idx) ((IPAddressOrRange *)OPENSSL_sk_value(ossl_check_const_IPAddressOrRange_sk_type(sk), (idx))) +#define sk_IPAddressOrRange_new(cmp) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_new(ossl_check_IPAddressOrRange_compfunc_type(cmp))) +#define sk_IPAddressOrRange_new_null() ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_new_null()) +#define sk_IPAddressOrRange_new_reserve(cmp, n) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_new_reserve(ossl_check_IPAddressOrRange_compfunc_type(cmp), (n))) +#define sk_IPAddressOrRange_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_IPAddressOrRange_sk_type(sk), (n)) +#define sk_IPAddressOrRange_free(sk) OPENSSL_sk_free(ossl_check_IPAddressOrRange_sk_type(sk)) +#define sk_IPAddressOrRange_zero(sk) OPENSSL_sk_zero(ossl_check_IPAddressOrRange_sk_type(sk)) +#define sk_IPAddressOrRange_delete(sk, i) ((IPAddressOrRange *)OPENSSL_sk_delete(ossl_check_IPAddressOrRange_sk_type(sk), (i))) +#define sk_IPAddressOrRange_delete_ptr(sk, ptr) ((IPAddressOrRange *)OPENSSL_sk_delete_ptr(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr))) +#define sk_IPAddressOrRange_push(sk, ptr) OPENSSL_sk_push(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr)) +#define sk_IPAddressOrRange_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr)) +#define sk_IPAddressOrRange_pop(sk) ((IPAddressOrRange *)OPENSSL_sk_pop(ossl_check_IPAddressOrRange_sk_type(sk))) +#define sk_IPAddressOrRange_shift(sk) ((IPAddressOrRange *)OPENSSL_sk_shift(ossl_check_IPAddressOrRange_sk_type(sk))) +#define sk_IPAddressOrRange_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_freefunc_type(freefunc)) +#define sk_IPAddressOrRange_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr), (idx)) +#define sk_IPAddressOrRange_set(sk, idx, ptr) ((IPAddressOrRange *)OPENSSL_sk_set(ossl_check_IPAddressOrRange_sk_type(sk), (idx), ossl_check_IPAddressOrRange_type(ptr))) +#define sk_IPAddressOrRange_find(sk, ptr) OPENSSL_sk_find(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr)) +#define sk_IPAddressOrRange_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr)) +#define sk_IPAddressOrRange_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr), pnum) +#define sk_IPAddressOrRange_sort(sk) OPENSSL_sk_sort(ossl_check_IPAddressOrRange_sk_type(sk)) +#define sk_IPAddressOrRange_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_IPAddressOrRange_sk_type(sk)) +#define sk_IPAddressOrRange_dup(sk) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_dup(ossl_check_const_IPAddressOrRange_sk_type(sk))) +#define sk_IPAddressOrRange_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_deep_copy(ossl_check_const_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_copyfunc_type(copyfunc), ossl_check_IPAddressOrRange_freefunc_type(freefunc))) +#define sk_IPAddressOrRange_set_cmp_func(sk, cmp) ((sk_IPAddressOrRange_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_compfunc_type(cmp))) + +/* clang-format on */ + +typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; + +#define IPAddressChoice_inherit 0 +#define IPAddressChoice_addressesOrRanges 1 + +typedef struct IPAddressChoice_st { + int type; + union { + ASN1_NULL *inherit; + IPAddressOrRanges *addressesOrRanges; + } u; +} IPAddressChoice; + +typedef struct IPAddressFamily_st { + ASN1_OCTET_STRING *addressFamily; + IPAddressChoice *ipAddressChoice; +} IPAddressFamily; + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(IPAddressFamily, IPAddressFamily, IPAddressFamily) +#define sk_IPAddressFamily_num(sk) OPENSSL_sk_num(ossl_check_const_IPAddressFamily_sk_type(sk)) +#define sk_IPAddressFamily_value(sk, idx) ((IPAddressFamily *)OPENSSL_sk_value(ossl_check_const_IPAddressFamily_sk_type(sk), (idx))) +#define sk_IPAddressFamily_new(cmp) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_new(ossl_check_IPAddressFamily_compfunc_type(cmp))) +#define sk_IPAddressFamily_new_null() ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_new_null()) +#define sk_IPAddressFamily_new_reserve(cmp, n) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_new_reserve(ossl_check_IPAddressFamily_compfunc_type(cmp), (n))) +#define sk_IPAddressFamily_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_IPAddressFamily_sk_type(sk), (n)) +#define sk_IPAddressFamily_free(sk) OPENSSL_sk_free(ossl_check_IPAddressFamily_sk_type(sk)) +#define sk_IPAddressFamily_zero(sk) OPENSSL_sk_zero(ossl_check_IPAddressFamily_sk_type(sk)) +#define sk_IPAddressFamily_delete(sk, i) ((IPAddressFamily *)OPENSSL_sk_delete(ossl_check_IPAddressFamily_sk_type(sk), (i))) +#define sk_IPAddressFamily_delete_ptr(sk, ptr) ((IPAddressFamily *)OPENSSL_sk_delete_ptr(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr))) +#define sk_IPAddressFamily_push(sk, ptr) OPENSSL_sk_push(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr)) +#define sk_IPAddressFamily_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr)) +#define sk_IPAddressFamily_pop(sk) ((IPAddressFamily *)OPENSSL_sk_pop(ossl_check_IPAddressFamily_sk_type(sk))) +#define sk_IPAddressFamily_shift(sk) ((IPAddressFamily *)OPENSSL_sk_shift(ossl_check_IPAddressFamily_sk_type(sk))) +#define sk_IPAddressFamily_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_freefunc_type(freefunc)) +#define sk_IPAddressFamily_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr), (idx)) +#define sk_IPAddressFamily_set(sk, idx, ptr) ((IPAddressFamily *)OPENSSL_sk_set(ossl_check_IPAddressFamily_sk_type(sk), (idx), ossl_check_IPAddressFamily_type(ptr))) +#define sk_IPAddressFamily_find(sk, ptr) OPENSSL_sk_find(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr)) +#define sk_IPAddressFamily_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr)) +#define sk_IPAddressFamily_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr), pnum) +#define sk_IPAddressFamily_sort(sk) OPENSSL_sk_sort(ossl_check_IPAddressFamily_sk_type(sk)) +#define sk_IPAddressFamily_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_IPAddressFamily_sk_type(sk)) +#define sk_IPAddressFamily_dup(sk) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_dup(ossl_check_const_IPAddressFamily_sk_type(sk))) +#define sk_IPAddressFamily_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_deep_copy(ossl_check_const_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_copyfunc_type(copyfunc), ossl_check_IPAddressFamily_freefunc_type(freefunc))) +#define sk_IPAddressFamily_set_cmp_func(sk, cmp) ((sk_IPAddressFamily_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_compfunc_type(cmp))) + +/* clang-format on */ + +typedef STACK_OF(IPAddressFamily) IPAddrBlocks; + +DECLARE_ASN1_FUNCTIONS(IPAddressRange) +DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) +DECLARE_ASN1_FUNCTIONS(IPAddressChoice) +DECLARE_ASN1_FUNCTIONS(IPAddressFamily) + +/* + * API tag for elements of the ASIdentifer SEQUENCE. + */ +#define V3_ASID_ASNUM 0 +#define V3_ASID_RDI 1 + +/* + * AFI values, assigned by IANA. It'd be nice to make the AFI + * handling code totally generic, but there are too many little things + * that would need to be defined for other address families for it to + * be worth the trouble. + */ +#define IANA_AFI_IPV4 1 +#define IANA_AFI_IPV6 2 + +/* + * Utilities to construct and extract values from RFC3779 extensions, + * since some of the encodings (particularly for IP address prefixes + * and ranges) are a bit tedious to work with directly. + */ +int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); +int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, + ASN1_INTEGER *min, ASN1_INTEGER *max); +int X509v3_addr_add_inherit(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi); +int X509v3_addr_add_prefix(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *a, const int prefixlen); +int X509v3_addr_add_range(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *min, unsigned char *max); +unsigned X509v3_addr_get_afi(const IPAddressFamily *f); +int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, + unsigned char *min, unsigned char *max, + const int length); + +/* + * Canonical forms. + */ +int X509v3_asid_is_canonical(ASIdentifiers *asid); +int X509v3_addr_is_canonical(IPAddrBlocks *addr); +int X509v3_asid_canonize(ASIdentifiers *asid); +int X509v3_addr_canonize(IPAddrBlocks *addr); + +/* + * Tests for inheritance and containment. + */ +int X509v3_asid_inherits(ASIdentifiers *asid); +int X509v3_addr_inherits(IPAddrBlocks *addr); +int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); +int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); + +/* + * Check whether RFC 3779 extensions nest properly in chains. + */ +int X509v3_asid_validate_path(X509_STORE_CTX *); +int X509v3_addr_validate_path(X509_STORE_CTX *); +int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, + ASIdentifiers *ext, + int allow_inheritance); +int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, + IPAddrBlocks *ext, int allow_inheritance); + +#endif /* OPENSSL_NO_RFC3779 */ + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(ASN1_STRING, ASN1_STRING, ASN1_STRING) +#define sk_ASN1_STRING_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_STRING_sk_type(sk)) +#define sk_ASN1_STRING_value(sk, idx) ((ASN1_STRING *)OPENSSL_sk_value(ossl_check_const_ASN1_STRING_sk_type(sk), (idx))) +#define sk_ASN1_STRING_new(cmp) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_new(ossl_check_ASN1_STRING_compfunc_type(cmp))) +#define sk_ASN1_STRING_new_null() ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_new_null()) +#define sk_ASN1_STRING_new_reserve(cmp, n) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_STRING_compfunc_type(cmp), (n))) +#define sk_ASN1_STRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_STRING_sk_type(sk), (n)) +#define sk_ASN1_STRING_free(sk) OPENSSL_sk_free(ossl_check_ASN1_STRING_sk_type(sk)) +#define sk_ASN1_STRING_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_STRING_sk_type(sk)) +#define sk_ASN1_STRING_delete(sk, i) ((ASN1_STRING *)OPENSSL_sk_delete(ossl_check_ASN1_STRING_sk_type(sk), (i))) +#define sk_ASN1_STRING_delete_ptr(sk, ptr) ((ASN1_STRING *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr))) +#define sk_ASN1_STRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr)) +#define sk_ASN1_STRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr)) +#define sk_ASN1_STRING_pop(sk) ((ASN1_STRING *)OPENSSL_sk_pop(ossl_check_ASN1_STRING_sk_type(sk))) +#define sk_ASN1_STRING_shift(sk) ((ASN1_STRING *)OPENSSL_sk_shift(ossl_check_ASN1_STRING_sk_type(sk))) +#define sk_ASN1_STRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_freefunc_type(freefunc)) +#define sk_ASN1_STRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr), (idx)) +#define sk_ASN1_STRING_set(sk, idx, ptr) ((ASN1_STRING *)OPENSSL_sk_set(ossl_check_ASN1_STRING_sk_type(sk), (idx), ossl_check_ASN1_STRING_type(ptr))) +#define sk_ASN1_STRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr)) +#define sk_ASN1_STRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr)) +#define sk_ASN1_STRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr), pnum) +#define sk_ASN1_STRING_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_STRING_sk_type(sk)) +#define sk_ASN1_STRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_STRING_sk_type(sk)) +#define sk_ASN1_STRING_dup(sk) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_dup(ossl_check_const_ASN1_STRING_sk_type(sk))) +#define sk_ASN1_STRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_copyfunc_type(copyfunc), ossl_check_ASN1_STRING_freefunc_type(freefunc))) +#define sk_ASN1_STRING_set_cmp_func(sk, cmp) ((sk_ASN1_STRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_compfunc_type(cmp))) + +/* clang-format on */ + +/* + * Admission Syntax + */ +typedef struct NamingAuthority_st NAMING_AUTHORITY; +typedef struct ProfessionInfo_st PROFESSION_INFO; +typedef struct Admissions_st ADMISSIONS; +typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; +DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) +DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) +DECLARE_ASN1_FUNCTIONS(ADMISSIONS) +DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(PROFESSION_INFO, PROFESSION_INFO, PROFESSION_INFO) +#define sk_PROFESSION_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_PROFESSION_INFO_sk_type(sk)) +#define sk_PROFESSION_INFO_value(sk, idx) ((PROFESSION_INFO *)OPENSSL_sk_value(ossl_check_const_PROFESSION_INFO_sk_type(sk), (idx))) +#define sk_PROFESSION_INFO_new(cmp) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_new(ossl_check_PROFESSION_INFO_compfunc_type(cmp))) +#define sk_PROFESSION_INFO_new_null() ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_new_null()) +#define sk_PROFESSION_INFO_new_reserve(cmp, n) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_new_reserve(ossl_check_PROFESSION_INFO_compfunc_type(cmp), (n))) +#define sk_PROFESSION_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PROFESSION_INFO_sk_type(sk), (n)) +#define sk_PROFESSION_INFO_free(sk) OPENSSL_sk_free(ossl_check_PROFESSION_INFO_sk_type(sk)) +#define sk_PROFESSION_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_PROFESSION_INFO_sk_type(sk)) +#define sk_PROFESSION_INFO_delete(sk, i) ((PROFESSION_INFO *)OPENSSL_sk_delete(ossl_check_PROFESSION_INFO_sk_type(sk), (i))) +#define sk_PROFESSION_INFO_delete_ptr(sk, ptr) ((PROFESSION_INFO *)OPENSSL_sk_delete_ptr(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr))) +#define sk_PROFESSION_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr)) +#define sk_PROFESSION_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr)) +#define sk_PROFESSION_INFO_pop(sk) ((PROFESSION_INFO *)OPENSSL_sk_pop(ossl_check_PROFESSION_INFO_sk_type(sk))) +#define sk_PROFESSION_INFO_shift(sk) ((PROFESSION_INFO *)OPENSSL_sk_shift(ossl_check_PROFESSION_INFO_sk_type(sk))) +#define sk_PROFESSION_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_freefunc_type(freefunc)) +#define sk_PROFESSION_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr), (idx)) +#define sk_PROFESSION_INFO_set(sk, idx, ptr) ((PROFESSION_INFO *)OPENSSL_sk_set(ossl_check_PROFESSION_INFO_sk_type(sk), (idx), ossl_check_PROFESSION_INFO_type(ptr))) +#define sk_PROFESSION_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr)) +#define sk_PROFESSION_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr)) +#define sk_PROFESSION_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr), pnum) +#define sk_PROFESSION_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_PROFESSION_INFO_sk_type(sk)) +#define sk_PROFESSION_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PROFESSION_INFO_sk_type(sk)) +#define sk_PROFESSION_INFO_dup(sk) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_dup(ossl_check_const_PROFESSION_INFO_sk_type(sk))) +#define sk_PROFESSION_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_copyfunc_type(copyfunc), ossl_check_PROFESSION_INFO_freefunc_type(freefunc))) +#define sk_PROFESSION_INFO_set_cmp_func(sk, cmp) ((sk_PROFESSION_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_compfunc_type(cmp))) +SKM_DEFINE_STACK_OF_INTERNAL(ADMISSIONS, ADMISSIONS, ADMISSIONS) +#define sk_ADMISSIONS_num(sk) OPENSSL_sk_num(ossl_check_const_ADMISSIONS_sk_type(sk)) +#define sk_ADMISSIONS_value(sk, idx) ((ADMISSIONS *)OPENSSL_sk_value(ossl_check_const_ADMISSIONS_sk_type(sk), (idx))) +#define sk_ADMISSIONS_new(cmp) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_new(ossl_check_ADMISSIONS_compfunc_type(cmp))) +#define sk_ADMISSIONS_new_null() ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_new_null()) +#define sk_ADMISSIONS_new_reserve(cmp, n) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_new_reserve(ossl_check_ADMISSIONS_compfunc_type(cmp), (n))) +#define sk_ADMISSIONS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ADMISSIONS_sk_type(sk), (n)) +#define sk_ADMISSIONS_free(sk) OPENSSL_sk_free(ossl_check_ADMISSIONS_sk_type(sk)) +#define sk_ADMISSIONS_zero(sk) OPENSSL_sk_zero(ossl_check_ADMISSIONS_sk_type(sk)) +#define sk_ADMISSIONS_delete(sk, i) ((ADMISSIONS *)OPENSSL_sk_delete(ossl_check_ADMISSIONS_sk_type(sk), (i))) +#define sk_ADMISSIONS_delete_ptr(sk, ptr) ((ADMISSIONS *)OPENSSL_sk_delete_ptr(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr))) +#define sk_ADMISSIONS_push(sk, ptr) OPENSSL_sk_push(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr)) +#define sk_ADMISSIONS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr)) +#define sk_ADMISSIONS_pop(sk) ((ADMISSIONS *)OPENSSL_sk_pop(ossl_check_ADMISSIONS_sk_type(sk))) +#define sk_ADMISSIONS_shift(sk) ((ADMISSIONS *)OPENSSL_sk_shift(ossl_check_ADMISSIONS_sk_type(sk))) +#define sk_ADMISSIONS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_freefunc_type(freefunc)) +#define sk_ADMISSIONS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr), (idx)) +#define sk_ADMISSIONS_set(sk, idx, ptr) ((ADMISSIONS *)OPENSSL_sk_set(ossl_check_ADMISSIONS_sk_type(sk), (idx), ossl_check_ADMISSIONS_type(ptr))) +#define sk_ADMISSIONS_find(sk, ptr) OPENSSL_sk_find(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr)) +#define sk_ADMISSIONS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr)) +#define sk_ADMISSIONS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr), pnum) +#define sk_ADMISSIONS_sort(sk) OPENSSL_sk_sort(ossl_check_ADMISSIONS_sk_type(sk)) +#define sk_ADMISSIONS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ADMISSIONS_sk_type(sk)) +#define sk_ADMISSIONS_dup(sk) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_dup(ossl_check_const_ADMISSIONS_sk_type(sk))) +#define sk_ADMISSIONS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_deep_copy(ossl_check_const_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_copyfunc_type(copyfunc), ossl_check_ADMISSIONS_freefunc_type(freefunc))) +#define sk_ADMISSIONS_set_cmp_func(sk, cmp) ((sk_ADMISSIONS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_compfunc_type(cmp))) + +/* clang-format on */ +typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; + +const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( + const NAMING_AUTHORITY *n); +const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( + const NAMING_AUTHORITY *n); +const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( + const NAMING_AUTHORITY *n); +void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, + ASN1_OBJECT *namingAuthorityId); +void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, + ASN1_IA5STRING *namingAuthorityUrl); +void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, + ASN1_STRING *namingAuthorityText); + +const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( + const ADMISSION_SYNTAX *as); +void ADMISSION_SYNTAX_set0_admissionAuthority( + ADMISSION_SYNTAX *as, GENERAL_NAME *aa); +const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( + const ADMISSION_SYNTAX *as); +void ADMISSION_SYNTAX_set0_contentsOfAdmissions( + ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); +const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); +void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); +const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); +void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); +const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); +void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); +const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_addProfessionInfo( + PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); +const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_namingAuthority( + PROFESSION_INFO *pi, NAMING_AUTHORITY *na); +const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_professionItems( + PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); +const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_professionOIDs( + PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); +const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_registrationNumber( + PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); + +int OSSL_GENERAL_NAMES_print(BIO *out, GENERAL_NAMES *gens, int indent); + +typedef STACK_OF(X509_ATTRIBUTE) OSSL_ATTRIBUTES_SYNTAX; +DECLARE_ASN1_FUNCTIONS(OSSL_ATTRIBUTES_SYNTAX) + +typedef STACK_OF(USERNOTICE) OSSL_USER_NOTICE_SYNTAX; +DECLARE_ASN1_FUNCTIONS(OSSL_USER_NOTICE_SYNTAX) + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(USERNOTICE, USERNOTICE, USERNOTICE) +#define sk_USERNOTICE_num(sk) OPENSSL_sk_num(ossl_check_const_USERNOTICE_sk_type(sk)) +#define sk_USERNOTICE_value(sk, idx) ((USERNOTICE *)OPENSSL_sk_value(ossl_check_const_USERNOTICE_sk_type(sk), (idx))) +#define sk_USERNOTICE_new(cmp) ((STACK_OF(USERNOTICE) *)OPENSSL_sk_new(ossl_check_USERNOTICE_compfunc_type(cmp))) +#define sk_USERNOTICE_new_null() ((STACK_OF(USERNOTICE) *)OPENSSL_sk_new_null()) +#define sk_USERNOTICE_new_reserve(cmp, n) ((STACK_OF(USERNOTICE) *)OPENSSL_sk_new_reserve(ossl_check_USERNOTICE_compfunc_type(cmp), (n))) +#define sk_USERNOTICE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_USERNOTICE_sk_type(sk), (n)) +#define sk_USERNOTICE_free(sk) OPENSSL_sk_free(ossl_check_USERNOTICE_sk_type(sk)) +#define sk_USERNOTICE_zero(sk) OPENSSL_sk_zero(ossl_check_USERNOTICE_sk_type(sk)) +#define sk_USERNOTICE_delete(sk, i) ((USERNOTICE *)OPENSSL_sk_delete(ossl_check_USERNOTICE_sk_type(sk), (i))) +#define sk_USERNOTICE_delete_ptr(sk, ptr) ((USERNOTICE *)OPENSSL_sk_delete_ptr(ossl_check_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_type(ptr))) +#define sk_USERNOTICE_push(sk, ptr) OPENSSL_sk_push(ossl_check_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_type(ptr)) +#define sk_USERNOTICE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_type(ptr)) +#define sk_USERNOTICE_pop(sk) ((USERNOTICE *)OPENSSL_sk_pop(ossl_check_USERNOTICE_sk_type(sk))) +#define sk_USERNOTICE_shift(sk) ((USERNOTICE *)OPENSSL_sk_shift(ossl_check_USERNOTICE_sk_type(sk))) +#define sk_USERNOTICE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_freefunc_type(freefunc)) +#define sk_USERNOTICE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_type(ptr), (idx)) +#define sk_USERNOTICE_set(sk, idx, ptr) ((USERNOTICE *)OPENSSL_sk_set(ossl_check_USERNOTICE_sk_type(sk), (idx), ossl_check_USERNOTICE_type(ptr))) +#define sk_USERNOTICE_find(sk, ptr) OPENSSL_sk_find(ossl_check_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_type(ptr)) +#define sk_USERNOTICE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_type(ptr)) +#define sk_USERNOTICE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_type(ptr), pnum) +#define sk_USERNOTICE_sort(sk) OPENSSL_sk_sort(ossl_check_USERNOTICE_sk_type(sk)) +#define sk_USERNOTICE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_USERNOTICE_sk_type(sk)) +#define sk_USERNOTICE_dup(sk) ((STACK_OF(USERNOTICE) *)OPENSSL_sk_dup(ossl_check_const_USERNOTICE_sk_type(sk))) +#define sk_USERNOTICE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(USERNOTICE) *)OPENSSL_sk_deep_copy(ossl_check_const_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_copyfunc_type(copyfunc), ossl_check_USERNOTICE_freefunc_type(freefunc))) +#define sk_USERNOTICE_set_cmp_func(sk, cmp) ((sk_USERNOTICE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_USERNOTICE_sk_type(sk), ossl_check_USERNOTICE_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct OSSL_ROLE_SPEC_CERT_ID_st { + GENERAL_NAME *roleName; + GENERAL_NAME *roleCertIssuer; + ASN1_INTEGER *roleCertSerialNumber; + GENERAL_NAMES *roleCertLocator; +} OSSL_ROLE_SPEC_CERT_ID; + +DECLARE_ASN1_FUNCTIONS(OSSL_ROLE_SPEC_CERT_ID) + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_ROLE_SPEC_CERT_ID, OSSL_ROLE_SPEC_CERT_ID, OSSL_ROLE_SPEC_CERT_ID) +#define sk_OSSL_ROLE_SPEC_CERT_ID_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_value(sk, idx) ((OSSL_ROLE_SPEC_CERT_ID *)OPENSSL_sk_value(ossl_check_const_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), (idx))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_new(cmp) ((STACK_OF(OSSL_ROLE_SPEC_CERT_ID) *)OPENSSL_sk_new(ossl_check_OSSL_ROLE_SPEC_CERT_ID_compfunc_type(cmp))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_new_null() ((STACK_OF(OSSL_ROLE_SPEC_CERT_ID) *)OPENSSL_sk_new_null()) +#define sk_OSSL_ROLE_SPEC_CERT_ID_new_reserve(cmp, n) ((STACK_OF(OSSL_ROLE_SPEC_CERT_ID) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_ROLE_SPEC_CERT_ID_compfunc_type(cmp), (n))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), (n)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_free(sk) OPENSSL_sk_free(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_delete(sk, i) ((OSSL_ROLE_SPEC_CERT_ID *)OPENSSL_sk_delete(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), (i))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_delete_ptr(sk, ptr) ((OSSL_ROLE_SPEC_CERT_ID *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_type(ptr))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_type(ptr)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_type(ptr)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_pop(sk) ((OSSL_ROLE_SPEC_CERT_ID *)OPENSSL_sk_pop(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_shift(sk) ((OSSL_ROLE_SPEC_CERT_ID *)OPENSSL_sk_shift(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_freefunc_type(freefunc)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_type(ptr), (idx)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_set(sk, idx, ptr) ((OSSL_ROLE_SPEC_CERT_ID *)OPENSSL_sk_set(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), (idx), ossl_check_OSSL_ROLE_SPEC_CERT_ID_type(ptr))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_type(ptr)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_type(ptr)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_type(ptr), pnum) +#define sk_OSSL_ROLE_SPEC_CERT_ID_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk)) +#define sk_OSSL_ROLE_SPEC_CERT_ID_dup(sk) ((STACK_OF(OSSL_ROLE_SPEC_CERT_ID) *)OPENSSL_sk_dup(ossl_check_const_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_ROLE_SPEC_CERT_ID) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_copyfunc_type(copyfunc), ossl_check_OSSL_ROLE_SPEC_CERT_ID_freefunc_type(freefunc))) +#define sk_OSSL_ROLE_SPEC_CERT_ID_set_cmp_func(sk, cmp) ((sk_OSSL_ROLE_SPEC_CERT_ID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_ROLE_SPEC_CERT_ID_sk_type(sk), ossl_check_OSSL_ROLE_SPEC_CERT_ID_compfunc_type(cmp))) + +/* clang-format on */ + +typedef STACK_OF(OSSL_ROLE_SPEC_CERT_ID) OSSL_ROLE_SPEC_CERT_ID_SYNTAX; + +DECLARE_ASN1_FUNCTIONS(OSSL_ROLE_SPEC_CERT_ID_SYNTAX) +typedef struct OSSL_HASH_st { + X509_ALGOR *algorithmIdentifier; + ASN1_BIT_STRING *hashValue; +} OSSL_HASH; + +typedef struct OSSL_INFO_SYNTAX_POINTER_st { + GENERAL_NAMES *name; + OSSL_HASH *hash; +} OSSL_INFO_SYNTAX_POINTER; + +#define OSSL_INFO_SYNTAX_TYPE_CONTENT 0 +#define OSSL_INFO_SYNTAX_TYPE_POINTER 1 + +typedef struct OSSL_INFO_SYNTAX_st { + int type; + union { + ASN1_STRING *content; + OSSL_INFO_SYNTAX_POINTER *pointer; + } choice; +} OSSL_INFO_SYNTAX; + +typedef struct OSSL_PRIVILEGE_POLICY_ID_st { + ASN1_OBJECT *privilegePolicy; + OSSL_INFO_SYNTAX *privPolSyntax; +} OSSL_PRIVILEGE_POLICY_ID; + +typedef struct OSSL_ATTRIBUTE_DESCRIPTOR_st { + ASN1_OBJECT *identifier; + ASN1_STRING *attributeSyntax; + ASN1_UTF8STRING *name; + ASN1_UTF8STRING *description; + OSSL_PRIVILEGE_POLICY_ID *dominationRule; +} OSSL_ATTRIBUTE_DESCRIPTOR; + +DECLARE_ASN1_FUNCTIONS(OSSL_HASH) +DECLARE_ASN1_FUNCTIONS(OSSL_INFO_SYNTAX) +DECLARE_ASN1_FUNCTIONS(OSSL_INFO_SYNTAX_POINTER) +DECLARE_ASN1_FUNCTIONS(OSSL_PRIVILEGE_POLICY_ID) +DECLARE_ASN1_FUNCTIONS(OSSL_ATTRIBUTE_DESCRIPTOR) + +typedef struct OSSL_TIME_SPEC_ABSOLUTE_st { + ASN1_GENERALIZEDTIME *startTime; + ASN1_GENERALIZEDTIME *endTime; +} OSSL_TIME_SPEC_ABSOLUTE; + +typedef struct OSSL_DAY_TIME_st { + ASN1_INTEGER *hour; + ASN1_INTEGER *minute; + ASN1_INTEGER *second; +} OSSL_DAY_TIME; + +typedef struct OSSL_DAY_TIME_BAND_st { + OSSL_DAY_TIME *startDayTime; + OSSL_DAY_TIME *endDayTime; +} OSSL_DAY_TIME_BAND; + +#define OSSL_NAMED_DAY_TYPE_INT 0 +#define OSSL_NAMED_DAY_TYPE_BIT 1 +#define OSSL_NAMED_DAY_INT_SUN 1 +#define OSSL_NAMED_DAY_INT_MON 2 +#define OSSL_NAMED_DAY_INT_TUE 3 +#define OSSL_NAMED_DAY_INT_WED 4 +#define OSSL_NAMED_DAY_INT_THU 5 +#define OSSL_NAMED_DAY_INT_FRI 6 +#define OSSL_NAMED_DAY_INT_SAT 7 +#define OSSL_NAMED_DAY_BIT_SUN 0 +#define OSSL_NAMED_DAY_BIT_MON 1 +#define OSSL_NAMED_DAY_BIT_TUE 2 +#define OSSL_NAMED_DAY_BIT_WED 3 +#define OSSL_NAMED_DAY_BIT_THU 4 +#define OSSL_NAMED_DAY_BIT_FRI 5 +#define OSSL_NAMED_DAY_BIT_SAT 6 + +typedef struct OSSL_NAMED_DAY_st { + int type; + union { + ASN1_INTEGER *intNamedDays; + ASN1_BIT_STRING *bitNamedDays; + } choice; +} OSSL_NAMED_DAY; + +#define OSSL_TIME_SPEC_X_DAY_OF_FIRST 0 +#define OSSL_TIME_SPEC_X_DAY_OF_SECOND 1 +#define OSSL_TIME_SPEC_X_DAY_OF_THIRD 2 +#define OSSL_TIME_SPEC_X_DAY_OF_FOURTH 3 +#define OSSL_TIME_SPEC_X_DAY_OF_FIFTH 4 + +typedef struct OSSL_TIME_SPEC_X_DAY_OF_st { + int type; + union { + OSSL_NAMED_DAY *first; + OSSL_NAMED_DAY *second; + OSSL_NAMED_DAY *third; + OSSL_NAMED_DAY *fourth; + OSSL_NAMED_DAY *fifth; + } choice; +} OSSL_TIME_SPEC_X_DAY_OF; + +#define OSSL_TIME_SPEC_DAY_TYPE_INT 0 +#define OSSL_TIME_SPEC_DAY_TYPE_BIT 1 +#define OSSL_TIME_SPEC_DAY_TYPE_DAY_OF 2 +#define OSSL_TIME_SPEC_DAY_BIT_SUN 0 +#define OSSL_TIME_SPEC_DAY_BIT_MON 1 +#define OSSL_TIME_SPEC_DAY_BIT_TUE 2 +#define OSSL_TIME_SPEC_DAY_BIT_WED 3 +#define OSSL_TIME_SPEC_DAY_BIT_THU 4 +#define OSSL_TIME_SPEC_DAY_BIT_FRI 5 +#define OSSL_TIME_SPEC_DAY_BIT_SAT 6 +#define OSSL_TIME_SPEC_DAY_INT_SUN 1 +#define OSSL_TIME_SPEC_DAY_INT_MON 2 +#define OSSL_TIME_SPEC_DAY_INT_TUE 3 +#define OSSL_TIME_SPEC_DAY_INT_WED 4 +#define OSSL_TIME_SPEC_DAY_INT_THU 5 +#define OSSL_TIME_SPEC_DAY_INT_FRI 6 +#define OSSL_TIME_SPEC_DAY_INT_SAT 7 + +typedef struct OSSL_TIME_SPEC_DAY_st { + int type; + union { + STACK_OF(ASN1_INTEGER) *intDay; + ASN1_BIT_STRING *bitDay; + OSSL_TIME_SPEC_X_DAY_OF *dayOf; + } choice; +} OSSL_TIME_SPEC_DAY; + +#define OSSL_TIME_SPEC_WEEKS_TYPE_ALL 0 +#define OSSL_TIME_SPEC_WEEKS_TYPE_INT 1 +#define OSSL_TIME_SPEC_WEEKS_TYPE_BIT 2 +#define OSSL_TIME_SPEC_BIT_WEEKS_1 0 +#define OSSL_TIME_SPEC_BIT_WEEKS_2 1 +#define OSSL_TIME_SPEC_BIT_WEEKS_3 2 +#define OSSL_TIME_SPEC_BIT_WEEKS_4 3 +#define OSSL_TIME_SPEC_BIT_WEEKS_5 4 + +typedef struct OSSL_TIME_SPEC_WEEKS_st { + int type; + union { + ASN1_NULL *allWeeks; + STACK_OF(ASN1_INTEGER) *intWeek; + ASN1_BIT_STRING *bitWeek; + } choice; +} OSSL_TIME_SPEC_WEEKS; + +#define OSSL_TIME_SPEC_MONTH_TYPE_ALL 0 +#define OSSL_TIME_SPEC_MONTH_TYPE_INT 1 +#define OSSL_TIME_SPEC_MONTH_TYPE_BIT 2 +#define OSSL_TIME_SPEC_INT_MONTH_JAN 1 +#define OSSL_TIME_SPEC_INT_MONTH_FEB 2 +#define OSSL_TIME_SPEC_INT_MONTH_MAR 3 +#define OSSL_TIME_SPEC_INT_MONTH_APR 4 +#define OSSL_TIME_SPEC_INT_MONTH_MAY 5 +#define OSSL_TIME_SPEC_INT_MONTH_JUN 6 +#define OSSL_TIME_SPEC_INT_MONTH_JUL 7 +#define OSSL_TIME_SPEC_INT_MONTH_AUG 8 +#define OSSL_TIME_SPEC_INT_MONTH_SEP 9 +#define OSSL_TIME_SPEC_INT_MONTH_OCT 10 +#define OSSL_TIME_SPEC_INT_MONTH_NOV 11 +#define OSSL_TIME_SPEC_INT_MONTH_DEC 12 +#define OSSL_TIME_SPEC_BIT_MONTH_JAN 0 +#define OSSL_TIME_SPEC_BIT_MONTH_FEB 1 +#define OSSL_TIME_SPEC_BIT_MONTH_MAR 2 +#define OSSL_TIME_SPEC_BIT_MONTH_APR 3 +#define OSSL_TIME_SPEC_BIT_MONTH_MAY 4 +#define OSSL_TIME_SPEC_BIT_MONTH_JUN 5 +#define OSSL_TIME_SPEC_BIT_MONTH_JUL 6 +#define OSSL_TIME_SPEC_BIT_MONTH_AUG 7 +#define OSSL_TIME_SPEC_BIT_MONTH_SEP 8 +#define OSSL_TIME_SPEC_BIT_MONTH_OCT 9 +#define OSSL_TIME_SPEC_BIT_MONTH_NOV 10 +#define OSSL_TIME_SPEC_BIT_MONTH_DEC 11 + +typedef struct OSSL_TIME_SPEC_MONTH_st { + int type; + union { + ASN1_NULL *allMonths; + STACK_OF(ASN1_INTEGER) *intMonth; + ASN1_BIT_STRING *bitMonth; + } choice; +} OSSL_TIME_SPEC_MONTH; + +typedef struct OSSL_TIME_PERIOD_st { + STACK_OF(OSSL_DAY_TIME_BAND) *timesOfDay; + OSSL_TIME_SPEC_DAY *days; + OSSL_TIME_SPEC_WEEKS *weeks; + OSSL_TIME_SPEC_MONTH *months; + STACK_OF(ASN1_INTEGER) *years; +} OSSL_TIME_PERIOD; + +#define OSSL_TIME_SPEC_TIME_TYPE_ABSOLUTE 0 +#define OSSL_TIME_SPEC_TIME_TYPE_PERIODIC 1 + +typedef struct OSSL_TIME_SPEC_TIME_st { + int type; + union { + OSSL_TIME_SPEC_ABSOLUTE *absolute; + STACK_OF(OSSL_TIME_PERIOD) *periodic; + } choice; +} OSSL_TIME_SPEC_TIME; + +typedef struct OSSL_TIME_SPEC_st { + OSSL_TIME_SPEC_TIME *time; + ASN1_BOOLEAN notThisTime; + ASN1_INTEGER *timeZone; +} OSSL_TIME_SPEC; + +DECLARE_ASN1_FUNCTIONS(OSSL_DAY_TIME) +DECLARE_ASN1_FUNCTIONS(OSSL_DAY_TIME_BAND) +DECLARE_ASN1_FUNCTIONS(OSSL_TIME_SPEC_DAY) +DECLARE_ASN1_FUNCTIONS(OSSL_TIME_SPEC_WEEKS) +DECLARE_ASN1_FUNCTIONS(OSSL_TIME_SPEC_MONTH) +DECLARE_ASN1_FUNCTIONS(OSSL_NAMED_DAY) +DECLARE_ASN1_FUNCTIONS(OSSL_TIME_SPEC_X_DAY_OF) +DECLARE_ASN1_FUNCTIONS(OSSL_TIME_SPEC_ABSOLUTE) +DECLARE_ASN1_FUNCTIONS(OSSL_TIME_SPEC_TIME) +DECLARE_ASN1_FUNCTIONS(OSSL_TIME_SPEC) +DECLARE_ASN1_FUNCTIONS(OSSL_TIME_PERIOD) + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_TIME_PERIOD, OSSL_TIME_PERIOD, OSSL_TIME_PERIOD) +#define sk_OSSL_TIME_PERIOD_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_TIME_PERIOD_sk_type(sk)) +#define sk_OSSL_TIME_PERIOD_value(sk, idx) ((OSSL_TIME_PERIOD *)OPENSSL_sk_value(ossl_check_const_OSSL_TIME_PERIOD_sk_type(sk), (idx))) +#define sk_OSSL_TIME_PERIOD_new(cmp) ((STACK_OF(OSSL_TIME_PERIOD) *)OPENSSL_sk_new(ossl_check_OSSL_TIME_PERIOD_compfunc_type(cmp))) +#define sk_OSSL_TIME_PERIOD_new_null() ((STACK_OF(OSSL_TIME_PERIOD) *)OPENSSL_sk_new_null()) +#define sk_OSSL_TIME_PERIOD_new_reserve(cmp, n) ((STACK_OF(OSSL_TIME_PERIOD) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_TIME_PERIOD_compfunc_type(cmp), (n))) +#define sk_OSSL_TIME_PERIOD_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), (n)) +#define sk_OSSL_TIME_PERIOD_free(sk) OPENSSL_sk_free(ossl_check_OSSL_TIME_PERIOD_sk_type(sk)) +#define sk_OSSL_TIME_PERIOD_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_TIME_PERIOD_sk_type(sk)) +#define sk_OSSL_TIME_PERIOD_delete(sk, i) ((OSSL_TIME_PERIOD *)OPENSSL_sk_delete(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), (i))) +#define sk_OSSL_TIME_PERIOD_delete_ptr(sk, ptr) ((OSSL_TIME_PERIOD *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_type(ptr))) +#define sk_OSSL_TIME_PERIOD_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_type(ptr)) +#define sk_OSSL_TIME_PERIOD_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_type(ptr)) +#define sk_OSSL_TIME_PERIOD_pop(sk) ((OSSL_TIME_PERIOD *)OPENSSL_sk_pop(ossl_check_OSSL_TIME_PERIOD_sk_type(sk))) +#define sk_OSSL_TIME_PERIOD_shift(sk) ((OSSL_TIME_PERIOD *)OPENSSL_sk_shift(ossl_check_OSSL_TIME_PERIOD_sk_type(sk))) +#define sk_OSSL_TIME_PERIOD_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_freefunc_type(freefunc)) +#define sk_OSSL_TIME_PERIOD_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_type(ptr), (idx)) +#define sk_OSSL_TIME_PERIOD_set(sk, idx, ptr) ((OSSL_TIME_PERIOD *)OPENSSL_sk_set(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), (idx), ossl_check_OSSL_TIME_PERIOD_type(ptr))) +#define sk_OSSL_TIME_PERIOD_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_type(ptr)) +#define sk_OSSL_TIME_PERIOD_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_type(ptr)) +#define sk_OSSL_TIME_PERIOD_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_type(ptr), pnum) +#define sk_OSSL_TIME_PERIOD_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_TIME_PERIOD_sk_type(sk)) +#define sk_OSSL_TIME_PERIOD_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_TIME_PERIOD_sk_type(sk)) +#define sk_OSSL_TIME_PERIOD_dup(sk) ((STACK_OF(OSSL_TIME_PERIOD) *)OPENSSL_sk_dup(ossl_check_const_OSSL_TIME_PERIOD_sk_type(sk))) +#define sk_OSSL_TIME_PERIOD_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_TIME_PERIOD) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_copyfunc_type(copyfunc), ossl_check_OSSL_TIME_PERIOD_freefunc_type(freefunc))) +#define sk_OSSL_TIME_PERIOD_set_cmp_func(sk, cmp) ((sk_OSSL_TIME_PERIOD_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_TIME_PERIOD_sk_type(sk), ossl_check_OSSL_TIME_PERIOD_compfunc_type(cmp))) + +/* clang-format on */ + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_DAY_TIME_BAND, OSSL_DAY_TIME_BAND, OSSL_DAY_TIME_BAND) +#define sk_OSSL_DAY_TIME_BAND_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_DAY_TIME_BAND_sk_type(sk)) +#define sk_OSSL_DAY_TIME_BAND_value(sk, idx) ((OSSL_DAY_TIME_BAND *)OPENSSL_sk_value(ossl_check_const_OSSL_DAY_TIME_BAND_sk_type(sk), (idx))) +#define sk_OSSL_DAY_TIME_BAND_new(cmp) ((STACK_OF(OSSL_DAY_TIME_BAND) *)OPENSSL_sk_new(ossl_check_OSSL_DAY_TIME_BAND_compfunc_type(cmp))) +#define sk_OSSL_DAY_TIME_BAND_new_null() ((STACK_OF(OSSL_DAY_TIME_BAND) *)OPENSSL_sk_new_null()) +#define sk_OSSL_DAY_TIME_BAND_new_reserve(cmp, n) ((STACK_OF(OSSL_DAY_TIME_BAND) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_DAY_TIME_BAND_compfunc_type(cmp), (n))) +#define sk_OSSL_DAY_TIME_BAND_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), (n)) +#define sk_OSSL_DAY_TIME_BAND_free(sk) OPENSSL_sk_free(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk)) +#define sk_OSSL_DAY_TIME_BAND_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk)) +#define sk_OSSL_DAY_TIME_BAND_delete(sk, i) ((OSSL_DAY_TIME_BAND *)OPENSSL_sk_delete(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), (i))) +#define sk_OSSL_DAY_TIME_BAND_delete_ptr(sk, ptr) ((OSSL_DAY_TIME_BAND *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_type(ptr))) +#define sk_OSSL_DAY_TIME_BAND_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_type(ptr)) +#define sk_OSSL_DAY_TIME_BAND_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_type(ptr)) +#define sk_OSSL_DAY_TIME_BAND_pop(sk) ((OSSL_DAY_TIME_BAND *)OPENSSL_sk_pop(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk))) +#define sk_OSSL_DAY_TIME_BAND_shift(sk) ((OSSL_DAY_TIME_BAND *)OPENSSL_sk_shift(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk))) +#define sk_OSSL_DAY_TIME_BAND_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_freefunc_type(freefunc)) +#define sk_OSSL_DAY_TIME_BAND_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_type(ptr), (idx)) +#define sk_OSSL_DAY_TIME_BAND_set(sk, idx, ptr) ((OSSL_DAY_TIME_BAND *)OPENSSL_sk_set(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), (idx), ossl_check_OSSL_DAY_TIME_BAND_type(ptr))) +#define sk_OSSL_DAY_TIME_BAND_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_type(ptr)) +#define sk_OSSL_DAY_TIME_BAND_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_type(ptr)) +#define sk_OSSL_DAY_TIME_BAND_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_type(ptr), pnum) +#define sk_OSSL_DAY_TIME_BAND_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk)) +#define sk_OSSL_DAY_TIME_BAND_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_DAY_TIME_BAND_sk_type(sk)) +#define sk_OSSL_DAY_TIME_BAND_dup(sk) ((STACK_OF(OSSL_DAY_TIME_BAND) *)OPENSSL_sk_dup(ossl_check_const_OSSL_DAY_TIME_BAND_sk_type(sk))) +#define sk_OSSL_DAY_TIME_BAND_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_DAY_TIME_BAND) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_copyfunc_type(copyfunc), ossl_check_OSSL_DAY_TIME_BAND_freefunc_type(freefunc))) +#define sk_OSSL_DAY_TIME_BAND_set_cmp_func(sk, cmp) ((sk_OSSL_DAY_TIME_BAND_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_DAY_TIME_BAND_sk_type(sk), ossl_check_OSSL_DAY_TIME_BAND_compfunc_type(cmp))) + +/* clang-format on */ + +/* Attribute Type and Value */ +typedef struct atav_st { + ASN1_OBJECT *type; + ASN1_TYPE *value; +} OSSL_ATAV; + +typedef struct ATTRIBUTE_TYPE_MAPPING_st { + ASN1_OBJECT *local; + ASN1_OBJECT *remote; +} OSSL_ATTRIBUTE_TYPE_MAPPING; + +typedef struct ATTRIBUTE_VALUE_MAPPING_st { + OSSL_ATAV *local; + OSSL_ATAV *remote; +} OSSL_ATTRIBUTE_VALUE_MAPPING; + +#define OSSL_ATTR_MAP_TYPE 0 +#define OSSL_ATTR_MAP_VALUE 1 + +typedef struct ATTRIBUTE_MAPPING_st { + int type; + union { + OSSL_ATTRIBUTE_TYPE_MAPPING *typeMappings; + OSSL_ATTRIBUTE_VALUE_MAPPING *typeValueMappings; + } choice; +} OSSL_ATTRIBUTE_MAPPING; + +typedef STACK_OF(OSSL_ATTRIBUTE_MAPPING) OSSL_ATTRIBUTE_MAPPINGS; +DECLARE_ASN1_FUNCTIONS(OSSL_ATAV) +DECLARE_ASN1_FUNCTIONS(OSSL_ATTRIBUTE_TYPE_MAPPING) +DECLARE_ASN1_FUNCTIONS(OSSL_ATTRIBUTE_VALUE_MAPPING) +DECLARE_ASN1_FUNCTIONS(OSSL_ATTRIBUTE_MAPPING) +DECLARE_ASN1_FUNCTIONS(OSSL_ATTRIBUTE_MAPPINGS) + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_ATTRIBUTE_MAPPING, OSSL_ATTRIBUTE_MAPPING, OSSL_ATTRIBUTE_MAPPING) +#define sk_OSSL_ATTRIBUTE_MAPPING_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_ATTRIBUTE_MAPPING_sk_type(sk)) +#define sk_OSSL_ATTRIBUTE_MAPPING_value(sk, idx) ((OSSL_ATTRIBUTE_MAPPING *)OPENSSL_sk_value(ossl_check_const_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), (idx))) +#define sk_OSSL_ATTRIBUTE_MAPPING_new(cmp) ((STACK_OF(OSSL_ATTRIBUTE_MAPPING) *)OPENSSL_sk_new(ossl_check_OSSL_ATTRIBUTE_MAPPING_compfunc_type(cmp))) +#define sk_OSSL_ATTRIBUTE_MAPPING_new_null() ((STACK_OF(OSSL_ATTRIBUTE_MAPPING) *)OPENSSL_sk_new_null()) +#define sk_OSSL_ATTRIBUTE_MAPPING_new_reserve(cmp, n) ((STACK_OF(OSSL_ATTRIBUTE_MAPPING) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_ATTRIBUTE_MAPPING_compfunc_type(cmp), (n))) +#define sk_OSSL_ATTRIBUTE_MAPPING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), (n)) +#define sk_OSSL_ATTRIBUTE_MAPPING_free(sk) OPENSSL_sk_free(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk)) +#define sk_OSSL_ATTRIBUTE_MAPPING_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk)) +#define sk_OSSL_ATTRIBUTE_MAPPING_delete(sk, i) ((OSSL_ATTRIBUTE_MAPPING *)OPENSSL_sk_delete(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), (i))) +#define sk_OSSL_ATTRIBUTE_MAPPING_delete_ptr(sk, ptr) ((OSSL_ATTRIBUTE_MAPPING *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_type(ptr))) +#define sk_OSSL_ATTRIBUTE_MAPPING_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_type(ptr)) +#define sk_OSSL_ATTRIBUTE_MAPPING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_type(ptr)) +#define sk_OSSL_ATTRIBUTE_MAPPING_pop(sk) ((OSSL_ATTRIBUTE_MAPPING *)OPENSSL_sk_pop(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk))) +#define sk_OSSL_ATTRIBUTE_MAPPING_shift(sk) ((OSSL_ATTRIBUTE_MAPPING *)OPENSSL_sk_shift(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk))) +#define sk_OSSL_ATTRIBUTE_MAPPING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_freefunc_type(freefunc)) +#define sk_OSSL_ATTRIBUTE_MAPPING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_type(ptr), (idx)) +#define sk_OSSL_ATTRIBUTE_MAPPING_set(sk, idx, ptr) ((OSSL_ATTRIBUTE_MAPPING *)OPENSSL_sk_set(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), (idx), ossl_check_OSSL_ATTRIBUTE_MAPPING_type(ptr))) +#define sk_OSSL_ATTRIBUTE_MAPPING_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_type(ptr)) +#define sk_OSSL_ATTRIBUTE_MAPPING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_type(ptr)) +#define sk_OSSL_ATTRIBUTE_MAPPING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_type(ptr), pnum) +#define sk_OSSL_ATTRIBUTE_MAPPING_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk)) +#define sk_OSSL_ATTRIBUTE_MAPPING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_ATTRIBUTE_MAPPING_sk_type(sk)) +#define sk_OSSL_ATTRIBUTE_MAPPING_dup(sk) ((STACK_OF(OSSL_ATTRIBUTE_MAPPING) *)OPENSSL_sk_dup(ossl_check_const_OSSL_ATTRIBUTE_MAPPING_sk_type(sk))) +#define sk_OSSL_ATTRIBUTE_MAPPING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_ATTRIBUTE_MAPPING) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_copyfunc_type(copyfunc), ossl_check_OSSL_ATTRIBUTE_MAPPING_freefunc_type(freefunc))) +#define sk_OSSL_ATTRIBUTE_MAPPING_set_cmp_func(sk, cmp) ((sk_OSSL_ATTRIBUTE_MAPPING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_ATTRIBUTE_MAPPING_sk_type(sk), ossl_check_OSSL_ATTRIBUTE_MAPPING_compfunc_type(cmp))) + +/* clang-format on */ + +#define OSSL_AAA_ATTRIBUTE_TYPE 0 +#define OSSL_AAA_ATTRIBUTE_VALUES 1 + +typedef struct ALLOWED_ATTRIBUTES_CHOICE_st { + int type; + union { + ASN1_OBJECT *attributeType; + X509_ATTRIBUTE *attributeTypeandValues; + } choice; +} OSSL_ALLOWED_ATTRIBUTES_CHOICE; + +typedef struct ALLOWED_ATTRIBUTES_ITEM_st { + STACK_OF(OSSL_ALLOWED_ATTRIBUTES_CHOICE) *attributes; + GENERAL_NAME *holderDomain; +} OSSL_ALLOWED_ATTRIBUTES_ITEM; + +typedef STACK_OF(OSSL_ALLOWED_ATTRIBUTES_ITEM) OSSL_ALLOWED_ATTRIBUTES_SYNTAX; + +DECLARE_ASN1_FUNCTIONS(OSSL_ALLOWED_ATTRIBUTES_CHOICE) +DECLARE_ASN1_FUNCTIONS(OSSL_ALLOWED_ATTRIBUTES_ITEM) +DECLARE_ASN1_FUNCTIONS(OSSL_ALLOWED_ATTRIBUTES_SYNTAX) + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_ALLOWED_ATTRIBUTES_CHOICE, OSSL_ALLOWED_ATTRIBUTES_CHOICE, OSSL_ALLOWED_ATTRIBUTES_CHOICE) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_value(sk, idx) ((OSSL_ALLOWED_ATTRIBUTES_CHOICE *)OPENSSL_sk_value(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), (idx))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_new(cmp) ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_CHOICE) *)OPENSSL_sk_new(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_compfunc_type(cmp))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_new_null() ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_CHOICE) *)OPENSSL_sk_new_null()) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_new_reserve(cmp, n) ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_CHOICE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_compfunc_type(cmp), (n))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), (n)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_delete(sk, i) ((OSSL_ALLOWED_ATTRIBUTES_CHOICE *)OPENSSL_sk_delete(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), (i))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_delete_ptr(sk, ptr) ((OSSL_ALLOWED_ATTRIBUTES_CHOICE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_type(ptr))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_type(ptr)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_type(ptr)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_pop(sk) ((OSSL_ALLOWED_ATTRIBUTES_CHOICE *)OPENSSL_sk_pop(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_shift(sk) ((OSSL_ALLOWED_ATTRIBUTES_CHOICE *)OPENSSL_sk_shift(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_freefunc_type(freefunc)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_type(ptr), (idx)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_set(sk, idx, ptr) ((OSSL_ALLOWED_ATTRIBUTES_CHOICE *)OPENSSL_sk_set(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), (idx), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_type(ptr))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_type(ptr)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_type(ptr)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_type(ptr), pnum) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_dup(sk) ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_CHOICE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_CHOICE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_copyfunc_type(copyfunc), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_freefunc_type(freefunc))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_set_cmp_func(sk, cmp) ((sk_OSSL_ALLOWED_ATTRIBUTES_CHOICE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_CHOICE_compfunc_type(cmp))) + +/* clang-format on */ + +/* clang-format off */ +SKM_DEFINE_STACK_OF_INTERNAL(OSSL_ALLOWED_ATTRIBUTES_ITEM, OSSL_ALLOWED_ATTRIBUTES_ITEM, OSSL_ALLOWED_ATTRIBUTES_ITEM) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_value(sk, idx) ((OSSL_ALLOWED_ATTRIBUTES_ITEM *)OPENSSL_sk_value(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), (idx))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_new(cmp) ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_ITEM) *)OPENSSL_sk_new(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_compfunc_type(cmp))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_new_null() ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_ITEM) *)OPENSSL_sk_new_null()) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_new_reserve(cmp, n) ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_ITEM) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_compfunc_type(cmp), (n))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), (n)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_free(sk) OPENSSL_sk_free(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_delete(sk, i) ((OSSL_ALLOWED_ATTRIBUTES_ITEM *)OPENSSL_sk_delete(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), (i))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_delete_ptr(sk, ptr) ((OSSL_ALLOWED_ATTRIBUTES_ITEM *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_type(ptr))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_type(ptr)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_type(ptr)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_pop(sk) ((OSSL_ALLOWED_ATTRIBUTES_ITEM *)OPENSSL_sk_pop(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_shift(sk) ((OSSL_ALLOWED_ATTRIBUTES_ITEM *)OPENSSL_sk_shift(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_freefunc_type(freefunc)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_type(ptr), (idx)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_set(sk, idx, ptr) ((OSSL_ALLOWED_ATTRIBUTES_ITEM *)OPENSSL_sk_set(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), (idx), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_type(ptr))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_type(ptr)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_type(ptr)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_type(ptr), pnum) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk)) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_dup(sk) ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_ITEM) *)OPENSSL_sk_dup(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_ALLOWED_ATTRIBUTES_ITEM) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_copyfunc_type(copyfunc), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_freefunc_type(freefunc))) +#define sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_set_cmp_func(sk, cmp) ((sk_OSSL_ALLOWED_ATTRIBUTES_ITEM_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_sk_type(sk), ossl_check_OSSL_ALLOWED_ATTRIBUTES_ITEM_compfunc_type(cmp))) + +/* clang-format on */ + +typedef struct AA_DIST_POINT_st { + DIST_POINT_NAME *distpoint; + ASN1_BIT_STRING *reasons; + int dp_reasons; + ASN1_BOOLEAN indirectCRL; + ASN1_BOOLEAN containsUserAttributeCerts; + ASN1_BOOLEAN containsAACerts; + ASN1_BOOLEAN containsSOAPublicKeyCerts; +} OSSL_AA_DIST_POINT; + +DECLARE_ASN1_FUNCTIONS(OSSL_AA_DIST_POINT) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/VCMP-LUA/modules/postgresql/include/openssl/x509v3err.h b/VCMP-LUA/modules/postgresql/include/openssl/x509v3err.h new file mode 100644 index 0000000..19f9386 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/openssl/x509v3err.h @@ -0,0 +1,95 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OPENSSL_X509V3ERR_H +#define OPENSSL_X509V3ERR_H +#pragma once + +#include +#include +#include + +/* + * X509V3 reason codes. + */ +#define X509V3_R_BAD_IP_ADDRESS 118 +#define X509V3_R_BAD_OBJECT 119 +#define X509V3_R_BAD_OPTION 170 +#define X509V3_R_BAD_VALUE 171 +#define X509V3_R_BN_DEC2BN_ERROR 100 +#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 +#define X509V3_R_DIRNAME_ERROR 149 +#define X509V3_R_DISTPOINT_ALREADY_SET 160 +#define X509V3_R_DUPLICATE_ZONE_ID 133 +#define X509V3_R_EMPTY_KEY_USAGE 169 +#define X509V3_R_ERROR_CONVERTING_ZONE 131 +#define X509V3_R_ERROR_CREATING_EXTENSION 144 +#define X509V3_R_ERROR_IN_EXTENSION 128 +#define X509V3_R_EXPECTED_A_SECTION_NAME 137 +#define X509V3_R_EXTENSION_EXISTS 145 +#define X509V3_R_EXTENSION_NAME_ERROR 115 +#define X509V3_R_EXTENSION_NOT_FOUND 102 +#define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 +#define X509V3_R_EXTENSION_VALUE_ERROR 116 +#define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 +#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 +#define X509V3_R_INVALID_ASNUMBER 162 +#define X509V3_R_INVALID_ASRANGE 163 +#define X509V3_R_INVALID_BOOLEAN_STRING 104 +#define X509V3_R_INVALID_CERTIFICATE 158 +#define X509V3_R_INVALID_EMPTY_NAME 108 +#define X509V3_R_INVALID_EXTENSION_STRING 105 +#define X509V3_R_INVALID_INHERITANCE 165 +#define X509V3_R_INVALID_IPADDRESS 166 +#define X509V3_R_INVALID_MULTIPLE_RDNS 161 +#define X509V3_R_INVALID_NAME 106 +#define X509V3_R_INVALID_NULL_ARGUMENT 107 +#define X509V3_R_INVALID_NULL_VALUE 109 +#define X509V3_R_INVALID_NUMBER 140 +#define X509V3_R_INVALID_NUMBERS 141 +#define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 +#define X509V3_R_INVALID_OPTION 138 +#define X509V3_R_INVALID_POLICY_IDENTIFIER 134 +#define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 +#define X509V3_R_INVALID_PURPOSE 146 +#define X509V3_R_INVALID_SAFI 164 +#define X509V3_R_INVALID_SECTION 135 +#define X509V3_R_INVALID_SYNTAX 143 +#define X509V3_R_ISSUER_DECODE_ERROR 126 +#define X509V3_R_MISSING_VALUE 124 +#define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 +#define X509V3_R_NEGATIVE_PATHLEN 168 +#define X509V3_R_NO_CONFIG_DATABASE 136 +#define X509V3_R_NO_ISSUER_CERTIFICATE 121 +#define X509V3_R_NO_ISSUER_DETAILS 127 +#define X509V3_R_NO_POLICY_IDENTIFIER 139 +#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 +#define X509V3_R_NO_PUBLIC_KEY 114 +#define X509V3_R_NO_SUBJECT_DETAILS 125 +#define X509V3_R_OPERATION_NOT_DEFINED 148 +#define X509V3_R_OTHERNAME_ERROR 147 +#define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 +#define X509V3_R_POLICY_PATH_LENGTH 156 +#define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 +#define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 +#define X509V3_R_PURPOSE_NOT_UNIQUE 173 +#define X509V3_R_SECTION_NOT_FOUND 150 +#define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 +#define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 +#define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 +#define X509V3_R_UNKNOWN_EXTENSION 129 +#define X509V3_R_UNKNOWN_EXTENSION_NAME 130 +#define X509V3_R_UNKNOWN_OPTION 120 +#define X509V3_R_UNKNOWN_VALUE 172 +#define X509V3_R_UNSUPPORTED_OPTION 117 +#define X509V3_R_UNSUPPORTED_TYPE 167 +#define X509V3_R_USER_TOO_LONG 132 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/pg_config.h b/VCMP-LUA/modules/postgresql/include/pg_config.h new file mode 100644 index 0000000..f13cc7b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/pg_config.h @@ -0,0 +1,348 @@ +/* + * Autogenerated by the Meson build system. + * Do not edit, your changes will be lost. + */ + +#pragma once + +#define ALIGNOF_DOUBLE 8 + +#define ALIGNOF_INT 4 + +#define ALIGNOF_LONG 4 + +#define ALIGNOF_SHORT 2 + +/* Size of a disk block --- this also limits the size of a tuple. You can set + it bigger if you need bigger tuples (although TOAST should reduce the need + to have large tuples, since fields can be spread across multiple tuples). + BLCKSZ must be a power of 2. The maximum possible value of BLCKSZ is + currently 2^15 (32768). This is determined by the 15-bit widths of the + lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h). + Changing BLCKSZ requires an initdb. */ +#define BLCKSZ 8192 + +#define CONFIGURE_ARGS "" + +#define DEF_PGPORT 5432 + +#define DEF_PGPORT_STR "5432" + +#define DLSUFFIX ".dll" + +/* Define to 1 if you have the header file. */ +#undef HAVE_ATOMIC_H + +/* Define to 1 if you have the `backtrace_symbols' function. */ +#undef HAVE_BACKTRACE_SYMBOLS + +/* Define to 1 if you have the `copyfile' function. */ +#undef HAVE_COPYFILE + +/* Define to 1 if you have the header file. */ +#undef HAVE_COPYFILE_H + +/* Define to 1 if you have the `copy_file_range' function. */ +#undef HAVE_COPY_FILE_RANGE + +/* Define to 1 if you have the header file. */ +#define HAVE_CRTDEFS_H 1 + +/* Define to 1 if you have the declaration of `fdatasync', and to 0 if you + don't. */ +#define HAVE_DECL_FDATASYNC 0 + +/* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you + don't. */ +#define HAVE_DECL_F_FULLFSYNC 0 + +/* Define to 1 if you have the declaration of `memset_s', and to 0 if you + don't. */ +#define HAVE_DECL_MEMSET_S 0 + +/* Define to 1 if you have the declaration of `posix_fadvise', and to 0 if you + don't. */ +#define HAVE_DECL_POSIX_FADVISE 0 + +/* Define to 1 if you have the declaration of `preadv', and to 0 if you + don't. */ +#define HAVE_DECL_PREADV 0 + +/* Define to 1 if you have the declaration of `pwritev', and to 0 if you + don't. */ +#define HAVE_DECL_PWRITEV 0 + +/* Define to 1 if you have the declaration of `strchrnul', and to 0 if you + don't. */ +#define HAVE_DECL_STRCHRNUL 0 + +/* Define to 1 if you have the declaration of `strlcat', and to 0 if you + don't. */ +#define HAVE_DECL_STRLCAT 0 + +/* Define to 1 if you have the declaration of `strlcpy', and to 0 if you + don't. */ +#define HAVE_DECL_STRLCPY 0 + +/* Define to 1 if you have the declaration of `strnlen', and to 0 if you + don't. */ +#define HAVE_DECL_STRNLEN 1 + +/* Define to 1 if you have the declaration of `strsep', and to 0 if you + don't. */ +#define HAVE_DECL_STRSEP 0 + +/* Define to 1 if you have the declaration of `timingsafe_bcmp', and to 0 if you + don't. */ +#define HAVE_DECL_TIMINGSAFE_BCMP 0 + +/* Define to 1 if you have the `elf_aux_info' function. */ +#undef HAVE_ELF_AUX_INFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_EXECINFO_H + +/* Define to 1 if you have the `explicit_bzero' function. */ +#undef HAVE_EXPLICIT_BZERO + +#undef HAVE_GCC__ATOMIC_INT32_CAS + +#undef HAVE_GCC__ATOMIC_INT64_CAS + +#undef HAVE_GCC__SYNC_CHAR_TAS + +#undef HAVE_GCC__SYNC_INT32_CAS + +#undef HAVE_GCC__SYNC_INT32_TAS + +#undef HAVE_GCC__SYNC_INT64_CAS + +/* Define to 1 if you have the `getauxval' function. */ +#undef HAVE_GETAUXVAL + +/* Define to 1 if you have the `getifaddrs' function. */ +#undef HAVE_GETIFADDRS + +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `getpeereid' function. */ +#undef HAVE_GETPEEREID + +/* Define to 1 if you have the `getpeerucred' function. */ +#undef HAVE_GETPEERUCRED + +/* Define to 1 if you have the header file. */ +#undef HAVE_IFADDRS_H + +/* Define to 1 if you have the `inet_aton' function. */ +#undef HAVE_INET_ATON + +/* Define to 1 if you have the `inet_pton' function. */ +#undef HAVE_INET_PTON + +#undef HAVE_INT_OPTERR + +#undef HAVE_INT_OPTRESET + +#undef HAVE_INT_TIMEZONE + +/* Define to 1 if you have the `kqueue' function. */ +#undef HAVE_KQUEUE + +#define HAVE_LIBLZ4 1 + +#undef HAVE_LIBSELINUX + +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the `localeconv_l' function. */ +#undef HAVE_LOCALECONV_L + +/* Define to 1 if you have the header file. */ +#undef HAVE_MBARRIER_H + +/* Define to 1 if you have the `mbstowcs_l' function. */ +#undef HAVE_MBSTOWCS_L + +/* Define to 1 if you have the `mkdtemp' function. */ +#undef HAVE_MKDTEMP + +/* Define to 1 if you have the `posix_fadvise' function. */ +#undef HAVE_POSIX_FADVISE + +/* Define to 1 if you have the `posix_fallocate' function. */ +#undef HAVE_POSIX_FALLOCATE + +/* Define to 1 if you have the `ppoll' function. */ +#undef HAVE_PPOLL + +/* Define to 1 if you have the `pthread_barrier_wait' function. */ +#undef HAVE_PTHREAD_BARRIER_WAIT + +/* Define to 1 if you have the `pthread_is_threaded_np' function. */ +#undef HAVE_PTHREAD_IS_THREADED_NP + +/* Define to 1 if you have the `setproctitle' function. */ +#undef HAVE_SETPROCTITLE + +/* Define to 1 if you have the `setproctitle_fast' function. */ +#undef HAVE_SETPROCTITLE_FAST + +#define HAVE_SOCKLEN_T 1 + +#define HAVE_SSL_CTX_SET_CERT_CB 1 + +#define HAVE_SSL_CTX_SET_KEYLOG_CALLBACK 1 + +#define HAVE_SSL_CTX_SET_NUM_TICKETS 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + +/* Define to 1 if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define to 1 if you have the `strnlen' function. */ +#define HAVE_STRNLEN 1 + +/* Define to 1 if you have the `strsep' function. */ +#undef HAVE_STRSEP + +/* Define to 1 if you have the `strsignal' function. */ +#undef HAVE_STRSIGNAL + +/* Define to 1 if you have the `syncfs' function. */ +#undef HAVE_SYNCFS + +/* Define to 1 if you have the `sync_file_range' function. */ +#undef HAVE_SYNC_FILE_RANGE + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PERSONALITY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PRCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PROCCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UCRED_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the `timingsafe_bcmp' function. */ +#undef HAVE_TIMINGSAFE_BCMP + +#define HAVE_TYPEOF 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_UCRED_H + +/* Define to 1 if you have the `uselocale' function. */ +#undef HAVE_USELOCALE + +/* Define to 1 if you have the `wcstombs_l' function. */ +#undef HAVE_WCSTOMBS_L + +#define HAVE_X509_GET_SIGNATURE_INFO 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_XLOCALE_H + +#define HAVE_XSAVE_INTRINSICS 1 + +#define HAVE__CPUID 1 + +#define HAVE__CPUIDEX 1 + +#define MAXIMUM_ALIGNOF 8 + +#define MEMSET_LOOP_LIMIT 1024 + +/* Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions. */ +#define OPENSSL_API_COMPAT 0x10101000L + +#define PACKAGE_BUGREPORT "pgsql-bugs@lists.postgresql.org" + +#define PACKAGE_NAME "PostgreSQL" + +#define PACKAGE_STRING "PostgreSQL 18.3" + +#define PACKAGE_TARNAME "postgresql" + +#define PACKAGE_URL "https://www.postgresql.org/" + +#define PACKAGE_VERSION "18.3" + +#define PG_KRB_SRVNAM "postgres" + +#define PG_MAJORVERSION "18" + +#define PG_MAJORVERSION_NUM 18 + +#define PG_MINORVERSION_NUM 3 + +#define PG_VERSION "18.3" + +#define PG_VERSION_NUM 180003 + +#define PG_VERSION_STR "PostgreSQL 18.3 on x86_64-windows, compiled by msvc-19.50.35730, 64-bit" + +#define RELSEG_SIZE 131072 + +#define SIZEOF_LONG 4 + +#define SIZEOF_LONG_LONG 8 + +#define SIZEOF_SIZE_T 8 + +#define SIZEOF_VOID_P 8 + +#define STRERROR_R_INT 1 + +#undef USE_ASSERT_CHECKING + +#define USE_AVX512_POPCNT_WITH_RUNTIME_CHECK 1 + +#undef USE_INJECTION_POINTS + +#define USE_LZ4 1 + +/* Define to 1 to build with OpenSSL support. (-Dssl=openssl) */ +#define USE_OPENSSL 1 + +#undef USE_SSE42_CRC32C + +#define USE_SSE42_CRC32C_WITH_RUNTIME_CHECK 1 + +#undef USE_SYSTEMD + +#define USE_WIN32_SEMAPHORES 1 + +#define USE_WIN32_SHARED_MEMORY 1 + +#define WIN32_STACK_RLIMIT 4194304 + +#define XLOG_BLCKSZ 8192 + +#define pg_restrict __restrict + +#define typeof __typeof__ + diff --git a/VCMP-LUA/modules/postgresql/include/pg_config_manual.h b/VCMP-LUA/modules/postgresql/include/pg_config_manual.h new file mode 100644 index 0000000..125d3eb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/pg_config_manual.h @@ -0,0 +1,363 @@ +/*------------------------------------------------------------------------ + * PostgreSQL manual configuration settings + * + * This file contains various configuration symbols and limits. In + * all cases, changing them is only useful in very rare situations or + * for developers. If you edit any of these, be sure to do a *full* + * rebuild (and an initdb if noted). + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/pg_config_manual.h + *------------------------------------------------------------------------ + */ + +/* + * This is the default value for wal_segment_size to be used when initdb is run + * without the --wal-segsize option. It must be a valid segment size. + */ +#define DEFAULT_XLOG_SEG_SIZE (16*1024*1024) + +/* + * Maximum length for identifiers (e.g. table names, column names, + * function names). Names actually are limited to one fewer byte than this, + * because the length must include a trailing zero byte. + * + * Changing this requires an initdb. + */ +#define NAMEDATALEN 64 + +/* + * Maximum number of arguments to a function. + * + * The minimum value is 8 (GIN indexes use 8-argument support functions). + * The maximum possible value is around 600 (limited by index tuple size in + * pg_proc's index; BLCKSZ larger than 8K would allow more). Values larger + * than needed will waste memory and processing time, but do not directly + * cost disk space. + * + * Changing this does not require an initdb, but it does require a full + * backend recompile (including any user-defined C functions). + */ +#define FUNC_MAX_ARGS 100 + +/* + * When creating a product derived from PostgreSQL with changes that cause + * incompatibilities for loadable modules, it is recommended to change this + * string so that dfmgr.c can refuse to load incompatible modules with a clean + * error message. Typical examples that cause incompatibilities are any + * changes to node tags or node structures. (Note that dfmgr.c already + * detects common sources of incompatibilities due to major version + * differences and due to some changed compile-time constants. This setting + * is for catching anything that cannot be detected in a straightforward way.) + * + * There is no prescribed format for the string. The suggestion is to include + * product or company name, and optionally any internally-relevant ABI + * version. Example: "ACME Postgres/1.2". Note that the string will appear + * in a user-facing error message if an ABI mismatch is detected. + */ +#define FMGR_ABI_EXTRA "PostgreSQL" + +/* + * Maximum number of columns in an index. There is little point in making + * this anything but a multiple of 32, because the main cost is associated + * with index tuple header size (see access/itup.h). + * + * Changing this requires an initdb. + */ +#define INDEX_MAX_KEYS 32 + +/* + * Maximum number of columns in a partition key + */ +#define PARTITION_MAX_KEYS 32 + +/* + * Decide whether built-in 8-byte types, including float8, int8, and + * timestamp, are passed by value. This is on by default if sizeof(Datum) >= + * 8 (that is, on 64-bit platforms). If sizeof(Datum) < 8 (32-bit platforms), + * this must be off. We keep this here as an option so that it is easy to + * test the pass-by-reference code paths on 64-bit platforms. + * + * Changing this requires an initdb. + */ +#if SIZEOF_VOID_P >= 8 +#define USE_FLOAT8_BYVAL 1 +#endif + + +/* + * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence, + * maximum usable pathname length is one less). + * + * We'd use a standard system header symbol for this, if there weren't + * so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all + * defined by different "standards", and often have different values + * on the same platform! So we just punt and use a reasonably + * generous setting here. + */ +#define MAXPGPATH 1024 + +/* + * You can try changing this if you have a machine with bytes of + * another size, but no guarantee... + */ +#define BITS_PER_BYTE 8 + +/* + * Preferred alignment for disk I/O buffers. On some CPUs, copies between + * user space and kernel space are significantly faster if the user buffer + * is aligned on a larger-than-MAXALIGN boundary. Ideally this should be + * a platform-dependent value, but for now we just hard-wire it. + */ +#define ALIGNOF_BUFFER 32 + +/* + * If EXEC_BACKEND is defined, the postmaster uses an alternative method for + * starting subprocesses: Instead of simply using fork(), as is standard on + * Unix platforms, it uses fork()+exec() or something equivalent on Windows, + * as well as lots of extra code to bring the required global state to those + * new processes. This must be enabled on Windows (because there is no + * fork()). On other platforms, it's only useful for verifying those + * otherwise Windows-specific code paths. + */ +#if defined(WIN32) && !defined(__CYGWIN__) +#define EXEC_BACKEND +#endif + +/* + * USE_POSIX_FADVISE controls whether Postgres will attempt to use the + * posix_fadvise() kernel call. Usually the automatic configure tests are + * sufficient, but some older Linux distributions had broken versions of + * posix_fadvise(). If necessary you can remove the #define here. + */ +#if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE) +#define USE_POSIX_FADVISE +#endif + +/* + * USE_PREFETCH code should be compiled only if we have a way to implement + * prefetching. (This is decoupled from USE_POSIX_FADVISE because there + * might in future be support for alternative low-level prefetch APIs, + * as well as platform-specific APIs defined elsewhere.) + */ +#ifdef USE_POSIX_FADVISE +#define USE_PREFETCH +#endif + +/* + * Default and maximum values for backend_flush_after, bgwriter_flush_after + * and checkpoint_flush_after; measured in blocks. Currently, these are + * enabled by default if sync_file_range() exists, ie, only on Linux. Perhaps + * we could also enable by default if we have mmap and msync(MS_ASYNC)? + */ +#ifdef HAVE_SYNC_FILE_RANGE +#define DEFAULT_BACKEND_FLUSH_AFTER 0 /* never enabled by default */ +#define DEFAULT_BGWRITER_FLUSH_AFTER 64 +#define DEFAULT_CHECKPOINT_FLUSH_AFTER 32 +#else +#define DEFAULT_BACKEND_FLUSH_AFTER 0 +#define DEFAULT_BGWRITER_FLUSH_AFTER 0 +#define DEFAULT_CHECKPOINT_FLUSH_AFTER 0 +#endif +/* upper limit for all three variables */ +#define WRITEBACK_MAX_PENDING_FLUSHES 256 + +/* + * USE_SSL code should be compiled only when compiling with an SSL + * implementation. + */ +#ifdef USE_OPENSSL +#define USE_SSL +#endif + +/* + * This is the default directory in which AF_UNIX socket files are + * placed. Caution: changing this risks breaking your existing client + * applications, which are likely to continue to look in the old + * directory. But if you just hate the idea of sockets in /tmp, + * here's where to twiddle it. You can also override this at runtime + * with the postmaster's -k switch. + * + * If set to an empty string, then AF_UNIX sockets are not used by default: A + * server will not create an AF_UNIX socket unless the run-time configuration + * is changed, a client will connect via TCP/IP by default and will only use + * an AF_UNIX socket if one is explicitly specified. + * + * This is done by default on Windows because there is no good standard + * location for AF_UNIX sockets and many installations on Windows don't + * support them yet. + */ +#ifndef WIN32 +#define DEFAULT_PGSOCKET_DIR "/tmp" +#else +#define DEFAULT_PGSOCKET_DIR "" +#endif + +/* + * This is the default event source for Windows event log. + */ +#define DEFAULT_EVENT_SOURCE "PostgreSQL" + +/* + * Assumed cache line size. This doesn't affect correctness, but can be used + * for low-level optimizations. This is mostly used to pad various data + * structures, to ensure that highly-contended fields are on different cache + * lines. Too small a value can hurt performance due to false sharing, while + * the only downside of too large a value is a few bytes of wasted memory. + * The default is 128, which should be large enough for all supported + * platforms. + */ +#define PG_CACHE_LINE_SIZE 128 + +/* + * Assumed alignment requirement for direct I/O. 4K corresponds to common + * sector and memory page size. + */ +#define PG_IO_ALIGN_SIZE 4096 + +/* + *------------------------------------------------------------------------ + * The following symbols are for enabling debugging code, not for + * controlling user-visible features or resource limits. + *------------------------------------------------------------------------ + */ + +/* + * Force use of the non-recursive JSON parser in all cases. This is useful + * to validate the working of the parser, and the regression tests should + * pass except for some different error messages about the stack limit. + */ +/* #define FORCE_JSON_PSTACK */ + +/* + * Include Valgrind "client requests", mostly in the memory allocator, so + * Valgrind understands PostgreSQL memory contexts. This permits detecting + * memory errors that Valgrind would not detect on a vanilla build. It also + * enables detection of buffer accesses that take place without holding a + * buffer pin (or without holding a buffer lock in the case of index access + * methods that superimpose their own custom client requests on top of the + * generic bufmgr.c requests). + * + * "make installcheck" is significantly slower under Valgrind. The client + * requests fall in hot code paths, so USE_VALGRIND slows execution by a few + * percentage points even when not run under Valgrind. + * + * Do not try to test the server under Valgrind without having built the + * server with USE_VALGRIND; else you will get false positives from sinval + * messaging (see comments in AddCatcacheInvalidationMessage). It's also + * important to use the suppression file src/tools/valgrind.supp to + * exclude other known false positives. + * + * You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND; + * instrumentation of repalloc() is inferior without it. + */ +/* #define USE_VALGRIND */ + +/* + * Define this to cause pfree()'d memory to be cleared immediately, to + * facilitate catching bugs that refer to already-freed values. + * Right now, this gets defined automatically if --enable-cassert. + */ +#ifdef USE_ASSERT_CHECKING +#define CLOBBER_FREED_MEMORY +#endif + +/* + * Define this to check memory allocation errors (scribbling on more + * bytes than were allocated). Right now, this gets defined + * automatically if --enable-cassert or USE_VALGRIND. + */ +#if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND) +#define MEMORY_CONTEXT_CHECKING +#endif + +/* + * Define this to cause palloc()'d memory to be filled with random data, to + * facilitate catching code that depends on the contents of uninitialized + * memory. Caution: this is horrendously expensive. + */ +/* #define RANDOMIZE_ALLOCATED_MEMORY */ + +/* + * For cache-invalidation debugging, define DISCARD_CACHES_ENABLED to enable + * use of the debug_discard_caches GUC to aggressively flush + * syscache/relcache/relsynccache entries whenever it's possible to deliver + * invalidations. See AcceptInvalidationMessages() in + * src/backend/utils/cache/inval.c for details. + * + * USE_ASSERT_CHECKING builds default to enabling this. It's possible to use + * DISCARD_CACHES_ENABLED without a cassert build and the implied + * CLOBBER_FREED_MEMORY and MEMORY_CONTEXT_CHECKING options, but it's unlikely + * to be as effective at identifying problems. + */ +/* #define DISCARD_CACHES_ENABLED */ + +#if defined(USE_ASSERT_CHECKING) && !defined(DISCARD_CACHES_ENABLED) +#define DISCARD_CACHES_ENABLED +#endif + +/* + * Backwards compatibility for the older compile-time-only clobber-cache + * macros. + */ +#if !defined(DISCARD_CACHES_ENABLED) && (defined(CLOBBER_CACHE_ALWAYS) || defined(CLOBBER_CACHE_RECURSIVELY)) +#define DISCARD_CACHES_ENABLED +#endif + +/* + * Recover memory used for relcache entries when invalidated. See + * RelationBuildDesc() in src/backend/utils/cache/relcache.c. + * + * This is active automatically for clobber-cache builds when clobbering is + * active, but can be overridden here by explicitly defining + * RECOVER_RELATION_BUILD_MEMORY. Define to 1 to always free relation cache + * memory even when clobber is off, or to 0 to never free relation cache + * memory even when clobbering is on. + */ + /* #define RECOVER_RELATION_BUILD_MEMORY 0 */ /* Force disable */ + /* #define RECOVER_RELATION_BUILD_MEMORY 1 */ /* Force enable */ + +/* + * Define DEBUG_NODE_TESTS_ENABLED to enable use of the GUCs + * debug_copy_parse_plan_trees, debug_write_read_parse_plan_trees, and + * debug_raw_expression_coverage_test, to test coverage of node support + * functions in src/backend/nodes/. + * + * USE_ASSERT_CHECKING builds default to enabling this. + */ +/* #define DEBUG_NODE_TESTS_ENABLED */ + +#if defined(USE_ASSERT_CHECKING) && !defined(DEBUG_NODE_TESTS_ENABLED) +#define DEBUG_NODE_TESTS_ENABLED +#endif + +/* + * Backwards compatibility for the older compile-time-only node-tests macros. + */ +#if !defined(DEBUG_NODE_TESTS_ENABLED) && (defined(COPY_PARSE_PLAN_TREES) || defined(WRITE_READ_PARSE_PLAN_TREES) || defined(RAW_EXPRESSION_COVERAGE_TEST)) +#define DEBUG_NODE_TESTS_ENABLED +#endif + +/* + * Define this to force Bitmapset reallocation on each modification. Helps + * to find dangling pointers to Bitmapset's. + */ +/* #define REALLOCATE_BITMAPSETS */ + +/* + * Enable debugging print statements for lock-related operations. + */ +/* #define LOCK_DEBUG */ + +/* + * Enable debugging print statements for WAL-related operations; see + * also the wal_debug GUC var. + */ +/* #define WAL_DEBUG */ + +/* + * Enable tracing of syncscan operations (see also the trace_syncscan GUC var). + */ +/* #define TRACE_SYNCSCAN */ diff --git a/VCMP-LUA/modules/postgresql/include/pg_config_os.h b/VCMP-LUA/modules/postgresql/include/pg_config_os.h new file mode 100644 index 0000000..d6c13d0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/pg_config_os.h @@ -0,0 +1,59 @@ +/* src/include/port/win32.h */ + +/* + * We always rely on the WIN32 macro being set by our build system, + * but _WIN32 is the compiler pre-defined macro. So make sure we define + * WIN32 whenever _WIN32 is set, to facilitate standalone building. + */ +#if defined(_WIN32) && !defined(WIN32) +#define WIN32 +#endif + +/* + * Make sure _WIN32_WINNT has the minimum required value. + * Leave a higher value in place. The minimum requirement is Windows 10. + */ +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#endif + +#define _WIN32_WINNT 0x0A00 + +/* + * We need to prevent from defining a symbol conflicting with + * our errcode() function. Since it's likely to get included by standard + * system headers, pre-emptively include it now. + */ +#if defined(_MSC_VER) || defined(HAVE_CRTDEFS_H) +#define errcode __msvc_errcode +#include +#undef errcode +#endif + +/* + * defines for dynamic linking on Win32 platform + */ + +/* + * Variables declared in the core backend and referenced by loadable + * modules need to be marked "dllimport" in the core build, but + * "dllexport" when the declaration is read in a loadable module. + * No special markings should be used when compiling frontend code. + */ +#ifndef FRONTEND +#ifdef BUILDING_DLL +#define PGDLLIMPORT __declspec (dllexport) +#else +#define PGDLLIMPORT __declspec (dllimport) +#endif +#endif + +/* + * Functions exported by a loadable module must be marked "dllexport". + * + * While mingw would otherwise fall back to + * __attribute__((visibility("default"))), that appears to only work as long + * as no symbols are declared with __declspec(dllexport). But we can end up + * with some, e.g. plpython's Py_Init. + */ +#define PGDLLEXPORT __declspec (dllexport) diff --git a/VCMP-LUA/modules/postgresql/include/pgtypes.h b/VCMP-LUA/modules/postgresql/include/pgtypes.h new file mode 100644 index 0000000..dbf759b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/pgtypes.h @@ -0,0 +1,17 @@ +/* src/interfaces/ecpg/include/pgtypes.h */ + +#ifndef PGTYPES_H +#define PGTYPES_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern void PGTYPESchar_free(char *ptr); + +#ifdef __cplusplus +} +#endif + +#endif /* PGTYPES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/pgtypes_date.h b/VCMP-LUA/modules/postgresql/include/pgtypes_date.h new file mode 100644 index 0000000..5490cf8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/pgtypes_date.h @@ -0,0 +1,32 @@ +/* src/interfaces/ecpg/include/pgtypes_date.h */ + +#ifndef PGTYPES_DATETIME +#define PGTYPES_DATETIME + +#include +#include + +typedef long date; + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern date * PGTYPESdate_new(void); +extern void PGTYPESdate_free(date * d); +extern date PGTYPESdate_from_asc(char *str, char **endptr); +extern char *PGTYPESdate_to_asc(date dDate); +extern date PGTYPESdate_from_timestamp(timestamp dt); +extern void PGTYPESdate_julmdy(date jd, int *mdy); +extern void PGTYPESdate_mdyjul(int *mdy, date * jdate); +extern int PGTYPESdate_dayofweek(date dDate); +extern void PGTYPESdate_today(date * d); +extern int PGTYPESdate_defmt_asc(date * d, const char *fmt, const char *str); +extern int PGTYPESdate_fmt_asc(date dDate, const char *fmtstring, char *outbuf); + +#ifdef __cplusplus +} +#endif + +#endif /* PGTYPES_DATETIME */ diff --git a/VCMP-LUA/modules/postgresql/include/pgtypes_error.h b/VCMP-LUA/modules/postgresql/include/pgtypes_error.h new file mode 100644 index 0000000..9fc22a2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/pgtypes_error.h @@ -0,0 +1,18 @@ +/* src/interfaces/ecpg/include/pgtypes_error.h */ + +#define PGTYPES_NUM_OVERFLOW 301 +#define PGTYPES_NUM_BAD_NUMERIC 302 +#define PGTYPES_NUM_DIVIDE_ZERO 303 +#define PGTYPES_NUM_UNDERFLOW 304 + +#define PGTYPES_DATE_BAD_DATE 310 +#define PGTYPES_DATE_ERR_EARGS 311 +#define PGTYPES_DATE_ERR_ENOSHORTDATE 312 +#define PGTYPES_DATE_ERR_ENOTDMY 313 +#define PGTYPES_DATE_BAD_DAY 314 +#define PGTYPES_DATE_BAD_MONTH 315 + +#define PGTYPES_TS_BAD_TIMESTAMP 320 +#define PGTYPES_TS_ERR_EINFTIME 321 + +#define PGTYPES_INTVL_BAD_INTERVAL 330 diff --git a/VCMP-LUA/modules/postgresql/include/pgtypes_interval.h b/VCMP-LUA/modules/postgresql/include/pgtypes_interval.h new file mode 100644 index 0000000..f0acbb4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/pgtypes_interval.h @@ -0,0 +1,40 @@ +/* src/interfaces/ecpg/include/pgtypes_interval.h */ + +#ifndef PGTYPES_INTERVAL +#define PGTYPES_INTERVAL + +#include + +#include +#include + +#ifndef C_H + +typedef int64_t int64; + +#define HAVE_INT64_TIMESTAMP + +#endif /* C_H */ + +typedef struct +{ + int64 time; /* all time units other than months and years */ + long month; /* months and years, after time for alignment */ +} interval; + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern interval * PGTYPESinterval_new(void); +extern void PGTYPESinterval_free(interval * intvl); +extern interval * PGTYPESinterval_from_asc(char *str, char **endptr); +extern char *PGTYPESinterval_to_asc(interval * span); +extern int PGTYPESinterval_copy(interval * intvlsrc, interval * intvldest); + +#ifdef __cplusplus +} +#endif + +#endif /* PGTYPES_INTERVAL */ diff --git a/VCMP-LUA/modules/postgresql/include/pgtypes_numeric.h b/VCMP-LUA/modules/postgresql/include/pgtypes_numeric.h new file mode 100644 index 0000000..61506f4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/pgtypes_numeric.h @@ -0,0 +1,69 @@ +#ifndef PGTYPES_NUMERIC +#define PGTYPES_NUMERIC + +#include + +#define NUMERIC_POS 0x0000 +#define NUMERIC_NEG 0x4000 +#define NUMERIC_NAN 0xC000 +#define NUMERIC_NULL 0xF000 +#define NUMERIC_MAX_PRECISION 1000 +#define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION +#define NUMERIC_MIN_DISPLAY_SCALE 0 +#define NUMERIC_MIN_SIG_DIGITS 16 + +#define DECSIZE 30 + +typedef unsigned char NumericDigit; +typedef struct +{ + int ndigits; /* number of digits in digits[] - can be 0! */ + int weight; /* weight of first digit */ + int rscale; /* result scale */ + int dscale; /* display scale */ + int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */ + NumericDigit *buf; /* start of alloc'd space for digits[] */ + NumericDigit *digits; /* decimal digits */ +} numeric; + +typedef struct +{ + int ndigits; /* number of digits in digits[] - can be 0! */ + int weight; /* weight of first digit */ + int rscale; /* result scale */ + int dscale; /* display scale */ + int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */ + NumericDigit digits[DECSIZE]; /* decimal digits */ +} decimal; + +#ifdef __cplusplus +extern "C" +{ +#endif + +numeric *PGTYPESnumeric_new(void); +decimal *PGTYPESdecimal_new(void); +void PGTYPESnumeric_free(numeric *var); +void PGTYPESdecimal_free(decimal *var); +numeric *PGTYPESnumeric_from_asc(char *str, char **endptr); +char *PGTYPESnumeric_to_asc(numeric *num, int dscale); +int PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result); +int PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result); +int PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result); +int PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result); +int PGTYPESnumeric_cmp(numeric *var1, numeric *var2); +int PGTYPESnumeric_from_int(signed int int_val, numeric *var); +int PGTYPESnumeric_from_long(signed long int long_val, numeric *var); +int PGTYPESnumeric_copy(numeric *src, numeric *dst); +int PGTYPESnumeric_from_double(double d, numeric *dst); +int PGTYPESnumeric_to_double(numeric *nv, double *dp); +int PGTYPESnumeric_to_int(numeric *nv, int *ip); +int PGTYPESnumeric_to_long(numeric *nv, long *lp); +int PGTYPESnumeric_to_decimal(numeric *src, decimal *dst); +int PGTYPESnumeric_from_decimal(decimal *src, numeric *dst); + +#ifdef __cplusplus +} +#endif + +#endif /* PGTYPES_NUMERIC */ diff --git a/VCMP-LUA/modules/postgresql/include/pgtypes_timestamp.h b/VCMP-LUA/modules/postgresql/include/pgtypes_timestamp.h new file mode 100644 index 0000000..412ecc2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/pgtypes_timestamp.h @@ -0,0 +1,31 @@ +/* src/interfaces/ecpg/include/pgtypes_timestamp.h */ + +#ifndef PGTYPES_TIMESTAMP +#define PGTYPES_TIMESTAMP + +#include +/* pgtypes_interval.h includes ecpg_config.h */ +#include + +typedef int64 timestamp; +typedef int64 TimestampTz; + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern timestamp PGTYPEStimestamp_from_asc(char *str, char **endptr); +extern char *PGTYPEStimestamp_to_asc(timestamp tstamp); +extern int PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv); +extern int PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, const char *fmtstr); +extern void PGTYPEStimestamp_current(timestamp * ts); +extern int PGTYPEStimestamp_defmt_asc(const char *str, const char *fmt, timestamp * d); +extern int PGTYPEStimestamp_add_interval(timestamp * tin, interval * span, timestamp * tout); +extern int PGTYPEStimestamp_sub_interval(timestamp * tin, interval * span, timestamp * tout); + +#ifdef __cplusplus +} +#endif + +#endif /* PGTYPES_TIMESTAMP */ diff --git a/VCMP-LUA/modules/postgresql/include/postgres_ext.h b/VCMP-LUA/modules/postgresql/include/postgres_ext.h new file mode 100644 index 0000000..6a8f25a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgres_ext.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * postgres_ext.h + * + * This file contains declarations of things that are visible everywhere + * in PostgreSQL *and* are visible to clients of frontend interface libraries. + * For example, the Oid type is part of the API of libpq and other libraries. + * + * Declarations which are specific to a particular interface should + * go in the header file for that interface (such as libpq-fe.h). This + * file is only for fundamental Postgres declarations. + * + * User-written C functions don't count as "external to Postgres." + * Those function much as local modifications to the backend itself, and + * use header files that are otherwise internal to Postgres to interface + * with the backend. + * + * src/include/postgres_ext.h + * + *------------------------------------------------------------------------- + */ +/* IWYU pragma: always_keep */ + +#ifndef POSTGRES_EXT_H +#define POSTGRES_EXT_H + +#include + +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +#ifdef __cplusplus +#define InvalidOid (Oid(0)) +#else +#define InvalidOid ((Oid) 0) +#endif + +#define OID_MAX UINT_MAX +/* you will need to include to use the above #define */ + +#define atooid(x) ((Oid) strtoul((x), NULL, 10)) +/* the above needs */ + + +/* deprecated name for int64_t, formerly used in client API declarations */ +typedef int64_t pg_int64; + +/* + * Identifiers of error message fields. Kept here to keep common + * between frontend and backend, and also to export them to libpq + * applications. + */ +#define PG_DIAG_SEVERITY 'S' +#define PG_DIAG_SEVERITY_NONLOCALIZED 'V' +#define PG_DIAG_SQLSTATE 'C' +#define PG_DIAG_MESSAGE_PRIMARY 'M' +#define PG_DIAG_MESSAGE_DETAIL 'D' +#define PG_DIAG_MESSAGE_HINT 'H' +#define PG_DIAG_STATEMENT_POSITION 'P' +#define PG_DIAG_INTERNAL_POSITION 'p' +#define PG_DIAG_INTERNAL_QUERY 'q' +#define PG_DIAG_CONTEXT 'W' +#define PG_DIAG_SCHEMA_NAME 's' +#define PG_DIAG_TABLE_NAME 't' +#define PG_DIAG_COLUMN_NAME 'c' +#define PG_DIAG_DATATYPE_NAME 'd' +#define PG_DIAG_CONSTRAINT_NAME 'n' +#define PG_DIAG_SOURCE_FILE 'F' +#define PG_DIAG_SOURCE_LINE 'L' +#define PG_DIAG_SOURCE_FUNCTION 'R' + +#endif /* POSTGRES_EXT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/informix/esql/datetime.h b/VCMP-LUA/modules/postgresql/include/postgresql/informix/esql/datetime.h new file mode 100644 index 0000000..44b2422 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/informix/esql/datetime.h @@ -0,0 +1,14 @@ +/* src/interfaces/ecpg/include/datetime.h */ + +#ifndef _ECPG_DATETIME_H +#define _ECPG_DATETIME_H + +#include + +/* source created by ecpg which defines these symbols */ +#ifndef _ECPGLIB_H +typedef timestamp dtime_t; +typedef interval intrvl_t; +#endif /* ndef _ECPGLIB_H */ + +#endif /* ndef _ECPG_DATETIME_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/informix/esql/decimal.h b/VCMP-LUA/modules/postgresql/include/postgresql/informix/esql/decimal.h new file mode 100644 index 0000000..6ac2962 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/informix/esql/decimal.h @@ -0,0 +1,13 @@ +/* src/interfaces/ecpg/include/decimal.h */ + +#ifndef _ECPG_DECIMAL_H +#define _ECPG_DECIMAL_H + +#include + +/* source created by ecpg which defines this */ +#ifndef _ECPGLIB_H +typedef decimal dec_t; +#endif /* ndef _ECPGLIB_H */ + +#endif /* ndef _ECPG_DECIMAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/informix/esql/sqltypes.h b/VCMP-LUA/modules/postgresql/include/postgresql/informix/esql/sqltypes.h new file mode 100644 index 0000000..4988404 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/informix/esql/sqltypes.h @@ -0,0 +1,59 @@ +#ifndef ECPG_SQLTYPES_H +#define ECPG_SQLTYPES_H + +#include + +#define CCHARTYPE ECPGt_char +#define CSHORTTYPE ECPGt_short +#define CINTTYPE ECPGt_int +#define CLONGTYPE ECPGt_long +#define CFLOATTYPE ECPGt_float +#define CDOUBLETYPE ECPGt_double +#define CDECIMALTYPE ECPGt_decimal +#define CFIXCHARTYPE 108 +#define CSTRINGTYPE ECPGt_char +#define CDATETYPE ECPGt_date +#define CMONEYTYPE 111 +#define CDTIMETYPE ECPGt_timestamp +#define CLOCATORTYPE 113 +#define CVCHARTYPE ECPGt_varchar +#define CINVTYPE 115 +#define CFILETYPE 116 +#define CINT8TYPE ECPGt_long_long +#define CCOLLTYPE 118 +#define CLVCHARTYPE 119 +#define CFIXBINTYPE 120 +#define CVARBINTYPE 121 +#define CBOOLTYPE ECPGt_bool +#define CROWTYPE 123 +#define CLVCHARPTRTYPE 124 +#define CTYPEMAX 25 + +/* + * Values used in sqlda->sqlvar[i]->sqltype + */ +#define SQLCHAR ECPGt_char +#define SQLSMINT ECPGt_short +#define SQLINT ECPGt_int +#define SQLFLOAT ECPGt_double +#define SQLSMFLOAT ECPGt_float +#define SQLDECIMAL ECPGt_decimal +#define SQLSERIAL ECPGt_int +#define SQLDATE ECPGt_date +#define SQLDTIME ECPGt_timestamp +#define SQLTEXT ECPGt_char +#define SQLVCHAR ECPGt_char +#define SQLINTERVAL ECPGt_interval +#define SQLNCHAR ECPGt_char +#define SQLNVCHAR ECPGt_char +#if SIZEOF_LONG == 8 +#define SQLINT8 ECPGt_long +#define SQLSERIAL8 ECPGt_long +#elif SIZEOF_LONG_LONG == 8 +#define SQLINT8 ECPGt_long_long +#define SQLSERIAL8 ECPGt_long_long +#else +#error "cannot find integer type of the same size as SQLINT8" +#endif + +#endif /* ndef ECPG_SQLTYPES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/internal/c.h b/VCMP-LUA/modules/postgresql/include/postgresql/internal/c.h new file mode 100644 index 0000000..6dc44fa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/internal/c.h @@ -0,0 +1,1347 @@ +/*------------------------------------------------------------------------- + * + * c.h + * Fundamental C definitions. This is included by every .c file in + * PostgreSQL (via either postgres.h or postgres_fe.h, as appropriate). + * + * Note that the definitions here are not intended to be exposed to clients + * of the frontend interface libraries --- so we don't worry much about + * polluting the namespace with lots of stuff... + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/c.h + * + *------------------------------------------------------------------------- + */ +/* IWYU pragma: always_keep */ +/* + *---------------------------------------------------------------- + * TABLE OF CONTENTS + * + * When adding stuff to this file, please try to put stuff + * into the relevant section, or add new sections as appropriate. + * + * section description + * ------- ------------------------------------------------ + * 0) pg_config.h and standard system headers + * 1) compiler characteristics + * 2) bool, true, false + * 3) standard system types + * 4) IsValid macros for system types + * 5) lengthof, alignment + * 6) assertions + * 7) widely useful macros + * 8) random stuff + * 9) system-specific hacks + * + * NOTE: since this file is included by both frontend and backend modules, + * it's usually wrong to put an "extern" declaration here, unless it's + * ifdef'd so that it's seen in only one case or the other. + * typedefs and macros are the kind of thing that might go here. + * + *---------------------------------------------------------------- + */ +#ifndef C_H +#define C_H + +/* IWYU pragma: begin_exports */ + +/* + * These headers must be included before any system headers, because on some + * platforms they affect the behavior of the system headers (for example, by + * defining _FILE_OFFSET_BITS). + */ +#include "pg_config.h" +#include "pg_config_manual.h" /* must be after pg_config.h */ +#include "pg_config_os.h" /* config from include/port/PORTNAME.h */ + +/* System header files that should be available everywhere in Postgres */ +#include +#include +#include +#include +#include +#include +#ifdef HAVE_STRINGS_H +#include +#endif +#include +#include +#include +#if defined(WIN32) || defined(__CYGWIN__) +#include /* ensure O_BINARY is available */ +#endif +#include +#ifdef HAVE_XLOCALE_H +#include +#endif +#ifdef ENABLE_NLS +#include +#endif + + /* Pull in fundamental symbols that we also expose to applications */ +#include "postgres_ext.h" + +/* Define before including zlib.h to add const decorations to zlib API. */ +#ifdef HAVE_LIBZ +#define ZLIB_CONST +#endif + + +/* ---------------------------------------------------------------- + * Section 1: compiler characteristics + * + * type prefixes (const, signed, volatile, inline) are handled in pg_config.h. + * ---------------------------------------------------------------- + */ + +/* + * Disable "inline" if PG_FORCE_DISABLE_INLINE is defined. + * This is used to work around compiler bugs and might also be useful for + * investigatory purposes. + */ +#ifdef PG_FORCE_DISABLE_INLINE +#undef inline +#define inline +#endif + +/* + * Attribute macros + * + * GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html + * GCC: https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html + * Clang: https://clang.llvm.org/docs/AttributeReference.html + * Sunpro: https://docs.oracle.com/cd/E18659_01/html/821-1384/gjzke.html + */ + +/* + * For compilers which don't support __has_attribute, we just define + * __has_attribute(x) to 0 so that we can define macros for various + * __attribute__s more easily below. + */ +#ifndef __has_attribute +#define __has_attribute(attribute) 0 +#endif + +/* only GCC supports the unused attribute */ +#ifdef __GNUC__ +#define pg_attribute_unused() __attribute__((unused)) +#else +#define pg_attribute_unused() +#endif + +/* + * pg_nodiscard means the compiler should warn if the result of a function + * call is ignored. The name "nodiscard" is chosen in alignment with the C23 + * standard attribute with the same name. For maximum forward compatibility, + * place it before the declaration. + */ +#ifdef __GNUC__ +#define pg_nodiscard __attribute__((warn_unused_result)) +#else +#define pg_nodiscard +#endif + +/* + * pg_noreturn corresponds to the C11 noreturn/_Noreturn function specifier. + * We can't use the standard name "noreturn" because some third-party code + * uses __attribute__((noreturn)) in headers, which would get confused if + * "noreturn" is defined to "_Noreturn", as is done by . + * + * In a declaration, function specifiers go before the function name. The + * common style is to put them before the return type. (The MSVC fallback has + * the same requirement. The GCC fallback is more flexible.) + */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#define pg_noreturn _Noreturn +#elif defined(__GNUC__) || defined(__SUNPRO_C) +#define pg_noreturn __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define pg_noreturn __declspec(noreturn) +#else +#define pg_noreturn +#endif + +/* + * This macro will disable address safety instrumentation for a function + * when running with "-fsanitize=address". Think twice before using this! + */ +#if defined(__clang__) || __GNUC__ >= 8 +#define pg_attribute_no_sanitize_address() __attribute__((no_sanitize("address"))) +#elif __has_attribute(no_sanitize_address) +/* This would work for clang, but it's deprecated. */ +#define pg_attribute_no_sanitize_address() __attribute__((no_sanitize_address)) +#else +#define pg_attribute_no_sanitize_address() +#endif + +/* + * Place this macro before functions that should be allowed to make misaligned + * accesses. Think twice before using it on non-x86-specific code! + * Testing can be done with "-fsanitize=alignment -fsanitize-trap=alignment" + * on clang, or "-fsanitize=alignment -fno-sanitize-recover=alignment" on gcc. + */ +#if __clang_major__ >= 7 || __GNUC__ >= 8 +#define pg_attribute_no_sanitize_alignment() __attribute__((no_sanitize("alignment"))) +#else +#define pg_attribute_no_sanitize_alignment() +#endif + +/* + * pg_attribute_nonnull means the compiler should warn if the function is + * called with the listed arguments set to NULL. If no arguments are + * listed, the compiler should warn if any pointer arguments are set to NULL. + */ +#if __has_attribute (nonnull) +#define pg_attribute_nonnull(...) __attribute__((nonnull(__VA_ARGS__))) +#else +#define pg_attribute_nonnull(...) +#endif + +/* + * pg_attribute_target allows specifying different target options that the + * function should be compiled with (e.g., for using special CPU instructions). + * Note that there still needs to be a configure-time check to verify that a + * specific target is understood by the compiler. + */ +#if __has_attribute (target) +#define pg_attribute_target(...) __attribute__((target(__VA_ARGS__))) +#else +#define pg_attribute_target(...) +#endif + +/* + * Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only + * used in assert-enabled builds, to avoid compiler warnings about unused + * variables in assert-disabled builds. + */ +#ifdef USE_ASSERT_CHECKING +#define PG_USED_FOR_ASSERTS_ONLY +#else +#define PG_USED_FOR_ASSERTS_ONLY pg_attribute_unused() +#endif + +/* GCC supports format attributes */ +#if defined(__GNUC__) +#define pg_attribute_format_arg(a) __attribute__((format_arg(a))) +#define pg_attribute_printf(f,a) __attribute__((format(PG_PRINTF_ATTRIBUTE, f, a))) +#else +#define pg_attribute_format_arg(a) +#define pg_attribute_printf(f,a) +#endif + +/* GCC and Sunpro support aligned and packed */ +#if defined(__GNUC__) || defined(__SUNPRO_C) +#define pg_attribute_aligned(a) __attribute__((aligned(a))) +#define pg_attribute_packed() __attribute__((packed)) +#elif defined(_MSC_VER) +/* + * MSVC supports aligned. + * + * Packing is also possible but only by wrapping the entire struct definition + * which doesn't fit into our current macro declarations. + */ +#define pg_attribute_aligned(a) __declspec(align(a)) +#else +/* + * NB: aligned and packed are not given default definitions because they + * affect code functionality; they *must* be implemented by the compiler + * if they are to be used. + */ +#endif + +/* + * Use "pg_attribute_always_inline" in place of "inline" for functions that + * we wish to force inlining of, even when the compiler's heuristics would + * choose not to. But, if possible, don't force inlining in unoptimized + * debug builds. + */ +#if (defined(__GNUC__) && __GNUC__ > 3 && defined(__OPTIMIZE__)) || defined(__SUNPRO_C) +/* GCC > 3 and Sunpro support always_inline via __attribute__ */ +#define pg_attribute_always_inline __attribute__((always_inline)) inline +#elif defined(_MSC_VER) +/* MSVC has a special keyword for this */ +#define pg_attribute_always_inline __forceinline +#else +/* Otherwise, the best we can do is to say "inline" */ +#define pg_attribute_always_inline inline +#endif + +/* + * Forcing a function not to be inlined can be useful if it's the slow path of + * a performance-critical function, or should be visible in profiles to allow + * for proper cost attribution. Note that unlike the pg_attribute_XXX macros + * above, this should be placed before the function's return type and name. + */ +/* GCC and Sunpro support noinline via __attribute__ */ +#if (defined(__GNUC__) && __GNUC__ > 2) || defined(__SUNPRO_C) +#define pg_noinline __attribute__((noinline)) +/* msvc via declspec */ +#elif defined(_MSC_VER) +#define pg_noinline __declspec(noinline) +#else +#define pg_noinline +#endif + +/* + * For now, just define pg_attribute_cold and pg_attribute_hot to be empty + * macros on minGW 8.1. There appears to be a compiler bug that results in + * compilation failure. At this time, we still have at least one buildfarm + * animal running that compiler, so this should make that green again. It's + * likely this compiler is not popular enough to warrant keeping this code + * around forever, so let's just remove it once the last buildfarm animal + * upgrades. + */ +#if defined(__MINGW64__) && __GNUC__ == 8 && __GNUC_MINOR__ == 1 + +#define pg_attribute_cold +#define pg_attribute_hot + +#else +/* + * Marking certain functions as "hot" or "cold" can be useful to assist the + * compiler in arranging the assembly code in a more efficient way. + */ +#if __has_attribute (cold) +#define pg_attribute_cold __attribute__((cold)) +#else +#define pg_attribute_cold +#endif + +#if __has_attribute (hot) +#define pg_attribute_hot __attribute__((hot)) +#else +#define pg_attribute_hot +#endif + +#endif /* defined(__MINGW64__) && __GNUC__ == 8 && + * __GNUC_MINOR__ == 1 */ +/* + * Mark a point as unreachable in a portable fashion. This should preferably + * be something that the compiler understands, to aid code generation. + * In assert-enabled builds, we prefer abort() for debugging reasons. + */ +#if defined(HAVE__BUILTIN_UNREACHABLE) && !defined(USE_ASSERT_CHECKING) +#define pg_unreachable() __builtin_unreachable() +#elif defined(_MSC_VER) && !defined(USE_ASSERT_CHECKING) +#define pg_unreachable() __assume(0) +#else +#define pg_unreachable() abort() +#endif + +/* + * Hints to the compiler about the likelihood of a branch. Both likely() and + * unlikely() return the boolean value of the contained expression. + * + * These should only be used sparingly, in very hot code paths. It's very easy + * to mis-estimate likelihoods. + */ +#if __GNUC__ >= 3 +#define likely(x) __builtin_expect((x) != 0, 1) +#define unlikely(x) __builtin_expect((x) != 0, 0) +#else +#define likely(x) ((x) != 0) +#define unlikely(x) ((x) != 0) +#endif + +/* + * CppAsString + * Convert the argument to a string, using the C preprocessor. + * CppAsString2 + * Convert the argument to a string, after one round of macro expansion. + * CppConcat + * Concatenate two arguments together, using the C preprocessor. + * + * Note: There used to be support here for pre-ANSI C compilers that didn't + * support # and ##. Nowadays, these macros are just for clarity and/or + * backward compatibility with existing PostgreSQL code. + */ +#define CppAsString(identifier) #identifier +#define CppAsString2(x) CppAsString(x) +#define CppConcat(x, y) x##y + +/* + * VA_ARGS_NARGS + * Returns the number of macro arguments it is passed. + * + * An empty argument still counts as an argument, so effectively, this is + * "one more than the number of commas in the argument list". + * + * This works for up to 63 arguments. Internally, VA_ARGS_NARGS_() is passed + * 64+N arguments, and the C99 standard only requires macros to allow up to + * 127 arguments, so we can't portably go higher. The implementation is + * pretty trivial: VA_ARGS_NARGS_() returns its 64th argument, and we set up + * the call so that that is the appropriate one of the list of constants. + * This idea is due to Laurent Deniau. + * + * MSVC has an implementation of __VA_ARGS__ that doesn't conform to the + * standard unless you use the /Zc:preprocessor compiler flag, but that + * isn't available before Visual Studio 2019. For now, use a different + * definition that also works on older compilers. + */ +#ifdef _MSC_VER +#define EXPAND(args) args +#define VA_ARGS_NARGS(...) \ + VA_ARGS_NARGS_ EXPAND((__VA_ARGS__, \ + 63,62,61,60, \ + 59,58,57,56,55,54,53,52,51,50, \ + 49,48,47,46,45,44,43,42,41,40, \ + 39,38,37,36,35,34,33,32,31,30, \ + 29,28,27,26,25,24,23,22,21,20, \ + 19,18,17,16,15,14,13,12,11,10, \ + 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) +#else + +#define VA_ARGS_NARGS(...) \ + VA_ARGS_NARGS_(__VA_ARGS__, \ + 63,62,61,60, \ + 59,58,57,56,55,54,53,52,51,50, \ + 49,48,47,46,45,44,43,42,41,40, \ + 39,38,37,36,35,34,33,32,31,30, \ + 29,28,27,26,25,24,23,22,21,20, \ + 19,18,17,16,15,14,13,12,11,10, \ + 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) +#endif + +#define VA_ARGS_NARGS_( \ + _01,_02,_03,_04,_05,_06,_07,_08,_09,_10, \ + _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ + _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ + _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ + _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ + _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ + _61,_62,_63, N, ...) \ + (N) + +/* + * Generic function pointer. This can be used in the rare cases where it's + * necessary to cast a function pointer to a seemingly incompatible function + * pointer type while avoiding gcc's -Wcast-function-type warnings. + */ +typedef void (*pg_funcptr_t) (void); + +/* + * We require C99, hence the compiler should understand flexible array + * members. However, for documentation purposes we still consider it to be + * project style to write "field[FLEXIBLE_ARRAY_MEMBER]" not just "field[]". + * When computing the size of such an object, use "offsetof(struct s, f)" + * for portability. Don't use "offsetof(struct s, f[0])", as this doesn't + * work with MSVC and with C++ compilers. + */ +#define FLEXIBLE_ARRAY_MEMBER /* empty */ + +/* + * Does the compiler support #pragma GCC system_header? We optionally use it + * to avoid warnings that we can't fix (e.g. in the perl headers). + * See https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html + * + * Headers for which we do not want to show compiler warnings can, + * conditionally, use #pragma GCC system_header to avoid warnings. Obviously + * this should only be used for external headers over which we do not have + * control. + * + * Support for the pragma is tested here, instead of during configure, as gcc + * also warns about the pragma being used in a .c file. It's surprisingly hard + * to get autoconf to use .h as the file-ending. Looks like gcc has + * implemented the pragma since the 2000, so this test should suffice. + * + * + * Alternatively, we could add the include paths for problematic headers with + * -isystem, but that is a larger hammer and is harder to search for. + * + * A more granular alternative would be to use #pragma GCC diagnostic + * push/ignored/pop, but gcc warns about unknown warnings being ignored, so + * every to-be-ignored-temporarily compiler warning would require its own + * pg_config.h symbol and #ifdef. + */ +#ifdef __GNUC__ +#define HAVE_PRAGMA_GCC_SYSTEM_HEADER 1 +#endif + + +/* ---------------------------------------------------------------- + * Section 2: bool, true, false + * ---------------------------------------------------------------- + */ + +/* + * bool + * Boolean value, either true or false. + * + * PostgreSQL currently cannot deal with bool of size other than 1; there are + * static assertions around the code to prevent that. + */ + +#include + + +/* ---------------------------------------------------------------- + * Section 3: standard system types + * ---------------------------------------------------------------- + */ + +/* + * Pointer + * Variable holding address of any memory resident object. + * + * XXX Pointer arithmetic is done with this, so it can't be void * + * under "true" ANSI compilers. + */ +typedef char *Pointer; + +/* Historical names for types in . */ +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; + +/* + * bitsN + * Unit of bitwise operation, AT LEAST N BITS IN SIZE. + */ +typedef uint8 bits8; /* >= 8 bits */ +typedef uint16 bits16; /* >= 16 bits */ +typedef uint32 bits32; /* >= 32 bits */ + +/* + * 64-bit integers + */ +#define INT64CONST(x) INT64_C(x) +#define UINT64CONST(x) UINT64_C(x) + +/* snprintf format strings to use for 64-bit integers */ +#define INT64_FORMAT "%" PRId64 +#define UINT64_FORMAT "%" PRIu64 + +/* + * 128-bit signed and unsigned integers + * There currently is only limited support for such types. + * E.g. 128bit literals and snprintf are not supported; but math is. + * Also, because we exclude such types when choosing MAXIMUM_ALIGNOF, + * it must be possible to coerce the compiler to allocate them on no + * more than MAXALIGN boundaries. + */ +#if defined(PG_INT128_TYPE) +#if defined(pg_attribute_aligned) || ALIGNOF_PG_INT128_TYPE <= MAXIMUM_ALIGNOF +#define HAVE_INT128 1 + +typedef PG_INT128_TYPE int128 +#if defined(pg_attribute_aligned) + pg_attribute_aligned(MAXIMUM_ALIGNOF) +#endif + ; + +typedef unsigned PG_INT128_TYPE uint128 +#if defined(pg_attribute_aligned) + pg_attribute_aligned(MAXIMUM_ALIGNOF) +#endif + ; + +#endif +#endif + +/* Historical names for limits in . */ +#define PG_INT8_MIN INT8_MIN +#define PG_INT8_MAX INT8_MAX +#define PG_UINT8_MAX UINT8_MAX +#define PG_INT16_MIN INT16_MIN +#define PG_INT16_MAX INT16_MAX +#define PG_UINT16_MAX UINT16_MAX +#define PG_INT32_MIN INT32_MIN +#define PG_INT32_MAX INT32_MAX +#define PG_UINT32_MAX UINT32_MAX +#define PG_INT64_MIN INT64_MIN +#define PG_INT64_MAX INT64_MAX +#define PG_UINT64_MAX UINT64_MAX + +/* + * We now always use int64 timestamps, but keep this symbol defined for the + * benefit of external code that might test it. + */ +#define HAVE_INT64_TIMESTAMP + +/* + * Size + * Size of any memory resident object, as returned by sizeof. + */ +typedef size_t Size; + +/* + * Index + * Index into any memory resident array. + * + * Note: + * Indices are non negative. + */ +typedef unsigned int Index; + +/* + * Offset + * Offset into any memory resident array. + * + * Note: + * This differs from an Index in that an Index is always + * non negative, whereas Offset may be negative. + */ +typedef signed int Offset; + +/* + * Common Postgres datatype names (as used in the catalogs) + */ +typedef float float4; +typedef double float8; + +#ifdef USE_FLOAT8_BYVAL +#define FLOAT8PASSBYVAL true +#else +#define FLOAT8PASSBYVAL false +#endif + +/* + * Oid, RegProcedure, TransactionId, SubTransactionId, MultiXactId, + * CommandId + */ + +/* typedef Oid is in postgres_ext.h */ + +/* + * regproc is the type name used in the include/catalog headers, but + * RegProcedure is the preferred name in C code. + */ +typedef Oid regproc; +typedef regproc RegProcedure; + +typedef uint32 TransactionId; + +typedef uint32 LocalTransactionId; + +typedef uint32 SubTransactionId; + +#define InvalidSubTransactionId ((SubTransactionId) 0) +#define TopSubTransactionId ((SubTransactionId) 1) + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +typedef uint32 CommandId; + +#define FirstCommandId ((CommandId) 0) +#define InvalidCommandId (~(CommandId)0) + + +/* ---------------- + * Variable-length datatypes all share the 'struct varlena' header. + * + * NOTE: for TOASTable types, this is an oversimplification, since the value + * may be compressed or moved out-of-line. However datatype-specific routines + * are mostly content to deal with de-TOASTed values only, and of course + * client-side routines should never see a TOASTed value. But even in a + * de-TOASTed value, beware of touching vl_len_ directly, as its + * representation is no longer convenient. It's recommended that code always + * use macros VARDATA_ANY, VARSIZE_ANY, VARSIZE_ANY_EXHDR, VARDATA, VARSIZE, + * and SET_VARSIZE instead of relying on direct mentions of the struct fields. + * See postgres.h for details of the TOASTed form. + * ---------------- + */ +struct varlena +{ + char vl_len_[4]; /* Do not touch this field directly! */ + char vl_dat[FLEXIBLE_ARRAY_MEMBER]; /* Data content is here */ +}; + +#define VARHDRSZ ((int32) sizeof(int32)) + +/* + * These widely-used datatypes are just a varlena header and the data bytes. + * There is no terminating null or anything like that --- the data length is + * always VARSIZE_ANY_EXHDR(ptr). + */ +typedef struct varlena bytea; +typedef struct varlena text; +typedef struct varlena BpChar; /* blank-padded char, ie SQL char(n) */ +typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */ + +/* + * Specialized array types. These are physically laid out just the same + * as regular arrays (so that the regular array subscripting code works + * with them). They exist as distinct types mostly for historical reasons: + * they have nonstandard I/O behavior which we don't want to change for fear + * of breaking applications that look at the system catalogs. There is also + * an implementation issue for oidvector: it's part of the primary key for + * pg_proc, and we can't use the normal btree array support routines for that + * without circularity. + */ +typedef struct +{ + int32 vl_len_; /* these fields must match ArrayType! */ + int ndim; /* always 1 for int2vector */ + int32 dataoffset; /* always 0 for int2vector */ + Oid elemtype; + int dim1; + int lbound1; + int16 values[FLEXIBLE_ARRAY_MEMBER]; +} int2vector; + +typedef struct +{ + int32 vl_len_; /* these fields must match ArrayType! */ + int ndim; /* always 1 for oidvector */ + int32 dataoffset; /* always 0 for oidvector */ + Oid elemtype; + int dim1; + int lbound1; + Oid values[FLEXIBLE_ARRAY_MEMBER]; +} oidvector; + +/* + * Representation of a Name: effectively just a C string, but null-padded to + * exactly NAMEDATALEN bytes. The use of a struct is historical. + */ +typedef struct nameData +{ + char data[NAMEDATALEN]; +} NameData; +typedef NameData *Name; + +#define NameStr(name) ((name).data) + + +/* ---------------------------------------------------------------- + * Section 4: IsValid macros for system types + * ---------------------------------------------------------------- + */ +/* + * BoolIsValid + * True iff bool is valid. + */ +#define BoolIsValid(boolean) ((boolean) == false || (boolean) == true) + +/* + * PointerIsValid + * True iff pointer is valid. + */ +#define PointerIsValid(pointer) ((const void*)(pointer) != NULL) + +/* + * PointerIsAligned + * True iff pointer is properly aligned to point to the given type. + */ +#define PointerIsAligned(pointer, type) \ + (((uintptr_t)(pointer) % (sizeof (type))) == 0) + +#define OffsetToPointer(base, offset) \ + ((void *)((char *) base + offset)) + +#define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid)) + +#define RegProcedureIsValid(p) OidIsValid(p) + + +/* ---------------------------------------------------------------- + * Section 5: lengthof, alignment + * ---------------------------------------------------------------- + */ +/* + * lengthof + * Number of elements in an array. + */ +#define lengthof(array) (sizeof (array) / sizeof ((array)[0])) + +/* ---------------- + * Alignment macros: align a length or address appropriately for a given type. + * The fooALIGN() macros round up to a multiple of the required alignment, + * while the fooALIGN_DOWN() macros round down. The latter are more useful + * for problems like "how many X-sized structures will fit in a page?". + * + * NOTE: TYPEALIGN[_DOWN] will not work if ALIGNVAL is not a power of 2. + * That case seems extremely unlikely to be needed in practice, however. + * + * NOTE: MAXIMUM_ALIGNOF, and hence MAXALIGN(), intentionally exclude any + * larger-than-8-byte types the compiler might have. + * ---------------- + */ + +#define TYPEALIGN(ALIGNVAL,LEN) \ + (((uintptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((uintptr_t) ((ALIGNVAL) - 1))) + +#define SHORTALIGN(LEN) TYPEALIGN(ALIGNOF_SHORT, (LEN)) +#define INTALIGN(LEN) TYPEALIGN(ALIGNOF_INT, (LEN)) +#define LONGALIGN(LEN) TYPEALIGN(ALIGNOF_LONG, (LEN)) +#define DOUBLEALIGN(LEN) TYPEALIGN(ALIGNOF_DOUBLE, (LEN)) +#define MAXALIGN(LEN) TYPEALIGN(MAXIMUM_ALIGNOF, (LEN)) +/* MAXALIGN covers only built-in types, not buffers */ +#define BUFFERALIGN(LEN) TYPEALIGN(ALIGNOF_BUFFER, (LEN)) +#define CACHELINEALIGN(LEN) TYPEALIGN(PG_CACHE_LINE_SIZE, (LEN)) + +#define TYPEALIGN_DOWN(ALIGNVAL,LEN) \ + (((uintptr_t) (LEN)) & ~((uintptr_t) ((ALIGNVAL) - 1))) + +#define SHORTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN)) +#define INTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_INT, (LEN)) +#define LONGALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_LONG, (LEN)) +#define DOUBLEALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_DOUBLE, (LEN)) +#define MAXALIGN_DOWN(LEN) TYPEALIGN_DOWN(MAXIMUM_ALIGNOF, (LEN)) +#define BUFFERALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_BUFFER, (LEN)) + +/* + * The above macros will not work with types wider than uintptr_t, like with + * uint64 on 32-bit platforms. That's not problem for the usual use where a + * pointer or a length is aligned, but for the odd case that you need to + * align something (potentially) wider, use TYPEALIGN64. + */ +#define TYPEALIGN64(ALIGNVAL,LEN) \ + (((uint64) (LEN) + ((ALIGNVAL) - 1)) & ~((uint64) ((ALIGNVAL) - 1))) + +/* we don't currently need wider versions of the other ALIGN macros */ +#define MAXALIGN64(LEN) TYPEALIGN64(MAXIMUM_ALIGNOF, (LEN)) + + +/* ---------------------------------------------------------------- + * Section 6: assertions + * ---------------------------------------------------------------- + */ + +/* + * USE_ASSERT_CHECKING, if defined, turns on all the assertions. + * - plai 9/5/90 + * + * It should _NOT_ be defined in releases or in benchmark copies + */ + +/* + * Assert() can be used in both frontend and backend code. In frontend code it + * just calls the standard assert, if it's available. If use of assertions is + * not configured, it does nothing. + */ +#ifndef USE_ASSERT_CHECKING + +#define Assert(condition) ((void)true) +#define AssertMacro(condition) ((void)true) + +#elif defined(FRONTEND) + +#include +#define Assert(p) assert(p) +#define AssertMacro(p) ((void) assert(p)) + +#else /* USE_ASSERT_CHECKING && !FRONTEND */ + +/* + * Assert + * Generates a fatal exception if the given condition is false. + */ +#define Assert(condition) \ + do { \ + if (!(condition)) \ + ExceptionalCondition(#condition, __FILE__, __LINE__); \ + } while (0) + +/* + * AssertMacro is the same as Assert but it's suitable for use in + * expression-like macros, for example: + * + * #define foo(x) (AssertMacro(x != 0), bar(x)) + */ +#define AssertMacro(condition) \ + ((void) ((condition) || \ + (ExceptionalCondition(#condition, __FILE__, __LINE__), 0))) + +#endif /* USE_ASSERT_CHECKING && !FRONTEND */ + +/* + * Check that `ptr' is `bndr' aligned. + */ +#define AssertPointerAlignment(ptr, bndr) \ + Assert(TYPEALIGN(bndr, (uintptr_t)(ptr)) == (uintptr_t)(ptr)) + +/* + * ExceptionalCondition is compiled into the backend whether or not + * USE_ASSERT_CHECKING is defined, so as to support use of extensions + * that are built with that #define with a backend that isn't. Hence, + * we should declare it as long as !FRONTEND. + */ +#ifndef FRONTEND +pg_noreturn extern void ExceptionalCondition(const char *conditionName, + const char *fileName, int lineNumber); +#endif + +/* + * Macros to support compile-time assertion checks. + * + * If the "condition" (a compile-time-constant expression) evaluates to false, + * throw a compile error using the "errmessage" (a string literal). + * + * C11 has _Static_assert(), and most C99 compilers already support that. For + * portability, we wrap it into StaticAssertDecl(). _Static_assert() is a + * "declaration", and so it must be placed where for example a variable + * declaration would be valid. As long as we compile with + * -Wno-declaration-after-statement, that also means it cannot be placed after + * statements in a function. Macros StaticAssertStmt() and StaticAssertExpr() + * make it safe to use as a statement or in an expression, respectively. + * + * For compilers without _Static_assert(), we fall back on a kluge that + * assumes the compiler will complain about a negative width for a struct + * bit-field. This will not include a helpful error message, but it beats not + * getting an error at all. + */ +#ifndef __cplusplus +#ifdef HAVE__STATIC_ASSERT +#define StaticAssertDecl(condition, errmessage) \ + _Static_assert(condition, errmessage) +#define StaticAssertStmt(condition, errmessage) \ + do { _Static_assert(condition, errmessage); } while(0) +#define StaticAssertExpr(condition, errmessage) \ + ((void) ({ StaticAssertStmt(condition, errmessage); true; })) +#else /* !HAVE__STATIC_ASSERT */ +#define StaticAssertDecl(condition, errmessage) \ + extern void static_assert_func(int static_assert_failure[(condition) ? 1 : -1]) +#define StaticAssertStmt(condition, errmessage) \ + ((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; })) +#define StaticAssertExpr(condition, errmessage) \ + StaticAssertStmt(condition, errmessage) +#endif /* HAVE__STATIC_ASSERT */ +#else /* C++ */ +#if defined(__cpp_static_assert) && __cpp_static_assert >= 200410 +#define StaticAssertDecl(condition, errmessage) \ + static_assert(condition, errmessage) +#define StaticAssertStmt(condition, errmessage) \ + static_assert(condition, errmessage) +#define StaticAssertExpr(condition, errmessage) \ + ({ static_assert(condition, errmessage); }) +#else /* !__cpp_static_assert */ +#define StaticAssertDecl(condition, errmessage) \ + extern void static_assert_func(int static_assert_failure[(condition) ? 1 : -1]) +#define StaticAssertStmt(condition, errmessage) \ + do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0) +#define StaticAssertExpr(condition, errmessage) \ + ((void) ({ StaticAssertStmt(condition, errmessage); })) +#endif /* __cpp_static_assert */ +#endif /* C++ */ + + +/* + * Compile-time checks that a variable (or expression) has the specified type. + * + * AssertVariableIsOfType() can be used as a statement. + * AssertVariableIsOfTypeMacro() is intended for use in macros, eg + * #define foo(x) (AssertVariableIsOfTypeMacro(x, int), bar(x)) + * + * If we don't have __builtin_types_compatible_p, we can still assert that + * the types have the same size. This is far from ideal (especially on 32-bit + * platforms) but it provides at least some coverage. + */ +#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P +#define AssertVariableIsOfType(varname, typename) \ + StaticAssertStmt(__builtin_types_compatible_p(__typeof__(varname), typename), \ + CppAsString(varname) " does not have type " CppAsString(typename)) +#define AssertVariableIsOfTypeMacro(varname, typename) \ + (StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \ + CppAsString(varname) " does not have type " CppAsString(typename))) +#else /* !HAVE__BUILTIN_TYPES_COMPATIBLE_P */ +#define AssertVariableIsOfType(varname, typename) \ + StaticAssertStmt(sizeof(varname) == sizeof(typename), \ + CppAsString(varname) " does not have type " CppAsString(typename)) +#define AssertVariableIsOfTypeMacro(varname, typename) \ + (StaticAssertExpr(sizeof(varname) == sizeof(typename), \ + CppAsString(varname) " does not have type " CppAsString(typename))) +#endif /* HAVE__BUILTIN_TYPES_COMPATIBLE_P */ + + +/* ---------------------------------------------------------------- + * Section 7: widely useful macros + * ---------------------------------------------------------------- + */ +/* + * Max + * Return the maximum of two numbers. + */ +#define Max(x, y) ((x) > (y) ? (x) : (y)) + +/* + * Min + * Return the minimum of two numbers. + */ +#define Min(x, y) ((x) < (y) ? (x) : (y)) + + +/* Get a bit mask of the bits set in non-long aligned addresses */ +#define LONG_ALIGN_MASK (sizeof(long) - 1) + +/* + * MemSet + * Exactly the same as standard library function memset(), but considerably + * faster for zeroing small word-aligned structures (such as parsetree nodes). + * This has to be a macro because the main point is to avoid function-call + * overhead. However, we have also found that the loop is faster than + * native libc memset() on some platforms, even those with assembler + * memset() functions. More research needs to be done, perhaps with + * MEMSET_LOOP_LIMIT tests in configure. + */ +#define MemSet(start, val, len) \ + do \ + { \ + /* must be void* because we don't know if it is integer aligned yet */ \ + void *_vstart = (void *) (start); \ + int _val = (val); \ + Size _len = (len); \ +\ + if ((((uintptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \ + (_len & LONG_ALIGN_MASK) == 0 && \ + _val == 0 && \ + _len <= MEMSET_LOOP_LIMIT && \ + /* \ + * If MEMSET_LOOP_LIMIT == 0, optimizer should find \ + * the whole "if" false at compile time. \ + */ \ + MEMSET_LOOP_LIMIT != 0) \ + { \ + long *_start = (long *) _vstart; \ + long *_stop = (long *) ((char *) _start + _len); \ + while (_start < _stop) \ + *_start++ = 0; \ + } \ + else \ + memset(_vstart, _val, _len); \ + } while (0) + +/* + * MemSetAligned is the same as MemSet except it omits the test to see if + * "start" is word-aligned. This is okay to use if the caller knows a-priori + * that the pointer is suitably aligned (typically, because he just got it + * from palloc(), which always delivers a max-aligned pointer). + */ +#define MemSetAligned(start, val, len) \ + do \ + { \ + long *_start = (long *) (start); \ + int _val = (val); \ + Size _len = (len); \ +\ + if ((_len & LONG_ALIGN_MASK) == 0 && \ + _val == 0 && \ + _len <= MEMSET_LOOP_LIMIT && \ + MEMSET_LOOP_LIMIT != 0) \ + { \ + long *_stop = (long *) ((char *) _start + _len); \ + while (_start < _stop) \ + *_start++ = 0; \ + } \ + else \ + memset(_start, _val, _len); \ + } while (0) + + +/* + * Macros for range-checking float values before converting to integer. + * We must be careful here that the boundary values are expressed exactly + * in the float domain. PG_INTnn_MIN is an exact power of 2, so it will + * be represented exactly; but PG_INTnn_MAX isn't, and might get rounded + * off, so avoid using that. + * The input must be rounded to an integer beforehand, typically with rint(), + * else we might draw the wrong conclusion about close-to-the-limit values. + * These macros will do the right thing for Inf, but not necessarily for NaN, + * so check isnan(num) first if that's a possibility. + */ +#define FLOAT4_FITS_IN_INT16(num) \ + ((num) >= (float4) PG_INT16_MIN && (num) < -((float4) PG_INT16_MIN)) +#define FLOAT4_FITS_IN_INT32(num) \ + ((num) >= (float4) PG_INT32_MIN && (num) < -((float4) PG_INT32_MIN)) +#define FLOAT4_FITS_IN_INT64(num) \ + ((num) >= (float4) PG_INT64_MIN && (num) < -((float4) PG_INT64_MIN)) +#define FLOAT8_FITS_IN_INT16(num) \ + ((num) >= (float8) PG_INT16_MIN && (num) < -((float8) PG_INT16_MIN)) +#define FLOAT8_FITS_IN_INT32(num) \ + ((num) >= (float8) PG_INT32_MIN && (num) < -((float8) PG_INT32_MIN)) +#define FLOAT8_FITS_IN_INT64(num) \ + ((num) >= (float8) PG_INT64_MIN && (num) < -((float8) PG_INT64_MIN)) + + +/* ---------------------------------------------------------------- + * Section 8: random stuff + * ---------------------------------------------------------------- + */ + +/* + * Invert the sign of a qsort-style comparison result, ie, exchange negative + * and positive integer values, being careful not to get the wrong answer + * for INT_MIN. The argument should be an integral variable. + */ +#define INVERT_COMPARE_RESULT(var) \ + ((var) = ((var) < 0) ? 1 : -(var)) + +/* + * Use this, not "char buf[BLCKSZ]", to declare a field or local variable + * holding a page buffer, if that page might be accessed as a page. Otherwise + * the variable might be under-aligned, causing problems on alignment-picky + * hardware. We include both "double" and "int64" in the union to ensure that + * the compiler knows the value must be MAXALIGN'ed (cf. configure's + * computation of MAXIMUM_ALIGNOF). + */ +typedef union PGAlignedBlock +{ + char data[BLCKSZ]; + double force_align_d; + int64 force_align_i64; +} PGAlignedBlock; + +/* + * Use this to declare a field or local variable holding a page buffer, if that + * page might be accessed as a page or passed to an SMgr I/O function. If + * allocating using the MemoryContext API, the aligned allocation functions + * should be used with PG_IO_ALIGN_SIZE. This alignment may be more efficient + * for I/O in general, but may be strictly required on some platforms when + * using direct I/O. + */ +typedef union PGIOAlignedBlock +{ +#ifdef pg_attribute_aligned + pg_attribute_aligned(PG_IO_ALIGN_SIZE) +#endif + char data[BLCKSZ]; + double force_align_d; + int64 force_align_i64; +} PGIOAlignedBlock; + +/* Same, but for an XLOG_BLCKSZ-sized buffer */ +typedef union PGAlignedXLogBlock +{ +#ifdef pg_attribute_aligned + pg_attribute_aligned(PG_IO_ALIGN_SIZE) +#endif + char data[XLOG_BLCKSZ]; + double force_align_d; + int64 force_align_i64; +} PGAlignedXLogBlock; + +/* msb for char */ +#define HIGHBIT (0x80) +#define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT) + +/* + * Support macros for escaping strings. escape_backslash should be true + * if generating a non-standard-conforming string. Prefixing a string + * with ESCAPE_STRING_SYNTAX guarantees it is non-standard-conforming. + * Beware of multiple evaluation of the "ch" argument! + */ +#define SQL_STR_DOUBLE(ch, escape_backslash) \ + ((ch) == '\'' || ((ch) == '\\' && (escape_backslash))) + +#define ESCAPE_STRING_SYNTAX 'E' + + +#define STATUS_OK (0) +#define STATUS_ERROR (-1) +#define STATUS_EOF (-2) + +/* + * gettext support + */ + +#ifndef ENABLE_NLS +/* stuff we'd otherwise get from */ +#define gettext(x) (x) +#define dgettext(d,x) (x) +#define ngettext(s,p,n) ((n) == 1 ? (s) : (p)) +#define dngettext(d,s,p,n) ((n) == 1 ? (s) : (p)) +#endif + +#define _(x) gettext(x) + +/* + * Use this to mark string constants as needing translation at some later + * time, rather than immediately. This is useful for cases where you need + * access to the original string and translated string, and for cases where + * immediate translation is not possible, like when initializing global + * variables. + * + * https://www.gnu.org/software/gettext/manual/html_node/Special-cases.html + */ +#define gettext_noop(x) (x) + +/* + * To better support parallel installations of major PostgreSQL + * versions as well as parallel installations of major library soname + * versions, we mangle the gettext domain name by appending those + * version numbers. The coding rule ought to be that wherever the + * domain name is mentioned as a literal, it must be wrapped into + * PG_TEXTDOMAIN(). The macros below do not work on non-literals; but + * that is somewhat intentional because it avoids having to worry + * about multiple states of premangling and postmangling as the values + * are being passed around. + * + * Make sure this matches the installation rules in nls-global.mk. + */ +#ifdef SO_MAJOR_VERSION +#define PG_TEXTDOMAIN(domain) (domain CppAsString2(SO_MAJOR_VERSION) "-" PG_MAJORVERSION) +#else +#define PG_TEXTDOMAIN(domain) (domain "-" PG_MAJORVERSION) +#endif + +/* + * Macro that allows to cast constness and volatile away from an expression, but doesn't + * allow changing the underlying type. Enforcement of the latter + * currently only works for gcc like compilers. + * + * Please note IT IS NOT SAFE to cast constness away if the result will ever + * be modified (it would be undefined behaviour). Doing so anyway can cause + * compiler misoptimizations or runtime crashes (modifying readonly memory). + * It is only safe to use when the result will not be modified, but API + * design or language restrictions prevent you from declaring that + * (e.g. because a function returns both const and non-const variables). + * + * Note that this only works in function scope, not for global variables (it'd + * be nice, but not trivial, to improve that). + */ +#if defined(__cplusplus) +#define unconstify(underlying_type, expr) const_cast(expr) +#define unvolatize(underlying_type, expr) const_cast(expr) +#elif defined(HAVE__BUILTIN_TYPES_COMPATIBLE_P) +#define unconstify(underlying_type, expr) \ + (StaticAssertExpr(__builtin_types_compatible_p(__typeof(expr), const underlying_type), \ + "wrong cast"), \ + (underlying_type) (expr)) +#define unvolatize(underlying_type, expr) \ + (StaticAssertExpr(__builtin_types_compatible_p(__typeof(expr), volatile underlying_type), \ + "wrong cast"), \ + (underlying_type) (expr)) +#else +#define unconstify(underlying_type, expr) \ + ((underlying_type) (expr)) +#define unvolatize(underlying_type, expr) \ + ((underlying_type) (expr)) +#endif + +/* ---------------------------------------------------------------- + * Section 9: system-specific hacks + * + * This should be limited to things that absolutely have to be + * included in every source file. The port-specific header file + * is usually a better place for this sort of thing. + * ---------------------------------------------------------------- + */ + +/* + * NOTE: this is also used for opening text files. + * WIN32 treats Control-Z as EOF in files opened in text mode. + * Therefore, we open files in binary mode on Win32 so we can read + * literal control-Z. The other affect is that we see CRLF, but + * that is OK because we can already handle those cleanly. + */ +#if defined(WIN32) || defined(__CYGWIN__) +#define PG_BINARY O_BINARY +#define PG_BINARY_A "ab" +#define PG_BINARY_R "rb" +#define PG_BINARY_W "wb" +#else +#define PG_BINARY 0 +#define PG_BINARY_A "a" +#define PG_BINARY_R "r" +#define PG_BINARY_W "w" +#endif + +/* + * Provide prototypes for routines not present in a particular machine's + * standard C library. + */ + +#if !HAVE_DECL_FDATASYNC +extern int fdatasync(int fildes); +#endif + +/* + * Thin wrappers that convert strings to exactly 64-bit integers, matching our + * definition of int64. (For the naming, compare that POSIX has + * strtoimax()/strtoumax() which return intmax_t/uintmax_t.) + */ +#if SIZEOF_LONG == 8 +#define strtoi64(str, endptr, base) ((int64) strtol(str, endptr, base)) +#define strtou64(str, endptr, base) ((uint64) strtoul(str, endptr, base)) +#elif SIZEOF_LONG_LONG == 8 +#define strtoi64(str, endptr, base) ((int64) strtoll(str, endptr, base)) +#define strtou64(str, endptr, base) ((uint64) strtoull(str, endptr, base)) +#else +#error "cannot find integer type of the same size as int64_t" +#endif + +/* + * Similarly, wrappers around labs()/llabs() matching our int64. + */ +#if SIZEOF_LONG == 8 +#define i64abs(i) ((int64) labs(i)) +#elif SIZEOF_LONG_LONG == 8 +#define i64abs(i) ((int64) llabs(i)) +#else +#error "cannot find integer type of the same size as int64_t" +#endif + +/* + * Use "extern PGDLLIMPORT ..." to declare variables that are defined + * in the core backend and need to be accessible by loadable modules. + * No special marking is required on most ports. + */ +#ifndef PGDLLIMPORT +#define PGDLLIMPORT +#endif + +/* + * Use "extern PGDLLEXPORT ..." to declare functions that are defined in + * loadable modules and need to be callable by the core backend or other + * loadable modules. + * If the compiler knows __attribute__((visibility("*"))), we use that, + * unless we already have a platform-specific definition. Otherwise, + * no special marking is required. + */ +#ifndef PGDLLEXPORT +#ifdef HAVE_VISIBILITY_ATTRIBUTE +#define PGDLLEXPORT __attribute__((visibility("default"))) +#else +#define PGDLLEXPORT +#endif +#endif + +/* + * The following is used as the arg list for signal handlers. Any ports + * that take something other than an int argument should override this in + * their pg_config_os.h file. Note that variable names are required + * because it is used in both the prototypes as well as the definitions. + * Note also the long name. We expect that this won't collide with + * other names causing compiler warnings. + */ + +#ifndef SIGNAL_ARGS +#define SIGNAL_ARGS int postgres_signal_arg +#endif + +/* + * When there is no sigsetjmp, its functionality is provided by plain + * setjmp. We now support the case only on Windows. However, it seems + * that MinGW-64 has some longstanding issues in its setjmp support, + * so on that toolchain we cheat and use gcc's builtins. + */ +#ifdef WIN32 +#ifdef __MINGW64__ +typedef intptr_t sigjmp_buf[5]; +#define sigsetjmp(x,y) __builtin_setjmp(x) +#define siglongjmp __builtin_longjmp +#else /* !__MINGW64__ */ +#define sigjmp_buf jmp_buf +#define sigsetjmp(x,y) setjmp(x) +#define siglongjmp longjmp +#endif /* __MINGW64__ */ +#endif /* WIN32 */ + +/* /port compatibility functions */ +#include "port.h" + +/* IWYU pragma: end_exports */ + +#endif /* C_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/internal/fe-auth-sasl.h b/VCMP-LUA/modules/postgresql/include/postgresql/internal/fe-auth-sasl.h new file mode 100644 index 0000000..f06f547 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/internal/fe-auth-sasl.h @@ -0,0 +1,153 @@ +/*------------------------------------------------------------------------- + * + * fe-auth-sasl.h + * Defines the SASL mechanism interface for libpq. + * + * Each SASL mechanism defines a frontend and a backend callback structure. + * This is not part of the public API for applications. + * + * See src/include/libpq/sasl.h for the backend counterpart. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/interfaces/libpq/fe-auth-sasl.h + * + *------------------------------------------------------------------------- + */ + +#ifndef FE_AUTH_SASL_H +#define FE_AUTH_SASL_H + +#include "libpq-fe.h" + +/* + * Possible states for the SASL exchange, see the comment on exchange for an + * explanation of these. + */ +typedef enum +{ + SASL_COMPLETE = 0, + SASL_FAILED, + SASL_CONTINUE, + SASL_ASYNC, +} SASLStatus; + +/* + * Frontend SASL mechanism callbacks. + * + * To implement a frontend mechanism, declare a pg_fe_sasl_mech struct with + * appropriate callback implementations, then hook it into conn->sasl during + * pg_SASL_init()'s mechanism negotiation. + */ +typedef struct pg_fe_sasl_mech +{ + /*------- + * init() + * + * Initializes mechanism-specific state for a connection. This + * callback must return a pointer to its allocated state, which will + * be passed as-is as the first argument to the other callbacks. + * the free() callback is called to release any state resources. + * + * If state allocation fails, the implementation should return NULL to + * fail the authentication exchange. + * + * Input parameters: + * + * conn: The connection to the server + * + * password: The user's supplied password for the current connection + * + * mech: The mechanism name in use, for implementations that may + * advertise more than one name (such as *-PLUS variants). + *------- + */ + void *(*init) (PGconn *conn, const char *password, const char *mech); + + /*-------- + * exchange() + * + * Produces a client response to a server challenge. As a special case + * for client-first SASL mechanisms, exchange() is called with a NULL + * server response once at the start of the authentication exchange to + * generate an initial response. Returns a SASLStatus indicating the + * state and status of the exchange. + * + * Input parameters: + * + * state: The opaque mechanism state returned by init() + * + * final: true if the server has sent a final exchange outcome + * + * input: The challenge data sent by the server, or NULL when + * generating a client-first initial response (that is, when + * the server expects the client to send a message to start + * the exchange). This is guaranteed to be null-terminated + * for safety, but SASL allows embedded nulls in challenges, + * so mechanisms must be careful to check inputlen. + * + * inputlen: The length of the challenge data sent by the server, or -1 + * during client-first initial response generation. + * + * Output parameters, to be set by the callback function: + * + * output: A malloc'd buffer containing the client's response to + * the server (can be empty), or NULL if the exchange should + * be aborted. (The callback should return SASL_FAILED in the + * latter case.) + * + * outputlen: The length (0 or higher) of the client response buffer, + * ignored if output is NULL. + * + * Return value: + * + * SASL_CONTINUE: The output buffer is filled with a client response. + * Additional server challenge is expected + * SASL_ASYNC: Some asynchronous processing external to the + * connection needs to be done before a response can be + * generated. The mechanism is responsible for setting up + * conn->async_auth/cleanup_async_auth appropriately + * before returning. + * SASL_COMPLETE: The SASL exchange has completed successfully. + * SASL_FAILED: The exchange has failed and the connection should be + * dropped. + *-------- + */ + SASLStatus (*exchange) (void *state, bool final, + char *input, int inputlen, + char **output, int *outputlen); + + /*-------- + * channel_bound() + * + * Returns true if the connection has an established channel binding. A + * mechanism implementation must ensure that a SASL exchange has actually + * been completed, in addition to checking that channel binding is in use. + * + * Mechanisms that do not implement channel binding may simply return + * false. + * + * Input parameters: + * + * state: The opaque mechanism state returned by init() + *-------- + */ + bool (*channel_bound) (void *state); + + /*-------- + * free() + * + * Frees the state allocated by init(). This is called when the connection + * is dropped, not when the exchange is completed. + * + * Input parameters: + * + * state: The opaque mechanism state returned by init() + *-------- + */ + void (*free) (void *state); + +} pg_fe_sasl_mech; + +#endif /* FE_AUTH_SASL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/internal/libpq-int.h b/VCMP-LUA/modules/postgresql/include/postgresql/internal/libpq-int.h new file mode 100644 index 0000000..decc091 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/internal/libpq-int.h @@ -0,0 +1,974 @@ +/*------------------------------------------------------------------------- + * + * libpq-int.h + * This file contains internal definitions meant to be used only by + * the frontend libpq library, not by applications that call it. + * + * An application can include this file if it wants to bypass the + * official API defined by libpq-fe.h, but code that does so is much + * more likely to break across PostgreSQL releases than code that uses + * only the official API. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/interfaces/libpq/libpq-int.h + * + *------------------------------------------------------------------------- + */ + +#ifndef LIBPQ_INT_H +#define LIBPQ_INT_H + +/* We assume libpq-fe.h has already been included. */ +#include "libpq-events.h" + +#include +#include +#include +/* MinGW has sys/time.h, but MSVC doesn't */ +#ifndef _MSC_VER +#include +#endif + +#ifdef WIN32 +#include "pthread-win32.h" +#else +#include +#endif +#include + +/* include stuff common to fe and be */ +#include "libpq/pqcomm.h" +/* include stuff found in fe only */ +#include "fe-auth-sasl.h" +#include "pqexpbuffer.h" + +#include "libpq/pg-gssapi.h" + +#ifdef ENABLE_SSPI +#define SECURITY_WIN32 +#if defined(WIN32) && !defined(_MSC_VER) +#include +#endif +#include +#undef SECURITY_WIN32 + +#ifndef ENABLE_GSS +/* + * Define a fake structure compatible with GSSAPI on Unix. + */ +typedef struct +{ + void *value; + int length; +} gss_buffer_desc; +#endif +#endif /* ENABLE_SSPI */ + +#ifdef USE_OPENSSL +#include +#include + +#ifndef OPENSSL_NO_ENGINE +#define USE_SSL_ENGINE +#endif +#endif /* USE_OPENSSL */ + +#include "common/pg_prng.h" + +/* + * POSTGRES backend dependent Constants. + */ +#define CMDSTATUS_LEN 64 /* should match COMPLETION_TAG_BUFSIZE */ + +/* + * PGresult and the subsidiary types PGresAttDesc, PGresAttValue + * represent the result of a query (or more precisely, of a single SQL + * command --- a query string given to PQexec can contain multiple commands). + * Note we assume that a single command can return at most one tuple group, + * hence there is no need for multiple descriptor sets. + */ + +/* Subsidiary-storage management structure for PGresult. + * See space management routines in fe-exec.c for details. + * Note that space[k] refers to the k'th byte starting from the physical + * head of the block --- it's a union, not a struct! + */ +typedef union pgresult_data PGresult_data; + +union pgresult_data +{ + PGresult_data *next; /* link to next block, or NULL */ + char space[1]; /* dummy for accessing block as bytes */ +}; + +/* Data about a single parameter of a prepared statement */ +typedef struct pgresParamDesc +{ + Oid typid; /* type id */ +} PGresParamDesc; + +/* + * Data for a single attribute of a single tuple + * + * We use char* for Attribute values. + * + * The value pointer always points to a null-terminated area; we add a + * null (zero) byte after whatever the backend sends us. This is only + * particularly useful for text values ... with a binary value, the + * value might have embedded nulls, so the application can't use C string + * operators on it. But we add a null anyway for consistency. + * Note that the value itself does not contain a length word. + * + * A NULL attribute is a special case in two ways: its len field is NULL_LEN + * and its value field points to null_field in the owning PGresult. All the + * NULL attributes in a query result point to the same place (there's no need + * to store a null string separately for each one). + */ + +#define NULL_LEN (-1) /* pg_result len for NULL value */ + +typedef struct pgresAttValue +{ + int len; /* length in bytes of the value */ + char *value; /* actual value, plus terminating zero byte */ +} PGresAttValue; + +/* Typedef for message-field list entries */ +typedef struct pgMessageField +{ + struct pgMessageField *next; /* list link */ + char code; /* field code */ + char contents[FLEXIBLE_ARRAY_MEMBER]; /* value, nul-terminated */ +} PGMessageField; + +/* Fields needed for notice handling */ +typedef struct +{ + PQnoticeReceiver noticeRec; /* notice message receiver */ + void *noticeRecArg; + PQnoticeProcessor noticeProc; /* notice message processor */ + void *noticeProcArg; +} PGNoticeHooks; + +typedef struct PGEvent +{ + PGEventProc proc; /* the function to call on events */ + char *name; /* used only for error messages */ + void *passThrough; /* pointer supplied at registration time */ + void *data; /* optional state (instance) data */ + bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */ +} PGEvent; + +struct pg_result +{ + int ntups; + int numAttributes; + PGresAttDesc *attDescs; + PGresAttValue **tuples; /* each PGresult tuple is an array of + * PGresAttValue's */ + int tupArrSize; /* allocated size of tuples array */ + int numParameters; + PGresParamDesc *paramDescs; + ExecStatusType resultStatus; + char cmdStatus[CMDSTATUS_LEN]; /* cmd status from the query */ + int binary; /* binary tuple values if binary == 1, + * otherwise text */ + + /* + * These fields are copied from the originating PGconn, so that operations + * on the PGresult don't have to reference the PGconn. + */ + PGNoticeHooks noticeHooks; + PGEvent *events; + int nEvents; + int client_encoding; /* encoding id */ + + /* + * Error information (all NULL if not an error result). errMsg is the + * "overall" error message returned by PQresultErrorMessage. If we have + * per-field info then it is stored in a linked list. + */ + char *errMsg; /* error message, or NULL if no error */ + PGMessageField *errFields; /* message broken into fields */ + char *errQuery; /* text of triggering query, if available */ + + /* All NULL attributes in the query result point to this null string */ + char null_field[1]; + + /* + * Space management information. Note that attDescs and error stuff, if + * not null, point into allocated blocks. But tuples points to a + * separately malloc'd block, so that we can realloc it. + */ + PGresult_data *curBlock; /* most recently allocated block */ + int curOffset; /* start offset of free space in block */ + int spaceLeft; /* number of free bytes remaining in block */ + + size_t memorySize; /* total space allocated for this PGresult */ +}; + +/* PGAsyncStatusType defines the state of the query-execution state machine */ +typedef enum +{ + PGASYNC_IDLE, /* nothing's happening, dude */ + PGASYNC_BUSY, /* query in progress */ + PGASYNC_READY, /* query done, waiting for client to fetch + * result */ + PGASYNC_READY_MORE, /* query done, waiting for client to fetch + * result, more results expected from this + * query */ + PGASYNC_COPY_IN, /* Copy In data transfer in progress */ + PGASYNC_COPY_OUT, /* Copy Out data transfer in progress */ + PGASYNC_COPY_BOTH, /* Copy In/Out data transfer in progress */ + PGASYNC_PIPELINE_IDLE, /* "Idle" between commands in pipeline mode */ +} PGAsyncStatusType; + +/* Bitmasks for allowed_enc_methods and failed_enc_methods */ +#define ENC_ERROR 0 +#define ENC_PLAINTEXT 0x01 +#define ENC_GSSAPI 0x02 +#define ENC_SSL 0x04 + +/* Target server type (decoded value of target_session_attrs) */ +typedef enum +{ + SERVER_TYPE_ANY = 0, /* Any server (default) */ + SERVER_TYPE_READ_WRITE, /* Read-write server */ + SERVER_TYPE_READ_ONLY, /* Read-only server */ + SERVER_TYPE_PRIMARY, /* Primary server */ + SERVER_TYPE_STANDBY, /* Standby server */ + SERVER_TYPE_PREFER_STANDBY, /* Prefer standby server */ + SERVER_TYPE_PREFER_STANDBY_PASS2 /* second pass - behaves same as ANY */ +} PGTargetServerType; + +/* Target server type (decoded value of load_balance_hosts) */ +typedef enum +{ + LOAD_BALANCE_DISABLE = 0, /* Use the existing host order (default) */ + LOAD_BALANCE_RANDOM, /* Randomly shuffle the hosts */ +} PGLoadBalanceType; + +/* Boolean value plus a not-known state, for GUCs we might have to fetch */ +typedef enum +{ + PG_BOOL_UNKNOWN = 0, /* Currently unknown */ + PG_BOOL_YES, /* Yes (true) */ + PG_BOOL_NO /* No (false) */ +} PGTernaryBool; + +/* Typedef for the EnvironmentOptions[] array */ +typedef struct PQEnvironmentOption +{ + const char *envName, /* name of an environment variable */ + *pgName; /* name of corresponding SET variable */ +} PQEnvironmentOption; + +/* Typedef for parameter-status list entries */ +typedef struct pgParameterStatus +{ + struct pgParameterStatus *next; /* list link */ + char *name; /* parameter name */ + char *value; /* parameter value */ + /* Note: name and value are stored in same malloc block as struct is */ +} pgParameterStatus; + +/* large-object-access data ... allocated only if large-object code is used. */ +typedef struct pgLobjfuncs +{ + Oid fn_lo_open; /* OID of backend function lo_open */ + Oid fn_lo_close; /* OID of backend function lo_close */ + Oid fn_lo_creat; /* OID of backend function lo_creat */ + Oid fn_lo_create; /* OID of backend function lo_create */ + Oid fn_lo_unlink; /* OID of backend function lo_unlink */ + Oid fn_lo_lseek; /* OID of backend function lo_lseek */ + Oid fn_lo_lseek64; /* OID of backend function lo_lseek64 */ + Oid fn_lo_tell; /* OID of backend function lo_tell */ + Oid fn_lo_tell64; /* OID of backend function lo_tell64 */ + Oid fn_lo_truncate; /* OID of backend function lo_truncate */ + Oid fn_lo_truncate64; /* OID of function lo_truncate64 */ + Oid fn_lo_read; /* OID of backend function LOread */ + Oid fn_lo_write; /* OID of backend function LOwrite */ +} PGlobjfuncs; + +/* PGdataValue represents a data field value being passed to a row processor. + * It could be either text or binary data; text data is not zero-terminated. + * A SQL NULL is represented by len < 0; then value is still valid but there + * are no data bytes there. + */ +typedef struct pgDataValue +{ + int len; /* data length in bytes, or <0 if NULL */ + const char *value; /* data value, without zero-termination */ +} PGdataValue; + +/* Host address type enum for struct pg_conn_host */ +typedef enum pg_conn_host_type +{ + CHT_HOST_NAME, + CHT_HOST_ADDRESS, + CHT_UNIX_SOCKET +} pg_conn_host_type; + +/* + * PGQueryClass tracks which query protocol is in use for each command queue + * entry, or special operation in execution + */ +typedef enum +{ + PGQUERY_SIMPLE, /* simple Query protocol (PQexec) */ + PGQUERY_EXTENDED, /* full Extended protocol (PQexecParams) */ + PGQUERY_PREPARE, /* Parse only (PQprepare) */ + PGQUERY_DESCRIBE, /* Describe Statement or Portal */ + PGQUERY_SYNC, /* Sync (at end of a pipeline) */ + PGQUERY_CLOSE /* Close Statement or Portal */ +} PGQueryClass; + + +/* + * valid values for pg_conn->current_auth_response. These are just for + * libpq internal use: since authentication response types all use the + * protocol byte 'p', fe-trace.c needs a way to distinguish them in order + * to print them correctly. + */ +#define AUTH_RESPONSE_GSS 'G' +#define AUTH_RESPONSE_PASSWORD 'P' +#define AUTH_RESPONSE_SASL_INITIAL 'I' +#define AUTH_RESPONSE_SASL 'S' + +/* + * An entry in the pending command queue. + */ +typedef struct PGcmdQueueEntry +{ + PGQueryClass queryclass; /* Query type */ + char *query; /* SQL command, or NULL if none/unknown/OOM */ + struct PGcmdQueueEntry *next; /* list link */ +} PGcmdQueueEntry; + +/* + * pg_conn_host stores all information about each of possibly several hosts + * mentioned in the connection string. Most fields are derived by splitting + * the relevant connection parameter (e.g., pghost) at commas. + */ +typedef struct pg_conn_host +{ + pg_conn_host_type type; /* type of host address */ + char *host; /* host name or socket path */ + char *hostaddr; /* host numeric IP address */ + char *port; /* port number (if NULL or empty, use + * DEF_PGPORT[_STR]) */ + char *password; /* password for this host, read from the + * password file; NULL if not sought or not + * found in password file. */ +} pg_conn_host; + +/* + * PGconn stores all the state data associated with a single connection + * to a backend. + */ +struct pg_conn +{ + /* Saved values of connection options */ + char *pghost; /* the machine on which the server is running, + * or a path to a UNIX-domain socket, or a + * comma-separated list of machines and/or + * paths; if NULL, use DEFAULT_PGSOCKET_DIR */ + char *pghostaddr; /* the numeric IP address of the machine on + * which the server is running, or a + * comma-separated list of same. Takes + * precedence over pghost. */ + char *pgport; /* the server's communication port number, or + * a comma-separated list of ports */ + char *connect_timeout; /* connection timeout (numeric string) */ + char *pgtcp_user_timeout; /* tcp user timeout (numeric string) */ + char *client_encoding_initial; /* encoding to use */ + char *pgoptions; /* options to start the backend with */ + char *appname; /* application name */ + char *fbappname; /* fallback application name */ + char *dbName; /* database name */ + char *replication; /* connect as the replication standby? */ + char *pgservice; /* Postgres service, if any */ + char *pguser; /* Postgres username and password, if any */ + char *pgpass; + char *pgpassfile; /* path to a file containing password(s) */ + char *channel_binding; /* channel binding mode + * (require,prefer,disable) */ + char *keepalives; /* use TCP keepalives? */ + char *keepalives_idle; /* time between TCP keepalives */ + char *keepalives_interval; /* time between TCP keepalive + * retransmits */ + char *keepalives_count; /* maximum number of TCP keepalive + * retransmits */ + char *sslmode; /* SSL mode (require,prefer,allow,disable) */ + char *sslnegotiation; /* SSL initiation style (postgres,direct) */ + char *sslcompression; /* SSL compression (0 or 1) */ + char *sslkey; /* client key filename */ + char *sslcert; /* client certificate filename */ + char *sslpassword; /* client key file password */ + char *sslcertmode; /* client cert mode (require,allow,disable) */ + char *sslrootcert; /* root certificate filename */ + char *sslcrl; /* certificate revocation list filename */ + char *sslcrldir; /* certificate revocation list directory name */ + char *sslsni; /* use SSL SNI extension (0 or 1) */ + char *requirepeer; /* required peer credentials for local sockets */ + char *gssencmode; /* GSS mode (require,prefer,disable) */ + char *krbsrvname; /* Kerberos service name */ + char *gsslib; /* What GSS library to use ("gssapi" or + * "sspi") */ + char *gssdelegation; /* Try to delegate GSS credentials? (0 or 1) */ + char *min_protocol_version; /* minimum used protocol version */ + char *max_protocol_version; /* maximum used protocol version */ + char *ssl_min_protocol_version; /* minimum TLS protocol version */ + char *ssl_max_protocol_version; /* maximum TLS protocol version */ + char *target_session_attrs; /* desired session properties */ + char *require_auth; /* name of the expected auth method */ + char *load_balance_hosts; /* load balance over hosts */ + char *scram_client_key; /* base64-encoded SCRAM client key */ + char *scram_server_key; /* base64-encoded SCRAM server key */ + char *sslkeylogfile; /* where should the client write ssl keylogs */ + + bool cancelRequest; /* true if this connection is used to send a + * cancel request, instead of being a normal + * connection that's used for queries */ + + /* OAuth v2 */ + char *oauth_issuer; /* token issuer/URL */ + char *oauth_issuer_id; /* token issuer identifier */ + char *oauth_discovery_uri; /* URI of the issuer's discovery + * document */ + char *oauth_client_id; /* client identifier */ + char *oauth_client_secret; /* client secret */ + char *oauth_scope; /* access token scope */ + char *oauth_token; /* access token */ + bool oauth_want_retry; /* should we retry on failure? */ + + /* Optional file to write trace info to */ + FILE *Pfdebug; + int traceFlags; + + /* Callback procedures for notice message processing */ + PGNoticeHooks noticeHooks; + + /* Event procs registered via PQregisterEventProc */ + PGEvent *events; /* expandable array of event data */ + int nEvents; /* number of active events */ + int eventArraySize; /* allocated array size */ + + /* Status indicators */ + ConnStatusType status; + PGAsyncStatusType asyncStatus; + PGTransactionStatusType xactStatus; /* never changes to ACTIVE */ + char last_sqlstate[6]; /* last reported SQLSTATE */ + bool options_valid; /* true if OK to attempt connection */ + bool nonblocking; /* whether this connection is using nonblock + * sending semantics */ + PGpipelineStatus pipelineStatus; /* status of pipeline mode */ + bool partialResMode; /* true if single-row or chunked mode */ + bool singleRowMode; /* return current query result row-by-row? */ + int maxChunkSize; /* return query result in chunks not exceeding + * this number of rows */ + char copy_is_binary; /* 1 = copy binary, 0 = copy text */ + int copy_already_done; /* # bytes already returned in COPY OUT */ + PGnotify *notifyHead; /* oldest unreported Notify msg */ + PGnotify *notifyTail; /* newest unreported Notify msg */ + + /* Support for multiple hosts in connection string */ + int nconnhost; /* # of hosts named in conn string */ + int whichhost; /* host we're currently trying/connected to */ + pg_conn_host *connhost; /* details about each named host */ + char *connip; /* IP address for current network connection */ + + /* + * The pending command queue as a singly-linked list. Head is the command + * currently in execution, tail is where new commands are added. + */ + PGcmdQueueEntry *cmd_queue_head; + PGcmdQueueEntry *cmd_queue_tail; + + /* + * To save malloc traffic, we don't free entries right away; instead we + * save them in this list for possible reuse. + */ + PGcmdQueueEntry *cmd_queue_recycle; + + /* Connection data */ + pgsocket sock; /* FD for socket, PGINVALID_SOCKET if + * unconnected */ + SockAddr laddr; /* Local address */ + SockAddr raddr; /* Remote address */ + ProtocolVersion pversion; /* FE/BE protocol version in use */ + int sversion; /* server version, e.g. 70401 for 7.4.1 */ + bool pversion_negotiated; /* true if NegotiateProtocolVersion + * was received */ + bool auth_req_received; /* true if any type of auth req received */ + bool password_needed; /* true if server demanded a password */ + bool gssapi_used; /* true if authenticated via gssapi */ + bool sigpipe_so; /* have we masked SIGPIPE via SO_NOSIGPIPE? */ + bool sigpipe_flag; /* can we mask SIGPIPE via MSG_NOSIGNAL? */ + bool write_failed; /* have we had a write failure on sock? */ + char *write_err_msg; /* write error message, or NULL if OOM */ + + bool auth_required; /* require an authentication challenge from + * the server? */ + uint32 allowed_auth_methods; /* bitmask of acceptable AuthRequest + * codes */ + const pg_fe_sasl_mech *allowed_sasl_mechs[2]; /* and acceptable SASL + * mechanisms */ + bool client_finished_auth; /* have we finished our half of the + * authentication exchange? */ + char current_auth_response; /* used by pqTraceOutputMessage to + * know which auth response we're + * sending */ + + /* Callbacks for external async authentication */ + PostgresPollingStatusType (*async_auth) (PGconn *conn); + void (*cleanup_async_auth) (PGconn *conn); + pgsocket altsock; /* alternative socket for client to poll */ + + + /* Transient state needed while establishing connection */ + PGTargetServerType target_server_type; /* desired session properties */ + PGLoadBalanceType load_balance_type; /* desired load balancing + * algorithm */ + bool try_next_addr; /* time to advance to next address/host? */ + bool try_next_host; /* time to advance to next connhost[]? */ + int naddr; /* number of addresses returned by getaddrinfo */ + int whichaddr; /* the address currently being tried */ + AddrInfo *addr; /* the array of addresses for the currently + * tried host */ + bool send_appname; /* okay to send application_name? */ + size_t scram_client_key_len; + uint8 *scram_client_key_binary; /* binary SCRAM client key */ + size_t scram_server_key_len; + uint8 *scram_server_key_binary; /* binary SCRAM server key */ + ProtocolVersion min_pversion; /* protocol version to request */ + ProtocolVersion max_pversion; /* protocol version to request */ + + /* Miscellaneous stuff */ + int be_pid; /* PID of backend --- needed for cancels */ + int be_cancel_key_len; + uint8 *be_cancel_key; /* query cancellation key */ + pgParameterStatus *pstatus; /* ParameterStatus data */ + int client_encoding; /* encoding id */ + bool std_strings; /* standard_conforming_strings */ + PGTernaryBool default_transaction_read_only; /* default_transaction_read_only */ + PGTernaryBool in_hot_standby; /* in_hot_standby */ + PGVerbosity verbosity; /* error/notice message verbosity */ + PGContextVisibility show_context; /* whether to show CONTEXT field */ + PGlobjfuncs *lobjfuncs; /* private state for large-object access fns */ + pg_prng_state prng_state; /* prng state for load balancing connections */ + + + /* + * Buffer for data received from backend and not yet processed. + * + * NB: We rely on a maximum inBufSize/outBufSize of INT_MAX (and therefore + * an INT_MAX upper bound on the size of any and all packet contents) to + * avoid overflow; for example in reportErrorPosition(). Changing the type + * would require not only an adjustment to the overflow protection in + * pqCheck{In,Out}BufferSpace(), but also a careful audit of all libpq + * code that uses ints during size calculations. + */ + char *inBuffer; /* currently allocated buffer */ + int inBufSize; /* allocated size of buffer */ + int inStart; /* offset to first unconsumed data in buffer */ + int inCursor; /* next byte to tentatively consume */ + int inEnd; /* offset to first position after avail data */ + + /* Buffer for data not yet sent to backend */ + char *outBuffer; /* currently allocated buffer */ + int outBufSize; /* allocated size of buffer */ + int outCount; /* number of chars waiting in buffer */ + + /* State for constructing messages in outBuffer */ + int outMsgStart; /* offset to msg start (length word); if -1, + * msg has no length word */ + int outMsgEnd; /* offset to msg end (so far) */ + + /* Row processor interface workspace */ + PGdataValue *rowBuf; /* array for passing values to rowProcessor */ + int rowBufLen; /* number of entries allocated in rowBuf */ + + /* + * Status for asynchronous result construction. If result isn't NULL, it + * is a result being constructed or ready to return. If result is NULL + * and error_result is true, then we need to return a PGRES_FATAL_ERROR + * result, but haven't yet constructed it; text for the error has been + * appended to conn->errorMessage. (Delaying construction simplifies + * dealing with out-of-memory cases.) If saved_result isn't NULL, it is a + * PGresult that will replace "result" after we return that one; we use + * that in partial-result mode to remember the query's tuple metadata. + */ + PGresult *result; /* result being constructed */ + bool error_result; /* do we need to make an ERROR result? */ + PGresult *saved_result; /* original, empty result in partialResMode */ + + /* Assorted state for SASL, SSL, GSS, etc */ + const pg_fe_sasl_mech *sasl; + void *sasl_state; + int scram_sha_256_iterations; + + uint8 allowed_enc_methods; + uint8 failed_enc_methods; + uint8 current_enc_method; + + /* SSL structures */ + bool ssl_in_use; + bool ssl_handshake_started; + bool ssl_cert_requested; /* Did the server ask us for a cert? */ + bool ssl_cert_sent; /* Did we send one in reply? */ + bool last_read_was_eof; + +#ifdef USE_SSL +#ifdef USE_OPENSSL + SSL *ssl; /* SSL status, if have SSL connection */ + X509 *peer; /* X509 cert of server */ +#ifdef USE_SSL_ENGINE + ENGINE *engine; /* SSL engine, if any */ +#else + void *engine; /* dummy field to keep struct the same if + * OpenSSL version changes */ +#endif +#endif /* USE_OPENSSL */ +#endif /* USE_SSL */ + +#ifdef ENABLE_GSS + gss_ctx_id_t gctx; /* GSS context */ + gss_name_t gtarg_nam; /* GSS target name */ + + /* The following are encryption-only */ + bool gssenc; /* GSS encryption is usable */ + gss_cred_id_t gcred; /* GSS credential temp storage. */ + + /* GSS encryption I/O state --- see fe-secure-gssapi.c */ + char *gss_SendBuffer; /* Encrypted data waiting to be sent */ + int gss_SendLength; /* End of data available in gss_SendBuffer */ + int gss_SendNext; /* Next index to send a byte from + * gss_SendBuffer */ + int gss_SendConsumed; /* Number of source bytes encrypted but + * not yet reported as sent */ + char *gss_RecvBuffer; /* Received, encrypted data */ + int gss_RecvLength; /* End of data available in gss_RecvBuffer */ + char *gss_ResultBuffer; /* Decryption of data in gss_RecvBuffer */ + int gss_ResultLength; /* End of data available in + * gss_ResultBuffer */ + int gss_ResultNext; /* Next index to read a byte from + * gss_ResultBuffer */ + uint32 gss_MaxPktSize; /* Maximum size we can encrypt and fit the + * results into our output buffer */ +#endif + +#ifdef ENABLE_SSPI + CredHandle *sspicred; /* SSPI credentials handle */ + CtxtHandle *sspictx; /* SSPI context */ + char *sspitarget; /* SSPI target name */ + int usesspi; /* Indicate if SSPI is in use on the + * connection */ +#endif + + /* + * Buffer for current error message. This is cleared at the start of any + * connection attempt or query cycle; after that, all code should append + * messages to it, never overwrite. + * + * In some situations we might report an error more than once in a query + * cycle. If so, errorMessage accumulates text from all the errors, and + * errorReported tracks how much we've already reported, so that the + * individual error PGresult objects don't contain duplicative text. + */ + PQExpBufferData errorMessage; /* expansible string */ + int errorReported; /* # bytes of string already reported */ + + /* Buffer for receiving various parts of messages */ + PQExpBufferData workBuffer; /* expansible string */ +}; + + +/* String descriptions of the ExecStatusTypes. + * direct use of this array is deprecated; call PQresStatus() instead. + */ +extern char *const pgresStatus[]; + + +#ifdef USE_SSL + +#ifndef WIN32 +#define USER_CERT_FILE ".postgresql/postgresql.crt" +#define USER_KEY_FILE ".postgresql/postgresql.key" +#define ROOT_CERT_FILE ".postgresql/root.crt" +#define ROOT_CRL_FILE ".postgresql/root.crl" +#else +/* On Windows, the "home" directory is already PostgreSQL-specific */ +#define USER_CERT_FILE "postgresql.crt" +#define USER_KEY_FILE "postgresql.key" +#define ROOT_CERT_FILE "root.crt" +#define ROOT_CRL_FILE "root.crl" +#endif + +#endif /* USE_SSL */ + +/* ---------------- + * Internal functions of libpq + * Functions declared here need to be visible across files of libpq, + * but are not intended to be called by applications. We use the + * convention "pqXXX" for internal functions, vs. the "PQxxx" names + * used for application-visible routines. + * ---------------- + */ + +/* === in fe-connect.c === */ + +extern void pqDropConnection(PGconn *conn, bool flushInput); +extern bool pqConnectOptions2(PGconn *conn); +#if defined(WIN32) && defined(SIO_KEEPALIVE_VALS) +extern int pqSetKeepalivesWin32(pgsocket sock, int idle, int interval); +#endif +extern int pqConnectDBStart(PGconn *conn); +extern int pqConnectDBComplete(PGconn *conn); +extern PGconn *pqMakeEmptyPGconn(void); +extern void pqReleaseConnHosts(PGconn *conn); +extern void pqClosePGconn(PGconn *conn); +extern int pqPacketSend(PGconn *conn, char pack_type, + const void *buf, size_t buf_len); +extern bool pqGetHomeDirectory(char *buf, int bufsize); +extern bool pqCopyPGconn(PGconn *srcConn, PGconn *dstConn); +extern bool pqParseIntParam(const char *value, int *result, PGconn *conn, + const char *context); + +extern pgthreadlock_t pg_g_threadlock; + +#define pglock_thread() pg_g_threadlock(true) +#define pgunlock_thread() pg_g_threadlock(false) + +/* === in fe-exec.c === */ + +extern void pqSetResultError(PGresult *res, PQExpBuffer errorMessage, int offset); +extern void *pqResultAlloc(PGresult *res, size_t nBytes, bool isBinary); +extern char *pqResultStrdup(PGresult *res, const char *str); +extern void pqClearAsyncResult(PGconn *conn); +extern void pqSaveErrorResult(PGconn *conn); +extern PGresult *pqPrepareAsyncResult(PGconn *conn); +extern void pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...) pg_attribute_printf(2, 3); +extern void pqSaveMessageField(PGresult *res, char code, + const char *value); +extern int pqSaveParameterStatus(PGconn *conn, const char *name, + const char *value); +extern int pqRowProcessor(PGconn *conn, const char **errmsgp); +extern void pqCommandQueueAdvance(PGconn *conn, bool isReadyForQuery, + bool gotSync); +extern int PQsendQueryContinue(PGconn *conn, const char *query); + +/* === in fe-protocol3.c === */ + +extern char *pqBuildStartupPacket3(PGconn *conn, int *packetlen, + const PQEnvironmentOption *options); +extern void pqParseInput3(PGconn *conn); +extern int pqGetErrorNotice3(PGconn *conn, bool isError); +extern void pqBuildErrorMessage3(PQExpBuffer msg, const PGresult *res, + PGVerbosity verbosity, PGContextVisibility show_context); +extern int pqGetNegotiateProtocolVersion3(PGconn *conn); +extern int pqGetCopyData3(PGconn *conn, char **buffer, int async); +extern int pqGetline3(PGconn *conn, char *s, int maxlen); +extern int pqGetlineAsync3(PGconn *conn, char *buffer, int bufsize); +extern int pqEndcopy3(PGconn *conn); +extern PGresult *pqFunctionCall3(PGconn *conn, Oid fnid, + int *result_buf, int *actual_result_len, + int result_is_int, + const PQArgBlock *args, int nargs); + +/* === in fe-cancel.c === */ + +extern int PQsendCancelRequest(PGconn *cancelConn); + +/* === in fe-misc.c === */ + + /* + * "Get" and "Put" routines return 0 if successful, EOF if not. Note that for + * Get, EOF merely means the buffer is exhausted, not that there is + * necessarily any error. + */ +extern int pqCheckOutBufferSpace(size_t bytes_needed, PGconn *conn); +extern int pqCheckInBufferSpace(size_t bytes_needed, PGconn *conn); +extern void pqParseDone(PGconn *conn, int newInStart); +extern int pqGetc(char *result, PGconn *conn); +extern int pqPutc(char c, PGconn *conn); +extern int pqGets(PQExpBuffer buf, PGconn *conn); +extern int pqGets_append(PQExpBuffer buf, PGconn *conn); +extern int pqPuts(const char *s, PGconn *conn); +extern int pqGetnchar(void *s, size_t len, PGconn *conn); +extern int pqSkipnchar(size_t len, PGconn *conn); +extern int pqPutnchar(const void *s, size_t len, PGconn *conn); +extern int pqGetInt(int *result, size_t bytes, PGconn *conn); +extern int pqPutInt(int value, size_t bytes, PGconn *conn); +extern int pqPutMsgStart(char msg_type, PGconn *conn); +extern int pqPutMsgEnd(PGconn *conn); +extern int pqReadData(PGconn *conn); +extern int pqFlush(PGconn *conn); +extern int pqWait(int forRead, int forWrite, PGconn *conn); +extern int pqWaitTimed(int forRead, int forWrite, PGconn *conn, + pg_usec_time_t end_time); +extern int pqReadReady(PGconn *conn); +extern int pqWriteReady(PGconn *conn); + +/* === in fe-secure.c === */ + +extern PostgresPollingStatusType pqsecure_open_client(PGconn *); +extern void pqsecure_close(PGconn *); +extern ssize_t pqsecure_read(PGconn *, void *ptr, size_t len); +extern ssize_t pqsecure_write(PGconn *, const void *ptr, size_t len); +extern ssize_t pqsecure_raw_read(PGconn *, void *ptr, size_t len); +extern ssize_t pqsecure_raw_write(PGconn *, const void *ptr, size_t len); + +#if !defined(WIN32) +extern int pq_block_sigpipe(sigset_t *osigset, bool *sigpipe_pending); +extern void pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending, + bool got_epipe); +#endif + +/* === SSL === */ + +/* + * The SSL implementation provides these functions. + */ + +/* + * Begin or continue negotiating a secure session. + */ +extern PostgresPollingStatusType pgtls_open_client(PGconn *conn); + +/* + * Close SSL connection. + */ +extern void pgtls_close(PGconn *conn); + +/* + * Read data from a secure connection. + * + * On failure, this function is responsible for appending a suitable message + * to conn->errorMessage. The caller must still inspect errno, but only + * to determine whether to continue/retry after error. + */ +extern ssize_t pgtls_read(PGconn *conn, void *ptr, size_t len); + +/* + * Is there unread data waiting in the SSL read buffer? + */ +extern bool pgtls_read_pending(PGconn *conn); + +/* + * Write data to a secure connection. + * + * On failure, this function is responsible for appending a suitable message + * to conn->errorMessage. The caller must still inspect errno, but only + * to determine whether to continue/retry after error. + */ +extern ssize_t pgtls_write(PGconn *conn, const void *ptr, size_t len); + +/* + * Get the hash of the server certificate, for SCRAM channel binding type + * tls-server-end-point. + * + * NULL is sent back to the caller in the event of an error, with an + * error message for the caller to consume. + */ +extern char *pgtls_get_peer_certificate_hash(PGconn *conn, size_t *len); + +/* + * Verify that the server certificate matches the host name we connected to. + * + * The certificate's Common Name and Subject Alternative Names are considered. + * + * Returns 1 if the name matches, and 0 if it does not. On error, returns + * -1, and sets the libpq error message. + * + */ +extern int pgtls_verify_peer_name_matches_certificate_guts(PGconn *conn, + int *names_examined, + char **first_name); + +/* === GSSAPI === */ + +#ifdef ENABLE_GSS + +/* + * Establish a GSSAPI-encrypted connection. + */ +extern PostgresPollingStatusType pqsecure_open_gss(PGconn *conn); + +/* + * Read and write functions for GSSAPI-encrypted connections, with internal + * buffering to handle nonblocking sockets. + */ +extern ssize_t pg_GSS_write(PGconn *conn, const void *ptr, size_t len); +extern ssize_t pg_GSS_read(PGconn *conn, void *ptr, size_t len); +#endif + +/* === in fe-trace.c === */ + +extern void pqTraceOutputMessage(PGconn *conn, const char *message, + bool toServer); +extern void pqTraceOutputNoTypeByteMessage(PGconn *conn, const char *message); +extern void pqTraceOutputCharResponse(PGconn *conn, const char *responseType, + char response); + +/* === miscellaneous macros === */ + +/* + * Reset the conn's error-reporting state. + */ +#define pqClearConnErrorState(conn) \ + (resetPQExpBuffer(&(conn)->errorMessage), \ + (conn)->errorReported = 0) + +/* + * Check whether we have a PGresult pending to be returned --- either a + * constructed one in conn->result, or a "virtual" error result that we + * don't intend to materialize until the end of the query cycle. + */ +#define pgHavePendingResult(conn) \ + ((conn)->result != NULL || (conn)->error_result) + +/* + * this is so that we can check if a connection is non-blocking internally + * without the overhead of a function call + */ +#define pqIsnonblocking(conn) ((conn)->nonblocking) + +/* + * Connection's outbuffer threshold, for pipeline mode. + */ +#define OUTBUFFER_THRESHOLD 65536 + +#ifdef ENABLE_NLS +extern char *libpq_gettext(const char *msgid) pg_attribute_format_arg(1); +extern char *libpq_ngettext(const char *msgid, const char *msgid_plural, unsigned long n) pg_attribute_format_arg(1) pg_attribute_format_arg(2); +#else +#define libpq_gettext(x) (x) +#define libpq_ngettext(s, p, n) ((n) == 1 ? (s) : (p)) +#endif +/* + * libpq code should use the above, not _(), since that would use the + * surrounding programs's message catalog. + */ +#undef _ + +extern void libpq_append_error(PQExpBuffer errorMessage, const char *fmt,...) pg_attribute_printf(2, 3); +extern void libpq_append_conn_error(PGconn *conn, const char *fmt,...) pg_attribute_printf(2, 3); + +/* + * These macros are needed to let error-handling code be portable between + * Unix and Windows. (ugh) + */ +#ifdef WIN32 +#define SOCK_ERRNO (WSAGetLastError()) +#define SOCK_STRERROR winsock_strerror +#define SOCK_ERRNO_SET(e) WSASetLastError(e) +#else +#define SOCK_ERRNO errno +#define SOCK_STRERROR strerror_r +#define SOCK_ERRNO_SET(e) (errno = (e)) +#endif + +#endif /* LIBPQ_INT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/internal/libpq/pqcomm.h b/VCMP-LUA/modules/postgresql/include/postgresql/internal/libpq/pqcomm.h new file mode 100644 index 0000000..f04ca13 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/internal/libpq/pqcomm.h @@ -0,0 +1,175 @@ +/*------------------------------------------------------------------------- + * + * pqcomm.h + * Definitions common to frontends and backends. + * + * NOTE: for historical reasons, this does not correspond to pqcomm.c. + * pqcomm.c's routines are declared in libpq.h. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pqcomm.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQCOMM_H +#define PQCOMM_H + +#include +#include +#include +#include + +/* + * The definitions for the request/response codes are kept in a separate file + * for ease of use in third party programs. + */ +#include "libpq/protocol.h" + +typedef struct +{ + struct sockaddr_storage addr; + socklen_t salen; +} SockAddr; + +typedef struct +{ + int family; + SockAddr addr; +} AddrInfo; + +/* Configure the UNIX socket location for the well known port. */ + +#define UNIXSOCK_PATH(path, port, sockdir) \ + (AssertMacro(sockdir), \ + AssertMacro(*(sockdir) != '\0'), \ + snprintf(path, sizeof(path), "%s/.s.PGSQL.%d", \ + (sockdir), (port))) + +/* + * The maximum workable length of a socket path is what will fit into + * struct sockaddr_un. This is usually only 100 or so bytes :-(. + * + * For consistency, always pass a MAXPGPATH-sized buffer to UNIXSOCK_PATH(), + * then complain if the resulting string is >= UNIXSOCK_PATH_BUFLEN bytes. + * (Because the standard API for getaddrinfo doesn't allow it to complain in + * a useful way when the socket pathname is too long, we have to test for + * this explicitly, instead of just letting the subroutine return an error.) + */ +#define UNIXSOCK_PATH_BUFLEN sizeof(((struct sockaddr_un *) NULL)->sun_path) + +/* + * A host that looks either like an absolute path or starts with @ is + * interpreted as a Unix-domain socket address. + */ +static inline bool +is_unixsock_path(const char *path) +{ + return is_absolute_path(path) || path[0] == '@'; +} + +/* + * These manipulate the frontend/backend protocol version number. + * + * The major number should be incremented for incompatible changes. The minor + * number should be incremented for compatible changes (eg. additional + * functionality). + * + * If a backend supports version m.n of the protocol it must actually support + * versions m.[0..n]. Backend support for version m-1 can be dropped after a + * `reasonable' length of time. + * + * A frontend isn't required to support anything other than the current + * version. + */ + +#define PG_PROTOCOL_MAJOR(v) ((v) >> 16) +#define PG_PROTOCOL_MINOR(v) ((v) & 0x0000ffff) +#define PG_PROTOCOL_FULL(v) (PG_PROTOCOL_MAJOR(v) * 10000 + PG_PROTOCOL_MINOR(v)) +#define PG_PROTOCOL(m,n) (((m) << 16) | (n)) + +/* + * The earliest and latest frontend/backend protocol version supported. + */ + +#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(3,0) +#define PG_PROTOCOL_LATEST PG_PROTOCOL(3,2) + +typedef uint32 ProtocolVersion; /* FE/BE protocol version number */ + +typedef ProtocolVersion MsgType; + + +/* + * Packet lengths are 4 bytes in network byte order. + * + * The initial length is omitted from the packet layouts appearing below. + */ + +typedef uint32 PacketLen; + +/* + * In protocol 3.0 and later, the startup packet length is not fixed, but + * we set an arbitrary limit on it anyway. This is just to prevent simple + * denial-of-service attacks via sending enough data to run the server + * out of memory. + */ +#define MAX_STARTUP_PACKET_LENGTH 10000 + + +typedef uint32 AuthRequest; + + +/* + * A client can also send a cancel-current-operation request to the postmaster. + * This is uglier than sending it directly to the client's backend, but it + * avoids depending on out-of-band communication facilities. + * + * The cancel request code must not match any protocol version number + * we're ever likely to use. This random choice should do. + * + * Before PostgreSQL v18 and the protocol version bump from 3.0 to 3.2, the + * cancel key was always 4 bytes. With protocol version 3.2, it's variable + * length. + */ + +#define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678) + +typedef struct CancelRequestPacket +{ + /* Note that each field is stored in network byte order! */ + MsgType cancelRequestCode; /* code to identify a cancel request */ + uint32 backendPID; /* PID of client's backend */ + uint8 cancelAuthCode[FLEXIBLE_ARRAY_MEMBER]; /* secret key to + * authorize cancel */ +} CancelRequestPacket; + +/* Application-Layer Protocol Negotiation is required for direct connections + * to avoid protocol confusion attacks (e.g https://alpaca-attack.com/). + * + * ALPN is specified in RFC 7301 + * + * This string should be registered at: + * https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids + * + * OpenSSL uses this wire-format for the list of alpn protocols even in the + * API. Both server and client take the same format parameter but the client + * actually sends it to the server as-is and the server it specifies the + * preference order to use to choose the one selected to send back. + * + * c.f. https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_alpn_select_cb.html + * + * The #define can be used to initialize a char[] vector to use directly in the API + */ +#define PG_ALPN_PROTOCOL "postgresql" +#define PG_ALPN_PROTOCOL_VECTOR { 10, 'p','o','s','t','g','r','e','s','q','l' } + +/* + * A client can also start by sending a SSL or GSSAPI negotiation request to + * get a secure channel. + */ +#define NEGOTIATE_SSL_CODE PG_PROTOCOL(1234,5679) +#define NEGOTIATE_GSS_CODE PG_PROTOCOL(1234,5680) + +#endif /* PQCOMM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/internal/libpq/protocol.h b/VCMP-LUA/modules/postgresql/include/postgresql/internal/libpq/protocol.h new file mode 100644 index 0000000..b0bcb3c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/internal/libpq/protocol.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------- + * + * protocol.h + * Definitions of the request/response codes for the wire protocol. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/protocol.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROTOCOL_H +#define PROTOCOL_H + +/* These are the request codes sent by the frontend. */ + +#define PqMsg_Bind 'B' +#define PqMsg_Close 'C' +#define PqMsg_Describe 'D' +#define PqMsg_Execute 'E' +#define PqMsg_FunctionCall 'F' +#define PqMsg_Flush 'H' +#define PqMsg_Parse 'P' +#define PqMsg_Query 'Q' +#define PqMsg_Sync 'S' +#define PqMsg_Terminate 'X' +#define PqMsg_CopyFail 'f' +#define PqMsg_GSSResponse 'p' +#define PqMsg_PasswordMessage 'p' +#define PqMsg_SASLInitialResponse 'p' +#define PqMsg_SASLResponse 'p' + + +/* These are the response codes sent by the backend. */ + +#define PqMsg_ParseComplete '1' +#define PqMsg_BindComplete '2' +#define PqMsg_CloseComplete '3' +#define PqMsg_NotificationResponse 'A' +#define PqMsg_CommandComplete 'C' +#define PqMsg_DataRow 'D' +#define PqMsg_ErrorResponse 'E' +#define PqMsg_CopyInResponse 'G' +#define PqMsg_CopyOutResponse 'H' +#define PqMsg_EmptyQueryResponse 'I' +#define PqMsg_BackendKeyData 'K' +#define PqMsg_NoticeResponse 'N' +#define PqMsg_AuthenticationRequest 'R' +#define PqMsg_ParameterStatus 'S' +#define PqMsg_RowDescription 'T' +#define PqMsg_FunctionCallResponse 'V' +#define PqMsg_CopyBothResponse 'W' +#define PqMsg_ReadyForQuery 'Z' +#define PqMsg_NoData 'n' +#define PqMsg_PortalSuspended 's' +#define PqMsg_ParameterDescription 't' +#define PqMsg_NegotiateProtocolVersion 'v' + + +/* These are the codes sent by both the frontend and backend. */ + +#define PqMsg_CopyDone 'c' +#define PqMsg_CopyData 'd' + + +/* These are the codes sent by parallel workers to leader processes. */ +#define PqMsg_Progress 'P' + + +/* These are the authentication request codes sent by the backend. */ + +#define AUTH_REQ_OK 0 /* User is authenticated */ +#define AUTH_REQ_KRB4 1 /* Kerberos V4. Not supported any more. */ +#define AUTH_REQ_KRB5 2 /* Kerberos V5. Not supported any more. */ +#define AUTH_REQ_PASSWORD 3 /* Password */ +#define AUTH_REQ_CRYPT 4 /* crypt password. Not supported any more. */ +#define AUTH_REQ_MD5 5 /* md5 password */ +/* 6 is available. It was used for SCM creds, not supported any more. */ +#define AUTH_REQ_GSS 7 /* GSSAPI without wrap() */ +#define AUTH_REQ_GSS_CONT 8 /* Continue GSS exchanges */ +#define AUTH_REQ_SSPI 9 /* SSPI negotiate without wrap() */ +#define AUTH_REQ_SASL 10 /* Begin SASL authentication */ +#define AUTH_REQ_SASL_CONT 11 /* Continue SASL authentication */ +#define AUTH_REQ_SASL_FIN 12 /* Final SASL message */ +#define AUTH_REQ_MAX AUTH_REQ_SASL_FIN /* maximum AUTH_REQ_* value */ + +#endif /* PROTOCOL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/internal/port.h b/VCMP-LUA/modules/postgresql/include/postgresql/internal/port.h new file mode 100644 index 0000000..caf65ce --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/internal/port.h @@ -0,0 +1,564 @@ +/*------------------------------------------------------------------------- + * + * port.h + * Header for src/port/ compatibility functions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PORT_H +#define PG_PORT_H + +#include + +/* + * Windows has enough specialized port stuff that we push most of it off + * into another file. + * Note: Some CYGWIN includes might #define WIN32. + */ +#if defined(WIN32) && !defined(__CYGWIN__) +#include "port/win32_port.h" +#endif + +/* socket has a different definition on WIN32 */ +#ifndef WIN32 +typedef int pgsocket; + +#define PGINVALID_SOCKET (-1) +#else +typedef SOCKET pgsocket; + +#define PGINVALID_SOCKET INVALID_SOCKET +#endif + +/* if platform lacks socklen_t, we assume this will work */ +#ifndef HAVE_SOCKLEN_T +typedef unsigned int socklen_t; +#endif + +/* non-blocking */ +extern bool pg_set_noblock(pgsocket sock); +extern bool pg_set_block(pgsocket sock); + +/* Portable path handling for Unix/Win32 (in path.c) */ + +extern bool has_drive_prefix(const char *path); +extern char *first_dir_separator(const char *filename); +extern char *last_dir_separator(const char *filename); +extern char *first_path_var_separator(const char *pathlist); +extern void join_path_components(char *ret_path, + const char *head, const char *tail); +extern void canonicalize_path(char *path); +extern void canonicalize_path_enc(char *path, int encoding); +extern void make_native_path(char *filename); +extern void cleanup_path(char *path); +extern bool path_contains_parent_reference(const char *path); +extern bool path_is_relative_and_below_cwd(const char *path); +extern bool path_is_prefix_of_path(const char *path1, const char *path2); +extern char *make_absolute_path(const char *path); +extern const char *get_progname(const char *argv0); +extern void get_share_path(const char *my_exec_path, char *ret_path); +extern void get_etc_path(const char *my_exec_path, char *ret_path); +extern void get_include_path(const char *my_exec_path, char *ret_path); +extern void get_pkginclude_path(const char *my_exec_path, char *ret_path); +extern void get_includeserver_path(const char *my_exec_path, char *ret_path); +extern void get_lib_path(const char *my_exec_path, char *ret_path); +extern void get_pkglib_path(const char *my_exec_path, char *ret_path); +extern void get_locale_path(const char *my_exec_path, char *ret_path); +extern void get_doc_path(const char *my_exec_path, char *ret_path); +extern void get_html_path(const char *my_exec_path, char *ret_path); +extern void get_man_path(const char *my_exec_path, char *ret_path); +extern bool get_home_path(char *ret_path); +extern void get_parent_directory(char *path); + +/* common/pgfnames.c */ +extern char **pgfnames(const char *path); +extern void pgfnames_cleanup(char **filenames); + +#define IS_NONWINDOWS_DIR_SEP(ch) ((ch) == '/') +#define is_nonwindows_absolute_path(filename) \ +( \ + IS_NONWINDOWS_DIR_SEP((filename)[0]) \ +) + +#define IS_WINDOWS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\') +/* See path_is_relative_and_below_cwd() for how we handle 'E:abc'. */ +#define is_windows_absolute_path(filename) \ +( \ + IS_WINDOWS_DIR_SEP((filename)[0]) || \ + (isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \ + IS_WINDOWS_DIR_SEP((filename)[2])) \ +) + +/* + * is_absolute_path and IS_DIR_SEP + * + * By using macros here we avoid needing to include path.c in libpq. + */ +#ifndef WIN32 +#define IS_DIR_SEP(ch) IS_NONWINDOWS_DIR_SEP(ch) +#define is_absolute_path(filename) is_nonwindows_absolute_path(filename) +#else +#define IS_DIR_SEP(ch) IS_WINDOWS_DIR_SEP(ch) +#define is_absolute_path(filename) is_windows_absolute_path(filename) +#endif + +/* + * This macro provides a centralized list of all errnos that identify + * hard failure of a previously-established network connection. + * The macro is intended to be used in a switch statement, in the form + * "case ALL_CONNECTION_FAILURE_ERRNOS:". + * + * Note: this groups EPIPE and ECONNRESET, which we take to indicate a + * probable server crash, with other errors that indicate loss of network + * connectivity without proving much about the server's state. Places that + * are actually reporting errors typically single out EPIPE and ECONNRESET, + * while allowing the network failures to be reported generically. + */ +#define ALL_CONNECTION_FAILURE_ERRNOS \ + EPIPE: \ + case ECONNRESET: \ + case ECONNABORTED: \ + case EHOSTDOWN: \ + case EHOSTUNREACH: \ + case ENETDOWN: \ + case ENETRESET: \ + case ENETUNREACH: \ + case ETIMEDOUT + +/* Portable locale initialization (in exec.c) */ +extern void set_pglocale_pgservice(const char *argv0, const char *app); + +/* Portable way to find and execute binaries (in exec.c) */ +extern int validate_exec(const char *path); +extern int find_my_exec(const char *argv0, char *retpath); +extern int find_other_exec(const char *argv0, const char *target, + const char *versionstr, char *retpath); +extern char *pipe_read_line(char *cmd); + +/* Doesn't belong here, but this is used with find_other_exec(), so... */ +#define PG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n" + +#ifdef EXEC_BACKEND +/* Disable ASLR before exec, for developer builds only (in exec.c) */ +extern int pg_disable_aslr(void); +#endif + + +#if defined(WIN32) || defined(__CYGWIN__) +#define EXE ".exe" +#else +#define EXE "" +#endif + +#if defined(WIN32) && !defined(__CYGWIN__) +#define DEVNULL "nul" +#else +#define DEVNULL "/dev/null" +#endif + +/* Portable delay handling */ +extern void pg_usleep(long microsec); + +/* Portable SQL-like case-independent comparisons and conversions */ +extern int pg_strcasecmp(const char *s1, const char *s2); +extern int pg_strncasecmp(const char *s1, const char *s2, size_t n); +extern unsigned char pg_toupper(unsigned char ch); +extern unsigned char pg_tolower(unsigned char ch); +extern unsigned char pg_ascii_toupper(unsigned char ch); +extern unsigned char pg_ascii_tolower(unsigned char ch); + +/* + * Beginning in v12, we always replace snprintf() and friends with our own + * implementation. This symbol is no longer consulted by the core code, + * but keep it defined anyway in case any extensions are looking at it. + */ +#define USE_REPL_SNPRINTF 1 + +/* + * Versions of libintl >= 0.13 try to replace printf() and friends with + * macros to their own versions that understand the %$ format. We do the + * same, so disable their macros, if they exist. + */ +#ifdef vsnprintf +#undef vsnprintf +#endif +#ifdef snprintf +#undef snprintf +#endif +#ifdef vsprintf +#undef vsprintf +#endif +#ifdef sprintf +#undef sprintf +#endif +#ifdef vfprintf +#undef vfprintf +#endif +#ifdef fprintf +#undef fprintf +#endif +#ifdef vprintf +#undef vprintf +#endif +#ifdef printf +#undef printf +#endif + +extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args) pg_attribute_printf(3, 0); +extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4); +extern int pg_vsprintf(char *str, const char *fmt, va_list args) pg_attribute_printf(2, 0); +extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3); +extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args) pg_attribute_printf(2, 0); +extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3); +extern int pg_vprintf(const char *fmt, va_list args) pg_attribute_printf(1, 0); +extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2); + +#ifndef WIN32 +/* + * We add a pg_ prefix as a warning that the Windows implementations have the + * non-standard side-effect of changing the current file position. + */ +#define pg_pread pread +#define pg_pwrite pwrite +#endif + +/* + * We use __VA_ARGS__ for printf to prevent replacing references to + * the "printf" format archetype in format() attribute declarations. + * That unfortunately means that taking a function pointer to printf + * will not do what we'd wish. (If you need to do that, you must name + * pg_printf explicitly.) For printf's sibling functions, use + * parameterless macros so that function pointers will work unsurprisingly. + */ +#define vsnprintf pg_vsnprintf +#define snprintf pg_snprintf +#define vsprintf pg_vsprintf +#define sprintf pg_sprintf +#define vfprintf pg_vfprintf +#define fprintf pg_fprintf +#define vprintf pg_vprintf +#define printf(...) pg_printf(__VA_ARGS__) + +/* This is also provided by snprintf.c */ +extern int pg_strfromd(char *str, size_t count, int precision, double value); + +/* Replace strerror() with our own, somewhat more robust wrapper */ +extern char *pg_strerror(int errnum); +#define strerror pg_strerror + +/* Likewise for strerror_r(); note we prefer the GNU API for that */ +extern char *pg_strerror_r(int errnum, char *buf, size_t buflen); +#define strerror_r pg_strerror_r +#define PG_STRERROR_R_BUFLEN 256 /* Recommended buffer size for strerror_r */ + +/* Wrap strsignal(), or provide our own version if necessary */ +extern const char *pg_strsignal(int signum); + +extern int pclose_check(FILE *stream); + +/* Global variable holding time zone information. */ +#if defined(WIN32) || defined(__CYGWIN__) +#define TIMEZONE_GLOBAL _timezone +#define TZNAME_GLOBAL _tzname +#else +#define TIMEZONE_GLOBAL timezone +#define TZNAME_GLOBAL tzname +#endif + +#if defined(WIN32) || defined(__CYGWIN__) +/* + * Win32 doesn't have reliable rename/unlink during concurrent access. + */ +extern int pgrename(const char *from, const char *to); +extern int pgunlink(const char *path); + +/* Include this first so later includes don't see these defines */ +#ifdef _MSC_VER +#include +#endif + +#define rename(from, to) pgrename(from, to) +#define unlink(path) pgunlink(path) +#endif /* defined(WIN32) || defined(__CYGWIN__) */ + +/* + * Win32 also doesn't have symlinks, but we can emulate them with + * junction points on newer Win32 versions. + * + * Cygwin has its own symlinks which work on Win95/98/ME where + * junction points don't, so use those instead. We have no way of + * knowing what type of system Cygwin binaries will be run on. + * Note: Some CYGWIN includes might #define WIN32. + */ +#if defined(WIN32) && !defined(__CYGWIN__) +extern int pgsymlink(const char *oldpath, const char *newpath); +extern int pgreadlink(const char *path, char *buf, size_t size); + +#define symlink(oldpath, newpath) pgsymlink(oldpath, newpath) +#define readlink(path, buf, size) pgreadlink(path, buf, size) +#endif + +extern bool rmtree(const char *path, bool rmtopdir); + +#if defined(WIN32) && !defined(__CYGWIN__) + +/* + * We want the 64-bit variant of lseek(). + * + * For Visual Studio, this must be after to avoid messing up its + * lseek() and _lseeki64() function declarations. + * + * For MinGW there is already a macro, so we have to undefine it (depending on + * _FILE_OFFSET_BITS, it may point at its own lseek64, but we don't want to + * count on that being set). + */ +#undef lseek +#define lseek(a,b,c) _lseeki64((a),(b),(c)) + +/* + * We want the 64-bit variant of chsize(). It sets errno and also returns it, + * so convert non-zero result to -1 to match POSIX. + * + * Prevent MinGW from declaring functions, and undefine its macro before we + * define our own. + */ +#ifndef _MSC_VER +#define FTRUNCATE_DEFINED +#include +#undef ftruncate +#endif +#define ftruncate(a,b) (_chsize_s((a),(b)) == 0 ? 0 : -1) + +/* + * open() and fopen() replacements to allow deletion of open files and + * passing of other special options. + */ +extern HANDLE pgwin32_open_handle(const char *, int, bool); +extern int pgwin32_open(const char *, int,...); +extern FILE *pgwin32_fopen(const char *, const char *); +#define open(a,b,c) pgwin32_open(a,b,c) +#define fopen(a,b) pgwin32_fopen(a,b) + +/* + * Mingw-w64 headers #define popen and pclose to _popen and _pclose. We want + * to use our popen wrapper, rather than plain _popen, so override that. For + * consistency, use our version of pclose, too. + */ +#ifdef popen +#undef popen +#endif +#ifdef pclose +#undef pclose +#endif + +/* + * system() and popen() replacements to enclose the command in an extra + * pair of quotes. + */ +extern int pgwin32_system(const char *command); +extern FILE *pgwin32_popen(const char *command, const char *type); + +#define system(a) pgwin32_system(a) +#define popen(a,b) pgwin32_popen(a,b) +#define pclose(a) _pclose(a) + +#else /* !WIN32 */ + +/* + * Win32 requires a special close for sockets and pipes, while on Unix + * close() does them all. + */ +#define closesocket close +#endif /* WIN32 */ + +/* + * On Windows, setvbuf() does not support _IOLBF mode, and interprets that + * as _IOFBF. To add insult to injury, setvbuf(file, NULL, _IOFBF, 0) + * crashes outright if "parameter validation" is enabled. Therefore, in + * places where we'd like to select line-buffered mode, we fall back to + * unbuffered mode instead on Windows. Always use PG_IOLBF not _IOLBF + * directly in order to implement this behavior. + */ +#ifndef WIN32 +#define PG_IOLBF _IOLBF +#else +#define PG_IOLBF _IONBF +#endif + +/* + * Default "extern" declarations or macro substitutes for library routines. + * When necessary, these routines are provided by files in src/port/. + */ + +/* Type to use with fseeko/ftello */ +#ifndef WIN32 /* WIN32 is handled in port/win32_port.h */ +#define pgoff_t off_t +#endif + +#ifndef HAVE_GETPEEREID +/* On Windows, Perl might have incompatible definitions of uid_t and gid_t. */ +#ifndef PLPERL_HAVE_UID_GID +extern int getpeereid(int sock, uid_t *uid, gid_t *gid); +#endif +#endif + +/* + * Glibc doesn't use the builtin for clang due to a *gcc* bug in a version + * newer than the gcc compatibility clang claims to have. This would cause a + * *lot* of superfluous function calls, therefore revert when using clang. In + * C++ there's issues with libc++ (not libstdc++), so disable as well. + */ +#if defined(__clang__) && !defined(__cplusplus) +/* needs to be separate to not confuse other compilers */ +#if __has_builtin(__builtin_isinf) +/* need to include before, to avoid getting overwritten */ +#include +#undef isinf +#define isinf __builtin_isinf +#endif /* __has_builtin(isinf) */ +#endif /* __clang__ && !__cplusplus */ + +#ifndef HAVE_EXPLICIT_BZERO +extern void explicit_bzero(void *buf, size_t len); +#endif + +#ifdef HAVE_BUGGY_STRTOF +extern float pg_strtof(const char *nptr, char **endptr); +#define strtof(a,b) (pg_strtof((a),(b))) +#endif + +#ifdef WIN32 +/* src/port/win32link.c */ +extern int link(const char *src, const char *dst); +#endif + +#ifndef HAVE_MKDTEMP +extern char *mkdtemp(char *path); +#endif + +#ifndef HAVE_INET_ATON +#include +#include +extern int inet_aton(const char *cp, struct in_addr *addr); +#endif + +#if !HAVE_DECL_STRLCAT +extern size_t strlcat(char *dst, const char *src, size_t siz); +#endif + +#if !HAVE_DECL_STRLCPY +extern size_t strlcpy(char *dst, const char *src, size_t siz); +#endif + +#if !HAVE_DECL_STRNLEN +extern size_t strnlen(const char *str, size_t maxlen); +#endif + +#if !HAVE_DECL_STRSEP +extern char *strsep(char **stringp, const char *delim); +#endif + +#if !HAVE_DECL_TIMINGSAFE_BCMP +extern int timingsafe_bcmp(const void *b1, const void *b2, size_t len); +#endif + +/* + * Callers should use the qsort() macro defined below instead of calling + * pg_qsort() directly. + */ +extern void pg_qsort(void *base, size_t nel, size_t elsize, + int (*cmp) (const void *, const void *)); +extern int pg_qsort_strcmp(const void *a, const void *b); + +#define qsort(a,b,c,d) pg_qsort(a,b,c,d) + +typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg); + +extern void qsort_arg(void *base, size_t nel, size_t elsize, + qsort_arg_comparator cmp, void *arg); + +extern void qsort_interruptible(void *base, size_t nel, size_t elsize, + qsort_arg_comparator cmp, void *arg); + +extern void *bsearch_arg(const void *key, const void *base0, + size_t nmemb, size_t size, + int (*compar) (const void *, const void *, void *), + void *arg); + +/* port/pg_localeconv_r.c */ +extern int pg_localeconv_r(const char *lc_monetary, + const char *lc_numeric, + struct lconv *output); +extern void pg_localeconv_free(struct lconv *lconv); + +/* port/chklocale.c */ +extern int pg_get_encoding_from_locale(const char *ctype, bool write_message); + +#if defined(WIN32) && !defined(FRONTEND) +extern int pg_codepage_to_encoding(UINT cp); +#endif + +/* port/inet_net_ntop.c */ +extern char *pg_inet_net_ntop(int af, const void *src, int bits, + char *dst, size_t size); + +/* port/pg_strong_random.c */ +extern void pg_strong_random_init(void); +extern bool pg_strong_random(void *buf, size_t len); + +/* + * pg_backend_random used to be a wrapper for pg_strong_random before + * Postgres 12 for the backend code. + */ +#define pg_backend_random pg_strong_random + +/* port/pgcheckdir.c */ +extern int pg_check_dir(const char *dir); + +/* port/pgmkdirp.c */ +extern int pg_mkdir_p(char *path, int omode); + +/* port/pqsignal.c (see also interfaces/libpq/legacy-pqsignal.c) */ +#ifdef FRONTEND +#define pqsignal pqsignal_fe +#else +#define pqsignal pqsignal_be +#endif +typedef void (*pqsigfunc) (SIGNAL_ARGS); +extern void pqsignal(int signo, pqsigfunc func); + +/* port/quotes.c */ +extern char *escape_single_quotes_ascii(const char *src); + +/* common/wait_error.c */ +extern char *wait_result_to_str(int exitstatus); +extern bool wait_result_is_signal(int exit_status, int signum); +extern bool wait_result_is_any_signal(int exit_status, bool include_command_not_found); +extern int wait_result_to_exit_code(int exit_status); + +/* + * Interfaces that we assume all Unix system have. We retain individual macros + * for better documentation. + * + * For symlink-related functions, there is often no need to test these macros, + * because we provided basic support on Windows that can work with absolute + * paths to directories. Code that wants to test for complete symlink support + * (including relative paths and non-directories) should be conditional on + * HAVE_READLINK or HAVE_SYMLINK. + */ +#ifndef WIN32 +#define HAVE_GETRLIMIT 1 +#define HAVE_POLL 1 +#define HAVE_POLL_H 1 +#define HAVE_READLINK 1 +#define HAVE_SETSID 1 +#define HAVE_SHM_OPEN 1 +#define HAVE_SYMLINK 1 +#endif + +#endif /* PG_PORT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/internal/postgres_fe.h b/VCMP-LUA/modules/postgresql/include/postgresql/internal/postgres_fe.h new file mode 100644 index 0000000..a3f65b1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/internal/postgres_fe.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * postgres_fe.h + * Primary include file for PostgreSQL client-side .c files + * + * This should be the first file included by PostgreSQL client libraries and + * application programs --- but not by backend modules, which should include + * postgres.h. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1995, Regents of the University of California + * + * src/include/postgres_fe.h + * + *------------------------------------------------------------------------- + */ +/* IWYU pragma: always_keep */ +#ifndef POSTGRES_FE_H +#define POSTGRES_FE_H + +#ifndef FRONTEND +#define FRONTEND 1 +#endif + +/* IWYU pragma: begin_exports */ + +#include "c.h" + +#include "common/fe_memutils.h" + +/* IWYU pragma: end_exports */ + +#endif /* POSTGRES_FE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/internal/pqexpbuffer.h b/VCMP-LUA/modules/postgresql/include/postgresql/internal/pqexpbuffer.h new file mode 100644 index 0000000..a0af7ad --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/internal/pqexpbuffer.h @@ -0,0 +1,192 @@ +/*------------------------------------------------------------------------- + * + * pqexpbuffer.h + * Declarations/definitions for "PQExpBuffer" functions. + * + * PQExpBuffer provides an indefinitely-extensible string data type. + * It can be used to buffer either ordinary C strings (null-terminated text) + * or arbitrary binary data. All storage is allocated with malloc(). + * + * This module is essentially the same as the backend's StringInfo data type, + * but it is intended for use in frontend libpq and client applications. + * Thus, it does not rely on palloc() nor elog(). + * + * It does rely on vsnprintf(); if configure finds that libc doesn't provide + * a usable vsnprintf(), then a copy of our own implementation of it will + * be linked into libpq. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/interfaces/libpq/pqexpbuffer.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQEXPBUFFER_H +#define PQEXPBUFFER_H + +/*------------------------- + * PQExpBufferData holds information about an extensible string. + * data is the current buffer for the string (allocated with malloc). + * len is the current string length. There is guaranteed to be + * a terminating '\0' at data[len], although this is not very + * useful when the string holds binary data rather than text. + * maxlen is the allocated size in bytes of 'data', i.e. the maximum + * string size (including the terminating '\0' char) that we can + * currently store in 'data' without having to reallocate + * more space. We must always have maxlen > len. + * + * An exception occurs if we failed to allocate enough memory for the string + * buffer. In that case data points to a statically allocated empty string, + * and len = maxlen = 0. + *------------------------- + */ +typedef struct PQExpBufferData +{ + char *data; + size_t len; + size_t maxlen; +} PQExpBufferData; + +typedef PQExpBufferData *PQExpBuffer; + +/*------------------------ + * Test for a broken (out of memory) PQExpBuffer. + * When a buffer is "broken", all operations except resetting or deleting it + * are no-ops. + *------------------------ + */ +#define PQExpBufferBroken(str) \ + ((str) == NULL || (str)->maxlen == 0) + +/*------------------------ + * Same, but for use when using a static or local PQExpBufferData struct. + * For that, a null-pointer test is useless and may draw compiler warnings. + *------------------------ + */ +#define PQExpBufferDataBroken(buf) \ + ((buf).maxlen == 0) + +/*------------------------ + * Initial size of the data buffer in a PQExpBuffer. + * NB: this must be large enough to hold error messages that might + * be returned by PQrequestCancel(). + *------------------------ + */ +#define INITIAL_EXPBUFFER_SIZE 256 + +/*------------------------ + * There are two ways to create a PQExpBuffer object initially: + * + * PQExpBuffer stringptr = createPQExpBuffer(); + * Both the PQExpBufferData and the data buffer are malloc'd. + * + * PQExpBufferData string; + * initPQExpBuffer(&string); + * The data buffer is malloc'd but the PQExpBufferData is presupplied. + * This is appropriate if the PQExpBufferData is a field of another + * struct. + *------------------------- + */ + +/*------------------------ + * createPQExpBuffer + * Create an empty 'PQExpBufferData' & return a pointer to it. + */ +extern PQExpBuffer createPQExpBuffer(void); + +/*------------------------ + * initPQExpBuffer + * Initialize a PQExpBufferData struct (with previously undefined contents) + * to describe an empty string. + */ +extern void initPQExpBuffer(PQExpBuffer str); + +/*------------------------ + * To destroy a PQExpBuffer, use either: + * + * destroyPQExpBuffer(str); + * free()s both the data buffer and the PQExpBufferData. + * This is the inverse of createPQExpBuffer(). + * + * termPQExpBuffer(str) + * free()s the data buffer but not the PQExpBufferData itself. + * This is the inverse of initPQExpBuffer(). + * + * NOTE: some routines build up a string using PQExpBuffer, and then + * release the PQExpBufferData but return the data string itself to their + * caller. At that point the data string looks like a plain malloc'd + * string. + */ +extern void destroyPQExpBuffer(PQExpBuffer str); +extern void termPQExpBuffer(PQExpBuffer str); + +/*------------------------ + * resetPQExpBuffer + * Reset a PQExpBuffer to empty + * + * Note: if possible, a "broken" PQExpBuffer is returned to normal. + */ +extern void resetPQExpBuffer(PQExpBuffer str); + +/*------------------------ + * enlargePQExpBuffer + * Make sure there is enough space for 'needed' more bytes in the buffer + * ('needed' does not include the terminating null). + * + * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case + * the buffer is left in "broken" state.) + */ +extern int enlargePQExpBuffer(PQExpBuffer str, size_t needed); + +/*------------------------ + * printfPQExpBuffer + * Format text data under the control of fmt (an sprintf-like format string) + * and insert it into str. More space is allocated to str if necessary. + * This is a convenience routine that does the same thing as + * resetPQExpBuffer() followed by appendPQExpBuffer(). + */ +extern void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...) pg_attribute_printf(2, 3); + +/*------------------------ + * appendPQExpBuffer + * Format text data under the control of fmt (an sprintf-like format string) + * and append it to whatever is already in str. More space is allocated + * to str if necessary. This is sort of like a combination of sprintf and + * strcat. + */ +extern void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...) pg_attribute_printf(2, 3); + +/*------------------------ + * appendPQExpBufferVA + * Attempt to format data and append it to str. Returns true if done + * (either successful or hard failure), false if need to retry. + * + * Caution: callers must be sure to preserve their entry-time errno + * when looping, in case the fmt contains "%m". + */ +extern bool appendPQExpBufferVA(PQExpBuffer str, const char *fmt, va_list args) pg_attribute_printf(2, 0); + +/*------------------------ + * appendPQExpBufferStr + * Append the given string to a PQExpBuffer, allocating more space + * if necessary. + */ +extern void appendPQExpBufferStr(PQExpBuffer str, const char *data); + +/*------------------------ + * appendPQExpBufferChar + * Append a single byte to str. + * Like appendPQExpBuffer(str, "%c", ch) but much faster. + */ +extern void appendPQExpBufferChar(PQExpBuffer str, char ch); + +/*------------------------ + * appendBinaryPQExpBuffer + * Append arbitrary binary data to a PQExpBuffer, allocating more space + * if necessary. + */ +extern void appendBinaryPQExpBuffer(PQExpBuffer str, + const char *data, size_t datalen); + +#endif /* PQEXPBUFFER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/amapi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/amapi.h new file mode 100644 index 0000000..70949de --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/amapi.h @@ -0,0 +1,332 @@ +/*------------------------------------------------------------------------- + * + * amapi.h + * API for Postgres index access methods. + * + * Copyright (c) 2015-2025, PostgreSQL Global Development Group + * + * src/include/access/amapi.h + * + *------------------------------------------------------------------------- + */ +#ifndef AMAPI_H +#define AMAPI_H + +#include "access/cmptype.h" +#include "access/genam.h" +#include "access/stratnum.h" + +/* + * We don't wish to include planner header files here, since most of an index + * AM's implementation isn't concerned with those data structures. To allow + * declaring amcostestimate_function here, use forward struct references. + */ +struct PlannerInfo; +struct IndexPath; + +/* Likewise, this file shouldn't depend on execnodes.h. */ +struct IndexInfo; + + +/* + * Properties for amproperty API. This list covers properties known to the + * core code, but an index AM can define its own properties, by matching the + * string property name. + */ +typedef enum IndexAMProperty +{ + AMPROP_UNKNOWN = 0, /* anything not known to core code */ + AMPROP_ASC, /* column properties */ + AMPROP_DESC, + AMPROP_NULLS_FIRST, + AMPROP_NULLS_LAST, + AMPROP_ORDERABLE, + AMPROP_DISTANCE_ORDERABLE, + AMPROP_RETURNABLE, + AMPROP_SEARCH_ARRAY, + AMPROP_SEARCH_NULLS, + AMPROP_CLUSTERABLE, /* index properties */ + AMPROP_INDEX_SCAN, + AMPROP_BITMAP_SCAN, + AMPROP_BACKWARD_SCAN, + AMPROP_CAN_ORDER, /* AM properties */ + AMPROP_CAN_UNIQUE, + AMPROP_CAN_MULTI_COL, + AMPROP_CAN_EXCLUDE, + AMPROP_CAN_INCLUDE, +} IndexAMProperty; + +/* + * We use lists of this struct type to keep track of both operators and + * support functions while building or adding to an opclass or opfamily. + * amadjustmembers functions receive lists of these structs, and are allowed + * to alter their "ref" fields. + * + * The "ref" fields define how the pg_amop or pg_amproc entry should depend + * on the associated objects (that is, which dependency type to use, and + * which opclass or opfamily it should depend on). + * + * If ref_is_hard is true, the entry will have a NORMAL dependency on the + * operator or support func, and an INTERNAL dependency on the opclass or + * opfamily. This forces the opclass or opfamily to be dropped if the + * operator or support func is dropped, and requires the CASCADE option + * to do so. Nor will ALTER OPERATOR FAMILY DROP be allowed. This is + * the right behavior for objects that are essential to an opclass. + * + * If ref_is_hard is false, the entry will have an AUTO dependency on the + * operator or support func, and also an AUTO dependency on the opclass or + * opfamily. This allows ALTER OPERATOR FAMILY DROP, and causes that to + * happen automatically if the operator or support func is dropped. This + * is the right behavior for inessential ("loose") objects. + * + * We also make dependencies on lefttype/righttype, of the same strength as + * the dependency on the operator or support func, unless these dependencies + * are redundant with the dependency on the operator or support func. + */ +typedef struct OpFamilyMember +{ + bool is_func; /* is this an operator, or support func? */ + Oid object; /* operator or support func's OID */ + int number; /* strategy or support func number */ + Oid lefttype; /* lefttype */ + Oid righttype; /* righttype */ + Oid sortfamily; /* ordering operator's sort opfamily, or 0 */ + bool ref_is_hard; /* hard or soft dependency? */ + bool ref_is_family; /* is dependency on opclass or opfamily? */ + Oid refobjid; /* OID of opclass or opfamily */ +} OpFamilyMember; + + +/* + * Callback function signatures --- see indexam.sgml for more info. + */ + +/* translate AM-specific strategies to general operator types */ +typedef CompareType (*amtranslate_strategy_function) (StrategyNumber strategy, Oid opfamily); + +/* translate general operator types to AM-specific strategies */ +typedef StrategyNumber (*amtranslate_cmptype_function) (CompareType cmptype, Oid opfamily); + +/* build new index */ +typedef IndexBuildResult *(*ambuild_function) (Relation heapRelation, + Relation indexRelation, + struct IndexInfo *indexInfo); + +/* build empty index */ +typedef void (*ambuildempty_function) (Relation indexRelation); + +/* insert this tuple */ +typedef bool (*aminsert_function) (Relation indexRelation, + Datum *values, + bool *isnull, + ItemPointer heap_tid, + Relation heapRelation, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); + +/* cleanup after insert */ +typedef void (*aminsertcleanup_function) (Relation indexRelation, + struct IndexInfo *indexInfo); + +/* bulk delete */ +typedef IndexBulkDeleteResult *(*ambulkdelete_function) (IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); + +/* post-VACUUM cleanup */ +typedef IndexBulkDeleteResult *(*amvacuumcleanup_function) (IndexVacuumInfo *info, + IndexBulkDeleteResult *stats); + +/* can indexscan return IndexTuples? */ +typedef bool (*amcanreturn_function) (Relation indexRelation, int attno); + +/* estimate cost of an indexscan */ +typedef void (*amcostestimate_function) (struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); + +/* estimate height of a tree-structured index + * + * XXX This just computes a value that is later used by amcostestimate. This + * API could be expanded to support passing more values if the need arises. + */ +typedef int (*amgettreeheight_function) (Relation rel); + +/* parse index reloptions */ +typedef bytea *(*amoptions_function) (Datum reloptions, + bool validate); + +/* report AM, index, or index column property */ +typedef bool (*amproperty_function) (Oid index_oid, int attno, + IndexAMProperty prop, const char *propname, + bool *res, bool *isnull); + +/* name of phase as used in progress reporting */ +typedef char *(*ambuildphasename_function) (int64 phasenum); + +/* validate definition of an opclass for this AM */ +typedef bool (*amvalidate_function) (Oid opclassoid); + +/* validate operators and support functions to be added to an opclass/family */ +typedef void (*amadjustmembers_function) (Oid opfamilyoid, + Oid opclassoid, + List *operators, + List *functions); + +/* prepare for index scan */ +typedef IndexScanDesc (*ambeginscan_function) (Relation indexRelation, + int nkeys, + int norderbys); + +/* (re)start index scan */ +typedef void (*amrescan_function) (IndexScanDesc scan, + ScanKey keys, + int nkeys, + ScanKey orderbys, + int norderbys); + +/* next valid tuple */ +typedef bool (*amgettuple_function) (IndexScanDesc scan, + ScanDirection direction); + +/* fetch all valid tuples */ +typedef int64 (*amgetbitmap_function) (IndexScanDesc scan, + TIDBitmap *tbm); + +/* end index scan */ +typedef void (*amendscan_function) (IndexScanDesc scan); + +/* mark current scan position */ +typedef void (*ammarkpos_function) (IndexScanDesc scan); + +/* restore marked scan position */ +typedef void (*amrestrpos_function) (IndexScanDesc scan); + +/* + * Callback function signatures - for parallel index scans. + */ + +/* estimate size of parallel scan descriptor */ +typedef Size (*amestimateparallelscan_function) (Relation indexRelation, + int nkeys, int norderbys); + +/* prepare for parallel index scan */ +typedef void (*aminitparallelscan_function) (void *target); + +/* (re)start parallel index scan */ +typedef void (*amparallelrescan_function) (IndexScanDesc scan); + +/* + * API struct for an index AM. Note this must be stored in a single palloc'd + * chunk of memory. + */ +typedef struct IndexAmRoutine +{ + NodeTag type; + + /* + * Total number of strategies (operators) by which we can traverse/search + * this AM. Zero if AM does not have a fixed set of strategy assignments. + */ + uint16 amstrategies; + /* total number of support functions that this AM uses */ + uint16 amsupport; + /* opclass options support function number or 0 */ + uint16 amoptsprocnum; + /* does AM support ORDER BY indexed column's value? */ + bool amcanorder; + /* does AM support ORDER BY result of an operator on indexed column? */ + bool amcanorderbyop; + /* does AM support hashing using API consistent with the hash AM? */ + bool amcanhash; + /* do operators within an opfamily have consistent equality semantics? */ + bool amconsistentequality; + /* do operators within an opfamily have consistent ordering semantics? */ + bool amconsistentordering; + /* does AM support backward scanning? */ + bool amcanbackward; + /* does AM support UNIQUE indexes? */ + bool amcanunique; + /* does AM support multi-column indexes? */ + bool amcanmulticol; + /* does AM require scans to have a constraint on the first index column? */ + bool amoptionalkey; + /* does AM handle ScalarArrayOpExpr quals? */ + bool amsearcharray; + /* does AM handle IS NULL/IS NOT NULL quals? */ + bool amsearchnulls; + /* can index storage data type differ from column data type? */ + bool amstorage; + /* can an index of this type be clustered on? */ + bool amclusterable; + /* does AM handle predicate locks? */ + bool ampredlocks; + /* does AM support parallel scan? */ + bool amcanparallel; + /* does AM support parallel build? */ + bool amcanbuildparallel; + /* does AM support columns included with clause INCLUDE? */ + bool amcaninclude; + /* does AM use maintenance_work_mem? */ + bool amusemaintenanceworkmem; + /* does AM store tuple information only at block granularity? */ + bool amsummarizing; + /* OR of parallel vacuum flags. See vacuum.h for flags. */ + uint8 amparallelvacuumoptions; + /* type of data stored in index, or InvalidOid if variable */ + Oid amkeytype; + + /* + * If you add new properties to either the above or the below lists, then + * they should also (usually) be exposed via the property API (see + * IndexAMProperty at the top of the file, and utils/adt/amutils.c). + */ + + /* interface functions */ + ambuild_function ambuild; + ambuildempty_function ambuildempty; + aminsert_function aminsert; + aminsertcleanup_function aminsertcleanup; /* can be NULL */ + ambulkdelete_function ambulkdelete; + amvacuumcleanup_function amvacuumcleanup; + amcanreturn_function amcanreturn; /* can be NULL */ + amcostestimate_function amcostestimate; + amgettreeheight_function amgettreeheight; /* can be NULL */ + amoptions_function amoptions; + amproperty_function amproperty; /* can be NULL */ + ambuildphasename_function ambuildphasename; /* can be NULL */ + amvalidate_function amvalidate; + amadjustmembers_function amadjustmembers; /* can be NULL */ + ambeginscan_function ambeginscan; + amrescan_function amrescan; + amgettuple_function amgettuple; /* can be NULL */ + amgetbitmap_function amgetbitmap; /* can be NULL */ + amendscan_function amendscan; + ammarkpos_function ammarkpos; /* can be NULL */ + amrestrpos_function amrestrpos; /* can be NULL */ + + /* interface functions to support parallel index scans */ + amestimateparallelscan_function amestimateparallelscan; /* can be NULL */ + aminitparallelscan_function aminitparallelscan; /* can be NULL */ + amparallelrescan_function amparallelrescan; /* can be NULL */ + + /* interface functions to support planning */ + amtranslate_strategy_function amtranslatestrategy; /* can be NULL */ + amtranslate_cmptype_function amtranslatecmptype; /* can be NULL */ +} IndexAmRoutine; + + +/* Functions in access/index/amapi.c */ +extern IndexAmRoutine *GetIndexAmRoutine(Oid amhandler); +extern IndexAmRoutine *GetIndexAmRoutineByAmId(Oid amoid, bool noerror); +extern CompareType IndexAmTranslateStrategy(StrategyNumber strategy, Oid amoid, Oid opfamily, bool missing_ok); +extern StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, bool missing_ok); + +#endif /* AMAPI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/amvalidate.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/amvalidate.h new file mode 100644 index 0000000..43b1692 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/amvalidate.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * amvalidate.h + * Support routines for index access methods' amvalidate and + * amadjustmembers functions. + * + * Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/access/amvalidate.h + * + *------------------------------------------------------------------------- + */ +#ifndef AMVALIDATE_H +#define AMVALIDATE_H + +#include "utils/catcache.h" + + +/* Struct returned (in a list) by identify_opfamily_groups() */ +typedef struct OpFamilyOpFuncGroup +{ + Oid lefttype; /* amoplefttype/amproclefttype */ + Oid righttype; /* amoprighttype/amprocrighttype */ + uint64 operatorset; /* bitmask of operators with these types */ + uint64 functionset; /* bitmask of support funcs with these types */ +} OpFamilyOpFuncGroup; + + +/* Functions in access/index/amvalidate.c */ +extern List *identify_opfamily_groups(CatCList *oprlist, CatCList *proclist); +extern bool check_amproc_signature(Oid funcid, Oid restype, bool exact, + int minargs, int maxargs,...); +extern bool check_amoptsproc_signature(Oid funcid); +extern bool check_amop_signature(Oid opno, Oid restype, + Oid lefttype, Oid righttype); +extern Oid opclass_for_family_datatype(Oid amoid, Oid opfamilyoid, + Oid datatypeoid); +extern bool opfamily_can_sort_type(Oid opfamilyoid, Oid datatypeoid); + +#endif /* AMVALIDATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/attmap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/attmap.h new file mode 100644 index 0000000..8f92188 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/attmap.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * attmap.h + * Definitions for PostgreSQL attribute mappings + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/attmap.h + * + *------------------------------------------------------------------------- + */ +#ifndef ATTMAP_H +#define ATTMAP_H + +#include "access/attnum.h" +#include "access/tupdesc.h" + +/* + * Attribute mapping structure + * + * This maps attribute numbers between a pair of relations, designated + * 'input' and 'output' (most typically inheritance parent and child + * relations), whose common columns may have different attribute numbers. + * Such difference may arise due to the columns being ordered differently + * in the two relations or the two relations having dropped columns at + * different positions. + * + * 'maplen' is set to the number of attributes of the 'output' relation, + * taking into account any of its dropped attributes, with the corresponding + * elements of the 'attnums' array set to 0. + */ +typedef struct AttrMap +{ + AttrNumber *attnums; + int maplen; +} AttrMap; + +extern AttrMap *make_attrmap(int maplen); +extern void free_attrmap(AttrMap *map); + +/* Conversion routines to build mappings */ +extern AttrMap *build_attrmap_by_name(TupleDesc indesc, + TupleDesc outdesc, + bool missing_ok); +extern AttrMap *build_attrmap_by_name_if_req(TupleDesc indesc, + TupleDesc outdesc, + bool missing_ok); +extern AttrMap *build_attrmap_by_position(TupleDesc indesc, + TupleDesc outdesc, + const char *msg); + +#endif /* ATTMAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/attnum.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/attnum.h new file mode 100644 index 0000000..06c9167 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/attnum.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * attnum.h + * POSTGRES attribute number definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/attnum.h + * + *------------------------------------------------------------------------- + */ +#ifndef ATTNUM_H +#define ATTNUM_H + + +/* + * user defined attribute numbers start at 1. -ay 2/95 + */ +typedef int16 AttrNumber; + +#define InvalidAttrNumber 0 +#define MaxAttrNumber 32767 + +/* ---------------- + * support macros + * ---------------- + */ +/* + * AttributeNumberIsValid + * True iff the attribute number is valid. + */ +#define AttributeNumberIsValid(attributeNumber) \ + ((bool) ((attributeNumber) != InvalidAttrNumber)) + +/* + * AttrNumberIsForUserDefinedAttr + * True iff the attribute number corresponds to a user defined attribute. + */ +#define AttrNumberIsForUserDefinedAttr(attributeNumber) \ + ((bool) ((attributeNumber) > 0)) + +/* + * AttrNumberGetAttrOffset + * Returns the attribute offset for an attribute number. + * + * Note: + * Assumes the attribute number is for a user defined attribute. + */ +#define AttrNumberGetAttrOffset(attNum) \ +( \ + AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)), \ + ((attNum) - 1) \ +) + +/* + * AttrOffsetGetAttrNumber + * Returns the attribute number for an attribute offset. + */ +#define AttrOffsetGetAttrNumber(attributeOffset) \ + ((AttrNumber) (1 + (attributeOffset))) + +#endif /* ATTNUM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin.h new file mode 100644 index 0000000..821f1e0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin.h @@ -0,0 +1,58 @@ +/* + * AM-callable functions for BRIN indexes + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/brin.h + */ +#ifndef BRIN_H +#define BRIN_H + +#include "nodes/execnodes.h" +#include "storage/shm_toc.h" +#include "utils/relcache.h" + + +/* + * Storage type for BRIN's reloptions + */ +typedef struct BrinOptions +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + BlockNumber pagesPerRange; + bool autosummarize; +} BrinOptions; + + +/* + * BrinStatsData represents stats data for planner use + */ +typedef struct BrinStatsData +{ + BlockNumber pagesPerRange; + BlockNumber revmapNumPages; +} BrinStatsData; + + +#define BRIN_DEFAULT_PAGES_PER_RANGE 128 +#define BrinGetPagesPerRange(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == BRIN_AM_OID), \ + (relation)->rd_options ? \ + ((BrinOptions *) (relation)->rd_options)->pagesPerRange : \ + BRIN_DEFAULT_PAGES_PER_RANGE) +#define BrinGetAutoSummarize(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == BRIN_AM_OID), \ + (relation)->rd_options ? \ + ((BrinOptions *) (relation)->rd_options)->autosummarize : \ + false) + + +extern void brinGetStats(Relation index, BrinStatsData *stats); + +extern void _brin_parallel_build_main(dsm_segment *seg, shm_toc *toc); + +#endif /* BRIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_internal.h new file mode 100644 index 0000000..d093a0b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_internal.h @@ -0,0 +1,116 @@ +/* + * brin_internal.h + * internal declarations for BRIN indexes + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/brin_internal.h + */ +#ifndef BRIN_INTERNAL_H +#define BRIN_INTERNAL_H + +#include "access/amapi.h" +#include "storage/bufpage.h" +#include "utils/typcache.h" + + +/* + * A BrinDesc is a struct designed to enable decoding a BRIN tuple from the + * on-disk format to an in-memory tuple and vice-versa. + */ + +/* struct returned by "OpcInfo" amproc */ +typedef struct BrinOpcInfo +{ + /* Number of columns stored in an index column of this opclass */ + uint16 oi_nstored; + + /* Regular processing of NULLs in BrinValues? */ + bool oi_regular_nulls; + + /* Opaque pointer for the opclass' private use */ + void *oi_opaque; + + /* Type cache entries of the stored columns */ + TypeCacheEntry *oi_typcache[FLEXIBLE_ARRAY_MEMBER]; +} BrinOpcInfo; + +/* the size of a BrinOpcInfo for the given number of columns */ +#define SizeofBrinOpcInfo(ncols) \ + (offsetof(BrinOpcInfo, oi_typcache) + sizeof(TypeCacheEntry *) * ncols) + +typedef struct BrinDesc +{ + /* Containing memory context */ + MemoryContext bd_context; + + /* the index relation itself */ + Relation bd_index; + + /* tuple descriptor of the index relation */ + TupleDesc bd_tupdesc; + + /* cached copy for on-disk tuples; generated at first use */ + TupleDesc bd_disktdesc; + + /* total number of Datum entries that are stored on-disk for all columns */ + int bd_totalstored; + + /* per-column info; bd_tupdesc->natts entries long */ + BrinOpcInfo *bd_info[FLEXIBLE_ARRAY_MEMBER]; +} BrinDesc; + +/* + * Globally-known function support numbers for BRIN indexes. Individual + * opclasses can define more function support numbers, which must fall into + * BRIN_FIRST_OPTIONAL_PROCNUM .. BRIN_LAST_OPTIONAL_PROCNUM. + */ +#define BRIN_PROCNUM_OPCINFO 1 +#define BRIN_PROCNUM_ADDVALUE 2 +#define BRIN_PROCNUM_CONSISTENT 3 +#define BRIN_PROCNUM_UNION 4 +#define BRIN_MANDATORY_NPROCS 4 +#define BRIN_PROCNUM_OPTIONS 5 /* optional */ +/* procedure numbers up to 10 are reserved for BRIN future expansion */ +#define BRIN_FIRST_OPTIONAL_PROCNUM 11 +#define BRIN_LAST_OPTIONAL_PROCNUM 15 + +#undef BRIN_DEBUG + +#ifdef BRIN_DEBUG +#define BRIN_elog(args) elog args +#else +#define BRIN_elog(args) ((void) 0) +#endif + +/* brin.c */ +extern BrinDesc *brin_build_desc(Relation rel); +extern void brin_free_desc(BrinDesc *bdesc); +extern IndexBuildResult *brinbuild(Relation heap, Relation index, + struct IndexInfo *indexInfo); +extern void brinbuildempty(Relation index); +extern bool brininsert(Relation idxRel, Datum *values, bool *nulls, + ItemPointer heaptid, Relation heapRel, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); +extern void brininsertcleanup(Relation index, struct IndexInfo *indexInfo); +extern IndexScanDesc brinbeginscan(Relation r, int nkeys, int norderbys); +extern int64 bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm); +extern void brinrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, + ScanKey orderbys, int norderbys); +extern void brinendscan(IndexScanDesc scan); +extern IndexBulkDeleteResult *brinbulkdelete(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); +extern IndexBulkDeleteResult *brinvacuumcleanup(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats); +extern bytea *brinoptions(Datum reloptions, bool validate); + +/* brin_validate.c */ +extern bool brinvalidate(Oid opclassoid); + +#endif /* BRIN_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_page.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_page.h new file mode 100644 index 0000000..06742a3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_page.h @@ -0,0 +1,96 @@ +/* + * brin_page.h + * Prototypes and definitions for BRIN page layouts + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/brin_page.h + * + * NOTES + * + * These structs should really be private to specific BRIN files, but it's + * useful to have them here so that they can be used by pageinspect and similar + * tools. + */ +#ifndef BRIN_PAGE_H +#define BRIN_PAGE_H + +#include "storage/block.h" +#include "storage/itemptr.h" + +/* + * Special area of BRIN pages. + * + * We define it in this odd way so that it always occupies the last + * MAXALIGN-sized element of each page. + */ +typedef struct BrinSpecialSpace +{ + uint16 vector[MAXALIGN(1) / sizeof(uint16)]; +} BrinSpecialSpace; + +/* + * Make the page type be the last half-word in the page, for consumption by + * pg_filedump and similar utilities. We don't really care much about the + * position of the "flags" half-word, but it's simpler to apply a consistent + * rule to both. + * + * See comments above GinPageOpaqueData. + */ +#define BrinPageType(page) \ + (((BrinSpecialSpace *) \ + PageGetSpecialPointer(page))->vector[MAXALIGN(1) / sizeof(uint16) - 1]) + +#define BrinPageFlags(page) \ + (((BrinSpecialSpace *) \ + PageGetSpecialPointer(page))->vector[MAXALIGN(1) / sizeof(uint16) - 2]) + +/* special space on all BRIN pages stores a "type" identifier */ +#define BRIN_PAGETYPE_META 0xF091 +#define BRIN_PAGETYPE_REVMAP 0xF092 +#define BRIN_PAGETYPE_REGULAR 0xF093 + +#define BRIN_IS_META_PAGE(page) (BrinPageType(page) == BRIN_PAGETYPE_META) +#define BRIN_IS_REVMAP_PAGE(page) (BrinPageType(page) == BRIN_PAGETYPE_REVMAP) +#define BRIN_IS_REGULAR_PAGE(page) (BrinPageType(page) == BRIN_PAGETYPE_REGULAR) + +/* flags for BrinSpecialSpace */ +#define BRIN_EVACUATE_PAGE (1 << 0) + + +/* Metapage definitions */ +typedef struct BrinMetaPageData +{ + uint32 brinMagic; + uint32 brinVersion; + BlockNumber pagesPerRange; + BlockNumber lastRevmapPage; +} BrinMetaPageData; + +#define BRIN_CURRENT_VERSION 1 +#define BRIN_META_MAGIC 0xA8109CFA + +#define BRIN_METAPAGE_BLKNO 0 + +/* Definitions for revmap pages */ +typedef struct RevmapContents +{ + /* + * This array will fill all available space on the page. It should be + * declared [FLEXIBLE_ARRAY_MEMBER], but for some reason you can't do that + * in an otherwise-empty struct. + */ + ItemPointerData rm_tids[1]; +} RevmapContents; + +#define REVMAP_CONTENT_SIZE \ + (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - \ + offsetof(RevmapContents, rm_tids) - \ + MAXALIGN(sizeof(BrinSpecialSpace))) +/* max num of items in the array */ +#define REVMAP_PAGE_MAXITEMS \ + (REVMAP_CONTENT_SIZE / sizeof(ItemPointerData)) + +#endif /* BRIN_PAGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_pageops.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_pageops.h new file mode 100644 index 0000000..be34376 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_pageops.h @@ -0,0 +1,38 @@ +/* + * brin_pageops.h + * Prototypes for operating on BRIN pages. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/brin_pageops.h + */ +#ifndef BRIN_PAGEOPS_H +#define BRIN_PAGEOPS_H + +#include "access/brin_revmap.h" + +extern bool brin_doupdate(Relation idxrel, BlockNumber pagesPerRange, + BrinRevmap *revmap, BlockNumber heapBlk, + Buffer oldbuf, OffsetNumber oldoff, + const BrinTuple *origtup, Size origsz, + const BrinTuple *newtup, Size newsz, + bool samepage); +extern bool brin_can_do_samepage_update(Buffer buffer, Size origsz, + Size newsz); +extern OffsetNumber brin_doinsert(Relation idxrel, BlockNumber pagesPerRange, + BrinRevmap *revmap, Buffer *buffer, BlockNumber heapBlk, + BrinTuple *tup, Size itemsz); + +extern void brin_page_init(Page page, uint16 type); +extern void brin_metapage_init(Page page, BlockNumber pagesPerRange, + uint16 version); + +extern bool brin_start_evacuating_page(Relation idxRel, Buffer buf); +extern void brin_evacuate_page(Relation idxRel, BlockNumber pagesPerRange, + BrinRevmap *revmap, Buffer buf); + +extern void brin_page_cleanup(Relation idxrel, Buffer buf); + +#endif /* BRIN_PAGEOPS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_revmap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_revmap.h new file mode 100644 index 0000000..b88473c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_revmap.h @@ -0,0 +1,41 @@ +/* + * brin_revmap.h + * Prototypes for BRIN reverse range maps + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/brin_revmap.h + */ + +#ifndef BRIN_REVMAP_H +#define BRIN_REVMAP_H + +#include "access/brin_tuple.h" +#include "storage/block.h" +#include "storage/buf.h" +#include "storage/itemptr.h" +#include "storage/off.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + +/* struct definition lives in brin_revmap.c */ +typedef struct BrinRevmap BrinRevmap; + +extern BrinRevmap *brinRevmapInitialize(Relation idxrel, + BlockNumber *pagesPerRange); +extern void brinRevmapTerminate(BrinRevmap *revmap); + +extern void brinRevmapExtend(BrinRevmap *revmap, + BlockNumber heapBlk); +extern Buffer brinLockRevmapPageForUpdate(BrinRevmap *revmap, + BlockNumber heapBlk); +extern void brinSetHeapBlockItemptr(Buffer buf, BlockNumber pagesPerRange, + BlockNumber heapBlk, ItemPointerData tid); +extern BrinTuple *brinGetTupleForHeapBlock(BrinRevmap *revmap, + BlockNumber heapBlk, Buffer *buf, OffsetNumber *off, + Size *size, int mode); +extern bool brinRevmapDesummarizeRange(Relation idxrel, BlockNumber heapBlk); + +#endif /* BRIN_REVMAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_tuple.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_tuple.h new file mode 100644 index 0000000..010ba4e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_tuple.h @@ -0,0 +1,112 @@ +/* + * brin_tuple.h + * Declarations for dealing with BRIN-specific tuples. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/brin_tuple.h + */ +#ifndef BRIN_TUPLE_H +#define BRIN_TUPLE_H + +#include "access/brin_internal.h" +#include "access/tupdesc.h" + +/* + * The BRIN opclasses may register serialization callback, in case the on-disk + * and in-memory representations differ (e.g. for performance reasons). + */ +typedef void (*brin_serialize_callback_type) (BrinDesc *bdesc, Datum src, Datum *dst); + +/* + * A BRIN index stores one index tuple per page range. Each index tuple + * has one BrinValues struct for each indexed column; in turn, each BrinValues + * has (besides the null flags) an array of Datum whose size is determined by + * the opclass. + */ +typedef struct BrinValues +{ + AttrNumber bv_attno; /* index attribute number */ + bool bv_hasnulls; /* are there any nulls in the page range? */ + bool bv_allnulls; /* are all values nulls in the page range? */ + Datum *bv_values; /* current accumulated values */ + Datum bv_mem_value; /* expanded accumulated values */ + MemoryContext bv_context; + brin_serialize_callback_type bv_serialize; +} BrinValues; + +/* + * This struct is used to represent an in-memory index tuple. The values can + * only be meaningfully decoded with an appropriate BrinDesc. + */ +typedef struct BrinMemTuple +{ + bool bt_placeholder; /* this is a placeholder tuple */ + bool bt_empty_range; /* range represents no tuples */ + BlockNumber bt_blkno; /* heap blkno that the tuple is for */ + MemoryContext bt_context; /* memcxt holding the bt_columns values */ + /* output arrays for brin_deform_tuple: */ + Datum *bt_values; /* values array */ + bool *bt_allnulls; /* allnulls array */ + bool *bt_hasnulls; /* hasnulls array */ + /* not an output array, but must be last */ + BrinValues bt_columns[FLEXIBLE_ARRAY_MEMBER]; +} BrinMemTuple; + +/* + * An on-disk BRIN tuple. This is possibly followed by a nulls bitmask, with + * room for 2 null bits (two bits for each indexed column); an opclass-defined + * number of Datum values for each column follow. + */ +typedef struct BrinTuple +{ + /* heap block number that the tuple is for */ + BlockNumber bt_blkno; + + /* --------------- + * bt_info is laid out in the following fashion: + * + * 7th (high) bit: has nulls + * 6th bit: is placeholder tuple + * 5th bit: range is empty + * 4-0 bit: offset of data + * --------------- + */ + uint8 bt_info; +} BrinTuple; + +#define SizeOfBrinTuple (offsetof(BrinTuple, bt_info) + sizeof(uint8)) + +/* + * bt_info manipulation macros + */ +#define BRIN_OFFSET_MASK 0x1F +#define BRIN_EMPTY_RANGE_MASK 0x20 +#define BRIN_PLACEHOLDER_MASK 0x40 +#define BRIN_NULLS_MASK 0x80 + +#define BrinTupleDataOffset(tup) ((Size) (((BrinTuple *) (tup))->bt_info & BRIN_OFFSET_MASK)) +#define BrinTupleHasNulls(tup) (((((BrinTuple *) (tup))->bt_info & BRIN_NULLS_MASK)) != 0) +#define BrinTupleIsPlaceholder(tup) (((((BrinTuple *) (tup))->bt_info & BRIN_PLACEHOLDER_MASK)) != 0) +#define BrinTupleIsEmptyRange(tup) (((((BrinTuple *) (tup))->bt_info & BRIN_EMPTY_RANGE_MASK)) != 0) + + +extern BrinTuple *brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, + BrinMemTuple *tuple, Size *size); +extern BrinTuple *brin_form_placeholder_tuple(BrinDesc *brdesc, + BlockNumber blkno, Size *size); +extern void brin_free_tuple(BrinTuple *tuple); +extern BrinTuple *brin_copy_tuple(BrinTuple *tuple, Size len, + BrinTuple *dest, Size *destsz); +extern bool brin_tuples_equal(const BrinTuple *a, Size alen, + const BrinTuple *b, Size blen); + +extern BrinMemTuple *brin_new_memtuple(BrinDesc *brdesc); +extern BrinMemTuple *brin_memtuple_initialize(BrinMemTuple *dtuple, + BrinDesc *brdesc); +extern BrinMemTuple *brin_deform_tuple(BrinDesc *brdesc, + BrinTuple *tuple, BrinMemTuple *dMemtuple); + +#endif /* BRIN_TUPLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_xlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_xlog.h new file mode 100644 index 0000000..992b057 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/brin_xlog.h @@ -0,0 +1,151 @@ +/*------------------------------------------------------------------------- + * + * brin_xlog.h + * POSTGRES BRIN access XLOG definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/brin_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef BRIN_XLOG_H +#define BRIN_XLOG_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/bufpage.h" +#include "storage/itemptr.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" + + +/* + * WAL record definitions for BRIN's WAL operations + * + * XLOG allows to store some information in high 4 bits of log + * record xl_info field. + */ +#define XLOG_BRIN_CREATE_INDEX 0x00 +#define XLOG_BRIN_INSERT 0x10 +#define XLOG_BRIN_UPDATE 0x20 +#define XLOG_BRIN_SAMEPAGE_UPDATE 0x30 +#define XLOG_BRIN_REVMAP_EXTEND 0x40 +#define XLOG_BRIN_DESUMMARIZE 0x50 + +#define XLOG_BRIN_OPMASK 0x70 +/* + * When we insert the first item on a new page, we restore the entire page in + * redo. + */ +#define XLOG_BRIN_INIT_PAGE 0x80 + +/* + * This is what we need to know about a BRIN index create. + * + * Backup block 0: metapage + */ +typedef struct xl_brin_createidx +{ + BlockNumber pagesPerRange; + uint16 version; +} xl_brin_createidx; +#define SizeOfBrinCreateIdx (offsetof(xl_brin_createidx, version) + sizeof(uint16)) + +/* + * This is what we need to know about a BRIN tuple insert + * + * Backup block 0: main page, block data is the new BrinTuple. + * Backup block 1: revmap page + */ +typedef struct xl_brin_insert +{ + BlockNumber heapBlk; + + /* extra information needed to update the revmap */ + BlockNumber pagesPerRange; + + /* offset number in the main page to insert the tuple to. */ + OffsetNumber offnum; +} xl_brin_insert; + +#define SizeOfBrinInsert (offsetof(xl_brin_insert, offnum) + sizeof(OffsetNumber)) + +/* + * A cross-page update is the same as an insert, but also stores information + * about the old tuple. + * + * Like in xl_brin_insert: + * Backup block 0: new page, block data includes the new BrinTuple. + * Backup block 1: revmap page + * + * And in addition: + * Backup block 2: old page + */ +typedef struct xl_brin_update +{ + /* offset number of old tuple on old page */ + OffsetNumber oldOffnum; + + xl_brin_insert insert; +} xl_brin_update; + +#define SizeOfBrinUpdate (offsetof(xl_brin_update, insert) + SizeOfBrinInsert) + +/* + * This is what we need to know about a BRIN tuple samepage update + * + * Backup block 0: updated page, with new BrinTuple as block data + */ +typedef struct xl_brin_samepage_update +{ + OffsetNumber offnum; +} xl_brin_samepage_update; + +#define SizeOfBrinSamepageUpdate (sizeof(OffsetNumber)) + +/* + * This is what we need to know about a revmap extension + * + * Backup block 0: metapage + * Backup block 1: new revmap page + */ +typedef struct xl_brin_revmap_extend +{ + /* + * XXX: This is actually redundant - the block number is stored as part of + * backup block 1. + */ + BlockNumber targetBlk; +} xl_brin_revmap_extend; + +#define SizeOfBrinRevmapExtend (offsetof(xl_brin_revmap_extend, targetBlk) + \ + sizeof(BlockNumber)) + +/* + * This is what we need to know about a range de-summarization + * + * Backup block 0: revmap page + * Backup block 1: regular page + */ +typedef struct xl_brin_desummarize +{ + BlockNumber pagesPerRange; + /* page number location to set to invalid */ + BlockNumber heapBlk; + /* offset of item to delete in regular index page */ + OffsetNumber regOffset; +} xl_brin_desummarize; + +#define SizeOfBrinDesummarize (offsetof(xl_brin_desummarize, regOffset) + \ + sizeof(OffsetNumber)) + + +extern void brin_redo(XLogReaderState *record); +extern void brin_desc(StringInfo buf, XLogReaderState *record); +extern const char *brin_identify(uint8 info); +extern void brin_mask(char *pagedata, BlockNumber blkno); + +#endif /* BRIN_XLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/bufmask.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/bufmask.h new file mode 100644 index 0000000..b6632cf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/bufmask.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * bufmask.h + * Definitions for buffer masking routines, used to mask certain bits + * in a page which can be different when the WAL is generated + * and when the WAL is applied. This is really the job of each + * individual rmgr, but we make things easier by providing some + * common routines to handle cases which occur in multiple rmgrs. + * + * Portions Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/access/bufmask.h + * + *------------------------------------------------------------------------- + */ + +#ifndef BUFMASK_H +#define BUFMASK_H + +#include "storage/block.h" +#include "storage/bufmgr.h" + +/* Marker used to mask pages consistently */ +#define MASK_MARKER 0 + +extern void mask_page_lsn_and_checksum(Page page); +extern void mask_page_hint_bits(Page page); +extern void mask_unused_space(Page page); +extern void mask_lp_flags(Page page); +extern void mask_page_content(Page page); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/clog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/clog.h new file mode 100644 index 0000000..7eb3ffe --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/clog.h @@ -0,0 +1,62 @@ +/* + * clog.h + * + * PostgreSQL transaction-commit-log manager + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/clog.h + */ +#ifndef CLOG_H +#define CLOG_H + +#include "access/xlogreader.h" +#include "storage/sync.h" +#include "lib/stringinfo.h" + +/* + * Possible transaction statuses --- note that all-zeroes is the initial + * state. + * + * A "subcommitted" transaction is a committed subtransaction whose parent + * hasn't committed or aborted yet. + */ +typedef int XidStatus; + +#define TRANSACTION_STATUS_IN_PROGRESS 0x00 +#define TRANSACTION_STATUS_COMMITTED 0x01 +#define TRANSACTION_STATUS_ABORTED 0x02 +#define TRANSACTION_STATUS_SUB_COMMITTED 0x03 + +typedef struct xl_clog_truncate +{ + int64 pageno; + TransactionId oldestXact; + Oid oldestXactDb; +} xl_clog_truncate; + +extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, + TransactionId *subxids, XidStatus status, XLogRecPtr lsn); +extern XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn); + +extern Size CLOGShmemSize(void); +extern void CLOGShmemInit(void); +extern void BootStrapCLOG(void); +extern void StartupCLOG(void); +extern void TrimCLOG(void); +extern void CheckPointCLOG(void); +extern void ExtendCLOG(TransactionId newestXact); +extern void TruncateCLOG(TransactionId oldestXact, Oid oldestxid_datoid); + +extern int clogsyncfiletag(const FileTag *ftag, char *path); + +/* XLOG stuff */ +#define CLOG_ZEROPAGE 0x00 +#define CLOG_TRUNCATE 0x10 + +extern void clog_redo(XLogReaderState *record); +extern void clog_desc(StringInfo buf, XLogReaderState *record); +extern const char *clog_identify(uint8 info); + +#endif /* CLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/cmptype.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/cmptype.h new file mode 100644 index 0000000..ed6da1e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/cmptype.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * cmptype.h + * POSTGRES compare type definitions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/cmptype.h + * + *------------------------------------------------------------------------- + */ +#ifndef CMPTYPE_H +#define CMPTYPE_H + +/* + * CompareType - fundamental semantics of certain operators + * + * These enum symbols represent the fundamental semantics of certain operators + * that the system needs to have some hardcoded knowledge about. (For + * example, RowCompareExpr needs to know which operators can be determined to + * act like =, <>, <, etc.) Index access methods map (some of) strategy + * numbers to these values so that the system can know about the meaning of + * (some of) the operators without needing hardcoded knowledge of index AM's + * strategy numbering. + * + * XXX Currently, this mapping is not fully developed and most values are + * chosen to match btree strategy numbers, which is not going to work very + * well for other access methods. + */ +typedef enum CompareType +{ + COMPARE_INVALID = 0, + COMPARE_LT = 1, /* BTLessStrategyNumber */ + COMPARE_LE = 2, /* BTLessEqualStrategyNumber */ + COMPARE_EQ = 3, /* BTEqualStrategyNumber */ + COMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */ + COMPARE_GT = 5, /* BTGreaterStrategyNumber */ + COMPARE_NE = 6, /* no such btree strategy */ + COMPARE_OVERLAP, + COMPARE_CONTAINED_BY, +} CompareType; + +#endif /* CMPTYPE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/commit_ts.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/commit_ts.h new file mode 100644 index 0000000..b8294e4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/commit_ts.h @@ -0,0 +1,73 @@ +/* + * commit_ts.h + * + * PostgreSQL commit timestamp manager + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/commit_ts.h + */ +#ifndef COMMIT_TS_H +#define COMMIT_TS_H + +#include "access/xlog.h" +#include "datatype/timestamp.h" +#include "replication/origin.h" +#include "storage/sync.h" + + +extern PGDLLIMPORT bool track_commit_timestamp; + +extern void TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids, + TransactionId *subxids, TimestampTz timestamp, + RepOriginId nodeid); +extern bool TransactionIdGetCommitTsData(TransactionId xid, + TimestampTz *ts, RepOriginId *nodeid); +extern TransactionId GetLatestCommitTsData(TimestampTz *ts, + RepOriginId *nodeid); + +extern Size CommitTsShmemSize(void); +extern void CommitTsShmemInit(void); +extern void BootStrapCommitTs(void); +extern void StartupCommitTs(void); +extern void CommitTsParameterChange(bool newvalue, bool oldvalue); +extern void CompleteCommitTsInitialization(void); +extern void CheckPointCommitTs(void); +extern void ExtendCommitTs(TransactionId newestXact); +extern void TruncateCommitTs(TransactionId oldestXact); +extern void SetCommitTsLimit(TransactionId oldestXact, + TransactionId newestXact); +extern void AdvanceOldestCommitTsXid(TransactionId oldestXact); + +extern int committssyncfiletag(const FileTag *ftag, char *path); + +/* XLOG stuff */ +#define COMMIT_TS_ZEROPAGE 0x00 +#define COMMIT_TS_TRUNCATE 0x10 + +typedef struct xl_commit_ts_set +{ + TimestampTz timestamp; + RepOriginId nodeid; + TransactionId mainxid; + /* subxact Xids follow */ +} xl_commit_ts_set; + +#define SizeOfCommitTsSet (offsetof(xl_commit_ts_set, mainxid) + \ + sizeof(TransactionId)) + +typedef struct xl_commit_ts_truncate +{ + int64 pageno; + TransactionId oldestXid; +} xl_commit_ts_truncate; + +#define SizeOfCommitTsTruncate (offsetof(xl_commit_ts_truncate, oldestXid) + \ + sizeof(TransactionId)) + +extern void commit_ts_redo(XLogReaderState *record); +extern void commit_ts_desc(StringInfo buf, XLogReaderState *record); +extern const char *commit_ts_identify(uint8 info); + +#endif /* COMMIT_TS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/detoast.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/detoast.h new file mode 100644 index 0000000..e603a22 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/detoast.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------------------- + * + * detoast.h + * Access to compressed and external varlena values. + * + * Copyright (c) 2000-2025, PostgreSQL Global Development Group + * + * src/include/access/detoast.h + * + *------------------------------------------------------------------------- + */ +#ifndef DETOAST_H +#define DETOAST_H + +/* + * Macro to fetch the possibly-unaligned contents of an EXTERNAL datum + * into a local "struct varatt_external" toast pointer. This should be + * just a memcpy, but some versions of gcc seem to produce broken code + * that assumes the datum contents are aligned. Introducing an explicit + * intermediate "varattrib_1b_e *" variable seems to fix it. + */ +#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr) \ +do { \ + varattrib_1b_e *attre = (varattrib_1b_e *) (attr); \ + Assert(VARATT_IS_EXTERNAL(attre)); \ + Assert(VARSIZE_EXTERNAL(attre) == sizeof(toast_pointer) + VARHDRSZ_EXTERNAL); \ + memcpy(&(toast_pointer), VARDATA_EXTERNAL(attre), sizeof(toast_pointer)); \ +} while (0) + +/* Size of an EXTERNAL datum that contains a standard TOAST pointer */ +#define TOAST_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(varatt_external)) + +/* Size of an EXTERNAL datum that contains an indirection pointer */ +#define INDIRECT_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(varatt_indirect)) + +/* ---------- + * detoast_external_attr() - + * + * Fetches an external stored attribute from the toast + * relation. Does NOT decompress it, if stored external + * in compressed format. + * ---------- + */ +extern struct varlena *detoast_external_attr(struct varlena *attr); + +/* ---------- + * detoast_attr() - + * + * Fully detoasts one attribute, fetching and/or decompressing + * it as needed. + * ---------- + */ +extern struct varlena *detoast_attr(struct varlena *attr); + +/* ---------- + * detoast_attr_slice() - + * + * Fetches only the specified portion of an attribute. + * (Handles all cases for attribute storage) + * ---------- + */ +extern struct varlena *detoast_attr_slice(struct varlena *attr, + int32 sliceoffset, + int32 slicelength); + +/* ---------- + * toast_raw_datum_size - + * + * Return the raw (detoasted) size of a varlena datum + * ---------- + */ +extern Size toast_raw_datum_size(Datum value); + +/* ---------- + * toast_datum_size - + * + * Return the storage size of a varlena datum + * ---------- + */ +extern Size toast_datum_size(Datum value); + +#endif /* DETOAST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/genam.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/genam.h new file mode 100644 index 0000000..5b2ab18 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/genam.h @@ -0,0 +1,278 @@ +/*------------------------------------------------------------------------- + * + * genam.h + * POSTGRES generalized index access method definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/genam.h + * + *------------------------------------------------------------------------- + */ +#ifndef GENAM_H +#define GENAM_H + +#include "access/htup.h" +#include "access/sdir.h" +#include "access/skey.h" +#include "nodes/tidbitmap.h" +#include "storage/buf.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + +/* We don't want this file to depend on execnodes.h. */ +struct IndexInfo; + +/* + * Struct for statistics maintained by amgettuple and amgetbitmap + * + * Note: IndexScanInstrumentation can't contain any pointers, since it is + * copied into a SharedIndexScanInstrumentation during parallel scans + */ +typedef struct IndexScanInstrumentation +{ + /* Index search count (incremented with pgstat_count_index_scan call) */ + uint64 nsearches; +} IndexScanInstrumentation; + +/* + * Struct for every worker's IndexScanInstrumentation, stored in shared memory + */ +typedef struct SharedIndexScanInstrumentation +{ + int num_workers; + IndexScanInstrumentation winstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedIndexScanInstrumentation; + +/* + * Struct for statistics returned by ambuild + */ +typedef struct IndexBuildResult +{ + double heap_tuples; /* # of tuples seen in parent table */ + double index_tuples; /* # of tuples inserted into index */ +} IndexBuildResult; + +/* + * Struct for input arguments passed to ambulkdelete and amvacuumcleanup + * + * num_heap_tuples is accurate only when estimated_count is false; + * otherwise it's just an estimate (currently, the estimate is the + * prior value of the relation's pg_class.reltuples field, so it could + * even be -1). It will always just be an estimate during ambulkdelete. + */ +typedef struct IndexVacuumInfo +{ + Relation index; /* the index being vacuumed */ + Relation heaprel; /* the heap relation the index belongs to */ + bool analyze_only; /* ANALYZE (without any actual vacuum) */ + bool report_progress; /* emit progress.h status reports */ + bool estimated_count; /* num_heap_tuples is an estimate */ + int message_level; /* ereport level for progress messages */ + double num_heap_tuples; /* tuples remaining in heap */ + BufferAccessStrategy strategy; /* access strategy for reads */ +} IndexVacuumInfo; + +/* + * Struct for statistics returned by ambulkdelete and amvacuumcleanup + * + * This struct is normally allocated by the first ambulkdelete call and then + * passed along through subsequent ones until amvacuumcleanup; however, + * amvacuumcleanup must be prepared to allocate it in the case where no + * ambulkdelete calls were made (because no tuples needed deletion). + * Note that an index AM could choose to return a larger struct + * of which this is just the first field; this provides a way for ambulkdelete + * to communicate additional private data to amvacuumcleanup. + * + * Note: pages_newly_deleted is the number of pages in the index that were + * deleted by the current vacuum operation. pages_deleted and pages_free + * refer to free space within the index file. + * + * Note: Some index AMs may compute num_index_tuples by reference to + * num_heap_tuples, in which case they should copy the estimated_count field + * from IndexVacuumInfo. + */ +typedef struct IndexBulkDeleteResult +{ + BlockNumber num_pages; /* pages remaining in index */ + bool estimated_count; /* num_index_tuples is an estimate */ + double num_index_tuples; /* tuples remaining */ + double tuples_removed; /* # removed during vacuum operation */ + BlockNumber pages_newly_deleted; /* # pages marked deleted by us */ + BlockNumber pages_deleted; /* # pages marked deleted (could be by us) */ + BlockNumber pages_free; /* # pages available for reuse */ +} IndexBulkDeleteResult; + +/* Typedef for callback function to determine if a tuple is bulk-deletable */ +typedef bool (*IndexBulkDeleteCallback) (ItemPointer itemptr, void *state); + +/* struct definitions appear in relscan.h */ +typedef struct IndexScanDescData *IndexScanDesc; +typedef struct SysScanDescData *SysScanDesc; + +typedef struct ParallelIndexScanDescData *ParallelIndexScanDesc; + +/* + * Enumeration specifying the type of uniqueness check to perform in + * index_insert(). + * + * UNIQUE_CHECK_YES is the traditional Postgres immediate check, possibly + * blocking to see if a conflicting transaction commits. + * + * For deferrable unique constraints, UNIQUE_CHECK_PARTIAL is specified at + * insertion time. The index AM should test if the tuple is unique, but + * should not throw error, block, or prevent the insertion if the tuple + * appears not to be unique. We'll recheck later when it is time for the + * constraint to be enforced. The AM must return true if the tuple is + * known unique, false if it is possibly non-unique. In the "true" case + * it is safe to omit the later recheck. + * + * When it is time to recheck the deferred constraint, a pseudo-insertion + * call is made with UNIQUE_CHECK_EXISTING. The tuple is already in the + * index in this case, so it should not be inserted again. Rather, just + * check for conflicting live tuples (possibly blocking). + */ +typedef enum IndexUniqueCheck +{ + UNIQUE_CHECK_NO, /* Don't do any uniqueness checking */ + UNIQUE_CHECK_YES, /* Enforce uniqueness at insertion time */ + UNIQUE_CHECK_PARTIAL, /* Test uniqueness, but no error */ + UNIQUE_CHECK_EXISTING, /* Check if existing tuple is unique */ +} IndexUniqueCheck; + + +/* Nullable "ORDER BY col op const" distance */ +typedef struct IndexOrderByDistance +{ + double value; + bool isnull; +} IndexOrderByDistance; + +/* + * generalized index_ interface routines (in indexam.c) + */ + +/* + * IndexScanIsValid + * True iff the index scan is valid. + */ +#define IndexScanIsValid(scan) PointerIsValid(scan) + +extern Relation index_open(Oid relationId, LOCKMODE lockmode); +extern Relation try_index_open(Oid relationId, LOCKMODE lockmode); +extern void index_close(Relation relation, LOCKMODE lockmode); + +extern bool index_insert(Relation indexRelation, + Datum *values, bool *isnull, + ItemPointer heap_t_ctid, + Relation heapRelation, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); +extern void index_insert_cleanup(Relation indexRelation, + struct IndexInfo *indexInfo); + +extern IndexScanDesc index_beginscan(Relation heapRelation, + Relation indexRelation, + Snapshot snapshot, + IndexScanInstrumentation *instrument, + int nkeys, int norderbys); +extern IndexScanDesc index_beginscan_bitmap(Relation indexRelation, + Snapshot snapshot, + IndexScanInstrumentation *instrument, + int nkeys); +extern void index_rescan(IndexScanDesc scan, + ScanKey keys, int nkeys, + ScanKey orderbys, int norderbys); +extern void index_endscan(IndexScanDesc scan); +extern void index_markpos(IndexScanDesc scan); +extern void index_restrpos(IndexScanDesc scan); +extern Size index_parallelscan_estimate(Relation indexRelation, + int nkeys, int norderbys, Snapshot snapshot, + bool instrument, bool parallel_aware, + int nworkers); +extern void index_parallelscan_initialize(Relation heapRelation, + Relation indexRelation, Snapshot snapshot, + bool instrument, bool parallel_aware, + int nworkers, + SharedIndexScanInstrumentation **sharedinfo, + ParallelIndexScanDesc target); +extern void index_parallelrescan(IndexScanDesc scan); +extern IndexScanDesc index_beginscan_parallel(Relation heaprel, + Relation indexrel, + IndexScanInstrumentation *instrument, + int nkeys, int norderbys, + ParallelIndexScanDesc pscan); +extern ItemPointer index_getnext_tid(IndexScanDesc scan, + ScanDirection direction); +struct TupleTableSlot; +extern bool index_fetch_heap(IndexScanDesc scan, struct TupleTableSlot *slot); +extern bool index_getnext_slot(IndexScanDesc scan, ScanDirection direction, + struct TupleTableSlot *slot); +extern int64 index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap); + +extern IndexBulkDeleteResult *index_bulk_delete(IndexVacuumInfo *info, + IndexBulkDeleteResult *istat, + IndexBulkDeleteCallback callback, + void *callback_state); +extern IndexBulkDeleteResult *index_vacuum_cleanup(IndexVacuumInfo *info, + IndexBulkDeleteResult *istat); +extern bool index_can_return(Relation indexRelation, int attno); +extern RegProcedure index_getprocid(Relation irel, AttrNumber attnum, + uint16 procnum); +extern FmgrInfo *index_getprocinfo(Relation irel, AttrNumber attnum, + uint16 procnum); +extern void index_store_float8_orderby_distances(IndexScanDesc scan, + Oid *orderByTypes, + IndexOrderByDistance *distances, + bool recheckOrderBy); +extern bytea *index_opclass_options(Relation indrel, AttrNumber attnum, + Datum attoptions, bool validate); + + +/* + * index access method support routines (in genam.c) + */ +extern IndexScanDesc RelationGetIndexScan(Relation indexRelation, + int nkeys, int norderbys); +extern void IndexScanEnd(IndexScanDesc scan); +extern char *BuildIndexValueDescription(Relation indexRelation, + const Datum *values, const bool *isnull); +extern TransactionId index_compute_xid_horizon_for_tuples(Relation irel, + Relation hrel, + Buffer ibuf, + OffsetNumber *itemnos, + int nitems); + +/* + * heap-or-index access to system catalogs (in genam.c) + */ +extern SysScanDesc systable_beginscan(Relation heapRelation, + Oid indexId, + bool indexOK, + Snapshot snapshot, + int nkeys, ScanKey key); +extern HeapTuple systable_getnext(SysScanDesc sysscan); +extern bool systable_recheck_tuple(SysScanDesc sysscan, HeapTuple tup); +extern void systable_endscan(SysScanDesc sysscan); +extern SysScanDesc systable_beginscan_ordered(Relation heapRelation, + Relation indexRelation, + Snapshot snapshot, + int nkeys, ScanKey key); +extern HeapTuple systable_getnext_ordered(SysScanDesc sysscan, + ScanDirection direction); +extern void systable_endscan_ordered(SysScanDesc sysscan); +extern void systable_inplace_update_begin(Relation relation, + Oid indexId, + bool indexOK, + Snapshot snapshot, + int nkeys, const ScanKeyData *key, + HeapTuple *oldtupcopy, + void **state); +extern void systable_inplace_update_finish(void *state, HeapTuple tuple); +extern void systable_inplace_update_cancel(void *state); + +#endif /* GENAM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/generic_xlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/generic_xlog.h new file mode 100644 index 0000000..4d1cbab --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/generic_xlog.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * generic_xlog.h + * Generic xlog API definition. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/generic_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef GENERIC_XLOG_H +#define GENERIC_XLOG_H + +#include "access/xlog.h" +#include "access/xlogreader.h" +#include "access/xloginsert.h" +#include "storage/bufpage.h" +#include "utils/rel.h" + +#define MAX_GENERIC_XLOG_PAGES XLR_NORMAL_MAX_BLOCK_ID + +/* Flag bits for GenericXLogRegisterBuffer */ +#define GENERIC_XLOG_FULL_IMAGE 0x0001 /* write full-page image */ + +/* state of generic xlog record construction */ +struct GenericXLogState; +typedef struct GenericXLogState GenericXLogState; + +/* API for construction of generic xlog records */ +extern GenericXLogState *GenericXLogStart(Relation relation); +extern Page GenericXLogRegisterBuffer(GenericXLogState *state, Buffer buffer, + int flags); +extern XLogRecPtr GenericXLogFinish(GenericXLogState *state); +extern void GenericXLogAbort(GenericXLogState *state); + +/* functions defined for rmgr */ +extern void generic_redo(XLogReaderState *record); +extern const char *generic_identify(uint8 info); +extern void generic_desc(StringInfo buf, XLogReaderState *record); +extern void generic_mask(char *page, BlockNumber blkno); + +#endif /* GENERIC_XLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gin.h new file mode 100644 index 0000000..2e1076a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gin.h @@ -0,0 +1,106 @@ +/*-------------------------------------------------------------------------- + * gin.h + * Public header file for Generalized Inverted Index access method. + * + * Copyright (c) 2006-2025, PostgreSQL Global Development Group + * + * src/include/access/gin.h + *-------------------------------------------------------------------------- + */ +#ifndef GIN_H +#define GIN_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "nodes/execnodes.h" +#include "storage/shm_toc.h" +#include "storage/block.h" +#include "utils/relcache.h" + + +/* + * amproc indexes for inverted indexes. + */ +#define GIN_COMPARE_PROC 1 +#define GIN_EXTRACTVALUE_PROC 2 +#define GIN_EXTRACTQUERY_PROC 3 +#define GIN_CONSISTENT_PROC 4 +#define GIN_COMPARE_PARTIAL_PROC 5 +#define GIN_TRICONSISTENT_PROC 6 +#define GIN_OPTIONS_PROC 7 +#define GINNProcs 7 + +/* + * searchMode settings for extractQueryFn. + */ +#define GIN_SEARCH_MODE_DEFAULT 0 +#define GIN_SEARCH_MODE_INCLUDE_EMPTY 1 +#define GIN_SEARCH_MODE_ALL 2 +#define GIN_SEARCH_MODE_EVERYTHING 3 /* for internal use only */ + +/* + * Constant definition for progress reporting. Phase numbers must match + * ginbuildphasename. + */ +/* PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE is 1 (see progress.h) */ +#define PROGRESS_GIN_PHASE_INDEXBUILD_TABLESCAN 2 +#define PROGRESS_GIN_PHASE_PERFORMSORT_1 3 +#define PROGRESS_GIN_PHASE_MERGE_1 4 +#define PROGRESS_GIN_PHASE_PERFORMSORT_2 5 +#define PROGRESS_GIN_PHASE_MERGE_2 6 + +/* + * GinStatsData represents stats data for planner use + */ +typedef struct GinStatsData +{ + BlockNumber nPendingPages; + BlockNumber nTotalPages; + BlockNumber nEntryPages; + BlockNumber nDataPages; + int64 nEntries; + int32 ginVersion; +} GinStatsData; + +/* + * A ternary value used by tri-consistent functions. + * + * This must be of the same size as a bool because some code will cast a + * pointer to a bool to a pointer to a GinTernaryValue. + */ +typedef char GinTernaryValue; + +StaticAssertDecl(sizeof(GinTernaryValue) == sizeof(bool), + "sizes of GinTernaryValue and bool are not equal"); + +#define GIN_FALSE 0 /* item is not present / does not match */ +#define GIN_TRUE 1 /* item is present / matches */ +#define GIN_MAYBE 2 /* don't know if item is present / don't know + * if matches */ + +static inline GinTernaryValue +DatumGetGinTernaryValue(Datum X) +{ + return (GinTernaryValue) X; +} + +static inline Datum +GinTernaryValueGetDatum(GinTernaryValue X) +{ + return (Datum) X; +} + +#define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x) + +/* GUC parameters */ +extern PGDLLIMPORT int GinFuzzySearchLimit; +extern PGDLLIMPORT int gin_pending_list_limit; + +/* ginutil.c */ +extern void ginGetStats(Relation index, GinStatsData *stats); +extern void ginUpdateStats(Relation index, const GinStatsData *stats, + bool is_build); + +extern void _gin_parallel_build_main(dsm_segment *seg, shm_toc *toc); + +#endif /* GIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gin_private.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gin_private.h new file mode 100644 index 0000000..aee1f70 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gin_private.h @@ -0,0 +1,506 @@ +/*-------------------------------------------------------------------------- + * gin_private.h + * header file for postgres inverted index access method implementation. + * + * Copyright (c) 2006-2025, PostgreSQL Global Development Group + * + * src/include/access/gin_private.h + *-------------------------------------------------------------------------- + */ +#ifndef GIN_PRIVATE_H +#define GIN_PRIVATE_H + +#include "access/amapi.h" +#include "access/gin.h" +#include "access/ginblock.h" +#include "access/itup.h" +#include "common/int.h" +#include "catalog/pg_am_d.h" +#include "fmgr.h" +#include "lib/rbtree.h" +#include "storage/bufmgr.h" + +/* + * Storage type for GIN's reloptions + */ +typedef struct GinOptions +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + bool useFastUpdate; /* use fast updates? */ + int pendingListCleanupSize; /* maximum size of pending list */ +} GinOptions; + +#define GIN_DEFAULT_USE_FASTUPDATE true +#define GinGetUseFastUpdate(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == GIN_AM_OID), \ + (relation)->rd_options ? \ + ((GinOptions *) (relation)->rd_options)->useFastUpdate : GIN_DEFAULT_USE_FASTUPDATE) +#define GinGetPendingListCleanupSize(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == GIN_AM_OID), \ + (relation)->rd_options && \ + ((GinOptions *) (relation)->rd_options)->pendingListCleanupSize != -1 ? \ + ((GinOptions *) (relation)->rd_options)->pendingListCleanupSize : \ + gin_pending_list_limit) + + +/* Macros for buffer lock/unlock operations */ +#define GIN_UNLOCK BUFFER_LOCK_UNLOCK +#define GIN_SHARE BUFFER_LOCK_SHARE +#define GIN_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE + + +/* + * GinState: working data structure describing the index being worked on + */ +typedef struct GinState +{ + Relation index; + bool oneCol; /* true if single-column index */ + + /* + * origTupdesc is the nominal tuple descriptor of the index, ie, the i'th + * attribute shows the key type (not the input data type!) of the i'th + * index column. In a single-column index this describes the actual leaf + * index tuples. In a multi-column index, the actual leaf tuples contain + * a smallint column number followed by a key datum of the appropriate + * type for that column. We set up tupdesc[i] to describe the actual + * rowtype of the index tuples for the i'th column, ie, (int2, keytype). + * Note that in any case, leaf tuples contain more data than is known to + * the TupleDesc; see access/gin/README for details. + */ + TupleDesc origTupdesc; + TupleDesc tupdesc[INDEX_MAX_KEYS]; + + /* + * Per-index-column opclass support functions + */ + FmgrInfo compareFn[INDEX_MAX_KEYS]; + FmgrInfo extractValueFn[INDEX_MAX_KEYS]; + FmgrInfo extractQueryFn[INDEX_MAX_KEYS]; + FmgrInfo consistentFn[INDEX_MAX_KEYS]; + FmgrInfo triConsistentFn[INDEX_MAX_KEYS]; + FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */ + /* canPartialMatch[i] is true if comparePartialFn[i] is valid */ + bool canPartialMatch[INDEX_MAX_KEYS]; + /* Collations to pass to the support functions */ + Oid supportCollation[INDEX_MAX_KEYS]; +} GinState; + + +/* ginutil.c */ +extern bytea *ginoptions(Datum reloptions, bool validate); +extern void initGinState(GinState *state, Relation index); +extern Buffer GinNewBuffer(Relation index); +extern void GinInitBuffer(Buffer b, uint32 f); +extern void GinInitPage(Page page, uint32 f, Size pageSize); +extern void GinInitMetabuffer(Buffer b); +extern int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, + Datum a, GinNullCategory categorya, + Datum b, GinNullCategory categoryb); +extern int ginCompareAttEntries(GinState *ginstate, + OffsetNumber attnuma, Datum a, GinNullCategory categorya, + OffsetNumber attnumb, Datum b, GinNullCategory categoryb); +extern Datum *ginExtractEntries(GinState *ginstate, OffsetNumber attnum, + Datum value, bool isNull, + int32 *nentries, GinNullCategory **categories); + +extern OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple); +extern Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple, + GinNullCategory *category); +extern char *ginbuildphasename(int64 phasenum); + +/* gininsert.c */ +extern IndexBuildResult *ginbuild(Relation heap, Relation index, + struct IndexInfo *indexInfo); +extern void ginbuildempty(Relation index); +extern bool gininsert(Relation index, Datum *values, bool *isnull, + ItemPointer ht_ctid, Relation heapRel, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); +extern void ginEntryInsert(GinState *ginstate, + OffsetNumber attnum, Datum key, GinNullCategory category, + ItemPointerData *items, uint32 nitem, + GinStatsData *buildStats); + +/* ginbtree.c */ + +typedef struct GinBtreeStack +{ + BlockNumber blkno; + Buffer buffer; + OffsetNumber off; + ItemPointerData iptr; + /* predictNumber contains predicted number of pages on current level */ + uint32 predictNumber; + struct GinBtreeStack *parent; +} GinBtreeStack; + +typedef struct GinBtreeData *GinBtree; + +/* Return codes for GinBtreeData.beginPlaceToPage method */ +typedef enum +{ + GPTP_NO_WORK, + GPTP_INSERT, + GPTP_SPLIT, +} GinPlaceToPageRC; + +typedef struct GinBtreeData +{ + /* search methods */ + BlockNumber (*findChildPage) (GinBtree, GinBtreeStack *); + BlockNumber (*getLeftMostChild) (GinBtree, Page); + bool (*isMoveRight) (GinBtree, Page); + bool (*findItem) (GinBtree, GinBtreeStack *); + + /* insert methods */ + OffsetNumber (*findChildPtr) (GinBtree, Page, BlockNumber, OffsetNumber); + GinPlaceToPageRC (*beginPlaceToPage) (GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void **, Page *, Page *); + void (*execPlaceToPage) (GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void *); + void *(*prepareDownlink) (GinBtree, Buffer); + void (*fillRoot) (GinBtree, Page, BlockNumber, Page, BlockNumber, Page); + + bool isData; + + Relation index; + BlockNumber rootBlkno; + GinState *ginstate; /* not valid in a data scan */ + bool fullScan; + bool isBuild; + + /* Search key for Entry tree */ + OffsetNumber entryAttnum; + Datum entryKey; + GinNullCategory entryCategory; + + /* Search key for data tree (posting tree) */ + ItemPointerData itemptr; +} GinBtreeData; + +/* This represents a tuple to be inserted to entry tree. */ +typedef struct +{ + IndexTuple entry; /* tuple to insert */ + bool isDelete; /* delete old tuple at same offset? */ +} GinBtreeEntryInsertData; + +/* + * This represents an itempointer, or many itempointers, to be inserted to + * a data (posting tree) leaf page + */ +typedef struct +{ + ItemPointerData *items; + uint32 nitem; + uint32 curitem; +} GinBtreeDataLeafInsertData; + +/* + * For internal data (posting tree) pages, the insertion payload is a + * PostingItem + */ + +extern GinBtreeStack *ginFindLeafPage(GinBtree btree, bool searchMode, + bool rootConflictCheck); +extern Buffer ginStepRight(Buffer buffer, Relation index, int lockmode); +extern void freeGinBtreeStack(GinBtreeStack *stack); +extern void ginInsertValue(GinBtree btree, GinBtreeStack *stack, + void *insertdata, GinStatsData *buildStats); + +/* ginentrypage.c */ +extern IndexTuple GinFormTuple(GinState *ginstate, + OffsetNumber attnum, Datum key, GinNullCategory category, + Pointer data, Size dataSize, int nipd, bool errorTooBig); +extern void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum, + Datum key, GinNullCategory category, + GinState *ginstate); +extern void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage); +extern ItemPointer ginReadTuple(GinState *ginstate, OffsetNumber attnum, + IndexTuple itup, int *nitems); + +/* gindatapage.c */ +extern ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast); +extern int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm); +extern BlockNumber createPostingTree(Relation index, + ItemPointerData *items, uint32 nitems, + GinStatsData *buildStats, Buffer entrybuffer); +extern void GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset); +extern void GinPageDeletePostingItem(Page page, OffsetNumber offset); +extern void ginInsertItemPointers(Relation index, BlockNumber rootBlkno, + ItemPointerData *items, uint32 nitem, + GinStatsData *buildStats); +extern GinBtreeStack *ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno); +extern void ginDataFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage); + +/* + * This is declared in ginvacuum.c, but is passed between ginVacuumItemPointers + * and ginVacuumPostingTreeLeaf and as an opaque struct, so we need a forward + * declaration for it. + */ +typedef struct GinVacuumState GinVacuumState; + +extern void ginVacuumPostingTreeLeaf(Relation indexrel, Buffer buffer, + GinVacuumState *gvs); + +/* ginscan.c */ + +/* + * GinScanKeyData describes a single GIN index qualifier expression. + * + * From each qual expression, we extract one or more specific index search + * conditions, which are represented by GinScanEntryData. It's quite + * possible for identical search conditions to be requested by more than + * one qual expression, in which case we merge such conditions to have just + * one unique GinScanEntry --- this is particularly important for efficiency + * when dealing with full-index-scan entries. So there can be multiple + * GinScanKeyData.scanEntry pointers to the same GinScanEntryData. + * + * In each GinScanKeyData, nentries is the true number of entries, while + * nuserentries is the number that extractQueryFn returned (which is what + * we report to consistentFn). The "user" entries must come first. + */ +typedef struct GinScanKeyData *GinScanKey; + +typedef struct GinScanEntryData *GinScanEntry; + +typedef struct GinScanKeyData +{ + /* Real number of entries in scanEntry[] (always > 0) */ + uint32 nentries; + /* Number of entries that extractQueryFn and consistentFn know about */ + uint32 nuserentries; + + /* array of GinScanEntry pointers, one per extracted search condition */ + GinScanEntry *scanEntry; + + /* + * At least one of the entries in requiredEntries must be present for a + * tuple to match the overall qual. + * + * additionalEntries contains entries that are needed by the consistent + * function to decide if an item matches, but are not sufficient to + * satisfy the qual without entries from requiredEntries. + */ + GinScanEntry *requiredEntries; + int nrequired; + GinScanEntry *additionalEntries; + int nadditional; + + /* array of check flags, reported to consistentFn */ + GinTernaryValue *entryRes; + bool (*boolConsistentFn) (GinScanKey key); + GinTernaryValue (*triConsistentFn) (GinScanKey key); + FmgrInfo *consistentFmgrInfo; + FmgrInfo *triConsistentFmgrInfo; + Oid collation; + + /* other data needed for calling consistentFn */ + Datum query; + /* NB: these three arrays have only nuserentries elements! */ + Datum *queryValues; + GinNullCategory *queryCategories; + Pointer *extra_data; + StrategyNumber strategy; + int32 searchMode; + OffsetNumber attnum; + + /* + * An excludeOnly scan key is not able to enumerate all matching tuples. + * That is, to be semantically correct on its own, it would need to have a + * GIN_CAT_EMPTY_QUERY scanEntry, but it doesn't. Such a key can still be + * used to filter tuples returned by other scan keys, so we will get the + * right answers as long as there's at least one non-excludeOnly scan key + * for each index attribute considered by the search. For efficiency + * reasons we don't want to have unnecessary GIN_CAT_EMPTY_QUERY entries, + * so we will convert an excludeOnly scan key to non-excludeOnly (by + * adding a GIN_CAT_EMPTY_QUERY scanEntry) only if there are no other + * non-excludeOnly scan keys. + */ + bool excludeOnly; + + /* + * Match status data. curItem is the TID most recently tested (could be a + * lossy-page pointer). curItemMatches is true if it passes the + * consistentFn test; if so, recheckCurItem is the recheck flag. + * isFinished means that all the input entry streams are finished, so this + * key cannot succeed for any later TIDs. + */ + ItemPointerData curItem; + bool curItemMatches; + bool recheckCurItem; + bool isFinished; +} GinScanKeyData; + +typedef struct GinScanEntryData +{ + /* query key and other information from extractQueryFn */ + Datum queryKey; + GinNullCategory queryCategory; + bool isPartialMatch; + Pointer extra_data; + StrategyNumber strategy; + int32 searchMode; + OffsetNumber attnum; + + /* Current page in posting tree */ + Buffer buffer; + + /* current ItemPointer to heap */ + ItemPointerData curItem; + + /* for a partial-match or full-scan query, we accumulate all TIDs here */ + TIDBitmap *matchBitmap; + TBMPrivateIterator *matchIterator; + + /* + * If blockno is InvalidBlockNumber, all of the other fields in the + * matchResult are meaningless. + */ + TBMIterateResult matchResult; + OffsetNumber matchOffsets[TBM_MAX_TUPLES_PER_PAGE]; + int matchNtuples; + + /* used for Posting list and one page in Posting tree */ + ItemPointerData *list; + int nlist; + OffsetNumber offset; + + bool isFinished; + bool reduceResult; + uint32 predictNumberResult; + GinBtreeData btree; +} GinScanEntryData; + +typedef struct GinScanOpaqueData +{ + MemoryContext tempCtx; + GinState ginstate; + + GinScanKey keys; /* one per scan qualifier expr */ + uint32 nkeys; + + GinScanEntry *entries; /* one per index search condition */ + uint32 totalentries; + uint32 allocentries; /* allocated length of entries[] */ + + MemoryContext keyCtx; /* used to hold key and entry data */ + + bool isVoidRes; /* true if query is unsatisfiable */ +} GinScanOpaqueData; + +typedef GinScanOpaqueData *GinScanOpaque; + +extern IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys); +extern void ginendscan(IndexScanDesc scan); +extern void ginrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, + ScanKey orderbys, int norderbys); +extern void ginNewScanKey(IndexScanDesc scan); +extern void ginFreeScanKeys(GinScanOpaque so); + +/* ginget.c */ +extern int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm); + +/* ginlogic.c */ +extern void ginInitConsistentFunction(GinState *ginstate, GinScanKey key); + +/* ginvacuum.c */ +extern IndexBulkDeleteResult *ginbulkdelete(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); +extern IndexBulkDeleteResult *ginvacuumcleanup(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats); +extern ItemPointer ginVacuumItemPointers(GinVacuumState *gvs, + ItemPointerData *items, int nitem, int *nremaining); + +/* ginvalidate.c */ +extern bool ginvalidate(Oid opclassoid); +extern void ginadjustmembers(Oid opfamilyoid, + Oid opclassoid, + List *operators, + List *functions); + +/* ginbulk.c */ +typedef struct GinEntryAccumulator +{ + RBTNode rbtnode; + Datum key; + GinNullCategory category; + OffsetNumber attnum; + bool shouldSort; + ItemPointerData *list; + uint32 maxcount; /* allocated size of list[] */ + uint32 count; /* current number of list[] entries */ +} GinEntryAccumulator; + +typedef struct +{ + GinState *ginstate; + Size allocatedMemory; + GinEntryAccumulator *entryallocator; + uint32 eas_used; + RBTree *tree; + RBTreeIterator tree_walk; +} BuildAccumulator; + +extern void ginInitBA(BuildAccumulator *accum); +extern void ginInsertBAEntries(BuildAccumulator *accum, + ItemPointer heapptr, OffsetNumber attnum, + Datum *entries, GinNullCategory *categories, + int32 nentries); +extern void ginBeginBAScan(BuildAccumulator *accum); +extern ItemPointerData *ginGetBAEntry(BuildAccumulator *accum, + OffsetNumber *attnum, Datum *key, GinNullCategory *category, + uint32 *n); + +/* ginfast.c */ + +typedef struct GinTupleCollector +{ + IndexTuple *tuples; + uint32 ntuples; + uint32 lentuples; + uint32 sumsize; +} GinTupleCollector; + +extern void ginHeapTupleFastInsert(GinState *ginstate, + GinTupleCollector *collector); +extern void ginHeapTupleFastCollect(GinState *ginstate, + GinTupleCollector *collector, + OffsetNumber attnum, Datum value, bool isNull, + ItemPointer ht_ctid); +extern void ginInsertCleanup(GinState *ginstate, bool full_clean, + bool fill_fsm, bool forceCleanup, IndexBulkDeleteResult *stats); + +/* ginpostinglist.c */ + +extern GinPostingList *ginCompressPostingList(const ItemPointer ipd, int nipd, + int maxsize, int *nwritten); +extern int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int len, TIDBitmap *tbm); + +extern ItemPointer ginPostingListDecodeAllSegments(GinPostingList *segment, int len, + int *ndecoded_out); +extern ItemPointer ginPostingListDecode(GinPostingList *plist, int *ndecoded_out); +extern ItemPointer ginMergeItemPointers(ItemPointerData *a, uint32 na, + ItemPointerData *b, uint32 nb, + int *nmerged); + +/* + * Merging the results of several gin scans compares item pointers a lot, + * so we want this to be inlined. + */ +static inline int +ginCompareItemPointers(ItemPointer a, ItemPointer b) +{ + uint64 ia = (uint64) GinItemPointerGetBlockNumber(a) << 32 | GinItemPointerGetOffsetNumber(a); + uint64 ib = (uint64) GinItemPointerGetBlockNumber(b) << 32 | GinItemPointerGetOffsetNumber(b); + + return pg_cmp_u64(ia, ib); +} + +extern int ginTraverseLock(Buffer buffer, bool searchMode); + +#endif /* GIN_PRIVATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gin_tuple.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gin_tuple.h new file mode 100644 index 0000000..702f7d1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gin_tuple.h @@ -0,0 +1,44 @@ +/*-------------------------------------------------------------------------- + * gin.h + * Public header file for Generalized Inverted Index access method. + * + * Copyright (c) 2006-2025, PostgreSQL Global Development Group + * + * src/include/access/gin.h + *-------------------------------------------------------------------------- + */ +#ifndef GIN_TUPLE_H +#define GIN_TUPLE_H + +#include "access/ginblock.h" +#include "storage/itemptr.h" +#include "utils/sortsupport.h" + +/* + * Data for one key in a GIN index. + */ +typedef struct GinTuple +{ + int tuplen; /* length of the whole tuple */ + OffsetNumber attrnum; /* attnum of index key */ + uint16 keylen; /* bytes in data for key value */ + int16 typlen; /* typlen for key */ + bool typbyval; /* typbyval for key */ + signed char category; /* category: normal or NULL? */ + int nitems; /* number of TIDs in the data */ + char data[FLEXIBLE_ARRAY_MEMBER]; +} GinTuple; + +static inline ItemPointer +GinTupleGetFirst(GinTuple *tup) +{ + GinPostingList *list; + + list = (GinPostingList *) SHORTALIGN(tup->data + tup->keylen); + + return &list->first; +} + +extern int _gin_compare_tuples(GinTuple *a, GinTuple *b, SortSupport ssup); + +#endif /* GIN_TUPLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/ginblock.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/ginblock.h new file mode 100644 index 0000000..4c16810 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/ginblock.h @@ -0,0 +1,346 @@ +/*-------------------------------------------------------------------------- + * ginblock.h + * details of structures stored in GIN index blocks + * + * Copyright (c) 2006-2025, PostgreSQL Global Development Group + * + * src/include/access/ginblock.h + *-------------------------------------------------------------------------- + */ +#ifndef GINBLOCK_H +#define GINBLOCK_H + +#include "access/transam.h" +#include "storage/block.h" +#include "storage/bufpage.h" +#include "storage/itemptr.h" +#include "storage/off.h" + +/* + * Page opaque data in an inverted index page. + * + * Note: GIN does not include a page ID word as do the other index types. + * This is OK because the opaque data is only 8 bytes and so can be reliably + * distinguished by size. Revisit this if the size ever increases. + * Further note: as of 9.2, SP-GiST also uses 8-byte special space, as does + * BRIN as of 9.5. This is still OK, as long as GIN isn't using all of the + * high-order bits in its flags word, because that way the flags word cannot + * match the page IDs used by SP-GiST and BRIN. + */ +typedef struct GinPageOpaqueData +{ + BlockNumber rightlink; /* next page if any */ + OffsetNumber maxoff; /* number of PostingItems on GIN_DATA & + * ~GIN_LEAF page. On GIN_LIST page, number of + * heap tuples. */ + uint16 flags; /* see bit definitions below */ +} GinPageOpaqueData; + +typedef GinPageOpaqueData *GinPageOpaque; + +#define GIN_DATA (1 << 0) +#define GIN_LEAF (1 << 1) +#define GIN_DELETED (1 << 2) +#define GIN_META (1 << 3) +#define GIN_LIST (1 << 4) +#define GIN_LIST_FULLROW (1 << 5) /* makes sense only on GIN_LIST page */ +#define GIN_INCOMPLETE_SPLIT (1 << 6) /* page was split, but parent not + * updated */ +#define GIN_COMPRESSED (1 << 7) + +/* Page numbers of fixed-location pages */ +#define GIN_METAPAGE_BLKNO (0) +#define GIN_ROOT_BLKNO (1) + +typedef struct GinMetaPageData +{ + /* + * Pointers to head and tail of pending list, which consists of GIN_LIST + * pages. These store fast-inserted entries that haven't yet been moved + * into the regular GIN structure. + */ + BlockNumber head; + BlockNumber tail; + + /* + * Free space in bytes in the pending list's tail page. + */ + uint32 tailFreeSize; + + /* + * We store both number of pages and number of heap tuples that are in the + * pending list. + */ + BlockNumber nPendingPages; + int64 nPendingHeapTuples; + + /* + * Statistics for planner use (accurate as of last VACUUM) + */ + BlockNumber nTotalPages; + BlockNumber nEntryPages; + BlockNumber nDataPages; + int64 nEntries; + + /* + * GIN version number (ideally this should have been at the front, but too + * late now. Don't move it!) + * + * Currently 2 (for indexes initialized in 9.4 or later) + * + * Version 1 (indexes initialized in version 9.1, 9.2 or 9.3), is + * compatible, but may contain uncompressed posting tree (leaf) pages and + * posting lists. They will be converted to compressed format when + * modified. + * + * Version 0 (indexes initialized in 9.0 or before) is compatible but may + * be missing null entries, including both null keys and placeholders. + * Reject full-index-scan attempts on such indexes. + */ + int32 ginVersion; +} GinMetaPageData; + +#define GIN_CURRENT_VERSION 2 + +#define GinPageGetMeta(p) \ + ((GinMetaPageData *) PageGetContents(p)) + +/* + * Macros for accessing a GIN index page's opaque data + */ +#define GinPageGetOpaque(page) ( (GinPageOpaque) PageGetSpecialPointer(page) ) + +#define GinPageIsLeaf(page) ( (GinPageGetOpaque(page)->flags & GIN_LEAF) != 0 ) +#define GinPageSetLeaf(page) ( GinPageGetOpaque(page)->flags |= GIN_LEAF ) +#define GinPageSetNonLeaf(page) ( GinPageGetOpaque(page)->flags &= ~GIN_LEAF ) +#define GinPageIsData(page) ( (GinPageGetOpaque(page)->flags & GIN_DATA) != 0 ) +#define GinPageSetData(page) ( GinPageGetOpaque(page)->flags |= GIN_DATA ) +#define GinPageIsList(page) ( (GinPageGetOpaque(page)->flags & GIN_LIST) != 0 ) +#define GinPageSetList(page) ( GinPageGetOpaque(page)->flags |= GIN_LIST ) +#define GinPageHasFullRow(page) ( (GinPageGetOpaque(page)->flags & GIN_LIST_FULLROW) != 0 ) +#define GinPageSetFullRow(page) ( GinPageGetOpaque(page)->flags |= GIN_LIST_FULLROW ) +#define GinPageIsCompressed(page) ( (GinPageGetOpaque(page)->flags & GIN_COMPRESSED) != 0 ) +#define GinPageSetCompressed(page) ( GinPageGetOpaque(page)->flags |= GIN_COMPRESSED ) + +#define GinPageIsDeleted(page) ( (GinPageGetOpaque(page)->flags & GIN_DELETED) != 0 ) +#define GinPageSetDeleted(page) ( GinPageGetOpaque(page)->flags |= GIN_DELETED) +#define GinPageSetNonDeleted(page) ( GinPageGetOpaque(page)->flags &= ~GIN_DELETED) +#define GinPageIsIncompleteSplit(page) ( (GinPageGetOpaque(page)->flags & GIN_INCOMPLETE_SPLIT) != 0 ) + +#define GinPageRightMost(page) ( GinPageGetOpaque(page)->rightlink == InvalidBlockNumber) + +/* + * We should reclaim deleted page only once every transaction started before + * its deletion is over. + */ +#define GinPageGetDeleteXid(page) ( ((PageHeader) (page))->pd_prune_xid ) +#define GinPageSetDeleteXid(page, xid) ( ((PageHeader) (page))->pd_prune_xid = xid) +extern bool GinPageIsRecyclable(Page page); + +/* + * We use our own ItemPointerGet(BlockNumber|OffsetNumber) + * to avoid Asserts, since sometimes the ip_posid isn't "valid" + */ +#define GinItemPointerGetBlockNumber(pointer) \ + (ItemPointerGetBlockNumberNoCheck(pointer)) + +#define GinItemPointerGetOffsetNumber(pointer) \ + (ItemPointerGetOffsetNumberNoCheck(pointer)) + +#define GinItemPointerSetBlockNumber(pointer, blkno) \ + (ItemPointerSetBlockNumber((pointer), (blkno))) + +#define GinItemPointerSetOffsetNumber(pointer, offnum) \ + (ItemPointerSetOffsetNumber((pointer), (offnum))) + + +/* + * Special-case item pointer values needed by the GIN search logic. + * MIN: sorts less than any valid item pointer + * MAX: sorts greater than any valid item pointer + * LOSSY PAGE: indicates a whole heap page, sorts after normal item + * pointers for that page + * Note that these are all distinguishable from an "invalid" item pointer + * (which is InvalidBlockNumber/0) as well as from all normal item + * pointers (which have item numbers in the range 1..MaxHeapTuplesPerPage). + */ +#define ItemPointerSetMin(p) \ + ItemPointerSet((p), (BlockNumber)0, (OffsetNumber)0) +#define ItemPointerIsMin(p) \ + (GinItemPointerGetOffsetNumber(p) == (OffsetNumber)0 && \ + GinItemPointerGetBlockNumber(p) == (BlockNumber)0) +#define ItemPointerSetMax(p) \ + ItemPointerSet((p), InvalidBlockNumber, (OffsetNumber)0xffff) +#define ItemPointerSetLossyPage(p, b) \ + ItemPointerSet((p), (b), (OffsetNumber)0xffff) +#define ItemPointerIsLossyPage(p) \ + (GinItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff && \ + GinItemPointerGetBlockNumber(p) != InvalidBlockNumber) + +/* + * Posting item in a non-leaf posting-tree page + */ +typedef struct +{ + /* We use BlockIdData not BlockNumber to avoid padding space wastage */ + BlockIdData child_blkno; + ItemPointerData key; +} PostingItem; + +#define PostingItemGetBlockNumber(pointer) \ + BlockIdGetBlockNumber(&(pointer)->child_blkno) + +#define PostingItemSetBlockNumber(pointer, blockNumber) \ + BlockIdSet(&((pointer)->child_blkno), (blockNumber)) + +/* + * Category codes to distinguish placeholder nulls from ordinary NULL keys. + * + * The first two code values were chosen to be compatible with the usual usage + * of bool isNull flags. However, casting between bool and GinNullCategory is + * risky because of the possibility of different bit patterns and type sizes, + * so it is no longer done. + * + * GIN_CAT_EMPTY_QUERY is never stored in the index; and notice that it is + * chosen to sort before not after regular key values. + */ +typedef signed char GinNullCategory; + +#define GIN_CAT_NORM_KEY 0 /* normal, non-null key value */ +#define GIN_CAT_NULL_KEY 1 /* null key value */ +#define GIN_CAT_EMPTY_ITEM 2 /* placeholder for zero-key item */ +#define GIN_CAT_NULL_ITEM 3 /* placeholder for null item */ +#define GIN_CAT_EMPTY_QUERY (-1) /* placeholder for full-scan query */ + +/* + * Access macros for null category byte in entry tuples + */ +#define GinCategoryOffset(itup,ginstate) \ + (IndexInfoFindDataOffset((itup)->t_info) + \ + ((ginstate)->oneCol ? 0 : sizeof(int16))) +#define GinGetNullCategory(itup,ginstate) \ + (*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate)))) +#define GinSetNullCategory(itup,ginstate,c) \ + (*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate))) = (c)) + +/* + * Access macros for leaf-page entry tuples (see discussion in README) + */ +#define GinGetNPosting(itup) GinItemPointerGetOffsetNumber(&(itup)->t_tid) +#define GinSetNPosting(itup,n) ItemPointerSetOffsetNumber(&(itup)->t_tid,n) +#define GIN_TREE_POSTING ((OffsetNumber)0xffff) +#define GinIsPostingTree(itup) (GinGetNPosting(itup) == GIN_TREE_POSTING) +#define GinSetPostingTree(itup, blkno) ( GinSetNPosting((itup),GIN_TREE_POSTING), ItemPointerSetBlockNumber(&(itup)->t_tid, blkno) ) +#define GinGetPostingTree(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid) + +#define GIN_ITUP_COMPRESSED (1U << 31) +#define GinGetPostingOffset(itup) (GinItemPointerGetBlockNumber(&(itup)->t_tid) & (~GIN_ITUP_COMPRESSED)) +#define GinSetPostingOffset(itup,n) ItemPointerSetBlockNumber(&(itup)->t_tid,(n)|GIN_ITUP_COMPRESSED) +#define GinGetPosting(itup) ((Pointer) ((char*)(itup) + GinGetPostingOffset(itup))) +#define GinItupIsCompressed(itup) ((GinItemPointerGetBlockNumber(&(itup)->t_tid) & GIN_ITUP_COMPRESSED) != 0) + +/* + * Maximum size of an item on entry tree page. Make sure that we fit at least + * three items on each page. (On regular B-tree indexes, we must fit at least + * three items: two data items and the "high key". In GIN entry tree, we don't + * currently store the high key explicitly, we just use the rightmost item on + * the page, so it would actually be enough to fit two items.) + */ +#define GinMaxItemSize \ + Min(INDEX_SIZE_MASK, \ + MAXALIGN_DOWN(((BLCKSZ - \ + MAXALIGN(SizeOfPageHeaderData + 3 * sizeof(ItemIdData)) - \ + MAXALIGN(sizeof(GinPageOpaqueData))) / 3))) + +/* + * Access macros for non-leaf entry tuples + */ +#define GinGetDownlink(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid) +#define GinSetDownlink(itup,blkno) ItemPointerSet(&(itup)->t_tid, blkno, InvalidOffsetNumber) + + +/* + * Data (posting tree) pages + * + * Posting tree pages don't store regular tuples. Non-leaf pages contain + * PostingItems, which are pairs of ItemPointers and child block numbers. + * Leaf pages contain GinPostingLists and an uncompressed array of item + * pointers. + * + * In a leaf page, the compressed posting lists are stored after the regular + * page header, one after each other. Although we don't store regular tuples, + * pd_lower is used to indicate the end of the posting lists. After that, free + * space follows. This layout is compatible with the "standard" heap and + * index page layout described in bufpage.h, so that we can e.g set buffer_std + * when writing WAL records. + * + * In the special space is the GinPageOpaque struct. + */ +#define GinDataLeafPageGetPostingList(page) \ + (GinPostingList *) ((PageGetContents(page) + MAXALIGN(sizeof(ItemPointerData)))) +#define GinDataLeafPageGetPostingListSize(page) \ + (((PageHeader) page)->pd_lower - MAXALIGN(SizeOfPageHeaderData) - MAXALIGN(sizeof(ItemPointerData))) + +#define GinDataLeafPageIsEmpty(page) \ + (GinPageIsCompressed(page) ? (GinDataLeafPageGetPostingListSize(page) == 0) : (GinPageGetOpaque(page)->maxoff < FirstOffsetNumber)) + +#define GinDataLeafPageGetFreeSpace(page) PageGetExactFreeSpace(page) + +#define GinDataPageGetRightBound(page) ((ItemPointer) PageGetContents(page)) +/* + * Pointer to the data portion of a posting tree page. For internal pages, + * that's the beginning of the array of PostingItems. For compressed leaf + * pages, the first compressed posting list. For uncompressed (pre-9.4) leaf + * pages, it's the beginning of the ItemPointer array. + */ +#define GinDataPageGetData(page) \ + (PageGetContents(page) + MAXALIGN(sizeof(ItemPointerData))) +/* non-leaf pages contain PostingItems */ +#define GinDataPageGetPostingItem(page, i) \ + ((PostingItem *) (GinDataPageGetData(page) + ((i)-1) * sizeof(PostingItem))) + +/* + * Note: there is no GinDataPageGetDataSize macro, because before version + * 9.4, we didn't set pd_lower on data pages. There can be pages in the index + * that were binary-upgraded from earlier versions and still have an invalid + * pd_lower, so we cannot trust it in general. Compressed posting tree leaf + * pages are new in 9.4, however, so we can trust them; see + * GinDataLeafPageGetPostingListSize. + */ +#define GinDataPageSetDataSize(page, size) \ + { \ + Assert(size <= GinDataPageMaxDataSize); \ + ((PageHeader) page)->pd_lower = (size) + MAXALIGN(SizeOfPageHeaderData) + MAXALIGN(sizeof(ItemPointerData)); \ + } + +#define GinNonLeafDataPageGetFreeSpace(page) \ + (GinDataPageMaxDataSize - \ + GinPageGetOpaque(page)->maxoff * sizeof(PostingItem)) + +#define GinDataPageMaxDataSize \ + (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) \ + - MAXALIGN(sizeof(ItemPointerData)) \ + - MAXALIGN(sizeof(GinPageOpaqueData))) + +/* + * List pages + */ +#define GinListPageSize \ + ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GinPageOpaqueData)) ) + +/* + * A compressed posting list. + * + * Note: This requires 2-byte alignment. + */ +typedef struct +{ + ItemPointerData first; /* first item in this posting list (unpacked) */ + uint16 nbytes; /* number of bytes that follow */ + unsigned char bytes[FLEXIBLE_ARRAY_MEMBER]; /* varbyte encoded items */ +} GinPostingList; + +#define SizeOfGinPostingList(plist) (offsetof(GinPostingList, bytes) + SHORTALIGN((plist)->nbytes) ) +#define GinNextPostingListSegment(cur) ((GinPostingList *) (((char *) (cur)) + SizeOfGinPostingList((cur)))) + +#endif /* GINBLOCK_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/ginxlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/ginxlog.h new file mode 100644 index 0000000..f8c671c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/ginxlog.h @@ -0,0 +1,216 @@ +/*-------------------------------------------------------------------------- + * ginxlog.h + * header file for postgres inverted index xlog implementation. + * + * Copyright (c) 2006-2025, PostgreSQL Global Development Group + * + * src/include/access/ginxlog.h + *-------------------------------------------------------------------------- + */ +#ifndef GINXLOG_H +#define GINXLOG_H + +#include "access/ginblock.h" +#include "access/itup.h" +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/off.h" + +#define XLOG_GIN_CREATE_PTREE 0x10 + +typedef struct ginxlogCreatePostingTree +{ + uint32 size; + /* A compressed posting list follows */ +} ginxlogCreatePostingTree; + +/* + * The format of the insertion record varies depending on the page type. + * ginxlogInsert is the common part between all variants. + * + * Backup Blk 0: target page + * Backup Blk 1: left child, if this insertion finishes an incomplete split + */ + +#define XLOG_GIN_INSERT 0x20 + +typedef struct +{ + uint16 flags; /* GIN_INSERT_ISLEAF and/or GIN_INSERT_ISDATA */ + + /* + * FOLLOWS: + * + * 1. if not leaf page, block numbers of the left and right child pages + * whose split this insertion finishes, as BlockIdData[2] (beware of + * adding fields in this struct that would make them not 16-bit aligned) + * + * 2. a ginxlogInsertEntry or ginxlogRecompressDataLeaf struct, depending + * on tree type. + * + * NB: the below structs are only 16-bit aligned when appended to a + * ginxlogInsert struct! Beware of adding fields to them that require + * stricter alignment. + */ +} ginxlogInsert; + +typedef struct +{ + OffsetNumber offset; + bool isDelete; + IndexTupleData tuple; /* variable length */ +} ginxlogInsertEntry; + + +typedef struct +{ + uint16 nactions; + + /* Variable number of 'actions' follow */ +} ginxlogRecompressDataLeaf; + +/* + * Note: this struct is currently not used in code, and only acts as + * documentation. The WAL record format is as specified here, but the code + * uses straight access through a Pointer and memcpy to read/write these. + */ +typedef struct +{ + uint8 segno; /* segment this action applies to */ + char type; /* action type (see below) */ + + /* + * Action-specific data follows. For INSERT and REPLACE actions that is a + * GinPostingList struct. For ADDITEMS, a uint16 for the number of items + * added, followed by the items themselves as ItemPointers. DELETE actions + * have no further data. + */ +} ginxlogSegmentAction; + +/* Action types */ +#define GIN_SEGMENT_UNMODIFIED 0 /* no action (not used in WAL records) */ +#define GIN_SEGMENT_DELETE 1 /* a whole segment is removed */ +#define GIN_SEGMENT_INSERT 2 /* a whole segment is added */ +#define GIN_SEGMENT_REPLACE 3 /* a segment is replaced */ +#define GIN_SEGMENT_ADDITEMS 4 /* items are added to existing segment */ + +typedef struct +{ + OffsetNumber offset; + PostingItem newitem; +} ginxlogInsertDataInternal; + +/* + * Backup Blk 0: new left page (= original page, if not root split) + * Backup Blk 1: new right page + * Backup Blk 2: original page / new root page, if root split + * Backup Blk 3: left child, if this insertion completes an earlier split + */ +#define XLOG_GIN_SPLIT 0x30 + +typedef struct ginxlogSplit +{ + RelFileLocator locator; + BlockNumber rrlink; /* right link, or root's blocknumber if root + * split */ + BlockNumber leftChildBlkno; /* valid on a non-leaf split */ + BlockNumber rightChildBlkno; + uint16 flags; /* see below */ +} ginxlogSplit; + +/* + * Flags used in ginxlogInsert and ginxlogSplit records + */ +#define GIN_INSERT_ISDATA 0x01 /* for both insert and split records */ +#define GIN_INSERT_ISLEAF 0x02 /* ditto */ +#define GIN_SPLIT_ROOT 0x04 /* only for split records */ + +/* + * Vacuum simply WAL-logs the whole page, when anything is modified. This + * is functionally identical to XLOG_FPI records, but is kept separate for + * debugging purposes. (When inspecting the WAL stream, it's easier to see + * what's going on when GIN vacuum records are marked as such, not as heap + * records.) This is currently only used for entry tree leaf pages. + */ +#define XLOG_GIN_VACUUM_PAGE 0x40 + +/* + * Vacuuming posting tree leaf page is WAL-logged like recompression caused + * by insertion. + */ +#define XLOG_GIN_VACUUM_DATA_LEAF_PAGE 0x90 + +typedef struct ginxlogVacuumDataLeafPage +{ + ginxlogRecompressDataLeaf data; +} ginxlogVacuumDataLeafPage; + +/* + * Backup Blk 0: deleted page + * Backup Blk 1: parent + * Backup Blk 2: left sibling + */ +#define XLOG_GIN_DELETE_PAGE 0x50 + +typedef struct ginxlogDeletePage +{ + OffsetNumber parentOffset; + BlockNumber rightLink; + TransactionId deleteXid; /* last Xid which could see this page in scan */ +} ginxlogDeletePage; + +#define XLOG_GIN_UPDATE_META_PAGE 0x60 + +/* + * Backup Blk 0: metapage + * Backup Blk 1: tail page + */ +typedef struct ginxlogUpdateMeta +{ + RelFileLocator locator; + GinMetaPageData metadata; + BlockNumber prevTail; + BlockNumber newRightlink; + int32 ntuples; /* if ntuples > 0 then metadata.tail was + * updated with that many tuples; else new sub + * list was inserted */ + /* array of inserted tuples follows */ +} ginxlogUpdateMeta; + +#define XLOG_GIN_INSERT_LISTPAGE 0x70 + +typedef struct ginxlogInsertListPage +{ + BlockNumber rightlink; + int32 ntuples; + /* array of inserted tuples follows */ +} ginxlogInsertListPage; + +/* + * Backup Blk 0: metapage + * Backup Blk 1 to (ndeleted + 1): deleted pages + */ + +#define XLOG_GIN_DELETE_LISTPAGE 0x80 + +/* + * The WAL record for deleting list pages must contain a block reference to + * all the deleted pages, so the number of pages that can be deleted in one + * record is limited by XLR_MAX_BLOCK_ID. (block_id 0 is used for the + * metapage.) + */ +#define GIN_NDELETE_AT_ONCE Min(16, XLR_MAX_BLOCK_ID - 1) +typedef struct ginxlogDeleteListPages +{ + GinMetaPageData metadata; + int32 ndeleted; +} ginxlogDeleteListPages; + +extern void gin_redo(XLogReaderState *record); +extern void gin_desc(StringInfo buf, XLogReaderState *record); +extern const char *gin_identify(uint8 info); +extern void gin_xlog_startup(void); +extern void gin_xlog_cleanup(void); +extern void gin_mask(char *pagedata, BlockNumber blkno); + +#endif /* GINXLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gist.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gist.h new file mode 100644 index 0000000..b3f4e02 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gist.h @@ -0,0 +1,253 @@ +/*------------------------------------------------------------------------- + * + * gist.h + * The public API for GiST indexes. This API is exposed to + * individuals implementing GiST indexes, so backward-incompatible + * changes should be made with care. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/gist.h + * + *------------------------------------------------------------------------- + */ +#ifndef GIST_H +#define GIST_H + +#include "access/itup.h" +#include "access/stratnum.h" +#include "access/transam.h" +#include "access/xlog.h" +#include "access/xlogdefs.h" +#include "nodes/primnodes.h" +#include "storage/block.h" +#include "storage/bufpage.h" +#include "utils/relcache.h" + +/* + * amproc indexes for GiST indexes. + */ +#define GIST_CONSISTENT_PROC 1 +#define GIST_UNION_PROC 2 +#define GIST_COMPRESS_PROC 3 +#define GIST_DECOMPRESS_PROC 4 +#define GIST_PENALTY_PROC 5 +#define GIST_PICKSPLIT_PROC 6 +#define GIST_EQUAL_PROC 7 +#define GIST_DISTANCE_PROC 8 +#define GIST_FETCH_PROC 9 +#define GIST_OPTIONS_PROC 10 +#define GIST_SORTSUPPORT_PROC 11 +#define GIST_TRANSLATE_CMPTYPE_PROC 12 +#define GISTNProcs 12 + +/* + * Page opaque data in a GiST index page. + */ +#define F_LEAF (1 << 0) /* leaf page */ +#define F_DELETED (1 << 1) /* the page has been deleted */ +#define F_TUPLES_DELETED (1 << 2) /* some tuples on the page were + * deleted */ +#define F_FOLLOW_RIGHT (1 << 3) /* page to the right has no downlink */ +#define F_HAS_GARBAGE (1 << 4) /* some tuples on the page are dead, + * but not deleted yet */ + +/* + * NSN (node sequence number) is a special-purpose LSN which is stored on each + * index page in GISTPageOpaqueData and updated only during page splits. By + * recording the parent's LSN in GISTSearchItem.parentlsn, it is possible to + * detect concurrent child page splits by checking if parentlsn < child's NSN, + * and handle them properly. The child page's LSN is insufficient for this + * purpose since it is updated for every page change. + */ +typedef XLogRecPtr GistNSN; + +/* + * A fake LSN / NSN value used during index builds. Must be smaller than any + * real or fake (unlogged) LSN generated after the index build completes so + * that all splits are considered complete. + */ +#define GistBuildLSN ((XLogRecPtr) 1) + +/* + * For on-disk compatibility with pre-9.3 servers, NSN is stored as two + * 32-bit fields on disk, same as LSNs. + */ +typedef PageXLogRecPtr PageGistNSN; + +typedef struct GISTPageOpaqueData +{ + PageGistNSN nsn; /* this value must change on page split */ + BlockNumber rightlink; /* next page if any */ + uint16 flags; /* see bit definitions above */ + uint16 gist_page_id; /* for identification of GiST indexes */ +} GISTPageOpaqueData; + +typedef GISTPageOpaqueData *GISTPageOpaque; + +/* + * Maximum possible sizes for GiST index tuple and index key. Calculation is + * based on assumption that GiST page should fit at least 4 tuples. In theory, + * GiST index can be functional when page can fit 3 tuples. But that seems + * rather inefficient, so we use a bit conservative estimate. + * + * The maximum size of index key is true for unicolumn index. Therefore, this + * estimation should be used to figure out which maximum size of GiST index key + * makes sense at all. For multicolumn indexes, user might be able to tune + * key size using opclass parameters. + */ +#define GISTMaxIndexTupleSize \ + MAXALIGN_DOWN((BLCKSZ - SizeOfPageHeaderData - sizeof(GISTPageOpaqueData)) / \ + 4 - sizeof(ItemIdData)) + +#define GISTMaxIndexKeySize \ + (GISTMaxIndexTupleSize - MAXALIGN(sizeof(IndexTupleData))) + +/* + * The page ID is for the convenience of pg_filedump and similar utilities, + * which otherwise would have a hard time telling pages of different index + * types apart. It should be the last 2 bytes on the page. This is more or + * less "free" due to alignment considerations. + */ +#define GIST_PAGE_ID 0xFF81 + +/* + * This is the Split Vector to be returned by the PickSplit method. + * PickSplit should fill the indexes of tuples to go to the left side into + * spl_left[], and those to go to the right into spl_right[] (note the method + * is responsible for palloc'ing both of these arrays!). The tuple counts + * go into spl_nleft/spl_nright, and spl_ldatum/spl_rdatum must be set to + * the union keys for each side. + * + * If spl_ldatum_exists and spl_rdatum_exists are true, then we are performing + * a "secondary split" using a non-first index column. In this case some + * decisions have already been made about a page split, and the set of tuples + * being passed to PickSplit is just the tuples about which we are undecided. + * spl_ldatum/spl_rdatum then contain the union keys for the tuples already + * chosen to go left or right. Ideally the PickSplit method should take those + * keys into account while deciding what to do with the remaining tuples, ie + * it should try to "build out" from those unions so as to minimally expand + * them. If it does so, it should union the given tuples' keys into the + * existing spl_ldatum/spl_rdatum values rather than just setting those values + * from scratch, and then set spl_ldatum_exists/spl_rdatum_exists to false to + * show it has done this. + * + * If the PickSplit method fails to clear spl_ldatum_exists/spl_rdatum_exists, + * the core GiST code will make its own decision about how to merge the + * secondary-split results with the previously-chosen tuples, and will then + * recompute the union keys from scratch. This is a workable though often not + * optimal approach. + */ +typedef struct GIST_SPLITVEC +{ + OffsetNumber *spl_left; /* array of entries that go left */ + int spl_nleft; /* size of this array */ + Datum spl_ldatum; /* Union of keys in spl_left */ + bool spl_ldatum_exists; /* true, if spl_ldatum already exists. */ + + OffsetNumber *spl_right; /* array of entries that go right */ + int spl_nright; /* size of the array */ + Datum spl_rdatum; /* Union of keys in spl_right */ + bool spl_rdatum_exists; /* true, if spl_rdatum already exists. */ +} GIST_SPLITVEC; + +/* + * An entry on a GiST node. Contains the key, as well as its own + * location (rel,page,offset) which can supply the matching pointer. + * leafkey is a flag to tell us if the entry is in a leaf node. + */ +typedef struct GISTENTRY +{ + Datum key; + Relation rel; + Page page; + OffsetNumber offset; + bool leafkey; +} GISTENTRY; + +#define GistPageGetOpaque(page) ( (GISTPageOpaque) PageGetSpecialPointer(page) ) + +#define GistPageIsLeaf(page) ( GistPageGetOpaque(page)->flags & F_LEAF) +#define GIST_LEAF(entry) (GistPageIsLeaf((entry)->page)) + +#define GistPageIsDeleted(page) ( GistPageGetOpaque(page)->flags & F_DELETED) + +#define GistTuplesDeleted(page) ( GistPageGetOpaque(page)->flags & F_TUPLES_DELETED) +#define GistMarkTuplesDeleted(page) ( GistPageGetOpaque(page)->flags |= F_TUPLES_DELETED) +#define GistClearTuplesDeleted(page) ( GistPageGetOpaque(page)->flags &= ~F_TUPLES_DELETED) + +#define GistPageHasGarbage(page) ( GistPageGetOpaque(page)->flags & F_HAS_GARBAGE) +#define GistMarkPageHasGarbage(page) ( GistPageGetOpaque(page)->flags |= F_HAS_GARBAGE) +#define GistClearPageHasGarbage(page) ( GistPageGetOpaque(page)->flags &= ~F_HAS_GARBAGE) + +#define GistFollowRight(page) ( GistPageGetOpaque(page)->flags & F_FOLLOW_RIGHT) +#define GistMarkFollowRight(page) ( GistPageGetOpaque(page)->flags |= F_FOLLOW_RIGHT) +#define GistClearFollowRight(page) ( GistPageGetOpaque(page)->flags &= ~F_FOLLOW_RIGHT) + +#define GistPageGetNSN(page) ( PageXLogRecPtrGet(GistPageGetOpaque(page)->nsn)) +#define GistPageSetNSN(page, val) ( PageXLogRecPtrSet(GistPageGetOpaque(page)->nsn, val)) + + +/* + * On a deleted page, we store this struct. A deleted page doesn't contain any + * tuples, so we don't use the normal page layout with line pointers. Instead, + * this struct is stored right after the standard page header. pd_lower points + * to the end of this struct. If we add fields to this struct in the future, we + * can distinguish the old and new formats by pd_lower. + */ +typedef struct GISTDeletedPageContents +{ + /* last xid which could see the page in a scan */ + FullTransactionId deleteXid; +} GISTDeletedPageContents; + +static inline void +GistPageSetDeleted(Page page, FullTransactionId deletexid) +{ + Assert(PageIsEmpty(page)); + + GistPageGetOpaque(page)->flags |= F_DELETED; + ((PageHeader) page)->pd_lower = MAXALIGN(SizeOfPageHeaderData) + sizeof(GISTDeletedPageContents); + + ((GISTDeletedPageContents *) PageGetContents(page))->deleteXid = deletexid; +} + +static inline FullTransactionId +GistPageGetDeleteXid(Page page) +{ + Assert(GistPageIsDeleted(page)); + + /* Is the deleteXid field present? */ + if (((PageHeader) page)->pd_lower >= MAXALIGN(SizeOfPageHeaderData) + + offsetof(GISTDeletedPageContents, deleteXid) + sizeof(FullTransactionId)) + { + return ((GISTDeletedPageContents *) PageGetContents(page))->deleteXid; + } + else + return FullTransactionIdFromEpochAndXid(0, FirstNormalTransactionId); +} + +/* + * Vector of GISTENTRY structs; user-defined methods union and picksplit + * take it as one of their arguments + */ +typedef struct +{ + int32 n; /* number of elements */ + GISTENTRY vector[FLEXIBLE_ARRAY_MEMBER]; +} GistEntryVector; + +#define GEVHDRSZ (offsetof(GistEntryVector, vector)) + +/* + * macro to initialize a GISTENTRY + */ +#define gistentryinit(e, k, r, pg, o, l) \ + do { (e).key = (k); (e).rel = (r); (e).page = (pg); \ + (e).offset = (o); (e).leafkey = (l); } while (0) + +extern StrategyNumber gisttranslatecmptype(CompareType cmptype, Oid opfamily); + +#endif /* GIST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gist_private.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gist_private.h new file mode 100644 index 0000000..39404ec --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gist_private.h @@ -0,0 +1,571 @@ +/*------------------------------------------------------------------------- + * + * gist_private.h + * private declarations for GiST -- declarations related to the + * internal implementation of GiST, not the public API + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/gist_private.h + * + *------------------------------------------------------------------------- + */ +#ifndef GIST_PRIVATE_H +#define GIST_PRIVATE_H + +#include "access/amapi.h" +#include "access/gist.h" +#include "access/itup.h" +#include "lib/pairingheap.h" +#include "storage/bufmgr.h" +#include "storage/buffile.h" +#include "utils/hsearch.h" +#include "access/genam.h" + +/* + * Maximum number of "halves" a page can be split into in one operation. + * Typically a split produces 2 halves, but can be more if keys have very + * different lengths, or when inserting multiple keys in one operation (as + * when inserting downlinks to an internal node). There is no theoretical + * limit on this, but in practice if you get more than a handful page halves + * in one split, there's something wrong with the opclass implementation. + * GIST_MAX_SPLIT_PAGES is an arbitrary limit on that, used to size some + * local arrays used during split. Note that there is also a limit on the + * number of buffers that can be held locked at a time, MAX_SIMUL_LWLOCKS, + * so if you raise this higher than that limit, you'll just get a different + * error. + */ +#define GIST_MAX_SPLIT_PAGES 75 + +/* Buffer lock modes */ +#define GIST_SHARE BUFFER_LOCK_SHARE +#define GIST_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE +#define GIST_UNLOCK BUFFER_LOCK_UNLOCK + +typedef struct +{ + BlockNumber prev; + uint32 freespace; + char tupledata[FLEXIBLE_ARRAY_MEMBER]; +} GISTNodeBufferPage; + +#define BUFFER_PAGE_DATA_OFFSET MAXALIGN(offsetof(GISTNodeBufferPage, tupledata)) +/* Returns free space in node buffer page */ +#define PAGE_FREE_SPACE(nbp) (nbp->freespace) +/* Checks if node buffer page is empty */ +#define PAGE_IS_EMPTY(nbp) (nbp->freespace == BLCKSZ - BUFFER_PAGE_DATA_OFFSET) +/* Checks if node buffers page don't contain sufficient space for index tuple */ +#define PAGE_NO_SPACE(nbp, itup) (PAGE_FREE_SPACE(nbp) < \ + MAXALIGN(IndexTupleSize(itup))) + +/* + * GISTSTATE: information needed for any GiST index operation + * + * This struct retains call info for the index's opclass-specific support + * functions (per index column), plus the index's tuple descriptor. + * + * scanCxt holds the GISTSTATE itself as well as any data that lives for the + * lifetime of the index operation. We pass this to the support functions + * via fn_mcxt, so that they can store scan-lifespan data in it. The + * functions are invoked in tempCxt, which is typically short-lifespan + * (that is, it's reset after each tuple). However, tempCxt can be the same + * as scanCxt if we're not bothering with per-tuple context resets. + */ +typedef struct GISTSTATE +{ + MemoryContext scanCxt; /* context for scan-lifespan data */ + MemoryContext tempCxt; /* short-term context for calling functions */ + + TupleDesc leafTupdesc; /* index's tuple descriptor */ + TupleDesc nonLeafTupdesc; /* truncated tuple descriptor for non-leaf + * pages */ + TupleDesc fetchTupdesc; /* tuple descriptor for tuples returned in an + * index-only scan */ + + FmgrInfo consistentFn[INDEX_MAX_KEYS]; + FmgrInfo unionFn[INDEX_MAX_KEYS]; + FmgrInfo compressFn[INDEX_MAX_KEYS]; + FmgrInfo decompressFn[INDEX_MAX_KEYS]; + FmgrInfo penaltyFn[INDEX_MAX_KEYS]; + FmgrInfo picksplitFn[INDEX_MAX_KEYS]; + FmgrInfo equalFn[INDEX_MAX_KEYS]; + FmgrInfo distanceFn[INDEX_MAX_KEYS]; + FmgrInfo fetchFn[INDEX_MAX_KEYS]; + + /* Collations to pass to the support functions */ + Oid supportCollation[INDEX_MAX_KEYS]; +} GISTSTATE; + + +/* + * During a GiST index search, we must maintain a queue of unvisited items, + * which can be either individual heap tuples or whole index pages. If it + * is an ordered search, the unvisited items should be visited in distance + * order. Unvisited items at the same distance should be visited in + * depth-first order, that is heap items first, then lower index pages, then + * upper index pages; this rule avoids doing extra work during a search that + * ends early due to LIMIT. + * + * To perform an ordered search, we use a pairing heap to manage the + * distance-order queue. In a non-ordered search (no order-by operators), + * we use it to return heap tuples before unvisited index pages, to + * ensure depth-first order, but all entries are otherwise considered + * equal. + */ + +/* Individual heap tuple to be visited */ +typedef struct GISTSearchHeapItem +{ + ItemPointerData heapPtr; + bool recheck; /* T if quals must be rechecked */ + bool recheckDistances; /* T if distances must be rechecked */ + HeapTuple recontup; /* data reconstructed from the index, used in + * index-only scans */ + OffsetNumber offnum; /* track offset in page to mark tuple as + * LP_DEAD */ +} GISTSearchHeapItem; + +/* Unvisited item, either index page or heap tuple */ +typedef struct GISTSearchItem +{ + pairingheap_node phNode; + BlockNumber blkno; /* index page number, or InvalidBlockNumber */ + union + { + GistNSN parentlsn; /* parent page's LSN, if index page */ + /* we must store parentlsn to detect whether a split occurred */ + GISTSearchHeapItem heap; /* heap info, if heap tuple */ + } data; + + /* numberOfOrderBys entries */ + IndexOrderByDistance distances[FLEXIBLE_ARRAY_MEMBER]; +} GISTSearchItem; + +#define GISTSearchItemIsHeap(item) ((item).blkno == InvalidBlockNumber) + +#define SizeOfGISTSearchItem(n_distances) \ + (offsetof(GISTSearchItem, distances) + \ + sizeof(IndexOrderByDistance) * (n_distances)) + +/* + * GISTScanOpaqueData: private state for a scan of a GiST index + */ +typedef struct GISTScanOpaqueData +{ + GISTSTATE *giststate; /* index information, see above */ + Oid *orderByTypes; /* datatypes of ORDER BY expressions */ + + pairingheap *queue; /* queue of unvisited items */ + MemoryContext queueCxt; /* context holding the queue */ + bool qual_ok; /* false if qual can never be satisfied */ + bool firstCall; /* true until first gistgettuple call */ + + /* pre-allocated workspace arrays */ + IndexOrderByDistance *distances; /* output area for gistindex_keytest */ + + /* info about killed items if any (killedItems is NULL if never used) */ + OffsetNumber *killedItems; /* offset numbers of killed items */ + int numKilled; /* number of currently stored items */ + BlockNumber curBlkno; /* current number of block */ + GistNSN curPageLSN; /* pos in the WAL stream when page was read */ + + /* In a non-ordered search, returnable heap items are stored here: */ + GISTSearchHeapItem pageData[BLCKSZ / sizeof(IndexTupleData)]; + OffsetNumber nPageData; /* number of valid items in array */ + OffsetNumber curPageData; /* next item to return */ + MemoryContext pageDataCxt; /* context holding the fetched tuples, for + * index-only scans */ +} GISTScanOpaqueData; + +typedef GISTScanOpaqueData *GISTScanOpaque; + +/* despite the name, gistxlogPage is not part of any xlog record */ +typedef struct gistxlogPage +{ + BlockNumber blkno; + int num; /* number of index tuples following */ +} gistxlogPage; + +/* SplitPageLayout - gistSplit function result */ +typedef struct SplitPageLayout +{ + gistxlogPage block; + IndexTupleData *list; + int lenlist; + IndexTuple itup; /* union key for page */ + Page page; /* to operate */ + Buffer buffer; /* to write after all proceed */ + + struct SplitPageLayout *next; +} SplitPageLayout; + +/* + * GISTInsertStack used for locking buffers and transfer arguments during + * insertion + */ +typedef struct GISTInsertStack +{ + /* current page */ + BlockNumber blkno; + Buffer buffer; + Page page; + + /* + * log sequence number from page->lsn to recognize page update and compare + * it with page's nsn to recognize page split + */ + GistNSN lsn; + + /* + * If set, we split the page while descending the tree to find an + * insertion target. It means that we need to retry from the parent, + * because the downlink of this page might no longer cover the new key. + */ + bool retry_from_parent; + + /* offset of the downlink in the parent page, that points to this page */ + OffsetNumber downlinkoffnum; + + /* pointer to parent */ + struct GISTInsertStack *parent; +} GISTInsertStack; + +/* Working state and results for multi-column split logic in gistsplit.c */ +typedef struct GistSplitVector +{ + GIST_SPLITVEC splitVector; /* passed to/from user PickSplit method */ + + Datum spl_lattr[INDEX_MAX_KEYS]; /* Union of subkeys in + * splitVector.spl_left */ + bool spl_lisnull[INDEX_MAX_KEYS]; + + Datum spl_rattr[INDEX_MAX_KEYS]; /* Union of subkeys in + * splitVector.spl_right */ + bool spl_risnull[INDEX_MAX_KEYS]; + + bool *spl_dontcare; /* flags tuples which could go to either side + * of the split for zero penalty */ +} GistSplitVector; + +typedef struct +{ + Relation r; + Relation heapRel; + Size freespace; /* free space to be left */ + bool is_build; + + GISTInsertStack *stack; +} GISTInsertState; + +/* root page of a gist index */ +#define GIST_ROOT_BLKNO 0 + +/* + * Before PostgreSQL 9.1, we used to rely on so-called "invalid tuples" on + * inner pages to finish crash recovery of incomplete page splits. If a crash + * happened in the middle of a page split, so that the downlink pointers were + * not yet inserted, crash recovery inserted a special downlink pointer. The + * semantics of an invalid tuple was that it if you encounter one in a scan, + * it must always be followed, because we don't know if the tuples on the + * child page match or not. + * + * We no longer create such invalid tuples, we now mark the left-half of such + * an incomplete split with the F_FOLLOW_RIGHT flag instead, and finish the + * split properly the next time we need to insert on that page. To retain + * on-disk compatibility for the sake of pg_upgrade, we still store 0xffff as + * the offset number of all inner tuples. If we encounter any invalid tuples + * with 0xfffe during insertion, we throw an error, though scans still handle + * them. You should only encounter invalid tuples if you pg_upgrade a pre-9.1 + * gist index which already has invalid tuples in it because of a crash. That + * should be rare, and you are recommended to REINDEX anyway if you have any + * invalid tuples in an index, so throwing an error is as far as we go with + * supporting that. + */ +#define TUPLE_IS_VALID 0xffff +#define TUPLE_IS_INVALID 0xfffe + +#define GistTupleIsInvalid(itup) ( ItemPointerGetOffsetNumber( &((itup)->t_tid) ) == TUPLE_IS_INVALID ) +#define GistTupleSetValid(itup) ItemPointerSetOffsetNumber( &((itup)->t_tid), TUPLE_IS_VALID ) + + + + +/* + * A buffer attached to an internal node, used when building an index in + * buffering mode. + */ +typedef struct +{ + BlockNumber nodeBlocknum; /* index block # this buffer is for */ + int32 blocksCount; /* current # of blocks occupied by buffer */ + + BlockNumber pageBlocknum; /* temporary file block # */ + GISTNodeBufferPage *pageBuffer; /* in-memory buffer page */ + + /* is this buffer queued for emptying? */ + bool queuedForEmptying; + + /* is this a temporary copy, not in the hash table? */ + bool isTemp; + + int level; /* 0 == leaf */ +} GISTNodeBuffer; + +/* + * Does specified level have buffers? (Beware of multiple evaluation of + * arguments.) + */ +#define LEVEL_HAS_BUFFERS(nlevel, gfbb) \ + ((nlevel) != 0 && (nlevel) % (gfbb)->levelStep == 0 && \ + (nlevel) != (gfbb)->rootlevel) + +/* Is specified buffer at least half-filled (should be queued for emptying)? */ +#define BUFFER_HALF_FILLED(nodeBuffer, gfbb) \ + ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer / 2) + +/* + * Is specified buffer full? Our buffers can actually grow indefinitely, + * beyond the "maximum" size, so this just means whether the buffer has grown + * beyond the nominal maximum size. + */ +#define BUFFER_OVERFLOWED(nodeBuffer, gfbb) \ + ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer) + +/* + * Data structure with general information about build buffers. + */ +typedef struct GISTBuildBuffers +{ + /* Persistent memory context for the buffers and metadata. */ + MemoryContext context; + + BufFile *pfile; /* Temporary file to store buffers in */ + long nFileBlocks; /* Current size of the temporary file */ + + /* + * resizable array of free blocks. + */ + long *freeBlocks; + int nFreeBlocks; /* # of currently free blocks in the array */ + int freeBlocksLen; /* current allocated length of the array */ + + /* Hash for buffers by block number */ + HTAB *nodeBuffersTab; + + /* List of buffers scheduled for emptying */ + List *bufferEmptyingQueue; + + /* + * Parameters to the buffering build algorithm. levelStep determines which + * levels in the tree have buffers, and pagesPerBuffer determines how + * large each buffer is. + */ + int levelStep; + int pagesPerBuffer; + + /* Array of lists of buffers on each level, for final emptying */ + List **buffersOnLevels; + int buffersOnLevelsLen; + + /* + * Dynamically-sized array of buffers that currently have their last page + * loaded in main memory. + */ + GISTNodeBuffer **loadedBuffers; + int loadedBuffersCount; /* # of entries in loadedBuffers */ + int loadedBuffersLen; /* allocated size of loadedBuffers */ + + /* Level of the current root node (= height of the index tree - 1) */ + int rootlevel; +} GISTBuildBuffers; + +/* GiSTOptions->buffering_mode values */ +typedef enum GistOptBufferingMode +{ + GIST_OPTION_BUFFERING_AUTO, + GIST_OPTION_BUFFERING_ON, + GIST_OPTION_BUFFERING_OFF, +} GistOptBufferingMode; + +/* + * Storage type for GiST's reloptions + */ +typedef struct GiSTOptions +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int fillfactor; /* page fill factor in percent (0..100) */ + GistOptBufferingMode buffering_mode; /* buffering build mode */ +} GiSTOptions; + +/* gist.c */ +extern void gistbuildempty(Relation index); +extern bool gistinsert(Relation r, Datum *values, bool *isnull, + ItemPointer ht_ctid, Relation heapRel, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); +extern MemoryContext createTempGistContext(void); +extern GISTSTATE *initGISTstate(Relation index); +extern void freeGISTstate(GISTSTATE *giststate); +extern void gistdoinsert(Relation r, + IndexTuple itup, + Size freespace, + GISTSTATE *giststate, + Relation heapRel, + bool is_build); + +/* A List of these is returned from gistplacetopage() in *splitinfo */ +typedef struct +{ + Buffer buf; /* the split page "half" */ + IndexTuple downlink; /* downlink for this half. */ +} GISTPageSplitInfo; + +extern bool gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate, + Buffer buffer, + IndexTuple *itup, int ntup, + OffsetNumber oldoffnum, BlockNumber *newblkno, + Buffer leftchildbuf, + List **splitinfo, + bool markfollowright, + Relation heapRel, + bool is_build); + +extern SplitPageLayout *gistSplit(Relation r, Page page, IndexTuple *itup, + int len, GISTSTATE *giststate); + +/* gistxlog.c */ +extern XLogRecPtr gistXLogPageDelete(Buffer buffer, + FullTransactionId xid, Buffer parentBuffer, + OffsetNumber downlinkOffset); + +extern void gistXLogPageReuse(Relation rel, Relation heaprel, BlockNumber blkno, + FullTransactionId deleteXid); + +extern XLogRecPtr gistXLogUpdate(Buffer buffer, + OffsetNumber *todelete, int ntodelete, + IndexTuple *itup, int ituplen, + Buffer leftchildbuf); + +extern XLogRecPtr gistXLogDelete(Buffer buffer, OffsetNumber *todelete, + int ntodelete, TransactionId snapshotConflictHorizon, + Relation heaprel); + +extern XLogRecPtr gistXLogSplit(bool page_is_leaf, + SplitPageLayout *dist, + BlockNumber origrlink, GistNSN orignsn, + Buffer leftchildbuf, bool markfollowright); + +extern XLogRecPtr gistXLogAssignLSN(void); + +/* gistget.c */ +extern bool gistgettuple(IndexScanDesc scan, ScanDirection dir); +extern int64 gistgetbitmap(IndexScanDesc scan, TIDBitmap *tbm); +extern bool gistcanreturn(Relation index, int attno); + +/* gistvalidate.c */ +extern bool gistvalidate(Oid opclassoid); +extern void gistadjustmembers(Oid opfamilyoid, + Oid opclassoid, + List *operators, + List *functions); + +/* gistutil.c */ + +#define GiSTPageSize \ + ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GISTPageOpaqueData)) ) + +#define GIST_MIN_FILLFACTOR 10 +#define GIST_DEFAULT_FILLFACTOR 90 + +extern bytea *gistoptions(Datum reloptions, bool validate); +extern bool gistproperty(Oid index_oid, int attno, + IndexAMProperty prop, const char *propname, + bool *res, bool *isnull); +extern bool gistfitpage(IndexTuple *itvec, int len); +extern bool gistnospace(Page page, IndexTuple *itvec, int len, OffsetNumber todelete, Size freespace); +extern void gistcheckpage(Relation rel, Buffer buf); +extern Buffer gistNewBuffer(Relation r, Relation heaprel); +extern bool gistPageRecyclable(Page page); +extern void gistfillbuffer(Page page, IndexTuple *itup, int len, + OffsetNumber off); +extern IndexTuple *gistextractpage(Page page, int *len /* out */ ); +extern IndexTuple *gistjoinvector(IndexTuple *itvec, int *len, + IndexTuple *additvec, int addlen); +extern IndexTupleData *gistfillitupvec(IndexTuple *vec, int veclen, int *memlen); + +extern IndexTuple gistunion(Relation r, IndexTuple *itvec, + int len, GISTSTATE *giststate); +extern IndexTuple gistgetadjusted(Relation r, + IndexTuple oldtup, + IndexTuple addtup, + GISTSTATE *giststate); +extern IndexTuple gistFormTuple(GISTSTATE *giststate, + Relation r, const Datum *attdata, const bool *isnull, bool isleaf); +extern void gistCompressValues(GISTSTATE *giststate, Relation r, + const Datum *attdata, const bool *isnull, bool isleaf, Datum *compatt); + +extern OffsetNumber gistchoose(Relation r, Page p, + IndexTuple it, + GISTSTATE *giststate); + +extern void GISTInitBuffer(Buffer b, uint32 f); +extern void gistinitpage(Page page, uint32 f); +extern void gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e, + Datum k, Relation r, Page pg, OffsetNumber o, + bool l, bool isNull); + +extern float gistpenalty(GISTSTATE *giststate, int attno, + GISTENTRY *orig, bool isNullOrig, + GISTENTRY *add, bool isNullAdd); +extern void gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, + Datum *attr, bool *isnull); +extern bool gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b); +extern void gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p, + OffsetNumber o, GISTENTRY *attdata, bool *isnull); +extern HeapTuple gistFetchTuple(GISTSTATE *giststate, Relation r, + IndexTuple tuple); +extern void gistMakeUnionKey(GISTSTATE *giststate, int attno, + GISTENTRY *entry1, bool isnull1, + GISTENTRY *entry2, bool isnull2, + Datum *dst, bool *dstisnull); + +extern XLogRecPtr gistGetFakeLSN(Relation rel); + +/* gistvacuum.c */ +extern IndexBulkDeleteResult *gistbulkdelete(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); +extern IndexBulkDeleteResult *gistvacuumcleanup(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats); + +/* gistsplit.c */ +extern void gistSplitByKey(Relation r, Page page, IndexTuple *itup, + int len, GISTSTATE *giststate, + GistSplitVector *v, + int attno); + +/* gistbuild.c */ +extern IndexBuildResult *gistbuild(Relation heap, Relation index, + struct IndexInfo *indexInfo); + +/* gistbuildbuffers.c */ +extern GISTBuildBuffers *gistInitBuildBuffers(int pagesPerBuffer, int levelStep, + int maxLevel); +extern GISTNodeBuffer *gistGetNodeBuffer(GISTBuildBuffers *gfbb, + GISTSTATE *giststate, + BlockNumber nodeBlocknum, int level); +extern void gistPushItupToNodeBuffer(GISTBuildBuffers *gfbb, + GISTNodeBuffer *nodeBuffer, IndexTuple itup); +extern bool gistPopItupFromNodeBuffer(GISTBuildBuffers *gfbb, + GISTNodeBuffer *nodeBuffer, IndexTuple *itup); +extern void gistFreeBuildBuffers(GISTBuildBuffers *gfbb); +extern void gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, + GISTSTATE *giststate, Relation r, + int level, Buffer buffer, + List *splitinfo); +extern void gistUnloadNodeBuffers(GISTBuildBuffers *gfbb); + +#endif /* GIST_PRIVATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gistscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gistscan.h new file mode 100644 index 0000000..518034c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gistscan.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * gistscan.h + * routines defined in access/gist/gistscan.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/gistscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef GISTSCAN_H +#define GISTSCAN_H + +#include "access/amapi.h" + +extern IndexScanDesc gistbeginscan(Relation r, int nkeys, int norderbys); +extern void gistrescan(IndexScanDesc scan, ScanKey key, int nkeys, + ScanKey orderbys, int norderbys); +extern void gistendscan(IndexScanDesc scan); + +#endif /* GISTSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gistxlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gistxlog.h new file mode 100644 index 0000000..d551c0a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/gistxlog.h @@ -0,0 +1,117 @@ +/*------------------------------------------------------------------------- + * + * gistxlog.h + * gist xlog routines + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/gistxlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef GIST_XLOG_H +#define GIST_XLOG_H + +#include "access/gist.h" +#include "access/xlogreader.h" +#include "lib/stringinfo.h" + +#define XLOG_GIST_PAGE_UPDATE 0x00 +#define XLOG_GIST_DELETE 0x10 /* delete leaf index tuples for a + * page */ +#define XLOG_GIST_PAGE_REUSE 0x20 /* old page is about to be reused + * from FSM */ +#define XLOG_GIST_PAGE_SPLIT 0x30 + /* #define XLOG_GIST_INSERT_COMPLETE 0x40 */ /* not used anymore */ + /* #define XLOG_GIST_CREATE_INDEX 0x50 */ /* not used anymore */ +#define XLOG_GIST_PAGE_DELETE 0x60 +#define XLOG_GIST_ASSIGN_LSN 0x70 /* nop, assign new LSN */ + +/* + * Backup Blk 0: updated page. + * Backup Blk 1: If this operation completes a page split, by inserting a + * downlink for the split page, the left half of the split + */ +typedef struct gistxlogPageUpdate +{ + /* number of deleted offsets */ + uint16 ntodelete; + uint16 ntoinsert; + + /* + * In payload of blk 0 : 1. todelete OffsetNumbers 2. tuples to insert + */ +} gistxlogPageUpdate; + +/* + * Backup Blk 0: Leaf page, whose index tuples are deleted. + */ +typedef struct gistxlogDelete +{ + TransactionId snapshotConflictHorizon; + uint16 ntodelete; /* number of deleted offsets */ + bool isCatalogRel; /* to handle recovery conflict during logical + * decoding on standby */ + + /* TODELETE OFFSET NUMBERS */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} gistxlogDelete; + +#define SizeOfGistxlogDelete offsetof(gistxlogDelete, offsets) + +/* + * Backup Blk 0: If this operation completes a page split, by inserting a + * downlink for the split page, the left half of the split + * Backup Blk 1 - npage: split pages (1 is the original page) + */ +typedef struct gistxlogPageSplit +{ + BlockNumber origrlink; /* rightlink of the page before split */ + GistNSN orignsn; /* NSN of the page before split */ + bool origleaf; /* was split page a leaf page? */ + + uint16 npage; /* # of pages in the split */ + bool markfollowright; /* set F_FOLLOW_RIGHT flags */ + + /* + * follow: 1. gistxlogPage and array of IndexTupleData per page + */ +} gistxlogPageSplit; + +/* + * Backup Blk 0: page that was deleted. + * Backup Blk 1: parent page, containing the downlink to the deleted page. + */ +typedef struct gistxlogPageDelete +{ + FullTransactionId deleteXid; /* last Xid which could see page in scan */ + OffsetNumber downlinkOffset; /* Offset of downlink referencing this + * page */ +} gistxlogPageDelete; + +#define SizeOfGistxlogPageDelete (offsetof(gistxlogPageDelete, downlinkOffset) + sizeof(OffsetNumber)) + + +/* + * This is what we need to know about page reuse, for hot standby. + */ +typedef struct gistxlogPageReuse +{ + RelFileLocator locator; + BlockNumber block; + FullTransactionId snapshotConflictHorizon; + bool isCatalogRel; /* to handle recovery conflict during logical + * decoding on standby */ +} gistxlogPageReuse; + +#define SizeOfGistxlogPageReuse (offsetof(gistxlogPageReuse, isCatalogRel) + sizeof(bool)) + +extern void gist_redo(XLogReaderState *record); +extern void gist_desc(StringInfo buf, XLogReaderState *record); +extern const char *gist_identify(uint8 info); +extern void gist_xlog_startup(void); +extern void gist_xlog_cleanup(void); +extern void gist_mask(char *pagedata, BlockNumber blkno); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/hash.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/hash.h new file mode 100644 index 0000000..073ad29 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/hash.h @@ -0,0 +1,490 @@ +/*------------------------------------------------------------------------- + * + * hash.h + * header file for postgres hash access method implementation + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/hash.h + * + * NOTES + * modeled after Margo Seltzer's hash implementation for unix. + * + *------------------------------------------------------------------------- + */ +#ifndef HASH_H +#define HASH_H + +#include "access/amapi.h" +#include "access/itup.h" +#include "access/sdir.h" +#include "catalog/pg_am_d.h" +#include "common/hashfn.h" +#include "lib/stringinfo.h" +#include "storage/bufmgr.h" +#include "storage/lockdefs.h" +#include "utils/hsearch.h" +#include "utils/relcache.h" + +/* + * Mapping from hash bucket number to physical block number of bucket's + * starting page. Beware of multiple evaluations of argument! + */ +typedef uint32 Bucket; + +#define InvalidBucket ((Bucket) 0xFFFFFFFF) + +#define BUCKET_TO_BLKNO(metap,B) \ + ((BlockNumber) ((B) + ((B) ? (metap)->hashm_spares[_hash_spareindex((B)+1)-1] : 0)) + 1) + +/* + * Special space for hash index pages. + * + * hasho_flag's LH_PAGE_TYPE bits tell us which type of page we're looking at. + * Additional bits in the flag word are used for more transient purposes. + * + * To test a page's type, do (hasho_flag & LH_PAGE_TYPE) == LH_xxx_PAGE. + * However, we ensure that each used page type has a distinct bit so that + * we can OR together page types for uses such as the allowable-page-types + * argument of _hash_checkpage(). + */ +#define LH_UNUSED_PAGE (0) +#define LH_OVERFLOW_PAGE (1 << 0) +#define LH_BUCKET_PAGE (1 << 1) +#define LH_BITMAP_PAGE (1 << 2) +#define LH_META_PAGE (1 << 3) +#define LH_BUCKET_BEING_POPULATED (1 << 4) +#define LH_BUCKET_BEING_SPLIT (1 << 5) +#define LH_BUCKET_NEEDS_SPLIT_CLEANUP (1 << 6) +#define LH_PAGE_HAS_DEAD_TUPLES (1 << 7) + +#define LH_PAGE_TYPE \ + (LH_OVERFLOW_PAGE | LH_BUCKET_PAGE | LH_BITMAP_PAGE | LH_META_PAGE) + +/* + * In an overflow page, hasho_prevblkno stores the block number of the previous + * page in the bucket chain; in a bucket page, hasho_prevblkno stores the + * hashm_maxbucket value as of the last time the bucket was last split, or + * else as of the time the bucket was created. The latter convention is used + * to determine whether a cached copy of the metapage is too stale to be used + * without needing to lock or pin the metapage. + * + * hasho_nextblkno is always the block number of the next page in the + * bucket chain, or InvalidBlockNumber if there are no more such pages. + */ +typedef struct HashPageOpaqueData +{ + BlockNumber hasho_prevblkno; /* see above */ + BlockNumber hasho_nextblkno; /* see above */ + Bucket hasho_bucket; /* bucket number this pg belongs to */ + uint16 hasho_flag; /* page type code + flag bits, see above */ + uint16 hasho_page_id; /* for identification of hash indexes */ +} HashPageOpaqueData; + +typedef HashPageOpaqueData *HashPageOpaque; + +#define HashPageGetOpaque(page) ((HashPageOpaque) PageGetSpecialPointer(page)) + +#define H_NEEDS_SPLIT_CLEANUP(opaque) (((opaque)->hasho_flag & LH_BUCKET_NEEDS_SPLIT_CLEANUP) != 0) +#define H_BUCKET_BEING_SPLIT(opaque) (((opaque)->hasho_flag & LH_BUCKET_BEING_SPLIT) != 0) +#define H_BUCKET_BEING_POPULATED(opaque) (((opaque)->hasho_flag & LH_BUCKET_BEING_POPULATED) != 0) +#define H_HAS_DEAD_TUPLES(opaque) (((opaque)->hasho_flag & LH_PAGE_HAS_DEAD_TUPLES) != 0) + +/* + * The page ID is for the convenience of pg_filedump and similar utilities, + * which otherwise would have a hard time telling pages of different index + * types apart. It should be the last 2 bytes on the page. This is more or + * less "free" due to alignment considerations. + */ +#define HASHO_PAGE_ID 0xFF80 + +typedef struct HashScanPosItem /* what we remember about each match */ +{ + ItemPointerData heapTid; /* TID of referenced heap item */ + OffsetNumber indexOffset; /* index item's location within page */ +} HashScanPosItem; + +typedef struct HashScanPosData +{ + Buffer buf; /* if valid, the buffer is pinned */ + BlockNumber currPage; /* current hash index page */ + BlockNumber nextPage; /* next overflow page */ + BlockNumber prevPage; /* prev overflow or bucket page */ + + /* + * The items array is always ordered in index order (ie, increasing + * indexoffset). When scanning backwards it is convenient to fill the + * array back-to-front, so we start at the last slot and fill downwards. + * Hence we need both a first-valid-entry and a last-valid-entry counter. + * itemIndex is a cursor showing which entry was last returned to caller. + */ + int firstItem; /* first valid index in items[] */ + int lastItem; /* last valid index in items[] */ + int itemIndex; /* current index in items[] */ + + HashScanPosItem items[MaxIndexTuplesPerPage]; /* MUST BE LAST */ +} HashScanPosData; + +#define HashScanPosIsPinned(scanpos) \ +( \ + AssertMacro(BlockNumberIsValid((scanpos).currPage) || \ + !BufferIsValid((scanpos).buf)), \ + BufferIsValid((scanpos).buf) \ +) + +#define HashScanPosIsValid(scanpos) \ +( \ + AssertMacro(BlockNumberIsValid((scanpos).currPage) || \ + !BufferIsValid((scanpos).buf)), \ + BlockNumberIsValid((scanpos).currPage) \ +) + +#define HashScanPosInvalidate(scanpos) \ + do { \ + (scanpos).buf = InvalidBuffer; \ + (scanpos).currPage = InvalidBlockNumber; \ + (scanpos).nextPage = InvalidBlockNumber; \ + (scanpos).prevPage = InvalidBlockNumber; \ + (scanpos).firstItem = 0; \ + (scanpos).lastItem = 0; \ + (scanpos).itemIndex = 0; \ + } while (0) + +/* + * HashScanOpaqueData is private state for a hash index scan. + */ +typedef struct HashScanOpaqueData +{ + /* Hash value of the scan key, ie, the hash key we seek */ + uint32 hashso_sk_hash; + + /* remember the buffer associated with primary bucket */ + Buffer hashso_bucket_buf; + + /* + * remember the buffer associated with primary bucket page of bucket being + * split. it is required during the scan of the bucket which is being + * populated during split operation. + */ + Buffer hashso_split_bucket_buf; + + /* Whether scan starts on bucket being populated due to split */ + bool hashso_buc_populated; + + /* + * Whether scanning bucket being split? The value of this parameter is + * referred only when hashso_buc_populated is true. + */ + bool hashso_buc_split; + /* info about killed items if any (killedItems is NULL if never used) */ + int *killedItems; /* currPos.items indexes of killed items */ + int numKilled; /* number of currently stored items */ + + /* + * Identify all the matching items on a page and save them in + * HashScanPosData + */ + HashScanPosData currPos; /* current position data */ +} HashScanOpaqueData; + +typedef HashScanOpaqueData *HashScanOpaque; + +/* + * Definitions for metapage. + */ + +#define HASH_METAPAGE 0 /* metapage is always block 0 */ + +#define HASH_MAGIC 0x6440640 +#define HASH_VERSION 4 + +/* + * spares[] holds the number of overflow pages currently allocated at or + * before a certain splitpoint. For example, if spares[3] = 7 then there are + * 7 ovflpages before splitpoint 3 (compare BUCKET_TO_BLKNO macro). The + * value in spares[ovflpoint] increases as overflow pages are added at the + * end of the index. Once ovflpoint increases (ie, we have actually allocated + * the bucket pages belonging to that splitpoint) the number of spares at the + * prior splitpoint cannot change anymore. + * + * ovflpages that have been recycled for reuse can be found by looking at + * bitmaps that are stored within ovflpages dedicated for the purpose. + * The blknos of these bitmap pages are kept in mapp[]; nmaps is the + * number of currently existing bitmaps. + * + * The limitation on the size of spares[] comes from the fact that there's + * no point in having more than 2^32 buckets with only uint32 hashcodes. + * (Note: The value of HASH_MAX_SPLITPOINTS which is the size of spares[] is + * adjusted in such a way to accommodate multi phased allocation of buckets + * after HASH_SPLITPOINT_GROUPS_WITH_ONE_PHASE). + * + * There is no particular upper limit on the size of mapp[], other than + * needing to fit into the metapage. (With 8K block size, 1024 bitmaps + * limit us to 256 GB of overflow space...). For smaller block size we + * can not use 1024 bitmaps as it will lead to the meta page data crossing + * the block size boundary. So we use BLCKSZ to determine the maximum number + * of bitmaps. + */ +#define HASH_MAX_BITMAPS Min(BLCKSZ / 8, 1024) + +#define HASH_SPLITPOINT_PHASE_BITS 2 +#define HASH_SPLITPOINT_PHASES_PER_GRP (1 << HASH_SPLITPOINT_PHASE_BITS) +#define HASH_SPLITPOINT_PHASE_MASK (HASH_SPLITPOINT_PHASES_PER_GRP - 1) +#define HASH_SPLITPOINT_GROUPS_WITH_ONE_PHASE 10 + +/* defines max number of splitpoint phases a hash index can have */ +#define HASH_MAX_SPLITPOINT_GROUP 32 +#define HASH_MAX_SPLITPOINTS \ + (((HASH_MAX_SPLITPOINT_GROUP - HASH_SPLITPOINT_GROUPS_WITH_ONE_PHASE) * \ + HASH_SPLITPOINT_PHASES_PER_GRP) + \ + HASH_SPLITPOINT_GROUPS_WITH_ONE_PHASE) + +typedef struct HashMetaPageData +{ + uint32 hashm_magic; /* magic no. for hash tables */ + uint32 hashm_version; /* version ID */ + double hashm_ntuples; /* number of tuples stored in the table */ + uint16 hashm_ffactor; /* target fill factor (tuples/bucket) */ + uint16 hashm_bsize; /* index page size (bytes) */ + uint16 hashm_bmsize; /* bitmap array size (bytes) - must be a power + * of 2 */ + uint16 hashm_bmshift; /* log2(bitmap array size in BITS) */ + uint32 hashm_maxbucket; /* ID of maximum bucket in use */ + uint32 hashm_highmask; /* mask to modulo into entire table */ + uint32 hashm_lowmask; /* mask to modulo into lower half of table */ + uint32 hashm_ovflpoint; /* splitpoint from which ovflpage being + * allocated */ + uint32 hashm_firstfree; /* lowest-number free ovflpage (bit#) */ + uint32 hashm_nmaps; /* number of bitmap pages */ + RegProcedure hashm_procid; /* hash function id from pg_proc */ + uint32 hashm_spares[HASH_MAX_SPLITPOINTS]; /* spare pages before each + * splitpoint */ + BlockNumber hashm_mapp[HASH_MAX_BITMAPS]; /* blknos of ovfl bitmaps */ +} HashMetaPageData; + +typedef HashMetaPageData *HashMetaPage; + +typedef struct HashOptions +{ + int32 varlena_header_; /* varlena header (do not touch directly!) */ + int fillfactor; /* page fill factor in percent (0..100) */ +} HashOptions; + +#define HashGetFillFactor(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == HASH_AM_OID), \ + (relation)->rd_options ? \ + ((HashOptions *) (relation)->rd_options)->fillfactor : \ + HASH_DEFAULT_FILLFACTOR) +#define HashGetTargetPageUsage(relation) \ + (BLCKSZ * HashGetFillFactor(relation) / 100) + +/* + * Maximum size of a hash index item (it's okay to have only one per page) + */ +#define HashMaxItemSize(page) \ + MAXALIGN_DOWN(PageGetPageSize(page) - \ + SizeOfPageHeaderData - \ + sizeof(ItemIdData) - \ + MAXALIGN(sizeof(HashPageOpaqueData))) + +#define INDEX_MOVED_BY_SPLIT_MASK INDEX_AM_RESERVED_BIT + +#define HASH_MIN_FILLFACTOR 10 +#define HASH_DEFAULT_FILLFACTOR 75 + +/* + * Constants + */ +#define BYTE_TO_BIT 3 /* 2^3 bits/byte */ +#define ALL_SET ((uint32) ~0) + +/* + * Bitmap pages do not contain tuples. They do contain the standard + * page headers and trailers; however, everything in between is a + * giant bit array. The number of bits that fit on a page obviously + * depends on the page size and the header/trailer overhead. We require + * the number of bits per page to be a power of 2. + */ +#define BMPGSZ_BYTE(metap) ((metap)->hashm_bmsize) +#define BMPGSZ_BIT(metap) ((metap)->hashm_bmsize << BYTE_TO_BIT) +#define BMPG_SHIFT(metap) ((metap)->hashm_bmshift) +#define BMPG_MASK(metap) (BMPGSZ_BIT(metap) - 1) + +#define HashPageGetBitmap(page) \ + ((uint32 *) PageGetContents(page)) + +#define HashGetMaxBitmapSize(page) \ + (PageGetPageSize((Page) page) - \ + (MAXALIGN(SizeOfPageHeaderData) + MAXALIGN(sizeof(HashPageOpaqueData)))) + +#define HashPageGetMeta(page) \ + ((HashMetaPage) PageGetContents(page)) + +/* + * The number of bits in an ovflpage bitmap word. + */ +#define BITS_PER_MAP 32 /* Number of bits in uint32 */ + +/* Given the address of the beginning of a bit map, clear/set the nth bit */ +#define CLRBIT(A, N) ((A)[(N)/BITS_PER_MAP] &= ~(1<<((N)%BITS_PER_MAP))) +#define SETBIT(A, N) ((A)[(N)/BITS_PER_MAP] |= (1<<((N)%BITS_PER_MAP))) +#define ISSET(A, N) ((A)[(N)/BITS_PER_MAP] & (1<<((N)%BITS_PER_MAP))) + +/* + * page-level and high-level locking modes (see README) + */ +#define HASH_READ BUFFER_LOCK_SHARE +#define HASH_WRITE BUFFER_LOCK_EXCLUSIVE +#define HASH_NOLOCK (-1) + +/* + * When a new operator class is declared, we require that the user supply + * us with an amproc function for hashing a key of the new type, returning + * a 32-bit hash value. We call this the "standard" hash function. We + * also allow an optional "extended" hash function which accepts a salt and + * returns a 64-bit hash value. This is highly recommended but, for reasons + * of backward compatibility, optional. + * + * When the salt is 0, the low 32 bits of the value returned by the extended + * hash function should match the value that would have been returned by the + * standard hash function. + */ +#define HASHSTANDARD_PROC 1 +#define HASHEXTENDED_PROC 2 +#define HASHOPTIONS_PROC 3 +#define HASHNProcs 3 + + +/* public routines */ + +extern IndexBuildResult *hashbuild(Relation heap, Relation index, + struct IndexInfo *indexInfo); +extern void hashbuildempty(Relation index); +extern bool hashinsert(Relation rel, Datum *values, bool *isnull, + ItemPointer ht_ctid, Relation heapRel, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); +extern bool hashgettuple(IndexScanDesc scan, ScanDirection dir); +extern int64 hashgetbitmap(IndexScanDesc scan, TIDBitmap *tbm); +extern IndexScanDesc hashbeginscan(Relation rel, int nkeys, int norderbys); +extern void hashrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, + ScanKey orderbys, int norderbys); +extern void hashendscan(IndexScanDesc scan); +extern IndexBulkDeleteResult *hashbulkdelete(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); +extern IndexBulkDeleteResult *hashvacuumcleanup(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats); +extern bytea *hashoptions(Datum reloptions, bool validate); +extern bool hashvalidate(Oid opclassoid); +extern void hashadjustmembers(Oid opfamilyoid, + Oid opclassoid, + List *operators, + List *functions); + +extern CompareType hashtranslatestrategy(StrategyNumber strategy, Oid opfamily); +extern StrategyNumber hashtranslatecmptype(CompareType cmptype, Oid opfamily); + +/* private routines */ + +/* hashinsert.c */ +extern void _hash_doinsert(Relation rel, IndexTuple itup, Relation heapRel, + bool sorted); +extern OffsetNumber _hash_pgaddtup(Relation rel, Buffer buf, + Size itemsize, IndexTuple itup, + bool appendtup); +extern void _hash_pgaddmultitup(Relation rel, Buffer buf, IndexTuple *itups, + OffsetNumber *itup_offsets, uint16 nitups); + +/* hashovfl.c */ +extern Buffer _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf, bool retain_pin); +extern BlockNumber _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf, + Buffer wbuf, IndexTuple *itups, OffsetNumber *itup_offsets, + Size *tups_size, uint16 nitups, BufferAccessStrategy bstrategy); +extern void _hash_initbitmapbuffer(Buffer buf, uint16 bmsize, bool initpage); +extern void _hash_squeezebucket(Relation rel, + Bucket bucket, BlockNumber bucket_blkno, + Buffer bucket_buf, + BufferAccessStrategy bstrategy); +extern uint32 _hash_ovflblkno_to_bitno(HashMetaPage metap, BlockNumber ovflblkno); + +/* hashpage.c */ +extern Buffer _hash_getbuf(Relation rel, BlockNumber blkno, + int access, int flags); +extern Buffer _hash_getbuf_with_condlock_cleanup(Relation rel, + BlockNumber blkno, int flags); +extern HashMetaPage _hash_getcachedmetap(Relation rel, Buffer *metabuf, + bool force_refresh); +extern Buffer _hash_getbucketbuf_from_hashkey(Relation rel, uint32 hashkey, + int access, + HashMetaPage *cachedmetap); +extern Buffer _hash_getinitbuf(Relation rel, BlockNumber blkno); +extern void _hash_initbuf(Buffer buf, uint32 max_bucket, uint32 num_bucket, + uint32 flag, bool initpage); +extern Buffer _hash_getnewbuf(Relation rel, BlockNumber blkno, + ForkNumber forkNum); +extern Buffer _hash_getbuf_with_strategy(Relation rel, BlockNumber blkno, + int access, int flags, + BufferAccessStrategy bstrategy); +extern void _hash_relbuf(Relation rel, Buffer buf); +extern void _hash_dropbuf(Relation rel, Buffer buf); +extern void _hash_dropscanbuf(Relation rel, HashScanOpaque so); +extern uint32 _hash_init(Relation rel, double num_tuples, + ForkNumber forkNum); +extern void _hash_init_metabuffer(Buffer buf, double num_tuples, + RegProcedure procid, uint16 ffactor, bool initpage); +extern void _hash_pageinit(Page page, Size size); +extern void _hash_expandtable(Relation rel, Buffer metabuf); +extern void _hash_finish_split(Relation rel, Buffer metabuf, Buffer obuf, + Bucket obucket, uint32 maxbucket, uint32 highmask, + uint32 lowmask); + +/* hashsearch.c */ +extern bool _hash_next(IndexScanDesc scan, ScanDirection dir); +extern bool _hash_first(IndexScanDesc scan, ScanDirection dir); + +/* hashsort.c */ +typedef struct HSpool HSpool; /* opaque struct in hashsort.c */ + +extern HSpool *_h_spoolinit(Relation heap, Relation index, uint32 num_buckets); +extern void _h_spooldestroy(HSpool *hspool); +extern void _h_spool(HSpool *hspool, ItemPointer self, + const Datum *values, const bool *isnull); +extern void _h_indexbuild(HSpool *hspool, Relation heapRel); + +/* hashutil.c */ +extern bool _hash_checkqual(IndexScanDesc scan, IndexTuple itup); +extern uint32 _hash_datum2hashkey(Relation rel, Datum key); +extern uint32 _hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype); +extern Bucket _hash_hashkey2bucket(uint32 hashkey, uint32 maxbucket, + uint32 highmask, uint32 lowmask); +extern uint32 _hash_spareindex(uint32 num_bucket); +extern uint32 _hash_get_totalbuckets(uint32 splitpoint_phase); +extern void _hash_checkpage(Relation rel, Buffer buf, int flags); +extern uint32 _hash_get_indextuple_hashkey(IndexTuple itup); +extern bool _hash_convert_tuple(Relation index, + Datum *user_values, bool *user_isnull, + Datum *index_values, bool *index_isnull); +extern OffsetNumber _hash_binsearch(Page page, uint32 hash_value); +extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value); +extern BlockNumber _hash_get_oldblock_from_newbucket(Relation rel, Bucket new_bucket); +extern BlockNumber _hash_get_newblock_from_oldbucket(Relation rel, Bucket old_bucket); +extern Bucket _hash_get_newbucket_from_oldbucket(Relation rel, Bucket old_bucket, + uint32 lowmask, uint32 maxbucket); +extern void _hash_kill_items(IndexScanDesc scan); + +/* hash.c */ +extern void hashbucketcleanup(Relation rel, Bucket cur_bucket, + Buffer bucket_buf, BlockNumber bucket_blkno, + BufferAccessStrategy bstrategy, + uint32 maxbucket, uint32 highmask, uint32 lowmask, + double *tuples_removed, double *num_index_tuples, + bool split_cleanup, + IndexBulkDeleteCallback callback, void *callback_state); + +#endif /* HASH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/hash_xlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/hash_xlog.h new file mode 100644 index 0000000..5d4671d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/hash_xlog.h @@ -0,0 +1,270 @@ +/*------------------------------------------------------------------------- + * + * hash_xlog.h + * header file for Postgres hash AM implementation + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/hash_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef HASH_XLOG_H +#define HASH_XLOG_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/off.h" + +/* Number of buffers required for XLOG_HASH_SQUEEZE_PAGE operation */ +#define HASH_XLOG_FREE_OVFL_BUFS 6 + +/* + * XLOG records for hash operations + */ +#define XLOG_HASH_INIT_META_PAGE 0x00 /* initialize the meta page */ +#define XLOG_HASH_INIT_BITMAP_PAGE 0x10 /* initialize the bitmap page */ +#define XLOG_HASH_INSERT 0x20 /* add index tuple without split */ +#define XLOG_HASH_ADD_OVFL_PAGE 0x30 /* add overflow page */ +#define XLOG_HASH_SPLIT_ALLOCATE_PAGE 0x40 /* allocate new page for split */ +#define XLOG_HASH_SPLIT_PAGE 0x50 /* split page */ +#define XLOG_HASH_SPLIT_COMPLETE 0x60 /* completion of split operation */ +#define XLOG_HASH_MOVE_PAGE_CONTENTS 0x70 /* remove tuples from one page + * and add to another page */ +#define XLOG_HASH_SQUEEZE_PAGE 0x80 /* add tuples to one of the previous + * pages in chain and free the ovfl + * page */ +#define XLOG_HASH_DELETE 0x90 /* delete index tuples from a page */ +#define XLOG_HASH_SPLIT_CLEANUP 0xA0 /* clear split-cleanup flag in primary + * bucket page after deleting tuples + * that are moved due to split */ +#define XLOG_HASH_UPDATE_META_PAGE 0xB0 /* update meta page after vacuum */ + +#define XLOG_HASH_VACUUM_ONE_PAGE 0xC0 /* remove dead tuples from index + * page */ + +/* + * xl_hash_split_allocate_page flag values, 8 bits are available. + */ +#define XLH_SPLIT_META_UPDATE_MASKS (1<<0) +#define XLH_SPLIT_META_UPDATE_SPLITPOINT (1<<1) + +/* + * This is what we need to know about simple (without split) insert. + * + * This data record is used for XLOG_HASH_INSERT + * + * Backup Blk 0: original page (data contains the inserted tuple) + * Backup Blk 1: metapage (HashMetaPageData) + */ +typedef struct xl_hash_insert +{ + OffsetNumber offnum; +} xl_hash_insert; + +#define SizeOfHashInsert (offsetof(xl_hash_insert, offnum) + sizeof(OffsetNumber)) + +/* + * This is what we need to know about addition of overflow page. + * + * This data record is used for XLOG_HASH_ADD_OVFL_PAGE + * + * Backup Blk 0: newly allocated overflow page + * Backup Blk 1: page before new overflow page in the bucket chain + * Backup Blk 2: bitmap page + * Backup Blk 3: new bitmap page + * Backup Blk 4: metapage + */ +typedef struct xl_hash_add_ovfl_page +{ + uint16 bmsize; + bool bmpage_found; +} xl_hash_add_ovfl_page; + +#define SizeOfHashAddOvflPage \ + (offsetof(xl_hash_add_ovfl_page, bmpage_found) + sizeof(bool)) + +/* + * This is what we need to know about allocating a page for split. + * + * This data record is used for XLOG_HASH_SPLIT_ALLOCATE_PAGE + * + * Backup Blk 0: page for old bucket + * Backup Blk 1: page for new bucket + * Backup Blk 2: metapage + */ +typedef struct xl_hash_split_allocate_page +{ + uint32 new_bucket; + uint16 old_bucket_flag; + uint16 new_bucket_flag; + uint8 flags; +} xl_hash_split_allocate_page; + +#define SizeOfHashSplitAllocPage \ + (offsetof(xl_hash_split_allocate_page, flags) + sizeof(uint8)) + +/* + * This is what we need to know about completing the split operation. + * + * This data record is used for XLOG_HASH_SPLIT_COMPLETE + * + * Backup Blk 0: page for old bucket + * Backup Blk 1: page for new bucket + */ +typedef struct xl_hash_split_complete +{ + uint16 old_bucket_flag; + uint16 new_bucket_flag; +} xl_hash_split_complete; + +#define SizeOfHashSplitComplete \ + (offsetof(xl_hash_split_complete, new_bucket_flag) + sizeof(uint16)) + +/* + * This is what we need to know about move page contents required during + * squeeze operation. + * + * This data record is used for XLOG_HASH_MOVE_PAGE_CONTENTS + * + * Backup Blk 0: primary bucket page + * Backup Blk 1: page containing moved tuples + * Backup Blk 2: page from which tuples will be removed + */ +typedef struct xl_hash_move_page_contents +{ + uint16 ntups; + bool is_prim_bucket_same_wrt; /* true if the page to which + * tuples are moved is same as + * primary bucket page */ +} xl_hash_move_page_contents; + +#define SizeOfHashMovePageContents \ + (offsetof(xl_hash_move_page_contents, is_prim_bucket_same_wrt) + sizeof(bool)) + +/* + * This is what we need to know about the squeeze page operation. + * + * This data record is used for XLOG_HASH_SQUEEZE_PAGE + * + * Backup Blk 0: primary bucket page + * Backup Blk 1: page containing tuples moved from freed overflow page + * Backup Blk 2: freed overflow page + * Backup Blk 3: page previous to the freed overflow page + * Backup Blk 4: page next to the freed overflow page + * Backup Blk 5: bitmap page containing info of freed overflow page + * Backup Blk 6: meta page + */ +typedef struct xl_hash_squeeze_page +{ + BlockNumber prevblkno; + BlockNumber nextblkno; + uint16 ntups; + bool is_prim_bucket_same_wrt; /* true if the page to which + * tuples are moved is same as + * primary bucket page */ + bool is_prev_bucket_same_wrt; /* true if the page to which + * tuples are moved is the page + * previous to the freed overflow + * page */ +} xl_hash_squeeze_page; + +#define SizeOfHashSqueezePage \ + (offsetof(xl_hash_squeeze_page, is_prev_bucket_same_wrt) + sizeof(bool)) + +/* + * This is what we need to know about the deletion of index tuples from a page. + * + * This data record is used for XLOG_HASH_DELETE + * + * Backup Blk 0: primary bucket page + * Backup Blk 1: page from which tuples are deleted + */ +typedef struct xl_hash_delete +{ + bool clear_dead_marking; /* true if this operation clears + * LH_PAGE_HAS_DEAD_TUPLES flag */ + bool is_primary_bucket_page; /* true if the operation is for + * primary bucket page */ +} xl_hash_delete; + +#define SizeOfHashDelete (offsetof(xl_hash_delete, is_primary_bucket_page) + sizeof(bool)) + +/* + * This is what we need for metapage update operation. + * + * This data record is used for XLOG_HASH_UPDATE_META_PAGE + * + * Backup Blk 0: meta page + */ +typedef struct xl_hash_update_meta_page +{ + double ntuples; +} xl_hash_update_meta_page; + +#define SizeOfHashUpdateMetaPage \ + (offsetof(xl_hash_update_meta_page, ntuples) + sizeof(double)) + +/* + * This is what we need to initialize metapage. + * + * This data record is used for XLOG_HASH_INIT_META_PAGE + * + * Backup Blk 0: meta page + */ +typedef struct xl_hash_init_meta_page +{ + double num_tuples; + RegProcedure procid; + uint16 ffactor; +} xl_hash_init_meta_page; + +#define SizeOfHashInitMetaPage \ + (offsetof(xl_hash_init_meta_page, ffactor) + sizeof(uint16)) + +/* + * This is what we need to initialize bitmap page. + * + * This data record is used for XLOG_HASH_INIT_BITMAP_PAGE + * + * Backup Blk 0: bitmap page + * Backup Blk 1: meta page + */ +typedef struct xl_hash_init_bitmap_page +{ + uint16 bmsize; +} xl_hash_init_bitmap_page; + +#define SizeOfHashInitBitmapPage \ + (offsetof(xl_hash_init_bitmap_page, bmsize) + sizeof(uint16)) + +/* + * This is what we need for index tuple deletion and to + * update the meta page. + * + * This data record is used for XLOG_HASH_VACUUM_ONE_PAGE + * + * Backup Blk 0: primary bucket page + * Backup Blk 1: meta page + */ +typedef struct xl_hash_vacuum_one_page +{ + TransactionId snapshotConflictHorizon; + uint16 ntuples; + bool isCatalogRel; /* to handle recovery conflict during logical + * decoding on standby */ + + /* TARGET OFFSET NUMBERS */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} xl_hash_vacuum_one_page; + +#define SizeOfHashVacuumOnePage offsetof(xl_hash_vacuum_one_page, offsets) + +extern void hash_redo(XLogReaderState *record); +extern void hash_desc(StringInfo buf, XLogReaderState *record); +extern const char *hash_identify(uint8 info); +extern void hash_mask(char *pagedata, BlockNumber blkno); + +#endif /* HASH_XLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/heapam.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/heapam.h new file mode 100644 index 0000000..3a9424c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/heapam.h @@ -0,0 +1,455 @@ +/*------------------------------------------------------------------------- + * + * heapam.h + * POSTGRES heap access method definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/heapam.h + * + *------------------------------------------------------------------------- + */ +#ifndef HEAPAM_H +#define HEAPAM_H + +#include "access/heapam_xlog.h" +#include "access/relation.h" /* for backward compatibility */ +#include "access/relscan.h" +#include "access/sdir.h" +#include "access/skey.h" +#include "access/table.h" /* for backward compatibility */ +#include "access/tableam.h" +#include "nodes/lockoptions.h" +#include "nodes/primnodes.h" +#include "storage/bufpage.h" +#include "storage/dsm.h" +#include "storage/lockdefs.h" +#include "storage/read_stream.h" +#include "storage/shm_toc.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + + +/* "options" flag bits for heap_insert */ +#define HEAP_INSERT_SKIP_FSM TABLE_INSERT_SKIP_FSM +#define HEAP_INSERT_FROZEN TABLE_INSERT_FROZEN +#define HEAP_INSERT_NO_LOGICAL TABLE_INSERT_NO_LOGICAL +#define HEAP_INSERT_SPECULATIVE 0x0010 + +/* "options" flag bits for heap_page_prune_and_freeze */ +#define HEAP_PAGE_PRUNE_MARK_UNUSED_NOW (1 << 0) +#define HEAP_PAGE_PRUNE_FREEZE (1 << 1) + +typedef struct BulkInsertStateData *BulkInsertState; +struct TupleTableSlot; +struct VacuumCutoffs; + +#define MaxLockTupleMode LockTupleExclusive + +/* + * Descriptor for heap table scans. + */ +typedef struct HeapScanDescData +{ + TableScanDescData rs_base; /* AM independent part of the descriptor */ + + /* state set up at initscan time */ + BlockNumber rs_nblocks; /* total number of blocks in rel */ + BlockNumber rs_startblock; /* block # to start at */ + BlockNumber rs_numblocks; /* max number of blocks to scan */ + /* rs_numblocks is usually InvalidBlockNumber, meaning "scan whole rel" */ + + /* scan current state */ + bool rs_inited; /* false = scan not init'd yet */ + OffsetNumber rs_coffset; /* current offset # in non-page-at-a-time mode */ + BlockNumber rs_cblock; /* current block # in scan, if any */ + Buffer rs_cbuf; /* current buffer in scan, if any */ + /* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */ + + BufferAccessStrategy rs_strategy; /* access strategy for reads */ + + HeapTupleData rs_ctup; /* current tuple in scan, if any */ + + /* For scans that stream reads */ + ReadStream *rs_read_stream; + + /* + * For sequential scans and TID range scans to stream reads. The read + * stream is allocated at the beginning of the scan and reset on rescan or + * when the scan direction changes. The scan direction is saved each time + * a new page is requested. If the scan direction changes from one page to + * the next, the read stream releases all previously pinned buffers and + * resets the prefetch block. + */ + ScanDirection rs_dir; + BlockNumber rs_prefetch_block; + + /* + * For parallel scans to store page allocation data. NULL when not + * performing a parallel scan. + */ + ParallelBlockTableScanWorkerData *rs_parallelworkerdata; + + /* these fields only used in page-at-a-time mode and for bitmap scans */ + uint32 rs_cindex; /* current tuple's index in vistuples */ + uint32 rs_ntuples; /* number of visible tuples on page */ + OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]; /* their offsets */ +} HeapScanDescData; +typedef struct HeapScanDescData *HeapScanDesc; + +typedef struct BitmapHeapScanDescData +{ + HeapScanDescData rs_heap_base; + + /* Holds no data */ +} BitmapHeapScanDescData; +typedef struct BitmapHeapScanDescData *BitmapHeapScanDesc; + +/* + * Descriptor for fetches from heap via an index. + */ +typedef struct IndexFetchHeapData +{ + IndexFetchTableData xs_base; /* AM independent part of the descriptor */ + + Buffer xs_cbuf; /* current heap buffer in scan, if any */ + /* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */ +} IndexFetchHeapData; + +/* Result codes for HeapTupleSatisfiesVacuum */ +typedef enum +{ + HEAPTUPLE_DEAD, /* tuple is dead and deletable */ + HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */ + HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */ + HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */ + HEAPTUPLE_DELETE_IN_PROGRESS, /* deleting xact is still in progress */ +} HTSV_Result; + +/* + * heap_prepare_freeze_tuple may request that heap_freeze_execute_prepared + * check any tuple's to-be-frozen xmin and/or xmax status using pg_xact + */ +#define HEAP_FREEZE_CHECK_XMIN_COMMITTED 0x01 +#define HEAP_FREEZE_CHECK_XMAX_ABORTED 0x02 + +/* heap_prepare_freeze_tuple state describing how to freeze a tuple */ +typedef struct HeapTupleFreeze +{ + /* Fields describing how to process tuple */ + TransactionId xmax; + uint16 t_infomask2; + uint16 t_infomask; + uint8 frzflags; + + /* xmin/xmax check flags */ + uint8 checkflags; + /* Page offset number for tuple */ + OffsetNumber offset; +} HeapTupleFreeze; + +/* + * State used by VACUUM to track the details of freezing all eligible tuples + * on a given heap page. + * + * VACUUM prepares freeze plans for each page via heap_prepare_freeze_tuple + * calls (every tuple with storage gets its own call). This page-level freeze + * state is updated across each call, which ultimately determines whether or + * not freezing the page is required. + * + * Aside from the basic question of whether or not freezing will go ahead, the + * state also tracks the oldest extant XID/MXID in the table as a whole, for + * the purposes of advancing relfrozenxid/relminmxid values in pg_class later + * on. Each heap_prepare_freeze_tuple call pushes NewRelfrozenXid and/or + * NewRelminMxid back as required to avoid unsafe final pg_class values. Any + * and all unfrozen XIDs or MXIDs that remain after VACUUM finishes _must_ + * have values >= the final relfrozenxid/relminmxid values in pg_class. This + * includes XIDs that remain as MultiXact members from any tuple's xmax. + * + * When 'freeze_required' flag isn't set after all tuples are examined, the + * final choice on freezing is made by vacuumlazy.c. It can decide to trigger + * freezing based on whatever criteria it deems appropriate. However, it is + * recommended that vacuumlazy.c avoid early freezing when freezing does not + * enable setting the target page all-frozen in the visibility map afterwards. + */ +typedef struct HeapPageFreeze +{ + /* Is heap_prepare_freeze_tuple caller required to freeze page? */ + bool freeze_required; + + /* + * "Freeze" NewRelfrozenXid/NewRelminMxid trackers. + * + * Trackers used when heap_freeze_execute_prepared freezes, or when there + * are zero freeze plans for a page. It is always valid for vacuumlazy.c + * to freeze any page, by definition. This even includes pages that have + * no tuples with storage to consider in the first place. That way the + * 'totally_frozen' results from heap_prepare_freeze_tuple can always be + * used in the same way, even when no freeze plans need to be executed to + * "freeze the page". Only the "freeze" path needs to consider the need + * to set pages all-frozen in the visibility map under this scheme. + * + * When we freeze a page, we generally freeze all XIDs < OldestXmin, only + * leaving behind XIDs that are ineligible for freezing, if any. And so + * you might wonder why these trackers are necessary at all; why should + * _any_ page that VACUUM freezes _ever_ be left with XIDs/MXIDs that + * ratchet back the top-level NewRelfrozenXid/NewRelminMxid trackers? + * + * It is useful to use a definition of "freeze the page" that does not + * overspecify how MultiXacts are affected. heap_prepare_freeze_tuple + * generally prefers to remove Multis eagerly, but lazy processing is used + * in cases where laziness allows VACUUM to avoid allocating a new Multi. + * The "freeze the page" trackers enable this flexibility. + */ + TransactionId FreezePageRelfrozenXid; + MultiXactId FreezePageRelminMxid; + + /* + * "No freeze" NewRelfrozenXid/NewRelminMxid trackers. + * + * These trackers are maintained in the same way as the trackers used when + * VACUUM scans a page that isn't cleanup locked. Both code paths are + * based on the same general idea (do less work for this page during the + * ongoing VACUUM, at the cost of having to accept older final values). + */ + TransactionId NoFreezePageRelfrozenXid; + MultiXactId NoFreezePageRelminMxid; + +} HeapPageFreeze; + +/* + * Per-page state returned by heap_page_prune_and_freeze() + */ +typedef struct PruneFreezeResult +{ + int ndeleted; /* Number of tuples deleted from the page */ + int nnewlpdead; /* Number of newly LP_DEAD items */ + int nfrozen; /* Number of tuples we froze */ + + /* Number of live and recently dead tuples on the page, after pruning */ + int live_tuples; + int recently_dead_tuples; + + /* + * all_visible and all_frozen indicate if the all-visible and all-frozen + * bits in the visibility map can be set for this page, after pruning. + * + * vm_conflict_horizon is the newest xmin of live tuples on the page. The + * caller can use it as the conflict horizon when setting the VM bits. It + * is only valid if we froze some tuples (nfrozen > 0), and all_frozen is + * true. + * + * These are only set if the HEAP_PRUNE_FREEZE option is set. + */ + bool all_visible; + bool all_frozen; + TransactionId vm_conflict_horizon; + + /* + * Whether or not the page makes rel truncation unsafe. This is set to + * 'true', even if the page contains LP_DEAD items. VACUUM will remove + * them before attempting to truncate. + */ + bool hastup; + + /* + * LP_DEAD items on the page after pruning. Includes existing LP_DEAD + * items. + */ + int lpdead_items; + OffsetNumber deadoffsets[MaxHeapTuplesPerPage]; +} PruneFreezeResult; + +/* 'reason' codes for heap_page_prune_and_freeze() */ +typedef enum +{ + PRUNE_ON_ACCESS, /* on-access pruning */ + PRUNE_VACUUM_SCAN, /* VACUUM 1st heap pass */ + PRUNE_VACUUM_CLEANUP, /* VACUUM 2nd heap pass */ +} PruneReason; + +/* ---------------- + * function prototypes for heap access method + * + * heap_create, heap_create_with_catalog, and heap_drop_with_catalog + * are declared in catalog/heap.h + * ---------------- + */ + + +/* + * HeapScanIsValid + * True iff the heap scan is valid. + */ +#define HeapScanIsValid(scan) PointerIsValid(scan) + +extern TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot, + int nkeys, ScanKey key, + ParallelTableScanDesc parallel_scan, + uint32 flags); +extern void heap_setscanlimits(TableScanDesc sscan, BlockNumber startBlk, + BlockNumber numBlks); +extern void heap_prepare_pagescan(TableScanDesc sscan); +extern void heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params, + bool allow_strat, bool allow_sync, bool allow_pagemode); +extern void heap_endscan(TableScanDesc sscan); +extern HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction); +extern bool heap_getnextslot(TableScanDesc sscan, + ScanDirection direction, struct TupleTableSlot *slot); +extern void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid, + ItemPointer maxtid); +extern bool heap_getnextslot_tidrange(TableScanDesc sscan, + ScanDirection direction, + TupleTableSlot *slot); +extern bool heap_fetch(Relation relation, Snapshot snapshot, + HeapTuple tuple, Buffer *userbuf, bool keep_buf); +extern bool heap_hot_search_buffer(ItemPointer tid, Relation relation, + Buffer buffer, Snapshot snapshot, HeapTuple heapTuple, + bool *all_dead, bool first_call); + +extern void heap_get_latest_tid(TableScanDesc sscan, ItemPointer tid); + +extern BulkInsertState GetBulkInsertState(void); +extern void FreeBulkInsertState(BulkInsertState); +extern void ReleaseBulkInsertStatePin(BulkInsertState bistate); + +extern void heap_insert(Relation relation, HeapTuple tup, CommandId cid, + int options, BulkInsertState bistate); +extern void heap_multi_insert(Relation relation, struct TupleTableSlot **slots, + int ntuples, CommandId cid, int options, + BulkInsertState bistate); +extern TM_Result heap_delete(Relation relation, ItemPointer tid, + CommandId cid, Snapshot crosscheck, bool wait, + struct TM_FailureData *tmfd, bool changingPart); +extern void heap_finish_speculative(Relation relation, ItemPointer tid); +extern void heap_abort_speculative(Relation relation, ItemPointer tid); +extern TM_Result heap_update(Relation relation, ItemPointer otid, + HeapTuple newtup, + CommandId cid, Snapshot crosscheck, bool wait, + struct TM_FailureData *tmfd, LockTupleMode *lockmode, + TU_UpdateIndexes *update_indexes); +extern TM_Result heap_lock_tuple(Relation relation, HeapTuple tuple, + CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, + bool follow_updates, + Buffer *buffer, struct TM_FailureData *tmfd); + +extern bool heap_inplace_lock(Relation relation, + HeapTuple oldtup_ptr, Buffer buffer, + void (*release_callback) (void *), void *arg); +extern void heap_inplace_update_and_unlock(Relation relation, + HeapTuple oldtup, HeapTuple tuple, + Buffer buffer); +extern void heap_inplace_unlock(Relation relation, + HeapTuple oldtup, Buffer buffer); +extern bool heap_prepare_freeze_tuple(HeapTupleHeader tuple, + const struct VacuumCutoffs *cutoffs, + HeapPageFreeze *pagefrz, + HeapTupleFreeze *frz, bool *totally_frozen); + +extern void heap_pre_freeze_checks(Buffer buffer, + HeapTupleFreeze *tuples, int ntuples); +extern void heap_freeze_prepared_tuples(Buffer buffer, + HeapTupleFreeze *tuples, int ntuples); +extern bool heap_freeze_tuple(HeapTupleHeader tuple, + TransactionId relfrozenxid, TransactionId relminmxid, + TransactionId FreezeLimit, TransactionId MultiXactCutoff); +extern bool heap_tuple_should_freeze(HeapTupleHeader tuple, + const struct VacuumCutoffs *cutoffs, + TransactionId *NoFreezePageRelfrozenXid, + MultiXactId *NoFreezePageRelminMxid); +extern bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple); + +extern void simple_heap_insert(Relation relation, HeapTuple tup); +extern void simple_heap_delete(Relation relation, ItemPointer tid); +extern void simple_heap_update(Relation relation, ItemPointer otid, + HeapTuple tup, TU_UpdateIndexes *update_indexes); + +extern TransactionId heap_index_delete_tuples(Relation rel, + TM_IndexDeleteOp *delstate); + +/* in heap/pruneheap.c */ +struct GlobalVisState; +extern void heap_page_prune_opt(Relation relation, Buffer buffer); +extern void heap_page_prune_and_freeze(Relation relation, Buffer buffer, + struct GlobalVisState *vistest, + int options, + struct VacuumCutoffs *cutoffs, + PruneFreezeResult *presult, + PruneReason reason, + OffsetNumber *off_loc, + TransactionId *new_relfrozen_xid, + MultiXactId *new_relmin_mxid); +extern void heap_page_prune_execute(Buffer buffer, bool lp_truncate_only, + OffsetNumber *redirected, int nredirected, + OffsetNumber *nowdead, int ndead, + OffsetNumber *nowunused, int nunused); +extern void heap_get_root_tuples(Page page, OffsetNumber *root_offsets); +extern void log_heap_prune_and_freeze(Relation relation, Buffer buffer, + TransactionId conflict_xid, + bool cleanup_lock, + PruneReason reason, + HeapTupleFreeze *frozen, int nfrozen, + OffsetNumber *redirected, int nredirected, + OffsetNumber *dead, int ndead, + OffsetNumber *unused, int nunused); + +/* in heap/vacuumlazy.c */ +struct VacuumParams; +extern void heap_vacuum_rel(Relation rel, + struct VacuumParams *params, BufferAccessStrategy bstrategy); + +/* in heap/heapam_visibility.c */ +extern bool HeapTupleSatisfiesVisibility(HeapTuple htup, Snapshot snapshot, + Buffer buffer); +extern TM_Result HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, + Buffer buffer); +extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin, + Buffer buffer); +extern HTSV_Result HeapTupleSatisfiesVacuumHorizon(HeapTuple htup, Buffer buffer, + TransactionId *dead_after); +extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer, + uint16 infomask, TransactionId xid); +extern bool HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple); +extern bool HeapTupleIsSurelyDead(HeapTuple htup, + struct GlobalVisState *vistest); + +/* + * To avoid leaking too much knowledge about reorderbuffer implementation + * details this is implemented in reorderbuffer.c not heapam_visibility.c + */ +struct HTAB; +extern bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data, + Snapshot snapshot, + HeapTuple htup, + Buffer buffer, + CommandId *cmin, CommandId *cmax); +extern void HeapCheckForSerializableConflictOut(bool visible, Relation relation, HeapTuple tuple, + Buffer buffer, Snapshot snapshot); + +/* + * heap_execute_freeze_tuple + * Execute the prepared freezing of a tuple with caller's freeze plan. + * + * Caller is responsible for ensuring that no other backend can access the + * storage underlying this tuple, either by holding an exclusive lock on the + * buffer containing it (which is what lazy VACUUM does), or by having it be + * in private storage (which is what CLUSTER and friends do). + */ +static inline void +heap_execute_freeze_tuple(HeapTupleHeader tuple, HeapTupleFreeze *frz) +{ + HeapTupleHeaderSetXmax(tuple, frz->xmax); + + if (frz->frzflags & XLH_FREEZE_XVAC) + HeapTupleHeaderSetXvac(tuple, FrozenTransactionId); + + if (frz->frzflags & XLH_INVALID_XVAC) + HeapTupleHeaderSetXvac(tuple, InvalidTransactionId); + + tuple->t_infomask = frz->t_infomask; + tuple->t_infomask2 = frz->t_infomask2; +} + +#endif /* HEAPAM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/heapam_xlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/heapam_xlog.h new file mode 100644 index 0000000..277df6b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/heapam_xlog.h @@ -0,0 +1,508 @@ +/*------------------------------------------------------------------------- + * + * heapam_xlog.h + * POSTGRES heap access XLOG definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/heapam_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef HEAPAM_XLOG_H +#define HEAPAM_XLOG_H + +#include "access/htup.h" +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/buf.h" +#include "storage/bufpage.h" +#include "storage/relfilelocator.h" +#include "storage/sinval.h" +#include "utils/relcache.h" + + +/* + * WAL record definitions for heapam.c's WAL operations + * + * XLOG allows to store some information in high 4 bits of log + * record xl_info field. We use 3 for opcode and one for init bit. + */ +#define XLOG_HEAP_INSERT 0x00 +#define XLOG_HEAP_DELETE 0x10 +#define XLOG_HEAP_UPDATE 0x20 +#define XLOG_HEAP_TRUNCATE 0x30 +#define XLOG_HEAP_HOT_UPDATE 0x40 +#define XLOG_HEAP_CONFIRM 0x50 +#define XLOG_HEAP_LOCK 0x60 +#define XLOG_HEAP_INPLACE 0x70 + +#define XLOG_HEAP_OPMASK 0x70 +/* + * When we insert 1st item on new page in INSERT, UPDATE, HOT_UPDATE, + * or MULTI_INSERT, we can (and we do) restore entire page in redo + */ +#define XLOG_HEAP_INIT_PAGE 0x80 +/* + * We ran out of opcodes, so heapam.c now has a second RmgrId. These opcodes + * are associated with RM_HEAP2_ID, but are not logically different from + * the ones above associated with RM_HEAP_ID. XLOG_HEAP_OPMASK applies to + * these, too. + * + * There's no difference between XLOG_HEAP2_PRUNE_ON_ACCESS, + * XLOG_HEAP2_PRUNE_VACUUM_SCAN and XLOG_HEAP2_PRUNE_VACUUM_CLEANUP records. + * They have separate opcodes just for debugging and analysis purposes, to + * indicate why the WAL record was emitted. + */ +#define XLOG_HEAP2_REWRITE 0x00 +#define XLOG_HEAP2_PRUNE_ON_ACCESS 0x10 +#define XLOG_HEAP2_PRUNE_VACUUM_SCAN 0x20 +#define XLOG_HEAP2_PRUNE_VACUUM_CLEANUP 0x30 +#define XLOG_HEAP2_VISIBLE 0x40 +#define XLOG_HEAP2_MULTI_INSERT 0x50 +#define XLOG_HEAP2_LOCK_UPDATED 0x60 +#define XLOG_HEAP2_NEW_CID 0x70 + +/* + * xl_heap_insert/xl_heap_multi_insert flag values, 8 bits are available. + */ +/* PD_ALL_VISIBLE was cleared */ +#define XLH_INSERT_ALL_VISIBLE_CLEARED (1<<0) +#define XLH_INSERT_LAST_IN_MULTI (1<<1) +#define XLH_INSERT_IS_SPECULATIVE (1<<2) +#define XLH_INSERT_CONTAINS_NEW_TUPLE (1<<3) +#define XLH_INSERT_ON_TOAST_RELATION (1<<4) + +/* all_frozen_set always implies all_visible_set */ +#define XLH_INSERT_ALL_FROZEN_SET (1<<5) + +/* + * xl_heap_update flag values, 8 bits are available. + */ +/* PD_ALL_VISIBLE was cleared */ +#define XLH_UPDATE_OLD_ALL_VISIBLE_CLEARED (1<<0) +/* PD_ALL_VISIBLE was cleared in the 2nd page */ +#define XLH_UPDATE_NEW_ALL_VISIBLE_CLEARED (1<<1) +#define XLH_UPDATE_CONTAINS_OLD_TUPLE (1<<2) +#define XLH_UPDATE_CONTAINS_OLD_KEY (1<<3) +#define XLH_UPDATE_CONTAINS_NEW_TUPLE (1<<4) +#define XLH_UPDATE_PREFIX_FROM_OLD (1<<5) +#define XLH_UPDATE_SUFFIX_FROM_OLD (1<<6) + +/* convenience macro for checking whether any form of old tuple was logged */ +#define XLH_UPDATE_CONTAINS_OLD \ + (XLH_UPDATE_CONTAINS_OLD_TUPLE | XLH_UPDATE_CONTAINS_OLD_KEY) + +/* + * xl_heap_delete flag values, 8 bits are available. + */ +/* PD_ALL_VISIBLE was cleared */ +#define XLH_DELETE_ALL_VISIBLE_CLEARED (1<<0) +#define XLH_DELETE_CONTAINS_OLD_TUPLE (1<<1) +#define XLH_DELETE_CONTAINS_OLD_KEY (1<<2) +#define XLH_DELETE_IS_SUPER (1<<3) +#define XLH_DELETE_IS_PARTITION_MOVE (1<<4) + +/* convenience macro for checking whether any form of old tuple was logged */ +#define XLH_DELETE_CONTAINS_OLD \ + (XLH_DELETE_CONTAINS_OLD_TUPLE | XLH_DELETE_CONTAINS_OLD_KEY) + +/* This is what we need to know about delete */ +typedef struct xl_heap_delete +{ + TransactionId xmax; /* xmax of the deleted tuple */ + OffsetNumber offnum; /* deleted tuple's offset */ + uint8 infobits_set; /* infomask bits */ + uint8 flags; +} xl_heap_delete; + +#define SizeOfHeapDelete (offsetof(xl_heap_delete, flags) + sizeof(uint8)) + +/* + * xl_heap_truncate flag values, 8 bits are available. + */ +#define XLH_TRUNCATE_CASCADE (1<<0) +#define XLH_TRUNCATE_RESTART_SEQS (1<<1) + +/* + * For truncate we list all truncated relids in an array, followed by all + * sequence relids that need to be restarted, if any. + * All rels are always within the same database, so we just list dbid once. + */ +typedef struct xl_heap_truncate +{ + Oid dbId; + uint32 nrelids; + uint8 flags; + Oid relids[FLEXIBLE_ARRAY_MEMBER]; +} xl_heap_truncate; + +#define SizeOfHeapTruncate (offsetof(xl_heap_truncate, relids)) + +/* + * We don't store the whole fixed part (HeapTupleHeaderData) of an inserted + * or updated tuple in WAL; we can save a few bytes by reconstructing the + * fields that are available elsewhere in the WAL record, or perhaps just + * plain needn't be reconstructed. These are the fields we must store. + */ +typedef struct xl_heap_header +{ + uint16 t_infomask2; + uint16 t_infomask; + uint8 t_hoff; +} xl_heap_header; + +#define SizeOfHeapHeader (offsetof(xl_heap_header, t_hoff) + sizeof(uint8)) + +/* This is what we need to know about insert */ +typedef struct xl_heap_insert +{ + OffsetNumber offnum; /* inserted tuple's offset */ + uint8 flags; + + /* xl_heap_header & TUPLE DATA in backup block 0 */ +} xl_heap_insert; + +#define SizeOfHeapInsert (offsetof(xl_heap_insert, flags) + sizeof(uint8)) + +/* + * This is what we need to know about a multi-insert. + * + * The main data of the record consists of this xl_heap_multi_insert header. + * 'offsets' array is omitted if the whole page is reinitialized + * (XLOG_HEAP_INIT_PAGE). + * + * In block 0's data portion, there is an xl_multi_insert_tuple struct, + * followed by the tuple data for each tuple. There is padding to align + * each xl_multi_insert_tuple struct. + */ +typedef struct xl_heap_multi_insert +{ + uint8 flags; + uint16 ntuples; + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} xl_heap_multi_insert; + +#define SizeOfHeapMultiInsert offsetof(xl_heap_multi_insert, offsets) + +typedef struct xl_multi_insert_tuple +{ + uint16 datalen; /* size of tuple data that follows */ + uint16 t_infomask2; + uint16 t_infomask; + uint8 t_hoff; + /* TUPLE DATA FOLLOWS AT END OF STRUCT */ +} xl_multi_insert_tuple; + +#define SizeOfMultiInsertTuple (offsetof(xl_multi_insert_tuple, t_hoff) + sizeof(uint8)) + +/* + * This is what we need to know about update|hot_update + * + * Backup blk 0: new page + * + * If XLH_UPDATE_PREFIX_FROM_OLD or XLH_UPDATE_SUFFIX_FROM_OLD flags are set, + * the prefix and/or suffix come first, as one or two uint16s. + * + * After that, xl_heap_header and new tuple data follow. The new tuple + * data doesn't include the prefix and suffix, which are copied from the + * old tuple on replay. + * + * If XLH_UPDATE_CONTAINS_NEW_TUPLE flag is given, the tuple data is + * included even if a full-page image was taken. + * + * Backup blk 1: old page, if different. (no data, just a reference to the blk) + */ +typedef struct xl_heap_update +{ + TransactionId old_xmax; /* xmax of the old tuple */ + OffsetNumber old_offnum; /* old tuple's offset */ + uint8 old_infobits_set; /* infomask bits to set on old tuple */ + uint8 flags; + TransactionId new_xmax; /* xmax of the new tuple */ + OffsetNumber new_offnum; /* new tuple's offset */ + + /* + * If XLH_UPDATE_CONTAINS_OLD_TUPLE or XLH_UPDATE_CONTAINS_OLD_KEY flags + * are set, xl_heap_header and tuple data for the old tuple follow. + */ +} xl_heap_update; + +#define SizeOfHeapUpdate (offsetof(xl_heap_update, new_offnum) + sizeof(OffsetNumber)) + +/* + * These structures and flags encode VACUUM pruning and freezing and on-access + * pruning page modifications. + * + * xl_heap_prune is the main record. The XLHP_HAS_* flags indicate which + * "sub-records" are included and the other XLHP_* flags provide additional + * information about the conditions for replay. + * + * The data for block reference 0 contains "sub-records" depending on which of + * the XLHP_HAS_* flags are set. See xlhp_* struct definitions below. The + * sub-records appear in the same order as the XLHP_* flags. An example + * record with every sub-record included: + * + *----------------------------------------------------------------------------- + * Main data section: + * + * xl_heap_prune + * uint8 flags + * TransactionId snapshot_conflict_horizon + * + * Block 0 data section: + * + * xlhp_freeze_plans + * uint16 nplans + * [2 bytes of padding] + * xlhp_freeze_plan plans[nplans] + * + * xlhp_prune_items + * uint16 nredirected + * OffsetNumber redirected[2 * nredirected] + * + * xlhp_prune_items + * uint16 ndead + * OffsetNumber nowdead[ndead] + * + * xlhp_prune_items + * uint16 nunused + * OffsetNumber nowunused[nunused] + * + * OffsetNumber frz_offsets[sum([plan.ntuples for plan in plans])] + *----------------------------------------------------------------------------- + * + * NOTE: because the record data is assembled from many optional parts, we + * have to pay close attention to alignment. In the main data section, + * 'snapshot_conflict_horizon' is stored unaligned after 'flags', to save + * space. In the block 0 data section, the freeze plans appear first, because + * they contain TransactionId fields that require 4-byte alignment. All the + * other fields require only 2-byte alignment. This is also the reason that + * 'frz_offsets' is stored separately from the xlhp_freeze_plan structs. + */ +typedef struct xl_heap_prune +{ + uint8 reason; + uint8 flags; + + /* + * If XLHP_HAS_CONFLICT_HORIZON is set, the conflict horizon XID follows, + * unaligned + */ +} xl_heap_prune; + +#define SizeOfHeapPrune (offsetof(xl_heap_prune, flags) + sizeof(uint8)) + +/* to handle recovery conflict during logical decoding on standby */ +#define XLHP_IS_CATALOG_REL (1 << 1) + +/* + * Does replaying the record require a cleanup-lock? + * + * Pruning, in VACUUM's first pass or when otherwise accessing a page, + * requires a cleanup lock. For freezing, and VACUUM's second pass which + * marks LP_DEAD line pointers as unused without moving any tuple data, an + * ordinary exclusive lock is sufficient. + */ +#define XLHP_CLEANUP_LOCK (1 << 2) + +/* + * If we remove or freeze any entries that contain xids, we need to include a + * snapshot conflict horizon. It's used in Hot Standby mode to ensure that + * there are no queries running for which the removed tuples are still + * visible, or which still consider the frozen XIDs as running. + */ +#define XLHP_HAS_CONFLICT_HORIZON (1 << 3) + +/* + * Indicates that an xlhp_freeze_plans sub-record and one or more + * xlhp_freeze_plan sub-records are present. + */ +#define XLHP_HAS_FREEZE_PLANS (1 << 4) + +/* + * XLHP_HAS_REDIRECTIONS, XLHP_HAS_DEAD_ITEMS, and XLHP_HAS_NOW_UNUSED_ITEMS + * indicate that xlhp_prune_items sub-records with redirected, dead, and + * unused item offsets are present. + */ +#define XLHP_HAS_REDIRECTIONS (1 << 5) +#define XLHP_HAS_DEAD_ITEMS (1 << 6) +#define XLHP_HAS_NOW_UNUSED_ITEMS (1 << 7) + +/* + * xlhp_freeze_plan describes how to freeze a group of one or more heap tuples + * (appears in xl_heap_prune's xlhp_freeze_plans sub-record) + */ +/* 0x01 was XLH_FREEZE_XMIN */ +#define XLH_FREEZE_XVAC 0x02 +#define XLH_INVALID_XVAC 0x04 + +typedef struct xlhp_freeze_plan +{ + TransactionId xmax; + uint16 t_infomask2; + uint16 t_infomask; + uint8 frzflags; + + /* Length of individual page offset numbers array for this plan */ + uint16 ntuples; +} xlhp_freeze_plan; + +/* + * This is what we need to know about a block being frozen during vacuum + * + * The backup block's data contains an array of xlhp_freeze_plan structs (with + * nplans elements). The individual item offsets are located in an array at + * the end of the entire record with nplans * (each plan's ntuples) members + * Those offsets are in the same order as the plans. The REDO routine uses + * the offsets to freeze the corresponding heap tuples. + * + * (As of PostgreSQL 17, XLOG_HEAP2_PRUNE_VACUUM_SCAN records replace the + * separate XLOG_HEAP2_FREEZE_PAGE records.) + */ +typedef struct xlhp_freeze_plans +{ + uint16 nplans; + xlhp_freeze_plan plans[FLEXIBLE_ARRAY_MEMBER]; +} xlhp_freeze_plans; + +/* + * Generic sub-record type contained in block reference 0 of an xl_heap_prune + * record and used for redirect, dead, and unused items if any of + * XLHP_HAS_REDIRECTIONS/XLHP_HAS_DEAD_ITEMS/XLHP_HAS_NOW_UNUSED_ITEMS are + * set. Note that in the XLHP_HAS_REDIRECTIONS variant, there are actually 2 + * * length number of OffsetNumbers in the data. + */ +typedef struct xlhp_prune_items +{ + uint16 ntargets; + OffsetNumber data[FLEXIBLE_ARRAY_MEMBER]; +} xlhp_prune_items; + + +/* flags for infobits_set */ +#define XLHL_XMAX_IS_MULTI 0x01 +#define XLHL_XMAX_LOCK_ONLY 0x02 +#define XLHL_XMAX_EXCL_LOCK 0x04 +#define XLHL_XMAX_KEYSHR_LOCK 0x08 +#define XLHL_KEYS_UPDATED 0x10 + +/* flag bits for xl_heap_lock / xl_heap_lock_updated's flag field */ +#define XLH_LOCK_ALL_FROZEN_CLEARED 0x01 + +/* This is what we need to know about lock */ +typedef struct xl_heap_lock +{ + TransactionId xmax; /* might be a MultiXactId */ + OffsetNumber offnum; /* locked tuple's offset on page */ + uint8 infobits_set; /* infomask and infomask2 bits to set */ + uint8 flags; /* XLH_LOCK_* flag bits */ +} xl_heap_lock; + +#define SizeOfHeapLock (offsetof(xl_heap_lock, flags) + sizeof(uint8)) + +/* This is what we need to know about locking an updated version of a row */ +typedef struct xl_heap_lock_updated +{ + TransactionId xmax; + OffsetNumber offnum; + uint8 infobits_set; + uint8 flags; +} xl_heap_lock_updated; + +#define SizeOfHeapLockUpdated (offsetof(xl_heap_lock_updated, flags) + sizeof(uint8)) + +/* This is what we need to know about confirmation of speculative insertion */ +typedef struct xl_heap_confirm +{ + OffsetNumber offnum; /* confirmed tuple's offset on page */ +} xl_heap_confirm; + +#define SizeOfHeapConfirm (offsetof(xl_heap_confirm, offnum) + sizeof(OffsetNumber)) + +/* This is what we need to know about in-place update */ +typedef struct xl_heap_inplace +{ + OffsetNumber offnum; /* updated tuple's offset on page */ + Oid dbId; /* MyDatabaseId */ + Oid tsId; /* MyDatabaseTableSpace */ + bool relcacheInitFileInval; /* invalidate relcache init files */ + int nmsgs; /* number of shared inval msgs */ + SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]; +} xl_heap_inplace; + +#define MinSizeOfHeapInplace (offsetof(xl_heap_inplace, nmsgs) + sizeof(int)) + +/* + * This is what we need to know about setting a visibility map bit + * + * Backup blk 0: visibility map buffer + * Backup blk 1: heap buffer + */ +typedef struct xl_heap_visible +{ + TransactionId snapshotConflictHorizon; + uint8 flags; +} xl_heap_visible; + +#define SizeOfHeapVisible (offsetof(xl_heap_visible, flags) + sizeof(uint8)) + +typedef struct xl_heap_new_cid +{ + /* + * store toplevel xid so we don't have to merge cids from different + * transactions + */ + TransactionId top_xid; + CommandId cmin; + CommandId cmax; + CommandId combocid; /* just for debugging */ + + /* + * Store the relfilelocator/ctid pair to facilitate lookups. + */ + RelFileLocator target_locator; + ItemPointerData target_tid; +} xl_heap_new_cid; + +#define SizeOfHeapNewCid (offsetof(xl_heap_new_cid, target_tid) + sizeof(ItemPointerData)) + +/* logical rewrite xlog record header */ +typedef struct xl_heap_rewrite_mapping +{ + TransactionId mapped_xid; /* xid that might need to see the row */ + Oid mapped_db; /* DbOid or InvalidOid for shared rels */ + Oid mapped_rel; /* Oid of the mapped relation */ + off_t offset; /* How far have we written so far */ + uint32 num_mappings; /* Number of in-memory mappings */ + XLogRecPtr start_lsn; /* Insert LSN at begin of rewrite */ +} xl_heap_rewrite_mapping; + +extern void HeapTupleHeaderAdvanceConflictHorizon(HeapTupleHeader tuple, + TransactionId *snapshotConflictHorizon); + +extern void heap_redo(XLogReaderState *record); +extern void heap_desc(StringInfo buf, XLogReaderState *record); +extern const char *heap_identify(uint8 info); +extern void heap_mask(char *pagedata, BlockNumber blkno); +extern void heap2_redo(XLogReaderState *record); +extern void heap2_desc(StringInfo buf, XLogReaderState *record); +extern const char *heap2_identify(uint8 info); +extern void heap_xlog_logical_rewrite(XLogReaderState *r); + +extern XLogRecPtr log_heap_visible(Relation rel, Buffer heap_buffer, + Buffer vm_buffer, + TransactionId snapshotConflictHorizon, + uint8 vmflags); + +/* in heapdesc.c, so it can be shared between frontend/backend code */ +extern void heap_xlog_deserialize_prune_and_freeze(char *cursor, uint8 flags, + int *nplans, xlhp_freeze_plan **plans, + OffsetNumber **frz_offsets, + int *nredirected, OffsetNumber **redirected, + int *ndead, OffsetNumber **nowdead, + int *nunused, OffsetNumber **nowunused); + +#endif /* HEAPAM_XLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/heaptoast.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/heaptoast.h new file mode 100644 index 0000000..6385a27 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/heaptoast.h @@ -0,0 +1,149 @@ +/*------------------------------------------------------------------------- + * + * heaptoast.h + * Heap-specific definitions for external and compressed storage + * of variable size attributes. + * + * Copyright (c) 2000-2025, PostgreSQL Global Development Group + * + * src/include/access/heaptoast.h + * + *------------------------------------------------------------------------- + */ +#ifndef HEAPTOAST_H +#define HEAPTOAST_H + +#include "access/htup_details.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" + +/* + * Find the maximum size of a tuple if there are to be N tuples per page. + */ +#define MaximumBytesPerTuple(tuplesPerPage) \ + MAXALIGN_DOWN((BLCKSZ - \ + MAXALIGN(SizeOfPageHeaderData + (tuplesPerPage) * sizeof(ItemIdData))) \ + / (tuplesPerPage)) + +/* + * These symbols control toaster activation. If a tuple is larger than + * TOAST_TUPLE_THRESHOLD, we will try to toast it down to no more than + * TOAST_TUPLE_TARGET bytes through compressing compressible fields and + * moving EXTENDED and EXTERNAL data out-of-line. + * + * The numbers need not be the same, though they currently are. It doesn't + * make sense for TARGET to exceed THRESHOLD, but it could be useful to make + * it be smaller. + * + * Currently we choose both values to match the largest tuple size for which + * TOAST_TUPLES_PER_PAGE tuples can fit on a heap page. + * + * XXX while these can be modified without initdb, some thought needs to be + * given to needs_toast_table() in toasting.c before unleashing random + * changes. Also see LOBLKSIZE in large_object.h, which can *not* be + * changed without initdb. + */ +#define TOAST_TUPLES_PER_PAGE 4 + +#define TOAST_TUPLE_THRESHOLD MaximumBytesPerTuple(TOAST_TUPLES_PER_PAGE) + +#define TOAST_TUPLE_TARGET TOAST_TUPLE_THRESHOLD + +/* + * The code will also consider moving MAIN data out-of-line, but only as a + * last resort if the previous steps haven't reached the target tuple size. + * In this phase we use a different target size, currently equal to the + * largest tuple that will fit on a heap page. This is reasonable since + * the user has told us to keep the data in-line if at all possible. + */ +#define TOAST_TUPLES_PER_PAGE_MAIN 1 + +#define TOAST_TUPLE_TARGET_MAIN MaximumBytesPerTuple(TOAST_TUPLES_PER_PAGE_MAIN) + +/* + * If an index value is larger than TOAST_INDEX_TARGET, we will try to + * compress it (we can't move it out-of-line, however). Note that this + * number is per-datum, not per-tuple, for simplicity in index_form_tuple(). + */ +#define TOAST_INDEX_TARGET (MaxHeapTupleSize / 16) + +/* + * When we store an oversize datum externally, we divide it into chunks + * containing at most TOAST_MAX_CHUNK_SIZE data bytes. This number *must* + * be small enough that the completed toast-table tuple (including the + * ID and sequence fields and all overhead) will fit on a page. + * The coding here sets the size on the theory that we want to fit + * EXTERN_TUPLES_PER_PAGE tuples of maximum size onto a page. + * + * NB: Changing TOAST_MAX_CHUNK_SIZE requires an initdb. + */ +#define EXTERN_TUPLES_PER_PAGE 4 /* tweak only this */ + +#define EXTERN_TUPLE_MAX_SIZE MaximumBytesPerTuple(EXTERN_TUPLES_PER_PAGE) + +#define TOAST_MAX_CHUNK_SIZE \ + (EXTERN_TUPLE_MAX_SIZE - \ + MAXALIGN(SizeofHeapTupleHeader) - \ + sizeof(Oid) - \ + sizeof(int32) - \ + VARHDRSZ) + +/* ---------- + * heap_toast_insert_or_update - + * + * Called by heap_insert() and heap_update(). + * ---------- + */ +extern HeapTuple heap_toast_insert_or_update(Relation rel, HeapTuple newtup, + HeapTuple oldtup, int options); + +/* ---------- + * heap_toast_delete - + * + * Called by heap_delete(). + * ---------- + */ +extern void heap_toast_delete(Relation rel, HeapTuple oldtup, + bool is_speculative); + +/* ---------- + * toast_flatten_tuple - + * + * "Flatten" a tuple to contain no out-of-line toasted fields. + * (This does not eliminate compressed or short-header datums.) + * ---------- + */ +extern HeapTuple toast_flatten_tuple(HeapTuple tup, TupleDesc tupleDesc); + +/* ---------- + * toast_flatten_tuple_to_datum - + * + * "Flatten" a tuple containing out-of-line toasted fields into a Datum. + * ---------- + */ +extern Datum toast_flatten_tuple_to_datum(HeapTupleHeader tup, + uint32 tup_len, + TupleDesc tupleDesc); + +/* ---------- + * toast_build_flattened_tuple - + * + * Build a tuple containing no out-of-line toasted fields. + * (This does not eliminate compressed or short-header datums.) + * ---------- + */ +extern HeapTuple toast_build_flattened_tuple(TupleDesc tupleDesc, + Datum *values, + bool *isnull); + +/* ---------- + * heap_fetch_toast_slice + * + * Fetch a slice from a toast value stored in a heap table. + * ---------- + */ +extern void heap_fetch_toast_slice(Relation toastrel, Oid valueid, + int32 attrsize, int32 sliceoffset, + int32 slicelength, struct varlena *result); + +#endif /* HEAPTOAST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/hio.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/hio.h new file mode 100644 index 0000000..60b8026 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/hio.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * hio.h + * POSTGRES heap access method input/output definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/hio.h + * + *------------------------------------------------------------------------- + */ +#ifndef HIO_H +#define HIO_H + +#include "access/htup.h" +#include "storage/buf.h" +#include "utils/relcache.h" + +/* + * state for bulk inserts --- private to heapam.c and hio.c + * + * If current_buf isn't InvalidBuffer, then we are holding an extra pin + * on that buffer. + * + * "typedef struct BulkInsertStateData *BulkInsertState" is in heapam.h + */ +typedef struct BulkInsertStateData +{ + BufferAccessStrategy strategy; /* our BULKWRITE strategy object */ + Buffer current_buf; /* current insertion target page */ + + /* + * State for bulk extensions. + * + * last_free..next_free are further pages that were unused at the time of + * the last extension. They might be in use by the time we use them + * though, so rechecks are needed. + * + * XXX: Eventually these should probably live in RelationData instead, + * alongside targetblock. + * + * already_extended_by is the number of pages that this bulk inserted + * extended by. If we already extended by a significant number of pages, + * we can be more aggressive about extending going forward. + */ + BlockNumber next_free; + BlockNumber last_free; + uint32 already_extended_by; +} BulkInsertStateData; + + +extern void RelationPutHeapTuple(Relation relation, Buffer buffer, + HeapTuple tuple, bool token); +extern Buffer RelationGetBufferForTuple(Relation relation, Size len, + Buffer otherBuffer, int options, + BulkInsertStateData *bistate, + Buffer *vmbuffer, Buffer *vmbuffer_other, + int num_pages); + +#endif /* HIO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/htup.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/htup.h new file mode 100644 index 0000000..f0e3aa8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/htup.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------- + * + * htup.h + * POSTGRES heap tuple definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/htup.h + * + *------------------------------------------------------------------------- + */ +#ifndef HTUP_H +#define HTUP_H + +#include "storage/itemptr.h" + +/* typedefs and forward declarations for structs defined in htup_details.h */ + +typedef struct HeapTupleHeaderData HeapTupleHeaderData; + +typedef HeapTupleHeaderData *HeapTupleHeader; + +typedef struct MinimalTupleData MinimalTupleData; + +typedef MinimalTupleData *MinimalTuple; + + +/* + * HeapTupleData is an in-memory data structure that points to a tuple. + * + * There are several ways in which this data structure is used: + * + * * Pointer to a tuple in a disk buffer: t_data points directly into the + * buffer (which the code had better be holding a pin on, but this is not + * reflected in HeapTupleData itself). + * + * * Pointer to nothing: t_data is NULL. This is used as a failure indication + * in some functions. + * + * * Part of a palloc'd tuple: the HeapTupleData itself and the tuple + * form a single palloc'd chunk. t_data points to the memory location + * immediately following the HeapTupleData struct (at offset HEAPTUPLESIZE). + * This is the output format of heap_form_tuple and related routines. + * + * * Separately allocated tuple: t_data points to a palloc'd chunk that + * is not adjacent to the HeapTupleData. (This case is deprecated since + * it's difficult to tell apart from case #1. It should be used only in + * limited contexts where the code knows that case #1 will never apply.) + * + * * Separately allocated minimal tuple: t_data points MINIMAL_TUPLE_OFFSET + * bytes before the start of a MinimalTuple. As with the previous case, + * this can't be told apart from case #1 by inspection; code setting up + * or destroying this representation has to know what it's doing. + * + * t_len should always be valid, except in the pointer-to-nothing case. + * t_self and t_tableOid should be valid if the HeapTupleData points to + * a disk buffer, or if it represents a copy of a tuple on disk. They + * should be explicitly set invalid in manufactured tuples. + */ +typedef struct HeapTupleData +{ + uint32 t_len; /* length of *t_data */ + ItemPointerData t_self; /* SelfItemPointer */ + Oid t_tableOid; /* table the tuple came from */ +#define FIELDNO_HEAPTUPLEDATA_DATA 3 + HeapTupleHeader t_data; /* -> tuple header and data */ +} HeapTupleData; + +typedef HeapTupleData *HeapTuple; + +#define HEAPTUPLESIZE MAXALIGN(sizeof(HeapTupleData)) + +/* + * Accessor macros to be used with HeapTuple pointers. + */ +#define HeapTupleIsValid(tuple) PointerIsValid(tuple) + +/* HeapTupleHeader functions implemented in utils/time/combocid.c */ +extern CommandId HeapTupleHeaderGetCmin(const HeapTupleHeaderData *tup); +extern CommandId HeapTupleHeaderGetCmax(const HeapTupleHeaderData *tup); +extern void HeapTupleHeaderAdjustCmax(const HeapTupleHeaderData *tup, + CommandId *cmax, bool *iscombo); + +/* Prototype for HeapTupleHeader accessors in heapam.c */ +extern TransactionId HeapTupleGetUpdateXid(const HeapTupleHeaderData *tup); + +#endif /* HTUP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/htup_details.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/htup_details.h new file mode 100644 index 0000000..aa957cf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/htup_details.h @@ -0,0 +1,923 @@ +/*------------------------------------------------------------------------- + * + * htup_details.h + * POSTGRES heap tuple header definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/htup_details.h + * + *------------------------------------------------------------------------- + */ +#ifndef HTUP_DETAILS_H +#define HTUP_DETAILS_H + +#include "access/htup.h" +#include "access/transam.h" +#include "access/tupdesc.h" +#include "access/tupmacs.h" +#include "storage/bufpage.h" +#include "varatt.h" + +/* + * MaxTupleAttributeNumber limits the number of (user) columns in a tuple. + * The key limit on this value is that the size of the fixed overhead for + * a tuple, plus the size of the null-values bitmap (at 1 bit per column), + * plus MAXALIGN alignment, must fit into t_hoff which is uint8. On most + * machines the upper limit without making t_hoff wider would be a little + * over 1700. We use round numbers here and for MaxHeapAttributeNumber + * so that alterations in HeapTupleHeaderData layout won't change the + * supported max number of columns. + */ +#define MaxTupleAttributeNumber 1664 /* 8 * 208 */ + +/* + * MaxHeapAttributeNumber limits the number of (user) columns in a table. + * This should be somewhat less than MaxTupleAttributeNumber. It must be + * at least one less, else we will fail to do UPDATEs on a maximal-width + * table (because UPDATE has to form working tuples that include CTID). + * In practice we want some additional daylight so that we can gracefully + * support operations that add hidden "resjunk" columns, for example + * SELECT * FROM wide_table ORDER BY foo, bar, baz. + * In any case, depending on column data types you will likely be running + * into the disk-block-based limit on overall tuple size if you have more + * than a thousand or so columns. TOAST won't help. + */ +#define MaxHeapAttributeNumber 1600 /* 8 * 200 */ + +/* + * Heap tuple header. To avoid wasting space, the fields should be + * laid out in such a way as to avoid structure padding. + * + * Datums of composite types (row types) share the same general structure + * as on-disk tuples, so that the same routines can be used to build and + * examine them. However the requirements are slightly different: a Datum + * does not need any transaction visibility information, and it does need + * a length word and some embedded type information. We can achieve this + * by overlaying the xmin/cmin/xmax/cmax/xvac fields of a heap tuple + * with the fields needed in the Datum case. Typically, all tuples built + * in-memory will be initialized with the Datum fields; but when a tuple is + * about to be inserted in a table, the transaction fields will be filled, + * overwriting the datum fields. + * + * The overall structure of a heap tuple looks like: + * fixed fields (HeapTupleHeaderData struct) + * nulls bitmap (if HEAP_HASNULL is set in t_infomask) + * alignment padding (as needed to make user data MAXALIGN'd) + * object ID (if HEAP_HASOID_OLD is set in t_infomask, not created + * anymore) + * user data fields + * + * We store five "virtual" fields Xmin, Cmin, Xmax, Cmax, and Xvac in three + * physical fields. Xmin and Xmax are always really stored, but Cmin, Cmax + * and Xvac share a field. This works because we know that Cmin and Cmax + * are only interesting for the lifetime of the inserting and deleting + * transaction respectively. If a tuple is inserted and deleted in the same + * transaction, we store a "combo" command id that can be mapped to the real + * cmin and cmax, but only by use of local state within the originating + * backend. See combocid.c for more details. Meanwhile, Xvac is only set by + * old-style VACUUM FULL, which does not have any command sub-structure and so + * does not need either Cmin or Cmax. (This requires that old-style VACUUM + * FULL never try to move a tuple whose Cmin or Cmax is still interesting, + * ie, an insert-in-progress or delete-in-progress tuple.) + * + * A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid + * is initialized with its own TID (location). If the tuple is ever updated, + * its t_ctid is changed to point to the replacement version of the tuple. Or + * if the tuple is moved from one partition to another, due to an update of + * the partition key, t_ctid is set to a special value to indicate that + * (see ItemPointerSetMovedPartitions). Thus, a tuple is the latest version + * of its row iff XMAX is invalid or + * t_ctid points to itself (in which case, if XMAX is valid, the tuple is + * either locked or deleted). One can follow the chain of t_ctid links + * to find the newest version of the row, unless it was moved to a different + * partition. Beware however that VACUUM might + * erase the pointed-to (newer) tuple before erasing the pointing (older) + * tuple. Hence, when following a t_ctid link, it is necessary to check + * to see if the referenced slot is empty or contains an unrelated tuple. + * Check that the referenced tuple has XMIN equal to the referencing tuple's + * XMAX to verify that it is actually the descendant version and not an + * unrelated tuple stored into a slot recently freed by VACUUM. If either + * check fails, one may assume that there is no live descendant version. + * + * t_ctid is sometimes used to store a speculative insertion token, instead + * of a real TID. A speculative token is set on a tuple that's being + * inserted, until the inserter is sure that it wants to go ahead with the + * insertion. Hence a token should only be seen on a tuple with an XMAX + * that's still in-progress, or invalid/aborted. The token is replaced with + * the tuple's real TID when the insertion is confirmed. One should never + * see a speculative insertion token while following a chain of t_ctid links, + * because they are not used on updates, only insertions. + * + * Following the fixed header fields, the nulls bitmap is stored (beginning + * at t_bits). The bitmap is *not* stored if t_infomask shows that there + * are no nulls in the tuple. If an OID field is present (as indicated by + * t_infomask), then it is stored just before the user data, which begins at + * the offset shown by t_hoff. Note that t_hoff must be a multiple of + * MAXALIGN. + */ + +typedef struct HeapTupleFields +{ + TransactionId t_xmin; /* inserting xact ID */ + TransactionId t_xmax; /* deleting or locking xact ID */ + + union + { + CommandId t_cid; /* inserting or deleting command ID, or both */ + TransactionId t_xvac; /* old-style VACUUM FULL xact ID */ + } t_field3; +} HeapTupleFields; + +typedef struct DatumTupleFields +{ + int32 datum_len_; /* varlena header (do not touch directly!) */ + + int32 datum_typmod; /* -1, or identifier of a record type */ + + Oid datum_typeid; /* composite type OID, or RECORDOID */ + + /* + * datum_typeid cannot be a domain over composite, only plain composite, + * even if the datum is meant as a value of a domain-over-composite type. + * This is in line with the general principle that CoerceToDomain does not + * change the physical representation of the base type value. + * + * Note: field ordering is chosen with thought that Oid might someday + * widen to 64 bits. + */ +} DatumTupleFields; + +struct HeapTupleHeaderData +{ + union + { + HeapTupleFields t_heap; + DatumTupleFields t_datum; + } t_choice; + + ItemPointerData t_ctid; /* current TID of this or newer tuple (or a + * speculative insertion token) */ + + /* Fields below here must match MinimalTupleData! */ + +#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK2 2 + uint16 t_infomask2; /* number of attributes + various flags */ + +#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK 3 + uint16 t_infomask; /* various flag bits, see below */ + +#define FIELDNO_HEAPTUPLEHEADERDATA_HOFF 4 + uint8 t_hoff; /* sizeof header incl. bitmap, padding */ + + /* ^ - 23 bytes - ^ */ + +#define FIELDNO_HEAPTUPLEHEADERDATA_BITS 5 + bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */ + + /* MORE DATA FOLLOWS AT END OF STRUCT */ +}; + +/* typedef appears in htup.h */ + +#define SizeofHeapTupleHeader offsetof(HeapTupleHeaderData, t_bits) + +/* + * information stored in t_infomask: + */ +#define HEAP_HASNULL 0x0001 /* has null attribute(s) */ +#define HEAP_HASVARWIDTH 0x0002 /* has variable-width attribute(s) */ +#define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */ +#define HEAP_HASOID_OLD 0x0008 /* has an object-id field */ +#define HEAP_XMAX_KEYSHR_LOCK 0x0010 /* xmax is a key-shared locker */ +#define HEAP_COMBOCID 0x0020 /* t_cid is a combo CID */ +#define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */ +#define HEAP_XMAX_LOCK_ONLY 0x0080 /* xmax, if valid, is only a locker */ + + /* xmax is a shared locker */ +#define HEAP_XMAX_SHR_LOCK (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK) + +#define HEAP_LOCK_MASK (HEAP_XMAX_SHR_LOCK | HEAP_XMAX_EXCL_LOCK | \ + HEAP_XMAX_KEYSHR_LOCK) +#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */ +#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */ +#define HEAP_XMIN_FROZEN (HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID) +#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */ +#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */ +#define HEAP_XMAX_IS_MULTI 0x1000 /* t_xmax is a MultiXactId */ +#define HEAP_UPDATED 0x2000 /* this is UPDATEd version of row */ +#define HEAP_MOVED_OFF 0x4000 /* moved to another place by pre-9.0 + * VACUUM FULL; kept for binary + * upgrade support */ +#define HEAP_MOVED_IN 0x8000 /* moved from another place by pre-9.0 + * VACUUM FULL; kept for binary + * upgrade support */ +#define HEAP_MOVED (HEAP_MOVED_OFF | HEAP_MOVED_IN) + +#define HEAP_XACT_MASK 0xFFF0 /* visibility-related bits */ + +/* + * A tuple is only locked (i.e. not updated by its Xmax) if the + * HEAP_XMAX_LOCK_ONLY bit is set; or, for pg_upgrade's sake, if the Xmax is + * not a multi and the EXCL_LOCK bit is set. + * + * See also HeapTupleHeaderIsOnlyLocked, which also checks for a possible + * aborted updater transaction. + */ +static inline bool +HEAP_XMAX_IS_LOCKED_ONLY(uint16 infomask) +{ + return (infomask & HEAP_XMAX_LOCK_ONLY) || + (infomask & (HEAP_XMAX_IS_MULTI | HEAP_LOCK_MASK)) == HEAP_XMAX_EXCL_LOCK; +} + +/* + * A tuple that has HEAP_XMAX_IS_MULTI and HEAP_XMAX_LOCK_ONLY but neither of + * HEAP_XMAX_EXCL_LOCK and HEAP_XMAX_KEYSHR_LOCK must come from a tuple that was + * share-locked in 9.2 or earlier and then pg_upgrade'd. + * + * In 9.2 and prior, HEAP_XMAX_IS_MULTI was only set when there were multiple + * FOR SHARE lockers of that tuple. That set HEAP_XMAX_LOCK_ONLY (with a + * different name back then) but neither of HEAP_XMAX_EXCL_LOCK and + * HEAP_XMAX_KEYSHR_LOCK. That combination is no longer possible in 9.3 and + * up, so if we see that combination we know for certain that the tuple was + * locked in an earlier release; since all such lockers are gone (they cannot + * survive through pg_upgrade), such tuples can safely be considered not + * locked. + * + * We must not resolve such multixacts locally, because the result would be + * bogus, regardless of where they stand with respect to the current valid + * multixact range. + */ +static inline bool +HEAP_LOCKED_UPGRADED(uint16 infomask) +{ + return + (infomask & HEAP_XMAX_IS_MULTI) != 0 && + (infomask & HEAP_XMAX_LOCK_ONLY) != 0 && + (infomask & (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK)) == 0; +} + +/* + * Use these to test whether a particular lock is applied to a tuple + */ +static inline bool +HEAP_XMAX_IS_SHR_LOCKED(int16 infomask) +{ + return (infomask & HEAP_LOCK_MASK) == HEAP_XMAX_SHR_LOCK; +} + +static inline bool +HEAP_XMAX_IS_EXCL_LOCKED(int16 infomask) +{ + return (infomask & HEAP_LOCK_MASK) == HEAP_XMAX_EXCL_LOCK; +} + +static inline bool +HEAP_XMAX_IS_KEYSHR_LOCKED(int16 infomask) +{ + return (infomask & HEAP_LOCK_MASK) == HEAP_XMAX_KEYSHR_LOCK; +} + +/* turn these all off when Xmax is to change */ +#define HEAP_XMAX_BITS (HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID | \ + HEAP_XMAX_IS_MULTI | HEAP_LOCK_MASK | HEAP_XMAX_LOCK_ONLY) + +/* + * information stored in t_infomask2: + */ +#define HEAP_NATTS_MASK 0x07FF /* 11 bits for number of attributes */ +/* bits 0x1800 are available */ +#define HEAP_KEYS_UPDATED 0x2000 /* tuple was updated and key cols + * modified, or tuple deleted */ +#define HEAP_HOT_UPDATED 0x4000 /* tuple was HOT-updated */ +#define HEAP_ONLY_TUPLE 0x8000 /* this is heap-only tuple */ + +#define HEAP2_XACT_MASK 0xE000 /* visibility-related bits */ + +/* + * HEAP_TUPLE_HAS_MATCH is a temporary flag used during hash joins. It is + * only used in tuples that are in the hash table, and those don't need + * any visibility information, so we can overlay it on a visibility flag + * instead of using up a dedicated bit. + */ +#define HEAP_TUPLE_HAS_MATCH HEAP_ONLY_TUPLE /* tuple has a join match */ + +/* + * HeapTupleHeader accessor functions + */ + +static bool HeapTupleHeaderXminFrozen(const HeapTupleHeaderData *tup); + +/* + * HeapTupleHeaderGetRawXmin returns the "raw" xmin field, which is the xid + * originally used to insert the tuple. However, the tuple might actually + * be frozen (via HeapTupleHeaderSetXminFrozen) in which case the tuple's xmin + * is visible to every snapshot. Prior to PostgreSQL 9.4, we actually changed + * the xmin to FrozenTransactionId, and that value may still be encountered + * on disk. + */ +static inline TransactionId +HeapTupleHeaderGetRawXmin(const HeapTupleHeaderData *tup) +{ + return tup->t_choice.t_heap.t_xmin; +} + +static inline TransactionId +HeapTupleHeaderGetXmin(const HeapTupleHeaderData *tup) +{ + return HeapTupleHeaderXminFrozen(tup) ? + FrozenTransactionId : HeapTupleHeaderGetRawXmin(tup); +} + +static inline void +HeapTupleHeaderSetXmin(HeapTupleHeaderData *tup, TransactionId xid) +{ + tup->t_choice.t_heap.t_xmin = xid; +} + +static inline bool +HeapTupleHeaderXminCommitted(const HeapTupleHeaderData *tup) +{ + return (tup->t_infomask & HEAP_XMIN_COMMITTED) != 0; +} + +static inline bool +HeapTupleHeaderXminInvalid(const HeapTupleHeaderData *tup) \ +{ + return (tup->t_infomask & (HEAP_XMIN_COMMITTED | HEAP_XMIN_INVALID)) == + HEAP_XMIN_INVALID; +} + +static inline bool +HeapTupleHeaderXminFrozen(const HeapTupleHeaderData *tup) +{ + return (tup->t_infomask & HEAP_XMIN_FROZEN) == HEAP_XMIN_FROZEN; +} + +static inline void +HeapTupleHeaderSetXminCommitted(HeapTupleHeaderData *tup) +{ + Assert(!HeapTupleHeaderXminInvalid(tup)); + tup->t_infomask |= HEAP_XMIN_COMMITTED; +} + +static inline void +HeapTupleHeaderSetXminInvalid(HeapTupleHeaderData *tup) +{ + Assert(!HeapTupleHeaderXminCommitted(tup)); + tup->t_infomask |= HEAP_XMIN_INVALID; +} + +static inline void +HeapTupleHeaderSetXminFrozen(HeapTupleHeaderData *tup) +{ + Assert(!HeapTupleHeaderXminInvalid(tup)); + tup->t_infomask |= HEAP_XMIN_FROZEN; +} + +static inline TransactionId +HeapTupleHeaderGetRawXmax(const HeapTupleHeaderData *tup) +{ + return tup->t_choice.t_heap.t_xmax; +} + +static inline void +HeapTupleHeaderSetXmax(HeapTupleHeaderData *tup, TransactionId xid) +{ + tup->t_choice.t_heap.t_xmax = xid; +} + +#ifndef FRONTEND +/* + * HeapTupleHeaderGetRawXmax gets you the raw Xmax field. To find out the Xid + * that updated a tuple, you might need to resolve the MultiXactId if certain + * bits are set. HeapTupleHeaderGetUpdateXid checks those bits and takes care + * to resolve the MultiXactId if necessary. This might involve multixact I/O, + * so it should only be used if absolutely necessary. + */ +static inline TransactionId +HeapTupleHeaderGetUpdateXid(const HeapTupleHeaderData *tup) +{ + if (!((tup)->t_infomask & HEAP_XMAX_INVALID) && + ((tup)->t_infomask & HEAP_XMAX_IS_MULTI) && + !((tup)->t_infomask & HEAP_XMAX_LOCK_ONLY)) + return HeapTupleGetUpdateXid(tup); + else + return HeapTupleHeaderGetRawXmax(tup); +} +#endif /* FRONTEND */ + +/* + * HeapTupleHeaderGetRawCommandId will give you what's in the header whether + * it is useful or not. Most code should use HeapTupleHeaderGetCmin or + * HeapTupleHeaderGetCmax instead, but note that those Assert that you can + * get a legitimate result, ie you are in the originating transaction! + */ +static inline CommandId +HeapTupleHeaderGetRawCommandId(const HeapTupleHeaderData *tup) +{ + return tup->t_choice.t_heap.t_field3.t_cid; +} + +/* SetCmin is reasonably simple since we never need a combo CID */ +static inline void +HeapTupleHeaderSetCmin(HeapTupleHeaderData *tup, CommandId cid) +{ + Assert(!(tup->t_infomask & HEAP_MOVED)); + tup->t_choice.t_heap.t_field3.t_cid = cid; + tup->t_infomask &= ~HEAP_COMBOCID; +} + +/* SetCmax must be used after HeapTupleHeaderAdjustCmax; see combocid.c */ +static inline void +HeapTupleHeaderSetCmax(HeapTupleHeaderData *tup, CommandId cid, bool iscombo) +{ + Assert(!((tup)->t_infomask & HEAP_MOVED)); + tup->t_choice.t_heap.t_field3.t_cid = cid; + if (iscombo) + tup->t_infomask |= HEAP_COMBOCID; + else + tup->t_infomask &= ~HEAP_COMBOCID; +} + +static inline TransactionId +HeapTupleHeaderGetXvac(const HeapTupleHeaderData *tup) +{ + if (tup->t_infomask & HEAP_MOVED) + return tup->t_choice.t_heap.t_field3.t_xvac; + else + return InvalidTransactionId; +} + +static inline void +HeapTupleHeaderSetXvac(HeapTupleHeaderData *tup, TransactionId xid) +{ + Assert(tup->t_infomask & HEAP_MOVED); + tup->t_choice.t_heap.t_field3.t_xvac = xid; +} + +StaticAssertDecl(MaxOffsetNumber < SpecTokenOffsetNumber, + "invalid speculative token constant"); + +static inline bool +HeapTupleHeaderIsSpeculative(const HeapTupleHeaderData *tup) +{ + return ItemPointerGetOffsetNumberNoCheck(&tup->t_ctid) == SpecTokenOffsetNumber; +} + +static inline BlockNumber +HeapTupleHeaderGetSpeculativeToken(const HeapTupleHeaderData *tup) +{ + Assert(HeapTupleHeaderIsSpeculative(tup)); + return ItemPointerGetBlockNumber(&tup->t_ctid); +} + +static inline void +HeapTupleHeaderSetSpeculativeToken(HeapTupleHeaderData *tup, BlockNumber token) +{ + ItemPointerSet(&tup->t_ctid, token, SpecTokenOffsetNumber); +} + +static inline bool +HeapTupleHeaderIndicatesMovedPartitions(const HeapTupleHeaderData *tup) +{ + return ItemPointerIndicatesMovedPartitions(&tup->t_ctid); +} + +static inline void +HeapTupleHeaderSetMovedPartitions(HeapTupleHeaderData *tup) +{ + ItemPointerSetMovedPartitions(&tup->t_ctid); +} + +static inline uint32 +HeapTupleHeaderGetDatumLength(const HeapTupleHeaderData *tup) +{ + return VARSIZE(tup); +} + +static inline void +HeapTupleHeaderSetDatumLength(HeapTupleHeaderData *tup, uint32 len) +{ + SET_VARSIZE(tup, len); +} + +static inline Oid +HeapTupleHeaderGetTypeId(const HeapTupleHeaderData *tup) +{ + return tup->t_choice.t_datum.datum_typeid; +} + +static inline void +HeapTupleHeaderSetTypeId(HeapTupleHeaderData *tup, Oid datum_typeid) +{ + tup->t_choice.t_datum.datum_typeid = datum_typeid; +} + +static inline int32 +HeapTupleHeaderGetTypMod(const HeapTupleHeaderData *tup) +{ + return tup->t_choice.t_datum.datum_typmod; +} + +static inline void +HeapTupleHeaderSetTypMod(HeapTupleHeaderData *tup, int32 typmod) +{ + tup->t_choice.t_datum.datum_typmod = typmod; +} + +/* + * Note that we stop considering a tuple HOT-updated as soon as it is known + * aborted or the would-be updating transaction is known aborted. For best + * efficiency, check tuple visibility before using this function, so that the + * INVALID bits will be as up to date as possible. + */ +static inline bool +HeapTupleHeaderIsHotUpdated(const HeapTupleHeaderData *tup) +{ + return + (tup->t_infomask2 & HEAP_HOT_UPDATED) != 0 && + (tup->t_infomask & HEAP_XMAX_INVALID) == 0 && + !HeapTupleHeaderXminInvalid(tup); +} + +static inline void +HeapTupleHeaderSetHotUpdated(HeapTupleHeaderData *tup) +{ + tup->t_infomask2 |= HEAP_HOT_UPDATED; +} + +static inline void +HeapTupleHeaderClearHotUpdated(HeapTupleHeaderData *tup) +{ + tup->t_infomask2 &= ~HEAP_HOT_UPDATED; +} + +static inline bool +HeapTupleHeaderIsHeapOnly(const HeapTupleHeaderData *tup) \ +{ + return (tup->t_infomask2 & HEAP_ONLY_TUPLE) != 0; +} + +static inline void +HeapTupleHeaderSetHeapOnly(HeapTupleHeaderData *tup) +{ + tup->t_infomask2 |= HEAP_ONLY_TUPLE; +} + +static inline void +HeapTupleHeaderClearHeapOnly(HeapTupleHeaderData *tup) +{ + tup->t_infomask2 &= ~HEAP_ONLY_TUPLE; +} + +/* + * These are used with both HeapTuple and MinimalTuple, so they must be + * macros. + */ + +#define HeapTupleHeaderGetNatts(tup) \ + ((tup)->t_infomask2 & HEAP_NATTS_MASK) + +#define HeapTupleHeaderSetNatts(tup, natts) \ +( \ + (tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \ +) + +#define HeapTupleHeaderHasExternal(tup) \ + (((tup)->t_infomask & HEAP_HASEXTERNAL) != 0) + + +/* + * BITMAPLEN(NATTS) - + * Computes size of null bitmap given number of data columns. + */ +static inline int +BITMAPLEN(int NATTS) +{ + return (NATTS + 7) / 8; +} + +/* + * MaxHeapTupleSize is the maximum allowed size of a heap tuple, including + * header and MAXALIGN alignment padding. Basically it's BLCKSZ minus the + * other stuff that has to be on a disk page. Since heap pages use no + * "special space", there's no deduction for that. + * + * NOTE: we allow for the ItemId that must point to the tuple, ensuring that + * an otherwise-empty page can indeed hold a tuple of this size. Because + * ItemIds and tuples have different alignment requirements, don't assume that + * you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page. + */ +#define MaxHeapTupleSize (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData))) +#define MinHeapTupleSize MAXALIGN(SizeofHeapTupleHeader) + +/* + * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can + * fit on one heap page. (Note that indexes could have more, because they + * use a smaller tuple header.) We arrive at the divisor because each tuple + * must be maxaligned, and it must have an associated line pointer. + * + * Note: with HOT, there could theoretically be more line pointers (not actual + * tuples) than this on a heap page. However we constrain the number of line + * pointers to this anyway, to avoid excessive line-pointer bloat and not + * require increases in the size of work arrays. + */ +#define MaxHeapTuplesPerPage \ + ((int) ((BLCKSZ - SizeOfPageHeaderData) / \ + (MAXALIGN(SizeofHeapTupleHeader) + sizeof(ItemIdData)))) + +/* + * MaxAttrSize is a somewhat arbitrary upper limit on the declared size of + * data fields of char(n) and similar types. It need not have anything + * directly to do with the *actual* upper limit of varlena values, which + * is currently 1Gb (see TOAST structures in postgres.h). I've set it + * at 10Mb which seems like a reasonable number --- tgl 8/6/00. + */ +#define MaxAttrSize (10 * 1024 * 1024) + + +/* + * MinimalTuple is an alternative representation that is used for transient + * tuples inside the executor, in places where transaction status information + * is not required, the tuple rowtype is known, and shaving off a few bytes + * is worthwhile because we need to store many tuples. The representation + * is chosen so that tuple access routines can work with either full or + * minimal tuples via a HeapTupleData pointer structure. The access routines + * see no difference, except that they must not access the transaction status + * or t_ctid fields because those aren't there. + * + * For the most part, MinimalTuples should be accessed via TupleTableSlot + * routines. These routines will prevent access to the "system columns" + * and thereby prevent accidental use of the nonexistent fields. + * + * MinimalTupleData contains a length word, some padding, and fields matching + * HeapTupleHeaderData beginning with t_infomask2. The padding is chosen so + * that offsetof(t_infomask2) is the same modulo MAXIMUM_ALIGNOF in both + * structs. This makes data alignment rules equivalent in both cases. + * + * When a minimal tuple is accessed via a HeapTupleData pointer, t_data is + * set to point MINIMAL_TUPLE_OFFSET bytes before the actual start of the + * minimal tuple --- that is, where a full tuple matching the minimal tuple's + * data would start. This trick is what makes the structs seem equivalent. + * + * Note that t_hoff is computed the same as in a full tuple, hence it includes + * the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however. + * + * MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data + * other than the length word. tuplesort.c and tuplestore.c use this to avoid + * writing the padding to disk. + */ +#define MINIMAL_TUPLE_OFFSET \ + ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF) +#define MINIMAL_TUPLE_PADDING \ + ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF) +#define MINIMAL_TUPLE_DATA_OFFSET \ + offsetof(MinimalTupleData, t_infomask2) + +struct MinimalTupleData +{ + uint32 t_len; /* actual length of minimal tuple */ + + char mt_padding[MINIMAL_TUPLE_PADDING]; + + /* Fields below here must match HeapTupleHeaderData! */ + + uint16 t_infomask2; /* number of attributes + various flags */ + + uint16 t_infomask; /* various flag bits, see below */ + + uint8 t_hoff; /* sizeof header incl. bitmap, padding */ + + /* ^ - 23 bytes - ^ */ + + bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */ + + /* MORE DATA FOLLOWS AT END OF STRUCT */ +}; + +/* typedef appears in htup.h */ + +#define SizeofMinimalTupleHeader offsetof(MinimalTupleData, t_bits) + +/* + * MinimalTuple accessor functions + */ + +static inline bool +HeapTupleHeaderHasMatch(const MinimalTupleData *tup) +{ + return (tup->t_infomask2 & HEAP_TUPLE_HAS_MATCH) != 0; +} + +static inline void +HeapTupleHeaderSetMatch(MinimalTupleData *tup) +{ + tup->t_infomask2 |= HEAP_TUPLE_HAS_MATCH; +} + +static inline void +HeapTupleHeaderClearMatch(MinimalTupleData *tup) +{ + tup->t_infomask2 &= ~HEAP_TUPLE_HAS_MATCH; +} + + +/* + * GETSTRUCT - given a HeapTuple pointer, return address of the user data + */ +static inline void * +GETSTRUCT(const HeapTupleData *tuple) +{ + return ((char *) (tuple->t_data) + tuple->t_data->t_hoff); +} + +/* + * Accessor functions to be used with HeapTuple pointers. + */ + +static inline bool +HeapTupleHasNulls(const HeapTupleData *tuple) +{ + return (tuple->t_data->t_infomask & HEAP_HASNULL) != 0; +} + +static inline bool +HeapTupleNoNulls(const HeapTupleData *tuple) +{ + return !HeapTupleHasNulls(tuple); +} + +static inline bool +HeapTupleHasVarWidth(const HeapTupleData *tuple) +{ + return (tuple->t_data->t_infomask & HEAP_HASVARWIDTH) != 0; +} + +static inline bool +HeapTupleAllFixed(const HeapTupleData *tuple) +{ + return !HeapTupleHasVarWidth(tuple); +} + +static inline bool +HeapTupleHasExternal(const HeapTupleData *tuple) +{ + return (tuple->t_data->t_infomask & HEAP_HASEXTERNAL) != 0; +} + +static inline bool +HeapTupleIsHotUpdated(const HeapTupleData *tuple) +{ + return HeapTupleHeaderIsHotUpdated(tuple->t_data); +} + +static inline void +HeapTupleSetHotUpdated(const HeapTupleData *tuple) +{ + HeapTupleHeaderSetHotUpdated(tuple->t_data); +} + +static inline void +HeapTupleClearHotUpdated(const HeapTupleData *tuple) +{ + HeapTupleHeaderClearHotUpdated(tuple->t_data); +} + +static inline bool +HeapTupleIsHeapOnly(const HeapTupleData *tuple) +{ + return HeapTupleHeaderIsHeapOnly(tuple->t_data); +} + +static inline void +HeapTupleSetHeapOnly(const HeapTupleData *tuple) +{ + HeapTupleHeaderSetHeapOnly(tuple->t_data); +} + +static inline void +HeapTupleClearHeapOnly(const HeapTupleData *tuple) +{ + HeapTupleHeaderClearHeapOnly(tuple->t_data); +} + +/* prototypes for functions in common/heaptuple.c */ +extern Size heap_compute_data_size(TupleDesc tupleDesc, + const Datum *values, const bool *isnull); +extern void heap_fill_tuple(TupleDesc tupleDesc, + const Datum *values, const bool *isnull, + char *data, Size data_size, + uint16 *infomask, bits8 *bit); +extern bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc); +extern Datum nocachegetattr(HeapTuple tup, int attnum, + TupleDesc tupleDesc); +extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, + bool *isnull); +extern Datum getmissingattr(TupleDesc tupleDesc, + int attnum, bool *isnull); +extern HeapTuple heap_copytuple(HeapTuple tuple); +extern void heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest); +extern Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc); +extern HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, + const Datum *values, const bool *isnull); +extern HeapTuple heap_modify_tuple(HeapTuple tuple, + TupleDesc tupleDesc, + const Datum *replValues, + const bool *replIsnull, + const bool *doReplace); +extern HeapTuple heap_modify_tuple_by_cols(HeapTuple tuple, + TupleDesc tupleDesc, + int nCols, + const int *replCols, + const Datum *replValues, + const bool *replIsnull); +extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, + Datum *values, bool *isnull); +extern void heap_freetuple(HeapTuple htup); +extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor, + const Datum *values, const bool *isnull, + Size extra); +extern void heap_free_minimal_tuple(MinimalTuple mtup); +extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup, Size extra); +extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup); +extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup, Size extra); +extern size_t varsize_any(void *p); +extern HeapTuple heap_expand_tuple(HeapTuple sourceTuple, TupleDesc tupleDesc); +extern MinimalTuple minimal_expand_tuple(HeapTuple sourceTuple, TupleDesc tupleDesc); + +#ifndef FRONTEND +/* + * fastgetattr + * Fetch a user attribute's value as a Datum (might be either a + * value, or a pointer into the data area of the tuple). + * + * This must not be used when a system attribute might be requested. + * Furthermore, the passed attnum MUST be valid. Use heap_getattr() + * instead, if in doubt. + * + * This gets called many times, so we macro the cacheable and NULL + * lookups, and call nocachegetattr() for the rest. + */ +static inline Datum +fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) +{ + Assert(attnum > 0); + + *isnull = false; + if (HeapTupleNoNulls(tup)) + { + CompactAttribute *att; + + att = TupleDescCompactAttr(tupleDesc, attnum - 1); + if (att->attcacheoff >= 0) + return fetchatt(att, (char *) tup->t_data + tup->t_data->t_hoff + + att->attcacheoff); + else + return nocachegetattr(tup, attnum, tupleDesc); + } + else + { + if (att_isnull(attnum - 1, tup->t_data->t_bits)) + { + *isnull = true; + return (Datum) NULL; + } + else + return nocachegetattr(tup, attnum, tupleDesc); + } +} + +/* + * heap_getattr + * Extract an attribute of a heap tuple and return it as a Datum. + * This works for either system or user attributes. The given attnum + * is properly range-checked. + * + * If the field in question has a NULL value, we return a zero Datum + * and set *isnull == true. Otherwise, we set *isnull == false. + * + * is the pointer to the heap tuple. is the attribute + * number of the column (field) caller wants. is a + * pointer to the structure describing the row and all its fields. + * + */ +static inline Datum +heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) +{ + if (attnum > 0) + { + if (attnum > (int) HeapTupleHeaderGetNatts(tup->t_data)) + return getmissingattr(tupleDesc, attnum, isnull); + else + return fastgetattr(tup, attnum, tupleDesc, isnull); + } + else + return heap_getsysattr(tup, attnum, tupleDesc, isnull); +} +#endif /* FRONTEND */ + +#endif /* HTUP_DETAILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/itup.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/itup.h new file mode 100644 index 0000000..7066c2a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/itup.h @@ -0,0 +1,186 @@ +/*------------------------------------------------------------------------- + * + * itup.h + * POSTGRES index tuple definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/itup.h + * + *------------------------------------------------------------------------- + */ +#ifndef ITUP_H +#define ITUP_H + +#include "access/tupdesc.h" +#include "access/tupmacs.h" +#include "storage/bufpage.h" +#include "storage/itemptr.h" + +/* + * Index tuple header structure + * + * All index tuples start with IndexTupleData. If the HasNulls bit is set, + * this is followed by an IndexAttributeBitMapData. The index attribute + * values follow, beginning at a MAXALIGN boundary. + * + * Note that the space allocated for the bitmap does not vary with the number + * of attributes; that is because we don't have room to store the number of + * attributes in the header. Given the MAXALIGN constraint there's no space + * savings to be had anyway, for usual values of INDEX_MAX_KEYS. + */ + +typedef struct IndexTupleData +{ + ItemPointerData t_tid; /* reference TID to heap tuple */ + + /* --------------- + * t_info is laid out in the following fashion: + * + * 15th (high) bit: has nulls + * 14th bit: has var-width attributes + * 13th bit: AM-defined meaning + * 12-0 bit: size of tuple + * --------------- + */ + + unsigned short t_info; /* various info about tuple */ + +} IndexTupleData; /* MORE DATA FOLLOWS AT END OF STRUCT */ + +typedef IndexTupleData *IndexTuple; + +typedef struct IndexAttributeBitMapData +{ + bits8 bits[(INDEX_MAX_KEYS + 8 - 1) / 8]; +} IndexAttributeBitMapData; + +typedef IndexAttributeBitMapData * IndexAttributeBitMap; + +/* + * t_info manipulation macros + */ +#define INDEX_SIZE_MASK 0x1FFF +#define INDEX_AM_RESERVED_BIT 0x2000 /* reserved for index-AM specific + * usage */ +#define INDEX_VAR_MASK 0x4000 +#define INDEX_NULL_MASK 0x8000 + +static inline Size +IndexTupleSize(const IndexTupleData *itup) +{ + return (itup->t_info & INDEX_SIZE_MASK); +} + +static inline bool +IndexTupleHasNulls(const IndexTupleData *itup) +{ + return itup->t_info & INDEX_NULL_MASK; +} + +static inline bool +IndexTupleHasVarwidths(const IndexTupleData *itup) +{ + return itup->t_info & INDEX_VAR_MASK; +} + + +/* routines in indextuple.c */ +extern IndexTuple index_form_tuple(TupleDesc tupleDescriptor, + const Datum *values, const bool *isnull); +extern IndexTuple index_form_tuple_context(TupleDesc tupleDescriptor, + const Datum *values, const bool *isnull, + MemoryContext context); +extern Datum nocache_index_getattr(IndexTuple tup, int attnum, + TupleDesc tupleDesc); +extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor, + Datum *values, bool *isnull); +extern void index_deform_tuple_internal(TupleDesc tupleDescriptor, + Datum *values, bool *isnull, + char *tp, bits8 *bp, int hasnulls); +extern IndexTuple CopyIndexTuple(IndexTuple source); +extern IndexTuple index_truncate_tuple(TupleDesc sourceDescriptor, + IndexTuple source, int leavenatts); + + +/* + * Takes an infomask as argument (primarily because this needs to be usable + * at index_form_tuple time so enough space is allocated). + */ +static inline Size +IndexInfoFindDataOffset(unsigned short t_info) +{ + if (!(t_info & INDEX_NULL_MASK)) + return MAXALIGN(sizeof(IndexTupleData)); + else + return MAXALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData)); +} + +#ifndef FRONTEND + +/* ---------------- + * index_getattr + * + * This gets called many times, so we macro the cacheable and NULL + * lookups, and call nocache_index_getattr() for the rest. + * + * ---------------- + */ +static inline Datum +index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) +{ + Assert(PointerIsValid(isnull)); + Assert(attnum > 0); + + *isnull = false; + + if (!IndexTupleHasNulls(tup)) + { + CompactAttribute *attr = TupleDescCompactAttr(tupleDesc, attnum - 1); + + if (attr->attcacheoff >= 0) + { + return fetchatt(attr, + (char *) tup + IndexInfoFindDataOffset(tup->t_info) + + attr->attcacheoff); + } + else + return nocache_index_getattr(tup, attnum, tupleDesc); + } + else + { + if (att_isnull(attnum - 1, (bits8 *) tup + sizeof(IndexTupleData))) + { + *isnull = true; + return (Datum) NULL; + } + else + return nocache_index_getattr(tup, attnum, tupleDesc); + } +} + +#endif + +/* + * MaxIndexTuplesPerPage is an upper bound on the number of tuples that can + * fit on one index page. An index tuple must have either data or a null + * bitmap, so we can safely assume it's at least 1 byte bigger than a bare + * IndexTupleData struct. We arrive at the divisor because each tuple + * must be maxaligned, and it must have an associated line pointer. + * + * To be index-type-independent, this does not account for any special space + * on the page, and is thus conservative. + * + * Note: in btree non-leaf pages, the first tuple has no key (it's implicitly + * minus infinity), thus breaking the "at least 1 byte bigger" assumption. + * On such a page, N tuples could take one MAXALIGN quantum less space than + * estimated here, seemingly allowing one more tuple than estimated here. + * But such a page always has at least MAXALIGN special space, so we're safe. + */ +#define MaxIndexTuplesPerPage \ + ((int) ((BLCKSZ - SizeOfPageHeaderData) / \ + (MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData)))) + +#endif /* ITUP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/multixact.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/multixact.h new file mode 100644 index 0000000..4e6b0ee --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/multixact.h @@ -0,0 +1,161 @@ +/* + * multixact.h + * + * PostgreSQL multi-transaction-log manager + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/multixact.h + */ +#ifndef MULTIXACT_H +#define MULTIXACT_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/sync.h" + + +/* + * The first two MultiXactId values are reserved to store the truncation Xid + * and epoch of the first segment, so we start assigning multixact values from + * 2. + */ +#define InvalidMultiXactId ((MultiXactId) 0) +#define FirstMultiXactId ((MultiXactId) 1) +#define MaxMultiXactId ((MultiXactId) 0xFFFFFFFF) + +#define MultiXactIdIsValid(multi) ((multi) != InvalidMultiXactId) + +#define MaxMultiXactOffset ((MultiXactOffset) 0xFFFFFFFF) + +/* + * Possible multixact lock modes ("status"). The first four modes are for + * tuple locks (FOR KEY SHARE, FOR SHARE, FOR NO KEY UPDATE, FOR UPDATE); the + * next two are used for update and delete modes. + */ +typedef enum +{ + MultiXactStatusForKeyShare = 0x00, + MultiXactStatusForShare = 0x01, + MultiXactStatusForNoKeyUpdate = 0x02, + MultiXactStatusForUpdate = 0x03, + /* an update that doesn't touch "key" columns */ + MultiXactStatusNoKeyUpdate = 0x04, + /* other updates, and delete */ + MultiXactStatusUpdate = 0x05, +} MultiXactStatus; + +#define MaxMultiXactStatus MultiXactStatusUpdate + +/* does a status value correspond to a tuple update? */ +#define ISUPDATE_from_mxstatus(status) \ + ((status) > MultiXactStatusForUpdate) + + +typedef struct MultiXactMember +{ + TransactionId xid; + MultiXactStatus status; +} MultiXactMember; + + +/* ---------------- + * multixact-related XLOG entries + * ---------------- + */ + +#define XLOG_MULTIXACT_ZERO_OFF_PAGE 0x00 +#define XLOG_MULTIXACT_ZERO_MEM_PAGE 0x10 +#define XLOG_MULTIXACT_CREATE_ID 0x20 +#define XLOG_MULTIXACT_TRUNCATE_ID 0x30 + +typedef struct xl_multixact_create +{ + MultiXactId mid; /* new MultiXact's ID */ + MultiXactOffset moff; /* its starting offset in members file */ + int32 nmembers; /* number of member XIDs */ + MultiXactMember members[FLEXIBLE_ARRAY_MEMBER]; +} xl_multixact_create; + +#define SizeOfMultiXactCreate (offsetof(xl_multixact_create, members)) + +typedef struct xl_multixact_truncate +{ + Oid oldestMultiDB; + + /* to-be-truncated range of multixact offsets */ + MultiXactId startTruncOff; /* just for completeness' sake */ + MultiXactId endTruncOff; + + /* to-be-truncated range of multixact members */ + MultiXactOffset startTruncMemb; + MultiXactOffset endTruncMemb; +} xl_multixact_truncate; + +#define SizeOfMultiXactTruncate (sizeof(xl_multixact_truncate)) + + +extern MultiXactId MultiXactIdCreate(TransactionId xid1, + MultiXactStatus status1, TransactionId xid2, + MultiXactStatus status2); +extern MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid, + MultiXactStatus status); +extern MultiXactId MultiXactIdCreateFromMembers(int nmembers, + MultiXactMember *members); + +extern MultiXactId ReadNextMultiXactId(void); +extern void ReadMultiXactIdRange(MultiXactId *oldest, MultiXactId *next); +extern bool MultiXactIdIsRunning(MultiXactId multi, bool isLockOnly); +extern void MultiXactIdSetOldestMember(void); +extern int GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members, + bool from_pgupgrade, bool isLockOnly); +extern bool MultiXactIdPrecedes(MultiXactId multi1, MultiXactId multi2); +extern bool MultiXactIdPrecedesOrEquals(MultiXactId multi1, + MultiXactId multi2); + +extern int multixactoffsetssyncfiletag(const FileTag *ftag, char *path); +extern int multixactmemberssyncfiletag(const FileTag *ftag, char *path); + +extern void AtEOXact_MultiXact(void); +extern void AtPrepare_MultiXact(void); +extern void PostPrepare_MultiXact(TransactionId xid); + +extern Size MultiXactShmemSize(void); +extern void MultiXactShmemInit(void); +extern void BootStrapMultiXact(void); +extern void StartupMultiXact(void); +extern void TrimMultiXact(void); +extern void SetMultiXactIdLimit(MultiXactId oldest_datminmxid, + Oid oldest_datoid, + bool is_startup); +extern void MultiXactGetCheckptMulti(bool is_shutdown, + MultiXactId *nextMulti, + MultiXactOffset *nextMultiOffset, + MultiXactId *oldestMulti, + Oid *oldestMultiDB); +extern void CheckPointMultiXact(void); +extern MultiXactId GetOldestMultiXactId(void); +extern void TruncateMultiXact(MultiXactId newOldestMulti, + Oid newOldestMultiDB); +extern void MultiXactSetNextMXact(MultiXactId nextMulti, + MultiXactOffset nextMultiOffset); +extern void MultiXactAdvanceNextMXact(MultiXactId minMulti, + MultiXactOffset minMultiOffset); +extern void MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB); +extern int MultiXactMemberFreezeThreshold(void); + +extern void multixact_twophase_recover(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void multixact_twophase_postcommit(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void multixact_twophase_postabort(TransactionId xid, uint16 info, + void *recdata, uint32 len); + +extern void multixact_redo(XLogReaderState *record); +extern void multixact_desc(StringInfo buf, XLogReaderState *record); +extern const char *multixact_identify(uint8 info); +extern char *mxid_to_string(MultiXactId multi, int nmembers, + MultiXactMember *members); + +#endif /* MULTIXACT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/nbtree.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/nbtree.h new file mode 100644 index 0000000..e709d2e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/nbtree.h @@ -0,0 +1,1367 @@ +/*------------------------------------------------------------------------- + * + * nbtree.h + * header file for postgres btree access method implementation. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/nbtree.h + * + *------------------------------------------------------------------------- + */ +#ifndef NBTREE_H +#define NBTREE_H + +#include "access/amapi.h" +#include "access/itup.h" +#include "access/sdir.h" +#include "access/tableam.h" +#include "access/xlogreader.h" +#include "catalog/pg_am_d.h" +#include "catalog/pg_index.h" +#include "lib/stringinfo.h" +#include "storage/bufmgr.h" +#include "storage/shm_toc.h" +#include "utils/skipsupport.h" + +/* There's room for a 16-bit vacuum cycle ID in BTPageOpaqueData */ +typedef uint16 BTCycleId; + +/* + * BTPageOpaqueData -- At the end of every page, we store a pointer + * to both siblings in the tree. This is used to do forward/backward + * index scans. The next-page link is also critical for recovery when + * a search has navigated to the wrong page due to concurrent page splits + * or deletions; see src/backend/access/nbtree/README for more info. + * + * In addition, we store the page's btree level (counting upwards from + * zero at a leaf page) as well as some flag bits indicating the page type + * and status. If the page is deleted, a BTDeletedPageData struct is stored + * in the page's tuple area, while a standard BTPageOpaqueData struct is + * stored in the page special area. + * + * We also store a "vacuum cycle ID". When a page is split while VACUUM is + * processing the index, a nonzero value associated with the VACUUM run is + * stored into both halves of the split page. (If VACUUM is not running, + * both pages receive zero cycleids.) This allows VACUUM to detect whether + * a page was split since it started, with a small probability of false match + * if the page was last split some exact multiple of MAX_BT_CYCLE_ID VACUUMs + * ago. Also, during a split, the BTP_SPLIT_END flag is cleared in the left + * (original) page, and set in the right page, but only if the next page + * to its right has a different cycleid. + * + * NOTE: the BTP_LEAF flag bit is redundant since level==0 could be tested + * instead. + * + * NOTE: the btpo_level field used to be a union type in order to allow + * deleted pages to store a 32-bit safexid in the same field. We now store + * 64-bit/full safexid values using BTDeletedPageData instead. + */ + +typedef struct BTPageOpaqueData +{ + BlockNumber btpo_prev; /* left sibling, or P_NONE if leftmost */ + BlockNumber btpo_next; /* right sibling, or P_NONE if rightmost */ + uint32 btpo_level; /* tree level --- zero for leaf pages */ + uint16 btpo_flags; /* flag bits, see below */ + BTCycleId btpo_cycleid; /* vacuum cycle ID of latest split */ +} BTPageOpaqueData; + +typedef BTPageOpaqueData *BTPageOpaque; + +#define BTPageGetOpaque(page) ((BTPageOpaque) PageGetSpecialPointer(page)) + +/* Bits defined in btpo_flags */ +#define BTP_LEAF (1 << 0) /* leaf page, i.e. not internal page */ +#define BTP_ROOT (1 << 1) /* root page (has no parent) */ +#define BTP_DELETED (1 << 2) /* page has been deleted from tree */ +#define BTP_META (1 << 3) /* meta-page */ +#define BTP_HALF_DEAD (1 << 4) /* empty, but still in tree */ +#define BTP_SPLIT_END (1 << 5) /* rightmost page of split group */ +#define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DEAD tuples (deprecated) */ +#define BTP_INCOMPLETE_SPLIT (1 << 7) /* right sibling's downlink is missing */ +#define BTP_HAS_FULLXID (1 << 8) /* contains BTDeletedPageData */ + +/* + * The max allowed value of a cycle ID is a bit less than 64K. This is + * for convenience of pg_filedump and similar utilities: we want to use + * the last 2 bytes of special space as an index type indicator, and + * restricting cycle ID lets btree use that space for vacuum cycle IDs + * while still allowing index type to be identified. + */ +#define MAX_BT_CYCLE_ID 0xFF7F + + +/* + * The Meta page is always the first page in the btree index. + * Its primary purpose is to point to the location of the btree root page. + * We also point to the "fast" root, which is the current effective root; + * see README for discussion. + */ + +typedef struct BTMetaPageData +{ + uint32 btm_magic; /* should contain BTREE_MAGIC */ + uint32 btm_version; /* nbtree version (always <= BTREE_VERSION) */ + BlockNumber btm_root; /* current root location */ + uint32 btm_level; /* tree level of the root page */ + BlockNumber btm_fastroot; /* current "fast" root location */ + uint32 btm_fastlevel; /* tree level of the "fast" root page */ + /* remaining fields only valid when btm_version >= BTREE_NOVAC_VERSION */ + + /* number of deleted, non-recyclable pages during last cleanup */ + uint32 btm_last_cleanup_num_delpages; + /* number of heap tuples during last cleanup (deprecated) */ + float8 btm_last_cleanup_num_heap_tuples; + + bool btm_allequalimage; /* are all columns "equalimage"? */ +} BTMetaPageData; + +#define BTPageGetMeta(p) \ + ((BTMetaPageData *) PageGetContents(p)) + +/* + * The current Btree version is 4. That's what you'll get when you create + * a new index. + * + * Btree version 3 was used in PostgreSQL v11. It is mostly the same as + * version 4, but heap TIDs were not part of the keyspace. Index tuples + * with duplicate keys could be stored in any order. We continue to + * support reading and writing Btree versions 2 and 3, so that they don't + * need to be immediately re-indexed at pg_upgrade. In order to get the + * new heapkeyspace semantics, however, a REINDEX is needed. + * + * Deduplication is safe to use when the btm_allequalimage field is set to + * true. It's safe to read the btm_allequalimage field on version 3, but + * only version 4 indexes make use of deduplication. Even version 4 + * indexes created on PostgreSQL v12 will need a REINDEX to make use of + * deduplication, though, since there is no other way to set + * btm_allequalimage to true (pg_upgrade hasn't been taught to set the + * metapage field). + * + * Btree version 2 is mostly the same as version 3. There are two new + * fields in the metapage that were introduced in version 3. A version 2 + * metapage will be automatically upgraded to version 3 on the first + * insert to it. INCLUDE indexes cannot use version 2. + */ +#define BTREE_METAPAGE 0 /* first page is meta */ +#define BTREE_MAGIC 0x053162 /* magic number in metapage */ +#define BTREE_VERSION 4 /* current version number */ +#define BTREE_MIN_VERSION 2 /* minimum supported version */ +#define BTREE_NOVAC_VERSION 3 /* version with all meta fields set */ + +/* + * Maximum size of a btree index entry, including its tuple header. + * + * We actually need to be able to fit three items on every page, + * so restrict any one item to 1/3 the per-page available space. + * + * There are rare cases where _bt_truncate() will need to enlarge + * a heap index tuple to make space for a tiebreaker heap TID + * attribute, which we account for here. + */ +#define BTMaxItemSize \ + (MAXALIGN_DOWN((BLCKSZ - \ + MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \ + MAXALIGN(sizeof(BTPageOpaqueData))) / 3) - \ + MAXALIGN(sizeof(ItemPointerData))) +#define BTMaxItemSizeNoHeapTid \ + MAXALIGN_DOWN((BLCKSZ - \ + MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \ + MAXALIGN(sizeof(BTPageOpaqueData))) / 3) + +/* + * MaxTIDsPerBTreePage is an upper bound on the number of heap TIDs tuples + * that may be stored on a btree leaf page. It is used to size the + * per-page temporary buffers. + * + * Note: we don't bother considering per-tuple overheads here to keep + * things simple (value is based on how many elements a single array of + * heap TIDs must have to fill the space between the page header and + * special area). The value is slightly higher (i.e. more conservative) + * than necessary as a result, which is considered acceptable. + */ +#define MaxTIDsPerBTreePage \ + (int) ((BLCKSZ - SizeOfPageHeaderData - sizeof(BTPageOpaqueData)) / \ + sizeof(ItemPointerData)) + +/* + * The leaf-page fillfactor defaults to 90% but is user-adjustable. + * For pages above the leaf level, we use a fixed 70% fillfactor. + * The fillfactor is applied during index build and when splitting + * a rightmost page; when splitting non-rightmost pages we try to + * divide the data equally. When splitting a page that's entirely + * filled with a single value (duplicates), the effective leaf-page + * fillfactor is 96%, regardless of whether the page is a rightmost + * page. + */ +#define BTREE_MIN_FILLFACTOR 10 +#define BTREE_DEFAULT_FILLFACTOR 90 +#define BTREE_NONLEAF_FILLFACTOR 70 +#define BTREE_SINGLEVAL_FILLFACTOR 96 + +/* + * In general, the btree code tries to localize its knowledge about + * page layout to a couple of routines. However, we need a special + * value to indicate "no page number" in those places where we expect + * page numbers. We can use zero for this because we never need to + * make a pointer to the metadata page. + */ + +#define P_NONE 0 + +/* + * Macros to test whether a page is leftmost or rightmost on its tree level, + * as well as other state info kept in the opaque data. + */ +#define P_LEFTMOST(opaque) ((opaque)->btpo_prev == P_NONE) +#define P_RIGHTMOST(opaque) ((opaque)->btpo_next == P_NONE) +#define P_ISLEAF(opaque) (((opaque)->btpo_flags & BTP_LEAF) != 0) +#define P_ISROOT(opaque) (((opaque)->btpo_flags & BTP_ROOT) != 0) +#define P_ISDELETED(opaque) (((opaque)->btpo_flags & BTP_DELETED) != 0) +#define P_ISMETA(opaque) (((opaque)->btpo_flags & BTP_META) != 0) +#define P_ISHALFDEAD(opaque) (((opaque)->btpo_flags & BTP_HALF_DEAD) != 0) +#define P_IGNORE(opaque) (((opaque)->btpo_flags & (BTP_DELETED|BTP_HALF_DEAD)) != 0) +#define P_HAS_GARBAGE(opaque) (((opaque)->btpo_flags & BTP_HAS_GARBAGE) != 0) +#define P_INCOMPLETE_SPLIT(opaque) (((opaque)->btpo_flags & BTP_INCOMPLETE_SPLIT) != 0) +#define P_HAS_FULLXID(opaque) (((opaque)->btpo_flags & BTP_HAS_FULLXID) != 0) + +/* + * BTDeletedPageData is the page contents of a deleted page + */ +typedef struct BTDeletedPageData +{ + FullTransactionId safexid; /* See BTPageIsRecyclable() */ +} BTDeletedPageData; + +static inline void +BTPageSetDeleted(Page page, FullTransactionId safexid) +{ + BTPageOpaque opaque; + PageHeader header; + BTDeletedPageData *contents; + + opaque = BTPageGetOpaque(page); + header = ((PageHeader) page); + + opaque->btpo_flags &= ~BTP_HALF_DEAD; + opaque->btpo_flags |= BTP_DELETED | BTP_HAS_FULLXID; + header->pd_lower = MAXALIGN(SizeOfPageHeaderData) + + sizeof(BTDeletedPageData); + header->pd_upper = header->pd_special; + + /* Set safexid in deleted page */ + contents = ((BTDeletedPageData *) PageGetContents(page)); + contents->safexid = safexid; +} + +static inline FullTransactionId +BTPageGetDeleteXid(Page page) +{ + BTPageOpaque opaque; + BTDeletedPageData *contents; + + /* We only expect to be called with a deleted page */ + Assert(!PageIsNew(page)); + opaque = BTPageGetOpaque(page); + Assert(P_ISDELETED(opaque)); + + /* pg_upgrade'd deleted page -- must be safe to recycle now */ + if (!P_HAS_FULLXID(opaque)) + return FirstNormalFullTransactionId; + + /* Get safexid from deleted page */ + contents = ((BTDeletedPageData *) PageGetContents(page)); + return contents->safexid; +} + +/* + * Is an existing page recyclable? + * + * This exists to centralize the policy on which deleted pages are now safe to + * re-use. However, _bt_pendingfsm_finalize() duplicates some of the same + * logic because it doesn't work directly with pages -- keep the two in sync. + * + * Note: PageIsNew() pages are always safe to recycle, but we can't deal with + * them here (caller is responsible for that case themselves). Caller might + * well need special handling for new pages anyway. + */ +static inline bool +BTPageIsRecyclable(Page page, Relation heaprel) +{ + BTPageOpaque opaque; + + Assert(!PageIsNew(page)); + Assert(heaprel != NULL); + + /* Recycling okay iff page is deleted and safexid is old enough */ + opaque = BTPageGetOpaque(page); + if (P_ISDELETED(opaque)) + { + FullTransactionId safexid = BTPageGetDeleteXid(page); + + /* + * The page was deleted, but when? If it was just deleted, a scan + * might have seen the downlink to it, and will read the page later. + * As long as that can happen, we must keep the deleted page around as + * a tombstone. + * + * For that check if the deletion XID could still be visible to + * anyone. If not, then no scan that's still in progress could have + * seen its downlink, and we can recycle it. + */ + return GlobalVisCheckRemovableFullXid(heaprel, safexid); + } + + return false; +} + +/* + * BTVacState and BTPendingFSM are private nbtree.c state used during VACUUM. + * They are exported for use by page deletion related code in nbtpage.c. + */ +typedef struct BTPendingFSM +{ + BlockNumber target; /* Page deleted by current VACUUM */ + FullTransactionId safexid; /* Page's BTDeletedPageData.safexid */ +} BTPendingFSM; + +typedef struct BTVacState +{ + IndexVacuumInfo *info; + IndexBulkDeleteResult *stats; + IndexBulkDeleteCallback callback; + void *callback_state; + BTCycleId cycleid; + MemoryContext pagedelcontext; + + /* + * _bt_pendingfsm_finalize() state + */ + int bufsize; /* pendingpages space (in # elements) */ + int maxbufsize; /* max bufsize that respects work_mem */ + BTPendingFSM *pendingpages; /* One entry per newly deleted page */ + int npendingpages; /* current # valid pendingpages */ +} BTVacState; + +/* + * Lehman and Yao's algorithm requires a ``high key'' on every non-rightmost + * page. The high key is not a tuple that is used to visit the heap. It is + * a pivot tuple (see "Notes on B-Tree tuple format" below for definition). + * The high key on a page is required to be greater than or equal to any + * other key that appears on the page. If we find ourselves trying to + * insert a key that is strictly > high key, we know we need to move right + * (this should only happen if the page was split since we examined the + * parent page). + * + * Our insertion algorithm guarantees that we can use the initial least key + * on our right sibling as the high key. Once a page is created, its high + * key changes only if the page is split. + * + * On a non-rightmost page, the high key lives in item 1 and data items + * start in item 2. Rightmost pages have no high key, so we store data + * items beginning in item 1. + */ + +#define P_HIKEY ((OffsetNumber) 1) +#define P_FIRSTKEY ((OffsetNumber) 2) +#define P_FIRSTDATAKEY(opaque) (P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY) + +/* + * Notes on B-Tree tuple format, and key and non-key attributes: + * + * INCLUDE B-Tree indexes have non-key attributes. These are extra + * attributes that may be returned by index-only scans, but do not influence + * the order of items in the index (formally, non-key attributes are not + * considered to be part of the key space). Non-key attributes are only + * present in leaf index tuples whose item pointers actually point to heap + * tuples (non-pivot tuples). _bt_check_natts() enforces the rules + * described here. + * + * Non-pivot tuple format (plain/non-posting variant): + * + * t_tid | t_info | key values | INCLUDE columns, if any + * + * t_tid points to the heap TID, which is a tiebreaker key column as of + * BTREE_VERSION 4. + * + * Non-pivot tuples complement pivot tuples, which only have key columns. + * The sole purpose of pivot tuples is to represent how the key space is + * separated. In general, any B-Tree index that has more than one level + * (i.e. any index that does not just consist of a metapage and a single + * leaf root page) must have some number of pivot tuples, since pivot + * tuples are used for traversing the tree. Suffix truncation can omit + * trailing key columns when a new pivot is formed, which makes minus + * infinity their logical value. Since BTREE_VERSION 4 indexes treat heap + * TID as a trailing key column that ensures that all index tuples are + * physically unique, it is necessary to represent heap TID as a trailing + * key column in pivot tuples, though very often this can be truncated + * away, just like any other key column. (Actually, the heap TID is + * omitted rather than truncated, since its representation is different to + * the non-pivot representation.) + * + * Pivot tuple format: + * + * t_tid | t_info | key values | [heap TID] + * + * We store the number of columns present inside pivot tuples by abusing + * their t_tid offset field, since pivot tuples never need to store a real + * offset (pivot tuples generally store a downlink in t_tid, though). The + * offset field only stores the number of columns/attributes when the + * INDEX_ALT_TID_MASK bit is set, which doesn't count the trailing heap + * TID column sometimes stored in pivot tuples -- that's represented by + * the presence of BT_PIVOT_HEAP_TID_ATTR. The INDEX_ALT_TID_MASK bit in + * t_info is always set on BTREE_VERSION 4 pivot tuples, since + * BTreeTupleIsPivot() must work reliably on heapkeyspace versions. + * + * In version 2 or version 3 (!heapkeyspace) indexes, INDEX_ALT_TID_MASK + * might not be set in pivot tuples. BTreeTupleIsPivot() won't work + * reliably as a result. The number of columns stored is implicitly the + * same as the number of columns in the index, just like any non-pivot + * tuple. (The number of columns stored should not vary, since suffix + * truncation of key columns is unsafe within any !heapkeyspace index.) + * + * The 12 least significant bits from t_tid's offset number are used to + * represent the number of key columns within a pivot tuple. This leaves 4 + * status bits (BT_STATUS_OFFSET_MASK bits), which are shared by all tuples + * that have the INDEX_ALT_TID_MASK bit set (set in t_info) to store basic + * tuple metadata. BTreeTupleIsPivot() and BTreeTupleIsPosting() use the + * BT_STATUS_OFFSET_MASK bits. + * + * Sometimes non-pivot tuples also use a representation that repurposes + * t_tid to store metadata rather than a TID. PostgreSQL v13 introduced a + * new non-pivot tuple format to support deduplication: posting list + * tuples. Deduplication merges together multiple equal non-pivot tuples + * into a logically equivalent, space efficient representation. A posting + * list is an array of ItemPointerData elements. Non-pivot tuples are + * merged together to form posting list tuples lazily, at the point where + * we'd otherwise have to split a leaf page. + * + * Posting tuple format (alternative non-pivot tuple representation): + * + * t_tid | t_info | key values | posting list (TID array) + * + * Posting list tuples are recognized as such by having the + * INDEX_ALT_TID_MASK status bit set in t_info and the BT_IS_POSTING status + * bit set in t_tid's offset number. These flags redefine the content of + * the posting tuple's t_tid to store the location of the posting list + * (instead of a block number), as well as the total number of heap TIDs + * present in the tuple (instead of a real offset number). + * + * The 12 least significant bits from t_tid's offset number are used to + * represent the number of heap TIDs present in the tuple, leaving 4 status + * bits (the BT_STATUS_OFFSET_MASK bits). Like any non-pivot tuple, the + * number of columns stored is always implicitly the total number in the + * index (in practice there can never be non-key columns stored, since + * deduplication is not supported with INCLUDE indexes). + */ +#define INDEX_ALT_TID_MASK INDEX_AM_RESERVED_BIT + +/* Item pointer offset bit masks */ +#define BT_OFFSET_MASK 0x0FFF +#define BT_STATUS_OFFSET_MASK 0xF000 +/* BT_STATUS_OFFSET_MASK status bits */ +#define BT_PIVOT_HEAP_TID_ATTR 0x1000 +#define BT_IS_POSTING 0x2000 + +/* + * Mask allocated for number of keys in index tuple must be able to fit + * maximum possible number of index attributes + */ +StaticAssertDecl(BT_OFFSET_MASK >= INDEX_MAX_KEYS, + "BT_OFFSET_MASK can't fit INDEX_MAX_KEYS"); + +/* + * Note: BTreeTupleIsPivot() can have false negatives (but not false + * positives) when used with !heapkeyspace indexes + */ +static inline bool +BTreeTupleIsPivot(IndexTuple itup) +{ + if ((itup->t_info & INDEX_ALT_TID_MASK) == 0) + return false; + /* absence of BT_IS_POSTING in offset number indicates pivot tuple */ + if ((ItemPointerGetOffsetNumberNoCheck(&itup->t_tid) & BT_IS_POSTING) != 0) + return false; + + return true; +} + +static inline bool +BTreeTupleIsPosting(IndexTuple itup) +{ + if ((itup->t_info & INDEX_ALT_TID_MASK) == 0) + return false; + /* presence of BT_IS_POSTING in offset number indicates posting tuple */ + if ((ItemPointerGetOffsetNumberNoCheck(&itup->t_tid) & BT_IS_POSTING) == 0) + return false; + + return true; +} + +static inline void +BTreeTupleSetPosting(IndexTuple itup, uint16 nhtids, int postingoffset) +{ + Assert(nhtids > 1); + Assert((nhtids & BT_STATUS_OFFSET_MASK) == 0); + Assert((size_t) postingoffset == MAXALIGN(postingoffset)); + Assert(postingoffset < INDEX_SIZE_MASK); + Assert(!BTreeTupleIsPivot(itup)); + + itup->t_info |= INDEX_ALT_TID_MASK; + ItemPointerSetOffsetNumber(&itup->t_tid, (nhtids | BT_IS_POSTING)); + ItemPointerSetBlockNumber(&itup->t_tid, postingoffset); +} + +static inline uint16 +BTreeTupleGetNPosting(IndexTuple posting) +{ + OffsetNumber existing; + + Assert(BTreeTupleIsPosting(posting)); + + existing = ItemPointerGetOffsetNumberNoCheck(&posting->t_tid); + return (existing & BT_OFFSET_MASK); +} + +static inline uint32 +BTreeTupleGetPostingOffset(IndexTuple posting) +{ + Assert(BTreeTupleIsPosting(posting)); + + return ItemPointerGetBlockNumberNoCheck(&posting->t_tid); +} + +static inline ItemPointer +BTreeTupleGetPosting(IndexTuple posting) +{ + return (ItemPointer) ((char *) posting + + BTreeTupleGetPostingOffset(posting)); +} + +static inline ItemPointer +BTreeTupleGetPostingN(IndexTuple posting, int n) +{ + return BTreeTupleGetPosting(posting) + n; +} + +/* + * Get/set downlink block number in pivot tuple. + * + * Note: Cannot assert that tuple is a pivot tuple. If we did so then + * !heapkeyspace indexes would exhibit false positive assertion failures. + */ +static inline BlockNumber +BTreeTupleGetDownLink(IndexTuple pivot) +{ + return ItemPointerGetBlockNumberNoCheck(&pivot->t_tid); +} + +static inline void +BTreeTupleSetDownLink(IndexTuple pivot, BlockNumber blkno) +{ + ItemPointerSetBlockNumber(&pivot->t_tid, blkno); +} + +/* + * Get number of attributes within tuple. + * + * Note that this does not include an implicit tiebreaker heap TID + * attribute, if any. Note also that the number of key attributes must be + * explicitly represented in all heapkeyspace pivot tuples. + * + * Note: This is defined as a macro rather than an inline function to + * avoid including rel.h. + */ +#define BTreeTupleGetNAtts(itup, rel) \ + ( \ + (BTreeTupleIsPivot(itup)) ? \ + ( \ + ItemPointerGetOffsetNumberNoCheck(&(itup)->t_tid) & BT_OFFSET_MASK \ + ) \ + : \ + IndexRelationGetNumberOfAttributes(rel) \ + ) + +/* + * Set number of key attributes in tuple. + * + * The heap TID tiebreaker attribute bit may also be set here, indicating that + * a heap TID value will be stored at the end of the tuple (i.e. using the + * special pivot tuple representation). + */ +static inline void +BTreeTupleSetNAtts(IndexTuple itup, uint16 nkeyatts, bool heaptid) +{ + Assert(nkeyatts <= INDEX_MAX_KEYS); + Assert((nkeyatts & BT_STATUS_OFFSET_MASK) == 0); + Assert(!heaptid || nkeyatts > 0); + Assert(!BTreeTupleIsPivot(itup) || nkeyatts == 0); + + itup->t_info |= INDEX_ALT_TID_MASK; + + if (heaptid) + nkeyatts |= BT_PIVOT_HEAP_TID_ATTR; + + /* BT_IS_POSTING bit is deliberately unset here */ + ItemPointerSetOffsetNumber(&itup->t_tid, nkeyatts); + Assert(BTreeTupleIsPivot(itup)); +} + +/* + * Get/set leaf page's "top parent" link from its high key. Used during page + * deletion. + * + * Note: Cannot assert that tuple is a pivot tuple. If we did so then + * !heapkeyspace indexes would exhibit false positive assertion failures. + */ +static inline BlockNumber +BTreeTupleGetTopParent(IndexTuple leafhikey) +{ + return ItemPointerGetBlockNumberNoCheck(&leafhikey->t_tid); +} + +static inline void +BTreeTupleSetTopParent(IndexTuple leafhikey, BlockNumber blkno) +{ + ItemPointerSetBlockNumber(&leafhikey->t_tid, blkno); + BTreeTupleSetNAtts(leafhikey, 0, false); +} + +/* + * Get tiebreaker heap TID attribute, if any. + * + * This returns the first/lowest heap TID in the case of a posting list tuple. + */ +static inline ItemPointer +BTreeTupleGetHeapTID(IndexTuple itup) +{ + if (BTreeTupleIsPivot(itup)) + { + /* Pivot tuple heap TID representation? */ + if ((ItemPointerGetOffsetNumberNoCheck(&itup->t_tid) & + BT_PIVOT_HEAP_TID_ATTR) != 0) + return (ItemPointer) ((char *) itup + IndexTupleSize(itup) - + sizeof(ItemPointerData)); + + /* Heap TID attribute was truncated */ + return NULL; + } + else if (BTreeTupleIsPosting(itup)) + return BTreeTupleGetPosting(itup); + + return &itup->t_tid; +} + +/* + * Get maximum heap TID attribute, which could be the only TID in the case of + * a non-pivot tuple that does not have a posting list. + * + * Works with non-pivot tuples only. + */ +static inline ItemPointer +BTreeTupleGetMaxHeapTID(IndexTuple itup) +{ + Assert(!BTreeTupleIsPivot(itup)); + + if (BTreeTupleIsPosting(itup)) + { + uint16 nposting = BTreeTupleGetNPosting(itup); + + return BTreeTupleGetPostingN(itup, nposting - 1); + } + + return &itup->t_tid; +} + +/* + * Operator strategy numbers for B-tree have been moved to access/stratnum.h, + * because many places need to use them in ScanKeyInit() calls. + * + * The strategy numbers are chosen so that we can commute them by + * subtraction, thus: + */ +#define BTCommuteStrategyNumber(strat) (BTMaxStrategyNumber + 1 - (strat)) + +/* + * When a new operator class is declared, we require that the user + * supply us with an amproc procedure (BTORDER_PROC) for determining + * whether, for two keys a and b, a < b, a = b, or a > b. This routine + * must return < 0, 0, > 0, respectively, in these three cases. + * + * To facilitate accelerated sorting, an operator class may choose to + * offer a second procedure (BTSORTSUPPORT_PROC). For full details, see + * src/include/utils/sortsupport.h. + * + * To support window frames defined by "RANGE offset PRECEDING/FOLLOWING", + * an operator class may choose to offer a third amproc procedure + * (BTINRANGE_PROC), independently of whether it offers sortsupport. + * For full details, see doc/src/sgml/btree.sgml. + * + * To facilitate B-Tree deduplication, an operator class may choose to + * offer a forth amproc procedure (BTEQUALIMAGE_PROC). For full details, + * see doc/src/sgml/btree.sgml. + * + * An operator class may choose to offer a fifth amproc procedure + * (BTOPTIONS_PROC). These procedures define a set of user-visible + * parameters that can be used to control operator class behavior. None of + * the built-in B-Tree operator classes currently register an "options" proc. + * + * To facilitate more efficient B-Tree skip scans, an operator class may + * choose to offer a sixth amproc procedure (BTSKIPSUPPORT_PROC). For full + * details, see src/include/utils/skipsupport.h. + */ + +#define BTORDER_PROC 1 +#define BTSORTSUPPORT_PROC 2 +#define BTINRANGE_PROC 3 +#define BTEQUALIMAGE_PROC 4 +#define BTOPTIONS_PROC 5 +#define BTSKIPSUPPORT_PROC 6 +#define BTNProcs 6 + +/* + * We need to be able to tell the difference between read and write + * requests for pages, in order to do locking correctly. + */ + +#define BT_READ BUFFER_LOCK_SHARE +#define BT_WRITE BUFFER_LOCK_EXCLUSIVE + +/* + * BTStackData -- As we descend a tree, we push the location of pivot + * tuples whose downlink we are about to follow onto a private stack. If + * we split a leaf, we use this stack to walk back up the tree and insert + * data into its parent page at the correct location. We also have to + * recursively insert into the grandparent page if and when the parent page + * splits. Our private stack can become stale due to concurrent page + * splits and page deletions, but it should never give us an irredeemably + * bad picture. + */ +typedef struct BTStackData +{ + BlockNumber bts_blkno; + OffsetNumber bts_offset; + struct BTStackData *bts_parent; +} BTStackData; + +typedef BTStackData *BTStack; + +/* + * BTScanInsertData is the btree-private state needed to find an initial + * position for an indexscan, or to insert new tuples -- an "insertion + * scankey" (not to be confused with a search scankey). It's used to descend + * a B-Tree using _bt_search. + * + * heapkeyspace indicates if we expect all keys in the index to be physically + * unique because heap TID is used as a tiebreaker attribute, and if index may + * have truncated key attributes in pivot tuples. This is actually a property + * of the index relation itself (not an indexscan). heapkeyspace indexes are + * indexes whose version is >= version 4. It's convenient to keep this close + * by, rather than accessing the metapage repeatedly. + * + * allequalimage is set to indicate that deduplication is safe for the index. + * This is also a property of the index relation rather than an indexscan. + * + * anynullkeys indicates if any of the keys had NULL value when scankey was + * built from index tuple (note that already-truncated tuple key attributes + * set NULL as a placeholder key value, which also affects value of + * anynullkeys). This is a convenience for unique index non-pivot tuple + * insertion, which usually temporarily unsets scantid, but shouldn't iff + * anynullkeys is true. Value generally matches non-pivot tuple's HasNulls + * bit, but may not when inserting into an INCLUDE index (tuple header value + * is affected by the NULL-ness of both key and non-key attributes). + * + * See comments in _bt_first for an explanation of the nextkey and backward + * fields. + * + * scantid is the heap TID that is used as a final tiebreaker attribute. It + * is set to NULL when index scan doesn't need to find a position for a + * specific physical tuple. Must be set when inserting new tuples into + * heapkeyspace indexes, since every tuple in the tree unambiguously belongs + * in one exact position (it's never set with !heapkeyspace indexes, though). + * Despite the representational difference, nbtree search code considers + * scantid to be just another insertion scankey attribute. + * + * scankeys is an array of scan key entries for attributes that are compared + * before scantid (user-visible attributes). keysz is the size of the array. + * During insertion, there must be a scan key for every attribute, but when + * starting a regular index scan some can be omitted. The array is used as a + * flexible array member, though it's sized in a way that makes it possible to + * use stack allocations. See nbtree/README for full details. + */ +typedef struct BTScanInsertData +{ + bool heapkeyspace; + bool allequalimage; + bool anynullkeys; + bool nextkey; + bool backward; /* backward index scan? */ + ItemPointer scantid; /* tiebreaker for scankeys */ + int keysz; /* Size of scankeys array */ + ScanKeyData scankeys[INDEX_MAX_KEYS]; /* Must appear last */ +} BTScanInsertData; + +typedef BTScanInsertData *BTScanInsert; + +/* + * BTInsertStateData is a working area used during insertion. + * + * This is filled in after descending the tree to the first leaf page the new + * tuple might belong on. Tracks the current position while performing + * uniqueness check, before we have determined which exact page to insert + * to. + * + * (This should be private to nbtinsert.c, but it's also used by + * _bt_binsrch_insert) + */ +typedef struct BTInsertStateData +{ + IndexTuple itup; /* Item we're inserting */ + Size itemsz; /* Size of itup -- should be MAXALIGN()'d */ + BTScanInsert itup_key; /* Insertion scankey */ + + /* Buffer containing leaf page we're likely to insert itup on */ + Buffer buf; + + /* + * Cache of bounds within the current buffer. Only used for insertions + * where _bt_check_unique is called. See _bt_binsrch_insert and + * _bt_findinsertloc for details. + */ + bool bounds_valid; + OffsetNumber low; + OffsetNumber stricthigh; + + /* + * if _bt_binsrch_insert found the location inside existing posting list, + * save the position inside the list. -1 sentinel value indicates overlap + * with an existing posting list tuple that has its LP_DEAD bit set. + */ + int postingoff; +} BTInsertStateData; + +typedef BTInsertStateData *BTInsertState; + +/* + * State used to representing an individual pending tuple during + * deduplication. + */ +typedef struct BTDedupInterval +{ + OffsetNumber baseoff; + uint16 nitems; +} BTDedupInterval; + +/* + * BTDedupStateData is a working area used during deduplication. + * + * The status info fields track the state of a whole-page deduplication pass. + * State about the current pending posting list is also tracked. + * + * A pending posting list is comprised of a contiguous group of equal items + * from the page, starting from page offset number 'baseoff'. This is the + * offset number of the "base" tuple for new posting list. 'nitems' is the + * current total number of existing items from the page that will be merged to + * make a new posting list tuple, including the base tuple item. (Existing + * items may themselves be posting list tuples, or regular non-pivot tuples.) + * + * The total size of the existing tuples to be freed when pending posting list + * is processed gets tracked by 'phystupsize'. This information allows + * deduplication to calculate the space saving for each new posting list + * tuple, and for the entire pass over the page as a whole. + */ +typedef struct BTDedupStateData +{ + /* Deduplication status info for entire pass over page */ + bool deduplicate; /* Still deduplicating page? */ + int nmaxitems; /* Number of max-sized tuples so far */ + Size maxpostingsize; /* Limit on size of final tuple */ + + /* Metadata about base tuple of current pending posting list */ + IndexTuple base; /* Use to form new posting list */ + OffsetNumber baseoff; /* page offset of base */ + Size basetupsize; /* base size without original posting list */ + + /* Other metadata about pending posting list */ + ItemPointer htids; /* Heap TIDs in pending posting list */ + int nhtids; /* Number of heap TIDs in htids array */ + int nitems; /* Number of existing tuples/line pointers */ + Size phystupsize; /* Includes line pointer overhead */ + + /* + * Array of tuples to go on new version of the page. Contains one entry + * for each group of consecutive items. Note that existing tuples that + * will not become posting list tuples do not appear in the array (they + * are implicitly unchanged by deduplication pass). + */ + int nintervals; /* current number of intervals in array */ + BTDedupInterval intervals[MaxIndexTuplesPerPage]; +} BTDedupStateData; + +typedef BTDedupStateData *BTDedupState; + +/* + * BTVacuumPostingData is state that represents how to VACUUM (or delete) a + * posting list tuple when some (though not all) of its TIDs are to be + * deleted. + * + * Convention is that itup field is the original posting list tuple on input, + * and palloc()'d final tuple used to overwrite existing tuple on output. + */ +typedef struct BTVacuumPostingData +{ + /* Tuple that will be/was updated */ + IndexTuple itup; + OffsetNumber updatedoffset; + + /* State needed to describe final itup in WAL */ + uint16 ndeletedtids; + uint16 deletetids[FLEXIBLE_ARRAY_MEMBER]; +} BTVacuumPostingData; + +typedef BTVacuumPostingData *BTVacuumPosting; + +/* + * BTScanOpaqueData is the btree-private state needed for an indexscan. + * This consists of preprocessed scan keys (see _bt_preprocess_keys() for + * details of the preprocessing), information about the current location + * of the scan, and information about the marked location, if any. (We use + * BTScanPosData to represent the data needed for each of current and marked + * locations.) In addition we can remember some known-killed index entries + * that must be marked before we can move off the current page. + * + * Index scans work a page at a time: we pin and read-lock the page, identify + * all the matching items on the page and save them in BTScanPosData, then + * release the read-lock while returning the items to the caller for + * processing. This approach minimizes lock/unlock traffic. We must always + * drop the lock to make it okay for caller to process the returned items. + * Whether or not we can also release the pin during this window will vary. + * We drop the pin (when so->dropPin) to avoid blocking progress by VACUUM + * (see nbtree/README section about making concurrent TID recycling safe). + * We'll always release both the lock and the pin on the current page before + * moving on to its sibling page. + * + * If we are doing an index-only scan, we save the entire IndexTuple for each + * matched item, otherwise only its heap TID and offset. The IndexTuples go + * into a separate workspace array; each BTScanPosItem stores its tuple's + * offset within that array. Posting list tuples store a "base" tuple once, + * allowing the same key to be returned for each TID in the posting list + * tuple. + */ + +typedef struct BTScanPosItem /* what we remember about each match */ +{ + ItemPointerData heapTid; /* TID of referenced heap item */ + OffsetNumber indexOffset; /* index item's location within page */ + LocationIndex tupleOffset; /* IndexTuple's offset in workspace, if any */ +} BTScanPosItem; + +typedef struct BTScanPosData +{ + Buffer buf; /* currPage buf (invalid means unpinned) */ + + /* page details as of the saved position's call to _bt_readpage */ + BlockNumber currPage; /* page referenced by items array */ + BlockNumber prevPage; /* currPage's left link */ + BlockNumber nextPage; /* currPage's right link */ + XLogRecPtr lsn; /* currPage's LSN (when so->dropPin) */ + + /* scan direction for the saved position's call to _bt_readpage */ + ScanDirection dir; + + /* + * If we are doing an index-only scan, nextTupleOffset is the first free + * location in the associated tuple storage workspace. + */ + int nextTupleOffset; + + /* + * moreLeft and moreRight track whether we think there may be matching + * index entries to the left and right of the current page, respectively. + */ + bool moreLeft; + bool moreRight; + + /* + * The items array is always ordered in index order (ie, increasing + * indexoffset). When scanning backwards it is convenient to fill the + * array back-to-front, so we start at the last slot and fill downwards. + * Hence we need both a first-valid-entry and a last-valid-entry counter. + * itemIndex is a cursor showing which entry was last returned to caller. + */ + int firstItem; /* first valid index in items[] */ + int lastItem; /* last valid index in items[] */ + int itemIndex; /* current index in items[] */ + + BTScanPosItem items[MaxTIDsPerBTreePage]; /* MUST BE LAST */ +} BTScanPosData; + +typedef BTScanPosData *BTScanPos; + +#define BTScanPosIsPinned(scanpos) \ +( \ + AssertMacro(BlockNumberIsValid((scanpos).currPage) || \ + !BufferIsValid((scanpos).buf)), \ + BufferIsValid((scanpos).buf) \ +) +#define BTScanPosUnpin(scanpos) \ + do { \ + ReleaseBuffer((scanpos).buf); \ + (scanpos).buf = InvalidBuffer; \ + } while (0) +#define BTScanPosUnpinIfPinned(scanpos) \ + do { \ + if (BTScanPosIsPinned(scanpos)) \ + BTScanPosUnpin(scanpos); \ + } while (0) + +#define BTScanPosIsValid(scanpos) \ +( \ + AssertMacro(BlockNumberIsValid((scanpos).currPage) || \ + !BufferIsValid((scanpos).buf)), \ + BlockNumberIsValid((scanpos).currPage) \ +) +#define BTScanPosInvalidate(scanpos) \ + do { \ + (scanpos).buf = InvalidBuffer; \ + (scanpos).currPage = InvalidBlockNumber; \ + } while (0) + +/* We need one of these for each equality-type SK_SEARCHARRAY scan key */ +typedef struct BTArrayKeyInfo +{ + /* fields set for both kinds of array (SAOP arrays and skip arrays) */ + int scan_key; /* index of associated key in keyData */ + int num_elems; /* number of elems (-1 means skip array) */ + + /* fields set for ScalarArrayOpExpr arrays only */ + Datum *elem_values; /* array of num_elems Datums */ + int cur_elem; /* index of current element in elem_values */ + + /* fields set for skip arrays only */ + int16 attlen; /* attr's length, in bytes */ + bool attbyval; /* attr's FormData_pg_attribute.attbyval */ + bool null_elem; /* NULL is lowest/highest element? */ + SkipSupport sksup; /* skip support (NULL if opclass lacks it) */ + ScanKey low_compare; /* array's > or >= lower bound */ + ScanKey high_compare; /* array's < or <= upper bound */ +} BTArrayKeyInfo; + +typedef struct BTScanOpaqueData +{ + /* these fields are set by _bt_preprocess_keys(): */ + bool qual_ok; /* false if qual can never be satisfied */ + int numberOfKeys; /* number of preprocessed scan keys */ + ScanKey keyData; /* array of preprocessed scan keys */ + + /* workspace for SK_SEARCHARRAY support */ + int numArrayKeys; /* number of equality-type array keys */ + bool skipScan; /* At least one skip array in arrayKeys[]? */ + bool needPrimScan; /* New prim scan to continue in current dir? */ + bool scanBehind; /* Check scan not still behind on next page? */ + bool oppositeDirCheck; /* scanBehind opposite-scan-dir check? */ + BTArrayKeyInfo *arrayKeys; /* info about each equality-type array key */ + FmgrInfo *orderProcs; /* ORDER procs for required equality keys */ + MemoryContext arrayContext; /* scan-lifespan context for array data */ + + /* info about killed items if any (killedItems is NULL if never used) */ + int *killedItems; /* currPos.items indexes of killed items */ + int numKilled; /* number of currently stored items */ + bool dropPin; /* drop leaf pin before btgettuple returns? */ + + /* + * If we are doing an index-only scan, these are the tuple storage + * workspaces for the currPos and markPos respectively. Each is of size + * BLCKSZ, so it can hold as much as a full page's worth of tuples. + */ + char *currTuples; /* tuple storage for currPos */ + char *markTuples; /* tuple storage for markPos */ + + /* + * If the marked position is on the same page as current position, we + * don't use markPos, but just keep the marked itemIndex in markItemIndex + * (all the rest of currPos is valid for the mark position). Hence, to + * determine if there is a mark, first look at markItemIndex, then at + * markPos. + */ + int markItemIndex; /* itemIndex, or -1 if not valid */ + + /* keep these last in struct for efficiency */ + BTScanPosData currPos; /* current position data */ + BTScanPosData markPos; /* marked position, if any */ +} BTScanOpaqueData; + +typedef BTScanOpaqueData *BTScanOpaque; + +/* + * _bt_readpage state used across _bt_checkkeys calls for a page + */ +typedef struct BTReadPageState +{ + /* Input parameters, set by _bt_readpage for _bt_checkkeys */ + OffsetNumber minoff; /* Lowest non-pivot tuple's offset */ + OffsetNumber maxoff; /* Highest non-pivot tuple's offset */ + IndexTuple finaltup; /* Needed by scans with array keys */ + Page page; /* Page being read */ + bool firstpage; /* page is first for primitive scan? */ + bool forcenonrequired; /* treat all keys as nonrequired? */ + int startikey; /* start comparisons from this scan key */ + + /* Per-tuple input parameters, set by _bt_readpage for _bt_checkkeys */ + OffsetNumber offnum; /* current tuple's page offset number */ + + /* Output parameters, set by _bt_checkkeys for _bt_readpage */ + OffsetNumber skip; /* Array keys "look ahead" skip offnum */ + bool continuescan; /* Terminate ongoing (primitive) index scan? */ + + /* + * Private _bt_checkkeys state used to manage "look ahead" optimization + * and primscan scheduling (only used during scans with array keys) + */ + int16 rechecks; + int16 targetdistance; + int16 nskipadvances; + +} BTReadPageState; + +/* + * We use some private sk_flags bits in preprocessed scan keys. We're allowed + * to use bits 16-31 (see skey.h). The uppermost bits are copied from the + * index's indoption[] array entry for the index attribute. + */ +#define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */ +#define SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */ +#define SK_BT_SKIP 0x00040000 /* skip array on column without input = */ + +/* SK_BT_SKIP-only flags (set and unset by array advancement) */ +#define SK_BT_MINVAL 0x00080000 /* invalid sk_argument, use low_compare */ +#define SK_BT_MAXVAL 0x00100000 /* invalid sk_argument, use high_compare */ +#define SK_BT_NEXT 0x00200000 /* positions the scan > sk_argument */ +#define SK_BT_PRIOR 0x00400000 /* positions the scan < sk_argument */ + +/* Remaps pg_index flag bits to uppermost SK_BT_* byte */ +#define SK_BT_INDOPTION_SHIFT 24 /* must clear the above bits */ +#define SK_BT_DESC (INDOPTION_DESC << SK_BT_INDOPTION_SHIFT) +#define SK_BT_NULLS_FIRST (INDOPTION_NULLS_FIRST << SK_BT_INDOPTION_SHIFT) + +typedef struct BTOptions +{ + int32 varlena_header_; /* varlena header (do not touch directly!) */ + int fillfactor; /* page fill factor in percent (0..100) */ + float8 vacuum_cleanup_index_scale_factor; /* deprecated */ + bool deduplicate_items; /* Try to deduplicate items? */ +} BTOptions; + +#define BTGetFillFactor(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == BTREE_AM_OID), \ + (relation)->rd_options ? \ + ((BTOptions *) (relation)->rd_options)->fillfactor : \ + BTREE_DEFAULT_FILLFACTOR) +#define BTGetTargetPageFreeSpace(relation) \ + (BLCKSZ * (100 - BTGetFillFactor(relation)) / 100) +#define BTGetDeduplicateItems(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == BTREE_AM_OID), \ + ((relation)->rd_options ? \ + ((BTOptions *) (relation)->rd_options)->deduplicate_items : true)) + +/* + * Constant definition for progress reporting. Phase numbers must match + * btbuildphasename. + */ +/* PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE is 1 (see progress.h) */ +#define PROGRESS_BTREE_PHASE_INDEXBUILD_TABLESCAN 2 +#define PROGRESS_BTREE_PHASE_PERFORMSORT_1 3 +#define PROGRESS_BTREE_PHASE_PERFORMSORT_2 4 +#define PROGRESS_BTREE_PHASE_LEAF_LOAD 5 + +/* + * external entry points for btree, in nbtree.c + */ +extern void btbuildempty(Relation index); +extern bool btinsert(Relation rel, Datum *values, bool *isnull, + ItemPointer ht_ctid, Relation heapRel, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); +extern IndexScanDesc btbeginscan(Relation rel, int nkeys, int norderbys); +extern Size btestimateparallelscan(Relation rel, int nkeys, int norderbys); +extern void btinitparallelscan(void *target); +extern bool btgettuple(IndexScanDesc scan, ScanDirection dir); +extern int64 btgetbitmap(IndexScanDesc scan, TIDBitmap *tbm); +extern void btrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, + ScanKey orderbys, int norderbys); +extern void btparallelrescan(IndexScanDesc scan); +extern void btendscan(IndexScanDesc scan); +extern void btmarkpos(IndexScanDesc scan); +extern void btrestrpos(IndexScanDesc scan); +extern IndexBulkDeleteResult *btbulkdelete(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); +extern IndexBulkDeleteResult *btvacuumcleanup(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats); +extern bool btcanreturn(Relation index, int attno); +extern int btgettreeheight(Relation rel); + +extern CompareType bttranslatestrategy(StrategyNumber strategy, Oid opfamily); +extern StrategyNumber bttranslatecmptype(CompareType cmptype, Oid opfamily); + +/* + * prototypes for internal functions in nbtree.c + */ +extern bool _bt_parallel_seize(IndexScanDesc scan, BlockNumber *next_scan_page, + BlockNumber *last_curr_page, bool first); +extern void _bt_parallel_release(IndexScanDesc scan, + BlockNumber next_scan_page, + BlockNumber curr_page); +extern void _bt_parallel_done(IndexScanDesc scan); +extern void _bt_parallel_primscan_schedule(IndexScanDesc scan, + BlockNumber curr_page); + +/* + * prototypes for functions in nbtdedup.c + */ +extern void _bt_dedup_pass(Relation rel, Buffer buf, IndexTuple newitem, + Size newitemsz, bool bottomupdedup); +extern bool _bt_bottomupdel_pass(Relation rel, Buffer buf, Relation heapRel, + Size newitemsz); +extern void _bt_dedup_start_pending(BTDedupState state, IndexTuple base, + OffsetNumber baseoff); +extern bool _bt_dedup_save_htid(BTDedupState state, IndexTuple itup); +extern Size _bt_dedup_finish_pending(Page newpage, BTDedupState state); +extern IndexTuple _bt_form_posting(IndexTuple base, ItemPointer htids, + int nhtids); +extern void _bt_update_posting(BTVacuumPosting vacposting); +extern IndexTuple _bt_swap_posting(IndexTuple newitem, IndexTuple oposting, + int postingoff); + +/* + * prototypes for functions in nbtinsert.c + */ +extern bool _bt_doinsert(Relation rel, IndexTuple itup, + IndexUniqueCheck checkUnique, bool indexUnchanged, + Relation heapRel); +extern void _bt_finish_split(Relation rel, Relation heaprel, Buffer lbuf, + BTStack stack); +extern Buffer _bt_getstackbuf(Relation rel, Relation heaprel, BTStack stack, + BlockNumber child); + +/* + * prototypes for functions in nbtsplitloc.c + */ +extern OffsetNumber _bt_findsplitloc(Relation rel, Page origpage, + OffsetNumber newitemoff, Size newitemsz, IndexTuple newitem, + bool *newitemonleft); + +/* + * prototypes for functions in nbtpage.c + */ +extern void _bt_initmetapage(Page page, BlockNumber rootbknum, uint32 level, + bool allequalimage); +extern bool _bt_vacuum_needs_cleanup(Relation rel); +extern void _bt_set_cleanup_info(Relation rel, BlockNumber num_delpages); +extern void _bt_upgrademetapage(Page page); +extern Buffer _bt_getroot(Relation rel, Relation heaprel, int access); +extern Buffer _bt_gettrueroot(Relation rel); +extern int _bt_getrootheight(Relation rel); +extern void _bt_metaversion(Relation rel, bool *heapkeyspace, + bool *allequalimage); +extern void _bt_checkpage(Relation rel, Buffer buf); +extern Buffer _bt_getbuf(Relation rel, BlockNumber blkno, int access); +extern Buffer _bt_allocbuf(Relation rel, Relation heaprel); +extern Buffer _bt_relandgetbuf(Relation rel, Buffer obuf, + BlockNumber blkno, int access); +extern void _bt_relbuf(Relation rel, Buffer buf); +extern void _bt_lockbuf(Relation rel, Buffer buf, int access); +extern void _bt_unlockbuf(Relation rel, Buffer buf); +extern bool _bt_conditionallockbuf(Relation rel, Buffer buf); +extern void _bt_upgradelockbufcleanup(Relation rel, Buffer buf); +extern void _bt_pageinit(Page page, Size size); +extern void _bt_delitems_vacuum(Relation rel, Buffer buf, + OffsetNumber *deletable, int ndeletable, + BTVacuumPosting *updatable, int nupdatable); +extern void _bt_delitems_delete_check(Relation rel, Buffer buf, + Relation heapRel, + TM_IndexDeleteOp *delstate); +extern void _bt_pagedel(Relation rel, Buffer leafbuf, BTVacState *vstate); +extern void _bt_pendingfsm_init(Relation rel, BTVacState *vstate, + bool cleanuponly); +extern void _bt_pendingfsm_finalize(Relation rel, BTVacState *vstate); + +/* + * prototypes for functions in nbtpreprocesskeys.c + */ +extern void _bt_preprocess_keys(IndexScanDesc scan); + +/* + * prototypes for functions in nbtsearch.c + */ +extern BTStack _bt_search(Relation rel, Relation heaprel, BTScanInsert key, + Buffer *bufP, int access); +extern OffsetNumber _bt_binsrch_insert(Relation rel, BTInsertState insertstate); +extern int32 _bt_compare(Relation rel, BTScanInsert key, Page page, OffsetNumber offnum); +extern bool _bt_first(IndexScanDesc scan, ScanDirection dir); +extern bool _bt_next(IndexScanDesc scan, ScanDirection dir); +extern Buffer _bt_get_endpoint(Relation rel, uint32 level, bool rightmost); + +/* + * prototypes for functions in nbtutils.c + */ +extern BTScanInsert _bt_mkscankey(Relation rel, IndexTuple itup); +extern void _bt_freestack(BTStack stack); +extern bool _bt_start_prim_scan(IndexScanDesc scan, ScanDirection dir); +extern int _bt_binsrch_array_skey(FmgrInfo *orderproc, + bool cur_elem_trig, ScanDirection dir, + Datum tupdatum, bool tupnull, + BTArrayKeyInfo *array, ScanKey cur, + int32 *set_elem_result); +extern void _bt_start_array_keys(IndexScanDesc scan, ScanDirection dir); +extern bool _bt_checkkeys(IndexScanDesc scan, BTReadPageState *pstate, bool arrayKeys, + IndexTuple tuple, int tupnatts); +extern bool _bt_scanbehind_checkkeys(IndexScanDesc scan, ScanDirection dir, + IndexTuple finaltup); +extern void _bt_set_startikey(IndexScanDesc scan, BTReadPageState *pstate); +extern void _bt_killitems(IndexScanDesc scan); +extern BTCycleId _bt_vacuum_cycleid(Relation rel); +extern BTCycleId _bt_start_vacuum(Relation rel); +extern void _bt_end_vacuum(Relation rel); +extern void _bt_end_vacuum_callback(int code, Datum arg); +extern Size BTreeShmemSize(void); +extern void BTreeShmemInit(void); +extern bytea *btoptions(Datum reloptions, bool validate); +extern bool btproperty(Oid index_oid, int attno, + IndexAMProperty prop, const char *propname, + bool *res, bool *isnull); +extern char *btbuildphasename(int64 phasenum); +extern IndexTuple _bt_truncate(Relation rel, IndexTuple lastleft, + IndexTuple firstright, BTScanInsert itup_key); +extern int _bt_keep_natts_fast(Relation rel, IndexTuple lastleft, + IndexTuple firstright); +extern bool _bt_check_natts(Relation rel, bool heapkeyspace, Page page, + OffsetNumber offnum); +extern void _bt_check_third_page(Relation rel, Relation heap, + bool needheaptidspace, Page page, IndexTuple newtup); +extern bool _bt_allequalimage(Relation rel, bool debugmessage); + +/* + * prototypes for functions in nbtvalidate.c + */ +extern bool btvalidate(Oid opclassoid); +extern void btadjustmembers(Oid opfamilyoid, + Oid opclassoid, + List *operators, + List *functions); + +/* + * prototypes for functions in nbtsort.c + */ +extern IndexBuildResult *btbuild(Relation heap, Relation index, + struct IndexInfo *indexInfo); +extern void _bt_parallel_build_main(dsm_segment *seg, shm_toc *toc); + +#endif /* NBTREE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/nbtxlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/nbtxlog.h new file mode 100644 index 0000000..fbbe115 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/nbtxlog.h @@ -0,0 +1,367 @@ +/*------------------------------------------------------------------------- + * + * nbtxlog.h + * header file for postgres btree xlog routines + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/nbtxlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef NBTXLOG_H +#define NBTXLOG_H + +#include "access/transam.h" +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/off.h" + +/* + * XLOG records for btree operations + * + * XLOG allows to store some information in high 4 bits of log + * record xl_info field + */ +#define XLOG_BTREE_INSERT_LEAF 0x00 /* add index tuple without split */ +#define XLOG_BTREE_INSERT_UPPER 0x10 /* same, on a non-leaf page */ +#define XLOG_BTREE_INSERT_META 0x20 /* same, plus update metapage */ +#define XLOG_BTREE_SPLIT_L 0x30 /* add index tuple with split */ +#define XLOG_BTREE_SPLIT_R 0x40 /* as above, new item on right */ +#define XLOG_BTREE_INSERT_POST 0x50 /* add index tuple with posting split */ +#define XLOG_BTREE_DEDUP 0x60 /* deduplicate tuples for a page */ +#define XLOG_BTREE_DELETE 0x70 /* delete leaf index tuples for a page */ +#define XLOG_BTREE_UNLINK_PAGE 0x80 /* delete a half-dead page */ +#define XLOG_BTREE_UNLINK_PAGE_META 0x90 /* same, and update metapage */ +#define XLOG_BTREE_NEWROOT 0xA0 /* new root page */ +#define XLOG_BTREE_MARK_PAGE_HALFDEAD 0xB0 /* mark a leaf as half-dead */ +#define XLOG_BTREE_VACUUM 0xC0 /* delete entries on a page during + * vacuum */ +#define XLOG_BTREE_REUSE_PAGE 0xD0 /* old page is about to be reused from + * FSM */ +#define XLOG_BTREE_META_CLEANUP 0xE0 /* update cleanup-related data in the + * metapage */ + +/* + * All that we need to regenerate the meta-data page + */ +typedef struct xl_btree_metadata +{ + uint32 version; + BlockNumber root; + uint32 level; + BlockNumber fastroot; + uint32 fastlevel; + uint32 last_cleanup_num_delpages; + bool allequalimage; +} xl_btree_metadata; + +/* + * This is what we need to know about simple (without split) insert. + * + * This data record is used for INSERT_LEAF, INSERT_UPPER, INSERT_META, and + * INSERT_POST. Note that INSERT_META and INSERT_UPPER implies it's not a + * leaf page, while INSERT_POST and INSERT_LEAF imply that it must be a leaf + * page. + * + * Backup Blk 0: original page + * Backup Blk 1: child's left sibling, if INSERT_UPPER or INSERT_META + * Backup Blk 2: xl_btree_metadata, if INSERT_META + * + * Note: The new tuple is actually the "original" new item in the posting + * list split insert case (i.e. the INSERT_POST case). A split offset for + * the posting list is logged before the original new item. Recovery needs + * both, since it must do an in-place update of the existing posting list + * that was split as an extra step. Also, recovery generates a "final" + * newitem. See _bt_swap_posting() for details on posting list splits. + */ +typedef struct xl_btree_insert +{ + OffsetNumber offnum; + + /* POSTING SPLIT OFFSET FOLLOWS (INSERT_POST case) */ + /* NEW TUPLE ALWAYS FOLLOWS AT THE END */ +} xl_btree_insert; + +#define SizeOfBtreeInsert (offsetof(xl_btree_insert, offnum) + sizeof(OffsetNumber)) + +/* + * On insert with split, we save all the items going into the right sibling + * so that we can restore it completely from the log record. This way takes + * less xlog space than the normal approach, because if we did it standardly, + * XLogInsert would almost always think the right page is new and store its + * whole page image. The left page, however, is handled in the normal + * incremental-update fashion. + * + * Note: XLOG_BTREE_SPLIT_L and XLOG_BTREE_SPLIT_R share this data record. + * There are two variants to indicate whether the inserted tuple went into the + * left or right split page (and thus, whether the new item is stored or not). + * We always log the left page high key because suffix truncation can generate + * a new leaf high key using user-defined code. This is also necessary on + * internal pages, since the firstright item that the left page's high key was + * based on will have been truncated to zero attributes in the right page (the + * separator key is unavailable from the right page). + * + * Backup Blk 0: original page / new left page + * + * The left page's data portion contains the new item, if it's the _L variant. + * _R variant split records generally do not have a newitem (_R variant leaf + * page split records that must deal with a posting list split will include an + * explicit newitem, though it is never used on the right page -- it is + * actually an orignewitem needed to update existing posting list). The new + * high key of the left/original page appears last of all (and must always be + * present). + * + * Page split records that need the REDO routine to deal with a posting list + * split directly will have an explicit newitem, which is actually an + * orignewitem (the newitem as it was before the posting list split, not + * after). A posting list split always has a newitem that comes immediately + * after the posting list being split (which would have overlapped with + * orignewitem prior to split). Usually REDO must deal with posting list + * splits with an _L variant page split record, and usually both the new + * posting list and the final newitem go on the left page (the existing + * posting list will be inserted instead of the old, and the final newitem + * will be inserted next to that). However, _R variant split records will + * include an orignewitem when the split point for the page happens to have a + * lastleft tuple that is also the posting list being split (leaving newitem + * as the page split's firstright tuple). The existence of this corner case + * does not change the basic fact about newitem/orignewitem for the REDO + * routine: it is always state used for the left page alone. (This is why the + * record's postingoff field isn't a reliable indicator of whether or not a + * posting list split occurred during the page split; a non-zero value merely + * indicates that the REDO routine must reconstruct a new posting list tuple + * that is needed for the left page.) + * + * This posting list split handling is equivalent to the xl_btree_insert REDO + * routine's INSERT_POST handling. While the details are more complicated + * here, the concept and goals are exactly the same. See _bt_swap_posting() + * for details on posting list splits. + * + * Backup Blk 1: new right page + * + * The right page's data portion contains the right page's tuples in the form + * used by _bt_restore_page. This includes the new item, if it's the _R + * variant. The right page's tuples also include the right page's high key + * with either variant (moved from the left/original page during the split), + * unless the split happened to be of the rightmost page on its level, where + * there is no high key for new right page. + * + * Backup Blk 2: next block (orig page's rightlink), if any + * Backup Blk 3: child's left sibling, if non-leaf split + */ +typedef struct xl_btree_split +{ + uint32 level; /* tree level of page being split */ + OffsetNumber firstrightoff; /* first origpage item on rightpage */ + OffsetNumber newitemoff; /* new item's offset */ + uint16 postingoff; /* offset inside orig posting tuple */ +} xl_btree_split; + +#define SizeOfBtreeSplit (offsetof(xl_btree_split, postingoff) + sizeof(uint16)) + +/* + * When page is deduplicated, consecutive groups of tuples with equal keys are + * merged together into posting list tuples. + * + * The WAL record represents a deduplication pass for a leaf page. An array + * of BTDedupInterval structs follows. + */ +typedef struct xl_btree_dedup +{ + uint16 nintervals; + + /* DEDUPLICATION INTERVALS FOLLOW */ +} xl_btree_dedup; + +#define SizeOfBtreeDedup (offsetof(xl_btree_dedup, nintervals) + sizeof(uint16)) + +/* + * This is what we need to know about page reuse within btree. This record + * only exists to generate a conflict point for Hot Standby. + * + * Note that we must include a RelFileLocator in the record because we don't + * actually register the buffer with the record. + */ +typedef struct xl_btree_reuse_page +{ + RelFileLocator locator; + BlockNumber block; + FullTransactionId snapshotConflictHorizon; + bool isCatalogRel; /* to handle recovery conflict during logical + * decoding on standby */ +} xl_btree_reuse_page; + +#define SizeOfBtreeReusePage (offsetof(xl_btree_reuse_page, isCatalogRel) + sizeof(bool)) + +/* + * xl_btree_vacuum and xl_btree_delete records describe deletion of index + * tuples on a leaf page. The former variant is used by VACUUM, while the + * latter variant is used by the ad-hoc deletions that sometimes take place + * when btinsert() is called. + * + * The records are very similar. The only difference is that xl_btree_delete + * have snapshotConflictHorizon/isCatalogRel fields for recovery conflicts. + * (VACUUM operations can just rely on earlier conflicts generated during + * pruning of the table whose TIDs the to-be-deleted index tuples point to. + * There are also small differences between each REDO routine that we don't go + * into here.) + * + * xl_btree_vacuum and xl_btree_delete both represent deletion of any number + * of index tuples on a single leaf page using page offset numbers. Both also + * support "updates" of index tuples, which is how deletes of a subset of TIDs + * contained in an existing posting list tuple are implemented. + * + * Updated posting list tuples are represented using xl_btree_update metadata. + * The REDO routines each use the xl_btree_update entries (plus each + * corresponding original index tuple from the target leaf page) to generate + * the final updated tuple. + * + * Updates are only used when there will be some remaining TIDs left by the + * REDO routine. Otherwise the posting list tuple just gets deleted outright. + */ +typedef struct xl_btree_vacuum +{ + uint16 ndeleted; + uint16 nupdated; + + /*---- + * In payload of blk 0 : + * - DELETED TARGET OFFSET NUMBERS + * - UPDATED TARGET OFFSET NUMBERS + * - UPDATED TUPLES METADATA (xl_btree_update) ITEMS + *---- + */ +} xl_btree_vacuum; + +#define SizeOfBtreeVacuum (offsetof(xl_btree_vacuum, nupdated) + sizeof(uint16)) + +typedef struct xl_btree_delete +{ + TransactionId snapshotConflictHorizon; + uint16 ndeleted; + uint16 nupdated; + bool isCatalogRel; /* to handle recovery conflict during logical + * decoding on standby */ + + /*---- + * In payload of blk 0 : + * - DELETED TARGET OFFSET NUMBERS + * - UPDATED TARGET OFFSET NUMBERS + * - UPDATED TUPLES METADATA (xl_btree_update) ITEMS + *---- + */ +} xl_btree_delete; + +#define SizeOfBtreeDelete (offsetof(xl_btree_delete, isCatalogRel) + sizeof(bool)) + +/* + * The offsets that appear in xl_btree_update metadata are offsets into the + * original posting list from tuple, not page offset numbers. These are + * 0-based. The page offset number for the original posting list tuple comes + * from the main xl_btree_vacuum/xl_btree_delete record. + */ +typedef struct xl_btree_update +{ + uint16 ndeletedtids; + + /* POSTING LIST uint16 OFFSETS TO A DELETED TID FOLLOW */ +} xl_btree_update; + +#define SizeOfBtreeUpdate (offsetof(xl_btree_update, ndeletedtids) + sizeof(uint16)) + +/* + * This is what we need to know about marking an empty subtree for deletion. + * The target identifies the tuple removed from the parent page (note that we + * remove this tuple's downlink and the *following* tuple's key). Note that + * the leaf page is empty, so we don't need to store its content --- it is + * just reinitialized during recovery using the rest of the fields. + * + * Backup Blk 0: leaf block + * Backup Blk 1: top parent + */ +typedef struct xl_btree_mark_page_halfdead +{ + OffsetNumber poffset; /* deleted tuple id in parent page */ + + /* information needed to recreate the leaf page: */ + BlockNumber leafblk; /* leaf block ultimately being deleted */ + BlockNumber leftblk; /* leaf block's left sibling, if any */ + BlockNumber rightblk; /* leaf block's right sibling */ + BlockNumber topparent; /* topmost internal page in the subtree */ +} xl_btree_mark_page_halfdead; + +#define SizeOfBtreeMarkPageHalfDead (offsetof(xl_btree_mark_page_halfdead, topparent) + sizeof(BlockNumber)) + +/* + * This is what we need to know about deletion of a btree page. Note that we + * only leave behind a small amount of bookkeeping information in deleted + * pages (deleted pages must be kept around as tombstones for a while). It is + * convenient for the REDO routine to regenerate its target page from scratch. + * This is why WAL record describes certain details that are actually directly + * available from the target page. + * + * Backup Blk 0: target block being deleted + * Backup Blk 1: target block's left sibling, if any + * Backup Blk 2: target block's right sibling + * Backup Blk 3: leaf block (if different from target) + * Backup Blk 4: metapage (if rightsib becomes new fast root) + */ +typedef struct xl_btree_unlink_page +{ + BlockNumber leftsib; /* target block's left sibling, if any */ + BlockNumber rightsib; /* target block's right sibling */ + uint32 level; /* target block's level */ + FullTransactionId safexid; /* target block's BTPageSetDeleted() XID */ + + /* + * Information needed to recreate a half-dead leaf page with correct + * topparent link. The fields are only used when deletion operation's + * target page is an internal page. REDO routine creates half-dead page + * from scratch to keep things simple (this is the same convenient + * approach used for the target page itself). + */ + BlockNumber leafleftsib; + BlockNumber leafrightsib; + BlockNumber leaftopparent; /* next child down in the subtree */ + + /* xl_btree_metadata FOLLOWS IF XLOG_BTREE_UNLINK_PAGE_META */ +} xl_btree_unlink_page; + +#define SizeOfBtreeUnlinkPage (offsetof(xl_btree_unlink_page, leaftopparent) + sizeof(BlockNumber)) + +/* + * New root log record. There are zero tuples if this is to establish an + * empty root, or two if it is the result of splitting an old root. + * + * Note that although this implies rewriting the metadata page, we don't need + * an xl_btree_metadata record --- the rootblk and level are sufficient. + * + * Backup Blk 0: new root page (2 tuples as payload, if splitting old root) + * Backup Blk 1: left child (if splitting an old root) + * Backup Blk 2: metapage + */ +typedef struct xl_btree_newroot +{ + BlockNumber rootblk; /* location of new root (redundant with blk 0) */ + uint32 level; /* its tree level */ +} xl_btree_newroot; + +#define SizeOfBtreeNewroot (offsetof(xl_btree_newroot, level) + sizeof(uint32)) + + +/* + * prototypes for functions in nbtxlog.c + */ +extern void btree_redo(XLogReaderState *record); +extern void btree_xlog_startup(void); +extern void btree_xlog_cleanup(void); +extern void btree_mask(char *pagedata, BlockNumber blkno); + +/* + * prototypes for functions in nbtdesc.c + */ +extern void btree_desc(StringInfo buf, XLogReaderState *record); +extern const char *btree_identify(uint8 info); + +#endif /* NBTXLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/parallel.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/parallel.h new file mode 100644 index 0000000..f37be6d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/parallel.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------------------- + * + * parallel.h + * Infrastructure for launching parallel workers + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/parallel.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PARALLEL_H +#define PARALLEL_H + +#include "access/xlogdefs.h" +#include "lib/ilist.h" +#include "postmaster/bgworker.h" +#include "storage/shm_mq.h" +#include "storage/shm_toc.h" + +typedef void (*parallel_worker_main_type) (dsm_segment *seg, shm_toc *toc); + +typedef struct ParallelWorkerInfo +{ + BackgroundWorkerHandle *bgwhandle; + shm_mq_handle *error_mqh; +} ParallelWorkerInfo; + +typedef struct ParallelContext +{ + dlist_node node; + SubTransactionId subid; + int nworkers; /* Maximum number of workers to launch */ + int nworkers_to_launch; /* Actual number of workers to launch */ + int nworkers_launched; + char *library_name; + char *function_name; + ErrorContextCallback *error_context_stack; + shm_toc_estimator estimator; + dsm_segment *seg; + void *private_memory; + shm_toc *toc; + ParallelWorkerInfo *worker; + int nknown_attached_workers; + bool *known_attached_workers; +} ParallelContext; + +typedef struct ParallelWorkerContext +{ + dsm_segment *seg; + shm_toc *toc; +} ParallelWorkerContext; + +extern PGDLLIMPORT volatile sig_atomic_t ParallelMessagePending; +extern PGDLLIMPORT int ParallelWorkerNumber; +extern PGDLLIMPORT bool InitializingParallelWorker; + +#define IsParallelWorker() (ParallelWorkerNumber >= 0) + +extern ParallelContext *CreateParallelContext(const char *library_name, + const char *function_name, int nworkers); +extern void InitializeParallelDSM(ParallelContext *pcxt); +extern void ReinitializeParallelDSM(ParallelContext *pcxt); +extern void ReinitializeParallelWorkers(ParallelContext *pcxt, int nworkers_to_launch); +extern void LaunchParallelWorkers(ParallelContext *pcxt); +extern void WaitForParallelWorkersToAttach(ParallelContext *pcxt); +extern void WaitForParallelWorkersToFinish(ParallelContext *pcxt); +extern void DestroyParallelContext(ParallelContext *pcxt); +extern bool ParallelContextActive(void); + +extern void HandleParallelMessageInterrupt(void); +extern void ProcessParallelMessages(void); +extern void AtEOXact_Parallel(bool isCommit); +extern void AtEOSubXact_Parallel(bool isCommit, SubTransactionId mySubId); +extern void ParallelWorkerReportLastRecEnd(XLogRecPtr last_xlog_end); + +extern void ParallelWorkerMain(Datum main_arg); + +#endif /* PARALLEL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/printsimple.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/printsimple.h new file mode 100644 index 0000000..760d148 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/printsimple.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * printsimple.h + * print simple tuples without catalog access + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/printsimple.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PRINTSIMPLE_H +#define PRINTSIMPLE_H + +#include "tcop/dest.h" + +extern bool printsimple(TupleTableSlot *slot, DestReceiver *self); +extern void printsimple_startup(DestReceiver *self, int operation, + TupleDesc tupdesc); + +#endif /* PRINTSIMPLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/printtup.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/printtup.h new file mode 100644 index 0000000..b9bca20 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/printtup.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * printtup.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/printtup.h + * + *------------------------------------------------------------------------- + */ +#ifndef PRINTTUP_H +#define PRINTTUP_H + +#include "utils/portal.h" + +extern DestReceiver *printtup_create_DR(CommandDest dest); + +extern void SetRemoteDestReceiverParams(DestReceiver *self, Portal portal); + +extern void SendRowDescriptionMessage(StringInfo buf, + TupleDesc typeinfo, List *targetlist, int16 *formats); + +extern void debugStartup(DestReceiver *self, int operation, + TupleDesc typeinfo); +extern bool debugtup(TupleTableSlot *slot, DestReceiver *self); + +/* XXX these are really in executor/spi.c */ +extern void spi_dest_startup(DestReceiver *self, int operation, + TupleDesc typeinfo); +extern bool spi_printtup(TupleTableSlot *slot, DestReceiver *self); + +#endif /* PRINTTUP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/relation.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/relation.h new file mode 100644 index 0000000..79b0198 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/relation.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * relation.h + * Generic relation related routines. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/relation.h + * + *------------------------------------------------------------------------- + */ +#ifndef ACCESS_RELATION_H +#define ACCESS_RELATION_H + +#include "nodes/primnodes.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" + +extern Relation relation_open(Oid relationId, LOCKMODE lockmode); +extern Relation try_relation_open(Oid relationId, LOCKMODE lockmode); +extern Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode); +extern Relation relation_openrv_extended(const RangeVar *relation, + LOCKMODE lockmode, bool missing_ok); +extern void relation_close(Relation relation, LOCKMODE lockmode); + +#endif /* ACCESS_RELATION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/reloptions.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/reloptions.h new file mode 100644 index 0000000..dfbb4c8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/reloptions.h @@ -0,0 +1,260 @@ +/*------------------------------------------------------------------------- + * + * reloptions.h + * Core support for relation and tablespace options (pg_class.reloptions + * and pg_tablespace.spcoptions) + * + * Note: the functions dealing with text-array reloptions values declare + * them as Datum, not ArrayType *, to avoid needing to include array.h + * into a lot of low-level code. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/reloptions.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELOPTIONS_H +#define RELOPTIONS_H + +#include "access/amapi.h" +#include "access/htup.h" +#include "access/tupdesc.h" +#include "nodes/pg_list.h" +#include "storage/lock.h" + +/* types supported by reloptions */ +typedef enum relopt_type +{ + RELOPT_TYPE_BOOL, + RELOPT_TYPE_INT, + RELOPT_TYPE_REAL, + RELOPT_TYPE_ENUM, + RELOPT_TYPE_STRING, +} relopt_type; + +/* kinds supported by reloptions */ +typedef enum relopt_kind +{ + RELOPT_KIND_LOCAL = 0, + RELOPT_KIND_HEAP = (1 << 0), + RELOPT_KIND_TOAST = (1 << 1), + RELOPT_KIND_BTREE = (1 << 2), + RELOPT_KIND_HASH = (1 << 3), + RELOPT_KIND_GIN = (1 << 4), + RELOPT_KIND_GIST = (1 << 5), + RELOPT_KIND_ATTRIBUTE = (1 << 6), + RELOPT_KIND_TABLESPACE = (1 << 7), + RELOPT_KIND_SPGIST = (1 << 8), + RELOPT_KIND_VIEW = (1 << 9), + RELOPT_KIND_BRIN = (1 << 10), + RELOPT_KIND_PARTITIONED = (1 << 11), + /* if you add a new kind, make sure you update "last_default" too */ + RELOPT_KIND_LAST_DEFAULT = RELOPT_KIND_PARTITIONED, + /* some compilers treat enums as signed ints, so we can't use 1 << 31 */ + RELOPT_KIND_MAX = (1 << 30) +} relopt_kind; + +/* reloption namespaces allowed for heaps -- currently only TOAST */ +#define HEAP_RELOPT_NAMESPACES { "toast", NULL } + +/* generic struct to hold shared data */ +typedef struct relopt_gen +{ + const char *name; /* must be first (used as list termination + * marker) */ + const char *desc; + bits32 kinds; + LOCKMODE lockmode; + int namelen; + relopt_type type; +} relopt_gen; + +/* holds a parsed value */ +typedef struct relopt_value +{ + relopt_gen *gen; + bool isset; + union + { + bool bool_val; + int int_val; + double real_val; + int enum_val; + char *string_val; /* allocated separately */ + } values; +} relopt_value; + +/* reloptions records for specific variable types */ +typedef struct relopt_bool +{ + relopt_gen gen; + bool default_val; +} relopt_bool; + +typedef struct relopt_int +{ + relopt_gen gen; + int default_val; + int min; + int max; +} relopt_int; + +typedef struct relopt_real +{ + relopt_gen gen; + double default_val; + double min; + double max; +} relopt_real; + +/* + * relopt_enum_elt_def -- One member of the array of acceptable values + * of an enum reloption. + */ +typedef struct relopt_enum_elt_def +{ + const char *string_val; + int symbol_val; +} relopt_enum_elt_def; + +typedef struct relopt_enum +{ + relopt_gen gen; + relopt_enum_elt_def *members; + int default_val; + const char *detailmsg; + /* null-terminated array of members */ +} relopt_enum; + +/* validation routines for strings */ +typedef void (*validate_string_relopt) (const char *value); +typedef Size (*fill_string_relopt) (const char *value, void *ptr); + +/* validation routine for the whole option set */ +typedef void (*relopts_validator) (void *parsed_options, relopt_value *vals, int nvals); + +typedef struct relopt_string +{ + relopt_gen gen; + int default_len; + bool default_isnull; + validate_string_relopt validate_cb; + fill_string_relopt fill_cb; + char *default_val; +} relopt_string; + +/* This is the table datatype for build_reloptions() */ +typedef struct +{ + const char *optname; /* option's name */ + relopt_type opttype; /* option's datatype */ + int offset; /* offset of field in result struct */ + + /* + * isset_offset is an optional offset of a field in the result struct that + * stores whether the option is explicitly set for the relation or if it + * just picked up the default value. In most cases, this can be + * accomplished by giving the reloption a special out-of-range default + * value (e.g., some integer reloptions use -2), but this isn't always + * possible. For example, a Boolean reloption cannot be given an + * out-of-range default, so we need another way to discover the source of + * its value. This offset is only used if given a value greater than + * zero. + */ + int isset_offset; +} relopt_parse_elt; + +/* Local reloption definition */ +typedef struct local_relopt +{ + relopt_gen *option; /* option definition */ + int offset; /* offset of parsed value in bytea structure */ +} local_relopt; + +/* Structure to hold local reloption data for build_local_reloptions() */ +typedef struct local_relopts +{ + List *options; /* list of local_relopt definitions */ + List *validators; /* list of relopts_validator callbacks */ + Size relopt_struct_size; /* size of parsed bytea structure */ +} local_relopts; + +/* + * Utility macro to get a value for a string reloption once the options + * are parsed. This gets a pointer to the string value itself. "optstruct" + * is the StdRdOptions struct or equivalent, "member" is the struct member + * corresponding to the string option. + */ +#define GET_STRING_RELOPTION(optstruct, member) \ + ((optstruct)->member == 0 ? NULL : \ + (char *)(optstruct) + (optstruct)->member) + +extern relopt_kind add_reloption_kind(void); +extern void add_bool_reloption(bits32 kinds, const char *name, const char *desc, + bool default_val, LOCKMODE lockmode); +extern void add_int_reloption(bits32 kinds, const char *name, const char *desc, + int default_val, int min_val, int max_val, + LOCKMODE lockmode); +extern void add_real_reloption(bits32 kinds, const char *name, const char *desc, + double default_val, double min_val, double max_val, + LOCKMODE lockmode); +extern void add_enum_reloption(bits32 kinds, const char *name, const char *desc, + relopt_enum_elt_def *members, int default_val, + const char *detailmsg, LOCKMODE lockmode); +extern void add_string_reloption(bits32 kinds, const char *name, const char *desc, + const char *default_val, validate_string_relopt validator, + LOCKMODE lockmode); + +extern void init_local_reloptions(local_relopts *relopts, Size relopt_struct_size); +extern void register_reloptions_validator(local_relopts *relopts, + relopts_validator validator); +extern void add_local_bool_reloption(local_relopts *relopts, const char *name, + const char *desc, bool default_val, + int offset); +extern void add_local_int_reloption(local_relopts *relopts, const char *name, + const char *desc, int default_val, + int min_val, int max_val, int offset); +extern void add_local_real_reloption(local_relopts *relopts, const char *name, + const char *desc, double default_val, + double min_val, double max_val, + int offset); +extern void add_local_enum_reloption(local_relopts *relopts, + const char *name, const char *desc, + relopt_enum_elt_def *members, + int default_val, const char *detailmsg, + int offset); +extern void add_local_string_reloption(local_relopts *relopts, const char *name, + const char *desc, + const char *default_val, + validate_string_relopt validator, + fill_string_relopt filler, int offset); + +extern Datum transformRelOptions(Datum oldOptions, List *defList, + const char *namspace, const char *const validnsps[], + bool acceptOidsOff, bool isReset); +extern List *untransformRelOptions(Datum options); +extern bytea *extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, + amoptions_function amoptions); +extern void *build_reloptions(Datum reloptions, bool validate, + relopt_kind kind, + Size relopt_struct_size, + const relopt_parse_elt *relopt_elems, + int num_relopt_elems); +extern void *build_local_reloptions(local_relopts *relopts, Datum options, + bool validate); + +extern bytea *default_reloptions(Datum reloptions, bool validate, + relopt_kind kind); +extern bytea *heap_reloptions(char relkind, Datum reloptions, bool validate); +extern bytea *view_reloptions(Datum reloptions, bool validate); +extern bytea *partitioned_table_reloptions(Datum reloptions, bool validate); +extern bytea *index_reloptions(amoptions_function amoptions, Datum reloptions, + bool validate); +extern bytea *attribute_reloptions(Datum reloptions, bool validate); +extern bytea *tablespace_reloptions(Datum reloptions, bool validate); +extern LOCKMODE AlterTableGetRelOptionsLockLevel(List *defList); + +#endif /* RELOPTIONS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/relscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/relscan.h new file mode 100644 index 0000000..b5e0fb3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/relscan.h @@ -0,0 +1,217 @@ +/*------------------------------------------------------------------------- + * + * relscan.h + * POSTGRES relation scan descriptor definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/relscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELSCAN_H +#define RELSCAN_H + +#include "access/htup_details.h" +#include "access/itup.h" +#include "nodes/tidbitmap.h" +#include "port/atomics.h" +#include "storage/buf.h" +#include "storage/relfilelocator.h" +#include "storage/spin.h" +#include "utils/relcache.h" + + +struct ParallelTableScanDescData; + +/* + * Generic descriptor for table scans. This is the base-class for table scans, + * which needs to be embedded in the scans of individual AMs. + */ +typedef struct TableScanDescData +{ + /* scan parameters */ + Relation rs_rd; /* heap relation descriptor */ + struct SnapshotData *rs_snapshot; /* snapshot to see */ + int rs_nkeys; /* number of scan keys */ + struct ScanKeyData *rs_key; /* array of scan key descriptors */ + + /* + * Scan type-specific members + */ + union + { + /* Iterator for Bitmap Table Scans */ + TBMIterator rs_tbmiterator; + + /* + * Range of ItemPointers for table_scan_getnextslot_tidrange() to + * scan. + */ + struct + { + ItemPointerData rs_mintid; + ItemPointerData rs_maxtid; + } tidrange; + } st; + + /* + * Information about type and behaviour of the scan, a bitmask of members + * of the ScanOptions enum (see tableam.h). + */ + uint32 rs_flags; + + struct ParallelTableScanDescData *rs_parallel; /* parallel scan + * information */ +} TableScanDescData; +typedef struct TableScanDescData *TableScanDesc; + +/* + * Shared state for parallel table scan. + * + * Each backend participating in a parallel table scan has its own + * TableScanDesc in backend-private memory, and those objects all contain a + * pointer to this structure. The information here must be sufficient to + * properly initialize each new TableScanDesc as workers join the scan, and it + * must act as a information what to scan for those workers. + */ +typedef struct ParallelTableScanDescData +{ + RelFileLocator phs_locator; /* physical relation to scan */ + bool phs_syncscan; /* report location to syncscan logic? */ + bool phs_snapshot_any; /* SnapshotAny, not phs_snapshot_data? */ + Size phs_snapshot_off; /* data for snapshot */ +} ParallelTableScanDescData; +typedef struct ParallelTableScanDescData *ParallelTableScanDesc; + +/* + * Shared state for parallel table scans, for block oriented storage. + */ +typedef struct ParallelBlockTableScanDescData +{ + ParallelTableScanDescData base; + + BlockNumber phs_nblocks; /* # blocks in relation at start of scan */ + slock_t phs_mutex; /* mutual exclusion for setting startblock */ + BlockNumber phs_startblock; /* starting block number */ + pg_atomic_uint64 phs_nallocated; /* number of blocks allocated to + * workers so far. */ +} ParallelBlockTableScanDescData; +typedef struct ParallelBlockTableScanDescData *ParallelBlockTableScanDesc; + +/* + * Per backend state for parallel table scan, for block-oriented storage. + */ +typedef struct ParallelBlockTableScanWorkerData +{ + uint64 phsw_nallocated; /* Current # of blocks into the scan */ + uint32 phsw_chunk_remaining; /* # blocks left in this chunk */ + uint32 phsw_chunk_size; /* The number of blocks to allocate in + * each I/O chunk for the scan */ +} ParallelBlockTableScanWorkerData; +typedef struct ParallelBlockTableScanWorkerData *ParallelBlockTableScanWorker; + +/* + * Base class for fetches from a table via an index. This is the base-class + * for such scans, which needs to be embedded in the respective struct for + * individual AMs. + */ +typedef struct IndexFetchTableData +{ + Relation rel; +} IndexFetchTableData; + +struct IndexScanInstrumentation; + +/* + * We use the same IndexScanDescData structure for both amgettuple-based + * and amgetbitmap-based index scans. Some fields are only relevant in + * amgettuple-based scans. + */ +typedef struct IndexScanDescData +{ + /* scan parameters */ + Relation heapRelation; /* heap relation descriptor, or NULL */ + Relation indexRelation; /* index relation descriptor */ + struct SnapshotData *xs_snapshot; /* snapshot to see */ + int numberOfKeys; /* number of index qualifier conditions */ + int numberOfOrderBys; /* number of ordering operators */ + struct ScanKeyData *keyData; /* array of index qualifier descriptors */ + struct ScanKeyData *orderByData; /* array of ordering op descriptors */ + bool xs_want_itup; /* caller requests index tuples */ + bool xs_temp_snap; /* unregister snapshot at scan end? */ + + /* signaling to index AM about killing index tuples */ + bool kill_prior_tuple; /* last-returned tuple is dead */ + bool ignore_killed_tuples; /* do not return killed entries */ + bool xactStartedInRecovery; /* prevents killing/seeing killed + * tuples */ + + /* index access method's private state */ + void *opaque; /* access-method-specific info */ + + /* + * Instrumentation counters maintained by all index AMs during both + * amgettuple calls and amgetbitmap calls (unless field remains NULL) + */ + struct IndexScanInstrumentation *instrument; + + /* + * In an index-only scan, a successful amgettuple call must fill either + * xs_itup (and xs_itupdesc) or xs_hitup (and xs_hitupdesc) to provide the + * data returned by the scan. It can fill both, in which case the heap + * format will be used. + */ + IndexTuple xs_itup; /* index tuple returned by AM */ + struct TupleDescData *xs_itupdesc; /* rowtype descriptor of xs_itup */ + HeapTuple xs_hitup; /* index data returned by AM, as HeapTuple */ + struct TupleDescData *xs_hitupdesc; /* rowtype descriptor of xs_hitup */ + + ItemPointerData xs_heaptid; /* result */ + bool xs_heap_continue; /* T if must keep walking, potential + * further results */ + IndexFetchTableData *xs_heapfetch; + + bool xs_recheck; /* T means scan keys must be rechecked */ + + /* + * When fetching with an ordering operator, the values of the ORDER BY + * expressions of the last returned tuple, according to the index. If + * xs_recheckorderby is true, these need to be rechecked just like the + * scan keys, and the values returned here are a lower-bound on the actual + * values. + */ + Datum *xs_orderbyvals; + bool *xs_orderbynulls; + bool xs_recheckorderby; + + /* parallel index scan information, in shared memory */ + struct ParallelIndexScanDescData *parallel_scan; +} IndexScanDescData; + +/* Generic structure for parallel scans */ +typedef struct ParallelIndexScanDescData +{ + RelFileLocator ps_locator; /* physical table relation to scan */ + RelFileLocator ps_indexlocator; /* physical index relation to scan */ + Size ps_offset_ins; /* Offset to SharedIndexScanInstrumentation */ + Size ps_offset_am; /* Offset to am-specific structure */ + char ps_snapshot_data[FLEXIBLE_ARRAY_MEMBER]; +} ParallelIndexScanDescData; + +struct TupleTableSlot; + +/* Struct for storage-or-index scans of system tables */ +typedef struct SysScanDescData +{ + Relation heap_rel; /* catalog being scanned */ + Relation irel; /* NULL if doing heap scan */ + struct TableScanDescData *scan; /* only valid in storage-scan case */ + struct IndexScanDescData *iscan; /* only valid in index-scan case */ + struct SnapshotData *snapshot; /* snapshot to unregister at end of scan */ + struct TupleTableSlot *slot; +} SysScanDescData; + +#endif /* RELSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rewriteheap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rewriteheap.h new file mode 100644 index 0000000..99c3f36 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rewriteheap.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * rewriteheap.h + * Declarations for heap rewrite support functions + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/access/rewriteheap.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITE_HEAP_H +#define REWRITE_HEAP_H + +#include "access/htup.h" +#include "storage/itemptr.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" + +/* struct definition is private to rewriteheap.c */ +typedef struct RewriteStateData *RewriteState; + +extern RewriteState begin_heap_rewrite(Relation old_heap, Relation new_heap, + TransactionId oldest_xmin, TransactionId freeze_xid, + MultiXactId cutoff_multi); +extern void end_heap_rewrite(RewriteState state); +extern void rewrite_heap_tuple(RewriteState state, HeapTuple old_tuple, + HeapTuple new_tuple); +extern bool rewrite_heap_dead_tuple(RewriteState state, HeapTuple old_tuple); + +/* + * On-Disk data format for an individual logical rewrite mapping. + */ +typedef struct LogicalRewriteMappingData +{ + RelFileLocator old_locator; + RelFileLocator new_locator; + ItemPointerData old_tid; + ItemPointerData new_tid; +} LogicalRewriteMappingData; + +/* --- + * The filename consists of the following, dash separated, + * components: + * 1) database oid or InvalidOid for shared relations + * 2) the oid of the relation + * 3) upper 32bit of the LSN at which a rewrite started + * 4) lower 32bit of the LSN at which a rewrite started + * 5) xid we are mapping for + * 6) xid of the xact performing the mapping + * --- + */ +#define LOGICAL_REWRITE_FORMAT "map-%x-%x-%X_%X-%x-%x" +extern void CheckPointLogicalRewriteHeap(void); + +#endif /* REWRITE_HEAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rmgr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rmgr.h new file mode 100644 index 0000000..3b6a497 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rmgr.h @@ -0,0 +1,62 @@ +/* + * rmgr.h + * + * Resource managers definition + * + * src/include/access/rmgr.h + */ +#ifndef RMGR_H +#define RMGR_H + +typedef uint8 RmgrId; + +/* + * Built-in resource managers + * + * The actual numerical values for each rmgr ID are defined by the order + * of entries in rmgrlist.h. + * + * Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG + * file format. + */ +#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup,mask,decode) \ + symname, + +typedef enum RmgrIds +{ +#include "access/rmgrlist.h" + RM_NEXT_ID +} RmgrIds; + +#undef PG_RMGR + +#define RM_MAX_ID UINT8_MAX +#define RM_MAX_BUILTIN_ID (RM_NEXT_ID - 1) +#define RM_MIN_CUSTOM_ID 128 +#define RM_MAX_CUSTOM_ID UINT8_MAX +#define RM_N_IDS (UINT8_MAX + 1) +#define RM_N_BUILTIN_IDS (RM_MAX_BUILTIN_ID + 1) +#define RM_N_CUSTOM_IDS (RM_MAX_CUSTOM_ID - RM_MIN_CUSTOM_ID + 1) + +static inline bool +RmgrIdIsBuiltin(int rmid) +{ + return rmid <= RM_MAX_BUILTIN_ID; +} + +static inline bool +RmgrIdIsCustom(int rmid) +{ + return rmid >= RM_MIN_CUSTOM_ID && rmid <= RM_MAX_CUSTOM_ID; +} + +#define RmgrIdIsValid(rmid) (RmgrIdIsBuiltin((rmid)) || RmgrIdIsCustom((rmid))) + +/* + * RmgrId to use for extensions that require an RmgrId, but are still in + * development and have not reserved their own unique RmgrId yet. See: + * https://wiki.postgresql.org/wiki/CustomWALResourceManagers + */ +#define RM_EXPERIMENTAL_ID 128 + +#endif /* RMGR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rmgrdesc_utils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rmgrdesc_utils.h new file mode 100644 index 0000000..cda2ee5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rmgrdesc_utils.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * rmgrdesc_utils.h + * Support functions for rmgrdesc routines + * + * Copyright (c) 2023-2025, PostgreSQL Global Development Group + * + * src/include/access/rmgrdesc_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef RMGRDESC_UTILS_H_ +#define RMGRDESC_UTILS_H_ + +extern void array_desc(StringInfo buf, void *array, size_t elem_size, int count, + void (*elem_desc) (StringInfo buf, void *elem, void *data), + void *data); +extern void offset_elem_desc(StringInfo buf, void *offset, void *data); +extern void redirect_elem_desc(StringInfo buf, void *offset, void *data); +extern void oid_elem_desc(StringInfo buf, void *relid, void *data); + +#endif /* RMGRDESC_UTILS_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rmgrlist.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rmgrlist.h new file mode 100644 index 0000000..8e7fc9d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/rmgrlist.h @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------- + * rmgrlist.h + * + * The resource manager list is kept in its own source file for possible + * use by automatic tools. The exact representation of a rmgr is determined + * by the PG_RMGR macro, which is not defined in this file; it can be + * defined by the caller for special purposes. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/rmgrlist.h + *--------------------------------------------------------------------------- + */ + +/* there is deliberately not an #ifndef RMGRLIST_H here */ + +/* + * List of resource manager entries. Note that order of entries defines the + * numerical values of each rmgr's ID, which is stored in WAL records. New + * entries should be added at the end, to avoid changing IDs of existing + * entries. + * + * Changes to this list possibly need an XLOG_PAGE_MAGIC bump. + */ + +/* symbol name, textual name, redo, desc, identify, startup, cleanup, mask, decode */ +PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, xlog_identify, NULL, NULL, NULL, xlog_decode) +PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, xact_identify, NULL, NULL, NULL, xact_decode) +PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, smgr_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, clog_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, dbase_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, tblspc_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, multixact_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, relmap_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, standby_identify, NULL, NULL, NULL, standby_decode) +PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, heap2_identify, NULL, NULL, heap_mask, heap2_decode) +PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, heap_identify, NULL, NULL, heap_mask, heap_decode) +PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, btree_identify, btree_xlog_startup, btree_xlog_cleanup, btree_mask, NULL) +PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, hash_identify, NULL, NULL, hash_mask, NULL) +PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_identify, gin_xlog_startup, gin_xlog_cleanup, gin_mask, NULL) +PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_identify, gist_xlog_startup, gist_xlog_cleanup, gist_mask, NULL) +PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, seq_identify, NULL, NULL, seq_mask, NULL) +PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_identify, spg_xlog_startup, spg_xlog_cleanup, spg_mask, NULL) +PG_RMGR(RM_BRIN_ID, "BRIN", brin_redo, brin_desc, brin_identify, NULL, NULL, brin_mask, NULL) +PG_RMGR(RM_COMMIT_TS_ID, "CommitTs", commit_ts_redo, commit_ts_desc, commit_ts_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_REPLORIGIN_ID, "ReplicationOrigin", replorigin_redo, replorigin_desc, replorigin_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_GENERIC_ID, "Generic", generic_redo, generic_desc, generic_identify, NULL, NULL, generic_mask, NULL) +PG_RMGR(RM_LOGICALMSG_ID, "LogicalMessage", logicalmsg_redo, logicalmsg_desc, logicalmsg_identify, NULL, NULL, NULL, logicalmsg_decode) diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/sdir.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/sdir.h new file mode 100644 index 0000000..6544d24 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/sdir.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * sdir.h + * POSTGRES scan direction definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/sdir.h + * + *------------------------------------------------------------------------- + */ +#ifndef SDIR_H +#define SDIR_H + + +/* + * Defines the direction for scanning a table or an index. Scans are never + * invoked using NoMovementScanDirection. For convenience, we use the values + * -1 and 1 for backward and forward scans. This allows us to perform a few + * mathematical tricks such as what is done in ScanDirectionCombine. + */ +typedef enum ScanDirection +{ + BackwardScanDirection = -1, + NoMovementScanDirection = 0, + ForwardScanDirection = 1 +} ScanDirection; + +/* + * Determine the net effect of two direction specifications. + * This relies on having ForwardScanDirection = +1, BackwardScanDirection = -1, + * and will probably not do what you want if applied to any other values. + */ +#define ScanDirectionCombine(a, b) ((a) * (b)) + +/* + * ScanDirectionIsValid + * True iff scan direction is valid. + */ +#define ScanDirectionIsValid(direction) \ + ((bool) (BackwardScanDirection <= (direction) && \ + (direction) <= ForwardScanDirection)) + +/* + * ScanDirectionIsBackward + * True iff scan direction is backward. + */ +#define ScanDirectionIsBackward(direction) \ + ((bool) ((direction) == BackwardScanDirection)) + +/* + * ScanDirectionIsNoMovement + * True iff scan direction indicates no movement. + */ +#define ScanDirectionIsNoMovement(direction) \ + ((bool) ((direction) == NoMovementScanDirection)) + +/* + * ScanDirectionIsForward + * True iff scan direction is forward. + */ +#define ScanDirectionIsForward(direction) \ + ((bool) ((direction) == ForwardScanDirection)) + +#endif /* SDIR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/sequence.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/sequence.h new file mode 100644 index 0000000..27dde29 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/sequence.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * sequence.h + * Generic routines for sequence-related code. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/sequence.h + * + *------------------------------------------------------------------------- + */ +#ifndef ACCESS_SEQUENCE_H +#define ACCESS_SEQUENCE_H + +#include "storage/lockdefs.h" +#include "utils/relcache.h" + +extern Relation sequence_open(Oid relationId, LOCKMODE lockmode); +extern void sequence_close(Relation relation, LOCKMODE lockmode); + +#endif /* ACCESS_SEQUENCE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/session.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/session.h new file mode 100644 index 0000000..b494627 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/session.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * session.h + * Encapsulation of user session. + * + * Copyright (c) 2017-2025, PostgreSQL Global Development Group + * + * src/include/access/session.h + * + *------------------------------------------------------------------------- + */ +#ifndef SESSION_H +#define SESSION_H + +#include "lib/dshash.h" + +/* Avoid including typcache.h */ +struct SharedRecordTypmodRegistry; + +/* + * A struct encapsulating some elements of a user's session. For now this + * manages state that applies to parallel query, but in principle it could + * include other things that are currently global variables. + */ +typedef struct Session +{ + dsm_segment *segment; /* The session-scoped DSM segment. */ + dsa_area *area; /* The session-scoped DSA area. */ + + /* State managed by typcache.c. */ + struct SharedRecordTypmodRegistry *shared_typmod_registry; + dshash_table *shared_record_table; + dshash_table *shared_typmod_table; +} Session; + +extern void InitializeSession(void); +extern dsm_handle GetSessionDsmHandle(void); +extern void AttachSession(dsm_handle handle); +extern void DetachSession(void); + +/* The current session, or NULL for none. */ +extern PGDLLIMPORT Session *CurrentSession; + +#endif /* SESSION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/skey.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/skey.h new file mode 100644 index 0000000..e650c2e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/skey.h @@ -0,0 +1,151 @@ +/*------------------------------------------------------------------------- + * + * skey.h + * POSTGRES scan key definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/skey.h + * + *------------------------------------------------------------------------- + */ +#ifndef SKEY_H +#define SKEY_H + +#include "access/attnum.h" +#include "access/stratnum.h" +#include "fmgr.h" + + +/* + * A ScanKey represents the application of a comparison operator between + * a table or index column and a constant. When it's part of an array of + * ScanKeys, the comparison conditions are implicitly ANDed. The index + * column is the left argument of the operator, if it's a binary operator. + * (The data structure can support unary indexable operators too; in that + * case sk_argument would go unused. This is not currently implemented.) + * + * For an index scan, sk_strategy and sk_subtype must be set correctly for + * the operator. When using a ScanKey in a heap scan, these fields are not + * used and may be set to InvalidStrategy/InvalidOid. + * + * If the operator is collation-sensitive, sk_collation must be set + * correctly as well. + * + * A ScanKey can also represent a ScalarArrayOpExpr, that is a condition + * "column op ANY(ARRAY[...])". This is signaled by the SK_SEARCHARRAY + * flag bit. The sk_argument is not a value of the operator's right-hand + * argument type, but rather an array of such values, and the per-element + * comparisons are to be ORed together. + * + * A ScanKey can also represent a condition "column IS NULL" or "column + * IS NOT NULL"; these cases are signaled by the SK_SEARCHNULL and + * SK_SEARCHNOTNULL flag bits respectively. The argument is always NULL, + * and the sk_strategy, sk_subtype, sk_collation, and sk_func fields are + * not used (unless set by the index AM). + * + * SK_SEARCHARRAY, SK_SEARCHNULL and SK_SEARCHNOTNULL are supported only + * for index scans, not heap scans; and not all index AMs support them, + * only those that set amsearcharray or amsearchnulls respectively. + * + * A ScanKey can also represent an ordering operator invocation, that is + * an ordering requirement "ORDER BY indexedcol op constant". This looks + * the same as a comparison operator, except that the operator doesn't + * (usually) yield boolean. We mark such ScanKeys with SK_ORDER_BY. + * SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here. + * + * Note: in some places, ScanKeys are used as a convenient representation + * for the invocation of an access method support procedure. In this case + * sk_strategy/sk_subtype are not meaningful (but sk_collation can be); and + * sk_func may refer to a function that returns something other than boolean. + */ +typedef struct ScanKeyData +{ + int sk_flags; /* flags, see below */ + AttrNumber sk_attno; /* table or index column number */ + StrategyNumber sk_strategy; /* operator strategy number */ + Oid sk_subtype; /* strategy subtype */ + Oid sk_collation; /* collation to use, if needed */ + FmgrInfo sk_func; /* lookup info for function to call */ + Datum sk_argument; /* data to compare */ +} ScanKeyData; + +typedef ScanKeyData *ScanKey; + +/* + * About row comparisons: + * + * The ScanKey data structure also supports row comparisons, that is ordered + * tuple comparisons like (x, y) > (c1, c2), having the SQL-spec semantics + * "x > c1 OR (x = c1 AND y > c2)". Note that this is currently only + * implemented for btree index searches, not for heapscans or any other index + * type. A row comparison is represented by a "header" ScanKey entry plus + * a separate array of ScanKeys, one for each column of the row comparison. + * The header entry has these properties: + * sk_flags = SK_ROW_HEADER + * sk_attno = index column number for leading column of row comparison + * sk_strategy = btree strategy code for semantics of row comparison + * (ie, < <= > or >=) + * sk_subtype, sk_collation, sk_func: not used + * sk_argument: pointer to subsidiary ScanKey array + * If the header is part of a ScanKey array that's sorted by attno, it + * must be sorted according to the leading column number. + * + * The subsidiary ScanKey array appears in logical column order of the row + * comparison, which may be different from index column order. The array + * elements are like a normal ScanKey array except that: + * sk_flags must include SK_ROW_MEMBER, plus SK_ROW_END in the last + * element (needed since row header does not include a count) + * sk_func points to the btree comparison support function for the + * opclass, NOT the operator's implementation function. + * sk_strategy must be the same in all elements of the subsidiary array, + * that is, the same as in the header entry. + * SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here. + */ + +/* + * ScanKeyData sk_flags + * + * sk_flags bits 0-15 are reserved for system-wide use (symbols for those + * bits should be defined here). Bits 16-31 are reserved for use within + * individual index access methods. + */ +#define SK_ISNULL 0x0001 /* sk_argument is NULL */ +#define SK_UNARY 0x0002 /* unary operator (not supported!) */ +#define SK_ROW_HEADER 0x0004 /* row comparison header (see above) */ +#define SK_ROW_MEMBER 0x0008 /* row comparison member (see above) */ +#define SK_ROW_END 0x0010 /* last row comparison member */ +#define SK_SEARCHARRAY 0x0020 /* scankey represents ScalarArrayOp */ +#define SK_SEARCHNULL 0x0040 /* scankey represents "col IS NULL" */ +#define SK_SEARCHNOTNULL 0x0080 /* scankey represents "col IS NOT NULL" */ +#define SK_ORDER_BY 0x0100 /* scankey is for ORDER BY op */ + + +/* + * prototypes for functions in access/common/scankey.c + */ +extern void ScanKeyInit(ScanKey entry, + AttrNumber attributeNumber, + StrategyNumber strategy, + RegProcedure procedure, + Datum argument); +extern void ScanKeyEntryInitialize(ScanKey entry, + int flags, + AttrNumber attributeNumber, + StrategyNumber strategy, + Oid subtype, + Oid collation, + RegProcedure procedure, + Datum argument); +extern void ScanKeyEntryInitializeWithInfo(ScanKey entry, + int flags, + AttrNumber attributeNumber, + StrategyNumber strategy, + Oid subtype, + Oid collation, + FmgrInfo *finfo, + Datum argument); + +#endif /* SKEY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/slru.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/slru.h new file mode 100644 index 0000000..f8bf1f1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/slru.h @@ -0,0 +1,220 @@ +/*------------------------------------------------------------------------- + * + * slru.h + * Simple LRU buffering for transaction status logfiles + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/slru.h + * + *------------------------------------------------------------------------- + */ +#ifndef SLRU_H +#define SLRU_H + +#include "access/xlogdefs.h" +#include "storage/lwlock.h" +#include "storage/sync.h" + +/* + * To avoid overflowing internal arithmetic and the size_t data type, the + * number of buffers must not exceed this number. + */ +#define SLRU_MAX_ALLOWED_BUFFERS ((1024 * 1024 * 1024) / BLCKSZ) + +/* + * Define SLRU segment size. A page is the same BLCKSZ as is used everywhere + * else in Postgres. The segment size can be chosen somewhat arbitrarily; + * we make it 32 pages by default, or 256Kb, i.e. 1M transactions for CLOG + * or 64K transactions for SUBTRANS. + * + * Note: because TransactionIds are 32 bits and wrap around at 0xFFFFFFFF, + * page numbering also wraps around at 0xFFFFFFFF/xxxx_XACTS_PER_PAGE (where + * xxxx is CLOG or SUBTRANS, respectively), and segment numbering at + * 0xFFFFFFFF/xxxx_XACTS_PER_PAGE/SLRU_PAGES_PER_SEGMENT. We need + * take no explicit notice of that fact in slru.c, except when comparing + * segment and page numbers in SimpleLruTruncate (see PagePrecedes()). + */ +#define SLRU_PAGES_PER_SEGMENT 32 + +/* + * Page status codes. Note that these do not include the "dirty" bit. + * page_dirty can be true only in the VALID or WRITE_IN_PROGRESS states; + * in the latter case it implies that the page has been re-dirtied since + * the write started. + */ +typedef enum +{ + SLRU_PAGE_EMPTY, /* buffer is not in use */ + SLRU_PAGE_READ_IN_PROGRESS, /* page is being read in */ + SLRU_PAGE_VALID, /* page is valid and not being written */ + SLRU_PAGE_WRITE_IN_PROGRESS, /* page is being written out */ +} SlruPageStatus; + +/* + * Shared-memory state + * + * SLRU bank locks are used to protect access to the other fields, except + * latest_page_number, which uses atomics; see comment in slru.c. + */ +typedef struct SlruSharedData +{ + /* Number of buffers managed by this SLRU structure */ + int num_slots; + + /* + * Arrays holding info for each buffer slot. Page number is undefined + * when status is EMPTY, as is page_lru_count. + */ + char **page_buffer; + SlruPageStatus *page_status; + bool *page_dirty; + int64 *page_number; + int *page_lru_count; + + /* The buffer_locks protects the I/O on each buffer slots */ + LWLockPadded *buffer_locks; + + /* Locks to protect the in memory buffer slot access in SLRU bank. */ + LWLockPadded *bank_locks; + + /*---------- + * A bank-wise LRU counter is maintained because we do a victim buffer + * search within a bank. Furthermore, manipulating an individual bank + * counter avoids frequent cache invalidation since we update it every time + * we access the page. + * + * We mark a page "most recently used" by setting + * page_lru_count[slotno] = ++bank_cur_lru_count[bankno]; + * The oldest page in the bank is therefore the one with the highest value + * of + * bank_cur_lru_count[bankno] - page_lru_count[slotno] + * The counts will eventually wrap around, but this calculation still + * works as long as no page's age exceeds INT_MAX counts. + *---------- + */ + int *bank_cur_lru_count; + + /* + * Optional array of WAL flush LSNs associated with entries in the SLRU + * pages. If not zero/NULL, we must flush WAL before writing pages (true + * for pg_xact, false for everything else). group_lsn[] has + * lsn_groups_per_page entries per buffer slot, each containing the + * highest LSN known for a contiguous group of SLRU entries on that slot's + * page. + */ + XLogRecPtr *group_lsn; + int lsn_groups_per_page; + + /* + * latest_page_number is the page number of the current end of the log; + * this is not critical data, since we use it only to avoid swapping out + * the latest page. (An exception: an accurate latest_page_number is + * needed on pg_multixact/offsets to replay WAL generated with older minor + * versions correctly. See RecordNewMultiXact().) + */ + pg_atomic_uint64 latest_page_number; + + /* SLRU's index for statistics purposes (might not be unique) */ + int slru_stats_idx; +} SlruSharedData; + +typedef SlruSharedData *SlruShared; + +/* + * SlruCtlData is an unshared structure that points to the active information + * in shared memory. + */ +typedef struct SlruCtlData +{ + SlruShared shared; + + /* Number of banks in this SLRU. */ + uint16 nbanks; + + /* + * If true, use long segment file names. Otherwise, use short file names. + * + * For details about the file name format, see SlruFileName(). + */ + bool long_segment_names; + + /* + * Which sync handler function to use when handing sync requests over to + * the checkpointer. SYNC_HANDLER_NONE to disable fsync (eg pg_notify). + */ + SyncRequestHandler sync_handler; + + /* + * Decide whether a page is "older" for truncation and as a hint for + * evicting pages in LRU order. Return true if every entry of the first + * argument is older than every entry of the second argument. Note that + * !PagePrecedes(a,b) && !PagePrecedes(b,a) need not imply a==b; it also + * arises when some entries are older and some are not. For SLRUs using + * SimpleLruTruncate(), this must use modular arithmetic. (For others, + * the behavior of this callback has no functional implications.) Use + * SlruPagePrecedesUnitTests() in SLRUs meeting its criteria. + */ + bool (*PagePrecedes) (int64, int64); + + /* + * Dir is set during SimpleLruInit and does not change thereafter. Since + * it's always the same, it doesn't need to be in shared memory. + */ + char Dir[64]; +} SlruCtlData; + +typedef SlruCtlData *SlruCtl; + +/* + * Get the SLRU bank lock for given SlruCtl and the pageno. + * + * This lock needs to be acquired to access the slru buffer slots in the + * respective bank. + */ +static inline LWLock * +SimpleLruGetBankLock(SlruCtl ctl, int64 pageno) +{ + int bankno; + + bankno = pageno % ctl->nbanks; + return &(ctl->shared->bank_locks[bankno].lock); +} + +extern Size SimpleLruShmemSize(int nslots, int nlsns); +extern int SimpleLruAutotuneBuffers(int divisor, int max); +extern void SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns, + const char *subdir, int buffer_tranche_id, + int bank_tranche_id, SyncRequestHandler sync_handler, + bool long_segment_names); +extern int SimpleLruZeroPage(SlruCtl ctl, int64 pageno); +extern int SimpleLruReadPage(SlruCtl ctl, int64 pageno, bool write_ok, + TransactionId xid); +extern int SimpleLruReadPage_ReadOnly(SlruCtl ctl, int64 pageno, + TransactionId xid); +extern void SimpleLruWritePage(SlruCtl ctl, int slotno); +extern void SimpleLruWriteAll(SlruCtl ctl, bool allow_redirtied); +#ifdef USE_ASSERT_CHECKING +extern void SlruPagePrecedesUnitTests(SlruCtl ctl, int per_page); +#else +#define SlruPagePrecedesUnitTests(ctl, per_page) do {} while (0) +#endif +extern void SimpleLruTruncate(SlruCtl ctl, int64 cutoffPage); +extern bool SimpleLruDoesPhysicalPageExist(SlruCtl ctl, int64 pageno); + +typedef bool (*SlruScanCallback) (SlruCtl ctl, char *filename, int64 segpage, + void *data); +extern bool SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data); +extern void SlruDeleteSegment(SlruCtl ctl, int64 segno); + +extern int SlruSyncFileTag(SlruCtl ctl, const FileTag *ftag, char *path); + +/* SlruScanDirectory public callbacks */ +extern bool SlruScanDirCbReportPresence(SlruCtl ctl, char *filename, + int64 segpage, void *data); +extern bool SlruScanDirCbDeleteAll(SlruCtl ctl, char *filename, int64 segpage, + void *data); +extern bool check_slru_buffers(const char *name, int *newval); + +#endif /* SLRU_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/spgist.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/spgist.h new file mode 100644 index 0000000..cbe9b34 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/spgist.h @@ -0,0 +1,229 @@ +/*------------------------------------------------------------------------- + * + * spgist.h + * Public header file for SP-GiST access method. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/spgist.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPGIST_H +#define SPGIST_H + +#include "access/amapi.h" +#include "access/xlogreader.h" +#include "lib/stringinfo.h" + + +/* SPGiST opclass support function numbers */ +#define SPGIST_CONFIG_PROC 1 +#define SPGIST_CHOOSE_PROC 2 +#define SPGIST_PICKSPLIT_PROC 3 +#define SPGIST_INNER_CONSISTENT_PROC 4 +#define SPGIST_LEAF_CONSISTENT_PROC 5 +#define SPGIST_COMPRESS_PROC 6 +#define SPGIST_OPTIONS_PROC 7 +#define SPGISTNRequiredProc 5 +#define SPGISTNProc 7 + +/* + * Argument structs for spg_config method + */ +typedef struct spgConfigIn +{ + Oid attType; /* Data type to be indexed */ +} spgConfigIn; + +typedef struct spgConfigOut +{ + Oid prefixType; /* Data type of inner-tuple prefixes */ + Oid labelType; /* Data type of inner-tuple node labels */ + Oid leafType; /* Data type of leaf-tuple values */ + bool canReturnData; /* Opclass can reconstruct original data */ + bool longValuesOK; /* Opclass can cope with values > 1 page */ +} spgConfigOut; + +/* + * Argument structs for spg_choose method + */ +typedef struct spgChooseIn +{ + Datum datum; /* original datum to be indexed */ + Datum leafDatum; /* current datum to be stored at leaf */ + int level; /* current level (counting from zero) */ + + /* Data from current inner tuple */ + bool allTheSame; /* tuple is marked all-the-same? */ + bool hasPrefix; /* tuple has a prefix? */ + Datum prefixDatum; /* if so, the prefix value */ + int nNodes; /* number of nodes in the inner tuple */ + Datum *nodeLabels; /* node label values (NULL if none) */ +} spgChooseIn; + +typedef enum spgChooseResultType +{ + spgMatchNode = 1, /* descend into existing node */ + spgAddNode, /* add a node to the inner tuple */ + spgSplitTuple, /* split inner tuple (change its prefix) */ +} spgChooseResultType; + +typedef struct spgChooseOut +{ + spgChooseResultType resultType; /* action code, see above */ + union + { + struct /* results for spgMatchNode */ + { + int nodeN; /* descend to this node (index from 0) */ + int levelAdd; /* increment level by this much */ + Datum restDatum; /* new leaf datum */ + } matchNode; + struct /* results for spgAddNode */ + { + Datum nodeLabel; /* new node's label */ + int nodeN; /* where to insert it (index from 0) */ + } addNode; + struct /* results for spgSplitTuple */ + { + /* Info to form new upper-level inner tuple with one child tuple */ + bool prefixHasPrefix; /* tuple should have a prefix? */ + Datum prefixPrefixDatum; /* if so, its value */ + int prefixNNodes; /* number of nodes */ + Datum *prefixNodeLabels; /* their labels (or NULL for no + * labels) */ + int childNodeN; /* which node gets child tuple */ + + /* Info to form new lower-level inner tuple with all old nodes */ + bool postfixHasPrefix; /* tuple should have a prefix? */ + Datum postfixPrefixDatum; /* if so, its value */ + } splitTuple; + } result; +} spgChooseOut; + +/* + * Argument structs for spg_picksplit method + */ +typedef struct spgPickSplitIn +{ + int nTuples; /* number of leaf tuples */ + Datum *datums; /* their datums (array of length nTuples) */ + int level; /* current level (counting from zero) */ +} spgPickSplitIn; + +typedef struct spgPickSplitOut +{ + bool hasPrefix; /* new inner tuple should have a prefix? */ + Datum prefixDatum; /* if so, its value */ + + int nNodes; /* number of nodes for new inner tuple */ + Datum *nodeLabels; /* their labels (or NULL for no labels) */ + + int *mapTuplesToNodes; /* node index for each leaf tuple */ + Datum *leafTupleDatums; /* datum to store in each new leaf tuple */ +} spgPickSplitOut; + +/* + * Argument structs for spg_inner_consistent method + */ +typedef struct spgInnerConsistentIn +{ + ScanKey scankeys; /* array of operators and comparison values */ + ScanKey orderbys; /* array of ordering operators and comparison + * values */ + int nkeys; /* length of scankeys array */ + int norderbys; /* length of orderbys array */ + + Datum reconstructedValue; /* value reconstructed at parent */ + void *traversalValue; /* opclass-specific traverse value */ + MemoryContext traversalMemoryContext; /* put new traverse values here */ + int level; /* current level (counting from zero) */ + bool returnData; /* original data must be returned? */ + + /* Data from current inner tuple */ + bool allTheSame; /* tuple is marked all-the-same? */ + bool hasPrefix; /* tuple has a prefix? */ + Datum prefixDatum; /* if so, the prefix value */ + int nNodes; /* number of nodes in the inner tuple */ + Datum *nodeLabels; /* node label values (NULL if none) */ +} spgInnerConsistentIn; + +typedef struct spgInnerConsistentOut +{ + int nNodes; /* number of child nodes to be visited */ + int *nodeNumbers; /* their indexes in the node array */ + int *levelAdds; /* increment level by this much for each */ + Datum *reconstructedValues; /* associated reconstructed values */ + void **traversalValues; /* opclass-specific traverse values */ + double **distances; /* associated distances */ +} spgInnerConsistentOut; + +/* + * Argument structs for spg_leaf_consistent method + */ +typedef struct spgLeafConsistentIn +{ + ScanKey scankeys; /* array of operators and comparison values */ + ScanKey orderbys; /* array of ordering operators and comparison + * values */ + int nkeys; /* length of scankeys array */ + int norderbys; /* length of orderbys array */ + + Datum reconstructedValue; /* value reconstructed at parent */ + void *traversalValue; /* opclass-specific traverse value */ + int level; /* current level (counting from zero) */ + bool returnData; /* original data must be returned? */ + + Datum leafDatum; /* datum in leaf tuple */ +} spgLeafConsistentIn; + +typedef struct spgLeafConsistentOut +{ + Datum leafValue; /* reconstructed original data, if any */ + bool recheck; /* set true if operator must be rechecked */ + bool recheckDistances; /* set true if distances must be rechecked */ + double *distances; /* associated distances */ +} spgLeafConsistentOut; + + +/* spgutils.c */ +extern bytea *spgoptions(Datum reloptions, bool validate); + +/* spginsert.c */ +extern IndexBuildResult *spgbuild(Relation heap, Relation index, + struct IndexInfo *indexInfo); +extern void spgbuildempty(Relation index); +extern bool spginsert(Relation index, Datum *values, bool *isnull, + ItemPointer ht_ctid, Relation heapRel, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); + +/* spgscan.c */ +extern IndexScanDesc spgbeginscan(Relation rel, int keysz, int orderbysz); +extern void spgendscan(IndexScanDesc scan); +extern void spgrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, + ScanKey orderbys, int norderbys); +extern int64 spggetbitmap(IndexScanDesc scan, TIDBitmap *tbm); +extern bool spggettuple(IndexScanDesc scan, ScanDirection dir); +extern bool spgcanreturn(Relation index, int attno); + +/* spgvacuum.c */ +extern IndexBulkDeleteResult *spgbulkdelete(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); +extern IndexBulkDeleteResult *spgvacuumcleanup(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats); + +/* spgvalidate.c */ +extern bool spgvalidate(Oid opclassoid); +extern void spgadjustmembers(Oid opfamilyoid, + Oid opclassoid, + List *operators, + List *functions); + +#endif /* SPGIST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/spgist_private.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/spgist_private.h new file mode 100644 index 0000000..cb43a27 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/spgist_private.h @@ -0,0 +1,549 @@ +/*------------------------------------------------------------------------- + * + * spgist_private.h + * Private declarations for SP-GiST access method. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/spgist_private.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPGIST_PRIVATE_H +#define SPGIST_PRIVATE_H + +#include "access/itup.h" +#include "access/spgist.h" +#include "catalog/pg_am_d.h" +#include "nodes/tidbitmap.h" +#include "storage/buf.h" +#include "utils/geo_decls.h" +#include "utils/relcache.h" + + +typedef struct SpGistOptions +{ + int32 varlena_header_; /* varlena header (do not touch directly!) */ + int fillfactor; /* page fill factor in percent (0..100) */ +} SpGistOptions; + +#define SpGistGetFillFactor(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == SPGIST_AM_OID), \ + (relation)->rd_options ? \ + ((SpGistOptions *) (relation)->rd_options)->fillfactor : \ + SPGIST_DEFAULT_FILLFACTOR) +#define SpGistGetTargetPageFreeSpace(relation) \ + (BLCKSZ * (100 - SpGistGetFillFactor(relation)) / 100) + + +/* SPGiST leaf tuples have one key column, optionally have included columns */ +#define spgKeyColumn 0 +#define spgFirstIncludeColumn 1 + +/* Page numbers of fixed-location pages */ +#define SPGIST_METAPAGE_BLKNO (0) /* metapage */ +#define SPGIST_ROOT_BLKNO (1) /* root for normal entries */ +#define SPGIST_NULL_BLKNO (2) /* root for null-value entries */ +#define SPGIST_LAST_FIXED_BLKNO SPGIST_NULL_BLKNO + +#define SpGistBlockIsRoot(blkno) \ + ((blkno) == SPGIST_ROOT_BLKNO || (blkno) == SPGIST_NULL_BLKNO) +#define SpGistBlockIsFixed(blkno) \ + ((BlockNumber) (blkno) <= (BlockNumber) SPGIST_LAST_FIXED_BLKNO) + +/* + * Contents of page special space on SPGiST index pages + */ +typedef struct SpGistPageOpaqueData +{ + uint16 flags; /* see bit definitions below */ + uint16 nRedirection; /* number of redirection tuples on page */ + uint16 nPlaceholder; /* number of placeholder tuples on page */ + /* note there's no count of either LIVE or DEAD tuples ... */ + uint16 spgist_page_id; /* for identification of SP-GiST indexes */ +} SpGistPageOpaqueData; + +typedef SpGistPageOpaqueData *SpGistPageOpaque; + +/* Flag bits in page special space */ +#define SPGIST_META (1<<0) +#define SPGIST_DELETED (1<<1) /* never set, but keep for backwards + * compatibility */ +#define SPGIST_LEAF (1<<2) +#define SPGIST_NULLS (1<<3) + +#define SpGistPageGetOpaque(page) ((SpGistPageOpaque) PageGetSpecialPointer(page)) +#define SpGistPageIsMeta(page) (SpGistPageGetOpaque(page)->flags & SPGIST_META) +#define SpGistPageIsDeleted(page) (SpGistPageGetOpaque(page)->flags & SPGIST_DELETED) +#define SpGistPageIsLeaf(page) (SpGistPageGetOpaque(page)->flags & SPGIST_LEAF) +#define SpGistPageStoresNulls(page) (SpGistPageGetOpaque(page)->flags & SPGIST_NULLS) + +/* + * The page ID is for the convenience of pg_filedump and similar utilities, + * which otherwise would have a hard time telling pages of different index + * types apart. It should be the last 2 bytes on the page. This is more or + * less "free" due to alignment considerations. + * + * See comments above GinPageOpaqueData. + */ +#define SPGIST_PAGE_ID 0xFF82 + +/* + * Each backend keeps a cache of last-used page info in its index->rd_amcache + * area. This is initialized from, and occasionally written back to, + * shared storage in the index metapage. + */ +typedef struct SpGistLastUsedPage +{ + BlockNumber blkno; /* block number, or InvalidBlockNumber */ + int freeSpace; /* page's free space (could be obsolete!) */ +} SpGistLastUsedPage; + +/* Note: indexes in cachedPage[] match flag assignments for SpGistGetBuffer */ +#define SPGIST_CACHED_PAGES 8 + +typedef struct SpGistLUPCache +{ + SpGistLastUsedPage cachedPage[SPGIST_CACHED_PAGES]; +} SpGistLUPCache; + +/* + * metapage + */ +typedef struct SpGistMetaPageData +{ + uint32 magicNumber; /* for identity cross-check */ + SpGistLUPCache lastUsedPages; /* shared storage of last-used info */ +} SpGistMetaPageData; + +#define SPGIST_MAGIC_NUMBER (0xBA0BABEE) + +#define SpGistPageGetMeta(p) \ + ((SpGistMetaPageData *) PageGetContents(p)) + +/* + * Private state of index AM. SpGistState is common to both insert and + * search code; SpGistScanOpaque is for searches only. + */ + +typedef struct SpGistLeafTupleData *SpGistLeafTuple; /* forward reference */ + +/* Per-datatype info needed in SpGistState */ +typedef struct SpGistTypeDesc +{ + Oid type; + int16 attlen; + bool attbyval; + char attalign; + char attstorage; +} SpGistTypeDesc; + +typedef struct SpGistState +{ + Relation index; /* index we're working with */ + + spgConfigOut config; /* filled in by opclass config method */ + + SpGistTypeDesc attType; /* type of values to be indexed/restored */ + SpGistTypeDesc attLeafType; /* type of leaf-tuple values */ + SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ + SpGistTypeDesc attLabelType; /* type of node label values */ + + /* leafTupDesc typically points to index's tupdesc, but not always */ + TupleDesc leafTupDesc; /* descriptor for leaf-level tuples */ + + char *deadTupleStorage; /* workspace for spgFormDeadTuple */ + + TransactionId redirectXid; /* XID to use when creating a redirect tuple */ + bool isBuild; /* true if doing index build */ +} SpGistState; + +/* Item to be re-examined later during a search */ +typedef struct SpGistSearchItem +{ + pairingheap_node phNode; /* pairing heap node */ + Datum value; /* value reconstructed from parent, or + * leafValue if isLeaf */ + SpGistLeafTuple leafTuple; /* whole leaf tuple, if needed */ + void *traversalValue; /* opclass-specific traverse value */ + int level; /* level of items on this page */ + ItemPointerData heapPtr; /* heap info, if heap tuple */ + bool isNull; /* SearchItem is NULL item */ + bool isLeaf; /* SearchItem is heap item */ + bool recheck; /* qual recheck is needed */ + bool recheckDistances; /* distance recheck is needed */ + + /* array with numberOfOrderBys entries */ + double distances[FLEXIBLE_ARRAY_MEMBER]; +} SpGistSearchItem; + +#define SizeOfSpGistSearchItem(n_distances) \ + (offsetof(SpGistSearchItem, distances) + sizeof(double) * (n_distances)) + +/* + * Private state of an index scan + */ +typedef struct SpGistScanOpaqueData +{ + SpGistState state; /* see above */ + pairingheap *scanQueue; /* queue of to be visited items */ + MemoryContext tempCxt; /* short-lived memory context */ + MemoryContext traversalCxt; /* single scan lifetime memory context */ + + /* Control flags showing whether to search nulls and/or non-nulls */ + bool searchNulls; /* scan matches (all) null entries */ + bool searchNonNulls; /* scan matches (some) non-null entries */ + + /* Index quals to be passed to opclass (null-related quals removed) */ + int numberOfKeys; /* number of index qualifier conditions */ + ScanKey keyData; /* array of index qualifier descriptors */ + int numberOfOrderBys; /* number of ordering operators */ + int numberOfNonNullOrderBys; /* number of ordering operators + * with non-NULL arguments */ + ScanKey orderByData; /* array of ordering op descriptors */ + Oid *orderByTypes; /* array of ordering op return types */ + int *nonNullOrderByOffsets; /* array of offset of non-NULL + * ordering keys in the original array */ + Oid indexCollation; /* collation of index column */ + + /* Opclass defined functions: */ + FmgrInfo innerConsistentFn; + FmgrInfo leafConsistentFn; + + /* Pre-allocated workspace arrays: */ + double *zeroDistances; + double *infDistances; + + /* These fields are only used in amgetbitmap scans: */ + TIDBitmap *tbm; /* bitmap being filled */ + int64 ntids; /* number of TIDs passed to bitmap */ + + /* These fields are only used in amgettuple scans: */ + bool want_itup; /* are we reconstructing tuples? */ + TupleDesc reconTupDesc; /* if so, descriptor for reconstructed tuples */ + int nPtrs; /* number of TIDs found on current page */ + int iPtr; /* index for scanning through same */ + ItemPointerData heapPtrs[MaxIndexTuplesPerPage]; /* TIDs from cur page */ + bool recheck[MaxIndexTuplesPerPage]; /* their recheck flags */ + bool recheckDistances[MaxIndexTuplesPerPage]; /* distance recheck + * flags */ + HeapTuple reconTups[MaxIndexTuplesPerPage]; /* reconstructed tuples */ + + /* distances (for recheck) */ + IndexOrderByDistance *distances[MaxIndexTuplesPerPage]; + + /* + * Note: using MaxIndexTuplesPerPage above is a bit hokey since + * SpGistLeafTuples aren't exactly IndexTuples; however, they are larger, + * so this is safe. + */ +} SpGistScanOpaqueData; + +typedef SpGistScanOpaqueData *SpGistScanOpaque; + +/* + * This struct is what we actually keep in index->rd_amcache. It includes + * static configuration information as well as the lastUsedPages cache. + */ +typedef struct SpGistCache +{ + spgConfigOut config; /* filled in by opclass config method */ + + SpGistTypeDesc attType; /* type of values to be indexed/restored */ + SpGistTypeDesc attLeafType; /* type of leaf-tuple values */ + SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ + SpGistTypeDesc attLabelType; /* type of node label values */ + + SpGistLUPCache lastUsedPages; /* local storage of last-used info */ +} SpGistCache; + + +/* + * SPGiST tuple types. Note: inner, leaf, and dead tuple structs + * must have the same tupstate field in the same position! Real inner and + * leaf tuples always have tupstate = LIVE; if the state is something else, + * use the SpGistDeadTuple struct to inspect the tuple. + */ + +/* values of tupstate (see README for more info) */ +#define SPGIST_LIVE 0 /* normal live tuple (either inner or leaf) */ +#define SPGIST_REDIRECT 1 /* temporary redirection placeholder */ +#define SPGIST_DEAD 2 /* dead, cannot be removed because of links */ +#define SPGIST_PLACEHOLDER 3 /* placeholder, used to preserve offsets */ + +/* + * SPGiST inner tuple: list of "nodes" that subdivide a set of tuples + * + * Inner tuple layout: + * header/optional prefix/array of nodes, which are SpGistNodeTuples + * + * size and prefixSize must be multiples of MAXALIGN + * + * If the prefix datum is of a pass-by-value type, it is stored in its + * Datum representation, that is its on-disk representation is of length + * sizeof(Datum). This is a fairly unfortunate choice, because in no other + * place does Postgres use Datum as an on-disk representation; it creates + * an unnecessary incompatibility between 32-bit and 64-bit builds. But the + * compatibility loss is mostly theoretical since MAXIMUM_ALIGNOF typically + * differs between such builds, too. Anyway we're stuck with it now. + */ +typedef struct SpGistInnerTupleData +{ + unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */ + allTheSame:1, /* all nodes in tuple are equivalent */ + nNodes:13, /* number of nodes within inner tuple */ + prefixSize:16; /* size of prefix, or 0 if none */ + uint16 size; /* total size of inner tuple */ + /* On most machines there will be a couple of wasted bytes here */ + /* prefix datum follows, then nodes */ +} SpGistInnerTupleData; + +typedef SpGistInnerTupleData *SpGistInnerTuple; + +/* these must match largest values that fit in bit fields declared above */ +#define SGITMAXNNODES 0x1FFF +#define SGITMAXPREFIXSIZE 0xFFFF +#define SGITMAXSIZE 0xFFFF + +#define SGITHDRSZ MAXALIGN(sizeof(SpGistInnerTupleData)) +#define _SGITDATA(x) (((char *) (x)) + SGITHDRSZ) +#define SGITDATAPTR(x) ((x)->prefixSize ? _SGITDATA(x) : NULL) +#define SGITDATUM(x, s) ((x)->prefixSize ? \ + ((s)->attPrefixType.attbyval ? \ + *(Datum *) _SGITDATA(x) : \ + PointerGetDatum(_SGITDATA(x))) \ + : (Datum) 0) +#define SGITNODEPTR(x) ((SpGistNodeTuple) (_SGITDATA(x) + (x)->prefixSize)) + +/* Macro for iterating through the nodes of an inner tuple */ +#define SGITITERATE(x, i, nt) \ + for ((i) = 0, (nt) = SGITNODEPTR(x); \ + (i) < (x)->nNodes; \ + (i)++, (nt) = (SpGistNodeTuple) (((char *) (nt)) + IndexTupleSize(nt))) + +/* + * SPGiST node tuple: one node within an inner tuple + * + * Node tuples use the same header as ordinary Postgres IndexTuples, but + * we do not use a null bitmap, because we know there is only one column + * so the INDEX_NULL_MASK bit suffices. Also, pass-by-value datums are + * stored in Datum form, the same convention as for inner tuple prefixes. + */ + +typedef IndexTupleData SpGistNodeTupleData; + +typedef SpGistNodeTupleData *SpGistNodeTuple; + +#define SGNTHDRSZ MAXALIGN(sizeof(SpGistNodeTupleData)) +#define SGNTDATAPTR(x) (((char *) (x)) + SGNTHDRSZ) +#define SGNTDATUM(x, s) ((s)->attLabelType.attbyval ? \ + *(Datum *) SGNTDATAPTR(x) : \ + PointerGetDatum(SGNTDATAPTR(x))) + +/* + * SPGiST leaf tuple: carries a leaf datum and a heap tuple TID, + * and optionally some "included" columns. + * + * In the simplest case, the leaf datum is the same as the indexed value; + * but it could also be a suffix or some other sort of delta that permits + * reconstruction given knowledge of the prefix path traversed to get here. + * Any included columns are stored without modification. + * + * A nulls bitmap is present if there are included columns AND any of the + * datums are NULL. We do not need a nulls bitmap for the case of a null + * leaf datum without included columns, as we can infer whether the leaf + * datum is null from whether the tuple is stored on a nulls page. (This + * provision is mostly for backwards compatibility, but it does save space + * on 32-bit machines.) As with other PG index tuple designs, if the nulls + * bitmap exists then it's of size INDEX_MAX_KEYS bits regardless of the + * actual number of attributes. For the usual choice of INDEX_MAX_KEYS, + * this costs nothing because of alignment considerations. + * + * The size field is wider than could possibly be needed for an on-disk leaf + * tuple, but this allows us to form leaf tuples even when the datum is too + * wide to be stored immediately, and it costs nothing because of alignment + * considerations. + * + * t_info holds the nextOffset field (14 bits wide, enough for supported + * page sizes) plus the has-nulls-bitmap flag bit; another flag bit is free. + * + * Normally, nextOffset links to the next tuple belonging to the same parent + * node (which must be on the same page), or it's 0 if there is no next tuple. + * But when the root page is a leaf page, we don't chain its tuples, + * so nextOffset is always 0 on the root. + * + * size must be a multiple of MAXALIGN; also, it must be at least SGDTSIZE + * so that the tuple can be converted to REDIRECT status later. (This + * restriction only adds bytes for a NULL leaf datum stored on a 32-bit + * machine; otherwise alignment restrictions force it anyway.) + */ +typedef struct SpGistLeafTupleData +{ + unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */ + size:30; /* large enough for any palloc'able value */ + uint16 t_info; /* nextOffset, which links to the next tuple + * in chain, plus two flag bits */ + ItemPointerData heapPtr; /* TID of represented heap tuple */ + /* nulls bitmap follows if the flag bit for it is set */ + /* leaf datum, then any included datums, follows on a MAXALIGN boundary */ +} SpGistLeafTupleData; + +/* Macros to access nextOffset and bit fields inside t_info */ +#define SGLT_GET_NEXTOFFSET(spgLeafTuple) \ + ((spgLeafTuple)->t_info & 0x3FFF) +#define SGLT_GET_HASNULLMASK(spgLeafTuple) \ + (((spgLeafTuple)->t_info & 0x8000) ? true : false) +#define SGLT_SET_NEXTOFFSET(spgLeafTuple, offsetNumber) \ + ((spgLeafTuple)->t_info = \ + ((spgLeafTuple)->t_info & 0xC000) | ((offsetNumber) & 0x3FFF)) +#define SGLT_SET_HASNULLMASK(spgLeafTuple, hasnulls) \ + ((spgLeafTuple)->t_info = \ + ((spgLeafTuple)->t_info & 0x7FFF) | ((hasnulls) ? 0x8000 : 0)) + +#define SGLTHDRSZ(hasnulls) \ + ((hasnulls) ? MAXALIGN(sizeof(SpGistLeafTupleData) + \ + sizeof(IndexAttributeBitMapData)) : \ + MAXALIGN(sizeof(SpGistLeafTupleData))) +#define SGLTDATAPTR(x) (((char *) (x)) + SGLTHDRSZ(SGLT_GET_HASNULLMASK(x))) +#define SGLTDATUM(x, s) fetch_att(SGLTDATAPTR(x), \ + (s)->attLeafType.attbyval, \ + (s)->attLeafType.attlen) + +/* + * SPGiST dead tuple: declaration for examining non-live tuples + * + * The tupstate field of this struct must match those of regular inner and + * leaf tuples, and its size field must match a leaf tuple's. + * Also, the pointer field must be in the same place as a leaf tuple's heapPtr + * field, to satisfy some Asserts that we make when replacing a leaf tuple + * with a dead tuple. + * We don't use t_info, but it's needed to align the pointer field. + * pointer and xid are only valid when tupstate = REDIRECT, and in some + * cases xid can be InvalidTransactionId even then; see initSpGistState. + */ +typedef struct SpGistDeadTupleData +{ + unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */ + size:30; + uint16 t_info; /* not used in dead tuples */ + ItemPointerData pointer; /* redirection inside index */ + TransactionId xid; /* ID of xact that inserted this tuple */ +} SpGistDeadTupleData; + +typedef SpGistDeadTupleData *SpGistDeadTuple; + +#define SGDTSIZE MAXALIGN(sizeof(SpGistDeadTupleData)) + +/* + * Macros for doing free-space calculations. Note that when adding up the + * space needed for tuples, we always consider each tuple to need the tuple's + * size plus sizeof(ItemIdData) (for the line pointer). This works correctly + * so long as tuple sizes are always maxaligned. + */ + +/* Page capacity after allowing for fixed header and special space */ +#define SPGIST_PAGE_CAPACITY \ + MAXALIGN_DOWN(BLCKSZ - \ + SizeOfPageHeaderData - \ + MAXALIGN(sizeof(SpGistPageOpaqueData))) + +/* + * Compute free space on page, assuming that up to n placeholders can be + * recycled if present (n should be the number of tuples to be inserted) + */ +#define SpGistPageGetFreeSpace(p, n) \ + (PageGetExactFreeSpace(p) + \ + Min(SpGistPageGetOpaque(p)->nPlaceholder, n) * \ + (SGDTSIZE + sizeof(ItemIdData))) + +/* + * XLOG stuff + */ + +#define STORE_STATE(s, d) \ + do { \ + (d).redirectXid = (s)->redirectXid; \ + (d).isBuild = (s)->isBuild; \ + } while(0) + +/* + * The "flags" argument for SpGistGetBuffer should be either GBUF_LEAF to + * get a leaf page, or GBUF_INNER_PARITY(blockNumber) to get an inner + * page in the same triple-parity group as the specified block number. + * (Typically, this should be GBUF_INNER_PARITY(parentBlockNumber + 1) + * to follow the rule described in spgist/README.) + * In addition, GBUF_NULLS can be OR'd in to get a page for storage of + * null-valued tuples. + * + * Note: these flag values are used as indexes into lastUsedPages. + */ +#define GBUF_LEAF 0x03 +#define GBUF_INNER_PARITY(x) ((x) % 3) +#define GBUF_NULLS 0x04 + +#define GBUF_PARITY_MASK 0x03 +#define GBUF_REQ_LEAF(flags) (((flags) & GBUF_PARITY_MASK) == GBUF_LEAF) +#define GBUF_REQ_NULLS(flags) ((flags) & GBUF_NULLS) + +/* spgutils.c */ + +/* reloption parameters */ +#define SPGIST_MIN_FILLFACTOR 10 +#define SPGIST_DEFAULT_FILLFACTOR 80 + +extern SpGistCache *spgGetCache(Relation index); +extern TupleDesc getSpGistTupleDesc(Relation index, SpGistTypeDesc *keyType); +extern void initSpGistState(SpGistState *state, Relation index); +extern Buffer SpGistNewBuffer(Relation index); +extern void SpGistUpdateMetaPage(Relation index); +extern Buffer SpGistGetBuffer(Relation index, int flags, + int needSpace, bool *isNew); +extern void SpGistSetLastUsedPage(Relation index, Buffer buffer); +extern void SpGistInitPage(Page page, uint16 f); +extern void SpGistInitBuffer(Buffer b, uint16 f); +extern void SpGistInitMetapage(Page page); +extern unsigned int SpGistGetInnerTypeSize(SpGistTypeDesc *att, Datum datum); +extern Size SpGistGetLeafTupleSize(TupleDesc tupleDescriptor, + const Datum *datums, const bool *isnulls); +extern SpGistLeafTuple spgFormLeafTuple(SpGistState *state, + ItemPointer heapPtr, + const Datum *datums, const bool *isnulls); +extern SpGistNodeTuple spgFormNodeTuple(SpGistState *state, + Datum label, bool isnull); +extern SpGistInnerTuple spgFormInnerTuple(SpGistState *state, + bool hasPrefix, Datum prefix, + int nNodes, SpGistNodeTuple *nodes); +extern SpGistDeadTuple spgFormDeadTuple(SpGistState *state, int tupstate, + BlockNumber blkno, OffsetNumber offnum); +extern void spgDeformLeafTuple(SpGistLeafTuple tup, TupleDesc tupleDescriptor, + Datum *datums, bool *isnulls, + bool keyColumnIsNull); +extern Datum *spgExtractNodeLabels(SpGistState *state, + SpGistInnerTuple innerTuple); +extern OffsetNumber SpGistPageAddNewItem(SpGistState *state, Page page, + Item item, Size size, + OffsetNumber *startOffset, + bool errorOK); +extern bool spgproperty(Oid index_oid, int attno, + IndexAMProperty prop, const char *propname, + bool *res, bool *isnull); + +/* spgdoinsert.c */ +extern void spgUpdateNodeLink(SpGistInnerTuple tup, int nodeN, + BlockNumber blkno, OffsetNumber offset); +extern void spgPageIndexMultiDelete(SpGistState *state, Page page, + OffsetNumber *itemnos, int nitems, + int firststate, int reststate, + BlockNumber blkno, OffsetNumber offnum); +extern bool spgdoinsert(Relation index, SpGistState *state, + ItemPointer heapPtr, Datum *datums, bool *isnulls); + +/* spgproc.c */ +extern double *spg_key_orderbys_distances(Datum key, bool isLeaf, + ScanKey orderbys, int norderbys); +extern BOX *box_copy(BOX *orig); + +#endif /* SPGIST_PRIVATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/spgxlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/spgxlog.h new file mode 100644 index 0000000..695b014 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/spgxlog.h @@ -0,0 +1,259 @@ +/*------------------------------------------------------------------------- + * + * spgxlog.h + * xlog declarations for SP-GiST access method. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/spgxlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPGXLOG_H +#define SPGXLOG_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/off.h" + +/* XLOG record types for SPGiST */ + /* #define XLOG_SPGIST_CREATE_INDEX 0x00 */ /* not used anymore */ +#define XLOG_SPGIST_ADD_LEAF 0x10 +#define XLOG_SPGIST_MOVE_LEAFS 0x20 +#define XLOG_SPGIST_ADD_NODE 0x30 +#define XLOG_SPGIST_SPLIT_TUPLE 0x40 +#define XLOG_SPGIST_PICKSPLIT 0x50 +#define XLOG_SPGIST_VACUUM_LEAF 0x60 +#define XLOG_SPGIST_VACUUM_ROOT 0x70 +#define XLOG_SPGIST_VACUUM_REDIRECT 0x80 + +/* + * Some redo functions need an SpGistState, although only a few of its fields + * need to be valid. spgxlogState carries the required info in xlog records. + * (See fillFakeState in spgxlog.c for more comments.) + */ +typedef struct spgxlogState +{ + TransactionId redirectXid; + bool isBuild; +} spgxlogState; + +/* + * Backup Blk 0: destination page for leaf tuple + * Backup Blk 1: parent page (if any) + */ +typedef struct spgxlogAddLeaf +{ + bool newPage; /* init dest page? */ + bool storesNulls; /* page is in the nulls tree? */ + OffsetNumber offnumLeaf; /* offset where leaf tuple gets placed */ + OffsetNumber offnumHeadLeaf; /* offset of head tuple in chain, if any */ + + OffsetNumber offnumParent; /* where the parent downlink is, if any */ + uint16 nodeI; + + /* new leaf tuple follows (unaligned!) */ +} spgxlogAddLeaf; + +/* + * Backup Blk 0: source leaf page + * Backup Blk 1: destination leaf page + * Backup Blk 2: parent page + */ +typedef struct spgxlogMoveLeafs +{ + uint16 nMoves; /* number of tuples moved from source page */ + bool newPage; /* init dest page? */ + bool replaceDead; /* are we replacing a DEAD source tuple? */ + bool storesNulls; /* pages are in the nulls tree? */ + + /* where the parent downlink is */ + OffsetNumber offnumParent; + uint16 nodeI; + + spgxlogState stateSrc; + + /*---------- + * data follows: + * array of deleted tuple numbers, length nMoves + * array of inserted tuple numbers, length nMoves + 1 or 1 + * list of leaf tuples, length nMoves + 1 or 1 (unaligned!) + * + * Note: if replaceDead is true then there is only one inserted tuple + * number and only one leaf tuple in the data, because we are not copying + * the dead tuple from the source + *---------- + */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogMoveLeafs; + +#define SizeOfSpgxlogMoveLeafs offsetof(spgxlogMoveLeafs, offsets) + +/* + * Backup Blk 0: original page + * Backup Blk 1: where new tuple goes, if not same place + * Backup Blk 2: where parent downlink is, if updated and different from + * the old and new + */ +typedef struct spgxlogAddNode +{ + /* + * Offset of the original inner tuple, in the original page (on backup + * block 0). + */ + OffsetNumber offnum; + + /* + * Offset of the new tuple, on the new page (on backup block 1). Invalid, + * if we overwrote the old tuple in the original page). + */ + OffsetNumber offnumNew; + bool newPage; /* init new page? */ + + /*---- + * Where is the parent downlink? parentBlk indicates which page it's on, + * and offnumParent is the offset within the page. The possible values for + * parentBlk are: + * + * 0: parent == original page + * 1: parent == new page + * 2: parent == different page (blk ref 2) + * -1: parent not updated + *---- + */ + int8 parentBlk; + OffsetNumber offnumParent; /* offset within the parent page */ + + uint16 nodeI; + + spgxlogState stateSrc; + + /* + * updated inner tuple follows (unaligned!) + */ +} spgxlogAddNode; + +/* + * Backup Blk 0: where the prefix tuple goes + * Backup Blk 1: where the postfix tuple goes (if different page) + */ +typedef struct spgxlogSplitTuple +{ + /* where the prefix tuple goes */ + OffsetNumber offnumPrefix; + + /* where the postfix tuple goes */ + OffsetNumber offnumPostfix; + bool newPage; /* need to init that page? */ + bool postfixBlkSame; /* was postfix tuple put on same page as + * prefix? */ + + /* + * new prefix inner tuple follows, then new postfix inner tuple (both are + * unaligned!) + */ +} spgxlogSplitTuple; + +/* + * Buffer references in the rdata array are: + * Backup Blk 0: Src page (only if not root) + * Backup Blk 1: Dest page (if used) + * Backup Blk 2: Inner page + * Backup Blk 3: Parent page (if any, and different from Inner) + */ +typedef struct spgxlogPickSplit +{ + bool isRootSplit; + + uint16 nDelete; /* n to delete from Src */ + uint16 nInsert; /* n to insert on Src and/or Dest */ + bool initSrc; /* re-init the Src page? */ + bool initDest; /* re-init the Dest page? */ + + /* where to put new inner tuple */ + OffsetNumber offnumInner; + bool initInner; /* re-init the Inner page? */ + + bool storesNulls; /* pages are in the nulls tree? */ + + /* where the parent downlink is, if any */ + bool innerIsParent; /* is parent the same as inner page? */ + OffsetNumber offnumParent; + uint16 nodeI; + + spgxlogState stateSrc; + + /*---------- + * data follows: + * array of deleted tuple numbers, length nDelete + * array of inserted tuple numbers, length nInsert + * array of page selector bytes for inserted tuples, length nInsert + * new inner tuple (unaligned!) + * list of leaf tuples, length nInsert (unaligned!) + *---------- + */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogPickSplit; + +#define SizeOfSpgxlogPickSplit offsetof(spgxlogPickSplit, offsets) + +typedef struct spgxlogVacuumLeaf +{ + uint16 nDead; /* number of tuples to become DEAD */ + uint16 nPlaceholder; /* number of tuples to become PLACEHOLDER */ + uint16 nMove; /* number of tuples to move */ + uint16 nChain; /* number of tuples to re-chain */ + + spgxlogState stateSrc; + + /*---------- + * data follows: + * tuple numbers to become DEAD + * tuple numbers to become PLACEHOLDER + * tuple numbers to move from (and replace with PLACEHOLDER) + * tuple numbers to move to (replacing what is there) + * tuple numbers to update nextOffset links of + * tuple numbers to insert in nextOffset links + *---------- + */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogVacuumLeaf; + +#define SizeOfSpgxlogVacuumLeaf offsetof(spgxlogVacuumLeaf, offsets) + +typedef struct spgxlogVacuumRoot +{ + /* vacuum a root page when it is also a leaf */ + uint16 nDelete; /* number of tuples to delete */ + + spgxlogState stateSrc; + + /* offsets of tuples to delete follow */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogVacuumRoot; + +#define SizeOfSpgxlogVacuumRoot offsetof(spgxlogVacuumRoot, offsets) + +typedef struct spgxlogVacuumRedirect +{ + uint16 nToPlaceholder; /* number of redirects to make placeholders */ + OffsetNumber firstPlaceholder; /* first placeholder tuple to remove */ + TransactionId snapshotConflictHorizon; /* newest XID of removed redirects */ + bool isCatalogRel; /* to handle recovery conflict during logical + * decoding on standby */ + + /* offsets of redirect tuples to make placeholders follow */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogVacuumRedirect; + +#define SizeOfSpgxlogVacuumRedirect offsetof(spgxlogVacuumRedirect, offsets) + +extern void spg_redo(XLogReaderState *record); +extern void spg_desc(StringInfo buf, XLogReaderState *record); +extern const char *spg_identify(uint8 info); +extern void spg_xlog_startup(void); +extern void spg_xlog_cleanup(void); +extern void spg_mask(char *pagedata, BlockNumber blkno); + +#endif /* SPGXLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/stratnum.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/stratnum.h new file mode 100644 index 0000000..ee036d2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/stratnum.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------------------- + * + * stratnum.h + * POSTGRES strategy number definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/stratnum.h + * + *------------------------------------------------------------------------- + */ +#ifndef STRATNUM_H +#define STRATNUM_H + +/* + * Strategy numbers identify the semantics that particular operators have + * with respect to particular operator classes. In some cases a strategy + * subtype (an OID) is used as further information. + */ +typedef uint16 StrategyNumber; + +#define InvalidStrategy ((StrategyNumber) 0) + +/* + * Strategy numbers for B-tree indexes. + */ +#define BTLessStrategyNumber 1 +#define BTLessEqualStrategyNumber 2 +#define BTEqualStrategyNumber 3 +#define BTGreaterEqualStrategyNumber 4 +#define BTGreaterStrategyNumber 5 + +#define BTMaxStrategyNumber 5 + +/* + * Strategy numbers for hash indexes. There's only one valid strategy for + * hashing: equality. + */ +#define HTEqualStrategyNumber 1 + +#define HTMaxStrategyNumber 1 + +/* + * Strategy numbers common to (some) GiST, SP-GiST and BRIN opclasses. + * + * The first few of these come from the R-Tree indexing method (hence the + * names); the others have been added over time as they have been needed. + */ +#define RTLeftStrategyNumber 1 /* for << */ +#define RTOverLeftStrategyNumber 2 /* for &< */ +#define RTOverlapStrategyNumber 3 /* for && */ +#define RTOverRightStrategyNumber 4 /* for &> */ +#define RTRightStrategyNumber 5 /* for >> */ +#define RTSameStrategyNumber 6 /* for ~= */ +#define RTContainsStrategyNumber 7 /* for @> */ +#define RTContainedByStrategyNumber 8 /* for <@ */ +#define RTOverBelowStrategyNumber 9 /* for &<| */ +#define RTBelowStrategyNumber 10 /* for <<| */ +#define RTAboveStrategyNumber 11 /* for |>> */ +#define RTOverAboveStrategyNumber 12 /* for |&> */ +#define RTOldContainsStrategyNumber 13 /* for old spelling of @> */ +#define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */ +#define RTKNNSearchStrategyNumber 15 /* for <-> (distance) */ +#define RTContainsElemStrategyNumber 16 /* for range types @> elem */ +#define RTAdjacentStrategyNumber 17 /* for -|- */ +#define RTEqualStrategyNumber 18 /* for = */ +#define RTNotEqualStrategyNumber 19 /* for != */ +#define RTLessStrategyNumber 20 /* for < */ +#define RTLessEqualStrategyNumber 21 /* for <= */ +#define RTGreaterStrategyNumber 22 /* for > */ +#define RTGreaterEqualStrategyNumber 23 /* for >= */ +#define RTSubStrategyNumber 24 /* for inet >> */ +#define RTSubEqualStrategyNumber 25 /* for inet <<= */ +#define RTSuperStrategyNumber 26 /* for inet << */ +#define RTSuperEqualStrategyNumber 27 /* for inet >>= */ +#define RTPrefixStrategyNumber 28 /* for text ^@ */ +#define RTOldBelowStrategyNumber 29 /* for old spelling of <<| */ +#define RTOldAboveStrategyNumber 30 /* for old spelling of |>> */ + +#define RTMaxStrategyNumber 30 + + +#endif /* STRATNUM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/subtrans.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/subtrans.h new file mode 100644 index 0000000..c1193a4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/subtrans.h @@ -0,0 +1,26 @@ +/* + * subtrans.h + * + * PostgreSQL subtransaction-log manager + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/subtrans.h + */ +#ifndef SUBTRANS_H +#define SUBTRANS_H + +extern void SubTransSetParent(TransactionId xid, TransactionId parent); +extern TransactionId SubTransGetParent(TransactionId xid); +extern TransactionId SubTransGetTopmostTransaction(TransactionId xid); + +extern Size SUBTRANSShmemSize(void); +extern void SUBTRANSShmemInit(void); +extern void BootStrapSUBTRANS(void); +extern void StartupSUBTRANS(TransactionId oldestActiveXID); +extern void CheckPointSUBTRANS(void); +extern void ExtendSUBTRANS(TransactionId newestXact); +extern void TruncateSUBTRANS(TransactionId oldestXact); + +#endif /* SUBTRANS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/syncscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/syncscan.h new file mode 100644 index 0000000..397baca --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/syncscan.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * syncscan.h + * POSTGRES synchronous scan support functions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/syncscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef SYNCSCAN_H +#define SYNCSCAN_H + +#include "storage/block.h" +#include "utils/relcache.h" + +/* GUC variables */ +#ifdef TRACE_SYNCSCAN +extern PGDLLIMPORT bool trace_syncscan; +#endif + +extern void ss_report_location(Relation rel, BlockNumber location); +extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks); +extern void SyncScanShmemInit(void); +extern Size SyncScanShmemSize(void); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/sysattr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/sysattr.h new file mode 100644 index 0000000..47104f3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/sysattr.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * sysattr.h + * POSTGRES system attribute definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/sysattr.h + * + *------------------------------------------------------------------------- + */ +#ifndef SYSATTR_H +#define SYSATTR_H + + +/* + * Attribute numbers for the system-defined attributes + */ +#define SelfItemPointerAttributeNumber (-1) +#define MinTransactionIdAttributeNumber (-2) +#define MinCommandIdAttributeNumber (-3) +#define MaxTransactionIdAttributeNumber (-4) +#define MaxCommandIdAttributeNumber (-5) +#define TableOidAttributeNumber (-6) +#define FirstLowInvalidHeapAttributeNumber (-7) + +#endif /* SYSATTR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/table.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/table.h new file mode 100644 index 0000000..f530b06 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/table.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * table.h + * Generic routines for table related code. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/table.h + * + *------------------------------------------------------------------------- + */ +#ifndef TABLE_H +#define TABLE_H + +#include "nodes/primnodes.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" + +extern Relation table_open(Oid relationId, LOCKMODE lockmode); +extern Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode); +extern Relation table_openrv_extended(const RangeVar *relation, + LOCKMODE lockmode, bool missing_ok); +extern Relation try_table_open(Oid relationId, LOCKMODE lockmode); +extern void table_close(Relation relation, LOCKMODE lockmode); + +#endif /* TABLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tableam.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tableam.h new file mode 100644 index 0000000..9ecf8fa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tableam.h @@ -0,0 +1,2060 @@ +/*------------------------------------------------------------------------- + * + * tableam.h + * POSTGRES table access method definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tableam.h + * + * NOTES + * See tableam.sgml for higher level documentation. + * + *------------------------------------------------------------------------- + */ +#ifndef TABLEAM_H +#define TABLEAM_H + +#include "access/relscan.h" +#include "access/sdir.h" +#include "access/xact.h" +#include "executor/tuptable.h" +#include "storage/read_stream.h" +#include "utils/rel.h" +#include "utils/snapshot.h" + + +#define DEFAULT_TABLE_ACCESS_METHOD "heap" + +/* GUCs */ +extern PGDLLIMPORT char *default_table_access_method; +extern PGDLLIMPORT bool synchronize_seqscans; + + +struct BulkInsertStateData; +struct IndexInfo; +struct SampleScanState; +struct VacuumParams; +struct ValidateIndexState; + +/* + * Bitmask values for the flags argument to the scan_begin callback. + */ +typedef enum ScanOptions +{ + /* one of SO_TYPE_* may be specified */ + SO_TYPE_SEQSCAN = 1 << 0, + SO_TYPE_BITMAPSCAN = 1 << 1, + SO_TYPE_SAMPLESCAN = 1 << 2, + SO_TYPE_TIDSCAN = 1 << 3, + SO_TYPE_TIDRANGESCAN = 1 << 4, + SO_TYPE_ANALYZE = 1 << 5, + + /* several of SO_ALLOW_* may be specified */ + /* allow or disallow use of access strategy */ + SO_ALLOW_STRAT = 1 << 6, + /* report location to syncscan logic? */ + SO_ALLOW_SYNC = 1 << 7, + /* verify visibility page-at-a-time? */ + SO_ALLOW_PAGEMODE = 1 << 8, + + /* unregister snapshot at scan end? */ + SO_TEMP_SNAPSHOT = 1 << 9, +} ScanOptions; + +/* + * Result codes for table_{update,delete,lock_tuple}, and for visibility + * routines inside table AMs. + */ +typedef enum TM_Result +{ + /* + * Signals that the action succeeded (i.e. update/delete performed, lock + * was acquired) + */ + TM_Ok, + + /* The affected tuple wasn't visible to the relevant snapshot */ + TM_Invisible, + + /* The affected tuple was already modified by the calling backend */ + TM_SelfModified, + + /* + * The affected tuple was updated by another transaction. This includes + * the case where tuple was moved to another partition. + */ + TM_Updated, + + /* The affected tuple was deleted by another transaction */ + TM_Deleted, + + /* + * The affected tuple is currently being modified by another session. This + * will only be returned if table_(update/delete/lock_tuple) are + * instructed not to wait. + */ + TM_BeingModified, + + /* lock couldn't be acquired, action skipped. Only used by lock_tuple */ + TM_WouldBlock, +} TM_Result; + +/* + * Result codes for table_update(..., update_indexes*..). + * Used to determine which indexes to update. + */ +typedef enum TU_UpdateIndexes +{ + /* No indexed columns were updated (incl. TID addressing of tuple) */ + TU_None, + + /* A non-summarizing indexed column was updated, or the TID has changed */ + TU_All, + + /* Only summarized columns were updated, TID is unchanged */ + TU_Summarizing, +} TU_UpdateIndexes; + +/* + * When table_tuple_update, table_tuple_delete, or table_tuple_lock fail + * because the target tuple is already outdated, they fill in this struct to + * provide information to the caller about what happened. When those functions + * succeed, the contents of this struct should not be relied upon, except for + * `traversed`, which may be set in both success and failure cases. + * + * ctid is the target's ctid link: it is the same as the target's TID if the + * target was deleted, or the location of the replacement tuple if the target + * was updated. + * + * xmax is the outdating transaction's XID. If the caller wants to visit the + * replacement tuple, it must check that this matches before believing the + * replacement is really a match. This is InvalidTransactionId if the target + * was !LP_NORMAL (expected only for a TID retrieved from syscache). + * + * cmax is the outdating command's CID, but only when the failure code is + * TM_SelfModified (i.e., something in the current transaction outdated the + * tuple); otherwise cmax is zero. (We make this restriction because + * HeapTupleHeaderGetCmax doesn't work for tuples outdated in other + * transactions.) + * + * traversed indicates if an update chain was followed in order to try to lock + * the target tuple. (This may be set in both success and failure cases.) + */ +typedef struct TM_FailureData +{ + ItemPointerData ctid; + TransactionId xmax; + CommandId cmax; + bool traversed; +} TM_FailureData; + +/* + * State used when calling table_index_delete_tuples(). + * + * Represents the status of table tuples, referenced by table TID and taken by + * index AM from index tuples. State consists of high level parameters of the + * deletion operation, plus two mutable palloc()'d arrays for information + * about the status of individual table tuples. These are conceptually one + * single array. Using two arrays keeps the TM_IndexDelete struct small, + * which makes sorting the first array (the deltids array) fast. + * + * Some index AM callers perform simple index tuple deletion (by specifying + * bottomup = false), and include only known-dead deltids. These known-dead + * entries are all marked knowndeletable = true directly (typically these are + * TIDs from LP_DEAD-marked index tuples), but that isn't strictly required. + * + * Callers that specify bottomup = true are "bottom-up index deletion" + * callers. The considerations for the tableam are more subtle with these + * callers because they ask the tableam to perform highly speculative work, + * and might only expect the tableam to check a small fraction of all entries. + * Caller is not allowed to specify knowndeletable = true for any entry + * because everything is highly speculative. Bottom-up caller provides + * context and hints to tableam -- see comments below for details on how index + * AMs and tableams should coordinate during bottom-up index deletion. + * + * Simple index deletion callers may ask the tableam to perform speculative + * work, too. This is a little like bottom-up deletion, but not too much. + * The tableam will only perform speculative work when it's practically free + * to do so in passing for simple deletion caller (while always performing + * whatever work is needed to enable knowndeletable/LP_DEAD index tuples to + * be deleted within index AM). This is the real reason why it's possible for + * simple index deletion caller to specify knowndeletable = false up front + * (this means "check if it's possible for me to delete corresponding index + * tuple when it's cheap to do so in passing"). The index AM should only + * include "extra" entries for index tuples whose TIDs point to a table block + * that tableam is expected to have to visit anyway (in the event of a block + * orientated tableam). The tableam isn't strictly obligated to check these + * "extra" TIDs, but a block-based AM should always manage to do so in + * practice. + * + * The final contents of the deltids/status arrays are interesting to callers + * that ask tableam to perform speculative work (i.e. when _any_ items have + * knowndeletable set to false up front). These index AM callers will + * naturally need to consult final state to determine which index tuples are + * in fact deletable. + * + * The index AM can keep track of which index tuple relates to which deltid by + * setting idxoffnum (and/or relying on each entry being uniquely identifiable + * using tid), which is important when the final contents of the array will + * need to be interpreted -- the array can shrink from initial size after + * tableam processing and/or have entries in a new order (tableam may sort + * deltids array for its own reasons). Bottom-up callers may find that final + * ndeltids is 0 on return from call to tableam, in which case no index tuple + * deletions are possible. Simple deletion callers can rely on any entries + * they know to be deletable appearing in the final array as deletable. + */ +typedef struct TM_IndexDelete +{ + ItemPointerData tid; /* table TID from index tuple */ + int16 id; /* Offset into TM_IndexStatus array */ +} TM_IndexDelete; + +typedef struct TM_IndexStatus +{ + OffsetNumber idxoffnum; /* Index am page offset number */ + bool knowndeletable; /* Currently known to be deletable? */ + + /* Bottom-up index deletion specific fields follow */ + bool promising; /* Promising (duplicate) index tuple? */ + int16 freespace; /* Space freed in index if deleted */ +} TM_IndexStatus; + +/* + * Index AM/tableam coordination is central to the design of bottom-up index + * deletion. The index AM provides hints about where to look to the tableam + * by marking some entries as "promising". Index AM does this with duplicate + * index tuples that are strongly suspected to be old versions left behind by + * UPDATEs that did not logically modify indexed values. Index AM may find it + * helpful to only mark entries as promising when they're thought to have been + * affected by such an UPDATE in the recent past. + * + * Bottom-up index deletion casts a wide net at first, usually by including + * all TIDs on a target index page. It is up to the tableam to worry about + * the cost of checking transaction status information. The tableam is in + * control, but needs careful guidance from the index AM. Index AM requests + * that bottomupfreespace target be met, while tableam measures progress + * towards that goal by tallying the per-entry freespace value for known + * deletable entries. (All !bottomup callers can just set these space related + * fields to zero.) + */ +typedef struct TM_IndexDeleteOp +{ + Relation irel; /* Target index relation */ + BlockNumber iblknum; /* Index block number (for error reports) */ + bool bottomup; /* Bottom-up (not simple) deletion? */ + int bottomupfreespace; /* Bottom-up space target */ + + /* Mutable per-TID information follows (index AM initializes entries) */ + int ndeltids; /* Current # of deltids/status elements */ + TM_IndexDelete *deltids; + TM_IndexStatus *status; +} TM_IndexDeleteOp; + +/* "options" flag bits for table_tuple_insert */ +/* TABLE_INSERT_SKIP_WAL was 0x0001; RelationNeedsWAL() now governs */ +#define TABLE_INSERT_SKIP_FSM 0x0002 +#define TABLE_INSERT_FROZEN 0x0004 +#define TABLE_INSERT_NO_LOGICAL 0x0008 + +/* flag bits for table_tuple_lock */ +/* Follow tuples whose update is in progress if lock modes don't conflict */ +#define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS (1 << 0) +/* Follow update chain and lock latest version of tuple */ +#define TUPLE_LOCK_FLAG_FIND_LAST_VERSION (1 << 1) + + +/* Typedef for callback function for table_index_build_scan */ +typedef void (*IndexBuildCallback) (Relation index, + ItemPointer tid, + Datum *values, + bool *isnull, + bool tupleIsAlive, + void *state); + +/* + * API struct for a table AM. Note this must be allocated in a + * server-lifetime manner, typically as a static const struct, which then gets + * returned by FormData_pg_am.amhandler. + * + * In most cases it's not appropriate to call the callbacks directly, use the + * table_* wrapper functions instead. + * + * GetTableAmRoutine() asserts that required callbacks are filled in, remember + * to update when adding a callback. + */ +typedef struct TableAmRoutine +{ + /* this must be set to T_TableAmRoutine */ + NodeTag type; + + + /* ------------------------------------------------------------------------ + * Slot related callbacks. + * ------------------------------------------------------------------------ + */ + + /* + * Return slot implementation suitable for storing a tuple of this AM. + */ + const TupleTableSlotOps *(*slot_callbacks) (Relation rel); + + + /* ------------------------------------------------------------------------ + * Table scan callbacks. + * ------------------------------------------------------------------------ + */ + + /* + * Start a scan of `rel`. The callback has to return a TableScanDesc, + * which will typically be embedded in a larger, AM specific, struct. + * + * If nkeys != 0, the results need to be filtered by those scan keys. + * + * pscan, if not NULL, will have already been initialized with + * parallelscan_initialize(), and has to be for the same relation. Will + * only be set coming from table_beginscan_parallel(). + * + * `flags` is a bitmask indicating the type of scan (ScanOptions's + * SO_TYPE_*, currently only one may be specified), options controlling + * the scan's behaviour (ScanOptions's SO_ALLOW_*, several may be + * specified, an AM may ignore unsupported ones) and whether the snapshot + * needs to be deallocated at scan_end (ScanOptions's SO_TEMP_SNAPSHOT). + */ + TableScanDesc (*scan_begin) (Relation rel, + Snapshot snapshot, + int nkeys, struct ScanKeyData *key, + ParallelTableScanDesc pscan, + uint32 flags); + + /* + * Release resources and deallocate scan. If TableScanDesc.temp_snap, + * TableScanDesc.rs_snapshot needs to be unregistered. + */ + void (*scan_end) (TableScanDesc scan); + + /* + * Restart relation scan. If set_params is set to true, allow_{strat, + * sync, pagemode} (see scan_begin) changes should be taken into account. + */ + void (*scan_rescan) (TableScanDesc scan, struct ScanKeyData *key, + bool set_params, bool allow_strat, + bool allow_sync, bool allow_pagemode); + + /* + * Return next tuple from `scan`, store in slot. + */ + bool (*scan_getnextslot) (TableScanDesc scan, + ScanDirection direction, + TupleTableSlot *slot); + + /*----------- + * Optional functions to provide scanning for ranges of ItemPointers. + * Implementations must either provide both of these functions, or neither + * of them. + * + * Implementations of scan_set_tidrange must themselves handle + * ItemPointers of any value. i.e, they must handle each of the following: + * + * 1) mintid or maxtid is beyond the end of the table; and + * 2) mintid is above maxtid; and + * 3) item offset for mintid or maxtid is beyond the maximum offset + * allowed by the AM. + * + * Implementations can assume that scan_set_tidrange is always called + * before scan_getnextslot_tidrange or after scan_rescan and before any + * further calls to scan_getnextslot_tidrange. + */ + void (*scan_set_tidrange) (TableScanDesc scan, + ItemPointer mintid, + ItemPointer maxtid); + + /* + * Return next tuple from `scan` that's in the range of TIDs defined by + * scan_set_tidrange. + */ + bool (*scan_getnextslot_tidrange) (TableScanDesc scan, + ScanDirection direction, + TupleTableSlot *slot); + + /* ------------------------------------------------------------------------ + * Parallel table scan related functions. + * ------------------------------------------------------------------------ + */ + + /* + * Estimate the size of shared memory needed for a parallel scan of this + * relation. The snapshot does not need to be accounted for. + */ + Size (*parallelscan_estimate) (Relation rel); + + /* + * Initialize ParallelTableScanDesc for a parallel scan of this relation. + * `pscan` will be sized according to parallelscan_estimate() for the same + * relation. + */ + Size (*parallelscan_initialize) (Relation rel, + ParallelTableScanDesc pscan); + + /* + * Reinitialize `pscan` for a new scan. `rel` will be the same relation as + * when `pscan` was initialized by parallelscan_initialize. + */ + void (*parallelscan_reinitialize) (Relation rel, + ParallelTableScanDesc pscan); + + + /* ------------------------------------------------------------------------ + * Index Scan Callbacks + * ------------------------------------------------------------------------ + */ + + /* + * Prepare to fetch tuples from the relation, as needed when fetching + * tuples for an index scan. The callback has to return an + * IndexFetchTableData, which the AM will typically embed in a larger + * structure with additional information. + * + * Tuples for an index scan can then be fetched via index_fetch_tuple. + */ + struct IndexFetchTableData *(*index_fetch_begin) (Relation rel); + + /* + * Reset index fetch. Typically this will release cross index fetch + * resources held in IndexFetchTableData. + */ + void (*index_fetch_reset) (struct IndexFetchTableData *data); + + /* + * Release resources and deallocate index fetch. + */ + void (*index_fetch_end) (struct IndexFetchTableData *data); + + /* + * Fetch tuple at `tid` into `slot`, after doing a visibility test + * according to `snapshot`. If a tuple was found and passed the visibility + * test, return true, false otherwise. + * + * Note that AMs that do not necessarily update indexes when indexed + * columns do not change, need to return the current/correct version of + * the tuple that is visible to the snapshot, even if the tid points to an + * older version of the tuple. + * + * *call_again is false on the first call to index_fetch_tuple for a tid. + * If there potentially is another tuple matching the tid, *call_again + * needs to be set to true by index_fetch_tuple, signaling to the caller + * that index_fetch_tuple should be called again for the same tid. + * + * *all_dead, if all_dead is not NULL, should be set to true by + * index_fetch_tuple iff it is guaranteed that no backend needs to see + * that tuple. Index AMs can use that to avoid returning that tid in + * future searches. + */ + bool (*index_fetch_tuple) (struct IndexFetchTableData *scan, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot, + bool *call_again, bool *all_dead); + + + /* ------------------------------------------------------------------------ + * Callbacks for non-modifying operations on individual tuples + * ------------------------------------------------------------------------ + */ + + /* + * Fetch tuple at `tid` into `slot`, after doing a visibility test + * according to `snapshot`. If a tuple was found and passed the visibility + * test, returns true, false otherwise. + */ + bool (*tuple_fetch_row_version) (Relation rel, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot); + + /* + * Is tid valid for a scan of this relation. + */ + bool (*tuple_tid_valid) (TableScanDesc scan, + ItemPointer tid); + + /* + * Return the latest version of the tuple at `tid`, by updating `tid` to + * point at the newest version. + */ + void (*tuple_get_latest_tid) (TableScanDesc scan, + ItemPointer tid); + + /* + * Does the tuple in `slot` satisfy `snapshot`? The slot needs to be of + * the appropriate type for the AM. + */ + bool (*tuple_satisfies_snapshot) (Relation rel, + TupleTableSlot *slot, + Snapshot snapshot); + + /* see table_index_delete_tuples() */ + TransactionId (*index_delete_tuples) (Relation rel, + TM_IndexDeleteOp *delstate); + + + /* ------------------------------------------------------------------------ + * Manipulations of physical tuples. + * ------------------------------------------------------------------------ + */ + + /* see table_tuple_insert() for reference about parameters */ + void (*tuple_insert) (Relation rel, TupleTableSlot *slot, + CommandId cid, int options, + struct BulkInsertStateData *bistate); + + /* see table_tuple_insert_speculative() for reference about parameters */ + void (*tuple_insert_speculative) (Relation rel, + TupleTableSlot *slot, + CommandId cid, + int options, + struct BulkInsertStateData *bistate, + uint32 specToken); + + /* see table_tuple_complete_speculative() for reference about parameters */ + void (*tuple_complete_speculative) (Relation rel, + TupleTableSlot *slot, + uint32 specToken, + bool succeeded); + + /* see table_multi_insert() for reference about parameters */ + void (*multi_insert) (Relation rel, TupleTableSlot **slots, int nslots, + CommandId cid, int options, struct BulkInsertStateData *bistate); + + /* see table_tuple_delete() for reference about parameters */ + TM_Result (*tuple_delete) (Relation rel, + ItemPointer tid, + CommandId cid, + Snapshot snapshot, + Snapshot crosscheck, + bool wait, + TM_FailureData *tmfd, + bool changingPart); + + /* see table_tuple_update() for reference about parameters */ + TM_Result (*tuple_update) (Relation rel, + ItemPointer otid, + TupleTableSlot *slot, + CommandId cid, + Snapshot snapshot, + Snapshot crosscheck, + bool wait, + TM_FailureData *tmfd, + LockTupleMode *lockmode, + TU_UpdateIndexes *update_indexes); + + /* see table_tuple_lock() for reference about parameters */ + TM_Result (*tuple_lock) (Relation rel, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot, + CommandId cid, + LockTupleMode mode, + LockWaitPolicy wait_policy, + uint8 flags, + TM_FailureData *tmfd); + + /* + * Perform operations necessary to complete insertions made via + * tuple_insert and multi_insert with a BulkInsertState specified. In-tree + * access methods ceased to use this. + * + * Typically callers of tuple_insert and multi_insert will just pass all + * the flags that apply to them, and each AM has to decide which of them + * make sense for it, and then only take actions in finish_bulk_insert for + * those flags, and ignore others. + * + * Optional callback. + */ + void (*finish_bulk_insert) (Relation rel, int options); + + + /* ------------------------------------------------------------------------ + * DDL related functionality. + * ------------------------------------------------------------------------ + */ + + /* + * This callback needs to create new relation storage for `rel`, with + * appropriate durability behaviour for `persistence`. + * + * Note that only the subset of the relcache filled by + * RelationBuildLocalRelation() can be relied upon and that the relation's + * catalog entries will either not yet exist (new relation), or will still + * reference the old relfilelocator. + * + * As output *freezeXid, *minmulti must be set to the values appropriate + * for pg_class.{relfrozenxid, relminmxid}. For AMs that don't need those + * fields to be filled they can be set to InvalidTransactionId and + * InvalidMultiXactId, respectively. + * + * See also table_relation_set_new_filelocator(). + */ + void (*relation_set_new_filelocator) (Relation rel, + const RelFileLocator *newrlocator, + char persistence, + TransactionId *freezeXid, + MultiXactId *minmulti); + + /* + * This callback needs to remove all contents from `rel`'s current + * relfilelocator. No provisions for transactional behaviour need to be + * made. Often this can be implemented by truncating the underlying + * storage to its minimal size. + * + * See also table_relation_nontransactional_truncate(). + */ + void (*relation_nontransactional_truncate) (Relation rel); + + /* + * See table_relation_copy_data(). + * + * This can typically be implemented by directly copying the underlying + * storage, unless it contains references to the tablespace internally. + */ + void (*relation_copy_data) (Relation rel, + const RelFileLocator *newrlocator); + + /* See table_relation_copy_for_cluster() */ + void (*relation_copy_for_cluster) (Relation OldTable, + Relation NewTable, + Relation OldIndex, + bool use_sort, + TransactionId OldestXmin, + TransactionId *xid_cutoff, + MultiXactId *multi_cutoff, + double *num_tuples, + double *tups_vacuumed, + double *tups_recently_dead); + + /* + * React to VACUUM command on the relation. The VACUUM can be triggered by + * a user or by autovacuum. The specific actions performed by the AM will + * depend heavily on the individual AM. + * + * On entry a transaction is already established, and the relation is + * locked with a ShareUpdateExclusive lock. + * + * Note that neither VACUUM FULL (and CLUSTER), nor ANALYZE go through + * this routine, even if (for ANALYZE) it is part of the same VACUUM + * command. + * + * There probably, in the future, needs to be a separate callback to + * integrate with autovacuum's scheduling. + */ + void (*relation_vacuum) (Relation rel, + struct VacuumParams *params, + BufferAccessStrategy bstrategy); + + /* + * Prepare to analyze block `blockno` of `scan`. The scan has been started + * with table_beginscan_analyze(). See also + * table_scan_analyze_next_block(). + * + * The callback may acquire resources like locks that are held until + * table_scan_analyze_next_tuple() returns false. It e.g. can make sense + * to hold a lock until all tuples on a block have been analyzed by + * scan_analyze_next_tuple. + * + * The callback can return false if the block is not suitable for + * sampling, e.g. because it's a metapage that could never contain tuples. + * + * XXX: This obviously is primarily suited for block-based AMs. It's not + * clear what a good interface for non block based AMs would be, so there + * isn't one yet. + */ + bool (*scan_analyze_next_block) (TableScanDesc scan, + ReadStream *stream); + + /* + * See table_scan_analyze_next_tuple(). + * + * Not every AM might have a meaningful concept of dead rows, in which + * case it's OK to not increment *deadrows - but note that that may + * influence autovacuum scheduling (see comment for relation_vacuum + * callback). + */ + bool (*scan_analyze_next_tuple) (TableScanDesc scan, + TransactionId OldestXmin, + double *liverows, + double *deadrows, + TupleTableSlot *slot); + + /* see table_index_build_range_scan for reference about parameters */ + double (*index_build_range_scan) (Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + bool allow_sync, + bool anyvisible, + bool progress, + BlockNumber start_blockno, + BlockNumber numblocks, + IndexBuildCallback callback, + void *callback_state, + TableScanDesc scan); + + /* see table_index_validate_scan for reference about parameters */ + void (*index_validate_scan) (Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + Snapshot snapshot, + struct ValidateIndexState *state); + + + /* ------------------------------------------------------------------------ + * Miscellaneous functions. + * ------------------------------------------------------------------------ + */ + + /* + * See table_relation_size(). + * + * Note that currently a few callers use the MAIN_FORKNUM size to figure + * out the range of potentially interesting blocks (brin, analyze). It's + * probable that we'll need to revise the interface for those at some + * point. + */ + uint64 (*relation_size) (Relation rel, ForkNumber forkNumber); + + + /* + * This callback should return true if the relation requires a TOAST table + * and false if it does not. It may wish to examine the relation's tuple + * descriptor before making a decision, but if it uses some other method + * of storing large values (or if it does not support them) it can simply + * return false. + */ + bool (*relation_needs_toast_table) (Relation rel); + + /* + * This callback should return the OID of the table AM that implements + * TOAST tables for this AM. If the relation_needs_toast_table callback + * always returns false, this callback is not required. + */ + Oid (*relation_toast_am) (Relation rel); + + /* + * This callback is invoked when detoasting a value stored in a toast + * table implemented by this AM. See table_relation_fetch_toast_slice() + * for more details. + */ + void (*relation_fetch_toast_slice) (Relation toastrel, Oid valueid, + int32 attrsize, + int32 sliceoffset, + int32 slicelength, + struct varlena *result); + + + /* ------------------------------------------------------------------------ + * Planner related functions. + * ------------------------------------------------------------------------ + */ + + /* + * See table_relation_estimate_size(). + * + * While block oriented, it shouldn't be too hard for an AM that doesn't + * internally use blocks to convert into a usable representation. + * + * This differs from the relation_size callback by returning size + * estimates (both relation size and tuple count) for planning purposes, + * rather than returning a currently correct estimate. + */ + void (*relation_estimate_size) (Relation rel, int32 *attr_widths, + BlockNumber *pages, double *tuples, + double *allvisfrac); + + + /* ------------------------------------------------------------------------ + * Executor related functions. + * ------------------------------------------------------------------------ + */ + + /* + * Fetch the next tuple of a bitmap table scan into `slot` and return true + * if a visible tuple was found, false otherwise. + * + * `lossy_pages` is incremented if the bitmap is lossy for the selected + * page; otherwise, `exact_pages` is incremented. These are tracked for + * display in EXPLAIN ANALYZE output. + * + * Prefetching additional data from the bitmap is left to the table AM. + * + * This is an optional callback. + */ + bool (*scan_bitmap_next_tuple) (TableScanDesc scan, + TupleTableSlot *slot, + bool *recheck, + uint64 *lossy_pages, + uint64 *exact_pages); + + /* + * Prepare to fetch tuples from the next block in a sample scan. Return + * false if the sample scan is finished, true otherwise. `scan` was + * started via table_beginscan_sampling(). + * + * Typically this will first determine the target block by calling the + * TsmRoutine's NextSampleBlock() callback if not NULL, or alternatively + * perform a sequential scan over all blocks. The determined block is + * then typically read and pinned. + * + * As the TsmRoutine interface is block based, a block needs to be passed + * to NextSampleBlock(). If that's not appropriate for an AM, it + * internally needs to perform mapping between the internal and a block + * based representation. + * + * Note that it's not acceptable to hold deadlock prone resources such as + * lwlocks until scan_sample_next_tuple() has exhausted the tuples on the + * block - the tuple is likely to be returned to an upper query node, and + * the next call could be off a long while. Holding buffer pins and such + * is obviously OK. + * + * Currently it is required to implement this interface, as there's no + * alternative way (contrary e.g. to bitmap scans) to implement sample + * scans. If infeasible to implement, the AM may raise an error. + */ + bool (*scan_sample_next_block) (TableScanDesc scan, + struct SampleScanState *scanstate); + + /* + * This callback, only called after scan_sample_next_block has returned + * true, should determine the next tuple to be returned from the selected + * block using the TsmRoutine's NextSampleTuple() callback. + * + * The callback needs to perform visibility checks, and only return + * visible tuples. That obviously can mean calling NextSampleTuple() + * multiple times. + * + * The TsmRoutine interface assumes that there's a maximum offset on a + * given page, so if that doesn't apply to an AM, it needs to emulate that + * assumption somehow. + */ + bool (*scan_sample_next_tuple) (TableScanDesc scan, + struct SampleScanState *scanstate, + TupleTableSlot *slot); + +} TableAmRoutine; + + +/* ---------------------------------------------------------------------------- + * Slot functions. + * ---------------------------------------------------------------------------- + */ + +/* + * Returns slot callbacks suitable for holding tuples of the appropriate type + * for the relation. Works for tables, views, foreign tables and partitioned + * tables. + */ +extern const TupleTableSlotOps *table_slot_callbacks(Relation relation); + +/* + * Returns slot using the callbacks returned by table_slot_callbacks(), and + * registers it on *reglist. + */ +extern TupleTableSlot *table_slot_create(Relation relation, List **reglist); + + +/* ---------------------------------------------------------------------------- + * Table scan functions. + * ---------------------------------------------------------------------------- + */ + +/* + * Start a scan of `rel`. Returned tuples pass a visibility test of + * `snapshot`, and if nkeys != 0, the results are filtered by those scan keys. + */ +static inline TableScanDesc +table_beginscan(Relation rel, Snapshot snapshot, + int nkeys, struct ScanKeyData *key) +{ + uint32 flags = SO_TYPE_SEQSCAN | + SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE; + + return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags); +} + +/* + * Like table_beginscan(), but for scanning catalog. It'll automatically use a + * snapshot appropriate for scanning catalog relations. + */ +extern TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, + struct ScanKeyData *key); + +/* + * Like table_beginscan(), but table_beginscan_strat() offers an extended API + * that lets the caller control whether a nondefault buffer access strategy + * can be used, and whether syncscan can be chosen (possibly resulting in the + * scan not starting from block zero). Both of these default to true with + * plain table_beginscan. + */ +static inline TableScanDesc +table_beginscan_strat(Relation rel, Snapshot snapshot, + int nkeys, struct ScanKeyData *key, + bool allow_strat, bool allow_sync) +{ + uint32 flags = SO_TYPE_SEQSCAN | SO_ALLOW_PAGEMODE; + + if (allow_strat) + flags |= SO_ALLOW_STRAT; + if (allow_sync) + flags |= SO_ALLOW_SYNC; + + return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags); +} + +/* + * table_beginscan_bm is an alternative entry point for setting up a + * TableScanDesc for a bitmap heap scan. Although that scan technology is + * really quite unlike a standard seqscan, there is just enough commonality to + * make it worth using the same data structure. + */ +static inline TableScanDesc +table_beginscan_bm(Relation rel, Snapshot snapshot, + int nkeys, struct ScanKeyData *key) +{ + uint32 flags = SO_TYPE_BITMAPSCAN | SO_ALLOW_PAGEMODE; + + return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, + NULL, flags); +} + +/* + * table_beginscan_sampling is an alternative entry point for setting up a + * TableScanDesc for a TABLESAMPLE scan. As with bitmap scans, it's worth + * using the same data structure although the behavior is rather different. + * In addition to the options offered by table_beginscan_strat, this call + * also allows control of whether page-mode visibility checking is used. + */ +static inline TableScanDesc +table_beginscan_sampling(Relation rel, Snapshot snapshot, + int nkeys, struct ScanKeyData *key, + bool allow_strat, bool allow_sync, + bool allow_pagemode) +{ + uint32 flags = SO_TYPE_SAMPLESCAN; + + if (allow_strat) + flags |= SO_ALLOW_STRAT; + if (allow_sync) + flags |= SO_ALLOW_SYNC; + if (allow_pagemode) + flags |= SO_ALLOW_PAGEMODE; + + return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags); +} + +/* + * table_beginscan_tid is an alternative entry point for setting up a + * TableScanDesc for a Tid scan. As with bitmap scans, it's worth using + * the same data structure although the behavior is rather different. + */ +static inline TableScanDesc +table_beginscan_tid(Relation rel, Snapshot snapshot) +{ + uint32 flags = SO_TYPE_TIDSCAN; + + return rel->rd_tableam->scan_begin(rel, snapshot, 0, NULL, NULL, flags); +} + +/* + * table_beginscan_analyze is an alternative entry point for setting up a + * TableScanDesc for an ANALYZE scan. As with bitmap scans, it's worth using + * the same data structure although the behavior is rather different. + */ +static inline TableScanDesc +table_beginscan_analyze(Relation rel) +{ + uint32 flags = SO_TYPE_ANALYZE; + + return rel->rd_tableam->scan_begin(rel, NULL, 0, NULL, NULL, flags); +} + +/* + * End relation scan. + */ +static inline void +table_endscan(TableScanDesc scan) +{ + scan->rs_rd->rd_tableam->scan_end(scan); +} + +/* + * Restart a relation scan. + */ +static inline void +table_rescan(TableScanDesc scan, + struct ScanKeyData *key) +{ + scan->rs_rd->rd_tableam->scan_rescan(scan, key, false, false, false, false); +} + +/* + * Restart a relation scan after changing params. + * + * This call allows changing the buffer strategy, syncscan, and pagemode + * options before starting a fresh scan. Note that although the actual use of + * syncscan might change (effectively, enabling or disabling reporting), the + * previously selected startblock will be kept. + */ +static inline void +table_rescan_set_params(TableScanDesc scan, struct ScanKeyData *key, + bool allow_strat, bool allow_sync, bool allow_pagemode) +{ + scan->rs_rd->rd_tableam->scan_rescan(scan, key, true, + allow_strat, allow_sync, + allow_pagemode); +} + +/* + * Return next tuple from `scan`, store in slot. + */ +static inline bool +table_scan_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot) +{ + slot->tts_tableOid = RelationGetRelid(sscan->rs_rd); + + /* We don't expect actual scans using NoMovementScanDirection */ + Assert(direction == ForwardScanDirection || + direction == BackwardScanDirection); + + /* + * We don't expect direct calls to table_scan_getnextslot with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_scan_getnextslot call during logical decoding"); + + return sscan->rs_rd->rd_tableam->scan_getnextslot(sscan, direction, slot); +} + +/* ---------------------------------------------------------------------------- + * TID Range scanning related functions. + * ---------------------------------------------------------------------------- + */ + +/* + * table_beginscan_tidrange is the entry point for setting up a TableScanDesc + * for a TID range scan. + */ +static inline TableScanDesc +table_beginscan_tidrange(Relation rel, Snapshot snapshot, + ItemPointer mintid, + ItemPointer maxtid) +{ + TableScanDesc sscan; + uint32 flags = SO_TYPE_TIDRANGESCAN | SO_ALLOW_PAGEMODE; + + sscan = rel->rd_tableam->scan_begin(rel, snapshot, 0, NULL, NULL, flags); + + /* Set the range of TIDs to scan */ + sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid); + + return sscan; +} + +/* + * table_rescan_tidrange resets the scan position and sets the minimum and + * maximum TID range to scan for a TableScanDesc created by + * table_beginscan_tidrange. + */ +static inline void +table_rescan_tidrange(TableScanDesc sscan, ItemPointer mintid, + ItemPointer maxtid) +{ + /* Ensure table_beginscan_tidrange() was used. */ + Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0); + + sscan->rs_rd->rd_tableam->scan_rescan(sscan, NULL, false, false, false, false); + sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid); +} + +/* + * Fetch the next tuple from `sscan` for a TID range scan created by + * table_beginscan_tidrange(). Stores the tuple in `slot` and returns true, + * or returns false if no more tuples exist in the range. + */ +static inline bool +table_scan_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction, + TupleTableSlot *slot) +{ + /* Ensure table_beginscan_tidrange() was used. */ + Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0); + + /* We don't expect actual scans using NoMovementScanDirection */ + Assert(direction == ForwardScanDirection || + direction == BackwardScanDirection); + + return sscan->rs_rd->rd_tableam->scan_getnextslot_tidrange(sscan, + direction, + slot); +} + + +/* ---------------------------------------------------------------------------- + * Parallel table scan related functions. + * ---------------------------------------------------------------------------- + */ + +/* + * Estimate the size of shared memory needed for a parallel scan of this + * relation. + */ +extern Size table_parallelscan_estimate(Relation rel, Snapshot snapshot); + +/* + * Initialize ParallelTableScanDesc for a parallel scan of this + * relation. `pscan` needs to be sized according to parallelscan_estimate() + * for the same relation. Call this just once in the leader process; then, + * individual workers attach via table_beginscan_parallel. + */ +extern void table_parallelscan_initialize(Relation rel, + ParallelTableScanDesc pscan, + Snapshot snapshot); + +/* + * Begin a parallel scan. `pscan` needs to have been initialized with + * table_parallelscan_initialize(), for the same relation. The initialization + * does not need to have happened in this backend. + * + * Caller must hold a suitable lock on the relation. + */ +extern TableScanDesc table_beginscan_parallel(Relation relation, + ParallelTableScanDesc pscan); + +/* + * Restart a parallel scan. Call this in the leader process. Caller is + * responsible for making sure that all workers have finished the scan + * beforehand. + */ +static inline void +table_parallelscan_reinitialize(Relation rel, ParallelTableScanDesc pscan) +{ + rel->rd_tableam->parallelscan_reinitialize(rel, pscan); +} + + +/* ---------------------------------------------------------------------------- + * Index scan related functions. + * ---------------------------------------------------------------------------- + */ + +/* + * Prepare to fetch tuples from the relation, as needed when fetching tuples + * for an index scan. + * + * Tuples for an index scan can then be fetched via table_index_fetch_tuple(). + */ +static inline IndexFetchTableData * +table_index_fetch_begin(Relation rel) +{ + return rel->rd_tableam->index_fetch_begin(rel); +} + +/* + * Reset index fetch. Typically this will release cross index fetch resources + * held in IndexFetchTableData. + */ +static inline void +table_index_fetch_reset(struct IndexFetchTableData *scan) +{ + scan->rel->rd_tableam->index_fetch_reset(scan); +} + +/* + * Release resources and deallocate index fetch. + */ +static inline void +table_index_fetch_end(struct IndexFetchTableData *scan) +{ + scan->rel->rd_tableam->index_fetch_end(scan); +} + +/* + * Fetches, as part of an index scan, tuple at `tid` into `slot`, after doing + * a visibility test according to `snapshot`. If a tuple was found and passed + * the visibility test, returns true, false otherwise. Note that *tid may be + * modified when we return true (see later remarks on multiple row versions + * reachable via a single index entry). + * + * *call_again needs to be false on the first call to table_index_fetch_tuple() for + * a tid. If there potentially is another tuple matching the tid, *call_again + * will be set to true, signaling that table_index_fetch_tuple() should be called + * again for the same tid. + * + * *all_dead, if all_dead is not NULL, will be set to true by + * table_index_fetch_tuple() iff it is guaranteed that no backend needs to see + * that tuple. Index AMs can use that to avoid returning that tid in future + * searches. + * + * The difference between this function and table_tuple_fetch_row_version() + * is that this function returns the currently visible version of a row if + * the AM supports storing multiple row versions reachable via a single index + * entry (like heap's HOT). Whereas table_tuple_fetch_row_version() only + * evaluates the tuple exactly at `tid`. Outside of index entry ->table tuple + * lookups, table_tuple_fetch_row_version() is what's usually needed. + */ +static inline bool +table_index_fetch_tuple(struct IndexFetchTableData *scan, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot, + bool *call_again, bool *all_dead) +{ + /* + * We don't expect direct calls to table_index_fetch_tuple with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_index_fetch_tuple call during logical decoding"); + + return scan->rel->rd_tableam->index_fetch_tuple(scan, tid, snapshot, + slot, call_again, + all_dead); +} + +/* + * This is a convenience wrapper around table_index_fetch_tuple() which + * returns whether there are table tuple items corresponding to an index + * entry. This likely is only useful to verify if there's a conflict in a + * unique index. + */ +extern bool table_index_fetch_tuple_check(Relation rel, + ItemPointer tid, + Snapshot snapshot, + bool *all_dead); + + +/* ------------------------------------------------------------------------ + * Functions for non-modifying operations on individual tuples + * ------------------------------------------------------------------------ + */ + + +/* + * Fetch tuple at `tid` into `slot`, after doing a visibility test according to + * `snapshot`. If a tuple was found and passed the visibility test, returns + * true, false otherwise. + * + * See table_index_fetch_tuple's comment about what the difference between + * these functions is. It is correct to use this function outside of index + * entry->table tuple lookups. + */ +static inline bool +table_tuple_fetch_row_version(Relation rel, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot) +{ + /* + * We don't expect direct calls to table_tuple_fetch_row_version with + * valid CheckXidAlive for catalog or regular tables. See detailed + * comments in xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_tuple_fetch_row_version call during logical decoding"); + + return rel->rd_tableam->tuple_fetch_row_version(rel, tid, snapshot, slot); +} + +/* + * Verify that `tid` is a potentially valid tuple identifier. That doesn't + * mean that the pointed to row needs to exist or be visible, but that + * attempting to fetch the row (e.g. with table_tuple_get_latest_tid() or + * table_tuple_fetch_row_version()) should not error out if called with that + * tid. + * + * `scan` needs to have been started via table_beginscan(). + */ +static inline bool +table_tuple_tid_valid(TableScanDesc scan, ItemPointer tid) +{ + return scan->rs_rd->rd_tableam->tuple_tid_valid(scan, tid); +} + +/* + * Return the latest version of the tuple at `tid`, by updating `tid` to + * point at the newest version. + */ +extern void table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid); + +/* + * Return true iff tuple in slot satisfies the snapshot. + * + * This assumes the slot's tuple is valid, and of the appropriate type for the + * AM. + * + * Some AMs might modify the data underlying the tuple as a side-effect. If so + * they ought to mark the relevant buffer dirty. + */ +static inline bool +table_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot, + Snapshot snapshot) +{ + return rel->rd_tableam->tuple_satisfies_snapshot(rel, slot, snapshot); +} + +/* + * Determine which index tuples are safe to delete based on their table TID. + * + * Determines which entries from index AM caller's TM_IndexDeleteOp state + * point to vacuumable table tuples. Entries that are found by tableam to be + * vacuumable are naturally safe for index AM to delete, and so get directly + * marked as deletable. See comments above TM_IndexDelete and comments above + * TM_IndexDeleteOp for full details. + * + * Returns a snapshotConflictHorizon transaction ID that caller places in + * its index deletion WAL record. This might be used during subsequent REDO + * of the WAL record when in Hot Standby mode -- a recovery conflict for the + * index deletion operation might be required on the standby. + */ +static inline TransactionId +table_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate) +{ + return rel->rd_tableam->index_delete_tuples(rel, delstate); +} + + +/* ---------------------------------------------------------------------------- + * Functions for manipulations of physical tuples. + * ---------------------------------------------------------------------------- + */ + +/* + * Insert a tuple from a slot into table AM routine. + * + * The options bitmask allows the caller to specify options that may change the + * behaviour of the AM. The AM will ignore options that it does not support. + * + * If the TABLE_INSERT_SKIP_FSM option is specified, AMs are free to not reuse + * free space in the relation. This can save some cycles when we know the + * relation is new and doesn't contain useful amounts of free space. + * TABLE_INSERT_SKIP_FSM is commonly passed directly to + * RelationGetBufferForTuple. See that method for more information. + * + * TABLE_INSERT_FROZEN should only be specified for inserts into + * relation storage created during the current subtransaction and when + * there are no prior snapshots or pre-existing portals open. + * This causes rows to be frozen, which is an MVCC violation and + * requires explicit options chosen by user. + * + * TABLE_INSERT_NO_LOGICAL force-disables the emitting of logical decoding + * information for the tuple. This should solely be used during table rewrites + * where RelationIsLogicallyLogged(relation) is not yet accurate for the new + * relation. + * + * Note that most of these options will be applied when inserting into the + * heap's TOAST table, too, if the tuple requires any out-of-line data. + * + * The BulkInsertState object (if any; bistate can be NULL for default + * behavior) is also just passed through to RelationGetBufferForTuple. If + * `bistate` is provided, table_finish_bulk_insert() needs to be called. + * + * On return the slot's tts_tid and tts_tableOid are updated to reflect the + * insertion. But note that any toasting of fields within the slot is NOT + * reflected in the slots contents. + */ +static inline void +table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, + int options, struct BulkInsertStateData *bistate) +{ + rel->rd_tableam->tuple_insert(rel, slot, cid, options, + bistate); +} + +/* + * Perform a "speculative insertion". These can be backed out afterwards + * without aborting the whole transaction. Other sessions can wait for the + * speculative insertion to be confirmed, turning it into a regular tuple, or + * aborted, as if it never existed. Speculatively inserted tuples behave as + * "value locks" of short duration, used to implement INSERT .. ON CONFLICT. + * + * A transaction having performed a speculative insertion has to either abort, + * or finish the speculative insertion with + * table_tuple_complete_speculative(succeeded = ...). + */ +static inline void +table_tuple_insert_speculative(Relation rel, TupleTableSlot *slot, + CommandId cid, int options, + struct BulkInsertStateData *bistate, + uint32 specToken) +{ + rel->rd_tableam->tuple_insert_speculative(rel, slot, cid, options, + bistate, specToken); +} + +/* + * Complete "speculative insertion" started in the same transaction. If + * succeeded is true, the tuple is fully inserted, if false, it's removed. + */ +static inline void +table_tuple_complete_speculative(Relation rel, TupleTableSlot *slot, + uint32 specToken, bool succeeded) +{ + rel->rd_tableam->tuple_complete_speculative(rel, slot, specToken, + succeeded); +} + +/* + * Insert multiple tuples into a table. + * + * This is like table_tuple_insert(), but inserts multiple tuples in one + * operation. That's often faster than calling table_tuple_insert() in a loop, + * because e.g. the AM can reduce WAL logging and page locking overhead. + * + * Except for taking `nslots` tuples as input, and an array of TupleTableSlots + * in `slots`, the parameters for table_multi_insert() are the same as for + * table_tuple_insert(). + * + * Note: this leaks memory into the current memory context. You can create a + * temporary context before calling this, if that's a problem. + */ +static inline void +table_multi_insert(Relation rel, TupleTableSlot **slots, int nslots, + CommandId cid, int options, struct BulkInsertStateData *bistate) +{ + rel->rd_tableam->multi_insert(rel, slots, nslots, + cid, options, bistate); +} + +/* + * Delete a tuple. + * + * NB: do not call this directly unless prepared to deal with + * concurrent-update conditions. Use simple_table_tuple_delete instead. + * + * Input parameters: + * relation - table to be modified (caller must hold suitable lock) + * tid - TID of tuple to be deleted + * cid - delete command ID (used for visibility test, and stored into + * cmax if successful) + * crosscheck - if not InvalidSnapshot, also check tuple against this + * wait - true if should wait for any conflicting update to commit/abort + * Output parameters: + * tmfd - filled in failure cases (see below) + * changingPart - true iff the tuple is being moved to another partition + * table due to an update of the partition key. Otherwise, false. + * + * Normal, successful return value is TM_Ok, which means we did actually + * delete it. Failure return codes are TM_SelfModified, TM_Updated, and + * TM_BeingModified (the last only possible if wait == false). + * + * In the failure cases, the routine fills *tmfd with the tuple's t_ctid, + * t_xmax, and, if possible, t_cmax. See comments for struct + * TM_FailureData for additional info. + */ +static inline TM_Result +table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid, + Snapshot snapshot, Snapshot crosscheck, bool wait, + TM_FailureData *tmfd, bool changingPart) +{ + return rel->rd_tableam->tuple_delete(rel, tid, cid, + snapshot, crosscheck, + wait, tmfd, changingPart); +} + +/* + * Update a tuple. + * + * NB: do not call this directly unless you are prepared to deal with + * concurrent-update conditions. Use simple_table_tuple_update instead. + * + * Input parameters: + * relation - table to be modified (caller must hold suitable lock) + * otid - TID of old tuple to be replaced + * slot - newly constructed tuple data to store + * cid - update command ID (used for visibility test, and stored into + * cmax/cmin if successful) + * crosscheck - if not InvalidSnapshot, also check old tuple against this + * wait - true if should wait for any conflicting update to commit/abort + * Output parameters: + * tmfd - filled in failure cases (see below) + * lockmode - filled with lock mode acquired on tuple + * update_indexes - in success cases this is set if new index entries + * are required for this tuple; see TU_UpdateIndexes + * + * Normal, successful return value is TM_Ok, which means we did actually + * update it. Failure return codes are TM_SelfModified, TM_Updated, and + * TM_BeingModified (the last only possible if wait == false). + * + * On success, the slot's tts_tid and tts_tableOid are updated to match the new + * stored tuple; in particular, slot->tts_tid is set to the TID where the + * new tuple was inserted, and its HEAP_ONLY_TUPLE flag is set iff a HOT + * update was done. However, any TOAST changes in the new tuple's + * data are not reflected into *newtup. + * + * In the failure cases, the routine fills *tmfd with the tuple's t_ctid, + * t_xmax, and, if possible, t_cmax. See comments for struct TM_FailureData + * for additional info. + */ +static inline TM_Result +table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, + CommandId cid, Snapshot snapshot, Snapshot crosscheck, + bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, + TU_UpdateIndexes *update_indexes) +{ + return rel->rd_tableam->tuple_update(rel, otid, slot, + cid, snapshot, crosscheck, + wait, tmfd, + lockmode, update_indexes); +} + +/* + * Lock a tuple in the specified mode. + * + * Input parameters: + * relation: relation containing tuple (caller must hold suitable lock) + * tid: TID of tuple to lock (updated if an update chain was followed) + * snapshot: snapshot to use for visibility determinations + * cid: current command ID (used for visibility test, and stored into + * tuple's cmax if lock is successful) + * mode: lock mode desired + * wait_policy: what to do if tuple lock is not available + * flags: + * If TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS, follow the update chain to + * also lock descendant tuples if lock modes don't conflict. + * If TUPLE_LOCK_FLAG_FIND_LAST_VERSION, follow the update chain and lock + * latest version. + * + * Output parameters: + * *slot: contains the target tuple + * *tmfd: filled in failure cases (see below) + * + * Function result may be: + * TM_Ok: lock was successfully acquired + * TM_Invisible: lock failed because tuple was never visible to us + * TM_SelfModified: lock failed because tuple updated by self + * TM_Updated: lock failed because tuple updated by other xact + * TM_Deleted: lock failed because tuple deleted by other xact + * TM_WouldBlock: lock couldn't be acquired and wait_policy is skip + * + * In the failure cases other than TM_Invisible and TM_Deleted, the routine + * fills *tmfd with the tuple's t_ctid, t_xmax, and, if possible, t_cmax. + * Additionally, in both success and failure cases, tmfd->traversed is set if + * an update chain was followed. See comments for struct TM_FailureData for + * additional info. + */ +static inline TM_Result +table_tuple_lock(Relation rel, ItemPointer tid, Snapshot snapshot, + TupleTableSlot *slot, CommandId cid, LockTupleMode mode, + LockWaitPolicy wait_policy, uint8 flags, + TM_FailureData *tmfd) +{ + return rel->rd_tableam->tuple_lock(rel, tid, snapshot, slot, + cid, mode, wait_policy, + flags, tmfd); +} + +/* + * Perform operations necessary to complete insertions made via + * tuple_insert and multi_insert with a BulkInsertState specified. + */ +static inline void +table_finish_bulk_insert(Relation rel, int options) +{ + /* optional callback */ + if (rel->rd_tableam && rel->rd_tableam->finish_bulk_insert) + rel->rd_tableam->finish_bulk_insert(rel, options); +} + + +/* ------------------------------------------------------------------------ + * DDL related functionality. + * ------------------------------------------------------------------------ + */ + +/* + * Create storage for `rel` in `newrlocator`, with persistence set to + * `persistence`. + * + * This is used both during relation creation and various DDL operations to + * create new rel storage that can be filled from scratch. When creating + * new storage for an existing relfilelocator, this should be called before the + * relcache entry has been updated. + * + * *freezeXid, *minmulti are set to the xid / multixact horizon for the table + * that pg_class.{relfrozenxid, relminmxid} have to be set to. + */ +static inline void +table_relation_set_new_filelocator(Relation rel, + const RelFileLocator *newrlocator, + char persistence, + TransactionId *freezeXid, + MultiXactId *minmulti) +{ + rel->rd_tableam->relation_set_new_filelocator(rel, newrlocator, + persistence, freezeXid, + minmulti); +} + +/* + * Remove all table contents from `rel`, in a non-transactional manner. + * Non-transactional meaning that there's no need to support rollbacks. This + * commonly only is used to perform truncations for relation storage created in + * the current transaction. + */ +static inline void +table_relation_nontransactional_truncate(Relation rel) +{ + rel->rd_tableam->relation_nontransactional_truncate(rel); +} + +/* + * Copy data from `rel` into the new relfilelocator `newrlocator`. The new + * relfilelocator may not have storage associated before this function is + * called. This is only supposed to be used for low level operations like + * changing a relation's tablespace. + */ +static inline void +table_relation_copy_data(Relation rel, const RelFileLocator *newrlocator) +{ + rel->rd_tableam->relation_copy_data(rel, newrlocator); +} + +/* + * Copy data from `OldTable` into `NewTable`, as part of a CLUSTER or VACUUM + * FULL. + * + * Additional Input parameters: + * - use_sort - if true, the table contents are sorted appropriate for + * `OldIndex`; if false and OldIndex is not InvalidOid, the data is copied + * in that index's order; if false and OldIndex is InvalidOid, no sorting is + * performed + * - OldIndex - see use_sort + * - OldestXmin - computed by vacuum_get_cutoffs(), even when + * not needed for the relation's AM + * - *xid_cutoff - ditto + * - *multi_cutoff - ditto + * + * Output parameters: + * - *xid_cutoff - rel's new relfrozenxid value, may be invalid + * - *multi_cutoff - rel's new relminmxid value, may be invalid + * - *tups_vacuumed - stats, for logging, if appropriate for AM + * - *tups_recently_dead - stats, for logging, if appropriate for AM + */ +static inline void +table_relation_copy_for_cluster(Relation OldTable, Relation NewTable, + Relation OldIndex, + bool use_sort, + TransactionId OldestXmin, + TransactionId *xid_cutoff, + MultiXactId *multi_cutoff, + double *num_tuples, + double *tups_vacuumed, + double *tups_recently_dead) +{ + OldTable->rd_tableam->relation_copy_for_cluster(OldTable, NewTable, OldIndex, + use_sort, OldestXmin, + xid_cutoff, multi_cutoff, + num_tuples, tups_vacuumed, + tups_recently_dead); +} + +/* + * Perform VACUUM on the relation. The VACUUM can be triggered by a user or by + * autovacuum. The specific actions performed by the AM will depend heavily on + * the individual AM. + * + * On entry a transaction needs to already been established, and the + * table is locked with a ShareUpdateExclusive lock. + * + * Note that neither VACUUM FULL (and CLUSTER), nor ANALYZE go through this + * routine, even if (for ANALYZE) it is part of the same VACUUM command. + */ +static inline void +table_relation_vacuum(Relation rel, struct VacuumParams *params, + BufferAccessStrategy bstrategy) +{ + rel->rd_tableam->relation_vacuum(rel, params, bstrategy); +} + +/* + * Prepare to analyze the next block in the read stream. The scan needs to + * have been started with table_beginscan_analyze(). Note that this routine + * might acquire resources like locks that are held until + * table_scan_analyze_next_tuple() returns false. + * + * Returns false if block is unsuitable for sampling, true otherwise. + */ +static inline bool +table_scan_analyze_next_block(TableScanDesc scan, ReadStream *stream) +{ + return scan->rs_rd->rd_tableam->scan_analyze_next_block(scan, stream); +} + +/* + * Iterate over tuples in the block selected with + * table_scan_analyze_next_block() (which needs to have returned true, and + * this routine may not have returned false for the same block before). If a + * tuple that's suitable for sampling is found, true is returned and a tuple + * is stored in `slot`. + * + * *liverows and *deadrows are incremented according to the encountered + * tuples. + */ +static inline bool +table_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin, + double *liverows, double *deadrows, + TupleTableSlot *slot) +{ + return scan->rs_rd->rd_tableam->scan_analyze_next_tuple(scan, OldestXmin, + liverows, deadrows, + slot); +} + +/* + * table_index_build_scan - scan the table to find tuples to be indexed + * + * This is called back from an access-method-specific index build procedure + * after the AM has done whatever setup it needs. The parent table relation + * is scanned to find tuples that should be entered into the index. Each + * such tuple is passed to the AM's callback routine, which does the right + * things to add it to the new index. After we return, the AM's index + * build procedure does whatever cleanup it needs. + * + * The total count of live tuples is returned. This is for updating pg_class + * statistics. (It's annoying not to be able to do that here, but we want to + * merge that update with others; see index_update_stats.) Note that the + * index AM itself must keep track of the number of index tuples; we don't do + * so here because the AM might reject some of the tuples for its own reasons, + * such as being unable to store NULLs. + * + * If 'progress', the PROGRESS_SCAN_BLOCKS_TOTAL counter is updated when + * starting the scan, and PROGRESS_SCAN_BLOCKS_DONE is updated as we go along. + * + * A side effect is to set indexInfo->ii_BrokenHotChain to true if we detect + * any potentially broken HOT chains. Currently, we set this if there are any + * RECENTLY_DEAD or DELETE_IN_PROGRESS entries in a HOT chain, without trying + * very hard to detect whether they're really incompatible with the chain tip. + * This only really makes sense for heap AM, it might need to be generalized + * for other AMs later. + */ +static inline double +table_index_build_scan(Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + bool allow_sync, + bool progress, + IndexBuildCallback callback, + void *callback_state, + TableScanDesc scan) +{ + return table_rel->rd_tableam->index_build_range_scan(table_rel, + index_rel, + index_info, + allow_sync, + false, + progress, + 0, + InvalidBlockNumber, + callback, + callback_state, + scan); +} + +/* + * As table_index_build_scan(), except that instead of scanning the complete + * table, only the given number of blocks are scanned. Scan to end-of-rel can + * be signaled by passing InvalidBlockNumber as numblocks. Note that + * restricting the range to scan cannot be done when requesting syncscan. + * + * When "anyvisible" mode is requested, all tuples visible to any transaction + * are indexed and counted as live, including those inserted or deleted by + * transactions that are still in progress. + */ +static inline double +table_index_build_range_scan(Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + bool allow_sync, + bool anyvisible, + bool progress, + BlockNumber start_blockno, + BlockNumber numblocks, + IndexBuildCallback callback, + void *callback_state, + TableScanDesc scan) +{ + return table_rel->rd_tableam->index_build_range_scan(table_rel, + index_rel, + index_info, + allow_sync, + anyvisible, + progress, + start_blockno, + numblocks, + callback, + callback_state, + scan); +} + +/* + * table_index_validate_scan - second table scan for concurrent index build + * + * See validate_index() for an explanation. + */ +static inline void +table_index_validate_scan(Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + Snapshot snapshot, + struct ValidateIndexState *state) +{ + table_rel->rd_tableam->index_validate_scan(table_rel, + index_rel, + index_info, + snapshot, + state); +} + + +/* ---------------------------------------------------------------------------- + * Miscellaneous functionality + * ---------------------------------------------------------------------------- + */ + +/* + * Return the current size of `rel` in bytes. If `forkNumber` is + * InvalidForkNumber, return the relation's overall size, otherwise the size + * for the indicated fork. + * + * Note that the overall size might not be the equivalent of the sum of sizes + * for the individual forks for some AMs, e.g. because the AMs storage does + * not neatly map onto the builtin types of forks. + */ +static inline uint64 +table_relation_size(Relation rel, ForkNumber forkNumber) +{ + return rel->rd_tableam->relation_size(rel, forkNumber); +} + +/* + * table_relation_needs_toast_table - does this relation need a toast table? + */ +static inline bool +table_relation_needs_toast_table(Relation rel) +{ + return rel->rd_tableam->relation_needs_toast_table(rel); +} + +/* + * Return the OID of the AM that should be used to implement the TOAST table + * for this relation. + */ +static inline Oid +table_relation_toast_am(Relation rel) +{ + return rel->rd_tableam->relation_toast_am(rel); +} + +/* + * Fetch all or part of a TOAST value from a TOAST table. + * + * If this AM is never used to implement a TOAST table, then this callback + * is not needed. But, if toasted values are ever stored in a table of this + * type, then you will need this callback. + * + * toastrel is the relation in which the toasted value is stored. + * + * valueid identifies which toast value is to be fetched. For the heap, + * this corresponds to the values stored in the chunk_id column. + * + * attrsize is the total size of the toast value to be fetched. + * + * sliceoffset is the offset within the toast value of the first byte that + * should be fetched. + * + * slicelength is the number of bytes from the toast value that should be + * fetched. + * + * result is caller-allocated space into which the fetched bytes should be + * stored. + */ +static inline void +table_relation_fetch_toast_slice(Relation toastrel, Oid valueid, + int32 attrsize, int32 sliceoffset, + int32 slicelength, struct varlena *result) +{ + toastrel->rd_tableam->relation_fetch_toast_slice(toastrel, valueid, + attrsize, + sliceoffset, slicelength, + result); +} + + +/* ---------------------------------------------------------------------------- + * Planner related functionality + * ---------------------------------------------------------------------------- + */ + +/* + * Estimate the current size of the relation, as an AM specific workhorse for + * estimate_rel_size(). Look there for an explanation of the parameters. + */ +static inline void +table_relation_estimate_size(Relation rel, int32 *attr_widths, + BlockNumber *pages, double *tuples, + double *allvisfrac) +{ + rel->rd_tableam->relation_estimate_size(rel, attr_widths, pages, tuples, + allvisfrac); +} + + +/* ---------------------------------------------------------------------------- + * Executor related functionality + * ---------------------------------------------------------------------------- + */ + +/* + * Fetch / check / return tuples as part of a bitmap table scan. `scan` needs + * to have been started via table_beginscan_bm(). Fetch the next tuple of a + * bitmap table scan into `slot` and return true if a visible tuple was found, + * false otherwise. + * + * `recheck` is set by the table AM to indicate whether or not the tuple in + * `slot` should be rechecked. Tuples from lossy pages will always need to be + * rechecked, but some non-lossy pages' tuples may also require recheck. + * + * `lossy_pages` is incremented if the block's representation in the bitmap is + * lossy; otherwise, `exact_pages` is incremented. + */ +static inline bool +table_scan_bitmap_next_tuple(TableScanDesc scan, + TupleTableSlot *slot, + bool *recheck, + uint64 *lossy_pages, + uint64 *exact_pages) +{ + /* + * We don't expect direct calls to table_scan_bitmap_next_tuple with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_scan_bitmap_next_tuple call during logical decoding"); + + return scan->rs_rd->rd_tableam->scan_bitmap_next_tuple(scan, + slot, + recheck, + lossy_pages, + exact_pages); +} + +/* + * Prepare to fetch tuples from the next block in a sample scan. Returns false + * if the sample scan is finished, true otherwise. `scan` needs to have been + * started via table_beginscan_sampling(). + * + * This will call the TsmRoutine's NextSampleBlock() callback if necessary + * (i.e. NextSampleBlock is not NULL), or perform a sequential scan over the + * underlying relation. + */ +static inline bool +table_scan_sample_next_block(TableScanDesc scan, + struct SampleScanState *scanstate) +{ + /* + * We don't expect direct calls to table_scan_sample_next_block with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_scan_sample_next_block call during logical decoding"); + return scan->rs_rd->rd_tableam->scan_sample_next_block(scan, scanstate); +} + +/* + * Fetch the next sample tuple into `slot` and return true if a visible tuple + * was found, false otherwise. table_scan_sample_next_block() needs to + * previously have selected a block (i.e. returned true), and no previous + * table_scan_sample_next_tuple() for the same block may have returned false. + * + * This will call the TsmRoutine's NextSampleTuple() callback. + */ +static inline bool +table_scan_sample_next_tuple(TableScanDesc scan, + struct SampleScanState *scanstate, + TupleTableSlot *slot) +{ + /* + * We don't expect direct calls to table_scan_sample_next_tuple with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_scan_sample_next_tuple call during logical decoding"); + return scan->rs_rd->rd_tableam->scan_sample_next_tuple(scan, scanstate, + slot); +} + + +/* ---------------------------------------------------------------------------- + * Functions to make modifications a bit simpler. + * ---------------------------------------------------------------------------- + */ + +extern void simple_table_tuple_insert(Relation rel, TupleTableSlot *slot); +extern void simple_table_tuple_delete(Relation rel, ItemPointer tid, + Snapshot snapshot); +extern void simple_table_tuple_update(Relation rel, ItemPointer otid, + TupleTableSlot *slot, Snapshot snapshot, + TU_UpdateIndexes *update_indexes); + + +/* ---------------------------------------------------------------------------- + * Helper functions to implement parallel scans for block oriented AMs. + * ---------------------------------------------------------------------------- + */ + +extern Size table_block_parallelscan_estimate(Relation rel); +extern Size table_block_parallelscan_initialize(Relation rel, + ParallelTableScanDesc pscan); +extern void table_block_parallelscan_reinitialize(Relation rel, + ParallelTableScanDesc pscan); +extern BlockNumber table_block_parallelscan_nextpage(Relation rel, + ParallelBlockTableScanWorker pbscanwork, + ParallelBlockTableScanDesc pbscan); +extern void table_block_parallelscan_startblock_init(Relation rel, + ParallelBlockTableScanWorker pbscanwork, + ParallelBlockTableScanDesc pbscan); + + +/* ---------------------------------------------------------------------------- + * Helper functions to implement relation sizing for block oriented AMs. + * ---------------------------------------------------------------------------- + */ + +extern uint64 table_block_relation_size(Relation rel, ForkNumber forkNumber); +extern void table_block_relation_estimate_size(Relation rel, + int32 *attr_widths, + BlockNumber *pages, + double *tuples, + double *allvisfrac, + Size overhead_bytes_per_tuple, + Size usable_bytes_per_page); + +/* ---------------------------------------------------------------------------- + * Functions in tableamapi.c + * ---------------------------------------------------------------------------- + */ + +extern const TableAmRoutine *GetTableAmRoutine(Oid amhandler); + +/* ---------------------------------------------------------------------------- + * Functions in heapam_handler.c + * ---------------------------------------------------------------------------- + */ + +extern const TableAmRoutine *GetHeapamTableAmRoutine(void); + +#endif /* TABLEAM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tidstore.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tidstore.h new file mode 100644 index 0000000..041091d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tidstore.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * tidstore.h + * TidStore interface. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tidstore.h + * + *------------------------------------------------------------------------- + */ +#ifndef TIDSTORE_H +#define TIDSTORE_H + +#include "storage/itemptr.h" +#include "utils/dsa.h" + +typedef struct TidStore TidStore; +typedef struct TidStoreIter TidStoreIter; + +/* + * Result struct for TidStoreIterateNext. This is copyable, but should be + * treated as opaque. Call TidStoreGetBlockOffsets() to obtain the offsets. + */ +typedef struct TidStoreIterResult +{ + BlockNumber blkno; + void *internal_page; +} TidStoreIterResult; + +extern TidStore *TidStoreCreateLocal(size_t max_bytes, bool insert_only); +extern TidStore *TidStoreCreateShared(size_t max_bytes, int tranche_id); +extern TidStore *TidStoreAttach(dsa_handle area_handle, dsa_pointer handle); +extern void TidStoreDetach(TidStore *ts); +extern void TidStoreLockExclusive(TidStore *ts); +extern void TidStoreLockShare(TidStore *ts); +extern void TidStoreUnlock(TidStore *ts); +extern void TidStoreDestroy(TidStore *ts); +extern void TidStoreSetBlockOffsets(TidStore *ts, BlockNumber blkno, OffsetNumber *offsets, + int num_offsets); +extern bool TidStoreIsMember(TidStore *ts, ItemPointer tid); +extern TidStoreIter *TidStoreBeginIterate(TidStore *ts); +extern TidStoreIterResult *TidStoreIterateNext(TidStoreIter *iter); +extern int TidStoreGetBlockOffsets(TidStoreIterResult *result, + OffsetNumber *offsets, + int max_offsets); +extern void TidStoreEndIterate(TidStoreIter *iter); +extern size_t TidStoreMemoryUsage(TidStore *ts); +extern dsa_pointer TidStoreGetHandle(TidStore *ts); +extern dsa_area *TidStoreGetDSA(TidStore *ts); + +#endif /* TIDSTORE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/timeline.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/timeline.h new file mode 100644 index 0000000..219b580 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/timeline.h @@ -0,0 +1,44 @@ +/* + * timeline.h + * + * Functions for reading and writing timeline history files. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/timeline.h + */ +#ifndef TIMELINE_H +#define TIMELINE_H + +#include "access/xlogdefs.h" +#include "nodes/pg_list.h" + +/* + * A list of these structs describes the timeline history of the server. Each + * TimeLineHistoryEntry represents a piece of WAL belonging to the history, + * from newest to oldest. All WAL locations between 'begin' and 'end' belong to + * the timeline represented by the entry. Together the 'begin' and 'end' + * pointers of all the entries form a contiguous line from beginning of time + * to infinity. + */ +typedef struct +{ + TimeLineID tli; + XLogRecPtr begin; /* inclusive */ + XLogRecPtr end; /* exclusive, InvalidXLogRecPtr means infinity */ +} TimeLineHistoryEntry; + +extern List *readTimeLineHistory(TimeLineID targetTLI); +extern bool existsTimeLineHistory(TimeLineID probeTLI); +extern TimeLineID findNewestTimeLine(TimeLineID startTLI); +extern void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, + XLogRecPtr switchpoint, char *reason); +extern void writeTimeLineHistoryFile(TimeLineID tli, char *content, int size); +extern void restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end); +extern bool tliInHistory(TimeLineID tli, List *expectedTLEs); +extern TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history); +extern XLogRecPtr tliSwitchPoint(TimeLineID tli, List *history, + TimeLineID *nextTLI); + +#endif /* TIMELINE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/toast_compression.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/toast_compression.h new file mode 100644 index 0000000..13c4612 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/toast_compression.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------- + * + * toast_compression.h + * Functions for toast compression. + * + * Copyright (c) 2021-2025, PostgreSQL Global Development Group + * + * src/include/access/toast_compression.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TOAST_COMPRESSION_H +#define TOAST_COMPRESSION_H + +/* + * GUC support. + * + * default_toast_compression is an integer for purposes of the GUC machinery, + * but the value is one of the char values defined below, as they appear in + * pg_attribute.attcompression, e.g. TOAST_PGLZ_COMPRESSION. + */ +extern PGDLLIMPORT int default_toast_compression; + +/* + * Built-in compression method ID. The toast compression header will store + * this in the first 2 bits of the raw length. These built-in compression + * method IDs are directly mapped to the built-in compression methods. + * + * Don't use these values for anything other than understanding the meaning + * of the raw bits from a varlena; in particular, if the goal is to identify + * a compression method, use the constants TOAST_PGLZ_COMPRESSION, etc. + * below. We might someday support more than 4 compression methods, but + * we can never have more than 4 values in this enum, because there are + * only 2 bits available in the places where this is stored. + */ +typedef enum ToastCompressionId +{ + TOAST_PGLZ_COMPRESSION_ID = 0, + TOAST_LZ4_COMPRESSION_ID = 1, + TOAST_INVALID_COMPRESSION_ID = 2, +} ToastCompressionId; + +/* + * Built-in compression methods. pg_attribute will store these in the + * attcompression column. In attcompression, InvalidCompressionMethod + * denotes the default behavior. + */ +#define TOAST_PGLZ_COMPRESSION 'p' +#define TOAST_LZ4_COMPRESSION 'l' +#define InvalidCompressionMethod '\0' + +#define CompressionMethodIsValid(cm) ((cm) != InvalidCompressionMethod) + + +/* pglz compression/decompression routines */ +extern struct varlena *pglz_compress_datum(const struct varlena *value); +extern struct varlena *pglz_decompress_datum(const struct varlena *value); +extern struct varlena *pglz_decompress_datum_slice(const struct varlena *value, + int32 slicelength); + +/* lz4 compression/decompression routines */ +extern struct varlena *lz4_compress_datum(const struct varlena *value); +extern struct varlena *lz4_decompress_datum(const struct varlena *value); +extern struct varlena *lz4_decompress_datum_slice(const struct varlena *value, + int32 slicelength); + +/* other stuff */ +extern ToastCompressionId toast_get_compression_id(struct varlena *attr); +extern char CompressionNameToMethod(const char *compression); +extern const char *GetCompressionMethodName(char method); + +#endif /* TOAST_COMPRESSION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/toast_helper.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/toast_helper.h new file mode 100644 index 0000000..e6ab8af --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/toast_helper.h @@ -0,0 +1,116 @@ +/*------------------------------------------------------------------------- + * + * toast_helper.h + * Helper functions for table AMs implementing compressed or + * out-of-line storage of varlena attributes. + * + * Copyright (c) 2000-2025, PostgreSQL Global Development Group + * + * src/include/access/toast_helper.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TOAST_HELPER_H +#define TOAST_HELPER_H + +#include "utils/rel.h" + +/* + * Information about one column of a tuple being toasted. + * + * NOTE: toast_action[i] can have these values: + * ' ' default handling + * TYPSTORAGE_PLAIN already processed --- don't touch it + * TYPSTORAGE_EXTENDED incompressible, but OK to move off + * + * NOTE: toast_attr[i].tai_size is only made valid for varlena attributes with + * toast_action[i] different from TYPSTORAGE_PLAIN. + */ +typedef struct +{ + struct varlena *tai_oldexternal; + int32 tai_size; + uint8 tai_colflags; + char tai_compression; +} ToastAttrInfo; + +/* + * Information about one tuple being toasted. + */ +typedef struct +{ + /* + * Before calling toast_tuple_init, the caller must initialize the + * following fields. Each array must have a length equal to + * ttc_rel->rd_att->natts. The ttc_oldvalues and ttc_oldisnull fields + * should be NULL in the case of an insert. + */ + Relation ttc_rel; /* the relation that contains the tuple */ + Datum *ttc_values; /* values from the tuple columns */ + bool *ttc_isnull; /* null flags for the tuple columns */ + Datum *ttc_oldvalues; /* values from previous tuple */ + bool *ttc_oldisnull; /* null flags from previous tuple */ + + /* + * Before calling toast_tuple_init, the caller should set ttc_attr to + * point to an array of ToastAttrInfo structures of a length equal to + * ttc_rel->rd_att->natts. The contents of the array need not be + * initialized. ttc_flags also does not need to be initialized. + */ + uint8 ttc_flags; + ToastAttrInfo *ttc_attr; +} ToastTupleContext; + +/* + * Flags indicating the overall state of a TOAST operation. + * + * TOAST_NEEDS_DELETE_OLD indicates that one or more old TOAST datums need + * to be deleted. + * + * TOAST_NEEDS_FREE indicates that one or more TOAST values need to be freed. + * + * TOAST_HAS_NULLS indicates that nulls were found in the tuple being toasted. + * + * TOAST_NEEDS_CHANGE indicates that a new tuple needs to built; in other + * words, the toaster did something. + */ +#define TOAST_NEEDS_DELETE_OLD 0x0001 +#define TOAST_NEEDS_FREE 0x0002 +#define TOAST_HAS_NULLS 0x0004 +#define TOAST_NEEDS_CHANGE 0x0008 + +/* + * Flags indicating the status of a TOAST operation with respect to a + * particular column. + * + * TOASTCOL_NEEDS_DELETE_OLD indicates that the old TOAST datums for this + * column need to be deleted. + * + * TOASTCOL_NEEDS_FREE indicates that the value for this column needs to + * be freed. + * + * TOASTCOL_IGNORE indicates that the toaster should not further process + * this column. + * + * TOASTCOL_INCOMPRESSIBLE indicates that this column has been found to + * be incompressible, but could be moved out-of-line. + */ +#define TOASTCOL_NEEDS_DELETE_OLD TOAST_NEEDS_DELETE_OLD +#define TOASTCOL_NEEDS_FREE TOAST_NEEDS_FREE +#define TOASTCOL_IGNORE 0x0010 +#define TOASTCOL_INCOMPRESSIBLE 0x0020 + +extern void toast_tuple_init(ToastTupleContext *ttc); +extern int toast_tuple_find_biggest_attribute(ToastTupleContext *ttc, + bool for_compression, + bool check_main); +extern void toast_tuple_try_compression(ToastTupleContext *ttc, int attribute); +extern void toast_tuple_externalize(ToastTupleContext *ttc, int attribute, + int options); +extern void toast_tuple_cleanup(ToastTupleContext *ttc); + +extern void toast_delete_external(Relation rel, const Datum *values, const bool *isnull, + bool is_speculative); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/toast_internals.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/toast_internals.h new file mode 100644 index 0000000..06ae858 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/toast_internals.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * toast_internals.h + * Internal definitions for the TOAST system. + * + * Copyright (c) 2000-2025, PostgreSQL Global Development Group + * + * src/include/access/toast_internals.h + * + *------------------------------------------------------------------------- + */ +#ifndef TOAST_INTERNALS_H +#define TOAST_INTERNALS_H + +#include "access/toast_compression.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + +/* + * The information at the start of the compressed toast data. + */ +typedef struct toast_compress_header +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint32 tcinfo; /* 2 bits for compression method and 30 bits + * external size; see va_extinfo */ +} toast_compress_header; + +/* + * Utilities for manipulation of header information for compressed + * toast entries. + */ +#define TOAST_COMPRESS_EXTSIZE(ptr) \ + (((toast_compress_header *) (ptr))->tcinfo & VARLENA_EXTSIZE_MASK) +#define TOAST_COMPRESS_METHOD(ptr) \ + (((toast_compress_header *) (ptr))->tcinfo >> VARLENA_EXTSIZE_BITS) + +#define TOAST_COMPRESS_SET_SIZE_AND_COMPRESS_METHOD(ptr, len, cm_method) \ + do { \ + Assert((len) > 0 && (len) <= VARLENA_EXTSIZE_MASK); \ + Assert((cm_method) == TOAST_PGLZ_COMPRESSION_ID || \ + (cm_method) == TOAST_LZ4_COMPRESSION_ID); \ + ((toast_compress_header *) (ptr))->tcinfo = \ + (len) | ((uint32) (cm_method) << VARLENA_EXTSIZE_BITS); \ + } while (0) + +extern Datum toast_compress_datum(Datum value, char cmethod); +extern Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock); + +extern void toast_delete_datum(Relation rel, Datum value, bool is_speculative); +extern Datum toast_save_datum(Relation rel, Datum value, + struct varlena *oldexternal, int options); + +extern int toast_open_indexes(Relation toastrel, + LOCKMODE lock, + Relation **toastidxs, + int *num_indexes); +extern void toast_close_indexes(Relation *toastidxs, int num_indexes, + LOCKMODE lock); +extern Snapshot get_toast_snapshot(void); + +#endif /* TOAST_INTERNALS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/transam.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/transam.h new file mode 100644 index 0000000..7d82cd2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/transam.h @@ -0,0 +1,418 @@ +/*------------------------------------------------------------------------- + * + * transam.h + * postgres transaction access method support code + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/transam.h + * + *------------------------------------------------------------------------- + */ +#ifndef TRANSAM_H +#define TRANSAM_H + +#include "access/xlogdefs.h" + + +/* ---------------- + * Special transaction ID values + * + * BootstrapTransactionId is the XID for "bootstrap" operations, and + * FrozenTransactionId is used for very old tuples. Both should + * always be considered valid. + * + * FirstNormalTransactionId is the first "normal" transaction id. + * Note: if you need to change it, you must change pg_class.h as well. + * ---------------- + */ +#define InvalidTransactionId ((TransactionId) 0) +#define BootstrapTransactionId ((TransactionId) 1) +#define FrozenTransactionId ((TransactionId) 2) +#define FirstNormalTransactionId ((TransactionId) 3) +#define MaxTransactionId ((TransactionId) 0xFFFFFFFF) + +/* ---------------- + * transaction ID manipulation macros + * ---------------- + */ +#define TransactionIdIsValid(xid) ((xid) != InvalidTransactionId) +#define TransactionIdIsNormal(xid) ((xid) >= FirstNormalTransactionId) +#define TransactionIdEquals(id1, id2) ((id1) == (id2)) +#define TransactionIdStore(xid, dest) (*(dest) = (xid)) +#define StoreInvalidTransactionId(dest) (*(dest) = InvalidTransactionId) + +#define EpochFromFullTransactionId(x) ((uint32) ((x).value >> 32)) +#define XidFromFullTransactionId(x) ((uint32) (x).value) +#define U64FromFullTransactionId(x) ((x).value) +#define FullTransactionIdEquals(a, b) ((a).value == (b).value) +#define FullTransactionIdPrecedes(a, b) ((a).value < (b).value) +#define FullTransactionIdPrecedesOrEquals(a, b) ((a).value <= (b).value) +#define FullTransactionIdFollows(a, b) ((a).value > (b).value) +#define FullTransactionIdFollowsOrEquals(a, b) ((a).value >= (b).value) +#define FullTransactionIdIsValid(x) TransactionIdIsValid(XidFromFullTransactionId(x)) +#define InvalidFullTransactionId FullTransactionIdFromEpochAndXid(0, InvalidTransactionId) +#define FirstNormalFullTransactionId FullTransactionIdFromEpochAndXid(0, FirstNormalTransactionId) +#define FullTransactionIdIsNormal(x) FullTransactionIdFollowsOrEquals(x, FirstNormalFullTransactionId) + +/* + * A 64 bit value that contains an epoch and a TransactionId. This is + * wrapped in a struct to prevent implicit conversion to/from TransactionId. + * Not all values represent valid normal XIDs. + */ +typedef struct FullTransactionId +{ + uint64 value; +} FullTransactionId; + +static inline FullTransactionId +FullTransactionIdFromEpochAndXid(uint32 epoch, TransactionId xid) +{ + FullTransactionId result; + + result.value = ((uint64) epoch) << 32 | xid; + + return result; +} + +static inline FullTransactionId +FullTransactionIdFromU64(uint64 value) +{ + FullTransactionId result; + + result.value = value; + + return result; +} + +/* advance a transaction ID variable, handling wraparound correctly */ +#define TransactionIdAdvance(dest) \ + do { \ + (dest)++; \ + if ((dest) < FirstNormalTransactionId) \ + (dest) = FirstNormalTransactionId; \ + } while(0) + +/* + * Retreat a FullTransactionId variable, stepping over xids that would appear + * to be special only when viewed as 32bit XIDs. + */ +static inline void +FullTransactionIdRetreat(FullTransactionId *dest) +{ + dest->value--; + + /* + * In contrast to 32bit XIDs don't step over the "actual" special xids. + * For 64bit xids these can't be reached as part of a wraparound as they + * can in the 32bit case. + */ + if (FullTransactionIdPrecedes(*dest, FirstNormalFullTransactionId)) + return; + + /* + * But we do need to step over XIDs that'd appear special only for 32bit + * XIDs. + */ + while (XidFromFullTransactionId(*dest) < FirstNormalTransactionId) + dest->value--; +} + +/* + * Advance a FullTransactionId variable, stepping over xids that would appear + * to be special only when viewed as 32bit XIDs. + */ +static inline void +FullTransactionIdAdvance(FullTransactionId *dest) +{ + dest->value++; + + /* see FullTransactionIdAdvance() */ + if (FullTransactionIdPrecedes(*dest, FirstNormalFullTransactionId)) + return; + + while (XidFromFullTransactionId(*dest) < FirstNormalTransactionId) + dest->value++; +} + +/* back up a transaction ID variable, handling wraparound correctly */ +#define TransactionIdRetreat(dest) \ + do { \ + (dest)--; \ + } while ((dest) < FirstNormalTransactionId) + +/* compare two XIDs already known to be normal; this is a macro for speed */ +#define NormalTransactionIdPrecedes(id1, id2) \ + (AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \ + (int32) ((id1) - (id2)) < 0) + +/* compare two XIDs already known to be normal; this is a macro for speed */ +#define NormalTransactionIdFollows(id1, id2) \ + (AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \ + (int32) ((id1) - (id2)) > 0) + +/* ---------- + * Object ID (OID) zero is InvalidOid. + * + * OIDs 1-9999 are reserved for manual assignment (see .dat files in + * src/include/catalog/). Of these, 8000-9999 are reserved for + * development purposes (such as in-progress patches and forks); + * they should not appear in released versions. + * + * OIDs 10000-11999 are reserved for assignment by genbki.pl, for use + * when the .dat files in src/include/catalog/ do not specify an OID + * for a catalog entry that requires one. Note that genbki.pl assigns + * these OIDs independently in each catalog, so they're not guaranteed + * to be globally unique. Furthermore, the bootstrap backend and + * initdb's post-bootstrap processing can also assign OIDs in this range. + * The normal OID-generation logic takes care of any OID conflicts that + * might arise from that. + * + * OIDs 12000-16383 are reserved for unpinned objects created by initdb's + * post-bootstrap processing. initdb forces the OID generator up to + * 12000 as soon as it's made the pinned objects it's responsible for. + * + * OIDs beginning at 16384 are assigned from the OID generator + * during normal multiuser operation. (We force the generator up to + * 16384 as soon as we are in normal operation.) + * + * The choices of 8000, 10000 and 12000 are completely arbitrary, and can be + * moved if we run low on OIDs in any category. Changing the macros below, + * and updating relevant documentation (see bki.sgml and RELEASE_CHANGES), + * should be sufficient to do this. Moving the 16384 boundary between + * initdb-assigned OIDs and user-defined objects would be substantially + * more painful, however, since some user-defined OIDs will appear in + * on-disk data; such a change would probably break pg_upgrade. + * + * NOTE: if the OID generator wraps around, we skip over OIDs 0-16383 + * and resume with 16384. This minimizes the odds of OID conflict, by not + * reassigning OIDs that might have been assigned during initdb. Critically, + * it also ensures that no user-created object will be considered pinned. + * ---------- + */ +#define FirstGenbkiObjectId 10000 +#define FirstUnpinnedObjectId 12000 +#define FirstNormalObjectId 16384 + +/* + * TransamVariables is a data structure in shared memory that is used to track + * OID and XID assignment state. For largely historical reasons, there is + * just one struct with different fields that are protected by different + * LWLocks. + * + * Note: xidWrapLimit and oldestXidDB are not "active" values, but are + * used just to generate useful messages when xidWarnLimit or xidStopLimit + * are exceeded. + */ +typedef struct TransamVariablesData +{ + /* + * These fields are protected by OidGenLock. + */ + Oid nextOid; /* next OID to assign */ + uint32 oidCount; /* OIDs available before must do XLOG work */ + + /* + * These fields are protected by XidGenLock. + */ + FullTransactionId nextXid; /* next XID to assign */ + + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + TransactionId xidVacLimit; /* start forcing autovacuums here */ + TransactionId xidWarnLimit; /* start complaining here */ + TransactionId xidStopLimit; /* refuse to advance nextXid beyond here */ + TransactionId xidWrapLimit; /* where the world ends */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + + /* + * These fields are protected by CommitTsLock + */ + TransactionId oldestCommitTsXid; + TransactionId newestCommitTsXid; + + /* + * These fields are protected by ProcArrayLock. + */ + FullTransactionId latestCompletedXid; /* newest full XID that has + * committed or aborted */ + + /* + * Number of top-level transactions with xids (i.e. which may have + * modified the database) that completed in some form since the start of + * the server. This currently is solely used to check whether + * GetSnapshotData() needs to recompute the contents of the snapshot, or + * not. There are likely other users of this. Always above 1. + */ + uint64 xactCompletionCount; + + /* + * These fields are protected by XactTruncationLock + */ + TransactionId oldestClogXid; /* oldest it's safe to look up in clog */ + +} TransamVariablesData; + + +/* ---------------- + * extern declarations + * ---------------- + */ + +/* in transam/xact.c */ +extern bool TransactionStartedDuringRecovery(void); + +/* in transam/varsup.c */ +extern PGDLLIMPORT TransamVariablesData *TransamVariables; + +/* + * prototypes for functions in transam/transam.c + */ +extern bool TransactionIdDidCommit(TransactionId transactionId); +extern bool TransactionIdDidAbort(TransactionId transactionId); +extern void TransactionIdCommitTree(TransactionId xid, int nxids, TransactionId *xids); +extern void TransactionIdAsyncCommitTree(TransactionId xid, int nxids, TransactionId *xids, XLogRecPtr lsn); +extern void TransactionIdAbortTree(TransactionId xid, int nxids, TransactionId *xids); +extern bool TransactionIdPrecedes(TransactionId id1, TransactionId id2); +extern bool TransactionIdPrecedesOrEquals(TransactionId id1, TransactionId id2); +extern bool TransactionIdFollows(TransactionId id1, TransactionId id2); +extern bool TransactionIdFollowsOrEquals(TransactionId id1, TransactionId id2); +extern TransactionId TransactionIdLatest(TransactionId mainxid, + int nxids, const TransactionId *xids); +extern XLogRecPtr TransactionIdGetCommitLSN(TransactionId xid); + +/* in transam/varsup.c */ +extern Size VarsupShmemSize(void); +extern void VarsupShmemInit(void); +extern FullTransactionId GetNewTransactionId(bool isSubXact); +extern void AdvanceNextFullTransactionIdPastXid(TransactionId xid); +extern FullTransactionId ReadNextFullTransactionId(void); +extern void SetTransactionIdLimit(TransactionId oldest_datfrozenxid, + Oid oldest_datoid); +extern void AdvanceOldestClogXid(TransactionId oldest_datfrozenxid); +extern bool ForceTransactionIdLimitUpdate(void); +extern Oid GetNewObjectId(void); +extern void StopGeneratingPinnedObjectIds(void); + +#ifdef USE_ASSERT_CHECKING +extern void AssertTransactionIdInAllowableRange(TransactionId xid); +#else +#define AssertTransactionIdInAllowableRange(xid) ((void)true) +#endif + +/* + * Some frontend programs include this header. For compilers that emit static + * inline functions even when they're unused, that leads to unsatisfied + * external references; hence hide them with #ifndef FRONTEND. + */ +#ifndef FRONTEND + +/* + * For callers that just need the XID part of the next transaction ID. + */ +static inline TransactionId +ReadNextTransactionId(void) +{ + return XidFromFullTransactionId(ReadNextFullTransactionId()); +} + +/* return transaction ID backed up by amount, handling wraparound correctly */ +static inline TransactionId +TransactionIdRetreatedBy(TransactionId xid, uint32 amount) +{ + xid -= amount; + + while (xid < FirstNormalTransactionId) + xid--; + + return xid; +} + +/* return the older of the two IDs */ +static inline TransactionId +TransactionIdOlder(TransactionId a, TransactionId b) +{ + if (!TransactionIdIsValid(a)) + return b; + + if (!TransactionIdIsValid(b)) + return a; + + if (TransactionIdPrecedes(a, b)) + return a; + return b; +} + +/* return the older of the two IDs, assuming they're both normal */ +static inline TransactionId +NormalTransactionIdOlder(TransactionId a, TransactionId b) +{ + Assert(TransactionIdIsNormal(a)); + Assert(TransactionIdIsNormal(b)); + if (NormalTransactionIdPrecedes(a, b)) + return a; + return b; +} + +/* return the newer of the two IDs */ +static inline FullTransactionId +FullTransactionIdNewer(FullTransactionId a, FullTransactionId b) +{ + if (!FullTransactionIdIsValid(a)) + return b; + + if (!FullTransactionIdIsValid(b)) + return a; + + if (FullTransactionIdFollows(a, b)) + return a; + return b; +} + +/* + * Compute FullTransactionId for the given TransactionId, assuming xid was + * between [oldestXid, nextXid] at the time when TransamVariables->nextXid was + * nextFullXid. When adding calls, evaluate what prevents xid from preceding + * oldestXid if SetTransactionIdLimit() runs between the collection of xid and + * the collection of nextFullXid. + */ +static inline FullTransactionId +FullTransactionIdFromAllowableAt(FullTransactionId nextFullXid, + TransactionId xid) +{ + uint32 epoch; + + /* Special transaction ID. */ + if (!TransactionIdIsNormal(xid)) + return FullTransactionIdFromEpochAndXid(0, xid); + + Assert(TransactionIdPrecedesOrEquals(xid, + XidFromFullTransactionId(nextFullXid))); + + /* + * The 64 bit result must be <= nextFullXid, since nextFullXid hadn't been + * issued yet when xid was in the past. The xid must therefore be from + * the epoch of nextFullXid or the epoch before. We know this because we + * must remove (by freezing) an XID before assigning the XID half an epoch + * ahead of it. + * + * The unlikely() branch hint is dubious. It's perfect for the first 2^32 + * XIDs of a cluster's life. Right at 2^32 XIDs, misprediction shoots to + * 100%, then improves until perfection returns 2^31 XIDs later. Since + * current callers pass relatively-recent XIDs, expect >90% prediction + * accuracy overall. This favors average latency over tail latency. + */ + epoch = EpochFromFullTransactionId(nextFullXid); + if (unlikely(xid > XidFromFullTransactionId(nextFullXid))) + { + Assert(epoch != 0); + epoch--; + } + + return FullTransactionIdFromEpochAndXid(epoch, xid); +} + +#endif /* FRONTEND */ + +#endif /* TRANSAM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tsmapi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tsmapi.h new file mode 100644 index 0000000..94d230b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tsmapi.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------------------- + * + * tsmapi.h + * API for tablesample methods + * + * Copyright (c) 2015-2025, PostgreSQL Global Development Group + * + * src/include/access/tsmapi.h + * + *------------------------------------------------------------------------- + */ +#ifndef TSMAPI_H +#define TSMAPI_H + +#include "nodes/execnodes.h" +#include "nodes/pathnodes.h" + + +/* + * Callback function signatures --- see tablesample-method.sgml for more info. + */ + +typedef void (*SampleScanGetSampleSize_function) (PlannerInfo *root, + RelOptInfo *baserel, + List *paramexprs, + BlockNumber *pages, + double *tuples); + +typedef void (*InitSampleScan_function) (SampleScanState *node, + int eflags); + +typedef void (*BeginSampleScan_function) (SampleScanState *node, + Datum *params, + int nparams, + uint32 seed); + +typedef BlockNumber (*NextSampleBlock_function) (SampleScanState *node, + BlockNumber nblocks); + +typedef OffsetNumber (*NextSampleTuple_function) (SampleScanState *node, + BlockNumber blockno, + OffsetNumber maxoffset); + +typedef void (*EndSampleScan_function) (SampleScanState *node); + +/* + * TsmRoutine is the struct returned by a tablesample method's handler + * function. It provides pointers to the callback functions needed by the + * planner and executor, as well as additional information about the method. + * + * More function pointers are likely to be added in the future. + * Therefore it's recommended that the handler initialize the struct with + * makeNode(TsmRoutine) so that all fields are set to NULL. This will + * ensure that no fields are accidentally left undefined. + */ +typedef struct TsmRoutine +{ + NodeTag type; + + /* List of datatype OIDs for the arguments of the TABLESAMPLE clause */ + List *parameterTypes; + + /* Can method produce repeatable samples across, or even within, queries? */ + bool repeatable_across_queries; + bool repeatable_across_scans; + + /* Functions for planning a SampleScan on a physical table */ + SampleScanGetSampleSize_function SampleScanGetSampleSize; + + /* Functions for executing a SampleScan on a physical table */ + InitSampleScan_function InitSampleScan; /* can be NULL */ + BeginSampleScan_function BeginSampleScan; + NextSampleBlock_function NextSampleBlock; /* can be NULL */ + NextSampleTuple_function NextSampleTuple; + EndSampleScan_function EndSampleScan; /* can be NULL */ +} TsmRoutine; + + +/* Functions in access/tablesample/tablesample.c */ +extern TsmRoutine *GetTsmRoutine(Oid tsmhandler); + +#endif /* TSMAPI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupconvert.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupconvert.h new file mode 100644 index 0000000..2ab3936 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupconvert.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * tupconvert.h + * Tuple conversion support. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tupconvert.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPCONVERT_H +#define TUPCONVERT_H + +#include "access/attmap.h" +#include "access/htup.h" +#include "access/tupdesc.h" +#include "executor/tuptable.h" +#include "nodes/bitmapset.h" + + +typedef struct TupleConversionMap +{ + TupleDesc indesc; /* tupdesc for source rowtype */ + TupleDesc outdesc; /* tupdesc for result rowtype */ + AttrMap *attrMap; /* indexes of input fields, or 0 for null */ + Datum *invalues; /* workspace for deconstructing source */ + bool *inisnull; + Datum *outvalues; /* workspace for constructing result */ + bool *outisnull; +} TupleConversionMap; + + +extern TupleConversionMap *convert_tuples_by_position(TupleDesc indesc, + TupleDesc outdesc, + const char *msg); + +extern TupleConversionMap *convert_tuples_by_name(TupleDesc indesc, + TupleDesc outdesc); +extern TupleConversionMap *convert_tuples_by_name_attrmap(TupleDesc indesc, + TupleDesc outdesc, + AttrMap *attrMap); + +extern HeapTuple execute_attr_map_tuple(HeapTuple tuple, TupleConversionMap *map); +extern TupleTableSlot *execute_attr_map_slot(AttrMap *attrMap, + TupleTableSlot *in_slot, + TupleTableSlot *out_slot); +extern Bitmapset *execute_attr_map_cols(AttrMap *attrMap, Bitmapset *in_cols); + +extern void free_conversion_map(TupleConversionMap *map); + +#endif /* TUPCONVERT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupdesc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupdesc.h new file mode 100644 index 0000000..a25b94b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupdesc.h @@ -0,0 +1,251 @@ +/*------------------------------------------------------------------------- + * + * tupdesc.h + * POSTGRES tuple descriptor definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tupdesc.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPDESC_H +#define TUPDESC_H + +#include "access/attnum.h" +#include "catalog/pg_attribute.h" +#include "nodes/pg_list.h" + + +typedef struct AttrDefault +{ + AttrNumber adnum; + char *adbin; /* nodeToString representation of expr */ +} AttrDefault; + +typedef struct ConstrCheck +{ + char *ccname; + char *ccbin; /* nodeToString representation of expr */ + bool ccenforced; + bool ccvalid; + bool ccnoinherit; /* this is a non-inheritable constraint */ +} ConstrCheck; + +/* This structure contains constraints of a tuple */ +typedef struct TupleConstr +{ + AttrDefault *defval; /* array */ + ConstrCheck *check; /* array */ + struct AttrMissing *missing; /* missing attributes values, NULL if none */ + uint16 num_defval; + uint16 num_check; + bool has_not_null; /* any not-null, including not valid ones */ + bool has_generated_stored; + bool has_generated_virtual; +} TupleConstr; + +/* + * CompactAttribute + * Cut-down version of FormData_pg_attribute for faster access for tasks + * such as tuple deformation. The fields of this struct are populated + * using the populate_compact_attribute() function, which must be called + * directly after the FormData_pg_attribute struct is populated or + * altered in any way. + * + * Currently, this struct is 16 bytes. Any code changes which enlarge this + * struct should be considered very carefully. + * + * Code which must access a TupleDesc's attribute data should always make use + * the fields of this struct when required fields are available here. It's + * more efficient to access the memory in CompactAttribute due to it being a + * more compact representation of FormData_pg_attribute and also because + * accessing the FormData_pg_attribute requires an additional calculations to + * obtain the base address of the array within the TupleDesc. + */ +typedef struct CompactAttribute +{ + int32 attcacheoff; /* fixed offset into tuple, if known, or -1 */ + int16 attlen; /* attr len in bytes or -1 = varlen, -2 = + * cstring */ + bool attbyval; /* as FormData_pg_attribute.attbyval */ + bool attispackable; /* FormData_pg_attribute.attstorage != + * TYPSTORAGE_PLAIN */ + bool atthasmissing; /* as FormData_pg_attribute.atthasmissing */ + bool attisdropped; /* as FormData_pg_attribute.attisdropped */ + bool attgenerated; /* FormData_pg_attribute.attgenerated != '\0' */ + char attnullability; /* status of not-null constraint, see below */ + uint8 attalignby; /* alignment requirement in bytes */ +} CompactAttribute; + +/* Valid values for CompactAttribute->attnullability */ +#define ATTNULLABLE_UNRESTRICTED 'f' /* No constraint exists */ +#define ATTNULLABLE_UNKNOWN 'u' /* constraint exists, validity unknown */ +#define ATTNULLABLE_VALID 'v' /* valid constraint exists */ +#define ATTNULLABLE_INVALID 'i' /* constraint exists, marked invalid */ + +/* + * This struct is passed around within the backend to describe the structure + * of tuples. For tuples coming from on-disk relations, the information is + * collected from the pg_attribute, pg_attrdef, and pg_constraint catalogs. + * Transient row types (such as the result of a join query) have anonymous + * TupleDesc structs that generally omit any constraint info; therefore the + * structure is designed to let the constraints be omitted efficiently. + * + * Note that only user attributes, not system attributes, are mentioned in + * TupleDesc. + * + * If the tupdesc is known to correspond to a named rowtype (such as a table's + * rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise + * tdtypeid is RECORDOID, and tdtypmod can be either -1 for a fully anonymous + * row type, or a value >= 0 to allow the rowtype to be looked up in the + * typcache.c type cache. + * + * Note that tdtypeid is never the OID of a domain over composite, even if + * we are dealing with values that are known (at some higher level) to be of + * a domain-over-composite type. This is because tdtypeid/tdtypmod need to + * match up with the type labeling of composite Datums, and those are never + * explicitly marked as being of a domain type, either. + * + * Tuple descriptors that live in caches (relcache or typcache, at present) + * are reference-counted: they can be deleted when their reference count goes + * to zero. Tuple descriptors created by the executor need no reference + * counting, however: they are simply created in the appropriate memory + * context and go away when the context is freed. We set the tdrefcount + * field of such a descriptor to -1, while reference-counted descriptors + * always have tdrefcount >= 0. + * + * Beyond the compact_attrs variable length array, the TupleDesc stores an + * array of FormData_pg_attribute. The TupleDescAttr() function, as defined + * below, takes care of calculating the address of the elements of the + * FormData_pg_attribute array. + * + * The array of CompactAttribute is effectively an abbreviated version of the + * array of FormData_pg_attribute. Because CompactAttribute is significantly + * smaller than FormData_pg_attribute, code, especially performance-critical + * code, should prioritize using the fields from the CompactAttribute over the + * equivalent fields in FormData_pg_attribute. + * + * Any code making changes manually to and fields in the FormData_pg_attribute + * array must subsequently call populate_compact_attribute() to flush the + * changes out to the corresponding 'compact_attrs' element. + */ +typedef struct TupleDescData +{ + int natts; /* number of attributes in the tuple */ + Oid tdtypeid; /* composite type ID for tuple type */ + int32 tdtypmod; /* typmod for tuple type */ + int tdrefcount; /* reference count, or -1 if not counting */ + TupleConstr *constr; /* constraints, or NULL if none */ + /* compact_attrs[N] is the compact metadata of Attribute Number N+1 */ + CompactAttribute compact_attrs[FLEXIBLE_ARRAY_MEMBER]; +} TupleDescData; +typedef struct TupleDescData *TupleDesc; + +extern void populate_compact_attribute(TupleDesc tupdesc, int attnum); + +/* + * Calculates the base address of the Form_pg_attribute at the end of the + * TupleDescData struct. + */ +#define TupleDescAttrAddress(desc) \ + (Form_pg_attribute) ((char *) (desc) + \ + (offsetof(struct TupleDescData, compact_attrs) + \ + (desc)->natts * sizeof(CompactAttribute))) + +/* Accessor for the i'th FormData_pg_attribute element of tupdesc. */ +static inline FormData_pg_attribute * +TupleDescAttr(TupleDesc tupdesc, int i) +{ + FormData_pg_attribute *attrs = TupleDescAttrAddress(tupdesc); + + return &attrs[i]; +} + +#undef TupleDescAttrAddress + +extern void verify_compact_attribute(TupleDesc, int attnum); + +/* + * Accessor for the i'th CompactAttribute element of tupdesc. + */ +static inline CompactAttribute * +TupleDescCompactAttr(TupleDesc tupdesc, int i) +{ + CompactAttribute *cattr = &tupdesc->compact_attrs[i]; + +#ifdef USE_ASSERT_CHECKING + + /* Check that the CompactAttribute is correctly populated */ + verify_compact_attribute(tupdesc, i); +#endif + + return cattr; +} + +extern TupleDesc CreateTemplateTupleDesc(int natts); + +extern TupleDesc CreateTupleDesc(int natts, Form_pg_attribute *attrs); + +extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc); + +extern TupleDesc CreateTupleDescTruncatedCopy(TupleDesc tupdesc, int natts); + +extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc); + +#define TupleDescSize(src) \ + (offsetof(struct TupleDescData, compact_attrs) + \ + (src)->natts * sizeof(CompactAttribute) + \ + (src)->natts * sizeof(FormData_pg_attribute)) + +extern void TupleDescCopy(TupleDesc dst, TupleDesc src); + +extern void TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno, + TupleDesc src, AttrNumber srcAttno); + +extern void FreeTupleDesc(TupleDesc tupdesc); + +extern void IncrTupleDescRefCount(TupleDesc tupdesc); +extern void DecrTupleDescRefCount(TupleDesc tupdesc); + +#define PinTupleDesc(tupdesc) \ + do { \ + if ((tupdesc)->tdrefcount >= 0) \ + IncrTupleDescRefCount(tupdesc); \ + } while (0) + +#define ReleaseTupleDesc(tupdesc) \ + do { \ + if ((tupdesc)->tdrefcount >= 0) \ + DecrTupleDescRefCount(tupdesc); \ + } while (0) + +extern bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2); +extern bool equalRowTypes(TupleDesc tupdesc1, TupleDesc tupdesc2); +extern uint32 hashRowType(TupleDesc desc); + +extern void TupleDescInitEntry(TupleDesc desc, + AttrNumber attributeNumber, + const char *attributeName, + Oid oidtypeid, + int32 typmod, + int attdim); + +extern void TupleDescInitBuiltinEntry(TupleDesc desc, + AttrNumber attributeNumber, + const char *attributeName, + Oid oidtypeid, + int32 typmod, + int attdim); + +extern void TupleDescInitEntryCollation(TupleDesc desc, + AttrNumber attributeNumber, + Oid collationid); + +extern TupleDesc BuildDescFromLists(const List *names, const List *types, const List *typmods, const List *collations); + +extern Node *TupleDescGetDefault(TupleDesc tupdesc, AttrNumber attnum); + +#endif /* TUPDESC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupdesc_details.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupdesc_details.h new file mode 100644 index 0000000..8c0e1a1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupdesc_details.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * tupdesc_details.h + * POSTGRES tuple descriptor definitions we can't include everywhere + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tupdesc_details.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TUPDESC_DETAILS_H +#define TUPDESC_DETAILS_H + +/* + * Structure used to represent value to be used when the attribute is not + * present at all in a tuple, i.e. when the column was created after the tuple + */ +typedef struct AttrMissing +{ + bool am_present; /* true if non-NULL missing value exists */ + Datum am_value; /* value when attribute is missing */ +} AttrMissing; + +#endif /* TUPDESC_DETAILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupmacs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupmacs.h new file mode 100644 index 0000000..6240ec9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/tupmacs.h @@ -0,0 +1,235 @@ +/*------------------------------------------------------------------------- + * + * tupmacs.h + * Tuple macros used by both index tuples and heap tuples. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tupmacs.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPMACS_H +#define TUPMACS_H + +#include "catalog/pg_type_d.h" /* for TYPALIGN macros */ + + +/* + * Check a tuple's null bitmap to determine whether the attribute is null. + * Note that a 0 in the null bitmap indicates a null, while 1 indicates + * non-null. + */ +static inline bool +att_isnull(int ATT, const bits8 *BITS) +{ + return !(BITS[ATT >> 3] & (1 << (ATT & 0x07))); +} + +#ifndef FRONTEND +/* + * Given an attbyval and an attlen from either a Form_pg_attribute or + * CompactAttribute and a pointer into a tuple's data area, return the + * correct value or pointer. + * + * We return a Datum value in all cases. If attbyval is false, we return the + * same pointer into the tuple data area that we're passed. Otherwise, we + * return the correct number of bytes fetched from the data area and extended + * to Datum form. + * + * On machines where Datum is 8 bytes, we support fetching 8-byte byval + * attributes; otherwise, only 1, 2, and 4-byte values are supported. + * + * Note that T must already be properly aligned for this to work correctly. + */ +#define fetchatt(A,T) fetch_att(T, (A)->attbyval, (A)->attlen) + +/* + * Same, but work from byval/len parameters rather than Form_pg_attribute. + */ +static inline Datum +fetch_att(const void *T, bool attbyval, int attlen) +{ + if (attbyval) + { + switch (attlen) + { + case sizeof(char): + return CharGetDatum(*((const char *) T)); + case sizeof(int16): + return Int16GetDatum(*((const int16 *) T)); + case sizeof(int32): + return Int32GetDatum(*((const int32 *) T)); +#if SIZEOF_DATUM == 8 + case sizeof(Datum): + return *((const Datum *) T); +#endif + default: + elog(ERROR, "unsupported byval length: %d", attlen); + return 0; + } + } + else + return PointerGetDatum(T); +} +#endif /* FRONTEND */ + +/* + * att_align_datum aligns the given offset as needed for a datum of alignment + * requirement attalign and typlen attlen. attdatum is the Datum variable + * we intend to pack into a tuple (it's only accessed if we are dealing with + * a varlena type). Note that this assumes the Datum will be stored as-is; + * callers that are intending to convert non-short varlena datums to short + * format have to account for that themselves. + */ +#define att_align_datum(cur_offset, attalign, attlen, attdatum) \ +( \ + ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \ + (uintptr_t) (cur_offset) : \ + att_align_nominal(cur_offset, attalign) \ +) + +/* + * Similar to att_align_datum, but accepts a number of bytes, typically from + * CompactAttribute.attalignby to align the Datum by. + */ +#define att_datum_alignby(cur_offset, attalignby, attlen, attdatum) \ + ( \ + ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \ + (uintptr_t) (cur_offset) : \ + TYPEALIGN(attalignby, cur_offset)) + +/* + * att_align_pointer performs the same calculation as att_align_datum, + * but is used when walking a tuple. attptr is the current actual data + * pointer; when accessing a varlena field we have to "peek" to see if we + * are looking at a pad byte or the first byte of a 1-byte-header datum. + * (A zero byte must be either a pad byte, or the first byte of a correctly + * aligned 4-byte length word; in either case we can align safely. A non-zero + * byte must be either a 1-byte length word, or the first byte of a correctly + * aligned 4-byte length word; in either case we need not align.) + * + * Note: some callers pass a "char *" pointer for cur_offset. This is + * a bit of a hack but should work all right as long as uintptr_t is the + * correct width. + */ +#define att_align_pointer(cur_offset, attalign, attlen, attptr) \ +( \ + ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \ + (uintptr_t) (cur_offset) : \ + att_align_nominal(cur_offset, attalign) \ +) + +/* + * Similar to att_align_pointer, but accepts a number of bytes, typically from + * CompactAttribute.attalignby to align the pointer by. + */ +#define att_pointer_alignby(cur_offset, attalignby, attlen, attptr) \ + ( \ + ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \ + (uintptr_t) (cur_offset) : \ + TYPEALIGN(attalignby, cur_offset)) + +/* + * att_align_nominal aligns the given offset as needed for a datum of alignment + * requirement attalign, ignoring any consideration of packed varlena datums. + * There are three main use cases for using this macro directly: + * * we know that the att in question is not varlena (attlen != -1); + * in this case it is cheaper than the above macros and just as good. + * * we need to estimate alignment padding cost abstractly, ie without + * reference to a real tuple. We must assume the worst case that + * all varlenas are aligned. + * * within arrays and multiranges, we unconditionally align varlenas (XXX this + * should be revisited, probably). + * + * The attalign cases are tested in what is hopefully something like their + * frequency of occurrence. + */ +#define att_align_nominal(cur_offset, attalign) \ +( \ + ((attalign) == TYPALIGN_INT) ? INTALIGN(cur_offset) : \ + (((attalign) == TYPALIGN_CHAR) ? (uintptr_t) (cur_offset) : \ + (((attalign) == TYPALIGN_DOUBLE) ? DOUBLEALIGN(cur_offset) : \ + ( \ + AssertMacro((attalign) == TYPALIGN_SHORT), \ + SHORTALIGN(cur_offset) \ + ))) \ +) + +/* + * Similar to att_align_nominal, but accepts a number of bytes, typically from + * CompactAttribute.attalignby to align the offset by. + */ +#define att_nominal_alignby(cur_offset, attalignby) \ + TYPEALIGN(attalignby, cur_offset) + +/* + * att_addlength_datum increments the given offset by the space needed for + * the given Datum variable. attdatum is only accessed if we are dealing + * with a variable-length attribute. + */ +#define att_addlength_datum(cur_offset, attlen, attdatum) \ + att_addlength_pointer(cur_offset, attlen, DatumGetPointer(attdatum)) + +/* + * att_addlength_pointer performs the same calculation as att_addlength_datum, + * but is used when walking a tuple --- attptr is the pointer to the field + * within the tuple. + * + * Note: some callers pass a "char *" pointer for cur_offset. This is + * actually perfectly OK, but probably should be cleaned up along with + * the same practice for att_align_pointer. + */ +#define att_addlength_pointer(cur_offset, attlen, attptr) \ +( \ + ((attlen) > 0) ? \ + ( \ + (cur_offset) + (attlen) \ + ) \ + : (((attlen) == -1) ? \ + ( \ + (cur_offset) + VARSIZE_ANY(attptr) \ + ) \ + : \ + ( \ + AssertMacro((attlen) == -2), \ + (cur_offset) + (strlen((char *) (attptr)) + 1) \ + )) \ +) + +#ifndef FRONTEND +/* + * store_att_byval is a partial inverse of fetch_att: store a given Datum + * value into a tuple data area at the specified address. However, it only + * handles the byval case, because in typical usage the caller needs to + * distinguish by-val and by-ref cases anyway, and so a do-it-all function + * wouldn't be convenient. + */ +static inline void +store_att_byval(void *T, Datum newdatum, int attlen) +{ + switch (attlen) + { + case sizeof(char): + *(char *) T = DatumGetChar(newdatum); + break; + case sizeof(int16): + *(int16 *) T = DatumGetInt16(newdatum); + break; + case sizeof(int32): + *(int32 *) T = DatumGetInt32(newdatum); + break; +#if SIZEOF_DATUM == 8 + case sizeof(Datum): + *(Datum *) T = newdatum; + break; +#endif + default: + elog(ERROR, "unsupported byval length: %d", attlen); + } +} +#endif /* FRONTEND */ + +#endif /* TUPMACS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/twophase.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/twophase.h new file mode 100644 index 0000000..9fa8235 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/twophase.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * + * twophase.h + * Two-phase-commit related declarations. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/twophase.h + * + *------------------------------------------------------------------------- + */ +#ifndef TWOPHASE_H +#define TWOPHASE_H + +#include "access/xact.h" +#include "access/xlogdefs.h" +#include "datatype/timestamp.h" +#include "storage/lock.h" + +/* + * GlobalTransactionData is defined in twophase.c; other places have no + * business knowing the internal definition. + */ +typedef struct GlobalTransactionData *GlobalTransaction; + +/* GUC variable */ +extern PGDLLIMPORT int max_prepared_xacts; + +extern Size TwoPhaseShmemSize(void); +extern void TwoPhaseShmemInit(void); + +extern void AtAbort_Twophase(void); +extern void PostPrepare_Twophase(void); + +extern TransactionId TwoPhaseGetXidByVirtualXID(VirtualTransactionId vxid, + bool *have_more); +extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid, bool lock_held); +extern int TwoPhaseGetDummyProcNumber(TransactionId xid, bool lock_held); + +extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid, + TimestampTz prepared_at, + Oid owner, Oid databaseid); + +extern void StartPrepare(GlobalTransaction gxact); +extern void EndPrepare(GlobalTransaction gxact); +extern bool StandbyTransactionIdIsPrepared(TransactionId xid); + +extern TransactionId PrescanPreparedTransactions(TransactionId **xids_p, + int *nxids_p); +extern void StandbyRecoverPreparedTransactions(void); +extern void RecoverPreparedTransactions(void); + +extern void CheckPointTwoPhase(XLogRecPtr redo_horizon); + +extern void FinishPreparedTransaction(const char *gid, bool isCommit); + +extern void PrepareRedoAdd(char *buf, XLogRecPtr start_lsn, + XLogRecPtr end_lsn, RepOriginId origin_id); +extern void PrepareRedoRemove(TransactionId xid, bool giveWarning); +extern void restoreTwoPhaseData(void); +extern bool LookupGXact(const char *gid, XLogRecPtr prepare_end_lsn, + TimestampTz origin_prepare_timestamp); + +extern void TwoPhaseTransactionGid(Oid subid, TransactionId xid, char *gid_res, + int szgid); +extern bool LookupGXactBySubid(Oid subid); + +#endif /* TWOPHASE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/twophase_rmgr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/twophase_rmgr.h new file mode 100644 index 0000000..3ed154b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/twophase_rmgr.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * twophase_rmgr.h + * Two-phase-commit resource managers definition + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/twophase_rmgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef TWOPHASE_RMGR_H +#define TWOPHASE_RMGR_H + +typedef void (*TwoPhaseCallback) (TransactionId xid, uint16 info, + void *recdata, uint32 len); +typedef uint8 TwoPhaseRmgrId; + +/* + * Built-in resource managers + */ +#define TWOPHASE_RM_END_ID 0 +#define TWOPHASE_RM_LOCK_ID 1 +#define TWOPHASE_RM_PGSTAT_ID 2 +#define TWOPHASE_RM_MULTIXACT_ID 3 +#define TWOPHASE_RM_PREDICATELOCK_ID 4 +#define TWOPHASE_RM_MAX_ID TWOPHASE_RM_PREDICATELOCK_ID + +extern PGDLLIMPORT const TwoPhaseCallback twophase_recover_callbacks[]; +extern PGDLLIMPORT const TwoPhaseCallback twophase_postcommit_callbacks[]; +extern PGDLLIMPORT const TwoPhaseCallback twophase_postabort_callbacks[]; +extern PGDLLIMPORT const TwoPhaseCallback twophase_standby_recover_callbacks[]; + + +extern void RegisterTwoPhaseRecord(TwoPhaseRmgrId rmid, uint16 info, + const void *data, uint32 len); + +#endif /* TWOPHASE_RMGR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/valid.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/valid.h new file mode 100644 index 0000000..8b33089 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/valid.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * valid.h + * POSTGRES tuple qualification validity definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/valid.h + * + *------------------------------------------------------------------------- + */ +#ifndef VALID_H +#define VALID_H + +#include "access/htup.h" +#include "access/htup_details.h" +#include "access/skey.h" +#include "access/tupdesc.h" + +/* + * HeapKeyTest + * + * Test a heap tuple to see if it satisfies a scan key. + */ +static inline bool +HeapKeyTest(HeapTuple tuple, TupleDesc tupdesc, int nkeys, ScanKey keys) +{ + int cur_nkeys = nkeys; + ScanKey cur_key = keys; + + for (; cur_nkeys--; cur_key++) + { + Datum atp; + bool isnull; + Datum test; + + if (cur_key->sk_flags & SK_ISNULL) + return false; + + atp = heap_getattr(tuple, cur_key->sk_attno, tupdesc, &isnull); + + if (isnull) + return false; + + test = FunctionCall2Coll(&cur_key->sk_func, + cur_key->sk_collation, + atp, cur_key->sk_argument); + + if (!DatumGetBool(test)) + return false; + } + + return true; +} + +#endif /* VALID_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/visibilitymap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/visibilitymap.h new file mode 100644 index 0000000..be21c6d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/visibilitymap.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * visibilitymap.h + * visibility map interface + * + * + * Portions Copyright (c) 2007-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/visibilitymap.h + * + *------------------------------------------------------------------------- + */ +#ifndef VISIBILITYMAP_H +#define VISIBILITYMAP_H + +#include "access/visibilitymapdefs.h" +#include "access/xlogdefs.h" +#include "storage/block.h" +#include "storage/buf.h" +#include "utils/relcache.h" + +/* Macros for visibilitymap test */ +#define VM_ALL_VISIBLE(r, b, v) \ + ((visibilitymap_get_status((r), (b), (v)) & VISIBILITYMAP_ALL_VISIBLE) != 0) +#define VM_ALL_FROZEN(r, b, v) \ + ((visibilitymap_get_status((r), (b), (v)) & VISIBILITYMAP_ALL_FROZEN) != 0) + +extern bool visibilitymap_clear(Relation rel, BlockNumber heapBlk, + Buffer vmbuf, uint8 flags); +extern void visibilitymap_pin(Relation rel, BlockNumber heapBlk, + Buffer *vmbuf); +extern bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf); +extern uint8 visibilitymap_set(Relation rel, + BlockNumber heapBlk, Buffer heapBuf, + XLogRecPtr recptr, + Buffer vmBuf, + TransactionId cutoff_xid, + uint8 flags); +extern uint8 visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *vmbuf); +extern void visibilitymap_count(Relation rel, BlockNumber *all_visible, BlockNumber *all_frozen); +extern BlockNumber visibilitymap_prepare_truncate(Relation rel, + BlockNumber nheapblocks); + +#endif /* VISIBILITYMAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/visibilitymapdefs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/visibilitymapdefs.h new file mode 100644 index 0000000..5ad5c02 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/visibilitymapdefs.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * visibilitymapdefs.h + * macros for accessing contents of visibility map pages + * + * + * Copyright (c) 2021-2025, PostgreSQL Global Development Group + * + * src/include/access/visibilitymapdefs.h + * + *------------------------------------------------------------------------- + */ +#ifndef VISIBILITYMAPDEFS_H +#define VISIBILITYMAPDEFS_H + +/* Number of bits for one heap page */ +#define BITS_PER_HEAPBLOCK 2 + +/* Flags for bit map */ +#define VISIBILITYMAP_ALL_VISIBLE 0x01 +#define VISIBILITYMAP_ALL_FROZEN 0x02 +#define VISIBILITYMAP_VALID_BITS 0x03 /* OR of all valid visibilitymap + * flags bits */ +/* + * To detect recovery conflicts during logical decoding on a standby, we need + * to know if a table is a user catalog table. For that we add an additional + * bit into xl_heap_visible.flags, in addition to the above. + * + * NB: VISIBILITYMAP_XLOG_* may not be passed to visibilitymap_set(). + */ +#define VISIBILITYMAP_XLOG_CATALOG_REL 0x04 +#define VISIBILITYMAP_XLOG_VALID_BITS (VISIBILITYMAP_VALID_BITS | VISIBILITYMAP_XLOG_CATALOG_REL) + +#endif /* VISIBILITYMAPDEFS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xact.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xact.h new file mode 100644 index 0000000..b2bc10e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xact.h @@ -0,0 +1,536 @@ +/*------------------------------------------------------------------------- + * + * xact.h + * postgres transaction system definitions + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xact.h + * + *------------------------------------------------------------------------- + */ +#ifndef XACT_H +#define XACT_H + +#include "access/transam.h" +#include "access/xlogreader.h" +#include "datatype/timestamp.h" +#include "lib/stringinfo.h" +#include "nodes/pg_list.h" +#include "storage/relfilelocator.h" +#include "storage/sinval.h" + +/* + * Maximum size of Global Transaction ID (including '\0'). + * + * Note that the max value of GIDSIZE must fit in the uint16 gidlen, + * specified in TwoPhaseFileHeader. + */ +#define GIDSIZE 200 + +/* + * Xact isolation levels + */ +#define XACT_READ_UNCOMMITTED 0 +#define XACT_READ_COMMITTED 1 +#define XACT_REPEATABLE_READ 2 +#define XACT_SERIALIZABLE 3 + +extern PGDLLIMPORT int DefaultXactIsoLevel; +extern PGDLLIMPORT int XactIsoLevel; + +/* + * We implement three isolation levels internally. + * The two stronger ones use one snapshot per database transaction; + * the others use one snapshot per statement. + * Serializable uses predicate locks in addition to snapshots. + * These macros should be used to check which isolation level is selected. + */ +#define IsolationUsesXactSnapshot() (XactIsoLevel >= XACT_REPEATABLE_READ) +#define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE) + +/* Xact read-only state */ +extern PGDLLIMPORT bool DefaultXactReadOnly; +extern PGDLLIMPORT bool XactReadOnly; + +/* flag for logging statements in this transaction */ +extern PGDLLIMPORT bool xact_is_sampled; + +/* + * Xact is deferrable -- only meaningful (currently) for read only + * SERIALIZABLE transactions + */ +extern PGDLLIMPORT bool DefaultXactDeferrable; +extern PGDLLIMPORT bool XactDeferrable; + +typedef enum +{ + SYNCHRONOUS_COMMIT_OFF, /* asynchronous commit */ + SYNCHRONOUS_COMMIT_LOCAL_FLUSH, /* wait for local flush only */ + SYNCHRONOUS_COMMIT_REMOTE_WRITE, /* wait for local flush and remote + * write */ + SYNCHRONOUS_COMMIT_REMOTE_FLUSH, /* wait for local and remote flush */ + SYNCHRONOUS_COMMIT_REMOTE_APPLY, /* wait for local and remote flush and + * remote apply */ +} SyncCommitLevel; + +/* Define the default setting for synchronous_commit */ +#define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH + +/* Synchronous commit level */ +extern PGDLLIMPORT int synchronous_commit; + +/* used during logical streaming of a transaction */ +extern PGDLLIMPORT TransactionId CheckXidAlive; +extern PGDLLIMPORT bool bsysscan; + +/* + * Miscellaneous flag bits to record events which occur on the top level + * transaction. These flags are only persisted in MyXactFlags and are intended + * so we remember to do certain things later in the transaction. This is + * globally accessible, so can be set from anywhere in the code which requires + * recording flags. + */ +extern PGDLLIMPORT int MyXactFlags; + +/* + * XACT_FLAGS_ACCESSEDTEMPNAMESPACE - set when a temporary object is accessed. + * We don't allow PREPARE TRANSACTION in that case. + */ +#define XACT_FLAGS_ACCESSEDTEMPNAMESPACE (1U << 0) + +/* + * XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK - records whether the top level xact + * logged any Access Exclusive Locks. + */ +#define XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK (1U << 1) + +/* + * XACT_FLAGS_NEEDIMMEDIATECOMMIT - records whether the top level statement + * is one that requires immediate commit, such as CREATE DATABASE. + */ +#define XACT_FLAGS_NEEDIMMEDIATECOMMIT (1U << 2) + +/* + * XACT_FLAGS_PIPELINING - set when we complete an extended-query-protocol + * Execute message. This is useful for detecting that an implicit transaction + * block has been created via pipelining. + */ +#define XACT_FLAGS_PIPELINING (1U << 3) + +/* + * start- and end-of-transaction callbacks for dynamically loaded modules + */ +typedef enum +{ + XACT_EVENT_COMMIT, + XACT_EVENT_PARALLEL_COMMIT, + XACT_EVENT_ABORT, + XACT_EVENT_PARALLEL_ABORT, + XACT_EVENT_PREPARE, + XACT_EVENT_PRE_COMMIT, + XACT_EVENT_PARALLEL_PRE_COMMIT, + XACT_EVENT_PRE_PREPARE, +} XactEvent; + +typedef void (*XactCallback) (XactEvent event, void *arg); + +typedef enum +{ + SUBXACT_EVENT_START_SUB, + SUBXACT_EVENT_COMMIT_SUB, + SUBXACT_EVENT_ABORT_SUB, + SUBXACT_EVENT_PRE_COMMIT_SUB, +} SubXactEvent; + +typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid, + SubTransactionId parentSubid, void *arg); + +/* Data structure for Save/RestoreTransactionCharacteristics */ +typedef struct SavedTransactionCharacteristics +{ + int save_XactIsoLevel; + bool save_XactReadOnly; + bool save_XactDeferrable; +} SavedTransactionCharacteristics; + + +/* ---------------- + * transaction-related XLOG entries + * ---------------- + */ + +/* + * XLOG allows to store some information in high 4 bits of log record xl_info + * field. We use 3 for the opcode, and one about an optional flag variable. + */ +#define XLOG_XACT_COMMIT 0x00 +#define XLOG_XACT_PREPARE 0x10 +#define XLOG_XACT_ABORT 0x20 +#define XLOG_XACT_COMMIT_PREPARED 0x30 +#define XLOG_XACT_ABORT_PREPARED 0x40 +#define XLOG_XACT_ASSIGNMENT 0x50 +#define XLOG_XACT_INVALIDATIONS 0x60 +/* free opcode 0x70 */ + +/* mask for filtering opcodes out of xl_info */ +#define XLOG_XACT_OPMASK 0x70 + +/* does this record have a 'xinfo' field or not */ +#define XLOG_XACT_HAS_INFO 0x80 + +/* + * The following flags, stored in xinfo, determine which information is + * contained in commit/abort records. + */ +#define XACT_XINFO_HAS_DBINFO (1U << 0) +#define XACT_XINFO_HAS_SUBXACTS (1U << 1) +#define XACT_XINFO_HAS_RELFILELOCATORS (1U << 2) +#define XACT_XINFO_HAS_INVALS (1U << 3) +#define XACT_XINFO_HAS_TWOPHASE (1U << 4) +#define XACT_XINFO_HAS_ORIGIN (1U << 5) +#define XACT_XINFO_HAS_AE_LOCKS (1U << 6) +#define XACT_XINFO_HAS_GID (1U << 7) +#define XACT_XINFO_HAS_DROPPED_STATS (1U << 8) + +/* + * Also stored in xinfo, these indicating a variety of additional actions that + * need to occur when emulating transaction effects during recovery. + * + * They are named XactCompletion... to differentiate them from + * EOXact... routines which run at the end of the original transaction + * completion. + */ +#define XACT_COMPLETION_APPLY_FEEDBACK (1U << 29) +#define XACT_COMPLETION_UPDATE_RELCACHE_FILE (1U << 30) +#define XACT_COMPLETION_FORCE_SYNC_COMMIT (1U << 31) + +/* Access macros for above flags */ +#define XactCompletionApplyFeedback(xinfo) \ + ((xinfo & XACT_COMPLETION_APPLY_FEEDBACK) != 0) +#define XactCompletionRelcacheInitFileInval(xinfo) \ + ((xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) != 0) +#define XactCompletionForceSyncCommit(xinfo) \ + ((xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) != 0) + +typedef struct xl_xact_assignment +{ + TransactionId xtop; /* assigned XID's top-level XID */ + int nsubxacts; /* number of subtransaction XIDs */ + TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]; /* assigned subxids */ +} xl_xact_assignment; + +#define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub) + +/* + * Commit and abort records can contain a lot of information. But a large + * portion of the records won't need all possible pieces of information. So we + * only include what's needed. + * + * A minimal commit/abort record only consists of a xl_xact_commit/abort + * struct. The presence of additional information is indicated by bits set in + * 'xl_xact_xinfo->xinfo'. The presence of the xinfo field itself is signaled + * by a set XLOG_XACT_HAS_INFO bit in the xl_info field. + * + * NB: All the individual data chunks should be sized to multiples of + * sizeof(int) and only require int32 alignment. If they require bigger + * alignment, they need to be copied upon reading. + */ + +/* sub-records for commit/abort */ + +typedef struct xl_xact_xinfo +{ + /* + * Even though we right now only require two bytes of space in xinfo we + * use four so following records don't have to care about alignment. + * Commit records can be large, so copying large portions isn't + * attractive. + */ + uint32 xinfo; +} xl_xact_xinfo; + +typedef struct xl_xact_dbinfo +{ + Oid dbId; /* MyDatabaseId */ + Oid tsId; /* MyDatabaseTableSpace */ +} xl_xact_dbinfo; + +typedef struct xl_xact_subxacts +{ + int nsubxacts; /* number of subtransaction XIDs */ + TransactionId subxacts[FLEXIBLE_ARRAY_MEMBER]; +} xl_xact_subxacts; +#define MinSizeOfXactSubxacts offsetof(xl_xact_subxacts, subxacts) + +typedef struct xl_xact_relfilelocators +{ + int nrels; /* number of relations */ + RelFileLocator xlocators[FLEXIBLE_ARRAY_MEMBER]; +} xl_xact_relfilelocators; +#define MinSizeOfXactRelfileLocators offsetof(xl_xact_relfilelocators, xlocators) + +/* + * A transactionally dropped statistics entry. + * + * Declared here rather than pgstat.h because pgstat.h can't be included from + * frontend code, but the WAL format needs to be readable by frontend + * programs. + */ +typedef struct xl_xact_stats_item +{ + int kind; + Oid dboid; + + /* + * This stores the value of PgStat_HashKey.objid as two uint32 as all the + * fields of xl_xact_xinfo should be multiples of size(int). + */ + uint32 objid_lo; + uint32 objid_hi; +} xl_xact_stats_item; + +typedef struct xl_xact_stats_items +{ + int nitems; + xl_xact_stats_item items[FLEXIBLE_ARRAY_MEMBER]; +} xl_xact_stats_items; +#define MinSizeOfXactStatsItems offsetof(xl_xact_stats_items, items) + +typedef struct xl_xact_invals +{ + int nmsgs; /* number of shared inval msgs */ + SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]; +} xl_xact_invals; +#define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs) + +typedef struct xl_xact_twophase +{ + TransactionId xid; +} xl_xact_twophase; + +typedef struct xl_xact_origin +{ + XLogRecPtr origin_lsn; + TimestampTz origin_timestamp; +} xl_xact_origin; + +typedef struct xl_xact_commit +{ + TimestampTz xact_time; /* time of commit */ + + /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */ + /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */ + /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */ + /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */ + /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */ + /* xl_xact_invals follows if XINFO_HAS_INVALS */ + /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */ + /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */ + /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */ +} xl_xact_commit; +#define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz)) + +typedef struct xl_xact_abort +{ + TimestampTz xact_time; /* time of abort */ + + /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */ + /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */ + /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */ + /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */ + /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */ + /* No invalidation messages needed. */ + /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */ + /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */ + /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */ +} xl_xact_abort; +#define MinSizeOfXactAbort sizeof(xl_xact_abort) + +typedef struct xl_xact_prepare +{ + uint32 magic; /* format identifier */ + uint32 total_len; /* actual file length */ + TransactionId xid; /* original transaction XID */ + Oid database; /* OID of database it was in */ + TimestampTz prepared_at; /* time of preparation */ + Oid owner; /* user running the transaction */ + int32 nsubxacts; /* number of following subxact XIDs */ + int32 ncommitrels; /* number of delete-on-commit rels */ + int32 nabortrels; /* number of delete-on-abort rels */ + int32 ncommitstats; /* number of stats to drop on commit */ + int32 nabortstats; /* number of stats to drop on abort */ + int32 ninvalmsgs; /* number of cache invalidation messages */ + bool initfileinval; /* does relcache init file need invalidation? */ + uint16 gidlen; /* length of the GID - GID follows the header */ + XLogRecPtr origin_lsn; /* lsn of this record at origin node */ + TimestampTz origin_timestamp; /* time of prepare at origin node */ +} xl_xact_prepare; + +/* + * Commit/Abort records in the above form are a bit verbose to parse, so + * there's a deconstructed versions generated by ParseCommit/AbortRecord() for + * easier consumption. + */ +typedef struct xl_xact_parsed_commit +{ + TimestampTz xact_time; + uint32 xinfo; + + Oid dbId; /* MyDatabaseId */ + Oid tsId; /* MyDatabaseTableSpace */ + + int nsubxacts; + TransactionId *subxacts; + + int nrels; + RelFileLocator *xlocators; + + int nstats; + xl_xact_stats_item *stats; + + int nmsgs; + SharedInvalidationMessage *msgs; + + TransactionId twophase_xid; /* only for 2PC */ + char twophase_gid[GIDSIZE]; /* only for 2PC */ + int nabortrels; /* only for 2PC */ + RelFileLocator *abortlocators; /* only for 2PC */ + int nabortstats; /* only for 2PC */ + xl_xact_stats_item *abortstats; /* only for 2PC */ + + XLogRecPtr origin_lsn; + TimestampTz origin_timestamp; +} xl_xact_parsed_commit; + +typedef xl_xact_parsed_commit xl_xact_parsed_prepare; + +typedef struct xl_xact_parsed_abort +{ + TimestampTz xact_time; + uint32 xinfo; + + Oid dbId; /* MyDatabaseId */ + Oid tsId; /* MyDatabaseTableSpace */ + + int nsubxacts; + TransactionId *subxacts; + + int nrels; + RelFileLocator *xlocators; + + int nstats; + xl_xact_stats_item *stats; + + TransactionId twophase_xid; /* only for 2PC */ + char twophase_gid[GIDSIZE]; /* only for 2PC */ + + XLogRecPtr origin_lsn; + TimestampTz origin_timestamp; +} xl_xact_parsed_abort; + + +/* ---------------- + * extern definitions + * ---------------- + */ +extern bool IsTransactionState(void); +extern bool IsAbortedTransactionBlockState(void); +extern TransactionId GetTopTransactionId(void); +extern TransactionId GetTopTransactionIdIfAny(void); +extern TransactionId GetCurrentTransactionId(void); +extern TransactionId GetCurrentTransactionIdIfAny(void); +extern TransactionId GetStableLatestTransactionId(void); +extern SubTransactionId GetCurrentSubTransactionId(void); +extern FullTransactionId GetTopFullTransactionId(void); +extern FullTransactionId GetTopFullTransactionIdIfAny(void); +extern FullTransactionId GetCurrentFullTransactionId(void); +extern FullTransactionId GetCurrentFullTransactionIdIfAny(void); +extern void MarkCurrentTransactionIdLoggedIfAny(void); +extern bool SubTransactionIsActive(SubTransactionId subxid); +extern CommandId GetCurrentCommandId(bool used); +extern void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts); +extern TimestampTz GetCurrentTransactionStartTimestamp(void); +extern TimestampTz GetCurrentStatementStartTimestamp(void); +extern TimestampTz GetCurrentTransactionStopTimestamp(void); +extern void SetCurrentStatementStartTimestamp(void); +extern int GetCurrentTransactionNestLevel(void); +extern bool TransactionIdIsCurrentTransactionId(TransactionId xid); +extern void CommandCounterIncrement(void); +extern void ForceSyncCommit(void); +extern void StartTransactionCommand(void); +extern void SaveTransactionCharacteristics(SavedTransactionCharacteristics *s); +extern void RestoreTransactionCharacteristics(const SavedTransactionCharacteristics *s); +extern void CommitTransactionCommand(void); +extern void AbortCurrentTransaction(void); +extern void BeginTransactionBlock(void); +extern bool EndTransactionBlock(bool chain); +extern bool PrepareTransactionBlock(const char *gid); +extern void UserAbortTransactionBlock(bool chain); +extern void BeginImplicitTransactionBlock(void); +extern void EndImplicitTransactionBlock(void); +extern void ReleaseSavepoint(const char *name); +extern void DefineSavepoint(const char *name); +extern void RollbackToSavepoint(const char *name); +extern void BeginInternalSubTransaction(const char *name); +extern void ReleaseCurrentSubTransaction(void); +extern void RollbackAndReleaseCurrentSubTransaction(void); +extern bool IsSubTransaction(void); +extern Size EstimateTransactionStateSpace(void); +extern void SerializeTransactionState(Size maxsize, char *start_address); +extern void StartParallelWorkerTransaction(char *tstatespace); +extern void EndParallelWorkerTransaction(void); +extern bool IsTransactionBlock(void); +extern bool IsTransactionOrTransactionBlock(void); +extern char TransactionBlockStatusCode(void); +extern void AbortOutOfAnyTransaction(void); +extern void PreventInTransactionBlock(bool isTopLevel, const char *stmtType); +extern void RequireTransactionBlock(bool isTopLevel, const char *stmtType); +extern void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType); +extern bool IsInTransactionBlock(bool isTopLevel); +extern void RegisterXactCallback(XactCallback callback, void *arg); +extern void UnregisterXactCallback(XactCallback callback, void *arg); +extern void RegisterSubXactCallback(SubXactCallback callback, void *arg); +extern void UnregisterSubXactCallback(SubXactCallback callback, void *arg); + +extern bool IsSubxactTopXidLogPending(void); +extern void MarkSubxactTopXidLogged(void); + +extern int xactGetCommittedChildren(TransactionId **ptr); + +extern XLogRecPtr XactLogCommitRecord(TimestampTz commit_time, + int nsubxacts, TransactionId *subxacts, + int nrels, RelFileLocator *rels, + int ndroppedstats, + xl_xact_stats_item *droppedstats, + int nmsgs, SharedInvalidationMessage *msgs, + bool relcacheInval, + int xactflags, + TransactionId twophase_xid, + const char *twophase_gid); + +extern XLogRecPtr XactLogAbortRecord(TimestampTz abort_time, + int nsubxacts, TransactionId *subxacts, + int nrels, RelFileLocator *rels, + int ndroppedstats, + xl_xact_stats_item *droppedstats, + int xactflags, TransactionId twophase_xid, + const char *twophase_gid); +extern void xact_redo(XLogReaderState *record); + +/* xactdesc.c */ +extern void xact_desc(StringInfo buf, XLogReaderState *record); +extern const char *xact_identify(uint8 info); + +/* also in xactdesc.c, so they can be shared between front/backend code */ +extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed); +extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed); +extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed); + +extern void EnterParallelMode(void); +extern void ExitParallelMode(void); +extern bool IsInParallelMode(void); + +#endif /* XACT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlog.h new file mode 100644 index 0000000..0992c27 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlog.h @@ -0,0 +1,316 @@ +/* + * xlog.h + * + * PostgreSQL write-ahead log manager + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlog.h + */ +#ifndef XLOG_H +#define XLOG_H + +#include "access/xlogbackup.h" +#include "access/xlogdefs.h" +#include "datatype/timestamp.h" +#include "lib/stringinfo.h" +#include "nodes/pg_list.h" + + +/* Sync methods */ +enum WalSyncMethod +{ + WAL_SYNC_METHOD_FSYNC = 0, + WAL_SYNC_METHOD_FDATASYNC, + WAL_SYNC_METHOD_OPEN, /* for O_SYNC */ + WAL_SYNC_METHOD_FSYNC_WRITETHROUGH, + WAL_SYNC_METHOD_OPEN_DSYNC /* for O_DSYNC */ +}; +extern PGDLLIMPORT int wal_sync_method; + +extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr; +extern PGDLLIMPORT XLogRecPtr XactLastRecEnd; +extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd; + +/* these variables are GUC parameters related to XLOG */ +extern PGDLLIMPORT int wal_segment_size; +extern PGDLLIMPORT int min_wal_size_mb; +extern PGDLLIMPORT int max_wal_size_mb; +extern PGDLLIMPORT int wal_keep_size_mb; +extern PGDLLIMPORT int max_slot_wal_keep_size_mb; +extern PGDLLIMPORT int XLOGbuffers; +extern PGDLLIMPORT int XLogArchiveTimeout; +extern PGDLLIMPORT int wal_retrieve_retry_interval; +extern PGDLLIMPORT char *XLogArchiveCommand; +extern PGDLLIMPORT bool EnableHotStandby; +extern PGDLLIMPORT bool fullPageWrites; +extern PGDLLIMPORT bool wal_log_hints; +extern PGDLLIMPORT int wal_compression; +extern PGDLLIMPORT bool wal_init_zero; +extern PGDLLIMPORT bool wal_recycle; +extern PGDLLIMPORT bool *wal_consistency_checking; +extern PGDLLIMPORT char *wal_consistency_checking_string; +extern PGDLLIMPORT bool log_checkpoints; +extern PGDLLIMPORT int CommitDelay; +extern PGDLLIMPORT int CommitSiblings; +extern PGDLLIMPORT bool track_wal_io_timing; +extern PGDLLIMPORT int wal_decode_buffer_size; + +extern PGDLLIMPORT int CheckPointSegments; + +/* Archive modes */ +typedef enum ArchiveMode +{ + ARCHIVE_MODE_OFF = 0, /* disabled */ + ARCHIVE_MODE_ON, /* enabled while server is running normally */ + ARCHIVE_MODE_ALWAYS, /* enabled always (even during recovery) */ +} ArchiveMode; +extern PGDLLIMPORT int XLogArchiveMode; + +/* WAL levels */ +typedef enum WalLevel +{ + WAL_LEVEL_MINIMAL = 0, + WAL_LEVEL_REPLICA, + WAL_LEVEL_LOGICAL, +} WalLevel; + +/* Compression algorithms for WAL */ +typedef enum WalCompression +{ + WAL_COMPRESSION_NONE = 0, + WAL_COMPRESSION_PGLZ, + WAL_COMPRESSION_LZ4, + WAL_COMPRESSION_ZSTD, +} WalCompression; + +/* Recovery states */ +typedef enum RecoveryState +{ + RECOVERY_STATE_CRASH = 0, /* crash recovery */ + RECOVERY_STATE_ARCHIVE, /* archive recovery */ + RECOVERY_STATE_DONE, /* currently in production */ +} RecoveryState; + +extern PGDLLIMPORT int wal_level; + +/* Is WAL archiving enabled (always or only while server is running normally)? */ +#define XLogArchivingActive() \ + (AssertMacro(XLogArchiveMode == ARCHIVE_MODE_OFF || wal_level >= WAL_LEVEL_REPLICA), XLogArchiveMode > ARCHIVE_MODE_OFF) +/* Is WAL archiving enabled always (even during recovery)? */ +#define XLogArchivingAlways() \ + (AssertMacro(XLogArchiveMode == ARCHIVE_MODE_OFF || wal_level >= WAL_LEVEL_REPLICA), XLogArchiveMode == ARCHIVE_MODE_ALWAYS) + +/* + * Is WAL-logging necessary for archival or log-shipping, or can we skip + * WAL-logging if we fsync() the data before committing instead? + */ +#define XLogIsNeeded() (wal_level >= WAL_LEVEL_REPLICA) + +/* + * Is a full-page image needed for hint bit updates? + * + * Normally, we don't WAL-log hint bit updates, but if checksums are enabled, + * we have to protect them against torn page writes. When you only set + * individual bits on a page, it's still consistent no matter what combination + * of the bits make it to disk, but the checksum wouldn't match. Also WAL-log + * them if forced by wal_log_hints=on. + */ +#define XLogHintBitIsNeeded() (DataChecksumsEnabled() || wal_log_hints) + +/* Do we need to WAL-log information required only for Hot Standby and logical replication? */ +#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_REPLICA) + +/* Do we need to WAL-log information required only for logical replication? */ +#define XLogLogicalInfoActive() (wal_level >= WAL_LEVEL_LOGICAL) + +#ifdef WAL_DEBUG +extern PGDLLIMPORT bool XLOG_DEBUG; +#endif + +/* + * OR-able request flag bits for checkpoints. The "cause" bits are used only + * for logging purposes. Note: the flags must be defined so that it's + * sensible to OR together request flags arising from different requestors. + */ + +/* These directly affect the behavior of CreateCheckPoint and subsidiaries */ +#define CHECKPOINT_IS_SHUTDOWN 0x0001 /* Checkpoint is for shutdown */ +#define CHECKPOINT_END_OF_RECOVERY 0x0002 /* Like shutdown checkpoint, but + * issued at end of WAL recovery */ +#define CHECKPOINT_IMMEDIATE 0x0004 /* Do it without delays */ +#define CHECKPOINT_FORCE 0x0008 /* Force even if no activity */ +#define CHECKPOINT_FLUSH_ALL 0x0010 /* Flush all pages, including those + * belonging to unlogged tables */ +/* These are important to RequestCheckpoint */ +#define CHECKPOINT_WAIT 0x0020 /* Wait for completion */ +#define CHECKPOINT_REQUESTED 0x0040 /* Checkpoint request has been made */ +/* These indicate the cause of a checkpoint request */ +#define CHECKPOINT_CAUSE_XLOG 0x0080 /* XLOG consumption */ +#define CHECKPOINT_CAUSE_TIME 0x0100 /* Elapsed time */ + +/* + * Flag bits for the record being inserted, set using XLogSetRecordFlags(). + */ +#define XLOG_INCLUDE_ORIGIN 0x01 /* include the replication origin */ +#define XLOG_MARK_UNIMPORTANT 0x02 /* record not important for durability */ + + +/* Checkpoint statistics */ +typedef struct CheckpointStatsData +{ + TimestampTz ckpt_start_t; /* start of checkpoint */ + TimestampTz ckpt_write_t; /* start of flushing buffers */ + TimestampTz ckpt_sync_t; /* start of fsyncs */ + TimestampTz ckpt_sync_end_t; /* end of fsyncs */ + TimestampTz ckpt_end_t; /* end of checkpoint */ + + int ckpt_bufs_written; /* # of buffers written */ + int ckpt_slru_written; /* # of SLRU buffers written */ + + int ckpt_segs_added; /* # of new xlog segments created */ + int ckpt_segs_removed; /* # of xlog segments deleted */ + int ckpt_segs_recycled; /* # of xlog segments recycled */ + + int ckpt_sync_rels; /* # of relations synced */ + uint64 ckpt_longest_sync; /* Longest sync for one relation */ + uint64 ckpt_agg_sync_time; /* The sum of all the individual sync + * times, which is not necessarily the + * same as the total elapsed time for the + * entire sync phase. */ +} CheckpointStatsData; + +extern PGDLLIMPORT CheckpointStatsData CheckpointStats; + +/* + * GetWALAvailability return codes + */ +typedef enum WALAvailability +{ + WALAVAIL_INVALID_LSN, /* parameter error */ + WALAVAIL_RESERVED, /* WAL segment is within max_wal_size */ + WALAVAIL_EXTENDED, /* WAL segment is reserved by a slot or + * wal_keep_size */ + WALAVAIL_UNRESERVED, /* no longer reserved, but not removed yet */ + WALAVAIL_REMOVED, /* WAL segment has been removed */ +} WALAvailability; + +struct XLogRecData; +struct XLogReaderState; + +extern XLogRecPtr XLogInsertRecord(struct XLogRecData *rdata, + XLogRecPtr fpw_lsn, + uint8 flags, + int num_fpi, + bool topxid_included); +extern void XLogFlush(XLogRecPtr record); +extern bool XLogBackgroundFlush(void); +extern bool XLogNeedsFlush(XLogRecPtr record); +extern int XLogFileInit(XLogSegNo logsegno, TimeLineID logtli); +extern int XLogFileOpen(XLogSegNo segno, TimeLineID tli); + +extern void CheckXLogRemoved(XLogSegNo segno, TimeLineID tli); +extern XLogSegNo XLogGetLastRemovedSegno(void); +extern XLogSegNo XLogGetOldestSegno(TimeLineID tli); +extern void XLogSetAsyncXactLSN(XLogRecPtr asyncXactLSN); +extern void XLogSetReplicationSlotMinimumLSN(XLogRecPtr lsn); +extern XLogRecPtr XLogGetReplicationSlotMinimumLSN(void); + +extern void xlog_redo(struct XLogReaderState *record); +extern void xlog_desc(StringInfo buf, struct XLogReaderState *record); +extern const char *xlog_identify(uint8 info); + +extern void issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli); + +extern bool RecoveryInProgress(void); +extern RecoveryState GetRecoveryState(void); +extern bool XLogInsertAllowed(void); +extern XLogRecPtr GetXLogInsertRecPtr(void); +extern XLogRecPtr GetXLogWriteRecPtr(void); + +extern uint64 GetSystemIdentifier(void); +extern char *GetMockAuthenticationNonce(void); +extern bool DataChecksumsEnabled(void); +extern bool GetDefaultCharSignedness(void); +extern XLogRecPtr GetFakeLSNForUnloggedRel(void); +extern Size XLOGShmemSize(void); +extern void XLOGShmemInit(void); +extern void BootStrapXLOG(uint32 data_checksum_version); +extern void InitializeWalConsistencyChecking(void); +extern void LocalProcessControlFile(bool reset); +extern WalLevel GetActiveWalLevelOnStandby(void); +extern void StartupXLOG(void); +extern void ShutdownXLOG(int code, Datum arg); +extern bool CreateCheckPoint(int flags); +extern bool CreateRestartPoint(int flags); +extern WALAvailability GetWALAvailability(XLogRecPtr targetLSN); +extern void XLogPutNextOid(Oid nextOid); +extern XLogRecPtr XLogRestorePoint(const char *rpName); +extern void UpdateFullPageWrites(void); +extern void GetFullPageWriteInfo(XLogRecPtr *RedoRecPtr_p, bool *doPageWrites_p); +extern XLogRecPtr GetRedoRecPtr(void); +extern XLogRecPtr GetInsertRecPtr(void); +extern XLogRecPtr GetFlushRecPtr(TimeLineID *insertTLI); +extern TimeLineID GetWALInsertionTimeLine(void); +extern TimeLineID GetWALInsertionTimeLineIfSet(void); +extern XLogRecPtr GetLastImportantRecPtr(void); + +extern void SetWalWriterSleeping(bool sleeping); + +extern Size WALReadFromBuffers(char *dstbuf, XLogRecPtr startptr, Size count, + TimeLineID tli); + +/* + * Routines used by xlogrecovery.c to call back into xlog.c during recovery. + */ +extern void RemoveNonParentXlogFiles(XLogRecPtr switchpoint, TimeLineID newTLI); +extern bool XLogCheckpointNeeded(XLogSegNo new_segno); +extern void SwitchIntoArchiveRecovery(XLogRecPtr EndRecPtr, TimeLineID replayTLI); +extern void ReachedEndOfBackup(XLogRecPtr EndRecPtr, TimeLineID tli); +extern void SetInstallXLogFileSegmentActive(void); +extern bool IsInstallXLogFileSegmentActive(void); +extern void ResetInstallXLogFileSegmentActive(void); +extern void XLogShutdownWalRcv(void); + +/* + * Routines to start, stop, and get status of a base backup. + */ + +/* + * Session-level status of base backups + * + * This is used in parallel with the shared memory status to control parallel + * execution of base backup functions for a given session, be it a backend + * dedicated to replication or a normal backend connected to a database. The + * update of the session-level status happens at the same time as the shared + * memory counters to keep a consistent global and local state of the backups + * running. + */ +typedef enum SessionBackupState +{ + SESSION_BACKUP_NONE, + SESSION_BACKUP_RUNNING, +} SessionBackupState; + +extern void do_pg_backup_start(const char *backupidstr, bool fast, + List **tablespaces, BackupState *state, + StringInfo tblspcmapfile); +extern void do_pg_backup_stop(BackupState *state, bool waitforarchive); +extern void do_pg_abort_backup(int code, Datum arg); +extern void register_persistent_abort_backup_handler(void); +extern SessionBackupState get_backup_status(void); + +/* File path names (all relative to $PGDATA) */ +#define RECOVERY_SIGNAL_FILE "recovery.signal" +#define STANDBY_SIGNAL_FILE "standby.signal" +#define BACKUP_LABEL_FILE "backup_label" +#define BACKUP_LABEL_OLD "backup_label.old" + +#define TABLESPACE_MAP "tablespace_map" +#define TABLESPACE_MAP_OLD "tablespace_map.old" + +/* files to signal promotion to primary */ +#define PROMOTE_SIGNAL_FILE "promote" + +#endif /* XLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlog_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlog_internal.h new file mode 100644 index 0000000..2cf8d55 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlog_internal.h @@ -0,0 +1,405 @@ +/* + * xlog_internal.h + * + * PostgreSQL write-ahead log internal declarations + * + * NOTE: this file is intended to contain declarations useful for + * manipulating the XLOG files directly, but it is not supposed to be + * needed by rmgr routines (redo support for individual record types). + * So the XLogRecord typedef and associated stuff appear in xlogrecord.h. + * + * Note: This file must be includable in both frontend and backend contexts, + * to allow stand-alone tools like pg_receivewal to deal with WAL files. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlog_internal.h + */ +#ifndef XLOG_INTERNAL_H +#define XLOG_INTERNAL_H + +#include "access/xlogdefs.h" +#include "access/xlogreader.h" +#include "datatype/timestamp.h" +#include "lib/stringinfo.h" +#include "pgtime.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" + + +/* + * Each page of XLOG file has a header like this: + */ +#define XLOG_PAGE_MAGIC 0xD118 /* can be used as WAL version indicator */ + +typedef struct XLogPageHeaderData +{ + uint16 xlp_magic; /* magic value for correctness checks */ + uint16 xlp_info; /* flag bits, see below */ + TimeLineID xlp_tli; /* TimeLineID of first record on page */ + XLogRecPtr xlp_pageaddr; /* XLOG address of this page */ + + /* + * When there is not enough space on current page for whole record, we + * continue on the next page. xlp_rem_len is the number of bytes + * remaining from a previous page; it tracks xl_tot_len in the initial + * header. Note that the continuation data isn't necessarily aligned. + */ + uint32 xlp_rem_len; /* total len of remaining data for record */ +} XLogPageHeaderData; + +#define SizeOfXLogShortPHD MAXALIGN(sizeof(XLogPageHeaderData)) + +typedef XLogPageHeaderData *XLogPageHeader; + +/* + * When the XLP_LONG_HEADER flag is set, we store additional fields in the + * page header. (This is ordinarily done just in the first page of an + * XLOG file.) The additional fields serve to identify the file accurately. + */ +typedef struct XLogLongPageHeaderData +{ + XLogPageHeaderData std; /* standard header fields */ + uint64 xlp_sysid; /* system identifier from pg_control */ + uint32 xlp_seg_size; /* just as a cross-check */ + uint32 xlp_xlog_blcksz; /* just as a cross-check */ +} XLogLongPageHeaderData; + +#define SizeOfXLogLongPHD MAXALIGN(sizeof(XLogLongPageHeaderData)) + +typedef XLogLongPageHeaderData *XLogLongPageHeader; + +/* When record crosses page boundary, set this flag in new page's header */ +#define XLP_FIRST_IS_CONTRECORD 0x0001 +/* This flag indicates a "long" page header */ +#define XLP_LONG_HEADER 0x0002 +/* This flag indicates backup blocks starting in this page are optional */ +#define XLP_BKP_REMOVABLE 0x0004 +/* Replaces a missing contrecord; see CreateOverwriteContrecordRecord */ +#define XLP_FIRST_IS_OVERWRITE_CONTRECORD 0x0008 +/* All defined flag bits in xlp_info (used for validity checking of header) */ +#define XLP_ALL_FLAGS 0x000F + +#define XLogPageHeaderSize(hdr) \ + (((hdr)->xlp_info & XLP_LONG_HEADER) ? SizeOfXLogLongPHD : SizeOfXLogShortPHD) + +/* wal_segment_size can range from 1MB to 1GB */ +#define WalSegMinSize 1024 * 1024 +#define WalSegMaxSize 1024 * 1024 * 1024 +/* default number of min and max wal segments */ +#define DEFAULT_MIN_WAL_SEGS 5 +#define DEFAULT_MAX_WAL_SEGS 64 + +/* check that the given size is a valid wal_segment_size */ +#define IsPowerOf2(x) (x > 0 && ((x) & ((x)-1)) == 0) +#define IsValidWalSegSize(size) \ + (IsPowerOf2(size) && \ + ((size) >= WalSegMinSize && (size) <= WalSegMaxSize)) + +#define XLogSegmentsPerXLogId(wal_segsz_bytes) \ + (UINT64CONST(0x100000000) / (wal_segsz_bytes)) + +#define XLogSegNoOffsetToRecPtr(segno, offset, wal_segsz_bytes, dest) \ + (dest) = (segno) * (wal_segsz_bytes) + (offset) + +#define XLogSegmentOffset(xlogptr, wal_segsz_bytes) \ + ((xlogptr) & ((wal_segsz_bytes) - 1)) + +/* + * Compute a segment number from an XLogRecPtr. + * + * For XLByteToSeg, do the computation at face value. For XLByteToPrevSeg, + * a boundary byte is taken to be in the previous segment. This is suitable + * for deciding which segment to write given a pointer to a record end, + * for example. + */ +#define XLByteToSeg(xlrp, logSegNo, wal_segsz_bytes) \ + logSegNo = (xlrp) / (wal_segsz_bytes) + +#define XLByteToPrevSeg(xlrp, logSegNo, wal_segsz_bytes) \ + logSegNo = ((xlrp) - 1) / (wal_segsz_bytes) + +/* + * Convert values of GUCs measured in megabytes to equiv. segment count. + * Rounds down. + */ +#define XLogMBVarToSegs(mbvar, wal_segsz_bytes) \ + ((mbvar) / ((wal_segsz_bytes) / (1024 * 1024))) + +/* + * Is an XLogRecPtr within a particular XLOG segment? + * + * For XLByteInSeg, do the computation at face value. For XLByteInPrevSeg, + * a boundary byte is taken to be in the previous segment. + */ +#define XLByteInSeg(xlrp, logSegNo, wal_segsz_bytes) \ + (((xlrp) / (wal_segsz_bytes)) == (logSegNo)) + +#define XLByteInPrevSeg(xlrp, logSegNo, wal_segsz_bytes) \ + ((((xlrp) - 1) / (wal_segsz_bytes)) == (logSegNo)) + +/* Check if an XLogRecPtr value is in a plausible range */ +#define XRecOffIsValid(xlrp) \ + ((xlrp) % XLOG_BLCKSZ >= SizeOfXLogShortPHD) + +/* + * The XLog directory and control file (relative to $PGDATA) + */ +#define XLOGDIR "pg_wal" +#define XLOG_CONTROL_FILE "global/pg_control" + +/* + * These macros encapsulate knowledge about the exact layout of XLog file + * names, timeline history file names, and archive-status file names. + */ +#define MAXFNAMELEN 64 + +/* Length of XLog file name */ +#define XLOG_FNAME_LEN 24 + +/* + * Generate a WAL segment file name. Do not use this function in a helper + * function allocating the result generated. + */ +static inline void +XLogFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes) +{ + snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli, + (uint32) (logSegNo / XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (logSegNo % XLogSegmentsPerXLogId(wal_segsz_bytes))); +} + +static inline void +XLogFileNameById(char *fname, TimeLineID tli, uint32 log, uint32 seg) +{ + snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli, log, seg); +} + +static inline bool +IsXLogFileName(const char *fname) +{ + return (strlen(fname) == XLOG_FNAME_LEN && \ + strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN); +} + +/* + * XLOG segment with .partial suffix. Used by pg_receivewal and at end of + * archive recovery, when we want to archive a WAL segment but it might not + * be complete yet. + */ +static inline bool +IsPartialXLogFileName(const char *fname) +{ + return (strlen(fname) == XLOG_FNAME_LEN + strlen(".partial") && + strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN && + strcmp(fname + XLOG_FNAME_LEN, ".partial") == 0); +} + +static inline void +XLogFromFileName(const char *fname, TimeLineID *tli, XLogSegNo *logSegNo, int wal_segsz_bytes) +{ + uint32 log; + uint32 seg; + + sscanf(fname, "%08X%08X%08X", tli, &log, &seg); + *logSegNo = (uint64) log * XLogSegmentsPerXLogId(wal_segsz_bytes) + seg; +} + +static inline void +XLogFilePath(char *path, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes) +{ + snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X", tli, + (uint32) (logSegNo / XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (logSegNo % XLogSegmentsPerXLogId(wal_segsz_bytes))); +} + +static inline void +TLHistoryFileName(char *fname, TimeLineID tli) +{ + snprintf(fname, MAXFNAMELEN, "%08X.history", tli); +} + +static inline bool +IsTLHistoryFileName(const char *fname) +{ + return (strlen(fname) == 8 + strlen(".history") && + strspn(fname, "0123456789ABCDEF") == 8 && + strcmp(fname + 8, ".history") == 0); +} + +static inline void +TLHistoryFilePath(char *path, TimeLineID tli) +{ + snprintf(path, MAXPGPATH, XLOGDIR "/%08X.history", tli); +} + +static inline void +StatusFilePath(char *path, const char *xlog, const char *suffix) +{ + snprintf(path, MAXPGPATH, XLOGDIR "/archive_status/%s%s", xlog, suffix); +} + +static inline void +BackupHistoryFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, XLogRecPtr startpoint, int wal_segsz_bytes) +{ + snprintf(fname, MAXFNAMELEN, "%08X%08X%08X.%08X.backup", tli, + (uint32) (logSegNo / XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (logSegNo % XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (XLogSegmentOffset(startpoint, wal_segsz_bytes))); +} + +static inline bool +IsBackupHistoryFileName(const char *fname) +{ + return (strlen(fname) > XLOG_FNAME_LEN && + strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN && + strcmp(fname + strlen(fname) - strlen(".backup"), ".backup") == 0); +} + +static inline void +BackupHistoryFilePath(char *path, TimeLineID tli, XLogSegNo logSegNo, XLogRecPtr startpoint, int wal_segsz_bytes) +{ + snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X.%08X.backup", tli, + (uint32) (logSegNo / XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (logSegNo % XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (XLogSegmentOffset((startpoint), wal_segsz_bytes))); +} + +/* + * Information logged when we detect a change in one of the parameters + * important for Hot Standby. + */ +typedef struct xl_parameter_change +{ + int MaxConnections; + int max_worker_processes; + int max_wal_senders; + int max_prepared_xacts; + int max_locks_per_xact; + int wal_level; + bool wal_log_hints; + bool track_commit_timestamp; +} xl_parameter_change; + +/* logs restore point */ +typedef struct xl_restore_point +{ + TimestampTz rp_time; + char rp_name[MAXFNAMELEN]; +} xl_restore_point; + +/* Overwrite of prior contrecord */ +typedef struct xl_overwrite_contrecord +{ + XLogRecPtr overwritten_lsn; + TimestampTz overwrite_time; +} xl_overwrite_contrecord; + +/* End of recovery mark, when we don't do an END_OF_RECOVERY checkpoint */ +typedef struct xl_end_of_recovery +{ + TimestampTz end_time; + TimeLineID ThisTimeLineID; /* new TLI */ + TimeLineID PrevTimeLineID; /* previous TLI we forked off from */ + int wal_level; +} xl_end_of_recovery; + +/* + * The functions in xloginsert.c construct a chain of XLogRecData structs + * to represent the final WAL record. + */ +typedef struct XLogRecData +{ + struct XLogRecData *next; /* next struct in chain, or NULL */ + const void *data; /* start of rmgr data to include */ + uint32 len; /* length of rmgr data to include */ +} XLogRecData; + +/* + * Recovery target action. + */ +typedef enum +{ + RECOVERY_TARGET_ACTION_PAUSE, + RECOVERY_TARGET_ACTION_PROMOTE, + RECOVERY_TARGET_ACTION_SHUTDOWN, +} RecoveryTargetAction; + +struct LogicalDecodingContext; +struct XLogRecordBuffer; + +/* + * Method table for resource managers. + * + * This struct must be kept in sync with the PG_RMGR definition in + * rmgr.c. + * + * rm_identify must return a name for the record based on xl_info (without + * reference to the rmid). For example, XLOG_BTREE_VACUUM would be named + * "VACUUM". rm_desc can then be called to obtain additional detail for the + * record, if available (e.g. the last block). + * + * rm_mask takes as input a page modified by the resource manager and masks + * out bits that shouldn't be flagged by wal_consistency_checking. + * + * RmgrTable[] is indexed by RmgrId values (see rmgrlist.h). If rm_name is + * NULL, the corresponding RmgrTable entry is considered invalid. + */ +typedef struct RmgrData +{ + const char *rm_name; + void (*rm_redo) (XLogReaderState *record); + void (*rm_desc) (StringInfo buf, XLogReaderState *record); + const char *(*rm_identify) (uint8 info); + void (*rm_startup) (void); + void (*rm_cleanup) (void); + void (*rm_mask) (char *pagedata, BlockNumber blkno); + void (*rm_decode) (struct LogicalDecodingContext *ctx, + struct XLogRecordBuffer *buf); +} RmgrData; + +extern PGDLLIMPORT RmgrData RmgrTable[]; +extern void RmgrStartup(void); +extern void RmgrCleanup(void); +extern void RmgrNotFound(RmgrId rmid); +extern void RegisterCustomRmgr(RmgrId rmid, const RmgrData *rmgr); + +#ifndef FRONTEND +static inline bool +RmgrIdExists(RmgrId rmid) +{ + return RmgrTable[rmid].rm_name != NULL; +} + +static inline RmgrData +GetRmgr(RmgrId rmid) +{ + if (unlikely(!RmgrIdExists(rmid))) + RmgrNotFound(rmid); + return RmgrTable[rmid]; +} +#endif + +/* + * Exported to support xlog switching from checkpointer + */ +extern pg_time_t GetLastSegSwitchData(XLogRecPtr *lastSwitchLSN); +extern XLogRecPtr RequestXLogSwitch(bool mark_unimportant); + +extern void GetOldestRestartPoint(XLogRecPtr *oldrecptr, TimeLineID *oldtli); + +extern void XLogRecGetBlockRefInfo(XLogReaderState *record, bool pretty, + bool detailed_format, StringInfo buf, + uint32 *fpi_len); + +/* + * Exported for the functions in timeline.c and xlogarchive.c. Only valid + * in the startup process. + */ +extern PGDLLIMPORT bool ArchiveRecoveryRequested; +extern PGDLLIMPORT bool InArchiveRecovery; +extern PGDLLIMPORT bool StandbyMode; +extern PGDLLIMPORT char *recoveryRestoreCommand; + +#endif /* XLOG_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogarchive.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogarchive.h new file mode 100644 index 0000000..6ed47e9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogarchive.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------ + * + * xlogarchive.h + * Prototypes for WAL archives in the backend + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/xlogarchive.h + * + *------------------------------------------------------------------------ + */ + +#ifndef XLOG_ARCHIVE_H +#define XLOG_ARCHIVE_H + +#include "access/xlogdefs.h" + +extern bool RestoreArchivedFile(char *path, const char *xlogfname, + const char *recovername, off_t expectedSize, + bool cleanupEnabled); +extern void ExecuteRecoveryCommand(const char *command, const char *commandName, + bool failOnSignal, uint32 wait_event_info); +extern void KeepFileRestoredFromArchive(const char *path, const char *xlogfname); +extern void XLogArchiveNotify(const char *xlog); +extern void XLogArchiveNotifySeg(XLogSegNo segno, TimeLineID tli); +extern void XLogArchiveForceDone(const char *xlog); +extern bool XLogArchiveCheckDone(const char *xlog); +extern bool XLogArchiveIsBusy(const char *xlog); +extern bool XLogArchiveIsReady(const char *xlog); +extern bool XLogArchiveIsReadyOrDone(const char *xlog); +extern void XLogArchiveCleanup(const char *xlog); + +#endif /* XLOG_ARCHIVE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogbackup.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogbackup.h new file mode 100644 index 0000000..6b828ce --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogbackup.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * xlogbackup.h + * Definitions for internals of base backups. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/xlogbackup.h + *------------------------------------------------------------------------- + */ + +#ifndef XLOG_BACKUP_H +#define XLOG_BACKUP_H + +#include "access/xlogdefs.h" +#include "pgtime.h" + +/* Structure to hold backup state. */ +typedef struct BackupState +{ + /* Fields saved at backup start */ + /* Backup label name one extra byte for null-termination */ + char name[MAXPGPATH + 1]; + XLogRecPtr startpoint; /* backup start WAL location */ + TimeLineID starttli; /* backup start TLI */ + XLogRecPtr checkpointloc; /* last checkpoint location */ + pg_time_t starttime; /* backup start time */ + bool started_in_recovery; /* backup started in recovery? */ + XLogRecPtr istartpoint; /* incremental based on backup at this LSN */ + TimeLineID istarttli; /* incremental based on backup on this TLI */ + + /* Fields saved at the end of backup */ + XLogRecPtr stoppoint; /* backup stop WAL location */ + TimeLineID stoptli; /* backup stop TLI */ + pg_time_t stoptime; /* backup stop time */ +} BackupState; + +extern char *build_backup_content(BackupState *state, + bool ishistoryfile); + +#endif /* XLOG_BACKUP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogdefs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogdefs.h new file mode 100644 index 0000000..5464861 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogdefs.h @@ -0,0 +1,83 @@ +/* + * xlogdefs.h + * + * Postgres write-ahead log manager record pointer and + * timeline number definitions + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlogdefs.h + */ +#ifndef XLOG_DEFS_H +#define XLOG_DEFS_H + +#include /* need open() flags */ + +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + */ +typedef uint64 XLogRecPtr; + +/* + * Zero is used indicate an invalid pointer. Bootstrap skips the first possible + * WAL segment, initializing the first WAL page at WAL segment size, so no XLOG + * record can begin at zero. + */ +#define InvalidXLogRecPtr 0 +#define XLogRecPtrIsValid(r) ((r) != InvalidXLogRecPtr) +#define XLogRecPtrIsInvalid(r) ((r) == InvalidXLogRecPtr) + +/* + * First LSN to use for "fake" LSNs. + * + * Values smaller than this can be used for special per-AM purposes. + */ +#define FirstNormalUnloggedLSN ((XLogRecPtr) 1000) + +/* + * Handy macro for printing XLogRecPtr in conventional format, e.g., + * + * printf("%X/%X", LSN_FORMAT_ARGS(lsn)); + */ +#define LSN_FORMAT_ARGS(lsn) (AssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn)) + +/* + * XLogSegNo - physical log file sequence number. + */ +typedef uint64 XLogSegNo; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/* + * Replication origin id - this is located in this file to avoid having to + * include origin.h in a bunch of xlog related places. + */ +typedef uint16 RepOriginId; + +/* + * This chunk of hackery attempts to determine which file sync methods + * are available on the current platform, and to choose an appropriate + * default method. + * + * Note that we define our own O_DSYNC on Windows, but not O_SYNC. + */ +#if defined(PLATFORM_DEFAULT_WAL_SYNC_METHOD) +#define DEFAULT_WAL_SYNC_METHOD PLATFORM_DEFAULT_WAL_SYNC_METHOD +#elif defined(O_DSYNC) && (!defined(O_SYNC) || O_DSYNC != O_SYNC) +#define DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_OPEN_DSYNC +#else +#define DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_FDATASYNC +#endif + +#endif /* XLOG_DEFS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xloginsert.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xloginsert.h new file mode 100644 index 0000000..cf057f0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xloginsert.h @@ -0,0 +1,68 @@ +/* + * xloginsert.h + * + * Functions for generating WAL records + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xloginsert.h + */ +#ifndef XLOGINSERT_H +#define XLOGINSERT_H + +#include "access/rmgr.h" +#include "access/xlogdefs.h" +#include "storage/block.h" +#include "storage/buf.h" +#include "storage/bufpage.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" + +/* + * The minimum size of the WAL construction working area. If you need to + * register more than XLR_NORMAL_MAX_BLOCK_ID block references or have more + * than XLR_NORMAL_RDATAS data chunks in a single WAL record, you must call + * XLogEnsureRecordSpace() first to allocate more working memory. + */ +#define XLR_NORMAL_MAX_BLOCK_ID 4 +#define XLR_NORMAL_RDATAS 20 + +/* flags for XLogRegisterBuffer */ +#define REGBUF_FORCE_IMAGE 0x01 /* force a full-page image */ +#define REGBUF_NO_IMAGE 0x02 /* don't take a full-page image */ +#define REGBUF_WILL_INIT (0x04 | 0x02) /* page will be re-initialized at + * replay (implies NO_IMAGE) */ +#define REGBUF_STANDARD 0x08 /* page follows "standard" page layout, + * (data between pd_lower and pd_upper + * will be skipped) */ +#define REGBUF_KEEP_DATA 0x10 /* include data even if a full-page image + * is taken */ +#define REGBUF_NO_CHANGE 0x20 /* intentionally register clean buffer */ + +/* prototypes for public functions in xloginsert.c: */ +extern void XLogBeginInsert(void); +extern void XLogSetRecordFlags(uint8 flags); +extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info); +extern void XLogEnsureRecordSpace(int max_block_id, int ndatas); +extern void XLogRegisterData(const void *data, uint32 len); +extern void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags); +extern void XLogRegisterBlock(uint8 block_id, RelFileLocator *rlocator, + ForkNumber forknum, BlockNumber blknum, const PageData *page, + uint8 flags); +extern void XLogRegisterBufData(uint8 block_id, const void *data, uint32 len); +extern void XLogResetInsertion(void); +extern bool XLogCheckBufferNeedsBackup(Buffer buffer); + +extern XLogRecPtr log_newpage(RelFileLocator *rlocator, ForkNumber forknum, + BlockNumber blkno, Page page, bool page_std); +extern void log_newpages(RelFileLocator *rlocator, ForkNumber forknum, int num_pages, + BlockNumber *blknos, Page *pages, bool page_std); +extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std); +extern void log_newpage_range(Relation rel, ForkNumber forknum, + BlockNumber startblk, BlockNumber endblk, bool page_std); +extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std); + +extern void InitXLogInsert(void); + +#endif /* XLOGINSERT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogprefetcher.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogprefetcher.h new file mode 100644 index 0000000..50b39c1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogprefetcher.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------------------- + * + * xlogprefetcher.h + * Declarations for the recovery prefetching module. + * + * Portions Copyright (c) 2022-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/xlogprefetcher.h + *------------------------------------------------------------------------- + */ +#ifndef XLOGPREFETCHER_H +#define XLOGPREFETCHER_H + +#include "access/xlogdefs.h" +#include "access/xlogreader.h" +#include "access/xlogrecord.h" + +/* GUCs */ +extern PGDLLIMPORT int recovery_prefetch; + +/* Possible values for recovery_prefetch */ +typedef enum +{ + RECOVERY_PREFETCH_OFF, + RECOVERY_PREFETCH_ON, + RECOVERY_PREFETCH_TRY, +} RecoveryPrefetchValue; + +struct XLogPrefetcher; +typedef struct XLogPrefetcher XLogPrefetcher; + + +extern void XLogPrefetchReconfigure(void); + +extern size_t XLogPrefetchShmemSize(void); +extern void XLogPrefetchShmemInit(void); + +extern void XLogPrefetchResetStats(void); + +extern XLogPrefetcher *XLogPrefetcherAllocate(XLogReaderState *reader); +extern void XLogPrefetcherFree(XLogPrefetcher *prefetcher); + +extern XLogReaderState *XLogPrefetcherGetReader(XLogPrefetcher *prefetcher); + +extern void XLogPrefetcherBeginRead(XLogPrefetcher *prefetcher, + XLogRecPtr recPtr); + +extern XLogRecord *XLogPrefetcherReadRecord(XLogPrefetcher *prefetcher, + char **errmsg); + +extern void XLogPrefetcherComputeStats(XLogPrefetcher *prefetcher); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogreader.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogreader.h new file mode 100644 index 0000000..9738462 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogreader.h @@ -0,0 +1,444 @@ +/*------------------------------------------------------------------------- + * + * xlogreader.h + * Definitions for the generic XLog reading facility + * + * Portions Copyright (c) 2013-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/access/xlogreader.h + * + * NOTES + * See the definition of the XLogReaderState struct for instructions on + * how to use the XLogReader infrastructure. + * + * The basic idea is to allocate an XLogReaderState via + * XLogReaderAllocate(), position the reader to the first record with + * XLogBeginRead() or XLogFindNextRecord(), and call XLogReadRecord() + * until it returns NULL. + * + * Callers supply a page_read callback if they want to call + * XLogReadRecord or XLogFindNextRecord; it can be passed in as NULL + * otherwise. The WALRead function can be used as a helper to write + * page_read callbacks, but it is not mandatory; callers that use it, + * must supply segment_open callbacks. The segment_close callback + * must always be supplied. + * + * After reading a record with XLogReadRecord(), it's decomposed into + * the per-block and main data parts, and the parts can be accessed + * with the XLogRec* macros and functions. You can also decode a + * record that's already constructed in memory, without reading from + * disk, by calling the DecodeXLogRecord() function. + *------------------------------------------------------------------------- + */ +#ifndef XLOGREADER_H +#define XLOGREADER_H + +#ifndef FRONTEND +#include "access/transam.h" +#endif + +#include "access/xlogrecord.h" +#include "storage/buf.h" + +/* WALOpenSegment represents a WAL segment being read. */ +typedef struct WALOpenSegment +{ + int ws_file; /* segment file descriptor */ + XLogSegNo ws_segno; /* segment number */ + TimeLineID ws_tli; /* timeline ID of the currently open file */ +} WALOpenSegment; + +/* WALSegmentContext carries context information about WAL segments to read */ +typedef struct WALSegmentContext +{ + char ws_dir[MAXPGPATH]; + int ws_segsize; +} WALSegmentContext; + +typedef struct XLogReaderState XLogReaderState; + +/* Function type definitions for various xlogreader interactions */ +typedef int (*XLogPageReadCB) (XLogReaderState *xlogreader, + XLogRecPtr targetPagePtr, + int reqLen, + XLogRecPtr targetRecPtr, + char *readBuf); +typedef void (*WALSegmentOpenCB) (XLogReaderState *xlogreader, + XLogSegNo nextSegNo, + TimeLineID *tli_p); +typedef void (*WALSegmentCloseCB) (XLogReaderState *xlogreader); + +typedef struct XLogReaderRoutine +{ + /* + * Data input callback + * + * This callback shall read at least reqLen valid bytes of the xlog page + * starting at targetPagePtr, and store them in readBuf. The callback + * shall return the number of bytes read (never more than XLOG_BLCKSZ), or + * -1 on failure. The callback shall sleep, if necessary, to wait for the + * requested bytes to become available. The callback will not be invoked + * again for the same page unless more than the returned number of bytes + * are needed. + * + * targetRecPtr is the position of the WAL record we're reading. Usually + * it is equal to targetPagePtr + reqLen, but sometimes xlogreader needs + * to read and verify the page or segment header, before it reads the + * actual WAL record it's interested in. In that case, targetRecPtr can + * be used to determine which timeline to read the page from. + * + * The callback shall set ->seg.ws_tli to the TLI of the file the page was + * read from. + */ + XLogPageReadCB page_read; + + /* + * Callback to open the specified WAL segment for reading. ->seg.ws_file + * shall be set to the file descriptor of the opened segment. In case of + * failure, an error shall be raised by the callback and it shall not + * return. + * + * "nextSegNo" is the number of the segment to be opened. + * + * "tli_p" is an input/output argument. WALRead() uses it to pass the + * timeline in which the new segment should be found, but the callback can + * use it to return the TLI that it actually opened. + */ + WALSegmentOpenCB segment_open; + + /* + * WAL segment close callback. ->seg.ws_file shall be set to a negative + * number. + */ + WALSegmentCloseCB segment_close; +} XLogReaderRoutine; + +#define XL_ROUTINE(...) &(XLogReaderRoutine){__VA_ARGS__} + +typedef struct +{ + /* Is this block ref in use? */ + bool in_use; + + /* Identify the block this refers to */ + RelFileLocator rlocator; + ForkNumber forknum; + BlockNumber blkno; + + /* Prefetching workspace. */ + Buffer prefetch_buffer; + + /* copy of the fork_flags field from the XLogRecordBlockHeader */ + uint8 flags; + + /* Information on full-page image, if any */ + bool has_image; /* has image, even for consistency checking */ + bool apply_image; /* has image that should be restored */ + char *bkp_image; + uint16 hole_offset; + uint16 hole_length; + uint16 bimg_len; + uint8 bimg_info; + + /* Buffer holding the rmgr-specific data associated with this block */ + bool has_data; + char *data; + uint16 data_len; + uint16 data_bufsz; +} DecodedBkpBlock; + +/* + * The decoded contents of a record. This occupies a contiguous region of + * memory, with main_data and blocks[n].data pointing to memory after the + * members declared here. + */ +typedef struct DecodedXLogRecord +{ + /* Private member used for resource management. */ + size_t size; /* total size of decoded record */ + bool oversized; /* outside the regular decode buffer? */ + struct DecodedXLogRecord *next; /* decoded record queue link */ + + /* Public members. */ + XLogRecPtr lsn; /* location */ + XLogRecPtr next_lsn; /* location of next record */ + XLogRecord header; /* header */ + RepOriginId record_origin; + TransactionId toplevel_xid; /* XID of top-level transaction */ + char *main_data; /* record's main data portion */ + uint32 main_data_len; /* main data portion's length */ + int max_block_id; /* highest block_id in use (-1 if none) */ + DecodedBkpBlock blocks[FLEXIBLE_ARRAY_MEMBER]; +} DecodedXLogRecord; + +struct XLogReaderState +{ + /* + * Operational callbacks + */ + XLogReaderRoutine routine; + + /* ---------------------------------------- + * Public parameters + * ---------------------------------------- + */ + + /* + * System identifier of the xlog files we're about to read. Set to zero + * (the default value) if unknown or unimportant. + */ + uint64 system_identifier; + + /* + * Opaque data for callbacks to use. Not used by XLogReader. + */ + void *private_data; + + /* + * Start and end point of last record read. EndRecPtr is also used as the + * position to read next. Calling XLogBeginRead() sets EndRecPtr to the + * starting position and ReadRecPtr to invalid. + * + * Start and end point of last record returned by XLogReadRecord(). These + * are also available as record->lsn and record->next_lsn. + */ + XLogRecPtr ReadRecPtr; /* start of last record read */ + XLogRecPtr EndRecPtr; /* end+1 of last record read */ + + /* + * Set at the end of recovery: the start point of a partial record at the + * end of WAL (InvalidXLogRecPtr if there wasn't one), and the start + * location of its first contrecord that went missing. + */ + XLogRecPtr abortedRecPtr; + XLogRecPtr missingContrecPtr; + /* Set when XLP_FIRST_IS_OVERWRITE_CONTRECORD is found */ + XLogRecPtr overwrittenRecPtr; + + + /* ---------------------------------------- + * Decoded representation of current record + * + * Use XLogRecGet* functions to investigate the record; these fields + * should not be accessed directly. + * ---------------------------------------- + * Start and end point of the last record read and decoded by + * XLogReadRecord(). NextRecPtr is also used as the position to decode + * next. Calling XLogBeginRead() sets NextRecPtr and EndRecPtr to the + * requested starting position. + */ + XLogRecPtr DecodeRecPtr; /* start of last record decoded */ + XLogRecPtr NextRecPtr; /* end+1 of last record decoded */ + XLogRecPtr PrevRecPtr; /* start of previous record decoded */ + + /* Last record returned by XLogReadRecord(). */ + DecodedXLogRecord *record; + + /* ---------------------------------------- + * private/internal state + * ---------------------------------------- + */ + + /* + * Buffer for decoded records. This is a circular buffer, though + * individual records can't be split in the middle, so some space is often + * wasted at the end. Oversized records that don't fit in this space are + * allocated separately. + */ + char *decode_buffer; + size_t decode_buffer_size; + bool free_decode_buffer; /* need to free? */ + char *decode_buffer_head; /* data is read from the head */ + char *decode_buffer_tail; /* new data is written at the tail */ + + /* + * Queue of records that have been decoded. This is a linked list that + * usually consists of consecutive records in decode_buffer, but may also + * contain oversized records allocated with palloc(). + */ + DecodedXLogRecord *decode_queue_head; /* oldest decoded record */ + DecodedXLogRecord *decode_queue_tail; /* newest decoded record */ + + /* + * Buffer for currently read page (XLOG_BLCKSZ bytes, valid up to at least + * readLen bytes) + */ + char *readBuf; + uint32 readLen; + + /* last read XLOG position for data currently in readBuf */ + WALSegmentContext segcxt; + WALOpenSegment seg; + uint32 segoff; + + /* + * beginning of prior page read, and its TLI. Doesn't necessarily + * correspond to what's in readBuf; used for timeline sanity checks. + */ + XLogRecPtr latestPagePtr; + TimeLineID latestPageTLI; + + /* beginning of the WAL record being read. */ + XLogRecPtr currRecPtr; + /* timeline to read it from, 0 if a lookup is required */ + TimeLineID currTLI; + + /* + * Safe point to read to in currTLI if current TLI is historical + * (tliSwitchPoint) or InvalidXLogRecPtr if on current timeline. + * + * Actually set to the start of the segment containing the timeline switch + * that ends currTLI's validity, not the LSN of the switch its self, since + * we can't assume the old segment will be present. + */ + XLogRecPtr currTLIValidUntil; + + /* + * If currTLI is not the most recent known timeline, the next timeline to + * read from when currTLIValidUntil is reached. + */ + TimeLineID nextTLI; + + /* + * Buffer for current ReadRecord result (expandable), used when a record + * crosses a page boundary. + */ + char *readRecordBuf; + uint32 readRecordBufSize; + + /* Buffer to hold error message */ + char *errormsg_buf; + bool errormsg_deferred; + + /* + * Flag to indicate to XLogPageReadCB that it should not block waiting for + * data. + */ + bool nonblocking; +}; + +/* + * Check if XLogNextRecord() has any more queued records or an error to return. + */ +static inline bool +XLogReaderHasQueuedRecordOrError(XLogReaderState *state) +{ + return (state->decode_queue_head != NULL) || state->errormsg_deferred; +} + +/* Get a new XLogReader */ +extern XLogReaderState *XLogReaderAllocate(int wal_segment_size, + const char *waldir, + XLogReaderRoutine *routine, + void *private_data); + +/* Free an XLogReader */ +extern void XLogReaderFree(XLogReaderState *state); + +/* Optionally provide a circular decoding buffer to allow readahead. */ +extern void XLogReaderSetDecodeBuffer(XLogReaderState *state, + void *buffer, + size_t size); + +/* Position the XLogReader to given record */ +extern void XLogBeginRead(XLogReaderState *state, XLogRecPtr RecPtr); +extern XLogRecPtr XLogFindNextRecord(XLogReaderState *state, XLogRecPtr RecPtr); + +/* Return values from XLogPageReadCB. */ +typedef enum XLogPageReadResult +{ + XLREAD_SUCCESS = 0, /* record is successfully read */ + XLREAD_FAIL = -1, /* failed during reading a record */ + XLREAD_WOULDBLOCK = -2, /* nonblocking mode only, no data */ +} XLogPageReadResult; + +/* Read the next XLog record. Returns NULL on end-of-WAL or failure */ +extern struct XLogRecord *XLogReadRecord(XLogReaderState *state, + char **errormsg); + +/* Consume the next record or error. */ +extern DecodedXLogRecord *XLogNextRecord(XLogReaderState *state, + char **errormsg); + +/* Release the previously returned record, if necessary. */ +extern XLogRecPtr XLogReleasePreviousRecord(XLogReaderState *state); + +/* Try to read ahead, if there is data and space. */ +extern DecodedXLogRecord *XLogReadAhead(XLogReaderState *state, + bool nonblocking); + +/* Validate a page */ +extern bool XLogReaderValidatePageHeader(XLogReaderState *state, + XLogRecPtr recptr, char *phdr); + +/* Forget error produced by XLogReaderValidatePageHeader(). */ +extern void XLogReaderResetError(XLogReaderState *state); + +/* + * Error information from WALRead that both backend and frontend caller can + * process. Currently only errors from pg_pread can be reported. + */ +typedef struct WALReadError +{ + int wre_errno; /* errno set by the last pg_pread() */ + int wre_off; /* Offset we tried to read from. */ + int wre_req; /* Bytes requested to be read. */ + int wre_read; /* Bytes read by the last read(). */ + WALOpenSegment wre_seg; /* Segment we tried to read from. */ +} WALReadError; + +extern bool WALRead(XLogReaderState *state, + char *buf, XLogRecPtr startptr, Size count, + TimeLineID tli, WALReadError *errinfo); + +/* Functions for decoding an XLogRecord */ + +extern size_t DecodeXLogRecordRequiredSpace(size_t xl_tot_len); +extern bool DecodeXLogRecord(XLogReaderState *state, + DecodedXLogRecord *decoded, + XLogRecord *record, + XLogRecPtr lsn, + char **errormsg); + +/* + * Macros that provide access to parts of the record most recently returned by + * XLogReadRecord() or XLogNextRecord(). + */ +#define XLogRecGetTotalLen(decoder) ((decoder)->record->header.xl_tot_len) +#define XLogRecGetPrev(decoder) ((decoder)->record->header.xl_prev) +#define XLogRecGetInfo(decoder) ((decoder)->record->header.xl_info) +#define XLogRecGetRmid(decoder) ((decoder)->record->header.xl_rmid) +#define XLogRecGetXid(decoder) ((decoder)->record->header.xl_xid) +#define XLogRecGetOrigin(decoder) ((decoder)->record->record_origin) +#define XLogRecGetTopXid(decoder) ((decoder)->record->toplevel_xid) +#define XLogRecGetData(decoder) ((decoder)->record->main_data) +#define XLogRecGetDataLen(decoder) ((decoder)->record->main_data_len) +#define XLogRecHasAnyBlockRefs(decoder) ((decoder)->record->max_block_id >= 0) +#define XLogRecMaxBlockId(decoder) ((decoder)->record->max_block_id) +#define XLogRecGetBlock(decoder, i) (&(decoder)->record->blocks[(i)]) +#define XLogRecHasBlockRef(decoder, block_id) \ + (((decoder)->record->max_block_id >= (block_id)) && \ + ((decoder)->record->blocks[block_id].in_use)) +#define XLogRecHasBlockImage(decoder, block_id) \ + ((decoder)->record->blocks[block_id].has_image) +#define XLogRecBlockImageApply(decoder, block_id) \ + ((decoder)->record->blocks[block_id].apply_image) +#define XLogRecHasBlockData(decoder, block_id) \ + ((decoder)->record->blocks[block_id].has_data) + +#ifndef FRONTEND +extern FullTransactionId XLogRecGetFullXid(XLogReaderState *record); +#endif + +extern bool RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page); +extern char *XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len); +extern void XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id, + RelFileLocator *rlocator, ForkNumber *forknum, + BlockNumber *blknum); +extern bool XLogRecGetBlockTagExtended(XLogReaderState *record, uint8 block_id, + RelFileLocator *rlocator, ForkNumber *forknum, + BlockNumber *blknum, + Buffer *prefetch_buffer); + +#endif /* XLOGREADER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogrecord.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogrecord.h new file mode 100644 index 0000000..a06833c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogrecord.h @@ -0,0 +1,248 @@ +/* + * xlogrecord.h + * + * Definitions for the WAL record format. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlogrecord.h + */ +#ifndef XLOGRECORD_H +#define XLOGRECORD_H + +#include "access/rmgr.h" +#include "access/xlogdefs.h" +#include "port/pg_crc32c.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" + +/* + * The overall layout of an XLOG record is: + * Fixed-size header (XLogRecord struct) + * XLogRecordBlockHeader struct + * XLogRecordBlockHeader struct + * ... + * XLogRecordDataHeader[Short|Long] struct + * block data + * block data + * ... + * main data + * + * There can be zero or more XLogRecordBlockHeaders, and 0 or more bytes of + * rmgr-specific data not associated with a block. XLogRecord structs + * always start on MAXALIGN boundaries in the WAL files, but the rest of + * the fields are not aligned. + * + * The XLogRecordBlockHeader, XLogRecordDataHeaderShort and + * XLogRecordDataHeaderLong structs all begin with a single 'id' byte. It's + * used to distinguish between block references, and the main data structs. + */ +typedef struct XLogRecord +{ + uint32 xl_tot_len; /* total len of entire record */ + TransactionId xl_xid; /* xact id */ + XLogRecPtr xl_prev; /* ptr to previous record in log */ + uint8 xl_info; /* flag bits, see below */ + RmgrId xl_rmid; /* resource manager for this record */ + /* 2 bytes of padding here, initialize to zero */ + pg_crc32c xl_crc; /* CRC for this record */ + + /* XLogRecordBlockHeaders and XLogRecordDataHeader follow, no padding */ + +} XLogRecord; + +#define SizeOfXLogRecord (offsetof(XLogRecord, xl_crc) + sizeof(pg_crc32c)) + +/* + * The high 4 bits in xl_info may be used freely by rmgr. The + * XLR_SPECIAL_REL_UPDATE and XLR_CHECK_CONSISTENCY bits can be passed by + * XLogInsert caller. The rest are set internally by XLogInsert. + */ +#define XLR_INFO_MASK 0x0F +#define XLR_RMGR_INFO_MASK 0xF0 + +/* + * XLogReader needs to allocate all the data of a WAL record in a single + * chunk. This means that a single XLogRecord cannot exceed MaxAllocSize + * in length if we ignore any allocation overhead of the XLogReader. + * + * To accommodate some overhead, this value allows for 4M of allocation + * overhead, that should be plenty enough for what the XLogReader + * infrastructure expects as extra. + */ +#define XLogRecordMaxSize (1020 * 1024 * 1024) + +/* + * If a WAL record modifies any relation files, in ways not covered by the + * usual block references, this flag is set. This is not used for anything + * by PostgreSQL itself, but it allows external tools that read WAL and keep + * track of modified blocks to recognize such special record types. + */ +#define XLR_SPECIAL_REL_UPDATE 0x01 + +/* + * Enforces consistency checks of replayed WAL at recovery. If enabled, + * each record will log a full-page write for each block modified by the + * record and will reuse it afterwards for consistency checks. The caller + * of XLogInsert can use this value if necessary, but if + * wal_consistency_checking is enabled for a rmgr this is set unconditionally. + */ +#define XLR_CHECK_CONSISTENCY 0x02 + +/* + * Header info for block data appended to an XLOG record. + * + * 'data_length' is the length of the rmgr-specific payload data associated + * with this block. It does not include the possible full page image, nor + * XLogRecordBlockHeader struct itself. + * + * Note that we don't attempt to align the XLogRecordBlockHeader struct! + * So, the struct must be copied to aligned local storage before use. + */ +typedef struct XLogRecordBlockHeader +{ + uint8 id; /* block reference ID */ + uint8 fork_flags; /* fork within the relation, and flags */ + uint16 data_length; /* number of payload bytes (not including page + * image) */ + + /* If BKPBLOCK_HAS_IMAGE, an XLogRecordBlockImageHeader struct follows */ + /* If BKPBLOCK_SAME_REL is not set, a RelFileLocator follows */ + /* BlockNumber follows */ +} XLogRecordBlockHeader; + +#define SizeOfXLogRecordBlockHeader (offsetof(XLogRecordBlockHeader, data_length) + sizeof(uint16)) + +/* + * Additional header information when a full-page image is included + * (i.e. when BKPBLOCK_HAS_IMAGE is set). + * + * The XLOG code is aware that PG data pages usually contain an unused "hole" + * in the middle, which contains only zero bytes. Since we know that the + * "hole" is all zeros, we remove it from the stored data (and it's not counted + * in the XLOG record's CRC, either). Hence, the amount of block data actually + * present is (BLCKSZ - ). + * + * Additionally, when wal_compression is enabled, we will try to compress full + * page images using one of the supported algorithms, after removing the + * "hole". This can reduce the WAL volume, but at some extra cost of CPU spent + * on the compression during WAL logging. In this case, since the "hole" + * length cannot be calculated by subtracting the number of page image bytes + * from BLCKSZ, basically it needs to be stored as an extra information. + * But when no "hole" exists, we can assume that the "hole" length is zero + * and no such an extra information needs to be stored. Note that + * the original version of page image is stored in WAL instead of the + * compressed one if the number of bytes saved by compression is less than + * the length of extra information. Hence, when a page image is successfully + * compressed, the amount of block data actually present is less than + * BLCKSZ - the length of "hole" bytes - the length of extra information. + */ +typedef struct XLogRecordBlockImageHeader +{ + uint16 length; /* number of page image bytes */ + uint16 hole_offset; /* number of bytes before "hole" */ + uint8 bimg_info; /* flag bits, see below */ + + /* + * If BKPIMAGE_HAS_HOLE and BKPIMAGE_COMPRESSED(), an + * XLogRecordBlockCompressHeader struct follows. + */ +} XLogRecordBlockImageHeader; + +#define SizeOfXLogRecordBlockImageHeader \ + (offsetof(XLogRecordBlockImageHeader, bimg_info) + sizeof(uint8)) + +/* Information stored in bimg_info */ +#define BKPIMAGE_HAS_HOLE 0x01 /* page image has "hole" */ +#define BKPIMAGE_APPLY 0x02 /* page image should be restored + * during replay */ +/* compression methods supported */ +#define BKPIMAGE_COMPRESS_PGLZ 0x04 +#define BKPIMAGE_COMPRESS_LZ4 0x08 +#define BKPIMAGE_COMPRESS_ZSTD 0x10 + +#define BKPIMAGE_COMPRESSED(info) \ + ((info & (BKPIMAGE_COMPRESS_PGLZ | BKPIMAGE_COMPRESS_LZ4 | \ + BKPIMAGE_COMPRESS_ZSTD)) != 0) + +/* + * Extra header information used when page image has "hole" and + * is compressed. + */ +typedef struct XLogRecordBlockCompressHeader +{ + uint16 hole_length; /* number of bytes in "hole" */ +} XLogRecordBlockCompressHeader; + +#define SizeOfXLogRecordBlockCompressHeader \ + sizeof(XLogRecordBlockCompressHeader) + +/* + * Maximum size of the header for a block reference. This is used to size a + * temporary buffer for constructing the header. + */ +#define MaxSizeOfXLogRecordBlockHeader \ + (SizeOfXLogRecordBlockHeader + \ + SizeOfXLogRecordBlockImageHeader + \ + SizeOfXLogRecordBlockCompressHeader + \ + sizeof(RelFileLocator) + \ + sizeof(BlockNumber)) + +/* + * The fork number fits in the lower 4 bits in the fork_flags field. The upper + * bits are used for flags. + */ +#define BKPBLOCK_FORK_MASK 0x0F +#define BKPBLOCK_FLAG_MASK 0xF0 +#define BKPBLOCK_HAS_IMAGE 0x10 /* block data is an XLogRecordBlockImage */ +#define BKPBLOCK_HAS_DATA 0x20 +#define BKPBLOCK_WILL_INIT 0x40 /* redo will re-init the page */ +#define BKPBLOCK_SAME_REL 0x80 /* RelFileLocator omitted, same as + * previous */ + +/* + * XLogRecordDataHeaderShort/Long are used for the "main data" portion of + * the record. If the length of the data is less than 256 bytes, the short + * form is used, with a single byte to hold the length. Otherwise the long + * form is used. + * + * (These structs are currently not used in the code, they are here just for + * documentation purposes). + */ +typedef struct XLogRecordDataHeaderShort +{ + uint8 id; /* XLR_BLOCK_ID_DATA_SHORT */ + uint8 data_length; /* number of payload bytes */ +} XLogRecordDataHeaderShort; + +#define SizeOfXLogRecordDataHeaderShort (sizeof(uint8) * 2) + +typedef struct XLogRecordDataHeaderLong +{ + uint8 id; /* XLR_BLOCK_ID_DATA_LONG */ + /* followed by uint32 data_length, unaligned */ +} XLogRecordDataHeaderLong; + +#define SizeOfXLogRecordDataHeaderLong (sizeof(uint8) + sizeof(uint32)) + +/* + * Block IDs used to distinguish different kinds of record fragments. Block + * references are numbered from 0 to XLR_MAX_BLOCK_ID. A rmgr is free to use + * any ID number in that range (although you should stick to small numbers, + * because the WAL machinery is optimized for that case). A few ID + * numbers are reserved to denote the "main" data portion of the record, + * as well as replication-supporting transaction metadata. + * + * The maximum is currently set at 32, quite arbitrarily. Most records only + * need a handful of block references, but there are a few exceptions that + * need more. + */ +#define XLR_MAX_BLOCK_ID 32 + +#define XLR_BLOCK_ID_DATA_SHORT 255 +#define XLR_BLOCK_ID_DATA_LONG 254 +#define XLR_BLOCK_ID_ORIGIN 253 +#define XLR_BLOCK_ID_TOPLEVEL_XID 252 + +#endif /* XLOGRECORD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogrecovery.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogrecovery.h new file mode 100644 index 0000000..9144630 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogrecovery.h @@ -0,0 +1,158 @@ +/* + * xlogrecovery.h + * + * Functions for WAL recovery and standby mode + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlogrecovery.h + */ +#ifndef XLOGRECOVERY_H +#define XLOGRECOVERY_H + +#include "access/xlogreader.h" +#include "catalog/pg_control.h" +#include "lib/stringinfo.h" +#include "utils/timestamp.h" + +/* + * Recovery target type. + * Only set during a Point in Time recovery, not when in standby mode. + */ +typedef enum +{ + RECOVERY_TARGET_UNSET, + RECOVERY_TARGET_XID, + RECOVERY_TARGET_TIME, + RECOVERY_TARGET_NAME, + RECOVERY_TARGET_LSN, + RECOVERY_TARGET_IMMEDIATE, +} RecoveryTargetType; + +/* + * Recovery target TimeLine goal + */ +typedef enum +{ + RECOVERY_TARGET_TIMELINE_CONTROLFILE, + RECOVERY_TARGET_TIMELINE_LATEST, + RECOVERY_TARGET_TIMELINE_NUMERIC, +} RecoveryTargetTimeLineGoal; + +/* Recovery pause states */ +typedef enum RecoveryPauseState +{ + RECOVERY_NOT_PAUSED, /* pause not requested */ + RECOVERY_PAUSE_REQUESTED, /* pause requested, but not yet paused */ + RECOVERY_PAUSED, /* recovery is paused */ +} RecoveryPauseState; + +/* User-settable GUC parameters */ +extern PGDLLIMPORT bool recoveryTargetInclusive; +extern PGDLLIMPORT int recoveryTargetAction; +extern PGDLLIMPORT int recovery_min_apply_delay; +extern PGDLLIMPORT char *PrimaryConnInfo; +extern PGDLLIMPORT char *PrimarySlotName; +extern PGDLLIMPORT char *recoveryRestoreCommand; +extern PGDLLIMPORT char *recoveryEndCommand; +extern PGDLLIMPORT char *archiveCleanupCommand; + +/* indirectly set via GUC system */ +extern PGDLLIMPORT TransactionId recoveryTargetXid; +extern PGDLLIMPORT char *recovery_target_time_string; +extern PGDLLIMPORT TimestampTz recoveryTargetTime; +extern PGDLLIMPORT const char *recoveryTargetName; +extern PGDLLIMPORT XLogRecPtr recoveryTargetLSN; +extern PGDLLIMPORT RecoveryTargetType recoveryTarget; +extern PGDLLIMPORT bool wal_receiver_create_temp_slot; +extern PGDLLIMPORT RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal; +extern PGDLLIMPORT TimeLineID recoveryTargetTLIRequested; +extern PGDLLIMPORT TimeLineID recoveryTargetTLI; + +/* Have we already reached a consistent database state? */ +extern PGDLLIMPORT bool reachedConsistency; + +/* Are we currently in standby mode? */ +extern PGDLLIMPORT bool StandbyMode; + +extern Size XLogRecoveryShmemSize(void); +extern void XLogRecoveryShmemInit(void); + +extern void InitWalRecovery(ControlFileData *ControlFile, + bool *wasShutdown_ptr, bool *haveBackupLabel_ptr, + bool *haveTblspcMap_ptr); +extern void PerformWalRecovery(void); + +/* + * FinishWalRecovery() returns this. It contains information about the point + * where recovery ended, and why it ended. + */ +typedef struct +{ + /* + * Information about the last valid or applied record, after which new WAL + * can be appended. 'lastRec' is the position where the last record + * starts, and 'endOfLog' is its end. 'lastPage' is a copy of the last + * partial page that contains endOfLog (or NULL if endOfLog is exactly at + * page boundary). 'lastPageBeginPtr' is the position where the last page + * begins. + * + * endOfLogTLI is the TLI in the filename of the XLOG segment containing + * the last applied record. It could be different from lastRecTLI, if + * there was a timeline switch in that segment, and we were reading the + * old WAL from a segment belonging to a higher timeline. + */ + XLogRecPtr lastRec; /* start of last valid or applied record */ + TimeLineID lastRecTLI; + XLogRecPtr endOfLog; /* end of last valid or applied record */ + TimeLineID endOfLogTLI; + + XLogRecPtr lastPageBeginPtr; /* LSN of page that contains endOfLog */ + char *lastPage; /* copy of the last page, up to endOfLog */ + + /* + * abortedRecPtr is the start pointer of a broken record at end of WAL + * when recovery completes; missingContrecPtr is the location of the first + * contrecord that went missing. See CreateOverwriteContrecordRecord for + * details. + */ + XLogRecPtr abortedRecPtr; + XLogRecPtr missingContrecPtr; + + /* short human-readable string describing why recovery ended */ + char *recoveryStopReason; + + /* + * If standby or recovery signal file was found, these flags are set + * accordingly. + */ + bool standby_signal_file_found; + bool recovery_signal_file_found; +} EndOfWalRecoveryInfo; + +extern EndOfWalRecoveryInfo *FinishWalRecovery(void); +extern void ShutdownWalRecovery(void); +extern void RemovePromoteSignalFiles(void); + +extern bool HotStandbyActive(void); +extern XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI); +extern RecoveryPauseState GetRecoveryPauseState(void); +extern void SetRecoveryPause(bool recoveryPause); +extern void GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream); +extern TimestampTz GetLatestXTime(void); +extern TimestampTz GetCurrentChunkReplayStartTime(void); +extern XLogRecPtr GetCurrentReplayRecPtr(TimeLineID *replayEndTLI); + +extern bool PromoteIsTriggered(void); +extern bool CheckPromoteSignal(void); +extern void WakeupRecovery(void); + +extern void StartupRequestWalReceiverRestart(void); +extern void XLogRequestWalReceiverReply(void); + +extern void RecoveryRequiresIntParameter(const char *param_name, int currValue, int minValue); + +extern void xlog_outdesc(StringInfo buf, XLogReaderState *record); + +#endif /* XLOGRECOVERY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogstats.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogstats.h new file mode 100644 index 0000000..6ec6670 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogstats.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * xlogstats.h + * Definitions for WAL Statistics + * + * Copyright (c) 2022-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/access/xlogstats.h + * + *------------------------------------------------------------------------- + */ +#ifndef XLOGSTATS_H +#define XLOGSTATS_H + +#include "access/rmgr.h" +#include "access/xlogreader.h" + +#define MAX_XLINFO_TYPES 16 + +typedef struct XLogRecStats +{ + uint64 count; + uint64 rec_len; + uint64 fpi_len; +} XLogRecStats; + +typedef struct XLogStats +{ + uint64 count; +#ifdef FRONTEND + XLogRecPtr startptr; + XLogRecPtr endptr; +#endif + XLogRecStats rmgr_stats[RM_MAX_ID + 1]; + XLogRecStats record_stats[RM_MAX_ID + 1][MAX_XLINFO_TYPES]; +} XLogStats; + +extern void XLogRecGetLen(XLogReaderState *record, uint32 *rec_len, + uint32 *fpi_len); +extern void XLogRecStoreStats(XLogStats *stats, XLogReaderState *record); + +#endif /* XLOGSTATS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogutils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogutils.h new file mode 100644 index 0000000..a1870d8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/access/xlogutils.h @@ -0,0 +1,121 @@ +/* + * xlogutils.h + * + * Utilities for replaying WAL records. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlogutils.h + */ +#ifndef XLOG_UTILS_H +#define XLOG_UTILS_H + +#include "access/xlogreader.h" +#include "storage/bufmgr.h" + +/* GUC variable */ +extern PGDLLIMPORT bool ignore_invalid_pages; + +/* + * Prior to 8.4, all activity during recovery was carried out by the startup + * process. This local variable continues to be used in many parts of the + * code to indicate actions taken by RecoveryManagers. Other processes that + * potentially perform work during recovery should check RecoveryInProgress(). + * See XLogCtl notes in xlog.c. + */ +extern PGDLLIMPORT bool InRecovery; + +/* + * Like InRecovery, standbyState is only valid in the startup process. + * In all other processes it will have the value STANDBY_DISABLED (so + * InHotStandby will read as false). + * + * In DISABLED state, we're performing crash recovery or hot standby was + * disabled in postgresql.conf. + * + * In INITIALIZED state, we've run InitRecoveryTransactionEnvironment, but + * we haven't yet processed a RUNNING_XACTS or shutdown-checkpoint WAL record + * to initialize our primary-transaction tracking system. + * + * When the transaction tracking is initialized, we enter the SNAPSHOT_PENDING + * state. The tracked information might still be incomplete, so we can't allow + * connections yet, but redo functions must update the in-memory state when + * appropriate. + * + * In SNAPSHOT_READY mode, we have full knowledge of transactions that are + * (or were) running on the primary at the current WAL location. Snapshots + * can be taken, and read-only queries can be run. + */ +typedef enum +{ + STANDBY_DISABLED, + STANDBY_INITIALIZED, + STANDBY_SNAPSHOT_PENDING, + STANDBY_SNAPSHOT_READY, +} HotStandbyState; + +extern PGDLLIMPORT HotStandbyState standbyState; + +#define InHotStandby (standbyState >= STANDBY_SNAPSHOT_PENDING) + + +extern bool XLogHaveInvalidPages(void); +extern void XLogCheckInvalidPages(void); + +extern void XLogDropRelation(RelFileLocator rlocator, ForkNumber forknum); +extern void XLogDropDatabase(Oid dbid); +extern void XLogTruncateRelation(RelFileLocator rlocator, ForkNumber forkNum, + BlockNumber nblocks); + +/* Result codes for XLogReadBufferForRedo[Extended] */ +typedef enum +{ + BLK_NEEDS_REDO, /* changes from WAL record need to be applied */ + BLK_DONE, /* block is already up-to-date */ + BLK_RESTORED, /* block was restored from a full-page image */ + BLK_NOTFOUND, /* block was not found (and hence does not + * need to be replayed) */ +} XLogRedoAction; + +/* Private data of the read_local_xlog_page_no_wait callback. */ +typedef struct ReadLocalXLogPageNoWaitPrivate +{ + bool end_of_wal; /* true, when end of WAL is reached */ +} ReadLocalXLogPageNoWaitPrivate; + +extern XLogRedoAction XLogReadBufferForRedo(XLogReaderState *record, + uint8 block_id, Buffer *buf); +extern Buffer XLogInitBufferForRedo(XLogReaderState *record, uint8 block_id); +extern XLogRedoAction XLogReadBufferForRedoExtended(XLogReaderState *record, + uint8 block_id, + ReadBufferMode mode, bool get_cleanup_lock, + Buffer *buf); + +extern Buffer XLogReadBufferExtended(RelFileLocator rlocator, ForkNumber forknum, + BlockNumber blkno, ReadBufferMode mode, + Buffer recent_buffer); + +extern Relation CreateFakeRelcacheEntry(RelFileLocator rlocator); +extern void FreeFakeRelcacheEntry(Relation fakerel); + +extern int read_local_xlog_page(XLogReaderState *state, + XLogRecPtr targetPagePtr, int reqLen, + XLogRecPtr targetRecPtr, char *cur_page); +extern int read_local_xlog_page_no_wait(XLogReaderState *state, + XLogRecPtr targetPagePtr, int reqLen, + XLogRecPtr targetRecPtr, + char *cur_page); +extern void wal_segment_open(XLogReaderState *state, + XLogSegNo nextSegNo, + TimeLineID *tli_p); +extern void wal_segment_close(XLogReaderState *state); + +extern void XLogReadDetermineTimeline(XLogReaderState *state, + XLogRecPtr wantPage, + uint32 wantLength, + TimeLineID currTLI); + +extern void WALReadRaiseError(WALReadError *errinfo); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/archive/archive_module.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/archive/archive_module.h new file mode 100644 index 0000000..3b17ca7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/archive/archive_module.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * archive_module.h + * Exports for archive modules. + * + * Copyright (c) 2022-2025, PostgreSQL Global Development Group + * + * src/include/archive/archive_module.h + * + *------------------------------------------------------------------------- + */ +#ifndef _ARCHIVE_MODULE_H +#define _ARCHIVE_MODULE_H + +/* + * The value of the archive_library GUC. + */ +extern PGDLLIMPORT char *XLogArchiveLibrary; + +typedef struct ArchiveModuleState +{ + /* + * Private data pointer for use by an archive module. This can be used to + * store state for the module that will be passed to each of its + * callbacks. + */ + void *private_data; +} ArchiveModuleState; + +/* + * Archive module callbacks + * + * These callback functions should be defined by archive libraries and returned + * via _PG_archive_module_init(). ArchiveFileCB is the only required callback. + * For more information about the purpose of each callback, refer to the + * archive modules documentation. + */ +typedef void (*ArchiveStartupCB) (ArchiveModuleState *state); +typedef bool (*ArchiveCheckConfiguredCB) (ArchiveModuleState *state); +typedef bool (*ArchiveFileCB) (ArchiveModuleState *state, const char *file, const char *path); +typedef void (*ArchiveShutdownCB) (ArchiveModuleState *state); + +typedef struct ArchiveModuleCallbacks +{ + ArchiveStartupCB startup_cb; + ArchiveCheckConfiguredCB check_configured_cb; + ArchiveFileCB archive_file_cb; + ArchiveShutdownCB shutdown_cb; +} ArchiveModuleCallbacks; + +/* + * Type of the shared library symbol _PG_archive_module_init that is looked + * up when loading an archive library. + */ +typedef const ArchiveModuleCallbacks *(*ArchiveModuleInit) (void); + +extern PGDLLEXPORT const ArchiveModuleCallbacks *_PG_archive_module_init(void); + +/* Support for messages reported from archive module callbacks. */ + +extern PGDLLIMPORT char *arch_module_check_errdetail_string; + +#define arch_module_check_errdetail \ + pre_format_elog_string(errno, TEXTDOMAIN), \ + arch_module_check_errdetail_string = format_elog_string + +#endif /* _ARCHIVE_MODULE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/archive/shell_archive.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/archive/shell_archive.h new file mode 100644 index 0000000..cf131f5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/archive/shell_archive.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * shell_archive.h + * Exports for archiving via shell. + * + * Copyright (c) 2022-2025, PostgreSQL Global Development Group + * + * src/include/archive/shell_archive.h + * + *------------------------------------------------------------------------- + */ +#ifndef _SHELL_ARCHIVE_H +#define _SHELL_ARCHIVE_H + +#include "archive/archive_module.h" + +/* + * Since the logic for archiving via a shell command is in the core server + * and does not need to be loaded via a shared library, it has a special + * initialization function. + */ +extern const ArchiveModuleCallbacks *shell_archive_init(void); + +#endif /* _SHELL_ARCHIVE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/bootstrap/bootstrap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/bootstrap/bootstrap.h new file mode 100644 index 0000000..befc4fa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/bootstrap/bootstrap.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * bootstrap.h + * include file for the bootstrapping code + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/bootstrap/bootstrap.h + * + *------------------------------------------------------------------------- + */ +#ifndef BOOTSTRAP_H +#define BOOTSTRAP_H + +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" + + +/* + * MAXATTR is the maximum number of attributes in a relation supported + * at bootstrap time (i.e., the max possible in a system table). + */ +#define MAXATTR 40 + +#define BOOTCOL_NULL_AUTO 1 +#define BOOTCOL_NULL_FORCE_NULL 2 +#define BOOTCOL_NULL_FORCE_NOT_NULL 3 + +extern PGDLLIMPORT Relation boot_reldesc; +extern PGDLLIMPORT Form_pg_attribute attrtypes[MAXATTR]; +extern PGDLLIMPORT int numattr; + + +pg_noreturn extern void BootstrapModeMain(int argc, char *argv[], bool check_only); + +extern void closerel(char *relname); +extern void boot_openrel(char *relname); + +extern void DefineAttr(char *name, char *type, int attnum, int nullness); +extern void InsertOneTuple(void); +extern void InsertOneValue(char *value, int i); +extern void InsertOneNull(int i); + +extern void index_register(Oid heap, Oid ind, const IndexInfo *indexInfo); +extern void build_indices(void); + +extern void boot_get_type_io_data(Oid typid, + int16 *typlen, + bool *typbyval, + char *typalign, + char *typdelim, + Oid *typioparam, + Oid *typinput, + Oid *typoutput); + +union YYSTYPE; +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void *yyscan_t; +#endif + +extern int boot_yyparse(yyscan_t yyscanner); +extern int boot_yylex_init(yyscan_t *yyscannerp); +extern int boot_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner); +pg_noreturn extern void boot_yyerror(yyscan_t yyscanner, const char *message); + +#endif /* BOOTSTRAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/c.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/c.h new file mode 100644 index 0000000..6dc44fa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/c.h @@ -0,0 +1,1347 @@ +/*------------------------------------------------------------------------- + * + * c.h + * Fundamental C definitions. This is included by every .c file in + * PostgreSQL (via either postgres.h or postgres_fe.h, as appropriate). + * + * Note that the definitions here are not intended to be exposed to clients + * of the frontend interface libraries --- so we don't worry much about + * polluting the namespace with lots of stuff... + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/c.h + * + *------------------------------------------------------------------------- + */ +/* IWYU pragma: always_keep */ +/* + *---------------------------------------------------------------- + * TABLE OF CONTENTS + * + * When adding stuff to this file, please try to put stuff + * into the relevant section, or add new sections as appropriate. + * + * section description + * ------- ------------------------------------------------ + * 0) pg_config.h and standard system headers + * 1) compiler characteristics + * 2) bool, true, false + * 3) standard system types + * 4) IsValid macros for system types + * 5) lengthof, alignment + * 6) assertions + * 7) widely useful macros + * 8) random stuff + * 9) system-specific hacks + * + * NOTE: since this file is included by both frontend and backend modules, + * it's usually wrong to put an "extern" declaration here, unless it's + * ifdef'd so that it's seen in only one case or the other. + * typedefs and macros are the kind of thing that might go here. + * + *---------------------------------------------------------------- + */ +#ifndef C_H +#define C_H + +/* IWYU pragma: begin_exports */ + +/* + * These headers must be included before any system headers, because on some + * platforms they affect the behavior of the system headers (for example, by + * defining _FILE_OFFSET_BITS). + */ +#include "pg_config.h" +#include "pg_config_manual.h" /* must be after pg_config.h */ +#include "pg_config_os.h" /* config from include/port/PORTNAME.h */ + +/* System header files that should be available everywhere in Postgres */ +#include +#include +#include +#include +#include +#include +#ifdef HAVE_STRINGS_H +#include +#endif +#include +#include +#include +#if defined(WIN32) || defined(__CYGWIN__) +#include /* ensure O_BINARY is available */ +#endif +#include +#ifdef HAVE_XLOCALE_H +#include +#endif +#ifdef ENABLE_NLS +#include +#endif + + /* Pull in fundamental symbols that we also expose to applications */ +#include "postgres_ext.h" + +/* Define before including zlib.h to add const decorations to zlib API. */ +#ifdef HAVE_LIBZ +#define ZLIB_CONST +#endif + + +/* ---------------------------------------------------------------- + * Section 1: compiler characteristics + * + * type prefixes (const, signed, volatile, inline) are handled in pg_config.h. + * ---------------------------------------------------------------- + */ + +/* + * Disable "inline" if PG_FORCE_DISABLE_INLINE is defined. + * This is used to work around compiler bugs and might also be useful for + * investigatory purposes. + */ +#ifdef PG_FORCE_DISABLE_INLINE +#undef inline +#define inline +#endif + +/* + * Attribute macros + * + * GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html + * GCC: https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html + * Clang: https://clang.llvm.org/docs/AttributeReference.html + * Sunpro: https://docs.oracle.com/cd/E18659_01/html/821-1384/gjzke.html + */ + +/* + * For compilers which don't support __has_attribute, we just define + * __has_attribute(x) to 0 so that we can define macros for various + * __attribute__s more easily below. + */ +#ifndef __has_attribute +#define __has_attribute(attribute) 0 +#endif + +/* only GCC supports the unused attribute */ +#ifdef __GNUC__ +#define pg_attribute_unused() __attribute__((unused)) +#else +#define pg_attribute_unused() +#endif + +/* + * pg_nodiscard means the compiler should warn if the result of a function + * call is ignored. The name "nodiscard" is chosen in alignment with the C23 + * standard attribute with the same name. For maximum forward compatibility, + * place it before the declaration. + */ +#ifdef __GNUC__ +#define pg_nodiscard __attribute__((warn_unused_result)) +#else +#define pg_nodiscard +#endif + +/* + * pg_noreturn corresponds to the C11 noreturn/_Noreturn function specifier. + * We can't use the standard name "noreturn" because some third-party code + * uses __attribute__((noreturn)) in headers, which would get confused if + * "noreturn" is defined to "_Noreturn", as is done by . + * + * In a declaration, function specifiers go before the function name. The + * common style is to put them before the return type. (The MSVC fallback has + * the same requirement. The GCC fallback is more flexible.) + */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#define pg_noreturn _Noreturn +#elif defined(__GNUC__) || defined(__SUNPRO_C) +#define pg_noreturn __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define pg_noreturn __declspec(noreturn) +#else +#define pg_noreturn +#endif + +/* + * This macro will disable address safety instrumentation for a function + * when running with "-fsanitize=address". Think twice before using this! + */ +#if defined(__clang__) || __GNUC__ >= 8 +#define pg_attribute_no_sanitize_address() __attribute__((no_sanitize("address"))) +#elif __has_attribute(no_sanitize_address) +/* This would work for clang, but it's deprecated. */ +#define pg_attribute_no_sanitize_address() __attribute__((no_sanitize_address)) +#else +#define pg_attribute_no_sanitize_address() +#endif + +/* + * Place this macro before functions that should be allowed to make misaligned + * accesses. Think twice before using it on non-x86-specific code! + * Testing can be done with "-fsanitize=alignment -fsanitize-trap=alignment" + * on clang, or "-fsanitize=alignment -fno-sanitize-recover=alignment" on gcc. + */ +#if __clang_major__ >= 7 || __GNUC__ >= 8 +#define pg_attribute_no_sanitize_alignment() __attribute__((no_sanitize("alignment"))) +#else +#define pg_attribute_no_sanitize_alignment() +#endif + +/* + * pg_attribute_nonnull means the compiler should warn if the function is + * called with the listed arguments set to NULL. If no arguments are + * listed, the compiler should warn if any pointer arguments are set to NULL. + */ +#if __has_attribute (nonnull) +#define pg_attribute_nonnull(...) __attribute__((nonnull(__VA_ARGS__))) +#else +#define pg_attribute_nonnull(...) +#endif + +/* + * pg_attribute_target allows specifying different target options that the + * function should be compiled with (e.g., for using special CPU instructions). + * Note that there still needs to be a configure-time check to verify that a + * specific target is understood by the compiler. + */ +#if __has_attribute (target) +#define pg_attribute_target(...) __attribute__((target(__VA_ARGS__))) +#else +#define pg_attribute_target(...) +#endif + +/* + * Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only + * used in assert-enabled builds, to avoid compiler warnings about unused + * variables in assert-disabled builds. + */ +#ifdef USE_ASSERT_CHECKING +#define PG_USED_FOR_ASSERTS_ONLY +#else +#define PG_USED_FOR_ASSERTS_ONLY pg_attribute_unused() +#endif + +/* GCC supports format attributes */ +#if defined(__GNUC__) +#define pg_attribute_format_arg(a) __attribute__((format_arg(a))) +#define pg_attribute_printf(f,a) __attribute__((format(PG_PRINTF_ATTRIBUTE, f, a))) +#else +#define pg_attribute_format_arg(a) +#define pg_attribute_printf(f,a) +#endif + +/* GCC and Sunpro support aligned and packed */ +#if defined(__GNUC__) || defined(__SUNPRO_C) +#define pg_attribute_aligned(a) __attribute__((aligned(a))) +#define pg_attribute_packed() __attribute__((packed)) +#elif defined(_MSC_VER) +/* + * MSVC supports aligned. + * + * Packing is also possible but only by wrapping the entire struct definition + * which doesn't fit into our current macro declarations. + */ +#define pg_attribute_aligned(a) __declspec(align(a)) +#else +/* + * NB: aligned and packed are not given default definitions because they + * affect code functionality; they *must* be implemented by the compiler + * if they are to be used. + */ +#endif + +/* + * Use "pg_attribute_always_inline" in place of "inline" for functions that + * we wish to force inlining of, even when the compiler's heuristics would + * choose not to. But, if possible, don't force inlining in unoptimized + * debug builds. + */ +#if (defined(__GNUC__) && __GNUC__ > 3 && defined(__OPTIMIZE__)) || defined(__SUNPRO_C) +/* GCC > 3 and Sunpro support always_inline via __attribute__ */ +#define pg_attribute_always_inline __attribute__((always_inline)) inline +#elif defined(_MSC_VER) +/* MSVC has a special keyword for this */ +#define pg_attribute_always_inline __forceinline +#else +/* Otherwise, the best we can do is to say "inline" */ +#define pg_attribute_always_inline inline +#endif + +/* + * Forcing a function not to be inlined can be useful if it's the slow path of + * a performance-critical function, or should be visible in profiles to allow + * for proper cost attribution. Note that unlike the pg_attribute_XXX macros + * above, this should be placed before the function's return type and name. + */ +/* GCC and Sunpro support noinline via __attribute__ */ +#if (defined(__GNUC__) && __GNUC__ > 2) || defined(__SUNPRO_C) +#define pg_noinline __attribute__((noinline)) +/* msvc via declspec */ +#elif defined(_MSC_VER) +#define pg_noinline __declspec(noinline) +#else +#define pg_noinline +#endif + +/* + * For now, just define pg_attribute_cold and pg_attribute_hot to be empty + * macros on minGW 8.1. There appears to be a compiler bug that results in + * compilation failure. At this time, we still have at least one buildfarm + * animal running that compiler, so this should make that green again. It's + * likely this compiler is not popular enough to warrant keeping this code + * around forever, so let's just remove it once the last buildfarm animal + * upgrades. + */ +#if defined(__MINGW64__) && __GNUC__ == 8 && __GNUC_MINOR__ == 1 + +#define pg_attribute_cold +#define pg_attribute_hot + +#else +/* + * Marking certain functions as "hot" or "cold" can be useful to assist the + * compiler in arranging the assembly code in a more efficient way. + */ +#if __has_attribute (cold) +#define pg_attribute_cold __attribute__((cold)) +#else +#define pg_attribute_cold +#endif + +#if __has_attribute (hot) +#define pg_attribute_hot __attribute__((hot)) +#else +#define pg_attribute_hot +#endif + +#endif /* defined(__MINGW64__) && __GNUC__ == 8 && + * __GNUC_MINOR__ == 1 */ +/* + * Mark a point as unreachable in a portable fashion. This should preferably + * be something that the compiler understands, to aid code generation. + * In assert-enabled builds, we prefer abort() for debugging reasons. + */ +#if defined(HAVE__BUILTIN_UNREACHABLE) && !defined(USE_ASSERT_CHECKING) +#define pg_unreachable() __builtin_unreachable() +#elif defined(_MSC_VER) && !defined(USE_ASSERT_CHECKING) +#define pg_unreachable() __assume(0) +#else +#define pg_unreachable() abort() +#endif + +/* + * Hints to the compiler about the likelihood of a branch. Both likely() and + * unlikely() return the boolean value of the contained expression. + * + * These should only be used sparingly, in very hot code paths. It's very easy + * to mis-estimate likelihoods. + */ +#if __GNUC__ >= 3 +#define likely(x) __builtin_expect((x) != 0, 1) +#define unlikely(x) __builtin_expect((x) != 0, 0) +#else +#define likely(x) ((x) != 0) +#define unlikely(x) ((x) != 0) +#endif + +/* + * CppAsString + * Convert the argument to a string, using the C preprocessor. + * CppAsString2 + * Convert the argument to a string, after one round of macro expansion. + * CppConcat + * Concatenate two arguments together, using the C preprocessor. + * + * Note: There used to be support here for pre-ANSI C compilers that didn't + * support # and ##. Nowadays, these macros are just for clarity and/or + * backward compatibility with existing PostgreSQL code. + */ +#define CppAsString(identifier) #identifier +#define CppAsString2(x) CppAsString(x) +#define CppConcat(x, y) x##y + +/* + * VA_ARGS_NARGS + * Returns the number of macro arguments it is passed. + * + * An empty argument still counts as an argument, so effectively, this is + * "one more than the number of commas in the argument list". + * + * This works for up to 63 arguments. Internally, VA_ARGS_NARGS_() is passed + * 64+N arguments, and the C99 standard only requires macros to allow up to + * 127 arguments, so we can't portably go higher. The implementation is + * pretty trivial: VA_ARGS_NARGS_() returns its 64th argument, and we set up + * the call so that that is the appropriate one of the list of constants. + * This idea is due to Laurent Deniau. + * + * MSVC has an implementation of __VA_ARGS__ that doesn't conform to the + * standard unless you use the /Zc:preprocessor compiler flag, but that + * isn't available before Visual Studio 2019. For now, use a different + * definition that also works on older compilers. + */ +#ifdef _MSC_VER +#define EXPAND(args) args +#define VA_ARGS_NARGS(...) \ + VA_ARGS_NARGS_ EXPAND((__VA_ARGS__, \ + 63,62,61,60, \ + 59,58,57,56,55,54,53,52,51,50, \ + 49,48,47,46,45,44,43,42,41,40, \ + 39,38,37,36,35,34,33,32,31,30, \ + 29,28,27,26,25,24,23,22,21,20, \ + 19,18,17,16,15,14,13,12,11,10, \ + 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) +#else + +#define VA_ARGS_NARGS(...) \ + VA_ARGS_NARGS_(__VA_ARGS__, \ + 63,62,61,60, \ + 59,58,57,56,55,54,53,52,51,50, \ + 49,48,47,46,45,44,43,42,41,40, \ + 39,38,37,36,35,34,33,32,31,30, \ + 29,28,27,26,25,24,23,22,21,20, \ + 19,18,17,16,15,14,13,12,11,10, \ + 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) +#endif + +#define VA_ARGS_NARGS_( \ + _01,_02,_03,_04,_05,_06,_07,_08,_09,_10, \ + _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ + _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ + _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ + _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ + _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ + _61,_62,_63, N, ...) \ + (N) + +/* + * Generic function pointer. This can be used in the rare cases where it's + * necessary to cast a function pointer to a seemingly incompatible function + * pointer type while avoiding gcc's -Wcast-function-type warnings. + */ +typedef void (*pg_funcptr_t) (void); + +/* + * We require C99, hence the compiler should understand flexible array + * members. However, for documentation purposes we still consider it to be + * project style to write "field[FLEXIBLE_ARRAY_MEMBER]" not just "field[]". + * When computing the size of such an object, use "offsetof(struct s, f)" + * for portability. Don't use "offsetof(struct s, f[0])", as this doesn't + * work with MSVC and with C++ compilers. + */ +#define FLEXIBLE_ARRAY_MEMBER /* empty */ + +/* + * Does the compiler support #pragma GCC system_header? We optionally use it + * to avoid warnings that we can't fix (e.g. in the perl headers). + * See https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html + * + * Headers for which we do not want to show compiler warnings can, + * conditionally, use #pragma GCC system_header to avoid warnings. Obviously + * this should only be used for external headers over which we do not have + * control. + * + * Support for the pragma is tested here, instead of during configure, as gcc + * also warns about the pragma being used in a .c file. It's surprisingly hard + * to get autoconf to use .h as the file-ending. Looks like gcc has + * implemented the pragma since the 2000, so this test should suffice. + * + * + * Alternatively, we could add the include paths for problematic headers with + * -isystem, but that is a larger hammer and is harder to search for. + * + * A more granular alternative would be to use #pragma GCC diagnostic + * push/ignored/pop, but gcc warns about unknown warnings being ignored, so + * every to-be-ignored-temporarily compiler warning would require its own + * pg_config.h symbol and #ifdef. + */ +#ifdef __GNUC__ +#define HAVE_PRAGMA_GCC_SYSTEM_HEADER 1 +#endif + + +/* ---------------------------------------------------------------- + * Section 2: bool, true, false + * ---------------------------------------------------------------- + */ + +/* + * bool + * Boolean value, either true or false. + * + * PostgreSQL currently cannot deal with bool of size other than 1; there are + * static assertions around the code to prevent that. + */ + +#include + + +/* ---------------------------------------------------------------- + * Section 3: standard system types + * ---------------------------------------------------------------- + */ + +/* + * Pointer + * Variable holding address of any memory resident object. + * + * XXX Pointer arithmetic is done with this, so it can't be void * + * under "true" ANSI compilers. + */ +typedef char *Pointer; + +/* Historical names for types in . */ +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; + +/* + * bitsN + * Unit of bitwise operation, AT LEAST N BITS IN SIZE. + */ +typedef uint8 bits8; /* >= 8 bits */ +typedef uint16 bits16; /* >= 16 bits */ +typedef uint32 bits32; /* >= 32 bits */ + +/* + * 64-bit integers + */ +#define INT64CONST(x) INT64_C(x) +#define UINT64CONST(x) UINT64_C(x) + +/* snprintf format strings to use for 64-bit integers */ +#define INT64_FORMAT "%" PRId64 +#define UINT64_FORMAT "%" PRIu64 + +/* + * 128-bit signed and unsigned integers + * There currently is only limited support for such types. + * E.g. 128bit literals and snprintf are not supported; but math is. + * Also, because we exclude such types when choosing MAXIMUM_ALIGNOF, + * it must be possible to coerce the compiler to allocate them on no + * more than MAXALIGN boundaries. + */ +#if defined(PG_INT128_TYPE) +#if defined(pg_attribute_aligned) || ALIGNOF_PG_INT128_TYPE <= MAXIMUM_ALIGNOF +#define HAVE_INT128 1 + +typedef PG_INT128_TYPE int128 +#if defined(pg_attribute_aligned) + pg_attribute_aligned(MAXIMUM_ALIGNOF) +#endif + ; + +typedef unsigned PG_INT128_TYPE uint128 +#if defined(pg_attribute_aligned) + pg_attribute_aligned(MAXIMUM_ALIGNOF) +#endif + ; + +#endif +#endif + +/* Historical names for limits in . */ +#define PG_INT8_MIN INT8_MIN +#define PG_INT8_MAX INT8_MAX +#define PG_UINT8_MAX UINT8_MAX +#define PG_INT16_MIN INT16_MIN +#define PG_INT16_MAX INT16_MAX +#define PG_UINT16_MAX UINT16_MAX +#define PG_INT32_MIN INT32_MIN +#define PG_INT32_MAX INT32_MAX +#define PG_UINT32_MAX UINT32_MAX +#define PG_INT64_MIN INT64_MIN +#define PG_INT64_MAX INT64_MAX +#define PG_UINT64_MAX UINT64_MAX + +/* + * We now always use int64 timestamps, but keep this symbol defined for the + * benefit of external code that might test it. + */ +#define HAVE_INT64_TIMESTAMP + +/* + * Size + * Size of any memory resident object, as returned by sizeof. + */ +typedef size_t Size; + +/* + * Index + * Index into any memory resident array. + * + * Note: + * Indices are non negative. + */ +typedef unsigned int Index; + +/* + * Offset + * Offset into any memory resident array. + * + * Note: + * This differs from an Index in that an Index is always + * non negative, whereas Offset may be negative. + */ +typedef signed int Offset; + +/* + * Common Postgres datatype names (as used in the catalogs) + */ +typedef float float4; +typedef double float8; + +#ifdef USE_FLOAT8_BYVAL +#define FLOAT8PASSBYVAL true +#else +#define FLOAT8PASSBYVAL false +#endif + +/* + * Oid, RegProcedure, TransactionId, SubTransactionId, MultiXactId, + * CommandId + */ + +/* typedef Oid is in postgres_ext.h */ + +/* + * regproc is the type name used in the include/catalog headers, but + * RegProcedure is the preferred name in C code. + */ +typedef Oid regproc; +typedef regproc RegProcedure; + +typedef uint32 TransactionId; + +typedef uint32 LocalTransactionId; + +typedef uint32 SubTransactionId; + +#define InvalidSubTransactionId ((SubTransactionId) 0) +#define TopSubTransactionId ((SubTransactionId) 1) + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +typedef uint32 CommandId; + +#define FirstCommandId ((CommandId) 0) +#define InvalidCommandId (~(CommandId)0) + + +/* ---------------- + * Variable-length datatypes all share the 'struct varlena' header. + * + * NOTE: for TOASTable types, this is an oversimplification, since the value + * may be compressed or moved out-of-line. However datatype-specific routines + * are mostly content to deal with de-TOASTed values only, and of course + * client-side routines should never see a TOASTed value. But even in a + * de-TOASTed value, beware of touching vl_len_ directly, as its + * representation is no longer convenient. It's recommended that code always + * use macros VARDATA_ANY, VARSIZE_ANY, VARSIZE_ANY_EXHDR, VARDATA, VARSIZE, + * and SET_VARSIZE instead of relying on direct mentions of the struct fields. + * See postgres.h for details of the TOASTed form. + * ---------------- + */ +struct varlena +{ + char vl_len_[4]; /* Do not touch this field directly! */ + char vl_dat[FLEXIBLE_ARRAY_MEMBER]; /* Data content is here */ +}; + +#define VARHDRSZ ((int32) sizeof(int32)) + +/* + * These widely-used datatypes are just a varlena header and the data bytes. + * There is no terminating null or anything like that --- the data length is + * always VARSIZE_ANY_EXHDR(ptr). + */ +typedef struct varlena bytea; +typedef struct varlena text; +typedef struct varlena BpChar; /* blank-padded char, ie SQL char(n) */ +typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */ + +/* + * Specialized array types. These are physically laid out just the same + * as regular arrays (so that the regular array subscripting code works + * with them). They exist as distinct types mostly for historical reasons: + * they have nonstandard I/O behavior which we don't want to change for fear + * of breaking applications that look at the system catalogs. There is also + * an implementation issue for oidvector: it's part of the primary key for + * pg_proc, and we can't use the normal btree array support routines for that + * without circularity. + */ +typedef struct +{ + int32 vl_len_; /* these fields must match ArrayType! */ + int ndim; /* always 1 for int2vector */ + int32 dataoffset; /* always 0 for int2vector */ + Oid elemtype; + int dim1; + int lbound1; + int16 values[FLEXIBLE_ARRAY_MEMBER]; +} int2vector; + +typedef struct +{ + int32 vl_len_; /* these fields must match ArrayType! */ + int ndim; /* always 1 for oidvector */ + int32 dataoffset; /* always 0 for oidvector */ + Oid elemtype; + int dim1; + int lbound1; + Oid values[FLEXIBLE_ARRAY_MEMBER]; +} oidvector; + +/* + * Representation of a Name: effectively just a C string, but null-padded to + * exactly NAMEDATALEN bytes. The use of a struct is historical. + */ +typedef struct nameData +{ + char data[NAMEDATALEN]; +} NameData; +typedef NameData *Name; + +#define NameStr(name) ((name).data) + + +/* ---------------------------------------------------------------- + * Section 4: IsValid macros for system types + * ---------------------------------------------------------------- + */ +/* + * BoolIsValid + * True iff bool is valid. + */ +#define BoolIsValid(boolean) ((boolean) == false || (boolean) == true) + +/* + * PointerIsValid + * True iff pointer is valid. + */ +#define PointerIsValid(pointer) ((const void*)(pointer) != NULL) + +/* + * PointerIsAligned + * True iff pointer is properly aligned to point to the given type. + */ +#define PointerIsAligned(pointer, type) \ + (((uintptr_t)(pointer) % (sizeof (type))) == 0) + +#define OffsetToPointer(base, offset) \ + ((void *)((char *) base + offset)) + +#define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid)) + +#define RegProcedureIsValid(p) OidIsValid(p) + + +/* ---------------------------------------------------------------- + * Section 5: lengthof, alignment + * ---------------------------------------------------------------- + */ +/* + * lengthof + * Number of elements in an array. + */ +#define lengthof(array) (sizeof (array) / sizeof ((array)[0])) + +/* ---------------- + * Alignment macros: align a length or address appropriately for a given type. + * The fooALIGN() macros round up to a multiple of the required alignment, + * while the fooALIGN_DOWN() macros round down. The latter are more useful + * for problems like "how many X-sized structures will fit in a page?". + * + * NOTE: TYPEALIGN[_DOWN] will not work if ALIGNVAL is not a power of 2. + * That case seems extremely unlikely to be needed in practice, however. + * + * NOTE: MAXIMUM_ALIGNOF, and hence MAXALIGN(), intentionally exclude any + * larger-than-8-byte types the compiler might have. + * ---------------- + */ + +#define TYPEALIGN(ALIGNVAL,LEN) \ + (((uintptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((uintptr_t) ((ALIGNVAL) - 1))) + +#define SHORTALIGN(LEN) TYPEALIGN(ALIGNOF_SHORT, (LEN)) +#define INTALIGN(LEN) TYPEALIGN(ALIGNOF_INT, (LEN)) +#define LONGALIGN(LEN) TYPEALIGN(ALIGNOF_LONG, (LEN)) +#define DOUBLEALIGN(LEN) TYPEALIGN(ALIGNOF_DOUBLE, (LEN)) +#define MAXALIGN(LEN) TYPEALIGN(MAXIMUM_ALIGNOF, (LEN)) +/* MAXALIGN covers only built-in types, not buffers */ +#define BUFFERALIGN(LEN) TYPEALIGN(ALIGNOF_BUFFER, (LEN)) +#define CACHELINEALIGN(LEN) TYPEALIGN(PG_CACHE_LINE_SIZE, (LEN)) + +#define TYPEALIGN_DOWN(ALIGNVAL,LEN) \ + (((uintptr_t) (LEN)) & ~((uintptr_t) ((ALIGNVAL) - 1))) + +#define SHORTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN)) +#define INTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_INT, (LEN)) +#define LONGALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_LONG, (LEN)) +#define DOUBLEALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_DOUBLE, (LEN)) +#define MAXALIGN_DOWN(LEN) TYPEALIGN_DOWN(MAXIMUM_ALIGNOF, (LEN)) +#define BUFFERALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_BUFFER, (LEN)) + +/* + * The above macros will not work with types wider than uintptr_t, like with + * uint64 on 32-bit platforms. That's not problem for the usual use where a + * pointer or a length is aligned, but for the odd case that you need to + * align something (potentially) wider, use TYPEALIGN64. + */ +#define TYPEALIGN64(ALIGNVAL,LEN) \ + (((uint64) (LEN) + ((ALIGNVAL) - 1)) & ~((uint64) ((ALIGNVAL) - 1))) + +/* we don't currently need wider versions of the other ALIGN macros */ +#define MAXALIGN64(LEN) TYPEALIGN64(MAXIMUM_ALIGNOF, (LEN)) + + +/* ---------------------------------------------------------------- + * Section 6: assertions + * ---------------------------------------------------------------- + */ + +/* + * USE_ASSERT_CHECKING, if defined, turns on all the assertions. + * - plai 9/5/90 + * + * It should _NOT_ be defined in releases or in benchmark copies + */ + +/* + * Assert() can be used in both frontend and backend code. In frontend code it + * just calls the standard assert, if it's available. If use of assertions is + * not configured, it does nothing. + */ +#ifndef USE_ASSERT_CHECKING + +#define Assert(condition) ((void)true) +#define AssertMacro(condition) ((void)true) + +#elif defined(FRONTEND) + +#include +#define Assert(p) assert(p) +#define AssertMacro(p) ((void) assert(p)) + +#else /* USE_ASSERT_CHECKING && !FRONTEND */ + +/* + * Assert + * Generates a fatal exception if the given condition is false. + */ +#define Assert(condition) \ + do { \ + if (!(condition)) \ + ExceptionalCondition(#condition, __FILE__, __LINE__); \ + } while (0) + +/* + * AssertMacro is the same as Assert but it's suitable for use in + * expression-like macros, for example: + * + * #define foo(x) (AssertMacro(x != 0), bar(x)) + */ +#define AssertMacro(condition) \ + ((void) ((condition) || \ + (ExceptionalCondition(#condition, __FILE__, __LINE__), 0))) + +#endif /* USE_ASSERT_CHECKING && !FRONTEND */ + +/* + * Check that `ptr' is `bndr' aligned. + */ +#define AssertPointerAlignment(ptr, bndr) \ + Assert(TYPEALIGN(bndr, (uintptr_t)(ptr)) == (uintptr_t)(ptr)) + +/* + * ExceptionalCondition is compiled into the backend whether or not + * USE_ASSERT_CHECKING is defined, so as to support use of extensions + * that are built with that #define with a backend that isn't. Hence, + * we should declare it as long as !FRONTEND. + */ +#ifndef FRONTEND +pg_noreturn extern void ExceptionalCondition(const char *conditionName, + const char *fileName, int lineNumber); +#endif + +/* + * Macros to support compile-time assertion checks. + * + * If the "condition" (a compile-time-constant expression) evaluates to false, + * throw a compile error using the "errmessage" (a string literal). + * + * C11 has _Static_assert(), and most C99 compilers already support that. For + * portability, we wrap it into StaticAssertDecl(). _Static_assert() is a + * "declaration", and so it must be placed where for example a variable + * declaration would be valid. As long as we compile with + * -Wno-declaration-after-statement, that also means it cannot be placed after + * statements in a function. Macros StaticAssertStmt() and StaticAssertExpr() + * make it safe to use as a statement or in an expression, respectively. + * + * For compilers without _Static_assert(), we fall back on a kluge that + * assumes the compiler will complain about a negative width for a struct + * bit-field. This will not include a helpful error message, but it beats not + * getting an error at all. + */ +#ifndef __cplusplus +#ifdef HAVE__STATIC_ASSERT +#define StaticAssertDecl(condition, errmessage) \ + _Static_assert(condition, errmessage) +#define StaticAssertStmt(condition, errmessage) \ + do { _Static_assert(condition, errmessage); } while(0) +#define StaticAssertExpr(condition, errmessage) \ + ((void) ({ StaticAssertStmt(condition, errmessage); true; })) +#else /* !HAVE__STATIC_ASSERT */ +#define StaticAssertDecl(condition, errmessage) \ + extern void static_assert_func(int static_assert_failure[(condition) ? 1 : -1]) +#define StaticAssertStmt(condition, errmessage) \ + ((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; })) +#define StaticAssertExpr(condition, errmessage) \ + StaticAssertStmt(condition, errmessage) +#endif /* HAVE__STATIC_ASSERT */ +#else /* C++ */ +#if defined(__cpp_static_assert) && __cpp_static_assert >= 200410 +#define StaticAssertDecl(condition, errmessage) \ + static_assert(condition, errmessage) +#define StaticAssertStmt(condition, errmessage) \ + static_assert(condition, errmessage) +#define StaticAssertExpr(condition, errmessage) \ + ({ static_assert(condition, errmessage); }) +#else /* !__cpp_static_assert */ +#define StaticAssertDecl(condition, errmessage) \ + extern void static_assert_func(int static_assert_failure[(condition) ? 1 : -1]) +#define StaticAssertStmt(condition, errmessage) \ + do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0) +#define StaticAssertExpr(condition, errmessage) \ + ((void) ({ StaticAssertStmt(condition, errmessage); })) +#endif /* __cpp_static_assert */ +#endif /* C++ */ + + +/* + * Compile-time checks that a variable (or expression) has the specified type. + * + * AssertVariableIsOfType() can be used as a statement. + * AssertVariableIsOfTypeMacro() is intended for use in macros, eg + * #define foo(x) (AssertVariableIsOfTypeMacro(x, int), bar(x)) + * + * If we don't have __builtin_types_compatible_p, we can still assert that + * the types have the same size. This is far from ideal (especially on 32-bit + * platforms) but it provides at least some coverage. + */ +#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P +#define AssertVariableIsOfType(varname, typename) \ + StaticAssertStmt(__builtin_types_compatible_p(__typeof__(varname), typename), \ + CppAsString(varname) " does not have type " CppAsString(typename)) +#define AssertVariableIsOfTypeMacro(varname, typename) \ + (StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \ + CppAsString(varname) " does not have type " CppAsString(typename))) +#else /* !HAVE__BUILTIN_TYPES_COMPATIBLE_P */ +#define AssertVariableIsOfType(varname, typename) \ + StaticAssertStmt(sizeof(varname) == sizeof(typename), \ + CppAsString(varname) " does not have type " CppAsString(typename)) +#define AssertVariableIsOfTypeMacro(varname, typename) \ + (StaticAssertExpr(sizeof(varname) == sizeof(typename), \ + CppAsString(varname) " does not have type " CppAsString(typename))) +#endif /* HAVE__BUILTIN_TYPES_COMPATIBLE_P */ + + +/* ---------------------------------------------------------------- + * Section 7: widely useful macros + * ---------------------------------------------------------------- + */ +/* + * Max + * Return the maximum of two numbers. + */ +#define Max(x, y) ((x) > (y) ? (x) : (y)) + +/* + * Min + * Return the minimum of two numbers. + */ +#define Min(x, y) ((x) < (y) ? (x) : (y)) + + +/* Get a bit mask of the bits set in non-long aligned addresses */ +#define LONG_ALIGN_MASK (sizeof(long) - 1) + +/* + * MemSet + * Exactly the same as standard library function memset(), but considerably + * faster for zeroing small word-aligned structures (such as parsetree nodes). + * This has to be a macro because the main point is to avoid function-call + * overhead. However, we have also found that the loop is faster than + * native libc memset() on some platforms, even those with assembler + * memset() functions. More research needs to be done, perhaps with + * MEMSET_LOOP_LIMIT tests in configure. + */ +#define MemSet(start, val, len) \ + do \ + { \ + /* must be void* because we don't know if it is integer aligned yet */ \ + void *_vstart = (void *) (start); \ + int _val = (val); \ + Size _len = (len); \ +\ + if ((((uintptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \ + (_len & LONG_ALIGN_MASK) == 0 && \ + _val == 0 && \ + _len <= MEMSET_LOOP_LIMIT && \ + /* \ + * If MEMSET_LOOP_LIMIT == 0, optimizer should find \ + * the whole "if" false at compile time. \ + */ \ + MEMSET_LOOP_LIMIT != 0) \ + { \ + long *_start = (long *) _vstart; \ + long *_stop = (long *) ((char *) _start + _len); \ + while (_start < _stop) \ + *_start++ = 0; \ + } \ + else \ + memset(_vstart, _val, _len); \ + } while (0) + +/* + * MemSetAligned is the same as MemSet except it omits the test to see if + * "start" is word-aligned. This is okay to use if the caller knows a-priori + * that the pointer is suitably aligned (typically, because he just got it + * from palloc(), which always delivers a max-aligned pointer). + */ +#define MemSetAligned(start, val, len) \ + do \ + { \ + long *_start = (long *) (start); \ + int _val = (val); \ + Size _len = (len); \ +\ + if ((_len & LONG_ALIGN_MASK) == 0 && \ + _val == 0 && \ + _len <= MEMSET_LOOP_LIMIT && \ + MEMSET_LOOP_LIMIT != 0) \ + { \ + long *_stop = (long *) ((char *) _start + _len); \ + while (_start < _stop) \ + *_start++ = 0; \ + } \ + else \ + memset(_start, _val, _len); \ + } while (0) + + +/* + * Macros for range-checking float values before converting to integer. + * We must be careful here that the boundary values are expressed exactly + * in the float domain. PG_INTnn_MIN is an exact power of 2, so it will + * be represented exactly; but PG_INTnn_MAX isn't, and might get rounded + * off, so avoid using that. + * The input must be rounded to an integer beforehand, typically with rint(), + * else we might draw the wrong conclusion about close-to-the-limit values. + * These macros will do the right thing for Inf, but not necessarily for NaN, + * so check isnan(num) first if that's a possibility. + */ +#define FLOAT4_FITS_IN_INT16(num) \ + ((num) >= (float4) PG_INT16_MIN && (num) < -((float4) PG_INT16_MIN)) +#define FLOAT4_FITS_IN_INT32(num) \ + ((num) >= (float4) PG_INT32_MIN && (num) < -((float4) PG_INT32_MIN)) +#define FLOAT4_FITS_IN_INT64(num) \ + ((num) >= (float4) PG_INT64_MIN && (num) < -((float4) PG_INT64_MIN)) +#define FLOAT8_FITS_IN_INT16(num) \ + ((num) >= (float8) PG_INT16_MIN && (num) < -((float8) PG_INT16_MIN)) +#define FLOAT8_FITS_IN_INT32(num) \ + ((num) >= (float8) PG_INT32_MIN && (num) < -((float8) PG_INT32_MIN)) +#define FLOAT8_FITS_IN_INT64(num) \ + ((num) >= (float8) PG_INT64_MIN && (num) < -((float8) PG_INT64_MIN)) + + +/* ---------------------------------------------------------------- + * Section 8: random stuff + * ---------------------------------------------------------------- + */ + +/* + * Invert the sign of a qsort-style comparison result, ie, exchange negative + * and positive integer values, being careful not to get the wrong answer + * for INT_MIN. The argument should be an integral variable. + */ +#define INVERT_COMPARE_RESULT(var) \ + ((var) = ((var) < 0) ? 1 : -(var)) + +/* + * Use this, not "char buf[BLCKSZ]", to declare a field or local variable + * holding a page buffer, if that page might be accessed as a page. Otherwise + * the variable might be under-aligned, causing problems on alignment-picky + * hardware. We include both "double" and "int64" in the union to ensure that + * the compiler knows the value must be MAXALIGN'ed (cf. configure's + * computation of MAXIMUM_ALIGNOF). + */ +typedef union PGAlignedBlock +{ + char data[BLCKSZ]; + double force_align_d; + int64 force_align_i64; +} PGAlignedBlock; + +/* + * Use this to declare a field or local variable holding a page buffer, if that + * page might be accessed as a page or passed to an SMgr I/O function. If + * allocating using the MemoryContext API, the aligned allocation functions + * should be used with PG_IO_ALIGN_SIZE. This alignment may be more efficient + * for I/O in general, but may be strictly required on some platforms when + * using direct I/O. + */ +typedef union PGIOAlignedBlock +{ +#ifdef pg_attribute_aligned + pg_attribute_aligned(PG_IO_ALIGN_SIZE) +#endif + char data[BLCKSZ]; + double force_align_d; + int64 force_align_i64; +} PGIOAlignedBlock; + +/* Same, but for an XLOG_BLCKSZ-sized buffer */ +typedef union PGAlignedXLogBlock +{ +#ifdef pg_attribute_aligned + pg_attribute_aligned(PG_IO_ALIGN_SIZE) +#endif + char data[XLOG_BLCKSZ]; + double force_align_d; + int64 force_align_i64; +} PGAlignedXLogBlock; + +/* msb for char */ +#define HIGHBIT (0x80) +#define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT) + +/* + * Support macros for escaping strings. escape_backslash should be true + * if generating a non-standard-conforming string. Prefixing a string + * with ESCAPE_STRING_SYNTAX guarantees it is non-standard-conforming. + * Beware of multiple evaluation of the "ch" argument! + */ +#define SQL_STR_DOUBLE(ch, escape_backslash) \ + ((ch) == '\'' || ((ch) == '\\' && (escape_backslash))) + +#define ESCAPE_STRING_SYNTAX 'E' + + +#define STATUS_OK (0) +#define STATUS_ERROR (-1) +#define STATUS_EOF (-2) + +/* + * gettext support + */ + +#ifndef ENABLE_NLS +/* stuff we'd otherwise get from */ +#define gettext(x) (x) +#define dgettext(d,x) (x) +#define ngettext(s,p,n) ((n) == 1 ? (s) : (p)) +#define dngettext(d,s,p,n) ((n) == 1 ? (s) : (p)) +#endif + +#define _(x) gettext(x) + +/* + * Use this to mark string constants as needing translation at some later + * time, rather than immediately. This is useful for cases where you need + * access to the original string and translated string, and for cases where + * immediate translation is not possible, like when initializing global + * variables. + * + * https://www.gnu.org/software/gettext/manual/html_node/Special-cases.html + */ +#define gettext_noop(x) (x) + +/* + * To better support parallel installations of major PostgreSQL + * versions as well as parallel installations of major library soname + * versions, we mangle the gettext domain name by appending those + * version numbers. The coding rule ought to be that wherever the + * domain name is mentioned as a literal, it must be wrapped into + * PG_TEXTDOMAIN(). The macros below do not work on non-literals; but + * that is somewhat intentional because it avoids having to worry + * about multiple states of premangling and postmangling as the values + * are being passed around. + * + * Make sure this matches the installation rules in nls-global.mk. + */ +#ifdef SO_MAJOR_VERSION +#define PG_TEXTDOMAIN(domain) (domain CppAsString2(SO_MAJOR_VERSION) "-" PG_MAJORVERSION) +#else +#define PG_TEXTDOMAIN(domain) (domain "-" PG_MAJORVERSION) +#endif + +/* + * Macro that allows to cast constness and volatile away from an expression, but doesn't + * allow changing the underlying type. Enforcement of the latter + * currently only works for gcc like compilers. + * + * Please note IT IS NOT SAFE to cast constness away if the result will ever + * be modified (it would be undefined behaviour). Doing so anyway can cause + * compiler misoptimizations or runtime crashes (modifying readonly memory). + * It is only safe to use when the result will not be modified, but API + * design or language restrictions prevent you from declaring that + * (e.g. because a function returns both const and non-const variables). + * + * Note that this only works in function scope, not for global variables (it'd + * be nice, but not trivial, to improve that). + */ +#if defined(__cplusplus) +#define unconstify(underlying_type, expr) const_cast(expr) +#define unvolatize(underlying_type, expr) const_cast(expr) +#elif defined(HAVE__BUILTIN_TYPES_COMPATIBLE_P) +#define unconstify(underlying_type, expr) \ + (StaticAssertExpr(__builtin_types_compatible_p(__typeof(expr), const underlying_type), \ + "wrong cast"), \ + (underlying_type) (expr)) +#define unvolatize(underlying_type, expr) \ + (StaticAssertExpr(__builtin_types_compatible_p(__typeof(expr), volatile underlying_type), \ + "wrong cast"), \ + (underlying_type) (expr)) +#else +#define unconstify(underlying_type, expr) \ + ((underlying_type) (expr)) +#define unvolatize(underlying_type, expr) \ + ((underlying_type) (expr)) +#endif + +/* ---------------------------------------------------------------- + * Section 9: system-specific hacks + * + * This should be limited to things that absolutely have to be + * included in every source file. The port-specific header file + * is usually a better place for this sort of thing. + * ---------------------------------------------------------------- + */ + +/* + * NOTE: this is also used for opening text files. + * WIN32 treats Control-Z as EOF in files opened in text mode. + * Therefore, we open files in binary mode on Win32 so we can read + * literal control-Z. The other affect is that we see CRLF, but + * that is OK because we can already handle those cleanly. + */ +#if defined(WIN32) || defined(__CYGWIN__) +#define PG_BINARY O_BINARY +#define PG_BINARY_A "ab" +#define PG_BINARY_R "rb" +#define PG_BINARY_W "wb" +#else +#define PG_BINARY 0 +#define PG_BINARY_A "a" +#define PG_BINARY_R "r" +#define PG_BINARY_W "w" +#endif + +/* + * Provide prototypes for routines not present in a particular machine's + * standard C library. + */ + +#if !HAVE_DECL_FDATASYNC +extern int fdatasync(int fildes); +#endif + +/* + * Thin wrappers that convert strings to exactly 64-bit integers, matching our + * definition of int64. (For the naming, compare that POSIX has + * strtoimax()/strtoumax() which return intmax_t/uintmax_t.) + */ +#if SIZEOF_LONG == 8 +#define strtoi64(str, endptr, base) ((int64) strtol(str, endptr, base)) +#define strtou64(str, endptr, base) ((uint64) strtoul(str, endptr, base)) +#elif SIZEOF_LONG_LONG == 8 +#define strtoi64(str, endptr, base) ((int64) strtoll(str, endptr, base)) +#define strtou64(str, endptr, base) ((uint64) strtoull(str, endptr, base)) +#else +#error "cannot find integer type of the same size as int64_t" +#endif + +/* + * Similarly, wrappers around labs()/llabs() matching our int64. + */ +#if SIZEOF_LONG == 8 +#define i64abs(i) ((int64) labs(i)) +#elif SIZEOF_LONG_LONG == 8 +#define i64abs(i) ((int64) llabs(i)) +#else +#error "cannot find integer type of the same size as int64_t" +#endif + +/* + * Use "extern PGDLLIMPORT ..." to declare variables that are defined + * in the core backend and need to be accessible by loadable modules. + * No special marking is required on most ports. + */ +#ifndef PGDLLIMPORT +#define PGDLLIMPORT +#endif + +/* + * Use "extern PGDLLEXPORT ..." to declare functions that are defined in + * loadable modules and need to be callable by the core backend or other + * loadable modules. + * If the compiler knows __attribute__((visibility("*"))), we use that, + * unless we already have a platform-specific definition. Otherwise, + * no special marking is required. + */ +#ifndef PGDLLEXPORT +#ifdef HAVE_VISIBILITY_ATTRIBUTE +#define PGDLLEXPORT __attribute__((visibility("default"))) +#else +#define PGDLLEXPORT +#endif +#endif + +/* + * The following is used as the arg list for signal handlers. Any ports + * that take something other than an int argument should override this in + * their pg_config_os.h file. Note that variable names are required + * because it is used in both the prototypes as well as the definitions. + * Note also the long name. We expect that this won't collide with + * other names causing compiler warnings. + */ + +#ifndef SIGNAL_ARGS +#define SIGNAL_ARGS int postgres_signal_arg +#endif + +/* + * When there is no sigsetjmp, its functionality is provided by plain + * setjmp. We now support the case only on Windows. However, it seems + * that MinGW-64 has some longstanding issues in its setjmp support, + * so on that toolchain we cheat and use gcc's builtins. + */ +#ifdef WIN32 +#ifdef __MINGW64__ +typedef intptr_t sigjmp_buf[5]; +#define sigsetjmp(x,y) __builtin_setjmp(x) +#define siglongjmp __builtin_longjmp +#else /* !__MINGW64__ */ +#define sigjmp_buf jmp_buf +#define sigsetjmp(x,y) setjmp(x) +#define siglongjmp longjmp +#endif /* __MINGW64__ */ +#endif /* WIN32 */ + +/* /port compatibility functions */ +#include "port.h" + +/* IWYU pragma: end_exports */ + +#endif /* C_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/binary_upgrade.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/binary_upgrade.h new file mode 100644 index 0000000..6fcc59e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/binary_upgrade.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * binary_upgrade.h + * variables used for binary upgrades + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/binary_upgrade.h + * + *------------------------------------------------------------------------- + */ +#ifndef BINARY_UPGRADE_H +#define BINARY_UPGRADE_H + +#include "common/relpath.h" + +extern PGDLLIMPORT Oid binary_upgrade_next_pg_tablespace_oid; + +extern PGDLLIMPORT Oid binary_upgrade_next_pg_type_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_array_pg_type_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_mrng_pg_type_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_mrng_array_pg_type_oid; + +extern PGDLLIMPORT Oid binary_upgrade_next_heap_pg_class_oid; +extern PGDLLIMPORT RelFileNumber binary_upgrade_next_heap_pg_class_relfilenumber; +extern PGDLLIMPORT Oid binary_upgrade_next_index_pg_class_oid; +extern PGDLLIMPORT RelFileNumber binary_upgrade_next_index_pg_class_relfilenumber; +extern PGDLLIMPORT Oid binary_upgrade_next_toast_pg_class_oid; +extern PGDLLIMPORT RelFileNumber binary_upgrade_next_toast_pg_class_relfilenumber; + +extern PGDLLIMPORT Oid binary_upgrade_next_pg_enum_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_pg_authid_oid; + +extern PGDLLIMPORT bool binary_upgrade_record_init_privs; + +#endif /* BINARY_UPGRADE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/catalog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/catalog.h new file mode 100644 index 0000000..9b5e750 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/catalog.h @@ -0,0 +1,48 @@ +/*------------------------------------------------------------------------- + * + * catalog.h + * prototypes for functions in backend/catalog/catalog.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/catalog.h + * + *------------------------------------------------------------------------- + */ +#ifndef CATALOG_H +#define CATALOG_H + +#include "catalog/pg_class.h" +#include "utils/relcache.h" + + +extern bool IsSystemRelation(Relation relation); +extern bool IsToastRelation(Relation relation); +extern bool IsCatalogRelation(Relation relation); +extern bool IsInplaceUpdateRelation(Relation relation); + +extern bool IsSystemClass(Oid relid, Form_pg_class reltuple); +extern bool IsToastClass(Form_pg_class reltuple); + +extern bool IsCatalogRelationOid(Oid relid); +extern bool IsCatalogTextUniqueIndexOid(Oid relid); +extern bool IsInplaceUpdateOid(Oid relid); + +extern bool IsCatalogNamespace(Oid namespaceId); +extern bool IsToastNamespace(Oid namespaceId); + +extern bool IsReservedName(const char *name); + +extern bool IsSharedRelation(Oid relationId); + +extern bool IsPinnedObject(Oid classId, Oid objectId); + +extern Oid GetNewOidWithIndex(Relation relation, Oid indexId, + AttrNumber oidcolumn); +extern RelFileNumber GetNewRelFileNumber(Oid reltablespace, + Relation pg_class, + char relpersistence); + +#endif /* CATALOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/catversion.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/catversion.h new file mode 100644 index 0000000..4796298 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/catversion.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * catversion.h + * "Catalog version number" for PostgreSQL. + * + * The catalog version number is used to flag incompatible changes in + * the PostgreSQL system catalogs. Whenever anyone changes the format of + * a system catalog relation, or adds, deletes, or modifies standard + * catalog entries in such a way that an updated backend wouldn't work + * with an old database (or vice versa), the catalog version number + * should be changed. The version number stored in pg_control by initdb + * is checked against the version number compiled into the backend at + * startup time, so that a backend can refuse to run in an incompatible + * database. + * + * The point of this feature is to provide a finer grain of compatibility + * checking than is possible from looking at the major version number + * stored in PG_VERSION. It shouldn't matter to end users, but during + * development cycles we usually make quite a few incompatible changes + * to the contents of the system catalogs, and we don't want to bump the + * major version number for each one. What we can do instead is bump + * this internal version number. This should save some grief for + * developers who might otherwise waste time tracking down "bugs" that + * are really just code-vs-database incompatibilities. + * + * The rule for developers is: if you commit a change that requires + * an initdb, you should update the catalog version number (as well as + * notifying the pgsql-hackers mailing list, which has been the + * informal practice for a long time). + * + * The catalog version number is placed here since modifying files in + * include/catalog is the most common kind of initdb-forcing change. + * But it could be used to protect any kind of incompatible change in + * database contents or layout, such as altering tuple headers. + * Another common reason for a catversion update is a change in parsetree + * external representation, since serialized parsetrees appear in stored + * rules and new-style SQL functions. Almost any change in primnodes.h or + * parsenodes.h will warrant a catversion update. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/catversion.h + * + *------------------------------------------------------------------------- + */ +#ifndef CATVERSION_H +#define CATVERSION_H + +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 202506291 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/dependency.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/dependency.h new file mode 100644 index 0000000..4b9fcec --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/dependency.h @@ -0,0 +1,230 @@ +/*------------------------------------------------------------------------- + * + * dependency.h + * Routines to support inter-object dependencies. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/dependency.h + * + *------------------------------------------------------------------------- + */ +#ifndef DEPENDENCY_H +#define DEPENDENCY_H + +#include "catalog/objectaddress.h" + + +/* + * Precise semantics of a dependency relationship are specified by the + * DependencyType code (which is stored in a "char" field in pg_depend, + * so we assign ASCII-code values to the enumeration members). + * + * In all cases, a dependency relationship indicates that the referenced + * object may not be dropped without also dropping the dependent object. + * However, there are several subflavors; see the description of pg_depend + * in catalogs.sgml for details. + */ + +typedef enum DependencyType +{ + DEPENDENCY_NORMAL = 'n', + DEPENDENCY_AUTO = 'a', + DEPENDENCY_INTERNAL = 'i', + DEPENDENCY_PARTITION_PRI = 'P', + DEPENDENCY_PARTITION_SEC = 'S', + DEPENDENCY_EXTENSION = 'e', + DEPENDENCY_AUTO_EXTENSION = 'x', +} DependencyType; + +/* + * There is also a SharedDependencyType enum type that determines the exact + * semantics of an entry in pg_shdepend. Just like regular dependency entries, + * any pg_shdepend entry means that the referenced object cannot be dropped + * unless the dependent object is dropped at the same time. There are some + * additional rules however: + * + * (a) a SHARED_DEPENDENCY_OWNER entry means that the referenced object is + * the role owning the dependent object. The referenced object must be + * a pg_authid entry. + * + * (b) a SHARED_DEPENDENCY_ACL entry means that the referenced object is + * a role mentioned in the ACL field of the dependent object. The referenced + * object must be a pg_authid entry. (SHARED_DEPENDENCY_ACL entries are not + * created for the owner of an object; hence two objects may be linked by + * one or the other, but not both, of these dependency types.) + * + * (c) a SHARED_DEPENDENCY_INITACL entry means that the referenced object is + * a role mentioned in a pg_init_privs entry for the dependent object. + * The referenced object must be a pg_authid entry. (Unlike the case for + * SHARED_DEPENDENCY_ACL, we make an entry for such a role whether or not + * it is the object's owner.) + * + * (d) a SHARED_DEPENDENCY_POLICY entry means that the referenced object is + * a role mentioned in a policy object. The referenced object must be a + * pg_authid entry. + * + * (e) a SHARED_DEPENDENCY_TABLESPACE entry means that the referenced + * object is a tablespace mentioned in a relation without storage. The + * referenced object must be a pg_tablespace entry. (Relations that have + * storage don't need this: they are protected by the existence of a physical + * file in the tablespace.) + * + * SHARED_DEPENDENCY_INVALID is a value used as a parameter in internal + * routines, and is not valid in the catalog itself. + */ +typedef enum SharedDependencyType +{ + SHARED_DEPENDENCY_OWNER = 'o', + SHARED_DEPENDENCY_ACL = 'a', + SHARED_DEPENDENCY_INITACL = 'i', + SHARED_DEPENDENCY_POLICY = 'r', + SHARED_DEPENDENCY_TABLESPACE = 't', + SHARED_DEPENDENCY_INVALID = 0, +} SharedDependencyType; + +/* expansible list of ObjectAddresses (private in dependency.c) */ +typedef struct ObjectAddresses ObjectAddresses; + +/* flag bits for performDeletion/performMultipleDeletions: */ +#define PERFORM_DELETION_INTERNAL 0x0001 /* internal action */ +#define PERFORM_DELETION_CONCURRENTLY 0x0002 /* concurrent drop */ +#define PERFORM_DELETION_QUIETLY 0x0004 /* suppress notices */ +#define PERFORM_DELETION_SKIP_ORIGINAL 0x0008 /* keep original obj */ +#define PERFORM_DELETION_SKIP_EXTENSIONS 0x0010 /* keep extensions */ +#define PERFORM_DELETION_CONCURRENT_LOCK 0x0020 /* normal drop with + * concurrent lock mode */ + + +/* in dependency.c */ + +extern void AcquireDeletionLock(const ObjectAddress *object, int flags); + +extern void ReleaseDeletionLock(const ObjectAddress *object); + +extern void performDeletion(const ObjectAddress *object, + DropBehavior behavior, int flags); + +extern void performMultipleDeletions(const ObjectAddresses *objects, + DropBehavior behavior, int flags); + +extern void recordDependencyOnExpr(const ObjectAddress *depender, + Node *expr, List *rtable, + DependencyType behavior); + +extern void recordDependencyOnSingleRelExpr(const ObjectAddress *depender, + Node *expr, Oid relId, + DependencyType behavior, + DependencyType self_behavior, + bool reverse_self); + +extern ObjectAddresses *new_object_addresses(void); + +extern void add_exact_object_address(const ObjectAddress *object, + ObjectAddresses *addrs); + +extern bool object_address_present(const ObjectAddress *object, + const ObjectAddresses *addrs); + +extern void record_object_address_dependencies(const ObjectAddress *depender, + ObjectAddresses *referenced, + DependencyType behavior); + +extern void sort_object_addresses(ObjectAddresses *addrs); + +extern void free_object_addresses(ObjectAddresses *addrs); + +/* in pg_depend.c */ + +extern void recordDependencyOn(const ObjectAddress *depender, + const ObjectAddress *referenced, + DependencyType behavior); + +extern void recordMultipleDependencies(const ObjectAddress *depender, + const ObjectAddress *referenced, + int nreferenced, + DependencyType behavior); + +extern void recordDependencyOnCurrentExtension(const ObjectAddress *object, + bool isReplace); + +extern void checkMembershipInCurrentExtension(const ObjectAddress *object); + +extern long deleteDependencyRecordsFor(Oid classId, Oid objectId, + bool skipExtensionDeps); + +extern long deleteDependencyRecordsForClass(Oid classId, Oid objectId, + Oid refclassId, char deptype); + +extern long deleteDependencyRecordsForSpecific(Oid classId, Oid objectId, + char deptype, + Oid refclassId, Oid refobjectId); + +extern long changeDependencyFor(Oid classId, Oid objectId, + Oid refClassId, Oid oldRefObjectId, + Oid newRefObjectId); + +extern long changeDependenciesOf(Oid classId, Oid oldObjectId, + Oid newObjectId); + +extern long changeDependenciesOn(Oid refClassId, Oid oldRefObjectId, + Oid newRefObjectId); + +extern Oid getExtensionOfObject(Oid classId, Oid objectId); +extern List *getAutoExtensionsOfObject(Oid classId, Oid objectId); + +extern Oid getExtensionType(Oid extensionOid, const char *typname); + +extern bool sequenceIsOwned(Oid seqId, char deptype, Oid *tableId, int32 *colId); +extern List *getOwnedSequences(Oid relid); +extern Oid getIdentitySequence(Relation rel, AttrNumber attnum, bool missing_ok); + +extern Oid get_index_constraint(Oid indexId); + +extern List *get_index_ref_constraints(Oid indexId); + +/* in pg_shdepend.c */ + +extern void recordSharedDependencyOn(ObjectAddress *depender, + ObjectAddress *referenced, + SharedDependencyType deptype); + +extern void deleteSharedDependencyRecordsFor(Oid classId, Oid objectId, + int32 objectSubId); + +extern void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner); + +extern void changeDependencyOnOwner(Oid classId, Oid objectId, + Oid newOwnerId); + +extern void recordDependencyOnTablespace(Oid classId, Oid objectId, + Oid tablespace); + +extern void changeDependencyOnTablespace(Oid classId, Oid objectId, + Oid newTablespaceId); + +extern void updateAclDependencies(Oid classId, Oid objectId, int32 objsubId, + Oid ownerId, + int noldmembers, Oid *oldmembers, + int nnewmembers, Oid *newmembers); + +extern void updateInitAclDependencies(Oid classId, Oid objectId, int32 objsubId, + int noldmembers, Oid *oldmembers, + int nnewmembers, Oid *newmembers); + +extern bool checkSharedDependencies(Oid classId, Oid objectId, + char **detail_msg, char **detail_log_msg); + +extern void shdepLockAndCheckObject(Oid classId, Oid objectId); + +extern void copyTemplateDependencies(Oid templateDbId, Oid newDbId); + +extern void dropDatabaseDependencies(Oid databaseId); + +extern void shdepDropOwned(List *roleids, DropBehavior behavior); + +extern void shdepReassignOwned(List *roleids, Oid newrole); + +#endif /* DEPENDENCY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/genbki.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/genbki.h new file mode 100644 index 0000000..26e2055 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/genbki.h @@ -0,0 +1,149 @@ +/*------------------------------------------------------------------------- + * + * genbki.h + * Required include file for all POSTGRES catalog header files + * + * genbki.h defines CATALOG(), BKI_BOOTSTRAP and related macros + * so that the catalog header files can be read by the C compiler. + * (These same words are recognized by genbki.pl to build the BKI + * bootstrap file from these header files.) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/genbki.h + * + *------------------------------------------------------------------------- + */ +#ifndef GENBKI_H +#define GENBKI_H + +/* Introduces a catalog's structure definition */ +#define CATALOG(name,oid,oidmacro) typedef struct CppConcat(FormData_,name) + +/* Options that may appear after CATALOG (on the same line) */ +#define BKI_BOOTSTRAP +#define BKI_SHARED_RELATION +#define BKI_ROWTYPE_OID(oid,oidmacro) +#define BKI_SCHEMA_MACRO + +/* Options that may appear after an attribute (on the same line) */ +#define BKI_FORCE_NULL +#define BKI_FORCE_NOT_NULL +/* Specifies a default value for a catalog field */ +#define BKI_DEFAULT(value) +/* Specifies a default value for auto-generated array types */ +#define BKI_ARRAY_DEFAULT(value) +/* + * Indicates that the attribute contains OIDs referencing the named catalog; + * can be applied to columns of oid, regproc, oid[], or oidvector type. + * genbki.pl uses this to know how to perform name lookups in the initial + * data (if any), and it also feeds into regression-test validity checks. + * The _OPT suffix indicates that values can be zero instead of + * a valid OID reference. + */ +#define BKI_LOOKUP(catalog) +#define BKI_LOOKUP_OPT(catalog) + +/* + * These lines are processed by genbki.pl to create the statements + * the bootstrap parser will turn into BootstrapToastTable commands. + * Each line specifies the system catalog that needs a toast table, + * the OID to assign to the toast table, and the OID to assign to the + * toast table's index. The reason we hard-wire these OIDs is that we + * need stable OIDs for shared relations, and that includes toast tables + * of shared relations. + * + * The DECLARE_TOAST_WITH_MACRO variant is used when C macros are needed + * for the toast table/index OIDs (usually only for shared catalogs). + * + * The macro definitions are just to keep the C compiler from spitting up. + */ +#define DECLARE_TOAST(name,toastoid,indexoid) extern int no_such_variable +#define DECLARE_TOAST_WITH_MACRO(name,toastoid,indexoid,toastoidmacro,indexoidmacro) extern int no_such_variable + +/* + * These lines are processed by genbki.pl to create the statements + * the bootstrap parser will turn into DefineIndex calls. + * + * The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX or + * DECLARE_UNIQUE_INDEX_PKEY. ("PKEY" marks the index as being the catalog's + * primary key; currently this is only cosmetically different from a regular + * unique index. By convention, we usually make a catalog's OID column its + * pkey, if it has one.) + * + * The first two arguments are the index's name and OID. The third argument + * is the name of a #define to generate for its OID. References to the index + * in the C code should always use these #defines, not the actual index name + * (much less the numeric OID). The fourth argument is the table name. The + * rest is much like a standard 'create index' SQL command. + * + * The macro definitions are just to keep the C compiler from spitting up. + */ +#define DECLARE_INDEX(name,oid,oidmacro,tblname,decl) extern int no_such_variable +#define DECLARE_UNIQUE_INDEX(name,oid,oidmacro,tblname,decl) extern int no_such_variable +#define DECLARE_UNIQUE_INDEX_PKEY(name,oid,oidmacro,tblname,decl) extern int no_such_variable + +/* + * These lines inform genbki.pl about manually-assigned OIDs that do not + * correspond to any entry in the catalog *.dat files, but should be subject + * to uniqueness verification and renumber_oids.pl renumbering. A C macro + * to #define the given name is emitted into the corresponding *_d.h file. + */ +#define DECLARE_OID_DEFINING_MACRO(name,oid) extern int no_such_variable + +/* + * These lines are processed by genbki.pl to create a table for use + * by the pg_get_catalog_foreign_keys() function. We do not have any + * mechanism that actually enforces foreign-key relationships in the + * system catalogs, but it is still useful to record the intended + * relationships in a machine-readable form. + * + * The keyword is DECLARE_FOREIGN_KEY[_OPT] or DECLARE_ARRAY_FOREIGN_KEY[_OPT]. + * The first argument is a parenthesized list of the referencing columns; + * the second, the name of the referenced table; the third, a parenthesized + * list of the referenced columns. Use of the ARRAY macros means that the + * last referencing column is an array, each of whose elements is supposed + * to match some entry in the last referenced column. Use of the OPT suffix + * indicates that the referencing column(s) can be zero instead of a valid + * reference. + * + * Columns that are marked with a BKI_LOOKUP rule do not need an explicit + * DECLARE_FOREIGN_KEY macro, as genbki.pl can infer the FK relationship + * from that. Thus, these macros are only needed in special cases. + * + * The macro definitions are just to keep the C compiler from spitting up. + */ +#define DECLARE_FOREIGN_KEY(cols,reftbl,refcols) extern int no_such_variable +#define DECLARE_FOREIGN_KEY_OPT(cols,reftbl,refcols) extern int no_such_variable +#define DECLARE_ARRAY_FOREIGN_KEY(cols,reftbl,refcols) extern int no_such_variable +#define DECLARE_ARRAY_FOREIGN_KEY_OPT(cols,reftbl,refcols) extern int no_such_variable + +/* + * Create a syscache with the given name, index, and bucket size. See + * syscache.c. + */ +#define MAKE_SYSCACHE(name,idxname,nbuckets) extern int no_such_variable + +/* The following are never defined; they are here only for documentation. */ + +/* + * Variable-length catalog fields (except possibly the first not nullable one) + * should not be visible in C structures, so they are made invisible by #ifdefs + * of an undefined symbol. See also the BOOTCOL_NULL_AUTO code in bootstrap.c + * for how this is handled. + */ +#undef CATALOG_VARLEN + +/* + * There is code in some catalog headers that needs to be visible to clients, + * but we don't want clients to include the full header because of safety + * issues with other code in the header. To handle that, surround code that + * should be visible to clients with "#ifdef EXPOSE_TO_CLIENT_CODE". That + * instructs genbki.pl to copy the section when generating the corresponding + * "_d" header, which can be included by both client and backend code. + */ +#undef EXPOSE_TO_CLIENT_CODE + +#endif /* GENBKI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/heap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/heap.h new file mode 100644 index 0000000..7f3a0ef --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/heap.h @@ -0,0 +1,168 @@ +/*------------------------------------------------------------------------- + * + * heap.h + * prototypes for functions in backend/catalog/heap.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/heap.h + * + *------------------------------------------------------------------------- + */ +#ifndef HEAP_H +#define HEAP_H + +#include "catalog/indexing.h" +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" + + +/* flag bits for CheckAttributeType/CheckAttributeNamesTypes */ +#define CHKATYPE_ANYARRAY 0x01 /* allow ANYARRAY */ +#define CHKATYPE_ANYRECORD 0x02 /* allow RECORD and RECORD[] */ +#define CHKATYPE_IS_PARTKEY 0x04 /* attname is part key # not column */ +#define CHKATYPE_IS_VIRTUAL 0x08 /* is virtual generated column */ + +typedef struct RawColumnDefault +{ + AttrNumber attnum; /* attribute to attach default to */ + Node *raw_default; /* default value (untransformed parse tree) */ + char generated; /* attgenerated setting */ +} RawColumnDefault; + +typedef struct CookedConstraint +{ + ConstrType contype; /* CONSTR_DEFAULT, CONSTR_CHECK, + * CONSTR_NOTNULL */ + Oid conoid; /* constr OID if created, otherwise Invalid */ + char *name; /* name, or NULL if none */ + AttrNumber attnum; /* which attr (only for NOTNULL, DEFAULT) */ + Node *expr; /* transformed default or check expr */ + bool is_enforced; /* is enforced? (only for CHECK) */ + bool skip_validation; /* skip validation? (only for CHECK) */ + bool is_local; /* constraint has local (non-inherited) def */ + int16 inhcount; /* number of times constraint is inherited */ + bool is_no_inherit; /* constraint has local def and cannot be + * inherited */ +} CookedConstraint; + +extern Relation heap_create(const char *relname, + Oid relnamespace, + Oid reltablespace, + Oid relid, + RelFileNumber relfilenumber, + Oid accessmtd, + TupleDesc tupDesc, + char relkind, + char relpersistence, + bool shared_relation, + bool mapped_relation, + bool allow_system_table_mods, + TransactionId *relfrozenxid, + MultiXactId *relminmxid, + bool create_storage); + +extern Oid heap_create_with_catalog(const char *relname, + Oid relnamespace, + Oid reltablespace, + Oid relid, + Oid reltypeid, + Oid reloftypeid, + Oid ownerid, + Oid accessmtd, + TupleDesc tupdesc, + List *cooked_constraints, + char relkind, + char relpersistence, + bool shared_relation, + bool mapped_relation, + OnCommitAction oncommit, + Datum reloptions, + bool use_user_acl, + bool allow_system_table_mods, + bool is_internal, + Oid relrewrite, + ObjectAddress *typaddress); + +extern void heap_drop_with_catalog(Oid relid); + +extern void heap_truncate(List *relids); + +extern void heap_truncate_one_rel(Relation rel); + +extern void heap_truncate_check_FKs(List *relations, bool tempTables); + +extern List *heap_truncate_find_FKs(List *relationIds); + +extern void InsertPgAttributeTuples(Relation pg_attribute_rel, + TupleDesc tupdesc, + Oid new_rel_oid, + const FormExtraData_pg_attribute tupdesc_extra[], + CatalogIndexState indstate); + +extern void InsertPgClassTuple(Relation pg_class_desc, + Relation new_rel_desc, + Oid new_rel_oid, + Datum relacl, + Datum reloptions); + +extern List *AddRelationNewConstraints(Relation rel, + List *newColDefaults, + List *newConstraints, + bool allow_merge, + bool is_local, + bool is_internal, + const char *queryString); +extern List *AddRelationNotNullConstraints(Relation rel, + List *constraints, + List *old_notnulls, + List *existing_constraints); + +extern void RelationClearMissing(Relation rel); + +extern void StoreAttrMissingVal(Relation rel, AttrNumber attnum, + Datum missingval); +extern void SetAttrMissing(Oid relid, char *attname, char *value); + +extern Node *cookDefault(ParseState *pstate, + Node *raw_default, + Oid atttypid, + int32 atttypmod, + const char *attname, + char attgenerated); + +extern void DeleteRelationTuple(Oid relid); +extern void DeleteAttributeTuples(Oid relid); +extern void DeleteSystemAttributeTuples(Oid relid); +extern void RemoveAttributeById(Oid relid, AttrNumber attnum); + +extern void CopyStatistics(Oid fromrelid, Oid torelid); +extern void RemoveStatistics(Oid relid, AttrNumber attnum); + +extern const FormData_pg_attribute *SystemAttributeDefinition(AttrNumber attno); + +extern const FormData_pg_attribute *SystemAttributeByName(const char *attname); + +extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind, + int flags); + +extern void CheckAttributeType(const char *attname, + Oid atttypid, Oid attcollation, + List *containing_rowtypes, + int flags); + +/* pg_partitioned_table catalog manipulation functions */ +extern void StorePartitionKey(Relation rel, + char strategy, + int16 partnatts, + AttrNumber *partattrs, + List *partexprs, + Oid *partopclass, + Oid *partcollation); +extern void RemovePartitionKeyByRelId(Oid relid); +extern void StorePartitionBound(Relation rel, Relation parent, + PartitionBoundSpec *bound); + +#endif /* HEAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/index.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/index.h new file mode 100644 index 0000000..4daa8be --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/index.h @@ -0,0 +1,219 @@ +/*------------------------------------------------------------------------- + * + * index.h + * prototypes for catalog/index.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/index.h + * + *------------------------------------------------------------------------- + */ +#ifndef INDEX_H +#define INDEX_H + +#include "catalog/objectaddress.h" +#include "nodes/execnodes.h" + + +#define DEFAULT_INDEX_TYPE "btree" + +/* Action code for index_set_state_flags */ +typedef enum +{ + INDEX_CREATE_SET_READY, + INDEX_CREATE_SET_VALID, + INDEX_DROP_CLEAR_VALID, + INDEX_DROP_SET_DEAD, +} IndexStateFlagsAction; + +/* options for REINDEX */ +typedef struct ReindexParams +{ + bits32 options; /* bitmask of REINDEXOPT_* */ + Oid tablespaceOid; /* New tablespace to move indexes to. + * InvalidOid to do nothing. */ +} ReindexParams; + +/* flag bits for ReindexParams->flags */ +#define REINDEXOPT_VERBOSE 0x01 /* print progress info */ +#define REINDEXOPT_REPORT_PROGRESS 0x02 /* report pgstat progress */ +#define REINDEXOPT_MISSING_OK 0x04 /* skip missing relations */ +#define REINDEXOPT_CONCURRENTLY 0x08 /* concurrent mode */ + +/* state info for validate_index bulkdelete callback */ +typedef struct ValidateIndexState +{ + Tuplesortstate *tuplesort; /* for sorting the index TIDs */ + /* statistics (for debug purposes only): */ + double htups, + itups, + tups_inserted; +} ValidateIndexState; + +extern void index_check_primary_key(Relation heapRel, + const IndexInfo *indexInfo, + bool is_alter_table, + const IndexStmt *stmt); + +#define INDEX_CREATE_IS_PRIMARY (1 << 0) +#define INDEX_CREATE_ADD_CONSTRAINT (1 << 1) +#define INDEX_CREATE_SKIP_BUILD (1 << 2) +#define INDEX_CREATE_CONCURRENT (1 << 3) +#define INDEX_CREATE_IF_NOT_EXISTS (1 << 4) +#define INDEX_CREATE_PARTITIONED (1 << 5) +#define INDEX_CREATE_INVALID (1 << 6) + +extern Oid index_create(Relation heapRelation, + const char *indexRelationName, + Oid indexRelationId, + Oid parentIndexRelid, + Oid parentConstraintId, + RelFileNumber relFileNumber, + IndexInfo *indexInfo, + const List *indexColNames, + Oid accessMethodId, + Oid tableSpaceId, + const Oid *collationIds, + const Oid *opclassIds, + const Datum *opclassOptions, + const int16 *coloptions, + const NullableDatum *stattargets, + Datum reloptions, + bits16 flags, + bits16 constr_flags, + bool allow_system_table_mods, + bool is_internal, + Oid *constraintId); + +#define INDEX_CONSTR_CREATE_MARK_AS_PRIMARY (1 << 0) +#define INDEX_CONSTR_CREATE_DEFERRABLE (1 << 1) +#define INDEX_CONSTR_CREATE_INIT_DEFERRED (1 << 2) +#define INDEX_CONSTR_CREATE_UPDATE_INDEX (1 << 3) +#define INDEX_CONSTR_CREATE_REMOVE_OLD_DEPS (1 << 4) +#define INDEX_CONSTR_CREATE_WITHOUT_OVERLAPS (1 << 5) + +extern Oid index_concurrently_create_copy(Relation heapRelation, + Oid oldIndexId, + Oid tablespaceOid, + const char *newName); + +extern void index_concurrently_build(Oid heapRelationId, + Oid indexRelationId); + +extern void index_concurrently_swap(Oid newIndexId, + Oid oldIndexId, + const char *oldName); + +extern void index_concurrently_set_dead(Oid heapId, + Oid indexId); + +extern ObjectAddress index_constraint_create(Relation heapRelation, + Oid indexRelationId, + Oid parentConstraintId, + const IndexInfo *indexInfo, + const char *constraintName, + char constraintType, + bits16 constr_flags, + bool allow_system_table_mods, + bool is_internal); + +extern void index_drop(Oid indexId, bool concurrent, bool concurrent_lock_mode); + +extern IndexInfo *BuildIndexInfo(Relation index); + +extern IndexInfo *BuildDummyIndexInfo(Relation index); + +extern bool CompareIndexInfo(const IndexInfo *info1, const IndexInfo *info2, + const Oid *collations1, const Oid *collations2, + const Oid *opfamilies1, const Oid *opfamilies2, + const AttrMap *attmap); + +extern void BuildSpeculativeIndexInfo(Relation index, IndexInfo *ii); + +extern void FormIndexDatum(IndexInfo *indexInfo, + TupleTableSlot *slot, + EState *estate, + Datum *values, + bool *isnull); + +extern void index_build(Relation heapRelation, + Relation indexRelation, + IndexInfo *indexInfo, + bool isreindex, + bool parallel); + +extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot); + +extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action); + +extern Oid IndexGetRelation(Oid indexId, bool missing_ok); + +extern void reindex_index(const ReindexStmt *stmt, Oid indexId, + bool skip_constraint_checks, char persistence, + const ReindexParams *params); + +/* Flag bits for reindex_relation(): */ +#define REINDEX_REL_PROCESS_TOAST 0x01 +#define REINDEX_REL_SUPPRESS_INDEX_USE 0x02 +#define REINDEX_REL_CHECK_CONSTRAINTS 0x04 +#define REINDEX_REL_FORCE_INDEXES_UNLOGGED 0x08 +#define REINDEX_REL_FORCE_INDEXES_PERMANENT 0x10 + +extern bool reindex_relation(const ReindexStmt *stmt, Oid relid, int flags, + const ReindexParams *params); + +extern bool ReindexIsProcessingHeap(Oid heapOid); +extern bool ReindexIsProcessingIndex(Oid indexOid); + +extern void ResetReindexState(int nestLevel); +extern Size EstimateReindexStateSpace(void); +extern void SerializeReindexState(Size maxsize, char *start_address); +extern void RestoreReindexState(const void *reindexstate); + +extern void IndexSetParentIndex(Relation partitionIdx, Oid parentOid); + + +/* + * itemptr_encode - Encode ItemPointer as int64/int8 + * + * This representation must produce values encoded as int64 that sort in the + * same order as their corresponding original TID values would (using the + * default int8 opclass to produce a result equivalent to the default TID + * opclass). + * + * As noted in validate_index(), this can be significantly faster. + */ +static inline int64 +itemptr_encode(ItemPointer itemptr) +{ + BlockNumber block = ItemPointerGetBlockNumber(itemptr); + OffsetNumber offset = ItemPointerGetOffsetNumber(itemptr); + int64 encoded; + + /* + * Use the 16 least significant bits for the offset. 32 adjacent bits are + * used for the block number. Since remaining bits are unused, there + * cannot be negative encoded values (We assume a two's complement + * representation). + */ + encoded = ((uint64) block << 16) | (uint16) offset; + + return encoded; +} + +/* + * itemptr_decode - Decode int64/int8 representation back to ItemPointer + */ +static inline void +itemptr_decode(ItemPointer itemptr, int64 encoded) +{ + BlockNumber block = (BlockNumber) (encoded >> 16); + OffsetNumber offset = (OffsetNumber) (encoded & 0xFFFF); + + ItemPointerSet(itemptr, block, offset); +} + +#endif /* INDEX_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/indexing.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/indexing.h new file mode 100644 index 0000000..667aca7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/indexing.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * indexing.h + * This file provides some definitions to support indexing + * on system catalogs + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/indexing.h + * + *------------------------------------------------------------------------- + */ +#ifndef INDEXING_H +#define INDEXING_H + +#include "access/htup.h" +#include "nodes/execnodes.h" +#include "utils/relcache.h" + +/* + * The state object used by CatalogOpenIndexes and friends is actually the + * same as the executor's ResultRelInfo, but we give it another type name + * to decouple callers from that fact. + */ +typedef struct ResultRelInfo *CatalogIndexState; + +/* + * Cap the maximum amount of bytes allocated for multi-inserts with system + * catalogs, limiting the number of slots used. + */ +#define MAX_CATALOG_MULTI_INSERT_BYTES 65535 + +/* + * indexing.c prototypes + */ +extern CatalogIndexState CatalogOpenIndexes(Relation heapRel); +extern void CatalogCloseIndexes(CatalogIndexState indstate); +extern void CatalogTupleInsert(Relation heapRel, HeapTuple tup); +extern void CatalogTupleInsertWithInfo(Relation heapRel, HeapTuple tup, + CatalogIndexState indstate); +extern void CatalogTuplesMultiInsertWithInfo(Relation heapRel, + TupleTableSlot **slot, + int ntuples, + CatalogIndexState indstate); +extern void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, + HeapTuple tup); +extern void CatalogTupleUpdateWithInfo(Relation heapRel, + ItemPointer otid, HeapTuple tup, + CatalogIndexState indstate); +extern void CatalogTupleDelete(Relation heapRel, ItemPointer tid); + +#endif /* INDEXING_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/namespace.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/namespace.h new file mode 100644 index 0000000..8c7ccc6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/namespace.h @@ -0,0 +1,189 @@ +/*------------------------------------------------------------------------- + * + * namespace.h + * prototypes for functions in backend/catalog/namespace.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/namespace.h + * + *------------------------------------------------------------------------- + */ +#ifndef NAMESPACE_H +#define NAMESPACE_H + +#include "nodes/primnodes.h" +#include "storage/lock.h" +#include "storage/procnumber.h" + + +/* + * This structure holds a list of possible functions or operators + * found by namespace lookup. Each function/operator is identified + * by OID and by argument types; the list must be pruned by type + * resolution rules that are embodied in the parser, not here. + * See FuncnameGetCandidates's comments for more info. + */ +typedef struct _FuncCandidateList +{ + struct _FuncCandidateList *next; + int pathpos; /* for internal use of namespace lookup */ + Oid oid; /* the function or operator's OID */ + int nominalnargs; /* either pronargs or length(proallargtypes) */ + int nargs; /* number of arg types returned */ + int nvargs; /* number of args to become variadic array */ + int ndargs; /* number of defaulted args */ + int *argnumbers; /* args' positional indexes, if named call */ + Oid args[FLEXIBLE_ARRAY_MEMBER]; /* arg types */ +} *FuncCandidateList; + +/* + * Result of checkTempNamespaceStatus + */ +typedef enum TempNamespaceStatus +{ + TEMP_NAMESPACE_NOT_TEMP, /* nonexistent, or non-temp namespace */ + TEMP_NAMESPACE_IDLE, /* exists, belongs to no active session */ + TEMP_NAMESPACE_IN_USE, /* belongs to some active session */ +} TempNamespaceStatus; + +/* + * Structure for xxxSearchPathMatcher functions + * + * The generation counter is private to namespace.c and shouldn't be touched + * by other code. It can be initialized to zero if necessary (that means + * "not known equal to the current active path"). + */ +typedef struct SearchPathMatcher +{ + List *schemas; /* OIDs of explicitly named schemas */ + bool addCatalog; /* implicitly prepend pg_catalog? */ + bool addTemp; /* implicitly prepend temp schema? */ + uint64 generation; /* for quick detection of equality to active */ +} SearchPathMatcher; + +/* + * Option flag bits for RangeVarGetRelidExtended(). + */ +typedef enum RVROption +{ + RVR_MISSING_OK = 1 << 0, /* don't error if relation doesn't exist */ + RVR_NOWAIT = 1 << 1, /* error if relation cannot be locked */ + RVR_SKIP_LOCKED = 1 << 2, /* skip if relation cannot be locked */ +} RVROption; + +typedef void (*RangeVarGetRelidCallback) (const RangeVar *relation, Oid relId, + Oid oldRelId, void *callback_arg); + +#define RangeVarGetRelid(relation, lockmode, missing_ok) \ + RangeVarGetRelidExtended(relation, lockmode, \ + (missing_ok) ? RVR_MISSING_OK : 0, NULL, NULL) + +extern Oid RangeVarGetRelidExtended(const RangeVar *relation, + LOCKMODE lockmode, uint32 flags, + RangeVarGetRelidCallback callback, + void *callback_arg); +extern Oid RangeVarGetCreationNamespace(const RangeVar *newRelation); +extern Oid RangeVarGetAndCheckCreationNamespace(RangeVar *relation, + LOCKMODE lockmode, + Oid *existing_relation_id); +extern void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid); +extern Oid RelnameGetRelid(const char *relname); +extern bool RelationIsVisible(Oid relid); + +extern Oid TypenameGetTypid(const char *typname); +extern Oid TypenameGetTypidExtended(const char *typname, bool temp_ok); +extern bool TypeIsVisible(Oid typid); + +extern FuncCandidateList FuncnameGetCandidates(List *names, + int nargs, List *argnames, + bool expand_variadic, + bool expand_defaults, + bool include_out_arguments, + bool missing_ok); +extern bool FunctionIsVisible(Oid funcid); + +extern Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright); +extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind, + bool missing_schema_ok); +extern bool OperatorIsVisible(Oid oprid); + +extern Oid OpclassnameGetOpcid(Oid amid, const char *opcname); +extern bool OpclassIsVisible(Oid opcid); + +extern Oid OpfamilynameGetOpfid(Oid amid, const char *opfname); +extern bool OpfamilyIsVisible(Oid opfid); + +extern Oid CollationGetCollid(const char *collname); +extern bool CollationIsVisible(Oid collid); + +extern Oid ConversionGetConid(const char *conname); +extern bool ConversionIsVisible(Oid conid); + +extern Oid get_statistics_object_oid(List *names, bool missing_ok); +extern bool StatisticsObjIsVisible(Oid stxid); + +extern Oid get_ts_parser_oid(List *names, bool missing_ok); +extern bool TSParserIsVisible(Oid prsId); + +extern Oid get_ts_dict_oid(List *names, bool missing_ok); +extern bool TSDictionaryIsVisible(Oid dictId); + +extern Oid get_ts_template_oid(List *names, bool missing_ok); +extern bool TSTemplateIsVisible(Oid tmplId); + +extern Oid get_ts_config_oid(List *names, bool missing_ok); +extern bool TSConfigIsVisible(Oid cfgid); + +extern void DeconstructQualifiedName(const List *names, + char **nspname_p, + char **objname_p); +extern Oid LookupNamespaceNoError(const char *nspname); +extern Oid LookupExplicitNamespace(const char *nspname, bool missing_ok); +extern Oid get_namespace_oid(const char *nspname, bool missing_ok); + +extern Oid LookupCreationNamespace(const char *nspname); +extern void CheckSetNamespace(Oid oldNspOid, Oid nspOid); +extern Oid QualifiedNameGetCreationNamespace(const List *names, char **objname_p); +extern RangeVar *makeRangeVarFromNameList(const List *names); +extern char *NameListToString(const List *names); +extern char *NameListToQuotedString(const List *names); + +extern bool isTempNamespace(Oid namespaceId); +extern bool isTempToastNamespace(Oid namespaceId); +extern bool isTempOrTempToastNamespace(Oid namespaceId); +extern bool isAnyTempNamespace(Oid namespaceId); +extern bool isOtherTempNamespace(Oid namespaceId); +extern TempNamespaceStatus checkTempNamespaceStatus(Oid namespaceId); +extern ProcNumber GetTempNamespaceProcNumber(Oid namespaceId); +extern Oid GetTempToastNamespace(void); +extern void GetTempNamespaceState(Oid *tempNamespaceId, + Oid *tempToastNamespaceId); +extern void SetTempNamespaceState(Oid tempNamespaceId, + Oid tempToastNamespaceId); +extern void ResetTempTableNamespace(void); + +extern SearchPathMatcher *GetSearchPathMatcher(MemoryContext context); +extern SearchPathMatcher *CopySearchPathMatcher(SearchPathMatcher *path); +extern bool SearchPathMatchesCurrentEnvironment(SearchPathMatcher *path); + +extern Oid get_collation_oid(List *collname, bool missing_ok); +extern Oid get_conversion_oid(List *conname, bool missing_ok); +extern Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding); + + +/* initialization & transaction cleanup code */ +extern void InitializeSearchPath(void); +extern void AtEOXact_Namespace(bool isCommit, bool parallel); +extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); + +/* stuff for search_path GUC variable */ +extern PGDLLIMPORT char *namespace_search_path; + +extern List *fetch_search_path(bool includeImplicit); +extern int fetch_search_path_array(Oid *sarray, int sarray_len); + +#endif /* NAMESPACE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/objectaccess.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/objectaccess.h new file mode 100644 index 0000000..126d9c9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/objectaccess.h @@ -0,0 +1,267 @@ +/* + * objectaccess.h + * + * Object access hooks. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + */ + +#ifndef OBJECTACCESS_H +#define OBJECTACCESS_H + +/* + * Object access hooks are intended to be called just before or just after + * performing certain actions on a SQL object. This is intended as + * infrastructure for security or logging plugins. + * + * OAT_POST_CREATE should be invoked just after the object is created. + * Typically, this is done after inserting the primary catalog records and + * associated dependencies. The command counter may or may not be incremented + * at the time the hook is invoked; if not, the extension can use SnapshotSelf + * to get the new version of the tuple. + * + * OAT_DROP should be invoked just before deletion of objects; typically + * deleteOneObject(). Its arguments are packed within ObjectAccessDrop. + * + * OAT_POST_ALTER should be invoked just after the object is altered, + * but before the command counter is incremented. An extension using the + * hook can use a current MVCC snapshot to get the old version of the tuple, + * and can use SnapshotSelf to get the new version of the tuple. + * + * OAT_NAMESPACE_SEARCH should be invoked prior to object name lookup under + * a particular namespace. This event is equivalent to usage permission + * on a schema under the default access control mechanism. + * + * OAT_FUNCTION_EXECUTE should be invoked prior to function execution. + * This event is almost equivalent to execute permission on functions, + * except for the case when execute permission is checked during object + * creation or altering, because OAT_POST_CREATE or OAT_POST_ALTER are + * sufficient for extensions to track these kind of checks. + * + * OAT_TRUNCATE should be invoked just before truncation of objects. This + * event is equivalent to truncate permission on a relation under the + * default access control mechanism. + * + * Other types may be added in the future. + */ +typedef enum ObjectAccessType +{ + OAT_POST_CREATE, + OAT_DROP, + OAT_POST_ALTER, + OAT_NAMESPACE_SEARCH, + OAT_FUNCTION_EXECUTE, + OAT_TRUNCATE, +} ObjectAccessType; + +/* + * Arguments of OAT_POST_CREATE event + */ +typedef struct +{ + /* + * This flag informs extensions whether the context of this creation is + * invoked by user's operations, or not. E.g, it shall be dealt as + * internal stuff on toast tables or indexes due to type changes. + */ + bool is_internal; +} ObjectAccessPostCreate; + +/* + * Arguments of OAT_DROP event + */ +typedef struct +{ + /* + * Flags to inform extensions the context of this deletion. Also see + * PERFORM_DELETION_* in dependency.h + */ + int dropflags; +} ObjectAccessDrop; + +/* + * Arguments of OAT_POST_ALTER event + */ +typedef struct +{ + /* + * This identifier is used when system catalog takes two IDs to identify a + * particular tuple of the catalog. It is only used when the caller want + * to identify an entry of pg_inherits, pg_db_role_setting or + * pg_user_mapping. Elsewhere, InvalidOid should be set. + */ + Oid auxiliary_id; + + /* + * If this flag is set, the user hasn't requested that the object be + * altered, but we're doing it anyway for some internal reason. + * Permissions-checking hooks may want to skip checks if, say, we're alter + * the constraints of a temporary heap during CLUSTER. + */ + bool is_internal; +} ObjectAccessPostAlter; + +/* + * Arguments of OAT_NAMESPACE_SEARCH + */ +typedef struct +{ + /* + * If true, hook should report an error when permission to search this + * schema is denied. + */ + bool ereport_on_violation; + + /* + * This is, in essence, an out parameter. Core code should initialize + * this to true, and any extension that wants to deny access should reset + * it to false. But an extension should be careful never to store a true + * value here, so that in case there are multiple extensions access is + * only allowed if all extensions agree. + */ + bool result; +} ObjectAccessNamespaceSearch; + +/* Plugin provides a hook function matching one or both of these signatures. */ +typedef void (*object_access_hook_type) (ObjectAccessType access, + Oid classId, + Oid objectId, + int subId, + void *arg); + +typedef void (*object_access_hook_type_str) (ObjectAccessType access, + Oid classId, + const char *objectStr, + int subId, + void *arg); + +/* Plugin sets this variable to a suitable hook function. */ +extern PGDLLIMPORT object_access_hook_type object_access_hook; +extern PGDLLIMPORT object_access_hook_type_str object_access_hook_str; + + +/* Core code uses these functions to call the hook (see macros below). */ +extern void RunObjectPostCreateHook(Oid classId, Oid objectId, int subId, + bool is_internal); +extern void RunObjectDropHook(Oid classId, Oid objectId, int subId, + int dropflags); +extern void RunObjectTruncateHook(Oid objectId); +extern void RunObjectPostAlterHook(Oid classId, Oid objectId, int subId, + Oid auxiliaryId, bool is_internal); +extern bool RunNamespaceSearchHook(Oid objectId, bool ereport_on_violation); +extern void RunFunctionExecuteHook(Oid objectId); + +/* String versions */ +extern void RunObjectPostCreateHookStr(Oid classId, const char *objectName, int subId, + bool is_internal); +extern void RunObjectDropHookStr(Oid classId, const char *objectName, int subId, + int dropflags); +extern void RunObjectTruncateHookStr(const char *objectName); +extern void RunObjectPostAlterHookStr(Oid classId, const char *objectName, int subId, + Oid auxiliaryId, bool is_internal); +extern bool RunNamespaceSearchHookStr(const char *objectName, bool ereport_on_violation); +extern void RunFunctionExecuteHookStr(const char *objectName); + + +/* + * The following macros are wrappers around the functions above; these should + * normally be used to invoke the hook in lieu of calling the above functions + * directly. + */ + +#define InvokeObjectPostCreateHook(classId,objectId,subId) \ + InvokeObjectPostCreateHookArg((classId),(objectId),(subId),false) +#define InvokeObjectPostCreateHookArg(classId,objectId,subId,is_internal) \ + do { \ + if (object_access_hook) \ + RunObjectPostCreateHook((classId),(objectId),(subId), \ + (is_internal)); \ + } while(0) + +#define InvokeObjectDropHook(classId,objectId,subId) \ + InvokeObjectDropHookArg((classId),(objectId),(subId),0) +#define InvokeObjectDropHookArg(classId,objectId,subId,dropflags) \ + do { \ + if (object_access_hook) \ + RunObjectDropHook((classId),(objectId),(subId), \ + (dropflags)); \ + } while(0) + +#define InvokeObjectTruncateHook(objectId) \ + do { \ + if (object_access_hook) \ + RunObjectTruncateHook(objectId); \ + } while(0) + +#define InvokeObjectPostAlterHook(classId,objectId,subId) \ + InvokeObjectPostAlterHookArg((classId),(objectId),(subId), \ + InvalidOid,false) +#define InvokeObjectPostAlterHookArg(classId,objectId,subId, \ + auxiliaryId,is_internal) \ + do { \ + if (object_access_hook) \ + RunObjectPostAlterHook((classId),(objectId),(subId), \ + (auxiliaryId),(is_internal)); \ + } while(0) + +#define InvokeNamespaceSearchHook(objectId, ereport_on_violation) \ + (!object_access_hook \ + ? true \ + : RunNamespaceSearchHook((objectId), (ereport_on_violation))) + +#define InvokeFunctionExecuteHook(objectId) \ + do { \ + if (object_access_hook) \ + RunFunctionExecuteHook(objectId); \ + } while(0) + + +#define InvokeObjectPostCreateHookStr(classId,objectName,subId) \ + InvokeObjectPostCreateHookArgStr((classId),(objectName),(subId),false) +#define InvokeObjectPostCreateHookArgStr(classId,objectName,subId,is_internal) \ + do { \ + if (object_access_hook_str) \ + RunObjectPostCreateHookStr((classId),(objectName),(subId), \ + (is_internal)); \ + } while(0) + +#define InvokeObjectDropHookStr(classId,objectName,subId) \ + InvokeObjectDropHookArgStr((classId),(objectName),(subId),0) +#define InvokeObjectDropHookArgStr(classId,objectName,subId,dropflags) \ + do { \ + if (object_access_hook_str) \ + RunObjectDropHookStr((classId),(objectName),(subId), \ + (dropflags)); \ + } while(0) + +#define InvokeObjectTruncateHookStr(objectName) \ + do { \ + if (object_access_hook_str) \ + RunObjectTruncateHookStr(objectName); \ + } while(0) + +#define InvokeObjectPostAlterHookStr(classId,objectName,subId) \ + InvokeObjectPostAlterHookArgStr((classId),(objectName),(subId), \ + InvalidOid,false) +#define InvokeObjectPostAlterHookArgStr(classId,objectName,subId, \ + auxiliaryId,is_internal) \ + do { \ + if (object_access_hook_str) \ + RunObjectPostAlterHookStr((classId),(objectName),(subId), \ + (auxiliaryId),(is_internal)); \ + } while(0) + +#define InvokeNamespaceSearchHookStr(objectName, ereport_on_violation) \ + (!object_access_hook_str \ + ? true \ + : RunNamespaceSearchHookStr((objectName), (ereport_on_violation))) + +#define InvokeFunctionExecuteHookStr(objectName) \ + do { \ + if (object_access_hook_str) \ + RunFunctionExecuteHookStr(objectName); \ + } while(0) + + +#endif /* OBJECTACCESS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/objectaddress.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/objectaddress.h new file mode 100644 index 0000000..630434b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/objectaddress.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * objectaddress.h + * functions for working with object addresses + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/objectaddress.h + * + *------------------------------------------------------------------------- + */ +#ifndef OBJECTADDRESS_H +#define OBJECTADDRESS_H + +#include "access/htup.h" +#include "nodes/parsenodes.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" + +/* + * An ObjectAddress represents a database object of any type. + */ +typedef struct ObjectAddress +{ + Oid classId; /* Class Id from pg_class */ + Oid objectId; /* OID of the object */ + int32 objectSubId; /* Subitem within object (eg column), or 0 */ +} ObjectAddress; + +extern PGDLLIMPORT const ObjectAddress InvalidObjectAddress; + +#define ObjectAddressSubSet(addr, class_id, object_id, object_sub_id) \ + do { \ + (addr).classId = (class_id); \ + (addr).objectId = (object_id); \ + (addr).objectSubId = (object_sub_id); \ + } while (0) + +#define ObjectAddressSet(addr, class_id, object_id) \ + ObjectAddressSubSet(addr, class_id, object_id, 0) + +extern ObjectAddress get_object_address(ObjectType objtype, Node *object, + Relation *relp, + LOCKMODE lockmode, bool missing_ok); + +extern ObjectAddress get_object_address_rv(ObjectType objtype, RangeVar *rel, + List *object, Relation *relp, + LOCKMODE lockmode, bool missing_ok); + +extern void check_object_ownership(Oid roleid, + ObjectType objtype, ObjectAddress address, + Node *object, Relation relation); + +extern Oid get_object_namespace(const ObjectAddress *address); + +extern bool is_objectclass_supported(Oid class_id); +extern const char *get_object_class_descr(Oid class_id); +extern Oid get_object_oid_index(Oid class_id); +extern int get_object_catcache_oid(Oid class_id); +extern int get_object_catcache_name(Oid class_id); +extern AttrNumber get_object_attnum_oid(Oid class_id); +extern AttrNumber get_object_attnum_name(Oid class_id); +extern AttrNumber get_object_attnum_namespace(Oid class_id); +extern AttrNumber get_object_attnum_owner(Oid class_id); +extern AttrNumber get_object_attnum_acl(Oid class_id); +extern ObjectType get_object_type(Oid class_id, Oid object_id); +extern bool get_object_namensp_unique(Oid class_id); + +extern HeapTuple get_catalog_object_by_oid(Relation catalog, + AttrNumber oidcol, Oid objectId); +extern HeapTuple get_catalog_object_by_oid_extended(Relation catalog, + AttrNumber oidcol, + Oid objectId, + bool locktup); + +extern char *getObjectDescription(const ObjectAddress *object, + bool missing_ok); +extern char *getObjectDescriptionOids(Oid classid, Oid objid); + +extern int read_objtype_from_string(const char *objtype); +extern char *getObjectTypeDescription(const ObjectAddress *object, + bool missing_ok); +extern char *getObjectIdentity(const ObjectAddress *object, + bool missing_ok); +extern char *getObjectIdentityParts(const ObjectAddress *object, + List **objname, List **objargs, + bool missing_ok); +extern struct ArrayType *strlist_to_textarray(List *list); + +extern ObjectType get_relkind_objtype(char relkind); + +#endif /* OBJECTADDRESS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/partition.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/partition.h new file mode 100644 index 0000000..520374a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/partition.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * partition.h + * Header file for structures and utility functions related to + * partitioning + * + * Copyright (c) 2007-2025, PostgreSQL Global Development Group + * + * src/include/catalog/partition.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTITION_H +#define PARTITION_H + +#include "partitioning/partdefs.h" +#include "utils/relcache.h" + +/* Seed for the extended hash function */ +#define HASH_PARTITION_SEED UINT64CONST(0x7A5B22367996DCFD) + +extern Oid get_partition_parent(Oid relid, bool even_if_detached); +extern List *get_partition_ancestors(Oid relid); +extern Oid index_get_partition(Relation partition, Oid indexId); +extern List *map_partition_varattnos(List *expr, int fromrel_varno, + Relation to_rel, Relation from_rel); +extern bool has_partition_attrs(Relation rel, Bitmapset *attnums, + bool *used_in_expr); + +extern Oid get_default_partition_oid(Oid parentId); +extern void update_default_partition_oid(Oid parentId, Oid defaultPartId); +extern List *get_proposed_default_constraint(List *new_part_constraints); + +#endif /* PARTITION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_aggregate.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_aggregate.h new file mode 100644 index 0000000..c15f8d2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_aggregate.h @@ -0,0 +1,182 @@ +/*------------------------------------------------------------------------- + * + * pg_aggregate.h + * definition of the "aggregate" system catalog (pg_aggregate) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_aggregate.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AGGREGATE_H +#define PG_AGGREGATE_H + +#include "catalog/genbki.h" +#include "catalog/pg_aggregate_d.h" /* IWYU pragma: export */ + +#include "catalog/objectaddress.h" +#include "nodes/pg_list.h" + +/* ---------------------------------------------------------------- + * pg_aggregate definition. + * cpp turns this into typedef struct FormData_pg_aggregate + * ---------------------------------------------------------------- + */ +CATALOG(pg_aggregate,2600,AggregateRelationId) +{ + /* pg_proc OID of the aggregate itself */ + regproc aggfnoid BKI_LOOKUP(pg_proc); + + /* aggregate kind, see AGGKIND_ categories below */ + char aggkind BKI_DEFAULT(n); + + /* number of arguments that are "direct" arguments */ + int16 aggnumdirectargs BKI_DEFAULT(0); + + /* transition function */ + regproc aggtransfn BKI_LOOKUP(pg_proc); + + /* final function (0 if none) */ + regproc aggfinalfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* combine function (0 if none) */ + regproc aggcombinefn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* function to convert transtype to bytea (0 if none) */ + regproc aggserialfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* function to convert bytea to transtype (0 if none) */ + regproc aggdeserialfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* forward function for moving-aggregate mode (0 if none) */ + regproc aggmtransfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* inverse function for moving-aggregate mode (0 if none) */ + regproc aggminvtransfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* final function for moving-aggregate mode (0 if none) */ + regproc aggmfinalfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* true to pass extra dummy arguments to aggfinalfn */ + bool aggfinalextra BKI_DEFAULT(f); + + /* true to pass extra dummy arguments to aggmfinalfn */ + bool aggmfinalextra BKI_DEFAULT(f); + + /* tells whether aggfinalfn modifies transition state */ + char aggfinalmodify BKI_DEFAULT(r); + + /* tells whether aggmfinalfn modifies transition state */ + char aggmfinalmodify BKI_DEFAULT(r); + + /* associated sort operator (0 if none) */ + Oid aggsortop BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator); + + /* type of aggregate's transition (state) data */ + Oid aggtranstype BKI_LOOKUP(pg_type); + + /* estimated size of state data (0 for default estimate) */ + int32 aggtransspace BKI_DEFAULT(0); + + /* type of moving-aggregate state data (0 if none) */ + Oid aggmtranstype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* estimated size of moving-agg state (0 for default est) */ + int32 aggmtransspace BKI_DEFAULT(0); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + /* initial value for transition state (can be NULL) */ + text agginitval BKI_DEFAULT(_null_); + + /* initial value for moving-agg state (can be NULL) */ + text aggminitval BKI_DEFAULT(_null_); +#endif +} FormData_pg_aggregate; + +/* ---------------- + * Form_pg_aggregate corresponds to a pointer to a tuple with + * the format of pg_aggregate relation. + * ---------------- + */ +typedef FormData_pg_aggregate *Form_pg_aggregate; + +DECLARE_TOAST(pg_aggregate, 4159, 4160); + +DECLARE_UNIQUE_INDEX_PKEY(pg_aggregate_fnoid_index, 2650, AggregateFnoidIndexId, pg_aggregate, btree(aggfnoid oid_ops)); + +MAKE_SYSCACHE(AGGFNOID, pg_aggregate_fnoid_index, 16); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Symbolic values for aggkind column. We distinguish normal aggregates + * from ordered-set aggregates (which have two sets of arguments, namely + * direct and aggregated arguments) and from hypothetical-set aggregates + * (which are a subclass of ordered-set aggregates in which the last + * direct arguments have to match up in number and datatypes with the + * aggregated arguments). + */ +#define AGGKIND_NORMAL 'n' +#define AGGKIND_ORDERED_SET 'o' +#define AGGKIND_HYPOTHETICAL 'h' + +/* Use this macro to test for "ordered-set agg including hypothetical case" */ +#define AGGKIND_IS_ORDERED_SET(kind) ((kind) != AGGKIND_NORMAL) + +/* + * Symbolic values for aggfinalmodify and aggmfinalmodify columns. + * Preferably, finalfns do not modify the transition state value at all, + * but in some cases that would cost too much performance. We distinguish + * "pure read only" and "trashes it arbitrarily" cases, as well as the + * intermediate case where multiple finalfn calls are allowed but the + * transfn cannot be applied anymore after the first finalfn call. + */ +#define AGGMODIFY_READ_ONLY 'r' +#define AGGMODIFY_SHAREABLE 's' +#define AGGMODIFY_READ_WRITE 'w' + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern ObjectAddress AggregateCreate(const char *aggName, + Oid aggNamespace, + bool replace, + char aggKind, + int numArgs, + int numDirectArgs, + oidvector *parameterTypes, + Datum allParameterTypes, + Datum parameterModes, + Datum parameterNames, + List *parameterDefaults, + Oid variadicArgType, + List *aggtransfnName, + List *aggfinalfnName, + List *aggcombinefnName, + List *aggserialfnName, + List *aggdeserialfnName, + List *aggmtransfnName, + List *aggminvtransfnName, + List *aggmfinalfnName, + bool finalfnExtraArgs, + bool mfinalfnExtraArgs, + char finalfnModify, + char mfinalfnModify, + List *aggsortopName, + Oid aggTransType, + int32 aggTransSpace, + Oid aggmTransType, + int32 aggmTransSpace, + const char *agginitval, + const char *aggminitval, + char proparallel); + +#endif /* PG_AGGREGATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_aggregate_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_aggregate_d.h new file mode 100644 index 0000000..53106ab --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_aggregate_d.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------------------- + * + * pg_aggregate_d.h + * Macro definitions for pg_aggregate + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AGGREGATE_D_H +#define PG_AGGREGATE_D_H + +/* Macros related to the structure of pg_aggregate */ + +#define AggregateRelationId 2600 +#define AggregateFnoidIndexId 2650 + +#define Anum_pg_aggregate_aggfnoid 1 +#define Anum_pg_aggregate_aggkind 2 +#define Anum_pg_aggregate_aggnumdirectargs 3 +#define Anum_pg_aggregate_aggtransfn 4 +#define Anum_pg_aggregate_aggfinalfn 5 +#define Anum_pg_aggregate_aggcombinefn 6 +#define Anum_pg_aggregate_aggserialfn 7 +#define Anum_pg_aggregate_aggdeserialfn 8 +#define Anum_pg_aggregate_aggmtransfn 9 +#define Anum_pg_aggregate_aggminvtransfn 10 +#define Anum_pg_aggregate_aggmfinalfn 11 +#define Anum_pg_aggregate_aggfinalextra 12 +#define Anum_pg_aggregate_aggmfinalextra 13 +#define Anum_pg_aggregate_aggfinalmodify 14 +#define Anum_pg_aggregate_aggmfinalmodify 15 +#define Anum_pg_aggregate_aggsortop 16 +#define Anum_pg_aggregate_aggtranstype 17 +#define Anum_pg_aggregate_aggtransspace 18 +#define Anum_pg_aggregate_aggmtranstype 19 +#define Anum_pg_aggregate_aggmtransspace 20 +#define Anum_pg_aggregate_agginitval 21 +#define Anum_pg_aggregate_aggminitval 22 + +#define Natts_pg_aggregate 22 + +/* Definitions copied from pg_aggregate.h */ + + +/* + * Symbolic values for aggkind column. We distinguish normal aggregates + * from ordered-set aggregates (which have two sets of arguments, namely + * direct and aggregated arguments) and from hypothetical-set aggregates + * (which are a subclass of ordered-set aggregates in which the last + * direct arguments have to match up in number and datatypes with the + * aggregated arguments). + */ +#define AGGKIND_NORMAL 'n' +#define AGGKIND_ORDERED_SET 'o' +#define AGGKIND_HYPOTHETICAL 'h' + +/* Use this macro to test for "ordered-set agg including hypothetical case" */ +#define AGGKIND_IS_ORDERED_SET(kind) ((kind) != AGGKIND_NORMAL) + +/* + * Symbolic values for aggfinalmodify and aggmfinalmodify columns. + * Preferably, finalfns do not modify the transition state value at all, + * but in some cases that would cost too much performance. We distinguish + * "pure read only" and "trashes it arbitrarily" cases, as well as the + * intermediate case where multiple finalfn calls are allowed but the + * transfn cannot be applied anymore after the first finalfn call. + */ +#define AGGMODIFY_READ_ONLY 'r' +#define AGGMODIFY_SHAREABLE 's' +#define AGGMODIFY_READ_WRITE 'w' + + +/* OID symbols for objects defined in pg_aggregate.dat */ + + +#endif /* PG_AGGREGATE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_am.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_am.h new file mode 100644 index 0000000..6e98a09 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_am.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * + * pg_am.h + * definition of the "access method" system catalog (pg_am) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_am.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AM_H +#define PG_AM_H + +#include "catalog/genbki.h" +#include "catalog/pg_am_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_am definition. cpp turns this into + * typedef struct FormData_pg_am + * ---------------- + */ +CATALOG(pg_am,2601,AccessMethodRelationId) +{ + Oid oid; /* oid */ + + /* access method name */ + NameData amname; + + /* handler function */ + regproc amhandler BKI_LOOKUP(pg_proc); + + /* see AMTYPE_xxx constants below */ + char amtype; +} FormData_pg_am; + +/* ---------------- + * Form_pg_am corresponds to a pointer to a tuple with + * the format of pg_am relation. + * ---------------- + */ +typedef FormData_pg_am *Form_pg_am; + +DECLARE_UNIQUE_INDEX(pg_am_name_index, 2651, AmNameIndexId, pg_am, btree(amname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_am_oid_index, 2652, AmOidIndexId, pg_am, btree(oid oid_ops)); + +MAKE_SYSCACHE(AMNAME, pg_am_name_index, 4); +MAKE_SYSCACHE(AMOID, pg_am_oid_index, 4); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Allowed values for amtype + */ +#define AMTYPE_INDEX 'i' /* index access method */ +#define AMTYPE_TABLE 't' /* table access method */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_AM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_am_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_am_d.h new file mode 100644 index 0000000..2d248f9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_am_d.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * pg_am_d.h + * Macro definitions for pg_am + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AM_D_H +#define PG_AM_D_H + +/* Macros related to the structure of pg_am */ + +#define AccessMethodRelationId 2601 +#define AmNameIndexId 2651 +#define AmOidIndexId 2652 + +#define Anum_pg_am_oid 1 +#define Anum_pg_am_amname 2 +#define Anum_pg_am_amhandler 3 +#define Anum_pg_am_amtype 4 + +#define Natts_pg_am 4 + +/* Definitions copied from pg_am.h */ + + +/* + * Allowed values for amtype + */ +#define AMTYPE_INDEX 'i' /* index access method */ +#define AMTYPE_TABLE 't' /* table access method */ + + +/* OID symbols for objects defined in pg_am.dat */ + +#define HEAP_TABLE_AM_OID 2 +#define BTREE_AM_OID 403 +#define HASH_AM_OID 405 +#define GIST_AM_OID 783 +#define GIN_AM_OID 2742 +#define SPGIST_AM_OID 4000 +#define BRIN_AM_OID 3580 + +#endif /* PG_AM_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amop.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amop.h new file mode 100644 index 0000000..cc71cab --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amop.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * pg_amop.h + * definition of the "access method operator" system catalog (pg_amop) + * + * The amop table identifies the operators associated with each index operator + * family and operator class (classes are subsets of families). An associated + * operator can be either a search operator or an ordering operator, as + * identified by amoppurpose. + * + * The primary key for this table is . amoplefttype and amoprighttype are just copies of the + * operator's oprleft/oprright, ie its declared input data types. The + * "default" operators for a particular opclass within the family are those + * with amoplefttype = amoprighttype = opclass's opcintype. An opfamily may + * also contain other operators, typically cross-data-type operators. All the + * operators within a family are supposed to be compatible, in a way that is + * defined by each individual index AM. + * + * We also keep a unique index on , so that + * we can use a syscache to quickly answer questions of the form "is this + * operator in this opfamily, and if so what are its semantics with respect to + * the family?" This implies that the same operator cannot be listed for + * multiple strategy numbers within a single opfamily, with the exception that + * it's possible to list it for both search and ordering purposes (with + * different strategy numbers for the two purposes). + * + * amopmethod is a copy of the owning opfamily's opfmethod field. This is an + * intentional denormalization of the catalogs to buy lookup speed. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_amop.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMOP_H +#define PG_AMOP_H + +#include "catalog/genbki.h" +#include "catalog/pg_amop_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_amop definition. cpp turns this into + * typedef struct FormData_pg_amop + * ---------------- + */ +CATALOG(pg_amop,2602,AccessMethodOperatorRelationId) +{ + Oid oid; /* oid */ + + /* the index opfamily this entry is for */ + Oid amopfamily BKI_LOOKUP(pg_opfamily); + + /* operator's left input data type */ + Oid amoplefttype BKI_LOOKUP(pg_type); + + /* operator's right input data type */ + Oid amoprighttype BKI_LOOKUP(pg_type); + + /* operator strategy number */ + int16 amopstrategy; + + /* is operator for 's'earch or 'o'rdering? */ + char amoppurpose BKI_DEFAULT(s); + + /* the operator's pg_operator OID */ + Oid amopopr BKI_LOOKUP(pg_operator); + + /* the index access method this entry is for */ + Oid amopmethod BKI_LOOKUP(pg_am); + + /* ordering opfamily OID, or 0 if search op */ + Oid amopsortfamily BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_opfamily); +} FormData_pg_amop; + +/* ---------------- + * Form_pg_amop corresponds to a pointer to a tuple with + * the format of pg_amop relation. + * ---------------- + */ +typedef FormData_pg_amop *Form_pg_amop; + +DECLARE_UNIQUE_INDEX(pg_amop_fam_strat_index, 2653, AccessMethodStrategyIndexId, pg_amop, btree(amopfamily oid_ops, amoplefttype oid_ops, amoprighttype oid_ops, amopstrategy int2_ops)); +DECLARE_UNIQUE_INDEX(pg_amop_opr_fam_index, 2654, AccessMethodOperatorIndexId, pg_amop, btree(amopopr oid_ops, amoppurpose char_ops, amopfamily oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_amop_oid_index, 2756, AccessMethodOperatorOidIndexId, pg_amop, btree(oid oid_ops)); + +MAKE_SYSCACHE(AMOPSTRATEGY, pg_amop_fam_strat_index, 64); +MAKE_SYSCACHE(AMOPOPID, pg_amop_opr_fam_index, 64); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* allowed values of amoppurpose: */ +#define AMOP_SEARCH 's' /* operator is for search */ +#define AMOP_ORDER 'o' /* operator is for ordering */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_AMOP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amop_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amop_d.h new file mode 100644 index 0000000..dc83ece --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amop_d.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_amop_d.h + * Macro definitions for pg_amop + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMOP_D_H +#define PG_AMOP_D_H + +/* Macros related to the structure of pg_amop */ + +#define AccessMethodOperatorRelationId 2602 +#define AccessMethodStrategyIndexId 2653 +#define AccessMethodOperatorIndexId 2654 +#define AccessMethodOperatorOidIndexId 2756 + +#define Anum_pg_amop_oid 1 +#define Anum_pg_amop_amopfamily 2 +#define Anum_pg_amop_amoplefttype 3 +#define Anum_pg_amop_amoprighttype 4 +#define Anum_pg_amop_amopstrategy 5 +#define Anum_pg_amop_amoppurpose 6 +#define Anum_pg_amop_amopopr 7 +#define Anum_pg_amop_amopmethod 8 +#define Anum_pg_amop_amopsortfamily 9 + +#define Natts_pg_amop 9 + +/* Definitions copied from pg_amop.h */ + + +/* allowed values of amoppurpose: */ +#define AMOP_SEARCH 's' /* operator is for search */ +#define AMOP_ORDER 'o' /* operator is for ordering */ + + +/* OID symbols for objects defined in pg_amop.dat */ + + +#endif /* PG_AMOP_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amproc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amproc.h new file mode 100644 index 0000000..bf8de46 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amproc.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * pg_amproc.h + * definition of the "access method procedure" system catalog (pg_amproc) + * + * The amproc table identifies support procedures associated with index + * operator families and classes. These procedures can't be listed in pg_amop + * since they are not the implementation of any indexable operator. + * + * The primary key for this table is . The "default" support functions for a + * particular opclass within the family are those with amproclefttype = + * amprocrighttype = opclass's opcintype. These are the ones loaded into the + * relcache for an index and typically used for internal index operations. + * Other support functions are typically used to handle cross-type indexable + * operators with oprleft/oprright matching the entry's amproclefttype and + * amprocrighttype. The exact behavior depends on the index AM, however, and + * some don't pay attention to non-default functions at all. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_amproc.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMPROC_H +#define PG_AMPROC_H + +#include "catalog/genbki.h" +#include "catalog/pg_amproc_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_amproc definition. cpp turns this into + * typedef struct FormData_pg_amproc + * ---------------- + */ +CATALOG(pg_amproc,2603,AccessMethodProcedureRelationId) +{ + Oid oid; /* oid */ + + /* the index opfamily this entry is for */ + Oid amprocfamily BKI_LOOKUP(pg_opfamily); + + /* procedure's left input data type */ + Oid amproclefttype BKI_LOOKUP(pg_type); + + /* procedure's right input data type */ + Oid amprocrighttype BKI_LOOKUP(pg_type); + + /* support procedure index */ + int16 amprocnum; + + /* OID of the proc */ + regproc amproc BKI_LOOKUP(pg_proc); +} FormData_pg_amproc; + +/* ---------------- + * Form_pg_amproc corresponds to a pointer to a tuple with + * the format of pg_amproc relation. + * ---------------- + */ +typedef FormData_pg_amproc *Form_pg_amproc; + +DECLARE_UNIQUE_INDEX(pg_amproc_fam_proc_index, 2655, AccessMethodProcedureIndexId, pg_amproc, btree(amprocfamily oid_ops, amproclefttype oid_ops, amprocrighttype oid_ops, amprocnum int2_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_amproc_oid_index, 2757, AccessMethodProcedureOidIndexId, pg_amproc, btree(oid oid_ops)); + +MAKE_SYSCACHE(AMPROCNUM, pg_amproc_fam_proc_index, 16); + +#endif /* PG_AMPROC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amproc_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amproc_d.h new file mode 100644 index 0000000..2cd26c1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_amproc_d.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * pg_amproc_d.h + * Macro definitions for pg_amproc + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMPROC_D_H +#define PG_AMPROC_D_H + +/* Macros related to the structure of pg_amproc */ + +#define AccessMethodProcedureRelationId 2603 +#define AccessMethodProcedureIndexId 2655 +#define AccessMethodProcedureOidIndexId 2757 + +#define Anum_pg_amproc_oid 1 +#define Anum_pg_amproc_amprocfamily 2 +#define Anum_pg_amproc_amproclefttype 3 +#define Anum_pg_amproc_amprocrighttype 4 +#define Anum_pg_amproc_amprocnum 5 +#define Anum_pg_amproc_amproc 6 + +#define Natts_pg_amproc 6 + +/* Definitions copied from pg_amproc.h */ + + +/* OID symbols for objects defined in pg_amproc.dat */ + + +#endif /* PG_AMPROC_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attrdef.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attrdef.h new file mode 100644 index 0000000..3067a83 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attrdef.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * pg_attrdef.h + * definition of the "attribute defaults" system catalog (pg_attrdef) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_attrdef.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRDEF_H +#define PG_ATTRDEF_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_attrdef_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_attrdef definition. cpp turns this into + * typedef struct FormData_pg_attrdef + * ---------------- + */ +CATALOG(pg_attrdef,2604,AttrDefaultRelationId) +{ + Oid oid; /* oid */ + + Oid adrelid BKI_LOOKUP(pg_class); /* OID of table containing + * attribute */ + int16 adnum; /* attnum of attribute */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + pg_node_tree adbin BKI_FORCE_NOT_NULL; /* nodeToString representation of + * default */ +#endif +} FormData_pg_attrdef; + +/* ---------------- + * Form_pg_attrdef corresponds to a pointer to a tuple with + * the format of pg_attrdef relation. + * ---------------- + */ +typedef FormData_pg_attrdef *Form_pg_attrdef; + +DECLARE_TOAST(pg_attrdef, 2830, 2831); + +DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, AttrDefaultIndexId, pg_attrdef, btree(adrelid oid_ops, adnum int2_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_attrdef_oid_index, 2657, AttrDefaultOidIndexId, pg_attrdef, btree(oid oid_ops)); + +DECLARE_FOREIGN_KEY((adrelid, adnum), pg_attribute, (attrelid, attnum)); + + +extern Oid StoreAttrDefault(Relation rel, AttrNumber attnum, + Node *expr, bool is_internal); +extern void RemoveAttrDefault(Oid relid, AttrNumber attnum, + DropBehavior behavior, + bool complain, bool internal); +extern void RemoveAttrDefaultById(Oid attrdefId); + +extern Oid GetAttrDefaultOid(Oid relid, AttrNumber attnum); +extern ObjectAddress GetAttrDefaultColumnAddress(Oid attrdefoid); + +#endif /* PG_ATTRDEF_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attrdef_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attrdef_d.h new file mode 100644 index 0000000..578a68d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attrdef_d.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * pg_attrdef_d.h + * Macro definitions for pg_attrdef + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRDEF_D_H +#define PG_ATTRDEF_D_H + +/* Macros related to the structure of pg_attrdef */ + +#define AttrDefaultRelationId 2604 +#define AttrDefaultIndexId 2656 +#define AttrDefaultOidIndexId 2657 + +#define Anum_pg_attrdef_oid 1 +#define Anum_pg_attrdef_adrelid 2 +#define Anum_pg_attrdef_adnum 3 +#define Anum_pg_attrdef_adbin 4 + +#define Natts_pg_attrdef 4 + +/* Definitions copied from pg_attrdef.h */ + + +/* OID symbols for objects defined in pg_attrdef.dat */ + + +#endif /* PG_ATTRDEF_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attribute.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attribute.h new file mode 100644 index 0000000..c612aed --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attribute.h @@ -0,0 +1,234 @@ +/*------------------------------------------------------------------------- + * + * pg_attribute.h + * definition of the "attribute" system catalog (pg_attribute) + * + * The initial contents of pg_attribute are generated at compile time by + * genbki.pl, so there is no pg_attribute.dat file. Only "bootstrapped" + * relations need be included. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_attribute.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRIBUTE_H +#define PG_ATTRIBUTE_H + +#include "catalog/genbki.h" +#include "catalog/pg_attribute_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_attribute definition. cpp turns this into + * typedef struct FormData_pg_attribute + * + * If you change the following, make sure you change the structs for + * system attributes in catalog/heap.c also. + * You may need to change catalog/genbki.pl as well. + * ---------------- + */ +CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75,AttributeRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid attrelid BKI_LOOKUP(pg_class); /* OID of relation containing + * this attribute */ + NameData attname; /* name of attribute */ + + /* + * atttypid is the OID of the instance in Catalog Class pg_type that + * defines the data type of this attribute (e.g. int4). Information in + * that instance is redundant with the attlen, attbyval, and attalign + * attributes of this instance, so they had better match or Postgres will + * fail. In an entry for a dropped column, this field is set to zero + * since the pg_type entry may no longer exist; but we rely on attlen, + * attbyval, and attalign to still tell us how large the values in the + * table are. + */ + Oid atttypid BKI_LOOKUP_OPT(pg_type); + + /* + * attlen is a copy of the typlen field from pg_type for this attribute. + * See atttypid comments above. + */ + int16 attlen; + + /* + * attnum is the "attribute number" for the attribute: A value that + * uniquely identifies this attribute within its class. For user + * attributes, Attribute numbers are greater than 0 and not greater than + * the number of attributes in the class. I.e. if the Class pg_class says + * that Class XYZ has 10 attributes, then the user attribute numbers in + * Class pg_attribute must be 1-10. + * + * System attributes have attribute numbers less than 0 that are unique + * within the class, but not constrained to any particular range. + * + * Note that (attnum - 1) is often used as the index to an array. + */ + int16 attnum; + + /* + * atttypmod records type-specific data supplied at table creation time + * (for example, the max length of a varchar field). It is passed to + * type-specific input and output functions as the third argument. The + * value will generally be -1 for types that do not need typmod. + */ + int32 atttypmod BKI_DEFAULT(-1); + + /* + * attndims is the declared number of dimensions, if an array type, + * otherwise zero. + */ + int16 attndims; + + /* + * attbyval is a copy of the typbyval field from pg_type for this + * attribute. See atttypid comments above. + */ + bool attbyval; + + /* + * attalign is a copy of the typalign field from pg_type for this + * attribute. See atttypid comments above. + */ + char attalign; + + /*---------- + * attstorage tells for VARLENA attributes, what the heap access + * methods can do to it if a given tuple doesn't fit into a page. + * Possible values are as for pg_type.typstorage (see TYPSTORAGE macros). + *---------- + */ + char attstorage; + + /* + * attcompression sets the current compression method of the attribute. + * Typically this is InvalidCompressionMethod ('\0') to specify use of the + * current default setting (see default_toast_compression). Otherwise, + * 'p' selects pglz compression, while 'l' selects LZ4 compression. + * However, this field is ignored whenever attstorage does not allow + * compression. + */ + char attcompression BKI_DEFAULT('\0'); + + /* + * Whether a (possibly invalid) not-null constraint exists for the column + */ + bool attnotnull; + + /* Has DEFAULT value or not */ + bool atthasdef BKI_DEFAULT(f); + + /* Has a missing value or not */ + bool atthasmissing BKI_DEFAULT(f); + + /* One of the ATTRIBUTE_IDENTITY_* constants below, or '\0' */ + char attidentity BKI_DEFAULT('\0'); + + /* One of the ATTRIBUTE_GENERATED_* constants below, or '\0' */ + char attgenerated BKI_DEFAULT('\0'); + + /* Is dropped (ie, logically invisible) or not */ + bool attisdropped BKI_DEFAULT(f); + + /* + * This flag specifies whether this column has ever had a local + * definition. It is set for normal non-inherited columns, but also for + * columns that are inherited from parents if also explicitly listed in + * CREATE TABLE INHERITS. It is also set when inheritance is removed from + * a table with ALTER TABLE NO INHERIT. If the flag is set, the column is + * not dropped by a parent's DROP COLUMN even if this causes the column's + * attinhcount to become zero. + */ + bool attislocal BKI_DEFAULT(t); + + /* Number of times inherited from direct parent relation(s) */ + int16 attinhcount BKI_DEFAULT(0); + + /* attribute's collation, if any */ + Oid attcollation BKI_LOOKUP_OPT(pg_collation); + +#ifdef CATALOG_VARLEN /* variable-length/nullable fields start here */ + /* NOTE: The following fields are not present in tuple descriptors. */ + + /* + * attstattarget is the target number of statistics datapoints to collect + * during VACUUM ANALYZE of this column. A zero here indicates that we do + * not wish to collect any stats about this column. A null value here + * indicates that no value has been explicitly set for this column, so + * ANALYZE should use the default setting. + * + * int16 is sufficient for the current max value (MAX_STATISTICS_TARGET). + */ + int16 attstattarget BKI_DEFAULT(_null_) BKI_FORCE_NULL; + + /* Column-level access permissions */ + aclitem attacl[1] BKI_DEFAULT(_null_); + + /* Column-level options */ + text attoptions[1] BKI_DEFAULT(_null_); + + /* Column-level FDW options */ + text attfdwoptions[1] BKI_DEFAULT(_null_); + + /* + * Missing value for added columns. This is a one element array which lets + * us store a value of the attribute type here. + */ + anyarray attmissingval BKI_DEFAULT(_null_); +#endif +} FormData_pg_attribute; + +/* + * ATTRIBUTE_FIXED_PART_SIZE is the size of the fixed-layout, + * guaranteed-not-null part of a pg_attribute row. This is in fact as much + * of the row as gets copied into tuple descriptors, so don't expect you + * can access the variable-length fields except in a real tuple! + */ +#define ATTRIBUTE_FIXED_PART_SIZE \ + (offsetof(FormData_pg_attribute,attcollation) + sizeof(Oid)) + +/* ---------------- + * Form_pg_attribute corresponds to a pointer to a tuple with + * the format of pg_attribute relation. + * ---------------- + */ +typedef FormData_pg_attribute *Form_pg_attribute; + +/* + * FormExtraData_pg_attribute contains (some of) the fields that are not in + * FormData_pg_attribute because they are excluded by CATALOG_VARLEN. It is + * meant to be used by DDL code so that the combination of + * FormData_pg_attribute (often via tuple descriptor) and + * FormExtraData_pg_attribute can be used to pass around all the information + * about an attribute. Fields can be included here as needed. + */ +typedef struct FormExtraData_pg_attribute +{ + NullableDatum attstattarget; + NullableDatum attoptions; +} FormExtraData_pg_attribute; + +DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index, 2658, AttributeRelidNameIndexId, pg_attribute, btree(attrelid oid_ops, attname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_attribute_relid_attnum_index, 2659, AttributeRelidNumIndexId, pg_attribute, btree(attrelid oid_ops, attnum int2_ops)); + +MAKE_SYSCACHE(ATTNAME, pg_attribute_relid_attnam_index, 32); +MAKE_SYSCACHE(ATTNUM, pg_attribute_relid_attnum_index, 128); + +#ifdef EXPOSE_TO_CLIENT_CODE + +#define ATTRIBUTE_IDENTITY_ALWAYS 'a' +#define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd' + +#define ATTRIBUTE_GENERATED_STORED 's' +#define ATTRIBUTE_GENERATED_VIRTUAL 'v' + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_ATTRIBUTE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attribute_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attribute_d.h new file mode 100644 index 0000000..639a017 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_attribute_d.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * pg_attribute_d.h + * Macro definitions for pg_attribute + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRIBUTE_D_H +#define PG_ATTRIBUTE_D_H + +/* Macros related to the structure of pg_attribute */ + +#define AttributeRelationId 1249 +#define AttributeRelation_Rowtype_Id 75 +#define AttributeRelidNameIndexId 2658 +#define AttributeRelidNumIndexId 2659 + +#define Anum_pg_attribute_attrelid 1 +#define Anum_pg_attribute_attname 2 +#define Anum_pg_attribute_atttypid 3 +#define Anum_pg_attribute_attlen 4 +#define Anum_pg_attribute_attnum 5 +#define Anum_pg_attribute_atttypmod 6 +#define Anum_pg_attribute_attndims 7 +#define Anum_pg_attribute_attbyval 8 +#define Anum_pg_attribute_attalign 9 +#define Anum_pg_attribute_attstorage 10 +#define Anum_pg_attribute_attcompression 11 +#define Anum_pg_attribute_attnotnull 12 +#define Anum_pg_attribute_atthasdef 13 +#define Anum_pg_attribute_atthasmissing 14 +#define Anum_pg_attribute_attidentity 15 +#define Anum_pg_attribute_attgenerated 16 +#define Anum_pg_attribute_attisdropped 17 +#define Anum_pg_attribute_attislocal 18 +#define Anum_pg_attribute_attinhcount 19 +#define Anum_pg_attribute_attcollation 20 +#define Anum_pg_attribute_attstattarget 21 +#define Anum_pg_attribute_attacl 22 +#define Anum_pg_attribute_attoptions 23 +#define Anum_pg_attribute_attfdwoptions 24 +#define Anum_pg_attribute_attmissingval 25 + +#define Natts_pg_attribute 25 + +/* Definitions copied from pg_attribute.h */ + + +#define ATTRIBUTE_IDENTITY_ALWAYS 'a' +#define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd' + +#define ATTRIBUTE_GENERATED_STORED 's' +#define ATTRIBUTE_GENERATED_VIRTUAL 'v' + + +/* OID symbols for objects defined in pg_attribute.dat */ + + +#endif /* PG_ATTRIBUTE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_auth_members.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_auth_members.h new file mode 100644 index 0000000..387316e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_auth_members.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * pg_auth_members.h + * definition of the "authorization identifier members" system catalog + * (pg_auth_members). + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_auth_members.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTH_MEMBERS_H +#define PG_AUTH_MEMBERS_H + +#include "catalog/genbki.h" +#include "catalog/pg_auth_members_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_auth_members definition. cpp turns this into + * typedef struct FormData_pg_auth_members + * ---------------- + */ +CATALOG(pg_auth_members,1261,AuthMemRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2843,AuthMemRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + Oid roleid BKI_LOOKUP(pg_authid); /* ID of a role */ + Oid member BKI_LOOKUP(pg_authid); /* ID of a member of that role */ + Oid grantor BKI_LOOKUP(pg_authid); /* who granted the membership */ + bool admin_option; /* granted with admin option? */ + bool inherit_option; /* exercise privileges without SET ROLE? */ + bool set_option; /* use SET ROLE to the target role? */ +} FormData_pg_auth_members; + +/* ---------------- + * Form_pg_auth_members corresponds to a pointer to a tuple with + * the format of pg_auth_members relation. + * ---------------- + */ +typedef FormData_pg_auth_members *Form_pg_auth_members; + +DECLARE_UNIQUE_INDEX_PKEY(pg_auth_members_oid_index, 6303, AuthMemOidIndexId, pg_auth_members, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_auth_members_role_member_index, 2694, AuthMemRoleMemIndexId, pg_auth_members, btree(roleid oid_ops, member oid_ops, grantor oid_ops)); +DECLARE_UNIQUE_INDEX(pg_auth_members_member_role_index, 2695, AuthMemMemRoleIndexId, pg_auth_members, btree(member oid_ops, roleid oid_ops, grantor oid_ops)); +DECLARE_INDEX(pg_auth_members_grantor_index, 6302, AuthMemGrantorIndexId, pg_auth_members, btree(grantor oid_ops)); + +MAKE_SYSCACHE(AUTHMEMROLEMEM, pg_auth_members_role_member_index, 8); +MAKE_SYSCACHE(AUTHMEMMEMROLE, pg_auth_members_member_role_index, 8); + +#endif /* PG_AUTH_MEMBERS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_auth_members_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_auth_members_d.h new file mode 100644 index 0000000..d43a38a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_auth_members_d.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- + * + * pg_auth_members_d.h + * Macro definitions for pg_auth_members + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTH_MEMBERS_D_H +#define PG_AUTH_MEMBERS_D_H + +/* Macros related to the structure of pg_auth_members */ + +#define AuthMemRelationId 1261 +#define AuthMemRelation_Rowtype_Id 2843 +#define AuthMemOidIndexId 6303 +#define AuthMemRoleMemIndexId 2694 +#define AuthMemMemRoleIndexId 2695 +#define AuthMemGrantorIndexId 6302 + +#define Anum_pg_auth_members_oid 1 +#define Anum_pg_auth_members_roleid 2 +#define Anum_pg_auth_members_member 3 +#define Anum_pg_auth_members_grantor 4 +#define Anum_pg_auth_members_admin_option 5 +#define Anum_pg_auth_members_inherit_option 6 +#define Anum_pg_auth_members_set_option 7 + +#define Natts_pg_auth_members 7 + +/* Definitions copied from pg_auth_members.h */ + + +/* OID symbols for objects defined in pg_auth_members.dat */ + + +#endif /* PG_AUTH_MEMBERS_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_authid.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_authid.h new file mode 100644 index 0000000..b2f3e9d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_authid.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * pg_authid.h + * definition of the "authorization identifier" system catalog (pg_authid) + * + * pg_shadow and pg_group are now views on pg_authid. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_authid.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTHID_H +#define PG_AUTHID_H + +#include "catalog/genbki.h" +#include "catalog/pg_authid_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_authid definition. cpp turns this into + * typedef struct FormData_pg_authid + * ---------------- + */ +CATALOG(pg_authid,1260,AuthIdRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842,AuthIdRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + NameData rolname; /* name of role */ + bool rolsuper; /* read this field via superuser() only! */ + bool rolinherit; /* inherit privileges from other roles? */ + bool rolcreaterole; /* allowed to create more roles? */ + bool rolcreatedb; /* allowed to create databases? */ + bool rolcanlogin; /* allowed to log in as session user? */ + bool rolreplication; /* role used for streaming replication */ + bool rolbypassrls; /* bypasses row-level security? */ + int32 rolconnlimit; /* max connections allowed (-1=no limit) */ + + /* remaining fields may be null; use heap_getattr to read them! */ +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text rolpassword; /* password, if any */ + timestamptz rolvaliduntil; /* password expiration time, if any */ +#endif +} FormData_pg_authid; + +/* ---------------- + * Form_pg_authid corresponds to a pointer to a tuple with + * the format of pg_authid relation. + * ---------------- + */ +typedef FormData_pg_authid *Form_pg_authid; + +DECLARE_UNIQUE_INDEX(pg_authid_rolname_index, 2676, AuthIdRolnameIndexId, pg_authid, btree(rolname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_authid_oid_index, 2677, AuthIdOidIndexId, pg_authid, btree(oid oid_ops)); + +MAKE_SYSCACHE(AUTHNAME, pg_authid_rolname_index, 8); +MAKE_SYSCACHE(AUTHOID, pg_authid_oid_index, 8); + +#endif /* PG_AUTHID_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_authid_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_authid_d.h new file mode 100644 index 0000000..d287d11 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_authid_d.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * + * pg_authid_d.h + * Macro definitions for pg_authid + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTHID_D_H +#define PG_AUTHID_D_H + +/* Macros related to the structure of pg_authid */ + +#define AuthIdRelationId 1260 +#define AuthIdRelation_Rowtype_Id 2842 +#define AuthIdRolnameIndexId 2676 +#define AuthIdOidIndexId 2677 + +#define Anum_pg_authid_oid 1 +#define Anum_pg_authid_rolname 2 +#define Anum_pg_authid_rolsuper 3 +#define Anum_pg_authid_rolinherit 4 +#define Anum_pg_authid_rolcreaterole 5 +#define Anum_pg_authid_rolcreatedb 6 +#define Anum_pg_authid_rolcanlogin 7 +#define Anum_pg_authid_rolreplication 8 +#define Anum_pg_authid_rolbypassrls 9 +#define Anum_pg_authid_rolconnlimit 10 +#define Anum_pg_authid_rolpassword 11 +#define Anum_pg_authid_rolvaliduntil 12 + +#define Natts_pg_authid 12 + +/* Definitions copied from pg_authid.h */ + + +/* OID symbols for objects defined in pg_authid.dat */ + +#define BOOTSTRAP_SUPERUSERID 10 +#define ROLE_PG_DATABASE_OWNER 6171 +#define ROLE_PG_READ_ALL_DATA 6181 +#define ROLE_PG_WRITE_ALL_DATA 6182 +#define ROLE_PG_MONITOR 3373 +#define ROLE_PG_READ_ALL_SETTINGS 3374 +#define ROLE_PG_READ_ALL_STATS 3375 +#define ROLE_PG_STAT_SCAN_TABLES 3377 +#define ROLE_PG_READ_SERVER_FILES 4569 +#define ROLE_PG_WRITE_SERVER_FILES 4570 +#define ROLE_PG_EXECUTE_SERVER_PROGRAM 4571 +#define ROLE_PG_SIGNAL_BACKEND 4200 +#define ROLE_PG_CHECKPOINT 4544 +#define ROLE_PG_MAINTAIN 6337 +#define ROLE_PG_USE_RESERVED_CONNECTIONS 4550 +#define ROLE_PG_CREATE_SUBSCRIPTION 6304 +#define ROLE_PG_SIGNAL_AUTOVACUUM_WORKER 6392 + +#endif /* PG_AUTHID_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_cast.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_cast.h new file mode 100644 index 0000000..6a0ca33 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_cast.h @@ -0,0 +1,106 @@ +/*------------------------------------------------------------------------- + * + * pg_cast.h + * definition of the "type casts" system catalog (pg_cast) + * + * As of Postgres 8.0, pg_cast describes not only type coercion functions + * but also length coercion functions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_cast.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CAST_H +#define PG_CAST_H + +#include "catalog/dependency.h" +#include "catalog/genbki.h" +#include "catalog/pg_cast_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_cast definition. cpp turns this into + * typedef struct FormData_pg_cast + * ---------------- + */ +CATALOG(pg_cast,2605,CastRelationId) +{ + Oid oid; /* oid */ + + /* source datatype for cast */ + Oid castsource BKI_LOOKUP(pg_type); + + /* destination datatype for cast */ + Oid casttarget BKI_LOOKUP(pg_type); + + /* cast function; 0 = binary coercible */ + Oid castfunc BKI_LOOKUP_OPT(pg_proc); + + /* contexts in which cast can be used */ + char castcontext; + + /* cast method */ + char castmethod; +} FormData_pg_cast; + +/* ---------------- + * Form_pg_cast corresponds to a pointer to a tuple with + * the format of pg_cast relation. + * ---------------- + */ +typedef FormData_pg_cast *Form_pg_cast; + +DECLARE_UNIQUE_INDEX_PKEY(pg_cast_oid_index, 2660, CastOidIndexId, pg_cast, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_cast_source_target_index, 2661, CastSourceTargetIndexId, pg_cast, btree(castsource oid_ops, casttarget oid_ops)); + +MAKE_SYSCACHE(CASTSOURCETARGET, pg_cast_source_target_index, 256); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * The allowable values for pg_cast.castcontext are specified by this enum. + * Since castcontext is stored as a "char", we use ASCII codes for human + * convenience in reading the table. Note that internally to the backend, + * these values are converted to the CoercionContext enum (see primnodes.h), + * which is defined to sort in a convenient order; the ASCII codes don't + * have to sort in any special order. + */ + +typedef enum CoercionCodes +{ + COERCION_CODE_IMPLICIT = 'i', /* coercion in context of expression */ + COERCION_CODE_ASSIGNMENT = 'a', /* coercion in context of assignment */ + COERCION_CODE_EXPLICIT = 'e', /* explicit cast operation */ +} CoercionCodes; + +/* + * The allowable values for pg_cast.castmethod are specified by this enum. + * Since castmethod is stored as a "char", we use ASCII codes for human + * convenience in reading the table. + */ +typedef enum CoercionMethod +{ + COERCION_METHOD_FUNCTION = 'f', /* use a function */ + COERCION_METHOD_BINARY = 'b', /* types are binary-compatible */ + COERCION_METHOD_INOUT = 'i', /* use input/output functions */ +} CoercionMethod; + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern ObjectAddress CastCreate(Oid sourcetypeid, + Oid targettypeid, + Oid funcid, + Oid incastid, + Oid outcastid, + char castcontext, + char castmethod, + DependencyType behavior); + +#endif /* PG_CAST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_cast_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_cast_d.h new file mode 100644 index 0000000..8920c3c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_cast_d.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------------------- + * + * pg_cast_d.h + * Macro definitions for pg_cast + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CAST_D_H +#define PG_CAST_D_H + +/* Macros related to the structure of pg_cast */ + +#define CastRelationId 2605 +#define CastOidIndexId 2660 +#define CastSourceTargetIndexId 2661 + +#define Anum_pg_cast_oid 1 +#define Anum_pg_cast_castsource 2 +#define Anum_pg_cast_casttarget 3 +#define Anum_pg_cast_castfunc 4 +#define Anum_pg_cast_castcontext 5 +#define Anum_pg_cast_castmethod 6 + +#define Natts_pg_cast 6 + +/* Definitions copied from pg_cast.h */ + + +/* + * The allowable values for pg_cast.castcontext are specified by this enum. + * Since castcontext is stored as a "char", we use ASCII codes for human + * convenience in reading the table. Note that internally to the backend, + * these values are converted to the CoercionContext enum (see primnodes.h), + * which is defined to sort in a convenient order; the ASCII codes don't + * have to sort in any special order. + */ + +typedef enum CoercionCodes +{ + COERCION_CODE_IMPLICIT = 'i', /* coercion in context of expression */ + COERCION_CODE_ASSIGNMENT = 'a', /* coercion in context of assignment */ + COERCION_CODE_EXPLICIT = 'e', /* explicit cast operation */ +} CoercionCodes; + +/* + * The allowable values for pg_cast.castmethod are specified by this enum. + * Since castmethod is stored as a "char", we use ASCII codes for human + * convenience in reading the table. + */ +typedef enum CoercionMethod +{ + COERCION_METHOD_FUNCTION = 'f', /* use a function */ + COERCION_METHOD_BINARY = 'b', /* types are binary-compatible */ + COERCION_METHOD_INOUT = 'i', /* use input/output functions */ +} CoercionMethod; + + +/* OID symbols for objects defined in pg_cast.dat */ + + +#endif /* PG_CAST_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_class.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_class.h new file mode 100644 index 0000000..07d182d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_class.h @@ -0,0 +1,238 @@ +/*------------------------------------------------------------------------- + * + * pg_class.h + * definition of the "relation" system catalog (pg_class) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_class.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CLASS_H +#define PG_CLASS_H + +#include "catalog/genbki.h" +#include "catalog/pg_class_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_class definition. cpp turns this into + * typedef struct FormData_pg_class + * + * Note that the BKI_DEFAULT values below are only used for rows describing + * BKI_BOOTSTRAP catalogs, since only those rows appear in pg_class.dat. + * ---------------- + */ +CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,RelationRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + /* oid */ + Oid oid; + + /* class name */ + NameData relname; + + /* OID of namespace containing this class */ + Oid relnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* OID of entry in pg_type for relation's implicit row type, if any */ + Oid reltype BKI_LOOKUP_OPT(pg_type); + + /* OID of entry in pg_type for underlying composite type, if any */ + Oid reloftype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* class owner */ + Oid relowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* access method; 0 if not a table / index */ + Oid relam BKI_DEFAULT(heap) BKI_LOOKUP_OPT(pg_am); + + /* identifier of physical storage file */ + /* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */ + Oid relfilenode BKI_DEFAULT(0); + + /* identifier of table space for relation (0 means default for database) */ + Oid reltablespace BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_tablespace); + + /* # of blocks (not always up-to-date) */ + int32 relpages BKI_DEFAULT(0); + + /* # of tuples (not always up-to-date; -1 means "unknown") */ + float4 reltuples BKI_DEFAULT(-1); + + /* # of all-visible blocks (not always up-to-date) */ + int32 relallvisible BKI_DEFAULT(0); + + /* # of all-frozen blocks (not always up-to-date) */ + int32 relallfrozen BKI_DEFAULT(0); + + /* OID of toast table; 0 if none */ + Oid reltoastrelid BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_class); + + /* T if has (or has had) any indexes */ + bool relhasindex BKI_DEFAULT(f); + + /* T if shared across databases */ + bool relisshared BKI_DEFAULT(f); + + /* see RELPERSISTENCE_xxx constants below */ + char relpersistence BKI_DEFAULT(p); + + /* see RELKIND_xxx constants below */ + char relkind BKI_DEFAULT(r); + + /* number of user attributes */ + int16 relnatts BKI_DEFAULT(0); /* genbki.pl will fill this in */ + + /* + * Class pg_attribute must contain exactly "relnatts" user attributes + * (with attnums ranging from 1 to relnatts) for this class. It may also + * contain entries with negative attnums for system attributes. + */ + + /* # of CHECK constraints for class */ + int16 relchecks BKI_DEFAULT(0); + + /* has (or has had) any rules */ + bool relhasrules BKI_DEFAULT(f); + + /* has (or has had) any TRIGGERs */ + bool relhastriggers BKI_DEFAULT(f); + + /* has (or has had) child tables or indexes */ + bool relhassubclass BKI_DEFAULT(f); + + /* row security is enabled or not */ + bool relrowsecurity BKI_DEFAULT(f); + + /* row security forced for owners or not */ + bool relforcerowsecurity BKI_DEFAULT(f); + + /* matview currently holds query results */ + bool relispopulated BKI_DEFAULT(t); + + /* see REPLICA_IDENTITY_xxx constants */ + char relreplident BKI_DEFAULT(n); + + /* is relation a partition? */ + bool relispartition BKI_DEFAULT(f); + + /* link to original rel during table rewrite; otherwise 0 */ + Oid relrewrite BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_class); + + /* all Xids < this are frozen in this rel */ + TransactionId relfrozenxid BKI_DEFAULT(3); /* FirstNormalTransactionId */ + + /* all multixacts in this rel are >= this; it is really a MultiXactId */ + TransactionId relminmxid BKI_DEFAULT(1); /* FirstMultiXactId */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* NOTE: These fields are not present in a relcache entry's rd_rel field. */ + /* access permissions */ + aclitem relacl[1] BKI_DEFAULT(_null_); + + /* access-method-specific options */ + text reloptions[1] BKI_DEFAULT(_null_); + + /* partition bound node tree */ + pg_node_tree relpartbound BKI_DEFAULT(_null_); +#endif +} FormData_pg_class; + +/* Size of fixed part of pg_class tuples, not counting var-length fields */ +#define CLASS_TUPLE_SIZE \ + (offsetof(FormData_pg_class,relminmxid) + sizeof(TransactionId)) + +/* ---------------- + * Form_pg_class corresponds to a pointer to a tuple with + * the format of pg_class relation. + * ---------------- + */ +typedef FormData_pg_class *Form_pg_class; + +DECLARE_UNIQUE_INDEX_PKEY(pg_class_oid_index, 2662, ClassOidIndexId, pg_class, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index, 2663, ClassNameNspIndexId, pg_class, btree(relname name_ops, relnamespace oid_ops)); +DECLARE_INDEX(pg_class_tblspc_relfilenode_index, 3455, ClassTblspcRelfilenodeIndexId, pg_class, btree(reltablespace oid_ops, relfilenode oid_ops)); + +MAKE_SYSCACHE(RELOID, pg_class_oid_index, 128); +MAKE_SYSCACHE(RELNAMENSP, pg_class_relname_nsp_index, 128); + +#ifdef EXPOSE_TO_CLIENT_CODE + +#define RELKIND_RELATION 'r' /* ordinary table */ +#define RELKIND_INDEX 'i' /* secondary index */ +#define RELKIND_SEQUENCE 'S' /* sequence object */ +#define RELKIND_TOASTVALUE 't' /* for out-of-line values */ +#define RELKIND_VIEW 'v' /* view */ +#define RELKIND_MATVIEW 'm' /* materialized view */ +#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ +#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ +#define RELKIND_PARTITIONED_TABLE 'p' /* partitioned table */ +#define RELKIND_PARTITIONED_INDEX 'I' /* partitioned index */ + +#define RELPERSISTENCE_PERMANENT 'p' /* regular table */ +#define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */ +#define RELPERSISTENCE_TEMP 't' /* temporary table */ + +/* default selection for replica identity (primary key or nothing) */ +#define REPLICA_IDENTITY_DEFAULT 'd' +/* no replica identity is logged for this relation */ +#define REPLICA_IDENTITY_NOTHING 'n' +/* all columns are logged as replica identity */ +#define REPLICA_IDENTITY_FULL 'f' +/* + * an explicitly chosen candidate key's columns are used as replica identity. + * Note this will still be set if the index has been dropped; in that case it + * has the same meaning as 'n'. + */ +#define REPLICA_IDENTITY_INDEX 'i' + +/* + * Relation kinds that have physical storage. These relations normally have + * relfilenode set to non-zero, but it can also be zero if the relation is + * mapped. + */ +#define RELKIND_HAS_STORAGE(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_INDEX || \ + (relkind) == RELKIND_SEQUENCE || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) + +#define RELKIND_HAS_PARTITIONS(relkind) \ + ((relkind) == RELKIND_PARTITIONED_TABLE || \ + (relkind) == RELKIND_PARTITIONED_INDEX) + +/* + * Relation kinds that support tablespaces: All relation kinds with storage + * support tablespaces, except that we don't support moving sequences around + * into different tablespaces. Partitioned tables and indexes don't have + * physical storage, but they have a tablespace settings so that their + * children can inherit it. + */ +#define RELKIND_HAS_TABLESPACE(relkind) \ + ((RELKIND_HAS_STORAGE(relkind) || RELKIND_HAS_PARTITIONS(relkind)) \ + && (relkind) != RELKIND_SEQUENCE) + +/* + * Relation kinds with a table access method (rd_tableam). Although sequences + * use the heap table AM, they are enough of a special case in most uses that + * they are not included here. Likewise, partitioned tables can have an access + * method defined so that their partitions can inherit it, but they do not set + * rd_tableam; hence, this is handled specially outside of this macro. + */ +#define RELKIND_HAS_TABLE_AM(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +extern int errdetail_relkind_not_supported(char relkind); + +#endif /* PG_CLASS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_class_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_class_d.h new file mode 100644 index 0000000..c9f3515 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_class_d.h @@ -0,0 +1,140 @@ +/*------------------------------------------------------------------------- + * + * pg_class_d.h + * Macro definitions for pg_class + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CLASS_D_H +#define PG_CLASS_D_H + +/* Macros related to the structure of pg_class */ + +#define RelationRelationId 1259 +#define RelationRelation_Rowtype_Id 83 +#define ClassOidIndexId 2662 +#define ClassNameNspIndexId 2663 +#define ClassTblspcRelfilenodeIndexId 3455 + +#define Anum_pg_class_oid 1 +#define Anum_pg_class_relname 2 +#define Anum_pg_class_relnamespace 3 +#define Anum_pg_class_reltype 4 +#define Anum_pg_class_reloftype 5 +#define Anum_pg_class_relowner 6 +#define Anum_pg_class_relam 7 +#define Anum_pg_class_relfilenode 8 +#define Anum_pg_class_reltablespace 9 +#define Anum_pg_class_relpages 10 +#define Anum_pg_class_reltuples 11 +#define Anum_pg_class_relallvisible 12 +#define Anum_pg_class_relallfrozen 13 +#define Anum_pg_class_reltoastrelid 14 +#define Anum_pg_class_relhasindex 15 +#define Anum_pg_class_relisshared 16 +#define Anum_pg_class_relpersistence 17 +#define Anum_pg_class_relkind 18 +#define Anum_pg_class_relnatts 19 +#define Anum_pg_class_relchecks 20 +#define Anum_pg_class_relhasrules 21 +#define Anum_pg_class_relhastriggers 22 +#define Anum_pg_class_relhassubclass 23 +#define Anum_pg_class_relrowsecurity 24 +#define Anum_pg_class_relforcerowsecurity 25 +#define Anum_pg_class_relispopulated 26 +#define Anum_pg_class_relreplident 27 +#define Anum_pg_class_relispartition 28 +#define Anum_pg_class_relrewrite 29 +#define Anum_pg_class_relfrozenxid 30 +#define Anum_pg_class_relminmxid 31 +#define Anum_pg_class_relacl 32 +#define Anum_pg_class_reloptions 33 +#define Anum_pg_class_relpartbound 34 + +#define Natts_pg_class 34 + +/* Definitions copied from pg_class.h */ + + +#define RELKIND_RELATION 'r' /* ordinary table */ +#define RELKIND_INDEX 'i' /* secondary index */ +#define RELKIND_SEQUENCE 'S' /* sequence object */ +#define RELKIND_TOASTVALUE 't' /* for out-of-line values */ +#define RELKIND_VIEW 'v' /* view */ +#define RELKIND_MATVIEW 'm' /* materialized view */ +#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ +#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ +#define RELKIND_PARTITIONED_TABLE 'p' /* partitioned table */ +#define RELKIND_PARTITIONED_INDEX 'I' /* partitioned index */ + +#define RELPERSISTENCE_PERMANENT 'p' /* regular table */ +#define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */ +#define RELPERSISTENCE_TEMP 't' /* temporary table */ + +/* default selection for replica identity (primary key or nothing) */ +#define REPLICA_IDENTITY_DEFAULT 'd' +/* no replica identity is logged for this relation */ +#define REPLICA_IDENTITY_NOTHING 'n' +/* all columns are logged as replica identity */ +#define REPLICA_IDENTITY_FULL 'f' +/* + * an explicitly chosen candidate key's columns are used as replica identity. + * Note this will still be set if the index has been dropped; in that case it + * has the same meaning as 'n'. + */ +#define REPLICA_IDENTITY_INDEX 'i' + +/* + * Relation kinds that have physical storage. These relations normally have + * relfilenode set to non-zero, but it can also be zero if the relation is + * mapped. + */ +#define RELKIND_HAS_STORAGE(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_INDEX || \ + (relkind) == RELKIND_SEQUENCE || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) + +#define RELKIND_HAS_PARTITIONS(relkind) \ + ((relkind) == RELKIND_PARTITIONED_TABLE || \ + (relkind) == RELKIND_PARTITIONED_INDEX) + +/* + * Relation kinds that support tablespaces: All relation kinds with storage + * support tablespaces, except that we don't support moving sequences around + * into different tablespaces. Partitioned tables and indexes don't have + * physical storage, but they have a tablespace settings so that their + * children can inherit it. + */ +#define RELKIND_HAS_TABLESPACE(relkind) \ + ((RELKIND_HAS_STORAGE(relkind) || RELKIND_HAS_PARTITIONS(relkind)) \ + && (relkind) != RELKIND_SEQUENCE) + +/* + * Relation kinds with a table access method (rd_tableam). Although sequences + * use the heap table AM, they are enough of a special case in most uses that + * they are not included here. Likewise, partitioned tables can have an access + * method defined so that their partitions can inherit it, but they do not set + * rd_tableam; hence, this is handled specially outside of this macro. + */ +#define RELKIND_HAS_TABLE_AM(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) + + +/* OID symbols for objects defined in pg_class.dat */ + + +#endif /* PG_CLASS_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_collation.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_collation.h new file mode 100644 index 0000000..7c5d5b1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_collation.h @@ -0,0 +1,106 @@ +/*------------------------------------------------------------------------- + * + * pg_collation.h + * definition of the "collation" system catalog (pg_collation) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_collation.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_COLLATION_H +#define PG_COLLATION_H + +#include "catalog/genbki.h" +#include "catalog/pg_collation_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_collation definition. cpp turns this into + * typedef struct FormData_pg_collation + * ---------------- + */ +CATALOG(pg_collation,3456,CollationRelationId) +{ + Oid oid; /* oid */ + NameData collname; /* collation name */ + + /* OID of namespace containing this collation */ + Oid collnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* owner of collation */ + Oid collowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + char collprovider; /* see constants below */ + bool collisdeterministic BKI_DEFAULT(t); + int32 collencoding; /* encoding for this collation; -1 = "all" */ +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text collcollate BKI_DEFAULT(_null_); /* LC_COLLATE setting */ + text collctype BKI_DEFAULT(_null_); /* LC_CTYPE setting */ + text colllocale BKI_DEFAULT(_null_); /* locale ID */ + text collicurules BKI_DEFAULT(_null_); /* ICU collation rules */ + text collversion BKI_DEFAULT(_null_); /* provider-dependent + * version of collation + * data */ +#endif +} FormData_pg_collation; + +/* ---------------- + * Form_pg_collation corresponds to a pointer to a row with + * the format of pg_collation relation. + * ---------------- + */ +typedef FormData_pg_collation *Form_pg_collation; + +DECLARE_TOAST(pg_collation, 6175, 6176); + +DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, CollationNameEncNspIndexId, pg_collation, btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_collation_oid_index, 3085, CollationOidIndexId, pg_collation, btree(oid oid_ops)); + +MAKE_SYSCACHE(COLLNAMEENCNSP, pg_collation_name_enc_nsp_index, 8); +MAKE_SYSCACHE(COLLOID, pg_collation_oid_index, 8); + +#ifdef EXPOSE_TO_CLIENT_CODE + +#define COLLPROVIDER_DEFAULT 'd' +#define COLLPROVIDER_BUILTIN 'b' +#define COLLPROVIDER_ICU 'i' +#define COLLPROVIDER_LIBC 'c' + +static inline const char * +collprovider_name(char c) +{ + switch (c) + { + case COLLPROVIDER_BUILTIN: + return "builtin"; + case COLLPROVIDER_ICU: + return "icu"; + case COLLPROVIDER_LIBC: + return "libc"; + default: + return "???"; + } +} + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern Oid CollationCreate(const char *collname, Oid collnamespace, + Oid collowner, + char collprovider, + bool collisdeterministic, + int32 collencoding, + const char *collcollate, const char *collctype, + const char *colllocale, + const char *collicurules, + const char *collversion, + bool if_not_exists, + bool quiet); + +#endif /* PG_COLLATION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_collation_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_collation_d.h new file mode 100644 index 0000000..11e423f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_collation_d.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------------------- + * + * pg_collation_d.h + * Macro definitions for pg_collation + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_COLLATION_D_H +#define PG_COLLATION_D_H + +/* Macros related to the structure of pg_collation */ + +#define CollationRelationId 3456 +#define CollationNameEncNspIndexId 3164 +#define CollationOidIndexId 3085 + +#define Anum_pg_collation_oid 1 +#define Anum_pg_collation_collname 2 +#define Anum_pg_collation_collnamespace 3 +#define Anum_pg_collation_collowner 4 +#define Anum_pg_collation_collprovider 5 +#define Anum_pg_collation_collisdeterministic 6 +#define Anum_pg_collation_collencoding 7 +#define Anum_pg_collation_collcollate 8 +#define Anum_pg_collation_collctype 9 +#define Anum_pg_collation_colllocale 10 +#define Anum_pg_collation_collicurules 11 +#define Anum_pg_collation_collversion 12 + +#define Natts_pg_collation 12 + +/* Definitions copied from pg_collation.h */ + + +#define COLLPROVIDER_DEFAULT 'd' +#define COLLPROVIDER_BUILTIN 'b' +#define COLLPROVIDER_ICU 'i' +#define COLLPROVIDER_LIBC 'c' + +static inline const char * +collprovider_name(char c) +{ + switch (c) + { + case COLLPROVIDER_BUILTIN: + return "builtin"; + case COLLPROVIDER_ICU: + return "icu"; + case COLLPROVIDER_LIBC: + return "libc"; + default: + return "???"; + } +} + + +/* OID symbols for objects defined in pg_collation.dat */ + +#define DEFAULT_COLLATION_OID 100 +#define C_COLLATION_OID 950 + +#endif /* PG_COLLATION_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_constraint.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_constraint.h new file mode 100644 index 0000000..3a03b8d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_constraint.h @@ -0,0 +1,301 @@ +/*------------------------------------------------------------------------- + * + * pg_constraint.h + * definition of the "constraint" system catalog (pg_constraint) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_constraint.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONSTRAINT_H +#define PG_CONSTRAINT_H + +#include "catalog/dependency.h" +#include "catalog/genbki.h" +#include "catalog/pg_constraint_d.h" /* IWYU pragma: export */ +#include "nodes/pg_list.h" + +/* ---------------- + * pg_constraint definition. cpp turns this into + * typedef struct FormData_pg_constraint + * ---------------- + */ +CATALOG(pg_constraint,2606,ConstraintRelationId) +{ + Oid oid; /* oid */ + + /* + * conname + connamespace is deliberately not unique; we allow, for + * example, the same name to be used for constraints of different + * relations. This is partly for backwards compatibility with past + * Postgres practice, and partly because we don't want to have to obtain a + * global lock to generate a globally unique name for a nameless + * constraint. We associate a namespace with constraint names only for + * SQL-spec compatibility. + * + * However, we do require conname to be unique among the constraints of a + * single relation or domain. This is enforced by a unique index on + * conrelid + contypid + conname. + */ + NameData conname; /* name of this constraint */ + Oid connamespace BKI_LOOKUP(pg_namespace); /* OID of namespace + * containing constraint */ + char contype; /* constraint type; see codes below */ + bool condeferrable; /* deferrable constraint? */ + bool condeferred; /* deferred by default? */ + bool conenforced; /* enforced constraint? */ + bool convalidated; /* constraint has been validated? */ + + /* + * conrelid and conkey are only meaningful if the constraint applies to a + * specific relation (this excludes domain constraints and assertions). + * Otherwise conrelid is 0 and conkey is NULL. + */ + Oid conrelid BKI_LOOKUP_OPT(pg_class); /* relation this + * constraint constrains */ + + /* + * contypid links to the pg_type row for a domain if this is a domain + * constraint. Otherwise it's 0. + * + * For SQL-style global ASSERTIONs, both conrelid and contypid would be + * zero. This is not presently supported, however. + */ + Oid contypid BKI_LOOKUP_OPT(pg_type); /* domain this constraint + * constrains */ + + /* + * conindid links to the index supporting the constraint, if any; + * otherwise it's 0. This is used for unique, primary-key, and exclusion + * constraints, and less obviously for foreign-key constraints (where the + * index is a unique index on the referenced relation's referenced + * columns). Notice that the index is on conrelid in the first case but + * confrelid in the second. + */ + Oid conindid BKI_LOOKUP_OPT(pg_class); /* index supporting this + * constraint */ + + /* + * If this constraint is on a partition inherited from a partitioned + * table, this is the OID of the corresponding constraint in the parent. + */ + Oid conparentid BKI_LOOKUP_OPT(pg_constraint); + + /* + * These fields, plus confkey, are only meaningful for a foreign-key + * constraint. Otherwise confrelid is 0 and the char fields are spaces. + */ + Oid confrelid BKI_LOOKUP_OPT(pg_class); /* relation referenced by + * foreign key */ + char confupdtype; /* foreign key's ON UPDATE action */ + char confdeltype; /* foreign key's ON DELETE action */ + char confmatchtype; /* foreign key's match type */ + + /* Has a local definition (hence, do not drop when coninhcount is 0) */ + bool conislocal; + + /* Number of times inherited from direct parent relation(s) */ + int16 coninhcount; + + /* Has a local definition and cannot be inherited */ + bool connoinherit; + + /* + * For primary keys, unique constraints, and foreign keys, signifies the + * last column uses overlaps instead of equals. + */ + bool conperiod; + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + /* + * Columns of conrelid that the constraint applies to, if known (this is + * NULL for trigger constraints) + */ + int16 conkey[1]; + + /* + * If a foreign key, the referenced columns of confrelid + */ + int16 confkey[1]; + + /* + * If a foreign key, the OIDs of the PK = FK equality/overlap operators + * for each column of the constraint + */ + Oid conpfeqop[1] BKI_LOOKUP(pg_operator); + + /* + * If a foreign key, the OIDs of the PK = PK equality/overlap operators + * for each column of the constraint (i.e., equality for the referenced + * columns) + */ + Oid conppeqop[1] BKI_LOOKUP(pg_operator); + + /* + * If a foreign key, the OIDs of the FK = FK equality/overlap operators + * for each column of the constraint (i.e., equality for the referencing + * columns) + */ + Oid conffeqop[1] BKI_LOOKUP(pg_operator); + + /* + * If a foreign key with an ON DELETE SET NULL/DEFAULT action, the subset + * of conkey to updated. If null, all columns are updated. + */ + int16 confdelsetcols[1]; + + /* + * If an exclusion constraint, the OIDs of the exclusion operators for + * each column of the constraint. Also set for unique constraints/primary + * keys using WITHOUT OVERLAPS. + */ + Oid conexclop[1] BKI_LOOKUP(pg_operator); + + /* + * If a check constraint, nodeToString representation of expression + */ + pg_node_tree conbin; +#endif +} FormData_pg_constraint; + +/* ---------------- + * Form_pg_constraint corresponds to a pointer to a tuple with + * the format of pg_constraint relation. + * ---------------- + */ +typedef FormData_pg_constraint *Form_pg_constraint; + +DECLARE_TOAST(pg_constraint, 2832, 2833); + +DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, ConstraintNameNspIndexId, pg_constraint, btree(conname name_ops, connamespace oid_ops)); +DECLARE_UNIQUE_INDEX(pg_constraint_conrelid_contypid_conname_index, 2665, ConstraintRelidTypidNameIndexId, pg_constraint, btree(conrelid oid_ops, contypid oid_ops, conname name_ops)); +DECLARE_INDEX(pg_constraint_contypid_index, 2666, ConstraintTypidIndexId, pg_constraint, btree(contypid oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_constraint_oid_index, 2667, ConstraintOidIndexId, pg_constraint, btree(oid oid_ops)); +DECLARE_INDEX(pg_constraint_conparentid_index, 2579, ConstraintParentIndexId, pg_constraint, btree(conparentid oid_ops)); + +MAKE_SYSCACHE(CONSTROID, pg_constraint_oid_index, 16); + +/* conkey can contain zero (InvalidAttrNumber) if a whole-row Var is used */ +DECLARE_ARRAY_FOREIGN_KEY_OPT((conrelid, conkey), pg_attribute, (attrelid, attnum)); +DECLARE_ARRAY_FOREIGN_KEY((confrelid, confkey), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* Valid values for contype */ +#define CONSTRAINT_CHECK 'c' +#define CONSTRAINT_FOREIGN 'f' +#define CONSTRAINT_NOTNULL 'n' +#define CONSTRAINT_PRIMARY 'p' +#define CONSTRAINT_UNIQUE 'u' +#define CONSTRAINT_TRIGGER 't' +#define CONSTRAINT_EXCLUSION 'x' + +/* + * Valid values for confupdtype and confdeltype are the FKCONSTR_ACTION_xxx + * constants defined in parsenodes.h. Valid values for confmatchtype are + * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h. + */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +/* + * Identify constraint type for lookup purposes + */ +typedef enum ConstraintCategory +{ + CONSTRAINT_RELATION, + CONSTRAINT_DOMAIN, + CONSTRAINT_ASSERTION, /* for future expansion */ +} ConstraintCategory; + + +extern Oid CreateConstraintEntry(const char *constraintName, + Oid constraintNamespace, + char constraintType, + bool isDeferrable, + bool isDeferred, + bool isEnforced, + bool isValidated, + Oid parentConstrId, + Oid relId, + const int16 *constraintKey, + int constraintNKeys, + int constraintNTotalKeys, + Oid domainId, + Oid indexRelId, + Oid foreignRelId, + const int16 *foreignKey, + const Oid *pfEqOp, + const Oid *ppEqOp, + const Oid *ffEqOp, + int foreignNKeys, + char foreignUpdateType, + char foreignDeleteType, + const int16 *fkDeleteSetCols, + int numFkDeleteSetCols, + char foreignMatchType, + const Oid *exclOp, + Node *conExpr, + const char *conBin, + bool conIsLocal, + int16 conInhCount, + bool conNoInherit, + bool conPeriod, + bool is_internal); + +extern bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId, + const char *conname); +extern bool ConstraintNameExists(const char *conname, Oid namespaceid); +extern char *ChooseConstraintName(const char *name1, const char *name2, + const char *label, Oid namespaceid, + List *others); + +extern HeapTuple findNotNullConstraintAttnum(Oid relid, AttrNumber attnum); +extern HeapTuple findNotNullConstraint(Oid relid, const char *colname); +extern HeapTuple findDomainNotNullConstraint(Oid typid); +extern AttrNumber extractNotNullColumn(HeapTuple constrTup); +extern bool AdjustNotNullInheritance(Oid relid, AttrNumber attnum, const char *new_conname, + bool is_local, bool is_no_inherit, bool is_notvalid); +extern List *RelationGetNotNullConstraints(Oid relid, bool cooked, + bool include_noinh); + +extern void RemoveConstraintById(Oid conId); +extern void RenameConstraintById(Oid conId, const char *newname); + +extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, + Oid newNspId, bool isType, ObjectAddresses *objsMoved); +extern void ConstraintSetParentConstraint(Oid childConstrId, + Oid parentConstrId, + Oid childTableId); +extern Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok); +extern Bitmapset *get_relation_constraint_attnos(Oid relid, const char *conname, + bool missing_ok, Oid *constraintOid); +extern Oid get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok); +extern Oid get_relation_idx_constraint_oid(Oid relationId, Oid indexId); + +extern Bitmapset *get_primary_key_attnos(Oid relid, bool deferrableOk, + Oid *constraintOid); +extern void DeconstructFkConstraintRow(HeapTuple tuple, int *numfks, + AttrNumber *conkey, AttrNumber *confkey, + Oid *pf_eq_oprs, Oid *pp_eq_oprs, Oid *ff_eq_oprs, + int *num_fk_del_set_cols, AttrNumber *fk_del_set_cols); +extern void FindFKPeriodOpers(Oid opclass, + Oid *containedbyoperoid, + Oid *aggedcontainedbyoperoid, + Oid *intersectoperoid); + +extern bool check_functional_grouping(Oid relid, + Index varno, Index varlevelsup, + List *grouping_columns, + List **constraintDeps); + +#endif /* PG_CONSTRAINT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_constraint_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_constraint_d.h new file mode 100644 index 0000000..e0d2f91 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_constraint_d.h @@ -0,0 +1,83 @@ +/*------------------------------------------------------------------------- + * + * pg_constraint_d.h + * Macro definitions for pg_constraint + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONSTRAINT_D_H +#define PG_CONSTRAINT_D_H + +/* Macros related to the structure of pg_constraint */ + +#define ConstraintRelationId 2606 +#define ConstraintNameNspIndexId 2664 +#define ConstraintRelidTypidNameIndexId 2665 +#define ConstraintTypidIndexId 2666 +#define ConstraintOidIndexId 2667 +#define ConstraintParentIndexId 2579 + +#define Anum_pg_constraint_oid 1 +#define Anum_pg_constraint_conname 2 +#define Anum_pg_constraint_connamespace 3 +#define Anum_pg_constraint_contype 4 +#define Anum_pg_constraint_condeferrable 5 +#define Anum_pg_constraint_condeferred 6 +#define Anum_pg_constraint_conenforced 7 +#define Anum_pg_constraint_convalidated 8 +#define Anum_pg_constraint_conrelid 9 +#define Anum_pg_constraint_contypid 10 +#define Anum_pg_constraint_conindid 11 +#define Anum_pg_constraint_conparentid 12 +#define Anum_pg_constraint_confrelid 13 +#define Anum_pg_constraint_confupdtype 14 +#define Anum_pg_constraint_confdeltype 15 +#define Anum_pg_constraint_confmatchtype 16 +#define Anum_pg_constraint_conislocal 17 +#define Anum_pg_constraint_coninhcount 18 +#define Anum_pg_constraint_connoinherit 19 +#define Anum_pg_constraint_conperiod 20 +#define Anum_pg_constraint_conkey 21 +#define Anum_pg_constraint_confkey 22 +#define Anum_pg_constraint_conpfeqop 23 +#define Anum_pg_constraint_conppeqop 24 +#define Anum_pg_constraint_conffeqop 25 +#define Anum_pg_constraint_confdelsetcols 26 +#define Anum_pg_constraint_conexclop 27 +#define Anum_pg_constraint_conbin 28 + +#define Natts_pg_constraint 28 + +/* Definitions copied from pg_constraint.h */ + + +/* Valid values for contype */ +#define CONSTRAINT_CHECK 'c' +#define CONSTRAINT_FOREIGN 'f' +#define CONSTRAINT_NOTNULL 'n' +#define CONSTRAINT_PRIMARY 'p' +#define CONSTRAINT_UNIQUE 'u' +#define CONSTRAINT_TRIGGER 't' +#define CONSTRAINT_EXCLUSION 'x' + +/* + * Valid values for confupdtype and confdeltype are the FKCONSTR_ACTION_xxx + * constants defined in parsenodes.h. Valid values for confmatchtype are + * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h. + */ + + +/* OID symbols for objects defined in pg_constraint.dat */ + + +#endif /* PG_CONSTRAINT_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_control.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_control.h new file mode 100644 index 0000000..63e834a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_control.h @@ -0,0 +1,266 @@ +/*------------------------------------------------------------------------- + * + * pg_control.h + * The system control file "pg_control" is not a heap relation. + * However, we define it here so that the format is documented. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_control.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONTROL_H +#define PG_CONTROL_H + +#include "access/transam.h" +#include "access/xlogdefs.h" +#include "pgtime.h" /* for pg_time_t */ +#include "port/pg_crc32c.h" + + +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 1800 + +/* Nonce key length, see below */ +#define MOCK_AUTH_NONCE_LEN 32 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new + * timeline (equals ThisTimeLineID otherwise) */ + bool fullPageWrites; /* current full_page_writes */ + int wal_level; /* current wal_level */ + FullTransactionId nextXid; /* next free transaction ID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */ + Oid oldestMultiDB; /* database with minimum datminmxid */ + pg_time_t time; /* time stamp of checkpoint */ + TransactionId oldestCommitTsXid; /* oldest Xid with valid commit + * timestamp */ + TransactionId newestCommitTsXid; /* newest Xid with valid commit + * timestamp */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is replica. Otherwise it's + * set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* XLOG info values for XLOG rmgr */ +#define XLOG_CHECKPOINT_SHUTDOWN 0x00 +#define XLOG_CHECKPOINT_ONLINE 0x10 +#define XLOG_NOOP 0x20 +#define XLOG_NEXTOID 0x30 +#define XLOG_SWITCH 0x40 +#define XLOG_BACKUP_END 0x50 +#define XLOG_PARAMETER_CHANGE 0x60 +#define XLOG_RESTORE_POINT 0x70 +#define XLOG_FPW_CHANGE 0x80 +#define XLOG_END_OF_RECOVERY 0x90 +#define XLOG_FPI_FOR_HINT 0xA0 +#define XLOG_FPI 0xB0 +/* 0xC0 is used in Postgres 9.5-11 */ +#define XLOG_OVERWRITE_CONTRECORD 0xD0 +#define XLOG_CHECKPOINT_REDO 0xE0 + + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION, +} DBState; + +/* + * Contents of pg_control. + */ + +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + * + * backupEndPoint is the backup end location, if we are recovering from an + * online backup which was taken from the standby and haven't reached the + * end of backup yet. It is initialized to the minimum recovery point in + * pg_control which was backed up last. It is reset to zero when the end + * of backup is reached, and we mustn't start up before that. + * + * If backupEndRequired is true, we know for sure that we're restoring + * from a backup, and must see a backup-end record before we can safely + * start up. + */ + XLogRecPtr minRecoveryPoint; + TimeLineID minRecoveryPointTLI; + XLogRecPtr backupStartPoint; + XLogRecPtr backupEndPoint; + bool backupEndRequired; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + bool wal_log_hints; + int MaxConnections; + int max_worker_processes; + int max_wal_senders; + int max_prepared_xacts; + int max_locks_per_xact; + bool track_commit_timestamp; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + uint32 loblksize; /* chunk size in pg_largeobject */ + + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* Are data pages protected by checksums? Zero if no checksum version */ + uint32 data_checksum_version; + + /* + * True if the default signedness of char is "signed" on a platform where + * the cluster is initialized. + */ + bool default_char_signedness; + + /* + * Random nonce, used in authentication requests that need to proceed + * based on values that are cluster-unique, like a SASL exchange that + * failed at an early stage. + */ + char mock_authentication_nonce[MOCK_AUTH_NONCE_LEN]; + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32c crc; +} ControlFileData; + +/* + * Maximum safe value of sizeof(ControlFileData). For reliability's sake, + * it's critical that pg_control updates be atomic writes. That generally + * means the active data can't be more than one disk sector, which is 512 + * bytes on common hardware. Be very careful about raising this limit. + */ +#define PG_CONTROL_MAX_SAFE_SIZE 512 + +/* + * Physical size of the pg_control file. Note that this is considerably + * bigger than the actually used size (ie, sizeof(ControlFileData)). + * The idea is to keep the physical size constant independent of format + * changes, so that ReadControlFile will deliver a suitable wrong-version + * message instead of a read error if it's looking at an incompatible file. + */ +#define PG_CONTROL_FILE_SIZE 8192 + +/* + * Ensure that the size of the pg_control data structure is sane. + */ +StaticAssertDecl(sizeof(ControlFileData) <= PG_CONTROL_MAX_SAFE_SIZE, + "pg_control is too large for atomic disk writes"); +StaticAssertDecl(sizeof(ControlFileData) <= PG_CONTROL_FILE_SIZE, + "sizeof(ControlFileData) exceeds PG_CONTROL_FILE_SIZE"); + +#endif /* PG_CONTROL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_conversion.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_conversion.h new file mode 100644 index 0000000..477b8d0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_conversion.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------------------- + * + * pg_conversion.h + * definition of the "conversion" system catalog (pg_conversion) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_conversion.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONVERSION_H +#define PG_CONVERSION_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_conversion_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_conversion definition. cpp turns this into + * typedef struct FormData_pg_conversion + * ---------------- + */ +CATALOG(pg_conversion,2607,ConversionRelationId) +{ + /* oid */ + Oid oid; + + /* name of the conversion */ + NameData conname; + + /* namespace that the conversion belongs to */ + Oid connamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* owner of the conversion */ + Oid conowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* FOR encoding id */ + int32 conforencoding BKI_LOOKUP(encoding); + + /* TO encoding id */ + int32 contoencoding BKI_LOOKUP(encoding); + + /* OID of the conversion proc */ + regproc conproc BKI_LOOKUP(pg_proc); + + /* true if this is a default conversion */ + bool condefault BKI_DEFAULT(t); +} FormData_pg_conversion; + +/* ---------------- + * Form_pg_conversion corresponds to a pointer to a tuple with + * the format of pg_conversion relation. + * ---------------- + */ +typedef FormData_pg_conversion *Form_pg_conversion; + +DECLARE_UNIQUE_INDEX(pg_conversion_default_index, 2668, ConversionDefaultIndexId, pg_conversion, btree(connamespace oid_ops, conforencoding int4_ops, contoencoding int4_ops, oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_conversion_name_nsp_index, 2669, ConversionNameNspIndexId, pg_conversion, btree(conname name_ops, connamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_conversion_oid_index, 2670, ConversionOidIndexId, pg_conversion, btree(oid oid_ops)); + +MAKE_SYSCACHE(CONDEFAULT, pg_conversion_default_index, 8); +MAKE_SYSCACHE(CONNAMENSP, pg_conversion_name_nsp_index, 8); +MAKE_SYSCACHE(CONVOID, pg_conversion_oid_index, 8); + + +extern ObjectAddress ConversionCreate(const char *conname, Oid connamespace, + Oid conowner, + int32 conforencoding, int32 contoencoding, + Oid conproc, bool def); +extern Oid FindDefaultConversion(Oid name_space, int32 for_encoding, + int32 to_encoding); + +#endif /* PG_CONVERSION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_conversion_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_conversion_d.h new file mode 100644 index 0000000..b9dbd64 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_conversion_d.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * pg_conversion_d.h + * Macro definitions for pg_conversion + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONVERSION_D_H +#define PG_CONVERSION_D_H + +/* Macros related to the structure of pg_conversion */ + +#define ConversionRelationId 2607 +#define ConversionDefaultIndexId 2668 +#define ConversionNameNspIndexId 2669 +#define ConversionOidIndexId 2670 + +#define Anum_pg_conversion_oid 1 +#define Anum_pg_conversion_conname 2 +#define Anum_pg_conversion_connamespace 3 +#define Anum_pg_conversion_conowner 4 +#define Anum_pg_conversion_conforencoding 5 +#define Anum_pg_conversion_contoencoding 6 +#define Anum_pg_conversion_conproc 7 +#define Anum_pg_conversion_condefault 8 + +#define Natts_pg_conversion 8 + +/* Definitions copied from pg_conversion.h */ + + +/* OID symbols for objects defined in pg_conversion.dat */ + + +#endif /* PG_CONVERSION_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_database.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_database.h new file mode 100644 index 0000000..54f0d38 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_database.h @@ -0,0 +1,129 @@ +/*------------------------------------------------------------------------- + * + * pg_database.h + * definition of the "database" system catalog (pg_database) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_database.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DATABASE_H +#define PG_DATABASE_H + +#include "catalog/genbki.h" +#include "catalog/pg_database_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_database definition. cpp turns this into + * typedef struct FormData_pg_database + * ---------------- + */ +CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248,DatabaseRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + /* oid */ + Oid oid; + + /* database name */ + NameData datname; + + /* owner of database */ + Oid datdba BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* character encoding */ + int32 encoding; + + /* locale provider, see pg_collation.collprovider */ + char datlocprovider; + + /* allowed as CREATE DATABASE template? */ + bool datistemplate; + + /* new connections allowed? */ + bool datallowconn; + + /* database has login event triggers? */ + bool dathasloginevt; + + /* + * Max connections allowed. Negative values have special meaning, see + * DATCONNLIMIT_* defines below. + */ + int32 datconnlimit; + + /* all Xids < this are frozen in this DB */ + TransactionId datfrozenxid; + + /* all multixacts in the DB are >= this */ + TransactionId datminmxid; + + /* default table space for this DB */ + Oid dattablespace BKI_LOOKUP(pg_tablespace); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* LC_COLLATE setting */ + text datcollate BKI_FORCE_NOT_NULL; + + /* LC_CTYPE setting */ + text datctype BKI_FORCE_NOT_NULL; + + /* ICU locale ID */ + text datlocale; + + /* ICU collation rules */ + text daticurules; + + /* provider-dependent version of collation data */ + text datcollversion BKI_DEFAULT(_null_); + + /* access permissions */ + aclitem datacl[1]; +#endif +} FormData_pg_database; + +/* ---------------- + * Form_pg_database corresponds to a pointer to a tuple with + * the format of pg_database relation. + * ---------------- + */ +typedef FormData_pg_database *Form_pg_database; + +DECLARE_TOAST_WITH_MACRO(pg_database, 4177, 4178, PgDatabaseToastTable, PgDatabaseToastIndex); + +DECLARE_UNIQUE_INDEX(pg_database_datname_index, 2671, DatabaseNameIndexId, pg_database, btree(datname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_database_oid_index, 2672, DatabaseOidIndexId, pg_database, btree(oid oid_ops)); + +MAKE_SYSCACHE(DATABASEOID, pg_database_oid_index, 4); + +/* + * pg_database.dat contains an entry for template1, but not for the template0 + * or postgres databases, because those are created later in initdb. + * However, we still want to manually assign the OIDs for template0 and + * postgres, so declare those here. + */ +DECLARE_OID_DEFINING_MACRO(Template0DbOid, 4); +DECLARE_OID_DEFINING_MACRO(PostgresDbOid, 5); + +/* + * Special values for pg_database.datconnlimit. Normal values are >= 0. + */ +#define DATCONNLIMIT_UNLIMITED -1 /* no limit */ + +/* + * A database is set to invalid partway through being dropped. Using + * datconnlimit=-2 for this purpose isn't particularly clean, but is + * backpatchable. + */ +#define DATCONNLIMIT_INVALID_DB -2 + +extern bool database_is_invalid_form(Form_pg_database datform); +extern bool database_is_invalid_oid(Oid dboid); + +#endif /* PG_DATABASE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_database_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_database_d.h new file mode 100644 index 0000000..e1c98ab --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_database_d.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * pg_database_d.h + * Macro definitions for pg_database + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DATABASE_D_H +#define PG_DATABASE_D_H + +/* Macros related to the structure of pg_database */ + +#define DatabaseRelationId 1262 +#define DatabaseRelation_Rowtype_Id 1248 +#define PgDatabaseToastTable 4177 +#define PgDatabaseToastIndex 4178 +#define DatabaseNameIndexId 2671 +#define DatabaseOidIndexId 2672 +#define Template0DbOid 4 +#define PostgresDbOid 5 + +#define Anum_pg_database_oid 1 +#define Anum_pg_database_datname 2 +#define Anum_pg_database_datdba 3 +#define Anum_pg_database_encoding 4 +#define Anum_pg_database_datlocprovider 5 +#define Anum_pg_database_datistemplate 6 +#define Anum_pg_database_datallowconn 7 +#define Anum_pg_database_dathasloginevt 8 +#define Anum_pg_database_datconnlimit 9 +#define Anum_pg_database_datfrozenxid 10 +#define Anum_pg_database_datminmxid 11 +#define Anum_pg_database_dattablespace 12 +#define Anum_pg_database_datcollate 13 +#define Anum_pg_database_datctype 14 +#define Anum_pg_database_datlocale 15 +#define Anum_pg_database_daticurules 16 +#define Anum_pg_database_datcollversion 17 +#define Anum_pg_database_datacl 18 + +#define Natts_pg_database 18 + +/* Definitions copied from pg_database.h */ + + +/* OID symbols for objects defined in pg_database.dat */ + +#define Template1DbOid 1 + +#endif /* PG_DATABASE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_db_role_setting.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_db_role_setting.h new file mode 100644 index 0000000..be5cde0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_db_role_setting.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_db_role_setting.h + * definition of the system catalog for per-database/per-user + * configuration settings (pg_db_role_setting) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_db_role_setting.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DB_ROLE_SETTING_H +#define PG_DB_ROLE_SETTING_H + +#include "catalog/genbki.h" +#include "catalog/pg_db_role_setting_d.h" /* IWYU pragma: export */ + +#include "utils/guc.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + +/* ---------------- + * pg_db_role_setting definition. cpp turns this into + * typedef struct FormData_pg_db_role_setting + * ---------------- + */ +CATALOG(pg_db_role_setting,2964,DbRoleSettingRelationId) BKI_SHARED_RELATION +{ + /* database, or 0 for a role-specific setting */ + Oid setdatabase BKI_LOOKUP_OPT(pg_database); + + /* role, or 0 for a database-specific setting */ + Oid setrole BKI_LOOKUP_OPT(pg_authid); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text setconfig[1]; /* GUC settings to apply at login */ +#endif +} FormData_pg_db_role_setting; + +typedef FormData_pg_db_role_setting * Form_pg_db_role_setting; + +DECLARE_TOAST_WITH_MACRO(pg_db_role_setting, 2966, 2967, PgDbRoleSettingToastTable, PgDbRoleSettingToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_db_role_setting_databaseid_rol_index, 2965, DbRoleSettingDatidRolidIndexId, pg_db_role_setting, btree(setdatabase oid_ops, setrole oid_ops)); + +/* + * prototypes for functions in pg_db_role_setting.c + */ +extern void AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt); +extern void DropSetting(Oid databaseid, Oid roleid); +extern void ApplySetting(Snapshot snapshot, Oid databaseid, Oid roleid, + Relation relsetting, GucSource source); + +#endif /* PG_DB_ROLE_SETTING_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_db_role_setting_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_db_role_setting_d.h new file mode 100644 index 0000000..df78cec --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_db_role_setting_d.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * pg_db_role_setting_d.h + * Macro definitions for pg_db_role_setting + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DB_ROLE_SETTING_D_H +#define PG_DB_ROLE_SETTING_D_H + +/* Macros related to the structure of pg_db_role_setting */ + +#define DbRoleSettingRelationId 2964 +#define PgDbRoleSettingToastTable 2966 +#define PgDbRoleSettingToastIndex 2967 +#define DbRoleSettingDatidRolidIndexId 2965 + +#define Anum_pg_db_role_setting_setdatabase 1 +#define Anum_pg_db_role_setting_setrole 2 +#define Anum_pg_db_role_setting_setconfig 3 + +#define Natts_pg_db_role_setting 3 + +/* Definitions copied from pg_db_role_setting.h */ + + +/* OID symbols for objects defined in pg_db_role_setting.dat */ + + +#endif /* PG_DB_ROLE_SETTING_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_default_acl.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_default_acl.h new file mode 100644 index 0000000..ce6e509 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_default_acl.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * pg_default_acl.h + * definition of the system catalog for default ACLs of new objects + * (pg_default_acl) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_default_acl.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEFAULT_ACL_H +#define PG_DEFAULT_ACL_H + +#include "catalog/genbki.h" +#include "catalog/pg_default_acl_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_default_acl definition. cpp turns this into + * typedef struct FormData_pg_default_acl + * ---------------- + */ +CATALOG(pg_default_acl,826,DefaultAclRelationId) +{ + Oid oid; /* oid */ + Oid defaclrole BKI_LOOKUP(pg_authid); /* OID of role owning this + * ACL */ + Oid defaclnamespace BKI_LOOKUP_OPT(pg_namespace); /* OID of namespace, or + * 0 for all */ + char defaclobjtype; /* see DEFACLOBJ_xxx constants below */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem defaclacl[1] BKI_FORCE_NOT_NULL; /* permissions to add at + * CREATE time */ +#endif +} FormData_pg_default_acl; + +/* ---------------- + * Form_pg_default_acl corresponds to a pointer to a tuple with + * the format of pg_default_acl relation. + * ---------------- + */ +typedef FormData_pg_default_acl *Form_pg_default_acl; + +DECLARE_TOAST(pg_default_acl, 4143, 4144); + +DECLARE_UNIQUE_INDEX(pg_default_acl_role_nsp_obj_index, 827, DefaultAclRoleNspObjIndexId, pg_default_acl, btree(defaclrole oid_ops, defaclnamespace oid_ops, defaclobjtype char_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_default_acl_oid_index, 828, DefaultAclOidIndexId, pg_default_acl, btree(oid oid_ops)); + +MAKE_SYSCACHE(DEFACLROLENSPOBJ, pg_default_acl_role_nsp_obj_index, 8); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Types of objects for which the user is allowed to specify default + * permissions through pg_default_acl. These codes are used in the + * defaclobjtype column. + */ +#define DEFACLOBJ_RELATION 'r' /* table, view */ +#define DEFACLOBJ_SEQUENCE 'S' /* sequence */ +#define DEFACLOBJ_FUNCTION 'f' /* function */ +#define DEFACLOBJ_TYPE 'T' /* type */ +#define DEFACLOBJ_NAMESPACE 'n' /* namespace */ +#define DEFACLOBJ_LARGEOBJECT 'L' /* large object */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_DEFAULT_ACL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_default_acl_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_default_acl_d.h new file mode 100644 index 0000000..e4b9017 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_default_acl_d.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * pg_default_acl_d.h + * Macro definitions for pg_default_acl + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEFAULT_ACL_D_H +#define PG_DEFAULT_ACL_D_H + +/* Macros related to the structure of pg_default_acl */ + +#define DefaultAclRelationId 826 +#define DefaultAclRoleNspObjIndexId 827 +#define DefaultAclOidIndexId 828 + +#define Anum_pg_default_acl_oid 1 +#define Anum_pg_default_acl_defaclrole 2 +#define Anum_pg_default_acl_defaclnamespace 3 +#define Anum_pg_default_acl_defaclobjtype 4 +#define Anum_pg_default_acl_defaclacl 5 + +#define Natts_pg_default_acl 5 + +/* Definitions copied from pg_default_acl.h */ + + +/* + * Types of objects for which the user is allowed to specify default + * permissions through pg_default_acl. These codes are used in the + * defaclobjtype column. + */ +#define DEFACLOBJ_RELATION 'r' /* table, view */ +#define DEFACLOBJ_SEQUENCE 'S' /* sequence */ +#define DEFACLOBJ_FUNCTION 'f' /* function */ +#define DEFACLOBJ_TYPE 'T' /* type */ +#define DEFACLOBJ_NAMESPACE 'n' /* namespace */ +#define DEFACLOBJ_LARGEOBJECT 'L' /* large object */ + + +/* OID symbols for objects defined in pg_default_acl.dat */ + + +#endif /* PG_DEFAULT_ACL_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_depend.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_depend.h new file mode 100644 index 0000000..8d0daa9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_depend.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------------- + * + * pg_depend.h + * definition of the "dependency" system catalog (pg_depend) + * + * pg_depend has no preloaded contents, so there is no pg_depend.dat + * file; dependencies for system-defined objects are loaded into it + * on-the-fly during initdb. Most built-in objects are pinned anyway, + * and hence need no explicit entries in pg_depend. + * + * NOTE: we do not represent all possible dependency pairs in pg_depend; + * for example, there's not much value in creating an explicit dependency + * from an attribute to its relation. Usually we make a dependency for + * cases where the relationship is conditional rather than essential + * (for example, not all triggers are dependent on constraints, but all + * attributes are dependent on relations) or where the dependency is not + * convenient to find from the contents of other catalogs. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_depend.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEPEND_H +#define PG_DEPEND_H + +#include "catalog/genbki.h" +#include "catalog/pg_depend_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_depend definition. cpp turns this into + * typedef struct FormData_pg_depend + * ---------------- + */ +CATALOG(pg_depend,2608,DependRelationId) +{ + /* + * Identification of the dependent (referencing) object. + */ + Oid classid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + Oid objid; /* OID of object itself */ + int32 objsubid; /* column number, or 0 if not used */ + + /* + * Identification of the independent (referenced) object. + */ + Oid refclassid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + Oid refobjid; /* OID of object itself */ + int32 refobjsubid; /* column number, or 0 if not used */ + + /* + * Precise semantics of the relationship are specified by the deptype + * field. See DependencyType in catalog/dependency.h. + */ + char deptype; /* see codes in dependency.h */ +} FormData_pg_depend; + +/* ---------------- + * Form_pg_depend corresponds to a pointer to a row with + * the format of pg_depend relation. + * ---------------- + */ +typedef FormData_pg_depend *Form_pg_depend; + +DECLARE_INDEX(pg_depend_depender_index, 2673, DependDependerIndexId, pg_depend, btree(classid oid_ops, objid oid_ops, objsubid int4_ops)); +DECLARE_INDEX(pg_depend_reference_index, 2674, DependReferenceIndexId, pg_depend, btree(refclassid oid_ops, refobjid oid_ops, refobjsubid int4_ops)); + +#endif /* PG_DEPEND_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_depend_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_depend_d.h new file mode 100644 index 0000000..435746d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_depend_d.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * pg_depend_d.h + * Macro definitions for pg_depend + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEPEND_D_H +#define PG_DEPEND_D_H + +/* Macros related to the structure of pg_depend */ + +#define DependRelationId 2608 +#define DependDependerIndexId 2673 +#define DependReferenceIndexId 2674 + +#define Anum_pg_depend_classid 1 +#define Anum_pg_depend_objid 2 +#define Anum_pg_depend_objsubid 3 +#define Anum_pg_depend_refclassid 4 +#define Anum_pg_depend_refobjid 5 +#define Anum_pg_depend_refobjsubid 6 +#define Anum_pg_depend_deptype 7 + +#define Natts_pg_depend 7 + +/* Definitions copied from pg_depend.h */ + + +/* OID symbols for objects defined in pg_depend.dat */ + + +#endif /* PG_DEPEND_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_description.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_description.h new file mode 100644 index 0000000..4cd2bf9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_description.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------- + * + * pg_description.h + * definition of the "description" system catalog (pg_description) + * + * Because the contents of this table are taken from the *.dat files + * of other catalogs, there is no pg_description.dat file. The initial + * contents are assembled by genbki.pl and loaded during initdb. + * + * NOTE: an object is identified by the OID of the row that primarily + * defines the object, plus the OID of the table that that row appears in. + * For example, a function is identified by the OID of its pg_proc row + * plus the pg_class OID of table pg_proc. This allows unique identification + * of objects without assuming that OIDs are unique across tables. + * + * Since attributes don't have OIDs of their own, we identify an attribute + * comment by the objoid+classoid of its parent table, plus an "objsubid" + * giving the attribute column number. "objsubid" must be zero in a comment + * for a table itself, so that it is distinct from any column comment. + * Currently, objsubid is unused and zero for all other kinds of objects, + * but perhaps it might be useful someday to associate comments with + * constituent elements of other kinds of objects (arguments of a function, + * for example). + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_description.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DESCRIPTION_H +#define PG_DESCRIPTION_H + +#include "catalog/genbki.h" +#include "catalog/pg_description_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_description definition. cpp turns this into + * typedef struct FormData_pg_description + * ---------------- + */ +CATALOG(pg_description,2609,DescriptionRelationId) +{ + Oid objoid; /* OID of object itself */ + Oid classoid; /* OID of table containing object */ + int32 objsubid; /* column number, or 0 if not used */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text description BKI_FORCE_NOT_NULL; /* description of object */ +#endif +} FormData_pg_description; + +/* ---------------- + * Form_pg_description corresponds to a pointer to a tuple with + * the format of pg_description relation. + * ---------------- + */ +typedef FormData_pg_description * Form_pg_description; + +DECLARE_TOAST(pg_description, 2834, 2835); + +DECLARE_UNIQUE_INDEX_PKEY(pg_description_o_c_o_index, 2675, DescriptionObjIndexId, pg_description, btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops)); + +/* We do not use BKI_LOOKUP here because it causes problems for genbki.pl */ +DECLARE_FOREIGN_KEY((classoid), pg_class, (oid)); + +#endif /* PG_DESCRIPTION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_description_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_description_d.h new file mode 100644 index 0000000..f961ece --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_description_d.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * pg_description_d.h + * Macro definitions for pg_description + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DESCRIPTION_D_H +#define PG_DESCRIPTION_D_H + +/* Macros related to the structure of pg_description */ + +#define DescriptionRelationId 2609 +#define DescriptionObjIndexId 2675 + +#define Anum_pg_description_objoid 1 +#define Anum_pg_description_classoid 2 +#define Anum_pg_description_objsubid 3 +#define Anum_pg_description_description 4 + +#define Natts_pg_description 4 + +/* Definitions copied from pg_description.h */ + + +/* OID symbols for objects defined in pg_description.dat */ + + +#endif /* PG_DESCRIPTION_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_enum.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_enum.h new file mode 100644 index 0000000..7cb69ae --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_enum.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * pg_enum.h + * definition of the "enum" system catalog (pg_enum) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_enum.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ENUM_H +#define PG_ENUM_H + +#include "catalog/genbki.h" +#include "catalog/pg_enum_d.h" /* IWYU pragma: export */ + +#include "nodes/pg_list.h" + +/* ---------------- + * pg_enum definition. cpp turns this into + * typedef struct FormData_pg_enum + * ---------------- + */ +CATALOG(pg_enum,3501,EnumRelationId) +{ + Oid oid; /* oid */ + Oid enumtypid BKI_LOOKUP(pg_type); /* OID of owning enum type */ + float4 enumsortorder; /* sort position of this enum value */ + NameData enumlabel; /* text representation of enum value */ +} FormData_pg_enum; + +/* ---------------- + * Form_pg_enum corresponds to a pointer to a tuple with + * the format of pg_enum relation. + * ---------------- + */ +typedef FormData_pg_enum *Form_pg_enum; + +DECLARE_UNIQUE_INDEX_PKEY(pg_enum_oid_index, 3502, EnumOidIndexId, pg_enum, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, EnumTypIdLabelIndexId, pg_enum, btree(enumtypid oid_ops, enumlabel name_ops)); +DECLARE_UNIQUE_INDEX(pg_enum_typid_sortorder_index, 3534, EnumTypIdSortOrderIndexId, pg_enum, btree(enumtypid oid_ops, enumsortorder float4_ops)); + +MAKE_SYSCACHE(ENUMOID, pg_enum_oid_index, 8); +MAKE_SYSCACHE(ENUMTYPOIDNAME, pg_enum_typid_label_index, 8); + +/* + * prototypes for functions in pg_enum.c + */ +extern void EnumValuesCreate(Oid enumTypeOid, List *vals); +extern void EnumValuesDelete(Oid enumTypeOid); +extern void AddEnumLabel(Oid enumTypeOid, const char *newVal, + const char *neighbor, bool newValIsAfter, + bool skipIfExists); +extern void RenameEnumLabel(Oid enumTypeOid, + const char *oldVal, const char *newVal); +extern bool EnumUncommitted(Oid enum_id); +extern Size EstimateUncommittedEnumsSpace(void); +extern void SerializeUncommittedEnums(void *space, Size size); +extern void RestoreUncommittedEnums(void *space); +extern void AtEOXact_Enum(void); + +#endif /* PG_ENUM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_enum_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_enum_d.h new file mode 100644 index 0000000..9bff82e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_enum_d.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * pg_enum_d.h + * Macro definitions for pg_enum + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ENUM_D_H +#define PG_ENUM_D_H + +/* Macros related to the structure of pg_enum */ + +#define EnumRelationId 3501 +#define EnumOidIndexId 3502 +#define EnumTypIdLabelIndexId 3503 +#define EnumTypIdSortOrderIndexId 3534 + +#define Anum_pg_enum_oid 1 +#define Anum_pg_enum_enumtypid 2 +#define Anum_pg_enum_enumsortorder 3 +#define Anum_pg_enum_enumlabel 4 + +#define Natts_pg_enum 4 + +/* Definitions copied from pg_enum.h */ + + +/* OID symbols for objects defined in pg_enum.dat */ + + +#endif /* PG_ENUM_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_event_trigger.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_event_trigger.h new file mode 100644 index 0000000..bcb516c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_event_trigger.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * pg_event_trigger.h + * definition of the "event trigger" system catalog (pg_event_trigger) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_event_trigger.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_EVENT_TRIGGER_H +#define PG_EVENT_TRIGGER_H + +#include "catalog/genbki.h" +#include "catalog/pg_event_trigger_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_event_trigger definition. cpp turns this into + * typedef struct FormData_pg_event_trigger + * ---------------- + */ +CATALOG(pg_event_trigger,3466,EventTriggerRelationId) +{ + Oid oid; /* oid */ + NameData evtname; /* trigger's name */ + NameData evtevent; /* trigger's event */ + Oid evtowner BKI_LOOKUP(pg_authid); /* trigger's owner */ + Oid evtfoid BKI_LOOKUP(pg_proc); /* OID of function to be + * called */ + char evtenabled; /* trigger's firing configuration WRT + * session_replication_role */ + +#ifdef CATALOG_VARLEN + text evttags[1]; /* command TAGs this event trigger targets */ +#endif +} FormData_pg_event_trigger; + +/* ---------------- + * Form_pg_event_trigger corresponds to a pointer to a tuple with + * the format of pg_event_trigger relation. + * ---------------- + */ +typedef FormData_pg_event_trigger *Form_pg_event_trigger; + +DECLARE_TOAST(pg_event_trigger, 4145, 4146); + +DECLARE_UNIQUE_INDEX(pg_event_trigger_evtname_index, 3467, EventTriggerNameIndexId, pg_event_trigger, btree(evtname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_event_trigger_oid_index, 3468, EventTriggerOidIndexId, pg_event_trigger, btree(oid oid_ops)); + +MAKE_SYSCACHE(EVENTTRIGGERNAME, pg_event_trigger_evtname_index, 8); +MAKE_SYSCACHE(EVENTTRIGGEROID, pg_event_trigger_oid_index, 8); + +#endif /* PG_EVENT_TRIGGER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_event_trigger_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_event_trigger_d.h new file mode 100644 index 0000000..03915c0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_event_trigger_d.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * pg_event_trigger_d.h + * Macro definitions for pg_event_trigger + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_EVENT_TRIGGER_D_H +#define PG_EVENT_TRIGGER_D_H + +/* Macros related to the structure of pg_event_trigger */ + +#define EventTriggerRelationId 3466 +#define EventTriggerNameIndexId 3467 +#define EventTriggerOidIndexId 3468 + +#define Anum_pg_event_trigger_oid 1 +#define Anum_pg_event_trigger_evtname 2 +#define Anum_pg_event_trigger_evtevent 3 +#define Anum_pg_event_trigger_evtowner 4 +#define Anum_pg_event_trigger_evtfoid 5 +#define Anum_pg_event_trigger_evtenabled 6 +#define Anum_pg_event_trigger_evttags 7 + +#define Natts_pg_event_trigger 7 + +/* Definitions copied from pg_event_trigger.h */ + + +/* OID symbols for objects defined in pg_event_trigger.dat */ + + +#endif /* PG_EVENT_TRIGGER_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_extension.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_extension.h new file mode 100644 index 0000000..9214ebe --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_extension.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * pg_extension.h + * definition of the "extension" system catalog (pg_extension) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_extension.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_EXTENSION_H +#define PG_EXTENSION_H + +#include "catalog/genbki.h" +#include "catalog/pg_extension_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_extension definition. cpp turns this into + * typedef struct FormData_pg_extension + * ---------------- + */ +CATALOG(pg_extension,3079,ExtensionRelationId) +{ + Oid oid; /* oid */ + NameData extname; /* extension name */ + Oid extowner BKI_LOOKUP(pg_authid); /* extension owner */ + Oid extnamespace BKI_LOOKUP(pg_namespace); /* namespace of + * contained objects */ + bool extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* extversion may never be null, but the others can be. */ + text extversion BKI_FORCE_NOT_NULL; /* extension version name */ + Oid extconfig[1] BKI_LOOKUP(pg_class); /* dumpable configuration + * tables */ + text extcondition[1]; /* WHERE clauses for config tables */ +#endif +} FormData_pg_extension; + +/* ---------------- + * Form_pg_extension corresponds to a pointer to a tuple with + * the format of pg_extension relation. + * ---------------- + */ +typedef FormData_pg_extension *Form_pg_extension; + +DECLARE_TOAST(pg_extension, 4147, 4148); + +DECLARE_UNIQUE_INDEX_PKEY(pg_extension_oid_index, 3080, ExtensionOidIndexId, pg_extension, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_extension_name_index, 3081, ExtensionNameIndexId, pg_extension, btree(extname name_ops)); + +MAKE_SYSCACHE(EXTENSIONOID, pg_extension_oid_index, 2); +MAKE_SYSCACHE(EXTENSIONNAME, pg_extension_name_index, 2); + +#endif /* PG_EXTENSION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_extension_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_extension_d.h new file mode 100644 index 0000000..79ee9cf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_extension_d.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * pg_extension_d.h + * Macro definitions for pg_extension + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_EXTENSION_D_H +#define PG_EXTENSION_D_H + +/* Macros related to the structure of pg_extension */ + +#define ExtensionRelationId 3079 +#define ExtensionOidIndexId 3080 +#define ExtensionNameIndexId 3081 + +#define Anum_pg_extension_oid 1 +#define Anum_pg_extension_extname 2 +#define Anum_pg_extension_extowner 3 +#define Anum_pg_extension_extnamespace 4 +#define Anum_pg_extension_extrelocatable 5 +#define Anum_pg_extension_extversion 6 +#define Anum_pg_extension_extconfig 7 +#define Anum_pg_extension_extcondition 8 + +#define Natts_pg_extension 8 + +/* Definitions copied from pg_extension.h */ + + +/* OID symbols for objects defined in pg_extension.dat */ + + +#endif /* PG_EXTENSION_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_data_wrapper.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_data_wrapper.h new file mode 100644 index 0000000..d03ab5a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_data_wrapper.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_data_wrapper.h + * definition of the "foreign-data wrapper" system catalog (pg_foreign_data_wrapper) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_foreign_data_wrapper.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_DATA_WRAPPER_H +#define PG_FOREIGN_DATA_WRAPPER_H + +#include "catalog/genbki.h" +#include "catalog/pg_foreign_data_wrapper_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_foreign_data_wrapper definition. cpp turns this into + * typedef struct FormData_pg_foreign_data_wrapper + * ---------------- + */ +CATALOG(pg_foreign_data_wrapper,2328,ForeignDataWrapperRelationId) +{ + Oid oid; /* oid */ + NameData fdwname; /* foreign-data wrapper name */ + Oid fdwowner BKI_LOOKUP(pg_authid); /* FDW owner */ + Oid fdwhandler BKI_LOOKUP_OPT(pg_proc); /* handler function, or 0 + * if none */ + Oid fdwvalidator BKI_LOOKUP_OPT(pg_proc); /* option validation + * function, or 0 if + * none */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem fdwacl[1]; /* access permissions */ + text fdwoptions[1]; /* FDW options */ +#endif +} FormData_pg_foreign_data_wrapper; + +/* ---------------- + * Form_pg_foreign_data_wrapper corresponds to a pointer to a tuple with + * the format of pg_foreign_data_wrapper relation. + * ---------------- + */ +typedef FormData_pg_foreign_data_wrapper *Form_pg_foreign_data_wrapper; + +DECLARE_TOAST(pg_foreign_data_wrapper, 4149, 4150); + +DECLARE_UNIQUE_INDEX_PKEY(pg_foreign_data_wrapper_oid_index, 112, ForeignDataWrapperOidIndexId, pg_foreign_data_wrapper, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_name_index, 548, ForeignDataWrapperNameIndexId, pg_foreign_data_wrapper, btree(fdwname name_ops)); + +MAKE_SYSCACHE(FOREIGNDATAWRAPPEROID, pg_foreign_data_wrapper_oid_index, 2); +MAKE_SYSCACHE(FOREIGNDATAWRAPPERNAME, pg_foreign_data_wrapper_name_index, 2); + +#endif /* PG_FOREIGN_DATA_WRAPPER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_data_wrapper_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_data_wrapper_d.h new file mode 100644 index 0000000..5b8c15d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_data_wrapper_d.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_data_wrapper_d.h + * Macro definitions for pg_foreign_data_wrapper + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_DATA_WRAPPER_D_H +#define PG_FOREIGN_DATA_WRAPPER_D_H + +/* Macros related to the structure of pg_foreign_data_wrapper */ + +#define ForeignDataWrapperRelationId 2328 +#define ForeignDataWrapperOidIndexId 112 +#define ForeignDataWrapperNameIndexId 548 + +#define Anum_pg_foreign_data_wrapper_oid 1 +#define Anum_pg_foreign_data_wrapper_fdwname 2 +#define Anum_pg_foreign_data_wrapper_fdwowner 3 +#define Anum_pg_foreign_data_wrapper_fdwhandler 4 +#define Anum_pg_foreign_data_wrapper_fdwvalidator 5 +#define Anum_pg_foreign_data_wrapper_fdwacl 6 +#define Anum_pg_foreign_data_wrapper_fdwoptions 7 + +#define Natts_pg_foreign_data_wrapper 7 + +/* Definitions copied from pg_foreign_data_wrapper.h */ + + +/* OID symbols for objects defined in pg_foreign_data_wrapper.dat */ + + +#endif /* PG_FOREIGN_DATA_WRAPPER_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_server.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_server.h new file mode 100644 index 0000000..d53f097 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_server.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_server.h + * definition of the "foreign server" system catalog (pg_foreign_server) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_foreign_server.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_SERVER_H +#define PG_FOREIGN_SERVER_H + +#include "catalog/genbki.h" +#include "catalog/pg_foreign_server_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_foreign_server definition. cpp turns this into + * typedef struct FormData_pg_foreign_server + * ---------------- + */ +CATALOG(pg_foreign_server,1417,ForeignServerRelationId) +{ + Oid oid; /* oid */ + NameData srvname; /* foreign server name */ + Oid srvowner BKI_LOOKUP(pg_authid); /* server owner */ + Oid srvfdw BKI_LOOKUP(pg_foreign_data_wrapper); /* server FDW */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text srvtype; + text srvversion; + aclitem srvacl[1]; /* access permissions */ + text srvoptions[1]; /* FDW-specific options */ +#endif +} FormData_pg_foreign_server; + +/* ---------------- + * Form_pg_foreign_server corresponds to a pointer to a tuple with + * the format of pg_foreign_server relation. + * ---------------- + */ +typedef FormData_pg_foreign_server *Form_pg_foreign_server; + +DECLARE_TOAST(pg_foreign_server, 4151, 4152); + +DECLARE_UNIQUE_INDEX_PKEY(pg_foreign_server_oid_index, 113, ForeignServerOidIndexId, pg_foreign_server, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_foreign_server_name_index, 549, ForeignServerNameIndexId, pg_foreign_server, btree(srvname name_ops)); + +MAKE_SYSCACHE(FOREIGNSERVEROID, pg_foreign_server_oid_index, 2); +MAKE_SYSCACHE(FOREIGNSERVERNAME, pg_foreign_server_name_index, 2); + +#endif /* PG_FOREIGN_SERVER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_server_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_server_d.h new file mode 100644 index 0000000..8bd6ced --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_server_d.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_server_d.h + * Macro definitions for pg_foreign_server + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_SERVER_D_H +#define PG_FOREIGN_SERVER_D_H + +/* Macros related to the structure of pg_foreign_server */ + +#define ForeignServerRelationId 1417 +#define ForeignServerOidIndexId 113 +#define ForeignServerNameIndexId 549 + +#define Anum_pg_foreign_server_oid 1 +#define Anum_pg_foreign_server_srvname 2 +#define Anum_pg_foreign_server_srvowner 3 +#define Anum_pg_foreign_server_srvfdw 4 +#define Anum_pg_foreign_server_srvtype 5 +#define Anum_pg_foreign_server_srvversion 6 +#define Anum_pg_foreign_server_srvacl 7 +#define Anum_pg_foreign_server_srvoptions 8 + +#define Natts_pg_foreign_server 8 + +/* Definitions copied from pg_foreign_server.h */ + + +/* OID symbols for objects defined in pg_foreign_server.dat */ + + +#endif /* PG_FOREIGN_SERVER_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_table.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_table.h new file mode 100644 index 0000000..aea94aa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_table.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_table.h + * definition of the "foreign table" system catalog (pg_foreign_table) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_foreign_table.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_TABLE_H +#define PG_FOREIGN_TABLE_H + +#include "catalog/genbki.h" +#include "catalog/pg_foreign_table_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_foreign_table definition. cpp turns this into + * typedef struct FormData_pg_foreign_table + * ---------------- + */ +CATALOG(pg_foreign_table,3118,ForeignTableRelationId) +{ + Oid ftrelid BKI_LOOKUP(pg_class); /* OID of foreign table */ + Oid ftserver BKI_LOOKUP(pg_foreign_server); /* OID of foreign server */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text ftoptions[1]; /* FDW-specific options */ +#endif +} FormData_pg_foreign_table; + +/* ---------------- + * Form_pg_foreign_table corresponds to a pointer to a tuple with + * the format of pg_foreign_table relation. + * ---------------- + */ +typedef FormData_pg_foreign_table *Form_pg_foreign_table; + +DECLARE_TOAST(pg_foreign_table, 4153, 4154); + +DECLARE_UNIQUE_INDEX_PKEY(pg_foreign_table_relid_index, 3119, ForeignTableRelidIndexId, pg_foreign_table, btree(ftrelid oid_ops)); + +MAKE_SYSCACHE(FOREIGNTABLEREL, pg_foreign_table_relid_index, 4); + +#endif /* PG_FOREIGN_TABLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_table_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_table_d.h new file mode 100644 index 0000000..9d0635a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_foreign_table_d.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_table_d.h + * Macro definitions for pg_foreign_table + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_TABLE_D_H +#define PG_FOREIGN_TABLE_D_H + +/* Macros related to the structure of pg_foreign_table */ + +#define ForeignTableRelationId 3118 +#define ForeignTableRelidIndexId 3119 + +#define Anum_pg_foreign_table_ftrelid 1 +#define Anum_pg_foreign_table_ftserver 2 +#define Anum_pg_foreign_table_ftoptions 3 + +#define Natts_pg_foreign_table 3 + +/* Definitions copied from pg_foreign_table.h */ + + +/* OID symbols for objects defined in pg_foreign_table.dat */ + + +#endif /* PG_FOREIGN_TABLE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_index.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_index.h new file mode 100644 index 0000000..731d393 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_index.h @@ -0,0 +1,94 @@ +/*------------------------------------------------------------------------- + * + * pg_index.h + * definition of the "index" system catalog (pg_index) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_index.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INDEX_H +#define PG_INDEX_H + +#include "catalog/genbki.h" +#include "catalog/pg_index_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_index definition. cpp turns this into + * typedef struct FormData_pg_index. + * ---------------- + */ +CATALOG(pg_index,2610,IndexRelationId) BKI_SCHEMA_MACRO +{ + Oid indexrelid BKI_LOOKUP(pg_class); /* OID of the index */ + Oid indrelid BKI_LOOKUP(pg_class); /* OID of the relation it + * indexes */ + int16 indnatts; /* total number of columns in index */ + int16 indnkeyatts; /* number of key columns in index */ + bool indisunique; /* is this a unique index? */ + bool indnullsnotdistinct; /* null treatment in unique index */ + bool indisprimary; /* is this index for primary key? */ + bool indisexclusion; /* is this index for exclusion constraint? */ + bool indimmediate; /* is uniqueness enforced immediately? */ + bool indisclustered; /* is this the index last clustered by? */ + bool indisvalid; /* is this index valid for use by queries? */ + bool indcheckxmin; /* must we wait for xmin to be old? */ + bool indisready; /* is this index ready for inserts? */ + bool indislive; /* is this index alive at all? */ + bool indisreplident; /* is this index the identity for replication? */ + + /* variable-length fields start here, but we allow direct access to indkey */ + int2vector indkey BKI_FORCE_NOT_NULL; /* column numbers of indexed cols, + * or 0 */ + +#ifdef CATALOG_VARLEN + oidvector indcollation BKI_LOOKUP_OPT(pg_collation) BKI_FORCE_NOT_NULL; /* collation identifiers */ + oidvector indclass BKI_LOOKUP(pg_opclass) BKI_FORCE_NOT_NULL; /* opclass identifiers */ + int2vector indoption BKI_FORCE_NOT_NULL; /* per-column flags + * (AM-specific meanings) */ + pg_node_tree indexprs; /* expression trees for index attributes that + * are not simple column references; one for + * each zero entry in indkey[] */ + pg_node_tree indpred; /* expression tree for predicate, if a partial + * index; else NULL */ +#endif +} FormData_pg_index; + +/* ---------------- + * Form_pg_index corresponds to a pointer to a tuple with + * the format of pg_index relation. + * ---------------- + */ +typedef FormData_pg_index *Form_pg_index; + +DECLARE_TOAST_WITH_MACRO(pg_index, 6351, 6352, PgIndexToastTable, PgIndexToastIndex); + +DECLARE_INDEX(pg_index_indrelid_index, 2678, IndexIndrelidIndexId, pg_index, btree(indrelid oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_index_indexrelid_index, 2679, IndexRelidIndexId, pg_index, btree(indexrelid oid_ops)); + +MAKE_SYSCACHE(INDEXRELID, pg_index_indexrelid_index, 64); + +/* indkey can contain zero (InvalidAttrNumber) to represent expressions */ +DECLARE_ARRAY_FOREIGN_KEY_OPT((indrelid, indkey), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Index AMs that support ordered scans must support these two indoption + * bits. Otherwise, the content of the per-column indoption fields is + * open for future definition. + */ +#define INDOPTION_DESC 0x0001 /* values are in reverse order */ +#define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_INDEX_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_index_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_index_d.h new file mode 100644 index 0000000..bb923ea --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_index_d.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------------------- + * + * pg_index_d.h + * Macro definitions for pg_index + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INDEX_D_H +#define PG_INDEX_D_H + +/* Macros related to the structure of pg_index */ + +#define IndexRelationId 2610 +#define PgIndexToastTable 6351 +#define PgIndexToastIndex 6352 +#define IndexIndrelidIndexId 2678 +#define IndexRelidIndexId 2679 + +#define Anum_pg_index_indexrelid 1 +#define Anum_pg_index_indrelid 2 +#define Anum_pg_index_indnatts 3 +#define Anum_pg_index_indnkeyatts 4 +#define Anum_pg_index_indisunique 5 +#define Anum_pg_index_indnullsnotdistinct 6 +#define Anum_pg_index_indisprimary 7 +#define Anum_pg_index_indisexclusion 8 +#define Anum_pg_index_indimmediate 9 +#define Anum_pg_index_indisclustered 10 +#define Anum_pg_index_indisvalid 11 +#define Anum_pg_index_indcheckxmin 12 +#define Anum_pg_index_indisready 13 +#define Anum_pg_index_indislive 14 +#define Anum_pg_index_indisreplident 15 +#define Anum_pg_index_indkey 16 +#define Anum_pg_index_indcollation 17 +#define Anum_pg_index_indclass 18 +#define Anum_pg_index_indoption 19 +#define Anum_pg_index_indexprs 20 +#define Anum_pg_index_indpred 21 + +#define Natts_pg_index 21 + +/* Definitions copied from pg_index.h */ + + +/* + * Index AMs that support ordered scans must support these two indoption + * bits. Otherwise, the content of the per-column indoption fields is + * open for future definition. + */ +#define INDOPTION_DESC 0x0001 /* values are in reverse order */ +#define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */ + + +/* OID symbols for objects defined in pg_index.dat */ + + +#endif /* PG_INDEX_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_inherits.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_inherits.h new file mode 100644 index 0000000..1d6765a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_inherits.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * pg_inherits.h + * definition of the "inherits" system catalog (pg_inherits) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_inherits.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INHERITS_H +#define PG_INHERITS_H + +#include "catalog/genbki.h" +#include "catalog/pg_inherits_d.h" /* IWYU pragma: export */ + +#include "nodes/pg_list.h" +#include "storage/lock.h" + +/* ---------------- + * pg_inherits definition. cpp turns this into + * typedef struct FormData_pg_inherits + * ---------------- + */ +CATALOG(pg_inherits,2611,InheritsRelationId) +{ + Oid inhrelid BKI_LOOKUP(pg_class); + Oid inhparent BKI_LOOKUP(pg_class); + int32 inhseqno; + bool inhdetachpending; +} FormData_pg_inherits; + +/* ---------------- + * Form_pg_inherits corresponds to a pointer to a tuple with + * the format of pg_inherits relation. + * ---------------- + */ +typedef FormData_pg_inherits *Form_pg_inherits; + +DECLARE_UNIQUE_INDEX_PKEY(pg_inherits_relid_seqno_index, 2680, InheritsRelidSeqnoIndexId, pg_inherits, btree(inhrelid oid_ops, inhseqno int4_ops)); +DECLARE_INDEX(pg_inherits_parent_index, 2187, InheritsParentIndexId, pg_inherits, btree(inhparent oid_ops)); + + +extern List *find_inheritance_children(Oid parentrelId, LOCKMODE lockmode); +extern List *find_inheritance_children_extended(Oid parentrelId, bool omit_detached, + LOCKMODE lockmode, bool *detached_exist, TransactionId *detached_xmin); + +extern List *find_all_inheritors(Oid parentrelId, LOCKMODE lockmode, + List **numparents); +extern bool has_subclass(Oid relationId); +extern bool has_superclass(Oid relationId); +extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId); +extern void StoreSingleInheritance(Oid relationId, Oid parentOid, + int32 seqNumber); +extern bool DeleteInheritsTuple(Oid inhrelid, Oid inhparent, + bool expect_detach_pending, + const char *childname); +extern bool PartitionHasPendingDetach(Oid partoid); + +#endif /* PG_INHERITS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_inherits_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_inherits_d.h new file mode 100644 index 0000000..626dbcc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_inherits_d.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * pg_inherits_d.h + * Macro definitions for pg_inherits + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INHERITS_D_H +#define PG_INHERITS_D_H + +/* Macros related to the structure of pg_inherits */ + +#define InheritsRelationId 2611 +#define InheritsRelidSeqnoIndexId 2680 +#define InheritsParentIndexId 2187 + +#define Anum_pg_inherits_inhrelid 1 +#define Anum_pg_inherits_inhparent 2 +#define Anum_pg_inherits_inhseqno 3 +#define Anum_pg_inherits_inhdetachpending 4 + +#define Natts_pg_inherits 4 + +/* Definitions copied from pg_inherits.h */ + + +/* OID symbols for objects defined in pg_inherits.dat */ + + +#endif /* PG_INHERITS_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_init_privs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_init_privs.h new file mode 100644 index 0000000..594efff --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_init_privs.h @@ -0,0 +1,83 @@ +/*------------------------------------------------------------------------- + * + * pg_init_privs.h + * definition of the "initial privileges" system catalog (pg_init_privs) + * + * NOTE: an object is identified by the OID of the row that primarily + * defines the object, plus the OID of the table that that row appears in. + * For example, a function is identified by the OID of its pg_proc row + * plus the pg_class OID of table pg_proc. This allows unique identification + * of objects without assuming that OIDs are unique across tables. + * + * Since attributes don't have OIDs of their own, we identify an attribute + * privilege by the objoid+classoid of its parent table, plus an "objsubid" + * giving the attribute column number. "objsubid" must be zero in a privilege + * for a table itself, so that it is distinct from any column privilege. + * Currently, objsubid is unused and zero for all other kinds of objects. + * + * Because the contents of this table depend on what is done with the other + * objects in the system (and, in particular, may change due to changes in + * system_views.sql), there is no pg_init_privs.dat file. The initial contents + * are loaded near the end of initdb. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_init_privs.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INIT_PRIVS_H +#define PG_INIT_PRIVS_H + +#include "catalog/genbki.h" +#include "catalog/pg_init_privs_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_init_privs definition. cpp turns this into + * typedef struct FormData_pg_init_privs + * ---------------- + */ +CATALOG(pg_init_privs,3394,InitPrivsRelationId) +{ + Oid objoid; /* OID of object itself */ + Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + int32 objsubid; /* column number, or 0 if not used */ + char privtype; /* from initdb or extension? */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem initprivs[1] BKI_FORCE_NOT_NULL; /* initial privs on object */ +#endif +} FormData_pg_init_privs; + +/* ---------------- + * Form_pg_init_privs corresponds to a pointer to a tuple with + * the format of pg_init_privs relation. + * ---------------- + */ +typedef FormData_pg_init_privs * Form_pg_init_privs; + +DECLARE_TOAST(pg_init_privs, 4155, 4156); + +DECLARE_UNIQUE_INDEX_PKEY(pg_init_privs_o_c_o_index, 3395, InitPrivsObjIndexId, pg_init_privs, btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops)); + +/* + * It is important to know if the initial privileges are from initdb or from an + * extension. This enum is used to provide that differentiation and the two + * places which populate this table (initdb and during CREATE EXTENSION, see + * recordExtensionInitPriv()) know to use the correct values. + */ + +typedef enum InitPrivsType +{ + INITPRIVS_INITDB = 'i', + INITPRIVS_EXTENSION = 'e', +} InitPrivsType; + +#endif /* PG_INIT_PRIVS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_init_privs_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_init_privs_d.h new file mode 100644 index 0000000..50ae715 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_init_privs_d.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * pg_init_privs_d.h + * Macro definitions for pg_init_privs + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INIT_PRIVS_D_H +#define PG_INIT_PRIVS_D_H + +/* Macros related to the structure of pg_init_privs */ + +#define InitPrivsRelationId 3394 +#define InitPrivsObjIndexId 3395 + +#define Anum_pg_init_privs_objoid 1 +#define Anum_pg_init_privs_classoid 2 +#define Anum_pg_init_privs_objsubid 3 +#define Anum_pg_init_privs_privtype 4 +#define Anum_pg_init_privs_initprivs 5 + +#define Natts_pg_init_privs 5 + +/* Definitions copied from pg_init_privs.h */ + + +/* OID symbols for objects defined in pg_init_privs.dat */ + + +#endif /* PG_INIT_PRIVS_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_language.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_language.h new file mode 100644 index 0000000..3558b99 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_language.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * pg_language.h + * definition of the "language" system catalog (pg_language) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_language.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LANGUAGE_H +#define PG_LANGUAGE_H + +#include "catalog/genbki.h" +#include "catalog/pg_language_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_language definition. cpp turns this into + * typedef struct FormData_pg_language + * ---------------- + */ +CATALOG(pg_language,2612,LanguageRelationId) +{ + Oid oid; /* oid */ + + /* Language name */ + NameData lanname; + + /* Language's owner */ + Oid lanowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* Is a procedural language */ + bool lanispl BKI_DEFAULT(f); + + /* PL is trusted */ + bool lanpltrusted BKI_DEFAULT(f); + + /* Call handler, if it's a PL */ + Oid lanplcallfoid BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc); + + /* Optional anonymous-block handler function */ + Oid laninline BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc); + + /* Optional validation function */ + Oid lanvalidator BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* Access privileges */ + aclitem lanacl[1] BKI_DEFAULT(_null_); +#endif +} FormData_pg_language; + +/* ---------------- + * Form_pg_language corresponds to a pointer to a tuple with + * the format of pg_language relation. + * ---------------- + */ +typedef FormData_pg_language *Form_pg_language; + +DECLARE_TOAST(pg_language, 4157, 4158); + +DECLARE_UNIQUE_INDEX(pg_language_name_index, 2681, LanguageNameIndexId, pg_language, btree(lanname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_language_oid_index, 2682, LanguageOidIndexId, pg_language, btree(oid oid_ops)); + +MAKE_SYSCACHE(LANGNAME, pg_language_name_index, 4); +MAKE_SYSCACHE(LANGOID, pg_language_oid_index, 4); + +#endif /* PG_LANGUAGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_language_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_language_d.h new file mode 100644 index 0000000..f30275f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_language_d.h @@ -0,0 +1,48 @@ +/*------------------------------------------------------------------------- + * + * pg_language_d.h + * Macro definitions for pg_language + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LANGUAGE_D_H +#define PG_LANGUAGE_D_H + +/* Macros related to the structure of pg_language */ + +#define LanguageRelationId 2612 +#define LanguageNameIndexId 2681 +#define LanguageOidIndexId 2682 + +#define Anum_pg_language_oid 1 +#define Anum_pg_language_lanname 2 +#define Anum_pg_language_lanowner 3 +#define Anum_pg_language_lanispl 4 +#define Anum_pg_language_lanpltrusted 5 +#define Anum_pg_language_lanplcallfoid 6 +#define Anum_pg_language_laninline 7 +#define Anum_pg_language_lanvalidator 8 +#define Anum_pg_language_lanacl 9 + +#define Natts_pg_language 9 + +/* Definitions copied from pg_language.h */ + + +/* OID symbols for objects defined in pg_language.dat */ + +#define INTERNALlanguageId 12 +#define ClanguageId 13 +#define SQLlanguageId 14 + +#endif /* PG_LANGUAGE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject.h new file mode 100644 index 0000000..42971bf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject.h + * definition of the "large object" system catalog (pg_largeobject) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_largeobject.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_H +#define PG_LARGEOBJECT_H + +#include "catalog/genbki.h" +#include "catalog/pg_largeobject_d.h" /* IWYU pragma: export */ +#include "utils/snapshot.h" + +/* ---------------- + * pg_largeobject definition. cpp turns this into + * typedef struct FormData_pg_largeobject + * ---------------- + */ +CATALOG(pg_largeobject,2613,LargeObjectRelationId) +{ + Oid loid BKI_LOOKUP(pg_largeobject_metadata); /* Identifier of large + * object */ + int32 pageno; /* Page number (starting from 0) */ + + /* data has variable length, but we allow direct access; see inv_api.c */ + bytea data BKI_FORCE_NOT_NULL; /* Data for page (may be + * zero-length) */ +} FormData_pg_largeobject; + +/* ---------------- + * Form_pg_largeobject corresponds to a pointer to a tuple with + * the format of pg_largeobject relation. + * ---------------- + */ +typedef FormData_pg_largeobject *Form_pg_largeobject; + +DECLARE_UNIQUE_INDEX_PKEY(pg_largeobject_loid_pn_index, 2683, LargeObjectLOidPNIndexId, pg_largeobject, btree(loid oid_ops, pageno int4_ops)); + +extern Oid LargeObjectCreate(Oid loid); +extern void LargeObjectDrop(Oid loid); +extern bool LargeObjectExists(Oid loid); +extern bool LargeObjectExistsWithSnapshot(Oid loid, Snapshot snapshot); + +#endif /* PG_LARGEOBJECT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject_d.h new file mode 100644 index 0000000..667cf95 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject_d.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject_d.h + * Macro definitions for pg_largeobject + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_D_H +#define PG_LARGEOBJECT_D_H + +/* Macros related to the structure of pg_largeobject */ + +#define LargeObjectRelationId 2613 +#define LargeObjectLOidPNIndexId 2683 + +#define Anum_pg_largeobject_loid 1 +#define Anum_pg_largeobject_pageno 2 +#define Anum_pg_largeobject_data 3 + +#define Natts_pg_largeobject 3 + +/* Definitions copied from pg_largeobject.h */ + + +/* OID symbols for objects defined in pg_largeobject.dat */ + + +#endif /* PG_LARGEOBJECT_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject_metadata.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject_metadata.h new file mode 100644 index 0000000..e618cd5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject_metadata.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject_metadata.h + * definition of the "large object metadata" system catalog + * (pg_largeobject_metadata) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_largeobject_metadata.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_METADATA_H +#define PG_LARGEOBJECT_METADATA_H + +#include "catalog/genbki.h" +#include "catalog/pg_largeobject_metadata_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_largeobject_metadata definition. cpp turns this into + * typedef struct FormData_pg_largeobject_metadata + * ---------------- + */ +CATALOG(pg_largeobject_metadata,2995,LargeObjectMetadataRelationId) +{ + Oid oid; /* oid */ + + Oid lomowner BKI_LOOKUP(pg_authid); /* OID of the largeobject + * owner */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem lomacl[1]; /* access permissions */ +#endif +} FormData_pg_largeobject_metadata; + +/* ---------------- + * Form_pg_largeobject_metadata corresponds to a pointer to a tuple + * with the format of pg_largeobject_metadata relation. + * ---------------- + */ +typedef FormData_pg_largeobject_metadata *Form_pg_largeobject_metadata; + +DECLARE_UNIQUE_INDEX_PKEY(pg_largeobject_metadata_oid_index, 2996, LargeObjectMetadataOidIndexId, pg_largeobject_metadata, btree(oid oid_ops)); + +#endif /* PG_LARGEOBJECT_METADATA_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject_metadata_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject_metadata_d.h new file mode 100644 index 0000000..8c6aa43 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_largeobject_metadata_d.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject_metadata_d.h + * Macro definitions for pg_largeobject_metadata + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_METADATA_D_H +#define PG_LARGEOBJECT_METADATA_D_H + +/* Macros related to the structure of pg_largeobject_metadata */ + +#define LargeObjectMetadataRelationId 2995 +#define LargeObjectMetadataOidIndexId 2996 + +#define Anum_pg_largeobject_metadata_oid 1 +#define Anum_pg_largeobject_metadata_lomowner 2 +#define Anum_pg_largeobject_metadata_lomacl 3 + +#define Natts_pg_largeobject_metadata 3 + +/* Definitions copied from pg_largeobject_metadata.h */ + + +/* OID symbols for objects defined in pg_largeobject_metadata.dat */ + + +#endif /* PG_LARGEOBJECT_METADATA_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_namespace.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_namespace.h new file mode 100644 index 0000000..affb36f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_namespace.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * pg_namespace.h + * definition of the "namespace" system catalog (pg_namespace) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_namespace.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_NAMESPACE_H +#define PG_NAMESPACE_H + +#include "catalog/genbki.h" +#include "catalog/pg_namespace_d.h" /* IWYU pragma: export */ +#include "utils/acl.h" + +/* ---------------------------------------------------------------- + * pg_namespace definition. + * + * cpp turns this into typedef struct FormData_pg_namespace + * + * nspname name of the namespace + * nspowner owner (creator) of the namespace + * nspacl access privilege list + * ---------------------------------------------------------------- + */ +CATALOG(pg_namespace,2615,NamespaceRelationId) +{ + Oid oid; /* oid */ + + NameData nspname; + Oid nspowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem nspacl[1]; +#endif +} FormData_pg_namespace; + +/* ---------------- + * Form_pg_namespace corresponds to a pointer to a tuple with + * the format of pg_namespace relation. + * ---------------- + */ +typedef FormData_pg_namespace *Form_pg_namespace; + +DECLARE_TOAST(pg_namespace, 4163, 4164); + +DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index, 2684, NamespaceNameIndexId, pg_namespace, btree(nspname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_namespace_oid_index, 2685, NamespaceOidIndexId, pg_namespace, btree(oid oid_ops)); + +MAKE_SYSCACHE(NAMESPACENAME, pg_namespace_nspname_index, 4); +MAKE_SYSCACHE(NAMESPACEOID, pg_namespace_oid_index, 16); + +/* + * prototypes for functions in pg_namespace.c + */ +extern Oid NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp); + +#endif /* PG_NAMESPACE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_namespace_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_namespace_d.h new file mode 100644 index 0000000..f4c5057 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_namespace_d.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * pg_namespace_d.h + * Macro definitions for pg_namespace + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_NAMESPACE_D_H +#define PG_NAMESPACE_D_H + +/* Macros related to the structure of pg_namespace */ + +#define NamespaceRelationId 2615 +#define NamespaceNameIndexId 2684 +#define NamespaceOidIndexId 2685 + +#define Anum_pg_namespace_oid 1 +#define Anum_pg_namespace_nspname 2 +#define Anum_pg_namespace_nspowner 3 +#define Anum_pg_namespace_nspacl 4 + +#define Natts_pg_namespace 4 + +/* Definitions copied from pg_namespace.h */ + + +/* OID symbols for objects defined in pg_namespace.dat */ + +#define PG_CATALOG_NAMESPACE 11 +#define PG_TOAST_NAMESPACE 99 +#define PG_PUBLIC_NAMESPACE 2200 + +#endif /* PG_NAMESPACE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opclass.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opclass.h new file mode 100644 index 0000000..cb63bd9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opclass.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------------------- + * + * pg_opclass.h + * definition of the "operator class" system catalog (pg_opclass) + * + * The primary key for this table is --- + * that is, there is a row for each valid combination of opclass name and + * index access method type. This row specifies the expected input data type + * for the opclass (the type of the heap column, or the expression output type + * in the case of an index expression). Note that types binary-coercible to + * the specified type will be accepted too. + * + * For a given pair, there can be at most one row that + * has opcdefault = true; this row is the default opclass for such data in + * such an index. (This is not currently enforced by an index, because we + * don't support partial indexes on system catalogs.) + * + * Normally opckeytype = InvalidOid (zero), indicating that the data stored + * in the index is the same as the data in the indexed column. If opckeytype + * is nonzero then it indicates that a conversion step is needed to produce + * the stored index data, which will be of type opckeytype (which might be + * the same or different from the input datatype). Performing such a + * conversion is the responsibility of the index access method --- not all + * AMs support this. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_opclass.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPCLASS_H +#define PG_OPCLASS_H + +#include "catalog/genbki.h" +#include "catalog/pg_opclass_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_opclass definition. cpp turns this into + * typedef struct FormData_pg_opclass + * ---------------- + */ +CATALOG(pg_opclass,2616,OperatorClassRelationId) +{ + Oid oid; /* oid */ + + /* index access method opclass is for */ + Oid opcmethod BKI_LOOKUP(pg_am); + + /* name of this opclass */ + NameData opcname; + + /* namespace of this opclass */ + Oid opcnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* opclass owner */ + Oid opcowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* containing operator family */ + Oid opcfamily BKI_LOOKUP(pg_opfamily); + + /* type of data indexed by opclass */ + Oid opcintype BKI_LOOKUP(pg_type); + + /* T if opclass is default for opcintype */ + bool opcdefault BKI_DEFAULT(t); + + /* type of data in index, or InvalidOid if same as input column type */ + Oid opckeytype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); +} FormData_pg_opclass; + +/* ---------------- + * Form_pg_opclass corresponds to a pointer to a tuple with + * the format of pg_opclass relation. + * ---------------- + */ +typedef FormData_pg_opclass *Form_pg_opclass; + +DECLARE_UNIQUE_INDEX(pg_opclass_am_name_nsp_index, 2686, OpclassAmNameNspIndexId, pg_opclass, btree(opcmethod oid_ops, opcname name_ops, opcnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_opclass_oid_index, 2687, OpclassOidIndexId, pg_opclass, btree(oid oid_ops)); + +MAKE_SYSCACHE(CLAAMNAMENSP, pg_opclass_am_name_nsp_index, 8); +MAKE_SYSCACHE(CLAOID, pg_opclass_oid_index, 8); + +#endif /* PG_OPCLASS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opclass_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opclass_d.h new file mode 100644 index 0000000..e363ee6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opclass_d.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_opclass_d.h + * Macro definitions for pg_opclass + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPCLASS_D_H +#define PG_OPCLASS_D_H + +/* Macros related to the structure of pg_opclass */ + +#define OperatorClassRelationId 2616 +#define OpclassAmNameNspIndexId 2686 +#define OpclassOidIndexId 2687 + +#define Anum_pg_opclass_oid 1 +#define Anum_pg_opclass_opcmethod 2 +#define Anum_pg_opclass_opcname 3 +#define Anum_pg_opclass_opcnamespace 4 +#define Anum_pg_opclass_opcowner 5 +#define Anum_pg_opclass_opcfamily 6 +#define Anum_pg_opclass_opcintype 7 +#define Anum_pg_opclass_opcdefault 8 +#define Anum_pg_opclass_opckeytype 9 + +#define Natts_pg_opclass 9 + +/* Definitions copied from pg_opclass.h */ + + +/* OID symbols for objects defined in pg_opclass.dat */ + +#define DATE_BTREE_OPS_OID 3122 +#define FLOAT8_BTREE_OPS_OID 3123 +#define INT2_BTREE_OPS_OID 1979 +#define INT4_BTREE_OPS_OID 1978 +#define INT8_BTREE_OPS_OID 3124 +#define NUMERIC_BTREE_OPS_OID 3125 +#define OID_BTREE_OPS_OID 1981 +#define TEXT_BTREE_OPS_OID 3126 +#define TIMESTAMPTZ_BTREE_OPS_OID 3127 +#define TIMESTAMP_BTREE_OPS_OID 3128 +#define TEXT_BTREE_PATTERN_OPS_OID 4217 +#define VARCHAR_BTREE_PATTERN_OPS_OID 4218 +#define BPCHAR_BTREE_PATTERN_OPS_OID 4219 + +#endif /* PG_OPCLASS_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_operator.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_operator.h new file mode 100644 index 0000000..c3ddfb2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_operator.h @@ -0,0 +1,124 @@ +/*------------------------------------------------------------------------- + * + * pg_operator.h + * definition of the "operator" system catalog (pg_operator) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_operator.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPERATOR_H +#define PG_OPERATOR_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_operator_d.h" /* IWYU pragma: export */ +#include "nodes/pg_list.h" + +/* ---------------- + * pg_operator definition. cpp turns this into + * typedef struct FormData_pg_operator + * ---------------- + */ +CATALOG(pg_operator,2617,OperatorRelationId) +{ + Oid oid; /* oid */ + + /* name of operator */ + NameData oprname; + + /* OID of namespace containing this oper */ + Oid oprnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* operator owner */ + Oid oprowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* 'l' for prefix or 'b' for infix */ + char oprkind BKI_DEFAULT(b); + + /* can be used in merge join? */ + bool oprcanmerge BKI_DEFAULT(f); + + /* can be used in hash join? */ + bool oprcanhash BKI_DEFAULT(f); + + /* left arg type, or 0 if prefix operator */ + Oid oprleft BKI_LOOKUP_OPT(pg_type); + + /* right arg type */ + Oid oprright BKI_LOOKUP(pg_type); + + /* result datatype; can be 0 in a "shell" operator */ + Oid oprresult BKI_LOOKUP_OPT(pg_type); + + /* OID of commutator oper, or 0 if none */ + Oid oprcom BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator); + + /* OID of negator oper, or 0 if none */ + Oid oprnegate BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator); + + /* OID of underlying function; can be 0 in a "shell" operator */ + regproc oprcode BKI_LOOKUP_OPT(pg_proc); + + /* OID of restriction estimator, or 0 */ + regproc oprrest BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* OID of join estimator, or 0 */ + regproc oprjoin BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); +} FormData_pg_operator; + +/* ---------------- + * Form_pg_operator corresponds to a pointer to a tuple with + * the format of pg_operator relation. + * ---------------- + */ +typedef FormData_pg_operator *Form_pg_operator; + +DECLARE_UNIQUE_INDEX_PKEY(pg_operator_oid_index, 2688, OperatorOidIndexId, pg_operator, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index, 2689, OperatorNameNspIndexId, pg_operator, btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops)); + +MAKE_SYSCACHE(OPEROID, pg_operator_oid_index, 32); +MAKE_SYSCACHE(OPERNAMENSP, pg_operator_oprname_l_r_n_index, 256); + +extern Oid OperatorLookup(List *operatorName, + Oid leftObjectId, + Oid rightObjectId, + bool *defined); + +extern ObjectAddress OperatorCreate(const char *operatorName, + Oid operatorNamespace, + Oid leftTypeId, + Oid rightTypeId, + Oid procedureId, + List *commutatorName, + List *negatorName, + Oid restrictionId, + Oid joinId, + bool canMerge, + bool canHash); + +extern ObjectAddress makeOperatorDependencies(HeapTuple tuple, + bool makeExtensionDep, + bool isUpdate); + +extern void OperatorValidateParams(Oid leftTypeId, + Oid rightTypeId, + Oid operResultType, + bool hasCommutator, + bool hasNegator, + bool hasRestrictionSelectivity, + bool hasJoinSelectivity, + bool canMerge, + bool canHash); + +extern void OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete); + +#endif /* PG_OPERATOR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_operator_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_operator_d.h new file mode 100644 index 0000000..f0074be --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_operator_d.h @@ -0,0 +1,151 @@ +/*------------------------------------------------------------------------- + * + * pg_operator_d.h + * Macro definitions for pg_operator + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPERATOR_D_H +#define PG_OPERATOR_D_H + +/* Macros related to the structure of pg_operator */ + +#define OperatorRelationId 2617 +#define OperatorOidIndexId 2688 +#define OperatorNameNspIndexId 2689 + +#define Anum_pg_operator_oid 1 +#define Anum_pg_operator_oprname 2 +#define Anum_pg_operator_oprnamespace 3 +#define Anum_pg_operator_oprowner 4 +#define Anum_pg_operator_oprkind 5 +#define Anum_pg_operator_oprcanmerge 6 +#define Anum_pg_operator_oprcanhash 7 +#define Anum_pg_operator_oprleft 8 +#define Anum_pg_operator_oprright 9 +#define Anum_pg_operator_oprresult 10 +#define Anum_pg_operator_oprcom 11 +#define Anum_pg_operator_oprnegate 12 +#define Anum_pg_operator_oprcode 13 +#define Anum_pg_operator_oprrest 14 +#define Anum_pg_operator_oprjoin 15 + +#define Natts_pg_operator 15 + +/* Definitions copied from pg_operator.h */ + + +/* OID symbols for objects defined in pg_operator.dat */ + +#define BooleanNotEqualOperator 85 +#define BooleanEqualOperator 91 +#define Int4EqualOperator 96 +#define Int4LessOperator 97 +#define TextEqualOperator 98 +#define TextPrefixOperator 3877 +#define NameEqualTextOperator 254 +#define NameLessTextOperator 255 +#define NameGreaterEqualTextOperator 257 +#define TIDEqualOperator 387 +#define TIDLessOperator 2799 +#define TIDGreaterOperator 2800 +#define TIDLessEqOperator 2801 +#define TIDGreaterEqOperator 2802 +#define Int8LessOperator 412 +#define OID_NAME_REGEXEQ_OP 639 +#define OID_TEXT_REGEXEQ_OP 641 +#define TextLessOperator 664 +#define TextGreaterEqualOperator 667 +#define Float8LessOperator 672 +#define BpcharEqualOperator 1054 +#define OID_BPCHAR_REGEXEQ_OP 1055 +#define BpcharLessOperator 1058 +#define BpcharGreaterEqualOperator 1061 +#define ARRAY_EQ_OP 1070 +#define ARRAY_LT_OP 1072 +#define ARRAY_GT_OP 1073 +#define OID_NAME_LIKE_OP 1207 +#define OID_TEXT_LIKE_OP 1209 +#define OID_BPCHAR_LIKE_OP 1211 +#define OID_NAME_ICREGEXEQ_OP 1226 +#define OID_TEXT_ICREGEXEQ_OP 1228 +#define OID_BPCHAR_ICREGEXEQ_OP 1234 +#define OID_INET_SUB_OP 931 +#define OID_INET_SUBEQ_OP 932 +#define OID_INET_SUP_OP 933 +#define OID_INET_SUPEQ_OP 934 +#define OID_INET_OVERLAP_OP 3552 +#define OID_NAME_ICLIKE_OP 1625 +#define OID_TEXT_ICLIKE_OP 1627 +#define OID_BPCHAR_ICLIKE_OP 1629 +#define ByteaEqualOperator 1955 +#define ByteaLessOperator 1957 +#define ByteaGreaterEqualOperator 1960 +#define OID_BYTEA_LIKE_OP 2016 +#define TextPatternLessOperator 2314 +#define TextPatternGreaterEqualOperator 2317 +#define BpcharPatternLessOperator 2326 +#define BpcharPatternGreaterEqualOperator 2329 +#define OID_ARRAY_OVERLAP_OP 2750 +#define OID_ARRAY_CONTAINS_OP 2751 +#define OID_ARRAY_CONTAINED_OP 2752 +#define RECORD_EQ_OP 2988 +#define RECORD_LT_OP 2990 +#define RECORD_GT_OP 2991 +#define OID_RANGE_LESS_OP 3884 +#define OID_RANGE_LESS_EQUAL_OP 3885 +#define OID_RANGE_GREATER_EQUAL_OP 3886 +#define OID_RANGE_GREATER_OP 3887 +#define OID_RANGE_OVERLAP_OP 3888 +#define OID_RANGE_CONTAINS_ELEM_OP 3889 +#define OID_RANGE_CONTAINS_OP 3890 +#define OID_RANGE_ELEM_CONTAINED_OP 3891 +#define OID_RANGE_CONTAINED_OP 3892 +#define OID_RANGE_LEFT_OP 3893 +#define OID_RANGE_RIGHT_OP 3894 +#define OID_RANGE_OVERLAPS_LEFT_OP 3895 +#define OID_RANGE_OVERLAPS_RIGHT_OP 3896 +#define OID_RANGE_INTERSECT_RANGE_OP 3900 +#define OID_MULTIRANGE_LESS_OP 2862 +#define OID_MULTIRANGE_LESS_EQUAL_OP 2863 +#define OID_MULTIRANGE_GREATER_EQUAL_OP 2864 +#define OID_MULTIRANGE_GREATER_OP 2865 +#define OID_RANGE_OVERLAPS_MULTIRANGE_OP 2866 +#define OID_MULTIRANGE_OVERLAPS_RANGE_OP 2867 +#define OID_MULTIRANGE_OVERLAPS_MULTIRANGE_OP 2868 +#define OID_MULTIRANGE_CONTAINS_ELEM_OP 2869 +#define OID_MULTIRANGE_CONTAINS_RANGE_OP 2870 +#define OID_MULTIRANGE_CONTAINS_MULTIRANGE_OP 2871 +#define OID_MULTIRANGE_ELEM_CONTAINED_OP 2872 +#define OID_MULTIRANGE_RANGE_CONTAINED_OP 2873 +#define OID_MULTIRANGE_MULTIRANGE_CONTAINED_OP 2874 +#define OID_RANGE_CONTAINS_MULTIRANGE_OP 4539 +#define OID_RANGE_MULTIRANGE_CONTAINED_OP 4540 +#define OID_RANGE_OVERLAPS_LEFT_MULTIRANGE_OP 2875 +#define OID_MULTIRANGE_OVERLAPS_LEFT_RANGE_OP 2876 +#define OID_MULTIRANGE_OVERLAPS_LEFT_MULTIRANGE_OP 2877 +#define OID_RANGE_OVERLAPS_RIGHT_MULTIRANGE_OP 3585 +#define OID_MULTIRANGE_OVERLAPS_RIGHT_RANGE_OP 4035 +#define OID_MULTIRANGE_OVERLAPS_RIGHT_MULTIRANGE_OP 4142 +#define OID_RANGE_ADJACENT_MULTIRANGE_OP 4179 +#define OID_MULTIRANGE_ADJACENT_RANGE_OP 4180 +#define OID_MULTIRANGE_ADJACENT_MULTIRANGE_OP 4198 +#define OID_MULTIRANGE_INTERSECT_MULTIRANGE_OP 4394 +#define OID_RANGE_LEFT_MULTIRANGE_OP 4395 +#define OID_MULTIRANGE_LEFT_RANGE_OP 4396 +#define OID_MULTIRANGE_LEFT_MULTIRANGE_OP 4397 +#define OID_RANGE_RIGHT_MULTIRANGE_OP 4398 +#define OID_MULTIRANGE_RIGHT_RANGE_OP 4399 +#define OID_MULTIRANGE_RIGHT_MULTIRANGE_OP 4400 + +#endif /* PG_OPERATOR_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opfamily.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opfamily.h new file mode 100644 index 0000000..7472e7e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opfamily.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * pg_opfamily.h + * definition of the "operator family" system catalog (pg_opfamily) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_opfamily.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPFAMILY_H +#define PG_OPFAMILY_H + +#include "catalog/genbki.h" +#include "catalog/pg_opfamily_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_opfamily definition. cpp turns this into + * typedef struct FormData_pg_opfamily + * ---------------- + */ +CATALOG(pg_opfamily,2753,OperatorFamilyRelationId) +{ + Oid oid; /* oid */ + + /* index access method opfamily is for */ + Oid opfmethod BKI_LOOKUP(pg_am); + + /* name of this opfamily */ + NameData opfname; + + /* namespace of this opfamily */ + Oid opfnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* opfamily owner */ + Oid opfowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); +} FormData_pg_opfamily; + +/* ---------------- + * Form_pg_opfamily corresponds to a pointer to a tuple with + * the format of pg_opfamily relation. + * ---------------- + */ +typedef FormData_pg_opfamily *Form_pg_opfamily; + +DECLARE_UNIQUE_INDEX(pg_opfamily_am_name_nsp_index, 2754, OpfamilyAmNameNspIndexId, pg_opfamily, btree(opfmethod oid_ops, opfname name_ops, opfnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_opfamily_oid_index, 2755, OpfamilyOidIndexId, pg_opfamily, btree(oid oid_ops)); + +MAKE_SYSCACHE(OPFAMILYAMNAMENSP, pg_opfamily_am_name_nsp_index, 8); +MAKE_SYSCACHE(OPFAMILYOID, pg_opfamily_oid_index, 8); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* This does not account for non-core opfamilies that might accept boolean */ +#define IsBuiltinBooleanOpfamily(opfamily) \ + ((opfamily) == BOOL_BTREE_FAM_OID || (opfamily) == BOOL_HASH_FAM_OID) + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_OPFAMILY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opfamily_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opfamily_d.h new file mode 100644 index 0000000..4487bee --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_opfamily_d.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_opfamily_d.h + * Macro definitions for pg_opfamily + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPFAMILY_D_H +#define PG_OPFAMILY_D_H + +/* Macros related to the structure of pg_opfamily */ + +#define OperatorFamilyRelationId 2753 +#define OpfamilyAmNameNspIndexId 2754 +#define OpfamilyOidIndexId 2755 + +#define Anum_pg_opfamily_oid 1 +#define Anum_pg_opfamily_opfmethod 2 +#define Anum_pg_opfamily_opfname 3 +#define Anum_pg_opfamily_opfnamespace 4 +#define Anum_pg_opfamily_opfowner 5 + +#define Natts_pg_opfamily 5 + +/* Definitions copied from pg_opfamily.h */ + + +/* This does not account for non-core opfamilies that might accept boolean */ +#define IsBuiltinBooleanOpfamily(opfamily) \ + ((opfamily) == BOOL_BTREE_FAM_OID || (opfamily) == BOOL_HASH_FAM_OID) + + +/* OID symbols for objects defined in pg_opfamily.dat */ + +#define BOOL_BTREE_FAM_OID 424 +#define BPCHAR_BTREE_FAM_OID 426 +#define BYTEA_BTREE_FAM_OID 428 +#define NETWORK_BTREE_FAM_OID 1974 +#define INTEGER_BTREE_FAM_OID 1976 +#define INTERVAL_BTREE_FAM_OID 1982 +#define OID_BTREE_FAM_OID 1989 +#define TEXT_BTREE_FAM_OID 1994 +#define TEXT_PATTERN_BTREE_FAM_OID 2095 +#define BPCHAR_PATTERN_BTREE_FAM_OID 2097 +#define BOOL_HASH_FAM_OID 2222 +#define TEXT_SPGIST_FAM_OID 4017 + +#endif /* PG_OPFAMILY_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_parameter_acl.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_parameter_acl.h new file mode 100644 index 0000000..ae4049b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_parameter_acl.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * pg_parameter_acl.h + * definition of the "configuration parameter ACL" system catalog + * (pg_parameter_acl). + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_parameter_acl.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PARAMETER_ACL_H +#define PG_PARAMETER_ACL_H + +#include "catalog/genbki.h" +#include "catalog/pg_parameter_acl_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_parameter_acl definition. cpp turns this into + * typedef struct FormData_pg_parameter_acl + * ---------------- + */ +CATALOG(pg_parameter_acl,6243,ParameterAclRelationId) BKI_SHARED_RELATION +{ + Oid oid; /* oid */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* name of parameter */ + text parname BKI_FORCE_NOT_NULL; + + /* access permissions */ + aclitem paracl[1] BKI_DEFAULT(_null_); +#endif +} FormData_pg_parameter_acl; + + +/* ---------------- + * Form_pg_parameter_acl corresponds to a pointer to a tuple with + * the format of pg_parameter_acl relation. + * ---------------- + */ +typedef FormData_pg_parameter_acl * Form_pg_parameter_acl; + +DECLARE_TOAST_WITH_MACRO(pg_parameter_acl, 6244, 6245, PgParameterAclToastTable, PgParameterAclToastIndex); + +DECLARE_UNIQUE_INDEX(pg_parameter_acl_parname_index, 6246, ParameterAclParnameIndexId, pg_parameter_acl, btree(parname text_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_parameter_acl_oid_index, 6247, ParameterAclOidIndexId, pg_parameter_acl, btree(oid oid_ops)); + +MAKE_SYSCACHE(PARAMETERACLNAME, pg_parameter_acl_parname_index, 4); +MAKE_SYSCACHE(PARAMETERACLOID, pg_parameter_acl_oid_index, 4); + +extern Oid ParameterAclLookup(const char *parameter, bool missing_ok); +extern Oid ParameterAclCreate(const char *parameter); + +#endif /* PG_PARAMETER_ACL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_parameter_acl_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_parameter_acl_d.h new file mode 100644 index 0000000..3e41812 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_parameter_acl_d.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * pg_parameter_acl_d.h + * Macro definitions for pg_parameter_acl + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PARAMETER_ACL_D_H +#define PG_PARAMETER_ACL_D_H + +/* Macros related to the structure of pg_parameter_acl */ + +#define ParameterAclRelationId 6243 +#define PgParameterAclToastTable 6244 +#define PgParameterAclToastIndex 6245 +#define ParameterAclParnameIndexId 6246 +#define ParameterAclOidIndexId 6247 + +#define Anum_pg_parameter_acl_oid 1 +#define Anum_pg_parameter_acl_parname 2 +#define Anum_pg_parameter_acl_paracl 3 + +#define Natts_pg_parameter_acl 3 + +/* Definitions copied from pg_parameter_acl.h */ + + +/* OID symbols for objects defined in pg_parameter_acl.dat */ + + +#endif /* PG_PARAMETER_ACL_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_partitioned_table.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_partitioned_table.h new file mode 100644 index 0000000..0527f34 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_partitioned_table.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------------------- + * + * pg_partitioned_table.h + * definition of the "partitioned table" system catalog + * (pg_partitioned_table) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_partitioned_table.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PARTITIONED_TABLE_H +#define PG_PARTITIONED_TABLE_H + +#include "catalog/genbki.h" +#include "catalog/pg_partitioned_table_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_partitioned_table definition. cpp turns this into + * typedef struct FormData_pg_partitioned_table + * ---------------- + */ +CATALOG(pg_partitioned_table,3350,PartitionedRelationId) +{ + Oid partrelid BKI_LOOKUP(pg_class); /* partitioned table oid */ + char partstrat; /* partitioning strategy */ + int16 partnatts; /* number of partition key columns */ + Oid partdefid BKI_LOOKUP_OPT(pg_class); /* default partition oid; + * 0 if there isn't one */ + + /* + * variable-length fields start here, but we allow direct access to + * partattrs via the C struct. That's because the first variable-length + * field of a heap tuple can be reliably accessed using its C struct + * offset, as previous fields are all non-nullable fixed-length fields. + */ + int2vector partattrs BKI_FORCE_NOT_NULL; /* each member of the array is + * the attribute number of a + * partition key column, or 0 + * if the column is actually + * an expression */ + +#ifdef CATALOG_VARLEN + oidvector partclass BKI_LOOKUP(pg_opclass) BKI_FORCE_NOT_NULL; /* operator class to + * compare keys */ + oidvector partcollation BKI_LOOKUP_OPT(pg_collation) BKI_FORCE_NOT_NULL; /* user-specified + * collation for keys */ + pg_node_tree partexprs; /* list of expressions in the partition key; + * one item for each zero entry in partattrs[] */ +#endif +} FormData_pg_partitioned_table; + +/* ---------------- + * Form_pg_partitioned_table corresponds to a pointer to a tuple with + * the format of pg_partitioned_table relation. + * ---------------- + */ +typedef FormData_pg_partitioned_table *Form_pg_partitioned_table; + +DECLARE_TOAST(pg_partitioned_table, 4165, 4166); + +DECLARE_UNIQUE_INDEX_PKEY(pg_partitioned_table_partrelid_index, 3351, PartitionedRelidIndexId, pg_partitioned_table, btree(partrelid oid_ops)); + +MAKE_SYSCACHE(PARTRELID, pg_partitioned_table_partrelid_index, 32); + +/* partattrs can contain zero (InvalidAttrNumber) to represent expressions */ +DECLARE_ARRAY_FOREIGN_KEY_OPT((partrelid, partattrs), pg_attribute, (attrelid, attnum)); + +#endif /* PG_PARTITIONED_TABLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_partitioned_table_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_partitioned_table_d.h new file mode 100644 index 0000000..26d27a5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_partitioned_table_d.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * pg_partitioned_table_d.h + * Macro definitions for pg_partitioned_table + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PARTITIONED_TABLE_D_H +#define PG_PARTITIONED_TABLE_D_H + +/* Macros related to the structure of pg_partitioned_table */ + +#define PartitionedRelationId 3350 +#define PartitionedRelidIndexId 3351 + +#define Anum_pg_partitioned_table_partrelid 1 +#define Anum_pg_partitioned_table_partstrat 2 +#define Anum_pg_partitioned_table_partnatts 3 +#define Anum_pg_partitioned_table_partdefid 4 +#define Anum_pg_partitioned_table_partattrs 5 +#define Anum_pg_partitioned_table_partclass 6 +#define Anum_pg_partitioned_table_partcollation 7 +#define Anum_pg_partitioned_table_partexprs 8 + +#define Natts_pg_partitioned_table 8 + +/* Definitions copied from pg_partitioned_table.h */ + + +/* OID symbols for objects defined in pg_partitioned_table.dat */ + + +#endif /* PG_PARTITIONED_TABLE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_policy.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_policy.h new file mode 100644 index 0000000..3c2498c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_policy.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_policy.h + * definition of the "policy" system catalog (pg_policy) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_policy.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_POLICY_H +#define PG_POLICY_H + +#include "catalog/genbki.h" +#include "catalog/pg_policy_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_policy definition. cpp turns this into + * typedef struct FormData_pg_policy + * ---------------- + */ +CATALOG(pg_policy,3256,PolicyRelationId) +{ + Oid oid; /* oid */ + NameData polname; /* Policy name. */ + Oid polrelid BKI_LOOKUP(pg_class); /* Oid of the relation with + * policy. */ + char polcmd; /* One of ACL_*_CHR, or '*' for all */ + bool polpermissive; /* restrictive or permissive policy */ + +#ifdef CATALOG_VARLEN + /* Roles to which the policy is applied; zero means PUBLIC */ + Oid polroles[1] BKI_LOOKUP_OPT(pg_authid) BKI_FORCE_NOT_NULL; + pg_node_tree polqual; /* Policy quals. */ + pg_node_tree polwithcheck; /* WITH CHECK quals. */ +#endif +} FormData_pg_policy; + +/* ---------------- + * Form_pg_policy corresponds to a pointer to a row with + * the format of pg_policy relation. + * ---------------- + */ +typedef FormData_pg_policy *Form_pg_policy; + +DECLARE_TOAST(pg_policy, 4167, 4168); + +DECLARE_UNIQUE_INDEX_PKEY(pg_policy_oid_index, 3257, PolicyOidIndexId, pg_policy, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_policy_polrelid_polname_index, 3258, PolicyPolrelidPolnameIndexId, pg_policy, btree(polrelid oid_ops, polname name_ops)); + +#endif /* PG_POLICY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_policy_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_policy_d.h new file mode 100644 index 0000000..936ebec --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_policy_d.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * pg_policy_d.h + * Macro definitions for pg_policy + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_POLICY_D_H +#define PG_POLICY_D_H + +/* Macros related to the structure of pg_policy */ + +#define PolicyRelationId 3256 +#define PolicyOidIndexId 3257 +#define PolicyPolrelidPolnameIndexId 3258 + +#define Anum_pg_policy_oid 1 +#define Anum_pg_policy_polname 2 +#define Anum_pg_policy_polrelid 3 +#define Anum_pg_policy_polcmd 4 +#define Anum_pg_policy_polpermissive 5 +#define Anum_pg_policy_polroles 6 +#define Anum_pg_policy_polqual 7 +#define Anum_pg_policy_polwithcheck 8 + +#define Natts_pg_policy 8 + +/* Definitions copied from pg_policy.h */ + + +/* OID symbols for objects defined in pg_policy.dat */ + + +#endif /* PG_POLICY_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_proc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_proc.h new file mode 100644 index 0000000..d7353e7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_proc.h @@ -0,0 +1,224 @@ +/*------------------------------------------------------------------------- + * + * pg_proc.h + * definition of the "procedure" system catalog (pg_proc) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_proc.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PROC_H +#define PG_PROC_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_proc_d.h" /* IWYU pragma: export */ +#include "nodes/pg_list.h" + +/* ---------------- + * pg_proc definition. cpp turns this into + * typedef struct FormData_pg_proc + * ---------------- + */ +CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,ProcedureRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + + /* procedure name */ + NameData proname; + + /* OID of namespace containing this proc */ + Oid pronamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* procedure owner */ + Oid proowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* OID of pg_language entry */ + Oid prolang BKI_DEFAULT(internal) BKI_LOOKUP(pg_language); + + /* estimated execution cost */ + float4 procost BKI_DEFAULT(1); + + /* estimated # of rows out (if proretset) */ + float4 prorows BKI_DEFAULT(0); + + /* element type of variadic array, or 0 if not variadic */ + Oid provariadic BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* planner support function for this function, or 0 if none */ + regproc prosupport BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc); + + /* see PROKIND_ categories below */ + char prokind BKI_DEFAULT(f); + + /* security definer */ + bool prosecdef BKI_DEFAULT(f); + + /* is it a leakproof function? */ + bool proleakproof BKI_DEFAULT(f); + + /* strict with respect to NULLs? */ + bool proisstrict BKI_DEFAULT(t); + + /* returns a set? */ + bool proretset BKI_DEFAULT(f); + + /* see PROVOLATILE_ categories below */ + char provolatile BKI_DEFAULT(i); + + /* see PROPARALLEL_ categories below */ + char proparallel BKI_DEFAULT(s); + + /* number of arguments */ + /* Note: need not be given in pg_proc.dat; genbki.pl will compute it */ + int16 pronargs; + + /* number of arguments with defaults */ + int16 pronargdefaults BKI_DEFAULT(0); + + /* OID of result type */ + Oid prorettype BKI_LOOKUP(pg_type); + + /* + * variable-length fields start here, but we allow direct access to + * proargtypes + */ + + /* parameter types (excludes OUT params) */ + oidvector proargtypes BKI_LOOKUP(pg_type) BKI_FORCE_NOT_NULL; + +#ifdef CATALOG_VARLEN + + /* all param types (NULL if IN only) */ + Oid proallargtypes[1] BKI_DEFAULT(_null_) BKI_LOOKUP(pg_type); + + /* parameter modes (NULL if IN only) */ + char proargmodes[1] BKI_DEFAULT(_null_); + + /* parameter names (NULL if no names) */ + text proargnames[1] BKI_DEFAULT(_null_); + + /* list of expression trees for argument defaults (NULL if none) */ + pg_node_tree proargdefaults BKI_DEFAULT(_null_); + + /* types for which to apply transforms */ + Oid protrftypes[1] BKI_DEFAULT(_null_) BKI_LOOKUP(pg_type); + + /* procedure source text */ + text prosrc BKI_FORCE_NOT_NULL; + + /* secondary procedure info (can be NULL) */ + text probin BKI_DEFAULT(_null_); + + /* pre-parsed SQL function body */ + pg_node_tree prosqlbody BKI_DEFAULT(_null_); + + /* procedure-local GUC settings */ + text proconfig[1] BKI_DEFAULT(_null_); + + /* access permissions */ + aclitem proacl[1] BKI_DEFAULT(_null_); +#endif +} FormData_pg_proc; + +/* ---------------- + * Form_pg_proc corresponds to a pointer to a tuple with + * the format of pg_proc relation. + * ---------------- + */ +typedef FormData_pg_proc *Form_pg_proc; + +DECLARE_TOAST(pg_proc, 2836, 2837); + +DECLARE_UNIQUE_INDEX_PKEY(pg_proc_oid_index, 2690, ProcedureOidIndexId, pg_proc, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_proc_proname_args_nsp_index, 2691, ProcedureNameArgsNspIndexId, pg_proc, btree(proname name_ops, proargtypes oidvector_ops, pronamespace oid_ops)); + +MAKE_SYSCACHE(PROCOID, pg_proc_oid_index, 128); +MAKE_SYSCACHE(PROCNAMEARGSNSP, pg_proc_proname_args_nsp_index, 128); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Symbolic values for prokind column + */ +#define PROKIND_FUNCTION 'f' +#define PROKIND_AGGREGATE 'a' +#define PROKIND_WINDOW 'w' +#define PROKIND_PROCEDURE 'p' + +/* + * Symbolic values for provolatile column: these indicate whether the result + * of a function is dependent *only* on the values of its explicit arguments, + * or can change due to outside factors (such as parameter variables or + * table contents). NOTE: functions having side-effects, such as setval(), + * must be labeled volatile to ensure they will not get optimized away, + * even if the actual return value is not changeable. + */ +#define PROVOLATILE_IMMUTABLE 'i' /* never changes for given input */ +#define PROVOLATILE_STABLE 's' /* does not change within a scan */ +#define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */ + +/* + * Symbolic values for proparallel column: these indicate whether a function + * can be safely be run in a parallel backend, during parallelism but + * necessarily in the leader, or only in non-parallel mode. + */ +#define PROPARALLEL_SAFE 's' /* can run in worker or leader */ +#define PROPARALLEL_RESTRICTED 'r' /* can run in parallel leader only */ +#define PROPARALLEL_UNSAFE 'u' /* banned while in parallel mode */ + +/* + * Symbolic values for proargmodes column. Note that these must agree with + * the FunctionParameterMode enum in parsenodes.h; we declare them here to + * be accessible from either header. + */ +#define PROARGMODE_IN 'i' +#define PROARGMODE_OUT 'o' +#define PROARGMODE_INOUT 'b' +#define PROARGMODE_VARIADIC 'v' +#define PROARGMODE_TABLE 't' + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern ObjectAddress ProcedureCreate(const char *procedureName, + Oid procNamespace, + bool replace, + bool returnsSet, + Oid returnType, + Oid proowner, + Oid languageObjectId, + Oid languageValidator, + const char *prosrc, + const char *probin, + Node *prosqlbody, + char prokind, + bool security_definer, + bool isLeakProof, + bool isStrict, + char volatility, + char parallel, + oidvector *parameterTypes, + Datum allParameterTypes, + Datum parameterModes, + Datum parameterNames, + List *parameterDefaults, + Datum trftypes, + List *trfoids, + Datum proconfig, + Oid prosupport, + float4 procost, + float4 prorows); + +extern bool function_parse_error_transpose(const char *prosrc); + +extern List *oid_array_to_list(Datum datum); + +#endif /* PG_PROC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_proc_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_proc_d.h new file mode 100644 index 0000000..b271155 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_proc_d.h @@ -0,0 +1,108 @@ +/*------------------------------------------------------------------------- + * + * pg_proc_d.h + * Macro definitions for pg_proc + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PROC_D_H +#define PG_PROC_D_H + +/* Macros related to the structure of pg_proc */ + +#define ProcedureRelationId 1255 +#define ProcedureRelation_Rowtype_Id 81 +#define ProcedureOidIndexId 2690 +#define ProcedureNameArgsNspIndexId 2691 + +#define Anum_pg_proc_oid 1 +#define Anum_pg_proc_proname 2 +#define Anum_pg_proc_pronamespace 3 +#define Anum_pg_proc_proowner 4 +#define Anum_pg_proc_prolang 5 +#define Anum_pg_proc_procost 6 +#define Anum_pg_proc_prorows 7 +#define Anum_pg_proc_provariadic 8 +#define Anum_pg_proc_prosupport 9 +#define Anum_pg_proc_prokind 10 +#define Anum_pg_proc_prosecdef 11 +#define Anum_pg_proc_proleakproof 12 +#define Anum_pg_proc_proisstrict 13 +#define Anum_pg_proc_proretset 14 +#define Anum_pg_proc_provolatile 15 +#define Anum_pg_proc_proparallel 16 +#define Anum_pg_proc_pronargs 17 +#define Anum_pg_proc_pronargdefaults 18 +#define Anum_pg_proc_prorettype 19 +#define Anum_pg_proc_proargtypes 20 +#define Anum_pg_proc_proallargtypes 21 +#define Anum_pg_proc_proargmodes 22 +#define Anum_pg_proc_proargnames 23 +#define Anum_pg_proc_proargdefaults 24 +#define Anum_pg_proc_protrftypes 25 +#define Anum_pg_proc_prosrc 26 +#define Anum_pg_proc_probin 27 +#define Anum_pg_proc_prosqlbody 28 +#define Anum_pg_proc_proconfig 29 +#define Anum_pg_proc_proacl 30 + +#define Natts_pg_proc 30 + +/* Definitions copied from pg_proc.h */ + + +/* + * Symbolic values for prokind column + */ +#define PROKIND_FUNCTION 'f' +#define PROKIND_AGGREGATE 'a' +#define PROKIND_WINDOW 'w' +#define PROKIND_PROCEDURE 'p' + +/* + * Symbolic values for provolatile column: these indicate whether the result + * of a function is dependent *only* on the values of its explicit arguments, + * or can change due to outside factors (such as parameter variables or + * table contents). NOTE: functions having side-effects, such as setval(), + * must be labeled volatile to ensure they will not get optimized away, + * even if the actual return value is not changeable. + */ +#define PROVOLATILE_IMMUTABLE 'i' /* never changes for given input */ +#define PROVOLATILE_STABLE 's' /* does not change within a scan */ +#define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */ + +/* + * Symbolic values for proparallel column: these indicate whether a function + * can be safely be run in a parallel backend, during parallelism but + * necessarily in the leader, or only in non-parallel mode. + */ +#define PROPARALLEL_SAFE 's' /* can run in worker or leader */ +#define PROPARALLEL_RESTRICTED 'r' /* can run in parallel leader only */ +#define PROPARALLEL_UNSAFE 'u' /* banned while in parallel mode */ + +/* + * Symbolic values for proargmodes column. Note that these must agree with + * the FunctionParameterMode enum in parsenodes.h; we declare them here to + * be accessible from either header. + */ +#define PROARGMODE_IN 'i' +#define PROARGMODE_OUT 'o' +#define PROARGMODE_INOUT 'b' +#define PROARGMODE_VARIADIC 'v' +#define PROARGMODE_TABLE 't' + + +/* OID symbols for objects defined in pg_proc.dat */ + + +#endif /* PG_PROC_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication.h new file mode 100644 index 0000000..48c7d1a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication.h @@ -0,0 +1,194 @@ +/*------------------------------------------------------------------------- + * + * pg_publication.h + * definition of the "publication" system catalog (pg_publication) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_publication.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_H +#define PG_PUBLICATION_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_publication_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_publication definition. cpp turns this into + * typedef struct FormData_pg_publication + * ---------------- + */ +CATALOG(pg_publication,6104,PublicationRelationId) +{ + Oid oid; /* oid */ + + NameData pubname; /* name of the publication */ + + Oid pubowner BKI_LOOKUP(pg_authid); /* publication owner */ + + /* + * indicates that this is special publication which should encompass all + * tables in the database (except for the unlogged and temp ones) + */ + bool puballtables; + + /* true if inserts are published */ + bool pubinsert; + + /* true if updates are published */ + bool pubupdate; + + /* true if deletes are published */ + bool pubdelete; + + /* true if truncates are published */ + bool pubtruncate; + + /* true if partition changes are published using root schema */ + bool pubviaroot; + + /* + * 'n'(none) if generated column data should not be published. 's'(stored) + * if stored generated column data should be published. + */ + char pubgencols; +} FormData_pg_publication; + +/* ---------------- + * Form_pg_publication corresponds to a pointer to a tuple with + * the format of pg_publication relation. + * ---------------- + */ +typedef FormData_pg_publication *Form_pg_publication; + +DECLARE_UNIQUE_INDEX_PKEY(pg_publication_oid_index, 6110, PublicationObjectIndexId, pg_publication, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_publication_pubname_index, 6111, PublicationNameIndexId, pg_publication, btree(pubname name_ops)); + +MAKE_SYSCACHE(PUBLICATIONOID, pg_publication_oid_index, 8); +MAKE_SYSCACHE(PUBLICATIONNAME, pg_publication_pubname_index, 8); + +typedef struct PublicationActions +{ + bool pubinsert; + bool pubupdate; + bool pubdelete; + bool pubtruncate; +} PublicationActions; + +typedef struct PublicationDesc +{ + PublicationActions pubactions; + + /* + * true if the columns referenced in row filters which are used for UPDATE + * or DELETE are part of the replica identity or the publication actions + * do not include UPDATE or DELETE. + */ + bool rf_valid_for_update; + bool rf_valid_for_delete; + + /* + * true if the columns are part of the replica identity or the publication + * actions do not include UPDATE or DELETE. + */ + bool cols_valid_for_update; + bool cols_valid_for_delete; + + /* + * true if all generated columns that are part of replica identity are + * published or the publication actions do not include UPDATE or DELETE. + */ + bool gencols_valid_for_update; + bool gencols_valid_for_delete; +} PublicationDesc; + +#ifdef EXPOSE_TO_CLIENT_CODE + +typedef enum PublishGencolsType +{ + /* Generated columns present should not be replicated. */ + PUBLISH_GENCOLS_NONE = 'n', + + /* Generated columns present should be replicated. */ + PUBLISH_GENCOLS_STORED = 's', + +} PublishGencolsType; + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +typedef struct Publication +{ + Oid oid; + char *name; + bool alltables; + bool pubviaroot; + PublishGencolsType pubgencols_type; + PublicationActions pubactions; +} Publication; + +typedef struct PublicationRelInfo +{ + Relation relation; + Node *whereClause; + List *columns; +} PublicationRelInfo; + +extern Publication *GetPublication(Oid pubid); +extern Publication *GetPublicationByName(const char *pubname, bool missing_ok); +extern List *GetRelationPublications(Oid relid); + +/*--------- + * Expected values for pub_partopt parameter of GetRelationPublications(), + * which allows callers to specify which partitions of partitioned tables + * mentioned in the publication they expect to see. + * + * ROOT: only the table explicitly mentioned in the publication + * LEAF: only leaf partitions in given tree + * ALL: all partitions in given tree + */ +typedef enum PublicationPartOpt +{ + PUBLICATION_PART_ROOT, + PUBLICATION_PART_LEAF, + PUBLICATION_PART_ALL, +} PublicationPartOpt; + +extern List *GetPublicationRelations(Oid pubid, PublicationPartOpt pub_partopt); +extern List *GetAllTablesPublications(void); +extern List *GetAllTablesPublicationRelations(bool pubviaroot); +extern List *GetPublicationSchemas(Oid pubid); +extern List *GetSchemaPublications(Oid schemaid); +extern List *GetSchemaPublicationRelations(Oid schemaid, + PublicationPartOpt pub_partopt); +extern List *GetAllSchemaPublicationRelations(Oid pubid, + PublicationPartOpt pub_partopt); +extern List *GetPubPartitionOptionRelations(List *result, + PublicationPartOpt pub_partopt, + Oid relid); +extern Oid GetTopMostAncestorInPublication(Oid puboid, List *ancestors, + int *ancestor_level); + +extern bool is_publishable_relation(Relation rel); +extern bool is_schema_publication(Oid pubid); +extern bool check_and_fetch_column_list(Publication *pub, Oid relid, + MemoryContext mcxt, Bitmapset **cols); +extern ObjectAddress publication_add_relation(Oid pubid, PublicationRelInfo *pri, + bool if_not_exists); +extern Bitmapset *pub_collist_validate(Relation targetrel, List *columns); +extern ObjectAddress publication_add_schema(Oid pubid, Oid schemaid, + bool if_not_exists); + +extern Bitmapset *pub_collist_to_bitmapset(Bitmapset *columns, Datum pubcols, + MemoryContext mcxt); +extern Bitmapset *pub_form_cols_map(Relation relation, + PublishGencolsType include_gencols_type); + +#endif /* PG_PUBLICATION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_d.h new file mode 100644 index 0000000..08f722b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_d.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_d.h + * Macro definitions for pg_publication + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_D_H +#define PG_PUBLICATION_D_H + +/* Macros related to the structure of pg_publication */ + +#define PublicationRelationId 6104 +#define PublicationObjectIndexId 6110 +#define PublicationNameIndexId 6111 + +#define Anum_pg_publication_oid 1 +#define Anum_pg_publication_pubname 2 +#define Anum_pg_publication_pubowner 3 +#define Anum_pg_publication_puballtables 4 +#define Anum_pg_publication_pubinsert 5 +#define Anum_pg_publication_pubupdate 6 +#define Anum_pg_publication_pubdelete 7 +#define Anum_pg_publication_pubtruncate 8 +#define Anum_pg_publication_pubviaroot 9 +#define Anum_pg_publication_pubgencols 10 + +#define Natts_pg_publication 10 + +/* Definitions copied from pg_publication.h */ + + +typedef enum PublishGencolsType +{ + /* Generated columns present should not be replicated. */ + PUBLISH_GENCOLS_NONE = 'n', + + /* Generated columns present should be replicated. */ + PUBLISH_GENCOLS_STORED = 's', + +} PublishGencolsType; + + +/* OID symbols for objects defined in pg_publication.dat */ + + +#endif /* PG_PUBLICATION_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_namespace.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_namespace.h new file mode 100644 index 0000000..3bf308d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_namespace.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_namespace.h + * definition of the system catalog for mappings between schemas and + * publications (pg_publication_namespace) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_publication_namespace.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_NAMESPACE_H +#define PG_PUBLICATION_NAMESPACE_H + +#include "catalog/genbki.h" +#include "catalog/pg_publication_namespace_d.h" /* IWYU pragma: export */ + + +/* ---------------- + * pg_publication_namespace definition. cpp turns this into + * typedef struct FormData_pg_publication_namespace + * ---------------- + */ +CATALOG(pg_publication_namespace,6237,PublicationNamespaceRelationId) +{ + Oid oid; /* oid */ + Oid pnpubid BKI_LOOKUP(pg_publication); /* Oid of the publication */ + Oid pnnspid BKI_LOOKUP(pg_namespace); /* Oid of the schema */ +} FormData_pg_publication_namespace; + +/* ---------------- + * Form_pg_publication_namespace corresponds to a pointer to a tuple with + * the format of pg_publication_namespace relation. + * ---------------- + */ +typedef FormData_pg_publication_namespace *Form_pg_publication_namespace; + +DECLARE_UNIQUE_INDEX_PKEY(pg_publication_namespace_oid_index, 6238, PublicationNamespaceObjectIndexId, pg_publication_namespace, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_publication_namespace_pnnspid_pnpubid_index, 6239, PublicationNamespacePnnspidPnpubidIndexId, pg_publication_namespace, btree(pnnspid oid_ops, pnpubid oid_ops)); + +MAKE_SYSCACHE(PUBLICATIONNAMESPACE, pg_publication_namespace_oid_index, 64); +MAKE_SYSCACHE(PUBLICATIONNAMESPACEMAP, pg_publication_namespace_pnnspid_pnpubid_index, 64); + +#endif /* PG_PUBLICATION_NAMESPACE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_namespace_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_namespace_d.h new file mode 100644 index 0000000..f9014c6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_namespace_d.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_namespace_d.h + * Macro definitions for pg_publication_namespace + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_NAMESPACE_D_H +#define PG_PUBLICATION_NAMESPACE_D_H + +/* Macros related to the structure of pg_publication_namespace */ + +#define PublicationNamespaceRelationId 6237 +#define PublicationNamespaceObjectIndexId 6238 +#define PublicationNamespacePnnspidPnpubidIndexId 6239 + +#define Anum_pg_publication_namespace_oid 1 +#define Anum_pg_publication_namespace_pnpubid 2 +#define Anum_pg_publication_namespace_pnnspid 3 + +#define Natts_pg_publication_namespace 3 + +/* Definitions copied from pg_publication_namespace.h */ + + +/* OID symbols for objects defined in pg_publication_namespace.dat */ + + +#endif /* PG_PUBLICATION_NAMESPACE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_rel.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_rel.h new file mode 100644 index 0000000..92cc36d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_rel.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_rel.h + * definition of the system catalog for mappings between relations and + * publications (pg_publication_rel) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_publication_rel.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_REL_H +#define PG_PUBLICATION_REL_H + +#include "catalog/genbki.h" +#include "catalog/pg_publication_rel_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_publication_rel definition. cpp turns this into + * typedef struct FormData_pg_publication_rel + * ---------------- + */ +CATALOG(pg_publication_rel,6106,PublicationRelRelationId) +{ + Oid oid; /* oid */ + Oid prpubid BKI_LOOKUP(pg_publication); /* Oid of the publication */ + Oid prrelid BKI_LOOKUP(pg_class); /* Oid of the relation */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + pg_node_tree prqual; /* qualifications */ + int2vector prattrs; /* columns to replicate */ +#endif +} FormData_pg_publication_rel; + +/* ---------------- + * Form_pg_publication_rel corresponds to a pointer to a tuple with + * the format of pg_publication_rel relation. + * ---------------- + */ +typedef FormData_pg_publication_rel *Form_pg_publication_rel; + +DECLARE_TOAST(pg_publication_rel, 6228, 6229); + +DECLARE_UNIQUE_INDEX_PKEY(pg_publication_rel_oid_index, 6112, PublicationRelObjectIndexId, pg_publication_rel, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_publication_rel_prrelid_prpubid_index, 6113, PublicationRelPrrelidPrpubidIndexId, pg_publication_rel, btree(prrelid oid_ops, prpubid oid_ops)); +DECLARE_INDEX(pg_publication_rel_prpubid_index, 6116, PublicationRelPrpubidIndexId, pg_publication_rel, btree(prpubid oid_ops)); + +MAKE_SYSCACHE(PUBLICATIONREL, pg_publication_rel_oid_index, 64); +MAKE_SYSCACHE(PUBLICATIONRELMAP, pg_publication_rel_prrelid_prpubid_index, 64); + +#endif /* PG_PUBLICATION_REL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_rel_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_rel_d.h new file mode 100644 index 0000000..a15cab3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_publication_rel_d.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_rel_d.h + * Macro definitions for pg_publication_rel + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_REL_D_H +#define PG_PUBLICATION_REL_D_H + +/* Macros related to the structure of pg_publication_rel */ + +#define PublicationRelRelationId 6106 +#define PublicationRelObjectIndexId 6112 +#define PublicationRelPrrelidPrpubidIndexId 6113 +#define PublicationRelPrpubidIndexId 6116 + +#define Anum_pg_publication_rel_oid 1 +#define Anum_pg_publication_rel_prpubid 2 +#define Anum_pg_publication_rel_prrelid 3 +#define Anum_pg_publication_rel_prqual 4 +#define Anum_pg_publication_rel_prattrs 5 + +#define Natts_pg_publication_rel 5 + +/* Definitions copied from pg_publication_rel.h */ + + +/* OID symbols for objects defined in pg_publication_rel.dat */ + + +#endif /* PG_PUBLICATION_REL_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_range.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_range.h new file mode 100644 index 0000000..3bba616 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_range.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * pg_range.h + * definition of the "range type" system catalog (pg_range) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_range.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_RANGE_H +#define PG_RANGE_H + +#include "catalog/genbki.h" +#include "catalog/pg_range_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_range definition. cpp turns this into + * typedef struct FormData_pg_range + * ---------------- + */ +CATALOG(pg_range,3541,RangeRelationId) +{ + /* OID of owning range type */ + Oid rngtypid BKI_LOOKUP(pg_type); + + /* OID of range's element type (subtype) */ + Oid rngsubtype BKI_LOOKUP(pg_type); + + /* OID of the range's multirange type */ + Oid rngmultitypid BKI_LOOKUP(pg_type); + + /* collation for this range type, or 0 */ + Oid rngcollation BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_collation); + + /* subtype's btree opclass */ + Oid rngsubopc BKI_LOOKUP(pg_opclass); + + /* canonicalize range, or 0 */ + regproc rngcanonical BKI_LOOKUP_OPT(pg_proc); + + /* subtype difference as a float8, or 0 */ + regproc rngsubdiff BKI_LOOKUP_OPT(pg_proc); +} FormData_pg_range; + +/* ---------------- + * Form_pg_range corresponds to a pointer to a tuple with + * the format of pg_range relation. + * ---------------- + */ +typedef FormData_pg_range *Form_pg_range; + +DECLARE_UNIQUE_INDEX_PKEY(pg_range_rngtypid_index, 3542, RangeTypidIndexId, pg_range, btree(rngtypid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_range_rngmultitypid_index, 2228, RangeMultirangeTypidIndexId, pg_range, btree(rngmultitypid oid_ops)); + +MAKE_SYSCACHE(RANGETYPE, pg_range_rngtypid_index, 4); +MAKE_SYSCACHE(RANGEMULTIRANGE, pg_range_rngmultitypid_index, 4); + +/* + * prototypes for functions in pg_range.c + */ + +extern void RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation, + Oid rangeSubOpclass, RegProcedure rangeCanonical, + RegProcedure rangeSubDiff, Oid multirangeTypeOid); +extern void RangeDelete(Oid rangeTypeOid); + +#endif /* PG_RANGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_range_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_range_d.h new file mode 100644 index 0000000..b566f73 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_range_d.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * pg_range_d.h + * Macro definitions for pg_range + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_RANGE_D_H +#define PG_RANGE_D_H + +/* Macros related to the structure of pg_range */ + +#define RangeRelationId 3541 +#define RangeTypidIndexId 3542 +#define RangeMultirangeTypidIndexId 2228 + +#define Anum_pg_range_rngtypid 1 +#define Anum_pg_range_rngsubtype 2 +#define Anum_pg_range_rngmultitypid 3 +#define Anum_pg_range_rngcollation 4 +#define Anum_pg_range_rngsubopc 5 +#define Anum_pg_range_rngcanonical 6 +#define Anum_pg_range_rngsubdiff 7 + +#define Natts_pg_range 7 + +/* Definitions copied from pg_range.h */ + + +/* OID symbols for objects defined in pg_range.dat */ + + +#endif /* PG_RANGE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_replication_origin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_replication_origin.h new file mode 100644 index 0000000..7ade8bb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_replication_origin.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * pg_replication_origin.h + * definition of the "replication origin" system catalog + * (pg_replication_origin) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_replication_origin.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_REPLICATION_ORIGIN_H +#define PG_REPLICATION_ORIGIN_H + +#include "access/xlogdefs.h" +#include "catalog/genbki.h" +#include "catalog/pg_replication_origin_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_replication_origin. cpp turns this into + * typedef struct FormData_pg_replication_origin + * ---------------- + */ +CATALOG(pg_replication_origin,6000,ReplicationOriginRelationId) BKI_SHARED_RELATION +{ + /* + * Locally known id that get included into WAL. + * + * This should never leave the system. + * + * Needs to fit into an uint16, so we don't waste too much space in WAL + * records. For this reason we don't use a normal Oid column here, since + * we need to handle allocation of new values manually. + */ + Oid roident; + + /* + * Variable-length fields start here, but we allow direct access to + * roname. + */ + + /* external, free-format, name */ + text roname BKI_FORCE_NOT_NULL; + +#ifdef CATALOG_VARLEN /* further variable-length fields */ +#endif +} FormData_pg_replication_origin; + +typedef FormData_pg_replication_origin *Form_pg_replication_origin; + +DECLARE_UNIQUE_INDEX_PKEY(pg_replication_origin_roiident_index, 6001, ReplicationOriginIdentIndex, pg_replication_origin, btree(roident oid_ops)); +DECLARE_UNIQUE_INDEX(pg_replication_origin_roname_index, 6002, ReplicationOriginNameIndex, pg_replication_origin, btree(roname text_ops)); + +MAKE_SYSCACHE(REPLORIGIDENT, pg_replication_origin_roiident_index, 16); +MAKE_SYSCACHE(REPLORIGNAME, pg_replication_origin_roname_index, 16); + +#endif /* PG_REPLICATION_ORIGIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_replication_origin_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_replication_origin_d.h new file mode 100644 index 0000000..ea89a13 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_replication_origin_d.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pg_replication_origin_d.h + * Macro definitions for pg_replication_origin + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_REPLICATION_ORIGIN_D_H +#define PG_REPLICATION_ORIGIN_D_H + +/* Macros related to the structure of pg_replication_origin */ + +#define ReplicationOriginRelationId 6000 +#define ReplicationOriginIdentIndex 6001 +#define ReplicationOriginNameIndex 6002 + +#define Anum_pg_replication_origin_roident 1 +#define Anum_pg_replication_origin_roname 2 + +#define Natts_pg_replication_origin 2 + +/* Definitions copied from pg_replication_origin.h */ + + +/* OID symbols for objects defined in pg_replication_origin.dat */ + + +#endif /* PG_REPLICATION_ORIGIN_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_rewrite.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_rewrite.h new file mode 100644 index 0000000..c70bc45 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_rewrite.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_rewrite.h + * definition of the "rewrite rule" system catalog (pg_rewrite) + * + * As of Postgres 7.3, the primary key for this table is + * --- ie, rule names are only unique among the rules of a given table. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_rewrite.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_REWRITE_H +#define PG_REWRITE_H + +#include "catalog/genbki.h" +#include "catalog/pg_rewrite_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_rewrite definition. cpp turns this into + * typedef struct FormData_pg_rewrite + * ---------------- + */ +CATALOG(pg_rewrite,2618,RewriteRelationId) +{ + Oid oid; /* oid */ + NameData rulename; + Oid ev_class BKI_LOOKUP(pg_class); + char ev_type; + char ev_enabled; + bool is_instead; + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + pg_node_tree ev_qual BKI_FORCE_NOT_NULL; + pg_node_tree ev_action BKI_FORCE_NOT_NULL; +#endif +} FormData_pg_rewrite; + +/* ---------------- + * Form_pg_rewrite corresponds to a pointer to a tuple with + * the format of pg_rewrite relation. + * ---------------- + */ +typedef FormData_pg_rewrite *Form_pg_rewrite; + +DECLARE_TOAST(pg_rewrite, 2838, 2839); + +DECLARE_UNIQUE_INDEX_PKEY(pg_rewrite_oid_index, 2692, RewriteOidIndexId, pg_rewrite, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_rewrite_rel_rulename_index, 2693, RewriteRelRulenameIndexId, pg_rewrite, btree(ev_class oid_ops, rulename name_ops)); + +MAKE_SYSCACHE(RULERELNAME, pg_rewrite_rel_rulename_index, 8); + +#endif /* PG_REWRITE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_rewrite_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_rewrite_d.h new file mode 100644 index 0000000..2645356 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_rewrite_d.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * pg_rewrite_d.h + * Macro definitions for pg_rewrite + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_REWRITE_D_H +#define PG_REWRITE_D_H + +/* Macros related to the structure of pg_rewrite */ + +#define RewriteRelationId 2618 +#define RewriteOidIndexId 2692 +#define RewriteRelRulenameIndexId 2693 + +#define Anum_pg_rewrite_oid 1 +#define Anum_pg_rewrite_rulename 2 +#define Anum_pg_rewrite_ev_class 3 +#define Anum_pg_rewrite_ev_type 4 +#define Anum_pg_rewrite_ev_enabled 5 +#define Anum_pg_rewrite_is_instead 6 +#define Anum_pg_rewrite_ev_qual 7 +#define Anum_pg_rewrite_ev_action 8 + +#define Natts_pg_rewrite 8 + +/* Definitions copied from pg_rewrite.h */ + + +/* OID symbols for objects defined in pg_rewrite.dat */ + + +#endif /* PG_REWRITE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_seclabel.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_seclabel.h new file mode 100644 index 0000000..5b1b433 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_seclabel.h @@ -0,0 +1,45 @@ +/* ------------------------------------------------------------------------- + * + * pg_seclabel.h + * definition of the "security label" system catalog (pg_seclabel) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_seclabel.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SECLABEL_H +#define PG_SECLABEL_H + +#include "catalog/genbki.h" +#include "catalog/pg_seclabel_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_seclabel definition. cpp turns this into + * typedef struct FormData_pg_seclabel + * ---------------- + */ +CATALOG(pg_seclabel,3596,SecLabelRelationId) +{ + Oid objoid; /* OID of the object itself */ + Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing the + * object */ + int32 objsubid; /* column number, or 0 if not used */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text provider BKI_FORCE_NOT_NULL; /* name of label provider */ + text label BKI_FORCE_NOT_NULL; /* security label of the object */ +#endif +} FormData_pg_seclabel; + +DECLARE_TOAST(pg_seclabel, 3598, 3599); + +DECLARE_UNIQUE_INDEX_PKEY(pg_seclabel_object_index, 3597, SecLabelObjectIndexId, pg_seclabel, btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops, provider text_ops)); + +#endif /* PG_SECLABEL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_seclabel_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_seclabel_d.h new file mode 100644 index 0000000..0ae7cbf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_seclabel_d.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * pg_seclabel_d.h + * Macro definitions for pg_seclabel + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SECLABEL_D_H +#define PG_SECLABEL_D_H + +/* Macros related to the structure of pg_seclabel */ + +#define SecLabelRelationId 3596 +#define SecLabelObjectIndexId 3597 + +#define Anum_pg_seclabel_objoid 1 +#define Anum_pg_seclabel_classoid 2 +#define Anum_pg_seclabel_objsubid 3 +#define Anum_pg_seclabel_provider 4 +#define Anum_pg_seclabel_label 5 + +#define Natts_pg_seclabel 5 + +/* Definitions copied from pg_seclabel.h */ + + +/* OID symbols for objects defined in pg_seclabel.dat */ + + +#endif /* PG_SECLABEL_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_sequence.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_sequence.h new file mode 100644 index 0000000..580c7f2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_sequence.h @@ -0,0 +1,46 @@ +/* ------------------------------------------------------------------------- + * + * pg_sequence.h + * definition of the "sequence" system catalog (pg_sequence) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_sequence.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SEQUENCE_H +#define PG_SEQUENCE_H + +#include "catalog/genbki.h" +#include "catalog/pg_sequence_d.h" /* IWYU pragma: export */ + +CATALOG(pg_sequence,2224,SequenceRelationId) +{ + Oid seqrelid BKI_LOOKUP(pg_class); + Oid seqtypid BKI_LOOKUP(pg_type); + int64 seqstart; + int64 seqincrement; + int64 seqmax; + int64 seqmin; + int64 seqcache; + bool seqcycle; +} FormData_pg_sequence; + +/* ---------------- + * Form_pg_sequence corresponds to a pointer to a tuple with + * the format of pg_sequence relation. + * ---------------- + */ +typedef FormData_pg_sequence *Form_pg_sequence; + +DECLARE_UNIQUE_INDEX_PKEY(pg_sequence_seqrelid_index, 5002, SequenceRelidIndexId, pg_sequence, btree(seqrelid oid_ops)); + +MAKE_SYSCACHE(SEQRELID, pg_sequence_seqrelid_index, 32); + +#endif /* PG_SEQUENCE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_sequence_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_sequence_d.h new file mode 100644 index 0000000..270325d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_sequence_d.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * pg_sequence_d.h + * Macro definitions for pg_sequence + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SEQUENCE_D_H +#define PG_SEQUENCE_D_H + +/* Macros related to the structure of pg_sequence */ + +#define SequenceRelationId 2224 +#define SequenceRelidIndexId 5002 + +#define Anum_pg_sequence_seqrelid 1 +#define Anum_pg_sequence_seqtypid 2 +#define Anum_pg_sequence_seqstart 3 +#define Anum_pg_sequence_seqincrement 4 +#define Anum_pg_sequence_seqmax 5 +#define Anum_pg_sequence_seqmin 6 +#define Anum_pg_sequence_seqcache 7 +#define Anum_pg_sequence_seqcycle 8 + +#define Natts_pg_sequence 8 + +/* Definitions copied from pg_sequence.h */ + + +/* OID symbols for objects defined in pg_sequence.dat */ + + +#endif /* PG_SEQUENCE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdepend.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdepend.h new file mode 100644 index 0000000..62df9f7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdepend.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------------------- + * + * pg_shdepend.h + * definition of the "shared dependency" system catalog (pg_shdepend) + * + * pg_shdepend has no preloaded contents, so there is no pg_shdepend.dat + * file; dependencies for system-defined objects are loaded into it + * on-the-fly during initdb. Most built-in objects are pinned anyway, + * and hence need no explicit entries in pg_shdepend. + * + * NOTE: we do not represent all possible dependency pairs in pg_shdepend; + * for example, there's not much value in creating an explicit dependency + * from a relation to its database. Currently, only dependencies on roles + * are explicitly stored in pg_shdepend. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_shdepend.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHDEPEND_H +#define PG_SHDEPEND_H + +#include "catalog/genbki.h" +#include "catalog/pg_shdepend_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_shdepend definition. cpp turns this into + * typedef struct FormData_pg_shdepend + * ---------------- + */ +CATALOG(pg_shdepend,1214,SharedDependRelationId) BKI_SHARED_RELATION +{ + /* + * Identification of the dependent (referencing) object. + * + * Note that dbid can be zero to denote a shared object. + */ + Oid dbid BKI_LOOKUP_OPT(pg_database); /* OID of database + * containing object */ + Oid classid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + Oid objid; /* OID of object itself */ + int32 objsubid; /* column number, or 0 if not used */ + + /* + * Identification of the independent (referenced) object. This is always + * a shared object, so we need no database ID field. We don't bother with + * a sub-object ID either. + */ + Oid refclassid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + Oid refobjid; /* OID of object itself */ + + /* + * Precise semantics of the relationship are specified by the deptype + * field. See SharedDependencyType in catalog/dependency.h. + */ + char deptype; /* see codes in dependency.h */ +} FormData_pg_shdepend; + +/* ---------------- + * Form_pg_shdepend corresponds to a pointer to a row with + * the format of pg_shdepend relation. + * ---------------- + */ +typedef FormData_pg_shdepend *Form_pg_shdepend; + +DECLARE_INDEX(pg_shdepend_depender_index, 1232, SharedDependDependerIndexId, pg_shdepend, btree(dbid oid_ops, classid oid_ops, objid oid_ops, objsubid int4_ops)); +DECLARE_INDEX(pg_shdepend_reference_index, 1233, SharedDependReferenceIndexId, pg_shdepend, btree(refclassid oid_ops, refobjid oid_ops)); + +#endif /* PG_SHDEPEND_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdepend_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdepend_d.h new file mode 100644 index 0000000..9261088 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdepend_d.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * pg_shdepend_d.h + * Macro definitions for pg_shdepend + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHDEPEND_D_H +#define PG_SHDEPEND_D_H + +/* Macros related to the structure of pg_shdepend */ + +#define SharedDependRelationId 1214 +#define SharedDependDependerIndexId 1232 +#define SharedDependReferenceIndexId 1233 + +#define Anum_pg_shdepend_dbid 1 +#define Anum_pg_shdepend_classid 2 +#define Anum_pg_shdepend_objid 3 +#define Anum_pg_shdepend_objsubid 4 +#define Anum_pg_shdepend_refclassid 5 +#define Anum_pg_shdepend_refobjid 6 +#define Anum_pg_shdepend_deptype 7 + +#define Natts_pg_shdepend 7 + +/* Definitions copied from pg_shdepend.h */ + + +/* OID symbols for objects defined in pg_shdepend.dat */ + + +#endif /* PG_SHDEPEND_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdescription.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdescription.h new file mode 100644 index 0000000..ccd1f2e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdescription.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * pg_shdescription.h + * definition of the "shared description" system catalog + * (pg_shdescription) + * + * Because the contents of this table are taken from the *.dat files + * of other catalogs, there is no pg_shdescription.dat file. The initial + * contents are assembled by genbki.pl and loaded during initdb. + * + * NOTE: an object is identified by the OID of the row that primarily + * defines the object, plus the OID of the table that that row appears in. + * For example, a database is identified by the OID of its pg_database row + * plus the pg_class OID of table pg_database. This allows unique + * identification of objects without assuming that OIDs are unique + * across tables. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_shdescription.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHDESCRIPTION_H +#define PG_SHDESCRIPTION_H + +#include "catalog/genbki.h" +#include "catalog/pg_shdescription_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_shdescription definition. cpp turns this into + * typedef struct FormData_pg_shdescription + * ---------------- + */ +CATALOG(pg_shdescription,2396,SharedDescriptionRelationId) BKI_SHARED_RELATION +{ + Oid objoid; /* OID of object itself */ + Oid classoid; /* OID of table containing object */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text description BKI_FORCE_NOT_NULL; /* description of object */ +#endif +} FormData_pg_shdescription; + +/* ---------------- + * Form_pg_shdescription corresponds to a pointer to a tuple with + * the format of pg_shdescription relation. + * ---------------- + */ +typedef FormData_pg_shdescription * Form_pg_shdescription; + +DECLARE_TOAST_WITH_MACRO(pg_shdescription, 2846, 2847, PgShdescriptionToastTable, PgShdescriptionToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_shdescription_o_c_index, 2397, SharedDescriptionObjIndexId, pg_shdescription, btree(objoid oid_ops, classoid oid_ops)); + +/* We do not use BKI_LOOKUP here because it causes problems for genbki.pl */ +DECLARE_FOREIGN_KEY((classoid), pg_class, (oid)); + +#endif /* PG_SHDESCRIPTION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdescription_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdescription_d.h new file mode 100644 index 0000000..9a187bc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shdescription_d.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * pg_shdescription_d.h + * Macro definitions for pg_shdescription + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHDESCRIPTION_D_H +#define PG_SHDESCRIPTION_D_H + +/* Macros related to the structure of pg_shdescription */ + +#define SharedDescriptionRelationId 2396 +#define PgShdescriptionToastTable 2846 +#define PgShdescriptionToastIndex 2847 +#define SharedDescriptionObjIndexId 2397 + +#define Anum_pg_shdescription_objoid 1 +#define Anum_pg_shdescription_classoid 2 +#define Anum_pg_shdescription_description 3 + +#define Natts_pg_shdescription 3 + +/* Definitions copied from pg_shdescription.h */ + + +/* OID symbols for objects defined in pg_shdescription.dat */ + + +#endif /* PG_SHDESCRIPTION_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shseclabel.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shseclabel.h new file mode 100644 index 0000000..523d605 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shseclabel.h @@ -0,0 +1,46 @@ +/* ------------------------------------------------------------------------- + * + * pg_shseclabel.h + * definition of the "shared security label" system catalog (pg_shseclabel) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_shseclabel.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SHSECLABEL_H +#define PG_SHSECLABEL_H + +#include "catalog/genbki.h" +#include "catalog/pg_shseclabel_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_shseclabel definition. cpp turns this into + * typedef struct FormData_pg_shseclabel + * ---------------- + */ +CATALOG(pg_shseclabel,3592,SharedSecLabelRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(4066,SharedSecLabelRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid objoid; /* OID of the shared object itself */ + Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing the + * shared object */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text provider BKI_FORCE_NOT_NULL; /* name of label provider */ + text label BKI_FORCE_NOT_NULL; /* security label of the object */ +#endif +} FormData_pg_shseclabel; + +typedef FormData_pg_shseclabel * Form_pg_shseclabel; + +DECLARE_TOAST_WITH_MACRO(pg_shseclabel, 4060, 4061, PgShseclabelToastTable, PgShseclabelToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_shseclabel_object_index, 3593, SharedSecLabelObjectIndexId, pg_shseclabel, btree(objoid oid_ops, classoid oid_ops, provider text_ops)); + +#endif /* PG_SHSECLABEL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shseclabel_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shseclabel_d.h new file mode 100644 index 0000000..9fea311 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_shseclabel_d.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * pg_shseclabel_d.h + * Macro definitions for pg_shseclabel + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHSECLABEL_D_H +#define PG_SHSECLABEL_D_H + +/* Macros related to the structure of pg_shseclabel */ + +#define SharedSecLabelRelationId 3592 +#define SharedSecLabelRelation_Rowtype_Id 4066 +#define PgShseclabelToastTable 4060 +#define PgShseclabelToastIndex 4061 +#define SharedSecLabelObjectIndexId 3593 + +#define Anum_pg_shseclabel_objoid 1 +#define Anum_pg_shseclabel_classoid 2 +#define Anum_pg_shseclabel_provider 3 +#define Anum_pg_shseclabel_label 4 + +#define Natts_pg_shseclabel 4 + +/* Definitions copied from pg_shseclabel.h */ + + +/* OID symbols for objects defined in pg_shseclabel.dat */ + + +#endif /* PG_SHSECLABEL_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic.h new file mode 100644 index 0000000..4216e27 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic.h @@ -0,0 +1,288 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic.h + * definition of the "statistics" system catalog (pg_statistic) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_statistic.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_H +#define PG_STATISTIC_H + +#include "catalog/genbki.h" +#include "catalog/pg_statistic_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_statistic definition. cpp turns this into + * typedef struct FormData_pg_statistic + * ---------------- + */ +CATALOG(pg_statistic,2619,StatisticRelationId) +{ + /* These fields form the unique key for the entry: */ + Oid starelid BKI_LOOKUP(pg_class); /* relation containing + * attribute */ + int16 staattnum; /* attribute (column) stats are for */ + bool stainherit; /* true if inheritance children are included */ + + /* the fraction of the column's entries that are NULL: */ + float4 stanullfrac; + + /* + * stawidth is the average width in bytes of non-null entries. For + * fixed-width datatypes this is of course the same as the typlen, but for + * var-width types it is more useful. Note that this is the average width + * of the data as actually stored, post-TOASTing (eg, for a + * moved-out-of-line value, only the size of the pointer object is + * counted). This is the appropriate definition for the primary use of + * the statistic, which is to estimate sizes of in-memory hash tables of + * tuples. + */ + int32 stawidth; + + /* ---------------- + * stadistinct indicates the (approximate) number of distinct non-null + * data values in the column. The interpretation is: + * 0 unknown or not computed + * > 0 actual number of distinct values + * < 0 negative of multiplier for number of rows + * The special negative case allows us to cope with columns that are + * unique (stadistinct = -1) or nearly so (for example, a column in which + * non-null values appear about twice on the average could be represented + * by stadistinct = -0.5 if there are no nulls, or -0.4 if 20% of the + * column is nulls). Because the number-of-rows statistic in pg_class may + * be updated more frequently than pg_statistic is, it's important to be + * able to describe such situations as a multiple of the number of rows, + * rather than a fixed number of distinct values. But in other cases a + * fixed number is correct (eg, a boolean column). + * ---------------- + */ + float4 stadistinct; + + /* ---------------- + * To allow keeping statistics on different kinds of datatypes, + * we do not hard-wire any particular meaning for the remaining + * statistical fields. Instead, we provide several "slots" in which + * statistical data can be placed. Each slot includes: + * kind integer code identifying kind of data (see below) + * op OID of associated operator, if needed + * coll OID of relevant collation, or 0 if none + * numbers float4 array (for statistical values) + * values anyarray (for representations of data values) + * The ID, operator, and collation fields are never NULL; they are zeroes + * in an unused slot. The numbers and values fields are NULL in an + * unused slot, and might also be NULL in a used slot if the slot kind + * has no need for one or the other. + * ---------------- + */ + + int16 stakind1; + int16 stakind2; + int16 stakind3; + int16 stakind4; + int16 stakind5; + + Oid staop1 BKI_LOOKUP_OPT(pg_operator); + Oid staop2 BKI_LOOKUP_OPT(pg_operator); + Oid staop3 BKI_LOOKUP_OPT(pg_operator); + Oid staop4 BKI_LOOKUP_OPT(pg_operator); + Oid staop5 BKI_LOOKUP_OPT(pg_operator); + + Oid stacoll1 BKI_LOOKUP_OPT(pg_collation); + Oid stacoll2 BKI_LOOKUP_OPT(pg_collation); + Oid stacoll3 BKI_LOOKUP_OPT(pg_collation); + Oid stacoll4 BKI_LOOKUP_OPT(pg_collation); + Oid stacoll5 BKI_LOOKUP_OPT(pg_collation); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + float4 stanumbers1[1]; + float4 stanumbers2[1]; + float4 stanumbers3[1]; + float4 stanumbers4[1]; + float4 stanumbers5[1]; + + /* + * Values in these arrays are values of the column's data type, or of some + * related type such as an array element type. We presently have to cheat + * quite a bit to allow polymorphic arrays of this kind, but perhaps + * someday it'll be a less bogus facility. + */ + anyarray stavalues1; + anyarray stavalues2; + anyarray stavalues3; + anyarray stavalues4; + anyarray stavalues5; +#endif +} FormData_pg_statistic; + +#define STATISTIC_NUM_SLOTS 5 + + +/* ---------------- + * Form_pg_statistic corresponds to a pointer to a tuple with + * the format of pg_statistic relation. + * ---------------- + */ +typedef FormData_pg_statistic *Form_pg_statistic; + +DECLARE_TOAST(pg_statistic, 2840, 2841); + +DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_relid_att_inh_index, 2696, StatisticRelidAttnumInhIndexId, pg_statistic, btree(starelid oid_ops, staattnum int2_ops, stainherit bool_ops)); + +MAKE_SYSCACHE(STATRELATTINH, pg_statistic_relid_att_inh_index, 128); + +DECLARE_FOREIGN_KEY((starelid, staattnum), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Several statistical slot "kinds" are defined by core PostgreSQL, as + * documented below. Also, custom data types can define their own "kind" + * codes by mutual agreement between a custom typanalyze routine and the + * selectivity estimation functions of the type's operators. + * + * Code reading the pg_statistic relation should not assume that a particular + * data "kind" will appear in any particular slot. Instead, search the + * stakind fields to see if the desired data is available. (The standard + * function get_attstatsslot() may be used for this.) + * + * Note: The pg_stats view needs to be modified whenever a new slot kind is + * added to core. + */ + +/* + * The present allocation of "kind" codes is: + * + * 1-99: reserved for assignment by the core PostgreSQL project + * (values in this range will be documented in this file) + * 100-199: reserved for assignment by the PostGIS project + * (values to be documented in PostGIS documentation) + * 200-299: reserved for assignment by the ESRI ST_Geometry project + * (values to be documented in ESRI ST_Geometry documentation) + * 300-9999: reserved for future public assignments + * + * For private use you may choose a "kind" code at random in the range + * 10000-30000. However, for code that is to be widely disseminated it is + * better to obtain a publicly defined "kind" code by request from the + * PostgreSQL Global Development Group. + */ + +/* + * In a "most common values" slot, staop is the OID of the "=" operator + * used to decide whether values are the same or not, and stacoll is the + * collation used (same as column's collation). stavalues contains + * the K most common non-null values appearing in the column, and stanumbers + * contains their frequencies (fractions of total row count). The values + * shall be ordered in decreasing frequency. Note that since the arrays are + * variable-size, K may be chosen at ANALYZE time. Values should not appear + * in MCV unless they have been observed to occur more than once; a unique + * column will have no MCV slot. + */ +#define STATISTIC_KIND_MCV 1 + +/* + * A "histogram" slot describes the distribution of scalar data. staop is + * the OID of the "<" operator that describes the sort ordering, and stacoll + * is the relevant collation. (In theory more than one histogram could appear, + * if a datatype has more than one useful sort operator or we care about more + * than one collation. Currently the collation will always be that of the + * underlying column.) stavalues contains M (>=2) non-null values that + * divide the non-null column data values into M-1 bins of approximately equal + * population. The first stavalues item is the MIN and the last is the MAX. + * stanumbers is not used and should be NULL. IMPORTANT POINT: if an MCV + * slot is also provided, then the histogram describes the data distribution + * *after removing the values listed in MCV* (thus, it's a "compressed + * histogram" in the technical parlance). This allows a more accurate + * representation of the distribution of a column with some very-common + * values. In a column with only a few distinct values, it's possible that + * the MCV list describes the entire data population; in this case the + * histogram reduces to empty and should be omitted. + */ +#define STATISTIC_KIND_HISTOGRAM 2 + +/* + * A "correlation" slot describes the correlation between the physical order + * of table tuples and the ordering of data values of this column, as seen + * by the "<" operator identified by staop with the collation identified by + * stacoll. (As with the histogram, more than one entry could theoretically + * appear.) stavalues is not used and should be NULL. stanumbers contains + * a single entry, the correlation coefficient between the sequence of data + * values and the sequence of their actual tuple positions. The coefficient + * ranges from +1 to -1. + */ +#define STATISTIC_KIND_CORRELATION 3 + +/* + * A "most common elements" slot is similar to a "most common values" slot, + * except that it stores the most common non-null *elements* of the column + * values. This is useful when the column datatype is an array or some other + * type with identifiable elements (for instance, tsvector). staop contains + * the equality operator appropriate to the element type, and stacoll + * contains the collation to use with it. stavalues contains + * the most common element values, and stanumbers their frequencies. Unlike + * MCV slots, frequencies are measured as the fraction of non-null rows the + * element value appears in, not the frequency of all rows. Also unlike + * MCV slots, the values are sorted into the element type's default order + * (to support binary search for a particular value). Since this puts the + * minimum and maximum frequencies at unpredictable spots in stanumbers, + * there are two extra members of stanumbers, holding copies of the minimum + * and maximum frequencies. Optionally, there can be a third extra member, + * which holds the frequency of null elements (expressed in the same terms: + * the fraction of non-null rows that contain at least one null element). If + * this member is omitted, the column is presumed to contain no null elements. + * + * Note: in current usage for tsvector columns, the stavalues elements are of + * type text, even though their representation within tsvector is not + * exactly text. + */ +#define STATISTIC_KIND_MCELEM 4 + +/* + * A "distinct elements count histogram" slot describes the distribution of + * the number of distinct element values present in each row of an array-type + * column. Only non-null rows are considered, and only non-null elements. + * staop contains the equality operator appropriate to the element type, + * and stacoll contains the collation to use with it. + * stavalues is not used and should be NULL. The last member of stanumbers is + * the average count of distinct element values over all non-null rows. The + * preceding M (>=2) members form a histogram that divides the population of + * distinct-elements counts into M-1 bins of approximately equal population. + * The first of these is the minimum observed count, and the last the maximum. + */ +#define STATISTIC_KIND_DECHIST 5 + +/* + * A "length histogram" slot describes the distribution of range lengths in + * rows of a range-type column. stanumbers contains a single entry, the + * fraction of empty ranges. stavalues is a histogram of non-empty lengths, in + * a format similar to STATISTIC_KIND_HISTOGRAM: it contains M (>=2) range + * values that divide the column data values into M-1 bins of approximately + * equal population. The lengths are stored as float8s, as measured by the + * range type's subdiff function. Only non-null, non-empty rows are + * considered. + */ +#define STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM 6 + +/* + * A "bounds histogram" slot is similar to STATISTIC_KIND_HISTOGRAM, but for + * a range-type column. stavalues contains M (>=2) range values that divide + * the column data values into M-1 bins of approximately equal population. + * Unlike a regular scalar histogram, this is actually two histograms combined + * into a single array, with the lower bounds of each value forming a + * histogram of lower bounds, and the upper bounds a histogram of upper + * bounds. Only non-NULL, non-empty ranges are included. + */ +#define STATISTIC_KIND_BOUNDS_HISTOGRAM 7 + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_STATISTIC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_d.h new file mode 100644 index 0000000..b7b1e0b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_d.h @@ -0,0 +1,206 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_d.h + * Macro definitions for pg_statistic + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_D_H +#define PG_STATISTIC_D_H + +/* Macros related to the structure of pg_statistic */ + +#define StatisticRelationId 2619 +#define StatisticRelidAttnumInhIndexId 2696 + +#define Anum_pg_statistic_starelid 1 +#define Anum_pg_statistic_staattnum 2 +#define Anum_pg_statistic_stainherit 3 +#define Anum_pg_statistic_stanullfrac 4 +#define Anum_pg_statistic_stawidth 5 +#define Anum_pg_statistic_stadistinct 6 +#define Anum_pg_statistic_stakind1 7 +#define Anum_pg_statistic_stakind2 8 +#define Anum_pg_statistic_stakind3 9 +#define Anum_pg_statistic_stakind4 10 +#define Anum_pg_statistic_stakind5 11 +#define Anum_pg_statistic_staop1 12 +#define Anum_pg_statistic_staop2 13 +#define Anum_pg_statistic_staop3 14 +#define Anum_pg_statistic_staop4 15 +#define Anum_pg_statistic_staop5 16 +#define Anum_pg_statistic_stacoll1 17 +#define Anum_pg_statistic_stacoll2 18 +#define Anum_pg_statistic_stacoll3 19 +#define Anum_pg_statistic_stacoll4 20 +#define Anum_pg_statistic_stacoll5 21 +#define Anum_pg_statistic_stanumbers1 22 +#define Anum_pg_statistic_stanumbers2 23 +#define Anum_pg_statistic_stanumbers3 24 +#define Anum_pg_statistic_stanumbers4 25 +#define Anum_pg_statistic_stanumbers5 26 +#define Anum_pg_statistic_stavalues1 27 +#define Anum_pg_statistic_stavalues2 28 +#define Anum_pg_statistic_stavalues3 29 +#define Anum_pg_statistic_stavalues4 30 +#define Anum_pg_statistic_stavalues5 31 + +#define Natts_pg_statistic 31 + +/* Definitions copied from pg_statistic.h */ + + +/* + * Several statistical slot "kinds" are defined by core PostgreSQL, as + * documented below. Also, custom data types can define their own "kind" + * codes by mutual agreement between a custom typanalyze routine and the + * selectivity estimation functions of the type's operators. + * + * Code reading the pg_statistic relation should not assume that a particular + * data "kind" will appear in any particular slot. Instead, search the + * stakind fields to see if the desired data is available. (The standard + * function get_attstatsslot() may be used for this.) + * + * Note: The pg_stats view needs to be modified whenever a new slot kind is + * added to core. + */ + +/* + * The present allocation of "kind" codes is: + * + * 1-99: reserved for assignment by the core PostgreSQL project + * (values in this range will be documented in this file) + * 100-199: reserved for assignment by the PostGIS project + * (values to be documented in PostGIS documentation) + * 200-299: reserved for assignment by the ESRI ST_Geometry project + * (values to be documented in ESRI ST_Geometry documentation) + * 300-9999: reserved for future public assignments + * + * For private use you may choose a "kind" code at random in the range + * 10000-30000. However, for code that is to be widely disseminated it is + * better to obtain a publicly defined "kind" code by request from the + * PostgreSQL Global Development Group. + */ + +/* + * In a "most common values" slot, staop is the OID of the "=" operator + * used to decide whether values are the same or not, and stacoll is the + * collation used (same as column's collation). stavalues contains + * the K most common non-null values appearing in the column, and stanumbers + * contains their frequencies (fractions of total row count). The values + * shall be ordered in decreasing frequency. Note that since the arrays are + * variable-size, K may be chosen at ANALYZE time. Values should not appear + * in MCV unless they have been observed to occur more than once; a unique + * column will have no MCV slot. + */ +#define STATISTIC_KIND_MCV 1 + +/* + * A "histogram" slot describes the distribution of scalar data. staop is + * the OID of the "<" operator that describes the sort ordering, and stacoll + * is the relevant collation. (In theory more than one histogram could appear, + * if a datatype has more than one useful sort operator or we care about more + * than one collation. Currently the collation will always be that of the + * underlying column.) stavalues contains M (>=2) non-null values that + * divide the non-null column data values into M-1 bins of approximately equal + * population. The first stavalues item is the MIN and the last is the MAX. + * stanumbers is not used and should be NULL. IMPORTANT POINT: if an MCV + * slot is also provided, then the histogram describes the data distribution + * *after removing the values listed in MCV* (thus, it's a "compressed + * histogram" in the technical parlance). This allows a more accurate + * representation of the distribution of a column with some very-common + * values. In a column with only a few distinct values, it's possible that + * the MCV list describes the entire data population; in this case the + * histogram reduces to empty and should be omitted. + */ +#define STATISTIC_KIND_HISTOGRAM 2 + +/* + * A "correlation" slot describes the correlation between the physical order + * of table tuples and the ordering of data values of this column, as seen + * by the "<" operator identified by staop with the collation identified by + * stacoll. (As with the histogram, more than one entry could theoretically + * appear.) stavalues is not used and should be NULL. stanumbers contains + * a single entry, the correlation coefficient between the sequence of data + * values and the sequence of their actual tuple positions. The coefficient + * ranges from +1 to -1. + */ +#define STATISTIC_KIND_CORRELATION 3 + +/* + * A "most common elements" slot is similar to a "most common values" slot, + * except that it stores the most common non-null *elements* of the column + * values. This is useful when the column datatype is an array or some other + * type with identifiable elements (for instance, tsvector). staop contains + * the equality operator appropriate to the element type, and stacoll + * contains the collation to use with it. stavalues contains + * the most common element values, and stanumbers their frequencies. Unlike + * MCV slots, frequencies are measured as the fraction of non-null rows the + * element value appears in, not the frequency of all rows. Also unlike + * MCV slots, the values are sorted into the element type's default order + * (to support binary search for a particular value). Since this puts the + * minimum and maximum frequencies at unpredictable spots in stanumbers, + * there are two extra members of stanumbers, holding copies of the minimum + * and maximum frequencies. Optionally, there can be a third extra member, + * which holds the frequency of null elements (expressed in the same terms: + * the fraction of non-null rows that contain at least one null element). If + * this member is omitted, the column is presumed to contain no null elements. + * + * Note: in current usage for tsvector columns, the stavalues elements are of + * type text, even though their representation within tsvector is not + * exactly text. + */ +#define STATISTIC_KIND_MCELEM 4 + +/* + * A "distinct elements count histogram" slot describes the distribution of + * the number of distinct element values present in each row of an array-type + * column. Only non-null rows are considered, and only non-null elements. + * staop contains the equality operator appropriate to the element type, + * and stacoll contains the collation to use with it. + * stavalues is not used and should be NULL. The last member of stanumbers is + * the average count of distinct element values over all non-null rows. The + * preceding M (>=2) members form a histogram that divides the population of + * distinct-elements counts into M-1 bins of approximately equal population. + * The first of these is the minimum observed count, and the last the maximum. + */ +#define STATISTIC_KIND_DECHIST 5 + +/* + * A "length histogram" slot describes the distribution of range lengths in + * rows of a range-type column. stanumbers contains a single entry, the + * fraction of empty ranges. stavalues is a histogram of non-empty lengths, in + * a format similar to STATISTIC_KIND_HISTOGRAM: it contains M (>=2) range + * values that divide the column data values into M-1 bins of approximately + * equal population. The lengths are stored as float8s, as measured by the + * range type's subdiff function. Only non-null, non-empty rows are + * considered. + */ +#define STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM 6 + +/* + * A "bounds histogram" slot is similar to STATISTIC_KIND_HISTOGRAM, but for + * a range-type column. stavalues contains M (>=2) range values that divide + * the column data values into M-1 bins of approximately equal population. + * Unlike a regular scalar histogram, this is actually two histograms combined + * into a single array, with the lower bounds of each value forming a + * histogram of lower bounds, and the upper bounds a histogram of upper + * bounds. Only non-NULL, non-empty ranges are included. + */ +#define STATISTIC_KIND_BOUNDS_HISTOGRAM 7 + + +/* OID symbols for objects defined in pg_statistic.dat */ + + +#endif /* PG_STATISTIC_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext.h new file mode 100644 index 0000000..d476095 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_ext.h + * definition of the "extended statistics" system catalog + * (pg_statistic_ext) + * + * Note that pg_statistic_ext contains the definitions of extended statistics + * objects, created by CREATE STATISTICS, but not the actual statistical data, + * created by running ANALYZE. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_statistic_ext.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_EXT_H +#define PG_STATISTIC_EXT_H + +#include "catalog/genbki.h" +#include "catalog/pg_statistic_ext_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_statistic_ext definition. cpp turns this into + * typedef struct FormData_pg_statistic_ext + * ---------------- + */ +CATALOG(pg_statistic_ext,3381,StatisticExtRelationId) +{ + Oid oid; /* oid */ + + Oid stxrelid BKI_LOOKUP(pg_class); /* relation containing + * attributes */ + + /* These two fields form the unique key for the entry: */ + NameData stxname; /* statistics object name */ + Oid stxnamespace BKI_LOOKUP(pg_namespace); /* OID of statistics + * object's namespace */ + + Oid stxowner BKI_LOOKUP(pg_authid); /* statistics object's owner */ + + /* + * variable-length/nullable fields start here, but we allow direct access + * to stxkeys + */ + int2vector stxkeys BKI_FORCE_NOT_NULL; /* array of column keys */ + +#ifdef CATALOG_VARLEN + int16 stxstattarget BKI_DEFAULT(_null_) BKI_FORCE_NULL; /* statistics target */ + char stxkind[1] BKI_FORCE_NOT_NULL; /* statistics kinds requested + * to build */ + pg_node_tree stxexprs; /* A list of expression trees for stats + * attributes that are not simple column + * references. */ +#endif + +} FormData_pg_statistic_ext; + +/* ---------------- + * Form_pg_statistic_ext corresponds to a pointer to a tuple with + * the format of pg_statistic_ext relation. + * ---------------- + */ +typedef FormData_pg_statistic_ext *Form_pg_statistic_ext; + +DECLARE_TOAST(pg_statistic_ext, 3439, 3440); + +DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_ext_oid_index, 3380, StatisticExtOidIndexId, pg_statistic_ext, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_statistic_ext_name_index, 3997, StatisticExtNameIndexId, pg_statistic_ext, btree(stxname name_ops, stxnamespace oid_ops)); +DECLARE_INDEX(pg_statistic_ext_relid_index, 3379, StatisticExtRelidIndexId, pg_statistic_ext, btree(stxrelid oid_ops)); + +MAKE_SYSCACHE(STATEXTOID, pg_statistic_ext_oid_index, 4); +MAKE_SYSCACHE(STATEXTNAMENSP, pg_statistic_ext_name_index, 4); + +DECLARE_ARRAY_FOREIGN_KEY((stxrelid, stxkeys), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +#define STATS_EXT_NDISTINCT 'd' +#define STATS_EXT_DEPENDENCIES 'f' +#define STATS_EXT_MCV 'm' +#define STATS_EXT_EXPRESSIONS 'e' + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_STATISTIC_EXT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext_d.h new file mode 100644 index 0000000..685fce1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext_d.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_ext_d.h + * Macro definitions for pg_statistic_ext + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_EXT_D_H +#define PG_STATISTIC_EXT_D_H + +/* Macros related to the structure of pg_statistic_ext */ + +#define StatisticExtRelationId 3381 +#define StatisticExtOidIndexId 3380 +#define StatisticExtNameIndexId 3997 +#define StatisticExtRelidIndexId 3379 + +#define Anum_pg_statistic_ext_oid 1 +#define Anum_pg_statistic_ext_stxrelid 2 +#define Anum_pg_statistic_ext_stxname 3 +#define Anum_pg_statistic_ext_stxnamespace 4 +#define Anum_pg_statistic_ext_stxowner 5 +#define Anum_pg_statistic_ext_stxkeys 6 +#define Anum_pg_statistic_ext_stxstattarget 7 +#define Anum_pg_statistic_ext_stxkind 8 +#define Anum_pg_statistic_ext_stxexprs 9 + +#define Natts_pg_statistic_ext 9 + +/* Definitions copied from pg_statistic_ext.h */ + + +#define STATS_EXT_NDISTINCT 'd' +#define STATS_EXT_DEPENDENCIES 'f' +#define STATS_EXT_MCV 'm' +#define STATS_EXT_EXPRESSIONS 'e' + + +/* OID symbols for objects defined in pg_statistic_ext.dat */ + + +#endif /* PG_STATISTIC_EXT_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext_data.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext_data.h new file mode 100644 index 0000000..809b525 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext_data.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_ext_data.h + * definition of the "extended statistics data" system catalog + * (pg_statistic_ext_data) + * + * This catalog stores the statistical data for extended statistics objects. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_statistic_ext_data.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_EXT_DATA_H +#define PG_STATISTIC_EXT_DATA_H + +#include "catalog/genbki.h" +#include "catalog/pg_statistic_ext_data_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_statistic_ext_data definition. cpp turns this into + * typedef struct FormData_pg_statistic_ext_data + * ---------------- + */ +CATALOG(pg_statistic_ext_data,3429,StatisticExtDataRelationId) +{ + Oid stxoid BKI_LOOKUP(pg_statistic_ext); /* statistics object + * this data is for */ + bool stxdinherit; /* true if inheritance children are included */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + pg_ndistinct stxdndistinct; /* ndistinct coefficients (serialized) */ + pg_dependencies stxddependencies; /* dependencies (serialized) */ + pg_mcv_list stxdmcv; /* MCV (serialized) */ + pg_statistic stxdexpr[1]; /* stats for expressions */ + +#endif + +} FormData_pg_statistic_ext_data; + +/* ---------------- + * Form_pg_statistic_ext_data corresponds to a pointer to a tuple with + * the format of pg_statistic_ext_data relation. + * ---------------- + */ +typedef FormData_pg_statistic_ext_data *Form_pg_statistic_ext_data; + +DECLARE_TOAST(pg_statistic_ext_data, 3430, 3431); + +DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_ext_data_stxoid_inh_index, 3433, StatisticExtDataStxoidInhIndexId, pg_statistic_ext_data, btree(stxoid oid_ops, stxdinherit bool_ops)); + +MAKE_SYSCACHE(STATEXTDATASTXOID, pg_statistic_ext_data_stxoid_inh_index, 4); + +#endif /* PG_STATISTIC_EXT_DATA_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext_data_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext_data_d.h new file mode 100644 index 0000000..a967a0d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_statistic_ext_data_d.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_ext_data_d.h + * Macro definitions for pg_statistic_ext_data + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_EXT_DATA_D_H +#define PG_STATISTIC_EXT_DATA_D_H + +/* Macros related to the structure of pg_statistic_ext_data */ + +#define StatisticExtDataRelationId 3429 +#define StatisticExtDataStxoidInhIndexId 3433 + +#define Anum_pg_statistic_ext_data_stxoid 1 +#define Anum_pg_statistic_ext_data_stxdinherit 2 +#define Anum_pg_statistic_ext_data_stxdndistinct 3 +#define Anum_pg_statistic_ext_data_stxddependencies 4 +#define Anum_pg_statistic_ext_data_stxdmcv 5 +#define Anum_pg_statistic_ext_data_stxdexpr 6 + +#define Natts_pg_statistic_ext_data 6 + +/* Definitions copied from pg_statistic_ext_data.h */ + + +/* OID symbols for objects defined in pg_statistic_ext_data.dat */ + + +#endif /* PG_STATISTIC_EXT_DATA_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription.h new file mode 100644 index 0000000..20fc329 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription.h @@ -0,0 +1,190 @@ +/* ------------------------------------------------------------------------- + * + * pg_subscription.h + * definition of the "subscription" system catalog (pg_subscription) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_subscription.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SUBSCRIPTION_H +#define PG_SUBSCRIPTION_H + +#include "access/xlogdefs.h" +#include "catalog/genbki.h" +#include "catalog/pg_subscription_d.h" /* IWYU pragma: export */ +#include "lib/stringinfo.h" +#include "nodes/pg_list.h" + +/* ---------------- + * pg_subscription definition. cpp turns this into + * typedef struct FormData_pg_subscription + * ---------------- + */ + +/* + * Technically, the subscriptions live inside the database, so a shared catalog + * seems weird, but the replication launcher process needs to access all of + * them to be able to start the workers, so we have to put them in a shared, + * nailed catalog. + * + * CAUTION: There is a GRANT in system_views.sql to grant public select + * access on all columns except subconninfo. When you add a new column + * here, be sure to update that (or, if the new column is not to be publicly + * readable, update associated comments and catalogs.sgml instead). + */ +CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101,SubscriptionRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + + Oid subdbid BKI_LOOKUP(pg_database); /* Database the + * subscription is in. */ + + XLogRecPtr subskiplsn; /* All changes finished at this LSN are + * skipped */ + + NameData subname; /* Name of the subscription */ + + Oid subowner BKI_LOOKUP(pg_authid); /* Owner of the subscription */ + + bool subenabled; /* True if the subscription is enabled (the + * worker should be running) */ + + bool subbinary; /* True if the subscription wants the + * publisher to send data in binary */ + + char substream; /* Stream in-progress transactions. See + * LOGICALREP_STREAM_xxx constants. */ + + char subtwophasestate; /* Stream two-phase transactions */ + + bool subdisableonerr; /* True if a worker error should cause the + * subscription to be disabled */ + + bool subpasswordrequired; /* Must connection use a password? */ + + bool subrunasowner; /* True if replication should execute as the + * subscription owner */ + + bool subfailover; /* True if the associated replication slots + * (i.e. the main slot and the table sync + * slots) in the upstream database are enabled + * to be synchronized to the standbys. */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* Connection string to the publisher */ + text subconninfo BKI_FORCE_NOT_NULL; + + /* Slot name on publisher */ + NameData subslotname BKI_FORCE_NULL; + + /* Synchronous commit setting for worker */ + text subsynccommit BKI_FORCE_NOT_NULL; + + /* List of publications subscribed to */ + text subpublications[1] BKI_FORCE_NOT_NULL; + + /* Only publish data originating from the specified origin */ + text suborigin BKI_DEFAULT(LOGICALREP_ORIGIN_ANY); +#endif +} FormData_pg_subscription; + +typedef FormData_pg_subscription *Form_pg_subscription; + +DECLARE_TOAST_WITH_MACRO(pg_subscription, 4183, 4184, PgSubscriptionToastTable, PgSubscriptionToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_subscription_oid_index, 6114, SubscriptionObjectIndexId, pg_subscription, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_subscription_subname_index, 6115, SubscriptionNameIndexId, pg_subscription, btree(subdbid oid_ops, subname name_ops)); + +MAKE_SYSCACHE(SUBSCRIPTIONOID, pg_subscription_oid_index, 4); +MAKE_SYSCACHE(SUBSCRIPTIONNAME, pg_subscription_subname_index, 4); + +typedef struct Subscription +{ + Oid oid; /* Oid of the subscription */ + Oid dbid; /* Oid of the database which subscription is + * in */ + XLogRecPtr skiplsn; /* All changes finished at this LSN are + * skipped */ + char *name; /* Name of the subscription */ + Oid owner; /* Oid of the subscription owner */ + bool ownersuperuser; /* Is the subscription owner a superuser? */ + bool enabled; /* Indicates if the subscription is enabled */ + bool binary; /* Indicates if the subscription wants data in + * binary format */ + char stream; /* Allow streaming in-progress transactions. + * See LOGICALREP_STREAM_xxx constants. */ + char twophasestate; /* Allow streaming two-phase transactions */ + bool disableonerr; /* Indicates if the subscription should be + * automatically disabled if a worker error + * occurs */ + bool passwordrequired; /* Must connection use a password? */ + bool runasowner; /* Run replication as subscription owner */ + bool failover; /* True if the associated replication slots + * (i.e. the main slot and the table sync + * slots) in the upstream database are enabled + * to be synchronized to the standbys. */ + char *conninfo; /* Connection string to the publisher */ + char *slotname; /* Name of the replication slot */ + char *synccommit; /* Synchronous commit setting for worker */ + List *publications; /* List of publication names to subscribe to */ + char *origin; /* Only publish data originating from the + * specified origin */ +} Subscription; + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * two_phase tri-state values. See comments atop worker.c to know more about + * these states. + */ +#define LOGICALREP_TWOPHASE_STATE_DISABLED 'd' +#define LOGICALREP_TWOPHASE_STATE_PENDING 'p' +#define LOGICALREP_TWOPHASE_STATE_ENABLED 'e' + +/* + * The subscription will request the publisher to only send changes that do not + * have any origin. + */ +#define LOGICALREP_ORIGIN_NONE "none" + +/* + * The subscription will request the publisher to send changes regardless + * of their origin. + */ +#define LOGICALREP_ORIGIN_ANY "any" + +/* Disallow streaming in-progress transactions. */ +#define LOGICALREP_STREAM_OFF 'f' + +/* + * Streaming in-progress transactions are written to a temporary file and + * applied only after the transaction is committed on upstream. + */ +#define LOGICALREP_STREAM_ON 't' + +/* + * Streaming in-progress transactions are applied immediately via a parallel + * apply worker. + */ +#define LOGICALREP_STREAM_PARALLEL 'p' + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +extern Subscription *GetSubscription(Oid subid, bool missing_ok); +extern void FreeSubscription(Subscription *sub); +extern void DisableSubscription(Oid subid); + +extern int CountDBSubscriptions(Oid dbid); + +extern void GetPublicationsStr(List *publications, StringInfo dest, + bool quote_literal); + +#endif /* PG_SUBSCRIPTION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription_d.h new file mode 100644 index 0000000..a9ba1ab --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription_d.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * pg_subscription_d.h + * Macro definitions for pg_subscription + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SUBSCRIPTION_D_H +#define PG_SUBSCRIPTION_D_H + +/* Macros related to the structure of pg_subscription */ + +#define SubscriptionRelationId 6100 +#define SubscriptionRelation_Rowtype_Id 6101 +#define PgSubscriptionToastTable 4183 +#define PgSubscriptionToastIndex 4184 +#define SubscriptionObjectIndexId 6114 +#define SubscriptionNameIndexId 6115 + +#define Anum_pg_subscription_oid 1 +#define Anum_pg_subscription_subdbid 2 +#define Anum_pg_subscription_subskiplsn 3 +#define Anum_pg_subscription_subname 4 +#define Anum_pg_subscription_subowner 5 +#define Anum_pg_subscription_subenabled 6 +#define Anum_pg_subscription_subbinary 7 +#define Anum_pg_subscription_substream 8 +#define Anum_pg_subscription_subtwophasestate 9 +#define Anum_pg_subscription_subdisableonerr 10 +#define Anum_pg_subscription_subpasswordrequired 11 +#define Anum_pg_subscription_subrunasowner 12 +#define Anum_pg_subscription_subfailover 13 +#define Anum_pg_subscription_subconninfo 14 +#define Anum_pg_subscription_subslotname 15 +#define Anum_pg_subscription_subsynccommit 16 +#define Anum_pg_subscription_subpublications 17 +#define Anum_pg_subscription_suborigin 18 + +#define Natts_pg_subscription 18 + +/* Definitions copied from pg_subscription.h */ + + +/* + * two_phase tri-state values. See comments atop worker.c to know more about + * these states. + */ +#define LOGICALREP_TWOPHASE_STATE_DISABLED 'd' +#define LOGICALREP_TWOPHASE_STATE_PENDING 'p' +#define LOGICALREP_TWOPHASE_STATE_ENABLED 'e' + +/* + * The subscription will request the publisher to only send changes that do not + * have any origin. + */ +#define LOGICALREP_ORIGIN_NONE "none" + +/* + * The subscription will request the publisher to send changes regardless + * of their origin. + */ +#define LOGICALREP_ORIGIN_ANY "any" + +/* Disallow streaming in-progress transactions. */ +#define LOGICALREP_STREAM_OFF 'f' + +/* + * Streaming in-progress transactions are written to a temporary file and + * applied only after the transaction is committed on upstream. + */ +#define LOGICALREP_STREAM_ON 't' + +/* + * Streaming in-progress transactions are applied immediately via a parallel + * apply worker. + */ +#define LOGICALREP_STREAM_PARALLEL 'p' + + +/* OID symbols for objects defined in pg_subscription.dat */ + + +#endif /* PG_SUBSCRIPTION_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription_rel.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription_rel.h new file mode 100644 index 0000000..f458447 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription_rel.h @@ -0,0 +1,95 @@ +/* ------------------------------------------------------------------------- + * + * pg_subscription_rel.h + * definition of the system catalog containing the state for each + * replicated table in each subscription (pg_subscription_rel) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_subscription_rel.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SUBSCRIPTION_REL_H +#define PG_SUBSCRIPTION_REL_H + +#include "access/xlogdefs.h" +#include "catalog/genbki.h" +#include "catalog/pg_subscription_rel_d.h" /* IWYU pragma: export */ +#include "nodes/pg_list.h" + +/* ---------------- + * pg_subscription_rel definition. cpp turns this into + * typedef struct FormData_pg_subscription_rel + * ---------------- + */ +CATALOG(pg_subscription_rel,6102,SubscriptionRelRelationId) +{ + Oid srsubid BKI_LOOKUP(pg_subscription); /* Oid of subscription */ + Oid srrelid BKI_LOOKUP(pg_class); /* Oid of relation */ + char srsubstate; /* state of the relation in subscription */ + + /* + * Although srsublsn is a fixed-width type, it is allowed to be NULL, so + * we prevent direct C code access to it just as for a varlena field. + */ +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + XLogRecPtr srsublsn BKI_FORCE_NULL; /* remote LSN of the state change + * used for synchronization + * coordination, or NULL if not + * valid */ +#endif +} FormData_pg_subscription_rel; + +typedef FormData_pg_subscription_rel *Form_pg_subscription_rel; + +DECLARE_UNIQUE_INDEX_PKEY(pg_subscription_rel_srrelid_srsubid_index, 6117, SubscriptionRelSrrelidSrsubidIndexId, pg_subscription_rel, btree(srrelid oid_ops, srsubid oid_ops)); + +MAKE_SYSCACHE(SUBSCRIPTIONRELMAP, pg_subscription_rel_srrelid_srsubid_index, 64); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* ---------------- + * substate constants + * ---------------- + */ +#define SUBREL_STATE_INIT 'i' /* initializing (sublsn NULL) */ +#define SUBREL_STATE_DATASYNC 'd' /* data is being synchronized (sublsn + * NULL) */ +#define SUBREL_STATE_FINISHEDCOPY 'f' /* tablesync copy phase is completed + * (sublsn NULL) */ +#define SUBREL_STATE_SYNCDONE 's' /* synchronization finished in front of + * apply (sublsn set) */ +#define SUBREL_STATE_READY 'r' /* ready (sublsn set) */ + +/* These are never stored in the catalog, we only use them for IPC. */ +#define SUBREL_STATE_UNKNOWN '\0' /* unknown state */ +#define SUBREL_STATE_SYNCWAIT 'w' /* waiting for sync */ +#define SUBREL_STATE_CATCHUP 'c' /* catching up with apply */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +typedef struct SubscriptionRelState +{ + Oid relid; + XLogRecPtr lsn; + char state; +} SubscriptionRelState; + +extern void AddSubscriptionRelState(Oid subid, Oid relid, char state, + XLogRecPtr sublsn, bool retain_lock); +extern void UpdateSubscriptionRelState(Oid subid, Oid relid, char state, + XLogRecPtr sublsn, bool already_locked); +extern char GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn); +extern void RemoveSubscriptionRel(Oid subid, Oid relid); + +extern bool HasSubscriptionRelations(Oid subid); +extern List *GetSubscriptionRelations(Oid subid, bool not_ready); + +#endif /* PG_SUBSCRIPTION_REL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription_rel_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription_rel_d.h new file mode 100644 index 0000000..dada031 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_subscription_rel_d.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_subscription_rel_d.h + * Macro definitions for pg_subscription_rel + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SUBSCRIPTION_REL_D_H +#define PG_SUBSCRIPTION_REL_D_H + +/* Macros related to the structure of pg_subscription_rel */ + +#define SubscriptionRelRelationId 6102 +#define SubscriptionRelSrrelidSrsubidIndexId 6117 + +#define Anum_pg_subscription_rel_srsubid 1 +#define Anum_pg_subscription_rel_srrelid 2 +#define Anum_pg_subscription_rel_srsubstate 3 +#define Anum_pg_subscription_rel_srsublsn 4 + +#define Natts_pg_subscription_rel 4 + +/* Definitions copied from pg_subscription_rel.h */ + + +/* ---------------- + * substate constants + * ---------------- + */ +#define SUBREL_STATE_INIT 'i' /* initializing (sublsn NULL) */ +#define SUBREL_STATE_DATASYNC 'd' /* data is being synchronized (sublsn + * NULL) */ +#define SUBREL_STATE_FINISHEDCOPY 'f' /* tablesync copy phase is completed + * (sublsn NULL) */ +#define SUBREL_STATE_SYNCDONE 's' /* synchronization finished in front of + * apply (sublsn set) */ +#define SUBREL_STATE_READY 'r' /* ready (sublsn set) */ + +/* These are never stored in the catalog, we only use them for IPC. */ +#define SUBREL_STATE_UNKNOWN '\0' /* unknown state */ +#define SUBREL_STATE_SYNCWAIT 'w' /* waiting for sync */ +#define SUBREL_STATE_CATCHUP 'c' /* catching up with apply */ + + +/* OID symbols for objects defined in pg_subscription_rel.dat */ + + +#endif /* PG_SUBSCRIPTION_REL_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_tablespace.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_tablespace.h new file mode 100644 index 0000000..5293488 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_tablespace.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * pg_tablespace.h + * definition of the "tablespace" system catalog (pg_tablespace) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_tablespace.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TABLESPACE_H +#define PG_TABLESPACE_H + +#include "catalog/genbki.h" +#include "catalog/pg_tablespace_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_tablespace definition. cpp turns this into + * typedef struct FormData_pg_tablespace + * ---------------- + */ +CATALOG(pg_tablespace,1213,TableSpaceRelationId) BKI_SHARED_RELATION +{ + Oid oid; /* oid */ + NameData spcname; /* tablespace name */ + + /* owner of tablespace */ + Oid spcowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem spcacl[1]; /* access permissions */ + text spcoptions[1]; /* per-tablespace options */ +#endif +} FormData_pg_tablespace; + +/* ---------------- + * Form_pg_tablespace corresponds to a pointer to a tuple with + * the format of pg_tablespace relation. + * ---------------- + */ +typedef FormData_pg_tablespace *Form_pg_tablespace; + +DECLARE_TOAST_WITH_MACRO(pg_tablespace, 4185, 4186, PgTablespaceToastTable, PgTablespaceToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_tablespace_oid_index, 2697, TablespaceOidIndexId, pg_tablespace, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_tablespace_spcname_index, 2698, TablespaceNameIndexId, pg_tablespace, btree(spcname name_ops)); + +MAKE_SYSCACHE(TABLESPACEOID, pg_tablespace_oid_index, 4); + +#endif /* PG_TABLESPACE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_tablespace_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_tablespace_d.h new file mode 100644 index 0000000..7145363 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_tablespace_d.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * pg_tablespace_d.h + * Macro definitions for pg_tablespace + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TABLESPACE_D_H +#define PG_TABLESPACE_D_H + +/* Macros related to the structure of pg_tablespace */ + +#define TableSpaceRelationId 1213 +#define PgTablespaceToastTable 4185 +#define PgTablespaceToastIndex 4186 +#define TablespaceOidIndexId 2697 +#define TablespaceNameIndexId 2698 + +#define Anum_pg_tablespace_oid 1 +#define Anum_pg_tablespace_spcname 2 +#define Anum_pg_tablespace_spcowner 3 +#define Anum_pg_tablespace_spcacl 4 +#define Anum_pg_tablespace_spcoptions 5 + +#define Natts_pg_tablespace 5 + +/* Definitions copied from pg_tablespace.h */ + + +/* OID symbols for objects defined in pg_tablespace.dat */ + +#define DEFAULTTABLESPACE_OID 1663 +#define GLOBALTABLESPACE_OID 1664 + +#endif /* PG_TABLESPACE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_transform.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_transform.h new file mode 100644 index 0000000..bc3d943 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_transform.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_transform.h + * definition of the "transform" system catalog (pg_transform) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_transform.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TRANSFORM_H +#define PG_TRANSFORM_H + +#include "catalog/genbki.h" +#include "catalog/pg_transform_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_transform definition. cpp turns this into + * typedef struct FormData_pg_transform + * ---------------- + */ +CATALOG(pg_transform,3576,TransformRelationId) +{ + Oid oid; /* oid */ + Oid trftype BKI_LOOKUP(pg_type); + Oid trflang BKI_LOOKUP(pg_language); + regproc trffromsql BKI_LOOKUP_OPT(pg_proc); + regproc trftosql BKI_LOOKUP_OPT(pg_proc); +} FormData_pg_transform; + +/* ---------------- + * Form_pg_transform corresponds to a pointer to a tuple with + * the format of pg_transform relation. + * ---------------- + */ +typedef FormData_pg_transform *Form_pg_transform; + +DECLARE_UNIQUE_INDEX_PKEY(pg_transform_oid_index, 3574, TransformOidIndexId, pg_transform, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_transform_type_lang_index, 3575, TransformTypeLangIndexId, pg_transform, btree(trftype oid_ops, trflang oid_ops)); + +MAKE_SYSCACHE(TRFOID, pg_transform_oid_index, 16); +MAKE_SYSCACHE(TRFTYPELANG, pg_transform_type_lang_index, 16); + +#endif /* PG_TRANSFORM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_transform_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_transform_d.h new file mode 100644 index 0000000..ac4a011 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_transform_d.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * pg_transform_d.h + * Macro definitions for pg_transform + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TRANSFORM_D_H +#define PG_TRANSFORM_D_H + +/* Macros related to the structure of pg_transform */ + +#define TransformRelationId 3576 +#define TransformOidIndexId 3574 +#define TransformTypeLangIndexId 3575 + +#define Anum_pg_transform_oid 1 +#define Anum_pg_transform_trftype 2 +#define Anum_pg_transform_trflang 3 +#define Anum_pg_transform_trffromsql 4 +#define Anum_pg_transform_trftosql 5 + +#define Natts_pg_transform 5 + +/* Definitions copied from pg_transform.h */ + + +/* OID symbols for objects defined in pg_transform.dat */ + + +#endif /* PG_TRANSFORM_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_trigger.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_trigger.h new file mode 100644 index 0000000..24a9152 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_trigger.h @@ -0,0 +1,153 @@ +/*------------------------------------------------------------------------- + * + * pg_trigger.h + * definition of the "trigger" system catalog (pg_trigger) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_trigger.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TRIGGER_H +#define PG_TRIGGER_H + +#include "catalog/genbki.h" +#include "catalog/pg_trigger_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_trigger definition. cpp turns this into + * typedef struct FormData_pg_trigger + * + * Note: when tgconstraint is nonzero, tgconstrrelid, tgconstrindid, + * tgdeferrable, and tginitdeferred are largely redundant with the referenced + * pg_constraint entry. However, it is possible for a non-deferrable trigger + * to be associated with a deferrable constraint. + * ---------------- + */ +CATALOG(pg_trigger,2620,TriggerRelationId) +{ + Oid oid; /* oid */ + Oid tgrelid BKI_LOOKUP(pg_class); /* relation trigger is + * attached to */ + Oid tgparentid BKI_LOOKUP_OPT(pg_trigger); /* OID of parent + * trigger, if any */ + NameData tgname; /* trigger's name */ + Oid tgfoid BKI_LOOKUP(pg_proc); /* OID of function to be called */ + int16 tgtype; /* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT, + * ROW/STATEMENT; see below */ + char tgenabled; /* trigger's firing configuration WRT + * session_replication_role */ + bool tgisinternal; /* trigger is system-generated */ + Oid tgconstrrelid BKI_LOOKUP_OPT(pg_class); /* constraint's FROM + * table, if any */ + Oid tgconstrindid BKI_LOOKUP_OPT(pg_class); /* constraint's + * supporting index, if + * any */ + Oid tgconstraint BKI_LOOKUP_OPT(pg_constraint); /* associated + * pg_constraint entry, + * if any */ + bool tgdeferrable; /* constraint trigger is deferrable */ + bool tginitdeferred; /* constraint trigger is deferred initially */ + int16 tgnargs; /* # of extra arguments in tgargs */ + + /* + * Variable-length fields start here, but we allow direct access to + * tgattr. Note: tgattr and tgargs must not be null. + */ + int2vector tgattr BKI_FORCE_NOT_NULL; /* column numbers, if trigger is + * on columns */ + +#ifdef CATALOG_VARLEN + bytea tgargs BKI_FORCE_NOT_NULL; /* first\000second\000tgnargs\000 */ + pg_node_tree tgqual; /* WHEN expression, or NULL if none */ + NameData tgoldtable; /* old transition table, or NULL if none */ + NameData tgnewtable; /* new transition table, or NULL if none */ +#endif +} FormData_pg_trigger; + +/* ---------------- + * Form_pg_trigger corresponds to a pointer to a tuple with + * the format of pg_trigger relation. + * ---------------- + */ +typedef FormData_pg_trigger *Form_pg_trigger; + +DECLARE_TOAST(pg_trigger, 2336, 2337); + +DECLARE_INDEX(pg_trigger_tgconstraint_index, 2699, TriggerConstraintIndexId, pg_trigger, btree(tgconstraint oid_ops)); +DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index, 2701, TriggerRelidNameIndexId, pg_trigger, btree(tgrelid oid_ops, tgname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_trigger_oid_index, 2702, TriggerOidIndexId, pg_trigger, btree(oid oid_ops)); + +DECLARE_ARRAY_FOREIGN_KEY((tgrelid, tgattr), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* Bits within tgtype */ +#define TRIGGER_TYPE_ROW (1 << 0) +#define TRIGGER_TYPE_BEFORE (1 << 1) +#define TRIGGER_TYPE_INSERT (1 << 2) +#define TRIGGER_TYPE_DELETE (1 << 3) +#define TRIGGER_TYPE_UPDATE (1 << 4) +#define TRIGGER_TYPE_TRUNCATE (1 << 5) +#define TRIGGER_TYPE_INSTEAD (1 << 6) + +#define TRIGGER_TYPE_LEVEL_MASK (TRIGGER_TYPE_ROW) +#define TRIGGER_TYPE_STATEMENT 0 + +/* Note bits within TRIGGER_TYPE_TIMING_MASK aren't adjacent */ +#define TRIGGER_TYPE_TIMING_MASK \ + (TRIGGER_TYPE_BEFORE | TRIGGER_TYPE_INSTEAD) +#define TRIGGER_TYPE_AFTER 0 + +#define TRIGGER_TYPE_EVENT_MASK \ + (TRIGGER_TYPE_INSERT | TRIGGER_TYPE_DELETE | TRIGGER_TYPE_UPDATE | TRIGGER_TYPE_TRUNCATE) + +/* Macros for manipulating tgtype */ +#define TRIGGER_CLEAR_TYPE(type) ((type) = 0) + +#define TRIGGER_SETT_ROW(type) ((type) |= TRIGGER_TYPE_ROW) +#define TRIGGER_SETT_STATEMENT(type) ((type) |= TRIGGER_TYPE_STATEMENT) +#define TRIGGER_SETT_BEFORE(type) ((type) |= TRIGGER_TYPE_BEFORE) +#define TRIGGER_SETT_AFTER(type) ((type) |= TRIGGER_TYPE_AFTER) +#define TRIGGER_SETT_INSTEAD(type) ((type) |= TRIGGER_TYPE_INSTEAD) +#define TRIGGER_SETT_INSERT(type) ((type) |= TRIGGER_TYPE_INSERT) +#define TRIGGER_SETT_DELETE(type) ((type) |= TRIGGER_TYPE_DELETE) +#define TRIGGER_SETT_UPDATE(type) ((type) |= TRIGGER_TYPE_UPDATE) +#define TRIGGER_SETT_TRUNCATE(type) ((type) |= TRIGGER_TYPE_TRUNCATE) + +#define TRIGGER_FOR_ROW(type) ((type) & TRIGGER_TYPE_ROW) +#define TRIGGER_FOR_BEFORE(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_BEFORE) +#define TRIGGER_FOR_AFTER(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_AFTER) +#define TRIGGER_FOR_INSTEAD(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_INSTEAD) +#define TRIGGER_FOR_INSERT(type) ((type) & TRIGGER_TYPE_INSERT) +#define TRIGGER_FOR_DELETE(type) ((type) & TRIGGER_TYPE_DELETE) +#define TRIGGER_FOR_UPDATE(type) ((type) & TRIGGER_TYPE_UPDATE) +#define TRIGGER_FOR_TRUNCATE(type) ((type) & TRIGGER_TYPE_TRUNCATE) + +/* + * Efficient macro for checking if tgtype matches a particular level + * (TRIGGER_TYPE_ROW or TRIGGER_TYPE_STATEMENT), timing (TRIGGER_TYPE_BEFORE, + * TRIGGER_TYPE_AFTER or TRIGGER_TYPE_INSTEAD), and event (TRIGGER_TYPE_INSERT, + * TRIGGER_TYPE_DELETE, TRIGGER_TYPE_UPDATE, or TRIGGER_TYPE_TRUNCATE). Note + * that a tgtype can match more than one event, but only one level or timing. + */ +#define TRIGGER_TYPE_MATCHES(type, level, timing, event) \ + (((type) & (TRIGGER_TYPE_LEVEL_MASK | TRIGGER_TYPE_TIMING_MASK | (event))) == ((level) | (timing) | (event))) + +/* + * Macro to determine whether tgnewtable or tgoldtable has been specified for + * a trigger. + */ +#define TRIGGER_USES_TRANSITION_TABLE(namepointer) \ + ((namepointer) != (char *) NULL) + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_TRIGGER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_trigger_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_trigger_d.h new file mode 100644 index 0000000..3b8829e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_trigger_d.h @@ -0,0 +1,116 @@ +/*------------------------------------------------------------------------- + * + * pg_trigger_d.h + * Macro definitions for pg_trigger + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TRIGGER_D_H +#define PG_TRIGGER_D_H + +/* Macros related to the structure of pg_trigger */ + +#define TriggerRelationId 2620 +#define TriggerConstraintIndexId 2699 +#define TriggerRelidNameIndexId 2701 +#define TriggerOidIndexId 2702 + +#define Anum_pg_trigger_oid 1 +#define Anum_pg_trigger_tgrelid 2 +#define Anum_pg_trigger_tgparentid 3 +#define Anum_pg_trigger_tgname 4 +#define Anum_pg_trigger_tgfoid 5 +#define Anum_pg_trigger_tgtype 6 +#define Anum_pg_trigger_tgenabled 7 +#define Anum_pg_trigger_tgisinternal 8 +#define Anum_pg_trigger_tgconstrrelid 9 +#define Anum_pg_trigger_tgconstrindid 10 +#define Anum_pg_trigger_tgconstraint 11 +#define Anum_pg_trigger_tgdeferrable 12 +#define Anum_pg_trigger_tginitdeferred 13 +#define Anum_pg_trigger_tgnargs 14 +#define Anum_pg_trigger_tgattr 15 +#define Anum_pg_trigger_tgargs 16 +#define Anum_pg_trigger_tgqual 17 +#define Anum_pg_trigger_tgoldtable 18 +#define Anum_pg_trigger_tgnewtable 19 + +#define Natts_pg_trigger 19 + +/* Definitions copied from pg_trigger.h */ + + +/* Bits within tgtype */ +#define TRIGGER_TYPE_ROW (1 << 0) +#define TRIGGER_TYPE_BEFORE (1 << 1) +#define TRIGGER_TYPE_INSERT (1 << 2) +#define TRIGGER_TYPE_DELETE (1 << 3) +#define TRIGGER_TYPE_UPDATE (1 << 4) +#define TRIGGER_TYPE_TRUNCATE (1 << 5) +#define TRIGGER_TYPE_INSTEAD (1 << 6) + +#define TRIGGER_TYPE_LEVEL_MASK (TRIGGER_TYPE_ROW) +#define TRIGGER_TYPE_STATEMENT 0 + +/* Note bits within TRIGGER_TYPE_TIMING_MASK aren't adjacent */ +#define TRIGGER_TYPE_TIMING_MASK \ + (TRIGGER_TYPE_BEFORE | TRIGGER_TYPE_INSTEAD) +#define TRIGGER_TYPE_AFTER 0 + +#define TRIGGER_TYPE_EVENT_MASK \ + (TRIGGER_TYPE_INSERT | TRIGGER_TYPE_DELETE | TRIGGER_TYPE_UPDATE | TRIGGER_TYPE_TRUNCATE) + +/* Macros for manipulating tgtype */ +#define TRIGGER_CLEAR_TYPE(type) ((type) = 0) + +#define TRIGGER_SETT_ROW(type) ((type) |= TRIGGER_TYPE_ROW) +#define TRIGGER_SETT_STATEMENT(type) ((type) |= TRIGGER_TYPE_STATEMENT) +#define TRIGGER_SETT_BEFORE(type) ((type) |= TRIGGER_TYPE_BEFORE) +#define TRIGGER_SETT_AFTER(type) ((type) |= TRIGGER_TYPE_AFTER) +#define TRIGGER_SETT_INSTEAD(type) ((type) |= TRIGGER_TYPE_INSTEAD) +#define TRIGGER_SETT_INSERT(type) ((type) |= TRIGGER_TYPE_INSERT) +#define TRIGGER_SETT_DELETE(type) ((type) |= TRIGGER_TYPE_DELETE) +#define TRIGGER_SETT_UPDATE(type) ((type) |= TRIGGER_TYPE_UPDATE) +#define TRIGGER_SETT_TRUNCATE(type) ((type) |= TRIGGER_TYPE_TRUNCATE) + +#define TRIGGER_FOR_ROW(type) ((type) & TRIGGER_TYPE_ROW) +#define TRIGGER_FOR_BEFORE(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_BEFORE) +#define TRIGGER_FOR_AFTER(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_AFTER) +#define TRIGGER_FOR_INSTEAD(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_INSTEAD) +#define TRIGGER_FOR_INSERT(type) ((type) & TRIGGER_TYPE_INSERT) +#define TRIGGER_FOR_DELETE(type) ((type) & TRIGGER_TYPE_DELETE) +#define TRIGGER_FOR_UPDATE(type) ((type) & TRIGGER_TYPE_UPDATE) +#define TRIGGER_FOR_TRUNCATE(type) ((type) & TRIGGER_TYPE_TRUNCATE) + +/* + * Efficient macro for checking if tgtype matches a particular level + * (TRIGGER_TYPE_ROW or TRIGGER_TYPE_STATEMENT), timing (TRIGGER_TYPE_BEFORE, + * TRIGGER_TYPE_AFTER or TRIGGER_TYPE_INSTEAD), and event (TRIGGER_TYPE_INSERT, + * TRIGGER_TYPE_DELETE, TRIGGER_TYPE_UPDATE, or TRIGGER_TYPE_TRUNCATE). Note + * that a tgtype can match more than one event, but only one level or timing. + */ +#define TRIGGER_TYPE_MATCHES(type, level, timing, event) \ + (((type) & (TRIGGER_TYPE_LEVEL_MASK | TRIGGER_TYPE_TIMING_MASK | (event))) == ((level) | (timing) | (event))) + +/* + * Macro to determine whether tgnewtable or tgoldtable has been specified for + * a trigger. + */ +#define TRIGGER_USES_TRANSITION_TABLE(namepointer) \ + ((namepointer) != (char *) NULL) + + +/* OID symbols for objects defined in pg_trigger.dat */ + + +#endif /* PG_TRIGGER_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config.h new file mode 100644 index 0000000..0f5df37 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_config.h + * definition of the "text search configuration" system catalog + * (pg_ts_config) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_config.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_CONFIG_H +#define PG_TS_CONFIG_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_config_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_ts_config definition. cpp turns this into + * typedef struct FormData_pg_ts_config + * ---------------- + */ +CATALOG(pg_ts_config,3602,TSConfigRelationId) +{ + /* oid */ + Oid oid; + + /* name of configuration */ + NameData cfgname; + + /* name space */ + Oid cfgnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* owner */ + Oid cfgowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* OID of parser */ + Oid cfgparser BKI_LOOKUP(pg_ts_parser); +} FormData_pg_ts_config; + +typedef FormData_pg_ts_config *Form_pg_ts_config; + +DECLARE_UNIQUE_INDEX(pg_ts_config_cfgname_index, 3608, TSConfigNameNspIndexId, pg_ts_config, btree(cfgname name_ops, cfgnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_config_oid_index, 3712, TSConfigOidIndexId, pg_ts_config, btree(oid oid_ops)); + +MAKE_SYSCACHE(TSCONFIGNAMENSP, pg_ts_config_cfgname_index, 2); +MAKE_SYSCACHE(TSCONFIGOID, pg_ts_config_oid_index, 2); + +#endif /* PG_TS_CONFIG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config_d.h new file mode 100644 index 0000000..96e440d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config_d.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_config_d.h + * Macro definitions for pg_ts_config + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_CONFIG_D_H +#define PG_TS_CONFIG_D_H + +/* Macros related to the structure of pg_ts_config */ + +#define TSConfigRelationId 3602 +#define TSConfigNameNspIndexId 3608 +#define TSConfigOidIndexId 3712 + +#define Anum_pg_ts_config_oid 1 +#define Anum_pg_ts_config_cfgname 2 +#define Anum_pg_ts_config_cfgnamespace 3 +#define Anum_pg_ts_config_cfgowner 4 +#define Anum_pg_ts_config_cfgparser 5 + +#define Natts_pg_ts_config 5 + +/* Definitions copied from pg_ts_config.h */ + + +/* OID symbols for objects defined in pg_ts_config.dat */ + + +#endif /* PG_TS_CONFIG_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config_map.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config_map.h new file mode 100644 index 0000000..38c3d44 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config_map.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_config_map.h + * definition of the system catalog for text search token mappings + * (pg_ts_config_map) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_config_map.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_CONFIG_MAP_H +#define PG_TS_CONFIG_MAP_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_config_map_d.h" + +/* ---------------- + * pg_ts_config_map definition. cpp turns this into + * typedef struct FormData_pg_ts_config_map + * ---------------- + */ +CATALOG(pg_ts_config_map,3603,TSConfigMapRelationId) +{ + /* OID of configuration owning this entry */ + Oid mapcfg BKI_LOOKUP(pg_ts_config); + + /* token type from parser */ + int32 maptokentype; + + /* order in which to consult dictionaries */ + int32 mapseqno; + + /* dictionary to consult */ + Oid mapdict BKI_LOOKUP(pg_ts_dict); +} FormData_pg_ts_config_map; + +typedef FormData_pg_ts_config_map *Form_pg_ts_config_map; + +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_config_map_index, 3609, TSConfigMapIndexId, pg_ts_config_map, btree(mapcfg oid_ops, maptokentype int4_ops, mapseqno int4_ops)); + +MAKE_SYSCACHE(TSCONFIGMAP, pg_ts_config_map_index, 2); + +#endif /* PG_TS_CONFIG_MAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config_map_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config_map_d.h new file mode 100644 index 0000000..4e86bfb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_config_map_d.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_config_map_d.h + * Macro definitions for pg_ts_config_map + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_CONFIG_MAP_D_H +#define PG_TS_CONFIG_MAP_D_H + +/* Macros related to the structure of pg_ts_config_map */ + +#define TSConfigMapRelationId 3603 +#define TSConfigMapIndexId 3609 + +#define Anum_pg_ts_config_map_mapcfg 1 +#define Anum_pg_ts_config_map_maptokentype 2 +#define Anum_pg_ts_config_map_mapseqno 3 +#define Anum_pg_ts_config_map_mapdict 4 + +#define Natts_pg_ts_config_map 4 + +/* Definitions copied from pg_ts_config_map.h */ + + +/* OID symbols for objects defined in pg_ts_config_map.dat */ + + +#endif /* PG_TS_CONFIG_MAP_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_dict.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_dict.h new file mode 100644 index 0000000..86102c7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_dict.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_dict.h + * definition of the "text search dictionary" system catalog (pg_ts_dict) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_dict.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_DICT_H +#define PG_TS_DICT_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_dict_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_ts_dict definition. cpp turns this into + * typedef struct FormData_pg_ts_dict + * ---------------- + */ +CATALOG(pg_ts_dict,3600,TSDictionaryRelationId) +{ + /* oid */ + Oid oid; + + /* dictionary name */ + NameData dictname; + + /* name space */ + Oid dictnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* owner */ + Oid dictowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* dictionary's template */ + Oid dicttemplate BKI_LOOKUP(pg_ts_template); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* options passed to dict_init() */ + text dictinitoption; +#endif +} FormData_pg_ts_dict; + +typedef FormData_pg_ts_dict *Form_pg_ts_dict; + +DECLARE_TOAST(pg_ts_dict, 4169, 4170); + +DECLARE_UNIQUE_INDEX(pg_ts_dict_dictname_index, 3604, TSDictionaryNameNspIndexId, pg_ts_dict, btree(dictname name_ops, dictnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_dict_oid_index, 3605, TSDictionaryOidIndexId, pg_ts_dict, btree(oid oid_ops)); + +MAKE_SYSCACHE(TSDICTNAMENSP, pg_ts_dict_dictname_index, 2); +MAKE_SYSCACHE(TSDICTOID, pg_ts_dict_oid_index, 2); + +#endif /* PG_TS_DICT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_dict_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_dict_d.h new file mode 100644 index 0000000..469ef93 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_dict_d.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_dict_d.h + * Macro definitions for pg_ts_dict + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_DICT_D_H +#define PG_TS_DICT_D_H + +/* Macros related to the structure of pg_ts_dict */ + +#define TSDictionaryRelationId 3600 +#define TSDictionaryNameNspIndexId 3604 +#define TSDictionaryOidIndexId 3605 + +#define Anum_pg_ts_dict_oid 1 +#define Anum_pg_ts_dict_dictname 2 +#define Anum_pg_ts_dict_dictnamespace 3 +#define Anum_pg_ts_dict_dictowner 4 +#define Anum_pg_ts_dict_dicttemplate 5 +#define Anum_pg_ts_dict_dictinitoption 6 + +#define Natts_pg_ts_dict 6 + +/* Definitions copied from pg_ts_dict.h */ + + +/* OID symbols for objects defined in pg_ts_dict.dat */ + + +#endif /* PG_TS_DICT_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_parser.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_parser.h new file mode 100644 index 0000000..f3a40e5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_parser.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_parser.h + * definition of the "text search parser" system catalog (pg_ts_parser) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_parser.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_PARSER_H +#define PG_TS_PARSER_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_parser_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_ts_parser definition. cpp turns this into + * typedef struct FormData_pg_ts_parser + * ---------------- + */ +CATALOG(pg_ts_parser,3601,TSParserRelationId) +{ + Oid oid; /* oid */ + + /* parser's name */ + NameData prsname; + + /* name space */ + Oid prsnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* init parsing session */ + regproc prsstart BKI_LOOKUP(pg_proc); + + /* return next token */ + regproc prstoken BKI_LOOKUP(pg_proc); + + /* finalize parsing session */ + regproc prsend BKI_LOOKUP(pg_proc); + + /* return data for headline creation */ + regproc prsheadline BKI_LOOKUP_OPT(pg_proc); + + /* return descriptions of lexeme's types */ + regproc prslextype BKI_LOOKUP(pg_proc); +} FormData_pg_ts_parser; + +typedef FormData_pg_ts_parser *Form_pg_ts_parser; + +DECLARE_UNIQUE_INDEX(pg_ts_parser_prsname_index, 3606, TSParserNameNspIndexId, pg_ts_parser, btree(prsname name_ops, prsnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_parser_oid_index, 3607, TSParserOidIndexId, pg_ts_parser, btree(oid oid_ops)); + +MAKE_SYSCACHE(TSPARSERNAMENSP, pg_ts_parser_prsname_index, 2); +MAKE_SYSCACHE(TSPARSEROID, pg_ts_parser_oid_index, 2); + +#endif /* PG_TS_PARSER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_parser_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_parser_d.h new file mode 100644 index 0000000..1b9685b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_parser_d.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_parser_d.h + * Macro definitions for pg_ts_parser + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_PARSER_D_H +#define PG_TS_PARSER_D_H + +/* Macros related to the structure of pg_ts_parser */ + +#define TSParserRelationId 3601 +#define TSParserNameNspIndexId 3606 +#define TSParserOidIndexId 3607 + +#define Anum_pg_ts_parser_oid 1 +#define Anum_pg_ts_parser_prsname 2 +#define Anum_pg_ts_parser_prsnamespace 3 +#define Anum_pg_ts_parser_prsstart 4 +#define Anum_pg_ts_parser_prstoken 5 +#define Anum_pg_ts_parser_prsend 6 +#define Anum_pg_ts_parser_prsheadline 7 +#define Anum_pg_ts_parser_prslextype 8 + +#define Natts_pg_ts_parser 8 + +/* Definitions copied from pg_ts_parser.h */ + + +/* OID symbols for objects defined in pg_ts_parser.dat */ + + +#endif /* PG_TS_PARSER_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_template.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_template.h new file mode 100644 index 0000000..aa06b7a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_template.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_template.h + * definition of the "text search template" system catalog (pg_ts_template) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_template.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_TEMPLATE_H +#define PG_TS_TEMPLATE_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_template_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_ts_template definition. cpp turns this into + * typedef struct FormData_pg_ts_template + * ---------------- + */ +CATALOG(pg_ts_template,3764,TSTemplateRelationId) +{ + Oid oid; /* oid */ + + /* template name */ + NameData tmplname; + + /* name space */ + Oid tmplnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* initialization method of dict (may be 0) */ + regproc tmplinit BKI_LOOKUP_OPT(pg_proc); + + /* base method of dictionary */ + regproc tmpllexize BKI_LOOKUP(pg_proc); +} FormData_pg_ts_template; + +typedef FormData_pg_ts_template *Form_pg_ts_template; + +DECLARE_UNIQUE_INDEX(pg_ts_template_tmplname_index, 3766, TSTemplateNameNspIndexId, pg_ts_template, btree(tmplname name_ops, tmplnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_template_oid_index, 3767, TSTemplateOidIndexId, pg_ts_template, btree(oid oid_ops)); + +MAKE_SYSCACHE(TSTEMPLATENAMENSP, pg_ts_template_tmplname_index, 2); +MAKE_SYSCACHE(TSTEMPLATEOID, pg_ts_template_oid_index, 2); + +#endif /* PG_TS_TEMPLATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_template_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_template_d.h new file mode 100644 index 0000000..a35bcfe --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_ts_template_d.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_template_d.h + * Macro definitions for pg_ts_template + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_TEMPLATE_D_H +#define PG_TS_TEMPLATE_D_H + +/* Macros related to the structure of pg_ts_template */ + +#define TSTemplateRelationId 3764 +#define TSTemplateNameNspIndexId 3766 +#define TSTemplateOidIndexId 3767 + +#define Anum_pg_ts_template_oid 1 +#define Anum_pg_ts_template_tmplname 2 +#define Anum_pg_ts_template_tmplnamespace 3 +#define Anum_pg_ts_template_tmplinit 4 +#define Anum_pg_ts_template_tmpllexize 5 + +#define Natts_pg_ts_template 5 + +/* Definitions copied from pg_ts_template.h */ + + +/* OID symbols for objects defined in pg_ts_template.dat */ + + +#endif /* PG_TS_TEMPLATE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_type.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_type.h new file mode 100644 index 0000000..ff66671 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_type.h @@ -0,0 +1,407 @@ +/*------------------------------------------------------------------------- + * + * pg_type.h + * definition of the "type" system catalog (pg_type) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_type.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TYPE_H +#define PG_TYPE_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_type_d.h" /* IWYU pragma: export */ +#include "nodes/nodes.h" + +/* ---------------- + * pg_type definition. cpp turns this into + * typedef struct FormData_pg_type + * + * Some of the values in a pg_type instance are copied into + * pg_attribute instances. Some parts of Postgres use the pg_type copy, + * while others use the pg_attribute copy, so they must match. + * See struct FormData_pg_attribute for details. + * ---------------- + */ +CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + + /* type name */ + NameData typname; + + /* OID of namespace containing this type */ + Oid typnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* type owner */ + Oid typowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* + * For a fixed-size type, typlen is the number of bytes we use to + * represent a value of this type, e.g. 4 for an int4. But for a + * variable-length type, typlen is negative. We use -1 to indicate a + * "varlena" type (one that has a length word), -2 to indicate a + * null-terminated C string. + */ + int16 typlen BKI_ARRAY_DEFAULT(-1); + + /* + * typbyval determines whether internal Postgres routines pass a value of + * this type by value or by reference. typbyval had better be false if + * the length is not 1, 2, or 4 (or 8 on 8-byte-Datum machines). + * Variable-length types are always passed by reference. Note that + * typbyval can be false even if the length would allow pass-by-value; for + * example, type macaddr8 is pass-by-ref even when Datum is 8 bytes. + */ + bool typbyval BKI_ARRAY_DEFAULT(f); + + /* + * typtype is 'b' for a base type, 'c' for a composite type (e.g., a + * table's rowtype), 'd' for a domain, 'e' for an enum type, 'p' for a + * pseudo-type, or 'r' for a range type. (Use the TYPTYPE macros below.) + * + * If typtype is 'c', typrelid is the OID of the class' entry in pg_class. + */ + char typtype BKI_DEFAULT(b) BKI_ARRAY_DEFAULT(b); + + /* + * typcategory and typispreferred help the parser distinguish preferred + * and non-preferred coercions. The category can be any single ASCII + * character (but not \0). The categories used for built-in types are + * identified by the TYPCATEGORY macros below. + */ + + /* arbitrary type classification */ + char typcategory BKI_ARRAY_DEFAULT(A); + + /* is type "preferred" within its category? */ + bool typispreferred BKI_DEFAULT(f) BKI_ARRAY_DEFAULT(f); + + /* + * If typisdefined is false, the entry is only a placeholder (forward + * reference). We know the type's name and owner, but not yet anything + * else about it. + */ + bool typisdefined BKI_DEFAULT(t); + + /* delimiter for arrays of this type */ + char typdelim BKI_DEFAULT(','); + + /* associated pg_class OID if a composite type, else 0 */ + Oid typrelid BKI_DEFAULT(0) BKI_ARRAY_DEFAULT(0) BKI_LOOKUP_OPT(pg_class); + + /* + * Type-specific subscripting handler. If typsubscript is 0, it means + * that this type doesn't support subscripting. Note that various parts + * of the system deem types to be "true" array types only if their + * typsubscript is array_subscript_handler. + */ + regproc typsubscript BKI_DEFAULT(-) BKI_ARRAY_DEFAULT(array_subscript_handler) BKI_LOOKUP_OPT(pg_proc); + + /* + * If typelem is not 0 then it identifies another row in pg_type, defining + * the type yielded by subscripting. This should be 0 if typsubscript is + * 0. However, it can be 0 when typsubscript isn't 0, if the handler + * doesn't need typelem to determine the subscripting result type. Note + * that a typelem dependency is considered to imply physical containment + * of the element type in this type; so DDL changes on the element type + * might be restricted by the presence of this type. + */ + Oid typelem BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* + * If there is a "true" array type having this type as element type, + * typarray links to it. Zero if no associated "true" array type. + */ + Oid typarray BKI_DEFAULT(0) BKI_ARRAY_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* + * I/O conversion procedures for the datatype. + */ + + /* text format (required) */ + regproc typinput BKI_ARRAY_DEFAULT(array_in) BKI_LOOKUP(pg_proc); + regproc typoutput BKI_ARRAY_DEFAULT(array_out) BKI_LOOKUP(pg_proc); + + /* binary format (optional) */ + regproc typreceive BKI_ARRAY_DEFAULT(array_recv) BKI_LOOKUP_OPT(pg_proc); + regproc typsend BKI_ARRAY_DEFAULT(array_send) BKI_LOOKUP_OPT(pg_proc); + + /* + * I/O functions for optional type modifiers. + */ + regproc typmodin BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + regproc typmodout BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* + * Custom ANALYZE procedure for the datatype (0 selects the default). + */ + regproc typanalyze BKI_DEFAULT(-) BKI_ARRAY_DEFAULT(array_typanalyze) BKI_LOOKUP_OPT(pg_proc); + + /* ---------------- + * typalign is the alignment required when storing a value of this + * type. It applies to storage on disk as well as most + * representations of the value inside Postgres. When multiple values + * are stored consecutively, such as in the representation of a + * complete row on disk, padding is inserted before a datum of this + * type so that it begins on the specified boundary. The alignment + * reference is the beginning of the first datum in the sequence. + * + * 'c' = CHAR alignment, ie no alignment needed. + * 's' = SHORT alignment (2 bytes on most machines). + * 'i' = INT alignment (4 bytes on most machines). + * 'd' = DOUBLE alignment (8 bytes on many machines, but by no means all). + * (Use the TYPALIGN macros below for these.) + * + * See include/access/tupmacs.h for the macros that compute these + * alignment requirements. Note also that we allow the nominal alignment + * to be violated when storing "packed" varlenas; the TOAST mechanism + * takes care of hiding that from most code. + * + * NOTE: for types used in system tables, it is critical that the + * size and alignment defined in pg_type agree with the way that the + * compiler will lay out the field in a struct representing a table row. + * ---------------- + */ + char typalign; + + /* ---------------- + * typstorage tells if the type is prepared for toasting and what + * the default strategy for attributes of this type should be. + * + * 'p' PLAIN type not prepared for toasting + * 'e' EXTERNAL external storage possible, don't try to compress + * 'x' EXTENDED try to compress and store external if required + * 'm' MAIN like 'x' but try to keep in main tuple + * (Use the TYPSTORAGE macros below for these.) + * + * Note that 'm' fields can also be moved out to secondary storage, + * but only as a last resort ('e' and 'x' fields are moved first). + * ---------------- + */ + char typstorage BKI_DEFAULT(p) BKI_ARRAY_DEFAULT(x); + + /* + * This flag represents a "NOT NULL" constraint against this datatype. + * + * If true, the attnotnull column for a corresponding table column using + * this datatype will always enforce the NOT NULL constraint. + * + * Used primarily for domain types. + */ + bool typnotnull BKI_DEFAULT(f); + + /* + * Domains use typbasetype to show the base (or domain) type that the + * domain is based on. Zero if the type is not a domain. + */ + Oid typbasetype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* + * Domains use typtypmod to record the typmod to be applied to their base + * type (-1 if base type does not use a typmod). -1 if this type is not a + * domain. + */ + int32 typtypmod BKI_DEFAULT(-1); + + /* + * typndims is the declared number of dimensions for an array domain type + * (i.e., typbasetype is an array type). Otherwise zero. + */ + int32 typndims BKI_DEFAULT(0); + + /* + * Collation: 0 if type cannot use collations, nonzero (typically + * DEFAULT_COLLATION_OID) for collatable base types, possibly some other + * OID for domains over collatable types + */ + Oid typcollation BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_collation); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + /* + * If typdefaultbin is not NULL, it is the nodeToString representation of + * a default expression for the type. Currently this is only used for + * domains. + */ + pg_node_tree typdefaultbin BKI_DEFAULT(_null_) BKI_ARRAY_DEFAULT(_null_); + + /* + * typdefault is NULL if the type has no associated default value. If + * typdefaultbin is not NULL, typdefault must contain a human-readable + * version of the default expression represented by typdefaultbin. If + * typdefaultbin is NULL and typdefault is not, then typdefault is the + * external representation of the type's default value, which may be fed + * to the type's input converter to produce a constant. + */ + text typdefault BKI_DEFAULT(_null_) BKI_ARRAY_DEFAULT(_null_); + + /* + * Access permissions + */ + aclitem typacl[1] BKI_DEFAULT(_null_); +#endif +} FormData_pg_type; + +/* ---------------- + * Form_pg_type corresponds to a pointer to a row with + * the format of pg_type relation. + * ---------------- + */ +typedef FormData_pg_type *Form_pg_type; + +DECLARE_TOAST(pg_type, 4171, 4172); + +DECLARE_UNIQUE_INDEX_PKEY(pg_type_oid_index, 2703, TypeOidIndexId, pg_type, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_type_typname_nsp_index, 2704, TypeNameNspIndexId, pg_type, btree(typname name_ops, typnamespace oid_ops)); + +MAKE_SYSCACHE(TYPEOID, pg_type_oid_index, 64); +MAKE_SYSCACHE(TYPENAMENSP, pg_type_typname_nsp_index, 64); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * macros for values of poor-mans-enumerated-type columns + */ +#define TYPTYPE_BASE 'b' /* base type (ordinary scalar type) */ +#define TYPTYPE_COMPOSITE 'c' /* composite (e.g., table's rowtype) */ +#define TYPTYPE_DOMAIN 'd' /* domain over another type */ +#define TYPTYPE_ENUM 'e' /* enumerated type */ +#define TYPTYPE_MULTIRANGE 'm' /* multirange type */ +#define TYPTYPE_PSEUDO 'p' /* pseudo-type */ +#define TYPTYPE_RANGE 'r' /* range type */ + +#define TYPCATEGORY_INVALID '\0' /* not an allowed category */ +#define TYPCATEGORY_ARRAY 'A' +#define TYPCATEGORY_BOOLEAN 'B' +#define TYPCATEGORY_COMPOSITE 'C' +#define TYPCATEGORY_DATETIME 'D' +#define TYPCATEGORY_ENUM 'E' +#define TYPCATEGORY_GEOMETRIC 'G' +#define TYPCATEGORY_NETWORK 'I' /* think INET */ +#define TYPCATEGORY_NUMERIC 'N' +#define TYPCATEGORY_PSEUDOTYPE 'P' +#define TYPCATEGORY_RANGE 'R' +#define TYPCATEGORY_STRING 'S' +#define TYPCATEGORY_TIMESPAN 'T' +#define TYPCATEGORY_USER 'U' +#define TYPCATEGORY_BITSTRING 'V' /* er ... "varbit"? */ +#define TYPCATEGORY_UNKNOWN 'X' +#define TYPCATEGORY_INTERNAL 'Z' + +#define TYPALIGN_CHAR 'c' /* char alignment (i.e. unaligned) */ +#define TYPALIGN_SHORT 's' /* short alignment (typically 2 bytes) */ +#define TYPALIGN_INT 'i' /* int alignment (typically 4 bytes) */ +#define TYPALIGN_DOUBLE 'd' /* double alignment (often 8 bytes) */ + +#define TYPSTORAGE_PLAIN 'p' /* type not prepared for toasting */ +#define TYPSTORAGE_EXTERNAL 'e' /* toastable, don't try to compress */ +#define TYPSTORAGE_EXTENDED 'x' /* fully toastable */ +#define TYPSTORAGE_MAIN 'm' /* like 'x' but try to store inline */ + +/* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */ +#define IsPolymorphicType(typid) \ + (IsPolymorphicTypeFamily1(typid) || \ + IsPolymorphicTypeFamily2(typid)) + +/* Code not part of polymorphic type resolution should not use these macros: */ +#define IsPolymorphicTypeFamily1(typid) \ + ((typid) == ANYELEMENTOID || \ + (typid) == ANYARRAYOID || \ + (typid) == ANYNONARRAYOID || \ + (typid) == ANYENUMOID || \ + (typid) == ANYRANGEOID || \ + (typid) == ANYMULTIRANGEOID) + +#define IsPolymorphicTypeFamily2(typid) \ + ((typid) == ANYCOMPATIBLEOID || \ + (typid) == ANYCOMPATIBLEARRAYOID || \ + (typid) == ANYCOMPATIBLENONARRAYOID || \ + (typid) == ANYCOMPATIBLERANGEOID || \ + (typid) == ANYCOMPATIBLEMULTIRANGEOID) + +/* Is this a "true" array type? (Requires fmgroids.h) */ +#define IsTrueArrayType(typeForm) \ + (OidIsValid((typeForm)->typelem) && \ + (typeForm)->typsubscript == F_ARRAY_SUBSCRIPT_HANDLER) + +/* + * Backwards compatibility for ancient random spellings of pg_type OID macros. + * Don't use these names in new code. + */ +#define CASHOID MONEYOID +#define LSNOID PG_LSNOID + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern ObjectAddress TypeShellMake(const char *typeName, + Oid typeNamespace, + Oid ownerId); + +extern ObjectAddress TypeCreate(Oid newTypeOid, + const char *typeName, + Oid typeNamespace, + Oid relationOid, + char relationKind, + Oid ownerId, + int16 internalSize, + char typeType, + char typeCategory, + bool typePreferred, + char typDelim, + Oid inputProcedure, + Oid outputProcedure, + Oid receiveProcedure, + Oid sendProcedure, + Oid typmodinProcedure, + Oid typmodoutProcedure, + Oid analyzeProcedure, + Oid subscriptProcedure, + Oid elementType, + bool isImplicitArray, + Oid arrayType, + Oid baseType, + const char *defaultTypeValue, + char *defaultTypeBin, + bool passedByValue, + char alignment, + char storage, + int32 typeMod, + int32 typNDims, + bool typeNotNull, + Oid typeCollation); + +extern void GenerateTypeDependencies(HeapTuple typeTuple, + Relation typeCatalog, + Node *defaultExpr, + void *typacl, + char relationKind, /* only for relation + * rowtypes */ + bool isImplicitArray, + bool isDependentType, + bool makeExtensionDep, + bool rebuild); + +extern void RenameTypeInternal(Oid typeOid, const char *newTypeName, + Oid typeNamespace); + +extern char *makeArrayTypeName(const char *typeName, Oid typeNamespace); + +extern bool moveArrayTypeName(Oid typeOid, const char *typeName, + Oid typeNamespace); + +extern char *makeMultirangeTypeName(const char *rangeTypeName, + Oid typeNamespace); + +#endif /* PG_TYPE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_type_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_type_d.h new file mode 100644 index 0000000..7248e3c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_type_d.h @@ -0,0 +1,331 @@ +/*------------------------------------------------------------------------- + * + * pg_type_d.h + * Macro definitions for pg_type + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TYPE_D_H +#define PG_TYPE_D_H + +/* Macros related to the structure of pg_type */ + +#define TypeRelationId 1247 +#define TypeRelation_Rowtype_Id 71 +#define TypeOidIndexId 2703 +#define TypeNameNspIndexId 2704 + +#define Anum_pg_type_oid 1 +#define Anum_pg_type_typname 2 +#define Anum_pg_type_typnamespace 3 +#define Anum_pg_type_typowner 4 +#define Anum_pg_type_typlen 5 +#define Anum_pg_type_typbyval 6 +#define Anum_pg_type_typtype 7 +#define Anum_pg_type_typcategory 8 +#define Anum_pg_type_typispreferred 9 +#define Anum_pg_type_typisdefined 10 +#define Anum_pg_type_typdelim 11 +#define Anum_pg_type_typrelid 12 +#define Anum_pg_type_typsubscript 13 +#define Anum_pg_type_typelem 14 +#define Anum_pg_type_typarray 15 +#define Anum_pg_type_typinput 16 +#define Anum_pg_type_typoutput 17 +#define Anum_pg_type_typreceive 18 +#define Anum_pg_type_typsend 19 +#define Anum_pg_type_typmodin 20 +#define Anum_pg_type_typmodout 21 +#define Anum_pg_type_typanalyze 22 +#define Anum_pg_type_typalign 23 +#define Anum_pg_type_typstorage 24 +#define Anum_pg_type_typnotnull 25 +#define Anum_pg_type_typbasetype 26 +#define Anum_pg_type_typtypmod 27 +#define Anum_pg_type_typndims 28 +#define Anum_pg_type_typcollation 29 +#define Anum_pg_type_typdefaultbin 30 +#define Anum_pg_type_typdefault 31 +#define Anum_pg_type_typacl 32 + +#define Natts_pg_type 32 + +/* Definitions copied from pg_type.h */ + + +/* + * macros for values of poor-mans-enumerated-type columns + */ +#define TYPTYPE_BASE 'b' /* base type (ordinary scalar type) */ +#define TYPTYPE_COMPOSITE 'c' /* composite (e.g., table's rowtype) */ +#define TYPTYPE_DOMAIN 'd' /* domain over another type */ +#define TYPTYPE_ENUM 'e' /* enumerated type */ +#define TYPTYPE_MULTIRANGE 'm' /* multirange type */ +#define TYPTYPE_PSEUDO 'p' /* pseudo-type */ +#define TYPTYPE_RANGE 'r' /* range type */ + +#define TYPCATEGORY_INVALID '\0' /* not an allowed category */ +#define TYPCATEGORY_ARRAY 'A' +#define TYPCATEGORY_BOOLEAN 'B' +#define TYPCATEGORY_COMPOSITE 'C' +#define TYPCATEGORY_DATETIME 'D' +#define TYPCATEGORY_ENUM 'E' +#define TYPCATEGORY_GEOMETRIC 'G' +#define TYPCATEGORY_NETWORK 'I' /* think INET */ +#define TYPCATEGORY_NUMERIC 'N' +#define TYPCATEGORY_PSEUDOTYPE 'P' +#define TYPCATEGORY_RANGE 'R' +#define TYPCATEGORY_STRING 'S' +#define TYPCATEGORY_TIMESPAN 'T' +#define TYPCATEGORY_USER 'U' +#define TYPCATEGORY_BITSTRING 'V' /* er ... "varbit"? */ +#define TYPCATEGORY_UNKNOWN 'X' +#define TYPCATEGORY_INTERNAL 'Z' + +#define TYPALIGN_CHAR 'c' /* char alignment (i.e. unaligned) */ +#define TYPALIGN_SHORT 's' /* short alignment (typically 2 bytes) */ +#define TYPALIGN_INT 'i' /* int alignment (typically 4 bytes) */ +#define TYPALIGN_DOUBLE 'd' /* double alignment (often 8 bytes) */ + +#define TYPSTORAGE_PLAIN 'p' /* type not prepared for toasting */ +#define TYPSTORAGE_EXTERNAL 'e' /* toastable, don't try to compress */ +#define TYPSTORAGE_EXTENDED 'x' /* fully toastable */ +#define TYPSTORAGE_MAIN 'm' /* like 'x' but try to store inline */ + +/* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */ +#define IsPolymorphicType(typid) \ + (IsPolymorphicTypeFamily1(typid) || \ + IsPolymorphicTypeFamily2(typid)) + +/* Code not part of polymorphic type resolution should not use these macros: */ +#define IsPolymorphicTypeFamily1(typid) \ + ((typid) == ANYELEMENTOID || \ + (typid) == ANYARRAYOID || \ + (typid) == ANYNONARRAYOID || \ + (typid) == ANYENUMOID || \ + (typid) == ANYRANGEOID || \ + (typid) == ANYMULTIRANGEOID) + +#define IsPolymorphicTypeFamily2(typid) \ + ((typid) == ANYCOMPATIBLEOID || \ + (typid) == ANYCOMPATIBLEARRAYOID || \ + (typid) == ANYCOMPATIBLENONARRAYOID || \ + (typid) == ANYCOMPATIBLERANGEOID || \ + (typid) == ANYCOMPATIBLEMULTIRANGEOID) + +/* Is this a "true" array type? (Requires fmgroids.h) */ +#define IsTrueArrayType(typeForm) \ + (OidIsValid((typeForm)->typelem) && \ + (typeForm)->typsubscript == F_ARRAY_SUBSCRIPT_HANDLER) + +/* + * Backwards compatibility for ancient random spellings of pg_type OID macros. + * Don't use these names in new code. + */ +#define CASHOID MONEYOID +#define LSNOID PG_LSNOID + + +/* OID symbols for objects defined in pg_type.dat */ + +#define BOOLOID 16 +#define BYTEAOID 17 +#define CHAROID 18 +#define NAMEOID 19 +#define INT8OID 20 +#define INT2OID 21 +#define INT2VECTOROID 22 +#define INT4OID 23 +#define REGPROCOID 24 +#define TEXTOID 25 +#define OIDOID 26 +#define TIDOID 27 +#define XIDOID 28 +#define CIDOID 29 +#define OIDVECTOROID 30 +#define JSONOID 114 +#define XMLOID 142 +#define PG_NODE_TREEOID 194 +#define PG_NDISTINCTOID 3361 +#define PG_DEPENDENCIESOID 3402 +#define PG_MCV_LISTOID 5017 +#define PG_DDL_COMMANDOID 32 +#define XID8OID 5069 +#define POINTOID 600 +#define LSEGOID 601 +#define PATHOID 602 +#define BOXOID 603 +#define POLYGONOID 604 +#define LINEOID 628 +#define FLOAT4OID 700 +#define FLOAT8OID 701 +#define UNKNOWNOID 705 +#define CIRCLEOID 718 +#define MONEYOID 790 +#define MACADDROID 829 +#define INETOID 869 +#define CIDROID 650 +#define MACADDR8OID 774 +#define ACLITEMOID 1033 +#define BPCHAROID 1042 +#define VARCHAROID 1043 +#define DATEOID 1082 +#define TIMEOID 1083 +#define TIMESTAMPOID 1114 +#define TIMESTAMPTZOID 1184 +#define INTERVALOID 1186 +#define TIMETZOID 1266 +#define BITOID 1560 +#define VARBITOID 1562 +#define NUMERICOID 1700 +#define REFCURSOROID 1790 +#define REGPROCEDUREOID 2202 +#define REGOPEROID 2203 +#define REGOPERATOROID 2204 +#define REGCLASSOID 2205 +#define REGCOLLATIONOID 4191 +#define REGTYPEOID 2206 +#define REGROLEOID 4096 +#define REGNAMESPACEOID 4089 +#define UUIDOID 2950 +#define PG_LSNOID 3220 +#define TSVECTOROID 3614 +#define GTSVECTOROID 3642 +#define TSQUERYOID 3615 +#define REGCONFIGOID 3734 +#define REGDICTIONARYOID 3769 +#define JSONBOID 3802 +#define JSONPATHOID 4072 +#define TXID_SNAPSHOTOID 2970 +#define PG_SNAPSHOTOID 5038 +#define INT4RANGEOID 3904 +#define NUMRANGEOID 3906 +#define TSRANGEOID 3908 +#define TSTZRANGEOID 3910 +#define DATERANGEOID 3912 +#define INT8RANGEOID 3926 +#define INT4MULTIRANGEOID 4451 +#define NUMMULTIRANGEOID 4532 +#define TSMULTIRANGEOID 4533 +#define TSTZMULTIRANGEOID 4534 +#define DATEMULTIRANGEOID 4535 +#define INT8MULTIRANGEOID 4536 +#define RECORDOID 2249 +#define RECORDARRAYOID 2287 +#define CSTRINGOID 2275 +#define ANYOID 2276 +#define ANYARRAYOID 2277 +#define VOIDOID 2278 +#define TRIGGEROID 2279 +#define EVENT_TRIGGEROID 3838 +#define LANGUAGE_HANDLEROID 2280 +#define INTERNALOID 2281 +#define ANYELEMENTOID 2283 +#define ANYNONARRAYOID 2776 +#define ANYENUMOID 3500 +#define FDW_HANDLEROID 3115 +#define INDEX_AM_HANDLEROID 325 +#define TSM_HANDLEROID 3310 +#define TABLE_AM_HANDLEROID 269 +#define ANYRANGEOID 3831 +#define ANYCOMPATIBLEOID 5077 +#define ANYCOMPATIBLEARRAYOID 5078 +#define ANYCOMPATIBLENONARRAYOID 5079 +#define ANYCOMPATIBLERANGEOID 5080 +#define ANYMULTIRANGEOID 4537 +#define ANYCOMPATIBLEMULTIRANGEOID 4538 +#define PG_BRIN_BLOOM_SUMMARYOID 4600 +#define PG_BRIN_MINMAX_MULTI_SUMMARYOID 4601 +#define BOOLARRAYOID 1000 +#define BYTEAARRAYOID 1001 +#define CHARARRAYOID 1002 +#define NAMEARRAYOID 1003 +#define INT8ARRAYOID 1016 +#define INT2ARRAYOID 1005 +#define INT2VECTORARRAYOID 1006 +#define INT4ARRAYOID 1007 +#define REGPROCARRAYOID 1008 +#define TEXTARRAYOID 1009 +#define OIDARRAYOID 1028 +#define TIDARRAYOID 1010 +#define XIDARRAYOID 1011 +#define CIDARRAYOID 1012 +#define OIDVECTORARRAYOID 1013 +#define PG_TYPEARRAYOID 210 +#define PG_ATTRIBUTEARRAYOID 270 +#define PG_PROCARRAYOID 272 +#define PG_CLASSARRAYOID 273 +#define JSONARRAYOID 199 +#define XMLARRAYOID 143 +#define XID8ARRAYOID 271 +#define POINTARRAYOID 1017 +#define LSEGARRAYOID 1018 +#define PATHARRAYOID 1019 +#define BOXARRAYOID 1020 +#define POLYGONARRAYOID 1027 +#define LINEARRAYOID 629 +#define FLOAT4ARRAYOID 1021 +#define FLOAT8ARRAYOID 1022 +#define CIRCLEARRAYOID 719 +#define MONEYARRAYOID 791 +#define MACADDRARRAYOID 1040 +#define INETARRAYOID 1041 +#define CIDRARRAYOID 651 +#define MACADDR8ARRAYOID 775 +#define ACLITEMARRAYOID 1034 +#define BPCHARARRAYOID 1014 +#define VARCHARARRAYOID 1015 +#define DATEARRAYOID 1182 +#define TIMEARRAYOID 1183 +#define TIMESTAMPARRAYOID 1115 +#define TIMESTAMPTZARRAYOID 1185 +#define INTERVALARRAYOID 1187 +#define TIMETZARRAYOID 1270 +#define BITARRAYOID 1561 +#define VARBITARRAYOID 1563 +#define NUMERICARRAYOID 1231 +#define REFCURSORARRAYOID 2201 +#define REGPROCEDUREARRAYOID 2207 +#define REGOPERARRAYOID 2208 +#define REGOPERATORARRAYOID 2209 +#define REGCLASSARRAYOID 2210 +#define REGCOLLATIONARRAYOID 4192 +#define REGTYPEARRAYOID 2211 +#define REGROLEARRAYOID 4097 +#define REGNAMESPACEARRAYOID 4090 +#define UUIDARRAYOID 2951 +#define PG_LSNARRAYOID 3221 +#define TSVECTORARRAYOID 3643 +#define GTSVECTORARRAYOID 3644 +#define TSQUERYARRAYOID 3645 +#define REGCONFIGARRAYOID 3735 +#define REGDICTIONARYARRAYOID 3770 +#define JSONBARRAYOID 3807 +#define JSONPATHARRAYOID 4073 +#define TXID_SNAPSHOTARRAYOID 2949 +#define PG_SNAPSHOTARRAYOID 5039 +#define INT4RANGEARRAYOID 3905 +#define NUMRANGEARRAYOID 3907 +#define TSRANGEARRAYOID 3909 +#define TSTZRANGEARRAYOID 3911 +#define DATERANGEARRAYOID 3913 +#define INT8RANGEARRAYOID 3927 +#define INT4MULTIRANGEARRAYOID 6150 +#define NUMMULTIRANGEARRAYOID 6151 +#define TSMULTIRANGEARRAYOID 6152 +#define TSTZMULTIRANGEARRAYOID 6153 +#define DATEMULTIRANGEARRAYOID 6155 +#define INT8MULTIRANGEARRAYOID 6157 +#define CSTRINGARRAYOID 1263 + +#endif /* PG_TYPE_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_user_mapping.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_user_mapping.h new file mode 100644 index 0000000..7a0465c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_user_mapping.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_user_mapping.h + * definition of the "user mapping" system catalog (pg_user_mapping) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_user_mapping.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_USER_MAPPING_H +#define PG_USER_MAPPING_H + +#include "catalog/genbki.h" +#include "catalog/pg_user_mapping_d.h" /* IWYU pragma: export */ + +/* ---------------- + * pg_user_mapping definition. cpp turns this into + * typedef struct FormData_pg_user_mapping + * ---------------- + */ +CATALOG(pg_user_mapping,1418,UserMappingRelationId) +{ + Oid oid; /* oid */ + + Oid umuser BKI_LOOKUP_OPT(pg_authid); /* Id of the user, + * InvalidOid if PUBLIC is + * wanted */ + Oid umserver BKI_LOOKUP(pg_foreign_server); /* server of this + * mapping */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text umoptions[1]; /* user mapping options */ +#endif +} FormData_pg_user_mapping; + +/* ---------------- + * Form_pg_user_mapping corresponds to a pointer to a tuple with + * the format of pg_user_mapping relation. + * ---------------- + */ +typedef FormData_pg_user_mapping *Form_pg_user_mapping; + +DECLARE_TOAST(pg_user_mapping, 4173, 4174); + +DECLARE_UNIQUE_INDEX_PKEY(pg_user_mapping_oid_index, 174, UserMappingOidIndexId, pg_user_mapping, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_user_mapping_user_server_index, 175, UserMappingUserServerIndexId, pg_user_mapping, btree(umuser oid_ops, umserver oid_ops)); + +MAKE_SYSCACHE(USERMAPPINGOID, pg_user_mapping_oid_index, 2); +MAKE_SYSCACHE(USERMAPPINGUSERSERVER, pg_user_mapping_user_server_index, 2); + +#endif /* PG_USER_MAPPING_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_user_mapping_d.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_user_mapping_d.h new file mode 100644 index 0000000..08ff009 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/pg_user_mapping_d.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * pg_user_mapping_d.h + * Macro definitions for pg_user_mapping + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_USER_MAPPING_D_H +#define PG_USER_MAPPING_D_H + +/* Macros related to the structure of pg_user_mapping */ + +#define UserMappingRelationId 1418 +#define UserMappingOidIndexId 174 +#define UserMappingUserServerIndexId 175 + +#define Anum_pg_user_mapping_oid 1 +#define Anum_pg_user_mapping_umuser 2 +#define Anum_pg_user_mapping_umserver 3 +#define Anum_pg_user_mapping_umoptions 4 + +#define Natts_pg_user_mapping 4 + +/* Definitions copied from pg_user_mapping.h */ + + +/* OID symbols for objects defined in pg_user_mapping.dat */ + + +#endif /* PG_USER_MAPPING_D_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/schemapg.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/schemapg.h new file mode 100644 index 0000000..f66a294 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/schemapg.h @@ -0,0 +1,242 @@ +/*------------------------------------------------------------------------- + * + * schemapg.h + * Schema_pg_xxx macros for use by relcache.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef SCHEMAPG_H +#define SCHEMAPG_H + +#define Schema_pg_proc \ +{ 1255, {"oid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proname"}, 19, NAMEDATALEN, 2, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"pronamespace"}, 26, 4, 3, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proowner"}, 26, 4, 4, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prolang"}, 26, 4, 5, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"procost"}, 700, 4, 6, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prorows"}, 700, 4, 7, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"provariadic"}, 26, 4, 8, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prosupport"}, 24, 4, 9, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prokind"}, 18, 1, 10, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prosecdef"}, 16, 1, 11, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proleakproof"}, 16, 1, 12, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proisstrict"}, 16, 1, 13, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proretset"}, 16, 1, 14, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"provolatile"}, 18, 1, 15, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proparallel"}, 18, 1, 16, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"pronargs"}, 21, 2, 17, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"pronargdefaults"}, 21, 2, 18, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prorettype"}, 26, 4, 19, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proargtypes"}, 30, -1, 20, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proallargtypes"}, 1028, -1, 21, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proargmodes"}, 1002, -1, 22, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proargnames"}, 1009, -1, 23, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"proargdefaults"}, 194, -1, 24, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"protrftypes"}, 1028, -1, 25, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prosrc"}, 25, -1, 26, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"probin"}, 25, -1, 27, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"prosqlbody"}, 194, -1, 28, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"proconfig"}, 1009, -1, 29, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"proacl"}, 1034, -1, 30, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_type \ +{ 1247, {"oid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typname"}, 19, NAMEDATALEN, 2, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1247, {"typnamespace"}, 26, 4, 3, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typowner"}, 26, 4, 4, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typlen"}, 21, 2, 5, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typbyval"}, 16, 1, 6, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typtype"}, 18, 1, 7, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typcategory"}, 18, 1, 8, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typispreferred"}, 16, 1, 9, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typisdefined"}, 16, 1, 10, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typdelim"}, 18, 1, 11, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typrelid"}, 26, 4, 12, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typsubscript"}, 24, 4, 13, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typelem"}, 26, 4, 14, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typarray"}, 26, 4, 15, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typinput"}, 24, 4, 16, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typoutput"}, 24, 4, 17, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typreceive"}, 24, 4, 18, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typsend"}, 24, 4, 19, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typmodin"}, 24, 4, 20, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typmodout"}, 24, 4, 21, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typanalyze"}, 24, 4, 22, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typalign"}, 18, 1, 23, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typstorage"}, 18, 1, 24, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typnotnull"}, 16, 1, 25, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typbasetype"}, 26, 4, 26, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typtypmod"}, 23, 4, 27, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typndims"}, 23, 4, 28, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typcollation"}, 26, 4, 29, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typdefaultbin"}, 194, -1, 30, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1247, {"typdefault"}, 25, -1, 31, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1247, {"typacl"}, 1034, -1, 32, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_attribute \ +{ 1249, {"attrelid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attname"}, 19, NAMEDATALEN, 2, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1249, {"atttypid"}, 26, 4, 3, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attlen"}, 21, 2, 4, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attnum"}, 21, 2, 5, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"atttypmod"}, 23, 4, 6, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attndims"}, 21, 2, 7, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attbyval"}, 16, 1, 8, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attalign"}, 18, 1, 9, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attstorage"}, 18, 1, 10, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attcompression"}, 18, 1, 11, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attnotnull"}, 16, 1, 12, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"atthasdef"}, 16, 1, 13, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"atthasmissing"}, 16, 1, 14, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attidentity"}, 18, 1, 15, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attgenerated"}, 18, 1, 16, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attisdropped"}, 16, 1, 17, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attislocal"}, 16, 1, 18, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attinhcount"}, 21, 2, 19, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attcollation"}, 26, 4, 20, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attstattarget"}, 21, 2, 21, -1, 0, true, 's', 'p', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attacl"}, 1034, -1, 22, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attoptions"}, 1009, -1, 23, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1249, {"attfdwoptions"}, 1009, -1, 24, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1249, {"attmissingval"}, 2277, -1, 25, -1, 0, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_class \ +{ 1259, {"oid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relname"}, 19, NAMEDATALEN, 2, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1259, {"relnamespace"}, 26, 4, 3, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reltype"}, 26, 4, 4, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reloftype"}, 26, 4, 5, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relowner"}, 26, 4, 6, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relam"}, 26, 4, 7, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relfilenode"}, 26, 4, 8, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reltablespace"}, 26, 4, 9, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relpages"}, 23, 4, 10, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reltuples"}, 700, 4, 11, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relallvisible"}, 23, 4, 12, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relallfrozen"}, 23, 4, 13, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reltoastrelid"}, 26, 4, 14, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relhasindex"}, 16, 1, 15, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relisshared"}, 16, 1, 16, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relpersistence"}, 18, 1, 17, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relkind"}, 18, 1, 18, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relnatts"}, 21, 2, 19, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relchecks"}, 21, 2, 20, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relhasrules"}, 16, 1, 21, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relhastriggers"}, 16, 1, 22, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relhassubclass"}, 16, 1, 23, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relrowsecurity"}, 16, 1, 24, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relforcerowsecurity"}, 16, 1, 25, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relispopulated"}, 16, 1, 26, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relreplident"}, 18, 1, 27, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relispartition"}, 16, 1, 28, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relrewrite"}, 26, 4, 29, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relfrozenxid"}, 28, 4, 30, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relminmxid"}, 28, 4, 31, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relacl"}, 1034, -1, 32, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reloptions"}, 1009, -1, 33, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1259, {"relpartbound"}, 194, -1, 34, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 } + +#define Schema_pg_index \ +{ 2610, {"indexrelid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indrelid"}, 26, 4, 2, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indnatts"}, 21, 2, 3, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indnkeyatts"}, 21, 2, 4, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisunique"}, 16, 1, 5, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indnullsnotdistinct"}, 16, 1, 6, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisprimary"}, 16, 1, 7, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisexclusion"}, 16, 1, 8, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indimmediate"}, 16, 1, 9, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisclustered"}, 16, 1, 10, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisvalid"}, 16, 1, 11, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indcheckxmin"}, 16, 1, 12, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisready"}, 16, 1, 13, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indislive"}, 16, 1, 14, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisreplident"}, 16, 1, 15, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indkey"}, 22, -1, 16, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indcollation"}, 30, -1, 17, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indclass"}, 30, -1, 18, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indoption"}, 22, -1, 19, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indexprs"}, 194, -1, 20, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 2610, {"indpred"}, 194, -1, 21, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 } + +#define Schema_pg_database \ +{ 1262, {"oid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datname"}, 19, NAMEDATALEN, 2, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datdba"}, 26, 4, 3, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"encoding"}, 23, 4, 4, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datlocprovider"}, 18, 1, 5, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datistemplate"}, 16, 1, 6, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datallowconn"}, 16, 1, 7, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"dathasloginevt"}, 16, 1, 8, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datconnlimit"}, 23, 4, 9, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datfrozenxid"}, 28, 4, 10, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datminmxid"}, 28, 4, 11, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"dattablespace"}, 26, 4, 12, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datcollate"}, 25, -1, 13, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datctype"}, 25, -1, 14, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datlocale"}, 25, -1, 15, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"daticurules"}, 25, -1, 16, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datcollversion"}, 25, -1, 17, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datacl"}, 1034, -1, 18, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_authid \ +{ 1260, {"oid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolname"}, 19, NAMEDATALEN, 2, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1260, {"rolsuper"}, 16, 1, 3, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolinherit"}, 16, 1, 4, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolcreaterole"}, 16, 1, 5, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolcreatedb"}, 16, 1, 6, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolcanlogin"}, 16, 1, 7, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolreplication"}, 16, 1, 8, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolbypassrls"}, 16, 1, 9, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolconnlimit"}, 23, 4, 10, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolpassword"}, 25, -1, 11, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1260, {"rolvaliduntil"}, 1184, 8, 12, -1, 0, FLOAT8PASSBYVAL, 'd', 'p', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_auth_members \ +{ 1261, {"oid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"roleid"}, 26, 4, 2, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"member"}, 26, 4, 3, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"grantor"}, 26, 4, 4, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"admin_option"}, 16, 1, 5, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"inherit_option"}, 16, 1, 6, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"set_option"}, 16, 1, 7, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_shseclabel \ +{ 3592, {"objoid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 3592, {"classoid"}, 26, 4, 2, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 3592, {"provider"}, 25, -1, 3, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 3592, {"label"}, 25, -1, 4, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 } + +#define Schema_pg_subscription \ +{ 6100, {"oid"}, 26, 4, 1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subdbid"}, 26, 4, 2, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subskiplsn"}, 3220, 8, 3, -1, 0, FLOAT8PASSBYVAL, 'd', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subname"}, 19, NAMEDATALEN, 4, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"subowner"}, 26, 4, 5, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subenabled"}, 16, 1, 6, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subbinary"}, 16, 1, 7, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"substream"}, 18, 1, 8, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subtwophasestate"}, 18, 1, 9, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subdisableonerr"}, 16, 1, 10, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subpasswordrequired"}, 16, 1, 11, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subrunasowner"}, 16, 1, 12, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subfailover"}, 16, 1, 13, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subconninfo"}, 25, -1, 14, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"subslotname"}, 19, NAMEDATALEN, 15, -1, 0, false, 'c', 'p', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"subsynccommit"}, 25, -1, 16, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"subpublications"}, 1009, -1, 17, -1, 1, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"suborigin"}, 25, -1, 18, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 } + +#endif /* SCHEMAPG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/storage.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/storage.h new file mode 100644 index 0000000..ba99225 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/storage.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * storage.h + * prototypes for functions in backend/catalog/storage.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/storage.h + * + *------------------------------------------------------------------------- + */ +#ifndef STORAGE_H +#define STORAGE_H + +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "storage/smgr.h" +#include "utils/relcache.h" + +/* GUC variables */ +extern PGDLLIMPORT int wal_skip_threshold; + +extern SMgrRelation RelationCreateStorage(RelFileLocator rlocator, + char relpersistence, + bool register_delete); +extern void RelationDropStorage(Relation rel); +extern void RelationPreserveStorage(RelFileLocator rlocator, bool atCommit); +extern void RelationPreTruncate(Relation rel); +extern void RelationTruncate(Relation rel, BlockNumber nblocks); +extern void RelationCopyStorage(SMgrRelation src, SMgrRelation dst, + ForkNumber forkNum, char relpersistence); +extern bool RelFileLocatorSkippingWAL(RelFileLocator rlocator); +extern Size EstimatePendingSyncsSpace(void); +extern void SerializePendingSyncs(Size maxSize, char *startAddress); +extern void RestorePendingSyncs(char *startAddress); + +/* + * These functions used to be in storage/smgr/smgr.c, which explains the + * naming + */ +extern void smgrDoPendingDeletes(bool isCommit); +extern void smgrDoPendingSyncs(bool isCommit, bool isParallelWorker); +extern int smgrGetPendingDeletes(bool forCommit, RelFileLocator **ptr); +extern void AtSubCommit_smgr(void); +extern void AtSubAbort_smgr(void); +extern void PostPrepare_smgr(void); + +#endif /* STORAGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/storage_xlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/storage_xlog.h new file mode 100644 index 0000000..e807c44 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/storage_xlog.h @@ -0,0 +1,59 @@ +/*------------------------------------------------------------------------- + * + * storage_xlog.h + * prototypes for XLog support for backend/catalog/storage.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/storage_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef STORAGE_XLOG_H +#define STORAGE_XLOG_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" + +/* + * Declarations for smgr-related XLOG records + * + * Note: we log file creation and truncation here, but logging of deletion + * actions is handled by xact.c, because it is part of transaction commit. + */ + +/* XLOG gives us high 4 bits */ +#define XLOG_SMGR_CREATE 0x10 +#define XLOG_SMGR_TRUNCATE 0x20 + +typedef struct xl_smgr_create +{ + RelFileLocator rlocator; + ForkNumber forkNum; +} xl_smgr_create; + +/* flags for xl_smgr_truncate */ +#define SMGR_TRUNCATE_HEAP 0x0001 +#define SMGR_TRUNCATE_VM 0x0002 +#define SMGR_TRUNCATE_FSM 0x0004 +#define SMGR_TRUNCATE_ALL \ + (SMGR_TRUNCATE_HEAP|SMGR_TRUNCATE_VM|SMGR_TRUNCATE_FSM) + +typedef struct xl_smgr_truncate +{ + BlockNumber blkno; + RelFileLocator rlocator; + int flags; +} xl_smgr_truncate; + +extern void log_smgrcreate(const RelFileLocator *rlocator, ForkNumber forkNum); + +extern void smgr_redo(XLogReaderState *record); +extern void smgr_desc(StringInfo buf, XLogReaderState *record); +extern const char *smgr_identify(uint8 info); + +#endif /* STORAGE_XLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/syscache_ids.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/syscache_ids.h new file mode 100644 index 0000000..e837e73 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/syscache_ids.h @@ -0,0 +1,106 @@ +/*------------------------------------------------------------------------- + * + * syscache_ids.h + * SysCache identifiers + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +enum SysCacheIdentifier +{ + AGGFNOID, + AMNAME, + AMOID, + AMOPOPID, + AMOPSTRATEGY, + AMPROCNUM, + ATTNAME, + ATTNUM, + AUTHMEMMEMROLE, + AUTHMEMROLEMEM, + AUTHNAME, + AUTHOID, + CASTSOURCETARGET, + CLAAMNAMENSP, + CLAOID, + COLLNAMEENCNSP, + COLLOID, + CONDEFAULT, + CONNAMENSP, + CONSTROID, + CONVOID, + DATABASEOID, + DEFACLROLENSPOBJ, + ENUMOID, + ENUMTYPOIDNAME, + EVENTTRIGGERNAME, + EVENTTRIGGEROID, + EXTENSIONNAME, + EXTENSIONOID, + FOREIGNDATAWRAPPERNAME, + FOREIGNDATAWRAPPEROID, + FOREIGNSERVERNAME, + FOREIGNSERVEROID, + FOREIGNTABLEREL, + INDEXRELID, + LANGNAME, + LANGOID, + NAMESPACENAME, + NAMESPACEOID, + OPERNAMENSP, + OPEROID, + OPFAMILYAMNAMENSP, + OPFAMILYOID, + PARAMETERACLNAME, + PARAMETERACLOID, + PARTRELID, + PROCNAMEARGSNSP, + PROCOID, + PUBLICATIONNAME, + PUBLICATIONNAMESPACE, + PUBLICATIONNAMESPACEMAP, + PUBLICATIONOID, + PUBLICATIONREL, + PUBLICATIONRELMAP, + RANGEMULTIRANGE, + RANGETYPE, + RELNAMENSP, + RELOID, + REPLORIGIDENT, + REPLORIGNAME, + RULERELNAME, + SEQRELID, + STATEXTDATASTXOID, + STATEXTNAMENSP, + STATEXTOID, + STATRELATTINH, + SUBSCRIPTIONNAME, + SUBSCRIPTIONOID, + SUBSCRIPTIONRELMAP, + TABLESPACEOID, + TRFOID, + TRFTYPELANG, + TSCONFIGMAP, + TSCONFIGNAMENSP, + TSCONFIGOID, + TSDICTNAMENSP, + TSDICTOID, + TSPARSERNAMENSP, + TSPARSEROID, + TSTEMPLATENAMENSP, + TSTEMPLATEOID, + TYPENAMENSP, + TYPEOID, + USERMAPPINGOID, + USERMAPPINGUSERSERVER, +}; +#define SysCacheSize (USERMAPPINGUSERSERVER + 1) diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/system_fk_info.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/system_fk_info.h new file mode 100644 index 0000000..c4a71e2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/system_fk_info.h @@ -0,0 +1,253 @@ +/*------------------------------------------------------------------------- + * + * system_fk_info.h + * Data about the foreign-key relationships in the system catalogs + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef SYSTEM_FK_INFO_H +#define SYSTEM_FK_INFO_H + +typedef struct SysFKRelationship +{ + Oid fk_table; /* referencing catalog */ + Oid pk_table; /* referenced catalog */ + const char *fk_columns; /* referencing column name(s) */ + const char *pk_columns; /* referenced column name(s) */ + bool is_array; /* if true, last fk_column is an array */ + bool is_opt; /* if true, fk_column can be zero */ +} SysFKRelationship; + +static const SysFKRelationship sys_fk_relationships[] = { + { /* pg_proc */ 1255, /* pg_namespace */ 2615, "{pronamespace}", "{oid}", false, false}, + { /* pg_proc */ 1255, /* pg_authid */ 1260, "{proowner}", "{oid}", false, false}, + { /* pg_proc */ 1255, /* pg_language */ 2612, "{prolang}", "{oid}", false, false}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{provariadic}", "{oid}", false, true}, + { /* pg_proc */ 1255, /* pg_proc */ 1255, "{prosupport}", "{oid}", false, true}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{prorettype}", "{oid}", false, false}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{proargtypes}", "{oid}", true, false}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{proallargtypes}", "{oid}", true, false}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{protrftypes}", "{oid}", true, false}, + { /* pg_type */ 1247, /* pg_namespace */ 2615, "{typnamespace}", "{oid}", false, false}, + { /* pg_type */ 1247, /* pg_authid */ 1260, "{typowner}", "{oid}", false, false}, + { /* pg_type */ 1247, /* pg_class */ 1259, "{typrelid}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typsubscript}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_type */ 1247, "{typelem}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_type */ 1247, "{typarray}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typinput}", "{oid}", false, false}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typoutput}", "{oid}", false, false}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typreceive}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typsend}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typmodin}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typmodout}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typanalyze}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_type */ 1247, "{typbasetype}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_collation */ 3456, "{typcollation}", "{oid}", false, true}, + { /* pg_attribute */ 1249, /* pg_class */ 1259, "{attrelid}", "{oid}", false, false}, + { /* pg_attribute */ 1249, /* pg_type */ 1247, "{atttypid}", "{oid}", false, true}, + { /* pg_attribute */ 1249, /* pg_collation */ 3456, "{attcollation}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_namespace */ 2615, "{relnamespace}", "{oid}", false, false}, + { /* pg_class */ 1259, /* pg_type */ 1247, "{reltype}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_type */ 1247, "{reloftype}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_authid */ 1260, "{relowner}", "{oid}", false, false}, + { /* pg_class */ 1259, /* pg_am */ 2601, "{relam}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_tablespace */ 1213, "{reltablespace}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_class */ 1259, "{reltoastrelid}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_class */ 1259, "{relrewrite}", "{oid}", false, true}, + { /* pg_attrdef */ 2604, /* pg_class */ 1259, "{adrelid}", "{oid}", false, false}, + { /* pg_attrdef */ 2604, /* pg_attribute */ 1249, "{adrelid, adnum}", "{attrelid, attnum}", false, false}, + { /* pg_constraint */ 2606, /* pg_namespace */ 2615, "{connamespace}", "{oid}", false, false}, + { /* pg_constraint */ 2606, /* pg_class */ 1259, "{conrelid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_type */ 1247, "{contypid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_class */ 1259, "{conindid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_constraint */ 2606, "{conparentid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_class */ 1259, "{confrelid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_operator */ 2617, "{conpfeqop}", "{oid}", true, false}, + { /* pg_constraint */ 2606, /* pg_operator */ 2617, "{conppeqop}", "{oid}", true, false}, + { /* pg_constraint */ 2606, /* pg_operator */ 2617, "{conffeqop}", "{oid}", true, false}, + { /* pg_constraint */ 2606, /* pg_operator */ 2617, "{conexclop}", "{oid}", true, false}, + { /* pg_constraint */ 2606, /* pg_attribute */ 1249, "{conrelid, conkey}", "{attrelid, attnum}", true, true}, + { /* pg_constraint */ 2606, /* pg_attribute */ 1249, "{confrelid, confkey}", "{attrelid, attnum}", true, false}, + { /* pg_inherits */ 2611, /* pg_class */ 1259, "{inhrelid}", "{oid}", false, false}, + { /* pg_inherits */ 2611, /* pg_class */ 1259, "{inhparent}", "{oid}", false, false}, + { /* pg_index */ 2610, /* pg_class */ 1259, "{indexrelid}", "{oid}", false, false}, + { /* pg_index */ 2610, /* pg_class */ 1259, "{indrelid}", "{oid}", false, false}, + { /* pg_index */ 2610, /* pg_collation */ 3456, "{indcollation}", "{oid}", true, true}, + { /* pg_index */ 2610, /* pg_opclass */ 2616, "{indclass}", "{oid}", true, false}, + { /* pg_index */ 2610, /* pg_attribute */ 1249, "{indrelid, indkey}", "{attrelid, attnum}", true, true}, + { /* pg_operator */ 2617, /* pg_namespace */ 2615, "{oprnamespace}", "{oid}", false, false}, + { /* pg_operator */ 2617, /* pg_authid */ 1260, "{oprowner}", "{oid}", false, false}, + { /* pg_operator */ 2617, /* pg_type */ 1247, "{oprleft}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_type */ 1247, "{oprright}", "{oid}", false, false}, + { /* pg_operator */ 2617, /* pg_type */ 1247, "{oprresult}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_operator */ 2617, "{oprcom}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_operator */ 2617, "{oprnegate}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_proc */ 1255, "{oprcode}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_proc */ 1255, "{oprrest}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_proc */ 1255, "{oprjoin}", "{oid}", false, true}, + { /* pg_opfamily */ 2753, /* pg_am */ 2601, "{opfmethod}", "{oid}", false, false}, + { /* pg_opfamily */ 2753, /* pg_namespace */ 2615, "{opfnamespace}", "{oid}", false, false}, + { /* pg_opfamily */ 2753, /* pg_authid */ 1260, "{opfowner}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_am */ 2601, "{opcmethod}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_namespace */ 2615, "{opcnamespace}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_authid */ 1260, "{opcowner}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_opfamily */ 2753, "{opcfamily}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_type */ 1247, "{opcintype}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_type */ 1247, "{opckeytype}", "{oid}", false, true}, + { /* pg_am */ 2601, /* pg_proc */ 1255, "{amhandler}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_opfamily */ 2753, "{amopfamily}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_type */ 1247, "{amoplefttype}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_type */ 1247, "{amoprighttype}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_operator */ 2617, "{amopopr}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_am */ 2601, "{amopmethod}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_opfamily */ 2753, "{amopsortfamily}", "{oid}", false, true}, + { /* pg_amproc */ 2603, /* pg_opfamily */ 2753, "{amprocfamily}", "{oid}", false, false}, + { /* pg_amproc */ 2603, /* pg_type */ 1247, "{amproclefttype}", "{oid}", false, false}, + { /* pg_amproc */ 2603, /* pg_type */ 1247, "{amprocrighttype}", "{oid}", false, false}, + { /* pg_amproc */ 2603, /* pg_proc */ 1255, "{amproc}", "{oid}", false, false}, + { /* pg_language */ 2612, /* pg_authid */ 1260, "{lanowner}", "{oid}", false, false}, + { /* pg_language */ 2612, /* pg_proc */ 1255, "{lanplcallfoid}", "{oid}", false, true}, + { /* pg_language */ 2612, /* pg_proc */ 1255, "{laninline}", "{oid}", false, true}, + { /* pg_language */ 2612, /* pg_proc */ 1255, "{lanvalidator}", "{oid}", false, true}, + { /* pg_largeobject_metadata */ 2995, /* pg_authid */ 1260, "{lomowner}", "{oid}", false, false}, + { /* pg_largeobject */ 2613, /* pg_largeobject_metadata */ 2995, "{loid}", "{oid}", false, false}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggfnoid}", "{oid}", false, false}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggtransfn}", "{oid}", false, false}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggfinalfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggcombinefn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggserialfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggdeserialfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggmtransfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggminvtransfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggmfinalfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_operator */ 2617, "{aggsortop}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_type */ 1247, "{aggtranstype}", "{oid}", false, false}, + { /* pg_aggregate */ 2600, /* pg_type */ 1247, "{aggmtranstype}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_class */ 1259, "{starelid}", "{oid}", false, false}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop1}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop2}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop3}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop4}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop5}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll1}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll2}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll3}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll4}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll5}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_attribute */ 1249, "{starelid, staattnum}", "{attrelid, attnum}", false, false}, + { /* pg_statistic_ext */ 3381, /* pg_class */ 1259, "{stxrelid}", "{oid}", false, false}, + { /* pg_statistic_ext */ 3381, /* pg_namespace */ 2615, "{stxnamespace}", "{oid}", false, false}, + { /* pg_statistic_ext */ 3381, /* pg_authid */ 1260, "{stxowner}", "{oid}", false, false}, + { /* pg_statistic_ext */ 3381, /* pg_attribute */ 1249, "{stxrelid, stxkeys}", "{attrelid, attnum}", true, false}, + { /* pg_statistic_ext_data */ 3429, /* pg_statistic_ext */ 3381, "{stxoid}", "{oid}", false, false}, + { /* pg_rewrite */ 2618, /* pg_class */ 1259, "{ev_class}", "{oid}", false, false}, + { /* pg_trigger */ 2620, /* pg_class */ 1259, "{tgrelid}", "{oid}", false, false}, + { /* pg_trigger */ 2620, /* pg_trigger */ 2620, "{tgparentid}", "{oid}", false, true}, + { /* pg_trigger */ 2620, /* pg_proc */ 1255, "{tgfoid}", "{oid}", false, false}, + { /* pg_trigger */ 2620, /* pg_class */ 1259, "{tgconstrrelid}", "{oid}", false, true}, + { /* pg_trigger */ 2620, /* pg_class */ 1259, "{tgconstrindid}", "{oid}", false, true}, + { /* pg_trigger */ 2620, /* pg_constraint */ 2606, "{tgconstraint}", "{oid}", false, true}, + { /* pg_trigger */ 2620, /* pg_attribute */ 1249, "{tgrelid, tgattr}", "{attrelid, attnum}", true, false}, + { /* pg_event_trigger */ 3466, /* pg_authid */ 1260, "{evtowner}", "{oid}", false, false}, + { /* pg_event_trigger */ 3466, /* pg_proc */ 1255, "{evtfoid}", "{oid}", false, false}, + { /* pg_description */ 2609, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_cast */ 2605, /* pg_type */ 1247, "{castsource}", "{oid}", false, false}, + { /* pg_cast */ 2605, /* pg_type */ 1247, "{casttarget}", "{oid}", false, false}, + { /* pg_cast */ 2605, /* pg_proc */ 1255, "{castfunc}", "{oid}", false, true}, + { /* pg_enum */ 3501, /* pg_type */ 1247, "{enumtypid}", "{oid}", false, false}, + { /* pg_namespace */ 2615, /* pg_authid */ 1260, "{nspowner}", "{oid}", false, false}, + { /* pg_conversion */ 2607, /* pg_namespace */ 2615, "{connamespace}", "{oid}", false, false}, + { /* pg_conversion */ 2607, /* pg_authid */ 1260, "{conowner}", "{oid}", false, false}, + { /* pg_conversion */ 2607, /* pg_proc */ 1255, "{conproc}", "{oid}", false, false}, + { /* pg_depend */ 2608, /* pg_class */ 1259, "{classid}", "{oid}", false, false}, + { /* pg_depend */ 2608, /* pg_class */ 1259, "{refclassid}", "{oid}", false, false}, + { /* pg_database */ 1262, /* pg_authid */ 1260, "{datdba}", "{oid}", false, false}, + { /* pg_database */ 1262, /* pg_tablespace */ 1213, "{dattablespace}", "{oid}", false, false}, + { /* pg_db_role_setting */ 2964, /* pg_database */ 1262, "{setdatabase}", "{oid}", false, true}, + { /* pg_db_role_setting */ 2964, /* pg_authid */ 1260, "{setrole}", "{oid}", false, true}, + { /* pg_tablespace */ 1213, /* pg_authid */ 1260, "{spcowner}", "{oid}", false, false}, + { /* pg_auth_members */ 1261, /* pg_authid */ 1260, "{roleid}", "{oid}", false, false}, + { /* pg_auth_members */ 1261, /* pg_authid */ 1260, "{member}", "{oid}", false, false}, + { /* pg_auth_members */ 1261, /* pg_authid */ 1260, "{grantor}", "{oid}", false, false}, + { /* pg_shdepend */ 1214, /* pg_database */ 1262, "{dbid}", "{oid}", false, true}, + { /* pg_shdepend */ 1214, /* pg_class */ 1259, "{classid}", "{oid}", false, false}, + { /* pg_shdepend */ 1214, /* pg_class */ 1259, "{refclassid}", "{oid}", false, false}, + { /* pg_shdescription */ 2396, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_ts_config */ 3602, /* pg_namespace */ 2615, "{cfgnamespace}", "{oid}", false, false}, + { /* pg_ts_config */ 3602, /* pg_authid */ 1260, "{cfgowner}", "{oid}", false, false}, + { /* pg_ts_config */ 3602, /* pg_ts_parser */ 3601, "{cfgparser}", "{oid}", false, false}, + { /* pg_ts_config_map */ 3603, /* pg_ts_config */ 3602, "{mapcfg}", "{oid}", false, false}, + { /* pg_ts_config_map */ 3603, /* pg_ts_dict */ 3600, "{mapdict}", "{oid}", false, false}, + { /* pg_ts_dict */ 3600, /* pg_namespace */ 2615, "{dictnamespace}", "{oid}", false, false}, + { /* pg_ts_dict */ 3600, /* pg_authid */ 1260, "{dictowner}", "{oid}", false, false}, + { /* pg_ts_dict */ 3600, /* pg_ts_template */ 3764, "{dicttemplate}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_namespace */ 2615, "{prsnamespace}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prsstart}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prstoken}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prsend}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prsheadline}", "{oid}", false, true}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prslextype}", "{oid}", false, false}, + { /* pg_ts_template */ 3764, /* pg_namespace */ 2615, "{tmplnamespace}", "{oid}", false, false}, + { /* pg_ts_template */ 3764, /* pg_proc */ 1255, "{tmplinit}", "{oid}", false, true}, + { /* pg_ts_template */ 3764, /* pg_proc */ 1255, "{tmpllexize}", "{oid}", false, false}, + { /* pg_extension */ 3079, /* pg_authid */ 1260, "{extowner}", "{oid}", false, false}, + { /* pg_extension */ 3079, /* pg_namespace */ 2615, "{extnamespace}", "{oid}", false, false}, + { /* pg_extension */ 3079, /* pg_class */ 1259, "{extconfig}", "{oid}", true, false}, + { /* pg_foreign_data_wrapper */ 2328, /* pg_authid */ 1260, "{fdwowner}", "{oid}", false, false}, + { /* pg_foreign_data_wrapper */ 2328, /* pg_proc */ 1255, "{fdwhandler}", "{oid}", false, true}, + { /* pg_foreign_data_wrapper */ 2328, /* pg_proc */ 1255, "{fdwvalidator}", "{oid}", false, true}, + { /* pg_foreign_server */ 1417, /* pg_authid */ 1260, "{srvowner}", "{oid}", false, false}, + { /* pg_foreign_server */ 1417, /* pg_foreign_data_wrapper */ 2328, "{srvfdw}", "{oid}", false, false}, + { /* pg_user_mapping */ 1418, /* pg_authid */ 1260, "{umuser}", "{oid}", false, true}, + { /* pg_user_mapping */ 1418, /* pg_foreign_server */ 1417, "{umserver}", "{oid}", false, false}, + { /* pg_foreign_table */ 3118, /* pg_class */ 1259, "{ftrelid}", "{oid}", false, false}, + { /* pg_foreign_table */ 3118, /* pg_foreign_server */ 1417, "{ftserver}", "{oid}", false, false}, + { /* pg_policy */ 3256, /* pg_class */ 1259, "{polrelid}", "{oid}", false, false}, + { /* pg_policy */ 3256, /* pg_authid */ 1260, "{polroles}", "{oid}", true, true}, + { /* pg_default_acl */ 826, /* pg_authid */ 1260, "{defaclrole}", "{oid}", false, false}, + { /* pg_default_acl */ 826, /* pg_namespace */ 2615, "{defaclnamespace}", "{oid}", false, true}, + { /* pg_init_privs */ 3394, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_seclabel */ 3596, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_shseclabel */ 3592, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_collation */ 3456, /* pg_namespace */ 2615, "{collnamespace}", "{oid}", false, false}, + { /* pg_collation */ 3456, /* pg_authid */ 1260, "{collowner}", "{oid}", false, false}, + { /* pg_partitioned_table */ 3350, /* pg_class */ 1259, "{partrelid}", "{oid}", false, false}, + { /* pg_partitioned_table */ 3350, /* pg_class */ 1259, "{partdefid}", "{oid}", false, true}, + { /* pg_partitioned_table */ 3350, /* pg_opclass */ 2616, "{partclass}", "{oid}", true, false}, + { /* pg_partitioned_table */ 3350, /* pg_collation */ 3456, "{partcollation}", "{oid}", true, true}, + { /* pg_partitioned_table */ 3350, /* pg_attribute */ 1249, "{partrelid, partattrs}", "{attrelid, attnum}", true, true}, + { /* pg_range */ 3541, /* pg_type */ 1247, "{rngtypid}", "{oid}", false, false}, + { /* pg_range */ 3541, /* pg_type */ 1247, "{rngsubtype}", "{oid}", false, false}, + { /* pg_range */ 3541, /* pg_type */ 1247, "{rngmultitypid}", "{oid}", false, false}, + { /* pg_range */ 3541, /* pg_collation */ 3456, "{rngcollation}", "{oid}", false, true}, + { /* pg_range */ 3541, /* pg_opclass */ 2616, "{rngsubopc}", "{oid}", false, false}, + { /* pg_range */ 3541, /* pg_proc */ 1255, "{rngcanonical}", "{oid}", false, true}, + { /* pg_range */ 3541, /* pg_proc */ 1255, "{rngsubdiff}", "{oid}", false, true}, + { /* pg_transform */ 3576, /* pg_type */ 1247, "{trftype}", "{oid}", false, false}, + { /* pg_transform */ 3576, /* pg_language */ 2612, "{trflang}", "{oid}", false, false}, + { /* pg_transform */ 3576, /* pg_proc */ 1255, "{trffromsql}", "{oid}", false, true}, + { /* pg_transform */ 3576, /* pg_proc */ 1255, "{trftosql}", "{oid}", false, true}, + { /* pg_sequence */ 2224, /* pg_class */ 1259, "{seqrelid}", "{oid}", false, false}, + { /* pg_sequence */ 2224, /* pg_type */ 1247, "{seqtypid}", "{oid}", false, false}, + { /* pg_publication */ 6104, /* pg_authid */ 1260, "{pubowner}", "{oid}", false, false}, + { /* pg_publication_namespace */ 6237, /* pg_publication */ 6104, "{pnpubid}", "{oid}", false, false}, + { /* pg_publication_namespace */ 6237, /* pg_namespace */ 2615, "{pnnspid}", "{oid}", false, false}, + { /* pg_publication_rel */ 6106, /* pg_publication */ 6104, "{prpubid}", "{oid}", false, false}, + { /* pg_publication_rel */ 6106, /* pg_class */ 1259, "{prrelid}", "{oid}", false, false}, + { /* pg_subscription */ 6100, /* pg_database */ 1262, "{subdbid}", "{oid}", false, false}, + { /* pg_subscription */ 6100, /* pg_authid */ 1260, "{subowner}", "{oid}", false, false}, + { /* pg_subscription_rel */ 6102, /* pg_subscription */ 6100, "{srsubid}", "{oid}", false, false}, + { /* pg_subscription_rel */ 6102, /* pg_class */ 1259, "{srrelid}", "{oid}", false, false}, +}; + +#endif /* SYSTEM_FK_INFO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/toasting.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/toasting.h new file mode 100644 index 0000000..0950a07 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/catalog/toasting.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * toasting.h + * This file provides some definitions to support creation of toast tables + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/toasting.h + * + *------------------------------------------------------------------------- + */ +#ifndef TOASTING_H +#define TOASTING_H + +#include "storage/lock.h" + +/* + * toasting.c prototypes + */ +extern void NewRelationCreateToastTable(Oid relOid, Datum reloptions); +extern void NewHeapCreateToastTable(Oid relOid, Datum reloptions, + LOCKMODE lockmode, Oid OIDOldToast); +extern void AlterTableCreateToastTable(Oid relOid, Datum reloptions, + LOCKMODE lockmode); +extern void BootstrapToastTable(char *relName, + Oid toastOid, Oid toastIndexOid); + +#endif /* TOASTING_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/alter.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/alter.h new file mode 100644 index 0000000..b1e4630 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/alter.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * alter.h + * prototypes for commands/alter.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/alter.h + * + *------------------------------------------------------------------------- + */ +#ifndef ALTER_H +#define ALTER_H + +#include "catalog/dependency.h" +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern ObjectAddress ExecRenameStmt(RenameStmt *stmt); + +extern ObjectAddress ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt, + ObjectAddress *refAddress); +extern ObjectAddress ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt, + ObjectAddress *oldSchemaAddr); +extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid, + ObjectAddresses *objsMoved); + +extern ObjectAddress ExecAlterOwnerStmt(AlterOwnerStmt *stmt); +extern void AlterObjectOwner_internal(Oid classId, Oid objectId, + Oid new_ownerId); + +#endif /* ALTER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/async.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/async.h new file mode 100644 index 0000000..aaec731 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/async.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------------------- + * + * async.h + * Asynchronous notification: NOTIFY, LISTEN, UNLISTEN + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/async.h + * + *------------------------------------------------------------------------- + */ +#ifndef ASYNC_H +#define ASYNC_H + +#include + +extern PGDLLIMPORT bool Trace_notify; +extern PGDLLIMPORT int max_notify_queue_pages; +extern PGDLLIMPORT volatile sig_atomic_t notifyInterruptPending; + +extern Size AsyncShmemSize(void); +extern void AsyncShmemInit(void); + +extern void NotifyMyFrontEnd(const char *channel, + const char *payload, + int32 srcPid); + +/* notify-related SQL statements */ +extern void Async_Notify(const char *channel, const char *payload); +extern void Async_Listen(const char *channel); +extern void Async_Unlisten(const char *channel); +extern void Async_UnlistenAll(void); + +/* perform (or cancel) outbound notify processing at transaction commit */ +extern void PreCommit_Notify(void); +extern void AtCommit_Notify(void); +extern void AtAbort_Notify(void); +extern void AtSubCommit_Notify(void); +extern void AtSubAbort_Notify(void); +extern void AtPrepare_Notify(void); + +/* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */ +extern void HandleNotifyInterrupt(void); + +/* process interrupts */ +extern void ProcessNotifyInterrupt(bool flush); + +/* freeze old transaction IDs in notify queue (called by VACUUM) */ +extern void AsyncNotifyFreezeXids(TransactionId newFrozenXid); + +#endif /* ASYNC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/cluster.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/cluster.h new file mode 100644 index 0000000..60088a6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/cluster.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * cluster.h + * header file for postgres cluster command stuff + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/commands/cluster.h + * + *------------------------------------------------------------------------- + */ +#ifndef CLUSTER_H +#define CLUSTER_H + +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "storage/lock.h" +#include "utils/relcache.h" + + +/* flag bits for ClusterParams->options */ +#define CLUOPT_VERBOSE 0x01 /* print progress info */ +#define CLUOPT_RECHECK 0x02 /* recheck relation state */ +#define CLUOPT_RECHECK_ISCLUSTERED 0x04 /* recheck relation state for + * indisclustered */ + +/* options for CLUSTER */ +typedef struct ClusterParams +{ + bits32 options; /* bitmask of CLUOPT_* */ +} ClusterParams; + +extern void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel); +extern void cluster_rel(Relation OldHeap, Oid indexOid, ClusterParams *params); +extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid, + LOCKMODE lockmode); +extern void mark_index_clustered(Relation rel, Oid indexOid, bool is_internal); + +extern Oid make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, Oid NewAccessMethod, + char relpersistence, LOCKMODE lockmode); +extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap, + bool is_system_catalog, + bool swap_toast_by_content, + bool check_constraints, + bool is_internal, + TransactionId frozenXid, + MultiXactId cutoffMulti, + char newrelpersistence); + +#endif /* CLUSTER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/collationcmds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/collationcmds.h new file mode 100644 index 0000000..c228ac7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/collationcmds.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * collationcmds.h + * prototypes for collationcmds.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/collationcmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef COLLATIONCMDS_H +#define COLLATIONCMDS_H + +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" + +extern ObjectAddress DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_exists); +extern void IsThereCollationInNamespace(const char *collname, Oid nspOid); +extern ObjectAddress AlterCollation(AlterCollationStmt *stmt); + +#endif /* COLLATIONCMDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/comment.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/comment.h new file mode 100644 index 0000000..f083ea3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/comment.h @@ -0,0 +1,45 @@ +/* + * src/include/commands/comment.h + * + *------------------------------------------------------------------------- + * + * comment.h + * + * Prototypes for functions in commands/comment.c + * + * Copyright (c) 1999-2025, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ + +#ifndef COMMENT_H +#define COMMENT_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +/*------------------------------------------------------------------ + * Function Prototypes -- + * + * The following prototypes define the public functions of the comment + * related routines. CommentObject() implements the SQL "COMMENT ON" + * command. DeleteComments() deletes all comments for an object. + * CreateComments creates (or deletes, if comment is NULL) a comment + * for a specific key. There are versions of these two methods for + * both normal and shared objects. + *------------------------------------------------------------------ + */ + +extern ObjectAddress CommentObject(CommentStmt *stmt); + +extern void DeleteComments(Oid oid, Oid classoid, int32 subid); + +extern void CreateComments(Oid oid, Oid classoid, int32 subid, const char *comment); + +extern void DeleteSharedComments(Oid oid, Oid classoid); + +extern void CreateSharedComments(Oid oid, Oid classoid, const char *comment); + +extern char *GetComment(Oid oid, Oid classoid, int32 subid); + +#endif /* COMMENT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/conversioncmds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/conversioncmds.h new file mode 100644 index 0000000..95cd84c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/conversioncmds.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * conversioncmds.h + * prototypes for conversioncmds.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/conversioncmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef CONVERSIONCMDS_H +#define CONVERSIONCMDS_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern ObjectAddress CreateConversionCommand(CreateConversionStmt *stmt); + +#endif /* CONVERSIONCMDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/copy.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/copy.h new file mode 100644 index 0000000..06dfdfe --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/copy.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * copy.h + * Definitions for using the POSTGRES copy command. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/copy.h + * + *------------------------------------------------------------------------- + */ +#ifndef COPY_H +#define COPY_H + +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "tcop/dest.h" + +/* + * Represents whether a header line should be present, and whether it must + * match the actual names (which implies "true"). + */ +typedef enum CopyHeaderChoice +{ + COPY_HEADER_FALSE = 0, + COPY_HEADER_TRUE, + COPY_HEADER_MATCH, +} CopyHeaderChoice; + +/* + * Represents where to save input processing errors. More values to be added + * in the future. + */ +typedef enum CopyOnErrorChoice +{ + COPY_ON_ERROR_STOP = 0, /* immediately throw errors, default */ + COPY_ON_ERROR_IGNORE, /* ignore errors */ +} CopyOnErrorChoice; + +/* + * Represents verbosity of logged messages by COPY command. + */ +typedef enum CopyLogVerbosityChoice +{ + COPY_LOG_VERBOSITY_SILENT = -1, /* logs none */ + COPY_LOG_VERBOSITY_DEFAULT = 0, /* logs no additional messages. As this is + * the default, assign 0 */ + COPY_LOG_VERBOSITY_VERBOSE, /* logs additional messages */ +} CopyLogVerbosityChoice; + +/* + * A struct to hold COPY options, in a parsed form. All of these are related + * to formatting, except for 'freeze', which doesn't really belong here, but + * it's expedient to parse it along with all the other options. + */ +typedef struct CopyFormatOptions +{ + /* parameters from the COPY command */ + int file_encoding; /* file or remote side's character encoding, + * -1 if not specified */ + bool binary; /* binary format? */ + bool freeze; /* freeze rows on loading? */ + bool csv_mode; /* Comma Separated Value format? */ + CopyHeaderChoice header_line; /* header line? */ + char *null_print; /* NULL marker string (server encoding!) */ + int null_print_len; /* length of same */ + char *null_print_client; /* same converted to file encoding */ + char *default_print; /* DEFAULT marker string */ + int default_print_len; /* length of same */ + char *delim; /* column delimiter (must be 1 byte) */ + char *quote; /* CSV quote char (must be 1 byte) */ + char *escape; /* CSV escape char (must be 1 byte) */ + List *force_quote; /* list of column names */ + bool force_quote_all; /* FORCE_QUOTE *? */ + bool *force_quote_flags; /* per-column CSV FQ flags */ + List *force_notnull; /* list of column names */ + bool force_notnull_all; /* FORCE_NOT_NULL *? */ + bool *force_notnull_flags; /* per-column CSV FNN flags */ + List *force_null; /* list of column names */ + bool force_null_all; /* FORCE_NULL *? */ + bool *force_null_flags; /* per-column CSV FN flags */ + bool convert_selectively; /* do selective binary conversion? */ + CopyOnErrorChoice on_error; /* what to do when error happened */ + CopyLogVerbosityChoice log_verbosity; /* verbosity of logged messages */ + int64 reject_limit; /* maximum tolerable number of errors */ + List *convert_select; /* list of column names (can be NIL) */ +} CopyFormatOptions; + +/* These are private in commands/copy[from|to].c */ +typedef struct CopyFromStateData *CopyFromState; +typedef struct CopyToStateData *CopyToState; + +typedef int (*copy_data_source_cb) (void *outbuf, int minread, int maxread); +typedef void (*copy_data_dest_cb) (void *data, int len); + +extern void DoCopy(ParseState *pstate, const CopyStmt *stmt, + int stmt_location, int stmt_len, + uint64 *processed); + +extern void ProcessCopyOptions(ParseState *pstate, CopyFormatOptions *opts_out, bool is_from, List *options); +extern CopyFromState BeginCopyFrom(ParseState *pstate, Relation rel, Node *whereClause, + const char *filename, + bool is_program, copy_data_source_cb data_source_cb, List *attnamelist, List *options); +extern void EndCopyFrom(CopyFromState cstate); +extern bool NextCopyFrom(CopyFromState cstate, ExprContext *econtext, + Datum *values, bool *nulls); +extern bool NextCopyFromRawFields(CopyFromState cstate, + char ***fields, int *nfields); +extern void CopyFromErrorCallback(void *arg); +extern char *CopyLimitPrintoutLength(const char *str); + +extern uint64 CopyFrom(CopyFromState cstate); + +extern DestReceiver *CreateCopyDestReceiver(void); + +/* + * internal prototypes + */ +extern CopyToState BeginCopyTo(ParseState *pstate, Relation rel, RawStmt *raw_query, + Oid queryRelId, const char *filename, bool is_program, + copy_data_dest_cb data_dest_cb, List *attnamelist, List *options); +extern void EndCopyTo(CopyToState cstate); +extern uint64 DoCopyTo(CopyToState cstate); +extern List *CopyGetAttnums(TupleDesc tupDesc, Relation rel, + List *attnamelist); + +#endif /* COPY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/copyapi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/copyapi.h new file mode 100644 index 0000000..2a2d2f9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/copyapi.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * copyapi.h + * API for COPY TO/FROM handlers + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/copyapi.h + * + *------------------------------------------------------------------------- + */ +#ifndef COPYAPI_H +#define COPYAPI_H + +#include "commands/copy.h" + +/* + * API structure for a COPY TO format implementation. Note this must be + * allocated in a server-lifetime manner, typically as a static const struct. + */ +typedef struct CopyToRoutine +{ + /* + * Set output function information. This callback is called once at the + * beginning of COPY TO. + * + * 'finfo' can be optionally filled to provide the catalog information of + * the output function. + * + * 'atttypid' is the OID of data type used by the relation's attribute. + */ + void (*CopyToOutFunc) (CopyToState cstate, Oid atttypid, + FmgrInfo *finfo); + + /* + * Start a COPY TO. This callback is called once at the beginning of COPY + * TO. + * + * 'tupDesc' is the tuple descriptor of the relation from where the data + * is read. + */ + void (*CopyToStart) (CopyToState cstate, TupleDesc tupDesc); + + /* + * Write one row stored in 'slot' to the destination. + */ + void (*CopyToOneRow) (CopyToState cstate, TupleTableSlot *slot); + + /* + * End a COPY TO. This callback is called once at the end of COPY TO. + */ + void (*CopyToEnd) (CopyToState cstate); +} CopyToRoutine; + +/* + * API structure for a COPY FROM format implementation. Note this must be + * allocated in a server-lifetime manner, typically as a static const struct. + */ +typedef struct CopyFromRoutine +{ + /* + * Set input function information. This callback is called once at the + * beginning of COPY FROM. + * + * 'finfo' can be optionally filled to provide the catalog information of + * the input function. + * + * 'typioparam' can be optionally filled to define the OID of the type to + * pass to the input function.'atttypid' is the OID of data type used by + * the relation's attribute. + */ + void (*CopyFromInFunc) (CopyFromState cstate, Oid atttypid, + FmgrInfo *finfo, Oid *typioparam); + + /* + * Start a COPY FROM. This callback is called once at the beginning of + * COPY FROM. + * + * 'tupDesc' is the tuple descriptor of the relation where the data needs + * to be copied. This can be used for any initialization steps required by + * a format. + */ + void (*CopyFromStart) (CopyFromState cstate, TupleDesc tupDesc); + + /* + * Read one row from the source and fill *values and *nulls. + * + * 'econtext' is used to evaluate default expression for each column that + * is either not read from the file or is using the DEFAULT option of COPY + * FROM. It is NULL if no default values are used. + * + * Returns false if there are no more tuples to read. + */ + bool (*CopyFromOneRow) (CopyFromState cstate, ExprContext *econtext, + Datum *values, bool *nulls); + + /* + * End a COPY FROM. This callback is called once at the end of COPY FROM. + */ + void (*CopyFromEnd) (CopyFromState cstate); +} CopyFromRoutine; + +#endif /* COPYAPI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/copyfrom_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/copyfrom_internal.h new file mode 100644 index 0000000..c8b22af --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/copyfrom_internal.h @@ -0,0 +1,197 @@ +/*------------------------------------------------------------------------- + * + * copyfrom_internal.h + * Internal definitions for COPY FROM command. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/copyfrom_internal.h + * + *------------------------------------------------------------------------- + */ +#ifndef COPYFROM_INTERNAL_H +#define COPYFROM_INTERNAL_H + +#include "commands/copy.h" +#include "commands/trigger.h" +#include "nodes/miscnodes.h" + +/* + * Represents the different source cases we need to worry about at + * the bottom level + */ +typedef enum CopySource +{ + COPY_FILE, /* from file (or a piped program) */ + COPY_FRONTEND, /* from frontend */ + COPY_CALLBACK, /* from callback function */ +} CopySource; + +/* + * Represents the end-of-line terminator type of the input + */ +typedef enum EolType +{ + EOL_UNKNOWN, + EOL_NL, + EOL_CR, + EOL_CRNL, +} EolType; + +/* + * Represents the insert method to be used during COPY FROM. + */ +typedef enum CopyInsertMethod +{ + CIM_SINGLE, /* use table_tuple_insert or ExecForeignInsert */ + CIM_MULTI, /* always use table_multi_insert or + * ExecForeignBatchInsert */ + CIM_MULTI_CONDITIONAL, /* use table_multi_insert or + * ExecForeignBatchInsert only if valid */ +} CopyInsertMethod; + +/* + * This struct contains all the state variables used throughout a COPY FROM + * operation. + */ +typedef struct CopyFromStateData +{ + /* format routine */ + const struct CopyFromRoutine *routine; + + /* low-level state data */ + CopySource copy_src; /* type of copy source */ + FILE *copy_file; /* used if copy_src == COPY_FILE */ + StringInfo fe_msgbuf; /* used if copy_src == COPY_FRONTEND */ + + EolType eol_type; /* EOL type of input */ + int file_encoding; /* file or remote side's character encoding */ + bool need_transcoding; /* file encoding diff from server? */ + Oid conversion_proc; /* encoding conversion function */ + + /* parameters from the COPY command */ + Relation rel; /* relation to copy from */ + List *attnumlist; /* integer list of attnums to copy */ + char *filename; /* filename, or NULL for STDIN */ + bool is_program; /* is 'filename' a program to popen? */ + copy_data_source_cb data_source_cb; /* function for reading data */ + + CopyFormatOptions opts; + bool *convert_select_flags; /* per-column CSV/TEXT CS flags */ + Node *whereClause; /* WHERE condition (or NULL) */ + + /* these are just for error messages, see CopyFromErrorCallback */ + const char *cur_relname; /* table name for error messages */ + uint64 cur_lineno; /* line number for error messages */ + const char *cur_attname; /* current att for error messages */ + const char *cur_attval; /* current att value for error messages */ + bool relname_only; /* don't output line number, att, etc. */ + + /* + * Working state + */ + MemoryContext copycontext; /* per-copy execution context */ + + AttrNumber num_defaults; /* count of att that are missing and have + * default value */ + FmgrInfo *in_functions; /* array of input functions for each attrs */ + Oid *typioparams; /* array of element types for in_functions */ + ErrorSaveContext *escontext; /* soft error trapped during in_functions + * execution */ + uint64 num_errors; /* total number of rows which contained soft + * errors */ + int *defmap; /* array of default att numbers related to + * missing att */ + ExprState **defexprs; /* array of default att expressions for all + * att */ + bool *defaults; /* if DEFAULT marker was found for + * corresponding att */ + bool volatile_defexprs; /* is any of defexprs volatile? */ + List *range_table; /* single element list of RangeTblEntry */ + List *rteperminfos; /* single element list of RTEPermissionInfo */ + ExprState *qualexpr; + + TransitionCaptureState *transition_capture; + + /* + * These variables are used to reduce overhead in COPY FROM. + * + * attribute_buf holds the separated, de-escaped text for each field of + * the current line. The CopyReadAttributes functions return arrays of + * pointers into this buffer. We avoid palloc/pfree overhead by re-using + * the buffer on each cycle. + * + * In binary COPY FROM, attribute_buf holds the binary data for the + * current field, but the usage is otherwise similar. + */ + StringInfoData attribute_buf; + + /* field raw data pointers found by COPY FROM */ + + int max_fields; + char **raw_fields; + + /* + * Similarly, line_buf holds the whole input line being processed. The + * input cycle is first to read the whole line into line_buf, and then + * extract the individual attribute fields into attribute_buf. line_buf + * is preserved unmodified so that we can display it in error messages if + * appropriate. (In binary mode, line_buf is not used.) + */ + StringInfoData line_buf; + bool line_buf_valid; /* contains the row being processed? */ + + /* + * input_buf holds input data, already converted to database encoding. + * + * In text mode, CopyReadLine parses this data sufficiently to locate line + * boundaries, then transfers the data to line_buf. We guarantee that + * there is a \0 at input_buf[input_buf_len] at all times. (In binary + * mode, input_buf is not used.) + * + * If encoding conversion is not required, input_buf is not a separate + * buffer but points directly to raw_buf. In that case, input_buf_len + * tracks the number of bytes that have been verified as valid in the + * database encoding, and raw_buf_len is the total number of bytes stored + * in the buffer. + */ +#define INPUT_BUF_SIZE 65536 /* we palloc INPUT_BUF_SIZE+1 bytes */ + char *input_buf; + int input_buf_index; /* next byte to process */ + int input_buf_len; /* total # of bytes stored */ + bool input_reached_eof; /* true if we reached EOF */ + bool input_reached_error; /* true if a conversion error happened */ + /* Shorthand for number of unconsumed bytes available in input_buf */ +#define INPUT_BUF_BYTES(cstate) ((cstate)->input_buf_len - (cstate)->input_buf_index) + + /* + * raw_buf holds raw input data read from the data source (file or client + * connection), not yet converted to the database encoding. Like with + * 'input_buf', we guarantee that there is a \0 at raw_buf[raw_buf_len]. + */ +#define RAW_BUF_SIZE 65536 /* we palloc RAW_BUF_SIZE+1 bytes */ + char *raw_buf; + int raw_buf_index; /* next byte to process */ + int raw_buf_len; /* total # of bytes stored */ + bool raw_reached_eof; /* true if we reached EOF */ + + /* Shorthand for number of unconsumed bytes available in raw_buf */ +#define RAW_BUF_BYTES(cstate) ((cstate)->raw_buf_len - (cstate)->raw_buf_index) + + uint64 bytes_processed; /* number of bytes processed so far */ +} CopyFromStateData; + +extern void ReceiveCopyBegin(CopyFromState cstate); +extern void ReceiveCopyBinaryHeader(CopyFromState cstate); + +/* One-row callbacks for built-in formats defined in copyfromparse.c */ +extern bool CopyFromTextOneRow(CopyFromState cstate, ExprContext *econtext, + Datum *values, bool *nulls); +extern bool CopyFromCSVOneRow(CopyFromState cstate, ExprContext *econtext, + Datum *values, bool *nulls); +extern bool CopyFromBinaryOneRow(CopyFromState cstate, ExprContext *econtext, + Datum *values, bool *nulls); + +#endif /* COPYFROM_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/createas.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/createas.h new file mode 100644 index 0000000..90612eb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/createas.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * createas.h + * prototypes for createas.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/createas.h + * + *------------------------------------------------------------------------- + */ +#ifndef CREATEAS_H +#define CREATEAS_H + +#include "catalog/objectaddress.h" +#include "nodes/params.h" +#include "parser/parse_node.h" +#include "tcop/dest.h" +#include "utils/queryenvironment.h" + + +extern ObjectAddress ExecCreateTableAs(ParseState *pstate, CreateTableAsStmt *stmt, + ParamListInfo params, QueryEnvironment *queryEnv, + QueryCompletion *qc); + +extern int GetIntoRelEFlags(IntoClause *intoClause); + +extern DestReceiver *CreateIntoRelDestReceiver(IntoClause *intoClause); + +extern bool CreateTableAsRelExists(CreateTableAsStmt *ctas); + +#endif /* CREATEAS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/dbcommands.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/dbcommands.h new file mode 100644 index 0000000..524ac6d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/dbcommands.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * dbcommands.h + * Database management commands (create/drop database). + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/dbcommands.h + * + *------------------------------------------------------------------------- + */ +#ifndef DBCOMMANDS_H +#define DBCOMMANDS_H + +#include "access/xlogreader.h" +#include "catalog/objectaddress.h" +#include "lib/stringinfo.h" +#include "parser/parse_node.h" + +extern Oid createdb(ParseState *pstate, const CreatedbStmt *stmt); +extern void dropdb(const char *dbname, bool missing_ok, bool force); +extern void DropDatabase(ParseState *pstate, DropdbStmt *stmt); +extern ObjectAddress RenameDatabase(const char *oldname, const char *newname); +extern Oid AlterDatabase(ParseState *pstate, AlterDatabaseStmt *stmt, bool isTopLevel); +extern ObjectAddress AlterDatabaseRefreshColl(AlterDatabaseRefreshCollStmt *stmt); +extern Oid AlterDatabaseSet(AlterDatabaseSetStmt *stmt); +extern ObjectAddress AlterDatabaseOwner(const char *dbname, Oid newOwnerId); + +extern Oid get_database_oid(const char *dbname, bool missing_ok); +extern char *get_database_name(Oid dbid); +extern bool have_createdb_privilege(void); + +extern void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype); + +#endif /* DBCOMMANDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/dbcommands_xlog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/dbcommands_xlog.h new file mode 100644 index 0000000..c4202c3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/dbcommands_xlog.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * dbcommands_xlog.h + * Database resource manager XLOG definitions (create/drop database). + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/dbcommands_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef DBCOMMANDS_XLOG_H +#define DBCOMMANDS_XLOG_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" + +/* record types */ +#define XLOG_DBASE_CREATE_FILE_COPY 0x00 +#define XLOG_DBASE_CREATE_WAL_LOG 0x10 +#define XLOG_DBASE_DROP 0x20 + +/* + * Single WAL record for an entire CREATE DATABASE operation. This is used + * by the FILE_COPY strategy. + */ +typedef struct xl_dbase_create_file_copy_rec +{ + Oid db_id; + Oid tablespace_id; + Oid src_db_id; + Oid src_tablespace_id; +} xl_dbase_create_file_copy_rec; + +/* + * WAL record for the beginning of a CREATE DATABASE operation, when the + * WAL_LOG strategy is used. Each individual block will be logged separately + * afterward. + */ +typedef struct xl_dbase_create_wal_log_rec +{ + Oid db_id; + Oid tablespace_id; +} xl_dbase_create_wal_log_rec; + +typedef struct xl_dbase_drop_rec +{ + Oid db_id; + int ntablespaces; /* number of tablespace IDs */ + Oid tablespace_ids[FLEXIBLE_ARRAY_MEMBER]; +} xl_dbase_drop_rec; +#define MinSizeOfDbaseDropRec offsetof(xl_dbase_drop_rec, tablespace_ids) + +extern void dbase_redo(XLogReaderState *record); +extern void dbase_desc(StringInfo buf, XLogReaderState *record); +extern const char *dbase_identify(uint8 info); + +#endif /* DBCOMMANDS_XLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/defrem.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/defrem.h new file mode 100644 index 0000000..f3432b4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/defrem.h @@ -0,0 +1,165 @@ +/*------------------------------------------------------------------------- + * + * defrem.h + * POSTGRES define and remove utility definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/defrem.h + * + *------------------------------------------------------------------------- + */ +#ifndef DEFREM_H +#define DEFREM_H + +#include "access/stratnum.h" +#include "catalog/objectaddress.h" +#include "nodes/params.h" +#include "parser/parse_node.h" +#include "tcop/dest.h" +#include "utils/array.h" + +/* commands/dropcmds.c */ +extern void RemoveObjects(DropStmt *stmt); + +/* commands/indexcmds.c */ +extern ObjectAddress DefineIndex(Oid tableId, + IndexStmt *stmt, + Oid indexRelationId, + Oid parentIndexId, + Oid parentConstraintId, + int total_parts, + bool is_alter_table, + bool check_rights, + bool check_not_in_use, + bool skip_build, + bool quiet); +extern void ExecReindex(ParseState *pstate, const ReindexStmt *stmt, bool isTopLevel); +extern char *makeObjectName(const char *name1, const char *name2, + const char *label); +extern char *ChooseRelationName(const char *name1, const char *name2, + const char *label, Oid namespaceid, + bool isconstraint); +extern bool CheckIndexCompatible(Oid oldId, + const char *accessMethodName, + const List *attributeList, + const List *exclusionOpNames, + bool isWithoutOverlaps); +extern Oid GetDefaultOpClass(Oid type_id, Oid am_id); +extern Oid ResolveOpClass(const List *opclass, Oid attrType, + const char *accessMethodName, Oid accessMethodId); +extern void GetOperatorFromCompareType(Oid opclass, Oid rhstype, CompareType cmptype, + Oid *opid, StrategyNumber *strat); + +/* commands/functioncmds.c */ +extern ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt); +extern void RemoveFunctionById(Oid funcOid); +extern ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt); +extern ObjectAddress CreateCast(CreateCastStmt *stmt); +extern ObjectAddress CreateTransform(CreateTransformStmt *stmt); +extern void IsThereFunctionInNamespace(const char *proname, int pronargs, + oidvector *proargtypes, Oid nspOid); +extern void ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic); +extern void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest); +extern TupleDesc CallStmtResultDesc(CallStmt *stmt); +extern Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok); +extern void interpret_function_parameter_list(ParseState *pstate, + List *parameters, + Oid languageOid, + ObjectType objtype, + oidvector **parameterTypes, + List **parameterTypes_list, + ArrayType **allParameterTypes, + ArrayType **parameterModes, + ArrayType **parameterNames, + List **inParameterNames_list, + List **parameterDefaults, + Oid *variadicArgType, + Oid *requiredResultType); + +/* commands/operatorcmds.c */ +extern ObjectAddress DefineOperator(List *names, List *parameters); +extern void RemoveOperatorById(Oid operOid); +extern ObjectAddress AlterOperator(AlterOperatorStmt *stmt); + +/* commands/statscmds.c */ +extern ObjectAddress CreateStatistics(CreateStatsStmt *stmt, bool check_rights); +extern ObjectAddress AlterStatistics(AlterStatsStmt *stmt); +extern void RemoveStatisticsById(Oid statsOid); +extern void RemoveStatisticsDataById(Oid statsOid, bool inh); +extern Oid StatisticsGetRelation(Oid statId, bool missing_ok); + +/* commands/aggregatecmds.c */ +extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, + List *parameters, bool replace); + +/* commands/opclasscmds.c */ +extern ObjectAddress DefineOpClass(CreateOpClassStmt *stmt); +extern ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt); +extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt); +extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, + Oid opcnamespace); +extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, + Oid opfnamespace); +extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok); +extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok); + +/* commands/tsearchcmds.c */ +extern ObjectAddress DefineTSParser(List *names, List *parameters); + +extern ObjectAddress DefineTSDictionary(List *names, List *parameters); +extern ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt); + +extern ObjectAddress DefineTSTemplate(List *names, List *parameters); + +extern ObjectAddress DefineTSConfiguration(List *names, List *parameters, + ObjectAddress *copied); +extern void RemoveTSConfigurationById(Oid cfgId); +extern ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt); + +extern text *serialize_deflist(List *deflist); +extern List *deserialize_deflist(Datum txt); + +/* commands/foreigncmds.c */ +extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId); +extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId); +extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); +extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId); +extern ObjectAddress CreateForeignDataWrapper(ParseState *pstate, CreateFdwStmt *stmt); +extern ObjectAddress AlterForeignDataWrapper(ParseState *pstate, AlterFdwStmt *stmt); +extern ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt); +extern ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt); +extern ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt); +extern ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt); +extern Oid RemoveUserMapping(DropUserMappingStmt *stmt); +extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid); +extern void ImportForeignSchema(ImportForeignSchemaStmt *stmt); +extern Datum transformGenericOptions(Oid catalogId, + Datum oldOptions, + List *options, + Oid fdwvalidator); + +/* commands/amcmds.c */ +extern ObjectAddress CreateAccessMethod(CreateAmStmt *stmt); +extern Oid get_index_am_oid(const char *amname, bool missing_ok); +extern Oid get_table_am_oid(const char *amname, bool missing_ok); +extern Oid get_am_oid(const char *amname, bool missing_ok); +extern char *get_am_name(Oid amOid); + +/* support routines in commands/define.c */ + +extern char *defGetString(DefElem *def); +extern double defGetNumeric(DefElem *def); +extern bool defGetBoolean(DefElem *def); +extern int32 defGetInt32(DefElem *def); +extern int64 defGetInt64(DefElem *def); +extern Oid defGetObjectId(DefElem *def); +extern List *defGetQualifiedName(DefElem *def); +extern TypeName *defGetTypeName(DefElem *def); +extern int defGetTypeLength(DefElem *def); +extern List *defGetStringList(DefElem *def); +pg_noreturn extern void errorConflictingDefElem(DefElem *defel, ParseState *pstate); + +#endif /* DEFREM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/discard.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/discard.h new file mode 100644 index 0000000..fac63e9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/discard.h @@ -0,0 +1,20 @@ +/*------------------------------------------------------------------------- + * + * discard.h + * prototypes for discard.c. + * + * + * Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/commands/discard.h + * + *------------------------------------------------------------------------- + */ +#ifndef DISCARD_H +#define DISCARD_H + +#include "nodes/parsenodes.h" + +extern void DiscardCommand(DiscardStmt *stmt, bool isTopLevel); + +#endif /* DISCARD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/event_trigger.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/event_trigger.h new file mode 100644 index 0000000..4c67dd8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/event_trigger.h @@ -0,0 +1,97 @@ +/*------------------------------------------------------------------------- + * + * event_trigger.h + * Declarations for command trigger handling. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/event_trigger.h + * + *------------------------------------------------------------------------- + */ +#ifndef EVENT_TRIGGER_H +#define EVENT_TRIGGER_H + +#include "catalog/dependency.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_event_trigger.h" +#include "nodes/parsenodes.h" +#include "tcop/cmdtag.h" +#include "tcop/deparse_utility.h" +#include "utils/aclchk_internal.h" + +typedef struct EventTriggerData +{ + NodeTag type; + const char *event; /* event name */ + Node *parsetree; /* parse tree */ + CommandTag tag; +} EventTriggerData; + +extern PGDLLIMPORT bool event_triggers; + +/* + * Reasons for relation rewrites. + * + * pg_event_trigger_table_rewrite_reason() uses these values, so make sure to + * update the documentation when changing this list. + */ +#define AT_REWRITE_ALTER_PERSISTENCE 0x01 +#define AT_REWRITE_DEFAULT_VAL 0x02 +#define AT_REWRITE_COLUMN_REWRITE 0x04 +#define AT_REWRITE_ACCESS_METHOD 0x08 + +/* + * EventTriggerData is the node type that is passed as fmgr "context" info + * when a function is called by the event trigger manager. + */ +#define CALLED_AS_EVENT_TRIGGER(fcinfo) \ + ((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData)) + +extern Oid CreateEventTrigger(CreateEventTrigStmt *stmt); +extern Oid get_event_trigger_oid(const char *trigname, bool missing_ok); + +extern Oid AlterEventTrigger(AlterEventTrigStmt *stmt); +extern ObjectAddress AlterEventTriggerOwner(const char *name, Oid newOwnerId); +extern void AlterEventTriggerOwner_oid(Oid, Oid newOwnerId); + +extern bool EventTriggerSupportsObjectType(ObjectType obtype); +extern bool EventTriggerSupportsObject(const ObjectAddress *object); +extern void EventTriggerDDLCommandStart(Node *parsetree); +extern void EventTriggerDDLCommandEnd(Node *parsetree); +extern void EventTriggerSQLDrop(Node *parsetree); +extern void EventTriggerTableRewrite(Node *parsetree, Oid tableOid, int reason); +extern void EventTriggerOnLogin(void); + +extern bool EventTriggerBeginCompleteQuery(void); +extern void EventTriggerEndCompleteQuery(void); +extern bool trackDroppedObjectsNeeded(void); +extern void EventTriggerSQLDropAddObject(const ObjectAddress *object, + bool original, bool normal); + +extern void EventTriggerInhibitCommandCollection(void); +extern void EventTriggerUndoInhibitCommandCollection(void); + +extern void EventTriggerCollectSimpleCommand(ObjectAddress address, + ObjectAddress secondaryObject, + Node *parsetree); + +extern void EventTriggerAlterTableStart(Node *parsetree); +extern void EventTriggerAlterTableRelid(Oid objectId); +extern void EventTriggerCollectAlterTableSubcmd(Node *subcmd, + ObjectAddress address); +extern void EventTriggerAlterTableEnd(void); + +extern void EventTriggerCollectGrant(InternalGrant *istmt); +extern void EventTriggerCollectAlterOpFam(AlterOpFamilyStmt *stmt, + Oid opfamoid, List *operators, + List *procedures); +extern void EventTriggerCollectCreateOpClass(CreateOpClassStmt *stmt, + Oid opcoid, List *operators, + List *procedures); +extern void EventTriggerCollectAlterTSConfig(AlterTSConfigurationStmt *stmt, + Oid cfgId, Oid *dictIds, int ndicts); +extern void EventTriggerCollectAlterDefPrivs(AlterDefaultPrivilegesStmt *stmt); + +#endif /* EVENT_TRIGGER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain.h new file mode 100644 index 0000000..3b122f7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------------------------- + * + * explain.h + * prototypes for explain.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/commands/explain.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPLAIN_H +#define EXPLAIN_H + +#include "executor/executor.h" +#include "parser/parse_node.h" + +struct ExplainState; /* defined in explain_state.h */ + +/* Hook for plugins to get control in ExplainOneQuery() */ +typedef void (*ExplainOneQuery_hook_type) (Query *query, + int cursorOptions, + IntoClause *into, + struct ExplainState *es, + const char *queryString, + ParamListInfo params, + QueryEnvironment *queryEnv); +extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook; + +/* Hook for EXPLAIN plugins to print extra information for each plan */ +typedef void (*explain_per_plan_hook_type) (PlannedStmt *plannedstmt, + IntoClause *into, + struct ExplainState *es, + const char *queryString, + ParamListInfo params, + QueryEnvironment *queryEnv); +extern PGDLLIMPORT explain_per_plan_hook_type explain_per_plan_hook; + +/* Hook for EXPLAIN plugins to print extra fields on individual plan nodes */ +typedef void (*explain_per_node_hook_type) (PlanState *planstate, + List *ancestors, + const char *relationship, + const char *plan_name, + struct ExplainState *es); +extern PGDLLIMPORT explain_per_node_hook_type explain_per_node_hook; + +/* Hook for plugins to get control in explain_get_index_name() */ +typedef const char *(*explain_get_index_name_hook_type) (Oid indexId); +extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook; + + +extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt, + ParamListInfo params, DestReceiver *dest); +extern void standard_ExplainOneQuery(Query *query, int cursorOptions, + IntoClause *into, struct ExplainState *es, + const char *queryString, ParamListInfo params, + QueryEnvironment *queryEnv); + +extern TupleDesc ExplainResultDesc(ExplainStmt *stmt); + +extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into, + struct ExplainState *es, ParseState *pstate, + ParamListInfo params); + +extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, + struct ExplainState *es, const char *queryString, + ParamListInfo params, QueryEnvironment *queryEnv, + const instr_time *planduration, + const BufferUsage *bufusage, + const MemoryContextCounters *mem_counters); + +extern void ExplainPrintPlan(struct ExplainState *es, QueryDesc *queryDesc); +extern void ExplainPrintTriggers(struct ExplainState *es, + QueryDesc *queryDesc); + +extern void ExplainPrintJITSummary(struct ExplainState *es, + QueryDesc *queryDesc); + +extern void ExplainQueryText(struct ExplainState *es, QueryDesc *queryDesc); +extern void ExplainQueryParameters(struct ExplainState *es, + ParamListInfo params, int maxlen); + +#endif /* EXPLAIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain_dr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain_dr.h new file mode 100644 index 0000000..55da63d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain_dr.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * explain_dr.h + * prototypes for explain_dr.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/commands/explain_dr.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPLAIN_DR_H +#define EXPLAIN_DR_H + +#include "executor/instrument.h" +#include "tcop/dest.h" + +struct ExplainState; /* avoid including explain.h here */ + +/* Instrumentation data for EXPLAIN's SERIALIZE option */ +typedef struct SerializeMetrics +{ + uint64 bytesSent; /* # of bytes serialized */ + instr_time timeSpent; /* time spent serializing */ + BufferUsage bufferUsage; /* buffers accessed during serialization */ +} SerializeMetrics; + +extern DestReceiver *CreateExplainSerializeDestReceiver(struct ExplainState *es); +extern SerializeMetrics GetSerializationMetrics(DestReceiver *dest); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain_format.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain_format.h new file mode 100644 index 0000000..05045bf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain_format.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * explain_format.h + * prototypes for explain_format.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/commands/explain_format.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPLAIN_FORMAT_H +#define EXPLAIN_FORMAT_H + +#include "nodes/pg_list.h" + +struct ExplainState; /* avoid including explain.h here */ + +extern void ExplainPropertyList(const char *qlabel, List *data, + struct ExplainState *es); +extern void ExplainPropertyListNested(const char *qlabel, List *data, + struct ExplainState *es); +extern void ExplainPropertyText(const char *qlabel, const char *value, + struct ExplainState *es); +extern void ExplainPropertyInteger(const char *qlabel, const char *unit, + int64 value, struct ExplainState *es); +extern void ExplainPropertyUInteger(const char *qlabel, const char *unit, + uint64 value, struct ExplainState *es); +extern void ExplainPropertyFloat(const char *qlabel, const char *unit, + double value, int ndigits, + struct ExplainState *es); +extern void ExplainPropertyBool(const char *qlabel, bool value, + struct ExplainState *es); + +extern void ExplainOpenGroup(const char *objtype, const char *labelname, + bool labeled, struct ExplainState *es); +extern void ExplainCloseGroup(const char *objtype, const char *labelname, + bool labeled, struct ExplainState *es); + +extern void ExplainOpenSetAsideGroup(const char *objtype, const char *labelname, + bool labeled, int depth, + struct ExplainState *es); +extern void ExplainSaveGroup(struct ExplainState *es, int depth, + int *state_save); +extern void ExplainRestoreGroup(struct ExplainState *es, int depth, + int *state_save); + +extern void ExplainDummyGroup(const char *objtype, const char *labelname, + struct ExplainState *es); + +extern void ExplainBeginOutput(struct ExplainState *es); +extern void ExplainEndOutput(struct ExplainState *es); +extern void ExplainSeparatePlans(struct ExplainState *es); + +extern void ExplainIndentText(struct ExplainState *es); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain_state.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain_state.h new file mode 100644 index 0000000..32728f5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/explain_state.h @@ -0,0 +1,100 @@ +/*------------------------------------------------------------------------- + * + * explain_state.h + * prototypes for explain_state.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/commands/explain_state.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPLAIN_STATE_H +#define EXPLAIN_STATE_H + +#include "nodes/parsenodes.h" +#include "nodes/plannodes.h" +#include "parser/parse_node.h" + +typedef enum ExplainSerializeOption +{ + EXPLAIN_SERIALIZE_NONE, + EXPLAIN_SERIALIZE_TEXT, + EXPLAIN_SERIALIZE_BINARY, +} ExplainSerializeOption; + +typedef enum ExplainFormat +{ + EXPLAIN_FORMAT_TEXT, + EXPLAIN_FORMAT_XML, + EXPLAIN_FORMAT_JSON, + EXPLAIN_FORMAT_YAML, +} ExplainFormat; + +typedef struct ExplainWorkersState +{ + int num_workers; /* # of worker processes the plan used */ + bool *worker_inited; /* per-worker state-initialized flags */ + StringInfoData *worker_str; /* per-worker transient output buffers */ + int *worker_state_save; /* per-worker grouping state save areas */ + StringInfo prev_str; /* saved output buffer while redirecting */ +} ExplainWorkersState; + +typedef struct ExplainState +{ + StringInfo str; /* output buffer */ + /* options */ + bool verbose; /* be verbose */ + bool analyze; /* print actual times */ + bool costs; /* print estimated costs */ + bool buffers; /* print buffer usage */ + bool wal; /* print WAL usage */ + bool timing; /* print detailed node timing */ + bool summary; /* print total planning and execution timing */ + bool memory; /* print planner's memory usage information */ + bool settings; /* print modified settings */ + bool generic; /* generate a generic plan */ + ExplainSerializeOption serialize; /* serialize the query's output? */ + ExplainFormat format; /* output format */ + /* state for output formatting --- not reset for each new plan tree */ + int indent; /* current indentation level */ + List *grouping_stack; /* format-specific grouping state */ + /* state related to the current plan tree (filled by ExplainPrintPlan) */ + PlannedStmt *pstmt; /* top of plan */ + List *rtable; /* range table */ + List *rtable_names; /* alias names for RTEs */ + List *deparse_cxt; /* context list for deparsing expressions */ + Bitmapset *printed_subplans; /* ids of SubPlans we've printed */ + bool hide_workers; /* set if we find an invisible Gather */ + int rtable_size; /* length of rtable excluding the RTE_GROUP + * entry */ + /* state related to the current plan node */ + ExplainWorkersState *workers_state; /* needed if parallel plan */ + /* extensions */ + void **extension_state; + int extension_state_allocated; +} ExplainState; + +typedef void (*ExplainOptionHandler) (ExplainState *, DefElem *, ParseState *); + +/* Hook to perform additional EXPLAIN options validation */ +typedef void (*explain_validate_options_hook_type) (struct ExplainState *es, List *options, + ParseState *pstate); +extern PGDLLIMPORT explain_validate_options_hook_type explain_validate_options_hook; + +extern ExplainState *NewExplainState(void); +extern void ParseExplainOptionList(ExplainState *es, List *options, + ParseState *pstate); + +extern int GetExplainExtensionId(const char *extension_name); +extern void *GetExplainExtensionState(ExplainState *es, int extension_id); +extern void SetExplainExtensionState(ExplainState *es, int extension_id, + void *opaque); + +extern void RegisterExtensionExplainOption(const char *option_name, + ExplainOptionHandler handler); +extern bool ApplyExtensionExplainOption(ExplainState *es, DefElem *opt, + ParseState *pstate); + +#endif /* EXPLAIN_STATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/extension.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/extension.h new file mode 100644 index 0000000..6525f44 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/extension.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * extension.h + * Extension management commands (create/drop extension). + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/extension.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXTENSION_H +#define EXTENSION_H + +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" + +/* GUC */ +extern PGDLLIMPORT char *Extension_control_path; + +/* + * creating_extension is only true while running a CREATE EXTENSION or ALTER + * EXTENSION UPDATE command. It instructs recordDependencyOnCurrentExtension() + * to register a dependency on the current pg_extension object for each SQL + * object created by an extension script. It also instructs performDeletion() + * to remove such dependencies without following them, so that extension + * scripts can drop member objects without having to explicitly dissociate + * them from the extension first. + */ +extern PGDLLIMPORT bool creating_extension; +extern PGDLLIMPORT Oid CurrentExtensionObject; + + +extern ObjectAddress CreateExtension(ParseState *pstate, CreateExtensionStmt *stmt); + +extern void RemoveExtensionById(Oid extId); + +extern ObjectAddress InsertExtensionTuple(const char *extName, Oid extOwner, + Oid schemaOid, bool relocatable, const char *extVersion, + Datum extConfig, Datum extCondition, + List *requiredExtensions); + +extern ObjectAddress ExecAlterExtensionStmt(ParseState *pstate, AlterExtensionStmt *stmt); + +extern ObjectAddress ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt, + ObjectAddress *objAddr); + +extern Oid get_extension_oid(const char *extname, bool missing_ok); +extern char *get_extension_name(Oid ext_oid); +extern Oid get_extension_schema(Oid ext_oid); +extern bool extension_file_exists(const char *extensionName); + +extern Oid get_function_sibling_type(Oid funcoid, const char *typname); + +extern ObjectAddress AlterExtensionNamespace(const char *extensionName, const char *newschema, + Oid *oldschema); + +#endif /* EXTENSION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/lockcmds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/lockcmds.h new file mode 100644 index 0000000..8a00251 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/lockcmds.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * lockcmds.h + * prototypes for lockcmds.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/lockcmds.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOCKCMDS_H +#define LOCKCMDS_H + +#include "nodes/parsenodes.h" + +/* + * LOCK + */ +extern void LockTableCommand(LockStmt *lockstmt); + +#endif /* LOCKCMDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/matview.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/matview.h new file mode 100644 index 0000000..750bb10 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/matview.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * matview.h + * prototypes for matview.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/matview.h + * + *------------------------------------------------------------------------- + */ +#ifndef MATVIEW_H +#define MATVIEW_H + +#include "catalog/objectaddress.h" +#include "nodes/params.h" +#include "nodes/parsenodes.h" +#include "tcop/dest.h" +#include "utils/relcache.h" + + +extern void SetMatViewPopulatedState(Relation relation, bool newstate); + +extern ObjectAddress ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, + QueryCompletion *qc); +extern ObjectAddress RefreshMatViewByOid(Oid matviewOid, bool is_create, bool skipData, + bool concurrent, const char *queryString, + QueryCompletion *qc); + +extern DestReceiver *CreateTransientRelDestReceiver(Oid transientoid); + +extern bool MatViewIncrementalMaintenanceIsEnabled(void); + +#endif /* MATVIEW_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/policy.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/policy.h new file mode 100644 index 0000000..f06aa1d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/policy.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * policy.h + * prototypes for policy.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/policy.h + * + *------------------------------------------------------------------------- + */ + +#ifndef POLICY_H +#define POLICY_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" +#include "utils/relcache.h" + +extern void RelationBuildRowSecurity(Relation relation); + +extern void RemovePolicyById(Oid policy_id); + +extern bool RemoveRoleFromObjectPolicy(Oid roleid, Oid classid, Oid policy_id); + +extern ObjectAddress CreatePolicy(CreatePolicyStmt *stmt); +extern ObjectAddress AlterPolicy(AlterPolicyStmt *stmt); + +extern Oid get_relation_policy_oid(Oid relid, const char *policy_name, + bool missing_ok); + +extern ObjectAddress rename_policy(RenameStmt *stmt); + +extern bool relation_has_policies(Relation rel); + +#endif /* POLICY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/portalcmds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/portalcmds.h new file mode 100644 index 0000000..baef23d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/portalcmds.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * portalcmds.h + * prototypes for portalcmds.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/portalcmds.h + * + *------------------------------------------------------------------------- + */ +#ifndef PORTALCMDS_H +#define PORTALCMDS_H + +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "utils/portal.h" + + +extern void PerformCursorOpen(ParseState *pstate, DeclareCursorStmt *cstmt, ParamListInfo params, + bool isTopLevel); + +extern void PerformPortalFetch(FetchStmt *stmt, DestReceiver *dest, + QueryCompletion *qc); + +extern void PerformPortalClose(const char *name); + +extern void PortalCleanup(Portal portal); + +extern void PersistHoldablePortal(Portal portal); + +#endif /* PORTALCMDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/prepare.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/prepare.h new file mode 100644 index 0000000..08daac8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/prepare.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * prepare.h + * PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage + * + * + * Copyright (c) 2002-2025, PostgreSQL Global Development Group + * + * src/include/commands/prepare.h + * + *------------------------------------------------------------------------- + */ +#ifndef PREPARE_H +#define PREPARE_H + +#include "commands/explain_state.h" +#include "datatype/timestamp.h" +#include "tcop/dest.h" +#include "utils/plancache.h" + +/* + * The data structure representing a prepared statement. This is now just + * a thin veneer over a plancache entry --- the main addition is that of + * a name. + * + * Note: all subsidiary storage lives in the referenced plancache entry. + */ +typedef struct +{ + /* dynahash.c requires key to be first field */ + char stmt_name[NAMEDATALEN]; + CachedPlanSource *plansource; /* the actual cached plan */ + bool from_sql; /* prepared via SQL, not FE/BE protocol? */ + TimestampTz prepare_time; /* the time when the stmt was prepared */ +} PreparedStatement; + + +/* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */ +extern void PrepareQuery(ParseState *pstate, PrepareStmt *stmt, + int stmt_location, int stmt_len); +extern void ExecuteQuery(ParseState *pstate, + ExecuteStmt *stmt, IntoClause *intoClause, + ParamListInfo params, + DestReceiver *dest, QueryCompletion *qc); +extern void DeallocateQuery(DeallocateStmt *stmt); +extern void ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into, + ExplainState *es, ParseState *pstate, + ParamListInfo params); + +/* Low-level access to stored prepared statements */ +extern void StorePreparedStatement(const char *stmt_name, + CachedPlanSource *plansource, + bool from_sql); +extern PreparedStatement *FetchPreparedStatement(const char *stmt_name, + bool throwError); +extern void DropPreparedStatement(const char *stmt_name, bool showError); +extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt); +extern List *FetchPreparedStatementTargetList(PreparedStatement *stmt); + +extern void DropAllPreparedStatements(void); + +#endif /* PREPARE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/proclang.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/proclang.h new file mode 100644 index 0000000..fc89282 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/proclang.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * proclang.h + * prototypes for proclang.c. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/proclang.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROCLANG_H +#define PROCLANG_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern ObjectAddress CreateProceduralLanguage(CreatePLangStmt *stmt); + +extern Oid get_language_oid(const char *langname, bool missing_ok); + +#endif /* PROCLANG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/progress.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/progress.h new file mode 100644 index 0000000..7c736e7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/progress.h @@ -0,0 +1,160 @@ +/*------------------------------------------------------------------------- + * + * progress.h + * Constants used with the progress reporting facilities defined in + * backend_status.h. These are possibly interesting to extensions, so we + * expose them via this header file. Note that if you update these + * constants, you probably also need to update the views based on them + * in system_views.sql. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/progress.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROGRESS_H +#define PROGRESS_H + +/* Progress parameters for (lazy) vacuum */ +#define PROGRESS_VACUUM_PHASE 0 +#define PROGRESS_VACUUM_TOTAL_HEAP_BLKS 1 +#define PROGRESS_VACUUM_HEAP_BLKS_SCANNED 2 +#define PROGRESS_VACUUM_HEAP_BLKS_VACUUMED 3 +#define PROGRESS_VACUUM_NUM_INDEX_VACUUMS 4 +#define PROGRESS_VACUUM_MAX_DEAD_TUPLE_BYTES 5 +#define PROGRESS_VACUUM_DEAD_TUPLE_BYTES 6 +#define PROGRESS_VACUUM_NUM_DEAD_ITEM_IDS 7 +#define PROGRESS_VACUUM_INDEXES_TOTAL 8 +#define PROGRESS_VACUUM_INDEXES_PROCESSED 9 +#define PROGRESS_VACUUM_DELAY_TIME 10 + +/* Phases of vacuum (as advertised via PROGRESS_VACUUM_PHASE) */ +#define PROGRESS_VACUUM_PHASE_SCAN_HEAP 1 +#define PROGRESS_VACUUM_PHASE_VACUUM_INDEX 2 +#define PROGRESS_VACUUM_PHASE_VACUUM_HEAP 3 +#define PROGRESS_VACUUM_PHASE_INDEX_CLEANUP 4 +#define PROGRESS_VACUUM_PHASE_TRUNCATE 5 +#define PROGRESS_VACUUM_PHASE_FINAL_CLEANUP 6 + +/* Progress parameters for analyze */ +#define PROGRESS_ANALYZE_PHASE 0 +#define PROGRESS_ANALYZE_BLOCKS_TOTAL 1 +#define PROGRESS_ANALYZE_BLOCKS_DONE 2 +#define PROGRESS_ANALYZE_EXT_STATS_TOTAL 3 +#define PROGRESS_ANALYZE_EXT_STATS_COMPUTED 4 +#define PROGRESS_ANALYZE_CHILD_TABLES_TOTAL 5 +#define PROGRESS_ANALYZE_CHILD_TABLES_DONE 6 +#define PROGRESS_ANALYZE_CURRENT_CHILD_TABLE_RELID 7 +#define PROGRESS_ANALYZE_DELAY_TIME 8 + +/* Phases of analyze (as advertised via PROGRESS_ANALYZE_PHASE) */ +#define PROGRESS_ANALYZE_PHASE_ACQUIRE_SAMPLE_ROWS 1 +#define PROGRESS_ANALYZE_PHASE_ACQUIRE_SAMPLE_ROWS_INH 2 +#define PROGRESS_ANALYZE_PHASE_COMPUTE_STATS 3 +#define PROGRESS_ANALYZE_PHASE_COMPUTE_EXT_STATS 4 +#define PROGRESS_ANALYZE_PHASE_FINALIZE_ANALYZE 5 + +/* Progress parameters for cluster */ +#define PROGRESS_CLUSTER_COMMAND 0 +#define PROGRESS_CLUSTER_PHASE 1 +#define PROGRESS_CLUSTER_INDEX_RELID 2 +#define PROGRESS_CLUSTER_HEAP_TUPLES_SCANNED 3 +#define PROGRESS_CLUSTER_HEAP_TUPLES_WRITTEN 4 +#define PROGRESS_CLUSTER_TOTAL_HEAP_BLKS 5 +#define PROGRESS_CLUSTER_HEAP_BLKS_SCANNED 6 +#define PROGRESS_CLUSTER_INDEX_REBUILD_COUNT 7 + +/* Phases of cluster (as advertised via PROGRESS_CLUSTER_PHASE) */ +#define PROGRESS_CLUSTER_PHASE_SEQ_SCAN_HEAP 1 +#define PROGRESS_CLUSTER_PHASE_INDEX_SCAN_HEAP 2 +#define PROGRESS_CLUSTER_PHASE_SORT_TUPLES 3 +#define PROGRESS_CLUSTER_PHASE_WRITE_NEW_HEAP 4 +#define PROGRESS_CLUSTER_PHASE_SWAP_REL_FILES 5 +#define PROGRESS_CLUSTER_PHASE_REBUILD_INDEX 6 +#define PROGRESS_CLUSTER_PHASE_FINAL_CLEANUP 7 + +/* Commands of PROGRESS_CLUSTER */ +#define PROGRESS_CLUSTER_COMMAND_CLUSTER 1 +#define PROGRESS_CLUSTER_COMMAND_VACUUM_FULL 2 + +/* Progress parameters for CREATE INDEX */ +/* 3, 4 and 5 reserved for "waitfor" metrics */ +#define PROGRESS_CREATEIDX_COMMAND 0 +#define PROGRESS_CREATEIDX_INDEX_OID 6 +#define PROGRESS_CREATEIDX_ACCESS_METHOD_OID 8 +#define PROGRESS_CREATEIDX_PHASE 9 /* AM-agnostic phase # */ +#define PROGRESS_CREATEIDX_SUBPHASE 10 /* phase # filled by AM */ +#define PROGRESS_CREATEIDX_TUPLES_TOTAL 11 +#define PROGRESS_CREATEIDX_TUPLES_DONE 12 +#define PROGRESS_CREATEIDX_PARTITIONS_TOTAL 13 +#define PROGRESS_CREATEIDX_PARTITIONS_DONE 14 +/* 15 and 16 reserved for "block number" metrics */ + +/* Phases of CREATE INDEX (as advertised via PROGRESS_CREATEIDX_PHASE) */ +#define PROGRESS_CREATEIDX_PHASE_WAIT_1 1 +#define PROGRESS_CREATEIDX_PHASE_BUILD 2 +#define PROGRESS_CREATEIDX_PHASE_WAIT_2 3 +#define PROGRESS_CREATEIDX_PHASE_VALIDATE_IDXSCAN 4 +#define PROGRESS_CREATEIDX_PHASE_VALIDATE_SORT 5 +#define PROGRESS_CREATEIDX_PHASE_VALIDATE_TABLESCAN 6 +#define PROGRESS_CREATEIDX_PHASE_WAIT_3 7 +#define PROGRESS_CREATEIDX_PHASE_WAIT_4 8 +#define PROGRESS_CREATEIDX_PHASE_WAIT_5 9 + +/* + * Subphases of CREATE INDEX, for index_build. + */ +#define PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE 1 +/* Additional phases are defined by each AM */ + +/* Commands of PROGRESS_CREATEIDX */ +#define PROGRESS_CREATEIDX_COMMAND_CREATE 1 +#define PROGRESS_CREATEIDX_COMMAND_CREATE_CONCURRENTLY 2 +#define PROGRESS_CREATEIDX_COMMAND_REINDEX 3 +#define PROGRESS_CREATEIDX_COMMAND_REINDEX_CONCURRENTLY 4 + +/* Lock holder wait counts */ +#define PROGRESS_WAITFOR_TOTAL 3 +#define PROGRESS_WAITFOR_DONE 4 +#define PROGRESS_WAITFOR_CURRENT_PID 5 + +/* Block numbers in a generic relation scan */ +#define PROGRESS_SCAN_BLOCKS_TOTAL 15 +#define PROGRESS_SCAN_BLOCKS_DONE 16 + +/* Progress parameters for pg_basebackup */ +#define PROGRESS_BASEBACKUP_PHASE 0 +#define PROGRESS_BASEBACKUP_BACKUP_TOTAL 1 +#define PROGRESS_BASEBACKUP_BACKUP_STREAMED 2 +#define PROGRESS_BASEBACKUP_TBLSPC_TOTAL 3 +#define PROGRESS_BASEBACKUP_TBLSPC_STREAMED 4 + +/* Phases of pg_basebackup (as advertised via PROGRESS_BASEBACKUP_PHASE) */ +#define PROGRESS_BASEBACKUP_PHASE_WAIT_CHECKPOINT 1 +#define PROGRESS_BASEBACKUP_PHASE_ESTIMATE_BACKUP_SIZE 2 +#define PROGRESS_BASEBACKUP_PHASE_STREAM_BACKUP 3 +#define PROGRESS_BASEBACKUP_PHASE_WAIT_WAL_ARCHIVE 4 +#define PROGRESS_BASEBACKUP_PHASE_TRANSFER_WAL 5 + +/* Progress parameters for PROGRESS_COPY */ +#define PROGRESS_COPY_BYTES_PROCESSED 0 +#define PROGRESS_COPY_BYTES_TOTAL 1 +#define PROGRESS_COPY_TUPLES_PROCESSED 2 +#define PROGRESS_COPY_TUPLES_EXCLUDED 3 +#define PROGRESS_COPY_COMMAND 4 +#define PROGRESS_COPY_TYPE 5 +#define PROGRESS_COPY_TUPLES_SKIPPED 6 + +/* Commands of COPY (as advertised via PROGRESS_COPY_COMMAND) */ +#define PROGRESS_COPY_COMMAND_FROM 1 +#define PROGRESS_COPY_COMMAND_TO 2 + +/* Types of COPY commands (as advertised via PROGRESS_COPY_TYPE) */ +#define PROGRESS_COPY_TYPE_FILE 1 +#define PROGRESS_COPY_TYPE_PROGRAM 2 +#define PROGRESS_COPY_TYPE_PIPE 3 +#define PROGRESS_COPY_TYPE_CALLBACK 4 + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/publicationcmds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/publicationcmds.h new file mode 100644 index 0000000..f90cf1e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/publicationcmds.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * publicationcmds.h + * prototypes for publicationcmds.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/publicationcmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PUBLICATIONCMDS_H +#define PUBLICATIONCMDS_H + +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" +#include "utils/inval.h" + +/* Same as MAXNUMMESSAGES in sinvaladt.c */ +#define MAX_RELCACHE_INVAL_MSGS 4096 + +extern ObjectAddress CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt); +extern void AlterPublication(ParseState *pstate, AlterPublicationStmt *stmt); +extern void RemovePublicationById(Oid pubid); +extern void RemovePublicationRelById(Oid proid); +extern void RemovePublicationSchemaById(Oid psoid); + +extern ObjectAddress AlterPublicationOwner(const char *name, Oid newOwnerId); +extern void AlterPublicationOwner_oid(Oid pubid, Oid newOwnerId); +extern void InvalidatePublicationRels(List *relids); +extern bool pub_rf_contains_invalid_column(Oid pubid, Relation relation, + List *ancestors, bool pubviaroot); +extern bool pub_contains_invalid_column(Oid pubid, Relation relation, + List *ancestors, bool pubviaroot, + char pubgencols_type, + bool *invalid_column_list, + bool *invalid_gen_col); +extern void InvalidatePubRelSyncCache(Oid pubid, bool puballtables); + +#endif /* PUBLICATIONCMDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/schemacmds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/schemacmds.h new file mode 100644 index 0000000..8557176 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/schemacmds.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * schemacmds.h + * prototypes for schemacmds.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/schemacmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SCHEMACMDS_H +#define SCHEMACMDS_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern Oid CreateSchemaCommand(CreateSchemaStmt *stmt, + const char *queryString, + int stmt_location, int stmt_len); + +extern ObjectAddress RenameSchema(const char *oldname, const char *newname); +extern ObjectAddress AlterSchemaOwner(const char *name, Oid newOwnerId); +extern void AlterSchemaOwner_oid(Oid schemaoid, Oid newOwnerId); + +#endif /* SCHEMACMDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/seclabel.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/seclabel.h new file mode 100644 index 0000000..4550be9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/seclabel.h @@ -0,0 +1,34 @@ +/* + * seclabel.h + * + * Prototypes for functions in commands/seclabel.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + */ +#ifndef SECLABEL_H +#define SECLABEL_H + +#include "catalog/objectaddress.h" + +/* + * Internal APIs + */ +extern char *GetSecurityLabel(const ObjectAddress *object, + const char *provider); +extern void SetSecurityLabel(const ObjectAddress *object, + const char *provider, const char *label); +extern void DeleteSecurityLabel(const ObjectAddress *object); +extern void DeleteSharedSecurityLabel(Oid objectId, Oid classId); + +/* + * Statement and ESP hook support + */ +extern ObjectAddress ExecSecLabelStmt(SecLabelStmt *stmt); + +typedef void (*check_object_relabel_type) (const ObjectAddress *object, + const char *seclabel); +extern void register_label_provider(const char *provider_name, + check_object_relabel_type hook); + +#endif /* SECLABEL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/sequence.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/sequence.h new file mode 100644 index 0000000..9ac0b67 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/sequence.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * + * sequence.h + * prototypes for sequence.c. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/sequence.h + * + *------------------------------------------------------------------------- + */ +#ifndef SEQUENCE_H +#define SEQUENCE_H + +#include "access/xlogreader.h" +#include "catalog/objectaddress.h" +#include "fmgr.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "storage/relfilelocator.h" + + +typedef struct FormData_pg_sequence_data +{ + int64 last_value; + int64 log_cnt; + bool is_called; +} FormData_pg_sequence_data; + +typedef FormData_pg_sequence_data *Form_pg_sequence_data; + +/* + * Columns of a sequence relation + */ + +#define SEQ_COL_LASTVAL 1 +#define SEQ_COL_LOG 2 +#define SEQ_COL_CALLED 3 + +#define SEQ_COL_FIRSTCOL SEQ_COL_LASTVAL +#define SEQ_COL_LASTCOL SEQ_COL_CALLED + +/* XLOG stuff */ +#define XLOG_SEQ_LOG 0x00 + +typedef struct xl_seq_rec +{ + RelFileLocator locator; + /* SEQUENCE TUPLE DATA FOLLOWS AT THE END */ +} xl_seq_rec; + +extern int64 nextval_internal(Oid relid, bool check_permissions); +extern Datum nextval(PG_FUNCTION_ARGS); +extern List *sequence_options(Oid relid); + +extern ObjectAddress DefineSequence(ParseState *pstate, CreateSeqStmt *seq); +extern ObjectAddress AlterSequence(ParseState *pstate, AlterSeqStmt *stmt); +extern void SequenceChangePersistence(Oid relid, char newrelpersistence); +extern void DeleteSequenceTuple(Oid relid); +extern void ResetSequence(Oid seq_relid); +extern void ResetSequenceCaches(void); + +extern void seq_redo(XLogReaderState *record); +extern void seq_desc(StringInfo buf, XLogReaderState *record); +extern const char *seq_identify(uint8 info); +extern void seq_mask(char *page, BlockNumber blkno); + +#endif /* SEQUENCE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/subscriptioncmds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/subscriptioncmds.h new file mode 100644 index 0000000..c2262e4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/subscriptioncmds.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * subscriptioncmds.h + * prototypes for subscriptioncmds.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/subscriptioncmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SUBSCRIPTIONCMDS_H +#define SUBSCRIPTIONCMDS_H + +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" + +extern ObjectAddress CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt, + bool isTopLevel); +extern ObjectAddress AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt, bool isTopLevel); +extern void DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel); + +extern ObjectAddress AlterSubscriptionOwner(const char *name, Oid newOwnerId); +extern void AlterSubscriptionOwner_oid(Oid subid, Oid newOwnerId); + +extern char defGetStreamingMode(DefElem *def); + +#endif /* SUBSCRIPTIONCMDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/tablecmds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/tablecmds.h new file mode 100644 index 0000000..6832470 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/tablecmds.h @@ -0,0 +1,110 @@ +/*------------------------------------------------------------------------- + * + * tablecmds.h + * prototypes for tablecmds.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/tablecmds.h + * + *------------------------------------------------------------------------- + */ +#ifndef TABLECMDS_H +#define TABLECMDS_H + +#include "access/htup.h" +#include "catalog/dependency.h" +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" +#include "storage/lock.h" +#include "utils/relcache.h" + +struct AlterTableUtilityContext; /* avoid including tcop/utility.h here */ + + +extern ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, + ObjectAddress *typaddress, const char *queryString); + +extern TupleDesc BuildDescForRelation(const List *columns); + +extern void RemoveRelations(DropStmt *drop); + +extern Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode); + +extern void AlterTable(AlterTableStmt *stmt, LOCKMODE lockmode, + struct AlterTableUtilityContext *context); + +extern LOCKMODE AlterTableGetLockLevel(List *cmds); + +extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode); + +extern void AlterTableInternal(Oid relid, List *cmds, bool recurse); + +extern Oid AlterTableMoveAll(AlterTableMoveAllStmt *stmt); + +extern ObjectAddress AlterTableNamespace(AlterObjectSchemaStmt *stmt, + Oid *oldschema); + +extern void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, + Oid nspOid, ObjectAddresses *objsMoved); + +extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, + Oid oldNspOid, Oid newNspOid, + bool hasDependEntry, + ObjectAddresses *objsMoved); + +extern void CheckTableNotInUse(Relation rel, const char *stmt); + +extern void ExecuteTruncate(TruncateStmt *stmt); +extern void ExecuteTruncateGuts(List *explicit_rels, + List *relids, + List *relids_logged, + DropBehavior behavior, + bool restart_seqs, + bool run_as_table_owner); + +extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass); + +extern bool CheckRelationTableSpaceMove(Relation rel, Oid newTableSpaceId); +extern void SetRelationTableSpace(Relation rel, Oid newTableSpaceId, + RelFileNumber newRelFilenumber); + +extern ObjectAddress renameatt(RenameStmt *stmt); + +extern ObjectAddress RenameConstraint(RenameStmt *stmt); + +extern ObjectAddress RenameRelation(RenameStmt *stmt); + +extern void RenameRelationInternal(Oid myrelid, + const char *newrelname, bool is_internal, + bool is_index); + +extern void ResetRelRewrite(Oid myrelid); + +extern void find_composite_type_dependencies(Oid typeOid, + Relation origRelation, + const char *origTypeName); + +extern void check_of_type(HeapTuple typetuple); + +extern void register_on_commit_action(Oid relid, OnCommitAction action); +extern void remove_on_commit_action(Oid relid); + +extern void PreCommit_on_commit_actions(void); +extern void AtEOXact_on_commit_actions(bool isCommit); +extern void AtEOSubXact_on_commit_actions(bool isCommit, + SubTransactionId mySubid, + SubTransactionId parentSubid); + +extern void RangeVarCallbackMaintainsTable(const RangeVar *relation, + Oid relId, Oid oldRelId, + void *arg); + +extern void RangeVarCallbackOwnsRelation(const RangeVar *relation, + Oid relId, Oid oldRelId, void *arg); +extern bool PartConstraintImpliedByRelConstraint(Relation scanrel, + List *partConstraint); + +#endif /* TABLECMDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/tablespace.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/tablespace.h new file mode 100644 index 0000000..4e8bf4d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/tablespace.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------------------- + * + * tablespace.h + * Tablespace management commands (create/drop tablespace). + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/tablespace.h + * + *------------------------------------------------------------------------- + */ +#ifndef TABLESPACE_H +#define TABLESPACE_H + +#include "access/xlogreader.h" +#include "catalog/objectaddress.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" + +extern PGDLLIMPORT char *default_tablespace; +extern PGDLLIMPORT char *temp_tablespaces; +extern PGDLLIMPORT bool allow_in_place_tablespaces; + +/* XLOG stuff */ +#define XLOG_TBLSPC_CREATE 0x00 +#define XLOG_TBLSPC_DROP 0x10 + +typedef struct xl_tblspc_create_rec +{ + Oid ts_id; + char ts_path[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string */ +} xl_tblspc_create_rec; + +typedef struct xl_tblspc_drop_rec +{ + Oid ts_id; +} xl_tblspc_drop_rec; + +typedef struct TableSpaceOpts +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + float8 random_page_cost; + float8 seq_page_cost; + int effective_io_concurrency; + int maintenance_io_concurrency; +} TableSpaceOpts; + +extern Oid CreateTableSpace(CreateTableSpaceStmt *stmt); +extern void DropTableSpace(DropTableSpaceStmt *stmt); +extern ObjectAddress RenameTableSpace(const char *oldname, const char *newname); +extern Oid AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt); + +extern void TablespaceCreateDbspace(Oid spcOid, Oid dbOid, bool isRedo); + +extern Oid GetDefaultTablespace(char relpersistence, bool partitioned); + +extern void PrepareTempTablespaces(void); + +extern Oid get_tablespace_oid(const char *tablespacename, bool missing_ok); +extern char *get_tablespace_name(Oid spc_oid); + +extern bool directory_is_empty(const char *path); +extern void remove_tablespace_symlink(const char *linkloc); + +extern void tblspc_redo(XLogReaderState *record); +extern void tblspc_desc(StringInfo buf, XLogReaderState *record); +extern const char *tblspc_identify(uint8 info); + +#endif /* TABLESPACE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/trigger.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/trigger.h new file mode 100644 index 0000000..54be07c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/trigger.h @@ -0,0 +1,292 @@ +/*------------------------------------------------------------------------- + * + * trigger.h + * Declarations for trigger handling. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/trigger.h + * + *------------------------------------------------------------------------- + */ +#ifndef TRIGGER_H +#define TRIGGER_H + +#include "access/tableam.h" +#include "catalog/objectaddress.h" +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" + +/* + * TriggerData is the node type that is passed as fmgr "context" info + * when a function is called by the trigger manager. + */ + +#define CALLED_AS_TRIGGER(fcinfo) \ + ((fcinfo)->context != NULL && IsA((fcinfo)->context, TriggerData)) + +typedef uint32 TriggerEvent; + +typedef struct TriggerData +{ + NodeTag type; + TriggerEvent tg_event; + Relation tg_relation; + HeapTuple tg_trigtuple; + HeapTuple tg_newtuple; + Trigger *tg_trigger; + TupleTableSlot *tg_trigslot; + TupleTableSlot *tg_newslot; + Tuplestorestate *tg_oldtable; + Tuplestorestate *tg_newtable; + const Bitmapset *tg_updatedcols; +} TriggerData; + +/* + * The state for capturing old and new tuples into transition tables for a + * single ModifyTable node (or other operation source, e.g. copyfrom.c). + * + * This is per-caller to avoid conflicts in setting + * tcs_original_insert_tuple. Note, however, that the pointed-to + * private data may be shared across multiple callers. + */ +struct AfterTriggersTableData; /* private in trigger.c */ + +typedef struct TransitionCaptureState +{ + /* + * Is there at least one trigger specifying each transition relation on + * the relation explicitly named in the DML statement or COPY command? + * Note: in current usage, these flags could be part of the private state, + * but it seems possibly useful to let callers see them. + */ + bool tcs_delete_old_table; + bool tcs_update_old_table; + bool tcs_update_new_table; + bool tcs_insert_new_table; + + /* + * For INSERT and COPY, it would be wasteful to convert tuples from child + * format to parent format after they have already been converted in the + * opposite direction during routing. In that case we bypass conversion + * and allow the inserting code (copyfrom.c and nodeModifyTable.c) to + * provide a slot containing the original tuple directly. + */ + TupleTableSlot *tcs_original_insert_tuple; + + /* + * Private data including the tuplestore(s) into which to insert tuples. + */ + struct AfterTriggersTableData *tcs_insert_private; + struct AfterTriggersTableData *tcs_update_private; + struct AfterTriggersTableData *tcs_delete_private; +} TransitionCaptureState; + +/* + * TriggerEvent bit flags + * + * Note that we assume different event types (INSERT/DELETE/UPDATE/TRUNCATE) + * can't be OR'd together in a single TriggerEvent. This is unlike the + * situation for pg_trigger rows, so pg_trigger.tgtype uses a different + * representation! + */ +#define TRIGGER_EVENT_INSERT 0x00000000 +#define TRIGGER_EVENT_DELETE 0x00000001 +#define TRIGGER_EVENT_UPDATE 0x00000002 +#define TRIGGER_EVENT_TRUNCATE 0x00000003 +#define TRIGGER_EVENT_OPMASK 0x00000003 + +#define TRIGGER_EVENT_ROW 0x00000004 + +#define TRIGGER_EVENT_BEFORE 0x00000008 +#define TRIGGER_EVENT_AFTER 0x00000000 +#define TRIGGER_EVENT_INSTEAD 0x00000010 +#define TRIGGER_EVENT_TIMINGMASK 0x00000018 + +/* More TriggerEvent flags, used only within trigger.c */ + +#define AFTER_TRIGGER_DEFERRABLE 0x00000020 +#define AFTER_TRIGGER_INITDEFERRED 0x00000040 + +#define TRIGGER_FIRED_BY_INSERT(event) \ + (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_INSERT) + +#define TRIGGER_FIRED_BY_DELETE(event) \ + (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_DELETE) + +#define TRIGGER_FIRED_BY_UPDATE(event) \ + (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_UPDATE) + +#define TRIGGER_FIRED_BY_TRUNCATE(event) \ + (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_TRUNCATE) + +#define TRIGGER_FIRED_FOR_ROW(event) \ + ((event) & TRIGGER_EVENT_ROW) + +#define TRIGGER_FIRED_FOR_STATEMENT(event) \ + (!TRIGGER_FIRED_FOR_ROW(event)) + +#define TRIGGER_FIRED_BEFORE(event) \ + (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_BEFORE) + +#define TRIGGER_FIRED_AFTER(event) \ + (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_AFTER) + +#define TRIGGER_FIRED_INSTEAD(event) \ + (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_INSTEAD) + +/* + * Definitions for replication role based firing. + */ +#define SESSION_REPLICATION_ROLE_ORIGIN 0 +#define SESSION_REPLICATION_ROLE_REPLICA 1 +#define SESSION_REPLICATION_ROLE_LOCAL 2 +extern PGDLLIMPORT int SessionReplicationRole; + +/* + * States at which a trigger can be fired. These are the + * possible values for pg_trigger.tgenabled. + */ +#define TRIGGER_FIRES_ON_ORIGIN 'O' +#define TRIGGER_FIRES_ALWAYS 'A' +#define TRIGGER_FIRES_ON_REPLICA 'R' +#define TRIGGER_DISABLED 'D' + +extern ObjectAddress CreateTrigger(CreateTrigStmt *stmt, const char *queryString, + Oid relOid, Oid refRelOid, Oid constraintOid, Oid indexOid, + Oid funcoid, Oid parentTriggerOid, Node *whenClause, + bool isInternal, bool in_partition); +extern ObjectAddress CreateTriggerFiringOn(CreateTrigStmt *stmt, const char *queryString, + Oid relOid, Oid refRelOid, Oid constraintOid, + Oid indexOid, Oid funcoid, Oid parentTriggerOid, + Node *whenClause, bool isInternal, bool in_partition, + char trigger_fires_when); + +extern void TriggerSetParentTrigger(Relation trigRel, + Oid childTrigId, + Oid parentTrigId, + Oid childTableId); +extern void RemoveTriggerById(Oid trigOid); +extern Oid get_trigger_oid(Oid relid, const char *trigname, bool missing_ok); + +extern ObjectAddress renametrig(RenameStmt *stmt); + +extern void EnableDisableTrigger(Relation rel, const char *tgname, Oid tgparent, + char fires_when, bool skip_system, bool recurse, + LOCKMODE lockmode); + +extern void RelationBuildTriggers(Relation relation); + +extern TriggerDesc *CopyTriggerDesc(TriggerDesc *trigdesc); + +extern const char *FindTriggerIncompatibleWithInheritance(TriggerDesc *trigdesc); + +extern TransitionCaptureState *MakeTransitionCaptureState(TriggerDesc *trigdesc, + Oid relid, CmdType cmdType); + +extern void FreeTriggerDesc(TriggerDesc *trigdesc); + +extern void ExecBSInsertTriggers(EState *estate, + ResultRelInfo *relinfo); +extern void ExecASInsertTriggers(EState *estate, + ResultRelInfo *relinfo, + TransitionCaptureState *transition_capture); +extern bool ExecBRInsertTriggers(EState *estate, + ResultRelInfo *relinfo, + TupleTableSlot *slot); +extern void ExecARInsertTriggers(EState *estate, + ResultRelInfo *relinfo, + TupleTableSlot *slot, + List *recheckIndexes, + TransitionCaptureState *transition_capture); +extern bool ExecIRInsertTriggers(EState *estate, + ResultRelInfo *relinfo, + TupleTableSlot *slot); +extern void ExecBSDeleteTriggers(EState *estate, + ResultRelInfo *relinfo); +extern void ExecASDeleteTriggers(EState *estate, + ResultRelInfo *relinfo, + TransitionCaptureState *transition_capture); +extern bool ExecBRDeleteTriggers(EState *estate, + EPQState *epqstate, + ResultRelInfo *relinfo, + ItemPointer tupleid, + HeapTuple fdw_trigtuple, + TupleTableSlot **epqslot, + TM_Result *tmresult, + TM_FailureData *tmfd, + bool is_merge_delete); +extern void ExecARDeleteTriggers(EState *estate, + ResultRelInfo *relinfo, + ItemPointer tupleid, + HeapTuple fdw_trigtuple, + TransitionCaptureState *transition_capture, + bool is_crosspart_update); +extern bool ExecIRDeleteTriggers(EState *estate, + ResultRelInfo *relinfo, + HeapTuple trigtuple); +extern void ExecBSUpdateTriggers(EState *estate, + ResultRelInfo *relinfo); +extern void ExecASUpdateTriggers(EState *estate, + ResultRelInfo *relinfo, + TransitionCaptureState *transition_capture); +extern bool ExecBRUpdateTriggers(EState *estate, + EPQState *epqstate, + ResultRelInfo *relinfo, + ItemPointer tupleid, + HeapTuple fdw_trigtuple, + TupleTableSlot *newslot, + TM_Result *tmresult, + TM_FailureData *tmfd, + bool is_merge_update); +extern void ExecARUpdateTriggers(EState *estate, + ResultRelInfo *relinfo, + ResultRelInfo *src_partinfo, + ResultRelInfo *dst_partinfo, + ItemPointer tupleid, + HeapTuple fdw_trigtuple, + TupleTableSlot *newslot, + List *recheckIndexes, + TransitionCaptureState *transition_capture, + bool is_crosspart_update); +extern bool ExecIRUpdateTriggers(EState *estate, + ResultRelInfo *relinfo, + HeapTuple trigtuple, + TupleTableSlot *newslot); +extern void ExecBSTruncateTriggers(EState *estate, + ResultRelInfo *relinfo); +extern void ExecASTruncateTriggers(EState *estate, + ResultRelInfo *relinfo); + +extern void AfterTriggerBeginXact(void); +extern void AfterTriggerBeginQuery(void); +extern void AfterTriggerEndQuery(EState *estate); +extern void AfterTriggerFireDeferred(void); +extern void AfterTriggerEndXact(bool isCommit); +extern void AfterTriggerBeginSubXact(void); +extern void AfterTriggerEndSubXact(bool isCommit); +extern void AfterTriggerSetState(ConstraintsSetStmt *stmt); +extern bool AfterTriggerPendingOnRel(Oid relid); + + +/* + * in utils/adt/ri_triggers.c + */ +extern bool RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel, + TupleTableSlot *oldslot, TupleTableSlot *newslot); +extern bool RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel, + TupleTableSlot *oldslot, TupleTableSlot *newslot); +extern bool RI_Initial_Check(Trigger *trigger, + Relation fk_rel, Relation pk_rel); +extern void RI_PartitionRemove_Check(Trigger *trigger, Relation fk_rel, + Relation pk_rel); + +/* result values for RI_FKey_trigger_type: */ +#define RI_TRIGGER_PK 1 /* is a trigger on the PK relation */ +#define RI_TRIGGER_FK 2 /* is a trigger on the FK relation */ +#define RI_TRIGGER_NONE 0 /* is not an RI trigger function */ + +extern int RI_FKey_trigger_type(Oid tgfoid); + +#endif /* TRIGGER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/typecmds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/typecmds.h new file mode 100644 index 0000000..6cc387e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/typecmds.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * typecmds.h + * prototypes for typecmds.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/typecmds.h + * + *------------------------------------------------------------------------- + */ +#ifndef TYPECMDS_H +#define TYPECMDS_H + +#include "access/htup.h" +#include "catalog/dependency.h" +#include "parser/parse_node.h" + + +#define DEFAULT_TYPDELIM ',' + +extern ObjectAddress DefineType(ParseState *pstate, List *names, List *parameters); +extern void RemoveTypeById(Oid typeOid); +extern ObjectAddress DefineDomain(ParseState *pstate, CreateDomainStmt *stmt); +extern ObjectAddress DefineEnum(CreateEnumStmt *stmt); +extern ObjectAddress DefineRange(ParseState *pstate, CreateRangeStmt *stmt); +extern ObjectAddress AlterEnum(AlterEnumStmt *stmt); +extern ObjectAddress DefineCompositeType(RangeVar *typevar, List *coldeflist); +extern Oid AssignTypeArrayOid(void); +extern Oid AssignTypeMultirangeOid(void); +extern Oid AssignTypeMultirangeArrayOid(void); + +extern ObjectAddress AlterDomainDefault(List *names, Node *defaultRaw); +extern ObjectAddress AlterDomainNotNull(List *names, bool notNull); +extern ObjectAddress AlterDomainAddConstraint(List *names, Node *newConstraint, + ObjectAddress *constrAddr); +extern ObjectAddress AlterDomainValidateConstraint(List *names, const char *constrName); +extern ObjectAddress AlterDomainDropConstraint(List *names, const char *constrName, + DropBehavior behavior, bool missing_ok); + +extern void checkDomainOwner(HeapTuple tup); + +extern ObjectAddress RenameType(RenameStmt *stmt); + +extern ObjectAddress AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype); +extern void AlterTypeOwner_oid(Oid typeOid, Oid newOwnerId, bool hasDependEntry); +extern void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId); + +extern ObjectAddress AlterTypeNamespace(List *names, const char *newschema, + ObjectType objecttype, Oid *oldschema); +extern Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, bool ignoreDependent, + ObjectAddresses *objsMoved); +extern Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid, + bool isImplicitArray, + bool ignoreDependent, + bool errorOnTableType, + ObjectAddresses *objsMoved); + +extern ObjectAddress AlterType(AlterTypeStmt *stmt); + +#endif /* TYPECMDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/user.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/user.h new file mode 100644 index 0000000..97dcb93 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/user.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * user.h + * Commands for manipulating roles (formerly called users). + * + * + * src/include/commands/user.h + * + *------------------------------------------------------------------------- + */ +#ifndef USER_H +#define USER_H + +#include "catalog/objectaddress.h" +#include "libpq/crypt.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "utils/guc.h" + +/* GUCs */ +extern PGDLLIMPORT int Password_encryption; /* values from enum PasswordType */ +extern PGDLLIMPORT char *createrole_self_grant; + +/* Hook to check passwords in CreateRole() and AlterRole() */ +typedef void (*check_password_hook_type) (const char *username, const char *shadow_pass, PasswordType password_type, Datum validuntil_time, bool validuntil_null); + +extern PGDLLIMPORT check_password_hook_type check_password_hook; + +extern Oid CreateRole(ParseState *pstate, CreateRoleStmt *stmt); +extern Oid AlterRole(ParseState *pstate, AlterRoleStmt *stmt); +extern Oid AlterRoleSet(AlterRoleSetStmt *stmt); +extern void DropRole(DropRoleStmt *stmt); +extern void GrantRole(ParseState *pstate, GrantRoleStmt *stmt); +extern ObjectAddress RenameRole(const char *oldname, const char *newname); +extern void DropOwnedObjects(DropOwnedStmt *stmt); +extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt); +extern List *roleSpecsToIds(List *memberNames); + +extern bool check_createrole_self_grant(char **newval, void **extra, + GucSource source); +extern void assign_createrole_self_grant(const char *newval, void *extra); + +#endif /* USER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/vacuum.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/vacuum.h new file mode 100644 index 0000000..bc37a80 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/vacuum.h @@ -0,0 +1,410 @@ +/*------------------------------------------------------------------------- + * + * vacuum.h + * header file for postgres vacuum cleaner and statistics analyzer + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/vacuum.h + * + *------------------------------------------------------------------------- + */ +#ifndef VACUUM_H +#define VACUUM_H + +#include "access/htup.h" +#include "access/genam.h" +#include "access/parallel.h" +#include "access/tidstore.h" +#include "catalog/pg_class.h" +#include "catalog/pg_statistic.h" +#include "catalog/pg_type.h" +#include "parser/parse_node.h" +#include "storage/buf.h" +#include "storage/lock.h" +#include "utils/relcache.h" + +/* + * Flags for amparallelvacuumoptions to control the participation of bulkdelete + * and vacuumcleanup in parallel vacuum. + */ + +/* + * Both bulkdelete and vacuumcleanup are disabled by default. This will be + * used by IndexAM's that don't want to or cannot participate in parallel + * vacuum. For example, if an index AM doesn't have a way to communicate the + * index statistics allocated by the first ambulkdelete call to the subsequent + * ones until amvacuumcleanup, the index AM cannot participate in parallel + * vacuum. + */ +#define VACUUM_OPTION_NO_PARALLEL 0 + +/* + * bulkdelete can be performed in parallel. This option can be used by + * index AMs that need to scan indexes to delete tuples. + */ +#define VACUUM_OPTION_PARALLEL_BULKDEL (1 << 0) + +/* + * vacuumcleanup can be performed in parallel if bulkdelete is not performed + * yet. This will be used by IndexAM's that can scan the index if the + * bulkdelete is not performed. + */ +#define VACUUM_OPTION_PARALLEL_COND_CLEANUP (1 << 1) + +/* + * vacuumcleanup can be performed in parallel even if bulkdelete has already + * processed the index. This will be used by IndexAM's that scan the index + * during the cleanup phase of index irrespective of whether the index is + * already scanned or not during bulkdelete phase. + */ +#define VACUUM_OPTION_PARALLEL_CLEANUP (1 << 2) + +/* value for checking vacuum flags */ +#define VACUUM_OPTION_MAX_VALID_VALUE ((1 << 3) - 1) + +/* Abstract type for parallel vacuum state */ +typedef struct ParallelVacuumState ParallelVacuumState; + +/*---------- + * ANALYZE builds one of these structs for each attribute (column) that is + * to be analyzed. The struct and subsidiary data are in anl_context, + * so they live until the end of the ANALYZE operation. + * + * The type-specific typanalyze function is passed a pointer to this struct + * and must return true to continue analysis, false to skip analysis of this + * column. In the true case it must set the compute_stats and minrows fields, + * and can optionally set extra_data to pass additional info to compute_stats. + * minrows is its request for the minimum number of sample rows to be gathered + * (but note this request might not be honored, eg if there are fewer rows + * than that in the table). + * + * The compute_stats routine will be called after sample rows have been + * gathered. Aside from this struct, it is passed: + * fetchfunc: a function for accessing the column values from the + * sample rows + * samplerows: the number of sample tuples + * totalrows: estimated total number of rows in relation + * The fetchfunc may be called with rownum running from 0 to samplerows-1. + * It returns a Datum and an isNull flag. + * + * compute_stats should set stats_valid true if it is able to compute + * any useful statistics. If it does, the remainder of the struct holds + * the information to be stored in a pg_statistic row for the column. Be + * careful to allocate any pointed-to data in anl_context, which will NOT + * be CurrentMemoryContext when compute_stats is called. + * + * Note: all comparisons done for statistical purposes should use the + * underlying column's collation (attcollation), except in situations + * where a noncollatable container type contains a collatable type; + * in that case use the type's default collation. Be sure to record + * the appropriate collation in stacoll. + *---------- + */ +typedef struct VacAttrStats *VacAttrStatsP; + +typedef Datum (*AnalyzeAttrFetchFunc) (VacAttrStatsP stats, int rownum, + bool *isNull); + +typedef void (*AnalyzeAttrComputeStatsFunc) (VacAttrStatsP stats, + AnalyzeAttrFetchFunc fetchfunc, + int samplerows, + double totalrows); + +typedef struct VacAttrStats +{ + /* + * These fields are set up by the main ANALYZE code before invoking the + * type-specific typanalyze function. They don't necessarily match what + * is in pg_attribute, because some index opclasses store a different type + * than the underlying column/expression. Therefore, use these fields for + * information about the datatype being fed to the typanalyze function. + */ + int attstattarget; /* -1 to use default */ + Oid attrtypid; /* type of data being analyzed */ + int32 attrtypmod; /* typmod of data being analyzed */ + Form_pg_type attrtype; /* copy of pg_type row for attrtypid */ + Oid attrcollid; /* collation of data being analyzed */ + MemoryContext anl_context; /* where to save long-lived data */ + + /* + * These fields must be filled in by the typanalyze routine, unless it + * returns false. + */ + AnalyzeAttrComputeStatsFunc compute_stats; /* function pointer */ + int minrows; /* Minimum # of rows wanted for stats */ + void *extra_data; /* for extra type-specific data */ + + /* + * These fields are to be filled in by the compute_stats routine. (They + * are initialized to zero when the struct is created.) + */ + bool stats_valid; + float4 stanullfrac; /* fraction of entries that are NULL */ + int32 stawidth; /* average width of column values */ + float4 stadistinct; /* # distinct values */ + int16 stakind[STATISTIC_NUM_SLOTS]; + Oid staop[STATISTIC_NUM_SLOTS]; + Oid stacoll[STATISTIC_NUM_SLOTS]; + int numnumbers[STATISTIC_NUM_SLOTS]; + float4 *stanumbers[STATISTIC_NUM_SLOTS]; + int numvalues[STATISTIC_NUM_SLOTS]; + Datum *stavalues[STATISTIC_NUM_SLOTS]; + + /* + * These fields describe the stavalues[n] element types. They will be + * initialized to match attrtypid, but a custom typanalyze function might + * want to store an array of something other than the analyzed column's + * elements. It should then overwrite these fields. + */ + Oid statypid[STATISTIC_NUM_SLOTS]; + int16 statyplen[STATISTIC_NUM_SLOTS]; + bool statypbyval[STATISTIC_NUM_SLOTS]; + char statypalign[STATISTIC_NUM_SLOTS]; + + /* + * These fields are private to the main ANALYZE code and should not be + * looked at by type-specific functions. + */ + int tupattnum; /* attribute number within tuples */ + HeapTuple *rows; /* access info for std fetch function */ + TupleDesc tupDesc; + Datum *exprvals; /* access info for index fetch function */ + bool *exprnulls; + int rowstride; +} VacAttrStats; + +/* flag bits for VacuumParams->options */ +#define VACOPT_VACUUM 0x01 /* do VACUUM */ +#define VACOPT_ANALYZE 0x02 /* do ANALYZE */ +#define VACOPT_VERBOSE 0x04 /* output INFO instrumentation messages */ +#define VACOPT_FREEZE 0x08 /* FREEZE option */ +#define VACOPT_FULL 0x10 /* FULL (non-concurrent) vacuum */ +#define VACOPT_SKIP_LOCKED 0x20 /* skip if cannot get lock */ +#define VACOPT_PROCESS_MAIN 0x40 /* process main relation */ +#define VACOPT_PROCESS_TOAST 0x80 /* process the TOAST table, if any */ +#define VACOPT_DISABLE_PAGE_SKIPPING 0x100 /* don't skip any pages */ +#define VACOPT_SKIP_DATABASE_STATS 0x200 /* skip vac_update_datfrozenxid() */ +#define VACOPT_ONLY_DATABASE_STATS 0x400 /* only vac_update_datfrozenxid() */ + +/* + * Values used by index_cleanup and truncate params. + * + * VACOPTVALUE_UNSPECIFIED is used as an initial placeholder when VACUUM + * command has no explicit value. When that happens the final usable value + * comes from the corresponding reloption (though the reloption default is + * usually used). + */ +typedef enum VacOptValue +{ + VACOPTVALUE_UNSPECIFIED = 0, + VACOPTVALUE_AUTO, + VACOPTVALUE_DISABLED, + VACOPTVALUE_ENABLED, +} VacOptValue; + +/* + * Parameters customizing behavior of VACUUM and ANALYZE. + * + * Note that at least one of VACOPT_VACUUM and VACOPT_ANALYZE must be set + * in options. + * + * When adding a new VacuumParam member, consider adding it to vacuumdb as + * well. + */ +typedef struct VacuumParams +{ + bits32 options; /* bitmask of VACOPT_* */ + int freeze_min_age; /* min freeze age, -1 to use default */ + int freeze_table_age; /* age at which to scan whole table */ + int multixact_freeze_min_age; /* min multixact freeze age, -1 to + * use default */ + int multixact_freeze_table_age; /* multixact age at which to scan + * whole table */ + bool is_wraparound; /* force a for-wraparound vacuum */ + int log_min_duration; /* minimum execution threshold in ms at + * which autovacuum is logged, -1 to use + * default */ + VacOptValue index_cleanup; /* Do index vacuum and cleanup */ + VacOptValue truncate; /* Truncate empty pages at the end */ + Oid toast_parent; /* for privilege checks when recursing */ + + /* + * Fraction of pages in a relation that vacuum can eagerly scan and fail + * to freeze. Only applicable for table AMs using visibility maps. Derived + * from GUC or table storage parameter. 0 if disabled. + */ + double max_eager_freeze_failure_rate; + + /* + * The number of parallel vacuum workers. 0 by default which means choose + * based on the number of indexes. -1 indicates parallel vacuum is + * disabled. + */ + int nworkers; +} VacuumParams; + +/* + * VacuumCutoffs is immutable state that describes the cutoffs used by VACUUM. + * Established at the beginning of each VACUUM operation. + */ +struct VacuumCutoffs +{ + /* + * Existing pg_class fields at start of VACUUM + */ + TransactionId relfrozenxid; + MultiXactId relminmxid; + + /* + * OldestXmin is the Xid below which tuples deleted by any xact (that + * committed) should be considered DEAD, not just RECENTLY_DEAD. + * + * OldestMxact is the Mxid below which MultiXacts are definitely not seen + * as visible by any running transaction. + * + * OldestXmin and OldestMxact are also the most recent values that can + * ever be passed to vac_update_relstats() as frozenxid and minmulti + * arguments at the end of VACUUM. These same values should be passed + * when it turns out that VACUUM will leave no unfrozen XIDs/MXIDs behind + * in the table. + */ + TransactionId OldestXmin; + MultiXactId OldestMxact; + + /* + * FreezeLimit is the Xid below which all Xids are definitely frozen or + * removed in pages VACUUM scans and cleanup locks. + * + * MultiXactCutoff is the value below which all MultiXactIds are + * definitely removed from Xmax in pages VACUUM scans and cleanup locks. + */ + TransactionId FreezeLimit; + MultiXactId MultiXactCutoff; +}; + +/* + * VacDeadItemsInfo stores supplemental information for dead tuple TID + * storage (i.e. TidStore). + */ +typedef struct VacDeadItemsInfo +{ + size_t max_bytes; /* the maximum bytes TidStore can use */ + int64 num_items; /* current # of entries */ +} VacDeadItemsInfo; + +/* GUC parameters */ +extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for PostGIS */ +extern PGDLLIMPORT int vacuum_freeze_min_age; +extern PGDLLIMPORT int vacuum_freeze_table_age; +extern PGDLLIMPORT int vacuum_multixact_freeze_min_age; +extern PGDLLIMPORT int vacuum_multixact_freeze_table_age; +extern PGDLLIMPORT int vacuum_failsafe_age; +extern PGDLLIMPORT int vacuum_multixact_failsafe_age; +extern PGDLLIMPORT bool track_cost_delay_timing; +extern PGDLLIMPORT bool vacuum_truncate; + +/* + * Relevant for vacuums implementing eager scanning. Normal vacuums may + * eagerly scan some all-visible but not all-frozen pages. Since the goal + * is to freeze these pages, an eager scan that fails to set the page + * all-frozen in the VM is considered to have "failed". This is the + * fraction of pages in the relation vacuum may scan and fail to freeze + * before disabling eager scanning. + */ +extern PGDLLIMPORT double vacuum_max_eager_freeze_failure_rate; + +/* + * Maximum value for default_statistics_target and per-column statistics + * targets. This is fairly arbitrary, mainly to prevent users from creating + * unreasonably large statistics that the system cannot handle well. + */ +#define MAX_STATISTICS_TARGET 10000 + +/* Variables for cost-based parallel vacuum */ +extern PGDLLIMPORT pg_atomic_uint32 *VacuumSharedCostBalance; +extern PGDLLIMPORT pg_atomic_uint32 *VacuumActiveNWorkers; +extern PGDLLIMPORT int VacuumCostBalanceLocal; + +extern PGDLLIMPORT bool VacuumFailsafeActive; +extern PGDLLIMPORT double vacuum_cost_delay; +extern PGDLLIMPORT int vacuum_cost_limit; + +extern PGDLLIMPORT int64 parallel_vacuum_worker_delay_ns; + +/* in commands/vacuum.c */ +extern void ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel); +extern void vacuum(List *relations, VacuumParams *params, + BufferAccessStrategy bstrategy, MemoryContext vac_context, + bool isTopLevel); +extern void vac_open_indexes(Relation relation, LOCKMODE lockmode, + int *nindexes, Relation **Irel); +extern void vac_close_indexes(int nindexes, Relation *Irel, LOCKMODE lockmode); +extern double vac_estimate_reltuples(Relation relation, + BlockNumber total_pages, + BlockNumber scanned_pages, + double scanned_tuples); +extern void vac_update_relstats(Relation relation, + BlockNumber num_pages, + double num_tuples, + BlockNumber num_all_visible_pages, + BlockNumber num_all_frozen_pages, + bool hasindex, + TransactionId frozenxid, + MultiXactId minmulti, + bool *frozenxid_updated, + bool *minmulti_updated, + bool in_outer_xact); +extern bool vacuum_get_cutoffs(Relation rel, const VacuumParams *params, + struct VacuumCutoffs *cutoffs); +extern bool vacuum_xid_failsafe_check(const struct VacuumCutoffs *cutoffs); +extern void vac_update_datfrozenxid(void); +extern void vacuum_delay_point(bool is_analyze); +extern bool vacuum_is_permitted_for_relation(Oid relid, Form_pg_class reltuple, + bits32 options); +extern Relation vacuum_open_relation(Oid relid, RangeVar *relation, + bits32 options, bool verbose, + LOCKMODE lmode); +extern IndexBulkDeleteResult *vac_bulkdel_one_index(IndexVacuumInfo *ivinfo, + IndexBulkDeleteResult *istat, + TidStore *dead_items, + VacDeadItemsInfo *dead_items_info); +extern IndexBulkDeleteResult *vac_cleanup_one_index(IndexVacuumInfo *ivinfo, + IndexBulkDeleteResult *istat); + +/* In postmaster/autovacuum.c */ +extern void AutoVacuumUpdateCostLimit(void); +extern void VacuumUpdateCosts(void); + +/* in commands/vacuumparallel.c */ +extern ParallelVacuumState *parallel_vacuum_init(Relation rel, Relation *indrels, + int nindexes, int nrequested_workers, + int vac_work_mem, int elevel, + BufferAccessStrategy bstrategy); +extern void parallel_vacuum_end(ParallelVacuumState *pvs, IndexBulkDeleteResult **istats); +extern TidStore *parallel_vacuum_get_dead_items(ParallelVacuumState *pvs, + VacDeadItemsInfo **dead_items_info_p); +extern void parallel_vacuum_reset_dead_items(ParallelVacuumState *pvs); +extern void parallel_vacuum_bulkdel_all_indexes(ParallelVacuumState *pvs, + long num_table_tuples, + int num_index_scans); +extern void parallel_vacuum_cleanup_all_indexes(ParallelVacuumState *pvs, + long num_table_tuples, + int num_index_scans, + bool estimated_count); +extern void parallel_vacuum_main(dsm_segment *seg, shm_toc *toc); + +/* in commands/analyze.c */ +extern void analyze_rel(Oid relid, RangeVar *relation, + VacuumParams *params, List *va_cols, bool in_outer_xact, + BufferAccessStrategy bstrategy); +extern bool std_typanalyze(VacAttrStats *stats); + +/* in utils/misc/sampling.c --- duplicate of declarations in utils/sampling.h */ +extern double anl_random_fract(void); +extern double anl_init_selection_state(int n); +extern double anl_get_next_S(double t, int n, double *stateptr); + +#endif /* VACUUM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/view.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/view.h new file mode 100644 index 0000000..c41f51b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/commands/view.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * view.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/view.h + * + *------------------------------------------------------------------------- + */ +#ifndef VIEW_H +#define VIEW_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern ObjectAddress DefineView(ViewStmt *stmt, const char *queryString, + int stmt_location, int stmt_len); + +extern void StoreViewQuery(Oid viewOid, Query *viewParse, bool replace); + +#endif /* VIEW_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/archive.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/archive.h new file mode 100644 index 0000000..6fed2a3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/archive.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * archive.h + * Common WAL archive routines + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/archive.h + * + *------------------------------------------------------------------------- + */ +#ifndef ARCHIVE_H +#define ARCHIVE_H + +extern char *BuildRestoreCommand(const char *restoreCommand, + const char *xlogpath, /* %p */ + const char *xlogfname, /* %f */ + const char *lastRestartPointFname); /* %r */ + +#endif /* ARCHIVE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/base64.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/base64.h new file mode 100644 index 0000000..66cb57b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/base64.h @@ -0,0 +1,19 @@ +/* + * base64.h + * Encoding and decoding routines for base64 without whitespace + * support. + * + * Portions Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/common/base64.h + */ +#ifndef BASE64_H +#define BASE64_H + +/* base 64 */ +pg_nodiscard extern int pg_b64_encode(const uint8 *src, int len, char *dst, int dstlen); +pg_nodiscard extern int pg_b64_decode(const char *src, int len, uint8 *dst, int dstlen); +extern int pg_b64_enc_len(int srclen); +extern int pg_b64_dec_len(int srclen); + +#endif /* BASE64_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/blkreftable.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/blkreftable.h new file mode 100644 index 0000000..67630d7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/blkreftable.h @@ -0,0 +1,116 @@ +/*------------------------------------------------------------------------- + * + * blkreftable.h + * Block reference tables. + * + * A block reference table is used to keep track of which blocks have + * been modified by WAL records within a certain LSN range. + * + * For each relation fork, there is a "limit block number". All existing + * blocks greater than or equal to the limit block number must be + * considered modified; for those less than the limit block number, + * we maintain a bitmap. When a relation fork is created or dropped, + * the limit block number should be set to 0. When it's truncated, + * the limit block number should be set to the length in blocks to + * which it was truncated. + * + * Portions Copyright (c) 2010-2025, PostgreSQL Global Development Group + * + * src/include/common/blkreftable.h + * + *------------------------------------------------------------------------- + */ +#ifndef BLKREFTABLE_H +#define BLKREFTABLE_H + +#include "storage/block.h" +#include "storage/relfilelocator.h" + +/* Magic number for serialization file format. */ +#define BLOCKREFTABLE_MAGIC 0x652b137b + +typedef struct BlockRefTable BlockRefTable; +typedef struct BlockRefTableEntry BlockRefTableEntry; +typedef struct BlockRefTableReader BlockRefTableReader; +typedef struct BlockRefTableWriter BlockRefTableWriter; + +/* + * The return value of io_callback_fn should be the number of bytes read + * or written. If an error occurs, the functions should report it and + * not return. When used as a write callback, short writes should be retried + * or treated as errors, so that if the callback returns, the return value + * is always the request length. + * + * report_error_fn should not return. + */ +typedef int (*io_callback_fn) (void *callback_arg, void *data, int length); +typedef void (*report_error_fn) (void *callback_arg, char *msg,...) pg_attribute_printf(2, 3); + + +/* + * Functions for manipulating an entire in-memory block reference table. + */ +extern BlockRefTable *CreateEmptyBlockRefTable(void); +extern void BlockRefTableSetLimitBlock(BlockRefTable *brtab, + const RelFileLocator *rlocator, + ForkNumber forknum, + BlockNumber limit_block); +extern void BlockRefTableMarkBlockModified(BlockRefTable *brtab, + const RelFileLocator *rlocator, + ForkNumber forknum, + BlockNumber blknum); +extern void WriteBlockRefTable(BlockRefTable *brtab, + io_callback_fn write_callback, + void *write_callback_arg); + +extern BlockRefTableEntry *BlockRefTableGetEntry(BlockRefTable *brtab, + const RelFileLocator *rlocator, + ForkNumber forknum, + BlockNumber *limit_block); +extern int BlockRefTableEntryGetBlocks(BlockRefTableEntry *entry, + BlockNumber start_blkno, + BlockNumber stop_blkno, + BlockNumber *blocks, + int nblocks); + +/* + * Functions for reading a block reference table incrementally from disk. + */ +extern BlockRefTableReader *CreateBlockRefTableReader(io_callback_fn read_callback, + void *read_callback_arg, + char *error_filename, + report_error_fn error_callback, + void *error_callback_arg); +extern bool BlockRefTableReaderNextRelation(BlockRefTableReader *reader, + RelFileLocator *rlocator, + ForkNumber *forknum, + BlockNumber *limit_block); +extern unsigned BlockRefTableReaderGetBlocks(BlockRefTableReader *reader, + BlockNumber *blocks, + int nblocks); +extern void DestroyBlockRefTableReader(BlockRefTableReader *reader); + +/* + * Functions for writing a block reference table incrementally to disk. + * + * Note that entries must be written in the proper order, that is, sorted by + * database, then tablespace, then relfilenumber, then fork number. Caller + * is responsible for supplying data in the correct order. If that seems hard, + * use an in-memory BlockRefTable instead. + */ +extern BlockRefTableWriter *CreateBlockRefTableWriter(io_callback_fn write_callback, + void *write_callback_arg); +extern void BlockRefTableWriteEntry(BlockRefTableWriter *writer, + BlockRefTableEntry *entry); +extern void DestroyBlockRefTableWriter(BlockRefTableWriter *writer); + +extern BlockRefTableEntry *CreateBlockRefTableEntry(RelFileLocator rlocator, + ForkNumber forknum); +extern void BlockRefTableEntrySetLimitBlock(BlockRefTableEntry *entry, + BlockNumber limit_block); +extern void BlockRefTableEntryMarkBlockModified(BlockRefTableEntry *entry, + ForkNumber forknum, + BlockNumber blknum); +extern void BlockRefTableFreeEntry(BlockRefTableEntry *entry); + +#endif /* BLKREFTABLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/checksum_helper.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/checksum_helper.h new file mode 100644 index 0000000..0f58d4a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/checksum_helper.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------------------- + * + * checksum_helper.h + * Compute a checksum of any of various types using common routines + * + * Portions Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/common/checksum_helper.h + * + *------------------------------------------------------------------------- + */ + +#ifndef CHECKSUM_HELPER_H +#define CHECKSUM_HELPER_H + +#include "common/cryptohash.h" +#include "common/sha2.h" +#include "port/pg_crc32c.h" + +/* + * Supported checksum types. It's not necessarily the case that code using + * these functions needs a cryptographically strong checksum; it may only + * need to detect accidental modification. That's why we include CRC-32C: it's + * much faster than any of the other algorithms. On the other hand, we omit + * MD5 here because any new that does need a cryptographically strong checksum + * should use something better. + */ +typedef enum pg_checksum_type +{ +#pragma push_macro("CHECKSUM_TYPE_NONE") +#ifdef CHECKSUM_TYPE_NONE +// winioctl.h defines CHECKSUM_TYPE_NONE to 0 as a macro. +#undef CHECKSUM_TYPE_NONE +#endif + CHECKSUM_TYPE_NONE, +#pragma pop_macro("CHECKSUM_TYPE_NONE") + CHECKSUM_TYPE_CRC32C, + CHECKSUM_TYPE_SHA224, + CHECKSUM_TYPE_SHA256, + CHECKSUM_TYPE_SHA384, + CHECKSUM_TYPE_SHA512, +} pg_checksum_type; + +/* + * This is just a union of all applicable context types. + */ +typedef union pg_checksum_raw_context +{ + pg_crc32c c_crc32c; + pg_cryptohash_ctx *c_sha2; +} pg_checksum_raw_context; + +/* + * This structure provides a convenient way to pass the checksum type and the + * checksum context around together. + */ +typedef struct pg_checksum_context +{ + pg_checksum_type type; + pg_checksum_raw_context raw_context; +} pg_checksum_context; + +/* + * This is the longest possible output for any checksum algorithm supported + * by this file. + */ +#define PG_CHECKSUM_MAX_LENGTH PG_SHA512_DIGEST_LENGTH + +extern bool pg_checksum_parse_type(char *name, pg_checksum_type *); +extern char *pg_checksum_type_name(pg_checksum_type); + +extern int pg_checksum_init(pg_checksum_context *, pg_checksum_type); +extern int pg_checksum_update(pg_checksum_context *, const uint8 *input, + size_t len); +extern int pg_checksum_final(pg_checksum_context *, uint8 *output); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/compression.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/compression.h new file mode 100644 index 0000000..640b420 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/compression.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * compression.h + * + * Shared definitions for compression methods and specifications. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/common/compression.h + *------------------------------------------------------------------------- + */ + +#ifndef PG_COMPRESSION_H +#define PG_COMPRESSION_H + +/* + * These values are stored in disk, for example in files generated by pg_dump. + * Create the necessary backwards compatibility layers if their order changes. + */ +typedef enum pg_compress_algorithm +{ + PG_COMPRESSION_NONE, + PG_COMPRESSION_GZIP, + PG_COMPRESSION_LZ4, + PG_COMPRESSION_ZSTD, +} pg_compress_algorithm; + +#define PG_COMPRESSION_OPTION_WORKERS (1 << 0) +#define PG_COMPRESSION_OPTION_LONG_DISTANCE (1 << 1) + +typedef struct pg_compress_specification +{ + pg_compress_algorithm algorithm; + unsigned options; /* OR of PG_COMPRESSION_OPTION constants */ + int level; + int workers; + bool long_distance; + char *parse_error; /* NULL if parsing was OK, else message */ +} pg_compress_specification; + +extern void parse_compress_options(const char *option, char **algorithm, + char **detail); +extern bool parse_compress_algorithm(char *name, pg_compress_algorithm *algorithm); +extern const char *get_compress_algorithm_name(pg_compress_algorithm algorithm); + +extern void parse_compress_specification(pg_compress_algorithm algorithm, + char *specification, + pg_compress_specification *result); + +extern char *validate_compress_specification(pg_compress_specification *); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/config_info.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/config_info.h new file mode 100644 index 0000000..8602774 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/config_info.h @@ -0,0 +1,21 @@ +/* + * config_info.h + * Common code for pg_config output + * + * Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/common/config_info.h + */ +#ifndef COMMON_CONFIG_INFO_H +#define COMMON_CONFIG_INFO_H + +typedef struct ConfigData +{ + char *name; + char *setting; +} ConfigData; + +extern ConfigData *get_configdata(const char *my_exec_path, + size_t *configdata_len); + +#endif /* COMMON_CONFIG_INFO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/connect.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/connect.h new file mode 100644 index 0000000..e7413c1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/connect.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * Interfaces in support of FE/BE connections. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/connect.h + * + *------------------------------------------------------------------------- + */ +#ifndef CONNECT_H +#define CONNECT_H + +/* + * This SQL statement installs an always-secure search path, so malicious + * users can't take control. CREATE of an unqualified name will fail, because + * this selects no creation schema. This does not demote pg_temp, so it is + * suitable where we control the entire FE/BE connection but not suitable in + * SECURITY DEFINER functions. This is portable to PostgreSQL 7.3, which + * introduced schemas. When connected to an older version from code that + * might work with the old server, skip this. + */ +#define ALWAYS_SECURE_SEARCH_PATH_SQL \ + "SELECT pg_catalog.set_config('search_path', '', false);" + +#endif /* CONNECT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/controldata_utils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/controldata_utils.h new file mode 100644 index 0000000..778eba1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/controldata_utils.h @@ -0,0 +1,21 @@ +/* + * controldata_utils.h + * Common code for pg_controldata output + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/controldata_utils.h + */ +#ifndef COMMON_CONTROLDATA_UTILS_H +#define COMMON_CONTROLDATA_UTILS_H + +#include "catalog/pg_control.h" + +extern ControlFileData *get_controlfile(const char *DataDir, bool *crc_ok_p); +extern ControlFileData *get_controlfile_by_exact_path(const char *ControlFilePath, + bool *crc_ok_p); +extern void update_controlfile(const char *DataDir, + ControlFileData *ControlFile, bool do_sync); + +#endif /* COMMON_CONTROLDATA_UTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/cryptohash.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/cryptohash.h new file mode 100644 index 0000000..ca103ef --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/cryptohash.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * cryptohash.h + * Generic headers for cryptographic hash functions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/common/cryptohash.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PG_CRYPTOHASH_H +#define PG_CRYPTOHASH_H + +/* Context Structures for each hash function */ +typedef enum +{ + PG_MD5 = 0, + PG_SHA1, + PG_SHA224, + PG_SHA256, + PG_SHA384, + PG_SHA512, +} pg_cryptohash_type; + +/* opaque context, private to each cryptohash implementation */ +typedef struct pg_cryptohash_ctx pg_cryptohash_ctx; + +extern pg_cryptohash_ctx *pg_cryptohash_create(pg_cryptohash_type type); +extern int pg_cryptohash_init(pg_cryptohash_ctx *ctx); +extern int pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len); +extern int pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len); +extern void pg_cryptohash_free(pg_cryptohash_ctx *ctx); +extern const char *pg_cryptohash_error(pg_cryptohash_ctx *ctx); + +#endif /* PG_CRYPTOHASH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/fe_memutils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/fe_memutils.h new file mode 100644 index 0000000..cd20528 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/fe_memutils.h @@ -0,0 +1,85 @@ +/* + * fe_memutils.h + * memory management support for frontend code + * + * Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/common/fe_memutils.h + */ +#ifndef FE_MEMUTILS_H +#define FE_MEMUTILS_H + +/* + * Assumed maximum size for allocation requests. + * + * We don't enforce this, so the actual maximum is the platform's SIZE_MAX. + * But it's useful to have it defined in frontend builds, so that common + * code can check for oversized requests without having frontend-vs-backend + * differences. Also, some code relies on MaxAllocSize being no more than + * INT_MAX/2, so rather than setting this to SIZE_MAX, make it the same as + * the backend's value. + */ +#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */ + +/* + * Flags for pg_malloc_extended and palloc_extended, deliberately named + * the same as the backend flags. + */ +#define MCXT_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) not + * actually used for frontends */ +#define MCXT_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */ +#define MCXT_ALLOC_ZERO 0x04 /* zero allocated memory */ + +/* + * "Safe" memory allocation functions --- these exit(1) on failure + * (except pg_malloc_extended with MCXT_ALLOC_NO_OOM) + */ +extern char *pg_strdup(const char *in); +extern void *pg_malloc(size_t size); +extern void *pg_malloc0(size_t size); +extern void *pg_malloc_extended(size_t size, int flags); +extern void *pg_realloc(void *ptr, size_t size); +extern void pg_free(void *ptr); + +/* + * Variants with easier notation and more type safety + */ + +/* + * Allocate space for one object of type "type" + */ +#define pg_malloc_object(type) ((type *) pg_malloc(sizeof(type))) +#define pg_malloc0_object(type) ((type *) pg_malloc0(sizeof(type))) + +/* + * Allocate space for "count" objects of type "type" + */ +#define pg_malloc_array(type, count) ((type *) pg_malloc(sizeof(type) * (count))) +#define pg_malloc0_array(type, count) ((type *) pg_malloc0(sizeof(type) * (count))) + +/* + * Change size of allocation pointed to by "pointer" to have space for "count" + * objects of type "type" + */ +#define pg_realloc_array(pointer, type, count) ((type *) pg_realloc(pointer, sizeof(type) * (count))) + +/* Equivalent functions, deliberately named the same as backend functions */ +extern char *pstrdup(const char *in); +extern char *pnstrdup(const char *in, Size size); +extern void *palloc(Size size); +extern void *palloc0(Size size); +extern void *palloc_extended(Size size, int flags); +extern void *repalloc(void *pointer, Size size); +extern void pfree(void *pointer); + +#define palloc_object(type) ((type *) palloc(sizeof(type))) +#define palloc0_object(type) ((type *) palloc0(sizeof(type))) +#define palloc_array(type, count) ((type *) palloc(sizeof(type) * (count))) +#define palloc0_array(type, count) ((type *) palloc0(sizeof(type) * (count))) +#define repalloc_array(pointer, type, count) ((type *) repalloc(pointer, sizeof(type) * (count))) + +/* sprintf into a palloc'd buffer --- these are in psprintf.c */ +extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2); +extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0); + +#endif /* FE_MEMUTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/file_perm.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/file_perm.h new file mode 100644 index 0000000..c621d82 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/file_perm.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * File and directory permission definitions + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/file_perm.h + * + *------------------------------------------------------------------------- + */ +#ifndef FILE_PERM_H +#define FILE_PERM_H + +#include + +/* + * Mode mask for data directory permissions that only allows the owner to + * read/write directories and files. + * + * This is the default. + */ +#define PG_MODE_MASK_OWNER (S_IRWXG | S_IRWXO) + +/* + * Mode mask for data directory permissions that also allows group read/execute. + */ +#define PG_MODE_MASK_GROUP (S_IWGRP | S_IRWXO) + +/* Default mode for creating directories */ +#define PG_DIR_MODE_OWNER S_IRWXU + +/* Mode for creating directories that allows group read/execute */ +#define PG_DIR_MODE_GROUP (S_IRWXU | S_IRGRP | S_IXGRP) + +/* Default mode for creating files */ +#define PG_FILE_MODE_OWNER (S_IRUSR | S_IWUSR) + +/* Mode for creating files that allows group read */ +#define PG_FILE_MODE_GROUP (S_IRUSR | S_IWUSR | S_IRGRP) + +/* Modes for creating directories and files in the data directory */ +extern PGDLLIMPORT int pg_dir_create_mode; +extern PGDLLIMPORT int pg_file_create_mode; + +/* Mode mask to pass to umask() */ +extern PGDLLIMPORT int pg_mode_mask; + +/* Set permissions and mask based on the provided mode */ +extern void SetDataDirectoryCreatePerm(int dataDirMode); + +/* Set permissions and mask based on the mode of the data directory */ +extern bool GetDataDirectoryCreatePerm(const char *dataDir); + +#endif /* FILE_PERM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/file_utils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/file_utils.h new file mode 100644 index 0000000..9fd8895 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/file_utils.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * + * Assorted utility functions to work on files. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/file_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef FILE_UTILS_H +#define FILE_UTILS_H + +#include + +typedef enum PGFileType +{ + PGFILETYPE_ERROR, + PGFILETYPE_UNKNOWN, + PGFILETYPE_REG, + PGFILETYPE_DIR, + PGFILETYPE_LNK, +} PGFileType; + +typedef enum DataDirSyncMethod +{ + DATA_DIR_SYNC_METHOD_FSYNC, + DATA_DIR_SYNC_METHOD_SYNCFS, +} DataDirSyncMethod; + +struct iovec; /* avoid including port/pg_iovec.h here */ + +#ifdef FRONTEND +extern int pre_sync_fname(const char *fname, bool isdir); +extern int fsync_fname(const char *fname, bool isdir); +extern void sync_pgdata(const char *pg_data, int serverVersion, + DataDirSyncMethod sync_method, bool sync_data_files); +extern void sync_dir_recurse(const char *dir, DataDirSyncMethod sync_method); +extern int durable_rename(const char *oldfile, const char *newfile); +extern int fsync_parent_path(const char *fname); +#endif + +extern PGFileType get_dirent_type(const char *path, + const struct dirent *de, + bool look_through_symlinks, + int elevel); + +extern int compute_remaining_iovec(struct iovec *destination, + const struct iovec *source, + int iovcnt, + size_t transferred); + +extern ssize_t pg_pwritev_with_retry(int fd, + const struct iovec *iov, + int iovcnt, + off_t offset); + +extern ssize_t pg_pwrite_zeros(int fd, size_t size, off_t offset); + +/* Filename components */ +#define PG_TEMP_FILES_DIR "pgsql_tmp" +#define PG_TEMP_FILE_PREFIX "pgsql_tmp" + +#endif /* FILE_UTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/hashfn.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/hashfn.h new file mode 100644 index 0000000..4430fb6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/hashfn.h @@ -0,0 +1,119 @@ +/* + * Utilities for working with hash values. + * + * Portions Copyright (c) 2017-2025, PostgreSQL Global Development Group + */ + +#ifndef HASHFN_H +#define HASHFN_H + + +/* + * Rotate the high 32 bits and the low 32 bits separately. The standard + * hash function sometimes rotates the low 32 bits by one bit when + * combining elements. We want extended hash functions to be compatible with + * that algorithm when the seed is 0, so we can't just do a normal rotation. + * This works, though. + */ +#define ROTATE_HIGH_AND_LOW_32BITS(v) \ + ((((v) << 1) & UINT64CONST(0xfffffffefffffffe)) | \ + (((v) >> 31) & UINT64CONST(0x100000001))) + + +extern uint32 hash_bytes(const unsigned char *k, int keylen); +extern uint64 hash_bytes_extended(const unsigned char *k, + int keylen, uint64 seed); +extern uint32 hash_bytes_uint32(uint32 k); +extern uint64 hash_bytes_uint32_extended(uint32 k, uint64 seed); + +#ifndef FRONTEND +static inline Datum +hash_any(const unsigned char *k, int keylen) +{ + return UInt32GetDatum(hash_bytes(k, keylen)); +} + +static inline Datum +hash_any_extended(const unsigned char *k, int keylen, uint64 seed) +{ + return UInt64GetDatum(hash_bytes_extended(k, keylen, seed)); +} + +static inline Datum +hash_uint32(uint32 k) +{ + return UInt32GetDatum(hash_bytes_uint32(k)); +} + +static inline Datum +hash_uint32_extended(uint32 k, uint64 seed) +{ + return UInt64GetDatum(hash_bytes_uint32_extended(k, seed)); +} +#endif + +extern uint32 string_hash(const void *key, Size keysize); +extern uint32 tag_hash(const void *key, Size keysize); +extern uint32 uint32_hash(const void *key, Size keysize); + +#define oid_hash uint32_hash /* Remove me eventually */ + +/* + * Combine two 32-bit hash values, resulting in another hash value, with + * decent bit mixing. + * + * Similar to boost's hash_combine(). + */ +static inline uint32 +hash_combine(uint32 a, uint32 b) +{ + a ^= b + 0x9e3779b9 + (a << 6) + (a >> 2); + return a; +} + +/* + * Combine two 64-bit hash values, resulting in another hash value, using the + * same kind of technique as hash_combine(). Testing shows that this also + * produces good bit mixing. + */ +static inline uint64 +hash_combine64(uint64 a, uint64 b) +{ + /* 0x49a0f4dd15e5a8e3 is 64bit random data */ + a ^= b + UINT64CONST(0x49a0f4dd15e5a8e3) + (a << 54) + (a >> 7); + return a; +} + +/* + * Simple inline murmur hash implementation hashing a 32 bit integer, for + * performance. + */ +static inline uint32 +murmurhash32(uint32 data) +{ + uint32 h = data; + + h ^= h >> 16; + h *= 0x85ebca6b; + h ^= h >> 13; + h *= 0xc2b2ae35; + h ^= h >> 16; + return h; +} + +/* 64-bit variant */ +static inline uint64 +murmurhash64(uint64 data) +{ + uint64 h = data; + + h ^= h >> 33; + h *= 0xff51afd7ed558ccd; + h ^= h >> 33; + h *= 0xc4ceb9fe1a85ec53; + h ^= h >> 33; + + return h; +} + +#endif /* HASHFN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/hashfn_unstable.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/hashfn_unstable.h new file mode 100644 index 0000000..8818a0d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/hashfn_unstable.h @@ -0,0 +1,407 @@ +/* + * hashfn_unstable.h + * + * Building blocks for creating fast inlineable hash functions. The + * functions in this file are not guaranteed to be stable between versions, + * and may differ by hardware platform. Hence they must not be used in + * indexes or other on-disk structures. See hashfn.h if you need stability. + * + * + * Portions Copyright (c) 2024-2025, PostgreSQL Global Development Group + * + * src/include/common/hashfn_unstable.h + */ +#ifndef HASHFN_UNSTABLE_H +#define HASHFN_UNSTABLE_H + + +/* + * fasthash is a modification of code taken from + * https://code.google.com/archive/p/fast-hash/source/default/source + * under the terms of the MIT license. The original copyright + * notice follows: + */ + +/* The MIT License + + Copyright (C) 2012 Zilong Tan (eric.zltan@gmail.com) + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* + * fasthash as implemented here has two interfaces: + * + * 1) Standalone functions, e.g. fasthash32() for a single value with a + * known length. These return the same hash code as the original, at + * least on little-endian machines. + * + * 2) Incremental interface. This can used for incorporating multiple + * inputs. First, initialize the hash state (here with a zero seed): + * + * fasthash_state hs; + * fasthash_init(&hs, 0); + * + * If the inputs are of types that can be trivially cast to uint64, it's + * sufficient to do: + * + * hs.accum = value1; + * fasthash_combine(&hs); + * hs.accum = value2; + * fasthash_combine(&hs); + * ... + * + * For longer or variable-length input, fasthash_accum() is a more + * flexible, but more verbose method. The standalone functions use this + * internally, so see fasthash64() for an example of this. + * + * After all inputs have been mixed in, finalize the hash: + * + * hashcode = fasthash_final32(&hs, 0); + * + * The incremental interface allows an optimization for NUL-terminated + * C strings: + * + * len = fasthash_accum_cstring(&hs, str); + * hashcode = fasthash_final32(&hs, len); + * + * By handling the terminator on-the-fly, we can avoid needing a strlen() + * call to tell us how many bytes to hash. Experimentation has found that + * SMHasher fails unless we incorporate the length, so it is passed to + * the finalizer as a tweak. + */ + + +typedef struct fasthash_state +{ + /* staging area for chunks of input */ + uint64 accum; + + uint64 hash; +} fasthash_state; + +#define FH_SIZEOF_ACCUM sizeof(uint64) + + +/* + * Initialize the hash state. + * + * 'seed' can be zero. + */ +static inline void +fasthash_init(fasthash_state *hs, uint64 seed) +{ + memset(hs, 0, sizeof(fasthash_state)); + hs->hash = seed ^ 0x880355f21e6d1965; +} + +/* both the finalizer and part of the combining step */ +static inline uint64 +fasthash_mix(uint64 h, uint64 tweak) +{ + h ^= (h >> 23) + tweak; + h *= 0x2127599bf4325c37; + h ^= h >> 47; + return h; +} + +/* combine one chunk of input into the hash */ +static inline void +fasthash_combine(fasthash_state *hs) +{ + hs->hash ^= fasthash_mix(hs->accum, 0); + hs->hash *= 0x880355f21e6d1965; +} + +/* accumulate up to 8 bytes of input and combine it into the hash */ +static inline void +fasthash_accum(fasthash_state *hs, const char *k, size_t len) +{ + uint32 lower_four; + + Assert(len <= FH_SIZEOF_ACCUM); + hs->accum = 0; + + /* + * For consistency, bytewise loads must match the platform's endianness. + */ +#ifdef WORDS_BIGENDIAN + switch (len) + { + case 8: + memcpy(&hs->accum, k, 8); + break; + case 7: + hs->accum |= (uint64) k[6] << 8; + /* FALLTHROUGH */ + case 6: + hs->accum |= (uint64) k[5] << 16; + /* FALLTHROUGH */ + case 5: + hs->accum |= (uint64) k[4] << 24; + /* FALLTHROUGH */ + case 4: + memcpy(&lower_four, k, sizeof(lower_four)); + hs->accum |= (uint64) lower_four << 32; + break; + case 3: + hs->accum |= (uint64) k[2] << 40; + /* FALLTHROUGH */ + case 2: + hs->accum |= (uint64) k[1] << 48; + /* FALLTHROUGH */ + case 1: + hs->accum |= (uint64) k[0] << 56; + break; + case 0: + return; + } +#else + switch (len) + { + case 8: + memcpy(&hs->accum, k, 8); + break; + case 7: + hs->accum |= (uint64) k[6] << 48; + /* FALLTHROUGH */ + case 6: + hs->accum |= (uint64) k[5] << 40; + /* FALLTHROUGH */ + case 5: + hs->accum |= (uint64) k[4] << 32; + /* FALLTHROUGH */ + case 4: + memcpy(&lower_four, k, sizeof(lower_four)); + hs->accum |= lower_four; + break; + case 3: + hs->accum |= (uint64) k[2] << 16; + /* FALLTHROUGH */ + case 2: + hs->accum |= (uint64) k[1] << 8; + /* FALLTHROUGH */ + case 1: + hs->accum |= (uint64) k[0]; + break; + case 0: + return; + } +#endif + + fasthash_combine(hs); +} + +/* + * Set high bit in lowest byte where the input is zero, from: + * https://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord + */ +#define haszero64(v) \ + (((v) - 0x0101010101010101) & ~(v) & 0x8080808080808080) + +/* + * all-purpose workhorse for fasthash_accum_cstring + */ +static inline size_t +fasthash_accum_cstring_unaligned(fasthash_state *hs, const char *str) +{ + const char *const start = str; + + while (*str) + { + size_t chunk_len = 0; + + while (chunk_len < FH_SIZEOF_ACCUM && str[chunk_len] != '\0') + chunk_len++; + + fasthash_accum(hs, str, chunk_len); + str += chunk_len; + } + + return str - start; +} + +/* + * specialized workhorse for fasthash_accum_cstring + * + * With an aligned pointer, we consume the string a word at a time. + * Loading the word containing the NUL terminator cannot segfault since + * allocation boundaries are suitably aligned. To keep from setting + * off alarms with address sanitizers, exclude this function from + * such testing. + */ +pg_attribute_no_sanitize_address() +static inline size_t +fasthash_accum_cstring_aligned(fasthash_state *hs, const char *str) +{ + const char *const start = str; + size_t remainder; + uint64 zero_byte_low; + + Assert(PointerIsAligned(start, uint64)); + + /* + * For every chunk of input, check for zero bytes before mixing into the + * hash. The chunk with zeros must contain the NUL terminator. + */ + for (;;) + { + uint64 chunk = *(uint64 *) str; + + zero_byte_low = haszero64(chunk); + if (zero_byte_low) + break; + + hs->accum = chunk; + fasthash_combine(hs); + str += FH_SIZEOF_ACCUM; + } + + /* mix in remaining bytes */ + remainder = fasthash_accum_cstring_unaligned(hs, str); + str += remainder; + + return str - start; +} + +/* + * Mix 'str' into the hash state and return the length of the string. + */ +static inline size_t +fasthash_accum_cstring(fasthash_state *hs, const char *str) +{ +#if SIZEOF_VOID_P >= 8 + + size_t len; +#ifdef USE_ASSERT_CHECKING + size_t len_check; + fasthash_state hs_check; + + memcpy(&hs_check, hs, sizeof(fasthash_state)); + len_check = fasthash_accum_cstring_unaligned(&hs_check, str); +#endif + if (PointerIsAligned(str, uint64)) + { + len = fasthash_accum_cstring_aligned(hs, str); + Assert(len_check == len); + Assert(hs_check.hash == hs->hash); + return len; + } +#endif /* SIZEOF_VOID_P */ + + /* + * It's not worth it to try to make the word-at-a-time optimization work + * on 32-bit platforms. + */ + return fasthash_accum_cstring_unaligned(hs, str); +} + +/* + * The finalizer + * + * 'tweak' is intended to be the input length when the caller doesn't know + * the length ahead of time, such as for NUL-terminated strings, otherwise + * zero. + */ +static inline uint64 +fasthash_final64(fasthash_state *hs, uint64 tweak) +{ + return fasthash_mix(hs->hash, tweak); +} + +/* + * Reduce a 64-bit hash to a 32-bit hash. + * + * This optional step provides a bit more additional mixing compared to + * just taking the lower 32-bits. + */ +static inline uint32 +fasthash_reduce32(uint64 h) +{ + /* + * Convert the 64-bit hashcode to Fermat residue, which shall retain + * information from both the higher and lower parts of hashcode. + */ + return h - (h >> 32); +} + +/* finalize and reduce */ +static inline uint32 +fasthash_final32(fasthash_state *hs, uint64 tweak) +{ + return fasthash_reduce32(fasthash_final64(hs, tweak)); +} + +/* + * The original fasthash64 function, re-implemented using the incremental + * interface. Returns a 64-bit hashcode. 'len' controls not only how + * many bytes to hash, but also modifies the internal seed. + * 'seed' can be zero. + */ +static inline uint64 +fasthash64(const char *k, size_t len, uint64 seed) +{ + fasthash_state hs; + + fasthash_init(&hs, 0); + + /* re-initialize the seed according to input length */ + hs.hash = seed ^ (len * 0x880355f21e6d1965); + + while (len >= FH_SIZEOF_ACCUM) + { + fasthash_accum(&hs, k, FH_SIZEOF_ACCUM); + k += FH_SIZEOF_ACCUM; + len -= FH_SIZEOF_ACCUM; + } + + fasthash_accum(&hs, k, len); + return fasthash_final64(&hs, 0); +} + +/* like fasthash64, but returns a 32-bit hashcode */ +static inline uint32 +fasthash32(const char *k, size_t len, uint64 seed) +{ + return fasthash_reduce32(fasthash64(k, len, seed)); +} + +/* + * Convenience function for hashing NUL-terminated strings + */ +static inline uint32 +hash_string(const char *s) +{ + fasthash_state hs; + size_t s_len; + + fasthash_init(&hs, 0); + + /* + * Combine string into the hash and save the length for tweaking the final + * mix. + */ + s_len = fasthash_accum_cstring(&hs, s); + + return fasthash_final32(&hs, s_len); +} + +#endif /* HASHFN_UNSTABLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/hmac.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/hmac.h new file mode 100644 index 0000000..c4d069e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/hmac.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * hmac.h + * Generic headers for HMAC + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/common/hmac.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PG_HMAC_H +#define PG_HMAC_H + +#include "common/cryptohash.h" + +/* opaque context, private to each HMAC implementation */ +typedef struct pg_hmac_ctx pg_hmac_ctx; + +extern pg_hmac_ctx *pg_hmac_create(pg_cryptohash_type type); +extern int pg_hmac_init(pg_hmac_ctx *ctx, const uint8 *key, size_t len); +extern int pg_hmac_update(pg_hmac_ctx *ctx, const uint8 *data, size_t len); +extern int pg_hmac_final(pg_hmac_ctx *ctx, uint8 *dest, size_t len); +extern void pg_hmac_free(pg_hmac_ctx *ctx); +extern const char *pg_hmac_error(pg_hmac_ctx *ctx); + +#endif /* PG_HMAC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/int.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/int.h new file mode 100644 index 0000000..3973f13 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/int.h @@ -0,0 +1,675 @@ +/*------------------------------------------------------------------------- + * + * int.h + * Overflow-aware integer math and integer comparison routines. + * + * The routines in this file are intended to be well defined C, without + * relying on compiler flags like -fwrapv. + * + * To reduce the overhead of these routines try to use compiler intrinsics + * where available. That's not that important for the 16, 32 bit cases, but + * the 64 bit cases can be considerably faster with intrinsics. In case no + * intrinsics are available 128 bit math is used where available. + * + * Copyright (c) 2017-2025, PostgreSQL Global Development Group + * + * src/include/common/int.h + * + *------------------------------------------------------------------------- + */ +#ifndef COMMON_INT_H +#define COMMON_INT_H + + +/*--------- + * The following guidelines apply to all the overflow routines: + * + * If the result overflows, return true, otherwise store the result into + * *result. The content of *result is implementation defined in case of + * overflow. + * + * bool pg_add_*_overflow(a, b, *result) + * + * Calculate a + b + * + * bool pg_sub_*_overflow(a, b, *result) + * + * Calculate a - b + * + * bool pg_mul_*_overflow(a, b, *result) + * + * Calculate a * b + * + * bool pg_neg_*_overflow(a, *result) + * + * Calculate -a + * + * + * In addition, this file contains: + * + * pg_abs_*( a) + * + * Calculate absolute value of a. Unlike the standard library abs() + * and labs() functions, the return type is unsigned, so the operation + * cannot overflow. + *--------- + */ + +/*------------------------------------------------------------------------ + * Overflow routines for signed integers + *------------------------------------------------------------------------ + */ + +/* + * INT16 + */ +static inline bool +pg_add_s16_overflow(int16 a, int16 b, int16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + int32 res = (int32) a + (int32) b; + + if (res > PG_INT16_MAX || res < PG_INT16_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int16) res; + return false; +#endif +} + +static inline bool +pg_sub_s16_overflow(int16 a, int16 b, int16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + int32 res = (int32) a - (int32) b; + + if (res > PG_INT16_MAX || res < PG_INT16_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int16) res; + return false; +#endif +} + +static inline bool +pg_mul_s16_overflow(int16 a, int16 b, int16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#else + int32 res = (int32) a * (int32) b; + + if (res > PG_INT16_MAX || res < PG_INT16_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int16) res; + return false; +#endif +} + +static inline bool +pg_neg_s16_overflow(int16 a, int16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(0, a, result); +#else + if (unlikely(a == PG_INT16_MIN)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = -a; + return false; +#endif +} + +static inline uint16 +pg_abs_s16(int16 a) +{ + /* + * This first widens the argument from int16 to int32 for use with abs(). + * The result is then narrowed from int32 to uint16. This prevents any + * possibility of overflow. + */ + return (uint16) abs((int32) a); +} + +/* + * INT32 + */ +static inline bool +pg_add_s32_overflow(int32 a, int32 b, int32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + int64 res = (int64) a + (int64) b; + + if (res > PG_INT32_MAX || res < PG_INT32_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int32) res; + return false; +#endif +} + +static inline bool +pg_sub_s32_overflow(int32 a, int32 b, int32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + int64 res = (int64) a - (int64) b; + + if (res > PG_INT32_MAX || res < PG_INT32_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int32) res; + return false; +#endif +} + +static inline bool +pg_mul_s32_overflow(int32 a, int32 b, int32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#else + int64 res = (int64) a * (int64) b; + + if (res > PG_INT32_MAX || res < PG_INT32_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int32) res; + return false; +#endif +} + +static inline bool +pg_neg_s32_overflow(int32 a, int32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(0, a, result); +#else + if (unlikely(a == PG_INT32_MIN)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = -a; + return false; +#endif +} + +static inline uint32 +pg_abs_s32(int32 a) +{ + /* + * This first widens the argument from int32 to int64 for use with + * i64abs(). The result is then narrowed from int64 to uint32. This + * prevents any possibility of overflow. + */ + return (uint32) i64abs((int64) a); +} + +/* + * INT64 + */ +static inline bool +pg_add_s64_overflow(int64 a, int64 b, int64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#elif defined(HAVE_INT128) + int128 res = (int128) a + (int128) b; + + if (res > PG_INT64_MAX || res < PG_INT64_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int64) res; + return false; +#else + if ((a > 0 && b > 0 && a > PG_INT64_MAX - b) || + (a < 0 && b < 0 && a < PG_INT64_MIN - b)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a + b; + return false; +#endif +} + +static inline bool +pg_sub_s64_overflow(int64 a, int64 b, int64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#elif defined(HAVE_INT128) + int128 res = (int128) a - (int128) b; + + if (res > PG_INT64_MAX || res < PG_INT64_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int64) res; + return false; +#else + /* + * Note: overflow is also possible when a == 0 and b < 0 (specifically, + * when b == PG_INT64_MIN). + */ + if ((a < 0 && b > 0 && a < PG_INT64_MIN + b) || + (a >= 0 && b < 0 && a > PG_INT64_MAX + b)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a - b; + return false; +#endif +} + +static inline bool +pg_mul_s64_overflow(int64 a, int64 b, int64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#elif defined(HAVE_INT128) + int128 res = (int128) a * (int128) b; + + if (res > PG_INT64_MAX || res < PG_INT64_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int64) res; + return false; +#else + /* + * Overflow can only happen if at least one value is outside the range + * sqrt(min)..sqrt(max) so check that first as the division can be quite a + * bit more expensive than the multiplication. + * + * Multiplying by 0 or 1 can't overflow of course and checking for 0 + * separately avoids any risk of dividing by 0. Be careful about dividing + * INT_MIN by -1 also, note reversing the a and b to ensure we're always + * dividing it by a positive value. + * + */ + if ((a > PG_INT32_MAX || a < PG_INT32_MIN || + b > PG_INT32_MAX || b < PG_INT32_MIN) && + a != 0 && a != 1 && b != 0 && b != 1 && + ((a > 0 && b > 0 && a > PG_INT64_MAX / b) || + (a > 0 && b < 0 && b < PG_INT64_MIN / a) || + (a < 0 && b > 0 && a < PG_INT64_MIN / b) || + (a < 0 && b < 0 && a < PG_INT64_MAX / b))) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a * b; + return false; +#endif +} + +static inline bool +pg_neg_s64_overflow(int64 a, int64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(0, a, result); +#else + if (unlikely(a == PG_INT64_MIN)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = -a; + return false; +#endif +} + +static inline uint64 +pg_abs_s64(int64 a) +{ + if (unlikely(a == PG_INT64_MIN)) + return (uint64) PG_INT64_MAX + 1; + return (uint64) i64abs(a); +} + +/*------------------------------------------------------------------------ + * Overflow routines for unsigned integers + *------------------------------------------------------------------------ + */ + +/* + * UINT16 + */ +static inline bool +pg_add_u16_overflow(uint16 a, uint16 b, uint16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + uint16 res = a + b; + + if (res < a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +static inline bool +pg_sub_u16_overflow(uint16 a, uint16 b, uint16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + if (b > a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a - b; + return false; +#endif +} + +static inline bool +pg_mul_u16_overflow(uint16 a, uint16 b, uint16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#else + uint32 res = (uint32) a * (uint32) b; + + if (res > PG_UINT16_MAX) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (uint16) res; + return false; +#endif +} + +static inline bool +pg_neg_u16_overflow(uint16 a, int16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(0, a, result); +#else + int32 res = -((int32) a); + + if (unlikely(res < PG_INT16_MIN)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +/* + * INT32 + */ +static inline bool +pg_add_u32_overflow(uint32 a, uint32 b, uint32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + uint32 res = a + b; + + if (res < a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +static inline bool +pg_sub_u32_overflow(uint32 a, uint32 b, uint32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + if (b > a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a - b; + return false; +#endif +} + +static inline bool +pg_mul_u32_overflow(uint32 a, uint32 b, uint32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#else + uint64 res = (uint64) a * (uint64) b; + + if (res > PG_UINT32_MAX) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (uint32) res; + return false; +#endif +} + +static inline bool +pg_neg_u32_overflow(uint32 a, int32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(0, a, result); +#else + int64 res = -((int64) a); + + if (unlikely(res < PG_INT32_MIN)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +/* + * UINT64 + */ +static inline bool +pg_add_u64_overflow(uint64 a, uint64 b, uint64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + uint64 res = a + b; + + if (res < a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +static inline bool +pg_sub_u64_overflow(uint64 a, uint64 b, uint64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + if (b > a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a - b; + return false; +#endif +} + +static inline bool +pg_mul_u64_overflow(uint64 a, uint64 b, uint64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#elif defined(HAVE_INT128) + uint128 res = (uint128) a * (uint128) b; + + if (res > PG_UINT64_MAX) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (uint64) res; + return false; +#else + uint64 res = a * b; + + if (a != 0 && b != res / a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +static inline bool +pg_neg_u64_overflow(uint64 a, int64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(0, a, result); +#elif defined(HAVE_INT128) + int128 res = -((int128) a); + + if (unlikely(res < PG_INT64_MIN)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#else + if (unlikely(a > (uint64) PG_INT64_MAX + 1)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + if (unlikely(a == (uint64) PG_INT64_MAX + 1)) + *result = PG_INT64_MIN; + else + *result = -((int64) a); + return false; +#endif +} + +/*------------------------------------------------------------------------ + * + * Comparison routines for integer types. + * + * These routines are primarily intended for use in qsort() comparator + * functions and therefore return a positive integer, 0, or a negative + * integer depending on whether "a" is greater than, equal to, or less + * than "b", respectively. These functions are written to be as efficient + * as possible without introducing overflow risks, thereby helping ensure + * the comparators that use them are transitive. + * + * Types with fewer than 32 bits are cast to signed integers and + * subtracted. Other types are compared using > and <, and the results of + * those comparisons (which are either (int) 0 or (int) 1 per the C + * standard) are subtracted. + * + * NB: If the comparator function is inlined, some compilers may produce + * worse code with these helper functions than with code with the + * following form: + * + * if (a < b) + * return -1; + * if (a > b) + * return 1; + * return 0; + * + *------------------------------------------------------------------------ + */ + +static inline int +pg_cmp_s16(int16 a, int16 b) +{ + return (int32) a - (int32) b; +} + +static inline int +pg_cmp_u16(uint16 a, uint16 b) +{ + return (int32) a - (int32) b; +} + +static inline int +pg_cmp_s32(int32 a, int32 b) +{ + return (a > b) - (a < b); +} + +static inline int +pg_cmp_u32(uint32 a, uint32 b) +{ + return (a > b) - (a < b); +} + +static inline int +pg_cmp_s64(int64 a, int64 b) +{ + return (a > b) - (a < b); +} + +static inline int +pg_cmp_u64(uint64 a, uint64 b) +{ + return (a > b) - (a < b); +} + +static inline int +pg_cmp_size(size_t a, size_t b) +{ + return (a > b) - (a < b); +} + +#endif /* COMMON_INT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/int128.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/int128.h new file mode 100644 index 0000000..a50f570 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/int128.h @@ -0,0 +1,276 @@ +/*------------------------------------------------------------------------- + * + * int128.h + * Roll-our-own 128-bit integer arithmetic. + * + * We make use of the native int128 type if there is one, otherwise + * implement things the hard way based on two int64 halves. + * + * See src/tools/testint128.c for a simple test harness for this file. + * + * Copyright (c) 2017-2025, PostgreSQL Global Development Group + * + * src/include/common/int128.h + * + *------------------------------------------------------------------------- + */ +#ifndef INT128_H +#define INT128_H + +/* + * For testing purposes, use of native int128 can be switched on/off by + * predefining USE_NATIVE_INT128. + */ +#ifndef USE_NATIVE_INT128 +#ifdef HAVE_INT128 +#define USE_NATIVE_INT128 1 +#else +#define USE_NATIVE_INT128 0 +#endif +#endif + + +#if USE_NATIVE_INT128 + +typedef int128 INT128; + +/* + * Add an unsigned int64 value into an INT128 variable. + */ +static inline void +int128_add_uint64(INT128 *i128, uint64 v) +{ + *i128 += v; +} + +/* + * Add a signed int64 value into an INT128 variable. + */ +static inline void +int128_add_int64(INT128 *i128, int64 v) +{ + *i128 += v; +} + +/* + * Add the 128-bit product of two int64 values into an INT128 variable. + * + * XXX with a stupid compiler, this could actually be less efficient than + * the other implementation; maybe we should do it by hand always? + */ +static inline void +int128_add_int64_mul_int64(INT128 *i128, int64 x, int64 y) +{ + *i128 += (int128) x * (int128) y; +} + +/* + * Compare two INT128 values, return -1, 0, or +1. + */ +static inline int +int128_compare(INT128 x, INT128 y) +{ + if (x < y) + return -1; + if (x > y) + return 1; + return 0; +} + +/* + * Widen int64 to INT128. + */ +static inline INT128 +int64_to_int128(int64 v) +{ + return (INT128) v; +} + +/* + * Convert INT128 to int64 (losing any high-order bits). + * This also works fine for casting down to uint64. + */ +static inline int64 +int128_to_int64(INT128 val) +{ + return (int64) val; +} + +#else /* !USE_NATIVE_INT128 */ + +/* + * We lay out the INT128 structure with the same content and byte ordering + * that a native int128 type would (probably) have. This makes no difference + * for ordinary use of INT128, but allows union'ing INT128 with int128 for + * testing purposes. + */ +typedef struct +{ +#ifdef WORDS_BIGENDIAN + int64 hi; /* most significant 64 bits, including sign */ + uint64 lo; /* least significant 64 bits, without sign */ +#else + uint64 lo; /* least significant 64 bits, without sign */ + int64 hi; /* most significant 64 bits, including sign */ +#endif +} INT128; + +/* + * Add an unsigned int64 value into an INT128 variable. + */ +static inline void +int128_add_uint64(INT128 *i128, uint64 v) +{ + /* + * First add the value to the .lo part, then check to see if a carry needs + * to be propagated into the .hi part. A carry is needed if both inputs + * have high bits set, or if just one input has high bit set while the new + * .lo part doesn't. Remember that .lo part is unsigned; we cast to + * signed here just as a cheap way to check the high bit. + */ + uint64 oldlo = i128->lo; + + i128->lo += v; + if (((int64) v < 0 && (int64) oldlo < 0) || + (((int64) v < 0 || (int64) oldlo < 0) && (int64) i128->lo >= 0)) + i128->hi++; +} + +/* + * Add a signed int64 value into an INT128 variable. + */ +static inline void +int128_add_int64(INT128 *i128, int64 v) +{ + /* + * This is much like the above except that the carry logic differs for + * negative v. Ordinarily we'd need to subtract 1 from the .hi part + * (corresponding to adding the sign-extended bits of v to it); but if + * there is a carry out of the .lo part, that cancels and we do nothing. + */ + uint64 oldlo = i128->lo; + + i128->lo += v; + if (v >= 0) + { + if ((int64) oldlo < 0 && (int64) i128->lo >= 0) + i128->hi++; + } + else + { + if (!((int64) oldlo < 0 || (int64) i128->lo >= 0)) + i128->hi--; + } +} + +/* + * INT64_AU32 extracts the most significant 32 bits of int64 as int64, while + * INT64_AL32 extracts the least significant 32 bits as uint64. + */ +#define INT64_AU32(i64) ((i64) >> 32) +#define INT64_AL32(i64) ((i64) & UINT64CONST(0xFFFFFFFF)) + +/* + * Add the 128-bit product of two int64 values into an INT128 variable. + */ +static inline void +int128_add_int64_mul_int64(INT128 *i128, int64 x, int64 y) +{ + /* INT64_AU32 must use arithmetic right shift */ + StaticAssertDecl(((int64) -1 >> 1) == (int64) -1, + "arithmetic right shift is needed"); + + /*---------- + * Form the 128-bit product x * y using 64-bit arithmetic. + * Considering each 64-bit input as having 32-bit high and low parts, + * we can compute + * + * x * y = ((x.hi << 32) + x.lo) * (((y.hi << 32) + y.lo) + * = (x.hi * y.hi) << 64 + + * (x.hi * y.lo) << 32 + + * (x.lo * y.hi) << 32 + + * x.lo * y.lo + * + * Each individual product is of 32-bit terms so it won't overflow when + * computed in 64-bit arithmetic. Then we just have to shift it to the + * correct position while adding into the 128-bit result. We must also + * keep in mind that the "lo" parts must be treated as unsigned. + *---------- + */ + + /* No need to work hard if product must be zero */ + if (x != 0 && y != 0) + { + int64 x_u32 = INT64_AU32(x); + uint64 x_l32 = INT64_AL32(x); + int64 y_u32 = INT64_AU32(y); + uint64 y_l32 = INT64_AL32(y); + int64 tmp; + + /* the first term */ + i128->hi += x_u32 * y_u32; + + /* the second term: sign-extend it only if x is negative */ + tmp = x_u32 * y_l32; + if (x < 0) + i128->hi += INT64_AU32(tmp); + else + i128->hi += ((uint64) tmp) >> 32; + int128_add_uint64(i128, ((uint64) INT64_AL32(tmp)) << 32); + + /* the third term: sign-extend it only if y is negative */ + tmp = x_l32 * y_u32; + if (y < 0) + i128->hi += INT64_AU32(tmp); + else + i128->hi += ((uint64) tmp) >> 32; + int128_add_uint64(i128, ((uint64) INT64_AL32(tmp)) << 32); + + /* the fourth term: always unsigned */ + int128_add_uint64(i128, x_l32 * y_l32); + } +} + +/* + * Compare two INT128 values, return -1, 0, or +1. + */ +static inline int +int128_compare(INT128 x, INT128 y) +{ + if (x.hi < y.hi) + return -1; + if (x.hi > y.hi) + return 1; + if (x.lo < y.lo) + return -1; + if (x.lo > y.lo) + return 1; + return 0; +} + +/* + * Widen int64 to INT128. + */ +static inline INT128 +int64_to_int128(int64 v) +{ + INT128 val; + + val.lo = (uint64) v; + val.hi = (v < 0) ? -INT64CONST(1) : INT64CONST(0); + return val; +} + +/* + * Convert INT128 to int64 (losing any high-order bits). + * This also works fine for casting down to uint64. + */ +static inline int64 +int128_to_int64(INT128 val) +{ + return (int64) val.lo; +} + +#endif /* USE_NATIVE_INT128 */ + +#endif /* INT128_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/ip.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/ip.h new file mode 100644 index 0000000..8eeae21 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/ip.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * ip.h + * Definitions for IPv6-aware network access. + * + * These definitions are used by both frontend and backend code. + * + * Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/common/ip.h + * + *------------------------------------------------------------------------- + */ +#ifndef IP_H +#define IP_H + +#include +#include + +#include "libpq/pqcomm.h" + + +extern int pg_getaddrinfo_all(const char *hostname, const char *servname, + const struct addrinfo *hintp, + struct addrinfo **result); +extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo *ai); + +extern int pg_getnameinfo_all(const struct sockaddr_storage *addr, int salen, + char *node, int nodelen, + char *service, int servicelen, + int flags); + +#endif /* IP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/jsonapi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/jsonapi.h new file mode 100644 index 0000000..5d1a3ef --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/jsonapi.h @@ -0,0 +1,267 @@ +/*------------------------------------------------------------------------- + * + * jsonapi.h + * Declarations for JSON API support. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/jsonapi.h + * + *------------------------------------------------------------------------- + */ + +#ifndef JSONAPI_H +#define JSONAPI_H + +typedef enum JsonTokenType +{ + JSON_TOKEN_INVALID, + JSON_TOKEN_STRING, + JSON_TOKEN_NUMBER, + JSON_TOKEN_OBJECT_START, + JSON_TOKEN_OBJECT_END, + JSON_TOKEN_ARRAY_START, + JSON_TOKEN_ARRAY_END, + JSON_TOKEN_COMMA, + JSON_TOKEN_COLON, + JSON_TOKEN_TRUE, + JSON_TOKEN_FALSE, + JSON_TOKEN_NULL, + JSON_TOKEN_END, +} JsonTokenType; + +typedef enum JsonParseErrorType +{ + JSON_SUCCESS, + JSON_INCOMPLETE, + JSON_INVALID_LEXER_TYPE, + JSON_NESTING_TOO_DEEP, + JSON_ESCAPING_INVALID, + JSON_ESCAPING_REQUIRED, + JSON_EXPECTED_ARRAY_FIRST, + JSON_EXPECTED_ARRAY_NEXT, + JSON_EXPECTED_COLON, + JSON_EXPECTED_END, + JSON_EXPECTED_JSON, + JSON_EXPECTED_MORE, + JSON_EXPECTED_OBJECT_FIRST, + JSON_EXPECTED_OBJECT_NEXT, + JSON_EXPECTED_STRING, + JSON_INVALID_TOKEN, + JSON_OUT_OF_MEMORY, + JSON_UNICODE_CODE_POINT_ZERO, + JSON_UNICODE_ESCAPE_FORMAT, + JSON_UNICODE_HIGH_ESCAPE, + JSON_UNICODE_UNTRANSLATABLE, + JSON_UNICODE_HIGH_SURROGATE, + JSON_UNICODE_LOW_SURROGATE, + JSON_SEM_ACTION_FAILED, /* error should already be reported */ +} JsonParseErrorType; + +/* Parser state private to jsonapi.c */ +typedef struct JsonParserStack JsonParserStack; +typedef struct JsonIncrementalState JsonIncrementalState; + +/* + * Don't depend on the internal type header for strval; if callers need access + * then they can include the appropriate header themselves. + */ +#ifdef JSONAPI_USE_PQEXPBUFFER +#define jsonapi_StrValType PQExpBufferData +#else +#define jsonapi_StrValType StringInfoData +#endif + +/* + * All the fields in this structure should be treated as read-only. + * + * If strval is not null, then it should contain the de-escaped value + * of the lexeme if it's a string. Otherwise most of these field names + * should be self-explanatory. + * + * line_number and line_start are principally for use by the parser's + * error reporting routines. + * token_terminator and prev_token_terminator point to the character + * AFTER the end of the token, i.e. where there would be a nul byte + * if we were using nul-terminated strings. + * + * The prev_token_terminator field should not be used when incremental is + * true, as the previous token might have started in a previous piece of input, + * and thus it can't be used in any pointer arithmetic or other operations in + * conjunction with token_start. + * + * JSONLEX_FREE_STRUCT/STRVAL are used to drive freeJsonLexContext. + * JSONLEX_CTX_OWNS_TOKENS is used by setJsonLexContextOwnsTokens. + */ +#define JSONLEX_FREE_STRUCT (1 << 0) +#define JSONLEX_FREE_STRVAL (1 << 1) +#define JSONLEX_CTX_OWNS_TOKENS (1 << 2) +typedef struct JsonLexContext +{ + const char *input; + size_t input_length; + int input_encoding; + const char *token_start; + const char *token_terminator; + const char *prev_token_terminator; + bool incremental; + JsonTokenType token_type; + int lex_level; + bits32 flags; + int line_number; /* line number, starting from 1 */ + const char *line_start; /* where that line starts within input */ + JsonParserStack *pstack; + JsonIncrementalState *inc_state; + bool need_escapes; + struct jsonapi_StrValType *strval; /* only used if need_escapes == true */ + struct jsonapi_StrValType *errormsg; +} JsonLexContext; + +/* + * Function types for custom json parsing actions. + * + * fname will be NULL if the context has need_escapes=false, as will token for + * string type values. + */ +typedef JsonParseErrorType (*json_struct_action) (void *state); +typedef JsonParseErrorType (*json_ofield_action) (void *state, char *fname, bool isnull); +typedef JsonParseErrorType (*json_aelem_action) (void *state, bool isnull); +typedef JsonParseErrorType (*json_scalar_action) (void *state, char *token, JsonTokenType tokentype); + + +/* + * Semantic Action structure for use in parsing json. + * + * Any of these actions can be NULL, in which case nothing is done at that + * point, Likewise, semstate can be NULL. Using an all-NULL structure amounts + * to doing a pure parse with no side-effects, and is therefore exactly + * what the json input routines do. + * + * By default, the 'fname' and 'token' strings passed to these actions are + * palloc'd. They are not free'd or used further by the parser, so the action + * function is free to do what it wishes with them. This behavior may be + * modified by setJsonLexContextOwnsTokens(). + * + * All action functions return JsonParseErrorType. If the result isn't + * JSON_SUCCESS, the parse is abandoned and that error code is returned. + * If it is JSON_SEM_ACTION_FAILED, the action function is responsible + * for having reported the error in some appropriate way. + */ +typedef struct JsonSemAction +{ + void *semstate; + json_struct_action object_start; + json_struct_action object_end; + json_struct_action array_start; + json_struct_action array_end; + json_ofield_action object_field_start; + json_ofield_action object_field_end; + json_aelem_action array_element_start; + json_aelem_action array_element_end; + json_scalar_action scalar; +} JsonSemAction; + +/* + * pg_parse_json will parse the string in the lex calling the + * action functions in sem at the appropriate points. It is + * up to them to keep what state they need in semstate. If they + * need access to the state of the lexer, then its pointer + * should be passed to them as a member of whatever semstate + * points to. If the action pointers are NULL the parser + * does nothing and just continues. + */ +extern JsonParseErrorType pg_parse_json(JsonLexContext *lex, + const JsonSemAction *sem); + +extern JsonParseErrorType pg_parse_json_incremental(JsonLexContext *lex, + const JsonSemAction *sem, + const char *json, + size_t len, + bool is_last); + +/* the null action object used for pure validation */ +extern PGDLLIMPORT const JsonSemAction nullSemAction; + +/* + * json_count_array_elements performs a fast secondary parse to determine the + * number of elements in passed array lex context. It should be called from an + * array_start action. + * + * The return value indicates whether any error occurred, while the number + * of elements is stored into *elements (but only if the return value is + * JSON_SUCCESS). + */ +extern JsonParseErrorType json_count_array_elements(JsonLexContext *lex, + int *elements); + +/* + * initializer for JsonLexContext. + * + * If a valid 'lex' pointer is given, it is initialized. This can be used + * for stack-allocated structs, saving overhead. If NULL is given, a new + * struct is allocated. + * + * If need_escapes is true, ->strval stores the unescaped lexemes. + * + * Setting need_escapes to true is necessary if the operation needs + * to reference field names or scalar string values. This is true of most + * operations beyond purely checking the json-validity of the source + * document. + * + * Unescaping is expensive, so only request it when necessary. + * + * If need_escapes is true or lex was given as NULL, then the caller is + * responsible for freeing the returned struct, either by calling + * freeJsonLexContext() or (in backends) via memory context cleanup. + */ +extern JsonLexContext *makeJsonLexContextCstringLen(JsonLexContext *lex, + const char *json, + size_t len, + int encoding, + bool need_escapes); + +/* + * make a JsonLexContext suitable for incremental parsing. + * the string chunks will be handed to pg_parse_json_incremental, + * so there's no need for them here. + */ +extern JsonLexContext *makeJsonLexContextIncremental(JsonLexContext *lex, + int encoding, + bool need_escapes); + +/* + * Sets whether tokens passed to semantic action callbacks are owned by the + * context (in which case, the callback must duplicate the tokens for long-term + * storage) or by the callback (in which case, the callback must explicitly + * free tokens to avoid leaks). + * + * By default, this setting is false: the callback owns the tokens that are + * passed to it (and if parsing fails between the two object-field callbacks, + * the field name token will likely leak). If set to true, tokens will be freed + * by the lexer after the callback completes. + * + * Setting this to true is important for long-lived clients (such as libpq) + * that must not leak memory during a parse failure. For a server backend using + * memory contexts, or a client application which will exit on parse failure, + * this setting is less critical. + */ +extern void setJsonLexContextOwnsTokens(JsonLexContext *lex, + bool owned_by_context); + +extern void freeJsonLexContext(JsonLexContext *lex); + +/* lex one token */ +extern JsonParseErrorType json_lex(JsonLexContext *lex); + +/* construct an error detail string for a json error */ +extern char *json_errdetail(JsonParseErrorType error, JsonLexContext *lex); + +/* + * Utility function to check if a string is a valid JSON number. + * + * str argument does not need to be nul-terminated. + */ +extern bool IsValidJsonNumber(const char *str, size_t len); + +#endif /* JSONAPI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/keywords.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/keywords.h new file mode 100644 index 0000000..8a35cc8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/keywords.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * keywords.h + * PostgreSQL's list of SQL keywords + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/keywords.h + * + *------------------------------------------------------------------------- + */ +#ifndef KEYWORDS_H +#define KEYWORDS_H + +#include "common/kwlookup.h" + +/* Keyword categories --- should match lists in gram.y */ +#define UNRESERVED_KEYWORD 0 +#define COL_NAME_KEYWORD 1 +#define TYPE_FUNC_NAME_KEYWORD 2 +#define RESERVED_KEYWORD 3 + +extern PGDLLIMPORT const ScanKeywordList ScanKeywords; +extern PGDLLIMPORT const uint8 ScanKeywordCategories[]; +extern PGDLLIMPORT const bool ScanKeywordBareLabel[]; + +#endif /* KEYWORDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/kwlookup.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/kwlookup.h new file mode 100644 index 0000000..bcc2a01 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/kwlookup.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * kwlookup.h + * Key word lookup for PostgreSQL + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/kwlookup.h + * + *------------------------------------------------------------------------- + */ +#ifndef KWLOOKUP_H +#define KWLOOKUP_H + +/* Hash function used by ScanKeywordLookup */ +typedef int (*ScanKeywordHashFunc) (const void *key, size_t keylen); + +/* + * This struct contains the data needed by ScanKeywordLookup to perform a + * search within a set of keywords. The contents are typically generated by + * src/tools/gen_keywordlist.pl from a header containing PG_KEYWORD macros. + */ +typedef struct ScanKeywordList +{ + const char *kw_string; /* all keywords in order, separated by \0 */ + const uint16 *kw_offsets; /* offsets to the start of each keyword */ + ScanKeywordHashFunc hash; /* perfect hash function for keywords */ + int num_keywords; /* number of keywords */ + int max_kw_len; /* length of longest keyword */ +} ScanKeywordList; + + +extern int ScanKeywordLookup(const char *str, const ScanKeywordList *keywords); + +/* Code that wants to retrieve the text of the N'th keyword should use this. */ +static inline const char * +GetScanKeyword(int n, const ScanKeywordList *keywords) +{ + return keywords->kw_string + keywords->kw_offsets[n]; +} + +#endif /* KWLOOKUP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/link-canary.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/link-canary.h new file mode 100644 index 0000000..699d3a0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/link-canary.h @@ -0,0 +1,17 @@ +/*------------------------------------------------------------------------- + * + * link-canary.h + * Detect whether src/common functions came from frontend or backend. + * + * Copyright (c) 2018-2025, PostgreSQL Global Development Group + * + * src/include/common/link-canary.h + * + *------------------------------------------------------------------------- + */ +#ifndef LINK_CANARY_H +#define LINK_CANARY_H + +extern bool pg_link_canary_is_frontend(void); + +#endif /* LINK_CANARY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/logging.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/logging.h new file mode 100644 index 0000000..81529ee --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/logging.h @@ -0,0 +1,163 @@ +/*------------------------------------------------------------------------- + * Logging framework for frontend programs + * + * Copyright (c) 2018-2025, PostgreSQL Global Development Group + * + * src/include/common/logging.h + * + *------------------------------------------------------------------------- + */ +#ifndef COMMON_LOGGING_H +#define COMMON_LOGGING_H + +/* + * Log levels are informational only. They do not affect program flow. + */ +enum pg_log_level +{ + /* + * Not initialized yet (not to be used as an actual message log level). + */ + PG_LOG_NOTSET = 0, + + /* + * Low level messages that are normally off by default. + */ + PG_LOG_DEBUG, + + /* + * Any program messages that go to stderr, shown by default. (The + * program's normal output should go to stdout and not use the logging + * system.) + */ + PG_LOG_INFO, + + /* + * Warnings and "almost" errors, depends on the program + */ + PG_LOG_WARNING, + + /* + * Errors + */ + PG_LOG_ERROR, + + /* + * Turn all logging off (not to be used as an actual message log level). + */ + PG_LOG_OFF, +}; + +/* + * __pg_log_level is the minimum log level that will actually be shown. + */ +extern enum pg_log_level __pg_log_level; + +/* + * A log message can have several parts. The primary message is required, + * others are optional. When emitting multiple parts, do so in the order of + * this enum, for consistency. + */ +enum pg_log_part +{ + /* + * The primary message. Try to keep it to one line; follow the backend's + * style guideline for primary messages. + */ + PG_LOG_PRIMARY, + + /* + * Additional detail. Follow the backend's style guideline for detail + * messages. + */ + PG_LOG_DETAIL, + + /* + * Hint (not guaranteed correct) about how to fix the problem. Follow the + * backend's style guideline for hint messages. + */ + PG_LOG_HINT, +}; + +/* + * Kind of a hack to be able to produce the psql output exactly as required by + * the regression tests. + */ +#define PG_LOG_FLAG_TERSE 1 + +void pg_logging_init(const char *argv0); +void pg_logging_config(int new_flags); +void pg_logging_set_level(enum pg_log_level new_level); +void pg_logging_increase_verbosity(void); +void pg_logging_set_pre_callback(void (*cb) (void)); +void pg_logging_set_locus_callback(void (*cb) (const char **filename, uint64 *lineno)); + +void pg_log_generic(enum pg_log_level level, enum pg_log_part part, + const char *pg_restrict fmt,...) + pg_attribute_printf(3, 4); +void pg_log_generic_v(enum pg_log_level level, enum pg_log_part part, + const char *pg_restrict fmt, va_list ap) + pg_attribute_printf(3, 0); + +/* + * Preferred style is to use these macros to perform logging; don't call + * pg_log_generic[_v] directly, except perhaps in error interface code. + */ +#define pg_log_error(...) \ + pg_log_generic(PG_LOG_ERROR, PG_LOG_PRIMARY, __VA_ARGS__) + +#define pg_log_error_detail(...) \ + pg_log_generic(PG_LOG_ERROR, PG_LOG_DETAIL, __VA_ARGS__) + +#define pg_log_error_hint(...) \ + pg_log_generic(PG_LOG_ERROR, PG_LOG_HINT, __VA_ARGS__) + +#define pg_log_warning(...) \ + pg_log_generic(PG_LOG_WARNING, PG_LOG_PRIMARY, __VA_ARGS__) + +#define pg_log_warning_detail(...) \ + pg_log_generic(PG_LOG_WARNING, PG_LOG_DETAIL, __VA_ARGS__) + +#define pg_log_warning_hint(...) \ + pg_log_generic(PG_LOG_WARNING, PG_LOG_HINT, __VA_ARGS__) + +#define pg_log_info(...) \ + pg_log_generic(PG_LOG_INFO, PG_LOG_PRIMARY, __VA_ARGS__) + +#define pg_log_info_detail(...) \ + pg_log_generic(PG_LOG_INFO, PG_LOG_DETAIL, __VA_ARGS__) + +#define pg_log_info_hint(...) \ + pg_log_generic(PG_LOG_INFO, PG_LOG_HINT, __VA_ARGS__) + +#define pg_log_debug(...) do { \ + if (unlikely(__pg_log_level <= PG_LOG_DEBUG)) \ + pg_log_generic(PG_LOG_DEBUG, PG_LOG_PRIMARY, __VA_ARGS__); \ + } while(0) + +#define pg_log_debug_detail(...) do { \ + if (unlikely(__pg_log_level <= PG_LOG_DEBUG)) \ + pg_log_generic(PG_LOG_DEBUG, PG_LOG_DETAIL, __VA_ARGS__); \ + } while(0) + +#define pg_log_debug_hint(...) do { \ + if (unlikely(__pg_log_level <= PG_LOG_DEBUG)) \ + pg_log_generic(PG_LOG_DEBUG, PG_LOG_HINT, __VA_ARGS__); \ + } while(0) + +/* + * A common shortcut: pg_log_error() and immediately exit(1). + */ +#define pg_fatal(...) do { \ + pg_log_generic(PG_LOG_ERROR, PG_LOG_PRIMARY, __VA_ARGS__); \ + exit(1); \ + } while(0) + +/* + * Use these variants for "can't happen" cases, if it seems translating their + * messages would be a waste of effort. + */ +#define pg_log_error_internal(...) pg_log_error(__VA_ARGS__) +#define pg_fatal_internal(...) pg_fatal(__VA_ARGS__) + +#endif /* COMMON_LOGGING_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/md5.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/md5.h new file mode 100644 index 0000000..0c9ae48 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/md5.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * md5.h + * Constants and common utilities related to MD5. + * + * These definitions are needed by both frontend and backend code to work + * with MD5-encrypted passwords. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/md5.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_MD5_H +#define PG_MD5_H + +/* Size of result generated by MD5 computation */ +#define MD5_DIGEST_LENGTH 16 +/* Block size for MD5 */ +#define MD5_BLOCK_SIZE 64 + +/* password-related data */ +#define MD5_PASSWD_CHARSET "0123456789abcdef" +#define MD5_PASSWD_LEN 35 + +/* Utilities common to all the MD5 implementations, as of md5_common.c */ +extern bool pg_md5_hash(const void *buff, size_t len, char *hexsum, + const char **errstr); +extern bool pg_md5_binary(const void *buff, size_t len, uint8 *outbuf, + const char **errstr); +extern bool pg_md5_encrypt(const char *passwd, const uint8 *salt, + size_t salt_len, char *buf, + const char **errstr); + +#endif /* PG_MD5_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/oauth-common.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/oauth-common.h new file mode 100644 index 0000000..5fb559d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/oauth-common.h @@ -0,0 +1,19 @@ +/*------------------------------------------------------------------------- + * + * oauth-common.h + * Declarations for helper functions used for OAuth/OIDC authentication + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/oauth-common.h + * + *------------------------------------------------------------------------- + */ +#ifndef OAUTH_COMMON_H +#define OAUTH_COMMON_H + +/* Name of SASL mechanism per IANA */ +#define OAUTHBEARER_NAME "OAUTHBEARER" + +#endif /* OAUTH_COMMON_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/openssl.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/openssl.h new file mode 100644 index 0000000..eab2c14 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/openssl.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * openssl.h + * OpenSSL supporting functionality shared between frontend and backend + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/common/openssl.h + * + *------------------------------------------------------------------------- + */ +#ifndef COMMON_OPENSSL_H +#define COMMON_OPENSSL_H + +#ifdef USE_OPENSSL +#include + +/* + * LibreSSL doesn't provide any very nice way to identify the max protocol + * versions the library supports, analogous to TLS_MAX_VERSION in OpenSSL, so + * we define our own. Note in particular that this doesn't account for + * restrictions that might be specified in the installation's openssl.cnf. + * + * We disable SSLv3 and older in library setup, so TLSv1 is the oldest + * protocol version of interest. + */ +#define MIN_OPENSSL_TLS_VERSION "TLSv1" + +#if defined(TLS1_3_VERSION) +#define MAX_OPENSSL_TLS_VERSION "TLSv1.3" +#elif defined(TLS1_2_VERSION) +#define MAX_OPENSSL_TLS_VERSION "TLSv1.2" +#elif defined(TLS1_1_VERSION) +#define MAX_OPENSSL_TLS_VERSION "TLSv1.1" +#else +#define MAX_OPENSSL_TLS_VERSION "TLSv1" +#endif + +#endif /* USE_OPENSSL */ + +#endif /* COMMON_OPENSSL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/parse_manifest.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/parse_manifest.h new file mode 100644 index 0000000..6172d1d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/parse_manifest.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * parse_manifest.h + * Parse a backup manifest in JSON format. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/parse_manifest.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PARSE_MANIFEST_H +#define PARSE_MANIFEST_H + +#include "access/xlogdefs.h" +#include "common/checksum_helper.h" +#include "mb/pg_wchar.h" + +struct JsonManifestParseContext; +typedef struct JsonManifestParseContext JsonManifestParseContext; +typedef struct JsonManifestParseIncrementalState JsonManifestParseIncrementalState; + +typedef void (*json_manifest_version_callback) (JsonManifestParseContext *, + int manifest_version); +typedef void (*json_manifest_system_identifier_callback) (JsonManifestParseContext *, + uint64 manifest_system_identifier); +typedef void (*json_manifest_per_file_callback) (JsonManifestParseContext *, + const char *pathname, + uint64 size, pg_checksum_type checksum_type, + int checksum_length, uint8 *checksum_payload); +typedef void (*json_manifest_per_wal_range_callback) (JsonManifestParseContext *, + TimeLineID tli, + XLogRecPtr start_lsn, XLogRecPtr end_lsn); +typedef void (*json_manifest_error_callback) (JsonManifestParseContext *, + const char *fmt,...) pg_attribute_printf(2, 3); + +struct JsonManifestParseContext +{ + void *private_data; + json_manifest_version_callback version_cb; + json_manifest_system_identifier_callback system_identifier_cb; + json_manifest_per_file_callback per_file_cb; + json_manifest_per_wal_range_callback per_wal_range_cb; + json_manifest_error_callback error_cb; +}; + +extern void json_parse_manifest(JsonManifestParseContext *context, + const char *buffer, size_t size); +extern JsonManifestParseIncrementalState *json_parse_manifest_incremental_init(JsonManifestParseContext *context); +extern void json_parse_manifest_incremental_chunk(JsonManifestParseIncrementalState *incstate, + const char *chunk, size_t size, + bool is_last); +extern void json_parse_manifest_incremental_shutdown(JsonManifestParseIncrementalState *incstate); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/percentrepl.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/percentrepl.h new file mode 100644 index 0000000..a4786b9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/percentrepl.h @@ -0,0 +1,18 @@ +/*------------------------------------------------------------------------- + * + * percentrepl.h + * Common routines to replace percent placeholders in strings + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/percentrepl.h + * + *------------------------------------------------------------------------- + */ +#ifndef PERCENTREPL_H +#define PERCENTREPL_H + +extern char *replace_percent_placeholders(const char *instr, const char *param_name, const char *letters,...); + +#endif /* PERCENTREPL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/pg_lzcompress.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/pg_lzcompress.h new file mode 100644 index 0000000..2a12b33 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/pg_lzcompress.h @@ -0,0 +1,93 @@ +/* ---------- + * pg_lzcompress.h - + * + * Definitions for the builtin LZ compressor + * + * src/include/common/pg_lzcompress.h + * ---------- + */ + +#ifndef _PG_LZCOMPRESS_H_ +#define _PG_LZCOMPRESS_H_ + + +/* ---------- + * PGLZ_MAX_OUTPUT - + * + * Macro to compute the buffer size required by pglz_compress(). + * We allow 4 bytes for overrun before detecting compression failure. + * ---------- + */ +#define PGLZ_MAX_OUTPUT(_dlen) ((_dlen) + 4) + + +/* ---------- + * PGLZ_Strategy - + * + * Some values that control the compression algorithm. + * + * min_input_size Minimum input data size to consider compression. + * + * max_input_size Maximum input data size to consider compression. + * + * min_comp_rate Minimum compression rate (0-99%) to require. + * Regardless of min_comp_rate, the output must be + * smaller than the input, else we don't store + * compressed. + * + * first_success_by Abandon compression if we find no compressible + * data within the first this-many bytes. + * + * match_size_good The initial GOOD match size when starting history + * lookup. When looking up the history to find a + * match that could be expressed as a tag, the + * algorithm does not always walk back entirely. + * A good match fast is usually better than the + * best possible one very late. For each iteration + * in the lookup, this value is lowered so the + * longer the lookup takes, the smaller matches + * are considered good. + * + * match_size_drop The percentage by which match_size_good is lowered + * after each history check. Allowed values are + * 0 (no change until end) to 100 (only check + * latest history entry at all). + * ---------- + */ +typedef struct PGLZ_Strategy +{ + int32 min_input_size; + int32 max_input_size; + int32 min_comp_rate; + int32 first_success_by; + int32 match_size_good; + int32 match_size_drop; +} PGLZ_Strategy; + + +/* ---------- + * The standard strategies + * + * PGLZ_strategy_default Recommended default strategy for TOAST. + * + * PGLZ_strategy_always Try to compress inputs of any length. + * Fallback to uncompressed storage only if + * output would be larger than input. + * ---------- + */ +extern PGDLLIMPORT const PGLZ_Strategy *const PGLZ_strategy_default; +extern PGDLLIMPORT const PGLZ_Strategy *const PGLZ_strategy_always; + + +/* ---------- + * Global function declarations + * ---------- + */ +extern int32 pglz_compress(const char *source, int32 slen, char *dest, + const PGLZ_Strategy *strategy); +extern int32 pglz_decompress(const char *source, int32 slen, char *dest, + int32 rawsize, bool check_complete); +extern int32 pglz_maximum_compressed_size(int32 rawsize, + int32 total_compressed_size); + +#endif /* _PG_LZCOMPRESS_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/pg_prng.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/pg_prng.h new file mode 100644 index 0000000..085c5ad --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/pg_prng.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * Pseudo-Random Number Generator + * + * Copyright (c) 2021-2025, PostgreSQL Global Development Group + * + * src/include/common/pg_prng.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PRNG_H +#define PG_PRNG_H + +/* + * State vector for PRNG generation. Callers should treat this as an + * opaque typedef, but we expose its definition to allow it to be + * embedded in other structs. + */ +typedef struct pg_prng_state +{ + uint64 s0, + s1; +} pg_prng_state; + +/* + * Callers not needing local PRNG series may use this global state vector, + * after initializing it with one of the pg_prng_...seed functions. + */ +extern PGDLLIMPORT pg_prng_state pg_global_prng_state; + +extern void pg_prng_seed(pg_prng_state *state, uint64 seed); +extern void pg_prng_fseed(pg_prng_state *state, double fseed); +extern bool pg_prng_seed_check(pg_prng_state *state); + +/* + * Initialize the PRNG state from the pg_strong_random source, + * taking care that we don't produce all-zeroes. If this returns false, + * caller should initialize the PRNG state from some other random seed, + * using pg_prng_[f]seed. + * + * We implement this as a macro, so that the pg_strong_random() call is + * in the caller. If it were in pg_prng.c, programs using pg_prng.c + * but not needing strong seeding would nonetheless be forced to pull in + * pg_strong_random.c and thence OpenSSL. + */ +#define pg_prng_strong_seed(state) \ + (pg_strong_random(state, sizeof(pg_prng_state)) ? \ + pg_prng_seed_check(state) : false) + +extern uint64 pg_prng_uint64(pg_prng_state *state); +extern uint64 pg_prng_uint64_range(pg_prng_state *state, uint64 rmin, uint64 rmax); +extern int64 pg_prng_int64(pg_prng_state *state); +extern int64 pg_prng_int64p(pg_prng_state *state); +extern int64 pg_prng_int64_range(pg_prng_state *state, int64 rmin, int64 rmax); +extern uint32 pg_prng_uint32(pg_prng_state *state); +extern int32 pg_prng_int32(pg_prng_state *state); +extern int32 pg_prng_int32p(pg_prng_state *state); +extern double pg_prng_double(pg_prng_state *state); +extern double pg_prng_double_normal(pg_prng_state *state); +extern bool pg_prng_bool(pg_prng_state *state); + +#endif /* PG_PRNG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/relpath.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/relpath.h new file mode 100644 index 0000000..6f2fce2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/relpath.h @@ -0,0 +1,154 @@ +/*------------------------------------------------------------------------- + * + * relpath.h + * Declarations for GetRelationPath() and friends + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/relpath.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELPATH_H +#define RELPATH_H + +/* + * Required here; note that CppAsString2() does not throw an error if the + * symbol is not defined. + */ +#include "catalog/catversion.h" + +/* + * RelFileNumber data type identifies the specific relation file name. + */ +typedef Oid RelFileNumber; +#define InvalidRelFileNumber ((RelFileNumber) InvalidOid) +#define RelFileNumberIsValid(relnumber) \ + ((bool) ((relnumber) != InvalidRelFileNumber)) + +/* + * Name of major-version-specific tablespace subdirectories + */ +#define TABLESPACE_VERSION_DIRECTORY "PG_" PG_MAJORVERSION "_" \ + CppAsString2(CATALOG_VERSION_NO) + +/* + * Tablespace path (relative to installation's $PGDATA). + * + * These values should not be changed as many tools rely on it. + */ +#define PG_TBLSPC_DIR "pg_tblspc" +#define PG_TBLSPC_DIR_SLASH "pg_tblspc/" /* required for strings + * comparisons */ + +/* Characters to allow for an OID in a relation path */ +#define OIDCHARS 10 /* max chars printed by %u */ + +/* + * Stuff for fork names. + * + * The physical storage of a relation consists of one or more forks. + * The main fork is always created, but in addition to that there can be + * additional forks for storing various metadata. ForkNumber is used when + * we need to refer to a specific fork in a relation. + */ +typedef enum ForkNumber +{ + InvalidForkNumber = -1, + MAIN_FORKNUM = 0, + FSM_FORKNUM, + VISIBILITYMAP_FORKNUM, + INIT_FORKNUM, + + /* + * NOTE: if you add a new fork, change MAX_FORKNUM and possibly + * FORKNAMECHARS below, and update the forkNames array in + * src/common/relpath.c + */ +} ForkNumber; + +#define MAX_FORKNUM INIT_FORKNUM + +#define FORKNAMECHARS 4 /* max chars for a fork name */ + +extern PGDLLIMPORT const char *const forkNames[]; + +extern ForkNumber forkname_to_number(const char *forkName); +extern int forkname_chars(const char *str, ForkNumber *fork); + + +/* + * Unfortunately, there's no easy way to derive PROCNUMBER_CHARS from + * MAX_BACKENDS. MAX_BACKENDS is 2^18-1. Crosschecked in test_relpath(). + */ +#define PROCNUMBER_CHARS 6 + +/* + * The longest possible relation path lengths is from the following format: + * sprintf(rp.path, "%s/%u/%s/%u/t%d_%u", + * PG_TBLSPC_DIR, spcOid, + * TABLESPACE_VERSION_DIRECTORY, + * dbOid, procNumber, relNumber); + * + * Note this does *not* include the trailing null-byte, to make it easier to + * combine it with other lengths. + */ +#define REL_PATH_STR_MAXLEN \ + ( \ + sizeof(PG_TBLSPC_DIR) - 1 \ + + sizeof((char)'/') \ + + OIDCHARS /* spcOid */ \ + + sizeof((char)'/') \ + + sizeof(TABLESPACE_VERSION_DIRECTORY) - 1 \ + + sizeof((char)'/') \ + + OIDCHARS /* dbOid */ \ + + sizeof((char)'/') \ + + sizeof((char)'t') /* temporary table indicator */ \ + + PROCNUMBER_CHARS /* procNumber */ \ + + sizeof((char)'_') \ + + OIDCHARS /* relNumber */ \ + + sizeof((char)'_') \ + + FORKNAMECHARS /* forkNames[forkNumber] */ \ + ) + +/* + * String of the exact length required to represent a relation path. We return + * this struct, instead of char[REL_PATH_STR_MAXLEN + 1], as the pointer would + * decay to a plain char * too easily, possibly preventing the compiler from + * detecting invalid references to the on-stack return value of + * GetRelationPath(). + */ +typedef struct RelPathStr +{ + char str[REL_PATH_STR_MAXLEN + 1]; +} RelPathStr; + + +/* + * Stuff for computing filesystem pathnames for relations. + */ +extern char *GetDatabasePath(Oid dbOid, Oid spcOid); + +extern RelPathStr GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber relNumber, + int procNumber, ForkNumber forkNumber); + +/* + * Wrapper macros for GetRelationPath. Beware of multiple + * evaluation of the RelFileLocator or RelFileLocatorBackend argument! + */ + +/* First argument is a RelFileLocator */ +#define relpathbackend(rlocator, backend, forknum) \ + GetRelationPath((rlocator).dbOid, (rlocator).spcOid, (rlocator).relNumber, \ + backend, forknum) + +/* First argument is a RelFileLocator */ +#define relpathperm(rlocator, forknum) \ + relpathbackend(rlocator, INVALID_PROC_NUMBER, forknum) + +/* First argument is a RelFileLocatorBackend */ +#define relpath(rlocator, forknum) \ + relpathbackend((rlocator).locator, (rlocator).backend, forknum) + +#endif /* RELPATH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/restricted_token.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/restricted_token.h new file mode 100644 index 0000000..3b8e3d6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/restricted_token.h @@ -0,0 +1,24 @@ +/* + * restricted_token.h + * helper routine to ensure restricted token on Windows + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/restricted_token.h + */ +#ifndef COMMON_RESTRICTED_TOKEN_H +#define COMMON_RESTRICTED_TOKEN_H + +/* + * On Windows make sure that we are running with a restricted token, + * On other platforms do nothing. + */ +void get_restricted_token(void); + +#ifdef WIN32 +/* Create a restricted token and execute the specified process with it. */ +HANDLE CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo); +#endif + +#endif /* COMMON_RESTRICTED_TOKEN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/saslprep.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/saslprep.h new file mode 100644 index 0000000..f4b006d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/saslprep.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * saslprep.h + * SASLprep normalization, for SCRAM authentication + * + * These definitions are used by both frontend and backend code. + * + * Copyright (c) 2017-2025, PostgreSQL Global Development Group + * + * src/include/common/saslprep.h + * + *------------------------------------------------------------------------- + */ +#ifndef SASLPREP_H +#define SASLPREP_H + +/* + * Return codes for pg_saslprep() function. + */ +typedef enum +{ + SASLPREP_SUCCESS = 0, + SASLPREP_OOM = -1, /* out of memory (only in frontend) */ + SASLPREP_INVALID_UTF8 = -2, /* input is not a valid UTF-8 string */ + SASLPREP_PROHIBITED = -3, /* output would contain prohibited characters */ +} pg_saslprep_rc; + +extern pg_saslprep_rc pg_saslprep(const char *input, char **output); + +#endif /* SASLPREP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/scram-common.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/scram-common.h new file mode 100644 index 0000000..5ce055e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/scram-common.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * + * scram-common.h + * Declarations for helper functions used for SCRAM authentication + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/scram-common.h + * + *------------------------------------------------------------------------- + */ +#ifndef SCRAM_COMMON_H +#define SCRAM_COMMON_H + +#include "common/cryptohash.h" +#include "common/sha2.h" + +/* Name of SCRAM mechanisms per IANA */ +#define SCRAM_SHA_256_NAME "SCRAM-SHA-256" +#define SCRAM_SHA_256_PLUS_NAME "SCRAM-SHA-256-PLUS" /* with channel binding */ + +/* Length of SCRAM keys (client and server) */ +#define SCRAM_SHA_256_KEY_LEN PG_SHA256_DIGEST_LENGTH + +/* + * Size of buffers used internally by SCRAM routines, that should be the + * maximum of SCRAM_SHA_*_KEY_LEN among the hash methods supported. + */ +#define SCRAM_MAX_KEY_LEN SCRAM_SHA_256_KEY_LEN + +/* + * Size of random nonce generated in the authentication exchange. This + * is in "raw" number of bytes, the actual nonces sent over the wire are + * encoded using only ASCII-printable characters. + */ +#define SCRAM_RAW_NONCE_LEN 18 + +/* + * Length of salt when generating new secrets, in bytes. (It will be stored + * and sent over the wire encoded in Base64.) 16 bytes is what the example in + * RFC 7677 uses. + */ +#define SCRAM_DEFAULT_SALT_LEN 16 + +/* + * Default number of iterations when generating secret. Should be at least + * 4096 per RFC 7677. + */ +#define SCRAM_SHA_256_DEFAULT_ITERATIONS 4096 + +extern int scram_SaltedPassword(const char *password, + pg_cryptohash_type hash_type, int key_length, + const uint8 *salt, int saltlen, int iterations, + uint8 *result, const char **errstr); +extern int scram_H(const uint8 *input, pg_cryptohash_type hash_type, + int key_length, uint8 *result, + const char **errstr); +extern int scram_ClientKey(const uint8 *salted_password, + pg_cryptohash_type hash_type, int key_length, + uint8 *result, const char **errstr); +extern int scram_ServerKey(const uint8 *salted_password, + pg_cryptohash_type hash_type, int key_length, + uint8 *result, const char **errstr); + +extern char *scram_build_secret(pg_cryptohash_type hash_type, int key_length, + const uint8 *salt, int saltlen, int iterations, + const char *password, const char **errstr); + +#endif /* SCRAM_COMMON_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/sha1.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/sha1.h new file mode 100644 index 0000000..27abde1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/sha1.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * sha1.h + * Constants related to SHA1. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/sha1.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHA1_H +#define PG_SHA1_H + +/* Size of result generated by SHA1 computation */ +#define SHA1_DIGEST_LENGTH 20 +/* Block size for SHA1 */ +#define SHA1_BLOCK_SIZE 64 + +#endif /* PG_SHA1_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/sha2.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/sha2.h new file mode 100644 index 0000000..5a0fe1b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/sha2.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * sha2.h + * Constants related to SHA224, 256, 384 AND 512. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/common/sha2.h + * + *------------------------------------------------------------------------- + */ + +#ifndef _PG_SHA2_H_ +#define _PG_SHA2_H_ + +/*** SHA224/256/384/512 Various Length Definitions ***********************/ +#define PG_SHA224_BLOCK_LENGTH 64 +#define PG_SHA224_DIGEST_LENGTH 28 +#define PG_SHA224_DIGEST_STRING_LENGTH (PG_SHA224_DIGEST_LENGTH * 2 + 1) +#define PG_SHA256_BLOCK_LENGTH 64 +#define PG_SHA256_DIGEST_LENGTH 32 +#define PG_SHA256_DIGEST_STRING_LENGTH (PG_SHA256_DIGEST_LENGTH * 2 + 1) +#define PG_SHA384_BLOCK_LENGTH 128 +#define PG_SHA384_DIGEST_LENGTH 48 +#define PG_SHA384_DIGEST_STRING_LENGTH (PG_SHA384_DIGEST_LENGTH * 2 + 1) +#define PG_SHA512_BLOCK_LENGTH 128 +#define PG_SHA512_DIGEST_LENGTH 64 +#define PG_SHA512_DIGEST_STRING_LENGTH (PG_SHA512_DIGEST_LENGTH * 2 + 1) + +#endif /* _PG_SHA2_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/shortest_dec.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/shortest_dec.h new file mode 100644 index 0000000..9ca909e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/shortest_dec.h @@ -0,0 +1,63 @@ +/*--------------------------------------------------------------------------- + * + * Ryu floating-point output. + * + * Portions Copyright (c) 2018-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/common/shortest_dec.h + * + * This is a modification of code taken from github.com/ulfjack/ryu under the + * terms of the Boost license (not the Apache license). The original copyright + * notice follows: + * + * Copyright 2018 Ulf Adams + * + * The contents of this file may be used under the terms of the Apache + * License, Version 2.0. + * + * (See accompanying file LICENSE-Apache or copy at + * http://www.apache.org/licenses/LICENSE-2.0) + * + * Alternatively, the contents of this file may be used under the terms of the + * Boost Software License, Version 1.0. + * + * (See accompanying file LICENSE-Boost or copy at + * https://www.boost.org/LICENSE_1_0.txt) + * + * Unless required by applicable law or agreed to in writing, this software is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. + * + *--------------------------------------------------------------------------- + */ +#ifndef SHORTEST_DEC_H +#define SHORTEST_DEC_H + +/*---- + * The length of 25 comes from: + * + * Case 1: -9.9999999999999999e-299 = 24 bytes, plus 1 for null + * + * Case 2: -0.00099999999999999999 = 23 bytes, plus 1 for null + */ +#define DOUBLE_SHORTEST_DECIMAL_LEN 25 + +int double_to_shortest_decimal_bufn(double f, char *result); +int double_to_shortest_decimal_buf(double f, char *result); +char *double_to_shortest_decimal(double f); + +/* + * The length of 16 comes from: + * + * Case 1: -9.99999999e+29 = 15 bytes, plus 1 for null + * + * Case 2: -0.000999999999 = 15 bytes, plus 1 for null + */ +#define FLOAT_SHORTEST_DECIMAL_LEN 16 + +int float_to_shortest_decimal_bufn(float f, char *result); +int float_to_shortest_decimal_buf(float f, char *result); +char *float_to_shortest_decimal(float f); + +#endif /* SHORTEST_DEC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/string.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/string.h new file mode 100644 index 0000000..ffe5ed5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/string.h @@ -0,0 +1,44 @@ +/* + * string.h + * string handling helpers + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/string.h + */ +#ifndef COMMON_STRING_H +#define COMMON_STRING_H + +#include + +struct StringInfoData; /* avoid including stringinfo.h here */ + +typedef struct PromptInterruptContext +{ + /* To avoid including here, jmpbuf is declared "void *" */ + void *jmpbuf; /* existing longjmp buffer */ + volatile sig_atomic_t *enabled; /* flag that enables longjmp-on-interrupt */ + bool canceled; /* indicates whether cancellation occurred */ +} PromptInterruptContext; + +/* functions in src/common/string.c */ +extern bool pg_str_endswith(const char *str, const char *end); +extern int strtoint(const char *pg_restrict str, char **pg_restrict endptr, + int base); +extern char *pg_clean_ascii(const char *str, int alloc_flags); +extern int pg_strip_crlf(char *str); +extern bool pg_is_ascii(const char *str); + +/* functions in src/common/pg_get_line.c */ +extern char *pg_get_line(FILE *stream, PromptInterruptContext *prompt_ctx); +extern bool pg_get_line_buf(FILE *stream, struct StringInfoData *buf); +extern bool pg_get_line_append(FILE *stream, struct StringInfoData *buf, + PromptInterruptContext *prompt_ctx); + +/* functions in src/common/sprompt.c */ +extern char *simple_prompt(const char *prompt, bool echo); +extern char *simple_prompt_extended(const char *prompt, bool echo, + PromptInterruptContext *prompt_ctx); + +#endif /* COMMON_STRING_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_case.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_case.h new file mode 100644 index 0000000..41e2c1f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_case.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * unicode_case.h + * Routines for converting character case. + * + * These definitions can be used by both frontend and backend code. + * + * Copyright (c) 2017-2025, PostgreSQL Global Development Group + * + * src/include/common/unicode_case.h + * + *------------------------------------------------------------------------- + */ +#ifndef UNICODE_CASE_H +#define UNICODE_CASE_H + +#include "mb/pg_wchar.h" + +typedef size_t (*WordBoundaryNext) (void *wbstate); + +pg_wchar unicode_lowercase_simple(pg_wchar code); +pg_wchar unicode_titlecase_simple(pg_wchar code); +pg_wchar unicode_uppercase_simple(pg_wchar code); +pg_wchar unicode_casefold_simple(pg_wchar code); +size_t unicode_strlower(char *dst, size_t dstsize, const char *src, + ssize_t srclen, bool full); +size_t unicode_strtitle(char *dst, size_t dstsize, const char *src, + ssize_t srclen, bool full, + WordBoundaryNext wbnext, void *wbstate); +size_t unicode_strupper(char *dst, size_t dstsize, const char *src, + ssize_t srclen, bool full); +size_t unicode_strfold(char *dst, size_t dstsize, const char *src, + ssize_t srclen, bool full); + +#endif /* UNICODE_CASE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_case_table.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_case_table.h new file mode 100644 index 0000000..d531178 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_case_table.h @@ -0,0 +1,13630 @@ +/*------------------------------------------------------------------------- + * + * unicode_case_table.h + * Case mapping and information table. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_case_table.h + * + *------------------------------------------------------------------------- + */ + +/* + * File auto-generated by src/common/unicode/generate-unicode_case_table.pl, + * do not edit. There is deliberately not an #ifndef PG_UNICODE_CASE_TABLE_H + * here. + */ + +#include "common/unicode_case.h" +#include "mb/pg_wchar.h" + +/* + * The maximum number of codepoints that can result from case mapping + * of a single character. See Unicode section 5.18 "Case Mappings". + */ +#define MAX_CASE_EXPANSION 3 + +/* + * Case mapping condition flags. For now, only Final_Sigma is supported. + * + * See Unicode Context Specification for Casing. + */ +#define PG_U_FINAL_SIGMA (1 << 0) + +typedef enum +{ + CaseLower = 0, + CaseTitle = 1, + CaseUpper = 2, + CaseFold = 3, + NCaseKind +} CaseKind; + +typedef struct +{ + int16 conditions; + pg_wchar map[NCaseKind][MAX_CASE_EXPANSION]; +} pg_special_case; + +/* + * Special case mappings that aren't representable in the simple map. + * Entries are referenced from simple_case_map. + */ +static const pg_special_case special_case[106] = +{ + {0, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}}, + {0, {[CaseLower] = {0x0000df, 0x000000, 0x000000},[CaseTitle] = {0x000053, 0x000073, 0x000000},[CaseUpper] = {0x000053, 0x000053, 0x000000},[CaseFold] = {0x000073, 0x000073, 0x000000}}}, + {0, {[CaseLower] = {0x000069, 0x000307, 0x000000},[CaseTitle] = {0x000130, 0x000000, 0x000000},[CaseUpper] = {0x000130, 0x000000, 0x000000},[CaseFold] = {0x000069, 0x000307, 0x000000}}}, + {0, {[CaseLower] = {0x000149, 0x000000, 0x000000},[CaseTitle] = {0x0002bc, 0x00004e, 0x000000},[CaseUpper] = {0x0002bc, 0x00004e, 0x000000},[CaseFold] = {0x0002bc, 0x00006e, 0x000000}}}, + {0, {[CaseLower] = {0x0001f0, 0x000000, 0x000000},[CaseTitle] = {0x00004a, 0x00030c, 0x000000},[CaseUpper] = {0x00004a, 0x00030c, 0x000000},[CaseFold] = {0x00006a, 0x00030c, 0x000000}}}, + {0, {[CaseLower] = {0x000390, 0x000000, 0x000000},[CaseTitle] = {0x000399, 0x000308, 0x000301},[CaseUpper] = {0x000399, 0x000308, 0x000301},[CaseFold] = {0x0003b9, 0x000308, 0x000301}}}, + {PG_U_FINAL_SIGMA, {[CaseLower] = {0x0003c2, 0x000000, 0x000000},[CaseTitle] = {0x0003a3, 0x000000, 0x000000},[CaseUpper] = {0x0003a3, 0x000000, 0x000000},[CaseFold] = {0x0003c3, 0x000000, 0x000000}}}, + {0, {[CaseLower] = {0x0003b0, 0x000000, 0x000000},[CaseTitle] = {0x0003a5, 0x000308, 0x000301},[CaseUpper] = {0x0003a5, 0x000308, 0x000301},[CaseFold] = {0x0003c5, 0x000308, 0x000301}}}, + {0, {[CaseLower] = {0x000587, 0x000000, 0x000000},[CaseTitle] = {0x000535, 0x000582, 0x000000},[CaseUpper] = {0x000535, 0x000552, 0x000000},[CaseFold] = {0x000565, 0x000582, 0x000000}}}, + {0, {[CaseLower] = {0x001e96, 0x000000, 0x000000},[CaseTitle] = {0x000048, 0x000331, 0x000000},[CaseUpper] = {0x000048, 0x000331, 0x000000},[CaseFold] = {0x000068, 0x000331, 0x000000}}}, + {0, {[CaseLower] = {0x001e97, 0x000000, 0x000000},[CaseTitle] = {0x000054, 0x000308, 0x000000},[CaseUpper] = {0x000054, 0x000308, 0x000000},[CaseFold] = {0x000074, 0x000308, 0x000000}}}, + {0, {[CaseLower] = {0x001e98, 0x000000, 0x000000},[CaseTitle] = {0x000057, 0x00030a, 0x000000},[CaseUpper] = {0x000057, 0x00030a, 0x000000},[CaseFold] = {0x000077, 0x00030a, 0x000000}}}, + {0, {[CaseLower] = {0x001e99, 0x000000, 0x000000},[CaseTitle] = {0x000059, 0x00030a, 0x000000},[CaseUpper] = {0x000059, 0x00030a, 0x000000},[CaseFold] = {0x000079, 0x00030a, 0x000000}}}, + {0, {[CaseLower] = {0x001e9a, 0x000000, 0x000000},[CaseTitle] = {0x000041, 0x0002be, 0x000000},[CaseUpper] = {0x000041, 0x0002be, 0x000000},[CaseFold] = {0x000061, 0x0002be, 0x000000}}}, + {0, {[CaseLower] = {0x0000df, 0x000000, 0x000000},[CaseTitle] = {0x001e9e, 0x000000, 0x000000},[CaseUpper] = {0x001e9e, 0x000000, 0x000000},[CaseFold] = {0x000073, 0x000073, 0x000000}}}, + {0, {[CaseLower] = {0x001f50, 0x000000, 0x000000},[CaseTitle] = {0x0003a5, 0x000313, 0x000000},[CaseUpper] = {0x0003a5, 0x000313, 0x000000},[CaseFold] = {0x0003c5, 0x000313, 0x000000}}}, + {0, {[CaseLower] = {0x001f52, 0x000000, 0x000000},[CaseTitle] = {0x0003a5, 0x000313, 0x000300},[CaseUpper] = {0x0003a5, 0x000313, 0x000300},[CaseFold] = {0x0003c5, 0x000313, 0x000300}}}, + {0, {[CaseLower] = {0x001f54, 0x000000, 0x000000},[CaseTitle] = {0x0003a5, 0x000313, 0x000301},[CaseUpper] = {0x0003a5, 0x000313, 0x000301},[CaseFold] = {0x0003c5, 0x000313, 0x000301}}}, + {0, {[CaseLower] = {0x001f56, 0x000000, 0x000000},[CaseTitle] = {0x0003a5, 0x000313, 0x000342},[CaseUpper] = {0x0003a5, 0x000313, 0x000342},[CaseFold] = {0x0003c5, 0x000313, 0x000342}}}, + {0, {[CaseLower] = {0x001f80, 0x000000, 0x000000},[CaseTitle] = {0x001f88, 0x000000, 0x000000},[CaseUpper] = {0x001f08, 0x000399, 0x000000},[CaseFold] = {0x001f00, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f81, 0x000000, 0x000000},[CaseTitle] = {0x001f89, 0x000000, 0x000000},[CaseUpper] = {0x001f09, 0x000399, 0x000000},[CaseFold] = {0x001f01, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f82, 0x000000, 0x000000},[CaseTitle] = {0x001f8a, 0x000000, 0x000000},[CaseUpper] = {0x001f0a, 0x000399, 0x000000},[CaseFold] = {0x001f02, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f83, 0x000000, 0x000000},[CaseTitle] = {0x001f8b, 0x000000, 0x000000},[CaseUpper] = {0x001f0b, 0x000399, 0x000000},[CaseFold] = {0x001f03, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f84, 0x000000, 0x000000},[CaseTitle] = {0x001f8c, 0x000000, 0x000000},[CaseUpper] = {0x001f0c, 0x000399, 0x000000},[CaseFold] = {0x001f04, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f85, 0x000000, 0x000000},[CaseTitle] = {0x001f8d, 0x000000, 0x000000},[CaseUpper] = {0x001f0d, 0x000399, 0x000000},[CaseFold] = {0x001f05, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f86, 0x000000, 0x000000},[CaseTitle] = {0x001f8e, 0x000000, 0x000000},[CaseUpper] = {0x001f0e, 0x000399, 0x000000},[CaseFold] = {0x001f06, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f87, 0x000000, 0x000000},[CaseTitle] = {0x001f8f, 0x000000, 0x000000},[CaseUpper] = {0x001f0f, 0x000399, 0x000000},[CaseFold] = {0x001f07, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f80, 0x000000, 0x000000},[CaseTitle] = {0x001f88, 0x000000, 0x000000},[CaseUpper] = {0x001f08, 0x000399, 0x000000},[CaseFold] = {0x001f00, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f81, 0x000000, 0x000000},[CaseTitle] = {0x001f89, 0x000000, 0x000000},[CaseUpper] = {0x001f09, 0x000399, 0x000000},[CaseFold] = {0x001f01, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f82, 0x000000, 0x000000},[CaseTitle] = {0x001f8a, 0x000000, 0x000000},[CaseUpper] = {0x001f0a, 0x000399, 0x000000},[CaseFold] = {0x001f02, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f83, 0x000000, 0x000000},[CaseTitle] = {0x001f8b, 0x000000, 0x000000},[CaseUpper] = {0x001f0b, 0x000399, 0x000000},[CaseFold] = {0x001f03, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f84, 0x000000, 0x000000},[CaseTitle] = {0x001f8c, 0x000000, 0x000000},[CaseUpper] = {0x001f0c, 0x000399, 0x000000},[CaseFold] = {0x001f04, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f85, 0x000000, 0x000000},[CaseTitle] = {0x001f8d, 0x000000, 0x000000},[CaseUpper] = {0x001f0d, 0x000399, 0x000000},[CaseFold] = {0x001f05, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f86, 0x000000, 0x000000},[CaseTitle] = {0x001f8e, 0x000000, 0x000000},[CaseUpper] = {0x001f0e, 0x000399, 0x000000},[CaseFold] = {0x001f06, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f87, 0x000000, 0x000000},[CaseTitle] = {0x001f8f, 0x000000, 0x000000},[CaseUpper] = {0x001f0f, 0x000399, 0x000000},[CaseFold] = {0x001f07, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f90, 0x000000, 0x000000},[CaseTitle] = {0x001f98, 0x000000, 0x000000},[CaseUpper] = {0x001f28, 0x000399, 0x000000},[CaseFold] = {0x001f20, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f91, 0x000000, 0x000000},[CaseTitle] = {0x001f99, 0x000000, 0x000000},[CaseUpper] = {0x001f29, 0x000399, 0x000000},[CaseFold] = {0x001f21, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f92, 0x000000, 0x000000},[CaseTitle] = {0x001f9a, 0x000000, 0x000000},[CaseUpper] = {0x001f2a, 0x000399, 0x000000},[CaseFold] = {0x001f22, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f93, 0x000000, 0x000000},[CaseTitle] = {0x001f9b, 0x000000, 0x000000},[CaseUpper] = {0x001f2b, 0x000399, 0x000000},[CaseFold] = {0x001f23, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f94, 0x000000, 0x000000},[CaseTitle] = {0x001f9c, 0x000000, 0x000000},[CaseUpper] = {0x001f2c, 0x000399, 0x000000},[CaseFold] = {0x001f24, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f95, 0x000000, 0x000000},[CaseTitle] = {0x001f9d, 0x000000, 0x000000},[CaseUpper] = {0x001f2d, 0x000399, 0x000000},[CaseFold] = {0x001f25, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f96, 0x000000, 0x000000},[CaseTitle] = {0x001f9e, 0x000000, 0x000000},[CaseUpper] = {0x001f2e, 0x000399, 0x000000},[CaseFold] = {0x001f26, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f97, 0x000000, 0x000000},[CaseTitle] = {0x001f9f, 0x000000, 0x000000},[CaseUpper] = {0x001f2f, 0x000399, 0x000000},[CaseFold] = {0x001f27, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f90, 0x000000, 0x000000},[CaseTitle] = {0x001f98, 0x000000, 0x000000},[CaseUpper] = {0x001f28, 0x000399, 0x000000},[CaseFold] = {0x001f20, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f91, 0x000000, 0x000000},[CaseTitle] = {0x001f99, 0x000000, 0x000000},[CaseUpper] = {0x001f29, 0x000399, 0x000000},[CaseFold] = {0x001f21, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f92, 0x000000, 0x000000},[CaseTitle] = {0x001f9a, 0x000000, 0x000000},[CaseUpper] = {0x001f2a, 0x000399, 0x000000},[CaseFold] = {0x001f22, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f93, 0x000000, 0x000000},[CaseTitle] = {0x001f9b, 0x000000, 0x000000},[CaseUpper] = {0x001f2b, 0x000399, 0x000000},[CaseFold] = {0x001f23, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f94, 0x000000, 0x000000},[CaseTitle] = {0x001f9c, 0x000000, 0x000000},[CaseUpper] = {0x001f2c, 0x000399, 0x000000},[CaseFold] = {0x001f24, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f95, 0x000000, 0x000000},[CaseTitle] = {0x001f9d, 0x000000, 0x000000},[CaseUpper] = {0x001f2d, 0x000399, 0x000000},[CaseFold] = {0x001f25, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f96, 0x000000, 0x000000},[CaseTitle] = {0x001f9e, 0x000000, 0x000000},[CaseUpper] = {0x001f2e, 0x000399, 0x000000},[CaseFold] = {0x001f26, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001f97, 0x000000, 0x000000},[CaseTitle] = {0x001f9f, 0x000000, 0x000000},[CaseUpper] = {0x001f2f, 0x000399, 0x000000},[CaseFold] = {0x001f27, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa0, 0x000000, 0x000000},[CaseTitle] = {0x001fa8, 0x000000, 0x000000},[CaseUpper] = {0x001f68, 0x000399, 0x000000},[CaseFold] = {0x001f60, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa1, 0x000000, 0x000000},[CaseTitle] = {0x001fa9, 0x000000, 0x000000},[CaseUpper] = {0x001f69, 0x000399, 0x000000},[CaseFold] = {0x001f61, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa2, 0x000000, 0x000000},[CaseTitle] = {0x001faa, 0x000000, 0x000000},[CaseUpper] = {0x001f6a, 0x000399, 0x000000},[CaseFold] = {0x001f62, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa3, 0x000000, 0x000000},[CaseTitle] = {0x001fab, 0x000000, 0x000000},[CaseUpper] = {0x001f6b, 0x000399, 0x000000},[CaseFold] = {0x001f63, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa4, 0x000000, 0x000000},[CaseTitle] = {0x001fac, 0x000000, 0x000000},[CaseUpper] = {0x001f6c, 0x000399, 0x000000},[CaseFold] = {0x001f64, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa5, 0x000000, 0x000000},[CaseTitle] = {0x001fad, 0x000000, 0x000000},[CaseUpper] = {0x001f6d, 0x000399, 0x000000},[CaseFold] = {0x001f65, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa6, 0x000000, 0x000000},[CaseTitle] = {0x001fae, 0x000000, 0x000000},[CaseUpper] = {0x001f6e, 0x000399, 0x000000},[CaseFold] = {0x001f66, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa7, 0x000000, 0x000000},[CaseTitle] = {0x001faf, 0x000000, 0x000000},[CaseUpper] = {0x001f6f, 0x000399, 0x000000},[CaseFold] = {0x001f67, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa0, 0x000000, 0x000000},[CaseTitle] = {0x001fa8, 0x000000, 0x000000},[CaseUpper] = {0x001f68, 0x000399, 0x000000},[CaseFold] = {0x001f60, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa1, 0x000000, 0x000000},[CaseTitle] = {0x001fa9, 0x000000, 0x000000},[CaseUpper] = {0x001f69, 0x000399, 0x000000},[CaseFold] = {0x001f61, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa2, 0x000000, 0x000000},[CaseTitle] = {0x001faa, 0x000000, 0x000000},[CaseUpper] = {0x001f6a, 0x000399, 0x000000},[CaseFold] = {0x001f62, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa3, 0x000000, 0x000000},[CaseTitle] = {0x001fab, 0x000000, 0x000000},[CaseUpper] = {0x001f6b, 0x000399, 0x000000},[CaseFold] = {0x001f63, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa4, 0x000000, 0x000000},[CaseTitle] = {0x001fac, 0x000000, 0x000000},[CaseUpper] = {0x001f6c, 0x000399, 0x000000},[CaseFold] = {0x001f64, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa5, 0x000000, 0x000000},[CaseTitle] = {0x001fad, 0x000000, 0x000000},[CaseUpper] = {0x001f6d, 0x000399, 0x000000},[CaseFold] = {0x001f65, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa6, 0x000000, 0x000000},[CaseTitle] = {0x001fae, 0x000000, 0x000000},[CaseUpper] = {0x001f6e, 0x000399, 0x000000},[CaseFold] = {0x001f66, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fa7, 0x000000, 0x000000},[CaseTitle] = {0x001faf, 0x000000, 0x000000},[CaseUpper] = {0x001f6f, 0x000399, 0x000000},[CaseFold] = {0x001f67, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fb2, 0x000000, 0x000000},[CaseTitle] = {0x001fba, 0x000345, 0x000000},[CaseUpper] = {0x001fba, 0x000399, 0x000000},[CaseFold] = {0x001f70, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fb3, 0x000000, 0x000000},[CaseTitle] = {0x001fbc, 0x000000, 0x000000},[CaseUpper] = {0x000391, 0x000399, 0x000000},[CaseFold] = {0x0003b1, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fb4, 0x000000, 0x000000},[CaseTitle] = {0x000386, 0x000345, 0x000000},[CaseUpper] = {0x000386, 0x000399, 0x000000},[CaseFold] = {0x0003ac, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fb6, 0x000000, 0x000000},[CaseTitle] = {0x000391, 0x000342, 0x000000},[CaseUpper] = {0x000391, 0x000342, 0x000000},[CaseFold] = {0x0003b1, 0x000342, 0x000000}}}, + {0, {[CaseLower] = {0x001fb7, 0x000000, 0x000000},[CaseTitle] = {0x000391, 0x000342, 0x000345},[CaseUpper] = {0x000391, 0x000342, 0x000399},[CaseFold] = {0x0003b1, 0x000342, 0x0003b9}}}, + {0, {[CaseLower] = {0x001fb3, 0x000000, 0x000000},[CaseTitle] = {0x001fbc, 0x000000, 0x000000},[CaseUpper] = {0x000391, 0x000399, 0x000000},[CaseFold] = {0x0003b1, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fc2, 0x000000, 0x000000},[CaseTitle] = {0x001fca, 0x000345, 0x000000},[CaseUpper] = {0x001fca, 0x000399, 0x000000},[CaseFold] = {0x001f74, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fc3, 0x000000, 0x000000},[CaseTitle] = {0x001fcc, 0x000000, 0x000000},[CaseUpper] = {0x000397, 0x000399, 0x000000},[CaseFold] = {0x0003b7, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fc4, 0x000000, 0x000000},[CaseTitle] = {0x000389, 0x000345, 0x000000},[CaseUpper] = {0x000389, 0x000399, 0x000000},[CaseFold] = {0x0003ae, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fc6, 0x000000, 0x000000},[CaseTitle] = {0x000397, 0x000342, 0x000000},[CaseUpper] = {0x000397, 0x000342, 0x000000},[CaseFold] = {0x0003b7, 0x000342, 0x000000}}}, + {0, {[CaseLower] = {0x001fc7, 0x000000, 0x000000},[CaseTitle] = {0x000397, 0x000342, 0x000345},[CaseUpper] = {0x000397, 0x000342, 0x000399},[CaseFold] = {0x0003b7, 0x000342, 0x0003b9}}}, + {0, {[CaseLower] = {0x001fc3, 0x000000, 0x000000},[CaseTitle] = {0x001fcc, 0x000000, 0x000000},[CaseUpper] = {0x000397, 0x000399, 0x000000},[CaseFold] = {0x0003b7, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001fd2, 0x000000, 0x000000},[CaseTitle] = {0x000399, 0x000308, 0x000300},[CaseUpper] = {0x000399, 0x000308, 0x000300},[CaseFold] = {0x0003b9, 0x000308, 0x000300}}}, + {0, {[CaseLower] = {0x001fd3, 0x000000, 0x000000},[CaseTitle] = {0x000399, 0x000308, 0x000301},[CaseUpper] = {0x000399, 0x000308, 0x000301},[CaseFold] = {0x0003b9, 0x000308, 0x000301}}}, + {0, {[CaseLower] = {0x001fd6, 0x000000, 0x000000},[CaseTitle] = {0x000399, 0x000342, 0x000000},[CaseUpper] = {0x000399, 0x000342, 0x000000},[CaseFold] = {0x0003b9, 0x000342, 0x000000}}}, + {0, {[CaseLower] = {0x001fd7, 0x000000, 0x000000},[CaseTitle] = {0x000399, 0x000308, 0x000342},[CaseUpper] = {0x000399, 0x000308, 0x000342},[CaseFold] = {0x0003b9, 0x000308, 0x000342}}}, + {0, {[CaseLower] = {0x001fe2, 0x000000, 0x000000},[CaseTitle] = {0x0003a5, 0x000308, 0x000300},[CaseUpper] = {0x0003a5, 0x000308, 0x000300},[CaseFold] = {0x0003c5, 0x000308, 0x000300}}}, + {0, {[CaseLower] = {0x001fe3, 0x000000, 0x000000},[CaseTitle] = {0x0003a5, 0x000308, 0x000301},[CaseUpper] = {0x0003a5, 0x000308, 0x000301},[CaseFold] = {0x0003c5, 0x000308, 0x000301}}}, + {0, {[CaseLower] = {0x001fe4, 0x000000, 0x000000},[CaseTitle] = {0x0003a1, 0x000313, 0x000000},[CaseUpper] = {0x0003a1, 0x000313, 0x000000},[CaseFold] = {0x0003c1, 0x000313, 0x000000}}}, + {0, {[CaseLower] = {0x001fe6, 0x000000, 0x000000},[CaseTitle] = {0x0003a5, 0x000342, 0x000000},[CaseUpper] = {0x0003a5, 0x000342, 0x000000},[CaseFold] = {0x0003c5, 0x000342, 0x000000}}}, + {0, {[CaseLower] = {0x001fe7, 0x000000, 0x000000},[CaseTitle] = {0x0003a5, 0x000308, 0x000342},[CaseUpper] = {0x0003a5, 0x000308, 0x000342},[CaseFold] = {0x0003c5, 0x000308, 0x000342}}}, + {0, {[CaseLower] = {0x001ff2, 0x000000, 0x000000},[CaseTitle] = {0x001ffa, 0x000345, 0x000000},[CaseUpper] = {0x001ffa, 0x000399, 0x000000},[CaseFold] = {0x001f7c, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001ff3, 0x000000, 0x000000},[CaseTitle] = {0x001ffc, 0x000000, 0x000000},[CaseUpper] = {0x0003a9, 0x000399, 0x000000},[CaseFold] = {0x0003c9, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001ff4, 0x000000, 0x000000},[CaseTitle] = {0x00038f, 0x000345, 0x000000},[CaseUpper] = {0x00038f, 0x000399, 0x000000},[CaseFold] = {0x0003ce, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x001ff6, 0x000000, 0x000000},[CaseTitle] = {0x0003a9, 0x000342, 0x000000},[CaseUpper] = {0x0003a9, 0x000342, 0x000000},[CaseFold] = {0x0003c9, 0x000342, 0x000000}}}, + {0, {[CaseLower] = {0x001ff7, 0x000000, 0x000000},[CaseTitle] = {0x0003a9, 0x000342, 0x000345},[CaseUpper] = {0x0003a9, 0x000342, 0x000399},[CaseFold] = {0x0003c9, 0x000342, 0x0003b9}}}, + {0, {[CaseLower] = {0x001ff3, 0x000000, 0x000000},[CaseTitle] = {0x001ffc, 0x000000, 0x000000},[CaseUpper] = {0x0003a9, 0x000399, 0x000000},[CaseFold] = {0x0003c9, 0x0003b9, 0x000000}}}, + {0, {[CaseLower] = {0x00fb00, 0x000000, 0x000000},[CaseTitle] = {0x000046, 0x000066, 0x000000},[CaseUpper] = {0x000046, 0x000046, 0x000000},[CaseFold] = {0x000066, 0x000066, 0x000000}}}, + {0, {[CaseLower] = {0x00fb01, 0x000000, 0x000000},[CaseTitle] = {0x000046, 0x000069, 0x000000},[CaseUpper] = {0x000046, 0x000049, 0x000000},[CaseFold] = {0x000066, 0x000069, 0x000000}}}, + {0, {[CaseLower] = {0x00fb02, 0x000000, 0x000000},[CaseTitle] = {0x000046, 0x00006c, 0x000000},[CaseUpper] = {0x000046, 0x00004c, 0x000000},[CaseFold] = {0x000066, 0x00006c, 0x000000}}}, + {0, {[CaseLower] = {0x00fb03, 0x000000, 0x000000},[CaseTitle] = {0x000046, 0x000066, 0x000069},[CaseUpper] = {0x000046, 0x000046, 0x000049},[CaseFold] = {0x000066, 0x000066, 0x000069}}}, + {0, {[CaseLower] = {0x00fb04, 0x000000, 0x000000},[CaseTitle] = {0x000046, 0x000066, 0x00006c},[CaseUpper] = {0x000046, 0x000046, 0x00004c},[CaseFold] = {0x000066, 0x000066, 0x00006c}}}, + {0, {[CaseLower] = {0x00fb05, 0x000000, 0x000000},[CaseTitle] = {0x000053, 0x000074, 0x000000},[CaseUpper] = {0x000053, 0x000054, 0x000000},[CaseFold] = {0x000073, 0x000074, 0x000000}}}, + {0, {[CaseLower] = {0x00fb06, 0x000000, 0x000000},[CaseTitle] = {0x000053, 0x000074, 0x000000},[CaseUpper] = {0x000053, 0x000054, 0x000000},[CaseFold] = {0x000073, 0x000074, 0x000000}}}, + {0, {[CaseLower] = {0x00fb13, 0x000000, 0x000000},[CaseTitle] = {0x000544, 0x000576, 0x000000},[CaseUpper] = {0x000544, 0x000546, 0x000000},[CaseFold] = {0x000574, 0x000576, 0x000000}}}, + {0, {[CaseLower] = {0x00fb14, 0x000000, 0x000000},[CaseTitle] = {0x000544, 0x000565, 0x000000},[CaseUpper] = {0x000544, 0x000535, 0x000000},[CaseFold] = {0x000574, 0x000565, 0x000000}}}, + {0, {[CaseLower] = {0x00fb15, 0x000000, 0x000000},[CaseTitle] = {0x000544, 0x00056b, 0x000000},[CaseUpper] = {0x000544, 0x00053b, 0x000000},[CaseFold] = {0x000574, 0x00056b, 0x000000}}}, + {0, {[CaseLower] = {0x00fb16, 0x000000, 0x000000},[CaseTitle] = {0x00054e, 0x000576, 0x000000},[CaseUpper] = {0x00054e, 0x000546, 0x000000},[CaseFold] = {0x00057e, 0x000576, 0x000000}}}, + {0, {[CaseLower] = {0x00fb17, 0x000000, 0x000000},[CaseTitle] = {0x000544, 0x00056d, 0x000000},[CaseUpper] = {0x000544, 0x00053d, 0x000000},[CaseFold] = {0x000574, 0x00056d, 0x000000}}}, +}; + +/* + * The entry case_map_lower[case_index(codepoint)] is the mapping for the + * given codepoint. + */ +static const pg_wchar case_map_lower[1704] = +{ + 0x000000, /* reserved */ + 0x000000, /* U+000000 */ + 0x000001, /* U+000001 */ + 0x000002, /* U+000002 */ + 0x000003, /* U+000003 */ + 0x000004, /* U+000004 */ + 0x000005, /* U+000005 */ + 0x000006, /* U+000006 */ + 0x000007, /* U+000007 */ + 0x000008, /* U+000008 */ + 0x000009, /* U+000009 */ + 0x00000a, /* U+00000a */ + 0x00000b, /* U+00000b */ + 0x00000c, /* U+00000c */ + 0x00000d, /* U+00000d */ + 0x00000e, /* U+00000e */ + 0x00000f, /* U+00000f */ + 0x000010, /* U+000010 */ + 0x000011, /* U+000011 */ + 0x000012, /* U+000012 */ + 0x000013, /* U+000013 */ + 0x000014, /* U+000014 */ + 0x000015, /* U+000015 */ + 0x000016, /* U+000016 */ + 0x000017, /* U+000017 */ + 0x000018, /* U+000018 */ + 0x000019, /* U+000019 */ + 0x00001a, /* U+00001a */ + 0x00001b, /* U+00001b */ + 0x00001c, /* U+00001c */ + 0x00001d, /* U+00001d */ + 0x00001e, /* U+00001e */ + 0x00001f, /* U+00001f */ + 0x000020, /* U+000020 */ + 0x000021, /* U+000021 */ + 0x000022, /* U+000022 */ + 0x000023, /* U+000023 */ + 0x000024, /* U+000024 */ + 0x000025, /* U+000025 */ + 0x000026, /* U+000026 */ + 0x000027, /* U+000027 */ + 0x000028, /* U+000028 */ + 0x000029, /* U+000029 */ + 0x00002a, /* U+00002a */ + 0x00002b, /* U+00002b */ + 0x00002c, /* U+00002c */ + 0x00002d, /* U+00002d */ + 0x00002e, /* U+00002e */ + 0x00002f, /* U+00002f */ + 0x000030, /* U+000030 */ + 0x000031, /* U+000031 */ + 0x000032, /* U+000032 */ + 0x000033, /* U+000033 */ + 0x000034, /* U+000034 */ + 0x000035, /* U+000035 */ + 0x000036, /* U+000036 */ + 0x000037, /* U+000037 */ + 0x000038, /* U+000038 */ + 0x000039, /* U+000039 */ + 0x00003a, /* U+00003a */ + 0x00003b, /* U+00003b */ + 0x00003c, /* U+00003c */ + 0x00003d, /* U+00003d */ + 0x00003e, /* U+00003e */ + 0x00003f, /* U+00003f */ + 0x000040, /* U+000040 */ + 0x000061, /* U+000041 */ + 0x000062, /* U+000042 */ + 0x000063, /* U+000043 */ + 0x000064, /* U+000044 */ + 0x000065, /* U+000045 */ + 0x000066, /* U+000046 */ + 0x000067, /* U+000047 */ + 0x000068, /* U+000048 */ + 0x000069, /* U+000049 */ + 0x00006a, /* U+00004a */ + 0x00006b, /* U+00004b */ + 0x00006c, /* U+00004c */ + 0x00006d, /* U+00004d */ + 0x00006e, /* U+00004e */ + 0x00006f, /* U+00004f */ + 0x000070, /* U+000050 */ + 0x000071, /* U+000051 */ + 0x000072, /* U+000052 */ + 0x000073, /* U+000053 */ + 0x000074, /* U+000054 */ + 0x000075, /* U+000055 */ + 0x000076, /* U+000056 */ + 0x000077, /* U+000057 */ + 0x000078, /* U+000058 */ + 0x000079, /* U+000059 */ + 0x00007a, /* U+00005a */ + 0x00005b, /* U+00005b */ + 0x00005c, /* U+00005c */ + 0x00005d, /* U+00005d */ + 0x00005e, /* U+00005e */ + 0x00005f, /* U+00005f */ + 0x000060, /* U+000060 */ + 0x000061, /* U+000061 */ + 0x000062, /* U+000062 */ + 0x000063, /* U+000063 */ + 0x000064, /* U+000064 */ + 0x000065, /* U+000065 */ + 0x000066, /* U+000066 */ + 0x000067, /* U+000067 */ + 0x000068, /* U+000068 */ + 0x000069, /* U+000069 */ + 0x00006a, /* U+00006a */ + 0x00006b, /* U+00006b */ + 0x00006c, /* U+00006c */ + 0x00006d, /* U+00006d */ + 0x00006e, /* U+00006e */ + 0x00006f, /* U+00006f */ + 0x000070, /* U+000070 */ + 0x000071, /* U+000071 */ + 0x000072, /* U+000072 */ + 0x000073, /* U+000073 */ + 0x000074, /* U+000074 */ + 0x000075, /* U+000075 */ + 0x000076, /* U+000076 */ + 0x000077, /* U+000077 */ + 0x000078, /* U+000078 */ + 0x000079, /* U+000079 */ + 0x00007a, /* U+00007a */ + 0x00007b, /* U+00007b */ + 0x00007c, /* U+00007c */ + 0x00007d, /* U+00007d */ + 0x00007e, /* U+00007e */ + 0x00007f, /* U+00007f */ + 0x0000b5, /* U+0000b5 */ + 0x0000e0, /* U+0000c0 */ + 0x0000e1, /* U+0000c1 */ + 0x0000e2, /* U+0000c2 */ + 0x0000e3, /* U+0000c3 */ + 0x0000e4, /* U+0000c4 */ + 0x0000e5, /* U+0000c5 */ + 0x0000e6, /* U+0000c6 */ + 0x0000e7, /* U+0000c7 */ + 0x0000e8, /* U+0000c8 */ + 0x0000e9, /* U+0000c9 */ + 0x0000ea, /* U+0000ca */ + 0x0000eb, /* U+0000cb */ + 0x0000ec, /* U+0000cc */ + 0x0000ed, /* U+0000cd */ + 0x0000ee, /* U+0000ce */ + 0x0000ef, /* U+0000cf */ + 0x0000f0, /* U+0000d0 */ + 0x0000f1, /* U+0000d1 */ + 0x0000f2, /* U+0000d2 */ + 0x0000f3, /* U+0000d3 */ + 0x0000f4, /* U+0000d4 */ + 0x0000f5, /* U+0000d5 */ + 0x0000f6, /* U+0000d6 */ + 0x0000f8, /* U+0000d8 */ + 0x0000f9, /* U+0000d9 */ + 0x0000fa, /* U+0000da */ + 0x0000fb, /* U+0000db */ + 0x0000fc, /* U+0000dc */ + 0x0000fd, /* U+0000dd */ + 0x0000fe, /* U+0000de */ + 0x0000df, /* U+0000df */ + 0x0000ff, /* U+0000ff */ + 0x000101, /* U+000100 */ + 0x000103, /* U+000102 */ + 0x000105, /* U+000104 */ + 0x000107, /* U+000106 */ + 0x000109, /* U+000108 */ + 0x00010b, /* U+00010a */ + 0x00010d, /* U+00010c */ + 0x00010f, /* U+00010e */ + 0x000111, /* U+000110 */ + 0x000113, /* U+000112 */ + 0x000115, /* U+000114 */ + 0x000117, /* U+000116 */ + 0x000119, /* U+000118 */ + 0x00011b, /* U+00011a */ + 0x00011d, /* U+00011c */ + 0x00011f, /* U+00011e */ + 0x000121, /* U+000120 */ + 0x000123, /* U+000122 */ + 0x000125, /* U+000124 */ + 0x000127, /* U+000126 */ + 0x000129, /* U+000128 */ + 0x00012b, /* U+00012a */ + 0x00012d, /* U+00012c */ + 0x00012f, /* U+00012e */ + 0x000069, /* U+000130 */ + 0x000131, /* U+000131 */ + 0x000133, /* U+000132 */ + 0x000135, /* U+000134 */ + 0x000137, /* U+000136 */ + 0x00013a, /* U+000139 */ + 0x00013c, /* U+00013b */ + 0x00013e, /* U+00013d */ + 0x000140, /* U+00013f */ + 0x000142, /* U+000141 */ + 0x000144, /* U+000143 */ + 0x000146, /* U+000145 */ + 0x000148, /* U+000147 */ + 0x000149, /* U+000149 */ + 0x00014b, /* U+00014a */ + 0x00014d, /* U+00014c */ + 0x00014f, /* U+00014e */ + 0x000151, /* U+000150 */ + 0x000153, /* U+000152 */ + 0x000155, /* U+000154 */ + 0x000157, /* U+000156 */ + 0x000159, /* U+000158 */ + 0x00015b, /* U+00015a */ + 0x00015d, /* U+00015c */ + 0x00015f, /* U+00015e */ + 0x000161, /* U+000160 */ + 0x000163, /* U+000162 */ + 0x000165, /* U+000164 */ + 0x000167, /* U+000166 */ + 0x000169, /* U+000168 */ + 0x00016b, /* U+00016a */ + 0x00016d, /* U+00016c */ + 0x00016f, /* U+00016e */ + 0x000171, /* U+000170 */ + 0x000173, /* U+000172 */ + 0x000175, /* U+000174 */ + 0x000177, /* U+000176 */ + 0x00017a, /* U+000179 */ + 0x00017c, /* U+00017b */ + 0x00017e, /* U+00017d */ + 0x00017f, /* U+00017f */ + 0x000180, /* U+000180 */ + 0x000253, /* U+000181 */ + 0x000183, /* U+000182 */ + 0x000185, /* U+000184 */ + 0x000254, /* U+000186 */ + 0x000188, /* U+000187 */ + 0x000256, /* U+000189 */ + 0x000257, /* U+00018a */ + 0x00018c, /* U+00018b */ + 0x0001dd, /* U+00018e */ + 0x000259, /* U+00018f */ + 0x00025b, /* U+000190 */ + 0x000192, /* U+000191 */ + 0x000260, /* U+000193 */ + 0x000263, /* U+000194 */ + 0x000195, /* U+000195 */ + 0x000269, /* U+000196 */ + 0x000268, /* U+000197 */ + 0x000199, /* U+000198 */ + 0x00019a, /* U+00019a */ + 0x00019b, /* U+00019b */ + 0x00026f, /* U+00019c */ + 0x000272, /* U+00019d */ + 0x00019e, /* U+00019e */ + 0x000275, /* U+00019f */ + 0x0001a1, /* U+0001a0 */ + 0x0001a3, /* U+0001a2 */ + 0x0001a5, /* U+0001a4 */ + 0x000280, /* U+0001a6 */ + 0x0001a8, /* U+0001a7 */ + 0x000283, /* U+0001a9 */ + 0x0001ad, /* U+0001ac */ + 0x000288, /* U+0001ae */ + 0x0001b0, /* U+0001af */ + 0x00028a, /* U+0001b1 */ + 0x00028b, /* U+0001b2 */ + 0x0001b4, /* U+0001b3 */ + 0x0001b6, /* U+0001b5 */ + 0x000292, /* U+0001b7 */ + 0x0001b9, /* U+0001b8 */ + 0x0001bd, /* U+0001bc */ + 0x0001bf, /* U+0001bf */ + 0x0001c6, /* U+0001c4 */ + 0x0001c9, /* U+0001c7 */ + 0x0001cc, /* U+0001ca */ + 0x0001ce, /* U+0001cd */ + 0x0001d0, /* U+0001cf */ + 0x0001d2, /* U+0001d1 */ + 0x0001d4, /* U+0001d3 */ + 0x0001d6, /* U+0001d5 */ + 0x0001d8, /* U+0001d7 */ + 0x0001da, /* U+0001d9 */ + 0x0001dc, /* U+0001db */ + 0x0001df, /* U+0001de */ + 0x0001e1, /* U+0001e0 */ + 0x0001e3, /* U+0001e2 */ + 0x0001e5, /* U+0001e4 */ + 0x0001e7, /* U+0001e6 */ + 0x0001e9, /* U+0001e8 */ + 0x0001eb, /* U+0001ea */ + 0x0001ed, /* U+0001ec */ + 0x0001ef, /* U+0001ee */ + 0x0001f0, /* U+0001f0 */ + 0x0001f3, /* U+0001f1 */ + 0x0001f5, /* U+0001f4 */ + 0x0001f9, /* U+0001f8 */ + 0x0001fb, /* U+0001fa */ + 0x0001fd, /* U+0001fc */ + 0x0001ff, /* U+0001fe */ + 0x000201, /* U+000200 */ + 0x000203, /* U+000202 */ + 0x000205, /* U+000204 */ + 0x000207, /* U+000206 */ + 0x000209, /* U+000208 */ + 0x00020b, /* U+00020a */ + 0x00020d, /* U+00020c */ + 0x00020f, /* U+00020e */ + 0x000211, /* U+000210 */ + 0x000213, /* U+000212 */ + 0x000215, /* U+000214 */ + 0x000217, /* U+000216 */ + 0x000219, /* U+000218 */ + 0x00021b, /* U+00021a */ + 0x00021d, /* U+00021c */ + 0x00021f, /* U+00021e */ + 0x000223, /* U+000222 */ + 0x000225, /* U+000224 */ + 0x000227, /* U+000226 */ + 0x000229, /* U+000228 */ + 0x00022b, /* U+00022a */ + 0x00022d, /* U+00022c */ + 0x00022f, /* U+00022e */ + 0x000231, /* U+000230 */ + 0x000233, /* U+000232 */ + 0x002c65, /* U+00023a */ + 0x00023c, /* U+00023b */ + 0x002c66, /* U+00023e */ + 0x00023f, /* U+00023f */ + 0x000240, /* U+000240 */ + 0x000242, /* U+000241 */ + 0x000289, /* U+000244 */ + 0x00028c, /* U+000245 */ + 0x000247, /* U+000246 */ + 0x000249, /* U+000248 */ + 0x00024b, /* U+00024a */ + 0x00024d, /* U+00024c */ + 0x00024f, /* U+00024e */ + 0x000250, /* U+000250 */ + 0x000251, /* U+000251 */ + 0x000252, /* U+000252 */ + 0x00025c, /* U+00025c */ + 0x000261, /* U+000261 */ + 0x000264, /* U+000264 */ + 0x000265, /* U+000265 */ + 0x000266, /* U+000266 */ + 0x00026a, /* U+00026a */ + 0x00026b, /* U+00026b */ + 0x00026c, /* U+00026c */ + 0x000271, /* U+000271 */ + 0x00027d, /* U+00027d */ + 0x000282, /* U+000282 */ + 0x000287, /* U+000287 */ + 0x00029d, /* U+00029d */ + 0x00029e, /* U+00029e */ + 0x000345, /* U+000345 */ + 0x000371, /* U+000370 */ + 0x000373, /* U+000372 */ + 0x000377, /* U+000376 */ + 0x00037b, /* U+00037b */ + 0x00037c, /* U+00037c */ + 0x00037d, /* U+00037d */ + 0x0003f3, /* U+00037f */ + 0x0003ac, /* U+000386 */ + 0x0003ad, /* U+000388 */ + 0x0003ae, /* U+000389 */ + 0x0003af, /* U+00038a */ + 0x0003cc, /* U+00038c */ + 0x0003cd, /* U+00038e */ + 0x0003ce, /* U+00038f */ + 0x000390, /* U+000390 */ + 0x0003b1, /* U+000391 */ + 0x0003b2, /* U+000392 */ + 0x0003b3, /* U+000393 */ + 0x0003b4, /* U+000394 */ + 0x0003b5, /* U+000395 */ + 0x0003b6, /* U+000396 */ + 0x0003b7, /* U+000397 */ + 0x0003b8, /* U+000398 */ + 0x0003b9, /* U+000399 */ + 0x0003ba, /* U+00039a */ + 0x0003bb, /* U+00039b */ + 0x0003bc, /* U+00039c */ + 0x0003bd, /* U+00039d */ + 0x0003be, /* U+00039e */ + 0x0003bf, /* U+00039f */ + 0x0003c0, /* U+0003a0 */ + 0x0003c1, /* U+0003a1 */ + 0x0003c3, /* U+0003a3 */ + 0x0003c4, /* U+0003a4 */ + 0x0003c5, /* U+0003a5 */ + 0x0003c6, /* U+0003a6 */ + 0x0003c7, /* U+0003a7 */ + 0x0003c8, /* U+0003a8 */ + 0x0003c9, /* U+0003a9 */ + 0x0003ca, /* U+0003aa */ + 0x0003cb, /* U+0003ab */ + 0x0003b0, /* U+0003b0 */ + 0x0003c2, /* U+0003c2 */ + 0x0003c3, /* U+0003c3 */ + 0x0003d7, /* U+0003cf */ + 0x0003d0, /* U+0003d0 */ + 0x0003d1, /* U+0003d1 */ + 0x0003d5, /* U+0003d5 */ + 0x0003d6, /* U+0003d6 */ + 0x0003d9, /* U+0003d8 */ + 0x0003db, /* U+0003da */ + 0x0003dd, /* U+0003dc */ + 0x0003df, /* U+0003de */ + 0x0003e1, /* U+0003e0 */ + 0x0003e3, /* U+0003e2 */ + 0x0003e5, /* U+0003e4 */ + 0x0003e7, /* U+0003e6 */ + 0x0003e9, /* U+0003e8 */ + 0x0003eb, /* U+0003ea */ + 0x0003ed, /* U+0003ec */ + 0x0003ef, /* U+0003ee */ + 0x0003f0, /* U+0003f0 */ + 0x0003f1, /* U+0003f1 */ + 0x0003f2, /* U+0003f2 */ + 0x0003b8, /* U+0003f4 */ + 0x0003f5, /* U+0003f5 */ + 0x0003f8, /* U+0003f7 */ + 0x0003fb, /* U+0003fa */ + 0x000450, /* U+000400 */ + 0x000451, /* U+000401 */ + 0x000452, /* U+000402 */ + 0x000453, /* U+000403 */ + 0x000454, /* U+000404 */ + 0x000455, /* U+000405 */ + 0x000456, /* U+000406 */ + 0x000457, /* U+000407 */ + 0x000458, /* U+000408 */ + 0x000459, /* U+000409 */ + 0x00045a, /* U+00040a */ + 0x00045b, /* U+00040b */ + 0x00045c, /* U+00040c */ + 0x00045d, /* U+00040d */ + 0x00045e, /* U+00040e */ + 0x00045f, /* U+00040f */ + 0x000430, /* U+000410 */ + 0x000431, /* U+000411 */ + 0x000432, /* U+000412 */ + 0x000433, /* U+000413 */ + 0x000434, /* U+000414 */ + 0x000435, /* U+000415 */ + 0x000436, /* U+000416 */ + 0x000437, /* U+000417 */ + 0x000438, /* U+000418 */ + 0x000439, /* U+000419 */ + 0x00043a, /* U+00041a */ + 0x00043b, /* U+00041b */ + 0x00043c, /* U+00041c */ + 0x00043d, /* U+00041d */ + 0x00043e, /* U+00041e */ + 0x00043f, /* U+00041f */ + 0x000440, /* U+000420 */ + 0x000441, /* U+000421 */ + 0x000442, /* U+000422 */ + 0x000443, /* U+000423 */ + 0x000444, /* U+000424 */ + 0x000445, /* U+000425 */ + 0x000446, /* U+000426 */ + 0x000447, /* U+000427 */ + 0x000448, /* U+000428 */ + 0x000449, /* U+000429 */ + 0x00044a, /* U+00042a */ + 0x00044b, /* U+00042b */ + 0x00044c, /* U+00042c */ + 0x00044d, /* U+00042d */ + 0x00044e, /* U+00042e */ + 0x00044f, /* U+00042f */ + 0x000461, /* U+000460 */ + 0x000463, /* U+000462 */ + 0x000465, /* U+000464 */ + 0x000467, /* U+000466 */ + 0x000469, /* U+000468 */ + 0x00046b, /* U+00046a */ + 0x00046d, /* U+00046c */ + 0x00046f, /* U+00046e */ + 0x000471, /* U+000470 */ + 0x000473, /* U+000472 */ + 0x000475, /* U+000474 */ + 0x000477, /* U+000476 */ + 0x000479, /* U+000478 */ + 0x00047b, /* U+00047a */ + 0x00047d, /* U+00047c */ + 0x00047f, /* U+00047e */ + 0x000481, /* U+000480 */ + 0x00048b, /* U+00048a */ + 0x00048d, /* U+00048c */ + 0x00048f, /* U+00048e */ + 0x000491, /* U+000490 */ + 0x000493, /* U+000492 */ + 0x000495, /* U+000494 */ + 0x000497, /* U+000496 */ + 0x000499, /* U+000498 */ + 0x00049b, /* U+00049a */ + 0x00049d, /* U+00049c */ + 0x00049f, /* U+00049e */ + 0x0004a1, /* U+0004a0 */ + 0x0004a3, /* U+0004a2 */ + 0x0004a5, /* U+0004a4 */ + 0x0004a7, /* U+0004a6 */ + 0x0004a9, /* U+0004a8 */ + 0x0004ab, /* U+0004aa */ + 0x0004ad, /* U+0004ac */ + 0x0004af, /* U+0004ae */ + 0x0004b1, /* U+0004b0 */ + 0x0004b3, /* U+0004b2 */ + 0x0004b5, /* U+0004b4 */ + 0x0004b7, /* U+0004b6 */ + 0x0004b9, /* U+0004b8 */ + 0x0004bb, /* U+0004ba */ + 0x0004bd, /* U+0004bc */ + 0x0004bf, /* U+0004be */ + 0x0004cf, /* U+0004c0 */ + 0x0004c2, /* U+0004c1 */ + 0x0004c4, /* U+0004c3 */ + 0x0004c6, /* U+0004c5 */ + 0x0004c8, /* U+0004c7 */ + 0x0004ca, /* U+0004c9 */ + 0x0004cc, /* U+0004cb */ + 0x0004ce, /* U+0004cd */ + 0x0004d1, /* U+0004d0 */ + 0x0004d3, /* U+0004d2 */ + 0x0004d5, /* U+0004d4 */ + 0x0004d7, /* U+0004d6 */ + 0x0004d9, /* U+0004d8 */ + 0x0004db, /* U+0004da */ + 0x0004dd, /* U+0004dc */ + 0x0004df, /* U+0004de */ + 0x0004e1, /* U+0004e0 */ + 0x0004e3, /* U+0004e2 */ + 0x0004e5, /* U+0004e4 */ + 0x0004e7, /* U+0004e6 */ + 0x0004e9, /* U+0004e8 */ + 0x0004eb, /* U+0004ea */ + 0x0004ed, /* U+0004ec */ + 0x0004ef, /* U+0004ee */ + 0x0004f1, /* U+0004f0 */ + 0x0004f3, /* U+0004f2 */ + 0x0004f5, /* U+0004f4 */ + 0x0004f7, /* U+0004f6 */ + 0x0004f9, /* U+0004f8 */ + 0x0004fb, /* U+0004fa */ + 0x0004fd, /* U+0004fc */ + 0x0004ff, /* U+0004fe */ + 0x000501, /* U+000500 */ + 0x000503, /* U+000502 */ + 0x000505, /* U+000504 */ + 0x000507, /* U+000506 */ + 0x000509, /* U+000508 */ + 0x00050b, /* U+00050a */ + 0x00050d, /* U+00050c */ + 0x00050f, /* U+00050e */ + 0x000511, /* U+000510 */ + 0x000513, /* U+000512 */ + 0x000515, /* U+000514 */ + 0x000517, /* U+000516 */ + 0x000519, /* U+000518 */ + 0x00051b, /* U+00051a */ + 0x00051d, /* U+00051c */ + 0x00051f, /* U+00051e */ + 0x000521, /* U+000520 */ + 0x000523, /* U+000522 */ + 0x000525, /* U+000524 */ + 0x000527, /* U+000526 */ + 0x000529, /* U+000528 */ + 0x00052b, /* U+00052a */ + 0x00052d, /* U+00052c */ + 0x00052f, /* U+00052e */ + 0x000561, /* U+000531 */ + 0x000562, /* U+000532 */ + 0x000563, /* U+000533 */ + 0x000564, /* U+000534 */ + 0x000565, /* U+000535 */ + 0x000566, /* U+000536 */ + 0x000567, /* U+000537 */ + 0x000568, /* U+000538 */ + 0x000569, /* U+000539 */ + 0x00056a, /* U+00053a */ + 0x00056b, /* U+00053b */ + 0x00056c, /* U+00053c */ + 0x00056d, /* U+00053d */ + 0x00056e, /* U+00053e */ + 0x00056f, /* U+00053f */ + 0x000570, /* U+000540 */ + 0x000571, /* U+000541 */ + 0x000572, /* U+000542 */ + 0x000573, /* U+000543 */ + 0x000574, /* U+000544 */ + 0x000575, /* U+000545 */ + 0x000576, /* U+000546 */ + 0x000577, /* U+000547 */ + 0x000578, /* U+000548 */ + 0x000579, /* U+000549 */ + 0x00057a, /* U+00054a */ + 0x00057b, /* U+00054b */ + 0x00057c, /* U+00054c */ + 0x00057d, /* U+00054d */ + 0x00057e, /* U+00054e */ + 0x00057f, /* U+00054f */ + 0x000580, /* U+000550 */ + 0x000581, /* U+000551 */ + 0x000582, /* U+000552 */ + 0x000583, /* U+000553 */ + 0x000584, /* U+000554 */ + 0x000585, /* U+000555 */ + 0x000586, /* U+000556 */ + 0x000587, /* U+000587 */ + 0x002d00, /* U+0010a0 */ + 0x002d01, /* U+0010a1 */ + 0x002d02, /* U+0010a2 */ + 0x002d03, /* U+0010a3 */ + 0x002d04, /* U+0010a4 */ + 0x002d05, /* U+0010a5 */ + 0x002d06, /* U+0010a6 */ + 0x002d07, /* U+0010a7 */ + 0x002d08, /* U+0010a8 */ + 0x002d09, /* U+0010a9 */ + 0x002d0a, /* U+0010aa */ + 0x002d0b, /* U+0010ab */ + 0x002d0c, /* U+0010ac */ + 0x002d0d, /* U+0010ad */ + 0x002d0e, /* U+0010ae */ + 0x002d0f, /* U+0010af */ + 0x002d10, /* U+0010b0 */ + 0x002d11, /* U+0010b1 */ + 0x002d12, /* U+0010b2 */ + 0x002d13, /* U+0010b3 */ + 0x002d14, /* U+0010b4 */ + 0x002d15, /* U+0010b5 */ + 0x002d16, /* U+0010b6 */ + 0x002d17, /* U+0010b7 */ + 0x002d18, /* U+0010b8 */ + 0x002d19, /* U+0010b9 */ + 0x002d1a, /* U+0010ba */ + 0x002d1b, /* U+0010bb */ + 0x002d1c, /* U+0010bc */ + 0x002d1d, /* U+0010bd */ + 0x002d1e, /* U+0010be */ + 0x002d1f, /* U+0010bf */ + 0x002d20, /* U+0010c0 */ + 0x002d21, /* U+0010c1 */ + 0x002d22, /* U+0010c2 */ + 0x002d23, /* U+0010c3 */ + 0x002d24, /* U+0010c4 */ + 0x002d25, /* U+0010c5 */ + 0x002d27, /* U+0010c7 */ + 0x002d2d, /* U+0010cd */ + 0x0010d0, /* U+0010d0 */ + 0x0010d1, /* U+0010d1 */ + 0x0010d2, /* U+0010d2 */ + 0x0010d3, /* U+0010d3 */ + 0x0010d4, /* U+0010d4 */ + 0x0010d5, /* U+0010d5 */ + 0x0010d6, /* U+0010d6 */ + 0x0010d7, /* U+0010d7 */ + 0x0010d8, /* U+0010d8 */ + 0x0010d9, /* U+0010d9 */ + 0x0010da, /* U+0010da */ + 0x0010db, /* U+0010db */ + 0x0010dc, /* U+0010dc */ + 0x0010dd, /* U+0010dd */ + 0x0010de, /* U+0010de */ + 0x0010df, /* U+0010df */ + 0x0010e0, /* U+0010e0 */ + 0x0010e1, /* U+0010e1 */ + 0x0010e2, /* U+0010e2 */ + 0x0010e3, /* U+0010e3 */ + 0x0010e4, /* U+0010e4 */ + 0x0010e5, /* U+0010e5 */ + 0x0010e6, /* U+0010e6 */ + 0x0010e7, /* U+0010e7 */ + 0x0010e8, /* U+0010e8 */ + 0x0010e9, /* U+0010e9 */ + 0x0010ea, /* U+0010ea */ + 0x0010eb, /* U+0010eb */ + 0x0010ec, /* U+0010ec */ + 0x0010ed, /* U+0010ed */ + 0x0010ee, /* U+0010ee */ + 0x0010ef, /* U+0010ef */ + 0x0010f0, /* U+0010f0 */ + 0x0010f1, /* U+0010f1 */ + 0x0010f2, /* U+0010f2 */ + 0x0010f3, /* U+0010f3 */ + 0x0010f4, /* U+0010f4 */ + 0x0010f5, /* U+0010f5 */ + 0x0010f6, /* U+0010f6 */ + 0x0010f7, /* U+0010f7 */ + 0x0010f8, /* U+0010f8 */ + 0x0010f9, /* U+0010f9 */ + 0x0010fa, /* U+0010fa */ + 0x0010fd, /* U+0010fd */ + 0x0010fe, /* U+0010fe */ + 0x0010ff, /* U+0010ff */ + 0x00ab70, /* U+0013a0 */ + 0x00ab71, /* U+0013a1 */ + 0x00ab72, /* U+0013a2 */ + 0x00ab73, /* U+0013a3 */ + 0x00ab74, /* U+0013a4 */ + 0x00ab75, /* U+0013a5 */ + 0x00ab76, /* U+0013a6 */ + 0x00ab77, /* U+0013a7 */ + 0x00ab78, /* U+0013a8 */ + 0x00ab79, /* U+0013a9 */ + 0x00ab7a, /* U+0013aa */ + 0x00ab7b, /* U+0013ab */ + 0x00ab7c, /* U+0013ac */ + 0x00ab7d, /* U+0013ad */ + 0x00ab7e, /* U+0013ae */ + 0x00ab7f, /* U+0013af */ + 0x00ab80, /* U+0013b0 */ + 0x00ab81, /* U+0013b1 */ + 0x00ab82, /* U+0013b2 */ + 0x00ab83, /* U+0013b3 */ + 0x00ab84, /* U+0013b4 */ + 0x00ab85, /* U+0013b5 */ + 0x00ab86, /* U+0013b6 */ + 0x00ab87, /* U+0013b7 */ + 0x00ab88, /* U+0013b8 */ + 0x00ab89, /* U+0013b9 */ + 0x00ab8a, /* U+0013ba */ + 0x00ab8b, /* U+0013bb */ + 0x00ab8c, /* U+0013bc */ + 0x00ab8d, /* U+0013bd */ + 0x00ab8e, /* U+0013be */ + 0x00ab8f, /* U+0013bf */ + 0x00ab90, /* U+0013c0 */ + 0x00ab91, /* U+0013c1 */ + 0x00ab92, /* U+0013c2 */ + 0x00ab93, /* U+0013c3 */ + 0x00ab94, /* U+0013c4 */ + 0x00ab95, /* U+0013c5 */ + 0x00ab96, /* U+0013c6 */ + 0x00ab97, /* U+0013c7 */ + 0x00ab98, /* U+0013c8 */ + 0x00ab99, /* U+0013c9 */ + 0x00ab9a, /* U+0013ca */ + 0x00ab9b, /* U+0013cb */ + 0x00ab9c, /* U+0013cc */ + 0x00ab9d, /* U+0013cd */ + 0x00ab9e, /* U+0013ce */ + 0x00ab9f, /* U+0013cf */ + 0x00aba0, /* U+0013d0 */ + 0x00aba1, /* U+0013d1 */ + 0x00aba2, /* U+0013d2 */ + 0x00aba3, /* U+0013d3 */ + 0x00aba4, /* U+0013d4 */ + 0x00aba5, /* U+0013d5 */ + 0x00aba6, /* U+0013d6 */ + 0x00aba7, /* U+0013d7 */ + 0x00aba8, /* U+0013d8 */ + 0x00aba9, /* U+0013d9 */ + 0x00abaa, /* U+0013da */ + 0x00abab, /* U+0013db */ + 0x00abac, /* U+0013dc */ + 0x00abad, /* U+0013dd */ + 0x00abae, /* U+0013de */ + 0x00abaf, /* U+0013df */ + 0x00abb0, /* U+0013e0 */ + 0x00abb1, /* U+0013e1 */ + 0x00abb2, /* U+0013e2 */ + 0x00abb3, /* U+0013e3 */ + 0x00abb4, /* U+0013e4 */ + 0x00abb5, /* U+0013e5 */ + 0x00abb6, /* U+0013e6 */ + 0x00abb7, /* U+0013e7 */ + 0x00abb8, /* U+0013e8 */ + 0x00abb9, /* U+0013e9 */ + 0x00abba, /* U+0013ea */ + 0x00abbb, /* U+0013eb */ + 0x00abbc, /* U+0013ec */ + 0x00abbd, /* U+0013ed */ + 0x00abbe, /* U+0013ee */ + 0x00abbf, /* U+0013ef */ + 0x0013f8, /* U+0013f0 */ + 0x0013f9, /* U+0013f1 */ + 0x0013fa, /* U+0013f2 */ + 0x0013fb, /* U+0013f3 */ + 0x0013fc, /* U+0013f4 */ + 0x0013fd, /* U+0013f5 */ + 0x001c80, /* U+001c80 */ + 0x001c81, /* U+001c81 */ + 0x001c82, /* U+001c82 */ + 0x001c83, /* U+001c83 */ + 0x001c84, /* U+001c84 */ + 0x001c85, /* U+001c85 */ + 0x001c86, /* U+001c86 */ + 0x001c87, /* U+001c87 */ + 0x001c88, /* U+001c88 */ + 0x001c8a, /* U+001c89 */ + 0x0010d0, /* U+001c90 */ + 0x0010d1, /* U+001c91 */ + 0x0010d2, /* U+001c92 */ + 0x0010d3, /* U+001c93 */ + 0x0010d4, /* U+001c94 */ + 0x0010d5, /* U+001c95 */ + 0x0010d6, /* U+001c96 */ + 0x0010d7, /* U+001c97 */ + 0x0010d8, /* U+001c98 */ + 0x0010d9, /* U+001c99 */ + 0x0010da, /* U+001c9a */ + 0x0010db, /* U+001c9b */ + 0x0010dc, /* U+001c9c */ + 0x0010dd, /* U+001c9d */ + 0x0010de, /* U+001c9e */ + 0x0010df, /* U+001c9f */ + 0x0010e0, /* U+001ca0 */ + 0x0010e1, /* U+001ca1 */ + 0x0010e2, /* U+001ca2 */ + 0x0010e3, /* U+001ca3 */ + 0x0010e4, /* U+001ca4 */ + 0x0010e5, /* U+001ca5 */ + 0x0010e6, /* U+001ca6 */ + 0x0010e7, /* U+001ca7 */ + 0x0010e8, /* U+001ca8 */ + 0x0010e9, /* U+001ca9 */ + 0x0010ea, /* U+001caa */ + 0x0010eb, /* U+001cab */ + 0x0010ec, /* U+001cac */ + 0x0010ed, /* U+001cad */ + 0x0010ee, /* U+001cae */ + 0x0010ef, /* U+001caf */ + 0x0010f0, /* U+001cb0 */ + 0x0010f1, /* U+001cb1 */ + 0x0010f2, /* U+001cb2 */ + 0x0010f3, /* U+001cb3 */ + 0x0010f4, /* U+001cb4 */ + 0x0010f5, /* U+001cb5 */ + 0x0010f6, /* U+001cb6 */ + 0x0010f7, /* U+001cb7 */ + 0x0010f8, /* U+001cb8 */ + 0x0010f9, /* U+001cb9 */ + 0x0010fa, /* U+001cba */ + 0x0010fd, /* U+001cbd */ + 0x0010fe, /* U+001cbe */ + 0x0010ff, /* U+001cbf */ + 0x001d79, /* U+001d79 */ + 0x001d7d, /* U+001d7d */ + 0x001d8e, /* U+001d8e */ + 0x001e01, /* U+001e00 */ + 0x001e03, /* U+001e02 */ + 0x001e05, /* U+001e04 */ + 0x001e07, /* U+001e06 */ + 0x001e09, /* U+001e08 */ + 0x001e0b, /* U+001e0a */ + 0x001e0d, /* U+001e0c */ + 0x001e0f, /* U+001e0e */ + 0x001e11, /* U+001e10 */ + 0x001e13, /* U+001e12 */ + 0x001e15, /* U+001e14 */ + 0x001e17, /* U+001e16 */ + 0x001e19, /* U+001e18 */ + 0x001e1b, /* U+001e1a */ + 0x001e1d, /* U+001e1c */ + 0x001e1f, /* U+001e1e */ + 0x001e21, /* U+001e20 */ + 0x001e23, /* U+001e22 */ + 0x001e25, /* U+001e24 */ + 0x001e27, /* U+001e26 */ + 0x001e29, /* U+001e28 */ + 0x001e2b, /* U+001e2a */ + 0x001e2d, /* U+001e2c */ + 0x001e2f, /* U+001e2e */ + 0x001e31, /* U+001e30 */ + 0x001e33, /* U+001e32 */ + 0x001e35, /* U+001e34 */ + 0x001e37, /* U+001e36 */ + 0x001e39, /* U+001e38 */ + 0x001e3b, /* U+001e3a */ + 0x001e3d, /* U+001e3c */ + 0x001e3f, /* U+001e3e */ + 0x001e41, /* U+001e40 */ + 0x001e43, /* U+001e42 */ + 0x001e45, /* U+001e44 */ + 0x001e47, /* U+001e46 */ + 0x001e49, /* U+001e48 */ + 0x001e4b, /* U+001e4a */ + 0x001e4d, /* U+001e4c */ + 0x001e4f, /* U+001e4e */ + 0x001e51, /* U+001e50 */ + 0x001e53, /* U+001e52 */ + 0x001e55, /* U+001e54 */ + 0x001e57, /* U+001e56 */ + 0x001e59, /* U+001e58 */ + 0x001e5b, /* U+001e5a */ + 0x001e5d, /* U+001e5c */ + 0x001e5f, /* U+001e5e */ + 0x001e61, /* U+001e60 */ + 0x001e63, /* U+001e62 */ + 0x001e65, /* U+001e64 */ + 0x001e67, /* U+001e66 */ + 0x001e69, /* U+001e68 */ + 0x001e6b, /* U+001e6a */ + 0x001e6d, /* U+001e6c */ + 0x001e6f, /* U+001e6e */ + 0x001e71, /* U+001e70 */ + 0x001e73, /* U+001e72 */ + 0x001e75, /* U+001e74 */ + 0x001e77, /* U+001e76 */ + 0x001e79, /* U+001e78 */ + 0x001e7b, /* U+001e7a */ + 0x001e7d, /* U+001e7c */ + 0x001e7f, /* U+001e7e */ + 0x001e81, /* U+001e80 */ + 0x001e83, /* U+001e82 */ + 0x001e85, /* U+001e84 */ + 0x001e87, /* U+001e86 */ + 0x001e89, /* U+001e88 */ + 0x001e8b, /* U+001e8a */ + 0x001e8d, /* U+001e8c */ + 0x001e8f, /* U+001e8e */ + 0x001e91, /* U+001e90 */ + 0x001e93, /* U+001e92 */ + 0x001e95, /* U+001e94 */ + 0x001e96, /* U+001e96 */ + 0x001e97, /* U+001e97 */ + 0x001e98, /* U+001e98 */ + 0x001e99, /* U+001e99 */ + 0x001e9a, /* U+001e9a */ + 0x001e9b, /* U+001e9b */ + 0x0000df, /* U+001e9e */ + 0x001ea1, /* U+001ea0 */ + 0x001ea3, /* U+001ea2 */ + 0x001ea5, /* U+001ea4 */ + 0x001ea7, /* U+001ea6 */ + 0x001ea9, /* U+001ea8 */ + 0x001eab, /* U+001eaa */ + 0x001ead, /* U+001eac */ + 0x001eaf, /* U+001eae */ + 0x001eb1, /* U+001eb0 */ + 0x001eb3, /* U+001eb2 */ + 0x001eb5, /* U+001eb4 */ + 0x001eb7, /* U+001eb6 */ + 0x001eb9, /* U+001eb8 */ + 0x001ebb, /* U+001eba */ + 0x001ebd, /* U+001ebc */ + 0x001ebf, /* U+001ebe */ + 0x001ec1, /* U+001ec0 */ + 0x001ec3, /* U+001ec2 */ + 0x001ec5, /* U+001ec4 */ + 0x001ec7, /* U+001ec6 */ + 0x001ec9, /* U+001ec8 */ + 0x001ecb, /* U+001eca */ + 0x001ecd, /* U+001ecc */ + 0x001ecf, /* U+001ece */ + 0x001ed1, /* U+001ed0 */ + 0x001ed3, /* U+001ed2 */ + 0x001ed5, /* U+001ed4 */ + 0x001ed7, /* U+001ed6 */ + 0x001ed9, /* U+001ed8 */ + 0x001edb, /* U+001eda */ + 0x001edd, /* U+001edc */ + 0x001edf, /* U+001ede */ + 0x001ee1, /* U+001ee0 */ + 0x001ee3, /* U+001ee2 */ + 0x001ee5, /* U+001ee4 */ + 0x001ee7, /* U+001ee6 */ + 0x001ee9, /* U+001ee8 */ + 0x001eeb, /* U+001eea */ + 0x001eed, /* U+001eec */ + 0x001eef, /* U+001eee */ + 0x001ef1, /* U+001ef0 */ + 0x001ef3, /* U+001ef2 */ + 0x001ef5, /* U+001ef4 */ + 0x001ef7, /* U+001ef6 */ + 0x001ef9, /* U+001ef8 */ + 0x001efb, /* U+001efa */ + 0x001efd, /* U+001efc */ + 0x001eff, /* U+001efe */ + 0x001f00, /* U+001f00 */ + 0x001f01, /* U+001f01 */ + 0x001f02, /* U+001f02 */ + 0x001f03, /* U+001f03 */ + 0x001f04, /* U+001f04 */ + 0x001f05, /* U+001f05 */ + 0x001f06, /* U+001f06 */ + 0x001f07, /* U+001f07 */ + 0x001f10, /* U+001f10 */ + 0x001f11, /* U+001f11 */ + 0x001f12, /* U+001f12 */ + 0x001f13, /* U+001f13 */ + 0x001f14, /* U+001f14 */ + 0x001f15, /* U+001f15 */ + 0x001f20, /* U+001f20 */ + 0x001f21, /* U+001f21 */ + 0x001f22, /* U+001f22 */ + 0x001f23, /* U+001f23 */ + 0x001f24, /* U+001f24 */ + 0x001f25, /* U+001f25 */ + 0x001f26, /* U+001f26 */ + 0x001f27, /* U+001f27 */ + 0x001f30, /* U+001f30 */ + 0x001f31, /* U+001f31 */ + 0x001f32, /* U+001f32 */ + 0x001f33, /* U+001f33 */ + 0x001f34, /* U+001f34 */ + 0x001f35, /* U+001f35 */ + 0x001f36, /* U+001f36 */ + 0x001f37, /* U+001f37 */ + 0x001f40, /* U+001f40 */ + 0x001f41, /* U+001f41 */ + 0x001f42, /* U+001f42 */ + 0x001f43, /* U+001f43 */ + 0x001f44, /* U+001f44 */ + 0x001f45, /* U+001f45 */ + 0x001f50, /* U+001f50 */ + 0x001f51, /* U+001f51 */ + 0x001f52, /* U+001f52 */ + 0x001f53, /* U+001f53 */ + 0x001f54, /* U+001f54 */ + 0x001f55, /* U+001f55 */ + 0x001f56, /* U+001f56 */ + 0x001f57, /* U+001f57 */ + 0x001f60, /* U+001f60 */ + 0x001f61, /* U+001f61 */ + 0x001f62, /* U+001f62 */ + 0x001f63, /* U+001f63 */ + 0x001f64, /* U+001f64 */ + 0x001f65, /* U+001f65 */ + 0x001f66, /* U+001f66 */ + 0x001f67, /* U+001f67 */ + 0x001f70, /* U+001f70 */ + 0x001f71, /* U+001f71 */ + 0x001f72, /* U+001f72 */ + 0x001f73, /* U+001f73 */ + 0x001f74, /* U+001f74 */ + 0x001f75, /* U+001f75 */ + 0x001f76, /* U+001f76 */ + 0x001f77, /* U+001f77 */ + 0x001f78, /* U+001f78 */ + 0x001f79, /* U+001f79 */ + 0x001f7a, /* U+001f7a */ + 0x001f7b, /* U+001f7b */ + 0x001f7c, /* U+001f7c */ + 0x001f7d, /* U+001f7d */ + 0x001f80, /* U+001f80 */ + 0x001f81, /* U+001f81 */ + 0x001f82, /* U+001f82 */ + 0x001f83, /* U+001f83 */ + 0x001f84, /* U+001f84 */ + 0x001f85, /* U+001f85 */ + 0x001f86, /* U+001f86 */ + 0x001f87, /* U+001f87 */ + 0x001f80, /* U+001f88 */ + 0x001f81, /* U+001f89 */ + 0x001f82, /* U+001f8a */ + 0x001f83, /* U+001f8b */ + 0x001f84, /* U+001f8c */ + 0x001f85, /* U+001f8d */ + 0x001f86, /* U+001f8e */ + 0x001f87, /* U+001f8f */ + 0x001f90, /* U+001f90 */ + 0x001f91, /* U+001f91 */ + 0x001f92, /* U+001f92 */ + 0x001f93, /* U+001f93 */ + 0x001f94, /* U+001f94 */ + 0x001f95, /* U+001f95 */ + 0x001f96, /* U+001f96 */ + 0x001f97, /* U+001f97 */ + 0x001f90, /* U+001f98 */ + 0x001f91, /* U+001f99 */ + 0x001f92, /* U+001f9a */ + 0x001f93, /* U+001f9b */ + 0x001f94, /* U+001f9c */ + 0x001f95, /* U+001f9d */ + 0x001f96, /* U+001f9e */ + 0x001f97, /* U+001f9f */ + 0x001fa0, /* U+001fa0 */ + 0x001fa1, /* U+001fa1 */ + 0x001fa2, /* U+001fa2 */ + 0x001fa3, /* U+001fa3 */ + 0x001fa4, /* U+001fa4 */ + 0x001fa5, /* U+001fa5 */ + 0x001fa6, /* U+001fa6 */ + 0x001fa7, /* U+001fa7 */ + 0x001fa0, /* U+001fa8 */ + 0x001fa1, /* U+001fa9 */ + 0x001fa2, /* U+001faa */ + 0x001fa3, /* U+001fab */ + 0x001fa4, /* U+001fac */ + 0x001fa5, /* U+001fad */ + 0x001fa6, /* U+001fae */ + 0x001fa7, /* U+001faf */ + 0x001fb0, /* U+001fb0 */ + 0x001fb1, /* U+001fb1 */ + 0x001fb2, /* U+001fb2 */ + 0x001fb3, /* U+001fb3 */ + 0x001fb4, /* U+001fb4 */ + 0x001fb6, /* U+001fb6 */ + 0x001fb7, /* U+001fb7 */ + 0x001fb3, /* U+001fbc */ + 0x001fbe, /* U+001fbe */ + 0x001fc2, /* U+001fc2 */ + 0x001fc3, /* U+001fc3 */ + 0x001fc4, /* U+001fc4 */ + 0x001fc6, /* U+001fc6 */ + 0x001fc7, /* U+001fc7 */ + 0x001fc3, /* U+001fcc */ + 0x001fd0, /* U+001fd0 */ + 0x001fd1, /* U+001fd1 */ + 0x001fd2, /* U+001fd2 */ + 0x001fd3, /* U+001fd3 */ + 0x001fd6, /* U+001fd6 */ + 0x001fd7, /* U+001fd7 */ + 0x001fe0, /* U+001fe0 */ + 0x001fe1, /* U+001fe1 */ + 0x001fe2, /* U+001fe2 */ + 0x001fe3, /* U+001fe3 */ + 0x001fe4, /* U+001fe4 */ + 0x001fe5, /* U+001fe5 */ + 0x001fe6, /* U+001fe6 */ + 0x001fe7, /* U+001fe7 */ + 0x001ff2, /* U+001ff2 */ + 0x001ff3, /* U+001ff3 */ + 0x001ff4, /* U+001ff4 */ + 0x001ff6, /* U+001ff6 */ + 0x001ff7, /* U+001ff7 */ + 0x001ff3, /* U+001ffc */ + 0x0003c9, /* U+002126 */ + 0x00006b, /* U+00212a */ + 0x0000e5, /* U+00212b */ + 0x00214e, /* U+002132 */ + 0x002170, /* U+002160 */ + 0x002171, /* U+002161 */ + 0x002172, /* U+002162 */ + 0x002173, /* U+002163 */ + 0x002174, /* U+002164 */ + 0x002175, /* U+002165 */ + 0x002176, /* U+002166 */ + 0x002177, /* U+002167 */ + 0x002178, /* U+002168 */ + 0x002179, /* U+002169 */ + 0x00217a, /* U+00216a */ + 0x00217b, /* U+00216b */ + 0x00217c, /* U+00216c */ + 0x00217d, /* U+00216d */ + 0x00217e, /* U+00216e */ + 0x00217f, /* U+00216f */ + 0x002184, /* U+002183 */ + 0x0024d0, /* U+0024b6 */ + 0x0024d1, /* U+0024b7 */ + 0x0024d2, /* U+0024b8 */ + 0x0024d3, /* U+0024b9 */ + 0x0024d4, /* U+0024ba */ + 0x0024d5, /* U+0024bb */ + 0x0024d6, /* U+0024bc */ + 0x0024d7, /* U+0024bd */ + 0x0024d8, /* U+0024be */ + 0x0024d9, /* U+0024bf */ + 0x0024da, /* U+0024c0 */ + 0x0024db, /* U+0024c1 */ + 0x0024dc, /* U+0024c2 */ + 0x0024dd, /* U+0024c3 */ + 0x0024de, /* U+0024c4 */ + 0x0024df, /* U+0024c5 */ + 0x0024e0, /* U+0024c6 */ + 0x0024e1, /* U+0024c7 */ + 0x0024e2, /* U+0024c8 */ + 0x0024e3, /* U+0024c9 */ + 0x0024e4, /* U+0024ca */ + 0x0024e5, /* U+0024cb */ + 0x0024e6, /* U+0024cc */ + 0x0024e7, /* U+0024cd */ + 0x0024e8, /* U+0024ce */ + 0x0024e9, /* U+0024cf */ + 0x002c30, /* U+002c00 */ + 0x002c31, /* U+002c01 */ + 0x002c32, /* U+002c02 */ + 0x002c33, /* U+002c03 */ + 0x002c34, /* U+002c04 */ + 0x002c35, /* U+002c05 */ + 0x002c36, /* U+002c06 */ + 0x002c37, /* U+002c07 */ + 0x002c38, /* U+002c08 */ + 0x002c39, /* U+002c09 */ + 0x002c3a, /* U+002c0a */ + 0x002c3b, /* U+002c0b */ + 0x002c3c, /* U+002c0c */ + 0x002c3d, /* U+002c0d */ + 0x002c3e, /* U+002c0e */ + 0x002c3f, /* U+002c0f */ + 0x002c40, /* U+002c10 */ + 0x002c41, /* U+002c11 */ + 0x002c42, /* U+002c12 */ + 0x002c43, /* U+002c13 */ + 0x002c44, /* U+002c14 */ + 0x002c45, /* U+002c15 */ + 0x002c46, /* U+002c16 */ + 0x002c47, /* U+002c17 */ + 0x002c48, /* U+002c18 */ + 0x002c49, /* U+002c19 */ + 0x002c4a, /* U+002c1a */ + 0x002c4b, /* U+002c1b */ + 0x002c4c, /* U+002c1c */ + 0x002c4d, /* U+002c1d */ + 0x002c4e, /* U+002c1e */ + 0x002c4f, /* U+002c1f */ + 0x002c50, /* U+002c20 */ + 0x002c51, /* U+002c21 */ + 0x002c52, /* U+002c22 */ + 0x002c53, /* U+002c23 */ + 0x002c54, /* U+002c24 */ + 0x002c55, /* U+002c25 */ + 0x002c56, /* U+002c26 */ + 0x002c57, /* U+002c27 */ + 0x002c58, /* U+002c28 */ + 0x002c59, /* U+002c29 */ + 0x002c5a, /* U+002c2a */ + 0x002c5b, /* U+002c2b */ + 0x002c5c, /* U+002c2c */ + 0x002c5d, /* U+002c2d */ + 0x002c5e, /* U+002c2e */ + 0x002c5f, /* U+002c2f */ + 0x002c61, /* U+002c60 */ + 0x002c68, /* U+002c67 */ + 0x002c6a, /* U+002c69 */ + 0x002c6c, /* U+002c6b */ + 0x002c73, /* U+002c72 */ + 0x002c76, /* U+002c75 */ + 0x002c81, /* U+002c80 */ + 0x002c83, /* U+002c82 */ + 0x002c85, /* U+002c84 */ + 0x002c87, /* U+002c86 */ + 0x002c89, /* U+002c88 */ + 0x002c8b, /* U+002c8a */ + 0x002c8d, /* U+002c8c */ + 0x002c8f, /* U+002c8e */ + 0x002c91, /* U+002c90 */ + 0x002c93, /* U+002c92 */ + 0x002c95, /* U+002c94 */ + 0x002c97, /* U+002c96 */ + 0x002c99, /* U+002c98 */ + 0x002c9b, /* U+002c9a */ + 0x002c9d, /* U+002c9c */ + 0x002c9f, /* U+002c9e */ + 0x002ca1, /* U+002ca0 */ + 0x002ca3, /* U+002ca2 */ + 0x002ca5, /* U+002ca4 */ + 0x002ca7, /* U+002ca6 */ + 0x002ca9, /* U+002ca8 */ + 0x002cab, /* U+002caa */ + 0x002cad, /* U+002cac */ + 0x002caf, /* U+002cae */ + 0x002cb1, /* U+002cb0 */ + 0x002cb3, /* U+002cb2 */ + 0x002cb5, /* U+002cb4 */ + 0x002cb7, /* U+002cb6 */ + 0x002cb9, /* U+002cb8 */ + 0x002cbb, /* U+002cba */ + 0x002cbd, /* U+002cbc */ + 0x002cbf, /* U+002cbe */ + 0x002cc1, /* U+002cc0 */ + 0x002cc3, /* U+002cc2 */ + 0x002cc5, /* U+002cc4 */ + 0x002cc7, /* U+002cc6 */ + 0x002cc9, /* U+002cc8 */ + 0x002ccb, /* U+002cca */ + 0x002ccd, /* U+002ccc */ + 0x002ccf, /* U+002cce */ + 0x002cd1, /* U+002cd0 */ + 0x002cd3, /* U+002cd2 */ + 0x002cd5, /* U+002cd4 */ + 0x002cd7, /* U+002cd6 */ + 0x002cd9, /* U+002cd8 */ + 0x002cdb, /* U+002cda */ + 0x002cdd, /* U+002cdc */ + 0x002cdf, /* U+002cde */ + 0x002ce1, /* U+002ce0 */ + 0x002ce3, /* U+002ce2 */ + 0x002cec, /* U+002ceb */ + 0x002cee, /* U+002ced */ + 0x002cf3, /* U+002cf2 */ + 0x00a641, /* U+00a640 */ + 0x00a643, /* U+00a642 */ + 0x00a645, /* U+00a644 */ + 0x00a647, /* U+00a646 */ + 0x00a649, /* U+00a648 */ + 0x00a64b, /* U+00a64a */ + 0x00a64d, /* U+00a64c */ + 0x00a64f, /* U+00a64e */ + 0x00a651, /* U+00a650 */ + 0x00a653, /* U+00a652 */ + 0x00a655, /* U+00a654 */ + 0x00a657, /* U+00a656 */ + 0x00a659, /* U+00a658 */ + 0x00a65b, /* U+00a65a */ + 0x00a65d, /* U+00a65c */ + 0x00a65f, /* U+00a65e */ + 0x00a661, /* U+00a660 */ + 0x00a663, /* U+00a662 */ + 0x00a665, /* U+00a664 */ + 0x00a667, /* U+00a666 */ + 0x00a669, /* U+00a668 */ + 0x00a66b, /* U+00a66a */ + 0x00a66d, /* U+00a66c */ + 0x00a681, /* U+00a680 */ + 0x00a683, /* U+00a682 */ + 0x00a685, /* U+00a684 */ + 0x00a687, /* U+00a686 */ + 0x00a689, /* U+00a688 */ + 0x00a68b, /* U+00a68a */ + 0x00a68d, /* U+00a68c */ + 0x00a68f, /* U+00a68e */ + 0x00a691, /* U+00a690 */ + 0x00a693, /* U+00a692 */ + 0x00a695, /* U+00a694 */ + 0x00a697, /* U+00a696 */ + 0x00a699, /* U+00a698 */ + 0x00a69b, /* U+00a69a */ + 0x00a723, /* U+00a722 */ + 0x00a725, /* U+00a724 */ + 0x00a727, /* U+00a726 */ + 0x00a729, /* U+00a728 */ + 0x00a72b, /* U+00a72a */ + 0x00a72d, /* U+00a72c */ + 0x00a72f, /* U+00a72e */ + 0x00a733, /* U+00a732 */ + 0x00a735, /* U+00a734 */ + 0x00a737, /* U+00a736 */ + 0x00a739, /* U+00a738 */ + 0x00a73b, /* U+00a73a */ + 0x00a73d, /* U+00a73c */ + 0x00a73f, /* U+00a73e */ + 0x00a741, /* U+00a740 */ + 0x00a743, /* U+00a742 */ + 0x00a745, /* U+00a744 */ + 0x00a747, /* U+00a746 */ + 0x00a749, /* U+00a748 */ + 0x00a74b, /* U+00a74a */ + 0x00a74d, /* U+00a74c */ + 0x00a74f, /* U+00a74e */ + 0x00a751, /* U+00a750 */ + 0x00a753, /* U+00a752 */ + 0x00a755, /* U+00a754 */ + 0x00a757, /* U+00a756 */ + 0x00a759, /* U+00a758 */ + 0x00a75b, /* U+00a75a */ + 0x00a75d, /* U+00a75c */ + 0x00a75f, /* U+00a75e */ + 0x00a761, /* U+00a760 */ + 0x00a763, /* U+00a762 */ + 0x00a765, /* U+00a764 */ + 0x00a767, /* U+00a766 */ + 0x00a769, /* U+00a768 */ + 0x00a76b, /* U+00a76a */ + 0x00a76d, /* U+00a76c */ + 0x00a76f, /* U+00a76e */ + 0x00a77a, /* U+00a779 */ + 0x00a77c, /* U+00a77b */ + 0x00a77f, /* U+00a77e */ + 0x00a781, /* U+00a780 */ + 0x00a783, /* U+00a782 */ + 0x00a785, /* U+00a784 */ + 0x00a787, /* U+00a786 */ + 0x00a78c, /* U+00a78b */ + 0x00a791, /* U+00a790 */ + 0x00a793, /* U+00a792 */ + 0x00a794, /* U+00a794 */ + 0x00a797, /* U+00a796 */ + 0x00a799, /* U+00a798 */ + 0x00a79b, /* U+00a79a */ + 0x00a79d, /* U+00a79c */ + 0x00a79f, /* U+00a79e */ + 0x00a7a1, /* U+00a7a0 */ + 0x00a7a3, /* U+00a7a2 */ + 0x00a7a5, /* U+00a7a4 */ + 0x00a7a7, /* U+00a7a6 */ + 0x00a7a9, /* U+00a7a8 */ + 0x00ab53, /* U+00a7b3 */ + 0x00a7b5, /* U+00a7b4 */ + 0x00a7b7, /* U+00a7b6 */ + 0x00a7b9, /* U+00a7b8 */ + 0x00a7bb, /* U+00a7ba */ + 0x00a7bd, /* U+00a7bc */ + 0x00a7bf, /* U+00a7be */ + 0x00a7c1, /* U+00a7c0 */ + 0x00a7c3, /* U+00a7c2 */ + 0x00a7c8, /* U+00a7c7 */ + 0x00a7ca, /* U+00a7c9 */ + 0x00a7cd, /* U+00a7cc */ + 0x00a7d1, /* U+00a7d0 */ + 0x00a7d7, /* U+00a7d6 */ + 0x00a7d9, /* U+00a7d8 */ + 0x00a7db, /* U+00a7da */ + 0x00a7f6, /* U+00a7f5 */ + 0x00fb00, /* U+00fb00 */ + 0x00fb01, /* U+00fb01 */ + 0x00fb02, /* U+00fb02 */ + 0x00fb03, /* U+00fb03 */ + 0x00fb04, /* U+00fb04 */ + 0x00fb05, /* U+00fb05 */ + 0x00fb06, /* U+00fb06 */ + 0x00fb13, /* U+00fb13 */ + 0x00fb14, /* U+00fb14 */ + 0x00fb15, /* U+00fb15 */ + 0x00fb16, /* U+00fb16 */ + 0x00fb17, /* U+00fb17 */ + 0x00ff41, /* U+00ff21 */ + 0x00ff42, /* U+00ff22 */ + 0x00ff43, /* U+00ff23 */ + 0x00ff44, /* U+00ff24 */ + 0x00ff45, /* U+00ff25 */ + 0x00ff46, /* U+00ff26 */ + 0x00ff47, /* U+00ff27 */ + 0x00ff48, /* U+00ff28 */ + 0x00ff49, /* U+00ff29 */ + 0x00ff4a, /* U+00ff2a */ + 0x00ff4b, /* U+00ff2b */ + 0x00ff4c, /* U+00ff2c */ + 0x00ff4d, /* U+00ff2d */ + 0x00ff4e, /* U+00ff2e */ + 0x00ff4f, /* U+00ff2f */ + 0x00ff50, /* U+00ff30 */ + 0x00ff51, /* U+00ff31 */ + 0x00ff52, /* U+00ff32 */ + 0x00ff53, /* U+00ff33 */ + 0x00ff54, /* U+00ff34 */ + 0x00ff55, /* U+00ff35 */ + 0x00ff56, /* U+00ff36 */ + 0x00ff57, /* U+00ff37 */ + 0x00ff58, /* U+00ff38 */ + 0x00ff59, /* U+00ff39 */ + 0x00ff5a, /* U+00ff3a */ + 0x010428, /* U+010400 */ + 0x010429, /* U+010401 */ + 0x01042a, /* U+010402 */ + 0x01042b, /* U+010403 */ + 0x01042c, /* U+010404 */ + 0x01042d, /* U+010405 */ + 0x01042e, /* U+010406 */ + 0x01042f, /* U+010407 */ + 0x010430, /* U+010408 */ + 0x010431, /* U+010409 */ + 0x010432, /* U+01040a */ + 0x010433, /* U+01040b */ + 0x010434, /* U+01040c */ + 0x010435, /* U+01040d */ + 0x010436, /* U+01040e */ + 0x010437, /* U+01040f */ + 0x010438, /* U+010410 */ + 0x010439, /* U+010411 */ + 0x01043a, /* U+010412 */ + 0x01043b, /* U+010413 */ + 0x01043c, /* U+010414 */ + 0x01043d, /* U+010415 */ + 0x01043e, /* U+010416 */ + 0x01043f, /* U+010417 */ + 0x010440, /* U+010418 */ + 0x010441, /* U+010419 */ + 0x010442, /* U+01041a */ + 0x010443, /* U+01041b */ + 0x010444, /* U+01041c */ + 0x010445, /* U+01041d */ + 0x010446, /* U+01041e */ + 0x010447, /* U+01041f */ + 0x010448, /* U+010420 */ + 0x010449, /* U+010421 */ + 0x01044a, /* U+010422 */ + 0x01044b, /* U+010423 */ + 0x01044c, /* U+010424 */ + 0x01044d, /* U+010425 */ + 0x01044e, /* U+010426 */ + 0x01044f, /* U+010427 */ + 0x0104d8, /* U+0104b0 */ + 0x0104d9, /* U+0104b1 */ + 0x0104da, /* U+0104b2 */ + 0x0104db, /* U+0104b3 */ + 0x0104dc, /* U+0104b4 */ + 0x0104dd, /* U+0104b5 */ + 0x0104de, /* U+0104b6 */ + 0x0104df, /* U+0104b7 */ + 0x0104e0, /* U+0104b8 */ + 0x0104e1, /* U+0104b9 */ + 0x0104e2, /* U+0104ba */ + 0x0104e3, /* U+0104bb */ + 0x0104e4, /* U+0104bc */ + 0x0104e5, /* U+0104bd */ + 0x0104e6, /* U+0104be */ + 0x0104e7, /* U+0104bf */ + 0x0104e8, /* U+0104c0 */ + 0x0104e9, /* U+0104c1 */ + 0x0104ea, /* U+0104c2 */ + 0x0104eb, /* U+0104c3 */ + 0x0104ec, /* U+0104c4 */ + 0x0104ed, /* U+0104c5 */ + 0x0104ee, /* U+0104c6 */ + 0x0104ef, /* U+0104c7 */ + 0x0104f0, /* U+0104c8 */ + 0x0104f1, /* U+0104c9 */ + 0x0104f2, /* U+0104ca */ + 0x0104f3, /* U+0104cb */ + 0x0104f4, /* U+0104cc */ + 0x0104f5, /* U+0104cd */ + 0x0104f6, /* U+0104ce */ + 0x0104f7, /* U+0104cf */ + 0x0104f8, /* U+0104d0 */ + 0x0104f9, /* U+0104d1 */ + 0x0104fa, /* U+0104d2 */ + 0x0104fb, /* U+0104d3 */ + 0x010597, /* U+010570 */ + 0x010598, /* U+010571 */ + 0x010599, /* U+010572 */ + 0x01059a, /* U+010573 */ + 0x01059b, /* U+010574 */ + 0x01059c, /* U+010575 */ + 0x01059d, /* U+010576 */ + 0x01059e, /* U+010577 */ + 0x01059f, /* U+010578 */ + 0x0105a0, /* U+010579 */ + 0x0105a1, /* U+01057a */ + 0x0105a3, /* U+01057c */ + 0x0105a4, /* U+01057d */ + 0x0105a5, /* U+01057e */ + 0x0105a6, /* U+01057f */ + 0x0105a7, /* U+010580 */ + 0x0105a8, /* U+010581 */ + 0x0105a9, /* U+010582 */ + 0x0105aa, /* U+010583 */ + 0x0105ab, /* U+010584 */ + 0x0105ac, /* U+010585 */ + 0x0105ad, /* U+010586 */ + 0x0105ae, /* U+010587 */ + 0x0105af, /* U+010588 */ + 0x0105b0, /* U+010589 */ + 0x0105b1, /* U+01058a */ + 0x0105b3, /* U+01058c */ + 0x0105b4, /* U+01058d */ + 0x0105b5, /* U+01058e */ + 0x0105b6, /* U+01058f */ + 0x0105b7, /* U+010590 */ + 0x0105b8, /* U+010591 */ + 0x0105b9, /* U+010592 */ + 0x0105bb, /* U+010594 */ + 0x0105bc, /* U+010595 */ + 0x010cc0, /* U+010c80 */ + 0x010cc1, /* U+010c81 */ + 0x010cc2, /* U+010c82 */ + 0x010cc3, /* U+010c83 */ + 0x010cc4, /* U+010c84 */ + 0x010cc5, /* U+010c85 */ + 0x010cc6, /* U+010c86 */ + 0x010cc7, /* U+010c87 */ + 0x010cc8, /* U+010c88 */ + 0x010cc9, /* U+010c89 */ + 0x010cca, /* U+010c8a */ + 0x010ccb, /* U+010c8b */ + 0x010ccc, /* U+010c8c */ + 0x010ccd, /* U+010c8d */ + 0x010cce, /* U+010c8e */ + 0x010ccf, /* U+010c8f */ + 0x010cd0, /* U+010c90 */ + 0x010cd1, /* U+010c91 */ + 0x010cd2, /* U+010c92 */ + 0x010cd3, /* U+010c93 */ + 0x010cd4, /* U+010c94 */ + 0x010cd5, /* U+010c95 */ + 0x010cd6, /* U+010c96 */ + 0x010cd7, /* U+010c97 */ + 0x010cd8, /* U+010c98 */ + 0x010cd9, /* U+010c99 */ + 0x010cda, /* U+010c9a */ + 0x010cdb, /* U+010c9b */ + 0x010cdc, /* U+010c9c */ + 0x010cdd, /* U+010c9d */ + 0x010cde, /* U+010c9e */ + 0x010cdf, /* U+010c9f */ + 0x010ce0, /* U+010ca0 */ + 0x010ce1, /* U+010ca1 */ + 0x010ce2, /* U+010ca2 */ + 0x010ce3, /* U+010ca3 */ + 0x010ce4, /* U+010ca4 */ + 0x010ce5, /* U+010ca5 */ + 0x010ce6, /* U+010ca6 */ + 0x010ce7, /* U+010ca7 */ + 0x010ce8, /* U+010ca8 */ + 0x010ce9, /* U+010ca9 */ + 0x010cea, /* U+010caa */ + 0x010ceb, /* U+010cab */ + 0x010cec, /* U+010cac */ + 0x010ced, /* U+010cad */ + 0x010cee, /* U+010cae */ + 0x010cef, /* U+010caf */ + 0x010cf0, /* U+010cb0 */ + 0x010cf1, /* U+010cb1 */ + 0x010cf2, /* U+010cb2 */ + 0x010d70, /* U+010d50 */ + 0x010d71, /* U+010d51 */ + 0x010d72, /* U+010d52 */ + 0x010d73, /* U+010d53 */ + 0x010d74, /* U+010d54 */ + 0x010d75, /* U+010d55 */ + 0x010d76, /* U+010d56 */ + 0x010d77, /* U+010d57 */ + 0x010d78, /* U+010d58 */ + 0x010d79, /* U+010d59 */ + 0x010d7a, /* U+010d5a */ + 0x010d7b, /* U+010d5b */ + 0x010d7c, /* U+010d5c */ + 0x010d7d, /* U+010d5d */ + 0x010d7e, /* U+010d5e */ + 0x010d7f, /* U+010d5f */ + 0x010d80, /* U+010d60 */ + 0x010d81, /* U+010d61 */ + 0x010d82, /* U+010d62 */ + 0x010d83, /* U+010d63 */ + 0x010d84, /* U+010d64 */ + 0x010d85, /* U+010d65 */ + 0x0118c0, /* U+0118a0 */ + 0x0118c1, /* U+0118a1 */ + 0x0118c2, /* U+0118a2 */ + 0x0118c3, /* U+0118a3 */ + 0x0118c4, /* U+0118a4 */ + 0x0118c5, /* U+0118a5 */ + 0x0118c6, /* U+0118a6 */ + 0x0118c7, /* U+0118a7 */ + 0x0118c8, /* U+0118a8 */ + 0x0118c9, /* U+0118a9 */ + 0x0118ca, /* U+0118aa */ + 0x0118cb, /* U+0118ab */ + 0x0118cc, /* U+0118ac */ + 0x0118cd, /* U+0118ad */ + 0x0118ce, /* U+0118ae */ + 0x0118cf, /* U+0118af */ + 0x0118d0, /* U+0118b0 */ + 0x0118d1, /* U+0118b1 */ + 0x0118d2, /* U+0118b2 */ + 0x0118d3, /* U+0118b3 */ + 0x0118d4, /* U+0118b4 */ + 0x0118d5, /* U+0118b5 */ + 0x0118d6, /* U+0118b6 */ + 0x0118d7, /* U+0118b7 */ + 0x0118d8, /* U+0118b8 */ + 0x0118d9, /* U+0118b9 */ + 0x0118da, /* U+0118ba */ + 0x0118db, /* U+0118bb */ + 0x0118dc, /* U+0118bc */ + 0x0118dd, /* U+0118bd */ + 0x0118de, /* U+0118be */ + 0x0118df, /* U+0118bf */ + 0x016e60, /* U+016e40 */ + 0x016e61, /* U+016e41 */ + 0x016e62, /* U+016e42 */ + 0x016e63, /* U+016e43 */ + 0x016e64, /* U+016e44 */ + 0x016e65, /* U+016e45 */ + 0x016e66, /* U+016e46 */ + 0x016e67, /* U+016e47 */ + 0x016e68, /* U+016e48 */ + 0x016e69, /* U+016e49 */ + 0x016e6a, /* U+016e4a */ + 0x016e6b, /* U+016e4b */ + 0x016e6c, /* U+016e4c */ + 0x016e6d, /* U+016e4d */ + 0x016e6e, /* U+016e4e */ + 0x016e6f, /* U+016e4f */ + 0x016e70, /* U+016e50 */ + 0x016e71, /* U+016e51 */ + 0x016e72, /* U+016e52 */ + 0x016e73, /* U+016e53 */ + 0x016e74, /* U+016e54 */ + 0x016e75, /* U+016e55 */ + 0x016e76, /* U+016e56 */ + 0x016e77, /* U+016e57 */ + 0x016e78, /* U+016e58 */ + 0x016e79, /* U+016e59 */ + 0x016e7a, /* U+016e5a */ + 0x016e7b, /* U+016e5b */ + 0x016e7c, /* U+016e5c */ + 0x016e7d, /* U+016e5d */ + 0x016e7e, /* U+016e5e */ + 0x016e7f, /* U+016e5f */ + 0x01e922, /* U+01e900 */ + 0x01e923, /* U+01e901 */ + 0x01e924, /* U+01e902 */ + 0x01e925, /* U+01e903 */ + 0x01e926, /* U+01e904 */ + 0x01e927, /* U+01e905 */ + 0x01e928, /* U+01e906 */ + 0x01e929, /* U+01e907 */ + 0x01e92a, /* U+01e908 */ + 0x01e92b, /* U+01e909 */ + 0x01e92c, /* U+01e90a */ + 0x01e92d, /* U+01e90b */ + 0x01e92e, /* U+01e90c */ + 0x01e92f, /* U+01e90d */ + 0x01e930, /* U+01e90e */ + 0x01e931, /* U+01e90f */ + 0x01e932, /* U+01e910 */ + 0x01e933, /* U+01e911 */ + 0x01e934, /* U+01e912 */ + 0x01e935, /* U+01e913 */ + 0x01e936, /* U+01e914 */ + 0x01e937, /* U+01e915 */ + 0x01e938, /* U+01e916 */ + 0x01e939, /* U+01e917 */ + 0x01e93a, /* U+01e918 */ + 0x01e93b, /* U+01e919 */ + 0x01e93c, /* U+01e91a */ + 0x01e93d, /* U+01e91b */ + 0x01e93e, /* U+01e91c */ + 0x01e93f, /* U+01e91d */ + 0x01e940, /* U+01e91e */ + 0x01e941, /* U+01e91f */ + 0x01e942, /* U+01e920 */ + 0x01e943, /* U+01e921 */ + +}; + +/* + * The entry case_map_title[case_index(codepoint)] is the mapping for the + * given codepoint. + */ +static const pg_wchar case_map_title[1704] = +{ + 0x000000, /* reserved */ + 0x000000, /* U+000000 */ + 0x000001, /* U+000001 */ + 0x000002, /* U+000002 */ + 0x000003, /* U+000003 */ + 0x000004, /* U+000004 */ + 0x000005, /* U+000005 */ + 0x000006, /* U+000006 */ + 0x000007, /* U+000007 */ + 0x000008, /* U+000008 */ + 0x000009, /* U+000009 */ + 0x00000a, /* U+00000a */ + 0x00000b, /* U+00000b */ + 0x00000c, /* U+00000c */ + 0x00000d, /* U+00000d */ + 0x00000e, /* U+00000e */ + 0x00000f, /* U+00000f */ + 0x000010, /* U+000010 */ + 0x000011, /* U+000011 */ + 0x000012, /* U+000012 */ + 0x000013, /* U+000013 */ + 0x000014, /* U+000014 */ + 0x000015, /* U+000015 */ + 0x000016, /* U+000016 */ + 0x000017, /* U+000017 */ + 0x000018, /* U+000018 */ + 0x000019, /* U+000019 */ + 0x00001a, /* U+00001a */ + 0x00001b, /* U+00001b */ + 0x00001c, /* U+00001c */ + 0x00001d, /* U+00001d */ + 0x00001e, /* U+00001e */ + 0x00001f, /* U+00001f */ + 0x000020, /* U+000020 */ + 0x000021, /* U+000021 */ + 0x000022, /* U+000022 */ + 0x000023, /* U+000023 */ + 0x000024, /* U+000024 */ + 0x000025, /* U+000025 */ + 0x000026, /* U+000026 */ + 0x000027, /* U+000027 */ + 0x000028, /* U+000028 */ + 0x000029, /* U+000029 */ + 0x00002a, /* U+00002a */ + 0x00002b, /* U+00002b */ + 0x00002c, /* U+00002c */ + 0x00002d, /* U+00002d */ + 0x00002e, /* U+00002e */ + 0x00002f, /* U+00002f */ + 0x000030, /* U+000030 */ + 0x000031, /* U+000031 */ + 0x000032, /* U+000032 */ + 0x000033, /* U+000033 */ + 0x000034, /* U+000034 */ + 0x000035, /* U+000035 */ + 0x000036, /* U+000036 */ + 0x000037, /* U+000037 */ + 0x000038, /* U+000038 */ + 0x000039, /* U+000039 */ + 0x00003a, /* U+00003a */ + 0x00003b, /* U+00003b */ + 0x00003c, /* U+00003c */ + 0x00003d, /* U+00003d */ + 0x00003e, /* U+00003e */ + 0x00003f, /* U+00003f */ + 0x000040, /* U+000040 */ + 0x000041, /* U+000041 */ + 0x000042, /* U+000042 */ + 0x000043, /* U+000043 */ + 0x000044, /* U+000044 */ + 0x000045, /* U+000045 */ + 0x000046, /* U+000046 */ + 0x000047, /* U+000047 */ + 0x000048, /* U+000048 */ + 0x000049, /* U+000049 */ + 0x00004a, /* U+00004a */ + 0x00004b, /* U+00004b */ + 0x00004c, /* U+00004c */ + 0x00004d, /* U+00004d */ + 0x00004e, /* U+00004e */ + 0x00004f, /* U+00004f */ + 0x000050, /* U+000050 */ + 0x000051, /* U+000051 */ + 0x000052, /* U+000052 */ + 0x000053, /* U+000053 */ + 0x000054, /* U+000054 */ + 0x000055, /* U+000055 */ + 0x000056, /* U+000056 */ + 0x000057, /* U+000057 */ + 0x000058, /* U+000058 */ + 0x000059, /* U+000059 */ + 0x00005a, /* U+00005a */ + 0x00005b, /* U+00005b */ + 0x00005c, /* U+00005c */ + 0x00005d, /* U+00005d */ + 0x00005e, /* U+00005e */ + 0x00005f, /* U+00005f */ + 0x000060, /* U+000060 */ + 0x000041, /* U+000061 */ + 0x000042, /* U+000062 */ + 0x000043, /* U+000063 */ + 0x000044, /* U+000064 */ + 0x000045, /* U+000065 */ + 0x000046, /* U+000066 */ + 0x000047, /* U+000067 */ + 0x000048, /* U+000068 */ + 0x000049, /* U+000069 */ + 0x00004a, /* U+00006a */ + 0x00004b, /* U+00006b */ + 0x00004c, /* U+00006c */ + 0x00004d, /* U+00006d */ + 0x00004e, /* U+00006e */ + 0x00004f, /* U+00006f */ + 0x000050, /* U+000070 */ + 0x000051, /* U+000071 */ + 0x000052, /* U+000072 */ + 0x000053, /* U+000073 */ + 0x000054, /* U+000074 */ + 0x000055, /* U+000075 */ + 0x000056, /* U+000076 */ + 0x000057, /* U+000077 */ + 0x000058, /* U+000078 */ + 0x000059, /* U+000079 */ + 0x00005a, /* U+00007a */ + 0x00007b, /* U+00007b */ + 0x00007c, /* U+00007c */ + 0x00007d, /* U+00007d */ + 0x00007e, /* U+00007e */ + 0x00007f, /* U+00007f */ + 0x00039c, /* U+0000b5 */ + 0x0000c0, /* U+0000c0 */ + 0x0000c1, /* U+0000c1 */ + 0x0000c2, /* U+0000c2 */ + 0x0000c3, /* U+0000c3 */ + 0x0000c4, /* U+0000c4 */ + 0x0000c5, /* U+0000c5 */ + 0x0000c6, /* U+0000c6 */ + 0x0000c7, /* U+0000c7 */ + 0x0000c8, /* U+0000c8 */ + 0x0000c9, /* U+0000c9 */ + 0x0000ca, /* U+0000ca */ + 0x0000cb, /* U+0000cb */ + 0x0000cc, /* U+0000cc */ + 0x0000cd, /* U+0000cd */ + 0x0000ce, /* U+0000ce */ + 0x0000cf, /* U+0000cf */ + 0x0000d0, /* U+0000d0 */ + 0x0000d1, /* U+0000d1 */ + 0x0000d2, /* U+0000d2 */ + 0x0000d3, /* U+0000d3 */ + 0x0000d4, /* U+0000d4 */ + 0x0000d5, /* U+0000d5 */ + 0x0000d6, /* U+0000d6 */ + 0x0000d8, /* U+0000d8 */ + 0x0000d9, /* U+0000d9 */ + 0x0000da, /* U+0000da */ + 0x0000db, /* U+0000db */ + 0x0000dc, /* U+0000dc */ + 0x0000dd, /* U+0000dd */ + 0x0000de, /* U+0000de */ + 0x0000df, /* U+0000df */ + 0x000178, /* U+0000ff */ + 0x000100, /* U+000100 */ + 0x000102, /* U+000102 */ + 0x000104, /* U+000104 */ + 0x000106, /* U+000106 */ + 0x000108, /* U+000108 */ + 0x00010a, /* U+00010a */ + 0x00010c, /* U+00010c */ + 0x00010e, /* U+00010e */ + 0x000110, /* U+000110 */ + 0x000112, /* U+000112 */ + 0x000114, /* U+000114 */ + 0x000116, /* U+000116 */ + 0x000118, /* U+000118 */ + 0x00011a, /* U+00011a */ + 0x00011c, /* U+00011c */ + 0x00011e, /* U+00011e */ + 0x000120, /* U+000120 */ + 0x000122, /* U+000122 */ + 0x000124, /* U+000124 */ + 0x000126, /* U+000126 */ + 0x000128, /* U+000128 */ + 0x00012a, /* U+00012a */ + 0x00012c, /* U+00012c */ + 0x00012e, /* U+00012e */ + 0x000130, /* U+000130 */ + 0x000049, /* U+000131 */ + 0x000132, /* U+000132 */ + 0x000134, /* U+000134 */ + 0x000136, /* U+000136 */ + 0x000139, /* U+000139 */ + 0x00013b, /* U+00013b */ + 0x00013d, /* U+00013d */ + 0x00013f, /* U+00013f */ + 0x000141, /* U+000141 */ + 0x000143, /* U+000143 */ + 0x000145, /* U+000145 */ + 0x000147, /* U+000147 */ + 0x000149, /* U+000149 */ + 0x00014a, /* U+00014a */ + 0x00014c, /* U+00014c */ + 0x00014e, /* U+00014e */ + 0x000150, /* U+000150 */ + 0x000152, /* U+000152 */ + 0x000154, /* U+000154 */ + 0x000156, /* U+000156 */ + 0x000158, /* U+000158 */ + 0x00015a, /* U+00015a */ + 0x00015c, /* U+00015c */ + 0x00015e, /* U+00015e */ + 0x000160, /* U+000160 */ + 0x000162, /* U+000162 */ + 0x000164, /* U+000164 */ + 0x000166, /* U+000166 */ + 0x000168, /* U+000168 */ + 0x00016a, /* U+00016a */ + 0x00016c, /* U+00016c */ + 0x00016e, /* U+00016e */ + 0x000170, /* U+000170 */ + 0x000172, /* U+000172 */ + 0x000174, /* U+000174 */ + 0x000176, /* U+000176 */ + 0x000179, /* U+000179 */ + 0x00017b, /* U+00017b */ + 0x00017d, /* U+00017d */ + 0x000053, /* U+00017f */ + 0x000243, /* U+000180 */ + 0x000181, /* U+000181 */ + 0x000182, /* U+000182 */ + 0x000184, /* U+000184 */ + 0x000186, /* U+000186 */ + 0x000187, /* U+000187 */ + 0x000189, /* U+000189 */ + 0x00018a, /* U+00018a */ + 0x00018b, /* U+00018b */ + 0x00018e, /* U+00018e */ + 0x00018f, /* U+00018f */ + 0x000190, /* U+000190 */ + 0x000191, /* U+000191 */ + 0x000193, /* U+000193 */ + 0x000194, /* U+000194 */ + 0x0001f6, /* U+000195 */ + 0x000196, /* U+000196 */ + 0x000197, /* U+000197 */ + 0x000198, /* U+000198 */ + 0x00023d, /* U+00019a */ + 0x00a7dc, /* U+00019b */ + 0x00019c, /* U+00019c */ + 0x00019d, /* U+00019d */ + 0x000220, /* U+00019e */ + 0x00019f, /* U+00019f */ + 0x0001a0, /* U+0001a0 */ + 0x0001a2, /* U+0001a2 */ + 0x0001a4, /* U+0001a4 */ + 0x0001a6, /* U+0001a6 */ + 0x0001a7, /* U+0001a7 */ + 0x0001a9, /* U+0001a9 */ + 0x0001ac, /* U+0001ac */ + 0x0001ae, /* U+0001ae */ + 0x0001af, /* U+0001af */ + 0x0001b1, /* U+0001b1 */ + 0x0001b2, /* U+0001b2 */ + 0x0001b3, /* U+0001b3 */ + 0x0001b5, /* U+0001b5 */ + 0x0001b7, /* U+0001b7 */ + 0x0001b8, /* U+0001b8 */ + 0x0001bc, /* U+0001bc */ + 0x0001f7, /* U+0001bf */ + 0x0001c5, /* U+0001c4 */ + 0x0001c8, /* U+0001c7 */ + 0x0001cb, /* U+0001ca */ + 0x0001cd, /* U+0001cd */ + 0x0001cf, /* U+0001cf */ + 0x0001d1, /* U+0001d1 */ + 0x0001d3, /* U+0001d3 */ + 0x0001d5, /* U+0001d5 */ + 0x0001d7, /* U+0001d7 */ + 0x0001d9, /* U+0001d9 */ + 0x0001db, /* U+0001db */ + 0x0001de, /* U+0001de */ + 0x0001e0, /* U+0001e0 */ + 0x0001e2, /* U+0001e2 */ + 0x0001e4, /* U+0001e4 */ + 0x0001e6, /* U+0001e6 */ + 0x0001e8, /* U+0001e8 */ + 0x0001ea, /* U+0001ea */ + 0x0001ec, /* U+0001ec */ + 0x0001ee, /* U+0001ee */ + 0x0001f0, /* U+0001f0 */ + 0x0001f2, /* U+0001f1 */ + 0x0001f4, /* U+0001f4 */ + 0x0001f8, /* U+0001f8 */ + 0x0001fa, /* U+0001fa */ + 0x0001fc, /* U+0001fc */ + 0x0001fe, /* U+0001fe */ + 0x000200, /* U+000200 */ + 0x000202, /* U+000202 */ + 0x000204, /* U+000204 */ + 0x000206, /* U+000206 */ + 0x000208, /* U+000208 */ + 0x00020a, /* U+00020a */ + 0x00020c, /* U+00020c */ + 0x00020e, /* U+00020e */ + 0x000210, /* U+000210 */ + 0x000212, /* U+000212 */ + 0x000214, /* U+000214 */ + 0x000216, /* U+000216 */ + 0x000218, /* U+000218 */ + 0x00021a, /* U+00021a */ + 0x00021c, /* U+00021c */ + 0x00021e, /* U+00021e */ + 0x000222, /* U+000222 */ + 0x000224, /* U+000224 */ + 0x000226, /* U+000226 */ + 0x000228, /* U+000228 */ + 0x00022a, /* U+00022a */ + 0x00022c, /* U+00022c */ + 0x00022e, /* U+00022e */ + 0x000230, /* U+000230 */ + 0x000232, /* U+000232 */ + 0x00023a, /* U+00023a */ + 0x00023b, /* U+00023b */ + 0x00023e, /* U+00023e */ + 0x002c7e, /* U+00023f */ + 0x002c7f, /* U+000240 */ + 0x000241, /* U+000241 */ + 0x000244, /* U+000244 */ + 0x000245, /* U+000245 */ + 0x000246, /* U+000246 */ + 0x000248, /* U+000248 */ + 0x00024a, /* U+00024a */ + 0x00024c, /* U+00024c */ + 0x00024e, /* U+00024e */ + 0x002c6f, /* U+000250 */ + 0x002c6d, /* U+000251 */ + 0x002c70, /* U+000252 */ + 0x00a7ab, /* U+00025c */ + 0x00a7ac, /* U+000261 */ + 0x00a7cb, /* U+000264 */ + 0x00a78d, /* U+000265 */ + 0x00a7aa, /* U+000266 */ + 0x00a7ae, /* U+00026a */ + 0x002c62, /* U+00026b */ + 0x00a7ad, /* U+00026c */ + 0x002c6e, /* U+000271 */ + 0x002c64, /* U+00027d */ + 0x00a7c5, /* U+000282 */ + 0x00a7b1, /* U+000287 */ + 0x00a7b2, /* U+00029d */ + 0x00a7b0, /* U+00029e */ + 0x000399, /* U+000345 */ + 0x000370, /* U+000370 */ + 0x000372, /* U+000372 */ + 0x000376, /* U+000376 */ + 0x0003fd, /* U+00037b */ + 0x0003fe, /* U+00037c */ + 0x0003ff, /* U+00037d */ + 0x00037f, /* U+00037f */ + 0x000386, /* U+000386 */ + 0x000388, /* U+000388 */ + 0x000389, /* U+000389 */ + 0x00038a, /* U+00038a */ + 0x00038c, /* U+00038c */ + 0x00038e, /* U+00038e */ + 0x00038f, /* U+00038f */ + 0x000390, /* U+000390 */ + 0x000391, /* U+000391 */ + 0x000392, /* U+000392 */ + 0x000393, /* U+000393 */ + 0x000394, /* U+000394 */ + 0x000395, /* U+000395 */ + 0x000396, /* U+000396 */ + 0x000397, /* U+000397 */ + 0x000398, /* U+000398 */ + 0x000399, /* U+000399 */ + 0x00039a, /* U+00039a */ + 0x00039b, /* U+00039b */ + 0x00039c, /* U+00039c */ + 0x00039d, /* U+00039d */ + 0x00039e, /* U+00039e */ + 0x00039f, /* U+00039f */ + 0x0003a0, /* U+0003a0 */ + 0x0003a1, /* U+0003a1 */ + 0x0003a3, /* U+0003a3 */ + 0x0003a4, /* U+0003a4 */ + 0x0003a5, /* U+0003a5 */ + 0x0003a6, /* U+0003a6 */ + 0x0003a7, /* U+0003a7 */ + 0x0003a8, /* U+0003a8 */ + 0x0003a9, /* U+0003a9 */ + 0x0003aa, /* U+0003aa */ + 0x0003ab, /* U+0003ab */ + 0x0003b0, /* U+0003b0 */ + 0x0003a3, /* U+0003c2 */ + 0x0003a3, /* U+0003c3 */ + 0x0003cf, /* U+0003cf */ + 0x000392, /* U+0003d0 */ + 0x000398, /* U+0003d1 */ + 0x0003a6, /* U+0003d5 */ + 0x0003a0, /* U+0003d6 */ + 0x0003d8, /* U+0003d8 */ + 0x0003da, /* U+0003da */ + 0x0003dc, /* U+0003dc */ + 0x0003de, /* U+0003de */ + 0x0003e0, /* U+0003e0 */ + 0x0003e2, /* U+0003e2 */ + 0x0003e4, /* U+0003e4 */ + 0x0003e6, /* U+0003e6 */ + 0x0003e8, /* U+0003e8 */ + 0x0003ea, /* U+0003ea */ + 0x0003ec, /* U+0003ec */ + 0x0003ee, /* U+0003ee */ + 0x00039a, /* U+0003f0 */ + 0x0003a1, /* U+0003f1 */ + 0x0003f9, /* U+0003f2 */ + 0x0003f4, /* U+0003f4 */ + 0x000395, /* U+0003f5 */ + 0x0003f7, /* U+0003f7 */ + 0x0003fa, /* U+0003fa */ + 0x000400, /* U+000400 */ + 0x000401, /* U+000401 */ + 0x000402, /* U+000402 */ + 0x000403, /* U+000403 */ + 0x000404, /* U+000404 */ + 0x000405, /* U+000405 */ + 0x000406, /* U+000406 */ + 0x000407, /* U+000407 */ + 0x000408, /* U+000408 */ + 0x000409, /* U+000409 */ + 0x00040a, /* U+00040a */ + 0x00040b, /* U+00040b */ + 0x00040c, /* U+00040c */ + 0x00040d, /* U+00040d */ + 0x00040e, /* U+00040e */ + 0x00040f, /* U+00040f */ + 0x000410, /* U+000410 */ + 0x000411, /* U+000411 */ + 0x000412, /* U+000412 */ + 0x000413, /* U+000413 */ + 0x000414, /* U+000414 */ + 0x000415, /* U+000415 */ + 0x000416, /* U+000416 */ + 0x000417, /* U+000417 */ + 0x000418, /* U+000418 */ + 0x000419, /* U+000419 */ + 0x00041a, /* U+00041a */ + 0x00041b, /* U+00041b */ + 0x00041c, /* U+00041c */ + 0x00041d, /* U+00041d */ + 0x00041e, /* U+00041e */ + 0x00041f, /* U+00041f */ + 0x000420, /* U+000420 */ + 0x000421, /* U+000421 */ + 0x000422, /* U+000422 */ + 0x000423, /* U+000423 */ + 0x000424, /* U+000424 */ + 0x000425, /* U+000425 */ + 0x000426, /* U+000426 */ + 0x000427, /* U+000427 */ + 0x000428, /* U+000428 */ + 0x000429, /* U+000429 */ + 0x00042a, /* U+00042a */ + 0x00042b, /* U+00042b */ + 0x00042c, /* U+00042c */ + 0x00042d, /* U+00042d */ + 0x00042e, /* U+00042e */ + 0x00042f, /* U+00042f */ + 0x000460, /* U+000460 */ + 0x000462, /* U+000462 */ + 0x000464, /* U+000464 */ + 0x000466, /* U+000466 */ + 0x000468, /* U+000468 */ + 0x00046a, /* U+00046a */ + 0x00046c, /* U+00046c */ + 0x00046e, /* U+00046e */ + 0x000470, /* U+000470 */ + 0x000472, /* U+000472 */ + 0x000474, /* U+000474 */ + 0x000476, /* U+000476 */ + 0x000478, /* U+000478 */ + 0x00047a, /* U+00047a */ + 0x00047c, /* U+00047c */ + 0x00047e, /* U+00047e */ + 0x000480, /* U+000480 */ + 0x00048a, /* U+00048a */ + 0x00048c, /* U+00048c */ + 0x00048e, /* U+00048e */ + 0x000490, /* U+000490 */ + 0x000492, /* U+000492 */ + 0x000494, /* U+000494 */ + 0x000496, /* U+000496 */ + 0x000498, /* U+000498 */ + 0x00049a, /* U+00049a */ + 0x00049c, /* U+00049c */ + 0x00049e, /* U+00049e */ + 0x0004a0, /* U+0004a0 */ + 0x0004a2, /* U+0004a2 */ + 0x0004a4, /* U+0004a4 */ + 0x0004a6, /* U+0004a6 */ + 0x0004a8, /* U+0004a8 */ + 0x0004aa, /* U+0004aa */ + 0x0004ac, /* U+0004ac */ + 0x0004ae, /* U+0004ae */ + 0x0004b0, /* U+0004b0 */ + 0x0004b2, /* U+0004b2 */ + 0x0004b4, /* U+0004b4 */ + 0x0004b6, /* U+0004b6 */ + 0x0004b8, /* U+0004b8 */ + 0x0004ba, /* U+0004ba */ + 0x0004bc, /* U+0004bc */ + 0x0004be, /* U+0004be */ + 0x0004c0, /* U+0004c0 */ + 0x0004c1, /* U+0004c1 */ + 0x0004c3, /* U+0004c3 */ + 0x0004c5, /* U+0004c5 */ + 0x0004c7, /* U+0004c7 */ + 0x0004c9, /* U+0004c9 */ + 0x0004cb, /* U+0004cb */ + 0x0004cd, /* U+0004cd */ + 0x0004d0, /* U+0004d0 */ + 0x0004d2, /* U+0004d2 */ + 0x0004d4, /* U+0004d4 */ + 0x0004d6, /* U+0004d6 */ + 0x0004d8, /* U+0004d8 */ + 0x0004da, /* U+0004da */ + 0x0004dc, /* U+0004dc */ + 0x0004de, /* U+0004de */ + 0x0004e0, /* U+0004e0 */ + 0x0004e2, /* U+0004e2 */ + 0x0004e4, /* U+0004e4 */ + 0x0004e6, /* U+0004e6 */ + 0x0004e8, /* U+0004e8 */ + 0x0004ea, /* U+0004ea */ + 0x0004ec, /* U+0004ec */ + 0x0004ee, /* U+0004ee */ + 0x0004f0, /* U+0004f0 */ + 0x0004f2, /* U+0004f2 */ + 0x0004f4, /* U+0004f4 */ + 0x0004f6, /* U+0004f6 */ + 0x0004f8, /* U+0004f8 */ + 0x0004fa, /* U+0004fa */ + 0x0004fc, /* U+0004fc */ + 0x0004fe, /* U+0004fe */ + 0x000500, /* U+000500 */ + 0x000502, /* U+000502 */ + 0x000504, /* U+000504 */ + 0x000506, /* U+000506 */ + 0x000508, /* U+000508 */ + 0x00050a, /* U+00050a */ + 0x00050c, /* U+00050c */ + 0x00050e, /* U+00050e */ + 0x000510, /* U+000510 */ + 0x000512, /* U+000512 */ + 0x000514, /* U+000514 */ + 0x000516, /* U+000516 */ + 0x000518, /* U+000518 */ + 0x00051a, /* U+00051a */ + 0x00051c, /* U+00051c */ + 0x00051e, /* U+00051e */ + 0x000520, /* U+000520 */ + 0x000522, /* U+000522 */ + 0x000524, /* U+000524 */ + 0x000526, /* U+000526 */ + 0x000528, /* U+000528 */ + 0x00052a, /* U+00052a */ + 0x00052c, /* U+00052c */ + 0x00052e, /* U+00052e */ + 0x000531, /* U+000531 */ + 0x000532, /* U+000532 */ + 0x000533, /* U+000533 */ + 0x000534, /* U+000534 */ + 0x000535, /* U+000535 */ + 0x000536, /* U+000536 */ + 0x000537, /* U+000537 */ + 0x000538, /* U+000538 */ + 0x000539, /* U+000539 */ + 0x00053a, /* U+00053a */ + 0x00053b, /* U+00053b */ + 0x00053c, /* U+00053c */ + 0x00053d, /* U+00053d */ + 0x00053e, /* U+00053e */ + 0x00053f, /* U+00053f */ + 0x000540, /* U+000540 */ + 0x000541, /* U+000541 */ + 0x000542, /* U+000542 */ + 0x000543, /* U+000543 */ + 0x000544, /* U+000544 */ + 0x000545, /* U+000545 */ + 0x000546, /* U+000546 */ + 0x000547, /* U+000547 */ + 0x000548, /* U+000548 */ + 0x000549, /* U+000549 */ + 0x00054a, /* U+00054a */ + 0x00054b, /* U+00054b */ + 0x00054c, /* U+00054c */ + 0x00054d, /* U+00054d */ + 0x00054e, /* U+00054e */ + 0x00054f, /* U+00054f */ + 0x000550, /* U+000550 */ + 0x000551, /* U+000551 */ + 0x000552, /* U+000552 */ + 0x000553, /* U+000553 */ + 0x000554, /* U+000554 */ + 0x000555, /* U+000555 */ + 0x000556, /* U+000556 */ + 0x000587, /* U+000587 */ + 0x0010a0, /* U+0010a0 */ + 0x0010a1, /* U+0010a1 */ + 0x0010a2, /* U+0010a2 */ + 0x0010a3, /* U+0010a3 */ + 0x0010a4, /* U+0010a4 */ + 0x0010a5, /* U+0010a5 */ + 0x0010a6, /* U+0010a6 */ + 0x0010a7, /* U+0010a7 */ + 0x0010a8, /* U+0010a8 */ + 0x0010a9, /* U+0010a9 */ + 0x0010aa, /* U+0010aa */ + 0x0010ab, /* U+0010ab */ + 0x0010ac, /* U+0010ac */ + 0x0010ad, /* U+0010ad */ + 0x0010ae, /* U+0010ae */ + 0x0010af, /* U+0010af */ + 0x0010b0, /* U+0010b0 */ + 0x0010b1, /* U+0010b1 */ + 0x0010b2, /* U+0010b2 */ + 0x0010b3, /* U+0010b3 */ + 0x0010b4, /* U+0010b4 */ + 0x0010b5, /* U+0010b5 */ + 0x0010b6, /* U+0010b6 */ + 0x0010b7, /* U+0010b7 */ + 0x0010b8, /* U+0010b8 */ + 0x0010b9, /* U+0010b9 */ + 0x0010ba, /* U+0010ba */ + 0x0010bb, /* U+0010bb */ + 0x0010bc, /* U+0010bc */ + 0x0010bd, /* U+0010bd */ + 0x0010be, /* U+0010be */ + 0x0010bf, /* U+0010bf */ + 0x0010c0, /* U+0010c0 */ + 0x0010c1, /* U+0010c1 */ + 0x0010c2, /* U+0010c2 */ + 0x0010c3, /* U+0010c3 */ + 0x0010c4, /* U+0010c4 */ + 0x0010c5, /* U+0010c5 */ + 0x0010c7, /* U+0010c7 */ + 0x0010cd, /* U+0010cd */ + 0x0010d0, /* U+0010d0 */ + 0x0010d1, /* U+0010d1 */ + 0x0010d2, /* U+0010d2 */ + 0x0010d3, /* U+0010d3 */ + 0x0010d4, /* U+0010d4 */ + 0x0010d5, /* U+0010d5 */ + 0x0010d6, /* U+0010d6 */ + 0x0010d7, /* U+0010d7 */ + 0x0010d8, /* U+0010d8 */ + 0x0010d9, /* U+0010d9 */ + 0x0010da, /* U+0010da */ + 0x0010db, /* U+0010db */ + 0x0010dc, /* U+0010dc */ + 0x0010dd, /* U+0010dd */ + 0x0010de, /* U+0010de */ + 0x0010df, /* U+0010df */ + 0x0010e0, /* U+0010e0 */ + 0x0010e1, /* U+0010e1 */ + 0x0010e2, /* U+0010e2 */ + 0x0010e3, /* U+0010e3 */ + 0x0010e4, /* U+0010e4 */ + 0x0010e5, /* U+0010e5 */ + 0x0010e6, /* U+0010e6 */ + 0x0010e7, /* U+0010e7 */ + 0x0010e8, /* U+0010e8 */ + 0x0010e9, /* U+0010e9 */ + 0x0010ea, /* U+0010ea */ + 0x0010eb, /* U+0010eb */ + 0x0010ec, /* U+0010ec */ + 0x0010ed, /* U+0010ed */ + 0x0010ee, /* U+0010ee */ + 0x0010ef, /* U+0010ef */ + 0x0010f0, /* U+0010f0 */ + 0x0010f1, /* U+0010f1 */ + 0x0010f2, /* U+0010f2 */ + 0x0010f3, /* U+0010f3 */ + 0x0010f4, /* U+0010f4 */ + 0x0010f5, /* U+0010f5 */ + 0x0010f6, /* U+0010f6 */ + 0x0010f7, /* U+0010f7 */ + 0x0010f8, /* U+0010f8 */ + 0x0010f9, /* U+0010f9 */ + 0x0010fa, /* U+0010fa */ + 0x0010fd, /* U+0010fd */ + 0x0010fe, /* U+0010fe */ + 0x0010ff, /* U+0010ff */ + 0x0013a0, /* U+0013a0 */ + 0x0013a1, /* U+0013a1 */ + 0x0013a2, /* U+0013a2 */ + 0x0013a3, /* U+0013a3 */ + 0x0013a4, /* U+0013a4 */ + 0x0013a5, /* U+0013a5 */ + 0x0013a6, /* U+0013a6 */ + 0x0013a7, /* U+0013a7 */ + 0x0013a8, /* U+0013a8 */ + 0x0013a9, /* U+0013a9 */ + 0x0013aa, /* U+0013aa */ + 0x0013ab, /* U+0013ab */ + 0x0013ac, /* U+0013ac */ + 0x0013ad, /* U+0013ad */ + 0x0013ae, /* U+0013ae */ + 0x0013af, /* U+0013af */ + 0x0013b0, /* U+0013b0 */ + 0x0013b1, /* U+0013b1 */ + 0x0013b2, /* U+0013b2 */ + 0x0013b3, /* U+0013b3 */ + 0x0013b4, /* U+0013b4 */ + 0x0013b5, /* U+0013b5 */ + 0x0013b6, /* U+0013b6 */ + 0x0013b7, /* U+0013b7 */ + 0x0013b8, /* U+0013b8 */ + 0x0013b9, /* U+0013b9 */ + 0x0013ba, /* U+0013ba */ + 0x0013bb, /* U+0013bb */ + 0x0013bc, /* U+0013bc */ + 0x0013bd, /* U+0013bd */ + 0x0013be, /* U+0013be */ + 0x0013bf, /* U+0013bf */ + 0x0013c0, /* U+0013c0 */ + 0x0013c1, /* U+0013c1 */ + 0x0013c2, /* U+0013c2 */ + 0x0013c3, /* U+0013c3 */ + 0x0013c4, /* U+0013c4 */ + 0x0013c5, /* U+0013c5 */ + 0x0013c6, /* U+0013c6 */ + 0x0013c7, /* U+0013c7 */ + 0x0013c8, /* U+0013c8 */ + 0x0013c9, /* U+0013c9 */ + 0x0013ca, /* U+0013ca */ + 0x0013cb, /* U+0013cb */ + 0x0013cc, /* U+0013cc */ + 0x0013cd, /* U+0013cd */ + 0x0013ce, /* U+0013ce */ + 0x0013cf, /* U+0013cf */ + 0x0013d0, /* U+0013d0 */ + 0x0013d1, /* U+0013d1 */ + 0x0013d2, /* U+0013d2 */ + 0x0013d3, /* U+0013d3 */ + 0x0013d4, /* U+0013d4 */ + 0x0013d5, /* U+0013d5 */ + 0x0013d6, /* U+0013d6 */ + 0x0013d7, /* U+0013d7 */ + 0x0013d8, /* U+0013d8 */ + 0x0013d9, /* U+0013d9 */ + 0x0013da, /* U+0013da */ + 0x0013db, /* U+0013db */ + 0x0013dc, /* U+0013dc */ + 0x0013dd, /* U+0013dd */ + 0x0013de, /* U+0013de */ + 0x0013df, /* U+0013df */ + 0x0013e0, /* U+0013e0 */ + 0x0013e1, /* U+0013e1 */ + 0x0013e2, /* U+0013e2 */ + 0x0013e3, /* U+0013e3 */ + 0x0013e4, /* U+0013e4 */ + 0x0013e5, /* U+0013e5 */ + 0x0013e6, /* U+0013e6 */ + 0x0013e7, /* U+0013e7 */ + 0x0013e8, /* U+0013e8 */ + 0x0013e9, /* U+0013e9 */ + 0x0013ea, /* U+0013ea */ + 0x0013eb, /* U+0013eb */ + 0x0013ec, /* U+0013ec */ + 0x0013ed, /* U+0013ed */ + 0x0013ee, /* U+0013ee */ + 0x0013ef, /* U+0013ef */ + 0x0013f0, /* U+0013f0 */ + 0x0013f1, /* U+0013f1 */ + 0x0013f2, /* U+0013f2 */ + 0x0013f3, /* U+0013f3 */ + 0x0013f4, /* U+0013f4 */ + 0x0013f5, /* U+0013f5 */ + 0x000412, /* U+001c80 */ + 0x000414, /* U+001c81 */ + 0x00041e, /* U+001c82 */ + 0x000421, /* U+001c83 */ + 0x000422, /* U+001c84 */ + 0x000422, /* U+001c85 */ + 0x00042a, /* U+001c86 */ + 0x000462, /* U+001c87 */ + 0x00a64a, /* U+001c88 */ + 0x001c89, /* U+001c89 */ + 0x001c90, /* U+001c90 */ + 0x001c91, /* U+001c91 */ + 0x001c92, /* U+001c92 */ + 0x001c93, /* U+001c93 */ + 0x001c94, /* U+001c94 */ + 0x001c95, /* U+001c95 */ + 0x001c96, /* U+001c96 */ + 0x001c97, /* U+001c97 */ + 0x001c98, /* U+001c98 */ + 0x001c99, /* U+001c99 */ + 0x001c9a, /* U+001c9a */ + 0x001c9b, /* U+001c9b */ + 0x001c9c, /* U+001c9c */ + 0x001c9d, /* U+001c9d */ + 0x001c9e, /* U+001c9e */ + 0x001c9f, /* U+001c9f */ + 0x001ca0, /* U+001ca0 */ + 0x001ca1, /* U+001ca1 */ + 0x001ca2, /* U+001ca2 */ + 0x001ca3, /* U+001ca3 */ + 0x001ca4, /* U+001ca4 */ + 0x001ca5, /* U+001ca5 */ + 0x001ca6, /* U+001ca6 */ + 0x001ca7, /* U+001ca7 */ + 0x001ca8, /* U+001ca8 */ + 0x001ca9, /* U+001ca9 */ + 0x001caa, /* U+001caa */ + 0x001cab, /* U+001cab */ + 0x001cac, /* U+001cac */ + 0x001cad, /* U+001cad */ + 0x001cae, /* U+001cae */ + 0x001caf, /* U+001caf */ + 0x001cb0, /* U+001cb0 */ + 0x001cb1, /* U+001cb1 */ + 0x001cb2, /* U+001cb2 */ + 0x001cb3, /* U+001cb3 */ + 0x001cb4, /* U+001cb4 */ + 0x001cb5, /* U+001cb5 */ + 0x001cb6, /* U+001cb6 */ + 0x001cb7, /* U+001cb7 */ + 0x001cb8, /* U+001cb8 */ + 0x001cb9, /* U+001cb9 */ + 0x001cba, /* U+001cba */ + 0x001cbd, /* U+001cbd */ + 0x001cbe, /* U+001cbe */ + 0x001cbf, /* U+001cbf */ + 0x00a77d, /* U+001d79 */ + 0x002c63, /* U+001d7d */ + 0x00a7c6, /* U+001d8e */ + 0x001e00, /* U+001e00 */ + 0x001e02, /* U+001e02 */ + 0x001e04, /* U+001e04 */ + 0x001e06, /* U+001e06 */ + 0x001e08, /* U+001e08 */ + 0x001e0a, /* U+001e0a */ + 0x001e0c, /* U+001e0c */ + 0x001e0e, /* U+001e0e */ + 0x001e10, /* U+001e10 */ + 0x001e12, /* U+001e12 */ + 0x001e14, /* U+001e14 */ + 0x001e16, /* U+001e16 */ + 0x001e18, /* U+001e18 */ + 0x001e1a, /* U+001e1a */ + 0x001e1c, /* U+001e1c */ + 0x001e1e, /* U+001e1e */ + 0x001e20, /* U+001e20 */ + 0x001e22, /* U+001e22 */ + 0x001e24, /* U+001e24 */ + 0x001e26, /* U+001e26 */ + 0x001e28, /* U+001e28 */ + 0x001e2a, /* U+001e2a */ + 0x001e2c, /* U+001e2c */ + 0x001e2e, /* U+001e2e */ + 0x001e30, /* U+001e30 */ + 0x001e32, /* U+001e32 */ + 0x001e34, /* U+001e34 */ + 0x001e36, /* U+001e36 */ + 0x001e38, /* U+001e38 */ + 0x001e3a, /* U+001e3a */ + 0x001e3c, /* U+001e3c */ + 0x001e3e, /* U+001e3e */ + 0x001e40, /* U+001e40 */ + 0x001e42, /* U+001e42 */ + 0x001e44, /* U+001e44 */ + 0x001e46, /* U+001e46 */ + 0x001e48, /* U+001e48 */ + 0x001e4a, /* U+001e4a */ + 0x001e4c, /* U+001e4c */ + 0x001e4e, /* U+001e4e */ + 0x001e50, /* U+001e50 */ + 0x001e52, /* U+001e52 */ + 0x001e54, /* U+001e54 */ + 0x001e56, /* U+001e56 */ + 0x001e58, /* U+001e58 */ + 0x001e5a, /* U+001e5a */ + 0x001e5c, /* U+001e5c */ + 0x001e5e, /* U+001e5e */ + 0x001e60, /* U+001e60 */ + 0x001e62, /* U+001e62 */ + 0x001e64, /* U+001e64 */ + 0x001e66, /* U+001e66 */ + 0x001e68, /* U+001e68 */ + 0x001e6a, /* U+001e6a */ + 0x001e6c, /* U+001e6c */ + 0x001e6e, /* U+001e6e */ + 0x001e70, /* U+001e70 */ + 0x001e72, /* U+001e72 */ + 0x001e74, /* U+001e74 */ + 0x001e76, /* U+001e76 */ + 0x001e78, /* U+001e78 */ + 0x001e7a, /* U+001e7a */ + 0x001e7c, /* U+001e7c */ + 0x001e7e, /* U+001e7e */ + 0x001e80, /* U+001e80 */ + 0x001e82, /* U+001e82 */ + 0x001e84, /* U+001e84 */ + 0x001e86, /* U+001e86 */ + 0x001e88, /* U+001e88 */ + 0x001e8a, /* U+001e8a */ + 0x001e8c, /* U+001e8c */ + 0x001e8e, /* U+001e8e */ + 0x001e90, /* U+001e90 */ + 0x001e92, /* U+001e92 */ + 0x001e94, /* U+001e94 */ + 0x001e96, /* U+001e96 */ + 0x001e97, /* U+001e97 */ + 0x001e98, /* U+001e98 */ + 0x001e99, /* U+001e99 */ + 0x001e9a, /* U+001e9a */ + 0x001e60, /* U+001e9b */ + 0x001e9e, /* U+001e9e */ + 0x001ea0, /* U+001ea0 */ + 0x001ea2, /* U+001ea2 */ + 0x001ea4, /* U+001ea4 */ + 0x001ea6, /* U+001ea6 */ + 0x001ea8, /* U+001ea8 */ + 0x001eaa, /* U+001eaa */ + 0x001eac, /* U+001eac */ + 0x001eae, /* U+001eae */ + 0x001eb0, /* U+001eb0 */ + 0x001eb2, /* U+001eb2 */ + 0x001eb4, /* U+001eb4 */ + 0x001eb6, /* U+001eb6 */ + 0x001eb8, /* U+001eb8 */ + 0x001eba, /* U+001eba */ + 0x001ebc, /* U+001ebc */ + 0x001ebe, /* U+001ebe */ + 0x001ec0, /* U+001ec0 */ + 0x001ec2, /* U+001ec2 */ + 0x001ec4, /* U+001ec4 */ + 0x001ec6, /* U+001ec6 */ + 0x001ec8, /* U+001ec8 */ + 0x001eca, /* U+001eca */ + 0x001ecc, /* U+001ecc */ + 0x001ece, /* U+001ece */ + 0x001ed0, /* U+001ed0 */ + 0x001ed2, /* U+001ed2 */ + 0x001ed4, /* U+001ed4 */ + 0x001ed6, /* U+001ed6 */ + 0x001ed8, /* U+001ed8 */ + 0x001eda, /* U+001eda */ + 0x001edc, /* U+001edc */ + 0x001ede, /* U+001ede */ + 0x001ee0, /* U+001ee0 */ + 0x001ee2, /* U+001ee2 */ + 0x001ee4, /* U+001ee4 */ + 0x001ee6, /* U+001ee6 */ + 0x001ee8, /* U+001ee8 */ + 0x001eea, /* U+001eea */ + 0x001eec, /* U+001eec */ + 0x001eee, /* U+001eee */ + 0x001ef0, /* U+001ef0 */ + 0x001ef2, /* U+001ef2 */ + 0x001ef4, /* U+001ef4 */ + 0x001ef6, /* U+001ef6 */ + 0x001ef8, /* U+001ef8 */ + 0x001efa, /* U+001efa */ + 0x001efc, /* U+001efc */ + 0x001efe, /* U+001efe */ + 0x001f08, /* U+001f00 */ + 0x001f09, /* U+001f01 */ + 0x001f0a, /* U+001f02 */ + 0x001f0b, /* U+001f03 */ + 0x001f0c, /* U+001f04 */ + 0x001f0d, /* U+001f05 */ + 0x001f0e, /* U+001f06 */ + 0x001f0f, /* U+001f07 */ + 0x001f18, /* U+001f10 */ + 0x001f19, /* U+001f11 */ + 0x001f1a, /* U+001f12 */ + 0x001f1b, /* U+001f13 */ + 0x001f1c, /* U+001f14 */ + 0x001f1d, /* U+001f15 */ + 0x001f28, /* U+001f20 */ + 0x001f29, /* U+001f21 */ + 0x001f2a, /* U+001f22 */ + 0x001f2b, /* U+001f23 */ + 0x001f2c, /* U+001f24 */ + 0x001f2d, /* U+001f25 */ + 0x001f2e, /* U+001f26 */ + 0x001f2f, /* U+001f27 */ + 0x001f38, /* U+001f30 */ + 0x001f39, /* U+001f31 */ + 0x001f3a, /* U+001f32 */ + 0x001f3b, /* U+001f33 */ + 0x001f3c, /* U+001f34 */ + 0x001f3d, /* U+001f35 */ + 0x001f3e, /* U+001f36 */ + 0x001f3f, /* U+001f37 */ + 0x001f48, /* U+001f40 */ + 0x001f49, /* U+001f41 */ + 0x001f4a, /* U+001f42 */ + 0x001f4b, /* U+001f43 */ + 0x001f4c, /* U+001f44 */ + 0x001f4d, /* U+001f45 */ + 0x001f50, /* U+001f50 */ + 0x001f59, /* U+001f51 */ + 0x001f52, /* U+001f52 */ + 0x001f5b, /* U+001f53 */ + 0x001f54, /* U+001f54 */ + 0x001f5d, /* U+001f55 */ + 0x001f56, /* U+001f56 */ + 0x001f5f, /* U+001f57 */ + 0x001f68, /* U+001f60 */ + 0x001f69, /* U+001f61 */ + 0x001f6a, /* U+001f62 */ + 0x001f6b, /* U+001f63 */ + 0x001f6c, /* U+001f64 */ + 0x001f6d, /* U+001f65 */ + 0x001f6e, /* U+001f66 */ + 0x001f6f, /* U+001f67 */ + 0x001fba, /* U+001f70 */ + 0x001fbb, /* U+001f71 */ + 0x001fc8, /* U+001f72 */ + 0x001fc9, /* U+001f73 */ + 0x001fca, /* U+001f74 */ + 0x001fcb, /* U+001f75 */ + 0x001fda, /* U+001f76 */ + 0x001fdb, /* U+001f77 */ + 0x001ff8, /* U+001f78 */ + 0x001ff9, /* U+001f79 */ + 0x001fea, /* U+001f7a */ + 0x001feb, /* U+001f7b */ + 0x001ffa, /* U+001f7c */ + 0x001ffb, /* U+001f7d */ + 0x001f88, /* U+001f80 */ + 0x001f89, /* U+001f81 */ + 0x001f8a, /* U+001f82 */ + 0x001f8b, /* U+001f83 */ + 0x001f8c, /* U+001f84 */ + 0x001f8d, /* U+001f85 */ + 0x001f8e, /* U+001f86 */ + 0x001f8f, /* U+001f87 */ + 0x001f88, /* U+001f88 */ + 0x001f89, /* U+001f89 */ + 0x001f8a, /* U+001f8a */ + 0x001f8b, /* U+001f8b */ + 0x001f8c, /* U+001f8c */ + 0x001f8d, /* U+001f8d */ + 0x001f8e, /* U+001f8e */ + 0x001f8f, /* U+001f8f */ + 0x001f98, /* U+001f90 */ + 0x001f99, /* U+001f91 */ + 0x001f9a, /* U+001f92 */ + 0x001f9b, /* U+001f93 */ + 0x001f9c, /* U+001f94 */ + 0x001f9d, /* U+001f95 */ + 0x001f9e, /* U+001f96 */ + 0x001f9f, /* U+001f97 */ + 0x001f98, /* U+001f98 */ + 0x001f99, /* U+001f99 */ + 0x001f9a, /* U+001f9a */ + 0x001f9b, /* U+001f9b */ + 0x001f9c, /* U+001f9c */ + 0x001f9d, /* U+001f9d */ + 0x001f9e, /* U+001f9e */ + 0x001f9f, /* U+001f9f */ + 0x001fa8, /* U+001fa0 */ + 0x001fa9, /* U+001fa1 */ + 0x001faa, /* U+001fa2 */ + 0x001fab, /* U+001fa3 */ + 0x001fac, /* U+001fa4 */ + 0x001fad, /* U+001fa5 */ + 0x001fae, /* U+001fa6 */ + 0x001faf, /* U+001fa7 */ + 0x001fa8, /* U+001fa8 */ + 0x001fa9, /* U+001fa9 */ + 0x001faa, /* U+001faa */ + 0x001fab, /* U+001fab */ + 0x001fac, /* U+001fac */ + 0x001fad, /* U+001fad */ + 0x001fae, /* U+001fae */ + 0x001faf, /* U+001faf */ + 0x001fb8, /* U+001fb0 */ + 0x001fb9, /* U+001fb1 */ + 0x001fb2, /* U+001fb2 */ + 0x001fbc, /* U+001fb3 */ + 0x001fb4, /* U+001fb4 */ + 0x001fb6, /* U+001fb6 */ + 0x001fb7, /* U+001fb7 */ + 0x001fbc, /* U+001fbc */ + 0x000399, /* U+001fbe */ + 0x001fc2, /* U+001fc2 */ + 0x001fcc, /* U+001fc3 */ + 0x001fc4, /* U+001fc4 */ + 0x001fc6, /* U+001fc6 */ + 0x001fc7, /* U+001fc7 */ + 0x001fcc, /* U+001fcc */ + 0x001fd8, /* U+001fd0 */ + 0x001fd9, /* U+001fd1 */ + 0x001fd2, /* U+001fd2 */ + 0x001fd3, /* U+001fd3 */ + 0x001fd6, /* U+001fd6 */ + 0x001fd7, /* U+001fd7 */ + 0x001fe8, /* U+001fe0 */ + 0x001fe9, /* U+001fe1 */ + 0x001fe2, /* U+001fe2 */ + 0x001fe3, /* U+001fe3 */ + 0x001fe4, /* U+001fe4 */ + 0x001fec, /* U+001fe5 */ + 0x001fe6, /* U+001fe6 */ + 0x001fe7, /* U+001fe7 */ + 0x001ff2, /* U+001ff2 */ + 0x001ffc, /* U+001ff3 */ + 0x001ff4, /* U+001ff4 */ + 0x001ff6, /* U+001ff6 */ + 0x001ff7, /* U+001ff7 */ + 0x001ffc, /* U+001ffc */ + 0x002126, /* U+002126 */ + 0x00212a, /* U+00212a */ + 0x00212b, /* U+00212b */ + 0x002132, /* U+002132 */ + 0x002160, /* U+002160 */ + 0x002161, /* U+002161 */ + 0x002162, /* U+002162 */ + 0x002163, /* U+002163 */ + 0x002164, /* U+002164 */ + 0x002165, /* U+002165 */ + 0x002166, /* U+002166 */ + 0x002167, /* U+002167 */ + 0x002168, /* U+002168 */ + 0x002169, /* U+002169 */ + 0x00216a, /* U+00216a */ + 0x00216b, /* U+00216b */ + 0x00216c, /* U+00216c */ + 0x00216d, /* U+00216d */ + 0x00216e, /* U+00216e */ + 0x00216f, /* U+00216f */ + 0x002183, /* U+002183 */ + 0x0024b6, /* U+0024b6 */ + 0x0024b7, /* U+0024b7 */ + 0x0024b8, /* U+0024b8 */ + 0x0024b9, /* U+0024b9 */ + 0x0024ba, /* U+0024ba */ + 0x0024bb, /* U+0024bb */ + 0x0024bc, /* U+0024bc */ + 0x0024bd, /* U+0024bd */ + 0x0024be, /* U+0024be */ + 0x0024bf, /* U+0024bf */ + 0x0024c0, /* U+0024c0 */ + 0x0024c1, /* U+0024c1 */ + 0x0024c2, /* U+0024c2 */ + 0x0024c3, /* U+0024c3 */ + 0x0024c4, /* U+0024c4 */ + 0x0024c5, /* U+0024c5 */ + 0x0024c6, /* U+0024c6 */ + 0x0024c7, /* U+0024c7 */ + 0x0024c8, /* U+0024c8 */ + 0x0024c9, /* U+0024c9 */ + 0x0024ca, /* U+0024ca */ + 0x0024cb, /* U+0024cb */ + 0x0024cc, /* U+0024cc */ + 0x0024cd, /* U+0024cd */ + 0x0024ce, /* U+0024ce */ + 0x0024cf, /* U+0024cf */ + 0x002c00, /* U+002c00 */ + 0x002c01, /* U+002c01 */ + 0x002c02, /* U+002c02 */ + 0x002c03, /* U+002c03 */ + 0x002c04, /* U+002c04 */ + 0x002c05, /* U+002c05 */ + 0x002c06, /* U+002c06 */ + 0x002c07, /* U+002c07 */ + 0x002c08, /* U+002c08 */ + 0x002c09, /* U+002c09 */ + 0x002c0a, /* U+002c0a */ + 0x002c0b, /* U+002c0b */ + 0x002c0c, /* U+002c0c */ + 0x002c0d, /* U+002c0d */ + 0x002c0e, /* U+002c0e */ + 0x002c0f, /* U+002c0f */ + 0x002c10, /* U+002c10 */ + 0x002c11, /* U+002c11 */ + 0x002c12, /* U+002c12 */ + 0x002c13, /* U+002c13 */ + 0x002c14, /* U+002c14 */ + 0x002c15, /* U+002c15 */ + 0x002c16, /* U+002c16 */ + 0x002c17, /* U+002c17 */ + 0x002c18, /* U+002c18 */ + 0x002c19, /* U+002c19 */ + 0x002c1a, /* U+002c1a */ + 0x002c1b, /* U+002c1b */ + 0x002c1c, /* U+002c1c */ + 0x002c1d, /* U+002c1d */ + 0x002c1e, /* U+002c1e */ + 0x002c1f, /* U+002c1f */ + 0x002c20, /* U+002c20 */ + 0x002c21, /* U+002c21 */ + 0x002c22, /* U+002c22 */ + 0x002c23, /* U+002c23 */ + 0x002c24, /* U+002c24 */ + 0x002c25, /* U+002c25 */ + 0x002c26, /* U+002c26 */ + 0x002c27, /* U+002c27 */ + 0x002c28, /* U+002c28 */ + 0x002c29, /* U+002c29 */ + 0x002c2a, /* U+002c2a */ + 0x002c2b, /* U+002c2b */ + 0x002c2c, /* U+002c2c */ + 0x002c2d, /* U+002c2d */ + 0x002c2e, /* U+002c2e */ + 0x002c2f, /* U+002c2f */ + 0x002c60, /* U+002c60 */ + 0x002c67, /* U+002c67 */ + 0x002c69, /* U+002c69 */ + 0x002c6b, /* U+002c6b */ + 0x002c72, /* U+002c72 */ + 0x002c75, /* U+002c75 */ + 0x002c80, /* U+002c80 */ + 0x002c82, /* U+002c82 */ + 0x002c84, /* U+002c84 */ + 0x002c86, /* U+002c86 */ + 0x002c88, /* U+002c88 */ + 0x002c8a, /* U+002c8a */ + 0x002c8c, /* U+002c8c */ + 0x002c8e, /* U+002c8e */ + 0x002c90, /* U+002c90 */ + 0x002c92, /* U+002c92 */ + 0x002c94, /* U+002c94 */ + 0x002c96, /* U+002c96 */ + 0x002c98, /* U+002c98 */ + 0x002c9a, /* U+002c9a */ + 0x002c9c, /* U+002c9c */ + 0x002c9e, /* U+002c9e */ + 0x002ca0, /* U+002ca0 */ + 0x002ca2, /* U+002ca2 */ + 0x002ca4, /* U+002ca4 */ + 0x002ca6, /* U+002ca6 */ + 0x002ca8, /* U+002ca8 */ + 0x002caa, /* U+002caa */ + 0x002cac, /* U+002cac */ + 0x002cae, /* U+002cae */ + 0x002cb0, /* U+002cb0 */ + 0x002cb2, /* U+002cb2 */ + 0x002cb4, /* U+002cb4 */ + 0x002cb6, /* U+002cb6 */ + 0x002cb8, /* U+002cb8 */ + 0x002cba, /* U+002cba */ + 0x002cbc, /* U+002cbc */ + 0x002cbe, /* U+002cbe */ + 0x002cc0, /* U+002cc0 */ + 0x002cc2, /* U+002cc2 */ + 0x002cc4, /* U+002cc4 */ + 0x002cc6, /* U+002cc6 */ + 0x002cc8, /* U+002cc8 */ + 0x002cca, /* U+002cca */ + 0x002ccc, /* U+002ccc */ + 0x002cce, /* U+002cce */ + 0x002cd0, /* U+002cd0 */ + 0x002cd2, /* U+002cd2 */ + 0x002cd4, /* U+002cd4 */ + 0x002cd6, /* U+002cd6 */ + 0x002cd8, /* U+002cd8 */ + 0x002cda, /* U+002cda */ + 0x002cdc, /* U+002cdc */ + 0x002cde, /* U+002cde */ + 0x002ce0, /* U+002ce0 */ + 0x002ce2, /* U+002ce2 */ + 0x002ceb, /* U+002ceb */ + 0x002ced, /* U+002ced */ + 0x002cf2, /* U+002cf2 */ + 0x00a640, /* U+00a640 */ + 0x00a642, /* U+00a642 */ + 0x00a644, /* U+00a644 */ + 0x00a646, /* U+00a646 */ + 0x00a648, /* U+00a648 */ + 0x00a64a, /* U+00a64a */ + 0x00a64c, /* U+00a64c */ + 0x00a64e, /* U+00a64e */ + 0x00a650, /* U+00a650 */ + 0x00a652, /* U+00a652 */ + 0x00a654, /* U+00a654 */ + 0x00a656, /* U+00a656 */ + 0x00a658, /* U+00a658 */ + 0x00a65a, /* U+00a65a */ + 0x00a65c, /* U+00a65c */ + 0x00a65e, /* U+00a65e */ + 0x00a660, /* U+00a660 */ + 0x00a662, /* U+00a662 */ + 0x00a664, /* U+00a664 */ + 0x00a666, /* U+00a666 */ + 0x00a668, /* U+00a668 */ + 0x00a66a, /* U+00a66a */ + 0x00a66c, /* U+00a66c */ + 0x00a680, /* U+00a680 */ + 0x00a682, /* U+00a682 */ + 0x00a684, /* U+00a684 */ + 0x00a686, /* U+00a686 */ + 0x00a688, /* U+00a688 */ + 0x00a68a, /* U+00a68a */ + 0x00a68c, /* U+00a68c */ + 0x00a68e, /* U+00a68e */ + 0x00a690, /* U+00a690 */ + 0x00a692, /* U+00a692 */ + 0x00a694, /* U+00a694 */ + 0x00a696, /* U+00a696 */ + 0x00a698, /* U+00a698 */ + 0x00a69a, /* U+00a69a */ + 0x00a722, /* U+00a722 */ + 0x00a724, /* U+00a724 */ + 0x00a726, /* U+00a726 */ + 0x00a728, /* U+00a728 */ + 0x00a72a, /* U+00a72a */ + 0x00a72c, /* U+00a72c */ + 0x00a72e, /* U+00a72e */ + 0x00a732, /* U+00a732 */ + 0x00a734, /* U+00a734 */ + 0x00a736, /* U+00a736 */ + 0x00a738, /* U+00a738 */ + 0x00a73a, /* U+00a73a */ + 0x00a73c, /* U+00a73c */ + 0x00a73e, /* U+00a73e */ + 0x00a740, /* U+00a740 */ + 0x00a742, /* U+00a742 */ + 0x00a744, /* U+00a744 */ + 0x00a746, /* U+00a746 */ + 0x00a748, /* U+00a748 */ + 0x00a74a, /* U+00a74a */ + 0x00a74c, /* U+00a74c */ + 0x00a74e, /* U+00a74e */ + 0x00a750, /* U+00a750 */ + 0x00a752, /* U+00a752 */ + 0x00a754, /* U+00a754 */ + 0x00a756, /* U+00a756 */ + 0x00a758, /* U+00a758 */ + 0x00a75a, /* U+00a75a */ + 0x00a75c, /* U+00a75c */ + 0x00a75e, /* U+00a75e */ + 0x00a760, /* U+00a760 */ + 0x00a762, /* U+00a762 */ + 0x00a764, /* U+00a764 */ + 0x00a766, /* U+00a766 */ + 0x00a768, /* U+00a768 */ + 0x00a76a, /* U+00a76a */ + 0x00a76c, /* U+00a76c */ + 0x00a76e, /* U+00a76e */ + 0x00a779, /* U+00a779 */ + 0x00a77b, /* U+00a77b */ + 0x00a77e, /* U+00a77e */ + 0x00a780, /* U+00a780 */ + 0x00a782, /* U+00a782 */ + 0x00a784, /* U+00a784 */ + 0x00a786, /* U+00a786 */ + 0x00a78b, /* U+00a78b */ + 0x00a790, /* U+00a790 */ + 0x00a792, /* U+00a792 */ + 0x00a7c4, /* U+00a794 */ + 0x00a796, /* U+00a796 */ + 0x00a798, /* U+00a798 */ + 0x00a79a, /* U+00a79a */ + 0x00a79c, /* U+00a79c */ + 0x00a79e, /* U+00a79e */ + 0x00a7a0, /* U+00a7a0 */ + 0x00a7a2, /* U+00a7a2 */ + 0x00a7a4, /* U+00a7a4 */ + 0x00a7a6, /* U+00a7a6 */ + 0x00a7a8, /* U+00a7a8 */ + 0x00a7b3, /* U+00a7b3 */ + 0x00a7b4, /* U+00a7b4 */ + 0x00a7b6, /* U+00a7b6 */ + 0x00a7b8, /* U+00a7b8 */ + 0x00a7ba, /* U+00a7ba */ + 0x00a7bc, /* U+00a7bc */ + 0x00a7be, /* U+00a7be */ + 0x00a7c0, /* U+00a7c0 */ + 0x00a7c2, /* U+00a7c2 */ + 0x00a7c7, /* U+00a7c7 */ + 0x00a7c9, /* U+00a7c9 */ + 0x00a7cc, /* U+00a7cc */ + 0x00a7d0, /* U+00a7d0 */ + 0x00a7d6, /* U+00a7d6 */ + 0x00a7d8, /* U+00a7d8 */ + 0x00a7da, /* U+00a7da */ + 0x00a7f5, /* U+00a7f5 */ + 0x00fb00, /* U+00fb00 */ + 0x00fb01, /* U+00fb01 */ + 0x00fb02, /* U+00fb02 */ + 0x00fb03, /* U+00fb03 */ + 0x00fb04, /* U+00fb04 */ + 0x00fb05, /* U+00fb05 */ + 0x00fb06, /* U+00fb06 */ + 0x00fb13, /* U+00fb13 */ + 0x00fb14, /* U+00fb14 */ + 0x00fb15, /* U+00fb15 */ + 0x00fb16, /* U+00fb16 */ + 0x00fb17, /* U+00fb17 */ + 0x00ff21, /* U+00ff21 */ + 0x00ff22, /* U+00ff22 */ + 0x00ff23, /* U+00ff23 */ + 0x00ff24, /* U+00ff24 */ + 0x00ff25, /* U+00ff25 */ + 0x00ff26, /* U+00ff26 */ + 0x00ff27, /* U+00ff27 */ + 0x00ff28, /* U+00ff28 */ + 0x00ff29, /* U+00ff29 */ + 0x00ff2a, /* U+00ff2a */ + 0x00ff2b, /* U+00ff2b */ + 0x00ff2c, /* U+00ff2c */ + 0x00ff2d, /* U+00ff2d */ + 0x00ff2e, /* U+00ff2e */ + 0x00ff2f, /* U+00ff2f */ + 0x00ff30, /* U+00ff30 */ + 0x00ff31, /* U+00ff31 */ + 0x00ff32, /* U+00ff32 */ + 0x00ff33, /* U+00ff33 */ + 0x00ff34, /* U+00ff34 */ + 0x00ff35, /* U+00ff35 */ + 0x00ff36, /* U+00ff36 */ + 0x00ff37, /* U+00ff37 */ + 0x00ff38, /* U+00ff38 */ + 0x00ff39, /* U+00ff39 */ + 0x00ff3a, /* U+00ff3a */ + 0x010400, /* U+010400 */ + 0x010401, /* U+010401 */ + 0x010402, /* U+010402 */ + 0x010403, /* U+010403 */ + 0x010404, /* U+010404 */ + 0x010405, /* U+010405 */ + 0x010406, /* U+010406 */ + 0x010407, /* U+010407 */ + 0x010408, /* U+010408 */ + 0x010409, /* U+010409 */ + 0x01040a, /* U+01040a */ + 0x01040b, /* U+01040b */ + 0x01040c, /* U+01040c */ + 0x01040d, /* U+01040d */ + 0x01040e, /* U+01040e */ + 0x01040f, /* U+01040f */ + 0x010410, /* U+010410 */ + 0x010411, /* U+010411 */ + 0x010412, /* U+010412 */ + 0x010413, /* U+010413 */ + 0x010414, /* U+010414 */ + 0x010415, /* U+010415 */ + 0x010416, /* U+010416 */ + 0x010417, /* U+010417 */ + 0x010418, /* U+010418 */ + 0x010419, /* U+010419 */ + 0x01041a, /* U+01041a */ + 0x01041b, /* U+01041b */ + 0x01041c, /* U+01041c */ + 0x01041d, /* U+01041d */ + 0x01041e, /* U+01041e */ + 0x01041f, /* U+01041f */ + 0x010420, /* U+010420 */ + 0x010421, /* U+010421 */ + 0x010422, /* U+010422 */ + 0x010423, /* U+010423 */ + 0x010424, /* U+010424 */ + 0x010425, /* U+010425 */ + 0x010426, /* U+010426 */ + 0x010427, /* U+010427 */ + 0x0104b0, /* U+0104b0 */ + 0x0104b1, /* U+0104b1 */ + 0x0104b2, /* U+0104b2 */ + 0x0104b3, /* U+0104b3 */ + 0x0104b4, /* U+0104b4 */ + 0x0104b5, /* U+0104b5 */ + 0x0104b6, /* U+0104b6 */ + 0x0104b7, /* U+0104b7 */ + 0x0104b8, /* U+0104b8 */ + 0x0104b9, /* U+0104b9 */ + 0x0104ba, /* U+0104ba */ + 0x0104bb, /* U+0104bb */ + 0x0104bc, /* U+0104bc */ + 0x0104bd, /* U+0104bd */ + 0x0104be, /* U+0104be */ + 0x0104bf, /* U+0104bf */ + 0x0104c0, /* U+0104c0 */ + 0x0104c1, /* U+0104c1 */ + 0x0104c2, /* U+0104c2 */ + 0x0104c3, /* U+0104c3 */ + 0x0104c4, /* U+0104c4 */ + 0x0104c5, /* U+0104c5 */ + 0x0104c6, /* U+0104c6 */ + 0x0104c7, /* U+0104c7 */ + 0x0104c8, /* U+0104c8 */ + 0x0104c9, /* U+0104c9 */ + 0x0104ca, /* U+0104ca */ + 0x0104cb, /* U+0104cb */ + 0x0104cc, /* U+0104cc */ + 0x0104cd, /* U+0104cd */ + 0x0104ce, /* U+0104ce */ + 0x0104cf, /* U+0104cf */ + 0x0104d0, /* U+0104d0 */ + 0x0104d1, /* U+0104d1 */ + 0x0104d2, /* U+0104d2 */ + 0x0104d3, /* U+0104d3 */ + 0x010570, /* U+010570 */ + 0x010571, /* U+010571 */ + 0x010572, /* U+010572 */ + 0x010573, /* U+010573 */ + 0x010574, /* U+010574 */ + 0x010575, /* U+010575 */ + 0x010576, /* U+010576 */ + 0x010577, /* U+010577 */ + 0x010578, /* U+010578 */ + 0x010579, /* U+010579 */ + 0x01057a, /* U+01057a */ + 0x01057c, /* U+01057c */ + 0x01057d, /* U+01057d */ + 0x01057e, /* U+01057e */ + 0x01057f, /* U+01057f */ + 0x010580, /* U+010580 */ + 0x010581, /* U+010581 */ + 0x010582, /* U+010582 */ + 0x010583, /* U+010583 */ + 0x010584, /* U+010584 */ + 0x010585, /* U+010585 */ + 0x010586, /* U+010586 */ + 0x010587, /* U+010587 */ + 0x010588, /* U+010588 */ + 0x010589, /* U+010589 */ + 0x01058a, /* U+01058a */ + 0x01058c, /* U+01058c */ + 0x01058d, /* U+01058d */ + 0x01058e, /* U+01058e */ + 0x01058f, /* U+01058f */ + 0x010590, /* U+010590 */ + 0x010591, /* U+010591 */ + 0x010592, /* U+010592 */ + 0x010594, /* U+010594 */ + 0x010595, /* U+010595 */ + 0x010c80, /* U+010c80 */ + 0x010c81, /* U+010c81 */ + 0x010c82, /* U+010c82 */ + 0x010c83, /* U+010c83 */ + 0x010c84, /* U+010c84 */ + 0x010c85, /* U+010c85 */ + 0x010c86, /* U+010c86 */ + 0x010c87, /* U+010c87 */ + 0x010c88, /* U+010c88 */ + 0x010c89, /* U+010c89 */ + 0x010c8a, /* U+010c8a */ + 0x010c8b, /* U+010c8b */ + 0x010c8c, /* U+010c8c */ + 0x010c8d, /* U+010c8d */ + 0x010c8e, /* U+010c8e */ + 0x010c8f, /* U+010c8f */ + 0x010c90, /* U+010c90 */ + 0x010c91, /* U+010c91 */ + 0x010c92, /* U+010c92 */ + 0x010c93, /* U+010c93 */ + 0x010c94, /* U+010c94 */ + 0x010c95, /* U+010c95 */ + 0x010c96, /* U+010c96 */ + 0x010c97, /* U+010c97 */ + 0x010c98, /* U+010c98 */ + 0x010c99, /* U+010c99 */ + 0x010c9a, /* U+010c9a */ + 0x010c9b, /* U+010c9b */ + 0x010c9c, /* U+010c9c */ + 0x010c9d, /* U+010c9d */ + 0x010c9e, /* U+010c9e */ + 0x010c9f, /* U+010c9f */ + 0x010ca0, /* U+010ca0 */ + 0x010ca1, /* U+010ca1 */ + 0x010ca2, /* U+010ca2 */ + 0x010ca3, /* U+010ca3 */ + 0x010ca4, /* U+010ca4 */ + 0x010ca5, /* U+010ca5 */ + 0x010ca6, /* U+010ca6 */ + 0x010ca7, /* U+010ca7 */ + 0x010ca8, /* U+010ca8 */ + 0x010ca9, /* U+010ca9 */ + 0x010caa, /* U+010caa */ + 0x010cab, /* U+010cab */ + 0x010cac, /* U+010cac */ + 0x010cad, /* U+010cad */ + 0x010cae, /* U+010cae */ + 0x010caf, /* U+010caf */ + 0x010cb0, /* U+010cb0 */ + 0x010cb1, /* U+010cb1 */ + 0x010cb2, /* U+010cb2 */ + 0x010d50, /* U+010d50 */ + 0x010d51, /* U+010d51 */ + 0x010d52, /* U+010d52 */ + 0x010d53, /* U+010d53 */ + 0x010d54, /* U+010d54 */ + 0x010d55, /* U+010d55 */ + 0x010d56, /* U+010d56 */ + 0x010d57, /* U+010d57 */ + 0x010d58, /* U+010d58 */ + 0x010d59, /* U+010d59 */ + 0x010d5a, /* U+010d5a */ + 0x010d5b, /* U+010d5b */ + 0x010d5c, /* U+010d5c */ + 0x010d5d, /* U+010d5d */ + 0x010d5e, /* U+010d5e */ + 0x010d5f, /* U+010d5f */ + 0x010d60, /* U+010d60 */ + 0x010d61, /* U+010d61 */ + 0x010d62, /* U+010d62 */ + 0x010d63, /* U+010d63 */ + 0x010d64, /* U+010d64 */ + 0x010d65, /* U+010d65 */ + 0x0118a0, /* U+0118a0 */ + 0x0118a1, /* U+0118a1 */ + 0x0118a2, /* U+0118a2 */ + 0x0118a3, /* U+0118a3 */ + 0x0118a4, /* U+0118a4 */ + 0x0118a5, /* U+0118a5 */ + 0x0118a6, /* U+0118a6 */ + 0x0118a7, /* U+0118a7 */ + 0x0118a8, /* U+0118a8 */ + 0x0118a9, /* U+0118a9 */ + 0x0118aa, /* U+0118aa */ + 0x0118ab, /* U+0118ab */ + 0x0118ac, /* U+0118ac */ + 0x0118ad, /* U+0118ad */ + 0x0118ae, /* U+0118ae */ + 0x0118af, /* U+0118af */ + 0x0118b0, /* U+0118b0 */ + 0x0118b1, /* U+0118b1 */ + 0x0118b2, /* U+0118b2 */ + 0x0118b3, /* U+0118b3 */ + 0x0118b4, /* U+0118b4 */ + 0x0118b5, /* U+0118b5 */ + 0x0118b6, /* U+0118b6 */ + 0x0118b7, /* U+0118b7 */ + 0x0118b8, /* U+0118b8 */ + 0x0118b9, /* U+0118b9 */ + 0x0118ba, /* U+0118ba */ + 0x0118bb, /* U+0118bb */ + 0x0118bc, /* U+0118bc */ + 0x0118bd, /* U+0118bd */ + 0x0118be, /* U+0118be */ + 0x0118bf, /* U+0118bf */ + 0x016e40, /* U+016e40 */ + 0x016e41, /* U+016e41 */ + 0x016e42, /* U+016e42 */ + 0x016e43, /* U+016e43 */ + 0x016e44, /* U+016e44 */ + 0x016e45, /* U+016e45 */ + 0x016e46, /* U+016e46 */ + 0x016e47, /* U+016e47 */ + 0x016e48, /* U+016e48 */ + 0x016e49, /* U+016e49 */ + 0x016e4a, /* U+016e4a */ + 0x016e4b, /* U+016e4b */ + 0x016e4c, /* U+016e4c */ + 0x016e4d, /* U+016e4d */ + 0x016e4e, /* U+016e4e */ + 0x016e4f, /* U+016e4f */ + 0x016e50, /* U+016e50 */ + 0x016e51, /* U+016e51 */ + 0x016e52, /* U+016e52 */ + 0x016e53, /* U+016e53 */ + 0x016e54, /* U+016e54 */ + 0x016e55, /* U+016e55 */ + 0x016e56, /* U+016e56 */ + 0x016e57, /* U+016e57 */ + 0x016e58, /* U+016e58 */ + 0x016e59, /* U+016e59 */ + 0x016e5a, /* U+016e5a */ + 0x016e5b, /* U+016e5b */ + 0x016e5c, /* U+016e5c */ + 0x016e5d, /* U+016e5d */ + 0x016e5e, /* U+016e5e */ + 0x016e5f, /* U+016e5f */ + 0x01e900, /* U+01e900 */ + 0x01e901, /* U+01e901 */ + 0x01e902, /* U+01e902 */ + 0x01e903, /* U+01e903 */ + 0x01e904, /* U+01e904 */ + 0x01e905, /* U+01e905 */ + 0x01e906, /* U+01e906 */ + 0x01e907, /* U+01e907 */ + 0x01e908, /* U+01e908 */ + 0x01e909, /* U+01e909 */ + 0x01e90a, /* U+01e90a */ + 0x01e90b, /* U+01e90b */ + 0x01e90c, /* U+01e90c */ + 0x01e90d, /* U+01e90d */ + 0x01e90e, /* U+01e90e */ + 0x01e90f, /* U+01e90f */ + 0x01e910, /* U+01e910 */ + 0x01e911, /* U+01e911 */ + 0x01e912, /* U+01e912 */ + 0x01e913, /* U+01e913 */ + 0x01e914, /* U+01e914 */ + 0x01e915, /* U+01e915 */ + 0x01e916, /* U+01e916 */ + 0x01e917, /* U+01e917 */ + 0x01e918, /* U+01e918 */ + 0x01e919, /* U+01e919 */ + 0x01e91a, /* U+01e91a */ + 0x01e91b, /* U+01e91b */ + 0x01e91c, /* U+01e91c */ + 0x01e91d, /* U+01e91d */ + 0x01e91e, /* U+01e91e */ + 0x01e91f, /* U+01e91f */ + 0x01e920, /* U+01e920 */ + 0x01e921, /* U+01e921 */ + +}; + +/* + * The entry case_map_upper[case_index(codepoint)] is the mapping for the + * given codepoint. + */ +static const pg_wchar case_map_upper[1704] = +{ + 0x000000, /* reserved */ + 0x000000, /* U+000000 */ + 0x000001, /* U+000001 */ + 0x000002, /* U+000002 */ + 0x000003, /* U+000003 */ + 0x000004, /* U+000004 */ + 0x000005, /* U+000005 */ + 0x000006, /* U+000006 */ + 0x000007, /* U+000007 */ + 0x000008, /* U+000008 */ + 0x000009, /* U+000009 */ + 0x00000a, /* U+00000a */ + 0x00000b, /* U+00000b */ + 0x00000c, /* U+00000c */ + 0x00000d, /* U+00000d */ + 0x00000e, /* U+00000e */ + 0x00000f, /* U+00000f */ + 0x000010, /* U+000010 */ + 0x000011, /* U+000011 */ + 0x000012, /* U+000012 */ + 0x000013, /* U+000013 */ + 0x000014, /* U+000014 */ + 0x000015, /* U+000015 */ + 0x000016, /* U+000016 */ + 0x000017, /* U+000017 */ + 0x000018, /* U+000018 */ + 0x000019, /* U+000019 */ + 0x00001a, /* U+00001a */ + 0x00001b, /* U+00001b */ + 0x00001c, /* U+00001c */ + 0x00001d, /* U+00001d */ + 0x00001e, /* U+00001e */ + 0x00001f, /* U+00001f */ + 0x000020, /* U+000020 */ + 0x000021, /* U+000021 */ + 0x000022, /* U+000022 */ + 0x000023, /* U+000023 */ + 0x000024, /* U+000024 */ + 0x000025, /* U+000025 */ + 0x000026, /* U+000026 */ + 0x000027, /* U+000027 */ + 0x000028, /* U+000028 */ + 0x000029, /* U+000029 */ + 0x00002a, /* U+00002a */ + 0x00002b, /* U+00002b */ + 0x00002c, /* U+00002c */ + 0x00002d, /* U+00002d */ + 0x00002e, /* U+00002e */ + 0x00002f, /* U+00002f */ + 0x000030, /* U+000030 */ + 0x000031, /* U+000031 */ + 0x000032, /* U+000032 */ + 0x000033, /* U+000033 */ + 0x000034, /* U+000034 */ + 0x000035, /* U+000035 */ + 0x000036, /* U+000036 */ + 0x000037, /* U+000037 */ + 0x000038, /* U+000038 */ + 0x000039, /* U+000039 */ + 0x00003a, /* U+00003a */ + 0x00003b, /* U+00003b */ + 0x00003c, /* U+00003c */ + 0x00003d, /* U+00003d */ + 0x00003e, /* U+00003e */ + 0x00003f, /* U+00003f */ + 0x000040, /* U+000040 */ + 0x000041, /* U+000041 */ + 0x000042, /* U+000042 */ + 0x000043, /* U+000043 */ + 0x000044, /* U+000044 */ + 0x000045, /* U+000045 */ + 0x000046, /* U+000046 */ + 0x000047, /* U+000047 */ + 0x000048, /* U+000048 */ + 0x000049, /* U+000049 */ + 0x00004a, /* U+00004a */ + 0x00004b, /* U+00004b */ + 0x00004c, /* U+00004c */ + 0x00004d, /* U+00004d */ + 0x00004e, /* U+00004e */ + 0x00004f, /* U+00004f */ + 0x000050, /* U+000050 */ + 0x000051, /* U+000051 */ + 0x000052, /* U+000052 */ + 0x000053, /* U+000053 */ + 0x000054, /* U+000054 */ + 0x000055, /* U+000055 */ + 0x000056, /* U+000056 */ + 0x000057, /* U+000057 */ + 0x000058, /* U+000058 */ + 0x000059, /* U+000059 */ + 0x00005a, /* U+00005a */ + 0x00005b, /* U+00005b */ + 0x00005c, /* U+00005c */ + 0x00005d, /* U+00005d */ + 0x00005e, /* U+00005e */ + 0x00005f, /* U+00005f */ + 0x000060, /* U+000060 */ + 0x000041, /* U+000061 */ + 0x000042, /* U+000062 */ + 0x000043, /* U+000063 */ + 0x000044, /* U+000064 */ + 0x000045, /* U+000065 */ + 0x000046, /* U+000066 */ + 0x000047, /* U+000067 */ + 0x000048, /* U+000068 */ + 0x000049, /* U+000069 */ + 0x00004a, /* U+00006a */ + 0x00004b, /* U+00006b */ + 0x00004c, /* U+00006c */ + 0x00004d, /* U+00006d */ + 0x00004e, /* U+00006e */ + 0x00004f, /* U+00006f */ + 0x000050, /* U+000070 */ + 0x000051, /* U+000071 */ + 0x000052, /* U+000072 */ + 0x000053, /* U+000073 */ + 0x000054, /* U+000074 */ + 0x000055, /* U+000075 */ + 0x000056, /* U+000076 */ + 0x000057, /* U+000077 */ + 0x000058, /* U+000078 */ + 0x000059, /* U+000079 */ + 0x00005a, /* U+00007a */ + 0x00007b, /* U+00007b */ + 0x00007c, /* U+00007c */ + 0x00007d, /* U+00007d */ + 0x00007e, /* U+00007e */ + 0x00007f, /* U+00007f */ + 0x00039c, /* U+0000b5 */ + 0x0000c0, /* U+0000c0 */ + 0x0000c1, /* U+0000c1 */ + 0x0000c2, /* U+0000c2 */ + 0x0000c3, /* U+0000c3 */ + 0x0000c4, /* U+0000c4 */ + 0x0000c5, /* U+0000c5 */ + 0x0000c6, /* U+0000c6 */ + 0x0000c7, /* U+0000c7 */ + 0x0000c8, /* U+0000c8 */ + 0x0000c9, /* U+0000c9 */ + 0x0000ca, /* U+0000ca */ + 0x0000cb, /* U+0000cb */ + 0x0000cc, /* U+0000cc */ + 0x0000cd, /* U+0000cd */ + 0x0000ce, /* U+0000ce */ + 0x0000cf, /* U+0000cf */ + 0x0000d0, /* U+0000d0 */ + 0x0000d1, /* U+0000d1 */ + 0x0000d2, /* U+0000d2 */ + 0x0000d3, /* U+0000d3 */ + 0x0000d4, /* U+0000d4 */ + 0x0000d5, /* U+0000d5 */ + 0x0000d6, /* U+0000d6 */ + 0x0000d8, /* U+0000d8 */ + 0x0000d9, /* U+0000d9 */ + 0x0000da, /* U+0000da */ + 0x0000db, /* U+0000db */ + 0x0000dc, /* U+0000dc */ + 0x0000dd, /* U+0000dd */ + 0x0000de, /* U+0000de */ + 0x0000df, /* U+0000df */ + 0x000178, /* U+0000ff */ + 0x000100, /* U+000100 */ + 0x000102, /* U+000102 */ + 0x000104, /* U+000104 */ + 0x000106, /* U+000106 */ + 0x000108, /* U+000108 */ + 0x00010a, /* U+00010a */ + 0x00010c, /* U+00010c */ + 0x00010e, /* U+00010e */ + 0x000110, /* U+000110 */ + 0x000112, /* U+000112 */ + 0x000114, /* U+000114 */ + 0x000116, /* U+000116 */ + 0x000118, /* U+000118 */ + 0x00011a, /* U+00011a */ + 0x00011c, /* U+00011c */ + 0x00011e, /* U+00011e */ + 0x000120, /* U+000120 */ + 0x000122, /* U+000122 */ + 0x000124, /* U+000124 */ + 0x000126, /* U+000126 */ + 0x000128, /* U+000128 */ + 0x00012a, /* U+00012a */ + 0x00012c, /* U+00012c */ + 0x00012e, /* U+00012e */ + 0x000130, /* U+000130 */ + 0x000049, /* U+000131 */ + 0x000132, /* U+000132 */ + 0x000134, /* U+000134 */ + 0x000136, /* U+000136 */ + 0x000139, /* U+000139 */ + 0x00013b, /* U+00013b */ + 0x00013d, /* U+00013d */ + 0x00013f, /* U+00013f */ + 0x000141, /* U+000141 */ + 0x000143, /* U+000143 */ + 0x000145, /* U+000145 */ + 0x000147, /* U+000147 */ + 0x000149, /* U+000149 */ + 0x00014a, /* U+00014a */ + 0x00014c, /* U+00014c */ + 0x00014e, /* U+00014e */ + 0x000150, /* U+000150 */ + 0x000152, /* U+000152 */ + 0x000154, /* U+000154 */ + 0x000156, /* U+000156 */ + 0x000158, /* U+000158 */ + 0x00015a, /* U+00015a */ + 0x00015c, /* U+00015c */ + 0x00015e, /* U+00015e */ + 0x000160, /* U+000160 */ + 0x000162, /* U+000162 */ + 0x000164, /* U+000164 */ + 0x000166, /* U+000166 */ + 0x000168, /* U+000168 */ + 0x00016a, /* U+00016a */ + 0x00016c, /* U+00016c */ + 0x00016e, /* U+00016e */ + 0x000170, /* U+000170 */ + 0x000172, /* U+000172 */ + 0x000174, /* U+000174 */ + 0x000176, /* U+000176 */ + 0x000179, /* U+000179 */ + 0x00017b, /* U+00017b */ + 0x00017d, /* U+00017d */ + 0x000053, /* U+00017f */ + 0x000243, /* U+000180 */ + 0x000181, /* U+000181 */ + 0x000182, /* U+000182 */ + 0x000184, /* U+000184 */ + 0x000186, /* U+000186 */ + 0x000187, /* U+000187 */ + 0x000189, /* U+000189 */ + 0x00018a, /* U+00018a */ + 0x00018b, /* U+00018b */ + 0x00018e, /* U+00018e */ + 0x00018f, /* U+00018f */ + 0x000190, /* U+000190 */ + 0x000191, /* U+000191 */ + 0x000193, /* U+000193 */ + 0x000194, /* U+000194 */ + 0x0001f6, /* U+000195 */ + 0x000196, /* U+000196 */ + 0x000197, /* U+000197 */ + 0x000198, /* U+000198 */ + 0x00023d, /* U+00019a */ + 0x00a7dc, /* U+00019b */ + 0x00019c, /* U+00019c */ + 0x00019d, /* U+00019d */ + 0x000220, /* U+00019e */ + 0x00019f, /* U+00019f */ + 0x0001a0, /* U+0001a0 */ + 0x0001a2, /* U+0001a2 */ + 0x0001a4, /* U+0001a4 */ + 0x0001a6, /* U+0001a6 */ + 0x0001a7, /* U+0001a7 */ + 0x0001a9, /* U+0001a9 */ + 0x0001ac, /* U+0001ac */ + 0x0001ae, /* U+0001ae */ + 0x0001af, /* U+0001af */ + 0x0001b1, /* U+0001b1 */ + 0x0001b2, /* U+0001b2 */ + 0x0001b3, /* U+0001b3 */ + 0x0001b5, /* U+0001b5 */ + 0x0001b7, /* U+0001b7 */ + 0x0001b8, /* U+0001b8 */ + 0x0001bc, /* U+0001bc */ + 0x0001f7, /* U+0001bf */ + 0x0001c4, /* U+0001c4 */ + 0x0001c7, /* U+0001c7 */ + 0x0001ca, /* U+0001ca */ + 0x0001cd, /* U+0001cd */ + 0x0001cf, /* U+0001cf */ + 0x0001d1, /* U+0001d1 */ + 0x0001d3, /* U+0001d3 */ + 0x0001d5, /* U+0001d5 */ + 0x0001d7, /* U+0001d7 */ + 0x0001d9, /* U+0001d9 */ + 0x0001db, /* U+0001db */ + 0x0001de, /* U+0001de */ + 0x0001e0, /* U+0001e0 */ + 0x0001e2, /* U+0001e2 */ + 0x0001e4, /* U+0001e4 */ + 0x0001e6, /* U+0001e6 */ + 0x0001e8, /* U+0001e8 */ + 0x0001ea, /* U+0001ea */ + 0x0001ec, /* U+0001ec */ + 0x0001ee, /* U+0001ee */ + 0x0001f0, /* U+0001f0 */ + 0x0001f1, /* U+0001f1 */ + 0x0001f4, /* U+0001f4 */ + 0x0001f8, /* U+0001f8 */ + 0x0001fa, /* U+0001fa */ + 0x0001fc, /* U+0001fc */ + 0x0001fe, /* U+0001fe */ + 0x000200, /* U+000200 */ + 0x000202, /* U+000202 */ + 0x000204, /* U+000204 */ + 0x000206, /* U+000206 */ + 0x000208, /* U+000208 */ + 0x00020a, /* U+00020a */ + 0x00020c, /* U+00020c */ + 0x00020e, /* U+00020e */ + 0x000210, /* U+000210 */ + 0x000212, /* U+000212 */ + 0x000214, /* U+000214 */ + 0x000216, /* U+000216 */ + 0x000218, /* U+000218 */ + 0x00021a, /* U+00021a */ + 0x00021c, /* U+00021c */ + 0x00021e, /* U+00021e */ + 0x000222, /* U+000222 */ + 0x000224, /* U+000224 */ + 0x000226, /* U+000226 */ + 0x000228, /* U+000228 */ + 0x00022a, /* U+00022a */ + 0x00022c, /* U+00022c */ + 0x00022e, /* U+00022e */ + 0x000230, /* U+000230 */ + 0x000232, /* U+000232 */ + 0x00023a, /* U+00023a */ + 0x00023b, /* U+00023b */ + 0x00023e, /* U+00023e */ + 0x002c7e, /* U+00023f */ + 0x002c7f, /* U+000240 */ + 0x000241, /* U+000241 */ + 0x000244, /* U+000244 */ + 0x000245, /* U+000245 */ + 0x000246, /* U+000246 */ + 0x000248, /* U+000248 */ + 0x00024a, /* U+00024a */ + 0x00024c, /* U+00024c */ + 0x00024e, /* U+00024e */ + 0x002c6f, /* U+000250 */ + 0x002c6d, /* U+000251 */ + 0x002c70, /* U+000252 */ + 0x00a7ab, /* U+00025c */ + 0x00a7ac, /* U+000261 */ + 0x00a7cb, /* U+000264 */ + 0x00a78d, /* U+000265 */ + 0x00a7aa, /* U+000266 */ + 0x00a7ae, /* U+00026a */ + 0x002c62, /* U+00026b */ + 0x00a7ad, /* U+00026c */ + 0x002c6e, /* U+000271 */ + 0x002c64, /* U+00027d */ + 0x00a7c5, /* U+000282 */ + 0x00a7b1, /* U+000287 */ + 0x00a7b2, /* U+00029d */ + 0x00a7b0, /* U+00029e */ + 0x000399, /* U+000345 */ + 0x000370, /* U+000370 */ + 0x000372, /* U+000372 */ + 0x000376, /* U+000376 */ + 0x0003fd, /* U+00037b */ + 0x0003fe, /* U+00037c */ + 0x0003ff, /* U+00037d */ + 0x00037f, /* U+00037f */ + 0x000386, /* U+000386 */ + 0x000388, /* U+000388 */ + 0x000389, /* U+000389 */ + 0x00038a, /* U+00038a */ + 0x00038c, /* U+00038c */ + 0x00038e, /* U+00038e */ + 0x00038f, /* U+00038f */ + 0x000390, /* U+000390 */ + 0x000391, /* U+000391 */ + 0x000392, /* U+000392 */ + 0x000393, /* U+000393 */ + 0x000394, /* U+000394 */ + 0x000395, /* U+000395 */ + 0x000396, /* U+000396 */ + 0x000397, /* U+000397 */ + 0x000398, /* U+000398 */ + 0x000399, /* U+000399 */ + 0x00039a, /* U+00039a */ + 0x00039b, /* U+00039b */ + 0x00039c, /* U+00039c */ + 0x00039d, /* U+00039d */ + 0x00039e, /* U+00039e */ + 0x00039f, /* U+00039f */ + 0x0003a0, /* U+0003a0 */ + 0x0003a1, /* U+0003a1 */ + 0x0003a3, /* U+0003a3 */ + 0x0003a4, /* U+0003a4 */ + 0x0003a5, /* U+0003a5 */ + 0x0003a6, /* U+0003a6 */ + 0x0003a7, /* U+0003a7 */ + 0x0003a8, /* U+0003a8 */ + 0x0003a9, /* U+0003a9 */ + 0x0003aa, /* U+0003aa */ + 0x0003ab, /* U+0003ab */ + 0x0003b0, /* U+0003b0 */ + 0x0003a3, /* U+0003c2 */ + 0x0003a3, /* U+0003c3 */ + 0x0003cf, /* U+0003cf */ + 0x000392, /* U+0003d0 */ + 0x000398, /* U+0003d1 */ + 0x0003a6, /* U+0003d5 */ + 0x0003a0, /* U+0003d6 */ + 0x0003d8, /* U+0003d8 */ + 0x0003da, /* U+0003da */ + 0x0003dc, /* U+0003dc */ + 0x0003de, /* U+0003de */ + 0x0003e0, /* U+0003e0 */ + 0x0003e2, /* U+0003e2 */ + 0x0003e4, /* U+0003e4 */ + 0x0003e6, /* U+0003e6 */ + 0x0003e8, /* U+0003e8 */ + 0x0003ea, /* U+0003ea */ + 0x0003ec, /* U+0003ec */ + 0x0003ee, /* U+0003ee */ + 0x00039a, /* U+0003f0 */ + 0x0003a1, /* U+0003f1 */ + 0x0003f9, /* U+0003f2 */ + 0x0003f4, /* U+0003f4 */ + 0x000395, /* U+0003f5 */ + 0x0003f7, /* U+0003f7 */ + 0x0003fa, /* U+0003fa */ + 0x000400, /* U+000400 */ + 0x000401, /* U+000401 */ + 0x000402, /* U+000402 */ + 0x000403, /* U+000403 */ + 0x000404, /* U+000404 */ + 0x000405, /* U+000405 */ + 0x000406, /* U+000406 */ + 0x000407, /* U+000407 */ + 0x000408, /* U+000408 */ + 0x000409, /* U+000409 */ + 0x00040a, /* U+00040a */ + 0x00040b, /* U+00040b */ + 0x00040c, /* U+00040c */ + 0x00040d, /* U+00040d */ + 0x00040e, /* U+00040e */ + 0x00040f, /* U+00040f */ + 0x000410, /* U+000410 */ + 0x000411, /* U+000411 */ + 0x000412, /* U+000412 */ + 0x000413, /* U+000413 */ + 0x000414, /* U+000414 */ + 0x000415, /* U+000415 */ + 0x000416, /* U+000416 */ + 0x000417, /* U+000417 */ + 0x000418, /* U+000418 */ + 0x000419, /* U+000419 */ + 0x00041a, /* U+00041a */ + 0x00041b, /* U+00041b */ + 0x00041c, /* U+00041c */ + 0x00041d, /* U+00041d */ + 0x00041e, /* U+00041e */ + 0x00041f, /* U+00041f */ + 0x000420, /* U+000420 */ + 0x000421, /* U+000421 */ + 0x000422, /* U+000422 */ + 0x000423, /* U+000423 */ + 0x000424, /* U+000424 */ + 0x000425, /* U+000425 */ + 0x000426, /* U+000426 */ + 0x000427, /* U+000427 */ + 0x000428, /* U+000428 */ + 0x000429, /* U+000429 */ + 0x00042a, /* U+00042a */ + 0x00042b, /* U+00042b */ + 0x00042c, /* U+00042c */ + 0x00042d, /* U+00042d */ + 0x00042e, /* U+00042e */ + 0x00042f, /* U+00042f */ + 0x000460, /* U+000460 */ + 0x000462, /* U+000462 */ + 0x000464, /* U+000464 */ + 0x000466, /* U+000466 */ + 0x000468, /* U+000468 */ + 0x00046a, /* U+00046a */ + 0x00046c, /* U+00046c */ + 0x00046e, /* U+00046e */ + 0x000470, /* U+000470 */ + 0x000472, /* U+000472 */ + 0x000474, /* U+000474 */ + 0x000476, /* U+000476 */ + 0x000478, /* U+000478 */ + 0x00047a, /* U+00047a */ + 0x00047c, /* U+00047c */ + 0x00047e, /* U+00047e */ + 0x000480, /* U+000480 */ + 0x00048a, /* U+00048a */ + 0x00048c, /* U+00048c */ + 0x00048e, /* U+00048e */ + 0x000490, /* U+000490 */ + 0x000492, /* U+000492 */ + 0x000494, /* U+000494 */ + 0x000496, /* U+000496 */ + 0x000498, /* U+000498 */ + 0x00049a, /* U+00049a */ + 0x00049c, /* U+00049c */ + 0x00049e, /* U+00049e */ + 0x0004a0, /* U+0004a0 */ + 0x0004a2, /* U+0004a2 */ + 0x0004a4, /* U+0004a4 */ + 0x0004a6, /* U+0004a6 */ + 0x0004a8, /* U+0004a8 */ + 0x0004aa, /* U+0004aa */ + 0x0004ac, /* U+0004ac */ + 0x0004ae, /* U+0004ae */ + 0x0004b0, /* U+0004b0 */ + 0x0004b2, /* U+0004b2 */ + 0x0004b4, /* U+0004b4 */ + 0x0004b6, /* U+0004b6 */ + 0x0004b8, /* U+0004b8 */ + 0x0004ba, /* U+0004ba */ + 0x0004bc, /* U+0004bc */ + 0x0004be, /* U+0004be */ + 0x0004c0, /* U+0004c0 */ + 0x0004c1, /* U+0004c1 */ + 0x0004c3, /* U+0004c3 */ + 0x0004c5, /* U+0004c5 */ + 0x0004c7, /* U+0004c7 */ + 0x0004c9, /* U+0004c9 */ + 0x0004cb, /* U+0004cb */ + 0x0004cd, /* U+0004cd */ + 0x0004d0, /* U+0004d0 */ + 0x0004d2, /* U+0004d2 */ + 0x0004d4, /* U+0004d4 */ + 0x0004d6, /* U+0004d6 */ + 0x0004d8, /* U+0004d8 */ + 0x0004da, /* U+0004da */ + 0x0004dc, /* U+0004dc */ + 0x0004de, /* U+0004de */ + 0x0004e0, /* U+0004e0 */ + 0x0004e2, /* U+0004e2 */ + 0x0004e4, /* U+0004e4 */ + 0x0004e6, /* U+0004e6 */ + 0x0004e8, /* U+0004e8 */ + 0x0004ea, /* U+0004ea */ + 0x0004ec, /* U+0004ec */ + 0x0004ee, /* U+0004ee */ + 0x0004f0, /* U+0004f0 */ + 0x0004f2, /* U+0004f2 */ + 0x0004f4, /* U+0004f4 */ + 0x0004f6, /* U+0004f6 */ + 0x0004f8, /* U+0004f8 */ + 0x0004fa, /* U+0004fa */ + 0x0004fc, /* U+0004fc */ + 0x0004fe, /* U+0004fe */ + 0x000500, /* U+000500 */ + 0x000502, /* U+000502 */ + 0x000504, /* U+000504 */ + 0x000506, /* U+000506 */ + 0x000508, /* U+000508 */ + 0x00050a, /* U+00050a */ + 0x00050c, /* U+00050c */ + 0x00050e, /* U+00050e */ + 0x000510, /* U+000510 */ + 0x000512, /* U+000512 */ + 0x000514, /* U+000514 */ + 0x000516, /* U+000516 */ + 0x000518, /* U+000518 */ + 0x00051a, /* U+00051a */ + 0x00051c, /* U+00051c */ + 0x00051e, /* U+00051e */ + 0x000520, /* U+000520 */ + 0x000522, /* U+000522 */ + 0x000524, /* U+000524 */ + 0x000526, /* U+000526 */ + 0x000528, /* U+000528 */ + 0x00052a, /* U+00052a */ + 0x00052c, /* U+00052c */ + 0x00052e, /* U+00052e */ + 0x000531, /* U+000531 */ + 0x000532, /* U+000532 */ + 0x000533, /* U+000533 */ + 0x000534, /* U+000534 */ + 0x000535, /* U+000535 */ + 0x000536, /* U+000536 */ + 0x000537, /* U+000537 */ + 0x000538, /* U+000538 */ + 0x000539, /* U+000539 */ + 0x00053a, /* U+00053a */ + 0x00053b, /* U+00053b */ + 0x00053c, /* U+00053c */ + 0x00053d, /* U+00053d */ + 0x00053e, /* U+00053e */ + 0x00053f, /* U+00053f */ + 0x000540, /* U+000540 */ + 0x000541, /* U+000541 */ + 0x000542, /* U+000542 */ + 0x000543, /* U+000543 */ + 0x000544, /* U+000544 */ + 0x000545, /* U+000545 */ + 0x000546, /* U+000546 */ + 0x000547, /* U+000547 */ + 0x000548, /* U+000548 */ + 0x000549, /* U+000549 */ + 0x00054a, /* U+00054a */ + 0x00054b, /* U+00054b */ + 0x00054c, /* U+00054c */ + 0x00054d, /* U+00054d */ + 0x00054e, /* U+00054e */ + 0x00054f, /* U+00054f */ + 0x000550, /* U+000550 */ + 0x000551, /* U+000551 */ + 0x000552, /* U+000552 */ + 0x000553, /* U+000553 */ + 0x000554, /* U+000554 */ + 0x000555, /* U+000555 */ + 0x000556, /* U+000556 */ + 0x000587, /* U+000587 */ + 0x0010a0, /* U+0010a0 */ + 0x0010a1, /* U+0010a1 */ + 0x0010a2, /* U+0010a2 */ + 0x0010a3, /* U+0010a3 */ + 0x0010a4, /* U+0010a4 */ + 0x0010a5, /* U+0010a5 */ + 0x0010a6, /* U+0010a6 */ + 0x0010a7, /* U+0010a7 */ + 0x0010a8, /* U+0010a8 */ + 0x0010a9, /* U+0010a9 */ + 0x0010aa, /* U+0010aa */ + 0x0010ab, /* U+0010ab */ + 0x0010ac, /* U+0010ac */ + 0x0010ad, /* U+0010ad */ + 0x0010ae, /* U+0010ae */ + 0x0010af, /* U+0010af */ + 0x0010b0, /* U+0010b0 */ + 0x0010b1, /* U+0010b1 */ + 0x0010b2, /* U+0010b2 */ + 0x0010b3, /* U+0010b3 */ + 0x0010b4, /* U+0010b4 */ + 0x0010b5, /* U+0010b5 */ + 0x0010b6, /* U+0010b6 */ + 0x0010b7, /* U+0010b7 */ + 0x0010b8, /* U+0010b8 */ + 0x0010b9, /* U+0010b9 */ + 0x0010ba, /* U+0010ba */ + 0x0010bb, /* U+0010bb */ + 0x0010bc, /* U+0010bc */ + 0x0010bd, /* U+0010bd */ + 0x0010be, /* U+0010be */ + 0x0010bf, /* U+0010bf */ + 0x0010c0, /* U+0010c0 */ + 0x0010c1, /* U+0010c1 */ + 0x0010c2, /* U+0010c2 */ + 0x0010c3, /* U+0010c3 */ + 0x0010c4, /* U+0010c4 */ + 0x0010c5, /* U+0010c5 */ + 0x0010c7, /* U+0010c7 */ + 0x0010cd, /* U+0010cd */ + 0x001c90, /* U+0010d0 */ + 0x001c91, /* U+0010d1 */ + 0x001c92, /* U+0010d2 */ + 0x001c93, /* U+0010d3 */ + 0x001c94, /* U+0010d4 */ + 0x001c95, /* U+0010d5 */ + 0x001c96, /* U+0010d6 */ + 0x001c97, /* U+0010d7 */ + 0x001c98, /* U+0010d8 */ + 0x001c99, /* U+0010d9 */ + 0x001c9a, /* U+0010da */ + 0x001c9b, /* U+0010db */ + 0x001c9c, /* U+0010dc */ + 0x001c9d, /* U+0010dd */ + 0x001c9e, /* U+0010de */ + 0x001c9f, /* U+0010df */ + 0x001ca0, /* U+0010e0 */ + 0x001ca1, /* U+0010e1 */ + 0x001ca2, /* U+0010e2 */ + 0x001ca3, /* U+0010e3 */ + 0x001ca4, /* U+0010e4 */ + 0x001ca5, /* U+0010e5 */ + 0x001ca6, /* U+0010e6 */ + 0x001ca7, /* U+0010e7 */ + 0x001ca8, /* U+0010e8 */ + 0x001ca9, /* U+0010e9 */ + 0x001caa, /* U+0010ea */ + 0x001cab, /* U+0010eb */ + 0x001cac, /* U+0010ec */ + 0x001cad, /* U+0010ed */ + 0x001cae, /* U+0010ee */ + 0x001caf, /* U+0010ef */ + 0x001cb0, /* U+0010f0 */ + 0x001cb1, /* U+0010f1 */ + 0x001cb2, /* U+0010f2 */ + 0x001cb3, /* U+0010f3 */ + 0x001cb4, /* U+0010f4 */ + 0x001cb5, /* U+0010f5 */ + 0x001cb6, /* U+0010f6 */ + 0x001cb7, /* U+0010f7 */ + 0x001cb8, /* U+0010f8 */ + 0x001cb9, /* U+0010f9 */ + 0x001cba, /* U+0010fa */ + 0x001cbd, /* U+0010fd */ + 0x001cbe, /* U+0010fe */ + 0x001cbf, /* U+0010ff */ + 0x0013a0, /* U+0013a0 */ + 0x0013a1, /* U+0013a1 */ + 0x0013a2, /* U+0013a2 */ + 0x0013a3, /* U+0013a3 */ + 0x0013a4, /* U+0013a4 */ + 0x0013a5, /* U+0013a5 */ + 0x0013a6, /* U+0013a6 */ + 0x0013a7, /* U+0013a7 */ + 0x0013a8, /* U+0013a8 */ + 0x0013a9, /* U+0013a9 */ + 0x0013aa, /* U+0013aa */ + 0x0013ab, /* U+0013ab */ + 0x0013ac, /* U+0013ac */ + 0x0013ad, /* U+0013ad */ + 0x0013ae, /* U+0013ae */ + 0x0013af, /* U+0013af */ + 0x0013b0, /* U+0013b0 */ + 0x0013b1, /* U+0013b1 */ + 0x0013b2, /* U+0013b2 */ + 0x0013b3, /* U+0013b3 */ + 0x0013b4, /* U+0013b4 */ + 0x0013b5, /* U+0013b5 */ + 0x0013b6, /* U+0013b6 */ + 0x0013b7, /* U+0013b7 */ + 0x0013b8, /* U+0013b8 */ + 0x0013b9, /* U+0013b9 */ + 0x0013ba, /* U+0013ba */ + 0x0013bb, /* U+0013bb */ + 0x0013bc, /* U+0013bc */ + 0x0013bd, /* U+0013bd */ + 0x0013be, /* U+0013be */ + 0x0013bf, /* U+0013bf */ + 0x0013c0, /* U+0013c0 */ + 0x0013c1, /* U+0013c1 */ + 0x0013c2, /* U+0013c2 */ + 0x0013c3, /* U+0013c3 */ + 0x0013c4, /* U+0013c4 */ + 0x0013c5, /* U+0013c5 */ + 0x0013c6, /* U+0013c6 */ + 0x0013c7, /* U+0013c7 */ + 0x0013c8, /* U+0013c8 */ + 0x0013c9, /* U+0013c9 */ + 0x0013ca, /* U+0013ca */ + 0x0013cb, /* U+0013cb */ + 0x0013cc, /* U+0013cc */ + 0x0013cd, /* U+0013cd */ + 0x0013ce, /* U+0013ce */ + 0x0013cf, /* U+0013cf */ + 0x0013d0, /* U+0013d0 */ + 0x0013d1, /* U+0013d1 */ + 0x0013d2, /* U+0013d2 */ + 0x0013d3, /* U+0013d3 */ + 0x0013d4, /* U+0013d4 */ + 0x0013d5, /* U+0013d5 */ + 0x0013d6, /* U+0013d6 */ + 0x0013d7, /* U+0013d7 */ + 0x0013d8, /* U+0013d8 */ + 0x0013d9, /* U+0013d9 */ + 0x0013da, /* U+0013da */ + 0x0013db, /* U+0013db */ + 0x0013dc, /* U+0013dc */ + 0x0013dd, /* U+0013dd */ + 0x0013de, /* U+0013de */ + 0x0013df, /* U+0013df */ + 0x0013e0, /* U+0013e0 */ + 0x0013e1, /* U+0013e1 */ + 0x0013e2, /* U+0013e2 */ + 0x0013e3, /* U+0013e3 */ + 0x0013e4, /* U+0013e4 */ + 0x0013e5, /* U+0013e5 */ + 0x0013e6, /* U+0013e6 */ + 0x0013e7, /* U+0013e7 */ + 0x0013e8, /* U+0013e8 */ + 0x0013e9, /* U+0013e9 */ + 0x0013ea, /* U+0013ea */ + 0x0013eb, /* U+0013eb */ + 0x0013ec, /* U+0013ec */ + 0x0013ed, /* U+0013ed */ + 0x0013ee, /* U+0013ee */ + 0x0013ef, /* U+0013ef */ + 0x0013f0, /* U+0013f0 */ + 0x0013f1, /* U+0013f1 */ + 0x0013f2, /* U+0013f2 */ + 0x0013f3, /* U+0013f3 */ + 0x0013f4, /* U+0013f4 */ + 0x0013f5, /* U+0013f5 */ + 0x000412, /* U+001c80 */ + 0x000414, /* U+001c81 */ + 0x00041e, /* U+001c82 */ + 0x000421, /* U+001c83 */ + 0x000422, /* U+001c84 */ + 0x000422, /* U+001c85 */ + 0x00042a, /* U+001c86 */ + 0x000462, /* U+001c87 */ + 0x00a64a, /* U+001c88 */ + 0x001c89, /* U+001c89 */ + 0x001c90, /* U+001c90 */ + 0x001c91, /* U+001c91 */ + 0x001c92, /* U+001c92 */ + 0x001c93, /* U+001c93 */ + 0x001c94, /* U+001c94 */ + 0x001c95, /* U+001c95 */ + 0x001c96, /* U+001c96 */ + 0x001c97, /* U+001c97 */ + 0x001c98, /* U+001c98 */ + 0x001c99, /* U+001c99 */ + 0x001c9a, /* U+001c9a */ + 0x001c9b, /* U+001c9b */ + 0x001c9c, /* U+001c9c */ + 0x001c9d, /* U+001c9d */ + 0x001c9e, /* U+001c9e */ + 0x001c9f, /* U+001c9f */ + 0x001ca0, /* U+001ca0 */ + 0x001ca1, /* U+001ca1 */ + 0x001ca2, /* U+001ca2 */ + 0x001ca3, /* U+001ca3 */ + 0x001ca4, /* U+001ca4 */ + 0x001ca5, /* U+001ca5 */ + 0x001ca6, /* U+001ca6 */ + 0x001ca7, /* U+001ca7 */ + 0x001ca8, /* U+001ca8 */ + 0x001ca9, /* U+001ca9 */ + 0x001caa, /* U+001caa */ + 0x001cab, /* U+001cab */ + 0x001cac, /* U+001cac */ + 0x001cad, /* U+001cad */ + 0x001cae, /* U+001cae */ + 0x001caf, /* U+001caf */ + 0x001cb0, /* U+001cb0 */ + 0x001cb1, /* U+001cb1 */ + 0x001cb2, /* U+001cb2 */ + 0x001cb3, /* U+001cb3 */ + 0x001cb4, /* U+001cb4 */ + 0x001cb5, /* U+001cb5 */ + 0x001cb6, /* U+001cb6 */ + 0x001cb7, /* U+001cb7 */ + 0x001cb8, /* U+001cb8 */ + 0x001cb9, /* U+001cb9 */ + 0x001cba, /* U+001cba */ + 0x001cbd, /* U+001cbd */ + 0x001cbe, /* U+001cbe */ + 0x001cbf, /* U+001cbf */ + 0x00a77d, /* U+001d79 */ + 0x002c63, /* U+001d7d */ + 0x00a7c6, /* U+001d8e */ + 0x001e00, /* U+001e00 */ + 0x001e02, /* U+001e02 */ + 0x001e04, /* U+001e04 */ + 0x001e06, /* U+001e06 */ + 0x001e08, /* U+001e08 */ + 0x001e0a, /* U+001e0a */ + 0x001e0c, /* U+001e0c */ + 0x001e0e, /* U+001e0e */ + 0x001e10, /* U+001e10 */ + 0x001e12, /* U+001e12 */ + 0x001e14, /* U+001e14 */ + 0x001e16, /* U+001e16 */ + 0x001e18, /* U+001e18 */ + 0x001e1a, /* U+001e1a */ + 0x001e1c, /* U+001e1c */ + 0x001e1e, /* U+001e1e */ + 0x001e20, /* U+001e20 */ + 0x001e22, /* U+001e22 */ + 0x001e24, /* U+001e24 */ + 0x001e26, /* U+001e26 */ + 0x001e28, /* U+001e28 */ + 0x001e2a, /* U+001e2a */ + 0x001e2c, /* U+001e2c */ + 0x001e2e, /* U+001e2e */ + 0x001e30, /* U+001e30 */ + 0x001e32, /* U+001e32 */ + 0x001e34, /* U+001e34 */ + 0x001e36, /* U+001e36 */ + 0x001e38, /* U+001e38 */ + 0x001e3a, /* U+001e3a */ + 0x001e3c, /* U+001e3c */ + 0x001e3e, /* U+001e3e */ + 0x001e40, /* U+001e40 */ + 0x001e42, /* U+001e42 */ + 0x001e44, /* U+001e44 */ + 0x001e46, /* U+001e46 */ + 0x001e48, /* U+001e48 */ + 0x001e4a, /* U+001e4a */ + 0x001e4c, /* U+001e4c */ + 0x001e4e, /* U+001e4e */ + 0x001e50, /* U+001e50 */ + 0x001e52, /* U+001e52 */ + 0x001e54, /* U+001e54 */ + 0x001e56, /* U+001e56 */ + 0x001e58, /* U+001e58 */ + 0x001e5a, /* U+001e5a */ + 0x001e5c, /* U+001e5c */ + 0x001e5e, /* U+001e5e */ + 0x001e60, /* U+001e60 */ + 0x001e62, /* U+001e62 */ + 0x001e64, /* U+001e64 */ + 0x001e66, /* U+001e66 */ + 0x001e68, /* U+001e68 */ + 0x001e6a, /* U+001e6a */ + 0x001e6c, /* U+001e6c */ + 0x001e6e, /* U+001e6e */ + 0x001e70, /* U+001e70 */ + 0x001e72, /* U+001e72 */ + 0x001e74, /* U+001e74 */ + 0x001e76, /* U+001e76 */ + 0x001e78, /* U+001e78 */ + 0x001e7a, /* U+001e7a */ + 0x001e7c, /* U+001e7c */ + 0x001e7e, /* U+001e7e */ + 0x001e80, /* U+001e80 */ + 0x001e82, /* U+001e82 */ + 0x001e84, /* U+001e84 */ + 0x001e86, /* U+001e86 */ + 0x001e88, /* U+001e88 */ + 0x001e8a, /* U+001e8a */ + 0x001e8c, /* U+001e8c */ + 0x001e8e, /* U+001e8e */ + 0x001e90, /* U+001e90 */ + 0x001e92, /* U+001e92 */ + 0x001e94, /* U+001e94 */ + 0x001e96, /* U+001e96 */ + 0x001e97, /* U+001e97 */ + 0x001e98, /* U+001e98 */ + 0x001e99, /* U+001e99 */ + 0x001e9a, /* U+001e9a */ + 0x001e60, /* U+001e9b */ + 0x001e9e, /* U+001e9e */ + 0x001ea0, /* U+001ea0 */ + 0x001ea2, /* U+001ea2 */ + 0x001ea4, /* U+001ea4 */ + 0x001ea6, /* U+001ea6 */ + 0x001ea8, /* U+001ea8 */ + 0x001eaa, /* U+001eaa */ + 0x001eac, /* U+001eac */ + 0x001eae, /* U+001eae */ + 0x001eb0, /* U+001eb0 */ + 0x001eb2, /* U+001eb2 */ + 0x001eb4, /* U+001eb4 */ + 0x001eb6, /* U+001eb6 */ + 0x001eb8, /* U+001eb8 */ + 0x001eba, /* U+001eba */ + 0x001ebc, /* U+001ebc */ + 0x001ebe, /* U+001ebe */ + 0x001ec0, /* U+001ec0 */ + 0x001ec2, /* U+001ec2 */ + 0x001ec4, /* U+001ec4 */ + 0x001ec6, /* U+001ec6 */ + 0x001ec8, /* U+001ec8 */ + 0x001eca, /* U+001eca */ + 0x001ecc, /* U+001ecc */ + 0x001ece, /* U+001ece */ + 0x001ed0, /* U+001ed0 */ + 0x001ed2, /* U+001ed2 */ + 0x001ed4, /* U+001ed4 */ + 0x001ed6, /* U+001ed6 */ + 0x001ed8, /* U+001ed8 */ + 0x001eda, /* U+001eda */ + 0x001edc, /* U+001edc */ + 0x001ede, /* U+001ede */ + 0x001ee0, /* U+001ee0 */ + 0x001ee2, /* U+001ee2 */ + 0x001ee4, /* U+001ee4 */ + 0x001ee6, /* U+001ee6 */ + 0x001ee8, /* U+001ee8 */ + 0x001eea, /* U+001eea */ + 0x001eec, /* U+001eec */ + 0x001eee, /* U+001eee */ + 0x001ef0, /* U+001ef0 */ + 0x001ef2, /* U+001ef2 */ + 0x001ef4, /* U+001ef4 */ + 0x001ef6, /* U+001ef6 */ + 0x001ef8, /* U+001ef8 */ + 0x001efa, /* U+001efa */ + 0x001efc, /* U+001efc */ + 0x001efe, /* U+001efe */ + 0x001f08, /* U+001f00 */ + 0x001f09, /* U+001f01 */ + 0x001f0a, /* U+001f02 */ + 0x001f0b, /* U+001f03 */ + 0x001f0c, /* U+001f04 */ + 0x001f0d, /* U+001f05 */ + 0x001f0e, /* U+001f06 */ + 0x001f0f, /* U+001f07 */ + 0x001f18, /* U+001f10 */ + 0x001f19, /* U+001f11 */ + 0x001f1a, /* U+001f12 */ + 0x001f1b, /* U+001f13 */ + 0x001f1c, /* U+001f14 */ + 0x001f1d, /* U+001f15 */ + 0x001f28, /* U+001f20 */ + 0x001f29, /* U+001f21 */ + 0x001f2a, /* U+001f22 */ + 0x001f2b, /* U+001f23 */ + 0x001f2c, /* U+001f24 */ + 0x001f2d, /* U+001f25 */ + 0x001f2e, /* U+001f26 */ + 0x001f2f, /* U+001f27 */ + 0x001f38, /* U+001f30 */ + 0x001f39, /* U+001f31 */ + 0x001f3a, /* U+001f32 */ + 0x001f3b, /* U+001f33 */ + 0x001f3c, /* U+001f34 */ + 0x001f3d, /* U+001f35 */ + 0x001f3e, /* U+001f36 */ + 0x001f3f, /* U+001f37 */ + 0x001f48, /* U+001f40 */ + 0x001f49, /* U+001f41 */ + 0x001f4a, /* U+001f42 */ + 0x001f4b, /* U+001f43 */ + 0x001f4c, /* U+001f44 */ + 0x001f4d, /* U+001f45 */ + 0x001f50, /* U+001f50 */ + 0x001f59, /* U+001f51 */ + 0x001f52, /* U+001f52 */ + 0x001f5b, /* U+001f53 */ + 0x001f54, /* U+001f54 */ + 0x001f5d, /* U+001f55 */ + 0x001f56, /* U+001f56 */ + 0x001f5f, /* U+001f57 */ + 0x001f68, /* U+001f60 */ + 0x001f69, /* U+001f61 */ + 0x001f6a, /* U+001f62 */ + 0x001f6b, /* U+001f63 */ + 0x001f6c, /* U+001f64 */ + 0x001f6d, /* U+001f65 */ + 0x001f6e, /* U+001f66 */ + 0x001f6f, /* U+001f67 */ + 0x001fba, /* U+001f70 */ + 0x001fbb, /* U+001f71 */ + 0x001fc8, /* U+001f72 */ + 0x001fc9, /* U+001f73 */ + 0x001fca, /* U+001f74 */ + 0x001fcb, /* U+001f75 */ + 0x001fda, /* U+001f76 */ + 0x001fdb, /* U+001f77 */ + 0x001ff8, /* U+001f78 */ + 0x001ff9, /* U+001f79 */ + 0x001fea, /* U+001f7a */ + 0x001feb, /* U+001f7b */ + 0x001ffa, /* U+001f7c */ + 0x001ffb, /* U+001f7d */ + 0x001f88, /* U+001f80 */ + 0x001f89, /* U+001f81 */ + 0x001f8a, /* U+001f82 */ + 0x001f8b, /* U+001f83 */ + 0x001f8c, /* U+001f84 */ + 0x001f8d, /* U+001f85 */ + 0x001f8e, /* U+001f86 */ + 0x001f8f, /* U+001f87 */ + 0x001f88, /* U+001f88 */ + 0x001f89, /* U+001f89 */ + 0x001f8a, /* U+001f8a */ + 0x001f8b, /* U+001f8b */ + 0x001f8c, /* U+001f8c */ + 0x001f8d, /* U+001f8d */ + 0x001f8e, /* U+001f8e */ + 0x001f8f, /* U+001f8f */ + 0x001f98, /* U+001f90 */ + 0x001f99, /* U+001f91 */ + 0x001f9a, /* U+001f92 */ + 0x001f9b, /* U+001f93 */ + 0x001f9c, /* U+001f94 */ + 0x001f9d, /* U+001f95 */ + 0x001f9e, /* U+001f96 */ + 0x001f9f, /* U+001f97 */ + 0x001f98, /* U+001f98 */ + 0x001f99, /* U+001f99 */ + 0x001f9a, /* U+001f9a */ + 0x001f9b, /* U+001f9b */ + 0x001f9c, /* U+001f9c */ + 0x001f9d, /* U+001f9d */ + 0x001f9e, /* U+001f9e */ + 0x001f9f, /* U+001f9f */ + 0x001fa8, /* U+001fa0 */ + 0x001fa9, /* U+001fa1 */ + 0x001faa, /* U+001fa2 */ + 0x001fab, /* U+001fa3 */ + 0x001fac, /* U+001fa4 */ + 0x001fad, /* U+001fa5 */ + 0x001fae, /* U+001fa6 */ + 0x001faf, /* U+001fa7 */ + 0x001fa8, /* U+001fa8 */ + 0x001fa9, /* U+001fa9 */ + 0x001faa, /* U+001faa */ + 0x001fab, /* U+001fab */ + 0x001fac, /* U+001fac */ + 0x001fad, /* U+001fad */ + 0x001fae, /* U+001fae */ + 0x001faf, /* U+001faf */ + 0x001fb8, /* U+001fb0 */ + 0x001fb9, /* U+001fb1 */ + 0x001fb2, /* U+001fb2 */ + 0x001fbc, /* U+001fb3 */ + 0x001fb4, /* U+001fb4 */ + 0x001fb6, /* U+001fb6 */ + 0x001fb7, /* U+001fb7 */ + 0x001fbc, /* U+001fbc */ + 0x000399, /* U+001fbe */ + 0x001fc2, /* U+001fc2 */ + 0x001fcc, /* U+001fc3 */ + 0x001fc4, /* U+001fc4 */ + 0x001fc6, /* U+001fc6 */ + 0x001fc7, /* U+001fc7 */ + 0x001fcc, /* U+001fcc */ + 0x001fd8, /* U+001fd0 */ + 0x001fd9, /* U+001fd1 */ + 0x001fd2, /* U+001fd2 */ + 0x001fd3, /* U+001fd3 */ + 0x001fd6, /* U+001fd6 */ + 0x001fd7, /* U+001fd7 */ + 0x001fe8, /* U+001fe0 */ + 0x001fe9, /* U+001fe1 */ + 0x001fe2, /* U+001fe2 */ + 0x001fe3, /* U+001fe3 */ + 0x001fe4, /* U+001fe4 */ + 0x001fec, /* U+001fe5 */ + 0x001fe6, /* U+001fe6 */ + 0x001fe7, /* U+001fe7 */ + 0x001ff2, /* U+001ff2 */ + 0x001ffc, /* U+001ff3 */ + 0x001ff4, /* U+001ff4 */ + 0x001ff6, /* U+001ff6 */ + 0x001ff7, /* U+001ff7 */ + 0x001ffc, /* U+001ffc */ + 0x002126, /* U+002126 */ + 0x00212a, /* U+00212a */ + 0x00212b, /* U+00212b */ + 0x002132, /* U+002132 */ + 0x002160, /* U+002160 */ + 0x002161, /* U+002161 */ + 0x002162, /* U+002162 */ + 0x002163, /* U+002163 */ + 0x002164, /* U+002164 */ + 0x002165, /* U+002165 */ + 0x002166, /* U+002166 */ + 0x002167, /* U+002167 */ + 0x002168, /* U+002168 */ + 0x002169, /* U+002169 */ + 0x00216a, /* U+00216a */ + 0x00216b, /* U+00216b */ + 0x00216c, /* U+00216c */ + 0x00216d, /* U+00216d */ + 0x00216e, /* U+00216e */ + 0x00216f, /* U+00216f */ + 0x002183, /* U+002183 */ + 0x0024b6, /* U+0024b6 */ + 0x0024b7, /* U+0024b7 */ + 0x0024b8, /* U+0024b8 */ + 0x0024b9, /* U+0024b9 */ + 0x0024ba, /* U+0024ba */ + 0x0024bb, /* U+0024bb */ + 0x0024bc, /* U+0024bc */ + 0x0024bd, /* U+0024bd */ + 0x0024be, /* U+0024be */ + 0x0024bf, /* U+0024bf */ + 0x0024c0, /* U+0024c0 */ + 0x0024c1, /* U+0024c1 */ + 0x0024c2, /* U+0024c2 */ + 0x0024c3, /* U+0024c3 */ + 0x0024c4, /* U+0024c4 */ + 0x0024c5, /* U+0024c5 */ + 0x0024c6, /* U+0024c6 */ + 0x0024c7, /* U+0024c7 */ + 0x0024c8, /* U+0024c8 */ + 0x0024c9, /* U+0024c9 */ + 0x0024ca, /* U+0024ca */ + 0x0024cb, /* U+0024cb */ + 0x0024cc, /* U+0024cc */ + 0x0024cd, /* U+0024cd */ + 0x0024ce, /* U+0024ce */ + 0x0024cf, /* U+0024cf */ + 0x002c00, /* U+002c00 */ + 0x002c01, /* U+002c01 */ + 0x002c02, /* U+002c02 */ + 0x002c03, /* U+002c03 */ + 0x002c04, /* U+002c04 */ + 0x002c05, /* U+002c05 */ + 0x002c06, /* U+002c06 */ + 0x002c07, /* U+002c07 */ + 0x002c08, /* U+002c08 */ + 0x002c09, /* U+002c09 */ + 0x002c0a, /* U+002c0a */ + 0x002c0b, /* U+002c0b */ + 0x002c0c, /* U+002c0c */ + 0x002c0d, /* U+002c0d */ + 0x002c0e, /* U+002c0e */ + 0x002c0f, /* U+002c0f */ + 0x002c10, /* U+002c10 */ + 0x002c11, /* U+002c11 */ + 0x002c12, /* U+002c12 */ + 0x002c13, /* U+002c13 */ + 0x002c14, /* U+002c14 */ + 0x002c15, /* U+002c15 */ + 0x002c16, /* U+002c16 */ + 0x002c17, /* U+002c17 */ + 0x002c18, /* U+002c18 */ + 0x002c19, /* U+002c19 */ + 0x002c1a, /* U+002c1a */ + 0x002c1b, /* U+002c1b */ + 0x002c1c, /* U+002c1c */ + 0x002c1d, /* U+002c1d */ + 0x002c1e, /* U+002c1e */ + 0x002c1f, /* U+002c1f */ + 0x002c20, /* U+002c20 */ + 0x002c21, /* U+002c21 */ + 0x002c22, /* U+002c22 */ + 0x002c23, /* U+002c23 */ + 0x002c24, /* U+002c24 */ + 0x002c25, /* U+002c25 */ + 0x002c26, /* U+002c26 */ + 0x002c27, /* U+002c27 */ + 0x002c28, /* U+002c28 */ + 0x002c29, /* U+002c29 */ + 0x002c2a, /* U+002c2a */ + 0x002c2b, /* U+002c2b */ + 0x002c2c, /* U+002c2c */ + 0x002c2d, /* U+002c2d */ + 0x002c2e, /* U+002c2e */ + 0x002c2f, /* U+002c2f */ + 0x002c60, /* U+002c60 */ + 0x002c67, /* U+002c67 */ + 0x002c69, /* U+002c69 */ + 0x002c6b, /* U+002c6b */ + 0x002c72, /* U+002c72 */ + 0x002c75, /* U+002c75 */ + 0x002c80, /* U+002c80 */ + 0x002c82, /* U+002c82 */ + 0x002c84, /* U+002c84 */ + 0x002c86, /* U+002c86 */ + 0x002c88, /* U+002c88 */ + 0x002c8a, /* U+002c8a */ + 0x002c8c, /* U+002c8c */ + 0x002c8e, /* U+002c8e */ + 0x002c90, /* U+002c90 */ + 0x002c92, /* U+002c92 */ + 0x002c94, /* U+002c94 */ + 0x002c96, /* U+002c96 */ + 0x002c98, /* U+002c98 */ + 0x002c9a, /* U+002c9a */ + 0x002c9c, /* U+002c9c */ + 0x002c9e, /* U+002c9e */ + 0x002ca0, /* U+002ca0 */ + 0x002ca2, /* U+002ca2 */ + 0x002ca4, /* U+002ca4 */ + 0x002ca6, /* U+002ca6 */ + 0x002ca8, /* U+002ca8 */ + 0x002caa, /* U+002caa */ + 0x002cac, /* U+002cac */ + 0x002cae, /* U+002cae */ + 0x002cb0, /* U+002cb0 */ + 0x002cb2, /* U+002cb2 */ + 0x002cb4, /* U+002cb4 */ + 0x002cb6, /* U+002cb6 */ + 0x002cb8, /* U+002cb8 */ + 0x002cba, /* U+002cba */ + 0x002cbc, /* U+002cbc */ + 0x002cbe, /* U+002cbe */ + 0x002cc0, /* U+002cc0 */ + 0x002cc2, /* U+002cc2 */ + 0x002cc4, /* U+002cc4 */ + 0x002cc6, /* U+002cc6 */ + 0x002cc8, /* U+002cc8 */ + 0x002cca, /* U+002cca */ + 0x002ccc, /* U+002ccc */ + 0x002cce, /* U+002cce */ + 0x002cd0, /* U+002cd0 */ + 0x002cd2, /* U+002cd2 */ + 0x002cd4, /* U+002cd4 */ + 0x002cd6, /* U+002cd6 */ + 0x002cd8, /* U+002cd8 */ + 0x002cda, /* U+002cda */ + 0x002cdc, /* U+002cdc */ + 0x002cde, /* U+002cde */ + 0x002ce0, /* U+002ce0 */ + 0x002ce2, /* U+002ce2 */ + 0x002ceb, /* U+002ceb */ + 0x002ced, /* U+002ced */ + 0x002cf2, /* U+002cf2 */ + 0x00a640, /* U+00a640 */ + 0x00a642, /* U+00a642 */ + 0x00a644, /* U+00a644 */ + 0x00a646, /* U+00a646 */ + 0x00a648, /* U+00a648 */ + 0x00a64a, /* U+00a64a */ + 0x00a64c, /* U+00a64c */ + 0x00a64e, /* U+00a64e */ + 0x00a650, /* U+00a650 */ + 0x00a652, /* U+00a652 */ + 0x00a654, /* U+00a654 */ + 0x00a656, /* U+00a656 */ + 0x00a658, /* U+00a658 */ + 0x00a65a, /* U+00a65a */ + 0x00a65c, /* U+00a65c */ + 0x00a65e, /* U+00a65e */ + 0x00a660, /* U+00a660 */ + 0x00a662, /* U+00a662 */ + 0x00a664, /* U+00a664 */ + 0x00a666, /* U+00a666 */ + 0x00a668, /* U+00a668 */ + 0x00a66a, /* U+00a66a */ + 0x00a66c, /* U+00a66c */ + 0x00a680, /* U+00a680 */ + 0x00a682, /* U+00a682 */ + 0x00a684, /* U+00a684 */ + 0x00a686, /* U+00a686 */ + 0x00a688, /* U+00a688 */ + 0x00a68a, /* U+00a68a */ + 0x00a68c, /* U+00a68c */ + 0x00a68e, /* U+00a68e */ + 0x00a690, /* U+00a690 */ + 0x00a692, /* U+00a692 */ + 0x00a694, /* U+00a694 */ + 0x00a696, /* U+00a696 */ + 0x00a698, /* U+00a698 */ + 0x00a69a, /* U+00a69a */ + 0x00a722, /* U+00a722 */ + 0x00a724, /* U+00a724 */ + 0x00a726, /* U+00a726 */ + 0x00a728, /* U+00a728 */ + 0x00a72a, /* U+00a72a */ + 0x00a72c, /* U+00a72c */ + 0x00a72e, /* U+00a72e */ + 0x00a732, /* U+00a732 */ + 0x00a734, /* U+00a734 */ + 0x00a736, /* U+00a736 */ + 0x00a738, /* U+00a738 */ + 0x00a73a, /* U+00a73a */ + 0x00a73c, /* U+00a73c */ + 0x00a73e, /* U+00a73e */ + 0x00a740, /* U+00a740 */ + 0x00a742, /* U+00a742 */ + 0x00a744, /* U+00a744 */ + 0x00a746, /* U+00a746 */ + 0x00a748, /* U+00a748 */ + 0x00a74a, /* U+00a74a */ + 0x00a74c, /* U+00a74c */ + 0x00a74e, /* U+00a74e */ + 0x00a750, /* U+00a750 */ + 0x00a752, /* U+00a752 */ + 0x00a754, /* U+00a754 */ + 0x00a756, /* U+00a756 */ + 0x00a758, /* U+00a758 */ + 0x00a75a, /* U+00a75a */ + 0x00a75c, /* U+00a75c */ + 0x00a75e, /* U+00a75e */ + 0x00a760, /* U+00a760 */ + 0x00a762, /* U+00a762 */ + 0x00a764, /* U+00a764 */ + 0x00a766, /* U+00a766 */ + 0x00a768, /* U+00a768 */ + 0x00a76a, /* U+00a76a */ + 0x00a76c, /* U+00a76c */ + 0x00a76e, /* U+00a76e */ + 0x00a779, /* U+00a779 */ + 0x00a77b, /* U+00a77b */ + 0x00a77e, /* U+00a77e */ + 0x00a780, /* U+00a780 */ + 0x00a782, /* U+00a782 */ + 0x00a784, /* U+00a784 */ + 0x00a786, /* U+00a786 */ + 0x00a78b, /* U+00a78b */ + 0x00a790, /* U+00a790 */ + 0x00a792, /* U+00a792 */ + 0x00a7c4, /* U+00a794 */ + 0x00a796, /* U+00a796 */ + 0x00a798, /* U+00a798 */ + 0x00a79a, /* U+00a79a */ + 0x00a79c, /* U+00a79c */ + 0x00a79e, /* U+00a79e */ + 0x00a7a0, /* U+00a7a0 */ + 0x00a7a2, /* U+00a7a2 */ + 0x00a7a4, /* U+00a7a4 */ + 0x00a7a6, /* U+00a7a6 */ + 0x00a7a8, /* U+00a7a8 */ + 0x00a7b3, /* U+00a7b3 */ + 0x00a7b4, /* U+00a7b4 */ + 0x00a7b6, /* U+00a7b6 */ + 0x00a7b8, /* U+00a7b8 */ + 0x00a7ba, /* U+00a7ba */ + 0x00a7bc, /* U+00a7bc */ + 0x00a7be, /* U+00a7be */ + 0x00a7c0, /* U+00a7c0 */ + 0x00a7c2, /* U+00a7c2 */ + 0x00a7c7, /* U+00a7c7 */ + 0x00a7c9, /* U+00a7c9 */ + 0x00a7cc, /* U+00a7cc */ + 0x00a7d0, /* U+00a7d0 */ + 0x00a7d6, /* U+00a7d6 */ + 0x00a7d8, /* U+00a7d8 */ + 0x00a7da, /* U+00a7da */ + 0x00a7f5, /* U+00a7f5 */ + 0x00fb00, /* U+00fb00 */ + 0x00fb01, /* U+00fb01 */ + 0x00fb02, /* U+00fb02 */ + 0x00fb03, /* U+00fb03 */ + 0x00fb04, /* U+00fb04 */ + 0x00fb05, /* U+00fb05 */ + 0x00fb06, /* U+00fb06 */ + 0x00fb13, /* U+00fb13 */ + 0x00fb14, /* U+00fb14 */ + 0x00fb15, /* U+00fb15 */ + 0x00fb16, /* U+00fb16 */ + 0x00fb17, /* U+00fb17 */ + 0x00ff21, /* U+00ff21 */ + 0x00ff22, /* U+00ff22 */ + 0x00ff23, /* U+00ff23 */ + 0x00ff24, /* U+00ff24 */ + 0x00ff25, /* U+00ff25 */ + 0x00ff26, /* U+00ff26 */ + 0x00ff27, /* U+00ff27 */ + 0x00ff28, /* U+00ff28 */ + 0x00ff29, /* U+00ff29 */ + 0x00ff2a, /* U+00ff2a */ + 0x00ff2b, /* U+00ff2b */ + 0x00ff2c, /* U+00ff2c */ + 0x00ff2d, /* U+00ff2d */ + 0x00ff2e, /* U+00ff2e */ + 0x00ff2f, /* U+00ff2f */ + 0x00ff30, /* U+00ff30 */ + 0x00ff31, /* U+00ff31 */ + 0x00ff32, /* U+00ff32 */ + 0x00ff33, /* U+00ff33 */ + 0x00ff34, /* U+00ff34 */ + 0x00ff35, /* U+00ff35 */ + 0x00ff36, /* U+00ff36 */ + 0x00ff37, /* U+00ff37 */ + 0x00ff38, /* U+00ff38 */ + 0x00ff39, /* U+00ff39 */ + 0x00ff3a, /* U+00ff3a */ + 0x010400, /* U+010400 */ + 0x010401, /* U+010401 */ + 0x010402, /* U+010402 */ + 0x010403, /* U+010403 */ + 0x010404, /* U+010404 */ + 0x010405, /* U+010405 */ + 0x010406, /* U+010406 */ + 0x010407, /* U+010407 */ + 0x010408, /* U+010408 */ + 0x010409, /* U+010409 */ + 0x01040a, /* U+01040a */ + 0x01040b, /* U+01040b */ + 0x01040c, /* U+01040c */ + 0x01040d, /* U+01040d */ + 0x01040e, /* U+01040e */ + 0x01040f, /* U+01040f */ + 0x010410, /* U+010410 */ + 0x010411, /* U+010411 */ + 0x010412, /* U+010412 */ + 0x010413, /* U+010413 */ + 0x010414, /* U+010414 */ + 0x010415, /* U+010415 */ + 0x010416, /* U+010416 */ + 0x010417, /* U+010417 */ + 0x010418, /* U+010418 */ + 0x010419, /* U+010419 */ + 0x01041a, /* U+01041a */ + 0x01041b, /* U+01041b */ + 0x01041c, /* U+01041c */ + 0x01041d, /* U+01041d */ + 0x01041e, /* U+01041e */ + 0x01041f, /* U+01041f */ + 0x010420, /* U+010420 */ + 0x010421, /* U+010421 */ + 0x010422, /* U+010422 */ + 0x010423, /* U+010423 */ + 0x010424, /* U+010424 */ + 0x010425, /* U+010425 */ + 0x010426, /* U+010426 */ + 0x010427, /* U+010427 */ + 0x0104b0, /* U+0104b0 */ + 0x0104b1, /* U+0104b1 */ + 0x0104b2, /* U+0104b2 */ + 0x0104b3, /* U+0104b3 */ + 0x0104b4, /* U+0104b4 */ + 0x0104b5, /* U+0104b5 */ + 0x0104b6, /* U+0104b6 */ + 0x0104b7, /* U+0104b7 */ + 0x0104b8, /* U+0104b8 */ + 0x0104b9, /* U+0104b9 */ + 0x0104ba, /* U+0104ba */ + 0x0104bb, /* U+0104bb */ + 0x0104bc, /* U+0104bc */ + 0x0104bd, /* U+0104bd */ + 0x0104be, /* U+0104be */ + 0x0104bf, /* U+0104bf */ + 0x0104c0, /* U+0104c0 */ + 0x0104c1, /* U+0104c1 */ + 0x0104c2, /* U+0104c2 */ + 0x0104c3, /* U+0104c3 */ + 0x0104c4, /* U+0104c4 */ + 0x0104c5, /* U+0104c5 */ + 0x0104c6, /* U+0104c6 */ + 0x0104c7, /* U+0104c7 */ + 0x0104c8, /* U+0104c8 */ + 0x0104c9, /* U+0104c9 */ + 0x0104ca, /* U+0104ca */ + 0x0104cb, /* U+0104cb */ + 0x0104cc, /* U+0104cc */ + 0x0104cd, /* U+0104cd */ + 0x0104ce, /* U+0104ce */ + 0x0104cf, /* U+0104cf */ + 0x0104d0, /* U+0104d0 */ + 0x0104d1, /* U+0104d1 */ + 0x0104d2, /* U+0104d2 */ + 0x0104d3, /* U+0104d3 */ + 0x010570, /* U+010570 */ + 0x010571, /* U+010571 */ + 0x010572, /* U+010572 */ + 0x010573, /* U+010573 */ + 0x010574, /* U+010574 */ + 0x010575, /* U+010575 */ + 0x010576, /* U+010576 */ + 0x010577, /* U+010577 */ + 0x010578, /* U+010578 */ + 0x010579, /* U+010579 */ + 0x01057a, /* U+01057a */ + 0x01057c, /* U+01057c */ + 0x01057d, /* U+01057d */ + 0x01057e, /* U+01057e */ + 0x01057f, /* U+01057f */ + 0x010580, /* U+010580 */ + 0x010581, /* U+010581 */ + 0x010582, /* U+010582 */ + 0x010583, /* U+010583 */ + 0x010584, /* U+010584 */ + 0x010585, /* U+010585 */ + 0x010586, /* U+010586 */ + 0x010587, /* U+010587 */ + 0x010588, /* U+010588 */ + 0x010589, /* U+010589 */ + 0x01058a, /* U+01058a */ + 0x01058c, /* U+01058c */ + 0x01058d, /* U+01058d */ + 0x01058e, /* U+01058e */ + 0x01058f, /* U+01058f */ + 0x010590, /* U+010590 */ + 0x010591, /* U+010591 */ + 0x010592, /* U+010592 */ + 0x010594, /* U+010594 */ + 0x010595, /* U+010595 */ + 0x010c80, /* U+010c80 */ + 0x010c81, /* U+010c81 */ + 0x010c82, /* U+010c82 */ + 0x010c83, /* U+010c83 */ + 0x010c84, /* U+010c84 */ + 0x010c85, /* U+010c85 */ + 0x010c86, /* U+010c86 */ + 0x010c87, /* U+010c87 */ + 0x010c88, /* U+010c88 */ + 0x010c89, /* U+010c89 */ + 0x010c8a, /* U+010c8a */ + 0x010c8b, /* U+010c8b */ + 0x010c8c, /* U+010c8c */ + 0x010c8d, /* U+010c8d */ + 0x010c8e, /* U+010c8e */ + 0x010c8f, /* U+010c8f */ + 0x010c90, /* U+010c90 */ + 0x010c91, /* U+010c91 */ + 0x010c92, /* U+010c92 */ + 0x010c93, /* U+010c93 */ + 0x010c94, /* U+010c94 */ + 0x010c95, /* U+010c95 */ + 0x010c96, /* U+010c96 */ + 0x010c97, /* U+010c97 */ + 0x010c98, /* U+010c98 */ + 0x010c99, /* U+010c99 */ + 0x010c9a, /* U+010c9a */ + 0x010c9b, /* U+010c9b */ + 0x010c9c, /* U+010c9c */ + 0x010c9d, /* U+010c9d */ + 0x010c9e, /* U+010c9e */ + 0x010c9f, /* U+010c9f */ + 0x010ca0, /* U+010ca0 */ + 0x010ca1, /* U+010ca1 */ + 0x010ca2, /* U+010ca2 */ + 0x010ca3, /* U+010ca3 */ + 0x010ca4, /* U+010ca4 */ + 0x010ca5, /* U+010ca5 */ + 0x010ca6, /* U+010ca6 */ + 0x010ca7, /* U+010ca7 */ + 0x010ca8, /* U+010ca8 */ + 0x010ca9, /* U+010ca9 */ + 0x010caa, /* U+010caa */ + 0x010cab, /* U+010cab */ + 0x010cac, /* U+010cac */ + 0x010cad, /* U+010cad */ + 0x010cae, /* U+010cae */ + 0x010caf, /* U+010caf */ + 0x010cb0, /* U+010cb0 */ + 0x010cb1, /* U+010cb1 */ + 0x010cb2, /* U+010cb2 */ + 0x010d50, /* U+010d50 */ + 0x010d51, /* U+010d51 */ + 0x010d52, /* U+010d52 */ + 0x010d53, /* U+010d53 */ + 0x010d54, /* U+010d54 */ + 0x010d55, /* U+010d55 */ + 0x010d56, /* U+010d56 */ + 0x010d57, /* U+010d57 */ + 0x010d58, /* U+010d58 */ + 0x010d59, /* U+010d59 */ + 0x010d5a, /* U+010d5a */ + 0x010d5b, /* U+010d5b */ + 0x010d5c, /* U+010d5c */ + 0x010d5d, /* U+010d5d */ + 0x010d5e, /* U+010d5e */ + 0x010d5f, /* U+010d5f */ + 0x010d60, /* U+010d60 */ + 0x010d61, /* U+010d61 */ + 0x010d62, /* U+010d62 */ + 0x010d63, /* U+010d63 */ + 0x010d64, /* U+010d64 */ + 0x010d65, /* U+010d65 */ + 0x0118a0, /* U+0118a0 */ + 0x0118a1, /* U+0118a1 */ + 0x0118a2, /* U+0118a2 */ + 0x0118a3, /* U+0118a3 */ + 0x0118a4, /* U+0118a4 */ + 0x0118a5, /* U+0118a5 */ + 0x0118a6, /* U+0118a6 */ + 0x0118a7, /* U+0118a7 */ + 0x0118a8, /* U+0118a8 */ + 0x0118a9, /* U+0118a9 */ + 0x0118aa, /* U+0118aa */ + 0x0118ab, /* U+0118ab */ + 0x0118ac, /* U+0118ac */ + 0x0118ad, /* U+0118ad */ + 0x0118ae, /* U+0118ae */ + 0x0118af, /* U+0118af */ + 0x0118b0, /* U+0118b0 */ + 0x0118b1, /* U+0118b1 */ + 0x0118b2, /* U+0118b2 */ + 0x0118b3, /* U+0118b3 */ + 0x0118b4, /* U+0118b4 */ + 0x0118b5, /* U+0118b5 */ + 0x0118b6, /* U+0118b6 */ + 0x0118b7, /* U+0118b7 */ + 0x0118b8, /* U+0118b8 */ + 0x0118b9, /* U+0118b9 */ + 0x0118ba, /* U+0118ba */ + 0x0118bb, /* U+0118bb */ + 0x0118bc, /* U+0118bc */ + 0x0118bd, /* U+0118bd */ + 0x0118be, /* U+0118be */ + 0x0118bf, /* U+0118bf */ + 0x016e40, /* U+016e40 */ + 0x016e41, /* U+016e41 */ + 0x016e42, /* U+016e42 */ + 0x016e43, /* U+016e43 */ + 0x016e44, /* U+016e44 */ + 0x016e45, /* U+016e45 */ + 0x016e46, /* U+016e46 */ + 0x016e47, /* U+016e47 */ + 0x016e48, /* U+016e48 */ + 0x016e49, /* U+016e49 */ + 0x016e4a, /* U+016e4a */ + 0x016e4b, /* U+016e4b */ + 0x016e4c, /* U+016e4c */ + 0x016e4d, /* U+016e4d */ + 0x016e4e, /* U+016e4e */ + 0x016e4f, /* U+016e4f */ + 0x016e50, /* U+016e50 */ + 0x016e51, /* U+016e51 */ + 0x016e52, /* U+016e52 */ + 0x016e53, /* U+016e53 */ + 0x016e54, /* U+016e54 */ + 0x016e55, /* U+016e55 */ + 0x016e56, /* U+016e56 */ + 0x016e57, /* U+016e57 */ + 0x016e58, /* U+016e58 */ + 0x016e59, /* U+016e59 */ + 0x016e5a, /* U+016e5a */ + 0x016e5b, /* U+016e5b */ + 0x016e5c, /* U+016e5c */ + 0x016e5d, /* U+016e5d */ + 0x016e5e, /* U+016e5e */ + 0x016e5f, /* U+016e5f */ + 0x01e900, /* U+01e900 */ + 0x01e901, /* U+01e901 */ + 0x01e902, /* U+01e902 */ + 0x01e903, /* U+01e903 */ + 0x01e904, /* U+01e904 */ + 0x01e905, /* U+01e905 */ + 0x01e906, /* U+01e906 */ + 0x01e907, /* U+01e907 */ + 0x01e908, /* U+01e908 */ + 0x01e909, /* U+01e909 */ + 0x01e90a, /* U+01e90a */ + 0x01e90b, /* U+01e90b */ + 0x01e90c, /* U+01e90c */ + 0x01e90d, /* U+01e90d */ + 0x01e90e, /* U+01e90e */ + 0x01e90f, /* U+01e90f */ + 0x01e910, /* U+01e910 */ + 0x01e911, /* U+01e911 */ + 0x01e912, /* U+01e912 */ + 0x01e913, /* U+01e913 */ + 0x01e914, /* U+01e914 */ + 0x01e915, /* U+01e915 */ + 0x01e916, /* U+01e916 */ + 0x01e917, /* U+01e917 */ + 0x01e918, /* U+01e918 */ + 0x01e919, /* U+01e919 */ + 0x01e91a, /* U+01e91a */ + 0x01e91b, /* U+01e91b */ + 0x01e91c, /* U+01e91c */ + 0x01e91d, /* U+01e91d */ + 0x01e91e, /* U+01e91e */ + 0x01e91f, /* U+01e91f */ + 0x01e920, /* U+01e920 */ + 0x01e921, /* U+01e921 */ + +}; + +/* + * The entry case_map_fold[case_index(codepoint)] is the mapping for the + * given codepoint. + */ +static const pg_wchar case_map_fold[1704] = +{ + 0x000000, /* reserved */ + 0x000000, /* U+000000 */ + 0x000001, /* U+000001 */ + 0x000002, /* U+000002 */ + 0x000003, /* U+000003 */ + 0x000004, /* U+000004 */ + 0x000005, /* U+000005 */ + 0x000006, /* U+000006 */ + 0x000007, /* U+000007 */ + 0x000008, /* U+000008 */ + 0x000009, /* U+000009 */ + 0x00000a, /* U+00000a */ + 0x00000b, /* U+00000b */ + 0x00000c, /* U+00000c */ + 0x00000d, /* U+00000d */ + 0x00000e, /* U+00000e */ + 0x00000f, /* U+00000f */ + 0x000010, /* U+000010 */ + 0x000011, /* U+000011 */ + 0x000012, /* U+000012 */ + 0x000013, /* U+000013 */ + 0x000014, /* U+000014 */ + 0x000015, /* U+000015 */ + 0x000016, /* U+000016 */ + 0x000017, /* U+000017 */ + 0x000018, /* U+000018 */ + 0x000019, /* U+000019 */ + 0x00001a, /* U+00001a */ + 0x00001b, /* U+00001b */ + 0x00001c, /* U+00001c */ + 0x00001d, /* U+00001d */ + 0x00001e, /* U+00001e */ + 0x00001f, /* U+00001f */ + 0x000020, /* U+000020 */ + 0x000021, /* U+000021 */ + 0x000022, /* U+000022 */ + 0x000023, /* U+000023 */ + 0x000024, /* U+000024 */ + 0x000025, /* U+000025 */ + 0x000026, /* U+000026 */ + 0x000027, /* U+000027 */ + 0x000028, /* U+000028 */ + 0x000029, /* U+000029 */ + 0x00002a, /* U+00002a */ + 0x00002b, /* U+00002b */ + 0x00002c, /* U+00002c */ + 0x00002d, /* U+00002d */ + 0x00002e, /* U+00002e */ + 0x00002f, /* U+00002f */ + 0x000030, /* U+000030 */ + 0x000031, /* U+000031 */ + 0x000032, /* U+000032 */ + 0x000033, /* U+000033 */ + 0x000034, /* U+000034 */ + 0x000035, /* U+000035 */ + 0x000036, /* U+000036 */ + 0x000037, /* U+000037 */ + 0x000038, /* U+000038 */ + 0x000039, /* U+000039 */ + 0x00003a, /* U+00003a */ + 0x00003b, /* U+00003b */ + 0x00003c, /* U+00003c */ + 0x00003d, /* U+00003d */ + 0x00003e, /* U+00003e */ + 0x00003f, /* U+00003f */ + 0x000040, /* U+000040 */ + 0x000061, /* U+000041 */ + 0x000062, /* U+000042 */ + 0x000063, /* U+000043 */ + 0x000064, /* U+000044 */ + 0x000065, /* U+000045 */ + 0x000066, /* U+000046 */ + 0x000067, /* U+000047 */ + 0x000068, /* U+000048 */ + 0x000069, /* U+000049 */ + 0x00006a, /* U+00004a */ + 0x00006b, /* U+00004b */ + 0x00006c, /* U+00004c */ + 0x00006d, /* U+00004d */ + 0x00006e, /* U+00004e */ + 0x00006f, /* U+00004f */ + 0x000070, /* U+000050 */ + 0x000071, /* U+000051 */ + 0x000072, /* U+000052 */ + 0x000073, /* U+000053 */ + 0x000074, /* U+000054 */ + 0x000075, /* U+000055 */ + 0x000076, /* U+000056 */ + 0x000077, /* U+000057 */ + 0x000078, /* U+000058 */ + 0x000079, /* U+000059 */ + 0x00007a, /* U+00005a */ + 0x00005b, /* U+00005b */ + 0x00005c, /* U+00005c */ + 0x00005d, /* U+00005d */ + 0x00005e, /* U+00005e */ + 0x00005f, /* U+00005f */ + 0x000060, /* U+000060 */ + 0x000061, /* U+000061 */ + 0x000062, /* U+000062 */ + 0x000063, /* U+000063 */ + 0x000064, /* U+000064 */ + 0x000065, /* U+000065 */ + 0x000066, /* U+000066 */ + 0x000067, /* U+000067 */ + 0x000068, /* U+000068 */ + 0x000069, /* U+000069 */ + 0x00006a, /* U+00006a */ + 0x00006b, /* U+00006b */ + 0x00006c, /* U+00006c */ + 0x00006d, /* U+00006d */ + 0x00006e, /* U+00006e */ + 0x00006f, /* U+00006f */ + 0x000070, /* U+000070 */ + 0x000071, /* U+000071 */ + 0x000072, /* U+000072 */ + 0x000073, /* U+000073 */ + 0x000074, /* U+000074 */ + 0x000075, /* U+000075 */ + 0x000076, /* U+000076 */ + 0x000077, /* U+000077 */ + 0x000078, /* U+000078 */ + 0x000079, /* U+000079 */ + 0x00007a, /* U+00007a */ + 0x00007b, /* U+00007b */ + 0x00007c, /* U+00007c */ + 0x00007d, /* U+00007d */ + 0x00007e, /* U+00007e */ + 0x00007f, /* U+00007f */ + 0x0003bc, /* U+0000b5 */ + 0x0000e0, /* U+0000c0 */ + 0x0000e1, /* U+0000c1 */ + 0x0000e2, /* U+0000c2 */ + 0x0000e3, /* U+0000c3 */ + 0x0000e4, /* U+0000c4 */ + 0x0000e5, /* U+0000c5 */ + 0x0000e6, /* U+0000c6 */ + 0x0000e7, /* U+0000c7 */ + 0x0000e8, /* U+0000c8 */ + 0x0000e9, /* U+0000c9 */ + 0x0000ea, /* U+0000ca */ + 0x0000eb, /* U+0000cb */ + 0x0000ec, /* U+0000cc */ + 0x0000ed, /* U+0000cd */ + 0x0000ee, /* U+0000ce */ + 0x0000ef, /* U+0000cf */ + 0x0000f0, /* U+0000d0 */ + 0x0000f1, /* U+0000d1 */ + 0x0000f2, /* U+0000d2 */ + 0x0000f3, /* U+0000d3 */ + 0x0000f4, /* U+0000d4 */ + 0x0000f5, /* U+0000d5 */ + 0x0000f6, /* U+0000d6 */ + 0x0000f8, /* U+0000d8 */ + 0x0000f9, /* U+0000d9 */ + 0x0000fa, /* U+0000da */ + 0x0000fb, /* U+0000db */ + 0x0000fc, /* U+0000dc */ + 0x0000fd, /* U+0000dd */ + 0x0000fe, /* U+0000de */ + 0x0000df, /* U+0000df */ + 0x0000ff, /* U+0000ff */ + 0x000101, /* U+000100 */ + 0x000103, /* U+000102 */ + 0x000105, /* U+000104 */ + 0x000107, /* U+000106 */ + 0x000109, /* U+000108 */ + 0x00010b, /* U+00010a */ + 0x00010d, /* U+00010c */ + 0x00010f, /* U+00010e */ + 0x000111, /* U+000110 */ + 0x000113, /* U+000112 */ + 0x000115, /* U+000114 */ + 0x000117, /* U+000116 */ + 0x000119, /* U+000118 */ + 0x00011b, /* U+00011a */ + 0x00011d, /* U+00011c */ + 0x00011f, /* U+00011e */ + 0x000121, /* U+000120 */ + 0x000123, /* U+000122 */ + 0x000125, /* U+000124 */ + 0x000127, /* U+000126 */ + 0x000129, /* U+000128 */ + 0x00012b, /* U+00012a */ + 0x00012d, /* U+00012c */ + 0x00012f, /* U+00012e */ + 0x000130, /* U+000130 */ + 0x000131, /* U+000131 */ + 0x000133, /* U+000132 */ + 0x000135, /* U+000134 */ + 0x000137, /* U+000136 */ + 0x00013a, /* U+000139 */ + 0x00013c, /* U+00013b */ + 0x00013e, /* U+00013d */ + 0x000140, /* U+00013f */ + 0x000142, /* U+000141 */ + 0x000144, /* U+000143 */ + 0x000146, /* U+000145 */ + 0x000148, /* U+000147 */ + 0x000149, /* U+000149 */ + 0x00014b, /* U+00014a */ + 0x00014d, /* U+00014c */ + 0x00014f, /* U+00014e */ + 0x000151, /* U+000150 */ + 0x000153, /* U+000152 */ + 0x000155, /* U+000154 */ + 0x000157, /* U+000156 */ + 0x000159, /* U+000158 */ + 0x00015b, /* U+00015a */ + 0x00015d, /* U+00015c */ + 0x00015f, /* U+00015e */ + 0x000161, /* U+000160 */ + 0x000163, /* U+000162 */ + 0x000165, /* U+000164 */ + 0x000167, /* U+000166 */ + 0x000169, /* U+000168 */ + 0x00016b, /* U+00016a */ + 0x00016d, /* U+00016c */ + 0x00016f, /* U+00016e */ + 0x000171, /* U+000170 */ + 0x000173, /* U+000172 */ + 0x000175, /* U+000174 */ + 0x000177, /* U+000176 */ + 0x00017a, /* U+000179 */ + 0x00017c, /* U+00017b */ + 0x00017e, /* U+00017d */ + 0x000073, /* U+00017f */ + 0x000180, /* U+000180 */ + 0x000253, /* U+000181 */ + 0x000183, /* U+000182 */ + 0x000185, /* U+000184 */ + 0x000254, /* U+000186 */ + 0x000188, /* U+000187 */ + 0x000256, /* U+000189 */ + 0x000257, /* U+00018a */ + 0x00018c, /* U+00018b */ + 0x0001dd, /* U+00018e */ + 0x000259, /* U+00018f */ + 0x00025b, /* U+000190 */ + 0x000192, /* U+000191 */ + 0x000260, /* U+000193 */ + 0x000263, /* U+000194 */ + 0x000195, /* U+000195 */ + 0x000269, /* U+000196 */ + 0x000268, /* U+000197 */ + 0x000199, /* U+000198 */ + 0x00019a, /* U+00019a */ + 0x00019b, /* U+00019b */ + 0x00026f, /* U+00019c */ + 0x000272, /* U+00019d */ + 0x00019e, /* U+00019e */ + 0x000275, /* U+00019f */ + 0x0001a1, /* U+0001a0 */ + 0x0001a3, /* U+0001a2 */ + 0x0001a5, /* U+0001a4 */ + 0x000280, /* U+0001a6 */ + 0x0001a8, /* U+0001a7 */ + 0x000283, /* U+0001a9 */ + 0x0001ad, /* U+0001ac */ + 0x000288, /* U+0001ae */ + 0x0001b0, /* U+0001af */ + 0x00028a, /* U+0001b1 */ + 0x00028b, /* U+0001b2 */ + 0x0001b4, /* U+0001b3 */ + 0x0001b6, /* U+0001b5 */ + 0x000292, /* U+0001b7 */ + 0x0001b9, /* U+0001b8 */ + 0x0001bd, /* U+0001bc */ + 0x0001bf, /* U+0001bf */ + 0x0001c6, /* U+0001c4 */ + 0x0001c9, /* U+0001c7 */ + 0x0001cc, /* U+0001ca */ + 0x0001ce, /* U+0001cd */ + 0x0001d0, /* U+0001cf */ + 0x0001d2, /* U+0001d1 */ + 0x0001d4, /* U+0001d3 */ + 0x0001d6, /* U+0001d5 */ + 0x0001d8, /* U+0001d7 */ + 0x0001da, /* U+0001d9 */ + 0x0001dc, /* U+0001db */ + 0x0001df, /* U+0001de */ + 0x0001e1, /* U+0001e0 */ + 0x0001e3, /* U+0001e2 */ + 0x0001e5, /* U+0001e4 */ + 0x0001e7, /* U+0001e6 */ + 0x0001e9, /* U+0001e8 */ + 0x0001eb, /* U+0001ea */ + 0x0001ed, /* U+0001ec */ + 0x0001ef, /* U+0001ee */ + 0x0001f0, /* U+0001f0 */ + 0x0001f3, /* U+0001f1 */ + 0x0001f5, /* U+0001f4 */ + 0x0001f9, /* U+0001f8 */ + 0x0001fb, /* U+0001fa */ + 0x0001fd, /* U+0001fc */ + 0x0001ff, /* U+0001fe */ + 0x000201, /* U+000200 */ + 0x000203, /* U+000202 */ + 0x000205, /* U+000204 */ + 0x000207, /* U+000206 */ + 0x000209, /* U+000208 */ + 0x00020b, /* U+00020a */ + 0x00020d, /* U+00020c */ + 0x00020f, /* U+00020e */ + 0x000211, /* U+000210 */ + 0x000213, /* U+000212 */ + 0x000215, /* U+000214 */ + 0x000217, /* U+000216 */ + 0x000219, /* U+000218 */ + 0x00021b, /* U+00021a */ + 0x00021d, /* U+00021c */ + 0x00021f, /* U+00021e */ + 0x000223, /* U+000222 */ + 0x000225, /* U+000224 */ + 0x000227, /* U+000226 */ + 0x000229, /* U+000228 */ + 0x00022b, /* U+00022a */ + 0x00022d, /* U+00022c */ + 0x00022f, /* U+00022e */ + 0x000231, /* U+000230 */ + 0x000233, /* U+000232 */ + 0x002c65, /* U+00023a */ + 0x00023c, /* U+00023b */ + 0x002c66, /* U+00023e */ + 0x00023f, /* U+00023f */ + 0x000240, /* U+000240 */ + 0x000242, /* U+000241 */ + 0x000289, /* U+000244 */ + 0x00028c, /* U+000245 */ + 0x000247, /* U+000246 */ + 0x000249, /* U+000248 */ + 0x00024b, /* U+00024a */ + 0x00024d, /* U+00024c */ + 0x00024f, /* U+00024e */ + 0x000250, /* U+000250 */ + 0x000251, /* U+000251 */ + 0x000252, /* U+000252 */ + 0x00025c, /* U+00025c */ + 0x000261, /* U+000261 */ + 0x000264, /* U+000264 */ + 0x000265, /* U+000265 */ + 0x000266, /* U+000266 */ + 0x00026a, /* U+00026a */ + 0x00026b, /* U+00026b */ + 0x00026c, /* U+00026c */ + 0x000271, /* U+000271 */ + 0x00027d, /* U+00027d */ + 0x000282, /* U+000282 */ + 0x000287, /* U+000287 */ + 0x00029d, /* U+00029d */ + 0x00029e, /* U+00029e */ + 0x0003b9, /* U+000345 */ + 0x000371, /* U+000370 */ + 0x000373, /* U+000372 */ + 0x000377, /* U+000376 */ + 0x00037b, /* U+00037b */ + 0x00037c, /* U+00037c */ + 0x00037d, /* U+00037d */ + 0x0003f3, /* U+00037f */ + 0x0003ac, /* U+000386 */ + 0x0003ad, /* U+000388 */ + 0x0003ae, /* U+000389 */ + 0x0003af, /* U+00038a */ + 0x0003cc, /* U+00038c */ + 0x0003cd, /* U+00038e */ + 0x0003ce, /* U+00038f */ + 0x000390, /* U+000390 */ + 0x0003b1, /* U+000391 */ + 0x0003b2, /* U+000392 */ + 0x0003b3, /* U+000393 */ + 0x0003b4, /* U+000394 */ + 0x0003b5, /* U+000395 */ + 0x0003b6, /* U+000396 */ + 0x0003b7, /* U+000397 */ + 0x0003b8, /* U+000398 */ + 0x0003b9, /* U+000399 */ + 0x0003ba, /* U+00039a */ + 0x0003bb, /* U+00039b */ + 0x0003bc, /* U+00039c */ + 0x0003bd, /* U+00039d */ + 0x0003be, /* U+00039e */ + 0x0003bf, /* U+00039f */ + 0x0003c0, /* U+0003a0 */ + 0x0003c1, /* U+0003a1 */ + 0x0003c3, /* U+0003a3 */ + 0x0003c4, /* U+0003a4 */ + 0x0003c5, /* U+0003a5 */ + 0x0003c6, /* U+0003a6 */ + 0x0003c7, /* U+0003a7 */ + 0x0003c8, /* U+0003a8 */ + 0x0003c9, /* U+0003a9 */ + 0x0003ca, /* U+0003aa */ + 0x0003cb, /* U+0003ab */ + 0x0003b0, /* U+0003b0 */ + 0x0003c3, /* U+0003c2 */ + 0x0003c3, /* U+0003c3 */ + 0x0003d7, /* U+0003cf */ + 0x0003b2, /* U+0003d0 */ + 0x0003b8, /* U+0003d1 */ + 0x0003c6, /* U+0003d5 */ + 0x0003c0, /* U+0003d6 */ + 0x0003d9, /* U+0003d8 */ + 0x0003db, /* U+0003da */ + 0x0003dd, /* U+0003dc */ + 0x0003df, /* U+0003de */ + 0x0003e1, /* U+0003e0 */ + 0x0003e3, /* U+0003e2 */ + 0x0003e5, /* U+0003e4 */ + 0x0003e7, /* U+0003e6 */ + 0x0003e9, /* U+0003e8 */ + 0x0003eb, /* U+0003ea */ + 0x0003ed, /* U+0003ec */ + 0x0003ef, /* U+0003ee */ + 0x0003ba, /* U+0003f0 */ + 0x0003c1, /* U+0003f1 */ + 0x0003f2, /* U+0003f2 */ + 0x0003b8, /* U+0003f4 */ + 0x0003b5, /* U+0003f5 */ + 0x0003f8, /* U+0003f7 */ + 0x0003fb, /* U+0003fa */ + 0x000450, /* U+000400 */ + 0x000451, /* U+000401 */ + 0x000452, /* U+000402 */ + 0x000453, /* U+000403 */ + 0x000454, /* U+000404 */ + 0x000455, /* U+000405 */ + 0x000456, /* U+000406 */ + 0x000457, /* U+000407 */ + 0x000458, /* U+000408 */ + 0x000459, /* U+000409 */ + 0x00045a, /* U+00040a */ + 0x00045b, /* U+00040b */ + 0x00045c, /* U+00040c */ + 0x00045d, /* U+00040d */ + 0x00045e, /* U+00040e */ + 0x00045f, /* U+00040f */ + 0x000430, /* U+000410 */ + 0x000431, /* U+000411 */ + 0x000432, /* U+000412 */ + 0x000433, /* U+000413 */ + 0x000434, /* U+000414 */ + 0x000435, /* U+000415 */ + 0x000436, /* U+000416 */ + 0x000437, /* U+000417 */ + 0x000438, /* U+000418 */ + 0x000439, /* U+000419 */ + 0x00043a, /* U+00041a */ + 0x00043b, /* U+00041b */ + 0x00043c, /* U+00041c */ + 0x00043d, /* U+00041d */ + 0x00043e, /* U+00041e */ + 0x00043f, /* U+00041f */ + 0x000440, /* U+000420 */ + 0x000441, /* U+000421 */ + 0x000442, /* U+000422 */ + 0x000443, /* U+000423 */ + 0x000444, /* U+000424 */ + 0x000445, /* U+000425 */ + 0x000446, /* U+000426 */ + 0x000447, /* U+000427 */ + 0x000448, /* U+000428 */ + 0x000449, /* U+000429 */ + 0x00044a, /* U+00042a */ + 0x00044b, /* U+00042b */ + 0x00044c, /* U+00042c */ + 0x00044d, /* U+00042d */ + 0x00044e, /* U+00042e */ + 0x00044f, /* U+00042f */ + 0x000461, /* U+000460 */ + 0x000463, /* U+000462 */ + 0x000465, /* U+000464 */ + 0x000467, /* U+000466 */ + 0x000469, /* U+000468 */ + 0x00046b, /* U+00046a */ + 0x00046d, /* U+00046c */ + 0x00046f, /* U+00046e */ + 0x000471, /* U+000470 */ + 0x000473, /* U+000472 */ + 0x000475, /* U+000474 */ + 0x000477, /* U+000476 */ + 0x000479, /* U+000478 */ + 0x00047b, /* U+00047a */ + 0x00047d, /* U+00047c */ + 0x00047f, /* U+00047e */ + 0x000481, /* U+000480 */ + 0x00048b, /* U+00048a */ + 0x00048d, /* U+00048c */ + 0x00048f, /* U+00048e */ + 0x000491, /* U+000490 */ + 0x000493, /* U+000492 */ + 0x000495, /* U+000494 */ + 0x000497, /* U+000496 */ + 0x000499, /* U+000498 */ + 0x00049b, /* U+00049a */ + 0x00049d, /* U+00049c */ + 0x00049f, /* U+00049e */ + 0x0004a1, /* U+0004a0 */ + 0x0004a3, /* U+0004a2 */ + 0x0004a5, /* U+0004a4 */ + 0x0004a7, /* U+0004a6 */ + 0x0004a9, /* U+0004a8 */ + 0x0004ab, /* U+0004aa */ + 0x0004ad, /* U+0004ac */ + 0x0004af, /* U+0004ae */ + 0x0004b1, /* U+0004b0 */ + 0x0004b3, /* U+0004b2 */ + 0x0004b5, /* U+0004b4 */ + 0x0004b7, /* U+0004b6 */ + 0x0004b9, /* U+0004b8 */ + 0x0004bb, /* U+0004ba */ + 0x0004bd, /* U+0004bc */ + 0x0004bf, /* U+0004be */ + 0x0004cf, /* U+0004c0 */ + 0x0004c2, /* U+0004c1 */ + 0x0004c4, /* U+0004c3 */ + 0x0004c6, /* U+0004c5 */ + 0x0004c8, /* U+0004c7 */ + 0x0004ca, /* U+0004c9 */ + 0x0004cc, /* U+0004cb */ + 0x0004ce, /* U+0004cd */ + 0x0004d1, /* U+0004d0 */ + 0x0004d3, /* U+0004d2 */ + 0x0004d5, /* U+0004d4 */ + 0x0004d7, /* U+0004d6 */ + 0x0004d9, /* U+0004d8 */ + 0x0004db, /* U+0004da */ + 0x0004dd, /* U+0004dc */ + 0x0004df, /* U+0004de */ + 0x0004e1, /* U+0004e0 */ + 0x0004e3, /* U+0004e2 */ + 0x0004e5, /* U+0004e4 */ + 0x0004e7, /* U+0004e6 */ + 0x0004e9, /* U+0004e8 */ + 0x0004eb, /* U+0004ea */ + 0x0004ed, /* U+0004ec */ + 0x0004ef, /* U+0004ee */ + 0x0004f1, /* U+0004f0 */ + 0x0004f3, /* U+0004f2 */ + 0x0004f5, /* U+0004f4 */ + 0x0004f7, /* U+0004f6 */ + 0x0004f9, /* U+0004f8 */ + 0x0004fb, /* U+0004fa */ + 0x0004fd, /* U+0004fc */ + 0x0004ff, /* U+0004fe */ + 0x000501, /* U+000500 */ + 0x000503, /* U+000502 */ + 0x000505, /* U+000504 */ + 0x000507, /* U+000506 */ + 0x000509, /* U+000508 */ + 0x00050b, /* U+00050a */ + 0x00050d, /* U+00050c */ + 0x00050f, /* U+00050e */ + 0x000511, /* U+000510 */ + 0x000513, /* U+000512 */ + 0x000515, /* U+000514 */ + 0x000517, /* U+000516 */ + 0x000519, /* U+000518 */ + 0x00051b, /* U+00051a */ + 0x00051d, /* U+00051c */ + 0x00051f, /* U+00051e */ + 0x000521, /* U+000520 */ + 0x000523, /* U+000522 */ + 0x000525, /* U+000524 */ + 0x000527, /* U+000526 */ + 0x000529, /* U+000528 */ + 0x00052b, /* U+00052a */ + 0x00052d, /* U+00052c */ + 0x00052f, /* U+00052e */ + 0x000561, /* U+000531 */ + 0x000562, /* U+000532 */ + 0x000563, /* U+000533 */ + 0x000564, /* U+000534 */ + 0x000565, /* U+000535 */ + 0x000566, /* U+000536 */ + 0x000567, /* U+000537 */ + 0x000568, /* U+000538 */ + 0x000569, /* U+000539 */ + 0x00056a, /* U+00053a */ + 0x00056b, /* U+00053b */ + 0x00056c, /* U+00053c */ + 0x00056d, /* U+00053d */ + 0x00056e, /* U+00053e */ + 0x00056f, /* U+00053f */ + 0x000570, /* U+000540 */ + 0x000571, /* U+000541 */ + 0x000572, /* U+000542 */ + 0x000573, /* U+000543 */ + 0x000574, /* U+000544 */ + 0x000575, /* U+000545 */ + 0x000576, /* U+000546 */ + 0x000577, /* U+000547 */ + 0x000578, /* U+000548 */ + 0x000579, /* U+000549 */ + 0x00057a, /* U+00054a */ + 0x00057b, /* U+00054b */ + 0x00057c, /* U+00054c */ + 0x00057d, /* U+00054d */ + 0x00057e, /* U+00054e */ + 0x00057f, /* U+00054f */ + 0x000580, /* U+000550 */ + 0x000581, /* U+000551 */ + 0x000582, /* U+000552 */ + 0x000583, /* U+000553 */ + 0x000584, /* U+000554 */ + 0x000585, /* U+000555 */ + 0x000586, /* U+000556 */ + 0x000587, /* U+000587 */ + 0x002d00, /* U+0010a0 */ + 0x002d01, /* U+0010a1 */ + 0x002d02, /* U+0010a2 */ + 0x002d03, /* U+0010a3 */ + 0x002d04, /* U+0010a4 */ + 0x002d05, /* U+0010a5 */ + 0x002d06, /* U+0010a6 */ + 0x002d07, /* U+0010a7 */ + 0x002d08, /* U+0010a8 */ + 0x002d09, /* U+0010a9 */ + 0x002d0a, /* U+0010aa */ + 0x002d0b, /* U+0010ab */ + 0x002d0c, /* U+0010ac */ + 0x002d0d, /* U+0010ad */ + 0x002d0e, /* U+0010ae */ + 0x002d0f, /* U+0010af */ + 0x002d10, /* U+0010b0 */ + 0x002d11, /* U+0010b1 */ + 0x002d12, /* U+0010b2 */ + 0x002d13, /* U+0010b3 */ + 0x002d14, /* U+0010b4 */ + 0x002d15, /* U+0010b5 */ + 0x002d16, /* U+0010b6 */ + 0x002d17, /* U+0010b7 */ + 0x002d18, /* U+0010b8 */ + 0x002d19, /* U+0010b9 */ + 0x002d1a, /* U+0010ba */ + 0x002d1b, /* U+0010bb */ + 0x002d1c, /* U+0010bc */ + 0x002d1d, /* U+0010bd */ + 0x002d1e, /* U+0010be */ + 0x002d1f, /* U+0010bf */ + 0x002d20, /* U+0010c0 */ + 0x002d21, /* U+0010c1 */ + 0x002d22, /* U+0010c2 */ + 0x002d23, /* U+0010c3 */ + 0x002d24, /* U+0010c4 */ + 0x002d25, /* U+0010c5 */ + 0x002d27, /* U+0010c7 */ + 0x002d2d, /* U+0010cd */ + 0x0010d0, /* U+0010d0 */ + 0x0010d1, /* U+0010d1 */ + 0x0010d2, /* U+0010d2 */ + 0x0010d3, /* U+0010d3 */ + 0x0010d4, /* U+0010d4 */ + 0x0010d5, /* U+0010d5 */ + 0x0010d6, /* U+0010d6 */ + 0x0010d7, /* U+0010d7 */ + 0x0010d8, /* U+0010d8 */ + 0x0010d9, /* U+0010d9 */ + 0x0010da, /* U+0010da */ + 0x0010db, /* U+0010db */ + 0x0010dc, /* U+0010dc */ + 0x0010dd, /* U+0010dd */ + 0x0010de, /* U+0010de */ + 0x0010df, /* U+0010df */ + 0x0010e0, /* U+0010e0 */ + 0x0010e1, /* U+0010e1 */ + 0x0010e2, /* U+0010e2 */ + 0x0010e3, /* U+0010e3 */ + 0x0010e4, /* U+0010e4 */ + 0x0010e5, /* U+0010e5 */ + 0x0010e6, /* U+0010e6 */ + 0x0010e7, /* U+0010e7 */ + 0x0010e8, /* U+0010e8 */ + 0x0010e9, /* U+0010e9 */ + 0x0010ea, /* U+0010ea */ + 0x0010eb, /* U+0010eb */ + 0x0010ec, /* U+0010ec */ + 0x0010ed, /* U+0010ed */ + 0x0010ee, /* U+0010ee */ + 0x0010ef, /* U+0010ef */ + 0x0010f0, /* U+0010f0 */ + 0x0010f1, /* U+0010f1 */ + 0x0010f2, /* U+0010f2 */ + 0x0010f3, /* U+0010f3 */ + 0x0010f4, /* U+0010f4 */ + 0x0010f5, /* U+0010f5 */ + 0x0010f6, /* U+0010f6 */ + 0x0010f7, /* U+0010f7 */ + 0x0010f8, /* U+0010f8 */ + 0x0010f9, /* U+0010f9 */ + 0x0010fa, /* U+0010fa */ + 0x0010fd, /* U+0010fd */ + 0x0010fe, /* U+0010fe */ + 0x0010ff, /* U+0010ff */ + 0x0013a0, /* U+0013a0 */ + 0x0013a1, /* U+0013a1 */ + 0x0013a2, /* U+0013a2 */ + 0x0013a3, /* U+0013a3 */ + 0x0013a4, /* U+0013a4 */ + 0x0013a5, /* U+0013a5 */ + 0x0013a6, /* U+0013a6 */ + 0x0013a7, /* U+0013a7 */ + 0x0013a8, /* U+0013a8 */ + 0x0013a9, /* U+0013a9 */ + 0x0013aa, /* U+0013aa */ + 0x0013ab, /* U+0013ab */ + 0x0013ac, /* U+0013ac */ + 0x0013ad, /* U+0013ad */ + 0x0013ae, /* U+0013ae */ + 0x0013af, /* U+0013af */ + 0x0013b0, /* U+0013b0 */ + 0x0013b1, /* U+0013b1 */ + 0x0013b2, /* U+0013b2 */ + 0x0013b3, /* U+0013b3 */ + 0x0013b4, /* U+0013b4 */ + 0x0013b5, /* U+0013b5 */ + 0x0013b6, /* U+0013b6 */ + 0x0013b7, /* U+0013b7 */ + 0x0013b8, /* U+0013b8 */ + 0x0013b9, /* U+0013b9 */ + 0x0013ba, /* U+0013ba */ + 0x0013bb, /* U+0013bb */ + 0x0013bc, /* U+0013bc */ + 0x0013bd, /* U+0013bd */ + 0x0013be, /* U+0013be */ + 0x0013bf, /* U+0013bf */ + 0x0013c0, /* U+0013c0 */ + 0x0013c1, /* U+0013c1 */ + 0x0013c2, /* U+0013c2 */ + 0x0013c3, /* U+0013c3 */ + 0x0013c4, /* U+0013c4 */ + 0x0013c5, /* U+0013c5 */ + 0x0013c6, /* U+0013c6 */ + 0x0013c7, /* U+0013c7 */ + 0x0013c8, /* U+0013c8 */ + 0x0013c9, /* U+0013c9 */ + 0x0013ca, /* U+0013ca */ + 0x0013cb, /* U+0013cb */ + 0x0013cc, /* U+0013cc */ + 0x0013cd, /* U+0013cd */ + 0x0013ce, /* U+0013ce */ + 0x0013cf, /* U+0013cf */ + 0x0013d0, /* U+0013d0 */ + 0x0013d1, /* U+0013d1 */ + 0x0013d2, /* U+0013d2 */ + 0x0013d3, /* U+0013d3 */ + 0x0013d4, /* U+0013d4 */ + 0x0013d5, /* U+0013d5 */ + 0x0013d6, /* U+0013d6 */ + 0x0013d7, /* U+0013d7 */ + 0x0013d8, /* U+0013d8 */ + 0x0013d9, /* U+0013d9 */ + 0x0013da, /* U+0013da */ + 0x0013db, /* U+0013db */ + 0x0013dc, /* U+0013dc */ + 0x0013dd, /* U+0013dd */ + 0x0013de, /* U+0013de */ + 0x0013df, /* U+0013df */ + 0x0013e0, /* U+0013e0 */ + 0x0013e1, /* U+0013e1 */ + 0x0013e2, /* U+0013e2 */ + 0x0013e3, /* U+0013e3 */ + 0x0013e4, /* U+0013e4 */ + 0x0013e5, /* U+0013e5 */ + 0x0013e6, /* U+0013e6 */ + 0x0013e7, /* U+0013e7 */ + 0x0013e8, /* U+0013e8 */ + 0x0013e9, /* U+0013e9 */ + 0x0013ea, /* U+0013ea */ + 0x0013eb, /* U+0013eb */ + 0x0013ec, /* U+0013ec */ + 0x0013ed, /* U+0013ed */ + 0x0013ee, /* U+0013ee */ + 0x0013ef, /* U+0013ef */ + 0x0013f0, /* U+0013f0 */ + 0x0013f1, /* U+0013f1 */ + 0x0013f2, /* U+0013f2 */ + 0x0013f3, /* U+0013f3 */ + 0x0013f4, /* U+0013f4 */ + 0x0013f5, /* U+0013f5 */ + 0x000432, /* U+001c80 */ + 0x000434, /* U+001c81 */ + 0x00043e, /* U+001c82 */ + 0x000441, /* U+001c83 */ + 0x000442, /* U+001c84 */ + 0x000442, /* U+001c85 */ + 0x00044a, /* U+001c86 */ + 0x000463, /* U+001c87 */ + 0x00a64b, /* U+001c88 */ + 0x001c8a, /* U+001c89 */ + 0x0010d0, /* U+001c90 */ + 0x0010d1, /* U+001c91 */ + 0x0010d2, /* U+001c92 */ + 0x0010d3, /* U+001c93 */ + 0x0010d4, /* U+001c94 */ + 0x0010d5, /* U+001c95 */ + 0x0010d6, /* U+001c96 */ + 0x0010d7, /* U+001c97 */ + 0x0010d8, /* U+001c98 */ + 0x0010d9, /* U+001c99 */ + 0x0010da, /* U+001c9a */ + 0x0010db, /* U+001c9b */ + 0x0010dc, /* U+001c9c */ + 0x0010dd, /* U+001c9d */ + 0x0010de, /* U+001c9e */ + 0x0010df, /* U+001c9f */ + 0x0010e0, /* U+001ca0 */ + 0x0010e1, /* U+001ca1 */ + 0x0010e2, /* U+001ca2 */ + 0x0010e3, /* U+001ca3 */ + 0x0010e4, /* U+001ca4 */ + 0x0010e5, /* U+001ca5 */ + 0x0010e6, /* U+001ca6 */ + 0x0010e7, /* U+001ca7 */ + 0x0010e8, /* U+001ca8 */ + 0x0010e9, /* U+001ca9 */ + 0x0010ea, /* U+001caa */ + 0x0010eb, /* U+001cab */ + 0x0010ec, /* U+001cac */ + 0x0010ed, /* U+001cad */ + 0x0010ee, /* U+001cae */ + 0x0010ef, /* U+001caf */ + 0x0010f0, /* U+001cb0 */ + 0x0010f1, /* U+001cb1 */ + 0x0010f2, /* U+001cb2 */ + 0x0010f3, /* U+001cb3 */ + 0x0010f4, /* U+001cb4 */ + 0x0010f5, /* U+001cb5 */ + 0x0010f6, /* U+001cb6 */ + 0x0010f7, /* U+001cb7 */ + 0x0010f8, /* U+001cb8 */ + 0x0010f9, /* U+001cb9 */ + 0x0010fa, /* U+001cba */ + 0x0010fd, /* U+001cbd */ + 0x0010fe, /* U+001cbe */ + 0x0010ff, /* U+001cbf */ + 0x001d79, /* U+001d79 */ + 0x001d7d, /* U+001d7d */ + 0x001d8e, /* U+001d8e */ + 0x001e01, /* U+001e00 */ + 0x001e03, /* U+001e02 */ + 0x001e05, /* U+001e04 */ + 0x001e07, /* U+001e06 */ + 0x001e09, /* U+001e08 */ + 0x001e0b, /* U+001e0a */ + 0x001e0d, /* U+001e0c */ + 0x001e0f, /* U+001e0e */ + 0x001e11, /* U+001e10 */ + 0x001e13, /* U+001e12 */ + 0x001e15, /* U+001e14 */ + 0x001e17, /* U+001e16 */ + 0x001e19, /* U+001e18 */ + 0x001e1b, /* U+001e1a */ + 0x001e1d, /* U+001e1c */ + 0x001e1f, /* U+001e1e */ + 0x001e21, /* U+001e20 */ + 0x001e23, /* U+001e22 */ + 0x001e25, /* U+001e24 */ + 0x001e27, /* U+001e26 */ + 0x001e29, /* U+001e28 */ + 0x001e2b, /* U+001e2a */ + 0x001e2d, /* U+001e2c */ + 0x001e2f, /* U+001e2e */ + 0x001e31, /* U+001e30 */ + 0x001e33, /* U+001e32 */ + 0x001e35, /* U+001e34 */ + 0x001e37, /* U+001e36 */ + 0x001e39, /* U+001e38 */ + 0x001e3b, /* U+001e3a */ + 0x001e3d, /* U+001e3c */ + 0x001e3f, /* U+001e3e */ + 0x001e41, /* U+001e40 */ + 0x001e43, /* U+001e42 */ + 0x001e45, /* U+001e44 */ + 0x001e47, /* U+001e46 */ + 0x001e49, /* U+001e48 */ + 0x001e4b, /* U+001e4a */ + 0x001e4d, /* U+001e4c */ + 0x001e4f, /* U+001e4e */ + 0x001e51, /* U+001e50 */ + 0x001e53, /* U+001e52 */ + 0x001e55, /* U+001e54 */ + 0x001e57, /* U+001e56 */ + 0x001e59, /* U+001e58 */ + 0x001e5b, /* U+001e5a */ + 0x001e5d, /* U+001e5c */ + 0x001e5f, /* U+001e5e */ + 0x001e61, /* U+001e60 */ + 0x001e63, /* U+001e62 */ + 0x001e65, /* U+001e64 */ + 0x001e67, /* U+001e66 */ + 0x001e69, /* U+001e68 */ + 0x001e6b, /* U+001e6a */ + 0x001e6d, /* U+001e6c */ + 0x001e6f, /* U+001e6e */ + 0x001e71, /* U+001e70 */ + 0x001e73, /* U+001e72 */ + 0x001e75, /* U+001e74 */ + 0x001e77, /* U+001e76 */ + 0x001e79, /* U+001e78 */ + 0x001e7b, /* U+001e7a */ + 0x001e7d, /* U+001e7c */ + 0x001e7f, /* U+001e7e */ + 0x001e81, /* U+001e80 */ + 0x001e83, /* U+001e82 */ + 0x001e85, /* U+001e84 */ + 0x001e87, /* U+001e86 */ + 0x001e89, /* U+001e88 */ + 0x001e8b, /* U+001e8a */ + 0x001e8d, /* U+001e8c */ + 0x001e8f, /* U+001e8e */ + 0x001e91, /* U+001e90 */ + 0x001e93, /* U+001e92 */ + 0x001e95, /* U+001e94 */ + 0x001e96, /* U+001e96 */ + 0x001e97, /* U+001e97 */ + 0x001e98, /* U+001e98 */ + 0x001e99, /* U+001e99 */ + 0x001e9a, /* U+001e9a */ + 0x001e61, /* U+001e9b */ + 0x0000df, /* U+001e9e */ + 0x001ea1, /* U+001ea0 */ + 0x001ea3, /* U+001ea2 */ + 0x001ea5, /* U+001ea4 */ + 0x001ea7, /* U+001ea6 */ + 0x001ea9, /* U+001ea8 */ + 0x001eab, /* U+001eaa */ + 0x001ead, /* U+001eac */ + 0x001eaf, /* U+001eae */ + 0x001eb1, /* U+001eb0 */ + 0x001eb3, /* U+001eb2 */ + 0x001eb5, /* U+001eb4 */ + 0x001eb7, /* U+001eb6 */ + 0x001eb9, /* U+001eb8 */ + 0x001ebb, /* U+001eba */ + 0x001ebd, /* U+001ebc */ + 0x001ebf, /* U+001ebe */ + 0x001ec1, /* U+001ec0 */ + 0x001ec3, /* U+001ec2 */ + 0x001ec5, /* U+001ec4 */ + 0x001ec7, /* U+001ec6 */ + 0x001ec9, /* U+001ec8 */ + 0x001ecb, /* U+001eca */ + 0x001ecd, /* U+001ecc */ + 0x001ecf, /* U+001ece */ + 0x001ed1, /* U+001ed0 */ + 0x001ed3, /* U+001ed2 */ + 0x001ed5, /* U+001ed4 */ + 0x001ed7, /* U+001ed6 */ + 0x001ed9, /* U+001ed8 */ + 0x001edb, /* U+001eda */ + 0x001edd, /* U+001edc */ + 0x001edf, /* U+001ede */ + 0x001ee1, /* U+001ee0 */ + 0x001ee3, /* U+001ee2 */ + 0x001ee5, /* U+001ee4 */ + 0x001ee7, /* U+001ee6 */ + 0x001ee9, /* U+001ee8 */ + 0x001eeb, /* U+001eea */ + 0x001eed, /* U+001eec */ + 0x001eef, /* U+001eee */ + 0x001ef1, /* U+001ef0 */ + 0x001ef3, /* U+001ef2 */ + 0x001ef5, /* U+001ef4 */ + 0x001ef7, /* U+001ef6 */ + 0x001ef9, /* U+001ef8 */ + 0x001efb, /* U+001efa */ + 0x001efd, /* U+001efc */ + 0x001eff, /* U+001efe */ + 0x001f00, /* U+001f00 */ + 0x001f01, /* U+001f01 */ + 0x001f02, /* U+001f02 */ + 0x001f03, /* U+001f03 */ + 0x001f04, /* U+001f04 */ + 0x001f05, /* U+001f05 */ + 0x001f06, /* U+001f06 */ + 0x001f07, /* U+001f07 */ + 0x001f10, /* U+001f10 */ + 0x001f11, /* U+001f11 */ + 0x001f12, /* U+001f12 */ + 0x001f13, /* U+001f13 */ + 0x001f14, /* U+001f14 */ + 0x001f15, /* U+001f15 */ + 0x001f20, /* U+001f20 */ + 0x001f21, /* U+001f21 */ + 0x001f22, /* U+001f22 */ + 0x001f23, /* U+001f23 */ + 0x001f24, /* U+001f24 */ + 0x001f25, /* U+001f25 */ + 0x001f26, /* U+001f26 */ + 0x001f27, /* U+001f27 */ + 0x001f30, /* U+001f30 */ + 0x001f31, /* U+001f31 */ + 0x001f32, /* U+001f32 */ + 0x001f33, /* U+001f33 */ + 0x001f34, /* U+001f34 */ + 0x001f35, /* U+001f35 */ + 0x001f36, /* U+001f36 */ + 0x001f37, /* U+001f37 */ + 0x001f40, /* U+001f40 */ + 0x001f41, /* U+001f41 */ + 0x001f42, /* U+001f42 */ + 0x001f43, /* U+001f43 */ + 0x001f44, /* U+001f44 */ + 0x001f45, /* U+001f45 */ + 0x001f50, /* U+001f50 */ + 0x001f51, /* U+001f51 */ + 0x001f52, /* U+001f52 */ + 0x001f53, /* U+001f53 */ + 0x001f54, /* U+001f54 */ + 0x001f55, /* U+001f55 */ + 0x001f56, /* U+001f56 */ + 0x001f57, /* U+001f57 */ + 0x001f60, /* U+001f60 */ + 0x001f61, /* U+001f61 */ + 0x001f62, /* U+001f62 */ + 0x001f63, /* U+001f63 */ + 0x001f64, /* U+001f64 */ + 0x001f65, /* U+001f65 */ + 0x001f66, /* U+001f66 */ + 0x001f67, /* U+001f67 */ + 0x001f70, /* U+001f70 */ + 0x001f71, /* U+001f71 */ + 0x001f72, /* U+001f72 */ + 0x001f73, /* U+001f73 */ + 0x001f74, /* U+001f74 */ + 0x001f75, /* U+001f75 */ + 0x001f76, /* U+001f76 */ + 0x001f77, /* U+001f77 */ + 0x001f78, /* U+001f78 */ + 0x001f79, /* U+001f79 */ + 0x001f7a, /* U+001f7a */ + 0x001f7b, /* U+001f7b */ + 0x001f7c, /* U+001f7c */ + 0x001f7d, /* U+001f7d */ + 0x001f80, /* U+001f80 */ + 0x001f81, /* U+001f81 */ + 0x001f82, /* U+001f82 */ + 0x001f83, /* U+001f83 */ + 0x001f84, /* U+001f84 */ + 0x001f85, /* U+001f85 */ + 0x001f86, /* U+001f86 */ + 0x001f87, /* U+001f87 */ + 0x001f80, /* U+001f88 */ + 0x001f81, /* U+001f89 */ + 0x001f82, /* U+001f8a */ + 0x001f83, /* U+001f8b */ + 0x001f84, /* U+001f8c */ + 0x001f85, /* U+001f8d */ + 0x001f86, /* U+001f8e */ + 0x001f87, /* U+001f8f */ + 0x001f90, /* U+001f90 */ + 0x001f91, /* U+001f91 */ + 0x001f92, /* U+001f92 */ + 0x001f93, /* U+001f93 */ + 0x001f94, /* U+001f94 */ + 0x001f95, /* U+001f95 */ + 0x001f96, /* U+001f96 */ + 0x001f97, /* U+001f97 */ + 0x001f90, /* U+001f98 */ + 0x001f91, /* U+001f99 */ + 0x001f92, /* U+001f9a */ + 0x001f93, /* U+001f9b */ + 0x001f94, /* U+001f9c */ + 0x001f95, /* U+001f9d */ + 0x001f96, /* U+001f9e */ + 0x001f97, /* U+001f9f */ + 0x001fa0, /* U+001fa0 */ + 0x001fa1, /* U+001fa1 */ + 0x001fa2, /* U+001fa2 */ + 0x001fa3, /* U+001fa3 */ + 0x001fa4, /* U+001fa4 */ + 0x001fa5, /* U+001fa5 */ + 0x001fa6, /* U+001fa6 */ + 0x001fa7, /* U+001fa7 */ + 0x001fa0, /* U+001fa8 */ + 0x001fa1, /* U+001fa9 */ + 0x001fa2, /* U+001faa */ + 0x001fa3, /* U+001fab */ + 0x001fa4, /* U+001fac */ + 0x001fa5, /* U+001fad */ + 0x001fa6, /* U+001fae */ + 0x001fa7, /* U+001faf */ + 0x001fb0, /* U+001fb0 */ + 0x001fb1, /* U+001fb1 */ + 0x001fb2, /* U+001fb2 */ + 0x001fb3, /* U+001fb3 */ + 0x001fb4, /* U+001fb4 */ + 0x001fb6, /* U+001fb6 */ + 0x001fb7, /* U+001fb7 */ + 0x001fb3, /* U+001fbc */ + 0x0003b9, /* U+001fbe */ + 0x001fc2, /* U+001fc2 */ + 0x001fc3, /* U+001fc3 */ + 0x001fc4, /* U+001fc4 */ + 0x001fc6, /* U+001fc6 */ + 0x001fc7, /* U+001fc7 */ + 0x001fc3, /* U+001fcc */ + 0x001fd0, /* U+001fd0 */ + 0x001fd1, /* U+001fd1 */ + 0x001fd2, /* U+001fd2 */ + 0x000390, /* U+001fd3 */ + 0x001fd6, /* U+001fd6 */ + 0x001fd7, /* U+001fd7 */ + 0x001fe0, /* U+001fe0 */ + 0x001fe1, /* U+001fe1 */ + 0x001fe2, /* U+001fe2 */ + 0x0003b0, /* U+001fe3 */ + 0x001fe4, /* U+001fe4 */ + 0x001fe5, /* U+001fe5 */ + 0x001fe6, /* U+001fe6 */ + 0x001fe7, /* U+001fe7 */ + 0x001ff2, /* U+001ff2 */ + 0x001ff3, /* U+001ff3 */ + 0x001ff4, /* U+001ff4 */ + 0x001ff6, /* U+001ff6 */ + 0x001ff7, /* U+001ff7 */ + 0x001ff3, /* U+001ffc */ + 0x0003c9, /* U+002126 */ + 0x00006b, /* U+00212a */ + 0x0000e5, /* U+00212b */ + 0x00214e, /* U+002132 */ + 0x002170, /* U+002160 */ + 0x002171, /* U+002161 */ + 0x002172, /* U+002162 */ + 0x002173, /* U+002163 */ + 0x002174, /* U+002164 */ + 0x002175, /* U+002165 */ + 0x002176, /* U+002166 */ + 0x002177, /* U+002167 */ + 0x002178, /* U+002168 */ + 0x002179, /* U+002169 */ + 0x00217a, /* U+00216a */ + 0x00217b, /* U+00216b */ + 0x00217c, /* U+00216c */ + 0x00217d, /* U+00216d */ + 0x00217e, /* U+00216e */ + 0x00217f, /* U+00216f */ + 0x002184, /* U+002183 */ + 0x0024d0, /* U+0024b6 */ + 0x0024d1, /* U+0024b7 */ + 0x0024d2, /* U+0024b8 */ + 0x0024d3, /* U+0024b9 */ + 0x0024d4, /* U+0024ba */ + 0x0024d5, /* U+0024bb */ + 0x0024d6, /* U+0024bc */ + 0x0024d7, /* U+0024bd */ + 0x0024d8, /* U+0024be */ + 0x0024d9, /* U+0024bf */ + 0x0024da, /* U+0024c0 */ + 0x0024db, /* U+0024c1 */ + 0x0024dc, /* U+0024c2 */ + 0x0024dd, /* U+0024c3 */ + 0x0024de, /* U+0024c4 */ + 0x0024df, /* U+0024c5 */ + 0x0024e0, /* U+0024c6 */ + 0x0024e1, /* U+0024c7 */ + 0x0024e2, /* U+0024c8 */ + 0x0024e3, /* U+0024c9 */ + 0x0024e4, /* U+0024ca */ + 0x0024e5, /* U+0024cb */ + 0x0024e6, /* U+0024cc */ + 0x0024e7, /* U+0024cd */ + 0x0024e8, /* U+0024ce */ + 0x0024e9, /* U+0024cf */ + 0x002c30, /* U+002c00 */ + 0x002c31, /* U+002c01 */ + 0x002c32, /* U+002c02 */ + 0x002c33, /* U+002c03 */ + 0x002c34, /* U+002c04 */ + 0x002c35, /* U+002c05 */ + 0x002c36, /* U+002c06 */ + 0x002c37, /* U+002c07 */ + 0x002c38, /* U+002c08 */ + 0x002c39, /* U+002c09 */ + 0x002c3a, /* U+002c0a */ + 0x002c3b, /* U+002c0b */ + 0x002c3c, /* U+002c0c */ + 0x002c3d, /* U+002c0d */ + 0x002c3e, /* U+002c0e */ + 0x002c3f, /* U+002c0f */ + 0x002c40, /* U+002c10 */ + 0x002c41, /* U+002c11 */ + 0x002c42, /* U+002c12 */ + 0x002c43, /* U+002c13 */ + 0x002c44, /* U+002c14 */ + 0x002c45, /* U+002c15 */ + 0x002c46, /* U+002c16 */ + 0x002c47, /* U+002c17 */ + 0x002c48, /* U+002c18 */ + 0x002c49, /* U+002c19 */ + 0x002c4a, /* U+002c1a */ + 0x002c4b, /* U+002c1b */ + 0x002c4c, /* U+002c1c */ + 0x002c4d, /* U+002c1d */ + 0x002c4e, /* U+002c1e */ + 0x002c4f, /* U+002c1f */ + 0x002c50, /* U+002c20 */ + 0x002c51, /* U+002c21 */ + 0x002c52, /* U+002c22 */ + 0x002c53, /* U+002c23 */ + 0x002c54, /* U+002c24 */ + 0x002c55, /* U+002c25 */ + 0x002c56, /* U+002c26 */ + 0x002c57, /* U+002c27 */ + 0x002c58, /* U+002c28 */ + 0x002c59, /* U+002c29 */ + 0x002c5a, /* U+002c2a */ + 0x002c5b, /* U+002c2b */ + 0x002c5c, /* U+002c2c */ + 0x002c5d, /* U+002c2d */ + 0x002c5e, /* U+002c2e */ + 0x002c5f, /* U+002c2f */ + 0x002c61, /* U+002c60 */ + 0x002c68, /* U+002c67 */ + 0x002c6a, /* U+002c69 */ + 0x002c6c, /* U+002c6b */ + 0x002c73, /* U+002c72 */ + 0x002c76, /* U+002c75 */ + 0x002c81, /* U+002c80 */ + 0x002c83, /* U+002c82 */ + 0x002c85, /* U+002c84 */ + 0x002c87, /* U+002c86 */ + 0x002c89, /* U+002c88 */ + 0x002c8b, /* U+002c8a */ + 0x002c8d, /* U+002c8c */ + 0x002c8f, /* U+002c8e */ + 0x002c91, /* U+002c90 */ + 0x002c93, /* U+002c92 */ + 0x002c95, /* U+002c94 */ + 0x002c97, /* U+002c96 */ + 0x002c99, /* U+002c98 */ + 0x002c9b, /* U+002c9a */ + 0x002c9d, /* U+002c9c */ + 0x002c9f, /* U+002c9e */ + 0x002ca1, /* U+002ca0 */ + 0x002ca3, /* U+002ca2 */ + 0x002ca5, /* U+002ca4 */ + 0x002ca7, /* U+002ca6 */ + 0x002ca9, /* U+002ca8 */ + 0x002cab, /* U+002caa */ + 0x002cad, /* U+002cac */ + 0x002caf, /* U+002cae */ + 0x002cb1, /* U+002cb0 */ + 0x002cb3, /* U+002cb2 */ + 0x002cb5, /* U+002cb4 */ + 0x002cb7, /* U+002cb6 */ + 0x002cb9, /* U+002cb8 */ + 0x002cbb, /* U+002cba */ + 0x002cbd, /* U+002cbc */ + 0x002cbf, /* U+002cbe */ + 0x002cc1, /* U+002cc0 */ + 0x002cc3, /* U+002cc2 */ + 0x002cc5, /* U+002cc4 */ + 0x002cc7, /* U+002cc6 */ + 0x002cc9, /* U+002cc8 */ + 0x002ccb, /* U+002cca */ + 0x002ccd, /* U+002ccc */ + 0x002ccf, /* U+002cce */ + 0x002cd1, /* U+002cd0 */ + 0x002cd3, /* U+002cd2 */ + 0x002cd5, /* U+002cd4 */ + 0x002cd7, /* U+002cd6 */ + 0x002cd9, /* U+002cd8 */ + 0x002cdb, /* U+002cda */ + 0x002cdd, /* U+002cdc */ + 0x002cdf, /* U+002cde */ + 0x002ce1, /* U+002ce0 */ + 0x002ce3, /* U+002ce2 */ + 0x002cec, /* U+002ceb */ + 0x002cee, /* U+002ced */ + 0x002cf3, /* U+002cf2 */ + 0x00a641, /* U+00a640 */ + 0x00a643, /* U+00a642 */ + 0x00a645, /* U+00a644 */ + 0x00a647, /* U+00a646 */ + 0x00a649, /* U+00a648 */ + 0x00a64b, /* U+00a64a */ + 0x00a64d, /* U+00a64c */ + 0x00a64f, /* U+00a64e */ + 0x00a651, /* U+00a650 */ + 0x00a653, /* U+00a652 */ + 0x00a655, /* U+00a654 */ + 0x00a657, /* U+00a656 */ + 0x00a659, /* U+00a658 */ + 0x00a65b, /* U+00a65a */ + 0x00a65d, /* U+00a65c */ + 0x00a65f, /* U+00a65e */ + 0x00a661, /* U+00a660 */ + 0x00a663, /* U+00a662 */ + 0x00a665, /* U+00a664 */ + 0x00a667, /* U+00a666 */ + 0x00a669, /* U+00a668 */ + 0x00a66b, /* U+00a66a */ + 0x00a66d, /* U+00a66c */ + 0x00a681, /* U+00a680 */ + 0x00a683, /* U+00a682 */ + 0x00a685, /* U+00a684 */ + 0x00a687, /* U+00a686 */ + 0x00a689, /* U+00a688 */ + 0x00a68b, /* U+00a68a */ + 0x00a68d, /* U+00a68c */ + 0x00a68f, /* U+00a68e */ + 0x00a691, /* U+00a690 */ + 0x00a693, /* U+00a692 */ + 0x00a695, /* U+00a694 */ + 0x00a697, /* U+00a696 */ + 0x00a699, /* U+00a698 */ + 0x00a69b, /* U+00a69a */ + 0x00a723, /* U+00a722 */ + 0x00a725, /* U+00a724 */ + 0x00a727, /* U+00a726 */ + 0x00a729, /* U+00a728 */ + 0x00a72b, /* U+00a72a */ + 0x00a72d, /* U+00a72c */ + 0x00a72f, /* U+00a72e */ + 0x00a733, /* U+00a732 */ + 0x00a735, /* U+00a734 */ + 0x00a737, /* U+00a736 */ + 0x00a739, /* U+00a738 */ + 0x00a73b, /* U+00a73a */ + 0x00a73d, /* U+00a73c */ + 0x00a73f, /* U+00a73e */ + 0x00a741, /* U+00a740 */ + 0x00a743, /* U+00a742 */ + 0x00a745, /* U+00a744 */ + 0x00a747, /* U+00a746 */ + 0x00a749, /* U+00a748 */ + 0x00a74b, /* U+00a74a */ + 0x00a74d, /* U+00a74c */ + 0x00a74f, /* U+00a74e */ + 0x00a751, /* U+00a750 */ + 0x00a753, /* U+00a752 */ + 0x00a755, /* U+00a754 */ + 0x00a757, /* U+00a756 */ + 0x00a759, /* U+00a758 */ + 0x00a75b, /* U+00a75a */ + 0x00a75d, /* U+00a75c */ + 0x00a75f, /* U+00a75e */ + 0x00a761, /* U+00a760 */ + 0x00a763, /* U+00a762 */ + 0x00a765, /* U+00a764 */ + 0x00a767, /* U+00a766 */ + 0x00a769, /* U+00a768 */ + 0x00a76b, /* U+00a76a */ + 0x00a76d, /* U+00a76c */ + 0x00a76f, /* U+00a76e */ + 0x00a77a, /* U+00a779 */ + 0x00a77c, /* U+00a77b */ + 0x00a77f, /* U+00a77e */ + 0x00a781, /* U+00a780 */ + 0x00a783, /* U+00a782 */ + 0x00a785, /* U+00a784 */ + 0x00a787, /* U+00a786 */ + 0x00a78c, /* U+00a78b */ + 0x00a791, /* U+00a790 */ + 0x00a793, /* U+00a792 */ + 0x00a794, /* U+00a794 */ + 0x00a797, /* U+00a796 */ + 0x00a799, /* U+00a798 */ + 0x00a79b, /* U+00a79a */ + 0x00a79d, /* U+00a79c */ + 0x00a79f, /* U+00a79e */ + 0x00a7a1, /* U+00a7a0 */ + 0x00a7a3, /* U+00a7a2 */ + 0x00a7a5, /* U+00a7a4 */ + 0x00a7a7, /* U+00a7a6 */ + 0x00a7a9, /* U+00a7a8 */ + 0x00ab53, /* U+00a7b3 */ + 0x00a7b5, /* U+00a7b4 */ + 0x00a7b7, /* U+00a7b6 */ + 0x00a7b9, /* U+00a7b8 */ + 0x00a7bb, /* U+00a7ba */ + 0x00a7bd, /* U+00a7bc */ + 0x00a7bf, /* U+00a7be */ + 0x00a7c1, /* U+00a7c0 */ + 0x00a7c3, /* U+00a7c2 */ + 0x00a7c8, /* U+00a7c7 */ + 0x00a7ca, /* U+00a7c9 */ + 0x00a7cd, /* U+00a7cc */ + 0x00a7d1, /* U+00a7d0 */ + 0x00a7d7, /* U+00a7d6 */ + 0x00a7d9, /* U+00a7d8 */ + 0x00a7db, /* U+00a7da */ + 0x00a7f6, /* U+00a7f5 */ + 0x00fb00, /* U+00fb00 */ + 0x00fb01, /* U+00fb01 */ + 0x00fb02, /* U+00fb02 */ + 0x00fb03, /* U+00fb03 */ + 0x00fb04, /* U+00fb04 */ + 0x00fb06, /* U+00fb05 */ + 0x00fb06, /* U+00fb06 */ + 0x00fb13, /* U+00fb13 */ + 0x00fb14, /* U+00fb14 */ + 0x00fb15, /* U+00fb15 */ + 0x00fb16, /* U+00fb16 */ + 0x00fb17, /* U+00fb17 */ + 0x00ff41, /* U+00ff21 */ + 0x00ff42, /* U+00ff22 */ + 0x00ff43, /* U+00ff23 */ + 0x00ff44, /* U+00ff24 */ + 0x00ff45, /* U+00ff25 */ + 0x00ff46, /* U+00ff26 */ + 0x00ff47, /* U+00ff27 */ + 0x00ff48, /* U+00ff28 */ + 0x00ff49, /* U+00ff29 */ + 0x00ff4a, /* U+00ff2a */ + 0x00ff4b, /* U+00ff2b */ + 0x00ff4c, /* U+00ff2c */ + 0x00ff4d, /* U+00ff2d */ + 0x00ff4e, /* U+00ff2e */ + 0x00ff4f, /* U+00ff2f */ + 0x00ff50, /* U+00ff30 */ + 0x00ff51, /* U+00ff31 */ + 0x00ff52, /* U+00ff32 */ + 0x00ff53, /* U+00ff33 */ + 0x00ff54, /* U+00ff34 */ + 0x00ff55, /* U+00ff35 */ + 0x00ff56, /* U+00ff36 */ + 0x00ff57, /* U+00ff37 */ + 0x00ff58, /* U+00ff38 */ + 0x00ff59, /* U+00ff39 */ + 0x00ff5a, /* U+00ff3a */ + 0x010428, /* U+010400 */ + 0x010429, /* U+010401 */ + 0x01042a, /* U+010402 */ + 0x01042b, /* U+010403 */ + 0x01042c, /* U+010404 */ + 0x01042d, /* U+010405 */ + 0x01042e, /* U+010406 */ + 0x01042f, /* U+010407 */ + 0x010430, /* U+010408 */ + 0x010431, /* U+010409 */ + 0x010432, /* U+01040a */ + 0x010433, /* U+01040b */ + 0x010434, /* U+01040c */ + 0x010435, /* U+01040d */ + 0x010436, /* U+01040e */ + 0x010437, /* U+01040f */ + 0x010438, /* U+010410 */ + 0x010439, /* U+010411 */ + 0x01043a, /* U+010412 */ + 0x01043b, /* U+010413 */ + 0x01043c, /* U+010414 */ + 0x01043d, /* U+010415 */ + 0x01043e, /* U+010416 */ + 0x01043f, /* U+010417 */ + 0x010440, /* U+010418 */ + 0x010441, /* U+010419 */ + 0x010442, /* U+01041a */ + 0x010443, /* U+01041b */ + 0x010444, /* U+01041c */ + 0x010445, /* U+01041d */ + 0x010446, /* U+01041e */ + 0x010447, /* U+01041f */ + 0x010448, /* U+010420 */ + 0x010449, /* U+010421 */ + 0x01044a, /* U+010422 */ + 0x01044b, /* U+010423 */ + 0x01044c, /* U+010424 */ + 0x01044d, /* U+010425 */ + 0x01044e, /* U+010426 */ + 0x01044f, /* U+010427 */ + 0x0104d8, /* U+0104b0 */ + 0x0104d9, /* U+0104b1 */ + 0x0104da, /* U+0104b2 */ + 0x0104db, /* U+0104b3 */ + 0x0104dc, /* U+0104b4 */ + 0x0104dd, /* U+0104b5 */ + 0x0104de, /* U+0104b6 */ + 0x0104df, /* U+0104b7 */ + 0x0104e0, /* U+0104b8 */ + 0x0104e1, /* U+0104b9 */ + 0x0104e2, /* U+0104ba */ + 0x0104e3, /* U+0104bb */ + 0x0104e4, /* U+0104bc */ + 0x0104e5, /* U+0104bd */ + 0x0104e6, /* U+0104be */ + 0x0104e7, /* U+0104bf */ + 0x0104e8, /* U+0104c0 */ + 0x0104e9, /* U+0104c1 */ + 0x0104ea, /* U+0104c2 */ + 0x0104eb, /* U+0104c3 */ + 0x0104ec, /* U+0104c4 */ + 0x0104ed, /* U+0104c5 */ + 0x0104ee, /* U+0104c6 */ + 0x0104ef, /* U+0104c7 */ + 0x0104f0, /* U+0104c8 */ + 0x0104f1, /* U+0104c9 */ + 0x0104f2, /* U+0104ca */ + 0x0104f3, /* U+0104cb */ + 0x0104f4, /* U+0104cc */ + 0x0104f5, /* U+0104cd */ + 0x0104f6, /* U+0104ce */ + 0x0104f7, /* U+0104cf */ + 0x0104f8, /* U+0104d0 */ + 0x0104f9, /* U+0104d1 */ + 0x0104fa, /* U+0104d2 */ + 0x0104fb, /* U+0104d3 */ + 0x010597, /* U+010570 */ + 0x010598, /* U+010571 */ + 0x010599, /* U+010572 */ + 0x01059a, /* U+010573 */ + 0x01059b, /* U+010574 */ + 0x01059c, /* U+010575 */ + 0x01059d, /* U+010576 */ + 0x01059e, /* U+010577 */ + 0x01059f, /* U+010578 */ + 0x0105a0, /* U+010579 */ + 0x0105a1, /* U+01057a */ + 0x0105a3, /* U+01057c */ + 0x0105a4, /* U+01057d */ + 0x0105a5, /* U+01057e */ + 0x0105a6, /* U+01057f */ + 0x0105a7, /* U+010580 */ + 0x0105a8, /* U+010581 */ + 0x0105a9, /* U+010582 */ + 0x0105aa, /* U+010583 */ + 0x0105ab, /* U+010584 */ + 0x0105ac, /* U+010585 */ + 0x0105ad, /* U+010586 */ + 0x0105ae, /* U+010587 */ + 0x0105af, /* U+010588 */ + 0x0105b0, /* U+010589 */ + 0x0105b1, /* U+01058a */ + 0x0105b3, /* U+01058c */ + 0x0105b4, /* U+01058d */ + 0x0105b5, /* U+01058e */ + 0x0105b6, /* U+01058f */ + 0x0105b7, /* U+010590 */ + 0x0105b8, /* U+010591 */ + 0x0105b9, /* U+010592 */ + 0x0105bb, /* U+010594 */ + 0x0105bc, /* U+010595 */ + 0x010cc0, /* U+010c80 */ + 0x010cc1, /* U+010c81 */ + 0x010cc2, /* U+010c82 */ + 0x010cc3, /* U+010c83 */ + 0x010cc4, /* U+010c84 */ + 0x010cc5, /* U+010c85 */ + 0x010cc6, /* U+010c86 */ + 0x010cc7, /* U+010c87 */ + 0x010cc8, /* U+010c88 */ + 0x010cc9, /* U+010c89 */ + 0x010cca, /* U+010c8a */ + 0x010ccb, /* U+010c8b */ + 0x010ccc, /* U+010c8c */ + 0x010ccd, /* U+010c8d */ + 0x010cce, /* U+010c8e */ + 0x010ccf, /* U+010c8f */ + 0x010cd0, /* U+010c90 */ + 0x010cd1, /* U+010c91 */ + 0x010cd2, /* U+010c92 */ + 0x010cd3, /* U+010c93 */ + 0x010cd4, /* U+010c94 */ + 0x010cd5, /* U+010c95 */ + 0x010cd6, /* U+010c96 */ + 0x010cd7, /* U+010c97 */ + 0x010cd8, /* U+010c98 */ + 0x010cd9, /* U+010c99 */ + 0x010cda, /* U+010c9a */ + 0x010cdb, /* U+010c9b */ + 0x010cdc, /* U+010c9c */ + 0x010cdd, /* U+010c9d */ + 0x010cde, /* U+010c9e */ + 0x010cdf, /* U+010c9f */ + 0x010ce0, /* U+010ca0 */ + 0x010ce1, /* U+010ca1 */ + 0x010ce2, /* U+010ca2 */ + 0x010ce3, /* U+010ca3 */ + 0x010ce4, /* U+010ca4 */ + 0x010ce5, /* U+010ca5 */ + 0x010ce6, /* U+010ca6 */ + 0x010ce7, /* U+010ca7 */ + 0x010ce8, /* U+010ca8 */ + 0x010ce9, /* U+010ca9 */ + 0x010cea, /* U+010caa */ + 0x010ceb, /* U+010cab */ + 0x010cec, /* U+010cac */ + 0x010ced, /* U+010cad */ + 0x010cee, /* U+010cae */ + 0x010cef, /* U+010caf */ + 0x010cf0, /* U+010cb0 */ + 0x010cf1, /* U+010cb1 */ + 0x010cf2, /* U+010cb2 */ + 0x010d70, /* U+010d50 */ + 0x010d71, /* U+010d51 */ + 0x010d72, /* U+010d52 */ + 0x010d73, /* U+010d53 */ + 0x010d74, /* U+010d54 */ + 0x010d75, /* U+010d55 */ + 0x010d76, /* U+010d56 */ + 0x010d77, /* U+010d57 */ + 0x010d78, /* U+010d58 */ + 0x010d79, /* U+010d59 */ + 0x010d7a, /* U+010d5a */ + 0x010d7b, /* U+010d5b */ + 0x010d7c, /* U+010d5c */ + 0x010d7d, /* U+010d5d */ + 0x010d7e, /* U+010d5e */ + 0x010d7f, /* U+010d5f */ + 0x010d80, /* U+010d60 */ + 0x010d81, /* U+010d61 */ + 0x010d82, /* U+010d62 */ + 0x010d83, /* U+010d63 */ + 0x010d84, /* U+010d64 */ + 0x010d85, /* U+010d65 */ + 0x0118c0, /* U+0118a0 */ + 0x0118c1, /* U+0118a1 */ + 0x0118c2, /* U+0118a2 */ + 0x0118c3, /* U+0118a3 */ + 0x0118c4, /* U+0118a4 */ + 0x0118c5, /* U+0118a5 */ + 0x0118c6, /* U+0118a6 */ + 0x0118c7, /* U+0118a7 */ + 0x0118c8, /* U+0118a8 */ + 0x0118c9, /* U+0118a9 */ + 0x0118ca, /* U+0118aa */ + 0x0118cb, /* U+0118ab */ + 0x0118cc, /* U+0118ac */ + 0x0118cd, /* U+0118ad */ + 0x0118ce, /* U+0118ae */ + 0x0118cf, /* U+0118af */ + 0x0118d0, /* U+0118b0 */ + 0x0118d1, /* U+0118b1 */ + 0x0118d2, /* U+0118b2 */ + 0x0118d3, /* U+0118b3 */ + 0x0118d4, /* U+0118b4 */ + 0x0118d5, /* U+0118b5 */ + 0x0118d6, /* U+0118b6 */ + 0x0118d7, /* U+0118b7 */ + 0x0118d8, /* U+0118b8 */ + 0x0118d9, /* U+0118b9 */ + 0x0118da, /* U+0118ba */ + 0x0118db, /* U+0118bb */ + 0x0118dc, /* U+0118bc */ + 0x0118dd, /* U+0118bd */ + 0x0118de, /* U+0118be */ + 0x0118df, /* U+0118bf */ + 0x016e60, /* U+016e40 */ + 0x016e61, /* U+016e41 */ + 0x016e62, /* U+016e42 */ + 0x016e63, /* U+016e43 */ + 0x016e64, /* U+016e44 */ + 0x016e65, /* U+016e45 */ + 0x016e66, /* U+016e46 */ + 0x016e67, /* U+016e47 */ + 0x016e68, /* U+016e48 */ + 0x016e69, /* U+016e49 */ + 0x016e6a, /* U+016e4a */ + 0x016e6b, /* U+016e4b */ + 0x016e6c, /* U+016e4c */ + 0x016e6d, /* U+016e4d */ + 0x016e6e, /* U+016e4e */ + 0x016e6f, /* U+016e4f */ + 0x016e70, /* U+016e50 */ + 0x016e71, /* U+016e51 */ + 0x016e72, /* U+016e52 */ + 0x016e73, /* U+016e53 */ + 0x016e74, /* U+016e54 */ + 0x016e75, /* U+016e55 */ + 0x016e76, /* U+016e56 */ + 0x016e77, /* U+016e57 */ + 0x016e78, /* U+016e58 */ + 0x016e79, /* U+016e59 */ + 0x016e7a, /* U+016e5a */ + 0x016e7b, /* U+016e5b */ + 0x016e7c, /* U+016e5c */ + 0x016e7d, /* U+016e5d */ + 0x016e7e, /* U+016e5e */ + 0x016e7f, /* U+016e5f */ + 0x01e922, /* U+01e900 */ + 0x01e923, /* U+01e901 */ + 0x01e924, /* U+01e902 */ + 0x01e925, /* U+01e903 */ + 0x01e926, /* U+01e904 */ + 0x01e927, /* U+01e905 */ + 0x01e928, /* U+01e906 */ + 0x01e929, /* U+01e907 */ + 0x01e92a, /* U+01e908 */ + 0x01e92b, /* U+01e909 */ + 0x01e92c, /* U+01e90a */ + 0x01e92d, /* U+01e90b */ + 0x01e92e, /* U+01e90c */ + 0x01e92f, /* U+01e90d */ + 0x01e930, /* U+01e90e */ + 0x01e931, /* U+01e90f */ + 0x01e932, /* U+01e910 */ + 0x01e933, /* U+01e911 */ + 0x01e934, /* U+01e912 */ + 0x01e935, /* U+01e913 */ + 0x01e936, /* U+01e914 */ + 0x01e937, /* U+01e915 */ + 0x01e938, /* U+01e916 */ + 0x01e939, /* U+01e917 */ + 0x01e93a, /* U+01e918 */ + 0x01e93b, /* U+01e919 */ + 0x01e93c, /* U+01e91a */ + 0x01e93d, /* U+01e91b */ + 0x01e93e, /* U+01e91c */ + 0x01e93f, /* U+01e91d */ + 0x01e940, /* U+01e91e */ + 0x01e941, /* U+01e91f */ + 0x01e942, /* U+01e920 */ + 0x01e943, /* U+01e921 */ + +}; + +/* + * The entry case_map_special[case_index(codepoint)] is the index in + * special_case for that codepoint, or 0 if no special case mapping exists. + */ +static const uint8 case_map_special[1704] = +{ + 0, /* reserved */ + 0, /* U+000000 */ + 0, /* U+000001 */ + 0, /* U+000002 */ + 0, /* U+000003 */ + 0, /* U+000004 */ + 0, /* U+000005 */ + 0, /* U+000006 */ + 0, /* U+000007 */ + 0, /* U+000008 */ + 0, /* U+000009 */ + 0, /* U+00000a */ + 0, /* U+00000b */ + 0, /* U+00000c */ + 0, /* U+00000d */ + 0, /* U+00000e */ + 0, /* U+00000f */ + 0, /* U+000010 */ + 0, /* U+000011 */ + 0, /* U+000012 */ + 0, /* U+000013 */ + 0, /* U+000014 */ + 0, /* U+000015 */ + 0, /* U+000016 */ + 0, /* U+000017 */ + 0, /* U+000018 */ + 0, /* U+000019 */ + 0, /* U+00001a */ + 0, /* U+00001b */ + 0, /* U+00001c */ + 0, /* U+00001d */ + 0, /* U+00001e */ + 0, /* U+00001f */ + 0, /* U+000020 */ + 0, /* U+000021 */ + 0, /* U+000022 */ + 0, /* U+000023 */ + 0, /* U+000024 */ + 0, /* U+000025 */ + 0, /* U+000026 */ + 0, /* U+000027 */ + 0, /* U+000028 */ + 0, /* U+000029 */ + 0, /* U+00002a */ + 0, /* U+00002b */ + 0, /* U+00002c */ + 0, /* U+00002d */ + 0, /* U+00002e */ + 0, /* U+00002f */ + 0, /* U+000030 */ + 0, /* U+000031 */ + 0, /* U+000032 */ + 0, /* U+000033 */ + 0, /* U+000034 */ + 0, /* U+000035 */ + 0, /* U+000036 */ + 0, /* U+000037 */ + 0, /* U+000038 */ + 0, /* U+000039 */ + 0, /* U+00003a */ + 0, /* U+00003b */ + 0, /* U+00003c */ + 0, /* U+00003d */ + 0, /* U+00003e */ + 0, /* U+00003f */ + 0, /* U+000040 */ + 0, /* U+000041 */ + 0, /* U+000042 */ + 0, /* U+000043 */ + 0, /* U+000044 */ + 0, /* U+000045 */ + 0, /* U+000046 */ + 0, /* U+000047 */ + 0, /* U+000048 */ + 0, /* U+000049 */ + 0, /* U+00004a */ + 0, /* U+00004b */ + 0, /* U+00004c */ + 0, /* U+00004d */ + 0, /* U+00004e */ + 0, /* U+00004f */ + 0, /* U+000050 */ + 0, /* U+000051 */ + 0, /* U+000052 */ + 0, /* U+000053 */ + 0, /* U+000054 */ + 0, /* U+000055 */ + 0, /* U+000056 */ + 0, /* U+000057 */ + 0, /* U+000058 */ + 0, /* U+000059 */ + 0, /* U+00005a */ + 0, /* U+00005b */ + 0, /* U+00005c */ + 0, /* U+00005d */ + 0, /* U+00005e */ + 0, /* U+00005f */ + 0, /* U+000060 */ + 0, /* U+000061 */ + 0, /* U+000062 */ + 0, /* U+000063 */ + 0, /* U+000064 */ + 0, /* U+000065 */ + 0, /* U+000066 */ + 0, /* U+000067 */ + 0, /* U+000068 */ + 0, /* U+000069 */ + 0, /* U+00006a */ + 0, /* U+00006b */ + 0, /* U+00006c */ + 0, /* U+00006d */ + 0, /* U+00006e */ + 0, /* U+00006f */ + 0, /* U+000070 */ + 0, /* U+000071 */ + 0, /* U+000072 */ + 0, /* U+000073 */ + 0, /* U+000074 */ + 0, /* U+000075 */ + 0, /* U+000076 */ + 0, /* U+000077 */ + 0, /* U+000078 */ + 0, /* U+000079 */ + 0, /* U+00007a */ + 0, /* U+00007b */ + 0, /* U+00007c */ + 0, /* U+00007d */ + 0, /* U+00007e */ + 0, /* U+00007f */ + 0, /* U+0000b5 */ + 0, /* U+0000c0 */ + 0, /* U+0000c1 */ + 0, /* U+0000c2 */ + 0, /* U+0000c3 */ + 0, /* U+0000c4 */ + 0, /* U+0000c5 */ + 0, /* U+0000c6 */ + 0, /* U+0000c7 */ + 0, /* U+0000c8 */ + 0, /* U+0000c9 */ + 0, /* U+0000ca */ + 0, /* U+0000cb */ + 0, /* U+0000cc */ + 0, /* U+0000cd */ + 0, /* U+0000ce */ + 0, /* U+0000cf */ + 0, /* U+0000d0 */ + 0, /* U+0000d1 */ + 0, /* U+0000d2 */ + 0, /* U+0000d3 */ + 0, /* U+0000d4 */ + 0, /* U+0000d5 */ + 0, /* U+0000d6 */ + 0, /* U+0000d8 */ + 0, /* U+0000d9 */ + 0, /* U+0000da */ + 0, /* U+0000db */ + 0, /* U+0000dc */ + 0, /* U+0000dd */ + 0, /* U+0000de */ + 1, /* U+0000df */ + 0, /* U+0000ff */ + 0, /* U+000100 */ + 0, /* U+000102 */ + 0, /* U+000104 */ + 0, /* U+000106 */ + 0, /* U+000108 */ + 0, /* U+00010a */ + 0, /* U+00010c */ + 0, /* U+00010e */ + 0, /* U+000110 */ + 0, /* U+000112 */ + 0, /* U+000114 */ + 0, /* U+000116 */ + 0, /* U+000118 */ + 0, /* U+00011a */ + 0, /* U+00011c */ + 0, /* U+00011e */ + 0, /* U+000120 */ + 0, /* U+000122 */ + 0, /* U+000124 */ + 0, /* U+000126 */ + 0, /* U+000128 */ + 0, /* U+00012a */ + 0, /* U+00012c */ + 0, /* U+00012e */ + 2, /* U+000130 */ + 0, /* U+000131 */ + 0, /* U+000132 */ + 0, /* U+000134 */ + 0, /* U+000136 */ + 0, /* U+000139 */ + 0, /* U+00013b */ + 0, /* U+00013d */ + 0, /* U+00013f */ + 0, /* U+000141 */ + 0, /* U+000143 */ + 0, /* U+000145 */ + 0, /* U+000147 */ + 3, /* U+000149 */ + 0, /* U+00014a */ + 0, /* U+00014c */ + 0, /* U+00014e */ + 0, /* U+000150 */ + 0, /* U+000152 */ + 0, /* U+000154 */ + 0, /* U+000156 */ + 0, /* U+000158 */ + 0, /* U+00015a */ + 0, /* U+00015c */ + 0, /* U+00015e */ + 0, /* U+000160 */ + 0, /* U+000162 */ + 0, /* U+000164 */ + 0, /* U+000166 */ + 0, /* U+000168 */ + 0, /* U+00016a */ + 0, /* U+00016c */ + 0, /* U+00016e */ + 0, /* U+000170 */ + 0, /* U+000172 */ + 0, /* U+000174 */ + 0, /* U+000176 */ + 0, /* U+000179 */ + 0, /* U+00017b */ + 0, /* U+00017d */ + 0, /* U+00017f */ + 0, /* U+000180 */ + 0, /* U+000181 */ + 0, /* U+000182 */ + 0, /* U+000184 */ + 0, /* U+000186 */ + 0, /* U+000187 */ + 0, /* U+000189 */ + 0, /* U+00018a */ + 0, /* U+00018b */ + 0, /* U+00018e */ + 0, /* U+00018f */ + 0, /* U+000190 */ + 0, /* U+000191 */ + 0, /* U+000193 */ + 0, /* U+000194 */ + 0, /* U+000195 */ + 0, /* U+000196 */ + 0, /* U+000197 */ + 0, /* U+000198 */ + 0, /* U+00019a */ + 0, /* U+00019b */ + 0, /* U+00019c */ + 0, /* U+00019d */ + 0, /* U+00019e */ + 0, /* U+00019f */ + 0, /* U+0001a0 */ + 0, /* U+0001a2 */ + 0, /* U+0001a4 */ + 0, /* U+0001a6 */ + 0, /* U+0001a7 */ + 0, /* U+0001a9 */ + 0, /* U+0001ac */ + 0, /* U+0001ae */ + 0, /* U+0001af */ + 0, /* U+0001b1 */ + 0, /* U+0001b2 */ + 0, /* U+0001b3 */ + 0, /* U+0001b5 */ + 0, /* U+0001b7 */ + 0, /* U+0001b8 */ + 0, /* U+0001bc */ + 0, /* U+0001bf */ + 0, /* U+0001c4 */ + 0, /* U+0001c7 */ + 0, /* U+0001ca */ + 0, /* U+0001cd */ + 0, /* U+0001cf */ + 0, /* U+0001d1 */ + 0, /* U+0001d3 */ + 0, /* U+0001d5 */ + 0, /* U+0001d7 */ + 0, /* U+0001d9 */ + 0, /* U+0001db */ + 0, /* U+0001de */ + 0, /* U+0001e0 */ + 0, /* U+0001e2 */ + 0, /* U+0001e4 */ + 0, /* U+0001e6 */ + 0, /* U+0001e8 */ + 0, /* U+0001ea */ + 0, /* U+0001ec */ + 0, /* U+0001ee */ + 4, /* U+0001f0 */ + 0, /* U+0001f1 */ + 0, /* U+0001f4 */ + 0, /* U+0001f8 */ + 0, /* U+0001fa */ + 0, /* U+0001fc */ + 0, /* U+0001fe */ + 0, /* U+000200 */ + 0, /* U+000202 */ + 0, /* U+000204 */ + 0, /* U+000206 */ + 0, /* U+000208 */ + 0, /* U+00020a */ + 0, /* U+00020c */ + 0, /* U+00020e */ + 0, /* U+000210 */ + 0, /* U+000212 */ + 0, /* U+000214 */ + 0, /* U+000216 */ + 0, /* U+000218 */ + 0, /* U+00021a */ + 0, /* U+00021c */ + 0, /* U+00021e */ + 0, /* U+000222 */ + 0, /* U+000224 */ + 0, /* U+000226 */ + 0, /* U+000228 */ + 0, /* U+00022a */ + 0, /* U+00022c */ + 0, /* U+00022e */ + 0, /* U+000230 */ + 0, /* U+000232 */ + 0, /* U+00023a */ + 0, /* U+00023b */ + 0, /* U+00023e */ + 0, /* U+00023f */ + 0, /* U+000240 */ + 0, /* U+000241 */ + 0, /* U+000244 */ + 0, /* U+000245 */ + 0, /* U+000246 */ + 0, /* U+000248 */ + 0, /* U+00024a */ + 0, /* U+00024c */ + 0, /* U+00024e */ + 0, /* U+000250 */ + 0, /* U+000251 */ + 0, /* U+000252 */ + 0, /* U+00025c */ + 0, /* U+000261 */ + 0, /* U+000264 */ + 0, /* U+000265 */ + 0, /* U+000266 */ + 0, /* U+00026a */ + 0, /* U+00026b */ + 0, /* U+00026c */ + 0, /* U+000271 */ + 0, /* U+00027d */ + 0, /* U+000282 */ + 0, /* U+000287 */ + 0, /* U+00029d */ + 0, /* U+00029e */ + 0, /* U+000345 */ + 0, /* U+000370 */ + 0, /* U+000372 */ + 0, /* U+000376 */ + 0, /* U+00037b */ + 0, /* U+00037c */ + 0, /* U+00037d */ + 0, /* U+00037f */ + 0, /* U+000386 */ + 0, /* U+000388 */ + 0, /* U+000389 */ + 0, /* U+00038a */ + 0, /* U+00038c */ + 0, /* U+00038e */ + 0, /* U+00038f */ + 5, /* U+000390 */ + 0, /* U+000391 */ + 0, /* U+000392 */ + 0, /* U+000393 */ + 0, /* U+000394 */ + 0, /* U+000395 */ + 0, /* U+000396 */ + 0, /* U+000397 */ + 0, /* U+000398 */ + 0, /* U+000399 */ + 0, /* U+00039a */ + 0, /* U+00039b */ + 0, /* U+00039c */ + 0, /* U+00039d */ + 0, /* U+00039e */ + 0, /* U+00039f */ + 0, /* U+0003a0 */ + 0, /* U+0003a1 */ + 6, /* U+0003a3 */ + 0, /* U+0003a4 */ + 0, /* U+0003a5 */ + 0, /* U+0003a6 */ + 0, /* U+0003a7 */ + 0, /* U+0003a8 */ + 0, /* U+0003a9 */ + 0, /* U+0003aa */ + 0, /* U+0003ab */ + 7, /* U+0003b0 */ + 0, /* U+0003c2 */ + 0, /* U+0003c3 */ + 0, /* U+0003cf */ + 0, /* U+0003d0 */ + 0, /* U+0003d1 */ + 0, /* U+0003d5 */ + 0, /* U+0003d6 */ + 0, /* U+0003d8 */ + 0, /* U+0003da */ + 0, /* U+0003dc */ + 0, /* U+0003de */ + 0, /* U+0003e0 */ + 0, /* U+0003e2 */ + 0, /* U+0003e4 */ + 0, /* U+0003e6 */ + 0, /* U+0003e8 */ + 0, /* U+0003ea */ + 0, /* U+0003ec */ + 0, /* U+0003ee */ + 0, /* U+0003f0 */ + 0, /* U+0003f1 */ + 0, /* U+0003f2 */ + 0, /* U+0003f4 */ + 0, /* U+0003f5 */ + 0, /* U+0003f7 */ + 0, /* U+0003fa */ + 0, /* U+000400 */ + 0, /* U+000401 */ + 0, /* U+000402 */ + 0, /* U+000403 */ + 0, /* U+000404 */ + 0, /* U+000405 */ + 0, /* U+000406 */ + 0, /* U+000407 */ + 0, /* U+000408 */ + 0, /* U+000409 */ + 0, /* U+00040a */ + 0, /* U+00040b */ + 0, /* U+00040c */ + 0, /* U+00040d */ + 0, /* U+00040e */ + 0, /* U+00040f */ + 0, /* U+000410 */ + 0, /* U+000411 */ + 0, /* U+000412 */ + 0, /* U+000413 */ + 0, /* U+000414 */ + 0, /* U+000415 */ + 0, /* U+000416 */ + 0, /* U+000417 */ + 0, /* U+000418 */ + 0, /* U+000419 */ + 0, /* U+00041a */ + 0, /* U+00041b */ + 0, /* U+00041c */ + 0, /* U+00041d */ + 0, /* U+00041e */ + 0, /* U+00041f */ + 0, /* U+000420 */ + 0, /* U+000421 */ + 0, /* U+000422 */ + 0, /* U+000423 */ + 0, /* U+000424 */ + 0, /* U+000425 */ + 0, /* U+000426 */ + 0, /* U+000427 */ + 0, /* U+000428 */ + 0, /* U+000429 */ + 0, /* U+00042a */ + 0, /* U+00042b */ + 0, /* U+00042c */ + 0, /* U+00042d */ + 0, /* U+00042e */ + 0, /* U+00042f */ + 0, /* U+000460 */ + 0, /* U+000462 */ + 0, /* U+000464 */ + 0, /* U+000466 */ + 0, /* U+000468 */ + 0, /* U+00046a */ + 0, /* U+00046c */ + 0, /* U+00046e */ + 0, /* U+000470 */ + 0, /* U+000472 */ + 0, /* U+000474 */ + 0, /* U+000476 */ + 0, /* U+000478 */ + 0, /* U+00047a */ + 0, /* U+00047c */ + 0, /* U+00047e */ + 0, /* U+000480 */ + 0, /* U+00048a */ + 0, /* U+00048c */ + 0, /* U+00048e */ + 0, /* U+000490 */ + 0, /* U+000492 */ + 0, /* U+000494 */ + 0, /* U+000496 */ + 0, /* U+000498 */ + 0, /* U+00049a */ + 0, /* U+00049c */ + 0, /* U+00049e */ + 0, /* U+0004a0 */ + 0, /* U+0004a2 */ + 0, /* U+0004a4 */ + 0, /* U+0004a6 */ + 0, /* U+0004a8 */ + 0, /* U+0004aa */ + 0, /* U+0004ac */ + 0, /* U+0004ae */ + 0, /* U+0004b0 */ + 0, /* U+0004b2 */ + 0, /* U+0004b4 */ + 0, /* U+0004b6 */ + 0, /* U+0004b8 */ + 0, /* U+0004ba */ + 0, /* U+0004bc */ + 0, /* U+0004be */ + 0, /* U+0004c0 */ + 0, /* U+0004c1 */ + 0, /* U+0004c3 */ + 0, /* U+0004c5 */ + 0, /* U+0004c7 */ + 0, /* U+0004c9 */ + 0, /* U+0004cb */ + 0, /* U+0004cd */ + 0, /* U+0004d0 */ + 0, /* U+0004d2 */ + 0, /* U+0004d4 */ + 0, /* U+0004d6 */ + 0, /* U+0004d8 */ + 0, /* U+0004da */ + 0, /* U+0004dc */ + 0, /* U+0004de */ + 0, /* U+0004e0 */ + 0, /* U+0004e2 */ + 0, /* U+0004e4 */ + 0, /* U+0004e6 */ + 0, /* U+0004e8 */ + 0, /* U+0004ea */ + 0, /* U+0004ec */ + 0, /* U+0004ee */ + 0, /* U+0004f0 */ + 0, /* U+0004f2 */ + 0, /* U+0004f4 */ + 0, /* U+0004f6 */ + 0, /* U+0004f8 */ + 0, /* U+0004fa */ + 0, /* U+0004fc */ + 0, /* U+0004fe */ + 0, /* U+000500 */ + 0, /* U+000502 */ + 0, /* U+000504 */ + 0, /* U+000506 */ + 0, /* U+000508 */ + 0, /* U+00050a */ + 0, /* U+00050c */ + 0, /* U+00050e */ + 0, /* U+000510 */ + 0, /* U+000512 */ + 0, /* U+000514 */ + 0, /* U+000516 */ + 0, /* U+000518 */ + 0, /* U+00051a */ + 0, /* U+00051c */ + 0, /* U+00051e */ + 0, /* U+000520 */ + 0, /* U+000522 */ + 0, /* U+000524 */ + 0, /* U+000526 */ + 0, /* U+000528 */ + 0, /* U+00052a */ + 0, /* U+00052c */ + 0, /* U+00052e */ + 0, /* U+000531 */ + 0, /* U+000532 */ + 0, /* U+000533 */ + 0, /* U+000534 */ + 0, /* U+000535 */ + 0, /* U+000536 */ + 0, /* U+000537 */ + 0, /* U+000538 */ + 0, /* U+000539 */ + 0, /* U+00053a */ + 0, /* U+00053b */ + 0, /* U+00053c */ + 0, /* U+00053d */ + 0, /* U+00053e */ + 0, /* U+00053f */ + 0, /* U+000540 */ + 0, /* U+000541 */ + 0, /* U+000542 */ + 0, /* U+000543 */ + 0, /* U+000544 */ + 0, /* U+000545 */ + 0, /* U+000546 */ + 0, /* U+000547 */ + 0, /* U+000548 */ + 0, /* U+000549 */ + 0, /* U+00054a */ + 0, /* U+00054b */ + 0, /* U+00054c */ + 0, /* U+00054d */ + 0, /* U+00054e */ + 0, /* U+00054f */ + 0, /* U+000550 */ + 0, /* U+000551 */ + 0, /* U+000552 */ + 0, /* U+000553 */ + 0, /* U+000554 */ + 0, /* U+000555 */ + 0, /* U+000556 */ + 8, /* U+000587 */ + 0, /* U+0010a0 */ + 0, /* U+0010a1 */ + 0, /* U+0010a2 */ + 0, /* U+0010a3 */ + 0, /* U+0010a4 */ + 0, /* U+0010a5 */ + 0, /* U+0010a6 */ + 0, /* U+0010a7 */ + 0, /* U+0010a8 */ + 0, /* U+0010a9 */ + 0, /* U+0010aa */ + 0, /* U+0010ab */ + 0, /* U+0010ac */ + 0, /* U+0010ad */ + 0, /* U+0010ae */ + 0, /* U+0010af */ + 0, /* U+0010b0 */ + 0, /* U+0010b1 */ + 0, /* U+0010b2 */ + 0, /* U+0010b3 */ + 0, /* U+0010b4 */ + 0, /* U+0010b5 */ + 0, /* U+0010b6 */ + 0, /* U+0010b7 */ + 0, /* U+0010b8 */ + 0, /* U+0010b9 */ + 0, /* U+0010ba */ + 0, /* U+0010bb */ + 0, /* U+0010bc */ + 0, /* U+0010bd */ + 0, /* U+0010be */ + 0, /* U+0010bf */ + 0, /* U+0010c0 */ + 0, /* U+0010c1 */ + 0, /* U+0010c2 */ + 0, /* U+0010c3 */ + 0, /* U+0010c4 */ + 0, /* U+0010c5 */ + 0, /* U+0010c7 */ + 0, /* U+0010cd */ + 0, /* U+0010d0 */ + 0, /* U+0010d1 */ + 0, /* U+0010d2 */ + 0, /* U+0010d3 */ + 0, /* U+0010d4 */ + 0, /* U+0010d5 */ + 0, /* U+0010d6 */ + 0, /* U+0010d7 */ + 0, /* U+0010d8 */ + 0, /* U+0010d9 */ + 0, /* U+0010da */ + 0, /* U+0010db */ + 0, /* U+0010dc */ + 0, /* U+0010dd */ + 0, /* U+0010de */ + 0, /* U+0010df */ + 0, /* U+0010e0 */ + 0, /* U+0010e1 */ + 0, /* U+0010e2 */ + 0, /* U+0010e3 */ + 0, /* U+0010e4 */ + 0, /* U+0010e5 */ + 0, /* U+0010e6 */ + 0, /* U+0010e7 */ + 0, /* U+0010e8 */ + 0, /* U+0010e9 */ + 0, /* U+0010ea */ + 0, /* U+0010eb */ + 0, /* U+0010ec */ + 0, /* U+0010ed */ + 0, /* U+0010ee */ + 0, /* U+0010ef */ + 0, /* U+0010f0 */ + 0, /* U+0010f1 */ + 0, /* U+0010f2 */ + 0, /* U+0010f3 */ + 0, /* U+0010f4 */ + 0, /* U+0010f5 */ + 0, /* U+0010f6 */ + 0, /* U+0010f7 */ + 0, /* U+0010f8 */ + 0, /* U+0010f9 */ + 0, /* U+0010fa */ + 0, /* U+0010fd */ + 0, /* U+0010fe */ + 0, /* U+0010ff */ + 0, /* U+0013a0 */ + 0, /* U+0013a1 */ + 0, /* U+0013a2 */ + 0, /* U+0013a3 */ + 0, /* U+0013a4 */ + 0, /* U+0013a5 */ + 0, /* U+0013a6 */ + 0, /* U+0013a7 */ + 0, /* U+0013a8 */ + 0, /* U+0013a9 */ + 0, /* U+0013aa */ + 0, /* U+0013ab */ + 0, /* U+0013ac */ + 0, /* U+0013ad */ + 0, /* U+0013ae */ + 0, /* U+0013af */ + 0, /* U+0013b0 */ + 0, /* U+0013b1 */ + 0, /* U+0013b2 */ + 0, /* U+0013b3 */ + 0, /* U+0013b4 */ + 0, /* U+0013b5 */ + 0, /* U+0013b6 */ + 0, /* U+0013b7 */ + 0, /* U+0013b8 */ + 0, /* U+0013b9 */ + 0, /* U+0013ba */ + 0, /* U+0013bb */ + 0, /* U+0013bc */ + 0, /* U+0013bd */ + 0, /* U+0013be */ + 0, /* U+0013bf */ + 0, /* U+0013c0 */ + 0, /* U+0013c1 */ + 0, /* U+0013c2 */ + 0, /* U+0013c3 */ + 0, /* U+0013c4 */ + 0, /* U+0013c5 */ + 0, /* U+0013c6 */ + 0, /* U+0013c7 */ + 0, /* U+0013c8 */ + 0, /* U+0013c9 */ + 0, /* U+0013ca */ + 0, /* U+0013cb */ + 0, /* U+0013cc */ + 0, /* U+0013cd */ + 0, /* U+0013ce */ + 0, /* U+0013cf */ + 0, /* U+0013d0 */ + 0, /* U+0013d1 */ + 0, /* U+0013d2 */ + 0, /* U+0013d3 */ + 0, /* U+0013d4 */ + 0, /* U+0013d5 */ + 0, /* U+0013d6 */ + 0, /* U+0013d7 */ + 0, /* U+0013d8 */ + 0, /* U+0013d9 */ + 0, /* U+0013da */ + 0, /* U+0013db */ + 0, /* U+0013dc */ + 0, /* U+0013dd */ + 0, /* U+0013de */ + 0, /* U+0013df */ + 0, /* U+0013e0 */ + 0, /* U+0013e1 */ + 0, /* U+0013e2 */ + 0, /* U+0013e3 */ + 0, /* U+0013e4 */ + 0, /* U+0013e5 */ + 0, /* U+0013e6 */ + 0, /* U+0013e7 */ + 0, /* U+0013e8 */ + 0, /* U+0013e9 */ + 0, /* U+0013ea */ + 0, /* U+0013eb */ + 0, /* U+0013ec */ + 0, /* U+0013ed */ + 0, /* U+0013ee */ + 0, /* U+0013ef */ + 0, /* U+0013f0 */ + 0, /* U+0013f1 */ + 0, /* U+0013f2 */ + 0, /* U+0013f3 */ + 0, /* U+0013f4 */ + 0, /* U+0013f5 */ + 0, /* U+001c80 */ + 0, /* U+001c81 */ + 0, /* U+001c82 */ + 0, /* U+001c83 */ + 0, /* U+001c84 */ + 0, /* U+001c85 */ + 0, /* U+001c86 */ + 0, /* U+001c87 */ + 0, /* U+001c88 */ + 0, /* U+001c89 */ + 0, /* U+001c90 */ + 0, /* U+001c91 */ + 0, /* U+001c92 */ + 0, /* U+001c93 */ + 0, /* U+001c94 */ + 0, /* U+001c95 */ + 0, /* U+001c96 */ + 0, /* U+001c97 */ + 0, /* U+001c98 */ + 0, /* U+001c99 */ + 0, /* U+001c9a */ + 0, /* U+001c9b */ + 0, /* U+001c9c */ + 0, /* U+001c9d */ + 0, /* U+001c9e */ + 0, /* U+001c9f */ + 0, /* U+001ca0 */ + 0, /* U+001ca1 */ + 0, /* U+001ca2 */ + 0, /* U+001ca3 */ + 0, /* U+001ca4 */ + 0, /* U+001ca5 */ + 0, /* U+001ca6 */ + 0, /* U+001ca7 */ + 0, /* U+001ca8 */ + 0, /* U+001ca9 */ + 0, /* U+001caa */ + 0, /* U+001cab */ + 0, /* U+001cac */ + 0, /* U+001cad */ + 0, /* U+001cae */ + 0, /* U+001caf */ + 0, /* U+001cb0 */ + 0, /* U+001cb1 */ + 0, /* U+001cb2 */ + 0, /* U+001cb3 */ + 0, /* U+001cb4 */ + 0, /* U+001cb5 */ + 0, /* U+001cb6 */ + 0, /* U+001cb7 */ + 0, /* U+001cb8 */ + 0, /* U+001cb9 */ + 0, /* U+001cba */ + 0, /* U+001cbd */ + 0, /* U+001cbe */ + 0, /* U+001cbf */ + 0, /* U+001d79 */ + 0, /* U+001d7d */ + 0, /* U+001d8e */ + 0, /* U+001e00 */ + 0, /* U+001e02 */ + 0, /* U+001e04 */ + 0, /* U+001e06 */ + 0, /* U+001e08 */ + 0, /* U+001e0a */ + 0, /* U+001e0c */ + 0, /* U+001e0e */ + 0, /* U+001e10 */ + 0, /* U+001e12 */ + 0, /* U+001e14 */ + 0, /* U+001e16 */ + 0, /* U+001e18 */ + 0, /* U+001e1a */ + 0, /* U+001e1c */ + 0, /* U+001e1e */ + 0, /* U+001e20 */ + 0, /* U+001e22 */ + 0, /* U+001e24 */ + 0, /* U+001e26 */ + 0, /* U+001e28 */ + 0, /* U+001e2a */ + 0, /* U+001e2c */ + 0, /* U+001e2e */ + 0, /* U+001e30 */ + 0, /* U+001e32 */ + 0, /* U+001e34 */ + 0, /* U+001e36 */ + 0, /* U+001e38 */ + 0, /* U+001e3a */ + 0, /* U+001e3c */ + 0, /* U+001e3e */ + 0, /* U+001e40 */ + 0, /* U+001e42 */ + 0, /* U+001e44 */ + 0, /* U+001e46 */ + 0, /* U+001e48 */ + 0, /* U+001e4a */ + 0, /* U+001e4c */ + 0, /* U+001e4e */ + 0, /* U+001e50 */ + 0, /* U+001e52 */ + 0, /* U+001e54 */ + 0, /* U+001e56 */ + 0, /* U+001e58 */ + 0, /* U+001e5a */ + 0, /* U+001e5c */ + 0, /* U+001e5e */ + 0, /* U+001e60 */ + 0, /* U+001e62 */ + 0, /* U+001e64 */ + 0, /* U+001e66 */ + 0, /* U+001e68 */ + 0, /* U+001e6a */ + 0, /* U+001e6c */ + 0, /* U+001e6e */ + 0, /* U+001e70 */ + 0, /* U+001e72 */ + 0, /* U+001e74 */ + 0, /* U+001e76 */ + 0, /* U+001e78 */ + 0, /* U+001e7a */ + 0, /* U+001e7c */ + 0, /* U+001e7e */ + 0, /* U+001e80 */ + 0, /* U+001e82 */ + 0, /* U+001e84 */ + 0, /* U+001e86 */ + 0, /* U+001e88 */ + 0, /* U+001e8a */ + 0, /* U+001e8c */ + 0, /* U+001e8e */ + 0, /* U+001e90 */ + 0, /* U+001e92 */ + 0, /* U+001e94 */ + 9, /* U+001e96 */ + 10, /* U+001e97 */ + 11, /* U+001e98 */ + 12, /* U+001e99 */ + 13, /* U+001e9a */ + 0, /* U+001e9b */ + 14, /* U+001e9e */ + 0, /* U+001ea0 */ + 0, /* U+001ea2 */ + 0, /* U+001ea4 */ + 0, /* U+001ea6 */ + 0, /* U+001ea8 */ + 0, /* U+001eaa */ + 0, /* U+001eac */ + 0, /* U+001eae */ + 0, /* U+001eb0 */ + 0, /* U+001eb2 */ + 0, /* U+001eb4 */ + 0, /* U+001eb6 */ + 0, /* U+001eb8 */ + 0, /* U+001eba */ + 0, /* U+001ebc */ + 0, /* U+001ebe */ + 0, /* U+001ec0 */ + 0, /* U+001ec2 */ + 0, /* U+001ec4 */ + 0, /* U+001ec6 */ + 0, /* U+001ec8 */ + 0, /* U+001eca */ + 0, /* U+001ecc */ + 0, /* U+001ece */ + 0, /* U+001ed0 */ + 0, /* U+001ed2 */ + 0, /* U+001ed4 */ + 0, /* U+001ed6 */ + 0, /* U+001ed8 */ + 0, /* U+001eda */ + 0, /* U+001edc */ + 0, /* U+001ede */ + 0, /* U+001ee0 */ + 0, /* U+001ee2 */ + 0, /* U+001ee4 */ + 0, /* U+001ee6 */ + 0, /* U+001ee8 */ + 0, /* U+001eea */ + 0, /* U+001eec */ + 0, /* U+001eee */ + 0, /* U+001ef0 */ + 0, /* U+001ef2 */ + 0, /* U+001ef4 */ + 0, /* U+001ef6 */ + 0, /* U+001ef8 */ + 0, /* U+001efa */ + 0, /* U+001efc */ + 0, /* U+001efe */ + 0, /* U+001f00 */ + 0, /* U+001f01 */ + 0, /* U+001f02 */ + 0, /* U+001f03 */ + 0, /* U+001f04 */ + 0, /* U+001f05 */ + 0, /* U+001f06 */ + 0, /* U+001f07 */ + 0, /* U+001f10 */ + 0, /* U+001f11 */ + 0, /* U+001f12 */ + 0, /* U+001f13 */ + 0, /* U+001f14 */ + 0, /* U+001f15 */ + 0, /* U+001f20 */ + 0, /* U+001f21 */ + 0, /* U+001f22 */ + 0, /* U+001f23 */ + 0, /* U+001f24 */ + 0, /* U+001f25 */ + 0, /* U+001f26 */ + 0, /* U+001f27 */ + 0, /* U+001f30 */ + 0, /* U+001f31 */ + 0, /* U+001f32 */ + 0, /* U+001f33 */ + 0, /* U+001f34 */ + 0, /* U+001f35 */ + 0, /* U+001f36 */ + 0, /* U+001f37 */ + 0, /* U+001f40 */ + 0, /* U+001f41 */ + 0, /* U+001f42 */ + 0, /* U+001f43 */ + 0, /* U+001f44 */ + 0, /* U+001f45 */ + 15, /* U+001f50 */ + 0, /* U+001f51 */ + 16, /* U+001f52 */ + 0, /* U+001f53 */ + 17, /* U+001f54 */ + 0, /* U+001f55 */ + 18, /* U+001f56 */ + 0, /* U+001f57 */ + 0, /* U+001f60 */ + 0, /* U+001f61 */ + 0, /* U+001f62 */ + 0, /* U+001f63 */ + 0, /* U+001f64 */ + 0, /* U+001f65 */ + 0, /* U+001f66 */ + 0, /* U+001f67 */ + 0, /* U+001f70 */ + 0, /* U+001f71 */ + 0, /* U+001f72 */ + 0, /* U+001f73 */ + 0, /* U+001f74 */ + 0, /* U+001f75 */ + 0, /* U+001f76 */ + 0, /* U+001f77 */ + 0, /* U+001f78 */ + 0, /* U+001f79 */ + 0, /* U+001f7a */ + 0, /* U+001f7b */ + 0, /* U+001f7c */ + 0, /* U+001f7d */ + 19, /* U+001f80 */ + 20, /* U+001f81 */ + 21, /* U+001f82 */ + 22, /* U+001f83 */ + 23, /* U+001f84 */ + 24, /* U+001f85 */ + 25, /* U+001f86 */ + 26, /* U+001f87 */ + 27, /* U+001f88 */ + 28, /* U+001f89 */ + 29, /* U+001f8a */ + 30, /* U+001f8b */ + 31, /* U+001f8c */ + 32, /* U+001f8d */ + 33, /* U+001f8e */ + 34, /* U+001f8f */ + 35, /* U+001f90 */ + 36, /* U+001f91 */ + 37, /* U+001f92 */ + 38, /* U+001f93 */ + 39, /* U+001f94 */ + 40, /* U+001f95 */ + 41, /* U+001f96 */ + 42, /* U+001f97 */ + 43, /* U+001f98 */ + 44, /* U+001f99 */ + 45, /* U+001f9a */ + 46, /* U+001f9b */ + 47, /* U+001f9c */ + 48, /* U+001f9d */ + 49, /* U+001f9e */ + 50, /* U+001f9f */ + 51, /* U+001fa0 */ + 52, /* U+001fa1 */ + 53, /* U+001fa2 */ + 54, /* U+001fa3 */ + 55, /* U+001fa4 */ + 56, /* U+001fa5 */ + 57, /* U+001fa6 */ + 58, /* U+001fa7 */ + 59, /* U+001fa8 */ + 60, /* U+001fa9 */ + 61, /* U+001faa */ + 62, /* U+001fab */ + 63, /* U+001fac */ + 64, /* U+001fad */ + 65, /* U+001fae */ + 66, /* U+001faf */ + 0, /* U+001fb0 */ + 0, /* U+001fb1 */ + 67, /* U+001fb2 */ + 68, /* U+001fb3 */ + 69, /* U+001fb4 */ + 70, /* U+001fb6 */ + 71, /* U+001fb7 */ + 72, /* U+001fbc */ + 0, /* U+001fbe */ + 73, /* U+001fc2 */ + 74, /* U+001fc3 */ + 75, /* U+001fc4 */ + 76, /* U+001fc6 */ + 77, /* U+001fc7 */ + 78, /* U+001fcc */ + 0, /* U+001fd0 */ + 0, /* U+001fd1 */ + 79, /* U+001fd2 */ + 80, /* U+001fd3 */ + 81, /* U+001fd6 */ + 82, /* U+001fd7 */ + 0, /* U+001fe0 */ + 0, /* U+001fe1 */ + 83, /* U+001fe2 */ + 84, /* U+001fe3 */ + 85, /* U+001fe4 */ + 0, /* U+001fe5 */ + 86, /* U+001fe6 */ + 87, /* U+001fe7 */ + 88, /* U+001ff2 */ + 89, /* U+001ff3 */ + 90, /* U+001ff4 */ + 91, /* U+001ff6 */ + 92, /* U+001ff7 */ + 93, /* U+001ffc */ + 0, /* U+002126 */ + 0, /* U+00212a */ + 0, /* U+00212b */ + 0, /* U+002132 */ + 0, /* U+002160 */ + 0, /* U+002161 */ + 0, /* U+002162 */ + 0, /* U+002163 */ + 0, /* U+002164 */ + 0, /* U+002165 */ + 0, /* U+002166 */ + 0, /* U+002167 */ + 0, /* U+002168 */ + 0, /* U+002169 */ + 0, /* U+00216a */ + 0, /* U+00216b */ + 0, /* U+00216c */ + 0, /* U+00216d */ + 0, /* U+00216e */ + 0, /* U+00216f */ + 0, /* U+002183 */ + 0, /* U+0024b6 */ + 0, /* U+0024b7 */ + 0, /* U+0024b8 */ + 0, /* U+0024b9 */ + 0, /* U+0024ba */ + 0, /* U+0024bb */ + 0, /* U+0024bc */ + 0, /* U+0024bd */ + 0, /* U+0024be */ + 0, /* U+0024bf */ + 0, /* U+0024c0 */ + 0, /* U+0024c1 */ + 0, /* U+0024c2 */ + 0, /* U+0024c3 */ + 0, /* U+0024c4 */ + 0, /* U+0024c5 */ + 0, /* U+0024c6 */ + 0, /* U+0024c7 */ + 0, /* U+0024c8 */ + 0, /* U+0024c9 */ + 0, /* U+0024ca */ + 0, /* U+0024cb */ + 0, /* U+0024cc */ + 0, /* U+0024cd */ + 0, /* U+0024ce */ + 0, /* U+0024cf */ + 0, /* U+002c00 */ + 0, /* U+002c01 */ + 0, /* U+002c02 */ + 0, /* U+002c03 */ + 0, /* U+002c04 */ + 0, /* U+002c05 */ + 0, /* U+002c06 */ + 0, /* U+002c07 */ + 0, /* U+002c08 */ + 0, /* U+002c09 */ + 0, /* U+002c0a */ + 0, /* U+002c0b */ + 0, /* U+002c0c */ + 0, /* U+002c0d */ + 0, /* U+002c0e */ + 0, /* U+002c0f */ + 0, /* U+002c10 */ + 0, /* U+002c11 */ + 0, /* U+002c12 */ + 0, /* U+002c13 */ + 0, /* U+002c14 */ + 0, /* U+002c15 */ + 0, /* U+002c16 */ + 0, /* U+002c17 */ + 0, /* U+002c18 */ + 0, /* U+002c19 */ + 0, /* U+002c1a */ + 0, /* U+002c1b */ + 0, /* U+002c1c */ + 0, /* U+002c1d */ + 0, /* U+002c1e */ + 0, /* U+002c1f */ + 0, /* U+002c20 */ + 0, /* U+002c21 */ + 0, /* U+002c22 */ + 0, /* U+002c23 */ + 0, /* U+002c24 */ + 0, /* U+002c25 */ + 0, /* U+002c26 */ + 0, /* U+002c27 */ + 0, /* U+002c28 */ + 0, /* U+002c29 */ + 0, /* U+002c2a */ + 0, /* U+002c2b */ + 0, /* U+002c2c */ + 0, /* U+002c2d */ + 0, /* U+002c2e */ + 0, /* U+002c2f */ + 0, /* U+002c60 */ + 0, /* U+002c67 */ + 0, /* U+002c69 */ + 0, /* U+002c6b */ + 0, /* U+002c72 */ + 0, /* U+002c75 */ + 0, /* U+002c80 */ + 0, /* U+002c82 */ + 0, /* U+002c84 */ + 0, /* U+002c86 */ + 0, /* U+002c88 */ + 0, /* U+002c8a */ + 0, /* U+002c8c */ + 0, /* U+002c8e */ + 0, /* U+002c90 */ + 0, /* U+002c92 */ + 0, /* U+002c94 */ + 0, /* U+002c96 */ + 0, /* U+002c98 */ + 0, /* U+002c9a */ + 0, /* U+002c9c */ + 0, /* U+002c9e */ + 0, /* U+002ca0 */ + 0, /* U+002ca2 */ + 0, /* U+002ca4 */ + 0, /* U+002ca6 */ + 0, /* U+002ca8 */ + 0, /* U+002caa */ + 0, /* U+002cac */ + 0, /* U+002cae */ + 0, /* U+002cb0 */ + 0, /* U+002cb2 */ + 0, /* U+002cb4 */ + 0, /* U+002cb6 */ + 0, /* U+002cb8 */ + 0, /* U+002cba */ + 0, /* U+002cbc */ + 0, /* U+002cbe */ + 0, /* U+002cc0 */ + 0, /* U+002cc2 */ + 0, /* U+002cc4 */ + 0, /* U+002cc6 */ + 0, /* U+002cc8 */ + 0, /* U+002cca */ + 0, /* U+002ccc */ + 0, /* U+002cce */ + 0, /* U+002cd0 */ + 0, /* U+002cd2 */ + 0, /* U+002cd4 */ + 0, /* U+002cd6 */ + 0, /* U+002cd8 */ + 0, /* U+002cda */ + 0, /* U+002cdc */ + 0, /* U+002cde */ + 0, /* U+002ce0 */ + 0, /* U+002ce2 */ + 0, /* U+002ceb */ + 0, /* U+002ced */ + 0, /* U+002cf2 */ + 0, /* U+00a640 */ + 0, /* U+00a642 */ + 0, /* U+00a644 */ + 0, /* U+00a646 */ + 0, /* U+00a648 */ + 0, /* U+00a64a */ + 0, /* U+00a64c */ + 0, /* U+00a64e */ + 0, /* U+00a650 */ + 0, /* U+00a652 */ + 0, /* U+00a654 */ + 0, /* U+00a656 */ + 0, /* U+00a658 */ + 0, /* U+00a65a */ + 0, /* U+00a65c */ + 0, /* U+00a65e */ + 0, /* U+00a660 */ + 0, /* U+00a662 */ + 0, /* U+00a664 */ + 0, /* U+00a666 */ + 0, /* U+00a668 */ + 0, /* U+00a66a */ + 0, /* U+00a66c */ + 0, /* U+00a680 */ + 0, /* U+00a682 */ + 0, /* U+00a684 */ + 0, /* U+00a686 */ + 0, /* U+00a688 */ + 0, /* U+00a68a */ + 0, /* U+00a68c */ + 0, /* U+00a68e */ + 0, /* U+00a690 */ + 0, /* U+00a692 */ + 0, /* U+00a694 */ + 0, /* U+00a696 */ + 0, /* U+00a698 */ + 0, /* U+00a69a */ + 0, /* U+00a722 */ + 0, /* U+00a724 */ + 0, /* U+00a726 */ + 0, /* U+00a728 */ + 0, /* U+00a72a */ + 0, /* U+00a72c */ + 0, /* U+00a72e */ + 0, /* U+00a732 */ + 0, /* U+00a734 */ + 0, /* U+00a736 */ + 0, /* U+00a738 */ + 0, /* U+00a73a */ + 0, /* U+00a73c */ + 0, /* U+00a73e */ + 0, /* U+00a740 */ + 0, /* U+00a742 */ + 0, /* U+00a744 */ + 0, /* U+00a746 */ + 0, /* U+00a748 */ + 0, /* U+00a74a */ + 0, /* U+00a74c */ + 0, /* U+00a74e */ + 0, /* U+00a750 */ + 0, /* U+00a752 */ + 0, /* U+00a754 */ + 0, /* U+00a756 */ + 0, /* U+00a758 */ + 0, /* U+00a75a */ + 0, /* U+00a75c */ + 0, /* U+00a75e */ + 0, /* U+00a760 */ + 0, /* U+00a762 */ + 0, /* U+00a764 */ + 0, /* U+00a766 */ + 0, /* U+00a768 */ + 0, /* U+00a76a */ + 0, /* U+00a76c */ + 0, /* U+00a76e */ + 0, /* U+00a779 */ + 0, /* U+00a77b */ + 0, /* U+00a77e */ + 0, /* U+00a780 */ + 0, /* U+00a782 */ + 0, /* U+00a784 */ + 0, /* U+00a786 */ + 0, /* U+00a78b */ + 0, /* U+00a790 */ + 0, /* U+00a792 */ + 0, /* U+00a794 */ + 0, /* U+00a796 */ + 0, /* U+00a798 */ + 0, /* U+00a79a */ + 0, /* U+00a79c */ + 0, /* U+00a79e */ + 0, /* U+00a7a0 */ + 0, /* U+00a7a2 */ + 0, /* U+00a7a4 */ + 0, /* U+00a7a6 */ + 0, /* U+00a7a8 */ + 0, /* U+00a7b3 */ + 0, /* U+00a7b4 */ + 0, /* U+00a7b6 */ + 0, /* U+00a7b8 */ + 0, /* U+00a7ba */ + 0, /* U+00a7bc */ + 0, /* U+00a7be */ + 0, /* U+00a7c0 */ + 0, /* U+00a7c2 */ + 0, /* U+00a7c7 */ + 0, /* U+00a7c9 */ + 0, /* U+00a7cc */ + 0, /* U+00a7d0 */ + 0, /* U+00a7d6 */ + 0, /* U+00a7d8 */ + 0, /* U+00a7da */ + 0, /* U+00a7f5 */ + 94, /* U+00fb00 */ + 95, /* U+00fb01 */ + 96, /* U+00fb02 */ + 97, /* U+00fb03 */ + 98, /* U+00fb04 */ + 99, /* U+00fb05 */ + 100, /* U+00fb06 */ + 101, /* U+00fb13 */ + 102, /* U+00fb14 */ + 103, /* U+00fb15 */ + 104, /* U+00fb16 */ + 105, /* U+00fb17 */ + 0, /* U+00ff21 */ + 0, /* U+00ff22 */ + 0, /* U+00ff23 */ + 0, /* U+00ff24 */ + 0, /* U+00ff25 */ + 0, /* U+00ff26 */ + 0, /* U+00ff27 */ + 0, /* U+00ff28 */ + 0, /* U+00ff29 */ + 0, /* U+00ff2a */ + 0, /* U+00ff2b */ + 0, /* U+00ff2c */ + 0, /* U+00ff2d */ + 0, /* U+00ff2e */ + 0, /* U+00ff2f */ + 0, /* U+00ff30 */ + 0, /* U+00ff31 */ + 0, /* U+00ff32 */ + 0, /* U+00ff33 */ + 0, /* U+00ff34 */ + 0, /* U+00ff35 */ + 0, /* U+00ff36 */ + 0, /* U+00ff37 */ + 0, /* U+00ff38 */ + 0, /* U+00ff39 */ + 0, /* U+00ff3a */ + 0, /* U+010400 */ + 0, /* U+010401 */ + 0, /* U+010402 */ + 0, /* U+010403 */ + 0, /* U+010404 */ + 0, /* U+010405 */ + 0, /* U+010406 */ + 0, /* U+010407 */ + 0, /* U+010408 */ + 0, /* U+010409 */ + 0, /* U+01040a */ + 0, /* U+01040b */ + 0, /* U+01040c */ + 0, /* U+01040d */ + 0, /* U+01040e */ + 0, /* U+01040f */ + 0, /* U+010410 */ + 0, /* U+010411 */ + 0, /* U+010412 */ + 0, /* U+010413 */ + 0, /* U+010414 */ + 0, /* U+010415 */ + 0, /* U+010416 */ + 0, /* U+010417 */ + 0, /* U+010418 */ + 0, /* U+010419 */ + 0, /* U+01041a */ + 0, /* U+01041b */ + 0, /* U+01041c */ + 0, /* U+01041d */ + 0, /* U+01041e */ + 0, /* U+01041f */ + 0, /* U+010420 */ + 0, /* U+010421 */ + 0, /* U+010422 */ + 0, /* U+010423 */ + 0, /* U+010424 */ + 0, /* U+010425 */ + 0, /* U+010426 */ + 0, /* U+010427 */ + 0, /* U+0104b0 */ + 0, /* U+0104b1 */ + 0, /* U+0104b2 */ + 0, /* U+0104b3 */ + 0, /* U+0104b4 */ + 0, /* U+0104b5 */ + 0, /* U+0104b6 */ + 0, /* U+0104b7 */ + 0, /* U+0104b8 */ + 0, /* U+0104b9 */ + 0, /* U+0104ba */ + 0, /* U+0104bb */ + 0, /* U+0104bc */ + 0, /* U+0104bd */ + 0, /* U+0104be */ + 0, /* U+0104bf */ + 0, /* U+0104c0 */ + 0, /* U+0104c1 */ + 0, /* U+0104c2 */ + 0, /* U+0104c3 */ + 0, /* U+0104c4 */ + 0, /* U+0104c5 */ + 0, /* U+0104c6 */ + 0, /* U+0104c7 */ + 0, /* U+0104c8 */ + 0, /* U+0104c9 */ + 0, /* U+0104ca */ + 0, /* U+0104cb */ + 0, /* U+0104cc */ + 0, /* U+0104cd */ + 0, /* U+0104ce */ + 0, /* U+0104cf */ + 0, /* U+0104d0 */ + 0, /* U+0104d1 */ + 0, /* U+0104d2 */ + 0, /* U+0104d3 */ + 0, /* U+010570 */ + 0, /* U+010571 */ + 0, /* U+010572 */ + 0, /* U+010573 */ + 0, /* U+010574 */ + 0, /* U+010575 */ + 0, /* U+010576 */ + 0, /* U+010577 */ + 0, /* U+010578 */ + 0, /* U+010579 */ + 0, /* U+01057a */ + 0, /* U+01057c */ + 0, /* U+01057d */ + 0, /* U+01057e */ + 0, /* U+01057f */ + 0, /* U+010580 */ + 0, /* U+010581 */ + 0, /* U+010582 */ + 0, /* U+010583 */ + 0, /* U+010584 */ + 0, /* U+010585 */ + 0, /* U+010586 */ + 0, /* U+010587 */ + 0, /* U+010588 */ + 0, /* U+010589 */ + 0, /* U+01058a */ + 0, /* U+01058c */ + 0, /* U+01058d */ + 0, /* U+01058e */ + 0, /* U+01058f */ + 0, /* U+010590 */ + 0, /* U+010591 */ + 0, /* U+010592 */ + 0, /* U+010594 */ + 0, /* U+010595 */ + 0, /* U+010c80 */ + 0, /* U+010c81 */ + 0, /* U+010c82 */ + 0, /* U+010c83 */ + 0, /* U+010c84 */ + 0, /* U+010c85 */ + 0, /* U+010c86 */ + 0, /* U+010c87 */ + 0, /* U+010c88 */ + 0, /* U+010c89 */ + 0, /* U+010c8a */ + 0, /* U+010c8b */ + 0, /* U+010c8c */ + 0, /* U+010c8d */ + 0, /* U+010c8e */ + 0, /* U+010c8f */ + 0, /* U+010c90 */ + 0, /* U+010c91 */ + 0, /* U+010c92 */ + 0, /* U+010c93 */ + 0, /* U+010c94 */ + 0, /* U+010c95 */ + 0, /* U+010c96 */ + 0, /* U+010c97 */ + 0, /* U+010c98 */ + 0, /* U+010c99 */ + 0, /* U+010c9a */ + 0, /* U+010c9b */ + 0, /* U+010c9c */ + 0, /* U+010c9d */ + 0, /* U+010c9e */ + 0, /* U+010c9f */ + 0, /* U+010ca0 */ + 0, /* U+010ca1 */ + 0, /* U+010ca2 */ + 0, /* U+010ca3 */ + 0, /* U+010ca4 */ + 0, /* U+010ca5 */ + 0, /* U+010ca6 */ + 0, /* U+010ca7 */ + 0, /* U+010ca8 */ + 0, /* U+010ca9 */ + 0, /* U+010caa */ + 0, /* U+010cab */ + 0, /* U+010cac */ + 0, /* U+010cad */ + 0, /* U+010cae */ + 0, /* U+010caf */ + 0, /* U+010cb0 */ + 0, /* U+010cb1 */ + 0, /* U+010cb2 */ + 0, /* U+010d50 */ + 0, /* U+010d51 */ + 0, /* U+010d52 */ + 0, /* U+010d53 */ + 0, /* U+010d54 */ + 0, /* U+010d55 */ + 0, /* U+010d56 */ + 0, /* U+010d57 */ + 0, /* U+010d58 */ + 0, /* U+010d59 */ + 0, /* U+010d5a */ + 0, /* U+010d5b */ + 0, /* U+010d5c */ + 0, /* U+010d5d */ + 0, /* U+010d5e */ + 0, /* U+010d5f */ + 0, /* U+010d60 */ + 0, /* U+010d61 */ + 0, /* U+010d62 */ + 0, /* U+010d63 */ + 0, /* U+010d64 */ + 0, /* U+010d65 */ + 0, /* U+0118a0 */ + 0, /* U+0118a1 */ + 0, /* U+0118a2 */ + 0, /* U+0118a3 */ + 0, /* U+0118a4 */ + 0, /* U+0118a5 */ + 0, /* U+0118a6 */ + 0, /* U+0118a7 */ + 0, /* U+0118a8 */ + 0, /* U+0118a9 */ + 0, /* U+0118aa */ + 0, /* U+0118ab */ + 0, /* U+0118ac */ + 0, /* U+0118ad */ + 0, /* U+0118ae */ + 0, /* U+0118af */ + 0, /* U+0118b0 */ + 0, /* U+0118b1 */ + 0, /* U+0118b2 */ + 0, /* U+0118b3 */ + 0, /* U+0118b4 */ + 0, /* U+0118b5 */ + 0, /* U+0118b6 */ + 0, /* U+0118b7 */ + 0, /* U+0118b8 */ + 0, /* U+0118b9 */ + 0, /* U+0118ba */ + 0, /* U+0118bb */ + 0, /* U+0118bc */ + 0, /* U+0118bd */ + 0, /* U+0118be */ + 0, /* U+0118bf */ + 0, /* U+016e40 */ + 0, /* U+016e41 */ + 0, /* U+016e42 */ + 0, /* U+016e43 */ + 0, /* U+016e44 */ + 0, /* U+016e45 */ + 0, /* U+016e46 */ + 0, /* U+016e47 */ + 0, /* U+016e48 */ + 0, /* U+016e49 */ + 0, /* U+016e4a */ + 0, /* U+016e4b */ + 0, /* U+016e4c */ + 0, /* U+016e4d */ + 0, /* U+016e4e */ + 0, /* U+016e4f */ + 0, /* U+016e50 */ + 0, /* U+016e51 */ + 0, /* U+016e52 */ + 0, /* U+016e53 */ + 0, /* U+016e54 */ + 0, /* U+016e55 */ + 0, /* U+016e56 */ + 0, /* U+016e57 */ + 0, /* U+016e58 */ + 0, /* U+016e59 */ + 0, /* U+016e5a */ + 0, /* U+016e5b */ + 0, /* U+016e5c */ + 0, /* U+016e5d */ + 0, /* U+016e5e */ + 0, /* U+016e5f */ + 0, /* U+01e900 */ + 0, /* U+01e901 */ + 0, /* U+01e902 */ + 0, /* U+01e903 */ + 0, /* U+01e904 */ + 0, /* U+01e905 */ + 0, /* U+01e906 */ + 0, /* U+01e907 */ + 0, /* U+01e908 */ + 0, /* U+01e909 */ + 0, /* U+01e90a */ + 0, /* U+01e90b */ + 0, /* U+01e90c */ + 0, /* U+01e90d */ + 0, /* U+01e90e */ + 0, /* U+01e90f */ + 0, /* U+01e910 */ + 0, /* U+01e911 */ + 0, /* U+01e912 */ + 0, /* U+01e913 */ + 0, /* U+01e914 */ + 0, /* U+01e915 */ + 0, /* U+01e916 */ + 0, /* U+01e917 */ + 0, /* U+01e918 */ + 0, /* U+01e919 */ + 0, /* U+01e91a */ + 0, /* U+01e91b */ + 0, /* U+01e91c */ + 0, /* U+01e91d */ + 0, /* U+01e91e */ + 0, /* U+01e91f */ + 0, /* U+01e920 */ + 0, /* U+01e921 */ + +}; + +/* + * Used by case_index() to map a codepoint to an index that can be used in any + * of the following arrays: case_map_lower, case_map_title, case_map_upper, + * case_map_fold. + */ +static const uint16 case_map[4778] = +{ + 1, /* U+000000 */ + 2, /* U+000001 */ + 3, /* U+000002 */ + 4, /* U+000003 */ + 5, /* U+000004 */ + 6, /* U+000005 */ + 7, /* U+000006 */ + 8, /* U+000007 */ + 9, /* U+000008 */ + 10, /* U+000009 */ + 11, /* U+00000A */ + 12, /* U+00000B */ + 13, /* U+00000C */ + 14, /* U+00000D */ + 15, /* U+00000E */ + 16, /* U+00000F */ + 17, /* U+000010 */ + 18, /* U+000011 */ + 19, /* U+000012 */ + 20, /* U+000013 */ + 21, /* U+000014 */ + 22, /* U+000015 */ + 23, /* U+000016 */ + 24, /* U+000017 */ + 25, /* U+000018 */ + 26, /* U+000019 */ + 27, /* U+00001A */ + 28, /* U+00001B */ + 29, /* U+00001C */ + 30, /* U+00001D */ + 31, /* U+00001E */ + 32, /* U+00001F */ + 33, /* U+000020 */ + 34, /* U+000021 */ + 35, /* U+000022 */ + 36, /* U+000023 */ + 37, /* U+000024 */ + 38, /* U+000025 */ + 39, /* U+000026 */ + 40, /* U+000027 */ + 41, /* U+000028 */ + 42, /* U+000029 */ + 43, /* U+00002A */ + 44, /* U+00002B */ + 45, /* U+00002C */ + 46, /* U+00002D */ + 47, /* U+00002E */ + 48, /* U+00002F */ + 49, /* U+000030 */ + 50, /* U+000031 */ + 51, /* U+000032 */ + 52, /* U+000033 */ + 53, /* U+000034 */ + 54, /* U+000035 */ + 55, /* U+000036 */ + 56, /* U+000037 */ + 57, /* U+000038 */ + 58, /* U+000039 */ + 59, /* U+00003A */ + 60, /* U+00003B */ + 61, /* U+00003C */ + 62, /* U+00003D */ + 63, /* U+00003E */ + 64, /* U+00003F */ + 65, /* U+000040 */ + 66, /* U+000041 */ + 67, /* U+000042 */ + 68, /* U+000043 */ + 69, /* U+000044 */ + 70, /* U+000045 */ + 71, /* U+000046 */ + 72, /* U+000047 */ + 73, /* U+000048 */ + 74, /* U+000049 */ + 75, /* U+00004A */ + 76, /* U+00004B */ + 77, /* U+00004C */ + 78, /* U+00004D */ + 79, /* U+00004E */ + 80, /* U+00004F */ + 81, /* U+000050 */ + 82, /* U+000051 */ + 83, /* U+000052 */ + 84, /* U+000053 */ + 85, /* U+000054 */ + 86, /* U+000055 */ + 87, /* U+000056 */ + 88, /* U+000057 */ + 89, /* U+000058 */ + 90, /* U+000059 */ + 91, /* U+00005A */ + 92, /* U+00005B */ + 93, /* U+00005C */ + 94, /* U+00005D */ + 95, /* U+00005E */ + 96, /* U+00005F */ + 97, /* U+000060 */ + 98, /* U+000061 */ + 99, /* U+000062 */ + 100, /* U+000063 */ + 101, /* U+000064 */ + 102, /* U+000065 */ + 103, /* U+000066 */ + 104, /* U+000067 */ + 105, /* U+000068 */ + 106, /* U+000069 */ + 107, /* U+00006A */ + 108, /* U+00006B */ + 109, /* U+00006C */ + 110, /* U+00006D */ + 111, /* U+00006E */ + 112, /* U+00006F */ + 113, /* U+000070 */ + 114, /* U+000071 */ + 115, /* U+000072 */ + 116, /* U+000073 */ + 117, /* U+000074 */ + 118, /* U+000075 */ + 119, /* U+000076 */ + 120, /* U+000077 */ + 121, /* U+000078 */ + 122, /* U+000079 */ + 123, /* U+00007A */ + 124, /* U+00007B */ + 125, /* U+00007C */ + 126, /* U+00007D */ + 127, /* U+00007E */ + 128, /* U+00007F */ + 0, /* U+000080 */ + 0, /* U+000081 */ + 0, /* U+000082 */ + 0, /* U+000083 */ + 0, /* U+000084 */ + 0, /* U+000085 */ + 0, /* U+000086 */ + 0, /* U+000087 */ + 0, /* U+000088 */ + 0, /* U+000089 */ + 0, /* U+00008A */ + 0, /* U+00008B */ + 0, /* U+00008C */ + 0, /* U+00008D */ + 0, /* U+00008E */ + 0, /* U+00008F */ + 0, /* U+000090 */ + 0, /* U+000091 */ + 0, /* U+000092 */ + 0, /* U+000093 */ + 0, /* U+000094 */ + 0, /* U+000095 */ + 0, /* U+000096 */ + 0, /* U+000097 */ + 0, /* U+000098 */ + 0, /* U+000099 */ + 0, /* U+00009A */ + 0, /* U+00009B */ + 0, /* U+00009C */ + 0, /* U+00009D */ + 0, /* U+00009E */ + 0, /* U+00009F */ + 0, /* U+0000A0 */ + 0, /* U+0000A1 */ + 0, /* U+0000A2 */ + 0, /* U+0000A3 */ + 0, /* U+0000A4 */ + 0, /* U+0000A5 */ + 0, /* U+0000A6 */ + 0, /* U+0000A7 */ + 0, /* U+0000A8 */ + 0, /* U+0000A9 */ + 0, /* U+0000AA */ + 0, /* U+0000AB */ + 0, /* U+0000AC */ + 0, /* U+0000AD */ + 0, /* U+0000AE */ + 0, /* U+0000AF */ + 0, /* U+0000B0 */ + 0, /* U+0000B1 */ + 0, /* U+0000B2 */ + 0, /* U+0000B3 */ + 0, /* U+0000B4 */ + 129, /* U+0000B5 */ + 0, /* U+0000B6 */ + 0, /* U+0000B7 */ + 0, /* U+0000B8 */ + 0, /* U+0000B9 */ + 0, /* U+0000BA */ + 0, /* U+0000BB */ + 0, /* U+0000BC */ + 0, /* U+0000BD */ + 0, /* U+0000BE */ + 0, /* U+0000BF */ + 130, /* U+0000C0 */ + 131, /* U+0000C1 */ + 132, /* U+0000C2 */ + 133, /* U+0000C3 */ + 134, /* U+0000C4 */ + 135, /* U+0000C5 */ + 136, /* U+0000C6 */ + 137, /* U+0000C7 */ + 138, /* U+0000C8 */ + 139, /* U+0000C9 */ + 140, /* U+0000CA */ + 141, /* U+0000CB */ + 142, /* U+0000CC */ + 143, /* U+0000CD */ + 144, /* U+0000CE */ + 145, /* U+0000CF */ + 146, /* U+0000D0 */ + 147, /* U+0000D1 */ + 148, /* U+0000D2 */ + 149, /* U+0000D3 */ + 150, /* U+0000D4 */ + 151, /* U+0000D5 */ + 152, /* U+0000D6 */ + 0, /* U+0000D7 */ + 153, /* U+0000D8 */ + 154, /* U+0000D9 */ + 155, /* U+0000DA */ + 156, /* U+0000DB */ + 157, /* U+0000DC */ + 158, /* U+0000DD */ + 159, /* U+0000DE */ + 160, /* U+0000DF */ + 130, /* U+0000E0 */ + 131, /* U+0000E1 */ + 132, /* U+0000E2 */ + 133, /* U+0000E3 */ + 134, /* U+0000E4 */ + 135, /* U+0000E5 */ + 136, /* U+0000E6 */ + 137, /* U+0000E7 */ + 138, /* U+0000E8 */ + 139, /* U+0000E9 */ + 140, /* U+0000EA */ + 141, /* U+0000EB */ + 142, /* U+0000EC */ + 143, /* U+0000ED */ + 144, /* U+0000EE */ + 145, /* U+0000EF */ + 146, /* U+0000F0 */ + 147, /* U+0000F1 */ + 148, /* U+0000F2 */ + 149, /* U+0000F3 */ + 150, /* U+0000F4 */ + 151, /* U+0000F5 */ + 152, /* U+0000F6 */ + 0, /* U+0000F7 */ + 153, /* U+0000F8 */ + 154, /* U+0000F9 */ + 155, /* U+0000FA */ + 156, /* U+0000FB */ + 157, /* U+0000FC */ + 158, /* U+0000FD */ + 159, /* U+0000FE */ + 161, /* U+0000FF */ + 162, /* U+000100 */ + 162, /* U+000101 */ + 163, /* U+000102 */ + 163, /* U+000103 */ + 164, /* U+000104 */ + 164, /* U+000105 */ + 165, /* U+000106 */ + 165, /* U+000107 */ + 166, /* U+000108 */ + 166, /* U+000109 */ + 167, /* U+00010A */ + 167, /* U+00010B */ + 168, /* U+00010C */ + 168, /* U+00010D */ + 169, /* U+00010E */ + 169, /* U+00010F */ + 170, /* U+000110 */ + 170, /* U+000111 */ + 171, /* U+000112 */ + 171, /* U+000113 */ + 172, /* U+000114 */ + 172, /* U+000115 */ + 173, /* U+000116 */ + 173, /* U+000117 */ + 174, /* U+000118 */ + 174, /* U+000119 */ + 175, /* U+00011A */ + 175, /* U+00011B */ + 176, /* U+00011C */ + 176, /* U+00011D */ + 177, /* U+00011E */ + 177, /* U+00011F */ + 178, /* U+000120 */ + 178, /* U+000121 */ + 179, /* U+000122 */ + 179, /* U+000123 */ + 180, /* U+000124 */ + 180, /* U+000125 */ + 181, /* U+000126 */ + 181, /* U+000127 */ + 182, /* U+000128 */ + 182, /* U+000129 */ + 183, /* U+00012A */ + 183, /* U+00012B */ + 184, /* U+00012C */ + 184, /* U+00012D */ + 185, /* U+00012E */ + 185, /* U+00012F */ + 186, /* U+000130 */ + 187, /* U+000131 */ + 188, /* U+000132 */ + 188, /* U+000133 */ + 189, /* U+000134 */ + 189, /* U+000135 */ + 190, /* U+000136 */ + 190, /* U+000137 */ + 0, /* U+000138 */ + 191, /* U+000139 */ + 191, /* U+00013A */ + 192, /* U+00013B */ + 192, /* U+00013C */ + 193, /* U+00013D */ + 193, /* U+00013E */ + 194, /* U+00013F */ + 194, /* U+000140 */ + 195, /* U+000141 */ + 195, /* U+000142 */ + 196, /* U+000143 */ + 196, /* U+000144 */ + 197, /* U+000145 */ + 197, /* U+000146 */ + 198, /* U+000147 */ + 198, /* U+000148 */ + 199, /* U+000149 */ + 200, /* U+00014A */ + 200, /* U+00014B */ + 201, /* U+00014C */ + 201, /* U+00014D */ + 202, /* U+00014E */ + 202, /* U+00014F */ + 203, /* U+000150 */ + 203, /* U+000151 */ + 204, /* U+000152 */ + 204, /* U+000153 */ + 205, /* U+000154 */ + 205, /* U+000155 */ + 206, /* U+000156 */ + 206, /* U+000157 */ + 207, /* U+000158 */ + 207, /* U+000159 */ + 208, /* U+00015A */ + 208, /* U+00015B */ + 209, /* U+00015C */ + 209, /* U+00015D */ + 210, /* U+00015E */ + 210, /* U+00015F */ + 211, /* U+000160 */ + 211, /* U+000161 */ + 212, /* U+000162 */ + 212, /* U+000163 */ + 213, /* U+000164 */ + 213, /* U+000165 */ + 214, /* U+000166 */ + 214, /* U+000167 */ + 215, /* U+000168 */ + 215, /* U+000169 */ + 216, /* U+00016A */ + 216, /* U+00016B */ + 217, /* U+00016C */ + 217, /* U+00016D */ + 218, /* U+00016E */ + 218, /* U+00016F */ + 219, /* U+000170 */ + 219, /* U+000171 */ + 220, /* U+000172 */ + 220, /* U+000173 */ + 221, /* U+000174 */ + 221, /* U+000175 */ + 222, /* U+000176 */ + 222, /* U+000177 */ + 161, /* U+000178 */ + 223, /* U+000179 */ + 223, /* U+00017A */ + 224, /* U+00017B */ + 224, /* U+00017C */ + 225, /* U+00017D */ + 225, /* U+00017E */ + 226, /* U+00017F */ + 227, /* U+000180 */ + 228, /* U+000181 */ + 229, /* U+000182 */ + 229, /* U+000183 */ + 230, /* U+000184 */ + 230, /* U+000185 */ + 231, /* U+000186 */ + 232, /* U+000187 */ + 232, /* U+000188 */ + 233, /* U+000189 */ + 234, /* U+00018A */ + 235, /* U+00018B */ + 235, /* U+00018C */ + 0, /* U+00018D */ + 236, /* U+00018E */ + 237, /* U+00018F */ + 238, /* U+000190 */ + 239, /* U+000191 */ + 239, /* U+000192 */ + 240, /* U+000193 */ + 241, /* U+000194 */ + 242, /* U+000195 */ + 243, /* U+000196 */ + 244, /* U+000197 */ + 245, /* U+000198 */ + 245, /* U+000199 */ + 246, /* U+00019A */ + 247, /* U+00019B */ + 248, /* U+00019C */ + 249, /* U+00019D */ + 250, /* U+00019E */ + 251, /* U+00019F */ + 252, /* U+0001A0 */ + 252, /* U+0001A1 */ + 253, /* U+0001A2 */ + 253, /* U+0001A3 */ + 254, /* U+0001A4 */ + 254, /* U+0001A5 */ + 255, /* U+0001A6 */ + 256, /* U+0001A7 */ + 256, /* U+0001A8 */ + 257, /* U+0001A9 */ + 0, /* U+0001AA */ + 0, /* U+0001AB */ + 258, /* U+0001AC */ + 258, /* U+0001AD */ + 259, /* U+0001AE */ + 260, /* U+0001AF */ + 260, /* U+0001B0 */ + 261, /* U+0001B1 */ + 262, /* U+0001B2 */ + 263, /* U+0001B3 */ + 263, /* U+0001B4 */ + 264, /* U+0001B5 */ + 264, /* U+0001B6 */ + 265, /* U+0001B7 */ + 266, /* U+0001B8 */ + 266, /* U+0001B9 */ + 0, /* U+0001BA */ + 0, /* U+0001BB */ + 267, /* U+0001BC */ + 267, /* U+0001BD */ + 0, /* U+0001BE */ + 268, /* U+0001BF */ + 0, /* U+0001C0 */ + 0, /* U+0001C1 */ + 0, /* U+0001C2 */ + 0, /* U+0001C3 */ + 269, /* U+0001C4 */ + 269, /* U+0001C5 */ + 269, /* U+0001C6 */ + 270, /* U+0001C7 */ + 270, /* U+0001C8 */ + 270, /* U+0001C9 */ + 271, /* U+0001CA */ + 271, /* U+0001CB */ + 271, /* U+0001CC */ + 272, /* U+0001CD */ + 272, /* U+0001CE */ + 273, /* U+0001CF */ + 273, /* U+0001D0 */ + 274, /* U+0001D1 */ + 274, /* U+0001D2 */ + 275, /* U+0001D3 */ + 275, /* U+0001D4 */ + 276, /* U+0001D5 */ + 276, /* U+0001D6 */ + 277, /* U+0001D7 */ + 277, /* U+0001D8 */ + 278, /* U+0001D9 */ + 278, /* U+0001DA */ + 279, /* U+0001DB */ + 279, /* U+0001DC */ + 236, /* U+0001DD */ + 280, /* U+0001DE */ + 280, /* U+0001DF */ + 281, /* U+0001E0 */ + 281, /* U+0001E1 */ + 282, /* U+0001E2 */ + 282, /* U+0001E3 */ + 283, /* U+0001E4 */ + 283, /* U+0001E5 */ + 284, /* U+0001E6 */ + 284, /* U+0001E7 */ + 285, /* U+0001E8 */ + 285, /* U+0001E9 */ + 286, /* U+0001EA */ + 286, /* U+0001EB */ + 287, /* U+0001EC */ + 287, /* U+0001ED */ + 288, /* U+0001EE */ + 288, /* U+0001EF */ + 289, /* U+0001F0 */ + 290, /* U+0001F1 */ + 290, /* U+0001F2 */ + 290, /* U+0001F3 */ + 291, /* U+0001F4 */ + 291, /* U+0001F5 */ + 242, /* U+0001F6 */ + 268, /* U+0001F7 */ + 292, /* U+0001F8 */ + 292, /* U+0001F9 */ + 293, /* U+0001FA */ + 293, /* U+0001FB */ + 294, /* U+0001FC */ + 294, /* U+0001FD */ + 295, /* U+0001FE */ + 295, /* U+0001FF */ + 296, /* U+000200 */ + 296, /* U+000201 */ + 297, /* U+000202 */ + 297, /* U+000203 */ + 298, /* U+000204 */ + 298, /* U+000205 */ + 299, /* U+000206 */ + 299, /* U+000207 */ + 300, /* U+000208 */ + 300, /* U+000209 */ + 301, /* U+00020A */ + 301, /* U+00020B */ + 302, /* U+00020C */ + 302, /* U+00020D */ + 303, /* U+00020E */ + 303, /* U+00020F */ + 304, /* U+000210 */ + 304, /* U+000211 */ + 305, /* U+000212 */ + 305, /* U+000213 */ + 306, /* U+000214 */ + 306, /* U+000215 */ + 307, /* U+000216 */ + 307, /* U+000217 */ + 308, /* U+000218 */ + 308, /* U+000219 */ + 309, /* U+00021A */ + 309, /* U+00021B */ + 310, /* U+00021C */ + 310, /* U+00021D */ + 311, /* U+00021E */ + 311, /* U+00021F */ + 250, /* U+000220 */ + 0, /* U+000221 */ + 312, /* U+000222 */ + 312, /* U+000223 */ + 313, /* U+000224 */ + 313, /* U+000225 */ + 314, /* U+000226 */ + 314, /* U+000227 */ + 315, /* U+000228 */ + 315, /* U+000229 */ + 316, /* U+00022A */ + 316, /* U+00022B */ + 317, /* U+00022C */ + 317, /* U+00022D */ + 318, /* U+00022E */ + 318, /* U+00022F */ + 319, /* U+000230 */ + 319, /* U+000231 */ + 320, /* U+000232 */ + 320, /* U+000233 */ + 0, /* U+000234 */ + 0, /* U+000235 */ + 0, /* U+000236 */ + 0, /* U+000237 */ + 0, /* U+000238 */ + 0, /* U+000239 */ + 321, /* U+00023A */ + 322, /* U+00023B */ + 322, /* U+00023C */ + 246, /* U+00023D */ + 323, /* U+00023E */ + 324, /* U+00023F */ + 325, /* U+000240 */ + 326, /* U+000241 */ + 326, /* U+000242 */ + 227, /* U+000243 */ + 327, /* U+000244 */ + 328, /* U+000245 */ + 329, /* U+000246 */ + 329, /* U+000247 */ + 330, /* U+000248 */ + 330, /* U+000249 */ + 331, /* U+00024A */ + 331, /* U+00024B */ + 332, /* U+00024C */ + 332, /* U+00024D */ + 333, /* U+00024E */ + 333, /* U+00024F */ + 334, /* U+000250 */ + 335, /* U+000251 */ + 336, /* U+000252 */ + 228, /* U+000253 */ + 231, /* U+000254 */ + 0, /* U+000255 */ + 233, /* U+000256 */ + 234, /* U+000257 */ + 0, /* U+000258 */ + 237, /* U+000259 */ + 0, /* U+00025A */ + 238, /* U+00025B */ + 337, /* U+00025C */ + 0, /* U+00025D */ + 0, /* U+00025E */ + 0, /* U+00025F */ + 240, /* U+000260 */ + 338, /* U+000261 */ + 0, /* U+000262 */ + 241, /* U+000263 */ + 339, /* U+000264 */ + 340, /* U+000265 */ + 341, /* U+000266 */ + 0, /* U+000267 */ + 244, /* U+000268 */ + 243, /* U+000269 */ + 342, /* U+00026A */ + 343, /* U+00026B */ + 344, /* U+00026C */ + 0, /* U+00026D */ + 0, /* U+00026E */ + 248, /* U+00026F */ + 0, /* U+000270 */ + 345, /* U+000271 */ + 249, /* U+000272 */ + 0, /* U+000273 */ + 0, /* U+000274 */ + 251, /* U+000275 */ + 0, /* U+000276 */ + 0, /* U+000277 */ + 0, /* U+000278 */ + 0, /* U+000279 */ + 0, /* U+00027A */ + 0, /* U+00027B */ + 0, /* U+00027C */ + 346, /* U+00027D */ + 0, /* U+00027E */ + 0, /* U+00027F */ + 255, /* U+000280 */ + 0, /* U+000281 */ + 347, /* U+000282 */ + 257, /* U+000283 */ + 0, /* U+000284 */ + 0, /* U+000285 */ + 0, /* U+000286 */ + 348, /* U+000287 */ + 259, /* U+000288 */ + 327, /* U+000289 */ + 261, /* U+00028A */ + 262, /* U+00028B */ + 328, /* U+00028C */ + 0, /* U+00028D */ + 0, /* U+00028E */ + 0, /* U+00028F */ + 0, /* U+000290 */ + 0, /* U+000291 */ + 265, /* U+000292 */ + 0, /* U+000293 */ + 0, /* U+000294 */ + 0, /* U+000295 */ + 0, /* U+000296 */ + 0, /* U+000297 */ + 0, /* U+000298 */ + 0, /* U+000299 */ + 0, /* U+00029A */ + 0, /* U+00029B */ + 0, /* U+00029C */ + 349, /* U+00029D */ + 350, /* U+00029E */ + 0, /* U+00029F */ + 0, /* U+0002A0 */ + 0, /* U+0002A1 */ + 0, /* U+0002A2 */ + 0, /* U+0002A3 */ + 0, /* U+0002A4 */ + 0, /* U+0002A5 */ + 0, /* U+0002A6 */ + 0, /* U+0002A7 */ + 0, /* U+0002A8 */ + 0, /* U+0002A9 */ + 0, /* U+0002AA */ + 0, /* U+0002AB */ + 0, /* U+0002AC */ + 0, /* U+0002AD */ + 0, /* U+0002AE */ + 0, /* U+0002AF */ + 0, /* U+0002B0 */ + 0, /* U+0002B1 */ + 0, /* U+0002B2 */ + 0, /* U+0002B3 */ + 0, /* U+0002B4 */ + 0, /* U+0002B5 */ + 0, /* U+0002B6 */ + 0, /* U+0002B7 */ + 0, /* U+0002B8 */ + 0, /* U+0002B9 */ + 0, /* U+0002BA */ + 0, /* U+0002BB */ + 0, /* U+0002BC */ + 0, /* U+0002BD */ + 0, /* U+0002BE */ + 0, /* U+0002BF */ + 0, /* U+0002C0 */ + 0, /* U+0002C1 */ + 0, /* U+0002C2 */ + 0, /* U+0002C3 */ + 0, /* U+0002C4 */ + 0, /* U+0002C5 */ + 0, /* U+0002C6 */ + 0, /* U+0002C7 */ + 0, /* U+0002C8 */ + 0, /* U+0002C9 */ + 0, /* U+0002CA */ + 0, /* U+0002CB */ + 0, /* U+0002CC */ + 0, /* U+0002CD */ + 0, /* U+0002CE */ + 0, /* U+0002CF */ + 0, /* U+0002D0 */ + 0, /* U+0002D1 */ + 0, /* U+0002D2 */ + 0, /* U+0002D3 */ + 0, /* U+0002D4 */ + 0, /* U+0002D5 */ + 0, /* U+0002D6 */ + 0, /* U+0002D7 */ + 0, /* U+0002D8 */ + 0, /* U+0002D9 */ + 0, /* U+0002DA */ + 0, /* U+0002DB */ + 0, /* U+0002DC */ + 0, /* U+0002DD */ + 0, /* U+0002DE */ + 0, /* U+0002DF */ + 0, /* U+0002E0 */ + 0, /* U+0002E1 */ + 0, /* U+0002E2 */ + 0, /* U+0002E3 */ + 0, /* U+0002E4 */ + 0, /* U+0002E5 */ + 0, /* U+0002E6 */ + 0, /* U+0002E7 */ + 0, /* U+0002E8 */ + 0, /* U+0002E9 */ + 0, /* U+0002EA */ + 0, /* U+0002EB */ + 0, /* U+0002EC */ + 0, /* U+0002ED */ + 0, /* U+0002EE */ + 0, /* U+0002EF */ + 0, /* U+0002F0 */ + 0, /* U+0002F1 */ + 0, /* U+0002F2 */ + 0, /* U+0002F3 */ + 0, /* U+0002F4 */ + 0, /* U+0002F5 */ + 0, /* U+0002F6 */ + 0, /* U+0002F7 */ + 0, /* U+0002F8 */ + 0, /* U+0002F9 */ + 0, /* U+0002FA */ + 0, /* U+0002FB */ + 0, /* U+0002FC */ + 0, /* U+0002FD */ + 0, /* U+0002FE */ + 0, /* U+0002FF */ + 0, /* U+000300 */ + 0, /* U+000301 */ + 0, /* U+000302 */ + 0, /* U+000303 */ + 0, /* U+000304 */ + 0, /* U+000305 */ + 0, /* U+000306 */ + 0, /* U+000307 */ + 0, /* U+000308 */ + 0, /* U+000309 */ + 0, /* U+00030A */ + 0, /* U+00030B */ + 0, /* U+00030C */ + 0, /* U+00030D */ + 0, /* U+00030E */ + 0, /* U+00030F */ + 0, /* U+000310 */ + 0, /* U+000311 */ + 0, /* U+000312 */ + 0, /* U+000313 */ + 0, /* U+000314 */ + 0, /* U+000315 */ + 0, /* U+000316 */ + 0, /* U+000317 */ + 0, /* U+000318 */ + 0, /* U+000319 */ + 0, /* U+00031A */ + 0, /* U+00031B */ + 0, /* U+00031C */ + 0, /* U+00031D */ + 0, /* U+00031E */ + 0, /* U+00031F */ + 0, /* U+000320 */ + 0, /* U+000321 */ + 0, /* U+000322 */ + 0, /* U+000323 */ + 0, /* U+000324 */ + 0, /* U+000325 */ + 0, /* U+000326 */ + 0, /* U+000327 */ + 0, /* U+000328 */ + 0, /* U+000329 */ + 0, /* U+00032A */ + 0, /* U+00032B */ + 0, /* U+00032C */ + 0, /* U+00032D */ + 0, /* U+00032E */ + 0, /* U+00032F */ + 0, /* U+000330 */ + 0, /* U+000331 */ + 0, /* U+000332 */ + 0, /* U+000333 */ + 0, /* U+000334 */ + 0, /* U+000335 */ + 0, /* U+000336 */ + 0, /* U+000337 */ + 0, /* U+000338 */ + 0, /* U+000339 */ + 0, /* U+00033A */ + 0, /* U+00033B */ + 0, /* U+00033C */ + 0, /* U+00033D */ + 0, /* U+00033E */ + 0, /* U+00033F */ + 0, /* U+000340 */ + 0, /* U+000341 */ + 0, /* U+000342 */ + 0, /* U+000343 */ + 0, /* U+000344 */ + 351, /* U+000345 */ + 0, /* U+000346 */ + 0, /* U+000347 */ + 0, /* U+000348 */ + 0, /* U+000349 */ + 0, /* U+00034A */ + 0, /* U+00034B */ + 0, /* U+00034C */ + 0, /* U+00034D */ + 0, /* U+00034E */ + 0, /* U+00034F */ + 0, /* U+000350 */ + 0, /* U+000351 */ + 0, /* U+000352 */ + 0, /* U+000353 */ + 0, /* U+000354 */ + 0, /* U+000355 */ + 0, /* U+000356 */ + 0, /* U+000357 */ + 0, /* U+000358 */ + 0, /* U+000359 */ + 0, /* U+00035A */ + 0, /* U+00035B */ + 0, /* U+00035C */ + 0, /* U+00035D */ + 0, /* U+00035E */ + 0, /* U+00035F */ + 0, /* U+000360 */ + 0, /* U+000361 */ + 0, /* U+000362 */ + 0, /* U+000363 */ + 0, /* U+000364 */ + 0, /* U+000365 */ + 0, /* U+000366 */ + 0, /* U+000367 */ + 0, /* U+000368 */ + 0, /* U+000369 */ + 0, /* U+00036A */ + 0, /* U+00036B */ + 0, /* U+00036C */ + 0, /* U+00036D */ + 0, /* U+00036E */ + 0, /* U+00036F */ + 352, /* U+000370 */ + 352, /* U+000371 */ + 353, /* U+000372 */ + 353, /* U+000373 */ + 0, /* U+000374 */ + 0, /* U+000375 */ + 354, /* U+000376 */ + 354, /* U+000377 */ + 0, /* U+000378 */ + 0, /* U+000379 */ + 0, /* U+00037A */ + 355, /* U+00037B */ + 356, /* U+00037C */ + 357, /* U+00037D */ + 0, /* U+00037E */ + 358, /* U+00037F */ + 0, /* U+000380 */ + 0, /* U+000381 */ + 0, /* U+000382 */ + 0, /* U+000383 */ + 0, /* U+000384 */ + 0, /* U+000385 */ + 359, /* U+000386 */ + 0, /* U+000387 */ + 360, /* U+000388 */ + 361, /* U+000389 */ + 362, /* U+00038A */ + 0, /* U+00038B */ + 363, /* U+00038C */ + 0, /* U+00038D */ + 364, /* U+00038E */ + 365, /* U+00038F */ + 366, /* U+000390 */ + 367, /* U+000391 */ + 368, /* U+000392 */ + 369, /* U+000393 */ + 370, /* U+000394 */ + 371, /* U+000395 */ + 372, /* U+000396 */ + 373, /* U+000397 */ + 374, /* U+000398 */ + 375, /* U+000399 */ + 376, /* U+00039A */ + 377, /* U+00039B */ + 378, /* U+00039C */ + 379, /* U+00039D */ + 380, /* U+00039E */ + 381, /* U+00039F */ + 382, /* U+0003A0 */ + 383, /* U+0003A1 */ + 0, /* U+0003A2 */ + 384, /* U+0003A3 */ + 385, /* U+0003A4 */ + 386, /* U+0003A5 */ + 387, /* U+0003A6 */ + 388, /* U+0003A7 */ + 389, /* U+0003A8 */ + 390, /* U+0003A9 */ + 391, /* U+0003AA */ + 392, /* U+0003AB */ + 359, /* U+0003AC */ + 360, /* U+0003AD */ + 361, /* U+0003AE */ + 362, /* U+0003AF */ + 393, /* U+0003B0 */ + 367, /* U+0003B1 */ + 368, /* U+0003B2 */ + 369, /* U+0003B3 */ + 370, /* U+0003B4 */ + 371, /* U+0003B5 */ + 372, /* U+0003B6 */ + 373, /* U+0003B7 */ + 374, /* U+0003B8 */ + 375, /* U+0003B9 */ + 376, /* U+0003BA */ + 377, /* U+0003BB */ + 378, /* U+0003BC */ + 379, /* U+0003BD */ + 380, /* U+0003BE */ + 381, /* U+0003BF */ + 382, /* U+0003C0 */ + 383, /* U+0003C1 */ + 394, /* U+0003C2 */ + 395, /* U+0003C3 */ + 385, /* U+0003C4 */ + 386, /* U+0003C5 */ + 387, /* U+0003C6 */ + 388, /* U+0003C7 */ + 389, /* U+0003C8 */ + 390, /* U+0003C9 */ + 391, /* U+0003CA */ + 392, /* U+0003CB */ + 363, /* U+0003CC */ + 364, /* U+0003CD */ + 365, /* U+0003CE */ + 396, /* U+0003CF */ + 397, /* U+0003D0 */ + 398, /* U+0003D1 */ + 0, /* U+0003D2 */ + 0, /* U+0003D3 */ + 0, /* U+0003D4 */ + 399, /* U+0003D5 */ + 400, /* U+0003D6 */ + 396, /* U+0003D7 */ + 401, /* U+0003D8 */ + 401, /* U+0003D9 */ + 402, /* U+0003DA */ + 402, /* U+0003DB */ + 403, /* U+0003DC */ + 403, /* U+0003DD */ + 404, /* U+0003DE */ + 404, /* U+0003DF */ + 405, /* U+0003E0 */ + 405, /* U+0003E1 */ + 406, /* U+0003E2 */ + 406, /* U+0003E3 */ + 407, /* U+0003E4 */ + 407, /* U+0003E5 */ + 408, /* U+0003E6 */ + 408, /* U+0003E7 */ + 409, /* U+0003E8 */ + 409, /* U+0003E9 */ + 410, /* U+0003EA */ + 410, /* U+0003EB */ + 411, /* U+0003EC */ + 411, /* U+0003ED */ + 412, /* U+0003EE */ + 412, /* U+0003EF */ + 413, /* U+0003F0 */ + 414, /* U+0003F1 */ + 415, /* U+0003F2 */ + 358, /* U+0003F3 */ + 416, /* U+0003F4 */ + 417, /* U+0003F5 */ + 0, /* U+0003F6 */ + 418, /* U+0003F7 */ + 418, /* U+0003F8 */ + 415, /* U+0003F9 */ + 419, /* U+0003FA */ + 419, /* U+0003FB */ + 0, /* U+0003FC */ + 355, /* U+0003FD */ + 356, /* U+0003FE */ + 357, /* U+0003FF */ + 420, /* U+000400 */ + 421, /* U+000401 */ + 422, /* U+000402 */ + 423, /* U+000403 */ + 424, /* U+000404 */ + 425, /* U+000405 */ + 426, /* U+000406 */ + 427, /* U+000407 */ + 428, /* U+000408 */ + 429, /* U+000409 */ + 430, /* U+00040A */ + 431, /* U+00040B */ + 432, /* U+00040C */ + 433, /* U+00040D */ + 434, /* U+00040E */ + 435, /* U+00040F */ + 436, /* U+000410 */ + 437, /* U+000411 */ + 438, /* U+000412 */ + 439, /* U+000413 */ + 440, /* U+000414 */ + 441, /* U+000415 */ + 442, /* U+000416 */ + 443, /* U+000417 */ + 444, /* U+000418 */ + 445, /* U+000419 */ + 446, /* U+00041A */ + 447, /* U+00041B */ + 448, /* U+00041C */ + 449, /* U+00041D */ + 450, /* U+00041E */ + 451, /* U+00041F */ + 452, /* U+000420 */ + 453, /* U+000421 */ + 454, /* U+000422 */ + 455, /* U+000423 */ + 456, /* U+000424 */ + 457, /* U+000425 */ + 458, /* U+000426 */ + 459, /* U+000427 */ + 460, /* U+000428 */ + 461, /* U+000429 */ + 462, /* U+00042A */ + 463, /* U+00042B */ + 464, /* U+00042C */ + 465, /* U+00042D */ + 466, /* U+00042E */ + 467, /* U+00042F */ + 436, /* U+000430 */ + 437, /* U+000431 */ + 438, /* U+000432 */ + 439, /* U+000433 */ + 440, /* U+000434 */ + 441, /* U+000435 */ + 442, /* U+000436 */ + 443, /* U+000437 */ + 444, /* U+000438 */ + 445, /* U+000439 */ + 446, /* U+00043A */ + 447, /* U+00043B */ + 448, /* U+00043C */ + 449, /* U+00043D */ + 450, /* U+00043E */ + 451, /* U+00043F */ + 452, /* U+000440 */ + 453, /* U+000441 */ + 454, /* U+000442 */ + 455, /* U+000443 */ + 456, /* U+000444 */ + 457, /* U+000445 */ + 458, /* U+000446 */ + 459, /* U+000447 */ + 460, /* U+000448 */ + 461, /* U+000449 */ + 462, /* U+00044A */ + 463, /* U+00044B */ + 464, /* U+00044C */ + 465, /* U+00044D */ + 466, /* U+00044E */ + 467, /* U+00044F */ + 420, /* U+000450 */ + 421, /* U+000451 */ + 422, /* U+000452 */ + 423, /* U+000453 */ + 424, /* U+000454 */ + 425, /* U+000455 */ + 426, /* U+000456 */ + 427, /* U+000457 */ + 428, /* U+000458 */ + 429, /* U+000459 */ + 430, /* U+00045A */ + 431, /* U+00045B */ + 432, /* U+00045C */ + 433, /* U+00045D */ + 434, /* U+00045E */ + 435, /* U+00045F */ + 468, /* U+000460 */ + 468, /* U+000461 */ + 469, /* U+000462 */ + 469, /* U+000463 */ + 470, /* U+000464 */ + 470, /* U+000465 */ + 471, /* U+000466 */ + 471, /* U+000467 */ + 472, /* U+000468 */ + 472, /* U+000469 */ + 473, /* U+00046A */ + 473, /* U+00046B */ + 474, /* U+00046C */ + 474, /* U+00046D */ + 475, /* U+00046E */ + 475, /* U+00046F */ + 476, /* U+000470 */ + 476, /* U+000471 */ + 477, /* U+000472 */ + 477, /* U+000473 */ + 478, /* U+000474 */ + 478, /* U+000475 */ + 479, /* U+000476 */ + 479, /* U+000477 */ + 480, /* U+000478 */ + 480, /* U+000479 */ + 481, /* U+00047A */ + 481, /* U+00047B */ + 482, /* U+00047C */ + 482, /* U+00047D */ + 483, /* U+00047E */ + 483, /* U+00047F */ + 484, /* U+000480 */ + 484, /* U+000481 */ + 0, /* U+000482 */ + 0, /* U+000483 */ + 0, /* U+000484 */ + 0, /* U+000485 */ + 0, /* U+000486 */ + 0, /* U+000487 */ + 0, /* U+000488 */ + 0, /* U+000489 */ + 485, /* U+00048A */ + 485, /* U+00048B */ + 486, /* U+00048C */ + 486, /* U+00048D */ + 487, /* U+00048E */ + 487, /* U+00048F */ + 488, /* U+000490 */ + 488, /* U+000491 */ + 489, /* U+000492 */ + 489, /* U+000493 */ + 490, /* U+000494 */ + 490, /* U+000495 */ + 491, /* U+000496 */ + 491, /* U+000497 */ + 492, /* U+000498 */ + 492, /* U+000499 */ + 493, /* U+00049A */ + 493, /* U+00049B */ + 494, /* U+00049C */ + 494, /* U+00049D */ + 495, /* U+00049E */ + 495, /* U+00049F */ + 496, /* U+0004A0 */ + 496, /* U+0004A1 */ + 497, /* U+0004A2 */ + 497, /* U+0004A3 */ + 498, /* U+0004A4 */ + 498, /* U+0004A5 */ + 499, /* U+0004A6 */ + 499, /* U+0004A7 */ + 500, /* U+0004A8 */ + 500, /* U+0004A9 */ + 501, /* U+0004AA */ + 501, /* U+0004AB */ + 502, /* U+0004AC */ + 502, /* U+0004AD */ + 503, /* U+0004AE */ + 503, /* U+0004AF */ + 504, /* U+0004B0 */ + 504, /* U+0004B1 */ + 505, /* U+0004B2 */ + 505, /* U+0004B3 */ + 506, /* U+0004B4 */ + 506, /* U+0004B5 */ + 507, /* U+0004B6 */ + 507, /* U+0004B7 */ + 508, /* U+0004B8 */ + 508, /* U+0004B9 */ + 509, /* U+0004BA */ + 509, /* U+0004BB */ + 510, /* U+0004BC */ + 510, /* U+0004BD */ + 511, /* U+0004BE */ + 511, /* U+0004BF */ + 512, /* U+0004C0 */ + 513, /* U+0004C1 */ + 513, /* U+0004C2 */ + 514, /* U+0004C3 */ + 514, /* U+0004C4 */ + 515, /* U+0004C5 */ + 515, /* U+0004C6 */ + 516, /* U+0004C7 */ + 516, /* U+0004C8 */ + 517, /* U+0004C9 */ + 517, /* U+0004CA */ + 518, /* U+0004CB */ + 518, /* U+0004CC */ + 519, /* U+0004CD */ + 519, /* U+0004CE */ + 512, /* U+0004CF */ + 520, /* U+0004D0 */ + 520, /* U+0004D1 */ + 521, /* U+0004D2 */ + 521, /* U+0004D3 */ + 522, /* U+0004D4 */ + 522, /* U+0004D5 */ + 523, /* U+0004D6 */ + 523, /* U+0004D7 */ + 524, /* U+0004D8 */ + 524, /* U+0004D9 */ + 525, /* U+0004DA */ + 525, /* U+0004DB */ + 526, /* U+0004DC */ + 526, /* U+0004DD */ + 527, /* U+0004DE */ + 527, /* U+0004DF */ + 528, /* U+0004E0 */ + 528, /* U+0004E1 */ + 529, /* U+0004E2 */ + 529, /* U+0004E3 */ + 530, /* U+0004E4 */ + 530, /* U+0004E5 */ + 531, /* U+0004E6 */ + 531, /* U+0004E7 */ + 532, /* U+0004E8 */ + 532, /* U+0004E9 */ + 533, /* U+0004EA */ + 533, /* U+0004EB */ + 534, /* U+0004EC */ + 534, /* U+0004ED */ + 535, /* U+0004EE */ + 535, /* U+0004EF */ + 536, /* U+0004F0 */ + 536, /* U+0004F1 */ + 537, /* U+0004F2 */ + 537, /* U+0004F3 */ + 538, /* U+0004F4 */ + 538, /* U+0004F5 */ + 539, /* U+0004F6 */ + 539, /* U+0004F7 */ + 540, /* U+0004F8 */ + 540, /* U+0004F9 */ + 541, /* U+0004FA */ + 541, /* U+0004FB */ + 542, /* U+0004FC */ + 542, /* U+0004FD */ + 543, /* U+0004FE */ + 543, /* U+0004FF */ + 544, /* U+000500 */ + 544, /* U+000501 */ + 545, /* U+000502 */ + 545, /* U+000503 */ + 546, /* U+000504 */ + 546, /* U+000505 */ + 547, /* U+000506 */ + 547, /* U+000507 */ + 548, /* U+000508 */ + 548, /* U+000509 */ + 549, /* U+00050A */ + 549, /* U+00050B */ + 550, /* U+00050C */ + 550, /* U+00050D */ + 551, /* U+00050E */ + 551, /* U+00050F */ + 552, /* U+000510 */ + 552, /* U+000511 */ + 553, /* U+000512 */ + 553, /* U+000513 */ + 554, /* U+000514 */ + 554, /* U+000515 */ + 555, /* U+000516 */ + 555, /* U+000517 */ + 556, /* U+000518 */ + 556, /* U+000519 */ + 557, /* U+00051A */ + 557, /* U+00051B */ + 558, /* U+00051C */ + 558, /* U+00051D */ + 559, /* U+00051E */ + 559, /* U+00051F */ + 560, /* U+000520 */ + 560, /* U+000521 */ + 561, /* U+000522 */ + 561, /* U+000523 */ + 562, /* U+000524 */ + 562, /* U+000525 */ + 563, /* U+000526 */ + 563, /* U+000527 */ + 564, /* U+000528 */ + 564, /* U+000529 */ + 565, /* U+00052A */ + 565, /* U+00052B */ + 566, /* U+00052C */ + 566, /* U+00052D */ + 567, /* U+00052E */ + 567, /* U+00052F */ + 0, /* U+000530 */ + 568, /* U+000531 */ + 569, /* U+000532 */ + 570, /* U+000533 */ + 571, /* U+000534 */ + 572, /* U+000535 */ + 573, /* U+000536 */ + 574, /* U+000537 */ + 575, /* U+000538 */ + 576, /* U+000539 */ + 577, /* U+00053A */ + 578, /* U+00053B */ + 579, /* U+00053C */ + 580, /* U+00053D */ + 581, /* U+00053E */ + 582, /* U+00053F */ + 583, /* U+000540 */ + 584, /* U+000541 */ + 585, /* U+000542 */ + 586, /* U+000543 */ + 587, /* U+000544 */ + 588, /* U+000545 */ + 589, /* U+000546 */ + 590, /* U+000547 */ + 591, /* U+000548 */ + 592, /* U+000549 */ + 593, /* U+00054A */ + 594, /* U+00054B */ + 595, /* U+00054C */ + 596, /* U+00054D */ + 597, /* U+00054E */ + 598, /* U+00054F */ + 599, /* U+000550 */ + 600, /* U+000551 */ + 601, /* U+000552 */ + 602, /* U+000553 */ + 603, /* U+000554 */ + 604, /* U+000555 */ + 605, /* U+000556 */ + 0, /* U+000557 */ + 0, /* U+000558 */ + 0, /* U+000559 */ + 0, /* U+00055A */ + 0, /* U+00055B */ + 0, /* U+00055C */ + 0, /* U+00055D */ + 0, /* U+00055E */ + 0, /* U+00055F */ + 0, /* U+000560 */ + 568, /* U+000561 */ + 569, /* U+000562 */ + 570, /* U+000563 */ + 571, /* U+000564 */ + 572, /* U+000565 */ + 573, /* U+000566 */ + 574, /* U+000567 */ + 575, /* U+000568 */ + 576, /* U+000569 */ + 577, /* U+00056A */ + 578, /* U+00056B */ + 579, /* U+00056C */ + 580, /* U+00056D */ + 581, /* U+00056E */ + 582, /* U+00056F */ + 583, /* U+000570 */ + 584, /* U+000571 */ + 585, /* U+000572 */ + 586, /* U+000573 */ + 587, /* U+000574 */ + 588, /* U+000575 */ + 589, /* U+000576 */ + 590, /* U+000577 */ + 591, /* U+000578 */ + 592, /* U+000579 */ + 593, /* U+00057A */ + 594, /* U+00057B */ + 595, /* U+00057C */ + 596, /* U+00057D */ + 597, /* U+00057E */ + 598, /* U+00057F */ + 599, /* U+000580 */ + 600, /* U+000581 */ + 601, /* U+000582 */ + 602, /* U+000583 */ + 603, /* U+000584 */ + 604, /* U+000585 */ + 605, /* U+000586 */ + 606, /* U+000587 */ + 607, /* U+0010A0 */ + 608, /* U+0010A1 */ + 609, /* U+0010A2 */ + 610, /* U+0010A3 */ + 611, /* U+0010A4 */ + 612, /* U+0010A5 */ + 613, /* U+0010A6 */ + 614, /* U+0010A7 */ + 615, /* U+0010A8 */ + 616, /* U+0010A9 */ + 617, /* U+0010AA */ + 618, /* U+0010AB */ + 619, /* U+0010AC */ + 620, /* U+0010AD */ + 621, /* U+0010AE */ + 622, /* U+0010AF */ + 623, /* U+0010B0 */ + 624, /* U+0010B1 */ + 625, /* U+0010B2 */ + 626, /* U+0010B3 */ + 627, /* U+0010B4 */ + 628, /* U+0010B5 */ + 629, /* U+0010B6 */ + 630, /* U+0010B7 */ + 631, /* U+0010B8 */ + 632, /* U+0010B9 */ + 633, /* U+0010BA */ + 634, /* U+0010BB */ + 635, /* U+0010BC */ + 636, /* U+0010BD */ + 637, /* U+0010BE */ + 638, /* U+0010BF */ + 639, /* U+0010C0 */ + 640, /* U+0010C1 */ + 641, /* U+0010C2 */ + 642, /* U+0010C3 */ + 643, /* U+0010C4 */ + 644, /* U+0010C5 */ + 0, /* U+0010C6 */ + 645, /* U+0010C7 */ + 0, /* U+0010C8 */ + 0, /* U+0010C9 */ + 0, /* U+0010CA */ + 0, /* U+0010CB */ + 0, /* U+0010CC */ + 646, /* U+0010CD */ + 0, /* U+0010CE */ + 0, /* U+0010CF */ + 647, /* U+0010D0 */ + 648, /* U+0010D1 */ + 649, /* U+0010D2 */ + 650, /* U+0010D3 */ + 651, /* U+0010D4 */ + 652, /* U+0010D5 */ + 653, /* U+0010D6 */ + 654, /* U+0010D7 */ + 655, /* U+0010D8 */ + 656, /* U+0010D9 */ + 657, /* U+0010DA */ + 658, /* U+0010DB */ + 659, /* U+0010DC */ + 660, /* U+0010DD */ + 661, /* U+0010DE */ + 662, /* U+0010DF */ + 663, /* U+0010E0 */ + 664, /* U+0010E1 */ + 665, /* U+0010E2 */ + 666, /* U+0010E3 */ + 667, /* U+0010E4 */ + 668, /* U+0010E5 */ + 669, /* U+0010E6 */ + 670, /* U+0010E7 */ + 671, /* U+0010E8 */ + 672, /* U+0010E9 */ + 673, /* U+0010EA */ + 674, /* U+0010EB */ + 675, /* U+0010EC */ + 676, /* U+0010ED */ + 677, /* U+0010EE */ + 678, /* U+0010EF */ + 679, /* U+0010F0 */ + 680, /* U+0010F1 */ + 681, /* U+0010F2 */ + 682, /* U+0010F3 */ + 683, /* U+0010F4 */ + 684, /* U+0010F5 */ + 685, /* U+0010F6 */ + 686, /* U+0010F7 */ + 687, /* U+0010F8 */ + 688, /* U+0010F9 */ + 689, /* U+0010FA */ + 0, /* U+0010FB */ + 0, /* U+0010FC */ + 690, /* U+0010FD */ + 691, /* U+0010FE */ + 692, /* U+0010FF */ + 693, /* U+0013A0 */ + 694, /* U+0013A1 */ + 695, /* U+0013A2 */ + 696, /* U+0013A3 */ + 697, /* U+0013A4 */ + 698, /* U+0013A5 */ + 699, /* U+0013A6 */ + 700, /* U+0013A7 */ + 701, /* U+0013A8 */ + 702, /* U+0013A9 */ + 703, /* U+0013AA */ + 704, /* U+0013AB */ + 705, /* U+0013AC */ + 706, /* U+0013AD */ + 707, /* U+0013AE */ + 708, /* U+0013AF */ + 709, /* U+0013B0 */ + 710, /* U+0013B1 */ + 711, /* U+0013B2 */ + 712, /* U+0013B3 */ + 713, /* U+0013B4 */ + 714, /* U+0013B5 */ + 715, /* U+0013B6 */ + 716, /* U+0013B7 */ + 717, /* U+0013B8 */ + 718, /* U+0013B9 */ + 719, /* U+0013BA */ + 720, /* U+0013BB */ + 721, /* U+0013BC */ + 722, /* U+0013BD */ + 723, /* U+0013BE */ + 724, /* U+0013BF */ + 725, /* U+0013C0 */ + 726, /* U+0013C1 */ + 727, /* U+0013C2 */ + 728, /* U+0013C3 */ + 729, /* U+0013C4 */ + 730, /* U+0013C5 */ + 731, /* U+0013C6 */ + 732, /* U+0013C7 */ + 733, /* U+0013C8 */ + 734, /* U+0013C9 */ + 735, /* U+0013CA */ + 736, /* U+0013CB */ + 737, /* U+0013CC */ + 738, /* U+0013CD */ + 739, /* U+0013CE */ + 740, /* U+0013CF */ + 741, /* U+0013D0 */ + 742, /* U+0013D1 */ + 743, /* U+0013D2 */ + 744, /* U+0013D3 */ + 745, /* U+0013D4 */ + 746, /* U+0013D5 */ + 747, /* U+0013D6 */ + 748, /* U+0013D7 */ + 749, /* U+0013D8 */ + 750, /* U+0013D9 */ + 751, /* U+0013DA */ + 752, /* U+0013DB */ + 753, /* U+0013DC */ + 754, /* U+0013DD */ + 755, /* U+0013DE */ + 756, /* U+0013DF */ + 757, /* U+0013E0 */ + 758, /* U+0013E1 */ + 759, /* U+0013E2 */ + 760, /* U+0013E3 */ + 761, /* U+0013E4 */ + 762, /* U+0013E5 */ + 763, /* U+0013E6 */ + 764, /* U+0013E7 */ + 765, /* U+0013E8 */ + 766, /* U+0013E9 */ + 767, /* U+0013EA */ + 768, /* U+0013EB */ + 769, /* U+0013EC */ + 770, /* U+0013ED */ + 771, /* U+0013EE */ + 772, /* U+0013EF */ + 773, /* U+0013F0 */ + 774, /* U+0013F1 */ + 775, /* U+0013F2 */ + 776, /* U+0013F3 */ + 777, /* U+0013F4 */ + 778, /* U+0013F5 */ + 0, /* U+0013F6 */ + 0, /* U+0013F7 */ + 773, /* U+0013F8 */ + 774, /* U+0013F9 */ + 775, /* U+0013FA */ + 776, /* U+0013FB */ + 777, /* U+0013FC */ + 778, /* U+0013FD */ + 779, /* U+001C80 */ + 780, /* U+001C81 */ + 781, /* U+001C82 */ + 782, /* U+001C83 */ + 783, /* U+001C84 */ + 784, /* U+001C85 */ + 785, /* U+001C86 */ + 786, /* U+001C87 */ + 787, /* U+001C88 */ + 788, /* U+001C89 */ + 788, /* U+001C8A */ + 0, /* U+001C8B */ + 0, /* U+001C8C */ + 0, /* U+001C8D */ + 0, /* U+001C8E */ + 0, /* U+001C8F */ + 789, /* U+001C90 */ + 790, /* U+001C91 */ + 791, /* U+001C92 */ + 792, /* U+001C93 */ + 793, /* U+001C94 */ + 794, /* U+001C95 */ + 795, /* U+001C96 */ + 796, /* U+001C97 */ + 797, /* U+001C98 */ + 798, /* U+001C99 */ + 799, /* U+001C9A */ + 800, /* U+001C9B */ + 801, /* U+001C9C */ + 802, /* U+001C9D */ + 803, /* U+001C9E */ + 804, /* U+001C9F */ + 805, /* U+001CA0 */ + 806, /* U+001CA1 */ + 807, /* U+001CA2 */ + 808, /* U+001CA3 */ + 809, /* U+001CA4 */ + 810, /* U+001CA5 */ + 811, /* U+001CA6 */ + 812, /* U+001CA7 */ + 813, /* U+001CA8 */ + 814, /* U+001CA9 */ + 815, /* U+001CAA */ + 816, /* U+001CAB */ + 817, /* U+001CAC */ + 818, /* U+001CAD */ + 819, /* U+001CAE */ + 820, /* U+001CAF */ + 821, /* U+001CB0 */ + 822, /* U+001CB1 */ + 823, /* U+001CB2 */ + 824, /* U+001CB3 */ + 825, /* U+001CB4 */ + 826, /* U+001CB5 */ + 827, /* U+001CB6 */ + 828, /* U+001CB7 */ + 829, /* U+001CB8 */ + 830, /* U+001CB9 */ + 831, /* U+001CBA */ + 0, /* U+001CBB */ + 0, /* U+001CBC */ + 832, /* U+001CBD */ + 833, /* U+001CBE */ + 834, /* U+001CBF */ + 0, /* U+001CC0 */ + 0, /* U+001CC1 */ + 0, /* U+001CC2 */ + 0, /* U+001CC3 */ + 0, /* U+001CC4 */ + 0, /* U+001CC5 */ + 0, /* U+001CC6 */ + 0, /* U+001CC7 */ + 0, /* U+001CC8 */ + 0, /* U+001CC9 */ + 0, /* U+001CCA */ + 0, /* U+001CCB */ + 0, /* U+001CCC */ + 0, /* U+001CCD */ + 0, /* U+001CCE */ + 0, /* U+001CCF */ + 0, /* U+001CD0 */ + 0, /* U+001CD1 */ + 0, /* U+001CD2 */ + 0, /* U+001CD3 */ + 0, /* U+001CD4 */ + 0, /* U+001CD5 */ + 0, /* U+001CD6 */ + 0, /* U+001CD7 */ + 0, /* U+001CD8 */ + 0, /* U+001CD9 */ + 0, /* U+001CDA */ + 0, /* U+001CDB */ + 0, /* U+001CDC */ + 0, /* U+001CDD */ + 0, /* U+001CDE */ + 0, /* U+001CDF */ + 0, /* U+001CE0 */ + 0, /* U+001CE1 */ + 0, /* U+001CE2 */ + 0, /* U+001CE3 */ + 0, /* U+001CE4 */ + 0, /* U+001CE5 */ + 0, /* U+001CE6 */ + 0, /* U+001CE7 */ + 0, /* U+001CE8 */ + 0, /* U+001CE9 */ + 0, /* U+001CEA */ + 0, /* U+001CEB */ + 0, /* U+001CEC */ + 0, /* U+001CED */ + 0, /* U+001CEE */ + 0, /* U+001CEF */ + 0, /* U+001CF0 */ + 0, /* U+001CF1 */ + 0, /* U+001CF2 */ + 0, /* U+001CF3 */ + 0, /* U+001CF4 */ + 0, /* U+001CF5 */ + 0, /* U+001CF6 */ + 0, /* U+001CF7 */ + 0, /* U+001CF8 */ + 0, /* U+001CF9 */ + 0, /* U+001CFA */ + 0, /* U+001CFB */ + 0, /* U+001CFC */ + 0, /* U+001CFD */ + 0, /* U+001CFE */ + 0, /* U+001CFF */ + 0, /* U+001D00 */ + 0, /* U+001D01 */ + 0, /* U+001D02 */ + 0, /* U+001D03 */ + 0, /* U+001D04 */ + 0, /* U+001D05 */ + 0, /* U+001D06 */ + 0, /* U+001D07 */ + 0, /* U+001D08 */ + 0, /* U+001D09 */ + 0, /* U+001D0A */ + 0, /* U+001D0B */ + 0, /* U+001D0C */ + 0, /* U+001D0D */ + 0, /* U+001D0E */ + 0, /* U+001D0F */ + 0, /* U+001D10 */ + 0, /* U+001D11 */ + 0, /* U+001D12 */ + 0, /* U+001D13 */ + 0, /* U+001D14 */ + 0, /* U+001D15 */ + 0, /* U+001D16 */ + 0, /* U+001D17 */ + 0, /* U+001D18 */ + 0, /* U+001D19 */ + 0, /* U+001D1A */ + 0, /* U+001D1B */ + 0, /* U+001D1C */ + 0, /* U+001D1D */ + 0, /* U+001D1E */ + 0, /* U+001D1F */ + 0, /* U+001D20 */ + 0, /* U+001D21 */ + 0, /* U+001D22 */ + 0, /* U+001D23 */ + 0, /* U+001D24 */ + 0, /* U+001D25 */ + 0, /* U+001D26 */ + 0, /* U+001D27 */ + 0, /* U+001D28 */ + 0, /* U+001D29 */ + 0, /* U+001D2A */ + 0, /* U+001D2B */ + 0, /* U+001D2C */ + 0, /* U+001D2D */ + 0, /* U+001D2E */ + 0, /* U+001D2F */ + 0, /* U+001D30 */ + 0, /* U+001D31 */ + 0, /* U+001D32 */ + 0, /* U+001D33 */ + 0, /* U+001D34 */ + 0, /* U+001D35 */ + 0, /* U+001D36 */ + 0, /* U+001D37 */ + 0, /* U+001D38 */ + 0, /* U+001D39 */ + 0, /* U+001D3A */ + 0, /* U+001D3B */ + 0, /* U+001D3C */ + 0, /* U+001D3D */ + 0, /* U+001D3E */ + 0, /* U+001D3F */ + 0, /* U+001D40 */ + 0, /* U+001D41 */ + 0, /* U+001D42 */ + 0, /* U+001D43 */ + 0, /* U+001D44 */ + 0, /* U+001D45 */ + 0, /* U+001D46 */ + 0, /* U+001D47 */ + 0, /* U+001D48 */ + 0, /* U+001D49 */ + 0, /* U+001D4A */ + 0, /* U+001D4B */ + 0, /* U+001D4C */ + 0, /* U+001D4D */ + 0, /* U+001D4E */ + 0, /* U+001D4F */ + 0, /* U+001D50 */ + 0, /* U+001D51 */ + 0, /* U+001D52 */ + 0, /* U+001D53 */ + 0, /* U+001D54 */ + 0, /* U+001D55 */ + 0, /* U+001D56 */ + 0, /* U+001D57 */ + 0, /* U+001D58 */ + 0, /* U+001D59 */ + 0, /* U+001D5A */ + 0, /* U+001D5B */ + 0, /* U+001D5C */ + 0, /* U+001D5D */ + 0, /* U+001D5E */ + 0, /* U+001D5F */ + 0, /* U+001D60 */ + 0, /* U+001D61 */ + 0, /* U+001D62 */ + 0, /* U+001D63 */ + 0, /* U+001D64 */ + 0, /* U+001D65 */ + 0, /* U+001D66 */ + 0, /* U+001D67 */ + 0, /* U+001D68 */ + 0, /* U+001D69 */ + 0, /* U+001D6A */ + 0, /* U+001D6B */ + 0, /* U+001D6C */ + 0, /* U+001D6D */ + 0, /* U+001D6E */ + 0, /* U+001D6F */ + 0, /* U+001D70 */ + 0, /* U+001D71 */ + 0, /* U+001D72 */ + 0, /* U+001D73 */ + 0, /* U+001D74 */ + 0, /* U+001D75 */ + 0, /* U+001D76 */ + 0, /* U+001D77 */ + 0, /* U+001D78 */ + 835, /* U+001D79 */ + 0, /* U+001D7A */ + 0, /* U+001D7B */ + 0, /* U+001D7C */ + 836, /* U+001D7D */ + 0, /* U+001D7E */ + 0, /* U+001D7F */ + 0, /* U+001D80 */ + 0, /* U+001D81 */ + 0, /* U+001D82 */ + 0, /* U+001D83 */ + 0, /* U+001D84 */ + 0, /* U+001D85 */ + 0, /* U+001D86 */ + 0, /* U+001D87 */ + 0, /* U+001D88 */ + 0, /* U+001D89 */ + 0, /* U+001D8A */ + 0, /* U+001D8B */ + 0, /* U+001D8C */ + 0, /* U+001D8D */ + 837, /* U+001D8E */ + 0, /* U+001D8F */ + 0, /* U+001D90 */ + 0, /* U+001D91 */ + 0, /* U+001D92 */ + 0, /* U+001D93 */ + 0, /* U+001D94 */ + 0, /* U+001D95 */ + 0, /* U+001D96 */ + 0, /* U+001D97 */ + 0, /* U+001D98 */ + 0, /* U+001D99 */ + 0, /* U+001D9A */ + 0, /* U+001D9B */ + 0, /* U+001D9C */ + 0, /* U+001D9D */ + 0, /* U+001D9E */ + 0, /* U+001D9F */ + 0, /* U+001DA0 */ + 0, /* U+001DA1 */ + 0, /* U+001DA2 */ + 0, /* U+001DA3 */ + 0, /* U+001DA4 */ + 0, /* U+001DA5 */ + 0, /* U+001DA6 */ + 0, /* U+001DA7 */ + 0, /* U+001DA8 */ + 0, /* U+001DA9 */ + 0, /* U+001DAA */ + 0, /* U+001DAB */ + 0, /* U+001DAC */ + 0, /* U+001DAD */ + 0, /* U+001DAE */ + 0, /* U+001DAF */ + 0, /* U+001DB0 */ + 0, /* U+001DB1 */ + 0, /* U+001DB2 */ + 0, /* U+001DB3 */ + 0, /* U+001DB4 */ + 0, /* U+001DB5 */ + 0, /* U+001DB6 */ + 0, /* U+001DB7 */ + 0, /* U+001DB8 */ + 0, /* U+001DB9 */ + 0, /* U+001DBA */ + 0, /* U+001DBB */ + 0, /* U+001DBC */ + 0, /* U+001DBD */ + 0, /* U+001DBE */ + 0, /* U+001DBF */ + 0, /* U+001DC0 */ + 0, /* U+001DC1 */ + 0, /* U+001DC2 */ + 0, /* U+001DC3 */ + 0, /* U+001DC4 */ + 0, /* U+001DC5 */ + 0, /* U+001DC6 */ + 0, /* U+001DC7 */ + 0, /* U+001DC8 */ + 0, /* U+001DC9 */ + 0, /* U+001DCA */ + 0, /* U+001DCB */ + 0, /* U+001DCC */ + 0, /* U+001DCD */ + 0, /* U+001DCE */ + 0, /* U+001DCF */ + 0, /* U+001DD0 */ + 0, /* U+001DD1 */ + 0, /* U+001DD2 */ + 0, /* U+001DD3 */ + 0, /* U+001DD4 */ + 0, /* U+001DD5 */ + 0, /* U+001DD6 */ + 0, /* U+001DD7 */ + 0, /* U+001DD8 */ + 0, /* U+001DD9 */ + 0, /* U+001DDA */ + 0, /* U+001DDB */ + 0, /* U+001DDC */ + 0, /* U+001DDD */ + 0, /* U+001DDE */ + 0, /* U+001DDF */ + 0, /* U+001DE0 */ + 0, /* U+001DE1 */ + 0, /* U+001DE2 */ + 0, /* U+001DE3 */ + 0, /* U+001DE4 */ + 0, /* U+001DE5 */ + 0, /* U+001DE6 */ + 0, /* U+001DE7 */ + 0, /* U+001DE8 */ + 0, /* U+001DE9 */ + 0, /* U+001DEA */ + 0, /* U+001DEB */ + 0, /* U+001DEC */ + 0, /* U+001DED */ + 0, /* U+001DEE */ + 0, /* U+001DEF */ + 0, /* U+001DF0 */ + 0, /* U+001DF1 */ + 0, /* U+001DF2 */ + 0, /* U+001DF3 */ + 0, /* U+001DF4 */ + 0, /* U+001DF5 */ + 0, /* U+001DF6 */ + 0, /* U+001DF7 */ + 0, /* U+001DF8 */ + 0, /* U+001DF9 */ + 0, /* U+001DFA */ + 0, /* U+001DFB */ + 0, /* U+001DFC */ + 0, /* U+001DFD */ + 0, /* U+001DFE */ + 0, /* U+001DFF */ + 838, /* U+001E00 */ + 838, /* U+001E01 */ + 839, /* U+001E02 */ + 839, /* U+001E03 */ + 840, /* U+001E04 */ + 840, /* U+001E05 */ + 841, /* U+001E06 */ + 841, /* U+001E07 */ + 842, /* U+001E08 */ + 842, /* U+001E09 */ + 843, /* U+001E0A */ + 843, /* U+001E0B */ + 844, /* U+001E0C */ + 844, /* U+001E0D */ + 845, /* U+001E0E */ + 845, /* U+001E0F */ + 846, /* U+001E10 */ + 846, /* U+001E11 */ + 847, /* U+001E12 */ + 847, /* U+001E13 */ + 848, /* U+001E14 */ + 848, /* U+001E15 */ + 849, /* U+001E16 */ + 849, /* U+001E17 */ + 850, /* U+001E18 */ + 850, /* U+001E19 */ + 851, /* U+001E1A */ + 851, /* U+001E1B */ + 852, /* U+001E1C */ + 852, /* U+001E1D */ + 853, /* U+001E1E */ + 853, /* U+001E1F */ + 854, /* U+001E20 */ + 854, /* U+001E21 */ + 855, /* U+001E22 */ + 855, /* U+001E23 */ + 856, /* U+001E24 */ + 856, /* U+001E25 */ + 857, /* U+001E26 */ + 857, /* U+001E27 */ + 858, /* U+001E28 */ + 858, /* U+001E29 */ + 859, /* U+001E2A */ + 859, /* U+001E2B */ + 860, /* U+001E2C */ + 860, /* U+001E2D */ + 861, /* U+001E2E */ + 861, /* U+001E2F */ + 862, /* U+001E30 */ + 862, /* U+001E31 */ + 863, /* U+001E32 */ + 863, /* U+001E33 */ + 864, /* U+001E34 */ + 864, /* U+001E35 */ + 865, /* U+001E36 */ + 865, /* U+001E37 */ + 866, /* U+001E38 */ + 866, /* U+001E39 */ + 867, /* U+001E3A */ + 867, /* U+001E3B */ + 868, /* U+001E3C */ + 868, /* U+001E3D */ + 869, /* U+001E3E */ + 869, /* U+001E3F */ + 870, /* U+001E40 */ + 870, /* U+001E41 */ + 871, /* U+001E42 */ + 871, /* U+001E43 */ + 872, /* U+001E44 */ + 872, /* U+001E45 */ + 873, /* U+001E46 */ + 873, /* U+001E47 */ + 874, /* U+001E48 */ + 874, /* U+001E49 */ + 875, /* U+001E4A */ + 875, /* U+001E4B */ + 876, /* U+001E4C */ + 876, /* U+001E4D */ + 877, /* U+001E4E */ + 877, /* U+001E4F */ + 878, /* U+001E50 */ + 878, /* U+001E51 */ + 879, /* U+001E52 */ + 879, /* U+001E53 */ + 880, /* U+001E54 */ + 880, /* U+001E55 */ + 881, /* U+001E56 */ + 881, /* U+001E57 */ + 882, /* U+001E58 */ + 882, /* U+001E59 */ + 883, /* U+001E5A */ + 883, /* U+001E5B */ + 884, /* U+001E5C */ + 884, /* U+001E5D */ + 885, /* U+001E5E */ + 885, /* U+001E5F */ + 886, /* U+001E60 */ + 886, /* U+001E61 */ + 887, /* U+001E62 */ + 887, /* U+001E63 */ + 888, /* U+001E64 */ + 888, /* U+001E65 */ + 889, /* U+001E66 */ + 889, /* U+001E67 */ + 890, /* U+001E68 */ + 890, /* U+001E69 */ + 891, /* U+001E6A */ + 891, /* U+001E6B */ + 892, /* U+001E6C */ + 892, /* U+001E6D */ + 893, /* U+001E6E */ + 893, /* U+001E6F */ + 894, /* U+001E70 */ + 894, /* U+001E71 */ + 895, /* U+001E72 */ + 895, /* U+001E73 */ + 896, /* U+001E74 */ + 896, /* U+001E75 */ + 897, /* U+001E76 */ + 897, /* U+001E77 */ + 898, /* U+001E78 */ + 898, /* U+001E79 */ + 899, /* U+001E7A */ + 899, /* U+001E7B */ + 900, /* U+001E7C */ + 900, /* U+001E7D */ + 901, /* U+001E7E */ + 901, /* U+001E7F */ + 902, /* U+001E80 */ + 902, /* U+001E81 */ + 903, /* U+001E82 */ + 903, /* U+001E83 */ + 904, /* U+001E84 */ + 904, /* U+001E85 */ + 905, /* U+001E86 */ + 905, /* U+001E87 */ + 906, /* U+001E88 */ + 906, /* U+001E89 */ + 907, /* U+001E8A */ + 907, /* U+001E8B */ + 908, /* U+001E8C */ + 908, /* U+001E8D */ + 909, /* U+001E8E */ + 909, /* U+001E8F */ + 910, /* U+001E90 */ + 910, /* U+001E91 */ + 911, /* U+001E92 */ + 911, /* U+001E93 */ + 912, /* U+001E94 */ + 912, /* U+001E95 */ + 913, /* U+001E96 */ + 914, /* U+001E97 */ + 915, /* U+001E98 */ + 916, /* U+001E99 */ + 917, /* U+001E9A */ + 918, /* U+001E9B */ + 0, /* U+001E9C */ + 0, /* U+001E9D */ + 919, /* U+001E9E */ + 0, /* U+001E9F */ + 920, /* U+001EA0 */ + 920, /* U+001EA1 */ + 921, /* U+001EA2 */ + 921, /* U+001EA3 */ + 922, /* U+001EA4 */ + 922, /* U+001EA5 */ + 923, /* U+001EA6 */ + 923, /* U+001EA7 */ + 924, /* U+001EA8 */ + 924, /* U+001EA9 */ + 925, /* U+001EAA */ + 925, /* U+001EAB */ + 926, /* U+001EAC */ + 926, /* U+001EAD */ + 927, /* U+001EAE */ + 927, /* U+001EAF */ + 928, /* U+001EB0 */ + 928, /* U+001EB1 */ + 929, /* U+001EB2 */ + 929, /* U+001EB3 */ + 930, /* U+001EB4 */ + 930, /* U+001EB5 */ + 931, /* U+001EB6 */ + 931, /* U+001EB7 */ + 932, /* U+001EB8 */ + 932, /* U+001EB9 */ + 933, /* U+001EBA */ + 933, /* U+001EBB */ + 934, /* U+001EBC */ + 934, /* U+001EBD */ + 935, /* U+001EBE */ + 935, /* U+001EBF */ + 936, /* U+001EC0 */ + 936, /* U+001EC1 */ + 937, /* U+001EC2 */ + 937, /* U+001EC3 */ + 938, /* U+001EC4 */ + 938, /* U+001EC5 */ + 939, /* U+001EC6 */ + 939, /* U+001EC7 */ + 940, /* U+001EC8 */ + 940, /* U+001EC9 */ + 941, /* U+001ECA */ + 941, /* U+001ECB */ + 942, /* U+001ECC */ + 942, /* U+001ECD */ + 943, /* U+001ECE */ + 943, /* U+001ECF */ + 944, /* U+001ED0 */ + 944, /* U+001ED1 */ + 945, /* U+001ED2 */ + 945, /* U+001ED3 */ + 946, /* U+001ED4 */ + 946, /* U+001ED5 */ + 947, /* U+001ED6 */ + 947, /* U+001ED7 */ + 948, /* U+001ED8 */ + 948, /* U+001ED9 */ + 949, /* U+001EDA */ + 949, /* U+001EDB */ + 950, /* U+001EDC */ + 950, /* U+001EDD */ + 951, /* U+001EDE */ + 951, /* U+001EDF */ + 952, /* U+001EE0 */ + 952, /* U+001EE1 */ + 953, /* U+001EE2 */ + 953, /* U+001EE3 */ + 954, /* U+001EE4 */ + 954, /* U+001EE5 */ + 955, /* U+001EE6 */ + 955, /* U+001EE7 */ + 956, /* U+001EE8 */ + 956, /* U+001EE9 */ + 957, /* U+001EEA */ + 957, /* U+001EEB */ + 958, /* U+001EEC */ + 958, /* U+001EED */ + 959, /* U+001EEE */ + 959, /* U+001EEF */ + 960, /* U+001EF0 */ + 960, /* U+001EF1 */ + 961, /* U+001EF2 */ + 961, /* U+001EF3 */ + 962, /* U+001EF4 */ + 962, /* U+001EF5 */ + 963, /* U+001EF6 */ + 963, /* U+001EF7 */ + 964, /* U+001EF8 */ + 964, /* U+001EF9 */ + 965, /* U+001EFA */ + 965, /* U+001EFB */ + 966, /* U+001EFC */ + 966, /* U+001EFD */ + 967, /* U+001EFE */ + 967, /* U+001EFF */ + 968, /* U+001F00 */ + 969, /* U+001F01 */ + 970, /* U+001F02 */ + 971, /* U+001F03 */ + 972, /* U+001F04 */ + 973, /* U+001F05 */ + 974, /* U+001F06 */ + 975, /* U+001F07 */ + 968, /* U+001F08 */ + 969, /* U+001F09 */ + 970, /* U+001F0A */ + 971, /* U+001F0B */ + 972, /* U+001F0C */ + 973, /* U+001F0D */ + 974, /* U+001F0E */ + 975, /* U+001F0F */ + 976, /* U+001F10 */ + 977, /* U+001F11 */ + 978, /* U+001F12 */ + 979, /* U+001F13 */ + 980, /* U+001F14 */ + 981, /* U+001F15 */ + 0, /* U+001F16 */ + 0, /* U+001F17 */ + 976, /* U+001F18 */ + 977, /* U+001F19 */ + 978, /* U+001F1A */ + 979, /* U+001F1B */ + 980, /* U+001F1C */ + 981, /* U+001F1D */ + 0, /* U+001F1E */ + 0, /* U+001F1F */ + 982, /* U+001F20 */ + 983, /* U+001F21 */ + 984, /* U+001F22 */ + 985, /* U+001F23 */ + 986, /* U+001F24 */ + 987, /* U+001F25 */ + 988, /* U+001F26 */ + 989, /* U+001F27 */ + 982, /* U+001F28 */ + 983, /* U+001F29 */ + 984, /* U+001F2A */ + 985, /* U+001F2B */ + 986, /* U+001F2C */ + 987, /* U+001F2D */ + 988, /* U+001F2E */ + 989, /* U+001F2F */ + 990, /* U+001F30 */ + 991, /* U+001F31 */ + 992, /* U+001F32 */ + 993, /* U+001F33 */ + 994, /* U+001F34 */ + 995, /* U+001F35 */ + 996, /* U+001F36 */ + 997, /* U+001F37 */ + 990, /* U+001F38 */ + 991, /* U+001F39 */ + 992, /* U+001F3A */ + 993, /* U+001F3B */ + 994, /* U+001F3C */ + 995, /* U+001F3D */ + 996, /* U+001F3E */ + 997, /* U+001F3F */ + 998, /* U+001F40 */ + 999, /* U+001F41 */ + 1000, /* U+001F42 */ + 1001, /* U+001F43 */ + 1002, /* U+001F44 */ + 1003, /* U+001F45 */ + 0, /* U+001F46 */ + 0, /* U+001F47 */ + 998, /* U+001F48 */ + 999, /* U+001F49 */ + 1000, /* U+001F4A */ + 1001, /* U+001F4B */ + 1002, /* U+001F4C */ + 1003, /* U+001F4D */ + 0, /* U+001F4E */ + 0, /* U+001F4F */ + 1004, /* U+001F50 */ + 1005, /* U+001F51 */ + 1006, /* U+001F52 */ + 1007, /* U+001F53 */ + 1008, /* U+001F54 */ + 1009, /* U+001F55 */ + 1010, /* U+001F56 */ + 1011, /* U+001F57 */ + 0, /* U+001F58 */ + 1005, /* U+001F59 */ + 0, /* U+001F5A */ + 1007, /* U+001F5B */ + 0, /* U+001F5C */ + 1009, /* U+001F5D */ + 0, /* U+001F5E */ + 1011, /* U+001F5F */ + 1012, /* U+001F60 */ + 1013, /* U+001F61 */ + 1014, /* U+001F62 */ + 1015, /* U+001F63 */ + 1016, /* U+001F64 */ + 1017, /* U+001F65 */ + 1018, /* U+001F66 */ + 1019, /* U+001F67 */ + 1012, /* U+001F68 */ + 1013, /* U+001F69 */ + 1014, /* U+001F6A */ + 1015, /* U+001F6B */ + 1016, /* U+001F6C */ + 1017, /* U+001F6D */ + 1018, /* U+001F6E */ + 1019, /* U+001F6F */ + 1020, /* U+001F70 */ + 1021, /* U+001F71 */ + 1022, /* U+001F72 */ + 1023, /* U+001F73 */ + 1024, /* U+001F74 */ + 1025, /* U+001F75 */ + 1026, /* U+001F76 */ + 1027, /* U+001F77 */ + 1028, /* U+001F78 */ + 1029, /* U+001F79 */ + 1030, /* U+001F7A */ + 1031, /* U+001F7B */ + 1032, /* U+001F7C */ + 1033, /* U+001F7D */ + 0, /* U+001F7E */ + 0, /* U+001F7F */ + 1034, /* U+001F80 */ + 1035, /* U+001F81 */ + 1036, /* U+001F82 */ + 1037, /* U+001F83 */ + 1038, /* U+001F84 */ + 1039, /* U+001F85 */ + 1040, /* U+001F86 */ + 1041, /* U+001F87 */ + 1042, /* U+001F88 */ + 1043, /* U+001F89 */ + 1044, /* U+001F8A */ + 1045, /* U+001F8B */ + 1046, /* U+001F8C */ + 1047, /* U+001F8D */ + 1048, /* U+001F8E */ + 1049, /* U+001F8F */ + 1050, /* U+001F90 */ + 1051, /* U+001F91 */ + 1052, /* U+001F92 */ + 1053, /* U+001F93 */ + 1054, /* U+001F94 */ + 1055, /* U+001F95 */ + 1056, /* U+001F96 */ + 1057, /* U+001F97 */ + 1058, /* U+001F98 */ + 1059, /* U+001F99 */ + 1060, /* U+001F9A */ + 1061, /* U+001F9B */ + 1062, /* U+001F9C */ + 1063, /* U+001F9D */ + 1064, /* U+001F9E */ + 1065, /* U+001F9F */ + 1066, /* U+001FA0 */ + 1067, /* U+001FA1 */ + 1068, /* U+001FA2 */ + 1069, /* U+001FA3 */ + 1070, /* U+001FA4 */ + 1071, /* U+001FA5 */ + 1072, /* U+001FA6 */ + 1073, /* U+001FA7 */ + 1074, /* U+001FA8 */ + 1075, /* U+001FA9 */ + 1076, /* U+001FAA */ + 1077, /* U+001FAB */ + 1078, /* U+001FAC */ + 1079, /* U+001FAD */ + 1080, /* U+001FAE */ + 1081, /* U+001FAF */ + 1082, /* U+001FB0 */ + 1083, /* U+001FB1 */ + 1084, /* U+001FB2 */ + 1085, /* U+001FB3 */ + 1086, /* U+001FB4 */ + 0, /* U+001FB5 */ + 1087, /* U+001FB6 */ + 1088, /* U+001FB7 */ + 1082, /* U+001FB8 */ + 1083, /* U+001FB9 */ + 1020, /* U+001FBA */ + 1021, /* U+001FBB */ + 1089, /* U+001FBC */ + 0, /* U+001FBD */ + 1090, /* U+001FBE */ + 0, /* U+001FBF */ + 0, /* U+001FC0 */ + 0, /* U+001FC1 */ + 1091, /* U+001FC2 */ + 1092, /* U+001FC3 */ + 1093, /* U+001FC4 */ + 0, /* U+001FC5 */ + 1094, /* U+001FC6 */ + 1095, /* U+001FC7 */ + 1022, /* U+001FC8 */ + 1023, /* U+001FC9 */ + 1024, /* U+001FCA */ + 1025, /* U+001FCB */ + 1096, /* U+001FCC */ + 0, /* U+001FCD */ + 0, /* U+001FCE */ + 0, /* U+001FCF */ + 1097, /* U+001FD0 */ + 1098, /* U+001FD1 */ + 1099, /* U+001FD2 */ + 1100, /* U+001FD3 */ + 0, /* U+001FD4 */ + 0, /* U+001FD5 */ + 1101, /* U+001FD6 */ + 1102, /* U+001FD7 */ + 1097, /* U+001FD8 */ + 1098, /* U+001FD9 */ + 1026, /* U+001FDA */ + 1027, /* U+001FDB */ + 0, /* U+001FDC */ + 0, /* U+001FDD */ + 0, /* U+001FDE */ + 0, /* U+001FDF */ + 1103, /* U+001FE0 */ + 1104, /* U+001FE1 */ + 1105, /* U+001FE2 */ + 1106, /* U+001FE3 */ + 1107, /* U+001FE4 */ + 1108, /* U+001FE5 */ + 1109, /* U+001FE6 */ + 1110, /* U+001FE7 */ + 1103, /* U+001FE8 */ + 1104, /* U+001FE9 */ + 1030, /* U+001FEA */ + 1031, /* U+001FEB */ + 1108, /* U+001FEC */ + 0, /* U+001FED */ + 0, /* U+001FEE */ + 0, /* U+001FEF */ + 0, /* U+001FF0 */ + 0, /* U+001FF1 */ + 1111, /* U+001FF2 */ + 1112, /* U+001FF3 */ + 1113, /* U+001FF4 */ + 0, /* U+001FF5 */ + 1114, /* U+001FF6 */ + 1115, /* U+001FF7 */ + 1028, /* U+001FF8 */ + 1029, /* U+001FF9 */ + 1032, /* U+001FFA */ + 1033, /* U+001FFB */ + 1116, /* U+001FFC */ + 0, /* U+001FFD */ + 0, /* U+001FFE */ + 0, /* U+001FFF */ + 0, /* U+002000 */ + 0, /* U+002001 */ + 0, /* U+002002 */ + 0, /* U+002003 */ + 0, /* U+002004 */ + 0, /* U+002005 */ + 0, /* U+002006 */ + 0, /* U+002007 */ + 0, /* U+002008 */ + 0, /* U+002009 */ + 0, /* U+00200A */ + 0, /* U+00200B */ + 0, /* U+00200C */ + 0, /* U+00200D */ + 0, /* U+00200E */ + 0, /* U+00200F */ + 0, /* U+002010 */ + 0, /* U+002011 */ + 0, /* U+002012 */ + 0, /* U+002013 */ + 0, /* U+002014 */ + 0, /* U+002015 */ + 0, /* U+002016 */ + 0, /* U+002017 */ + 0, /* U+002018 */ + 0, /* U+002019 */ + 0, /* U+00201A */ + 0, /* U+00201B */ + 0, /* U+00201C */ + 0, /* U+00201D */ + 0, /* U+00201E */ + 0, /* U+00201F */ + 0, /* U+002020 */ + 0, /* U+002021 */ + 0, /* U+002022 */ + 0, /* U+002023 */ + 0, /* U+002024 */ + 0, /* U+002025 */ + 0, /* U+002026 */ + 0, /* U+002027 */ + 0, /* U+002028 */ + 0, /* U+002029 */ + 0, /* U+00202A */ + 0, /* U+00202B */ + 0, /* U+00202C */ + 0, /* U+00202D */ + 0, /* U+00202E */ + 0, /* U+00202F */ + 0, /* U+002030 */ + 0, /* U+002031 */ + 0, /* U+002032 */ + 0, /* U+002033 */ + 0, /* U+002034 */ + 0, /* U+002035 */ + 0, /* U+002036 */ + 0, /* U+002037 */ + 0, /* U+002038 */ + 0, /* U+002039 */ + 0, /* U+00203A */ + 0, /* U+00203B */ + 0, /* U+00203C */ + 0, /* U+00203D */ + 0, /* U+00203E */ + 0, /* U+00203F */ + 0, /* U+002040 */ + 0, /* U+002041 */ + 0, /* U+002042 */ + 0, /* U+002043 */ + 0, /* U+002044 */ + 0, /* U+002045 */ + 0, /* U+002046 */ + 0, /* U+002047 */ + 0, /* U+002048 */ + 0, /* U+002049 */ + 0, /* U+00204A */ + 0, /* U+00204B */ + 0, /* U+00204C */ + 0, /* U+00204D */ + 0, /* U+00204E */ + 0, /* U+00204F */ + 0, /* U+002050 */ + 0, /* U+002051 */ + 0, /* U+002052 */ + 0, /* U+002053 */ + 0, /* U+002054 */ + 0, /* U+002055 */ + 0, /* U+002056 */ + 0, /* U+002057 */ + 0, /* U+002058 */ + 0, /* U+002059 */ + 0, /* U+00205A */ + 0, /* U+00205B */ + 0, /* U+00205C */ + 0, /* U+00205D */ + 0, /* U+00205E */ + 0, /* U+00205F */ + 0, /* U+002060 */ + 0, /* U+002061 */ + 0, /* U+002062 */ + 0, /* U+002063 */ + 0, /* U+002064 */ + 0, /* U+002065 */ + 0, /* U+002066 */ + 0, /* U+002067 */ + 0, /* U+002068 */ + 0, /* U+002069 */ + 0, /* U+00206A */ + 0, /* U+00206B */ + 0, /* U+00206C */ + 0, /* U+00206D */ + 0, /* U+00206E */ + 0, /* U+00206F */ + 0, /* U+002070 */ + 0, /* U+002071 */ + 0, /* U+002072 */ + 0, /* U+002073 */ + 0, /* U+002074 */ + 0, /* U+002075 */ + 0, /* U+002076 */ + 0, /* U+002077 */ + 0, /* U+002078 */ + 0, /* U+002079 */ + 0, /* U+00207A */ + 0, /* U+00207B */ + 0, /* U+00207C */ + 0, /* U+00207D */ + 0, /* U+00207E */ + 0, /* U+00207F */ + 0, /* U+002080 */ + 0, /* U+002081 */ + 0, /* U+002082 */ + 0, /* U+002083 */ + 0, /* U+002084 */ + 0, /* U+002085 */ + 0, /* U+002086 */ + 0, /* U+002087 */ + 0, /* U+002088 */ + 0, /* U+002089 */ + 0, /* U+00208A */ + 0, /* U+00208B */ + 0, /* U+00208C */ + 0, /* U+00208D */ + 0, /* U+00208E */ + 0, /* U+00208F */ + 0, /* U+002090 */ + 0, /* U+002091 */ + 0, /* U+002092 */ + 0, /* U+002093 */ + 0, /* U+002094 */ + 0, /* U+002095 */ + 0, /* U+002096 */ + 0, /* U+002097 */ + 0, /* U+002098 */ + 0, /* U+002099 */ + 0, /* U+00209A */ + 0, /* U+00209B */ + 0, /* U+00209C */ + 0, /* U+00209D */ + 0, /* U+00209E */ + 0, /* U+00209F */ + 0, /* U+0020A0 */ + 0, /* U+0020A1 */ + 0, /* U+0020A2 */ + 0, /* U+0020A3 */ + 0, /* U+0020A4 */ + 0, /* U+0020A5 */ + 0, /* U+0020A6 */ + 0, /* U+0020A7 */ + 0, /* U+0020A8 */ + 0, /* U+0020A9 */ + 0, /* U+0020AA */ + 0, /* U+0020AB */ + 0, /* U+0020AC */ + 0, /* U+0020AD */ + 0, /* U+0020AE */ + 0, /* U+0020AF */ + 0, /* U+0020B0 */ + 0, /* U+0020B1 */ + 0, /* U+0020B2 */ + 0, /* U+0020B3 */ + 0, /* U+0020B4 */ + 0, /* U+0020B5 */ + 0, /* U+0020B6 */ + 0, /* U+0020B7 */ + 0, /* U+0020B8 */ + 0, /* U+0020B9 */ + 0, /* U+0020BA */ + 0, /* U+0020BB */ + 0, /* U+0020BC */ + 0, /* U+0020BD */ + 0, /* U+0020BE */ + 0, /* U+0020BF */ + 0, /* U+0020C0 */ + 0, /* U+0020C1 */ + 0, /* U+0020C2 */ + 0, /* U+0020C3 */ + 0, /* U+0020C4 */ + 0, /* U+0020C5 */ + 0, /* U+0020C6 */ + 0, /* U+0020C7 */ + 0, /* U+0020C8 */ + 0, /* U+0020C9 */ + 0, /* U+0020CA */ + 0, /* U+0020CB */ + 0, /* U+0020CC */ + 0, /* U+0020CD */ + 0, /* U+0020CE */ + 0, /* U+0020CF */ + 0, /* U+0020D0 */ + 0, /* U+0020D1 */ + 0, /* U+0020D2 */ + 0, /* U+0020D3 */ + 0, /* U+0020D4 */ + 0, /* U+0020D5 */ + 0, /* U+0020D6 */ + 0, /* U+0020D7 */ + 0, /* U+0020D8 */ + 0, /* U+0020D9 */ + 0, /* U+0020DA */ + 0, /* U+0020DB */ + 0, /* U+0020DC */ + 0, /* U+0020DD */ + 0, /* U+0020DE */ + 0, /* U+0020DF */ + 0, /* U+0020E0 */ + 0, /* U+0020E1 */ + 0, /* U+0020E2 */ + 0, /* U+0020E3 */ + 0, /* U+0020E4 */ + 0, /* U+0020E5 */ + 0, /* U+0020E6 */ + 0, /* U+0020E7 */ + 0, /* U+0020E8 */ + 0, /* U+0020E9 */ + 0, /* U+0020EA */ + 0, /* U+0020EB */ + 0, /* U+0020EC */ + 0, /* U+0020ED */ + 0, /* U+0020EE */ + 0, /* U+0020EF */ + 0, /* U+0020F0 */ + 0, /* U+0020F1 */ + 0, /* U+0020F2 */ + 0, /* U+0020F3 */ + 0, /* U+0020F4 */ + 0, /* U+0020F5 */ + 0, /* U+0020F6 */ + 0, /* U+0020F7 */ + 0, /* U+0020F8 */ + 0, /* U+0020F9 */ + 0, /* U+0020FA */ + 0, /* U+0020FB */ + 0, /* U+0020FC */ + 0, /* U+0020FD */ + 0, /* U+0020FE */ + 0, /* U+0020FF */ + 0, /* U+002100 */ + 0, /* U+002101 */ + 0, /* U+002102 */ + 0, /* U+002103 */ + 0, /* U+002104 */ + 0, /* U+002105 */ + 0, /* U+002106 */ + 0, /* U+002107 */ + 0, /* U+002108 */ + 0, /* U+002109 */ + 0, /* U+00210A */ + 0, /* U+00210B */ + 0, /* U+00210C */ + 0, /* U+00210D */ + 0, /* U+00210E */ + 0, /* U+00210F */ + 0, /* U+002110 */ + 0, /* U+002111 */ + 0, /* U+002112 */ + 0, /* U+002113 */ + 0, /* U+002114 */ + 0, /* U+002115 */ + 0, /* U+002116 */ + 0, /* U+002117 */ + 0, /* U+002118 */ + 0, /* U+002119 */ + 0, /* U+00211A */ + 0, /* U+00211B */ + 0, /* U+00211C */ + 0, /* U+00211D */ + 0, /* U+00211E */ + 0, /* U+00211F */ + 0, /* U+002120 */ + 0, /* U+002121 */ + 0, /* U+002122 */ + 0, /* U+002123 */ + 0, /* U+002124 */ + 0, /* U+002125 */ + 1117, /* U+002126 */ + 0, /* U+002127 */ + 0, /* U+002128 */ + 0, /* U+002129 */ + 1118, /* U+00212A */ + 1119, /* U+00212B */ + 0, /* U+00212C */ + 0, /* U+00212D */ + 0, /* U+00212E */ + 0, /* U+00212F */ + 0, /* U+002130 */ + 0, /* U+002131 */ + 1120, /* U+002132 */ + 0, /* U+002133 */ + 0, /* U+002134 */ + 0, /* U+002135 */ + 0, /* U+002136 */ + 0, /* U+002137 */ + 0, /* U+002138 */ + 0, /* U+002139 */ + 0, /* U+00213A */ + 0, /* U+00213B */ + 0, /* U+00213C */ + 0, /* U+00213D */ + 0, /* U+00213E */ + 0, /* U+00213F */ + 0, /* U+002140 */ + 0, /* U+002141 */ + 0, /* U+002142 */ + 0, /* U+002143 */ + 0, /* U+002144 */ + 0, /* U+002145 */ + 0, /* U+002146 */ + 0, /* U+002147 */ + 0, /* U+002148 */ + 0, /* U+002149 */ + 0, /* U+00214A */ + 0, /* U+00214B */ + 0, /* U+00214C */ + 0, /* U+00214D */ + 1120, /* U+00214E */ + 0, /* U+00214F */ + 0, /* U+002150 */ + 0, /* U+002151 */ + 0, /* U+002152 */ + 0, /* U+002153 */ + 0, /* U+002154 */ + 0, /* U+002155 */ + 0, /* U+002156 */ + 0, /* U+002157 */ + 0, /* U+002158 */ + 0, /* U+002159 */ + 0, /* U+00215A */ + 0, /* U+00215B */ + 0, /* U+00215C */ + 0, /* U+00215D */ + 0, /* U+00215E */ + 0, /* U+00215F */ + 1121, /* U+002160 */ + 1122, /* U+002161 */ + 1123, /* U+002162 */ + 1124, /* U+002163 */ + 1125, /* U+002164 */ + 1126, /* U+002165 */ + 1127, /* U+002166 */ + 1128, /* U+002167 */ + 1129, /* U+002168 */ + 1130, /* U+002169 */ + 1131, /* U+00216A */ + 1132, /* U+00216B */ + 1133, /* U+00216C */ + 1134, /* U+00216D */ + 1135, /* U+00216E */ + 1136, /* U+00216F */ + 1121, /* U+002170 */ + 1122, /* U+002171 */ + 1123, /* U+002172 */ + 1124, /* U+002173 */ + 1125, /* U+002174 */ + 1126, /* U+002175 */ + 1127, /* U+002176 */ + 1128, /* U+002177 */ + 1129, /* U+002178 */ + 1130, /* U+002179 */ + 1131, /* U+00217A */ + 1132, /* U+00217B */ + 1133, /* U+00217C */ + 1134, /* U+00217D */ + 1135, /* U+00217E */ + 1136, /* U+00217F */ + 0, /* U+002180 */ + 0, /* U+002181 */ + 0, /* U+002182 */ + 1137, /* U+002183 */ + 1137, /* U+002184 */ + 1138, /* U+0024B6 */ + 1139, /* U+0024B7 */ + 1140, /* U+0024B8 */ + 1141, /* U+0024B9 */ + 1142, /* U+0024BA */ + 1143, /* U+0024BB */ + 1144, /* U+0024BC */ + 1145, /* U+0024BD */ + 1146, /* U+0024BE */ + 1147, /* U+0024BF */ + 1148, /* U+0024C0 */ + 1149, /* U+0024C1 */ + 1150, /* U+0024C2 */ + 1151, /* U+0024C3 */ + 1152, /* U+0024C4 */ + 1153, /* U+0024C5 */ + 1154, /* U+0024C6 */ + 1155, /* U+0024C7 */ + 1156, /* U+0024C8 */ + 1157, /* U+0024C9 */ + 1158, /* U+0024CA */ + 1159, /* U+0024CB */ + 1160, /* U+0024CC */ + 1161, /* U+0024CD */ + 1162, /* U+0024CE */ + 1163, /* U+0024CF */ + 1138, /* U+0024D0 */ + 1139, /* U+0024D1 */ + 1140, /* U+0024D2 */ + 1141, /* U+0024D3 */ + 1142, /* U+0024D4 */ + 1143, /* U+0024D5 */ + 1144, /* U+0024D6 */ + 1145, /* U+0024D7 */ + 1146, /* U+0024D8 */ + 1147, /* U+0024D9 */ + 1148, /* U+0024DA */ + 1149, /* U+0024DB */ + 1150, /* U+0024DC */ + 1151, /* U+0024DD */ + 1152, /* U+0024DE */ + 1153, /* U+0024DF */ + 1154, /* U+0024E0 */ + 1155, /* U+0024E1 */ + 1156, /* U+0024E2 */ + 1157, /* U+0024E3 */ + 1158, /* U+0024E4 */ + 1159, /* U+0024E5 */ + 1160, /* U+0024E6 */ + 1161, /* U+0024E7 */ + 1162, /* U+0024E8 */ + 1163, /* U+0024E9 */ + 1164, /* U+002C00 */ + 1165, /* U+002C01 */ + 1166, /* U+002C02 */ + 1167, /* U+002C03 */ + 1168, /* U+002C04 */ + 1169, /* U+002C05 */ + 1170, /* U+002C06 */ + 1171, /* U+002C07 */ + 1172, /* U+002C08 */ + 1173, /* U+002C09 */ + 1174, /* U+002C0A */ + 1175, /* U+002C0B */ + 1176, /* U+002C0C */ + 1177, /* U+002C0D */ + 1178, /* U+002C0E */ + 1179, /* U+002C0F */ + 1180, /* U+002C10 */ + 1181, /* U+002C11 */ + 1182, /* U+002C12 */ + 1183, /* U+002C13 */ + 1184, /* U+002C14 */ + 1185, /* U+002C15 */ + 1186, /* U+002C16 */ + 1187, /* U+002C17 */ + 1188, /* U+002C18 */ + 1189, /* U+002C19 */ + 1190, /* U+002C1A */ + 1191, /* U+002C1B */ + 1192, /* U+002C1C */ + 1193, /* U+002C1D */ + 1194, /* U+002C1E */ + 1195, /* U+002C1F */ + 1196, /* U+002C20 */ + 1197, /* U+002C21 */ + 1198, /* U+002C22 */ + 1199, /* U+002C23 */ + 1200, /* U+002C24 */ + 1201, /* U+002C25 */ + 1202, /* U+002C26 */ + 1203, /* U+002C27 */ + 1204, /* U+002C28 */ + 1205, /* U+002C29 */ + 1206, /* U+002C2A */ + 1207, /* U+002C2B */ + 1208, /* U+002C2C */ + 1209, /* U+002C2D */ + 1210, /* U+002C2E */ + 1211, /* U+002C2F */ + 1164, /* U+002C30 */ + 1165, /* U+002C31 */ + 1166, /* U+002C32 */ + 1167, /* U+002C33 */ + 1168, /* U+002C34 */ + 1169, /* U+002C35 */ + 1170, /* U+002C36 */ + 1171, /* U+002C37 */ + 1172, /* U+002C38 */ + 1173, /* U+002C39 */ + 1174, /* U+002C3A */ + 1175, /* U+002C3B */ + 1176, /* U+002C3C */ + 1177, /* U+002C3D */ + 1178, /* U+002C3E */ + 1179, /* U+002C3F */ + 1180, /* U+002C40 */ + 1181, /* U+002C41 */ + 1182, /* U+002C42 */ + 1183, /* U+002C43 */ + 1184, /* U+002C44 */ + 1185, /* U+002C45 */ + 1186, /* U+002C46 */ + 1187, /* U+002C47 */ + 1188, /* U+002C48 */ + 1189, /* U+002C49 */ + 1190, /* U+002C4A */ + 1191, /* U+002C4B */ + 1192, /* U+002C4C */ + 1193, /* U+002C4D */ + 1194, /* U+002C4E */ + 1195, /* U+002C4F */ + 1196, /* U+002C50 */ + 1197, /* U+002C51 */ + 1198, /* U+002C52 */ + 1199, /* U+002C53 */ + 1200, /* U+002C54 */ + 1201, /* U+002C55 */ + 1202, /* U+002C56 */ + 1203, /* U+002C57 */ + 1204, /* U+002C58 */ + 1205, /* U+002C59 */ + 1206, /* U+002C5A */ + 1207, /* U+002C5B */ + 1208, /* U+002C5C */ + 1209, /* U+002C5D */ + 1210, /* U+002C5E */ + 1211, /* U+002C5F */ + 1212, /* U+002C60 */ + 1212, /* U+002C61 */ + 343, /* U+002C62 */ + 836, /* U+002C63 */ + 346, /* U+002C64 */ + 321, /* U+002C65 */ + 323, /* U+002C66 */ + 1213, /* U+002C67 */ + 1213, /* U+002C68 */ + 1214, /* U+002C69 */ + 1214, /* U+002C6A */ + 1215, /* U+002C6B */ + 1215, /* U+002C6C */ + 335, /* U+002C6D */ + 345, /* U+002C6E */ + 334, /* U+002C6F */ + 336, /* U+002C70 */ + 0, /* U+002C71 */ + 1216, /* U+002C72 */ + 1216, /* U+002C73 */ + 0, /* U+002C74 */ + 1217, /* U+002C75 */ + 1217, /* U+002C76 */ + 0, /* U+002C77 */ + 0, /* U+002C78 */ + 0, /* U+002C79 */ + 0, /* U+002C7A */ + 0, /* U+002C7B */ + 0, /* U+002C7C */ + 0, /* U+002C7D */ + 324, /* U+002C7E */ + 325, /* U+002C7F */ + 1218, /* U+002C80 */ + 1218, /* U+002C81 */ + 1219, /* U+002C82 */ + 1219, /* U+002C83 */ + 1220, /* U+002C84 */ + 1220, /* U+002C85 */ + 1221, /* U+002C86 */ + 1221, /* U+002C87 */ + 1222, /* U+002C88 */ + 1222, /* U+002C89 */ + 1223, /* U+002C8A */ + 1223, /* U+002C8B */ + 1224, /* U+002C8C */ + 1224, /* U+002C8D */ + 1225, /* U+002C8E */ + 1225, /* U+002C8F */ + 1226, /* U+002C90 */ + 1226, /* U+002C91 */ + 1227, /* U+002C92 */ + 1227, /* U+002C93 */ + 1228, /* U+002C94 */ + 1228, /* U+002C95 */ + 1229, /* U+002C96 */ + 1229, /* U+002C97 */ + 1230, /* U+002C98 */ + 1230, /* U+002C99 */ + 1231, /* U+002C9A */ + 1231, /* U+002C9B */ + 1232, /* U+002C9C */ + 1232, /* U+002C9D */ + 1233, /* U+002C9E */ + 1233, /* U+002C9F */ + 1234, /* U+002CA0 */ + 1234, /* U+002CA1 */ + 1235, /* U+002CA2 */ + 1235, /* U+002CA3 */ + 1236, /* U+002CA4 */ + 1236, /* U+002CA5 */ + 1237, /* U+002CA6 */ + 1237, /* U+002CA7 */ + 1238, /* U+002CA8 */ + 1238, /* U+002CA9 */ + 1239, /* U+002CAA */ + 1239, /* U+002CAB */ + 1240, /* U+002CAC */ + 1240, /* U+002CAD */ + 1241, /* U+002CAE */ + 1241, /* U+002CAF */ + 1242, /* U+002CB0 */ + 1242, /* U+002CB1 */ + 1243, /* U+002CB2 */ + 1243, /* U+002CB3 */ + 1244, /* U+002CB4 */ + 1244, /* U+002CB5 */ + 1245, /* U+002CB6 */ + 1245, /* U+002CB7 */ + 1246, /* U+002CB8 */ + 1246, /* U+002CB9 */ + 1247, /* U+002CBA */ + 1247, /* U+002CBB */ + 1248, /* U+002CBC */ + 1248, /* U+002CBD */ + 1249, /* U+002CBE */ + 1249, /* U+002CBF */ + 1250, /* U+002CC0 */ + 1250, /* U+002CC1 */ + 1251, /* U+002CC2 */ + 1251, /* U+002CC3 */ + 1252, /* U+002CC4 */ + 1252, /* U+002CC5 */ + 1253, /* U+002CC6 */ + 1253, /* U+002CC7 */ + 1254, /* U+002CC8 */ + 1254, /* U+002CC9 */ + 1255, /* U+002CCA */ + 1255, /* U+002CCB */ + 1256, /* U+002CCC */ + 1256, /* U+002CCD */ + 1257, /* U+002CCE */ + 1257, /* U+002CCF */ + 1258, /* U+002CD0 */ + 1258, /* U+002CD1 */ + 1259, /* U+002CD2 */ + 1259, /* U+002CD3 */ + 1260, /* U+002CD4 */ + 1260, /* U+002CD5 */ + 1261, /* U+002CD6 */ + 1261, /* U+002CD7 */ + 1262, /* U+002CD8 */ + 1262, /* U+002CD9 */ + 1263, /* U+002CDA */ + 1263, /* U+002CDB */ + 1264, /* U+002CDC */ + 1264, /* U+002CDD */ + 1265, /* U+002CDE */ + 1265, /* U+002CDF */ + 1266, /* U+002CE0 */ + 1266, /* U+002CE1 */ + 1267, /* U+002CE2 */ + 1267, /* U+002CE3 */ + 0, /* U+002CE4 */ + 0, /* U+002CE5 */ + 0, /* U+002CE6 */ + 0, /* U+002CE7 */ + 0, /* U+002CE8 */ + 0, /* U+002CE9 */ + 0, /* U+002CEA */ + 1268, /* U+002CEB */ + 1268, /* U+002CEC */ + 1269, /* U+002CED */ + 1269, /* U+002CEE */ + 0, /* U+002CEF */ + 0, /* U+002CF0 */ + 0, /* U+002CF1 */ + 1270, /* U+002CF2 */ + 1270, /* U+002CF3 */ + 0, /* U+002CF4 */ + 0, /* U+002CF5 */ + 0, /* U+002CF6 */ + 0, /* U+002CF7 */ + 0, /* U+002CF8 */ + 0, /* U+002CF9 */ + 0, /* U+002CFA */ + 0, /* U+002CFB */ + 0, /* U+002CFC */ + 0, /* U+002CFD */ + 0, /* U+002CFE */ + 0, /* U+002CFF */ + 607, /* U+002D00 */ + 608, /* U+002D01 */ + 609, /* U+002D02 */ + 610, /* U+002D03 */ + 611, /* U+002D04 */ + 612, /* U+002D05 */ + 613, /* U+002D06 */ + 614, /* U+002D07 */ + 615, /* U+002D08 */ + 616, /* U+002D09 */ + 617, /* U+002D0A */ + 618, /* U+002D0B */ + 619, /* U+002D0C */ + 620, /* U+002D0D */ + 621, /* U+002D0E */ + 622, /* U+002D0F */ + 623, /* U+002D10 */ + 624, /* U+002D11 */ + 625, /* U+002D12 */ + 626, /* U+002D13 */ + 627, /* U+002D14 */ + 628, /* U+002D15 */ + 629, /* U+002D16 */ + 630, /* U+002D17 */ + 631, /* U+002D18 */ + 632, /* U+002D19 */ + 633, /* U+002D1A */ + 634, /* U+002D1B */ + 635, /* U+002D1C */ + 636, /* U+002D1D */ + 637, /* U+002D1E */ + 638, /* U+002D1F */ + 639, /* U+002D20 */ + 640, /* U+002D21 */ + 641, /* U+002D22 */ + 642, /* U+002D23 */ + 643, /* U+002D24 */ + 644, /* U+002D25 */ + 0, /* U+002D26 */ + 645, /* U+002D27 */ + 0, /* U+002D28 */ + 0, /* U+002D29 */ + 0, /* U+002D2A */ + 0, /* U+002D2B */ + 0, /* U+002D2C */ + 646, /* U+002D2D */ + 1271, /* U+00A640 */ + 1271, /* U+00A641 */ + 1272, /* U+00A642 */ + 1272, /* U+00A643 */ + 1273, /* U+00A644 */ + 1273, /* U+00A645 */ + 1274, /* U+00A646 */ + 1274, /* U+00A647 */ + 1275, /* U+00A648 */ + 1275, /* U+00A649 */ + 1276, /* U+00A64A */ + 1276, /* U+00A64B */ + 1277, /* U+00A64C */ + 1277, /* U+00A64D */ + 1278, /* U+00A64E */ + 1278, /* U+00A64F */ + 1279, /* U+00A650 */ + 1279, /* U+00A651 */ + 1280, /* U+00A652 */ + 1280, /* U+00A653 */ + 1281, /* U+00A654 */ + 1281, /* U+00A655 */ + 1282, /* U+00A656 */ + 1282, /* U+00A657 */ + 1283, /* U+00A658 */ + 1283, /* U+00A659 */ + 1284, /* U+00A65A */ + 1284, /* U+00A65B */ + 1285, /* U+00A65C */ + 1285, /* U+00A65D */ + 1286, /* U+00A65E */ + 1286, /* U+00A65F */ + 1287, /* U+00A660 */ + 1287, /* U+00A661 */ + 1288, /* U+00A662 */ + 1288, /* U+00A663 */ + 1289, /* U+00A664 */ + 1289, /* U+00A665 */ + 1290, /* U+00A666 */ + 1290, /* U+00A667 */ + 1291, /* U+00A668 */ + 1291, /* U+00A669 */ + 1292, /* U+00A66A */ + 1292, /* U+00A66B */ + 1293, /* U+00A66C */ + 1293, /* U+00A66D */ + 0, /* U+00A66E */ + 0, /* U+00A66F */ + 0, /* U+00A670 */ + 0, /* U+00A671 */ + 0, /* U+00A672 */ + 0, /* U+00A673 */ + 0, /* U+00A674 */ + 0, /* U+00A675 */ + 0, /* U+00A676 */ + 0, /* U+00A677 */ + 0, /* U+00A678 */ + 0, /* U+00A679 */ + 0, /* U+00A67A */ + 0, /* U+00A67B */ + 0, /* U+00A67C */ + 0, /* U+00A67D */ + 0, /* U+00A67E */ + 0, /* U+00A67F */ + 1294, /* U+00A680 */ + 1294, /* U+00A681 */ + 1295, /* U+00A682 */ + 1295, /* U+00A683 */ + 1296, /* U+00A684 */ + 1296, /* U+00A685 */ + 1297, /* U+00A686 */ + 1297, /* U+00A687 */ + 1298, /* U+00A688 */ + 1298, /* U+00A689 */ + 1299, /* U+00A68A */ + 1299, /* U+00A68B */ + 1300, /* U+00A68C */ + 1300, /* U+00A68D */ + 1301, /* U+00A68E */ + 1301, /* U+00A68F */ + 1302, /* U+00A690 */ + 1302, /* U+00A691 */ + 1303, /* U+00A692 */ + 1303, /* U+00A693 */ + 1304, /* U+00A694 */ + 1304, /* U+00A695 */ + 1305, /* U+00A696 */ + 1305, /* U+00A697 */ + 1306, /* U+00A698 */ + 1306, /* U+00A699 */ + 1307, /* U+00A69A */ + 1307, /* U+00A69B */ + 0, /* U+00A69C */ + 0, /* U+00A69D */ + 0, /* U+00A69E */ + 0, /* U+00A69F */ + 0, /* U+00A6A0 */ + 0, /* U+00A6A1 */ + 0, /* U+00A6A2 */ + 0, /* U+00A6A3 */ + 0, /* U+00A6A4 */ + 0, /* U+00A6A5 */ + 0, /* U+00A6A6 */ + 0, /* U+00A6A7 */ + 0, /* U+00A6A8 */ + 0, /* U+00A6A9 */ + 0, /* U+00A6AA */ + 0, /* U+00A6AB */ + 0, /* U+00A6AC */ + 0, /* U+00A6AD */ + 0, /* U+00A6AE */ + 0, /* U+00A6AF */ + 0, /* U+00A6B0 */ + 0, /* U+00A6B1 */ + 0, /* U+00A6B2 */ + 0, /* U+00A6B3 */ + 0, /* U+00A6B4 */ + 0, /* U+00A6B5 */ + 0, /* U+00A6B6 */ + 0, /* U+00A6B7 */ + 0, /* U+00A6B8 */ + 0, /* U+00A6B9 */ + 0, /* U+00A6BA */ + 0, /* U+00A6BB */ + 0, /* U+00A6BC */ + 0, /* U+00A6BD */ + 0, /* U+00A6BE */ + 0, /* U+00A6BF */ + 0, /* U+00A6C0 */ + 0, /* U+00A6C1 */ + 0, /* U+00A6C2 */ + 0, /* U+00A6C3 */ + 0, /* U+00A6C4 */ + 0, /* U+00A6C5 */ + 0, /* U+00A6C6 */ + 0, /* U+00A6C7 */ + 0, /* U+00A6C8 */ + 0, /* U+00A6C9 */ + 0, /* U+00A6CA */ + 0, /* U+00A6CB */ + 0, /* U+00A6CC */ + 0, /* U+00A6CD */ + 0, /* U+00A6CE */ + 0, /* U+00A6CF */ + 0, /* U+00A6D0 */ + 0, /* U+00A6D1 */ + 0, /* U+00A6D2 */ + 0, /* U+00A6D3 */ + 0, /* U+00A6D4 */ + 0, /* U+00A6D5 */ + 0, /* U+00A6D6 */ + 0, /* U+00A6D7 */ + 0, /* U+00A6D8 */ + 0, /* U+00A6D9 */ + 0, /* U+00A6DA */ + 0, /* U+00A6DB */ + 0, /* U+00A6DC */ + 0, /* U+00A6DD */ + 0, /* U+00A6DE */ + 0, /* U+00A6DF */ + 0, /* U+00A6E0 */ + 0, /* U+00A6E1 */ + 0, /* U+00A6E2 */ + 0, /* U+00A6E3 */ + 0, /* U+00A6E4 */ + 0, /* U+00A6E5 */ + 0, /* U+00A6E6 */ + 0, /* U+00A6E7 */ + 0, /* U+00A6E8 */ + 0, /* U+00A6E9 */ + 0, /* U+00A6EA */ + 0, /* U+00A6EB */ + 0, /* U+00A6EC */ + 0, /* U+00A6ED */ + 0, /* U+00A6EE */ + 0, /* U+00A6EF */ + 0, /* U+00A6F0 */ + 0, /* U+00A6F1 */ + 0, /* U+00A6F2 */ + 0, /* U+00A6F3 */ + 0, /* U+00A6F4 */ + 0, /* U+00A6F5 */ + 0, /* U+00A6F6 */ + 0, /* U+00A6F7 */ + 0, /* U+00A6F8 */ + 0, /* U+00A6F9 */ + 0, /* U+00A6FA */ + 0, /* U+00A6FB */ + 0, /* U+00A6FC */ + 0, /* U+00A6FD */ + 0, /* U+00A6FE */ + 0, /* U+00A6FF */ + 0, /* U+00A700 */ + 0, /* U+00A701 */ + 0, /* U+00A702 */ + 0, /* U+00A703 */ + 0, /* U+00A704 */ + 0, /* U+00A705 */ + 0, /* U+00A706 */ + 0, /* U+00A707 */ + 0, /* U+00A708 */ + 0, /* U+00A709 */ + 0, /* U+00A70A */ + 0, /* U+00A70B */ + 0, /* U+00A70C */ + 0, /* U+00A70D */ + 0, /* U+00A70E */ + 0, /* U+00A70F */ + 0, /* U+00A710 */ + 0, /* U+00A711 */ + 0, /* U+00A712 */ + 0, /* U+00A713 */ + 0, /* U+00A714 */ + 0, /* U+00A715 */ + 0, /* U+00A716 */ + 0, /* U+00A717 */ + 0, /* U+00A718 */ + 0, /* U+00A719 */ + 0, /* U+00A71A */ + 0, /* U+00A71B */ + 0, /* U+00A71C */ + 0, /* U+00A71D */ + 0, /* U+00A71E */ + 0, /* U+00A71F */ + 0, /* U+00A720 */ + 0, /* U+00A721 */ + 1308, /* U+00A722 */ + 1308, /* U+00A723 */ + 1309, /* U+00A724 */ + 1309, /* U+00A725 */ + 1310, /* U+00A726 */ + 1310, /* U+00A727 */ + 1311, /* U+00A728 */ + 1311, /* U+00A729 */ + 1312, /* U+00A72A */ + 1312, /* U+00A72B */ + 1313, /* U+00A72C */ + 1313, /* U+00A72D */ + 1314, /* U+00A72E */ + 1314, /* U+00A72F */ + 0, /* U+00A730 */ + 0, /* U+00A731 */ + 1315, /* U+00A732 */ + 1315, /* U+00A733 */ + 1316, /* U+00A734 */ + 1316, /* U+00A735 */ + 1317, /* U+00A736 */ + 1317, /* U+00A737 */ + 1318, /* U+00A738 */ + 1318, /* U+00A739 */ + 1319, /* U+00A73A */ + 1319, /* U+00A73B */ + 1320, /* U+00A73C */ + 1320, /* U+00A73D */ + 1321, /* U+00A73E */ + 1321, /* U+00A73F */ + 1322, /* U+00A740 */ + 1322, /* U+00A741 */ + 1323, /* U+00A742 */ + 1323, /* U+00A743 */ + 1324, /* U+00A744 */ + 1324, /* U+00A745 */ + 1325, /* U+00A746 */ + 1325, /* U+00A747 */ + 1326, /* U+00A748 */ + 1326, /* U+00A749 */ + 1327, /* U+00A74A */ + 1327, /* U+00A74B */ + 1328, /* U+00A74C */ + 1328, /* U+00A74D */ + 1329, /* U+00A74E */ + 1329, /* U+00A74F */ + 1330, /* U+00A750 */ + 1330, /* U+00A751 */ + 1331, /* U+00A752 */ + 1331, /* U+00A753 */ + 1332, /* U+00A754 */ + 1332, /* U+00A755 */ + 1333, /* U+00A756 */ + 1333, /* U+00A757 */ + 1334, /* U+00A758 */ + 1334, /* U+00A759 */ + 1335, /* U+00A75A */ + 1335, /* U+00A75B */ + 1336, /* U+00A75C */ + 1336, /* U+00A75D */ + 1337, /* U+00A75E */ + 1337, /* U+00A75F */ + 1338, /* U+00A760 */ + 1338, /* U+00A761 */ + 1339, /* U+00A762 */ + 1339, /* U+00A763 */ + 1340, /* U+00A764 */ + 1340, /* U+00A765 */ + 1341, /* U+00A766 */ + 1341, /* U+00A767 */ + 1342, /* U+00A768 */ + 1342, /* U+00A769 */ + 1343, /* U+00A76A */ + 1343, /* U+00A76B */ + 1344, /* U+00A76C */ + 1344, /* U+00A76D */ + 1345, /* U+00A76E */ + 1345, /* U+00A76F */ + 0, /* U+00A770 */ + 0, /* U+00A771 */ + 0, /* U+00A772 */ + 0, /* U+00A773 */ + 0, /* U+00A774 */ + 0, /* U+00A775 */ + 0, /* U+00A776 */ + 0, /* U+00A777 */ + 0, /* U+00A778 */ + 1346, /* U+00A779 */ + 1346, /* U+00A77A */ + 1347, /* U+00A77B */ + 1347, /* U+00A77C */ + 835, /* U+00A77D */ + 1348, /* U+00A77E */ + 1348, /* U+00A77F */ + 1349, /* U+00A780 */ + 1349, /* U+00A781 */ + 1350, /* U+00A782 */ + 1350, /* U+00A783 */ + 1351, /* U+00A784 */ + 1351, /* U+00A785 */ + 1352, /* U+00A786 */ + 1352, /* U+00A787 */ + 0, /* U+00A788 */ + 0, /* U+00A789 */ + 0, /* U+00A78A */ + 1353, /* U+00A78B */ + 1353, /* U+00A78C */ + 340, /* U+00A78D */ + 0, /* U+00A78E */ + 0, /* U+00A78F */ + 1354, /* U+00A790 */ + 1354, /* U+00A791 */ + 1355, /* U+00A792 */ + 1355, /* U+00A793 */ + 1356, /* U+00A794 */ + 0, /* U+00A795 */ + 1357, /* U+00A796 */ + 1357, /* U+00A797 */ + 1358, /* U+00A798 */ + 1358, /* U+00A799 */ + 1359, /* U+00A79A */ + 1359, /* U+00A79B */ + 1360, /* U+00A79C */ + 1360, /* U+00A79D */ + 1361, /* U+00A79E */ + 1361, /* U+00A79F */ + 1362, /* U+00A7A0 */ + 1362, /* U+00A7A1 */ + 1363, /* U+00A7A2 */ + 1363, /* U+00A7A3 */ + 1364, /* U+00A7A4 */ + 1364, /* U+00A7A5 */ + 1365, /* U+00A7A6 */ + 1365, /* U+00A7A7 */ + 1366, /* U+00A7A8 */ + 1366, /* U+00A7A9 */ + 341, /* U+00A7AA */ + 337, /* U+00A7AB */ + 338, /* U+00A7AC */ + 344, /* U+00A7AD */ + 342, /* U+00A7AE */ + 0, /* U+00A7AF */ + 350, /* U+00A7B0 */ + 348, /* U+00A7B1 */ + 349, /* U+00A7B2 */ + 1367, /* U+00A7B3 */ + 1368, /* U+00A7B4 */ + 1368, /* U+00A7B5 */ + 1369, /* U+00A7B6 */ + 1369, /* U+00A7B7 */ + 1370, /* U+00A7B8 */ + 1370, /* U+00A7B9 */ + 1371, /* U+00A7BA */ + 1371, /* U+00A7BB */ + 1372, /* U+00A7BC */ + 1372, /* U+00A7BD */ + 1373, /* U+00A7BE */ + 1373, /* U+00A7BF */ + 1374, /* U+00A7C0 */ + 1374, /* U+00A7C1 */ + 1375, /* U+00A7C2 */ + 1375, /* U+00A7C3 */ + 1356, /* U+00A7C4 */ + 347, /* U+00A7C5 */ + 837, /* U+00A7C6 */ + 1376, /* U+00A7C7 */ + 1376, /* U+00A7C8 */ + 1377, /* U+00A7C9 */ + 1377, /* U+00A7CA */ + 339, /* U+00A7CB */ + 1378, /* U+00A7CC */ + 1378, /* U+00A7CD */ + 0, /* U+00A7CE */ + 0, /* U+00A7CF */ + 1379, /* U+00A7D0 */ + 1379, /* U+00A7D1 */ + 0, /* U+00A7D2 */ + 0, /* U+00A7D3 */ + 0, /* U+00A7D4 */ + 0, /* U+00A7D5 */ + 1380, /* U+00A7D6 */ + 1380, /* U+00A7D7 */ + 1381, /* U+00A7D8 */ + 1381, /* U+00A7D9 */ + 1382, /* U+00A7DA */ + 1382, /* U+00A7DB */ + 247, /* U+00A7DC */ + 0, /* U+00A7DD */ + 0, /* U+00A7DE */ + 0, /* U+00A7DF */ + 0, /* U+00A7E0 */ + 0, /* U+00A7E1 */ + 0, /* U+00A7E2 */ + 0, /* U+00A7E3 */ + 0, /* U+00A7E4 */ + 0, /* U+00A7E5 */ + 0, /* U+00A7E6 */ + 0, /* U+00A7E7 */ + 0, /* U+00A7E8 */ + 0, /* U+00A7E9 */ + 0, /* U+00A7EA */ + 0, /* U+00A7EB */ + 0, /* U+00A7EC */ + 0, /* U+00A7ED */ + 0, /* U+00A7EE */ + 0, /* U+00A7EF */ + 0, /* U+00A7F0 */ + 0, /* U+00A7F1 */ + 0, /* U+00A7F2 */ + 0, /* U+00A7F3 */ + 0, /* U+00A7F4 */ + 1383, /* U+00A7F5 */ + 1383, /* U+00A7F6 */ + 1367, /* U+00AB53 */ + 0, /* U+00AB54 */ + 0, /* U+00AB55 */ + 0, /* U+00AB56 */ + 0, /* U+00AB57 */ + 0, /* U+00AB58 */ + 0, /* U+00AB59 */ + 0, /* U+00AB5A */ + 0, /* U+00AB5B */ + 0, /* U+00AB5C */ + 0, /* U+00AB5D */ + 0, /* U+00AB5E */ + 0, /* U+00AB5F */ + 0, /* U+00AB60 */ + 0, /* U+00AB61 */ + 0, /* U+00AB62 */ + 0, /* U+00AB63 */ + 0, /* U+00AB64 */ + 0, /* U+00AB65 */ + 0, /* U+00AB66 */ + 0, /* U+00AB67 */ + 0, /* U+00AB68 */ + 0, /* U+00AB69 */ + 0, /* U+00AB6A */ + 0, /* U+00AB6B */ + 0, /* U+00AB6C */ + 0, /* U+00AB6D */ + 0, /* U+00AB6E */ + 0, /* U+00AB6F */ + 693, /* U+00AB70 */ + 694, /* U+00AB71 */ + 695, /* U+00AB72 */ + 696, /* U+00AB73 */ + 697, /* U+00AB74 */ + 698, /* U+00AB75 */ + 699, /* U+00AB76 */ + 700, /* U+00AB77 */ + 701, /* U+00AB78 */ + 702, /* U+00AB79 */ + 703, /* U+00AB7A */ + 704, /* U+00AB7B */ + 705, /* U+00AB7C */ + 706, /* U+00AB7D */ + 707, /* U+00AB7E */ + 708, /* U+00AB7F */ + 709, /* U+00AB80 */ + 710, /* U+00AB81 */ + 711, /* U+00AB82 */ + 712, /* U+00AB83 */ + 713, /* U+00AB84 */ + 714, /* U+00AB85 */ + 715, /* U+00AB86 */ + 716, /* U+00AB87 */ + 717, /* U+00AB88 */ + 718, /* U+00AB89 */ + 719, /* U+00AB8A */ + 720, /* U+00AB8B */ + 721, /* U+00AB8C */ + 722, /* U+00AB8D */ + 723, /* U+00AB8E */ + 724, /* U+00AB8F */ + 725, /* U+00AB90 */ + 726, /* U+00AB91 */ + 727, /* U+00AB92 */ + 728, /* U+00AB93 */ + 729, /* U+00AB94 */ + 730, /* U+00AB95 */ + 731, /* U+00AB96 */ + 732, /* U+00AB97 */ + 733, /* U+00AB98 */ + 734, /* U+00AB99 */ + 735, /* U+00AB9A */ + 736, /* U+00AB9B */ + 737, /* U+00AB9C */ + 738, /* U+00AB9D */ + 739, /* U+00AB9E */ + 740, /* U+00AB9F */ + 741, /* U+00ABA0 */ + 742, /* U+00ABA1 */ + 743, /* U+00ABA2 */ + 744, /* U+00ABA3 */ + 745, /* U+00ABA4 */ + 746, /* U+00ABA5 */ + 747, /* U+00ABA6 */ + 748, /* U+00ABA7 */ + 749, /* U+00ABA8 */ + 750, /* U+00ABA9 */ + 751, /* U+00ABAA */ + 752, /* U+00ABAB */ + 753, /* U+00ABAC */ + 754, /* U+00ABAD */ + 755, /* U+00ABAE */ + 756, /* U+00ABAF */ + 757, /* U+00ABB0 */ + 758, /* U+00ABB1 */ + 759, /* U+00ABB2 */ + 760, /* U+00ABB3 */ + 761, /* U+00ABB4 */ + 762, /* U+00ABB5 */ + 763, /* U+00ABB6 */ + 764, /* U+00ABB7 */ + 765, /* U+00ABB8 */ + 766, /* U+00ABB9 */ + 767, /* U+00ABBA */ + 768, /* U+00ABBB */ + 769, /* U+00ABBC */ + 770, /* U+00ABBD */ + 771, /* U+00ABBE */ + 772, /* U+00ABBF */ + 1384, /* U+00FB00 */ + 1385, /* U+00FB01 */ + 1386, /* U+00FB02 */ + 1387, /* U+00FB03 */ + 1388, /* U+00FB04 */ + 1389, /* U+00FB05 */ + 1390, /* U+00FB06 */ + 0, /* U+00FB07 */ + 0, /* U+00FB08 */ + 0, /* U+00FB09 */ + 0, /* U+00FB0A */ + 0, /* U+00FB0B */ + 0, /* U+00FB0C */ + 0, /* U+00FB0D */ + 0, /* U+00FB0E */ + 0, /* U+00FB0F */ + 0, /* U+00FB10 */ + 0, /* U+00FB11 */ + 0, /* U+00FB12 */ + 1391, /* U+00FB13 */ + 1392, /* U+00FB14 */ + 1393, /* U+00FB15 */ + 1394, /* U+00FB16 */ + 1395, /* U+00FB17 */ + 1396, /* U+00FF21 */ + 1397, /* U+00FF22 */ + 1398, /* U+00FF23 */ + 1399, /* U+00FF24 */ + 1400, /* U+00FF25 */ + 1401, /* U+00FF26 */ + 1402, /* U+00FF27 */ + 1403, /* U+00FF28 */ + 1404, /* U+00FF29 */ + 1405, /* U+00FF2A */ + 1406, /* U+00FF2B */ + 1407, /* U+00FF2C */ + 1408, /* U+00FF2D */ + 1409, /* U+00FF2E */ + 1410, /* U+00FF2F */ + 1411, /* U+00FF30 */ + 1412, /* U+00FF31 */ + 1413, /* U+00FF32 */ + 1414, /* U+00FF33 */ + 1415, /* U+00FF34 */ + 1416, /* U+00FF35 */ + 1417, /* U+00FF36 */ + 1418, /* U+00FF37 */ + 1419, /* U+00FF38 */ + 1420, /* U+00FF39 */ + 1421, /* U+00FF3A */ + 0, /* U+00FF3B */ + 0, /* U+00FF3C */ + 0, /* U+00FF3D */ + 0, /* U+00FF3E */ + 0, /* U+00FF3F */ + 0, /* U+00FF40 */ + 1396, /* U+00FF41 */ + 1397, /* U+00FF42 */ + 1398, /* U+00FF43 */ + 1399, /* U+00FF44 */ + 1400, /* U+00FF45 */ + 1401, /* U+00FF46 */ + 1402, /* U+00FF47 */ + 1403, /* U+00FF48 */ + 1404, /* U+00FF49 */ + 1405, /* U+00FF4A */ + 1406, /* U+00FF4B */ + 1407, /* U+00FF4C */ + 1408, /* U+00FF4D */ + 1409, /* U+00FF4E */ + 1410, /* U+00FF4F */ + 1411, /* U+00FF50 */ + 1412, /* U+00FF51 */ + 1413, /* U+00FF52 */ + 1414, /* U+00FF53 */ + 1415, /* U+00FF54 */ + 1416, /* U+00FF55 */ + 1417, /* U+00FF56 */ + 1418, /* U+00FF57 */ + 1419, /* U+00FF58 */ + 1420, /* U+00FF59 */ + 1421, /* U+00FF5A */ + 1422, /* U+010400 */ + 1423, /* U+010401 */ + 1424, /* U+010402 */ + 1425, /* U+010403 */ + 1426, /* U+010404 */ + 1427, /* U+010405 */ + 1428, /* U+010406 */ + 1429, /* U+010407 */ + 1430, /* U+010408 */ + 1431, /* U+010409 */ + 1432, /* U+01040A */ + 1433, /* U+01040B */ + 1434, /* U+01040C */ + 1435, /* U+01040D */ + 1436, /* U+01040E */ + 1437, /* U+01040F */ + 1438, /* U+010410 */ + 1439, /* U+010411 */ + 1440, /* U+010412 */ + 1441, /* U+010413 */ + 1442, /* U+010414 */ + 1443, /* U+010415 */ + 1444, /* U+010416 */ + 1445, /* U+010417 */ + 1446, /* U+010418 */ + 1447, /* U+010419 */ + 1448, /* U+01041A */ + 1449, /* U+01041B */ + 1450, /* U+01041C */ + 1451, /* U+01041D */ + 1452, /* U+01041E */ + 1453, /* U+01041F */ + 1454, /* U+010420 */ + 1455, /* U+010421 */ + 1456, /* U+010422 */ + 1457, /* U+010423 */ + 1458, /* U+010424 */ + 1459, /* U+010425 */ + 1460, /* U+010426 */ + 1461, /* U+010427 */ + 1422, /* U+010428 */ + 1423, /* U+010429 */ + 1424, /* U+01042A */ + 1425, /* U+01042B */ + 1426, /* U+01042C */ + 1427, /* U+01042D */ + 1428, /* U+01042E */ + 1429, /* U+01042F */ + 1430, /* U+010430 */ + 1431, /* U+010431 */ + 1432, /* U+010432 */ + 1433, /* U+010433 */ + 1434, /* U+010434 */ + 1435, /* U+010435 */ + 1436, /* U+010436 */ + 1437, /* U+010437 */ + 1438, /* U+010438 */ + 1439, /* U+010439 */ + 1440, /* U+01043A */ + 1441, /* U+01043B */ + 1442, /* U+01043C */ + 1443, /* U+01043D */ + 1444, /* U+01043E */ + 1445, /* U+01043F */ + 1446, /* U+010440 */ + 1447, /* U+010441 */ + 1448, /* U+010442 */ + 1449, /* U+010443 */ + 1450, /* U+010444 */ + 1451, /* U+010445 */ + 1452, /* U+010446 */ + 1453, /* U+010447 */ + 1454, /* U+010448 */ + 1455, /* U+010449 */ + 1456, /* U+01044A */ + 1457, /* U+01044B */ + 1458, /* U+01044C */ + 1459, /* U+01044D */ + 1460, /* U+01044E */ + 1461, /* U+01044F */ + 0, /* U+010450 */ + 0, /* U+010451 */ + 0, /* U+010452 */ + 0, /* U+010453 */ + 0, /* U+010454 */ + 0, /* U+010455 */ + 0, /* U+010456 */ + 0, /* U+010457 */ + 0, /* U+010458 */ + 0, /* U+010459 */ + 0, /* U+01045A */ + 0, /* U+01045B */ + 0, /* U+01045C */ + 0, /* U+01045D */ + 0, /* U+01045E */ + 0, /* U+01045F */ + 0, /* U+010460 */ + 0, /* U+010461 */ + 0, /* U+010462 */ + 0, /* U+010463 */ + 0, /* U+010464 */ + 0, /* U+010465 */ + 0, /* U+010466 */ + 0, /* U+010467 */ + 0, /* U+010468 */ + 0, /* U+010469 */ + 0, /* U+01046A */ + 0, /* U+01046B */ + 0, /* U+01046C */ + 0, /* U+01046D */ + 0, /* U+01046E */ + 0, /* U+01046F */ + 0, /* U+010470 */ + 0, /* U+010471 */ + 0, /* U+010472 */ + 0, /* U+010473 */ + 0, /* U+010474 */ + 0, /* U+010475 */ + 0, /* U+010476 */ + 0, /* U+010477 */ + 0, /* U+010478 */ + 0, /* U+010479 */ + 0, /* U+01047A */ + 0, /* U+01047B */ + 0, /* U+01047C */ + 0, /* U+01047D */ + 0, /* U+01047E */ + 0, /* U+01047F */ + 0, /* U+010480 */ + 0, /* U+010481 */ + 0, /* U+010482 */ + 0, /* U+010483 */ + 0, /* U+010484 */ + 0, /* U+010485 */ + 0, /* U+010486 */ + 0, /* U+010487 */ + 0, /* U+010488 */ + 0, /* U+010489 */ + 0, /* U+01048A */ + 0, /* U+01048B */ + 0, /* U+01048C */ + 0, /* U+01048D */ + 0, /* U+01048E */ + 0, /* U+01048F */ + 0, /* U+010490 */ + 0, /* U+010491 */ + 0, /* U+010492 */ + 0, /* U+010493 */ + 0, /* U+010494 */ + 0, /* U+010495 */ + 0, /* U+010496 */ + 0, /* U+010497 */ + 0, /* U+010498 */ + 0, /* U+010499 */ + 0, /* U+01049A */ + 0, /* U+01049B */ + 0, /* U+01049C */ + 0, /* U+01049D */ + 0, /* U+01049E */ + 0, /* U+01049F */ + 0, /* U+0104A0 */ + 0, /* U+0104A1 */ + 0, /* U+0104A2 */ + 0, /* U+0104A3 */ + 0, /* U+0104A4 */ + 0, /* U+0104A5 */ + 0, /* U+0104A6 */ + 0, /* U+0104A7 */ + 0, /* U+0104A8 */ + 0, /* U+0104A9 */ + 0, /* U+0104AA */ + 0, /* U+0104AB */ + 0, /* U+0104AC */ + 0, /* U+0104AD */ + 0, /* U+0104AE */ + 0, /* U+0104AF */ + 1462, /* U+0104B0 */ + 1463, /* U+0104B1 */ + 1464, /* U+0104B2 */ + 1465, /* U+0104B3 */ + 1466, /* U+0104B4 */ + 1467, /* U+0104B5 */ + 1468, /* U+0104B6 */ + 1469, /* U+0104B7 */ + 1470, /* U+0104B8 */ + 1471, /* U+0104B9 */ + 1472, /* U+0104BA */ + 1473, /* U+0104BB */ + 1474, /* U+0104BC */ + 1475, /* U+0104BD */ + 1476, /* U+0104BE */ + 1477, /* U+0104BF */ + 1478, /* U+0104C0 */ + 1479, /* U+0104C1 */ + 1480, /* U+0104C2 */ + 1481, /* U+0104C3 */ + 1482, /* U+0104C4 */ + 1483, /* U+0104C5 */ + 1484, /* U+0104C6 */ + 1485, /* U+0104C7 */ + 1486, /* U+0104C8 */ + 1487, /* U+0104C9 */ + 1488, /* U+0104CA */ + 1489, /* U+0104CB */ + 1490, /* U+0104CC */ + 1491, /* U+0104CD */ + 1492, /* U+0104CE */ + 1493, /* U+0104CF */ + 1494, /* U+0104D0 */ + 1495, /* U+0104D1 */ + 1496, /* U+0104D2 */ + 1497, /* U+0104D3 */ + 0, /* U+0104D4 */ + 0, /* U+0104D5 */ + 0, /* U+0104D6 */ + 0, /* U+0104D7 */ + 1462, /* U+0104D8 */ + 1463, /* U+0104D9 */ + 1464, /* U+0104DA */ + 1465, /* U+0104DB */ + 1466, /* U+0104DC */ + 1467, /* U+0104DD */ + 1468, /* U+0104DE */ + 1469, /* U+0104DF */ + 1470, /* U+0104E0 */ + 1471, /* U+0104E1 */ + 1472, /* U+0104E2 */ + 1473, /* U+0104E3 */ + 1474, /* U+0104E4 */ + 1475, /* U+0104E5 */ + 1476, /* U+0104E6 */ + 1477, /* U+0104E7 */ + 1478, /* U+0104E8 */ + 1479, /* U+0104E9 */ + 1480, /* U+0104EA */ + 1481, /* U+0104EB */ + 1482, /* U+0104EC */ + 1483, /* U+0104ED */ + 1484, /* U+0104EE */ + 1485, /* U+0104EF */ + 1486, /* U+0104F0 */ + 1487, /* U+0104F1 */ + 1488, /* U+0104F2 */ + 1489, /* U+0104F3 */ + 1490, /* U+0104F4 */ + 1491, /* U+0104F5 */ + 1492, /* U+0104F6 */ + 1493, /* U+0104F7 */ + 1494, /* U+0104F8 */ + 1495, /* U+0104F9 */ + 1496, /* U+0104FA */ + 1497, /* U+0104FB */ + 0, /* U+0104FC */ + 0, /* U+0104FD */ + 0, /* U+0104FE */ + 0, /* U+0104FF */ + 0, /* U+010500 */ + 0, /* U+010501 */ + 0, /* U+010502 */ + 0, /* U+010503 */ + 0, /* U+010504 */ + 0, /* U+010505 */ + 0, /* U+010506 */ + 0, /* U+010507 */ + 0, /* U+010508 */ + 0, /* U+010509 */ + 0, /* U+01050A */ + 0, /* U+01050B */ + 0, /* U+01050C */ + 0, /* U+01050D */ + 0, /* U+01050E */ + 0, /* U+01050F */ + 0, /* U+010510 */ + 0, /* U+010511 */ + 0, /* U+010512 */ + 0, /* U+010513 */ + 0, /* U+010514 */ + 0, /* U+010515 */ + 0, /* U+010516 */ + 0, /* U+010517 */ + 0, /* U+010518 */ + 0, /* U+010519 */ + 0, /* U+01051A */ + 0, /* U+01051B */ + 0, /* U+01051C */ + 0, /* U+01051D */ + 0, /* U+01051E */ + 0, /* U+01051F */ + 0, /* U+010520 */ + 0, /* U+010521 */ + 0, /* U+010522 */ + 0, /* U+010523 */ + 0, /* U+010524 */ + 0, /* U+010525 */ + 0, /* U+010526 */ + 0, /* U+010527 */ + 0, /* U+010528 */ + 0, /* U+010529 */ + 0, /* U+01052A */ + 0, /* U+01052B */ + 0, /* U+01052C */ + 0, /* U+01052D */ + 0, /* U+01052E */ + 0, /* U+01052F */ + 0, /* U+010530 */ + 0, /* U+010531 */ + 0, /* U+010532 */ + 0, /* U+010533 */ + 0, /* U+010534 */ + 0, /* U+010535 */ + 0, /* U+010536 */ + 0, /* U+010537 */ + 0, /* U+010538 */ + 0, /* U+010539 */ + 0, /* U+01053A */ + 0, /* U+01053B */ + 0, /* U+01053C */ + 0, /* U+01053D */ + 0, /* U+01053E */ + 0, /* U+01053F */ + 0, /* U+010540 */ + 0, /* U+010541 */ + 0, /* U+010542 */ + 0, /* U+010543 */ + 0, /* U+010544 */ + 0, /* U+010545 */ + 0, /* U+010546 */ + 0, /* U+010547 */ + 0, /* U+010548 */ + 0, /* U+010549 */ + 0, /* U+01054A */ + 0, /* U+01054B */ + 0, /* U+01054C */ + 0, /* U+01054D */ + 0, /* U+01054E */ + 0, /* U+01054F */ + 0, /* U+010550 */ + 0, /* U+010551 */ + 0, /* U+010552 */ + 0, /* U+010553 */ + 0, /* U+010554 */ + 0, /* U+010555 */ + 0, /* U+010556 */ + 0, /* U+010557 */ + 0, /* U+010558 */ + 0, /* U+010559 */ + 0, /* U+01055A */ + 0, /* U+01055B */ + 0, /* U+01055C */ + 0, /* U+01055D */ + 0, /* U+01055E */ + 0, /* U+01055F */ + 0, /* U+010560 */ + 0, /* U+010561 */ + 0, /* U+010562 */ + 0, /* U+010563 */ + 0, /* U+010564 */ + 0, /* U+010565 */ + 0, /* U+010566 */ + 0, /* U+010567 */ + 0, /* U+010568 */ + 0, /* U+010569 */ + 0, /* U+01056A */ + 0, /* U+01056B */ + 0, /* U+01056C */ + 0, /* U+01056D */ + 0, /* U+01056E */ + 0, /* U+01056F */ + 1498, /* U+010570 */ + 1499, /* U+010571 */ + 1500, /* U+010572 */ + 1501, /* U+010573 */ + 1502, /* U+010574 */ + 1503, /* U+010575 */ + 1504, /* U+010576 */ + 1505, /* U+010577 */ + 1506, /* U+010578 */ + 1507, /* U+010579 */ + 1508, /* U+01057A */ + 0, /* U+01057B */ + 1509, /* U+01057C */ + 1510, /* U+01057D */ + 1511, /* U+01057E */ + 1512, /* U+01057F */ + 1513, /* U+010580 */ + 1514, /* U+010581 */ + 1515, /* U+010582 */ + 1516, /* U+010583 */ + 1517, /* U+010584 */ + 1518, /* U+010585 */ + 1519, /* U+010586 */ + 1520, /* U+010587 */ + 1521, /* U+010588 */ + 1522, /* U+010589 */ + 1523, /* U+01058A */ + 0, /* U+01058B */ + 1524, /* U+01058C */ + 1525, /* U+01058D */ + 1526, /* U+01058E */ + 1527, /* U+01058F */ + 1528, /* U+010590 */ + 1529, /* U+010591 */ + 1530, /* U+010592 */ + 0, /* U+010593 */ + 1531, /* U+010594 */ + 1532, /* U+010595 */ + 0, /* U+010596 */ + 1498, /* U+010597 */ + 1499, /* U+010598 */ + 1500, /* U+010599 */ + 1501, /* U+01059A */ + 1502, /* U+01059B */ + 1503, /* U+01059C */ + 1504, /* U+01059D */ + 1505, /* U+01059E */ + 1506, /* U+01059F */ + 1507, /* U+0105A0 */ + 1508, /* U+0105A1 */ + 0, /* U+0105A2 */ + 1509, /* U+0105A3 */ + 1510, /* U+0105A4 */ + 1511, /* U+0105A5 */ + 1512, /* U+0105A6 */ + 1513, /* U+0105A7 */ + 1514, /* U+0105A8 */ + 1515, /* U+0105A9 */ + 1516, /* U+0105AA */ + 1517, /* U+0105AB */ + 1518, /* U+0105AC */ + 1519, /* U+0105AD */ + 1520, /* U+0105AE */ + 1521, /* U+0105AF */ + 1522, /* U+0105B0 */ + 1523, /* U+0105B1 */ + 0, /* U+0105B2 */ + 1524, /* U+0105B3 */ + 1525, /* U+0105B4 */ + 1526, /* U+0105B5 */ + 1527, /* U+0105B6 */ + 1528, /* U+0105B7 */ + 1529, /* U+0105B8 */ + 1530, /* U+0105B9 */ + 0, /* U+0105BA */ + 1531, /* U+0105BB */ + 1532, /* U+0105BC */ + 1533, /* U+010C80 */ + 1534, /* U+010C81 */ + 1535, /* U+010C82 */ + 1536, /* U+010C83 */ + 1537, /* U+010C84 */ + 1538, /* U+010C85 */ + 1539, /* U+010C86 */ + 1540, /* U+010C87 */ + 1541, /* U+010C88 */ + 1542, /* U+010C89 */ + 1543, /* U+010C8A */ + 1544, /* U+010C8B */ + 1545, /* U+010C8C */ + 1546, /* U+010C8D */ + 1547, /* U+010C8E */ + 1548, /* U+010C8F */ + 1549, /* U+010C90 */ + 1550, /* U+010C91 */ + 1551, /* U+010C92 */ + 1552, /* U+010C93 */ + 1553, /* U+010C94 */ + 1554, /* U+010C95 */ + 1555, /* U+010C96 */ + 1556, /* U+010C97 */ + 1557, /* U+010C98 */ + 1558, /* U+010C99 */ + 1559, /* U+010C9A */ + 1560, /* U+010C9B */ + 1561, /* U+010C9C */ + 1562, /* U+010C9D */ + 1563, /* U+010C9E */ + 1564, /* U+010C9F */ + 1565, /* U+010CA0 */ + 1566, /* U+010CA1 */ + 1567, /* U+010CA2 */ + 1568, /* U+010CA3 */ + 1569, /* U+010CA4 */ + 1570, /* U+010CA5 */ + 1571, /* U+010CA6 */ + 1572, /* U+010CA7 */ + 1573, /* U+010CA8 */ + 1574, /* U+010CA9 */ + 1575, /* U+010CAA */ + 1576, /* U+010CAB */ + 1577, /* U+010CAC */ + 1578, /* U+010CAD */ + 1579, /* U+010CAE */ + 1580, /* U+010CAF */ + 1581, /* U+010CB0 */ + 1582, /* U+010CB1 */ + 1583, /* U+010CB2 */ + 0, /* U+010CB3 */ + 0, /* U+010CB4 */ + 0, /* U+010CB5 */ + 0, /* U+010CB6 */ + 0, /* U+010CB7 */ + 0, /* U+010CB8 */ + 0, /* U+010CB9 */ + 0, /* U+010CBA */ + 0, /* U+010CBB */ + 0, /* U+010CBC */ + 0, /* U+010CBD */ + 0, /* U+010CBE */ + 0, /* U+010CBF */ + 1533, /* U+010CC0 */ + 1534, /* U+010CC1 */ + 1535, /* U+010CC2 */ + 1536, /* U+010CC3 */ + 1537, /* U+010CC4 */ + 1538, /* U+010CC5 */ + 1539, /* U+010CC6 */ + 1540, /* U+010CC7 */ + 1541, /* U+010CC8 */ + 1542, /* U+010CC9 */ + 1543, /* U+010CCA */ + 1544, /* U+010CCB */ + 1545, /* U+010CCC */ + 1546, /* U+010CCD */ + 1547, /* U+010CCE */ + 1548, /* U+010CCF */ + 1549, /* U+010CD0 */ + 1550, /* U+010CD1 */ + 1551, /* U+010CD2 */ + 1552, /* U+010CD3 */ + 1553, /* U+010CD4 */ + 1554, /* U+010CD5 */ + 1555, /* U+010CD6 */ + 1556, /* U+010CD7 */ + 1557, /* U+010CD8 */ + 1558, /* U+010CD9 */ + 1559, /* U+010CDA */ + 1560, /* U+010CDB */ + 1561, /* U+010CDC */ + 1562, /* U+010CDD */ + 1563, /* U+010CDE */ + 1564, /* U+010CDF */ + 1565, /* U+010CE0 */ + 1566, /* U+010CE1 */ + 1567, /* U+010CE2 */ + 1568, /* U+010CE3 */ + 1569, /* U+010CE4 */ + 1570, /* U+010CE5 */ + 1571, /* U+010CE6 */ + 1572, /* U+010CE7 */ + 1573, /* U+010CE8 */ + 1574, /* U+010CE9 */ + 1575, /* U+010CEA */ + 1576, /* U+010CEB */ + 1577, /* U+010CEC */ + 1578, /* U+010CED */ + 1579, /* U+010CEE */ + 1580, /* U+010CEF */ + 1581, /* U+010CF0 */ + 1582, /* U+010CF1 */ + 1583, /* U+010CF2 */ + 0, /* U+010CF3 */ + 0, /* U+010CF4 */ + 0, /* U+010CF5 */ + 0, /* U+010CF6 */ + 0, /* U+010CF7 */ + 0, /* U+010CF8 */ + 0, /* U+010CF9 */ + 0, /* U+010CFA */ + 0, /* U+010CFB */ + 0, /* U+010CFC */ + 0, /* U+010CFD */ + 0, /* U+010CFE */ + 0, /* U+010CFF */ + 0, /* U+010D00 */ + 0, /* U+010D01 */ + 0, /* U+010D02 */ + 0, /* U+010D03 */ + 0, /* U+010D04 */ + 0, /* U+010D05 */ + 0, /* U+010D06 */ + 0, /* U+010D07 */ + 0, /* U+010D08 */ + 0, /* U+010D09 */ + 0, /* U+010D0A */ + 0, /* U+010D0B */ + 0, /* U+010D0C */ + 0, /* U+010D0D */ + 0, /* U+010D0E */ + 0, /* U+010D0F */ + 0, /* U+010D10 */ + 0, /* U+010D11 */ + 0, /* U+010D12 */ + 0, /* U+010D13 */ + 0, /* U+010D14 */ + 0, /* U+010D15 */ + 0, /* U+010D16 */ + 0, /* U+010D17 */ + 0, /* U+010D18 */ + 0, /* U+010D19 */ + 0, /* U+010D1A */ + 0, /* U+010D1B */ + 0, /* U+010D1C */ + 0, /* U+010D1D */ + 0, /* U+010D1E */ + 0, /* U+010D1F */ + 0, /* U+010D20 */ + 0, /* U+010D21 */ + 0, /* U+010D22 */ + 0, /* U+010D23 */ + 0, /* U+010D24 */ + 0, /* U+010D25 */ + 0, /* U+010D26 */ + 0, /* U+010D27 */ + 0, /* U+010D28 */ + 0, /* U+010D29 */ + 0, /* U+010D2A */ + 0, /* U+010D2B */ + 0, /* U+010D2C */ + 0, /* U+010D2D */ + 0, /* U+010D2E */ + 0, /* U+010D2F */ + 0, /* U+010D30 */ + 0, /* U+010D31 */ + 0, /* U+010D32 */ + 0, /* U+010D33 */ + 0, /* U+010D34 */ + 0, /* U+010D35 */ + 0, /* U+010D36 */ + 0, /* U+010D37 */ + 0, /* U+010D38 */ + 0, /* U+010D39 */ + 0, /* U+010D3A */ + 0, /* U+010D3B */ + 0, /* U+010D3C */ + 0, /* U+010D3D */ + 0, /* U+010D3E */ + 0, /* U+010D3F */ + 0, /* U+010D40 */ + 0, /* U+010D41 */ + 0, /* U+010D42 */ + 0, /* U+010D43 */ + 0, /* U+010D44 */ + 0, /* U+010D45 */ + 0, /* U+010D46 */ + 0, /* U+010D47 */ + 0, /* U+010D48 */ + 0, /* U+010D49 */ + 0, /* U+010D4A */ + 0, /* U+010D4B */ + 0, /* U+010D4C */ + 0, /* U+010D4D */ + 0, /* U+010D4E */ + 0, /* U+010D4F */ + 1584, /* U+010D50 */ + 1585, /* U+010D51 */ + 1586, /* U+010D52 */ + 1587, /* U+010D53 */ + 1588, /* U+010D54 */ + 1589, /* U+010D55 */ + 1590, /* U+010D56 */ + 1591, /* U+010D57 */ + 1592, /* U+010D58 */ + 1593, /* U+010D59 */ + 1594, /* U+010D5A */ + 1595, /* U+010D5B */ + 1596, /* U+010D5C */ + 1597, /* U+010D5D */ + 1598, /* U+010D5E */ + 1599, /* U+010D5F */ + 1600, /* U+010D60 */ + 1601, /* U+010D61 */ + 1602, /* U+010D62 */ + 1603, /* U+010D63 */ + 1604, /* U+010D64 */ + 1605, /* U+010D65 */ + 0, /* U+010D66 */ + 0, /* U+010D67 */ + 0, /* U+010D68 */ + 0, /* U+010D69 */ + 0, /* U+010D6A */ + 0, /* U+010D6B */ + 0, /* U+010D6C */ + 0, /* U+010D6D */ + 0, /* U+010D6E */ + 0, /* U+010D6F */ + 1584, /* U+010D70 */ + 1585, /* U+010D71 */ + 1586, /* U+010D72 */ + 1587, /* U+010D73 */ + 1588, /* U+010D74 */ + 1589, /* U+010D75 */ + 1590, /* U+010D76 */ + 1591, /* U+010D77 */ + 1592, /* U+010D78 */ + 1593, /* U+010D79 */ + 1594, /* U+010D7A */ + 1595, /* U+010D7B */ + 1596, /* U+010D7C */ + 1597, /* U+010D7D */ + 1598, /* U+010D7E */ + 1599, /* U+010D7F */ + 1600, /* U+010D80 */ + 1601, /* U+010D81 */ + 1602, /* U+010D82 */ + 1603, /* U+010D83 */ + 1604, /* U+010D84 */ + 1605, /* U+010D85 */ + 1606, /* U+0118A0 */ + 1607, /* U+0118A1 */ + 1608, /* U+0118A2 */ + 1609, /* U+0118A3 */ + 1610, /* U+0118A4 */ + 1611, /* U+0118A5 */ + 1612, /* U+0118A6 */ + 1613, /* U+0118A7 */ + 1614, /* U+0118A8 */ + 1615, /* U+0118A9 */ + 1616, /* U+0118AA */ + 1617, /* U+0118AB */ + 1618, /* U+0118AC */ + 1619, /* U+0118AD */ + 1620, /* U+0118AE */ + 1621, /* U+0118AF */ + 1622, /* U+0118B0 */ + 1623, /* U+0118B1 */ + 1624, /* U+0118B2 */ + 1625, /* U+0118B3 */ + 1626, /* U+0118B4 */ + 1627, /* U+0118B5 */ + 1628, /* U+0118B6 */ + 1629, /* U+0118B7 */ + 1630, /* U+0118B8 */ + 1631, /* U+0118B9 */ + 1632, /* U+0118BA */ + 1633, /* U+0118BB */ + 1634, /* U+0118BC */ + 1635, /* U+0118BD */ + 1636, /* U+0118BE */ + 1637, /* U+0118BF */ + 1606, /* U+0118C0 */ + 1607, /* U+0118C1 */ + 1608, /* U+0118C2 */ + 1609, /* U+0118C3 */ + 1610, /* U+0118C4 */ + 1611, /* U+0118C5 */ + 1612, /* U+0118C6 */ + 1613, /* U+0118C7 */ + 1614, /* U+0118C8 */ + 1615, /* U+0118C9 */ + 1616, /* U+0118CA */ + 1617, /* U+0118CB */ + 1618, /* U+0118CC */ + 1619, /* U+0118CD */ + 1620, /* U+0118CE */ + 1621, /* U+0118CF */ + 1622, /* U+0118D0 */ + 1623, /* U+0118D1 */ + 1624, /* U+0118D2 */ + 1625, /* U+0118D3 */ + 1626, /* U+0118D4 */ + 1627, /* U+0118D5 */ + 1628, /* U+0118D6 */ + 1629, /* U+0118D7 */ + 1630, /* U+0118D8 */ + 1631, /* U+0118D9 */ + 1632, /* U+0118DA */ + 1633, /* U+0118DB */ + 1634, /* U+0118DC */ + 1635, /* U+0118DD */ + 1636, /* U+0118DE */ + 1637, /* U+0118DF */ + 1638, /* U+016E40 */ + 1639, /* U+016E41 */ + 1640, /* U+016E42 */ + 1641, /* U+016E43 */ + 1642, /* U+016E44 */ + 1643, /* U+016E45 */ + 1644, /* U+016E46 */ + 1645, /* U+016E47 */ + 1646, /* U+016E48 */ + 1647, /* U+016E49 */ + 1648, /* U+016E4A */ + 1649, /* U+016E4B */ + 1650, /* U+016E4C */ + 1651, /* U+016E4D */ + 1652, /* U+016E4E */ + 1653, /* U+016E4F */ + 1654, /* U+016E50 */ + 1655, /* U+016E51 */ + 1656, /* U+016E52 */ + 1657, /* U+016E53 */ + 1658, /* U+016E54 */ + 1659, /* U+016E55 */ + 1660, /* U+016E56 */ + 1661, /* U+016E57 */ + 1662, /* U+016E58 */ + 1663, /* U+016E59 */ + 1664, /* U+016E5A */ + 1665, /* U+016E5B */ + 1666, /* U+016E5C */ + 1667, /* U+016E5D */ + 1668, /* U+016E5E */ + 1669, /* U+016E5F */ + 1638, /* U+016E60 */ + 1639, /* U+016E61 */ + 1640, /* U+016E62 */ + 1641, /* U+016E63 */ + 1642, /* U+016E64 */ + 1643, /* U+016E65 */ + 1644, /* U+016E66 */ + 1645, /* U+016E67 */ + 1646, /* U+016E68 */ + 1647, /* U+016E69 */ + 1648, /* U+016E6A */ + 1649, /* U+016E6B */ + 1650, /* U+016E6C */ + 1651, /* U+016E6D */ + 1652, /* U+016E6E */ + 1653, /* U+016E6F */ + 1654, /* U+016E70 */ + 1655, /* U+016E71 */ + 1656, /* U+016E72 */ + 1657, /* U+016E73 */ + 1658, /* U+016E74 */ + 1659, /* U+016E75 */ + 1660, /* U+016E76 */ + 1661, /* U+016E77 */ + 1662, /* U+016E78 */ + 1663, /* U+016E79 */ + 1664, /* U+016E7A */ + 1665, /* U+016E7B */ + 1666, /* U+016E7C */ + 1667, /* U+016E7D */ + 1668, /* U+016E7E */ + 1669, /* U+016E7F */ + 1670, /* U+01E900 */ + 1671, /* U+01E901 */ + 1672, /* U+01E902 */ + 1673, /* U+01E903 */ + 1674, /* U+01E904 */ + 1675, /* U+01E905 */ + 1676, /* U+01E906 */ + 1677, /* U+01E907 */ + 1678, /* U+01E908 */ + 1679, /* U+01E909 */ + 1680, /* U+01E90A */ + 1681, /* U+01E90B */ + 1682, /* U+01E90C */ + 1683, /* U+01E90D */ + 1684, /* U+01E90E */ + 1685, /* U+01E90F */ + 1686, /* U+01E910 */ + 1687, /* U+01E911 */ + 1688, /* U+01E912 */ + 1689, /* U+01E913 */ + 1690, /* U+01E914 */ + 1691, /* U+01E915 */ + 1692, /* U+01E916 */ + 1693, /* U+01E917 */ + 1694, /* U+01E918 */ + 1695, /* U+01E919 */ + 1696, /* U+01E91A */ + 1697, /* U+01E91B */ + 1698, /* U+01E91C */ + 1699, /* U+01E91D */ + 1700, /* U+01E91E */ + 1701, /* U+01E91F */ + 1702, /* U+01E920 */ + 1703, /* U+01E921 */ + 1670, /* U+01E922 */ + 1671, /* U+01E923 */ + 1672, /* U+01E924 */ + 1673, /* U+01E925 */ + 1674, /* U+01E926 */ + 1675, /* U+01E927 */ + 1676, /* U+01E928 */ + 1677, /* U+01E929 */ + 1678, /* U+01E92A */ + 1679, /* U+01E92B */ + 1680, /* U+01E92C */ + 1681, /* U+01E92D */ + 1682, /* U+01E92E */ + 1683, /* U+01E92F */ + 1684, /* U+01E930 */ + 1685, /* U+01E931 */ + 1686, /* U+01E932 */ + 1687, /* U+01E933 */ + 1688, /* U+01E934 */ + 1689, /* U+01E935 */ + 1690, /* U+01E936 */ + 1691, /* U+01E937 */ + 1692, /* U+01E938 */ + 1693, /* U+01E939 */ + 1694, /* U+01E93A */ + 1695, /* U+01E93B */ + 1696, /* U+01E93C */ + 1697, /* U+01E93D */ + 1698, /* U+01E93E */ + 1699, /* U+01E93F */ + 1700, /* U+01E940 */ + 1701, /* U+01E941 */ + 1702, /* U+01E942 */ + 1703, /* U+01E943 */ +}; + + +/* + * case_index() + * + * Given a code point, compute the index in the case_map at which we can find + * the offset into the mapping tables. + */ +static inline uint16 +case_index(pg_wchar cp) +{ + /* Fast path for codepoints < 0x0588 */ + if (cp < 0x0588) + { + return case_map[cp]; + } + + if (cp < 0xABC0) + { + if (cp < 0x2185) + { + if (cp >= 0x10A0 && cp < 0x1100) + { + return case_map[cp - 0x10A0 + 1416]; + } + else if (cp >= 0x13A0) + { + if (cp < 0x13FE) + { + return case_map[cp - 0x13A0 + 1512]; + } + else if (cp >= 0x1C80) + { + return case_map[cp - 0x1C80 + 1606]; + } + } + } + else if (cp >= 0x24B6) + { + if (cp < 0x2D2E) + { + if (cp < 0x24EA) + { + return case_map[cp - 0x24B6 + 2891]; + } + else if (cp >= 0x2C00) + { + return case_map[cp - 0x2C00 + 2943]; + } + } + else if (cp >= 0xA640) + { + if (cp < 0xA7F7) + { + return case_map[cp - 0xA640 + 3245]; + } + else if (cp >= 0xAB53) + { + return case_map[cp - 0xAB53 + 3684]; + } + } + } + } + else if (cp >= 0xFB00) + { + if (cp < 0x10D86) + { + if (cp < 0xFF5B) + { + if (cp < 0xFB18) + { + return case_map[cp - 0xFB00 + 3793]; + } + else if (cp >= 0xFF21) + { + return case_map[cp - 0xFF21 + 3817]; + } + } + else if (cp >= 0x10400) + { + if (cp < 0x105BD) + { + return case_map[cp - 0x10400 + 3875]; + } + else if (cp >= 0x10C80) + { + return case_map[cp - 0x10C80 + 4320]; + } + } + } + else if (cp >= 0x118A0) + { + if (cp < 0x16E80) + { + if (cp < 0x118E0) + { + return case_map[cp - 0x118A0 + 4582]; + } + else if (cp >= 0x16E40) + { + return case_map[cp - 0x16E40 + 4646]; + } + } + else if (cp >= 0x1E900) + { + if (cp < 0x1E944) + { + return case_map[cp - 0x1E900 + 4710]; + } + } + } + } + + return 0; +} diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_category.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_category.h new file mode 100644 index 0000000..8fd8b67 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_category.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------------------- + * + * unicode_category.h + * Routines for determining the category of Unicode characters. + * + * These definitions can be used by both frontend and backend code. + * + * Copyright (c) 2017-2025, PostgreSQL Global Development Group + * + * src/include/common/unicode_category.h + * + *------------------------------------------------------------------------- + */ +#ifndef UNICODE_CATEGORY_H +#define UNICODE_CATEGORY_H + +#include "mb/pg_wchar.h" + +/* + * Unicode General Category Values + * + * See: https://www.unicode.org/reports/tr44/#General_Category_Values + * + * The Unicode stability policy guarantees: "The enumeration of + * General_Category property values is fixed. No new values will be + * added". See: https://www.unicode.org/policies/stability_policy.html + * + * Numeric values chosen to match corresponding ICU UCharCategory. + */ +typedef enum pg_unicode_category +{ + PG_U_UNASSIGNED = 0, /* Cn */ + PG_U_UPPERCASE_LETTER = 1, /* Lu */ + PG_U_LOWERCASE_LETTER = 2, /* Ll */ + PG_U_TITLECASE_LETTER = 3, /* Lt */ + PG_U_MODIFIER_LETTER = 4, /* Lm */ + PG_U_OTHER_LETTER = 5, /* Lo */ + PG_U_NONSPACING_MARK = 6, /* Mn */ + PG_U_ENCLOSING_MARK = 7, /* Me */ + PG_U_SPACING_MARK = 8, /* Mc */ + PG_U_DECIMAL_NUMBER = 9, /* Nd */ + PG_U_LETTER_NUMBER = 10, /* Nl */ + PG_U_OTHER_NUMBER = 11, /* No */ + PG_U_SPACE_SEPARATOR = 12, /* Zs */ + PG_U_LINE_SEPARATOR = 13, /* Zl */ + PG_U_PARAGRAPH_SEPARATOR = 14, /* Zp */ + PG_U_CONTROL = 15, /* Cc */ + PG_U_FORMAT = 16, /* Cf */ + PG_U_PRIVATE_USE = 17, /* Co */ + PG_U_SURROGATE = 18, /* Cs */ + PG_U_DASH_PUNCTUATION = 19, /* Pd */ + PG_U_OPEN_PUNCTUATION = 20, /* Ps */ + PG_U_CLOSE_PUNCTUATION = 21, /* Pe */ + PG_U_CONNECTOR_PUNCTUATION = 22, /* Pc */ + PG_U_OTHER_PUNCTUATION = 23, /* Po */ + PG_U_MATH_SYMBOL = 24, /* Sm */ + PG_U_CURRENCY_SYMBOL = 25, /* Sc */ + PG_U_MODIFIER_SYMBOL = 26, /* Sk */ + PG_U_OTHER_SYMBOL = 27, /* So */ + PG_U_INITIAL_PUNCTUATION = 28, /* Pi */ + PG_U_FINAL_PUNCTUATION = 29 /* Pf */ +} pg_unicode_category; + +extern pg_unicode_category unicode_category(pg_wchar code); +extern const char *unicode_category_string(pg_unicode_category category); +extern const char *unicode_category_abbrev(pg_unicode_category category); + +extern bool pg_u_prop_alphabetic(pg_wchar code); +extern bool pg_u_prop_lowercase(pg_wchar code); +extern bool pg_u_prop_uppercase(pg_wchar code); +extern bool pg_u_prop_cased(pg_wchar code); +extern bool pg_u_prop_case_ignorable(pg_wchar code); +extern bool pg_u_prop_white_space(pg_wchar code); +extern bool pg_u_prop_hex_digit(pg_wchar code); +extern bool pg_u_prop_join_control(pg_wchar code); + +extern bool pg_u_isdigit(pg_wchar code, bool posix); +extern bool pg_u_isalpha(pg_wchar code); +extern bool pg_u_isalnum(pg_wchar code, bool posix); +extern bool pg_u_isword(pg_wchar code); +extern bool pg_u_isupper(pg_wchar code); +extern bool pg_u_islower(pg_wchar code); +extern bool pg_u_isblank(pg_wchar code); +extern bool pg_u_iscntrl(pg_wchar code); +extern bool pg_u_isgraph(pg_wchar code); +extern bool pg_u_isprint(pg_wchar code); +extern bool pg_u_ispunct(pg_wchar code, bool posix); +extern bool pg_u_isspace(pg_wchar code); +extern bool pg_u_isxdigit(pg_wchar code, bool posix); + +#endif /* UNICODE_CATEGORY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_category_table.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_category_table.h new file mode 100644 index 0000000..95a1c65 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_category_table.h @@ -0,0 +1,7153 @@ +/*------------------------------------------------------------------------- + * + * unicode_category_table.h + * Category table for Unicode character classification. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_category_table.h + * + *------------------------------------------------------------------------- + */ + +#include "common/unicode_category.h" + +/* + * File auto-generated by src/common/unicode/generate-unicode_category_table.pl, + * do not edit. There is deliberately not an #ifndef PG_UNICODE_CATEGORY_TABLE_H + * here. + */ +typedef struct +{ + uint32 first; /* Unicode codepoint */ + uint32 last; /* Unicode codepoint */ + uint8 category; /* General Category */ +} pg_category_range; + +typedef struct +{ + uint32 first; /* Unicode codepoint */ + uint32 last; /* Unicode codepoint */ +} pg_unicode_range; + +typedef struct +{ + uint8 category; + uint8 properties; +} pg_unicode_properties; + +/* + * The properties currently used, in no particular order. Fits in a uint8, but + * if more properties are added, a wider integer will be needed. + */ +#define PG_U_PROP_ALPHABETIC (1 << 0) +#define PG_U_PROP_LOWERCASE (1 << 1) +#define PG_U_PROP_UPPERCASE (1 << 2) +#define PG_U_PROP_CASED (1 << 3) +#define PG_U_PROP_CASE_IGNORABLE (1 << 4) +#define PG_U_PROP_WHITE_SPACE (1 << 5) +#define PG_U_PROP_JOIN_CONTROL (1 << 6) +#define PG_U_PROP_HEX_DIGIT (1 << 7) + +/* table for fast lookup of ASCII codepoints */ +static const pg_unicode_properties unicode_opt_ascii[128] = +{ + { + /* 0x000000 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000001 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000002 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000003 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000004 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000005 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000006 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000007 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000008 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000009 */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000a */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000b */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000c */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000d */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000e */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00000f */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000010 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000011 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000012 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000013 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000014 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000015 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000016 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000017 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000018 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000019 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001a */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001b */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001c */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001d */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001e */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001f */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000020 */ + .category = PG_U_SPACE_SEPARATOR, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x000021 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000022 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000023 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000024 */ + .category = PG_U_CURRENCY_SYMBOL, + .properties = 0 + }, + { + /* 0x000025 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000026 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000027 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x000028 */ + .category = PG_U_OPEN_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000029 */ + .category = PG_U_CLOSE_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00002a */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00002b */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00002c */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00002d */ + .category = PG_U_DASH_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00002e */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x00002f */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000030 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000031 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000032 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000033 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000034 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000035 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000036 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000037 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000038 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000039 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x00003a */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x00003b */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00003c */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00003d */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00003e */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00003f */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000040 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000041 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000042 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000043 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000044 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000045 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000046 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000047 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000048 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000049 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004a */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004b */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004c */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004d */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004e */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004f */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000050 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000051 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000052 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000053 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000054 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000055 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000056 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000057 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000058 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000059 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00005a */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00005b */ + .category = PG_U_OPEN_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00005c */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00005d */ + .category = PG_U_CLOSE_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00005e */ + .category = PG_U_MODIFIER_SYMBOL, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x00005f */ + .category = PG_U_CONNECTOR_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000060 */ + .category = PG_U_MODIFIER_SYMBOL, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x000061 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000062 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000063 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000064 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000065 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000066 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000067 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000068 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000069 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006a */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006b */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006c */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006d */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006e */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006f */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000070 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000071 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000072 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000073 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000074 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000075 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000076 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000077 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000078 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000079 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00007a */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00007b */ + .category = PG_U_OPEN_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00007c */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00007d */ + .category = PG_U_CLOSE_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00007e */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00007f */ + .category = PG_U_CONTROL, + .properties = 0 + }, +}; + +/* table of Unicode codepoint ranges and their categories */ +static const pg_category_range unicode_categories[3368] = +{ + {0x000000, 0x00001f, PG_U_CONTROL}, + {0x000020, 0x000020, PG_U_SPACE_SEPARATOR}, + {0x000021, 0x000023, PG_U_OTHER_PUNCTUATION}, + {0x000024, 0x000024, PG_U_CURRENCY_SYMBOL}, + {0x000025, 0x000027, PG_U_OTHER_PUNCTUATION}, + {0x000028, 0x000028, PG_U_OPEN_PUNCTUATION}, + {0x000029, 0x000029, PG_U_CLOSE_PUNCTUATION}, + {0x00002a, 0x00002a, PG_U_OTHER_PUNCTUATION}, + {0x00002b, 0x00002b, PG_U_MATH_SYMBOL}, + {0x00002c, 0x00002c, PG_U_OTHER_PUNCTUATION}, + {0x00002d, 0x00002d, PG_U_DASH_PUNCTUATION}, + {0x00002e, 0x00002f, PG_U_OTHER_PUNCTUATION}, + {0x000030, 0x000039, PG_U_DECIMAL_NUMBER}, + {0x00003a, 0x00003b, PG_U_OTHER_PUNCTUATION}, + {0x00003c, 0x00003e, PG_U_MATH_SYMBOL}, + {0x00003f, 0x000040, PG_U_OTHER_PUNCTUATION}, + {0x000041, 0x00005a, PG_U_UPPERCASE_LETTER}, + {0x00005b, 0x00005b, PG_U_OPEN_PUNCTUATION}, + {0x00005c, 0x00005c, PG_U_OTHER_PUNCTUATION}, + {0x00005d, 0x00005d, PG_U_CLOSE_PUNCTUATION}, + {0x00005e, 0x00005e, PG_U_MODIFIER_SYMBOL}, + {0x00005f, 0x00005f, PG_U_CONNECTOR_PUNCTUATION}, + {0x000060, 0x000060, PG_U_MODIFIER_SYMBOL}, + {0x000061, 0x00007a, PG_U_LOWERCASE_LETTER}, + {0x00007b, 0x00007b, PG_U_OPEN_PUNCTUATION}, + {0x00007c, 0x00007c, PG_U_MATH_SYMBOL}, + {0x00007d, 0x00007d, PG_U_CLOSE_PUNCTUATION}, + {0x00007e, 0x00007e, PG_U_MATH_SYMBOL}, + {0x00007f, 0x00009f, PG_U_CONTROL}, + {0x0000a0, 0x0000a0, PG_U_SPACE_SEPARATOR}, + {0x0000a1, 0x0000a1, PG_U_OTHER_PUNCTUATION}, + {0x0000a2, 0x0000a5, PG_U_CURRENCY_SYMBOL}, + {0x0000a6, 0x0000a6, PG_U_OTHER_SYMBOL}, + {0x0000a7, 0x0000a7, PG_U_OTHER_PUNCTUATION}, + {0x0000a8, 0x0000a8, PG_U_MODIFIER_SYMBOL}, + {0x0000a9, 0x0000a9, PG_U_OTHER_SYMBOL}, + {0x0000aa, 0x0000aa, PG_U_OTHER_LETTER}, + {0x0000ab, 0x0000ab, PG_U_INITIAL_PUNCTUATION}, + {0x0000ac, 0x0000ac, PG_U_MATH_SYMBOL}, + {0x0000ad, 0x0000ad, PG_U_FORMAT}, + {0x0000ae, 0x0000ae, PG_U_OTHER_SYMBOL}, + {0x0000af, 0x0000af, PG_U_MODIFIER_SYMBOL}, + {0x0000b0, 0x0000b0, PG_U_OTHER_SYMBOL}, + {0x0000b1, 0x0000b1, PG_U_MATH_SYMBOL}, + {0x0000b2, 0x0000b3, PG_U_OTHER_NUMBER}, + {0x0000b4, 0x0000b4, PG_U_MODIFIER_SYMBOL}, + {0x0000b5, 0x0000b5, PG_U_LOWERCASE_LETTER}, + {0x0000b6, 0x0000b7, PG_U_OTHER_PUNCTUATION}, + {0x0000b8, 0x0000b8, PG_U_MODIFIER_SYMBOL}, + {0x0000b9, 0x0000b9, PG_U_OTHER_NUMBER}, + {0x0000ba, 0x0000ba, PG_U_OTHER_LETTER}, + {0x0000bb, 0x0000bb, PG_U_FINAL_PUNCTUATION}, + {0x0000bc, 0x0000be, PG_U_OTHER_NUMBER}, + {0x0000bf, 0x0000bf, PG_U_OTHER_PUNCTUATION}, + {0x0000c0, 0x0000d6, PG_U_UPPERCASE_LETTER}, + {0x0000d7, 0x0000d7, PG_U_MATH_SYMBOL}, + {0x0000d8, 0x0000de, PG_U_UPPERCASE_LETTER}, + {0x0000df, 0x0000f6, PG_U_LOWERCASE_LETTER}, + {0x0000f7, 0x0000f7, PG_U_MATH_SYMBOL}, + {0x0000f8, 0x0000ff, PG_U_LOWERCASE_LETTER}, + {0x000100, 0x000100, PG_U_UPPERCASE_LETTER}, + {0x000101, 0x000101, PG_U_LOWERCASE_LETTER}, + {0x000102, 0x000102, PG_U_UPPERCASE_LETTER}, + {0x000103, 0x000103, PG_U_LOWERCASE_LETTER}, + {0x000104, 0x000104, PG_U_UPPERCASE_LETTER}, + {0x000105, 0x000105, PG_U_LOWERCASE_LETTER}, + {0x000106, 0x000106, PG_U_UPPERCASE_LETTER}, + {0x000107, 0x000107, PG_U_LOWERCASE_LETTER}, + {0x000108, 0x000108, PG_U_UPPERCASE_LETTER}, + {0x000109, 0x000109, PG_U_LOWERCASE_LETTER}, + {0x00010a, 0x00010a, PG_U_UPPERCASE_LETTER}, + {0x00010b, 0x00010b, PG_U_LOWERCASE_LETTER}, + {0x00010c, 0x00010c, PG_U_UPPERCASE_LETTER}, + {0x00010d, 0x00010d, PG_U_LOWERCASE_LETTER}, + {0x00010e, 0x00010e, PG_U_UPPERCASE_LETTER}, + {0x00010f, 0x00010f, PG_U_LOWERCASE_LETTER}, + {0x000110, 0x000110, PG_U_UPPERCASE_LETTER}, + {0x000111, 0x000111, PG_U_LOWERCASE_LETTER}, + {0x000112, 0x000112, PG_U_UPPERCASE_LETTER}, + {0x000113, 0x000113, PG_U_LOWERCASE_LETTER}, + {0x000114, 0x000114, PG_U_UPPERCASE_LETTER}, + {0x000115, 0x000115, PG_U_LOWERCASE_LETTER}, + {0x000116, 0x000116, PG_U_UPPERCASE_LETTER}, + {0x000117, 0x000117, PG_U_LOWERCASE_LETTER}, + {0x000118, 0x000118, PG_U_UPPERCASE_LETTER}, + {0x000119, 0x000119, PG_U_LOWERCASE_LETTER}, + {0x00011a, 0x00011a, PG_U_UPPERCASE_LETTER}, + {0x00011b, 0x00011b, PG_U_LOWERCASE_LETTER}, + {0x00011c, 0x00011c, PG_U_UPPERCASE_LETTER}, + {0x00011d, 0x00011d, PG_U_LOWERCASE_LETTER}, + {0x00011e, 0x00011e, PG_U_UPPERCASE_LETTER}, + {0x00011f, 0x00011f, PG_U_LOWERCASE_LETTER}, + {0x000120, 0x000120, PG_U_UPPERCASE_LETTER}, + {0x000121, 0x000121, PG_U_LOWERCASE_LETTER}, + {0x000122, 0x000122, PG_U_UPPERCASE_LETTER}, + {0x000123, 0x000123, PG_U_LOWERCASE_LETTER}, + {0x000124, 0x000124, PG_U_UPPERCASE_LETTER}, + {0x000125, 0x000125, PG_U_LOWERCASE_LETTER}, + {0x000126, 0x000126, PG_U_UPPERCASE_LETTER}, + {0x000127, 0x000127, PG_U_LOWERCASE_LETTER}, + {0x000128, 0x000128, PG_U_UPPERCASE_LETTER}, + {0x000129, 0x000129, PG_U_LOWERCASE_LETTER}, + {0x00012a, 0x00012a, PG_U_UPPERCASE_LETTER}, + {0x00012b, 0x00012b, PG_U_LOWERCASE_LETTER}, + {0x00012c, 0x00012c, PG_U_UPPERCASE_LETTER}, + {0x00012d, 0x00012d, PG_U_LOWERCASE_LETTER}, + {0x00012e, 0x00012e, PG_U_UPPERCASE_LETTER}, + {0x00012f, 0x00012f, PG_U_LOWERCASE_LETTER}, + {0x000130, 0x000130, PG_U_UPPERCASE_LETTER}, + {0x000131, 0x000131, PG_U_LOWERCASE_LETTER}, + {0x000132, 0x000132, PG_U_UPPERCASE_LETTER}, + {0x000133, 0x000133, PG_U_LOWERCASE_LETTER}, + {0x000134, 0x000134, PG_U_UPPERCASE_LETTER}, + {0x000135, 0x000135, PG_U_LOWERCASE_LETTER}, + {0x000136, 0x000136, PG_U_UPPERCASE_LETTER}, + {0x000137, 0x000138, PG_U_LOWERCASE_LETTER}, + {0x000139, 0x000139, PG_U_UPPERCASE_LETTER}, + {0x00013a, 0x00013a, PG_U_LOWERCASE_LETTER}, + {0x00013b, 0x00013b, PG_U_UPPERCASE_LETTER}, + {0x00013c, 0x00013c, PG_U_LOWERCASE_LETTER}, + {0x00013d, 0x00013d, PG_U_UPPERCASE_LETTER}, + {0x00013e, 0x00013e, PG_U_LOWERCASE_LETTER}, + {0x00013f, 0x00013f, PG_U_UPPERCASE_LETTER}, + {0x000140, 0x000140, PG_U_LOWERCASE_LETTER}, + {0x000141, 0x000141, PG_U_UPPERCASE_LETTER}, + {0x000142, 0x000142, PG_U_LOWERCASE_LETTER}, + {0x000143, 0x000143, PG_U_UPPERCASE_LETTER}, + {0x000144, 0x000144, PG_U_LOWERCASE_LETTER}, + {0x000145, 0x000145, PG_U_UPPERCASE_LETTER}, + {0x000146, 0x000146, PG_U_LOWERCASE_LETTER}, + {0x000147, 0x000147, PG_U_UPPERCASE_LETTER}, + {0x000148, 0x000149, PG_U_LOWERCASE_LETTER}, + {0x00014a, 0x00014a, PG_U_UPPERCASE_LETTER}, + {0x00014b, 0x00014b, PG_U_LOWERCASE_LETTER}, + {0x00014c, 0x00014c, PG_U_UPPERCASE_LETTER}, + {0x00014d, 0x00014d, PG_U_LOWERCASE_LETTER}, + {0x00014e, 0x00014e, PG_U_UPPERCASE_LETTER}, + {0x00014f, 0x00014f, PG_U_LOWERCASE_LETTER}, + {0x000150, 0x000150, PG_U_UPPERCASE_LETTER}, + {0x000151, 0x000151, PG_U_LOWERCASE_LETTER}, + {0x000152, 0x000152, PG_U_UPPERCASE_LETTER}, + {0x000153, 0x000153, PG_U_LOWERCASE_LETTER}, + {0x000154, 0x000154, PG_U_UPPERCASE_LETTER}, + {0x000155, 0x000155, PG_U_LOWERCASE_LETTER}, + {0x000156, 0x000156, PG_U_UPPERCASE_LETTER}, + {0x000157, 0x000157, PG_U_LOWERCASE_LETTER}, + {0x000158, 0x000158, PG_U_UPPERCASE_LETTER}, + {0x000159, 0x000159, PG_U_LOWERCASE_LETTER}, + {0x00015a, 0x00015a, PG_U_UPPERCASE_LETTER}, + {0x00015b, 0x00015b, PG_U_LOWERCASE_LETTER}, + {0x00015c, 0x00015c, PG_U_UPPERCASE_LETTER}, + {0x00015d, 0x00015d, PG_U_LOWERCASE_LETTER}, + {0x00015e, 0x00015e, PG_U_UPPERCASE_LETTER}, + {0x00015f, 0x00015f, PG_U_LOWERCASE_LETTER}, + {0x000160, 0x000160, PG_U_UPPERCASE_LETTER}, + {0x000161, 0x000161, PG_U_LOWERCASE_LETTER}, + {0x000162, 0x000162, PG_U_UPPERCASE_LETTER}, + {0x000163, 0x000163, PG_U_LOWERCASE_LETTER}, + {0x000164, 0x000164, PG_U_UPPERCASE_LETTER}, + {0x000165, 0x000165, PG_U_LOWERCASE_LETTER}, + {0x000166, 0x000166, PG_U_UPPERCASE_LETTER}, + {0x000167, 0x000167, PG_U_LOWERCASE_LETTER}, + {0x000168, 0x000168, PG_U_UPPERCASE_LETTER}, + {0x000169, 0x000169, PG_U_LOWERCASE_LETTER}, + {0x00016a, 0x00016a, PG_U_UPPERCASE_LETTER}, + {0x00016b, 0x00016b, PG_U_LOWERCASE_LETTER}, + {0x00016c, 0x00016c, PG_U_UPPERCASE_LETTER}, + {0x00016d, 0x00016d, PG_U_LOWERCASE_LETTER}, + {0x00016e, 0x00016e, PG_U_UPPERCASE_LETTER}, + {0x00016f, 0x00016f, PG_U_LOWERCASE_LETTER}, + {0x000170, 0x000170, PG_U_UPPERCASE_LETTER}, + {0x000171, 0x000171, PG_U_LOWERCASE_LETTER}, + {0x000172, 0x000172, PG_U_UPPERCASE_LETTER}, + {0x000173, 0x000173, PG_U_LOWERCASE_LETTER}, + {0x000174, 0x000174, PG_U_UPPERCASE_LETTER}, + {0x000175, 0x000175, PG_U_LOWERCASE_LETTER}, + {0x000176, 0x000176, PG_U_UPPERCASE_LETTER}, + {0x000177, 0x000177, PG_U_LOWERCASE_LETTER}, + {0x000178, 0x000179, PG_U_UPPERCASE_LETTER}, + {0x00017a, 0x00017a, PG_U_LOWERCASE_LETTER}, + {0x00017b, 0x00017b, PG_U_UPPERCASE_LETTER}, + {0x00017c, 0x00017c, PG_U_LOWERCASE_LETTER}, + {0x00017d, 0x00017d, PG_U_UPPERCASE_LETTER}, + {0x00017e, 0x000180, PG_U_LOWERCASE_LETTER}, + {0x000181, 0x000182, PG_U_UPPERCASE_LETTER}, + {0x000183, 0x000183, PG_U_LOWERCASE_LETTER}, + {0x000184, 0x000184, PG_U_UPPERCASE_LETTER}, + {0x000185, 0x000185, PG_U_LOWERCASE_LETTER}, + {0x000186, 0x000187, PG_U_UPPERCASE_LETTER}, + {0x000188, 0x000188, PG_U_LOWERCASE_LETTER}, + {0x000189, 0x00018b, PG_U_UPPERCASE_LETTER}, + {0x00018c, 0x00018d, PG_U_LOWERCASE_LETTER}, + {0x00018e, 0x000191, PG_U_UPPERCASE_LETTER}, + {0x000192, 0x000192, PG_U_LOWERCASE_LETTER}, + {0x000193, 0x000194, PG_U_UPPERCASE_LETTER}, + {0x000195, 0x000195, PG_U_LOWERCASE_LETTER}, + {0x000196, 0x000198, PG_U_UPPERCASE_LETTER}, + {0x000199, 0x00019b, PG_U_LOWERCASE_LETTER}, + {0x00019c, 0x00019d, PG_U_UPPERCASE_LETTER}, + {0x00019e, 0x00019e, PG_U_LOWERCASE_LETTER}, + {0x00019f, 0x0001a0, PG_U_UPPERCASE_LETTER}, + {0x0001a1, 0x0001a1, PG_U_LOWERCASE_LETTER}, + {0x0001a2, 0x0001a2, PG_U_UPPERCASE_LETTER}, + {0x0001a3, 0x0001a3, PG_U_LOWERCASE_LETTER}, + {0x0001a4, 0x0001a4, PG_U_UPPERCASE_LETTER}, + {0x0001a5, 0x0001a5, PG_U_LOWERCASE_LETTER}, + {0x0001a6, 0x0001a7, PG_U_UPPERCASE_LETTER}, + {0x0001a8, 0x0001a8, PG_U_LOWERCASE_LETTER}, + {0x0001a9, 0x0001a9, PG_U_UPPERCASE_LETTER}, + {0x0001aa, 0x0001ab, PG_U_LOWERCASE_LETTER}, + {0x0001ac, 0x0001ac, PG_U_UPPERCASE_LETTER}, + {0x0001ad, 0x0001ad, PG_U_LOWERCASE_LETTER}, + {0x0001ae, 0x0001af, PG_U_UPPERCASE_LETTER}, + {0x0001b0, 0x0001b0, PG_U_LOWERCASE_LETTER}, + {0x0001b1, 0x0001b3, PG_U_UPPERCASE_LETTER}, + {0x0001b4, 0x0001b4, PG_U_LOWERCASE_LETTER}, + {0x0001b5, 0x0001b5, PG_U_UPPERCASE_LETTER}, + {0x0001b6, 0x0001b6, PG_U_LOWERCASE_LETTER}, + {0x0001b7, 0x0001b8, PG_U_UPPERCASE_LETTER}, + {0x0001b9, 0x0001ba, PG_U_LOWERCASE_LETTER}, + {0x0001bb, 0x0001bb, PG_U_OTHER_LETTER}, + {0x0001bc, 0x0001bc, PG_U_UPPERCASE_LETTER}, + {0x0001bd, 0x0001bf, PG_U_LOWERCASE_LETTER}, + {0x0001c0, 0x0001c3, PG_U_OTHER_LETTER}, + {0x0001c4, 0x0001c4, PG_U_UPPERCASE_LETTER}, + {0x0001c5, 0x0001c5, PG_U_TITLECASE_LETTER}, + {0x0001c6, 0x0001c6, PG_U_LOWERCASE_LETTER}, + {0x0001c7, 0x0001c7, PG_U_UPPERCASE_LETTER}, + {0x0001c8, 0x0001c8, PG_U_TITLECASE_LETTER}, + {0x0001c9, 0x0001c9, PG_U_LOWERCASE_LETTER}, + {0x0001ca, 0x0001ca, PG_U_UPPERCASE_LETTER}, + {0x0001cb, 0x0001cb, PG_U_TITLECASE_LETTER}, + {0x0001cc, 0x0001cc, PG_U_LOWERCASE_LETTER}, + {0x0001cd, 0x0001cd, PG_U_UPPERCASE_LETTER}, + {0x0001ce, 0x0001ce, PG_U_LOWERCASE_LETTER}, + {0x0001cf, 0x0001cf, PG_U_UPPERCASE_LETTER}, + {0x0001d0, 0x0001d0, PG_U_LOWERCASE_LETTER}, + {0x0001d1, 0x0001d1, PG_U_UPPERCASE_LETTER}, + {0x0001d2, 0x0001d2, PG_U_LOWERCASE_LETTER}, + {0x0001d3, 0x0001d3, PG_U_UPPERCASE_LETTER}, + {0x0001d4, 0x0001d4, PG_U_LOWERCASE_LETTER}, + {0x0001d5, 0x0001d5, PG_U_UPPERCASE_LETTER}, + {0x0001d6, 0x0001d6, PG_U_LOWERCASE_LETTER}, + {0x0001d7, 0x0001d7, PG_U_UPPERCASE_LETTER}, + {0x0001d8, 0x0001d8, PG_U_LOWERCASE_LETTER}, + {0x0001d9, 0x0001d9, PG_U_UPPERCASE_LETTER}, + {0x0001da, 0x0001da, PG_U_LOWERCASE_LETTER}, + {0x0001db, 0x0001db, PG_U_UPPERCASE_LETTER}, + {0x0001dc, 0x0001dd, PG_U_LOWERCASE_LETTER}, + {0x0001de, 0x0001de, PG_U_UPPERCASE_LETTER}, + {0x0001df, 0x0001df, PG_U_LOWERCASE_LETTER}, + {0x0001e0, 0x0001e0, PG_U_UPPERCASE_LETTER}, + {0x0001e1, 0x0001e1, PG_U_LOWERCASE_LETTER}, + {0x0001e2, 0x0001e2, PG_U_UPPERCASE_LETTER}, + {0x0001e3, 0x0001e3, PG_U_LOWERCASE_LETTER}, + {0x0001e4, 0x0001e4, PG_U_UPPERCASE_LETTER}, + {0x0001e5, 0x0001e5, PG_U_LOWERCASE_LETTER}, + {0x0001e6, 0x0001e6, PG_U_UPPERCASE_LETTER}, + {0x0001e7, 0x0001e7, PG_U_LOWERCASE_LETTER}, + {0x0001e8, 0x0001e8, PG_U_UPPERCASE_LETTER}, + {0x0001e9, 0x0001e9, PG_U_LOWERCASE_LETTER}, + {0x0001ea, 0x0001ea, PG_U_UPPERCASE_LETTER}, + {0x0001eb, 0x0001eb, PG_U_LOWERCASE_LETTER}, + {0x0001ec, 0x0001ec, PG_U_UPPERCASE_LETTER}, + {0x0001ed, 0x0001ed, PG_U_LOWERCASE_LETTER}, + {0x0001ee, 0x0001ee, PG_U_UPPERCASE_LETTER}, + {0x0001ef, 0x0001f0, PG_U_LOWERCASE_LETTER}, + {0x0001f1, 0x0001f1, PG_U_UPPERCASE_LETTER}, + {0x0001f2, 0x0001f2, PG_U_TITLECASE_LETTER}, + {0x0001f3, 0x0001f3, PG_U_LOWERCASE_LETTER}, + {0x0001f4, 0x0001f4, PG_U_UPPERCASE_LETTER}, + {0x0001f5, 0x0001f5, PG_U_LOWERCASE_LETTER}, + {0x0001f6, 0x0001f8, PG_U_UPPERCASE_LETTER}, + {0x0001f9, 0x0001f9, PG_U_LOWERCASE_LETTER}, + {0x0001fa, 0x0001fa, PG_U_UPPERCASE_LETTER}, + {0x0001fb, 0x0001fb, PG_U_LOWERCASE_LETTER}, + {0x0001fc, 0x0001fc, PG_U_UPPERCASE_LETTER}, + {0x0001fd, 0x0001fd, PG_U_LOWERCASE_LETTER}, + {0x0001fe, 0x0001fe, PG_U_UPPERCASE_LETTER}, + {0x0001ff, 0x0001ff, PG_U_LOWERCASE_LETTER}, + {0x000200, 0x000200, PG_U_UPPERCASE_LETTER}, + {0x000201, 0x000201, PG_U_LOWERCASE_LETTER}, + {0x000202, 0x000202, PG_U_UPPERCASE_LETTER}, + {0x000203, 0x000203, PG_U_LOWERCASE_LETTER}, + {0x000204, 0x000204, PG_U_UPPERCASE_LETTER}, + {0x000205, 0x000205, PG_U_LOWERCASE_LETTER}, + {0x000206, 0x000206, PG_U_UPPERCASE_LETTER}, + {0x000207, 0x000207, PG_U_LOWERCASE_LETTER}, + {0x000208, 0x000208, PG_U_UPPERCASE_LETTER}, + {0x000209, 0x000209, PG_U_LOWERCASE_LETTER}, + {0x00020a, 0x00020a, PG_U_UPPERCASE_LETTER}, + {0x00020b, 0x00020b, PG_U_LOWERCASE_LETTER}, + {0x00020c, 0x00020c, PG_U_UPPERCASE_LETTER}, + {0x00020d, 0x00020d, PG_U_LOWERCASE_LETTER}, + {0x00020e, 0x00020e, PG_U_UPPERCASE_LETTER}, + {0x00020f, 0x00020f, PG_U_LOWERCASE_LETTER}, + {0x000210, 0x000210, PG_U_UPPERCASE_LETTER}, + {0x000211, 0x000211, PG_U_LOWERCASE_LETTER}, + {0x000212, 0x000212, PG_U_UPPERCASE_LETTER}, + {0x000213, 0x000213, PG_U_LOWERCASE_LETTER}, + {0x000214, 0x000214, PG_U_UPPERCASE_LETTER}, + {0x000215, 0x000215, PG_U_LOWERCASE_LETTER}, + {0x000216, 0x000216, PG_U_UPPERCASE_LETTER}, + {0x000217, 0x000217, PG_U_LOWERCASE_LETTER}, + {0x000218, 0x000218, PG_U_UPPERCASE_LETTER}, + {0x000219, 0x000219, PG_U_LOWERCASE_LETTER}, + {0x00021a, 0x00021a, PG_U_UPPERCASE_LETTER}, + {0x00021b, 0x00021b, PG_U_LOWERCASE_LETTER}, + {0x00021c, 0x00021c, PG_U_UPPERCASE_LETTER}, + {0x00021d, 0x00021d, PG_U_LOWERCASE_LETTER}, + {0x00021e, 0x00021e, PG_U_UPPERCASE_LETTER}, + {0x00021f, 0x00021f, PG_U_LOWERCASE_LETTER}, + {0x000220, 0x000220, PG_U_UPPERCASE_LETTER}, + {0x000221, 0x000221, PG_U_LOWERCASE_LETTER}, + {0x000222, 0x000222, PG_U_UPPERCASE_LETTER}, + {0x000223, 0x000223, PG_U_LOWERCASE_LETTER}, + {0x000224, 0x000224, PG_U_UPPERCASE_LETTER}, + {0x000225, 0x000225, PG_U_LOWERCASE_LETTER}, + {0x000226, 0x000226, PG_U_UPPERCASE_LETTER}, + {0x000227, 0x000227, PG_U_LOWERCASE_LETTER}, + {0x000228, 0x000228, PG_U_UPPERCASE_LETTER}, + {0x000229, 0x000229, PG_U_LOWERCASE_LETTER}, + {0x00022a, 0x00022a, PG_U_UPPERCASE_LETTER}, + {0x00022b, 0x00022b, PG_U_LOWERCASE_LETTER}, + {0x00022c, 0x00022c, PG_U_UPPERCASE_LETTER}, + {0x00022d, 0x00022d, PG_U_LOWERCASE_LETTER}, + {0x00022e, 0x00022e, PG_U_UPPERCASE_LETTER}, + {0x00022f, 0x00022f, PG_U_LOWERCASE_LETTER}, + {0x000230, 0x000230, PG_U_UPPERCASE_LETTER}, + {0x000231, 0x000231, PG_U_LOWERCASE_LETTER}, + {0x000232, 0x000232, PG_U_UPPERCASE_LETTER}, + {0x000233, 0x000239, PG_U_LOWERCASE_LETTER}, + {0x00023a, 0x00023b, PG_U_UPPERCASE_LETTER}, + {0x00023c, 0x00023c, PG_U_LOWERCASE_LETTER}, + {0x00023d, 0x00023e, PG_U_UPPERCASE_LETTER}, + {0x00023f, 0x000240, PG_U_LOWERCASE_LETTER}, + {0x000241, 0x000241, PG_U_UPPERCASE_LETTER}, + {0x000242, 0x000242, PG_U_LOWERCASE_LETTER}, + {0x000243, 0x000246, PG_U_UPPERCASE_LETTER}, + {0x000247, 0x000247, PG_U_LOWERCASE_LETTER}, + {0x000248, 0x000248, PG_U_UPPERCASE_LETTER}, + {0x000249, 0x000249, PG_U_LOWERCASE_LETTER}, + {0x00024a, 0x00024a, PG_U_UPPERCASE_LETTER}, + {0x00024b, 0x00024b, PG_U_LOWERCASE_LETTER}, + {0x00024c, 0x00024c, PG_U_UPPERCASE_LETTER}, + {0x00024d, 0x00024d, PG_U_LOWERCASE_LETTER}, + {0x00024e, 0x00024e, PG_U_UPPERCASE_LETTER}, + {0x00024f, 0x000293, PG_U_LOWERCASE_LETTER}, + {0x000294, 0x000294, PG_U_OTHER_LETTER}, + {0x000295, 0x0002af, PG_U_LOWERCASE_LETTER}, + {0x0002b0, 0x0002c1, PG_U_MODIFIER_LETTER}, + {0x0002c2, 0x0002c5, PG_U_MODIFIER_SYMBOL}, + {0x0002c6, 0x0002d1, PG_U_MODIFIER_LETTER}, + {0x0002d2, 0x0002df, PG_U_MODIFIER_SYMBOL}, + {0x0002e0, 0x0002e4, PG_U_MODIFIER_LETTER}, + {0x0002e5, 0x0002eb, PG_U_MODIFIER_SYMBOL}, + {0x0002ec, 0x0002ec, PG_U_MODIFIER_LETTER}, + {0x0002ed, 0x0002ed, PG_U_MODIFIER_SYMBOL}, + {0x0002ee, 0x0002ee, PG_U_MODIFIER_LETTER}, + {0x0002ef, 0x0002ff, PG_U_MODIFIER_SYMBOL}, + {0x000300, 0x00036f, PG_U_NONSPACING_MARK}, + {0x000370, 0x000370, PG_U_UPPERCASE_LETTER}, + {0x000371, 0x000371, PG_U_LOWERCASE_LETTER}, + {0x000372, 0x000372, PG_U_UPPERCASE_LETTER}, + {0x000373, 0x000373, PG_U_LOWERCASE_LETTER}, + {0x000374, 0x000374, PG_U_MODIFIER_LETTER}, + {0x000375, 0x000375, PG_U_MODIFIER_SYMBOL}, + {0x000376, 0x000376, PG_U_UPPERCASE_LETTER}, + {0x000377, 0x000377, PG_U_LOWERCASE_LETTER}, + {0x00037a, 0x00037a, PG_U_MODIFIER_LETTER}, + {0x00037b, 0x00037d, PG_U_LOWERCASE_LETTER}, + {0x00037e, 0x00037e, PG_U_OTHER_PUNCTUATION}, + {0x00037f, 0x00037f, PG_U_UPPERCASE_LETTER}, + {0x000384, 0x000385, PG_U_MODIFIER_SYMBOL}, + {0x000386, 0x000386, PG_U_UPPERCASE_LETTER}, + {0x000387, 0x000387, PG_U_OTHER_PUNCTUATION}, + {0x000388, 0x00038a, PG_U_UPPERCASE_LETTER}, + {0x00038c, 0x00038c, PG_U_UPPERCASE_LETTER}, + {0x00038e, 0x00038f, PG_U_UPPERCASE_LETTER}, + {0x000390, 0x000390, PG_U_LOWERCASE_LETTER}, + {0x000391, 0x0003a1, PG_U_UPPERCASE_LETTER}, + {0x0003a3, 0x0003ab, PG_U_UPPERCASE_LETTER}, + {0x0003ac, 0x0003ce, PG_U_LOWERCASE_LETTER}, + {0x0003cf, 0x0003cf, PG_U_UPPERCASE_LETTER}, + {0x0003d0, 0x0003d1, PG_U_LOWERCASE_LETTER}, + {0x0003d2, 0x0003d4, PG_U_UPPERCASE_LETTER}, + {0x0003d5, 0x0003d7, PG_U_LOWERCASE_LETTER}, + {0x0003d8, 0x0003d8, PG_U_UPPERCASE_LETTER}, + {0x0003d9, 0x0003d9, PG_U_LOWERCASE_LETTER}, + {0x0003da, 0x0003da, PG_U_UPPERCASE_LETTER}, + {0x0003db, 0x0003db, PG_U_LOWERCASE_LETTER}, + {0x0003dc, 0x0003dc, PG_U_UPPERCASE_LETTER}, + {0x0003dd, 0x0003dd, PG_U_LOWERCASE_LETTER}, + {0x0003de, 0x0003de, PG_U_UPPERCASE_LETTER}, + {0x0003df, 0x0003df, PG_U_LOWERCASE_LETTER}, + {0x0003e0, 0x0003e0, PG_U_UPPERCASE_LETTER}, + {0x0003e1, 0x0003e1, PG_U_LOWERCASE_LETTER}, + {0x0003e2, 0x0003e2, PG_U_UPPERCASE_LETTER}, + {0x0003e3, 0x0003e3, PG_U_LOWERCASE_LETTER}, + {0x0003e4, 0x0003e4, PG_U_UPPERCASE_LETTER}, + {0x0003e5, 0x0003e5, PG_U_LOWERCASE_LETTER}, + {0x0003e6, 0x0003e6, PG_U_UPPERCASE_LETTER}, + {0x0003e7, 0x0003e7, PG_U_LOWERCASE_LETTER}, + {0x0003e8, 0x0003e8, PG_U_UPPERCASE_LETTER}, + {0x0003e9, 0x0003e9, PG_U_LOWERCASE_LETTER}, + {0x0003ea, 0x0003ea, PG_U_UPPERCASE_LETTER}, + {0x0003eb, 0x0003eb, PG_U_LOWERCASE_LETTER}, + {0x0003ec, 0x0003ec, PG_U_UPPERCASE_LETTER}, + {0x0003ed, 0x0003ed, PG_U_LOWERCASE_LETTER}, + {0x0003ee, 0x0003ee, PG_U_UPPERCASE_LETTER}, + {0x0003ef, 0x0003f3, PG_U_LOWERCASE_LETTER}, + {0x0003f4, 0x0003f4, PG_U_UPPERCASE_LETTER}, + {0x0003f5, 0x0003f5, PG_U_LOWERCASE_LETTER}, + {0x0003f6, 0x0003f6, PG_U_MATH_SYMBOL}, + {0x0003f7, 0x0003f7, PG_U_UPPERCASE_LETTER}, + {0x0003f8, 0x0003f8, PG_U_LOWERCASE_LETTER}, + {0x0003f9, 0x0003fa, PG_U_UPPERCASE_LETTER}, + {0x0003fb, 0x0003fc, PG_U_LOWERCASE_LETTER}, + {0x0003fd, 0x00042f, PG_U_UPPERCASE_LETTER}, + {0x000430, 0x00045f, PG_U_LOWERCASE_LETTER}, + {0x000460, 0x000460, PG_U_UPPERCASE_LETTER}, + {0x000461, 0x000461, PG_U_LOWERCASE_LETTER}, + {0x000462, 0x000462, PG_U_UPPERCASE_LETTER}, + {0x000463, 0x000463, PG_U_LOWERCASE_LETTER}, + {0x000464, 0x000464, PG_U_UPPERCASE_LETTER}, + {0x000465, 0x000465, PG_U_LOWERCASE_LETTER}, + {0x000466, 0x000466, PG_U_UPPERCASE_LETTER}, + {0x000467, 0x000467, PG_U_LOWERCASE_LETTER}, + {0x000468, 0x000468, PG_U_UPPERCASE_LETTER}, + {0x000469, 0x000469, PG_U_LOWERCASE_LETTER}, + {0x00046a, 0x00046a, PG_U_UPPERCASE_LETTER}, + {0x00046b, 0x00046b, PG_U_LOWERCASE_LETTER}, + {0x00046c, 0x00046c, PG_U_UPPERCASE_LETTER}, + {0x00046d, 0x00046d, PG_U_LOWERCASE_LETTER}, + {0x00046e, 0x00046e, PG_U_UPPERCASE_LETTER}, + {0x00046f, 0x00046f, PG_U_LOWERCASE_LETTER}, + {0x000470, 0x000470, PG_U_UPPERCASE_LETTER}, + {0x000471, 0x000471, PG_U_LOWERCASE_LETTER}, + {0x000472, 0x000472, PG_U_UPPERCASE_LETTER}, + {0x000473, 0x000473, PG_U_LOWERCASE_LETTER}, + {0x000474, 0x000474, PG_U_UPPERCASE_LETTER}, + {0x000475, 0x000475, PG_U_LOWERCASE_LETTER}, + {0x000476, 0x000476, PG_U_UPPERCASE_LETTER}, + {0x000477, 0x000477, PG_U_LOWERCASE_LETTER}, + {0x000478, 0x000478, PG_U_UPPERCASE_LETTER}, + {0x000479, 0x000479, PG_U_LOWERCASE_LETTER}, + {0x00047a, 0x00047a, PG_U_UPPERCASE_LETTER}, + {0x00047b, 0x00047b, PG_U_LOWERCASE_LETTER}, + {0x00047c, 0x00047c, PG_U_UPPERCASE_LETTER}, + {0x00047d, 0x00047d, PG_U_LOWERCASE_LETTER}, + {0x00047e, 0x00047e, PG_U_UPPERCASE_LETTER}, + {0x00047f, 0x00047f, PG_U_LOWERCASE_LETTER}, + {0x000480, 0x000480, PG_U_UPPERCASE_LETTER}, + {0x000481, 0x000481, PG_U_LOWERCASE_LETTER}, + {0x000482, 0x000482, PG_U_OTHER_SYMBOL}, + {0x000483, 0x000487, PG_U_NONSPACING_MARK}, + {0x000488, 0x000489, PG_U_ENCLOSING_MARK}, + {0x00048a, 0x00048a, PG_U_UPPERCASE_LETTER}, + {0x00048b, 0x00048b, PG_U_LOWERCASE_LETTER}, + {0x00048c, 0x00048c, PG_U_UPPERCASE_LETTER}, + {0x00048d, 0x00048d, PG_U_LOWERCASE_LETTER}, + {0x00048e, 0x00048e, PG_U_UPPERCASE_LETTER}, + {0x00048f, 0x00048f, PG_U_LOWERCASE_LETTER}, + {0x000490, 0x000490, PG_U_UPPERCASE_LETTER}, + {0x000491, 0x000491, PG_U_LOWERCASE_LETTER}, + {0x000492, 0x000492, PG_U_UPPERCASE_LETTER}, + {0x000493, 0x000493, PG_U_LOWERCASE_LETTER}, + {0x000494, 0x000494, PG_U_UPPERCASE_LETTER}, + {0x000495, 0x000495, PG_U_LOWERCASE_LETTER}, + {0x000496, 0x000496, PG_U_UPPERCASE_LETTER}, + {0x000497, 0x000497, PG_U_LOWERCASE_LETTER}, + {0x000498, 0x000498, PG_U_UPPERCASE_LETTER}, + {0x000499, 0x000499, PG_U_LOWERCASE_LETTER}, + {0x00049a, 0x00049a, PG_U_UPPERCASE_LETTER}, + {0x00049b, 0x00049b, PG_U_LOWERCASE_LETTER}, + {0x00049c, 0x00049c, PG_U_UPPERCASE_LETTER}, + {0x00049d, 0x00049d, PG_U_LOWERCASE_LETTER}, + {0x00049e, 0x00049e, PG_U_UPPERCASE_LETTER}, + {0x00049f, 0x00049f, PG_U_LOWERCASE_LETTER}, + {0x0004a0, 0x0004a0, PG_U_UPPERCASE_LETTER}, + {0x0004a1, 0x0004a1, PG_U_LOWERCASE_LETTER}, + {0x0004a2, 0x0004a2, PG_U_UPPERCASE_LETTER}, + {0x0004a3, 0x0004a3, PG_U_LOWERCASE_LETTER}, + {0x0004a4, 0x0004a4, PG_U_UPPERCASE_LETTER}, + {0x0004a5, 0x0004a5, PG_U_LOWERCASE_LETTER}, + {0x0004a6, 0x0004a6, PG_U_UPPERCASE_LETTER}, + {0x0004a7, 0x0004a7, PG_U_LOWERCASE_LETTER}, + {0x0004a8, 0x0004a8, PG_U_UPPERCASE_LETTER}, + {0x0004a9, 0x0004a9, PG_U_LOWERCASE_LETTER}, + {0x0004aa, 0x0004aa, PG_U_UPPERCASE_LETTER}, + {0x0004ab, 0x0004ab, PG_U_LOWERCASE_LETTER}, + {0x0004ac, 0x0004ac, PG_U_UPPERCASE_LETTER}, + {0x0004ad, 0x0004ad, PG_U_LOWERCASE_LETTER}, + {0x0004ae, 0x0004ae, PG_U_UPPERCASE_LETTER}, + {0x0004af, 0x0004af, PG_U_LOWERCASE_LETTER}, + {0x0004b0, 0x0004b0, PG_U_UPPERCASE_LETTER}, + {0x0004b1, 0x0004b1, PG_U_LOWERCASE_LETTER}, + {0x0004b2, 0x0004b2, PG_U_UPPERCASE_LETTER}, + {0x0004b3, 0x0004b3, PG_U_LOWERCASE_LETTER}, + {0x0004b4, 0x0004b4, PG_U_UPPERCASE_LETTER}, + {0x0004b5, 0x0004b5, PG_U_LOWERCASE_LETTER}, + {0x0004b6, 0x0004b6, PG_U_UPPERCASE_LETTER}, + {0x0004b7, 0x0004b7, PG_U_LOWERCASE_LETTER}, + {0x0004b8, 0x0004b8, PG_U_UPPERCASE_LETTER}, + {0x0004b9, 0x0004b9, PG_U_LOWERCASE_LETTER}, + {0x0004ba, 0x0004ba, PG_U_UPPERCASE_LETTER}, + {0x0004bb, 0x0004bb, PG_U_LOWERCASE_LETTER}, + {0x0004bc, 0x0004bc, PG_U_UPPERCASE_LETTER}, + {0x0004bd, 0x0004bd, PG_U_LOWERCASE_LETTER}, + {0x0004be, 0x0004be, PG_U_UPPERCASE_LETTER}, + {0x0004bf, 0x0004bf, PG_U_LOWERCASE_LETTER}, + {0x0004c0, 0x0004c1, PG_U_UPPERCASE_LETTER}, + {0x0004c2, 0x0004c2, PG_U_LOWERCASE_LETTER}, + {0x0004c3, 0x0004c3, PG_U_UPPERCASE_LETTER}, + {0x0004c4, 0x0004c4, PG_U_LOWERCASE_LETTER}, + {0x0004c5, 0x0004c5, PG_U_UPPERCASE_LETTER}, + {0x0004c6, 0x0004c6, PG_U_LOWERCASE_LETTER}, + {0x0004c7, 0x0004c7, PG_U_UPPERCASE_LETTER}, + {0x0004c8, 0x0004c8, PG_U_LOWERCASE_LETTER}, + {0x0004c9, 0x0004c9, PG_U_UPPERCASE_LETTER}, + {0x0004ca, 0x0004ca, PG_U_LOWERCASE_LETTER}, + {0x0004cb, 0x0004cb, PG_U_UPPERCASE_LETTER}, + {0x0004cc, 0x0004cc, PG_U_LOWERCASE_LETTER}, + {0x0004cd, 0x0004cd, PG_U_UPPERCASE_LETTER}, + {0x0004ce, 0x0004cf, PG_U_LOWERCASE_LETTER}, + {0x0004d0, 0x0004d0, PG_U_UPPERCASE_LETTER}, + {0x0004d1, 0x0004d1, PG_U_LOWERCASE_LETTER}, + {0x0004d2, 0x0004d2, PG_U_UPPERCASE_LETTER}, + {0x0004d3, 0x0004d3, PG_U_LOWERCASE_LETTER}, + {0x0004d4, 0x0004d4, PG_U_UPPERCASE_LETTER}, + {0x0004d5, 0x0004d5, PG_U_LOWERCASE_LETTER}, + {0x0004d6, 0x0004d6, PG_U_UPPERCASE_LETTER}, + {0x0004d7, 0x0004d7, PG_U_LOWERCASE_LETTER}, + {0x0004d8, 0x0004d8, PG_U_UPPERCASE_LETTER}, + {0x0004d9, 0x0004d9, PG_U_LOWERCASE_LETTER}, + {0x0004da, 0x0004da, PG_U_UPPERCASE_LETTER}, + {0x0004db, 0x0004db, PG_U_LOWERCASE_LETTER}, + {0x0004dc, 0x0004dc, PG_U_UPPERCASE_LETTER}, + {0x0004dd, 0x0004dd, PG_U_LOWERCASE_LETTER}, + {0x0004de, 0x0004de, PG_U_UPPERCASE_LETTER}, + {0x0004df, 0x0004df, PG_U_LOWERCASE_LETTER}, + {0x0004e0, 0x0004e0, PG_U_UPPERCASE_LETTER}, + {0x0004e1, 0x0004e1, PG_U_LOWERCASE_LETTER}, + {0x0004e2, 0x0004e2, PG_U_UPPERCASE_LETTER}, + {0x0004e3, 0x0004e3, PG_U_LOWERCASE_LETTER}, + {0x0004e4, 0x0004e4, PG_U_UPPERCASE_LETTER}, + {0x0004e5, 0x0004e5, PG_U_LOWERCASE_LETTER}, + {0x0004e6, 0x0004e6, PG_U_UPPERCASE_LETTER}, + {0x0004e7, 0x0004e7, PG_U_LOWERCASE_LETTER}, + {0x0004e8, 0x0004e8, PG_U_UPPERCASE_LETTER}, + {0x0004e9, 0x0004e9, PG_U_LOWERCASE_LETTER}, + {0x0004ea, 0x0004ea, PG_U_UPPERCASE_LETTER}, + {0x0004eb, 0x0004eb, PG_U_LOWERCASE_LETTER}, + {0x0004ec, 0x0004ec, PG_U_UPPERCASE_LETTER}, + {0x0004ed, 0x0004ed, PG_U_LOWERCASE_LETTER}, + {0x0004ee, 0x0004ee, PG_U_UPPERCASE_LETTER}, + {0x0004ef, 0x0004ef, PG_U_LOWERCASE_LETTER}, + {0x0004f0, 0x0004f0, PG_U_UPPERCASE_LETTER}, + {0x0004f1, 0x0004f1, PG_U_LOWERCASE_LETTER}, + {0x0004f2, 0x0004f2, PG_U_UPPERCASE_LETTER}, + {0x0004f3, 0x0004f3, PG_U_LOWERCASE_LETTER}, + {0x0004f4, 0x0004f4, PG_U_UPPERCASE_LETTER}, + {0x0004f5, 0x0004f5, PG_U_LOWERCASE_LETTER}, + {0x0004f6, 0x0004f6, PG_U_UPPERCASE_LETTER}, + {0x0004f7, 0x0004f7, PG_U_LOWERCASE_LETTER}, + {0x0004f8, 0x0004f8, PG_U_UPPERCASE_LETTER}, + {0x0004f9, 0x0004f9, PG_U_LOWERCASE_LETTER}, + {0x0004fa, 0x0004fa, PG_U_UPPERCASE_LETTER}, + {0x0004fb, 0x0004fb, PG_U_LOWERCASE_LETTER}, + {0x0004fc, 0x0004fc, PG_U_UPPERCASE_LETTER}, + {0x0004fd, 0x0004fd, PG_U_LOWERCASE_LETTER}, + {0x0004fe, 0x0004fe, PG_U_UPPERCASE_LETTER}, + {0x0004ff, 0x0004ff, PG_U_LOWERCASE_LETTER}, + {0x000500, 0x000500, PG_U_UPPERCASE_LETTER}, + {0x000501, 0x000501, PG_U_LOWERCASE_LETTER}, + {0x000502, 0x000502, PG_U_UPPERCASE_LETTER}, + {0x000503, 0x000503, PG_U_LOWERCASE_LETTER}, + {0x000504, 0x000504, PG_U_UPPERCASE_LETTER}, + {0x000505, 0x000505, PG_U_LOWERCASE_LETTER}, + {0x000506, 0x000506, PG_U_UPPERCASE_LETTER}, + {0x000507, 0x000507, PG_U_LOWERCASE_LETTER}, + {0x000508, 0x000508, PG_U_UPPERCASE_LETTER}, + {0x000509, 0x000509, PG_U_LOWERCASE_LETTER}, + {0x00050a, 0x00050a, PG_U_UPPERCASE_LETTER}, + {0x00050b, 0x00050b, PG_U_LOWERCASE_LETTER}, + {0x00050c, 0x00050c, PG_U_UPPERCASE_LETTER}, + {0x00050d, 0x00050d, PG_U_LOWERCASE_LETTER}, + {0x00050e, 0x00050e, PG_U_UPPERCASE_LETTER}, + {0x00050f, 0x00050f, PG_U_LOWERCASE_LETTER}, + {0x000510, 0x000510, PG_U_UPPERCASE_LETTER}, + {0x000511, 0x000511, PG_U_LOWERCASE_LETTER}, + {0x000512, 0x000512, PG_U_UPPERCASE_LETTER}, + {0x000513, 0x000513, PG_U_LOWERCASE_LETTER}, + {0x000514, 0x000514, PG_U_UPPERCASE_LETTER}, + {0x000515, 0x000515, PG_U_LOWERCASE_LETTER}, + {0x000516, 0x000516, PG_U_UPPERCASE_LETTER}, + {0x000517, 0x000517, PG_U_LOWERCASE_LETTER}, + {0x000518, 0x000518, PG_U_UPPERCASE_LETTER}, + {0x000519, 0x000519, PG_U_LOWERCASE_LETTER}, + {0x00051a, 0x00051a, PG_U_UPPERCASE_LETTER}, + {0x00051b, 0x00051b, PG_U_LOWERCASE_LETTER}, + {0x00051c, 0x00051c, PG_U_UPPERCASE_LETTER}, + {0x00051d, 0x00051d, PG_U_LOWERCASE_LETTER}, + {0x00051e, 0x00051e, PG_U_UPPERCASE_LETTER}, + {0x00051f, 0x00051f, PG_U_LOWERCASE_LETTER}, + {0x000520, 0x000520, PG_U_UPPERCASE_LETTER}, + {0x000521, 0x000521, PG_U_LOWERCASE_LETTER}, + {0x000522, 0x000522, PG_U_UPPERCASE_LETTER}, + {0x000523, 0x000523, PG_U_LOWERCASE_LETTER}, + {0x000524, 0x000524, PG_U_UPPERCASE_LETTER}, + {0x000525, 0x000525, PG_U_LOWERCASE_LETTER}, + {0x000526, 0x000526, PG_U_UPPERCASE_LETTER}, + {0x000527, 0x000527, PG_U_LOWERCASE_LETTER}, + {0x000528, 0x000528, PG_U_UPPERCASE_LETTER}, + {0x000529, 0x000529, PG_U_LOWERCASE_LETTER}, + {0x00052a, 0x00052a, PG_U_UPPERCASE_LETTER}, + {0x00052b, 0x00052b, PG_U_LOWERCASE_LETTER}, + {0x00052c, 0x00052c, PG_U_UPPERCASE_LETTER}, + {0x00052d, 0x00052d, PG_U_LOWERCASE_LETTER}, + {0x00052e, 0x00052e, PG_U_UPPERCASE_LETTER}, + {0x00052f, 0x00052f, PG_U_LOWERCASE_LETTER}, + {0x000531, 0x000556, PG_U_UPPERCASE_LETTER}, + {0x000559, 0x000559, PG_U_MODIFIER_LETTER}, + {0x00055a, 0x00055f, PG_U_OTHER_PUNCTUATION}, + {0x000560, 0x000588, PG_U_LOWERCASE_LETTER}, + {0x000589, 0x000589, PG_U_OTHER_PUNCTUATION}, + {0x00058a, 0x00058a, PG_U_DASH_PUNCTUATION}, + {0x00058d, 0x00058e, PG_U_OTHER_SYMBOL}, + {0x00058f, 0x00058f, PG_U_CURRENCY_SYMBOL}, + {0x000591, 0x0005bd, PG_U_NONSPACING_MARK}, + {0x0005be, 0x0005be, PG_U_DASH_PUNCTUATION}, + {0x0005bf, 0x0005bf, PG_U_NONSPACING_MARK}, + {0x0005c0, 0x0005c0, PG_U_OTHER_PUNCTUATION}, + {0x0005c1, 0x0005c2, PG_U_NONSPACING_MARK}, + {0x0005c3, 0x0005c3, PG_U_OTHER_PUNCTUATION}, + {0x0005c4, 0x0005c5, PG_U_NONSPACING_MARK}, + {0x0005c6, 0x0005c6, PG_U_OTHER_PUNCTUATION}, + {0x0005c7, 0x0005c7, PG_U_NONSPACING_MARK}, + {0x0005d0, 0x0005ea, PG_U_OTHER_LETTER}, + {0x0005ef, 0x0005f2, PG_U_OTHER_LETTER}, + {0x0005f3, 0x0005f4, PG_U_OTHER_PUNCTUATION}, + {0x000600, 0x000605, PG_U_FORMAT}, + {0x000606, 0x000608, PG_U_MATH_SYMBOL}, + {0x000609, 0x00060a, PG_U_OTHER_PUNCTUATION}, + {0x00060b, 0x00060b, PG_U_CURRENCY_SYMBOL}, + {0x00060c, 0x00060d, PG_U_OTHER_PUNCTUATION}, + {0x00060e, 0x00060f, PG_U_OTHER_SYMBOL}, + {0x000610, 0x00061a, PG_U_NONSPACING_MARK}, + {0x00061b, 0x00061b, PG_U_OTHER_PUNCTUATION}, + {0x00061c, 0x00061c, PG_U_FORMAT}, + {0x00061d, 0x00061f, PG_U_OTHER_PUNCTUATION}, + {0x000620, 0x00063f, PG_U_OTHER_LETTER}, + {0x000640, 0x000640, PG_U_MODIFIER_LETTER}, + {0x000641, 0x00064a, PG_U_OTHER_LETTER}, + {0x00064b, 0x00065f, PG_U_NONSPACING_MARK}, + {0x000660, 0x000669, PG_U_DECIMAL_NUMBER}, + {0x00066a, 0x00066d, PG_U_OTHER_PUNCTUATION}, + {0x00066e, 0x00066f, PG_U_OTHER_LETTER}, + {0x000670, 0x000670, PG_U_NONSPACING_MARK}, + {0x000671, 0x0006d3, PG_U_OTHER_LETTER}, + {0x0006d4, 0x0006d4, PG_U_OTHER_PUNCTUATION}, + {0x0006d5, 0x0006d5, PG_U_OTHER_LETTER}, + {0x0006d6, 0x0006dc, PG_U_NONSPACING_MARK}, + {0x0006dd, 0x0006dd, PG_U_FORMAT}, + {0x0006de, 0x0006de, PG_U_OTHER_SYMBOL}, + {0x0006df, 0x0006e4, PG_U_NONSPACING_MARK}, + {0x0006e5, 0x0006e6, PG_U_MODIFIER_LETTER}, + {0x0006e7, 0x0006e8, PG_U_NONSPACING_MARK}, + {0x0006e9, 0x0006e9, PG_U_OTHER_SYMBOL}, + {0x0006ea, 0x0006ed, PG_U_NONSPACING_MARK}, + {0x0006ee, 0x0006ef, PG_U_OTHER_LETTER}, + {0x0006f0, 0x0006f9, PG_U_DECIMAL_NUMBER}, + {0x0006fa, 0x0006fc, PG_U_OTHER_LETTER}, + {0x0006fd, 0x0006fe, PG_U_OTHER_SYMBOL}, + {0x0006ff, 0x0006ff, PG_U_OTHER_LETTER}, + {0x000700, 0x00070d, PG_U_OTHER_PUNCTUATION}, + {0x00070f, 0x00070f, PG_U_FORMAT}, + {0x000710, 0x000710, PG_U_OTHER_LETTER}, + {0x000711, 0x000711, PG_U_NONSPACING_MARK}, + {0x000712, 0x00072f, PG_U_OTHER_LETTER}, + {0x000730, 0x00074a, PG_U_NONSPACING_MARK}, + {0x00074d, 0x0007a5, PG_U_OTHER_LETTER}, + {0x0007a6, 0x0007b0, PG_U_NONSPACING_MARK}, + {0x0007b1, 0x0007b1, PG_U_OTHER_LETTER}, + {0x0007c0, 0x0007c9, PG_U_DECIMAL_NUMBER}, + {0x0007ca, 0x0007ea, PG_U_OTHER_LETTER}, + {0x0007eb, 0x0007f3, PG_U_NONSPACING_MARK}, + {0x0007f4, 0x0007f5, PG_U_MODIFIER_LETTER}, + {0x0007f6, 0x0007f6, PG_U_OTHER_SYMBOL}, + {0x0007f7, 0x0007f9, PG_U_OTHER_PUNCTUATION}, + {0x0007fa, 0x0007fa, PG_U_MODIFIER_LETTER}, + {0x0007fd, 0x0007fd, PG_U_NONSPACING_MARK}, + {0x0007fe, 0x0007ff, PG_U_CURRENCY_SYMBOL}, + {0x000800, 0x000815, PG_U_OTHER_LETTER}, + {0x000816, 0x000819, PG_U_NONSPACING_MARK}, + {0x00081a, 0x00081a, PG_U_MODIFIER_LETTER}, + {0x00081b, 0x000823, PG_U_NONSPACING_MARK}, + {0x000824, 0x000824, PG_U_MODIFIER_LETTER}, + {0x000825, 0x000827, PG_U_NONSPACING_MARK}, + {0x000828, 0x000828, PG_U_MODIFIER_LETTER}, + {0x000829, 0x00082d, PG_U_NONSPACING_MARK}, + {0x000830, 0x00083e, PG_U_OTHER_PUNCTUATION}, + {0x000840, 0x000858, PG_U_OTHER_LETTER}, + {0x000859, 0x00085b, PG_U_NONSPACING_MARK}, + {0x00085e, 0x00085e, PG_U_OTHER_PUNCTUATION}, + {0x000860, 0x00086a, PG_U_OTHER_LETTER}, + {0x000870, 0x000887, PG_U_OTHER_LETTER}, + {0x000888, 0x000888, PG_U_MODIFIER_SYMBOL}, + {0x000889, 0x00088e, PG_U_OTHER_LETTER}, + {0x000890, 0x000891, PG_U_FORMAT}, + {0x000897, 0x00089f, PG_U_NONSPACING_MARK}, + {0x0008a0, 0x0008c8, PG_U_OTHER_LETTER}, + {0x0008c9, 0x0008c9, PG_U_MODIFIER_LETTER}, + {0x0008ca, 0x0008e1, PG_U_NONSPACING_MARK}, + {0x0008e2, 0x0008e2, PG_U_FORMAT}, + {0x0008e3, 0x000902, PG_U_NONSPACING_MARK}, + {0x000903, 0x000903, PG_U_SPACING_MARK}, + {0x000904, 0x000939, PG_U_OTHER_LETTER}, + {0x00093a, 0x00093a, PG_U_NONSPACING_MARK}, + {0x00093b, 0x00093b, PG_U_SPACING_MARK}, + {0x00093c, 0x00093c, PG_U_NONSPACING_MARK}, + {0x00093d, 0x00093d, PG_U_OTHER_LETTER}, + {0x00093e, 0x000940, PG_U_SPACING_MARK}, + {0x000941, 0x000948, PG_U_NONSPACING_MARK}, + {0x000949, 0x00094c, PG_U_SPACING_MARK}, + {0x00094d, 0x00094d, PG_U_NONSPACING_MARK}, + {0x00094e, 0x00094f, PG_U_SPACING_MARK}, + {0x000950, 0x000950, PG_U_OTHER_LETTER}, + {0x000951, 0x000957, PG_U_NONSPACING_MARK}, + {0x000958, 0x000961, PG_U_OTHER_LETTER}, + {0x000962, 0x000963, PG_U_NONSPACING_MARK}, + {0x000964, 0x000965, PG_U_OTHER_PUNCTUATION}, + {0x000966, 0x00096f, PG_U_DECIMAL_NUMBER}, + {0x000970, 0x000970, PG_U_OTHER_PUNCTUATION}, + {0x000971, 0x000971, PG_U_MODIFIER_LETTER}, + {0x000972, 0x000980, PG_U_OTHER_LETTER}, + {0x000981, 0x000981, PG_U_NONSPACING_MARK}, + {0x000982, 0x000983, PG_U_SPACING_MARK}, + {0x000985, 0x00098c, PG_U_OTHER_LETTER}, + {0x00098f, 0x000990, PG_U_OTHER_LETTER}, + {0x000993, 0x0009a8, PG_U_OTHER_LETTER}, + {0x0009aa, 0x0009b0, PG_U_OTHER_LETTER}, + {0x0009b2, 0x0009b2, PG_U_OTHER_LETTER}, + {0x0009b6, 0x0009b9, PG_U_OTHER_LETTER}, + {0x0009bc, 0x0009bc, PG_U_NONSPACING_MARK}, + {0x0009bd, 0x0009bd, PG_U_OTHER_LETTER}, + {0x0009be, 0x0009c0, PG_U_SPACING_MARK}, + {0x0009c1, 0x0009c4, PG_U_NONSPACING_MARK}, + {0x0009c7, 0x0009c8, PG_U_SPACING_MARK}, + {0x0009cb, 0x0009cc, PG_U_SPACING_MARK}, + {0x0009cd, 0x0009cd, PG_U_NONSPACING_MARK}, + {0x0009ce, 0x0009ce, PG_U_OTHER_LETTER}, + {0x0009d7, 0x0009d7, PG_U_SPACING_MARK}, + {0x0009dc, 0x0009dd, PG_U_OTHER_LETTER}, + {0x0009df, 0x0009e1, PG_U_OTHER_LETTER}, + {0x0009e2, 0x0009e3, PG_U_NONSPACING_MARK}, + {0x0009e6, 0x0009ef, PG_U_DECIMAL_NUMBER}, + {0x0009f0, 0x0009f1, PG_U_OTHER_LETTER}, + {0x0009f2, 0x0009f3, PG_U_CURRENCY_SYMBOL}, + {0x0009f4, 0x0009f9, PG_U_OTHER_NUMBER}, + {0x0009fa, 0x0009fa, PG_U_OTHER_SYMBOL}, + {0x0009fb, 0x0009fb, PG_U_CURRENCY_SYMBOL}, + {0x0009fc, 0x0009fc, PG_U_OTHER_LETTER}, + {0x0009fd, 0x0009fd, PG_U_OTHER_PUNCTUATION}, + {0x0009fe, 0x0009fe, PG_U_NONSPACING_MARK}, + {0x000a01, 0x000a02, PG_U_NONSPACING_MARK}, + {0x000a03, 0x000a03, PG_U_SPACING_MARK}, + {0x000a05, 0x000a0a, PG_U_OTHER_LETTER}, + {0x000a0f, 0x000a10, PG_U_OTHER_LETTER}, + {0x000a13, 0x000a28, PG_U_OTHER_LETTER}, + {0x000a2a, 0x000a30, PG_U_OTHER_LETTER}, + {0x000a32, 0x000a33, PG_U_OTHER_LETTER}, + {0x000a35, 0x000a36, PG_U_OTHER_LETTER}, + {0x000a38, 0x000a39, PG_U_OTHER_LETTER}, + {0x000a3c, 0x000a3c, PG_U_NONSPACING_MARK}, + {0x000a3e, 0x000a40, PG_U_SPACING_MARK}, + {0x000a41, 0x000a42, PG_U_NONSPACING_MARK}, + {0x000a47, 0x000a48, PG_U_NONSPACING_MARK}, + {0x000a4b, 0x000a4d, PG_U_NONSPACING_MARK}, + {0x000a51, 0x000a51, PG_U_NONSPACING_MARK}, + {0x000a59, 0x000a5c, PG_U_OTHER_LETTER}, + {0x000a5e, 0x000a5e, PG_U_OTHER_LETTER}, + {0x000a66, 0x000a6f, PG_U_DECIMAL_NUMBER}, + {0x000a70, 0x000a71, PG_U_NONSPACING_MARK}, + {0x000a72, 0x000a74, PG_U_OTHER_LETTER}, + {0x000a75, 0x000a75, PG_U_NONSPACING_MARK}, + {0x000a76, 0x000a76, PG_U_OTHER_PUNCTUATION}, + {0x000a81, 0x000a82, PG_U_NONSPACING_MARK}, + {0x000a83, 0x000a83, PG_U_SPACING_MARK}, + {0x000a85, 0x000a8d, PG_U_OTHER_LETTER}, + {0x000a8f, 0x000a91, PG_U_OTHER_LETTER}, + {0x000a93, 0x000aa8, PG_U_OTHER_LETTER}, + {0x000aaa, 0x000ab0, PG_U_OTHER_LETTER}, + {0x000ab2, 0x000ab3, PG_U_OTHER_LETTER}, + {0x000ab5, 0x000ab9, PG_U_OTHER_LETTER}, + {0x000abc, 0x000abc, PG_U_NONSPACING_MARK}, + {0x000abd, 0x000abd, PG_U_OTHER_LETTER}, + {0x000abe, 0x000ac0, PG_U_SPACING_MARK}, + {0x000ac1, 0x000ac5, PG_U_NONSPACING_MARK}, + {0x000ac7, 0x000ac8, PG_U_NONSPACING_MARK}, + {0x000ac9, 0x000ac9, PG_U_SPACING_MARK}, + {0x000acb, 0x000acc, PG_U_SPACING_MARK}, + {0x000acd, 0x000acd, PG_U_NONSPACING_MARK}, + {0x000ad0, 0x000ad0, PG_U_OTHER_LETTER}, + {0x000ae0, 0x000ae1, PG_U_OTHER_LETTER}, + {0x000ae2, 0x000ae3, PG_U_NONSPACING_MARK}, + {0x000ae6, 0x000aef, PG_U_DECIMAL_NUMBER}, + {0x000af0, 0x000af0, PG_U_OTHER_PUNCTUATION}, + {0x000af1, 0x000af1, PG_U_CURRENCY_SYMBOL}, + {0x000af9, 0x000af9, PG_U_OTHER_LETTER}, + {0x000afa, 0x000aff, PG_U_NONSPACING_MARK}, + {0x000b01, 0x000b01, PG_U_NONSPACING_MARK}, + {0x000b02, 0x000b03, PG_U_SPACING_MARK}, + {0x000b05, 0x000b0c, PG_U_OTHER_LETTER}, + {0x000b0f, 0x000b10, PG_U_OTHER_LETTER}, + {0x000b13, 0x000b28, PG_U_OTHER_LETTER}, + {0x000b2a, 0x000b30, PG_U_OTHER_LETTER}, + {0x000b32, 0x000b33, PG_U_OTHER_LETTER}, + {0x000b35, 0x000b39, PG_U_OTHER_LETTER}, + {0x000b3c, 0x000b3c, PG_U_NONSPACING_MARK}, + {0x000b3d, 0x000b3d, PG_U_OTHER_LETTER}, + {0x000b3e, 0x000b3e, PG_U_SPACING_MARK}, + {0x000b3f, 0x000b3f, PG_U_NONSPACING_MARK}, + {0x000b40, 0x000b40, PG_U_SPACING_MARK}, + {0x000b41, 0x000b44, PG_U_NONSPACING_MARK}, + {0x000b47, 0x000b48, PG_U_SPACING_MARK}, + {0x000b4b, 0x000b4c, PG_U_SPACING_MARK}, + {0x000b4d, 0x000b4d, PG_U_NONSPACING_MARK}, + {0x000b55, 0x000b56, PG_U_NONSPACING_MARK}, + {0x000b57, 0x000b57, PG_U_SPACING_MARK}, + {0x000b5c, 0x000b5d, PG_U_OTHER_LETTER}, + {0x000b5f, 0x000b61, PG_U_OTHER_LETTER}, + {0x000b62, 0x000b63, PG_U_NONSPACING_MARK}, + {0x000b66, 0x000b6f, PG_U_DECIMAL_NUMBER}, + {0x000b70, 0x000b70, PG_U_OTHER_SYMBOL}, + {0x000b71, 0x000b71, PG_U_OTHER_LETTER}, + {0x000b72, 0x000b77, PG_U_OTHER_NUMBER}, + {0x000b82, 0x000b82, PG_U_NONSPACING_MARK}, + {0x000b83, 0x000b83, PG_U_OTHER_LETTER}, + {0x000b85, 0x000b8a, PG_U_OTHER_LETTER}, + {0x000b8e, 0x000b90, PG_U_OTHER_LETTER}, + {0x000b92, 0x000b95, PG_U_OTHER_LETTER}, + {0x000b99, 0x000b9a, PG_U_OTHER_LETTER}, + {0x000b9c, 0x000b9c, PG_U_OTHER_LETTER}, + {0x000b9e, 0x000b9f, PG_U_OTHER_LETTER}, + {0x000ba3, 0x000ba4, PG_U_OTHER_LETTER}, + {0x000ba8, 0x000baa, PG_U_OTHER_LETTER}, + {0x000bae, 0x000bb9, PG_U_OTHER_LETTER}, + {0x000bbe, 0x000bbf, PG_U_SPACING_MARK}, + {0x000bc0, 0x000bc0, PG_U_NONSPACING_MARK}, + {0x000bc1, 0x000bc2, PG_U_SPACING_MARK}, + {0x000bc6, 0x000bc8, PG_U_SPACING_MARK}, + {0x000bca, 0x000bcc, PG_U_SPACING_MARK}, + {0x000bcd, 0x000bcd, PG_U_NONSPACING_MARK}, + {0x000bd0, 0x000bd0, PG_U_OTHER_LETTER}, + {0x000bd7, 0x000bd7, PG_U_SPACING_MARK}, + {0x000be6, 0x000bef, PG_U_DECIMAL_NUMBER}, + {0x000bf0, 0x000bf2, PG_U_OTHER_NUMBER}, + {0x000bf3, 0x000bf8, PG_U_OTHER_SYMBOL}, + {0x000bf9, 0x000bf9, PG_U_CURRENCY_SYMBOL}, + {0x000bfa, 0x000bfa, PG_U_OTHER_SYMBOL}, + {0x000c00, 0x000c00, PG_U_NONSPACING_MARK}, + {0x000c01, 0x000c03, PG_U_SPACING_MARK}, + {0x000c04, 0x000c04, PG_U_NONSPACING_MARK}, + {0x000c05, 0x000c0c, PG_U_OTHER_LETTER}, + {0x000c0e, 0x000c10, PG_U_OTHER_LETTER}, + {0x000c12, 0x000c28, PG_U_OTHER_LETTER}, + {0x000c2a, 0x000c39, PG_U_OTHER_LETTER}, + {0x000c3c, 0x000c3c, PG_U_NONSPACING_MARK}, + {0x000c3d, 0x000c3d, PG_U_OTHER_LETTER}, + {0x000c3e, 0x000c40, PG_U_NONSPACING_MARK}, + {0x000c41, 0x000c44, PG_U_SPACING_MARK}, + {0x000c46, 0x000c48, PG_U_NONSPACING_MARK}, + {0x000c4a, 0x000c4d, PG_U_NONSPACING_MARK}, + {0x000c55, 0x000c56, PG_U_NONSPACING_MARK}, + {0x000c58, 0x000c5a, PG_U_OTHER_LETTER}, + {0x000c5d, 0x000c5d, PG_U_OTHER_LETTER}, + {0x000c60, 0x000c61, PG_U_OTHER_LETTER}, + {0x000c62, 0x000c63, PG_U_NONSPACING_MARK}, + {0x000c66, 0x000c6f, PG_U_DECIMAL_NUMBER}, + {0x000c77, 0x000c77, PG_U_OTHER_PUNCTUATION}, + {0x000c78, 0x000c7e, PG_U_OTHER_NUMBER}, + {0x000c7f, 0x000c7f, PG_U_OTHER_SYMBOL}, + {0x000c80, 0x000c80, PG_U_OTHER_LETTER}, + {0x000c81, 0x000c81, PG_U_NONSPACING_MARK}, + {0x000c82, 0x000c83, PG_U_SPACING_MARK}, + {0x000c84, 0x000c84, PG_U_OTHER_PUNCTUATION}, + {0x000c85, 0x000c8c, PG_U_OTHER_LETTER}, + {0x000c8e, 0x000c90, PG_U_OTHER_LETTER}, + {0x000c92, 0x000ca8, PG_U_OTHER_LETTER}, + {0x000caa, 0x000cb3, PG_U_OTHER_LETTER}, + {0x000cb5, 0x000cb9, PG_U_OTHER_LETTER}, + {0x000cbc, 0x000cbc, PG_U_NONSPACING_MARK}, + {0x000cbd, 0x000cbd, PG_U_OTHER_LETTER}, + {0x000cbe, 0x000cbe, PG_U_SPACING_MARK}, + {0x000cbf, 0x000cbf, PG_U_NONSPACING_MARK}, + {0x000cc0, 0x000cc4, PG_U_SPACING_MARK}, + {0x000cc6, 0x000cc6, PG_U_NONSPACING_MARK}, + {0x000cc7, 0x000cc8, PG_U_SPACING_MARK}, + {0x000cca, 0x000ccb, PG_U_SPACING_MARK}, + {0x000ccc, 0x000ccd, PG_U_NONSPACING_MARK}, + {0x000cd5, 0x000cd6, PG_U_SPACING_MARK}, + {0x000cdd, 0x000cde, PG_U_OTHER_LETTER}, + {0x000ce0, 0x000ce1, PG_U_OTHER_LETTER}, + {0x000ce2, 0x000ce3, PG_U_NONSPACING_MARK}, + {0x000ce6, 0x000cef, PG_U_DECIMAL_NUMBER}, + {0x000cf1, 0x000cf2, PG_U_OTHER_LETTER}, + {0x000cf3, 0x000cf3, PG_U_SPACING_MARK}, + {0x000d00, 0x000d01, PG_U_NONSPACING_MARK}, + {0x000d02, 0x000d03, PG_U_SPACING_MARK}, + {0x000d04, 0x000d0c, PG_U_OTHER_LETTER}, + {0x000d0e, 0x000d10, PG_U_OTHER_LETTER}, + {0x000d12, 0x000d3a, PG_U_OTHER_LETTER}, + {0x000d3b, 0x000d3c, PG_U_NONSPACING_MARK}, + {0x000d3d, 0x000d3d, PG_U_OTHER_LETTER}, + {0x000d3e, 0x000d40, PG_U_SPACING_MARK}, + {0x000d41, 0x000d44, PG_U_NONSPACING_MARK}, + {0x000d46, 0x000d48, PG_U_SPACING_MARK}, + {0x000d4a, 0x000d4c, PG_U_SPACING_MARK}, + {0x000d4d, 0x000d4d, PG_U_NONSPACING_MARK}, + {0x000d4e, 0x000d4e, PG_U_OTHER_LETTER}, + {0x000d4f, 0x000d4f, PG_U_OTHER_SYMBOL}, + {0x000d54, 0x000d56, PG_U_OTHER_LETTER}, + {0x000d57, 0x000d57, PG_U_SPACING_MARK}, + {0x000d58, 0x000d5e, PG_U_OTHER_NUMBER}, + {0x000d5f, 0x000d61, PG_U_OTHER_LETTER}, + {0x000d62, 0x000d63, PG_U_NONSPACING_MARK}, + {0x000d66, 0x000d6f, PG_U_DECIMAL_NUMBER}, + {0x000d70, 0x000d78, PG_U_OTHER_NUMBER}, + {0x000d79, 0x000d79, PG_U_OTHER_SYMBOL}, + {0x000d7a, 0x000d7f, PG_U_OTHER_LETTER}, + {0x000d81, 0x000d81, PG_U_NONSPACING_MARK}, + {0x000d82, 0x000d83, PG_U_SPACING_MARK}, + {0x000d85, 0x000d96, PG_U_OTHER_LETTER}, + {0x000d9a, 0x000db1, PG_U_OTHER_LETTER}, + {0x000db3, 0x000dbb, PG_U_OTHER_LETTER}, + {0x000dbd, 0x000dbd, PG_U_OTHER_LETTER}, + {0x000dc0, 0x000dc6, PG_U_OTHER_LETTER}, + {0x000dca, 0x000dca, PG_U_NONSPACING_MARK}, + {0x000dcf, 0x000dd1, PG_U_SPACING_MARK}, + {0x000dd2, 0x000dd4, PG_U_NONSPACING_MARK}, + {0x000dd6, 0x000dd6, PG_U_NONSPACING_MARK}, + {0x000dd8, 0x000ddf, PG_U_SPACING_MARK}, + {0x000de6, 0x000def, PG_U_DECIMAL_NUMBER}, + {0x000df2, 0x000df3, PG_U_SPACING_MARK}, + {0x000df4, 0x000df4, PG_U_OTHER_PUNCTUATION}, + {0x000e01, 0x000e30, PG_U_OTHER_LETTER}, + {0x000e31, 0x000e31, PG_U_NONSPACING_MARK}, + {0x000e32, 0x000e33, PG_U_OTHER_LETTER}, + {0x000e34, 0x000e3a, PG_U_NONSPACING_MARK}, + {0x000e3f, 0x000e3f, PG_U_CURRENCY_SYMBOL}, + {0x000e40, 0x000e45, PG_U_OTHER_LETTER}, + {0x000e46, 0x000e46, PG_U_MODIFIER_LETTER}, + {0x000e47, 0x000e4e, PG_U_NONSPACING_MARK}, + {0x000e4f, 0x000e4f, PG_U_OTHER_PUNCTUATION}, + {0x000e50, 0x000e59, PG_U_DECIMAL_NUMBER}, + {0x000e5a, 0x000e5b, PG_U_OTHER_PUNCTUATION}, + {0x000e81, 0x000e82, PG_U_OTHER_LETTER}, + {0x000e84, 0x000e84, PG_U_OTHER_LETTER}, + {0x000e86, 0x000e8a, PG_U_OTHER_LETTER}, + {0x000e8c, 0x000ea3, PG_U_OTHER_LETTER}, + {0x000ea5, 0x000ea5, PG_U_OTHER_LETTER}, + {0x000ea7, 0x000eb0, PG_U_OTHER_LETTER}, + {0x000eb1, 0x000eb1, PG_U_NONSPACING_MARK}, + {0x000eb2, 0x000eb3, PG_U_OTHER_LETTER}, + {0x000eb4, 0x000ebc, PG_U_NONSPACING_MARK}, + {0x000ebd, 0x000ebd, PG_U_OTHER_LETTER}, + {0x000ec0, 0x000ec4, PG_U_OTHER_LETTER}, + {0x000ec6, 0x000ec6, PG_U_MODIFIER_LETTER}, + {0x000ec8, 0x000ece, PG_U_NONSPACING_MARK}, + {0x000ed0, 0x000ed9, PG_U_DECIMAL_NUMBER}, + {0x000edc, 0x000edf, PG_U_OTHER_LETTER}, + {0x000f00, 0x000f00, PG_U_OTHER_LETTER}, + {0x000f01, 0x000f03, PG_U_OTHER_SYMBOL}, + {0x000f04, 0x000f12, PG_U_OTHER_PUNCTUATION}, + {0x000f13, 0x000f13, PG_U_OTHER_SYMBOL}, + {0x000f14, 0x000f14, PG_U_OTHER_PUNCTUATION}, + {0x000f15, 0x000f17, PG_U_OTHER_SYMBOL}, + {0x000f18, 0x000f19, PG_U_NONSPACING_MARK}, + {0x000f1a, 0x000f1f, PG_U_OTHER_SYMBOL}, + {0x000f20, 0x000f29, PG_U_DECIMAL_NUMBER}, + {0x000f2a, 0x000f33, PG_U_OTHER_NUMBER}, + {0x000f34, 0x000f34, PG_U_OTHER_SYMBOL}, + {0x000f35, 0x000f35, PG_U_NONSPACING_MARK}, + {0x000f36, 0x000f36, PG_U_OTHER_SYMBOL}, + {0x000f37, 0x000f37, PG_U_NONSPACING_MARK}, + {0x000f38, 0x000f38, PG_U_OTHER_SYMBOL}, + {0x000f39, 0x000f39, PG_U_NONSPACING_MARK}, + {0x000f3a, 0x000f3a, PG_U_OPEN_PUNCTUATION}, + {0x000f3b, 0x000f3b, PG_U_CLOSE_PUNCTUATION}, + {0x000f3c, 0x000f3c, PG_U_OPEN_PUNCTUATION}, + {0x000f3d, 0x000f3d, PG_U_CLOSE_PUNCTUATION}, + {0x000f3e, 0x000f3f, PG_U_SPACING_MARK}, + {0x000f40, 0x000f47, PG_U_OTHER_LETTER}, + {0x000f49, 0x000f6c, PG_U_OTHER_LETTER}, + {0x000f71, 0x000f7e, PG_U_NONSPACING_MARK}, + {0x000f7f, 0x000f7f, PG_U_SPACING_MARK}, + {0x000f80, 0x000f84, PG_U_NONSPACING_MARK}, + {0x000f85, 0x000f85, PG_U_OTHER_PUNCTUATION}, + {0x000f86, 0x000f87, PG_U_NONSPACING_MARK}, + {0x000f88, 0x000f8c, PG_U_OTHER_LETTER}, + {0x000f8d, 0x000f97, PG_U_NONSPACING_MARK}, + {0x000f99, 0x000fbc, PG_U_NONSPACING_MARK}, + {0x000fbe, 0x000fc5, PG_U_OTHER_SYMBOL}, + {0x000fc6, 0x000fc6, PG_U_NONSPACING_MARK}, + {0x000fc7, 0x000fcc, PG_U_OTHER_SYMBOL}, + {0x000fce, 0x000fcf, PG_U_OTHER_SYMBOL}, + {0x000fd0, 0x000fd4, PG_U_OTHER_PUNCTUATION}, + {0x000fd5, 0x000fd8, PG_U_OTHER_SYMBOL}, + {0x000fd9, 0x000fda, PG_U_OTHER_PUNCTUATION}, + {0x001000, 0x00102a, PG_U_OTHER_LETTER}, + {0x00102b, 0x00102c, PG_U_SPACING_MARK}, + {0x00102d, 0x001030, PG_U_NONSPACING_MARK}, + {0x001031, 0x001031, PG_U_SPACING_MARK}, + {0x001032, 0x001037, PG_U_NONSPACING_MARK}, + {0x001038, 0x001038, PG_U_SPACING_MARK}, + {0x001039, 0x00103a, PG_U_NONSPACING_MARK}, + {0x00103b, 0x00103c, PG_U_SPACING_MARK}, + {0x00103d, 0x00103e, PG_U_NONSPACING_MARK}, + {0x00103f, 0x00103f, PG_U_OTHER_LETTER}, + {0x001040, 0x001049, PG_U_DECIMAL_NUMBER}, + {0x00104a, 0x00104f, PG_U_OTHER_PUNCTUATION}, + {0x001050, 0x001055, PG_U_OTHER_LETTER}, + {0x001056, 0x001057, PG_U_SPACING_MARK}, + {0x001058, 0x001059, PG_U_NONSPACING_MARK}, + {0x00105a, 0x00105d, PG_U_OTHER_LETTER}, + {0x00105e, 0x001060, PG_U_NONSPACING_MARK}, + {0x001061, 0x001061, PG_U_OTHER_LETTER}, + {0x001062, 0x001064, PG_U_SPACING_MARK}, + {0x001065, 0x001066, PG_U_OTHER_LETTER}, + {0x001067, 0x00106d, PG_U_SPACING_MARK}, + {0x00106e, 0x001070, PG_U_OTHER_LETTER}, + {0x001071, 0x001074, PG_U_NONSPACING_MARK}, + {0x001075, 0x001081, PG_U_OTHER_LETTER}, + {0x001082, 0x001082, PG_U_NONSPACING_MARK}, + {0x001083, 0x001084, PG_U_SPACING_MARK}, + {0x001085, 0x001086, PG_U_NONSPACING_MARK}, + {0x001087, 0x00108c, PG_U_SPACING_MARK}, + {0x00108d, 0x00108d, PG_U_NONSPACING_MARK}, + {0x00108e, 0x00108e, PG_U_OTHER_LETTER}, + {0x00108f, 0x00108f, PG_U_SPACING_MARK}, + {0x001090, 0x001099, PG_U_DECIMAL_NUMBER}, + {0x00109a, 0x00109c, PG_U_SPACING_MARK}, + {0x00109d, 0x00109d, PG_U_NONSPACING_MARK}, + {0x00109e, 0x00109f, PG_U_OTHER_SYMBOL}, + {0x0010a0, 0x0010c5, PG_U_UPPERCASE_LETTER}, + {0x0010c7, 0x0010c7, PG_U_UPPERCASE_LETTER}, + {0x0010cd, 0x0010cd, PG_U_UPPERCASE_LETTER}, + {0x0010d0, 0x0010fa, PG_U_LOWERCASE_LETTER}, + {0x0010fb, 0x0010fb, PG_U_OTHER_PUNCTUATION}, + {0x0010fc, 0x0010fc, PG_U_MODIFIER_LETTER}, + {0x0010fd, 0x0010ff, PG_U_LOWERCASE_LETTER}, + {0x001100, 0x001248, PG_U_OTHER_LETTER}, + {0x00124a, 0x00124d, PG_U_OTHER_LETTER}, + {0x001250, 0x001256, PG_U_OTHER_LETTER}, + {0x001258, 0x001258, PG_U_OTHER_LETTER}, + {0x00125a, 0x00125d, PG_U_OTHER_LETTER}, + {0x001260, 0x001288, PG_U_OTHER_LETTER}, + {0x00128a, 0x00128d, PG_U_OTHER_LETTER}, + {0x001290, 0x0012b0, PG_U_OTHER_LETTER}, + {0x0012b2, 0x0012b5, PG_U_OTHER_LETTER}, + {0x0012b8, 0x0012be, PG_U_OTHER_LETTER}, + {0x0012c0, 0x0012c0, PG_U_OTHER_LETTER}, + {0x0012c2, 0x0012c5, PG_U_OTHER_LETTER}, + {0x0012c8, 0x0012d6, PG_U_OTHER_LETTER}, + {0x0012d8, 0x001310, PG_U_OTHER_LETTER}, + {0x001312, 0x001315, PG_U_OTHER_LETTER}, + {0x001318, 0x00135a, PG_U_OTHER_LETTER}, + {0x00135d, 0x00135f, PG_U_NONSPACING_MARK}, + {0x001360, 0x001368, PG_U_OTHER_PUNCTUATION}, + {0x001369, 0x00137c, PG_U_OTHER_NUMBER}, + {0x001380, 0x00138f, PG_U_OTHER_LETTER}, + {0x001390, 0x001399, PG_U_OTHER_SYMBOL}, + {0x0013a0, 0x0013f5, PG_U_UPPERCASE_LETTER}, + {0x0013f8, 0x0013fd, PG_U_LOWERCASE_LETTER}, + {0x001400, 0x001400, PG_U_DASH_PUNCTUATION}, + {0x001401, 0x00166c, PG_U_OTHER_LETTER}, + {0x00166d, 0x00166d, PG_U_OTHER_SYMBOL}, + {0x00166e, 0x00166e, PG_U_OTHER_PUNCTUATION}, + {0x00166f, 0x00167f, PG_U_OTHER_LETTER}, + {0x001680, 0x001680, PG_U_SPACE_SEPARATOR}, + {0x001681, 0x00169a, PG_U_OTHER_LETTER}, + {0x00169b, 0x00169b, PG_U_OPEN_PUNCTUATION}, + {0x00169c, 0x00169c, PG_U_CLOSE_PUNCTUATION}, + {0x0016a0, 0x0016ea, PG_U_OTHER_LETTER}, + {0x0016eb, 0x0016ed, PG_U_OTHER_PUNCTUATION}, + {0x0016ee, 0x0016f0, PG_U_LETTER_NUMBER}, + {0x0016f1, 0x0016f8, PG_U_OTHER_LETTER}, + {0x001700, 0x001711, PG_U_OTHER_LETTER}, + {0x001712, 0x001714, PG_U_NONSPACING_MARK}, + {0x001715, 0x001715, PG_U_SPACING_MARK}, + {0x00171f, 0x001731, PG_U_OTHER_LETTER}, + {0x001732, 0x001733, PG_U_NONSPACING_MARK}, + {0x001734, 0x001734, PG_U_SPACING_MARK}, + {0x001735, 0x001736, PG_U_OTHER_PUNCTUATION}, + {0x001740, 0x001751, PG_U_OTHER_LETTER}, + {0x001752, 0x001753, PG_U_NONSPACING_MARK}, + {0x001760, 0x00176c, PG_U_OTHER_LETTER}, + {0x00176e, 0x001770, PG_U_OTHER_LETTER}, + {0x001772, 0x001773, PG_U_NONSPACING_MARK}, + {0x001780, 0x0017b3, PG_U_OTHER_LETTER}, + {0x0017b4, 0x0017b5, PG_U_NONSPACING_MARK}, + {0x0017b6, 0x0017b6, PG_U_SPACING_MARK}, + {0x0017b7, 0x0017bd, PG_U_NONSPACING_MARK}, + {0x0017be, 0x0017c5, PG_U_SPACING_MARK}, + {0x0017c6, 0x0017c6, PG_U_NONSPACING_MARK}, + {0x0017c7, 0x0017c8, PG_U_SPACING_MARK}, + {0x0017c9, 0x0017d3, PG_U_NONSPACING_MARK}, + {0x0017d4, 0x0017d6, PG_U_OTHER_PUNCTUATION}, + {0x0017d7, 0x0017d7, PG_U_MODIFIER_LETTER}, + {0x0017d8, 0x0017da, PG_U_OTHER_PUNCTUATION}, + {0x0017db, 0x0017db, PG_U_CURRENCY_SYMBOL}, + {0x0017dc, 0x0017dc, PG_U_OTHER_LETTER}, + {0x0017dd, 0x0017dd, PG_U_NONSPACING_MARK}, + {0x0017e0, 0x0017e9, PG_U_DECIMAL_NUMBER}, + {0x0017f0, 0x0017f9, PG_U_OTHER_NUMBER}, + {0x001800, 0x001805, PG_U_OTHER_PUNCTUATION}, + {0x001806, 0x001806, PG_U_DASH_PUNCTUATION}, + {0x001807, 0x00180a, PG_U_OTHER_PUNCTUATION}, + {0x00180b, 0x00180d, PG_U_NONSPACING_MARK}, + {0x00180e, 0x00180e, PG_U_FORMAT}, + {0x00180f, 0x00180f, PG_U_NONSPACING_MARK}, + {0x001810, 0x001819, PG_U_DECIMAL_NUMBER}, + {0x001820, 0x001842, PG_U_OTHER_LETTER}, + {0x001843, 0x001843, PG_U_MODIFIER_LETTER}, + {0x001844, 0x001878, PG_U_OTHER_LETTER}, + {0x001880, 0x001884, PG_U_OTHER_LETTER}, + {0x001885, 0x001886, PG_U_NONSPACING_MARK}, + {0x001887, 0x0018a8, PG_U_OTHER_LETTER}, + {0x0018a9, 0x0018a9, PG_U_NONSPACING_MARK}, + {0x0018aa, 0x0018aa, PG_U_OTHER_LETTER}, + {0x0018b0, 0x0018f5, PG_U_OTHER_LETTER}, + {0x001900, 0x00191e, PG_U_OTHER_LETTER}, + {0x001920, 0x001922, PG_U_NONSPACING_MARK}, + {0x001923, 0x001926, PG_U_SPACING_MARK}, + {0x001927, 0x001928, PG_U_NONSPACING_MARK}, + {0x001929, 0x00192b, PG_U_SPACING_MARK}, + {0x001930, 0x001931, PG_U_SPACING_MARK}, + {0x001932, 0x001932, PG_U_NONSPACING_MARK}, + {0x001933, 0x001938, PG_U_SPACING_MARK}, + {0x001939, 0x00193b, PG_U_NONSPACING_MARK}, + {0x001940, 0x001940, PG_U_OTHER_SYMBOL}, + {0x001944, 0x001945, PG_U_OTHER_PUNCTUATION}, + {0x001946, 0x00194f, PG_U_DECIMAL_NUMBER}, + {0x001950, 0x00196d, PG_U_OTHER_LETTER}, + {0x001970, 0x001974, PG_U_OTHER_LETTER}, + {0x001980, 0x0019ab, PG_U_OTHER_LETTER}, + {0x0019b0, 0x0019c9, PG_U_OTHER_LETTER}, + {0x0019d0, 0x0019d9, PG_U_DECIMAL_NUMBER}, + {0x0019da, 0x0019da, PG_U_OTHER_NUMBER}, + {0x0019de, 0x0019ff, PG_U_OTHER_SYMBOL}, + {0x001a00, 0x001a16, PG_U_OTHER_LETTER}, + {0x001a17, 0x001a18, PG_U_NONSPACING_MARK}, + {0x001a19, 0x001a1a, PG_U_SPACING_MARK}, + {0x001a1b, 0x001a1b, PG_U_NONSPACING_MARK}, + {0x001a1e, 0x001a1f, PG_U_OTHER_PUNCTUATION}, + {0x001a20, 0x001a54, PG_U_OTHER_LETTER}, + {0x001a55, 0x001a55, PG_U_SPACING_MARK}, + {0x001a56, 0x001a56, PG_U_NONSPACING_MARK}, + {0x001a57, 0x001a57, PG_U_SPACING_MARK}, + {0x001a58, 0x001a5e, PG_U_NONSPACING_MARK}, + {0x001a60, 0x001a60, PG_U_NONSPACING_MARK}, + {0x001a61, 0x001a61, PG_U_SPACING_MARK}, + {0x001a62, 0x001a62, PG_U_NONSPACING_MARK}, + {0x001a63, 0x001a64, PG_U_SPACING_MARK}, + {0x001a65, 0x001a6c, PG_U_NONSPACING_MARK}, + {0x001a6d, 0x001a72, PG_U_SPACING_MARK}, + {0x001a73, 0x001a7c, PG_U_NONSPACING_MARK}, + {0x001a7f, 0x001a7f, PG_U_NONSPACING_MARK}, + {0x001a80, 0x001a89, PG_U_DECIMAL_NUMBER}, + {0x001a90, 0x001a99, PG_U_DECIMAL_NUMBER}, + {0x001aa0, 0x001aa6, PG_U_OTHER_PUNCTUATION}, + {0x001aa7, 0x001aa7, PG_U_MODIFIER_LETTER}, + {0x001aa8, 0x001aad, PG_U_OTHER_PUNCTUATION}, + {0x001ab0, 0x001abd, PG_U_NONSPACING_MARK}, + {0x001abe, 0x001abe, PG_U_ENCLOSING_MARK}, + {0x001abf, 0x001ace, PG_U_NONSPACING_MARK}, + {0x001b00, 0x001b03, PG_U_NONSPACING_MARK}, + {0x001b04, 0x001b04, PG_U_SPACING_MARK}, + {0x001b05, 0x001b33, PG_U_OTHER_LETTER}, + {0x001b34, 0x001b34, PG_U_NONSPACING_MARK}, + {0x001b35, 0x001b35, PG_U_SPACING_MARK}, + {0x001b36, 0x001b3a, PG_U_NONSPACING_MARK}, + {0x001b3b, 0x001b3b, PG_U_SPACING_MARK}, + {0x001b3c, 0x001b3c, PG_U_NONSPACING_MARK}, + {0x001b3d, 0x001b41, PG_U_SPACING_MARK}, + {0x001b42, 0x001b42, PG_U_NONSPACING_MARK}, + {0x001b43, 0x001b44, PG_U_SPACING_MARK}, + {0x001b45, 0x001b4c, PG_U_OTHER_LETTER}, + {0x001b4e, 0x001b4f, PG_U_OTHER_PUNCTUATION}, + {0x001b50, 0x001b59, PG_U_DECIMAL_NUMBER}, + {0x001b5a, 0x001b60, PG_U_OTHER_PUNCTUATION}, + {0x001b61, 0x001b6a, PG_U_OTHER_SYMBOL}, + {0x001b6b, 0x001b73, PG_U_NONSPACING_MARK}, + {0x001b74, 0x001b7c, PG_U_OTHER_SYMBOL}, + {0x001b7d, 0x001b7f, PG_U_OTHER_PUNCTUATION}, + {0x001b80, 0x001b81, PG_U_NONSPACING_MARK}, + {0x001b82, 0x001b82, PG_U_SPACING_MARK}, + {0x001b83, 0x001ba0, PG_U_OTHER_LETTER}, + {0x001ba1, 0x001ba1, PG_U_SPACING_MARK}, + {0x001ba2, 0x001ba5, PG_U_NONSPACING_MARK}, + {0x001ba6, 0x001ba7, PG_U_SPACING_MARK}, + {0x001ba8, 0x001ba9, PG_U_NONSPACING_MARK}, + {0x001baa, 0x001baa, PG_U_SPACING_MARK}, + {0x001bab, 0x001bad, PG_U_NONSPACING_MARK}, + {0x001bae, 0x001baf, PG_U_OTHER_LETTER}, + {0x001bb0, 0x001bb9, PG_U_DECIMAL_NUMBER}, + {0x001bba, 0x001be5, PG_U_OTHER_LETTER}, + {0x001be6, 0x001be6, PG_U_NONSPACING_MARK}, + {0x001be7, 0x001be7, PG_U_SPACING_MARK}, + {0x001be8, 0x001be9, PG_U_NONSPACING_MARK}, + {0x001bea, 0x001bec, PG_U_SPACING_MARK}, + {0x001bed, 0x001bed, PG_U_NONSPACING_MARK}, + {0x001bee, 0x001bee, PG_U_SPACING_MARK}, + {0x001bef, 0x001bf1, PG_U_NONSPACING_MARK}, + {0x001bf2, 0x001bf3, PG_U_SPACING_MARK}, + {0x001bfc, 0x001bff, PG_U_OTHER_PUNCTUATION}, + {0x001c00, 0x001c23, PG_U_OTHER_LETTER}, + {0x001c24, 0x001c2b, PG_U_SPACING_MARK}, + {0x001c2c, 0x001c33, PG_U_NONSPACING_MARK}, + {0x001c34, 0x001c35, PG_U_SPACING_MARK}, + {0x001c36, 0x001c37, PG_U_NONSPACING_MARK}, + {0x001c3b, 0x001c3f, PG_U_OTHER_PUNCTUATION}, + {0x001c40, 0x001c49, PG_U_DECIMAL_NUMBER}, + {0x001c4d, 0x001c4f, PG_U_OTHER_LETTER}, + {0x001c50, 0x001c59, PG_U_DECIMAL_NUMBER}, + {0x001c5a, 0x001c77, PG_U_OTHER_LETTER}, + {0x001c78, 0x001c7d, PG_U_MODIFIER_LETTER}, + {0x001c7e, 0x001c7f, PG_U_OTHER_PUNCTUATION}, + {0x001c80, 0x001c88, PG_U_LOWERCASE_LETTER}, + {0x001c89, 0x001c89, PG_U_UPPERCASE_LETTER}, + {0x001c8a, 0x001c8a, PG_U_LOWERCASE_LETTER}, + {0x001c90, 0x001cba, PG_U_UPPERCASE_LETTER}, + {0x001cbd, 0x001cbf, PG_U_UPPERCASE_LETTER}, + {0x001cc0, 0x001cc7, PG_U_OTHER_PUNCTUATION}, + {0x001cd0, 0x001cd2, PG_U_NONSPACING_MARK}, + {0x001cd3, 0x001cd3, PG_U_OTHER_PUNCTUATION}, + {0x001cd4, 0x001ce0, PG_U_NONSPACING_MARK}, + {0x001ce1, 0x001ce1, PG_U_SPACING_MARK}, + {0x001ce2, 0x001ce8, PG_U_NONSPACING_MARK}, + {0x001ce9, 0x001cec, PG_U_OTHER_LETTER}, + {0x001ced, 0x001ced, PG_U_NONSPACING_MARK}, + {0x001cee, 0x001cf3, PG_U_OTHER_LETTER}, + {0x001cf4, 0x001cf4, PG_U_NONSPACING_MARK}, + {0x001cf5, 0x001cf6, PG_U_OTHER_LETTER}, + {0x001cf7, 0x001cf7, PG_U_SPACING_MARK}, + {0x001cf8, 0x001cf9, PG_U_NONSPACING_MARK}, + {0x001cfa, 0x001cfa, PG_U_OTHER_LETTER}, + {0x001d00, 0x001d2b, PG_U_LOWERCASE_LETTER}, + {0x001d2c, 0x001d6a, PG_U_MODIFIER_LETTER}, + {0x001d6b, 0x001d77, PG_U_LOWERCASE_LETTER}, + {0x001d78, 0x001d78, PG_U_MODIFIER_LETTER}, + {0x001d79, 0x001d9a, PG_U_LOWERCASE_LETTER}, + {0x001d9b, 0x001dbf, PG_U_MODIFIER_LETTER}, + {0x001dc0, 0x001dff, PG_U_NONSPACING_MARK}, + {0x001e00, 0x001e00, PG_U_UPPERCASE_LETTER}, + {0x001e01, 0x001e01, PG_U_LOWERCASE_LETTER}, + {0x001e02, 0x001e02, PG_U_UPPERCASE_LETTER}, + {0x001e03, 0x001e03, PG_U_LOWERCASE_LETTER}, + {0x001e04, 0x001e04, PG_U_UPPERCASE_LETTER}, + {0x001e05, 0x001e05, PG_U_LOWERCASE_LETTER}, + {0x001e06, 0x001e06, PG_U_UPPERCASE_LETTER}, + {0x001e07, 0x001e07, PG_U_LOWERCASE_LETTER}, + {0x001e08, 0x001e08, PG_U_UPPERCASE_LETTER}, + {0x001e09, 0x001e09, PG_U_LOWERCASE_LETTER}, + {0x001e0a, 0x001e0a, PG_U_UPPERCASE_LETTER}, + {0x001e0b, 0x001e0b, PG_U_LOWERCASE_LETTER}, + {0x001e0c, 0x001e0c, PG_U_UPPERCASE_LETTER}, + {0x001e0d, 0x001e0d, PG_U_LOWERCASE_LETTER}, + {0x001e0e, 0x001e0e, PG_U_UPPERCASE_LETTER}, + {0x001e0f, 0x001e0f, PG_U_LOWERCASE_LETTER}, + {0x001e10, 0x001e10, PG_U_UPPERCASE_LETTER}, + {0x001e11, 0x001e11, PG_U_LOWERCASE_LETTER}, + {0x001e12, 0x001e12, PG_U_UPPERCASE_LETTER}, + {0x001e13, 0x001e13, PG_U_LOWERCASE_LETTER}, + {0x001e14, 0x001e14, PG_U_UPPERCASE_LETTER}, + {0x001e15, 0x001e15, PG_U_LOWERCASE_LETTER}, + {0x001e16, 0x001e16, PG_U_UPPERCASE_LETTER}, + {0x001e17, 0x001e17, PG_U_LOWERCASE_LETTER}, + {0x001e18, 0x001e18, PG_U_UPPERCASE_LETTER}, + {0x001e19, 0x001e19, PG_U_LOWERCASE_LETTER}, + {0x001e1a, 0x001e1a, PG_U_UPPERCASE_LETTER}, + {0x001e1b, 0x001e1b, PG_U_LOWERCASE_LETTER}, + {0x001e1c, 0x001e1c, PG_U_UPPERCASE_LETTER}, + {0x001e1d, 0x001e1d, PG_U_LOWERCASE_LETTER}, + {0x001e1e, 0x001e1e, PG_U_UPPERCASE_LETTER}, + {0x001e1f, 0x001e1f, PG_U_LOWERCASE_LETTER}, + {0x001e20, 0x001e20, PG_U_UPPERCASE_LETTER}, + {0x001e21, 0x001e21, PG_U_LOWERCASE_LETTER}, + {0x001e22, 0x001e22, PG_U_UPPERCASE_LETTER}, + {0x001e23, 0x001e23, PG_U_LOWERCASE_LETTER}, + {0x001e24, 0x001e24, PG_U_UPPERCASE_LETTER}, + {0x001e25, 0x001e25, PG_U_LOWERCASE_LETTER}, + {0x001e26, 0x001e26, PG_U_UPPERCASE_LETTER}, + {0x001e27, 0x001e27, PG_U_LOWERCASE_LETTER}, + {0x001e28, 0x001e28, PG_U_UPPERCASE_LETTER}, + {0x001e29, 0x001e29, PG_U_LOWERCASE_LETTER}, + {0x001e2a, 0x001e2a, PG_U_UPPERCASE_LETTER}, + {0x001e2b, 0x001e2b, PG_U_LOWERCASE_LETTER}, + {0x001e2c, 0x001e2c, PG_U_UPPERCASE_LETTER}, + {0x001e2d, 0x001e2d, PG_U_LOWERCASE_LETTER}, + {0x001e2e, 0x001e2e, PG_U_UPPERCASE_LETTER}, + {0x001e2f, 0x001e2f, PG_U_LOWERCASE_LETTER}, + {0x001e30, 0x001e30, PG_U_UPPERCASE_LETTER}, + {0x001e31, 0x001e31, PG_U_LOWERCASE_LETTER}, + {0x001e32, 0x001e32, PG_U_UPPERCASE_LETTER}, + {0x001e33, 0x001e33, PG_U_LOWERCASE_LETTER}, + {0x001e34, 0x001e34, PG_U_UPPERCASE_LETTER}, + {0x001e35, 0x001e35, PG_U_LOWERCASE_LETTER}, + {0x001e36, 0x001e36, PG_U_UPPERCASE_LETTER}, + {0x001e37, 0x001e37, PG_U_LOWERCASE_LETTER}, + {0x001e38, 0x001e38, PG_U_UPPERCASE_LETTER}, + {0x001e39, 0x001e39, PG_U_LOWERCASE_LETTER}, + {0x001e3a, 0x001e3a, PG_U_UPPERCASE_LETTER}, + {0x001e3b, 0x001e3b, PG_U_LOWERCASE_LETTER}, + {0x001e3c, 0x001e3c, PG_U_UPPERCASE_LETTER}, + {0x001e3d, 0x001e3d, PG_U_LOWERCASE_LETTER}, + {0x001e3e, 0x001e3e, PG_U_UPPERCASE_LETTER}, + {0x001e3f, 0x001e3f, PG_U_LOWERCASE_LETTER}, + {0x001e40, 0x001e40, PG_U_UPPERCASE_LETTER}, + {0x001e41, 0x001e41, PG_U_LOWERCASE_LETTER}, + {0x001e42, 0x001e42, PG_U_UPPERCASE_LETTER}, + {0x001e43, 0x001e43, PG_U_LOWERCASE_LETTER}, + {0x001e44, 0x001e44, PG_U_UPPERCASE_LETTER}, + {0x001e45, 0x001e45, PG_U_LOWERCASE_LETTER}, + {0x001e46, 0x001e46, PG_U_UPPERCASE_LETTER}, + {0x001e47, 0x001e47, PG_U_LOWERCASE_LETTER}, + {0x001e48, 0x001e48, PG_U_UPPERCASE_LETTER}, + {0x001e49, 0x001e49, PG_U_LOWERCASE_LETTER}, + {0x001e4a, 0x001e4a, PG_U_UPPERCASE_LETTER}, + {0x001e4b, 0x001e4b, PG_U_LOWERCASE_LETTER}, + {0x001e4c, 0x001e4c, PG_U_UPPERCASE_LETTER}, + {0x001e4d, 0x001e4d, PG_U_LOWERCASE_LETTER}, + {0x001e4e, 0x001e4e, PG_U_UPPERCASE_LETTER}, + {0x001e4f, 0x001e4f, PG_U_LOWERCASE_LETTER}, + {0x001e50, 0x001e50, PG_U_UPPERCASE_LETTER}, + {0x001e51, 0x001e51, PG_U_LOWERCASE_LETTER}, + {0x001e52, 0x001e52, PG_U_UPPERCASE_LETTER}, + {0x001e53, 0x001e53, PG_U_LOWERCASE_LETTER}, + {0x001e54, 0x001e54, PG_U_UPPERCASE_LETTER}, + {0x001e55, 0x001e55, PG_U_LOWERCASE_LETTER}, + {0x001e56, 0x001e56, PG_U_UPPERCASE_LETTER}, + {0x001e57, 0x001e57, PG_U_LOWERCASE_LETTER}, + {0x001e58, 0x001e58, PG_U_UPPERCASE_LETTER}, + {0x001e59, 0x001e59, PG_U_LOWERCASE_LETTER}, + {0x001e5a, 0x001e5a, PG_U_UPPERCASE_LETTER}, + {0x001e5b, 0x001e5b, PG_U_LOWERCASE_LETTER}, + {0x001e5c, 0x001e5c, PG_U_UPPERCASE_LETTER}, + {0x001e5d, 0x001e5d, PG_U_LOWERCASE_LETTER}, + {0x001e5e, 0x001e5e, PG_U_UPPERCASE_LETTER}, + {0x001e5f, 0x001e5f, PG_U_LOWERCASE_LETTER}, + {0x001e60, 0x001e60, PG_U_UPPERCASE_LETTER}, + {0x001e61, 0x001e61, PG_U_LOWERCASE_LETTER}, + {0x001e62, 0x001e62, PG_U_UPPERCASE_LETTER}, + {0x001e63, 0x001e63, PG_U_LOWERCASE_LETTER}, + {0x001e64, 0x001e64, PG_U_UPPERCASE_LETTER}, + {0x001e65, 0x001e65, PG_U_LOWERCASE_LETTER}, + {0x001e66, 0x001e66, PG_U_UPPERCASE_LETTER}, + {0x001e67, 0x001e67, PG_U_LOWERCASE_LETTER}, + {0x001e68, 0x001e68, PG_U_UPPERCASE_LETTER}, + {0x001e69, 0x001e69, PG_U_LOWERCASE_LETTER}, + {0x001e6a, 0x001e6a, PG_U_UPPERCASE_LETTER}, + {0x001e6b, 0x001e6b, PG_U_LOWERCASE_LETTER}, + {0x001e6c, 0x001e6c, PG_U_UPPERCASE_LETTER}, + {0x001e6d, 0x001e6d, PG_U_LOWERCASE_LETTER}, + {0x001e6e, 0x001e6e, PG_U_UPPERCASE_LETTER}, + {0x001e6f, 0x001e6f, PG_U_LOWERCASE_LETTER}, + {0x001e70, 0x001e70, PG_U_UPPERCASE_LETTER}, + {0x001e71, 0x001e71, PG_U_LOWERCASE_LETTER}, + {0x001e72, 0x001e72, PG_U_UPPERCASE_LETTER}, + {0x001e73, 0x001e73, PG_U_LOWERCASE_LETTER}, + {0x001e74, 0x001e74, PG_U_UPPERCASE_LETTER}, + {0x001e75, 0x001e75, PG_U_LOWERCASE_LETTER}, + {0x001e76, 0x001e76, PG_U_UPPERCASE_LETTER}, + {0x001e77, 0x001e77, PG_U_LOWERCASE_LETTER}, + {0x001e78, 0x001e78, PG_U_UPPERCASE_LETTER}, + {0x001e79, 0x001e79, PG_U_LOWERCASE_LETTER}, + {0x001e7a, 0x001e7a, PG_U_UPPERCASE_LETTER}, + {0x001e7b, 0x001e7b, PG_U_LOWERCASE_LETTER}, + {0x001e7c, 0x001e7c, PG_U_UPPERCASE_LETTER}, + {0x001e7d, 0x001e7d, PG_U_LOWERCASE_LETTER}, + {0x001e7e, 0x001e7e, PG_U_UPPERCASE_LETTER}, + {0x001e7f, 0x001e7f, PG_U_LOWERCASE_LETTER}, + {0x001e80, 0x001e80, PG_U_UPPERCASE_LETTER}, + {0x001e81, 0x001e81, PG_U_LOWERCASE_LETTER}, + {0x001e82, 0x001e82, PG_U_UPPERCASE_LETTER}, + {0x001e83, 0x001e83, PG_U_LOWERCASE_LETTER}, + {0x001e84, 0x001e84, PG_U_UPPERCASE_LETTER}, + {0x001e85, 0x001e85, PG_U_LOWERCASE_LETTER}, + {0x001e86, 0x001e86, PG_U_UPPERCASE_LETTER}, + {0x001e87, 0x001e87, PG_U_LOWERCASE_LETTER}, + {0x001e88, 0x001e88, PG_U_UPPERCASE_LETTER}, + {0x001e89, 0x001e89, PG_U_LOWERCASE_LETTER}, + {0x001e8a, 0x001e8a, PG_U_UPPERCASE_LETTER}, + {0x001e8b, 0x001e8b, PG_U_LOWERCASE_LETTER}, + {0x001e8c, 0x001e8c, PG_U_UPPERCASE_LETTER}, + {0x001e8d, 0x001e8d, PG_U_LOWERCASE_LETTER}, + {0x001e8e, 0x001e8e, PG_U_UPPERCASE_LETTER}, + {0x001e8f, 0x001e8f, PG_U_LOWERCASE_LETTER}, + {0x001e90, 0x001e90, PG_U_UPPERCASE_LETTER}, + {0x001e91, 0x001e91, PG_U_LOWERCASE_LETTER}, + {0x001e92, 0x001e92, PG_U_UPPERCASE_LETTER}, + {0x001e93, 0x001e93, PG_U_LOWERCASE_LETTER}, + {0x001e94, 0x001e94, PG_U_UPPERCASE_LETTER}, + {0x001e95, 0x001e9d, PG_U_LOWERCASE_LETTER}, + {0x001e9e, 0x001e9e, PG_U_UPPERCASE_LETTER}, + {0x001e9f, 0x001e9f, PG_U_LOWERCASE_LETTER}, + {0x001ea0, 0x001ea0, PG_U_UPPERCASE_LETTER}, + {0x001ea1, 0x001ea1, PG_U_LOWERCASE_LETTER}, + {0x001ea2, 0x001ea2, PG_U_UPPERCASE_LETTER}, + {0x001ea3, 0x001ea3, PG_U_LOWERCASE_LETTER}, + {0x001ea4, 0x001ea4, PG_U_UPPERCASE_LETTER}, + {0x001ea5, 0x001ea5, PG_U_LOWERCASE_LETTER}, + {0x001ea6, 0x001ea6, PG_U_UPPERCASE_LETTER}, + {0x001ea7, 0x001ea7, PG_U_LOWERCASE_LETTER}, + {0x001ea8, 0x001ea8, PG_U_UPPERCASE_LETTER}, + {0x001ea9, 0x001ea9, PG_U_LOWERCASE_LETTER}, + {0x001eaa, 0x001eaa, PG_U_UPPERCASE_LETTER}, + {0x001eab, 0x001eab, PG_U_LOWERCASE_LETTER}, + {0x001eac, 0x001eac, PG_U_UPPERCASE_LETTER}, + {0x001ead, 0x001ead, PG_U_LOWERCASE_LETTER}, + {0x001eae, 0x001eae, PG_U_UPPERCASE_LETTER}, + {0x001eaf, 0x001eaf, PG_U_LOWERCASE_LETTER}, + {0x001eb0, 0x001eb0, PG_U_UPPERCASE_LETTER}, + {0x001eb1, 0x001eb1, PG_U_LOWERCASE_LETTER}, + {0x001eb2, 0x001eb2, PG_U_UPPERCASE_LETTER}, + {0x001eb3, 0x001eb3, PG_U_LOWERCASE_LETTER}, + {0x001eb4, 0x001eb4, PG_U_UPPERCASE_LETTER}, + {0x001eb5, 0x001eb5, PG_U_LOWERCASE_LETTER}, + {0x001eb6, 0x001eb6, PG_U_UPPERCASE_LETTER}, + {0x001eb7, 0x001eb7, PG_U_LOWERCASE_LETTER}, + {0x001eb8, 0x001eb8, PG_U_UPPERCASE_LETTER}, + {0x001eb9, 0x001eb9, PG_U_LOWERCASE_LETTER}, + {0x001eba, 0x001eba, PG_U_UPPERCASE_LETTER}, + {0x001ebb, 0x001ebb, PG_U_LOWERCASE_LETTER}, + {0x001ebc, 0x001ebc, PG_U_UPPERCASE_LETTER}, + {0x001ebd, 0x001ebd, PG_U_LOWERCASE_LETTER}, + {0x001ebe, 0x001ebe, PG_U_UPPERCASE_LETTER}, + {0x001ebf, 0x001ebf, PG_U_LOWERCASE_LETTER}, + {0x001ec0, 0x001ec0, PG_U_UPPERCASE_LETTER}, + {0x001ec1, 0x001ec1, PG_U_LOWERCASE_LETTER}, + {0x001ec2, 0x001ec2, PG_U_UPPERCASE_LETTER}, + {0x001ec3, 0x001ec3, PG_U_LOWERCASE_LETTER}, + {0x001ec4, 0x001ec4, PG_U_UPPERCASE_LETTER}, + {0x001ec5, 0x001ec5, PG_U_LOWERCASE_LETTER}, + {0x001ec6, 0x001ec6, PG_U_UPPERCASE_LETTER}, + {0x001ec7, 0x001ec7, PG_U_LOWERCASE_LETTER}, + {0x001ec8, 0x001ec8, PG_U_UPPERCASE_LETTER}, + {0x001ec9, 0x001ec9, PG_U_LOWERCASE_LETTER}, + {0x001eca, 0x001eca, PG_U_UPPERCASE_LETTER}, + {0x001ecb, 0x001ecb, PG_U_LOWERCASE_LETTER}, + {0x001ecc, 0x001ecc, PG_U_UPPERCASE_LETTER}, + {0x001ecd, 0x001ecd, PG_U_LOWERCASE_LETTER}, + {0x001ece, 0x001ece, PG_U_UPPERCASE_LETTER}, + {0x001ecf, 0x001ecf, PG_U_LOWERCASE_LETTER}, + {0x001ed0, 0x001ed0, PG_U_UPPERCASE_LETTER}, + {0x001ed1, 0x001ed1, PG_U_LOWERCASE_LETTER}, + {0x001ed2, 0x001ed2, PG_U_UPPERCASE_LETTER}, + {0x001ed3, 0x001ed3, PG_U_LOWERCASE_LETTER}, + {0x001ed4, 0x001ed4, PG_U_UPPERCASE_LETTER}, + {0x001ed5, 0x001ed5, PG_U_LOWERCASE_LETTER}, + {0x001ed6, 0x001ed6, PG_U_UPPERCASE_LETTER}, + {0x001ed7, 0x001ed7, PG_U_LOWERCASE_LETTER}, + {0x001ed8, 0x001ed8, PG_U_UPPERCASE_LETTER}, + {0x001ed9, 0x001ed9, PG_U_LOWERCASE_LETTER}, + {0x001eda, 0x001eda, PG_U_UPPERCASE_LETTER}, + {0x001edb, 0x001edb, PG_U_LOWERCASE_LETTER}, + {0x001edc, 0x001edc, PG_U_UPPERCASE_LETTER}, + {0x001edd, 0x001edd, PG_U_LOWERCASE_LETTER}, + {0x001ede, 0x001ede, PG_U_UPPERCASE_LETTER}, + {0x001edf, 0x001edf, PG_U_LOWERCASE_LETTER}, + {0x001ee0, 0x001ee0, PG_U_UPPERCASE_LETTER}, + {0x001ee1, 0x001ee1, PG_U_LOWERCASE_LETTER}, + {0x001ee2, 0x001ee2, PG_U_UPPERCASE_LETTER}, + {0x001ee3, 0x001ee3, PG_U_LOWERCASE_LETTER}, + {0x001ee4, 0x001ee4, PG_U_UPPERCASE_LETTER}, + {0x001ee5, 0x001ee5, PG_U_LOWERCASE_LETTER}, + {0x001ee6, 0x001ee6, PG_U_UPPERCASE_LETTER}, + {0x001ee7, 0x001ee7, PG_U_LOWERCASE_LETTER}, + {0x001ee8, 0x001ee8, PG_U_UPPERCASE_LETTER}, + {0x001ee9, 0x001ee9, PG_U_LOWERCASE_LETTER}, + {0x001eea, 0x001eea, PG_U_UPPERCASE_LETTER}, + {0x001eeb, 0x001eeb, PG_U_LOWERCASE_LETTER}, + {0x001eec, 0x001eec, PG_U_UPPERCASE_LETTER}, + {0x001eed, 0x001eed, PG_U_LOWERCASE_LETTER}, + {0x001eee, 0x001eee, PG_U_UPPERCASE_LETTER}, + {0x001eef, 0x001eef, PG_U_LOWERCASE_LETTER}, + {0x001ef0, 0x001ef0, PG_U_UPPERCASE_LETTER}, + {0x001ef1, 0x001ef1, PG_U_LOWERCASE_LETTER}, + {0x001ef2, 0x001ef2, PG_U_UPPERCASE_LETTER}, + {0x001ef3, 0x001ef3, PG_U_LOWERCASE_LETTER}, + {0x001ef4, 0x001ef4, PG_U_UPPERCASE_LETTER}, + {0x001ef5, 0x001ef5, PG_U_LOWERCASE_LETTER}, + {0x001ef6, 0x001ef6, PG_U_UPPERCASE_LETTER}, + {0x001ef7, 0x001ef7, PG_U_LOWERCASE_LETTER}, + {0x001ef8, 0x001ef8, PG_U_UPPERCASE_LETTER}, + {0x001ef9, 0x001ef9, PG_U_LOWERCASE_LETTER}, + {0x001efa, 0x001efa, PG_U_UPPERCASE_LETTER}, + {0x001efb, 0x001efb, PG_U_LOWERCASE_LETTER}, + {0x001efc, 0x001efc, PG_U_UPPERCASE_LETTER}, + {0x001efd, 0x001efd, PG_U_LOWERCASE_LETTER}, + {0x001efe, 0x001efe, PG_U_UPPERCASE_LETTER}, + {0x001eff, 0x001f07, PG_U_LOWERCASE_LETTER}, + {0x001f08, 0x001f0f, PG_U_UPPERCASE_LETTER}, + {0x001f10, 0x001f15, PG_U_LOWERCASE_LETTER}, + {0x001f18, 0x001f1d, PG_U_UPPERCASE_LETTER}, + {0x001f20, 0x001f27, PG_U_LOWERCASE_LETTER}, + {0x001f28, 0x001f2f, PG_U_UPPERCASE_LETTER}, + {0x001f30, 0x001f37, PG_U_LOWERCASE_LETTER}, + {0x001f38, 0x001f3f, PG_U_UPPERCASE_LETTER}, + {0x001f40, 0x001f45, PG_U_LOWERCASE_LETTER}, + {0x001f48, 0x001f4d, PG_U_UPPERCASE_LETTER}, + {0x001f50, 0x001f57, PG_U_LOWERCASE_LETTER}, + {0x001f59, 0x001f59, PG_U_UPPERCASE_LETTER}, + {0x001f5b, 0x001f5b, PG_U_UPPERCASE_LETTER}, + {0x001f5d, 0x001f5d, PG_U_UPPERCASE_LETTER}, + {0x001f5f, 0x001f5f, PG_U_UPPERCASE_LETTER}, + {0x001f60, 0x001f67, PG_U_LOWERCASE_LETTER}, + {0x001f68, 0x001f6f, PG_U_UPPERCASE_LETTER}, + {0x001f70, 0x001f7d, PG_U_LOWERCASE_LETTER}, + {0x001f80, 0x001f87, PG_U_LOWERCASE_LETTER}, + {0x001f88, 0x001f8f, PG_U_TITLECASE_LETTER}, + {0x001f90, 0x001f97, PG_U_LOWERCASE_LETTER}, + {0x001f98, 0x001f9f, PG_U_TITLECASE_LETTER}, + {0x001fa0, 0x001fa7, PG_U_LOWERCASE_LETTER}, + {0x001fa8, 0x001faf, PG_U_TITLECASE_LETTER}, + {0x001fb0, 0x001fb4, PG_U_LOWERCASE_LETTER}, + {0x001fb6, 0x001fb7, PG_U_LOWERCASE_LETTER}, + {0x001fb8, 0x001fbb, PG_U_UPPERCASE_LETTER}, + {0x001fbc, 0x001fbc, PG_U_TITLECASE_LETTER}, + {0x001fbd, 0x001fbd, PG_U_MODIFIER_SYMBOL}, + {0x001fbe, 0x001fbe, PG_U_LOWERCASE_LETTER}, + {0x001fbf, 0x001fc1, PG_U_MODIFIER_SYMBOL}, + {0x001fc2, 0x001fc4, PG_U_LOWERCASE_LETTER}, + {0x001fc6, 0x001fc7, PG_U_LOWERCASE_LETTER}, + {0x001fc8, 0x001fcb, PG_U_UPPERCASE_LETTER}, + {0x001fcc, 0x001fcc, PG_U_TITLECASE_LETTER}, + {0x001fcd, 0x001fcf, PG_U_MODIFIER_SYMBOL}, + {0x001fd0, 0x001fd3, PG_U_LOWERCASE_LETTER}, + {0x001fd6, 0x001fd7, PG_U_LOWERCASE_LETTER}, + {0x001fd8, 0x001fdb, PG_U_UPPERCASE_LETTER}, + {0x001fdd, 0x001fdf, PG_U_MODIFIER_SYMBOL}, + {0x001fe0, 0x001fe7, PG_U_LOWERCASE_LETTER}, + {0x001fe8, 0x001fec, PG_U_UPPERCASE_LETTER}, + {0x001fed, 0x001fef, PG_U_MODIFIER_SYMBOL}, + {0x001ff2, 0x001ff4, PG_U_LOWERCASE_LETTER}, + {0x001ff6, 0x001ff7, PG_U_LOWERCASE_LETTER}, + {0x001ff8, 0x001ffb, PG_U_UPPERCASE_LETTER}, + {0x001ffc, 0x001ffc, PG_U_TITLECASE_LETTER}, + {0x001ffd, 0x001ffe, PG_U_MODIFIER_SYMBOL}, + {0x002000, 0x00200a, PG_U_SPACE_SEPARATOR}, + {0x00200b, 0x00200f, PG_U_FORMAT}, + {0x002010, 0x002015, PG_U_DASH_PUNCTUATION}, + {0x002016, 0x002017, PG_U_OTHER_PUNCTUATION}, + {0x002018, 0x002018, PG_U_INITIAL_PUNCTUATION}, + {0x002019, 0x002019, PG_U_FINAL_PUNCTUATION}, + {0x00201a, 0x00201a, PG_U_OPEN_PUNCTUATION}, + {0x00201b, 0x00201c, PG_U_INITIAL_PUNCTUATION}, + {0x00201d, 0x00201d, PG_U_FINAL_PUNCTUATION}, + {0x00201e, 0x00201e, PG_U_OPEN_PUNCTUATION}, + {0x00201f, 0x00201f, PG_U_INITIAL_PUNCTUATION}, + {0x002020, 0x002027, PG_U_OTHER_PUNCTUATION}, + {0x002028, 0x002028, PG_U_LINE_SEPARATOR}, + {0x002029, 0x002029, PG_U_PARAGRAPH_SEPARATOR}, + {0x00202a, 0x00202e, PG_U_FORMAT}, + {0x00202f, 0x00202f, PG_U_SPACE_SEPARATOR}, + {0x002030, 0x002038, PG_U_OTHER_PUNCTUATION}, + {0x002039, 0x002039, PG_U_INITIAL_PUNCTUATION}, + {0x00203a, 0x00203a, PG_U_FINAL_PUNCTUATION}, + {0x00203b, 0x00203e, PG_U_OTHER_PUNCTUATION}, + {0x00203f, 0x002040, PG_U_CONNECTOR_PUNCTUATION}, + {0x002041, 0x002043, PG_U_OTHER_PUNCTUATION}, + {0x002044, 0x002044, PG_U_MATH_SYMBOL}, + {0x002045, 0x002045, PG_U_OPEN_PUNCTUATION}, + {0x002046, 0x002046, PG_U_CLOSE_PUNCTUATION}, + {0x002047, 0x002051, PG_U_OTHER_PUNCTUATION}, + {0x002052, 0x002052, PG_U_MATH_SYMBOL}, + {0x002053, 0x002053, PG_U_OTHER_PUNCTUATION}, + {0x002054, 0x002054, PG_U_CONNECTOR_PUNCTUATION}, + {0x002055, 0x00205e, PG_U_OTHER_PUNCTUATION}, + {0x00205f, 0x00205f, PG_U_SPACE_SEPARATOR}, + {0x002060, 0x002064, PG_U_FORMAT}, + {0x002066, 0x00206f, PG_U_FORMAT}, + {0x002070, 0x002070, PG_U_OTHER_NUMBER}, + {0x002071, 0x002071, PG_U_MODIFIER_LETTER}, + {0x002074, 0x002079, PG_U_OTHER_NUMBER}, + {0x00207a, 0x00207c, PG_U_MATH_SYMBOL}, + {0x00207d, 0x00207d, PG_U_OPEN_PUNCTUATION}, + {0x00207e, 0x00207e, PG_U_CLOSE_PUNCTUATION}, + {0x00207f, 0x00207f, PG_U_MODIFIER_LETTER}, + {0x002080, 0x002089, PG_U_OTHER_NUMBER}, + {0x00208a, 0x00208c, PG_U_MATH_SYMBOL}, + {0x00208d, 0x00208d, PG_U_OPEN_PUNCTUATION}, + {0x00208e, 0x00208e, PG_U_CLOSE_PUNCTUATION}, + {0x002090, 0x00209c, PG_U_MODIFIER_LETTER}, + {0x0020a0, 0x0020c0, PG_U_CURRENCY_SYMBOL}, + {0x0020d0, 0x0020dc, PG_U_NONSPACING_MARK}, + {0x0020dd, 0x0020e0, PG_U_ENCLOSING_MARK}, + {0x0020e1, 0x0020e1, PG_U_NONSPACING_MARK}, + {0x0020e2, 0x0020e4, PG_U_ENCLOSING_MARK}, + {0x0020e5, 0x0020f0, PG_U_NONSPACING_MARK}, + {0x002100, 0x002101, PG_U_OTHER_SYMBOL}, + {0x002102, 0x002102, PG_U_UPPERCASE_LETTER}, + {0x002103, 0x002106, PG_U_OTHER_SYMBOL}, + {0x002107, 0x002107, PG_U_UPPERCASE_LETTER}, + {0x002108, 0x002109, PG_U_OTHER_SYMBOL}, + {0x00210a, 0x00210a, PG_U_LOWERCASE_LETTER}, + {0x00210b, 0x00210d, PG_U_UPPERCASE_LETTER}, + {0x00210e, 0x00210f, PG_U_LOWERCASE_LETTER}, + {0x002110, 0x002112, PG_U_UPPERCASE_LETTER}, + {0x002113, 0x002113, PG_U_LOWERCASE_LETTER}, + {0x002114, 0x002114, PG_U_OTHER_SYMBOL}, + {0x002115, 0x002115, PG_U_UPPERCASE_LETTER}, + {0x002116, 0x002117, PG_U_OTHER_SYMBOL}, + {0x002118, 0x002118, PG_U_MATH_SYMBOL}, + {0x002119, 0x00211d, PG_U_UPPERCASE_LETTER}, + {0x00211e, 0x002123, PG_U_OTHER_SYMBOL}, + {0x002124, 0x002124, PG_U_UPPERCASE_LETTER}, + {0x002125, 0x002125, PG_U_OTHER_SYMBOL}, + {0x002126, 0x002126, PG_U_UPPERCASE_LETTER}, + {0x002127, 0x002127, PG_U_OTHER_SYMBOL}, + {0x002128, 0x002128, PG_U_UPPERCASE_LETTER}, + {0x002129, 0x002129, PG_U_OTHER_SYMBOL}, + {0x00212a, 0x00212d, PG_U_UPPERCASE_LETTER}, + {0x00212e, 0x00212e, PG_U_OTHER_SYMBOL}, + {0x00212f, 0x00212f, PG_U_LOWERCASE_LETTER}, + {0x002130, 0x002133, PG_U_UPPERCASE_LETTER}, + {0x002134, 0x002134, PG_U_LOWERCASE_LETTER}, + {0x002135, 0x002138, PG_U_OTHER_LETTER}, + {0x002139, 0x002139, PG_U_LOWERCASE_LETTER}, + {0x00213a, 0x00213b, PG_U_OTHER_SYMBOL}, + {0x00213c, 0x00213d, PG_U_LOWERCASE_LETTER}, + {0x00213e, 0x00213f, PG_U_UPPERCASE_LETTER}, + {0x002140, 0x002144, PG_U_MATH_SYMBOL}, + {0x002145, 0x002145, PG_U_UPPERCASE_LETTER}, + {0x002146, 0x002149, PG_U_LOWERCASE_LETTER}, + {0x00214a, 0x00214a, PG_U_OTHER_SYMBOL}, + {0x00214b, 0x00214b, PG_U_MATH_SYMBOL}, + {0x00214c, 0x00214d, PG_U_OTHER_SYMBOL}, + {0x00214e, 0x00214e, PG_U_LOWERCASE_LETTER}, + {0x00214f, 0x00214f, PG_U_OTHER_SYMBOL}, + {0x002150, 0x00215f, PG_U_OTHER_NUMBER}, + {0x002160, 0x002182, PG_U_LETTER_NUMBER}, + {0x002183, 0x002183, PG_U_UPPERCASE_LETTER}, + {0x002184, 0x002184, PG_U_LOWERCASE_LETTER}, + {0x002185, 0x002188, PG_U_LETTER_NUMBER}, + {0x002189, 0x002189, PG_U_OTHER_NUMBER}, + {0x00218a, 0x00218b, PG_U_OTHER_SYMBOL}, + {0x002190, 0x002194, PG_U_MATH_SYMBOL}, + {0x002195, 0x002199, PG_U_OTHER_SYMBOL}, + {0x00219a, 0x00219b, PG_U_MATH_SYMBOL}, + {0x00219c, 0x00219f, PG_U_OTHER_SYMBOL}, + {0x0021a0, 0x0021a0, PG_U_MATH_SYMBOL}, + {0x0021a1, 0x0021a2, PG_U_OTHER_SYMBOL}, + {0x0021a3, 0x0021a3, PG_U_MATH_SYMBOL}, + {0x0021a4, 0x0021a5, PG_U_OTHER_SYMBOL}, + {0x0021a6, 0x0021a6, PG_U_MATH_SYMBOL}, + {0x0021a7, 0x0021ad, PG_U_OTHER_SYMBOL}, + {0x0021ae, 0x0021ae, PG_U_MATH_SYMBOL}, + {0x0021af, 0x0021cd, PG_U_OTHER_SYMBOL}, + {0x0021ce, 0x0021cf, PG_U_MATH_SYMBOL}, + {0x0021d0, 0x0021d1, PG_U_OTHER_SYMBOL}, + {0x0021d2, 0x0021d2, PG_U_MATH_SYMBOL}, + {0x0021d3, 0x0021d3, PG_U_OTHER_SYMBOL}, + {0x0021d4, 0x0021d4, PG_U_MATH_SYMBOL}, + {0x0021d5, 0x0021f3, PG_U_OTHER_SYMBOL}, + {0x0021f4, 0x0022ff, PG_U_MATH_SYMBOL}, + {0x002300, 0x002307, PG_U_OTHER_SYMBOL}, + {0x002308, 0x002308, PG_U_OPEN_PUNCTUATION}, + {0x002309, 0x002309, PG_U_CLOSE_PUNCTUATION}, + {0x00230a, 0x00230a, PG_U_OPEN_PUNCTUATION}, + {0x00230b, 0x00230b, PG_U_CLOSE_PUNCTUATION}, + {0x00230c, 0x00231f, PG_U_OTHER_SYMBOL}, + {0x002320, 0x002321, PG_U_MATH_SYMBOL}, + {0x002322, 0x002328, PG_U_OTHER_SYMBOL}, + {0x002329, 0x002329, PG_U_OPEN_PUNCTUATION}, + {0x00232a, 0x00232a, PG_U_CLOSE_PUNCTUATION}, + {0x00232b, 0x00237b, PG_U_OTHER_SYMBOL}, + {0x00237c, 0x00237c, PG_U_MATH_SYMBOL}, + {0x00237d, 0x00239a, PG_U_OTHER_SYMBOL}, + {0x00239b, 0x0023b3, PG_U_MATH_SYMBOL}, + {0x0023b4, 0x0023db, PG_U_OTHER_SYMBOL}, + {0x0023dc, 0x0023e1, PG_U_MATH_SYMBOL}, + {0x0023e2, 0x002429, PG_U_OTHER_SYMBOL}, + {0x002440, 0x00244a, PG_U_OTHER_SYMBOL}, + {0x002460, 0x00249b, PG_U_OTHER_NUMBER}, + {0x00249c, 0x0024e9, PG_U_OTHER_SYMBOL}, + {0x0024ea, 0x0024ff, PG_U_OTHER_NUMBER}, + {0x002500, 0x0025b6, PG_U_OTHER_SYMBOL}, + {0x0025b7, 0x0025b7, PG_U_MATH_SYMBOL}, + {0x0025b8, 0x0025c0, PG_U_OTHER_SYMBOL}, + {0x0025c1, 0x0025c1, PG_U_MATH_SYMBOL}, + {0x0025c2, 0x0025f7, PG_U_OTHER_SYMBOL}, + {0x0025f8, 0x0025ff, PG_U_MATH_SYMBOL}, + {0x002600, 0x00266e, PG_U_OTHER_SYMBOL}, + {0x00266f, 0x00266f, PG_U_MATH_SYMBOL}, + {0x002670, 0x002767, PG_U_OTHER_SYMBOL}, + {0x002768, 0x002768, PG_U_OPEN_PUNCTUATION}, + {0x002769, 0x002769, PG_U_CLOSE_PUNCTUATION}, + {0x00276a, 0x00276a, PG_U_OPEN_PUNCTUATION}, + {0x00276b, 0x00276b, PG_U_CLOSE_PUNCTUATION}, + {0x00276c, 0x00276c, PG_U_OPEN_PUNCTUATION}, + {0x00276d, 0x00276d, PG_U_CLOSE_PUNCTUATION}, + {0x00276e, 0x00276e, PG_U_OPEN_PUNCTUATION}, + {0x00276f, 0x00276f, PG_U_CLOSE_PUNCTUATION}, + {0x002770, 0x002770, PG_U_OPEN_PUNCTUATION}, + {0x002771, 0x002771, PG_U_CLOSE_PUNCTUATION}, + {0x002772, 0x002772, PG_U_OPEN_PUNCTUATION}, + {0x002773, 0x002773, PG_U_CLOSE_PUNCTUATION}, + {0x002774, 0x002774, PG_U_OPEN_PUNCTUATION}, + {0x002775, 0x002775, PG_U_CLOSE_PUNCTUATION}, + {0x002776, 0x002793, PG_U_OTHER_NUMBER}, + {0x002794, 0x0027bf, PG_U_OTHER_SYMBOL}, + {0x0027c0, 0x0027c4, PG_U_MATH_SYMBOL}, + {0x0027c5, 0x0027c5, PG_U_OPEN_PUNCTUATION}, + {0x0027c6, 0x0027c6, PG_U_CLOSE_PUNCTUATION}, + {0x0027c7, 0x0027e5, PG_U_MATH_SYMBOL}, + {0x0027e6, 0x0027e6, PG_U_OPEN_PUNCTUATION}, + {0x0027e7, 0x0027e7, PG_U_CLOSE_PUNCTUATION}, + {0x0027e8, 0x0027e8, PG_U_OPEN_PUNCTUATION}, + {0x0027e9, 0x0027e9, PG_U_CLOSE_PUNCTUATION}, + {0x0027ea, 0x0027ea, PG_U_OPEN_PUNCTUATION}, + {0x0027eb, 0x0027eb, PG_U_CLOSE_PUNCTUATION}, + {0x0027ec, 0x0027ec, PG_U_OPEN_PUNCTUATION}, + {0x0027ed, 0x0027ed, PG_U_CLOSE_PUNCTUATION}, + {0x0027ee, 0x0027ee, PG_U_OPEN_PUNCTUATION}, + {0x0027ef, 0x0027ef, PG_U_CLOSE_PUNCTUATION}, + {0x0027f0, 0x0027ff, PG_U_MATH_SYMBOL}, + {0x002800, 0x0028ff, PG_U_OTHER_SYMBOL}, + {0x002900, 0x002982, PG_U_MATH_SYMBOL}, + {0x002983, 0x002983, PG_U_OPEN_PUNCTUATION}, + {0x002984, 0x002984, PG_U_CLOSE_PUNCTUATION}, + {0x002985, 0x002985, PG_U_OPEN_PUNCTUATION}, + {0x002986, 0x002986, PG_U_CLOSE_PUNCTUATION}, + {0x002987, 0x002987, PG_U_OPEN_PUNCTUATION}, + {0x002988, 0x002988, PG_U_CLOSE_PUNCTUATION}, + {0x002989, 0x002989, PG_U_OPEN_PUNCTUATION}, + {0x00298a, 0x00298a, PG_U_CLOSE_PUNCTUATION}, + {0x00298b, 0x00298b, PG_U_OPEN_PUNCTUATION}, + {0x00298c, 0x00298c, PG_U_CLOSE_PUNCTUATION}, + {0x00298d, 0x00298d, PG_U_OPEN_PUNCTUATION}, + {0x00298e, 0x00298e, PG_U_CLOSE_PUNCTUATION}, + {0x00298f, 0x00298f, PG_U_OPEN_PUNCTUATION}, + {0x002990, 0x002990, PG_U_CLOSE_PUNCTUATION}, + {0x002991, 0x002991, PG_U_OPEN_PUNCTUATION}, + {0x002992, 0x002992, PG_U_CLOSE_PUNCTUATION}, + {0x002993, 0x002993, PG_U_OPEN_PUNCTUATION}, + {0x002994, 0x002994, PG_U_CLOSE_PUNCTUATION}, + {0x002995, 0x002995, PG_U_OPEN_PUNCTUATION}, + {0x002996, 0x002996, PG_U_CLOSE_PUNCTUATION}, + {0x002997, 0x002997, PG_U_OPEN_PUNCTUATION}, + {0x002998, 0x002998, PG_U_CLOSE_PUNCTUATION}, + {0x002999, 0x0029d7, PG_U_MATH_SYMBOL}, + {0x0029d8, 0x0029d8, PG_U_OPEN_PUNCTUATION}, + {0x0029d9, 0x0029d9, PG_U_CLOSE_PUNCTUATION}, + {0x0029da, 0x0029da, PG_U_OPEN_PUNCTUATION}, + {0x0029db, 0x0029db, PG_U_CLOSE_PUNCTUATION}, + {0x0029dc, 0x0029fb, PG_U_MATH_SYMBOL}, + {0x0029fc, 0x0029fc, PG_U_OPEN_PUNCTUATION}, + {0x0029fd, 0x0029fd, PG_U_CLOSE_PUNCTUATION}, + {0x0029fe, 0x002aff, PG_U_MATH_SYMBOL}, + {0x002b00, 0x002b2f, PG_U_OTHER_SYMBOL}, + {0x002b30, 0x002b44, PG_U_MATH_SYMBOL}, + {0x002b45, 0x002b46, PG_U_OTHER_SYMBOL}, + {0x002b47, 0x002b4c, PG_U_MATH_SYMBOL}, + {0x002b4d, 0x002b73, PG_U_OTHER_SYMBOL}, + {0x002b76, 0x002b95, PG_U_OTHER_SYMBOL}, + {0x002b97, 0x002bff, PG_U_OTHER_SYMBOL}, + {0x002c00, 0x002c2f, PG_U_UPPERCASE_LETTER}, + {0x002c30, 0x002c5f, PG_U_LOWERCASE_LETTER}, + {0x002c60, 0x002c60, PG_U_UPPERCASE_LETTER}, + {0x002c61, 0x002c61, PG_U_LOWERCASE_LETTER}, + {0x002c62, 0x002c64, PG_U_UPPERCASE_LETTER}, + {0x002c65, 0x002c66, PG_U_LOWERCASE_LETTER}, + {0x002c67, 0x002c67, PG_U_UPPERCASE_LETTER}, + {0x002c68, 0x002c68, PG_U_LOWERCASE_LETTER}, + {0x002c69, 0x002c69, PG_U_UPPERCASE_LETTER}, + {0x002c6a, 0x002c6a, PG_U_LOWERCASE_LETTER}, + {0x002c6b, 0x002c6b, PG_U_UPPERCASE_LETTER}, + {0x002c6c, 0x002c6c, PG_U_LOWERCASE_LETTER}, + {0x002c6d, 0x002c70, PG_U_UPPERCASE_LETTER}, + {0x002c71, 0x002c71, PG_U_LOWERCASE_LETTER}, + {0x002c72, 0x002c72, PG_U_UPPERCASE_LETTER}, + {0x002c73, 0x002c74, PG_U_LOWERCASE_LETTER}, + {0x002c75, 0x002c75, PG_U_UPPERCASE_LETTER}, + {0x002c76, 0x002c7b, PG_U_LOWERCASE_LETTER}, + {0x002c7c, 0x002c7d, PG_U_MODIFIER_LETTER}, + {0x002c7e, 0x002c80, PG_U_UPPERCASE_LETTER}, + {0x002c81, 0x002c81, PG_U_LOWERCASE_LETTER}, + {0x002c82, 0x002c82, PG_U_UPPERCASE_LETTER}, + {0x002c83, 0x002c83, PG_U_LOWERCASE_LETTER}, + {0x002c84, 0x002c84, PG_U_UPPERCASE_LETTER}, + {0x002c85, 0x002c85, PG_U_LOWERCASE_LETTER}, + {0x002c86, 0x002c86, PG_U_UPPERCASE_LETTER}, + {0x002c87, 0x002c87, PG_U_LOWERCASE_LETTER}, + {0x002c88, 0x002c88, PG_U_UPPERCASE_LETTER}, + {0x002c89, 0x002c89, PG_U_LOWERCASE_LETTER}, + {0x002c8a, 0x002c8a, PG_U_UPPERCASE_LETTER}, + {0x002c8b, 0x002c8b, PG_U_LOWERCASE_LETTER}, + {0x002c8c, 0x002c8c, PG_U_UPPERCASE_LETTER}, + {0x002c8d, 0x002c8d, PG_U_LOWERCASE_LETTER}, + {0x002c8e, 0x002c8e, PG_U_UPPERCASE_LETTER}, + {0x002c8f, 0x002c8f, PG_U_LOWERCASE_LETTER}, + {0x002c90, 0x002c90, PG_U_UPPERCASE_LETTER}, + {0x002c91, 0x002c91, PG_U_LOWERCASE_LETTER}, + {0x002c92, 0x002c92, PG_U_UPPERCASE_LETTER}, + {0x002c93, 0x002c93, PG_U_LOWERCASE_LETTER}, + {0x002c94, 0x002c94, PG_U_UPPERCASE_LETTER}, + {0x002c95, 0x002c95, PG_U_LOWERCASE_LETTER}, + {0x002c96, 0x002c96, PG_U_UPPERCASE_LETTER}, + {0x002c97, 0x002c97, PG_U_LOWERCASE_LETTER}, + {0x002c98, 0x002c98, PG_U_UPPERCASE_LETTER}, + {0x002c99, 0x002c99, PG_U_LOWERCASE_LETTER}, + {0x002c9a, 0x002c9a, PG_U_UPPERCASE_LETTER}, + {0x002c9b, 0x002c9b, PG_U_LOWERCASE_LETTER}, + {0x002c9c, 0x002c9c, PG_U_UPPERCASE_LETTER}, + {0x002c9d, 0x002c9d, PG_U_LOWERCASE_LETTER}, + {0x002c9e, 0x002c9e, PG_U_UPPERCASE_LETTER}, + {0x002c9f, 0x002c9f, PG_U_LOWERCASE_LETTER}, + {0x002ca0, 0x002ca0, PG_U_UPPERCASE_LETTER}, + {0x002ca1, 0x002ca1, PG_U_LOWERCASE_LETTER}, + {0x002ca2, 0x002ca2, PG_U_UPPERCASE_LETTER}, + {0x002ca3, 0x002ca3, PG_U_LOWERCASE_LETTER}, + {0x002ca4, 0x002ca4, PG_U_UPPERCASE_LETTER}, + {0x002ca5, 0x002ca5, PG_U_LOWERCASE_LETTER}, + {0x002ca6, 0x002ca6, PG_U_UPPERCASE_LETTER}, + {0x002ca7, 0x002ca7, PG_U_LOWERCASE_LETTER}, + {0x002ca8, 0x002ca8, PG_U_UPPERCASE_LETTER}, + {0x002ca9, 0x002ca9, PG_U_LOWERCASE_LETTER}, + {0x002caa, 0x002caa, PG_U_UPPERCASE_LETTER}, + {0x002cab, 0x002cab, PG_U_LOWERCASE_LETTER}, + {0x002cac, 0x002cac, PG_U_UPPERCASE_LETTER}, + {0x002cad, 0x002cad, PG_U_LOWERCASE_LETTER}, + {0x002cae, 0x002cae, PG_U_UPPERCASE_LETTER}, + {0x002caf, 0x002caf, PG_U_LOWERCASE_LETTER}, + {0x002cb0, 0x002cb0, PG_U_UPPERCASE_LETTER}, + {0x002cb1, 0x002cb1, PG_U_LOWERCASE_LETTER}, + {0x002cb2, 0x002cb2, PG_U_UPPERCASE_LETTER}, + {0x002cb3, 0x002cb3, PG_U_LOWERCASE_LETTER}, + {0x002cb4, 0x002cb4, PG_U_UPPERCASE_LETTER}, + {0x002cb5, 0x002cb5, PG_U_LOWERCASE_LETTER}, + {0x002cb6, 0x002cb6, PG_U_UPPERCASE_LETTER}, + {0x002cb7, 0x002cb7, PG_U_LOWERCASE_LETTER}, + {0x002cb8, 0x002cb8, PG_U_UPPERCASE_LETTER}, + {0x002cb9, 0x002cb9, PG_U_LOWERCASE_LETTER}, + {0x002cba, 0x002cba, PG_U_UPPERCASE_LETTER}, + {0x002cbb, 0x002cbb, PG_U_LOWERCASE_LETTER}, + {0x002cbc, 0x002cbc, PG_U_UPPERCASE_LETTER}, + {0x002cbd, 0x002cbd, PG_U_LOWERCASE_LETTER}, + {0x002cbe, 0x002cbe, PG_U_UPPERCASE_LETTER}, + {0x002cbf, 0x002cbf, PG_U_LOWERCASE_LETTER}, + {0x002cc0, 0x002cc0, PG_U_UPPERCASE_LETTER}, + {0x002cc1, 0x002cc1, PG_U_LOWERCASE_LETTER}, + {0x002cc2, 0x002cc2, PG_U_UPPERCASE_LETTER}, + {0x002cc3, 0x002cc3, PG_U_LOWERCASE_LETTER}, + {0x002cc4, 0x002cc4, PG_U_UPPERCASE_LETTER}, + {0x002cc5, 0x002cc5, PG_U_LOWERCASE_LETTER}, + {0x002cc6, 0x002cc6, PG_U_UPPERCASE_LETTER}, + {0x002cc7, 0x002cc7, PG_U_LOWERCASE_LETTER}, + {0x002cc8, 0x002cc8, PG_U_UPPERCASE_LETTER}, + {0x002cc9, 0x002cc9, PG_U_LOWERCASE_LETTER}, + {0x002cca, 0x002cca, PG_U_UPPERCASE_LETTER}, + {0x002ccb, 0x002ccb, PG_U_LOWERCASE_LETTER}, + {0x002ccc, 0x002ccc, PG_U_UPPERCASE_LETTER}, + {0x002ccd, 0x002ccd, PG_U_LOWERCASE_LETTER}, + {0x002cce, 0x002cce, PG_U_UPPERCASE_LETTER}, + {0x002ccf, 0x002ccf, PG_U_LOWERCASE_LETTER}, + {0x002cd0, 0x002cd0, PG_U_UPPERCASE_LETTER}, + {0x002cd1, 0x002cd1, PG_U_LOWERCASE_LETTER}, + {0x002cd2, 0x002cd2, PG_U_UPPERCASE_LETTER}, + {0x002cd3, 0x002cd3, PG_U_LOWERCASE_LETTER}, + {0x002cd4, 0x002cd4, PG_U_UPPERCASE_LETTER}, + {0x002cd5, 0x002cd5, PG_U_LOWERCASE_LETTER}, + {0x002cd6, 0x002cd6, PG_U_UPPERCASE_LETTER}, + {0x002cd7, 0x002cd7, PG_U_LOWERCASE_LETTER}, + {0x002cd8, 0x002cd8, PG_U_UPPERCASE_LETTER}, + {0x002cd9, 0x002cd9, PG_U_LOWERCASE_LETTER}, + {0x002cda, 0x002cda, PG_U_UPPERCASE_LETTER}, + {0x002cdb, 0x002cdb, PG_U_LOWERCASE_LETTER}, + {0x002cdc, 0x002cdc, PG_U_UPPERCASE_LETTER}, + {0x002cdd, 0x002cdd, PG_U_LOWERCASE_LETTER}, + {0x002cde, 0x002cde, PG_U_UPPERCASE_LETTER}, + {0x002cdf, 0x002cdf, PG_U_LOWERCASE_LETTER}, + {0x002ce0, 0x002ce0, PG_U_UPPERCASE_LETTER}, + {0x002ce1, 0x002ce1, PG_U_LOWERCASE_LETTER}, + {0x002ce2, 0x002ce2, PG_U_UPPERCASE_LETTER}, + {0x002ce3, 0x002ce4, PG_U_LOWERCASE_LETTER}, + {0x002ce5, 0x002cea, PG_U_OTHER_SYMBOL}, + {0x002ceb, 0x002ceb, PG_U_UPPERCASE_LETTER}, + {0x002cec, 0x002cec, PG_U_LOWERCASE_LETTER}, + {0x002ced, 0x002ced, PG_U_UPPERCASE_LETTER}, + {0x002cee, 0x002cee, PG_U_LOWERCASE_LETTER}, + {0x002cef, 0x002cf1, PG_U_NONSPACING_MARK}, + {0x002cf2, 0x002cf2, PG_U_UPPERCASE_LETTER}, + {0x002cf3, 0x002cf3, PG_U_LOWERCASE_LETTER}, + {0x002cf9, 0x002cfc, PG_U_OTHER_PUNCTUATION}, + {0x002cfd, 0x002cfd, PG_U_OTHER_NUMBER}, + {0x002cfe, 0x002cff, PG_U_OTHER_PUNCTUATION}, + {0x002d00, 0x002d25, PG_U_LOWERCASE_LETTER}, + {0x002d27, 0x002d27, PG_U_LOWERCASE_LETTER}, + {0x002d2d, 0x002d2d, PG_U_LOWERCASE_LETTER}, + {0x002d30, 0x002d67, PG_U_OTHER_LETTER}, + {0x002d6f, 0x002d6f, PG_U_MODIFIER_LETTER}, + {0x002d70, 0x002d70, PG_U_OTHER_PUNCTUATION}, + {0x002d7f, 0x002d7f, PG_U_NONSPACING_MARK}, + {0x002d80, 0x002d96, PG_U_OTHER_LETTER}, + {0x002da0, 0x002da6, PG_U_OTHER_LETTER}, + {0x002da8, 0x002dae, PG_U_OTHER_LETTER}, + {0x002db0, 0x002db6, PG_U_OTHER_LETTER}, + {0x002db8, 0x002dbe, PG_U_OTHER_LETTER}, + {0x002dc0, 0x002dc6, PG_U_OTHER_LETTER}, + {0x002dc8, 0x002dce, PG_U_OTHER_LETTER}, + {0x002dd0, 0x002dd6, PG_U_OTHER_LETTER}, + {0x002dd8, 0x002dde, PG_U_OTHER_LETTER}, + {0x002de0, 0x002dff, PG_U_NONSPACING_MARK}, + {0x002e00, 0x002e01, PG_U_OTHER_PUNCTUATION}, + {0x002e02, 0x002e02, PG_U_INITIAL_PUNCTUATION}, + {0x002e03, 0x002e03, PG_U_FINAL_PUNCTUATION}, + {0x002e04, 0x002e04, PG_U_INITIAL_PUNCTUATION}, + {0x002e05, 0x002e05, PG_U_FINAL_PUNCTUATION}, + {0x002e06, 0x002e08, PG_U_OTHER_PUNCTUATION}, + {0x002e09, 0x002e09, PG_U_INITIAL_PUNCTUATION}, + {0x002e0a, 0x002e0a, PG_U_FINAL_PUNCTUATION}, + {0x002e0b, 0x002e0b, PG_U_OTHER_PUNCTUATION}, + {0x002e0c, 0x002e0c, PG_U_INITIAL_PUNCTUATION}, + {0x002e0d, 0x002e0d, PG_U_FINAL_PUNCTUATION}, + {0x002e0e, 0x002e16, PG_U_OTHER_PUNCTUATION}, + {0x002e17, 0x002e17, PG_U_DASH_PUNCTUATION}, + {0x002e18, 0x002e19, PG_U_OTHER_PUNCTUATION}, + {0x002e1a, 0x002e1a, PG_U_DASH_PUNCTUATION}, + {0x002e1b, 0x002e1b, PG_U_OTHER_PUNCTUATION}, + {0x002e1c, 0x002e1c, PG_U_INITIAL_PUNCTUATION}, + {0x002e1d, 0x002e1d, PG_U_FINAL_PUNCTUATION}, + {0x002e1e, 0x002e1f, PG_U_OTHER_PUNCTUATION}, + {0x002e20, 0x002e20, PG_U_INITIAL_PUNCTUATION}, + {0x002e21, 0x002e21, PG_U_FINAL_PUNCTUATION}, + {0x002e22, 0x002e22, PG_U_OPEN_PUNCTUATION}, + {0x002e23, 0x002e23, PG_U_CLOSE_PUNCTUATION}, + {0x002e24, 0x002e24, PG_U_OPEN_PUNCTUATION}, + {0x002e25, 0x002e25, PG_U_CLOSE_PUNCTUATION}, + {0x002e26, 0x002e26, PG_U_OPEN_PUNCTUATION}, + {0x002e27, 0x002e27, PG_U_CLOSE_PUNCTUATION}, + {0x002e28, 0x002e28, PG_U_OPEN_PUNCTUATION}, + {0x002e29, 0x002e29, PG_U_CLOSE_PUNCTUATION}, + {0x002e2a, 0x002e2e, PG_U_OTHER_PUNCTUATION}, + {0x002e2f, 0x002e2f, PG_U_MODIFIER_LETTER}, + {0x002e30, 0x002e39, PG_U_OTHER_PUNCTUATION}, + {0x002e3a, 0x002e3b, PG_U_DASH_PUNCTUATION}, + {0x002e3c, 0x002e3f, PG_U_OTHER_PUNCTUATION}, + {0x002e40, 0x002e40, PG_U_DASH_PUNCTUATION}, + {0x002e41, 0x002e41, PG_U_OTHER_PUNCTUATION}, + {0x002e42, 0x002e42, PG_U_OPEN_PUNCTUATION}, + {0x002e43, 0x002e4f, PG_U_OTHER_PUNCTUATION}, + {0x002e50, 0x002e51, PG_U_OTHER_SYMBOL}, + {0x002e52, 0x002e54, PG_U_OTHER_PUNCTUATION}, + {0x002e55, 0x002e55, PG_U_OPEN_PUNCTUATION}, + {0x002e56, 0x002e56, PG_U_CLOSE_PUNCTUATION}, + {0x002e57, 0x002e57, PG_U_OPEN_PUNCTUATION}, + {0x002e58, 0x002e58, PG_U_CLOSE_PUNCTUATION}, + {0x002e59, 0x002e59, PG_U_OPEN_PUNCTUATION}, + {0x002e5a, 0x002e5a, PG_U_CLOSE_PUNCTUATION}, + {0x002e5b, 0x002e5b, PG_U_OPEN_PUNCTUATION}, + {0x002e5c, 0x002e5c, PG_U_CLOSE_PUNCTUATION}, + {0x002e5d, 0x002e5d, PG_U_DASH_PUNCTUATION}, + {0x002e80, 0x002e99, PG_U_OTHER_SYMBOL}, + {0x002e9b, 0x002ef3, PG_U_OTHER_SYMBOL}, + {0x002f00, 0x002fd5, PG_U_OTHER_SYMBOL}, + {0x002ff0, 0x002fff, PG_U_OTHER_SYMBOL}, + {0x003000, 0x003000, PG_U_SPACE_SEPARATOR}, + {0x003001, 0x003003, PG_U_OTHER_PUNCTUATION}, + {0x003004, 0x003004, PG_U_OTHER_SYMBOL}, + {0x003005, 0x003005, PG_U_MODIFIER_LETTER}, + {0x003006, 0x003006, PG_U_OTHER_LETTER}, + {0x003007, 0x003007, PG_U_LETTER_NUMBER}, + {0x003008, 0x003008, PG_U_OPEN_PUNCTUATION}, + {0x003009, 0x003009, PG_U_CLOSE_PUNCTUATION}, + {0x00300a, 0x00300a, PG_U_OPEN_PUNCTUATION}, + {0x00300b, 0x00300b, PG_U_CLOSE_PUNCTUATION}, + {0x00300c, 0x00300c, PG_U_OPEN_PUNCTUATION}, + {0x00300d, 0x00300d, PG_U_CLOSE_PUNCTUATION}, + {0x00300e, 0x00300e, PG_U_OPEN_PUNCTUATION}, + {0x00300f, 0x00300f, PG_U_CLOSE_PUNCTUATION}, + {0x003010, 0x003010, PG_U_OPEN_PUNCTUATION}, + {0x003011, 0x003011, PG_U_CLOSE_PUNCTUATION}, + {0x003012, 0x003013, PG_U_OTHER_SYMBOL}, + {0x003014, 0x003014, PG_U_OPEN_PUNCTUATION}, + {0x003015, 0x003015, PG_U_CLOSE_PUNCTUATION}, + {0x003016, 0x003016, PG_U_OPEN_PUNCTUATION}, + {0x003017, 0x003017, PG_U_CLOSE_PUNCTUATION}, + {0x003018, 0x003018, PG_U_OPEN_PUNCTUATION}, + {0x003019, 0x003019, PG_U_CLOSE_PUNCTUATION}, + {0x00301a, 0x00301a, PG_U_OPEN_PUNCTUATION}, + {0x00301b, 0x00301b, PG_U_CLOSE_PUNCTUATION}, + {0x00301c, 0x00301c, PG_U_DASH_PUNCTUATION}, + {0x00301d, 0x00301d, PG_U_OPEN_PUNCTUATION}, + {0x00301e, 0x00301f, PG_U_CLOSE_PUNCTUATION}, + {0x003020, 0x003020, PG_U_OTHER_SYMBOL}, + {0x003021, 0x003029, PG_U_LETTER_NUMBER}, + {0x00302a, 0x00302d, PG_U_NONSPACING_MARK}, + {0x00302e, 0x00302f, PG_U_SPACING_MARK}, + {0x003030, 0x003030, PG_U_DASH_PUNCTUATION}, + {0x003031, 0x003035, PG_U_MODIFIER_LETTER}, + {0x003036, 0x003037, PG_U_OTHER_SYMBOL}, + {0x003038, 0x00303a, PG_U_LETTER_NUMBER}, + {0x00303b, 0x00303b, PG_U_MODIFIER_LETTER}, + {0x00303c, 0x00303c, PG_U_OTHER_LETTER}, + {0x00303d, 0x00303d, PG_U_OTHER_PUNCTUATION}, + {0x00303e, 0x00303f, PG_U_OTHER_SYMBOL}, + {0x003041, 0x003096, PG_U_OTHER_LETTER}, + {0x003099, 0x00309a, PG_U_NONSPACING_MARK}, + {0x00309b, 0x00309c, PG_U_MODIFIER_SYMBOL}, + {0x00309d, 0x00309e, PG_U_MODIFIER_LETTER}, + {0x00309f, 0x00309f, PG_U_OTHER_LETTER}, + {0x0030a0, 0x0030a0, PG_U_DASH_PUNCTUATION}, + {0x0030a1, 0x0030fa, PG_U_OTHER_LETTER}, + {0x0030fb, 0x0030fb, PG_U_OTHER_PUNCTUATION}, + {0x0030fc, 0x0030fe, PG_U_MODIFIER_LETTER}, + {0x0030ff, 0x0030ff, PG_U_OTHER_LETTER}, + {0x003105, 0x00312f, PG_U_OTHER_LETTER}, + {0x003131, 0x00318e, PG_U_OTHER_LETTER}, + {0x003190, 0x003191, PG_U_OTHER_SYMBOL}, + {0x003192, 0x003195, PG_U_OTHER_NUMBER}, + {0x003196, 0x00319f, PG_U_OTHER_SYMBOL}, + {0x0031a0, 0x0031bf, PG_U_OTHER_LETTER}, + {0x0031c0, 0x0031e5, PG_U_OTHER_SYMBOL}, + {0x0031ef, 0x0031ef, PG_U_OTHER_SYMBOL}, + {0x0031f0, 0x0031ff, PG_U_OTHER_LETTER}, + {0x003200, 0x00321e, PG_U_OTHER_SYMBOL}, + {0x003220, 0x003229, PG_U_OTHER_NUMBER}, + {0x00322a, 0x003247, PG_U_OTHER_SYMBOL}, + {0x003248, 0x00324f, PG_U_OTHER_NUMBER}, + {0x003250, 0x003250, PG_U_OTHER_SYMBOL}, + {0x003251, 0x00325f, PG_U_OTHER_NUMBER}, + {0x003260, 0x00327f, PG_U_OTHER_SYMBOL}, + {0x003280, 0x003289, PG_U_OTHER_NUMBER}, + {0x00328a, 0x0032b0, PG_U_OTHER_SYMBOL}, + {0x0032b1, 0x0032bf, PG_U_OTHER_NUMBER}, + {0x0032c0, 0x0033ff, PG_U_OTHER_SYMBOL}, + {0x003400, 0x004dbf, PG_U_OTHER_LETTER}, + {0x004dc0, 0x004dff, PG_U_OTHER_SYMBOL}, + {0x004e00, 0x00a014, PG_U_OTHER_LETTER}, + {0x00a015, 0x00a015, PG_U_MODIFIER_LETTER}, + {0x00a016, 0x00a48c, PG_U_OTHER_LETTER}, + {0x00a490, 0x00a4c6, PG_U_OTHER_SYMBOL}, + {0x00a4d0, 0x00a4f7, PG_U_OTHER_LETTER}, + {0x00a4f8, 0x00a4fd, PG_U_MODIFIER_LETTER}, + {0x00a4fe, 0x00a4ff, PG_U_OTHER_PUNCTUATION}, + {0x00a500, 0x00a60b, PG_U_OTHER_LETTER}, + {0x00a60c, 0x00a60c, PG_U_MODIFIER_LETTER}, + {0x00a60d, 0x00a60f, PG_U_OTHER_PUNCTUATION}, + {0x00a610, 0x00a61f, PG_U_OTHER_LETTER}, + {0x00a620, 0x00a629, PG_U_DECIMAL_NUMBER}, + {0x00a62a, 0x00a62b, PG_U_OTHER_LETTER}, + {0x00a640, 0x00a640, PG_U_UPPERCASE_LETTER}, + {0x00a641, 0x00a641, PG_U_LOWERCASE_LETTER}, + {0x00a642, 0x00a642, PG_U_UPPERCASE_LETTER}, + {0x00a643, 0x00a643, PG_U_LOWERCASE_LETTER}, + {0x00a644, 0x00a644, PG_U_UPPERCASE_LETTER}, + {0x00a645, 0x00a645, PG_U_LOWERCASE_LETTER}, + {0x00a646, 0x00a646, PG_U_UPPERCASE_LETTER}, + {0x00a647, 0x00a647, PG_U_LOWERCASE_LETTER}, + {0x00a648, 0x00a648, PG_U_UPPERCASE_LETTER}, + {0x00a649, 0x00a649, PG_U_LOWERCASE_LETTER}, + {0x00a64a, 0x00a64a, PG_U_UPPERCASE_LETTER}, + {0x00a64b, 0x00a64b, PG_U_LOWERCASE_LETTER}, + {0x00a64c, 0x00a64c, PG_U_UPPERCASE_LETTER}, + {0x00a64d, 0x00a64d, PG_U_LOWERCASE_LETTER}, + {0x00a64e, 0x00a64e, PG_U_UPPERCASE_LETTER}, + {0x00a64f, 0x00a64f, PG_U_LOWERCASE_LETTER}, + {0x00a650, 0x00a650, PG_U_UPPERCASE_LETTER}, + {0x00a651, 0x00a651, PG_U_LOWERCASE_LETTER}, + {0x00a652, 0x00a652, PG_U_UPPERCASE_LETTER}, + {0x00a653, 0x00a653, PG_U_LOWERCASE_LETTER}, + {0x00a654, 0x00a654, PG_U_UPPERCASE_LETTER}, + {0x00a655, 0x00a655, PG_U_LOWERCASE_LETTER}, + {0x00a656, 0x00a656, PG_U_UPPERCASE_LETTER}, + {0x00a657, 0x00a657, PG_U_LOWERCASE_LETTER}, + {0x00a658, 0x00a658, PG_U_UPPERCASE_LETTER}, + {0x00a659, 0x00a659, PG_U_LOWERCASE_LETTER}, + {0x00a65a, 0x00a65a, PG_U_UPPERCASE_LETTER}, + {0x00a65b, 0x00a65b, PG_U_LOWERCASE_LETTER}, + {0x00a65c, 0x00a65c, PG_U_UPPERCASE_LETTER}, + {0x00a65d, 0x00a65d, PG_U_LOWERCASE_LETTER}, + {0x00a65e, 0x00a65e, PG_U_UPPERCASE_LETTER}, + {0x00a65f, 0x00a65f, PG_U_LOWERCASE_LETTER}, + {0x00a660, 0x00a660, PG_U_UPPERCASE_LETTER}, + {0x00a661, 0x00a661, PG_U_LOWERCASE_LETTER}, + {0x00a662, 0x00a662, PG_U_UPPERCASE_LETTER}, + {0x00a663, 0x00a663, PG_U_LOWERCASE_LETTER}, + {0x00a664, 0x00a664, PG_U_UPPERCASE_LETTER}, + {0x00a665, 0x00a665, PG_U_LOWERCASE_LETTER}, + {0x00a666, 0x00a666, PG_U_UPPERCASE_LETTER}, + {0x00a667, 0x00a667, PG_U_LOWERCASE_LETTER}, + {0x00a668, 0x00a668, PG_U_UPPERCASE_LETTER}, + {0x00a669, 0x00a669, PG_U_LOWERCASE_LETTER}, + {0x00a66a, 0x00a66a, PG_U_UPPERCASE_LETTER}, + {0x00a66b, 0x00a66b, PG_U_LOWERCASE_LETTER}, + {0x00a66c, 0x00a66c, PG_U_UPPERCASE_LETTER}, + {0x00a66d, 0x00a66d, PG_U_LOWERCASE_LETTER}, + {0x00a66e, 0x00a66e, PG_U_OTHER_LETTER}, + {0x00a66f, 0x00a66f, PG_U_NONSPACING_MARK}, + {0x00a670, 0x00a672, PG_U_ENCLOSING_MARK}, + {0x00a673, 0x00a673, PG_U_OTHER_PUNCTUATION}, + {0x00a674, 0x00a67d, PG_U_NONSPACING_MARK}, + {0x00a67e, 0x00a67e, PG_U_OTHER_PUNCTUATION}, + {0x00a67f, 0x00a67f, PG_U_MODIFIER_LETTER}, + {0x00a680, 0x00a680, PG_U_UPPERCASE_LETTER}, + {0x00a681, 0x00a681, PG_U_LOWERCASE_LETTER}, + {0x00a682, 0x00a682, PG_U_UPPERCASE_LETTER}, + {0x00a683, 0x00a683, PG_U_LOWERCASE_LETTER}, + {0x00a684, 0x00a684, PG_U_UPPERCASE_LETTER}, + {0x00a685, 0x00a685, PG_U_LOWERCASE_LETTER}, + {0x00a686, 0x00a686, PG_U_UPPERCASE_LETTER}, + {0x00a687, 0x00a687, PG_U_LOWERCASE_LETTER}, + {0x00a688, 0x00a688, PG_U_UPPERCASE_LETTER}, + {0x00a689, 0x00a689, PG_U_LOWERCASE_LETTER}, + {0x00a68a, 0x00a68a, PG_U_UPPERCASE_LETTER}, + {0x00a68b, 0x00a68b, PG_U_LOWERCASE_LETTER}, + {0x00a68c, 0x00a68c, PG_U_UPPERCASE_LETTER}, + {0x00a68d, 0x00a68d, PG_U_LOWERCASE_LETTER}, + {0x00a68e, 0x00a68e, PG_U_UPPERCASE_LETTER}, + {0x00a68f, 0x00a68f, PG_U_LOWERCASE_LETTER}, + {0x00a690, 0x00a690, PG_U_UPPERCASE_LETTER}, + {0x00a691, 0x00a691, PG_U_LOWERCASE_LETTER}, + {0x00a692, 0x00a692, PG_U_UPPERCASE_LETTER}, + {0x00a693, 0x00a693, PG_U_LOWERCASE_LETTER}, + {0x00a694, 0x00a694, PG_U_UPPERCASE_LETTER}, + {0x00a695, 0x00a695, PG_U_LOWERCASE_LETTER}, + {0x00a696, 0x00a696, PG_U_UPPERCASE_LETTER}, + {0x00a697, 0x00a697, PG_U_LOWERCASE_LETTER}, + {0x00a698, 0x00a698, PG_U_UPPERCASE_LETTER}, + {0x00a699, 0x00a699, PG_U_LOWERCASE_LETTER}, + {0x00a69a, 0x00a69a, PG_U_UPPERCASE_LETTER}, + {0x00a69b, 0x00a69b, PG_U_LOWERCASE_LETTER}, + {0x00a69c, 0x00a69d, PG_U_MODIFIER_LETTER}, + {0x00a69e, 0x00a69f, PG_U_NONSPACING_MARK}, + {0x00a6a0, 0x00a6e5, PG_U_OTHER_LETTER}, + {0x00a6e6, 0x00a6ef, PG_U_LETTER_NUMBER}, + {0x00a6f0, 0x00a6f1, PG_U_NONSPACING_MARK}, + {0x00a6f2, 0x00a6f7, PG_U_OTHER_PUNCTUATION}, + {0x00a700, 0x00a716, PG_U_MODIFIER_SYMBOL}, + {0x00a717, 0x00a71f, PG_U_MODIFIER_LETTER}, + {0x00a720, 0x00a721, PG_U_MODIFIER_SYMBOL}, + {0x00a722, 0x00a722, PG_U_UPPERCASE_LETTER}, + {0x00a723, 0x00a723, PG_U_LOWERCASE_LETTER}, + {0x00a724, 0x00a724, PG_U_UPPERCASE_LETTER}, + {0x00a725, 0x00a725, PG_U_LOWERCASE_LETTER}, + {0x00a726, 0x00a726, PG_U_UPPERCASE_LETTER}, + {0x00a727, 0x00a727, PG_U_LOWERCASE_LETTER}, + {0x00a728, 0x00a728, PG_U_UPPERCASE_LETTER}, + {0x00a729, 0x00a729, PG_U_LOWERCASE_LETTER}, + {0x00a72a, 0x00a72a, PG_U_UPPERCASE_LETTER}, + {0x00a72b, 0x00a72b, PG_U_LOWERCASE_LETTER}, + {0x00a72c, 0x00a72c, PG_U_UPPERCASE_LETTER}, + {0x00a72d, 0x00a72d, PG_U_LOWERCASE_LETTER}, + {0x00a72e, 0x00a72e, PG_U_UPPERCASE_LETTER}, + {0x00a72f, 0x00a731, PG_U_LOWERCASE_LETTER}, + {0x00a732, 0x00a732, PG_U_UPPERCASE_LETTER}, + {0x00a733, 0x00a733, PG_U_LOWERCASE_LETTER}, + {0x00a734, 0x00a734, PG_U_UPPERCASE_LETTER}, + {0x00a735, 0x00a735, PG_U_LOWERCASE_LETTER}, + {0x00a736, 0x00a736, PG_U_UPPERCASE_LETTER}, + {0x00a737, 0x00a737, PG_U_LOWERCASE_LETTER}, + {0x00a738, 0x00a738, PG_U_UPPERCASE_LETTER}, + {0x00a739, 0x00a739, PG_U_LOWERCASE_LETTER}, + {0x00a73a, 0x00a73a, PG_U_UPPERCASE_LETTER}, + {0x00a73b, 0x00a73b, PG_U_LOWERCASE_LETTER}, + {0x00a73c, 0x00a73c, PG_U_UPPERCASE_LETTER}, + {0x00a73d, 0x00a73d, PG_U_LOWERCASE_LETTER}, + {0x00a73e, 0x00a73e, PG_U_UPPERCASE_LETTER}, + {0x00a73f, 0x00a73f, PG_U_LOWERCASE_LETTER}, + {0x00a740, 0x00a740, PG_U_UPPERCASE_LETTER}, + {0x00a741, 0x00a741, PG_U_LOWERCASE_LETTER}, + {0x00a742, 0x00a742, PG_U_UPPERCASE_LETTER}, + {0x00a743, 0x00a743, PG_U_LOWERCASE_LETTER}, + {0x00a744, 0x00a744, PG_U_UPPERCASE_LETTER}, + {0x00a745, 0x00a745, PG_U_LOWERCASE_LETTER}, + {0x00a746, 0x00a746, PG_U_UPPERCASE_LETTER}, + {0x00a747, 0x00a747, PG_U_LOWERCASE_LETTER}, + {0x00a748, 0x00a748, PG_U_UPPERCASE_LETTER}, + {0x00a749, 0x00a749, PG_U_LOWERCASE_LETTER}, + {0x00a74a, 0x00a74a, PG_U_UPPERCASE_LETTER}, + {0x00a74b, 0x00a74b, PG_U_LOWERCASE_LETTER}, + {0x00a74c, 0x00a74c, PG_U_UPPERCASE_LETTER}, + {0x00a74d, 0x00a74d, PG_U_LOWERCASE_LETTER}, + {0x00a74e, 0x00a74e, PG_U_UPPERCASE_LETTER}, + {0x00a74f, 0x00a74f, PG_U_LOWERCASE_LETTER}, + {0x00a750, 0x00a750, PG_U_UPPERCASE_LETTER}, + {0x00a751, 0x00a751, PG_U_LOWERCASE_LETTER}, + {0x00a752, 0x00a752, PG_U_UPPERCASE_LETTER}, + {0x00a753, 0x00a753, PG_U_LOWERCASE_LETTER}, + {0x00a754, 0x00a754, PG_U_UPPERCASE_LETTER}, + {0x00a755, 0x00a755, PG_U_LOWERCASE_LETTER}, + {0x00a756, 0x00a756, PG_U_UPPERCASE_LETTER}, + {0x00a757, 0x00a757, PG_U_LOWERCASE_LETTER}, + {0x00a758, 0x00a758, PG_U_UPPERCASE_LETTER}, + {0x00a759, 0x00a759, PG_U_LOWERCASE_LETTER}, + {0x00a75a, 0x00a75a, PG_U_UPPERCASE_LETTER}, + {0x00a75b, 0x00a75b, PG_U_LOWERCASE_LETTER}, + {0x00a75c, 0x00a75c, PG_U_UPPERCASE_LETTER}, + {0x00a75d, 0x00a75d, PG_U_LOWERCASE_LETTER}, + {0x00a75e, 0x00a75e, PG_U_UPPERCASE_LETTER}, + {0x00a75f, 0x00a75f, PG_U_LOWERCASE_LETTER}, + {0x00a760, 0x00a760, PG_U_UPPERCASE_LETTER}, + {0x00a761, 0x00a761, PG_U_LOWERCASE_LETTER}, + {0x00a762, 0x00a762, PG_U_UPPERCASE_LETTER}, + {0x00a763, 0x00a763, PG_U_LOWERCASE_LETTER}, + {0x00a764, 0x00a764, PG_U_UPPERCASE_LETTER}, + {0x00a765, 0x00a765, PG_U_LOWERCASE_LETTER}, + {0x00a766, 0x00a766, PG_U_UPPERCASE_LETTER}, + {0x00a767, 0x00a767, PG_U_LOWERCASE_LETTER}, + {0x00a768, 0x00a768, PG_U_UPPERCASE_LETTER}, + {0x00a769, 0x00a769, PG_U_LOWERCASE_LETTER}, + {0x00a76a, 0x00a76a, PG_U_UPPERCASE_LETTER}, + {0x00a76b, 0x00a76b, PG_U_LOWERCASE_LETTER}, + {0x00a76c, 0x00a76c, PG_U_UPPERCASE_LETTER}, + {0x00a76d, 0x00a76d, PG_U_LOWERCASE_LETTER}, + {0x00a76e, 0x00a76e, PG_U_UPPERCASE_LETTER}, + {0x00a76f, 0x00a76f, PG_U_LOWERCASE_LETTER}, + {0x00a770, 0x00a770, PG_U_MODIFIER_LETTER}, + {0x00a771, 0x00a778, PG_U_LOWERCASE_LETTER}, + {0x00a779, 0x00a779, PG_U_UPPERCASE_LETTER}, + {0x00a77a, 0x00a77a, PG_U_LOWERCASE_LETTER}, + {0x00a77b, 0x00a77b, PG_U_UPPERCASE_LETTER}, + {0x00a77c, 0x00a77c, PG_U_LOWERCASE_LETTER}, + {0x00a77d, 0x00a77e, PG_U_UPPERCASE_LETTER}, + {0x00a77f, 0x00a77f, PG_U_LOWERCASE_LETTER}, + {0x00a780, 0x00a780, PG_U_UPPERCASE_LETTER}, + {0x00a781, 0x00a781, PG_U_LOWERCASE_LETTER}, + {0x00a782, 0x00a782, PG_U_UPPERCASE_LETTER}, + {0x00a783, 0x00a783, PG_U_LOWERCASE_LETTER}, + {0x00a784, 0x00a784, PG_U_UPPERCASE_LETTER}, + {0x00a785, 0x00a785, PG_U_LOWERCASE_LETTER}, + {0x00a786, 0x00a786, PG_U_UPPERCASE_LETTER}, + {0x00a787, 0x00a787, PG_U_LOWERCASE_LETTER}, + {0x00a788, 0x00a788, PG_U_MODIFIER_LETTER}, + {0x00a789, 0x00a78a, PG_U_MODIFIER_SYMBOL}, + {0x00a78b, 0x00a78b, PG_U_UPPERCASE_LETTER}, + {0x00a78c, 0x00a78c, PG_U_LOWERCASE_LETTER}, + {0x00a78d, 0x00a78d, PG_U_UPPERCASE_LETTER}, + {0x00a78e, 0x00a78e, PG_U_LOWERCASE_LETTER}, + {0x00a78f, 0x00a78f, PG_U_OTHER_LETTER}, + {0x00a790, 0x00a790, PG_U_UPPERCASE_LETTER}, + {0x00a791, 0x00a791, PG_U_LOWERCASE_LETTER}, + {0x00a792, 0x00a792, PG_U_UPPERCASE_LETTER}, + {0x00a793, 0x00a795, PG_U_LOWERCASE_LETTER}, + {0x00a796, 0x00a796, PG_U_UPPERCASE_LETTER}, + {0x00a797, 0x00a797, PG_U_LOWERCASE_LETTER}, + {0x00a798, 0x00a798, PG_U_UPPERCASE_LETTER}, + {0x00a799, 0x00a799, PG_U_LOWERCASE_LETTER}, + {0x00a79a, 0x00a79a, PG_U_UPPERCASE_LETTER}, + {0x00a79b, 0x00a79b, PG_U_LOWERCASE_LETTER}, + {0x00a79c, 0x00a79c, PG_U_UPPERCASE_LETTER}, + {0x00a79d, 0x00a79d, PG_U_LOWERCASE_LETTER}, + {0x00a79e, 0x00a79e, PG_U_UPPERCASE_LETTER}, + {0x00a79f, 0x00a79f, PG_U_LOWERCASE_LETTER}, + {0x00a7a0, 0x00a7a0, PG_U_UPPERCASE_LETTER}, + {0x00a7a1, 0x00a7a1, PG_U_LOWERCASE_LETTER}, + {0x00a7a2, 0x00a7a2, PG_U_UPPERCASE_LETTER}, + {0x00a7a3, 0x00a7a3, PG_U_LOWERCASE_LETTER}, + {0x00a7a4, 0x00a7a4, PG_U_UPPERCASE_LETTER}, + {0x00a7a5, 0x00a7a5, PG_U_LOWERCASE_LETTER}, + {0x00a7a6, 0x00a7a6, PG_U_UPPERCASE_LETTER}, + {0x00a7a7, 0x00a7a7, PG_U_LOWERCASE_LETTER}, + {0x00a7a8, 0x00a7a8, PG_U_UPPERCASE_LETTER}, + {0x00a7a9, 0x00a7a9, PG_U_LOWERCASE_LETTER}, + {0x00a7aa, 0x00a7ae, PG_U_UPPERCASE_LETTER}, + {0x00a7af, 0x00a7af, PG_U_LOWERCASE_LETTER}, + {0x00a7b0, 0x00a7b4, PG_U_UPPERCASE_LETTER}, + {0x00a7b5, 0x00a7b5, PG_U_LOWERCASE_LETTER}, + {0x00a7b6, 0x00a7b6, PG_U_UPPERCASE_LETTER}, + {0x00a7b7, 0x00a7b7, PG_U_LOWERCASE_LETTER}, + {0x00a7b8, 0x00a7b8, PG_U_UPPERCASE_LETTER}, + {0x00a7b9, 0x00a7b9, PG_U_LOWERCASE_LETTER}, + {0x00a7ba, 0x00a7ba, PG_U_UPPERCASE_LETTER}, + {0x00a7bb, 0x00a7bb, PG_U_LOWERCASE_LETTER}, + {0x00a7bc, 0x00a7bc, PG_U_UPPERCASE_LETTER}, + {0x00a7bd, 0x00a7bd, PG_U_LOWERCASE_LETTER}, + {0x00a7be, 0x00a7be, PG_U_UPPERCASE_LETTER}, + {0x00a7bf, 0x00a7bf, PG_U_LOWERCASE_LETTER}, + {0x00a7c0, 0x00a7c0, PG_U_UPPERCASE_LETTER}, + {0x00a7c1, 0x00a7c1, PG_U_LOWERCASE_LETTER}, + {0x00a7c2, 0x00a7c2, PG_U_UPPERCASE_LETTER}, + {0x00a7c3, 0x00a7c3, PG_U_LOWERCASE_LETTER}, + {0x00a7c4, 0x00a7c7, PG_U_UPPERCASE_LETTER}, + {0x00a7c8, 0x00a7c8, PG_U_LOWERCASE_LETTER}, + {0x00a7c9, 0x00a7c9, PG_U_UPPERCASE_LETTER}, + {0x00a7ca, 0x00a7ca, PG_U_LOWERCASE_LETTER}, + {0x00a7cb, 0x00a7cc, PG_U_UPPERCASE_LETTER}, + {0x00a7cd, 0x00a7cd, PG_U_LOWERCASE_LETTER}, + {0x00a7d0, 0x00a7d0, PG_U_UPPERCASE_LETTER}, + {0x00a7d1, 0x00a7d1, PG_U_LOWERCASE_LETTER}, + {0x00a7d3, 0x00a7d3, PG_U_LOWERCASE_LETTER}, + {0x00a7d5, 0x00a7d5, PG_U_LOWERCASE_LETTER}, + {0x00a7d6, 0x00a7d6, PG_U_UPPERCASE_LETTER}, + {0x00a7d7, 0x00a7d7, PG_U_LOWERCASE_LETTER}, + {0x00a7d8, 0x00a7d8, PG_U_UPPERCASE_LETTER}, + {0x00a7d9, 0x00a7d9, PG_U_LOWERCASE_LETTER}, + {0x00a7da, 0x00a7da, PG_U_UPPERCASE_LETTER}, + {0x00a7db, 0x00a7db, PG_U_LOWERCASE_LETTER}, + {0x00a7dc, 0x00a7dc, PG_U_UPPERCASE_LETTER}, + {0x00a7f2, 0x00a7f4, PG_U_MODIFIER_LETTER}, + {0x00a7f5, 0x00a7f5, PG_U_UPPERCASE_LETTER}, + {0x00a7f6, 0x00a7f6, PG_U_LOWERCASE_LETTER}, + {0x00a7f7, 0x00a7f7, PG_U_OTHER_LETTER}, + {0x00a7f8, 0x00a7f9, PG_U_MODIFIER_LETTER}, + {0x00a7fa, 0x00a7fa, PG_U_LOWERCASE_LETTER}, + {0x00a7fb, 0x00a801, PG_U_OTHER_LETTER}, + {0x00a802, 0x00a802, PG_U_NONSPACING_MARK}, + {0x00a803, 0x00a805, PG_U_OTHER_LETTER}, + {0x00a806, 0x00a806, PG_U_NONSPACING_MARK}, + {0x00a807, 0x00a80a, PG_U_OTHER_LETTER}, + {0x00a80b, 0x00a80b, PG_U_NONSPACING_MARK}, + {0x00a80c, 0x00a822, PG_U_OTHER_LETTER}, + {0x00a823, 0x00a824, PG_U_SPACING_MARK}, + {0x00a825, 0x00a826, PG_U_NONSPACING_MARK}, + {0x00a827, 0x00a827, PG_U_SPACING_MARK}, + {0x00a828, 0x00a82b, PG_U_OTHER_SYMBOL}, + {0x00a82c, 0x00a82c, PG_U_NONSPACING_MARK}, + {0x00a830, 0x00a835, PG_U_OTHER_NUMBER}, + {0x00a836, 0x00a837, PG_U_OTHER_SYMBOL}, + {0x00a838, 0x00a838, PG_U_CURRENCY_SYMBOL}, + {0x00a839, 0x00a839, PG_U_OTHER_SYMBOL}, + {0x00a840, 0x00a873, PG_U_OTHER_LETTER}, + {0x00a874, 0x00a877, PG_U_OTHER_PUNCTUATION}, + {0x00a880, 0x00a881, PG_U_SPACING_MARK}, + {0x00a882, 0x00a8b3, PG_U_OTHER_LETTER}, + {0x00a8b4, 0x00a8c3, PG_U_SPACING_MARK}, + {0x00a8c4, 0x00a8c5, PG_U_NONSPACING_MARK}, + {0x00a8ce, 0x00a8cf, PG_U_OTHER_PUNCTUATION}, + {0x00a8d0, 0x00a8d9, PG_U_DECIMAL_NUMBER}, + {0x00a8e0, 0x00a8f1, PG_U_NONSPACING_MARK}, + {0x00a8f2, 0x00a8f7, PG_U_OTHER_LETTER}, + {0x00a8f8, 0x00a8fa, PG_U_OTHER_PUNCTUATION}, + {0x00a8fb, 0x00a8fb, PG_U_OTHER_LETTER}, + {0x00a8fc, 0x00a8fc, PG_U_OTHER_PUNCTUATION}, + {0x00a8fd, 0x00a8fe, PG_U_OTHER_LETTER}, + {0x00a8ff, 0x00a8ff, PG_U_NONSPACING_MARK}, + {0x00a900, 0x00a909, PG_U_DECIMAL_NUMBER}, + {0x00a90a, 0x00a925, PG_U_OTHER_LETTER}, + {0x00a926, 0x00a92d, PG_U_NONSPACING_MARK}, + {0x00a92e, 0x00a92f, PG_U_OTHER_PUNCTUATION}, + {0x00a930, 0x00a946, PG_U_OTHER_LETTER}, + {0x00a947, 0x00a951, PG_U_NONSPACING_MARK}, + {0x00a952, 0x00a953, PG_U_SPACING_MARK}, + {0x00a95f, 0x00a95f, PG_U_OTHER_PUNCTUATION}, + {0x00a960, 0x00a97c, PG_U_OTHER_LETTER}, + {0x00a980, 0x00a982, PG_U_NONSPACING_MARK}, + {0x00a983, 0x00a983, PG_U_SPACING_MARK}, + {0x00a984, 0x00a9b2, PG_U_OTHER_LETTER}, + {0x00a9b3, 0x00a9b3, PG_U_NONSPACING_MARK}, + {0x00a9b4, 0x00a9b5, PG_U_SPACING_MARK}, + {0x00a9b6, 0x00a9b9, PG_U_NONSPACING_MARK}, + {0x00a9ba, 0x00a9bb, PG_U_SPACING_MARK}, + {0x00a9bc, 0x00a9bd, PG_U_NONSPACING_MARK}, + {0x00a9be, 0x00a9c0, PG_U_SPACING_MARK}, + {0x00a9c1, 0x00a9cd, PG_U_OTHER_PUNCTUATION}, + {0x00a9cf, 0x00a9cf, PG_U_MODIFIER_LETTER}, + {0x00a9d0, 0x00a9d9, PG_U_DECIMAL_NUMBER}, + {0x00a9de, 0x00a9df, PG_U_OTHER_PUNCTUATION}, + {0x00a9e0, 0x00a9e4, PG_U_OTHER_LETTER}, + {0x00a9e5, 0x00a9e5, PG_U_NONSPACING_MARK}, + {0x00a9e6, 0x00a9e6, PG_U_MODIFIER_LETTER}, + {0x00a9e7, 0x00a9ef, PG_U_OTHER_LETTER}, + {0x00a9f0, 0x00a9f9, PG_U_DECIMAL_NUMBER}, + {0x00a9fa, 0x00a9fe, PG_U_OTHER_LETTER}, + {0x00aa00, 0x00aa28, PG_U_OTHER_LETTER}, + {0x00aa29, 0x00aa2e, PG_U_NONSPACING_MARK}, + {0x00aa2f, 0x00aa30, PG_U_SPACING_MARK}, + {0x00aa31, 0x00aa32, PG_U_NONSPACING_MARK}, + {0x00aa33, 0x00aa34, PG_U_SPACING_MARK}, + {0x00aa35, 0x00aa36, PG_U_NONSPACING_MARK}, + {0x00aa40, 0x00aa42, PG_U_OTHER_LETTER}, + {0x00aa43, 0x00aa43, PG_U_NONSPACING_MARK}, + {0x00aa44, 0x00aa4b, PG_U_OTHER_LETTER}, + {0x00aa4c, 0x00aa4c, PG_U_NONSPACING_MARK}, + {0x00aa4d, 0x00aa4d, PG_U_SPACING_MARK}, + {0x00aa50, 0x00aa59, PG_U_DECIMAL_NUMBER}, + {0x00aa5c, 0x00aa5f, PG_U_OTHER_PUNCTUATION}, + {0x00aa60, 0x00aa6f, PG_U_OTHER_LETTER}, + {0x00aa70, 0x00aa70, PG_U_MODIFIER_LETTER}, + {0x00aa71, 0x00aa76, PG_U_OTHER_LETTER}, + {0x00aa77, 0x00aa79, PG_U_OTHER_SYMBOL}, + {0x00aa7a, 0x00aa7a, PG_U_OTHER_LETTER}, + {0x00aa7b, 0x00aa7b, PG_U_SPACING_MARK}, + {0x00aa7c, 0x00aa7c, PG_U_NONSPACING_MARK}, + {0x00aa7d, 0x00aa7d, PG_U_SPACING_MARK}, + {0x00aa7e, 0x00aaaf, PG_U_OTHER_LETTER}, + {0x00aab0, 0x00aab0, PG_U_NONSPACING_MARK}, + {0x00aab1, 0x00aab1, PG_U_OTHER_LETTER}, + {0x00aab2, 0x00aab4, PG_U_NONSPACING_MARK}, + {0x00aab5, 0x00aab6, PG_U_OTHER_LETTER}, + {0x00aab7, 0x00aab8, PG_U_NONSPACING_MARK}, + {0x00aab9, 0x00aabd, PG_U_OTHER_LETTER}, + {0x00aabe, 0x00aabf, PG_U_NONSPACING_MARK}, + {0x00aac0, 0x00aac0, PG_U_OTHER_LETTER}, + {0x00aac1, 0x00aac1, PG_U_NONSPACING_MARK}, + {0x00aac2, 0x00aac2, PG_U_OTHER_LETTER}, + {0x00aadb, 0x00aadc, PG_U_OTHER_LETTER}, + {0x00aadd, 0x00aadd, PG_U_MODIFIER_LETTER}, + {0x00aade, 0x00aadf, PG_U_OTHER_PUNCTUATION}, + {0x00aae0, 0x00aaea, PG_U_OTHER_LETTER}, + {0x00aaeb, 0x00aaeb, PG_U_SPACING_MARK}, + {0x00aaec, 0x00aaed, PG_U_NONSPACING_MARK}, + {0x00aaee, 0x00aaef, PG_U_SPACING_MARK}, + {0x00aaf0, 0x00aaf1, PG_U_OTHER_PUNCTUATION}, + {0x00aaf2, 0x00aaf2, PG_U_OTHER_LETTER}, + {0x00aaf3, 0x00aaf4, PG_U_MODIFIER_LETTER}, + {0x00aaf5, 0x00aaf5, PG_U_SPACING_MARK}, + {0x00aaf6, 0x00aaf6, PG_U_NONSPACING_MARK}, + {0x00ab01, 0x00ab06, PG_U_OTHER_LETTER}, + {0x00ab09, 0x00ab0e, PG_U_OTHER_LETTER}, + {0x00ab11, 0x00ab16, PG_U_OTHER_LETTER}, + {0x00ab20, 0x00ab26, PG_U_OTHER_LETTER}, + {0x00ab28, 0x00ab2e, PG_U_OTHER_LETTER}, + {0x00ab30, 0x00ab5a, PG_U_LOWERCASE_LETTER}, + {0x00ab5b, 0x00ab5b, PG_U_MODIFIER_SYMBOL}, + {0x00ab5c, 0x00ab5f, PG_U_MODIFIER_LETTER}, + {0x00ab60, 0x00ab68, PG_U_LOWERCASE_LETTER}, + {0x00ab69, 0x00ab69, PG_U_MODIFIER_LETTER}, + {0x00ab6a, 0x00ab6b, PG_U_MODIFIER_SYMBOL}, + {0x00ab70, 0x00abbf, PG_U_LOWERCASE_LETTER}, + {0x00abc0, 0x00abe2, PG_U_OTHER_LETTER}, + {0x00abe3, 0x00abe4, PG_U_SPACING_MARK}, + {0x00abe5, 0x00abe5, PG_U_NONSPACING_MARK}, + {0x00abe6, 0x00abe7, PG_U_SPACING_MARK}, + {0x00abe8, 0x00abe8, PG_U_NONSPACING_MARK}, + {0x00abe9, 0x00abea, PG_U_SPACING_MARK}, + {0x00abeb, 0x00abeb, PG_U_OTHER_PUNCTUATION}, + {0x00abec, 0x00abec, PG_U_SPACING_MARK}, + {0x00abed, 0x00abed, PG_U_NONSPACING_MARK}, + {0x00abf0, 0x00abf9, PG_U_DECIMAL_NUMBER}, + {0x00ac00, 0x00d7a3, PG_U_OTHER_LETTER}, + {0x00d7b0, 0x00d7c6, PG_U_OTHER_LETTER}, + {0x00d7cb, 0x00d7fb, PG_U_OTHER_LETTER}, + {0x00d800, 0x00dfff, PG_U_SURROGATE}, + {0x00e000, 0x00f8ff, PG_U_PRIVATE_USE}, + {0x00f900, 0x00fa6d, PG_U_OTHER_LETTER}, + {0x00fa70, 0x00fad9, PG_U_OTHER_LETTER}, + {0x00fb00, 0x00fb06, PG_U_LOWERCASE_LETTER}, + {0x00fb13, 0x00fb17, PG_U_LOWERCASE_LETTER}, + {0x00fb1d, 0x00fb1d, PG_U_OTHER_LETTER}, + {0x00fb1e, 0x00fb1e, PG_U_NONSPACING_MARK}, + {0x00fb1f, 0x00fb28, PG_U_OTHER_LETTER}, + {0x00fb29, 0x00fb29, PG_U_MATH_SYMBOL}, + {0x00fb2a, 0x00fb36, PG_U_OTHER_LETTER}, + {0x00fb38, 0x00fb3c, PG_U_OTHER_LETTER}, + {0x00fb3e, 0x00fb3e, PG_U_OTHER_LETTER}, + {0x00fb40, 0x00fb41, PG_U_OTHER_LETTER}, + {0x00fb43, 0x00fb44, PG_U_OTHER_LETTER}, + {0x00fb46, 0x00fbb1, PG_U_OTHER_LETTER}, + {0x00fbb2, 0x00fbc2, PG_U_MODIFIER_SYMBOL}, + {0x00fbd3, 0x00fd3d, PG_U_OTHER_LETTER}, + {0x00fd3e, 0x00fd3e, PG_U_CLOSE_PUNCTUATION}, + {0x00fd3f, 0x00fd3f, PG_U_OPEN_PUNCTUATION}, + {0x00fd40, 0x00fd4f, PG_U_OTHER_SYMBOL}, + {0x00fd50, 0x00fd8f, PG_U_OTHER_LETTER}, + {0x00fd92, 0x00fdc7, PG_U_OTHER_LETTER}, + {0x00fdcf, 0x00fdcf, PG_U_OTHER_SYMBOL}, + {0x00fdf0, 0x00fdfb, PG_U_OTHER_LETTER}, + {0x00fdfc, 0x00fdfc, PG_U_CURRENCY_SYMBOL}, + {0x00fdfd, 0x00fdff, PG_U_OTHER_SYMBOL}, + {0x00fe00, 0x00fe0f, PG_U_NONSPACING_MARK}, + {0x00fe10, 0x00fe16, PG_U_OTHER_PUNCTUATION}, + {0x00fe17, 0x00fe17, PG_U_OPEN_PUNCTUATION}, + {0x00fe18, 0x00fe18, PG_U_CLOSE_PUNCTUATION}, + {0x00fe19, 0x00fe19, PG_U_OTHER_PUNCTUATION}, + {0x00fe20, 0x00fe2f, PG_U_NONSPACING_MARK}, + {0x00fe30, 0x00fe30, PG_U_OTHER_PUNCTUATION}, + {0x00fe31, 0x00fe32, PG_U_DASH_PUNCTUATION}, + {0x00fe33, 0x00fe34, PG_U_CONNECTOR_PUNCTUATION}, + {0x00fe35, 0x00fe35, PG_U_OPEN_PUNCTUATION}, + {0x00fe36, 0x00fe36, PG_U_CLOSE_PUNCTUATION}, + {0x00fe37, 0x00fe37, PG_U_OPEN_PUNCTUATION}, + {0x00fe38, 0x00fe38, PG_U_CLOSE_PUNCTUATION}, + {0x00fe39, 0x00fe39, PG_U_OPEN_PUNCTUATION}, + {0x00fe3a, 0x00fe3a, PG_U_CLOSE_PUNCTUATION}, + {0x00fe3b, 0x00fe3b, PG_U_OPEN_PUNCTUATION}, + {0x00fe3c, 0x00fe3c, PG_U_CLOSE_PUNCTUATION}, + {0x00fe3d, 0x00fe3d, PG_U_OPEN_PUNCTUATION}, + {0x00fe3e, 0x00fe3e, PG_U_CLOSE_PUNCTUATION}, + {0x00fe3f, 0x00fe3f, PG_U_OPEN_PUNCTUATION}, + {0x00fe40, 0x00fe40, PG_U_CLOSE_PUNCTUATION}, + {0x00fe41, 0x00fe41, PG_U_OPEN_PUNCTUATION}, + {0x00fe42, 0x00fe42, PG_U_CLOSE_PUNCTUATION}, + {0x00fe43, 0x00fe43, PG_U_OPEN_PUNCTUATION}, + {0x00fe44, 0x00fe44, PG_U_CLOSE_PUNCTUATION}, + {0x00fe45, 0x00fe46, PG_U_OTHER_PUNCTUATION}, + {0x00fe47, 0x00fe47, PG_U_OPEN_PUNCTUATION}, + {0x00fe48, 0x00fe48, PG_U_CLOSE_PUNCTUATION}, + {0x00fe49, 0x00fe4c, PG_U_OTHER_PUNCTUATION}, + {0x00fe4d, 0x00fe4f, PG_U_CONNECTOR_PUNCTUATION}, + {0x00fe50, 0x00fe52, PG_U_OTHER_PUNCTUATION}, + {0x00fe54, 0x00fe57, PG_U_OTHER_PUNCTUATION}, + {0x00fe58, 0x00fe58, PG_U_DASH_PUNCTUATION}, + {0x00fe59, 0x00fe59, PG_U_OPEN_PUNCTUATION}, + {0x00fe5a, 0x00fe5a, PG_U_CLOSE_PUNCTUATION}, + {0x00fe5b, 0x00fe5b, PG_U_OPEN_PUNCTUATION}, + {0x00fe5c, 0x00fe5c, PG_U_CLOSE_PUNCTUATION}, + {0x00fe5d, 0x00fe5d, PG_U_OPEN_PUNCTUATION}, + {0x00fe5e, 0x00fe5e, PG_U_CLOSE_PUNCTUATION}, + {0x00fe5f, 0x00fe61, PG_U_OTHER_PUNCTUATION}, + {0x00fe62, 0x00fe62, PG_U_MATH_SYMBOL}, + {0x00fe63, 0x00fe63, PG_U_DASH_PUNCTUATION}, + {0x00fe64, 0x00fe66, PG_U_MATH_SYMBOL}, + {0x00fe68, 0x00fe68, PG_U_OTHER_PUNCTUATION}, + {0x00fe69, 0x00fe69, PG_U_CURRENCY_SYMBOL}, + {0x00fe6a, 0x00fe6b, PG_U_OTHER_PUNCTUATION}, + {0x00fe70, 0x00fe74, PG_U_OTHER_LETTER}, + {0x00fe76, 0x00fefc, PG_U_OTHER_LETTER}, + {0x00feff, 0x00feff, PG_U_FORMAT}, + {0x00ff01, 0x00ff03, PG_U_OTHER_PUNCTUATION}, + {0x00ff04, 0x00ff04, PG_U_CURRENCY_SYMBOL}, + {0x00ff05, 0x00ff07, PG_U_OTHER_PUNCTUATION}, + {0x00ff08, 0x00ff08, PG_U_OPEN_PUNCTUATION}, + {0x00ff09, 0x00ff09, PG_U_CLOSE_PUNCTUATION}, + {0x00ff0a, 0x00ff0a, PG_U_OTHER_PUNCTUATION}, + {0x00ff0b, 0x00ff0b, PG_U_MATH_SYMBOL}, + {0x00ff0c, 0x00ff0c, PG_U_OTHER_PUNCTUATION}, + {0x00ff0d, 0x00ff0d, PG_U_DASH_PUNCTUATION}, + {0x00ff0e, 0x00ff0f, PG_U_OTHER_PUNCTUATION}, + {0x00ff10, 0x00ff19, PG_U_DECIMAL_NUMBER}, + {0x00ff1a, 0x00ff1b, PG_U_OTHER_PUNCTUATION}, + {0x00ff1c, 0x00ff1e, PG_U_MATH_SYMBOL}, + {0x00ff1f, 0x00ff20, PG_U_OTHER_PUNCTUATION}, + {0x00ff21, 0x00ff3a, PG_U_UPPERCASE_LETTER}, + {0x00ff3b, 0x00ff3b, PG_U_OPEN_PUNCTUATION}, + {0x00ff3c, 0x00ff3c, PG_U_OTHER_PUNCTUATION}, + {0x00ff3d, 0x00ff3d, PG_U_CLOSE_PUNCTUATION}, + {0x00ff3e, 0x00ff3e, PG_U_MODIFIER_SYMBOL}, + {0x00ff3f, 0x00ff3f, PG_U_CONNECTOR_PUNCTUATION}, + {0x00ff40, 0x00ff40, PG_U_MODIFIER_SYMBOL}, + {0x00ff41, 0x00ff5a, PG_U_LOWERCASE_LETTER}, + {0x00ff5b, 0x00ff5b, PG_U_OPEN_PUNCTUATION}, + {0x00ff5c, 0x00ff5c, PG_U_MATH_SYMBOL}, + {0x00ff5d, 0x00ff5d, PG_U_CLOSE_PUNCTUATION}, + {0x00ff5e, 0x00ff5e, PG_U_MATH_SYMBOL}, + {0x00ff5f, 0x00ff5f, PG_U_OPEN_PUNCTUATION}, + {0x00ff60, 0x00ff60, PG_U_CLOSE_PUNCTUATION}, + {0x00ff61, 0x00ff61, PG_U_OTHER_PUNCTUATION}, + {0x00ff62, 0x00ff62, PG_U_OPEN_PUNCTUATION}, + {0x00ff63, 0x00ff63, PG_U_CLOSE_PUNCTUATION}, + {0x00ff64, 0x00ff65, PG_U_OTHER_PUNCTUATION}, + {0x00ff66, 0x00ff6f, PG_U_OTHER_LETTER}, + {0x00ff70, 0x00ff70, PG_U_MODIFIER_LETTER}, + {0x00ff71, 0x00ff9d, PG_U_OTHER_LETTER}, + {0x00ff9e, 0x00ff9f, PG_U_MODIFIER_LETTER}, + {0x00ffa0, 0x00ffbe, PG_U_OTHER_LETTER}, + {0x00ffc2, 0x00ffc7, PG_U_OTHER_LETTER}, + {0x00ffca, 0x00ffcf, PG_U_OTHER_LETTER}, + {0x00ffd2, 0x00ffd7, PG_U_OTHER_LETTER}, + {0x00ffda, 0x00ffdc, PG_U_OTHER_LETTER}, + {0x00ffe0, 0x00ffe1, PG_U_CURRENCY_SYMBOL}, + {0x00ffe2, 0x00ffe2, PG_U_MATH_SYMBOL}, + {0x00ffe3, 0x00ffe3, PG_U_MODIFIER_SYMBOL}, + {0x00ffe4, 0x00ffe4, PG_U_OTHER_SYMBOL}, + {0x00ffe5, 0x00ffe6, PG_U_CURRENCY_SYMBOL}, + {0x00ffe8, 0x00ffe8, PG_U_OTHER_SYMBOL}, + {0x00ffe9, 0x00ffec, PG_U_MATH_SYMBOL}, + {0x00ffed, 0x00ffee, PG_U_OTHER_SYMBOL}, + {0x00fff9, 0x00fffb, PG_U_FORMAT}, + {0x00fffc, 0x00fffd, PG_U_OTHER_SYMBOL}, + {0x010000, 0x01000b, PG_U_OTHER_LETTER}, + {0x01000d, 0x010026, PG_U_OTHER_LETTER}, + {0x010028, 0x01003a, PG_U_OTHER_LETTER}, + {0x01003c, 0x01003d, PG_U_OTHER_LETTER}, + {0x01003f, 0x01004d, PG_U_OTHER_LETTER}, + {0x010050, 0x01005d, PG_U_OTHER_LETTER}, + {0x010080, 0x0100fa, PG_U_OTHER_LETTER}, + {0x010100, 0x010102, PG_U_OTHER_PUNCTUATION}, + {0x010107, 0x010133, PG_U_OTHER_NUMBER}, + {0x010137, 0x01013f, PG_U_OTHER_SYMBOL}, + {0x010140, 0x010174, PG_U_LETTER_NUMBER}, + {0x010175, 0x010178, PG_U_OTHER_NUMBER}, + {0x010179, 0x010189, PG_U_OTHER_SYMBOL}, + {0x01018a, 0x01018b, PG_U_OTHER_NUMBER}, + {0x01018c, 0x01018e, PG_U_OTHER_SYMBOL}, + {0x010190, 0x01019c, PG_U_OTHER_SYMBOL}, + {0x0101a0, 0x0101a0, PG_U_OTHER_SYMBOL}, + {0x0101d0, 0x0101fc, PG_U_OTHER_SYMBOL}, + {0x0101fd, 0x0101fd, PG_U_NONSPACING_MARK}, + {0x010280, 0x01029c, PG_U_OTHER_LETTER}, + {0x0102a0, 0x0102d0, PG_U_OTHER_LETTER}, + {0x0102e0, 0x0102e0, PG_U_NONSPACING_MARK}, + {0x0102e1, 0x0102fb, PG_U_OTHER_NUMBER}, + {0x010300, 0x01031f, PG_U_OTHER_LETTER}, + {0x010320, 0x010323, PG_U_OTHER_NUMBER}, + {0x01032d, 0x010340, PG_U_OTHER_LETTER}, + {0x010341, 0x010341, PG_U_LETTER_NUMBER}, + {0x010342, 0x010349, PG_U_OTHER_LETTER}, + {0x01034a, 0x01034a, PG_U_LETTER_NUMBER}, + {0x010350, 0x010375, PG_U_OTHER_LETTER}, + {0x010376, 0x01037a, PG_U_NONSPACING_MARK}, + {0x010380, 0x01039d, PG_U_OTHER_LETTER}, + {0x01039f, 0x01039f, PG_U_OTHER_PUNCTUATION}, + {0x0103a0, 0x0103c3, PG_U_OTHER_LETTER}, + {0x0103c8, 0x0103cf, PG_U_OTHER_LETTER}, + {0x0103d0, 0x0103d0, PG_U_OTHER_PUNCTUATION}, + {0x0103d1, 0x0103d5, PG_U_LETTER_NUMBER}, + {0x010400, 0x010427, PG_U_UPPERCASE_LETTER}, + {0x010428, 0x01044f, PG_U_LOWERCASE_LETTER}, + {0x010450, 0x01049d, PG_U_OTHER_LETTER}, + {0x0104a0, 0x0104a9, PG_U_DECIMAL_NUMBER}, + {0x0104b0, 0x0104d3, PG_U_UPPERCASE_LETTER}, + {0x0104d8, 0x0104fb, PG_U_LOWERCASE_LETTER}, + {0x010500, 0x010527, PG_U_OTHER_LETTER}, + {0x010530, 0x010563, PG_U_OTHER_LETTER}, + {0x01056f, 0x01056f, PG_U_OTHER_PUNCTUATION}, + {0x010570, 0x01057a, PG_U_UPPERCASE_LETTER}, + {0x01057c, 0x01058a, PG_U_UPPERCASE_LETTER}, + {0x01058c, 0x010592, PG_U_UPPERCASE_LETTER}, + {0x010594, 0x010595, PG_U_UPPERCASE_LETTER}, + {0x010597, 0x0105a1, PG_U_LOWERCASE_LETTER}, + {0x0105a3, 0x0105b1, PG_U_LOWERCASE_LETTER}, + {0x0105b3, 0x0105b9, PG_U_LOWERCASE_LETTER}, + {0x0105bb, 0x0105bc, PG_U_LOWERCASE_LETTER}, + {0x0105c0, 0x0105f3, PG_U_OTHER_LETTER}, + {0x010600, 0x010736, PG_U_OTHER_LETTER}, + {0x010740, 0x010755, PG_U_OTHER_LETTER}, + {0x010760, 0x010767, PG_U_OTHER_LETTER}, + {0x010780, 0x010785, PG_U_MODIFIER_LETTER}, + {0x010787, 0x0107b0, PG_U_MODIFIER_LETTER}, + {0x0107b2, 0x0107ba, PG_U_MODIFIER_LETTER}, + {0x010800, 0x010805, PG_U_OTHER_LETTER}, + {0x010808, 0x010808, PG_U_OTHER_LETTER}, + {0x01080a, 0x010835, PG_U_OTHER_LETTER}, + {0x010837, 0x010838, PG_U_OTHER_LETTER}, + {0x01083c, 0x01083c, PG_U_OTHER_LETTER}, + {0x01083f, 0x010855, PG_U_OTHER_LETTER}, + {0x010857, 0x010857, PG_U_OTHER_PUNCTUATION}, + {0x010858, 0x01085f, PG_U_OTHER_NUMBER}, + {0x010860, 0x010876, PG_U_OTHER_LETTER}, + {0x010877, 0x010878, PG_U_OTHER_SYMBOL}, + {0x010879, 0x01087f, PG_U_OTHER_NUMBER}, + {0x010880, 0x01089e, PG_U_OTHER_LETTER}, + {0x0108a7, 0x0108af, PG_U_OTHER_NUMBER}, + {0x0108e0, 0x0108f2, PG_U_OTHER_LETTER}, + {0x0108f4, 0x0108f5, PG_U_OTHER_LETTER}, + {0x0108fb, 0x0108ff, PG_U_OTHER_NUMBER}, + {0x010900, 0x010915, PG_U_OTHER_LETTER}, + {0x010916, 0x01091b, PG_U_OTHER_NUMBER}, + {0x01091f, 0x01091f, PG_U_OTHER_PUNCTUATION}, + {0x010920, 0x010939, PG_U_OTHER_LETTER}, + {0x01093f, 0x01093f, PG_U_OTHER_PUNCTUATION}, + {0x010980, 0x0109b7, PG_U_OTHER_LETTER}, + {0x0109bc, 0x0109bd, PG_U_OTHER_NUMBER}, + {0x0109be, 0x0109bf, PG_U_OTHER_LETTER}, + {0x0109c0, 0x0109cf, PG_U_OTHER_NUMBER}, + {0x0109d2, 0x0109ff, PG_U_OTHER_NUMBER}, + {0x010a00, 0x010a00, PG_U_OTHER_LETTER}, + {0x010a01, 0x010a03, PG_U_NONSPACING_MARK}, + {0x010a05, 0x010a06, PG_U_NONSPACING_MARK}, + {0x010a0c, 0x010a0f, PG_U_NONSPACING_MARK}, + {0x010a10, 0x010a13, PG_U_OTHER_LETTER}, + {0x010a15, 0x010a17, PG_U_OTHER_LETTER}, + {0x010a19, 0x010a35, PG_U_OTHER_LETTER}, + {0x010a38, 0x010a3a, PG_U_NONSPACING_MARK}, + {0x010a3f, 0x010a3f, PG_U_NONSPACING_MARK}, + {0x010a40, 0x010a48, PG_U_OTHER_NUMBER}, + {0x010a50, 0x010a58, PG_U_OTHER_PUNCTUATION}, + {0x010a60, 0x010a7c, PG_U_OTHER_LETTER}, + {0x010a7d, 0x010a7e, PG_U_OTHER_NUMBER}, + {0x010a7f, 0x010a7f, PG_U_OTHER_PUNCTUATION}, + {0x010a80, 0x010a9c, PG_U_OTHER_LETTER}, + {0x010a9d, 0x010a9f, PG_U_OTHER_NUMBER}, + {0x010ac0, 0x010ac7, PG_U_OTHER_LETTER}, + {0x010ac8, 0x010ac8, PG_U_OTHER_SYMBOL}, + {0x010ac9, 0x010ae4, PG_U_OTHER_LETTER}, + {0x010ae5, 0x010ae6, PG_U_NONSPACING_MARK}, + {0x010aeb, 0x010aef, PG_U_OTHER_NUMBER}, + {0x010af0, 0x010af6, PG_U_OTHER_PUNCTUATION}, + {0x010b00, 0x010b35, PG_U_OTHER_LETTER}, + {0x010b39, 0x010b3f, PG_U_OTHER_PUNCTUATION}, + {0x010b40, 0x010b55, PG_U_OTHER_LETTER}, + {0x010b58, 0x010b5f, PG_U_OTHER_NUMBER}, + {0x010b60, 0x010b72, PG_U_OTHER_LETTER}, + {0x010b78, 0x010b7f, PG_U_OTHER_NUMBER}, + {0x010b80, 0x010b91, PG_U_OTHER_LETTER}, + {0x010b99, 0x010b9c, PG_U_OTHER_PUNCTUATION}, + {0x010ba9, 0x010baf, PG_U_OTHER_NUMBER}, + {0x010c00, 0x010c48, PG_U_OTHER_LETTER}, + {0x010c80, 0x010cb2, PG_U_UPPERCASE_LETTER}, + {0x010cc0, 0x010cf2, PG_U_LOWERCASE_LETTER}, + {0x010cfa, 0x010cff, PG_U_OTHER_NUMBER}, + {0x010d00, 0x010d23, PG_U_OTHER_LETTER}, + {0x010d24, 0x010d27, PG_U_NONSPACING_MARK}, + {0x010d30, 0x010d39, PG_U_DECIMAL_NUMBER}, + {0x010d40, 0x010d49, PG_U_DECIMAL_NUMBER}, + {0x010d4a, 0x010d4d, PG_U_OTHER_LETTER}, + {0x010d4e, 0x010d4e, PG_U_MODIFIER_LETTER}, + {0x010d4f, 0x010d4f, PG_U_OTHER_LETTER}, + {0x010d50, 0x010d65, PG_U_UPPERCASE_LETTER}, + {0x010d69, 0x010d6d, PG_U_NONSPACING_MARK}, + {0x010d6e, 0x010d6e, PG_U_DASH_PUNCTUATION}, + {0x010d6f, 0x010d6f, PG_U_MODIFIER_LETTER}, + {0x010d70, 0x010d85, PG_U_LOWERCASE_LETTER}, + {0x010d8e, 0x010d8f, PG_U_MATH_SYMBOL}, + {0x010e60, 0x010e7e, PG_U_OTHER_NUMBER}, + {0x010e80, 0x010ea9, PG_U_OTHER_LETTER}, + {0x010eab, 0x010eac, PG_U_NONSPACING_MARK}, + {0x010ead, 0x010ead, PG_U_DASH_PUNCTUATION}, + {0x010eb0, 0x010eb1, PG_U_OTHER_LETTER}, + {0x010ec2, 0x010ec4, PG_U_OTHER_LETTER}, + {0x010efc, 0x010eff, PG_U_NONSPACING_MARK}, + {0x010f00, 0x010f1c, PG_U_OTHER_LETTER}, + {0x010f1d, 0x010f26, PG_U_OTHER_NUMBER}, + {0x010f27, 0x010f27, PG_U_OTHER_LETTER}, + {0x010f30, 0x010f45, PG_U_OTHER_LETTER}, + {0x010f46, 0x010f50, PG_U_NONSPACING_MARK}, + {0x010f51, 0x010f54, PG_U_OTHER_NUMBER}, + {0x010f55, 0x010f59, PG_U_OTHER_PUNCTUATION}, + {0x010f70, 0x010f81, PG_U_OTHER_LETTER}, + {0x010f82, 0x010f85, PG_U_NONSPACING_MARK}, + {0x010f86, 0x010f89, PG_U_OTHER_PUNCTUATION}, + {0x010fb0, 0x010fc4, PG_U_OTHER_LETTER}, + {0x010fc5, 0x010fcb, PG_U_OTHER_NUMBER}, + {0x010fe0, 0x010ff6, PG_U_OTHER_LETTER}, + {0x011000, 0x011000, PG_U_SPACING_MARK}, + {0x011001, 0x011001, PG_U_NONSPACING_MARK}, + {0x011002, 0x011002, PG_U_SPACING_MARK}, + {0x011003, 0x011037, PG_U_OTHER_LETTER}, + {0x011038, 0x011046, PG_U_NONSPACING_MARK}, + {0x011047, 0x01104d, PG_U_OTHER_PUNCTUATION}, + {0x011052, 0x011065, PG_U_OTHER_NUMBER}, + {0x011066, 0x01106f, PG_U_DECIMAL_NUMBER}, + {0x011070, 0x011070, PG_U_NONSPACING_MARK}, + {0x011071, 0x011072, PG_U_OTHER_LETTER}, + {0x011073, 0x011074, PG_U_NONSPACING_MARK}, + {0x011075, 0x011075, PG_U_OTHER_LETTER}, + {0x01107f, 0x011081, PG_U_NONSPACING_MARK}, + {0x011082, 0x011082, PG_U_SPACING_MARK}, + {0x011083, 0x0110af, PG_U_OTHER_LETTER}, + {0x0110b0, 0x0110b2, PG_U_SPACING_MARK}, + {0x0110b3, 0x0110b6, PG_U_NONSPACING_MARK}, + {0x0110b7, 0x0110b8, PG_U_SPACING_MARK}, + {0x0110b9, 0x0110ba, PG_U_NONSPACING_MARK}, + {0x0110bb, 0x0110bc, PG_U_OTHER_PUNCTUATION}, + {0x0110bd, 0x0110bd, PG_U_FORMAT}, + {0x0110be, 0x0110c1, PG_U_OTHER_PUNCTUATION}, + {0x0110c2, 0x0110c2, PG_U_NONSPACING_MARK}, + {0x0110cd, 0x0110cd, PG_U_FORMAT}, + {0x0110d0, 0x0110e8, PG_U_OTHER_LETTER}, + {0x0110f0, 0x0110f9, PG_U_DECIMAL_NUMBER}, + {0x011100, 0x011102, PG_U_NONSPACING_MARK}, + {0x011103, 0x011126, PG_U_OTHER_LETTER}, + {0x011127, 0x01112b, PG_U_NONSPACING_MARK}, + {0x01112c, 0x01112c, PG_U_SPACING_MARK}, + {0x01112d, 0x011134, PG_U_NONSPACING_MARK}, + {0x011136, 0x01113f, PG_U_DECIMAL_NUMBER}, + {0x011140, 0x011143, PG_U_OTHER_PUNCTUATION}, + {0x011144, 0x011144, PG_U_OTHER_LETTER}, + {0x011145, 0x011146, PG_U_SPACING_MARK}, + {0x011147, 0x011147, PG_U_OTHER_LETTER}, + {0x011150, 0x011172, PG_U_OTHER_LETTER}, + {0x011173, 0x011173, PG_U_NONSPACING_MARK}, + {0x011174, 0x011175, PG_U_OTHER_PUNCTUATION}, + {0x011176, 0x011176, PG_U_OTHER_LETTER}, + {0x011180, 0x011181, PG_U_NONSPACING_MARK}, + {0x011182, 0x011182, PG_U_SPACING_MARK}, + {0x011183, 0x0111b2, PG_U_OTHER_LETTER}, + {0x0111b3, 0x0111b5, PG_U_SPACING_MARK}, + {0x0111b6, 0x0111be, PG_U_NONSPACING_MARK}, + {0x0111bf, 0x0111c0, PG_U_SPACING_MARK}, + {0x0111c1, 0x0111c4, PG_U_OTHER_LETTER}, + {0x0111c5, 0x0111c8, PG_U_OTHER_PUNCTUATION}, + {0x0111c9, 0x0111cc, PG_U_NONSPACING_MARK}, + {0x0111cd, 0x0111cd, PG_U_OTHER_PUNCTUATION}, + {0x0111ce, 0x0111ce, PG_U_SPACING_MARK}, + {0x0111cf, 0x0111cf, PG_U_NONSPACING_MARK}, + {0x0111d0, 0x0111d9, PG_U_DECIMAL_NUMBER}, + {0x0111da, 0x0111da, PG_U_OTHER_LETTER}, + {0x0111db, 0x0111db, PG_U_OTHER_PUNCTUATION}, + {0x0111dc, 0x0111dc, PG_U_OTHER_LETTER}, + {0x0111dd, 0x0111df, PG_U_OTHER_PUNCTUATION}, + {0x0111e1, 0x0111f4, PG_U_OTHER_NUMBER}, + {0x011200, 0x011211, PG_U_OTHER_LETTER}, + {0x011213, 0x01122b, PG_U_OTHER_LETTER}, + {0x01122c, 0x01122e, PG_U_SPACING_MARK}, + {0x01122f, 0x011231, PG_U_NONSPACING_MARK}, + {0x011232, 0x011233, PG_U_SPACING_MARK}, + {0x011234, 0x011234, PG_U_NONSPACING_MARK}, + {0x011235, 0x011235, PG_U_SPACING_MARK}, + {0x011236, 0x011237, PG_U_NONSPACING_MARK}, + {0x011238, 0x01123d, PG_U_OTHER_PUNCTUATION}, + {0x01123e, 0x01123e, PG_U_NONSPACING_MARK}, + {0x01123f, 0x011240, PG_U_OTHER_LETTER}, + {0x011241, 0x011241, PG_U_NONSPACING_MARK}, + {0x011280, 0x011286, PG_U_OTHER_LETTER}, + {0x011288, 0x011288, PG_U_OTHER_LETTER}, + {0x01128a, 0x01128d, PG_U_OTHER_LETTER}, + {0x01128f, 0x01129d, PG_U_OTHER_LETTER}, + {0x01129f, 0x0112a8, PG_U_OTHER_LETTER}, + {0x0112a9, 0x0112a9, PG_U_OTHER_PUNCTUATION}, + {0x0112b0, 0x0112de, PG_U_OTHER_LETTER}, + {0x0112df, 0x0112df, PG_U_NONSPACING_MARK}, + {0x0112e0, 0x0112e2, PG_U_SPACING_MARK}, + {0x0112e3, 0x0112ea, PG_U_NONSPACING_MARK}, + {0x0112f0, 0x0112f9, PG_U_DECIMAL_NUMBER}, + {0x011300, 0x011301, PG_U_NONSPACING_MARK}, + {0x011302, 0x011303, PG_U_SPACING_MARK}, + {0x011305, 0x01130c, PG_U_OTHER_LETTER}, + {0x01130f, 0x011310, PG_U_OTHER_LETTER}, + {0x011313, 0x011328, PG_U_OTHER_LETTER}, + {0x01132a, 0x011330, PG_U_OTHER_LETTER}, + {0x011332, 0x011333, PG_U_OTHER_LETTER}, + {0x011335, 0x011339, PG_U_OTHER_LETTER}, + {0x01133b, 0x01133c, PG_U_NONSPACING_MARK}, + {0x01133d, 0x01133d, PG_U_OTHER_LETTER}, + {0x01133e, 0x01133f, PG_U_SPACING_MARK}, + {0x011340, 0x011340, PG_U_NONSPACING_MARK}, + {0x011341, 0x011344, PG_U_SPACING_MARK}, + {0x011347, 0x011348, PG_U_SPACING_MARK}, + {0x01134b, 0x01134d, PG_U_SPACING_MARK}, + {0x011350, 0x011350, PG_U_OTHER_LETTER}, + {0x011357, 0x011357, PG_U_SPACING_MARK}, + {0x01135d, 0x011361, PG_U_OTHER_LETTER}, + {0x011362, 0x011363, PG_U_SPACING_MARK}, + {0x011366, 0x01136c, PG_U_NONSPACING_MARK}, + {0x011370, 0x011374, PG_U_NONSPACING_MARK}, + {0x011380, 0x011389, PG_U_OTHER_LETTER}, + {0x01138b, 0x01138b, PG_U_OTHER_LETTER}, + {0x01138e, 0x01138e, PG_U_OTHER_LETTER}, + {0x011390, 0x0113b5, PG_U_OTHER_LETTER}, + {0x0113b7, 0x0113b7, PG_U_OTHER_LETTER}, + {0x0113b8, 0x0113ba, PG_U_SPACING_MARK}, + {0x0113bb, 0x0113c0, PG_U_NONSPACING_MARK}, + {0x0113c2, 0x0113c2, PG_U_SPACING_MARK}, + {0x0113c5, 0x0113c5, PG_U_SPACING_MARK}, + {0x0113c7, 0x0113ca, PG_U_SPACING_MARK}, + {0x0113cc, 0x0113cd, PG_U_SPACING_MARK}, + {0x0113ce, 0x0113ce, PG_U_NONSPACING_MARK}, + {0x0113cf, 0x0113cf, PG_U_SPACING_MARK}, + {0x0113d0, 0x0113d0, PG_U_NONSPACING_MARK}, + {0x0113d1, 0x0113d1, PG_U_OTHER_LETTER}, + {0x0113d2, 0x0113d2, PG_U_NONSPACING_MARK}, + {0x0113d3, 0x0113d3, PG_U_OTHER_LETTER}, + {0x0113d4, 0x0113d5, PG_U_OTHER_PUNCTUATION}, + {0x0113d7, 0x0113d8, PG_U_OTHER_PUNCTUATION}, + {0x0113e1, 0x0113e2, PG_U_NONSPACING_MARK}, + {0x011400, 0x011434, PG_U_OTHER_LETTER}, + {0x011435, 0x011437, PG_U_SPACING_MARK}, + {0x011438, 0x01143f, PG_U_NONSPACING_MARK}, + {0x011440, 0x011441, PG_U_SPACING_MARK}, + {0x011442, 0x011444, PG_U_NONSPACING_MARK}, + {0x011445, 0x011445, PG_U_SPACING_MARK}, + {0x011446, 0x011446, PG_U_NONSPACING_MARK}, + {0x011447, 0x01144a, PG_U_OTHER_LETTER}, + {0x01144b, 0x01144f, PG_U_OTHER_PUNCTUATION}, + {0x011450, 0x011459, PG_U_DECIMAL_NUMBER}, + {0x01145a, 0x01145b, PG_U_OTHER_PUNCTUATION}, + {0x01145d, 0x01145d, PG_U_OTHER_PUNCTUATION}, + {0x01145e, 0x01145e, PG_U_NONSPACING_MARK}, + {0x01145f, 0x011461, PG_U_OTHER_LETTER}, + {0x011480, 0x0114af, PG_U_OTHER_LETTER}, + {0x0114b0, 0x0114b2, PG_U_SPACING_MARK}, + {0x0114b3, 0x0114b8, PG_U_NONSPACING_MARK}, + {0x0114b9, 0x0114b9, PG_U_SPACING_MARK}, + {0x0114ba, 0x0114ba, PG_U_NONSPACING_MARK}, + {0x0114bb, 0x0114be, PG_U_SPACING_MARK}, + {0x0114bf, 0x0114c0, PG_U_NONSPACING_MARK}, + {0x0114c1, 0x0114c1, PG_U_SPACING_MARK}, + {0x0114c2, 0x0114c3, PG_U_NONSPACING_MARK}, + {0x0114c4, 0x0114c5, PG_U_OTHER_LETTER}, + {0x0114c6, 0x0114c6, PG_U_OTHER_PUNCTUATION}, + {0x0114c7, 0x0114c7, PG_U_OTHER_LETTER}, + {0x0114d0, 0x0114d9, PG_U_DECIMAL_NUMBER}, + {0x011580, 0x0115ae, PG_U_OTHER_LETTER}, + {0x0115af, 0x0115b1, PG_U_SPACING_MARK}, + {0x0115b2, 0x0115b5, PG_U_NONSPACING_MARK}, + {0x0115b8, 0x0115bb, PG_U_SPACING_MARK}, + {0x0115bc, 0x0115bd, PG_U_NONSPACING_MARK}, + {0x0115be, 0x0115be, PG_U_SPACING_MARK}, + {0x0115bf, 0x0115c0, PG_U_NONSPACING_MARK}, + {0x0115c1, 0x0115d7, PG_U_OTHER_PUNCTUATION}, + {0x0115d8, 0x0115db, PG_U_OTHER_LETTER}, + {0x0115dc, 0x0115dd, PG_U_NONSPACING_MARK}, + {0x011600, 0x01162f, PG_U_OTHER_LETTER}, + {0x011630, 0x011632, PG_U_SPACING_MARK}, + {0x011633, 0x01163a, PG_U_NONSPACING_MARK}, + {0x01163b, 0x01163c, PG_U_SPACING_MARK}, + {0x01163d, 0x01163d, PG_U_NONSPACING_MARK}, + {0x01163e, 0x01163e, PG_U_SPACING_MARK}, + {0x01163f, 0x011640, PG_U_NONSPACING_MARK}, + {0x011641, 0x011643, PG_U_OTHER_PUNCTUATION}, + {0x011644, 0x011644, PG_U_OTHER_LETTER}, + {0x011650, 0x011659, PG_U_DECIMAL_NUMBER}, + {0x011660, 0x01166c, PG_U_OTHER_PUNCTUATION}, + {0x011680, 0x0116aa, PG_U_OTHER_LETTER}, + {0x0116ab, 0x0116ab, PG_U_NONSPACING_MARK}, + {0x0116ac, 0x0116ac, PG_U_SPACING_MARK}, + {0x0116ad, 0x0116ad, PG_U_NONSPACING_MARK}, + {0x0116ae, 0x0116af, PG_U_SPACING_MARK}, + {0x0116b0, 0x0116b5, PG_U_NONSPACING_MARK}, + {0x0116b6, 0x0116b6, PG_U_SPACING_MARK}, + {0x0116b7, 0x0116b7, PG_U_NONSPACING_MARK}, + {0x0116b8, 0x0116b8, PG_U_OTHER_LETTER}, + {0x0116b9, 0x0116b9, PG_U_OTHER_PUNCTUATION}, + {0x0116c0, 0x0116c9, PG_U_DECIMAL_NUMBER}, + {0x0116d0, 0x0116e3, PG_U_DECIMAL_NUMBER}, + {0x011700, 0x01171a, PG_U_OTHER_LETTER}, + {0x01171d, 0x01171d, PG_U_NONSPACING_MARK}, + {0x01171e, 0x01171e, PG_U_SPACING_MARK}, + {0x01171f, 0x01171f, PG_U_NONSPACING_MARK}, + {0x011720, 0x011721, PG_U_SPACING_MARK}, + {0x011722, 0x011725, PG_U_NONSPACING_MARK}, + {0x011726, 0x011726, PG_U_SPACING_MARK}, + {0x011727, 0x01172b, PG_U_NONSPACING_MARK}, + {0x011730, 0x011739, PG_U_DECIMAL_NUMBER}, + {0x01173a, 0x01173b, PG_U_OTHER_NUMBER}, + {0x01173c, 0x01173e, PG_U_OTHER_PUNCTUATION}, + {0x01173f, 0x01173f, PG_U_OTHER_SYMBOL}, + {0x011740, 0x011746, PG_U_OTHER_LETTER}, + {0x011800, 0x01182b, PG_U_OTHER_LETTER}, + {0x01182c, 0x01182e, PG_U_SPACING_MARK}, + {0x01182f, 0x011837, PG_U_NONSPACING_MARK}, + {0x011838, 0x011838, PG_U_SPACING_MARK}, + {0x011839, 0x01183a, PG_U_NONSPACING_MARK}, + {0x01183b, 0x01183b, PG_U_OTHER_PUNCTUATION}, + {0x0118a0, 0x0118bf, PG_U_UPPERCASE_LETTER}, + {0x0118c0, 0x0118df, PG_U_LOWERCASE_LETTER}, + {0x0118e0, 0x0118e9, PG_U_DECIMAL_NUMBER}, + {0x0118ea, 0x0118f2, PG_U_OTHER_NUMBER}, + {0x0118ff, 0x011906, PG_U_OTHER_LETTER}, + {0x011909, 0x011909, PG_U_OTHER_LETTER}, + {0x01190c, 0x011913, PG_U_OTHER_LETTER}, + {0x011915, 0x011916, PG_U_OTHER_LETTER}, + {0x011918, 0x01192f, PG_U_OTHER_LETTER}, + {0x011930, 0x011935, PG_U_SPACING_MARK}, + {0x011937, 0x011938, PG_U_SPACING_MARK}, + {0x01193b, 0x01193c, PG_U_NONSPACING_MARK}, + {0x01193d, 0x01193d, PG_U_SPACING_MARK}, + {0x01193e, 0x01193e, PG_U_NONSPACING_MARK}, + {0x01193f, 0x01193f, PG_U_OTHER_LETTER}, + {0x011940, 0x011940, PG_U_SPACING_MARK}, + {0x011941, 0x011941, PG_U_OTHER_LETTER}, + {0x011942, 0x011942, PG_U_SPACING_MARK}, + {0x011943, 0x011943, PG_U_NONSPACING_MARK}, + {0x011944, 0x011946, PG_U_OTHER_PUNCTUATION}, + {0x011950, 0x011959, PG_U_DECIMAL_NUMBER}, + {0x0119a0, 0x0119a7, PG_U_OTHER_LETTER}, + {0x0119aa, 0x0119d0, PG_U_OTHER_LETTER}, + {0x0119d1, 0x0119d3, PG_U_SPACING_MARK}, + {0x0119d4, 0x0119d7, PG_U_NONSPACING_MARK}, + {0x0119da, 0x0119db, PG_U_NONSPACING_MARK}, + {0x0119dc, 0x0119df, PG_U_SPACING_MARK}, + {0x0119e0, 0x0119e0, PG_U_NONSPACING_MARK}, + {0x0119e1, 0x0119e1, PG_U_OTHER_LETTER}, + {0x0119e2, 0x0119e2, PG_U_OTHER_PUNCTUATION}, + {0x0119e3, 0x0119e3, PG_U_OTHER_LETTER}, + {0x0119e4, 0x0119e4, PG_U_SPACING_MARK}, + {0x011a00, 0x011a00, PG_U_OTHER_LETTER}, + {0x011a01, 0x011a0a, PG_U_NONSPACING_MARK}, + {0x011a0b, 0x011a32, PG_U_OTHER_LETTER}, + {0x011a33, 0x011a38, PG_U_NONSPACING_MARK}, + {0x011a39, 0x011a39, PG_U_SPACING_MARK}, + {0x011a3a, 0x011a3a, PG_U_OTHER_LETTER}, + {0x011a3b, 0x011a3e, PG_U_NONSPACING_MARK}, + {0x011a3f, 0x011a46, PG_U_OTHER_PUNCTUATION}, + {0x011a47, 0x011a47, PG_U_NONSPACING_MARK}, + {0x011a50, 0x011a50, PG_U_OTHER_LETTER}, + {0x011a51, 0x011a56, PG_U_NONSPACING_MARK}, + {0x011a57, 0x011a58, PG_U_SPACING_MARK}, + {0x011a59, 0x011a5b, PG_U_NONSPACING_MARK}, + {0x011a5c, 0x011a89, PG_U_OTHER_LETTER}, + {0x011a8a, 0x011a96, PG_U_NONSPACING_MARK}, + {0x011a97, 0x011a97, PG_U_SPACING_MARK}, + {0x011a98, 0x011a99, PG_U_NONSPACING_MARK}, + {0x011a9a, 0x011a9c, PG_U_OTHER_PUNCTUATION}, + {0x011a9d, 0x011a9d, PG_U_OTHER_LETTER}, + {0x011a9e, 0x011aa2, PG_U_OTHER_PUNCTUATION}, + {0x011ab0, 0x011af8, PG_U_OTHER_LETTER}, + {0x011b00, 0x011b09, PG_U_OTHER_PUNCTUATION}, + {0x011bc0, 0x011be0, PG_U_OTHER_LETTER}, + {0x011be1, 0x011be1, PG_U_OTHER_PUNCTUATION}, + {0x011bf0, 0x011bf9, PG_U_DECIMAL_NUMBER}, + {0x011c00, 0x011c08, PG_U_OTHER_LETTER}, + {0x011c0a, 0x011c2e, PG_U_OTHER_LETTER}, + {0x011c2f, 0x011c2f, PG_U_SPACING_MARK}, + {0x011c30, 0x011c36, PG_U_NONSPACING_MARK}, + {0x011c38, 0x011c3d, PG_U_NONSPACING_MARK}, + {0x011c3e, 0x011c3e, PG_U_SPACING_MARK}, + {0x011c3f, 0x011c3f, PG_U_NONSPACING_MARK}, + {0x011c40, 0x011c40, PG_U_OTHER_LETTER}, + {0x011c41, 0x011c45, PG_U_OTHER_PUNCTUATION}, + {0x011c50, 0x011c59, PG_U_DECIMAL_NUMBER}, + {0x011c5a, 0x011c6c, PG_U_OTHER_NUMBER}, + {0x011c70, 0x011c71, PG_U_OTHER_PUNCTUATION}, + {0x011c72, 0x011c8f, PG_U_OTHER_LETTER}, + {0x011c92, 0x011ca7, PG_U_NONSPACING_MARK}, + {0x011ca9, 0x011ca9, PG_U_SPACING_MARK}, + {0x011caa, 0x011cb0, PG_U_NONSPACING_MARK}, + {0x011cb1, 0x011cb1, PG_U_SPACING_MARK}, + {0x011cb2, 0x011cb3, PG_U_NONSPACING_MARK}, + {0x011cb4, 0x011cb4, PG_U_SPACING_MARK}, + {0x011cb5, 0x011cb6, PG_U_NONSPACING_MARK}, + {0x011d00, 0x011d06, PG_U_OTHER_LETTER}, + {0x011d08, 0x011d09, PG_U_OTHER_LETTER}, + {0x011d0b, 0x011d30, PG_U_OTHER_LETTER}, + {0x011d31, 0x011d36, PG_U_NONSPACING_MARK}, + {0x011d3a, 0x011d3a, PG_U_NONSPACING_MARK}, + {0x011d3c, 0x011d3d, PG_U_NONSPACING_MARK}, + {0x011d3f, 0x011d45, PG_U_NONSPACING_MARK}, + {0x011d46, 0x011d46, PG_U_OTHER_LETTER}, + {0x011d47, 0x011d47, PG_U_NONSPACING_MARK}, + {0x011d50, 0x011d59, PG_U_DECIMAL_NUMBER}, + {0x011d60, 0x011d65, PG_U_OTHER_LETTER}, + {0x011d67, 0x011d68, PG_U_OTHER_LETTER}, + {0x011d6a, 0x011d89, PG_U_OTHER_LETTER}, + {0x011d8a, 0x011d8e, PG_U_SPACING_MARK}, + {0x011d90, 0x011d91, PG_U_NONSPACING_MARK}, + {0x011d93, 0x011d94, PG_U_SPACING_MARK}, + {0x011d95, 0x011d95, PG_U_NONSPACING_MARK}, + {0x011d96, 0x011d96, PG_U_SPACING_MARK}, + {0x011d97, 0x011d97, PG_U_NONSPACING_MARK}, + {0x011d98, 0x011d98, PG_U_OTHER_LETTER}, + {0x011da0, 0x011da9, PG_U_DECIMAL_NUMBER}, + {0x011ee0, 0x011ef2, PG_U_OTHER_LETTER}, + {0x011ef3, 0x011ef4, PG_U_NONSPACING_MARK}, + {0x011ef5, 0x011ef6, PG_U_SPACING_MARK}, + {0x011ef7, 0x011ef8, PG_U_OTHER_PUNCTUATION}, + {0x011f00, 0x011f01, PG_U_NONSPACING_MARK}, + {0x011f02, 0x011f02, PG_U_OTHER_LETTER}, + {0x011f03, 0x011f03, PG_U_SPACING_MARK}, + {0x011f04, 0x011f10, PG_U_OTHER_LETTER}, + {0x011f12, 0x011f33, PG_U_OTHER_LETTER}, + {0x011f34, 0x011f35, PG_U_SPACING_MARK}, + {0x011f36, 0x011f3a, PG_U_NONSPACING_MARK}, + {0x011f3e, 0x011f3f, PG_U_SPACING_MARK}, + {0x011f40, 0x011f40, PG_U_NONSPACING_MARK}, + {0x011f41, 0x011f41, PG_U_SPACING_MARK}, + {0x011f42, 0x011f42, PG_U_NONSPACING_MARK}, + {0x011f43, 0x011f4f, PG_U_OTHER_PUNCTUATION}, + {0x011f50, 0x011f59, PG_U_DECIMAL_NUMBER}, + {0x011f5a, 0x011f5a, PG_U_NONSPACING_MARK}, + {0x011fb0, 0x011fb0, PG_U_OTHER_LETTER}, + {0x011fc0, 0x011fd4, PG_U_OTHER_NUMBER}, + {0x011fd5, 0x011fdc, PG_U_OTHER_SYMBOL}, + {0x011fdd, 0x011fe0, PG_U_CURRENCY_SYMBOL}, + {0x011fe1, 0x011ff1, PG_U_OTHER_SYMBOL}, + {0x011fff, 0x011fff, PG_U_OTHER_PUNCTUATION}, + {0x012000, 0x012399, PG_U_OTHER_LETTER}, + {0x012400, 0x01246e, PG_U_LETTER_NUMBER}, + {0x012470, 0x012474, PG_U_OTHER_PUNCTUATION}, + {0x012480, 0x012543, PG_U_OTHER_LETTER}, + {0x012f90, 0x012ff0, PG_U_OTHER_LETTER}, + {0x012ff1, 0x012ff2, PG_U_OTHER_PUNCTUATION}, + {0x013000, 0x01342f, PG_U_OTHER_LETTER}, + {0x013430, 0x01343f, PG_U_FORMAT}, + {0x013440, 0x013440, PG_U_NONSPACING_MARK}, + {0x013441, 0x013446, PG_U_OTHER_LETTER}, + {0x013447, 0x013455, PG_U_NONSPACING_MARK}, + {0x013460, 0x0143fa, PG_U_OTHER_LETTER}, + {0x014400, 0x014646, PG_U_OTHER_LETTER}, + {0x016100, 0x01611d, PG_U_OTHER_LETTER}, + {0x01611e, 0x016129, PG_U_NONSPACING_MARK}, + {0x01612a, 0x01612c, PG_U_SPACING_MARK}, + {0x01612d, 0x01612f, PG_U_NONSPACING_MARK}, + {0x016130, 0x016139, PG_U_DECIMAL_NUMBER}, + {0x016800, 0x016a38, PG_U_OTHER_LETTER}, + {0x016a40, 0x016a5e, PG_U_OTHER_LETTER}, + {0x016a60, 0x016a69, PG_U_DECIMAL_NUMBER}, + {0x016a6e, 0x016a6f, PG_U_OTHER_PUNCTUATION}, + {0x016a70, 0x016abe, PG_U_OTHER_LETTER}, + {0x016ac0, 0x016ac9, PG_U_DECIMAL_NUMBER}, + {0x016ad0, 0x016aed, PG_U_OTHER_LETTER}, + {0x016af0, 0x016af4, PG_U_NONSPACING_MARK}, + {0x016af5, 0x016af5, PG_U_OTHER_PUNCTUATION}, + {0x016b00, 0x016b2f, PG_U_OTHER_LETTER}, + {0x016b30, 0x016b36, PG_U_NONSPACING_MARK}, + {0x016b37, 0x016b3b, PG_U_OTHER_PUNCTUATION}, + {0x016b3c, 0x016b3f, PG_U_OTHER_SYMBOL}, + {0x016b40, 0x016b43, PG_U_MODIFIER_LETTER}, + {0x016b44, 0x016b44, PG_U_OTHER_PUNCTUATION}, + {0x016b45, 0x016b45, PG_U_OTHER_SYMBOL}, + {0x016b50, 0x016b59, PG_U_DECIMAL_NUMBER}, + {0x016b5b, 0x016b61, PG_U_OTHER_NUMBER}, + {0x016b63, 0x016b77, PG_U_OTHER_LETTER}, + {0x016b7d, 0x016b8f, PG_U_OTHER_LETTER}, + {0x016d40, 0x016d42, PG_U_MODIFIER_LETTER}, + {0x016d43, 0x016d6a, PG_U_OTHER_LETTER}, + {0x016d6b, 0x016d6c, PG_U_MODIFIER_LETTER}, + {0x016d6d, 0x016d6f, PG_U_OTHER_PUNCTUATION}, + {0x016d70, 0x016d79, PG_U_DECIMAL_NUMBER}, + {0x016e40, 0x016e5f, PG_U_UPPERCASE_LETTER}, + {0x016e60, 0x016e7f, PG_U_LOWERCASE_LETTER}, + {0x016e80, 0x016e96, PG_U_OTHER_NUMBER}, + {0x016e97, 0x016e9a, PG_U_OTHER_PUNCTUATION}, + {0x016f00, 0x016f4a, PG_U_OTHER_LETTER}, + {0x016f4f, 0x016f4f, PG_U_NONSPACING_MARK}, + {0x016f50, 0x016f50, PG_U_OTHER_LETTER}, + {0x016f51, 0x016f87, PG_U_SPACING_MARK}, + {0x016f8f, 0x016f92, PG_U_NONSPACING_MARK}, + {0x016f93, 0x016f9f, PG_U_MODIFIER_LETTER}, + {0x016fe0, 0x016fe1, PG_U_MODIFIER_LETTER}, + {0x016fe2, 0x016fe2, PG_U_OTHER_PUNCTUATION}, + {0x016fe3, 0x016fe3, PG_U_MODIFIER_LETTER}, + {0x016fe4, 0x016fe4, PG_U_NONSPACING_MARK}, + {0x016ff0, 0x016ff1, PG_U_SPACING_MARK}, + {0x017000, 0x0187f7, PG_U_OTHER_LETTER}, + {0x018800, 0x018cd5, PG_U_OTHER_LETTER}, + {0x018cff, 0x018d08, PG_U_OTHER_LETTER}, + {0x01aff0, 0x01aff3, PG_U_MODIFIER_LETTER}, + {0x01aff5, 0x01affb, PG_U_MODIFIER_LETTER}, + {0x01affd, 0x01affe, PG_U_MODIFIER_LETTER}, + {0x01b000, 0x01b122, PG_U_OTHER_LETTER}, + {0x01b132, 0x01b132, PG_U_OTHER_LETTER}, + {0x01b150, 0x01b152, PG_U_OTHER_LETTER}, + {0x01b155, 0x01b155, PG_U_OTHER_LETTER}, + {0x01b164, 0x01b167, PG_U_OTHER_LETTER}, + {0x01b170, 0x01b2fb, PG_U_OTHER_LETTER}, + {0x01bc00, 0x01bc6a, PG_U_OTHER_LETTER}, + {0x01bc70, 0x01bc7c, PG_U_OTHER_LETTER}, + {0x01bc80, 0x01bc88, PG_U_OTHER_LETTER}, + {0x01bc90, 0x01bc99, PG_U_OTHER_LETTER}, + {0x01bc9c, 0x01bc9c, PG_U_OTHER_SYMBOL}, + {0x01bc9d, 0x01bc9e, PG_U_NONSPACING_MARK}, + {0x01bc9f, 0x01bc9f, PG_U_OTHER_PUNCTUATION}, + {0x01bca0, 0x01bca3, PG_U_FORMAT}, + {0x01cc00, 0x01ccef, PG_U_OTHER_SYMBOL}, + {0x01ccf0, 0x01ccf9, PG_U_DECIMAL_NUMBER}, + {0x01cd00, 0x01ceb3, PG_U_OTHER_SYMBOL}, + {0x01cf00, 0x01cf2d, PG_U_NONSPACING_MARK}, + {0x01cf30, 0x01cf46, PG_U_NONSPACING_MARK}, + {0x01cf50, 0x01cfc3, PG_U_OTHER_SYMBOL}, + {0x01d000, 0x01d0f5, PG_U_OTHER_SYMBOL}, + {0x01d100, 0x01d126, PG_U_OTHER_SYMBOL}, + {0x01d129, 0x01d164, PG_U_OTHER_SYMBOL}, + {0x01d165, 0x01d166, PG_U_SPACING_MARK}, + {0x01d167, 0x01d169, PG_U_NONSPACING_MARK}, + {0x01d16a, 0x01d16c, PG_U_OTHER_SYMBOL}, + {0x01d16d, 0x01d172, PG_U_SPACING_MARK}, + {0x01d173, 0x01d17a, PG_U_FORMAT}, + {0x01d17b, 0x01d182, PG_U_NONSPACING_MARK}, + {0x01d183, 0x01d184, PG_U_OTHER_SYMBOL}, + {0x01d185, 0x01d18b, PG_U_NONSPACING_MARK}, + {0x01d18c, 0x01d1a9, PG_U_OTHER_SYMBOL}, + {0x01d1aa, 0x01d1ad, PG_U_NONSPACING_MARK}, + {0x01d1ae, 0x01d1ea, PG_U_OTHER_SYMBOL}, + {0x01d200, 0x01d241, PG_U_OTHER_SYMBOL}, + {0x01d242, 0x01d244, PG_U_NONSPACING_MARK}, + {0x01d245, 0x01d245, PG_U_OTHER_SYMBOL}, + {0x01d2c0, 0x01d2d3, PG_U_OTHER_NUMBER}, + {0x01d2e0, 0x01d2f3, PG_U_OTHER_NUMBER}, + {0x01d300, 0x01d356, PG_U_OTHER_SYMBOL}, + {0x01d360, 0x01d378, PG_U_OTHER_NUMBER}, + {0x01d400, 0x01d419, PG_U_UPPERCASE_LETTER}, + {0x01d41a, 0x01d433, PG_U_LOWERCASE_LETTER}, + {0x01d434, 0x01d44d, PG_U_UPPERCASE_LETTER}, + {0x01d44e, 0x01d454, PG_U_LOWERCASE_LETTER}, + {0x01d456, 0x01d467, PG_U_LOWERCASE_LETTER}, + {0x01d468, 0x01d481, PG_U_UPPERCASE_LETTER}, + {0x01d482, 0x01d49b, PG_U_LOWERCASE_LETTER}, + {0x01d49c, 0x01d49c, PG_U_UPPERCASE_LETTER}, + {0x01d49e, 0x01d49f, PG_U_UPPERCASE_LETTER}, + {0x01d4a2, 0x01d4a2, PG_U_UPPERCASE_LETTER}, + {0x01d4a5, 0x01d4a6, PG_U_UPPERCASE_LETTER}, + {0x01d4a9, 0x01d4ac, PG_U_UPPERCASE_LETTER}, + {0x01d4ae, 0x01d4b5, PG_U_UPPERCASE_LETTER}, + {0x01d4b6, 0x01d4b9, PG_U_LOWERCASE_LETTER}, + {0x01d4bb, 0x01d4bb, PG_U_LOWERCASE_LETTER}, + {0x01d4bd, 0x01d4c3, PG_U_LOWERCASE_LETTER}, + {0x01d4c5, 0x01d4cf, PG_U_LOWERCASE_LETTER}, + {0x01d4d0, 0x01d4e9, PG_U_UPPERCASE_LETTER}, + {0x01d4ea, 0x01d503, PG_U_LOWERCASE_LETTER}, + {0x01d504, 0x01d505, PG_U_UPPERCASE_LETTER}, + {0x01d507, 0x01d50a, PG_U_UPPERCASE_LETTER}, + {0x01d50d, 0x01d514, PG_U_UPPERCASE_LETTER}, + {0x01d516, 0x01d51c, PG_U_UPPERCASE_LETTER}, + {0x01d51e, 0x01d537, PG_U_LOWERCASE_LETTER}, + {0x01d538, 0x01d539, PG_U_UPPERCASE_LETTER}, + {0x01d53b, 0x01d53e, PG_U_UPPERCASE_LETTER}, + {0x01d540, 0x01d544, PG_U_UPPERCASE_LETTER}, + {0x01d546, 0x01d546, PG_U_UPPERCASE_LETTER}, + {0x01d54a, 0x01d550, PG_U_UPPERCASE_LETTER}, + {0x01d552, 0x01d56b, PG_U_LOWERCASE_LETTER}, + {0x01d56c, 0x01d585, PG_U_UPPERCASE_LETTER}, + {0x01d586, 0x01d59f, PG_U_LOWERCASE_LETTER}, + {0x01d5a0, 0x01d5b9, PG_U_UPPERCASE_LETTER}, + {0x01d5ba, 0x01d5d3, PG_U_LOWERCASE_LETTER}, + {0x01d5d4, 0x01d5ed, PG_U_UPPERCASE_LETTER}, + {0x01d5ee, 0x01d607, PG_U_LOWERCASE_LETTER}, + {0x01d608, 0x01d621, PG_U_UPPERCASE_LETTER}, + {0x01d622, 0x01d63b, PG_U_LOWERCASE_LETTER}, + {0x01d63c, 0x01d655, PG_U_UPPERCASE_LETTER}, + {0x01d656, 0x01d66f, PG_U_LOWERCASE_LETTER}, + {0x01d670, 0x01d689, PG_U_UPPERCASE_LETTER}, + {0x01d68a, 0x01d6a5, PG_U_LOWERCASE_LETTER}, + {0x01d6a8, 0x01d6c0, PG_U_UPPERCASE_LETTER}, + {0x01d6c1, 0x01d6c1, PG_U_MATH_SYMBOL}, + {0x01d6c2, 0x01d6da, PG_U_LOWERCASE_LETTER}, + {0x01d6db, 0x01d6db, PG_U_MATH_SYMBOL}, + {0x01d6dc, 0x01d6e1, PG_U_LOWERCASE_LETTER}, + {0x01d6e2, 0x01d6fa, PG_U_UPPERCASE_LETTER}, + {0x01d6fb, 0x01d6fb, PG_U_MATH_SYMBOL}, + {0x01d6fc, 0x01d714, PG_U_LOWERCASE_LETTER}, + {0x01d715, 0x01d715, PG_U_MATH_SYMBOL}, + {0x01d716, 0x01d71b, PG_U_LOWERCASE_LETTER}, + {0x01d71c, 0x01d734, PG_U_UPPERCASE_LETTER}, + {0x01d735, 0x01d735, PG_U_MATH_SYMBOL}, + {0x01d736, 0x01d74e, PG_U_LOWERCASE_LETTER}, + {0x01d74f, 0x01d74f, PG_U_MATH_SYMBOL}, + {0x01d750, 0x01d755, PG_U_LOWERCASE_LETTER}, + {0x01d756, 0x01d76e, PG_U_UPPERCASE_LETTER}, + {0x01d76f, 0x01d76f, PG_U_MATH_SYMBOL}, + {0x01d770, 0x01d788, PG_U_LOWERCASE_LETTER}, + {0x01d789, 0x01d789, PG_U_MATH_SYMBOL}, + {0x01d78a, 0x01d78f, PG_U_LOWERCASE_LETTER}, + {0x01d790, 0x01d7a8, PG_U_UPPERCASE_LETTER}, + {0x01d7a9, 0x01d7a9, PG_U_MATH_SYMBOL}, + {0x01d7aa, 0x01d7c2, PG_U_LOWERCASE_LETTER}, + {0x01d7c3, 0x01d7c3, PG_U_MATH_SYMBOL}, + {0x01d7c4, 0x01d7c9, PG_U_LOWERCASE_LETTER}, + {0x01d7ca, 0x01d7ca, PG_U_UPPERCASE_LETTER}, + {0x01d7cb, 0x01d7cb, PG_U_LOWERCASE_LETTER}, + {0x01d7ce, 0x01d7ff, PG_U_DECIMAL_NUMBER}, + {0x01d800, 0x01d9ff, PG_U_OTHER_SYMBOL}, + {0x01da00, 0x01da36, PG_U_NONSPACING_MARK}, + {0x01da37, 0x01da3a, PG_U_OTHER_SYMBOL}, + {0x01da3b, 0x01da6c, PG_U_NONSPACING_MARK}, + {0x01da6d, 0x01da74, PG_U_OTHER_SYMBOL}, + {0x01da75, 0x01da75, PG_U_NONSPACING_MARK}, + {0x01da76, 0x01da83, PG_U_OTHER_SYMBOL}, + {0x01da84, 0x01da84, PG_U_NONSPACING_MARK}, + {0x01da85, 0x01da86, PG_U_OTHER_SYMBOL}, + {0x01da87, 0x01da8b, PG_U_OTHER_PUNCTUATION}, + {0x01da9b, 0x01da9f, PG_U_NONSPACING_MARK}, + {0x01daa1, 0x01daaf, PG_U_NONSPACING_MARK}, + {0x01df00, 0x01df09, PG_U_LOWERCASE_LETTER}, + {0x01df0a, 0x01df0a, PG_U_OTHER_LETTER}, + {0x01df0b, 0x01df1e, PG_U_LOWERCASE_LETTER}, + {0x01df25, 0x01df2a, PG_U_LOWERCASE_LETTER}, + {0x01e000, 0x01e006, PG_U_NONSPACING_MARK}, + {0x01e008, 0x01e018, PG_U_NONSPACING_MARK}, + {0x01e01b, 0x01e021, PG_U_NONSPACING_MARK}, + {0x01e023, 0x01e024, PG_U_NONSPACING_MARK}, + {0x01e026, 0x01e02a, PG_U_NONSPACING_MARK}, + {0x01e030, 0x01e06d, PG_U_MODIFIER_LETTER}, + {0x01e08f, 0x01e08f, PG_U_NONSPACING_MARK}, + {0x01e100, 0x01e12c, PG_U_OTHER_LETTER}, + {0x01e130, 0x01e136, PG_U_NONSPACING_MARK}, + {0x01e137, 0x01e13d, PG_U_MODIFIER_LETTER}, + {0x01e140, 0x01e149, PG_U_DECIMAL_NUMBER}, + {0x01e14e, 0x01e14e, PG_U_OTHER_LETTER}, + {0x01e14f, 0x01e14f, PG_U_OTHER_SYMBOL}, + {0x01e290, 0x01e2ad, PG_U_OTHER_LETTER}, + {0x01e2ae, 0x01e2ae, PG_U_NONSPACING_MARK}, + {0x01e2c0, 0x01e2eb, PG_U_OTHER_LETTER}, + {0x01e2ec, 0x01e2ef, PG_U_NONSPACING_MARK}, + {0x01e2f0, 0x01e2f9, PG_U_DECIMAL_NUMBER}, + {0x01e2ff, 0x01e2ff, PG_U_CURRENCY_SYMBOL}, + {0x01e4d0, 0x01e4ea, PG_U_OTHER_LETTER}, + {0x01e4eb, 0x01e4eb, PG_U_MODIFIER_LETTER}, + {0x01e4ec, 0x01e4ef, PG_U_NONSPACING_MARK}, + {0x01e4f0, 0x01e4f9, PG_U_DECIMAL_NUMBER}, + {0x01e5d0, 0x01e5ed, PG_U_OTHER_LETTER}, + {0x01e5ee, 0x01e5ef, PG_U_NONSPACING_MARK}, + {0x01e5f0, 0x01e5f0, PG_U_OTHER_LETTER}, + {0x01e5f1, 0x01e5fa, PG_U_DECIMAL_NUMBER}, + {0x01e5ff, 0x01e5ff, PG_U_OTHER_PUNCTUATION}, + {0x01e7e0, 0x01e7e6, PG_U_OTHER_LETTER}, + {0x01e7e8, 0x01e7eb, PG_U_OTHER_LETTER}, + {0x01e7ed, 0x01e7ee, PG_U_OTHER_LETTER}, + {0x01e7f0, 0x01e7fe, PG_U_OTHER_LETTER}, + {0x01e800, 0x01e8c4, PG_U_OTHER_LETTER}, + {0x01e8c7, 0x01e8cf, PG_U_OTHER_NUMBER}, + {0x01e8d0, 0x01e8d6, PG_U_NONSPACING_MARK}, + {0x01e900, 0x01e921, PG_U_UPPERCASE_LETTER}, + {0x01e922, 0x01e943, PG_U_LOWERCASE_LETTER}, + {0x01e944, 0x01e94a, PG_U_NONSPACING_MARK}, + {0x01e94b, 0x01e94b, PG_U_MODIFIER_LETTER}, + {0x01e950, 0x01e959, PG_U_DECIMAL_NUMBER}, + {0x01e95e, 0x01e95f, PG_U_OTHER_PUNCTUATION}, + {0x01ec71, 0x01ecab, PG_U_OTHER_NUMBER}, + {0x01ecac, 0x01ecac, PG_U_OTHER_SYMBOL}, + {0x01ecad, 0x01ecaf, PG_U_OTHER_NUMBER}, + {0x01ecb0, 0x01ecb0, PG_U_CURRENCY_SYMBOL}, + {0x01ecb1, 0x01ecb4, PG_U_OTHER_NUMBER}, + {0x01ed01, 0x01ed2d, PG_U_OTHER_NUMBER}, + {0x01ed2e, 0x01ed2e, PG_U_OTHER_SYMBOL}, + {0x01ed2f, 0x01ed3d, PG_U_OTHER_NUMBER}, + {0x01ee00, 0x01ee03, PG_U_OTHER_LETTER}, + {0x01ee05, 0x01ee1f, PG_U_OTHER_LETTER}, + {0x01ee21, 0x01ee22, PG_U_OTHER_LETTER}, + {0x01ee24, 0x01ee24, PG_U_OTHER_LETTER}, + {0x01ee27, 0x01ee27, PG_U_OTHER_LETTER}, + {0x01ee29, 0x01ee32, PG_U_OTHER_LETTER}, + {0x01ee34, 0x01ee37, PG_U_OTHER_LETTER}, + {0x01ee39, 0x01ee39, PG_U_OTHER_LETTER}, + {0x01ee3b, 0x01ee3b, PG_U_OTHER_LETTER}, + {0x01ee42, 0x01ee42, PG_U_OTHER_LETTER}, + {0x01ee47, 0x01ee47, PG_U_OTHER_LETTER}, + {0x01ee49, 0x01ee49, PG_U_OTHER_LETTER}, + {0x01ee4b, 0x01ee4b, PG_U_OTHER_LETTER}, + {0x01ee4d, 0x01ee4f, PG_U_OTHER_LETTER}, + {0x01ee51, 0x01ee52, PG_U_OTHER_LETTER}, + {0x01ee54, 0x01ee54, PG_U_OTHER_LETTER}, + {0x01ee57, 0x01ee57, PG_U_OTHER_LETTER}, + {0x01ee59, 0x01ee59, PG_U_OTHER_LETTER}, + {0x01ee5b, 0x01ee5b, PG_U_OTHER_LETTER}, + {0x01ee5d, 0x01ee5d, PG_U_OTHER_LETTER}, + {0x01ee5f, 0x01ee5f, PG_U_OTHER_LETTER}, + {0x01ee61, 0x01ee62, PG_U_OTHER_LETTER}, + {0x01ee64, 0x01ee64, PG_U_OTHER_LETTER}, + {0x01ee67, 0x01ee6a, PG_U_OTHER_LETTER}, + {0x01ee6c, 0x01ee72, PG_U_OTHER_LETTER}, + {0x01ee74, 0x01ee77, PG_U_OTHER_LETTER}, + {0x01ee79, 0x01ee7c, PG_U_OTHER_LETTER}, + {0x01ee7e, 0x01ee7e, PG_U_OTHER_LETTER}, + {0x01ee80, 0x01ee89, PG_U_OTHER_LETTER}, + {0x01ee8b, 0x01ee9b, PG_U_OTHER_LETTER}, + {0x01eea1, 0x01eea3, PG_U_OTHER_LETTER}, + {0x01eea5, 0x01eea9, PG_U_OTHER_LETTER}, + {0x01eeab, 0x01eebb, PG_U_OTHER_LETTER}, + {0x01eef0, 0x01eef1, PG_U_MATH_SYMBOL}, + {0x01f000, 0x01f02b, PG_U_OTHER_SYMBOL}, + {0x01f030, 0x01f093, PG_U_OTHER_SYMBOL}, + {0x01f0a0, 0x01f0ae, PG_U_OTHER_SYMBOL}, + {0x01f0b1, 0x01f0bf, PG_U_OTHER_SYMBOL}, + {0x01f0c1, 0x01f0cf, PG_U_OTHER_SYMBOL}, + {0x01f0d1, 0x01f0f5, PG_U_OTHER_SYMBOL}, + {0x01f100, 0x01f10c, PG_U_OTHER_NUMBER}, + {0x01f10d, 0x01f1ad, PG_U_OTHER_SYMBOL}, + {0x01f1e6, 0x01f202, PG_U_OTHER_SYMBOL}, + {0x01f210, 0x01f23b, PG_U_OTHER_SYMBOL}, + {0x01f240, 0x01f248, PG_U_OTHER_SYMBOL}, + {0x01f250, 0x01f251, PG_U_OTHER_SYMBOL}, + {0x01f260, 0x01f265, PG_U_OTHER_SYMBOL}, + {0x01f300, 0x01f3fa, PG_U_OTHER_SYMBOL}, + {0x01f3fb, 0x01f3ff, PG_U_MODIFIER_SYMBOL}, + {0x01f400, 0x01f6d7, PG_U_OTHER_SYMBOL}, + {0x01f6dc, 0x01f6ec, PG_U_OTHER_SYMBOL}, + {0x01f6f0, 0x01f6fc, PG_U_OTHER_SYMBOL}, + {0x01f700, 0x01f776, PG_U_OTHER_SYMBOL}, + {0x01f77b, 0x01f7d9, PG_U_OTHER_SYMBOL}, + {0x01f7e0, 0x01f7eb, PG_U_OTHER_SYMBOL}, + {0x01f7f0, 0x01f7f0, PG_U_OTHER_SYMBOL}, + {0x01f800, 0x01f80b, PG_U_OTHER_SYMBOL}, + {0x01f810, 0x01f847, PG_U_OTHER_SYMBOL}, + {0x01f850, 0x01f859, PG_U_OTHER_SYMBOL}, + {0x01f860, 0x01f887, PG_U_OTHER_SYMBOL}, + {0x01f890, 0x01f8ad, PG_U_OTHER_SYMBOL}, + {0x01f8b0, 0x01f8bb, PG_U_OTHER_SYMBOL}, + {0x01f8c0, 0x01f8c1, PG_U_OTHER_SYMBOL}, + {0x01f900, 0x01fa53, PG_U_OTHER_SYMBOL}, + {0x01fa60, 0x01fa6d, PG_U_OTHER_SYMBOL}, + {0x01fa70, 0x01fa7c, PG_U_OTHER_SYMBOL}, + {0x01fa80, 0x01fa89, PG_U_OTHER_SYMBOL}, + {0x01fa8f, 0x01fac6, PG_U_OTHER_SYMBOL}, + {0x01face, 0x01fadc, PG_U_OTHER_SYMBOL}, + {0x01fadf, 0x01fae9, PG_U_OTHER_SYMBOL}, + {0x01faf0, 0x01faf8, PG_U_OTHER_SYMBOL}, + {0x01fb00, 0x01fb92, PG_U_OTHER_SYMBOL}, + {0x01fb94, 0x01fbef, PG_U_OTHER_SYMBOL}, + {0x01fbf0, 0x01fbf9, PG_U_DECIMAL_NUMBER}, + {0x020000, 0x02a6df, PG_U_OTHER_LETTER}, + {0x02a700, 0x02b739, PG_U_OTHER_LETTER}, + {0x02b740, 0x02b81d, PG_U_OTHER_LETTER}, + {0x02b820, 0x02cea1, PG_U_OTHER_LETTER}, + {0x02ceb0, 0x02ebe0, PG_U_OTHER_LETTER}, + {0x02ebf0, 0x02ee5d, PG_U_OTHER_LETTER}, + {0x02f800, 0x02fa1d, PG_U_OTHER_LETTER}, + {0x030000, 0x03134a, PG_U_OTHER_LETTER}, + {0x031350, 0x0323af, PG_U_OTHER_LETTER}, + {0x0e0001, 0x0e0001, PG_U_FORMAT}, + {0x0e0020, 0x0e007f, PG_U_FORMAT}, + {0x0e0100, 0x0e01ef, PG_U_NONSPACING_MARK}, + {0x0f0000, 0x0ffffd, PG_U_PRIVATE_USE}, + {0x100000, 0x10fffd, PG_U_PRIVATE_USE}, +}; + +/* table of Unicode codepoint ranges of Alphabetic characters */ +static const pg_unicode_range unicode_alphabetic[1179] = +{ + {0x000041, 0x00005a}, + {0x000061, 0x00007a}, + {0x0000aa, 0x0000aa}, + {0x0000b5, 0x0000b5}, + {0x0000ba, 0x0000ba}, + {0x0000c0, 0x0000d6}, + {0x0000d8, 0x0000f6}, + {0x0000f8, 0x0001ba}, + {0x0001bb, 0x0001bb}, + {0x0001bc, 0x0001bf}, + {0x0001c0, 0x0001c3}, + {0x0001c4, 0x000293}, + {0x000294, 0x000294}, + {0x000295, 0x0002af}, + {0x0002b0, 0x0002c1}, + {0x0002c6, 0x0002d1}, + {0x0002e0, 0x0002e4}, + {0x0002ec, 0x0002ec}, + {0x0002ee, 0x0002ee}, + {0x000345, 0x000345}, + {0x000363, 0x00036f}, + {0x000370, 0x000373}, + {0x000374, 0x000374}, + {0x000376, 0x000377}, + {0x00037a, 0x00037a}, + {0x00037b, 0x00037d}, + {0x00037f, 0x00037f}, + {0x000386, 0x000386}, + {0x000388, 0x00038a}, + {0x00038c, 0x00038c}, + {0x00038e, 0x0003a1}, + {0x0003a3, 0x0003f5}, + {0x0003f7, 0x000481}, + {0x00048a, 0x00052f}, + {0x000531, 0x000556}, + {0x000559, 0x000559}, + {0x000560, 0x000588}, + {0x0005b0, 0x0005bd}, + {0x0005bf, 0x0005bf}, + {0x0005c1, 0x0005c2}, + {0x0005c4, 0x0005c5}, + {0x0005c7, 0x0005c7}, + {0x0005d0, 0x0005ea}, + {0x0005ef, 0x0005f2}, + {0x000610, 0x00061a}, + {0x000620, 0x00063f}, + {0x000640, 0x000640}, + {0x000641, 0x00064a}, + {0x00064b, 0x000657}, + {0x000659, 0x00065f}, + {0x00066e, 0x00066f}, + {0x000670, 0x000670}, + {0x000671, 0x0006d3}, + {0x0006d5, 0x0006d5}, + {0x0006d6, 0x0006dc}, + {0x0006e1, 0x0006e4}, + {0x0006e5, 0x0006e6}, + {0x0006e7, 0x0006e8}, + {0x0006ed, 0x0006ed}, + {0x0006ee, 0x0006ef}, + {0x0006fa, 0x0006fc}, + {0x0006ff, 0x0006ff}, + {0x000710, 0x000710}, + {0x000711, 0x000711}, + {0x000712, 0x00072f}, + {0x000730, 0x00073f}, + {0x00074d, 0x0007a5}, + {0x0007a6, 0x0007b0}, + {0x0007b1, 0x0007b1}, + {0x0007ca, 0x0007ea}, + {0x0007f4, 0x0007f5}, + {0x0007fa, 0x0007fa}, + {0x000800, 0x000815}, + {0x000816, 0x000817}, + {0x00081a, 0x00081a}, + {0x00081b, 0x000823}, + {0x000824, 0x000824}, + {0x000825, 0x000827}, + {0x000828, 0x000828}, + {0x000829, 0x00082c}, + {0x000840, 0x000858}, + {0x000860, 0x00086a}, + {0x000870, 0x000887}, + {0x000889, 0x00088e}, + {0x000897, 0x000897}, + {0x0008a0, 0x0008c8}, + {0x0008c9, 0x0008c9}, + {0x0008d4, 0x0008df}, + {0x0008e3, 0x0008e9}, + {0x0008f0, 0x000902}, + {0x000903, 0x000903}, + {0x000904, 0x000939}, + {0x00093a, 0x00093a}, + {0x00093b, 0x00093b}, + {0x00093d, 0x00093d}, + {0x00093e, 0x000940}, + {0x000941, 0x000948}, + {0x000949, 0x00094c}, + {0x00094e, 0x00094f}, + {0x000950, 0x000950}, + {0x000955, 0x000957}, + {0x000958, 0x000961}, + {0x000962, 0x000963}, + {0x000971, 0x000971}, + {0x000972, 0x000980}, + {0x000981, 0x000981}, + {0x000982, 0x000983}, + {0x000985, 0x00098c}, + {0x00098f, 0x000990}, + {0x000993, 0x0009a8}, + {0x0009aa, 0x0009b0}, + {0x0009b2, 0x0009b2}, + {0x0009b6, 0x0009b9}, + {0x0009bd, 0x0009bd}, + {0x0009be, 0x0009c0}, + {0x0009c1, 0x0009c4}, + {0x0009c7, 0x0009c8}, + {0x0009cb, 0x0009cc}, + {0x0009ce, 0x0009ce}, + {0x0009d7, 0x0009d7}, + {0x0009dc, 0x0009dd}, + {0x0009df, 0x0009e1}, + {0x0009e2, 0x0009e3}, + {0x0009f0, 0x0009f1}, + {0x0009fc, 0x0009fc}, + {0x000a01, 0x000a02}, + {0x000a03, 0x000a03}, + {0x000a05, 0x000a0a}, + {0x000a0f, 0x000a10}, + {0x000a13, 0x000a28}, + {0x000a2a, 0x000a30}, + {0x000a32, 0x000a33}, + {0x000a35, 0x000a36}, + {0x000a38, 0x000a39}, + {0x000a3e, 0x000a40}, + {0x000a41, 0x000a42}, + {0x000a47, 0x000a48}, + {0x000a4b, 0x000a4c}, + {0x000a51, 0x000a51}, + {0x000a59, 0x000a5c}, + {0x000a5e, 0x000a5e}, + {0x000a70, 0x000a71}, + {0x000a72, 0x000a74}, + {0x000a75, 0x000a75}, + {0x000a81, 0x000a82}, + {0x000a83, 0x000a83}, + {0x000a85, 0x000a8d}, + {0x000a8f, 0x000a91}, + {0x000a93, 0x000aa8}, + {0x000aaa, 0x000ab0}, + {0x000ab2, 0x000ab3}, + {0x000ab5, 0x000ab9}, + {0x000abd, 0x000abd}, + {0x000abe, 0x000ac0}, + {0x000ac1, 0x000ac5}, + {0x000ac7, 0x000ac8}, + {0x000ac9, 0x000ac9}, + {0x000acb, 0x000acc}, + {0x000ad0, 0x000ad0}, + {0x000ae0, 0x000ae1}, + {0x000ae2, 0x000ae3}, + {0x000af9, 0x000af9}, + {0x000afa, 0x000afc}, + {0x000b01, 0x000b01}, + {0x000b02, 0x000b03}, + {0x000b05, 0x000b0c}, + {0x000b0f, 0x000b10}, + {0x000b13, 0x000b28}, + {0x000b2a, 0x000b30}, + {0x000b32, 0x000b33}, + {0x000b35, 0x000b39}, + {0x000b3d, 0x000b3d}, + {0x000b3e, 0x000b3e}, + {0x000b3f, 0x000b3f}, + {0x000b40, 0x000b40}, + {0x000b41, 0x000b44}, + {0x000b47, 0x000b48}, + {0x000b4b, 0x000b4c}, + {0x000b56, 0x000b56}, + {0x000b57, 0x000b57}, + {0x000b5c, 0x000b5d}, + {0x000b5f, 0x000b61}, + {0x000b62, 0x000b63}, + {0x000b71, 0x000b71}, + {0x000b82, 0x000b82}, + {0x000b83, 0x000b83}, + {0x000b85, 0x000b8a}, + {0x000b8e, 0x000b90}, + {0x000b92, 0x000b95}, + {0x000b99, 0x000b9a}, + {0x000b9c, 0x000b9c}, + {0x000b9e, 0x000b9f}, + {0x000ba3, 0x000ba4}, + {0x000ba8, 0x000baa}, + {0x000bae, 0x000bb9}, + {0x000bbe, 0x000bbf}, + {0x000bc0, 0x000bc0}, + {0x000bc1, 0x000bc2}, + {0x000bc6, 0x000bc8}, + {0x000bca, 0x000bcc}, + {0x000bd0, 0x000bd0}, + {0x000bd7, 0x000bd7}, + {0x000c00, 0x000c00}, + {0x000c01, 0x000c03}, + {0x000c04, 0x000c04}, + {0x000c05, 0x000c0c}, + {0x000c0e, 0x000c10}, + {0x000c12, 0x000c28}, + {0x000c2a, 0x000c39}, + {0x000c3d, 0x000c3d}, + {0x000c3e, 0x000c40}, + {0x000c41, 0x000c44}, + {0x000c46, 0x000c48}, + {0x000c4a, 0x000c4c}, + {0x000c55, 0x000c56}, + {0x000c58, 0x000c5a}, + {0x000c5d, 0x000c5d}, + {0x000c60, 0x000c61}, + {0x000c62, 0x000c63}, + {0x000c80, 0x000c80}, + {0x000c81, 0x000c81}, + {0x000c82, 0x000c83}, + {0x000c85, 0x000c8c}, + {0x000c8e, 0x000c90}, + {0x000c92, 0x000ca8}, + {0x000caa, 0x000cb3}, + {0x000cb5, 0x000cb9}, + {0x000cbd, 0x000cbd}, + {0x000cbe, 0x000cbe}, + {0x000cbf, 0x000cbf}, + {0x000cc0, 0x000cc4}, + {0x000cc6, 0x000cc6}, + {0x000cc7, 0x000cc8}, + {0x000cca, 0x000ccb}, + {0x000ccc, 0x000ccc}, + {0x000cd5, 0x000cd6}, + {0x000cdd, 0x000cde}, + {0x000ce0, 0x000ce1}, + {0x000ce2, 0x000ce3}, + {0x000cf1, 0x000cf2}, + {0x000cf3, 0x000cf3}, + {0x000d00, 0x000d01}, + {0x000d02, 0x000d03}, + {0x000d04, 0x000d0c}, + {0x000d0e, 0x000d10}, + {0x000d12, 0x000d3a}, + {0x000d3d, 0x000d3d}, + {0x000d3e, 0x000d40}, + {0x000d41, 0x000d44}, + {0x000d46, 0x000d48}, + {0x000d4a, 0x000d4c}, + {0x000d4e, 0x000d4e}, + {0x000d54, 0x000d56}, + {0x000d57, 0x000d57}, + {0x000d5f, 0x000d61}, + {0x000d62, 0x000d63}, + {0x000d7a, 0x000d7f}, + {0x000d81, 0x000d81}, + {0x000d82, 0x000d83}, + {0x000d85, 0x000d96}, + {0x000d9a, 0x000db1}, + {0x000db3, 0x000dbb}, + {0x000dbd, 0x000dbd}, + {0x000dc0, 0x000dc6}, + {0x000dcf, 0x000dd1}, + {0x000dd2, 0x000dd4}, + {0x000dd6, 0x000dd6}, + {0x000dd8, 0x000ddf}, + {0x000df2, 0x000df3}, + {0x000e01, 0x000e30}, + {0x000e31, 0x000e31}, + {0x000e32, 0x000e33}, + {0x000e34, 0x000e3a}, + {0x000e40, 0x000e45}, + {0x000e46, 0x000e46}, + {0x000e4d, 0x000e4d}, + {0x000e81, 0x000e82}, + {0x000e84, 0x000e84}, + {0x000e86, 0x000e8a}, + {0x000e8c, 0x000ea3}, + {0x000ea5, 0x000ea5}, + {0x000ea7, 0x000eb0}, + {0x000eb1, 0x000eb1}, + {0x000eb2, 0x000eb3}, + {0x000eb4, 0x000eb9}, + {0x000ebb, 0x000ebc}, + {0x000ebd, 0x000ebd}, + {0x000ec0, 0x000ec4}, + {0x000ec6, 0x000ec6}, + {0x000ecd, 0x000ecd}, + {0x000edc, 0x000edf}, + {0x000f00, 0x000f00}, + {0x000f40, 0x000f47}, + {0x000f49, 0x000f6c}, + {0x000f71, 0x000f7e}, + {0x000f7f, 0x000f7f}, + {0x000f80, 0x000f83}, + {0x000f88, 0x000f8c}, + {0x000f8d, 0x000f97}, + {0x000f99, 0x000fbc}, + {0x001000, 0x00102a}, + {0x00102b, 0x00102c}, + {0x00102d, 0x001030}, + {0x001031, 0x001031}, + {0x001032, 0x001036}, + {0x001038, 0x001038}, + {0x00103b, 0x00103c}, + {0x00103d, 0x00103e}, + {0x00103f, 0x00103f}, + {0x001050, 0x001055}, + {0x001056, 0x001057}, + {0x001058, 0x001059}, + {0x00105a, 0x00105d}, + {0x00105e, 0x001060}, + {0x001061, 0x001061}, + {0x001062, 0x001064}, + {0x001065, 0x001066}, + {0x001067, 0x00106d}, + {0x00106e, 0x001070}, + {0x001071, 0x001074}, + {0x001075, 0x001081}, + {0x001082, 0x001082}, + {0x001083, 0x001084}, + {0x001085, 0x001086}, + {0x001087, 0x00108c}, + {0x00108d, 0x00108d}, + {0x00108e, 0x00108e}, + {0x00108f, 0x00108f}, + {0x00109a, 0x00109c}, + {0x00109d, 0x00109d}, + {0x0010a0, 0x0010c5}, + {0x0010c7, 0x0010c7}, + {0x0010cd, 0x0010cd}, + {0x0010d0, 0x0010fa}, + {0x0010fc, 0x0010fc}, + {0x0010fd, 0x0010ff}, + {0x001100, 0x001248}, + {0x00124a, 0x00124d}, + {0x001250, 0x001256}, + {0x001258, 0x001258}, + {0x00125a, 0x00125d}, + {0x001260, 0x001288}, + {0x00128a, 0x00128d}, + {0x001290, 0x0012b0}, + {0x0012b2, 0x0012b5}, + {0x0012b8, 0x0012be}, + {0x0012c0, 0x0012c0}, + {0x0012c2, 0x0012c5}, + {0x0012c8, 0x0012d6}, + {0x0012d8, 0x001310}, + {0x001312, 0x001315}, + {0x001318, 0x00135a}, + {0x001380, 0x00138f}, + {0x0013a0, 0x0013f5}, + {0x0013f8, 0x0013fd}, + {0x001401, 0x00166c}, + {0x00166f, 0x00167f}, + {0x001681, 0x00169a}, + {0x0016a0, 0x0016ea}, + {0x0016ee, 0x0016f0}, + {0x0016f1, 0x0016f8}, + {0x001700, 0x001711}, + {0x001712, 0x001713}, + {0x00171f, 0x001731}, + {0x001732, 0x001733}, + {0x001740, 0x001751}, + {0x001752, 0x001753}, + {0x001760, 0x00176c}, + {0x00176e, 0x001770}, + {0x001772, 0x001773}, + {0x001780, 0x0017b3}, + {0x0017b6, 0x0017b6}, + {0x0017b7, 0x0017bd}, + {0x0017be, 0x0017c5}, + {0x0017c6, 0x0017c6}, + {0x0017c7, 0x0017c8}, + {0x0017d7, 0x0017d7}, + {0x0017dc, 0x0017dc}, + {0x001820, 0x001842}, + {0x001843, 0x001843}, + {0x001844, 0x001878}, + {0x001880, 0x001884}, + {0x001885, 0x001886}, + {0x001887, 0x0018a8}, + {0x0018a9, 0x0018a9}, + {0x0018aa, 0x0018aa}, + {0x0018b0, 0x0018f5}, + {0x001900, 0x00191e}, + {0x001920, 0x001922}, + {0x001923, 0x001926}, + {0x001927, 0x001928}, + {0x001929, 0x00192b}, + {0x001930, 0x001931}, + {0x001932, 0x001932}, + {0x001933, 0x001938}, + {0x001950, 0x00196d}, + {0x001970, 0x001974}, + {0x001980, 0x0019ab}, + {0x0019b0, 0x0019c9}, + {0x001a00, 0x001a16}, + {0x001a17, 0x001a18}, + {0x001a19, 0x001a1a}, + {0x001a1b, 0x001a1b}, + {0x001a20, 0x001a54}, + {0x001a55, 0x001a55}, + {0x001a56, 0x001a56}, + {0x001a57, 0x001a57}, + {0x001a58, 0x001a5e}, + {0x001a61, 0x001a61}, + {0x001a62, 0x001a62}, + {0x001a63, 0x001a64}, + {0x001a65, 0x001a6c}, + {0x001a6d, 0x001a72}, + {0x001a73, 0x001a74}, + {0x001aa7, 0x001aa7}, + {0x001abf, 0x001ac0}, + {0x001acc, 0x001ace}, + {0x001b00, 0x001b03}, + {0x001b04, 0x001b04}, + {0x001b05, 0x001b33}, + {0x001b35, 0x001b35}, + {0x001b36, 0x001b3a}, + {0x001b3b, 0x001b3b}, + {0x001b3c, 0x001b3c}, + {0x001b3d, 0x001b41}, + {0x001b42, 0x001b42}, + {0x001b43, 0x001b43}, + {0x001b45, 0x001b4c}, + {0x001b80, 0x001b81}, + {0x001b82, 0x001b82}, + {0x001b83, 0x001ba0}, + {0x001ba1, 0x001ba1}, + {0x001ba2, 0x001ba5}, + {0x001ba6, 0x001ba7}, + {0x001ba8, 0x001ba9}, + {0x001bac, 0x001bad}, + {0x001bae, 0x001baf}, + {0x001bba, 0x001be5}, + {0x001be7, 0x001be7}, + {0x001be8, 0x001be9}, + {0x001bea, 0x001bec}, + {0x001bed, 0x001bed}, + {0x001bee, 0x001bee}, + {0x001bef, 0x001bf1}, + {0x001c00, 0x001c23}, + {0x001c24, 0x001c2b}, + {0x001c2c, 0x001c33}, + {0x001c34, 0x001c35}, + {0x001c36, 0x001c36}, + {0x001c4d, 0x001c4f}, + {0x001c5a, 0x001c77}, + {0x001c78, 0x001c7d}, + {0x001c80, 0x001c8a}, + {0x001c90, 0x001cba}, + {0x001cbd, 0x001cbf}, + {0x001ce9, 0x001cec}, + {0x001cee, 0x001cf3}, + {0x001cf5, 0x001cf6}, + {0x001cfa, 0x001cfa}, + {0x001d00, 0x001d2b}, + {0x001d2c, 0x001d6a}, + {0x001d6b, 0x001d77}, + {0x001d78, 0x001d78}, + {0x001d79, 0x001d9a}, + {0x001d9b, 0x001dbf}, + {0x001dd3, 0x001df4}, + {0x001e00, 0x001f15}, + {0x001f18, 0x001f1d}, + {0x001f20, 0x001f45}, + {0x001f48, 0x001f4d}, + {0x001f50, 0x001f57}, + {0x001f59, 0x001f59}, + {0x001f5b, 0x001f5b}, + {0x001f5d, 0x001f5d}, + {0x001f5f, 0x001f7d}, + {0x001f80, 0x001fb4}, + {0x001fb6, 0x001fbc}, + {0x001fbe, 0x001fbe}, + {0x001fc2, 0x001fc4}, + {0x001fc6, 0x001fcc}, + {0x001fd0, 0x001fd3}, + {0x001fd6, 0x001fdb}, + {0x001fe0, 0x001fec}, + {0x001ff2, 0x001ff4}, + {0x001ff6, 0x001ffc}, + {0x002071, 0x002071}, + {0x00207f, 0x00207f}, + {0x002090, 0x00209c}, + {0x002102, 0x002102}, + {0x002107, 0x002107}, + {0x00210a, 0x002113}, + {0x002115, 0x002115}, + {0x002119, 0x00211d}, + {0x002124, 0x002124}, + {0x002126, 0x002126}, + {0x002128, 0x002128}, + {0x00212a, 0x00212d}, + {0x00212f, 0x002134}, + {0x002135, 0x002138}, + {0x002139, 0x002139}, + {0x00213c, 0x00213f}, + {0x002145, 0x002149}, + {0x00214e, 0x00214e}, + {0x002160, 0x002182}, + {0x002183, 0x002184}, + {0x002185, 0x002188}, + {0x0024b6, 0x0024e9}, + {0x002c00, 0x002c7b}, + {0x002c7c, 0x002c7d}, + {0x002c7e, 0x002ce4}, + {0x002ceb, 0x002cee}, + {0x002cf2, 0x002cf3}, + {0x002d00, 0x002d25}, + {0x002d27, 0x002d27}, + {0x002d2d, 0x002d2d}, + {0x002d30, 0x002d67}, + {0x002d6f, 0x002d6f}, + {0x002d80, 0x002d96}, + {0x002da0, 0x002da6}, + {0x002da8, 0x002dae}, + {0x002db0, 0x002db6}, + {0x002db8, 0x002dbe}, + {0x002dc0, 0x002dc6}, + {0x002dc8, 0x002dce}, + {0x002dd0, 0x002dd6}, + {0x002dd8, 0x002dde}, + {0x002de0, 0x002dff}, + {0x002e2f, 0x002e2f}, + {0x003005, 0x003005}, + {0x003006, 0x003006}, + {0x003007, 0x003007}, + {0x003021, 0x003029}, + {0x003031, 0x003035}, + {0x003038, 0x00303a}, + {0x00303b, 0x00303b}, + {0x00303c, 0x00303c}, + {0x003041, 0x003096}, + {0x00309d, 0x00309e}, + {0x00309f, 0x00309f}, + {0x0030a1, 0x0030fa}, + {0x0030fc, 0x0030fe}, + {0x0030ff, 0x0030ff}, + {0x003105, 0x00312f}, + {0x003131, 0x00318e}, + {0x0031a0, 0x0031bf}, + {0x0031f0, 0x0031ff}, + {0x003400, 0x004dbf}, + {0x004e00, 0x00a014}, + {0x00a015, 0x00a015}, + {0x00a016, 0x00a48c}, + {0x00a4d0, 0x00a4f7}, + {0x00a4f8, 0x00a4fd}, + {0x00a500, 0x00a60b}, + {0x00a60c, 0x00a60c}, + {0x00a610, 0x00a61f}, + {0x00a62a, 0x00a62b}, + {0x00a640, 0x00a66d}, + {0x00a66e, 0x00a66e}, + {0x00a674, 0x00a67b}, + {0x00a67f, 0x00a67f}, + {0x00a680, 0x00a69b}, + {0x00a69c, 0x00a69d}, + {0x00a69e, 0x00a69f}, + {0x00a6a0, 0x00a6e5}, + {0x00a6e6, 0x00a6ef}, + {0x00a717, 0x00a71f}, + {0x00a722, 0x00a76f}, + {0x00a770, 0x00a770}, + {0x00a771, 0x00a787}, + {0x00a788, 0x00a788}, + {0x00a78b, 0x00a78e}, + {0x00a78f, 0x00a78f}, + {0x00a790, 0x00a7cd}, + {0x00a7d0, 0x00a7d1}, + {0x00a7d3, 0x00a7d3}, + {0x00a7d5, 0x00a7dc}, + {0x00a7f2, 0x00a7f4}, + {0x00a7f5, 0x00a7f6}, + {0x00a7f7, 0x00a7f7}, + {0x00a7f8, 0x00a7f9}, + {0x00a7fa, 0x00a7fa}, + {0x00a7fb, 0x00a801}, + {0x00a802, 0x00a802}, + {0x00a803, 0x00a805}, + {0x00a807, 0x00a80a}, + {0x00a80b, 0x00a80b}, + {0x00a80c, 0x00a822}, + {0x00a823, 0x00a824}, + {0x00a825, 0x00a826}, + {0x00a827, 0x00a827}, + {0x00a840, 0x00a873}, + {0x00a880, 0x00a881}, + {0x00a882, 0x00a8b3}, + {0x00a8b4, 0x00a8c3}, + {0x00a8c5, 0x00a8c5}, + {0x00a8f2, 0x00a8f7}, + {0x00a8fb, 0x00a8fb}, + {0x00a8fd, 0x00a8fe}, + {0x00a8ff, 0x00a8ff}, + {0x00a90a, 0x00a925}, + {0x00a926, 0x00a92a}, + {0x00a930, 0x00a946}, + {0x00a947, 0x00a951}, + {0x00a952, 0x00a952}, + {0x00a960, 0x00a97c}, + {0x00a980, 0x00a982}, + {0x00a983, 0x00a983}, + {0x00a984, 0x00a9b2}, + {0x00a9b4, 0x00a9b5}, + {0x00a9b6, 0x00a9b9}, + {0x00a9ba, 0x00a9bb}, + {0x00a9bc, 0x00a9bd}, + {0x00a9be, 0x00a9bf}, + {0x00a9cf, 0x00a9cf}, + {0x00a9e0, 0x00a9e4}, + {0x00a9e5, 0x00a9e5}, + {0x00a9e6, 0x00a9e6}, + {0x00a9e7, 0x00a9ef}, + {0x00a9fa, 0x00a9fe}, + {0x00aa00, 0x00aa28}, + {0x00aa29, 0x00aa2e}, + {0x00aa2f, 0x00aa30}, + {0x00aa31, 0x00aa32}, + {0x00aa33, 0x00aa34}, + {0x00aa35, 0x00aa36}, + {0x00aa40, 0x00aa42}, + {0x00aa43, 0x00aa43}, + {0x00aa44, 0x00aa4b}, + {0x00aa4c, 0x00aa4c}, + {0x00aa4d, 0x00aa4d}, + {0x00aa60, 0x00aa6f}, + {0x00aa70, 0x00aa70}, + {0x00aa71, 0x00aa76}, + {0x00aa7a, 0x00aa7a}, + {0x00aa7b, 0x00aa7b}, + {0x00aa7c, 0x00aa7c}, + {0x00aa7d, 0x00aa7d}, + {0x00aa7e, 0x00aaaf}, + {0x00aab0, 0x00aab0}, + {0x00aab1, 0x00aab1}, + {0x00aab2, 0x00aab4}, + {0x00aab5, 0x00aab6}, + {0x00aab7, 0x00aab8}, + {0x00aab9, 0x00aabd}, + {0x00aabe, 0x00aabe}, + {0x00aac0, 0x00aac0}, + {0x00aac2, 0x00aac2}, + {0x00aadb, 0x00aadc}, + {0x00aadd, 0x00aadd}, + {0x00aae0, 0x00aaea}, + {0x00aaeb, 0x00aaeb}, + {0x00aaec, 0x00aaed}, + {0x00aaee, 0x00aaef}, + {0x00aaf2, 0x00aaf2}, + {0x00aaf3, 0x00aaf4}, + {0x00aaf5, 0x00aaf5}, + {0x00ab01, 0x00ab06}, + {0x00ab09, 0x00ab0e}, + {0x00ab11, 0x00ab16}, + {0x00ab20, 0x00ab26}, + {0x00ab28, 0x00ab2e}, + {0x00ab30, 0x00ab5a}, + {0x00ab5c, 0x00ab5f}, + {0x00ab60, 0x00ab68}, + {0x00ab69, 0x00ab69}, + {0x00ab70, 0x00abbf}, + {0x00abc0, 0x00abe2}, + {0x00abe3, 0x00abe4}, + {0x00abe5, 0x00abe5}, + {0x00abe6, 0x00abe7}, + {0x00abe8, 0x00abe8}, + {0x00abe9, 0x00abea}, + {0x00ac00, 0x00d7a3}, + {0x00d7b0, 0x00d7c6}, + {0x00d7cb, 0x00d7fb}, + {0x00f900, 0x00fa6d}, + {0x00fa70, 0x00fad9}, + {0x00fb00, 0x00fb06}, + {0x00fb13, 0x00fb17}, + {0x00fb1d, 0x00fb1d}, + {0x00fb1e, 0x00fb1e}, + {0x00fb1f, 0x00fb28}, + {0x00fb2a, 0x00fb36}, + {0x00fb38, 0x00fb3c}, + {0x00fb3e, 0x00fb3e}, + {0x00fb40, 0x00fb41}, + {0x00fb43, 0x00fb44}, + {0x00fb46, 0x00fbb1}, + {0x00fbd3, 0x00fd3d}, + {0x00fd50, 0x00fd8f}, + {0x00fd92, 0x00fdc7}, + {0x00fdf0, 0x00fdfb}, + {0x00fe70, 0x00fe74}, + {0x00fe76, 0x00fefc}, + {0x00ff21, 0x00ff3a}, + {0x00ff41, 0x00ff5a}, + {0x00ff66, 0x00ff6f}, + {0x00ff70, 0x00ff70}, + {0x00ff71, 0x00ff9d}, + {0x00ff9e, 0x00ff9f}, + {0x00ffa0, 0x00ffbe}, + {0x00ffc2, 0x00ffc7}, + {0x00ffca, 0x00ffcf}, + {0x00ffd2, 0x00ffd7}, + {0x00ffda, 0x00ffdc}, + {0x010000, 0x01000b}, + {0x01000d, 0x010026}, + {0x010028, 0x01003a}, + {0x01003c, 0x01003d}, + {0x01003f, 0x01004d}, + {0x010050, 0x01005d}, + {0x010080, 0x0100fa}, + {0x010140, 0x010174}, + {0x010280, 0x01029c}, + {0x0102a0, 0x0102d0}, + {0x010300, 0x01031f}, + {0x01032d, 0x010340}, + {0x010341, 0x010341}, + {0x010342, 0x010349}, + {0x01034a, 0x01034a}, + {0x010350, 0x010375}, + {0x010376, 0x01037a}, + {0x010380, 0x01039d}, + {0x0103a0, 0x0103c3}, + {0x0103c8, 0x0103cf}, + {0x0103d1, 0x0103d5}, + {0x010400, 0x01044f}, + {0x010450, 0x01049d}, + {0x0104b0, 0x0104d3}, + {0x0104d8, 0x0104fb}, + {0x010500, 0x010527}, + {0x010530, 0x010563}, + {0x010570, 0x01057a}, + {0x01057c, 0x01058a}, + {0x01058c, 0x010592}, + {0x010594, 0x010595}, + {0x010597, 0x0105a1}, + {0x0105a3, 0x0105b1}, + {0x0105b3, 0x0105b9}, + {0x0105bb, 0x0105bc}, + {0x0105c0, 0x0105f3}, + {0x010600, 0x010736}, + {0x010740, 0x010755}, + {0x010760, 0x010767}, + {0x010780, 0x010785}, + {0x010787, 0x0107b0}, + {0x0107b2, 0x0107ba}, + {0x010800, 0x010805}, + {0x010808, 0x010808}, + {0x01080a, 0x010835}, + {0x010837, 0x010838}, + {0x01083c, 0x01083c}, + {0x01083f, 0x010855}, + {0x010860, 0x010876}, + {0x010880, 0x01089e}, + {0x0108e0, 0x0108f2}, + {0x0108f4, 0x0108f5}, + {0x010900, 0x010915}, + {0x010920, 0x010939}, + {0x010980, 0x0109b7}, + {0x0109be, 0x0109bf}, + {0x010a00, 0x010a00}, + {0x010a01, 0x010a03}, + {0x010a05, 0x010a06}, + {0x010a0c, 0x010a0f}, + {0x010a10, 0x010a13}, + {0x010a15, 0x010a17}, + {0x010a19, 0x010a35}, + {0x010a60, 0x010a7c}, + {0x010a80, 0x010a9c}, + {0x010ac0, 0x010ac7}, + {0x010ac9, 0x010ae4}, + {0x010b00, 0x010b35}, + {0x010b40, 0x010b55}, + {0x010b60, 0x010b72}, + {0x010b80, 0x010b91}, + {0x010c00, 0x010c48}, + {0x010c80, 0x010cb2}, + {0x010cc0, 0x010cf2}, + {0x010d00, 0x010d23}, + {0x010d24, 0x010d27}, + {0x010d4a, 0x010d4d}, + {0x010d4e, 0x010d4e}, + {0x010d4f, 0x010d4f}, + {0x010d50, 0x010d65}, + {0x010d69, 0x010d69}, + {0x010d6f, 0x010d6f}, + {0x010d70, 0x010d85}, + {0x010e80, 0x010ea9}, + {0x010eab, 0x010eac}, + {0x010eb0, 0x010eb1}, + {0x010ec2, 0x010ec4}, + {0x010efc, 0x010efc}, + {0x010f00, 0x010f1c}, + {0x010f27, 0x010f27}, + {0x010f30, 0x010f45}, + {0x010f70, 0x010f81}, + {0x010fb0, 0x010fc4}, + {0x010fe0, 0x010ff6}, + {0x011000, 0x011000}, + {0x011001, 0x011001}, + {0x011002, 0x011002}, + {0x011003, 0x011037}, + {0x011038, 0x011045}, + {0x011071, 0x011072}, + {0x011073, 0x011074}, + {0x011075, 0x011075}, + {0x011080, 0x011081}, + {0x011082, 0x011082}, + {0x011083, 0x0110af}, + {0x0110b0, 0x0110b2}, + {0x0110b3, 0x0110b6}, + {0x0110b7, 0x0110b8}, + {0x0110c2, 0x0110c2}, + {0x0110d0, 0x0110e8}, + {0x011100, 0x011102}, + {0x011103, 0x011126}, + {0x011127, 0x01112b}, + {0x01112c, 0x01112c}, + {0x01112d, 0x011132}, + {0x011144, 0x011144}, + {0x011145, 0x011146}, + {0x011147, 0x011147}, + {0x011150, 0x011172}, + {0x011176, 0x011176}, + {0x011180, 0x011181}, + {0x011182, 0x011182}, + {0x011183, 0x0111b2}, + {0x0111b3, 0x0111b5}, + {0x0111b6, 0x0111be}, + {0x0111bf, 0x0111bf}, + {0x0111c1, 0x0111c4}, + {0x0111ce, 0x0111ce}, + {0x0111cf, 0x0111cf}, + {0x0111da, 0x0111da}, + {0x0111dc, 0x0111dc}, + {0x011200, 0x011211}, + {0x011213, 0x01122b}, + {0x01122c, 0x01122e}, + {0x01122f, 0x011231}, + {0x011232, 0x011233}, + {0x011234, 0x011234}, + {0x011237, 0x011237}, + {0x01123e, 0x01123e}, + {0x01123f, 0x011240}, + {0x011241, 0x011241}, + {0x011280, 0x011286}, + {0x011288, 0x011288}, + {0x01128a, 0x01128d}, + {0x01128f, 0x01129d}, + {0x01129f, 0x0112a8}, + {0x0112b0, 0x0112de}, + {0x0112df, 0x0112df}, + {0x0112e0, 0x0112e2}, + {0x0112e3, 0x0112e8}, + {0x011300, 0x011301}, + {0x011302, 0x011303}, + {0x011305, 0x01130c}, + {0x01130f, 0x011310}, + {0x011313, 0x011328}, + {0x01132a, 0x011330}, + {0x011332, 0x011333}, + {0x011335, 0x011339}, + {0x01133d, 0x01133d}, + {0x01133e, 0x01133f}, + {0x011340, 0x011340}, + {0x011341, 0x011344}, + {0x011347, 0x011348}, + {0x01134b, 0x01134c}, + {0x011350, 0x011350}, + {0x011357, 0x011357}, + {0x01135d, 0x011361}, + {0x011362, 0x011363}, + {0x011380, 0x011389}, + {0x01138b, 0x01138b}, + {0x01138e, 0x01138e}, + {0x011390, 0x0113b5}, + {0x0113b7, 0x0113b7}, + {0x0113b8, 0x0113ba}, + {0x0113bb, 0x0113c0}, + {0x0113c2, 0x0113c2}, + {0x0113c5, 0x0113c5}, + {0x0113c7, 0x0113ca}, + {0x0113cc, 0x0113cd}, + {0x0113d1, 0x0113d1}, + {0x0113d3, 0x0113d3}, + {0x011400, 0x011434}, + {0x011435, 0x011437}, + {0x011438, 0x01143f}, + {0x011440, 0x011441}, + {0x011443, 0x011444}, + {0x011445, 0x011445}, + {0x011447, 0x01144a}, + {0x01145f, 0x011461}, + {0x011480, 0x0114af}, + {0x0114b0, 0x0114b2}, + {0x0114b3, 0x0114b8}, + {0x0114b9, 0x0114b9}, + {0x0114ba, 0x0114ba}, + {0x0114bb, 0x0114be}, + {0x0114bf, 0x0114c0}, + {0x0114c1, 0x0114c1}, + {0x0114c4, 0x0114c5}, + {0x0114c7, 0x0114c7}, + {0x011580, 0x0115ae}, + {0x0115af, 0x0115b1}, + {0x0115b2, 0x0115b5}, + {0x0115b8, 0x0115bb}, + {0x0115bc, 0x0115bd}, + {0x0115be, 0x0115be}, + {0x0115d8, 0x0115db}, + {0x0115dc, 0x0115dd}, + {0x011600, 0x01162f}, + {0x011630, 0x011632}, + {0x011633, 0x01163a}, + {0x01163b, 0x01163c}, + {0x01163d, 0x01163d}, + {0x01163e, 0x01163e}, + {0x011640, 0x011640}, + {0x011644, 0x011644}, + {0x011680, 0x0116aa}, + {0x0116ab, 0x0116ab}, + {0x0116ac, 0x0116ac}, + {0x0116ad, 0x0116ad}, + {0x0116ae, 0x0116af}, + {0x0116b0, 0x0116b5}, + {0x0116b8, 0x0116b8}, + {0x011700, 0x01171a}, + {0x01171d, 0x01171d}, + {0x01171e, 0x01171e}, + {0x01171f, 0x01171f}, + {0x011720, 0x011721}, + {0x011722, 0x011725}, + {0x011726, 0x011726}, + {0x011727, 0x01172a}, + {0x011740, 0x011746}, + {0x011800, 0x01182b}, + {0x01182c, 0x01182e}, + {0x01182f, 0x011837}, + {0x011838, 0x011838}, + {0x0118a0, 0x0118df}, + {0x0118ff, 0x011906}, + {0x011909, 0x011909}, + {0x01190c, 0x011913}, + {0x011915, 0x011916}, + {0x011918, 0x01192f}, + {0x011930, 0x011935}, + {0x011937, 0x011938}, + {0x01193b, 0x01193c}, + {0x01193f, 0x01193f}, + {0x011940, 0x011940}, + {0x011941, 0x011941}, + {0x011942, 0x011942}, + {0x0119a0, 0x0119a7}, + {0x0119aa, 0x0119d0}, + {0x0119d1, 0x0119d3}, + {0x0119d4, 0x0119d7}, + {0x0119da, 0x0119db}, + {0x0119dc, 0x0119df}, + {0x0119e1, 0x0119e1}, + {0x0119e3, 0x0119e3}, + {0x0119e4, 0x0119e4}, + {0x011a00, 0x011a00}, + {0x011a01, 0x011a0a}, + {0x011a0b, 0x011a32}, + {0x011a35, 0x011a38}, + {0x011a39, 0x011a39}, + {0x011a3a, 0x011a3a}, + {0x011a3b, 0x011a3e}, + {0x011a50, 0x011a50}, + {0x011a51, 0x011a56}, + {0x011a57, 0x011a58}, + {0x011a59, 0x011a5b}, + {0x011a5c, 0x011a89}, + {0x011a8a, 0x011a96}, + {0x011a97, 0x011a97}, + {0x011a9d, 0x011a9d}, + {0x011ab0, 0x011af8}, + {0x011bc0, 0x011be0}, + {0x011c00, 0x011c08}, + {0x011c0a, 0x011c2e}, + {0x011c2f, 0x011c2f}, + {0x011c30, 0x011c36}, + {0x011c38, 0x011c3d}, + {0x011c3e, 0x011c3e}, + {0x011c40, 0x011c40}, + {0x011c72, 0x011c8f}, + {0x011c92, 0x011ca7}, + {0x011ca9, 0x011ca9}, + {0x011caa, 0x011cb0}, + {0x011cb1, 0x011cb1}, + {0x011cb2, 0x011cb3}, + {0x011cb4, 0x011cb4}, + {0x011cb5, 0x011cb6}, + {0x011d00, 0x011d06}, + {0x011d08, 0x011d09}, + {0x011d0b, 0x011d30}, + {0x011d31, 0x011d36}, + {0x011d3a, 0x011d3a}, + {0x011d3c, 0x011d3d}, + {0x011d3f, 0x011d41}, + {0x011d43, 0x011d43}, + {0x011d46, 0x011d46}, + {0x011d47, 0x011d47}, + {0x011d60, 0x011d65}, + {0x011d67, 0x011d68}, + {0x011d6a, 0x011d89}, + {0x011d8a, 0x011d8e}, + {0x011d90, 0x011d91}, + {0x011d93, 0x011d94}, + {0x011d95, 0x011d95}, + {0x011d96, 0x011d96}, + {0x011d98, 0x011d98}, + {0x011ee0, 0x011ef2}, + {0x011ef3, 0x011ef4}, + {0x011ef5, 0x011ef6}, + {0x011f00, 0x011f01}, + {0x011f02, 0x011f02}, + {0x011f03, 0x011f03}, + {0x011f04, 0x011f10}, + {0x011f12, 0x011f33}, + {0x011f34, 0x011f35}, + {0x011f36, 0x011f3a}, + {0x011f3e, 0x011f3f}, + {0x011f40, 0x011f40}, + {0x011fb0, 0x011fb0}, + {0x012000, 0x012399}, + {0x012400, 0x01246e}, + {0x012480, 0x012543}, + {0x012f90, 0x012ff0}, + {0x013000, 0x01342f}, + {0x013441, 0x013446}, + {0x013460, 0x0143fa}, + {0x014400, 0x014646}, + {0x016100, 0x01611d}, + {0x01611e, 0x016129}, + {0x01612a, 0x01612c}, + {0x01612d, 0x01612e}, + {0x016800, 0x016a38}, + {0x016a40, 0x016a5e}, + {0x016a70, 0x016abe}, + {0x016ad0, 0x016aed}, + {0x016b00, 0x016b2f}, + {0x016b40, 0x016b43}, + {0x016b63, 0x016b77}, + {0x016b7d, 0x016b8f}, + {0x016d40, 0x016d42}, + {0x016d43, 0x016d6a}, + {0x016d6b, 0x016d6c}, + {0x016e40, 0x016e7f}, + {0x016f00, 0x016f4a}, + {0x016f4f, 0x016f4f}, + {0x016f50, 0x016f50}, + {0x016f51, 0x016f87}, + {0x016f8f, 0x016f92}, + {0x016f93, 0x016f9f}, + {0x016fe0, 0x016fe1}, + {0x016fe3, 0x016fe3}, + {0x016ff0, 0x016ff1}, + {0x017000, 0x0187f7}, + {0x018800, 0x018cd5}, + {0x018cff, 0x018d08}, + {0x01aff0, 0x01aff3}, + {0x01aff5, 0x01affb}, + {0x01affd, 0x01affe}, + {0x01b000, 0x01b122}, + {0x01b132, 0x01b132}, + {0x01b150, 0x01b152}, + {0x01b155, 0x01b155}, + {0x01b164, 0x01b167}, + {0x01b170, 0x01b2fb}, + {0x01bc00, 0x01bc6a}, + {0x01bc70, 0x01bc7c}, + {0x01bc80, 0x01bc88}, + {0x01bc90, 0x01bc99}, + {0x01bc9e, 0x01bc9e}, + {0x01d400, 0x01d454}, + {0x01d456, 0x01d49c}, + {0x01d49e, 0x01d49f}, + {0x01d4a2, 0x01d4a2}, + {0x01d4a5, 0x01d4a6}, + {0x01d4a9, 0x01d4ac}, + {0x01d4ae, 0x01d4b9}, + {0x01d4bb, 0x01d4bb}, + {0x01d4bd, 0x01d4c3}, + {0x01d4c5, 0x01d505}, + {0x01d507, 0x01d50a}, + {0x01d50d, 0x01d514}, + {0x01d516, 0x01d51c}, + {0x01d51e, 0x01d539}, + {0x01d53b, 0x01d53e}, + {0x01d540, 0x01d544}, + {0x01d546, 0x01d546}, + {0x01d54a, 0x01d550}, + {0x01d552, 0x01d6a5}, + {0x01d6a8, 0x01d6c0}, + {0x01d6c2, 0x01d6da}, + {0x01d6dc, 0x01d6fa}, + {0x01d6fc, 0x01d714}, + {0x01d716, 0x01d734}, + {0x01d736, 0x01d74e}, + {0x01d750, 0x01d76e}, + {0x01d770, 0x01d788}, + {0x01d78a, 0x01d7a8}, + {0x01d7aa, 0x01d7c2}, + {0x01d7c4, 0x01d7cb}, + {0x01df00, 0x01df09}, + {0x01df0a, 0x01df0a}, + {0x01df0b, 0x01df1e}, + {0x01df25, 0x01df2a}, + {0x01e000, 0x01e006}, + {0x01e008, 0x01e018}, + {0x01e01b, 0x01e021}, + {0x01e023, 0x01e024}, + {0x01e026, 0x01e02a}, + {0x01e030, 0x01e06d}, + {0x01e08f, 0x01e08f}, + {0x01e100, 0x01e12c}, + {0x01e137, 0x01e13d}, + {0x01e14e, 0x01e14e}, + {0x01e290, 0x01e2ad}, + {0x01e2c0, 0x01e2eb}, + {0x01e4d0, 0x01e4ea}, + {0x01e4eb, 0x01e4eb}, + {0x01e5d0, 0x01e5ed}, + {0x01e5f0, 0x01e5f0}, + {0x01e7e0, 0x01e7e6}, + {0x01e7e8, 0x01e7eb}, + {0x01e7ed, 0x01e7ee}, + {0x01e7f0, 0x01e7fe}, + {0x01e800, 0x01e8c4}, + {0x01e900, 0x01e943}, + {0x01e947, 0x01e947}, + {0x01e94b, 0x01e94b}, + {0x01ee00, 0x01ee03}, + {0x01ee05, 0x01ee1f}, + {0x01ee21, 0x01ee22}, + {0x01ee24, 0x01ee24}, + {0x01ee27, 0x01ee27}, + {0x01ee29, 0x01ee32}, + {0x01ee34, 0x01ee37}, + {0x01ee39, 0x01ee39}, + {0x01ee3b, 0x01ee3b}, + {0x01ee42, 0x01ee42}, + {0x01ee47, 0x01ee47}, + {0x01ee49, 0x01ee49}, + {0x01ee4b, 0x01ee4b}, + {0x01ee4d, 0x01ee4f}, + {0x01ee51, 0x01ee52}, + {0x01ee54, 0x01ee54}, + {0x01ee57, 0x01ee57}, + {0x01ee59, 0x01ee59}, + {0x01ee5b, 0x01ee5b}, + {0x01ee5d, 0x01ee5d}, + {0x01ee5f, 0x01ee5f}, + {0x01ee61, 0x01ee62}, + {0x01ee64, 0x01ee64}, + {0x01ee67, 0x01ee6a}, + {0x01ee6c, 0x01ee72}, + {0x01ee74, 0x01ee77}, + {0x01ee79, 0x01ee7c}, + {0x01ee7e, 0x01ee7e}, + {0x01ee80, 0x01ee89}, + {0x01ee8b, 0x01ee9b}, + {0x01eea1, 0x01eea3}, + {0x01eea5, 0x01eea9}, + {0x01eeab, 0x01eebb}, + {0x01f130, 0x01f149}, + {0x01f150, 0x01f169}, + {0x01f170, 0x01f189}, + {0x020000, 0x02a6df}, + {0x02a700, 0x02b739}, + {0x02b740, 0x02b81d}, + {0x02b820, 0x02cea1}, + {0x02ceb0, 0x02ebe0}, + {0x02ebf0, 0x02ee5d}, + {0x02f800, 0x02fa1d}, + {0x030000, 0x03134a}, + {0x031350, 0x0323af}, +}; + +/* table of Unicode codepoint ranges of Lowercase characters */ +static const pg_unicode_range unicode_lowercase[690] = +{ + {0x000061, 0x00007a}, + {0x0000aa, 0x0000aa}, + {0x0000b5, 0x0000b5}, + {0x0000ba, 0x0000ba}, + {0x0000df, 0x0000f6}, + {0x0000f8, 0x0000ff}, + {0x000101, 0x000101}, + {0x000103, 0x000103}, + {0x000105, 0x000105}, + {0x000107, 0x000107}, + {0x000109, 0x000109}, + {0x00010b, 0x00010b}, + {0x00010d, 0x00010d}, + {0x00010f, 0x00010f}, + {0x000111, 0x000111}, + {0x000113, 0x000113}, + {0x000115, 0x000115}, + {0x000117, 0x000117}, + {0x000119, 0x000119}, + {0x00011b, 0x00011b}, + {0x00011d, 0x00011d}, + {0x00011f, 0x00011f}, + {0x000121, 0x000121}, + {0x000123, 0x000123}, + {0x000125, 0x000125}, + {0x000127, 0x000127}, + {0x000129, 0x000129}, + {0x00012b, 0x00012b}, + {0x00012d, 0x00012d}, + {0x00012f, 0x00012f}, + {0x000131, 0x000131}, + {0x000133, 0x000133}, + {0x000135, 0x000135}, + {0x000137, 0x000138}, + {0x00013a, 0x00013a}, + {0x00013c, 0x00013c}, + {0x00013e, 0x00013e}, + {0x000140, 0x000140}, + {0x000142, 0x000142}, + {0x000144, 0x000144}, + {0x000146, 0x000146}, + {0x000148, 0x000149}, + {0x00014b, 0x00014b}, + {0x00014d, 0x00014d}, + {0x00014f, 0x00014f}, + {0x000151, 0x000151}, + {0x000153, 0x000153}, + {0x000155, 0x000155}, + {0x000157, 0x000157}, + {0x000159, 0x000159}, + {0x00015b, 0x00015b}, + {0x00015d, 0x00015d}, + {0x00015f, 0x00015f}, + {0x000161, 0x000161}, + {0x000163, 0x000163}, + {0x000165, 0x000165}, + {0x000167, 0x000167}, + {0x000169, 0x000169}, + {0x00016b, 0x00016b}, + {0x00016d, 0x00016d}, + {0x00016f, 0x00016f}, + {0x000171, 0x000171}, + {0x000173, 0x000173}, + {0x000175, 0x000175}, + {0x000177, 0x000177}, + {0x00017a, 0x00017a}, + {0x00017c, 0x00017c}, + {0x00017e, 0x000180}, + {0x000183, 0x000183}, + {0x000185, 0x000185}, + {0x000188, 0x000188}, + {0x00018c, 0x00018d}, + {0x000192, 0x000192}, + {0x000195, 0x000195}, + {0x000199, 0x00019b}, + {0x00019e, 0x00019e}, + {0x0001a1, 0x0001a1}, + {0x0001a3, 0x0001a3}, + {0x0001a5, 0x0001a5}, + {0x0001a8, 0x0001a8}, + {0x0001aa, 0x0001ab}, + {0x0001ad, 0x0001ad}, + {0x0001b0, 0x0001b0}, + {0x0001b4, 0x0001b4}, + {0x0001b6, 0x0001b6}, + {0x0001b9, 0x0001ba}, + {0x0001bd, 0x0001bf}, + {0x0001c6, 0x0001c6}, + {0x0001c9, 0x0001c9}, + {0x0001cc, 0x0001cc}, + {0x0001ce, 0x0001ce}, + {0x0001d0, 0x0001d0}, + {0x0001d2, 0x0001d2}, + {0x0001d4, 0x0001d4}, + {0x0001d6, 0x0001d6}, + {0x0001d8, 0x0001d8}, + {0x0001da, 0x0001da}, + {0x0001dc, 0x0001dd}, + {0x0001df, 0x0001df}, + {0x0001e1, 0x0001e1}, + {0x0001e3, 0x0001e3}, + {0x0001e5, 0x0001e5}, + {0x0001e7, 0x0001e7}, + {0x0001e9, 0x0001e9}, + {0x0001eb, 0x0001eb}, + {0x0001ed, 0x0001ed}, + {0x0001ef, 0x0001f0}, + {0x0001f3, 0x0001f3}, + {0x0001f5, 0x0001f5}, + {0x0001f9, 0x0001f9}, + {0x0001fb, 0x0001fb}, + {0x0001fd, 0x0001fd}, + {0x0001ff, 0x0001ff}, + {0x000201, 0x000201}, + {0x000203, 0x000203}, + {0x000205, 0x000205}, + {0x000207, 0x000207}, + {0x000209, 0x000209}, + {0x00020b, 0x00020b}, + {0x00020d, 0x00020d}, + {0x00020f, 0x00020f}, + {0x000211, 0x000211}, + {0x000213, 0x000213}, + {0x000215, 0x000215}, + {0x000217, 0x000217}, + {0x000219, 0x000219}, + {0x00021b, 0x00021b}, + {0x00021d, 0x00021d}, + {0x00021f, 0x00021f}, + {0x000221, 0x000221}, + {0x000223, 0x000223}, + {0x000225, 0x000225}, + {0x000227, 0x000227}, + {0x000229, 0x000229}, + {0x00022b, 0x00022b}, + {0x00022d, 0x00022d}, + {0x00022f, 0x00022f}, + {0x000231, 0x000231}, + {0x000233, 0x000239}, + {0x00023c, 0x00023c}, + {0x00023f, 0x000240}, + {0x000242, 0x000242}, + {0x000247, 0x000247}, + {0x000249, 0x000249}, + {0x00024b, 0x00024b}, + {0x00024d, 0x00024d}, + {0x00024f, 0x000293}, + {0x000295, 0x0002af}, + {0x0002b0, 0x0002b8}, + {0x0002c0, 0x0002c1}, + {0x0002e0, 0x0002e4}, + {0x000345, 0x000345}, + {0x000371, 0x000371}, + {0x000373, 0x000373}, + {0x000377, 0x000377}, + {0x00037a, 0x00037a}, + {0x00037b, 0x00037d}, + {0x000390, 0x000390}, + {0x0003ac, 0x0003ce}, + {0x0003d0, 0x0003d1}, + {0x0003d5, 0x0003d7}, + {0x0003d9, 0x0003d9}, + {0x0003db, 0x0003db}, + {0x0003dd, 0x0003dd}, + {0x0003df, 0x0003df}, + {0x0003e1, 0x0003e1}, + {0x0003e3, 0x0003e3}, + {0x0003e5, 0x0003e5}, + {0x0003e7, 0x0003e7}, + {0x0003e9, 0x0003e9}, + {0x0003eb, 0x0003eb}, + {0x0003ed, 0x0003ed}, + {0x0003ef, 0x0003f3}, + {0x0003f5, 0x0003f5}, + {0x0003f8, 0x0003f8}, + {0x0003fb, 0x0003fc}, + {0x000430, 0x00045f}, + {0x000461, 0x000461}, + {0x000463, 0x000463}, + {0x000465, 0x000465}, + {0x000467, 0x000467}, + {0x000469, 0x000469}, + {0x00046b, 0x00046b}, + {0x00046d, 0x00046d}, + {0x00046f, 0x00046f}, + {0x000471, 0x000471}, + {0x000473, 0x000473}, + {0x000475, 0x000475}, + {0x000477, 0x000477}, + {0x000479, 0x000479}, + {0x00047b, 0x00047b}, + {0x00047d, 0x00047d}, + {0x00047f, 0x00047f}, + {0x000481, 0x000481}, + {0x00048b, 0x00048b}, + {0x00048d, 0x00048d}, + {0x00048f, 0x00048f}, + {0x000491, 0x000491}, + {0x000493, 0x000493}, + {0x000495, 0x000495}, + {0x000497, 0x000497}, + {0x000499, 0x000499}, + {0x00049b, 0x00049b}, + {0x00049d, 0x00049d}, + {0x00049f, 0x00049f}, + {0x0004a1, 0x0004a1}, + {0x0004a3, 0x0004a3}, + {0x0004a5, 0x0004a5}, + {0x0004a7, 0x0004a7}, + {0x0004a9, 0x0004a9}, + {0x0004ab, 0x0004ab}, + {0x0004ad, 0x0004ad}, + {0x0004af, 0x0004af}, + {0x0004b1, 0x0004b1}, + {0x0004b3, 0x0004b3}, + {0x0004b5, 0x0004b5}, + {0x0004b7, 0x0004b7}, + {0x0004b9, 0x0004b9}, + {0x0004bb, 0x0004bb}, + {0x0004bd, 0x0004bd}, + {0x0004bf, 0x0004bf}, + {0x0004c2, 0x0004c2}, + {0x0004c4, 0x0004c4}, + {0x0004c6, 0x0004c6}, + {0x0004c8, 0x0004c8}, + {0x0004ca, 0x0004ca}, + {0x0004cc, 0x0004cc}, + {0x0004ce, 0x0004cf}, + {0x0004d1, 0x0004d1}, + {0x0004d3, 0x0004d3}, + {0x0004d5, 0x0004d5}, + {0x0004d7, 0x0004d7}, + {0x0004d9, 0x0004d9}, + {0x0004db, 0x0004db}, + {0x0004dd, 0x0004dd}, + {0x0004df, 0x0004df}, + {0x0004e1, 0x0004e1}, + {0x0004e3, 0x0004e3}, + {0x0004e5, 0x0004e5}, + {0x0004e7, 0x0004e7}, + {0x0004e9, 0x0004e9}, + {0x0004eb, 0x0004eb}, + {0x0004ed, 0x0004ed}, + {0x0004ef, 0x0004ef}, + {0x0004f1, 0x0004f1}, + {0x0004f3, 0x0004f3}, + {0x0004f5, 0x0004f5}, + {0x0004f7, 0x0004f7}, + {0x0004f9, 0x0004f9}, + {0x0004fb, 0x0004fb}, + {0x0004fd, 0x0004fd}, + {0x0004ff, 0x0004ff}, + {0x000501, 0x000501}, + {0x000503, 0x000503}, + {0x000505, 0x000505}, + {0x000507, 0x000507}, + {0x000509, 0x000509}, + {0x00050b, 0x00050b}, + {0x00050d, 0x00050d}, + {0x00050f, 0x00050f}, + {0x000511, 0x000511}, + {0x000513, 0x000513}, + {0x000515, 0x000515}, + {0x000517, 0x000517}, + {0x000519, 0x000519}, + {0x00051b, 0x00051b}, + {0x00051d, 0x00051d}, + {0x00051f, 0x00051f}, + {0x000521, 0x000521}, + {0x000523, 0x000523}, + {0x000525, 0x000525}, + {0x000527, 0x000527}, + {0x000529, 0x000529}, + {0x00052b, 0x00052b}, + {0x00052d, 0x00052d}, + {0x00052f, 0x00052f}, + {0x000560, 0x000588}, + {0x0010d0, 0x0010fa}, + {0x0010fc, 0x0010fc}, + {0x0010fd, 0x0010ff}, + {0x0013f8, 0x0013fd}, + {0x001c80, 0x001c88}, + {0x001c8a, 0x001c8a}, + {0x001d00, 0x001d2b}, + {0x001d2c, 0x001d6a}, + {0x001d6b, 0x001d77}, + {0x001d78, 0x001d78}, + {0x001d79, 0x001d9a}, + {0x001d9b, 0x001dbf}, + {0x001e01, 0x001e01}, + {0x001e03, 0x001e03}, + {0x001e05, 0x001e05}, + {0x001e07, 0x001e07}, + {0x001e09, 0x001e09}, + {0x001e0b, 0x001e0b}, + {0x001e0d, 0x001e0d}, + {0x001e0f, 0x001e0f}, + {0x001e11, 0x001e11}, + {0x001e13, 0x001e13}, + {0x001e15, 0x001e15}, + {0x001e17, 0x001e17}, + {0x001e19, 0x001e19}, + {0x001e1b, 0x001e1b}, + {0x001e1d, 0x001e1d}, + {0x001e1f, 0x001e1f}, + {0x001e21, 0x001e21}, + {0x001e23, 0x001e23}, + {0x001e25, 0x001e25}, + {0x001e27, 0x001e27}, + {0x001e29, 0x001e29}, + {0x001e2b, 0x001e2b}, + {0x001e2d, 0x001e2d}, + {0x001e2f, 0x001e2f}, + {0x001e31, 0x001e31}, + {0x001e33, 0x001e33}, + {0x001e35, 0x001e35}, + {0x001e37, 0x001e37}, + {0x001e39, 0x001e39}, + {0x001e3b, 0x001e3b}, + {0x001e3d, 0x001e3d}, + {0x001e3f, 0x001e3f}, + {0x001e41, 0x001e41}, + {0x001e43, 0x001e43}, + {0x001e45, 0x001e45}, + {0x001e47, 0x001e47}, + {0x001e49, 0x001e49}, + {0x001e4b, 0x001e4b}, + {0x001e4d, 0x001e4d}, + {0x001e4f, 0x001e4f}, + {0x001e51, 0x001e51}, + {0x001e53, 0x001e53}, + {0x001e55, 0x001e55}, + {0x001e57, 0x001e57}, + {0x001e59, 0x001e59}, + {0x001e5b, 0x001e5b}, + {0x001e5d, 0x001e5d}, + {0x001e5f, 0x001e5f}, + {0x001e61, 0x001e61}, + {0x001e63, 0x001e63}, + {0x001e65, 0x001e65}, + {0x001e67, 0x001e67}, + {0x001e69, 0x001e69}, + {0x001e6b, 0x001e6b}, + {0x001e6d, 0x001e6d}, + {0x001e6f, 0x001e6f}, + {0x001e71, 0x001e71}, + {0x001e73, 0x001e73}, + {0x001e75, 0x001e75}, + {0x001e77, 0x001e77}, + {0x001e79, 0x001e79}, + {0x001e7b, 0x001e7b}, + {0x001e7d, 0x001e7d}, + {0x001e7f, 0x001e7f}, + {0x001e81, 0x001e81}, + {0x001e83, 0x001e83}, + {0x001e85, 0x001e85}, + {0x001e87, 0x001e87}, + {0x001e89, 0x001e89}, + {0x001e8b, 0x001e8b}, + {0x001e8d, 0x001e8d}, + {0x001e8f, 0x001e8f}, + {0x001e91, 0x001e91}, + {0x001e93, 0x001e93}, + {0x001e95, 0x001e9d}, + {0x001e9f, 0x001e9f}, + {0x001ea1, 0x001ea1}, + {0x001ea3, 0x001ea3}, + {0x001ea5, 0x001ea5}, + {0x001ea7, 0x001ea7}, + {0x001ea9, 0x001ea9}, + {0x001eab, 0x001eab}, + {0x001ead, 0x001ead}, + {0x001eaf, 0x001eaf}, + {0x001eb1, 0x001eb1}, + {0x001eb3, 0x001eb3}, + {0x001eb5, 0x001eb5}, + {0x001eb7, 0x001eb7}, + {0x001eb9, 0x001eb9}, + {0x001ebb, 0x001ebb}, + {0x001ebd, 0x001ebd}, + {0x001ebf, 0x001ebf}, + {0x001ec1, 0x001ec1}, + {0x001ec3, 0x001ec3}, + {0x001ec5, 0x001ec5}, + {0x001ec7, 0x001ec7}, + {0x001ec9, 0x001ec9}, + {0x001ecb, 0x001ecb}, + {0x001ecd, 0x001ecd}, + {0x001ecf, 0x001ecf}, + {0x001ed1, 0x001ed1}, + {0x001ed3, 0x001ed3}, + {0x001ed5, 0x001ed5}, + {0x001ed7, 0x001ed7}, + {0x001ed9, 0x001ed9}, + {0x001edb, 0x001edb}, + {0x001edd, 0x001edd}, + {0x001edf, 0x001edf}, + {0x001ee1, 0x001ee1}, + {0x001ee3, 0x001ee3}, + {0x001ee5, 0x001ee5}, + {0x001ee7, 0x001ee7}, + {0x001ee9, 0x001ee9}, + {0x001eeb, 0x001eeb}, + {0x001eed, 0x001eed}, + {0x001eef, 0x001eef}, + {0x001ef1, 0x001ef1}, + {0x001ef3, 0x001ef3}, + {0x001ef5, 0x001ef5}, + {0x001ef7, 0x001ef7}, + {0x001ef9, 0x001ef9}, + {0x001efb, 0x001efb}, + {0x001efd, 0x001efd}, + {0x001eff, 0x001f07}, + {0x001f10, 0x001f15}, + {0x001f20, 0x001f27}, + {0x001f30, 0x001f37}, + {0x001f40, 0x001f45}, + {0x001f50, 0x001f57}, + {0x001f60, 0x001f67}, + {0x001f70, 0x001f7d}, + {0x001f80, 0x001f87}, + {0x001f90, 0x001f97}, + {0x001fa0, 0x001fa7}, + {0x001fb0, 0x001fb4}, + {0x001fb6, 0x001fb7}, + {0x001fbe, 0x001fbe}, + {0x001fc2, 0x001fc4}, + {0x001fc6, 0x001fc7}, + {0x001fd0, 0x001fd3}, + {0x001fd6, 0x001fd7}, + {0x001fe0, 0x001fe7}, + {0x001ff2, 0x001ff4}, + {0x001ff6, 0x001ff7}, + {0x002071, 0x002071}, + {0x00207f, 0x00207f}, + {0x002090, 0x00209c}, + {0x00210a, 0x00210a}, + {0x00210e, 0x00210f}, + {0x002113, 0x002113}, + {0x00212f, 0x00212f}, + {0x002134, 0x002134}, + {0x002139, 0x002139}, + {0x00213c, 0x00213d}, + {0x002146, 0x002149}, + {0x00214e, 0x00214e}, + {0x002170, 0x00217f}, + {0x002184, 0x002184}, + {0x0024d0, 0x0024e9}, + {0x002c30, 0x002c5f}, + {0x002c61, 0x002c61}, + {0x002c65, 0x002c66}, + {0x002c68, 0x002c68}, + {0x002c6a, 0x002c6a}, + {0x002c6c, 0x002c6c}, + {0x002c71, 0x002c71}, + {0x002c73, 0x002c74}, + {0x002c76, 0x002c7b}, + {0x002c7c, 0x002c7d}, + {0x002c81, 0x002c81}, + {0x002c83, 0x002c83}, + {0x002c85, 0x002c85}, + {0x002c87, 0x002c87}, + {0x002c89, 0x002c89}, + {0x002c8b, 0x002c8b}, + {0x002c8d, 0x002c8d}, + {0x002c8f, 0x002c8f}, + {0x002c91, 0x002c91}, + {0x002c93, 0x002c93}, + {0x002c95, 0x002c95}, + {0x002c97, 0x002c97}, + {0x002c99, 0x002c99}, + {0x002c9b, 0x002c9b}, + {0x002c9d, 0x002c9d}, + {0x002c9f, 0x002c9f}, + {0x002ca1, 0x002ca1}, + {0x002ca3, 0x002ca3}, + {0x002ca5, 0x002ca5}, + {0x002ca7, 0x002ca7}, + {0x002ca9, 0x002ca9}, + {0x002cab, 0x002cab}, + {0x002cad, 0x002cad}, + {0x002caf, 0x002caf}, + {0x002cb1, 0x002cb1}, + {0x002cb3, 0x002cb3}, + {0x002cb5, 0x002cb5}, + {0x002cb7, 0x002cb7}, + {0x002cb9, 0x002cb9}, + {0x002cbb, 0x002cbb}, + {0x002cbd, 0x002cbd}, + {0x002cbf, 0x002cbf}, + {0x002cc1, 0x002cc1}, + {0x002cc3, 0x002cc3}, + {0x002cc5, 0x002cc5}, + {0x002cc7, 0x002cc7}, + {0x002cc9, 0x002cc9}, + {0x002ccb, 0x002ccb}, + {0x002ccd, 0x002ccd}, + {0x002ccf, 0x002ccf}, + {0x002cd1, 0x002cd1}, + {0x002cd3, 0x002cd3}, + {0x002cd5, 0x002cd5}, + {0x002cd7, 0x002cd7}, + {0x002cd9, 0x002cd9}, + {0x002cdb, 0x002cdb}, + {0x002cdd, 0x002cdd}, + {0x002cdf, 0x002cdf}, + {0x002ce1, 0x002ce1}, + {0x002ce3, 0x002ce4}, + {0x002cec, 0x002cec}, + {0x002cee, 0x002cee}, + {0x002cf3, 0x002cf3}, + {0x002d00, 0x002d25}, + {0x002d27, 0x002d27}, + {0x002d2d, 0x002d2d}, + {0x00a641, 0x00a641}, + {0x00a643, 0x00a643}, + {0x00a645, 0x00a645}, + {0x00a647, 0x00a647}, + {0x00a649, 0x00a649}, + {0x00a64b, 0x00a64b}, + {0x00a64d, 0x00a64d}, + {0x00a64f, 0x00a64f}, + {0x00a651, 0x00a651}, + {0x00a653, 0x00a653}, + {0x00a655, 0x00a655}, + {0x00a657, 0x00a657}, + {0x00a659, 0x00a659}, + {0x00a65b, 0x00a65b}, + {0x00a65d, 0x00a65d}, + {0x00a65f, 0x00a65f}, + {0x00a661, 0x00a661}, + {0x00a663, 0x00a663}, + {0x00a665, 0x00a665}, + {0x00a667, 0x00a667}, + {0x00a669, 0x00a669}, + {0x00a66b, 0x00a66b}, + {0x00a66d, 0x00a66d}, + {0x00a681, 0x00a681}, + {0x00a683, 0x00a683}, + {0x00a685, 0x00a685}, + {0x00a687, 0x00a687}, + {0x00a689, 0x00a689}, + {0x00a68b, 0x00a68b}, + {0x00a68d, 0x00a68d}, + {0x00a68f, 0x00a68f}, + {0x00a691, 0x00a691}, + {0x00a693, 0x00a693}, + {0x00a695, 0x00a695}, + {0x00a697, 0x00a697}, + {0x00a699, 0x00a699}, + {0x00a69b, 0x00a69b}, + {0x00a69c, 0x00a69d}, + {0x00a723, 0x00a723}, + {0x00a725, 0x00a725}, + {0x00a727, 0x00a727}, + {0x00a729, 0x00a729}, + {0x00a72b, 0x00a72b}, + {0x00a72d, 0x00a72d}, + {0x00a72f, 0x00a731}, + {0x00a733, 0x00a733}, + {0x00a735, 0x00a735}, + {0x00a737, 0x00a737}, + {0x00a739, 0x00a739}, + {0x00a73b, 0x00a73b}, + {0x00a73d, 0x00a73d}, + {0x00a73f, 0x00a73f}, + {0x00a741, 0x00a741}, + {0x00a743, 0x00a743}, + {0x00a745, 0x00a745}, + {0x00a747, 0x00a747}, + {0x00a749, 0x00a749}, + {0x00a74b, 0x00a74b}, + {0x00a74d, 0x00a74d}, + {0x00a74f, 0x00a74f}, + {0x00a751, 0x00a751}, + {0x00a753, 0x00a753}, + {0x00a755, 0x00a755}, + {0x00a757, 0x00a757}, + {0x00a759, 0x00a759}, + {0x00a75b, 0x00a75b}, + {0x00a75d, 0x00a75d}, + {0x00a75f, 0x00a75f}, + {0x00a761, 0x00a761}, + {0x00a763, 0x00a763}, + {0x00a765, 0x00a765}, + {0x00a767, 0x00a767}, + {0x00a769, 0x00a769}, + {0x00a76b, 0x00a76b}, + {0x00a76d, 0x00a76d}, + {0x00a76f, 0x00a76f}, + {0x00a770, 0x00a770}, + {0x00a771, 0x00a778}, + {0x00a77a, 0x00a77a}, + {0x00a77c, 0x00a77c}, + {0x00a77f, 0x00a77f}, + {0x00a781, 0x00a781}, + {0x00a783, 0x00a783}, + {0x00a785, 0x00a785}, + {0x00a787, 0x00a787}, + {0x00a78c, 0x00a78c}, + {0x00a78e, 0x00a78e}, + {0x00a791, 0x00a791}, + {0x00a793, 0x00a795}, + {0x00a797, 0x00a797}, + {0x00a799, 0x00a799}, + {0x00a79b, 0x00a79b}, + {0x00a79d, 0x00a79d}, + {0x00a79f, 0x00a79f}, + {0x00a7a1, 0x00a7a1}, + {0x00a7a3, 0x00a7a3}, + {0x00a7a5, 0x00a7a5}, + {0x00a7a7, 0x00a7a7}, + {0x00a7a9, 0x00a7a9}, + {0x00a7af, 0x00a7af}, + {0x00a7b5, 0x00a7b5}, + {0x00a7b7, 0x00a7b7}, + {0x00a7b9, 0x00a7b9}, + {0x00a7bb, 0x00a7bb}, + {0x00a7bd, 0x00a7bd}, + {0x00a7bf, 0x00a7bf}, + {0x00a7c1, 0x00a7c1}, + {0x00a7c3, 0x00a7c3}, + {0x00a7c8, 0x00a7c8}, + {0x00a7ca, 0x00a7ca}, + {0x00a7cd, 0x00a7cd}, + {0x00a7d1, 0x00a7d1}, + {0x00a7d3, 0x00a7d3}, + {0x00a7d5, 0x00a7d5}, + {0x00a7d7, 0x00a7d7}, + {0x00a7d9, 0x00a7d9}, + {0x00a7db, 0x00a7db}, + {0x00a7f2, 0x00a7f4}, + {0x00a7f6, 0x00a7f6}, + {0x00a7f8, 0x00a7f9}, + {0x00a7fa, 0x00a7fa}, + {0x00ab30, 0x00ab5a}, + {0x00ab5c, 0x00ab5f}, + {0x00ab60, 0x00ab68}, + {0x00ab69, 0x00ab69}, + {0x00ab70, 0x00abbf}, + {0x00fb00, 0x00fb06}, + {0x00fb13, 0x00fb17}, + {0x00ff41, 0x00ff5a}, + {0x010428, 0x01044f}, + {0x0104d8, 0x0104fb}, + {0x010597, 0x0105a1}, + {0x0105a3, 0x0105b1}, + {0x0105b3, 0x0105b9}, + {0x0105bb, 0x0105bc}, + {0x010780, 0x010780}, + {0x010783, 0x010785}, + {0x010787, 0x0107b0}, + {0x0107b2, 0x0107ba}, + {0x010cc0, 0x010cf2}, + {0x010d70, 0x010d85}, + {0x0118c0, 0x0118df}, + {0x016e60, 0x016e7f}, + {0x01d41a, 0x01d433}, + {0x01d44e, 0x01d454}, + {0x01d456, 0x01d467}, + {0x01d482, 0x01d49b}, + {0x01d4b6, 0x01d4b9}, + {0x01d4bb, 0x01d4bb}, + {0x01d4bd, 0x01d4c3}, + {0x01d4c5, 0x01d4cf}, + {0x01d4ea, 0x01d503}, + {0x01d51e, 0x01d537}, + {0x01d552, 0x01d56b}, + {0x01d586, 0x01d59f}, + {0x01d5ba, 0x01d5d3}, + {0x01d5ee, 0x01d607}, + {0x01d622, 0x01d63b}, + {0x01d656, 0x01d66f}, + {0x01d68a, 0x01d6a5}, + {0x01d6c2, 0x01d6da}, + {0x01d6dc, 0x01d6e1}, + {0x01d6fc, 0x01d714}, + {0x01d716, 0x01d71b}, + {0x01d736, 0x01d74e}, + {0x01d750, 0x01d755}, + {0x01d770, 0x01d788}, + {0x01d78a, 0x01d78f}, + {0x01d7aa, 0x01d7c2}, + {0x01d7c4, 0x01d7c9}, + {0x01d7cb, 0x01d7cb}, + {0x01df00, 0x01df09}, + {0x01df0b, 0x01df1e}, + {0x01df25, 0x01df2a}, + {0x01e030, 0x01e06d}, + {0x01e922, 0x01e943}, +}; + +/* table of Unicode codepoint ranges of Uppercase characters */ +static const pg_unicode_range unicode_uppercase[656] = +{ + {0x000041, 0x00005a}, + {0x0000c0, 0x0000d6}, + {0x0000d8, 0x0000de}, + {0x000100, 0x000100}, + {0x000102, 0x000102}, + {0x000104, 0x000104}, + {0x000106, 0x000106}, + {0x000108, 0x000108}, + {0x00010a, 0x00010a}, + {0x00010c, 0x00010c}, + {0x00010e, 0x00010e}, + {0x000110, 0x000110}, + {0x000112, 0x000112}, + {0x000114, 0x000114}, + {0x000116, 0x000116}, + {0x000118, 0x000118}, + {0x00011a, 0x00011a}, + {0x00011c, 0x00011c}, + {0x00011e, 0x00011e}, + {0x000120, 0x000120}, + {0x000122, 0x000122}, + {0x000124, 0x000124}, + {0x000126, 0x000126}, + {0x000128, 0x000128}, + {0x00012a, 0x00012a}, + {0x00012c, 0x00012c}, + {0x00012e, 0x00012e}, + {0x000130, 0x000130}, + {0x000132, 0x000132}, + {0x000134, 0x000134}, + {0x000136, 0x000136}, + {0x000139, 0x000139}, + {0x00013b, 0x00013b}, + {0x00013d, 0x00013d}, + {0x00013f, 0x00013f}, + {0x000141, 0x000141}, + {0x000143, 0x000143}, + {0x000145, 0x000145}, + {0x000147, 0x000147}, + {0x00014a, 0x00014a}, + {0x00014c, 0x00014c}, + {0x00014e, 0x00014e}, + {0x000150, 0x000150}, + {0x000152, 0x000152}, + {0x000154, 0x000154}, + {0x000156, 0x000156}, + {0x000158, 0x000158}, + {0x00015a, 0x00015a}, + {0x00015c, 0x00015c}, + {0x00015e, 0x00015e}, + {0x000160, 0x000160}, + {0x000162, 0x000162}, + {0x000164, 0x000164}, + {0x000166, 0x000166}, + {0x000168, 0x000168}, + {0x00016a, 0x00016a}, + {0x00016c, 0x00016c}, + {0x00016e, 0x00016e}, + {0x000170, 0x000170}, + {0x000172, 0x000172}, + {0x000174, 0x000174}, + {0x000176, 0x000176}, + {0x000178, 0x000179}, + {0x00017b, 0x00017b}, + {0x00017d, 0x00017d}, + {0x000181, 0x000182}, + {0x000184, 0x000184}, + {0x000186, 0x000187}, + {0x000189, 0x00018b}, + {0x00018e, 0x000191}, + {0x000193, 0x000194}, + {0x000196, 0x000198}, + {0x00019c, 0x00019d}, + {0x00019f, 0x0001a0}, + {0x0001a2, 0x0001a2}, + {0x0001a4, 0x0001a4}, + {0x0001a6, 0x0001a7}, + {0x0001a9, 0x0001a9}, + {0x0001ac, 0x0001ac}, + {0x0001ae, 0x0001af}, + {0x0001b1, 0x0001b3}, + {0x0001b5, 0x0001b5}, + {0x0001b7, 0x0001b8}, + {0x0001bc, 0x0001bc}, + {0x0001c4, 0x0001c4}, + {0x0001c7, 0x0001c7}, + {0x0001ca, 0x0001ca}, + {0x0001cd, 0x0001cd}, + {0x0001cf, 0x0001cf}, + {0x0001d1, 0x0001d1}, + {0x0001d3, 0x0001d3}, + {0x0001d5, 0x0001d5}, + {0x0001d7, 0x0001d7}, + {0x0001d9, 0x0001d9}, + {0x0001db, 0x0001db}, + {0x0001de, 0x0001de}, + {0x0001e0, 0x0001e0}, + {0x0001e2, 0x0001e2}, + {0x0001e4, 0x0001e4}, + {0x0001e6, 0x0001e6}, + {0x0001e8, 0x0001e8}, + {0x0001ea, 0x0001ea}, + {0x0001ec, 0x0001ec}, + {0x0001ee, 0x0001ee}, + {0x0001f1, 0x0001f1}, + {0x0001f4, 0x0001f4}, + {0x0001f6, 0x0001f8}, + {0x0001fa, 0x0001fa}, + {0x0001fc, 0x0001fc}, + {0x0001fe, 0x0001fe}, + {0x000200, 0x000200}, + {0x000202, 0x000202}, + {0x000204, 0x000204}, + {0x000206, 0x000206}, + {0x000208, 0x000208}, + {0x00020a, 0x00020a}, + {0x00020c, 0x00020c}, + {0x00020e, 0x00020e}, + {0x000210, 0x000210}, + {0x000212, 0x000212}, + {0x000214, 0x000214}, + {0x000216, 0x000216}, + {0x000218, 0x000218}, + {0x00021a, 0x00021a}, + {0x00021c, 0x00021c}, + {0x00021e, 0x00021e}, + {0x000220, 0x000220}, + {0x000222, 0x000222}, + {0x000224, 0x000224}, + {0x000226, 0x000226}, + {0x000228, 0x000228}, + {0x00022a, 0x00022a}, + {0x00022c, 0x00022c}, + {0x00022e, 0x00022e}, + {0x000230, 0x000230}, + {0x000232, 0x000232}, + {0x00023a, 0x00023b}, + {0x00023d, 0x00023e}, + {0x000241, 0x000241}, + {0x000243, 0x000246}, + {0x000248, 0x000248}, + {0x00024a, 0x00024a}, + {0x00024c, 0x00024c}, + {0x00024e, 0x00024e}, + {0x000370, 0x000370}, + {0x000372, 0x000372}, + {0x000376, 0x000376}, + {0x00037f, 0x00037f}, + {0x000386, 0x000386}, + {0x000388, 0x00038a}, + {0x00038c, 0x00038c}, + {0x00038e, 0x00038f}, + {0x000391, 0x0003a1}, + {0x0003a3, 0x0003ab}, + {0x0003cf, 0x0003cf}, + {0x0003d2, 0x0003d4}, + {0x0003d8, 0x0003d8}, + {0x0003da, 0x0003da}, + {0x0003dc, 0x0003dc}, + {0x0003de, 0x0003de}, + {0x0003e0, 0x0003e0}, + {0x0003e2, 0x0003e2}, + {0x0003e4, 0x0003e4}, + {0x0003e6, 0x0003e6}, + {0x0003e8, 0x0003e8}, + {0x0003ea, 0x0003ea}, + {0x0003ec, 0x0003ec}, + {0x0003ee, 0x0003ee}, + {0x0003f4, 0x0003f4}, + {0x0003f7, 0x0003f7}, + {0x0003f9, 0x0003fa}, + {0x0003fd, 0x00042f}, + {0x000460, 0x000460}, + {0x000462, 0x000462}, + {0x000464, 0x000464}, + {0x000466, 0x000466}, + {0x000468, 0x000468}, + {0x00046a, 0x00046a}, + {0x00046c, 0x00046c}, + {0x00046e, 0x00046e}, + {0x000470, 0x000470}, + {0x000472, 0x000472}, + {0x000474, 0x000474}, + {0x000476, 0x000476}, + {0x000478, 0x000478}, + {0x00047a, 0x00047a}, + {0x00047c, 0x00047c}, + {0x00047e, 0x00047e}, + {0x000480, 0x000480}, + {0x00048a, 0x00048a}, + {0x00048c, 0x00048c}, + {0x00048e, 0x00048e}, + {0x000490, 0x000490}, + {0x000492, 0x000492}, + {0x000494, 0x000494}, + {0x000496, 0x000496}, + {0x000498, 0x000498}, + {0x00049a, 0x00049a}, + {0x00049c, 0x00049c}, + {0x00049e, 0x00049e}, + {0x0004a0, 0x0004a0}, + {0x0004a2, 0x0004a2}, + {0x0004a4, 0x0004a4}, + {0x0004a6, 0x0004a6}, + {0x0004a8, 0x0004a8}, + {0x0004aa, 0x0004aa}, + {0x0004ac, 0x0004ac}, + {0x0004ae, 0x0004ae}, + {0x0004b0, 0x0004b0}, + {0x0004b2, 0x0004b2}, + {0x0004b4, 0x0004b4}, + {0x0004b6, 0x0004b6}, + {0x0004b8, 0x0004b8}, + {0x0004ba, 0x0004ba}, + {0x0004bc, 0x0004bc}, + {0x0004be, 0x0004be}, + {0x0004c0, 0x0004c1}, + {0x0004c3, 0x0004c3}, + {0x0004c5, 0x0004c5}, + {0x0004c7, 0x0004c7}, + {0x0004c9, 0x0004c9}, + {0x0004cb, 0x0004cb}, + {0x0004cd, 0x0004cd}, + {0x0004d0, 0x0004d0}, + {0x0004d2, 0x0004d2}, + {0x0004d4, 0x0004d4}, + {0x0004d6, 0x0004d6}, + {0x0004d8, 0x0004d8}, + {0x0004da, 0x0004da}, + {0x0004dc, 0x0004dc}, + {0x0004de, 0x0004de}, + {0x0004e0, 0x0004e0}, + {0x0004e2, 0x0004e2}, + {0x0004e4, 0x0004e4}, + {0x0004e6, 0x0004e6}, + {0x0004e8, 0x0004e8}, + {0x0004ea, 0x0004ea}, + {0x0004ec, 0x0004ec}, + {0x0004ee, 0x0004ee}, + {0x0004f0, 0x0004f0}, + {0x0004f2, 0x0004f2}, + {0x0004f4, 0x0004f4}, + {0x0004f6, 0x0004f6}, + {0x0004f8, 0x0004f8}, + {0x0004fa, 0x0004fa}, + {0x0004fc, 0x0004fc}, + {0x0004fe, 0x0004fe}, + {0x000500, 0x000500}, + {0x000502, 0x000502}, + {0x000504, 0x000504}, + {0x000506, 0x000506}, + {0x000508, 0x000508}, + {0x00050a, 0x00050a}, + {0x00050c, 0x00050c}, + {0x00050e, 0x00050e}, + {0x000510, 0x000510}, + {0x000512, 0x000512}, + {0x000514, 0x000514}, + {0x000516, 0x000516}, + {0x000518, 0x000518}, + {0x00051a, 0x00051a}, + {0x00051c, 0x00051c}, + {0x00051e, 0x00051e}, + {0x000520, 0x000520}, + {0x000522, 0x000522}, + {0x000524, 0x000524}, + {0x000526, 0x000526}, + {0x000528, 0x000528}, + {0x00052a, 0x00052a}, + {0x00052c, 0x00052c}, + {0x00052e, 0x00052e}, + {0x000531, 0x000556}, + {0x0010a0, 0x0010c5}, + {0x0010c7, 0x0010c7}, + {0x0010cd, 0x0010cd}, + {0x0013a0, 0x0013f5}, + {0x001c89, 0x001c89}, + {0x001c90, 0x001cba}, + {0x001cbd, 0x001cbf}, + {0x001e00, 0x001e00}, + {0x001e02, 0x001e02}, + {0x001e04, 0x001e04}, + {0x001e06, 0x001e06}, + {0x001e08, 0x001e08}, + {0x001e0a, 0x001e0a}, + {0x001e0c, 0x001e0c}, + {0x001e0e, 0x001e0e}, + {0x001e10, 0x001e10}, + {0x001e12, 0x001e12}, + {0x001e14, 0x001e14}, + {0x001e16, 0x001e16}, + {0x001e18, 0x001e18}, + {0x001e1a, 0x001e1a}, + {0x001e1c, 0x001e1c}, + {0x001e1e, 0x001e1e}, + {0x001e20, 0x001e20}, + {0x001e22, 0x001e22}, + {0x001e24, 0x001e24}, + {0x001e26, 0x001e26}, + {0x001e28, 0x001e28}, + {0x001e2a, 0x001e2a}, + {0x001e2c, 0x001e2c}, + {0x001e2e, 0x001e2e}, + {0x001e30, 0x001e30}, + {0x001e32, 0x001e32}, + {0x001e34, 0x001e34}, + {0x001e36, 0x001e36}, + {0x001e38, 0x001e38}, + {0x001e3a, 0x001e3a}, + {0x001e3c, 0x001e3c}, + {0x001e3e, 0x001e3e}, + {0x001e40, 0x001e40}, + {0x001e42, 0x001e42}, + {0x001e44, 0x001e44}, + {0x001e46, 0x001e46}, + {0x001e48, 0x001e48}, + {0x001e4a, 0x001e4a}, + {0x001e4c, 0x001e4c}, + {0x001e4e, 0x001e4e}, + {0x001e50, 0x001e50}, + {0x001e52, 0x001e52}, + {0x001e54, 0x001e54}, + {0x001e56, 0x001e56}, + {0x001e58, 0x001e58}, + {0x001e5a, 0x001e5a}, + {0x001e5c, 0x001e5c}, + {0x001e5e, 0x001e5e}, + {0x001e60, 0x001e60}, + {0x001e62, 0x001e62}, + {0x001e64, 0x001e64}, + {0x001e66, 0x001e66}, + {0x001e68, 0x001e68}, + {0x001e6a, 0x001e6a}, + {0x001e6c, 0x001e6c}, + {0x001e6e, 0x001e6e}, + {0x001e70, 0x001e70}, + {0x001e72, 0x001e72}, + {0x001e74, 0x001e74}, + {0x001e76, 0x001e76}, + {0x001e78, 0x001e78}, + {0x001e7a, 0x001e7a}, + {0x001e7c, 0x001e7c}, + {0x001e7e, 0x001e7e}, + {0x001e80, 0x001e80}, + {0x001e82, 0x001e82}, + {0x001e84, 0x001e84}, + {0x001e86, 0x001e86}, + {0x001e88, 0x001e88}, + {0x001e8a, 0x001e8a}, + {0x001e8c, 0x001e8c}, + {0x001e8e, 0x001e8e}, + {0x001e90, 0x001e90}, + {0x001e92, 0x001e92}, + {0x001e94, 0x001e94}, + {0x001e9e, 0x001e9e}, + {0x001ea0, 0x001ea0}, + {0x001ea2, 0x001ea2}, + {0x001ea4, 0x001ea4}, + {0x001ea6, 0x001ea6}, + {0x001ea8, 0x001ea8}, + {0x001eaa, 0x001eaa}, + {0x001eac, 0x001eac}, + {0x001eae, 0x001eae}, + {0x001eb0, 0x001eb0}, + {0x001eb2, 0x001eb2}, + {0x001eb4, 0x001eb4}, + {0x001eb6, 0x001eb6}, + {0x001eb8, 0x001eb8}, + {0x001eba, 0x001eba}, + {0x001ebc, 0x001ebc}, + {0x001ebe, 0x001ebe}, + {0x001ec0, 0x001ec0}, + {0x001ec2, 0x001ec2}, + {0x001ec4, 0x001ec4}, + {0x001ec6, 0x001ec6}, + {0x001ec8, 0x001ec8}, + {0x001eca, 0x001eca}, + {0x001ecc, 0x001ecc}, + {0x001ece, 0x001ece}, + {0x001ed0, 0x001ed0}, + {0x001ed2, 0x001ed2}, + {0x001ed4, 0x001ed4}, + {0x001ed6, 0x001ed6}, + {0x001ed8, 0x001ed8}, + {0x001eda, 0x001eda}, + {0x001edc, 0x001edc}, + {0x001ede, 0x001ede}, + {0x001ee0, 0x001ee0}, + {0x001ee2, 0x001ee2}, + {0x001ee4, 0x001ee4}, + {0x001ee6, 0x001ee6}, + {0x001ee8, 0x001ee8}, + {0x001eea, 0x001eea}, + {0x001eec, 0x001eec}, + {0x001eee, 0x001eee}, + {0x001ef0, 0x001ef0}, + {0x001ef2, 0x001ef2}, + {0x001ef4, 0x001ef4}, + {0x001ef6, 0x001ef6}, + {0x001ef8, 0x001ef8}, + {0x001efa, 0x001efa}, + {0x001efc, 0x001efc}, + {0x001efe, 0x001efe}, + {0x001f08, 0x001f0f}, + {0x001f18, 0x001f1d}, + {0x001f28, 0x001f2f}, + {0x001f38, 0x001f3f}, + {0x001f48, 0x001f4d}, + {0x001f59, 0x001f59}, + {0x001f5b, 0x001f5b}, + {0x001f5d, 0x001f5d}, + {0x001f5f, 0x001f5f}, + {0x001f68, 0x001f6f}, + {0x001fb8, 0x001fbb}, + {0x001fc8, 0x001fcb}, + {0x001fd8, 0x001fdb}, + {0x001fe8, 0x001fec}, + {0x001ff8, 0x001ffb}, + {0x002102, 0x002102}, + {0x002107, 0x002107}, + {0x00210b, 0x00210d}, + {0x002110, 0x002112}, + {0x002115, 0x002115}, + {0x002119, 0x00211d}, + {0x002124, 0x002124}, + {0x002126, 0x002126}, + {0x002128, 0x002128}, + {0x00212a, 0x00212d}, + {0x002130, 0x002133}, + {0x00213e, 0x00213f}, + {0x002145, 0x002145}, + {0x002160, 0x00216f}, + {0x002183, 0x002183}, + {0x0024b6, 0x0024cf}, + {0x002c00, 0x002c2f}, + {0x002c60, 0x002c60}, + {0x002c62, 0x002c64}, + {0x002c67, 0x002c67}, + {0x002c69, 0x002c69}, + {0x002c6b, 0x002c6b}, + {0x002c6d, 0x002c70}, + {0x002c72, 0x002c72}, + {0x002c75, 0x002c75}, + {0x002c7e, 0x002c80}, + {0x002c82, 0x002c82}, + {0x002c84, 0x002c84}, + {0x002c86, 0x002c86}, + {0x002c88, 0x002c88}, + {0x002c8a, 0x002c8a}, + {0x002c8c, 0x002c8c}, + {0x002c8e, 0x002c8e}, + {0x002c90, 0x002c90}, + {0x002c92, 0x002c92}, + {0x002c94, 0x002c94}, + {0x002c96, 0x002c96}, + {0x002c98, 0x002c98}, + {0x002c9a, 0x002c9a}, + {0x002c9c, 0x002c9c}, + {0x002c9e, 0x002c9e}, + {0x002ca0, 0x002ca0}, + {0x002ca2, 0x002ca2}, + {0x002ca4, 0x002ca4}, + {0x002ca6, 0x002ca6}, + {0x002ca8, 0x002ca8}, + {0x002caa, 0x002caa}, + {0x002cac, 0x002cac}, + {0x002cae, 0x002cae}, + {0x002cb0, 0x002cb0}, + {0x002cb2, 0x002cb2}, + {0x002cb4, 0x002cb4}, + {0x002cb6, 0x002cb6}, + {0x002cb8, 0x002cb8}, + {0x002cba, 0x002cba}, + {0x002cbc, 0x002cbc}, + {0x002cbe, 0x002cbe}, + {0x002cc0, 0x002cc0}, + {0x002cc2, 0x002cc2}, + {0x002cc4, 0x002cc4}, + {0x002cc6, 0x002cc6}, + {0x002cc8, 0x002cc8}, + {0x002cca, 0x002cca}, + {0x002ccc, 0x002ccc}, + {0x002cce, 0x002cce}, + {0x002cd0, 0x002cd0}, + {0x002cd2, 0x002cd2}, + {0x002cd4, 0x002cd4}, + {0x002cd6, 0x002cd6}, + {0x002cd8, 0x002cd8}, + {0x002cda, 0x002cda}, + {0x002cdc, 0x002cdc}, + {0x002cde, 0x002cde}, + {0x002ce0, 0x002ce0}, + {0x002ce2, 0x002ce2}, + {0x002ceb, 0x002ceb}, + {0x002ced, 0x002ced}, + {0x002cf2, 0x002cf2}, + {0x00a640, 0x00a640}, + {0x00a642, 0x00a642}, + {0x00a644, 0x00a644}, + {0x00a646, 0x00a646}, + {0x00a648, 0x00a648}, + {0x00a64a, 0x00a64a}, + {0x00a64c, 0x00a64c}, + {0x00a64e, 0x00a64e}, + {0x00a650, 0x00a650}, + {0x00a652, 0x00a652}, + {0x00a654, 0x00a654}, + {0x00a656, 0x00a656}, + {0x00a658, 0x00a658}, + {0x00a65a, 0x00a65a}, + {0x00a65c, 0x00a65c}, + {0x00a65e, 0x00a65e}, + {0x00a660, 0x00a660}, + {0x00a662, 0x00a662}, + {0x00a664, 0x00a664}, + {0x00a666, 0x00a666}, + {0x00a668, 0x00a668}, + {0x00a66a, 0x00a66a}, + {0x00a66c, 0x00a66c}, + {0x00a680, 0x00a680}, + {0x00a682, 0x00a682}, + {0x00a684, 0x00a684}, + {0x00a686, 0x00a686}, + {0x00a688, 0x00a688}, + {0x00a68a, 0x00a68a}, + {0x00a68c, 0x00a68c}, + {0x00a68e, 0x00a68e}, + {0x00a690, 0x00a690}, + {0x00a692, 0x00a692}, + {0x00a694, 0x00a694}, + {0x00a696, 0x00a696}, + {0x00a698, 0x00a698}, + {0x00a69a, 0x00a69a}, + {0x00a722, 0x00a722}, + {0x00a724, 0x00a724}, + {0x00a726, 0x00a726}, + {0x00a728, 0x00a728}, + {0x00a72a, 0x00a72a}, + {0x00a72c, 0x00a72c}, + {0x00a72e, 0x00a72e}, + {0x00a732, 0x00a732}, + {0x00a734, 0x00a734}, + {0x00a736, 0x00a736}, + {0x00a738, 0x00a738}, + {0x00a73a, 0x00a73a}, + {0x00a73c, 0x00a73c}, + {0x00a73e, 0x00a73e}, + {0x00a740, 0x00a740}, + {0x00a742, 0x00a742}, + {0x00a744, 0x00a744}, + {0x00a746, 0x00a746}, + {0x00a748, 0x00a748}, + {0x00a74a, 0x00a74a}, + {0x00a74c, 0x00a74c}, + {0x00a74e, 0x00a74e}, + {0x00a750, 0x00a750}, + {0x00a752, 0x00a752}, + {0x00a754, 0x00a754}, + {0x00a756, 0x00a756}, + {0x00a758, 0x00a758}, + {0x00a75a, 0x00a75a}, + {0x00a75c, 0x00a75c}, + {0x00a75e, 0x00a75e}, + {0x00a760, 0x00a760}, + {0x00a762, 0x00a762}, + {0x00a764, 0x00a764}, + {0x00a766, 0x00a766}, + {0x00a768, 0x00a768}, + {0x00a76a, 0x00a76a}, + {0x00a76c, 0x00a76c}, + {0x00a76e, 0x00a76e}, + {0x00a779, 0x00a779}, + {0x00a77b, 0x00a77b}, + {0x00a77d, 0x00a77e}, + {0x00a780, 0x00a780}, + {0x00a782, 0x00a782}, + {0x00a784, 0x00a784}, + {0x00a786, 0x00a786}, + {0x00a78b, 0x00a78b}, + {0x00a78d, 0x00a78d}, + {0x00a790, 0x00a790}, + {0x00a792, 0x00a792}, + {0x00a796, 0x00a796}, + {0x00a798, 0x00a798}, + {0x00a79a, 0x00a79a}, + {0x00a79c, 0x00a79c}, + {0x00a79e, 0x00a79e}, + {0x00a7a0, 0x00a7a0}, + {0x00a7a2, 0x00a7a2}, + {0x00a7a4, 0x00a7a4}, + {0x00a7a6, 0x00a7a6}, + {0x00a7a8, 0x00a7a8}, + {0x00a7aa, 0x00a7ae}, + {0x00a7b0, 0x00a7b4}, + {0x00a7b6, 0x00a7b6}, + {0x00a7b8, 0x00a7b8}, + {0x00a7ba, 0x00a7ba}, + {0x00a7bc, 0x00a7bc}, + {0x00a7be, 0x00a7be}, + {0x00a7c0, 0x00a7c0}, + {0x00a7c2, 0x00a7c2}, + {0x00a7c4, 0x00a7c7}, + {0x00a7c9, 0x00a7c9}, + {0x00a7cb, 0x00a7cc}, + {0x00a7d0, 0x00a7d0}, + {0x00a7d6, 0x00a7d6}, + {0x00a7d8, 0x00a7d8}, + {0x00a7da, 0x00a7da}, + {0x00a7dc, 0x00a7dc}, + {0x00a7f5, 0x00a7f5}, + {0x00ff21, 0x00ff3a}, + {0x010400, 0x010427}, + {0x0104b0, 0x0104d3}, + {0x010570, 0x01057a}, + {0x01057c, 0x01058a}, + {0x01058c, 0x010592}, + {0x010594, 0x010595}, + {0x010c80, 0x010cb2}, + {0x010d50, 0x010d65}, + {0x0118a0, 0x0118bf}, + {0x016e40, 0x016e5f}, + {0x01d400, 0x01d419}, + {0x01d434, 0x01d44d}, + {0x01d468, 0x01d481}, + {0x01d49c, 0x01d49c}, + {0x01d49e, 0x01d49f}, + {0x01d4a2, 0x01d4a2}, + {0x01d4a5, 0x01d4a6}, + {0x01d4a9, 0x01d4ac}, + {0x01d4ae, 0x01d4b5}, + {0x01d4d0, 0x01d4e9}, + {0x01d504, 0x01d505}, + {0x01d507, 0x01d50a}, + {0x01d50d, 0x01d514}, + {0x01d516, 0x01d51c}, + {0x01d538, 0x01d539}, + {0x01d53b, 0x01d53e}, + {0x01d540, 0x01d544}, + {0x01d546, 0x01d546}, + {0x01d54a, 0x01d550}, + {0x01d56c, 0x01d585}, + {0x01d5a0, 0x01d5b9}, + {0x01d5d4, 0x01d5ed}, + {0x01d608, 0x01d621}, + {0x01d63c, 0x01d655}, + {0x01d670, 0x01d689}, + {0x01d6a8, 0x01d6c0}, + {0x01d6e2, 0x01d6fa}, + {0x01d71c, 0x01d734}, + {0x01d756, 0x01d76e}, + {0x01d790, 0x01d7a8}, + {0x01d7ca, 0x01d7ca}, + {0x01e900, 0x01e921}, + {0x01f130, 0x01f149}, + {0x01f150, 0x01f169}, + {0x01f170, 0x01f189}, +}; + +/* table of Unicode codepoint ranges of Case_Ignorable characters */ +static const pg_unicode_range unicode_case_ignorable[506] = +{ + {0x000027, 0x000027}, + {0x00002e, 0x00002e}, + {0x00003a, 0x00003a}, + {0x00005e, 0x00005e}, + {0x000060, 0x000060}, + {0x0000a8, 0x0000a8}, + {0x0000ad, 0x0000ad}, + {0x0000af, 0x0000af}, + {0x0000b4, 0x0000b4}, + {0x0000b7, 0x0000b7}, + {0x0000b8, 0x0000b8}, + {0x0002b0, 0x0002c1}, + {0x0002c2, 0x0002c5}, + {0x0002c6, 0x0002d1}, + {0x0002d2, 0x0002df}, + {0x0002e0, 0x0002e4}, + {0x0002e5, 0x0002eb}, + {0x0002ec, 0x0002ec}, + {0x0002ed, 0x0002ed}, + {0x0002ee, 0x0002ee}, + {0x0002ef, 0x0002ff}, + {0x000300, 0x00036f}, + {0x000374, 0x000374}, + {0x000375, 0x000375}, + {0x00037a, 0x00037a}, + {0x000384, 0x000385}, + {0x000387, 0x000387}, + {0x000483, 0x000487}, + {0x000488, 0x000489}, + {0x000559, 0x000559}, + {0x00055f, 0x00055f}, + {0x000591, 0x0005bd}, + {0x0005bf, 0x0005bf}, + {0x0005c1, 0x0005c2}, + {0x0005c4, 0x0005c5}, + {0x0005c7, 0x0005c7}, + {0x0005f4, 0x0005f4}, + {0x000600, 0x000605}, + {0x000610, 0x00061a}, + {0x00061c, 0x00061c}, + {0x000640, 0x000640}, + {0x00064b, 0x00065f}, + {0x000670, 0x000670}, + {0x0006d6, 0x0006dc}, + {0x0006dd, 0x0006dd}, + {0x0006df, 0x0006e4}, + {0x0006e5, 0x0006e6}, + {0x0006e7, 0x0006e8}, + {0x0006ea, 0x0006ed}, + {0x00070f, 0x00070f}, + {0x000711, 0x000711}, + {0x000730, 0x00074a}, + {0x0007a6, 0x0007b0}, + {0x0007eb, 0x0007f3}, + {0x0007f4, 0x0007f5}, + {0x0007fa, 0x0007fa}, + {0x0007fd, 0x0007fd}, + {0x000816, 0x000819}, + {0x00081a, 0x00081a}, + {0x00081b, 0x000823}, + {0x000824, 0x000824}, + {0x000825, 0x000827}, + {0x000828, 0x000828}, + {0x000829, 0x00082d}, + {0x000859, 0x00085b}, + {0x000888, 0x000888}, + {0x000890, 0x000891}, + {0x000897, 0x00089f}, + {0x0008c9, 0x0008c9}, + {0x0008ca, 0x0008e1}, + {0x0008e2, 0x0008e2}, + {0x0008e3, 0x000902}, + {0x00093a, 0x00093a}, + {0x00093c, 0x00093c}, + {0x000941, 0x000948}, + {0x00094d, 0x00094d}, + {0x000951, 0x000957}, + {0x000962, 0x000963}, + {0x000971, 0x000971}, + {0x000981, 0x000981}, + {0x0009bc, 0x0009bc}, + {0x0009c1, 0x0009c4}, + {0x0009cd, 0x0009cd}, + {0x0009e2, 0x0009e3}, + {0x0009fe, 0x0009fe}, + {0x000a01, 0x000a02}, + {0x000a3c, 0x000a3c}, + {0x000a41, 0x000a42}, + {0x000a47, 0x000a48}, + {0x000a4b, 0x000a4d}, + {0x000a51, 0x000a51}, + {0x000a70, 0x000a71}, + {0x000a75, 0x000a75}, + {0x000a81, 0x000a82}, + {0x000abc, 0x000abc}, + {0x000ac1, 0x000ac5}, + {0x000ac7, 0x000ac8}, + {0x000acd, 0x000acd}, + {0x000ae2, 0x000ae3}, + {0x000afa, 0x000aff}, + {0x000b01, 0x000b01}, + {0x000b3c, 0x000b3c}, + {0x000b3f, 0x000b3f}, + {0x000b41, 0x000b44}, + {0x000b4d, 0x000b4d}, + {0x000b55, 0x000b56}, + {0x000b62, 0x000b63}, + {0x000b82, 0x000b82}, + {0x000bc0, 0x000bc0}, + {0x000bcd, 0x000bcd}, + {0x000c00, 0x000c00}, + {0x000c04, 0x000c04}, + {0x000c3c, 0x000c3c}, + {0x000c3e, 0x000c40}, + {0x000c46, 0x000c48}, + {0x000c4a, 0x000c4d}, + {0x000c55, 0x000c56}, + {0x000c62, 0x000c63}, + {0x000c81, 0x000c81}, + {0x000cbc, 0x000cbc}, + {0x000cbf, 0x000cbf}, + {0x000cc6, 0x000cc6}, + {0x000ccc, 0x000ccd}, + {0x000ce2, 0x000ce3}, + {0x000d00, 0x000d01}, + {0x000d3b, 0x000d3c}, + {0x000d41, 0x000d44}, + {0x000d4d, 0x000d4d}, + {0x000d62, 0x000d63}, + {0x000d81, 0x000d81}, + {0x000dca, 0x000dca}, + {0x000dd2, 0x000dd4}, + {0x000dd6, 0x000dd6}, + {0x000e31, 0x000e31}, + {0x000e34, 0x000e3a}, + {0x000e46, 0x000e46}, + {0x000e47, 0x000e4e}, + {0x000eb1, 0x000eb1}, + {0x000eb4, 0x000ebc}, + {0x000ec6, 0x000ec6}, + {0x000ec8, 0x000ece}, + {0x000f18, 0x000f19}, + {0x000f35, 0x000f35}, + {0x000f37, 0x000f37}, + {0x000f39, 0x000f39}, + {0x000f71, 0x000f7e}, + {0x000f80, 0x000f84}, + {0x000f86, 0x000f87}, + {0x000f8d, 0x000f97}, + {0x000f99, 0x000fbc}, + {0x000fc6, 0x000fc6}, + {0x00102d, 0x001030}, + {0x001032, 0x001037}, + {0x001039, 0x00103a}, + {0x00103d, 0x00103e}, + {0x001058, 0x001059}, + {0x00105e, 0x001060}, + {0x001071, 0x001074}, + {0x001082, 0x001082}, + {0x001085, 0x001086}, + {0x00108d, 0x00108d}, + {0x00109d, 0x00109d}, + {0x0010fc, 0x0010fc}, + {0x00135d, 0x00135f}, + {0x001712, 0x001714}, + {0x001732, 0x001733}, + {0x001752, 0x001753}, + {0x001772, 0x001773}, + {0x0017b4, 0x0017b5}, + {0x0017b7, 0x0017bd}, + {0x0017c6, 0x0017c6}, + {0x0017c9, 0x0017d3}, + {0x0017d7, 0x0017d7}, + {0x0017dd, 0x0017dd}, + {0x00180b, 0x00180d}, + {0x00180e, 0x00180e}, + {0x00180f, 0x00180f}, + {0x001843, 0x001843}, + {0x001885, 0x001886}, + {0x0018a9, 0x0018a9}, + {0x001920, 0x001922}, + {0x001927, 0x001928}, + {0x001932, 0x001932}, + {0x001939, 0x00193b}, + {0x001a17, 0x001a18}, + {0x001a1b, 0x001a1b}, + {0x001a56, 0x001a56}, + {0x001a58, 0x001a5e}, + {0x001a60, 0x001a60}, + {0x001a62, 0x001a62}, + {0x001a65, 0x001a6c}, + {0x001a73, 0x001a7c}, + {0x001a7f, 0x001a7f}, + {0x001aa7, 0x001aa7}, + {0x001ab0, 0x001abd}, + {0x001abe, 0x001abe}, + {0x001abf, 0x001ace}, + {0x001b00, 0x001b03}, + {0x001b34, 0x001b34}, + {0x001b36, 0x001b3a}, + {0x001b3c, 0x001b3c}, + {0x001b42, 0x001b42}, + {0x001b6b, 0x001b73}, + {0x001b80, 0x001b81}, + {0x001ba2, 0x001ba5}, + {0x001ba8, 0x001ba9}, + {0x001bab, 0x001bad}, + {0x001be6, 0x001be6}, + {0x001be8, 0x001be9}, + {0x001bed, 0x001bed}, + {0x001bef, 0x001bf1}, + {0x001c2c, 0x001c33}, + {0x001c36, 0x001c37}, + {0x001c78, 0x001c7d}, + {0x001cd0, 0x001cd2}, + {0x001cd4, 0x001ce0}, + {0x001ce2, 0x001ce8}, + {0x001ced, 0x001ced}, + {0x001cf4, 0x001cf4}, + {0x001cf8, 0x001cf9}, + {0x001d2c, 0x001d6a}, + {0x001d78, 0x001d78}, + {0x001d9b, 0x001dbf}, + {0x001dc0, 0x001dff}, + {0x001fbd, 0x001fbd}, + {0x001fbf, 0x001fc1}, + {0x001fcd, 0x001fcf}, + {0x001fdd, 0x001fdf}, + {0x001fed, 0x001fef}, + {0x001ffd, 0x001ffe}, + {0x00200b, 0x00200f}, + {0x002018, 0x002018}, + {0x002019, 0x002019}, + {0x002024, 0x002024}, + {0x002027, 0x002027}, + {0x00202a, 0x00202e}, + {0x002060, 0x002064}, + {0x002066, 0x00206f}, + {0x002071, 0x002071}, + {0x00207f, 0x00207f}, + {0x002090, 0x00209c}, + {0x0020d0, 0x0020dc}, + {0x0020dd, 0x0020e0}, + {0x0020e1, 0x0020e1}, + {0x0020e2, 0x0020e4}, + {0x0020e5, 0x0020f0}, + {0x002c7c, 0x002c7d}, + {0x002cef, 0x002cf1}, + {0x002d6f, 0x002d6f}, + {0x002d7f, 0x002d7f}, + {0x002de0, 0x002dff}, + {0x002e2f, 0x002e2f}, + {0x003005, 0x003005}, + {0x00302a, 0x00302d}, + {0x003031, 0x003035}, + {0x00303b, 0x00303b}, + {0x003099, 0x00309a}, + {0x00309b, 0x00309c}, + {0x00309d, 0x00309e}, + {0x0030fc, 0x0030fe}, + {0x00a015, 0x00a015}, + {0x00a4f8, 0x00a4fd}, + {0x00a60c, 0x00a60c}, + {0x00a66f, 0x00a66f}, + {0x00a670, 0x00a672}, + {0x00a674, 0x00a67d}, + {0x00a67f, 0x00a67f}, + {0x00a69c, 0x00a69d}, + {0x00a69e, 0x00a69f}, + {0x00a6f0, 0x00a6f1}, + {0x00a700, 0x00a716}, + {0x00a717, 0x00a71f}, + {0x00a720, 0x00a721}, + {0x00a770, 0x00a770}, + {0x00a788, 0x00a788}, + {0x00a789, 0x00a78a}, + {0x00a7f2, 0x00a7f4}, + {0x00a7f8, 0x00a7f9}, + {0x00a802, 0x00a802}, + {0x00a806, 0x00a806}, + {0x00a80b, 0x00a80b}, + {0x00a825, 0x00a826}, + {0x00a82c, 0x00a82c}, + {0x00a8c4, 0x00a8c5}, + {0x00a8e0, 0x00a8f1}, + {0x00a8ff, 0x00a8ff}, + {0x00a926, 0x00a92d}, + {0x00a947, 0x00a951}, + {0x00a980, 0x00a982}, + {0x00a9b3, 0x00a9b3}, + {0x00a9b6, 0x00a9b9}, + {0x00a9bc, 0x00a9bd}, + {0x00a9cf, 0x00a9cf}, + {0x00a9e5, 0x00a9e5}, + {0x00a9e6, 0x00a9e6}, + {0x00aa29, 0x00aa2e}, + {0x00aa31, 0x00aa32}, + {0x00aa35, 0x00aa36}, + {0x00aa43, 0x00aa43}, + {0x00aa4c, 0x00aa4c}, + {0x00aa70, 0x00aa70}, + {0x00aa7c, 0x00aa7c}, + {0x00aab0, 0x00aab0}, + {0x00aab2, 0x00aab4}, + {0x00aab7, 0x00aab8}, + {0x00aabe, 0x00aabf}, + {0x00aac1, 0x00aac1}, + {0x00aadd, 0x00aadd}, + {0x00aaec, 0x00aaed}, + {0x00aaf3, 0x00aaf4}, + {0x00aaf6, 0x00aaf6}, + {0x00ab5b, 0x00ab5b}, + {0x00ab5c, 0x00ab5f}, + {0x00ab69, 0x00ab69}, + {0x00ab6a, 0x00ab6b}, + {0x00abe5, 0x00abe5}, + {0x00abe8, 0x00abe8}, + {0x00abed, 0x00abed}, + {0x00fb1e, 0x00fb1e}, + {0x00fbb2, 0x00fbc2}, + {0x00fe00, 0x00fe0f}, + {0x00fe13, 0x00fe13}, + {0x00fe20, 0x00fe2f}, + {0x00fe52, 0x00fe52}, + {0x00fe55, 0x00fe55}, + {0x00feff, 0x00feff}, + {0x00ff07, 0x00ff07}, + {0x00ff0e, 0x00ff0e}, + {0x00ff1a, 0x00ff1a}, + {0x00ff3e, 0x00ff3e}, + {0x00ff40, 0x00ff40}, + {0x00ff70, 0x00ff70}, + {0x00ff9e, 0x00ff9f}, + {0x00ffe3, 0x00ffe3}, + {0x00fff9, 0x00fffb}, + {0x0101fd, 0x0101fd}, + {0x0102e0, 0x0102e0}, + {0x010376, 0x01037a}, + {0x010780, 0x010785}, + {0x010787, 0x0107b0}, + {0x0107b2, 0x0107ba}, + {0x010a01, 0x010a03}, + {0x010a05, 0x010a06}, + {0x010a0c, 0x010a0f}, + {0x010a38, 0x010a3a}, + {0x010a3f, 0x010a3f}, + {0x010ae5, 0x010ae6}, + {0x010d24, 0x010d27}, + {0x010d4e, 0x010d4e}, + {0x010d69, 0x010d6d}, + {0x010d6f, 0x010d6f}, + {0x010eab, 0x010eac}, + {0x010efc, 0x010eff}, + {0x010f46, 0x010f50}, + {0x010f82, 0x010f85}, + {0x011001, 0x011001}, + {0x011038, 0x011046}, + {0x011070, 0x011070}, + {0x011073, 0x011074}, + {0x01107f, 0x011081}, + {0x0110b3, 0x0110b6}, + {0x0110b9, 0x0110ba}, + {0x0110bd, 0x0110bd}, + {0x0110c2, 0x0110c2}, + {0x0110cd, 0x0110cd}, + {0x011100, 0x011102}, + {0x011127, 0x01112b}, + {0x01112d, 0x011134}, + {0x011173, 0x011173}, + {0x011180, 0x011181}, + {0x0111b6, 0x0111be}, + {0x0111c9, 0x0111cc}, + {0x0111cf, 0x0111cf}, + {0x01122f, 0x011231}, + {0x011234, 0x011234}, + {0x011236, 0x011237}, + {0x01123e, 0x01123e}, + {0x011241, 0x011241}, + {0x0112df, 0x0112df}, + {0x0112e3, 0x0112ea}, + {0x011300, 0x011301}, + {0x01133b, 0x01133c}, + {0x011340, 0x011340}, + {0x011366, 0x01136c}, + {0x011370, 0x011374}, + {0x0113bb, 0x0113c0}, + {0x0113ce, 0x0113ce}, + {0x0113d0, 0x0113d0}, + {0x0113d2, 0x0113d2}, + {0x0113e1, 0x0113e2}, + {0x011438, 0x01143f}, + {0x011442, 0x011444}, + {0x011446, 0x011446}, + {0x01145e, 0x01145e}, + {0x0114b3, 0x0114b8}, + {0x0114ba, 0x0114ba}, + {0x0114bf, 0x0114c0}, + {0x0114c2, 0x0114c3}, + {0x0115b2, 0x0115b5}, + {0x0115bc, 0x0115bd}, + {0x0115bf, 0x0115c0}, + {0x0115dc, 0x0115dd}, + {0x011633, 0x01163a}, + {0x01163d, 0x01163d}, + {0x01163f, 0x011640}, + {0x0116ab, 0x0116ab}, + {0x0116ad, 0x0116ad}, + {0x0116b0, 0x0116b5}, + {0x0116b7, 0x0116b7}, + {0x01171d, 0x01171d}, + {0x01171f, 0x01171f}, + {0x011722, 0x011725}, + {0x011727, 0x01172b}, + {0x01182f, 0x011837}, + {0x011839, 0x01183a}, + {0x01193b, 0x01193c}, + {0x01193e, 0x01193e}, + {0x011943, 0x011943}, + {0x0119d4, 0x0119d7}, + {0x0119da, 0x0119db}, + {0x0119e0, 0x0119e0}, + {0x011a01, 0x011a0a}, + {0x011a33, 0x011a38}, + {0x011a3b, 0x011a3e}, + {0x011a47, 0x011a47}, + {0x011a51, 0x011a56}, + {0x011a59, 0x011a5b}, + {0x011a8a, 0x011a96}, + {0x011a98, 0x011a99}, + {0x011c30, 0x011c36}, + {0x011c38, 0x011c3d}, + {0x011c3f, 0x011c3f}, + {0x011c92, 0x011ca7}, + {0x011caa, 0x011cb0}, + {0x011cb2, 0x011cb3}, + {0x011cb5, 0x011cb6}, + {0x011d31, 0x011d36}, + {0x011d3a, 0x011d3a}, + {0x011d3c, 0x011d3d}, + {0x011d3f, 0x011d45}, + {0x011d47, 0x011d47}, + {0x011d90, 0x011d91}, + {0x011d95, 0x011d95}, + {0x011d97, 0x011d97}, + {0x011ef3, 0x011ef4}, + {0x011f00, 0x011f01}, + {0x011f36, 0x011f3a}, + {0x011f40, 0x011f40}, + {0x011f42, 0x011f42}, + {0x011f5a, 0x011f5a}, + {0x013430, 0x01343f}, + {0x013440, 0x013440}, + {0x013447, 0x013455}, + {0x01611e, 0x016129}, + {0x01612d, 0x01612f}, + {0x016af0, 0x016af4}, + {0x016b30, 0x016b36}, + {0x016b40, 0x016b43}, + {0x016d40, 0x016d42}, + {0x016d6b, 0x016d6c}, + {0x016f4f, 0x016f4f}, + {0x016f8f, 0x016f92}, + {0x016f93, 0x016f9f}, + {0x016fe0, 0x016fe1}, + {0x016fe3, 0x016fe3}, + {0x016fe4, 0x016fe4}, + {0x01aff0, 0x01aff3}, + {0x01aff5, 0x01affb}, + {0x01affd, 0x01affe}, + {0x01bc9d, 0x01bc9e}, + {0x01bca0, 0x01bca3}, + {0x01cf00, 0x01cf2d}, + {0x01cf30, 0x01cf46}, + {0x01d167, 0x01d169}, + {0x01d173, 0x01d17a}, + {0x01d17b, 0x01d182}, + {0x01d185, 0x01d18b}, + {0x01d1aa, 0x01d1ad}, + {0x01d242, 0x01d244}, + {0x01da00, 0x01da36}, + {0x01da3b, 0x01da6c}, + {0x01da75, 0x01da75}, + {0x01da84, 0x01da84}, + {0x01da9b, 0x01da9f}, + {0x01daa1, 0x01daaf}, + {0x01e000, 0x01e006}, + {0x01e008, 0x01e018}, + {0x01e01b, 0x01e021}, + {0x01e023, 0x01e024}, + {0x01e026, 0x01e02a}, + {0x01e030, 0x01e06d}, + {0x01e08f, 0x01e08f}, + {0x01e130, 0x01e136}, + {0x01e137, 0x01e13d}, + {0x01e2ae, 0x01e2ae}, + {0x01e2ec, 0x01e2ef}, + {0x01e4eb, 0x01e4eb}, + {0x01e4ec, 0x01e4ef}, + {0x01e5ee, 0x01e5ef}, + {0x01e8d0, 0x01e8d6}, + {0x01e944, 0x01e94a}, + {0x01e94b, 0x01e94b}, + {0x01f3fb, 0x01f3ff}, + {0x0e0001, 0x0e0001}, + {0x0e0020, 0x0e007f}, + {0x0e0100, 0x0e01ef}, +}; + +/* table of Unicode codepoint ranges of White_Space characters */ +static const pg_unicode_range unicode_white_space[11] = +{ + {0x000009, 0x00000d}, + {0x000020, 0x000020}, + {0x000085, 0x000085}, + {0x0000a0, 0x0000a0}, + {0x001680, 0x001680}, + {0x002000, 0x00200a}, + {0x002028, 0x002028}, + {0x002029, 0x002029}, + {0x00202f, 0x00202f}, + {0x00205f, 0x00205f}, + {0x003000, 0x003000}, +}; + +/* table of Unicode codepoint ranges of Hex_Digit characters */ +static const pg_unicode_range unicode_hex_digit[6] = +{ + {0x000030, 0x000039}, + {0x000041, 0x000046}, + {0x000061, 0x000066}, + {0x00ff10, 0x00ff19}, + {0x00ff21, 0x00ff26}, + {0x00ff41, 0x00ff46}, +}; + +/* table of Unicode codepoint ranges of Join_Control characters */ +static const pg_unicode_range unicode_join_control[1] = +{ + {0x00200c, 0x00200d}, +}; diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_east_asian_fw_table.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_east_asian_fw_table.h new file mode 100644 index 0000000..db8bd0a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_east_asian_fw_table.h @@ -0,0 +1,126 @@ +/* generated by src/common/unicode/generate-unicode_east_asian_fw_table.pl, do not edit */ + +static const struct mbinterval east_asian_fw[] = { + {0x1100, 0x115F}, + {0x231A, 0x231B}, + {0x2329, 0x232A}, + {0x23E9, 0x23EC}, + {0x23F0, 0x23F0}, + {0x23F3, 0x23F3}, + {0x25FD, 0x25FE}, + {0x2614, 0x2615}, + {0x2630, 0x2637}, + {0x2648, 0x2653}, + {0x267F, 0x267F}, + {0x268A, 0x268F}, + {0x2693, 0x2693}, + {0x26A1, 0x26A1}, + {0x26AA, 0x26AB}, + {0x26BD, 0x26BE}, + {0x26C4, 0x26C5}, + {0x26CE, 0x26CE}, + {0x26D4, 0x26D4}, + {0x26EA, 0x26EA}, + {0x26F2, 0x26F3}, + {0x26F5, 0x26F5}, + {0x26FA, 0x26FA}, + {0x26FD, 0x26FD}, + {0x2705, 0x2705}, + {0x270A, 0x270B}, + {0x2728, 0x2728}, + {0x274C, 0x274C}, + {0x274E, 0x274E}, + {0x2753, 0x2755}, + {0x2757, 0x2757}, + {0x2795, 0x2797}, + {0x27B0, 0x27B0}, + {0x27BF, 0x27BF}, + {0x2B1B, 0x2B1C}, + {0x2B50, 0x2B50}, + {0x2B55, 0x2B55}, + {0x2E80, 0x2E99}, + {0x2E9B, 0x2EF3}, + {0x2F00, 0x2FD5}, + {0x2FF0, 0x303E}, + {0x3041, 0x3096}, + {0x3099, 0x30FF}, + {0x3105, 0x312F}, + {0x3131, 0x318E}, + {0x3190, 0x31E5}, + {0x31EF, 0x321E}, + {0x3220, 0x3247}, + {0x3250, 0xA48C}, + {0xA490, 0xA4C6}, + {0xA960, 0xA97C}, + {0xAC00, 0xD7A3}, + {0xF900, 0xFAFF}, + {0xFE10, 0xFE19}, + {0xFE30, 0xFE52}, + {0xFE54, 0xFE66}, + {0xFE68, 0xFE6B}, + {0xFF01, 0xFF60}, + {0xFFE0, 0xFFE6}, + {0x16FE0, 0x16FE4}, + {0x16FF0, 0x16FF1}, + {0x17000, 0x187F7}, + {0x18800, 0x18CD5}, + {0x18CFF, 0x18D08}, + {0x1AFF0, 0x1AFF3}, + {0x1AFF5, 0x1AFFB}, + {0x1AFFD, 0x1AFFE}, + {0x1B000, 0x1B122}, + {0x1B132, 0x1B132}, + {0x1B150, 0x1B152}, + {0x1B155, 0x1B155}, + {0x1B164, 0x1B167}, + {0x1B170, 0x1B2FB}, + {0x1D300, 0x1D356}, + {0x1D360, 0x1D376}, + {0x1F004, 0x1F004}, + {0x1F0CF, 0x1F0CF}, + {0x1F18E, 0x1F18E}, + {0x1F191, 0x1F19A}, + {0x1F200, 0x1F202}, + {0x1F210, 0x1F23B}, + {0x1F240, 0x1F248}, + {0x1F250, 0x1F251}, + {0x1F260, 0x1F265}, + {0x1F300, 0x1F320}, + {0x1F32D, 0x1F335}, + {0x1F337, 0x1F37C}, + {0x1F37E, 0x1F393}, + {0x1F3A0, 0x1F3CA}, + {0x1F3CF, 0x1F3D3}, + {0x1F3E0, 0x1F3F0}, + {0x1F3F4, 0x1F3F4}, + {0x1F3F8, 0x1F43E}, + {0x1F440, 0x1F440}, + {0x1F442, 0x1F4FC}, + {0x1F4FF, 0x1F53D}, + {0x1F54B, 0x1F54E}, + {0x1F550, 0x1F567}, + {0x1F57A, 0x1F57A}, + {0x1F595, 0x1F596}, + {0x1F5A4, 0x1F5A4}, + {0x1F5FB, 0x1F64F}, + {0x1F680, 0x1F6C5}, + {0x1F6CC, 0x1F6CC}, + {0x1F6D0, 0x1F6D2}, + {0x1F6D5, 0x1F6D7}, + {0x1F6DC, 0x1F6DF}, + {0x1F6EB, 0x1F6EC}, + {0x1F6F4, 0x1F6FC}, + {0x1F7E0, 0x1F7EB}, + {0x1F7F0, 0x1F7F0}, + {0x1F90C, 0x1F93A}, + {0x1F93C, 0x1F945}, + {0x1F947, 0x1F9FF}, + {0x1FA70, 0x1FA7C}, + {0x1FA80, 0x1FA89}, + {0x1FA8F, 0x1FAC6}, + {0x1FACE, 0x1FADC}, + {0x1FADF, 0x1FAE9}, + {0x1FAF0, 0x1FAF8}, + {0x20000, 0x2FFFD}, + {0x30000, 0x3FFFD}, +}; diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_nonspacing_table.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_nonspacing_table.h new file mode 100644 index 0000000..d67f5b3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_nonspacing_table.h @@ -0,0 +1,338 @@ +/* generated by src/common/unicode/generate-unicode_nonspacing_table.pl, do not edit */ + +static const struct mbinterval nonspacing[] = { + {0x00AD, 0x00AD}, + {0x0300, 0x036F}, + {0x0483, 0x0489}, + {0x0591, 0x05BD}, + {0x05BF, 0x05BF}, + {0x05C1, 0x05C2}, + {0x05C4, 0x05C5}, + {0x05C7, 0x05C7}, + {0x0600, 0x0605}, + {0x0610, 0x061A}, + {0x061C, 0x061C}, + {0x064B, 0x065F}, + {0x0670, 0x0670}, + {0x06D6, 0x06DD}, + {0x06DF, 0x06E4}, + {0x06E7, 0x06E8}, + {0x06EA, 0x06ED}, + {0x070F, 0x070F}, + {0x0711, 0x0711}, + {0x0730, 0x074A}, + {0x07A6, 0x07B0}, + {0x07EB, 0x07F3}, + {0x07FD, 0x07FD}, + {0x0816, 0x0819}, + {0x081B, 0x0823}, + {0x0825, 0x0827}, + {0x0829, 0x082D}, + {0x0859, 0x085B}, + {0x0890, 0x089F}, + {0x08CA, 0x0902}, + {0x093A, 0x093A}, + {0x093C, 0x093C}, + {0x0941, 0x0948}, + {0x094D, 0x094D}, + {0x0951, 0x0957}, + {0x0962, 0x0963}, + {0x0981, 0x0981}, + {0x09BC, 0x09BC}, + {0x09C1, 0x09C4}, + {0x09CD, 0x09CD}, + {0x09E2, 0x09E3}, + {0x09FE, 0x0A02}, + {0x0A3C, 0x0A3C}, + {0x0A41, 0x0A51}, + {0x0A70, 0x0A71}, + {0x0A75, 0x0A75}, + {0x0A81, 0x0A82}, + {0x0ABC, 0x0ABC}, + {0x0AC1, 0x0AC8}, + {0x0ACD, 0x0ACD}, + {0x0AE2, 0x0AE3}, + {0x0AFA, 0x0B01}, + {0x0B3C, 0x0B3C}, + {0x0B3F, 0x0B3F}, + {0x0B41, 0x0B44}, + {0x0B4D, 0x0B56}, + {0x0B62, 0x0B63}, + {0x0B82, 0x0B82}, + {0x0BC0, 0x0BC0}, + {0x0BCD, 0x0BCD}, + {0x0C00, 0x0C00}, + {0x0C04, 0x0C04}, + {0x0C3C, 0x0C3C}, + {0x0C3E, 0x0C40}, + {0x0C46, 0x0C56}, + {0x0C62, 0x0C63}, + {0x0C81, 0x0C81}, + {0x0CBC, 0x0CBC}, + {0x0CBF, 0x0CBF}, + {0x0CC6, 0x0CC6}, + {0x0CCC, 0x0CCD}, + {0x0CE2, 0x0CE3}, + {0x0D00, 0x0D01}, + {0x0D3B, 0x0D3C}, + {0x0D41, 0x0D44}, + {0x0D4D, 0x0D4D}, + {0x0D62, 0x0D63}, + {0x0D81, 0x0D81}, + {0x0DCA, 0x0DCA}, + {0x0DD2, 0x0DD6}, + {0x0E31, 0x0E31}, + {0x0E34, 0x0E3A}, + {0x0E47, 0x0E4E}, + {0x0EB1, 0x0EB1}, + {0x0EB4, 0x0EBC}, + {0x0EC8, 0x0ECE}, + {0x0F18, 0x0F19}, + {0x0F35, 0x0F35}, + {0x0F37, 0x0F37}, + {0x0F39, 0x0F39}, + {0x0F71, 0x0F7E}, + {0x0F80, 0x0F84}, + {0x0F86, 0x0F87}, + {0x0F8D, 0x0FBC}, + {0x0FC6, 0x0FC6}, + {0x102D, 0x1030}, + {0x1032, 0x1037}, + {0x1039, 0x103A}, + {0x103D, 0x103E}, + {0x1058, 0x1059}, + {0x105E, 0x1060}, + {0x1071, 0x1074}, + {0x1082, 0x1082}, + {0x1085, 0x1086}, + {0x108D, 0x108D}, + {0x109D, 0x109D}, + {0x135D, 0x135F}, + {0x1712, 0x1714}, + {0x1732, 0x1733}, + {0x1752, 0x1753}, + {0x1772, 0x1773}, + {0x17B4, 0x17B5}, + {0x17B7, 0x17BD}, + {0x17C6, 0x17C6}, + {0x17C9, 0x17D3}, + {0x17DD, 0x17DD}, + {0x180B, 0x180F}, + {0x1885, 0x1886}, + {0x18A9, 0x18A9}, + {0x1920, 0x1922}, + {0x1927, 0x1928}, + {0x1932, 0x1932}, + {0x1939, 0x193B}, + {0x1A17, 0x1A18}, + {0x1A1B, 0x1A1B}, + {0x1A56, 0x1A56}, + {0x1A58, 0x1A60}, + {0x1A62, 0x1A62}, + {0x1A65, 0x1A6C}, + {0x1A73, 0x1A7F}, + {0x1AB0, 0x1B03}, + {0x1B34, 0x1B34}, + {0x1B36, 0x1B3A}, + {0x1B3C, 0x1B3C}, + {0x1B42, 0x1B42}, + {0x1B6B, 0x1B73}, + {0x1B80, 0x1B81}, + {0x1BA2, 0x1BA5}, + {0x1BA8, 0x1BA9}, + {0x1BAB, 0x1BAD}, + {0x1BE6, 0x1BE6}, + {0x1BE8, 0x1BE9}, + {0x1BED, 0x1BED}, + {0x1BEF, 0x1BF1}, + {0x1C2C, 0x1C33}, + {0x1C36, 0x1C37}, + {0x1CD0, 0x1CD2}, + {0x1CD4, 0x1CE0}, + {0x1CE2, 0x1CE8}, + {0x1CED, 0x1CED}, + {0x1CF4, 0x1CF4}, + {0x1CF8, 0x1CF9}, + {0x1DC0, 0x1DFF}, + {0x200B, 0x200F}, + {0x202A, 0x202E}, + {0x2060, 0x206F}, + {0x20D0, 0x20F0}, + {0x2CEF, 0x2CF1}, + {0x2D7F, 0x2D7F}, + {0x2DE0, 0x2DFF}, + {0x302A, 0x302D}, + {0x3099, 0x309A}, + {0xA66F, 0xA672}, + {0xA674, 0xA67D}, + {0xA69E, 0xA69F}, + {0xA6F0, 0xA6F1}, + {0xA802, 0xA802}, + {0xA806, 0xA806}, + {0xA80B, 0xA80B}, + {0xA825, 0xA826}, + {0xA82C, 0xA82C}, + {0xA8C4, 0xA8C5}, + {0xA8E0, 0xA8F1}, + {0xA8FF, 0xA8FF}, + {0xA926, 0xA92D}, + {0xA947, 0xA951}, + {0xA980, 0xA982}, + {0xA9B3, 0xA9B3}, + {0xA9B6, 0xA9B9}, + {0xA9BC, 0xA9BD}, + {0xA9E5, 0xA9E5}, + {0xAA29, 0xAA2E}, + {0xAA31, 0xAA32}, + {0xAA35, 0xAA36}, + {0xAA43, 0xAA43}, + {0xAA4C, 0xAA4C}, + {0xAA7C, 0xAA7C}, + {0xAAB0, 0xAAB0}, + {0xAAB2, 0xAAB4}, + {0xAAB7, 0xAAB8}, + {0xAABE, 0xAABF}, + {0xAAC1, 0xAAC1}, + {0xAAEC, 0xAAED}, + {0xAAF6, 0xAAF6}, + {0xABE5, 0xABE5}, + {0xABE8, 0xABE8}, + {0xABED, 0xABED}, + {0xFB1E, 0xFB1E}, + {0xFE00, 0xFE0F}, + {0xFE20, 0xFE2F}, + {0xFEFF, 0xFEFF}, + {0xFFF9, 0xFFFB}, + {0x101FD, 0x101FD}, + {0x102E0, 0x102E0}, + {0x10376, 0x1037A}, + {0x10A01, 0x10A0F}, + {0x10A38, 0x10A3F}, + {0x10AE5, 0x10AE6}, + {0x10D24, 0x10D27}, + {0x10D69, 0x10D6D}, + {0x10EAB, 0x10EAC}, + {0x10EFC, 0x10EFF}, + {0x10F46, 0x10F50}, + {0x10F82, 0x10F85}, + {0x11001, 0x11001}, + {0x11038, 0x11046}, + {0x11070, 0x11070}, + {0x11073, 0x11074}, + {0x1107F, 0x11081}, + {0x110B3, 0x110B6}, + {0x110B9, 0x110BA}, + {0x110BD, 0x110BD}, + {0x110C2, 0x110CD}, + {0x11100, 0x11102}, + {0x11127, 0x1112B}, + {0x1112D, 0x11134}, + {0x11173, 0x11173}, + {0x11180, 0x11181}, + {0x111B6, 0x111BE}, + {0x111C9, 0x111CC}, + {0x111CF, 0x111CF}, + {0x1122F, 0x11231}, + {0x11234, 0x11234}, + {0x11236, 0x11237}, + {0x1123E, 0x1123E}, + {0x11241, 0x11241}, + {0x112DF, 0x112DF}, + {0x112E3, 0x112EA}, + {0x11300, 0x11301}, + {0x1133B, 0x1133C}, + {0x11340, 0x11340}, + {0x11366, 0x11374}, + {0x113BB, 0x113C0}, + {0x113CE, 0x113CE}, + {0x113D0, 0x113D0}, + {0x113D2, 0x113D2}, + {0x113E1, 0x113E2}, + {0x11438, 0x1143F}, + {0x11442, 0x11444}, + {0x11446, 0x11446}, + {0x1145E, 0x1145E}, + {0x114B3, 0x114B8}, + {0x114BA, 0x114BA}, + {0x114BF, 0x114C0}, + {0x114C2, 0x114C3}, + {0x115B2, 0x115B5}, + {0x115BC, 0x115BD}, + {0x115BF, 0x115C0}, + {0x115DC, 0x115DD}, + {0x11633, 0x1163A}, + {0x1163D, 0x1163D}, + {0x1163F, 0x11640}, + {0x116AB, 0x116AB}, + {0x116AD, 0x116AD}, + {0x116B0, 0x116B5}, + {0x116B7, 0x116B7}, + {0x1171D, 0x1171D}, + {0x1171F, 0x1171F}, + {0x11722, 0x11725}, + {0x11727, 0x1172B}, + {0x1182F, 0x11837}, + {0x11839, 0x1183A}, + {0x1193B, 0x1193C}, + {0x1193E, 0x1193E}, + {0x11943, 0x11943}, + {0x119D4, 0x119DB}, + {0x119E0, 0x119E0}, + {0x11A01, 0x11A0A}, + {0x11A33, 0x11A38}, + {0x11A3B, 0x11A3E}, + {0x11A47, 0x11A47}, + {0x11A51, 0x11A56}, + {0x11A59, 0x11A5B}, + {0x11A8A, 0x11A96}, + {0x11A98, 0x11A99}, + {0x11C30, 0x11C3D}, + {0x11C3F, 0x11C3F}, + {0x11C92, 0x11CA7}, + {0x11CAA, 0x11CB0}, + {0x11CB2, 0x11CB3}, + {0x11CB5, 0x11CB6}, + {0x11D31, 0x11D45}, + {0x11D47, 0x11D47}, + {0x11D90, 0x11D91}, + {0x11D95, 0x11D95}, + {0x11D97, 0x11D97}, + {0x11EF3, 0x11EF4}, + {0x11F00, 0x11F01}, + {0x11F36, 0x11F3A}, + {0x11F40, 0x11F40}, + {0x11F42, 0x11F42}, + {0x11F5A, 0x11F5A}, + {0x13430, 0x13440}, + {0x13447, 0x13455}, + {0x1611E, 0x16129}, + {0x1612D, 0x1612F}, + {0x16AF0, 0x16AF4}, + {0x16B30, 0x16B36}, + {0x16F4F, 0x16F4F}, + {0x16F8F, 0x16F92}, + {0x16FE4, 0x16FE4}, + {0x1BC9D, 0x1BC9E}, + {0x1BCA0, 0x1BCA3}, + {0x1CF00, 0x1CF46}, + {0x1D167, 0x1D169}, + {0x1D173, 0x1D182}, + {0x1D185, 0x1D18B}, + {0x1D1AA, 0x1D1AD}, + {0x1D242, 0x1D244}, + {0x1DA00, 0x1DA36}, + {0x1DA3B, 0x1DA6C}, + {0x1DA75, 0x1DA75}, + {0x1DA84, 0x1DA84}, + {0x1DA9B, 0x1DAAF}, + {0x1E000, 0x1E02A}, + {0x1E08F, 0x1E08F}, + {0x1E130, 0x1E136}, + {0x1E2AE, 0x1E2AE}, + {0x1E2EC, 0x1E2EF}, + {0x1E4EC, 0x1E4EF}, + {0x1E5EE, 0x1E5EF}, + {0x1E8D0, 0x1E8D6}, + {0x1E944, 0x1E94A}, + {0xE0001, 0xE01EF}, +}; diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_norm.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_norm.h new file mode 100644 index 0000000..5bc3b79 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_norm.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * unicode_norm.h + * Routines for normalizing Unicode strings + * + * These definitions are used by both frontend and backend code. + * + * Copyright (c) 2017-2025, PostgreSQL Global Development Group + * + * src/include/common/unicode_norm.h + * + *------------------------------------------------------------------------- + */ +#ifndef UNICODE_NORM_H +#define UNICODE_NORM_H + +#include "mb/pg_wchar.h" + +typedef enum +{ + UNICODE_NFC = 0, + UNICODE_NFD = 1, + UNICODE_NFKC = 2, + UNICODE_NFKD = 3, +} UnicodeNormalizationForm; + +/* see UAX #15 */ +typedef enum +{ + UNICODE_NORM_QC_NO = 0, + UNICODE_NORM_QC_YES = 1, + UNICODE_NORM_QC_MAYBE = -1, +} UnicodeNormalizationQC; + +extern pg_wchar *unicode_normalize(UnicodeNormalizationForm form, const pg_wchar *input); + +extern UnicodeNormalizationQC unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const pg_wchar *input); + +#endif /* UNICODE_NORM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_norm_hashfunc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_norm_hashfunc.h new file mode 100644 index 0000000..89e04c7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_norm_hashfunc.h @@ -0,0 +1,3016 @@ +/*------------------------------------------------------------------------- + * + * unicode_norm_hashfunc.h + * Perfect hash functions used for Unicode normalization + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_norm_hashfunc.h + * + *------------------------------------------------------------------------- + */ + +/* + * File auto-generated by src/common/unicode/generate-unicode_norm_table.pl, + * do not edit. There is deliberately not an #ifndef PG_UNICODE_NORM_HASHFUNC_H + * here. + */ + +#include "common/unicode_norm_table.h" + +/* Typedef for perfect hash functions */ +typedef int (*cp_hash_func) (const void *key); + +/* Information for lookups with perfect hash functions */ +typedef struct +{ + const pg_unicode_decomposition *decomps; + cp_hash_func hash; + int num_decomps; +} pg_unicode_decompinfo; + +typedef struct +{ + const uint16 *inverse_lookup; + cp_hash_func hash; + int num_recomps; +} pg_unicode_recompinfo; + +/* Perfect hash function for decomposition */ +static int +Decomp_hash_func(const void *key) +{ + static const int16 h[13687] = { + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 32767, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 32767, 0, 32767, 0, 32767, + 0, 32767, 0, 32767, 0, 32767, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 32767, 0, 32767, 32767, 0, 0, 0, + 0, 32767, 32767, 32767, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 1, 32767, 2, 32767, 32767, 32767, 32767, 2792, + 32767, 32767, 4, 5, 6, 7, 32767, 32767, + 8, 9, 10, 32767, 11, 12, 13, 1734, + 14, -822, -822, 17, 18, 3020, 1739, 3021, + 3022, 3023, 1110, 24, 3024, 3025, 27, -3019, + 32767, 29, 30, 3026, 3027, 33, 34, 5016, + 1754, -4252, 36, 37, -4254, -4254, -4254, 32767, + 40, 41, 42, 43, 44, 45, 1912, 46, + 47, 48, 49, 50, 51, 52, 53, 54, + 1770, 55, 606, 57, 58, 59, 60, 1776, + 1777, 61, 62, 63, 64, 65, 32767, 66, + 32767, -1290, 6662, 3534, 3534, 3534, -172, 3322, + -170, -169, -168, -167, 3331, 1788, 0, 1790, + 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, + 1799, 3354, 1801, 1802, -964, -964, -964, -964, + 1807, 4976, 4976, 4976, 4976, 4976, 4976, 1814, + 1815, 4974, 2192, 11244, 2194, 11245, 0, 0, + 1605, 11251, 0, 11252, 0, 0, 3571, 3571, + -47, -47, 0, 0, -124, -123, -122, -4877, + -4877, -119, 32767, 32767, -118, 0, -116, -11032, + -114, -113, -112, 32767, 32767, -887, -110, -109, + -885, -107, 5320, 32767, 32767, -105, -882, 5328, + -102, -101, -100, -99, -4221, -4221, -4221, -95, + -94, -93, -92, -4221, -4221, -4221, -4221, 32767, + 32767, -4223, -4223, -4223, -4223, -4223, -4223, -4223, + -4223, -5481, -4223, -4223, -4223, -4223, -4223, -4223, + -4223, -4223, -4223, -4223, -4223, -4223, -4223, -4223, + -5495, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 1839, 1840, 1841, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 4663, 4664, 32767, + 32767, -4255, -4255, 32767, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -4268, -4268, 5881, 5882, 4722, 5884, 5885, 5886, + 5887, 32767, 5888, 5889, 5890, 5891, 5892, 5893, + 5894, 5895, 5896, 5897, 5898, 185, 186, -3976, + -3976, -3976, -3976, 6000, 6001, 6002, 6003, 6004, + 6005, 6006, 198, 5911, -3968, -3968, -826, -3968, + -3968, -3968, -3968, -3968, 208, 209, 32767, -3967, + -3967, -3032, -3967, -3967, -3030, 5922, 5923, -813, + 5925, 5926, 219, 220, 5929, 5930, 5931, 224, + -4290, -4290, -4290, -4290, -4290, -4290, -4290, 5940, + 5941, -4292, -4292, -4292, -4292, -4292, -4292, -4292, + -4292, 5950, 5951, 0, 0, 0, 0, 245, + 0, 0, 0, 0, 0, 0, 0, 253, + 254, 255, 256, -635, 258, 259, 260, 261, + 262, 263, 0, 265, 266, 267, 0, 0, + 268, 269, 32767, 32767, 32767, 32767, 32767, 32767, + 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 5981, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 2763, + 975, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 289, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 4382, 4382, 4382, 0, 7408, + 4383, 4383, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -4027, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -1642, -1641, -1640, -1639, + -1638, 3694, -1636, 3697, 3698, 3699, 0, 0, + -1627, 0, 0, -1622, -1621, 0, 6198, -1616, + -1615, -1614, -1613, 0, -1610, -1609, -1608, 0, + 0, 0, 0, 0, 0, 9558, -10546,0, + 6270, 6271, 6272, 6273, 6274, 6275, -3369, 6277, + 6545, 6279, 9583, 6281, -1402, -1402, 6284, 6285, + 304, 1947, 1947, 1947, 1947, 1947, -3384, 1947, + -3385, -3385, -3385, 315, 316, 1944, 318, 319, + 1942, 1942, 322, -5875, 1940, 1940, 1940, 1940, + 328, 1939, 1939, 1939, 332, 333, 334, 335, + 336, 337, -9220, 10885, 340, -5929, -5929, -5929, + -5929, -5929, -5929, 3716, -5929, -6196, -5929, -9232, + -5929, 1755, 1756, -5929, -5929, 53, -1589, -1588, + -1587, -1586, -1585, 3747, -1583, 3750, 3751, 3752, + 53, 53, -1574, 53, 53, -1569, -1568, 53, + 6251, -1563, -1562, -1561, -1560, 53, -1557, 5101, + -1556, 52, 52, 52, 52, 52, 52, 9610, + -10494,52, 6322, 6323, 6324, 6325, 6326, 6327, + -3317, 6329, 6597, 6331, 9635, 6333, -1350, -1350, + 6336, 6337, 356, 1999, 1999, 1999, 1999, 1999, + 0, 0, -2173, -3888, -3337, -5616, 0, 0, + 432, -2164, 1985, 0, 0, 0, 1980, 0, + 0, 0, 0, -1319, -4683, 1975, 368, 369, + 370, 371, 372, 0, -9185, 0, 374, -5895, + -5895, 0, 0, 0, 0, 864, 437, -16, + -16, 440, 32767, 441, 442, 443, -13, 445, + 446, 447, 32767, 32767, 32767, 32767, 32767, 6042, + 6043, 6044, 6045, 430, 431, 0, 2597, -1551, + 435, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 448, 449, 450, 32767, 451, + 452, 32767, 32767, 32767, 453, 0, 0, 0, + 0, 0, -428, 0, 454, 455, 0, 456, + 0, 0, 0, 457, 0, 0, 0, 0, + 458, 459, 460, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 3733, 3734, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 462, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 463, 464, 0, 465, + 0, 0, 0, 466, 0, 0, 0, 0, + 467, 0, 469, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5493, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 5530, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -4339, -4339, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -7353, -7353, -7353, -5439, + 0, 0, -7353, -4354, 0, 0, 485, 486, + 487, 488, 489, 490, 0, 0, 491, 492, + 493, 494, -2541, -5542, 0, 0, -5544, -5544, + -3630, -2543, -5542, -5542, -2543, 504, -2543, -2543, + -2543, -5538, 0, 0, -2545, -2545, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 3448, + 3448, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -3213, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 2540, 2540, + 2540, 2540, 2540, 0, 4830, 4831, -307, -307, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 4166, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -31, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -796, -795, + -794, -793, -792, -791, 1061, 1062, 1063, 1064, + 1065, 0, 0, 0, 0, 0, 0, 0, + -785, -784, -783, -782, -4016, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1097, -1096, -1095, -5270, -5270, -1094, -1093, + -1092, -2026, -1090, -1089, -2025, -2024, -765, -4241, + -10978,-10978,-5270, -5270, -10978,-10978,0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 3849, 0, + 0, 0, 0, 3854, 2311, 523, 2313, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 5994, 4146, 4146, 5997, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 2970, 32767, 32767, 32767, 32767, 1264, 1264, 1264, + 2215, 2216, 2217, 2218, 2219, 2220, 2221, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 5792, 32767, + 362, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -3774, 32767, 32767, -3776, -3776, -3776, -3776, + -5034, -3776, -3776, 32767, 32767, -3778, -3778, -3778, + -3778, -3778, -3778, 32767, 32767, -3780, -3780, 32767, + -5053, -3781, -3781, -3781, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -157, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 627, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 4695, 32767, + 32767, 2985, 2986, 32767, 32767, 32767, 32767, 628, + 629, 630, 631, 632, 633, -5911, 635, 636, + 637, 638, 639, 640, 641, 642, 643, 644, + 645, 646, 647, 648, 649, 650, 651, 652, + 653, 654, 32767, 32767, 32767, 32767, 32767, 32767, + -2208, 32767, 8339, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 4699, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 4700, + 4701, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 5998, 0, 32767, + 32767, 32767, 32767, 0, 0, 32767, 32767, 32767, + 32767, 0, 2987, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -1459, + -1459, -1459, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -1496, -2931, 32767, + 32767, 32767, 655, 656, 657, 658, 659, 660, + 661, 662, 663, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 664, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4743, 32767, 32767, 32767, -3717, -3716, + 667, -6740, 32767, -3714, 670, 671, 672, 673, + 674, 675, 676, 677, 32767, 678, 679, 680, + 32767, 681, 4709, 683, 684, 685, 2990, 32767, + 32767, 32767, 2991, 2992, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 538, 32767, 32767, 32767, 32767, -1583, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 686, -5583, -5583, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -1622, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 4710, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 4679, 4711, 4681, 4682, 4683, 4684, 4685, 4686, + 4687, 4688, 4689, 0, 0, 32767, 0, 32767, + 32767, 32767, 0, 5257, 32767, 32767, 32767, 6885, + 6619, 9923, 6621, -1062, -1062, 6624, 6625, 644, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 1637, 32767, 1637, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 4690, 4691, 4692, 4693, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4015, -5630, -5897, -5630, -8933, -5630, + 2054, 2055, -5630, -5630, 352, -1290, -1289, -1288, + -1287, -1286, 714, 715, 2889, 4605, 4055, 6335, + 720, 721, 32767, 2886, -1262, 724, 725, 726, + -1253, 728, 729, 730, 731, 2051, 5416, -1241, + 367, 367, 367, 367, 367, 740, 9926, 742, + 369, 6639, 6640, 746, 747, 748, 749, -114, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, -8006, -8006, -2024, -3666, -3665, + -3664, -3663, -3662, 1670, -3660, 1673, 1674, 1675, + -2024, -2024, -3651, -2024, -2024, 32767, 32767, 32767, + 32767, 32767, -2866, 32767, 32767, -2865, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -2866, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -2866, 32767, + 32767, 32767, -4485, -4485, 758, 759, 32767, 32767, + 32767, 760, -2863, -2862, -2861, -2860, -2859, -2858, + -2857, 32767, 32767, 32767, 32767, 32767, 32767, 3014, + 3015, 3016, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 0, 32767, 32767, 32767, 32767, 3017, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 2180, 2180, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 768, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 769, 770, 771, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 32767, 32767, 772, 773, 32767, + 774, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 3018, + 32767, 32767, 0, 32767, 4716, 4717, 32767, 32767, + 32767, 32767, 32767, 32767, 3019, 0, 3919, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 32767, 32767, 3643, + 32767, 32767, 3641, 32767, 32767, 0, 0, -3355, + 0, 0, 0, 0, 1998, 0, 0, 0, + 0, 0, 0, -3366, -3366, -3366, 0, 0, + -3368, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3365, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 676, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 677, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 13799, 0, 0, 0, 9279, 2994, 32767, + 8461, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 1755, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 3196, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -4700, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -3816, + 360, 361, 362, -572, 364, 365, -571, -570, + 689, -2787, -9524, -9524, -3816, -3816, -9524, -9524, + -9524, -3816, 699, 700, 701, 702, 703, 704, + 705, 706, 707, 8659, 5531, 5531, 5531, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 4746, 4747, 32767, + 4748, 32767, 32767, 32767, 4749, -507, -507, -507, + -507, -507, -507, -507, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -872, + 32767, 32767, 3030, 3031, 3032, 3033, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -3585, -3585, -3585, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -10784,-5076, -561, + -560, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 2304, 2304, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -3368, -3368, + 798, 32767, -372, -372, -372, -372, -372, -372, + 0, 1160, 0, 0, 0, 0, 0, 0, + 1161, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5714, 5714, 9877, 9878, 9879, 9880, 0, + 0, -97, -97, -97, -97, -97, 5712, 0, + 0, 9880, 6739, 0, 9882, 9883, 9884, 9885, + 5710, 0, 3820, 679, 0, 0, 9886, 9887, + 8951, 0, 0, 6737, 0, 0, 5708, 5708, + 0, 0, 0, 5708, 10223, 10224, 10225, 10226, + 10227, 10228, 10229, 0, 0, 10234, 10235, 10236, + 10237, 10238, 10239, 10240, 10241, 0, 0, 5952, + 5953, 5954, 5955, 5711, 5957, 5958, 5959, 5960, + 5961, 5962, 5963, 5711, 5711, 5711, 5711, 6603, + 5711, 5711, 5711, 5711, 5711, 5711, 5975, 5711, + 5711, 5711, 5979, 5980, 32767, 32767, 32767, 32767, + 803, 32767, 32767, 32767, 804, 32767, 32767, 32767, + 32767, 32767, 32767, 805, 806, 32767, 807, 808, + 32767, 809, 0, 5999, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 1389, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 840, 841, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 842, 32767, 843, 32767, 844, 32767, 32767, 32767, + 32767, 32767, 0, 0, 10606, 0, 845, 5378, + 0, 0, 0, 0, 1113, 1113, 1113, 1113, + 1113, 1113, 1113, 1113, 1113, -6838, -3709, -3708, + -3707, 0, -3493, 0, 0, 0, 0, -3497, + -1953, -164, -1953, -1953, 5407, 5408, -1955, -1955, + -1955, -1955, -1955, -1955, -3509, -1955, -1955, 812, + 813, 814, 815, -1955, -5123, -5122, -5121, -5120, + -5119, -5118, -14675,5430, -5115, -2332, -11383,-2332, + -11382,-136, -135, -1739, -11384,-11651,-11384,-131, + -130, -3700, -3699, -80, 5447, -126, -125, 0, + 0, 0, 4756, 4757, 0, 5456, -1715, 0, + -117, 0, 10917, 0, 0, 0, 5465, 5466, + 776, 0, 0, 777, 0, -5426, 5473, 5474, + 0, 778, -5431, 0, 0, 0, 0, 4123, + 4124, 4125, 0, 0, 0, 0, 4130, 4131, + 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, + 4140, 4141, 4142, 4143, 5402, 4145, 4146, 4147, + 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, + 4156, 4157, 4158, 5431, 5432, 4161, 4162, 4163, + 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, + 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, + 32767, 32767, 4180, 4181, 4182, 4183, 4184, 4185, + 4186, 4187, 4188, 4189, 4190, 4191, 4192, 6044, + 6045, 6046, 6047, 6048, 4198, 4199, 4200, 4201, + 4202, 4203, 4204, 4205, 4206, 4207, 4208, 974, + 4210, 11136, 3906, 3907, 3908, 3909, 3910, 3911, + 3912, 3913, 3914, 3915, 3916, 3917, 5988, 5989, + 0, 0, 3919, 3920, 3921, 3922, -6053, -6053, + -6053, -6053, -6053, -6053, -6053, -244, -5956, 3924, + 3925, 784, 3927, 3928, 3929, 3930, 3931, -244, + -244, 3932, 3933, 3934, 3000, 3936, 3937, 3001, + 3002, 4261, 785, -5952, -5952, -244, -244, -5952, + -5952, -5952, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -5739, -408, + -408, -408, 32767, 32767, 32767, 32767, 3724, 823, + 824, 32767, 32767, 32767, 32767, 32767, 32767, -421, + -2028, -2027, -2026, -2025, -2024, 517, -4312, -4312, + 827, 828, 522, 523, 524, 525, 526, 527, + 528, 529, 530, 531, 532, 533, 534, 535, + 536, 537, 538, 539, 540, 541, 542, 543, + 544, 545, 546, 547, 548, -3617, 550, 551, + 552, 553, 554, 555, 556, 32767, 557, 32767, + 558, 559, 32767, 560, 561, 32767, 562, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -1191, -1191, + -1191, -2792, 0, 0, 0, 0, -2791, -2790, + -4408, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -2791, -2790, + -2789, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 837, 838, 0, 0, -3001, 3038, + -3001, -3001, -3001, -1087, 0, -2999, -2999, 0, + 3047, 0, 0, 0, -2995, -2995, 0, 0, + 0, 0, 4287, 0, 0, 4292, 4293, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -550, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3918, 0, 0, 0, 0, 9976, 0, + 0, 0, 0, -6065, -6065, 0, 0, 0, + 0, 3142, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 935, 0, 0, 937, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 9645, 0, -267, 0, -3303, 0, + 7684, 7685, 0, 0, 5982, 4340, 4341, 4342, + 4343, 4344, 9676, 4346, 4347, 9679, 9680, 4350, + 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, + 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, + 5974, 5974, 5974, 5974, 5974, 5974, 15532, -4572, + 5974, 3192, 12244, 3194, 12245, 12246, 12247, 2603, + 12249, 12517, 12251, 999, 12252, 4569, 4569, 12255, + 12256, 6275, 7918, 7918, 7918, 7918, 7918, 2587, + 7918, 2586, 2586, 2586, 6286, 6287, 7915, 6289, + 6290, 7913, 7913, 6293, 96, 7911, 7911, 7911, + 7911, 6299, 7910, 1253, 7911, 6304, 6305, 6306, + 6307, 6308, 6309, -3248, 16857, 6312, 43, 43, + 43, 43, 43, 43, 9688, 43, -224, 43, + -3260, 43, 7727, 7728, 43, 43, 6025, 1253, + 6234, 1253, 6384, 6385, 10526, -3272, 1253, 6388, + 10531, 1253, 1253, 1253, 1253, 6392, 6393, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 6053, 6054, 6055, + 6056, 6057, 6058, 32767, 6059, 6060, 6061, 6062, + 32767, 6063, 32767, 6064, 32767, 32767, 32767, 4761, + 32767, 32767, 6065, 32767, 4762, 4763, 32767, 9404, + 32767, 6067, 4764, 6068, 32767, 6069, 6070, 6071, + 32767, 6072, 6073, 32767, 6074, 32767, 32767, 6075, + 32767, 6076, 32767, 6077, 32767, 6078, 32767, 6079, + 32767, 4374, 4374, 32767, 4373, 32767, 32767, 5324, + 5325, 5326, 5327, 32767, 6087, 6088, 6089, 6090, + 6091, 3057, 6093, 32767, 6094, 4376, -4013, 4376, + 32767, 4375, 4375, 4375, 4375, 32767, 4374, 32767, + 4373, 6104, 6105, 6106, 6107, 6108, 6109, 6110, + 6111, -3652, 881, -645, -645, -1903, 6116, 6117, + 6118, 4399, 4400, 4401, 6122, 6123, 3567, 3567, + 4406, 6127, 7410, 6129, 32767, 32767, 32767, 32767, + 32767, 7409, 7410, 4412, 32767, 6133, 4414, 4415, + 6136, 6137, 32767, 4420, 9402, 6140, 134, 134, + 13933, 134, 134, 134, 9413, 4429, 6149, 4432, + 6151, 4435, 6153, 6304, 6305, 6306, 6307, 6308, + 6309, 6310, 6311, 6312, 6313, 6314, 1068, 6316, + 5378, 6318, 5379, 6320, 803, 6322, -2232, 6324, + 6325, 6326, 1074, 6328, 6329, 6330, 6331, 6332, + 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, + 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, + 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, + 6357, 6358, 6359, 6360, 5417, 6362, 6363, 6364, + 6365, 6366, 6367, 5423, 6369, 5424, 6371, 6372, + 5426, 5426, 6375, 5427, 5427, 6378, 6379, 6380, + 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, + 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, + 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, + 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, + 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, + 6421, 6422, 7182, 5465, 6425, 6426, 6427, 6428, + 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, + 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, + 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, + 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, + 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, + 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, + 6477, 6478, 5519, 5519, 6481, 6482, 6483, 6484, + 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, + 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, + 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, + 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, + 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, + 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, + 6533, 1330, 6535, 6536, 6537, 6538, 5577, 6540, + 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, + 6549, 6550, 5588, 5588, 6553, 6554, 6555, 6556, + 32767, 6557, 1728, 1728, 6867, 6868, 6562, 6563, + 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, + 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, + 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, + 6588, 2423, 6590, 6591, 6592, 6593, 6594, 6595, + 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, + 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, + 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, + 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, + 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, + 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, + 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, + 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, + 6660, 6661, 6693, 6663, 6664, 6665, 6666, 6667, + 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, + 6676, 6677, 6678, 6679, 7476, 7476, 7476, 7476, + 7476, 7476, 5625, 5625, 5625, 5625, 5625, 6691, + 6692, 6693, 6694, 6695, 6696, 6697, 7483, 7483, + 7483, 7483, 10718, 6703, 6704, 6705, 6706, 6707, + 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, + 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, + 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, + 6732, 6733, 6734, 6735, 6736, 6737, 6738, 7836, + 7836, 7836, 12012, 12013, 7838, 7838, 7838, 8773, + 7838, 7838, 8775, 8775, 7517, 10994, 17732, 17733, + 12026, 12027, 17736, 17737, 6760, 6761, 6762, 6763, + 6764, 6765, 6766, 6767, 6768, 6769, 6770, 6771, + 6772, 6773, 6774, 6775, 2927, 6777, 6778, 6779, + 6780, 2927, 4471, 6260, 4471, 6785, 6786, 6787, + 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, + 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, + 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, + 6812, 32767, 3411, 5540, 5541, 3411, 12221, 3411, + 3411, 3411, 3411, 5548, 5549, 5550, 5551, 5552, + 5553, 5554, 5555, 5556, 5557, 5558, 5559, 5560, + 5561, 5562, 5563, 5564, 5565, 5566, 5567, 5568, + 32767, 32767, 32767, 32767, 32767, 32767, 3915, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 6155, 6156, 6157, 6158, 6159, + 6160, 6161, 6162, 6163, 6164, 6165, 32767, 32767, + 32767, 32767, 32767, 6166, 6167, 6168, 6169, 6170, + 6171, 6172, 6173, 6174, 6175, 6176, 6177, 6178, + 6179, 6180, 4615, 4616, 4617, 4618, 4619, 6186, + 6187, 6188, 6189, 6190, 6191, 6192, 6193, 6194, + 6195, 6196, 32767, 6197, 6198, 6199, 6200, 6201, + 7637, 4495, 4495, 6205, 4052, 4052, 6208, 6209, + 6210, 6211, 6212, 6213, 6214, 6215, 6216, 6217, + 6218, 6219, 6220, 6221, 6222, 6223, 6224, 6225, + 6226, 6227, 6228, 32767, 32767, 0, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 6229, 6230, 6231, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 6232, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 884, 885, 886, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 5994, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 6233, 6234, 6235, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 6236, 6237, 6238, 6239, + 6240, 6241, 6242, 6243, 6244, 6245, 6246, 6247, + 6248, 6249, 6250, 6251, 6252, 6253, 6254, 6255, + 6256, 6257, 6258, 6259, 6260, 6261, 6262, 6263, + 6264, 6265, 6266, 6267, 6268, 6269, 6270, 6271, + 6272, 6273, 6274, 6275, 6276, 6277, 6278, 6279, + 32767, 32767, 32767, 32767, 6280, 6281, 6282, 6283, + 6284, 6285, 6286, 6287, 6288, 4770, 32767, 4771, + 4772, 32767, 32767, 32767, 6289, 6290, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -5160, 2071, + 2071, 2071, 2071, 32767, 2070, 2070, 2070, 2070, + 2070, 2070, 2070, 0, 0, 6236, 6237, 2075, + 2075, 2075, 2075, 12051, 12052, 12053, 12054, 12055, + 12056, 12057, 6249, 11962, 2083, 2083, 5225, 2083, + 2083, 2083, 2083, 2083, 6259, 6260, 2085, 2085, + 2085, 3020, 2085, 2085, 3022, 3022, 32767, 5240, + 11978, 11979, 6272, 6273, 11982, 11983, 11984, 6277, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4773, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 415, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -2468, -2468, + -2468, -2468, -2468, -2468, -2468, -2468, -2468, -2468, + -2468, -2468, -2468, -2468, -2468, -2468, -2468, -2468, + 2089, 2090, 2091, -2465, -2465, -2465, -2465, -2465, + -2465, 2098, 2099, -2463, -2463, -2463, -2463, -2463, + -2463, 2106, 2107, -2461, -2461, -2461, -2461, -2461, + -2461, 0, 0, -2459, -2459, -2459, 2119, 2120, + 2121, -2456, 2123, 2124, 2125, 2126, 2127, 2128, + 0, 0, 2131, -6678, 2133, 2134, 2135, 2136, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2158, 2159, 2160, + 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, + 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, + 2177, 2178, 2179, 2180, 2181, -2412, -2412, -2412, + -2412, -2412, 2187, 2188, 2025, 2190, 2191, 2192, + 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, + 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, + 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, + 2217, 2218, 2219, 2220, 2221, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1566, 1566, + 1566, 1566, 1566, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 32767, 0, + 0, 0, 0, 0, -1435, 1708, 1709, 0, + 2154, 2155, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 0, 0, 32767, 32767, 4774, 4775, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 32767, 0, 0, 0, 0, + 0, 0, 0, 0, -2552, 0, 0, 32767, + 0, 32767, 32767, 32767, 1551, 293, 3770, 32767, + 32767, 32767, 32767, 0, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 32767, 32767, 0, + 0, 32767, 0, 0, 32767, 32767, 32767, 32767, + 0, 32767, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -4309, -4309, 0, 32767, + 0, -4310, -4577, -4310, -7613, -4310, 3374, 3375, + -4310, -4310, 1672, -3100, 1881, -3100, 2031, 2032, + 6173, -7625, -3100, 2035, 6178, -3100, -3100, -3100, + -3100, 2039, 2040, 32767, 0, -4353, -4353, 0, + -4352, 0, 0, -4350, 0, -4349, -4349, -4349, + -4349, 32767, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 0, 0, 32767, 0, 0, + 32767, 0, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 0, 0, 0, + 0, 951, 952, 953, 954, 955, 956, 957, + 1717, 0, 32767, 32767, 32767, -1317, 32767, 32767, + 32767, 0, -8389, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 887, 888, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 32767, -5009, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 5520, 32767, 32767, 32767, 32767, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 5990, 5991, 5992, 5993, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 890, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 891, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 799, 32767, 32767, 32767, + 32767, 800, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 801, 802, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 0, + 0, 0, 0, 0, 6545, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 32767, 0, 0, + 32767, 0, 32767, 32767, 32767, 32767, 32767, 32767, + -5711, 241, 242, 243, 244, 0, 246, 247, + 248, 249, 250, 251, 252, 0, 0, 0, + 0, 892, 0, 0, 0, 0, 0, 0, + 264, 0, 0, 0, 32767, 32767, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 893, -266, 895, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 284, 285, 286, 287, 288, 0, 290, 291, + 292, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 0, 0, 0, + 0, 0, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 293, 294, 295, 296, 297, 298, 32767, 32767, + 299, -4082, -4081, -4080, 303, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767, 0, 0, 0, 0, + 0, 32767, 0, 32767, 0, 0, 32767, 0, + 0, 32767, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -4245, -4245, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, -689, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -706, + -706, -706, -706, -706, -706, -706, -706, 32767, + 32767, -7551, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, -4377, -4377, -8024, -8023, -4377, -4377, + -3916, -4377, -4377, -4377, -4377, -4377, -4377, -4377, + 32767, -4378, -4378, -4378, -4378, -4378, -4378, -4378, + -4378, -4378, -4378, -4378, -4378, -4378, -4378, -4378, + -4378, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 150, 1867, 150, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5247, 0, 939, 0, 940, 0, 5518, + 0, 8555, 0, 0, 0, 5253, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 944, + 0, 0, 0, 0, 0, 0, 945, 0, + 946, 0, 0, 947, 948, 0, 949, 950, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -759, 959, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 960, 961, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5204, 0, 0, 0, + 0, 962, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 963, 964, 0, + 0, 0, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 5186, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 32767, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 5256, -4973, -4973, 32767, + 5261, 5262, 5263, 5264, 5265, 5266, 5267, -4974, + -4974, 978, 979, 980, 981, 32767, 982, 983, + 984, 985, 986, 987, 988, 32767, 32767, 32767, + 32767, 1624, 32767, 32767, 32767, 32767, 32767, 32767, + 990, 32767, 32767, 0, 991, 992, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 4759, + 4760, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -723, -722, -2974, 32767, 996, -719, -168, + -717, -716, -715, 1002, 1003, 1004, -712, -711, + 32767, -710, 1008, 1009, 1010, 1011, -2060, 5892, + 2764, 2764, 2764, 1017, 1018, 1019, 1020, 1021, + 1022, 2567, 1024, 32767, 1025, 1026, 1027, 1028, + 1029, 1030, 1031, 1032, 1033, 1034, 2589, 1036, + 1037, -1729, -1729, -1729, -1729, 1042, 4211, 4211, + 4211, 4211, 4211, 4211, 1049, 1050, 4209, 1427, + 32767, 32767, 32767, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -825, 32767, 32767, + 32767, 32767, 32767, 4718, 4719, 4720, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 4721, 4722, + 4723, 4724, 4725, 4726, 4727, 6291, 6292, 6293, + 4728, 4729, 4730, 4731, 4732, 6299, 6300, -4992, + 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, + 1078, 1079, 1080, 4733, 1082, 4734, 1084, 1085, + 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, + 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, + 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, + 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, + 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, + 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, + 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, + 1142, 1143, 1144, 1145, 1146, 4737, 1148, 4738, + 4739, 1151, 1152, 1153, 1154, 32767, 4740, 4741, + 4742, 1158, 1159, 1160, 1161, 1162, 1163, 1164, + 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, + 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, + 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, + 1189, 1190, 1191, 1192, 1193, 1194, 11979, 6272, + 1758, 1758, 1199, 1200, 1201, 1202, 1203, 1204, + 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, + 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, + 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, + 1229, -1074, -1073, 1232, 1233, 1234, 1235, 1236, + 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, + 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, + 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, + 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, + 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, + 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, + 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, + 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, + 1301, 1302, 1303, 1304, 1305, 1306, 1307, 4676, + 4677, 512, 32767, 32767, 32767, 32767, 1683, 1684, + 1685, 1314, 155, 1316, 1317, 1318, 1319, 1320, + 1321, 161, 1323, 1324, 1325, 1326, 1327, 1328, + 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, + 1337, 1338, -4375, -4374, -8536, -8536, -8536, -8536, + 1345, 1346, 1444, 1445, 1446, 1447, 1448, -4360, + 1353, 1354, -8525, -5383, 1357, -8524, -8524, -8524, + -8524, -4348, 1363, -2456, 686, 1366, 1367, -8518, + -8518, -7581, 1371, 1372, -5364, 1374, 1375, -4332, + -4331, 1378, 1379, 1380, -4327, -8841, -8841, -8841, + -8841, -8841, -8841, -8841, 1389, 1390, -8843, -8843, + -8843, -8843, -8843, -8843, -8843, -8843, 1399, 1400, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 5957, + 2655, -5028, -5028, 2658, 2659, -3322, -1679, -1679, + -1679, -1679, -1679, -7010, -1679, -1679, -7010, -7010, + -1679, -1679, -1679, -1679, -1679, 32767, 32767, -1681, + -1681, -1681, -1681, -1681, -1681, 32767, 32767, -1683, + -1683, -3290, -3289, -3288, -3287, -3286, -3285, -12842, + 7263, -3282, -499, -9550, -499, -9549, -9549, -9549, + 96, -9549, -9816, -9549, 1704, -9548, -1864, -1863, + -9548, -9548, -3566, -5208, -5207, -5206, -5205, -5204, + 128, -5202, 131, 132, 133, 32767, 32767, -5195, + -3568, -3568, -5190, -5189, -3568, 32767, 32767, -5185, + -5184, -5183, -3570, -5180, 1478, -5179, -3571, 32767, + -3572, 32767, -3573, 32767, 5984, 32767, -3575, 2695, + 2696, 2697, 2698, 2699, 2700, -6944, 2702, 2970, + 2704, 6008, 2706, -4977, -4977, 2709, 2710, -3271, + 1502, -3478, 1504, -3626, -3626, -7766, 6033, 1509, + -3625, -7767, 1512, 1513, 1514, 32767, 32767, -3625, + -3625, -3625, -3625, -3625, -3625, -3625, 1522, -3624, + 1524, 1525, 1526, 1527, 1528, 1529, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3128, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1581, -673, 0, 784, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3025, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -6843, + -6843, 0, 0, 0, 1619, 1620, 1621, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -2788, 32767, 32767, + 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, + 4194, 1643, 1644, 32767, 32767, 32767, 32767, 32767, + 32767, 1352, 32767, 32767, 32767, 32767, 32767, 1646, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 1647, 1648, 1649, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 1650, + 32767, 32767, 32767, 1651, 1652, 32767, 1653, 1654, + 32767, 32767, 32767, 32767, 1655, 32767, 1656, 32767, + 32767, 32767, 32767, 399, 399, 32767, 32767, 1657, + 1658, 1659, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 0, 0, 32767, 32767, 32767, 1660, + 32767, 32767, 32767, 32767, 32767, 6619, 32767, 1661, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 5971, 5972, 5973, 5974, 1664, 5975, 6243, 5977, + 9281, 5979, -1704, -1704, 5982, 5983, 2, 4775, + -205, 4777, -353, -353, -4493, 9306, 4782, -352, + -4494, 4785, 4786, 4787, 4788, -350, -350, 6044, + 1691, 6045, 6046, 1694, 6047, 1696, 1697, 6048, + 1699, 6049, 6050, 6051, 6052, 0, 0, 0, + 0, 0, 0, 32767, 0, 0, 0, 0, + 1704, 0, 32767, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 32767, -3338, -3338, + -3338, 0, 32767, 0, 32767, 0, 0, 0, + 32767, 0, 0, 32767, 0, 32767, 32767, 0, + 0, 0, 0, 0, 32767, 0, 32767, 0, + 1705, 1706, 1707, 1708, 1709, 759, 759, 759, + 759, 759, 759, 759, 0, 0, 0, 0, + 0, 3035, 0, 32767, 0, 1719, 10109, 1721, + 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, + 1730, 0, 0, 0, 0, 0, 0, 0, + 0, 9764, 6757, 6758, 6759, 8018, 0, 0, + 0, 1720, 1720, 1720, 0, 0, 2557, 2558, + 1720, 0, -1282, 0, -1281, -1281, -1281, 633, + 1720, -1279, -1279, 1720, 4767, 0, 1720, 1720, + 0, 0, 1718, 1718, -3263, 0, 6007, 6008, + -7790, 6010, 6011, 6012, -3266, 1719, 0, 1718, + 0, 1717, 0, -150, 1717, 1717, 1717, 32767, + 1716, 1716, 1716, 3969, 1715, 0, 1716, 1166, + 1716, 1716, 1716, 0, 0, 0, 1717, 1717, + 1717, 1717, 0, 0, 0, 0, 3072, -4879, + -1750, -1749, -1748, 0, 0, 0, 0, 0, + 0, -1544, 0, 1789, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -1554, 0, + 0, 2767, 2768, 2769, 2770, 0, -3168, -3167, + -3166, -3165, -3164, -3163, 0, 0, -3158, -375, + -9426, -375, -9425, 1821, 1822, 218, -9427, 1825, + -9426, 1827, 1828, -1742, -1741, 1878, 1879, 1833, + 1834, 32767, 32767, 32767, 32767, 2642, -4765, -1739, + -1738, 32767, 1835, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 2718, -3491, 3174, 3174, 3174, + -3669, -3669, -3669, -3669, -3669, -5232, -5232, -5232, + -3666, -3666, -3666, -3666, -3666, -5232, -5232, 6061, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -3652, 0, -3651, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -3590, 0, -3589, + -3589, 0, 0, 0, 0, 32767, 1842, 32767, + 32767, 32767, 32767, 1843, 32767, 32767, 1844, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 1845, 32767, + 1846, 32767, 32767, 32767, 32767, 32767, 1847, 1848, + 0, 1849, 1850, 0, 32767, 32767, 0, 0, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 1851, 32767, 32767, 1852, 32767, + 32767, 1853, 32767, 1854, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, -4903, 32767, -6162, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 137, + 1858, 3141, 1860, 3142, 32767, 32767, 1229, 143, + 32767, 32767, 144, -2902, 0, 0, 32767, 32767, + 32767, 32767, 148, 5130, 0, 0, -4140, 9659, + 32767, 0, -4142, 5137, 5138, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 32767, + 0, 5148, 5149, 5150, 5151, 5152, 5153, 4782, + 3623, 3623, 3623, 3623, 3623, 3623, 3623, 3623, + 3623, 3623, 3623, 3623, 3623, 3623, 6751, 3623, + 3623, 3623, 3623, 3623, 3623, 3623, 3623, 3623, + 3623, 3623, 3623, 3623, 32767, 3622, 3622, 3622, + 3622, 32767, 3621, 3621, 3621, 0, 3622, 32767, + 3621, 32767, 32767, 32767, 3618, 3618, 3618, 3618, + 3618, 3618, 3618, 32767, 2944, 0, 4402, 3618, + 3618, 3618, 3618, 3618, 3618, 3618, 3618, 3618, + 3618, 3618, 3618, 3618, 0, 0, 3620, 3620, + 3620, 3620, 3620, 3620, -762, 6646, 3621, 3621, + 3621, 3621, 3621, 3621, 3621, 3621, 3621, 3621, + -3222, -3222, 3621, 3621, 3621, 5240, 5241, 5242, + 0, 0, 3623, 3623, 3623, 0, 3624, 3624, + 3624, 3624, 3624, 3624, 3624, 3624, 836, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -3647, -3646, 0, 0, + 461, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 468, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 0, 32767, 0, 470, 471, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 472, 473, 474, 475, 476, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 775, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 4803, 4804, 7596, 7596, 7596, + 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, + 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, + 4824, 3988, 3988, 4827, 4828, 7830, 1792, 7832, + 7833, 7834, 5921, 4835, 7835, 7836, 4838, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3036, 6038, 0, + 6040, 6041, 6042, 4129, 3043, 6043, 6044, 3046, + 0, 3048, 3049, 3050, 6046, 6047, 3053, 3054, + 3055, 3056, -1230, 3058, 3059, -1232, -1232, 3062, + 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, + 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, + 3079, 3080, 3081, 3632, 3083, 3084, 3085, 3086, + 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, + 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, + 3103, -814, 3105, 3106, 3107, 3108, -6867, 3110, + 3111, 3112, 3113, 9179, 9180, 3116, 3117, 3118, + 3119, -22, 3121, 3122, 3123, 3124, 3125, 3126, + 3127, 3128, 3129, 3130, 2196, 3132, 3133, 2197, + 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, + 3143, 3144, -6500, 3146, 3414, 3148, 6452, 3150, + -4533, -4533, 3153, 3154, -2827, -1184, -1184, -1184, + -1184, -1184, -6515, -1184, -1184, -6515, -6515, -1184, + -1184, -1184, -1184, -1184, -1184, -1184, -1184, -1184, + -1184, -1184, -1184, -1184, -1184, -1184, -1184, -1184, + -2791, -2790, -2789, -2788, -2787, -2786, -12343,7762, + -2783, 0, -9051, 0, -9050, -9050, -9050, 595, + -9050, -9317, -9050, 2203, -9049, -1365, -1364, -9049, + -9049, -3067, -4709, -4708, -4707, -4706, -4705, 627, + -4703, 630, 631, 632, -3067, -3067, -4694, -3067, + -3067, -4689, -4688, -3067, 3131, -4683, -4682, -4681, + -4680, -3067, -4677, 1981, -4676, -3068, -3068, -3068, + -3068, -3068, -3068, 6490, -13614,-3068, 3202, 3203, + 3204, 3205, 3206, 3207, -6437, 3209, 3477, 3211, + 6515, 3213, -4470, -4470, 3216, 3217, -2764, 2009, + -2971, 2011, -3119, -3119, -7259, 6540, 2016, -3118, + -7260, 2019, 2020, 2021, 2022, -3116, -3116, 3278, + 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, + 3287, 3288, 3289, 3290, 3291, 32767, 3292, 3293, + -869, -869, -869, -869, 9107, 9108, 9109, 9110, + 9111, 9112, 9113, 3305, 32767, 32767, -863, 32767, + -864, 32767, 32767, -866, -866, 3310, 3311, -864, + -864, -864, 71, -864, -864, 32767, 72, 32767, + 2290, 32767, 32767, 3320, 3321, 32767, 32767, 32767, + 3322, -1192, -1192, -1192, -1192, -1192, -1192, -1192, + -1192, -1192, -1192, -1192, -1192, -1192, -1192, -1192, + -1192, -1192, -1192, -1192, -1192, -1192, -1192, -1192, + -1192, -1192, -1192, -1192, -1192, -1192, -1192, -1192, + -1192, -1192, -1192, -1192, -1192, -1192, -1192, -1192, + -1192, -1192, -1192, 3365, 3366, 3367, -1189, -1189, + -1189, -1189, -1189, -1189, 3374, 3375, -1187, -1187, + -1187, -1187, -1187, -1187, 3382, 3383, -1185, -1185, + -1185, -1185, -1185, -1185, 32767, 32767, -1185, -1185, + -1185, 3393, 3394, 3395, -1182, 3397, 3398, 3399, + 3400, 3401, 3402, 1274, 1274, 3405, -5404, 3407, + 3408, 3409, 3410, 1274, 1274, 1274, 1274, 1274, + 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, + 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, + 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, + -1138, -1138, -1138, -1138, -1138, 3461, 3462, 3299, + 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, + 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, + 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, + 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 3496, + 3497, 3498, 3499, 3500, 3501, 3502, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 3503, 3211, 3211, 3211, 3211, 32767, + 32767, 32767, 32767, 32767, 7590, 7590, 7590, 3208, + 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, + 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, + 3528, 3529, 3530, 3531, 3532, 3533, 32767, 3534, + 3535, 3536, 3537, 3538, 32767, 3539, 32767, 3540, + 3541, 32767, 3542, 3543, 32767, 3544, 3545, 3546, + 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, + 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, + 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, + 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, + 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, + 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, + 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, + 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, + 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, + 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, + 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, + 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, + 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, + 3651, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 3652, 3653, 3654, 3655, 3656, 3657, + 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, + 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, + 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, + 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, + 3690, 3691, 3692, 3693, 3694, 3695, 3696, 32767, + 3244, 3698, 3699, 3700, 3701, 3702, 4131, 3704, + 3251, 3251, 3707, 3252, 3709, 3710, 3711, 3255, + 3713, 3714, 3715, 3716, 3259, 3259, 3259, 3720, + 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, + 3729, 3730, 3731, 3732, 0, 0, 3735, 3736, + 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, + 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, + 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, + 3761, 3300, 3763, 3764, 3765, 3766, 3767, 3768, + 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, + 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, + 3322, 3322, 3787, 3323, 3789, 3790, 3791, 3326, + 3793, 3794, 3795, 3796, 3330, 3798, 3330, 3800, + 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, + 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, + 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, + 3825, -1667, 3827, 3828, 3829, 3830, 3831, 3832, + 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, + 3841, 3842, 3843, 3844, -1685, 3846, 3847, 3848, + 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, + 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, + 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, + 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, + 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, + 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, + 3897, 8237, 8238, 3900, 3901, 3902, 3903, 3904, + 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, + 11266, 11267, 11268, 9355, 3917, 3918, 11272, 8274, + 3921, 3922, 3438, 3438, 3438, 3438, 3438, 3438, + 3929, 3930, 3440, 3440, 3440, 3440, 6476, 9478, + 3937, 3938, 9483, 9484, 7571, 6485, 9485, 9486, + 6488, 3442, 6490, 6491, 6492, 9488, 3951, 3952, + 32767, -866, -866, -866, -866, -866, -866, -29, + -28, -866, -866, -3867, 2172, -3867, -3867, -3867, + -1953, -866, -3865, -3865, -866, 3973, 3974, 3975, + 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, + 3984, 3985, 3986, 951, -2050, 3989, -2050, -2050, + -2050, -136, 951, -2048, -2048, 951, 3998, 951, + 951, 951, -2044, -2044, 951, 951, 951, 951, + 5238, 951, 951, 5243, 5244, 951, 951, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 383, 933, 933, 933, 933, 933, 933, + 933, 933, 933, 933, 933, 933, 933, 933, + 933, 933, 933, 933, 933, 933, 933, 4851, + 933, 933, 933, 933, 10909, 933, 933, 933, + 933, -5132, -5132, 933, 933, 933, 933, 4075, + 933, 933, 933, 933, 933, 933, 933, 933, + 933, 933, 1868, 933, 933, 1870, 933, 933, + 933, 933, 933, 933, 933, 933, 933, 933, + 10578, 0, 32767, 931, -2372, 931, 8615, 8616, + 931, 931, 6913, 5271, 5272, 5273, 5274, 5275, + 10607, 5277, 5278, 10610, 10611, 5281, 5282, 5283, + 5284, 5285, 5286, 5287, 5288, 5289, 5290, 5291, + 5292, 5293, 5294, 5295, 5296, 5297, 6905, 6905, + 6905, 6905, 6905, 6905, 16463, -3641, 6905, 4123, + 13175, 4125, 13176, 13177, 13178, 3534, 13180, 13448, + 13182, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -2357, 17748, 7203, 934, 934, 934, 934, + 934, 934, 10579, 934, 667, 934, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4146, 4147, 4148, 4149, 4150, 4151, + 4152, 4153, 4154, 4155, 32767, 32767, 32767, 32767, + 32767, 32767, 4156, 4157, 4158, 4159, 4160, 4161, + 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, + 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, + 4178, 4179, 4180, 4181, 4182, 5374, 5375, 5376, + 6978, 4187, 4188, 4189, 4190, 6982, 6982, 32767, + 32767, 4193, 4194, 4195, 4196, 4197, 4198, 4199, + 4200, 4201, 4202, 4203, 4204, 32767, 6995, 6995, + 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, + 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, + 4223, 32767, 3386, 4225, 4226, 7228, 32767, 32767, + 32767, 32767, 5315, 4229, 7229, 32767, 4231, 32767, + 4232, 4233, 4234, 7230, 7231, 4237, 4238, 4239, + 4240, -46, 4242, 4243, -48, -48, 4246, 4247, + 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, + 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, + 4264, 4265, 4816, 4267, 4268, 4269, 4270, 4271, + 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, + 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, + 370, 4289, 4290, 4291, 4292, -5683, 4294, 4295, + 4296, 4297, 10363, 10364, 4300, 4301, 4302, 4303, + 1162, 4305, 4306, 4307, 4308, 4309, 4310, 4311, + 4312, 4313, 4314, 3380, 4316, 4317, 3381, 4319, + 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, + 4328, -5316, 4330, 4598, 4332, 7636, 4334, -3349, + -3349, 4337, 4338, -1643, 0, 0, 0, 0, + 0, -5331, 0, 0, -5331, -5331, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 4126, + 4127, 4128, 4129, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1258, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -1272, -1272, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -1851, -1851, -1851, -1851, + -1851, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3235, 0, -6925, 306, + 306, 306, 306, 306, 306, 306, 306, 306, + 306, 306, 306, -1764, -1764, 4472, 4473, 311, + 311, 311, 311, 10287, 10288, 10289, 10290, 10291, + 10292, 10293, 4485, 10198, 319, 319, 3461, 319, + 319, 319, 319, 319, 4495, 4496, 321, 321, + 321, 1256, 321, 321, 1258, 1258, 0, 3477, + 10215, 10216, 4509, 4510, 10219, 10220, 10221, 4514, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4579, 4580, 4581, 4582, + 4583, 4584, 32767, 2455, 4586, -4223, 4588, 4589, + 4590, 4591, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 4885, 4886, 4887, + 4888, 4889, 4890, 4891, 4892, 4893, 4894, 4895, + 4896, 4897, 4898, 4899, 4900, 4901, 4902, 4903, + 4904, 4616, 4906, 4907, 4908, 4909, 4910, 4911, + 4912, 4913, 4914, 4915, 4916, 4917, 4918, 4919, + 4920, 4921, 4922, 4923, 4924, 4925, 4926, 4927, + 4928, 4929, 4930, 4931, 4932, 4933, 4934, 4935, + 4936, 4937, 4938, 4939, 4940, 4941, 4942, 4943, + 4944, 4945, 4946, 4947, 4948, 567, 568, 569, + 4952, -2455, 571, 572, 4956, 4957, 4958, 4959, + 4960, 4961, 4962, 4963, 4964, 4965, 4966, 4967, + 4968, 4969, 32767, 4970, 4971, 4972, 4973, 4974, + 4975, 4976, 4977, 4978, 4979, 4980, 6623, 6623, + 6623, 6623, 6623, 1292, 6623, 1291, 1291, 1291, + 4991, 4992, 6620, 4994, 4995, 6618, 6618, 4998, + -1199, 6616, 6616, 6616, 6616, 5004, 6615, 6615, + 6615, 5008, 5009, 5010, 5011, 5012, 5013, -4544, + 15561, 5016, -1253, -1253, -1253, -1253, -1253, -1253, + 8392, -1253, -1520, -1253, -4556, -1253, 6431, 6432, + -1253, -1253, 4729, 3087, 3088, 3089, 3090, 3091, + 8423, 3093, 3094, 8426, 8427, 3097, 3098, 3099, + 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, + 3108, 3109, 3110, 3111, 3112, 3113, 4721, 4721, + 4721, 4721, 4721, 4721, 14279, -5825, 4721, 1939, + 10991, 1941, 10992, 10993, 10994, 1350, 10996, 11264, + 10998, -254, 10999, 3316, 3316, 11002, 11003, 5022, + 6665, 6665, 6665, 6665, 6665, 1334, 6665, 1333, + 1333, 1333, 5033, 5034, 6662, 5036, 5037, 6660, + 6660, 5040, -1157, 6658, 6658, 6658, 6658, 5046, + 6657, 0, 6658, 5051, 5052, 5053, 5054, 5055, + 5056, -4501, 15604, 5059, -1210, -1210, -1210, -1210, + -1210, -1210, 8435, -1210, -1477, -1210, -4513, -1210, + 6474, 6475, -1210, -1210, 4772, 0, 4981, 0, + 5131, 5132, 9273, -4525, 0, 5135, 9278, 0, + 0, 0, 0, 5139, 5140, 5141, 5142, 5143, + 5144, 5145, 5146, 0, 5147, 0, 0, 0, + 0, 0, 0, 1530, 1531, 1532, 1533, 1534, + 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, + 1543, 1544, -1583, 1546, 1547, 1548, 1549, 1550, + 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, + 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, + 1567, 5189, 1568, 1569, 1570, 1571, 1572, 1573, + 1574, 1575, 1576, 1577, 1578, 1579, 1580, 0, + 2255, 5200, 799, 1584, 1585, 1586, 1587, 1588, + 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, + 5215, 5216, 1597, 1598, 1599, 1600, 1601, 1602, + 5985, -1422, 1604, 1605, 1606, 1607, 1608, 1609, + 1610, 1611, 1612, 1613, 8457, 8458, 1616, 1617, + 1618, 0, 0, 0, 5243, 5244, 1622, 1623, + 1624, 5248, 1625, 1626, 1627, 1628, 1629, 1630, + 1631, 1632, 4421, 5258, 5259, 5260, 5261, 5262, + 5263, 5264, 5265, 5266, 5267, 5268, 5269, 5270, + 5271, 5272, 5273, 5274, 5275, 5276, 5277, 5278, + 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, + 8934, 8934, 5289, 5290, 4830, 5292, 5293, 5294, + 5295, 5296, 5297, 5298, 5299, 5300, 5301, 5302, + 5303, 5304, 5305, 5306, 5307, 5308, 5309, 5310, + 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, + 5319, 5320, 5321, 5322, 5323, 5324, 5325, 5326, + 5327, 5328, 5329, 5330, 5331, 5332, 5333, 5334, + 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342, + 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350, + 5351, 5352, 5353, 5354, 5355, 5356, 5357, 5358, + 4891, 5360, 5361, 5362, 5363, 5364, 5365, 5366, + 5367, 5368, 5369, 5370, 5371, 5372, 32767, 5373, + 5374, -5231, 5376, 4532, 0, 5379, 5380, 5381, + 5382, 4270, 4271, 4272, 4273, 4274, 4275, 4276, + 4277, 4278, 12230, 9102, 9102, 9102, 5396, 8890, + 5398, 5399, 5400, 5401, 8899, 7356, 5568, 7358, + 7359, 0, 0, 7364, 7365, 7366, 7367, 7368, + 7369, 8924, 7371, 7372, 4606, 4606, 4606, 4606, + 7377, 10546, 10546, 10546, 10546, 10546, 10546, 20104, + 0, 10546, 7764, 16816, 7766, 16817, 5572, 5572, + 7177, 16823, 17091, 16825, 5573, 5573, 9144, 9144, + 5526, 0, 5574, 5574, 5450, 5451, 5452, 697, + 697, 5455, 0, 7172, 5458, 5576, 5460, -5456, + 5462, 5463, 5464, 0, 0, 4691, 5468, 5469, + 4693, 5471, 10898, 0, 0, 5475, 4698, 10908, + 5478, 5479, 5480, 5481, 1359, 1359, 1359, 5485, + 5486, 5487, 5488, 1359, 1359, 1359, 1359, 1359, + 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, + 1359, 101, 1359, 1359, 1359, 1359, 1359, 1359, + 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, + 87, 87, 1359, 1359, 1359, 1359, 1359, 1359, + 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, + 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, + 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, + 1359, 1359, 1359, 1359, -492, -492, -492, -492, + -492, 1359, 1359, 1359, 1359, 1359, 1359, 1359, + 1359, 1359, 1359, 1359, 4594, 1359, -5566, 1665, + 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, + 1665, 1665, 1665, -405, -405, 5585, 5586, 1668, + 1668, 1668, 1668, 11644, 11645, 11646, 11647, 11648, + 11649, 11650, 5842, 11555, 1676, 1676, 4818, 1676, + 1676, 1676, 1676, 1676, 5852, 5853, 1678, 1678, + 1678, 2613, 1678, 1678, 2615, 2615, 1357, 4834, + 11572, 11573, 5866, 5867, 11576, 11577, 11578, 5871, + 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, + 1357, -6594, -3465, -3464, -3463, 244, -3249, 244, + 244, 244, 244, -3253, -1709, 80, -1709, -1709, + 5651, 5652, -1711, -1711, -1711, -1711, -1711, -1711, + -3265, -1711, -1711, 1056, 1057, 1058, 1059, -1711, + -4879, -4878, -4877, -4876, -4875, -4874, -14431,5674, + -4871, -2088, -11139,-2088, -11138,108, 109, -1495, + -11140,-11407,-11140,113, 114, -3456, -3455, 164, + 5691, 118, 119, 244, 244, 244, 5000, 5001, + 244, 5700, -1471, 244, 127, 244, 11161, 244, + 244, 244, 5709, 5710, 1020, 244, 244, 1021, + 244, -5182, 5717, 5718, 244, 1022, -5187, 244, + 244, 244, 244, 4367, 4368, 4369, 244, 244, + 244, 244, 4374, 4375, 4376, 4377, 4378, 4379, + 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, + 5646, 4389, 4390, 4391, 4392, 4393, 4394, 4395, + 4396, 4397, 4398, 4399, 4400, 4401, 4402, 5675, + 5676, 4405, 4406, 4407, 4408, 4409, 4410, 4411, + 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, + 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, + 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, + 4436, 4437, 4438, 6290, 6291, 6292, 6293, 6294, + 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, + 4452, 4453, 4454, 1220, 4456, 11382, 4152, 4153, + 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, + 4162, 4163, 6234, 6235, 0, 0, 4163, 4164, + 4165, 4166, -5809, -5809, -5809, -5809, -5809, -5809, + -5809, 0, -5712, 4168, 4169, 1028, 4171, 4172, + 4173, 4174, 4175, 0, 0, 4176, 4177, 4178, + 3244, 4180, 4181, 3245, 3246, 4505, 1029, -5708, + -5708, 0, 0, -5708, -5708, -5708, 0, 4515, + 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, + 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, + 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, + 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, + 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, + 4556, 0, 0, 0, 4557, 4558, 4559, 4560, + 4561, 4562, 0, 0, 4563, 4564, 4565, 4566, + 4567, 4568, 0, 0, 4569, 4570, 4571, 4572, + 4573, 4574, 2114, 2115, 4575, 4576, 4577, 0, + 0, 0, 4578, 0, 0, 0, 0, 0, + 0, 2129, 2130, 0, 8810, 0, 0, 0, + 0, 2137, 2138, 2139, 2140, 2141, 2142, 2143, + 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, + 2152, 2153, 2154, 2155, 2156, 2157, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4594, 4595, + 4596, 4597, 4598, 0, 0, 164, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2222, 2223, + 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, + 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, + 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, + 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, + 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, + 2264, 2265, 2266, 2267, 2268, 2269, 2270, 705, + 706, 707, 708, 709, 2276, 2277, 2278, 2279, + 2280, 2281, 2282, 2283, 2284, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 2285, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 2286, 2287, 2288, 2289, 2290, 2291, + 32767, 32767, 32767, 32767, 32767, 32767, 2292, 32767, + 2293, 2294, 2295, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 2296, 32767, 2297, 32767, + 2298, 32767, 2299, 32767, 2300, 32767, 2301, 32767, + 2302, 32767, 2303, 32767, 2304, 32767, 2305, 32767, + 2306, 32767, 2307, 32767, 32767, 2308, 32767, 2309, + 32767, 2310, 32767, 32767, 32767, 32767, 32767, 32767, + 2311, 2312, 32767, 2313, 2314, 32767, 2315, 2316, + 32767, 2317, 2318, 32767, 2319, 2320, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 2321, 32767, 32767, 32767, + 32767, 2322, 2323, 2324, 2325, 32767, 2326, 2327, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 2328, 32767, 2329, 32767, + 2330, 32767, 2331, 32767, 2332, 32767, 2333, 32767, + 2334, 32767, 2335, 32767, 2336, 32767, 2337, 32767, + 2338, 32767, 2339, 32767, 32767, 2340, 32767, 2341, + 32767, 2342, 32767, 32767, 32767, 32767, 32767, 32767, + 2343, 2344, 32767, 2345, 2346, 32767, 2347, 2348, + 32767, 2349, 2350, 32767, 2351, 2352, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 2353, 32767, 32767, 2354, + 2355, 2356, 2357, 32767, 32767, 32767, 2358, 2359, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 2360, 2361, 2362, 2363, 2364, 2365, + 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, + 2374, -753, 2376, 2377, 2378, 2379, 2380, 2381, + 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, + 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, + 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, + 2406, 2407, 2408, 2409, 2410, 2411, 831, 3086, + 2414, 1631, 2416, 2417, 2418, 2419, 2420, 2421, + 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, + 2430, 2431, 2432, 2433, 2434, 2435, 2436, 2437, + -587, 2439, 2440, 2441, 2442, 2443, 2444, 2445, + 2446, 2447, 2448, 9292, 9293, 2451, 2452, 2453, + 32767, 32767, 32767, 2454, 2455, 2456, 2457, 2458, + 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, + 2467, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 4599, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 4600, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 2468, -1450, 2470, 2471, 2472, 2473, + 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, + 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, + 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, + 2498, 32767, 2499, 2500, 2501, 2502, 2503, 2504, + 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, + 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, + 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, + 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, + 2537, 2538, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 2539, 2540, 5896, 2542, 2543, 2544, + 2545, 548, 2547, 2548, 2549, 2550, 2551, 2552, + 5919, 5920, 5921, 2556, 2557, 5926, 2559, 2560, + 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, + 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, + 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, + 2585, 32767, 2586, 2587, 2588, 2589, 2590, 2591, + 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, + 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, + 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, + 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, + 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, + 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, + 2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647, + 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, + 2656, 2657, 2658, 2659, 2660, 2661, -703, 2663, + 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, + 2672, 2673, 2674, 1999, 2676, 2677, 2678, 2679, + 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, + 2688, 2689, 2690, 2014, 2692, 2693, 2694, 2695, + 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, + 2704, 2705, 2706, 2707, 2708, 2709, -11089,2711, + 2712, 2713, 32767, 2714, 2715, 2716, 2717, 2718, + 8050, 2720, 2721, 8053, 8054, 2724, 2725, 2726, + 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, + 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, + 2743, 2744, 2745, 2746, 2747, 2748, -1377, -1377, + -1377, -1377, 2753, 2754, 2755, 2756, 2757, 2758, + 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, + 4025, 2768, 2769, 2770, 2771, 2772, 2773, 2774, + 2775, 2776, 2777, 2778, 2779, 2780, 2781, 4054, + 4055, 2784, 2785, 2786, 2787, 2788, 2789, 2790, + 2791, 2792, 2793, 2794, 2795, 2796, 2797, 2798, + 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, + 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, + 2815, 2816, 2817, 4669, 4670, 4671, 4672, 4673, + 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, + 2831, 2832, 2833, -401, 2835, 9761, 2531, 2532, + 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, + 2541, 2542, 4613, 4614, -1621, -1621, 2542, 2543, + 2544, 2545, -7430, -7430, -7430, -7430, -7430, -7430, + -7430, -1621, -7333, 2547, 2548, -593, 2550, 2551, + 2552, 2553, 2554, -1621, -1621, 2555, 2556, 2557, + 1623, 2559, 2560, 1624, 1625, 2884, -592, -7329, + -7329, -1621, -1621, -7329, -7329, -7329, -1621, 2894, + 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, + 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, + 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, + 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, + 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, + 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, + 2943, 2944, 2945, 2946, 2947, 2948, 2949, 2950, + 2951, 2952, 2953, 2954, 2955, 2956, 2957, 2958, + 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, + 2967, 2968, 2969, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 0, 0, 0, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 0, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 0, 32767, 0, 32767, 0, + 32767, 0, 32767, 0, 32767, 0, 32767, 0, + 32767, 0, 32767, 0, 32767, 0, 32767, 0, + 32767, 32767, 0, 32767, 0, 32767, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 0, 32767, + 0, 0, 32767, 0, 0, 32767, 0, 0, + 32767, 0, 0, 32767, 32767, 32767, 32767 + }; + + const unsigned char *k = (const unsigned char *) key; + size_t keylen = 4; + uint32 a = 0; + uint32 b = 1; + + while (keylen--) + { + unsigned char c = *k++; + + a = a * 257 + c; + b = b * 8191 + c; + } + return h[a % 13687] + h[b % 13687]; +} + +/* Hash lookup information for decomposition */ +static const pg_unicode_decompinfo UnicodeDecompInfo = +{ + UnicodeDecompMain, + Decomp_hash_func, + 6843 +}; + +/* Inverse lookup array -- contains indexes into UnicodeDecompMain[] */ +static const uint16 RecompInverseLookup[961] = +{ + /* U+003C+0338 -> U+226E */ 1858, + /* U+003D+0338 -> U+2260 */ 1855, + /* U+003E+0338 -> U+226F */ 1859, + /* U+0041+0300 -> U+00C0 */ 14, + /* U+0041+0301 -> U+00C1 */ 15, + /* U+0041+0302 -> U+00C2 */ 16, + /* U+0041+0303 -> U+00C3 */ 17, + /* U+0041+0304 -> U+0100 */ 67, + /* U+0041+0306 -> U+0102 */ 69, + /* U+0041+0307 -> U+0226 */ 270, + /* U+0041+0308 -> U+00C4 */ 18, + /* U+0041+0309 -> U+1EA2 */ 1313, + /* U+0041+030A -> U+00C5 */ 19, + /* U+0041+030C -> U+01CD */ 194, + /* U+0041+030F -> U+0200 */ 240, + /* U+0041+0311 -> U+0202 */ 242, + /* U+0041+0323 -> U+1EA0 */ 1311, + /* U+0041+0325 -> U+1E00 */ 1155, + /* U+0041+0328 -> U+0104 */ 71, + /* U+0042+0307 -> U+1E02 */ 1157, + /* U+0042+0323 -> U+1E04 */ 1159, + /* U+0042+0331 -> U+1E06 */ 1161, + /* U+0043+0301 -> U+0106 */ 73, + /* U+0043+0302 -> U+0108 */ 75, + /* U+0043+0307 -> U+010A */ 77, + /* U+0043+030C -> U+010C */ 79, + /* U+0043+0327 -> U+00C7 */ 20, + /* U+0044+0307 -> U+1E0A */ 1165, + /* U+0044+030C -> U+010E */ 81, + /* U+0044+0323 -> U+1E0C */ 1167, + /* U+0044+0327 -> U+1E10 */ 1171, + /* U+0044+032D -> U+1E12 */ 1173, + /* U+0044+0331 -> U+1E0E */ 1169, + /* U+0045+0300 -> U+00C8 */ 21, + /* U+0045+0301 -> U+00C9 */ 22, + /* U+0045+0302 -> U+00CA */ 23, + /* U+0045+0303 -> U+1EBC */ 1339, + /* U+0045+0304 -> U+0112 */ 83, + /* U+0045+0306 -> U+0114 */ 85, + /* U+0045+0307 -> U+0116 */ 87, + /* U+0045+0308 -> U+00CB */ 24, + /* U+0045+0309 -> U+1EBA */ 1337, + /* U+0045+030C -> U+011A */ 91, + /* U+0045+030F -> U+0204 */ 244, + /* U+0045+0311 -> U+0206 */ 246, + /* U+0045+0323 -> U+1EB8 */ 1335, + /* U+0045+0327 -> U+0228 */ 272, + /* U+0045+0328 -> U+0118 */ 89, + /* U+0045+032D -> U+1E18 */ 1179, + /* U+0045+0330 -> U+1E1A */ 1181, + /* U+0046+0307 -> U+1E1E */ 1185, + /* U+0047+0301 -> U+01F4 */ 230, + /* U+0047+0302 -> U+011C */ 93, + /* U+0047+0304 -> U+1E20 */ 1187, + /* U+0047+0306 -> U+011E */ 95, + /* U+0047+0307 -> U+0120 */ 97, + /* U+0047+030C -> U+01E6 */ 216, + /* U+0047+0327 -> U+0122 */ 99, + /* U+0048+0302 -> U+0124 */ 101, + /* U+0048+0307 -> U+1E22 */ 1189, + /* U+0048+0308 -> U+1E26 */ 1193, + /* U+0048+030C -> U+021E */ 268, + /* U+0048+0323 -> U+1E24 */ 1191, + /* U+0048+0327 -> U+1E28 */ 1195, + /* U+0048+032E -> U+1E2A */ 1197, + /* U+0049+0300 -> U+00CC */ 25, + /* U+0049+0301 -> U+00CD */ 26, + /* U+0049+0302 -> U+00CE */ 27, + /* U+0049+0303 -> U+0128 */ 103, + /* U+0049+0304 -> U+012A */ 105, + /* U+0049+0306 -> U+012C */ 107, + /* U+0049+0307 -> U+0130 */ 111, + /* U+0049+0308 -> U+00CF */ 28, + /* U+0049+0309 -> U+1EC8 */ 1351, + /* U+0049+030C -> U+01CF */ 196, + /* U+0049+030F -> U+0208 */ 248, + /* U+0049+0311 -> U+020A */ 250, + /* U+0049+0323 -> U+1ECA */ 1353, + /* U+0049+0328 -> U+012E */ 109, + /* U+0049+0330 -> U+1E2C */ 1199, + /* U+004A+0302 -> U+0134 */ 114, + /* U+004B+0301 -> U+1E30 */ 1203, + /* U+004B+030C -> U+01E8 */ 218, + /* U+004B+0323 -> U+1E32 */ 1205, + /* U+004B+0327 -> U+0136 */ 116, + /* U+004B+0331 -> U+1E34 */ 1207, + /* U+004C+0301 -> U+0139 */ 118, + /* U+004C+030C -> U+013D */ 122, + /* U+004C+0323 -> U+1E36 */ 1209, + /* U+004C+0327 -> U+013B */ 120, + /* U+004C+032D -> U+1E3C */ 1215, + /* U+004C+0331 -> U+1E3A */ 1213, + /* U+004D+0301 -> U+1E3E */ 1217, + /* U+004D+0307 -> U+1E40 */ 1219, + /* U+004D+0323 -> U+1E42 */ 1221, + /* U+004E+0300 -> U+01F8 */ 232, + /* U+004E+0301 -> U+0143 */ 126, + /* U+004E+0303 -> U+00D1 */ 29, + /* U+004E+0307 -> U+1E44 */ 1223, + /* U+004E+030C -> U+0147 */ 130, + /* U+004E+0323 -> U+1E46 */ 1225, + /* U+004E+0327 -> U+0145 */ 128, + /* U+004E+032D -> U+1E4A */ 1229, + /* U+004E+0331 -> U+1E48 */ 1227, + /* U+004F+0300 -> U+00D2 */ 30, + /* U+004F+0301 -> U+00D3 */ 31, + /* U+004F+0302 -> U+00D4 */ 32, + /* U+004F+0303 -> U+00D5 */ 33, + /* U+004F+0304 -> U+014C */ 133, + /* U+004F+0306 -> U+014E */ 135, + /* U+004F+0307 -> U+022E */ 278, + /* U+004F+0308 -> U+00D6 */ 34, + /* U+004F+0309 -> U+1ECE */ 1357, + /* U+004F+030B -> U+0150 */ 137, + /* U+004F+030C -> U+01D1 */ 198, + /* U+004F+030F -> U+020C */ 252, + /* U+004F+0311 -> U+020E */ 254, + /* U+004F+031B -> U+01A0 */ 181, + /* U+004F+0323 -> U+1ECC */ 1355, + /* U+004F+0328 -> U+01EA */ 220, + /* U+0050+0301 -> U+1E54 */ 1239, + /* U+0050+0307 -> U+1E56 */ 1241, + /* U+0052+0301 -> U+0154 */ 139, + /* U+0052+0307 -> U+1E58 */ 1243, + /* U+0052+030C -> U+0158 */ 143, + /* U+0052+030F -> U+0210 */ 256, + /* U+0052+0311 -> U+0212 */ 258, + /* U+0052+0323 -> U+1E5A */ 1245, + /* U+0052+0327 -> U+0156 */ 141, + /* U+0052+0331 -> U+1E5E */ 1249, + /* U+0053+0301 -> U+015A */ 145, + /* U+0053+0302 -> U+015C */ 147, + /* U+0053+0307 -> U+1E60 */ 1251, + /* U+0053+030C -> U+0160 */ 151, + /* U+0053+0323 -> U+1E62 */ 1253, + /* U+0053+0326 -> U+0218 */ 264, + /* U+0053+0327 -> U+015E */ 149, + /* U+0054+0307 -> U+1E6A */ 1261, + /* U+0054+030C -> U+0164 */ 155, + /* U+0054+0323 -> U+1E6C */ 1263, + /* U+0054+0326 -> U+021A */ 266, + /* U+0054+0327 -> U+0162 */ 153, + /* U+0054+032D -> U+1E70 */ 1267, + /* U+0054+0331 -> U+1E6E */ 1265, + /* U+0055+0300 -> U+00D9 */ 35, + /* U+0055+0301 -> U+00DA */ 36, + /* U+0055+0302 -> U+00DB */ 37, + /* U+0055+0303 -> U+0168 */ 157, + /* U+0055+0304 -> U+016A */ 159, + /* U+0055+0306 -> U+016C */ 161, + /* U+0055+0308 -> U+00DC */ 38, + /* U+0055+0309 -> U+1EE6 */ 1381, + /* U+0055+030A -> U+016E */ 163, + /* U+0055+030B -> U+0170 */ 165, + /* U+0055+030C -> U+01D3 */ 200, + /* U+0055+030F -> U+0214 */ 260, + /* U+0055+0311 -> U+0216 */ 262, + /* U+0055+031B -> U+01AF */ 183, + /* U+0055+0323 -> U+1EE4 */ 1379, + /* U+0055+0324 -> U+1E72 */ 1269, + /* U+0055+0328 -> U+0172 */ 167, + /* U+0055+032D -> U+1E76 */ 1273, + /* U+0055+0330 -> U+1E74 */ 1271, + /* U+0056+0303 -> U+1E7C */ 1279, + /* U+0056+0323 -> U+1E7E */ 1281, + /* U+0057+0300 -> U+1E80 */ 1283, + /* U+0057+0301 -> U+1E82 */ 1285, + /* U+0057+0302 -> U+0174 */ 169, + /* U+0057+0307 -> U+1E86 */ 1289, + /* U+0057+0308 -> U+1E84 */ 1287, + /* U+0057+0323 -> U+1E88 */ 1291, + /* U+0058+0307 -> U+1E8A */ 1293, + /* U+0058+0308 -> U+1E8C */ 1295, + /* U+0059+0300 -> U+1EF2 */ 1393, + /* U+0059+0301 -> U+00DD */ 39, + /* U+0059+0302 -> U+0176 */ 171, + /* U+0059+0303 -> U+1EF8 */ 1399, + /* U+0059+0304 -> U+0232 */ 282, + /* U+0059+0307 -> U+1E8E */ 1297, + /* U+0059+0308 -> U+0178 */ 173, + /* U+0059+0309 -> U+1EF6 */ 1397, + /* U+0059+0323 -> U+1EF4 */ 1395, + /* U+005A+0301 -> U+0179 */ 174, + /* U+005A+0302 -> U+1E90 */ 1299, + /* U+005A+0307 -> U+017B */ 176, + /* U+005A+030C -> U+017D */ 178, + /* U+005A+0323 -> U+1E92 */ 1301, + /* U+005A+0331 -> U+1E94 */ 1303, + /* U+0061+0300 -> U+00E0 */ 40, + /* U+0061+0301 -> U+00E1 */ 41, + /* U+0061+0302 -> U+00E2 */ 42, + /* U+0061+0303 -> U+00E3 */ 43, + /* U+0061+0304 -> U+0101 */ 68, + /* U+0061+0306 -> U+0103 */ 70, + /* U+0061+0307 -> U+0227 */ 271, + /* U+0061+0308 -> U+00E4 */ 44, + /* U+0061+0309 -> U+1EA3 */ 1314, + /* U+0061+030A -> U+00E5 */ 45, + /* U+0061+030C -> U+01CE */ 195, + /* U+0061+030F -> U+0201 */ 241, + /* U+0061+0311 -> U+0203 */ 243, + /* U+0061+0323 -> U+1EA1 */ 1312, + /* U+0061+0325 -> U+1E01 */ 1156, + /* U+0061+0328 -> U+0105 */ 72, + /* U+0062+0307 -> U+1E03 */ 1158, + /* U+0062+0323 -> U+1E05 */ 1160, + /* U+0062+0331 -> U+1E07 */ 1162, + /* U+0063+0301 -> U+0107 */ 74, + /* U+0063+0302 -> U+0109 */ 76, + /* U+0063+0307 -> U+010B */ 78, + /* U+0063+030C -> U+010D */ 80, + /* U+0063+0327 -> U+00E7 */ 46, + /* U+0064+0307 -> U+1E0B */ 1166, + /* U+0064+030C -> U+010F */ 82, + /* U+0064+0323 -> U+1E0D */ 1168, + /* U+0064+0327 -> U+1E11 */ 1172, + /* U+0064+032D -> U+1E13 */ 1174, + /* U+0064+0331 -> U+1E0F */ 1170, + /* U+0065+0300 -> U+00E8 */ 47, + /* U+0065+0301 -> U+00E9 */ 48, + /* U+0065+0302 -> U+00EA */ 49, + /* U+0065+0303 -> U+1EBD */ 1340, + /* U+0065+0304 -> U+0113 */ 84, + /* U+0065+0306 -> U+0115 */ 86, + /* U+0065+0307 -> U+0117 */ 88, + /* U+0065+0308 -> U+00EB */ 50, + /* U+0065+0309 -> U+1EBB */ 1338, + /* U+0065+030C -> U+011B */ 92, + /* U+0065+030F -> U+0205 */ 245, + /* U+0065+0311 -> U+0207 */ 247, + /* U+0065+0323 -> U+1EB9 */ 1336, + /* U+0065+0327 -> U+0229 */ 273, + /* U+0065+0328 -> U+0119 */ 90, + /* U+0065+032D -> U+1E19 */ 1180, + /* U+0065+0330 -> U+1E1B */ 1182, + /* U+0066+0307 -> U+1E1F */ 1186, + /* U+0067+0301 -> U+01F5 */ 231, + /* U+0067+0302 -> U+011D */ 94, + /* U+0067+0304 -> U+1E21 */ 1188, + /* U+0067+0306 -> U+011F */ 96, + /* U+0067+0307 -> U+0121 */ 98, + /* U+0067+030C -> U+01E7 */ 217, + /* U+0067+0327 -> U+0123 */ 100, + /* U+0068+0302 -> U+0125 */ 102, + /* U+0068+0307 -> U+1E23 */ 1190, + /* U+0068+0308 -> U+1E27 */ 1194, + /* U+0068+030C -> U+021F */ 269, + /* U+0068+0323 -> U+1E25 */ 1192, + /* U+0068+0327 -> U+1E29 */ 1196, + /* U+0068+032E -> U+1E2B */ 1198, + /* U+0068+0331 -> U+1E96 */ 1305, + /* U+0069+0300 -> U+00EC */ 51, + /* U+0069+0301 -> U+00ED */ 52, + /* U+0069+0302 -> U+00EE */ 53, + /* U+0069+0303 -> U+0129 */ 104, + /* U+0069+0304 -> U+012B */ 106, + /* U+0069+0306 -> U+012D */ 108, + /* U+0069+0308 -> U+00EF */ 54, + /* U+0069+0309 -> U+1EC9 */ 1352, + /* U+0069+030C -> U+01D0 */ 197, + /* U+0069+030F -> U+0209 */ 249, + /* U+0069+0311 -> U+020B */ 251, + /* U+0069+0323 -> U+1ECB */ 1354, + /* U+0069+0328 -> U+012F */ 110, + /* U+0069+0330 -> U+1E2D */ 1200, + /* U+006A+0302 -> U+0135 */ 115, + /* U+006A+030C -> U+01F0 */ 226, + /* U+006B+0301 -> U+1E31 */ 1204, + /* U+006B+030C -> U+01E9 */ 219, + /* U+006B+0323 -> U+1E33 */ 1206, + /* U+006B+0327 -> U+0137 */ 117, + /* U+006B+0331 -> U+1E35 */ 1208, + /* U+006C+0301 -> U+013A */ 119, + /* U+006C+030C -> U+013E */ 123, + /* U+006C+0323 -> U+1E37 */ 1210, + /* U+006C+0327 -> U+013C */ 121, + /* U+006C+032D -> U+1E3D */ 1216, + /* U+006C+0331 -> U+1E3B */ 1214, + /* U+006D+0301 -> U+1E3F */ 1218, + /* U+006D+0307 -> U+1E41 */ 1220, + /* U+006D+0323 -> U+1E43 */ 1222, + /* U+006E+0300 -> U+01F9 */ 233, + /* U+006E+0301 -> U+0144 */ 127, + /* U+006E+0303 -> U+00F1 */ 55, + /* U+006E+0307 -> U+1E45 */ 1224, + /* U+006E+030C -> U+0148 */ 131, + /* U+006E+0323 -> U+1E47 */ 1226, + /* U+006E+0327 -> U+0146 */ 129, + /* U+006E+032D -> U+1E4B */ 1230, + /* U+006E+0331 -> U+1E49 */ 1228, + /* U+006F+0300 -> U+00F2 */ 56, + /* U+006F+0301 -> U+00F3 */ 57, + /* U+006F+0302 -> U+00F4 */ 58, + /* U+006F+0303 -> U+00F5 */ 59, + /* U+006F+0304 -> U+014D */ 134, + /* U+006F+0306 -> U+014F */ 136, + /* U+006F+0307 -> U+022F */ 279, + /* U+006F+0308 -> U+00F6 */ 60, + /* U+006F+0309 -> U+1ECF */ 1358, + /* U+006F+030B -> U+0151 */ 138, + /* U+006F+030C -> U+01D2 */ 199, + /* U+006F+030F -> U+020D */ 253, + /* U+006F+0311 -> U+020F */ 255, + /* U+006F+031B -> U+01A1 */ 182, + /* U+006F+0323 -> U+1ECD */ 1356, + /* U+006F+0328 -> U+01EB */ 221, + /* U+0070+0301 -> U+1E55 */ 1240, + /* U+0070+0307 -> U+1E57 */ 1242, + /* U+0072+0301 -> U+0155 */ 140, + /* U+0072+0307 -> U+1E59 */ 1244, + /* U+0072+030C -> U+0159 */ 144, + /* U+0072+030F -> U+0211 */ 257, + /* U+0072+0311 -> U+0213 */ 259, + /* U+0072+0323 -> U+1E5B */ 1246, + /* U+0072+0327 -> U+0157 */ 142, + /* U+0072+0331 -> U+1E5F */ 1250, + /* U+0073+0301 -> U+015B */ 146, + /* U+0073+0302 -> U+015D */ 148, + /* U+0073+0307 -> U+1E61 */ 1252, + /* U+0073+030C -> U+0161 */ 152, + /* U+0073+0323 -> U+1E63 */ 1254, + /* U+0073+0326 -> U+0219 */ 265, + /* U+0073+0327 -> U+015F */ 150, + /* U+0074+0307 -> U+1E6B */ 1262, + /* U+0074+0308 -> U+1E97 */ 1306, + /* U+0074+030C -> U+0165 */ 156, + /* U+0074+0323 -> U+1E6D */ 1264, + /* U+0074+0326 -> U+021B */ 267, + /* U+0074+0327 -> U+0163 */ 154, + /* U+0074+032D -> U+1E71 */ 1268, + /* U+0074+0331 -> U+1E6F */ 1266, + /* U+0075+0300 -> U+00F9 */ 61, + /* U+0075+0301 -> U+00FA */ 62, + /* U+0075+0302 -> U+00FB */ 63, + /* U+0075+0303 -> U+0169 */ 158, + /* U+0075+0304 -> U+016B */ 160, + /* U+0075+0306 -> U+016D */ 162, + /* U+0075+0308 -> U+00FC */ 64, + /* U+0075+0309 -> U+1EE7 */ 1382, + /* U+0075+030A -> U+016F */ 164, + /* U+0075+030B -> U+0171 */ 166, + /* U+0075+030C -> U+01D4 */ 201, + /* U+0075+030F -> U+0215 */ 261, + /* U+0075+0311 -> U+0217 */ 263, + /* U+0075+031B -> U+01B0 */ 184, + /* U+0075+0323 -> U+1EE5 */ 1380, + /* U+0075+0324 -> U+1E73 */ 1270, + /* U+0075+0328 -> U+0173 */ 168, + /* U+0075+032D -> U+1E77 */ 1274, + /* U+0075+0330 -> U+1E75 */ 1272, + /* U+0076+0303 -> U+1E7D */ 1280, + /* U+0076+0323 -> U+1E7F */ 1282, + /* U+0077+0300 -> U+1E81 */ 1284, + /* U+0077+0301 -> U+1E83 */ 1286, + /* U+0077+0302 -> U+0175 */ 170, + /* U+0077+0307 -> U+1E87 */ 1290, + /* U+0077+0308 -> U+1E85 */ 1288, + /* U+0077+030A -> U+1E98 */ 1307, + /* U+0077+0323 -> U+1E89 */ 1292, + /* U+0078+0307 -> U+1E8B */ 1294, + /* U+0078+0308 -> U+1E8D */ 1296, + /* U+0079+0300 -> U+1EF3 */ 1394, + /* U+0079+0301 -> U+00FD */ 65, + /* U+0079+0302 -> U+0177 */ 172, + /* U+0079+0303 -> U+1EF9 */ 1400, + /* U+0079+0304 -> U+0233 */ 283, + /* U+0079+0307 -> U+1E8F */ 1298, + /* U+0079+0308 -> U+00FF */ 66, + /* U+0079+0309 -> U+1EF7 */ 1398, + /* U+0079+030A -> U+1E99 */ 1308, + /* U+0079+0323 -> U+1EF5 */ 1396, + /* U+007A+0301 -> U+017A */ 175, + /* U+007A+0302 -> U+1E91 */ 1300, + /* U+007A+0307 -> U+017C */ 177, + /* U+007A+030C -> U+017E */ 179, + /* U+007A+0323 -> U+1E93 */ 1302, + /* U+007A+0331 -> U+1E95 */ 1304, + /* U+00A8+0300 -> U+1FED */ 1619, + /* U+00A8+0301 -> U+0385 */ 419, + /* U+00A8+0342 -> U+1FC1 */ 1579, + /* U+00C2+0300 -> U+1EA6 */ 1317, + /* U+00C2+0301 -> U+1EA4 */ 1315, + /* U+00C2+0303 -> U+1EAA */ 1321, + /* U+00C2+0309 -> U+1EA8 */ 1319, + /* U+00C4+0304 -> U+01DE */ 210, + /* U+00C5+0301 -> U+01FA */ 234, + /* U+00C6+0301 -> U+01FC */ 236, + /* U+00C6+0304 -> U+01E2 */ 214, + /* U+00C7+0301 -> U+1E08 */ 1163, + /* U+00CA+0300 -> U+1EC0 */ 1343, + /* U+00CA+0301 -> U+1EBE */ 1341, + /* U+00CA+0303 -> U+1EC4 */ 1347, + /* U+00CA+0309 -> U+1EC2 */ 1345, + /* U+00CF+0301 -> U+1E2E */ 1201, + /* U+00D4+0300 -> U+1ED2 */ 1361, + /* U+00D4+0301 -> U+1ED0 */ 1359, + /* U+00D4+0303 -> U+1ED6 */ 1365, + /* U+00D4+0309 -> U+1ED4 */ 1363, + /* U+00D5+0301 -> U+1E4C */ 1231, + /* U+00D5+0304 -> U+022C */ 276, + /* U+00D5+0308 -> U+1E4E */ 1233, + /* U+00D6+0304 -> U+022A */ 274, + /* U+00D8+0301 -> U+01FE */ 238, + /* U+00DC+0300 -> U+01DB */ 208, + /* U+00DC+0301 -> U+01D7 */ 204, + /* U+00DC+0304 -> U+01D5 */ 202, + /* U+00DC+030C -> U+01D9 */ 206, + /* U+00E2+0300 -> U+1EA7 */ 1318, + /* U+00E2+0301 -> U+1EA5 */ 1316, + /* U+00E2+0303 -> U+1EAB */ 1322, + /* U+00E2+0309 -> U+1EA9 */ 1320, + /* U+00E4+0304 -> U+01DF */ 211, + /* U+00E5+0301 -> U+01FB */ 235, + /* U+00E6+0301 -> U+01FD */ 237, + /* U+00E6+0304 -> U+01E3 */ 215, + /* U+00E7+0301 -> U+1E09 */ 1164, + /* U+00EA+0300 -> U+1EC1 */ 1344, + /* U+00EA+0301 -> U+1EBF */ 1342, + /* U+00EA+0303 -> U+1EC5 */ 1348, + /* U+00EA+0309 -> U+1EC3 */ 1346, + /* U+00EF+0301 -> U+1E2F */ 1202, + /* U+00F4+0300 -> U+1ED3 */ 1362, + /* U+00F4+0301 -> U+1ED1 */ 1360, + /* U+00F4+0303 -> U+1ED7 */ 1366, + /* U+00F4+0309 -> U+1ED5 */ 1364, + /* U+00F5+0301 -> U+1E4D */ 1232, + /* U+00F5+0304 -> U+022D */ 277, + /* U+00F5+0308 -> U+1E4F */ 1234, + /* U+00F6+0304 -> U+022B */ 275, + /* U+00F8+0301 -> U+01FF */ 239, + /* U+00FC+0300 -> U+01DC */ 209, + /* U+00FC+0301 -> U+01D8 */ 205, + /* U+00FC+0304 -> U+01D6 */ 203, + /* U+00FC+030C -> U+01DA */ 207, + /* U+0102+0300 -> U+1EB0 */ 1327, + /* U+0102+0301 -> U+1EAE */ 1325, + /* U+0102+0303 -> U+1EB4 */ 1331, + /* U+0102+0309 -> U+1EB2 */ 1329, + /* U+0103+0300 -> U+1EB1 */ 1328, + /* U+0103+0301 -> U+1EAF */ 1326, + /* U+0103+0303 -> U+1EB5 */ 1332, + /* U+0103+0309 -> U+1EB3 */ 1330, + /* U+0112+0300 -> U+1E14 */ 1175, + /* U+0112+0301 -> U+1E16 */ 1177, + /* U+0113+0300 -> U+1E15 */ 1176, + /* U+0113+0301 -> U+1E17 */ 1178, + /* U+014C+0300 -> U+1E50 */ 1235, + /* U+014C+0301 -> U+1E52 */ 1237, + /* U+014D+0300 -> U+1E51 */ 1236, + /* U+014D+0301 -> U+1E53 */ 1238, + /* U+015A+0307 -> U+1E64 */ 1255, + /* U+015B+0307 -> U+1E65 */ 1256, + /* U+0160+0307 -> U+1E66 */ 1257, + /* U+0161+0307 -> U+1E67 */ 1258, + /* U+0168+0301 -> U+1E78 */ 1275, + /* U+0169+0301 -> U+1E79 */ 1276, + /* U+016A+0308 -> U+1E7A */ 1277, + /* U+016B+0308 -> U+1E7B */ 1278, + /* U+017F+0307 -> U+1E9B */ 1310, + /* U+01A0+0300 -> U+1EDC */ 1371, + /* U+01A0+0301 -> U+1EDA */ 1369, + /* U+01A0+0303 -> U+1EE0 */ 1375, + /* U+01A0+0309 -> U+1EDE */ 1373, + /* U+01A0+0323 -> U+1EE2 */ 1377, + /* U+01A1+0300 -> U+1EDD */ 1372, + /* U+01A1+0301 -> U+1EDB */ 1370, + /* U+01A1+0303 -> U+1EE1 */ 1376, + /* U+01A1+0309 -> U+1EDF */ 1374, + /* U+01A1+0323 -> U+1EE3 */ 1378, + /* U+01AF+0300 -> U+1EEA */ 1385, + /* U+01AF+0301 -> U+1EE8 */ 1383, + /* U+01AF+0303 -> U+1EEE */ 1389, + /* U+01AF+0309 -> U+1EEC */ 1387, + /* U+01AF+0323 -> U+1EF0 */ 1391, + /* U+01B0+0300 -> U+1EEB */ 1386, + /* U+01B0+0301 -> U+1EE9 */ 1384, + /* U+01B0+0303 -> U+1EEF */ 1390, + /* U+01B0+0309 -> U+1EED */ 1388, + /* U+01B0+0323 -> U+1EF1 */ 1392, + /* U+01B7+030C -> U+01EE */ 224, + /* U+01EA+0304 -> U+01EC */ 222, + /* U+01EB+0304 -> U+01ED */ 223, + /* U+0226+0304 -> U+01E0 */ 212, + /* U+0227+0304 -> U+01E1 */ 213, + /* U+0228+0306 -> U+1E1C */ 1183, + /* U+0229+0306 -> U+1E1D */ 1184, + /* U+022E+0304 -> U+0230 */ 280, + /* U+022F+0304 -> U+0231 */ 281, + /* U+0292+030C -> U+01EF */ 225, + /* U+0391+0300 -> U+1FBA */ 1572, + /* U+0391+0301 -> U+0386 */ 420, + /* U+0391+0304 -> U+1FB9 */ 1571, + /* U+0391+0306 -> U+1FB8 */ 1570, + /* U+0391+0313 -> U+1F08 */ 1409, + /* U+0391+0314 -> U+1F09 */ 1410, + /* U+0391+0345 -> U+1FBC */ 1574, + /* U+0395+0300 -> U+1FC8 */ 1585, + /* U+0395+0301 -> U+0388 */ 422, + /* U+0395+0313 -> U+1F18 */ 1423, + /* U+0395+0314 -> U+1F19 */ 1424, + /* U+0397+0300 -> U+1FCA */ 1587, + /* U+0397+0301 -> U+0389 */ 423, + /* U+0397+0313 -> U+1F28 */ 1437, + /* U+0397+0314 -> U+1F29 */ 1438, + /* U+0397+0345 -> U+1FCC */ 1589, + /* U+0399+0300 -> U+1FDA */ 1601, + /* U+0399+0301 -> U+038A */ 424, + /* U+0399+0304 -> U+1FD9 */ 1600, + /* U+0399+0306 -> U+1FD8 */ 1599, + /* U+0399+0308 -> U+03AA */ 429, + /* U+0399+0313 -> U+1F38 */ 1453, + /* U+0399+0314 -> U+1F39 */ 1454, + /* U+039F+0300 -> U+1FF8 */ 1627, + /* U+039F+0301 -> U+038C */ 425, + /* U+039F+0313 -> U+1F48 */ 1467, + /* U+039F+0314 -> U+1F49 */ 1468, + /* U+03A1+0314 -> U+1FEC */ 1618, + /* U+03A5+0300 -> U+1FEA */ 1616, + /* U+03A5+0301 -> U+038E */ 426, + /* U+03A5+0304 -> U+1FE9 */ 1615, + /* U+03A5+0306 -> U+1FE8 */ 1614, + /* U+03A5+0308 -> U+03AB */ 430, + /* U+03A5+0314 -> U+1F59 */ 1481, + /* U+03A9+0300 -> U+1FFA */ 1629, + /* U+03A9+0301 -> U+038F */ 427, + /* U+03A9+0313 -> U+1F68 */ 1493, + /* U+03A9+0314 -> U+1F69 */ 1494, + /* U+03A9+0345 -> U+1FFC */ 1631, + /* U+03AC+0345 -> U+1FB4 */ 1567, + /* U+03AE+0345 -> U+1FC4 */ 1582, + /* U+03B1+0300 -> U+1F70 */ 1501, + /* U+03B1+0301 -> U+03AC */ 431, + /* U+03B1+0304 -> U+1FB1 */ 1564, + /* U+03B1+0306 -> U+1FB0 */ 1563, + /* U+03B1+0313 -> U+1F00 */ 1401, + /* U+03B1+0314 -> U+1F01 */ 1402, + /* U+03B1+0342 -> U+1FB6 */ 1568, + /* U+03B1+0345 -> U+1FB3 */ 1566, + /* U+03B5+0300 -> U+1F72 */ 1503, + /* U+03B5+0301 -> U+03AD */ 432, + /* U+03B5+0313 -> U+1F10 */ 1417, + /* U+03B5+0314 -> U+1F11 */ 1418, + /* U+03B7+0300 -> U+1F74 */ 1505, + /* U+03B7+0301 -> U+03AE */ 433, + /* U+03B7+0313 -> U+1F20 */ 1429, + /* U+03B7+0314 -> U+1F21 */ 1430, + /* U+03B7+0342 -> U+1FC6 */ 1583, + /* U+03B7+0345 -> U+1FC3 */ 1581, + /* U+03B9+0300 -> U+1F76 */ 1507, + /* U+03B9+0301 -> U+03AF */ 434, + /* U+03B9+0304 -> U+1FD1 */ 1594, + /* U+03B9+0306 -> U+1FD0 */ 1593, + /* U+03B9+0308 -> U+03CA */ 436, + /* U+03B9+0313 -> U+1F30 */ 1445, + /* U+03B9+0314 -> U+1F31 */ 1446, + /* U+03B9+0342 -> U+1FD6 */ 1597, + /* U+03BF+0300 -> U+1F78 */ 1509, + /* U+03BF+0301 -> U+03CC */ 438, + /* U+03BF+0313 -> U+1F40 */ 1461, + /* U+03BF+0314 -> U+1F41 */ 1462, + /* U+03C1+0313 -> U+1FE4 */ 1610, + /* U+03C1+0314 -> U+1FE5 */ 1611, + /* U+03C5+0300 -> U+1F7A */ 1511, + /* U+03C5+0301 -> U+03CD */ 439, + /* U+03C5+0304 -> U+1FE1 */ 1607, + /* U+03C5+0306 -> U+1FE0 */ 1606, + /* U+03C5+0308 -> U+03CB */ 437, + /* U+03C5+0313 -> U+1F50 */ 1473, + /* U+03C5+0314 -> U+1F51 */ 1474, + /* U+03C5+0342 -> U+1FE6 */ 1612, + /* U+03C9+0300 -> U+1F7C */ 1513, + /* U+03C9+0301 -> U+03CE */ 440, + /* U+03C9+0313 -> U+1F60 */ 1485, + /* U+03C9+0314 -> U+1F61 */ 1486, + /* U+03C9+0342 -> U+1FF6 */ 1625, + /* U+03C9+0345 -> U+1FF3 */ 1623, + /* U+03CA+0300 -> U+1FD2 */ 1595, + /* U+03CA+0301 -> U+0390 */ 428, + /* U+03CA+0342 -> U+1FD7 */ 1598, + /* U+03CB+0300 -> U+1FE2 */ 1608, + /* U+03CB+0301 -> U+03B0 */ 435, + /* U+03CB+0342 -> U+1FE7 */ 1613, + /* U+03CE+0345 -> U+1FF4 */ 1624, + /* U+03D2+0301 -> U+03D3 */ 444, + /* U+03D2+0308 -> U+03D4 */ 445, + /* U+0406+0308 -> U+0407 */ 457, + /* U+0410+0306 -> U+04D0 */ 479, + /* U+0410+0308 -> U+04D2 */ 481, + /* U+0413+0301 -> U+0403 */ 456, + /* U+0415+0300 -> U+0400 */ 454, + /* U+0415+0306 -> U+04D6 */ 483, + /* U+0415+0308 -> U+0401 */ 455, + /* U+0416+0306 -> U+04C1 */ 477, + /* U+0416+0308 -> U+04DC */ 487, + /* U+0417+0308 -> U+04DE */ 489, + /* U+0418+0300 -> U+040D */ 459, + /* U+0418+0304 -> U+04E2 */ 491, + /* U+0418+0306 -> U+0419 */ 461, + /* U+0418+0308 -> U+04E4 */ 493, + /* U+041A+0301 -> U+040C */ 458, + /* U+041E+0308 -> U+04E6 */ 495, + /* U+0423+0304 -> U+04EE */ 501, + /* U+0423+0306 -> U+040E */ 460, + /* U+0423+0308 -> U+04F0 */ 503, + /* U+0423+030B -> U+04F2 */ 505, + /* U+0427+0308 -> U+04F4 */ 507, + /* U+042B+0308 -> U+04F8 */ 509, + /* U+042D+0308 -> U+04EC */ 499, + /* U+0430+0306 -> U+04D1 */ 480, + /* U+0430+0308 -> U+04D3 */ 482, + /* U+0433+0301 -> U+0453 */ 465, + /* U+0435+0300 -> U+0450 */ 463, + /* U+0435+0306 -> U+04D7 */ 484, + /* U+0435+0308 -> U+0451 */ 464, + /* U+0436+0306 -> U+04C2 */ 478, + /* U+0436+0308 -> U+04DD */ 488, + /* U+0437+0308 -> U+04DF */ 490, + /* U+0438+0300 -> U+045D */ 468, + /* U+0438+0304 -> U+04E3 */ 492, + /* U+0438+0306 -> U+0439 */ 462, + /* U+0438+0308 -> U+04E5 */ 494, + /* U+043A+0301 -> U+045C */ 467, + /* U+043E+0308 -> U+04E7 */ 496, + /* U+0443+0304 -> U+04EF */ 502, + /* U+0443+0306 -> U+045E */ 469, + /* U+0443+0308 -> U+04F1 */ 504, + /* U+0443+030B -> U+04F3 */ 506, + /* U+0447+0308 -> U+04F5 */ 508, + /* U+044B+0308 -> U+04F9 */ 510, + /* U+044D+0308 -> U+04ED */ 500, + /* U+0456+0308 -> U+0457 */ 466, + /* U+0474+030F -> U+0476 */ 470, + /* U+0475+030F -> U+0477 */ 471, + /* U+04D8+0308 -> U+04DA */ 485, + /* U+04D9+0308 -> U+04DB */ 486, + /* U+04E8+0308 -> U+04EA */ 497, + /* U+04E9+0308 -> U+04EB */ 498, + /* U+0627+0653 -> U+0622 */ 574, + /* U+0627+0654 -> U+0623 */ 575, + /* U+0627+0655 -> U+0625 */ 577, + /* U+0648+0654 -> U+0624 */ 576, + /* U+064A+0654 -> U+0626 */ 578, + /* U+06C1+0654 -> U+06C2 */ 606, + /* U+06D2+0654 -> U+06D3 */ 607, + /* U+06D5+0654 -> U+06C0 */ 605, + /* U+0928+093C -> U+0929 */ 751, + /* U+0930+093C -> U+0931 */ 752, + /* U+0933+093C -> U+0934 */ 753, + /* U+09C7+09BE -> U+09CB */ 769, + /* U+09C7+09D7 -> U+09CC */ 770, + /* U+0B47+0B3E -> U+0B4B */ 788, + /* U+0B47+0B56 -> U+0B48 */ 787, + /* U+0B47+0B57 -> U+0B4C */ 789, + /* U+0B92+0BD7 -> U+0B94 */ 793, + /* U+0BC6+0BBE -> U+0BCA */ 794, + /* U+0BC6+0BD7 -> U+0BCC */ 796, + /* U+0BC7+0BBE -> U+0BCB */ 795, + /* U+0C46+0C56 -> U+0C48 */ 799, + /* U+0CBF+0CD5 -> U+0CC0 */ 804, + /* U+0CC6+0CC2 -> U+0CCA */ 807, + /* U+0CC6+0CD5 -> U+0CC7 */ 805, + /* U+0CC6+0CD6 -> U+0CC8 */ 806, + /* U+0CCA+0CD5 -> U+0CCB */ 808, + /* U+0D46+0D3E -> U+0D4A */ 812, + /* U+0D46+0D57 -> U+0D4C */ 814, + /* U+0D47+0D3E -> U+0D4B */ 813, + /* U+0DD9+0DCA -> U+0DDA */ 817, + /* U+0DD9+0DCF -> U+0DDC */ 818, + /* U+0DD9+0DDF -> U+0DDE */ 820, + /* U+0DDC+0DCA -> U+0DDD */ 819, + /* U+1025+102E -> U+1026 */ 878, + /* U+1B05+1B35 -> U+1B06 */ 938, + /* U+1B07+1B35 -> U+1B08 */ 939, + /* U+1B09+1B35 -> U+1B0A */ 940, + /* U+1B0B+1B35 -> U+1B0C */ 941, + /* U+1B0D+1B35 -> U+1B0E */ 942, + /* U+1B11+1B35 -> U+1B12 */ 943, + /* U+1B3A+1B35 -> U+1B3B */ 945, + /* U+1B3C+1B35 -> U+1B3D */ 946, + /* U+1B3E+1B35 -> U+1B40 */ 947, + /* U+1B3F+1B35 -> U+1B41 */ 948, + /* U+1B42+1B35 -> U+1B43 */ 949, + /* U+1E36+0304 -> U+1E38 */ 1211, + /* U+1E37+0304 -> U+1E39 */ 1212, + /* U+1E5A+0304 -> U+1E5C */ 1247, + /* U+1E5B+0304 -> U+1E5D */ 1248, + /* U+1E62+0307 -> U+1E68 */ 1259, + /* U+1E63+0307 -> U+1E69 */ 1260, + /* U+1EA0+0302 -> U+1EAC */ 1323, + /* U+1EA0+0306 -> U+1EB6 */ 1333, + /* U+1EA1+0302 -> U+1EAD */ 1324, + /* U+1EA1+0306 -> U+1EB7 */ 1334, + /* U+1EB8+0302 -> U+1EC6 */ 1349, + /* U+1EB9+0302 -> U+1EC7 */ 1350, + /* U+1ECC+0302 -> U+1ED8 */ 1367, + /* U+1ECD+0302 -> U+1ED9 */ 1368, + /* U+1F00+0300 -> U+1F02 */ 1403, + /* U+1F00+0301 -> U+1F04 */ 1405, + /* U+1F00+0342 -> U+1F06 */ 1407, + /* U+1F00+0345 -> U+1F80 */ 1515, + /* U+1F01+0300 -> U+1F03 */ 1404, + /* U+1F01+0301 -> U+1F05 */ 1406, + /* U+1F01+0342 -> U+1F07 */ 1408, + /* U+1F01+0345 -> U+1F81 */ 1516, + /* U+1F02+0345 -> U+1F82 */ 1517, + /* U+1F03+0345 -> U+1F83 */ 1518, + /* U+1F04+0345 -> U+1F84 */ 1519, + /* U+1F05+0345 -> U+1F85 */ 1520, + /* U+1F06+0345 -> U+1F86 */ 1521, + /* U+1F07+0345 -> U+1F87 */ 1522, + /* U+1F08+0300 -> U+1F0A */ 1411, + /* U+1F08+0301 -> U+1F0C */ 1413, + /* U+1F08+0342 -> U+1F0E */ 1415, + /* U+1F08+0345 -> U+1F88 */ 1523, + /* U+1F09+0300 -> U+1F0B */ 1412, + /* U+1F09+0301 -> U+1F0D */ 1414, + /* U+1F09+0342 -> U+1F0F */ 1416, + /* U+1F09+0345 -> U+1F89 */ 1524, + /* U+1F0A+0345 -> U+1F8A */ 1525, + /* U+1F0B+0345 -> U+1F8B */ 1526, + /* U+1F0C+0345 -> U+1F8C */ 1527, + /* U+1F0D+0345 -> U+1F8D */ 1528, + /* U+1F0E+0345 -> U+1F8E */ 1529, + /* U+1F0F+0345 -> U+1F8F */ 1530, + /* U+1F10+0300 -> U+1F12 */ 1419, + /* U+1F10+0301 -> U+1F14 */ 1421, + /* U+1F11+0300 -> U+1F13 */ 1420, + /* U+1F11+0301 -> U+1F15 */ 1422, + /* U+1F18+0300 -> U+1F1A */ 1425, + /* U+1F18+0301 -> U+1F1C */ 1427, + /* U+1F19+0300 -> U+1F1B */ 1426, + /* U+1F19+0301 -> U+1F1D */ 1428, + /* U+1F20+0300 -> U+1F22 */ 1431, + /* U+1F20+0301 -> U+1F24 */ 1433, + /* U+1F20+0342 -> U+1F26 */ 1435, + /* U+1F20+0345 -> U+1F90 */ 1531, + /* U+1F21+0300 -> U+1F23 */ 1432, + /* U+1F21+0301 -> U+1F25 */ 1434, + /* U+1F21+0342 -> U+1F27 */ 1436, + /* U+1F21+0345 -> U+1F91 */ 1532, + /* U+1F22+0345 -> U+1F92 */ 1533, + /* U+1F23+0345 -> U+1F93 */ 1534, + /* U+1F24+0345 -> U+1F94 */ 1535, + /* U+1F25+0345 -> U+1F95 */ 1536, + /* U+1F26+0345 -> U+1F96 */ 1537, + /* U+1F27+0345 -> U+1F97 */ 1538, + /* U+1F28+0300 -> U+1F2A */ 1439, + /* U+1F28+0301 -> U+1F2C */ 1441, + /* U+1F28+0342 -> U+1F2E */ 1443, + /* U+1F28+0345 -> U+1F98 */ 1539, + /* U+1F29+0300 -> U+1F2B */ 1440, + /* U+1F29+0301 -> U+1F2D */ 1442, + /* U+1F29+0342 -> U+1F2F */ 1444, + /* U+1F29+0345 -> U+1F99 */ 1540, + /* U+1F2A+0345 -> U+1F9A */ 1541, + /* U+1F2B+0345 -> U+1F9B */ 1542, + /* U+1F2C+0345 -> U+1F9C */ 1543, + /* U+1F2D+0345 -> U+1F9D */ 1544, + /* U+1F2E+0345 -> U+1F9E */ 1545, + /* U+1F2F+0345 -> U+1F9F */ 1546, + /* U+1F30+0300 -> U+1F32 */ 1447, + /* U+1F30+0301 -> U+1F34 */ 1449, + /* U+1F30+0342 -> U+1F36 */ 1451, + /* U+1F31+0300 -> U+1F33 */ 1448, + /* U+1F31+0301 -> U+1F35 */ 1450, + /* U+1F31+0342 -> U+1F37 */ 1452, + /* U+1F38+0300 -> U+1F3A */ 1455, + /* U+1F38+0301 -> U+1F3C */ 1457, + /* U+1F38+0342 -> U+1F3E */ 1459, + /* U+1F39+0300 -> U+1F3B */ 1456, + /* U+1F39+0301 -> U+1F3D */ 1458, + /* U+1F39+0342 -> U+1F3F */ 1460, + /* U+1F40+0300 -> U+1F42 */ 1463, + /* U+1F40+0301 -> U+1F44 */ 1465, + /* U+1F41+0300 -> U+1F43 */ 1464, + /* U+1F41+0301 -> U+1F45 */ 1466, + /* U+1F48+0300 -> U+1F4A */ 1469, + /* U+1F48+0301 -> U+1F4C */ 1471, + /* U+1F49+0300 -> U+1F4B */ 1470, + /* U+1F49+0301 -> U+1F4D */ 1472, + /* U+1F50+0300 -> U+1F52 */ 1475, + /* U+1F50+0301 -> U+1F54 */ 1477, + /* U+1F50+0342 -> U+1F56 */ 1479, + /* U+1F51+0300 -> U+1F53 */ 1476, + /* U+1F51+0301 -> U+1F55 */ 1478, + /* U+1F51+0342 -> U+1F57 */ 1480, + /* U+1F59+0300 -> U+1F5B */ 1482, + /* U+1F59+0301 -> U+1F5D */ 1483, + /* U+1F59+0342 -> U+1F5F */ 1484, + /* U+1F60+0300 -> U+1F62 */ 1487, + /* U+1F60+0301 -> U+1F64 */ 1489, + /* U+1F60+0342 -> U+1F66 */ 1491, + /* U+1F60+0345 -> U+1FA0 */ 1547, + /* U+1F61+0300 -> U+1F63 */ 1488, + /* U+1F61+0301 -> U+1F65 */ 1490, + /* U+1F61+0342 -> U+1F67 */ 1492, + /* U+1F61+0345 -> U+1FA1 */ 1548, + /* U+1F62+0345 -> U+1FA2 */ 1549, + /* U+1F63+0345 -> U+1FA3 */ 1550, + /* U+1F64+0345 -> U+1FA4 */ 1551, + /* U+1F65+0345 -> U+1FA5 */ 1552, + /* U+1F66+0345 -> U+1FA6 */ 1553, + /* U+1F67+0345 -> U+1FA7 */ 1554, + /* U+1F68+0300 -> U+1F6A */ 1495, + /* U+1F68+0301 -> U+1F6C */ 1497, + /* U+1F68+0342 -> U+1F6E */ 1499, + /* U+1F68+0345 -> U+1FA8 */ 1555, + /* U+1F69+0300 -> U+1F6B */ 1496, + /* U+1F69+0301 -> U+1F6D */ 1498, + /* U+1F69+0342 -> U+1F6F */ 1500, + /* U+1F69+0345 -> U+1FA9 */ 1556, + /* U+1F6A+0345 -> U+1FAA */ 1557, + /* U+1F6B+0345 -> U+1FAB */ 1558, + /* U+1F6C+0345 -> U+1FAC */ 1559, + /* U+1F6D+0345 -> U+1FAD */ 1560, + /* U+1F6E+0345 -> U+1FAE */ 1561, + /* U+1F6F+0345 -> U+1FAF */ 1562, + /* U+1F70+0345 -> U+1FB2 */ 1565, + /* U+1F74+0345 -> U+1FC2 */ 1580, + /* U+1F7C+0345 -> U+1FF2 */ 1622, + /* U+1FB6+0345 -> U+1FB7 */ 1569, + /* U+1FBF+0300 -> U+1FCD */ 1590, + /* U+1FBF+0301 -> U+1FCE */ 1591, + /* U+1FBF+0342 -> U+1FCF */ 1592, + /* U+1FC6+0345 -> U+1FC7 */ 1584, + /* U+1FF6+0345 -> U+1FF7 */ 1626, + /* U+1FFE+0300 -> U+1FDD */ 1603, + /* U+1FFE+0301 -> U+1FDE */ 1604, + /* U+1FFE+0342 -> U+1FDF */ 1605, + /* U+2190+0338 -> U+219A */ 1836, + /* U+2192+0338 -> U+219B */ 1837, + /* U+2194+0338 -> U+21AE */ 1838, + /* U+21D0+0338 -> U+21CD */ 1839, + /* U+21D2+0338 -> U+21CF */ 1841, + /* U+21D4+0338 -> U+21CE */ 1840, + /* U+2203+0338 -> U+2204 */ 1842, + /* U+2208+0338 -> U+2209 */ 1843, + /* U+220B+0338 -> U+220C */ 1844, + /* U+2223+0338 -> U+2224 */ 1845, + /* U+2225+0338 -> U+2226 */ 1846, + /* U+223C+0338 -> U+2241 */ 1851, + /* U+2243+0338 -> U+2244 */ 1852, + /* U+2245+0338 -> U+2247 */ 1853, + /* U+2248+0338 -> U+2249 */ 1854, + /* U+224D+0338 -> U+226D */ 1857, + /* U+2261+0338 -> U+2262 */ 1856, + /* U+2264+0338 -> U+2270 */ 1860, + /* U+2265+0338 -> U+2271 */ 1861, + /* U+2272+0338 -> U+2274 */ 1862, + /* U+2273+0338 -> U+2275 */ 1863, + /* U+2276+0338 -> U+2278 */ 1864, + /* U+2277+0338 -> U+2279 */ 1865, + /* U+227A+0338 -> U+2280 */ 1866, + /* U+227B+0338 -> U+2281 */ 1867, + /* U+227C+0338 -> U+22E0 */ 1876, + /* U+227D+0338 -> U+22E1 */ 1877, + /* U+2282+0338 -> U+2284 */ 1868, + /* U+2283+0338 -> U+2285 */ 1869, + /* U+2286+0338 -> U+2288 */ 1870, + /* U+2287+0338 -> U+2289 */ 1871, + /* U+2291+0338 -> U+22E2 */ 1878, + /* U+2292+0338 -> U+22E3 */ 1879, + /* U+22A2+0338 -> U+22AC */ 1872, + /* U+22A8+0338 -> U+22AD */ 1873, + /* U+22A9+0338 -> U+22AE */ 1874, + /* U+22AB+0338 -> U+22AF */ 1875, + /* U+22B2+0338 -> U+22EA */ 1880, + /* U+22B3+0338 -> U+22EB */ 1881, + /* U+22B4+0338 -> U+22EC */ 1882, + /* U+22B5+0338 -> U+22ED */ 1883, + /* U+3046+3099 -> U+3094 */ 2321, + /* U+304B+3099 -> U+304C */ 2296, + /* U+304D+3099 -> U+304E */ 2297, + /* U+304F+3099 -> U+3050 */ 2298, + /* U+3051+3099 -> U+3052 */ 2299, + /* U+3053+3099 -> U+3054 */ 2300, + /* U+3055+3099 -> U+3056 */ 2301, + /* U+3057+3099 -> U+3058 */ 2302, + /* U+3059+3099 -> U+305A */ 2303, + /* U+305B+3099 -> U+305C */ 2304, + /* U+305D+3099 -> U+305E */ 2305, + /* U+305F+3099 -> U+3060 */ 2306, + /* U+3061+3099 -> U+3062 */ 2307, + /* U+3064+3099 -> U+3065 */ 2308, + /* U+3066+3099 -> U+3067 */ 2309, + /* U+3068+3099 -> U+3069 */ 2310, + /* U+306F+3099 -> U+3070 */ 2311, + /* U+306F+309A -> U+3071 */ 2312, + /* U+3072+3099 -> U+3073 */ 2313, + /* U+3072+309A -> U+3074 */ 2314, + /* U+3075+3099 -> U+3076 */ 2315, + /* U+3075+309A -> U+3077 */ 2316, + /* U+3078+3099 -> U+3079 */ 2317, + /* U+3078+309A -> U+307A */ 2318, + /* U+307B+3099 -> U+307C */ 2319, + /* U+307B+309A -> U+307D */ 2320, + /* U+309D+3099 -> U+309E */ 2326, + /* U+30A6+3099 -> U+30F4 */ 2353, + /* U+30AB+3099 -> U+30AC */ 2328, + /* U+30AD+3099 -> U+30AE */ 2329, + /* U+30AF+3099 -> U+30B0 */ 2330, + /* U+30B1+3099 -> U+30B2 */ 2331, + /* U+30B3+3099 -> U+30B4 */ 2332, + /* U+30B5+3099 -> U+30B6 */ 2333, + /* U+30B7+3099 -> U+30B8 */ 2334, + /* U+30B9+3099 -> U+30BA */ 2335, + /* U+30BB+3099 -> U+30BC */ 2336, + /* U+30BD+3099 -> U+30BE */ 2337, + /* U+30BF+3099 -> U+30C0 */ 2338, + /* U+30C1+3099 -> U+30C2 */ 2339, + /* U+30C4+3099 -> U+30C5 */ 2340, + /* U+30C6+3099 -> U+30C7 */ 2341, + /* U+30C8+3099 -> U+30C9 */ 2342, + /* U+30CF+3099 -> U+30D0 */ 2343, + /* U+30CF+309A -> U+30D1 */ 2344, + /* U+30D2+3099 -> U+30D3 */ 2345, + /* U+30D2+309A -> U+30D4 */ 2346, + /* U+30D5+3099 -> U+30D6 */ 2347, + /* U+30D5+309A -> U+30D7 */ 2348, + /* U+30D8+3099 -> U+30D9 */ 2349, + /* U+30D8+309A -> U+30DA */ 2350, + /* U+30DB+3099 -> U+30DC */ 2351, + /* U+30DB+309A -> U+30DD */ 2352, + /* U+30EF+3099 -> U+30F7 */ 2354, + /* U+30F0+3099 -> U+30F8 */ 2355, + /* U+30F1+3099 -> U+30F9 */ 2356, + /* U+30F2+3099 -> U+30FA */ 2357, + /* U+30FD+3099 -> U+30FE */ 2358, + /* U+105D2+0307 -> U+105C9 */ 4599, + /* U+105DA+0307 -> U+105E4 */ 4600, + /* U+11099+110BA -> U+1109A */ 4697, + /* U+1109B+110BA -> U+1109C */ 4698, + /* U+110A5+110BA -> U+110AB */ 4699, + /* U+11131+11127 -> U+1112E */ 4705, + /* U+11132+11127 -> U+1112F */ 4706, + /* U+11347+1133E -> U+1134B */ 4718, + /* U+11347+11357 -> U+1134C */ 4719, + /* U+11382+113C9 -> U+11383 */ 4733, + /* U+11384+113BB -> U+11385 */ 4734, + /* U+1138B+113C2 -> U+1138E */ 4735, + /* U+11390+113C9 -> U+11391 */ 4736, + /* U+113C2+113B8 -> U+113C7 */ 4738, + /* U+113C2+113C2 -> U+113C5 */ 4737, + /* U+113C2+113C9 -> U+113C8 */ 4739, + /* U+114B9+114B0 -> U+114BC */ 4747, + /* U+114B9+114BA -> U+114BB */ 4746, + /* U+114B9+114BD -> U+114BE */ 4748, + /* U+115B8+115AF -> U+115BA */ 4751, + /* U+115B9+115AF -> U+115BB */ 4752, + /* U+11935+11930 -> U+11938 */ 4761, + /* U+1611E+1611E -> U+16121 */ 4776, + /* U+1611E+1611F -> U+16123 */ 4778, + /* U+1611E+16120 -> U+16125 */ 4780, + /* U+1611E+16129 -> U+16122 */ 4777, + /* U+16121+1611F -> U+16126 */ 4781, + /* U+16121+16120 -> U+16128 */ 4783, + /* U+16122+1611F -> U+16127 */ 4782, + /* U+16129+1611F -> U+16124 */ 4779, + /* U+16D63+16D67 -> U+16D69 */ 4798, + /* U+16D67+16D67 -> U+16D68 */ 4797, + /* U+16D69+16D67 -> U+16D6A */ 4799 +}; + +/* Perfect hash function for recomposition */ +static int +Recomp_hash_func(const void *key) +{ + static const int16 h[1923] = { + -109, -96, 32767, 0, -844, -182, -292, 32767, + 830, 793, 794, 665, 0, -9, 32767, 32767, + 32767, 32767, 32767, 428, 32767, 32767, 32767, 502, + 0, 32767, -230, 144, 356, -76, 0, 243, + 665, 32767, 32767, -1003, 244, 0, 32767, 32767, + 573, 246, 125, 32767, 32767, 32767, 0, 32767, + 32767, 32767, 32767, 0, 245, 32767, 723, 32767, + 0, 889, 32767, 32767, 32767, 0, 32767, 32767, + 0, 173, 157, 1215, 254, 255, -126, 0, + 0, 504, 459, -11, 238, -188, 722, 247, + 260, 32767, -184, -6, 2102, -578, 32767, 32767, + -598, -670, 260, 19, 32767, -472, 32767, 664, + 511, 0, 32767, 345, 291, 0, -370, 176, + 32767, 1017, -139, -519, -30, 0, -24, -23, + 481, -253, -1813, 32767, 0, 935, 32767, 32767, + -443, 32767, 773, 32767, 32767, 32767, -507, 427, + 0, 32767, 899, 32767, 32767, 277, 0, 32767, + 32767, 0, 842, 854, 0, 32767, 936, 621, + -195, 32767, 0, 32767, 707, 268, 32767, 32767, + 435, 32767, 32767, 32767, 0, 267, 88, 72, + 32767, 487, 32767, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 875, -312, 32767, 483, 875, + 270, 89, 32767, 483, 32767, 32767, 32767, 32767, + 708, 273, 2053, -63, -242, -479, 32767, 352, + 32767, 32767, 0, 560, 544, 32767, 32767, 32767, + 0, 0, 32767, 0, 32767, 32767, 32767, 525, + 274, 32767, 404, 386, 518, 32767, -357, 32767, + -45, 1154, 276, 32767, 149, 0, 277, 714, + 313, 32767, 32767, 32767, 32767, 32767, 841, 460, + 431, 32767, 32767, -49, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 876, 280, 281, 131, 388, + 283, 32767, 1125, 32767, 695, 712, 32767, 0, + 713, 1732, 0, 32767, 0, 231, 32767, 0, + 32767, -755, 32767, 32767, 32767, 435, 32767, 0, + 951, 952, 32767, 32767, 464, 867, 1298, 0, + 660, -55, 0, 292, 663, 118, 661, -722, + 435, 816, 328, 0, 323, 323, -258, -684, + 2114, 0, 302, 0, 32767, 32767, 1607, 32767, + 0, 32767, 32767, 0, 810, 32767, -543, -5, + 515, 32767, 0, 877, 304, 32767, 472, 32767, + 683, -549, 258, 285, -904, 32767, 148, 1202, + 1044, 0, 32767, 32767, 659, 1395, 905, 32767, + 32767, 32767, -626, 32767, 32767, 32767, 32767, 672, + 0, 32767, -139, 32767, 32767, 0, 0, 660, + 1, 32767, -955, -293, 616, 391, 632, -126, + 32767, 32767, 1610, -166, 754, 324, 32767, 32767, + 931, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 0, 32767, 32767, 302, 391, 32767, 32767, + 516, 32767, 32767, 1131, 670, 544, 308, 286, + 0, 0, 32767, 32767, 531, -629, -35, 0, + 6, -63, 485, 0, 0, -486, -58, 0, + 0, 38, 470, -20, 0, 32767, 0, 0, + 956, 32767, 0, 294, -759, 0, 32767, 32767, + -362, 73, 316, 588, 314, 32767, 609, 0, + 318, 32767, 32767, 32767, -759, 1466, -212, 32767, + 1910, 226, 653, 32767, 219, 32767, 32767, 0, + 0, 32767, 1045, -6, -6, 32767, 0, 163, + 0, 0, -9, 879, -369, 32767, -18, 321, + 322, 32767, 32767, -449, 1082, 324, 57, 32767, + -403, 252, 697, 0, 491, 552, 0, 32767, + 32767, 32767, 864, 32767, 0, 32767, 929, -582, + 32767, 32767, 32767, 1521, 32767, 32767, 32767, 212, + 326, -542, 332, 333, 334, -490, 692, 336, + 32767, 337, 338, 31, 0, 714, 348, 34, + 342, 32767, 1602, 32767, 687, 143, 32767, 0, + 32767, 32767, 0, 32767, 196, -21, 32767, 32767, + -4, 32767, 32767, 880, -211, 203, 32767, 1078, + 83, 1661, 32767, 32767, 283, 787, 348, 32767, + 0, -464, 0, 32767, 725, -431, -811, -322, + 7, 32767, -315, 267, 694, -2103, 12, 247, + 13, 692, 32767, -1593, 32767, 15, 32767, 32767, + 830, 0, 623, 354, 32767, 32767, -154, 0, + 264, -712, 32767, 357, 32767, 32767, 220, -242, + 32767, 921, 905, 32767, -1184, 549, 32767, 19, + 319, 32767, 551, 32767, 1307, 0, 32767, 32767, + 32767, 0, 566, 881, 822, 936, 326, 89, + -313, 32767, 250, 0, 359, 360, 32767, 32767, + 32767, 32767, -575, 20, 32767, 98, 23, 32767, + 287, 744, 124, 1027, 32767, 0, 564, 0, + -548, -497, 982, 32767, 32767, 32767, 32767, 32767, + 35, 316, -1859, 343, 364, 786, 0, 32767, + 366, 4, 0, 753, 581, 524, 270, 686, + 0, -382, 32767, -1189, 0, 747, 32767, 363, + 32767, 32767, -1782, 32767, 28, 32767, 677, 452, + 210, 0, 884, 882, -258, 32767, -1099, -222, + 32767, 32767, 32767, 32767, 373, 671, 32767, 311, + 32767, 370, 32767, -831, 101, 32, 35, 36, + -1159, 930, 38, 39, -148, -148, 32767, 32767, + -150, -803, 1185, 675, 32767, -152, 32767, 0, + 633, 467, -279, 827, 32767, 1273, -410, 136, + 32767, 527, 842, 397, 32767, 1149, 376, 45, + 2221, 20, 0, -421, 47, 925, 0, 363, + 368, -384, 0, 32767, -230, 32767, -532, 32767, + 32767, 32767, 0, 32767, 634, 219, -6, 397, + 32767, 32767, 692, 385, 361, 483, 526, 32767, + 0, 32767, 628, 728, 2167, 51, 892, 32767, + -326, -595, 54, 55, 32767, 825, 0, 0, + 933, 32767, 32767, 32767, 828, 32767, 32767, 883, + -144, 32767, 32767, 32767, 933, 0, 0, 209, + 1580, 790, 0, 0, 32767, 32767, 32767, 730, + 731, 32767, 58, 57, 457, 557, 32767, 59, + 60, 0, -1438, 32767, 1016, 32767, 1344, 683, + 32767, 0, 32767, 32767, 32767, 32767, 32767, 558, + 45, 32767, 0, 32767, 0, 0, 843, 0, + 32767, 0, 503, 62, 488, 600, -395, -328, + 69, 566, -355, 1027, -737, -72, -606, 32767, + 74, 32767, 32767, 1144, 32767, -75, 32767, 884, + -144, 32767, 22, 598, 32767, 792, 32767, 32767, + 32767, 32767, 32767, -336, 32767, 32767, 0, 45, + 0, 32767, 658, 637, 78, 95, -962, 0, + 0, 32767, 256, 0, -247, -201, 32767, 32767, + 447, 0, 0, 0, 32767, 445, 806, 860, + -39, 74, 32767, -6, 32767, 529, 32767, 700, + 307, 179, 0, 893, 32767, 835, 0, -29, + 32767, 32767, 32767, 32767, -754, 32767, 32767, 32767, + -702, -227, -55, 0, 517, -196, 32767, 784, + 177, 0, -1082, 597, -166, 797, 32767, 32767, + 613, 32767, 1211, 32767, -283, 126, 32767, 83, + 526, -1584, 533, 172, 950, 0, 0, 32767, + 32767, -1767, -88, 32767, 87, -1289, 773, 953, + 1131, 0, 0, 32767, 1374, 0, 32767, 32767, + 32767, 798, 32767, 0, 1547, 158, 613, 32767, + 32767, -822, 32767, 88, 473, 474, 378, 89, + 940, 659, 352, -270, 0, -1015, 477, 32767, + 901, 91, 1068, 32767, 0, 0, 32767, 32767, + 0, 32767, 461, 404, 32767, 46, -65, 32767, + 32767, 815, 822, 32767, 32767, 32767, 406, 925, + 338, -487, 0, 97, 438, -464, 32767, 98, + 0, 0, 1113, 0, -416, 0, 32767, 0, + -35, 0, 180, 413, 32767, 32767, 0, -219, + 568, 175, 0, 0, 32767, 503, 0, 32767, + 528, 32767, 32767, -464, 733, 140, 106, 101, + 171, 32767, 109, 110, 597, 170, 32767, 113, + 76, 103, 32767, 115, 559, 116, 32767, -213, + 32767, 0, 597, 823, 32767, 801, 32767, 479, + 803, 631, 723, 32767, 538, -394, 468, -200, + 411, 29, 32767, 32767, -1347, 361, 32767, -458, + 655, 32767, 32767, 32767, -791, 0, 32767, 540, + 541, 32767, 32767, -14, 959, 32767, 0, 462, + 32767, 802, 32767, 32767, 846, 734, 32767, 32767, + 735, 32767, 32767, 32767, 32767, 32767, 0, 32767, + 32767, -685, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 44, 32767, 0, 807, 131, 349, 0, + 0, 7, -94, 423, 0, 529, 32767, 32767, + 32767, 286, 0, 32767, -145, 400, 281, 445, + 32767, 122, 32767, -300, 600, 571, 769, 945, + 518, 0, 461, 32767, -254, 32767, -423, -534, + 462, 396, 0, 886, 425, -956, 809, 145, + 573, 810, 0, 401, 0, -1069, 0, 151, + 1011, 0, 0, 81, 32767, -411, 0, -687, + 859, 451, -1447, 132, 32767, 32767, 32767, 32767, + -154, 32, 32767, 32767, 32767, 32767, 0, 32767, + 32767, 32767, 37, 408, 0, 811, 326, 32767, + 0, -374, 32767, -184, 741, -376, 91, 134, + 32767, 486, 135, -40, 579, 373, 32767, 547, + 32767, 32767, 32767, 32767, -259, 873, 0, 0, + 0, 825, -373, 0, 32767, 0, 0, 308, + 340, -373, 32767, 0, 0, 32767, -1259, 32767, + 742, 32767, 643, 139, 144, 349, -79, 147, + 148, 32767, 149, 732, 425, -219, 152, -446, + 556, 143, 32767, 155, 165, -1314, 0, 888, + 439, 32767, 0, 0, 0, 813, 405, 29, + 32767, 6, 0, 0, 743, 32767, 1902, 158, + 159, 32767, 381, 0, -102, 196, 0, 769, + -419, -596, 0, 782, 162, 32767, 32767, -580, + 32767, 32767, 32767, 32767, 1126, 32767, 32767, 412, + 32767, 814, 824, 32767, 32767, 0, 32767, 32767, + 744, 32767, 32767, 746, 0, 1480, 167, 0, + 1189, 32767, 32767, 168, 169, 32767, 0, 32767, + 906, 32767, 32767, 32767, 32767, 32767, 32767, 601, + 32767, 32767, -278, 0, 32767, 1261, 414, 32767, + 32767, 32767, 32767, 375, 378, 589, 644, 750, + 751, 937, 32767, 590, 32767, 591, 32767, 171, + 172, 32767, 32767, 32767, 32767, 1195, 32767, 32767, + 721, 0, 0, -505, -14, 6, 0, 0, + 0, 1058, -718, 99, 0, 372, 327, 32767, + 729, -166, 32767, 0, 173, -939, 175, 592, + 177, 576, 32767, 213, 179, 0, 0, 514, + 620, 32767, 32767, 32767, 32767, 0, 32767, 32767, + 958, -240, 0, -840, 32767, 379, 32767, 0, + 0, 752, 673, -432, 159, -877, 32767, -416, + 32767, 182, -211, 0, 0, 594, 32767, 184, + -1070, 32767, 32767, 32767, 185, 0, 0, 32767, + 710, 32767, 32767, 32767, 32767, 928, 32767, 32767, + 0, 126, 942, 32767, 0, 0, 32767, 867, + 697, -355, 32767, 625, 0, 596, 32767, 597, + -243, 583, 32767, 0, 0, 0, 0, 0, + 584, 650, 0, 32767, 515, 32767, 0, 892, + 0, 0, -271, 274, 32767, 418, 32767, 0, + 32767, 32767, 32767, 440, -1147, 32767, 0, 32767, + 32767, 651, 652, 564, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 32767, 947, -68, 32767, 688, + 32767, 0, 0, 689, 915, 916, 0, 0, + -204, 225, 0, 0, 0, 0, 32767, -275, + 370, 0, 599, -402, 32767, 571, 0, 32767, + 1470, 594, 32767, 772, 773, 1458, 0, 907, + 1048, 32767, 128, 4, 32767, 0, 32767, 1880, + 32767, 32767, 0, 0, 684, 32767, 0, 262, + 32767, 32767, 32767, 32767, 757, 32767, 32767, 0, + 196, 32767, -258, -552, -998, 0, 950, 774, + -35, 32767, 0, 32767, 0, 32767, 15, 32767, + 0, 32767, 0, 27, 198, 760, 32767, 32767, + 1204, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 620, 32767, 32767, 760, 761, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 0, 32767, 32767, 0, 32767, 0, + 1195, 918, 32767, 32767, 32767, 32767, 0, 0, + 32767, 32767, 32767, 32767, 903, 32767, 32767, 763, + 764, 0, 32767, 0, 32767, 32767, 0, 32767, + 833, 32767, 32767, 32767, 1132, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 450, 32767, 32767, 420, + 32767, 32767, 32767, 32767, -68, 2, 0, 0, + 1196, 0, 0, 0, 188, 189, 190, 191, + 192, 600, 0, -632, -43, 196, 89, 489, + 294, 1248, 32767, 1043, 32767, 492, 32767, 32767, + 519, 0, 32767, 863, 32767, 32767, 32767, 0, + 32767, 765, 493, 467, 0, 32767, 32767, 201, + 32767, 432, 849, 32767, 279, 0, 0, 204, + 834, 32767, 0, 32767, 1670, 32767, 0, 32767, + 0, 32767, 32767, 32767, 919, 929, 32767, 0, + 32767, -363, 0, 32767, 32767, 0, 434, -56, + 32767, 436, 0, 349, 0, 207, 208, 437, + 32767, 0, 32767, -694, -408, 32767, 0, 32767, + 210, 206, 0, 653, 32767, 32767, 0, 402, + 1105, 0, 32767, 693, 0, 0, 938, 32767, + 32767, 32767, 438, 541, 131, 440, 871, 32767, + 32767, 0, 32767, 279, 32767, 32767, 287, 212, + 0, 0, 32767, 32767, 367, 32767, 696, 697, + 32767, 0, 0, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 0, -1321, 32767, + 0, 176, 32767, 214, 218, 724, 234, 215, + 222, 32767, 223, -834, 943, 127, 32767, 496, + -100, 217, 0, 394, 32767, 229, 32767, 0, + 0, 17, 421, 415, 447, 0, 32767, 686, + 32767, 32767, 1845, 138, 32767, 32767, 872, 230, + 32767, 601, 851, 471, 232, 603, 32767, 778, + 698, 233, 32767, 699, -439, 32767, 0, 32767, + 32767, 32767, 663, 32767, 32767, 32767, 32767, -298, + 449, 32767, -463, 687, 32767, 32767, 427, 32767, + 0, 0, 0, 0, 0, 236, 193, 826, + 238, 0, 108 + }; + + const unsigned char *k = (const unsigned char *) key; + size_t keylen = 8; + uint32 a = 0; + uint32 b = 0; + + while (keylen--) + { + unsigned char c = *k++; + + a = a * 257 + c; + b = b * 17 + c; + } + return h[a % 1923] + h[b % 1923]; +} + +/* Hash lookup information for recomposition */ +static const pg_unicode_recompinfo UnicodeRecompInfo = +{ + RecompInverseLookup, + Recomp_hash_func, + 961 +}; diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_norm_table.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_norm_table.h new file mode 100644 index 0000000..6c98313 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_norm_table.h @@ -0,0 +1,9202 @@ +/*------------------------------------------------------------------------- + * + * unicode_norm_table.h + * Composition table used for Unicode normalization + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_norm_table.h + * + *------------------------------------------------------------------------- + */ + +/* + * File auto-generated by src/common/unicode/generate-unicode_norm_table.pl, + * do not edit. There is deliberately not an #ifndef PG_UNICODE_NORM_TABLE_H + * here. + */ +typedef struct +{ + uint32 codepoint; /* Unicode codepoint */ + uint8 comb_class; /* combining class of character */ + uint8 dec_size_flags; /* size and flags of decomposition code list */ + uint16 dec_index; /* index into UnicodeDecomp_codepoints, or the + * decomposition itself if DECOMP_INLINE */ +} pg_unicode_decomposition; + +#define DECOMP_NO_COMPOSE 0x80 /* don't use for re-composition */ +#define DECOMP_INLINE 0x40 /* decomposition is stored inline in + * dec_index */ +#define DECOMP_COMPAT 0x20 /* compatibility mapping */ + +#define DECOMPOSITION_SIZE(x) ((x)->dec_size_flags & 0x1F) +#define DECOMPOSITION_NO_COMPOSE(x) (((x)->dec_size_flags & (DECOMP_NO_COMPOSE | DECOMP_COMPAT)) != 0) +#define DECOMPOSITION_IS_INLINE(x) (((x)->dec_size_flags & DECOMP_INLINE) != 0) +#define DECOMPOSITION_IS_COMPAT(x) (((x)->dec_size_flags & DECOMP_COMPAT) != 0) + +/* Table of Unicode codepoints and their decompositions */ +static const pg_unicode_decomposition UnicodeDecompMain[6843] = +{ + {0x00A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x00A8, 0, 2 | DECOMP_COMPAT, 0}, + {0x00AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x00AF, 0, 2 | DECOMP_COMPAT, 2}, + {0x00B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x00B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x00B4, 0, 2 | DECOMP_COMPAT, 4}, + {0x00B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x00B8, 0, 2 | DECOMP_COMPAT, 6}, + {0x00B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x00BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x00BC, 0, 3 | DECOMP_COMPAT, 8}, + {0x00BD, 0, 3 | DECOMP_COMPAT, 11}, + {0x00BE, 0, 3 | DECOMP_COMPAT, 14}, + {0x00C0, 0, 2, 17}, + {0x00C1, 0, 2, 19}, + {0x00C2, 0, 2, 21}, + {0x00C3, 0, 2, 23}, + {0x00C4, 0, 2, 25}, + {0x00C5, 0, 2, 27}, + {0x00C7, 0, 2, 29}, + {0x00C8, 0, 2, 31}, + {0x00C9, 0, 2, 33}, + {0x00CA, 0, 2, 35}, + {0x00CB, 0, 2, 37}, + {0x00CC, 0, 2, 39}, + {0x00CD, 0, 2, 41}, + {0x00CE, 0, 2, 43}, + {0x00CF, 0, 2, 45}, + {0x00D1, 0, 2, 47}, + {0x00D2, 0, 2, 49}, + {0x00D3, 0, 2, 51}, + {0x00D4, 0, 2, 53}, + {0x00D5, 0, 2, 55}, + {0x00D6, 0, 2, 57}, + {0x00D9, 0, 2, 59}, + {0x00DA, 0, 2, 61}, + {0x00DB, 0, 2, 63}, + {0x00DC, 0, 2, 65}, + {0x00DD, 0, 2, 67}, + {0x00E0, 0, 2, 69}, + {0x00E1, 0, 2, 71}, + {0x00E2, 0, 2, 73}, + {0x00E3, 0, 2, 75}, + {0x00E4, 0, 2, 77}, + {0x00E5, 0, 2, 79}, + {0x00E7, 0, 2, 81}, + {0x00E8, 0, 2, 83}, + {0x00E9, 0, 2, 85}, + {0x00EA, 0, 2, 87}, + {0x00EB, 0, 2, 89}, + {0x00EC, 0, 2, 91}, + {0x00ED, 0, 2, 93}, + {0x00EE, 0, 2, 95}, + {0x00EF, 0, 2, 97}, + {0x00F1, 0, 2, 99}, + {0x00F2, 0, 2, 101}, + {0x00F3, 0, 2, 103}, + {0x00F4, 0, 2, 105}, + {0x00F5, 0, 2, 107}, + {0x00F6, 0, 2, 109}, + {0x00F9, 0, 2, 111}, + {0x00FA, 0, 2, 113}, + {0x00FB, 0, 2, 115}, + {0x00FC, 0, 2, 117}, + {0x00FD, 0, 2, 119}, + {0x00FF, 0, 2, 121}, + {0x0100, 0, 2, 123}, + {0x0101, 0, 2, 125}, + {0x0102, 0, 2, 127}, + {0x0103, 0, 2, 129}, + {0x0104, 0, 2, 131}, + {0x0105, 0, 2, 133}, + {0x0106, 0, 2, 135}, + {0x0107, 0, 2, 137}, + {0x0108, 0, 2, 139}, + {0x0109, 0, 2, 141}, + {0x010A, 0, 2, 143}, + {0x010B, 0, 2, 145}, + {0x010C, 0, 2, 147}, + {0x010D, 0, 2, 149}, + {0x010E, 0, 2, 151}, + {0x010F, 0, 2, 153}, + {0x0112, 0, 2, 155}, + {0x0113, 0, 2, 157}, + {0x0114, 0, 2, 159}, + {0x0115, 0, 2, 161}, + {0x0116, 0, 2, 163}, + {0x0117, 0, 2, 165}, + {0x0118, 0, 2, 167}, + {0x0119, 0, 2, 169}, + {0x011A, 0, 2, 171}, + {0x011B, 0, 2, 173}, + {0x011C, 0, 2, 175}, + {0x011D, 0, 2, 177}, + {0x011E, 0, 2, 179}, + {0x011F, 0, 2, 181}, + {0x0120, 0, 2, 183}, + {0x0121, 0, 2, 185}, + {0x0122, 0, 2, 187}, + {0x0123, 0, 2, 189}, + {0x0124, 0, 2, 191}, + {0x0125, 0, 2, 193}, + {0x0128, 0, 2, 195}, + {0x0129, 0, 2, 197}, + {0x012A, 0, 2, 199}, + {0x012B, 0, 2, 201}, + {0x012C, 0, 2, 203}, + {0x012D, 0, 2, 205}, + {0x012E, 0, 2, 207}, + {0x012F, 0, 2, 209}, + {0x0130, 0, 2, 211}, + {0x0132, 0, 2 | DECOMP_COMPAT, 213}, + {0x0133, 0, 2 | DECOMP_COMPAT, 215}, + {0x0134, 0, 2, 217}, + {0x0135, 0, 2, 219}, + {0x0136, 0, 2, 221}, + {0x0137, 0, 2, 223}, + {0x0139, 0, 2, 225}, + {0x013A, 0, 2, 227}, + {0x013B, 0, 2, 229}, + {0x013C, 0, 2, 231}, + {0x013D, 0, 2, 233}, + {0x013E, 0, 2, 235}, + {0x013F, 0, 2 | DECOMP_COMPAT, 237}, + {0x0140, 0, 2 | DECOMP_COMPAT, 239}, + {0x0143, 0, 2, 241}, + {0x0144, 0, 2, 243}, + {0x0145, 0, 2, 245}, + {0x0146, 0, 2, 247}, + {0x0147, 0, 2, 249}, + {0x0148, 0, 2, 251}, + {0x0149, 0, 2 | DECOMP_COMPAT, 253}, + {0x014C, 0, 2, 255}, + {0x014D, 0, 2, 257}, + {0x014E, 0, 2, 259}, + {0x014F, 0, 2, 261}, + {0x0150, 0, 2, 263}, + {0x0151, 0, 2, 265}, + {0x0154, 0, 2, 267}, + {0x0155, 0, 2, 269}, + {0x0156, 0, 2, 271}, + {0x0157, 0, 2, 273}, + {0x0158, 0, 2, 275}, + {0x0159, 0, 2, 277}, + {0x015A, 0, 2, 279}, + {0x015B, 0, 2, 281}, + {0x015C, 0, 2, 283}, + {0x015D, 0, 2, 285}, + {0x015E, 0, 2, 287}, + {0x015F, 0, 2, 289}, + {0x0160, 0, 2, 291}, + {0x0161, 0, 2, 293}, + {0x0162, 0, 2, 295}, + {0x0163, 0, 2, 297}, + {0x0164, 0, 2, 299}, + {0x0165, 0, 2, 301}, + {0x0168, 0, 2, 303}, + {0x0169, 0, 2, 305}, + {0x016A, 0, 2, 307}, + {0x016B, 0, 2, 309}, + {0x016C, 0, 2, 311}, + {0x016D, 0, 2, 313}, + {0x016E, 0, 2, 315}, + {0x016F, 0, 2, 317}, + {0x0170, 0, 2, 319}, + {0x0171, 0, 2, 321}, + {0x0172, 0, 2, 323}, + {0x0173, 0, 2, 325}, + {0x0174, 0, 2, 327}, + {0x0175, 0, 2, 329}, + {0x0176, 0, 2, 331}, + {0x0177, 0, 2, 333}, + {0x0178, 0, 2, 335}, + {0x0179, 0, 2, 337}, + {0x017A, 0, 2, 339}, + {0x017B, 0, 2, 341}, + {0x017C, 0, 2, 343}, + {0x017D, 0, 2, 345}, + {0x017E, 0, 2, 347}, + {0x017F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x01A0, 0, 2, 349}, + {0x01A1, 0, 2, 351}, + {0x01AF, 0, 2, 353}, + {0x01B0, 0, 2, 355}, + {0x01C4, 0, 2 | DECOMP_COMPAT, 357}, + {0x01C5, 0, 2 | DECOMP_COMPAT, 359}, + {0x01C6, 0, 2 | DECOMP_COMPAT, 361}, + {0x01C7, 0, 2 | DECOMP_COMPAT, 363}, + {0x01C8, 0, 2 | DECOMP_COMPAT, 365}, + {0x01C9, 0, 2 | DECOMP_COMPAT, 367}, + {0x01CA, 0, 2 | DECOMP_COMPAT, 369}, + {0x01CB, 0, 2 | DECOMP_COMPAT, 371}, + {0x01CC, 0, 2 | DECOMP_COMPAT, 373}, + {0x01CD, 0, 2, 375}, + {0x01CE, 0, 2, 377}, + {0x01CF, 0, 2, 379}, + {0x01D0, 0, 2, 381}, + {0x01D1, 0, 2, 383}, + {0x01D2, 0, 2, 385}, + {0x01D3, 0, 2, 387}, + {0x01D4, 0, 2, 389}, + {0x01D5, 0, 2, 391}, + {0x01D6, 0, 2, 393}, + {0x01D7, 0, 2, 395}, + {0x01D8, 0, 2, 397}, + {0x01D9, 0, 2, 399}, + {0x01DA, 0, 2, 401}, + {0x01DB, 0, 2, 403}, + {0x01DC, 0, 2, 405}, + {0x01DE, 0, 2, 407}, + {0x01DF, 0, 2, 409}, + {0x01E0, 0, 2, 411}, + {0x01E1, 0, 2, 413}, + {0x01E2, 0, 2, 415}, + {0x01E3, 0, 2, 417}, + {0x01E6, 0, 2, 419}, + {0x01E7, 0, 2, 421}, + {0x01E8, 0, 2, 423}, + {0x01E9, 0, 2, 425}, + {0x01EA, 0, 2, 427}, + {0x01EB, 0, 2, 429}, + {0x01EC, 0, 2, 431}, + {0x01ED, 0, 2, 433}, + {0x01EE, 0, 2, 435}, + {0x01EF, 0, 2, 437}, + {0x01F0, 0, 2, 439}, + {0x01F1, 0, 2 | DECOMP_COMPAT, 441}, + {0x01F2, 0, 2 | DECOMP_COMPAT, 443}, + {0x01F3, 0, 2 | DECOMP_COMPAT, 445}, + {0x01F4, 0, 2, 447}, + {0x01F5, 0, 2, 449}, + {0x01F8, 0, 2, 451}, + {0x01F9, 0, 2, 453}, + {0x01FA, 0, 2, 455}, + {0x01FB, 0, 2, 457}, + {0x01FC, 0, 2, 459}, + {0x01FD, 0, 2, 461}, + {0x01FE, 0, 2, 463}, + {0x01FF, 0, 2, 465}, + {0x0200, 0, 2, 467}, + {0x0201, 0, 2, 469}, + {0x0202, 0, 2, 471}, + {0x0203, 0, 2, 473}, + {0x0204, 0, 2, 475}, + {0x0205, 0, 2, 477}, + {0x0206, 0, 2, 479}, + {0x0207, 0, 2, 481}, + {0x0208, 0, 2, 483}, + {0x0209, 0, 2, 485}, + {0x020A, 0, 2, 487}, + {0x020B, 0, 2, 489}, + {0x020C, 0, 2, 491}, + {0x020D, 0, 2, 493}, + {0x020E, 0, 2, 495}, + {0x020F, 0, 2, 497}, + {0x0210, 0, 2, 499}, + {0x0211, 0, 2, 501}, + {0x0212, 0, 2, 503}, + {0x0213, 0, 2, 505}, + {0x0214, 0, 2, 507}, + {0x0215, 0, 2, 509}, + {0x0216, 0, 2, 511}, + {0x0217, 0, 2, 513}, + {0x0218, 0, 2, 515}, + {0x0219, 0, 2, 517}, + {0x021A, 0, 2, 519}, + {0x021B, 0, 2, 521}, + {0x021E, 0, 2, 523}, + {0x021F, 0, 2, 525}, + {0x0226, 0, 2, 527}, + {0x0227, 0, 2, 529}, + {0x0228, 0, 2, 531}, + {0x0229, 0, 2, 533}, + {0x022A, 0, 2, 535}, + {0x022B, 0, 2, 537}, + {0x022C, 0, 2, 539}, + {0x022D, 0, 2, 541}, + {0x022E, 0, 2, 543}, + {0x022F, 0, 2, 545}, + {0x0230, 0, 2, 547}, + {0x0231, 0, 2, 549}, + {0x0232, 0, 2, 551}, + {0x0233, 0, 2, 553}, + {0x02B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x02B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0266}, + {0x02B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x02B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x02B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0279}, + {0x02B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x027B}, + {0x02B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0281}, + {0x02B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x02B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x02D8, 0, 2 | DECOMP_COMPAT, 555}, + {0x02D9, 0, 2 | DECOMP_COMPAT, 557}, + {0x02DA, 0, 2 | DECOMP_COMPAT, 559}, + {0x02DB, 0, 2 | DECOMP_COMPAT, 561}, + {0x02DC, 0, 2 | DECOMP_COMPAT, 563}, + {0x02DD, 0, 2 | DECOMP_COMPAT, 565}, + {0x02E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0263}, + {0x02E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x02E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x02E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x02E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0295}, + {0x0300, 230, 0, 0}, + {0x0301, 230, 0, 0}, + {0x0302, 230, 0, 0}, + {0x0303, 230, 0, 0}, + {0x0304, 230, 0, 0}, + {0x0305, 230, 0, 0}, + {0x0306, 230, 0, 0}, + {0x0307, 230, 0, 0}, + {0x0308, 230, 0, 0}, + {0x0309, 230, 0, 0}, + {0x030A, 230, 0, 0}, + {0x030B, 230, 0, 0}, + {0x030C, 230, 0, 0}, + {0x030D, 230, 0, 0}, + {0x030E, 230, 0, 0}, + {0x030F, 230, 0, 0}, + {0x0310, 230, 0, 0}, + {0x0311, 230, 0, 0}, + {0x0312, 230, 0, 0}, + {0x0313, 230, 0, 0}, + {0x0314, 230, 0, 0}, + {0x0315, 232, 0, 0}, + {0x0316, 220, 0, 0}, + {0x0317, 220, 0, 0}, + {0x0318, 220, 0, 0}, + {0x0319, 220, 0, 0}, + {0x031A, 232, 0, 0}, + {0x031B, 216, 0, 0}, + {0x031C, 220, 0, 0}, + {0x031D, 220, 0, 0}, + {0x031E, 220, 0, 0}, + {0x031F, 220, 0, 0}, + {0x0320, 220, 0, 0}, + {0x0321, 202, 0, 0}, + {0x0322, 202, 0, 0}, + {0x0323, 220, 0, 0}, + {0x0324, 220, 0, 0}, + {0x0325, 220, 0, 0}, + {0x0326, 220, 0, 0}, + {0x0327, 202, 0, 0}, + {0x0328, 202, 0, 0}, + {0x0329, 220, 0, 0}, + {0x032A, 220, 0, 0}, + {0x032B, 220, 0, 0}, + {0x032C, 220, 0, 0}, + {0x032D, 220, 0, 0}, + {0x032E, 220, 0, 0}, + {0x032F, 220, 0, 0}, + {0x0330, 220, 0, 0}, + {0x0331, 220, 0, 0}, + {0x0332, 220, 0, 0}, + {0x0333, 220, 0, 0}, + {0x0334, 1, 0, 0}, + {0x0335, 1, 0, 0}, + {0x0336, 1, 0, 0}, + {0x0337, 1, 0, 0}, + {0x0338, 1, 0, 0}, + {0x0339, 220, 0, 0}, + {0x033A, 220, 0, 0}, + {0x033B, 220, 0, 0}, + {0x033C, 220, 0, 0}, + {0x033D, 230, 0, 0}, + {0x033E, 230, 0, 0}, + {0x033F, 230, 0, 0}, + {0x0340, 230, 1 | DECOMP_INLINE, 0x0300}, + {0x0341, 230, 1 | DECOMP_INLINE, 0x0301}, + {0x0342, 230, 0, 0}, + {0x0343, 230, 1 | DECOMP_INLINE, 0x0313}, + {0x0344, 230, 2 | DECOMP_NO_COMPOSE, 567}, /* non-starter decomposition */ + {0x0345, 240, 0, 0}, + {0x0346, 230, 0, 0}, + {0x0347, 220, 0, 0}, + {0x0348, 220, 0, 0}, + {0x0349, 220, 0, 0}, + {0x034A, 230, 0, 0}, + {0x034B, 230, 0, 0}, + {0x034C, 230, 0, 0}, + {0x034D, 220, 0, 0}, + {0x034E, 220, 0, 0}, + {0x0350, 230, 0, 0}, + {0x0351, 230, 0, 0}, + {0x0352, 230, 0, 0}, + {0x0353, 220, 0, 0}, + {0x0354, 220, 0, 0}, + {0x0355, 220, 0, 0}, + {0x0356, 220, 0, 0}, + {0x0357, 230, 0, 0}, + {0x0358, 232, 0, 0}, + {0x0359, 220, 0, 0}, + {0x035A, 220, 0, 0}, + {0x035B, 230, 0, 0}, + {0x035C, 233, 0, 0}, + {0x035D, 234, 0, 0}, + {0x035E, 234, 0, 0}, + {0x035F, 233, 0, 0}, + {0x0360, 234, 0, 0}, + {0x0361, 234, 0, 0}, + {0x0362, 233, 0, 0}, + {0x0363, 230, 0, 0}, + {0x0364, 230, 0, 0}, + {0x0365, 230, 0, 0}, + {0x0366, 230, 0, 0}, + {0x0367, 230, 0, 0}, + {0x0368, 230, 0, 0}, + {0x0369, 230, 0, 0}, + {0x036A, 230, 0, 0}, + {0x036B, 230, 0, 0}, + {0x036C, 230, 0, 0}, + {0x036D, 230, 0, 0}, + {0x036E, 230, 0, 0}, + {0x036F, 230, 0, 0}, + {0x0374, 0, 1 | DECOMP_INLINE, 0x02B9}, + {0x037A, 0, 2 | DECOMP_COMPAT, 569}, + {0x037E, 0, 1 | DECOMP_INLINE, 0x003B}, + {0x0384, 0, 2 | DECOMP_COMPAT, 571}, + {0x0385, 0, 2, 573}, + {0x0386, 0, 2, 575}, + {0x0387, 0, 1 | DECOMP_INLINE, 0x00B7}, + {0x0388, 0, 2, 577}, + {0x0389, 0, 2, 579}, + {0x038A, 0, 2, 581}, + {0x038C, 0, 2, 583}, + {0x038E, 0, 2, 585}, + {0x038F, 0, 2, 587}, + {0x0390, 0, 2, 589}, + {0x03AA, 0, 2, 591}, + {0x03AB, 0, 2, 593}, + {0x03AC, 0, 2, 595}, + {0x03AD, 0, 2, 597}, + {0x03AE, 0, 2, 599}, + {0x03AF, 0, 2, 601}, + {0x03B0, 0, 2, 603}, + {0x03CA, 0, 2, 605}, + {0x03CB, 0, 2, 607}, + {0x03CC, 0, 2, 609}, + {0x03CD, 0, 2, 611}, + {0x03CE, 0, 2, 613}, + {0x03D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x03D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x03D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x03D3, 0, 2, 615}, + {0x03D4, 0, 2, 617}, + {0x03D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x03D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x03F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x03F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x03F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x03F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x03F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x03F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x0400, 0, 2, 619}, + {0x0401, 0, 2, 621}, + {0x0403, 0, 2, 623}, + {0x0407, 0, 2, 625}, + {0x040C, 0, 2, 627}, + {0x040D, 0, 2, 629}, + {0x040E, 0, 2, 631}, + {0x0419, 0, 2, 633}, + {0x0439, 0, 2, 635}, + {0x0450, 0, 2, 637}, + {0x0451, 0, 2, 639}, + {0x0453, 0, 2, 641}, + {0x0457, 0, 2, 643}, + {0x045C, 0, 2, 645}, + {0x045D, 0, 2, 647}, + {0x045E, 0, 2, 649}, + {0x0476, 0, 2, 651}, + {0x0477, 0, 2, 653}, + {0x0483, 230, 0, 0}, + {0x0484, 230, 0, 0}, + {0x0485, 230, 0, 0}, + {0x0486, 230, 0, 0}, + {0x0487, 230, 0, 0}, + {0x04C1, 0, 2, 655}, + {0x04C2, 0, 2, 657}, + {0x04D0, 0, 2, 659}, + {0x04D1, 0, 2, 661}, + {0x04D2, 0, 2, 663}, + {0x04D3, 0, 2, 665}, + {0x04D6, 0, 2, 667}, + {0x04D7, 0, 2, 669}, + {0x04DA, 0, 2, 671}, + {0x04DB, 0, 2, 673}, + {0x04DC, 0, 2, 675}, + {0x04DD, 0, 2, 677}, + {0x04DE, 0, 2, 679}, + {0x04DF, 0, 2, 681}, + {0x04E2, 0, 2, 683}, + {0x04E3, 0, 2, 685}, + {0x04E4, 0, 2, 687}, + {0x04E5, 0, 2, 689}, + {0x04E6, 0, 2, 691}, + {0x04E7, 0, 2, 693}, + {0x04EA, 0, 2, 695}, + {0x04EB, 0, 2, 697}, + {0x04EC, 0, 2, 699}, + {0x04ED, 0, 2, 701}, + {0x04EE, 0, 2, 703}, + {0x04EF, 0, 2, 705}, + {0x04F0, 0, 2, 707}, + {0x04F1, 0, 2, 709}, + {0x04F2, 0, 2, 711}, + {0x04F3, 0, 2, 713}, + {0x04F4, 0, 2, 715}, + {0x04F5, 0, 2, 717}, + {0x04F8, 0, 2, 719}, + {0x04F9, 0, 2, 721}, + {0x0587, 0, 2 | DECOMP_COMPAT, 723}, + {0x0591, 220, 0, 0}, + {0x0592, 230, 0, 0}, + {0x0593, 230, 0, 0}, + {0x0594, 230, 0, 0}, + {0x0595, 230, 0, 0}, + {0x0596, 220, 0, 0}, + {0x0597, 230, 0, 0}, + {0x0598, 230, 0, 0}, + {0x0599, 230, 0, 0}, + {0x059A, 222, 0, 0}, + {0x059B, 220, 0, 0}, + {0x059C, 230, 0, 0}, + {0x059D, 230, 0, 0}, + {0x059E, 230, 0, 0}, + {0x059F, 230, 0, 0}, + {0x05A0, 230, 0, 0}, + {0x05A1, 230, 0, 0}, + {0x05A2, 220, 0, 0}, + {0x05A3, 220, 0, 0}, + {0x05A4, 220, 0, 0}, + {0x05A5, 220, 0, 0}, + {0x05A6, 220, 0, 0}, + {0x05A7, 220, 0, 0}, + {0x05A8, 230, 0, 0}, + {0x05A9, 230, 0, 0}, + {0x05AA, 220, 0, 0}, + {0x05AB, 230, 0, 0}, + {0x05AC, 230, 0, 0}, + {0x05AD, 222, 0, 0}, + {0x05AE, 228, 0, 0}, + {0x05AF, 230, 0, 0}, + {0x05B0, 10, 0, 0}, + {0x05B1, 11, 0, 0}, + {0x05B2, 12, 0, 0}, + {0x05B3, 13, 0, 0}, + {0x05B4, 14, 0, 0}, + {0x05B5, 15, 0, 0}, + {0x05B6, 16, 0, 0}, + {0x05B7, 17, 0, 0}, + {0x05B8, 18, 0, 0}, + {0x05B9, 19, 0, 0}, + {0x05BA, 19, 0, 0}, + {0x05BB, 20, 0, 0}, + {0x05BC, 21, 0, 0}, + {0x05BD, 22, 0, 0}, + {0x05BF, 23, 0, 0}, + {0x05C1, 24, 0, 0}, + {0x05C2, 25, 0, 0}, + {0x05C4, 230, 0, 0}, + {0x05C5, 220, 0, 0}, + {0x05C7, 18, 0, 0}, + {0x0610, 230, 0, 0}, + {0x0611, 230, 0, 0}, + {0x0612, 230, 0, 0}, + {0x0613, 230, 0, 0}, + {0x0614, 230, 0, 0}, + {0x0615, 230, 0, 0}, + {0x0616, 230, 0, 0}, + {0x0617, 230, 0, 0}, + {0x0618, 30, 0, 0}, + {0x0619, 31, 0, 0}, + {0x061A, 32, 0, 0}, + {0x0622, 0, 2, 725}, + {0x0623, 0, 2, 727}, + {0x0624, 0, 2, 729}, + {0x0625, 0, 2, 731}, + {0x0626, 0, 2, 733}, + {0x064B, 27, 0, 0}, + {0x064C, 28, 0, 0}, + {0x064D, 29, 0, 0}, + {0x064E, 30, 0, 0}, + {0x064F, 31, 0, 0}, + {0x0650, 32, 0, 0}, + {0x0651, 33, 0, 0}, + {0x0652, 34, 0, 0}, + {0x0653, 230, 0, 0}, + {0x0654, 230, 0, 0}, + {0x0655, 220, 0, 0}, + {0x0656, 220, 0, 0}, + {0x0657, 230, 0, 0}, + {0x0658, 230, 0, 0}, + {0x0659, 230, 0, 0}, + {0x065A, 230, 0, 0}, + {0x065B, 230, 0, 0}, + {0x065C, 220, 0, 0}, + {0x065D, 230, 0, 0}, + {0x065E, 230, 0, 0}, + {0x065F, 220, 0, 0}, + {0x0670, 35, 0, 0}, + {0x0675, 0, 2 | DECOMP_COMPAT, 735}, + {0x0676, 0, 2 | DECOMP_COMPAT, 737}, + {0x0677, 0, 2 | DECOMP_COMPAT, 739}, + {0x0678, 0, 2 | DECOMP_COMPAT, 741}, + {0x06C0, 0, 2, 743}, + {0x06C2, 0, 2, 745}, + {0x06D3, 0, 2, 747}, + {0x06D6, 230, 0, 0}, + {0x06D7, 230, 0, 0}, + {0x06D8, 230, 0, 0}, + {0x06D9, 230, 0, 0}, + {0x06DA, 230, 0, 0}, + {0x06DB, 230, 0, 0}, + {0x06DC, 230, 0, 0}, + {0x06DF, 230, 0, 0}, + {0x06E0, 230, 0, 0}, + {0x06E1, 230, 0, 0}, + {0x06E2, 230, 0, 0}, + {0x06E3, 220, 0, 0}, + {0x06E4, 230, 0, 0}, + {0x06E7, 230, 0, 0}, + {0x06E8, 230, 0, 0}, + {0x06EA, 220, 0, 0}, + {0x06EB, 230, 0, 0}, + {0x06EC, 230, 0, 0}, + {0x06ED, 220, 0, 0}, + {0x0711, 36, 0, 0}, + {0x0730, 230, 0, 0}, + {0x0731, 220, 0, 0}, + {0x0732, 230, 0, 0}, + {0x0733, 230, 0, 0}, + {0x0734, 220, 0, 0}, + {0x0735, 230, 0, 0}, + {0x0736, 230, 0, 0}, + {0x0737, 220, 0, 0}, + {0x0738, 220, 0, 0}, + {0x0739, 220, 0, 0}, + {0x073A, 230, 0, 0}, + {0x073B, 220, 0, 0}, + {0x073C, 220, 0, 0}, + {0x073D, 230, 0, 0}, + {0x073E, 220, 0, 0}, + {0x073F, 230, 0, 0}, + {0x0740, 230, 0, 0}, + {0x0741, 230, 0, 0}, + {0x0742, 220, 0, 0}, + {0x0743, 230, 0, 0}, + {0x0744, 220, 0, 0}, + {0x0745, 230, 0, 0}, + {0x0746, 220, 0, 0}, + {0x0747, 230, 0, 0}, + {0x0748, 220, 0, 0}, + {0x0749, 230, 0, 0}, + {0x074A, 230, 0, 0}, + {0x07EB, 230, 0, 0}, + {0x07EC, 230, 0, 0}, + {0x07ED, 230, 0, 0}, + {0x07EE, 230, 0, 0}, + {0x07EF, 230, 0, 0}, + {0x07F0, 230, 0, 0}, + {0x07F1, 230, 0, 0}, + {0x07F2, 220, 0, 0}, + {0x07F3, 230, 0, 0}, + {0x07FD, 220, 0, 0}, + {0x0816, 230, 0, 0}, + {0x0817, 230, 0, 0}, + {0x0818, 230, 0, 0}, + {0x0819, 230, 0, 0}, + {0x081B, 230, 0, 0}, + {0x081C, 230, 0, 0}, + {0x081D, 230, 0, 0}, + {0x081E, 230, 0, 0}, + {0x081F, 230, 0, 0}, + {0x0820, 230, 0, 0}, + {0x0821, 230, 0, 0}, + {0x0822, 230, 0, 0}, + {0x0823, 230, 0, 0}, + {0x0825, 230, 0, 0}, + {0x0826, 230, 0, 0}, + {0x0827, 230, 0, 0}, + {0x0829, 230, 0, 0}, + {0x082A, 230, 0, 0}, + {0x082B, 230, 0, 0}, + {0x082C, 230, 0, 0}, + {0x082D, 230, 0, 0}, + {0x0859, 220, 0, 0}, + {0x085A, 220, 0, 0}, + {0x085B, 220, 0, 0}, + {0x0897, 230, 0, 0}, + {0x0898, 230, 0, 0}, + {0x0899, 220, 0, 0}, + {0x089A, 220, 0, 0}, + {0x089B, 220, 0, 0}, + {0x089C, 230, 0, 0}, + {0x089D, 230, 0, 0}, + {0x089E, 230, 0, 0}, + {0x089F, 230, 0, 0}, + {0x08CA, 230, 0, 0}, + {0x08CB, 230, 0, 0}, + {0x08CC, 230, 0, 0}, + {0x08CD, 230, 0, 0}, + {0x08CE, 230, 0, 0}, + {0x08CF, 220, 0, 0}, + {0x08D0, 220, 0, 0}, + {0x08D1, 220, 0, 0}, + {0x08D2, 220, 0, 0}, + {0x08D3, 220, 0, 0}, + {0x08D4, 230, 0, 0}, + {0x08D5, 230, 0, 0}, + {0x08D6, 230, 0, 0}, + {0x08D7, 230, 0, 0}, + {0x08D8, 230, 0, 0}, + {0x08D9, 230, 0, 0}, + {0x08DA, 230, 0, 0}, + {0x08DB, 230, 0, 0}, + {0x08DC, 230, 0, 0}, + {0x08DD, 230, 0, 0}, + {0x08DE, 230, 0, 0}, + {0x08DF, 230, 0, 0}, + {0x08E0, 230, 0, 0}, + {0x08E1, 230, 0, 0}, + {0x08E3, 220, 0, 0}, + {0x08E4, 230, 0, 0}, + {0x08E5, 230, 0, 0}, + {0x08E6, 220, 0, 0}, + {0x08E7, 230, 0, 0}, + {0x08E8, 230, 0, 0}, + {0x08E9, 220, 0, 0}, + {0x08EA, 230, 0, 0}, + {0x08EB, 230, 0, 0}, + {0x08EC, 230, 0, 0}, + {0x08ED, 220, 0, 0}, + {0x08EE, 220, 0, 0}, + {0x08EF, 220, 0, 0}, + {0x08F0, 27, 0, 0}, + {0x08F1, 28, 0, 0}, + {0x08F2, 29, 0, 0}, + {0x08F3, 230, 0, 0}, + {0x08F4, 230, 0, 0}, + {0x08F5, 230, 0, 0}, + {0x08F6, 220, 0, 0}, + {0x08F7, 230, 0, 0}, + {0x08F8, 230, 0, 0}, + {0x08F9, 220, 0, 0}, + {0x08FA, 220, 0, 0}, + {0x08FB, 230, 0, 0}, + {0x08FC, 230, 0, 0}, + {0x08FD, 230, 0, 0}, + {0x08FE, 230, 0, 0}, + {0x08FF, 230, 0, 0}, + {0x0929, 0, 2, 749}, + {0x0931, 0, 2, 751}, + {0x0934, 0, 2, 753}, + {0x093C, 7, 0, 0}, + {0x094D, 9, 0, 0}, + {0x0951, 230, 0, 0}, + {0x0952, 220, 0, 0}, + {0x0953, 230, 0, 0}, + {0x0954, 230, 0, 0}, + {0x0958, 0, 2 | DECOMP_NO_COMPOSE, 755}, /* in exclusion list */ + {0x0959, 0, 2 | DECOMP_NO_COMPOSE, 757}, /* in exclusion list */ + {0x095A, 0, 2 | DECOMP_NO_COMPOSE, 759}, /* in exclusion list */ + {0x095B, 0, 2 | DECOMP_NO_COMPOSE, 761}, /* in exclusion list */ + {0x095C, 0, 2 | DECOMP_NO_COMPOSE, 763}, /* in exclusion list */ + {0x095D, 0, 2 | DECOMP_NO_COMPOSE, 765}, /* in exclusion list */ + {0x095E, 0, 2 | DECOMP_NO_COMPOSE, 767}, /* in exclusion list */ + {0x095F, 0, 2 | DECOMP_NO_COMPOSE, 769}, /* in exclusion list */ + {0x09BC, 7, 0, 0}, + {0x09CB, 0, 2, 771}, + {0x09CC, 0, 2, 773}, + {0x09CD, 9, 0, 0}, + {0x09DC, 0, 2 | DECOMP_NO_COMPOSE, 775}, /* in exclusion list */ + {0x09DD, 0, 2 | DECOMP_NO_COMPOSE, 777}, /* in exclusion list */ + {0x09DF, 0, 2 | DECOMP_NO_COMPOSE, 779}, /* in exclusion list */ + {0x09FE, 230, 0, 0}, + {0x0A33, 0, 2 | DECOMP_NO_COMPOSE, 781}, /* in exclusion list */ + {0x0A36, 0, 2 | DECOMP_NO_COMPOSE, 783}, /* in exclusion list */ + {0x0A3C, 7, 0, 0}, + {0x0A4D, 9, 0, 0}, + {0x0A59, 0, 2 | DECOMP_NO_COMPOSE, 785}, /* in exclusion list */ + {0x0A5A, 0, 2 | DECOMP_NO_COMPOSE, 787}, /* in exclusion list */ + {0x0A5B, 0, 2 | DECOMP_NO_COMPOSE, 789}, /* in exclusion list */ + {0x0A5E, 0, 2 | DECOMP_NO_COMPOSE, 791}, /* in exclusion list */ + {0x0ABC, 7, 0, 0}, + {0x0ACD, 9, 0, 0}, + {0x0B3C, 7, 0, 0}, + {0x0B48, 0, 2, 793}, + {0x0B4B, 0, 2, 795}, + {0x0B4C, 0, 2, 797}, + {0x0B4D, 9, 0, 0}, + {0x0B5C, 0, 2 | DECOMP_NO_COMPOSE, 799}, /* in exclusion list */ + {0x0B5D, 0, 2 | DECOMP_NO_COMPOSE, 801}, /* in exclusion list */ + {0x0B94, 0, 2, 803}, + {0x0BCA, 0, 2, 805}, + {0x0BCB, 0, 2, 807}, + {0x0BCC, 0, 2, 809}, + {0x0BCD, 9, 0, 0}, + {0x0C3C, 7, 0, 0}, + {0x0C48, 0, 2, 811}, + {0x0C4D, 9, 0, 0}, + {0x0C55, 84, 0, 0}, + {0x0C56, 91, 0, 0}, + {0x0CBC, 7, 0, 0}, + {0x0CC0, 0, 2, 813}, + {0x0CC7, 0, 2, 815}, + {0x0CC8, 0, 2, 817}, + {0x0CCA, 0, 2, 819}, + {0x0CCB, 0, 2, 821}, + {0x0CCD, 9, 0, 0}, + {0x0D3B, 9, 0, 0}, + {0x0D3C, 9, 0, 0}, + {0x0D4A, 0, 2, 823}, + {0x0D4B, 0, 2, 825}, + {0x0D4C, 0, 2, 827}, + {0x0D4D, 9, 0, 0}, + {0x0DCA, 9, 0, 0}, + {0x0DDA, 0, 2, 829}, + {0x0DDC, 0, 2, 831}, + {0x0DDD, 0, 2, 833}, + {0x0DDE, 0, 2, 835}, + {0x0E33, 0, 2 | DECOMP_COMPAT, 837}, + {0x0E38, 103, 0, 0}, + {0x0E39, 103, 0, 0}, + {0x0E3A, 9, 0, 0}, + {0x0E48, 107, 0, 0}, + {0x0E49, 107, 0, 0}, + {0x0E4A, 107, 0, 0}, + {0x0E4B, 107, 0, 0}, + {0x0EB3, 0, 2 | DECOMP_COMPAT, 839}, + {0x0EB8, 118, 0, 0}, + {0x0EB9, 118, 0, 0}, + {0x0EBA, 9, 0, 0}, + {0x0EC8, 122, 0, 0}, + {0x0EC9, 122, 0, 0}, + {0x0ECA, 122, 0, 0}, + {0x0ECB, 122, 0, 0}, + {0x0EDC, 0, 2 | DECOMP_COMPAT, 841}, + {0x0EDD, 0, 2 | DECOMP_COMPAT, 843}, + {0x0F0C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0F0B}, + {0x0F18, 220, 0, 0}, + {0x0F19, 220, 0, 0}, + {0x0F35, 220, 0, 0}, + {0x0F37, 220, 0, 0}, + {0x0F39, 216, 0, 0}, + {0x0F43, 0, 2 | DECOMP_NO_COMPOSE, 845}, /* in exclusion list */ + {0x0F4D, 0, 2 | DECOMP_NO_COMPOSE, 847}, /* in exclusion list */ + {0x0F52, 0, 2 | DECOMP_NO_COMPOSE, 849}, /* in exclusion list */ + {0x0F57, 0, 2 | DECOMP_NO_COMPOSE, 851}, /* in exclusion list */ + {0x0F5C, 0, 2 | DECOMP_NO_COMPOSE, 853}, /* in exclusion list */ + {0x0F69, 0, 2 | DECOMP_NO_COMPOSE, 855}, /* in exclusion list */ + {0x0F71, 129, 0, 0}, + {0x0F72, 130, 0, 0}, + {0x0F73, 0, 2 | DECOMP_NO_COMPOSE, 857}, /* non-starter decomposition */ + {0x0F74, 132, 0, 0}, + {0x0F75, 0, 2 | DECOMP_NO_COMPOSE, 859}, /* non-starter decomposition */ + {0x0F76, 0, 2 | DECOMP_NO_COMPOSE, 861}, /* in exclusion list */ + {0x0F77, 0, 2 | DECOMP_COMPAT, 863}, + {0x0F78, 0, 2 | DECOMP_NO_COMPOSE, 865}, /* in exclusion list */ + {0x0F79, 0, 2 | DECOMP_COMPAT, 867}, + {0x0F7A, 130, 0, 0}, + {0x0F7B, 130, 0, 0}, + {0x0F7C, 130, 0, 0}, + {0x0F7D, 130, 0, 0}, + {0x0F80, 130, 0, 0}, + {0x0F81, 0, 2 | DECOMP_NO_COMPOSE, 869}, /* non-starter decomposition */ + {0x0F82, 230, 0, 0}, + {0x0F83, 230, 0, 0}, + {0x0F84, 9, 0, 0}, + {0x0F86, 230, 0, 0}, + {0x0F87, 230, 0, 0}, + {0x0F93, 0, 2 | DECOMP_NO_COMPOSE, 871}, /* in exclusion list */ + {0x0F9D, 0, 2 | DECOMP_NO_COMPOSE, 873}, /* in exclusion list */ + {0x0FA2, 0, 2 | DECOMP_NO_COMPOSE, 875}, /* in exclusion list */ + {0x0FA7, 0, 2 | DECOMP_NO_COMPOSE, 877}, /* in exclusion list */ + {0x0FAC, 0, 2 | DECOMP_NO_COMPOSE, 879}, /* in exclusion list */ + {0x0FB9, 0, 2 | DECOMP_NO_COMPOSE, 881}, /* in exclusion list */ + {0x0FC6, 220, 0, 0}, + {0x1026, 0, 2, 883}, + {0x1037, 7, 0, 0}, + {0x1039, 9, 0, 0}, + {0x103A, 9, 0, 0}, + {0x108D, 220, 0, 0}, + {0x10FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x10DC}, + {0x135D, 230, 0, 0}, + {0x135E, 230, 0, 0}, + {0x135F, 230, 0, 0}, + {0x1714, 9, 0, 0}, + {0x1715, 9, 0, 0}, + {0x1734, 9, 0, 0}, + {0x17D2, 9, 0, 0}, + {0x17DD, 230, 0, 0}, + {0x18A9, 228, 0, 0}, + {0x1939, 222, 0, 0}, + {0x193A, 230, 0, 0}, + {0x193B, 220, 0, 0}, + {0x1A17, 230, 0, 0}, + {0x1A18, 220, 0, 0}, + {0x1A60, 9, 0, 0}, + {0x1A75, 230, 0, 0}, + {0x1A76, 230, 0, 0}, + {0x1A77, 230, 0, 0}, + {0x1A78, 230, 0, 0}, + {0x1A79, 230, 0, 0}, + {0x1A7A, 230, 0, 0}, + {0x1A7B, 230, 0, 0}, + {0x1A7C, 230, 0, 0}, + {0x1A7F, 220, 0, 0}, + {0x1AB0, 230, 0, 0}, + {0x1AB1, 230, 0, 0}, + {0x1AB2, 230, 0, 0}, + {0x1AB3, 230, 0, 0}, + {0x1AB4, 230, 0, 0}, + {0x1AB5, 220, 0, 0}, + {0x1AB6, 220, 0, 0}, + {0x1AB7, 220, 0, 0}, + {0x1AB8, 220, 0, 0}, + {0x1AB9, 220, 0, 0}, + {0x1ABA, 220, 0, 0}, + {0x1ABB, 230, 0, 0}, + {0x1ABC, 230, 0, 0}, + {0x1ABD, 220, 0, 0}, + {0x1ABF, 220, 0, 0}, + {0x1AC0, 220, 0, 0}, + {0x1AC1, 230, 0, 0}, + {0x1AC2, 230, 0, 0}, + {0x1AC3, 220, 0, 0}, + {0x1AC4, 220, 0, 0}, + {0x1AC5, 230, 0, 0}, + {0x1AC6, 230, 0, 0}, + {0x1AC7, 230, 0, 0}, + {0x1AC8, 230, 0, 0}, + {0x1AC9, 230, 0, 0}, + {0x1ACA, 220, 0, 0}, + {0x1ACB, 230, 0, 0}, + {0x1ACC, 230, 0, 0}, + {0x1ACD, 230, 0, 0}, + {0x1ACE, 230, 0, 0}, + {0x1B06, 0, 2, 885}, + {0x1B08, 0, 2, 887}, + {0x1B0A, 0, 2, 889}, + {0x1B0C, 0, 2, 891}, + {0x1B0E, 0, 2, 893}, + {0x1B12, 0, 2, 895}, + {0x1B34, 7, 0, 0}, + {0x1B3B, 0, 2, 897}, + {0x1B3D, 0, 2, 899}, + {0x1B40, 0, 2, 901}, + {0x1B41, 0, 2, 903}, + {0x1B43, 0, 2, 905}, + {0x1B44, 9, 0, 0}, + {0x1B6B, 230, 0, 0}, + {0x1B6C, 220, 0, 0}, + {0x1B6D, 230, 0, 0}, + {0x1B6E, 230, 0, 0}, + {0x1B6F, 230, 0, 0}, + {0x1B70, 230, 0, 0}, + {0x1B71, 230, 0, 0}, + {0x1B72, 230, 0, 0}, + {0x1B73, 230, 0, 0}, + {0x1BAA, 9, 0, 0}, + {0x1BAB, 9, 0, 0}, + {0x1BE6, 7, 0, 0}, + {0x1BF2, 9, 0, 0}, + {0x1BF3, 9, 0, 0}, + {0x1C37, 7, 0, 0}, + {0x1CD0, 230, 0, 0}, + {0x1CD1, 230, 0, 0}, + {0x1CD2, 230, 0, 0}, + {0x1CD4, 1, 0, 0}, + {0x1CD5, 220, 0, 0}, + {0x1CD6, 220, 0, 0}, + {0x1CD7, 220, 0, 0}, + {0x1CD8, 220, 0, 0}, + {0x1CD9, 220, 0, 0}, + {0x1CDA, 230, 0, 0}, + {0x1CDB, 230, 0, 0}, + {0x1CDC, 220, 0, 0}, + {0x1CDD, 220, 0, 0}, + {0x1CDE, 220, 0, 0}, + {0x1CDF, 220, 0, 0}, + {0x1CE0, 230, 0, 0}, + {0x1CE2, 1, 0, 0}, + {0x1CE3, 1, 0, 0}, + {0x1CE4, 1, 0, 0}, + {0x1CE5, 1, 0, 0}, + {0x1CE6, 1, 0, 0}, + {0x1CE7, 1, 0, 0}, + {0x1CE8, 1, 0, 0}, + {0x1CED, 220, 0, 0}, + {0x1CF4, 230, 0, 0}, + {0x1CF8, 230, 0, 0}, + {0x1CF9, 230, 0, 0}, + {0x1D2C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D2D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00C6}, + {0x1D2E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x018E}, + {0x1D33, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D38, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D3A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D3C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D3D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0222}, + {0x1D3E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D3F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D40, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D41, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D43, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D44, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0250}, + {0x1D45, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0251}, + {0x1D46, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D02}, + {0x1D47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D48, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D4A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0259}, + {0x1D4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025B}, + {0x1D4C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025C}, + {0x1D4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x014B}, + {0x1D52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D53, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0254}, + {0x1D54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D16}, + {0x1D55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D17}, + {0x1D56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D1D}, + {0x1D5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026F}, + {0x1D5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D25}, + {0x1D5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D78, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043D}, + {0x1D9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0252}, + {0x1D9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0255}, + {0x1D9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00F0}, + {0x1D9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025C}, + {0x1DA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1DA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025F}, + {0x1DA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0261}, + {0x1DA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0265}, + {0x1DA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0268}, + {0x1DA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0269}, + {0x1DA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026A}, + {0x1DA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D7B}, + {0x1DA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x029D}, + {0x1DA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026D}, + {0x1DAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D85}, + {0x1DAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x029F}, + {0x1DAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0271}, + {0x1DAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0270}, + {0x1DAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0272}, + {0x1DAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0273}, + {0x1DB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0274}, + {0x1DB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0275}, + {0x1DB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0278}, + {0x1DB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0282}, + {0x1DB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0283}, + {0x1DB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x01AB}, + {0x1DB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0289}, + {0x1DB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028A}, + {0x1DB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D1C}, + {0x1DB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028B}, + {0x1DBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028C}, + {0x1DBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1DBC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0290}, + {0x1DBD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0291}, + {0x1DBE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0292}, + {0x1DBF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1DC0, 230, 0, 0}, + {0x1DC1, 230, 0, 0}, + {0x1DC2, 220, 0, 0}, + {0x1DC3, 230, 0, 0}, + {0x1DC4, 230, 0, 0}, + {0x1DC5, 230, 0, 0}, + {0x1DC6, 230, 0, 0}, + {0x1DC7, 230, 0, 0}, + {0x1DC8, 230, 0, 0}, + {0x1DC9, 230, 0, 0}, + {0x1DCA, 220, 0, 0}, + {0x1DCB, 230, 0, 0}, + {0x1DCC, 230, 0, 0}, + {0x1DCD, 234, 0, 0}, + {0x1DCE, 214, 0, 0}, + {0x1DCF, 220, 0, 0}, + {0x1DD0, 202, 0, 0}, + {0x1DD1, 230, 0, 0}, + {0x1DD2, 230, 0, 0}, + {0x1DD3, 230, 0, 0}, + {0x1DD4, 230, 0, 0}, + {0x1DD5, 230, 0, 0}, + {0x1DD6, 230, 0, 0}, + {0x1DD7, 230, 0, 0}, + {0x1DD8, 230, 0, 0}, + {0x1DD9, 230, 0, 0}, + {0x1DDA, 230, 0, 0}, + {0x1DDB, 230, 0, 0}, + {0x1DDC, 230, 0, 0}, + {0x1DDD, 230, 0, 0}, + {0x1DDE, 230, 0, 0}, + {0x1DDF, 230, 0, 0}, + {0x1DE0, 230, 0, 0}, + {0x1DE1, 230, 0, 0}, + {0x1DE2, 230, 0, 0}, + {0x1DE3, 230, 0, 0}, + {0x1DE4, 230, 0, 0}, + {0x1DE5, 230, 0, 0}, + {0x1DE6, 230, 0, 0}, + {0x1DE7, 230, 0, 0}, + {0x1DE8, 230, 0, 0}, + {0x1DE9, 230, 0, 0}, + {0x1DEA, 230, 0, 0}, + {0x1DEB, 230, 0, 0}, + {0x1DEC, 230, 0, 0}, + {0x1DED, 230, 0, 0}, + {0x1DEE, 230, 0, 0}, + {0x1DEF, 230, 0, 0}, + {0x1DF0, 230, 0, 0}, + {0x1DF1, 230, 0, 0}, + {0x1DF2, 230, 0, 0}, + {0x1DF3, 230, 0, 0}, + {0x1DF4, 230, 0, 0}, + {0x1DF5, 230, 0, 0}, + {0x1DF6, 232, 0, 0}, + {0x1DF7, 228, 0, 0}, + {0x1DF8, 228, 0, 0}, + {0x1DF9, 220, 0, 0}, + {0x1DFA, 218, 0, 0}, + {0x1DFB, 230, 0, 0}, + {0x1DFC, 233, 0, 0}, + {0x1DFD, 220, 0, 0}, + {0x1DFE, 230, 0, 0}, + {0x1DFF, 220, 0, 0}, + {0x1E00, 0, 2, 907}, + {0x1E01, 0, 2, 909}, + {0x1E02, 0, 2, 911}, + {0x1E03, 0, 2, 913}, + {0x1E04, 0, 2, 915}, + {0x1E05, 0, 2, 917}, + {0x1E06, 0, 2, 919}, + {0x1E07, 0, 2, 921}, + {0x1E08, 0, 2, 923}, + {0x1E09, 0, 2, 925}, + {0x1E0A, 0, 2, 927}, + {0x1E0B, 0, 2, 929}, + {0x1E0C, 0, 2, 931}, + {0x1E0D, 0, 2, 933}, + {0x1E0E, 0, 2, 935}, + {0x1E0F, 0, 2, 937}, + {0x1E10, 0, 2, 939}, + {0x1E11, 0, 2, 941}, + {0x1E12, 0, 2, 943}, + {0x1E13, 0, 2, 945}, + {0x1E14, 0, 2, 947}, + {0x1E15, 0, 2, 949}, + {0x1E16, 0, 2, 951}, + {0x1E17, 0, 2, 953}, + {0x1E18, 0, 2, 955}, + {0x1E19, 0, 2, 957}, + {0x1E1A, 0, 2, 959}, + {0x1E1B, 0, 2, 961}, + {0x1E1C, 0, 2, 963}, + {0x1E1D, 0, 2, 965}, + {0x1E1E, 0, 2, 967}, + {0x1E1F, 0, 2, 969}, + {0x1E20, 0, 2, 971}, + {0x1E21, 0, 2, 973}, + {0x1E22, 0, 2, 975}, + {0x1E23, 0, 2, 977}, + {0x1E24, 0, 2, 979}, + {0x1E25, 0, 2, 981}, + {0x1E26, 0, 2, 983}, + {0x1E27, 0, 2, 985}, + {0x1E28, 0, 2, 987}, + {0x1E29, 0, 2, 989}, + {0x1E2A, 0, 2, 991}, + {0x1E2B, 0, 2, 993}, + {0x1E2C, 0, 2, 995}, + {0x1E2D, 0, 2, 997}, + {0x1E2E, 0, 2, 999}, + {0x1E2F, 0, 2, 1001}, + {0x1E30, 0, 2, 1003}, + {0x1E31, 0, 2, 1005}, + {0x1E32, 0, 2, 1007}, + {0x1E33, 0, 2, 1009}, + {0x1E34, 0, 2, 1011}, + {0x1E35, 0, 2, 1013}, + {0x1E36, 0, 2, 1015}, + {0x1E37, 0, 2, 1017}, + {0x1E38, 0, 2, 1019}, + {0x1E39, 0, 2, 1021}, + {0x1E3A, 0, 2, 1023}, + {0x1E3B, 0, 2, 1025}, + {0x1E3C, 0, 2, 1027}, + {0x1E3D, 0, 2, 1029}, + {0x1E3E, 0, 2, 1031}, + {0x1E3F, 0, 2, 1033}, + {0x1E40, 0, 2, 1035}, + {0x1E41, 0, 2, 1037}, + {0x1E42, 0, 2, 1039}, + {0x1E43, 0, 2, 1041}, + {0x1E44, 0, 2, 1043}, + {0x1E45, 0, 2, 1045}, + {0x1E46, 0, 2, 1047}, + {0x1E47, 0, 2, 1049}, + {0x1E48, 0, 2, 1051}, + {0x1E49, 0, 2, 1053}, + {0x1E4A, 0, 2, 1055}, + {0x1E4B, 0, 2, 1057}, + {0x1E4C, 0, 2, 1059}, + {0x1E4D, 0, 2, 1061}, + {0x1E4E, 0, 2, 1063}, + {0x1E4F, 0, 2, 1065}, + {0x1E50, 0, 2, 1067}, + {0x1E51, 0, 2, 1069}, + {0x1E52, 0, 2, 1071}, + {0x1E53, 0, 2, 1073}, + {0x1E54, 0, 2, 1075}, + {0x1E55, 0, 2, 1077}, + {0x1E56, 0, 2, 1079}, + {0x1E57, 0, 2, 1081}, + {0x1E58, 0, 2, 1083}, + {0x1E59, 0, 2, 1085}, + {0x1E5A, 0, 2, 1087}, + {0x1E5B, 0, 2, 1089}, + {0x1E5C, 0, 2, 1091}, + {0x1E5D, 0, 2, 1093}, + {0x1E5E, 0, 2, 1095}, + {0x1E5F, 0, 2, 1097}, + {0x1E60, 0, 2, 1099}, + {0x1E61, 0, 2, 1101}, + {0x1E62, 0, 2, 1103}, + {0x1E63, 0, 2, 1105}, + {0x1E64, 0, 2, 1107}, + {0x1E65, 0, 2, 1109}, + {0x1E66, 0, 2, 1111}, + {0x1E67, 0, 2, 1113}, + {0x1E68, 0, 2, 1115}, + {0x1E69, 0, 2, 1117}, + {0x1E6A, 0, 2, 1119}, + {0x1E6B, 0, 2, 1121}, + {0x1E6C, 0, 2, 1123}, + {0x1E6D, 0, 2, 1125}, + {0x1E6E, 0, 2, 1127}, + {0x1E6F, 0, 2, 1129}, + {0x1E70, 0, 2, 1131}, + {0x1E71, 0, 2, 1133}, + {0x1E72, 0, 2, 1135}, + {0x1E73, 0, 2, 1137}, + {0x1E74, 0, 2, 1139}, + {0x1E75, 0, 2, 1141}, + {0x1E76, 0, 2, 1143}, + {0x1E77, 0, 2, 1145}, + {0x1E78, 0, 2, 1147}, + {0x1E79, 0, 2, 1149}, + {0x1E7A, 0, 2, 1151}, + {0x1E7B, 0, 2, 1153}, + {0x1E7C, 0, 2, 1155}, + {0x1E7D, 0, 2, 1157}, + {0x1E7E, 0, 2, 1159}, + {0x1E7F, 0, 2, 1161}, + {0x1E80, 0, 2, 1163}, + {0x1E81, 0, 2, 1165}, + {0x1E82, 0, 2, 1167}, + {0x1E83, 0, 2, 1169}, + {0x1E84, 0, 2, 1171}, + {0x1E85, 0, 2, 1173}, + {0x1E86, 0, 2, 1175}, + {0x1E87, 0, 2, 1177}, + {0x1E88, 0, 2, 1179}, + {0x1E89, 0, 2, 1181}, + {0x1E8A, 0, 2, 1183}, + {0x1E8B, 0, 2, 1185}, + {0x1E8C, 0, 2, 1187}, + {0x1E8D, 0, 2, 1189}, + {0x1E8E, 0, 2, 1191}, + {0x1E8F, 0, 2, 1193}, + {0x1E90, 0, 2, 1195}, + {0x1E91, 0, 2, 1197}, + {0x1E92, 0, 2, 1199}, + {0x1E93, 0, 2, 1201}, + {0x1E94, 0, 2, 1203}, + {0x1E95, 0, 2, 1205}, + {0x1E96, 0, 2, 1207}, + {0x1E97, 0, 2, 1209}, + {0x1E98, 0, 2, 1211}, + {0x1E99, 0, 2, 1213}, + {0x1E9A, 0, 2 | DECOMP_COMPAT, 1215}, + {0x1E9B, 0, 2, 1217}, + {0x1EA0, 0, 2, 1219}, + {0x1EA1, 0, 2, 1221}, + {0x1EA2, 0, 2, 1223}, + {0x1EA3, 0, 2, 1225}, + {0x1EA4, 0, 2, 1227}, + {0x1EA5, 0, 2, 1229}, + {0x1EA6, 0, 2, 1231}, + {0x1EA7, 0, 2, 1233}, + {0x1EA8, 0, 2, 1235}, + {0x1EA9, 0, 2, 1237}, + {0x1EAA, 0, 2, 1239}, + {0x1EAB, 0, 2, 1241}, + {0x1EAC, 0, 2, 1243}, + {0x1EAD, 0, 2, 1245}, + {0x1EAE, 0, 2, 1247}, + {0x1EAF, 0, 2, 1249}, + {0x1EB0, 0, 2, 1251}, + {0x1EB1, 0, 2, 1253}, + {0x1EB2, 0, 2, 1255}, + {0x1EB3, 0, 2, 1257}, + {0x1EB4, 0, 2, 1259}, + {0x1EB5, 0, 2, 1261}, + {0x1EB6, 0, 2, 1263}, + {0x1EB7, 0, 2, 1265}, + {0x1EB8, 0, 2, 1267}, + {0x1EB9, 0, 2, 1269}, + {0x1EBA, 0, 2, 1271}, + {0x1EBB, 0, 2, 1273}, + {0x1EBC, 0, 2, 1275}, + {0x1EBD, 0, 2, 1277}, + {0x1EBE, 0, 2, 1279}, + {0x1EBF, 0, 2, 1281}, + {0x1EC0, 0, 2, 1283}, + {0x1EC1, 0, 2, 1285}, + {0x1EC2, 0, 2, 1287}, + {0x1EC3, 0, 2, 1289}, + {0x1EC4, 0, 2, 1291}, + {0x1EC5, 0, 2, 1293}, + {0x1EC6, 0, 2, 1295}, + {0x1EC7, 0, 2, 1297}, + {0x1EC8, 0, 2, 1299}, + {0x1EC9, 0, 2, 1301}, + {0x1ECA, 0, 2, 1303}, + {0x1ECB, 0, 2, 1305}, + {0x1ECC, 0, 2, 1307}, + {0x1ECD, 0, 2, 1309}, + {0x1ECE, 0, 2, 1311}, + {0x1ECF, 0, 2, 1313}, + {0x1ED0, 0, 2, 1315}, + {0x1ED1, 0, 2, 1317}, + {0x1ED2, 0, 2, 1319}, + {0x1ED3, 0, 2, 1321}, + {0x1ED4, 0, 2, 1323}, + {0x1ED5, 0, 2, 1325}, + {0x1ED6, 0, 2, 1327}, + {0x1ED7, 0, 2, 1329}, + {0x1ED8, 0, 2, 1331}, + {0x1ED9, 0, 2, 1333}, + {0x1EDA, 0, 2, 1335}, + {0x1EDB, 0, 2, 1337}, + {0x1EDC, 0, 2, 1339}, + {0x1EDD, 0, 2, 1341}, + {0x1EDE, 0, 2, 1343}, + {0x1EDF, 0, 2, 1345}, + {0x1EE0, 0, 2, 1347}, + {0x1EE1, 0, 2, 1349}, + {0x1EE2, 0, 2, 1351}, + {0x1EE3, 0, 2, 1353}, + {0x1EE4, 0, 2, 1355}, + {0x1EE5, 0, 2, 1357}, + {0x1EE6, 0, 2, 1359}, + {0x1EE7, 0, 2, 1361}, + {0x1EE8, 0, 2, 1363}, + {0x1EE9, 0, 2, 1365}, + {0x1EEA, 0, 2, 1367}, + {0x1EEB, 0, 2, 1369}, + {0x1EEC, 0, 2, 1371}, + {0x1EED, 0, 2, 1373}, + {0x1EEE, 0, 2, 1375}, + {0x1EEF, 0, 2, 1377}, + {0x1EF0, 0, 2, 1379}, + {0x1EF1, 0, 2, 1381}, + {0x1EF2, 0, 2, 1383}, + {0x1EF3, 0, 2, 1385}, + {0x1EF4, 0, 2, 1387}, + {0x1EF5, 0, 2, 1389}, + {0x1EF6, 0, 2, 1391}, + {0x1EF7, 0, 2, 1393}, + {0x1EF8, 0, 2, 1395}, + {0x1EF9, 0, 2, 1397}, + {0x1F00, 0, 2, 1399}, + {0x1F01, 0, 2, 1401}, + {0x1F02, 0, 2, 1403}, + {0x1F03, 0, 2, 1405}, + {0x1F04, 0, 2, 1407}, + {0x1F05, 0, 2, 1409}, + {0x1F06, 0, 2, 1411}, + {0x1F07, 0, 2, 1413}, + {0x1F08, 0, 2, 1415}, + {0x1F09, 0, 2, 1417}, + {0x1F0A, 0, 2, 1419}, + {0x1F0B, 0, 2, 1421}, + {0x1F0C, 0, 2, 1423}, + {0x1F0D, 0, 2, 1425}, + {0x1F0E, 0, 2, 1427}, + {0x1F0F, 0, 2, 1429}, + {0x1F10, 0, 2, 1431}, + {0x1F11, 0, 2, 1433}, + {0x1F12, 0, 2, 1435}, + {0x1F13, 0, 2, 1437}, + {0x1F14, 0, 2, 1439}, + {0x1F15, 0, 2, 1441}, + {0x1F18, 0, 2, 1443}, + {0x1F19, 0, 2, 1445}, + {0x1F1A, 0, 2, 1447}, + {0x1F1B, 0, 2, 1449}, + {0x1F1C, 0, 2, 1451}, + {0x1F1D, 0, 2, 1453}, + {0x1F20, 0, 2, 1455}, + {0x1F21, 0, 2, 1457}, + {0x1F22, 0, 2, 1459}, + {0x1F23, 0, 2, 1461}, + {0x1F24, 0, 2, 1463}, + {0x1F25, 0, 2, 1465}, + {0x1F26, 0, 2, 1467}, + {0x1F27, 0, 2, 1469}, + {0x1F28, 0, 2, 1471}, + {0x1F29, 0, 2, 1473}, + {0x1F2A, 0, 2, 1475}, + {0x1F2B, 0, 2, 1477}, + {0x1F2C, 0, 2, 1479}, + {0x1F2D, 0, 2, 1481}, + {0x1F2E, 0, 2, 1483}, + {0x1F2F, 0, 2, 1485}, + {0x1F30, 0, 2, 1487}, + {0x1F31, 0, 2, 1489}, + {0x1F32, 0, 2, 1491}, + {0x1F33, 0, 2, 1493}, + {0x1F34, 0, 2, 1495}, + {0x1F35, 0, 2, 1497}, + {0x1F36, 0, 2, 1499}, + {0x1F37, 0, 2, 1501}, + {0x1F38, 0, 2, 1503}, + {0x1F39, 0, 2, 1505}, + {0x1F3A, 0, 2, 1507}, + {0x1F3B, 0, 2, 1509}, + {0x1F3C, 0, 2, 1511}, + {0x1F3D, 0, 2, 1513}, + {0x1F3E, 0, 2, 1515}, + {0x1F3F, 0, 2, 1517}, + {0x1F40, 0, 2, 1519}, + {0x1F41, 0, 2, 1521}, + {0x1F42, 0, 2, 1523}, + {0x1F43, 0, 2, 1525}, + {0x1F44, 0, 2, 1527}, + {0x1F45, 0, 2, 1529}, + {0x1F48, 0, 2, 1531}, + {0x1F49, 0, 2, 1533}, + {0x1F4A, 0, 2, 1535}, + {0x1F4B, 0, 2, 1537}, + {0x1F4C, 0, 2, 1539}, + {0x1F4D, 0, 2, 1541}, + {0x1F50, 0, 2, 1543}, + {0x1F51, 0, 2, 1545}, + {0x1F52, 0, 2, 1547}, + {0x1F53, 0, 2, 1549}, + {0x1F54, 0, 2, 1551}, + {0x1F55, 0, 2, 1553}, + {0x1F56, 0, 2, 1555}, + {0x1F57, 0, 2, 1557}, + {0x1F59, 0, 2, 1559}, + {0x1F5B, 0, 2, 1561}, + {0x1F5D, 0, 2, 1563}, + {0x1F5F, 0, 2, 1565}, + {0x1F60, 0, 2, 1567}, + {0x1F61, 0, 2, 1569}, + {0x1F62, 0, 2, 1571}, + {0x1F63, 0, 2, 1573}, + {0x1F64, 0, 2, 1575}, + {0x1F65, 0, 2, 1577}, + {0x1F66, 0, 2, 1579}, + {0x1F67, 0, 2, 1581}, + {0x1F68, 0, 2, 1583}, + {0x1F69, 0, 2, 1585}, + {0x1F6A, 0, 2, 1587}, + {0x1F6B, 0, 2, 1589}, + {0x1F6C, 0, 2, 1591}, + {0x1F6D, 0, 2, 1593}, + {0x1F6E, 0, 2, 1595}, + {0x1F6F, 0, 2, 1597}, + {0x1F70, 0, 2, 1599}, + {0x1F71, 0, 1 | DECOMP_INLINE, 0x03AC}, + {0x1F72, 0, 2, 1601}, + {0x1F73, 0, 1 | DECOMP_INLINE, 0x03AD}, + {0x1F74, 0, 2, 1603}, + {0x1F75, 0, 1 | DECOMP_INLINE, 0x03AE}, + {0x1F76, 0, 2, 1605}, + {0x1F77, 0, 1 | DECOMP_INLINE, 0x03AF}, + {0x1F78, 0, 2, 1607}, + {0x1F79, 0, 1 | DECOMP_INLINE, 0x03CC}, + {0x1F7A, 0, 2, 1609}, + {0x1F7B, 0, 1 | DECOMP_INLINE, 0x03CD}, + {0x1F7C, 0, 2, 1611}, + {0x1F7D, 0, 1 | DECOMP_INLINE, 0x03CE}, + {0x1F80, 0, 2, 1613}, + {0x1F81, 0, 2, 1615}, + {0x1F82, 0, 2, 1617}, + {0x1F83, 0, 2, 1619}, + {0x1F84, 0, 2, 1621}, + {0x1F85, 0, 2, 1623}, + {0x1F86, 0, 2, 1625}, + {0x1F87, 0, 2, 1627}, + {0x1F88, 0, 2, 1629}, + {0x1F89, 0, 2, 1631}, + {0x1F8A, 0, 2, 1633}, + {0x1F8B, 0, 2, 1635}, + {0x1F8C, 0, 2, 1637}, + {0x1F8D, 0, 2, 1639}, + {0x1F8E, 0, 2, 1641}, + {0x1F8F, 0, 2, 1643}, + {0x1F90, 0, 2, 1645}, + {0x1F91, 0, 2, 1647}, + {0x1F92, 0, 2, 1649}, + {0x1F93, 0, 2, 1651}, + {0x1F94, 0, 2, 1653}, + {0x1F95, 0, 2, 1655}, + {0x1F96, 0, 2, 1657}, + {0x1F97, 0, 2, 1659}, + {0x1F98, 0, 2, 1661}, + {0x1F99, 0, 2, 1663}, + {0x1F9A, 0, 2, 1665}, + {0x1F9B, 0, 2, 1667}, + {0x1F9C, 0, 2, 1669}, + {0x1F9D, 0, 2, 1671}, + {0x1F9E, 0, 2, 1673}, + {0x1F9F, 0, 2, 1675}, + {0x1FA0, 0, 2, 1677}, + {0x1FA1, 0, 2, 1679}, + {0x1FA2, 0, 2, 1681}, + {0x1FA3, 0, 2, 1683}, + {0x1FA4, 0, 2, 1685}, + {0x1FA5, 0, 2, 1687}, + {0x1FA6, 0, 2, 1689}, + {0x1FA7, 0, 2, 1691}, + {0x1FA8, 0, 2, 1693}, + {0x1FA9, 0, 2, 1695}, + {0x1FAA, 0, 2, 1697}, + {0x1FAB, 0, 2, 1699}, + {0x1FAC, 0, 2, 1701}, + {0x1FAD, 0, 2, 1703}, + {0x1FAE, 0, 2, 1705}, + {0x1FAF, 0, 2, 1707}, + {0x1FB0, 0, 2, 1709}, + {0x1FB1, 0, 2, 1711}, + {0x1FB2, 0, 2, 1713}, + {0x1FB3, 0, 2, 1715}, + {0x1FB4, 0, 2, 1717}, + {0x1FB6, 0, 2, 1719}, + {0x1FB7, 0, 2, 1721}, + {0x1FB8, 0, 2, 1723}, + {0x1FB9, 0, 2, 1725}, + {0x1FBA, 0, 2, 1727}, + {0x1FBB, 0, 1 | DECOMP_INLINE, 0x0386}, + {0x1FBC, 0, 2, 1729}, + {0x1FBD, 0, 2 | DECOMP_COMPAT, 1731}, + {0x1FBE, 0, 1 | DECOMP_INLINE, 0x03B9}, + {0x1FBF, 0, 2 | DECOMP_COMPAT, 1733}, + {0x1FC0, 0, 2 | DECOMP_COMPAT, 1735}, + {0x1FC1, 0, 2, 1737}, + {0x1FC2, 0, 2, 1739}, + {0x1FC3, 0, 2, 1741}, + {0x1FC4, 0, 2, 1743}, + {0x1FC6, 0, 2, 1745}, + {0x1FC7, 0, 2, 1747}, + {0x1FC8, 0, 2, 1749}, + {0x1FC9, 0, 1 | DECOMP_INLINE, 0x0388}, + {0x1FCA, 0, 2, 1751}, + {0x1FCB, 0, 1 | DECOMP_INLINE, 0x0389}, + {0x1FCC, 0, 2, 1753}, + {0x1FCD, 0, 2, 1755}, + {0x1FCE, 0, 2, 1757}, + {0x1FCF, 0, 2, 1759}, + {0x1FD0, 0, 2, 1761}, + {0x1FD1, 0, 2, 1763}, + {0x1FD2, 0, 2, 1765}, + {0x1FD3, 0, 1 | DECOMP_INLINE, 0x0390}, + {0x1FD6, 0, 2, 1767}, + {0x1FD7, 0, 2, 1769}, + {0x1FD8, 0, 2, 1771}, + {0x1FD9, 0, 2, 1773}, + {0x1FDA, 0, 2, 1775}, + {0x1FDB, 0, 1 | DECOMP_INLINE, 0x038A}, + {0x1FDD, 0, 2, 1777}, + {0x1FDE, 0, 2, 1779}, + {0x1FDF, 0, 2, 1781}, + {0x1FE0, 0, 2, 1783}, + {0x1FE1, 0, 2, 1785}, + {0x1FE2, 0, 2, 1787}, + {0x1FE3, 0, 1 | DECOMP_INLINE, 0x03B0}, + {0x1FE4, 0, 2, 1789}, + {0x1FE5, 0, 2, 1791}, + {0x1FE6, 0, 2, 1793}, + {0x1FE7, 0, 2, 1795}, + {0x1FE8, 0, 2, 1797}, + {0x1FE9, 0, 2, 1799}, + {0x1FEA, 0, 2, 1801}, + {0x1FEB, 0, 1 | DECOMP_INLINE, 0x038E}, + {0x1FEC, 0, 2, 1803}, + {0x1FED, 0, 2, 1805}, + {0x1FEE, 0, 1 | DECOMP_INLINE, 0x0385}, + {0x1FEF, 0, 1 | DECOMP_INLINE, 0x0060}, + {0x1FF2, 0, 2, 1807}, + {0x1FF3, 0, 2, 1809}, + {0x1FF4, 0, 2, 1811}, + {0x1FF6, 0, 2, 1813}, + {0x1FF7, 0, 2, 1815}, + {0x1FF8, 0, 2, 1817}, + {0x1FF9, 0, 1 | DECOMP_INLINE, 0x038C}, + {0x1FFA, 0, 2, 1819}, + {0x1FFB, 0, 1 | DECOMP_INLINE, 0x038F}, + {0x1FFC, 0, 2, 1821}, + {0x1FFD, 0, 1 | DECOMP_INLINE, 0x00B4}, + {0x1FFE, 0, 2 | DECOMP_COMPAT, 1823}, + {0x2000, 0, 1 | DECOMP_INLINE, 0x2002}, + {0x2001, 0, 1 | DECOMP_INLINE, 0x2003}, + {0x2002, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2003, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2004, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2005, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2006, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2007, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2008, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2009, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x200A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2011, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2010}, + {0x2017, 0, 2 | DECOMP_COMPAT, 1825}, + {0x2024, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002E}, + {0x2025, 0, 2 | DECOMP_COMPAT, 1827}, + {0x2026, 0, 3 | DECOMP_COMPAT, 1829}, + {0x202F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2033, 0, 2 | DECOMP_COMPAT, 1832}, + {0x2034, 0, 3 | DECOMP_COMPAT, 1834}, + {0x2036, 0, 2 | DECOMP_COMPAT, 1837}, + {0x2037, 0, 3 | DECOMP_COMPAT, 1839}, + {0x203C, 0, 2 | DECOMP_COMPAT, 1842}, + {0x203E, 0, 2 | DECOMP_COMPAT, 1844}, + {0x2047, 0, 2 | DECOMP_COMPAT, 1846}, + {0x2048, 0, 2 | DECOMP_COMPAT, 1848}, + {0x2049, 0, 2 | DECOMP_COMPAT, 1850}, + {0x2057, 0, 4 | DECOMP_COMPAT, 1852}, + {0x205F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2070, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x2071, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x2074, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x2075, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x2076, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x2077, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x2078, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x2079, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x207A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0x207B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2212}, + {0x207C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003D}, + {0x207D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0x207E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0x207F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x2080, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x2081, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x2082, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x2083, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x2084, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x2085, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x2086, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x2087, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x2088, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x2089, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x208A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0x208B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2212}, + {0x208C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003D}, + {0x208D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0x208E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0x2090, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x2091, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x2092, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x2093, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x2094, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0259}, + {0x2095, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x2096, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x2097, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x2098, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x2099, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x209A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x209B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x209C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x20A8, 0, 2 | DECOMP_COMPAT, 1856}, + {0x20D0, 230, 0, 0}, + {0x20D1, 230, 0, 0}, + {0x20D2, 1, 0, 0}, + {0x20D3, 1, 0, 0}, + {0x20D4, 230, 0, 0}, + {0x20D5, 230, 0, 0}, + {0x20D6, 230, 0, 0}, + {0x20D7, 230, 0, 0}, + {0x20D8, 1, 0, 0}, + {0x20D9, 1, 0, 0}, + {0x20DA, 1, 0, 0}, + {0x20DB, 230, 0, 0}, + {0x20DC, 230, 0, 0}, + {0x20E1, 230, 0, 0}, + {0x20E5, 1, 0, 0}, + {0x20E6, 1, 0, 0}, + {0x20E7, 230, 0, 0}, + {0x20E8, 220, 0, 0}, + {0x20E9, 230, 0, 0}, + {0x20EA, 1, 0, 0}, + {0x20EB, 1, 0, 0}, + {0x20EC, 220, 0, 0}, + {0x20ED, 220, 0, 0}, + {0x20EE, 220, 0, 0}, + {0x20EF, 220, 0, 0}, + {0x20F0, 230, 0, 0}, + {0x2100, 0, 3 | DECOMP_COMPAT, 1858}, + {0x2101, 0, 3 | DECOMP_COMPAT, 1861}, + {0x2102, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x2103, 0, 2 | DECOMP_COMPAT, 1864}, + {0x2105, 0, 3 | DECOMP_COMPAT, 1866}, + {0x2106, 0, 3 | DECOMP_COMPAT, 1869}, + {0x2107, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0190}, + {0x2109, 0, 2 | DECOMP_COMPAT, 1872}, + {0x210A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x210B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x210C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x210D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x210E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x210F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0127}, + {0x2110, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x2111, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x2112, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x2113, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x2115, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x2116, 0, 2 | DECOMP_COMPAT, 1874}, + {0x2119, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x211A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x211B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x211C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x211D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x2120, 0, 2 | DECOMP_COMPAT, 1876}, + {0x2121, 0, 3 | DECOMP_COMPAT, 1878}, + {0x2122, 0, 2 | DECOMP_COMPAT, 1881}, + {0x2124, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x2126, 0, 1 | DECOMP_INLINE, 0x03A9}, + {0x2128, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x212A, 0, 1 | DECOMP_INLINE, 0x004B}, + {0x212B, 0, 1 | DECOMP_INLINE, 0x00C5}, + {0x212C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x212D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x212F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x2130, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x2131, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x2133, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x2134, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x2135, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D0}, + {0x2136, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D1}, + {0x2137, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D2}, + {0x2138, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D3}, + {0x2139, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x213B, 0, 3 | DECOMP_COMPAT, 1883}, + {0x213C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x213D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x213E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x213F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x2140, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2211}, + {0x2145, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x2146, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x2147, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x2148, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x2149, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x2150, 0, 3 | DECOMP_COMPAT, 1886}, + {0x2151, 0, 3 | DECOMP_COMPAT, 1889}, + {0x2152, 0, 4 | DECOMP_COMPAT, 1892}, + {0x2153, 0, 3 | DECOMP_COMPAT, 1896}, + {0x2154, 0, 3 | DECOMP_COMPAT, 1899}, + {0x2155, 0, 3 | DECOMP_COMPAT, 1902}, + {0x2156, 0, 3 | DECOMP_COMPAT, 1905}, + {0x2157, 0, 3 | DECOMP_COMPAT, 1908}, + {0x2158, 0, 3 | DECOMP_COMPAT, 1911}, + {0x2159, 0, 3 | DECOMP_COMPAT, 1914}, + {0x215A, 0, 3 | DECOMP_COMPAT, 1917}, + {0x215B, 0, 3 | DECOMP_COMPAT, 1920}, + {0x215C, 0, 3 | DECOMP_COMPAT, 1923}, + {0x215D, 0, 3 | DECOMP_COMPAT, 1926}, + {0x215E, 0, 3 | DECOMP_COMPAT, 1929}, + {0x215F, 0, 2 | DECOMP_COMPAT, 1932}, + {0x2160, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x2161, 0, 2 | DECOMP_COMPAT, 1934}, + {0x2162, 0, 3 | DECOMP_COMPAT, 1936}, + {0x2163, 0, 2 | DECOMP_COMPAT, 1939}, + {0x2164, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x2165, 0, 2 | DECOMP_COMPAT, 1941}, + {0x2166, 0, 3 | DECOMP_COMPAT, 1943}, + {0x2167, 0, 4 | DECOMP_COMPAT, 1946}, + {0x2168, 0, 2 | DECOMP_COMPAT, 1950}, + {0x2169, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x216A, 0, 2 | DECOMP_COMPAT, 1952}, + {0x216B, 0, 3 | DECOMP_COMPAT, 1954}, + {0x216C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x216D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x216E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x216F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x2170, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x2171, 0, 2 | DECOMP_COMPAT, 1957}, + {0x2172, 0, 3 | DECOMP_COMPAT, 1959}, + {0x2173, 0, 2 | DECOMP_COMPAT, 1962}, + {0x2174, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x2175, 0, 2 | DECOMP_COMPAT, 1964}, + {0x2176, 0, 3 | DECOMP_COMPAT, 1966}, + {0x2177, 0, 4 | DECOMP_COMPAT, 1969}, + {0x2178, 0, 2 | DECOMP_COMPAT, 1973}, + {0x2179, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x217A, 0, 2 | DECOMP_COMPAT, 1975}, + {0x217B, 0, 3 | DECOMP_COMPAT, 1977}, + {0x217C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x217D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x217E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x217F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x2189, 0, 3 | DECOMP_COMPAT, 1980}, + {0x219A, 0, 2, 1983}, + {0x219B, 0, 2, 1985}, + {0x21AE, 0, 2, 1987}, + {0x21CD, 0, 2, 1989}, + {0x21CE, 0, 2, 1991}, + {0x21CF, 0, 2, 1993}, + {0x2204, 0, 2, 1995}, + {0x2209, 0, 2, 1997}, + {0x220C, 0, 2, 1999}, + {0x2224, 0, 2, 2001}, + {0x2226, 0, 2, 2003}, + {0x222C, 0, 2 | DECOMP_COMPAT, 2005}, + {0x222D, 0, 3 | DECOMP_COMPAT, 2007}, + {0x222F, 0, 2 | DECOMP_COMPAT, 2010}, + {0x2230, 0, 3 | DECOMP_COMPAT, 2012}, + {0x2241, 0, 2, 2015}, + {0x2244, 0, 2, 2017}, + {0x2247, 0, 2, 2019}, + {0x2249, 0, 2, 2021}, + {0x2260, 0, 2, 2023}, + {0x2262, 0, 2, 2025}, + {0x226D, 0, 2, 2027}, + {0x226E, 0, 2, 2029}, + {0x226F, 0, 2, 2031}, + {0x2270, 0, 2, 2033}, + {0x2271, 0, 2, 2035}, + {0x2274, 0, 2, 2037}, + {0x2275, 0, 2, 2039}, + {0x2278, 0, 2, 2041}, + {0x2279, 0, 2, 2043}, + {0x2280, 0, 2, 2045}, + {0x2281, 0, 2, 2047}, + {0x2284, 0, 2, 2049}, + {0x2285, 0, 2, 2051}, + {0x2288, 0, 2, 2053}, + {0x2289, 0, 2, 2055}, + {0x22AC, 0, 2, 2057}, + {0x22AD, 0, 2, 2059}, + {0x22AE, 0, 2, 2061}, + {0x22AF, 0, 2, 2063}, + {0x22E0, 0, 2, 2065}, + {0x22E1, 0, 2, 2067}, + {0x22E2, 0, 2, 2069}, + {0x22E3, 0, 2, 2071}, + {0x22EA, 0, 2, 2073}, + {0x22EB, 0, 2, 2075}, + {0x22EC, 0, 2, 2077}, + {0x22ED, 0, 2, 2079}, + {0x2329, 0, 1 | DECOMP_INLINE, 0x3008}, + {0x232A, 0, 1 | DECOMP_INLINE, 0x3009}, + {0x2460, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x2461, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x2462, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x2463, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x2464, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x2465, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x2466, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x2467, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x2468, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x2469, 0, 2 | DECOMP_COMPAT, 2081}, + {0x246A, 0, 2 | DECOMP_COMPAT, 2083}, + {0x246B, 0, 2 | DECOMP_COMPAT, 2085}, + {0x246C, 0, 2 | DECOMP_COMPAT, 2087}, + {0x246D, 0, 2 | DECOMP_COMPAT, 2089}, + {0x246E, 0, 2 | DECOMP_COMPAT, 2091}, + {0x246F, 0, 2 | DECOMP_COMPAT, 2093}, + {0x2470, 0, 2 | DECOMP_COMPAT, 2095}, + {0x2471, 0, 2 | DECOMP_COMPAT, 2097}, + {0x2472, 0, 2 | DECOMP_COMPAT, 2099}, + {0x2473, 0, 2 | DECOMP_COMPAT, 2101}, + {0x2474, 0, 3 | DECOMP_COMPAT, 2103}, + {0x2475, 0, 3 | DECOMP_COMPAT, 2106}, + {0x2476, 0, 3 | DECOMP_COMPAT, 2109}, + {0x2477, 0, 3 | DECOMP_COMPAT, 2112}, + {0x2478, 0, 3 | DECOMP_COMPAT, 2115}, + {0x2479, 0, 3 | DECOMP_COMPAT, 2118}, + {0x247A, 0, 3 | DECOMP_COMPAT, 2121}, + {0x247B, 0, 3 | DECOMP_COMPAT, 2124}, + {0x247C, 0, 3 | DECOMP_COMPAT, 2127}, + {0x247D, 0, 4 | DECOMP_COMPAT, 2130}, + {0x247E, 0, 4 | DECOMP_COMPAT, 2134}, + {0x247F, 0, 4 | DECOMP_COMPAT, 2138}, + {0x2480, 0, 4 | DECOMP_COMPAT, 2142}, + {0x2481, 0, 4 | DECOMP_COMPAT, 2146}, + {0x2482, 0, 4 | DECOMP_COMPAT, 2150}, + {0x2483, 0, 4 | DECOMP_COMPAT, 2154}, + {0x2484, 0, 4 | DECOMP_COMPAT, 2158}, + {0x2485, 0, 4 | DECOMP_COMPAT, 2162}, + {0x2486, 0, 4 | DECOMP_COMPAT, 2166}, + {0x2487, 0, 4 | DECOMP_COMPAT, 2170}, + {0x2488, 0, 2 | DECOMP_COMPAT, 2174}, + {0x2489, 0, 2 | DECOMP_COMPAT, 2176}, + {0x248A, 0, 2 | DECOMP_COMPAT, 2178}, + {0x248B, 0, 2 | DECOMP_COMPAT, 2180}, + {0x248C, 0, 2 | DECOMP_COMPAT, 2182}, + {0x248D, 0, 2 | DECOMP_COMPAT, 2184}, + {0x248E, 0, 2 | DECOMP_COMPAT, 2186}, + {0x248F, 0, 2 | DECOMP_COMPAT, 2188}, + {0x2490, 0, 2 | DECOMP_COMPAT, 2190}, + {0x2491, 0, 3 | DECOMP_COMPAT, 2192}, + {0x2492, 0, 3 | DECOMP_COMPAT, 2195}, + {0x2493, 0, 3 | DECOMP_COMPAT, 2198}, + {0x2494, 0, 3 | DECOMP_COMPAT, 2201}, + {0x2495, 0, 3 | DECOMP_COMPAT, 2204}, + {0x2496, 0, 3 | DECOMP_COMPAT, 2207}, + {0x2497, 0, 3 | DECOMP_COMPAT, 2210}, + {0x2498, 0, 3 | DECOMP_COMPAT, 2213}, + {0x2499, 0, 3 | DECOMP_COMPAT, 2216}, + {0x249A, 0, 3 | DECOMP_COMPAT, 2219}, + {0x249B, 0, 3 | DECOMP_COMPAT, 2222}, + {0x249C, 0, 3 | DECOMP_COMPAT, 2225}, + {0x249D, 0, 3 | DECOMP_COMPAT, 2228}, + {0x249E, 0, 3 | DECOMP_COMPAT, 2231}, + {0x249F, 0, 3 | DECOMP_COMPAT, 2234}, + {0x24A0, 0, 3 | DECOMP_COMPAT, 2237}, + {0x24A1, 0, 3 | DECOMP_COMPAT, 2240}, + {0x24A2, 0, 3 | DECOMP_COMPAT, 2243}, + {0x24A3, 0, 3 | DECOMP_COMPAT, 2246}, + {0x24A4, 0, 3 | DECOMP_COMPAT, 2249}, + {0x24A5, 0, 3 | DECOMP_COMPAT, 2252}, + {0x24A6, 0, 3 | DECOMP_COMPAT, 2255}, + {0x24A7, 0, 3 | DECOMP_COMPAT, 2258}, + {0x24A8, 0, 3 | DECOMP_COMPAT, 2261}, + {0x24A9, 0, 3 | DECOMP_COMPAT, 2264}, + {0x24AA, 0, 3 | DECOMP_COMPAT, 2267}, + {0x24AB, 0, 3 | DECOMP_COMPAT, 2270}, + {0x24AC, 0, 3 | DECOMP_COMPAT, 2273}, + {0x24AD, 0, 3 | DECOMP_COMPAT, 2276}, + {0x24AE, 0, 3 | DECOMP_COMPAT, 2279}, + {0x24AF, 0, 3 | DECOMP_COMPAT, 2282}, + {0x24B0, 0, 3 | DECOMP_COMPAT, 2285}, + {0x24B1, 0, 3 | DECOMP_COMPAT, 2288}, + {0x24B2, 0, 3 | DECOMP_COMPAT, 2291}, + {0x24B3, 0, 3 | DECOMP_COMPAT, 2294}, + {0x24B4, 0, 3 | DECOMP_COMPAT, 2297}, + {0x24B5, 0, 3 | DECOMP_COMPAT, 2300}, + {0x24B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x24B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x24B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x24B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x24BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x24BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x24BC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x24BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x24BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x24BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x24C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x24C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x24C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x24C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x24C4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x24C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x24C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x24C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x24C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x24C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x24CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x24CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x24CC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x24CD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x24CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x24CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x24D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x24D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x24D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x24D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x24D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x24D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x24D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x24D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x24D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x24D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x24DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x24DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x24DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x24DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x24DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x24DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x24E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x24E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x24E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x24E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x24E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x24E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x24E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x24E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x24E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x24E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x24EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x2A0C, 0, 4 | DECOMP_COMPAT, 2303}, + {0x2A74, 0, 3 | DECOMP_COMPAT, 2307}, + {0x2A75, 0, 2 | DECOMP_COMPAT, 2310}, + {0x2A76, 0, 3 | DECOMP_COMPAT, 2312}, + {0x2ADC, 0, 2 | DECOMP_NO_COMPOSE, 2315}, /* in exclusion list */ + {0x2C7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x2C7D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x2CEF, 230, 0, 0}, + {0x2CF0, 230, 0, 0}, + {0x2CF1, 230, 0, 0}, + {0x2D6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2D61}, + {0x2D7F, 9, 0, 0}, + {0x2DE0, 230, 0, 0}, + {0x2DE1, 230, 0, 0}, + {0x2DE2, 230, 0, 0}, + {0x2DE3, 230, 0, 0}, + {0x2DE4, 230, 0, 0}, + {0x2DE5, 230, 0, 0}, + {0x2DE6, 230, 0, 0}, + {0x2DE7, 230, 0, 0}, + {0x2DE8, 230, 0, 0}, + {0x2DE9, 230, 0, 0}, + {0x2DEA, 230, 0, 0}, + {0x2DEB, 230, 0, 0}, + {0x2DEC, 230, 0, 0}, + {0x2DED, 230, 0, 0}, + {0x2DEE, 230, 0, 0}, + {0x2DEF, 230, 0, 0}, + {0x2DF0, 230, 0, 0}, + {0x2DF1, 230, 0, 0}, + {0x2DF2, 230, 0, 0}, + {0x2DF3, 230, 0, 0}, + {0x2DF4, 230, 0, 0}, + {0x2DF5, 230, 0, 0}, + {0x2DF6, 230, 0, 0}, + {0x2DF7, 230, 0, 0}, + {0x2DF8, 230, 0, 0}, + {0x2DF9, 230, 0, 0}, + {0x2DFA, 230, 0, 0}, + {0x2DFB, 230, 0, 0}, + {0x2DFC, 230, 0, 0}, + {0x2DFD, 230, 0, 0}, + {0x2DFE, 230, 0, 0}, + {0x2DFF, 230, 0, 0}, + {0x2E9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BCD}, + {0x2EF3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F9F}, + {0x2F00, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E00}, + {0x2F01, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E28}, + {0x2F02, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E36}, + {0x2F03, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E3F}, + {0x2F04, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E59}, + {0x2F05, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E85}, + {0x2F06, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E8C}, + {0x2F07, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4EA0}, + {0x2F08, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4EBA}, + {0x2F09, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x513F}, + {0x2F0A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5165}, + {0x2F0B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x516B}, + {0x2F0C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5182}, + {0x2F0D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5196}, + {0x2F0E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x51AB}, + {0x2F0F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x51E0}, + {0x2F10, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x51F5}, + {0x2F11, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5200}, + {0x2F12, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x529B}, + {0x2F13, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x52F9}, + {0x2F14, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5315}, + {0x2F15, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x531A}, + {0x2F16, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5338}, + {0x2F17, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5341}, + {0x2F18, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x535C}, + {0x2F19, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5369}, + {0x2F1A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5382}, + {0x2F1B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53B6}, + {0x2F1C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53C8}, + {0x2F1D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53E3}, + {0x2F1E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x56D7}, + {0x2F1F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x571F}, + {0x2F20, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x58EB}, + {0x2F21, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5902}, + {0x2F22, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x590A}, + {0x2F23, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5915}, + {0x2F24, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5927}, + {0x2F25, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5973}, + {0x2F26, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B50}, + {0x2F27, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B80}, + {0x2F28, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5BF8}, + {0x2F29, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C0F}, + {0x2F2A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C22}, + {0x2F2B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C38}, + {0x2F2C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C6E}, + {0x2F2D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C71}, + {0x2F2E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DDB}, + {0x2F2F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DE5}, + {0x2F30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DF1}, + {0x2F31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DFE}, + {0x2F32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5E72}, + {0x2F33, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5E7A}, + {0x2F34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5E7F}, + {0x2F35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5EF4}, + {0x2F36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5EFE}, + {0x2F37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F0B}, + {0x2F38, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F13}, + {0x2F39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F50}, + {0x2F3A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F61}, + {0x2F3B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F73}, + {0x2F3C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5FC3}, + {0x2F3D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6208}, + {0x2F3E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6236}, + {0x2F3F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x624B}, + {0x2F40, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x652F}, + {0x2F41, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6534}, + {0x2F42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6587}, + {0x2F43, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6597}, + {0x2F44, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65A4}, + {0x2F45, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65B9}, + {0x2F46, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65E0}, + {0x2F47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65E5}, + {0x2F48, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x66F0}, + {0x2F49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6708}, + {0x2F4A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6728}, + {0x2F4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6B20}, + {0x2F4C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6B62}, + {0x2F4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6B79}, + {0x2F4E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BB3}, + {0x2F4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BCB}, + {0x2F50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BD4}, + {0x2F51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BDB}, + {0x2F52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6C0F}, + {0x2F53, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6C14}, + {0x2F54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6C34}, + {0x2F55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x706B}, + {0x2F56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x722A}, + {0x2F57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7236}, + {0x2F58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x723B}, + {0x2F59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x723F}, + {0x2F5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7247}, + {0x2F5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7259}, + {0x2F5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x725B}, + {0x2F5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x72AC}, + {0x2F5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7384}, + {0x2F5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7389}, + {0x2F60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x74DC}, + {0x2F61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x74E6}, + {0x2F62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7518}, + {0x2F63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x751F}, + {0x2F64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7528}, + {0x2F65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7530}, + {0x2F66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x758B}, + {0x2F67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7592}, + {0x2F68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7676}, + {0x2F69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x767D}, + {0x2F6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x76AE}, + {0x2F6B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x76BF}, + {0x2F6C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x76EE}, + {0x2F6D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x77DB}, + {0x2F6E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x77E2}, + {0x2F6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x77F3}, + {0x2F70, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x793A}, + {0x2F71, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x79B8}, + {0x2F72, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x79BE}, + {0x2F73, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7A74}, + {0x2F74, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7ACB}, + {0x2F75, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7AF9}, + {0x2F76, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7C73}, + {0x2F77, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7CF8}, + {0x2F78, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7F36}, + {0x2F79, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7F51}, + {0x2F7A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7F8A}, + {0x2F7B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7FBD}, + {0x2F7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8001}, + {0x2F7D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x800C}, + {0x2F7E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8012}, + {0x2F7F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8033}, + {0x2F80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x807F}, + {0x2F81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8089}, + {0x2F82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x81E3}, + {0x2F83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x81EA}, + {0x2F84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x81F3}, + {0x2F85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x81FC}, + {0x2F86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x820C}, + {0x2F87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x821B}, + {0x2F88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x821F}, + {0x2F89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x826E}, + {0x2F8A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8272}, + {0x2F8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8278}, + {0x2F8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x864D}, + {0x2F8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x866B}, + {0x2F8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8840}, + {0x2F8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x884C}, + {0x2F90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8863}, + {0x2F91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x897E}, + {0x2F92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x898B}, + {0x2F93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x89D2}, + {0x2F94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8A00}, + {0x2F95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C37}, + {0x2F96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C46}, + {0x2F97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C55}, + {0x2F98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C78}, + {0x2F99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C9D}, + {0x2F9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8D64}, + {0x2F9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8D70}, + {0x2F9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8DB3}, + {0x2F9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8EAB}, + {0x2F9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8ECA}, + {0x2F9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8F9B}, + {0x2FA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8FB0}, + {0x2FA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8FB5}, + {0x2FA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9091}, + {0x2FA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9149}, + {0x2FA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x91C6}, + {0x2FA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x91CC}, + {0x2FA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x91D1}, + {0x2FA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9577}, + {0x2FA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9580}, + {0x2FA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x961C}, + {0x2FAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x96B6}, + {0x2FAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x96B9}, + {0x2FAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x96E8}, + {0x2FAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9751}, + {0x2FAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x975E}, + {0x2FAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9762}, + {0x2FB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9769}, + {0x2FB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x97CB}, + {0x2FB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x97ED}, + {0x2FB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x97F3}, + {0x2FB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9801}, + {0x2FB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x98A8}, + {0x2FB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x98DB}, + {0x2FB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x98DF}, + {0x2FB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9996}, + {0x2FB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9999}, + {0x2FBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x99AC}, + {0x2FBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9AA8}, + {0x2FBC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9AD8}, + {0x2FBD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9ADF}, + {0x2FBE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B25}, + {0x2FBF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B2F}, + {0x2FC0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B32}, + {0x2FC1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B3C}, + {0x2FC2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B5A}, + {0x2FC3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9CE5}, + {0x2FC4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9E75}, + {0x2FC5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9E7F}, + {0x2FC6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EA5}, + {0x2FC7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EBB}, + {0x2FC8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EC3}, + {0x2FC9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9ECD}, + {0x2FCA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9ED1}, + {0x2FCB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EF9}, + {0x2FCC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EFD}, + {0x2FCD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F0E}, + {0x2FCE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F13}, + {0x2FCF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F20}, + {0x2FD0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F3B}, + {0x2FD1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F4A}, + {0x2FD2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F52}, + {0x2FD3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F8D}, + {0x2FD4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F9C}, + {0x2FD5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9FA0}, + {0x3000, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x302A, 218, 0, 0}, + {0x302B, 228, 0, 0}, + {0x302C, 232, 0, 0}, + {0x302D, 222, 0, 0}, + {0x302E, 224, 0, 0}, + {0x302F, 224, 0, 0}, + {0x3036, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3012}, + {0x3038, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5341}, + {0x3039, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5344}, + {0x303A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5345}, + {0x304C, 0, 2, 2317}, + {0x304E, 0, 2, 2319}, + {0x3050, 0, 2, 2321}, + {0x3052, 0, 2, 2323}, + {0x3054, 0, 2, 2325}, + {0x3056, 0, 2, 2327}, + {0x3058, 0, 2, 2329}, + {0x305A, 0, 2, 2331}, + {0x305C, 0, 2, 2333}, + {0x305E, 0, 2, 2335}, + {0x3060, 0, 2, 2337}, + {0x3062, 0, 2, 2339}, + {0x3065, 0, 2, 2341}, + {0x3067, 0, 2, 2343}, + {0x3069, 0, 2, 2345}, + {0x3070, 0, 2, 2347}, + {0x3071, 0, 2, 2349}, + {0x3073, 0, 2, 2351}, + {0x3074, 0, 2, 2353}, + {0x3076, 0, 2, 2355}, + {0x3077, 0, 2, 2357}, + {0x3079, 0, 2, 2359}, + {0x307A, 0, 2, 2361}, + {0x307C, 0, 2, 2363}, + {0x307D, 0, 2, 2365}, + {0x3094, 0, 2, 2367}, + {0x3099, 8, 0, 0}, + {0x309A, 8, 0, 0}, + {0x309B, 0, 2 | DECOMP_COMPAT, 2369}, + {0x309C, 0, 2 | DECOMP_COMPAT, 2371}, + {0x309E, 0, 2, 2373}, + {0x309F, 0, 2 | DECOMP_COMPAT, 2375}, + {0x30AC, 0, 2, 2377}, + {0x30AE, 0, 2, 2379}, + {0x30B0, 0, 2, 2381}, + {0x30B2, 0, 2, 2383}, + {0x30B4, 0, 2, 2385}, + {0x30B6, 0, 2, 2387}, + {0x30B8, 0, 2, 2389}, + {0x30BA, 0, 2, 2391}, + {0x30BC, 0, 2, 2393}, + {0x30BE, 0, 2, 2395}, + {0x30C0, 0, 2, 2397}, + {0x30C2, 0, 2, 2399}, + {0x30C5, 0, 2, 2401}, + {0x30C7, 0, 2, 2403}, + {0x30C9, 0, 2, 2405}, + {0x30D0, 0, 2, 2407}, + {0x30D1, 0, 2, 2409}, + {0x30D3, 0, 2, 2411}, + {0x30D4, 0, 2, 2413}, + {0x30D6, 0, 2, 2415}, + {0x30D7, 0, 2, 2417}, + {0x30D9, 0, 2, 2419}, + {0x30DA, 0, 2, 2421}, + {0x30DC, 0, 2, 2423}, + {0x30DD, 0, 2, 2425}, + {0x30F4, 0, 2, 2427}, + {0x30F7, 0, 2, 2429}, + {0x30F8, 0, 2, 2431}, + {0x30F9, 0, 2, 2433}, + {0x30FA, 0, 2, 2435}, + {0x30FE, 0, 2, 2437}, + {0x30FF, 0, 2 | DECOMP_COMPAT, 2439}, + {0x3131, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1100}, + {0x3132, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1101}, + {0x3133, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11AA}, + {0x3134, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1102}, + {0x3135, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11AC}, + {0x3136, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11AD}, + {0x3137, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1103}, + {0x3138, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1104}, + {0x3139, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1105}, + {0x313A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B0}, + {0x313B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B1}, + {0x313C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B2}, + {0x313D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B3}, + {0x313E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B4}, + {0x313F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B5}, + {0x3140, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x111A}, + {0x3141, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1106}, + {0x3142, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1107}, + {0x3143, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1108}, + {0x3144, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1121}, + {0x3145, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1109}, + {0x3146, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110A}, + {0x3147, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110B}, + {0x3148, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110C}, + {0x3149, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110D}, + {0x314A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110E}, + {0x314B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110F}, + {0x314C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1110}, + {0x314D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1111}, + {0x314E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1112}, + {0x314F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1161}, + {0x3150, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1162}, + {0x3151, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1163}, + {0x3152, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1164}, + {0x3153, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1165}, + {0x3154, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1166}, + {0x3155, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1167}, + {0x3156, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1168}, + {0x3157, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1169}, + {0x3158, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116A}, + {0x3159, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116B}, + {0x315A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116C}, + {0x315B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116D}, + {0x315C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116E}, + {0x315D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116F}, + {0x315E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1170}, + {0x315F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1171}, + {0x3160, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1172}, + {0x3161, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1173}, + {0x3162, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1174}, + {0x3163, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1175}, + {0x3164, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1160}, + {0x3165, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1114}, + {0x3166, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1115}, + {0x3167, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11C7}, + {0x3168, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11C8}, + {0x3169, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11CC}, + {0x316A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11CE}, + {0x316B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11D3}, + {0x316C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11D7}, + {0x316D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11D9}, + {0x316E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x111C}, + {0x316F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11DD}, + {0x3170, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11DF}, + {0x3171, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x111D}, + {0x3172, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x111E}, + {0x3173, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1120}, + {0x3174, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1122}, + {0x3175, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1123}, + {0x3176, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1127}, + {0x3177, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1129}, + {0x3178, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112B}, + {0x3179, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112C}, + {0x317A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112D}, + {0x317B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112E}, + {0x317C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112F}, + {0x317D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1132}, + {0x317E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1136}, + {0x317F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1140}, + {0x3180, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1147}, + {0x3181, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x114C}, + {0x3182, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11F1}, + {0x3183, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11F2}, + {0x3184, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1157}, + {0x3185, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1158}, + {0x3186, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1159}, + {0x3187, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1184}, + {0x3188, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1185}, + {0x3189, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1188}, + {0x318A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1191}, + {0x318B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1192}, + {0x318C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1194}, + {0x318D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x119E}, + {0x318E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11A1}, + {0x3192, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E00}, + {0x3193, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E8C}, + {0x3194, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E09}, + {0x3195, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x56DB}, + {0x3196, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E0A}, + {0x3197, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E2D}, + {0x3198, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E0B}, + {0x3199, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7532}, + {0x319A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E59}, + {0x319B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E19}, + {0x319C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E01}, + {0x319D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5929}, + {0x319E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5730}, + {0x319F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4EBA}, + {0x3200, 0, 3 | DECOMP_COMPAT, 2441}, + {0x3201, 0, 3 | DECOMP_COMPAT, 2444}, + {0x3202, 0, 3 | DECOMP_COMPAT, 2447}, + {0x3203, 0, 3 | DECOMP_COMPAT, 2450}, + {0x3204, 0, 3 | DECOMP_COMPAT, 2453}, + {0x3205, 0, 3 | DECOMP_COMPAT, 2456}, + {0x3206, 0, 3 | DECOMP_COMPAT, 2459}, + {0x3207, 0, 3 | DECOMP_COMPAT, 2462}, + {0x3208, 0, 3 | DECOMP_COMPAT, 2465}, + {0x3209, 0, 3 | DECOMP_COMPAT, 2468}, + {0x320A, 0, 3 | DECOMP_COMPAT, 2471}, + {0x320B, 0, 3 | DECOMP_COMPAT, 2474}, + {0x320C, 0, 3 | DECOMP_COMPAT, 2477}, + {0x320D, 0, 3 | DECOMP_COMPAT, 2480}, + {0x320E, 0, 4 | DECOMP_COMPAT, 2483}, + {0x320F, 0, 4 | DECOMP_COMPAT, 2487}, + {0x3210, 0, 4 | DECOMP_COMPAT, 2491}, + {0x3211, 0, 4 | DECOMP_COMPAT, 2495}, + {0x3212, 0, 4 | DECOMP_COMPAT, 2499}, + {0x3213, 0, 4 | DECOMP_COMPAT, 2503}, + {0x3214, 0, 4 | DECOMP_COMPAT, 2507}, + {0x3215, 0, 4 | DECOMP_COMPAT, 2511}, + {0x3216, 0, 4 | DECOMP_COMPAT, 2515}, + {0x3217, 0, 4 | DECOMP_COMPAT, 2519}, + {0x3218, 0, 4 | DECOMP_COMPAT, 2523}, + {0x3219, 0, 4 | DECOMP_COMPAT, 2527}, + {0x321A, 0, 4 | DECOMP_COMPAT, 2531}, + {0x321B, 0, 4 | DECOMP_COMPAT, 2535}, + {0x321C, 0, 4 | DECOMP_COMPAT, 2539}, + {0x321D, 0, 7 | DECOMP_COMPAT, 2543}, + {0x321E, 0, 6 | DECOMP_COMPAT, 2550}, + {0x3220, 0, 3 | DECOMP_COMPAT, 2556}, + {0x3221, 0, 3 | DECOMP_COMPAT, 2559}, + {0x3222, 0, 3 | DECOMP_COMPAT, 2562}, + {0x3223, 0, 3 | DECOMP_COMPAT, 2565}, + {0x3224, 0, 3 | DECOMP_COMPAT, 2568}, + {0x3225, 0, 3 | DECOMP_COMPAT, 2571}, + {0x3226, 0, 3 | DECOMP_COMPAT, 2574}, + {0x3227, 0, 3 | DECOMP_COMPAT, 2577}, + {0x3228, 0, 3 | DECOMP_COMPAT, 2580}, + {0x3229, 0, 3 | DECOMP_COMPAT, 2583}, + {0x322A, 0, 3 | DECOMP_COMPAT, 2586}, + {0x322B, 0, 3 | DECOMP_COMPAT, 2589}, + {0x322C, 0, 3 | DECOMP_COMPAT, 2592}, + {0x322D, 0, 3 | DECOMP_COMPAT, 2595}, + {0x322E, 0, 3 | DECOMP_COMPAT, 2598}, + {0x322F, 0, 3 | DECOMP_COMPAT, 2601}, + {0x3230, 0, 3 | DECOMP_COMPAT, 2604}, + {0x3231, 0, 3 | DECOMP_COMPAT, 2607}, + {0x3232, 0, 3 | DECOMP_COMPAT, 2610}, + {0x3233, 0, 3 | DECOMP_COMPAT, 2613}, + {0x3234, 0, 3 | DECOMP_COMPAT, 2616}, + {0x3235, 0, 3 | DECOMP_COMPAT, 2619}, + {0x3236, 0, 3 | DECOMP_COMPAT, 2622}, + {0x3237, 0, 3 | DECOMP_COMPAT, 2625}, + {0x3238, 0, 3 | DECOMP_COMPAT, 2628}, + {0x3239, 0, 3 | DECOMP_COMPAT, 2631}, + {0x323A, 0, 3 | DECOMP_COMPAT, 2634}, + {0x323B, 0, 3 | DECOMP_COMPAT, 2637}, + {0x323C, 0, 3 | DECOMP_COMPAT, 2640}, + {0x323D, 0, 3 | DECOMP_COMPAT, 2643}, + {0x323E, 0, 3 | DECOMP_COMPAT, 2646}, + {0x323F, 0, 3 | DECOMP_COMPAT, 2649}, + {0x3240, 0, 3 | DECOMP_COMPAT, 2652}, + {0x3241, 0, 3 | DECOMP_COMPAT, 2655}, + {0x3242, 0, 3 | DECOMP_COMPAT, 2658}, + {0x3243, 0, 3 | DECOMP_COMPAT, 2661}, + {0x3244, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x554F}, + {0x3245, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5E7C}, + {0x3246, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6587}, + {0x3247, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7B8F}, + {0x3250, 0, 3 | DECOMP_COMPAT, 2664}, + {0x3251, 0, 2 | DECOMP_COMPAT, 2667}, + {0x3252, 0, 2 | DECOMP_COMPAT, 2669}, + {0x3253, 0, 2 | DECOMP_COMPAT, 2671}, + {0x3254, 0, 2 | DECOMP_COMPAT, 2673}, + {0x3255, 0, 2 | DECOMP_COMPAT, 2675}, + {0x3256, 0, 2 | DECOMP_COMPAT, 2677}, + {0x3257, 0, 2 | DECOMP_COMPAT, 2679}, + {0x3258, 0, 2 | DECOMP_COMPAT, 2681}, + {0x3259, 0, 2 | DECOMP_COMPAT, 2683}, + {0x325A, 0, 2 | DECOMP_COMPAT, 2685}, + {0x325B, 0, 2 | DECOMP_COMPAT, 2687}, + {0x325C, 0, 2 | DECOMP_COMPAT, 2689}, + {0x325D, 0, 2 | DECOMP_COMPAT, 2691}, + {0x325E, 0, 2 | DECOMP_COMPAT, 2693}, + {0x325F, 0, 2 | DECOMP_COMPAT, 2695}, + {0x3260, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1100}, + {0x3261, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1102}, + {0x3262, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1103}, + {0x3263, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1105}, + {0x3264, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1106}, + {0x3265, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1107}, + {0x3266, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1109}, + {0x3267, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110B}, + {0x3268, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110C}, + {0x3269, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110E}, + {0x326A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110F}, + {0x326B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1110}, + {0x326C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1111}, + {0x326D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1112}, + {0x326E, 0, 2 | DECOMP_COMPAT, 2697}, + {0x326F, 0, 2 | DECOMP_COMPAT, 2699}, + {0x3270, 0, 2 | DECOMP_COMPAT, 2701}, + {0x3271, 0, 2 | DECOMP_COMPAT, 2703}, + {0x3272, 0, 2 | DECOMP_COMPAT, 2705}, + {0x3273, 0, 2 | DECOMP_COMPAT, 2707}, + {0x3274, 0, 2 | DECOMP_COMPAT, 2709}, + {0x3275, 0, 2 | DECOMP_COMPAT, 2711}, + {0x3276, 0, 2 | DECOMP_COMPAT, 2713}, + {0x3277, 0, 2 | DECOMP_COMPAT, 2715}, + {0x3278, 0, 2 | DECOMP_COMPAT, 2717}, + {0x3279, 0, 2 | DECOMP_COMPAT, 2719}, + {0x327A, 0, 2 | DECOMP_COMPAT, 2721}, + {0x327B, 0, 2 | DECOMP_COMPAT, 2723}, + {0x327C, 0, 5 | DECOMP_COMPAT, 2725}, + {0x327D, 0, 4 | DECOMP_COMPAT, 2730}, + {0x327E, 0, 2 | DECOMP_COMPAT, 2734}, + {0x3280, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E00}, + {0x3281, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E8C}, + {0x3282, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E09}, + {0x3283, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x56DB}, + {0x3284, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E94}, + {0x3285, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x516D}, + {0x3286, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E03}, + {0x3287, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x516B}, + {0x3288, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E5D}, + {0x3289, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5341}, + {0x328A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6708}, + {0x328B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x706B}, + {0x328C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6C34}, + {0x328D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6728}, + {0x328E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x91D1}, + {0x328F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x571F}, + {0x3290, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65E5}, + {0x3291, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x682A}, + {0x3292, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6709}, + {0x3293, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x793E}, + {0x3294, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x540D}, + {0x3295, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7279}, + {0x3296, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8CA1}, + {0x3297, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x795D}, + {0x3298, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x52B4}, + {0x3299, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x79D8}, + {0x329A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7537}, + {0x329B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5973}, + {0x329C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9069}, + {0x329D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x512A}, + {0x329E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5370}, + {0x329F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6CE8}, + {0x32A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9805}, + {0x32A1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4F11}, + {0x32A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5199}, + {0x32A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6B63}, + {0x32A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E0A}, + {0x32A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E2D}, + {0x32A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E0B}, + {0x32A7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DE6}, + {0x32A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53F3}, + {0x32A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x533B}, + {0x32AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B97}, + {0x32AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B66}, + {0x32AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x76E3}, + {0x32AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4F01}, + {0x32AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8CC7}, + {0x32AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5354}, + {0x32B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x591C}, + {0x32B1, 0, 2 | DECOMP_COMPAT, 2736}, + {0x32B2, 0, 2 | DECOMP_COMPAT, 2738}, + {0x32B3, 0, 2 | DECOMP_COMPAT, 2740}, + {0x32B4, 0, 2 | DECOMP_COMPAT, 2742}, + {0x32B5, 0, 2 | DECOMP_COMPAT, 2744}, + {0x32B6, 0, 2 | DECOMP_COMPAT, 2746}, + {0x32B7, 0, 2 | DECOMP_COMPAT, 2748}, + {0x32B8, 0, 2 | DECOMP_COMPAT, 2750}, + {0x32B9, 0, 2 | DECOMP_COMPAT, 2752}, + {0x32BA, 0, 2 | DECOMP_COMPAT, 2754}, + {0x32BB, 0, 2 | DECOMP_COMPAT, 2756}, + {0x32BC, 0, 2 | DECOMP_COMPAT, 2758}, + {0x32BD, 0, 2 | DECOMP_COMPAT, 2760}, + {0x32BE, 0, 2 | DECOMP_COMPAT, 2762}, + {0x32BF, 0, 2 | DECOMP_COMPAT, 2764}, + {0x32C0, 0, 2 | DECOMP_COMPAT, 2766}, + {0x32C1, 0, 2 | DECOMP_COMPAT, 2768}, + {0x32C2, 0, 2 | DECOMP_COMPAT, 2770}, + {0x32C3, 0, 2 | DECOMP_COMPAT, 2772}, + {0x32C4, 0, 2 | DECOMP_COMPAT, 2774}, + {0x32C5, 0, 2 | DECOMP_COMPAT, 2776}, + {0x32C6, 0, 2 | DECOMP_COMPAT, 2778}, + {0x32C7, 0, 2 | DECOMP_COMPAT, 2780}, + {0x32C8, 0, 2 | DECOMP_COMPAT, 2782}, + {0x32C9, 0, 3 | DECOMP_COMPAT, 2784}, + {0x32CA, 0, 3 | DECOMP_COMPAT, 2787}, + {0x32CB, 0, 3 | DECOMP_COMPAT, 2790}, + {0x32CC, 0, 2 | DECOMP_COMPAT, 2793}, + {0x32CD, 0, 3 | DECOMP_COMPAT, 2795}, + {0x32CE, 0, 2 | DECOMP_COMPAT, 2798}, + {0x32CF, 0, 3 | DECOMP_COMPAT, 2800}, + {0x32D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A2}, + {0x32D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A4}, + {0x32D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A6}, + {0x32D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A8}, + {0x32D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AA}, + {0x32D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AB}, + {0x32D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AD}, + {0x32D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AF}, + {0x32D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B1}, + {0x32D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B3}, + {0x32DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B5}, + {0x32DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B7}, + {0x32DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B9}, + {0x32DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BB}, + {0x32DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BD}, + {0x32DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BF}, + {0x32E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C1}, + {0x32E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C4}, + {0x32E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C6}, + {0x32E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C8}, + {0x32E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CA}, + {0x32E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CB}, + {0x32E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CC}, + {0x32E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CD}, + {0x32E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CE}, + {0x32E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CF}, + {0x32EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D2}, + {0x32EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D5}, + {0x32EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D8}, + {0x32ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DB}, + {0x32EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DE}, + {0x32EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DF}, + {0x32F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E0}, + {0x32F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E1}, + {0x32F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E2}, + {0x32F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E4}, + {0x32F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E6}, + {0x32F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E8}, + {0x32F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E9}, + {0x32F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EA}, + {0x32F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EB}, + {0x32F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EC}, + {0x32FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30ED}, + {0x32FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EF}, + {0x32FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F0}, + {0x32FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F1}, + {0x32FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F2}, + {0x32FF, 0, 2 | DECOMP_COMPAT, 2803}, + {0x3300, 0, 4 | DECOMP_COMPAT, 2805}, + {0x3301, 0, 4 | DECOMP_COMPAT, 2809}, + {0x3302, 0, 4 | DECOMP_COMPAT, 2813}, + {0x3303, 0, 3 | DECOMP_COMPAT, 2817}, + {0x3304, 0, 4 | DECOMP_COMPAT, 2820}, + {0x3305, 0, 3 | DECOMP_COMPAT, 2824}, + {0x3306, 0, 3 | DECOMP_COMPAT, 2827}, + {0x3307, 0, 5 | DECOMP_COMPAT, 2830}, + {0x3308, 0, 4 | DECOMP_COMPAT, 2835}, + {0x3309, 0, 3 | DECOMP_COMPAT, 2839}, + {0x330A, 0, 3 | DECOMP_COMPAT, 2842}, + {0x330B, 0, 3 | DECOMP_COMPAT, 2845}, + {0x330C, 0, 4 | DECOMP_COMPAT, 2848}, + {0x330D, 0, 4 | DECOMP_COMPAT, 2852}, + {0x330E, 0, 3 | DECOMP_COMPAT, 2856}, + {0x330F, 0, 3 | DECOMP_COMPAT, 2859}, + {0x3310, 0, 2 | DECOMP_COMPAT, 2862}, + {0x3311, 0, 3 | DECOMP_COMPAT, 2864}, + {0x3312, 0, 4 | DECOMP_COMPAT, 2867}, + {0x3313, 0, 4 | DECOMP_COMPAT, 2871}, + {0x3314, 0, 2 | DECOMP_COMPAT, 2875}, + {0x3315, 0, 5 | DECOMP_COMPAT, 2877}, + {0x3316, 0, 6 | DECOMP_COMPAT, 2882}, + {0x3317, 0, 5 | DECOMP_COMPAT, 2888}, + {0x3318, 0, 3 | DECOMP_COMPAT, 2893}, + {0x3319, 0, 5 | DECOMP_COMPAT, 2896}, + {0x331A, 0, 5 | DECOMP_COMPAT, 2901}, + {0x331B, 0, 4 | DECOMP_COMPAT, 2906}, + {0x331C, 0, 3 | DECOMP_COMPAT, 2910}, + {0x331D, 0, 3 | DECOMP_COMPAT, 2913}, + {0x331E, 0, 3 | DECOMP_COMPAT, 2916}, + {0x331F, 0, 4 | DECOMP_COMPAT, 2919}, + {0x3320, 0, 5 | DECOMP_COMPAT, 2923}, + {0x3321, 0, 4 | DECOMP_COMPAT, 2928}, + {0x3322, 0, 3 | DECOMP_COMPAT, 2932}, + {0x3323, 0, 3 | DECOMP_COMPAT, 2935}, + {0x3324, 0, 3 | DECOMP_COMPAT, 2938}, + {0x3325, 0, 2 | DECOMP_COMPAT, 2941}, + {0x3326, 0, 2 | DECOMP_COMPAT, 2943}, + {0x3327, 0, 2 | DECOMP_COMPAT, 2945}, + {0x3328, 0, 2 | DECOMP_COMPAT, 2947}, + {0x3329, 0, 3 | DECOMP_COMPAT, 2949}, + {0x332A, 0, 3 | DECOMP_COMPAT, 2952}, + {0x332B, 0, 5 | DECOMP_COMPAT, 2955}, + {0x332C, 0, 3 | DECOMP_COMPAT, 2960}, + {0x332D, 0, 4 | DECOMP_COMPAT, 2963}, + {0x332E, 0, 5 | DECOMP_COMPAT, 2967}, + {0x332F, 0, 3 | DECOMP_COMPAT, 2972}, + {0x3330, 0, 2 | DECOMP_COMPAT, 2975}, + {0x3331, 0, 2 | DECOMP_COMPAT, 2977}, + {0x3332, 0, 5 | DECOMP_COMPAT, 2979}, + {0x3333, 0, 4 | DECOMP_COMPAT, 2984}, + {0x3334, 0, 5 | DECOMP_COMPAT, 2988}, + {0x3335, 0, 3 | DECOMP_COMPAT, 2993}, + {0x3336, 0, 5 | DECOMP_COMPAT, 2996}, + {0x3337, 0, 2 | DECOMP_COMPAT, 3001}, + {0x3338, 0, 3 | DECOMP_COMPAT, 3003}, + {0x3339, 0, 3 | DECOMP_COMPAT, 3006}, + {0x333A, 0, 3 | DECOMP_COMPAT, 3009}, + {0x333B, 0, 3 | DECOMP_COMPAT, 3012}, + {0x333C, 0, 3 | DECOMP_COMPAT, 3015}, + {0x333D, 0, 4 | DECOMP_COMPAT, 3018}, + {0x333E, 0, 3 | DECOMP_COMPAT, 3022}, + {0x333F, 0, 2 | DECOMP_COMPAT, 3025}, + {0x3340, 0, 3 | DECOMP_COMPAT, 3027}, + {0x3341, 0, 3 | DECOMP_COMPAT, 3030}, + {0x3342, 0, 3 | DECOMP_COMPAT, 3033}, + {0x3343, 0, 4 | DECOMP_COMPAT, 3036}, + {0x3344, 0, 3 | DECOMP_COMPAT, 3040}, + {0x3345, 0, 3 | DECOMP_COMPAT, 3043}, + {0x3346, 0, 3 | DECOMP_COMPAT, 3046}, + {0x3347, 0, 5 | DECOMP_COMPAT, 3049}, + {0x3348, 0, 4 | DECOMP_COMPAT, 3054}, + {0x3349, 0, 2 | DECOMP_COMPAT, 3058}, + {0x334A, 0, 5 | DECOMP_COMPAT, 3060}, + {0x334B, 0, 2 | DECOMP_COMPAT, 3065}, + {0x334C, 0, 4 | DECOMP_COMPAT, 3067}, + {0x334D, 0, 4 | DECOMP_COMPAT, 3071}, + {0x334E, 0, 3 | DECOMP_COMPAT, 3075}, + {0x334F, 0, 3 | DECOMP_COMPAT, 3078}, + {0x3350, 0, 3 | DECOMP_COMPAT, 3081}, + {0x3351, 0, 4 | DECOMP_COMPAT, 3084}, + {0x3352, 0, 2 | DECOMP_COMPAT, 3088}, + {0x3353, 0, 3 | DECOMP_COMPAT, 3090}, + {0x3354, 0, 4 | DECOMP_COMPAT, 3093}, + {0x3355, 0, 2 | DECOMP_COMPAT, 3097}, + {0x3356, 0, 5 | DECOMP_COMPAT, 3099}, + {0x3357, 0, 3 | DECOMP_COMPAT, 3104}, + {0x3358, 0, 2 | DECOMP_COMPAT, 3107}, + {0x3359, 0, 2 | DECOMP_COMPAT, 3109}, + {0x335A, 0, 2 | DECOMP_COMPAT, 3111}, + {0x335B, 0, 2 | DECOMP_COMPAT, 3113}, + {0x335C, 0, 2 | DECOMP_COMPAT, 3115}, + {0x335D, 0, 2 | DECOMP_COMPAT, 3117}, + {0x335E, 0, 2 | DECOMP_COMPAT, 3119}, + {0x335F, 0, 2 | DECOMP_COMPAT, 3121}, + {0x3360, 0, 2 | DECOMP_COMPAT, 3123}, + {0x3361, 0, 2 | DECOMP_COMPAT, 3125}, + {0x3362, 0, 3 | DECOMP_COMPAT, 3127}, + {0x3363, 0, 3 | DECOMP_COMPAT, 3130}, + {0x3364, 0, 3 | DECOMP_COMPAT, 3133}, + {0x3365, 0, 3 | DECOMP_COMPAT, 3136}, + {0x3366, 0, 3 | DECOMP_COMPAT, 3139}, + {0x3367, 0, 3 | DECOMP_COMPAT, 3142}, + {0x3368, 0, 3 | DECOMP_COMPAT, 3145}, + {0x3369, 0, 3 | DECOMP_COMPAT, 3148}, + {0x336A, 0, 3 | DECOMP_COMPAT, 3151}, + {0x336B, 0, 3 | DECOMP_COMPAT, 3154}, + {0x336C, 0, 3 | DECOMP_COMPAT, 3157}, + {0x336D, 0, 3 | DECOMP_COMPAT, 3160}, + {0x336E, 0, 3 | DECOMP_COMPAT, 3163}, + {0x336F, 0, 3 | DECOMP_COMPAT, 3166}, + {0x3370, 0, 3 | DECOMP_COMPAT, 3169}, + {0x3371, 0, 3 | DECOMP_COMPAT, 3172}, + {0x3372, 0, 2 | DECOMP_COMPAT, 3175}, + {0x3373, 0, 2 | DECOMP_COMPAT, 3177}, + {0x3374, 0, 3 | DECOMP_COMPAT, 3179}, + {0x3375, 0, 2 | DECOMP_COMPAT, 3182}, + {0x3376, 0, 2 | DECOMP_COMPAT, 3184}, + {0x3377, 0, 2 | DECOMP_COMPAT, 3186}, + {0x3378, 0, 3 | DECOMP_COMPAT, 3188}, + {0x3379, 0, 3 | DECOMP_COMPAT, 3191}, + {0x337A, 0, 2 | DECOMP_COMPAT, 3194}, + {0x337B, 0, 2 | DECOMP_COMPAT, 3196}, + {0x337C, 0, 2 | DECOMP_COMPAT, 3198}, + {0x337D, 0, 2 | DECOMP_COMPAT, 3200}, + {0x337E, 0, 2 | DECOMP_COMPAT, 3202}, + {0x337F, 0, 4 | DECOMP_COMPAT, 3204}, + {0x3380, 0, 2 | DECOMP_COMPAT, 3208}, + {0x3381, 0, 2 | DECOMP_COMPAT, 3210}, + {0x3382, 0, 2 | DECOMP_COMPAT, 3212}, + {0x3383, 0, 2 | DECOMP_COMPAT, 3214}, + {0x3384, 0, 2 | DECOMP_COMPAT, 3216}, + {0x3385, 0, 2 | DECOMP_COMPAT, 3218}, + {0x3386, 0, 2 | DECOMP_COMPAT, 3220}, + {0x3387, 0, 2 | DECOMP_COMPAT, 3222}, + {0x3388, 0, 3 | DECOMP_COMPAT, 3224}, + {0x3389, 0, 4 | DECOMP_COMPAT, 3227}, + {0x338A, 0, 2 | DECOMP_COMPAT, 3231}, + {0x338B, 0, 2 | DECOMP_COMPAT, 3233}, + {0x338C, 0, 2 | DECOMP_COMPAT, 3235}, + {0x338D, 0, 2 | DECOMP_COMPAT, 3237}, + {0x338E, 0, 2 | DECOMP_COMPAT, 3239}, + {0x338F, 0, 2 | DECOMP_COMPAT, 3241}, + {0x3390, 0, 2 | DECOMP_COMPAT, 3243}, + {0x3391, 0, 3 | DECOMP_COMPAT, 3245}, + {0x3392, 0, 3 | DECOMP_COMPAT, 3248}, + {0x3393, 0, 3 | DECOMP_COMPAT, 3251}, + {0x3394, 0, 3 | DECOMP_COMPAT, 3254}, + {0x3395, 0, 2 | DECOMP_COMPAT, 3257}, + {0x3396, 0, 2 | DECOMP_COMPAT, 3259}, + {0x3397, 0, 2 | DECOMP_COMPAT, 3261}, + {0x3398, 0, 2 | DECOMP_COMPAT, 3263}, + {0x3399, 0, 2 | DECOMP_COMPAT, 3265}, + {0x339A, 0, 2 | DECOMP_COMPAT, 3267}, + {0x339B, 0, 2 | DECOMP_COMPAT, 3269}, + {0x339C, 0, 2 | DECOMP_COMPAT, 3271}, + {0x339D, 0, 2 | DECOMP_COMPAT, 3273}, + {0x339E, 0, 2 | DECOMP_COMPAT, 3275}, + {0x339F, 0, 3 | DECOMP_COMPAT, 3277}, + {0x33A0, 0, 3 | DECOMP_COMPAT, 3280}, + {0x33A1, 0, 2 | DECOMP_COMPAT, 3283}, + {0x33A2, 0, 3 | DECOMP_COMPAT, 3285}, + {0x33A3, 0, 3 | DECOMP_COMPAT, 3288}, + {0x33A4, 0, 3 | DECOMP_COMPAT, 3291}, + {0x33A5, 0, 2 | DECOMP_COMPAT, 3294}, + {0x33A6, 0, 3 | DECOMP_COMPAT, 3296}, + {0x33A7, 0, 3 | DECOMP_COMPAT, 3299}, + {0x33A8, 0, 4 | DECOMP_COMPAT, 3302}, + {0x33A9, 0, 2 | DECOMP_COMPAT, 3306}, + {0x33AA, 0, 3 | DECOMP_COMPAT, 3308}, + {0x33AB, 0, 3 | DECOMP_COMPAT, 3311}, + {0x33AC, 0, 3 | DECOMP_COMPAT, 3314}, + {0x33AD, 0, 3 | DECOMP_COMPAT, 3317}, + {0x33AE, 0, 5 | DECOMP_COMPAT, 3320}, + {0x33AF, 0, 6 | DECOMP_COMPAT, 3325}, + {0x33B0, 0, 2 | DECOMP_COMPAT, 3331}, + {0x33B1, 0, 2 | DECOMP_COMPAT, 3333}, + {0x33B2, 0, 2 | DECOMP_COMPAT, 3335}, + {0x33B3, 0, 2 | DECOMP_COMPAT, 3337}, + {0x33B4, 0, 2 | DECOMP_COMPAT, 3339}, + {0x33B5, 0, 2 | DECOMP_COMPAT, 3341}, + {0x33B6, 0, 2 | DECOMP_COMPAT, 3343}, + {0x33B7, 0, 2 | DECOMP_COMPAT, 3345}, + {0x33B8, 0, 2 | DECOMP_COMPAT, 3347}, + {0x33B9, 0, 2 | DECOMP_COMPAT, 3349}, + {0x33BA, 0, 2 | DECOMP_COMPAT, 3351}, + {0x33BB, 0, 2 | DECOMP_COMPAT, 3353}, + {0x33BC, 0, 2 | DECOMP_COMPAT, 3355}, + {0x33BD, 0, 2 | DECOMP_COMPAT, 3357}, + {0x33BE, 0, 2 | DECOMP_COMPAT, 3359}, + {0x33BF, 0, 2 | DECOMP_COMPAT, 3361}, + {0x33C0, 0, 2 | DECOMP_COMPAT, 3363}, + {0x33C1, 0, 2 | DECOMP_COMPAT, 3365}, + {0x33C2, 0, 4 | DECOMP_COMPAT, 3367}, + {0x33C3, 0, 2 | DECOMP_COMPAT, 3371}, + {0x33C4, 0, 2 | DECOMP_COMPAT, 3373}, + {0x33C5, 0, 2 | DECOMP_COMPAT, 3375}, + {0x33C6, 0, 4 | DECOMP_COMPAT, 3377}, + {0x33C7, 0, 3 | DECOMP_COMPAT, 3381}, + {0x33C8, 0, 2 | DECOMP_COMPAT, 3384}, + {0x33C9, 0, 2 | DECOMP_COMPAT, 3386}, + {0x33CA, 0, 2 | DECOMP_COMPAT, 3388}, + {0x33CB, 0, 2 | DECOMP_COMPAT, 3390}, + {0x33CC, 0, 2 | DECOMP_COMPAT, 3392}, + {0x33CD, 0, 2 | DECOMP_COMPAT, 3394}, + {0x33CE, 0, 2 | DECOMP_COMPAT, 3396}, + {0x33CF, 0, 2 | DECOMP_COMPAT, 3398}, + {0x33D0, 0, 2 | DECOMP_COMPAT, 3400}, + {0x33D1, 0, 2 | DECOMP_COMPAT, 3402}, + {0x33D2, 0, 3 | DECOMP_COMPAT, 3404}, + {0x33D3, 0, 2 | DECOMP_COMPAT, 3407}, + {0x33D4, 0, 2 | DECOMP_COMPAT, 3409}, + {0x33D5, 0, 3 | DECOMP_COMPAT, 3411}, + {0x33D6, 0, 3 | DECOMP_COMPAT, 3414}, + {0x33D7, 0, 2 | DECOMP_COMPAT, 3417}, + {0x33D8, 0, 4 | DECOMP_COMPAT, 3419}, + {0x33D9, 0, 3 | DECOMP_COMPAT, 3423}, + {0x33DA, 0, 2 | DECOMP_COMPAT, 3426}, + {0x33DB, 0, 2 | DECOMP_COMPAT, 3428}, + {0x33DC, 0, 2 | DECOMP_COMPAT, 3430}, + {0x33DD, 0, 2 | DECOMP_COMPAT, 3432}, + {0x33DE, 0, 3 | DECOMP_COMPAT, 3434}, + {0x33DF, 0, 3 | DECOMP_COMPAT, 3437}, + {0x33E0, 0, 2 | DECOMP_COMPAT, 3440}, + {0x33E1, 0, 2 | DECOMP_COMPAT, 3442}, + {0x33E2, 0, 2 | DECOMP_COMPAT, 3444}, + {0x33E3, 0, 2 | DECOMP_COMPAT, 3446}, + {0x33E4, 0, 2 | DECOMP_COMPAT, 3448}, + {0x33E5, 0, 2 | DECOMP_COMPAT, 3450}, + {0x33E6, 0, 2 | DECOMP_COMPAT, 3452}, + {0x33E7, 0, 2 | DECOMP_COMPAT, 3454}, + {0x33E8, 0, 2 | DECOMP_COMPAT, 3456}, + {0x33E9, 0, 3 | DECOMP_COMPAT, 3458}, + {0x33EA, 0, 3 | DECOMP_COMPAT, 3461}, + {0x33EB, 0, 3 | DECOMP_COMPAT, 3464}, + {0x33EC, 0, 3 | DECOMP_COMPAT, 3467}, + {0x33ED, 0, 3 | DECOMP_COMPAT, 3470}, + {0x33EE, 0, 3 | DECOMP_COMPAT, 3473}, + {0x33EF, 0, 3 | DECOMP_COMPAT, 3476}, + {0x33F0, 0, 3 | DECOMP_COMPAT, 3479}, + {0x33F1, 0, 3 | DECOMP_COMPAT, 3482}, + {0x33F2, 0, 3 | DECOMP_COMPAT, 3485}, + {0x33F3, 0, 3 | DECOMP_COMPAT, 3488}, + {0x33F4, 0, 3 | DECOMP_COMPAT, 3491}, + {0x33F5, 0, 3 | DECOMP_COMPAT, 3494}, + {0x33F6, 0, 3 | DECOMP_COMPAT, 3497}, + {0x33F7, 0, 3 | DECOMP_COMPAT, 3500}, + {0x33F8, 0, 3 | DECOMP_COMPAT, 3503}, + {0x33F9, 0, 3 | DECOMP_COMPAT, 3506}, + {0x33FA, 0, 3 | DECOMP_COMPAT, 3509}, + {0x33FB, 0, 3 | DECOMP_COMPAT, 3512}, + {0x33FC, 0, 3 | DECOMP_COMPAT, 3515}, + {0x33FD, 0, 3 | DECOMP_COMPAT, 3518}, + {0x33FE, 0, 3 | DECOMP_COMPAT, 3521}, + {0x33FF, 0, 3 | DECOMP_COMPAT, 3524}, + {0xA66F, 230, 0, 0}, + {0xA674, 230, 0, 0}, + {0xA675, 230, 0, 0}, + {0xA676, 230, 0, 0}, + {0xA677, 230, 0, 0}, + {0xA678, 230, 0, 0}, + {0xA679, 230, 0, 0}, + {0xA67A, 230, 0, 0}, + {0xA67B, 230, 0, 0}, + {0xA67C, 230, 0, 0}, + {0xA67D, 230, 0, 0}, + {0xA69C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044A}, + {0xA69D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044C}, + {0xA69E, 230, 0, 0}, + {0xA69F, 230, 0, 0}, + {0xA6F0, 230, 0, 0}, + {0xA6F1, 230, 0, 0}, + {0xA770, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA76F}, + {0xA7F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0xA7F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0xA7F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0xA7F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0126}, + {0xA7F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0153}, + {0xA806, 9, 0, 0}, + {0xA82C, 9, 0, 0}, + {0xA8C4, 9, 0, 0}, + {0xA8E0, 230, 0, 0}, + {0xA8E1, 230, 0, 0}, + {0xA8E2, 230, 0, 0}, + {0xA8E3, 230, 0, 0}, + {0xA8E4, 230, 0, 0}, + {0xA8E5, 230, 0, 0}, + {0xA8E6, 230, 0, 0}, + {0xA8E7, 230, 0, 0}, + {0xA8E8, 230, 0, 0}, + {0xA8E9, 230, 0, 0}, + {0xA8EA, 230, 0, 0}, + {0xA8EB, 230, 0, 0}, + {0xA8EC, 230, 0, 0}, + {0xA8ED, 230, 0, 0}, + {0xA8EE, 230, 0, 0}, + {0xA8EF, 230, 0, 0}, + {0xA8F0, 230, 0, 0}, + {0xA8F1, 230, 0, 0}, + {0xA92B, 220, 0, 0}, + {0xA92C, 220, 0, 0}, + {0xA92D, 220, 0, 0}, + {0xA953, 9, 0, 0}, + {0xA9B3, 7, 0, 0}, + {0xA9C0, 9, 0, 0}, + {0xAAB0, 230, 0, 0}, + {0xAAB2, 230, 0, 0}, + {0xAAB3, 230, 0, 0}, + {0xAAB4, 220, 0, 0}, + {0xAAB7, 230, 0, 0}, + {0xAAB8, 230, 0, 0}, + {0xAABE, 230, 0, 0}, + {0xAABF, 230, 0, 0}, + {0xAAC1, 230, 0, 0}, + {0xAAF6, 9, 0, 0}, + {0xAB5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA727}, + {0xAB5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xAB37}, + {0xAB5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026B}, + {0xAB5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xAB52}, + {0xAB69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028D}, + {0xABED, 9, 0, 0}, + {0xF900, 0, 1 | DECOMP_INLINE, 0x8C48}, + {0xF901, 0, 1 | DECOMP_INLINE, 0x66F4}, + {0xF902, 0, 1 | DECOMP_INLINE, 0x8ECA}, + {0xF903, 0, 1 | DECOMP_INLINE, 0x8CC8}, + {0xF904, 0, 1 | DECOMP_INLINE, 0x6ED1}, + {0xF905, 0, 1 | DECOMP_INLINE, 0x4E32}, + {0xF906, 0, 1 | DECOMP_INLINE, 0x53E5}, + {0xF907, 0, 1 | DECOMP_INLINE, 0x9F9C}, + {0xF908, 0, 1 | DECOMP_INLINE, 0x9F9C}, + {0xF909, 0, 1 | DECOMP_INLINE, 0x5951}, + {0xF90A, 0, 1 | DECOMP_INLINE, 0x91D1}, + {0xF90B, 0, 1 | DECOMP_INLINE, 0x5587}, + {0xF90C, 0, 1 | DECOMP_INLINE, 0x5948}, + {0xF90D, 0, 1 | DECOMP_INLINE, 0x61F6}, + {0xF90E, 0, 1 | DECOMP_INLINE, 0x7669}, + {0xF90F, 0, 1 | DECOMP_INLINE, 0x7F85}, + {0xF910, 0, 1 | DECOMP_INLINE, 0x863F}, + {0xF911, 0, 1 | DECOMP_INLINE, 0x87BA}, + {0xF912, 0, 1 | DECOMP_INLINE, 0x88F8}, + {0xF913, 0, 1 | DECOMP_INLINE, 0x908F}, + {0xF914, 0, 1 | DECOMP_INLINE, 0x6A02}, + {0xF915, 0, 1 | DECOMP_INLINE, 0x6D1B}, + {0xF916, 0, 1 | DECOMP_INLINE, 0x70D9}, + {0xF917, 0, 1 | DECOMP_INLINE, 0x73DE}, + {0xF918, 0, 1 | DECOMP_INLINE, 0x843D}, + {0xF919, 0, 1 | DECOMP_INLINE, 0x916A}, + {0xF91A, 0, 1 | DECOMP_INLINE, 0x99F1}, + {0xF91B, 0, 1 | DECOMP_INLINE, 0x4E82}, + {0xF91C, 0, 1 | DECOMP_INLINE, 0x5375}, + {0xF91D, 0, 1 | DECOMP_INLINE, 0x6B04}, + {0xF91E, 0, 1 | DECOMP_INLINE, 0x721B}, + {0xF91F, 0, 1 | DECOMP_INLINE, 0x862D}, + {0xF920, 0, 1 | DECOMP_INLINE, 0x9E1E}, + {0xF921, 0, 1 | DECOMP_INLINE, 0x5D50}, + {0xF922, 0, 1 | DECOMP_INLINE, 0x6FEB}, + {0xF923, 0, 1 | DECOMP_INLINE, 0x85CD}, + {0xF924, 0, 1 | DECOMP_INLINE, 0x8964}, + {0xF925, 0, 1 | DECOMP_INLINE, 0x62C9}, + {0xF926, 0, 1 | DECOMP_INLINE, 0x81D8}, + {0xF927, 0, 1 | DECOMP_INLINE, 0x881F}, + {0xF928, 0, 1 | DECOMP_INLINE, 0x5ECA}, + {0xF929, 0, 1 | DECOMP_INLINE, 0x6717}, + {0xF92A, 0, 1 | DECOMP_INLINE, 0x6D6A}, + {0xF92B, 0, 1 | DECOMP_INLINE, 0x72FC}, + {0xF92C, 0, 1 | DECOMP_INLINE, 0x90CE}, + {0xF92D, 0, 1 | DECOMP_INLINE, 0x4F86}, + {0xF92E, 0, 1 | DECOMP_INLINE, 0x51B7}, + {0xF92F, 0, 1 | DECOMP_INLINE, 0x52DE}, + {0xF930, 0, 1 | DECOMP_INLINE, 0x64C4}, + {0xF931, 0, 1 | DECOMP_INLINE, 0x6AD3}, + {0xF932, 0, 1 | DECOMP_INLINE, 0x7210}, + {0xF933, 0, 1 | DECOMP_INLINE, 0x76E7}, + {0xF934, 0, 1 | DECOMP_INLINE, 0x8001}, + {0xF935, 0, 1 | DECOMP_INLINE, 0x8606}, + {0xF936, 0, 1 | DECOMP_INLINE, 0x865C}, + {0xF937, 0, 1 | DECOMP_INLINE, 0x8DEF}, + {0xF938, 0, 1 | DECOMP_INLINE, 0x9732}, + {0xF939, 0, 1 | DECOMP_INLINE, 0x9B6F}, + {0xF93A, 0, 1 | DECOMP_INLINE, 0x9DFA}, + {0xF93B, 0, 1 | DECOMP_INLINE, 0x788C}, + {0xF93C, 0, 1 | DECOMP_INLINE, 0x797F}, + {0xF93D, 0, 1 | DECOMP_INLINE, 0x7DA0}, + {0xF93E, 0, 1 | DECOMP_INLINE, 0x83C9}, + {0xF93F, 0, 1 | DECOMP_INLINE, 0x9304}, + {0xF940, 0, 1 | DECOMP_INLINE, 0x9E7F}, + {0xF941, 0, 1 | DECOMP_INLINE, 0x8AD6}, + {0xF942, 0, 1 | DECOMP_INLINE, 0x58DF}, + {0xF943, 0, 1 | DECOMP_INLINE, 0x5F04}, + {0xF944, 0, 1 | DECOMP_INLINE, 0x7C60}, + {0xF945, 0, 1 | DECOMP_INLINE, 0x807E}, + {0xF946, 0, 1 | DECOMP_INLINE, 0x7262}, + {0xF947, 0, 1 | DECOMP_INLINE, 0x78CA}, + {0xF948, 0, 1 | DECOMP_INLINE, 0x8CC2}, + {0xF949, 0, 1 | DECOMP_INLINE, 0x96F7}, + {0xF94A, 0, 1 | DECOMP_INLINE, 0x58D8}, + {0xF94B, 0, 1 | DECOMP_INLINE, 0x5C62}, + {0xF94C, 0, 1 | DECOMP_INLINE, 0x6A13}, + {0xF94D, 0, 1 | DECOMP_INLINE, 0x6DDA}, + {0xF94E, 0, 1 | DECOMP_INLINE, 0x6F0F}, + {0xF94F, 0, 1 | DECOMP_INLINE, 0x7D2F}, + {0xF950, 0, 1 | DECOMP_INLINE, 0x7E37}, + {0xF951, 0, 1 | DECOMP_INLINE, 0x964B}, + {0xF952, 0, 1 | DECOMP_INLINE, 0x52D2}, + {0xF953, 0, 1 | DECOMP_INLINE, 0x808B}, + {0xF954, 0, 1 | DECOMP_INLINE, 0x51DC}, + {0xF955, 0, 1 | DECOMP_INLINE, 0x51CC}, + {0xF956, 0, 1 | DECOMP_INLINE, 0x7A1C}, + {0xF957, 0, 1 | DECOMP_INLINE, 0x7DBE}, + {0xF958, 0, 1 | DECOMP_INLINE, 0x83F1}, + {0xF959, 0, 1 | DECOMP_INLINE, 0x9675}, + {0xF95A, 0, 1 | DECOMP_INLINE, 0x8B80}, + {0xF95B, 0, 1 | DECOMP_INLINE, 0x62CF}, + {0xF95C, 0, 1 | DECOMP_INLINE, 0x6A02}, + {0xF95D, 0, 1 | DECOMP_INLINE, 0x8AFE}, + {0xF95E, 0, 1 | DECOMP_INLINE, 0x4E39}, + {0xF95F, 0, 1 | DECOMP_INLINE, 0x5BE7}, + {0xF960, 0, 1 | DECOMP_INLINE, 0x6012}, + {0xF961, 0, 1 | DECOMP_INLINE, 0x7387}, + {0xF962, 0, 1 | DECOMP_INLINE, 0x7570}, + {0xF963, 0, 1 | DECOMP_INLINE, 0x5317}, + {0xF964, 0, 1 | DECOMP_INLINE, 0x78FB}, + {0xF965, 0, 1 | DECOMP_INLINE, 0x4FBF}, + {0xF966, 0, 1 | DECOMP_INLINE, 0x5FA9}, + {0xF967, 0, 1 | DECOMP_INLINE, 0x4E0D}, + {0xF968, 0, 1 | DECOMP_INLINE, 0x6CCC}, + {0xF969, 0, 1 | DECOMP_INLINE, 0x6578}, + {0xF96A, 0, 1 | DECOMP_INLINE, 0x7D22}, + {0xF96B, 0, 1 | DECOMP_INLINE, 0x53C3}, + {0xF96C, 0, 1 | DECOMP_INLINE, 0x585E}, + {0xF96D, 0, 1 | DECOMP_INLINE, 0x7701}, + {0xF96E, 0, 1 | DECOMP_INLINE, 0x8449}, + {0xF96F, 0, 1 | DECOMP_INLINE, 0x8AAA}, + {0xF970, 0, 1 | DECOMP_INLINE, 0x6BBA}, + {0xF971, 0, 1 | DECOMP_INLINE, 0x8FB0}, + {0xF972, 0, 1 | DECOMP_INLINE, 0x6C88}, + {0xF973, 0, 1 | DECOMP_INLINE, 0x62FE}, + {0xF974, 0, 1 | DECOMP_INLINE, 0x82E5}, + {0xF975, 0, 1 | DECOMP_INLINE, 0x63A0}, + {0xF976, 0, 1 | DECOMP_INLINE, 0x7565}, + {0xF977, 0, 1 | DECOMP_INLINE, 0x4EAE}, + {0xF978, 0, 1 | DECOMP_INLINE, 0x5169}, + {0xF979, 0, 1 | DECOMP_INLINE, 0x51C9}, + {0xF97A, 0, 1 | DECOMP_INLINE, 0x6881}, + {0xF97B, 0, 1 | DECOMP_INLINE, 0x7CE7}, + {0xF97C, 0, 1 | DECOMP_INLINE, 0x826F}, + {0xF97D, 0, 1 | DECOMP_INLINE, 0x8AD2}, + {0xF97E, 0, 1 | DECOMP_INLINE, 0x91CF}, + {0xF97F, 0, 1 | DECOMP_INLINE, 0x52F5}, + {0xF980, 0, 1 | DECOMP_INLINE, 0x5442}, + {0xF981, 0, 1 | DECOMP_INLINE, 0x5973}, + {0xF982, 0, 1 | DECOMP_INLINE, 0x5EEC}, + {0xF983, 0, 1 | DECOMP_INLINE, 0x65C5}, + {0xF984, 0, 1 | DECOMP_INLINE, 0x6FFE}, + {0xF985, 0, 1 | DECOMP_INLINE, 0x792A}, + {0xF986, 0, 1 | DECOMP_INLINE, 0x95AD}, + {0xF987, 0, 1 | DECOMP_INLINE, 0x9A6A}, + {0xF988, 0, 1 | DECOMP_INLINE, 0x9E97}, + {0xF989, 0, 1 | DECOMP_INLINE, 0x9ECE}, + {0xF98A, 0, 1 | DECOMP_INLINE, 0x529B}, + {0xF98B, 0, 1 | DECOMP_INLINE, 0x66C6}, + {0xF98C, 0, 1 | DECOMP_INLINE, 0x6B77}, + {0xF98D, 0, 1 | DECOMP_INLINE, 0x8F62}, + {0xF98E, 0, 1 | DECOMP_INLINE, 0x5E74}, + {0xF98F, 0, 1 | DECOMP_INLINE, 0x6190}, + {0xF990, 0, 1 | DECOMP_INLINE, 0x6200}, + {0xF991, 0, 1 | DECOMP_INLINE, 0x649A}, + {0xF992, 0, 1 | DECOMP_INLINE, 0x6F23}, + {0xF993, 0, 1 | DECOMP_INLINE, 0x7149}, + {0xF994, 0, 1 | DECOMP_INLINE, 0x7489}, + {0xF995, 0, 1 | DECOMP_INLINE, 0x79CA}, + {0xF996, 0, 1 | DECOMP_INLINE, 0x7DF4}, + {0xF997, 0, 1 | DECOMP_INLINE, 0x806F}, + {0xF998, 0, 1 | DECOMP_INLINE, 0x8F26}, + {0xF999, 0, 1 | DECOMP_INLINE, 0x84EE}, + {0xF99A, 0, 1 | DECOMP_INLINE, 0x9023}, + {0xF99B, 0, 1 | DECOMP_INLINE, 0x934A}, + {0xF99C, 0, 1 | DECOMP_INLINE, 0x5217}, + {0xF99D, 0, 1 | DECOMP_INLINE, 0x52A3}, + {0xF99E, 0, 1 | DECOMP_INLINE, 0x54BD}, + {0xF99F, 0, 1 | DECOMP_INLINE, 0x70C8}, + {0xF9A0, 0, 1 | DECOMP_INLINE, 0x88C2}, + {0xF9A1, 0, 1 | DECOMP_INLINE, 0x8AAA}, + {0xF9A2, 0, 1 | DECOMP_INLINE, 0x5EC9}, + {0xF9A3, 0, 1 | DECOMP_INLINE, 0x5FF5}, + {0xF9A4, 0, 1 | DECOMP_INLINE, 0x637B}, + {0xF9A5, 0, 1 | DECOMP_INLINE, 0x6BAE}, + {0xF9A6, 0, 1 | DECOMP_INLINE, 0x7C3E}, + {0xF9A7, 0, 1 | DECOMP_INLINE, 0x7375}, + {0xF9A8, 0, 1 | DECOMP_INLINE, 0x4EE4}, + {0xF9A9, 0, 1 | DECOMP_INLINE, 0x56F9}, + {0xF9AA, 0, 1 | DECOMP_INLINE, 0x5BE7}, + {0xF9AB, 0, 1 | DECOMP_INLINE, 0x5DBA}, + {0xF9AC, 0, 1 | DECOMP_INLINE, 0x601C}, + {0xF9AD, 0, 1 | DECOMP_INLINE, 0x73B2}, + {0xF9AE, 0, 1 | DECOMP_INLINE, 0x7469}, + {0xF9AF, 0, 1 | DECOMP_INLINE, 0x7F9A}, + {0xF9B0, 0, 1 | DECOMP_INLINE, 0x8046}, + {0xF9B1, 0, 1 | DECOMP_INLINE, 0x9234}, + {0xF9B2, 0, 1 | DECOMP_INLINE, 0x96F6}, + {0xF9B3, 0, 1 | DECOMP_INLINE, 0x9748}, + {0xF9B4, 0, 1 | DECOMP_INLINE, 0x9818}, + {0xF9B5, 0, 1 | DECOMP_INLINE, 0x4F8B}, + {0xF9B6, 0, 1 | DECOMP_INLINE, 0x79AE}, + {0xF9B7, 0, 1 | DECOMP_INLINE, 0x91B4}, + {0xF9B8, 0, 1 | DECOMP_INLINE, 0x96B8}, + {0xF9B9, 0, 1 | DECOMP_INLINE, 0x60E1}, + {0xF9BA, 0, 1 | DECOMP_INLINE, 0x4E86}, + {0xF9BB, 0, 1 | DECOMP_INLINE, 0x50DA}, + {0xF9BC, 0, 1 | DECOMP_INLINE, 0x5BEE}, + {0xF9BD, 0, 1 | DECOMP_INLINE, 0x5C3F}, + {0xF9BE, 0, 1 | DECOMP_INLINE, 0x6599}, + {0xF9BF, 0, 1 | DECOMP_INLINE, 0x6A02}, + {0xF9C0, 0, 1 | DECOMP_INLINE, 0x71CE}, + {0xF9C1, 0, 1 | DECOMP_INLINE, 0x7642}, + {0xF9C2, 0, 1 | DECOMP_INLINE, 0x84FC}, + {0xF9C3, 0, 1 | DECOMP_INLINE, 0x907C}, + {0xF9C4, 0, 1 | DECOMP_INLINE, 0x9F8D}, + {0xF9C5, 0, 1 | DECOMP_INLINE, 0x6688}, + {0xF9C6, 0, 1 | DECOMP_INLINE, 0x962E}, + {0xF9C7, 0, 1 | DECOMP_INLINE, 0x5289}, + {0xF9C8, 0, 1 | DECOMP_INLINE, 0x677B}, + {0xF9C9, 0, 1 | DECOMP_INLINE, 0x67F3}, + {0xF9CA, 0, 1 | DECOMP_INLINE, 0x6D41}, + {0xF9CB, 0, 1 | DECOMP_INLINE, 0x6E9C}, + {0xF9CC, 0, 1 | DECOMP_INLINE, 0x7409}, + {0xF9CD, 0, 1 | DECOMP_INLINE, 0x7559}, + {0xF9CE, 0, 1 | DECOMP_INLINE, 0x786B}, + {0xF9CF, 0, 1 | DECOMP_INLINE, 0x7D10}, + {0xF9D0, 0, 1 | DECOMP_INLINE, 0x985E}, + {0xF9D1, 0, 1 | DECOMP_INLINE, 0x516D}, + {0xF9D2, 0, 1 | DECOMP_INLINE, 0x622E}, + {0xF9D3, 0, 1 | DECOMP_INLINE, 0x9678}, + {0xF9D4, 0, 1 | DECOMP_INLINE, 0x502B}, + {0xF9D5, 0, 1 | DECOMP_INLINE, 0x5D19}, + {0xF9D6, 0, 1 | DECOMP_INLINE, 0x6DEA}, + {0xF9D7, 0, 1 | DECOMP_INLINE, 0x8F2A}, + {0xF9D8, 0, 1 | DECOMP_INLINE, 0x5F8B}, + {0xF9D9, 0, 1 | DECOMP_INLINE, 0x6144}, + {0xF9DA, 0, 1 | DECOMP_INLINE, 0x6817}, + {0xF9DB, 0, 1 | DECOMP_INLINE, 0x7387}, + {0xF9DC, 0, 1 | DECOMP_INLINE, 0x9686}, + {0xF9DD, 0, 1 | DECOMP_INLINE, 0x5229}, + {0xF9DE, 0, 1 | DECOMP_INLINE, 0x540F}, + {0xF9DF, 0, 1 | DECOMP_INLINE, 0x5C65}, + {0xF9E0, 0, 1 | DECOMP_INLINE, 0x6613}, + {0xF9E1, 0, 1 | DECOMP_INLINE, 0x674E}, + {0xF9E2, 0, 1 | DECOMP_INLINE, 0x68A8}, + {0xF9E3, 0, 1 | DECOMP_INLINE, 0x6CE5}, + {0xF9E4, 0, 1 | DECOMP_INLINE, 0x7406}, + {0xF9E5, 0, 1 | DECOMP_INLINE, 0x75E2}, + {0xF9E6, 0, 1 | DECOMP_INLINE, 0x7F79}, + {0xF9E7, 0, 1 | DECOMP_INLINE, 0x88CF}, + {0xF9E8, 0, 1 | DECOMP_INLINE, 0x88E1}, + {0xF9E9, 0, 1 | DECOMP_INLINE, 0x91CC}, + {0xF9EA, 0, 1 | DECOMP_INLINE, 0x96E2}, + {0xF9EB, 0, 1 | DECOMP_INLINE, 0x533F}, + {0xF9EC, 0, 1 | DECOMP_INLINE, 0x6EBA}, + {0xF9ED, 0, 1 | DECOMP_INLINE, 0x541D}, + {0xF9EE, 0, 1 | DECOMP_INLINE, 0x71D0}, + {0xF9EF, 0, 1 | DECOMP_INLINE, 0x7498}, + {0xF9F0, 0, 1 | DECOMP_INLINE, 0x85FA}, + {0xF9F1, 0, 1 | DECOMP_INLINE, 0x96A3}, + {0xF9F2, 0, 1 | DECOMP_INLINE, 0x9C57}, + {0xF9F3, 0, 1 | DECOMP_INLINE, 0x9E9F}, + {0xF9F4, 0, 1 | DECOMP_INLINE, 0x6797}, + {0xF9F5, 0, 1 | DECOMP_INLINE, 0x6DCB}, + {0xF9F6, 0, 1 | DECOMP_INLINE, 0x81E8}, + {0xF9F7, 0, 1 | DECOMP_INLINE, 0x7ACB}, + {0xF9F8, 0, 1 | DECOMP_INLINE, 0x7B20}, + {0xF9F9, 0, 1 | DECOMP_INLINE, 0x7C92}, + {0xF9FA, 0, 1 | DECOMP_INLINE, 0x72C0}, + {0xF9FB, 0, 1 | DECOMP_INLINE, 0x7099}, + {0xF9FC, 0, 1 | DECOMP_INLINE, 0x8B58}, + {0xF9FD, 0, 1 | DECOMP_INLINE, 0x4EC0}, + {0xF9FE, 0, 1 | DECOMP_INLINE, 0x8336}, + {0xF9FF, 0, 1 | DECOMP_INLINE, 0x523A}, + {0xFA00, 0, 1 | DECOMP_INLINE, 0x5207}, + {0xFA01, 0, 1 | DECOMP_INLINE, 0x5EA6}, + {0xFA02, 0, 1 | DECOMP_INLINE, 0x62D3}, + {0xFA03, 0, 1 | DECOMP_INLINE, 0x7CD6}, + {0xFA04, 0, 1 | DECOMP_INLINE, 0x5B85}, + {0xFA05, 0, 1 | DECOMP_INLINE, 0x6D1E}, + {0xFA06, 0, 1 | DECOMP_INLINE, 0x66B4}, + {0xFA07, 0, 1 | DECOMP_INLINE, 0x8F3B}, + {0xFA08, 0, 1 | DECOMP_INLINE, 0x884C}, + {0xFA09, 0, 1 | DECOMP_INLINE, 0x964D}, + {0xFA0A, 0, 1 | DECOMP_INLINE, 0x898B}, + {0xFA0B, 0, 1 | DECOMP_INLINE, 0x5ED3}, + {0xFA0C, 0, 1 | DECOMP_INLINE, 0x5140}, + {0xFA0D, 0, 1 | DECOMP_INLINE, 0x55C0}, + {0xFA10, 0, 1 | DECOMP_INLINE, 0x585A}, + {0xFA12, 0, 1 | DECOMP_INLINE, 0x6674}, + {0xFA15, 0, 1 | DECOMP_INLINE, 0x51DE}, + {0xFA16, 0, 1 | DECOMP_INLINE, 0x732A}, + {0xFA17, 0, 1 | DECOMP_INLINE, 0x76CA}, + {0xFA18, 0, 1 | DECOMP_INLINE, 0x793C}, + {0xFA19, 0, 1 | DECOMP_INLINE, 0x795E}, + {0xFA1A, 0, 1 | DECOMP_INLINE, 0x7965}, + {0xFA1B, 0, 1 | DECOMP_INLINE, 0x798F}, + {0xFA1C, 0, 1 | DECOMP_INLINE, 0x9756}, + {0xFA1D, 0, 1 | DECOMP_INLINE, 0x7CBE}, + {0xFA1E, 0, 1 | DECOMP_INLINE, 0x7FBD}, + {0xFA20, 0, 1 | DECOMP_INLINE, 0x8612}, + {0xFA22, 0, 1 | DECOMP_INLINE, 0x8AF8}, + {0xFA25, 0, 1 | DECOMP_INLINE, 0x9038}, + {0xFA26, 0, 1 | DECOMP_INLINE, 0x90FD}, + {0xFA2A, 0, 1 | DECOMP_INLINE, 0x98EF}, + {0xFA2B, 0, 1 | DECOMP_INLINE, 0x98FC}, + {0xFA2C, 0, 1 | DECOMP_INLINE, 0x9928}, + {0xFA2D, 0, 1 | DECOMP_INLINE, 0x9DB4}, + {0xFA2E, 0, 1 | DECOMP_INLINE, 0x90DE}, + {0xFA2F, 0, 1 | DECOMP_INLINE, 0x96B7}, + {0xFA30, 0, 1 | DECOMP_INLINE, 0x4FAE}, + {0xFA31, 0, 1 | DECOMP_INLINE, 0x50E7}, + {0xFA32, 0, 1 | DECOMP_INLINE, 0x514D}, + {0xFA33, 0, 1 | DECOMP_INLINE, 0x52C9}, + {0xFA34, 0, 1 | DECOMP_INLINE, 0x52E4}, + {0xFA35, 0, 1 | DECOMP_INLINE, 0x5351}, + {0xFA36, 0, 1 | DECOMP_INLINE, 0x559D}, + {0xFA37, 0, 1 | DECOMP_INLINE, 0x5606}, + {0xFA38, 0, 1 | DECOMP_INLINE, 0x5668}, + {0xFA39, 0, 1 | DECOMP_INLINE, 0x5840}, + {0xFA3A, 0, 1 | DECOMP_INLINE, 0x58A8}, + {0xFA3B, 0, 1 | DECOMP_INLINE, 0x5C64}, + {0xFA3C, 0, 1 | DECOMP_INLINE, 0x5C6E}, + {0xFA3D, 0, 1 | DECOMP_INLINE, 0x6094}, + {0xFA3E, 0, 1 | DECOMP_INLINE, 0x6168}, + {0xFA3F, 0, 1 | DECOMP_INLINE, 0x618E}, + {0xFA40, 0, 1 | DECOMP_INLINE, 0x61F2}, + {0xFA41, 0, 1 | DECOMP_INLINE, 0x654F}, + {0xFA42, 0, 1 | DECOMP_INLINE, 0x65E2}, + {0xFA43, 0, 1 | DECOMP_INLINE, 0x6691}, + {0xFA44, 0, 1 | DECOMP_INLINE, 0x6885}, + {0xFA45, 0, 1 | DECOMP_INLINE, 0x6D77}, + {0xFA46, 0, 1 | DECOMP_INLINE, 0x6E1A}, + {0xFA47, 0, 1 | DECOMP_INLINE, 0x6F22}, + {0xFA48, 0, 1 | DECOMP_INLINE, 0x716E}, + {0xFA49, 0, 1 | DECOMP_INLINE, 0x722B}, + {0xFA4A, 0, 1 | DECOMP_INLINE, 0x7422}, + {0xFA4B, 0, 1 | DECOMP_INLINE, 0x7891}, + {0xFA4C, 0, 1 | DECOMP_INLINE, 0x793E}, + {0xFA4D, 0, 1 | DECOMP_INLINE, 0x7949}, + {0xFA4E, 0, 1 | DECOMP_INLINE, 0x7948}, + {0xFA4F, 0, 1 | DECOMP_INLINE, 0x7950}, + {0xFA50, 0, 1 | DECOMP_INLINE, 0x7956}, + {0xFA51, 0, 1 | DECOMP_INLINE, 0x795D}, + {0xFA52, 0, 1 | DECOMP_INLINE, 0x798D}, + {0xFA53, 0, 1 | DECOMP_INLINE, 0x798E}, + {0xFA54, 0, 1 | DECOMP_INLINE, 0x7A40}, + {0xFA55, 0, 1 | DECOMP_INLINE, 0x7A81}, + {0xFA56, 0, 1 | DECOMP_INLINE, 0x7BC0}, + {0xFA57, 0, 1 | DECOMP_INLINE, 0x7DF4}, + {0xFA58, 0, 1 | DECOMP_INLINE, 0x7E09}, + {0xFA59, 0, 1 | DECOMP_INLINE, 0x7E41}, + {0xFA5A, 0, 1 | DECOMP_INLINE, 0x7F72}, + {0xFA5B, 0, 1 | DECOMP_INLINE, 0x8005}, + {0xFA5C, 0, 1 | DECOMP_INLINE, 0x81ED}, + {0xFA5D, 0, 1 | DECOMP_INLINE, 0x8279}, + {0xFA5E, 0, 1 | DECOMP_INLINE, 0x8279}, + {0xFA5F, 0, 1 | DECOMP_INLINE, 0x8457}, + {0xFA60, 0, 1 | DECOMP_INLINE, 0x8910}, + {0xFA61, 0, 1 | DECOMP_INLINE, 0x8996}, + {0xFA62, 0, 1 | DECOMP_INLINE, 0x8B01}, + {0xFA63, 0, 1 | DECOMP_INLINE, 0x8B39}, + {0xFA64, 0, 1 | DECOMP_INLINE, 0x8CD3}, + {0xFA65, 0, 1 | DECOMP_INLINE, 0x8D08}, + {0xFA66, 0, 1 | DECOMP_INLINE, 0x8FB6}, + {0xFA67, 0, 1 | DECOMP_INLINE, 0x9038}, + {0xFA68, 0, 1 | DECOMP_INLINE, 0x96E3}, + {0xFA69, 0, 1 | DECOMP_INLINE, 0x97FF}, + {0xFA6A, 0, 1 | DECOMP_INLINE, 0x983B}, + {0xFA6B, 0, 1 | DECOMP_INLINE, 0x6075}, + {0xFA6C, 0, 1, 3527}, + {0xFA6D, 0, 1 | DECOMP_INLINE, 0x8218}, + {0xFA70, 0, 1 | DECOMP_INLINE, 0x4E26}, + {0xFA71, 0, 1 | DECOMP_INLINE, 0x51B5}, + {0xFA72, 0, 1 | DECOMP_INLINE, 0x5168}, + {0xFA73, 0, 1 | DECOMP_INLINE, 0x4F80}, + {0xFA74, 0, 1 | DECOMP_INLINE, 0x5145}, + {0xFA75, 0, 1 | DECOMP_INLINE, 0x5180}, + {0xFA76, 0, 1 | DECOMP_INLINE, 0x52C7}, + {0xFA77, 0, 1 | DECOMP_INLINE, 0x52FA}, + {0xFA78, 0, 1 | DECOMP_INLINE, 0x559D}, + {0xFA79, 0, 1 | DECOMP_INLINE, 0x5555}, + {0xFA7A, 0, 1 | DECOMP_INLINE, 0x5599}, + {0xFA7B, 0, 1 | DECOMP_INLINE, 0x55E2}, + {0xFA7C, 0, 1 | DECOMP_INLINE, 0x585A}, + {0xFA7D, 0, 1 | DECOMP_INLINE, 0x58B3}, + {0xFA7E, 0, 1 | DECOMP_INLINE, 0x5944}, + {0xFA7F, 0, 1 | DECOMP_INLINE, 0x5954}, + {0xFA80, 0, 1 | DECOMP_INLINE, 0x5A62}, + {0xFA81, 0, 1 | DECOMP_INLINE, 0x5B28}, + {0xFA82, 0, 1 | DECOMP_INLINE, 0x5ED2}, + {0xFA83, 0, 1 | DECOMP_INLINE, 0x5ED9}, + {0xFA84, 0, 1 | DECOMP_INLINE, 0x5F69}, + {0xFA85, 0, 1 | DECOMP_INLINE, 0x5FAD}, + {0xFA86, 0, 1 | DECOMP_INLINE, 0x60D8}, + {0xFA87, 0, 1 | DECOMP_INLINE, 0x614E}, + {0xFA88, 0, 1 | DECOMP_INLINE, 0x6108}, + {0xFA89, 0, 1 | DECOMP_INLINE, 0x618E}, + {0xFA8A, 0, 1 | DECOMP_INLINE, 0x6160}, + {0xFA8B, 0, 1 | DECOMP_INLINE, 0x61F2}, + {0xFA8C, 0, 1 | DECOMP_INLINE, 0x6234}, + {0xFA8D, 0, 1 | DECOMP_INLINE, 0x63C4}, + {0xFA8E, 0, 1 | DECOMP_INLINE, 0x641C}, + {0xFA8F, 0, 1 | DECOMP_INLINE, 0x6452}, + {0xFA90, 0, 1 | DECOMP_INLINE, 0x6556}, + {0xFA91, 0, 1 | DECOMP_INLINE, 0x6674}, + {0xFA92, 0, 1 | DECOMP_INLINE, 0x6717}, + {0xFA93, 0, 1 | DECOMP_INLINE, 0x671B}, + {0xFA94, 0, 1 | DECOMP_INLINE, 0x6756}, + {0xFA95, 0, 1 | DECOMP_INLINE, 0x6B79}, + {0xFA96, 0, 1 | DECOMP_INLINE, 0x6BBA}, + {0xFA97, 0, 1 | DECOMP_INLINE, 0x6D41}, + {0xFA98, 0, 1 | DECOMP_INLINE, 0x6EDB}, + {0xFA99, 0, 1 | DECOMP_INLINE, 0x6ECB}, + {0xFA9A, 0, 1 | DECOMP_INLINE, 0x6F22}, + {0xFA9B, 0, 1 | DECOMP_INLINE, 0x701E}, + {0xFA9C, 0, 1 | DECOMP_INLINE, 0x716E}, + {0xFA9D, 0, 1 | DECOMP_INLINE, 0x77A7}, + {0xFA9E, 0, 1 | DECOMP_INLINE, 0x7235}, + {0xFA9F, 0, 1 | DECOMP_INLINE, 0x72AF}, + {0xFAA0, 0, 1 | DECOMP_INLINE, 0x732A}, + {0xFAA1, 0, 1 | DECOMP_INLINE, 0x7471}, + {0xFAA2, 0, 1 | DECOMP_INLINE, 0x7506}, + {0xFAA3, 0, 1 | DECOMP_INLINE, 0x753B}, + {0xFAA4, 0, 1 | DECOMP_INLINE, 0x761D}, + {0xFAA5, 0, 1 | DECOMP_INLINE, 0x761F}, + {0xFAA6, 0, 1 | DECOMP_INLINE, 0x76CA}, + {0xFAA7, 0, 1 | DECOMP_INLINE, 0x76DB}, + {0xFAA8, 0, 1 | DECOMP_INLINE, 0x76F4}, + {0xFAA9, 0, 1 | DECOMP_INLINE, 0x774A}, + {0xFAAA, 0, 1 | DECOMP_INLINE, 0x7740}, + {0xFAAB, 0, 1 | DECOMP_INLINE, 0x78CC}, + {0xFAAC, 0, 1 | DECOMP_INLINE, 0x7AB1}, + {0xFAAD, 0, 1 | DECOMP_INLINE, 0x7BC0}, + {0xFAAE, 0, 1 | DECOMP_INLINE, 0x7C7B}, + {0xFAAF, 0, 1 | DECOMP_INLINE, 0x7D5B}, + {0xFAB0, 0, 1 | DECOMP_INLINE, 0x7DF4}, + {0xFAB1, 0, 1 | DECOMP_INLINE, 0x7F3E}, + {0xFAB2, 0, 1 | DECOMP_INLINE, 0x8005}, + {0xFAB3, 0, 1 | DECOMP_INLINE, 0x8352}, + {0xFAB4, 0, 1 | DECOMP_INLINE, 0x83EF}, + {0xFAB5, 0, 1 | DECOMP_INLINE, 0x8779}, + {0xFAB6, 0, 1 | DECOMP_INLINE, 0x8941}, + {0xFAB7, 0, 1 | DECOMP_INLINE, 0x8986}, + {0xFAB8, 0, 1 | DECOMP_INLINE, 0x8996}, + {0xFAB9, 0, 1 | DECOMP_INLINE, 0x8ABF}, + {0xFABA, 0, 1 | DECOMP_INLINE, 0x8AF8}, + {0xFABB, 0, 1 | DECOMP_INLINE, 0x8ACB}, + {0xFABC, 0, 1 | DECOMP_INLINE, 0x8B01}, + {0xFABD, 0, 1 | DECOMP_INLINE, 0x8AFE}, + {0xFABE, 0, 1 | DECOMP_INLINE, 0x8AED}, + {0xFABF, 0, 1 | DECOMP_INLINE, 0x8B39}, + {0xFAC0, 0, 1 | DECOMP_INLINE, 0x8B8A}, + {0xFAC1, 0, 1 | DECOMP_INLINE, 0x8D08}, + {0xFAC2, 0, 1 | DECOMP_INLINE, 0x8F38}, + {0xFAC3, 0, 1 | DECOMP_INLINE, 0x9072}, + {0xFAC4, 0, 1 | DECOMP_INLINE, 0x9199}, + {0xFAC5, 0, 1 | DECOMP_INLINE, 0x9276}, + {0xFAC6, 0, 1 | DECOMP_INLINE, 0x967C}, + {0xFAC7, 0, 1 | DECOMP_INLINE, 0x96E3}, + {0xFAC8, 0, 1 | DECOMP_INLINE, 0x9756}, + {0xFAC9, 0, 1 | DECOMP_INLINE, 0x97DB}, + {0xFACA, 0, 1 | DECOMP_INLINE, 0x97FF}, + {0xFACB, 0, 1 | DECOMP_INLINE, 0x980B}, + {0xFACC, 0, 1 | DECOMP_INLINE, 0x983B}, + {0xFACD, 0, 1 | DECOMP_INLINE, 0x9B12}, + {0xFACE, 0, 1 | DECOMP_INLINE, 0x9F9C}, + {0xFACF, 0, 1, 3528}, + {0xFAD0, 0, 1, 3529}, + {0xFAD1, 0, 1, 3530}, + {0xFAD2, 0, 1 | DECOMP_INLINE, 0x3B9D}, + {0xFAD3, 0, 1 | DECOMP_INLINE, 0x4018}, + {0xFAD4, 0, 1 | DECOMP_INLINE, 0x4039}, + {0xFAD5, 0, 1, 3531}, + {0xFAD6, 0, 1, 3532}, + {0xFAD7, 0, 1, 3533}, + {0xFAD8, 0, 1 | DECOMP_INLINE, 0x9F43}, + {0xFAD9, 0, 1 | DECOMP_INLINE, 0x9F8E}, + {0xFB00, 0, 2 | DECOMP_COMPAT, 3534}, + {0xFB01, 0, 2 | DECOMP_COMPAT, 3536}, + {0xFB02, 0, 2 | DECOMP_COMPAT, 3538}, + {0xFB03, 0, 3 | DECOMP_COMPAT, 3540}, + {0xFB04, 0, 3 | DECOMP_COMPAT, 3543}, + {0xFB05, 0, 2 | DECOMP_COMPAT, 3546}, + {0xFB06, 0, 2 | DECOMP_COMPAT, 3548}, + {0xFB13, 0, 2 | DECOMP_COMPAT, 3550}, + {0xFB14, 0, 2 | DECOMP_COMPAT, 3552}, + {0xFB15, 0, 2 | DECOMP_COMPAT, 3554}, + {0xFB16, 0, 2 | DECOMP_COMPAT, 3556}, + {0xFB17, 0, 2 | DECOMP_COMPAT, 3558}, + {0xFB1D, 0, 2 | DECOMP_NO_COMPOSE, 3560}, /* in exclusion list */ + {0xFB1E, 26, 0, 0}, + {0xFB1F, 0, 2 | DECOMP_NO_COMPOSE, 3562}, /* in exclusion list */ + {0xFB20, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05E2}, + {0xFB21, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D0}, + {0xFB22, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D3}, + {0xFB23, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D4}, + {0xFB24, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05DB}, + {0xFB25, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05DC}, + {0xFB26, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05DD}, + {0xFB27, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05E8}, + {0xFB28, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05EA}, + {0xFB29, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0xFB2A, 0, 2 | DECOMP_NO_COMPOSE, 3564}, /* in exclusion list */ + {0xFB2B, 0, 2 | DECOMP_NO_COMPOSE, 3566}, /* in exclusion list */ + {0xFB2C, 0, 2 | DECOMP_NO_COMPOSE, 3568}, /* in exclusion list */ + {0xFB2D, 0, 2 | DECOMP_NO_COMPOSE, 3570}, /* in exclusion list */ + {0xFB2E, 0, 2 | DECOMP_NO_COMPOSE, 3572}, /* in exclusion list */ + {0xFB2F, 0, 2 | DECOMP_NO_COMPOSE, 3574}, /* in exclusion list */ + {0xFB30, 0, 2 | DECOMP_NO_COMPOSE, 3576}, /* in exclusion list */ + {0xFB31, 0, 2 | DECOMP_NO_COMPOSE, 3578}, /* in exclusion list */ + {0xFB32, 0, 2 | DECOMP_NO_COMPOSE, 3580}, /* in exclusion list */ + {0xFB33, 0, 2 | DECOMP_NO_COMPOSE, 3582}, /* in exclusion list */ + {0xFB34, 0, 2 | DECOMP_NO_COMPOSE, 3584}, /* in exclusion list */ + {0xFB35, 0, 2 | DECOMP_NO_COMPOSE, 3586}, /* in exclusion list */ + {0xFB36, 0, 2 | DECOMP_NO_COMPOSE, 3588}, /* in exclusion list */ + {0xFB38, 0, 2 | DECOMP_NO_COMPOSE, 3590}, /* in exclusion list */ + {0xFB39, 0, 2 | DECOMP_NO_COMPOSE, 3592}, /* in exclusion list */ + {0xFB3A, 0, 2 | DECOMP_NO_COMPOSE, 3594}, /* in exclusion list */ + {0xFB3B, 0, 2 | DECOMP_NO_COMPOSE, 3596}, /* in exclusion list */ + {0xFB3C, 0, 2 | DECOMP_NO_COMPOSE, 3598}, /* in exclusion list */ + {0xFB3E, 0, 2 | DECOMP_NO_COMPOSE, 3600}, /* in exclusion list */ + {0xFB40, 0, 2 | DECOMP_NO_COMPOSE, 3602}, /* in exclusion list */ + {0xFB41, 0, 2 | DECOMP_NO_COMPOSE, 3604}, /* in exclusion list */ + {0xFB43, 0, 2 | DECOMP_NO_COMPOSE, 3606}, /* in exclusion list */ + {0xFB44, 0, 2 | DECOMP_NO_COMPOSE, 3608}, /* in exclusion list */ + {0xFB46, 0, 2 | DECOMP_NO_COMPOSE, 3610}, /* in exclusion list */ + {0xFB47, 0, 2 | DECOMP_NO_COMPOSE, 3612}, /* in exclusion list */ + {0xFB48, 0, 2 | DECOMP_NO_COMPOSE, 3614}, /* in exclusion list */ + {0xFB49, 0, 2 | DECOMP_NO_COMPOSE, 3616}, /* in exclusion list */ + {0xFB4A, 0, 2 | DECOMP_NO_COMPOSE, 3618}, /* in exclusion list */ + {0xFB4B, 0, 2 | DECOMP_NO_COMPOSE, 3620}, /* in exclusion list */ + {0xFB4C, 0, 2 | DECOMP_NO_COMPOSE, 3622}, /* in exclusion list */ + {0xFB4D, 0, 2 | DECOMP_NO_COMPOSE, 3624}, /* in exclusion list */ + {0xFB4E, 0, 2 | DECOMP_NO_COMPOSE, 3626}, /* in exclusion list */ + {0xFB4F, 0, 2 | DECOMP_COMPAT, 3628}, + {0xFB50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0671}, + {0xFB51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0671}, + {0xFB52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067B}, + {0xFB53, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067B}, + {0xFB54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067B}, + {0xFB55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067B}, + {0xFB56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067E}, + {0xFB57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067E}, + {0xFB58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067E}, + {0xFB59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067E}, + {0xFB5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0680}, + {0xFB5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0680}, + {0xFB5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0680}, + {0xFB5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0680}, + {0xFB5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067A}, + {0xFB5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067A}, + {0xFB60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067A}, + {0xFB61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067A}, + {0xFB62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067F}, + {0xFB63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067F}, + {0xFB64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067F}, + {0xFB65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067F}, + {0xFB66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0679}, + {0xFB67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0679}, + {0xFB68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0679}, + {0xFB69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0679}, + {0xFB6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A4}, + {0xFB6B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A4}, + {0xFB6C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A4}, + {0xFB6D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A4}, + {0xFB6E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A6}, + {0xFB6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A6}, + {0xFB70, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A6}, + {0xFB71, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A6}, + {0xFB72, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0684}, + {0xFB73, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0684}, + {0xFB74, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0684}, + {0xFB75, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0684}, + {0xFB76, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0683}, + {0xFB77, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0683}, + {0xFB78, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0683}, + {0xFB79, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0683}, + {0xFB7A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0686}, + {0xFB7B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0686}, + {0xFB7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0686}, + {0xFB7D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0686}, + {0xFB7E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0687}, + {0xFB7F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0687}, + {0xFB80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0687}, + {0xFB81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0687}, + {0xFB82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068D}, + {0xFB83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068D}, + {0xFB84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068C}, + {0xFB85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068C}, + {0xFB86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068E}, + {0xFB87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068E}, + {0xFB88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0688}, + {0xFB89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0688}, + {0xFB8A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0698}, + {0xFB8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0698}, + {0xFB8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0691}, + {0xFB8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0691}, + {0xFB8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A9}, + {0xFB8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A9}, + {0xFB90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A9}, + {0xFB91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A9}, + {0xFB92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AF}, + {0xFB93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AF}, + {0xFB94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AF}, + {0xFB95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AF}, + {0xFB96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B3}, + {0xFB97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B3}, + {0xFB98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B3}, + {0xFB99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B3}, + {0xFB9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B1}, + {0xFB9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B1}, + {0xFB9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B1}, + {0xFB9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B1}, + {0xFB9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BA}, + {0xFB9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BA}, + {0xFBA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BB}, + {0xFBA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BB}, + {0xFBA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BB}, + {0xFBA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BB}, + {0xFBA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C0}, + {0xFBA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C0}, + {0xFBA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C1}, + {0xFBA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C1}, + {0xFBA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C1}, + {0xFBA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C1}, + {0xFBAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BE}, + {0xFBAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BE}, + {0xFBAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BE}, + {0xFBAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BE}, + {0xFBAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D2}, + {0xFBAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D2}, + {0xFBB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D3}, + {0xFBB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D3}, + {0xFBD3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AD}, + {0xFBD4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AD}, + {0xFBD5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AD}, + {0xFBD6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AD}, + {0xFBD7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C7}, + {0xFBD8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C7}, + {0xFBD9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C6}, + {0xFBDA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C6}, + {0xFBDB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C8}, + {0xFBDC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C8}, + {0xFBDD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0677}, + {0xFBDE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CB}, + {0xFBDF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CB}, + {0xFBE0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C5}, + {0xFBE1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C5}, + {0xFBE2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C9}, + {0xFBE3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C9}, + {0xFBE4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D0}, + {0xFBE5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D0}, + {0xFBE6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D0}, + {0xFBE7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D0}, + {0xFBE8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0649}, + {0xFBE9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0649}, + {0xFBEA, 0, 2 | DECOMP_COMPAT, 3630}, + {0xFBEB, 0, 2 | DECOMP_COMPAT, 3632}, + {0xFBEC, 0, 2 | DECOMP_COMPAT, 3634}, + {0xFBED, 0, 2 | DECOMP_COMPAT, 3636}, + {0xFBEE, 0, 2 | DECOMP_COMPAT, 3638}, + {0xFBEF, 0, 2 | DECOMP_COMPAT, 3640}, + {0xFBF0, 0, 2 | DECOMP_COMPAT, 3642}, + {0xFBF1, 0, 2 | DECOMP_COMPAT, 3644}, + {0xFBF2, 0, 2 | DECOMP_COMPAT, 3646}, + {0xFBF3, 0, 2 | DECOMP_COMPAT, 3648}, + {0xFBF4, 0, 2 | DECOMP_COMPAT, 3650}, + {0xFBF5, 0, 2 | DECOMP_COMPAT, 3652}, + {0xFBF6, 0, 2 | DECOMP_COMPAT, 3654}, + {0xFBF7, 0, 2 | DECOMP_COMPAT, 3656}, + {0xFBF8, 0, 2 | DECOMP_COMPAT, 3658}, + {0xFBF9, 0, 2 | DECOMP_COMPAT, 3660}, + {0xFBFA, 0, 2 | DECOMP_COMPAT, 3662}, + {0xFBFB, 0, 2 | DECOMP_COMPAT, 3664}, + {0xFBFC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CC}, + {0xFBFD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CC}, + {0xFBFE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CC}, + {0xFBFF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CC}, + {0xFC00, 0, 2 | DECOMP_COMPAT, 3666}, + {0xFC01, 0, 2 | DECOMP_COMPAT, 3668}, + {0xFC02, 0, 2 | DECOMP_COMPAT, 3670}, + {0xFC03, 0, 2 | DECOMP_COMPAT, 3672}, + {0xFC04, 0, 2 | DECOMP_COMPAT, 3674}, + {0xFC05, 0, 2 | DECOMP_COMPAT, 3676}, + {0xFC06, 0, 2 | DECOMP_COMPAT, 3678}, + {0xFC07, 0, 2 | DECOMP_COMPAT, 3680}, + {0xFC08, 0, 2 | DECOMP_COMPAT, 3682}, + {0xFC09, 0, 2 | DECOMP_COMPAT, 3684}, + {0xFC0A, 0, 2 | DECOMP_COMPAT, 3686}, + {0xFC0B, 0, 2 | DECOMP_COMPAT, 3688}, + {0xFC0C, 0, 2 | DECOMP_COMPAT, 3690}, + {0xFC0D, 0, 2 | DECOMP_COMPAT, 3692}, + {0xFC0E, 0, 2 | DECOMP_COMPAT, 3694}, + {0xFC0F, 0, 2 | DECOMP_COMPAT, 3696}, + {0xFC10, 0, 2 | DECOMP_COMPAT, 3698}, + {0xFC11, 0, 2 | DECOMP_COMPAT, 3700}, + {0xFC12, 0, 2 | DECOMP_COMPAT, 3702}, + {0xFC13, 0, 2 | DECOMP_COMPAT, 3704}, + {0xFC14, 0, 2 | DECOMP_COMPAT, 3706}, + {0xFC15, 0, 2 | DECOMP_COMPAT, 3708}, + {0xFC16, 0, 2 | DECOMP_COMPAT, 3710}, + {0xFC17, 0, 2 | DECOMP_COMPAT, 3712}, + {0xFC18, 0, 2 | DECOMP_COMPAT, 3714}, + {0xFC19, 0, 2 | DECOMP_COMPAT, 3716}, + {0xFC1A, 0, 2 | DECOMP_COMPAT, 3718}, + {0xFC1B, 0, 2 | DECOMP_COMPAT, 3720}, + {0xFC1C, 0, 2 | DECOMP_COMPAT, 3722}, + {0xFC1D, 0, 2 | DECOMP_COMPAT, 3724}, + {0xFC1E, 0, 2 | DECOMP_COMPAT, 3726}, + {0xFC1F, 0, 2 | DECOMP_COMPAT, 3728}, + {0xFC20, 0, 2 | DECOMP_COMPAT, 3730}, + {0xFC21, 0, 2 | DECOMP_COMPAT, 3732}, + {0xFC22, 0, 2 | DECOMP_COMPAT, 3734}, + {0xFC23, 0, 2 | DECOMP_COMPAT, 3736}, + {0xFC24, 0, 2 | DECOMP_COMPAT, 3738}, + {0xFC25, 0, 2 | DECOMP_COMPAT, 3740}, + {0xFC26, 0, 2 | DECOMP_COMPAT, 3742}, + {0xFC27, 0, 2 | DECOMP_COMPAT, 3744}, + {0xFC28, 0, 2 | DECOMP_COMPAT, 3746}, + {0xFC29, 0, 2 | DECOMP_COMPAT, 3748}, + {0xFC2A, 0, 2 | DECOMP_COMPAT, 3750}, + {0xFC2B, 0, 2 | DECOMP_COMPAT, 3752}, + {0xFC2C, 0, 2 | DECOMP_COMPAT, 3754}, + {0xFC2D, 0, 2 | DECOMP_COMPAT, 3756}, + {0xFC2E, 0, 2 | DECOMP_COMPAT, 3758}, + {0xFC2F, 0, 2 | DECOMP_COMPAT, 3760}, + {0xFC30, 0, 2 | DECOMP_COMPAT, 3762}, + {0xFC31, 0, 2 | DECOMP_COMPAT, 3764}, + {0xFC32, 0, 2 | DECOMP_COMPAT, 3766}, + {0xFC33, 0, 2 | DECOMP_COMPAT, 3768}, + {0xFC34, 0, 2 | DECOMP_COMPAT, 3770}, + {0xFC35, 0, 2 | DECOMP_COMPAT, 3772}, + {0xFC36, 0, 2 | DECOMP_COMPAT, 3774}, + {0xFC37, 0, 2 | DECOMP_COMPAT, 3776}, + {0xFC38, 0, 2 | DECOMP_COMPAT, 3778}, + {0xFC39, 0, 2 | DECOMP_COMPAT, 3780}, + {0xFC3A, 0, 2 | DECOMP_COMPAT, 3782}, + {0xFC3B, 0, 2 | DECOMP_COMPAT, 3784}, + {0xFC3C, 0, 2 | DECOMP_COMPAT, 3786}, + {0xFC3D, 0, 2 | DECOMP_COMPAT, 3788}, + {0xFC3E, 0, 2 | DECOMP_COMPAT, 3790}, + {0xFC3F, 0, 2 | DECOMP_COMPAT, 3792}, + {0xFC40, 0, 2 | DECOMP_COMPAT, 3794}, + {0xFC41, 0, 2 | DECOMP_COMPAT, 3796}, + {0xFC42, 0, 2 | DECOMP_COMPAT, 3798}, + {0xFC43, 0, 2 | DECOMP_COMPAT, 3800}, + {0xFC44, 0, 2 | DECOMP_COMPAT, 3802}, + {0xFC45, 0, 2 | DECOMP_COMPAT, 3804}, + {0xFC46, 0, 2 | DECOMP_COMPAT, 3806}, + {0xFC47, 0, 2 | DECOMP_COMPAT, 3808}, + {0xFC48, 0, 2 | DECOMP_COMPAT, 3810}, + {0xFC49, 0, 2 | DECOMP_COMPAT, 3812}, + {0xFC4A, 0, 2 | DECOMP_COMPAT, 3814}, + {0xFC4B, 0, 2 | DECOMP_COMPAT, 3816}, + {0xFC4C, 0, 2 | DECOMP_COMPAT, 3818}, + {0xFC4D, 0, 2 | DECOMP_COMPAT, 3820}, + {0xFC4E, 0, 2 | DECOMP_COMPAT, 3822}, + {0xFC4F, 0, 2 | DECOMP_COMPAT, 3824}, + {0xFC50, 0, 2 | DECOMP_COMPAT, 3826}, + {0xFC51, 0, 2 | DECOMP_COMPAT, 3828}, + {0xFC52, 0, 2 | DECOMP_COMPAT, 3830}, + {0xFC53, 0, 2 | DECOMP_COMPAT, 3832}, + {0xFC54, 0, 2 | DECOMP_COMPAT, 3834}, + {0xFC55, 0, 2 | DECOMP_COMPAT, 3836}, + {0xFC56, 0, 2 | DECOMP_COMPAT, 3838}, + {0xFC57, 0, 2 | DECOMP_COMPAT, 3840}, + {0xFC58, 0, 2 | DECOMP_COMPAT, 3842}, + {0xFC59, 0, 2 | DECOMP_COMPAT, 3844}, + {0xFC5A, 0, 2 | DECOMP_COMPAT, 3846}, + {0xFC5B, 0, 2 | DECOMP_COMPAT, 3848}, + {0xFC5C, 0, 2 | DECOMP_COMPAT, 3850}, + {0xFC5D, 0, 2 | DECOMP_COMPAT, 3852}, + {0xFC5E, 0, 3 | DECOMP_COMPAT, 3854}, + {0xFC5F, 0, 3 | DECOMP_COMPAT, 3857}, + {0xFC60, 0, 3 | DECOMP_COMPAT, 3860}, + {0xFC61, 0, 3 | DECOMP_COMPAT, 3863}, + {0xFC62, 0, 3 | DECOMP_COMPAT, 3866}, + {0xFC63, 0, 3 | DECOMP_COMPAT, 3869}, + {0xFC64, 0, 2 | DECOMP_COMPAT, 3872}, + {0xFC65, 0, 2 | DECOMP_COMPAT, 3874}, + {0xFC66, 0, 2 | DECOMP_COMPAT, 3876}, + {0xFC67, 0, 2 | DECOMP_COMPAT, 3878}, + {0xFC68, 0, 2 | DECOMP_COMPAT, 3880}, + {0xFC69, 0, 2 | DECOMP_COMPAT, 3882}, + {0xFC6A, 0, 2 | DECOMP_COMPAT, 3884}, + {0xFC6B, 0, 2 | DECOMP_COMPAT, 3886}, + {0xFC6C, 0, 2 | DECOMP_COMPAT, 3888}, + {0xFC6D, 0, 2 | DECOMP_COMPAT, 3890}, + {0xFC6E, 0, 2 | DECOMP_COMPAT, 3892}, + {0xFC6F, 0, 2 | DECOMP_COMPAT, 3894}, + {0xFC70, 0, 2 | DECOMP_COMPAT, 3896}, + {0xFC71, 0, 2 | DECOMP_COMPAT, 3898}, + {0xFC72, 0, 2 | DECOMP_COMPAT, 3900}, + {0xFC73, 0, 2 | DECOMP_COMPAT, 3902}, + {0xFC74, 0, 2 | DECOMP_COMPAT, 3904}, + {0xFC75, 0, 2 | DECOMP_COMPAT, 3906}, + {0xFC76, 0, 2 | DECOMP_COMPAT, 3908}, + {0xFC77, 0, 2 | DECOMP_COMPAT, 3910}, + {0xFC78, 0, 2 | DECOMP_COMPAT, 3912}, + {0xFC79, 0, 2 | DECOMP_COMPAT, 3914}, + {0xFC7A, 0, 2 | DECOMP_COMPAT, 3916}, + {0xFC7B, 0, 2 | DECOMP_COMPAT, 3918}, + {0xFC7C, 0, 2 | DECOMP_COMPAT, 3920}, + {0xFC7D, 0, 2 | DECOMP_COMPAT, 3922}, + {0xFC7E, 0, 2 | DECOMP_COMPAT, 3924}, + {0xFC7F, 0, 2 | DECOMP_COMPAT, 3926}, + {0xFC80, 0, 2 | DECOMP_COMPAT, 3928}, + {0xFC81, 0, 2 | DECOMP_COMPAT, 3930}, + {0xFC82, 0, 2 | DECOMP_COMPAT, 3932}, + {0xFC83, 0, 2 | DECOMP_COMPAT, 3934}, + {0xFC84, 0, 2 | DECOMP_COMPAT, 3936}, + {0xFC85, 0, 2 | DECOMP_COMPAT, 3938}, + {0xFC86, 0, 2 | DECOMP_COMPAT, 3940}, + {0xFC87, 0, 2 | DECOMP_COMPAT, 3942}, + {0xFC88, 0, 2 | DECOMP_COMPAT, 3944}, + {0xFC89, 0, 2 | DECOMP_COMPAT, 3946}, + {0xFC8A, 0, 2 | DECOMP_COMPAT, 3948}, + {0xFC8B, 0, 2 | DECOMP_COMPAT, 3950}, + {0xFC8C, 0, 2 | DECOMP_COMPAT, 3952}, + {0xFC8D, 0, 2 | DECOMP_COMPAT, 3954}, + {0xFC8E, 0, 2 | DECOMP_COMPAT, 3956}, + {0xFC8F, 0, 2 | DECOMP_COMPAT, 3958}, + {0xFC90, 0, 2 | DECOMP_COMPAT, 3960}, + {0xFC91, 0, 2 | DECOMP_COMPAT, 3962}, + {0xFC92, 0, 2 | DECOMP_COMPAT, 3964}, + {0xFC93, 0, 2 | DECOMP_COMPAT, 3966}, + {0xFC94, 0, 2 | DECOMP_COMPAT, 3968}, + {0xFC95, 0, 2 | DECOMP_COMPAT, 3970}, + {0xFC96, 0, 2 | DECOMP_COMPAT, 3972}, + {0xFC97, 0, 2 | DECOMP_COMPAT, 3974}, + {0xFC98, 0, 2 | DECOMP_COMPAT, 3976}, + {0xFC99, 0, 2 | DECOMP_COMPAT, 3978}, + {0xFC9A, 0, 2 | DECOMP_COMPAT, 3980}, + {0xFC9B, 0, 2 | DECOMP_COMPAT, 3982}, + {0xFC9C, 0, 2 | DECOMP_COMPAT, 3984}, + {0xFC9D, 0, 2 | DECOMP_COMPAT, 3986}, + {0xFC9E, 0, 2 | DECOMP_COMPAT, 3988}, + {0xFC9F, 0, 2 | DECOMP_COMPAT, 3990}, + {0xFCA0, 0, 2 | DECOMP_COMPAT, 3992}, + {0xFCA1, 0, 2 | DECOMP_COMPAT, 3994}, + {0xFCA2, 0, 2 | DECOMP_COMPAT, 3996}, + {0xFCA3, 0, 2 | DECOMP_COMPAT, 3998}, + {0xFCA4, 0, 2 | DECOMP_COMPAT, 4000}, + {0xFCA5, 0, 2 | DECOMP_COMPAT, 4002}, + {0xFCA6, 0, 2 | DECOMP_COMPAT, 4004}, + {0xFCA7, 0, 2 | DECOMP_COMPAT, 4006}, + {0xFCA8, 0, 2 | DECOMP_COMPAT, 4008}, + {0xFCA9, 0, 2 | DECOMP_COMPAT, 4010}, + {0xFCAA, 0, 2 | DECOMP_COMPAT, 4012}, + {0xFCAB, 0, 2 | DECOMP_COMPAT, 4014}, + {0xFCAC, 0, 2 | DECOMP_COMPAT, 4016}, + {0xFCAD, 0, 2 | DECOMP_COMPAT, 4018}, + {0xFCAE, 0, 2 | DECOMP_COMPAT, 4020}, + {0xFCAF, 0, 2 | DECOMP_COMPAT, 4022}, + {0xFCB0, 0, 2 | DECOMP_COMPAT, 4024}, + {0xFCB1, 0, 2 | DECOMP_COMPAT, 4026}, + {0xFCB2, 0, 2 | DECOMP_COMPAT, 4028}, + {0xFCB3, 0, 2 | DECOMP_COMPAT, 4030}, + {0xFCB4, 0, 2 | DECOMP_COMPAT, 4032}, + {0xFCB5, 0, 2 | DECOMP_COMPAT, 4034}, + {0xFCB6, 0, 2 | DECOMP_COMPAT, 4036}, + {0xFCB7, 0, 2 | DECOMP_COMPAT, 4038}, + {0xFCB8, 0, 2 | DECOMP_COMPAT, 4040}, + {0xFCB9, 0, 2 | DECOMP_COMPAT, 4042}, + {0xFCBA, 0, 2 | DECOMP_COMPAT, 4044}, + {0xFCBB, 0, 2 | DECOMP_COMPAT, 4046}, + {0xFCBC, 0, 2 | DECOMP_COMPAT, 4048}, + {0xFCBD, 0, 2 | DECOMP_COMPAT, 4050}, + {0xFCBE, 0, 2 | DECOMP_COMPAT, 4052}, + {0xFCBF, 0, 2 | DECOMP_COMPAT, 4054}, + {0xFCC0, 0, 2 | DECOMP_COMPAT, 4056}, + {0xFCC1, 0, 2 | DECOMP_COMPAT, 4058}, + {0xFCC2, 0, 2 | DECOMP_COMPAT, 4060}, + {0xFCC3, 0, 2 | DECOMP_COMPAT, 4062}, + {0xFCC4, 0, 2 | DECOMP_COMPAT, 4064}, + {0xFCC5, 0, 2 | DECOMP_COMPAT, 4066}, + {0xFCC6, 0, 2 | DECOMP_COMPAT, 4068}, + {0xFCC7, 0, 2 | DECOMP_COMPAT, 4070}, + {0xFCC8, 0, 2 | DECOMP_COMPAT, 4072}, + {0xFCC9, 0, 2 | DECOMP_COMPAT, 4074}, + {0xFCCA, 0, 2 | DECOMP_COMPAT, 4076}, + {0xFCCB, 0, 2 | DECOMP_COMPAT, 4078}, + {0xFCCC, 0, 2 | DECOMP_COMPAT, 4080}, + {0xFCCD, 0, 2 | DECOMP_COMPAT, 4082}, + {0xFCCE, 0, 2 | DECOMP_COMPAT, 4084}, + {0xFCCF, 0, 2 | DECOMP_COMPAT, 4086}, + {0xFCD0, 0, 2 | DECOMP_COMPAT, 4088}, + {0xFCD1, 0, 2 | DECOMP_COMPAT, 4090}, + {0xFCD2, 0, 2 | DECOMP_COMPAT, 4092}, + {0xFCD3, 0, 2 | DECOMP_COMPAT, 4094}, + {0xFCD4, 0, 2 | DECOMP_COMPAT, 4096}, + {0xFCD5, 0, 2 | DECOMP_COMPAT, 4098}, + {0xFCD6, 0, 2 | DECOMP_COMPAT, 4100}, + {0xFCD7, 0, 2 | DECOMP_COMPAT, 4102}, + {0xFCD8, 0, 2 | DECOMP_COMPAT, 4104}, + {0xFCD9, 0, 2 | DECOMP_COMPAT, 4106}, + {0xFCDA, 0, 2 | DECOMP_COMPAT, 4108}, + {0xFCDB, 0, 2 | DECOMP_COMPAT, 4110}, + {0xFCDC, 0, 2 | DECOMP_COMPAT, 4112}, + {0xFCDD, 0, 2 | DECOMP_COMPAT, 4114}, + {0xFCDE, 0, 2 | DECOMP_COMPAT, 4116}, + {0xFCDF, 0, 2 | DECOMP_COMPAT, 4118}, + {0xFCE0, 0, 2 | DECOMP_COMPAT, 4120}, + {0xFCE1, 0, 2 | DECOMP_COMPAT, 4122}, + {0xFCE2, 0, 2 | DECOMP_COMPAT, 4124}, + {0xFCE3, 0, 2 | DECOMP_COMPAT, 4126}, + {0xFCE4, 0, 2 | DECOMP_COMPAT, 4128}, + {0xFCE5, 0, 2 | DECOMP_COMPAT, 4130}, + {0xFCE6, 0, 2 | DECOMP_COMPAT, 4132}, + {0xFCE7, 0, 2 | DECOMP_COMPAT, 4134}, + {0xFCE8, 0, 2 | DECOMP_COMPAT, 4136}, + {0xFCE9, 0, 2 | DECOMP_COMPAT, 4138}, + {0xFCEA, 0, 2 | DECOMP_COMPAT, 4140}, + {0xFCEB, 0, 2 | DECOMP_COMPAT, 4142}, + {0xFCEC, 0, 2 | DECOMP_COMPAT, 4144}, + {0xFCED, 0, 2 | DECOMP_COMPAT, 4146}, + {0xFCEE, 0, 2 | DECOMP_COMPAT, 4148}, + {0xFCEF, 0, 2 | DECOMP_COMPAT, 4150}, + {0xFCF0, 0, 2 | DECOMP_COMPAT, 4152}, + {0xFCF1, 0, 2 | DECOMP_COMPAT, 4154}, + {0xFCF2, 0, 3 | DECOMP_COMPAT, 4156}, + {0xFCF3, 0, 3 | DECOMP_COMPAT, 4159}, + {0xFCF4, 0, 3 | DECOMP_COMPAT, 4162}, + {0xFCF5, 0, 2 | DECOMP_COMPAT, 4165}, + {0xFCF6, 0, 2 | DECOMP_COMPAT, 4167}, + {0xFCF7, 0, 2 | DECOMP_COMPAT, 4169}, + {0xFCF8, 0, 2 | DECOMP_COMPAT, 4171}, + {0xFCF9, 0, 2 | DECOMP_COMPAT, 4173}, + {0xFCFA, 0, 2 | DECOMP_COMPAT, 4175}, + {0xFCFB, 0, 2 | DECOMP_COMPAT, 4177}, + {0xFCFC, 0, 2 | DECOMP_COMPAT, 4179}, + {0xFCFD, 0, 2 | DECOMP_COMPAT, 4181}, + {0xFCFE, 0, 2 | DECOMP_COMPAT, 4183}, + {0xFCFF, 0, 2 | DECOMP_COMPAT, 4185}, + {0xFD00, 0, 2 | DECOMP_COMPAT, 4187}, + {0xFD01, 0, 2 | DECOMP_COMPAT, 4189}, + {0xFD02, 0, 2 | DECOMP_COMPAT, 4191}, + {0xFD03, 0, 2 | DECOMP_COMPAT, 4193}, + {0xFD04, 0, 2 | DECOMP_COMPAT, 4195}, + {0xFD05, 0, 2 | DECOMP_COMPAT, 4197}, + {0xFD06, 0, 2 | DECOMP_COMPAT, 4199}, + {0xFD07, 0, 2 | DECOMP_COMPAT, 4201}, + {0xFD08, 0, 2 | DECOMP_COMPAT, 4203}, + {0xFD09, 0, 2 | DECOMP_COMPAT, 4205}, + {0xFD0A, 0, 2 | DECOMP_COMPAT, 4207}, + {0xFD0B, 0, 2 | DECOMP_COMPAT, 4209}, + {0xFD0C, 0, 2 | DECOMP_COMPAT, 4211}, + {0xFD0D, 0, 2 | DECOMP_COMPAT, 4213}, + {0xFD0E, 0, 2 | DECOMP_COMPAT, 4215}, + {0xFD0F, 0, 2 | DECOMP_COMPAT, 4217}, + {0xFD10, 0, 2 | DECOMP_COMPAT, 4219}, + {0xFD11, 0, 2 | DECOMP_COMPAT, 4221}, + {0xFD12, 0, 2 | DECOMP_COMPAT, 4223}, + {0xFD13, 0, 2 | DECOMP_COMPAT, 4225}, + {0xFD14, 0, 2 | DECOMP_COMPAT, 4227}, + {0xFD15, 0, 2 | DECOMP_COMPAT, 4229}, + {0xFD16, 0, 2 | DECOMP_COMPAT, 4231}, + {0xFD17, 0, 2 | DECOMP_COMPAT, 4233}, + {0xFD18, 0, 2 | DECOMP_COMPAT, 4235}, + {0xFD19, 0, 2 | DECOMP_COMPAT, 4237}, + {0xFD1A, 0, 2 | DECOMP_COMPAT, 4239}, + {0xFD1B, 0, 2 | DECOMP_COMPAT, 4241}, + {0xFD1C, 0, 2 | DECOMP_COMPAT, 4243}, + {0xFD1D, 0, 2 | DECOMP_COMPAT, 4245}, + {0xFD1E, 0, 2 | DECOMP_COMPAT, 4247}, + {0xFD1F, 0, 2 | DECOMP_COMPAT, 4249}, + {0xFD20, 0, 2 | DECOMP_COMPAT, 4251}, + {0xFD21, 0, 2 | DECOMP_COMPAT, 4253}, + {0xFD22, 0, 2 | DECOMP_COMPAT, 4255}, + {0xFD23, 0, 2 | DECOMP_COMPAT, 4257}, + {0xFD24, 0, 2 | DECOMP_COMPAT, 4259}, + {0xFD25, 0, 2 | DECOMP_COMPAT, 4261}, + {0xFD26, 0, 2 | DECOMP_COMPAT, 4263}, + {0xFD27, 0, 2 | DECOMP_COMPAT, 4265}, + {0xFD28, 0, 2 | DECOMP_COMPAT, 4267}, + {0xFD29, 0, 2 | DECOMP_COMPAT, 4269}, + {0xFD2A, 0, 2 | DECOMP_COMPAT, 4271}, + {0xFD2B, 0, 2 | DECOMP_COMPAT, 4273}, + {0xFD2C, 0, 2 | DECOMP_COMPAT, 4275}, + {0xFD2D, 0, 2 | DECOMP_COMPAT, 4277}, + {0xFD2E, 0, 2 | DECOMP_COMPAT, 4279}, + {0xFD2F, 0, 2 | DECOMP_COMPAT, 4281}, + {0xFD30, 0, 2 | DECOMP_COMPAT, 4283}, + {0xFD31, 0, 2 | DECOMP_COMPAT, 4285}, + {0xFD32, 0, 2 | DECOMP_COMPAT, 4287}, + {0xFD33, 0, 2 | DECOMP_COMPAT, 4289}, + {0xFD34, 0, 2 | DECOMP_COMPAT, 4291}, + {0xFD35, 0, 2 | DECOMP_COMPAT, 4293}, + {0xFD36, 0, 2 | DECOMP_COMPAT, 4295}, + {0xFD37, 0, 2 | DECOMP_COMPAT, 4297}, + {0xFD38, 0, 2 | DECOMP_COMPAT, 4299}, + {0xFD39, 0, 2 | DECOMP_COMPAT, 4301}, + {0xFD3A, 0, 2 | DECOMP_COMPAT, 4303}, + {0xFD3B, 0, 2 | DECOMP_COMPAT, 4305}, + {0xFD3C, 0, 2 | DECOMP_COMPAT, 4307}, + {0xFD3D, 0, 2 | DECOMP_COMPAT, 4309}, + {0xFD50, 0, 3 | DECOMP_COMPAT, 4311}, + {0xFD51, 0, 3 | DECOMP_COMPAT, 4314}, + {0xFD52, 0, 3 | DECOMP_COMPAT, 4317}, + {0xFD53, 0, 3 | DECOMP_COMPAT, 4320}, + {0xFD54, 0, 3 | DECOMP_COMPAT, 4323}, + {0xFD55, 0, 3 | DECOMP_COMPAT, 4326}, + {0xFD56, 0, 3 | DECOMP_COMPAT, 4329}, + {0xFD57, 0, 3 | DECOMP_COMPAT, 4332}, + {0xFD58, 0, 3 | DECOMP_COMPAT, 4335}, + {0xFD59, 0, 3 | DECOMP_COMPAT, 4338}, + {0xFD5A, 0, 3 | DECOMP_COMPAT, 4341}, + {0xFD5B, 0, 3 | DECOMP_COMPAT, 4344}, + {0xFD5C, 0, 3 | DECOMP_COMPAT, 4347}, + {0xFD5D, 0, 3 | DECOMP_COMPAT, 4350}, + {0xFD5E, 0, 3 | DECOMP_COMPAT, 4353}, + {0xFD5F, 0, 3 | DECOMP_COMPAT, 4356}, + {0xFD60, 0, 3 | DECOMP_COMPAT, 4359}, + {0xFD61, 0, 3 | DECOMP_COMPAT, 4362}, + {0xFD62, 0, 3 | DECOMP_COMPAT, 4365}, + {0xFD63, 0, 3 | DECOMP_COMPAT, 4368}, + {0xFD64, 0, 3 | DECOMP_COMPAT, 4371}, + {0xFD65, 0, 3 | DECOMP_COMPAT, 4374}, + {0xFD66, 0, 3 | DECOMP_COMPAT, 4377}, + {0xFD67, 0, 3 | DECOMP_COMPAT, 4380}, + {0xFD68, 0, 3 | DECOMP_COMPAT, 4383}, + {0xFD69, 0, 3 | DECOMP_COMPAT, 4386}, + {0xFD6A, 0, 3 | DECOMP_COMPAT, 4389}, + {0xFD6B, 0, 3 | DECOMP_COMPAT, 4392}, + {0xFD6C, 0, 3 | DECOMP_COMPAT, 4395}, + {0xFD6D, 0, 3 | DECOMP_COMPAT, 4398}, + {0xFD6E, 0, 3 | DECOMP_COMPAT, 4401}, + {0xFD6F, 0, 3 | DECOMP_COMPAT, 4404}, + {0xFD70, 0, 3 | DECOMP_COMPAT, 4407}, + {0xFD71, 0, 3 | DECOMP_COMPAT, 4410}, + {0xFD72, 0, 3 | DECOMP_COMPAT, 4413}, + {0xFD73, 0, 3 | DECOMP_COMPAT, 4416}, + {0xFD74, 0, 3 | DECOMP_COMPAT, 4419}, + {0xFD75, 0, 3 | DECOMP_COMPAT, 4422}, + {0xFD76, 0, 3 | DECOMP_COMPAT, 4425}, + {0xFD77, 0, 3 | DECOMP_COMPAT, 4428}, + {0xFD78, 0, 3 | DECOMP_COMPAT, 4431}, + {0xFD79, 0, 3 | DECOMP_COMPAT, 4434}, + {0xFD7A, 0, 3 | DECOMP_COMPAT, 4437}, + {0xFD7B, 0, 3 | DECOMP_COMPAT, 4440}, + {0xFD7C, 0, 3 | DECOMP_COMPAT, 4443}, + {0xFD7D, 0, 3 | DECOMP_COMPAT, 4446}, + {0xFD7E, 0, 3 | DECOMP_COMPAT, 4449}, + {0xFD7F, 0, 3 | DECOMP_COMPAT, 4452}, + {0xFD80, 0, 3 | DECOMP_COMPAT, 4455}, + {0xFD81, 0, 3 | DECOMP_COMPAT, 4458}, + {0xFD82, 0, 3 | DECOMP_COMPAT, 4461}, + {0xFD83, 0, 3 | DECOMP_COMPAT, 4464}, + {0xFD84, 0, 3 | DECOMP_COMPAT, 4467}, + {0xFD85, 0, 3 | DECOMP_COMPAT, 4470}, + {0xFD86, 0, 3 | DECOMP_COMPAT, 4473}, + {0xFD87, 0, 3 | DECOMP_COMPAT, 4476}, + {0xFD88, 0, 3 | DECOMP_COMPAT, 4479}, + {0xFD89, 0, 3 | DECOMP_COMPAT, 4482}, + {0xFD8A, 0, 3 | DECOMP_COMPAT, 4485}, + {0xFD8B, 0, 3 | DECOMP_COMPAT, 4488}, + {0xFD8C, 0, 3 | DECOMP_COMPAT, 4491}, + {0xFD8D, 0, 3 | DECOMP_COMPAT, 4494}, + {0xFD8E, 0, 3 | DECOMP_COMPAT, 4497}, + {0xFD8F, 0, 3 | DECOMP_COMPAT, 4500}, + {0xFD92, 0, 3 | DECOMP_COMPAT, 4503}, + {0xFD93, 0, 3 | DECOMP_COMPAT, 4506}, + {0xFD94, 0, 3 | DECOMP_COMPAT, 4509}, + {0xFD95, 0, 3 | DECOMP_COMPAT, 4512}, + {0xFD96, 0, 3 | DECOMP_COMPAT, 4515}, + {0xFD97, 0, 3 | DECOMP_COMPAT, 4518}, + {0xFD98, 0, 3 | DECOMP_COMPAT, 4521}, + {0xFD99, 0, 3 | DECOMP_COMPAT, 4524}, + {0xFD9A, 0, 3 | DECOMP_COMPAT, 4527}, + {0xFD9B, 0, 3 | DECOMP_COMPAT, 4530}, + {0xFD9C, 0, 3 | DECOMP_COMPAT, 4533}, + {0xFD9D, 0, 3 | DECOMP_COMPAT, 4536}, + {0xFD9E, 0, 3 | DECOMP_COMPAT, 4539}, + {0xFD9F, 0, 3 | DECOMP_COMPAT, 4542}, + {0xFDA0, 0, 3 | DECOMP_COMPAT, 4545}, + {0xFDA1, 0, 3 | DECOMP_COMPAT, 4548}, + {0xFDA2, 0, 3 | DECOMP_COMPAT, 4551}, + {0xFDA3, 0, 3 | DECOMP_COMPAT, 4554}, + {0xFDA4, 0, 3 | DECOMP_COMPAT, 4557}, + {0xFDA5, 0, 3 | DECOMP_COMPAT, 4560}, + {0xFDA6, 0, 3 | DECOMP_COMPAT, 4563}, + {0xFDA7, 0, 3 | DECOMP_COMPAT, 4566}, + {0xFDA8, 0, 3 | DECOMP_COMPAT, 4569}, + {0xFDA9, 0, 3 | DECOMP_COMPAT, 4572}, + {0xFDAA, 0, 3 | DECOMP_COMPAT, 4575}, + {0xFDAB, 0, 3 | DECOMP_COMPAT, 4578}, + {0xFDAC, 0, 3 | DECOMP_COMPAT, 4581}, + {0xFDAD, 0, 3 | DECOMP_COMPAT, 4584}, + {0xFDAE, 0, 3 | DECOMP_COMPAT, 4587}, + {0xFDAF, 0, 3 | DECOMP_COMPAT, 4590}, + {0xFDB0, 0, 3 | DECOMP_COMPAT, 4593}, + {0xFDB1, 0, 3 | DECOMP_COMPAT, 4596}, + {0xFDB2, 0, 3 | DECOMP_COMPAT, 4599}, + {0xFDB3, 0, 3 | DECOMP_COMPAT, 4602}, + {0xFDB4, 0, 3 | DECOMP_COMPAT, 4605}, + {0xFDB5, 0, 3 | DECOMP_COMPAT, 4608}, + {0xFDB6, 0, 3 | DECOMP_COMPAT, 4611}, + {0xFDB7, 0, 3 | DECOMP_COMPAT, 4614}, + {0xFDB8, 0, 3 | DECOMP_COMPAT, 4617}, + {0xFDB9, 0, 3 | DECOMP_COMPAT, 4620}, + {0xFDBA, 0, 3 | DECOMP_COMPAT, 4623}, + {0xFDBB, 0, 3 | DECOMP_COMPAT, 4626}, + {0xFDBC, 0, 3 | DECOMP_COMPAT, 4629}, + {0xFDBD, 0, 3 | DECOMP_COMPAT, 4632}, + {0xFDBE, 0, 3 | DECOMP_COMPAT, 4635}, + {0xFDBF, 0, 3 | DECOMP_COMPAT, 4638}, + {0xFDC0, 0, 3 | DECOMP_COMPAT, 4641}, + {0xFDC1, 0, 3 | DECOMP_COMPAT, 4644}, + {0xFDC2, 0, 3 | DECOMP_COMPAT, 4647}, + {0xFDC3, 0, 3 | DECOMP_COMPAT, 4650}, + {0xFDC4, 0, 3 | DECOMP_COMPAT, 4653}, + {0xFDC5, 0, 3 | DECOMP_COMPAT, 4656}, + {0xFDC6, 0, 3 | DECOMP_COMPAT, 4659}, + {0xFDC7, 0, 3 | DECOMP_COMPAT, 4662}, + {0xFDF0, 0, 3 | DECOMP_COMPAT, 4665}, + {0xFDF1, 0, 3 | DECOMP_COMPAT, 4668}, + {0xFDF2, 0, 4 | DECOMP_COMPAT, 4671}, + {0xFDF3, 0, 4 | DECOMP_COMPAT, 4675}, + {0xFDF4, 0, 4 | DECOMP_COMPAT, 4679}, + {0xFDF5, 0, 4 | DECOMP_COMPAT, 4683}, + {0xFDF6, 0, 4 | DECOMP_COMPAT, 4687}, + {0xFDF7, 0, 4 | DECOMP_COMPAT, 4691}, + {0xFDF8, 0, 4 | DECOMP_COMPAT, 4695}, + {0xFDF9, 0, 3 | DECOMP_COMPAT, 4699}, + {0xFDFA, 0, 18 | DECOMP_COMPAT, 4702}, + {0xFDFB, 0, 8 | DECOMP_COMPAT, 4720}, + {0xFDFC, 0, 4 | DECOMP_COMPAT, 4728}, + {0xFE10, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002C}, + {0xFE11, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3001}, + {0xFE12, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3002}, + {0xFE13, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003A}, + {0xFE14, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003B}, + {0xFE15, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0021}, + {0xFE16, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003F}, + {0xFE17, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3016}, + {0xFE18, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3017}, + {0xFE19, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2026}, + {0xFE20, 230, 0, 0}, + {0xFE21, 230, 0, 0}, + {0xFE22, 230, 0, 0}, + {0xFE23, 230, 0, 0}, + {0xFE24, 230, 0, 0}, + {0xFE25, 230, 0, 0}, + {0xFE26, 230, 0, 0}, + {0xFE27, 220, 0, 0}, + {0xFE28, 220, 0, 0}, + {0xFE29, 220, 0, 0}, + {0xFE2A, 220, 0, 0}, + {0xFE2B, 220, 0, 0}, + {0xFE2C, 220, 0, 0}, + {0xFE2D, 220, 0, 0}, + {0xFE2E, 230, 0, 0}, + {0xFE2F, 230, 0, 0}, + {0xFE30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2025}, + {0xFE31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2014}, + {0xFE32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2013}, + {0xFE33, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0xFE36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0xFE37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007B}, + {0xFE38, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007D}, + {0xFE39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3014}, + {0xFE3A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3015}, + {0xFE3B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3010}, + {0xFE3C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3011}, + {0xFE3D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300A}, + {0xFE3E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300B}, + {0xFE3F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3008}, + {0xFE40, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3009}, + {0xFE41, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300C}, + {0xFE42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300D}, + {0xFE43, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300E}, + {0xFE44, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300F}, + {0xFE47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005B}, + {0xFE48, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005D}, + {0xFE49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x203E}, + {0xFE4A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x203E}, + {0xFE4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x203E}, + {0xFE4C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x203E}, + {0xFE4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE4E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002C}, + {0xFE51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3001}, + {0xFE52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002E}, + {0xFE54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003B}, + {0xFE55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003A}, + {0xFE56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003F}, + {0xFE57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0021}, + {0xFE58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2014}, + {0xFE59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0xFE5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0xFE5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007B}, + {0xFE5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007D}, + {0xFE5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3014}, + {0xFE5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3015}, + {0xFE5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0023}, + {0xFE60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0026}, + {0xFE61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002A}, + {0xFE62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0xFE63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002D}, + {0xFE64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003C}, + {0xFE65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003E}, + {0xFE66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003D}, + {0xFE68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005C}, + {0xFE69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0024}, + {0xFE6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0025}, + {0xFE6B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0040}, + {0xFE70, 0, 2 | DECOMP_COMPAT, 4732}, + {0xFE71, 0, 2 | DECOMP_COMPAT, 4734}, + {0xFE72, 0, 2 | DECOMP_COMPAT, 4736}, + {0xFE74, 0, 2 | DECOMP_COMPAT, 4738}, + {0xFE76, 0, 2 | DECOMP_COMPAT, 4740}, + {0xFE77, 0, 2 | DECOMP_COMPAT, 4742}, + {0xFE78, 0, 2 | DECOMP_COMPAT, 4744}, + {0xFE79, 0, 2 | DECOMP_COMPAT, 4746}, + {0xFE7A, 0, 2 | DECOMP_COMPAT, 4748}, + {0xFE7B, 0, 2 | DECOMP_COMPAT, 4750}, + {0xFE7C, 0, 2 | DECOMP_COMPAT, 4752}, + {0xFE7D, 0, 2 | DECOMP_COMPAT, 4754}, + {0xFE7E, 0, 2 | DECOMP_COMPAT, 4756}, + {0xFE7F, 0, 2 | DECOMP_COMPAT, 4758}, + {0xFE80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0621}, + {0xFE81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0622}, + {0xFE82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0622}, + {0xFE83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0623}, + {0xFE84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0623}, + {0xFE85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0624}, + {0xFE86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0624}, + {0xFE87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0625}, + {0xFE88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0625}, + {0xFE89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0626}, + {0xFE8A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0626}, + {0xFE8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0626}, + {0xFE8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0626}, + {0xFE8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0627}, + {0xFE8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0627}, + {0xFE8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0xFE90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0xFE91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0xFE92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0xFE93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0629}, + {0xFE94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0629}, + {0xFE95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0xFE96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0xFE97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0xFE98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0xFE99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0xFE9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0xFE9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0xFE9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0xFE9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0xFE9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0xFE9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0xFEA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0xFEA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0xFEA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0xFEA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0xFEA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0xFEA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0xFEA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0xFEA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0xFEA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0xFEA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0xFEAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0xFEAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0xFEAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0xFEAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0xFEAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0xFEAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0xFEB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0xFEB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0xFEB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0xFEB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0xFEB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0xFEB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0xFEB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0xFEB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0xFEB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0xFEB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0xFEBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0xFEBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0xFEBC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0xFEBD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0xFEBE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0xFEBF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0xFEC0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0xFEC1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0xFEC2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0xFEC3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0xFEC4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0xFEC5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0xFEC6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0xFEC7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0xFEC8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0xFEC9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0xFECA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0xFECB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0xFECC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0xFECD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0xFECE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0xFECF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0xFED0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0xFED1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0xFED2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0xFED3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0xFED4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0xFED5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0xFED6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0xFED7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0xFED8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0xFED9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0xFEDA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0xFEDB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0xFEDC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0xFEDD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0xFEDE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0xFEDF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0xFEE0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0xFEE1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0xFEE2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0xFEE3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0xFEE4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0xFEE5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0xFEE6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0xFEE7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0xFEE8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0xFEE9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0xFEEA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0xFEEB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0xFEEC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0xFEED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0xFEEE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0xFEEF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0649}, + {0xFEF0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0649}, + {0xFEF1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0xFEF2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0xFEF3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0xFEF4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0xFEF5, 0, 2 | DECOMP_COMPAT, 4760}, + {0xFEF6, 0, 2 | DECOMP_COMPAT, 4762}, + {0xFEF7, 0, 2 | DECOMP_COMPAT, 4764}, + {0xFEF8, 0, 2 | DECOMP_COMPAT, 4766}, + {0xFEF9, 0, 2 | DECOMP_COMPAT, 4768}, + {0xFEFA, 0, 2 | DECOMP_COMPAT, 4770}, + {0xFEFB, 0, 2 | DECOMP_COMPAT, 4772}, + {0xFEFC, 0, 2 | DECOMP_COMPAT, 4774}, + {0xFF01, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0021}, + {0xFF02, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0022}, + {0xFF03, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0023}, + {0xFF04, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0024}, + {0xFF05, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0025}, + {0xFF06, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0026}, + {0xFF07, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0027}, + {0xFF08, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0xFF09, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0xFF0A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002A}, + {0xFF0B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0xFF0C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002C}, + {0xFF0D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002D}, + {0xFF0E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002E}, + {0xFF0F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002F}, + {0xFF10, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0xFF11, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0xFF12, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0xFF13, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0xFF14, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0xFF15, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0xFF16, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0xFF17, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0xFF18, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0xFF19, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0xFF1A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003A}, + {0xFF1B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003B}, + {0xFF1C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003C}, + {0xFF1D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003D}, + {0xFF1E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003E}, + {0xFF1F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003F}, + {0xFF20, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0040}, + {0xFF21, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0xFF22, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0xFF23, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0xFF24, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0xFF25, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0xFF26, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0xFF27, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0xFF28, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0xFF29, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0xFF2A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0xFF2B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0xFF2C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0xFF2D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0xFF2E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0xFF2F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0xFF30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0xFF31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0xFF32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0xFF33, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0xFF34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0xFF35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0xFF36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0xFF37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0xFF38, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0xFF39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0xFF3A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0xFF3B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005B}, + {0xFF3C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005C}, + {0xFF3D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005D}, + {0xFF3E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005E}, + {0xFF3F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFF40, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0060}, + {0xFF41, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0xFF42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0xFF43, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0xFF44, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0xFF45, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0xFF46, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0xFF47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0xFF48, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0xFF49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0xFF4A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0xFF4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0xFF4C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0xFF4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0xFF4E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0xFF4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0xFF50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0xFF51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0xFF52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0xFF53, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0xFF54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0xFF55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0xFF56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0xFF57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0xFF58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0xFF59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0xFF5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0xFF5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007B}, + {0xFF5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007C}, + {0xFF5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007D}, + {0xFF5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007E}, + {0xFF5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2985}, + {0xFF60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2986}, + {0xFF61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3002}, + {0xFF62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300C}, + {0xFF63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300D}, + {0xFF64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3001}, + {0xFF65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30FB}, + {0xFF66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F2}, + {0xFF67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A1}, + {0xFF68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A3}, + {0xFF69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A5}, + {0xFF6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A7}, + {0xFF6B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A9}, + {0xFF6C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E3}, + {0xFF6D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E5}, + {0xFF6E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E7}, + {0xFF6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C3}, + {0xFF70, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30FC}, + {0xFF71, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A2}, + {0xFF72, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A4}, + {0xFF73, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A6}, + {0xFF74, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A8}, + {0xFF75, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AA}, + {0xFF76, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AB}, + {0xFF77, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AD}, + {0xFF78, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AF}, + {0xFF79, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B1}, + {0xFF7A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B3}, + {0xFF7B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B5}, + {0xFF7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B7}, + {0xFF7D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B9}, + {0xFF7E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BB}, + {0xFF7F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BD}, + {0xFF80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BF}, + {0xFF81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C1}, + {0xFF82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C4}, + {0xFF83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C6}, + {0xFF84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C8}, + {0xFF85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CA}, + {0xFF86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CB}, + {0xFF87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CC}, + {0xFF88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CD}, + {0xFF89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CE}, + {0xFF8A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CF}, + {0xFF8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D2}, + {0xFF8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D5}, + {0xFF8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D8}, + {0xFF8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DB}, + {0xFF8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DE}, + {0xFF90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DF}, + {0xFF91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E0}, + {0xFF92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E1}, + {0xFF93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E2}, + {0xFF94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E4}, + {0xFF95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E6}, + {0xFF96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E8}, + {0xFF97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E9}, + {0xFF98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EA}, + {0xFF99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EB}, + {0xFF9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EC}, + {0xFF9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30ED}, + {0xFF9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EF}, + {0xFF9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F3}, + {0xFF9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3099}, + {0xFF9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x309A}, + {0xFFA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3164}, + {0xFFA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3131}, + {0xFFA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3132}, + {0xFFA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3133}, + {0xFFA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3134}, + {0xFFA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3135}, + {0xFFA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3136}, + {0xFFA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3137}, + {0xFFA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3138}, + {0xFFA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3139}, + {0xFFAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313A}, + {0xFFAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313B}, + {0xFFAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313C}, + {0xFFAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313D}, + {0xFFAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313E}, + {0xFFAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313F}, + {0xFFB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3140}, + {0xFFB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3141}, + {0xFFB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3142}, + {0xFFB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3143}, + {0xFFB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3144}, + {0xFFB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3145}, + {0xFFB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3146}, + {0xFFB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3147}, + {0xFFB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3148}, + {0xFFB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3149}, + {0xFFBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314A}, + {0xFFBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314B}, + {0xFFBC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314C}, + {0xFFBD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314D}, + {0xFFBE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314E}, + {0xFFC2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314F}, + {0xFFC3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3150}, + {0xFFC4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3151}, + {0xFFC5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3152}, + {0xFFC6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3153}, + {0xFFC7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3154}, + {0xFFCA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3155}, + {0xFFCB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3156}, + {0xFFCC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3157}, + {0xFFCD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3158}, + {0xFFCE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3159}, + {0xFFCF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315A}, + {0xFFD2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315B}, + {0xFFD3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315C}, + {0xFFD4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315D}, + {0xFFD5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315E}, + {0xFFD6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315F}, + {0xFFD7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3160}, + {0xFFDA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3161}, + {0xFFDB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3162}, + {0xFFDC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3163}, + {0xFFE0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00A2}, + {0xFFE1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00A3}, + {0xFFE2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00AC}, + {0xFFE3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00AF}, + {0xFFE4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00A6}, + {0xFFE5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00A5}, + {0xFFE6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x20A9}, + {0xFFE8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2502}, + {0xFFE9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2190}, + {0xFFEA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2191}, + {0xFFEB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2192}, + {0xFFEC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2193}, + {0xFFED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x25A0}, + {0xFFEE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x25CB}, + {0x101FD, 220, 0, 0}, + {0x102E0, 220, 0, 0}, + {0x10376, 230, 0, 0}, + {0x10377, 230, 0, 0}, + {0x10378, 230, 0, 0}, + {0x10379, 230, 0, 0}, + {0x1037A, 230, 0, 0}, + {0x105C9, 0, 2, 4776}, + {0x105E4, 0, 2, 4778}, + {0x10781, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02D0}, + {0x10782, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02D1}, + {0x10783, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00E6}, + {0x10784, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0299}, + {0x10785, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0253}, + {0x10787, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A3}, + {0x10788, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xAB66}, + {0x10789, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A5}, + {0x1078A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A4}, + {0x1078B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0256}, + {0x1078C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0257}, + {0x1078D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D91}, + {0x1078E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0258}, + {0x1078F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025E}, + {0x10790, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A9}, + {0x10791, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0264}, + {0x10792, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0262}, + {0x10793, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0260}, + {0x10794, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x029B}, + {0x10795, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0127}, + {0x10796, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x029C}, + {0x10797, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0267}, + {0x10798, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0284}, + {0x10799, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02AA}, + {0x1079A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02AB}, + {0x1079B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026C}, + {0x1079C, 0, 1 | DECOMP_COMPAT, 4780}, + {0x1079D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA78E}, + {0x1079E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026E}, + {0x1079F, 0, 1 | DECOMP_COMPAT, 4781}, + {0x107A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028E}, + {0x107A1, 0, 1 | DECOMP_COMPAT, 4782}, + {0x107A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00F8}, + {0x107A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0276}, + {0x107A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0277}, + {0x107A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x107A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x027A}, + {0x107A7, 0, 1 | DECOMP_COMPAT, 4783}, + {0x107A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x027D}, + {0x107A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x027E}, + {0x107AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0280}, + {0x107AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A8}, + {0x107AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A6}, + {0x107AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xAB67}, + {0x107AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A7}, + {0x107AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0288}, + {0x107B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2C71}, + {0x107B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028F}, + {0x107B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A1}, + {0x107B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A2}, + {0x107B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0298}, + {0x107B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x01C0}, + {0x107B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x01C1}, + {0x107B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x01C2}, + {0x107B9, 0, 1 | DECOMP_COMPAT, 4784}, + {0x107BA, 0, 1 | DECOMP_COMPAT, 4785}, + {0x10A0D, 220, 0, 0}, + {0x10A0F, 230, 0, 0}, + {0x10A38, 230, 0, 0}, + {0x10A39, 1, 0, 0}, + {0x10A3A, 220, 0, 0}, + {0x10A3F, 9, 0, 0}, + {0x10AE5, 230, 0, 0}, + {0x10AE6, 220, 0, 0}, + {0x10D24, 230, 0, 0}, + {0x10D25, 230, 0, 0}, + {0x10D26, 230, 0, 0}, + {0x10D27, 230, 0, 0}, + {0x10D69, 230, 0, 0}, + {0x10D6A, 230, 0, 0}, + {0x10D6B, 230, 0, 0}, + {0x10D6C, 230, 0, 0}, + {0x10D6D, 230, 0, 0}, + {0x10EAB, 230, 0, 0}, + {0x10EAC, 230, 0, 0}, + {0x10EFD, 220, 0, 0}, + {0x10EFE, 220, 0, 0}, + {0x10EFF, 220, 0, 0}, + {0x10F46, 220, 0, 0}, + {0x10F47, 220, 0, 0}, + {0x10F48, 230, 0, 0}, + {0x10F49, 230, 0, 0}, + {0x10F4A, 230, 0, 0}, + {0x10F4B, 220, 0, 0}, + {0x10F4C, 230, 0, 0}, + {0x10F4D, 220, 0, 0}, + {0x10F4E, 220, 0, 0}, + {0x10F4F, 220, 0, 0}, + {0x10F50, 220, 0, 0}, + {0x10F82, 230, 0, 0}, + {0x10F83, 220, 0, 0}, + {0x10F84, 230, 0, 0}, + {0x10F85, 220, 0, 0}, + {0x11046, 9, 0, 0}, + {0x11070, 9, 0, 0}, + {0x1107F, 9, 0, 0}, + {0x1109A, 0, 2, 4786}, + {0x1109C, 0, 2, 4788}, + {0x110AB, 0, 2, 4790}, + {0x110B9, 9, 0, 0}, + {0x110BA, 7, 0, 0}, + {0x11100, 230, 0, 0}, + {0x11101, 230, 0, 0}, + {0x11102, 230, 0, 0}, + {0x1112E, 0, 2, 4792}, + {0x1112F, 0, 2, 4794}, + {0x11133, 9, 0, 0}, + {0x11134, 9, 0, 0}, + {0x11173, 7, 0, 0}, + {0x111C0, 9, 0, 0}, + {0x111CA, 7, 0, 0}, + {0x11235, 9, 0, 0}, + {0x11236, 7, 0, 0}, + {0x112E9, 7, 0, 0}, + {0x112EA, 9, 0, 0}, + {0x1133B, 7, 0, 0}, + {0x1133C, 7, 0, 0}, + {0x1134B, 0, 2, 4796}, + {0x1134C, 0, 2, 4798}, + {0x1134D, 9, 0, 0}, + {0x11366, 230, 0, 0}, + {0x11367, 230, 0, 0}, + {0x11368, 230, 0, 0}, + {0x11369, 230, 0, 0}, + {0x1136A, 230, 0, 0}, + {0x1136B, 230, 0, 0}, + {0x1136C, 230, 0, 0}, + {0x11370, 230, 0, 0}, + {0x11371, 230, 0, 0}, + {0x11372, 230, 0, 0}, + {0x11373, 230, 0, 0}, + {0x11374, 230, 0, 0}, + {0x11383, 0, 2, 4800}, + {0x11385, 0, 2, 4802}, + {0x1138E, 0, 2, 4804}, + {0x11391, 0, 2, 4806}, + {0x113C5, 0, 2, 4808}, + {0x113C7, 0, 2, 4810}, + {0x113C8, 0, 2, 4812}, + {0x113CE, 9, 0, 0}, + {0x113CF, 9, 0, 0}, + {0x113D0, 9, 0, 0}, + {0x11442, 9, 0, 0}, + {0x11446, 7, 0, 0}, + {0x1145E, 230, 0, 0}, + {0x114BB, 0, 2, 4814}, + {0x114BC, 0, 2, 4816}, + {0x114BE, 0, 2, 4818}, + {0x114C2, 9, 0, 0}, + {0x114C3, 7, 0, 0}, + {0x115BA, 0, 2, 4820}, + {0x115BB, 0, 2, 4822}, + {0x115BF, 9, 0, 0}, + {0x115C0, 7, 0, 0}, + {0x1163F, 9, 0, 0}, + {0x116B6, 9, 0, 0}, + {0x116B7, 7, 0, 0}, + {0x1172B, 9, 0, 0}, + {0x11839, 9, 0, 0}, + {0x1183A, 7, 0, 0}, + {0x11938, 0, 2, 4824}, + {0x1193D, 9, 0, 0}, + {0x1193E, 9, 0, 0}, + {0x11943, 7, 0, 0}, + {0x119E0, 9, 0, 0}, + {0x11A34, 9, 0, 0}, + {0x11A47, 9, 0, 0}, + {0x11A99, 9, 0, 0}, + {0x11C3F, 9, 0, 0}, + {0x11D42, 7, 0, 0}, + {0x11D44, 9, 0, 0}, + {0x11D45, 9, 0, 0}, + {0x11D97, 9, 0, 0}, + {0x11F41, 9, 0, 0}, + {0x11F42, 9, 0, 0}, + {0x16121, 0, 2, 4826}, + {0x16122, 0, 2, 4828}, + {0x16123, 0, 2, 4830}, + {0x16124, 0, 2, 4832}, + {0x16125, 0, 2, 4834}, + {0x16126, 0, 2, 4836}, + {0x16127, 0, 2, 4838}, + {0x16128, 0, 2, 4840}, + {0x1612F, 9, 0, 0}, + {0x16AF0, 1, 0, 0}, + {0x16AF1, 1, 0, 0}, + {0x16AF2, 1, 0, 0}, + {0x16AF3, 1, 0, 0}, + {0x16AF4, 1, 0, 0}, + {0x16B30, 230, 0, 0}, + {0x16B31, 230, 0, 0}, + {0x16B32, 230, 0, 0}, + {0x16B33, 230, 0, 0}, + {0x16B34, 230, 0, 0}, + {0x16B35, 230, 0, 0}, + {0x16B36, 230, 0, 0}, + {0x16D68, 0, 2, 4842}, + {0x16D69, 0, 2, 4844}, + {0x16D6A, 0, 2, 4846}, + {0x16FF0, 6, 0, 0}, + {0x16FF1, 6, 0, 0}, + {0x1BC9E, 1, 0, 0}, + {0x1CCD6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1CCD7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1CCD8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1CCD9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1CCDA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1CCDB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1CCDC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1CCDD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1CCDE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1CCDF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1CCE0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1CCE1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1CCE2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1CCE3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1CCE4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1CCE5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1CCE6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1CCE7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1CCE8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1CCE9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1CCEA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1CCEB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1CCEC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1CCED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1CCEE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1CCEF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1CCF0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1CCF1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1CCF2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1CCF3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1CCF4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1CCF5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1CCF6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1CCF7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1CCF8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1CCF9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1D15E, 0, 2 | DECOMP_NO_COMPOSE, 4848}, /* in exclusion list */ + {0x1D15F, 0, 2 | DECOMP_NO_COMPOSE, 4850}, /* in exclusion list */ + {0x1D160, 0, 2 | DECOMP_NO_COMPOSE, 4852}, /* in exclusion list */ + {0x1D161, 0, 2 | DECOMP_NO_COMPOSE, 4854}, /* in exclusion list */ + {0x1D162, 0, 2 | DECOMP_NO_COMPOSE, 4856}, /* in exclusion list */ + {0x1D163, 0, 2 | DECOMP_NO_COMPOSE, 4858}, /* in exclusion list */ + {0x1D164, 0, 2 | DECOMP_NO_COMPOSE, 4860}, /* in exclusion list */ + {0x1D165, 216, 0, 0}, + {0x1D166, 216, 0, 0}, + {0x1D167, 1, 0, 0}, + {0x1D168, 1, 0, 0}, + {0x1D169, 1, 0, 0}, + {0x1D16D, 226, 0, 0}, + {0x1D16E, 216, 0, 0}, + {0x1D16F, 216, 0, 0}, + {0x1D170, 216, 0, 0}, + {0x1D171, 216, 0, 0}, + {0x1D172, 216, 0, 0}, + {0x1D17B, 220, 0, 0}, + {0x1D17C, 220, 0, 0}, + {0x1D17D, 220, 0, 0}, + {0x1D17E, 220, 0, 0}, + {0x1D17F, 220, 0, 0}, + {0x1D180, 220, 0, 0}, + {0x1D181, 220, 0, 0}, + {0x1D182, 220, 0, 0}, + {0x1D185, 230, 0, 0}, + {0x1D186, 230, 0, 0}, + {0x1D187, 230, 0, 0}, + {0x1D188, 230, 0, 0}, + {0x1D189, 230, 0, 0}, + {0x1D18A, 220, 0, 0}, + {0x1D18B, 220, 0, 0}, + {0x1D1AA, 230, 0, 0}, + {0x1D1AB, 230, 0, 0}, + {0x1D1AC, 230, 0, 0}, + {0x1D1AD, 230, 0, 0}, + {0x1D1BB, 0, 2 | DECOMP_NO_COMPOSE, 4862}, /* in exclusion list */ + {0x1D1BC, 0, 2 | DECOMP_NO_COMPOSE, 4864}, /* in exclusion list */ + {0x1D1BD, 0, 2 | DECOMP_NO_COMPOSE, 4866}, /* in exclusion list */ + {0x1D1BE, 0, 2 | DECOMP_NO_COMPOSE, 4868}, /* in exclusion list */ + {0x1D1BF, 0, 2 | DECOMP_NO_COMPOSE, 4870}, /* in exclusion list */ + {0x1D1C0, 0, 2 | DECOMP_NO_COMPOSE, 4872}, /* in exclusion list */ + {0x1D242, 230, 0, 0}, + {0x1D243, 230, 0, 0}, + {0x1D244, 230, 0, 0}, + {0x1D400, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D401, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D402, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D403, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D404, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D405, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D406, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D407, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D408, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D409, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D40A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D40B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D40C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D40D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D40E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D40F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D410, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D411, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D412, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D413, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D414, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D415, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D416, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D417, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D418, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D419, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D41A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D41B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D41C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D41D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D41E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D41F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D420, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D421, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D422, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D423, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D424, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D425, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D426, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D427, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D428, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D429, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D42A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D42B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D42C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D42D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D42E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D42F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D430, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D431, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D432, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D433, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D434, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D435, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D436, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D437, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D438, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D439, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D43A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D43B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D43C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D43D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D43E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D43F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D440, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D441, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D442, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D443, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D444, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D445, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D446, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D447, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D448, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D449, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D44A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D44B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D44C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D44D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D44E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D44F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D450, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D451, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D452, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D453, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D454, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D456, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D457, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D458, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D459, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D45A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D45B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D45C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D45D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D45E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D45F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D460, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D461, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D462, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D463, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D464, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D465, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D466, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D467, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D468, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D469, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D46A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D46B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D46C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D46D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D46E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D46F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D470, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D471, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D472, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D473, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D474, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D475, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D476, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D477, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D478, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D479, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D47A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D47B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D47C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D47D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D47E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D47F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D480, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D481, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D482, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D483, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D484, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D485, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D486, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D487, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D488, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D489, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D48A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D48B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D48C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D48D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D48E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D48F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D490, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D491, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D492, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D493, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D494, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D495, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D496, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D497, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D498, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D499, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D49A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D49B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D49C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D49E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D49F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D4A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D4A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D4A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D4A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D4AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D4AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D4AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D4AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D4AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D4B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D4B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D4B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D4B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D4B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D4B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D4B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D4B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D4B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D4B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D4BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D4BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D4BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D4BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D4C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D4C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D4C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D4C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D4C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D4C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D4C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D4C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D4C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D4CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D4CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D4CC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D4CD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D4CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D4CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D4D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D4D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D4D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D4D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D4D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D4D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D4D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D4D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D4D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D4D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D4DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D4DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D4DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D4DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D4DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D4DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D4E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D4E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D4E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D4E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D4E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D4E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D4E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D4E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D4E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D4E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D4EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D4EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D4EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D4ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D4EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D4EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D4F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D4F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D4F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D4F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D4F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D4F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D4F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D4F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D4F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D4F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D4FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D4FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D4FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D4FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D4FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D4FF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D500, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D501, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D502, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D503, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D504, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D505, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D507, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D508, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D509, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D50A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D50D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D50E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D50F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D510, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D511, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D512, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D513, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D514, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D516, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D517, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D518, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D519, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D51A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D51B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D51C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D51E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D51F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D520, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D521, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D522, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D523, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D524, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D525, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D526, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D527, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D528, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D529, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D52A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D52B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D52C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D52D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D52E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D52F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D530, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D531, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D532, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D533, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D534, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D535, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D536, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D537, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D538, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D539, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D53B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D53C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D53D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D53E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D540, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D541, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D542, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D543, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D544, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D546, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D54A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D54B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D54C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D54D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D54E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D54F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D550, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D552, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D553, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D554, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D555, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D556, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D557, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D558, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D559, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D55A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D55B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D55C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D55D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D55E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D55F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D560, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D561, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D562, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D563, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D564, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D565, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D566, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D567, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D568, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D569, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D56A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D56B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D56C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D56D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D56E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D56F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D570, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D571, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D572, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D573, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D574, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D575, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D576, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D577, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D578, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D579, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D57A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D57B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D57C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D57D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D57E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D57F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D580, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D581, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D582, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D583, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D584, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D585, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D586, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D587, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D588, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D589, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D58A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D58B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D58C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D58D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D58E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D58F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D590, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D591, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D592, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D593, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D594, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D595, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D596, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D597, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D598, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D599, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D59A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D59B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D59C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D59D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D59E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D59F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D5A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D5A1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D5A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D5A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D5A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D5A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D5A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D5A7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D5A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D5A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D5AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D5AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D5AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D5AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D5AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D5AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D5B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D5B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D5B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D5B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D5B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D5B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D5B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D5B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D5B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D5B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D5BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D5BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D5BC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D5BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D5BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D5BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D5C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D5C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D5C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D5C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D5C4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D5C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D5C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D5C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D5C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D5C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D5CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D5CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D5CC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D5CD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D5CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D5CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D5D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D5D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D5D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D5D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D5D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D5D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D5D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D5D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D5D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D5D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D5DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D5DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D5DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D5DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D5DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D5DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D5E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D5E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D5E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D5E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D5E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D5E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D5E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D5E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D5E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D5E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D5EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D5EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D5EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D5ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D5EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D5EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D5F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D5F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D5F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D5F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D5F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D5F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D5F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D5F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D5F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D5F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D5FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D5FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D5FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D5FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D5FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D5FF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D600, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D601, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D602, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D603, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D604, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D605, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D606, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D607, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D608, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D609, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D60A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D60B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D60C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D60D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D60E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D60F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D610, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D611, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D612, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D613, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D614, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D615, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D616, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D617, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D618, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D619, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D61A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D61B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D61C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D61D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D61E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D61F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D620, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D621, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D622, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D623, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D624, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D625, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D626, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D627, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D628, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D629, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D62A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D62B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D62C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D62D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D62E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D62F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D630, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D631, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D632, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D633, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D634, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D635, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D636, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D637, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D638, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D639, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D63A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D63B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D63C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D63D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D63E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D63F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D640, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D641, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D642, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D643, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D644, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D645, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D646, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D647, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D648, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D649, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D64A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D64B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D64C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D64D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D64E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D64F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D650, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D651, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D652, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D653, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D654, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D655, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D656, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D657, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D658, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D659, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D65A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D65B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D65C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D65D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D65E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D65F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D660, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D661, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D662, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D663, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D664, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D665, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D666, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D667, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D668, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D669, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D66A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D66B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D66C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D66D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D66E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D66F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D670, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D671, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D672, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D673, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D674, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D675, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D676, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D677, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D678, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D679, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D67A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D67B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D67C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D67D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D67E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D67F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D680, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D681, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D682, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D683, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D684, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D685, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D686, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D687, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D688, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D689, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D68A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D68B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D68C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D68D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D68E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D68F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D690, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D691, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D692, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D693, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D694, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D695, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D696, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D697, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D698, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D699, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D69A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D69B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D69C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D69D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D69E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D69F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D6A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D6A1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D6A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D6A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D6A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0131}, + {0x1D6A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0237}, + {0x1D6A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D6A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D6AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D6AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D6AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D6AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D6AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D6AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D6B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D6B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D6B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D6B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D6B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D6B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D6B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D6B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D6B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D6B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D6BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D6BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D6BC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D6BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D6BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D6BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D6C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D6C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D6C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D6C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D6C4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D6C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D6C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D6C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D6C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D6C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D6CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D6CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D6CC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D6CD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D6CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D6CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D6D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D6D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D6D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D6D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D6D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D6D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D6D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D6D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D6D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D6D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D6DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D6DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D6DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D6DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D6DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D6DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D6E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D6E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D6E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D6E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D6E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D6E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D6E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D6E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D6E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D6E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D6EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D6EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D6EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D6ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D6EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D6EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D6F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D6F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D6F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D6F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D6F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D6F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D6F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D6F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D6F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D6F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D6FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D6FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D6FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D6FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D6FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D6FF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D700, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D701, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D702, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D703, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D704, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D705, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D706, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D707, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D708, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D709, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D70A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D70B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D70C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D70D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D70E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D70F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D710, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D711, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D712, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D713, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D714, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D715, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D716, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D717, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D718, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D719, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D71A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D71B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D71C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D71D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D71E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D71F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D720, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D721, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D722, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D723, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D724, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D725, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D726, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D727, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D728, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D729, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D72A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D72B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D72C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D72D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D72E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D72F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D730, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D731, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D732, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D733, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D734, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D735, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D736, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D737, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D738, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D739, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D73A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D73B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D73C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D73D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D73E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D73F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D740, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D741, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D742, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D743, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D744, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D745, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D746, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D747, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D748, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D749, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D74A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D74B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D74C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D74D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D74E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D74F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D750, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D751, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D752, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D753, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D754, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D755, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D756, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D757, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D758, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D759, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D75A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D75B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D75C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D75D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D75E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D75F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D760, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D761, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D762, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D763, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D764, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D765, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D766, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D767, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D768, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D769, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D76A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D76B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D76C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D76D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D76E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D76F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D770, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D771, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D772, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D773, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D774, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D775, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D776, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D777, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D778, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D779, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D77A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D77B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D77C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D77D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D77E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D77F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D780, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D781, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D782, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D783, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D784, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D785, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D786, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D787, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D788, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D789, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D78A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D78B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D78C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D78D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D78E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D78F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D790, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D791, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D792, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D793, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D794, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D795, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D796, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D797, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D798, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D799, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D79A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D79B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D79C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D79D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D79E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D79F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D7A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D7A1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D7A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D7A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D7A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D7A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D7A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D7A7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D7A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D7A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D7AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D7AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D7AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D7AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D7AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D7AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D7B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D7B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D7B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D7B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D7B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D7B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D7B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D7B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D7B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D7B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D7BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D7BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D7BC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D7BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D7BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D7BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D7C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D7C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D7C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D7C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D7C4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D7C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D7C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D7C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D7C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D7C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D7CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03DC}, + {0x1D7CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03DD}, + {0x1D7CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1D7D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1D7E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1D7EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1D7F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7FF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1E000, 230, 0, 0}, + {0x1E001, 230, 0, 0}, + {0x1E002, 230, 0, 0}, + {0x1E003, 230, 0, 0}, + {0x1E004, 230, 0, 0}, + {0x1E005, 230, 0, 0}, + {0x1E006, 230, 0, 0}, + {0x1E008, 230, 0, 0}, + {0x1E009, 230, 0, 0}, + {0x1E00A, 230, 0, 0}, + {0x1E00B, 230, 0, 0}, + {0x1E00C, 230, 0, 0}, + {0x1E00D, 230, 0, 0}, + {0x1E00E, 230, 0, 0}, + {0x1E00F, 230, 0, 0}, + {0x1E010, 230, 0, 0}, + {0x1E011, 230, 0, 0}, + {0x1E012, 230, 0, 0}, + {0x1E013, 230, 0, 0}, + {0x1E014, 230, 0, 0}, + {0x1E015, 230, 0, 0}, + {0x1E016, 230, 0, 0}, + {0x1E017, 230, 0, 0}, + {0x1E018, 230, 0, 0}, + {0x1E01B, 230, 0, 0}, + {0x1E01C, 230, 0, 0}, + {0x1E01D, 230, 0, 0}, + {0x1E01E, 230, 0, 0}, + {0x1E01F, 230, 0, 0}, + {0x1E020, 230, 0, 0}, + {0x1E021, 230, 0, 0}, + {0x1E023, 230, 0, 0}, + {0x1E024, 230, 0, 0}, + {0x1E026, 230, 0, 0}, + {0x1E027, 230, 0, 0}, + {0x1E028, 230, 0, 0}, + {0x1E029, 230, 0, 0}, + {0x1E02A, 230, 0, 0}, + {0x1E030, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0430}, + {0x1E031, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0431}, + {0x1E032, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0432}, + {0x1E033, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0433}, + {0x1E034, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0434}, + {0x1E035, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0435}, + {0x1E036, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0436}, + {0x1E037, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0437}, + {0x1E038, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0438}, + {0x1E039, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043A}, + {0x1E03A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043B}, + {0x1E03B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043C}, + {0x1E03C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043E}, + {0x1E03D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043F}, + {0x1E03E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0440}, + {0x1E03F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0441}, + {0x1E040, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0442}, + {0x1E041, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0443}, + {0x1E042, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0444}, + {0x1E043, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0445}, + {0x1E044, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0446}, + {0x1E045, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0447}, + {0x1E046, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0448}, + {0x1E047, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044B}, + {0x1E048, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044D}, + {0x1E049, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044E}, + {0x1E04A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA689}, + {0x1E04B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04D9}, + {0x1E04C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0456}, + {0x1E04D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0458}, + {0x1E04E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04E9}, + {0x1E04F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04AF}, + {0x1E050, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04CF}, + {0x1E051, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0430}, + {0x1E052, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0431}, + {0x1E053, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0432}, + {0x1E054, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0433}, + {0x1E055, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0434}, + {0x1E056, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0435}, + {0x1E057, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0436}, + {0x1E058, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0437}, + {0x1E059, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0438}, + {0x1E05A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043A}, + {0x1E05B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043B}, + {0x1E05C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043E}, + {0x1E05D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043F}, + {0x1E05E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0441}, + {0x1E05F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0443}, + {0x1E060, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0444}, + {0x1E061, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0445}, + {0x1E062, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0446}, + {0x1E063, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0447}, + {0x1E064, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0448}, + {0x1E065, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044A}, + {0x1E066, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044B}, + {0x1E067, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0491}, + {0x1E068, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0456}, + {0x1E069, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0455}, + {0x1E06A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x045F}, + {0x1E06B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04AB}, + {0x1E06C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA651}, + {0x1E06D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04B1}, + {0x1E08F, 230, 0, 0}, + {0x1E130, 230, 0, 0}, + {0x1E131, 230, 0, 0}, + {0x1E132, 230, 0, 0}, + {0x1E133, 230, 0, 0}, + {0x1E134, 230, 0, 0}, + {0x1E135, 230, 0, 0}, + {0x1E136, 230, 0, 0}, + {0x1E2AE, 230, 0, 0}, + {0x1E2EC, 230, 0, 0}, + {0x1E2ED, 230, 0, 0}, + {0x1E2EE, 230, 0, 0}, + {0x1E2EF, 230, 0, 0}, + {0x1E4EC, 232, 0, 0}, + {0x1E4ED, 232, 0, 0}, + {0x1E4EE, 220, 0, 0}, + {0x1E4EF, 230, 0, 0}, + {0x1E5EE, 230, 0, 0}, + {0x1E5EF, 220, 0, 0}, + {0x1E8D0, 220, 0, 0}, + {0x1E8D1, 220, 0, 0}, + {0x1E8D2, 220, 0, 0}, + {0x1E8D3, 220, 0, 0}, + {0x1E8D4, 220, 0, 0}, + {0x1E8D5, 220, 0, 0}, + {0x1E8D6, 220, 0, 0}, + {0x1E944, 230, 0, 0}, + {0x1E945, 230, 0, 0}, + {0x1E946, 230, 0, 0}, + {0x1E947, 230, 0, 0}, + {0x1E948, 230, 0, 0}, + {0x1E949, 230, 0, 0}, + {0x1E94A, 7, 0, 0}, + {0x1EE00, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0627}, + {0x1EE01, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EE02, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE03, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0x1EE05, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0x1EE06, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0x1EE07, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE08, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0x1EE09, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE0A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0x1EE0B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EE0C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EE0D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE0E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE0F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE10, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EE11, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE12, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE13, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0x1EE14, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE15, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EE16, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EE17, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE18, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0x1EE19, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE1A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0x1EE1B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EE1C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x066E}, + {0x1EE1D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BA}, + {0x1EE1E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A1}, + {0x1EE1F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x066F}, + {0x1EE21, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EE22, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE24, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0x1EE27, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE29, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE2A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0x1EE2B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EE2C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EE2D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE2E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE2F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EE31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EE36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EE37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE3B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EE42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EE4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE4E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EE5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BA}, + {0x1EE5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x066F}, + {0x1EE61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EE62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0x1EE67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0x1EE69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0x1EE6C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EE6D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE6E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE70, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EE71, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE72, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE74, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE75, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EE76, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EE77, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE79, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE7A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0x1EE7B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EE7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x066E}, + {0x1EE7E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A1}, + {0x1EE80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0627}, + {0x1EE81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EE82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0x1EE84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0x1EE85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0x1EE86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0x1EE87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0x1EE89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EE8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EE8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EE91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0x1EE94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EE96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EE97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0x1EE99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0x1EE9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EEA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EEA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EEA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0x1EEA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0x1EEA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0x1EEA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EEA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0x1EEA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EEAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EEAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EEAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EEAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EEAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EEB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EEB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EEB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EEB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0x1EEB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EEB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EEB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EEB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EEB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0x1EEB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EEBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0x1EEBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1F100, 0, 2 | DECOMP_COMPAT, 4874}, + {0x1F101, 0, 2 | DECOMP_COMPAT, 4876}, + {0x1F102, 0, 2 | DECOMP_COMPAT, 4878}, + {0x1F103, 0, 2 | DECOMP_COMPAT, 4880}, + {0x1F104, 0, 2 | DECOMP_COMPAT, 4882}, + {0x1F105, 0, 2 | DECOMP_COMPAT, 4884}, + {0x1F106, 0, 2 | DECOMP_COMPAT, 4886}, + {0x1F107, 0, 2 | DECOMP_COMPAT, 4888}, + {0x1F108, 0, 2 | DECOMP_COMPAT, 4890}, + {0x1F109, 0, 2 | DECOMP_COMPAT, 4892}, + {0x1F10A, 0, 2 | DECOMP_COMPAT, 4894}, + {0x1F110, 0, 3 | DECOMP_COMPAT, 4896}, + {0x1F111, 0, 3 | DECOMP_COMPAT, 4899}, + {0x1F112, 0, 3 | DECOMP_COMPAT, 4902}, + {0x1F113, 0, 3 | DECOMP_COMPAT, 4905}, + {0x1F114, 0, 3 | DECOMP_COMPAT, 4908}, + {0x1F115, 0, 3 | DECOMP_COMPAT, 4911}, + {0x1F116, 0, 3 | DECOMP_COMPAT, 4914}, + {0x1F117, 0, 3 | DECOMP_COMPAT, 4917}, + {0x1F118, 0, 3 | DECOMP_COMPAT, 4920}, + {0x1F119, 0, 3 | DECOMP_COMPAT, 4923}, + {0x1F11A, 0, 3 | DECOMP_COMPAT, 4926}, + {0x1F11B, 0, 3 | DECOMP_COMPAT, 4929}, + {0x1F11C, 0, 3 | DECOMP_COMPAT, 4932}, + {0x1F11D, 0, 3 | DECOMP_COMPAT, 4935}, + {0x1F11E, 0, 3 | DECOMP_COMPAT, 4938}, + {0x1F11F, 0, 3 | DECOMP_COMPAT, 4941}, + {0x1F120, 0, 3 | DECOMP_COMPAT, 4944}, + {0x1F121, 0, 3 | DECOMP_COMPAT, 4947}, + {0x1F122, 0, 3 | DECOMP_COMPAT, 4950}, + {0x1F123, 0, 3 | DECOMP_COMPAT, 4953}, + {0x1F124, 0, 3 | DECOMP_COMPAT, 4956}, + {0x1F125, 0, 3 | DECOMP_COMPAT, 4959}, + {0x1F126, 0, 3 | DECOMP_COMPAT, 4962}, + {0x1F127, 0, 3 | DECOMP_COMPAT, 4965}, + {0x1F128, 0, 3 | DECOMP_COMPAT, 4968}, + {0x1F129, 0, 3 | DECOMP_COMPAT, 4971}, + {0x1F12A, 0, 3 | DECOMP_COMPAT, 4974}, + {0x1F12B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1F12C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1F12D, 0, 2 | DECOMP_COMPAT, 4977}, + {0x1F12E, 0, 2 | DECOMP_COMPAT, 4979}, + {0x1F130, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1F131, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1F132, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1F133, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1F134, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1F135, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1F136, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1F137, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1F138, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1F139, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1F13A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1F13B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1F13C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1F13D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1F13E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1F13F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1F140, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1F141, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1F142, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1F143, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1F144, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1F145, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1F146, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1F147, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1F148, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1F149, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1F14A, 0, 2 | DECOMP_COMPAT, 4981}, + {0x1F14B, 0, 2 | DECOMP_COMPAT, 4983}, + {0x1F14C, 0, 2 | DECOMP_COMPAT, 4985}, + {0x1F14D, 0, 2 | DECOMP_COMPAT, 4987}, + {0x1F14E, 0, 3 | DECOMP_COMPAT, 4989}, + {0x1F14F, 0, 2 | DECOMP_COMPAT, 4992}, + {0x1F16A, 0, 2 | DECOMP_COMPAT, 4994}, + {0x1F16B, 0, 2 | DECOMP_COMPAT, 4996}, + {0x1F16C, 0, 2 | DECOMP_COMPAT, 4998}, + {0x1F190, 0, 2 | DECOMP_COMPAT, 5000}, + {0x1F200, 0, 2 | DECOMP_COMPAT, 5002}, + {0x1F201, 0, 2 | DECOMP_COMPAT, 5004}, + {0x1F202, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B5}, + {0x1F210, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x624B}, + {0x1F211, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B57}, + {0x1F212, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53CC}, + {0x1F213, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C7}, + {0x1F214, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E8C}, + {0x1F215, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x591A}, + {0x1F216, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x89E3}, + {0x1F217, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5929}, + {0x1F218, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4EA4}, + {0x1F219, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6620}, + {0x1F21A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7121}, + {0x1F21B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6599}, + {0x1F21C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x524D}, + {0x1F21D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F8C}, + {0x1F21E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x518D}, + {0x1F21F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65B0}, + {0x1F220, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x521D}, + {0x1F221, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7D42}, + {0x1F222, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x751F}, + {0x1F223, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8CA9}, + {0x1F224, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x58F0}, + {0x1F225, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5439}, + {0x1F226, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6F14}, + {0x1F227, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6295}, + {0x1F228, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6355}, + {0x1F229, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E00}, + {0x1F22A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E09}, + {0x1F22B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x904A}, + {0x1F22C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DE6}, + {0x1F22D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E2D}, + {0x1F22E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53F3}, + {0x1F22F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6307}, + {0x1F230, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8D70}, + {0x1F231, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6253}, + {0x1F232, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7981}, + {0x1F233, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7A7A}, + {0x1F234, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5408}, + {0x1F235, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6E80}, + {0x1F236, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6709}, + {0x1F237, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6708}, + {0x1F238, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7533}, + {0x1F239, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5272}, + {0x1F23A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x55B6}, + {0x1F23B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x914D}, + {0x1F240, 0, 3 | DECOMP_COMPAT, 5006}, + {0x1F241, 0, 3 | DECOMP_COMPAT, 5009}, + {0x1F242, 0, 3 | DECOMP_COMPAT, 5012}, + {0x1F243, 0, 3 | DECOMP_COMPAT, 5015}, + {0x1F244, 0, 3 | DECOMP_COMPAT, 5018}, + {0x1F245, 0, 3 | DECOMP_COMPAT, 5021}, + {0x1F246, 0, 3 | DECOMP_COMPAT, 5024}, + {0x1F247, 0, 3 | DECOMP_COMPAT, 5027}, + {0x1F248, 0, 3 | DECOMP_COMPAT, 5030}, + {0x1F250, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F97}, + {0x1F251, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53EF}, + {0x1FBF0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1FBF1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1FBF2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1FBF3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1FBF4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1FBF5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1FBF6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1FBF7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1FBF8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1FBF9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x2F800, 0, 1 | DECOMP_INLINE, 0x4E3D}, + {0x2F801, 0, 1 | DECOMP_INLINE, 0x4E38}, + {0x2F802, 0, 1 | DECOMP_INLINE, 0x4E41}, + {0x2F803, 0, 1, 5033}, + {0x2F804, 0, 1 | DECOMP_INLINE, 0x4F60}, + {0x2F805, 0, 1 | DECOMP_INLINE, 0x4FAE}, + {0x2F806, 0, 1 | DECOMP_INLINE, 0x4FBB}, + {0x2F807, 0, 1 | DECOMP_INLINE, 0x5002}, + {0x2F808, 0, 1 | DECOMP_INLINE, 0x507A}, + {0x2F809, 0, 1 | DECOMP_INLINE, 0x5099}, + {0x2F80A, 0, 1 | DECOMP_INLINE, 0x50E7}, + {0x2F80B, 0, 1 | DECOMP_INLINE, 0x50CF}, + {0x2F80C, 0, 1 | DECOMP_INLINE, 0x349E}, + {0x2F80D, 0, 1, 5034}, + {0x2F80E, 0, 1 | DECOMP_INLINE, 0x514D}, + {0x2F80F, 0, 1 | DECOMP_INLINE, 0x5154}, + {0x2F810, 0, 1 | DECOMP_INLINE, 0x5164}, + {0x2F811, 0, 1 | DECOMP_INLINE, 0x5177}, + {0x2F812, 0, 1, 5035}, + {0x2F813, 0, 1 | DECOMP_INLINE, 0x34B9}, + {0x2F814, 0, 1 | DECOMP_INLINE, 0x5167}, + {0x2F815, 0, 1 | DECOMP_INLINE, 0x518D}, + {0x2F816, 0, 1, 5036}, + {0x2F817, 0, 1 | DECOMP_INLINE, 0x5197}, + {0x2F818, 0, 1 | DECOMP_INLINE, 0x51A4}, + {0x2F819, 0, 1 | DECOMP_INLINE, 0x4ECC}, + {0x2F81A, 0, 1 | DECOMP_INLINE, 0x51AC}, + {0x2F81B, 0, 1 | DECOMP_INLINE, 0x51B5}, + {0x2F81C, 0, 1, 5037}, + {0x2F81D, 0, 1 | DECOMP_INLINE, 0x51F5}, + {0x2F81E, 0, 1 | DECOMP_INLINE, 0x5203}, + {0x2F81F, 0, 1 | DECOMP_INLINE, 0x34DF}, + {0x2F820, 0, 1 | DECOMP_INLINE, 0x523B}, + {0x2F821, 0, 1 | DECOMP_INLINE, 0x5246}, + {0x2F822, 0, 1 | DECOMP_INLINE, 0x5272}, + {0x2F823, 0, 1 | DECOMP_INLINE, 0x5277}, + {0x2F824, 0, 1 | DECOMP_INLINE, 0x3515}, + {0x2F825, 0, 1 | DECOMP_INLINE, 0x52C7}, + {0x2F826, 0, 1 | DECOMP_INLINE, 0x52C9}, + {0x2F827, 0, 1 | DECOMP_INLINE, 0x52E4}, + {0x2F828, 0, 1 | DECOMP_INLINE, 0x52FA}, + {0x2F829, 0, 1 | DECOMP_INLINE, 0x5305}, + {0x2F82A, 0, 1 | DECOMP_INLINE, 0x5306}, + {0x2F82B, 0, 1 | DECOMP_INLINE, 0x5317}, + {0x2F82C, 0, 1 | DECOMP_INLINE, 0x5349}, + {0x2F82D, 0, 1 | DECOMP_INLINE, 0x5351}, + {0x2F82E, 0, 1 | DECOMP_INLINE, 0x535A}, + {0x2F82F, 0, 1 | DECOMP_INLINE, 0x5373}, + {0x2F830, 0, 1 | DECOMP_INLINE, 0x537D}, + {0x2F831, 0, 1 | DECOMP_INLINE, 0x537F}, + {0x2F832, 0, 1 | DECOMP_INLINE, 0x537F}, + {0x2F833, 0, 1 | DECOMP_INLINE, 0x537F}, + {0x2F834, 0, 1, 5038}, + {0x2F835, 0, 1 | DECOMP_INLINE, 0x7070}, + {0x2F836, 0, 1 | DECOMP_INLINE, 0x53CA}, + {0x2F837, 0, 1 | DECOMP_INLINE, 0x53DF}, + {0x2F838, 0, 1, 5039}, + {0x2F839, 0, 1 | DECOMP_INLINE, 0x53EB}, + {0x2F83A, 0, 1 | DECOMP_INLINE, 0x53F1}, + {0x2F83B, 0, 1 | DECOMP_INLINE, 0x5406}, + {0x2F83C, 0, 1 | DECOMP_INLINE, 0x549E}, + {0x2F83D, 0, 1 | DECOMP_INLINE, 0x5438}, + {0x2F83E, 0, 1 | DECOMP_INLINE, 0x5448}, + {0x2F83F, 0, 1 | DECOMP_INLINE, 0x5468}, + {0x2F840, 0, 1 | DECOMP_INLINE, 0x54A2}, + {0x2F841, 0, 1 | DECOMP_INLINE, 0x54F6}, + {0x2F842, 0, 1 | DECOMP_INLINE, 0x5510}, + {0x2F843, 0, 1 | DECOMP_INLINE, 0x5553}, + {0x2F844, 0, 1 | DECOMP_INLINE, 0x5563}, + {0x2F845, 0, 1 | DECOMP_INLINE, 0x5584}, + {0x2F846, 0, 1 | DECOMP_INLINE, 0x5584}, + {0x2F847, 0, 1 | DECOMP_INLINE, 0x5599}, + {0x2F848, 0, 1 | DECOMP_INLINE, 0x55AB}, + {0x2F849, 0, 1 | DECOMP_INLINE, 0x55B3}, + {0x2F84A, 0, 1 | DECOMP_INLINE, 0x55C2}, + {0x2F84B, 0, 1 | DECOMP_INLINE, 0x5716}, + {0x2F84C, 0, 1 | DECOMP_INLINE, 0x5606}, + {0x2F84D, 0, 1 | DECOMP_INLINE, 0x5717}, + {0x2F84E, 0, 1 | DECOMP_INLINE, 0x5651}, + {0x2F84F, 0, 1 | DECOMP_INLINE, 0x5674}, + {0x2F850, 0, 1 | DECOMP_INLINE, 0x5207}, + {0x2F851, 0, 1 | DECOMP_INLINE, 0x58EE}, + {0x2F852, 0, 1 | DECOMP_INLINE, 0x57CE}, + {0x2F853, 0, 1 | DECOMP_INLINE, 0x57F4}, + {0x2F854, 0, 1 | DECOMP_INLINE, 0x580D}, + {0x2F855, 0, 1 | DECOMP_INLINE, 0x578B}, + {0x2F856, 0, 1 | DECOMP_INLINE, 0x5832}, + {0x2F857, 0, 1 | DECOMP_INLINE, 0x5831}, + {0x2F858, 0, 1 | DECOMP_INLINE, 0x58AC}, + {0x2F859, 0, 1, 5040}, + {0x2F85A, 0, 1 | DECOMP_INLINE, 0x58F2}, + {0x2F85B, 0, 1 | DECOMP_INLINE, 0x58F7}, + {0x2F85C, 0, 1 | DECOMP_INLINE, 0x5906}, + {0x2F85D, 0, 1 | DECOMP_INLINE, 0x591A}, + {0x2F85E, 0, 1 | DECOMP_INLINE, 0x5922}, + {0x2F85F, 0, 1 | DECOMP_INLINE, 0x5962}, + {0x2F860, 0, 1, 5041}, + {0x2F861, 0, 1, 5042}, + {0x2F862, 0, 1 | DECOMP_INLINE, 0x59EC}, + {0x2F863, 0, 1 | DECOMP_INLINE, 0x5A1B}, + {0x2F864, 0, 1 | DECOMP_INLINE, 0x5A27}, + {0x2F865, 0, 1 | DECOMP_INLINE, 0x59D8}, + {0x2F866, 0, 1 | DECOMP_INLINE, 0x5A66}, + {0x2F867, 0, 1 | DECOMP_INLINE, 0x36EE}, + {0x2F868, 0, 1 | DECOMP_INLINE, 0x36FC}, + {0x2F869, 0, 1 | DECOMP_INLINE, 0x5B08}, + {0x2F86A, 0, 1 | DECOMP_INLINE, 0x5B3E}, + {0x2F86B, 0, 1 | DECOMP_INLINE, 0x5B3E}, + {0x2F86C, 0, 1, 5043}, + {0x2F86D, 0, 1 | DECOMP_INLINE, 0x5BC3}, + {0x2F86E, 0, 1 | DECOMP_INLINE, 0x5BD8}, + {0x2F86F, 0, 1 | DECOMP_INLINE, 0x5BE7}, + {0x2F870, 0, 1 | DECOMP_INLINE, 0x5BF3}, + {0x2F871, 0, 1, 5044}, + {0x2F872, 0, 1 | DECOMP_INLINE, 0x5BFF}, + {0x2F873, 0, 1 | DECOMP_INLINE, 0x5C06}, + {0x2F874, 0, 1 | DECOMP_INLINE, 0x5F53}, + {0x2F875, 0, 1 | DECOMP_INLINE, 0x5C22}, + {0x2F876, 0, 1 | DECOMP_INLINE, 0x3781}, + {0x2F877, 0, 1 | DECOMP_INLINE, 0x5C60}, + {0x2F878, 0, 1 | DECOMP_INLINE, 0x5C6E}, + {0x2F879, 0, 1 | DECOMP_INLINE, 0x5CC0}, + {0x2F87A, 0, 1 | DECOMP_INLINE, 0x5C8D}, + {0x2F87B, 0, 1, 5045}, + {0x2F87C, 0, 1 | DECOMP_INLINE, 0x5D43}, + {0x2F87D, 0, 1, 5046}, + {0x2F87E, 0, 1 | DECOMP_INLINE, 0x5D6E}, + {0x2F87F, 0, 1 | DECOMP_INLINE, 0x5D6B}, + {0x2F880, 0, 1 | DECOMP_INLINE, 0x5D7C}, + {0x2F881, 0, 1 | DECOMP_INLINE, 0x5DE1}, + {0x2F882, 0, 1 | DECOMP_INLINE, 0x5DE2}, + {0x2F883, 0, 1 | DECOMP_INLINE, 0x382F}, + {0x2F884, 0, 1 | DECOMP_INLINE, 0x5DFD}, + {0x2F885, 0, 1 | DECOMP_INLINE, 0x5E28}, + {0x2F886, 0, 1 | DECOMP_INLINE, 0x5E3D}, + {0x2F887, 0, 1 | DECOMP_INLINE, 0x5E69}, + {0x2F888, 0, 1 | DECOMP_INLINE, 0x3862}, + {0x2F889, 0, 1, 5047}, + {0x2F88A, 0, 1 | DECOMP_INLINE, 0x387C}, + {0x2F88B, 0, 1 | DECOMP_INLINE, 0x5EB0}, + {0x2F88C, 0, 1 | DECOMP_INLINE, 0x5EB3}, + {0x2F88D, 0, 1 | DECOMP_INLINE, 0x5EB6}, + {0x2F88E, 0, 1 | DECOMP_INLINE, 0x5ECA}, + {0x2F88F, 0, 1, 5048}, + {0x2F890, 0, 1 | DECOMP_INLINE, 0x5EFE}, + {0x2F891, 0, 1, 5049}, + {0x2F892, 0, 1, 5050}, + {0x2F893, 0, 1 | DECOMP_INLINE, 0x8201}, + {0x2F894, 0, 1 | DECOMP_INLINE, 0x5F22}, + {0x2F895, 0, 1 | DECOMP_INLINE, 0x5F22}, + {0x2F896, 0, 1 | DECOMP_INLINE, 0x38C7}, + {0x2F897, 0, 1, 5051}, + {0x2F898, 0, 1, 5052}, + {0x2F899, 0, 1 | DECOMP_INLINE, 0x5F62}, + {0x2F89A, 0, 1 | DECOMP_INLINE, 0x5F6B}, + {0x2F89B, 0, 1 | DECOMP_INLINE, 0x38E3}, + {0x2F89C, 0, 1 | DECOMP_INLINE, 0x5F9A}, + {0x2F89D, 0, 1 | DECOMP_INLINE, 0x5FCD}, + {0x2F89E, 0, 1 | DECOMP_INLINE, 0x5FD7}, + {0x2F89F, 0, 1 | DECOMP_INLINE, 0x5FF9}, + {0x2F8A0, 0, 1 | DECOMP_INLINE, 0x6081}, + {0x2F8A1, 0, 1 | DECOMP_INLINE, 0x393A}, + {0x2F8A2, 0, 1 | DECOMP_INLINE, 0x391C}, + {0x2F8A3, 0, 1 | DECOMP_INLINE, 0x6094}, + {0x2F8A4, 0, 1, 5053}, + {0x2F8A5, 0, 1 | DECOMP_INLINE, 0x60C7}, + {0x2F8A6, 0, 1 | DECOMP_INLINE, 0x6148}, + {0x2F8A7, 0, 1 | DECOMP_INLINE, 0x614C}, + {0x2F8A8, 0, 1 | DECOMP_INLINE, 0x614E}, + {0x2F8A9, 0, 1 | DECOMP_INLINE, 0x614C}, + {0x2F8AA, 0, 1 | DECOMP_INLINE, 0x617A}, + {0x2F8AB, 0, 1 | DECOMP_INLINE, 0x618E}, + {0x2F8AC, 0, 1 | DECOMP_INLINE, 0x61B2}, + {0x2F8AD, 0, 1 | DECOMP_INLINE, 0x61A4}, + {0x2F8AE, 0, 1 | DECOMP_INLINE, 0x61AF}, + {0x2F8AF, 0, 1 | DECOMP_INLINE, 0x61DE}, + {0x2F8B0, 0, 1 | DECOMP_INLINE, 0x61F2}, + {0x2F8B1, 0, 1 | DECOMP_INLINE, 0x61F6}, + {0x2F8B2, 0, 1 | DECOMP_INLINE, 0x6210}, + {0x2F8B3, 0, 1 | DECOMP_INLINE, 0x621B}, + {0x2F8B4, 0, 1 | DECOMP_INLINE, 0x625D}, + {0x2F8B5, 0, 1 | DECOMP_INLINE, 0x62B1}, + {0x2F8B6, 0, 1 | DECOMP_INLINE, 0x62D4}, + {0x2F8B7, 0, 1 | DECOMP_INLINE, 0x6350}, + {0x2F8B8, 0, 1, 5054}, + {0x2F8B9, 0, 1 | DECOMP_INLINE, 0x633D}, + {0x2F8BA, 0, 1 | DECOMP_INLINE, 0x62FC}, + {0x2F8BB, 0, 1 | DECOMP_INLINE, 0x6368}, + {0x2F8BC, 0, 1 | DECOMP_INLINE, 0x6383}, + {0x2F8BD, 0, 1 | DECOMP_INLINE, 0x63E4}, + {0x2F8BE, 0, 1, 5055}, + {0x2F8BF, 0, 1 | DECOMP_INLINE, 0x6422}, + {0x2F8C0, 0, 1 | DECOMP_INLINE, 0x63C5}, + {0x2F8C1, 0, 1 | DECOMP_INLINE, 0x63A9}, + {0x2F8C2, 0, 1 | DECOMP_INLINE, 0x3A2E}, + {0x2F8C3, 0, 1 | DECOMP_INLINE, 0x6469}, + {0x2F8C4, 0, 1 | DECOMP_INLINE, 0x647E}, + {0x2F8C5, 0, 1 | DECOMP_INLINE, 0x649D}, + {0x2F8C6, 0, 1 | DECOMP_INLINE, 0x6477}, + {0x2F8C7, 0, 1 | DECOMP_INLINE, 0x3A6C}, + {0x2F8C8, 0, 1 | DECOMP_INLINE, 0x654F}, + {0x2F8C9, 0, 1 | DECOMP_INLINE, 0x656C}, + {0x2F8CA, 0, 1, 5056}, + {0x2F8CB, 0, 1 | DECOMP_INLINE, 0x65E3}, + {0x2F8CC, 0, 1 | DECOMP_INLINE, 0x66F8}, + {0x2F8CD, 0, 1 | DECOMP_INLINE, 0x6649}, + {0x2F8CE, 0, 1 | DECOMP_INLINE, 0x3B19}, + {0x2F8CF, 0, 1 | DECOMP_INLINE, 0x6691}, + {0x2F8D0, 0, 1 | DECOMP_INLINE, 0x3B08}, + {0x2F8D1, 0, 1 | DECOMP_INLINE, 0x3AE4}, + {0x2F8D2, 0, 1 | DECOMP_INLINE, 0x5192}, + {0x2F8D3, 0, 1 | DECOMP_INLINE, 0x5195}, + {0x2F8D4, 0, 1 | DECOMP_INLINE, 0x6700}, + {0x2F8D5, 0, 1 | DECOMP_INLINE, 0x669C}, + {0x2F8D6, 0, 1 | DECOMP_INLINE, 0x80AD}, + {0x2F8D7, 0, 1 | DECOMP_INLINE, 0x43D9}, + {0x2F8D8, 0, 1 | DECOMP_INLINE, 0x6717}, + {0x2F8D9, 0, 1 | DECOMP_INLINE, 0x671B}, + {0x2F8DA, 0, 1 | DECOMP_INLINE, 0x6721}, + {0x2F8DB, 0, 1 | DECOMP_INLINE, 0x675E}, + {0x2F8DC, 0, 1 | DECOMP_INLINE, 0x6753}, + {0x2F8DD, 0, 1, 5057}, + {0x2F8DE, 0, 1 | DECOMP_INLINE, 0x3B49}, + {0x2F8DF, 0, 1 | DECOMP_INLINE, 0x67FA}, + {0x2F8E0, 0, 1 | DECOMP_INLINE, 0x6785}, + {0x2F8E1, 0, 1 | DECOMP_INLINE, 0x6852}, + {0x2F8E2, 0, 1 | DECOMP_INLINE, 0x6885}, + {0x2F8E3, 0, 1, 5058}, + {0x2F8E4, 0, 1 | DECOMP_INLINE, 0x688E}, + {0x2F8E5, 0, 1 | DECOMP_INLINE, 0x681F}, + {0x2F8E6, 0, 1 | DECOMP_INLINE, 0x6914}, + {0x2F8E7, 0, 1 | DECOMP_INLINE, 0x3B9D}, + {0x2F8E8, 0, 1 | DECOMP_INLINE, 0x6942}, + {0x2F8E9, 0, 1 | DECOMP_INLINE, 0x69A3}, + {0x2F8EA, 0, 1 | DECOMP_INLINE, 0x69EA}, + {0x2F8EB, 0, 1 | DECOMP_INLINE, 0x6AA8}, + {0x2F8EC, 0, 1, 5059}, + {0x2F8ED, 0, 1 | DECOMP_INLINE, 0x6ADB}, + {0x2F8EE, 0, 1 | DECOMP_INLINE, 0x3C18}, + {0x2F8EF, 0, 1 | DECOMP_INLINE, 0x6B21}, + {0x2F8F0, 0, 1, 5060}, + {0x2F8F1, 0, 1 | DECOMP_INLINE, 0x6B54}, + {0x2F8F2, 0, 1 | DECOMP_INLINE, 0x3C4E}, + {0x2F8F3, 0, 1 | DECOMP_INLINE, 0x6B72}, + {0x2F8F4, 0, 1 | DECOMP_INLINE, 0x6B9F}, + {0x2F8F5, 0, 1 | DECOMP_INLINE, 0x6BBA}, + {0x2F8F6, 0, 1 | DECOMP_INLINE, 0x6BBB}, + {0x2F8F7, 0, 1, 5061}, + {0x2F8F8, 0, 1, 5062}, + {0x2F8F9, 0, 1, 5063}, + {0x2F8FA, 0, 1 | DECOMP_INLINE, 0x6C4E}, + {0x2F8FB, 0, 1, 5064}, + {0x2F8FC, 0, 1 | DECOMP_INLINE, 0x6CBF}, + {0x2F8FD, 0, 1 | DECOMP_INLINE, 0x6CCD}, + {0x2F8FE, 0, 1 | DECOMP_INLINE, 0x6C67}, + {0x2F8FF, 0, 1 | DECOMP_INLINE, 0x6D16}, + {0x2F900, 0, 1 | DECOMP_INLINE, 0x6D3E}, + {0x2F901, 0, 1 | DECOMP_INLINE, 0x6D77}, + {0x2F902, 0, 1 | DECOMP_INLINE, 0x6D41}, + {0x2F903, 0, 1 | DECOMP_INLINE, 0x6D69}, + {0x2F904, 0, 1 | DECOMP_INLINE, 0x6D78}, + {0x2F905, 0, 1 | DECOMP_INLINE, 0x6D85}, + {0x2F906, 0, 1, 5065}, + {0x2F907, 0, 1 | DECOMP_INLINE, 0x6D34}, + {0x2F908, 0, 1 | DECOMP_INLINE, 0x6E2F}, + {0x2F909, 0, 1 | DECOMP_INLINE, 0x6E6E}, + {0x2F90A, 0, 1 | DECOMP_INLINE, 0x3D33}, + {0x2F90B, 0, 1 | DECOMP_INLINE, 0x6ECB}, + {0x2F90C, 0, 1 | DECOMP_INLINE, 0x6EC7}, + {0x2F90D, 0, 1, 5066}, + {0x2F90E, 0, 1 | DECOMP_INLINE, 0x6DF9}, + {0x2F90F, 0, 1 | DECOMP_INLINE, 0x6F6E}, + {0x2F910, 0, 1, 5067}, + {0x2F911, 0, 1, 5068}, + {0x2F912, 0, 1 | DECOMP_INLINE, 0x6FC6}, + {0x2F913, 0, 1 | DECOMP_INLINE, 0x7039}, + {0x2F914, 0, 1 | DECOMP_INLINE, 0x701E}, + {0x2F915, 0, 1 | DECOMP_INLINE, 0x701B}, + {0x2F916, 0, 1 | DECOMP_INLINE, 0x3D96}, + {0x2F917, 0, 1 | DECOMP_INLINE, 0x704A}, + {0x2F918, 0, 1 | DECOMP_INLINE, 0x707D}, + {0x2F919, 0, 1 | DECOMP_INLINE, 0x7077}, + {0x2F91A, 0, 1 | DECOMP_INLINE, 0x70AD}, + {0x2F91B, 0, 1, 5069}, + {0x2F91C, 0, 1 | DECOMP_INLINE, 0x7145}, + {0x2F91D, 0, 1, 5070}, + {0x2F91E, 0, 1 | DECOMP_INLINE, 0x719C}, + {0x2F91F, 0, 1, 5071}, + {0x2F920, 0, 1 | DECOMP_INLINE, 0x7228}, + {0x2F921, 0, 1 | DECOMP_INLINE, 0x7235}, + {0x2F922, 0, 1 | DECOMP_INLINE, 0x7250}, + {0x2F923, 0, 1, 5072}, + {0x2F924, 0, 1 | DECOMP_INLINE, 0x7280}, + {0x2F925, 0, 1 | DECOMP_INLINE, 0x7295}, + {0x2F926, 0, 1, 5073}, + {0x2F927, 0, 1, 5074}, + {0x2F928, 0, 1 | DECOMP_INLINE, 0x737A}, + {0x2F929, 0, 1 | DECOMP_INLINE, 0x738B}, + {0x2F92A, 0, 1 | DECOMP_INLINE, 0x3EAC}, + {0x2F92B, 0, 1 | DECOMP_INLINE, 0x73A5}, + {0x2F92C, 0, 1 | DECOMP_INLINE, 0x3EB8}, + {0x2F92D, 0, 1 | DECOMP_INLINE, 0x3EB8}, + {0x2F92E, 0, 1 | DECOMP_INLINE, 0x7447}, + {0x2F92F, 0, 1 | DECOMP_INLINE, 0x745C}, + {0x2F930, 0, 1 | DECOMP_INLINE, 0x7471}, + {0x2F931, 0, 1 | DECOMP_INLINE, 0x7485}, + {0x2F932, 0, 1 | DECOMP_INLINE, 0x74CA}, + {0x2F933, 0, 1 | DECOMP_INLINE, 0x3F1B}, + {0x2F934, 0, 1 | DECOMP_INLINE, 0x7524}, + {0x2F935, 0, 1, 5075}, + {0x2F936, 0, 1 | DECOMP_INLINE, 0x753E}, + {0x2F937, 0, 1, 5076}, + {0x2F938, 0, 1 | DECOMP_INLINE, 0x7570}, + {0x2F939, 0, 1, 5077}, + {0x2F93A, 0, 1 | DECOMP_INLINE, 0x7610}, + {0x2F93B, 0, 1, 5078}, + {0x2F93C, 0, 1, 5079}, + {0x2F93D, 0, 1, 5080}, + {0x2F93E, 0, 1 | DECOMP_INLINE, 0x3FFC}, + {0x2F93F, 0, 1 | DECOMP_INLINE, 0x4008}, + {0x2F940, 0, 1 | DECOMP_INLINE, 0x76F4}, + {0x2F941, 0, 1, 5081}, + {0x2F942, 0, 1, 5082}, + {0x2F943, 0, 1, 5083}, + {0x2F944, 0, 1, 5084}, + {0x2F945, 0, 1 | DECOMP_INLINE, 0x771E}, + {0x2F946, 0, 1 | DECOMP_INLINE, 0x771F}, + {0x2F947, 0, 1 | DECOMP_INLINE, 0x771F}, + {0x2F948, 0, 1 | DECOMP_INLINE, 0x774A}, + {0x2F949, 0, 1 | DECOMP_INLINE, 0x4039}, + {0x2F94A, 0, 1 | DECOMP_INLINE, 0x778B}, + {0x2F94B, 0, 1 | DECOMP_INLINE, 0x4046}, + {0x2F94C, 0, 1 | DECOMP_INLINE, 0x4096}, + {0x2F94D, 0, 1, 5085}, + {0x2F94E, 0, 1 | DECOMP_INLINE, 0x784E}, + {0x2F94F, 0, 1 | DECOMP_INLINE, 0x788C}, + {0x2F950, 0, 1 | DECOMP_INLINE, 0x78CC}, + {0x2F951, 0, 1 | DECOMP_INLINE, 0x40E3}, + {0x2F952, 0, 1, 5086}, + {0x2F953, 0, 1 | DECOMP_INLINE, 0x7956}, + {0x2F954, 0, 1, 5087}, + {0x2F955, 0, 1, 5088}, + {0x2F956, 0, 1 | DECOMP_INLINE, 0x798F}, + {0x2F957, 0, 1 | DECOMP_INLINE, 0x79EB}, + {0x2F958, 0, 1 | DECOMP_INLINE, 0x412F}, + {0x2F959, 0, 1 | DECOMP_INLINE, 0x7A40}, + {0x2F95A, 0, 1 | DECOMP_INLINE, 0x7A4A}, + {0x2F95B, 0, 1 | DECOMP_INLINE, 0x7A4F}, + {0x2F95C, 0, 1, 5089}, + {0x2F95D, 0, 1, 5090}, + {0x2F95E, 0, 1, 5091}, + {0x2F95F, 0, 1 | DECOMP_INLINE, 0x7AEE}, + {0x2F960, 0, 1 | DECOMP_INLINE, 0x4202}, + {0x2F961, 0, 1, 5092}, + {0x2F962, 0, 1 | DECOMP_INLINE, 0x7BC6}, + {0x2F963, 0, 1 | DECOMP_INLINE, 0x7BC9}, + {0x2F964, 0, 1 | DECOMP_INLINE, 0x4227}, + {0x2F965, 0, 1, 5093}, + {0x2F966, 0, 1 | DECOMP_INLINE, 0x7CD2}, + {0x2F967, 0, 1 | DECOMP_INLINE, 0x42A0}, + {0x2F968, 0, 1 | DECOMP_INLINE, 0x7CE8}, + {0x2F969, 0, 1 | DECOMP_INLINE, 0x7CE3}, + {0x2F96A, 0, 1 | DECOMP_INLINE, 0x7D00}, + {0x2F96B, 0, 1, 5094}, + {0x2F96C, 0, 1 | DECOMP_INLINE, 0x7D63}, + {0x2F96D, 0, 1 | DECOMP_INLINE, 0x4301}, + {0x2F96E, 0, 1 | DECOMP_INLINE, 0x7DC7}, + {0x2F96F, 0, 1 | DECOMP_INLINE, 0x7E02}, + {0x2F970, 0, 1 | DECOMP_INLINE, 0x7E45}, + {0x2F971, 0, 1 | DECOMP_INLINE, 0x4334}, + {0x2F972, 0, 1, 5095}, + {0x2F973, 0, 1, 5096}, + {0x2F974, 0, 1 | DECOMP_INLINE, 0x4359}, + {0x2F975, 0, 1, 5097}, + {0x2F976, 0, 1 | DECOMP_INLINE, 0x7F7A}, + {0x2F977, 0, 1, 5098}, + {0x2F978, 0, 1 | DECOMP_INLINE, 0x7F95}, + {0x2F979, 0, 1 | DECOMP_INLINE, 0x7FFA}, + {0x2F97A, 0, 1 | DECOMP_INLINE, 0x8005}, + {0x2F97B, 0, 1, 5099}, + {0x2F97C, 0, 1, 5100}, + {0x2F97D, 0, 1 | DECOMP_INLINE, 0x8060}, + {0x2F97E, 0, 1, 5101}, + {0x2F97F, 0, 1 | DECOMP_INLINE, 0x8070}, + {0x2F980, 0, 1, 5102}, + {0x2F981, 0, 1 | DECOMP_INLINE, 0x43D5}, + {0x2F982, 0, 1 | DECOMP_INLINE, 0x80B2}, + {0x2F983, 0, 1 | DECOMP_INLINE, 0x8103}, + {0x2F984, 0, 1 | DECOMP_INLINE, 0x440B}, + {0x2F985, 0, 1 | DECOMP_INLINE, 0x813E}, + {0x2F986, 0, 1 | DECOMP_INLINE, 0x5AB5}, + {0x2F987, 0, 1, 5103}, + {0x2F988, 0, 1, 5104}, + {0x2F989, 0, 1, 5105}, + {0x2F98A, 0, 1, 5106}, + {0x2F98B, 0, 1 | DECOMP_INLINE, 0x8201}, + {0x2F98C, 0, 1 | DECOMP_INLINE, 0x8204}, + {0x2F98D, 0, 1 | DECOMP_INLINE, 0x8F9E}, + {0x2F98E, 0, 1 | DECOMP_INLINE, 0x446B}, + {0x2F98F, 0, 1 | DECOMP_INLINE, 0x8291}, + {0x2F990, 0, 1 | DECOMP_INLINE, 0x828B}, + {0x2F991, 0, 1 | DECOMP_INLINE, 0x829D}, + {0x2F992, 0, 1 | DECOMP_INLINE, 0x52B3}, + {0x2F993, 0, 1 | DECOMP_INLINE, 0x82B1}, + {0x2F994, 0, 1 | DECOMP_INLINE, 0x82B3}, + {0x2F995, 0, 1 | DECOMP_INLINE, 0x82BD}, + {0x2F996, 0, 1 | DECOMP_INLINE, 0x82E6}, + {0x2F997, 0, 1, 5107}, + {0x2F998, 0, 1 | DECOMP_INLINE, 0x82E5}, + {0x2F999, 0, 1 | DECOMP_INLINE, 0x831D}, + {0x2F99A, 0, 1 | DECOMP_INLINE, 0x8363}, + {0x2F99B, 0, 1 | DECOMP_INLINE, 0x83AD}, + {0x2F99C, 0, 1 | DECOMP_INLINE, 0x8323}, + {0x2F99D, 0, 1 | DECOMP_INLINE, 0x83BD}, + {0x2F99E, 0, 1 | DECOMP_INLINE, 0x83E7}, + {0x2F99F, 0, 1 | DECOMP_INLINE, 0x8457}, + {0x2F9A0, 0, 1 | DECOMP_INLINE, 0x8353}, + {0x2F9A1, 0, 1 | DECOMP_INLINE, 0x83CA}, + {0x2F9A2, 0, 1 | DECOMP_INLINE, 0x83CC}, + {0x2F9A3, 0, 1 | DECOMP_INLINE, 0x83DC}, + {0x2F9A4, 0, 1, 5108}, + {0x2F9A5, 0, 1, 5109}, + {0x2F9A6, 0, 1, 5110}, + {0x2F9A7, 0, 1 | DECOMP_INLINE, 0x452B}, + {0x2F9A8, 0, 1 | DECOMP_INLINE, 0x84F1}, + {0x2F9A9, 0, 1 | DECOMP_INLINE, 0x84F3}, + {0x2F9AA, 0, 1 | DECOMP_INLINE, 0x8516}, + {0x2F9AB, 0, 1, 5111}, + {0x2F9AC, 0, 1 | DECOMP_INLINE, 0x8564}, + {0x2F9AD, 0, 1, 5112}, + {0x2F9AE, 0, 1 | DECOMP_INLINE, 0x455D}, + {0x2F9AF, 0, 1 | DECOMP_INLINE, 0x4561}, + {0x2F9B0, 0, 1, 5113}, + {0x2F9B1, 0, 1, 5114}, + {0x2F9B2, 0, 1 | DECOMP_INLINE, 0x456B}, + {0x2F9B3, 0, 1 | DECOMP_INLINE, 0x8650}, + {0x2F9B4, 0, 1 | DECOMP_INLINE, 0x865C}, + {0x2F9B5, 0, 1 | DECOMP_INLINE, 0x8667}, + {0x2F9B6, 0, 1 | DECOMP_INLINE, 0x8669}, + {0x2F9B7, 0, 1 | DECOMP_INLINE, 0x86A9}, + {0x2F9B8, 0, 1 | DECOMP_INLINE, 0x8688}, + {0x2F9B9, 0, 1 | DECOMP_INLINE, 0x870E}, + {0x2F9BA, 0, 1 | DECOMP_INLINE, 0x86E2}, + {0x2F9BB, 0, 1 | DECOMP_INLINE, 0x8779}, + {0x2F9BC, 0, 1 | DECOMP_INLINE, 0x8728}, + {0x2F9BD, 0, 1 | DECOMP_INLINE, 0x876B}, + {0x2F9BE, 0, 1 | DECOMP_INLINE, 0x8786}, + {0x2F9BF, 0, 1 | DECOMP_INLINE, 0x45D7}, + {0x2F9C0, 0, 1 | DECOMP_INLINE, 0x87E1}, + {0x2F9C1, 0, 1 | DECOMP_INLINE, 0x8801}, + {0x2F9C2, 0, 1 | DECOMP_INLINE, 0x45F9}, + {0x2F9C3, 0, 1 | DECOMP_INLINE, 0x8860}, + {0x2F9C4, 0, 1 | DECOMP_INLINE, 0x8863}, + {0x2F9C5, 0, 1, 5115}, + {0x2F9C6, 0, 1 | DECOMP_INLINE, 0x88D7}, + {0x2F9C7, 0, 1 | DECOMP_INLINE, 0x88DE}, + {0x2F9C8, 0, 1 | DECOMP_INLINE, 0x4635}, + {0x2F9C9, 0, 1 | DECOMP_INLINE, 0x88FA}, + {0x2F9CA, 0, 1 | DECOMP_INLINE, 0x34BB}, + {0x2F9CB, 0, 1, 5116}, + {0x2F9CC, 0, 1, 5117}, + {0x2F9CD, 0, 1 | DECOMP_INLINE, 0x46BE}, + {0x2F9CE, 0, 1 | DECOMP_INLINE, 0x46C7}, + {0x2F9CF, 0, 1 | DECOMP_INLINE, 0x8AA0}, + {0x2F9D0, 0, 1 | DECOMP_INLINE, 0x8AED}, + {0x2F9D1, 0, 1 | DECOMP_INLINE, 0x8B8A}, + {0x2F9D2, 0, 1 | DECOMP_INLINE, 0x8C55}, + {0x2F9D3, 0, 1, 5118}, + {0x2F9D4, 0, 1 | DECOMP_INLINE, 0x8CAB}, + {0x2F9D5, 0, 1 | DECOMP_INLINE, 0x8CC1}, + {0x2F9D6, 0, 1 | DECOMP_INLINE, 0x8D1B}, + {0x2F9D7, 0, 1 | DECOMP_INLINE, 0x8D77}, + {0x2F9D8, 0, 1, 5119}, + {0x2F9D9, 0, 1, 5120}, + {0x2F9DA, 0, 1 | DECOMP_INLINE, 0x8DCB}, + {0x2F9DB, 0, 1 | DECOMP_INLINE, 0x8DBC}, + {0x2F9DC, 0, 1 | DECOMP_INLINE, 0x8DF0}, + {0x2F9DD, 0, 1, 5121}, + {0x2F9DE, 0, 1 | DECOMP_INLINE, 0x8ED4}, + {0x2F9DF, 0, 1 | DECOMP_INLINE, 0x8F38}, + {0x2F9E0, 0, 1, 5122}, + {0x2F9E1, 0, 1, 5123}, + {0x2F9E2, 0, 1 | DECOMP_INLINE, 0x9094}, + {0x2F9E3, 0, 1 | DECOMP_INLINE, 0x90F1}, + {0x2F9E4, 0, 1 | DECOMP_INLINE, 0x9111}, + {0x2F9E5, 0, 1, 5124}, + {0x2F9E6, 0, 1 | DECOMP_INLINE, 0x911B}, + {0x2F9E7, 0, 1 | DECOMP_INLINE, 0x9238}, + {0x2F9E8, 0, 1 | DECOMP_INLINE, 0x92D7}, + {0x2F9E9, 0, 1 | DECOMP_INLINE, 0x92D8}, + {0x2F9EA, 0, 1 | DECOMP_INLINE, 0x927C}, + {0x2F9EB, 0, 1 | DECOMP_INLINE, 0x93F9}, + {0x2F9EC, 0, 1 | DECOMP_INLINE, 0x9415}, + {0x2F9ED, 0, 1, 5125}, + {0x2F9EE, 0, 1 | DECOMP_INLINE, 0x958B}, + {0x2F9EF, 0, 1 | DECOMP_INLINE, 0x4995}, + {0x2F9F0, 0, 1 | DECOMP_INLINE, 0x95B7}, + {0x2F9F1, 0, 1, 5126}, + {0x2F9F2, 0, 1 | DECOMP_INLINE, 0x49E6}, + {0x2F9F3, 0, 1 | DECOMP_INLINE, 0x96C3}, + {0x2F9F4, 0, 1 | DECOMP_INLINE, 0x5DB2}, + {0x2F9F5, 0, 1 | DECOMP_INLINE, 0x9723}, + {0x2F9F6, 0, 1, 5127}, + {0x2F9F7, 0, 1, 5128}, + {0x2F9F8, 0, 1 | DECOMP_INLINE, 0x4A6E}, + {0x2F9F9, 0, 1 | DECOMP_INLINE, 0x4A76}, + {0x2F9FA, 0, 1 | DECOMP_INLINE, 0x97E0}, + {0x2F9FB, 0, 1, 5129}, + {0x2F9FC, 0, 1 | DECOMP_INLINE, 0x4AB2}, + {0x2F9FD, 0, 1, 5130}, + {0x2F9FE, 0, 1 | DECOMP_INLINE, 0x980B}, + {0x2F9FF, 0, 1 | DECOMP_INLINE, 0x980B}, + {0x2FA00, 0, 1 | DECOMP_INLINE, 0x9829}, + {0x2FA01, 0, 1, 5131}, + {0x2FA02, 0, 1 | DECOMP_INLINE, 0x98E2}, + {0x2FA03, 0, 1 | DECOMP_INLINE, 0x4B33}, + {0x2FA04, 0, 1 | DECOMP_INLINE, 0x9929}, + {0x2FA05, 0, 1 | DECOMP_INLINE, 0x99A7}, + {0x2FA06, 0, 1 | DECOMP_INLINE, 0x99C2}, + {0x2FA07, 0, 1 | DECOMP_INLINE, 0x99FE}, + {0x2FA08, 0, 1 | DECOMP_INLINE, 0x4BCE}, + {0x2FA09, 0, 1, 5132}, + {0x2FA0A, 0, 1 | DECOMP_INLINE, 0x9B12}, + {0x2FA0B, 0, 1 | DECOMP_INLINE, 0x9C40}, + {0x2FA0C, 0, 1 | DECOMP_INLINE, 0x9CFD}, + {0x2FA0D, 0, 1 | DECOMP_INLINE, 0x4CCE}, + {0x2FA0E, 0, 1 | DECOMP_INLINE, 0x4CED}, + {0x2FA0F, 0, 1 | DECOMP_INLINE, 0x9D67}, + {0x2FA10, 0, 1, 5133}, + {0x2FA11, 0, 1 | DECOMP_INLINE, 0x4CF8}, + {0x2FA12, 0, 1, 5134}, + {0x2FA13, 0, 1, 5135}, + {0x2FA14, 0, 1, 5136}, + {0x2FA15, 0, 1 | DECOMP_INLINE, 0x9EBB}, + {0x2FA16, 0, 1 | DECOMP_INLINE, 0x4D56}, + {0x2FA17, 0, 1 | DECOMP_INLINE, 0x9EF9}, + {0x2FA18, 0, 1 | DECOMP_INLINE, 0x9EFE}, + {0x2FA19, 0, 1 | DECOMP_INLINE, 0x9F05}, + {0x2FA1A, 0, 1 | DECOMP_INLINE, 0x9F0F}, + {0x2FA1B, 0, 1 | DECOMP_INLINE, 0x9F16}, + {0x2FA1C, 0, 1 | DECOMP_INLINE, 0x9F3B}, + {0x2FA1D, 0, 1, 5137} + +}; + +/* codepoints array */ +static const uint32 UnicodeDecomp_codepoints[5138] = +{ + /* 0 */ 0x0020, 0x0308, + /* 2 */ 0x0020, 0x0304, + /* 4 */ 0x0020, 0x0301, + /* 6 */ 0x0020, 0x0327, + /* 8 */ 0x0031, 0x2044, 0x0034, + /* 11 */ 0x0031, 0x2044, 0x0032, + /* 14 */ 0x0033, 0x2044, 0x0034, + /* 17 */ 0x0041, 0x0300, + /* 19 */ 0x0041, 0x0301, + /* 21 */ 0x0041, 0x0302, + /* 23 */ 0x0041, 0x0303, + /* 25 */ 0x0041, 0x0308, + /* 27 */ 0x0041, 0x030A, + /* 29 */ 0x0043, 0x0327, + /* 31 */ 0x0045, 0x0300, + /* 33 */ 0x0045, 0x0301, + /* 35 */ 0x0045, 0x0302, + /* 37 */ 0x0045, 0x0308, + /* 39 */ 0x0049, 0x0300, + /* 41 */ 0x0049, 0x0301, + /* 43 */ 0x0049, 0x0302, + /* 45 */ 0x0049, 0x0308, + /* 47 */ 0x004E, 0x0303, + /* 49 */ 0x004F, 0x0300, + /* 51 */ 0x004F, 0x0301, + /* 53 */ 0x004F, 0x0302, + /* 55 */ 0x004F, 0x0303, + /* 57 */ 0x004F, 0x0308, + /* 59 */ 0x0055, 0x0300, + /* 61 */ 0x0055, 0x0301, + /* 63 */ 0x0055, 0x0302, + /* 65 */ 0x0055, 0x0308, + /* 67 */ 0x0059, 0x0301, + /* 69 */ 0x0061, 0x0300, + /* 71 */ 0x0061, 0x0301, + /* 73 */ 0x0061, 0x0302, + /* 75 */ 0x0061, 0x0303, + /* 77 */ 0x0061, 0x0308, + /* 79 */ 0x0061, 0x030A, + /* 81 */ 0x0063, 0x0327, + /* 83 */ 0x0065, 0x0300, + /* 85 */ 0x0065, 0x0301, + /* 87 */ 0x0065, 0x0302, + /* 89 */ 0x0065, 0x0308, + /* 91 */ 0x0069, 0x0300, + /* 93 */ 0x0069, 0x0301, + /* 95 */ 0x0069, 0x0302, + /* 97 */ 0x0069, 0x0308, + /* 99 */ 0x006E, 0x0303, + /* 101 */ 0x006F, 0x0300, + /* 103 */ 0x006F, 0x0301, + /* 105 */ 0x006F, 0x0302, + /* 107 */ 0x006F, 0x0303, + /* 109 */ 0x006F, 0x0308, + /* 111 */ 0x0075, 0x0300, + /* 113 */ 0x0075, 0x0301, + /* 115 */ 0x0075, 0x0302, + /* 117 */ 0x0075, 0x0308, + /* 119 */ 0x0079, 0x0301, + /* 121 */ 0x0079, 0x0308, + /* 123 */ 0x0041, 0x0304, + /* 125 */ 0x0061, 0x0304, + /* 127 */ 0x0041, 0x0306, + /* 129 */ 0x0061, 0x0306, + /* 131 */ 0x0041, 0x0328, + /* 133 */ 0x0061, 0x0328, + /* 135 */ 0x0043, 0x0301, + /* 137 */ 0x0063, 0x0301, + /* 139 */ 0x0043, 0x0302, + /* 141 */ 0x0063, 0x0302, + /* 143 */ 0x0043, 0x0307, + /* 145 */ 0x0063, 0x0307, + /* 147 */ 0x0043, 0x030C, + /* 149 */ 0x0063, 0x030C, + /* 151 */ 0x0044, 0x030C, + /* 153 */ 0x0064, 0x030C, + /* 155 */ 0x0045, 0x0304, + /* 157 */ 0x0065, 0x0304, + /* 159 */ 0x0045, 0x0306, + /* 161 */ 0x0065, 0x0306, + /* 163 */ 0x0045, 0x0307, + /* 165 */ 0x0065, 0x0307, + /* 167 */ 0x0045, 0x0328, + /* 169 */ 0x0065, 0x0328, + /* 171 */ 0x0045, 0x030C, + /* 173 */ 0x0065, 0x030C, + /* 175 */ 0x0047, 0x0302, + /* 177 */ 0x0067, 0x0302, + /* 179 */ 0x0047, 0x0306, + /* 181 */ 0x0067, 0x0306, + /* 183 */ 0x0047, 0x0307, + /* 185 */ 0x0067, 0x0307, + /* 187 */ 0x0047, 0x0327, + /* 189 */ 0x0067, 0x0327, + /* 191 */ 0x0048, 0x0302, + /* 193 */ 0x0068, 0x0302, + /* 195 */ 0x0049, 0x0303, + /* 197 */ 0x0069, 0x0303, + /* 199 */ 0x0049, 0x0304, + /* 201 */ 0x0069, 0x0304, + /* 203 */ 0x0049, 0x0306, + /* 205 */ 0x0069, 0x0306, + /* 207 */ 0x0049, 0x0328, + /* 209 */ 0x0069, 0x0328, + /* 211 */ 0x0049, 0x0307, + /* 213 */ 0x0049, 0x004A, + /* 215 */ 0x0069, 0x006A, + /* 217 */ 0x004A, 0x0302, + /* 219 */ 0x006A, 0x0302, + /* 221 */ 0x004B, 0x0327, + /* 223 */ 0x006B, 0x0327, + /* 225 */ 0x004C, 0x0301, + /* 227 */ 0x006C, 0x0301, + /* 229 */ 0x004C, 0x0327, + /* 231 */ 0x006C, 0x0327, + /* 233 */ 0x004C, 0x030C, + /* 235 */ 0x006C, 0x030C, + /* 237 */ 0x004C, 0x00B7, + /* 239 */ 0x006C, 0x00B7, + /* 241 */ 0x004E, 0x0301, + /* 243 */ 0x006E, 0x0301, + /* 245 */ 0x004E, 0x0327, + /* 247 */ 0x006E, 0x0327, + /* 249 */ 0x004E, 0x030C, + /* 251 */ 0x006E, 0x030C, + /* 253 */ 0x02BC, 0x006E, + /* 255 */ 0x004F, 0x0304, + /* 257 */ 0x006F, 0x0304, + /* 259 */ 0x004F, 0x0306, + /* 261 */ 0x006F, 0x0306, + /* 263 */ 0x004F, 0x030B, + /* 265 */ 0x006F, 0x030B, + /* 267 */ 0x0052, 0x0301, + /* 269 */ 0x0072, 0x0301, + /* 271 */ 0x0052, 0x0327, + /* 273 */ 0x0072, 0x0327, + /* 275 */ 0x0052, 0x030C, + /* 277 */ 0x0072, 0x030C, + /* 279 */ 0x0053, 0x0301, + /* 281 */ 0x0073, 0x0301, + /* 283 */ 0x0053, 0x0302, + /* 285 */ 0x0073, 0x0302, + /* 287 */ 0x0053, 0x0327, + /* 289 */ 0x0073, 0x0327, + /* 291 */ 0x0053, 0x030C, + /* 293 */ 0x0073, 0x030C, + /* 295 */ 0x0054, 0x0327, + /* 297 */ 0x0074, 0x0327, + /* 299 */ 0x0054, 0x030C, + /* 301 */ 0x0074, 0x030C, + /* 303 */ 0x0055, 0x0303, + /* 305 */ 0x0075, 0x0303, + /* 307 */ 0x0055, 0x0304, + /* 309 */ 0x0075, 0x0304, + /* 311 */ 0x0055, 0x0306, + /* 313 */ 0x0075, 0x0306, + /* 315 */ 0x0055, 0x030A, + /* 317 */ 0x0075, 0x030A, + /* 319 */ 0x0055, 0x030B, + /* 321 */ 0x0075, 0x030B, + /* 323 */ 0x0055, 0x0328, + /* 325 */ 0x0075, 0x0328, + /* 327 */ 0x0057, 0x0302, + /* 329 */ 0x0077, 0x0302, + /* 331 */ 0x0059, 0x0302, + /* 333 */ 0x0079, 0x0302, + /* 335 */ 0x0059, 0x0308, + /* 337 */ 0x005A, 0x0301, + /* 339 */ 0x007A, 0x0301, + /* 341 */ 0x005A, 0x0307, + /* 343 */ 0x007A, 0x0307, + /* 345 */ 0x005A, 0x030C, + /* 347 */ 0x007A, 0x030C, + /* 349 */ 0x004F, 0x031B, + /* 351 */ 0x006F, 0x031B, + /* 353 */ 0x0055, 0x031B, + /* 355 */ 0x0075, 0x031B, + /* 357 */ 0x0044, 0x017D, + /* 359 */ 0x0044, 0x017E, + /* 361 */ 0x0064, 0x017E, + /* 363 */ 0x004C, 0x004A, + /* 365 */ 0x004C, 0x006A, + /* 367 */ 0x006C, 0x006A, + /* 369 */ 0x004E, 0x004A, + /* 371 */ 0x004E, 0x006A, + /* 373 */ 0x006E, 0x006A, + /* 375 */ 0x0041, 0x030C, + /* 377 */ 0x0061, 0x030C, + /* 379 */ 0x0049, 0x030C, + /* 381 */ 0x0069, 0x030C, + /* 383 */ 0x004F, 0x030C, + /* 385 */ 0x006F, 0x030C, + /* 387 */ 0x0055, 0x030C, + /* 389 */ 0x0075, 0x030C, + /* 391 */ 0x00DC, 0x0304, + /* 393 */ 0x00FC, 0x0304, + /* 395 */ 0x00DC, 0x0301, + /* 397 */ 0x00FC, 0x0301, + /* 399 */ 0x00DC, 0x030C, + /* 401 */ 0x00FC, 0x030C, + /* 403 */ 0x00DC, 0x0300, + /* 405 */ 0x00FC, 0x0300, + /* 407 */ 0x00C4, 0x0304, + /* 409 */ 0x00E4, 0x0304, + /* 411 */ 0x0226, 0x0304, + /* 413 */ 0x0227, 0x0304, + /* 415 */ 0x00C6, 0x0304, + /* 417 */ 0x00E6, 0x0304, + /* 419 */ 0x0047, 0x030C, + /* 421 */ 0x0067, 0x030C, + /* 423 */ 0x004B, 0x030C, + /* 425 */ 0x006B, 0x030C, + /* 427 */ 0x004F, 0x0328, + /* 429 */ 0x006F, 0x0328, + /* 431 */ 0x01EA, 0x0304, + /* 433 */ 0x01EB, 0x0304, + /* 435 */ 0x01B7, 0x030C, + /* 437 */ 0x0292, 0x030C, + /* 439 */ 0x006A, 0x030C, + /* 441 */ 0x0044, 0x005A, + /* 443 */ 0x0044, 0x007A, + /* 445 */ 0x0064, 0x007A, + /* 447 */ 0x0047, 0x0301, + /* 449 */ 0x0067, 0x0301, + /* 451 */ 0x004E, 0x0300, + /* 453 */ 0x006E, 0x0300, + /* 455 */ 0x00C5, 0x0301, + /* 457 */ 0x00E5, 0x0301, + /* 459 */ 0x00C6, 0x0301, + /* 461 */ 0x00E6, 0x0301, + /* 463 */ 0x00D8, 0x0301, + /* 465 */ 0x00F8, 0x0301, + /* 467 */ 0x0041, 0x030F, + /* 469 */ 0x0061, 0x030F, + /* 471 */ 0x0041, 0x0311, + /* 473 */ 0x0061, 0x0311, + /* 475 */ 0x0045, 0x030F, + /* 477 */ 0x0065, 0x030F, + /* 479 */ 0x0045, 0x0311, + /* 481 */ 0x0065, 0x0311, + /* 483 */ 0x0049, 0x030F, + /* 485 */ 0x0069, 0x030F, + /* 487 */ 0x0049, 0x0311, + /* 489 */ 0x0069, 0x0311, + /* 491 */ 0x004F, 0x030F, + /* 493 */ 0x006F, 0x030F, + /* 495 */ 0x004F, 0x0311, + /* 497 */ 0x006F, 0x0311, + /* 499 */ 0x0052, 0x030F, + /* 501 */ 0x0072, 0x030F, + /* 503 */ 0x0052, 0x0311, + /* 505 */ 0x0072, 0x0311, + /* 507 */ 0x0055, 0x030F, + /* 509 */ 0x0075, 0x030F, + /* 511 */ 0x0055, 0x0311, + /* 513 */ 0x0075, 0x0311, + /* 515 */ 0x0053, 0x0326, + /* 517 */ 0x0073, 0x0326, + /* 519 */ 0x0054, 0x0326, + /* 521 */ 0x0074, 0x0326, + /* 523 */ 0x0048, 0x030C, + /* 525 */ 0x0068, 0x030C, + /* 527 */ 0x0041, 0x0307, + /* 529 */ 0x0061, 0x0307, + /* 531 */ 0x0045, 0x0327, + /* 533 */ 0x0065, 0x0327, + /* 535 */ 0x00D6, 0x0304, + /* 537 */ 0x00F6, 0x0304, + /* 539 */ 0x00D5, 0x0304, + /* 541 */ 0x00F5, 0x0304, + /* 543 */ 0x004F, 0x0307, + /* 545 */ 0x006F, 0x0307, + /* 547 */ 0x022E, 0x0304, + /* 549 */ 0x022F, 0x0304, + /* 551 */ 0x0059, 0x0304, + /* 553 */ 0x0079, 0x0304, + /* 555 */ 0x0020, 0x0306, + /* 557 */ 0x0020, 0x0307, + /* 559 */ 0x0020, 0x030A, + /* 561 */ 0x0020, 0x0328, + /* 563 */ 0x0020, 0x0303, + /* 565 */ 0x0020, 0x030B, + /* 567 */ 0x0308, 0x0301, + /* 569 */ 0x0020, 0x0345, + /* 571 */ 0x0020, 0x0301, + /* 573 */ 0x00A8, 0x0301, + /* 575 */ 0x0391, 0x0301, + /* 577 */ 0x0395, 0x0301, + /* 579 */ 0x0397, 0x0301, + /* 581 */ 0x0399, 0x0301, + /* 583 */ 0x039F, 0x0301, + /* 585 */ 0x03A5, 0x0301, + /* 587 */ 0x03A9, 0x0301, + /* 589 */ 0x03CA, 0x0301, + /* 591 */ 0x0399, 0x0308, + /* 593 */ 0x03A5, 0x0308, + /* 595 */ 0x03B1, 0x0301, + /* 597 */ 0x03B5, 0x0301, + /* 599 */ 0x03B7, 0x0301, + /* 601 */ 0x03B9, 0x0301, + /* 603 */ 0x03CB, 0x0301, + /* 605 */ 0x03B9, 0x0308, + /* 607 */ 0x03C5, 0x0308, + /* 609 */ 0x03BF, 0x0301, + /* 611 */ 0x03C5, 0x0301, + /* 613 */ 0x03C9, 0x0301, + /* 615 */ 0x03D2, 0x0301, + /* 617 */ 0x03D2, 0x0308, + /* 619 */ 0x0415, 0x0300, + /* 621 */ 0x0415, 0x0308, + /* 623 */ 0x0413, 0x0301, + /* 625 */ 0x0406, 0x0308, + /* 627 */ 0x041A, 0x0301, + /* 629 */ 0x0418, 0x0300, + /* 631 */ 0x0423, 0x0306, + /* 633 */ 0x0418, 0x0306, + /* 635 */ 0x0438, 0x0306, + /* 637 */ 0x0435, 0x0300, + /* 639 */ 0x0435, 0x0308, + /* 641 */ 0x0433, 0x0301, + /* 643 */ 0x0456, 0x0308, + /* 645 */ 0x043A, 0x0301, + /* 647 */ 0x0438, 0x0300, + /* 649 */ 0x0443, 0x0306, + /* 651 */ 0x0474, 0x030F, + /* 653 */ 0x0475, 0x030F, + /* 655 */ 0x0416, 0x0306, + /* 657 */ 0x0436, 0x0306, + /* 659 */ 0x0410, 0x0306, + /* 661 */ 0x0430, 0x0306, + /* 663 */ 0x0410, 0x0308, + /* 665 */ 0x0430, 0x0308, + /* 667 */ 0x0415, 0x0306, + /* 669 */ 0x0435, 0x0306, + /* 671 */ 0x04D8, 0x0308, + /* 673 */ 0x04D9, 0x0308, + /* 675 */ 0x0416, 0x0308, + /* 677 */ 0x0436, 0x0308, + /* 679 */ 0x0417, 0x0308, + /* 681 */ 0x0437, 0x0308, + /* 683 */ 0x0418, 0x0304, + /* 685 */ 0x0438, 0x0304, + /* 687 */ 0x0418, 0x0308, + /* 689 */ 0x0438, 0x0308, + /* 691 */ 0x041E, 0x0308, + /* 693 */ 0x043E, 0x0308, + /* 695 */ 0x04E8, 0x0308, + /* 697 */ 0x04E9, 0x0308, + /* 699 */ 0x042D, 0x0308, + /* 701 */ 0x044D, 0x0308, + /* 703 */ 0x0423, 0x0304, + /* 705 */ 0x0443, 0x0304, + /* 707 */ 0x0423, 0x0308, + /* 709 */ 0x0443, 0x0308, + /* 711 */ 0x0423, 0x030B, + /* 713 */ 0x0443, 0x030B, + /* 715 */ 0x0427, 0x0308, + /* 717 */ 0x0447, 0x0308, + /* 719 */ 0x042B, 0x0308, + /* 721 */ 0x044B, 0x0308, + /* 723 */ 0x0565, 0x0582, + /* 725 */ 0x0627, 0x0653, + /* 727 */ 0x0627, 0x0654, + /* 729 */ 0x0648, 0x0654, + /* 731 */ 0x0627, 0x0655, + /* 733 */ 0x064A, 0x0654, + /* 735 */ 0x0627, 0x0674, + /* 737 */ 0x0648, 0x0674, + /* 739 */ 0x06C7, 0x0674, + /* 741 */ 0x064A, 0x0674, + /* 743 */ 0x06D5, 0x0654, + /* 745 */ 0x06C1, 0x0654, + /* 747 */ 0x06D2, 0x0654, + /* 749 */ 0x0928, 0x093C, + /* 751 */ 0x0930, 0x093C, + /* 753 */ 0x0933, 0x093C, + /* 755 */ 0x0915, 0x093C, + /* 757 */ 0x0916, 0x093C, + /* 759 */ 0x0917, 0x093C, + /* 761 */ 0x091C, 0x093C, + /* 763 */ 0x0921, 0x093C, + /* 765 */ 0x0922, 0x093C, + /* 767 */ 0x092B, 0x093C, + /* 769 */ 0x092F, 0x093C, + /* 771 */ 0x09C7, 0x09BE, + /* 773 */ 0x09C7, 0x09D7, + /* 775 */ 0x09A1, 0x09BC, + /* 777 */ 0x09A2, 0x09BC, + /* 779 */ 0x09AF, 0x09BC, + /* 781 */ 0x0A32, 0x0A3C, + /* 783 */ 0x0A38, 0x0A3C, + /* 785 */ 0x0A16, 0x0A3C, + /* 787 */ 0x0A17, 0x0A3C, + /* 789 */ 0x0A1C, 0x0A3C, + /* 791 */ 0x0A2B, 0x0A3C, + /* 793 */ 0x0B47, 0x0B56, + /* 795 */ 0x0B47, 0x0B3E, + /* 797 */ 0x0B47, 0x0B57, + /* 799 */ 0x0B21, 0x0B3C, + /* 801 */ 0x0B22, 0x0B3C, + /* 803 */ 0x0B92, 0x0BD7, + /* 805 */ 0x0BC6, 0x0BBE, + /* 807 */ 0x0BC7, 0x0BBE, + /* 809 */ 0x0BC6, 0x0BD7, + /* 811 */ 0x0C46, 0x0C56, + /* 813 */ 0x0CBF, 0x0CD5, + /* 815 */ 0x0CC6, 0x0CD5, + /* 817 */ 0x0CC6, 0x0CD6, + /* 819 */ 0x0CC6, 0x0CC2, + /* 821 */ 0x0CCA, 0x0CD5, + /* 823 */ 0x0D46, 0x0D3E, + /* 825 */ 0x0D47, 0x0D3E, + /* 827 */ 0x0D46, 0x0D57, + /* 829 */ 0x0DD9, 0x0DCA, + /* 831 */ 0x0DD9, 0x0DCF, + /* 833 */ 0x0DDC, 0x0DCA, + /* 835 */ 0x0DD9, 0x0DDF, + /* 837 */ 0x0E4D, 0x0E32, + /* 839 */ 0x0ECD, 0x0EB2, + /* 841 */ 0x0EAB, 0x0E99, + /* 843 */ 0x0EAB, 0x0EA1, + /* 845 */ 0x0F42, 0x0FB7, + /* 847 */ 0x0F4C, 0x0FB7, + /* 849 */ 0x0F51, 0x0FB7, + /* 851 */ 0x0F56, 0x0FB7, + /* 853 */ 0x0F5B, 0x0FB7, + /* 855 */ 0x0F40, 0x0FB5, + /* 857 */ 0x0F71, 0x0F72, + /* 859 */ 0x0F71, 0x0F74, + /* 861 */ 0x0FB2, 0x0F80, + /* 863 */ 0x0FB2, 0x0F81, + /* 865 */ 0x0FB3, 0x0F80, + /* 867 */ 0x0FB3, 0x0F81, + /* 869 */ 0x0F71, 0x0F80, + /* 871 */ 0x0F92, 0x0FB7, + /* 873 */ 0x0F9C, 0x0FB7, + /* 875 */ 0x0FA1, 0x0FB7, + /* 877 */ 0x0FA6, 0x0FB7, + /* 879 */ 0x0FAB, 0x0FB7, + /* 881 */ 0x0F90, 0x0FB5, + /* 883 */ 0x1025, 0x102E, + /* 885 */ 0x1B05, 0x1B35, + /* 887 */ 0x1B07, 0x1B35, + /* 889 */ 0x1B09, 0x1B35, + /* 891 */ 0x1B0B, 0x1B35, + /* 893 */ 0x1B0D, 0x1B35, + /* 895 */ 0x1B11, 0x1B35, + /* 897 */ 0x1B3A, 0x1B35, + /* 899 */ 0x1B3C, 0x1B35, + /* 901 */ 0x1B3E, 0x1B35, + /* 903 */ 0x1B3F, 0x1B35, + /* 905 */ 0x1B42, 0x1B35, + /* 907 */ 0x0041, 0x0325, + /* 909 */ 0x0061, 0x0325, + /* 911 */ 0x0042, 0x0307, + /* 913 */ 0x0062, 0x0307, + /* 915 */ 0x0042, 0x0323, + /* 917 */ 0x0062, 0x0323, + /* 919 */ 0x0042, 0x0331, + /* 921 */ 0x0062, 0x0331, + /* 923 */ 0x00C7, 0x0301, + /* 925 */ 0x00E7, 0x0301, + /* 927 */ 0x0044, 0x0307, + /* 929 */ 0x0064, 0x0307, + /* 931 */ 0x0044, 0x0323, + /* 933 */ 0x0064, 0x0323, + /* 935 */ 0x0044, 0x0331, + /* 937 */ 0x0064, 0x0331, + /* 939 */ 0x0044, 0x0327, + /* 941 */ 0x0064, 0x0327, + /* 943 */ 0x0044, 0x032D, + /* 945 */ 0x0064, 0x032D, + /* 947 */ 0x0112, 0x0300, + /* 949 */ 0x0113, 0x0300, + /* 951 */ 0x0112, 0x0301, + /* 953 */ 0x0113, 0x0301, + /* 955 */ 0x0045, 0x032D, + /* 957 */ 0x0065, 0x032D, + /* 959 */ 0x0045, 0x0330, + /* 961 */ 0x0065, 0x0330, + /* 963 */ 0x0228, 0x0306, + /* 965 */ 0x0229, 0x0306, + /* 967 */ 0x0046, 0x0307, + /* 969 */ 0x0066, 0x0307, + /* 971 */ 0x0047, 0x0304, + /* 973 */ 0x0067, 0x0304, + /* 975 */ 0x0048, 0x0307, + /* 977 */ 0x0068, 0x0307, + /* 979 */ 0x0048, 0x0323, + /* 981 */ 0x0068, 0x0323, + /* 983 */ 0x0048, 0x0308, + /* 985 */ 0x0068, 0x0308, + /* 987 */ 0x0048, 0x0327, + /* 989 */ 0x0068, 0x0327, + /* 991 */ 0x0048, 0x032E, + /* 993 */ 0x0068, 0x032E, + /* 995 */ 0x0049, 0x0330, + /* 997 */ 0x0069, 0x0330, + /* 999 */ 0x00CF, 0x0301, + /* 1001 */ 0x00EF, 0x0301, + /* 1003 */ 0x004B, 0x0301, + /* 1005 */ 0x006B, 0x0301, + /* 1007 */ 0x004B, 0x0323, + /* 1009 */ 0x006B, 0x0323, + /* 1011 */ 0x004B, 0x0331, + /* 1013 */ 0x006B, 0x0331, + /* 1015 */ 0x004C, 0x0323, + /* 1017 */ 0x006C, 0x0323, + /* 1019 */ 0x1E36, 0x0304, + /* 1021 */ 0x1E37, 0x0304, + /* 1023 */ 0x004C, 0x0331, + /* 1025 */ 0x006C, 0x0331, + /* 1027 */ 0x004C, 0x032D, + /* 1029 */ 0x006C, 0x032D, + /* 1031 */ 0x004D, 0x0301, + /* 1033 */ 0x006D, 0x0301, + /* 1035 */ 0x004D, 0x0307, + /* 1037 */ 0x006D, 0x0307, + /* 1039 */ 0x004D, 0x0323, + /* 1041 */ 0x006D, 0x0323, + /* 1043 */ 0x004E, 0x0307, + /* 1045 */ 0x006E, 0x0307, + /* 1047 */ 0x004E, 0x0323, + /* 1049 */ 0x006E, 0x0323, + /* 1051 */ 0x004E, 0x0331, + /* 1053 */ 0x006E, 0x0331, + /* 1055 */ 0x004E, 0x032D, + /* 1057 */ 0x006E, 0x032D, + /* 1059 */ 0x00D5, 0x0301, + /* 1061 */ 0x00F5, 0x0301, + /* 1063 */ 0x00D5, 0x0308, + /* 1065 */ 0x00F5, 0x0308, + /* 1067 */ 0x014C, 0x0300, + /* 1069 */ 0x014D, 0x0300, + /* 1071 */ 0x014C, 0x0301, + /* 1073 */ 0x014D, 0x0301, + /* 1075 */ 0x0050, 0x0301, + /* 1077 */ 0x0070, 0x0301, + /* 1079 */ 0x0050, 0x0307, + /* 1081 */ 0x0070, 0x0307, + /* 1083 */ 0x0052, 0x0307, + /* 1085 */ 0x0072, 0x0307, + /* 1087 */ 0x0052, 0x0323, + /* 1089 */ 0x0072, 0x0323, + /* 1091 */ 0x1E5A, 0x0304, + /* 1093 */ 0x1E5B, 0x0304, + /* 1095 */ 0x0052, 0x0331, + /* 1097 */ 0x0072, 0x0331, + /* 1099 */ 0x0053, 0x0307, + /* 1101 */ 0x0073, 0x0307, + /* 1103 */ 0x0053, 0x0323, + /* 1105 */ 0x0073, 0x0323, + /* 1107 */ 0x015A, 0x0307, + /* 1109 */ 0x015B, 0x0307, + /* 1111 */ 0x0160, 0x0307, + /* 1113 */ 0x0161, 0x0307, + /* 1115 */ 0x1E62, 0x0307, + /* 1117 */ 0x1E63, 0x0307, + /* 1119 */ 0x0054, 0x0307, + /* 1121 */ 0x0074, 0x0307, + /* 1123 */ 0x0054, 0x0323, + /* 1125 */ 0x0074, 0x0323, + /* 1127 */ 0x0054, 0x0331, + /* 1129 */ 0x0074, 0x0331, + /* 1131 */ 0x0054, 0x032D, + /* 1133 */ 0x0074, 0x032D, + /* 1135 */ 0x0055, 0x0324, + /* 1137 */ 0x0075, 0x0324, + /* 1139 */ 0x0055, 0x0330, + /* 1141 */ 0x0075, 0x0330, + /* 1143 */ 0x0055, 0x032D, + /* 1145 */ 0x0075, 0x032D, + /* 1147 */ 0x0168, 0x0301, + /* 1149 */ 0x0169, 0x0301, + /* 1151 */ 0x016A, 0x0308, + /* 1153 */ 0x016B, 0x0308, + /* 1155 */ 0x0056, 0x0303, + /* 1157 */ 0x0076, 0x0303, + /* 1159 */ 0x0056, 0x0323, + /* 1161 */ 0x0076, 0x0323, + /* 1163 */ 0x0057, 0x0300, + /* 1165 */ 0x0077, 0x0300, + /* 1167 */ 0x0057, 0x0301, + /* 1169 */ 0x0077, 0x0301, + /* 1171 */ 0x0057, 0x0308, + /* 1173 */ 0x0077, 0x0308, + /* 1175 */ 0x0057, 0x0307, + /* 1177 */ 0x0077, 0x0307, + /* 1179 */ 0x0057, 0x0323, + /* 1181 */ 0x0077, 0x0323, + /* 1183 */ 0x0058, 0x0307, + /* 1185 */ 0x0078, 0x0307, + /* 1187 */ 0x0058, 0x0308, + /* 1189 */ 0x0078, 0x0308, + /* 1191 */ 0x0059, 0x0307, + /* 1193 */ 0x0079, 0x0307, + /* 1195 */ 0x005A, 0x0302, + /* 1197 */ 0x007A, 0x0302, + /* 1199 */ 0x005A, 0x0323, + /* 1201 */ 0x007A, 0x0323, + /* 1203 */ 0x005A, 0x0331, + /* 1205 */ 0x007A, 0x0331, + /* 1207 */ 0x0068, 0x0331, + /* 1209 */ 0x0074, 0x0308, + /* 1211 */ 0x0077, 0x030A, + /* 1213 */ 0x0079, 0x030A, + /* 1215 */ 0x0061, 0x02BE, + /* 1217 */ 0x017F, 0x0307, + /* 1219 */ 0x0041, 0x0323, + /* 1221 */ 0x0061, 0x0323, + /* 1223 */ 0x0041, 0x0309, + /* 1225 */ 0x0061, 0x0309, + /* 1227 */ 0x00C2, 0x0301, + /* 1229 */ 0x00E2, 0x0301, + /* 1231 */ 0x00C2, 0x0300, + /* 1233 */ 0x00E2, 0x0300, + /* 1235 */ 0x00C2, 0x0309, + /* 1237 */ 0x00E2, 0x0309, + /* 1239 */ 0x00C2, 0x0303, + /* 1241 */ 0x00E2, 0x0303, + /* 1243 */ 0x1EA0, 0x0302, + /* 1245 */ 0x1EA1, 0x0302, + /* 1247 */ 0x0102, 0x0301, + /* 1249 */ 0x0103, 0x0301, + /* 1251 */ 0x0102, 0x0300, + /* 1253 */ 0x0103, 0x0300, + /* 1255 */ 0x0102, 0x0309, + /* 1257 */ 0x0103, 0x0309, + /* 1259 */ 0x0102, 0x0303, + /* 1261 */ 0x0103, 0x0303, + /* 1263 */ 0x1EA0, 0x0306, + /* 1265 */ 0x1EA1, 0x0306, + /* 1267 */ 0x0045, 0x0323, + /* 1269 */ 0x0065, 0x0323, + /* 1271 */ 0x0045, 0x0309, + /* 1273 */ 0x0065, 0x0309, + /* 1275 */ 0x0045, 0x0303, + /* 1277 */ 0x0065, 0x0303, + /* 1279 */ 0x00CA, 0x0301, + /* 1281 */ 0x00EA, 0x0301, + /* 1283 */ 0x00CA, 0x0300, + /* 1285 */ 0x00EA, 0x0300, + /* 1287 */ 0x00CA, 0x0309, + /* 1289 */ 0x00EA, 0x0309, + /* 1291 */ 0x00CA, 0x0303, + /* 1293 */ 0x00EA, 0x0303, + /* 1295 */ 0x1EB8, 0x0302, + /* 1297 */ 0x1EB9, 0x0302, + /* 1299 */ 0x0049, 0x0309, + /* 1301 */ 0x0069, 0x0309, + /* 1303 */ 0x0049, 0x0323, + /* 1305 */ 0x0069, 0x0323, + /* 1307 */ 0x004F, 0x0323, + /* 1309 */ 0x006F, 0x0323, + /* 1311 */ 0x004F, 0x0309, + /* 1313 */ 0x006F, 0x0309, + /* 1315 */ 0x00D4, 0x0301, + /* 1317 */ 0x00F4, 0x0301, + /* 1319 */ 0x00D4, 0x0300, + /* 1321 */ 0x00F4, 0x0300, + /* 1323 */ 0x00D4, 0x0309, + /* 1325 */ 0x00F4, 0x0309, + /* 1327 */ 0x00D4, 0x0303, + /* 1329 */ 0x00F4, 0x0303, + /* 1331 */ 0x1ECC, 0x0302, + /* 1333 */ 0x1ECD, 0x0302, + /* 1335 */ 0x01A0, 0x0301, + /* 1337 */ 0x01A1, 0x0301, + /* 1339 */ 0x01A0, 0x0300, + /* 1341 */ 0x01A1, 0x0300, + /* 1343 */ 0x01A0, 0x0309, + /* 1345 */ 0x01A1, 0x0309, + /* 1347 */ 0x01A0, 0x0303, + /* 1349 */ 0x01A1, 0x0303, + /* 1351 */ 0x01A0, 0x0323, + /* 1353 */ 0x01A1, 0x0323, + /* 1355 */ 0x0055, 0x0323, + /* 1357 */ 0x0075, 0x0323, + /* 1359 */ 0x0055, 0x0309, + /* 1361 */ 0x0075, 0x0309, + /* 1363 */ 0x01AF, 0x0301, + /* 1365 */ 0x01B0, 0x0301, + /* 1367 */ 0x01AF, 0x0300, + /* 1369 */ 0x01B0, 0x0300, + /* 1371 */ 0x01AF, 0x0309, + /* 1373 */ 0x01B0, 0x0309, + /* 1375 */ 0x01AF, 0x0303, + /* 1377 */ 0x01B0, 0x0303, + /* 1379 */ 0x01AF, 0x0323, + /* 1381 */ 0x01B0, 0x0323, + /* 1383 */ 0x0059, 0x0300, + /* 1385 */ 0x0079, 0x0300, + /* 1387 */ 0x0059, 0x0323, + /* 1389 */ 0x0079, 0x0323, + /* 1391 */ 0x0059, 0x0309, + /* 1393 */ 0x0079, 0x0309, + /* 1395 */ 0x0059, 0x0303, + /* 1397 */ 0x0079, 0x0303, + /* 1399 */ 0x03B1, 0x0313, + /* 1401 */ 0x03B1, 0x0314, + /* 1403 */ 0x1F00, 0x0300, + /* 1405 */ 0x1F01, 0x0300, + /* 1407 */ 0x1F00, 0x0301, + /* 1409 */ 0x1F01, 0x0301, + /* 1411 */ 0x1F00, 0x0342, + /* 1413 */ 0x1F01, 0x0342, + /* 1415 */ 0x0391, 0x0313, + /* 1417 */ 0x0391, 0x0314, + /* 1419 */ 0x1F08, 0x0300, + /* 1421 */ 0x1F09, 0x0300, + /* 1423 */ 0x1F08, 0x0301, + /* 1425 */ 0x1F09, 0x0301, + /* 1427 */ 0x1F08, 0x0342, + /* 1429 */ 0x1F09, 0x0342, + /* 1431 */ 0x03B5, 0x0313, + /* 1433 */ 0x03B5, 0x0314, + /* 1435 */ 0x1F10, 0x0300, + /* 1437 */ 0x1F11, 0x0300, + /* 1439 */ 0x1F10, 0x0301, + /* 1441 */ 0x1F11, 0x0301, + /* 1443 */ 0x0395, 0x0313, + /* 1445 */ 0x0395, 0x0314, + /* 1447 */ 0x1F18, 0x0300, + /* 1449 */ 0x1F19, 0x0300, + /* 1451 */ 0x1F18, 0x0301, + /* 1453 */ 0x1F19, 0x0301, + /* 1455 */ 0x03B7, 0x0313, + /* 1457 */ 0x03B7, 0x0314, + /* 1459 */ 0x1F20, 0x0300, + /* 1461 */ 0x1F21, 0x0300, + /* 1463 */ 0x1F20, 0x0301, + /* 1465 */ 0x1F21, 0x0301, + /* 1467 */ 0x1F20, 0x0342, + /* 1469 */ 0x1F21, 0x0342, + /* 1471 */ 0x0397, 0x0313, + /* 1473 */ 0x0397, 0x0314, + /* 1475 */ 0x1F28, 0x0300, + /* 1477 */ 0x1F29, 0x0300, + /* 1479 */ 0x1F28, 0x0301, + /* 1481 */ 0x1F29, 0x0301, + /* 1483 */ 0x1F28, 0x0342, + /* 1485 */ 0x1F29, 0x0342, + /* 1487 */ 0x03B9, 0x0313, + /* 1489 */ 0x03B9, 0x0314, + /* 1491 */ 0x1F30, 0x0300, + /* 1493 */ 0x1F31, 0x0300, + /* 1495 */ 0x1F30, 0x0301, + /* 1497 */ 0x1F31, 0x0301, + /* 1499 */ 0x1F30, 0x0342, + /* 1501 */ 0x1F31, 0x0342, + /* 1503 */ 0x0399, 0x0313, + /* 1505 */ 0x0399, 0x0314, + /* 1507 */ 0x1F38, 0x0300, + /* 1509 */ 0x1F39, 0x0300, + /* 1511 */ 0x1F38, 0x0301, + /* 1513 */ 0x1F39, 0x0301, + /* 1515 */ 0x1F38, 0x0342, + /* 1517 */ 0x1F39, 0x0342, + /* 1519 */ 0x03BF, 0x0313, + /* 1521 */ 0x03BF, 0x0314, + /* 1523 */ 0x1F40, 0x0300, + /* 1525 */ 0x1F41, 0x0300, + /* 1527 */ 0x1F40, 0x0301, + /* 1529 */ 0x1F41, 0x0301, + /* 1531 */ 0x039F, 0x0313, + /* 1533 */ 0x039F, 0x0314, + /* 1535 */ 0x1F48, 0x0300, + /* 1537 */ 0x1F49, 0x0300, + /* 1539 */ 0x1F48, 0x0301, + /* 1541 */ 0x1F49, 0x0301, + /* 1543 */ 0x03C5, 0x0313, + /* 1545 */ 0x03C5, 0x0314, + /* 1547 */ 0x1F50, 0x0300, + /* 1549 */ 0x1F51, 0x0300, + /* 1551 */ 0x1F50, 0x0301, + /* 1553 */ 0x1F51, 0x0301, + /* 1555 */ 0x1F50, 0x0342, + /* 1557 */ 0x1F51, 0x0342, + /* 1559 */ 0x03A5, 0x0314, + /* 1561 */ 0x1F59, 0x0300, + /* 1563 */ 0x1F59, 0x0301, + /* 1565 */ 0x1F59, 0x0342, + /* 1567 */ 0x03C9, 0x0313, + /* 1569 */ 0x03C9, 0x0314, + /* 1571 */ 0x1F60, 0x0300, + /* 1573 */ 0x1F61, 0x0300, + /* 1575 */ 0x1F60, 0x0301, + /* 1577 */ 0x1F61, 0x0301, + /* 1579 */ 0x1F60, 0x0342, + /* 1581 */ 0x1F61, 0x0342, + /* 1583 */ 0x03A9, 0x0313, + /* 1585 */ 0x03A9, 0x0314, + /* 1587 */ 0x1F68, 0x0300, + /* 1589 */ 0x1F69, 0x0300, + /* 1591 */ 0x1F68, 0x0301, + /* 1593 */ 0x1F69, 0x0301, + /* 1595 */ 0x1F68, 0x0342, + /* 1597 */ 0x1F69, 0x0342, + /* 1599 */ 0x03B1, 0x0300, + /* 1601 */ 0x03B5, 0x0300, + /* 1603 */ 0x03B7, 0x0300, + /* 1605 */ 0x03B9, 0x0300, + /* 1607 */ 0x03BF, 0x0300, + /* 1609 */ 0x03C5, 0x0300, + /* 1611 */ 0x03C9, 0x0300, + /* 1613 */ 0x1F00, 0x0345, + /* 1615 */ 0x1F01, 0x0345, + /* 1617 */ 0x1F02, 0x0345, + /* 1619 */ 0x1F03, 0x0345, + /* 1621 */ 0x1F04, 0x0345, + /* 1623 */ 0x1F05, 0x0345, + /* 1625 */ 0x1F06, 0x0345, + /* 1627 */ 0x1F07, 0x0345, + /* 1629 */ 0x1F08, 0x0345, + /* 1631 */ 0x1F09, 0x0345, + /* 1633 */ 0x1F0A, 0x0345, + /* 1635 */ 0x1F0B, 0x0345, + /* 1637 */ 0x1F0C, 0x0345, + /* 1639 */ 0x1F0D, 0x0345, + /* 1641 */ 0x1F0E, 0x0345, + /* 1643 */ 0x1F0F, 0x0345, + /* 1645 */ 0x1F20, 0x0345, + /* 1647 */ 0x1F21, 0x0345, + /* 1649 */ 0x1F22, 0x0345, + /* 1651 */ 0x1F23, 0x0345, + /* 1653 */ 0x1F24, 0x0345, + /* 1655 */ 0x1F25, 0x0345, + /* 1657 */ 0x1F26, 0x0345, + /* 1659 */ 0x1F27, 0x0345, + /* 1661 */ 0x1F28, 0x0345, + /* 1663 */ 0x1F29, 0x0345, + /* 1665 */ 0x1F2A, 0x0345, + /* 1667 */ 0x1F2B, 0x0345, + /* 1669 */ 0x1F2C, 0x0345, + /* 1671 */ 0x1F2D, 0x0345, + /* 1673 */ 0x1F2E, 0x0345, + /* 1675 */ 0x1F2F, 0x0345, + /* 1677 */ 0x1F60, 0x0345, + /* 1679 */ 0x1F61, 0x0345, + /* 1681 */ 0x1F62, 0x0345, + /* 1683 */ 0x1F63, 0x0345, + /* 1685 */ 0x1F64, 0x0345, + /* 1687 */ 0x1F65, 0x0345, + /* 1689 */ 0x1F66, 0x0345, + /* 1691 */ 0x1F67, 0x0345, + /* 1693 */ 0x1F68, 0x0345, + /* 1695 */ 0x1F69, 0x0345, + /* 1697 */ 0x1F6A, 0x0345, + /* 1699 */ 0x1F6B, 0x0345, + /* 1701 */ 0x1F6C, 0x0345, + /* 1703 */ 0x1F6D, 0x0345, + /* 1705 */ 0x1F6E, 0x0345, + /* 1707 */ 0x1F6F, 0x0345, + /* 1709 */ 0x03B1, 0x0306, + /* 1711 */ 0x03B1, 0x0304, + /* 1713 */ 0x1F70, 0x0345, + /* 1715 */ 0x03B1, 0x0345, + /* 1717 */ 0x03AC, 0x0345, + /* 1719 */ 0x03B1, 0x0342, + /* 1721 */ 0x1FB6, 0x0345, + /* 1723 */ 0x0391, 0x0306, + /* 1725 */ 0x0391, 0x0304, + /* 1727 */ 0x0391, 0x0300, + /* 1729 */ 0x0391, 0x0345, + /* 1731 */ 0x0020, 0x0313, + /* 1733 */ 0x0020, 0x0313, + /* 1735 */ 0x0020, 0x0342, + /* 1737 */ 0x00A8, 0x0342, + /* 1739 */ 0x1F74, 0x0345, + /* 1741 */ 0x03B7, 0x0345, + /* 1743 */ 0x03AE, 0x0345, + /* 1745 */ 0x03B7, 0x0342, + /* 1747 */ 0x1FC6, 0x0345, + /* 1749 */ 0x0395, 0x0300, + /* 1751 */ 0x0397, 0x0300, + /* 1753 */ 0x0397, 0x0345, + /* 1755 */ 0x1FBF, 0x0300, + /* 1757 */ 0x1FBF, 0x0301, + /* 1759 */ 0x1FBF, 0x0342, + /* 1761 */ 0x03B9, 0x0306, + /* 1763 */ 0x03B9, 0x0304, + /* 1765 */ 0x03CA, 0x0300, + /* 1767 */ 0x03B9, 0x0342, + /* 1769 */ 0x03CA, 0x0342, + /* 1771 */ 0x0399, 0x0306, + /* 1773 */ 0x0399, 0x0304, + /* 1775 */ 0x0399, 0x0300, + /* 1777 */ 0x1FFE, 0x0300, + /* 1779 */ 0x1FFE, 0x0301, + /* 1781 */ 0x1FFE, 0x0342, + /* 1783 */ 0x03C5, 0x0306, + /* 1785 */ 0x03C5, 0x0304, + /* 1787 */ 0x03CB, 0x0300, + /* 1789 */ 0x03C1, 0x0313, + /* 1791 */ 0x03C1, 0x0314, + /* 1793 */ 0x03C5, 0x0342, + /* 1795 */ 0x03CB, 0x0342, + /* 1797 */ 0x03A5, 0x0306, + /* 1799 */ 0x03A5, 0x0304, + /* 1801 */ 0x03A5, 0x0300, + /* 1803 */ 0x03A1, 0x0314, + /* 1805 */ 0x00A8, 0x0300, + /* 1807 */ 0x1F7C, 0x0345, + /* 1809 */ 0x03C9, 0x0345, + /* 1811 */ 0x03CE, 0x0345, + /* 1813 */ 0x03C9, 0x0342, + /* 1815 */ 0x1FF6, 0x0345, + /* 1817 */ 0x039F, 0x0300, + /* 1819 */ 0x03A9, 0x0300, + /* 1821 */ 0x03A9, 0x0345, + /* 1823 */ 0x0020, 0x0314, + /* 1825 */ 0x0020, 0x0333, + /* 1827 */ 0x002E, 0x002E, + /* 1829 */ 0x002E, 0x002E, 0x002E, + /* 1832 */ 0x2032, 0x2032, + /* 1834 */ 0x2032, 0x2032, 0x2032, + /* 1837 */ 0x2035, 0x2035, + /* 1839 */ 0x2035, 0x2035, 0x2035, + /* 1842 */ 0x0021, 0x0021, + /* 1844 */ 0x0020, 0x0305, + /* 1846 */ 0x003F, 0x003F, + /* 1848 */ 0x003F, 0x0021, + /* 1850 */ 0x0021, 0x003F, + /* 1852 */ 0x2032, 0x2032, 0x2032, 0x2032, + /* 1856 */ 0x0052, 0x0073, + /* 1858 */ 0x0061, 0x002F, 0x0063, + /* 1861 */ 0x0061, 0x002F, 0x0073, + /* 1864 */ 0x00B0, 0x0043, + /* 1866 */ 0x0063, 0x002F, 0x006F, + /* 1869 */ 0x0063, 0x002F, 0x0075, + /* 1872 */ 0x00B0, 0x0046, + /* 1874 */ 0x004E, 0x006F, + /* 1876 */ 0x0053, 0x004D, + /* 1878 */ 0x0054, 0x0045, 0x004C, + /* 1881 */ 0x0054, 0x004D, + /* 1883 */ 0x0046, 0x0041, 0x0058, + /* 1886 */ 0x0031, 0x2044, 0x0037, + /* 1889 */ 0x0031, 0x2044, 0x0039, + /* 1892 */ 0x0031, 0x2044, 0x0031, 0x0030, + /* 1896 */ 0x0031, 0x2044, 0x0033, + /* 1899 */ 0x0032, 0x2044, 0x0033, + /* 1902 */ 0x0031, 0x2044, 0x0035, + /* 1905 */ 0x0032, 0x2044, 0x0035, + /* 1908 */ 0x0033, 0x2044, 0x0035, + /* 1911 */ 0x0034, 0x2044, 0x0035, + /* 1914 */ 0x0031, 0x2044, 0x0036, + /* 1917 */ 0x0035, 0x2044, 0x0036, + /* 1920 */ 0x0031, 0x2044, 0x0038, + /* 1923 */ 0x0033, 0x2044, 0x0038, + /* 1926 */ 0x0035, 0x2044, 0x0038, + /* 1929 */ 0x0037, 0x2044, 0x0038, + /* 1932 */ 0x0031, 0x2044, + /* 1934 */ 0x0049, 0x0049, + /* 1936 */ 0x0049, 0x0049, 0x0049, + /* 1939 */ 0x0049, 0x0056, + /* 1941 */ 0x0056, 0x0049, + /* 1943 */ 0x0056, 0x0049, 0x0049, + /* 1946 */ 0x0056, 0x0049, 0x0049, 0x0049, + /* 1950 */ 0x0049, 0x0058, + /* 1952 */ 0x0058, 0x0049, + /* 1954 */ 0x0058, 0x0049, 0x0049, + /* 1957 */ 0x0069, 0x0069, + /* 1959 */ 0x0069, 0x0069, 0x0069, + /* 1962 */ 0x0069, 0x0076, + /* 1964 */ 0x0076, 0x0069, + /* 1966 */ 0x0076, 0x0069, 0x0069, + /* 1969 */ 0x0076, 0x0069, 0x0069, 0x0069, + /* 1973 */ 0x0069, 0x0078, + /* 1975 */ 0x0078, 0x0069, + /* 1977 */ 0x0078, 0x0069, 0x0069, + /* 1980 */ 0x0030, 0x2044, 0x0033, + /* 1983 */ 0x2190, 0x0338, + /* 1985 */ 0x2192, 0x0338, + /* 1987 */ 0x2194, 0x0338, + /* 1989 */ 0x21D0, 0x0338, + /* 1991 */ 0x21D4, 0x0338, + /* 1993 */ 0x21D2, 0x0338, + /* 1995 */ 0x2203, 0x0338, + /* 1997 */ 0x2208, 0x0338, + /* 1999 */ 0x220B, 0x0338, + /* 2001 */ 0x2223, 0x0338, + /* 2003 */ 0x2225, 0x0338, + /* 2005 */ 0x222B, 0x222B, + /* 2007 */ 0x222B, 0x222B, 0x222B, + /* 2010 */ 0x222E, 0x222E, + /* 2012 */ 0x222E, 0x222E, 0x222E, + /* 2015 */ 0x223C, 0x0338, + /* 2017 */ 0x2243, 0x0338, + /* 2019 */ 0x2245, 0x0338, + /* 2021 */ 0x2248, 0x0338, + /* 2023 */ 0x003D, 0x0338, + /* 2025 */ 0x2261, 0x0338, + /* 2027 */ 0x224D, 0x0338, + /* 2029 */ 0x003C, 0x0338, + /* 2031 */ 0x003E, 0x0338, + /* 2033 */ 0x2264, 0x0338, + /* 2035 */ 0x2265, 0x0338, + /* 2037 */ 0x2272, 0x0338, + /* 2039 */ 0x2273, 0x0338, + /* 2041 */ 0x2276, 0x0338, + /* 2043 */ 0x2277, 0x0338, + /* 2045 */ 0x227A, 0x0338, + /* 2047 */ 0x227B, 0x0338, + /* 2049 */ 0x2282, 0x0338, + /* 2051 */ 0x2283, 0x0338, + /* 2053 */ 0x2286, 0x0338, + /* 2055 */ 0x2287, 0x0338, + /* 2057 */ 0x22A2, 0x0338, + /* 2059 */ 0x22A8, 0x0338, + /* 2061 */ 0x22A9, 0x0338, + /* 2063 */ 0x22AB, 0x0338, + /* 2065 */ 0x227C, 0x0338, + /* 2067 */ 0x227D, 0x0338, + /* 2069 */ 0x2291, 0x0338, + /* 2071 */ 0x2292, 0x0338, + /* 2073 */ 0x22B2, 0x0338, + /* 2075 */ 0x22B3, 0x0338, + /* 2077 */ 0x22B4, 0x0338, + /* 2079 */ 0x22B5, 0x0338, + /* 2081 */ 0x0031, 0x0030, + /* 2083 */ 0x0031, 0x0031, + /* 2085 */ 0x0031, 0x0032, + /* 2087 */ 0x0031, 0x0033, + /* 2089 */ 0x0031, 0x0034, + /* 2091 */ 0x0031, 0x0035, + /* 2093 */ 0x0031, 0x0036, + /* 2095 */ 0x0031, 0x0037, + /* 2097 */ 0x0031, 0x0038, + /* 2099 */ 0x0031, 0x0039, + /* 2101 */ 0x0032, 0x0030, + /* 2103 */ 0x0028, 0x0031, 0x0029, + /* 2106 */ 0x0028, 0x0032, 0x0029, + /* 2109 */ 0x0028, 0x0033, 0x0029, + /* 2112 */ 0x0028, 0x0034, 0x0029, + /* 2115 */ 0x0028, 0x0035, 0x0029, + /* 2118 */ 0x0028, 0x0036, 0x0029, + /* 2121 */ 0x0028, 0x0037, 0x0029, + /* 2124 */ 0x0028, 0x0038, 0x0029, + /* 2127 */ 0x0028, 0x0039, 0x0029, + /* 2130 */ 0x0028, 0x0031, 0x0030, 0x0029, + /* 2134 */ 0x0028, 0x0031, 0x0031, 0x0029, + /* 2138 */ 0x0028, 0x0031, 0x0032, 0x0029, + /* 2142 */ 0x0028, 0x0031, 0x0033, 0x0029, + /* 2146 */ 0x0028, 0x0031, 0x0034, 0x0029, + /* 2150 */ 0x0028, 0x0031, 0x0035, 0x0029, + /* 2154 */ 0x0028, 0x0031, 0x0036, 0x0029, + /* 2158 */ 0x0028, 0x0031, 0x0037, 0x0029, + /* 2162 */ 0x0028, 0x0031, 0x0038, 0x0029, + /* 2166 */ 0x0028, 0x0031, 0x0039, 0x0029, + /* 2170 */ 0x0028, 0x0032, 0x0030, 0x0029, + /* 2174 */ 0x0031, 0x002E, + /* 2176 */ 0x0032, 0x002E, + /* 2178 */ 0x0033, 0x002E, + /* 2180 */ 0x0034, 0x002E, + /* 2182 */ 0x0035, 0x002E, + /* 2184 */ 0x0036, 0x002E, + /* 2186 */ 0x0037, 0x002E, + /* 2188 */ 0x0038, 0x002E, + /* 2190 */ 0x0039, 0x002E, + /* 2192 */ 0x0031, 0x0030, 0x002E, + /* 2195 */ 0x0031, 0x0031, 0x002E, + /* 2198 */ 0x0031, 0x0032, 0x002E, + /* 2201 */ 0x0031, 0x0033, 0x002E, + /* 2204 */ 0x0031, 0x0034, 0x002E, + /* 2207 */ 0x0031, 0x0035, 0x002E, + /* 2210 */ 0x0031, 0x0036, 0x002E, + /* 2213 */ 0x0031, 0x0037, 0x002E, + /* 2216 */ 0x0031, 0x0038, 0x002E, + /* 2219 */ 0x0031, 0x0039, 0x002E, + /* 2222 */ 0x0032, 0x0030, 0x002E, + /* 2225 */ 0x0028, 0x0061, 0x0029, + /* 2228 */ 0x0028, 0x0062, 0x0029, + /* 2231 */ 0x0028, 0x0063, 0x0029, + /* 2234 */ 0x0028, 0x0064, 0x0029, + /* 2237 */ 0x0028, 0x0065, 0x0029, + /* 2240 */ 0x0028, 0x0066, 0x0029, + /* 2243 */ 0x0028, 0x0067, 0x0029, + /* 2246 */ 0x0028, 0x0068, 0x0029, + /* 2249 */ 0x0028, 0x0069, 0x0029, + /* 2252 */ 0x0028, 0x006A, 0x0029, + /* 2255 */ 0x0028, 0x006B, 0x0029, + /* 2258 */ 0x0028, 0x006C, 0x0029, + /* 2261 */ 0x0028, 0x006D, 0x0029, + /* 2264 */ 0x0028, 0x006E, 0x0029, + /* 2267 */ 0x0028, 0x006F, 0x0029, + /* 2270 */ 0x0028, 0x0070, 0x0029, + /* 2273 */ 0x0028, 0x0071, 0x0029, + /* 2276 */ 0x0028, 0x0072, 0x0029, + /* 2279 */ 0x0028, 0x0073, 0x0029, + /* 2282 */ 0x0028, 0x0074, 0x0029, + /* 2285 */ 0x0028, 0x0075, 0x0029, + /* 2288 */ 0x0028, 0x0076, 0x0029, + /* 2291 */ 0x0028, 0x0077, 0x0029, + /* 2294 */ 0x0028, 0x0078, 0x0029, + /* 2297 */ 0x0028, 0x0079, 0x0029, + /* 2300 */ 0x0028, 0x007A, 0x0029, + /* 2303 */ 0x222B, 0x222B, 0x222B, 0x222B, + /* 2307 */ 0x003A, 0x003A, 0x003D, + /* 2310 */ 0x003D, 0x003D, + /* 2312 */ 0x003D, 0x003D, 0x003D, + /* 2315 */ 0x2ADD, 0x0338, + /* 2317 */ 0x304B, 0x3099, + /* 2319 */ 0x304D, 0x3099, + /* 2321 */ 0x304F, 0x3099, + /* 2323 */ 0x3051, 0x3099, + /* 2325 */ 0x3053, 0x3099, + /* 2327 */ 0x3055, 0x3099, + /* 2329 */ 0x3057, 0x3099, + /* 2331 */ 0x3059, 0x3099, + /* 2333 */ 0x305B, 0x3099, + /* 2335 */ 0x305D, 0x3099, + /* 2337 */ 0x305F, 0x3099, + /* 2339 */ 0x3061, 0x3099, + /* 2341 */ 0x3064, 0x3099, + /* 2343 */ 0x3066, 0x3099, + /* 2345 */ 0x3068, 0x3099, + /* 2347 */ 0x306F, 0x3099, + /* 2349 */ 0x306F, 0x309A, + /* 2351 */ 0x3072, 0x3099, + /* 2353 */ 0x3072, 0x309A, + /* 2355 */ 0x3075, 0x3099, + /* 2357 */ 0x3075, 0x309A, + /* 2359 */ 0x3078, 0x3099, + /* 2361 */ 0x3078, 0x309A, + /* 2363 */ 0x307B, 0x3099, + /* 2365 */ 0x307B, 0x309A, + /* 2367 */ 0x3046, 0x3099, + /* 2369 */ 0x0020, 0x3099, + /* 2371 */ 0x0020, 0x309A, + /* 2373 */ 0x309D, 0x3099, + /* 2375 */ 0x3088, 0x308A, + /* 2377 */ 0x30AB, 0x3099, + /* 2379 */ 0x30AD, 0x3099, + /* 2381 */ 0x30AF, 0x3099, + /* 2383 */ 0x30B1, 0x3099, + /* 2385 */ 0x30B3, 0x3099, + /* 2387 */ 0x30B5, 0x3099, + /* 2389 */ 0x30B7, 0x3099, + /* 2391 */ 0x30B9, 0x3099, + /* 2393 */ 0x30BB, 0x3099, + /* 2395 */ 0x30BD, 0x3099, + /* 2397 */ 0x30BF, 0x3099, + /* 2399 */ 0x30C1, 0x3099, + /* 2401 */ 0x30C4, 0x3099, + /* 2403 */ 0x30C6, 0x3099, + /* 2405 */ 0x30C8, 0x3099, + /* 2407 */ 0x30CF, 0x3099, + /* 2409 */ 0x30CF, 0x309A, + /* 2411 */ 0x30D2, 0x3099, + /* 2413 */ 0x30D2, 0x309A, + /* 2415 */ 0x30D5, 0x3099, + /* 2417 */ 0x30D5, 0x309A, + /* 2419 */ 0x30D8, 0x3099, + /* 2421 */ 0x30D8, 0x309A, + /* 2423 */ 0x30DB, 0x3099, + /* 2425 */ 0x30DB, 0x309A, + /* 2427 */ 0x30A6, 0x3099, + /* 2429 */ 0x30EF, 0x3099, + /* 2431 */ 0x30F0, 0x3099, + /* 2433 */ 0x30F1, 0x3099, + /* 2435 */ 0x30F2, 0x3099, + /* 2437 */ 0x30FD, 0x3099, + /* 2439 */ 0x30B3, 0x30C8, + /* 2441 */ 0x0028, 0x1100, 0x0029, + /* 2444 */ 0x0028, 0x1102, 0x0029, + /* 2447 */ 0x0028, 0x1103, 0x0029, + /* 2450 */ 0x0028, 0x1105, 0x0029, + /* 2453 */ 0x0028, 0x1106, 0x0029, + /* 2456 */ 0x0028, 0x1107, 0x0029, + /* 2459 */ 0x0028, 0x1109, 0x0029, + /* 2462 */ 0x0028, 0x110B, 0x0029, + /* 2465 */ 0x0028, 0x110C, 0x0029, + /* 2468 */ 0x0028, 0x110E, 0x0029, + /* 2471 */ 0x0028, 0x110F, 0x0029, + /* 2474 */ 0x0028, 0x1110, 0x0029, + /* 2477 */ 0x0028, 0x1111, 0x0029, + /* 2480 */ 0x0028, 0x1112, 0x0029, + /* 2483 */ 0x0028, 0x1100, 0x1161, 0x0029, + /* 2487 */ 0x0028, 0x1102, 0x1161, 0x0029, + /* 2491 */ 0x0028, 0x1103, 0x1161, 0x0029, + /* 2495 */ 0x0028, 0x1105, 0x1161, 0x0029, + /* 2499 */ 0x0028, 0x1106, 0x1161, 0x0029, + /* 2503 */ 0x0028, 0x1107, 0x1161, 0x0029, + /* 2507 */ 0x0028, 0x1109, 0x1161, 0x0029, + /* 2511 */ 0x0028, 0x110B, 0x1161, 0x0029, + /* 2515 */ 0x0028, 0x110C, 0x1161, 0x0029, + /* 2519 */ 0x0028, 0x110E, 0x1161, 0x0029, + /* 2523 */ 0x0028, 0x110F, 0x1161, 0x0029, + /* 2527 */ 0x0028, 0x1110, 0x1161, 0x0029, + /* 2531 */ 0x0028, 0x1111, 0x1161, 0x0029, + /* 2535 */ 0x0028, 0x1112, 0x1161, 0x0029, + /* 2539 */ 0x0028, 0x110C, 0x116E, 0x0029, + /* 2543 */ 0x0028, 0x110B, 0x1169, 0x110C, 0x1165, 0x11AB, 0x0029, + /* 2550 */ 0x0028, 0x110B, 0x1169, 0x1112, 0x116E, 0x0029, + /* 2556 */ 0x0028, 0x4E00, 0x0029, + /* 2559 */ 0x0028, 0x4E8C, 0x0029, + /* 2562 */ 0x0028, 0x4E09, 0x0029, + /* 2565 */ 0x0028, 0x56DB, 0x0029, + /* 2568 */ 0x0028, 0x4E94, 0x0029, + /* 2571 */ 0x0028, 0x516D, 0x0029, + /* 2574 */ 0x0028, 0x4E03, 0x0029, + /* 2577 */ 0x0028, 0x516B, 0x0029, + /* 2580 */ 0x0028, 0x4E5D, 0x0029, + /* 2583 */ 0x0028, 0x5341, 0x0029, + /* 2586 */ 0x0028, 0x6708, 0x0029, + /* 2589 */ 0x0028, 0x706B, 0x0029, + /* 2592 */ 0x0028, 0x6C34, 0x0029, + /* 2595 */ 0x0028, 0x6728, 0x0029, + /* 2598 */ 0x0028, 0x91D1, 0x0029, + /* 2601 */ 0x0028, 0x571F, 0x0029, + /* 2604 */ 0x0028, 0x65E5, 0x0029, + /* 2607 */ 0x0028, 0x682A, 0x0029, + /* 2610 */ 0x0028, 0x6709, 0x0029, + /* 2613 */ 0x0028, 0x793E, 0x0029, + /* 2616 */ 0x0028, 0x540D, 0x0029, + /* 2619 */ 0x0028, 0x7279, 0x0029, + /* 2622 */ 0x0028, 0x8CA1, 0x0029, + /* 2625 */ 0x0028, 0x795D, 0x0029, + /* 2628 */ 0x0028, 0x52B4, 0x0029, + /* 2631 */ 0x0028, 0x4EE3, 0x0029, + /* 2634 */ 0x0028, 0x547C, 0x0029, + /* 2637 */ 0x0028, 0x5B66, 0x0029, + /* 2640 */ 0x0028, 0x76E3, 0x0029, + /* 2643 */ 0x0028, 0x4F01, 0x0029, + /* 2646 */ 0x0028, 0x8CC7, 0x0029, + /* 2649 */ 0x0028, 0x5354, 0x0029, + /* 2652 */ 0x0028, 0x796D, 0x0029, + /* 2655 */ 0x0028, 0x4F11, 0x0029, + /* 2658 */ 0x0028, 0x81EA, 0x0029, + /* 2661 */ 0x0028, 0x81F3, 0x0029, + /* 2664 */ 0x0050, 0x0054, 0x0045, + /* 2667 */ 0x0032, 0x0031, + /* 2669 */ 0x0032, 0x0032, + /* 2671 */ 0x0032, 0x0033, + /* 2673 */ 0x0032, 0x0034, + /* 2675 */ 0x0032, 0x0035, + /* 2677 */ 0x0032, 0x0036, + /* 2679 */ 0x0032, 0x0037, + /* 2681 */ 0x0032, 0x0038, + /* 2683 */ 0x0032, 0x0039, + /* 2685 */ 0x0033, 0x0030, + /* 2687 */ 0x0033, 0x0031, + /* 2689 */ 0x0033, 0x0032, + /* 2691 */ 0x0033, 0x0033, + /* 2693 */ 0x0033, 0x0034, + /* 2695 */ 0x0033, 0x0035, + /* 2697 */ 0x1100, 0x1161, + /* 2699 */ 0x1102, 0x1161, + /* 2701 */ 0x1103, 0x1161, + /* 2703 */ 0x1105, 0x1161, + /* 2705 */ 0x1106, 0x1161, + /* 2707 */ 0x1107, 0x1161, + /* 2709 */ 0x1109, 0x1161, + /* 2711 */ 0x110B, 0x1161, + /* 2713 */ 0x110C, 0x1161, + /* 2715 */ 0x110E, 0x1161, + /* 2717 */ 0x110F, 0x1161, + /* 2719 */ 0x1110, 0x1161, + /* 2721 */ 0x1111, 0x1161, + /* 2723 */ 0x1112, 0x1161, + /* 2725 */ 0x110E, 0x1161, 0x11B7, 0x1100, 0x1169, + /* 2730 */ 0x110C, 0x116E, 0x110B, 0x1174, + /* 2734 */ 0x110B, 0x116E, + /* 2736 */ 0x0033, 0x0036, + /* 2738 */ 0x0033, 0x0037, + /* 2740 */ 0x0033, 0x0038, + /* 2742 */ 0x0033, 0x0039, + /* 2744 */ 0x0034, 0x0030, + /* 2746 */ 0x0034, 0x0031, + /* 2748 */ 0x0034, 0x0032, + /* 2750 */ 0x0034, 0x0033, + /* 2752 */ 0x0034, 0x0034, + /* 2754 */ 0x0034, 0x0035, + /* 2756 */ 0x0034, 0x0036, + /* 2758 */ 0x0034, 0x0037, + /* 2760 */ 0x0034, 0x0038, + /* 2762 */ 0x0034, 0x0039, + /* 2764 */ 0x0035, 0x0030, + /* 2766 */ 0x0031, 0x6708, + /* 2768 */ 0x0032, 0x6708, + /* 2770 */ 0x0033, 0x6708, + /* 2772 */ 0x0034, 0x6708, + /* 2774 */ 0x0035, 0x6708, + /* 2776 */ 0x0036, 0x6708, + /* 2778 */ 0x0037, 0x6708, + /* 2780 */ 0x0038, 0x6708, + /* 2782 */ 0x0039, 0x6708, + /* 2784 */ 0x0031, 0x0030, 0x6708, + /* 2787 */ 0x0031, 0x0031, 0x6708, + /* 2790 */ 0x0031, 0x0032, 0x6708, + /* 2793 */ 0x0048, 0x0067, + /* 2795 */ 0x0065, 0x0072, 0x0067, + /* 2798 */ 0x0065, 0x0056, + /* 2800 */ 0x004C, 0x0054, 0x0044, + /* 2803 */ 0x4EE4, 0x548C, + /* 2805 */ 0x30A2, 0x30D1, 0x30FC, 0x30C8, + /* 2809 */ 0x30A2, 0x30EB, 0x30D5, 0x30A1, + /* 2813 */ 0x30A2, 0x30F3, 0x30DA, 0x30A2, + /* 2817 */ 0x30A2, 0x30FC, 0x30EB, + /* 2820 */ 0x30A4, 0x30CB, 0x30F3, 0x30B0, + /* 2824 */ 0x30A4, 0x30F3, 0x30C1, + /* 2827 */ 0x30A6, 0x30A9, 0x30F3, + /* 2830 */ 0x30A8, 0x30B9, 0x30AF, 0x30FC, 0x30C9, + /* 2835 */ 0x30A8, 0x30FC, 0x30AB, 0x30FC, + /* 2839 */ 0x30AA, 0x30F3, 0x30B9, + /* 2842 */ 0x30AA, 0x30FC, 0x30E0, + /* 2845 */ 0x30AB, 0x30A4, 0x30EA, + /* 2848 */ 0x30AB, 0x30E9, 0x30C3, 0x30C8, + /* 2852 */ 0x30AB, 0x30ED, 0x30EA, 0x30FC, + /* 2856 */ 0x30AC, 0x30ED, 0x30F3, + /* 2859 */ 0x30AC, 0x30F3, 0x30DE, + /* 2862 */ 0x30AE, 0x30AC, + /* 2864 */ 0x30AE, 0x30CB, 0x30FC, + /* 2867 */ 0x30AD, 0x30E5, 0x30EA, 0x30FC, + /* 2871 */ 0x30AE, 0x30EB, 0x30C0, 0x30FC, + /* 2875 */ 0x30AD, 0x30ED, + /* 2877 */ 0x30AD, 0x30ED, 0x30B0, 0x30E9, 0x30E0, + /* 2882 */ 0x30AD, 0x30ED, 0x30E1, 0x30FC, 0x30C8, 0x30EB, + /* 2888 */ 0x30AD, 0x30ED, 0x30EF, 0x30C3, 0x30C8, + /* 2893 */ 0x30B0, 0x30E9, 0x30E0, + /* 2896 */ 0x30B0, 0x30E9, 0x30E0, 0x30C8, 0x30F3, + /* 2901 */ 0x30AF, 0x30EB, 0x30BC, 0x30A4, 0x30ED, + /* 2906 */ 0x30AF, 0x30ED, 0x30FC, 0x30CD, + /* 2910 */ 0x30B1, 0x30FC, 0x30B9, + /* 2913 */ 0x30B3, 0x30EB, 0x30CA, + /* 2916 */ 0x30B3, 0x30FC, 0x30DD, + /* 2919 */ 0x30B5, 0x30A4, 0x30AF, 0x30EB, + /* 2923 */ 0x30B5, 0x30F3, 0x30C1, 0x30FC, 0x30E0, + /* 2928 */ 0x30B7, 0x30EA, 0x30F3, 0x30B0, + /* 2932 */ 0x30BB, 0x30F3, 0x30C1, + /* 2935 */ 0x30BB, 0x30F3, 0x30C8, + /* 2938 */ 0x30C0, 0x30FC, 0x30B9, + /* 2941 */ 0x30C7, 0x30B7, + /* 2943 */ 0x30C9, 0x30EB, + /* 2945 */ 0x30C8, 0x30F3, + /* 2947 */ 0x30CA, 0x30CE, + /* 2949 */ 0x30CE, 0x30C3, 0x30C8, + /* 2952 */ 0x30CF, 0x30A4, 0x30C4, + /* 2955 */ 0x30D1, 0x30FC, 0x30BB, 0x30F3, 0x30C8, + /* 2960 */ 0x30D1, 0x30FC, 0x30C4, + /* 2963 */ 0x30D0, 0x30FC, 0x30EC, 0x30EB, + /* 2967 */ 0x30D4, 0x30A2, 0x30B9, 0x30C8, 0x30EB, + /* 2972 */ 0x30D4, 0x30AF, 0x30EB, + /* 2975 */ 0x30D4, 0x30B3, + /* 2977 */ 0x30D3, 0x30EB, + /* 2979 */ 0x30D5, 0x30A1, 0x30E9, 0x30C3, 0x30C9, + /* 2984 */ 0x30D5, 0x30A3, 0x30FC, 0x30C8, + /* 2988 */ 0x30D6, 0x30C3, 0x30B7, 0x30A7, 0x30EB, + /* 2993 */ 0x30D5, 0x30E9, 0x30F3, + /* 2996 */ 0x30D8, 0x30AF, 0x30BF, 0x30FC, 0x30EB, + /* 3001 */ 0x30DA, 0x30BD, + /* 3003 */ 0x30DA, 0x30CB, 0x30D2, + /* 3006 */ 0x30D8, 0x30EB, 0x30C4, + /* 3009 */ 0x30DA, 0x30F3, 0x30B9, + /* 3012 */ 0x30DA, 0x30FC, 0x30B8, + /* 3015 */ 0x30D9, 0x30FC, 0x30BF, + /* 3018 */ 0x30DD, 0x30A4, 0x30F3, 0x30C8, + /* 3022 */ 0x30DC, 0x30EB, 0x30C8, + /* 3025 */ 0x30DB, 0x30F3, + /* 3027 */ 0x30DD, 0x30F3, 0x30C9, + /* 3030 */ 0x30DB, 0x30FC, 0x30EB, + /* 3033 */ 0x30DB, 0x30FC, 0x30F3, + /* 3036 */ 0x30DE, 0x30A4, 0x30AF, 0x30ED, + /* 3040 */ 0x30DE, 0x30A4, 0x30EB, + /* 3043 */ 0x30DE, 0x30C3, 0x30CF, + /* 3046 */ 0x30DE, 0x30EB, 0x30AF, + /* 3049 */ 0x30DE, 0x30F3, 0x30B7, 0x30E7, 0x30F3, + /* 3054 */ 0x30DF, 0x30AF, 0x30ED, 0x30F3, + /* 3058 */ 0x30DF, 0x30EA, + /* 3060 */ 0x30DF, 0x30EA, 0x30D0, 0x30FC, 0x30EB, + /* 3065 */ 0x30E1, 0x30AC, + /* 3067 */ 0x30E1, 0x30AC, 0x30C8, 0x30F3, + /* 3071 */ 0x30E1, 0x30FC, 0x30C8, 0x30EB, + /* 3075 */ 0x30E4, 0x30FC, 0x30C9, + /* 3078 */ 0x30E4, 0x30FC, 0x30EB, + /* 3081 */ 0x30E6, 0x30A2, 0x30F3, + /* 3084 */ 0x30EA, 0x30C3, 0x30C8, 0x30EB, + /* 3088 */ 0x30EA, 0x30E9, + /* 3090 */ 0x30EB, 0x30D4, 0x30FC, + /* 3093 */ 0x30EB, 0x30FC, 0x30D6, 0x30EB, + /* 3097 */ 0x30EC, 0x30E0, + /* 3099 */ 0x30EC, 0x30F3, 0x30C8, 0x30B2, 0x30F3, + /* 3104 */ 0x30EF, 0x30C3, 0x30C8, + /* 3107 */ 0x0030, 0x70B9, + /* 3109 */ 0x0031, 0x70B9, + /* 3111 */ 0x0032, 0x70B9, + /* 3113 */ 0x0033, 0x70B9, + /* 3115 */ 0x0034, 0x70B9, + /* 3117 */ 0x0035, 0x70B9, + /* 3119 */ 0x0036, 0x70B9, + /* 3121 */ 0x0037, 0x70B9, + /* 3123 */ 0x0038, 0x70B9, + /* 3125 */ 0x0039, 0x70B9, + /* 3127 */ 0x0031, 0x0030, 0x70B9, + /* 3130 */ 0x0031, 0x0031, 0x70B9, + /* 3133 */ 0x0031, 0x0032, 0x70B9, + /* 3136 */ 0x0031, 0x0033, 0x70B9, + /* 3139 */ 0x0031, 0x0034, 0x70B9, + /* 3142 */ 0x0031, 0x0035, 0x70B9, + /* 3145 */ 0x0031, 0x0036, 0x70B9, + /* 3148 */ 0x0031, 0x0037, 0x70B9, + /* 3151 */ 0x0031, 0x0038, 0x70B9, + /* 3154 */ 0x0031, 0x0039, 0x70B9, + /* 3157 */ 0x0032, 0x0030, 0x70B9, + /* 3160 */ 0x0032, 0x0031, 0x70B9, + /* 3163 */ 0x0032, 0x0032, 0x70B9, + /* 3166 */ 0x0032, 0x0033, 0x70B9, + /* 3169 */ 0x0032, 0x0034, 0x70B9, + /* 3172 */ 0x0068, 0x0050, 0x0061, + /* 3175 */ 0x0064, 0x0061, + /* 3177 */ 0x0041, 0x0055, + /* 3179 */ 0x0062, 0x0061, 0x0072, + /* 3182 */ 0x006F, 0x0056, + /* 3184 */ 0x0070, 0x0063, + /* 3186 */ 0x0064, 0x006D, + /* 3188 */ 0x0064, 0x006D, 0x00B2, + /* 3191 */ 0x0064, 0x006D, 0x00B3, + /* 3194 */ 0x0049, 0x0055, + /* 3196 */ 0x5E73, 0x6210, + /* 3198 */ 0x662D, 0x548C, + /* 3200 */ 0x5927, 0x6B63, + /* 3202 */ 0x660E, 0x6CBB, + /* 3204 */ 0x682A, 0x5F0F, 0x4F1A, 0x793E, + /* 3208 */ 0x0070, 0x0041, + /* 3210 */ 0x006E, 0x0041, + /* 3212 */ 0x03BC, 0x0041, + /* 3214 */ 0x006D, 0x0041, + /* 3216 */ 0x006B, 0x0041, + /* 3218 */ 0x004B, 0x0042, + /* 3220 */ 0x004D, 0x0042, + /* 3222 */ 0x0047, 0x0042, + /* 3224 */ 0x0063, 0x0061, 0x006C, + /* 3227 */ 0x006B, 0x0063, 0x0061, 0x006C, + /* 3231 */ 0x0070, 0x0046, + /* 3233 */ 0x006E, 0x0046, + /* 3235 */ 0x03BC, 0x0046, + /* 3237 */ 0x03BC, 0x0067, + /* 3239 */ 0x006D, 0x0067, + /* 3241 */ 0x006B, 0x0067, + /* 3243 */ 0x0048, 0x007A, + /* 3245 */ 0x006B, 0x0048, 0x007A, + /* 3248 */ 0x004D, 0x0048, 0x007A, + /* 3251 */ 0x0047, 0x0048, 0x007A, + /* 3254 */ 0x0054, 0x0048, 0x007A, + /* 3257 */ 0x03BC, 0x2113, + /* 3259 */ 0x006D, 0x2113, + /* 3261 */ 0x0064, 0x2113, + /* 3263 */ 0x006B, 0x2113, + /* 3265 */ 0x0066, 0x006D, + /* 3267 */ 0x006E, 0x006D, + /* 3269 */ 0x03BC, 0x006D, + /* 3271 */ 0x006D, 0x006D, + /* 3273 */ 0x0063, 0x006D, + /* 3275 */ 0x006B, 0x006D, + /* 3277 */ 0x006D, 0x006D, 0x00B2, + /* 3280 */ 0x0063, 0x006D, 0x00B2, + /* 3283 */ 0x006D, 0x00B2, + /* 3285 */ 0x006B, 0x006D, 0x00B2, + /* 3288 */ 0x006D, 0x006D, 0x00B3, + /* 3291 */ 0x0063, 0x006D, 0x00B3, + /* 3294 */ 0x006D, 0x00B3, + /* 3296 */ 0x006B, 0x006D, 0x00B3, + /* 3299 */ 0x006D, 0x2215, 0x0073, + /* 3302 */ 0x006D, 0x2215, 0x0073, 0x00B2, + /* 3306 */ 0x0050, 0x0061, + /* 3308 */ 0x006B, 0x0050, 0x0061, + /* 3311 */ 0x004D, 0x0050, 0x0061, + /* 3314 */ 0x0047, 0x0050, 0x0061, + /* 3317 */ 0x0072, 0x0061, 0x0064, + /* 3320 */ 0x0072, 0x0061, 0x0064, 0x2215, 0x0073, + /* 3325 */ 0x0072, 0x0061, 0x0064, 0x2215, 0x0073, 0x00B2, + /* 3331 */ 0x0070, 0x0073, + /* 3333 */ 0x006E, 0x0073, + /* 3335 */ 0x03BC, 0x0073, + /* 3337 */ 0x006D, 0x0073, + /* 3339 */ 0x0070, 0x0056, + /* 3341 */ 0x006E, 0x0056, + /* 3343 */ 0x03BC, 0x0056, + /* 3345 */ 0x006D, 0x0056, + /* 3347 */ 0x006B, 0x0056, + /* 3349 */ 0x004D, 0x0056, + /* 3351 */ 0x0070, 0x0057, + /* 3353 */ 0x006E, 0x0057, + /* 3355 */ 0x03BC, 0x0057, + /* 3357 */ 0x006D, 0x0057, + /* 3359 */ 0x006B, 0x0057, + /* 3361 */ 0x004D, 0x0057, + /* 3363 */ 0x006B, 0x03A9, + /* 3365 */ 0x004D, 0x03A9, + /* 3367 */ 0x0061, 0x002E, 0x006D, 0x002E, + /* 3371 */ 0x0042, 0x0071, + /* 3373 */ 0x0063, 0x0063, + /* 3375 */ 0x0063, 0x0064, + /* 3377 */ 0x0043, 0x2215, 0x006B, 0x0067, + /* 3381 */ 0x0043, 0x006F, 0x002E, + /* 3384 */ 0x0064, 0x0042, + /* 3386 */ 0x0047, 0x0079, + /* 3388 */ 0x0068, 0x0061, + /* 3390 */ 0x0048, 0x0050, + /* 3392 */ 0x0069, 0x006E, + /* 3394 */ 0x004B, 0x004B, + /* 3396 */ 0x004B, 0x004D, + /* 3398 */ 0x006B, 0x0074, + /* 3400 */ 0x006C, 0x006D, + /* 3402 */ 0x006C, 0x006E, + /* 3404 */ 0x006C, 0x006F, 0x0067, + /* 3407 */ 0x006C, 0x0078, + /* 3409 */ 0x006D, 0x0062, + /* 3411 */ 0x006D, 0x0069, 0x006C, + /* 3414 */ 0x006D, 0x006F, 0x006C, + /* 3417 */ 0x0050, 0x0048, + /* 3419 */ 0x0070, 0x002E, 0x006D, 0x002E, + /* 3423 */ 0x0050, 0x0050, 0x004D, + /* 3426 */ 0x0050, 0x0052, + /* 3428 */ 0x0073, 0x0072, + /* 3430 */ 0x0053, 0x0076, + /* 3432 */ 0x0057, 0x0062, + /* 3434 */ 0x0056, 0x2215, 0x006D, + /* 3437 */ 0x0041, 0x2215, 0x006D, + /* 3440 */ 0x0031, 0x65E5, + /* 3442 */ 0x0032, 0x65E5, + /* 3444 */ 0x0033, 0x65E5, + /* 3446 */ 0x0034, 0x65E5, + /* 3448 */ 0x0035, 0x65E5, + /* 3450 */ 0x0036, 0x65E5, + /* 3452 */ 0x0037, 0x65E5, + /* 3454 */ 0x0038, 0x65E5, + /* 3456 */ 0x0039, 0x65E5, + /* 3458 */ 0x0031, 0x0030, 0x65E5, + /* 3461 */ 0x0031, 0x0031, 0x65E5, + /* 3464 */ 0x0031, 0x0032, 0x65E5, + /* 3467 */ 0x0031, 0x0033, 0x65E5, + /* 3470 */ 0x0031, 0x0034, 0x65E5, + /* 3473 */ 0x0031, 0x0035, 0x65E5, + /* 3476 */ 0x0031, 0x0036, 0x65E5, + /* 3479 */ 0x0031, 0x0037, 0x65E5, + /* 3482 */ 0x0031, 0x0038, 0x65E5, + /* 3485 */ 0x0031, 0x0039, 0x65E5, + /* 3488 */ 0x0032, 0x0030, 0x65E5, + /* 3491 */ 0x0032, 0x0031, 0x65E5, + /* 3494 */ 0x0032, 0x0032, 0x65E5, + /* 3497 */ 0x0032, 0x0033, 0x65E5, + /* 3500 */ 0x0032, 0x0034, 0x65E5, + /* 3503 */ 0x0032, 0x0035, 0x65E5, + /* 3506 */ 0x0032, 0x0036, 0x65E5, + /* 3509 */ 0x0032, 0x0037, 0x65E5, + /* 3512 */ 0x0032, 0x0038, 0x65E5, + /* 3515 */ 0x0032, 0x0039, 0x65E5, + /* 3518 */ 0x0033, 0x0030, 0x65E5, + /* 3521 */ 0x0033, 0x0031, 0x65E5, + /* 3524 */ 0x0067, 0x0061, 0x006C, + /* 3527 */ 0x242EE, + /* 3528 */ 0x2284A, + /* 3529 */ 0x22844, + /* 3530 */ 0x233D5, + /* 3531 */ 0x25249, + /* 3532 */ 0x25CD0, + /* 3533 */ 0x27ED3, + /* 3534 */ 0x0066, 0x0066, + /* 3536 */ 0x0066, 0x0069, + /* 3538 */ 0x0066, 0x006C, + /* 3540 */ 0x0066, 0x0066, 0x0069, + /* 3543 */ 0x0066, 0x0066, 0x006C, + /* 3546 */ 0x017F, 0x0074, + /* 3548 */ 0x0073, 0x0074, + /* 3550 */ 0x0574, 0x0576, + /* 3552 */ 0x0574, 0x0565, + /* 3554 */ 0x0574, 0x056B, + /* 3556 */ 0x057E, 0x0576, + /* 3558 */ 0x0574, 0x056D, + /* 3560 */ 0x05D9, 0x05B4, + /* 3562 */ 0x05F2, 0x05B7, + /* 3564 */ 0x05E9, 0x05C1, + /* 3566 */ 0x05E9, 0x05C2, + /* 3568 */ 0xFB49, 0x05C1, + /* 3570 */ 0xFB49, 0x05C2, + /* 3572 */ 0x05D0, 0x05B7, + /* 3574 */ 0x05D0, 0x05B8, + /* 3576 */ 0x05D0, 0x05BC, + /* 3578 */ 0x05D1, 0x05BC, + /* 3580 */ 0x05D2, 0x05BC, + /* 3582 */ 0x05D3, 0x05BC, + /* 3584 */ 0x05D4, 0x05BC, + /* 3586 */ 0x05D5, 0x05BC, + /* 3588 */ 0x05D6, 0x05BC, + /* 3590 */ 0x05D8, 0x05BC, + /* 3592 */ 0x05D9, 0x05BC, + /* 3594 */ 0x05DA, 0x05BC, + /* 3596 */ 0x05DB, 0x05BC, + /* 3598 */ 0x05DC, 0x05BC, + /* 3600 */ 0x05DE, 0x05BC, + /* 3602 */ 0x05E0, 0x05BC, + /* 3604 */ 0x05E1, 0x05BC, + /* 3606 */ 0x05E3, 0x05BC, + /* 3608 */ 0x05E4, 0x05BC, + /* 3610 */ 0x05E6, 0x05BC, + /* 3612 */ 0x05E7, 0x05BC, + /* 3614 */ 0x05E8, 0x05BC, + /* 3616 */ 0x05E9, 0x05BC, + /* 3618 */ 0x05EA, 0x05BC, + /* 3620 */ 0x05D5, 0x05B9, + /* 3622 */ 0x05D1, 0x05BF, + /* 3624 */ 0x05DB, 0x05BF, + /* 3626 */ 0x05E4, 0x05BF, + /* 3628 */ 0x05D0, 0x05DC, + /* 3630 */ 0x0626, 0x0627, + /* 3632 */ 0x0626, 0x0627, + /* 3634 */ 0x0626, 0x06D5, + /* 3636 */ 0x0626, 0x06D5, + /* 3638 */ 0x0626, 0x0648, + /* 3640 */ 0x0626, 0x0648, + /* 3642 */ 0x0626, 0x06C7, + /* 3644 */ 0x0626, 0x06C7, + /* 3646 */ 0x0626, 0x06C6, + /* 3648 */ 0x0626, 0x06C6, + /* 3650 */ 0x0626, 0x06C8, + /* 3652 */ 0x0626, 0x06C8, + /* 3654 */ 0x0626, 0x06D0, + /* 3656 */ 0x0626, 0x06D0, + /* 3658 */ 0x0626, 0x06D0, + /* 3660 */ 0x0626, 0x0649, + /* 3662 */ 0x0626, 0x0649, + /* 3664 */ 0x0626, 0x0649, + /* 3666 */ 0x0626, 0x062C, + /* 3668 */ 0x0626, 0x062D, + /* 3670 */ 0x0626, 0x0645, + /* 3672 */ 0x0626, 0x0649, + /* 3674 */ 0x0626, 0x064A, + /* 3676 */ 0x0628, 0x062C, + /* 3678 */ 0x0628, 0x062D, + /* 3680 */ 0x0628, 0x062E, + /* 3682 */ 0x0628, 0x0645, + /* 3684 */ 0x0628, 0x0649, + /* 3686 */ 0x0628, 0x064A, + /* 3688 */ 0x062A, 0x062C, + /* 3690 */ 0x062A, 0x062D, + /* 3692 */ 0x062A, 0x062E, + /* 3694 */ 0x062A, 0x0645, + /* 3696 */ 0x062A, 0x0649, + /* 3698 */ 0x062A, 0x064A, + /* 3700 */ 0x062B, 0x062C, + /* 3702 */ 0x062B, 0x0645, + /* 3704 */ 0x062B, 0x0649, + /* 3706 */ 0x062B, 0x064A, + /* 3708 */ 0x062C, 0x062D, + /* 3710 */ 0x062C, 0x0645, + /* 3712 */ 0x062D, 0x062C, + /* 3714 */ 0x062D, 0x0645, + /* 3716 */ 0x062E, 0x062C, + /* 3718 */ 0x062E, 0x062D, + /* 3720 */ 0x062E, 0x0645, + /* 3722 */ 0x0633, 0x062C, + /* 3724 */ 0x0633, 0x062D, + /* 3726 */ 0x0633, 0x062E, + /* 3728 */ 0x0633, 0x0645, + /* 3730 */ 0x0635, 0x062D, + /* 3732 */ 0x0635, 0x0645, + /* 3734 */ 0x0636, 0x062C, + /* 3736 */ 0x0636, 0x062D, + /* 3738 */ 0x0636, 0x062E, + /* 3740 */ 0x0636, 0x0645, + /* 3742 */ 0x0637, 0x062D, + /* 3744 */ 0x0637, 0x0645, + /* 3746 */ 0x0638, 0x0645, + /* 3748 */ 0x0639, 0x062C, + /* 3750 */ 0x0639, 0x0645, + /* 3752 */ 0x063A, 0x062C, + /* 3754 */ 0x063A, 0x0645, + /* 3756 */ 0x0641, 0x062C, + /* 3758 */ 0x0641, 0x062D, + /* 3760 */ 0x0641, 0x062E, + /* 3762 */ 0x0641, 0x0645, + /* 3764 */ 0x0641, 0x0649, + /* 3766 */ 0x0641, 0x064A, + /* 3768 */ 0x0642, 0x062D, + /* 3770 */ 0x0642, 0x0645, + /* 3772 */ 0x0642, 0x0649, + /* 3774 */ 0x0642, 0x064A, + /* 3776 */ 0x0643, 0x0627, + /* 3778 */ 0x0643, 0x062C, + /* 3780 */ 0x0643, 0x062D, + /* 3782 */ 0x0643, 0x062E, + /* 3784 */ 0x0643, 0x0644, + /* 3786 */ 0x0643, 0x0645, + /* 3788 */ 0x0643, 0x0649, + /* 3790 */ 0x0643, 0x064A, + /* 3792 */ 0x0644, 0x062C, + /* 3794 */ 0x0644, 0x062D, + /* 3796 */ 0x0644, 0x062E, + /* 3798 */ 0x0644, 0x0645, + /* 3800 */ 0x0644, 0x0649, + /* 3802 */ 0x0644, 0x064A, + /* 3804 */ 0x0645, 0x062C, + /* 3806 */ 0x0645, 0x062D, + /* 3808 */ 0x0645, 0x062E, + /* 3810 */ 0x0645, 0x0645, + /* 3812 */ 0x0645, 0x0649, + /* 3814 */ 0x0645, 0x064A, + /* 3816 */ 0x0646, 0x062C, + /* 3818 */ 0x0646, 0x062D, + /* 3820 */ 0x0646, 0x062E, + /* 3822 */ 0x0646, 0x0645, + /* 3824 */ 0x0646, 0x0649, + /* 3826 */ 0x0646, 0x064A, + /* 3828 */ 0x0647, 0x062C, + /* 3830 */ 0x0647, 0x0645, + /* 3832 */ 0x0647, 0x0649, + /* 3834 */ 0x0647, 0x064A, + /* 3836 */ 0x064A, 0x062C, + /* 3838 */ 0x064A, 0x062D, + /* 3840 */ 0x064A, 0x062E, + /* 3842 */ 0x064A, 0x0645, + /* 3844 */ 0x064A, 0x0649, + /* 3846 */ 0x064A, 0x064A, + /* 3848 */ 0x0630, 0x0670, + /* 3850 */ 0x0631, 0x0670, + /* 3852 */ 0x0649, 0x0670, + /* 3854 */ 0x0020, 0x064C, 0x0651, + /* 3857 */ 0x0020, 0x064D, 0x0651, + /* 3860 */ 0x0020, 0x064E, 0x0651, + /* 3863 */ 0x0020, 0x064F, 0x0651, + /* 3866 */ 0x0020, 0x0650, 0x0651, + /* 3869 */ 0x0020, 0x0651, 0x0670, + /* 3872 */ 0x0626, 0x0631, + /* 3874 */ 0x0626, 0x0632, + /* 3876 */ 0x0626, 0x0645, + /* 3878 */ 0x0626, 0x0646, + /* 3880 */ 0x0626, 0x0649, + /* 3882 */ 0x0626, 0x064A, + /* 3884 */ 0x0628, 0x0631, + /* 3886 */ 0x0628, 0x0632, + /* 3888 */ 0x0628, 0x0645, + /* 3890 */ 0x0628, 0x0646, + /* 3892 */ 0x0628, 0x0649, + /* 3894 */ 0x0628, 0x064A, + /* 3896 */ 0x062A, 0x0631, + /* 3898 */ 0x062A, 0x0632, + /* 3900 */ 0x062A, 0x0645, + /* 3902 */ 0x062A, 0x0646, + /* 3904 */ 0x062A, 0x0649, + /* 3906 */ 0x062A, 0x064A, + /* 3908 */ 0x062B, 0x0631, + /* 3910 */ 0x062B, 0x0632, + /* 3912 */ 0x062B, 0x0645, + /* 3914 */ 0x062B, 0x0646, + /* 3916 */ 0x062B, 0x0649, + /* 3918 */ 0x062B, 0x064A, + /* 3920 */ 0x0641, 0x0649, + /* 3922 */ 0x0641, 0x064A, + /* 3924 */ 0x0642, 0x0649, + /* 3926 */ 0x0642, 0x064A, + /* 3928 */ 0x0643, 0x0627, + /* 3930 */ 0x0643, 0x0644, + /* 3932 */ 0x0643, 0x0645, + /* 3934 */ 0x0643, 0x0649, + /* 3936 */ 0x0643, 0x064A, + /* 3938 */ 0x0644, 0x0645, + /* 3940 */ 0x0644, 0x0649, + /* 3942 */ 0x0644, 0x064A, + /* 3944 */ 0x0645, 0x0627, + /* 3946 */ 0x0645, 0x0645, + /* 3948 */ 0x0646, 0x0631, + /* 3950 */ 0x0646, 0x0632, + /* 3952 */ 0x0646, 0x0645, + /* 3954 */ 0x0646, 0x0646, + /* 3956 */ 0x0646, 0x0649, + /* 3958 */ 0x0646, 0x064A, + /* 3960 */ 0x0649, 0x0670, + /* 3962 */ 0x064A, 0x0631, + /* 3964 */ 0x064A, 0x0632, + /* 3966 */ 0x064A, 0x0645, + /* 3968 */ 0x064A, 0x0646, + /* 3970 */ 0x064A, 0x0649, + /* 3972 */ 0x064A, 0x064A, + /* 3974 */ 0x0626, 0x062C, + /* 3976 */ 0x0626, 0x062D, + /* 3978 */ 0x0626, 0x062E, + /* 3980 */ 0x0626, 0x0645, + /* 3982 */ 0x0626, 0x0647, + /* 3984 */ 0x0628, 0x062C, + /* 3986 */ 0x0628, 0x062D, + /* 3988 */ 0x0628, 0x062E, + /* 3990 */ 0x0628, 0x0645, + /* 3992 */ 0x0628, 0x0647, + /* 3994 */ 0x062A, 0x062C, + /* 3996 */ 0x062A, 0x062D, + /* 3998 */ 0x062A, 0x062E, + /* 4000 */ 0x062A, 0x0645, + /* 4002 */ 0x062A, 0x0647, + /* 4004 */ 0x062B, 0x0645, + /* 4006 */ 0x062C, 0x062D, + /* 4008 */ 0x062C, 0x0645, + /* 4010 */ 0x062D, 0x062C, + /* 4012 */ 0x062D, 0x0645, + /* 4014 */ 0x062E, 0x062C, + /* 4016 */ 0x062E, 0x0645, + /* 4018 */ 0x0633, 0x062C, + /* 4020 */ 0x0633, 0x062D, + /* 4022 */ 0x0633, 0x062E, + /* 4024 */ 0x0633, 0x0645, + /* 4026 */ 0x0635, 0x062D, + /* 4028 */ 0x0635, 0x062E, + /* 4030 */ 0x0635, 0x0645, + /* 4032 */ 0x0636, 0x062C, + /* 4034 */ 0x0636, 0x062D, + /* 4036 */ 0x0636, 0x062E, + /* 4038 */ 0x0636, 0x0645, + /* 4040 */ 0x0637, 0x062D, + /* 4042 */ 0x0638, 0x0645, + /* 4044 */ 0x0639, 0x062C, + /* 4046 */ 0x0639, 0x0645, + /* 4048 */ 0x063A, 0x062C, + /* 4050 */ 0x063A, 0x0645, + /* 4052 */ 0x0641, 0x062C, + /* 4054 */ 0x0641, 0x062D, + /* 4056 */ 0x0641, 0x062E, + /* 4058 */ 0x0641, 0x0645, + /* 4060 */ 0x0642, 0x062D, + /* 4062 */ 0x0642, 0x0645, + /* 4064 */ 0x0643, 0x062C, + /* 4066 */ 0x0643, 0x062D, + /* 4068 */ 0x0643, 0x062E, + /* 4070 */ 0x0643, 0x0644, + /* 4072 */ 0x0643, 0x0645, + /* 4074 */ 0x0644, 0x062C, + /* 4076 */ 0x0644, 0x062D, + /* 4078 */ 0x0644, 0x062E, + /* 4080 */ 0x0644, 0x0645, + /* 4082 */ 0x0644, 0x0647, + /* 4084 */ 0x0645, 0x062C, + /* 4086 */ 0x0645, 0x062D, + /* 4088 */ 0x0645, 0x062E, + /* 4090 */ 0x0645, 0x0645, + /* 4092 */ 0x0646, 0x062C, + /* 4094 */ 0x0646, 0x062D, + /* 4096 */ 0x0646, 0x062E, + /* 4098 */ 0x0646, 0x0645, + /* 4100 */ 0x0646, 0x0647, + /* 4102 */ 0x0647, 0x062C, + /* 4104 */ 0x0647, 0x0645, + /* 4106 */ 0x0647, 0x0670, + /* 4108 */ 0x064A, 0x062C, + /* 4110 */ 0x064A, 0x062D, + /* 4112 */ 0x064A, 0x062E, + /* 4114 */ 0x064A, 0x0645, + /* 4116 */ 0x064A, 0x0647, + /* 4118 */ 0x0626, 0x0645, + /* 4120 */ 0x0626, 0x0647, + /* 4122 */ 0x0628, 0x0645, + /* 4124 */ 0x0628, 0x0647, + /* 4126 */ 0x062A, 0x0645, + /* 4128 */ 0x062A, 0x0647, + /* 4130 */ 0x062B, 0x0645, + /* 4132 */ 0x062B, 0x0647, + /* 4134 */ 0x0633, 0x0645, + /* 4136 */ 0x0633, 0x0647, + /* 4138 */ 0x0634, 0x0645, + /* 4140 */ 0x0634, 0x0647, + /* 4142 */ 0x0643, 0x0644, + /* 4144 */ 0x0643, 0x0645, + /* 4146 */ 0x0644, 0x0645, + /* 4148 */ 0x0646, 0x0645, + /* 4150 */ 0x0646, 0x0647, + /* 4152 */ 0x064A, 0x0645, + /* 4154 */ 0x064A, 0x0647, + /* 4156 */ 0x0640, 0x064E, 0x0651, + /* 4159 */ 0x0640, 0x064F, 0x0651, + /* 4162 */ 0x0640, 0x0650, 0x0651, + /* 4165 */ 0x0637, 0x0649, + /* 4167 */ 0x0637, 0x064A, + /* 4169 */ 0x0639, 0x0649, + /* 4171 */ 0x0639, 0x064A, + /* 4173 */ 0x063A, 0x0649, + /* 4175 */ 0x063A, 0x064A, + /* 4177 */ 0x0633, 0x0649, + /* 4179 */ 0x0633, 0x064A, + /* 4181 */ 0x0634, 0x0649, + /* 4183 */ 0x0634, 0x064A, + /* 4185 */ 0x062D, 0x0649, + /* 4187 */ 0x062D, 0x064A, + /* 4189 */ 0x062C, 0x0649, + /* 4191 */ 0x062C, 0x064A, + /* 4193 */ 0x062E, 0x0649, + /* 4195 */ 0x062E, 0x064A, + /* 4197 */ 0x0635, 0x0649, + /* 4199 */ 0x0635, 0x064A, + /* 4201 */ 0x0636, 0x0649, + /* 4203 */ 0x0636, 0x064A, + /* 4205 */ 0x0634, 0x062C, + /* 4207 */ 0x0634, 0x062D, + /* 4209 */ 0x0634, 0x062E, + /* 4211 */ 0x0634, 0x0645, + /* 4213 */ 0x0634, 0x0631, + /* 4215 */ 0x0633, 0x0631, + /* 4217 */ 0x0635, 0x0631, + /* 4219 */ 0x0636, 0x0631, + /* 4221 */ 0x0637, 0x0649, + /* 4223 */ 0x0637, 0x064A, + /* 4225 */ 0x0639, 0x0649, + /* 4227 */ 0x0639, 0x064A, + /* 4229 */ 0x063A, 0x0649, + /* 4231 */ 0x063A, 0x064A, + /* 4233 */ 0x0633, 0x0649, + /* 4235 */ 0x0633, 0x064A, + /* 4237 */ 0x0634, 0x0649, + /* 4239 */ 0x0634, 0x064A, + /* 4241 */ 0x062D, 0x0649, + /* 4243 */ 0x062D, 0x064A, + /* 4245 */ 0x062C, 0x0649, + /* 4247 */ 0x062C, 0x064A, + /* 4249 */ 0x062E, 0x0649, + /* 4251 */ 0x062E, 0x064A, + /* 4253 */ 0x0635, 0x0649, + /* 4255 */ 0x0635, 0x064A, + /* 4257 */ 0x0636, 0x0649, + /* 4259 */ 0x0636, 0x064A, + /* 4261 */ 0x0634, 0x062C, + /* 4263 */ 0x0634, 0x062D, + /* 4265 */ 0x0634, 0x062E, + /* 4267 */ 0x0634, 0x0645, + /* 4269 */ 0x0634, 0x0631, + /* 4271 */ 0x0633, 0x0631, + /* 4273 */ 0x0635, 0x0631, + /* 4275 */ 0x0636, 0x0631, + /* 4277 */ 0x0634, 0x062C, + /* 4279 */ 0x0634, 0x062D, + /* 4281 */ 0x0634, 0x062E, + /* 4283 */ 0x0634, 0x0645, + /* 4285 */ 0x0633, 0x0647, + /* 4287 */ 0x0634, 0x0647, + /* 4289 */ 0x0637, 0x0645, + /* 4291 */ 0x0633, 0x062C, + /* 4293 */ 0x0633, 0x062D, + /* 4295 */ 0x0633, 0x062E, + /* 4297 */ 0x0634, 0x062C, + /* 4299 */ 0x0634, 0x062D, + /* 4301 */ 0x0634, 0x062E, + /* 4303 */ 0x0637, 0x0645, + /* 4305 */ 0x0638, 0x0645, + /* 4307 */ 0x0627, 0x064B, + /* 4309 */ 0x0627, 0x064B, + /* 4311 */ 0x062A, 0x062C, 0x0645, + /* 4314 */ 0x062A, 0x062D, 0x062C, + /* 4317 */ 0x062A, 0x062D, 0x062C, + /* 4320 */ 0x062A, 0x062D, 0x0645, + /* 4323 */ 0x062A, 0x062E, 0x0645, + /* 4326 */ 0x062A, 0x0645, 0x062C, + /* 4329 */ 0x062A, 0x0645, 0x062D, + /* 4332 */ 0x062A, 0x0645, 0x062E, + /* 4335 */ 0x062C, 0x0645, 0x062D, + /* 4338 */ 0x062C, 0x0645, 0x062D, + /* 4341 */ 0x062D, 0x0645, 0x064A, + /* 4344 */ 0x062D, 0x0645, 0x0649, + /* 4347 */ 0x0633, 0x062D, 0x062C, + /* 4350 */ 0x0633, 0x062C, 0x062D, + /* 4353 */ 0x0633, 0x062C, 0x0649, + /* 4356 */ 0x0633, 0x0645, 0x062D, + /* 4359 */ 0x0633, 0x0645, 0x062D, + /* 4362 */ 0x0633, 0x0645, 0x062C, + /* 4365 */ 0x0633, 0x0645, 0x0645, + /* 4368 */ 0x0633, 0x0645, 0x0645, + /* 4371 */ 0x0635, 0x062D, 0x062D, + /* 4374 */ 0x0635, 0x062D, 0x062D, + /* 4377 */ 0x0635, 0x0645, 0x0645, + /* 4380 */ 0x0634, 0x062D, 0x0645, + /* 4383 */ 0x0634, 0x062D, 0x0645, + /* 4386 */ 0x0634, 0x062C, 0x064A, + /* 4389 */ 0x0634, 0x0645, 0x062E, + /* 4392 */ 0x0634, 0x0645, 0x062E, + /* 4395 */ 0x0634, 0x0645, 0x0645, + /* 4398 */ 0x0634, 0x0645, 0x0645, + /* 4401 */ 0x0636, 0x062D, 0x0649, + /* 4404 */ 0x0636, 0x062E, 0x0645, + /* 4407 */ 0x0636, 0x062E, 0x0645, + /* 4410 */ 0x0637, 0x0645, 0x062D, + /* 4413 */ 0x0637, 0x0645, 0x062D, + /* 4416 */ 0x0637, 0x0645, 0x0645, + /* 4419 */ 0x0637, 0x0645, 0x064A, + /* 4422 */ 0x0639, 0x062C, 0x0645, + /* 4425 */ 0x0639, 0x0645, 0x0645, + /* 4428 */ 0x0639, 0x0645, 0x0645, + /* 4431 */ 0x0639, 0x0645, 0x0649, + /* 4434 */ 0x063A, 0x0645, 0x0645, + /* 4437 */ 0x063A, 0x0645, 0x064A, + /* 4440 */ 0x063A, 0x0645, 0x0649, + /* 4443 */ 0x0641, 0x062E, 0x0645, + /* 4446 */ 0x0641, 0x062E, 0x0645, + /* 4449 */ 0x0642, 0x0645, 0x062D, + /* 4452 */ 0x0642, 0x0645, 0x0645, + /* 4455 */ 0x0644, 0x062D, 0x0645, + /* 4458 */ 0x0644, 0x062D, 0x064A, + /* 4461 */ 0x0644, 0x062D, 0x0649, + /* 4464 */ 0x0644, 0x062C, 0x062C, + /* 4467 */ 0x0644, 0x062C, 0x062C, + /* 4470 */ 0x0644, 0x062E, 0x0645, + /* 4473 */ 0x0644, 0x062E, 0x0645, + /* 4476 */ 0x0644, 0x0645, 0x062D, + /* 4479 */ 0x0644, 0x0645, 0x062D, + /* 4482 */ 0x0645, 0x062D, 0x062C, + /* 4485 */ 0x0645, 0x062D, 0x0645, + /* 4488 */ 0x0645, 0x062D, 0x064A, + /* 4491 */ 0x0645, 0x062C, 0x062D, + /* 4494 */ 0x0645, 0x062C, 0x0645, + /* 4497 */ 0x0645, 0x062E, 0x062C, + /* 4500 */ 0x0645, 0x062E, 0x0645, + /* 4503 */ 0x0645, 0x062C, 0x062E, + /* 4506 */ 0x0647, 0x0645, 0x062C, + /* 4509 */ 0x0647, 0x0645, 0x0645, + /* 4512 */ 0x0646, 0x062D, 0x0645, + /* 4515 */ 0x0646, 0x062D, 0x0649, + /* 4518 */ 0x0646, 0x062C, 0x0645, + /* 4521 */ 0x0646, 0x062C, 0x0645, + /* 4524 */ 0x0646, 0x062C, 0x0649, + /* 4527 */ 0x0646, 0x0645, 0x064A, + /* 4530 */ 0x0646, 0x0645, 0x0649, + /* 4533 */ 0x064A, 0x0645, 0x0645, + /* 4536 */ 0x064A, 0x0645, 0x0645, + /* 4539 */ 0x0628, 0x062E, 0x064A, + /* 4542 */ 0x062A, 0x062C, 0x064A, + /* 4545 */ 0x062A, 0x062C, 0x0649, + /* 4548 */ 0x062A, 0x062E, 0x064A, + /* 4551 */ 0x062A, 0x062E, 0x0649, + /* 4554 */ 0x062A, 0x0645, 0x064A, + /* 4557 */ 0x062A, 0x0645, 0x0649, + /* 4560 */ 0x062C, 0x0645, 0x064A, + /* 4563 */ 0x062C, 0x062D, 0x0649, + /* 4566 */ 0x062C, 0x0645, 0x0649, + /* 4569 */ 0x0633, 0x062E, 0x0649, + /* 4572 */ 0x0635, 0x062D, 0x064A, + /* 4575 */ 0x0634, 0x062D, 0x064A, + /* 4578 */ 0x0636, 0x062D, 0x064A, + /* 4581 */ 0x0644, 0x062C, 0x064A, + /* 4584 */ 0x0644, 0x0645, 0x064A, + /* 4587 */ 0x064A, 0x062D, 0x064A, + /* 4590 */ 0x064A, 0x062C, 0x064A, + /* 4593 */ 0x064A, 0x0645, 0x064A, + /* 4596 */ 0x0645, 0x0645, 0x064A, + /* 4599 */ 0x0642, 0x0645, 0x064A, + /* 4602 */ 0x0646, 0x062D, 0x064A, + /* 4605 */ 0x0642, 0x0645, 0x062D, + /* 4608 */ 0x0644, 0x062D, 0x0645, + /* 4611 */ 0x0639, 0x0645, 0x064A, + /* 4614 */ 0x0643, 0x0645, 0x064A, + /* 4617 */ 0x0646, 0x062C, 0x062D, + /* 4620 */ 0x0645, 0x062E, 0x064A, + /* 4623 */ 0x0644, 0x062C, 0x0645, + /* 4626 */ 0x0643, 0x0645, 0x0645, + /* 4629 */ 0x0644, 0x062C, 0x0645, + /* 4632 */ 0x0646, 0x062C, 0x062D, + /* 4635 */ 0x062C, 0x062D, 0x064A, + /* 4638 */ 0x062D, 0x062C, 0x064A, + /* 4641 */ 0x0645, 0x062C, 0x064A, + /* 4644 */ 0x0641, 0x0645, 0x064A, + /* 4647 */ 0x0628, 0x062D, 0x064A, + /* 4650 */ 0x0643, 0x0645, 0x0645, + /* 4653 */ 0x0639, 0x062C, 0x0645, + /* 4656 */ 0x0635, 0x0645, 0x0645, + /* 4659 */ 0x0633, 0x062E, 0x064A, + /* 4662 */ 0x0646, 0x062C, 0x064A, + /* 4665 */ 0x0635, 0x0644, 0x06D2, + /* 4668 */ 0x0642, 0x0644, 0x06D2, + /* 4671 */ 0x0627, 0x0644, 0x0644, 0x0647, + /* 4675 */ 0x0627, 0x0643, 0x0628, 0x0631, + /* 4679 */ 0x0645, 0x062D, 0x0645, 0x062F, + /* 4683 */ 0x0635, 0x0644, 0x0639, 0x0645, + /* 4687 */ 0x0631, 0x0633, 0x0648, 0x0644, + /* 4691 */ 0x0639, 0x0644, 0x064A, 0x0647, + /* 4695 */ 0x0648, 0x0633, 0x0644, 0x0645, + /* 4699 */ 0x0635, 0x0644, 0x0649, + /* 4702 */ 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645, + /* 4720 */ 0x062C, 0x0644, 0x0020, 0x062C, 0x0644, 0x0627, 0x0644, 0x0647, + /* 4728 */ 0x0631, 0x06CC, 0x0627, 0x0644, + /* 4732 */ 0x0020, 0x064B, + /* 4734 */ 0x0640, 0x064B, + /* 4736 */ 0x0020, 0x064C, + /* 4738 */ 0x0020, 0x064D, + /* 4740 */ 0x0020, 0x064E, + /* 4742 */ 0x0640, 0x064E, + /* 4744 */ 0x0020, 0x064F, + /* 4746 */ 0x0640, 0x064F, + /* 4748 */ 0x0020, 0x0650, + /* 4750 */ 0x0640, 0x0650, + /* 4752 */ 0x0020, 0x0651, + /* 4754 */ 0x0640, 0x0651, + /* 4756 */ 0x0020, 0x0652, + /* 4758 */ 0x0640, 0x0652, + /* 4760 */ 0x0644, 0x0622, + /* 4762 */ 0x0644, 0x0622, + /* 4764 */ 0x0644, 0x0623, + /* 4766 */ 0x0644, 0x0623, + /* 4768 */ 0x0644, 0x0625, + /* 4770 */ 0x0644, 0x0625, + /* 4772 */ 0x0644, 0x0627, + /* 4774 */ 0x0644, 0x0627, + /* 4776 */ 0x105D2, 0x0307, + /* 4778 */ 0x105DA, 0x0307, + /* 4780 */ 0x1DF04, + /* 4781 */ 0x1DF05, + /* 4782 */ 0x1DF06, + /* 4783 */ 0x1DF08, + /* 4784 */ 0x1DF0A, + /* 4785 */ 0x1DF1E, + /* 4786 */ 0x11099, 0x110BA, + /* 4788 */ 0x1109B, 0x110BA, + /* 4790 */ 0x110A5, 0x110BA, + /* 4792 */ 0x11131, 0x11127, + /* 4794 */ 0x11132, 0x11127, + /* 4796 */ 0x11347, 0x1133E, + /* 4798 */ 0x11347, 0x11357, + /* 4800 */ 0x11382, 0x113C9, + /* 4802 */ 0x11384, 0x113BB, + /* 4804 */ 0x1138B, 0x113C2, + /* 4806 */ 0x11390, 0x113C9, + /* 4808 */ 0x113C2, 0x113C2, + /* 4810 */ 0x113C2, 0x113B8, + /* 4812 */ 0x113C2, 0x113C9, + /* 4814 */ 0x114B9, 0x114BA, + /* 4816 */ 0x114B9, 0x114B0, + /* 4818 */ 0x114B9, 0x114BD, + /* 4820 */ 0x115B8, 0x115AF, + /* 4822 */ 0x115B9, 0x115AF, + /* 4824 */ 0x11935, 0x11930, + /* 4826 */ 0x1611E, 0x1611E, + /* 4828 */ 0x1611E, 0x16129, + /* 4830 */ 0x1611E, 0x1611F, + /* 4832 */ 0x16129, 0x1611F, + /* 4834 */ 0x1611E, 0x16120, + /* 4836 */ 0x16121, 0x1611F, + /* 4838 */ 0x16122, 0x1611F, + /* 4840 */ 0x16121, 0x16120, + /* 4842 */ 0x16D67, 0x16D67, + /* 4844 */ 0x16D63, 0x16D67, + /* 4846 */ 0x16D69, 0x16D67, + /* 4848 */ 0x1D157, 0x1D165, + /* 4850 */ 0x1D158, 0x1D165, + /* 4852 */ 0x1D15F, 0x1D16E, + /* 4854 */ 0x1D15F, 0x1D16F, + /* 4856 */ 0x1D15F, 0x1D170, + /* 4858 */ 0x1D15F, 0x1D171, + /* 4860 */ 0x1D15F, 0x1D172, + /* 4862 */ 0x1D1B9, 0x1D165, + /* 4864 */ 0x1D1BA, 0x1D165, + /* 4866 */ 0x1D1BB, 0x1D16E, + /* 4868 */ 0x1D1BC, 0x1D16E, + /* 4870 */ 0x1D1BB, 0x1D16F, + /* 4872 */ 0x1D1BC, 0x1D16F, + /* 4874 */ 0x0030, 0x002E, + /* 4876 */ 0x0030, 0x002C, + /* 4878 */ 0x0031, 0x002C, + /* 4880 */ 0x0032, 0x002C, + /* 4882 */ 0x0033, 0x002C, + /* 4884 */ 0x0034, 0x002C, + /* 4886 */ 0x0035, 0x002C, + /* 4888 */ 0x0036, 0x002C, + /* 4890 */ 0x0037, 0x002C, + /* 4892 */ 0x0038, 0x002C, + /* 4894 */ 0x0039, 0x002C, + /* 4896 */ 0x0028, 0x0041, 0x0029, + /* 4899 */ 0x0028, 0x0042, 0x0029, + /* 4902 */ 0x0028, 0x0043, 0x0029, + /* 4905 */ 0x0028, 0x0044, 0x0029, + /* 4908 */ 0x0028, 0x0045, 0x0029, + /* 4911 */ 0x0028, 0x0046, 0x0029, + /* 4914 */ 0x0028, 0x0047, 0x0029, + /* 4917 */ 0x0028, 0x0048, 0x0029, + /* 4920 */ 0x0028, 0x0049, 0x0029, + /* 4923 */ 0x0028, 0x004A, 0x0029, + /* 4926 */ 0x0028, 0x004B, 0x0029, + /* 4929 */ 0x0028, 0x004C, 0x0029, + /* 4932 */ 0x0028, 0x004D, 0x0029, + /* 4935 */ 0x0028, 0x004E, 0x0029, + /* 4938 */ 0x0028, 0x004F, 0x0029, + /* 4941 */ 0x0028, 0x0050, 0x0029, + /* 4944 */ 0x0028, 0x0051, 0x0029, + /* 4947 */ 0x0028, 0x0052, 0x0029, + /* 4950 */ 0x0028, 0x0053, 0x0029, + /* 4953 */ 0x0028, 0x0054, 0x0029, + /* 4956 */ 0x0028, 0x0055, 0x0029, + /* 4959 */ 0x0028, 0x0056, 0x0029, + /* 4962 */ 0x0028, 0x0057, 0x0029, + /* 4965 */ 0x0028, 0x0058, 0x0029, + /* 4968 */ 0x0028, 0x0059, 0x0029, + /* 4971 */ 0x0028, 0x005A, 0x0029, + /* 4974 */ 0x3014, 0x0053, 0x3015, + /* 4977 */ 0x0043, 0x0044, + /* 4979 */ 0x0057, 0x005A, + /* 4981 */ 0x0048, 0x0056, + /* 4983 */ 0x004D, 0x0056, + /* 4985 */ 0x0053, 0x0044, + /* 4987 */ 0x0053, 0x0053, + /* 4989 */ 0x0050, 0x0050, 0x0056, + /* 4992 */ 0x0057, 0x0043, + /* 4994 */ 0x004D, 0x0043, + /* 4996 */ 0x004D, 0x0044, + /* 4998 */ 0x004D, 0x0052, + /* 5000 */ 0x0044, 0x004A, + /* 5002 */ 0x307B, 0x304B, + /* 5004 */ 0x30B3, 0x30B3, + /* 5006 */ 0x3014, 0x672C, 0x3015, + /* 5009 */ 0x3014, 0x4E09, 0x3015, + /* 5012 */ 0x3014, 0x4E8C, 0x3015, + /* 5015 */ 0x3014, 0x5B89, 0x3015, + /* 5018 */ 0x3014, 0x70B9, 0x3015, + /* 5021 */ 0x3014, 0x6253, 0x3015, + /* 5024 */ 0x3014, 0x76D7, 0x3015, + /* 5027 */ 0x3014, 0x52DD, 0x3015, + /* 5030 */ 0x3014, 0x6557, 0x3015, + /* 5033 */ 0x20122, + /* 5034 */ 0x2063A, + /* 5035 */ 0x2051C, + /* 5036 */ 0x2054B, + /* 5037 */ 0x291DF, + /* 5038 */ 0x20A2C, + /* 5039 */ 0x20B63, + /* 5040 */ 0x214E4, + /* 5041 */ 0x216A8, + /* 5042 */ 0x216EA, + /* 5043 */ 0x219C8, + /* 5044 */ 0x21B18, + /* 5045 */ 0x21DE4, + /* 5046 */ 0x21DE6, + /* 5047 */ 0x22183, + /* 5048 */ 0x2A392, + /* 5049 */ 0x22331, + /* 5050 */ 0x22331, + /* 5051 */ 0x232B8, + /* 5052 */ 0x261DA, + /* 5053 */ 0x226D4, + /* 5054 */ 0x22B0C, + /* 5055 */ 0x22BF1, + /* 5056 */ 0x2300A, + /* 5057 */ 0x233C3, + /* 5058 */ 0x2346D, + /* 5059 */ 0x236A3, + /* 5060 */ 0x238A7, + /* 5061 */ 0x23A8D, + /* 5062 */ 0x21D0B, + /* 5063 */ 0x23AFA, + /* 5064 */ 0x23CBC, + /* 5065 */ 0x23D1E, + /* 5066 */ 0x23ED1, + /* 5067 */ 0x23F5E, + /* 5068 */ 0x23F8E, + /* 5069 */ 0x20525, + /* 5070 */ 0x24263, + /* 5071 */ 0x243AB, + /* 5072 */ 0x24608, + /* 5073 */ 0x24735, + /* 5074 */ 0x24814, + /* 5075 */ 0x24C36, + /* 5076 */ 0x24C92, + /* 5077 */ 0x2219F, + /* 5078 */ 0x24FA1, + /* 5079 */ 0x24FB8, + /* 5080 */ 0x25044, + /* 5081 */ 0x250F3, + /* 5082 */ 0x250F2, + /* 5083 */ 0x25119, + /* 5084 */ 0x25133, + /* 5085 */ 0x2541D, + /* 5086 */ 0x25626, + /* 5087 */ 0x2569A, + /* 5088 */ 0x256C5, + /* 5089 */ 0x2597C, + /* 5090 */ 0x25AA7, + /* 5091 */ 0x25AA7, + /* 5092 */ 0x25BAB, + /* 5093 */ 0x25C80, + /* 5094 */ 0x25F86, + /* 5095 */ 0x26228, + /* 5096 */ 0x26247, + /* 5097 */ 0x262D9, + /* 5098 */ 0x2633E, + /* 5099 */ 0x264DA, + /* 5100 */ 0x26523, + /* 5101 */ 0x265A8, + /* 5102 */ 0x2335F, + /* 5103 */ 0x267A7, + /* 5104 */ 0x267B5, + /* 5105 */ 0x23393, + /* 5106 */ 0x2339C, + /* 5107 */ 0x26B3C, + /* 5108 */ 0x26C36, + /* 5109 */ 0x26D6B, + /* 5110 */ 0x26CD5, + /* 5111 */ 0x273CA, + /* 5112 */ 0x26F2C, + /* 5113 */ 0x26FB1, + /* 5114 */ 0x270D2, + /* 5115 */ 0x27667, + /* 5116 */ 0x278AE, + /* 5117 */ 0x27966, + /* 5118 */ 0x27CA8, + /* 5119 */ 0x27F2F, + /* 5120 */ 0x20804, + /* 5121 */ 0x208DE, + /* 5122 */ 0x285D2, + /* 5123 */ 0x285ED, + /* 5124 */ 0x2872E, + /* 5125 */ 0x28BFA, + /* 5126 */ 0x28D77, + /* 5127 */ 0x29145, + /* 5128 */ 0x2921A, + /* 5129 */ 0x2940A, + /* 5130 */ 0x29496, + /* 5131 */ 0x295B6, + /* 5132 */ 0x29B30, + /* 5133 */ 0x2A0CE, + /* 5134 */ 0x2A105, + /* 5135 */ 0x2A20E, + /* 5136 */ 0x2A291, + /* 5137 */ 0x2A600 +}; diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_normprops_table.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_normprops_table.h new file mode 100644 index 0000000..f1072c9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_normprops_table.h @@ -0,0 +1,8025 @@ +/* generated by src/common/unicode/generate-unicode_normprops_table.pl, do not edit */ + +#include "common/unicode_norm.h" + +/* + * Normalization quick check entry for codepoint. We use a bit field + * here to save space. + */ +typedef struct +{ + unsigned int codepoint:21; + signed int quickcheck:4; /* really UnicodeNormalizationQC */ +} pg_unicode_normprops; + +/* Typedef for hash function on quick check table */ +typedef int (*qc_hash_func) (const void *key); + +/* Information for quick check lookup with perfect hash function */ +typedef struct +{ + const pg_unicode_normprops *normprops; + qc_hash_func hash; + int num_normprops; +} pg_unicode_norminfo; + +static const pg_unicode_normprops UnicodeNormProps_NFC_QC[] = { + {0x0300, UNICODE_NORM_QC_MAYBE}, + {0x0301, UNICODE_NORM_QC_MAYBE}, + {0x0302, UNICODE_NORM_QC_MAYBE}, + {0x0303, UNICODE_NORM_QC_MAYBE}, + {0x0304, UNICODE_NORM_QC_MAYBE}, + {0x0306, UNICODE_NORM_QC_MAYBE}, + {0x0307, UNICODE_NORM_QC_MAYBE}, + {0x0308, UNICODE_NORM_QC_MAYBE}, + {0x0309, UNICODE_NORM_QC_MAYBE}, + {0x030A, UNICODE_NORM_QC_MAYBE}, + {0x030B, UNICODE_NORM_QC_MAYBE}, + {0x030C, UNICODE_NORM_QC_MAYBE}, + {0x030F, UNICODE_NORM_QC_MAYBE}, + {0x0311, UNICODE_NORM_QC_MAYBE}, + {0x0313, UNICODE_NORM_QC_MAYBE}, + {0x0314, UNICODE_NORM_QC_MAYBE}, + {0x031B, UNICODE_NORM_QC_MAYBE}, + {0x0323, UNICODE_NORM_QC_MAYBE}, + {0x0324, UNICODE_NORM_QC_MAYBE}, + {0x0325, UNICODE_NORM_QC_MAYBE}, + {0x0326, UNICODE_NORM_QC_MAYBE}, + {0x0327, UNICODE_NORM_QC_MAYBE}, + {0x0328, UNICODE_NORM_QC_MAYBE}, + {0x032D, UNICODE_NORM_QC_MAYBE}, + {0x032E, UNICODE_NORM_QC_MAYBE}, + {0x0330, UNICODE_NORM_QC_MAYBE}, + {0x0331, UNICODE_NORM_QC_MAYBE}, + {0x0338, UNICODE_NORM_QC_MAYBE}, + {0x0340, UNICODE_NORM_QC_NO}, + {0x0341, UNICODE_NORM_QC_NO}, + {0x0342, UNICODE_NORM_QC_MAYBE}, + {0x0343, UNICODE_NORM_QC_NO}, + {0x0344, UNICODE_NORM_QC_NO}, + {0x0345, UNICODE_NORM_QC_MAYBE}, + {0x0374, UNICODE_NORM_QC_NO}, + {0x037E, UNICODE_NORM_QC_NO}, + {0x0387, UNICODE_NORM_QC_NO}, + {0x0653, UNICODE_NORM_QC_MAYBE}, + {0x0654, UNICODE_NORM_QC_MAYBE}, + {0x0655, UNICODE_NORM_QC_MAYBE}, + {0x093C, UNICODE_NORM_QC_MAYBE}, + {0x0958, UNICODE_NORM_QC_NO}, + {0x0959, UNICODE_NORM_QC_NO}, + {0x095A, UNICODE_NORM_QC_NO}, + {0x095B, UNICODE_NORM_QC_NO}, + {0x095C, UNICODE_NORM_QC_NO}, + {0x095D, UNICODE_NORM_QC_NO}, + {0x095E, UNICODE_NORM_QC_NO}, + {0x095F, UNICODE_NORM_QC_NO}, + {0x09BE, UNICODE_NORM_QC_MAYBE}, + {0x09D7, UNICODE_NORM_QC_MAYBE}, + {0x09DC, UNICODE_NORM_QC_NO}, + {0x09DD, UNICODE_NORM_QC_NO}, + {0x09DF, UNICODE_NORM_QC_NO}, + {0x0A33, UNICODE_NORM_QC_NO}, + {0x0A36, UNICODE_NORM_QC_NO}, + {0x0A59, UNICODE_NORM_QC_NO}, + {0x0A5A, UNICODE_NORM_QC_NO}, + {0x0A5B, UNICODE_NORM_QC_NO}, + {0x0A5E, UNICODE_NORM_QC_NO}, + {0x0B3E, UNICODE_NORM_QC_MAYBE}, + {0x0B56, UNICODE_NORM_QC_MAYBE}, + {0x0B57, UNICODE_NORM_QC_MAYBE}, + {0x0B5C, UNICODE_NORM_QC_NO}, + {0x0B5D, UNICODE_NORM_QC_NO}, + {0x0BBE, UNICODE_NORM_QC_MAYBE}, + {0x0BD7, UNICODE_NORM_QC_MAYBE}, + {0x0C56, UNICODE_NORM_QC_MAYBE}, + {0x0CC2, UNICODE_NORM_QC_MAYBE}, + {0x0CD5, UNICODE_NORM_QC_MAYBE}, + {0x0CD6, UNICODE_NORM_QC_MAYBE}, + {0x0D3E, UNICODE_NORM_QC_MAYBE}, + {0x0D57, UNICODE_NORM_QC_MAYBE}, + {0x0DCA, UNICODE_NORM_QC_MAYBE}, + {0x0DCF, UNICODE_NORM_QC_MAYBE}, + {0x0DDF, UNICODE_NORM_QC_MAYBE}, + {0x0F43, UNICODE_NORM_QC_NO}, + {0x0F4D, UNICODE_NORM_QC_NO}, + {0x0F52, UNICODE_NORM_QC_NO}, + {0x0F57, UNICODE_NORM_QC_NO}, + {0x0F5C, UNICODE_NORM_QC_NO}, + {0x0F69, UNICODE_NORM_QC_NO}, + {0x0F73, UNICODE_NORM_QC_NO}, + {0x0F75, UNICODE_NORM_QC_NO}, + {0x0F76, UNICODE_NORM_QC_NO}, + {0x0F78, UNICODE_NORM_QC_NO}, + {0x0F81, UNICODE_NORM_QC_NO}, + {0x0F93, UNICODE_NORM_QC_NO}, + {0x0F9D, UNICODE_NORM_QC_NO}, + {0x0FA2, UNICODE_NORM_QC_NO}, + {0x0FA7, UNICODE_NORM_QC_NO}, + {0x0FAC, UNICODE_NORM_QC_NO}, + {0x0FB9, UNICODE_NORM_QC_NO}, + {0x102E, UNICODE_NORM_QC_MAYBE}, + {0x1161, UNICODE_NORM_QC_MAYBE}, + {0x1162, UNICODE_NORM_QC_MAYBE}, + {0x1163, UNICODE_NORM_QC_MAYBE}, + {0x1164, UNICODE_NORM_QC_MAYBE}, + {0x1165, UNICODE_NORM_QC_MAYBE}, + {0x1166, UNICODE_NORM_QC_MAYBE}, + {0x1167, UNICODE_NORM_QC_MAYBE}, + {0x1168, UNICODE_NORM_QC_MAYBE}, + {0x1169, UNICODE_NORM_QC_MAYBE}, + {0x116A, UNICODE_NORM_QC_MAYBE}, + {0x116B, UNICODE_NORM_QC_MAYBE}, + {0x116C, UNICODE_NORM_QC_MAYBE}, + {0x116D, UNICODE_NORM_QC_MAYBE}, + {0x116E, UNICODE_NORM_QC_MAYBE}, + {0x116F, UNICODE_NORM_QC_MAYBE}, + {0x1170, UNICODE_NORM_QC_MAYBE}, + {0x1171, UNICODE_NORM_QC_MAYBE}, + {0x1172, UNICODE_NORM_QC_MAYBE}, + {0x1173, UNICODE_NORM_QC_MAYBE}, + {0x1174, UNICODE_NORM_QC_MAYBE}, + {0x1175, UNICODE_NORM_QC_MAYBE}, + {0x11A8, UNICODE_NORM_QC_MAYBE}, + {0x11A9, UNICODE_NORM_QC_MAYBE}, + {0x11AA, UNICODE_NORM_QC_MAYBE}, + {0x11AB, UNICODE_NORM_QC_MAYBE}, + {0x11AC, UNICODE_NORM_QC_MAYBE}, + {0x11AD, UNICODE_NORM_QC_MAYBE}, + {0x11AE, UNICODE_NORM_QC_MAYBE}, + {0x11AF, UNICODE_NORM_QC_MAYBE}, + {0x11B0, UNICODE_NORM_QC_MAYBE}, + {0x11B1, UNICODE_NORM_QC_MAYBE}, + {0x11B2, UNICODE_NORM_QC_MAYBE}, + {0x11B3, UNICODE_NORM_QC_MAYBE}, + {0x11B4, UNICODE_NORM_QC_MAYBE}, + {0x11B5, UNICODE_NORM_QC_MAYBE}, + {0x11B6, UNICODE_NORM_QC_MAYBE}, + {0x11B7, UNICODE_NORM_QC_MAYBE}, + {0x11B8, UNICODE_NORM_QC_MAYBE}, + {0x11B9, UNICODE_NORM_QC_MAYBE}, + {0x11BA, UNICODE_NORM_QC_MAYBE}, + {0x11BB, UNICODE_NORM_QC_MAYBE}, + {0x11BC, UNICODE_NORM_QC_MAYBE}, + {0x11BD, UNICODE_NORM_QC_MAYBE}, + {0x11BE, UNICODE_NORM_QC_MAYBE}, + {0x11BF, UNICODE_NORM_QC_MAYBE}, + {0x11C0, UNICODE_NORM_QC_MAYBE}, + {0x11C1, UNICODE_NORM_QC_MAYBE}, + {0x11C2, UNICODE_NORM_QC_MAYBE}, + {0x1B35, UNICODE_NORM_QC_MAYBE}, + {0x1F71, UNICODE_NORM_QC_NO}, + {0x1F73, UNICODE_NORM_QC_NO}, + {0x1F75, UNICODE_NORM_QC_NO}, + {0x1F77, UNICODE_NORM_QC_NO}, + {0x1F79, UNICODE_NORM_QC_NO}, + {0x1F7B, UNICODE_NORM_QC_NO}, + {0x1F7D, UNICODE_NORM_QC_NO}, + {0x1FBB, UNICODE_NORM_QC_NO}, + {0x1FBE, UNICODE_NORM_QC_NO}, + {0x1FC9, UNICODE_NORM_QC_NO}, + {0x1FCB, UNICODE_NORM_QC_NO}, + {0x1FD3, UNICODE_NORM_QC_NO}, + {0x1FDB, UNICODE_NORM_QC_NO}, + {0x1FE3, UNICODE_NORM_QC_NO}, + {0x1FEB, UNICODE_NORM_QC_NO}, + {0x1FEE, UNICODE_NORM_QC_NO}, + {0x1FEF, UNICODE_NORM_QC_NO}, + {0x1FF9, UNICODE_NORM_QC_NO}, + {0x1FFB, UNICODE_NORM_QC_NO}, + {0x1FFD, UNICODE_NORM_QC_NO}, + {0x2000, UNICODE_NORM_QC_NO}, + {0x2001, UNICODE_NORM_QC_NO}, + {0x2126, UNICODE_NORM_QC_NO}, + {0x212A, UNICODE_NORM_QC_NO}, + {0x212B, UNICODE_NORM_QC_NO}, + {0x2329, UNICODE_NORM_QC_NO}, + {0x232A, UNICODE_NORM_QC_NO}, + {0x2ADC, UNICODE_NORM_QC_NO}, + {0x3099, UNICODE_NORM_QC_MAYBE}, + {0x309A, UNICODE_NORM_QC_MAYBE}, + {0xF900, UNICODE_NORM_QC_NO}, + {0xF901, UNICODE_NORM_QC_NO}, + {0xF902, UNICODE_NORM_QC_NO}, + {0xF903, UNICODE_NORM_QC_NO}, + {0xF904, UNICODE_NORM_QC_NO}, + {0xF905, UNICODE_NORM_QC_NO}, + {0xF906, UNICODE_NORM_QC_NO}, + {0xF907, UNICODE_NORM_QC_NO}, + {0xF908, UNICODE_NORM_QC_NO}, + {0xF909, UNICODE_NORM_QC_NO}, + {0xF90A, UNICODE_NORM_QC_NO}, + {0xF90B, UNICODE_NORM_QC_NO}, + {0xF90C, UNICODE_NORM_QC_NO}, + {0xF90D, UNICODE_NORM_QC_NO}, + {0xF90E, UNICODE_NORM_QC_NO}, + {0xF90F, UNICODE_NORM_QC_NO}, + {0xF910, UNICODE_NORM_QC_NO}, + {0xF911, UNICODE_NORM_QC_NO}, + {0xF912, UNICODE_NORM_QC_NO}, + {0xF913, UNICODE_NORM_QC_NO}, + {0xF914, UNICODE_NORM_QC_NO}, + {0xF915, UNICODE_NORM_QC_NO}, + {0xF916, UNICODE_NORM_QC_NO}, + {0xF917, UNICODE_NORM_QC_NO}, + {0xF918, UNICODE_NORM_QC_NO}, + {0xF919, UNICODE_NORM_QC_NO}, + {0xF91A, UNICODE_NORM_QC_NO}, + {0xF91B, UNICODE_NORM_QC_NO}, + {0xF91C, UNICODE_NORM_QC_NO}, + {0xF91D, UNICODE_NORM_QC_NO}, + {0xF91E, UNICODE_NORM_QC_NO}, + {0xF91F, UNICODE_NORM_QC_NO}, + {0xF920, UNICODE_NORM_QC_NO}, + {0xF921, UNICODE_NORM_QC_NO}, + {0xF922, UNICODE_NORM_QC_NO}, + {0xF923, UNICODE_NORM_QC_NO}, + {0xF924, UNICODE_NORM_QC_NO}, + {0xF925, UNICODE_NORM_QC_NO}, + {0xF926, UNICODE_NORM_QC_NO}, + {0xF927, UNICODE_NORM_QC_NO}, + {0xF928, UNICODE_NORM_QC_NO}, + {0xF929, UNICODE_NORM_QC_NO}, + {0xF92A, UNICODE_NORM_QC_NO}, + {0xF92B, UNICODE_NORM_QC_NO}, + {0xF92C, UNICODE_NORM_QC_NO}, + {0xF92D, UNICODE_NORM_QC_NO}, + {0xF92E, UNICODE_NORM_QC_NO}, + {0xF92F, UNICODE_NORM_QC_NO}, + {0xF930, UNICODE_NORM_QC_NO}, + {0xF931, UNICODE_NORM_QC_NO}, + {0xF932, UNICODE_NORM_QC_NO}, + {0xF933, UNICODE_NORM_QC_NO}, + {0xF934, UNICODE_NORM_QC_NO}, + {0xF935, UNICODE_NORM_QC_NO}, + {0xF936, UNICODE_NORM_QC_NO}, + {0xF937, UNICODE_NORM_QC_NO}, + {0xF938, UNICODE_NORM_QC_NO}, + {0xF939, UNICODE_NORM_QC_NO}, + {0xF93A, UNICODE_NORM_QC_NO}, + {0xF93B, UNICODE_NORM_QC_NO}, + {0xF93C, UNICODE_NORM_QC_NO}, + {0xF93D, UNICODE_NORM_QC_NO}, + {0xF93E, UNICODE_NORM_QC_NO}, + {0xF93F, UNICODE_NORM_QC_NO}, + {0xF940, UNICODE_NORM_QC_NO}, + {0xF941, UNICODE_NORM_QC_NO}, + {0xF942, UNICODE_NORM_QC_NO}, + {0xF943, UNICODE_NORM_QC_NO}, + {0xF944, UNICODE_NORM_QC_NO}, + {0xF945, UNICODE_NORM_QC_NO}, + {0xF946, UNICODE_NORM_QC_NO}, + {0xF947, UNICODE_NORM_QC_NO}, + {0xF948, UNICODE_NORM_QC_NO}, + {0xF949, UNICODE_NORM_QC_NO}, + {0xF94A, UNICODE_NORM_QC_NO}, + {0xF94B, UNICODE_NORM_QC_NO}, + {0xF94C, UNICODE_NORM_QC_NO}, + {0xF94D, UNICODE_NORM_QC_NO}, + {0xF94E, UNICODE_NORM_QC_NO}, + {0xF94F, UNICODE_NORM_QC_NO}, + {0xF950, UNICODE_NORM_QC_NO}, + {0xF951, UNICODE_NORM_QC_NO}, + {0xF952, UNICODE_NORM_QC_NO}, + {0xF953, UNICODE_NORM_QC_NO}, + {0xF954, UNICODE_NORM_QC_NO}, + {0xF955, UNICODE_NORM_QC_NO}, + {0xF956, UNICODE_NORM_QC_NO}, + {0xF957, UNICODE_NORM_QC_NO}, + {0xF958, UNICODE_NORM_QC_NO}, + {0xF959, UNICODE_NORM_QC_NO}, + {0xF95A, UNICODE_NORM_QC_NO}, + {0xF95B, UNICODE_NORM_QC_NO}, + {0xF95C, UNICODE_NORM_QC_NO}, + {0xF95D, UNICODE_NORM_QC_NO}, + {0xF95E, UNICODE_NORM_QC_NO}, + {0xF95F, UNICODE_NORM_QC_NO}, + {0xF960, UNICODE_NORM_QC_NO}, + {0xF961, UNICODE_NORM_QC_NO}, + {0xF962, UNICODE_NORM_QC_NO}, + {0xF963, UNICODE_NORM_QC_NO}, + {0xF964, UNICODE_NORM_QC_NO}, + {0xF965, UNICODE_NORM_QC_NO}, + {0xF966, UNICODE_NORM_QC_NO}, + {0xF967, UNICODE_NORM_QC_NO}, + {0xF968, UNICODE_NORM_QC_NO}, + {0xF969, UNICODE_NORM_QC_NO}, + {0xF96A, UNICODE_NORM_QC_NO}, + {0xF96B, UNICODE_NORM_QC_NO}, + {0xF96C, UNICODE_NORM_QC_NO}, + {0xF96D, UNICODE_NORM_QC_NO}, + {0xF96E, UNICODE_NORM_QC_NO}, + {0xF96F, UNICODE_NORM_QC_NO}, + {0xF970, UNICODE_NORM_QC_NO}, + {0xF971, UNICODE_NORM_QC_NO}, + {0xF972, UNICODE_NORM_QC_NO}, + {0xF973, UNICODE_NORM_QC_NO}, + {0xF974, UNICODE_NORM_QC_NO}, + {0xF975, UNICODE_NORM_QC_NO}, + {0xF976, UNICODE_NORM_QC_NO}, + {0xF977, UNICODE_NORM_QC_NO}, + {0xF978, UNICODE_NORM_QC_NO}, + {0xF979, UNICODE_NORM_QC_NO}, + {0xF97A, UNICODE_NORM_QC_NO}, + {0xF97B, UNICODE_NORM_QC_NO}, + {0xF97C, UNICODE_NORM_QC_NO}, + {0xF97D, UNICODE_NORM_QC_NO}, + {0xF97E, UNICODE_NORM_QC_NO}, + {0xF97F, UNICODE_NORM_QC_NO}, + {0xF980, UNICODE_NORM_QC_NO}, + {0xF981, UNICODE_NORM_QC_NO}, + {0xF982, UNICODE_NORM_QC_NO}, + {0xF983, UNICODE_NORM_QC_NO}, + {0xF984, UNICODE_NORM_QC_NO}, + {0xF985, UNICODE_NORM_QC_NO}, + {0xF986, UNICODE_NORM_QC_NO}, + {0xF987, UNICODE_NORM_QC_NO}, + {0xF988, UNICODE_NORM_QC_NO}, + {0xF989, UNICODE_NORM_QC_NO}, + {0xF98A, UNICODE_NORM_QC_NO}, + {0xF98B, UNICODE_NORM_QC_NO}, + {0xF98C, UNICODE_NORM_QC_NO}, + {0xF98D, UNICODE_NORM_QC_NO}, + {0xF98E, UNICODE_NORM_QC_NO}, + {0xF98F, UNICODE_NORM_QC_NO}, + {0xF990, UNICODE_NORM_QC_NO}, + {0xF991, UNICODE_NORM_QC_NO}, + {0xF992, UNICODE_NORM_QC_NO}, + {0xF993, UNICODE_NORM_QC_NO}, + {0xF994, UNICODE_NORM_QC_NO}, + {0xF995, UNICODE_NORM_QC_NO}, + {0xF996, UNICODE_NORM_QC_NO}, + {0xF997, UNICODE_NORM_QC_NO}, + {0xF998, UNICODE_NORM_QC_NO}, + {0xF999, UNICODE_NORM_QC_NO}, + {0xF99A, UNICODE_NORM_QC_NO}, + {0xF99B, UNICODE_NORM_QC_NO}, + {0xF99C, UNICODE_NORM_QC_NO}, + {0xF99D, UNICODE_NORM_QC_NO}, + {0xF99E, UNICODE_NORM_QC_NO}, + {0xF99F, UNICODE_NORM_QC_NO}, + {0xF9A0, UNICODE_NORM_QC_NO}, + {0xF9A1, UNICODE_NORM_QC_NO}, + {0xF9A2, UNICODE_NORM_QC_NO}, + {0xF9A3, UNICODE_NORM_QC_NO}, + {0xF9A4, UNICODE_NORM_QC_NO}, + {0xF9A5, UNICODE_NORM_QC_NO}, + {0xF9A6, UNICODE_NORM_QC_NO}, + {0xF9A7, UNICODE_NORM_QC_NO}, + {0xF9A8, UNICODE_NORM_QC_NO}, + {0xF9A9, UNICODE_NORM_QC_NO}, + {0xF9AA, UNICODE_NORM_QC_NO}, + {0xF9AB, UNICODE_NORM_QC_NO}, + {0xF9AC, UNICODE_NORM_QC_NO}, + {0xF9AD, UNICODE_NORM_QC_NO}, + {0xF9AE, UNICODE_NORM_QC_NO}, + {0xF9AF, UNICODE_NORM_QC_NO}, + {0xF9B0, UNICODE_NORM_QC_NO}, + {0xF9B1, UNICODE_NORM_QC_NO}, + {0xF9B2, UNICODE_NORM_QC_NO}, + {0xF9B3, UNICODE_NORM_QC_NO}, + {0xF9B4, UNICODE_NORM_QC_NO}, + {0xF9B5, UNICODE_NORM_QC_NO}, + {0xF9B6, UNICODE_NORM_QC_NO}, + {0xF9B7, UNICODE_NORM_QC_NO}, + {0xF9B8, UNICODE_NORM_QC_NO}, + {0xF9B9, UNICODE_NORM_QC_NO}, + {0xF9BA, UNICODE_NORM_QC_NO}, + {0xF9BB, UNICODE_NORM_QC_NO}, + {0xF9BC, UNICODE_NORM_QC_NO}, + {0xF9BD, UNICODE_NORM_QC_NO}, + {0xF9BE, UNICODE_NORM_QC_NO}, + {0xF9BF, UNICODE_NORM_QC_NO}, + {0xF9C0, UNICODE_NORM_QC_NO}, + {0xF9C1, UNICODE_NORM_QC_NO}, + {0xF9C2, UNICODE_NORM_QC_NO}, + {0xF9C3, UNICODE_NORM_QC_NO}, + {0xF9C4, UNICODE_NORM_QC_NO}, + {0xF9C5, UNICODE_NORM_QC_NO}, + {0xF9C6, UNICODE_NORM_QC_NO}, + {0xF9C7, UNICODE_NORM_QC_NO}, + {0xF9C8, UNICODE_NORM_QC_NO}, + {0xF9C9, UNICODE_NORM_QC_NO}, + {0xF9CA, UNICODE_NORM_QC_NO}, + {0xF9CB, UNICODE_NORM_QC_NO}, + {0xF9CC, UNICODE_NORM_QC_NO}, + {0xF9CD, UNICODE_NORM_QC_NO}, + {0xF9CE, UNICODE_NORM_QC_NO}, + {0xF9CF, UNICODE_NORM_QC_NO}, + {0xF9D0, UNICODE_NORM_QC_NO}, + {0xF9D1, UNICODE_NORM_QC_NO}, + {0xF9D2, UNICODE_NORM_QC_NO}, + {0xF9D3, UNICODE_NORM_QC_NO}, + {0xF9D4, UNICODE_NORM_QC_NO}, + {0xF9D5, UNICODE_NORM_QC_NO}, + {0xF9D6, UNICODE_NORM_QC_NO}, + {0xF9D7, UNICODE_NORM_QC_NO}, + {0xF9D8, UNICODE_NORM_QC_NO}, + {0xF9D9, UNICODE_NORM_QC_NO}, + {0xF9DA, UNICODE_NORM_QC_NO}, + {0xF9DB, UNICODE_NORM_QC_NO}, + {0xF9DC, UNICODE_NORM_QC_NO}, + {0xF9DD, UNICODE_NORM_QC_NO}, + {0xF9DE, UNICODE_NORM_QC_NO}, + {0xF9DF, UNICODE_NORM_QC_NO}, + {0xF9E0, UNICODE_NORM_QC_NO}, + {0xF9E1, UNICODE_NORM_QC_NO}, + {0xF9E2, UNICODE_NORM_QC_NO}, + {0xF9E3, UNICODE_NORM_QC_NO}, + {0xF9E4, UNICODE_NORM_QC_NO}, + {0xF9E5, UNICODE_NORM_QC_NO}, + {0xF9E6, UNICODE_NORM_QC_NO}, + {0xF9E7, UNICODE_NORM_QC_NO}, + {0xF9E8, UNICODE_NORM_QC_NO}, + {0xF9E9, UNICODE_NORM_QC_NO}, + {0xF9EA, UNICODE_NORM_QC_NO}, + {0xF9EB, UNICODE_NORM_QC_NO}, + {0xF9EC, UNICODE_NORM_QC_NO}, + {0xF9ED, UNICODE_NORM_QC_NO}, + {0xF9EE, UNICODE_NORM_QC_NO}, + {0xF9EF, UNICODE_NORM_QC_NO}, + {0xF9F0, UNICODE_NORM_QC_NO}, + {0xF9F1, UNICODE_NORM_QC_NO}, + {0xF9F2, UNICODE_NORM_QC_NO}, + {0xF9F3, UNICODE_NORM_QC_NO}, + {0xF9F4, UNICODE_NORM_QC_NO}, + {0xF9F5, UNICODE_NORM_QC_NO}, + {0xF9F6, UNICODE_NORM_QC_NO}, + {0xF9F7, UNICODE_NORM_QC_NO}, + {0xF9F8, UNICODE_NORM_QC_NO}, + {0xF9F9, UNICODE_NORM_QC_NO}, + {0xF9FA, UNICODE_NORM_QC_NO}, + {0xF9FB, UNICODE_NORM_QC_NO}, + {0xF9FC, UNICODE_NORM_QC_NO}, + {0xF9FD, UNICODE_NORM_QC_NO}, + {0xF9FE, UNICODE_NORM_QC_NO}, + {0xF9FF, UNICODE_NORM_QC_NO}, + {0xFA00, UNICODE_NORM_QC_NO}, + {0xFA01, UNICODE_NORM_QC_NO}, + {0xFA02, UNICODE_NORM_QC_NO}, + {0xFA03, UNICODE_NORM_QC_NO}, + {0xFA04, UNICODE_NORM_QC_NO}, + {0xFA05, UNICODE_NORM_QC_NO}, + {0xFA06, UNICODE_NORM_QC_NO}, + {0xFA07, UNICODE_NORM_QC_NO}, + {0xFA08, UNICODE_NORM_QC_NO}, + {0xFA09, UNICODE_NORM_QC_NO}, + {0xFA0A, UNICODE_NORM_QC_NO}, + {0xFA0B, UNICODE_NORM_QC_NO}, + {0xFA0C, UNICODE_NORM_QC_NO}, + {0xFA0D, UNICODE_NORM_QC_NO}, + {0xFA10, UNICODE_NORM_QC_NO}, + {0xFA12, UNICODE_NORM_QC_NO}, + {0xFA15, UNICODE_NORM_QC_NO}, + {0xFA16, UNICODE_NORM_QC_NO}, + {0xFA17, UNICODE_NORM_QC_NO}, + {0xFA18, UNICODE_NORM_QC_NO}, + {0xFA19, UNICODE_NORM_QC_NO}, + {0xFA1A, UNICODE_NORM_QC_NO}, + {0xFA1B, UNICODE_NORM_QC_NO}, + {0xFA1C, UNICODE_NORM_QC_NO}, + {0xFA1D, UNICODE_NORM_QC_NO}, + {0xFA1E, UNICODE_NORM_QC_NO}, + {0xFA20, UNICODE_NORM_QC_NO}, + {0xFA22, UNICODE_NORM_QC_NO}, + {0xFA25, UNICODE_NORM_QC_NO}, + {0xFA26, UNICODE_NORM_QC_NO}, + {0xFA2A, UNICODE_NORM_QC_NO}, + {0xFA2B, UNICODE_NORM_QC_NO}, + {0xFA2C, UNICODE_NORM_QC_NO}, + {0xFA2D, UNICODE_NORM_QC_NO}, + {0xFA2E, UNICODE_NORM_QC_NO}, + {0xFA2F, UNICODE_NORM_QC_NO}, + {0xFA30, UNICODE_NORM_QC_NO}, + {0xFA31, UNICODE_NORM_QC_NO}, + {0xFA32, UNICODE_NORM_QC_NO}, + {0xFA33, UNICODE_NORM_QC_NO}, + {0xFA34, UNICODE_NORM_QC_NO}, + {0xFA35, UNICODE_NORM_QC_NO}, + {0xFA36, UNICODE_NORM_QC_NO}, + {0xFA37, UNICODE_NORM_QC_NO}, + {0xFA38, UNICODE_NORM_QC_NO}, + {0xFA39, UNICODE_NORM_QC_NO}, + {0xFA3A, UNICODE_NORM_QC_NO}, + {0xFA3B, UNICODE_NORM_QC_NO}, + {0xFA3C, UNICODE_NORM_QC_NO}, + {0xFA3D, UNICODE_NORM_QC_NO}, + {0xFA3E, UNICODE_NORM_QC_NO}, + {0xFA3F, UNICODE_NORM_QC_NO}, + {0xFA40, UNICODE_NORM_QC_NO}, + {0xFA41, UNICODE_NORM_QC_NO}, + {0xFA42, UNICODE_NORM_QC_NO}, + {0xFA43, UNICODE_NORM_QC_NO}, + {0xFA44, UNICODE_NORM_QC_NO}, + {0xFA45, UNICODE_NORM_QC_NO}, + {0xFA46, UNICODE_NORM_QC_NO}, + {0xFA47, UNICODE_NORM_QC_NO}, + {0xFA48, UNICODE_NORM_QC_NO}, + {0xFA49, UNICODE_NORM_QC_NO}, + {0xFA4A, UNICODE_NORM_QC_NO}, + {0xFA4B, UNICODE_NORM_QC_NO}, + {0xFA4C, UNICODE_NORM_QC_NO}, + {0xFA4D, UNICODE_NORM_QC_NO}, + {0xFA4E, UNICODE_NORM_QC_NO}, + {0xFA4F, UNICODE_NORM_QC_NO}, + {0xFA50, UNICODE_NORM_QC_NO}, + {0xFA51, UNICODE_NORM_QC_NO}, + {0xFA52, UNICODE_NORM_QC_NO}, + {0xFA53, UNICODE_NORM_QC_NO}, + {0xFA54, UNICODE_NORM_QC_NO}, + {0xFA55, UNICODE_NORM_QC_NO}, + {0xFA56, UNICODE_NORM_QC_NO}, + {0xFA57, UNICODE_NORM_QC_NO}, + {0xFA58, UNICODE_NORM_QC_NO}, + {0xFA59, UNICODE_NORM_QC_NO}, + {0xFA5A, UNICODE_NORM_QC_NO}, + {0xFA5B, UNICODE_NORM_QC_NO}, + {0xFA5C, UNICODE_NORM_QC_NO}, + {0xFA5D, UNICODE_NORM_QC_NO}, + {0xFA5E, UNICODE_NORM_QC_NO}, + {0xFA5F, UNICODE_NORM_QC_NO}, + {0xFA60, UNICODE_NORM_QC_NO}, + {0xFA61, UNICODE_NORM_QC_NO}, + {0xFA62, UNICODE_NORM_QC_NO}, + {0xFA63, UNICODE_NORM_QC_NO}, + {0xFA64, UNICODE_NORM_QC_NO}, + {0xFA65, UNICODE_NORM_QC_NO}, + {0xFA66, UNICODE_NORM_QC_NO}, + {0xFA67, UNICODE_NORM_QC_NO}, + {0xFA68, UNICODE_NORM_QC_NO}, + {0xFA69, UNICODE_NORM_QC_NO}, + {0xFA6A, UNICODE_NORM_QC_NO}, + {0xFA6B, UNICODE_NORM_QC_NO}, + {0xFA6C, UNICODE_NORM_QC_NO}, + {0xFA6D, UNICODE_NORM_QC_NO}, + {0xFA70, UNICODE_NORM_QC_NO}, + {0xFA71, UNICODE_NORM_QC_NO}, + {0xFA72, UNICODE_NORM_QC_NO}, + {0xFA73, UNICODE_NORM_QC_NO}, + {0xFA74, UNICODE_NORM_QC_NO}, + {0xFA75, UNICODE_NORM_QC_NO}, + {0xFA76, UNICODE_NORM_QC_NO}, + {0xFA77, UNICODE_NORM_QC_NO}, + {0xFA78, UNICODE_NORM_QC_NO}, + {0xFA79, UNICODE_NORM_QC_NO}, + {0xFA7A, UNICODE_NORM_QC_NO}, + {0xFA7B, UNICODE_NORM_QC_NO}, + {0xFA7C, UNICODE_NORM_QC_NO}, + {0xFA7D, UNICODE_NORM_QC_NO}, + {0xFA7E, UNICODE_NORM_QC_NO}, + {0xFA7F, UNICODE_NORM_QC_NO}, + {0xFA80, UNICODE_NORM_QC_NO}, + {0xFA81, UNICODE_NORM_QC_NO}, + {0xFA82, UNICODE_NORM_QC_NO}, + {0xFA83, UNICODE_NORM_QC_NO}, + {0xFA84, UNICODE_NORM_QC_NO}, + {0xFA85, UNICODE_NORM_QC_NO}, + {0xFA86, UNICODE_NORM_QC_NO}, + {0xFA87, UNICODE_NORM_QC_NO}, + {0xFA88, UNICODE_NORM_QC_NO}, + {0xFA89, UNICODE_NORM_QC_NO}, + {0xFA8A, UNICODE_NORM_QC_NO}, + {0xFA8B, UNICODE_NORM_QC_NO}, + {0xFA8C, UNICODE_NORM_QC_NO}, + {0xFA8D, UNICODE_NORM_QC_NO}, + {0xFA8E, UNICODE_NORM_QC_NO}, + {0xFA8F, UNICODE_NORM_QC_NO}, + {0xFA90, UNICODE_NORM_QC_NO}, + {0xFA91, UNICODE_NORM_QC_NO}, + {0xFA92, UNICODE_NORM_QC_NO}, + {0xFA93, UNICODE_NORM_QC_NO}, + {0xFA94, UNICODE_NORM_QC_NO}, + {0xFA95, UNICODE_NORM_QC_NO}, + {0xFA96, UNICODE_NORM_QC_NO}, + {0xFA97, UNICODE_NORM_QC_NO}, + {0xFA98, UNICODE_NORM_QC_NO}, + {0xFA99, UNICODE_NORM_QC_NO}, + {0xFA9A, UNICODE_NORM_QC_NO}, + {0xFA9B, UNICODE_NORM_QC_NO}, + {0xFA9C, UNICODE_NORM_QC_NO}, + {0xFA9D, UNICODE_NORM_QC_NO}, + {0xFA9E, UNICODE_NORM_QC_NO}, + {0xFA9F, UNICODE_NORM_QC_NO}, + {0xFAA0, UNICODE_NORM_QC_NO}, + {0xFAA1, UNICODE_NORM_QC_NO}, + {0xFAA2, UNICODE_NORM_QC_NO}, + {0xFAA3, UNICODE_NORM_QC_NO}, + {0xFAA4, UNICODE_NORM_QC_NO}, + {0xFAA5, UNICODE_NORM_QC_NO}, + {0xFAA6, UNICODE_NORM_QC_NO}, + {0xFAA7, UNICODE_NORM_QC_NO}, + {0xFAA8, UNICODE_NORM_QC_NO}, + {0xFAA9, UNICODE_NORM_QC_NO}, + {0xFAAA, UNICODE_NORM_QC_NO}, + {0xFAAB, UNICODE_NORM_QC_NO}, + {0xFAAC, UNICODE_NORM_QC_NO}, + {0xFAAD, UNICODE_NORM_QC_NO}, + {0xFAAE, UNICODE_NORM_QC_NO}, + {0xFAAF, UNICODE_NORM_QC_NO}, + {0xFAB0, UNICODE_NORM_QC_NO}, + {0xFAB1, UNICODE_NORM_QC_NO}, + {0xFAB2, UNICODE_NORM_QC_NO}, + {0xFAB3, UNICODE_NORM_QC_NO}, + {0xFAB4, UNICODE_NORM_QC_NO}, + {0xFAB5, UNICODE_NORM_QC_NO}, + {0xFAB6, UNICODE_NORM_QC_NO}, + {0xFAB7, UNICODE_NORM_QC_NO}, + {0xFAB8, UNICODE_NORM_QC_NO}, + {0xFAB9, UNICODE_NORM_QC_NO}, + {0xFABA, UNICODE_NORM_QC_NO}, + {0xFABB, UNICODE_NORM_QC_NO}, + {0xFABC, UNICODE_NORM_QC_NO}, + {0xFABD, UNICODE_NORM_QC_NO}, + {0xFABE, UNICODE_NORM_QC_NO}, + {0xFABF, UNICODE_NORM_QC_NO}, + {0xFAC0, UNICODE_NORM_QC_NO}, + {0xFAC1, UNICODE_NORM_QC_NO}, + {0xFAC2, UNICODE_NORM_QC_NO}, + {0xFAC3, UNICODE_NORM_QC_NO}, + {0xFAC4, UNICODE_NORM_QC_NO}, + {0xFAC5, UNICODE_NORM_QC_NO}, + {0xFAC6, UNICODE_NORM_QC_NO}, + {0xFAC7, UNICODE_NORM_QC_NO}, + {0xFAC8, UNICODE_NORM_QC_NO}, + {0xFAC9, UNICODE_NORM_QC_NO}, + {0xFACA, UNICODE_NORM_QC_NO}, + {0xFACB, UNICODE_NORM_QC_NO}, + {0xFACC, UNICODE_NORM_QC_NO}, + {0xFACD, UNICODE_NORM_QC_NO}, + {0xFACE, UNICODE_NORM_QC_NO}, + {0xFACF, UNICODE_NORM_QC_NO}, + {0xFAD0, UNICODE_NORM_QC_NO}, + {0xFAD1, UNICODE_NORM_QC_NO}, + {0xFAD2, UNICODE_NORM_QC_NO}, + {0xFAD3, UNICODE_NORM_QC_NO}, + {0xFAD4, UNICODE_NORM_QC_NO}, + {0xFAD5, UNICODE_NORM_QC_NO}, + {0xFAD6, UNICODE_NORM_QC_NO}, + {0xFAD7, UNICODE_NORM_QC_NO}, + {0xFAD8, UNICODE_NORM_QC_NO}, + {0xFAD9, UNICODE_NORM_QC_NO}, + {0xFB1D, UNICODE_NORM_QC_NO}, + {0xFB1F, UNICODE_NORM_QC_NO}, + {0xFB2A, UNICODE_NORM_QC_NO}, + {0xFB2B, UNICODE_NORM_QC_NO}, + {0xFB2C, UNICODE_NORM_QC_NO}, + {0xFB2D, UNICODE_NORM_QC_NO}, + {0xFB2E, UNICODE_NORM_QC_NO}, + {0xFB2F, UNICODE_NORM_QC_NO}, + {0xFB30, UNICODE_NORM_QC_NO}, + {0xFB31, UNICODE_NORM_QC_NO}, + {0xFB32, UNICODE_NORM_QC_NO}, + {0xFB33, UNICODE_NORM_QC_NO}, + {0xFB34, UNICODE_NORM_QC_NO}, + {0xFB35, UNICODE_NORM_QC_NO}, + {0xFB36, UNICODE_NORM_QC_NO}, + {0xFB38, UNICODE_NORM_QC_NO}, + {0xFB39, UNICODE_NORM_QC_NO}, + {0xFB3A, UNICODE_NORM_QC_NO}, + {0xFB3B, UNICODE_NORM_QC_NO}, + {0xFB3C, UNICODE_NORM_QC_NO}, + {0xFB3E, UNICODE_NORM_QC_NO}, + {0xFB40, UNICODE_NORM_QC_NO}, + {0xFB41, UNICODE_NORM_QC_NO}, + {0xFB43, UNICODE_NORM_QC_NO}, + {0xFB44, UNICODE_NORM_QC_NO}, + {0xFB46, UNICODE_NORM_QC_NO}, + {0xFB47, UNICODE_NORM_QC_NO}, + {0xFB48, UNICODE_NORM_QC_NO}, + {0xFB49, UNICODE_NORM_QC_NO}, + {0xFB4A, UNICODE_NORM_QC_NO}, + {0xFB4B, UNICODE_NORM_QC_NO}, + {0xFB4C, UNICODE_NORM_QC_NO}, + {0xFB4D, UNICODE_NORM_QC_NO}, + {0xFB4E, UNICODE_NORM_QC_NO}, + {0x110BA, UNICODE_NORM_QC_MAYBE}, + {0x11127, UNICODE_NORM_QC_MAYBE}, + {0x1133E, UNICODE_NORM_QC_MAYBE}, + {0x11357, UNICODE_NORM_QC_MAYBE}, + {0x113B8, UNICODE_NORM_QC_MAYBE}, + {0x113BB, UNICODE_NORM_QC_MAYBE}, + {0x113C2, UNICODE_NORM_QC_MAYBE}, + {0x113C5, UNICODE_NORM_QC_MAYBE}, + {0x113C7, UNICODE_NORM_QC_MAYBE}, + {0x113C8, UNICODE_NORM_QC_MAYBE}, + {0x113C9, UNICODE_NORM_QC_MAYBE}, + {0x114B0, UNICODE_NORM_QC_MAYBE}, + {0x114BA, UNICODE_NORM_QC_MAYBE}, + {0x114BD, UNICODE_NORM_QC_MAYBE}, + {0x115AF, UNICODE_NORM_QC_MAYBE}, + {0x11930, UNICODE_NORM_QC_MAYBE}, + {0x1611E, UNICODE_NORM_QC_MAYBE}, + {0x1611F, UNICODE_NORM_QC_MAYBE}, + {0x16120, UNICODE_NORM_QC_MAYBE}, + {0x16121, UNICODE_NORM_QC_MAYBE}, + {0x16122, UNICODE_NORM_QC_MAYBE}, + {0x16123, UNICODE_NORM_QC_MAYBE}, + {0x16124, UNICODE_NORM_QC_MAYBE}, + {0x16125, UNICODE_NORM_QC_MAYBE}, + {0x16126, UNICODE_NORM_QC_MAYBE}, + {0x16127, UNICODE_NORM_QC_MAYBE}, + {0x16128, UNICODE_NORM_QC_MAYBE}, + {0x16129, UNICODE_NORM_QC_MAYBE}, + {0x16D67, UNICODE_NORM_QC_MAYBE}, + {0x16D68, UNICODE_NORM_QC_MAYBE}, + {0x1D15E, UNICODE_NORM_QC_NO}, + {0x1D15F, UNICODE_NORM_QC_NO}, + {0x1D160, UNICODE_NORM_QC_NO}, + {0x1D161, UNICODE_NORM_QC_NO}, + {0x1D162, UNICODE_NORM_QC_NO}, + {0x1D163, UNICODE_NORM_QC_NO}, + {0x1D164, UNICODE_NORM_QC_NO}, + {0x1D1BB, UNICODE_NORM_QC_NO}, + {0x1D1BC, UNICODE_NORM_QC_NO}, + {0x1D1BD, UNICODE_NORM_QC_NO}, + {0x1D1BE, UNICODE_NORM_QC_NO}, + {0x1D1BF, UNICODE_NORM_QC_NO}, + {0x1D1C0, UNICODE_NORM_QC_NO}, + {0x2F800, UNICODE_NORM_QC_NO}, + {0x2F801, UNICODE_NORM_QC_NO}, + {0x2F802, UNICODE_NORM_QC_NO}, + {0x2F803, UNICODE_NORM_QC_NO}, + {0x2F804, UNICODE_NORM_QC_NO}, + {0x2F805, UNICODE_NORM_QC_NO}, + {0x2F806, UNICODE_NORM_QC_NO}, + {0x2F807, UNICODE_NORM_QC_NO}, + {0x2F808, UNICODE_NORM_QC_NO}, + {0x2F809, UNICODE_NORM_QC_NO}, + {0x2F80A, UNICODE_NORM_QC_NO}, + {0x2F80B, UNICODE_NORM_QC_NO}, + {0x2F80C, UNICODE_NORM_QC_NO}, + {0x2F80D, UNICODE_NORM_QC_NO}, + {0x2F80E, UNICODE_NORM_QC_NO}, + {0x2F80F, UNICODE_NORM_QC_NO}, + {0x2F810, UNICODE_NORM_QC_NO}, + {0x2F811, UNICODE_NORM_QC_NO}, + {0x2F812, UNICODE_NORM_QC_NO}, + {0x2F813, UNICODE_NORM_QC_NO}, + {0x2F814, UNICODE_NORM_QC_NO}, + {0x2F815, UNICODE_NORM_QC_NO}, + {0x2F816, UNICODE_NORM_QC_NO}, + {0x2F817, UNICODE_NORM_QC_NO}, + {0x2F818, UNICODE_NORM_QC_NO}, + {0x2F819, UNICODE_NORM_QC_NO}, + {0x2F81A, UNICODE_NORM_QC_NO}, + {0x2F81B, UNICODE_NORM_QC_NO}, + {0x2F81C, UNICODE_NORM_QC_NO}, + {0x2F81D, UNICODE_NORM_QC_NO}, + {0x2F81E, UNICODE_NORM_QC_NO}, + {0x2F81F, UNICODE_NORM_QC_NO}, + {0x2F820, UNICODE_NORM_QC_NO}, + {0x2F821, UNICODE_NORM_QC_NO}, + {0x2F822, UNICODE_NORM_QC_NO}, + {0x2F823, UNICODE_NORM_QC_NO}, + {0x2F824, UNICODE_NORM_QC_NO}, + {0x2F825, UNICODE_NORM_QC_NO}, + {0x2F826, UNICODE_NORM_QC_NO}, + {0x2F827, UNICODE_NORM_QC_NO}, + {0x2F828, UNICODE_NORM_QC_NO}, + {0x2F829, UNICODE_NORM_QC_NO}, + {0x2F82A, UNICODE_NORM_QC_NO}, + {0x2F82B, UNICODE_NORM_QC_NO}, + {0x2F82C, UNICODE_NORM_QC_NO}, + {0x2F82D, UNICODE_NORM_QC_NO}, + {0x2F82E, UNICODE_NORM_QC_NO}, + {0x2F82F, UNICODE_NORM_QC_NO}, + {0x2F830, UNICODE_NORM_QC_NO}, + {0x2F831, UNICODE_NORM_QC_NO}, + {0x2F832, UNICODE_NORM_QC_NO}, + {0x2F833, UNICODE_NORM_QC_NO}, + {0x2F834, UNICODE_NORM_QC_NO}, + {0x2F835, UNICODE_NORM_QC_NO}, + {0x2F836, UNICODE_NORM_QC_NO}, + {0x2F837, UNICODE_NORM_QC_NO}, + {0x2F838, UNICODE_NORM_QC_NO}, + {0x2F839, UNICODE_NORM_QC_NO}, + {0x2F83A, UNICODE_NORM_QC_NO}, + {0x2F83B, UNICODE_NORM_QC_NO}, + {0x2F83C, UNICODE_NORM_QC_NO}, + {0x2F83D, UNICODE_NORM_QC_NO}, + {0x2F83E, UNICODE_NORM_QC_NO}, + {0x2F83F, UNICODE_NORM_QC_NO}, + {0x2F840, UNICODE_NORM_QC_NO}, + {0x2F841, UNICODE_NORM_QC_NO}, + {0x2F842, UNICODE_NORM_QC_NO}, + {0x2F843, UNICODE_NORM_QC_NO}, + {0x2F844, UNICODE_NORM_QC_NO}, + {0x2F845, UNICODE_NORM_QC_NO}, + {0x2F846, UNICODE_NORM_QC_NO}, + {0x2F847, UNICODE_NORM_QC_NO}, + {0x2F848, UNICODE_NORM_QC_NO}, + {0x2F849, UNICODE_NORM_QC_NO}, + {0x2F84A, UNICODE_NORM_QC_NO}, + {0x2F84B, UNICODE_NORM_QC_NO}, + {0x2F84C, UNICODE_NORM_QC_NO}, + {0x2F84D, UNICODE_NORM_QC_NO}, + {0x2F84E, UNICODE_NORM_QC_NO}, + {0x2F84F, UNICODE_NORM_QC_NO}, + {0x2F850, UNICODE_NORM_QC_NO}, + {0x2F851, UNICODE_NORM_QC_NO}, + {0x2F852, UNICODE_NORM_QC_NO}, + {0x2F853, UNICODE_NORM_QC_NO}, + {0x2F854, UNICODE_NORM_QC_NO}, + {0x2F855, UNICODE_NORM_QC_NO}, + {0x2F856, UNICODE_NORM_QC_NO}, + {0x2F857, UNICODE_NORM_QC_NO}, + {0x2F858, UNICODE_NORM_QC_NO}, + {0x2F859, UNICODE_NORM_QC_NO}, + {0x2F85A, UNICODE_NORM_QC_NO}, + {0x2F85B, UNICODE_NORM_QC_NO}, + {0x2F85C, UNICODE_NORM_QC_NO}, + {0x2F85D, UNICODE_NORM_QC_NO}, + {0x2F85E, UNICODE_NORM_QC_NO}, + {0x2F85F, UNICODE_NORM_QC_NO}, + {0x2F860, UNICODE_NORM_QC_NO}, + {0x2F861, UNICODE_NORM_QC_NO}, + {0x2F862, UNICODE_NORM_QC_NO}, + {0x2F863, UNICODE_NORM_QC_NO}, + {0x2F864, UNICODE_NORM_QC_NO}, + {0x2F865, UNICODE_NORM_QC_NO}, + {0x2F866, UNICODE_NORM_QC_NO}, + {0x2F867, UNICODE_NORM_QC_NO}, + {0x2F868, UNICODE_NORM_QC_NO}, + {0x2F869, UNICODE_NORM_QC_NO}, + {0x2F86A, UNICODE_NORM_QC_NO}, + {0x2F86B, UNICODE_NORM_QC_NO}, + {0x2F86C, UNICODE_NORM_QC_NO}, + {0x2F86D, UNICODE_NORM_QC_NO}, + {0x2F86E, UNICODE_NORM_QC_NO}, + {0x2F86F, UNICODE_NORM_QC_NO}, + {0x2F870, UNICODE_NORM_QC_NO}, + {0x2F871, UNICODE_NORM_QC_NO}, + {0x2F872, UNICODE_NORM_QC_NO}, + {0x2F873, UNICODE_NORM_QC_NO}, + {0x2F874, UNICODE_NORM_QC_NO}, + {0x2F875, UNICODE_NORM_QC_NO}, + {0x2F876, UNICODE_NORM_QC_NO}, + {0x2F877, UNICODE_NORM_QC_NO}, + {0x2F878, UNICODE_NORM_QC_NO}, + {0x2F879, UNICODE_NORM_QC_NO}, + {0x2F87A, UNICODE_NORM_QC_NO}, + {0x2F87B, UNICODE_NORM_QC_NO}, + {0x2F87C, UNICODE_NORM_QC_NO}, + {0x2F87D, UNICODE_NORM_QC_NO}, + {0x2F87E, UNICODE_NORM_QC_NO}, + {0x2F87F, UNICODE_NORM_QC_NO}, + {0x2F880, UNICODE_NORM_QC_NO}, + {0x2F881, UNICODE_NORM_QC_NO}, + {0x2F882, UNICODE_NORM_QC_NO}, + {0x2F883, UNICODE_NORM_QC_NO}, + {0x2F884, UNICODE_NORM_QC_NO}, + {0x2F885, UNICODE_NORM_QC_NO}, + {0x2F886, UNICODE_NORM_QC_NO}, + {0x2F887, UNICODE_NORM_QC_NO}, + {0x2F888, UNICODE_NORM_QC_NO}, + {0x2F889, UNICODE_NORM_QC_NO}, + {0x2F88A, UNICODE_NORM_QC_NO}, + {0x2F88B, UNICODE_NORM_QC_NO}, + {0x2F88C, UNICODE_NORM_QC_NO}, + {0x2F88D, UNICODE_NORM_QC_NO}, + {0x2F88E, UNICODE_NORM_QC_NO}, + {0x2F88F, UNICODE_NORM_QC_NO}, + {0x2F890, UNICODE_NORM_QC_NO}, + {0x2F891, UNICODE_NORM_QC_NO}, + {0x2F892, UNICODE_NORM_QC_NO}, + {0x2F893, UNICODE_NORM_QC_NO}, + {0x2F894, UNICODE_NORM_QC_NO}, + {0x2F895, UNICODE_NORM_QC_NO}, + {0x2F896, UNICODE_NORM_QC_NO}, + {0x2F897, UNICODE_NORM_QC_NO}, + {0x2F898, UNICODE_NORM_QC_NO}, + {0x2F899, UNICODE_NORM_QC_NO}, + {0x2F89A, UNICODE_NORM_QC_NO}, + {0x2F89B, UNICODE_NORM_QC_NO}, + {0x2F89C, UNICODE_NORM_QC_NO}, + {0x2F89D, UNICODE_NORM_QC_NO}, + {0x2F89E, UNICODE_NORM_QC_NO}, + {0x2F89F, UNICODE_NORM_QC_NO}, + {0x2F8A0, UNICODE_NORM_QC_NO}, + {0x2F8A1, UNICODE_NORM_QC_NO}, + {0x2F8A2, UNICODE_NORM_QC_NO}, + {0x2F8A3, UNICODE_NORM_QC_NO}, + {0x2F8A4, UNICODE_NORM_QC_NO}, + {0x2F8A5, UNICODE_NORM_QC_NO}, + {0x2F8A6, UNICODE_NORM_QC_NO}, + {0x2F8A7, UNICODE_NORM_QC_NO}, + {0x2F8A8, UNICODE_NORM_QC_NO}, + {0x2F8A9, UNICODE_NORM_QC_NO}, + {0x2F8AA, UNICODE_NORM_QC_NO}, + {0x2F8AB, UNICODE_NORM_QC_NO}, + {0x2F8AC, UNICODE_NORM_QC_NO}, + {0x2F8AD, UNICODE_NORM_QC_NO}, + {0x2F8AE, UNICODE_NORM_QC_NO}, + {0x2F8AF, UNICODE_NORM_QC_NO}, + {0x2F8B0, UNICODE_NORM_QC_NO}, + {0x2F8B1, UNICODE_NORM_QC_NO}, + {0x2F8B2, UNICODE_NORM_QC_NO}, + {0x2F8B3, UNICODE_NORM_QC_NO}, + {0x2F8B4, UNICODE_NORM_QC_NO}, + {0x2F8B5, UNICODE_NORM_QC_NO}, + {0x2F8B6, UNICODE_NORM_QC_NO}, + {0x2F8B7, UNICODE_NORM_QC_NO}, + {0x2F8B8, UNICODE_NORM_QC_NO}, + {0x2F8B9, UNICODE_NORM_QC_NO}, + {0x2F8BA, UNICODE_NORM_QC_NO}, + {0x2F8BB, UNICODE_NORM_QC_NO}, + {0x2F8BC, UNICODE_NORM_QC_NO}, + {0x2F8BD, UNICODE_NORM_QC_NO}, + {0x2F8BE, UNICODE_NORM_QC_NO}, + {0x2F8BF, UNICODE_NORM_QC_NO}, + {0x2F8C0, UNICODE_NORM_QC_NO}, + {0x2F8C1, UNICODE_NORM_QC_NO}, + {0x2F8C2, UNICODE_NORM_QC_NO}, + {0x2F8C3, UNICODE_NORM_QC_NO}, + {0x2F8C4, UNICODE_NORM_QC_NO}, + {0x2F8C5, UNICODE_NORM_QC_NO}, + {0x2F8C6, UNICODE_NORM_QC_NO}, + {0x2F8C7, UNICODE_NORM_QC_NO}, + {0x2F8C8, UNICODE_NORM_QC_NO}, + {0x2F8C9, UNICODE_NORM_QC_NO}, + {0x2F8CA, UNICODE_NORM_QC_NO}, + {0x2F8CB, UNICODE_NORM_QC_NO}, + {0x2F8CC, UNICODE_NORM_QC_NO}, + {0x2F8CD, UNICODE_NORM_QC_NO}, + {0x2F8CE, UNICODE_NORM_QC_NO}, + {0x2F8CF, UNICODE_NORM_QC_NO}, + {0x2F8D0, UNICODE_NORM_QC_NO}, + {0x2F8D1, UNICODE_NORM_QC_NO}, + {0x2F8D2, UNICODE_NORM_QC_NO}, + {0x2F8D3, UNICODE_NORM_QC_NO}, + {0x2F8D4, UNICODE_NORM_QC_NO}, + {0x2F8D5, UNICODE_NORM_QC_NO}, + {0x2F8D6, UNICODE_NORM_QC_NO}, + {0x2F8D7, UNICODE_NORM_QC_NO}, + {0x2F8D8, UNICODE_NORM_QC_NO}, + {0x2F8D9, UNICODE_NORM_QC_NO}, + {0x2F8DA, UNICODE_NORM_QC_NO}, + {0x2F8DB, UNICODE_NORM_QC_NO}, + {0x2F8DC, UNICODE_NORM_QC_NO}, + {0x2F8DD, UNICODE_NORM_QC_NO}, + {0x2F8DE, UNICODE_NORM_QC_NO}, + {0x2F8DF, UNICODE_NORM_QC_NO}, + {0x2F8E0, UNICODE_NORM_QC_NO}, + {0x2F8E1, UNICODE_NORM_QC_NO}, + {0x2F8E2, UNICODE_NORM_QC_NO}, + {0x2F8E3, UNICODE_NORM_QC_NO}, + {0x2F8E4, UNICODE_NORM_QC_NO}, + {0x2F8E5, UNICODE_NORM_QC_NO}, + {0x2F8E6, UNICODE_NORM_QC_NO}, + {0x2F8E7, UNICODE_NORM_QC_NO}, + {0x2F8E8, UNICODE_NORM_QC_NO}, + {0x2F8E9, UNICODE_NORM_QC_NO}, + {0x2F8EA, UNICODE_NORM_QC_NO}, + {0x2F8EB, UNICODE_NORM_QC_NO}, + {0x2F8EC, UNICODE_NORM_QC_NO}, + {0x2F8ED, UNICODE_NORM_QC_NO}, + {0x2F8EE, UNICODE_NORM_QC_NO}, + {0x2F8EF, UNICODE_NORM_QC_NO}, + {0x2F8F0, UNICODE_NORM_QC_NO}, + {0x2F8F1, UNICODE_NORM_QC_NO}, + {0x2F8F2, UNICODE_NORM_QC_NO}, + {0x2F8F3, UNICODE_NORM_QC_NO}, + {0x2F8F4, UNICODE_NORM_QC_NO}, + {0x2F8F5, UNICODE_NORM_QC_NO}, + {0x2F8F6, UNICODE_NORM_QC_NO}, + {0x2F8F7, UNICODE_NORM_QC_NO}, + {0x2F8F8, UNICODE_NORM_QC_NO}, + {0x2F8F9, UNICODE_NORM_QC_NO}, + {0x2F8FA, UNICODE_NORM_QC_NO}, + {0x2F8FB, UNICODE_NORM_QC_NO}, + {0x2F8FC, UNICODE_NORM_QC_NO}, + {0x2F8FD, UNICODE_NORM_QC_NO}, + {0x2F8FE, UNICODE_NORM_QC_NO}, + {0x2F8FF, UNICODE_NORM_QC_NO}, + {0x2F900, UNICODE_NORM_QC_NO}, + {0x2F901, UNICODE_NORM_QC_NO}, + {0x2F902, UNICODE_NORM_QC_NO}, + {0x2F903, UNICODE_NORM_QC_NO}, + {0x2F904, UNICODE_NORM_QC_NO}, + {0x2F905, UNICODE_NORM_QC_NO}, + {0x2F906, UNICODE_NORM_QC_NO}, + {0x2F907, UNICODE_NORM_QC_NO}, + {0x2F908, UNICODE_NORM_QC_NO}, + {0x2F909, UNICODE_NORM_QC_NO}, + {0x2F90A, UNICODE_NORM_QC_NO}, + {0x2F90B, UNICODE_NORM_QC_NO}, + {0x2F90C, UNICODE_NORM_QC_NO}, + {0x2F90D, UNICODE_NORM_QC_NO}, + {0x2F90E, UNICODE_NORM_QC_NO}, + {0x2F90F, UNICODE_NORM_QC_NO}, + {0x2F910, UNICODE_NORM_QC_NO}, + {0x2F911, UNICODE_NORM_QC_NO}, + {0x2F912, UNICODE_NORM_QC_NO}, + {0x2F913, UNICODE_NORM_QC_NO}, + {0x2F914, UNICODE_NORM_QC_NO}, + {0x2F915, UNICODE_NORM_QC_NO}, + {0x2F916, UNICODE_NORM_QC_NO}, + {0x2F917, UNICODE_NORM_QC_NO}, + {0x2F918, UNICODE_NORM_QC_NO}, + {0x2F919, UNICODE_NORM_QC_NO}, + {0x2F91A, UNICODE_NORM_QC_NO}, + {0x2F91B, UNICODE_NORM_QC_NO}, + {0x2F91C, UNICODE_NORM_QC_NO}, + {0x2F91D, UNICODE_NORM_QC_NO}, + {0x2F91E, UNICODE_NORM_QC_NO}, + {0x2F91F, UNICODE_NORM_QC_NO}, + {0x2F920, UNICODE_NORM_QC_NO}, + {0x2F921, UNICODE_NORM_QC_NO}, + {0x2F922, UNICODE_NORM_QC_NO}, + {0x2F923, UNICODE_NORM_QC_NO}, + {0x2F924, UNICODE_NORM_QC_NO}, + {0x2F925, UNICODE_NORM_QC_NO}, + {0x2F926, UNICODE_NORM_QC_NO}, + {0x2F927, UNICODE_NORM_QC_NO}, + {0x2F928, UNICODE_NORM_QC_NO}, + {0x2F929, UNICODE_NORM_QC_NO}, + {0x2F92A, UNICODE_NORM_QC_NO}, + {0x2F92B, UNICODE_NORM_QC_NO}, + {0x2F92C, UNICODE_NORM_QC_NO}, + {0x2F92D, UNICODE_NORM_QC_NO}, + {0x2F92E, UNICODE_NORM_QC_NO}, + {0x2F92F, UNICODE_NORM_QC_NO}, + {0x2F930, UNICODE_NORM_QC_NO}, + {0x2F931, UNICODE_NORM_QC_NO}, + {0x2F932, UNICODE_NORM_QC_NO}, + {0x2F933, UNICODE_NORM_QC_NO}, + {0x2F934, UNICODE_NORM_QC_NO}, + {0x2F935, UNICODE_NORM_QC_NO}, + {0x2F936, UNICODE_NORM_QC_NO}, + {0x2F937, UNICODE_NORM_QC_NO}, + {0x2F938, UNICODE_NORM_QC_NO}, + {0x2F939, UNICODE_NORM_QC_NO}, + {0x2F93A, UNICODE_NORM_QC_NO}, + {0x2F93B, UNICODE_NORM_QC_NO}, + {0x2F93C, UNICODE_NORM_QC_NO}, + {0x2F93D, UNICODE_NORM_QC_NO}, + {0x2F93E, UNICODE_NORM_QC_NO}, + {0x2F93F, UNICODE_NORM_QC_NO}, + {0x2F940, UNICODE_NORM_QC_NO}, + {0x2F941, UNICODE_NORM_QC_NO}, + {0x2F942, UNICODE_NORM_QC_NO}, + {0x2F943, UNICODE_NORM_QC_NO}, + {0x2F944, UNICODE_NORM_QC_NO}, + {0x2F945, UNICODE_NORM_QC_NO}, + {0x2F946, UNICODE_NORM_QC_NO}, + {0x2F947, UNICODE_NORM_QC_NO}, + {0x2F948, UNICODE_NORM_QC_NO}, + {0x2F949, UNICODE_NORM_QC_NO}, + {0x2F94A, UNICODE_NORM_QC_NO}, + {0x2F94B, UNICODE_NORM_QC_NO}, + {0x2F94C, UNICODE_NORM_QC_NO}, + {0x2F94D, UNICODE_NORM_QC_NO}, + {0x2F94E, UNICODE_NORM_QC_NO}, + {0x2F94F, UNICODE_NORM_QC_NO}, + {0x2F950, UNICODE_NORM_QC_NO}, + {0x2F951, UNICODE_NORM_QC_NO}, + {0x2F952, UNICODE_NORM_QC_NO}, + {0x2F953, UNICODE_NORM_QC_NO}, + {0x2F954, UNICODE_NORM_QC_NO}, + {0x2F955, UNICODE_NORM_QC_NO}, + {0x2F956, UNICODE_NORM_QC_NO}, + {0x2F957, UNICODE_NORM_QC_NO}, + {0x2F958, UNICODE_NORM_QC_NO}, + {0x2F959, UNICODE_NORM_QC_NO}, + {0x2F95A, UNICODE_NORM_QC_NO}, + {0x2F95B, UNICODE_NORM_QC_NO}, + {0x2F95C, UNICODE_NORM_QC_NO}, + {0x2F95D, UNICODE_NORM_QC_NO}, + {0x2F95E, UNICODE_NORM_QC_NO}, + {0x2F95F, UNICODE_NORM_QC_NO}, + {0x2F960, UNICODE_NORM_QC_NO}, + {0x2F961, UNICODE_NORM_QC_NO}, + {0x2F962, UNICODE_NORM_QC_NO}, + {0x2F963, UNICODE_NORM_QC_NO}, + {0x2F964, UNICODE_NORM_QC_NO}, + {0x2F965, UNICODE_NORM_QC_NO}, + {0x2F966, UNICODE_NORM_QC_NO}, + {0x2F967, UNICODE_NORM_QC_NO}, + {0x2F968, UNICODE_NORM_QC_NO}, + {0x2F969, UNICODE_NORM_QC_NO}, + {0x2F96A, UNICODE_NORM_QC_NO}, + {0x2F96B, UNICODE_NORM_QC_NO}, + {0x2F96C, UNICODE_NORM_QC_NO}, + {0x2F96D, UNICODE_NORM_QC_NO}, + {0x2F96E, UNICODE_NORM_QC_NO}, + {0x2F96F, UNICODE_NORM_QC_NO}, + {0x2F970, UNICODE_NORM_QC_NO}, + {0x2F971, UNICODE_NORM_QC_NO}, + {0x2F972, UNICODE_NORM_QC_NO}, + {0x2F973, UNICODE_NORM_QC_NO}, + {0x2F974, UNICODE_NORM_QC_NO}, + {0x2F975, UNICODE_NORM_QC_NO}, + {0x2F976, UNICODE_NORM_QC_NO}, + {0x2F977, UNICODE_NORM_QC_NO}, + {0x2F978, UNICODE_NORM_QC_NO}, + {0x2F979, UNICODE_NORM_QC_NO}, + {0x2F97A, UNICODE_NORM_QC_NO}, + {0x2F97B, UNICODE_NORM_QC_NO}, + {0x2F97C, UNICODE_NORM_QC_NO}, + {0x2F97D, UNICODE_NORM_QC_NO}, + {0x2F97E, UNICODE_NORM_QC_NO}, + {0x2F97F, UNICODE_NORM_QC_NO}, + {0x2F980, UNICODE_NORM_QC_NO}, + {0x2F981, UNICODE_NORM_QC_NO}, + {0x2F982, UNICODE_NORM_QC_NO}, + {0x2F983, UNICODE_NORM_QC_NO}, + {0x2F984, UNICODE_NORM_QC_NO}, + {0x2F985, UNICODE_NORM_QC_NO}, + {0x2F986, UNICODE_NORM_QC_NO}, + {0x2F987, UNICODE_NORM_QC_NO}, + {0x2F988, UNICODE_NORM_QC_NO}, + {0x2F989, UNICODE_NORM_QC_NO}, + {0x2F98A, UNICODE_NORM_QC_NO}, + {0x2F98B, UNICODE_NORM_QC_NO}, + {0x2F98C, UNICODE_NORM_QC_NO}, + {0x2F98D, UNICODE_NORM_QC_NO}, + {0x2F98E, UNICODE_NORM_QC_NO}, + {0x2F98F, UNICODE_NORM_QC_NO}, + {0x2F990, UNICODE_NORM_QC_NO}, + {0x2F991, UNICODE_NORM_QC_NO}, + {0x2F992, UNICODE_NORM_QC_NO}, + {0x2F993, UNICODE_NORM_QC_NO}, + {0x2F994, UNICODE_NORM_QC_NO}, + {0x2F995, UNICODE_NORM_QC_NO}, + {0x2F996, UNICODE_NORM_QC_NO}, + {0x2F997, UNICODE_NORM_QC_NO}, + {0x2F998, UNICODE_NORM_QC_NO}, + {0x2F999, UNICODE_NORM_QC_NO}, + {0x2F99A, UNICODE_NORM_QC_NO}, + {0x2F99B, UNICODE_NORM_QC_NO}, + {0x2F99C, UNICODE_NORM_QC_NO}, + {0x2F99D, UNICODE_NORM_QC_NO}, + {0x2F99E, UNICODE_NORM_QC_NO}, + {0x2F99F, UNICODE_NORM_QC_NO}, + {0x2F9A0, UNICODE_NORM_QC_NO}, + {0x2F9A1, UNICODE_NORM_QC_NO}, + {0x2F9A2, UNICODE_NORM_QC_NO}, + {0x2F9A3, UNICODE_NORM_QC_NO}, + {0x2F9A4, UNICODE_NORM_QC_NO}, + {0x2F9A5, UNICODE_NORM_QC_NO}, + {0x2F9A6, UNICODE_NORM_QC_NO}, + {0x2F9A7, UNICODE_NORM_QC_NO}, + {0x2F9A8, UNICODE_NORM_QC_NO}, + {0x2F9A9, UNICODE_NORM_QC_NO}, + {0x2F9AA, UNICODE_NORM_QC_NO}, + {0x2F9AB, UNICODE_NORM_QC_NO}, + {0x2F9AC, UNICODE_NORM_QC_NO}, + {0x2F9AD, UNICODE_NORM_QC_NO}, + {0x2F9AE, UNICODE_NORM_QC_NO}, + {0x2F9AF, UNICODE_NORM_QC_NO}, + {0x2F9B0, UNICODE_NORM_QC_NO}, + {0x2F9B1, UNICODE_NORM_QC_NO}, + {0x2F9B2, UNICODE_NORM_QC_NO}, + {0x2F9B3, UNICODE_NORM_QC_NO}, + {0x2F9B4, UNICODE_NORM_QC_NO}, + {0x2F9B5, UNICODE_NORM_QC_NO}, + {0x2F9B6, UNICODE_NORM_QC_NO}, + {0x2F9B7, UNICODE_NORM_QC_NO}, + {0x2F9B8, UNICODE_NORM_QC_NO}, + {0x2F9B9, UNICODE_NORM_QC_NO}, + {0x2F9BA, UNICODE_NORM_QC_NO}, + {0x2F9BB, UNICODE_NORM_QC_NO}, + {0x2F9BC, UNICODE_NORM_QC_NO}, + {0x2F9BD, UNICODE_NORM_QC_NO}, + {0x2F9BE, UNICODE_NORM_QC_NO}, + {0x2F9BF, UNICODE_NORM_QC_NO}, + {0x2F9C0, UNICODE_NORM_QC_NO}, + {0x2F9C1, UNICODE_NORM_QC_NO}, + {0x2F9C2, UNICODE_NORM_QC_NO}, + {0x2F9C3, UNICODE_NORM_QC_NO}, + {0x2F9C4, UNICODE_NORM_QC_NO}, + {0x2F9C5, UNICODE_NORM_QC_NO}, + {0x2F9C6, UNICODE_NORM_QC_NO}, + {0x2F9C7, UNICODE_NORM_QC_NO}, + {0x2F9C8, UNICODE_NORM_QC_NO}, + {0x2F9C9, UNICODE_NORM_QC_NO}, + {0x2F9CA, UNICODE_NORM_QC_NO}, + {0x2F9CB, UNICODE_NORM_QC_NO}, + {0x2F9CC, UNICODE_NORM_QC_NO}, + {0x2F9CD, UNICODE_NORM_QC_NO}, + {0x2F9CE, UNICODE_NORM_QC_NO}, + {0x2F9CF, UNICODE_NORM_QC_NO}, + {0x2F9D0, UNICODE_NORM_QC_NO}, + {0x2F9D1, UNICODE_NORM_QC_NO}, + {0x2F9D2, UNICODE_NORM_QC_NO}, + {0x2F9D3, UNICODE_NORM_QC_NO}, + {0x2F9D4, UNICODE_NORM_QC_NO}, + {0x2F9D5, UNICODE_NORM_QC_NO}, + {0x2F9D6, UNICODE_NORM_QC_NO}, + {0x2F9D7, UNICODE_NORM_QC_NO}, + {0x2F9D8, UNICODE_NORM_QC_NO}, + {0x2F9D9, UNICODE_NORM_QC_NO}, + {0x2F9DA, UNICODE_NORM_QC_NO}, + {0x2F9DB, UNICODE_NORM_QC_NO}, + {0x2F9DC, UNICODE_NORM_QC_NO}, + {0x2F9DD, UNICODE_NORM_QC_NO}, + {0x2F9DE, UNICODE_NORM_QC_NO}, + {0x2F9DF, UNICODE_NORM_QC_NO}, + {0x2F9E0, UNICODE_NORM_QC_NO}, + {0x2F9E1, UNICODE_NORM_QC_NO}, + {0x2F9E2, UNICODE_NORM_QC_NO}, + {0x2F9E3, UNICODE_NORM_QC_NO}, + {0x2F9E4, UNICODE_NORM_QC_NO}, + {0x2F9E5, UNICODE_NORM_QC_NO}, + {0x2F9E6, UNICODE_NORM_QC_NO}, + {0x2F9E7, UNICODE_NORM_QC_NO}, + {0x2F9E8, UNICODE_NORM_QC_NO}, + {0x2F9E9, UNICODE_NORM_QC_NO}, + {0x2F9EA, UNICODE_NORM_QC_NO}, + {0x2F9EB, UNICODE_NORM_QC_NO}, + {0x2F9EC, UNICODE_NORM_QC_NO}, + {0x2F9ED, UNICODE_NORM_QC_NO}, + {0x2F9EE, UNICODE_NORM_QC_NO}, + {0x2F9EF, UNICODE_NORM_QC_NO}, + {0x2F9F0, UNICODE_NORM_QC_NO}, + {0x2F9F1, UNICODE_NORM_QC_NO}, + {0x2F9F2, UNICODE_NORM_QC_NO}, + {0x2F9F3, UNICODE_NORM_QC_NO}, + {0x2F9F4, UNICODE_NORM_QC_NO}, + {0x2F9F5, UNICODE_NORM_QC_NO}, + {0x2F9F6, UNICODE_NORM_QC_NO}, + {0x2F9F7, UNICODE_NORM_QC_NO}, + {0x2F9F8, UNICODE_NORM_QC_NO}, + {0x2F9F9, UNICODE_NORM_QC_NO}, + {0x2F9FA, UNICODE_NORM_QC_NO}, + {0x2F9FB, UNICODE_NORM_QC_NO}, + {0x2F9FC, UNICODE_NORM_QC_NO}, + {0x2F9FD, UNICODE_NORM_QC_NO}, + {0x2F9FE, UNICODE_NORM_QC_NO}, + {0x2F9FF, UNICODE_NORM_QC_NO}, + {0x2FA00, UNICODE_NORM_QC_NO}, + {0x2FA01, UNICODE_NORM_QC_NO}, + {0x2FA02, UNICODE_NORM_QC_NO}, + {0x2FA03, UNICODE_NORM_QC_NO}, + {0x2FA04, UNICODE_NORM_QC_NO}, + {0x2FA05, UNICODE_NORM_QC_NO}, + {0x2FA06, UNICODE_NORM_QC_NO}, + {0x2FA07, UNICODE_NORM_QC_NO}, + {0x2FA08, UNICODE_NORM_QC_NO}, + {0x2FA09, UNICODE_NORM_QC_NO}, + {0x2FA0A, UNICODE_NORM_QC_NO}, + {0x2FA0B, UNICODE_NORM_QC_NO}, + {0x2FA0C, UNICODE_NORM_QC_NO}, + {0x2FA0D, UNICODE_NORM_QC_NO}, + {0x2FA0E, UNICODE_NORM_QC_NO}, + {0x2FA0F, UNICODE_NORM_QC_NO}, + {0x2FA10, UNICODE_NORM_QC_NO}, + {0x2FA11, UNICODE_NORM_QC_NO}, + {0x2FA12, UNICODE_NORM_QC_NO}, + {0x2FA13, UNICODE_NORM_QC_NO}, + {0x2FA14, UNICODE_NORM_QC_NO}, + {0x2FA15, UNICODE_NORM_QC_NO}, + {0x2FA16, UNICODE_NORM_QC_NO}, + {0x2FA17, UNICODE_NORM_QC_NO}, + {0x2FA18, UNICODE_NORM_QC_NO}, + {0x2FA19, UNICODE_NORM_QC_NO}, + {0x2FA1A, UNICODE_NORM_QC_NO}, + {0x2FA1B, UNICODE_NORM_QC_NO}, + {0x2FA1C, UNICODE_NORM_QC_NO}, + {0x2FA1D, UNICODE_NORM_QC_NO}, +}; + +/* Perfect hash function for NFC_QC */ +static int +NFC_QC_hash_func(const void *key) +{ + static const int16 h[2505] = { + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 32767, 32767, 32767, 32767, 0, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 50, + 32767, 32767, 32767, 32767, 51, 52, 32767, 53, + 32767, 32767, 32767, 32767, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 668, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -713, + 32767, 32767, 32767, 32767, 806, 687, 807, -539, + 808, 581, 581, 693, -51, 695, 976, 977, + -281, 465, 980, 981, 982, 983, 984, 985, + 986, 987, 988, 989, 990, 991, 992, 993, + 994, 995, 996, 997, 998, 999, 1000, 1001, + 1002, 1003, -1155, -1155, -1155, 1007, 1008, 59, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 893, 1829, 1830, 1293, 1832, 1151, 0, + 1154, 1837, 1156, 1157, 2760, -135, 1842, 0, + 0, 1847, 980, 1850, 0, 1853, 733, 975, + 177, 1059, 1060, 1061, 644, 1867, 1064, 1065, + 1066, 1067, 1068, 1069, 1070, 1882, 1072, 1884, + 1885, 1088, 1887, 1077, 1089, 1079, 1080, 1896, + 1897, 1083, 1900, 634, 1086, 665, 666, 0, + 2100, 0, 1914, -172, -172, -172, -1307, -361, + -361, 1641, -361, -361, -361, -361, -172, 1654, + 0, 332, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 669, 0, -132, 0, 0, + 0, 0, 0, 0, 0, 670, 0, 0, + 0, 0, 671, 0, 0, 0, 0, 672, + 0, 0, 0, 0, -78, 0, -1541, 0, + 0, 0, 0, 0, 0, 0, 1869, 0, + 0, 674, 0, 0, 0, 0, 0, 0, + 2046, 1092, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1116, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 60, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -15, + 61, 62, 32767, 32767, 32767, 32767, 63, 64, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 710, 57, 57, 713, + 58, 58, 716, 692, 59, 693, 59, 59, + 59, 59, 59, 59, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 506, 857, + 738, 858, -488, 859, 632, 632, 744, 0, + 746, 747, 748, 749, 750, 751, 752, 753, + 754, 755, 756, 757, 758, 759, 760, 761, + 762, 763, 764, 765, 766, 767, 768, 769, + 770, 771, 772, 773, 774, 775, 776, 777, + 778, 779, 780, 781, 782, 783, 784, 785, + 786, 787, 788, 789, 790, 791, 792, 0, + 0, 538, 0, 682, 0, 682, 0, 682, + 682, -920, 1976, 0, 0, 0, 0, 0, + 0, 0, 0, 1121, 20, 682, 0, 682, + 682, 1139, 0, 682, 682, 682, 1138, 825, + 826, 827, 0, 811, 0, 0, 798, 0, + 834, 835, 836, 837, 0, 0, 840, 0, + 1267, 843, 844, 845, 846, 847, 848, 0, + 850, 851, 822, 853, 854, 855, 856, 2290, + 2291, 2292, 2293, 2105, 280, 863, 864, 865, + 1839, -410, -410, 869, 870, 871, 872, 873, + 874, 875, 876, 877, 878, 879, 880, 881, + 882, 883, 884, 885, 0, 0, 2002, 0, + 0, 0, 0, 893, 894, 895, 896, 897, + 898, 899, 900, 901, 902, 903, 904, 905, + 906, 907, 908, 158, 910, 911, 912, 913, + 914, 915, 916, 917, 918, 0, 920, 921, + 922, 923, 924, 925, 926, 927, 2063, 1118, + 1119, -882, 1121, 1122, 1123, 1124, 936, 937, + 938, 939, 940, 941, 942, 943, 944, 945, + 946, 947, 948, 949, 950, 951, 952, 953, + 954, 955, 956, 957, 958, 959, 960, 961, + 962, 963, 964, 965, 510, 160, 280, 161, + 1508, 162, 390, 391, 280, 1025, 280, 0, + 0, 1259, 514, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2159, 2160, 2161, 0, 0, + 950, 1010, 1011, 1012, 1013, 1014, 1015, 1016, + 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, + 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, + 1033, 1034, 142, -793, -793, -255, -793, -111, + 1041, -112, -794, -112, -112, -1714, 1182, -794, + 1049, 1050, -796, 72, -797, 1054, -798, 323, + 82, 881, 0, 0, 0, 418, -804, 0, + 0, 0, 0, 0, 0, 0, -811, 0, + -811, -811, -13, -811, 0, -11, 0, 0, + -815, -815, 0, -816, 451, 0, 422, 422, + 1089, -1010, 1091, -822, 1265, 1266, 1267, 2403, + 1458, 1459, -542, 1461, 1462, 1463, 1464, 1276, + -549, 1106, 775, 1108, 1109, 1110, 1111, 1112, + 1113, 1114, 1115, 1116, 448, 1118, 1251, 1120, + 1121, 1122, 1123, 1124, 1125, 1126, 457, 1128, + 1129, 1130, 1131, 461, 1133, 1134, 1135, 1136, + 465, 1138, 1139, 1140, 1141, 1220, 1143, 2685, + 1145, 1146, 1147, 1148, 1149, 1150, 1151, -717, + 1153, 1154, 481, 1156, 1157, 1158, 1159, 1160, + 1161, -884, 71, 1164, 1165, 1166, 1167, 1168, + 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, + 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, + 1185, 1186, 1187, 72, 1189, 1190, 1191, 1192, + 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, + 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, + 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, + 1217, 1218, 1219, 1220, 1221, 32767, 1140, 342, + 1224, 1225, 1226, 809, 2032, 1229, 1230, 1231, + 1232, 1233, 1234, 1235, 2047, 1237, 2049, 2050, + 1253, 2052, 1242, 1254, 1244, 1245, 2061, 2062, + 1248, 2065, 799, 1251, 32767, 448, 32767, 448, + 676, 677, 170, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 165, 32767, 32767, 32767, + 166, 167, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 143, 32767, 144, + 32767, -690, 32767, -691, 32767, 147, 73, 148, + 32767, -694, 32767, -621, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 657, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -755, + 32767, 32767, -757, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 152, 32767, -768, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -964, + 32767, 32767, 32767, 32767, 32767, 32767, 0, -782, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -789, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -796, + 32767, 32767, -798, -798, 750, 0, 32767, 32767, + 32767, 32767, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 830, 831, + 832, 0, 0, 32767, 32767, 1125, 32767, 1126, + 32767, 32767, 2047, -848, 1129, 1130, 1131, 1132, + 1133, 1134, 1135, 1136, 32767, 1117, 32767, 1138, + 32767, 32767, 0, 1140, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 678, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 679, 0, 0, 680, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1343, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -582, -582, -582, -582, -582, -582, -582, -582, + -582, -582, -582, -582, -582, -582, -582, -582, + -582, -582, -582, -582, -582, -582, -582, -582, + -582, -582, -582, -582, -582, -582, -582, -582, + -582, -582, -582, -582, -582, -582, 211, 212, + -325, 214, -467, 216, -465, 218, -463, -462, + 1141, -1754, 223, 224, 225, 226, 227, 228, + 229, 230, -890, 212, -449, 234, -447, -446, + -902, 238, -443, -442, -441, -896, -582, -582, + -582, 246, -564, 248, 249, -548, 251, -582, + -582, -582, -582, 256, 257, -582, 259, -1007, + -582, -582, -582, -582, -582, -582, 267, -582, + -582, -552, -582, -582, -582, -582, -2015, -2015, + -2015, -2015, -1826, 0, -582, -582, -582, -1555, + 695, 696, -582, -582, -582, -582, -582, -582, + -582, -582, -582, -582, -582, -582, -582, -582, + -582, -582, -582, 304, 305, -1696, 307, 308, + 309, 310, -582, -582, -582, -582, -582, -582, + -582, -582, -582, -582, -582, -582, -582, -582, + -582, -582, 169, -582, -582, -582, -582, -582, + -582, -582, -582, -582, 337, -582, -582, -582, + -582, -582, -582, -582, -582, -1717, -771, -771, + 1231, -771, -771, -771, -771, -582, -582, -582, + -582, -582, -582, -582, -582, -582, -582, -582, + -582, -582, -582, -582, -582, -582, -582, -582, + -582, -582, -582, -582, -582, -582, -582, -582, + -582, -582, -582, -126, 225, 106, 226, -1120, + 227, 0, 0, 112, -632, 114, 395, 396, + -862, -116, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, + 413, 414, 415, 416, 417, 418, 419, 420, + 421, 422, -1736, -1736, -1736, 426, 427, -522, + 32767, 429, 430, 431, 432, 433, 434, 435, + 436, 437, -392, -392, -392, 441, 442, 32767, + 0, -682, 0, -682, 0, 0, -1602, 1294, + -682, -682, -682, -682, -682, -682, -682, -682, + 439, -662, 0, -682, 0, 0, 457, -682, + 0, 0, 0, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 476, -201, 478, 479, + 480, 481, 482, 483, 484, 485, 486, -192, + 488, 489, -190, 491, 492, 493, 494, 495, + 496, 497, 498, 499, 500, 501, 502, 503, + 504, 505, 506, 507, 508, 509, 510, 511, + 512, 513, 514, 515, 516, 517, 518, 519, + 520, 521, 522, 523, 524, 525, 526, 32767, + 32767, 527, 528, 529, 530, 531, 532, 533, + 534, 535, 536, 537, 538, 539, 540, 541, + 542, 543, 544, 545, 546, 547, 548, 549, + 550, 551, 552, 553, 554, 555, 556, 557, + 558, 559, 560, 561, 562, 563, 564, 565, + 566, 567, 568, 569, 570, 571, 572, 573, + 574, 575, 576, 577, 578, 579, 580, 581, + 582, 583, 584, 585, 586, 587, 588, 589, + 590, -752, 592, 593, 594, 595, 596, 597, + 598, 599, 600, 601, 602, 603, 604, 605, + 606, 607, 608, 609, 610, 611, 612, 613, + 614, 615, 616, 617, 1200, 1201, 1202, 1203, + 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, + 1212, 1213, 1214, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 0, 0, 0, 0, 0, 32767, 0, + 32767, 0, 0, 32767, 0, 0, 32767, 633, + 0, 634, 0, 0, 0, 0, 0, 0, + 32767, 32767, 32767, 32767, 635, 636, 637, 638, + 639, 640, 641, 642, 643, 644, 645, 646, + 647, 32767, 648, 649, 650, 651, 652, 32767, + 653, 0, 654, 655, 0, 656, 657, 0, + 25, 659, 26, 661, 662, 663, 664, 665, + 666, 676, 677, 678, 679, 680, 681, 682, + 683, 684, 685, 230, -120, 0, -119, 1228, + -118, 110, 111, 0, 745, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 793, 794, 257, 796, + 115, 798, 117, 800, 119, 120, 1723, -1172, + 805, 806, 807, 808, 809, 810, 811, 812, + -308, 794, 133, 816, 135, 136, -320, 820, + 139, 140, 141, -314, 0, 0, 0, 828, + 18, 830, 831, 34, 833, 0, 0, 0, + 0, 838, 839, 0, 841, -425, 0, 0, + 0, 0, 0, 0, 849, 0, 0, 30, + 0, 0, 0, 0, -1433, -1433, -1433, -1433, + -1244, 582, 0, 0, 0, -973, 1277, 1278, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 886, 887, -1114, 889, 890, 891, 892, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 751, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 919, 0, 0, 0, 0, 0, + 0, 0, 0, -1135, -189, -189, 1813, -189, + -189, -189, -189, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 32767, 32767, 32767, 32767, 704, 705, + 706, 707, 708, 709, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 0, 0, 0, 0, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 32767, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 40, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 682, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 41, 42, 43, 44, 45, 46, 47, + 48, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 171, 172, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 49, + 32767 + }; + + const unsigned char *k = (const unsigned char *) key; + size_t keylen = 4; + uint32 a = 0; + uint32 b = 0; + + while (keylen--) + { + unsigned char c = *k++; + + a = a * 257 + c; + b = b * 8191 + c; + } + return h[a % 2505] + h[b % 2505]; +} + +/* Hash lookup information for NFC_QC */ +static const pg_unicode_norminfo UnicodeNormInfo_NFC_QC = { + UnicodeNormProps_NFC_QC, + NFC_QC_hash_func, + 1252 +}; + +static const pg_unicode_normprops UnicodeNormProps_NFKC_QC[] = { + {0x00A0, UNICODE_NORM_QC_NO}, + {0x00A8, UNICODE_NORM_QC_NO}, + {0x00AA, UNICODE_NORM_QC_NO}, + {0x00AF, UNICODE_NORM_QC_NO}, + {0x00B2, UNICODE_NORM_QC_NO}, + {0x00B3, UNICODE_NORM_QC_NO}, + {0x00B4, UNICODE_NORM_QC_NO}, + {0x00B5, UNICODE_NORM_QC_NO}, + {0x00B8, UNICODE_NORM_QC_NO}, + {0x00B9, UNICODE_NORM_QC_NO}, + {0x00BA, UNICODE_NORM_QC_NO}, + {0x00BC, UNICODE_NORM_QC_NO}, + {0x00BD, UNICODE_NORM_QC_NO}, + {0x00BE, UNICODE_NORM_QC_NO}, + {0x0132, UNICODE_NORM_QC_NO}, + {0x0133, UNICODE_NORM_QC_NO}, + {0x013F, UNICODE_NORM_QC_NO}, + {0x0140, UNICODE_NORM_QC_NO}, + {0x0149, UNICODE_NORM_QC_NO}, + {0x017F, UNICODE_NORM_QC_NO}, + {0x01C4, UNICODE_NORM_QC_NO}, + {0x01C5, UNICODE_NORM_QC_NO}, + {0x01C6, UNICODE_NORM_QC_NO}, + {0x01C7, UNICODE_NORM_QC_NO}, + {0x01C8, UNICODE_NORM_QC_NO}, + {0x01C9, UNICODE_NORM_QC_NO}, + {0x01CA, UNICODE_NORM_QC_NO}, + {0x01CB, UNICODE_NORM_QC_NO}, + {0x01CC, UNICODE_NORM_QC_NO}, + {0x01F1, UNICODE_NORM_QC_NO}, + {0x01F2, UNICODE_NORM_QC_NO}, + {0x01F3, UNICODE_NORM_QC_NO}, + {0x02B0, UNICODE_NORM_QC_NO}, + {0x02B1, UNICODE_NORM_QC_NO}, + {0x02B2, UNICODE_NORM_QC_NO}, + {0x02B3, UNICODE_NORM_QC_NO}, + {0x02B4, UNICODE_NORM_QC_NO}, + {0x02B5, UNICODE_NORM_QC_NO}, + {0x02B6, UNICODE_NORM_QC_NO}, + {0x02B7, UNICODE_NORM_QC_NO}, + {0x02B8, UNICODE_NORM_QC_NO}, + {0x02D8, UNICODE_NORM_QC_NO}, + {0x02D9, UNICODE_NORM_QC_NO}, + {0x02DA, UNICODE_NORM_QC_NO}, + {0x02DB, UNICODE_NORM_QC_NO}, + {0x02DC, UNICODE_NORM_QC_NO}, + {0x02DD, UNICODE_NORM_QC_NO}, + {0x02E0, UNICODE_NORM_QC_NO}, + {0x02E1, UNICODE_NORM_QC_NO}, + {0x02E2, UNICODE_NORM_QC_NO}, + {0x02E3, UNICODE_NORM_QC_NO}, + {0x02E4, UNICODE_NORM_QC_NO}, + {0x0300, UNICODE_NORM_QC_MAYBE}, + {0x0301, UNICODE_NORM_QC_MAYBE}, + {0x0302, UNICODE_NORM_QC_MAYBE}, + {0x0303, UNICODE_NORM_QC_MAYBE}, + {0x0304, UNICODE_NORM_QC_MAYBE}, + {0x0306, UNICODE_NORM_QC_MAYBE}, + {0x0307, UNICODE_NORM_QC_MAYBE}, + {0x0308, UNICODE_NORM_QC_MAYBE}, + {0x0309, UNICODE_NORM_QC_MAYBE}, + {0x030A, UNICODE_NORM_QC_MAYBE}, + {0x030B, UNICODE_NORM_QC_MAYBE}, + {0x030C, UNICODE_NORM_QC_MAYBE}, + {0x030F, UNICODE_NORM_QC_MAYBE}, + {0x0311, UNICODE_NORM_QC_MAYBE}, + {0x0313, UNICODE_NORM_QC_MAYBE}, + {0x0314, UNICODE_NORM_QC_MAYBE}, + {0x031B, UNICODE_NORM_QC_MAYBE}, + {0x0323, UNICODE_NORM_QC_MAYBE}, + {0x0324, UNICODE_NORM_QC_MAYBE}, + {0x0325, UNICODE_NORM_QC_MAYBE}, + {0x0326, UNICODE_NORM_QC_MAYBE}, + {0x0327, UNICODE_NORM_QC_MAYBE}, + {0x0328, UNICODE_NORM_QC_MAYBE}, + {0x032D, UNICODE_NORM_QC_MAYBE}, + {0x032E, UNICODE_NORM_QC_MAYBE}, + {0x0330, UNICODE_NORM_QC_MAYBE}, + {0x0331, UNICODE_NORM_QC_MAYBE}, + {0x0338, UNICODE_NORM_QC_MAYBE}, + {0x0340, UNICODE_NORM_QC_NO}, + {0x0341, UNICODE_NORM_QC_NO}, + {0x0342, UNICODE_NORM_QC_MAYBE}, + {0x0343, UNICODE_NORM_QC_NO}, + {0x0344, UNICODE_NORM_QC_NO}, + {0x0345, UNICODE_NORM_QC_MAYBE}, + {0x0374, UNICODE_NORM_QC_NO}, + {0x037A, UNICODE_NORM_QC_NO}, + {0x037E, UNICODE_NORM_QC_NO}, + {0x0384, UNICODE_NORM_QC_NO}, + {0x0385, UNICODE_NORM_QC_NO}, + {0x0387, UNICODE_NORM_QC_NO}, + {0x03D0, UNICODE_NORM_QC_NO}, + {0x03D1, UNICODE_NORM_QC_NO}, + {0x03D2, UNICODE_NORM_QC_NO}, + {0x03D3, UNICODE_NORM_QC_NO}, + {0x03D4, UNICODE_NORM_QC_NO}, + {0x03D5, UNICODE_NORM_QC_NO}, + {0x03D6, UNICODE_NORM_QC_NO}, + {0x03F0, UNICODE_NORM_QC_NO}, + {0x03F1, UNICODE_NORM_QC_NO}, + {0x03F2, UNICODE_NORM_QC_NO}, + {0x03F4, UNICODE_NORM_QC_NO}, + {0x03F5, UNICODE_NORM_QC_NO}, + {0x03F9, UNICODE_NORM_QC_NO}, + {0x0587, UNICODE_NORM_QC_NO}, + {0x0653, UNICODE_NORM_QC_MAYBE}, + {0x0654, UNICODE_NORM_QC_MAYBE}, + {0x0655, UNICODE_NORM_QC_MAYBE}, + {0x0675, UNICODE_NORM_QC_NO}, + {0x0676, UNICODE_NORM_QC_NO}, + {0x0677, UNICODE_NORM_QC_NO}, + {0x0678, UNICODE_NORM_QC_NO}, + {0x093C, UNICODE_NORM_QC_MAYBE}, + {0x0958, UNICODE_NORM_QC_NO}, + {0x0959, UNICODE_NORM_QC_NO}, + {0x095A, UNICODE_NORM_QC_NO}, + {0x095B, UNICODE_NORM_QC_NO}, + {0x095C, UNICODE_NORM_QC_NO}, + {0x095D, UNICODE_NORM_QC_NO}, + {0x095E, UNICODE_NORM_QC_NO}, + {0x095F, UNICODE_NORM_QC_NO}, + {0x09BE, UNICODE_NORM_QC_MAYBE}, + {0x09D7, UNICODE_NORM_QC_MAYBE}, + {0x09DC, UNICODE_NORM_QC_NO}, + {0x09DD, UNICODE_NORM_QC_NO}, + {0x09DF, UNICODE_NORM_QC_NO}, + {0x0A33, UNICODE_NORM_QC_NO}, + {0x0A36, UNICODE_NORM_QC_NO}, + {0x0A59, UNICODE_NORM_QC_NO}, + {0x0A5A, UNICODE_NORM_QC_NO}, + {0x0A5B, UNICODE_NORM_QC_NO}, + {0x0A5E, UNICODE_NORM_QC_NO}, + {0x0B3E, UNICODE_NORM_QC_MAYBE}, + {0x0B56, UNICODE_NORM_QC_MAYBE}, + {0x0B57, UNICODE_NORM_QC_MAYBE}, + {0x0B5C, UNICODE_NORM_QC_NO}, + {0x0B5D, UNICODE_NORM_QC_NO}, + {0x0BBE, UNICODE_NORM_QC_MAYBE}, + {0x0BD7, UNICODE_NORM_QC_MAYBE}, + {0x0C56, UNICODE_NORM_QC_MAYBE}, + {0x0CC2, UNICODE_NORM_QC_MAYBE}, + {0x0CD5, UNICODE_NORM_QC_MAYBE}, + {0x0CD6, UNICODE_NORM_QC_MAYBE}, + {0x0D3E, UNICODE_NORM_QC_MAYBE}, + {0x0D57, UNICODE_NORM_QC_MAYBE}, + {0x0DCA, UNICODE_NORM_QC_MAYBE}, + {0x0DCF, UNICODE_NORM_QC_MAYBE}, + {0x0DDF, UNICODE_NORM_QC_MAYBE}, + {0x0E33, UNICODE_NORM_QC_NO}, + {0x0EB3, UNICODE_NORM_QC_NO}, + {0x0EDC, UNICODE_NORM_QC_NO}, + {0x0EDD, UNICODE_NORM_QC_NO}, + {0x0F0C, UNICODE_NORM_QC_NO}, + {0x0F43, UNICODE_NORM_QC_NO}, + {0x0F4D, UNICODE_NORM_QC_NO}, + {0x0F52, UNICODE_NORM_QC_NO}, + {0x0F57, UNICODE_NORM_QC_NO}, + {0x0F5C, UNICODE_NORM_QC_NO}, + {0x0F69, UNICODE_NORM_QC_NO}, + {0x0F73, UNICODE_NORM_QC_NO}, + {0x0F75, UNICODE_NORM_QC_NO}, + {0x0F76, UNICODE_NORM_QC_NO}, + {0x0F77, UNICODE_NORM_QC_NO}, + {0x0F78, UNICODE_NORM_QC_NO}, + {0x0F79, UNICODE_NORM_QC_NO}, + {0x0F81, UNICODE_NORM_QC_NO}, + {0x0F93, UNICODE_NORM_QC_NO}, + {0x0F9D, UNICODE_NORM_QC_NO}, + {0x0FA2, UNICODE_NORM_QC_NO}, + {0x0FA7, UNICODE_NORM_QC_NO}, + {0x0FAC, UNICODE_NORM_QC_NO}, + {0x0FB9, UNICODE_NORM_QC_NO}, + {0x102E, UNICODE_NORM_QC_MAYBE}, + {0x10FC, UNICODE_NORM_QC_NO}, + {0x1161, UNICODE_NORM_QC_MAYBE}, + {0x1162, UNICODE_NORM_QC_MAYBE}, + {0x1163, UNICODE_NORM_QC_MAYBE}, + {0x1164, UNICODE_NORM_QC_MAYBE}, + {0x1165, UNICODE_NORM_QC_MAYBE}, + {0x1166, UNICODE_NORM_QC_MAYBE}, + {0x1167, UNICODE_NORM_QC_MAYBE}, + {0x1168, UNICODE_NORM_QC_MAYBE}, + {0x1169, UNICODE_NORM_QC_MAYBE}, + {0x116A, UNICODE_NORM_QC_MAYBE}, + {0x116B, UNICODE_NORM_QC_MAYBE}, + {0x116C, UNICODE_NORM_QC_MAYBE}, + {0x116D, UNICODE_NORM_QC_MAYBE}, + {0x116E, UNICODE_NORM_QC_MAYBE}, + {0x116F, UNICODE_NORM_QC_MAYBE}, + {0x1170, UNICODE_NORM_QC_MAYBE}, + {0x1171, UNICODE_NORM_QC_MAYBE}, + {0x1172, UNICODE_NORM_QC_MAYBE}, + {0x1173, UNICODE_NORM_QC_MAYBE}, + {0x1174, UNICODE_NORM_QC_MAYBE}, + {0x1175, UNICODE_NORM_QC_MAYBE}, + {0x11A8, UNICODE_NORM_QC_MAYBE}, + {0x11A9, UNICODE_NORM_QC_MAYBE}, + {0x11AA, UNICODE_NORM_QC_MAYBE}, + {0x11AB, UNICODE_NORM_QC_MAYBE}, + {0x11AC, UNICODE_NORM_QC_MAYBE}, + {0x11AD, UNICODE_NORM_QC_MAYBE}, + {0x11AE, UNICODE_NORM_QC_MAYBE}, + {0x11AF, UNICODE_NORM_QC_MAYBE}, + {0x11B0, UNICODE_NORM_QC_MAYBE}, + {0x11B1, UNICODE_NORM_QC_MAYBE}, + {0x11B2, UNICODE_NORM_QC_MAYBE}, + {0x11B3, UNICODE_NORM_QC_MAYBE}, + {0x11B4, UNICODE_NORM_QC_MAYBE}, + {0x11B5, UNICODE_NORM_QC_MAYBE}, + {0x11B6, UNICODE_NORM_QC_MAYBE}, + {0x11B7, UNICODE_NORM_QC_MAYBE}, + {0x11B8, UNICODE_NORM_QC_MAYBE}, + {0x11B9, UNICODE_NORM_QC_MAYBE}, + {0x11BA, UNICODE_NORM_QC_MAYBE}, + {0x11BB, UNICODE_NORM_QC_MAYBE}, + {0x11BC, UNICODE_NORM_QC_MAYBE}, + {0x11BD, UNICODE_NORM_QC_MAYBE}, + {0x11BE, UNICODE_NORM_QC_MAYBE}, + {0x11BF, UNICODE_NORM_QC_MAYBE}, + {0x11C0, UNICODE_NORM_QC_MAYBE}, + {0x11C1, UNICODE_NORM_QC_MAYBE}, + {0x11C2, UNICODE_NORM_QC_MAYBE}, + {0x1B35, UNICODE_NORM_QC_MAYBE}, + {0x1D2C, UNICODE_NORM_QC_NO}, + {0x1D2D, UNICODE_NORM_QC_NO}, + {0x1D2E, UNICODE_NORM_QC_NO}, + {0x1D30, UNICODE_NORM_QC_NO}, + {0x1D31, UNICODE_NORM_QC_NO}, + {0x1D32, UNICODE_NORM_QC_NO}, + {0x1D33, UNICODE_NORM_QC_NO}, + {0x1D34, UNICODE_NORM_QC_NO}, + {0x1D35, UNICODE_NORM_QC_NO}, + {0x1D36, UNICODE_NORM_QC_NO}, + {0x1D37, UNICODE_NORM_QC_NO}, + {0x1D38, UNICODE_NORM_QC_NO}, + {0x1D39, UNICODE_NORM_QC_NO}, + {0x1D3A, UNICODE_NORM_QC_NO}, + {0x1D3C, UNICODE_NORM_QC_NO}, + {0x1D3D, UNICODE_NORM_QC_NO}, + {0x1D3E, UNICODE_NORM_QC_NO}, + {0x1D3F, UNICODE_NORM_QC_NO}, + {0x1D40, UNICODE_NORM_QC_NO}, + {0x1D41, UNICODE_NORM_QC_NO}, + {0x1D42, UNICODE_NORM_QC_NO}, + {0x1D43, UNICODE_NORM_QC_NO}, + {0x1D44, UNICODE_NORM_QC_NO}, + {0x1D45, UNICODE_NORM_QC_NO}, + {0x1D46, UNICODE_NORM_QC_NO}, + {0x1D47, UNICODE_NORM_QC_NO}, + {0x1D48, UNICODE_NORM_QC_NO}, + {0x1D49, UNICODE_NORM_QC_NO}, + {0x1D4A, UNICODE_NORM_QC_NO}, + {0x1D4B, UNICODE_NORM_QC_NO}, + {0x1D4C, UNICODE_NORM_QC_NO}, + {0x1D4D, UNICODE_NORM_QC_NO}, + {0x1D4F, UNICODE_NORM_QC_NO}, + {0x1D50, UNICODE_NORM_QC_NO}, + {0x1D51, UNICODE_NORM_QC_NO}, + {0x1D52, UNICODE_NORM_QC_NO}, + {0x1D53, UNICODE_NORM_QC_NO}, + {0x1D54, UNICODE_NORM_QC_NO}, + {0x1D55, UNICODE_NORM_QC_NO}, + {0x1D56, UNICODE_NORM_QC_NO}, + {0x1D57, UNICODE_NORM_QC_NO}, + {0x1D58, UNICODE_NORM_QC_NO}, + {0x1D59, UNICODE_NORM_QC_NO}, + {0x1D5A, UNICODE_NORM_QC_NO}, + {0x1D5B, UNICODE_NORM_QC_NO}, + {0x1D5C, UNICODE_NORM_QC_NO}, + {0x1D5D, UNICODE_NORM_QC_NO}, + {0x1D5E, UNICODE_NORM_QC_NO}, + {0x1D5F, UNICODE_NORM_QC_NO}, + {0x1D60, UNICODE_NORM_QC_NO}, + {0x1D61, UNICODE_NORM_QC_NO}, + {0x1D62, UNICODE_NORM_QC_NO}, + {0x1D63, UNICODE_NORM_QC_NO}, + {0x1D64, UNICODE_NORM_QC_NO}, + {0x1D65, UNICODE_NORM_QC_NO}, + {0x1D66, UNICODE_NORM_QC_NO}, + {0x1D67, UNICODE_NORM_QC_NO}, + {0x1D68, UNICODE_NORM_QC_NO}, + {0x1D69, UNICODE_NORM_QC_NO}, + {0x1D6A, UNICODE_NORM_QC_NO}, + {0x1D78, UNICODE_NORM_QC_NO}, + {0x1D9B, UNICODE_NORM_QC_NO}, + {0x1D9C, UNICODE_NORM_QC_NO}, + {0x1D9D, UNICODE_NORM_QC_NO}, + {0x1D9E, UNICODE_NORM_QC_NO}, + {0x1D9F, UNICODE_NORM_QC_NO}, + {0x1DA0, UNICODE_NORM_QC_NO}, + {0x1DA1, UNICODE_NORM_QC_NO}, + {0x1DA2, UNICODE_NORM_QC_NO}, + {0x1DA3, UNICODE_NORM_QC_NO}, + {0x1DA4, UNICODE_NORM_QC_NO}, + {0x1DA5, UNICODE_NORM_QC_NO}, + {0x1DA6, UNICODE_NORM_QC_NO}, + {0x1DA7, UNICODE_NORM_QC_NO}, + {0x1DA8, UNICODE_NORM_QC_NO}, + {0x1DA9, UNICODE_NORM_QC_NO}, + {0x1DAA, UNICODE_NORM_QC_NO}, + {0x1DAB, UNICODE_NORM_QC_NO}, + {0x1DAC, UNICODE_NORM_QC_NO}, + {0x1DAD, UNICODE_NORM_QC_NO}, + {0x1DAE, UNICODE_NORM_QC_NO}, + {0x1DAF, UNICODE_NORM_QC_NO}, + {0x1DB0, UNICODE_NORM_QC_NO}, + {0x1DB1, UNICODE_NORM_QC_NO}, + {0x1DB2, UNICODE_NORM_QC_NO}, + {0x1DB3, UNICODE_NORM_QC_NO}, + {0x1DB4, UNICODE_NORM_QC_NO}, + {0x1DB5, UNICODE_NORM_QC_NO}, + {0x1DB6, UNICODE_NORM_QC_NO}, + {0x1DB7, UNICODE_NORM_QC_NO}, + {0x1DB8, UNICODE_NORM_QC_NO}, + {0x1DB9, UNICODE_NORM_QC_NO}, + {0x1DBA, UNICODE_NORM_QC_NO}, + {0x1DBB, UNICODE_NORM_QC_NO}, + {0x1DBC, UNICODE_NORM_QC_NO}, + {0x1DBD, UNICODE_NORM_QC_NO}, + {0x1DBE, UNICODE_NORM_QC_NO}, + {0x1DBF, UNICODE_NORM_QC_NO}, + {0x1E9A, UNICODE_NORM_QC_NO}, + {0x1E9B, UNICODE_NORM_QC_NO}, + {0x1F71, UNICODE_NORM_QC_NO}, + {0x1F73, UNICODE_NORM_QC_NO}, + {0x1F75, UNICODE_NORM_QC_NO}, + {0x1F77, UNICODE_NORM_QC_NO}, + {0x1F79, UNICODE_NORM_QC_NO}, + {0x1F7B, UNICODE_NORM_QC_NO}, + {0x1F7D, UNICODE_NORM_QC_NO}, + {0x1FBB, UNICODE_NORM_QC_NO}, + {0x1FBD, UNICODE_NORM_QC_NO}, + {0x1FBE, UNICODE_NORM_QC_NO}, + {0x1FBF, UNICODE_NORM_QC_NO}, + {0x1FC0, UNICODE_NORM_QC_NO}, + {0x1FC1, UNICODE_NORM_QC_NO}, + {0x1FC9, UNICODE_NORM_QC_NO}, + {0x1FCB, UNICODE_NORM_QC_NO}, + {0x1FCD, UNICODE_NORM_QC_NO}, + {0x1FCE, UNICODE_NORM_QC_NO}, + {0x1FCF, UNICODE_NORM_QC_NO}, + {0x1FD3, UNICODE_NORM_QC_NO}, + {0x1FDB, UNICODE_NORM_QC_NO}, + {0x1FDD, UNICODE_NORM_QC_NO}, + {0x1FDE, UNICODE_NORM_QC_NO}, + {0x1FDF, UNICODE_NORM_QC_NO}, + {0x1FE3, UNICODE_NORM_QC_NO}, + {0x1FEB, UNICODE_NORM_QC_NO}, + {0x1FED, UNICODE_NORM_QC_NO}, + {0x1FEE, UNICODE_NORM_QC_NO}, + {0x1FEF, UNICODE_NORM_QC_NO}, + {0x1FF9, UNICODE_NORM_QC_NO}, + {0x1FFB, UNICODE_NORM_QC_NO}, + {0x1FFD, UNICODE_NORM_QC_NO}, + {0x1FFE, UNICODE_NORM_QC_NO}, + {0x2000, UNICODE_NORM_QC_NO}, + {0x2001, UNICODE_NORM_QC_NO}, + {0x2002, UNICODE_NORM_QC_NO}, + {0x2003, UNICODE_NORM_QC_NO}, + {0x2004, UNICODE_NORM_QC_NO}, + {0x2005, UNICODE_NORM_QC_NO}, + {0x2006, UNICODE_NORM_QC_NO}, + {0x2007, UNICODE_NORM_QC_NO}, + {0x2008, UNICODE_NORM_QC_NO}, + {0x2009, UNICODE_NORM_QC_NO}, + {0x200A, UNICODE_NORM_QC_NO}, + {0x2011, UNICODE_NORM_QC_NO}, + {0x2017, UNICODE_NORM_QC_NO}, + {0x2024, UNICODE_NORM_QC_NO}, + {0x2025, UNICODE_NORM_QC_NO}, + {0x2026, UNICODE_NORM_QC_NO}, + {0x202F, UNICODE_NORM_QC_NO}, + {0x2033, UNICODE_NORM_QC_NO}, + {0x2034, UNICODE_NORM_QC_NO}, + {0x2036, UNICODE_NORM_QC_NO}, + {0x2037, UNICODE_NORM_QC_NO}, + {0x203C, UNICODE_NORM_QC_NO}, + {0x203E, UNICODE_NORM_QC_NO}, + {0x2047, UNICODE_NORM_QC_NO}, + {0x2048, UNICODE_NORM_QC_NO}, + {0x2049, UNICODE_NORM_QC_NO}, + {0x2057, UNICODE_NORM_QC_NO}, + {0x205F, UNICODE_NORM_QC_NO}, + {0x2070, UNICODE_NORM_QC_NO}, + {0x2071, UNICODE_NORM_QC_NO}, + {0x2074, UNICODE_NORM_QC_NO}, + {0x2075, UNICODE_NORM_QC_NO}, + {0x2076, UNICODE_NORM_QC_NO}, + {0x2077, UNICODE_NORM_QC_NO}, + {0x2078, UNICODE_NORM_QC_NO}, + {0x2079, UNICODE_NORM_QC_NO}, + {0x207A, UNICODE_NORM_QC_NO}, + {0x207B, UNICODE_NORM_QC_NO}, + {0x207C, UNICODE_NORM_QC_NO}, + {0x207D, UNICODE_NORM_QC_NO}, + {0x207E, UNICODE_NORM_QC_NO}, + {0x207F, UNICODE_NORM_QC_NO}, + {0x2080, UNICODE_NORM_QC_NO}, + {0x2081, UNICODE_NORM_QC_NO}, + {0x2082, UNICODE_NORM_QC_NO}, + {0x2083, UNICODE_NORM_QC_NO}, + {0x2084, UNICODE_NORM_QC_NO}, + {0x2085, UNICODE_NORM_QC_NO}, + {0x2086, UNICODE_NORM_QC_NO}, + {0x2087, UNICODE_NORM_QC_NO}, + {0x2088, UNICODE_NORM_QC_NO}, + {0x2089, UNICODE_NORM_QC_NO}, + {0x208A, UNICODE_NORM_QC_NO}, + {0x208B, UNICODE_NORM_QC_NO}, + {0x208C, UNICODE_NORM_QC_NO}, + {0x208D, UNICODE_NORM_QC_NO}, + {0x208E, UNICODE_NORM_QC_NO}, + {0x2090, UNICODE_NORM_QC_NO}, + {0x2091, UNICODE_NORM_QC_NO}, + {0x2092, UNICODE_NORM_QC_NO}, + {0x2093, UNICODE_NORM_QC_NO}, + {0x2094, UNICODE_NORM_QC_NO}, + {0x2095, UNICODE_NORM_QC_NO}, + {0x2096, UNICODE_NORM_QC_NO}, + {0x2097, UNICODE_NORM_QC_NO}, + {0x2098, UNICODE_NORM_QC_NO}, + {0x2099, UNICODE_NORM_QC_NO}, + {0x209A, UNICODE_NORM_QC_NO}, + {0x209B, UNICODE_NORM_QC_NO}, + {0x209C, UNICODE_NORM_QC_NO}, + {0x20A8, UNICODE_NORM_QC_NO}, + {0x2100, UNICODE_NORM_QC_NO}, + {0x2101, UNICODE_NORM_QC_NO}, + {0x2102, UNICODE_NORM_QC_NO}, + {0x2103, UNICODE_NORM_QC_NO}, + {0x2105, UNICODE_NORM_QC_NO}, + {0x2106, UNICODE_NORM_QC_NO}, + {0x2107, UNICODE_NORM_QC_NO}, + {0x2109, UNICODE_NORM_QC_NO}, + {0x210A, UNICODE_NORM_QC_NO}, + {0x210B, UNICODE_NORM_QC_NO}, + {0x210C, UNICODE_NORM_QC_NO}, + {0x210D, UNICODE_NORM_QC_NO}, + {0x210E, UNICODE_NORM_QC_NO}, + {0x210F, UNICODE_NORM_QC_NO}, + {0x2110, UNICODE_NORM_QC_NO}, + {0x2111, UNICODE_NORM_QC_NO}, + {0x2112, UNICODE_NORM_QC_NO}, + {0x2113, UNICODE_NORM_QC_NO}, + {0x2115, UNICODE_NORM_QC_NO}, + {0x2116, UNICODE_NORM_QC_NO}, + {0x2119, UNICODE_NORM_QC_NO}, + {0x211A, UNICODE_NORM_QC_NO}, + {0x211B, UNICODE_NORM_QC_NO}, + {0x211C, UNICODE_NORM_QC_NO}, + {0x211D, UNICODE_NORM_QC_NO}, + {0x2120, UNICODE_NORM_QC_NO}, + {0x2121, UNICODE_NORM_QC_NO}, + {0x2122, UNICODE_NORM_QC_NO}, + {0x2124, UNICODE_NORM_QC_NO}, + {0x2126, UNICODE_NORM_QC_NO}, + {0x2128, UNICODE_NORM_QC_NO}, + {0x212A, UNICODE_NORM_QC_NO}, + {0x212B, UNICODE_NORM_QC_NO}, + {0x212C, UNICODE_NORM_QC_NO}, + {0x212D, UNICODE_NORM_QC_NO}, + {0x212F, UNICODE_NORM_QC_NO}, + {0x2130, UNICODE_NORM_QC_NO}, + {0x2131, UNICODE_NORM_QC_NO}, + {0x2133, UNICODE_NORM_QC_NO}, + {0x2134, UNICODE_NORM_QC_NO}, + {0x2135, UNICODE_NORM_QC_NO}, + {0x2136, UNICODE_NORM_QC_NO}, + {0x2137, UNICODE_NORM_QC_NO}, + {0x2138, UNICODE_NORM_QC_NO}, + {0x2139, UNICODE_NORM_QC_NO}, + {0x213B, UNICODE_NORM_QC_NO}, + {0x213C, UNICODE_NORM_QC_NO}, + {0x213D, UNICODE_NORM_QC_NO}, + {0x213E, UNICODE_NORM_QC_NO}, + {0x213F, UNICODE_NORM_QC_NO}, + {0x2140, UNICODE_NORM_QC_NO}, + {0x2145, UNICODE_NORM_QC_NO}, + {0x2146, UNICODE_NORM_QC_NO}, + {0x2147, UNICODE_NORM_QC_NO}, + {0x2148, UNICODE_NORM_QC_NO}, + {0x2149, UNICODE_NORM_QC_NO}, + {0x2150, UNICODE_NORM_QC_NO}, + {0x2151, UNICODE_NORM_QC_NO}, + {0x2152, UNICODE_NORM_QC_NO}, + {0x2153, UNICODE_NORM_QC_NO}, + {0x2154, UNICODE_NORM_QC_NO}, + {0x2155, UNICODE_NORM_QC_NO}, + {0x2156, UNICODE_NORM_QC_NO}, + {0x2157, UNICODE_NORM_QC_NO}, + {0x2158, UNICODE_NORM_QC_NO}, + {0x2159, UNICODE_NORM_QC_NO}, + {0x215A, UNICODE_NORM_QC_NO}, + {0x215B, UNICODE_NORM_QC_NO}, + {0x215C, UNICODE_NORM_QC_NO}, + {0x215D, UNICODE_NORM_QC_NO}, + {0x215E, UNICODE_NORM_QC_NO}, + {0x215F, UNICODE_NORM_QC_NO}, + {0x2160, UNICODE_NORM_QC_NO}, + {0x2161, UNICODE_NORM_QC_NO}, + {0x2162, UNICODE_NORM_QC_NO}, + {0x2163, UNICODE_NORM_QC_NO}, + {0x2164, UNICODE_NORM_QC_NO}, + {0x2165, UNICODE_NORM_QC_NO}, + {0x2166, UNICODE_NORM_QC_NO}, + {0x2167, UNICODE_NORM_QC_NO}, + {0x2168, UNICODE_NORM_QC_NO}, + {0x2169, UNICODE_NORM_QC_NO}, + {0x216A, UNICODE_NORM_QC_NO}, + {0x216B, UNICODE_NORM_QC_NO}, + {0x216C, UNICODE_NORM_QC_NO}, + {0x216D, UNICODE_NORM_QC_NO}, + {0x216E, UNICODE_NORM_QC_NO}, + {0x216F, UNICODE_NORM_QC_NO}, + {0x2170, UNICODE_NORM_QC_NO}, + {0x2171, UNICODE_NORM_QC_NO}, + {0x2172, UNICODE_NORM_QC_NO}, + {0x2173, UNICODE_NORM_QC_NO}, + {0x2174, UNICODE_NORM_QC_NO}, + {0x2175, UNICODE_NORM_QC_NO}, + {0x2176, UNICODE_NORM_QC_NO}, + {0x2177, UNICODE_NORM_QC_NO}, + {0x2178, UNICODE_NORM_QC_NO}, + {0x2179, UNICODE_NORM_QC_NO}, + {0x217A, UNICODE_NORM_QC_NO}, + {0x217B, UNICODE_NORM_QC_NO}, + {0x217C, UNICODE_NORM_QC_NO}, + {0x217D, UNICODE_NORM_QC_NO}, + {0x217E, UNICODE_NORM_QC_NO}, + {0x217F, UNICODE_NORM_QC_NO}, + {0x2189, UNICODE_NORM_QC_NO}, + {0x222C, UNICODE_NORM_QC_NO}, + {0x222D, UNICODE_NORM_QC_NO}, + {0x222F, UNICODE_NORM_QC_NO}, + {0x2230, UNICODE_NORM_QC_NO}, + {0x2329, UNICODE_NORM_QC_NO}, + {0x232A, UNICODE_NORM_QC_NO}, + {0x2460, UNICODE_NORM_QC_NO}, + {0x2461, UNICODE_NORM_QC_NO}, + {0x2462, UNICODE_NORM_QC_NO}, + {0x2463, UNICODE_NORM_QC_NO}, + {0x2464, UNICODE_NORM_QC_NO}, + {0x2465, UNICODE_NORM_QC_NO}, + {0x2466, UNICODE_NORM_QC_NO}, + {0x2467, UNICODE_NORM_QC_NO}, + {0x2468, UNICODE_NORM_QC_NO}, + {0x2469, UNICODE_NORM_QC_NO}, + {0x246A, UNICODE_NORM_QC_NO}, + {0x246B, UNICODE_NORM_QC_NO}, + {0x246C, UNICODE_NORM_QC_NO}, + {0x246D, UNICODE_NORM_QC_NO}, + {0x246E, UNICODE_NORM_QC_NO}, + {0x246F, UNICODE_NORM_QC_NO}, + {0x2470, UNICODE_NORM_QC_NO}, + {0x2471, UNICODE_NORM_QC_NO}, + {0x2472, UNICODE_NORM_QC_NO}, + {0x2473, UNICODE_NORM_QC_NO}, + {0x2474, UNICODE_NORM_QC_NO}, + {0x2475, UNICODE_NORM_QC_NO}, + {0x2476, UNICODE_NORM_QC_NO}, + {0x2477, UNICODE_NORM_QC_NO}, + {0x2478, UNICODE_NORM_QC_NO}, + {0x2479, UNICODE_NORM_QC_NO}, + {0x247A, UNICODE_NORM_QC_NO}, + {0x247B, UNICODE_NORM_QC_NO}, + {0x247C, UNICODE_NORM_QC_NO}, + {0x247D, UNICODE_NORM_QC_NO}, + {0x247E, UNICODE_NORM_QC_NO}, + {0x247F, UNICODE_NORM_QC_NO}, + {0x2480, UNICODE_NORM_QC_NO}, + {0x2481, UNICODE_NORM_QC_NO}, + {0x2482, UNICODE_NORM_QC_NO}, + {0x2483, UNICODE_NORM_QC_NO}, + {0x2484, UNICODE_NORM_QC_NO}, + {0x2485, UNICODE_NORM_QC_NO}, + {0x2486, UNICODE_NORM_QC_NO}, + {0x2487, UNICODE_NORM_QC_NO}, + {0x2488, UNICODE_NORM_QC_NO}, + {0x2489, UNICODE_NORM_QC_NO}, + {0x248A, UNICODE_NORM_QC_NO}, + {0x248B, UNICODE_NORM_QC_NO}, + {0x248C, UNICODE_NORM_QC_NO}, + {0x248D, UNICODE_NORM_QC_NO}, + {0x248E, UNICODE_NORM_QC_NO}, + {0x248F, UNICODE_NORM_QC_NO}, + {0x2490, UNICODE_NORM_QC_NO}, + {0x2491, UNICODE_NORM_QC_NO}, + {0x2492, UNICODE_NORM_QC_NO}, + {0x2493, UNICODE_NORM_QC_NO}, + {0x2494, UNICODE_NORM_QC_NO}, + {0x2495, UNICODE_NORM_QC_NO}, + {0x2496, UNICODE_NORM_QC_NO}, + {0x2497, UNICODE_NORM_QC_NO}, + {0x2498, UNICODE_NORM_QC_NO}, + {0x2499, UNICODE_NORM_QC_NO}, + {0x249A, UNICODE_NORM_QC_NO}, + {0x249B, UNICODE_NORM_QC_NO}, + {0x249C, UNICODE_NORM_QC_NO}, + {0x249D, UNICODE_NORM_QC_NO}, + {0x249E, UNICODE_NORM_QC_NO}, + {0x249F, UNICODE_NORM_QC_NO}, + {0x24A0, UNICODE_NORM_QC_NO}, + {0x24A1, UNICODE_NORM_QC_NO}, + {0x24A2, UNICODE_NORM_QC_NO}, + {0x24A3, UNICODE_NORM_QC_NO}, + {0x24A4, UNICODE_NORM_QC_NO}, + {0x24A5, UNICODE_NORM_QC_NO}, + {0x24A6, UNICODE_NORM_QC_NO}, + {0x24A7, UNICODE_NORM_QC_NO}, + {0x24A8, UNICODE_NORM_QC_NO}, + {0x24A9, UNICODE_NORM_QC_NO}, + {0x24AA, UNICODE_NORM_QC_NO}, + {0x24AB, UNICODE_NORM_QC_NO}, + {0x24AC, UNICODE_NORM_QC_NO}, + {0x24AD, UNICODE_NORM_QC_NO}, + {0x24AE, UNICODE_NORM_QC_NO}, + {0x24AF, UNICODE_NORM_QC_NO}, + {0x24B0, UNICODE_NORM_QC_NO}, + {0x24B1, UNICODE_NORM_QC_NO}, + {0x24B2, UNICODE_NORM_QC_NO}, + {0x24B3, UNICODE_NORM_QC_NO}, + {0x24B4, UNICODE_NORM_QC_NO}, + {0x24B5, UNICODE_NORM_QC_NO}, + {0x24B6, UNICODE_NORM_QC_NO}, + {0x24B7, UNICODE_NORM_QC_NO}, + {0x24B8, UNICODE_NORM_QC_NO}, + {0x24B9, UNICODE_NORM_QC_NO}, + {0x24BA, UNICODE_NORM_QC_NO}, + {0x24BB, UNICODE_NORM_QC_NO}, + {0x24BC, UNICODE_NORM_QC_NO}, + {0x24BD, UNICODE_NORM_QC_NO}, + {0x24BE, UNICODE_NORM_QC_NO}, + {0x24BF, UNICODE_NORM_QC_NO}, + {0x24C0, UNICODE_NORM_QC_NO}, + {0x24C1, UNICODE_NORM_QC_NO}, + {0x24C2, UNICODE_NORM_QC_NO}, + {0x24C3, UNICODE_NORM_QC_NO}, + {0x24C4, UNICODE_NORM_QC_NO}, + {0x24C5, UNICODE_NORM_QC_NO}, + {0x24C6, UNICODE_NORM_QC_NO}, + {0x24C7, UNICODE_NORM_QC_NO}, + {0x24C8, UNICODE_NORM_QC_NO}, + {0x24C9, UNICODE_NORM_QC_NO}, + {0x24CA, UNICODE_NORM_QC_NO}, + {0x24CB, UNICODE_NORM_QC_NO}, + {0x24CC, UNICODE_NORM_QC_NO}, + {0x24CD, UNICODE_NORM_QC_NO}, + {0x24CE, UNICODE_NORM_QC_NO}, + {0x24CF, UNICODE_NORM_QC_NO}, + {0x24D0, UNICODE_NORM_QC_NO}, + {0x24D1, UNICODE_NORM_QC_NO}, + {0x24D2, UNICODE_NORM_QC_NO}, + {0x24D3, UNICODE_NORM_QC_NO}, + {0x24D4, UNICODE_NORM_QC_NO}, + {0x24D5, UNICODE_NORM_QC_NO}, + {0x24D6, UNICODE_NORM_QC_NO}, + {0x24D7, UNICODE_NORM_QC_NO}, + {0x24D8, UNICODE_NORM_QC_NO}, + {0x24D9, UNICODE_NORM_QC_NO}, + {0x24DA, UNICODE_NORM_QC_NO}, + {0x24DB, UNICODE_NORM_QC_NO}, + {0x24DC, UNICODE_NORM_QC_NO}, + {0x24DD, UNICODE_NORM_QC_NO}, + {0x24DE, UNICODE_NORM_QC_NO}, + {0x24DF, UNICODE_NORM_QC_NO}, + {0x24E0, UNICODE_NORM_QC_NO}, + {0x24E1, UNICODE_NORM_QC_NO}, + {0x24E2, UNICODE_NORM_QC_NO}, + {0x24E3, UNICODE_NORM_QC_NO}, + {0x24E4, UNICODE_NORM_QC_NO}, + {0x24E5, UNICODE_NORM_QC_NO}, + {0x24E6, UNICODE_NORM_QC_NO}, + {0x24E7, UNICODE_NORM_QC_NO}, + {0x24E8, UNICODE_NORM_QC_NO}, + {0x24E9, UNICODE_NORM_QC_NO}, + {0x24EA, UNICODE_NORM_QC_NO}, + {0x2A0C, UNICODE_NORM_QC_NO}, + {0x2A74, UNICODE_NORM_QC_NO}, + {0x2A75, UNICODE_NORM_QC_NO}, + {0x2A76, UNICODE_NORM_QC_NO}, + {0x2ADC, UNICODE_NORM_QC_NO}, + {0x2C7C, UNICODE_NORM_QC_NO}, + {0x2C7D, UNICODE_NORM_QC_NO}, + {0x2D6F, UNICODE_NORM_QC_NO}, + {0x2E9F, UNICODE_NORM_QC_NO}, + {0x2EF3, UNICODE_NORM_QC_NO}, + {0x2F00, UNICODE_NORM_QC_NO}, + {0x2F01, UNICODE_NORM_QC_NO}, + {0x2F02, UNICODE_NORM_QC_NO}, + {0x2F03, UNICODE_NORM_QC_NO}, + {0x2F04, UNICODE_NORM_QC_NO}, + {0x2F05, UNICODE_NORM_QC_NO}, + {0x2F06, UNICODE_NORM_QC_NO}, + {0x2F07, UNICODE_NORM_QC_NO}, + {0x2F08, UNICODE_NORM_QC_NO}, + {0x2F09, UNICODE_NORM_QC_NO}, + {0x2F0A, UNICODE_NORM_QC_NO}, + {0x2F0B, UNICODE_NORM_QC_NO}, + {0x2F0C, UNICODE_NORM_QC_NO}, + {0x2F0D, UNICODE_NORM_QC_NO}, + {0x2F0E, UNICODE_NORM_QC_NO}, + {0x2F0F, UNICODE_NORM_QC_NO}, + {0x2F10, UNICODE_NORM_QC_NO}, + {0x2F11, UNICODE_NORM_QC_NO}, + {0x2F12, UNICODE_NORM_QC_NO}, + {0x2F13, UNICODE_NORM_QC_NO}, + {0x2F14, UNICODE_NORM_QC_NO}, + {0x2F15, UNICODE_NORM_QC_NO}, + {0x2F16, UNICODE_NORM_QC_NO}, + {0x2F17, UNICODE_NORM_QC_NO}, + {0x2F18, UNICODE_NORM_QC_NO}, + {0x2F19, UNICODE_NORM_QC_NO}, + {0x2F1A, UNICODE_NORM_QC_NO}, + {0x2F1B, UNICODE_NORM_QC_NO}, + {0x2F1C, UNICODE_NORM_QC_NO}, + {0x2F1D, UNICODE_NORM_QC_NO}, + {0x2F1E, UNICODE_NORM_QC_NO}, + {0x2F1F, UNICODE_NORM_QC_NO}, + {0x2F20, UNICODE_NORM_QC_NO}, + {0x2F21, UNICODE_NORM_QC_NO}, + {0x2F22, UNICODE_NORM_QC_NO}, + {0x2F23, UNICODE_NORM_QC_NO}, + {0x2F24, UNICODE_NORM_QC_NO}, + {0x2F25, UNICODE_NORM_QC_NO}, + {0x2F26, UNICODE_NORM_QC_NO}, + {0x2F27, UNICODE_NORM_QC_NO}, + {0x2F28, UNICODE_NORM_QC_NO}, + {0x2F29, UNICODE_NORM_QC_NO}, + {0x2F2A, UNICODE_NORM_QC_NO}, + {0x2F2B, UNICODE_NORM_QC_NO}, + {0x2F2C, UNICODE_NORM_QC_NO}, + {0x2F2D, UNICODE_NORM_QC_NO}, + {0x2F2E, UNICODE_NORM_QC_NO}, + {0x2F2F, UNICODE_NORM_QC_NO}, + {0x2F30, UNICODE_NORM_QC_NO}, + {0x2F31, UNICODE_NORM_QC_NO}, + {0x2F32, UNICODE_NORM_QC_NO}, + {0x2F33, UNICODE_NORM_QC_NO}, + {0x2F34, UNICODE_NORM_QC_NO}, + {0x2F35, UNICODE_NORM_QC_NO}, + {0x2F36, UNICODE_NORM_QC_NO}, + {0x2F37, UNICODE_NORM_QC_NO}, + {0x2F38, UNICODE_NORM_QC_NO}, + {0x2F39, UNICODE_NORM_QC_NO}, + {0x2F3A, UNICODE_NORM_QC_NO}, + {0x2F3B, UNICODE_NORM_QC_NO}, + {0x2F3C, UNICODE_NORM_QC_NO}, + {0x2F3D, UNICODE_NORM_QC_NO}, + {0x2F3E, UNICODE_NORM_QC_NO}, + {0x2F3F, UNICODE_NORM_QC_NO}, + {0x2F40, UNICODE_NORM_QC_NO}, + {0x2F41, UNICODE_NORM_QC_NO}, + {0x2F42, UNICODE_NORM_QC_NO}, + {0x2F43, UNICODE_NORM_QC_NO}, + {0x2F44, UNICODE_NORM_QC_NO}, + {0x2F45, UNICODE_NORM_QC_NO}, + {0x2F46, UNICODE_NORM_QC_NO}, + {0x2F47, UNICODE_NORM_QC_NO}, + {0x2F48, UNICODE_NORM_QC_NO}, + {0x2F49, UNICODE_NORM_QC_NO}, + {0x2F4A, UNICODE_NORM_QC_NO}, + {0x2F4B, UNICODE_NORM_QC_NO}, + {0x2F4C, UNICODE_NORM_QC_NO}, + {0x2F4D, UNICODE_NORM_QC_NO}, + {0x2F4E, UNICODE_NORM_QC_NO}, + {0x2F4F, UNICODE_NORM_QC_NO}, + {0x2F50, UNICODE_NORM_QC_NO}, + {0x2F51, UNICODE_NORM_QC_NO}, + {0x2F52, UNICODE_NORM_QC_NO}, + {0x2F53, UNICODE_NORM_QC_NO}, + {0x2F54, UNICODE_NORM_QC_NO}, + {0x2F55, UNICODE_NORM_QC_NO}, + {0x2F56, UNICODE_NORM_QC_NO}, + {0x2F57, UNICODE_NORM_QC_NO}, + {0x2F58, UNICODE_NORM_QC_NO}, + {0x2F59, UNICODE_NORM_QC_NO}, + {0x2F5A, UNICODE_NORM_QC_NO}, + {0x2F5B, UNICODE_NORM_QC_NO}, + {0x2F5C, UNICODE_NORM_QC_NO}, + {0x2F5D, UNICODE_NORM_QC_NO}, + {0x2F5E, UNICODE_NORM_QC_NO}, + {0x2F5F, UNICODE_NORM_QC_NO}, + {0x2F60, UNICODE_NORM_QC_NO}, + {0x2F61, UNICODE_NORM_QC_NO}, + {0x2F62, UNICODE_NORM_QC_NO}, + {0x2F63, UNICODE_NORM_QC_NO}, + {0x2F64, UNICODE_NORM_QC_NO}, + {0x2F65, UNICODE_NORM_QC_NO}, + {0x2F66, UNICODE_NORM_QC_NO}, + {0x2F67, UNICODE_NORM_QC_NO}, + {0x2F68, UNICODE_NORM_QC_NO}, + {0x2F69, UNICODE_NORM_QC_NO}, + {0x2F6A, UNICODE_NORM_QC_NO}, + {0x2F6B, UNICODE_NORM_QC_NO}, + {0x2F6C, UNICODE_NORM_QC_NO}, + {0x2F6D, UNICODE_NORM_QC_NO}, + {0x2F6E, UNICODE_NORM_QC_NO}, + {0x2F6F, UNICODE_NORM_QC_NO}, + {0x2F70, UNICODE_NORM_QC_NO}, + {0x2F71, UNICODE_NORM_QC_NO}, + {0x2F72, UNICODE_NORM_QC_NO}, + {0x2F73, UNICODE_NORM_QC_NO}, + {0x2F74, UNICODE_NORM_QC_NO}, + {0x2F75, UNICODE_NORM_QC_NO}, + {0x2F76, UNICODE_NORM_QC_NO}, + {0x2F77, UNICODE_NORM_QC_NO}, + {0x2F78, UNICODE_NORM_QC_NO}, + {0x2F79, UNICODE_NORM_QC_NO}, + {0x2F7A, UNICODE_NORM_QC_NO}, + {0x2F7B, UNICODE_NORM_QC_NO}, + {0x2F7C, UNICODE_NORM_QC_NO}, + {0x2F7D, UNICODE_NORM_QC_NO}, + {0x2F7E, UNICODE_NORM_QC_NO}, + {0x2F7F, UNICODE_NORM_QC_NO}, + {0x2F80, UNICODE_NORM_QC_NO}, + {0x2F81, UNICODE_NORM_QC_NO}, + {0x2F82, UNICODE_NORM_QC_NO}, + {0x2F83, UNICODE_NORM_QC_NO}, + {0x2F84, UNICODE_NORM_QC_NO}, + {0x2F85, UNICODE_NORM_QC_NO}, + {0x2F86, UNICODE_NORM_QC_NO}, + {0x2F87, UNICODE_NORM_QC_NO}, + {0x2F88, UNICODE_NORM_QC_NO}, + {0x2F89, UNICODE_NORM_QC_NO}, + {0x2F8A, UNICODE_NORM_QC_NO}, + {0x2F8B, UNICODE_NORM_QC_NO}, + {0x2F8C, UNICODE_NORM_QC_NO}, + {0x2F8D, UNICODE_NORM_QC_NO}, + {0x2F8E, UNICODE_NORM_QC_NO}, + {0x2F8F, UNICODE_NORM_QC_NO}, + {0x2F90, UNICODE_NORM_QC_NO}, + {0x2F91, UNICODE_NORM_QC_NO}, + {0x2F92, UNICODE_NORM_QC_NO}, + {0x2F93, UNICODE_NORM_QC_NO}, + {0x2F94, UNICODE_NORM_QC_NO}, + {0x2F95, UNICODE_NORM_QC_NO}, + {0x2F96, UNICODE_NORM_QC_NO}, + {0x2F97, UNICODE_NORM_QC_NO}, + {0x2F98, UNICODE_NORM_QC_NO}, + {0x2F99, UNICODE_NORM_QC_NO}, + {0x2F9A, UNICODE_NORM_QC_NO}, + {0x2F9B, UNICODE_NORM_QC_NO}, + {0x2F9C, UNICODE_NORM_QC_NO}, + {0x2F9D, UNICODE_NORM_QC_NO}, + {0x2F9E, UNICODE_NORM_QC_NO}, + {0x2F9F, UNICODE_NORM_QC_NO}, + {0x2FA0, UNICODE_NORM_QC_NO}, + {0x2FA1, UNICODE_NORM_QC_NO}, + {0x2FA2, UNICODE_NORM_QC_NO}, + {0x2FA3, UNICODE_NORM_QC_NO}, + {0x2FA4, UNICODE_NORM_QC_NO}, + {0x2FA5, UNICODE_NORM_QC_NO}, + {0x2FA6, UNICODE_NORM_QC_NO}, + {0x2FA7, UNICODE_NORM_QC_NO}, + {0x2FA8, UNICODE_NORM_QC_NO}, + {0x2FA9, UNICODE_NORM_QC_NO}, + {0x2FAA, UNICODE_NORM_QC_NO}, + {0x2FAB, UNICODE_NORM_QC_NO}, + {0x2FAC, UNICODE_NORM_QC_NO}, + {0x2FAD, UNICODE_NORM_QC_NO}, + {0x2FAE, UNICODE_NORM_QC_NO}, + {0x2FAF, UNICODE_NORM_QC_NO}, + {0x2FB0, UNICODE_NORM_QC_NO}, + {0x2FB1, UNICODE_NORM_QC_NO}, + {0x2FB2, UNICODE_NORM_QC_NO}, + {0x2FB3, UNICODE_NORM_QC_NO}, + {0x2FB4, UNICODE_NORM_QC_NO}, + {0x2FB5, UNICODE_NORM_QC_NO}, + {0x2FB6, UNICODE_NORM_QC_NO}, + {0x2FB7, UNICODE_NORM_QC_NO}, + {0x2FB8, UNICODE_NORM_QC_NO}, + {0x2FB9, UNICODE_NORM_QC_NO}, + {0x2FBA, UNICODE_NORM_QC_NO}, + {0x2FBB, UNICODE_NORM_QC_NO}, + {0x2FBC, UNICODE_NORM_QC_NO}, + {0x2FBD, UNICODE_NORM_QC_NO}, + {0x2FBE, UNICODE_NORM_QC_NO}, + {0x2FBF, UNICODE_NORM_QC_NO}, + {0x2FC0, UNICODE_NORM_QC_NO}, + {0x2FC1, UNICODE_NORM_QC_NO}, + {0x2FC2, UNICODE_NORM_QC_NO}, + {0x2FC3, UNICODE_NORM_QC_NO}, + {0x2FC4, UNICODE_NORM_QC_NO}, + {0x2FC5, UNICODE_NORM_QC_NO}, + {0x2FC6, UNICODE_NORM_QC_NO}, + {0x2FC7, UNICODE_NORM_QC_NO}, + {0x2FC8, UNICODE_NORM_QC_NO}, + {0x2FC9, UNICODE_NORM_QC_NO}, + {0x2FCA, UNICODE_NORM_QC_NO}, + {0x2FCB, UNICODE_NORM_QC_NO}, + {0x2FCC, UNICODE_NORM_QC_NO}, + {0x2FCD, UNICODE_NORM_QC_NO}, + {0x2FCE, UNICODE_NORM_QC_NO}, + {0x2FCF, UNICODE_NORM_QC_NO}, + {0x2FD0, UNICODE_NORM_QC_NO}, + {0x2FD1, UNICODE_NORM_QC_NO}, + {0x2FD2, UNICODE_NORM_QC_NO}, + {0x2FD3, UNICODE_NORM_QC_NO}, + {0x2FD4, UNICODE_NORM_QC_NO}, + {0x2FD5, UNICODE_NORM_QC_NO}, + {0x3000, UNICODE_NORM_QC_NO}, + {0x3036, UNICODE_NORM_QC_NO}, + {0x3038, UNICODE_NORM_QC_NO}, + {0x3039, UNICODE_NORM_QC_NO}, + {0x303A, UNICODE_NORM_QC_NO}, + {0x3099, UNICODE_NORM_QC_MAYBE}, + {0x309A, UNICODE_NORM_QC_MAYBE}, + {0x309B, UNICODE_NORM_QC_NO}, + {0x309C, UNICODE_NORM_QC_NO}, + {0x309F, UNICODE_NORM_QC_NO}, + {0x30FF, UNICODE_NORM_QC_NO}, + {0x3131, UNICODE_NORM_QC_NO}, + {0x3132, UNICODE_NORM_QC_NO}, + {0x3133, UNICODE_NORM_QC_NO}, + {0x3134, UNICODE_NORM_QC_NO}, + {0x3135, UNICODE_NORM_QC_NO}, + {0x3136, UNICODE_NORM_QC_NO}, + {0x3137, UNICODE_NORM_QC_NO}, + {0x3138, UNICODE_NORM_QC_NO}, + {0x3139, UNICODE_NORM_QC_NO}, + {0x313A, UNICODE_NORM_QC_NO}, + {0x313B, UNICODE_NORM_QC_NO}, + {0x313C, UNICODE_NORM_QC_NO}, + {0x313D, UNICODE_NORM_QC_NO}, + {0x313E, UNICODE_NORM_QC_NO}, + {0x313F, UNICODE_NORM_QC_NO}, + {0x3140, UNICODE_NORM_QC_NO}, + {0x3141, UNICODE_NORM_QC_NO}, + {0x3142, UNICODE_NORM_QC_NO}, + {0x3143, UNICODE_NORM_QC_NO}, + {0x3144, UNICODE_NORM_QC_NO}, + {0x3145, UNICODE_NORM_QC_NO}, + {0x3146, UNICODE_NORM_QC_NO}, + {0x3147, UNICODE_NORM_QC_NO}, + {0x3148, UNICODE_NORM_QC_NO}, + {0x3149, UNICODE_NORM_QC_NO}, + {0x314A, UNICODE_NORM_QC_NO}, + {0x314B, UNICODE_NORM_QC_NO}, + {0x314C, UNICODE_NORM_QC_NO}, + {0x314D, UNICODE_NORM_QC_NO}, + {0x314E, UNICODE_NORM_QC_NO}, + {0x314F, UNICODE_NORM_QC_NO}, + {0x3150, UNICODE_NORM_QC_NO}, + {0x3151, UNICODE_NORM_QC_NO}, + {0x3152, UNICODE_NORM_QC_NO}, + {0x3153, UNICODE_NORM_QC_NO}, + {0x3154, UNICODE_NORM_QC_NO}, + {0x3155, UNICODE_NORM_QC_NO}, + {0x3156, UNICODE_NORM_QC_NO}, + {0x3157, UNICODE_NORM_QC_NO}, + {0x3158, UNICODE_NORM_QC_NO}, + {0x3159, UNICODE_NORM_QC_NO}, + {0x315A, UNICODE_NORM_QC_NO}, + {0x315B, UNICODE_NORM_QC_NO}, + {0x315C, UNICODE_NORM_QC_NO}, + {0x315D, UNICODE_NORM_QC_NO}, + {0x315E, UNICODE_NORM_QC_NO}, + {0x315F, UNICODE_NORM_QC_NO}, + {0x3160, UNICODE_NORM_QC_NO}, + {0x3161, UNICODE_NORM_QC_NO}, + {0x3162, UNICODE_NORM_QC_NO}, + {0x3163, UNICODE_NORM_QC_NO}, + {0x3164, UNICODE_NORM_QC_NO}, + {0x3165, UNICODE_NORM_QC_NO}, + {0x3166, UNICODE_NORM_QC_NO}, + {0x3167, UNICODE_NORM_QC_NO}, + {0x3168, UNICODE_NORM_QC_NO}, + {0x3169, UNICODE_NORM_QC_NO}, + {0x316A, UNICODE_NORM_QC_NO}, + {0x316B, UNICODE_NORM_QC_NO}, + {0x316C, UNICODE_NORM_QC_NO}, + {0x316D, UNICODE_NORM_QC_NO}, + {0x316E, UNICODE_NORM_QC_NO}, + {0x316F, UNICODE_NORM_QC_NO}, + {0x3170, UNICODE_NORM_QC_NO}, + {0x3171, UNICODE_NORM_QC_NO}, + {0x3172, UNICODE_NORM_QC_NO}, + {0x3173, UNICODE_NORM_QC_NO}, + {0x3174, UNICODE_NORM_QC_NO}, + {0x3175, UNICODE_NORM_QC_NO}, + {0x3176, UNICODE_NORM_QC_NO}, + {0x3177, UNICODE_NORM_QC_NO}, + {0x3178, UNICODE_NORM_QC_NO}, + {0x3179, UNICODE_NORM_QC_NO}, + {0x317A, UNICODE_NORM_QC_NO}, + {0x317B, UNICODE_NORM_QC_NO}, + {0x317C, UNICODE_NORM_QC_NO}, + {0x317D, UNICODE_NORM_QC_NO}, + {0x317E, UNICODE_NORM_QC_NO}, + {0x317F, UNICODE_NORM_QC_NO}, + {0x3180, UNICODE_NORM_QC_NO}, + {0x3181, UNICODE_NORM_QC_NO}, + {0x3182, UNICODE_NORM_QC_NO}, + {0x3183, UNICODE_NORM_QC_NO}, + {0x3184, UNICODE_NORM_QC_NO}, + {0x3185, UNICODE_NORM_QC_NO}, + {0x3186, UNICODE_NORM_QC_NO}, + {0x3187, UNICODE_NORM_QC_NO}, + {0x3188, UNICODE_NORM_QC_NO}, + {0x3189, UNICODE_NORM_QC_NO}, + {0x318A, UNICODE_NORM_QC_NO}, + {0x318B, UNICODE_NORM_QC_NO}, + {0x318C, UNICODE_NORM_QC_NO}, + {0x318D, UNICODE_NORM_QC_NO}, + {0x318E, UNICODE_NORM_QC_NO}, + {0x3192, UNICODE_NORM_QC_NO}, + {0x3193, UNICODE_NORM_QC_NO}, + {0x3194, UNICODE_NORM_QC_NO}, + {0x3195, UNICODE_NORM_QC_NO}, + {0x3196, UNICODE_NORM_QC_NO}, + {0x3197, UNICODE_NORM_QC_NO}, + {0x3198, UNICODE_NORM_QC_NO}, + {0x3199, UNICODE_NORM_QC_NO}, + {0x319A, UNICODE_NORM_QC_NO}, + {0x319B, UNICODE_NORM_QC_NO}, + {0x319C, UNICODE_NORM_QC_NO}, + {0x319D, UNICODE_NORM_QC_NO}, + {0x319E, UNICODE_NORM_QC_NO}, + {0x319F, UNICODE_NORM_QC_NO}, + {0x3200, UNICODE_NORM_QC_NO}, + {0x3201, UNICODE_NORM_QC_NO}, + {0x3202, UNICODE_NORM_QC_NO}, + {0x3203, UNICODE_NORM_QC_NO}, + {0x3204, UNICODE_NORM_QC_NO}, + {0x3205, UNICODE_NORM_QC_NO}, + {0x3206, UNICODE_NORM_QC_NO}, + {0x3207, UNICODE_NORM_QC_NO}, + {0x3208, UNICODE_NORM_QC_NO}, + {0x3209, UNICODE_NORM_QC_NO}, + {0x320A, UNICODE_NORM_QC_NO}, + {0x320B, UNICODE_NORM_QC_NO}, + {0x320C, UNICODE_NORM_QC_NO}, + {0x320D, UNICODE_NORM_QC_NO}, + {0x320E, UNICODE_NORM_QC_NO}, + {0x320F, UNICODE_NORM_QC_NO}, + {0x3210, UNICODE_NORM_QC_NO}, + {0x3211, UNICODE_NORM_QC_NO}, + {0x3212, UNICODE_NORM_QC_NO}, + {0x3213, UNICODE_NORM_QC_NO}, + {0x3214, UNICODE_NORM_QC_NO}, + {0x3215, UNICODE_NORM_QC_NO}, + {0x3216, UNICODE_NORM_QC_NO}, + {0x3217, UNICODE_NORM_QC_NO}, + {0x3218, UNICODE_NORM_QC_NO}, + {0x3219, UNICODE_NORM_QC_NO}, + {0x321A, UNICODE_NORM_QC_NO}, + {0x321B, UNICODE_NORM_QC_NO}, + {0x321C, UNICODE_NORM_QC_NO}, + {0x321D, UNICODE_NORM_QC_NO}, + {0x321E, UNICODE_NORM_QC_NO}, + {0x3220, UNICODE_NORM_QC_NO}, + {0x3221, UNICODE_NORM_QC_NO}, + {0x3222, UNICODE_NORM_QC_NO}, + {0x3223, UNICODE_NORM_QC_NO}, + {0x3224, UNICODE_NORM_QC_NO}, + {0x3225, UNICODE_NORM_QC_NO}, + {0x3226, UNICODE_NORM_QC_NO}, + {0x3227, UNICODE_NORM_QC_NO}, + {0x3228, UNICODE_NORM_QC_NO}, + {0x3229, UNICODE_NORM_QC_NO}, + {0x322A, UNICODE_NORM_QC_NO}, + {0x322B, UNICODE_NORM_QC_NO}, + {0x322C, UNICODE_NORM_QC_NO}, + {0x322D, UNICODE_NORM_QC_NO}, + {0x322E, UNICODE_NORM_QC_NO}, + {0x322F, UNICODE_NORM_QC_NO}, + {0x3230, UNICODE_NORM_QC_NO}, + {0x3231, UNICODE_NORM_QC_NO}, + {0x3232, UNICODE_NORM_QC_NO}, + {0x3233, UNICODE_NORM_QC_NO}, + {0x3234, UNICODE_NORM_QC_NO}, + {0x3235, UNICODE_NORM_QC_NO}, + {0x3236, UNICODE_NORM_QC_NO}, + {0x3237, UNICODE_NORM_QC_NO}, + {0x3238, UNICODE_NORM_QC_NO}, + {0x3239, UNICODE_NORM_QC_NO}, + {0x323A, UNICODE_NORM_QC_NO}, + {0x323B, UNICODE_NORM_QC_NO}, + {0x323C, UNICODE_NORM_QC_NO}, + {0x323D, UNICODE_NORM_QC_NO}, + {0x323E, UNICODE_NORM_QC_NO}, + {0x323F, UNICODE_NORM_QC_NO}, + {0x3240, UNICODE_NORM_QC_NO}, + {0x3241, UNICODE_NORM_QC_NO}, + {0x3242, UNICODE_NORM_QC_NO}, + {0x3243, UNICODE_NORM_QC_NO}, + {0x3244, UNICODE_NORM_QC_NO}, + {0x3245, UNICODE_NORM_QC_NO}, + {0x3246, UNICODE_NORM_QC_NO}, + {0x3247, UNICODE_NORM_QC_NO}, + {0x3250, UNICODE_NORM_QC_NO}, + {0x3251, UNICODE_NORM_QC_NO}, + {0x3252, UNICODE_NORM_QC_NO}, + {0x3253, UNICODE_NORM_QC_NO}, + {0x3254, UNICODE_NORM_QC_NO}, + {0x3255, UNICODE_NORM_QC_NO}, + {0x3256, UNICODE_NORM_QC_NO}, + {0x3257, UNICODE_NORM_QC_NO}, + {0x3258, UNICODE_NORM_QC_NO}, + {0x3259, UNICODE_NORM_QC_NO}, + {0x325A, UNICODE_NORM_QC_NO}, + {0x325B, UNICODE_NORM_QC_NO}, + {0x325C, UNICODE_NORM_QC_NO}, + {0x325D, UNICODE_NORM_QC_NO}, + {0x325E, UNICODE_NORM_QC_NO}, + {0x325F, UNICODE_NORM_QC_NO}, + {0x3260, UNICODE_NORM_QC_NO}, + {0x3261, UNICODE_NORM_QC_NO}, + {0x3262, UNICODE_NORM_QC_NO}, + {0x3263, UNICODE_NORM_QC_NO}, + {0x3264, UNICODE_NORM_QC_NO}, + {0x3265, UNICODE_NORM_QC_NO}, + {0x3266, UNICODE_NORM_QC_NO}, + {0x3267, UNICODE_NORM_QC_NO}, + {0x3268, UNICODE_NORM_QC_NO}, + {0x3269, UNICODE_NORM_QC_NO}, + {0x326A, UNICODE_NORM_QC_NO}, + {0x326B, UNICODE_NORM_QC_NO}, + {0x326C, UNICODE_NORM_QC_NO}, + {0x326D, UNICODE_NORM_QC_NO}, + {0x326E, UNICODE_NORM_QC_NO}, + {0x326F, UNICODE_NORM_QC_NO}, + {0x3270, UNICODE_NORM_QC_NO}, + {0x3271, UNICODE_NORM_QC_NO}, + {0x3272, UNICODE_NORM_QC_NO}, + {0x3273, UNICODE_NORM_QC_NO}, + {0x3274, UNICODE_NORM_QC_NO}, + {0x3275, UNICODE_NORM_QC_NO}, + {0x3276, UNICODE_NORM_QC_NO}, + {0x3277, UNICODE_NORM_QC_NO}, + {0x3278, UNICODE_NORM_QC_NO}, + {0x3279, UNICODE_NORM_QC_NO}, + {0x327A, UNICODE_NORM_QC_NO}, + {0x327B, UNICODE_NORM_QC_NO}, + {0x327C, UNICODE_NORM_QC_NO}, + {0x327D, UNICODE_NORM_QC_NO}, + {0x327E, UNICODE_NORM_QC_NO}, + {0x3280, UNICODE_NORM_QC_NO}, + {0x3281, UNICODE_NORM_QC_NO}, + {0x3282, UNICODE_NORM_QC_NO}, + {0x3283, UNICODE_NORM_QC_NO}, + {0x3284, UNICODE_NORM_QC_NO}, + {0x3285, UNICODE_NORM_QC_NO}, + {0x3286, UNICODE_NORM_QC_NO}, + {0x3287, UNICODE_NORM_QC_NO}, + {0x3288, UNICODE_NORM_QC_NO}, + {0x3289, UNICODE_NORM_QC_NO}, + {0x328A, UNICODE_NORM_QC_NO}, + {0x328B, UNICODE_NORM_QC_NO}, + {0x328C, UNICODE_NORM_QC_NO}, + {0x328D, UNICODE_NORM_QC_NO}, + {0x328E, UNICODE_NORM_QC_NO}, + {0x328F, UNICODE_NORM_QC_NO}, + {0x3290, UNICODE_NORM_QC_NO}, + {0x3291, UNICODE_NORM_QC_NO}, + {0x3292, UNICODE_NORM_QC_NO}, + {0x3293, UNICODE_NORM_QC_NO}, + {0x3294, UNICODE_NORM_QC_NO}, + {0x3295, UNICODE_NORM_QC_NO}, + {0x3296, UNICODE_NORM_QC_NO}, + {0x3297, UNICODE_NORM_QC_NO}, + {0x3298, UNICODE_NORM_QC_NO}, + {0x3299, UNICODE_NORM_QC_NO}, + {0x329A, UNICODE_NORM_QC_NO}, + {0x329B, UNICODE_NORM_QC_NO}, + {0x329C, UNICODE_NORM_QC_NO}, + {0x329D, UNICODE_NORM_QC_NO}, + {0x329E, UNICODE_NORM_QC_NO}, + {0x329F, UNICODE_NORM_QC_NO}, + {0x32A0, UNICODE_NORM_QC_NO}, + {0x32A1, UNICODE_NORM_QC_NO}, + {0x32A2, UNICODE_NORM_QC_NO}, + {0x32A3, UNICODE_NORM_QC_NO}, + {0x32A4, UNICODE_NORM_QC_NO}, + {0x32A5, UNICODE_NORM_QC_NO}, + {0x32A6, UNICODE_NORM_QC_NO}, + {0x32A7, UNICODE_NORM_QC_NO}, + {0x32A8, UNICODE_NORM_QC_NO}, + {0x32A9, UNICODE_NORM_QC_NO}, + {0x32AA, UNICODE_NORM_QC_NO}, + {0x32AB, UNICODE_NORM_QC_NO}, + {0x32AC, UNICODE_NORM_QC_NO}, + {0x32AD, UNICODE_NORM_QC_NO}, + {0x32AE, UNICODE_NORM_QC_NO}, + {0x32AF, UNICODE_NORM_QC_NO}, + {0x32B0, UNICODE_NORM_QC_NO}, + {0x32B1, UNICODE_NORM_QC_NO}, + {0x32B2, UNICODE_NORM_QC_NO}, + {0x32B3, UNICODE_NORM_QC_NO}, + {0x32B4, UNICODE_NORM_QC_NO}, + {0x32B5, UNICODE_NORM_QC_NO}, + {0x32B6, UNICODE_NORM_QC_NO}, + {0x32B7, UNICODE_NORM_QC_NO}, + {0x32B8, UNICODE_NORM_QC_NO}, + {0x32B9, UNICODE_NORM_QC_NO}, + {0x32BA, UNICODE_NORM_QC_NO}, + {0x32BB, UNICODE_NORM_QC_NO}, + {0x32BC, UNICODE_NORM_QC_NO}, + {0x32BD, UNICODE_NORM_QC_NO}, + {0x32BE, UNICODE_NORM_QC_NO}, + {0x32BF, UNICODE_NORM_QC_NO}, + {0x32C0, UNICODE_NORM_QC_NO}, + {0x32C1, UNICODE_NORM_QC_NO}, + {0x32C2, UNICODE_NORM_QC_NO}, + {0x32C3, UNICODE_NORM_QC_NO}, + {0x32C4, UNICODE_NORM_QC_NO}, + {0x32C5, UNICODE_NORM_QC_NO}, + {0x32C6, UNICODE_NORM_QC_NO}, + {0x32C7, UNICODE_NORM_QC_NO}, + {0x32C8, UNICODE_NORM_QC_NO}, + {0x32C9, UNICODE_NORM_QC_NO}, + {0x32CA, UNICODE_NORM_QC_NO}, + {0x32CB, UNICODE_NORM_QC_NO}, + {0x32CC, UNICODE_NORM_QC_NO}, + {0x32CD, UNICODE_NORM_QC_NO}, + {0x32CE, UNICODE_NORM_QC_NO}, + {0x32CF, UNICODE_NORM_QC_NO}, + {0x32D0, UNICODE_NORM_QC_NO}, + {0x32D1, UNICODE_NORM_QC_NO}, + {0x32D2, UNICODE_NORM_QC_NO}, + {0x32D3, UNICODE_NORM_QC_NO}, + {0x32D4, UNICODE_NORM_QC_NO}, + {0x32D5, UNICODE_NORM_QC_NO}, + {0x32D6, UNICODE_NORM_QC_NO}, + {0x32D7, UNICODE_NORM_QC_NO}, + {0x32D8, UNICODE_NORM_QC_NO}, + {0x32D9, UNICODE_NORM_QC_NO}, + {0x32DA, UNICODE_NORM_QC_NO}, + {0x32DB, UNICODE_NORM_QC_NO}, + {0x32DC, UNICODE_NORM_QC_NO}, + {0x32DD, UNICODE_NORM_QC_NO}, + {0x32DE, UNICODE_NORM_QC_NO}, + {0x32DF, UNICODE_NORM_QC_NO}, + {0x32E0, UNICODE_NORM_QC_NO}, + {0x32E1, UNICODE_NORM_QC_NO}, + {0x32E2, UNICODE_NORM_QC_NO}, + {0x32E3, UNICODE_NORM_QC_NO}, + {0x32E4, UNICODE_NORM_QC_NO}, + {0x32E5, UNICODE_NORM_QC_NO}, + {0x32E6, UNICODE_NORM_QC_NO}, + {0x32E7, UNICODE_NORM_QC_NO}, + {0x32E8, UNICODE_NORM_QC_NO}, + {0x32E9, UNICODE_NORM_QC_NO}, + {0x32EA, UNICODE_NORM_QC_NO}, + {0x32EB, UNICODE_NORM_QC_NO}, + {0x32EC, UNICODE_NORM_QC_NO}, + {0x32ED, UNICODE_NORM_QC_NO}, + {0x32EE, UNICODE_NORM_QC_NO}, + {0x32EF, UNICODE_NORM_QC_NO}, + {0x32F0, UNICODE_NORM_QC_NO}, + {0x32F1, UNICODE_NORM_QC_NO}, + {0x32F2, UNICODE_NORM_QC_NO}, + {0x32F3, UNICODE_NORM_QC_NO}, + {0x32F4, UNICODE_NORM_QC_NO}, + {0x32F5, UNICODE_NORM_QC_NO}, + {0x32F6, UNICODE_NORM_QC_NO}, + {0x32F7, UNICODE_NORM_QC_NO}, + {0x32F8, UNICODE_NORM_QC_NO}, + {0x32F9, UNICODE_NORM_QC_NO}, + {0x32FA, UNICODE_NORM_QC_NO}, + {0x32FB, UNICODE_NORM_QC_NO}, + {0x32FC, UNICODE_NORM_QC_NO}, + {0x32FD, UNICODE_NORM_QC_NO}, + {0x32FE, UNICODE_NORM_QC_NO}, + {0x32FF, UNICODE_NORM_QC_NO}, + {0x3300, UNICODE_NORM_QC_NO}, + {0x3301, UNICODE_NORM_QC_NO}, + {0x3302, UNICODE_NORM_QC_NO}, + {0x3303, UNICODE_NORM_QC_NO}, + {0x3304, UNICODE_NORM_QC_NO}, + {0x3305, UNICODE_NORM_QC_NO}, + {0x3306, UNICODE_NORM_QC_NO}, + {0x3307, UNICODE_NORM_QC_NO}, + {0x3308, UNICODE_NORM_QC_NO}, + {0x3309, UNICODE_NORM_QC_NO}, + {0x330A, UNICODE_NORM_QC_NO}, + {0x330B, UNICODE_NORM_QC_NO}, + {0x330C, UNICODE_NORM_QC_NO}, + {0x330D, UNICODE_NORM_QC_NO}, + {0x330E, UNICODE_NORM_QC_NO}, + {0x330F, UNICODE_NORM_QC_NO}, + {0x3310, UNICODE_NORM_QC_NO}, + {0x3311, UNICODE_NORM_QC_NO}, + {0x3312, UNICODE_NORM_QC_NO}, + {0x3313, UNICODE_NORM_QC_NO}, + {0x3314, UNICODE_NORM_QC_NO}, + {0x3315, UNICODE_NORM_QC_NO}, + {0x3316, UNICODE_NORM_QC_NO}, + {0x3317, UNICODE_NORM_QC_NO}, + {0x3318, UNICODE_NORM_QC_NO}, + {0x3319, UNICODE_NORM_QC_NO}, + {0x331A, UNICODE_NORM_QC_NO}, + {0x331B, UNICODE_NORM_QC_NO}, + {0x331C, UNICODE_NORM_QC_NO}, + {0x331D, UNICODE_NORM_QC_NO}, + {0x331E, UNICODE_NORM_QC_NO}, + {0x331F, UNICODE_NORM_QC_NO}, + {0x3320, UNICODE_NORM_QC_NO}, + {0x3321, UNICODE_NORM_QC_NO}, + {0x3322, UNICODE_NORM_QC_NO}, + {0x3323, UNICODE_NORM_QC_NO}, + {0x3324, UNICODE_NORM_QC_NO}, + {0x3325, UNICODE_NORM_QC_NO}, + {0x3326, UNICODE_NORM_QC_NO}, + {0x3327, UNICODE_NORM_QC_NO}, + {0x3328, UNICODE_NORM_QC_NO}, + {0x3329, UNICODE_NORM_QC_NO}, + {0x332A, UNICODE_NORM_QC_NO}, + {0x332B, UNICODE_NORM_QC_NO}, + {0x332C, UNICODE_NORM_QC_NO}, + {0x332D, UNICODE_NORM_QC_NO}, + {0x332E, UNICODE_NORM_QC_NO}, + {0x332F, UNICODE_NORM_QC_NO}, + {0x3330, UNICODE_NORM_QC_NO}, + {0x3331, UNICODE_NORM_QC_NO}, + {0x3332, UNICODE_NORM_QC_NO}, + {0x3333, UNICODE_NORM_QC_NO}, + {0x3334, UNICODE_NORM_QC_NO}, + {0x3335, UNICODE_NORM_QC_NO}, + {0x3336, UNICODE_NORM_QC_NO}, + {0x3337, UNICODE_NORM_QC_NO}, + {0x3338, UNICODE_NORM_QC_NO}, + {0x3339, UNICODE_NORM_QC_NO}, + {0x333A, UNICODE_NORM_QC_NO}, + {0x333B, UNICODE_NORM_QC_NO}, + {0x333C, UNICODE_NORM_QC_NO}, + {0x333D, UNICODE_NORM_QC_NO}, + {0x333E, UNICODE_NORM_QC_NO}, + {0x333F, UNICODE_NORM_QC_NO}, + {0x3340, UNICODE_NORM_QC_NO}, + {0x3341, UNICODE_NORM_QC_NO}, + {0x3342, UNICODE_NORM_QC_NO}, + {0x3343, UNICODE_NORM_QC_NO}, + {0x3344, UNICODE_NORM_QC_NO}, + {0x3345, UNICODE_NORM_QC_NO}, + {0x3346, UNICODE_NORM_QC_NO}, + {0x3347, UNICODE_NORM_QC_NO}, + {0x3348, UNICODE_NORM_QC_NO}, + {0x3349, UNICODE_NORM_QC_NO}, + {0x334A, UNICODE_NORM_QC_NO}, + {0x334B, UNICODE_NORM_QC_NO}, + {0x334C, UNICODE_NORM_QC_NO}, + {0x334D, UNICODE_NORM_QC_NO}, + {0x334E, UNICODE_NORM_QC_NO}, + {0x334F, UNICODE_NORM_QC_NO}, + {0x3350, UNICODE_NORM_QC_NO}, + {0x3351, UNICODE_NORM_QC_NO}, + {0x3352, UNICODE_NORM_QC_NO}, + {0x3353, UNICODE_NORM_QC_NO}, + {0x3354, UNICODE_NORM_QC_NO}, + {0x3355, UNICODE_NORM_QC_NO}, + {0x3356, UNICODE_NORM_QC_NO}, + {0x3357, UNICODE_NORM_QC_NO}, + {0x3358, UNICODE_NORM_QC_NO}, + {0x3359, UNICODE_NORM_QC_NO}, + {0x335A, UNICODE_NORM_QC_NO}, + {0x335B, UNICODE_NORM_QC_NO}, + {0x335C, UNICODE_NORM_QC_NO}, + {0x335D, UNICODE_NORM_QC_NO}, + {0x335E, UNICODE_NORM_QC_NO}, + {0x335F, UNICODE_NORM_QC_NO}, + {0x3360, UNICODE_NORM_QC_NO}, + {0x3361, UNICODE_NORM_QC_NO}, + {0x3362, UNICODE_NORM_QC_NO}, + {0x3363, UNICODE_NORM_QC_NO}, + {0x3364, UNICODE_NORM_QC_NO}, + {0x3365, UNICODE_NORM_QC_NO}, + {0x3366, UNICODE_NORM_QC_NO}, + {0x3367, UNICODE_NORM_QC_NO}, + {0x3368, UNICODE_NORM_QC_NO}, + {0x3369, UNICODE_NORM_QC_NO}, + {0x336A, UNICODE_NORM_QC_NO}, + {0x336B, UNICODE_NORM_QC_NO}, + {0x336C, UNICODE_NORM_QC_NO}, + {0x336D, UNICODE_NORM_QC_NO}, + {0x336E, UNICODE_NORM_QC_NO}, + {0x336F, UNICODE_NORM_QC_NO}, + {0x3370, UNICODE_NORM_QC_NO}, + {0x3371, UNICODE_NORM_QC_NO}, + {0x3372, UNICODE_NORM_QC_NO}, + {0x3373, UNICODE_NORM_QC_NO}, + {0x3374, UNICODE_NORM_QC_NO}, + {0x3375, UNICODE_NORM_QC_NO}, + {0x3376, UNICODE_NORM_QC_NO}, + {0x3377, UNICODE_NORM_QC_NO}, + {0x3378, UNICODE_NORM_QC_NO}, + {0x3379, UNICODE_NORM_QC_NO}, + {0x337A, UNICODE_NORM_QC_NO}, + {0x337B, UNICODE_NORM_QC_NO}, + {0x337C, UNICODE_NORM_QC_NO}, + {0x337D, UNICODE_NORM_QC_NO}, + {0x337E, UNICODE_NORM_QC_NO}, + {0x337F, UNICODE_NORM_QC_NO}, + {0x3380, UNICODE_NORM_QC_NO}, + {0x3381, UNICODE_NORM_QC_NO}, + {0x3382, UNICODE_NORM_QC_NO}, + {0x3383, UNICODE_NORM_QC_NO}, + {0x3384, UNICODE_NORM_QC_NO}, + {0x3385, UNICODE_NORM_QC_NO}, + {0x3386, UNICODE_NORM_QC_NO}, + {0x3387, UNICODE_NORM_QC_NO}, + {0x3388, UNICODE_NORM_QC_NO}, + {0x3389, UNICODE_NORM_QC_NO}, + {0x338A, UNICODE_NORM_QC_NO}, + {0x338B, UNICODE_NORM_QC_NO}, + {0x338C, UNICODE_NORM_QC_NO}, + {0x338D, UNICODE_NORM_QC_NO}, + {0x338E, UNICODE_NORM_QC_NO}, + {0x338F, UNICODE_NORM_QC_NO}, + {0x3390, UNICODE_NORM_QC_NO}, + {0x3391, UNICODE_NORM_QC_NO}, + {0x3392, UNICODE_NORM_QC_NO}, + {0x3393, UNICODE_NORM_QC_NO}, + {0x3394, UNICODE_NORM_QC_NO}, + {0x3395, UNICODE_NORM_QC_NO}, + {0x3396, UNICODE_NORM_QC_NO}, + {0x3397, UNICODE_NORM_QC_NO}, + {0x3398, UNICODE_NORM_QC_NO}, + {0x3399, UNICODE_NORM_QC_NO}, + {0x339A, UNICODE_NORM_QC_NO}, + {0x339B, UNICODE_NORM_QC_NO}, + {0x339C, UNICODE_NORM_QC_NO}, + {0x339D, UNICODE_NORM_QC_NO}, + {0x339E, UNICODE_NORM_QC_NO}, + {0x339F, UNICODE_NORM_QC_NO}, + {0x33A0, UNICODE_NORM_QC_NO}, + {0x33A1, UNICODE_NORM_QC_NO}, + {0x33A2, UNICODE_NORM_QC_NO}, + {0x33A3, UNICODE_NORM_QC_NO}, + {0x33A4, UNICODE_NORM_QC_NO}, + {0x33A5, UNICODE_NORM_QC_NO}, + {0x33A6, UNICODE_NORM_QC_NO}, + {0x33A7, UNICODE_NORM_QC_NO}, + {0x33A8, UNICODE_NORM_QC_NO}, + {0x33A9, UNICODE_NORM_QC_NO}, + {0x33AA, UNICODE_NORM_QC_NO}, + {0x33AB, UNICODE_NORM_QC_NO}, + {0x33AC, UNICODE_NORM_QC_NO}, + {0x33AD, UNICODE_NORM_QC_NO}, + {0x33AE, UNICODE_NORM_QC_NO}, + {0x33AF, UNICODE_NORM_QC_NO}, + {0x33B0, UNICODE_NORM_QC_NO}, + {0x33B1, UNICODE_NORM_QC_NO}, + {0x33B2, UNICODE_NORM_QC_NO}, + {0x33B3, UNICODE_NORM_QC_NO}, + {0x33B4, UNICODE_NORM_QC_NO}, + {0x33B5, UNICODE_NORM_QC_NO}, + {0x33B6, UNICODE_NORM_QC_NO}, + {0x33B7, UNICODE_NORM_QC_NO}, + {0x33B8, UNICODE_NORM_QC_NO}, + {0x33B9, UNICODE_NORM_QC_NO}, + {0x33BA, UNICODE_NORM_QC_NO}, + {0x33BB, UNICODE_NORM_QC_NO}, + {0x33BC, UNICODE_NORM_QC_NO}, + {0x33BD, UNICODE_NORM_QC_NO}, + {0x33BE, UNICODE_NORM_QC_NO}, + {0x33BF, UNICODE_NORM_QC_NO}, + {0x33C0, UNICODE_NORM_QC_NO}, + {0x33C1, UNICODE_NORM_QC_NO}, + {0x33C2, UNICODE_NORM_QC_NO}, + {0x33C3, UNICODE_NORM_QC_NO}, + {0x33C4, UNICODE_NORM_QC_NO}, + {0x33C5, UNICODE_NORM_QC_NO}, + {0x33C6, UNICODE_NORM_QC_NO}, + {0x33C7, UNICODE_NORM_QC_NO}, + {0x33C8, UNICODE_NORM_QC_NO}, + {0x33C9, UNICODE_NORM_QC_NO}, + {0x33CA, UNICODE_NORM_QC_NO}, + {0x33CB, UNICODE_NORM_QC_NO}, + {0x33CC, UNICODE_NORM_QC_NO}, + {0x33CD, UNICODE_NORM_QC_NO}, + {0x33CE, UNICODE_NORM_QC_NO}, + {0x33CF, UNICODE_NORM_QC_NO}, + {0x33D0, UNICODE_NORM_QC_NO}, + {0x33D1, UNICODE_NORM_QC_NO}, + {0x33D2, UNICODE_NORM_QC_NO}, + {0x33D3, UNICODE_NORM_QC_NO}, + {0x33D4, UNICODE_NORM_QC_NO}, + {0x33D5, UNICODE_NORM_QC_NO}, + {0x33D6, UNICODE_NORM_QC_NO}, + {0x33D7, UNICODE_NORM_QC_NO}, + {0x33D8, UNICODE_NORM_QC_NO}, + {0x33D9, UNICODE_NORM_QC_NO}, + {0x33DA, UNICODE_NORM_QC_NO}, + {0x33DB, UNICODE_NORM_QC_NO}, + {0x33DC, UNICODE_NORM_QC_NO}, + {0x33DD, UNICODE_NORM_QC_NO}, + {0x33DE, UNICODE_NORM_QC_NO}, + {0x33DF, UNICODE_NORM_QC_NO}, + {0x33E0, UNICODE_NORM_QC_NO}, + {0x33E1, UNICODE_NORM_QC_NO}, + {0x33E2, UNICODE_NORM_QC_NO}, + {0x33E3, UNICODE_NORM_QC_NO}, + {0x33E4, UNICODE_NORM_QC_NO}, + {0x33E5, UNICODE_NORM_QC_NO}, + {0x33E6, UNICODE_NORM_QC_NO}, + {0x33E7, UNICODE_NORM_QC_NO}, + {0x33E8, UNICODE_NORM_QC_NO}, + {0x33E9, UNICODE_NORM_QC_NO}, + {0x33EA, UNICODE_NORM_QC_NO}, + {0x33EB, UNICODE_NORM_QC_NO}, + {0x33EC, UNICODE_NORM_QC_NO}, + {0x33ED, UNICODE_NORM_QC_NO}, + {0x33EE, UNICODE_NORM_QC_NO}, + {0x33EF, UNICODE_NORM_QC_NO}, + {0x33F0, UNICODE_NORM_QC_NO}, + {0x33F1, UNICODE_NORM_QC_NO}, + {0x33F2, UNICODE_NORM_QC_NO}, + {0x33F3, UNICODE_NORM_QC_NO}, + {0x33F4, UNICODE_NORM_QC_NO}, + {0x33F5, UNICODE_NORM_QC_NO}, + {0x33F6, UNICODE_NORM_QC_NO}, + {0x33F7, UNICODE_NORM_QC_NO}, + {0x33F8, UNICODE_NORM_QC_NO}, + {0x33F9, UNICODE_NORM_QC_NO}, + {0x33FA, UNICODE_NORM_QC_NO}, + {0x33FB, UNICODE_NORM_QC_NO}, + {0x33FC, UNICODE_NORM_QC_NO}, + {0x33FD, UNICODE_NORM_QC_NO}, + {0x33FE, UNICODE_NORM_QC_NO}, + {0x33FF, UNICODE_NORM_QC_NO}, + {0xA69C, UNICODE_NORM_QC_NO}, + {0xA69D, UNICODE_NORM_QC_NO}, + {0xA770, UNICODE_NORM_QC_NO}, + {0xA7F2, UNICODE_NORM_QC_NO}, + {0xA7F3, UNICODE_NORM_QC_NO}, + {0xA7F4, UNICODE_NORM_QC_NO}, + {0xA7F8, UNICODE_NORM_QC_NO}, + {0xA7F9, UNICODE_NORM_QC_NO}, + {0xAB5C, UNICODE_NORM_QC_NO}, + {0xAB5D, UNICODE_NORM_QC_NO}, + {0xAB5E, UNICODE_NORM_QC_NO}, + {0xAB5F, UNICODE_NORM_QC_NO}, + {0xAB69, UNICODE_NORM_QC_NO}, + {0xF900, UNICODE_NORM_QC_NO}, + {0xF901, UNICODE_NORM_QC_NO}, + {0xF902, UNICODE_NORM_QC_NO}, + {0xF903, UNICODE_NORM_QC_NO}, + {0xF904, UNICODE_NORM_QC_NO}, + {0xF905, UNICODE_NORM_QC_NO}, + {0xF906, UNICODE_NORM_QC_NO}, + {0xF907, UNICODE_NORM_QC_NO}, + {0xF908, UNICODE_NORM_QC_NO}, + {0xF909, UNICODE_NORM_QC_NO}, + {0xF90A, UNICODE_NORM_QC_NO}, + {0xF90B, UNICODE_NORM_QC_NO}, + {0xF90C, UNICODE_NORM_QC_NO}, + {0xF90D, UNICODE_NORM_QC_NO}, + {0xF90E, UNICODE_NORM_QC_NO}, + {0xF90F, UNICODE_NORM_QC_NO}, + {0xF910, UNICODE_NORM_QC_NO}, + {0xF911, UNICODE_NORM_QC_NO}, + {0xF912, UNICODE_NORM_QC_NO}, + {0xF913, UNICODE_NORM_QC_NO}, + {0xF914, UNICODE_NORM_QC_NO}, + {0xF915, UNICODE_NORM_QC_NO}, + {0xF916, UNICODE_NORM_QC_NO}, + {0xF917, UNICODE_NORM_QC_NO}, + {0xF918, UNICODE_NORM_QC_NO}, + {0xF919, UNICODE_NORM_QC_NO}, + {0xF91A, UNICODE_NORM_QC_NO}, + {0xF91B, UNICODE_NORM_QC_NO}, + {0xF91C, UNICODE_NORM_QC_NO}, + {0xF91D, UNICODE_NORM_QC_NO}, + {0xF91E, UNICODE_NORM_QC_NO}, + {0xF91F, UNICODE_NORM_QC_NO}, + {0xF920, UNICODE_NORM_QC_NO}, + {0xF921, UNICODE_NORM_QC_NO}, + {0xF922, UNICODE_NORM_QC_NO}, + {0xF923, UNICODE_NORM_QC_NO}, + {0xF924, UNICODE_NORM_QC_NO}, + {0xF925, UNICODE_NORM_QC_NO}, + {0xF926, UNICODE_NORM_QC_NO}, + {0xF927, UNICODE_NORM_QC_NO}, + {0xF928, UNICODE_NORM_QC_NO}, + {0xF929, UNICODE_NORM_QC_NO}, + {0xF92A, UNICODE_NORM_QC_NO}, + {0xF92B, UNICODE_NORM_QC_NO}, + {0xF92C, UNICODE_NORM_QC_NO}, + {0xF92D, UNICODE_NORM_QC_NO}, + {0xF92E, UNICODE_NORM_QC_NO}, + {0xF92F, UNICODE_NORM_QC_NO}, + {0xF930, UNICODE_NORM_QC_NO}, + {0xF931, UNICODE_NORM_QC_NO}, + {0xF932, UNICODE_NORM_QC_NO}, + {0xF933, UNICODE_NORM_QC_NO}, + {0xF934, UNICODE_NORM_QC_NO}, + {0xF935, UNICODE_NORM_QC_NO}, + {0xF936, UNICODE_NORM_QC_NO}, + {0xF937, UNICODE_NORM_QC_NO}, + {0xF938, UNICODE_NORM_QC_NO}, + {0xF939, UNICODE_NORM_QC_NO}, + {0xF93A, UNICODE_NORM_QC_NO}, + {0xF93B, UNICODE_NORM_QC_NO}, + {0xF93C, UNICODE_NORM_QC_NO}, + {0xF93D, UNICODE_NORM_QC_NO}, + {0xF93E, UNICODE_NORM_QC_NO}, + {0xF93F, UNICODE_NORM_QC_NO}, + {0xF940, UNICODE_NORM_QC_NO}, + {0xF941, UNICODE_NORM_QC_NO}, + {0xF942, UNICODE_NORM_QC_NO}, + {0xF943, UNICODE_NORM_QC_NO}, + {0xF944, UNICODE_NORM_QC_NO}, + {0xF945, UNICODE_NORM_QC_NO}, + {0xF946, UNICODE_NORM_QC_NO}, + {0xF947, UNICODE_NORM_QC_NO}, + {0xF948, UNICODE_NORM_QC_NO}, + {0xF949, UNICODE_NORM_QC_NO}, + {0xF94A, UNICODE_NORM_QC_NO}, + {0xF94B, UNICODE_NORM_QC_NO}, + {0xF94C, UNICODE_NORM_QC_NO}, + {0xF94D, UNICODE_NORM_QC_NO}, + {0xF94E, UNICODE_NORM_QC_NO}, + {0xF94F, UNICODE_NORM_QC_NO}, + {0xF950, UNICODE_NORM_QC_NO}, + {0xF951, UNICODE_NORM_QC_NO}, + {0xF952, UNICODE_NORM_QC_NO}, + {0xF953, UNICODE_NORM_QC_NO}, + {0xF954, UNICODE_NORM_QC_NO}, + {0xF955, UNICODE_NORM_QC_NO}, + {0xF956, UNICODE_NORM_QC_NO}, + {0xF957, UNICODE_NORM_QC_NO}, + {0xF958, UNICODE_NORM_QC_NO}, + {0xF959, UNICODE_NORM_QC_NO}, + {0xF95A, UNICODE_NORM_QC_NO}, + {0xF95B, UNICODE_NORM_QC_NO}, + {0xF95C, UNICODE_NORM_QC_NO}, + {0xF95D, UNICODE_NORM_QC_NO}, + {0xF95E, UNICODE_NORM_QC_NO}, + {0xF95F, UNICODE_NORM_QC_NO}, + {0xF960, UNICODE_NORM_QC_NO}, + {0xF961, UNICODE_NORM_QC_NO}, + {0xF962, UNICODE_NORM_QC_NO}, + {0xF963, UNICODE_NORM_QC_NO}, + {0xF964, UNICODE_NORM_QC_NO}, + {0xF965, UNICODE_NORM_QC_NO}, + {0xF966, UNICODE_NORM_QC_NO}, + {0xF967, UNICODE_NORM_QC_NO}, + {0xF968, UNICODE_NORM_QC_NO}, + {0xF969, UNICODE_NORM_QC_NO}, + {0xF96A, UNICODE_NORM_QC_NO}, + {0xF96B, UNICODE_NORM_QC_NO}, + {0xF96C, UNICODE_NORM_QC_NO}, + {0xF96D, UNICODE_NORM_QC_NO}, + {0xF96E, UNICODE_NORM_QC_NO}, + {0xF96F, UNICODE_NORM_QC_NO}, + {0xF970, UNICODE_NORM_QC_NO}, + {0xF971, UNICODE_NORM_QC_NO}, + {0xF972, UNICODE_NORM_QC_NO}, + {0xF973, UNICODE_NORM_QC_NO}, + {0xF974, UNICODE_NORM_QC_NO}, + {0xF975, UNICODE_NORM_QC_NO}, + {0xF976, UNICODE_NORM_QC_NO}, + {0xF977, UNICODE_NORM_QC_NO}, + {0xF978, UNICODE_NORM_QC_NO}, + {0xF979, UNICODE_NORM_QC_NO}, + {0xF97A, UNICODE_NORM_QC_NO}, + {0xF97B, UNICODE_NORM_QC_NO}, + {0xF97C, UNICODE_NORM_QC_NO}, + {0xF97D, UNICODE_NORM_QC_NO}, + {0xF97E, UNICODE_NORM_QC_NO}, + {0xF97F, UNICODE_NORM_QC_NO}, + {0xF980, UNICODE_NORM_QC_NO}, + {0xF981, UNICODE_NORM_QC_NO}, + {0xF982, UNICODE_NORM_QC_NO}, + {0xF983, UNICODE_NORM_QC_NO}, + {0xF984, UNICODE_NORM_QC_NO}, + {0xF985, UNICODE_NORM_QC_NO}, + {0xF986, UNICODE_NORM_QC_NO}, + {0xF987, UNICODE_NORM_QC_NO}, + {0xF988, UNICODE_NORM_QC_NO}, + {0xF989, UNICODE_NORM_QC_NO}, + {0xF98A, UNICODE_NORM_QC_NO}, + {0xF98B, UNICODE_NORM_QC_NO}, + {0xF98C, UNICODE_NORM_QC_NO}, + {0xF98D, UNICODE_NORM_QC_NO}, + {0xF98E, UNICODE_NORM_QC_NO}, + {0xF98F, UNICODE_NORM_QC_NO}, + {0xF990, UNICODE_NORM_QC_NO}, + {0xF991, UNICODE_NORM_QC_NO}, + {0xF992, UNICODE_NORM_QC_NO}, + {0xF993, UNICODE_NORM_QC_NO}, + {0xF994, UNICODE_NORM_QC_NO}, + {0xF995, UNICODE_NORM_QC_NO}, + {0xF996, UNICODE_NORM_QC_NO}, + {0xF997, UNICODE_NORM_QC_NO}, + {0xF998, UNICODE_NORM_QC_NO}, + {0xF999, UNICODE_NORM_QC_NO}, + {0xF99A, UNICODE_NORM_QC_NO}, + {0xF99B, UNICODE_NORM_QC_NO}, + {0xF99C, UNICODE_NORM_QC_NO}, + {0xF99D, UNICODE_NORM_QC_NO}, + {0xF99E, UNICODE_NORM_QC_NO}, + {0xF99F, UNICODE_NORM_QC_NO}, + {0xF9A0, UNICODE_NORM_QC_NO}, + {0xF9A1, UNICODE_NORM_QC_NO}, + {0xF9A2, UNICODE_NORM_QC_NO}, + {0xF9A3, UNICODE_NORM_QC_NO}, + {0xF9A4, UNICODE_NORM_QC_NO}, + {0xF9A5, UNICODE_NORM_QC_NO}, + {0xF9A6, UNICODE_NORM_QC_NO}, + {0xF9A7, UNICODE_NORM_QC_NO}, + {0xF9A8, UNICODE_NORM_QC_NO}, + {0xF9A9, UNICODE_NORM_QC_NO}, + {0xF9AA, UNICODE_NORM_QC_NO}, + {0xF9AB, UNICODE_NORM_QC_NO}, + {0xF9AC, UNICODE_NORM_QC_NO}, + {0xF9AD, UNICODE_NORM_QC_NO}, + {0xF9AE, UNICODE_NORM_QC_NO}, + {0xF9AF, UNICODE_NORM_QC_NO}, + {0xF9B0, UNICODE_NORM_QC_NO}, + {0xF9B1, UNICODE_NORM_QC_NO}, + {0xF9B2, UNICODE_NORM_QC_NO}, + {0xF9B3, UNICODE_NORM_QC_NO}, + {0xF9B4, UNICODE_NORM_QC_NO}, + {0xF9B5, UNICODE_NORM_QC_NO}, + {0xF9B6, UNICODE_NORM_QC_NO}, + {0xF9B7, UNICODE_NORM_QC_NO}, + {0xF9B8, UNICODE_NORM_QC_NO}, + {0xF9B9, UNICODE_NORM_QC_NO}, + {0xF9BA, UNICODE_NORM_QC_NO}, + {0xF9BB, UNICODE_NORM_QC_NO}, + {0xF9BC, UNICODE_NORM_QC_NO}, + {0xF9BD, UNICODE_NORM_QC_NO}, + {0xF9BE, UNICODE_NORM_QC_NO}, + {0xF9BF, UNICODE_NORM_QC_NO}, + {0xF9C0, UNICODE_NORM_QC_NO}, + {0xF9C1, UNICODE_NORM_QC_NO}, + {0xF9C2, UNICODE_NORM_QC_NO}, + {0xF9C3, UNICODE_NORM_QC_NO}, + {0xF9C4, UNICODE_NORM_QC_NO}, + {0xF9C5, UNICODE_NORM_QC_NO}, + {0xF9C6, UNICODE_NORM_QC_NO}, + {0xF9C7, UNICODE_NORM_QC_NO}, + {0xF9C8, UNICODE_NORM_QC_NO}, + {0xF9C9, UNICODE_NORM_QC_NO}, + {0xF9CA, UNICODE_NORM_QC_NO}, + {0xF9CB, UNICODE_NORM_QC_NO}, + {0xF9CC, UNICODE_NORM_QC_NO}, + {0xF9CD, UNICODE_NORM_QC_NO}, + {0xF9CE, UNICODE_NORM_QC_NO}, + {0xF9CF, UNICODE_NORM_QC_NO}, + {0xF9D0, UNICODE_NORM_QC_NO}, + {0xF9D1, UNICODE_NORM_QC_NO}, + {0xF9D2, UNICODE_NORM_QC_NO}, + {0xF9D3, UNICODE_NORM_QC_NO}, + {0xF9D4, UNICODE_NORM_QC_NO}, + {0xF9D5, UNICODE_NORM_QC_NO}, + {0xF9D6, UNICODE_NORM_QC_NO}, + {0xF9D7, UNICODE_NORM_QC_NO}, + {0xF9D8, UNICODE_NORM_QC_NO}, + {0xF9D9, UNICODE_NORM_QC_NO}, + {0xF9DA, UNICODE_NORM_QC_NO}, + {0xF9DB, UNICODE_NORM_QC_NO}, + {0xF9DC, UNICODE_NORM_QC_NO}, + {0xF9DD, UNICODE_NORM_QC_NO}, + {0xF9DE, UNICODE_NORM_QC_NO}, + {0xF9DF, UNICODE_NORM_QC_NO}, + {0xF9E0, UNICODE_NORM_QC_NO}, + {0xF9E1, UNICODE_NORM_QC_NO}, + {0xF9E2, UNICODE_NORM_QC_NO}, + {0xF9E3, UNICODE_NORM_QC_NO}, + {0xF9E4, UNICODE_NORM_QC_NO}, + {0xF9E5, UNICODE_NORM_QC_NO}, + {0xF9E6, UNICODE_NORM_QC_NO}, + {0xF9E7, UNICODE_NORM_QC_NO}, + {0xF9E8, UNICODE_NORM_QC_NO}, + {0xF9E9, UNICODE_NORM_QC_NO}, + {0xF9EA, UNICODE_NORM_QC_NO}, + {0xF9EB, UNICODE_NORM_QC_NO}, + {0xF9EC, UNICODE_NORM_QC_NO}, + {0xF9ED, UNICODE_NORM_QC_NO}, + {0xF9EE, UNICODE_NORM_QC_NO}, + {0xF9EF, UNICODE_NORM_QC_NO}, + {0xF9F0, UNICODE_NORM_QC_NO}, + {0xF9F1, UNICODE_NORM_QC_NO}, + {0xF9F2, UNICODE_NORM_QC_NO}, + {0xF9F3, UNICODE_NORM_QC_NO}, + {0xF9F4, UNICODE_NORM_QC_NO}, + {0xF9F5, UNICODE_NORM_QC_NO}, + {0xF9F6, UNICODE_NORM_QC_NO}, + {0xF9F7, UNICODE_NORM_QC_NO}, + {0xF9F8, UNICODE_NORM_QC_NO}, + {0xF9F9, UNICODE_NORM_QC_NO}, + {0xF9FA, UNICODE_NORM_QC_NO}, + {0xF9FB, UNICODE_NORM_QC_NO}, + {0xF9FC, UNICODE_NORM_QC_NO}, + {0xF9FD, UNICODE_NORM_QC_NO}, + {0xF9FE, UNICODE_NORM_QC_NO}, + {0xF9FF, UNICODE_NORM_QC_NO}, + {0xFA00, UNICODE_NORM_QC_NO}, + {0xFA01, UNICODE_NORM_QC_NO}, + {0xFA02, UNICODE_NORM_QC_NO}, + {0xFA03, UNICODE_NORM_QC_NO}, + {0xFA04, UNICODE_NORM_QC_NO}, + {0xFA05, UNICODE_NORM_QC_NO}, + {0xFA06, UNICODE_NORM_QC_NO}, + {0xFA07, UNICODE_NORM_QC_NO}, + {0xFA08, UNICODE_NORM_QC_NO}, + {0xFA09, UNICODE_NORM_QC_NO}, + {0xFA0A, UNICODE_NORM_QC_NO}, + {0xFA0B, UNICODE_NORM_QC_NO}, + {0xFA0C, UNICODE_NORM_QC_NO}, + {0xFA0D, UNICODE_NORM_QC_NO}, + {0xFA10, UNICODE_NORM_QC_NO}, + {0xFA12, UNICODE_NORM_QC_NO}, + {0xFA15, UNICODE_NORM_QC_NO}, + {0xFA16, UNICODE_NORM_QC_NO}, + {0xFA17, UNICODE_NORM_QC_NO}, + {0xFA18, UNICODE_NORM_QC_NO}, + {0xFA19, UNICODE_NORM_QC_NO}, + {0xFA1A, UNICODE_NORM_QC_NO}, + {0xFA1B, UNICODE_NORM_QC_NO}, + {0xFA1C, UNICODE_NORM_QC_NO}, + {0xFA1D, UNICODE_NORM_QC_NO}, + {0xFA1E, UNICODE_NORM_QC_NO}, + {0xFA20, UNICODE_NORM_QC_NO}, + {0xFA22, UNICODE_NORM_QC_NO}, + {0xFA25, UNICODE_NORM_QC_NO}, + {0xFA26, UNICODE_NORM_QC_NO}, + {0xFA2A, UNICODE_NORM_QC_NO}, + {0xFA2B, UNICODE_NORM_QC_NO}, + {0xFA2C, UNICODE_NORM_QC_NO}, + {0xFA2D, UNICODE_NORM_QC_NO}, + {0xFA2E, UNICODE_NORM_QC_NO}, + {0xFA2F, UNICODE_NORM_QC_NO}, + {0xFA30, UNICODE_NORM_QC_NO}, + {0xFA31, UNICODE_NORM_QC_NO}, + {0xFA32, UNICODE_NORM_QC_NO}, + {0xFA33, UNICODE_NORM_QC_NO}, + {0xFA34, UNICODE_NORM_QC_NO}, + {0xFA35, UNICODE_NORM_QC_NO}, + {0xFA36, UNICODE_NORM_QC_NO}, + {0xFA37, UNICODE_NORM_QC_NO}, + {0xFA38, UNICODE_NORM_QC_NO}, + {0xFA39, UNICODE_NORM_QC_NO}, + {0xFA3A, UNICODE_NORM_QC_NO}, + {0xFA3B, UNICODE_NORM_QC_NO}, + {0xFA3C, UNICODE_NORM_QC_NO}, + {0xFA3D, UNICODE_NORM_QC_NO}, + {0xFA3E, UNICODE_NORM_QC_NO}, + {0xFA3F, UNICODE_NORM_QC_NO}, + {0xFA40, UNICODE_NORM_QC_NO}, + {0xFA41, UNICODE_NORM_QC_NO}, + {0xFA42, UNICODE_NORM_QC_NO}, + {0xFA43, UNICODE_NORM_QC_NO}, + {0xFA44, UNICODE_NORM_QC_NO}, + {0xFA45, UNICODE_NORM_QC_NO}, + {0xFA46, UNICODE_NORM_QC_NO}, + {0xFA47, UNICODE_NORM_QC_NO}, + {0xFA48, UNICODE_NORM_QC_NO}, + {0xFA49, UNICODE_NORM_QC_NO}, + {0xFA4A, UNICODE_NORM_QC_NO}, + {0xFA4B, UNICODE_NORM_QC_NO}, + {0xFA4C, UNICODE_NORM_QC_NO}, + {0xFA4D, UNICODE_NORM_QC_NO}, + {0xFA4E, UNICODE_NORM_QC_NO}, + {0xFA4F, UNICODE_NORM_QC_NO}, + {0xFA50, UNICODE_NORM_QC_NO}, + {0xFA51, UNICODE_NORM_QC_NO}, + {0xFA52, UNICODE_NORM_QC_NO}, + {0xFA53, UNICODE_NORM_QC_NO}, + {0xFA54, UNICODE_NORM_QC_NO}, + {0xFA55, UNICODE_NORM_QC_NO}, + {0xFA56, UNICODE_NORM_QC_NO}, + {0xFA57, UNICODE_NORM_QC_NO}, + {0xFA58, UNICODE_NORM_QC_NO}, + {0xFA59, UNICODE_NORM_QC_NO}, + {0xFA5A, UNICODE_NORM_QC_NO}, + {0xFA5B, UNICODE_NORM_QC_NO}, + {0xFA5C, UNICODE_NORM_QC_NO}, + {0xFA5D, UNICODE_NORM_QC_NO}, + {0xFA5E, UNICODE_NORM_QC_NO}, + {0xFA5F, UNICODE_NORM_QC_NO}, + {0xFA60, UNICODE_NORM_QC_NO}, + {0xFA61, UNICODE_NORM_QC_NO}, + {0xFA62, UNICODE_NORM_QC_NO}, + {0xFA63, UNICODE_NORM_QC_NO}, + {0xFA64, UNICODE_NORM_QC_NO}, + {0xFA65, UNICODE_NORM_QC_NO}, + {0xFA66, UNICODE_NORM_QC_NO}, + {0xFA67, UNICODE_NORM_QC_NO}, + {0xFA68, UNICODE_NORM_QC_NO}, + {0xFA69, UNICODE_NORM_QC_NO}, + {0xFA6A, UNICODE_NORM_QC_NO}, + {0xFA6B, UNICODE_NORM_QC_NO}, + {0xFA6C, UNICODE_NORM_QC_NO}, + {0xFA6D, UNICODE_NORM_QC_NO}, + {0xFA70, UNICODE_NORM_QC_NO}, + {0xFA71, UNICODE_NORM_QC_NO}, + {0xFA72, UNICODE_NORM_QC_NO}, + {0xFA73, UNICODE_NORM_QC_NO}, + {0xFA74, UNICODE_NORM_QC_NO}, + {0xFA75, UNICODE_NORM_QC_NO}, + {0xFA76, UNICODE_NORM_QC_NO}, + {0xFA77, UNICODE_NORM_QC_NO}, + {0xFA78, UNICODE_NORM_QC_NO}, + {0xFA79, UNICODE_NORM_QC_NO}, + {0xFA7A, UNICODE_NORM_QC_NO}, + {0xFA7B, UNICODE_NORM_QC_NO}, + {0xFA7C, UNICODE_NORM_QC_NO}, + {0xFA7D, UNICODE_NORM_QC_NO}, + {0xFA7E, UNICODE_NORM_QC_NO}, + {0xFA7F, UNICODE_NORM_QC_NO}, + {0xFA80, UNICODE_NORM_QC_NO}, + {0xFA81, UNICODE_NORM_QC_NO}, + {0xFA82, UNICODE_NORM_QC_NO}, + {0xFA83, UNICODE_NORM_QC_NO}, + {0xFA84, UNICODE_NORM_QC_NO}, + {0xFA85, UNICODE_NORM_QC_NO}, + {0xFA86, UNICODE_NORM_QC_NO}, + {0xFA87, UNICODE_NORM_QC_NO}, + {0xFA88, UNICODE_NORM_QC_NO}, + {0xFA89, UNICODE_NORM_QC_NO}, + {0xFA8A, UNICODE_NORM_QC_NO}, + {0xFA8B, UNICODE_NORM_QC_NO}, + {0xFA8C, UNICODE_NORM_QC_NO}, + {0xFA8D, UNICODE_NORM_QC_NO}, + {0xFA8E, UNICODE_NORM_QC_NO}, + {0xFA8F, UNICODE_NORM_QC_NO}, + {0xFA90, UNICODE_NORM_QC_NO}, + {0xFA91, UNICODE_NORM_QC_NO}, + {0xFA92, UNICODE_NORM_QC_NO}, + {0xFA93, UNICODE_NORM_QC_NO}, + {0xFA94, UNICODE_NORM_QC_NO}, + {0xFA95, UNICODE_NORM_QC_NO}, + {0xFA96, UNICODE_NORM_QC_NO}, + {0xFA97, UNICODE_NORM_QC_NO}, + {0xFA98, UNICODE_NORM_QC_NO}, + {0xFA99, UNICODE_NORM_QC_NO}, + {0xFA9A, UNICODE_NORM_QC_NO}, + {0xFA9B, UNICODE_NORM_QC_NO}, + {0xFA9C, UNICODE_NORM_QC_NO}, + {0xFA9D, UNICODE_NORM_QC_NO}, + {0xFA9E, UNICODE_NORM_QC_NO}, + {0xFA9F, UNICODE_NORM_QC_NO}, + {0xFAA0, UNICODE_NORM_QC_NO}, + {0xFAA1, UNICODE_NORM_QC_NO}, + {0xFAA2, UNICODE_NORM_QC_NO}, + {0xFAA3, UNICODE_NORM_QC_NO}, + {0xFAA4, UNICODE_NORM_QC_NO}, + {0xFAA5, UNICODE_NORM_QC_NO}, + {0xFAA6, UNICODE_NORM_QC_NO}, + {0xFAA7, UNICODE_NORM_QC_NO}, + {0xFAA8, UNICODE_NORM_QC_NO}, + {0xFAA9, UNICODE_NORM_QC_NO}, + {0xFAAA, UNICODE_NORM_QC_NO}, + {0xFAAB, UNICODE_NORM_QC_NO}, + {0xFAAC, UNICODE_NORM_QC_NO}, + {0xFAAD, UNICODE_NORM_QC_NO}, + {0xFAAE, UNICODE_NORM_QC_NO}, + {0xFAAF, UNICODE_NORM_QC_NO}, + {0xFAB0, UNICODE_NORM_QC_NO}, + {0xFAB1, UNICODE_NORM_QC_NO}, + {0xFAB2, UNICODE_NORM_QC_NO}, + {0xFAB3, UNICODE_NORM_QC_NO}, + {0xFAB4, UNICODE_NORM_QC_NO}, + {0xFAB5, UNICODE_NORM_QC_NO}, + {0xFAB6, UNICODE_NORM_QC_NO}, + {0xFAB7, UNICODE_NORM_QC_NO}, + {0xFAB8, UNICODE_NORM_QC_NO}, + {0xFAB9, UNICODE_NORM_QC_NO}, + {0xFABA, UNICODE_NORM_QC_NO}, + {0xFABB, UNICODE_NORM_QC_NO}, + {0xFABC, UNICODE_NORM_QC_NO}, + {0xFABD, UNICODE_NORM_QC_NO}, + {0xFABE, UNICODE_NORM_QC_NO}, + {0xFABF, UNICODE_NORM_QC_NO}, + {0xFAC0, UNICODE_NORM_QC_NO}, + {0xFAC1, UNICODE_NORM_QC_NO}, + {0xFAC2, UNICODE_NORM_QC_NO}, + {0xFAC3, UNICODE_NORM_QC_NO}, + {0xFAC4, UNICODE_NORM_QC_NO}, + {0xFAC5, UNICODE_NORM_QC_NO}, + {0xFAC6, UNICODE_NORM_QC_NO}, + {0xFAC7, UNICODE_NORM_QC_NO}, + {0xFAC8, UNICODE_NORM_QC_NO}, + {0xFAC9, UNICODE_NORM_QC_NO}, + {0xFACA, UNICODE_NORM_QC_NO}, + {0xFACB, UNICODE_NORM_QC_NO}, + {0xFACC, UNICODE_NORM_QC_NO}, + {0xFACD, UNICODE_NORM_QC_NO}, + {0xFACE, UNICODE_NORM_QC_NO}, + {0xFACF, UNICODE_NORM_QC_NO}, + {0xFAD0, UNICODE_NORM_QC_NO}, + {0xFAD1, UNICODE_NORM_QC_NO}, + {0xFAD2, UNICODE_NORM_QC_NO}, + {0xFAD3, UNICODE_NORM_QC_NO}, + {0xFAD4, UNICODE_NORM_QC_NO}, + {0xFAD5, UNICODE_NORM_QC_NO}, + {0xFAD6, UNICODE_NORM_QC_NO}, + {0xFAD7, UNICODE_NORM_QC_NO}, + {0xFAD8, UNICODE_NORM_QC_NO}, + {0xFAD9, UNICODE_NORM_QC_NO}, + {0xFB00, UNICODE_NORM_QC_NO}, + {0xFB01, UNICODE_NORM_QC_NO}, + {0xFB02, UNICODE_NORM_QC_NO}, + {0xFB03, UNICODE_NORM_QC_NO}, + {0xFB04, UNICODE_NORM_QC_NO}, + {0xFB05, UNICODE_NORM_QC_NO}, + {0xFB06, UNICODE_NORM_QC_NO}, + {0xFB13, UNICODE_NORM_QC_NO}, + {0xFB14, UNICODE_NORM_QC_NO}, + {0xFB15, UNICODE_NORM_QC_NO}, + {0xFB16, UNICODE_NORM_QC_NO}, + {0xFB17, UNICODE_NORM_QC_NO}, + {0xFB1D, UNICODE_NORM_QC_NO}, + {0xFB1F, UNICODE_NORM_QC_NO}, + {0xFB20, UNICODE_NORM_QC_NO}, + {0xFB21, UNICODE_NORM_QC_NO}, + {0xFB22, UNICODE_NORM_QC_NO}, + {0xFB23, UNICODE_NORM_QC_NO}, + {0xFB24, UNICODE_NORM_QC_NO}, + {0xFB25, UNICODE_NORM_QC_NO}, + {0xFB26, UNICODE_NORM_QC_NO}, + {0xFB27, UNICODE_NORM_QC_NO}, + {0xFB28, UNICODE_NORM_QC_NO}, + {0xFB29, UNICODE_NORM_QC_NO}, + {0xFB2A, UNICODE_NORM_QC_NO}, + {0xFB2B, UNICODE_NORM_QC_NO}, + {0xFB2C, UNICODE_NORM_QC_NO}, + {0xFB2D, UNICODE_NORM_QC_NO}, + {0xFB2E, UNICODE_NORM_QC_NO}, + {0xFB2F, UNICODE_NORM_QC_NO}, + {0xFB30, UNICODE_NORM_QC_NO}, + {0xFB31, UNICODE_NORM_QC_NO}, + {0xFB32, UNICODE_NORM_QC_NO}, + {0xFB33, UNICODE_NORM_QC_NO}, + {0xFB34, UNICODE_NORM_QC_NO}, + {0xFB35, UNICODE_NORM_QC_NO}, + {0xFB36, UNICODE_NORM_QC_NO}, + {0xFB38, UNICODE_NORM_QC_NO}, + {0xFB39, UNICODE_NORM_QC_NO}, + {0xFB3A, UNICODE_NORM_QC_NO}, + {0xFB3B, UNICODE_NORM_QC_NO}, + {0xFB3C, UNICODE_NORM_QC_NO}, + {0xFB3E, UNICODE_NORM_QC_NO}, + {0xFB40, UNICODE_NORM_QC_NO}, + {0xFB41, UNICODE_NORM_QC_NO}, + {0xFB43, UNICODE_NORM_QC_NO}, + {0xFB44, UNICODE_NORM_QC_NO}, + {0xFB46, UNICODE_NORM_QC_NO}, + {0xFB47, UNICODE_NORM_QC_NO}, + {0xFB48, UNICODE_NORM_QC_NO}, + {0xFB49, UNICODE_NORM_QC_NO}, + {0xFB4A, UNICODE_NORM_QC_NO}, + {0xFB4B, UNICODE_NORM_QC_NO}, + {0xFB4C, UNICODE_NORM_QC_NO}, + {0xFB4D, UNICODE_NORM_QC_NO}, + {0xFB4E, UNICODE_NORM_QC_NO}, + {0xFB4F, UNICODE_NORM_QC_NO}, + {0xFB50, UNICODE_NORM_QC_NO}, + {0xFB51, UNICODE_NORM_QC_NO}, + {0xFB52, UNICODE_NORM_QC_NO}, + {0xFB53, UNICODE_NORM_QC_NO}, + {0xFB54, UNICODE_NORM_QC_NO}, + {0xFB55, UNICODE_NORM_QC_NO}, + {0xFB56, UNICODE_NORM_QC_NO}, + {0xFB57, UNICODE_NORM_QC_NO}, + {0xFB58, UNICODE_NORM_QC_NO}, + {0xFB59, UNICODE_NORM_QC_NO}, + {0xFB5A, UNICODE_NORM_QC_NO}, + {0xFB5B, UNICODE_NORM_QC_NO}, + {0xFB5C, UNICODE_NORM_QC_NO}, + {0xFB5D, UNICODE_NORM_QC_NO}, + {0xFB5E, UNICODE_NORM_QC_NO}, + {0xFB5F, UNICODE_NORM_QC_NO}, + {0xFB60, UNICODE_NORM_QC_NO}, + {0xFB61, UNICODE_NORM_QC_NO}, + {0xFB62, UNICODE_NORM_QC_NO}, + {0xFB63, UNICODE_NORM_QC_NO}, + {0xFB64, UNICODE_NORM_QC_NO}, + {0xFB65, UNICODE_NORM_QC_NO}, + {0xFB66, UNICODE_NORM_QC_NO}, + {0xFB67, UNICODE_NORM_QC_NO}, + {0xFB68, UNICODE_NORM_QC_NO}, + {0xFB69, UNICODE_NORM_QC_NO}, + {0xFB6A, UNICODE_NORM_QC_NO}, + {0xFB6B, UNICODE_NORM_QC_NO}, + {0xFB6C, UNICODE_NORM_QC_NO}, + {0xFB6D, UNICODE_NORM_QC_NO}, + {0xFB6E, UNICODE_NORM_QC_NO}, + {0xFB6F, UNICODE_NORM_QC_NO}, + {0xFB70, UNICODE_NORM_QC_NO}, + {0xFB71, UNICODE_NORM_QC_NO}, + {0xFB72, UNICODE_NORM_QC_NO}, + {0xFB73, UNICODE_NORM_QC_NO}, + {0xFB74, UNICODE_NORM_QC_NO}, + {0xFB75, UNICODE_NORM_QC_NO}, + {0xFB76, UNICODE_NORM_QC_NO}, + {0xFB77, UNICODE_NORM_QC_NO}, + {0xFB78, UNICODE_NORM_QC_NO}, + {0xFB79, UNICODE_NORM_QC_NO}, + {0xFB7A, UNICODE_NORM_QC_NO}, + {0xFB7B, UNICODE_NORM_QC_NO}, + {0xFB7C, UNICODE_NORM_QC_NO}, + {0xFB7D, UNICODE_NORM_QC_NO}, + {0xFB7E, UNICODE_NORM_QC_NO}, + {0xFB7F, UNICODE_NORM_QC_NO}, + {0xFB80, UNICODE_NORM_QC_NO}, + {0xFB81, UNICODE_NORM_QC_NO}, + {0xFB82, UNICODE_NORM_QC_NO}, + {0xFB83, UNICODE_NORM_QC_NO}, + {0xFB84, UNICODE_NORM_QC_NO}, + {0xFB85, UNICODE_NORM_QC_NO}, + {0xFB86, UNICODE_NORM_QC_NO}, + {0xFB87, UNICODE_NORM_QC_NO}, + {0xFB88, UNICODE_NORM_QC_NO}, + {0xFB89, UNICODE_NORM_QC_NO}, + {0xFB8A, UNICODE_NORM_QC_NO}, + {0xFB8B, UNICODE_NORM_QC_NO}, + {0xFB8C, UNICODE_NORM_QC_NO}, + {0xFB8D, UNICODE_NORM_QC_NO}, + {0xFB8E, UNICODE_NORM_QC_NO}, + {0xFB8F, UNICODE_NORM_QC_NO}, + {0xFB90, UNICODE_NORM_QC_NO}, + {0xFB91, UNICODE_NORM_QC_NO}, + {0xFB92, UNICODE_NORM_QC_NO}, + {0xFB93, UNICODE_NORM_QC_NO}, + {0xFB94, UNICODE_NORM_QC_NO}, + {0xFB95, UNICODE_NORM_QC_NO}, + {0xFB96, UNICODE_NORM_QC_NO}, + {0xFB97, UNICODE_NORM_QC_NO}, + {0xFB98, UNICODE_NORM_QC_NO}, + {0xFB99, UNICODE_NORM_QC_NO}, + {0xFB9A, UNICODE_NORM_QC_NO}, + {0xFB9B, UNICODE_NORM_QC_NO}, + {0xFB9C, UNICODE_NORM_QC_NO}, + {0xFB9D, UNICODE_NORM_QC_NO}, + {0xFB9E, UNICODE_NORM_QC_NO}, + {0xFB9F, UNICODE_NORM_QC_NO}, + {0xFBA0, UNICODE_NORM_QC_NO}, + {0xFBA1, UNICODE_NORM_QC_NO}, + {0xFBA2, UNICODE_NORM_QC_NO}, + {0xFBA3, UNICODE_NORM_QC_NO}, + {0xFBA4, UNICODE_NORM_QC_NO}, + {0xFBA5, UNICODE_NORM_QC_NO}, + {0xFBA6, UNICODE_NORM_QC_NO}, + {0xFBA7, UNICODE_NORM_QC_NO}, + {0xFBA8, UNICODE_NORM_QC_NO}, + {0xFBA9, UNICODE_NORM_QC_NO}, + {0xFBAA, UNICODE_NORM_QC_NO}, + {0xFBAB, UNICODE_NORM_QC_NO}, + {0xFBAC, UNICODE_NORM_QC_NO}, + {0xFBAD, UNICODE_NORM_QC_NO}, + {0xFBAE, UNICODE_NORM_QC_NO}, + {0xFBAF, UNICODE_NORM_QC_NO}, + {0xFBB0, UNICODE_NORM_QC_NO}, + {0xFBB1, UNICODE_NORM_QC_NO}, + {0xFBD3, UNICODE_NORM_QC_NO}, + {0xFBD4, UNICODE_NORM_QC_NO}, + {0xFBD5, UNICODE_NORM_QC_NO}, + {0xFBD6, UNICODE_NORM_QC_NO}, + {0xFBD7, UNICODE_NORM_QC_NO}, + {0xFBD8, UNICODE_NORM_QC_NO}, + {0xFBD9, UNICODE_NORM_QC_NO}, + {0xFBDA, UNICODE_NORM_QC_NO}, + {0xFBDB, UNICODE_NORM_QC_NO}, + {0xFBDC, UNICODE_NORM_QC_NO}, + {0xFBDD, UNICODE_NORM_QC_NO}, + {0xFBDE, UNICODE_NORM_QC_NO}, + {0xFBDF, UNICODE_NORM_QC_NO}, + {0xFBE0, UNICODE_NORM_QC_NO}, + {0xFBE1, UNICODE_NORM_QC_NO}, + {0xFBE2, UNICODE_NORM_QC_NO}, + {0xFBE3, UNICODE_NORM_QC_NO}, + {0xFBE4, UNICODE_NORM_QC_NO}, + {0xFBE5, UNICODE_NORM_QC_NO}, + {0xFBE6, UNICODE_NORM_QC_NO}, + {0xFBE7, UNICODE_NORM_QC_NO}, + {0xFBE8, UNICODE_NORM_QC_NO}, + {0xFBE9, UNICODE_NORM_QC_NO}, + {0xFBEA, UNICODE_NORM_QC_NO}, + {0xFBEB, UNICODE_NORM_QC_NO}, + {0xFBEC, UNICODE_NORM_QC_NO}, + {0xFBED, UNICODE_NORM_QC_NO}, + {0xFBEE, UNICODE_NORM_QC_NO}, + {0xFBEF, UNICODE_NORM_QC_NO}, + {0xFBF0, UNICODE_NORM_QC_NO}, + {0xFBF1, UNICODE_NORM_QC_NO}, + {0xFBF2, UNICODE_NORM_QC_NO}, + {0xFBF3, UNICODE_NORM_QC_NO}, + {0xFBF4, UNICODE_NORM_QC_NO}, + {0xFBF5, UNICODE_NORM_QC_NO}, + {0xFBF6, UNICODE_NORM_QC_NO}, + {0xFBF7, UNICODE_NORM_QC_NO}, + {0xFBF8, UNICODE_NORM_QC_NO}, + {0xFBF9, UNICODE_NORM_QC_NO}, + {0xFBFA, UNICODE_NORM_QC_NO}, + {0xFBFB, UNICODE_NORM_QC_NO}, + {0xFBFC, UNICODE_NORM_QC_NO}, + {0xFBFD, UNICODE_NORM_QC_NO}, + {0xFBFE, UNICODE_NORM_QC_NO}, + {0xFBFF, UNICODE_NORM_QC_NO}, + {0xFC00, UNICODE_NORM_QC_NO}, + {0xFC01, UNICODE_NORM_QC_NO}, + {0xFC02, UNICODE_NORM_QC_NO}, + {0xFC03, UNICODE_NORM_QC_NO}, + {0xFC04, UNICODE_NORM_QC_NO}, + {0xFC05, UNICODE_NORM_QC_NO}, + {0xFC06, UNICODE_NORM_QC_NO}, + {0xFC07, UNICODE_NORM_QC_NO}, + {0xFC08, UNICODE_NORM_QC_NO}, + {0xFC09, UNICODE_NORM_QC_NO}, + {0xFC0A, UNICODE_NORM_QC_NO}, + {0xFC0B, UNICODE_NORM_QC_NO}, + {0xFC0C, UNICODE_NORM_QC_NO}, + {0xFC0D, UNICODE_NORM_QC_NO}, + {0xFC0E, UNICODE_NORM_QC_NO}, + {0xFC0F, UNICODE_NORM_QC_NO}, + {0xFC10, UNICODE_NORM_QC_NO}, + {0xFC11, UNICODE_NORM_QC_NO}, + {0xFC12, UNICODE_NORM_QC_NO}, + {0xFC13, UNICODE_NORM_QC_NO}, + {0xFC14, UNICODE_NORM_QC_NO}, + {0xFC15, UNICODE_NORM_QC_NO}, + {0xFC16, UNICODE_NORM_QC_NO}, + {0xFC17, UNICODE_NORM_QC_NO}, + {0xFC18, UNICODE_NORM_QC_NO}, + {0xFC19, UNICODE_NORM_QC_NO}, + {0xFC1A, UNICODE_NORM_QC_NO}, + {0xFC1B, UNICODE_NORM_QC_NO}, + {0xFC1C, UNICODE_NORM_QC_NO}, + {0xFC1D, UNICODE_NORM_QC_NO}, + {0xFC1E, UNICODE_NORM_QC_NO}, + {0xFC1F, UNICODE_NORM_QC_NO}, + {0xFC20, UNICODE_NORM_QC_NO}, + {0xFC21, UNICODE_NORM_QC_NO}, + {0xFC22, UNICODE_NORM_QC_NO}, + {0xFC23, UNICODE_NORM_QC_NO}, + {0xFC24, UNICODE_NORM_QC_NO}, + {0xFC25, UNICODE_NORM_QC_NO}, + {0xFC26, UNICODE_NORM_QC_NO}, + {0xFC27, UNICODE_NORM_QC_NO}, + {0xFC28, UNICODE_NORM_QC_NO}, + {0xFC29, UNICODE_NORM_QC_NO}, + {0xFC2A, UNICODE_NORM_QC_NO}, + {0xFC2B, UNICODE_NORM_QC_NO}, + {0xFC2C, UNICODE_NORM_QC_NO}, + {0xFC2D, UNICODE_NORM_QC_NO}, + {0xFC2E, UNICODE_NORM_QC_NO}, + {0xFC2F, UNICODE_NORM_QC_NO}, + {0xFC30, UNICODE_NORM_QC_NO}, + {0xFC31, UNICODE_NORM_QC_NO}, + {0xFC32, UNICODE_NORM_QC_NO}, + {0xFC33, UNICODE_NORM_QC_NO}, + {0xFC34, UNICODE_NORM_QC_NO}, + {0xFC35, UNICODE_NORM_QC_NO}, + {0xFC36, UNICODE_NORM_QC_NO}, + {0xFC37, UNICODE_NORM_QC_NO}, + {0xFC38, UNICODE_NORM_QC_NO}, + {0xFC39, UNICODE_NORM_QC_NO}, + {0xFC3A, UNICODE_NORM_QC_NO}, + {0xFC3B, UNICODE_NORM_QC_NO}, + {0xFC3C, UNICODE_NORM_QC_NO}, + {0xFC3D, UNICODE_NORM_QC_NO}, + {0xFC3E, UNICODE_NORM_QC_NO}, + {0xFC3F, UNICODE_NORM_QC_NO}, + {0xFC40, UNICODE_NORM_QC_NO}, + {0xFC41, UNICODE_NORM_QC_NO}, + {0xFC42, UNICODE_NORM_QC_NO}, + {0xFC43, UNICODE_NORM_QC_NO}, + {0xFC44, UNICODE_NORM_QC_NO}, + {0xFC45, UNICODE_NORM_QC_NO}, + {0xFC46, UNICODE_NORM_QC_NO}, + {0xFC47, UNICODE_NORM_QC_NO}, + {0xFC48, UNICODE_NORM_QC_NO}, + {0xFC49, UNICODE_NORM_QC_NO}, + {0xFC4A, UNICODE_NORM_QC_NO}, + {0xFC4B, UNICODE_NORM_QC_NO}, + {0xFC4C, UNICODE_NORM_QC_NO}, + {0xFC4D, UNICODE_NORM_QC_NO}, + {0xFC4E, UNICODE_NORM_QC_NO}, + {0xFC4F, UNICODE_NORM_QC_NO}, + {0xFC50, UNICODE_NORM_QC_NO}, + {0xFC51, UNICODE_NORM_QC_NO}, + {0xFC52, UNICODE_NORM_QC_NO}, + {0xFC53, UNICODE_NORM_QC_NO}, + {0xFC54, UNICODE_NORM_QC_NO}, + {0xFC55, UNICODE_NORM_QC_NO}, + {0xFC56, UNICODE_NORM_QC_NO}, + {0xFC57, UNICODE_NORM_QC_NO}, + {0xFC58, UNICODE_NORM_QC_NO}, + {0xFC59, UNICODE_NORM_QC_NO}, + {0xFC5A, UNICODE_NORM_QC_NO}, + {0xFC5B, UNICODE_NORM_QC_NO}, + {0xFC5C, UNICODE_NORM_QC_NO}, + {0xFC5D, UNICODE_NORM_QC_NO}, + {0xFC5E, UNICODE_NORM_QC_NO}, + {0xFC5F, UNICODE_NORM_QC_NO}, + {0xFC60, UNICODE_NORM_QC_NO}, + {0xFC61, UNICODE_NORM_QC_NO}, + {0xFC62, UNICODE_NORM_QC_NO}, + {0xFC63, UNICODE_NORM_QC_NO}, + {0xFC64, UNICODE_NORM_QC_NO}, + {0xFC65, UNICODE_NORM_QC_NO}, + {0xFC66, UNICODE_NORM_QC_NO}, + {0xFC67, UNICODE_NORM_QC_NO}, + {0xFC68, UNICODE_NORM_QC_NO}, + {0xFC69, UNICODE_NORM_QC_NO}, + {0xFC6A, UNICODE_NORM_QC_NO}, + {0xFC6B, UNICODE_NORM_QC_NO}, + {0xFC6C, UNICODE_NORM_QC_NO}, + {0xFC6D, UNICODE_NORM_QC_NO}, + {0xFC6E, UNICODE_NORM_QC_NO}, + {0xFC6F, UNICODE_NORM_QC_NO}, + {0xFC70, UNICODE_NORM_QC_NO}, + {0xFC71, UNICODE_NORM_QC_NO}, + {0xFC72, UNICODE_NORM_QC_NO}, + {0xFC73, UNICODE_NORM_QC_NO}, + {0xFC74, UNICODE_NORM_QC_NO}, + {0xFC75, UNICODE_NORM_QC_NO}, + {0xFC76, UNICODE_NORM_QC_NO}, + {0xFC77, UNICODE_NORM_QC_NO}, + {0xFC78, UNICODE_NORM_QC_NO}, + {0xFC79, UNICODE_NORM_QC_NO}, + {0xFC7A, UNICODE_NORM_QC_NO}, + {0xFC7B, UNICODE_NORM_QC_NO}, + {0xFC7C, UNICODE_NORM_QC_NO}, + {0xFC7D, UNICODE_NORM_QC_NO}, + {0xFC7E, UNICODE_NORM_QC_NO}, + {0xFC7F, UNICODE_NORM_QC_NO}, + {0xFC80, UNICODE_NORM_QC_NO}, + {0xFC81, UNICODE_NORM_QC_NO}, + {0xFC82, UNICODE_NORM_QC_NO}, + {0xFC83, UNICODE_NORM_QC_NO}, + {0xFC84, UNICODE_NORM_QC_NO}, + {0xFC85, UNICODE_NORM_QC_NO}, + {0xFC86, UNICODE_NORM_QC_NO}, + {0xFC87, UNICODE_NORM_QC_NO}, + {0xFC88, UNICODE_NORM_QC_NO}, + {0xFC89, UNICODE_NORM_QC_NO}, + {0xFC8A, UNICODE_NORM_QC_NO}, + {0xFC8B, UNICODE_NORM_QC_NO}, + {0xFC8C, UNICODE_NORM_QC_NO}, + {0xFC8D, UNICODE_NORM_QC_NO}, + {0xFC8E, UNICODE_NORM_QC_NO}, + {0xFC8F, UNICODE_NORM_QC_NO}, + {0xFC90, UNICODE_NORM_QC_NO}, + {0xFC91, UNICODE_NORM_QC_NO}, + {0xFC92, UNICODE_NORM_QC_NO}, + {0xFC93, UNICODE_NORM_QC_NO}, + {0xFC94, UNICODE_NORM_QC_NO}, + {0xFC95, UNICODE_NORM_QC_NO}, + {0xFC96, UNICODE_NORM_QC_NO}, + {0xFC97, UNICODE_NORM_QC_NO}, + {0xFC98, UNICODE_NORM_QC_NO}, + {0xFC99, UNICODE_NORM_QC_NO}, + {0xFC9A, UNICODE_NORM_QC_NO}, + {0xFC9B, UNICODE_NORM_QC_NO}, + {0xFC9C, UNICODE_NORM_QC_NO}, + {0xFC9D, UNICODE_NORM_QC_NO}, + {0xFC9E, UNICODE_NORM_QC_NO}, + {0xFC9F, UNICODE_NORM_QC_NO}, + {0xFCA0, UNICODE_NORM_QC_NO}, + {0xFCA1, UNICODE_NORM_QC_NO}, + {0xFCA2, UNICODE_NORM_QC_NO}, + {0xFCA3, UNICODE_NORM_QC_NO}, + {0xFCA4, UNICODE_NORM_QC_NO}, + {0xFCA5, UNICODE_NORM_QC_NO}, + {0xFCA6, UNICODE_NORM_QC_NO}, + {0xFCA7, UNICODE_NORM_QC_NO}, + {0xFCA8, UNICODE_NORM_QC_NO}, + {0xFCA9, UNICODE_NORM_QC_NO}, + {0xFCAA, UNICODE_NORM_QC_NO}, + {0xFCAB, UNICODE_NORM_QC_NO}, + {0xFCAC, UNICODE_NORM_QC_NO}, + {0xFCAD, UNICODE_NORM_QC_NO}, + {0xFCAE, UNICODE_NORM_QC_NO}, + {0xFCAF, UNICODE_NORM_QC_NO}, + {0xFCB0, UNICODE_NORM_QC_NO}, + {0xFCB1, UNICODE_NORM_QC_NO}, + {0xFCB2, UNICODE_NORM_QC_NO}, + {0xFCB3, UNICODE_NORM_QC_NO}, + {0xFCB4, UNICODE_NORM_QC_NO}, + {0xFCB5, UNICODE_NORM_QC_NO}, + {0xFCB6, UNICODE_NORM_QC_NO}, + {0xFCB7, UNICODE_NORM_QC_NO}, + {0xFCB8, UNICODE_NORM_QC_NO}, + {0xFCB9, UNICODE_NORM_QC_NO}, + {0xFCBA, UNICODE_NORM_QC_NO}, + {0xFCBB, UNICODE_NORM_QC_NO}, + {0xFCBC, UNICODE_NORM_QC_NO}, + {0xFCBD, UNICODE_NORM_QC_NO}, + {0xFCBE, UNICODE_NORM_QC_NO}, + {0xFCBF, UNICODE_NORM_QC_NO}, + {0xFCC0, UNICODE_NORM_QC_NO}, + {0xFCC1, UNICODE_NORM_QC_NO}, + {0xFCC2, UNICODE_NORM_QC_NO}, + {0xFCC3, UNICODE_NORM_QC_NO}, + {0xFCC4, UNICODE_NORM_QC_NO}, + {0xFCC5, UNICODE_NORM_QC_NO}, + {0xFCC6, UNICODE_NORM_QC_NO}, + {0xFCC7, UNICODE_NORM_QC_NO}, + {0xFCC8, UNICODE_NORM_QC_NO}, + {0xFCC9, UNICODE_NORM_QC_NO}, + {0xFCCA, UNICODE_NORM_QC_NO}, + {0xFCCB, UNICODE_NORM_QC_NO}, + {0xFCCC, UNICODE_NORM_QC_NO}, + {0xFCCD, UNICODE_NORM_QC_NO}, + {0xFCCE, UNICODE_NORM_QC_NO}, + {0xFCCF, UNICODE_NORM_QC_NO}, + {0xFCD0, UNICODE_NORM_QC_NO}, + {0xFCD1, UNICODE_NORM_QC_NO}, + {0xFCD2, UNICODE_NORM_QC_NO}, + {0xFCD3, UNICODE_NORM_QC_NO}, + {0xFCD4, UNICODE_NORM_QC_NO}, + {0xFCD5, UNICODE_NORM_QC_NO}, + {0xFCD6, UNICODE_NORM_QC_NO}, + {0xFCD7, UNICODE_NORM_QC_NO}, + {0xFCD8, UNICODE_NORM_QC_NO}, + {0xFCD9, UNICODE_NORM_QC_NO}, + {0xFCDA, UNICODE_NORM_QC_NO}, + {0xFCDB, UNICODE_NORM_QC_NO}, + {0xFCDC, UNICODE_NORM_QC_NO}, + {0xFCDD, UNICODE_NORM_QC_NO}, + {0xFCDE, UNICODE_NORM_QC_NO}, + {0xFCDF, UNICODE_NORM_QC_NO}, + {0xFCE0, UNICODE_NORM_QC_NO}, + {0xFCE1, UNICODE_NORM_QC_NO}, + {0xFCE2, UNICODE_NORM_QC_NO}, + {0xFCE3, UNICODE_NORM_QC_NO}, + {0xFCE4, UNICODE_NORM_QC_NO}, + {0xFCE5, UNICODE_NORM_QC_NO}, + {0xFCE6, UNICODE_NORM_QC_NO}, + {0xFCE7, UNICODE_NORM_QC_NO}, + {0xFCE8, UNICODE_NORM_QC_NO}, + {0xFCE9, UNICODE_NORM_QC_NO}, + {0xFCEA, UNICODE_NORM_QC_NO}, + {0xFCEB, UNICODE_NORM_QC_NO}, + {0xFCEC, UNICODE_NORM_QC_NO}, + {0xFCED, UNICODE_NORM_QC_NO}, + {0xFCEE, UNICODE_NORM_QC_NO}, + {0xFCEF, UNICODE_NORM_QC_NO}, + {0xFCF0, UNICODE_NORM_QC_NO}, + {0xFCF1, UNICODE_NORM_QC_NO}, + {0xFCF2, UNICODE_NORM_QC_NO}, + {0xFCF3, UNICODE_NORM_QC_NO}, + {0xFCF4, UNICODE_NORM_QC_NO}, + {0xFCF5, UNICODE_NORM_QC_NO}, + {0xFCF6, UNICODE_NORM_QC_NO}, + {0xFCF7, UNICODE_NORM_QC_NO}, + {0xFCF8, UNICODE_NORM_QC_NO}, + {0xFCF9, UNICODE_NORM_QC_NO}, + {0xFCFA, UNICODE_NORM_QC_NO}, + {0xFCFB, UNICODE_NORM_QC_NO}, + {0xFCFC, UNICODE_NORM_QC_NO}, + {0xFCFD, UNICODE_NORM_QC_NO}, + {0xFCFE, UNICODE_NORM_QC_NO}, + {0xFCFF, UNICODE_NORM_QC_NO}, + {0xFD00, UNICODE_NORM_QC_NO}, + {0xFD01, UNICODE_NORM_QC_NO}, + {0xFD02, UNICODE_NORM_QC_NO}, + {0xFD03, UNICODE_NORM_QC_NO}, + {0xFD04, UNICODE_NORM_QC_NO}, + {0xFD05, UNICODE_NORM_QC_NO}, + {0xFD06, UNICODE_NORM_QC_NO}, + {0xFD07, UNICODE_NORM_QC_NO}, + {0xFD08, UNICODE_NORM_QC_NO}, + {0xFD09, UNICODE_NORM_QC_NO}, + {0xFD0A, UNICODE_NORM_QC_NO}, + {0xFD0B, UNICODE_NORM_QC_NO}, + {0xFD0C, UNICODE_NORM_QC_NO}, + {0xFD0D, UNICODE_NORM_QC_NO}, + {0xFD0E, UNICODE_NORM_QC_NO}, + {0xFD0F, UNICODE_NORM_QC_NO}, + {0xFD10, UNICODE_NORM_QC_NO}, + {0xFD11, UNICODE_NORM_QC_NO}, + {0xFD12, UNICODE_NORM_QC_NO}, + {0xFD13, UNICODE_NORM_QC_NO}, + {0xFD14, UNICODE_NORM_QC_NO}, + {0xFD15, UNICODE_NORM_QC_NO}, + {0xFD16, UNICODE_NORM_QC_NO}, + {0xFD17, UNICODE_NORM_QC_NO}, + {0xFD18, UNICODE_NORM_QC_NO}, + {0xFD19, UNICODE_NORM_QC_NO}, + {0xFD1A, UNICODE_NORM_QC_NO}, + {0xFD1B, UNICODE_NORM_QC_NO}, + {0xFD1C, UNICODE_NORM_QC_NO}, + {0xFD1D, UNICODE_NORM_QC_NO}, + {0xFD1E, UNICODE_NORM_QC_NO}, + {0xFD1F, UNICODE_NORM_QC_NO}, + {0xFD20, UNICODE_NORM_QC_NO}, + {0xFD21, UNICODE_NORM_QC_NO}, + {0xFD22, UNICODE_NORM_QC_NO}, + {0xFD23, UNICODE_NORM_QC_NO}, + {0xFD24, UNICODE_NORM_QC_NO}, + {0xFD25, UNICODE_NORM_QC_NO}, + {0xFD26, UNICODE_NORM_QC_NO}, + {0xFD27, UNICODE_NORM_QC_NO}, + {0xFD28, UNICODE_NORM_QC_NO}, + {0xFD29, UNICODE_NORM_QC_NO}, + {0xFD2A, UNICODE_NORM_QC_NO}, + {0xFD2B, UNICODE_NORM_QC_NO}, + {0xFD2C, UNICODE_NORM_QC_NO}, + {0xFD2D, UNICODE_NORM_QC_NO}, + {0xFD2E, UNICODE_NORM_QC_NO}, + {0xFD2F, UNICODE_NORM_QC_NO}, + {0xFD30, UNICODE_NORM_QC_NO}, + {0xFD31, UNICODE_NORM_QC_NO}, + {0xFD32, UNICODE_NORM_QC_NO}, + {0xFD33, UNICODE_NORM_QC_NO}, + {0xFD34, UNICODE_NORM_QC_NO}, + {0xFD35, UNICODE_NORM_QC_NO}, + {0xFD36, UNICODE_NORM_QC_NO}, + {0xFD37, UNICODE_NORM_QC_NO}, + {0xFD38, UNICODE_NORM_QC_NO}, + {0xFD39, UNICODE_NORM_QC_NO}, + {0xFD3A, UNICODE_NORM_QC_NO}, + {0xFD3B, UNICODE_NORM_QC_NO}, + {0xFD3C, UNICODE_NORM_QC_NO}, + {0xFD3D, UNICODE_NORM_QC_NO}, + {0xFD50, UNICODE_NORM_QC_NO}, + {0xFD51, UNICODE_NORM_QC_NO}, + {0xFD52, UNICODE_NORM_QC_NO}, + {0xFD53, UNICODE_NORM_QC_NO}, + {0xFD54, UNICODE_NORM_QC_NO}, + {0xFD55, UNICODE_NORM_QC_NO}, + {0xFD56, UNICODE_NORM_QC_NO}, + {0xFD57, UNICODE_NORM_QC_NO}, + {0xFD58, UNICODE_NORM_QC_NO}, + {0xFD59, UNICODE_NORM_QC_NO}, + {0xFD5A, UNICODE_NORM_QC_NO}, + {0xFD5B, UNICODE_NORM_QC_NO}, + {0xFD5C, UNICODE_NORM_QC_NO}, + {0xFD5D, UNICODE_NORM_QC_NO}, + {0xFD5E, UNICODE_NORM_QC_NO}, + {0xFD5F, UNICODE_NORM_QC_NO}, + {0xFD60, UNICODE_NORM_QC_NO}, + {0xFD61, UNICODE_NORM_QC_NO}, + {0xFD62, UNICODE_NORM_QC_NO}, + {0xFD63, UNICODE_NORM_QC_NO}, + {0xFD64, UNICODE_NORM_QC_NO}, + {0xFD65, UNICODE_NORM_QC_NO}, + {0xFD66, UNICODE_NORM_QC_NO}, + {0xFD67, UNICODE_NORM_QC_NO}, + {0xFD68, UNICODE_NORM_QC_NO}, + {0xFD69, UNICODE_NORM_QC_NO}, + {0xFD6A, UNICODE_NORM_QC_NO}, + {0xFD6B, UNICODE_NORM_QC_NO}, + {0xFD6C, UNICODE_NORM_QC_NO}, + {0xFD6D, UNICODE_NORM_QC_NO}, + {0xFD6E, UNICODE_NORM_QC_NO}, + {0xFD6F, UNICODE_NORM_QC_NO}, + {0xFD70, UNICODE_NORM_QC_NO}, + {0xFD71, UNICODE_NORM_QC_NO}, + {0xFD72, UNICODE_NORM_QC_NO}, + {0xFD73, UNICODE_NORM_QC_NO}, + {0xFD74, UNICODE_NORM_QC_NO}, + {0xFD75, UNICODE_NORM_QC_NO}, + {0xFD76, UNICODE_NORM_QC_NO}, + {0xFD77, UNICODE_NORM_QC_NO}, + {0xFD78, UNICODE_NORM_QC_NO}, + {0xFD79, UNICODE_NORM_QC_NO}, + {0xFD7A, UNICODE_NORM_QC_NO}, + {0xFD7B, UNICODE_NORM_QC_NO}, + {0xFD7C, UNICODE_NORM_QC_NO}, + {0xFD7D, UNICODE_NORM_QC_NO}, + {0xFD7E, UNICODE_NORM_QC_NO}, + {0xFD7F, UNICODE_NORM_QC_NO}, + {0xFD80, UNICODE_NORM_QC_NO}, + {0xFD81, UNICODE_NORM_QC_NO}, + {0xFD82, UNICODE_NORM_QC_NO}, + {0xFD83, UNICODE_NORM_QC_NO}, + {0xFD84, UNICODE_NORM_QC_NO}, + {0xFD85, UNICODE_NORM_QC_NO}, + {0xFD86, UNICODE_NORM_QC_NO}, + {0xFD87, UNICODE_NORM_QC_NO}, + {0xFD88, UNICODE_NORM_QC_NO}, + {0xFD89, UNICODE_NORM_QC_NO}, + {0xFD8A, UNICODE_NORM_QC_NO}, + {0xFD8B, UNICODE_NORM_QC_NO}, + {0xFD8C, UNICODE_NORM_QC_NO}, + {0xFD8D, UNICODE_NORM_QC_NO}, + {0xFD8E, UNICODE_NORM_QC_NO}, + {0xFD8F, UNICODE_NORM_QC_NO}, + {0xFD92, UNICODE_NORM_QC_NO}, + {0xFD93, UNICODE_NORM_QC_NO}, + {0xFD94, UNICODE_NORM_QC_NO}, + {0xFD95, UNICODE_NORM_QC_NO}, + {0xFD96, UNICODE_NORM_QC_NO}, + {0xFD97, UNICODE_NORM_QC_NO}, + {0xFD98, UNICODE_NORM_QC_NO}, + {0xFD99, UNICODE_NORM_QC_NO}, + {0xFD9A, UNICODE_NORM_QC_NO}, + {0xFD9B, UNICODE_NORM_QC_NO}, + {0xFD9C, UNICODE_NORM_QC_NO}, + {0xFD9D, UNICODE_NORM_QC_NO}, + {0xFD9E, UNICODE_NORM_QC_NO}, + {0xFD9F, UNICODE_NORM_QC_NO}, + {0xFDA0, UNICODE_NORM_QC_NO}, + {0xFDA1, UNICODE_NORM_QC_NO}, + {0xFDA2, UNICODE_NORM_QC_NO}, + {0xFDA3, UNICODE_NORM_QC_NO}, + {0xFDA4, UNICODE_NORM_QC_NO}, + {0xFDA5, UNICODE_NORM_QC_NO}, + {0xFDA6, UNICODE_NORM_QC_NO}, + {0xFDA7, UNICODE_NORM_QC_NO}, + {0xFDA8, UNICODE_NORM_QC_NO}, + {0xFDA9, UNICODE_NORM_QC_NO}, + {0xFDAA, UNICODE_NORM_QC_NO}, + {0xFDAB, UNICODE_NORM_QC_NO}, + {0xFDAC, UNICODE_NORM_QC_NO}, + {0xFDAD, UNICODE_NORM_QC_NO}, + {0xFDAE, UNICODE_NORM_QC_NO}, + {0xFDAF, UNICODE_NORM_QC_NO}, + {0xFDB0, UNICODE_NORM_QC_NO}, + {0xFDB1, UNICODE_NORM_QC_NO}, + {0xFDB2, UNICODE_NORM_QC_NO}, + {0xFDB3, UNICODE_NORM_QC_NO}, + {0xFDB4, UNICODE_NORM_QC_NO}, + {0xFDB5, UNICODE_NORM_QC_NO}, + {0xFDB6, UNICODE_NORM_QC_NO}, + {0xFDB7, UNICODE_NORM_QC_NO}, + {0xFDB8, UNICODE_NORM_QC_NO}, + {0xFDB9, UNICODE_NORM_QC_NO}, + {0xFDBA, UNICODE_NORM_QC_NO}, + {0xFDBB, UNICODE_NORM_QC_NO}, + {0xFDBC, UNICODE_NORM_QC_NO}, + {0xFDBD, UNICODE_NORM_QC_NO}, + {0xFDBE, UNICODE_NORM_QC_NO}, + {0xFDBF, UNICODE_NORM_QC_NO}, + {0xFDC0, UNICODE_NORM_QC_NO}, + {0xFDC1, UNICODE_NORM_QC_NO}, + {0xFDC2, UNICODE_NORM_QC_NO}, + {0xFDC3, UNICODE_NORM_QC_NO}, + {0xFDC4, UNICODE_NORM_QC_NO}, + {0xFDC5, UNICODE_NORM_QC_NO}, + {0xFDC6, UNICODE_NORM_QC_NO}, + {0xFDC7, UNICODE_NORM_QC_NO}, + {0xFDF0, UNICODE_NORM_QC_NO}, + {0xFDF1, UNICODE_NORM_QC_NO}, + {0xFDF2, UNICODE_NORM_QC_NO}, + {0xFDF3, UNICODE_NORM_QC_NO}, + {0xFDF4, UNICODE_NORM_QC_NO}, + {0xFDF5, UNICODE_NORM_QC_NO}, + {0xFDF6, UNICODE_NORM_QC_NO}, + {0xFDF7, UNICODE_NORM_QC_NO}, + {0xFDF8, UNICODE_NORM_QC_NO}, + {0xFDF9, UNICODE_NORM_QC_NO}, + {0xFDFA, UNICODE_NORM_QC_NO}, + {0xFDFB, UNICODE_NORM_QC_NO}, + {0xFDFC, UNICODE_NORM_QC_NO}, + {0xFE10, UNICODE_NORM_QC_NO}, + {0xFE11, UNICODE_NORM_QC_NO}, + {0xFE12, UNICODE_NORM_QC_NO}, + {0xFE13, UNICODE_NORM_QC_NO}, + {0xFE14, UNICODE_NORM_QC_NO}, + {0xFE15, UNICODE_NORM_QC_NO}, + {0xFE16, UNICODE_NORM_QC_NO}, + {0xFE17, UNICODE_NORM_QC_NO}, + {0xFE18, UNICODE_NORM_QC_NO}, + {0xFE19, UNICODE_NORM_QC_NO}, + {0xFE30, UNICODE_NORM_QC_NO}, + {0xFE31, UNICODE_NORM_QC_NO}, + {0xFE32, UNICODE_NORM_QC_NO}, + {0xFE33, UNICODE_NORM_QC_NO}, + {0xFE34, UNICODE_NORM_QC_NO}, + {0xFE35, UNICODE_NORM_QC_NO}, + {0xFE36, UNICODE_NORM_QC_NO}, + {0xFE37, UNICODE_NORM_QC_NO}, + {0xFE38, UNICODE_NORM_QC_NO}, + {0xFE39, UNICODE_NORM_QC_NO}, + {0xFE3A, UNICODE_NORM_QC_NO}, + {0xFE3B, UNICODE_NORM_QC_NO}, + {0xFE3C, UNICODE_NORM_QC_NO}, + {0xFE3D, UNICODE_NORM_QC_NO}, + {0xFE3E, UNICODE_NORM_QC_NO}, + {0xFE3F, UNICODE_NORM_QC_NO}, + {0xFE40, UNICODE_NORM_QC_NO}, + {0xFE41, UNICODE_NORM_QC_NO}, + {0xFE42, UNICODE_NORM_QC_NO}, + {0xFE43, UNICODE_NORM_QC_NO}, + {0xFE44, UNICODE_NORM_QC_NO}, + {0xFE47, UNICODE_NORM_QC_NO}, + {0xFE48, UNICODE_NORM_QC_NO}, + {0xFE49, UNICODE_NORM_QC_NO}, + {0xFE4A, UNICODE_NORM_QC_NO}, + {0xFE4B, UNICODE_NORM_QC_NO}, + {0xFE4C, UNICODE_NORM_QC_NO}, + {0xFE4D, UNICODE_NORM_QC_NO}, + {0xFE4E, UNICODE_NORM_QC_NO}, + {0xFE4F, UNICODE_NORM_QC_NO}, + {0xFE50, UNICODE_NORM_QC_NO}, + {0xFE51, UNICODE_NORM_QC_NO}, + {0xFE52, UNICODE_NORM_QC_NO}, + {0xFE54, UNICODE_NORM_QC_NO}, + {0xFE55, UNICODE_NORM_QC_NO}, + {0xFE56, UNICODE_NORM_QC_NO}, + {0xFE57, UNICODE_NORM_QC_NO}, + {0xFE58, UNICODE_NORM_QC_NO}, + {0xFE59, UNICODE_NORM_QC_NO}, + {0xFE5A, UNICODE_NORM_QC_NO}, + {0xFE5B, UNICODE_NORM_QC_NO}, + {0xFE5C, UNICODE_NORM_QC_NO}, + {0xFE5D, UNICODE_NORM_QC_NO}, + {0xFE5E, UNICODE_NORM_QC_NO}, + {0xFE5F, UNICODE_NORM_QC_NO}, + {0xFE60, UNICODE_NORM_QC_NO}, + {0xFE61, UNICODE_NORM_QC_NO}, + {0xFE62, UNICODE_NORM_QC_NO}, + {0xFE63, UNICODE_NORM_QC_NO}, + {0xFE64, UNICODE_NORM_QC_NO}, + {0xFE65, UNICODE_NORM_QC_NO}, + {0xFE66, UNICODE_NORM_QC_NO}, + {0xFE68, UNICODE_NORM_QC_NO}, + {0xFE69, UNICODE_NORM_QC_NO}, + {0xFE6A, UNICODE_NORM_QC_NO}, + {0xFE6B, UNICODE_NORM_QC_NO}, + {0xFE70, UNICODE_NORM_QC_NO}, + {0xFE71, UNICODE_NORM_QC_NO}, + {0xFE72, UNICODE_NORM_QC_NO}, + {0xFE74, UNICODE_NORM_QC_NO}, + {0xFE76, UNICODE_NORM_QC_NO}, + {0xFE77, UNICODE_NORM_QC_NO}, + {0xFE78, UNICODE_NORM_QC_NO}, + {0xFE79, UNICODE_NORM_QC_NO}, + {0xFE7A, UNICODE_NORM_QC_NO}, + {0xFE7B, UNICODE_NORM_QC_NO}, + {0xFE7C, UNICODE_NORM_QC_NO}, + {0xFE7D, UNICODE_NORM_QC_NO}, + {0xFE7E, UNICODE_NORM_QC_NO}, + {0xFE7F, UNICODE_NORM_QC_NO}, + {0xFE80, UNICODE_NORM_QC_NO}, + {0xFE81, UNICODE_NORM_QC_NO}, + {0xFE82, UNICODE_NORM_QC_NO}, + {0xFE83, UNICODE_NORM_QC_NO}, + {0xFE84, UNICODE_NORM_QC_NO}, + {0xFE85, UNICODE_NORM_QC_NO}, + {0xFE86, UNICODE_NORM_QC_NO}, + {0xFE87, UNICODE_NORM_QC_NO}, + {0xFE88, UNICODE_NORM_QC_NO}, + {0xFE89, UNICODE_NORM_QC_NO}, + {0xFE8A, UNICODE_NORM_QC_NO}, + {0xFE8B, UNICODE_NORM_QC_NO}, + {0xFE8C, UNICODE_NORM_QC_NO}, + {0xFE8D, UNICODE_NORM_QC_NO}, + {0xFE8E, UNICODE_NORM_QC_NO}, + {0xFE8F, UNICODE_NORM_QC_NO}, + {0xFE90, UNICODE_NORM_QC_NO}, + {0xFE91, UNICODE_NORM_QC_NO}, + {0xFE92, UNICODE_NORM_QC_NO}, + {0xFE93, UNICODE_NORM_QC_NO}, + {0xFE94, UNICODE_NORM_QC_NO}, + {0xFE95, UNICODE_NORM_QC_NO}, + {0xFE96, UNICODE_NORM_QC_NO}, + {0xFE97, UNICODE_NORM_QC_NO}, + {0xFE98, UNICODE_NORM_QC_NO}, + {0xFE99, UNICODE_NORM_QC_NO}, + {0xFE9A, UNICODE_NORM_QC_NO}, + {0xFE9B, UNICODE_NORM_QC_NO}, + {0xFE9C, UNICODE_NORM_QC_NO}, + {0xFE9D, UNICODE_NORM_QC_NO}, + {0xFE9E, UNICODE_NORM_QC_NO}, + {0xFE9F, UNICODE_NORM_QC_NO}, + {0xFEA0, UNICODE_NORM_QC_NO}, + {0xFEA1, UNICODE_NORM_QC_NO}, + {0xFEA2, UNICODE_NORM_QC_NO}, + {0xFEA3, UNICODE_NORM_QC_NO}, + {0xFEA4, UNICODE_NORM_QC_NO}, + {0xFEA5, UNICODE_NORM_QC_NO}, + {0xFEA6, UNICODE_NORM_QC_NO}, + {0xFEA7, UNICODE_NORM_QC_NO}, + {0xFEA8, UNICODE_NORM_QC_NO}, + {0xFEA9, UNICODE_NORM_QC_NO}, + {0xFEAA, UNICODE_NORM_QC_NO}, + {0xFEAB, UNICODE_NORM_QC_NO}, + {0xFEAC, UNICODE_NORM_QC_NO}, + {0xFEAD, UNICODE_NORM_QC_NO}, + {0xFEAE, UNICODE_NORM_QC_NO}, + {0xFEAF, UNICODE_NORM_QC_NO}, + {0xFEB0, UNICODE_NORM_QC_NO}, + {0xFEB1, UNICODE_NORM_QC_NO}, + {0xFEB2, UNICODE_NORM_QC_NO}, + {0xFEB3, UNICODE_NORM_QC_NO}, + {0xFEB4, UNICODE_NORM_QC_NO}, + {0xFEB5, UNICODE_NORM_QC_NO}, + {0xFEB6, UNICODE_NORM_QC_NO}, + {0xFEB7, UNICODE_NORM_QC_NO}, + {0xFEB8, UNICODE_NORM_QC_NO}, + {0xFEB9, UNICODE_NORM_QC_NO}, + {0xFEBA, UNICODE_NORM_QC_NO}, + {0xFEBB, UNICODE_NORM_QC_NO}, + {0xFEBC, UNICODE_NORM_QC_NO}, + {0xFEBD, UNICODE_NORM_QC_NO}, + {0xFEBE, UNICODE_NORM_QC_NO}, + {0xFEBF, UNICODE_NORM_QC_NO}, + {0xFEC0, UNICODE_NORM_QC_NO}, + {0xFEC1, UNICODE_NORM_QC_NO}, + {0xFEC2, UNICODE_NORM_QC_NO}, + {0xFEC3, UNICODE_NORM_QC_NO}, + {0xFEC4, UNICODE_NORM_QC_NO}, + {0xFEC5, UNICODE_NORM_QC_NO}, + {0xFEC6, UNICODE_NORM_QC_NO}, + {0xFEC7, UNICODE_NORM_QC_NO}, + {0xFEC8, UNICODE_NORM_QC_NO}, + {0xFEC9, UNICODE_NORM_QC_NO}, + {0xFECA, UNICODE_NORM_QC_NO}, + {0xFECB, UNICODE_NORM_QC_NO}, + {0xFECC, UNICODE_NORM_QC_NO}, + {0xFECD, UNICODE_NORM_QC_NO}, + {0xFECE, UNICODE_NORM_QC_NO}, + {0xFECF, UNICODE_NORM_QC_NO}, + {0xFED0, UNICODE_NORM_QC_NO}, + {0xFED1, UNICODE_NORM_QC_NO}, + {0xFED2, UNICODE_NORM_QC_NO}, + {0xFED3, UNICODE_NORM_QC_NO}, + {0xFED4, UNICODE_NORM_QC_NO}, + {0xFED5, UNICODE_NORM_QC_NO}, + {0xFED6, UNICODE_NORM_QC_NO}, + {0xFED7, UNICODE_NORM_QC_NO}, + {0xFED8, UNICODE_NORM_QC_NO}, + {0xFED9, UNICODE_NORM_QC_NO}, + {0xFEDA, UNICODE_NORM_QC_NO}, + {0xFEDB, UNICODE_NORM_QC_NO}, + {0xFEDC, UNICODE_NORM_QC_NO}, + {0xFEDD, UNICODE_NORM_QC_NO}, + {0xFEDE, UNICODE_NORM_QC_NO}, + {0xFEDF, UNICODE_NORM_QC_NO}, + {0xFEE0, UNICODE_NORM_QC_NO}, + {0xFEE1, UNICODE_NORM_QC_NO}, + {0xFEE2, UNICODE_NORM_QC_NO}, + {0xFEE3, UNICODE_NORM_QC_NO}, + {0xFEE4, UNICODE_NORM_QC_NO}, + {0xFEE5, UNICODE_NORM_QC_NO}, + {0xFEE6, UNICODE_NORM_QC_NO}, + {0xFEE7, UNICODE_NORM_QC_NO}, + {0xFEE8, UNICODE_NORM_QC_NO}, + {0xFEE9, UNICODE_NORM_QC_NO}, + {0xFEEA, UNICODE_NORM_QC_NO}, + {0xFEEB, UNICODE_NORM_QC_NO}, + {0xFEEC, UNICODE_NORM_QC_NO}, + {0xFEED, UNICODE_NORM_QC_NO}, + {0xFEEE, UNICODE_NORM_QC_NO}, + {0xFEEF, UNICODE_NORM_QC_NO}, + {0xFEF0, UNICODE_NORM_QC_NO}, + {0xFEF1, UNICODE_NORM_QC_NO}, + {0xFEF2, UNICODE_NORM_QC_NO}, + {0xFEF3, UNICODE_NORM_QC_NO}, + {0xFEF4, UNICODE_NORM_QC_NO}, + {0xFEF5, UNICODE_NORM_QC_NO}, + {0xFEF6, UNICODE_NORM_QC_NO}, + {0xFEF7, UNICODE_NORM_QC_NO}, + {0xFEF8, UNICODE_NORM_QC_NO}, + {0xFEF9, UNICODE_NORM_QC_NO}, + {0xFEFA, UNICODE_NORM_QC_NO}, + {0xFEFB, UNICODE_NORM_QC_NO}, + {0xFEFC, UNICODE_NORM_QC_NO}, + {0xFF01, UNICODE_NORM_QC_NO}, + {0xFF02, UNICODE_NORM_QC_NO}, + {0xFF03, UNICODE_NORM_QC_NO}, + {0xFF04, UNICODE_NORM_QC_NO}, + {0xFF05, UNICODE_NORM_QC_NO}, + {0xFF06, UNICODE_NORM_QC_NO}, + {0xFF07, UNICODE_NORM_QC_NO}, + {0xFF08, UNICODE_NORM_QC_NO}, + {0xFF09, UNICODE_NORM_QC_NO}, + {0xFF0A, UNICODE_NORM_QC_NO}, + {0xFF0B, UNICODE_NORM_QC_NO}, + {0xFF0C, UNICODE_NORM_QC_NO}, + {0xFF0D, UNICODE_NORM_QC_NO}, + {0xFF0E, UNICODE_NORM_QC_NO}, + {0xFF0F, UNICODE_NORM_QC_NO}, + {0xFF10, UNICODE_NORM_QC_NO}, + {0xFF11, UNICODE_NORM_QC_NO}, + {0xFF12, UNICODE_NORM_QC_NO}, + {0xFF13, UNICODE_NORM_QC_NO}, + {0xFF14, UNICODE_NORM_QC_NO}, + {0xFF15, UNICODE_NORM_QC_NO}, + {0xFF16, UNICODE_NORM_QC_NO}, + {0xFF17, UNICODE_NORM_QC_NO}, + {0xFF18, UNICODE_NORM_QC_NO}, + {0xFF19, UNICODE_NORM_QC_NO}, + {0xFF1A, UNICODE_NORM_QC_NO}, + {0xFF1B, UNICODE_NORM_QC_NO}, + {0xFF1C, UNICODE_NORM_QC_NO}, + {0xFF1D, UNICODE_NORM_QC_NO}, + {0xFF1E, UNICODE_NORM_QC_NO}, + {0xFF1F, UNICODE_NORM_QC_NO}, + {0xFF20, UNICODE_NORM_QC_NO}, + {0xFF21, UNICODE_NORM_QC_NO}, + {0xFF22, UNICODE_NORM_QC_NO}, + {0xFF23, UNICODE_NORM_QC_NO}, + {0xFF24, UNICODE_NORM_QC_NO}, + {0xFF25, UNICODE_NORM_QC_NO}, + {0xFF26, UNICODE_NORM_QC_NO}, + {0xFF27, UNICODE_NORM_QC_NO}, + {0xFF28, UNICODE_NORM_QC_NO}, + {0xFF29, UNICODE_NORM_QC_NO}, + {0xFF2A, UNICODE_NORM_QC_NO}, + {0xFF2B, UNICODE_NORM_QC_NO}, + {0xFF2C, UNICODE_NORM_QC_NO}, + {0xFF2D, UNICODE_NORM_QC_NO}, + {0xFF2E, UNICODE_NORM_QC_NO}, + {0xFF2F, UNICODE_NORM_QC_NO}, + {0xFF30, UNICODE_NORM_QC_NO}, + {0xFF31, UNICODE_NORM_QC_NO}, + {0xFF32, UNICODE_NORM_QC_NO}, + {0xFF33, UNICODE_NORM_QC_NO}, + {0xFF34, UNICODE_NORM_QC_NO}, + {0xFF35, UNICODE_NORM_QC_NO}, + {0xFF36, UNICODE_NORM_QC_NO}, + {0xFF37, UNICODE_NORM_QC_NO}, + {0xFF38, UNICODE_NORM_QC_NO}, + {0xFF39, UNICODE_NORM_QC_NO}, + {0xFF3A, UNICODE_NORM_QC_NO}, + {0xFF3B, UNICODE_NORM_QC_NO}, + {0xFF3C, UNICODE_NORM_QC_NO}, + {0xFF3D, UNICODE_NORM_QC_NO}, + {0xFF3E, UNICODE_NORM_QC_NO}, + {0xFF3F, UNICODE_NORM_QC_NO}, + {0xFF40, UNICODE_NORM_QC_NO}, + {0xFF41, UNICODE_NORM_QC_NO}, + {0xFF42, UNICODE_NORM_QC_NO}, + {0xFF43, UNICODE_NORM_QC_NO}, + {0xFF44, UNICODE_NORM_QC_NO}, + {0xFF45, UNICODE_NORM_QC_NO}, + {0xFF46, UNICODE_NORM_QC_NO}, + {0xFF47, UNICODE_NORM_QC_NO}, + {0xFF48, UNICODE_NORM_QC_NO}, + {0xFF49, UNICODE_NORM_QC_NO}, + {0xFF4A, UNICODE_NORM_QC_NO}, + {0xFF4B, UNICODE_NORM_QC_NO}, + {0xFF4C, UNICODE_NORM_QC_NO}, + {0xFF4D, UNICODE_NORM_QC_NO}, + {0xFF4E, UNICODE_NORM_QC_NO}, + {0xFF4F, UNICODE_NORM_QC_NO}, + {0xFF50, UNICODE_NORM_QC_NO}, + {0xFF51, UNICODE_NORM_QC_NO}, + {0xFF52, UNICODE_NORM_QC_NO}, + {0xFF53, UNICODE_NORM_QC_NO}, + {0xFF54, UNICODE_NORM_QC_NO}, + {0xFF55, UNICODE_NORM_QC_NO}, + {0xFF56, UNICODE_NORM_QC_NO}, + {0xFF57, UNICODE_NORM_QC_NO}, + {0xFF58, UNICODE_NORM_QC_NO}, + {0xFF59, UNICODE_NORM_QC_NO}, + {0xFF5A, UNICODE_NORM_QC_NO}, + {0xFF5B, UNICODE_NORM_QC_NO}, + {0xFF5C, UNICODE_NORM_QC_NO}, + {0xFF5D, UNICODE_NORM_QC_NO}, + {0xFF5E, UNICODE_NORM_QC_NO}, + {0xFF5F, UNICODE_NORM_QC_NO}, + {0xFF60, UNICODE_NORM_QC_NO}, + {0xFF61, UNICODE_NORM_QC_NO}, + {0xFF62, UNICODE_NORM_QC_NO}, + {0xFF63, UNICODE_NORM_QC_NO}, + {0xFF64, UNICODE_NORM_QC_NO}, + {0xFF65, UNICODE_NORM_QC_NO}, + {0xFF66, UNICODE_NORM_QC_NO}, + {0xFF67, UNICODE_NORM_QC_NO}, + {0xFF68, UNICODE_NORM_QC_NO}, + {0xFF69, UNICODE_NORM_QC_NO}, + {0xFF6A, UNICODE_NORM_QC_NO}, + {0xFF6B, UNICODE_NORM_QC_NO}, + {0xFF6C, UNICODE_NORM_QC_NO}, + {0xFF6D, UNICODE_NORM_QC_NO}, + {0xFF6E, UNICODE_NORM_QC_NO}, + {0xFF6F, UNICODE_NORM_QC_NO}, + {0xFF70, UNICODE_NORM_QC_NO}, + {0xFF71, UNICODE_NORM_QC_NO}, + {0xFF72, UNICODE_NORM_QC_NO}, + {0xFF73, UNICODE_NORM_QC_NO}, + {0xFF74, UNICODE_NORM_QC_NO}, + {0xFF75, UNICODE_NORM_QC_NO}, + {0xFF76, UNICODE_NORM_QC_NO}, + {0xFF77, UNICODE_NORM_QC_NO}, + {0xFF78, UNICODE_NORM_QC_NO}, + {0xFF79, UNICODE_NORM_QC_NO}, + {0xFF7A, UNICODE_NORM_QC_NO}, + {0xFF7B, UNICODE_NORM_QC_NO}, + {0xFF7C, UNICODE_NORM_QC_NO}, + {0xFF7D, UNICODE_NORM_QC_NO}, + {0xFF7E, UNICODE_NORM_QC_NO}, + {0xFF7F, UNICODE_NORM_QC_NO}, + {0xFF80, UNICODE_NORM_QC_NO}, + {0xFF81, UNICODE_NORM_QC_NO}, + {0xFF82, UNICODE_NORM_QC_NO}, + {0xFF83, UNICODE_NORM_QC_NO}, + {0xFF84, UNICODE_NORM_QC_NO}, + {0xFF85, UNICODE_NORM_QC_NO}, + {0xFF86, UNICODE_NORM_QC_NO}, + {0xFF87, UNICODE_NORM_QC_NO}, + {0xFF88, UNICODE_NORM_QC_NO}, + {0xFF89, UNICODE_NORM_QC_NO}, + {0xFF8A, UNICODE_NORM_QC_NO}, + {0xFF8B, UNICODE_NORM_QC_NO}, + {0xFF8C, UNICODE_NORM_QC_NO}, + {0xFF8D, UNICODE_NORM_QC_NO}, + {0xFF8E, UNICODE_NORM_QC_NO}, + {0xFF8F, UNICODE_NORM_QC_NO}, + {0xFF90, UNICODE_NORM_QC_NO}, + {0xFF91, UNICODE_NORM_QC_NO}, + {0xFF92, UNICODE_NORM_QC_NO}, + {0xFF93, UNICODE_NORM_QC_NO}, + {0xFF94, UNICODE_NORM_QC_NO}, + {0xFF95, UNICODE_NORM_QC_NO}, + {0xFF96, UNICODE_NORM_QC_NO}, + {0xFF97, UNICODE_NORM_QC_NO}, + {0xFF98, UNICODE_NORM_QC_NO}, + {0xFF99, UNICODE_NORM_QC_NO}, + {0xFF9A, UNICODE_NORM_QC_NO}, + {0xFF9B, UNICODE_NORM_QC_NO}, + {0xFF9C, UNICODE_NORM_QC_NO}, + {0xFF9D, UNICODE_NORM_QC_NO}, + {0xFF9E, UNICODE_NORM_QC_NO}, + {0xFF9F, UNICODE_NORM_QC_NO}, + {0xFFA0, UNICODE_NORM_QC_NO}, + {0xFFA1, UNICODE_NORM_QC_NO}, + {0xFFA2, UNICODE_NORM_QC_NO}, + {0xFFA3, UNICODE_NORM_QC_NO}, + {0xFFA4, UNICODE_NORM_QC_NO}, + {0xFFA5, UNICODE_NORM_QC_NO}, + {0xFFA6, UNICODE_NORM_QC_NO}, + {0xFFA7, UNICODE_NORM_QC_NO}, + {0xFFA8, UNICODE_NORM_QC_NO}, + {0xFFA9, UNICODE_NORM_QC_NO}, + {0xFFAA, UNICODE_NORM_QC_NO}, + {0xFFAB, UNICODE_NORM_QC_NO}, + {0xFFAC, UNICODE_NORM_QC_NO}, + {0xFFAD, UNICODE_NORM_QC_NO}, + {0xFFAE, UNICODE_NORM_QC_NO}, + {0xFFAF, UNICODE_NORM_QC_NO}, + {0xFFB0, UNICODE_NORM_QC_NO}, + {0xFFB1, UNICODE_NORM_QC_NO}, + {0xFFB2, UNICODE_NORM_QC_NO}, + {0xFFB3, UNICODE_NORM_QC_NO}, + {0xFFB4, UNICODE_NORM_QC_NO}, + {0xFFB5, UNICODE_NORM_QC_NO}, + {0xFFB6, UNICODE_NORM_QC_NO}, + {0xFFB7, UNICODE_NORM_QC_NO}, + {0xFFB8, UNICODE_NORM_QC_NO}, + {0xFFB9, UNICODE_NORM_QC_NO}, + {0xFFBA, UNICODE_NORM_QC_NO}, + {0xFFBB, UNICODE_NORM_QC_NO}, + {0xFFBC, UNICODE_NORM_QC_NO}, + {0xFFBD, UNICODE_NORM_QC_NO}, + {0xFFBE, UNICODE_NORM_QC_NO}, + {0xFFC2, UNICODE_NORM_QC_NO}, + {0xFFC3, UNICODE_NORM_QC_NO}, + {0xFFC4, UNICODE_NORM_QC_NO}, + {0xFFC5, UNICODE_NORM_QC_NO}, + {0xFFC6, UNICODE_NORM_QC_NO}, + {0xFFC7, UNICODE_NORM_QC_NO}, + {0xFFCA, UNICODE_NORM_QC_NO}, + {0xFFCB, UNICODE_NORM_QC_NO}, + {0xFFCC, UNICODE_NORM_QC_NO}, + {0xFFCD, UNICODE_NORM_QC_NO}, + {0xFFCE, UNICODE_NORM_QC_NO}, + {0xFFCF, UNICODE_NORM_QC_NO}, + {0xFFD2, UNICODE_NORM_QC_NO}, + {0xFFD3, UNICODE_NORM_QC_NO}, + {0xFFD4, UNICODE_NORM_QC_NO}, + {0xFFD5, UNICODE_NORM_QC_NO}, + {0xFFD6, UNICODE_NORM_QC_NO}, + {0xFFD7, UNICODE_NORM_QC_NO}, + {0xFFDA, UNICODE_NORM_QC_NO}, + {0xFFDB, UNICODE_NORM_QC_NO}, + {0xFFDC, UNICODE_NORM_QC_NO}, + {0xFFE0, UNICODE_NORM_QC_NO}, + {0xFFE1, UNICODE_NORM_QC_NO}, + {0xFFE2, UNICODE_NORM_QC_NO}, + {0xFFE3, UNICODE_NORM_QC_NO}, + {0xFFE4, UNICODE_NORM_QC_NO}, + {0xFFE5, UNICODE_NORM_QC_NO}, + {0xFFE6, UNICODE_NORM_QC_NO}, + {0xFFE8, UNICODE_NORM_QC_NO}, + {0xFFE9, UNICODE_NORM_QC_NO}, + {0xFFEA, UNICODE_NORM_QC_NO}, + {0xFFEB, UNICODE_NORM_QC_NO}, + {0xFFEC, UNICODE_NORM_QC_NO}, + {0xFFED, UNICODE_NORM_QC_NO}, + {0xFFEE, UNICODE_NORM_QC_NO}, + {0x10781, UNICODE_NORM_QC_NO}, + {0x10782, UNICODE_NORM_QC_NO}, + {0x10783, UNICODE_NORM_QC_NO}, + {0x10784, UNICODE_NORM_QC_NO}, + {0x10785, UNICODE_NORM_QC_NO}, + {0x10787, UNICODE_NORM_QC_NO}, + {0x10788, UNICODE_NORM_QC_NO}, + {0x10789, UNICODE_NORM_QC_NO}, + {0x1078A, UNICODE_NORM_QC_NO}, + {0x1078B, UNICODE_NORM_QC_NO}, + {0x1078C, UNICODE_NORM_QC_NO}, + {0x1078D, UNICODE_NORM_QC_NO}, + {0x1078E, UNICODE_NORM_QC_NO}, + {0x1078F, UNICODE_NORM_QC_NO}, + {0x10790, UNICODE_NORM_QC_NO}, + {0x10791, UNICODE_NORM_QC_NO}, + {0x10792, UNICODE_NORM_QC_NO}, + {0x10793, UNICODE_NORM_QC_NO}, + {0x10794, UNICODE_NORM_QC_NO}, + {0x10795, UNICODE_NORM_QC_NO}, + {0x10796, UNICODE_NORM_QC_NO}, + {0x10797, UNICODE_NORM_QC_NO}, + {0x10798, UNICODE_NORM_QC_NO}, + {0x10799, UNICODE_NORM_QC_NO}, + {0x1079A, UNICODE_NORM_QC_NO}, + {0x1079B, UNICODE_NORM_QC_NO}, + {0x1079C, UNICODE_NORM_QC_NO}, + {0x1079D, UNICODE_NORM_QC_NO}, + {0x1079E, UNICODE_NORM_QC_NO}, + {0x1079F, UNICODE_NORM_QC_NO}, + {0x107A0, UNICODE_NORM_QC_NO}, + {0x107A1, UNICODE_NORM_QC_NO}, + {0x107A2, UNICODE_NORM_QC_NO}, + {0x107A3, UNICODE_NORM_QC_NO}, + {0x107A4, UNICODE_NORM_QC_NO}, + {0x107A5, UNICODE_NORM_QC_NO}, + {0x107A6, UNICODE_NORM_QC_NO}, + {0x107A7, UNICODE_NORM_QC_NO}, + {0x107A8, UNICODE_NORM_QC_NO}, + {0x107A9, UNICODE_NORM_QC_NO}, + {0x107AA, UNICODE_NORM_QC_NO}, + {0x107AB, UNICODE_NORM_QC_NO}, + {0x107AC, UNICODE_NORM_QC_NO}, + {0x107AD, UNICODE_NORM_QC_NO}, + {0x107AE, UNICODE_NORM_QC_NO}, + {0x107AF, UNICODE_NORM_QC_NO}, + {0x107B0, UNICODE_NORM_QC_NO}, + {0x107B2, UNICODE_NORM_QC_NO}, + {0x107B3, UNICODE_NORM_QC_NO}, + {0x107B4, UNICODE_NORM_QC_NO}, + {0x107B5, UNICODE_NORM_QC_NO}, + {0x107B6, UNICODE_NORM_QC_NO}, + {0x107B7, UNICODE_NORM_QC_NO}, + {0x107B8, UNICODE_NORM_QC_NO}, + {0x107B9, UNICODE_NORM_QC_NO}, + {0x107BA, UNICODE_NORM_QC_NO}, + {0x110BA, UNICODE_NORM_QC_MAYBE}, + {0x11127, UNICODE_NORM_QC_MAYBE}, + {0x1133E, UNICODE_NORM_QC_MAYBE}, + {0x11357, UNICODE_NORM_QC_MAYBE}, + {0x113B8, UNICODE_NORM_QC_MAYBE}, + {0x113BB, UNICODE_NORM_QC_MAYBE}, + {0x113C2, UNICODE_NORM_QC_MAYBE}, + {0x113C5, UNICODE_NORM_QC_MAYBE}, + {0x113C7, UNICODE_NORM_QC_MAYBE}, + {0x113C8, UNICODE_NORM_QC_MAYBE}, + {0x113C9, UNICODE_NORM_QC_MAYBE}, + {0x114B0, UNICODE_NORM_QC_MAYBE}, + {0x114BA, UNICODE_NORM_QC_MAYBE}, + {0x114BD, UNICODE_NORM_QC_MAYBE}, + {0x115AF, UNICODE_NORM_QC_MAYBE}, + {0x11930, UNICODE_NORM_QC_MAYBE}, + {0x1611E, UNICODE_NORM_QC_MAYBE}, + {0x1611F, UNICODE_NORM_QC_MAYBE}, + {0x16120, UNICODE_NORM_QC_MAYBE}, + {0x16121, UNICODE_NORM_QC_MAYBE}, + {0x16122, UNICODE_NORM_QC_MAYBE}, + {0x16123, UNICODE_NORM_QC_MAYBE}, + {0x16124, UNICODE_NORM_QC_MAYBE}, + {0x16125, UNICODE_NORM_QC_MAYBE}, + {0x16126, UNICODE_NORM_QC_MAYBE}, + {0x16127, UNICODE_NORM_QC_MAYBE}, + {0x16128, UNICODE_NORM_QC_MAYBE}, + {0x16129, UNICODE_NORM_QC_MAYBE}, + {0x16D67, UNICODE_NORM_QC_MAYBE}, + {0x16D68, UNICODE_NORM_QC_MAYBE}, + {0x1CCD6, UNICODE_NORM_QC_NO}, + {0x1CCD7, UNICODE_NORM_QC_NO}, + {0x1CCD8, UNICODE_NORM_QC_NO}, + {0x1CCD9, UNICODE_NORM_QC_NO}, + {0x1CCDA, UNICODE_NORM_QC_NO}, + {0x1CCDB, UNICODE_NORM_QC_NO}, + {0x1CCDC, UNICODE_NORM_QC_NO}, + {0x1CCDD, UNICODE_NORM_QC_NO}, + {0x1CCDE, UNICODE_NORM_QC_NO}, + {0x1CCDF, UNICODE_NORM_QC_NO}, + {0x1CCE0, UNICODE_NORM_QC_NO}, + {0x1CCE1, UNICODE_NORM_QC_NO}, + {0x1CCE2, UNICODE_NORM_QC_NO}, + {0x1CCE3, UNICODE_NORM_QC_NO}, + {0x1CCE4, UNICODE_NORM_QC_NO}, + {0x1CCE5, UNICODE_NORM_QC_NO}, + {0x1CCE6, UNICODE_NORM_QC_NO}, + {0x1CCE7, UNICODE_NORM_QC_NO}, + {0x1CCE8, UNICODE_NORM_QC_NO}, + {0x1CCE9, UNICODE_NORM_QC_NO}, + {0x1CCEA, UNICODE_NORM_QC_NO}, + {0x1CCEB, UNICODE_NORM_QC_NO}, + {0x1CCEC, UNICODE_NORM_QC_NO}, + {0x1CCED, UNICODE_NORM_QC_NO}, + {0x1CCEE, UNICODE_NORM_QC_NO}, + {0x1CCEF, UNICODE_NORM_QC_NO}, + {0x1CCF0, UNICODE_NORM_QC_NO}, + {0x1CCF1, UNICODE_NORM_QC_NO}, + {0x1CCF2, UNICODE_NORM_QC_NO}, + {0x1CCF3, UNICODE_NORM_QC_NO}, + {0x1CCF4, UNICODE_NORM_QC_NO}, + {0x1CCF5, UNICODE_NORM_QC_NO}, + {0x1CCF6, UNICODE_NORM_QC_NO}, + {0x1CCF7, UNICODE_NORM_QC_NO}, + {0x1CCF8, UNICODE_NORM_QC_NO}, + {0x1CCF9, UNICODE_NORM_QC_NO}, + {0x1D15E, UNICODE_NORM_QC_NO}, + {0x1D15F, UNICODE_NORM_QC_NO}, + {0x1D160, UNICODE_NORM_QC_NO}, + {0x1D161, UNICODE_NORM_QC_NO}, + {0x1D162, UNICODE_NORM_QC_NO}, + {0x1D163, UNICODE_NORM_QC_NO}, + {0x1D164, UNICODE_NORM_QC_NO}, + {0x1D1BB, UNICODE_NORM_QC_NO}, + {0x1D1BC, UNICODE_NORM_QC_NO}, + {0x1D1BD, UNICODE_NORM_QC_NO}, + {0x1D1BE, UNICODE_NORM_QC_NO}, + {0x1D1BF, UNICODE_NORM_QC_NO}, + {0x1D1C0, UNICODE_NORM_QC_NO}, + {0x1D400, UNICODE_NORM_QC_NO}, + {0x1D401, UNICODE_NORM_QC_NO}, + {0x1D402, UNICODE_NORM_QC_NO}, + {0x1D403, UNICODE_NORM_QC_NO}, + {0x1D404, UNICODE_NORM_QC_NO}, + {0x1D405, UNICODE_NORM_QC_NO}, + {0x1D406, UNICODE_NORM_QC_NO}, + {0x1D407, UNICODE_NORM_QC_NO}, + {0x1D408, UNICODE_NORM_QC_NO}, + {0x1D409, UNICODE_NORM_QC_NO}, + {0x1D40A, UNICODE_NORM_QC_NO}, + {0x1D40B, UNICODE_NORM_QC_NO}, + {0x1D40C, UNICODE_NORM_QC_NO}, + {0x1D40D, UNICODE_NORM_QC_NO}, + {0x1D40E, UNICODE_NORM_QC_NO}, + {0x1D40F, UNICODE_NORM_QC_NO}, + {0x1D410, UNICODE_NORM_QC_NO}, + {0x1D411, UNICODE_NORM_QC_NO}, + {0x1D412, UNICODE_NORM_QC_NO}, + {0x1D413, UNICODE_NORM_QC_NO}, + {0x1D414, UNICODE_NORM_QC_NO}, + {0x1D415, UNICODE_NORM_QC_NO}, + {0x1D416, UNICODE_NORM_QC_NO}, + {0x1D417, UNICODE_NORM_QC_NO}, + {0x1D418, UNICODE_NORM_QC_NO}, + {0x1D419, UNICODE_NORM_QC_NO}, + {0x1D41A, UNICODE_NORM_QC_NO}, + {0x1D41B, UNICODE_NORM_QC_NO}, + {0x1D41C, UNICODE_NORM_QC_NO}, + {0x1D41D, UNICODE_NORM_QC_NO}, + {0x1D41E, UNICODE_NORM_QC_NO}, + {0x1D41F, UNICODE_NORM_QC_NO}, + {0x1D420, UNICODE_NORM_QC_NO}, + {0x1D421, UNICODE_NORM_QC_NO}, + {0x1D422, UNICODE_NORM_QC_NO}, + {0x1D423, UNICODE_NORM_QC_NO}, + {0x1D424, UNICODE_NORM_QC_NO}, + {0x1D425, UNICODE_NORM_QC_NO}, + {0x1D426, UNICODE_NORM_QC_NO}, + {0x1D427, UNICODE_NORM_QC_NO}, + {0x1D428, UNICODE_NORM_QC_NO}, + {0x1D429, UNICODE_NORM_QC_NO}, + {0x1D42A, UNICODE_NORM_QC_NO}, + {0x1D42B, UNICODE_NORM_QC_NO}, + {0x1D42C, UNICODE_NORM_QC_NO}, + {0x1D42D, UNICODE_NORM_QC_NO}, + {0x1D42E, UNICODE_NORM_QC_NO}, + {0x1D42F, UNICODE_NORM_QC_NO}, + {0x1D430, UNICODE_NORM_QC_NO}, + {0x1D431, UNICODE_NORM_QC_NO}, + {0x1D432, UNICODE_NORM_QC_NO}, + {0x1D433, UNICODE_NORM_QC_NO}, + {0x1D434, UNICODE_NORM_QC_NO}, + {0x1D435, UNICODE_NORM_QC_NO}, + {0x1D436, UNICODE_NORM_QC_NO}, + {0x1D437, UNICODE_NORM_QC_NO}, + {0x1D438, UNICODE_NORM_QC_NO}, + {0x1D439, UNICODE_NORM_QC_NO}, + {0x1D43A, UNICODE_NORM_QC_NO}, + {0x1D43B, UNICODE_NORM_QC_NO}, + {0x1D43C, UNICODE_NORM_QC_NO}, + {0x1D43D, UNICODE_NORM_QC_NO}, + {0x1D43E, UNICODE_NORM_QC_NO}, + {0x1D43F, UNICODE_NORM_QC_NO}, + {0x1D440, UNICODE_NORM_QC_NO}, + {0x1D441, UNICODE_NORM_QC_NO}, + {0x1D442, UNICODE_NORM_QC_NO}, + {0x1D443, UNICODE_NORM_QC_NO}, + {0x1D444, UNICODE_NORM_QC_NO}, + {0x1D445, UNICODE_NORM_QC_NO}, + {0x1D446, UNICODE_NORM_QC_NO}, + {0x1D447, UNICODE_NORM_QC_NO}, + {0x1D448, UNICODE_NORM_QC_NO}, + {0x1D449, UNICODE_NORM_QC_NO}, + {0x1D44A, UNICODE_NORM_QC_NO}, + {0x1D44B, UNICODE_NORM_QC_NO}, + {0x1D44C, UNICODE_NORM_QC_NO}, + {0x1D44D, UNICODE_NORM_QC_NO}, + {0x1D44E, UNICODE_NORM_QC_NO}, + {0x1D44F, UNICODE_NORM_QC_NO}, + {0x1D450, UNICODE_NORM_QC_NO}, + {0x1D451, UNICODE_NORM_QC_NO}, + {0x1D452, UNICODE_NORM_QC_NO}, + {0x1D453, UNICODE_NORM_QC_NO}, + {0x1D454, UNICODE_NORM_QC_NO}, + {0x1D456, UNICODE_NORM_QC_NO}, + {0x1D457, UNICODE_NORM_QC_NO}, + {0x1D458, UNICODE_NORM_QC_NO}, + {0x1D459, UNICODE_NORM_QC_NO}, + {0x1D45A, UNICODE_NORM_QC_NO}, + {0x1D45B, UNICODE_NORM_QC_NO}, + {0x1D45C, UNICODE_NORM_QC_NO}, + {0x1D45D, UNICODE_NORM_QC_NO}, + {0x1D45E, UNICODE_NORM_QC_NO}, + {0x1D45F, UNICODE_NORM_QC_NO}, + {0x1D460, UNICODE_NORM_QC_NO}, + {0x1D461, UNICODE_NORM_QC_NO}, + {0x1D462, UNICODE_NORM_QC_NO}, + {0x1D463, UNICODE_NORM_QC_NO}, + {0x1D464, UNICODE_NORM_QC_NO}, + {0x1D465, UNICODE_NORM_QC_NO}, + {0x1D466, UNICODE_NORM_QC_NO}, + {0x1D467, UNICODE_NORM_QC_NO}, + {0x1D468, UNICODE_NORM_QC_NO}, + {0x1D469, UNICODE_NORM_QC_NO}, + {0x1D46A, UNICODE_NORM_QC_NO}, + {0x1D46B, UNICODE_NORM_QC_NO}, + {0x1D46C, UNICODE_NORM_QC_NO}, + {0x1D46D, UNICODE_NORM_QC_NO}, + {0x1D46E, UNICODE_NORM_QC_NO}, + {0x1D46F, UNICODE_NORM_QC_NO}, + {0x1D470, UNICODE_NORM_QC_NO}, + {0x1D471, UNICODE_NORM_QC_NO}, + {0x1D472, UNICODE_NORM_QC_NO}, + {0x1D473, UNICODE_NORM_QC_NO}, + {0x1D474, UNICODE_NORM_QC_NO}, + {0x1D475, UNICODE_NORM_QC_NO}, + {0x1D476, UNICODE_NORM_QC_NO}, + {0x1D477, UNICODE_NORM_QC_NO}, + {0x1D478, UNICODE_NORM_QC_NO}, + {0x1D479, UNICODE_NORM_QC_NO}, + {0x1D47A, UNICODE_NORM_QC_NO}, + {0x1D47B, UNICODE_NORM_QC_NO}, + {0x1D47C, UNICODE_NORM_QC_NO}, + {0x1D47D, UNICODE_NORM_QC_NO}, + {0x1D47E, UNICODE_NORM_QC_NO}, + {0x1D47F, UNICODE_NORM_QC_NO}, + {0x1D480, UNICODE_NORM_QC_NO}, + {0x1D481, UNICODE_NORM_QC_NO}, + {0x1D482, UNICODE_NORM_QC_NO}, + {0x1D483, UNICODE_NORM_QC_NO}, + {0x1D484, UNICODE_NORM_QC_NO}, + {0x1D485, UNICODE_NORM_QC_NO}, + {0x1D486, UNICODE_NORM_QC_NO}, + {0x1D487, UNICODE_NORM_QC_NO}, + {0x1D488, UNICODE_NORM_QC_NO}, + {0x1D489, UNICODE_NORM_QC_NO}, + {0x1D48A, UNICODE_NORM_QC_NO}, + {0x1D48B, UNICODE_NORM_QC_NO}, + {0x1D48C, UNICODE_NORM_QC_NO}, + {0x1D48D, UNICODE_NORM_QC_NO}, + {0x1D48E, UNICODE_NORM_QC_NO}, + {0x1D48F, UNICODE_NORM_QC_NO}, + {0x1D490, UNICODE_NORM_QC_NO}, + {0x1D491, UNICODE_NORM_QC_NO}, + {0x1D492, UNICODE_NORM_QC_NO}, + {0x1D493, UNICODE_NORM_QC_NO}, + {0x1D494, UNICODE_NORM_QC_NO}, + {0x1D495, UNICODE_NORM_QC_NO}, + {0x1D496, UNICODE_NORM_QC_NO}, + {0x1D497, UNICODE_NORM_QC_NO}, + {0x1D498, UNICODE_NORM_QC_NO}, + {0x1D499, UNICODE_NORM_QC_NO}, + {0x1D49A, UNICODE_NORM_QC_NO}, + {0x1D49B, UNICODE_NORM_QC_NO}, + {0x1D49C, UNICODE_NORM_QC_NO}, + {0x1D49E, UNICODE_NORM_QC_NO}, + {0x1D49F, UNICODE_NORM_QC_NO}, + {0x1D4A2, UNICODE_NORM_QC_NO}, + {0x1D4A5, UNICODE_NORM_QC_NO}, + {0x1D4A6, UNICODE_NORM_QC_NO}, + {0x1D4A9, UNICODE_NORM_QC_NO}, + {0x1D4AA, UNICODE_NORM_QC_NO}, + {0x1D4AB, UNICODE_NORM_QC_NO}, + {0x1D4AC, UNICODE_NORM_QC_NO}, + {0x1D4AE, UNICODE_NORM_QC_NO}, + {0x1D4AF, UNICODE_NORM_QC_NO}, + {0x1D4B0, UNICODE_NORM_QC_NO}, + {0x1D4B1, UNICODE_NORM_QC_NO}, + {0x1D4B2, UNICODE_NORM_QC_NO}, + {0x1D4B3, UNICODE_NORM_QC_NO}, + {0x1D4B4, UNICODE_NORM_QC_NO}, + {0x1D4B5, UNICODE_NORM_QC_NO}, + {0x1D4B6, UNICODE_NORM_QC_NO}, + {0x1D4B7, UNICODE_NORM_QC_NO}, + {0x1D4B8, UNICODE_NORM_QC_NO}, + {0x1D4B9, UNICODE_NORM_QC_NO}, + {0x1D4BB, UNICODE_NORM_QC_NO}, + {0x1D4BD, UNICODE_NORM_QC_NO}, + {0x1D4BE, UNICODE_NORM_QC_NO}, + {0x1D4BF, UNICODE_NORM_QC_NO}, + {0x1D4C0, UNICODE_NORM_QC_NO}, + {0x1D4C1, UNICODE_NORM_QC_NO}, + {0x1D4C2, UNICODE_NORM_QC_NO}, + {0x1D4C3, UNICODE_NORM_QC_NO}, + {0x1D4C5, UNICODE_NORM_QC_NO}, + {0x1D4C6, UNICODE_NORM_QC_NO}, + {0x1D4C7, UNICODE_NORM_QC_NO}, + {0x1D4C8, UNICODE_NORM_QC_NO}, + {0x1D4C9, UNICODE_NORM_QC_NO}, + {0x1D4CA, UNICODE_NORM_QC_NO}, + {0x1D4CB, UNICODE_NORM_QC_NO}, + {0x1D4CC, UNICODE_NORM_QC_NO}, + {0x1D4CD, UNICODE_NORM_QC_NO}, + {0x1D4CE, UNICODE_NORM_QC_NO}, + {0x1D4CF, UNICODE_NORM_QC_NO}, + {0x1D4D0, UNICODE_NORM_QC_NO}, + {0x1D4D1, UNICODE_NORM_QC_NO}, + {0x1D4D2, UNICODE_NORM_QC_NO}, + {0x1D4D3, UNICODE_NORM_QC_NO}, + {0x1D4D4, UNICODE_NORM_QC_NO}, + {0x1D4D5, UNICODE_NORM_QC_NO}, + {0x1D4D6, UNICODE_NORM_QC_NO}, + {0x1D4D7, UNICODE_NORM_QC_NO}, + {0x1D4D8, UNICODE_NORM_QC_NO}, + {0x1D4D9, UNICODE_NORM_QC_NO}, + {0x1D4DA, UNICODE_NORM_QC_NO}, + {0x1D4DB, UNICODE_NORM_QC_NO}, + {0x1D4DC, UNICODE_NORM_QC_NO}, + {0x1D4DD, UNICODE_NORM_QC_NO}, + {0x1D4DE, UNICODE_NORM_QC_NO}, + {0x1D4DF, UNICODE_NORM_QC_NO}, + {0x1D4E0, UNICODE_NORM_QC_NO}, + {0x1D4E1, UNICODE_NORM_QC_NO}, + {0x1D4E2, UNICODE_NORM_QC_NO}, + {0x1D4E3, UNICODE_NORM_QC_NO}, + {0x1D4E4, UNICODE_NORM_QC_NO}, + {0x1D4E5, UNICODE_NORM_QC_NO}, + {0x1D4E6, UNICODE_NORM_QC_NO}, + {0x1D4E7, UNICODE_NORM_QC_NO}, + {0x1D4E8, UNICODE_NORM_QC_NO}, + {0x1D4E9, UNICODE_NORM_QC_NO}, + {0x1D4EA, UNICODE_NORM_QC_NO}, + {0x1D4EB, UNICODE_NORM_QC_NO}, + {0x1D4EC, UNICODE_NORM_QC_NO}, + {0x1D4ED, UNICODE_NORM_QC_NO}, + {0x1D4EE, UNICODE_NORM_QC_NO}, + {0x1D4EF, UNICODE_NORM_QC_NO}, + {0x1D4F0, UNICODE_NORM_QC_NO}, + {0x1D4F1, UNICODE_NORM_QC_NO}, + {0x1D4F2, UNICODE_NORM_QC_NO}, + {0x1D4F3, UNICODE_NORM_QC_NO}, + {0x1D4F4, UNICODE_NORM_QC_NO}, + {0x1D4F5, UNICODE_NORM_QC_NO}, + {0x1D4F6, UNICODE_NORM_QC_NO}, + {0x1D4F7, UNICODE_NORM_QC_NO}, + {0x1D4F8, UNICODE_NORM_QC_NO}, + {0x1D4F9, UNICODE_NORM_QC_NO}, + {0x1D4FA, UNICODE_NORM_QC_NO}, + {0x1D4FB, UNICODE_NORM_QC_NO}, + {0x1D4FC, UNICODE_NORM_QC_NO}, + {0x1D4FD, UNICODE_NORM_QC_NO}, + {0x1D4FE, UNICODE_NORM_QC_NO}, + {0x1D4FF, UNICODE_NORM_QC_NO}, + {0x1D500, UNICODE_NORM_QC_NO}, + {0x1D501, UNICODE_NORM_QC_NO}, + {0x1D502, UNICODE_NORM_QC_NO}, + {0x1D503, UNICODE_NORM_QC_NO}, + {0x1D504, UNICODE_NORM_QC_NO}, + {0x1D505, UNICODE_NORM_QC_NO}, + {0x1D507, UNICODE_NORM_QC_NO}, + {0x1D508, UNICODE_NORM_QC_NO}, + {0x1D509, UNICODE_NORM_QC_NO}, + {0x1D50A, UNICODE_NORM_QC_NO}, + {0x1D50D, UNICODE_NORM_QC_NO}, + {0x1D50E, UNICODE_NORM_QC_NO}, + {0x1D50F, UNICODE_NORM_QC_NO}, + {0x1D510, UNICODE_NORM_QC_NO}, + {0x1D511, UNICODE_NORM_QC_NO}, + {0x1D512, UNICODE_NORM_QC_NO}, + {0x1D513, UNICODE_NORM_QC_NO}, + {0x1D514, UNICODE_NORM_QC_NO}, + {0x1D516, UNICODE_NORM_QC_NO}, + {0x1D517, UNICODE_NORM_QC_NO}, + {0x1D518, UNICODE_NORM_QC_NO}, + {0x1D519, UNICODE_NORM_QC_NO}, + {0x1D51A, UNICODE_NORM_QC_NO}, + {0x1D51B, UNICODE_NORM_QC_NO}, + {0x1D51C, UNICODE_NORM_QC_NO}, + {0x1D51E, UNICODE_NORM_QC_NO}, + {0x1D51F, UNICODE_NORM_QC_NO}, + {0x1D520, UNICODE_NORM_QC_NO}, + {0x1D521, UNICODE_NORM_QC_NO}, + {0x1D522, UNICODE_NORM_QC_NO}, + {0x1D523, UNICODE_NORM_QC_NO}, + {0x1D524, UNICODE_NORM_QC_NO}, + {0x1D525, UNICODE_NORM_QC_NO}, + {0x1D526, UNICODE_NORM_QC_NO}, + {0x1D527, UNICODE_NORM_QC_NO}, + {0x1D528, UNICODE_NORM_QC_NO}, + {0x1D529, UNICODE_NORM_QC_NO}, + {0x1D52A, UNICODE_NORM_QC_NO}, + {0x1D52B, UNICODE_NORM_QC_NO}, + {0x1D52C, UNICODE_NORM_QC_NO}, + {0x1D52D, UNICODE_NORM_QC_NO}, + {0x1D52E, UNICODE_NORM_QC_NO}, + {0x1D52F, UNICODE_NORM_QC_NO}, + {0x1D530, UNICODE_NORM_QC_NO}, + {0x1D531, UNICODE_NORM_QC_NO}, + {0x1D532, UNICODE_NORM_QC_NO}, + {0x1D533, UNICODE_NORM_QC_NO}, + {0x1D534, UNICODE_NORM_QC_NO}, + {0x1D535, UNICODE_NORM_QC_NO}, + {0x1D536, UNICODE_NORM_QC_NO}, + {0x1D537, UNICODE_NORM_QC_NO}, + {0x1D538, UNICODE_NORM_QC_NO}, + {0x1D539, UNICODE_NORM_QC_NO}, + {0x1D53B, UNICODE_NORM_QC_NO}, + {0x1D53C, UNICODE_NORM_QC_NO}, + {0x1D53D, UNICODE_NORM_QC_NO}, + {0x1D53E, UNICODE_NORM_QC_NO}, + {0x1D540, UNICODE_NORM_QC_NO}, + {0x1D541, UNICODE_NORM_QC_NO}, + {0x1D542, UNICODE_NORM_QC_NO}, + {0x1D543, UNICODE_NORM_QC_NO}, + {0x1D544, UNICODE_NORM_QC_NO}, + {0x1D546, UNICODE_NORM_QC_NO}, + {0x1D54A, UNICODE_NORM_QC_NO}, + {0x1D54B, UNICODE_NORM_QC_NO}, + {0x1D54C, UNICODE_NORM_QC_NO}, + {0x1D54D, UNICODE_NORM_QC_NO}, + {0x1D54E, UNICODE_NORM_QC_NO}, + {0x1D54F, UNICODE_NORM_QC_NO}, + {0x1D550, UNICODE_NORM_QC_NO}, + {0x1D552, UNICODE_NORM_QC_NO}, + {0x1D553, UNICODE_NORM_QC_NO}, + {0x1D554, UNICODE_NORM_QC_NO}, + {0x1D555, UNICODE_NORM_QC_NO}, + {0x1D556, UNICODE_NORM_QC_NO}, + {0x1D557, UNICODE_NORM_QC_NO}, + {0x1D558, UNICODE_NORM_QC_NO}, + {0x1D559, UNICODE_NORM_QC_NO}, + {0x1D55A, UNICODE_NORM_QC_NO}, + {0x1D55B, UNICODE_NORM_QC_NO}, + {0x1D55C, UNICODE_NORM_QC_NO}, + {0x1D55D, UNICODE_NORM_QC_NO}, + {0x1D55E, UNICODE_NORM_QC_NO}, + {0x1D55F, UNICODE_NORM_QC_NO}, + {0x1D560, UNICODE_NORM_QC_NO}, + {0x1D561, UNICODE_NORM_QC_NO}, + {0x1D562, UNICODE_NORM_QC_NO}, + {0x1D563, UNICODE_NORM_QC_NO}, + {0x1D564, UNICODE_NORM_QC_NO}, + {0x1D565, UNICODE_NORM_QC_NO}, + {0x1D566, UNICODE_NORM_QC_NO}, + {0x1D567, UNICODE_NORM_QC_NO}, + {0x1D568, UNICODE_NORM_QC_NO}, + {0x1D569, UNICODE_NORM_QC_NO}, + {0x1D56A, UNICODE_NORM_QC_NO}, + {0x1D56B, UNICODE_NORM_QC_NO}, + {0x1D56C, UNICODE_NORM_QC_NO}, + {0x1D56D, UNICODE_NORM_QC_NO}, + {0x1D56E, UNICODE_NORM_QC_NO}, + {0x1D56F, UNICODE_NORM_QC_NO}, + {0x1D570, UNICODE_NORM_QC_NO}, + {0x1D571, UNICODE_NORM_QC_NO}, + {0x1D572, UNICODE_NORM_QC_NO}, + {0x1D573, UNICODE_NORM_QC_NO}, + {0x1D574, UNICODE_NORM_QC_NO}, + {0x1D575, UNICODE_NORM_QC_NO}, + {0x1D576, UNICODE_NORM_QC_NO}, + {0x1D577, UNICODE_NORM_QC_NO}, + {0x1D578, UNICODE_NORM_QC_NO}, + {0x1D579, UNICODE_NORM_QC_NO}, + {0x1D57A, UNICODE_NORM_QC_NO}, + {0x1D57B, UNICODE_NORM_QC_NO}, + {0x1D57C, UNICODE_NORM_QC_NO}, + {0x1D57D, UNICODE_NORM_QC_NO}, + {0x1D57E, UNICODE_NORM_QC_NO}, + {0x1D57F, UNICODE_NORM_QC_NO}, + {0x1D580, UNICODE_NORM_QC_NO}, + {0x1D581, UNICODE_NORM_QC_NO}, + {0x1D582, UNICODE_NORM_QC_NO}, + {0x1D583, UNICODE_NORM_QC_NO}, + {0x1D584, UNICODE_NORM_QC_NO}, + {0x1D585, UNICODE_NORM_QC_NO}, + {0x1D586, UNICODE_NORM_QC_NO}, + {0x1D587, UNICODE_NORM_QC_NO}, + {0x1D588, UNICODE_NORM_QC_NO}, + {0x1D589, UNICODE_NORM_QC_NO}, + {0x1D58A, UNICODE_NORM_QC_NO}, + {0x1D58B, UNICODE_NORM_QC_NO}, + {0x1D58C, UNICODE_NORM_QC_NO}, + {0x1D58D, UNICODE_NORM_QC_NO}, + {0x1D58E, UNICODE_NORM_QC_NO}, + {0x1D58F, UNICODE_NORM_QC_NO}, + {0x1D590, UNICODE_NORM_QC_NO}, + {0x1D591, UNICODE_NORM_QC_NO}, + {0x1D592, UNICODE_NORM_QC_NO}, + {0x1D593, UNICODE_NORM_QC_NO}, + {0x1D594, UNICODE_NORM_QC_NO}, + {0x1D595, UNICODE_NORM_QC_NO}, + {0x1D596, UNICODE_NORM_QC_NO}, + {0x1D597, UNICODE_NORM_QC_NO}, + {0x1D598, UNICODE_NORM_QC_NO}, + {0x1D599, UNICODE_NORM_QC_NO}, + {0x1D59A, UNICODE_NORM_QC_NO}, + {0x1D59B, UNICODE_NORM_QC_NO}, + {0x1D59C, UNICODE_NORM_QC_NO}, + {0x1D59D, UNICODE_NORM_QC_NO}, + {0x1D59E, UNICODE_NORM_QC_NO}, + {0x1D59F, UNICODE_NORM_QC_NO}, + {0x1D5A0, UNICODE_NORM_QC_NO}, + {0x1D5A1, UNICODE_NORM_QC_NO}, + {0x1D5A2, UNICODE_NORM_QC_NO}, + {0x1D5A3, UNICODE_NORM_QC_NO}, + {0x1D5A4, UNICODE_NORM_QC_NO}, + {0x1D5A5, UNICODE_NORM_QC_NO}, + {0x1D5A6, UNICODE_NORM_QC_NO}, + {0x1D5A7, UNICODE_NORM_QC_NO}, + {0x1D5A8, UNICODE_NORM_QC_NO}, + {0x1D5A9, UNICODE_NORM_QC_NO}, + {0x1D5AA, UNICODE_NORM_QC_NO}, + {0x1D5AB, UNICODE_NORM_QC_NO}, + {0x1D5AC, UNICODE_NORM_QC_NO}, + {0x1D5AD, UNICODE_NORM_QC_NO}, + {0x1D5AE, UNICODE_NORM_QC_NO}, + {0x1D5AF, UNICODE_NORM_QC_NO}, + {0x1D5B0, UNICODE_NORM_QC_NO}, + {0x1D5B1, UNICODE_NORM_QC_NO}, + {0x1D5B2, UNICODE_NORM_QC_NO}, + {0x1D5B3, UNICODE_NORM_QC_NO}, + {0x1D5B4, UNICODE_NORM_QC_NO}, + {0x1D5B5, UNICODE_NORM_QC_NO}, + {0x1D5B6, UNICODE_NORM_QC_NO}, + {0x1D5B7, UNICODE_NORM_QC_NO}, + {0x1D5B8, UNICODE_NORM_QC_NO}, + {0x1D5B9, UNICODE_NORM_QC_NO}, + {0x1D5BA, UNICODE_NORM_QC_NO}, + {0x1D5BB, UNICODE_NORM_QC_NO}, + {0x1D5BC, UNICODE_NORM_QC_NO}, + {0x1D5BD, UNICODE_NORM_QC_NO}, + {0x1D5BE, UNICODE_NORM_QC_NO}, + {0x1D5BF, UNICODE_NORM_QC_NO}, + {0x1D5C0, UNICODE_NORM_QC_NO}, + {0x1D5C1, UNICODE_NORM_QC_NO}, + {0x1D5C2, UNICODE_NORM_QC_NO}, + {0x1D5C3, UNICODE_NORM_QC_NO}, + {0x1D5C4, UNICODE_NORM_QC_NO}, + {0x1D5C5, UNICODE_NORM_QC_NO}, + {0x1D5C6, UNICODE_NORM_QC_NO}, + {0x1D5C7, UNICODE_NORM_QC_NO}, + {0x1D5C8, UNICODE_NORM_QC_NO}, + {0x1D5C9, UNICODE_NORM_QC_NO}, + {0x1D5CA, UNICODE_NORM_QC_NO}, + {0x1D5CB, UNICODE_NORM_QC_NO}, + {0x1D5CC, UNICODE_NORM_QC_NO}, + {0x1D5CD, UNICODE_NORM_QC_NO}, + {0x1D5CE, UNICODE_NORM_QC_NO}, + {0x1D5CF, UNICODE_NORM_QC_NO}, + {0x1D5D0, UNICODE_NORM_QC_NO}, + {0x1D5D1, UNICODE_NORM_QC_NO}, + {0x1D5D2, UNICODE_NORM_QC_NO}, + {0x1D5D3, UNICODE_NORM_QC_NO}, + {0x1D5D4, UNICODE_NORM_QC_NO}, + {0x1D5D5, UNICODE_NORM_QC_NO}, + {0x1D5D6, UNICODE_NORM_QC_NO}, + {0x1D5D7, UNICODE_NORM_QC_NO}, + {0x1D5D8, UNICODE_NORM_QC_NO}, + {0x1D5D9, UNICODE_NORM_QC_NO}, + {0x1D5DA, UNICODE_NORM_QC_NO}, + {0x1D5DB, UNICODE_NORM_QC_NO}, + {0x1D5DC, UNICODE_NORM_QC_NO}, + {0x1D5DD, UNICODE_NORM_QC_NO}, + {0x1D5DE, UNICODE_NORM_QC_NO}, + {0x1D5DF, UNICODE_NORM_QC_NO}, + {0x1D5E0, UNICODE_NORM_QC_NO}, + {0x1D5E1, UNICODE_NORM_QC_NO}, + {0x1D5E2, UNICODE_NORM_QC_NO}, + {0x1D5E3, UNICODE_NORM_QC_NO}, + {0x1D5E4, UNICODE_NORM_QC_NO}, + {0x1D5E5, UNICODE_NORM_QC_NO}, + {0x1D5E6, UNICODE_NORM_QC_NO}, + {0x1D5E7, UNICODE_NORM_QC_NO}, + {0x1D5E8, UNICODE_NORM_QC_NO}, + {0x1D5E9, UNICODE_NORM_QC_NO}, + {0x1D5EA, UNICODE_NORM_QC_NO}, + {0x1D5EB, UNICODE_NORM_QC_NO}, + {0x1D5EC, UNICODE_NORM_QC_NO}, + {0x1D5ED, UNICODE_NORM_QC_NO}, + {0x1D5EE, UNICODE_NORM_QC_NO}, + {0x1D5EF, UNICODE_NORM_QC_NO}, + {0x1D5F0, UNICODE_NORM_QC_NO}, + {0x1D5F1, UNICODE_NORM_QC_NO}, + {0x1D5F2, UNICODE_NORM_QC_NO}, + {0x1D5F3, UNICODE_NORM_QC_NO}, + {0x1D5F4, UNICODE_NORM_QC_NO}, + {0x1D5F5, UNICODE_NORM_QC_NO}, + {0x1D5F6, UNICODE_NORM_QC_NO}, + {0x1D5F7, UNICODE_NORM_QC_NO}, + {0x1D5F8, UNICODE_NORM_QC_NO}, + {0x1D5F9, UNICODE_NORM_QC_NO}, + {0x1D5FA, UNICODE_NORM_QC_NO}, + {0x1D5FB, UNICODE_NORM_QC_NO}, + {0x1D5FC, UNICODE_NORM_QC_NO}, + {0x1D5FD, UNICODE_NORM_QC_NO}, + {0x1D5FE, UNICODE_NORM_QC_NO}, + {0x1D5FF, UNICODE_NORM_QC_NO}, + {0x1D600, UNICODE_NORM_QC_NO}, + {0x1D601, UNICODE_NORM_QC_NO}, + {0x1D602, UNICODE_NORM_QC_NO}, + {0x1D603, UNICODE_NORM_QC_NO}, + {0x1D604, UNICODE_NORM_QC_NO}, + {0x1D605, UNICODE_NORM_QC_NO}, + {0x1D606, UNICODE_NORM_QC_NO}, + {0x1D607, UNICODE_NORM_QC_NO}, + {0x1D608, UNICODE_NORM_QC_NO}, + {0x1D609, UNICODE_NORM_QC_NO}, + {0x1D60A, UNICODE_NORM_QC_NO}, + {0x1D60B, UNICODE_NORM_QC_NO}, + {0x1D60C, UNICODE_NORM_QC_NO}, + {0x1D60D, UNICODE_NORM_QC_NO}, + {0x1D60E, UNICODE_NORM_QC_NO}, + {0x1D60F, UNICODE_NORM_QC_NO}, + {0x1D610, UNICODE_NORM_QC_NO}, + {0x1D611, UNICODE_NORM_QC_NO}, + {0x1D612, UNICODE_NORM_QC_NO}, + {0x1D613, UNICODE_NORM_QC_NO}, + {0x1D614, UNICODE_NORM_QC_NO}, + {0x1D615, UNICODE_NORM_QC_NO}, + {0x1D616, UNICODE_NORM_QC_NO}, + {0x1D617, UNICODE_NORM_QC_NO}, + {0x1D618, UNICODE_NORM_QC_NO}, + {0x1D619, UNICODE_NORM_QC_NO}, + {0x1D61A, UNICODE_NORM_QC_NO}, + {0x1D61B, UNICODE_NORM_QC_NO}, + {0x1D61C, UNICODE_NORM_QC_NO}, + {0x1D61D, UNICODE_NORM_QC_NO}, + {0x1D61E, UNICODE_NORM_QC_NO}, + {0x1D61F, UNICODE_NORM_QC_NO}, + {0x1D620, UNICODE_NORM_QC_NO}, + {0x1D621, UNICODE_NORM_QC_NO}, + {0x1D622, UNICODE_NORM_QC_NO}, + {0x1D623, UNICODE_NORM_QC_NO}, + {0x1D624, UNICODE_NORM_QC_NO}, + {0x1D625, UNICODE_NORM_QC_NO}, + {0x1D626, UNICODE_NORM_QC_NO}, + {0x1D627, UNICODE_NORM_QC_NO}, + {0x1D628, UNICODE_NORM_QC_NO}, + {0x1D629, UNICODE_NORM_QC_NO}, + {0x1D62A, UNICODE_NORM_QC_NO}, + {0x1D62B, UNICODE_NORM_QC_NO}, + {0x1D62C, UNICODE_NORM_QC_NO}, + {0x1D62D, UNICODE_NORM_QC_NO}, + {0x1D62E, UNICODE_NORM_QC_NO}, + {0x1D62F, UNICODE_NORM_QC_NO}, + {0x1D630, UNICODE_NORM_QC_NO}, + {0x1D631, UNICODE_NORM_QC_NO}, + {0x1D632, UNICODE_NORM_QC_NO}, + {0x1D633, UNICODE_NORM_QC_NO}, + {0x1D634, UNICODE_NORM_QC_NO}, + {0x1D635, UNICODE_NORM_QC_NO}, + {0x1D636, UNICODE_NORM_QC_NO}, + {0x1D637, UNICODE_NORM_QC_NO}, + {0x1D638, UNICODE_NORM_QC_NO}, + {0x1D639, UNICODE_NORM_QC_NO}, + {0x1D63A, UNICODE_NORM_QC_NO}, + {0x1D63B, UNICODE_NORM_QC_NO}, + {0x1D63C, UNICODE_NORM_QC_NO}, + {0x1D63D, UNICODE_NORM_QC_NO}, + {0x1D63E, UNICODE_NORM_QC_NO}, + {0x1D63F, UNICODE_NORM_QC_NO}, + {0x1D640, UNICODE_NORM_QC_NO}, + {0x1D641, UNICODE_NORM_QC_NO}, + {0x1D642, UNICODE_NORM_QC_NO}, + {0x1D643, UNICODE_NORM_QC_NO}, + {0x1D644, UNICODE_NORM_QC_NO}, + {0x1D645, UNICODE_NORM_QC_NO}, + {0x1D646, UNICODE_NORM_QC_NO}, + {0x1D647, UNICODE_NORM_QC_NO}, + {0x1D648, UNICODE_NORM_QC_NO}, + {0x1D649, UNICODE_NORM_QC_NO}, + {0x1D64A, UNICODE_NORM_QC_NO}, + {0x1D64B, UNICODE_NORM_QC_NO}, + {0x1D64C, UNICODE_NORM_QC_NO}, + {0x1D64D, UNICODE_NORM_QC_NO}, + {0x1D64E, UNICODE_NORM_QC_NO}, + {0x1D64F, UNICODE_NORM_QC_NO}, + {0x1D650, UNICODE_NORM_QC_NO}, + {0x1D651, UNICODE_NORM_QC_NO}, + {0x1D652, UNICODE_NORM_QC_NO}, + {0x1D653, UNICODE_NORM_QC_NO}, + {0x1D654, UNICODE_NORM_QC_NO}, + {0x1D655, UNICODE_NORM_QC_NO}, + {0x1D656, UNICODE_NORM_QC_NO}, + {0x1D657, UNICODE_NORM_QC_NO}, + {0x1D658, UNICODE_NORM_QC_NO}, + {0x1D659, UNICODE_NORM_QC_NO}, + {0x1D65A, UNICODE_NORM_QC_NO}, + {0x1D65B, UNICODE_NORM_QC_NO}, + {0x1D65C, UNICODE_NORM_QC_NO}, + {0x1D65D, UNICODE_NORM_QC_NO}, + {0x1D65E, UNICODE_NORM_QC_NO}, + {0x1D65F, UNICODE_NORM_QC_NO}, + {0x1D660, UNICODE_NORM_QC_NO}, + {0x1D661, UNICODE_NORM_QC_NO}, + {0x1D662, UNICODE_NORM_QC_NO}, + {0x1D663, UNICODE_NORM_QC_NO}, + {0x1D664, UNICODE_NORM_QC_NO}, + {0x1D665, UNICODE_NORM_QC_NO}, + {0x1D666, UNICODE_NORM_QC_NO}, + {0x1D667, UNICODE_NORM_QC_NO}, + {0x1D668, UNICODE_NORM_QC_NO}, + {0x1D669, UNICODE_NORM_QC_NO}, + {0x1D66A, UNICODE_NORM_QC_NO}, + {0x1D66B, UNICODE_NORM_QC_NO}, + {0x1D66C, UNICODE_NORM_QC_NO}, + {0x1D66D, UNICODE_NORM_QC_NO}, + {0x1D66E, UNICODE_NORM_QC_NO}, + {0x1D66F, UNICODE_NORM_QC_NO}, + {0x1D670, UNICODE_NORM_QC_NO}, + {0x1D671, UNICODE_NORM_QC_NO}, + {0x1D672, UNICODE_NORM_QC_NO}, + {0x1D673, UNICODE_NORM_QC_NO}, + {0x1D674, UNICODE_NORM_QC_NO}, + {0x1D675, UNICODE_NORM_QC_NO}, + {0x1D676, UNICODE_NORM_QC_NO}, + {0x1D677, UNICODE_NORM_QC_NO}, + {0x1D678, UNICODE_NORM_QC_NO}, + {0x1D679, UNICODE_NORM_QC_NO}, + {0x1D67A, UNICODE_NORM_QC_NO}, + {0x1D67B, UNICODE_NORM_QC_NO}, + {0x1D67C, UNICODE_NORM_QC_NO}, + {0x1D67D, UNICODE_NORM_QC_NO}, + {0x1D67E, UNICODE_NORM_QC_NO}, + {0x1D67F, UNICODE_NORM_QC_NO}, + {0x1D680, UNICODE_NORM_QC_NO}, + {0x1D681, UNICODE_NORM_QC_NO}, + {0x1D682, UNICODE_NORM_QC_NO}, + {0x1D683, UNICODE_NORM_QC_NO}, + {0x1D684, UNICODE_NORM_QC_NO}, + {0x1D685, UNICODE_NORM_QC_NO}, + {0x1D686, UNICODE_NORM_QC_NO}, + {0x1D687, UNICODE_NORM_QC_NO}, + {0x1D688, UNICODE_NORM_QC_NO}, + {0x1D689, UNICODE_NORM_QC_NO}, + {0x1D68A, UNICODE_NORM_QC_NO}, + {0x1D68B, UNICODE_NORM_QC_NO}, + {0x1D68C, UNICODE_NORM_QC_NO}, + {0x1D68D, UNICODE_NORM_QC_NO}, + {0x1D68E, UNICODE_NORM_QC_NO}, + {0x1D68F, UNICODE_NORM_QC_NO}, + {0x1D690, UNICODE_NORM_QC_NO}, + {0x1D691, UNICODE_NORM_QC_NO}, + {0x1D692, UNICODE_NORM_QC_NO}, + {0x1D693, UNICODE_NORM_QC_NO}, + {0x1D694, UNICODE_NORM_QC_NO}, + {0x1D695, UNICODE_NORM_QC_NO}, + {0x1D696, UNICODE_NORM_QC_NO}, + {0x1D697, UNICODE_NORM_QC_NO}, + {0x1D698, UNICODE_NORM_QC_NO}, + {0x1D699, UNICODE_NORM_QC_NO}, + {0x1D69A, UNICODE_NORM_QC_NO}, + {0x1D69B, UNICODE_NORM_QC_NO}, + {0x1D69C, UNICODE_NORM_QC_NO}, + {0x1D69D, UNICODE_NORM_QC_NO}, + {0x1D69E, UNICODE_NORM_QC_NO}, + {0x1D69F, UNICODE_NORM_QC_NO}, + {0x1D6A0, UNICODE_NORM_QC_NO}, + {0x1D6A1, UNICODE_NORM_QC_NO}, + {0x1D6A2, UNICODE_NORM_QC_NO}, + {0x1D6A3, UNICODE_NORM_QC_NO}, + {0x1D6A4, UNICODE_NORM_QC_NO}, + {0x1D6A5, UNICODE_NORM_QC_NO}, + {0x1D6A8, UNICODE_NORM_QC_NO}, + {0x1D6A9, UNICODE_NORM_QC_NO}, + {0x1D6AA, UNICODE_NORM_QC_NO}, + {0x1D6AB, UNICODE_NORM_QC_NO}, + {0x1D6AC, UNICODE_NORM_QC_NO}, + {0x1D6AD, UNICODE_NORM_QC_NO}, + {0x1D6AE, UNICODE_NORM_QC_NO}, + {0x1D6AF, UNICODE_NORM_QC_NO}, + {0x1D6B0, UNICODE_NORM_QC_NO}, + {0x1D6B1, UNICODE_NORM_QC_NO}, + {0x1D6B2, UNICODE_NORM_QC_NO}, + {0x1D6B3, UNICODE_NORM_QC_NO}, + {0x1D6B4, UNICODE_NORM_QC_NO}, + {0x1D6B5, UNICODE_NORM_QC_NO}, + {0x1D6B6, UNICODE_NORM_QC_NO}, + {0x1D6B7, UNICODE_NORM_QC_NO}, + {0x1D6B8, UNICODE_NORM_QC_NO}, + {0x1D6B9, UNICODE_NORM_QC_NO}, + {0x1D6BA, UNICODE_NORM_QC_NO}, + {0x1D6BB, UNICODE_NORM_QC_NO}, + {0x1D6BC, UNICODE_NORM_QC_NO}, + {0x1D6BD, UNICODE_NORM_QC_NO}, + {0x1D6BE, UNICODE_NORM_QC_NO}, + {0x1D6BF, UNICODE_NORM_QC_NO}, + {0x1D6C0, UNICODE_NORM_QC_NO}, + {0x1D6C1, UNICODE_NORM_QC_NO}, + {0x1D6C2, UNICODE_NORM_QC_NO}, + {0x1D6C3, UNICODE_NORM_QC_NO}, + {0x1D6C4, UNICODE_NORM_QC_NO}, + {0x1D6C5, UNICODE_NORM_QC_NO}, + {0x1D6C6, UNICODE_NORM_QC_NO}, + {0x1D6C7, UNICODE_NORM_QC_NO}, + {0x1D6C8, UNICODE_NORM_QC_NO}, + {0x1D6C9, UNICODE_NORM_QC_NO}, + {0x1D6CA, UNICODE_NORM_QC_NO}, + {0x1D6CB, UNICODE_NORM_QC_NO}, + {0x1D6CC, UNICODE_NORM_QC_NO}, + {0x1D6CD, UNICODE_NORM_QC_NO}, + {0x1D6CE, UNICODE_NORM_QC_NO}, + {0x1D6CF, UNICODE_NORM_QC_NO}, + {0x1D6D0, UNICODE_NORM_QC_NO}, + {0x1D6D1, UNICODE_NORM_QC_NO}, + {0x1D6D2, UNICODE_NORM_QC_NO}, + {0x1D6D3, UNICODE_NORM_QC_NO}, + {0x1D6D4, UNICODE_NORM_QC_NO}, + {0x1D6D5, UNICODE_NORM_QC_NO}, + {0x1D6D6, UNICODE_NORM_QC_NO}, + {0x1D6D7, UNICODE_NORM_QC_NO}, + {0x1D6D8, UNICODE_NORM_QC_NO}, + {0x1D6D9, UNICODE_NORM_QC_NO}, + {0x1D6DA, UNICODE_NORM_QC_NO}, + {0x1D6DB, UNICODE_NORM_QC_NO}, + {0x1D6DC, UNICODE_NORM_QC_NO}, + {0x1D6DD, UNICODE_NORM_QC_NO}, + {0x1D6DE, UNICODE_NORM_QC_NO}, + {0x1D6DF, UNICODE_NORM_QC_NO}, + {0x1D6E0, UNICODE_NORM_QC_NO}, + {0x1D6E1, UNICODE_NORM_QC_NO}, + {0x1D6E2, UNICODE_NORM_QC_NO}, + {0x1D6E3, UNICODE_NORM_QC_NO}, + {0x1D6E4, UNICODE_NORM_QC_NO}, + {0x1D6E5, UNICODE_NORM_QC_NO}, + {0x1D6E6, UNICODE_NORM_QC_NO}, + {0x1D6E7, UNICODE_NORM_QC_NO}, + {0x1D6E8, UNICODE_NORM_QC_NO}, + {0x1D6E9, UNICODE_NORM_QC_NO}, + {0x1D6EA, UNICODE_NORM_QC_NO}, + {0x1D6EB, UNICODE_NORM_QC_NO}, + {0x1D6EC, UNICODE_NORM_QC_NO}, + {0x1D6ED, UNICODE_NORM_QC_NO}, + {0x1D6EE, UNICODE_NORM_QC_NO}, + {0x1D6EF, UNICODE_NORM_QC_NO}, + {0x1D6F0, UNICODE_NORM_QC_NO}, + {0x1D6F1, UNICODE_NORM_QC_NO}, + {0x1D6F2, UNICODE_NORM_QC_NO}, + {0x1D6F3, UNICODE_NORM_QC_NO}, + {0x1D6F4, UNICODE_NORM_QC_NO}, + {0x1D6F5, UNICODE_NORM_QC_NO}, + {0x1D6F6, UNICODE_NORM_QC_NO}, + {0x1D6F7, UNICODE_NORM_QC_NO}, + {0x1D6F8, UNICODE_NORM_QC_NO}, + {0x1D6F9, UNICODE_NORM_QC_NO}, + {0x1D6FA, UNICODE_NORM_QC_NO}, + {0x1D6FB, UNICODE_NORM_QC_NO}, + {0x1D6FC, UNICODE_NORM_QC_NO}, + {0x1D6FD, UNICODE_NORM_QC_NO}, + {0x1D6FE, UNICODE_NORM_QC_NO}, + {0x1D6FF, UNICODE_NORM_QC_NO}, + {0x1D700, UNICODE_NORM_QC_NO}, + {0x1D701, UNICODE_NORM_QC_NO}, + {0x1D702, UNICODE_NORM_QC_NO}, + {0x1D703, UNICODE_NORM_QC_NO}, + {0x1D704, UNICODE_NORM_QC_NO}, + {0x1D705, UNICODE_NORM_QC_NO}, + {0x1D706, UNICODE_NORM_QC_NO}, + {0x1D707, UNICODE_NORM_QC_NO}, + {0x1D708, UNICODE_NORM_QC_NO}, + {0x1D709, UNICODE_NORM_QC_NO}, + {0x1D70A, UNICODE_NORM_QC_NO}, + {0x1D70B, UNICODE_NORM_QC_NO}, + {0x1D70C, UNICODE_NORM_QC_NO}, + {0x1D70D, UNICODE_NORM_QC_NO}, + {0x1D70E, UNICODE_NORM_QC_NO}, + {0x1D70F, UNICODE_NORM_QC_NO}, + {0x1D710, UNICODE_NORM_QC_NO}, + {0x1D711, UNICODE_NORM_QC_NO}, + {0x1D712, UNICODE_NORM_QC_NO}, + {0x1D713, UNICODE_NORM_QC_NO}, + {0x1D714, UNICODE_NORM_QC_NO}, + {0x1D715, UNICODE_NORM_QC_NO}, + {0x1D716, UNICODE_NORM_QC_NO}, + {0x1D717, UNICODE_NORM_QC_NO}, + {0x1D718, UNICODE_NORM_QC_NO}, + {0x1D719, UNICODE_NORM_QC_NO}, + {0x1D71A, UNICODE_NORM_QC_NO}, + {0x1D71B, UNICODE_NORM_QC_NO}, + {0x1D71C, UNICODE_NORM_QC_NO}, + {0x1D71D, UNICODE_NORM_QC_NO}, + {0x1D71E, UNICODE_NORM_QC_NO}, + {0x1D71F, UNICODE_NORM_QC_NO}, + {0x1D720, UNICODE_NORM_QC_NO}, + {0x1D721, UNICODE_NORM_QC_NO}, + {0x1D722, UNICODE_NORM_QC_NO}, + {0x1D723, UNICODE_NORM_QC_NO}, + {0x1D724, UNICODE_NORM_QC_NO}, + {0x1D725, UNICODE_NORM_QC_NO}, + {0x1D726, UNICODE_NORM_QC_NO}, + {0x1D727, UNICODE_NORM_QC_NO}, + {0x1D728, UNICODE_NORM_QC_NO}, + {0x1D729, UNICODE_NORM_QC_NO}, + {0x1D72A, UNICODE_NORM_QC_NO}, + {0x1D72B, UNICODE_NORM_QC_NO}, + {0x1D72C, UNICODE_NORM_QC_NO}, + {0x1D72D, UNICODE_NORM_QC_NO}, + {0x1D72E, UNICODE_NORM_QC_NO}, + {0x1D72F, UNICODE_NORM_QC_NO}, + {0x1D730, UNICODE_NORM_QC_NO}, + {0x1D731, UNICODE_NORM_QC_NO}, + {0x1D732, UNICODE_NORM_QC_NO}, + {0x1D733, UNICODE_NORM_QC_NO}, + {0x1D734, UNICODE_NORM_QC_NO}, + {0x1D735, UNICODE_NORM_QC_NO}, + {0x1D736, UNICODE_NORM_QC_NO}, + {0x1D737, UNICODE_NORM_QC_NO}, + {0x1D738, UNICODE_NORM_QC_NO}, + {0x1D739, UNICODE_NORM_QC_NO}, + {0x1D73A, UNICODE_NORM_QC_NO}, + {0x1D73B, UNICODE_NORM_QC_NO}, + {0x1D73C, UNICODE_NORM_QC_NO}, + {0x1D73D, UNICODE_NORM_QC_NO}, + {0x1D73E, UNICODE_NORM_QC_NO}, + {0x1D73F, UNICODE_NORM_QC_NO}, + {0x1D740, UNICODE_NORM_QC_NO}, + {0x1D741, UNICODE_NORM_QC_NO}, + {0x1D742, UNICODE_NORM_QC_NO}, + {0x1D743, UNICODE_NORM_QC_NO}, + {0x1D744, UNICODE_NORM_QC_NO}, + {0x1D745, UNICODE_NORM_QC_NO}, + {0x1D746, UNICODE_NORM_QC_NO}, + {0x1D747, UNICODE_NORM_QC_NO}, + {0x1D748, UNICODE_NORM_QC_NO}, + {0x1D749, UNICODE_NORM_QC_NO}, + {0x1D74A, UNICODE_NORM_QC_NO}, + {0x1D74B, UNICODE_NORM_QC_NO}, + {0x1D74C, UNICODE_NORM_QC_NO}, + {0x1D74D, UNICODE_NORM_QC_NO}, + {0x1D74E, UNICODE_NORM_QC_NO}, + {0x1D74F, UNICODE_NORM_QC_NO}, + {0x1D750, UNICODE_NORM_QC_NO}, + {0x1D751, UNICODE_NORM_QC_NO}, + {0x1D752, UNICODE_NORM_QC_NO}, + {0x1D753, UNICODE_NORM_QC_NO}, + {0x1D754, UNICODE_NORM_QC_NO}, + {0x1D755, UNICODE_NORM_QC_NO}, + {0x1D756, UNICODE_NORM_QC_NO}, + {0x1D757, UNICODE_NORM_QC_NO}, + {0x1D758, UNICODE_NORM_QC_NO}, + {0x1D759, UNICODE_NORM_QC_NO}, + {0x1D75A, UNICODE_NORM_QC_NO}, + {0x1D75B, UNICODE_NORM_QC_NO}, + {0x1D75C, UNICODE_NORM_QC_NO}, + {0x1D75D, UNICODE_NORM_QC_NO}, + {0x1D75E, UNICODE_NORM_QC_NO}, + {0x1D75F, UNICODE_NORM_QC_NO}, + {0x1D760, UNICODE_NORM_QC_NO}, + {0x1D761, UNICODE_NORM_QC_NO}, + {0x1D762, UNICODE_NORM_QC_NO}, + {0x1D763, UNICODE_NORM_QC_NO}, + {0x1D764, UNICODE_NORM_QC_NO}, + {0x1D765, UNICODE_NORM_QC_NO}, + {0x1D766, UNICODE_NORM_QC_NO}, + {0x1D767, UNICODE_NORM_QC_NO}, + {0x1D768, UNICODE_NORM_QC_NO}, + {0x1D769, UNICODE_NORM_QC_NO}, + {0x1D76A, UNICODE_NORM_QC_NO}, + {0x1D76B, UNICODE_NORM_QC_NO}, + {0x1D76C, UNICODE_NORM_QC_NO}, + {0x1D76D, UNICODE_NORM_QC_NO}, + {0x1D76E, UNICODE_NORM_QC_NO}, + {0x1D76F, UNICODE_NORM_QC_NO}, + {0x1D770, UNICODE_NORM_QC_NO}, + {0x1D771, UNICODE_NORM_QC_NO}, + {0x1D772, UNICODE_NORM_QC_NO}, + {0x1D773, UNICODE_NORM_QC_NO}, + {0x1D774, UNICODE_NORM_QC_NO}, + {0x1D775, UNICODE_NORM_QC_NO}, + {0x1D776, UNICODE_NORM_QC_NO}, + {0x1D777, UNICODE_NORM_QC_NO}, + {0x1D778, UNICODE_NORM_QC_NO}, + {0x1D779, UNICODE_NORM_QC_NO}, + {0x1D77A, UNICODE_NORM_QC_NO}, + {0x1D77B, UNICODE_NORM_QC_NO}, + {0x1D77C, UNICODE_NORM_QC_NO}, + {0x1D77D, UNICODE_NORM_QC_NO}, + {0x1D77E, UNICODE_NORM_QC_NO}, + {0x1D77F, UNICODE_NORM_QC_NO}, + {0x1D780, UNICODE_NORM_QC_NO}, + {0x1D781, UNICODE_NORM_QC_NO}, + {0x1D782, UNICODE_NORM_QC_NO}, + {0x1D783, UNICODE_NORM_QC_NO}, + {0x1D784, UNICODE_NORM_QC_NO}, + {0x1D785, UNICODE_NORM_QC_NO}, + {0x1D786, UNICODE_NORM_QC_NO}, + {0x1D787, UNICODE_NORM_QC_NO}, + {0x1D788, UNICODE_NORM_QC_NO}, + {0x1D789, UNICODE_NORM_QC_NO}, + {0x1D78A, UNICODE_NORM_QC_NO}, + {0x1D78B, UNICODE_NORM_QC_NO}, + {0x1D78C, UNICODE_NORM_QC_NO}, + {0x1D78D, UNICODE_NORM_QC_NO}, + {0x1D78E, UNICODE_NORM_QC_NO}, + {0x1D78F, UNICODE_NORM_QC_NO}, + {0x1D790, UNICODE_NORM_QC_NO}, + {0x1D791, UNICODE_NORM_QC_NO}, + {0x1D792, UNICODE_NORM_QC_NO}, + {0x1D793, UNICODE_NORM_QC_NO}, + {0x1D794, UNICODE_NORM_QC_NO}, + {0x1D795, UNICODE_NORM_QC_NO}, + {0x1D796, UNICODE_NORM_QC_NO}, + {0x1D797, UNICODE_NORM_QC_NO}, + {0x1D798, UNICODE_NORM_QC_NO}, + {0x1D799, UNICODE_NORM_QC_NO}, + {0x1D79A, UNICODE_NORM_QC_NO}, + {0x1D79B, UNICODE_NORM_QC_NO}, + {0x1D79C, UNICODE_NORM_QC_NO}, + {0x1D79D, UNICODE_NORM_QC_NO}, + {0x1D79E, UNICODE_NORM_QC_NO}, + {0x1D79F, UNICODE_NORM_QC_NO}, + {0x1D7A0, UNICODE_NORM_QC_NO}, + {0x1D7A1, UNICODE_NORM_QC_NO}, + {0x1D7A2, UNICODE_NORM_QC_NO}, + {0x1D7A3, UNICODE_NORM_QC_NO}, + {0x1D7A4, UNICODE_NORM_QC_NO}, + {0x1D7A5, UNICODE_NORM_QC_NO}, + {0x1D7A6, UNICODE_NORM_QC_NO}, + {0x1D7A7, UNICODE_NORM_QC_NO}, + {0x1D7A8, UNICODE_NORM_QC_NO}, + {0x1D7A9, UNICODE_NORM_QC_NO}, + {0x1D7AA, UNICODE_NORM_QC_NO}, + {0x1D7AB, UNICODE_NORM_QC_NO}, + {0x1D7AC, UNICODE_NORM_QC_NO}, + {0x1D7AD, UNICODE_NORM_QC_NO}, + {0x1D7AE, UNICODE_NORM_QC_NO}, + {0x1D7AF, UNICODE_NORM_QC_NO}, + {0x1D7B0, UNICODE_NORM_QC_NO}, + {0x1D7B1, UNICODE_NORM_QC_NO}, + {0x1D7B2, UNICODE_NORM_QC_NO}, + {0x1D7B3, UNICODE_NORM_QC_NO}, + {0x1D7B4, UNICODE_NORM_QC_NO}, + {0x1D7B5, UNICODE_NORM_QC_NO}, + {0x1D7B6, UNICODE_NORM_QC_NO}, + {0x1D7B7, UNICODE_NORM_QC_NO}, + {0x1D7B8, UNICODE_NORM_QC_NO}, + {0x1D7B9, UNICODE_NORM_QC_NO}, + {0x1D7BA, UNICODE_NORM_QC_NO}, + {0x1D7BB, UNICODE_NORM_QC_NO}, + {0x1D7BC, UNICODE_NORM_QC_NO}, + {0x1D7BD, UNICODE_NORM_QC_NO}, + {0x1D7BE, UNICODE_NORM_QC_NO}, + {0x1D7BF, UNICODE_NORM_QC_NO}, + {0x1D7C0, UNICODE_NORM_QC_NO}, + {0x1D7C1, UNICODE_NORM_QC_NO}, + {0x1D7C2, UNICODE_NORM_QC_NO}, + {0x1D7C3, UNICODE_NORM_QC_NO}, + {0x1D7C4, UNICODE_NORM_QC_NO}, + {0x1D7C5, UNICODE_NORM_QC_NO}, + {0x1D7C6, UNICODE_NORM_QC_NO}, + {0x1D7C7, UNICODE_NORM_QC_NO}, + {0x1D7C8, UNICODE_NORM_QC_NO}, + {0x1D7C9, UNICODE_NORM_QC_NO}, + {0x1D7CA, UNICODE_NORM_QC_NO}, + {0x1D7CB, UNICODE_NORM_QC_NO}, + {0x1D7CE, UNICODE_NORM_QC_NO}, + {0x1D7CF, UNICODE_NORM_QC_NO}, + {0x1D7D0, UNICODE_NORM_QC_NO}, + {0x1D7D1, UNICODE_NORM_QC_NO}, + {0x1D7D2, UNICODE_NORM_QC_NO}, + {0x1D7D3, UNICODE_NORM_QC_NO}, + {0x1D7D4, UNICODE_NORM_QC_NO}, + {0x1D7D5, UNICODE_NORM_QC_NO}, + {0x1D7D6, UNICODE_NORM_QC_NO}, + {0x1D7D7, UNICODE_NORM_QC_NO}, + {0x1D7D8, UNICODE_NORM_QC_NO}, + {0x1D7D9, UNICODE_NORM_QC_NO}, + {0x1D7DA, UNICODE_NORM_QC_NO}, + {0x1D7DB, UNICODE_NORM_QC_NO}, + {0x1D7DC, UNICODE_NORM_QC_NO}, + {0x1D7DD, UNICODE_NORM_QC_NO}, + {0x1D7DE, UNICODE_NORM_QC_NO}, + {0x1D7DF, UNICODE_NORM_QC_NO}, + {0x1D7E0, UNICODE_NORM_QC_NO}, + {0x1D7E1, UNICODE_NORM_QC_NO}, + {0x1D7E2, UNICODE_NORM_QC_NO}, + {0x1D7E3, UNICODE_NORM_QC_NO}, + {0x1D7E4, UNICODE_NORM_QC_NO}, + {0x1D7E5, UNICODE_NORM_QC_NO}, + {0x1D7E6, UNICODE_NORM_QC_NO}, + {0x1D7E7, UNICODE_NORM_QC_NO}, + {0x1D7E8, UNICODE_NORM_QC_NO}, + {0x1D7E9, UNICODE_NORM_QC_NO}, + {0x1D7EA, UNICODE_NORM_QC_NO}, + {0x1D7EB, UNICODE_NORM_QC_NO}, + {0x1D7EC, UNICODE_NORM_QC_NO}, + {0x1D7ED, UNICODE_NORM_QC_NO}, + {0x1D7EE, UNICODE_NORM_QC_NO}, + {0x1D7EF, UNICODE_NORM_QC_NO}, + {0x1D7F0, UNICODE_NORM_QC_NO}, + {0x1D7F1, UNICODE_NORM_QC_NO}, + {0x1D7F2, UNICODE_NORM_QC_NO}, + {0x1D7F3, UNICODE_NORM_QC_NO}, + {0x1D7F4, UNICODE_NORM_QC_NO}, + {0x1D7F5, UNICODE_NORM_QC_NO}, + {0x1D7F6, UNICODE_NORM_QC_NO}, + {0x1D7F7, UNICODE_NORM_QC_NO}, + {0x1D7F8, UNICODE_NORM_QC_NO}, + {0x1D7F9, UNICODE_NORM_QC_NO}, + {0x1D7FA, UNICODE_NORM_QC_NO}, + {0x1D7FB, UNICODE_NORM_QC_NO}, + {0x1D7FC, UNICODE_NORM_QC_NO}, + {0x1D7FD, UNICODE_NORM_QC_NO}, + {0x1D7FE, UNICODE_NORM_QC_NO}, + {0x1D7FF, UNICODE_NORM_QC_NO}, + {0x1E030, UNICODE_NORM_QC_NO}, + {0x1E031, UNICODE_NORM_QC_NO}, + {0x1E032, UNICODE_NORM_QC_NO}, + {0x1E033, UNICODE_NORM_QC_NO}, + {0x1E034, UNICODE_NORM_QC_NO}, + {0x1E035, UNICODE_NORM_QC_NO}, + {0x1E036, UNICODE_NORM_QC_NO}, + {0x1E037, UNICODE_NORM_QC_NO}, + {0x1E038, UNICODE_NORM_QC_NO}, + {0x1E039, UNICODE_NORM_QC_NO}, + {0x1E03A, UNICODE_NORM_QC_NO}, + {0x1E03B, UNICODE_NORM_QC_NO}, + {0x1E03C, UNICODE_NORM_QC_NO}, + {0x1E03D, UNICODE_NORM_QC_NO}, + {0x1E03E, UNICODE_NORM_QC_NO}, + {0x1E03F, UNICODE_NORM_QC_NO}, + {0x1E040, UNICODE_NORM_QC_NO}, + {0x1E041, UNICODE_NORM_QC_NO}, + {0x1E042, UNICODE_NORM_QC_NO}, + {0x1E043, UNICODE_NORM_QC_NO}, + {0x1E044, UNICODE_NORM_QC_NO}, + {0x1E045, UNICODE_NORM_QC_NO}, + {0x1E046, UNICODE_NORM_QC_NO}, + {0x1E047, UNICODE_NORM_QC_NO}, + {0x1E048, UNICODE_NORM_QC_NO}, + {0x1E049, UNICODE_NORM_QC_NO}, + {0x1E04A, UNICODE_NORM_QC_NO}, + {0x1E04B, UNICODE_NORM_QC_NO}, + {0x1E04C, UNICODE_NORM_QC_NO}, + {0x1E04D, UNICODE_NORM_QC_NO}, + {0x1E04E, UNICODE_NORM_QC_NO}, + {0x1E04F, UNICODE_NORM_QC_NO}, + {0x1E050, UNICODE_NORM_QC_NO}, + {0x1E051, UNICODE_NORM_QC_NO}, + {0x1E052, UNICODE_NORM_QC_NO}, + {0x1E053, UNICODE_NORM_QC_NO}, + {0x1E054, UNICODE_NORM_QC_NO}, + {0x1E055, UNICODE_NORM_QC_NO}, + {0x1E056, UNICODE_NORM_QC_NO}, + {0x1E057, UNICODE_NORM_QC_NO}, + {0x1E058, UNICODE_NORM_QC_NO}, + {0x1E059, UNICODE_NORM_QC_NO}, + {0x1E05A, UNICODE_NORM_QC_NO}, + {0x1E05B, UNICODE_NORM_QC_NO}, + {0x1E05C, UNICODE_NORM_QC_NO}, + {0x1E05D, UNICODE_NORM_QC_NO}, + {0x1E05E, UNICODE_NORM_QC_NO}, + {0x1E05F, UNICODE_NORM_QC_NO}, + {0x1E060, UNICODE_NORM_QC_NO}, + {0x1E061, UNICODE_NORM_QC_NO}, + {0x1E062, UNICODE_NORM_QC_NO}, + {0x1E063, UNICODE_NORM_QC_NO}, + {0x1E064, UNICODE_NORM_QC_NO}, + {0x1E065, UNICODE_NORM_QC_NO}, + {0x1E066, UNICODE_NORM_QC_NO}, + {0x1E067, UNICODE_NORM_QC_NO}, + {0x1E068, UNICODE_NORM_QC_NO}, + {0x1E069, UNICODE_NORM_QC_NO}, + {0x1E06A, UNICODE_NORM_QC_NO}, + {0x1E06B, UNICODE_NORM_QC_NO}, + {0x1E06C, UNICODE_NORM_QC_NO}, + {0x1E06D, UNICODE_NORM_QC_NO}, + {0x1EE00, UNICODE_NORM_QC_NO}, + {0x1EE01, UNICODE_NORM_QC_NO}, + {0x1EE02, UNICODE_NORM_QC_NO}, + {0x1EE03, UNICODE_NORM_QC_NO}, + {0x1EE05, UNICODE_NORM_QC_NO}, + {0x1EE06, UNICODE_NORM_QC_NO}, + {0x1EE07, UNICODE_NORM_QC_NO}, + {0x1EE08, UNICODE_NORM_QC_NO}, + {0x1EE09, UNICODE_NORM_QC_NO}, + {0x1EE0A, UNICODE_NORM_QC_NO}, + {0x1EE0B, UNICODE_NORM_QC_NO}, + {0x1EE0C, UNICODE_NORM_QC_NO}, + {0x1EE0D, UNICODE_NORM_QC_NO}, + {0x1EE0E, UNICODE_NORM_QC_NO}, + {0x1EE0F, UNICODE_NORM_QC_NO}, + {0x1EE10, UNICODE_NORM_QC_NO}, + {0x1EE11, UNICODE_NORM_QC_NO}, + {0x1EE12, UNICODE_NORM_QC_NO}, + {0x1EE13, UNICODE_NORM_QC_NO}, + {0x1EE14, UNICODE_NORM_QC_NO}, + {0x1EE15, UNICODE_NORM_QC_NO}, + {0x1EE16, UNICODE_NORM_QC_NO}, + {0x1EE17, UNICODE_NORM_QC_NO}, + {0x1EE18, UNICODE_NORM_QC_NO}, + {0x1EE19, UNICODE_NORM_QC_NO}, + {0x1EE1A, UNICODE_NORM_QC_NO}, + {0x1EE1B, UNICODE_NORM_QC_NO}, + {0x1EE1C, UNICODE_NORM_QC_NO}, + {0x1EE1D, UNICODE_NORM_QC_NO}, + {0x1EE1E, UNICODE_NORM_QC_NO}, + {0x1EE1F, UNICODE_NORM_QC_NO}, + {0x1EE21, UNICODE_NORM_QC_NO}, + {0x1EE22, UNICODE_NORM_QC_NO}, + {0x1EE24, UNICODE_NORM_QC_NO}, + {0x1EE27, UNICODE_NORM_QC_NO}, + {0x1EE29, UNICODE_NORM_QC_NO}, + {0x1EE2A, UNICODE_NORM_QC_NO}, + {0x1EE2B, UNICODE_NORM_QC_NO}, + {0x1EE2C, UNICODE_NORM_QC_NO}, + {0x1EE2D, UNICODE_NORM_QC_NO}, + {0x1EE2E, UNICODE_NORM_QC_NO}, + {0x1EE2F, UNICODE_NORM_QC_NO}, + {0x1EE30, UNICODE_NORM_QC_NO}, + {0x1EE31, UNICODE_NORM_QC_NO}, + {0x1EE32, UNICODE_NORM_QC_NO}, + {0x1EE34, UNICODE_NORM_QC_NO}, + {0x1EE35, UNICODE_NORM_QC_NO}, + {0x1EE36, UNICODE_NORM_QC_NO}, + {0x1EE37, UNICODE_NORM_QC_NO}, + {0x1EE39, UNICODE_NORM_QC_NO}, + {0x1EE3B, UNICODE_NORM_QC_NO}, + {0x1EE42, UNICODE_NORM_QC_NO}, + {0x1EE47, UNICODE_NORM_QC_NO}, + {0x1EE49, UNICODE_NORM_QC_NO}, + {0x1EE4B, UNICODE_NORM_QC_NO}, + {0x1EE4D, UNICODE_NORM_QC_NO}, + {0x1EE4E, UNICODE_NORM_QC_NO}, + {0x1EE4F, UNICODE_NORM_QC_NO}, + {0x1EE51, UNICODE_NORM_QC_NO}, + {0x1EE52, UNICODE_NORM_QC_NO}, + {0x1EE54, UNICODE_NORM_QC_NO}, + {0x1EE57, UNICODE_NORM_QC_NO}, + {0x1EE59, UNICODE_NORM_QC_NO}, + {0x1EE5B, UNICODE_NORM_QC_NO}, + {0x1EE5D, UNICODE_NORM_QC_NO}, + {0x1EE5F, UNICODE_NORM_QC_NO}, + {0x1EE61, UNICODE_NORM_QC_NO}, + {0x1EE62, UNICODE_NORM_QC_NO}, + {0x1EE64, UNICODE_NORM_QC_NO}, + {0x1EE67, UNICODE_NORM_QC_NO}, + {0x1EE68, UNICODE_NORM_QC_NO}, + {0x1EE69, UNICODE_NORM_QC_NO}, + {0x1EE6A, UNICODE_NORM_QC_NO}, + {0x1EE6C, UNICODE_NORM_QC_NO}, + {0x1EE6D, UNICODE_NORM_QC_NO}, + {0x1EE6E, UNICODE_NORM_QC_NO}, + {0x1EE6F, UNICODE_NORM_QC_NO}, + {0x1EE70, UNICODE_NORM_QC_NO}, + {0x1EE71, UNICODE_NORM_QC_NO}, + {0x1EE72, UNICODE_NORM_QC_NO}, + {0x1EE74, UNICODE_NORM_QC_NO}, + {0x1EE75, UNICODE_NORM_QC_NO}, + {0x1EE76, UNICODE_NORM_QC_NO}, + {0x1EE77, UNICODE_NORM_QC_NO}, + {0x1EE79, UNICODE_NORM_QC_NO}, + {0x1EE7A, UNICODE_NORM_QC_NO}, + {0x1EE7B, UNICODE_NORM_QC_NO}, + {0x1EE7C, UNICODE_NORM_QC_NO}, + {0x1EE7E, UNICODE_NORM_QC_NO}, + {0x1EE80, UNICODE_NORM_QC_NO}, + {0x1EE81, UNICODE_NORM_QC_NO}, + {0x1EE82, UNICODE_NORM_QC_NO}, + {0x1EE83, UNICODE_NORM_QC_NO}, + {0x1EE84, UNICODE_NORM_QC_NO}, + {0x1EE85, UNICODE_NORM_QC_NO}, + {0x1EE86, UNICODE_NORM_QC_NO}, + {0x1EE87, UNICODE_NORM_QC_NO}, + {0x1EE88, UNICODE_NORM_QC_NO}, + {0x1EE89, UNICODE_NORM_QC_NO}, + {0x1EE8B, UNICODE_NORM_QC_NO}, + {0x1EE8C, UNICODE_NORM_QC_NO}, + {0x1EE8D, UNICODE_NORM_QC_NO}, + {0x1EE8E, UNICODE_NORM_QC_NO}, + {0x1EE8F, UNICODE_NORM_QC_NO}, + {0x1EE90, UNICODE_NORM_QC_NO}, + {0x1EE91, UNICODE_NORM_QC_NO}, + {0x1EE92, UNICODE_NORM_QC_NO}, + {0x1EE93, UNICODE_NORM_QC_NO}, + {0x1EE94, UNICODE_NORM_QC_NO}, + {0x1EE95, UNICODE_NORM_QC_NO}, + {0x1EE96, UNICODE_NORM_QC_NO}, + {0x1EE97, UNICODE_NORM_QC_NO}, + {0x1EE98, UNICODE_NORM_QC_NO}, + {0x1EE99, UNICODE_NORM_QC_NO}, + {0x1EE9A, UNICODE_NORM_QC_NO}, + {0x1EE9B, UNICODE_NORM_QC_NO}, + {0x1EEA1, UNICODE_NORM_QC_NO}, + {0x1EEA2, UNICODE_NORM_QC_NO}, + {0x1EEA3, UNICODE_NORM_QC_NO}, + {0x1EEA5, UNICODE_NORM_QC_NO}, + {0x1EEA6, UNICODE_NORM_QC_NO}, + {0x1EEA7, UNICODE_NORM_QC_NO}, + {0x1EEA8, UNICODE_NORM_QC_NO}, + {0x1EEA9, UNICODE_NORM_QC_NO}, + {0x1EEAB, UNICODE_NORM_QC_NO}, + {0x1EEAC, UNICODE_NORM_QC_NO}, + {0x1EEAD, UNICODE_NORM_QC_NO}, + {0x1EEAE, UNICODE_NORM_QC_NO}, + {0x1EEAF, UNICODE_NORM_QC_NO}, + {0x1EEB0, UNICODE_NORM_QC_NO}, + {0x1EEB1, UNICODE_NORM_QC_NO}, + {0x1EEB2, UNICODE_NORM_QC_NO}, + {0x1EEB3, UNICODE_NORM_QC_NO}, + {0x1EEB4, UNICODE_NORM_QC_NO}, + {0x1EEB5, UNICODE_NORM_QC_NO}, + {0x1EEB6, UNICODE_NORM_QC_NO}, + {0x1EEB7, UNICODE_NORM_QC_NO}, + {0x1EEB8, UNICODE_NORM_QC_NO}, + {0x1EEB9, UNICODE_NORM_QC_NO}, + {0x1EEBA, UNICODE_NORM_QC_NO}, + {0x1EEBB, UNICODE_NORM_QC_NO}, + {0x1F100, UNICODE_NORM_QC_NO}, + {0x1F101, UNICODE_NORM_QC_NO}, + {0x1F102, UNICODE_NORM_QC_NO}, + {0x1F103, UNICODE_NORM_QC_NO}, + {0x1F104, UNICODE_NORM_QC_NO}, + {0x1F105, UNICODE_NORM_QC_NO}, + {0x1F106, UNICODE_NORM_QC_NO}, + {0x1F107, UNICODE_NORM_QC_NO}, + {0x1F108, UNICODE_NORM_QC_NO}, + {0x1F109, UNICODE_NORM_QC_NO}, + {0x1F10A, UNICODE_NORM_QC_NO}, + {0x1F110, UNICODE_NORM_QC_NO}, + {0x1F111, UNICODE_NORM_QC_NO}, + {0x1F112, UNICODE_NORM_QC_NO}, + {0x1F113, UNICODE_NORM_QC_NO}, + {0x1F114, UNICODE_NORM_QC_NO}, + {0x1F115, UNICODE_NORM_QC_NO}, + {0x1F116, UNICODE_NORM_QC_NO}, + {0x1F117, UNICODE_NORM_QC_NO}, + {0x1F118, UNICODE_NORM_QC_NO}, + {0x1F119, UNICODE_NORM_QC_NO}, + {0x1F11A, UNICODE_NORM_QC_NO}, + {0x1F11B, UNICODE_NORM_QC_NO}, + {0x1F11C, UNICODE_NORM_QC_NO}, + {0x1F11D, UNICODE_NORM_QC_NO}, + {0x1F11E, UNICODE_NORM_QC_NO}, + {0x1F11F, UNICODE_NORM_QC_NO}, + {0x1F120, UNICODE_NORM_QC_NO}, + {0x1F121, UNICODE_NORM_QC_NO}, + {0x1F122, UNICODE_NORM_QC_NO}, + {0x1F123, UNICODE_NORM_QC_NO}, + {0x1F124, UNICODE_NORM_QC_NO}, + {0x1F125, UNICODE_NORM_QC_NO}, + {0x1F126, UNICODE_NORM_QC_NO}, + {0x1F127, UNICODE_NORM_QC_NO}, + {0x1F128, UNICODE_NORM_QC_NO}, + {0x1F129, UNICODE_NORM_QC_NO}, + {0x1F12A, UNICODE_NORM_QC_NO}, + {0x1F12B, UNICODE_NORM_QC_NO}, + {0x1F12C, UNICODE_NORM_QC_NO}, + {0x1F12D, UNICODE_NORM_QC_NO}, + {0x1F12E, UNICODE_NORM_QC_NO}, + {0x1F130, UNICODE_NORM_QC_NO}, + {0x1F131, UNICODE_NORM_QC_NO}, + {0x1F132, UNICODE_NORM_QC_NO}, + {0x1F133, UNICODE_NORM_QC_NO}, + {0x1F134, UNICODE_NORM_QC_NO}, + {0x1F135, UNICODE_NORM_QC_NO}, + {0x1F136, UNICODE_NORM_QC_NO}, + {0x1F137, UNICODE_NORM_QC_NO}, + {0x1F138, UNICODE_NORM_QC_NO}, + {0x1F139, UNICODE_NORM_QC_NO}, + {0x1F13A, UNICODE_NORM_QC_NO}, + {0x1F13B, UNICODE_NORM_QC_NO}, + {0x1F13C, UNICODE_NORM_QC_NO}, + {0x1F13D, UNICODE_NORM_QC_NO}, + {0x1F13E, UNICODE_NORM_QC_NO}, + {0x1F13F, UNICODE_NORM_QC_NO}, + {0x1F140, UNICODE_NORM_QC_NO}, + {0x1F141, UNICODE_NORM_QC_NO}, + {0x1F142, UNICODE_NORM_QC_NO}, + {0x1F143, UNICODE_NORM_QC_NO}, + {0x1F144, UNICODE_NORM_QC_NO}, + {0x1F145, UNICODE_NORM_QC_NO}, + {0x1F146, UNICODE_NORM_QC_NO}, + {0x1F147, UNICODE_NORM_QC_NO}, + {0x1F148, UNICODE_NORM_QC_NO}, + {0x1F149, UNICODE_NORM_QC_NO}, + {0x1F14A, UNICODE_NORM_QC_NO}, + {0x1F14B, UNICODE_NORM_QC_NO}, + {0x1F14C, UNICODE_NORM_QC_NO}, + {0x1F14D, UNICODE_NORM_QC_NO}, + {0x1F14E, UNICODE_NORM_QC_NO}, + {0x1F14F, UNICODE_NORM_QC_NO}, + {0x1F16A, UNICODE_NORM_QC_NO}, + {0x1F16B, UNICODE_NORM_QC_NO}, + {0x1F16C, UNICODE_NORM_QC_NO}, + {0x1F190, UNICODE_NORM_QC_NO}, + {0x1F200, UNICODE_NORM_QC_NO}, + {0x1F201, UNICODE_NORM_QC_NO}, + {0x1F202, UNICODE_NORM_QC_NO}, + {0x1F210, UNICODE_NORM_QC_NO}, + {0x1F211, UNICODE_NORM_QC_NO}, + {0x1F212, UNICODE_NORM_QC_NO}, + {0x1F213, UNICODE_NORM_QC_NO}, + {0x1F214, UNICODE_NORM_QC_NO}, + {0x1F215, UNICODE_NORM_QC_NO}, + {0x1F216, UNICODE_NORM_QC_NO}, + {0x1F217, UNICODE_NORM_QC_NO}, + {0x1F218, UNICODE_NORM_QC_NO}, + {0x1F219, UNICODE_NORM_QC_NO}, + {0x1F21A, UNICODE_NORM_QC_NO}, + {0x1F21B, UNICODE_NORM_QC_NO}, + {0x1F21C, UNICODE_NORM_QC_NO}, + {0x1F21D, UNICODE_NORM_QC_NO}, + {0x1F21E, UNICODE_NORM_QC_NO}, + {0x1F21F, UNICODE_NORM_QC_NO}, + {0x1F220, UNICODE_NORM_QC_NO}, + {0x1F221, UNICODE_NORM_QC_NO}, + {0x1F222, UNICODE_NORM_QC_NO}, + {0x1F223, UNICODE_NORM_QC_NO}, + {0x1F224, UNICODE_NORM_QC_NO}, + {0x1F225, UNICODE_NORM_QC_NO}, + {0x1F226, UNICODE_NORM_QC_NO}, + {0x1F227, UNICODE_NORM_QC_NO}, + {0x1F228, UNICODE_NORM_QC_NO}, + {0x1F229, UNICODE_NORM_QC_NO}, + {0x1F22A, UNICODE_NORM_QC_NO}, + {0x1F22B, UNICODE_NORM_QC_NO}, + {0x1F22C, UNICODE_NORM_QC_NO}, + {0x1F22D, UNICODE_NORM_QC_NO}, + {0x1F22E, UNICODE_NORM_QC_NO}, + {0x1F22F, UNICODE_NORM_QC_NO}, + {0x1F230, UNICODE_NORM_QC_NO}, + {0x1F231, UNICODE_NORM_QC_NO}, + {0x1F232, UNICODE_NORM_QC_NO}, + {0x1F233, UNICODE_NORM_QC_NO}, + {0x1F234, UNICODE_NORM_QC_NO}, + {0x1F235, UNICODE_NORM_QC_NO}, + {0x1F236, UNICODE_NORM_QC_NO}, + {0x1F237, UNICODE_NORM_QC_NO}, + {0x1F238, UNICODE_NORM_QC_NO}, + {0x1F239, UNICODE_NORM_QC_NO}, + {0x1F23A, UNICODE_NORM_QC_NO}, + {0x1F23B, UNICODE_NORM_QC_NO}, + {0x1F240, UNICODE_NORM_QC_NO}, + {0x1F241, UNICODE_NORM_QC_NO}, + {0x1F242, UNICODE_NORM_QC_NO}, + {0x1F243, UNICODE_NORM_QC_NO}, + {0x1F244, UNICODE_NORM_QC_NO}, + {0x1F245, UNICODE_NORM_QC_NO}, + {0x1F246, UNICODE_NORM_QC_NO}, + {0x1F247, UNICODE_NORM_QC_NO}, + {0x1F248, UNICODE_NORM_QC_NO}, + {0x1F250, UNICODE_NORM_QC_NO}, + {0x1F251, UNICODE_NORM_QC_NO}, + {0x1FBF0, UNICODE_NORM_QC_NO}, + {0x1FBF1, UNICODE_NORM_QC_NO}, + {0x1FBF2, UNICODE_NORM_QC_NO}, + {0x1FBF3, UNICODE_NORM_QC_NO}, + {0x1FBF4, UNICODE_NORM_QC_NO}, + {0x1FBF5, UNICODE_NORM_QC_NO}, + {0x1FBF6, UNICODE_NORM_QC_NO}, + {0x1FBF7, UNICODE_NORM_QC_NO}, + {0x1FBF8, UNICODE_NORM_QC_NO}, + {0x1FBF9, UNICODE_NORM_QC_NO}, + {0x2F800, UNICODE_NORM_QC_NO}, + {0x2F801, UNICODE_NORM_QC_NO}, + {0x2F802, UNICODE_NORM_QC_NO}, + {0x2F803, UNICODE_NORM_QC_NO}, + {0x2F804, UNICODE_NORM_QC_NO}, + {0x2F805, UNICODE_NORM_QC_NO}, + {0x2F806, UNICODE_NORM_QC_NO}, + {0x2F807, UNICODE_NORM_QC_NO}, + {0x2F808, UNICODE_NORM_QC_NO}, + {0x2F809, UNICODE_NORM_QC_NO}, + {0x2F80A, UNICODE_NORM_QC_NO}, + {0x2F80B, UNICODE_NORM_QC_NO}, + {0x2F80C, UNICODE_NORM_QC_NO}, + {0x2F80D, UNICODE_NORM_QC_NO}, + {0x2F80E, UNICODE_NORM_QC_NO}, + {0x2F80F, UNICODE_NORM_QC_NO}, + {0x2F810, UNICODE_NORM_QC_NO}, + {0x2F811, UNICODE_NORM_QC_NO}, + {0x2F812, UNICODE_NORM_QC_NO}, + {0x2F813, UNICODE_NORM_QC_NO}, + {0x2F814, UNICODE_NORM_QC_NO}, + {0x2F815, UNICODE_NORM_QC_NO}, + {0x2F816, UNICODE_NORM_QC_NO}, + {0x2F817, UNICODE_NORM_QC_NO}, + {0x2F818, UNICODE_NORM_QC_NO}, + {0x2F819, UNICODE_NORM_QC_NO}, + {0x2F81A, UNICODE_NORM_QC_NO}, + {0x2F81B, UNICODE_NORM_QC_NO}, + {0x2F81C, UNICODE_NORM_QC_NO}, + {0x2F81D, UNICODE_NORM_QC_NO}, + {0x2F81E, UNICODE_NORM_QC_NO}, + {0x2F81F, UNICODE_NORM_QC_NO}, + {0x2F820, UNICODE_NORM_QC_NO}, + {0x2F821, UNICODE_NORM_QC_NO}, + {0x2F822, UNICODE_NORM_QC_NO}, + {0x2F823, UNICODE_NORM_QC_NO}, + {0x2F824, UNICODE_NORM_QC_NO}, + {0x2F825, UNICODE_NORM_QC_NO}, + {0x2F826, UNICODE_NORM_QC_NO}, + {0x2F827, UNICODE_NORM_QC_NO}, + {0x2F828, UNICODE_NORM_QC_NO}, + {0x2F829, UNICODE_NORM_QC_NO}, + {0x2F82A, UNICODE_NORM_QC_NO}, + {0x2F82B, UNICODE_NORM_QC_NO}, + {0x2F82C, UNICODE_NORM_QC_NO}, + {0x2F82D, UNICODE_NORM_QC_NO}, + {0x2F82E, UNICODE_NORM_QC_NO}, + {0x2F82F, UNICODE_NORM_QC_NO}, + {0x2F830, UNICODE_NORM_QC_NO}, + {0x2F831, UNICODE_NORM_QC_NO}, + {0x2F832, UNICODE_NORM_QC_NO}, + {0x2F833, UNICODE_NORM_QC_NO}, + {0x2F834, UNICODE_NORM_QC_NO}, + {0x2F835, UNICODE_NORM_QC_NO}, + {0x2F836, UNICODE_NORM_QC_NO}, + {0x2F837, UNICODE_NORM_QC_NO}, + {0x2F838, UNICODE_NORM_QC_NO}, + {0x2F839, UNICODE_NORM_QC_NO}, + {0x2F83A, UNICODE_NORM_QC_NO}, + {0x2F83B, UNICODE_NORM_QC_NO}, + {0x2F83C, UNICODE_NORM_QC_NO}, + {0x2F83D, UNICODE_NORM_QC_NO}, + {0x2F83E, UNICODE_NORM_QC_NO}, + {0x2F83F, UNICODE_NORM_QC_NO}, + {0x2F840, UNICODE_NORM_QC_NO}, + {0x2F841, UNICODE_NORM_QC_NO}, + {0x2F842, UNICODE_NORM_QC_NO}, + {0x2F843, UNICODE_NORM_QC_NO}, + {0x2F844, UNICODE_NORM_QC_NO}, + {0x2F845, UNICODE_NORM_QC_NO}, + {0x2F846, UNICODE_NORM_QC_NO}, + {0x2F847, UNICODE_NORM_QC_NO}, + {0x2F848, UNICODE_NORM_QC_NO}, + {0x2F849, UNICODE_NORM_QC_NO}, + {0x2F84A, UNICODE_NORM_QC_NO}, + {0x2F84B, UNICODE_NORM_QC_NO}, + {0x2F84C, UNICODE_NORM_QC_NO}, + {0x2F84D, UNICODE_NORM_QC_NO}, + {0x2F84E, UNICODE_NORM_QC_NO}, + {0x2F84F, UNICODE_NORM_QC_NO}, + {0x2F850, UNICODE_NORM_QC_NO}, + {0x2F851, UNICODE_NORM_QC_NO}, + {0x2F852, UNICODE_NORM_QC_NO}, + {0x2F853, UNICODE_NORM_QC_NO}, + {0x2F854, UNICODE_NORM_QC_NO}, + {0x2F855, UNICODE_NORM_QC_NO}, + {0x2F856, UNICODE_NORM_QC_NO}, + {0x2F857, UNICODE_NORM_QC_NO}, + {0x2F858, UNICODE_NORM_QC_NO}, + {0x2F859, UNICODE_NORM_QC_NO}, + {0x2F85A, UNICODE_NORM_QC_NO}, + {0x2F85B, UNICODE_NORM_QC_NO}, + {0x2F85C, UNICODE_NORM_QC_NO}, + {0x2F85D, UNICODE_NORM_QC_NO}, + {0x2F85E, UNICODE_NORM_QC_NO}, + {0x2F85F, UNICODE_NORM_QC_NO}, + {0x2F860, UNICODE_NORM_QC_NO}, + {0x2F861, UNICODE_NORM_QC_NO}, + {0x2F862, UNICODE_NORM_QC_NO}, + {0x2F863, UNICODE_NORM_QC_NO}, + {0x2F864, UNICODE_NORM_QC_NO}, + {0x2F865, UNICODE_NORM_QC_NO}, + {0x2F866, UNICODE_NORM_QC_NO}, + {0x2F867, UNICODE_NORM_QC_NO}, + {0x2F868, UNICODE_NORM_QC_NO}, + {0x2F869, UNICODE_NORM_QC_NO}, + {0x2F86A, UNICODE_NORM_QC_NO}, + {0x2F86B, UNICODE_NORM_QC_NO}, + {0x2F86C, UNICODE_NORM_QC_NO}, + {0x2F86D, UNICODE_NORM_QC_NO}, + {0x2F86E, UNICODE_NORM_QC_NO}, + {0x2F86F, UNICODE_NORM_QC_NO}, + {0x2F870, UNICODE_NORM_QC_NO}, + {0x2F871, UNICODE_NORM_QC_NO}, + {0x2F872, UNICODE_NORM_QC_NO}, + {0x2F873, UNICODE_NORM_QC_NO}, + {0x2F874, UNICODE_NORM_QC_NO}, + {0x2F875, UNICODE_NORM_QC_NO}, + {0x2F876, UNICODE_NORM_QC_NO}, + {0x2F877, UNICODE_NORM_QC_NO}, + {0x2F878, UNICODE_NORM_QC_NO}, + {0x2F879, UNICODE_NORM_QC_NO}, + {0x2F87A, UNICODE_NORM_QC_NO}, + {0x2F87B, UNICODE_NORM_QC_NO}, + {0x2F87C, UNICODE_NORM_QC_NO}, + {0x2F87D, UNICODE_NORM_QC_NO}, + {0x2F87E, UNICODE_NORM_QC_NO}, + {0x2F87F, UNICODE_NORM_QC_NO}, + {0x2F880, UNICODE_NORM_QC_NO}, + {0x2F881, UNICODE_NORM_QC_NO}, + {0x2F882, UNICODE_NORM_QC_NO}, + {0x2F883, UNICODE_NORM_QC_NO}, + {0x2F884, UNICODE_NORM_QC_NO}, + {0x2F885, UNICODE_NORM_QC_NO}, + {0x2F886, UNICODE_NORM_QC_NO}, + {0x2F887, UNICODE_NORM_QC_NO}, + {0x2F888, UNICODE_NORM_QC_NO}, + {0x2F889, UNICODE_NORM_QC_NO}, + {0x2F88A, UNICODE_NORM_QC_NO}, + {0x2F88B, UNICODE_NORM_QC_NO}, + {0x2F88C, UNICODE_NORM_QC_NO}, + {0x2F88D, UNICODE_NORM_QC_NO}, + {0x2F88E, UNICODE_NORM_QC_NO}, + {0x2F88F, UNICODE_NORM_QC_NO}, + {0x2F890, UNICODE_NORM_QC_NO}, + {0x2F891, UNICODE_NORM_QC_NO}, + {0x2F892, UNICODE_NORM_QC_NO}, + {0x2F893, UNICODE_NORM_QC_NO}, + {0x2F894, UNICODE_NORM_QC_NO}, + {0x2F895, UNICODE_NORM_QC_NO}, + {0x2F896, UNICODE_NORM_QC_NO}, + {0x2F897, UNICODE_NORM_QC_NO}, + {0x2F898, UNICODE_NORM_QC_NO}, + {0x2F899, UNICODE_NORM_QC_NO}, + {0x2F89A, UNICODE_NORM_QC_NO}, + {0x2F89B, UNICODE_NORM_QC_NO}, + {0x2F89C, UNICODE_NORM_QC_NO}, + {0x2F89D, UNICODE_NORM_QC_NO}, + {0x2F89E, UNICODE_NORM_QC_NO}, + {0x2F89F, UNICODE_NORM_QC_NO}, + {0x2F8A0, UNICODE_NORM_QC_NO}, + {0x2F8A1, UNICODE_NORM_QC_NO}, + {0x2F8A2, UNICODE_NORM_QC_NO}, + {0x2F8A3, UNICODE_NORM_QC_NO}, + {0x2F8A4, UNICODE_NORM_QC_NO}, + {0x2F8A5, UNICODE_NORM_QC_NO}, + {0x2F8A6, UNICODE_NORM_QC_NO}, + {0x2F8A7, UNICODE_NORM_QC_NO}, + {0x2F8A8, UNICODE_NORM_QC_NO}, + {0x2F8A9, UNICODE_NORM_QC_NO}, + {0x2F8AA, UNICODE_NORM_QC_NO}, + {0x2F8AB, UNICODE_NORM_QC_NO}, + {0x2F8AC, UNICODE_NORM_QC_NO}, + {0x2F8AD, UNICODE_NORM_QC_NO}, + {0x2F8AE, UNICODE_NORM_QC_NO}, + {0x2F8AF, UNICODE_NORM_QC_NO}, + {0x2F8B0, UNICODE_NORM_QC_NO}, + {0x2F8B1, UNICODE_NORM_QC_NO}, + {0x2F8B2, UNICODE_NORM_QC_NO}, + {0x2F8B3, UNICODE_NORM_QC_NO}, + {0x2F8B4, UNICODE_NORM_QC_NO}, + {0x2F8B5, UNICODE_NORM_QC_NO}, + {0x2F8B6, UNICODE_NORM_QC_NO}, + {0x2F8B7, UNICODE_NORM_QC_NO}, + {0x2F8B8, UNICODE_NORM_QC_NO}, + {0x2F8B9, UNICODE_NORM_QC_NO}, + {0x2F8BA, UNICODE_NORM_QC_NO}, + {0x2F8BB, UNICODE_NORM_QC_NO}, + {0x2F8BC, UNICODE_NORM_QC_NO}, + {0x2F8BD, UNICODE_NORM_QC_NO}, + {0x2F8BE, UNICODE_NORM_QC_NO}, + {0x2F8BF, UNICODE_NORM_QC_NO}, + {0x2F8C0, UNICODE_NORM_QC_NO}, + {0x2F8C1, UNICODE_NORM_QC_NO}, + {0x2F8C2, UNICODE_NORM_QC_NO}, + {0x2F8C3, UNICODE_NORM_QC_NO}, + {0x2F8C4, UNICODE_NORM_QC_NO}, + {0x2F8C5, UNICODE_NORM_QC_NO}, + {0x2F8C6, UNICODE_NORM_QC_NO}, + {0x2F8C7, UNICODE_NORM_QC_NO}, + {0x2F8C8, UNICODE_NORM_QC_NO}, + {0x2F8C9, UNICODE_NORM_QC_NO}, + {0x2F8CA, UNICODE_NORM_QC_NO}, + {0x2F8CB, UNICODE_NORM_QC_NO}, + {0x2F8CC, UNICODE_NORM_QC_NO}, + {0x2F8CD, UNICODE_NORM_QC_NO}, + {0x2F8CE, UNICODE_NORM_QC_NO}, + {0x2F8CF, UNICODE_NORM_QC_NO}, + {0x2F8D0, UNICODE_NORM_QC_NO}, + {0x2F8D1, UNICODE_NORM_QC_NO}, + {0x2F8D2, UNICODE_NORM_QC_NO}, + {0x2F8D3, UNICODE_NORM_QC_NO}, + {0x2F8D4, UNICODE_NORM_QC_NO}, + {0x2F8D5, UNICODE_NORM_QC_NO}, + {0x2F8D6, UNICODE_NORM_QC_NO}, + {0x2F8D7, UNICODE_NORM_QC_NO}, + {0x2F8D8, UNICODE_NORM_QC_NO}, + {0x2F8D9, UNICODE_NORM_QC_NO}, + {0x2F8DA, UNICODE_NORM_QC_NO}, + {0x2F8DB, UNICODE_NORM_QC_NO}, + {0x2F8DC, UNICODE_NORM_QC_NO}, + {0x2F8DD, UNICODE_NORM_QC_NO}, + {0x2F8DE, UNICODE_NORM_QC_NO}, + {0x2F8DF, UNICODE_NORM_QC_NO}, + {0x2F8E0, UNICODE_NORM_QC_NO}, + {0x2F8E1, UNICODE_NORM_QC_NO}, + {0x2F8E2, UNICODE_NORM_QC_NO}, + {0x2F8E3, UNICODE_NORM_QC_NO}, + {0x2F8E4, UNICODE_NORM_QC_NO}, + {0x2F8E5, UNICODE_NORM_QC_NO}, + {0x2F8E6, UNICODE_NORM_QC_NO}, + {0x2F8E7, UNICODE_NORM_QC_NO}, + {0x2F8E8, UNICODE_NORM_QC_NO}, + {0x2F8E9, UNICODE_NORM_QC_NO}, + {0x2F8EA, UNICODE_NORM_QC_NO}, + {0x2F8EB, UNICODE_NORM_QC_NO}, + {0x2F8EC, UNICODE_NORM_QC_NO}, + {0x2F8ED, UNICODE_NORM_QC_NO}, + {0x2F8EE, UNICODE_NORM_QC_NO}, + {0x2F8EF, UNICODE_NORM_QC_NO}, + {0x2F8F0, UNICODE_NORM_QC_NO}, + {0x2F8F1, UNICODE_NORM_QC_NO}, + {0x2F8F2, UNICODE_NORM_QC_NO}, + {0x2F8F3, UNICODE_NORM_QC_NO}, + {0x2F8F4, UNICODE_NORM_QC_NO}, + {0x2F8F5, UNICODE_NORM_QC_NO}, + {0x2F8F6, UNICODE_NORM_QC_NO}, + {0x2F8F7, UNICODE_NORM_QC_NO}, + {0x2F8F8, UNICODE_NORM_QC_NO}, + {0x2F8F9, UNICODE_NORM_QC_NO}, + {0x2F8FA, UNICODE_NORM_QC_NO}, + {0x2F8FB, UNICODE_NORM_QC_NO}, + {0x2F8FC, UNICODE_NORM_QC_NO}, + {0x2F8FD, UNICODE_NORM_QC_NO}, + {0x2F8FE, UNICODE_NORM_QC_NO}, + {0x2F8FF, UNICODE_NORM_QC_NO}, + {0x2F900, UNICODE_NORM_QC_NO}, + {0x2F901, UNICODE_NORM_QC_NO}, + {0x2F902, UNICODE_NORM_QC_NO}, + {0x2F903, UNICODE_NORM_QC_NO}, + {0x2F904, UNICODE_NORM_QC_NO}, + {0x2F905, UNICODE_NORM_QC_NO}, + {0x2F906, UNICODE_NORM_QC_NO}, + {0x2F907, UNICODE_NORM_QC_NO}, + {0x2F908, UNICODE_NORM_QC_NO}, + {0x2F909, UNICODE_NORM_QC_NO}, + {0x2F90A, UNICODE_NORM_QC_NO}, + {0x2F90B, UNICODE_NORM_QC_NO}, + {0x2F90C, UNICODE_NORM_QC_NO}, + {0x2F90D, UNICODE_NORM_QC_NO}, + {0x2F90E, UNICODE_NORM_QC_NO}, + {0x2F90F, UNICODE_NORM_QC_NO}, + {0x2F910, UNICODE_NORM_QC_NO}, + {0x2F911, UNICODE_NORM_QC_NO}, + {0x2F912, UNICODE_NORM_QC_NO}, + {0x2F913, UNICODE_NORM_QC_NO}, + {0x2F914, UNICODE_NORM_QC_NO}, + {0x2F915, UNICODE_NORM_QC_NO}, + {0x2F916, UNICODE_NORM_QC_NO}, + {0x2F917, UNICODE_NORM_QC_NO}, + {0x2F918, UNICODE_NORM_QC_NO}, + {0x2F919, UNICODE_NORM_QC_NO}, + {0x2F91A, UNICODE_NORM_QC_NO}, + {0x2F91B, UNICODE_NORM_QC_NO}, + {0x2F91C, UNICODE_NORM_QC_NO}, + {0x2F91D, UNICODE_NORM_QC_NO}, + {0x2F91E, UNICODE_NORM_QC_NO}, + {0x2F91F, UNICODE_NORM_QC_NO}, + {0x2F920, UNICODE_NORM_QC_NO}, + {0x2F921, UNICODE_NORM_QC_NO}, + {0x2F922, UNICODE_NORM_QC_NO}, + {0x2F923, UNICODE_NORM_QC_NO}, + {0x2F924, UNICODE_NORM_QC_NO}, + {0x2F925, UNICODE_NORM_QC_NO}, + {0x2F926, UNICODE_NORM_QC_NO}, + {0x2F927, UNICODE_NORM_QC_NO}, + {0x2F928, UNICODE_NORM_QC_NO}, + {0x2F929, UNICODE_NORM_QC_NO}, + {0x2F92A, UNICODE_NORM_QC_NO}, + {0x2F92B, UNICODE_NORM_QC_NO}, + {0x2F92C, UNICODE_NORM_QC_NO}, + {0x2F92D, UNICODE_NORM_QC_NO}, + {0x2F92E, UNICODE_NORM_QC_NO}, + {0x2F92F, UNICODE_NORM_QC_NO}, + {0x2F930, UNICODE_NORM_QC_NO}, + {0x2F931, UNICODE_NORM_QC_NO}, + {0x2F932, UNICODE_NORM_QC_NO}, + {0x2F933, UNICODE_NORM_QC_NO}, + {0x2F934, UNICODE_NORM_QC_NO}, + {0x2F935, UNICODE_NORM_QC_NO}, + {0x2F936, UNICODE_NORM_QC_NO}, + {0x2F937, UNICODE_NORM_QC_NO}, + {0x2F938, UNICODE_NORM_QC_NO}, + {0x2F939, UNICODE_NORM_QC_NO}, + {0x2F93A, UNICODE_NORM_QC_NO}, + {0x2F93B, UNICODE_NORM_QC_NO}, + {0x2F93C, UNICODE_NORM_QC_NO}, + {0x2F93D, UNICODE_NORM_QC_NO}, + {0x2F93E, UNICODE_NORM_QC_NO}, + {0x2F93F, UNICODE_NORM_QC_NO}, + {0x2F940, UNICODE_NORM_QC_NO}, + {0x2F941, UNICODE_NORM_QC_NO}, + {0x2F942, UNICODE_NORM_QC_NO}, + {0x2F943, UNICODE_NORM_QC_NO}, + {0x2F944, UNICODE_NORM_QC_NO}, + {0x2F945, UNICODE_NORM_QC_NO}, + {0x2F946, UNICODE_NORM_QC_NO}, + {0x2F947, UNICODE_NORM_QC_NO}, + {0x2F948, UNICODE_NORM_QC_NO}, + {0x2F949, UNICODE_NORM_QC_NO}, + {0x2F94A, UNICODE_NORM_QC_NO}, + {0x2F94B, UNICODE_NORM_QC_NO}, + {0x2F94C, UNICODE_NORM_QC_NO}, + {0x2F94D, UNICODE_NORM_QC_NO}, + {0x2F94E, UNICODE_NORM_QC_NO}, + {0x2F94F, UNICODE_NORM_QC_NO}, + {0x2F950, UNICODE_NORM_QC_NO}, + {0x2F951, UNICODE_NORM_QC_NO}, + {0x2F952, UNICODE_NORM_QC_NO}, + {0x2F953, UNICODE_NORM_QC_NO}, + {0x2F954, UNICODE_NORM_QC_NO}, + {0x2F955, UNICODE_NORM_QC_NO}, + {0x2F956, UNICODE_NORM_QC_NO}, + {0x2F957, UNICODE_NORM_QC_NO}, + {0x2F958, UNICODE_NORM_QC_NO}, + {0x2F959, UNICODE_NORM_QC_NO}, + {0x2F95A, UNICODE_NORM_QC_NO}, + {0x2F95B, UNICODE_NORM_QC_NO}, + {0x2F95C, UNICODE_NORM_QC_NO}, + {0x2F95D, UNICODE_NORM_QC_NO}, + {0x2F95E, UNICODE_NORM_QC_NO}, + {0x2F95F, UNICODE_NORM_QC_NO}, + {0x2F960, UNICODE_NORM_QC_NO}, + {0x2F961, UNICODE_NORM_QC_NO}, + {0x2F962, UNICODE_NORM_QC_NO}, + {0x2F963, UNICODE_NORM_QC_NO}, + {0x2F964, UNICODE_NORM_QC_NO}, + {0x2F965, UNICODE_NORM_QC_NO}, + {0x2F966, UNICODE_NORM_QC_NO}, + {0x2F967, UNICODE_NORM_QC_NO}, + {0x2F968, UNICODE_NORM_QC_NO}, + {0x2F969, UNICODE_NORM_QC_NO}, + {0x2F96A, UNICODE_NORM_QC_NO}, + {0x2F96B, UNICODE_NORM_QC_NO}, + {0x2F96C, UNICODE_NORM_QC_NO}, + {0x2F96D, UNICODE_NORM_QC_NO}, + {0x2F96E, UNICODE_NORM_QC_NO}, + {0x2F96F, UNICODE_NORM_QC_NO}, + {0x2F970, UNICODE_NORM_QC_NO}, + {0x2F971, UNICODE_NORM_QC_NO}, + {0x2F972, UNICODE_NORM_QC_NO}, + {0x2F973, UNICODE_NORM_QC_NO}, + {0x2F974, UNICODE_NORM_QC_NO}, + {0x2F975, UNICODE_NORM_QC_NO}, + {0x2F976, UNICODE_NORM_QC_NO}, + {0x2F977, UNICODE_NORM_QC_NO}, + {0x2F978, UNICODE_NORM_QC_NO}, + {0x2F979, UNICODE_NORM_QC_NO}, + {0x2F97A, UNICODE_NORM_QC_NO}, + {0x2F97B, UNICODE_NORM_QC_NO}, + {0x2F97C, UNICODE_NORM_QC_NO}, + {0x2F97D, UNICODE_NORM_QC_NO}, + {0x2F97E, UNICODE_NORM_QC_NO}, + {0x2F97F, UNICODE_NORM_QC_NO}, + {0x2F980, UNICODE_NORM_QC_NO}, + {0x2F981, UNICODE_NORM_QC_NO}, + {0x2F982, UNICODE_NORM_QC_NO}, + {0x2F983, UNICODE_NORM_QC_NO}, + {0x2F984, UNICODE_NORM_QC_NO}, + {0x2F985, UNICODE_NORM_QC_NO}, + {0x2F986, UNICODE_NORM_QC_NO}, + {0x2F987, UNICODE_NORM_QC_NO}, + {0x2F988, UNICODE_NORM_QC_NO}, + {0x2F989, UNICODE_NORM_QC_NO}, + {0x2F98A, UNICODE_NORM_QC_NO}, + {0x2F98B, UNICODE_NORM_QC_NO}, + {0x2F98C, UNICODE_NORM_QC_NO}, + {0x2F98D, UNICODE_NORM_QC_NO}, + {0x2F98E, UNICODE_NORM_QC_NO}, + {0x2F98F, UNICODE_NORM_QC_NO}, + {0x2F990, UNICODE_NORM_QC_NO}, + {0x2F991, UNICODE_NORM_QC_NO}, + {0x2F992, UNICODE_NORM_QC_NO}, + {0x2F993, UNICODE_NORM_QC_NO}, + {0x2F994, UNICODE_NORM_QC_NO}, + {0x2F995, UNICODE_NORM_QC_NO}, + {0x2F996, UNICODE_NORM_QC_NO}, + {0x2F997, UNICODE_NORM_QC_NO}, + {0x2F998, UNICODE_NORM_QC_NO}, + {0x2F999, UNICODE_NORM_QC_NO}, + {0x2F99A, UNICODE_NORM_QC_NO}, + {0x2F99B, UNICODE_NORM_QC_NO}, + {0x2F99C, UNICODE_NORM_QC_NO}, + {0x2F99D, UNICODE_NORM_QC_NO}, + {0x2F99E, UNICODE_NORM_QC_NO}, + {0x2F99F, UNICODE_NORM_QC_NO}, + {0x2F9A0, UNICODE_NORM_QC_NO}, + {0x2F9A1, UNICODE_NORM_QC_NO}, + {0x2F9A2, UNICODE_NORM_QC_NO}, + {0x2F9A3, UNICODE_NORM_QC_NO}, + {0x2F9A4, UNICODE_NORM_QC_NO}, + {0x2F9A5, UNICODE_NORM_QC_NO}, + {0x2F9A6, UNICODE_NORM_QC_NO}, + {0x2F9A7, UNICODE_NORM_QC_NO}, + {0x2F9A8, UNICODE_NORM_QC_NO}, + {0x2F9A9, UNICODE_NORM_QC_NO}, + {0x2F9AA, UNICODE_NORM_QC_NO}, + {0x2F9AB, UNICODE_NORM_QC_NO}, + {0x2F9AC, UNICODE_NORM_QC_NO}, + {0x2F9AD, UNICODE_NORM_QC_NO}, + {0x2F9AE, UNICODE_NORM_QC_NO}, + {0x2F9AF, UNICODE_NORM_QC_NO}, + {0x2F9B0, UNICODE_NORM_QC_NO}, + {0x2F9B1, UNICODE_NORM_QC_NO}, + {0x2F9B2, UNICODE_NORM_QC_NO}, + {0x2F9B3, UNICODE_NORM_QC_NO}, + {0x2F9B4, UNICODE_NORM_QC_NO}, + {0x2F9B5, UNICODE_NORM_QC_NO}, + {0x2F9B6, UNICODE_NORM_QC_NO}, + {0x2F9B7, UNICODE_NORM_QC_NO}, + {0x2F9B8, UNICODE_NORM_QC_NO}, + {0x2F9B9, UNICODE_NORM_QC_NO}, + {0x2F9BA, UNICODE_NORM_QC_NO}, + {0x2F9BB, UNICODE_NORM_QC_NO}, + {0x2F9BC, UNICODE_NORM_QC_NO}, + {0x2F9BD, UNICODE_NORM_QC_NO}, + {0x2F9BE, UNICODE_NORM_QC_NO}, + {0x2F9BF, UNICODE_NORM_QC_NO}, + {0x2F9C0, UNICODE_NORM_QC_NO}, + {0x2F9C1, UNICODE_NORM_QC_NO}, + {0x2F9C2, UNICODE_NORM_QC_NO}, + {0x2F9C3, UNICODE_NORM_QC_NO}, + {0x2F9C4, UNICODE_NORM_QC_NO}, + {0x2F9C5, UNICODE_NORM_QC_NO}, + {0x2F9C6, UNICODE_NORM_QC_NO}, + {0x2F9C7, UNICODE_NORM_QC_NO}, + {0x2F9C8, UNICODE_NORM_QC_NO}, + {0x2F9C9, UNICODE_NORM_QC_NO}, + {0x2F9CA, UNICODE_NORM_QC_NO}, + {0x2F9CB, UNICODE_NORM_QC_NO}, + {0x2F9CC, UNICODE_NORM_QC_NO}, + {0x2F9CD, UNICODE_NORM_QC_NO}, + {0x2F9CE, UNICODE_NORM_QC_NO}, + {0x2F9CF, UNICODE_NORM_QC_NO}, + {0x2F9D0, UNICODE_NORM_QC_NO}, + {0x2F9D1, UNICODE_NORM_QC_NO}, + {0x2F9D2, UNICODE_NORM_QC_NO}, + {0x2F9D3, UNICODE_NORM_QC_NO}, + {0x2F9D4, UNICODE_NORM_QC_NO}, + {0x2F9D5, UNICODE_NORM_QC_NO}, + {0x2F9D6, UNICODE_NORM_QC_NO}, + {0x2F9D7, UNICODE_NORM_QC_NO}, + {0x2F9D8, UNICODE_NORM_QC_NO}, + {0x2F9D9, UNICODE_NORM_QC_NO}, + {0x2F9DA, UNICODE_NORM_QC_NO}, + {0x2F9DB, UNICODE_NORM_QC_NO}, + {0x2F9DC, UNICODE_NORM_QC_NO}, + {0x2F9DD, UNICODE_NORM_QC_NO}, + {0x2F9DE, UNICODE_NORM_QC_NO}, + {0x2F9DF, UNICODE_NORM_QC_NO}, + {0x2F9E0, UNICODE_NORM_QC_NO}, + {0x2F9E1, UNICODE_NORM_QC_NO}, + {0x2F9E2, UNICODE_NORM_QC_NO}, + {0x2F9E3, UNICODE_NORM_QC_NO}, + {0x2F9E4, UNICODE_NORM_QC_NO}, + {0x2F9E5, UNICODE_NORM_QC_NO}, + {0x2F9E6, UNICODE_NORM_QC_NO}, + {0x2F9E7, UNICODE_NORM_QC_NO}, + {0x2F9E8, UNICODE_NORM_QC_NO}, + {0x2F9E9, UNICODE_NORM_QC_NO}, + {0x2F9EA, UNICODE_NORM_QC_NO}, + {0x2F9EB, UNICODE_NORM_QC_NO}, + {0x2F9EC, UNICODE_NORM_QC_NO}, + {0x2F9ED, UNICODE_NORM_QC_NO}, + {0x2F9EE, UNICODE_NORM_QC_NO}, + {0x2F9EF, UNICODE_NORM_QC_NO}, + {0x2F9F0, UNICODE_NORM_QC_NO}, + {0x2F9F1, UNICODE_NORM_QC_NO}, + {0x2F9F2, UNICODE_NORM_QC_NO}, + {0x2F9F3, UNICODE_NORM_QC_NO}, + {0x2F9F4, UNICODE_NORM_QC_NO}, + {0x2F9F5, UNICODE_NORM_QC_NO}, + {0x2F9F6, UNICODE_NORM_QC_NO}, + {0x2F9F7, UNICODE_NORM_QC_NO}, + {0x2F9F8, UNICODE_NORM_QC_NO}, + {0x2F9F9, UNICODE_NORM_QC_NO}, + {0x2F9FA, UNICODE_NORM_QC_NO}, + {0x2F9FB, UNICODE_NORM_QC_NO}, + {0x2F9FC, UNICODE_NORM_QC_NO}, + {0x2F9FD, UNICODE_NORM_QC_NO}, + {0x2F9FE, UNICODE_NORM_QC_NO}, + {0x2F9FF, UNICODE_NORM_QC_NO}, + {0x2FA00, UNICODE_NORM_QC_NO}, + {0x2FA01, UNICODE_NORM_QC_NO}, + {0x2FA02, UNICODE_NORM_QC_NO}, + {0x2FA03, UNICODE_NORM_QC_NO}, + {0x2FA04, UNICODE_NORM_QC_NO}, + {0x2FA05, UNICODE_NORM_QC_NO}, + {0x2FA06, UNICODE_NORM_QC_NO}, + {0x2FA07, UNICODE_NORM_QC_NO}, + {0x2FA08, UNICODE_NORM_QC_NO}, + {0x2FA09, UNICODE_NORM_QC_NO}, + {0x2FA0A, UNICODE_NORM_QC_NO}, + {0x2FA0B, UNICODE_NORM_QC_NO}, + {0x2FA0C, UNICODE_NORM_QC_NO}, + {0x2FA0D, UNICODE_NORM_QC_NO}, + {0x2FA0E, UNICODE_NORM_QC_NO}, + {0x2FA0F, UNICODE_NORM_QC_NO}, + {0x2FA10, UNICODE_NORM_QC_NO}, + {0x2FA11, UNICODE_NORM_QC_NO}, + {0x2FA12, UNICODE_NORM_QC_NO}, + {0x2FA13, UNICODE_NORM_QC_NO}, + {0x2FA14, UNICODE_NORM_QC_NO}, + {0x2FA15, UNICODE_NORM_QC_NO}, + {0x2FA16, UNICODE_NORM_QC_NO}, + {0x2FA17, UNICODE_NORM_QC_NO}, + {0x2FA18, UNICODE_NORM_QC_NO}, + {0x2FA19, UNICODE_NORM_QC_NO}, + {0x2FA1A, UNICODE_NORM_QC_NO}, + {0x2FA1B, UNICODE_NORM_QC_NO}, + {0x2FA1C, UNICODE_NORM_QC_NO}, + {0x2FA1D, UNICODE_NORM_QC_NO}, +}; + +/* Perfect hash function for NFKC_QC */ +static int +NFKC_QC_hash_func(const void *key) +{ + static const int16 h[10193] = { + 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, + 1886, 1887, 1888, 32767, 32767, 1889, 3141, -7211, + 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, + -1320, 1901, 1902, -1322, 1904, 1905, 1921, 1921, + 1921, 1909, 1910, 1911, 1924, 1924, 1914, 1915, + 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, + 1924, 1925, -1976, 4681, 1323, 1929, 1930, 4682, + 1932, 1933, 1934, 1935, 1936, 1937, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 422, 510, 422, 422, + 0, 0, 0, 0, 0, 0, 0, 1822, + 0, 431, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1840, 1840, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2762, 2762, 2762, + 2762, 2762, 2762, 2762, 2762, 2762, 2762, 2762, + 2762, 2762, 2762, 2762, 2762, 2762, 2762, 2762, + 2762, 2762, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2812, 2812, 2812, 2812, + 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, + 2812, 2812, -1449, 5319, 2812, 2812, 2812, 2812, + 2812, 2812, 2812, 2812, 2812, 2812, -534, 0, + 0, 0, 0, 348, 32767, 349, 0, 0, + 0, 0, 0, 0, 32767, 32767, 0, 0, + 0, -1517, 0, -1517, 32767, -1516, 4370, 4371, + 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, + 0, 32767, 32767, -23190,4110, 0, 0, 0, + 0, 0, 0, 32767, 0, 0, 0, 0, + -622, -622, 0, -3928, -1253, -1252, -5473, -3927, + -3927, -3927, -3927, -3927, -3927, -3927, -3927, -3927, + -3927, -3927, -3927, -3927, -3927, -3580, -3580, -3925, + -3580, -3924, -3580, -3580, -3922, -3922, -3922, -3922, + -3922, -3922, -3922, -3922, 0, 0, -3484, -3919, + -3482, -3918, -3480, -3578, -3916, -3916, -3578, -3578, + -3578, -3913, -3913, -3913, -3913, -3913, -3913, -3913, + -3913, -3913, -3913, -3913, -3913, -3913, -3913, -3913, + -3913, -3913, -3913, -3913, -3913, -3913, -3913, -3913, + -3913, -3913, -3913, -3913, -3913, -3913, -3913, -3913, + -3913, -3913, -3913, -3913, -3913, -3578, 625, -5288, + 627, 628, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2496, 2497, 2498, 2499, 2500, + 2501, 2502, 2503, 2504, 2505, 2506, 2507, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -1769, -1768, -1767, -3528, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, -4117, -4459, -4459, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -2719, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -6479, -6478, -6477, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 41, 42, 43, 44, 45, 46, + 32767, 32767, 47, 48, 49, 50, 51, 32767, + 32767, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 52, 1131, 8054, 3425, -19247, + 8047, -19248,8049, -19249,8051, -14620,8053, -19240, + 8056, 3330, 8058, 8059, 3430, -19242,3330, 3330, + 3330, 3330, 3330, -11231,8049, 3330, 3330, 3330, + 3330, -3326, 33, -3326, 3330, -3325, -3325, -3325, + 3330, -3326, -3326, 1075, 4681, 4682, 8076, -3327, + 8079, 19509, -7787, 4688, 4689, 1331, 4691, -1964, + 4692, 4693, 4694, 4695, 4696, 4697, 297, -3308, + -3308, -6701, 4703, -6702, -18131,9166, -3308, 4711, + -2199, 4724, 95, -22577,4717, -22578,4719, -22579, + 4721, -17950,4723, -22570,4726, 0, 4728, 4729, + 100, -22572,0, 0, 0, 0, 0, -14561, + 4719, 0, 0, 0, 0, -6656, -3297, -6656, + 0, -6655, -6655, -6655, 0, -6656, -6656, -2255, + 1351, 1352, 4746, -6657, 4749, 16179, -11117,1358, + 1359, -1999, 0, 0, 0, 938, 0, 0, + 0, 0, 0, 0, 1255, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 4081, 4081, 4081, + 4081, 4081, 2312, 2313, 2314, 553, 0, 0, + 0, 0, 0, 0, 0, 0, 3580, 2958, + 2958, 3580, -348, 2327, 2328, -1893, -347, -347, + -347, -347, -347, -347, -347, -347, -347, -347, + -347, -347, -347, -347, 0, 0, -345, 0, + -344, 0, 0, -342, -342, -342, -342, -342, + -342, -342, -342, -342, -342, 94, -341, 96, + -340, 98, 0, -338, -338, 0, 0, 0, + -335, -335, -335, -335, -335, -335, -335, -335, + -335, -335, -335, -335, -335, -335, -335, -335, + -335, -335, -335, -335, -335, -335, -335, -335, + -335, -335, -335, -335, -335, -335, -335, -335, + -335, -335, -335, -335, 0, 4203, -1710, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 1, 32767, 2, 32767, 32767, 32767, 32767, -2759, + 32767, 32767, -2758, -2757, -2756, -2755, 32767, 32767, + -2754, -2753, -2752, 32767, -2751, -2750, -2749, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, -1362, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 682, + 683, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 4205, 4206, 4207, + 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, + 4216, -4880, 4218, 5470, -4882, 4221, 4222, 4223, + 4224, 4225, 4226, 4227, 4228, 1009, 4230, 4231, + 1007, 4233, 4234, 4250, 4250, 4250, 4238, 4239, + 4240, 4253, 4253, 4243, 4244, 4245, 4246, 4247, + 4248, 4249, 4250, 4251, 4252, 4253, 4254, 353, + 7010, 3652, 4258, 4259, 7011, 4261, 4262, 4263, + 4264, 4265, 4266, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 105, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 2834, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -2302, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -2356, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, -4130, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -48, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 299, 32767, 300, 301, -2381, -2381, -2381, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -2388, 32767, + 32767, -4398, -4398, -4398, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -17740,32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4825, 32767, 32767, 32767, 32767, -4293, + 32767, 32767, 32767, 109, -5804, 111, 112, 32767, + 32767, -4301, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -2438, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 685, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -20069,32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 3994, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -6790, -6790, + 157, -3219, -17570,-1719, -1719, -3027, -3027, -19414, + -3027, -9665, -3028, -3028, -3028, -3028, -3028, 4977, + 577, -3028, -3028, -6421, 4983, -6422, -17851,9446, + -3028, -3028, 331, -3028, 3628, -3027, -3027, -3027, + -3027, -3027, -3027, 1374, 4980, 4981, 8375, -3028, + 8378, 19808, -7488, 4987, -3031, 3880, -3042, 1588, + 24261, -3032, 24264, -3032, 24267, -3032, 19640, -3032, + 24262, -3033, 1694, -3033, -3033, 1597, 24270, 1699, + 1700, 1701, 1702, 1703, 16265, -3014, 1706, 1707, + 1708, 1709, 8366, 5008, 8368, 1713, 8369, 8370, + 8371, 1717, 8374, 8375, 3975, 370, 370, -3023, + 8381, -3024, -14453,12844, 370, 8389, 1479, 8402, + 3773, -18899,8395, -18900,8397, -18901,8399, -14272, + 8401, -18892,8404, 3678, 8406, 8407, 3778, -18894, + 3678, 3678, 3678, 3678, 3678, -10883,8397, 3678, + 3678, 3678, 3678, -2978, 381, -2978, 3678, -2977, + -2977, -2977, 3678, -2978, -2978, 1423, 5029, 5030, + 8424, -2979, 8427, 19857, -7439, 5036, 5037, 1679, + 5039, -1616, 5040, 5041, 5042, 5043, 5044, 5045, + 645, -2960, -2960, -6353, 5051, -6354, -17783,9514, + -2960, 5059, -1851, 5072, 443, -22229,5065, -22230, + 5067, -22231,5069, -17602,5071, -22222,5074, 348, + 5076, 5077, 448, -22224,348, 348, 348, 348, + 348, -14213,5067, 348, 348, 348, 348, -6308, + -2949, -6308, 348, -6307, -6307, -6307, 348, -6308, + -6308, -1907, 1699, 1700, 5094, -6309, 5097, 16527, + -10769,1706, 1707, -1651, 348, 348, 348, 1286, + 348, 348, 348, 348, 348, 348, 1603, 348, + 348, 348, 348, 348, 348, 348, 348, 348, + 348, 348, 348, 348, 348, 348, 348, 348, + 348, 348, 348, 348, 348, 348, 348, 4429, + 4429, 4429, 4429, 4429, 2660, 2661, 2662, 901, + 348, 348, 348, 348, 348, 348, 348, 348, + 3928, 3306, 3306, 3928, 0, 2675, 2676, 2677, + 2678, 0, 2680, 0, 0, 2683, 2684, 2685, + 2686, 4556, 2687, 2688, 2689, 8575, 2691, 2692, + -9266, -9266, -4636, 18037, -9256, 18040, -9256, 18043, + 18044, 13415, -9257, 18037, -9258, 18039, -9259, -9259, + -4629, 18044, 4581, 4582, 4583, -2184, -4527, 10035, + -9244, -2185, -4524, 4590, -4523, 2134, -1224, 2717, + 4595, 2719, 2720, 4598, 6107, 6107, 6107, 2725, + 2726, 2727, 4605, 2729, 2730, 2731, 4609, 2736, + 4611, 4612, 4613, 6118, 6118, 4616, 6119, 2743, + 4619, 4620, 2744, 2745, 6123, 2747, 6124, 4626, + 4627, 4628, 4629, 2753, 4631, 2755, 4633, 8896, + 8897, 8898, 4637, 4638, 4639, 4640, 0, 0, + 0, 0, 0, -1812, 0, 0, 0, 8925, + 0, 0, 1330, -3389, 0, 0, 0, 8940, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 10649, 8068, 0, 0, 16017, 8807, 8808, -1676, + 906, 8811, -7039, -7038, 173, 173, 10658, 8077, + 173, 16024, 16024, 8814, 8815, -1669, 913, 8818, + -7032, -7031, 180, 180, 10665, 8084, 180, 16031, + 16031, 8821, 8822, -1662, 920, 8825, 9014, -7023, + 188, 188, 10673, 8092, 188, 0, 16038, 8828, + 8829, -1655, 927, 8832, 4727, 4728, 4729, 4730, + 4305, 4732, 4733, 4734, 4735, 4736, 4737, 4738, + 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, + 4747, 4748, 1540, 1540, 1540, 1540, 1540, 1540, + 1540, 1540, 1540, 1540, 1540, -1893, 1540, 1540, + 1540, 1540, 1540, 1540, 1540, 1540, 1540, 1540, + 1540, 1540, 1540, 1540, 1540, 1540, 1540, 1540, + 1540, 1540, 1540, 1540, 1540, 1540, 911, 1540, + 4614, 4615, 4616, 4617, 4618, 1540, 4619, 4620, + 4621, 4622, 4623, 4624, 4625, 4626, 4627, -7592, + 11688, 4630, 4631, 4632, 4633, 4634, 4635, 32767, + 4810, 4811, 4812, 4813, 3850, 3851, 4816, 4817, + 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, + 4573, 4573, 4573, 4573, 4830, 4574, 4574, 4574, + 4834, 4575, 4575, 4575, 4575, 4575, 917, 918, + 4575, 4575, 4575, 4575, 923, 4576, 4576, 926, + 927, 928, 7709, 930, 931, 932, 933, 934, + 7717, 936, 7719, 938, 7722, 940, 941, 942, + 943, 944, 945, 946, 7733, 948, 949, 950, + 951, 952, 953, 954, 955, 956, 957, 958, + 959, 960, 961, 962, 963, 964, 965, 4765, + 967, 968, 969, 970, 971, 972, 973, 974, + 975, 976, 977, 978, 4902, 4903, -2043, 1334, + 15686, -164, -163, 1146, 1147, 17535, 1149, 7788, + 1152, 1153, 1154, 1155, 1156, -6848, -2447, 1159, + 1160, 4554, -6849, 4557, 15987, -11309,1166, 7797, + 7798, 7799, -5489, 1167, 1168, 1169, 1170, 1171, + 1172, -3228, -6833, -6833, -10226,1178, -10227,-21656, + 7812, 7813, 7814, 7815, 7816, 4951, 7817, 7818, + 4954, 4955, 4956, 4957, 4958, 4959, 4960, 4961, + 4962, 7837, 4964, 4965, 4966, 4967, 4968, 4969, + 4970, 4971, 4972, 4973, 4974, 4975, 4976, 4977, + 4978, 4979, 4980, 4981, 4982, 4983, 4984, 4985, + 4986, 4987, 4988, 4989, 4990, 4991, 4992, 4993, + 4994, 4995, 4996, 4997, 4998, 4999, 5000, 5001, + 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, + 5010, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -224, -224, -224, -6880, -3521, -6880, -224, + -6879, -6879, -6879, -6879, -6879, -6879, -2478, 1128, + 1129, 4523, -6880, 4526, 15956, -11340,1135, -6883, + 28, -6894, -2264, 20409, -6884, 20412, -6884, 20415, + 20416, 15787, -6885, 20409, -6886, -2159, -6886, -6886, + -2256, 20417, -2154, -2153, -2152, -2151, -2150, 12412, + -6867, -2147, -2146, -2145, -2144, 4513, 1155, 4515, + -2140, 4516, 4517, 4518, -2136, 4521, 4522, 122, + -3483, -3483, -6876, 4528, -6877, -18306,8991, -3483, + -3483, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -3490, 911, 4517, 4518, 7912, -3491, 7915, + 19345, -7951, 4524, -3494, 3417, -3505, 1125, 23798, + -3495, 23801, -3495, 23804, -3495, 19177, -3495, 23799, + -3496, 1231, -3496, -3496, 1134, 23807, 1236, 1237, + 1238, 1239, 1240, 15802, -3477, 1243, 1244, 1245, + 1246, 7903, 4545, 7905, 1250, 7906, 7907, 7908, + 7909, 7910, 7911, 3511, -94, -94, -3487, 7917, + -3488, -14917,12380, -94, 7925, 1015, 7938, 3309, + -19363,7931, -19364,7933, -19365,7935, -14736,7937, + -19356,7940, 3214, 7942, 7943, 3314, -19358,3214, + 3214, 3214, 3214, 3214, -11347,7933, 3214, 3214, + 3214, 3214, -3442, -83, -3442, 3214, -3441, -3441, + -3441, 3214, -3442, -3442, 959, 4565, 4566, 7960, + -3443, 7963, 19393, -7903, 4572, 4573, 1215, 4575, + -2080, 4576, 4577, 4578, 4579, 4580, 4581, 181, + -3424, -3424, -6817, 4587, -6818, -18247,9050, -3424, + 4595, -2315, 4608, -21, -22693,4601, -22694,4603, + -22695,4605, -18066,4607, -22686,4610, -116, 4612, + 4613, -16, -22688,-116, -116, -116, -116, -116, + -14677,4603, -116, -116, -116, -116, -6772, -3413, + -6772, -116, -6771, -6771, -6771, -116, -6772, -6772, + -2371, 1235, 1236, 4630, -6773, 4633, 16063, -11233, + 1242, -6776, 135, -6787, -2157, 20516, -6777, 20519, + -6777, 20522, -6777, 15895, -6777, 20517, -6778, -2051, + -6778, -6778, -2148, 20525, -2046, -2045, -2044, -2043, + -2042, 12520, -6759, -2039, -2038, -2037, -2036, 4621, + 1263, 4623, -2032, 4624, 4625, 4626, -2028, 4629, + 4630, 230, -3375, -3375, -6768, 4636, -6769, -18198, + 9099, -3375, -3375, -16, -3375, 3281, -3374, -3374, + -3374, -3374, -3374, -3374, 1027, 4633, 4634, 8028, + -3375, 8031, 19461, -7835, 4640, -3378, 3533, -3389, + 1241, 23914, -3379, 23917, -3379, 23920, -3379, 19293, + -3379, 23915, -3380, 1347, -3380, -3380, 1250, 23923, + 1352, 1353, 1354, 1355, 1356, 15918, -3361, 1359, + 1360, 1361, 1362, 8019, 4661, 8021, 1366, 8022, + 8023, 8024, 1370, 8027, 8028, 3628, 23, 23, + -3370, 8034, -3371, -14800,12497, 23, 23, 3382, + 1384, 1385, 1386, 449, 1388, 1389, 1390, 1391, + 1392, 1393, 139, 1395, 1396, 1397, 1398, 1399, + 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, + 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, + 1416, 1417, 1418, -2662, -2661, -2660, -2659, -2658, + -888, -888, -888, 874, 1428, 1429, 1430, 1431, + 1432, 1433, 1434, 1435, -2144, -1521, -1520, -2141, + 1788, -886, -886, 3336, 1791, 1792, 1793, 1794, + 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, + 1803, 1804, 1458, 1459, 1805, 1461, 1806, 1463, + 1464, 1807, 1808, 1809, 1810, 1811, 1812, 1813, + 1814, 1815, 1816, 1381, 1817, 1381, 1818, 1381, + 1480, 1819, 1820, 1483, 1484, 1485, 1821, 1822, + 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, + 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, + 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, + 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, + 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, + 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, + 1871, 1872, 1873, 1874, 1875, 1876, 1877, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 9097, 0, -1251, 9102, 0, + 0, 0, 0, 0, 0, 0, 0, 3220, + 0, 0, 3225, 0, 0, -15, -14, -13, + 0, 0, 0, -12, -11, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3902, -2754, 605, 0, 0, -2751, 0, + 0, 0, 0, 0, 0, 1938, 1939, 1940, + 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, + 1949, 1950, 1951, 1530, 1443, 1532, 1533, 1956, + 1957, 1958, 1959, 1960, 1961, 1962, 141, 1964, + 1534, 1966, 1967, 1968, 1969, 1970, 1971, 1972, + 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, + 1981, 142, 143, 1984, 1985, 1986, 1987, 1988, + 1989, 1990, 1991, 1992, 1993, 1994, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 1665, 1996, 1997, + 1998, 1999, 2000, 2001, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 2002, 2003, 2004, 2005, 2006, 32767, 32767, 32767, + 32767, 32767, 2007, 32767, 2008, 2009, 2010, 2011, + 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, + 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, + -4501, -4501, -4501, -4501, -1422, -4500, -4500, -4500, + 2035, 2036, 32767, 1706, 32767, 1706, 1706, 32767, + 1705, 1705, 32767, 2042, 2043, 2044, 2045, 2046, + 2047, 1711, 2049, 1712, 2051, 4525, 4525, 4525, + 2055, 2056, 2057, 4528, 2059, 2060, 2061, 2062, + 2063, 2064, 2065, 7042, 2067, 4536, 4536, 4536, + 2071, 2072, 2073, 4539, 2075, 2076, 2077, 2078, + 2079, 2080, 2081, 2082, 2083, 2084, 1735, 1735, + 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, + 226, 227, 2097, 228, 229, 230, 6116, 232, + 233, -11725,-11725,-7095, 15578, -11715,15581, -11715, + 15584, 15585, 10956, -11716,15578, -11717,15580, -11718, + -11718,-7088, 15585, 2122, 2123, 2124, -4643, -6986, + 7576, -11703,-4644, -6983, 2131, -6982, -325, -3683, + 258, 2136, 260, 261, 2139, 3648, 3648, 3648, + 266, 267, 268, 2146, 270, 271, 272, -1029, + 32767, 32767, 32767, 32767, 6972, 2572, 32767, -1034, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -4286, + 32767, 32767, -2089, 32767, 3715, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -2492, -2492, -2492, -2492, -4304, -2492, -2492, -2492, + 6433, -2492, -2492, -1162, -5881, -2492, -2492, -2492, + 6448, -2492, -2492, -2492, -2492, -2492, -2492, -2492, + -2492, -2492, -2492, -2492, -2492, -2492, -2492, -2492, + -2492, 8157, 5576, -2492, -2492, 13525, 6315, 6316, + -4168, -1586, 6319, -9531, -9530, 32767, 2195, 2196, + 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, + 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, + 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, + 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, + 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, + 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, + 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, + 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, + 2261, 2262, -5075, 2264, 2265, 2266, 2267, 2268, + 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, + 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, + 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, + 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, + 2301, 2302, 2303, 1667, 1667, 2306, 2307, 2308, + 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, + 2317, 2318, 2319, 2320, 2321, 1358, 1359, 2324, + 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, + 2333, 2081, 2081, 2081, 2081, 2338, 2082, 2082, + 2082, 2342, 2083, 2083, 2083, 2083, 2083, -1575, + -1574, 2083, 2083, 2083, 2083, -1569, 2084, 2084, + -1566, -1565, -1564, 5217, -1562, -1561, -1560, -1559, + -1558, 5225, -1556, 5227, -1554, 5230, -1552, -1551, + -1550, -1549, -1548, -1547, -1546, 5241, -1544, -1543, + -1542, -1541, -1540, -1539, -1538, -1537, -1536, -1535, + -1534, -1533, -1532, -1531, -1530, -1529, -1528, -1527, + 2273, -1525, -1524, -1523, -1522, -1521, -1520, -1519, + -1518, -1517, -1516, -1515, -1514, 2410, 2411, -4535, + -1158, 13194, -2656, -2655, -1346, -1345, 15043, -1343, + 5296, -1340, -1339, -1338, -1337, -1336, -9340, -4939, + -1333, -1332, 2062, -9341, 2065, 13495, -13801,-1326, + 5305, 5306, 5307, -7981, -1325, -1324, -1323, -1322, + -1321, -1320, -5720, -9325, -9325, -12718,32767, 2451, + 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, + 2460, 2461, 2462, 2463, 2464, 2465, -6169, 4316, + 1735, -6169, 9682, 9682, 2472, 2473, -8011, -5429, + 2476, -13374,-13373,2479, 2480, 2481, 2482, 2483, + 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, + 2492, 2493, 2494, 2495, 2496, 2497, 2498, 203, + 1141, 203, 203, 203, 203, 203, 203, 1458, + 203, 2509, 2510, 2511, 2512, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 155, 32767, 32767, 32767, + 32767, 156, 32767, 32767, 32767, 32767, 157, 207, + 4288, 4288, 4288, 4288, 4288, 2519, 2520, 2521, + 760, 207, 207, 207, 207, 207, 207, 207, + 207, 3787, 3165, 3165, 2534, 2535, 2536, 2537, + 2538, 2539, -139, 2541, -139, -139, 2544, 2545, + 2546, 2547, 2548, 2549, 2550, 2551, 8437, 2553, + 2554, -9404, -9404, -4774, 17899, -9394, 17902, -9394, + 17905, 17906, 13277, -9395, 17899, -9396, -4669, -9396, + -9396, -4766, 17907, -4664, -4663, -4662, -4661, 0, + 32767, -9379, -4659, -4658, -4657, -4656, 2001, -1357, + 2584, 4462, 2586, 2587, 4465, 5974, 5974, 5974, + 2592, 2593, 2594, 4472, 2596, 2597, 2598, 4476, + 2603, 4478, 4479, 4480, 5985, 5985, 4483, 5986, + 2610, 4486, 4487, 2611, 2612, 5990, 2614, 5991, + 4493, 4494, 4495, 4496, 2620, 4498, 2622, 4500, + 8763, 8764, 8765, 4504, 4505, 4506, 4507, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 8635, + -1849, 733, 8638, -7212, -7211, 0, 0, 10485, + 7904, 0, 15851, 15851, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 2296, 1359, 2298, 2299, 2300, 2301, 2302, 2303, + 1049, 2305, 0, 0, 0, 0, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 173, 32767, + 32767, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 2306, -1774, -1773, -1772, -1771, -1770, 0, 0, + 0, 1762, 2316, 2317, 2318, 2319, 2320, 2321, + 2322, 2323, -1256, -633, -632, 0, 0, 0, + 0, 0, 0, 2679, 0, 2681, 2682, 0, + 0, 0, 0, 0, 0, 0, 0, -5885, + 0, 0, 11959, 11960, 7331, -15341,11953, -15342, + 11955, -15343,-15343,-10713,11960, -15333,11963, 7237, + 11965, 11966, 7337, -15335,7237, 7237, 7237, 7237, + 7237, -7324, 11956, 7237, 7237, 7237, 7237, 581, + 3940, 0, -1877, 0, 0, -1877, -3385, -3384, + -3383, 0, 0, 0, -1877, 0, 0, 0, + -1877, -3, -1877, -1877, -1877, -3381, -3380, -1877, + -3379, -2, -1877, -1877, 0, 0, -3377, 0, + -3376, -1877, -1877, -1877, -1877, 0, -1877, 0, + -1877, -6139, -6139, -6139, -1877, -1877, -1877, -1877, + 2764, 2765, 2766, 2767, 2768, 4581, 2770, 2771, + 2772, -6152, 2774, 2775, 1446, 6166, 2778, 2779, + 2780, -6159, 2782, 2783, 2784, 2785, 2786, 2787, + 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795, + 2796, 2797, -7851, -5269, 2800, 2801, -13215,-6004, + -6004, 4481, 1900, -6004, 9847, 9847, 2637, 2638, + -7846, -5264, 2641, -13209,-13208,-5997, -5997, 4488, + 1907, -5997, 9854, 9854, 2644, 2645, -7839, -5257, + 2648, -13202,-13201,-5990, -5990, 4495, 1914, -5990, + -6178, 9860, 2650, 2651, -7833, -5251, 2654, 2843, + -13194,-5983, -5983, 4502, 1921, 32767, 32767, 32767, + 32767, 32767, 2849, 2850, 1029, 2852, 2422, 2854, + 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, + 2863, 2864, 2865, 2866, 2867, 2868, 2869, 1030, + 1031, 2872, 2873, 2874, 2875, 2876, 2877, 2878, + 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, + 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, + 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, + 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, + 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, + 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, + 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, + 2935, 2936, 175, 176, 177, 178, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 2958, + 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, + 2967, 2968, 2969, 2970, 2971, 2972, 2973, 2974, + 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, + 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, + 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, + 2999, 3000, 3001, 3002, 3003, 3004, 3005, 3006, + 3007, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 4471, + -2296, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 3568, 3035, 3036, 3037, 3038, + 32767, 32767, 32767, 3039, 3040, 3041, 3042, 3043, + 3044, 32767, 32767, 3045, 3046, 3047, 4565, 3049, + 4567, 32767, 32767, -1319, -1319, -1319, -1319, -1319, + -1319, 32767, 32767, -1321, -1321, 3059, 32767, 32767, + 32767, -1050, 3061, 3062, 3063, 3064, 3065, 3066, + 32767, 3067, 3068, 3069, 3070, 3693, 3694, 3073, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 0, 0, + 0, 32767, 0, 0, 0, 0, 32767, 32767, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 0, 0, 0, 0, 0, 0, 0, + 32767, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -3663, -3662, -3661, -3660, -3659, 0, 0, + -3656, -3655, -3654, -3653, 0, -3652, -3651, 0, + 0, 0, -6780, 0, 0, 0, 0, 0, + -6782, 0, -6782, 0, -6783, 0, 0, 0, + 0, 0, 0, 0, -6786, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -3799, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -3923, -3923, 3024, -352, + -14703,1148, 1148, -160, -160, -16547,-160, -6798, + -161, -161, -161, -161, -161, 7844, 3444, -161, + -161, -3554, 7850, -3555, -14984,12313, -161, -161, + 3198, -161, 6495, -160, -160, -160, -160, -160, + -160, 4241, 7847, 7848, 11242, -161, 11245, 22675, + -4621, 7854, -164, 6747, -175, 4455, 27128, -165, + 27131, -165, 27134, -165, 22507, -165, 27129, -166, + 4561, -166, -166, 4464, 27137, 4566, 4567, 4568, + 4569, 4570, 19132, -147, 4573, 4574, 4575, 4576, + 11233, 7875, 11235, 4580, 11236, 11237, 11238, 4584, + 11241, 11242, 6842, 3237, 3237, -156, 11248, -157, + -11586,15711, 3237, 11256, 4346, 11269, 6640, -16032, + 11262, -16033,11264, -16034,11266, -11405,11268, -16025, + 11271, 6545, 11273, 11274, 6645, -16027,6545, 6545, + 6545, 6545, 6545, -8016, 11264, 6545, 6545, 6545, + 6545, -111, 3248, -111, 6545, -110, -110, -110, + 6545, -111, -111, 4290, 7896, 7897, 11291, -112, + 11294, 22724, -4572, 4364, 4365, 32767, 4366, 4367, + 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, + 4376, 4377, 4378, 4379, 4380, 4381, 4382, 32767, + 32767, 32767, 32767, 32767, 4383, 4384, 4385, 32767, + 4386, 4387, 4388, 4389, 4390, 32767, 4391, 4392, + 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, + 4401, 4402, 4403, 4404, 4405, 4406, 4407, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, -1078, -8000, -3370, 19303, + 32767, 19305, -7991, 19308, -7991, 14681, -7991, 19303, + 32767, 32767, -7994, 32767, -3365, 32767, -3264, -3263, + 32767, 32767, 32767, 32767, 32767, 32767, -3262, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 3394, 3395, + -3259, 3398, 3399, -1001, 32767, 32767, 32767, 32767, + -8004, -19433,32767, -4611, -4611, 32767, 32767, 32767, + 32767, 32767, 32767, -4616, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 6782, 18212, -9084, 3391, -4627, + 2284, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -1272, + 32767, 32767, 32767, 32767, 32767, -851, 32767, 32767, + 0, 88, 0, 0, 32767, 32767, 32767, 89, + 90, 32767, 91, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 434, 435, 0, 436, 0, + 437, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 434, 435, 436, 32767, 437, + 438, 32767, 32767, 32767, 439, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 4645, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -1906, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 4408, 4409, + 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, + 4418, 32767, 32767, 32767, 32767, 32767, 4419, 4420, + 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, + 20816, 4430, 4431, 4432, 4433, 4434, 4435, 4436, + -3568, 833, 4439, 4440, 7834, -3569, 7837, 19267, + -8029, 4446, 4447, 1089, 4449, -2206, 4450, 4451, + 4452, 4453, 4454, 4455, 55, -3550, 4458, -6944, + 4460, 4461, -18375,4463, 4464, 4465, 4466, 4477, + -152, -22824,4470, -22825,4472, -22826,4474, -18197, + 4476, 4477, 4478, -248, 4480, 4481, 32767, -22821, + 32767, -250, 32767, 32767, 32767, 32767, 32767, 32767, + -256, 32767, 32767, 32767, 32767, -6916, 32767, -6916, + 32767, -6917, 32767, -6919, -6919, -2518, 32767, 1088, + 4482, 4483, 4484, 32767, 32767, 1091, 32767, -17, + 32767, -2310, 32767, -6931, 32767, -6932, 32767, -6933, + 15739, 32767, 20360, 32767, 32767, -6937, -6937, -2307, + 20366, 32767, -2205, -2204, -2203, -2202, 12360, -6919, + -2199, 32767, -2198, -2197, 4460, 1102, 4485, -2194, + 4462, 4463, 4464, 32767, 4466, 32767, 66, -3539, + -3539, -6932, 4472, -6933, -18362,8935, 0, 0, + 32767, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 32767, 0, 0, 0, 0, 0, + 32767, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 4486, + 4487, 4488, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 4489, + 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, + 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, + 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, + 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, + 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, + 4530, 4531, 4532, 32767, 32767, 32767, 32767, 4533, + 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 4542, + 4543, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -1593, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 32767, 0, 32767, + 0, 0, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 7338, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 637, + 638, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 964, 964, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 253, 254, 255, + 256, 0, 257, 258, 259, 0, 260, 261, + 262, 263, 264, 3923, 3923, 267, 268, 269, + 270, 3923, 271, 272, 3923, 3923, 3923, -2857, + 3923, 3923, 3923, 3923, 3923, -2859, 3923, -2859, + 3923, -2860, 3923, 3923, 3923, 3923, 3923, 3923, + 3923, -2863, 3923, 3923, 3923, 3923, 3923, 3923, + 3923, 3923, 3923, 3923, 3923, 3923, 3923, 3923, + 3923, 3923, 3923, 3923, 124, 3923, 3923, 3923, + 3923, 3923, 3923, 3923, 3923, 3923, 3923, 3923, + 3923, 0, 0, 6947, 3571, -10780,5071, 5071, + 3763, 3763, -12624,3763, -2875, 3762, 3762, 3762, + 3762, 3762, 11767, 7367, 3762, 3762, 369, 11773, + 368, -11061,16236, 3762, -2868, -2868, -2868, 10421, + 3766, 3766, 3766, 3766, 3766, 3766, 8167, 11773, + 11774, 15168, 3765, 15171, 26601, -2866, -2866, -2866, + -2866, -2866, 0, -2865, -2865, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -2874, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5011, 5012, + 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020, + 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, + 5029, 5030, 5031, 5032, 5033, 5034, 5035, 5036, + 5037, 5038, 5039, 5040, 5041, 5042, 5267, 5268, + 5269, 11926, 8568, 11928, 5273, 11929, 11930, 11931, + 11932, 11933, 11934, 7534, 3929, 3929, 536, 11940, + 535, -10894,16403, 3929, 11948, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, + 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, + 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, + 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, + 3416, 3417, 3418, 10075, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -3433, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -629, 0, 3074, 3075, 3076, 3077, 3078, + 0, 3079, 3080, 3081, 3082, 3083, 3084, 3085, + 3086, 3087, -9132, 10148, 3090, 3091, 3092, 3093, + 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, + 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, + 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, + 3118, 3119, 3120, 6777, 3121, 3122, 3123, 3124, + 3125, 3126, 3127, 3128, 3129, 6780, 0, 6780, + 6780, 6780, 0, 0, 0, 6782, 0, 0, + 0, 0, 6784, 0, 6785, 0, 6786, 6786, + 0, 6786, 0, 6787, 6787, 6787, 0, 6788, + 6788, 6788, 6788, 6788, 6788, 6788, 0, 6789, + 6789, 6789, 6789, 2990, 6789, 0, 0, 0, + 0, 6793, 6793, 6793, 6793, 6793, 0, 0, + 0, 0, 0, 0, -7904, 7947, 7947, 6639, + 6639, -9748, 32767, 0, 6637, 32767, 32767, 6635, + 32767, 32767, 10238, 6633, 32767, 32767, 14642, 3237, + -8192, 19105, 32767, 0, 0, 0, 13289, 6634, + 6634, 6634, 6634, 6634, 6634, 11035, 14641, 32767, + 18035, 32767, 18037, 29467, 0, 0, 0, 0, + 0, 32767, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 0, 0, + 0, 0, 0, 32767, 32767, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 224, 225, 226, 32767, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, + 32767, 2087, -494, -8398, 7453, 7453, 243, 244, + -10240,-7658, 247, -15603,-15602,250, 251, 252, + 253, 254, 255, 32767, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, + 268, -2027, -1089, -2027, -2027, -2027, -2027, -2027, + -2027, -772, -2027, 279, 280, 281, 282, 283, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 284, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -1717, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 285, 286, 287, 288, 289, 290, 291, 292, + 6178, 294, 295, -11663,-11663,-7033, 15640, -11653, + 15643, -11653,15646, 15647, 11018, -11654,15640, -11655, + -6928, -11655,-11655,-7025, 15648, -6923, -6922, -6921, + -6920, -6919, 7643, -11636,-6916, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -17220,-12590,10083, + -17210,10086, 5360, 10088, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, -4703, -4703, -4703, -4703, -4703, -4703, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -4261, 2507, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -3346, 32767, 32767, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 324, 32767, 325, 32767, 326, 32767, 327, 32767, + 328, 32767, 329, 32767, 330, 0, 0, 0, + 0, 0, 0, 32767, 32767, 223, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 6529, + 6530, 6531, 6532, 32767, 6532, 6533, 6534, 0, + 0, 32767, 331, 32767, 332, 333, 334, 335, + 336, 32767, 0, 0, 0, 0, 0, 0, + 337, 0, 338, 0, -2473, -2472, -2471, 0, + 0, 0, -2470, 0, 0, 0, 0, 0, + 0, 0, -4976, 0, -2468, -2467, -2466, 0, + 0, 0, -2465, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 350, 351, 0, + 0, 0, 0, 0, 0, 0, 0, 1869, + 1869, 0, 1870, 1870, 1870, -4015, 1870, 1870, + 13829, 13830, 9201, -13471,13823, -13472,13825, -13473, + -13473,-8843, 13830, -13463,13833, -13463,13836, 13837, + 9208, -13464,0, 0, 0, 6768, 9112, -5449, + 13831, 6773, 9113, 0, 9114, 2458, 5817, 1877, + 0, 1877, 1877, 0, -1508, -1507, -1506, 1877, + 1877, 1877, 0, 1877, 1877, 1877, 0, 1874, + 0, 0, 0, -1504, -1503, 0, -1502, 1875, + 0, 0, 1877, 1877, -1500, 1877, -1499, 0, + 0, 0, 0, 1877, 0, 1877, 0, -4262, + -4262, -4262, 0, 0, 0, 0, 4641, 4642, + 4643, 4644, 4645, 6458, 4647, 4648, 4649, -4275, + 4651, 4652, 3323, 8043, 4655, 4656, 4657, -4282, + 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, + 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, + -5974, -3392, 4677, 4678, -11338,-4127, -4127, 6358, + 3777, -4127, 11724, 11724, 4514, 4515, -5969, -3387, + 4518, -11332,-11331,-4120, -4120, 6365, 3784, -4120, + 11731, 11731, 4521, 4522, -5962, -3380, 4525, -11325, + -11324,-4113, -4113, 6372, 3791, -4113, -4301, 11737, + 4527, 4528, -5956, -3374, 4531, 4720, -11317,-4106, + -4106, 6379, 3798, -4106, 0, 0, 0, 0, + 426, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3209, 3210, 3211, 3212, 3213, 3214, + 3215, 3216, 3217, 3218, 3219, 6653, 3221, 3222, + 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, + 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, + 3239, 3240, 3241, 3242, 3243, 3244, 3874, 3246, + 173, 173, 173, 173, 173, 3252, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 12394, + -6885, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, -3484, + -3483, 174, 174, 174, 174, 174, 174, 174, + 174, 174, -3476, 3305, -3474, -3473, -3472, 3309, + 3310, 3311, -3470, 3313, 3314, 3315, 3316, -3467, + 3318, -3466, 3320, -3465, -3464, 3323, -3462, 3325, + -3461, -3460, -3459, 3329, -3458, -3457, -3456, -3455, + -3454, -3453, -3452, 3337, -3451, -3450, -3449, -3448, + 352, -3446, 3344, 3345, 3346, 3347, -3445, -3444, + -3443, -3442, -3441, 3353, 3354, 3355, 3356, 3357, + 3358, 11263, -4587, -4586, -3277, -3276, 13112, -3274, + 3365, -3271, -3270, -3269, -3268, -3267, -11271,-6870, + -3264, -3263, 131, -11272,134, 11564, -15732,-3257, + 3374, 3375, 3376, -9912, -3256, -3255, -3254, -3253, + -3252, -3251, -7651, -11256,-11256,-14649,-3245, -14650, + -26079,3389, 3390, 3391, 3392, 3393, 528, 3394, + 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, + 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, + 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, + 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, + 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, + 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, + 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, + 3451, 3452, 32767, 3453, 3454, 3455, 3456, 3457, + 3458, 32767, 3459, 3460, 3461, 3462, 32767, 32767, + 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, + 32767, 3471, 3472, 3473, 3474, 3475, 3476, 3477, + 32767, 3478, 3479, 3480, 3481, 3482, 3483, 3484, + 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, + 3493, 7157, 7157, 7157, 7157, 7157, 3499, 3500, + 7157, 7157, 7157, 7157, 3505, 32767, 7157, 3507, + 3508, 3509, 32767, 3510, 3511, 3512, 3513, 3514, + 32767, 3515, 32767, 32767, 32767, 3516, 3517, 3518, + 3519, 3520, 3521, 3522, 32767, 3523, 3524, 3525, + 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, + 3534, 3535, 3536, 3537, 3538, 3539, 3540, 7340, + 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, + 3550, 3551, 3552, 3553, 7477, 7478, 532, 3909, + 18261, 2411, 2412, 3721, 3722, 20110, 3724, 10363, + 3727, 3728, 3729, 3730, 3731, -4273, 128, 3734, + 3735, 7129, -4274, 7132, 18562, -8734, 3741, 3742, + 384, 3744, -2911, 3745, 3746, 3747, 3748, 3749, + 3750, -650, -4255, -4255, -7648, 3756, -7649, -19078, + 8219, -4255, 3764, -3146, 3777, -852, -23524,3770, + -23525,3772, -23526,3774, -18897,3776, -23517,3779, + -947, 3781, 3782, -847, -23519,-947, -947, -947, + -947, -947, -15508,3772, -947, -947, -947, -947, + -7603, -4244, -7603, -947, -7602, -7602, -7602, -947, + -7603, -7603, -3202, 404, 405, 3799, -7604, 3802, + 15232, -12064,411, -7607, -696, -7618, -2988, 19685, + -7608, 19688, -7608, 19691, -7608, 15064, -7608, 19686, + -7609, -2882, -7609, -7609, -2979, 19694, -2877, -2876, + -2875, -2874, -2873, 11689, -7590, -2870, -2869, -2868, + -2867, 3790, 432, 3792, -2863, 3793, 3794, 3795, + -2859, 3798, 3799, -601, -4206, -4206, -7599, 3805, + -7600, -19029,8268, -4206, -4206, -847, -4206, 2450, + -4205, -4205, -4205, -4205, -4205, -4205, 196, 3802, + 3803, 7197, -4206, 7200, 18630, -8666, 3809, -4209, + 2702, -4220, 410, 23083, -4210, 23086, -4210, 23089, + -4210, 18462, -4210, 23084, -4211, 516, -4211, -4211, + 419, 23092, 521, 522, 523, 524, 525, 15087, + -4192, 528, 529, 530, 531, 7188, 3830, 7190, + 535, 7191, 7192, 7193, 539, 7196, 7197, 2797, + -808, -808, -4201, 7203, -4202, -15631,11666, -808, + -808, 2551, -808, 5848, -807, -807, -807, -807, + -807, -807, 3594, 7200, 7201, 10595, -808, 10598, + 22028, -5268, 7207, -811, 6100, -822, 3808, 26481, + -812, 26484, -812, 26487, -812, 21860, -812, 26482, + -813, 3914, -813, -813, 3817, 26490, 3919, 3920, + 3921, 3922, 3923, 18485, -794, 3926, 3927, 3928, + 3929, 10586, 7228, 10588, 3933, 10589, 10590, 10591, + 3937, 10594, 10595, 6195, 2590, 2590, -803, 10601, + -804, -12233,15064, 2590, 10609, 3699, 10622, 5993, + -16679,10615, -16680,10617, -16681,10619, -12052,10621, + -16672,10624, 5898, 10626, 10627, 5998, -16674,5898, + 5898, 5898, 5898, 5898, -8663, 10617, 5898, 5898, + 5898, 5898, 32767, 32767, -760, 5896, -759, -759, + -759, 5896, -760, -760, 3641, 7247, 7248, 10642, + -761, 10645, 22075, -5221, 7254, 7255, 3897, 7257, + 602, 7258, 7259, 7260, 7261, 7262, 7263, 2863, + -742, -742, -4135, 7269, -4136, -15565,11732, -742, + 7277, 367, 7290, 2661, -20011,7283, -20012,7285, + -20013,7287, -15384,7289, -20004,7292, 2566, 7294, + 7295, 2666, -20006,2566, 2566, 2566, 2566, 2566, + -11995,7285, 2566, 2566, 2566, 2566, -4090, -731, + -4090, 2566, -4089, -4089, -4089, 2566, -4090, -4090, + 311, 3917, 3918, 7312, -4091, 7315, 18745, -8551, + 3924, 3925, 567, 2566, 32767, 23198, -4095, 23201, + -4095, 23204, -4095, 18577, -4095, 23199, -4096, 631, + -4096, -4096, 534, 23207, 636, 637, 638, 639, + 640, 15202, -4077, 643, 644, 645, 646, 7303, + 3945, 7305, 650, 7306, 7307, 7308, 654, 7311, + 7312, 2912, -693, -693, -4086, 7318, -4087, -15516, + 11781, -693, -693, 2666, -693, 5963, -692, -692, + -692, -692, -692, -692, 3709, 7315, 7316, 10710, + -693, 10713, 22143, -5153, 7322, -696, 6215, -707, + 3923, 26596, -697, 26599, -697, 26602, -697, 21975, + -697, 26597, -698, 4029, -698, -698, 3932, 26605, + 4034, 4035, 4036, 4037, 4038, 18600, -679, 4041, + 4042, 4043, 4044, 10701, 7343, 10703, 4048, 10704, + 10705, 10706, 4052, 10709, 10710, 6310, 2705, 2705, + -688, 10716, -689, -12118,15179, 2705, 2705, 6064, + 4066, 4067, 4068, 3131, 4070, 4071, 4072, 4073, + 4074, 4075, 2821, 4077, 4078, 4079, 4080, 4081, + 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, + 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, + 4098, 4099, 4100, 20, 21, 22, 23, 24, + 1794, 1794, 1794, 3556, 4110, 4111, 4112, 4113, + 4114, 4115, 4116, 4117, 538, 1161, 1162, 541, + 4470, 1796, 1796, 6018, 4473, 4474, 4475, 4476, + 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, + 4485, 4486, 4140, 4141, 4487, 4143, 4488, 4145, + 4146, 4489, 4490, 4491, 4492, 4493, 4494, 4495, + 4496, 575, 576, 4061, 4497, 4061, 4498, 4061, + 4160, 4499, 4500, 4163, 4164, 4165, 4501, 4502, + 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, + 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, + 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, + 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, + 4535, 4536, 4202, 0, 5914, 0, 0, 629, + 630, 631, 632, 633, 634, 635, 636, 637, + 638, 639, 640, 641, 642, 643, 644, 645, + 646, 647, 648, 649, 650, 651, 652, 653, + -1842, -1842, -1842, -1842, -1842, -1842, -1842, -1842, + -1842, -1842, -1842, -1842, 666, 667, 668, 669, + 670, 671, 672, 673, 674, 675, 676, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, -4470, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 6910, 0, 32767, 32767, 32767, + 32767, -20383,6914, 32767, 32767, 32767, 32767, 32767, + 0, 0, 0, 0, 0, 32767, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 12220, + -7059, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, -7886, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 3132, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 3133, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -16387,0, 0, 0, 0, + 0, 0, 0, 8005, 3605, 0, 0, -3393, + 8011, -3394, -14823,12474, 0, 0, 3359, 0, + 32767, 0, 0, 0, 0, 0, 0, 4401, + 8007, 0, 11403, 0, 0, 22837, 0, 0, + 0, 0, -10, 4620, 27293, 0, 27296, 0, + 27299, 0, 22672, 0, 0, 0, 4727, 0, + 0, 3135, 32767, 32767, 32767, 32767, 32767, 32767, + 3136, 32767, 32767, 3137, 32767, 3138, 3139, 3140, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 0, 32767, + 0, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 32767, 0, 32767, + 0, 32767, 32767, 0, 0, 32767, 32767, 32767, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0 + }; + + const unsigned char *k = (const unsigned char *) key; + size_t keylen = 4; + uint32 a = 0; + uint32 b = 3; + + while (keylen--) + { + unsigned char c = *k++; + + a = a * 257 + c; + b = b * 8191 + c; + } + return h[a % 10193] + h[b % 10193]; +} + +/* Hash lookup information for NFKC_QC */ +static const pg_unicode_norminfo UnicodeNormInfo_NFKC_QC = { + UnicodeNormProps_NFKC_QC, + NFKC_QC_hash_func, + 5096 +}; diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_version.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_version.h new file mode 100644 index 0000000..5f6a00b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/unicode_version.h @@ -0,0 +1,14 @@ +/*------------------------------------------------------------------------- + * + * unicode_version.h + * Unicode version used by Postgres. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_version.h + * + *------------------------------------------------------------------------- + */ + +#define PG_UNICODE_VERSION "16.0" diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/common/username.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/username.h new file mode 100644 index 0000000..e133bb7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/common/username.h @@ -0,0 +1,15 @@ +/* + * username.h + * lookup effective username + * + * Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/common/username.h + */ +#ifndef USERNAME_H +#define USERNAME_H + +extern const char *get_user_name(char **errstr); +extern const char *get_user_name_or_exit(const char *progname); + +#endif /* USERNAME_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/datatype/timestamp.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/datatype/timestamp.h new file mode 100644 index 0000000..a924d58 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/datatype/timestamp.h @@ -0,0 +1,269 @@ +/*------------------------------------------------------------------------- + * + * timestamp.h + * Timestamp and Interval typedefs and related macros. + * + * Note: this file must be includable in both frontend and backend contexts. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/datatype/timestamp.h + * + *------------------------------------------------------------------------- + */ +#ifndef DATATYPE_TIMESTAMP_H +#define DATATYPE_TIMESTAMP_H + +/* + * Timestamp represents absolute time. + * + * Interval represents delta time. Keep track of months (and years), days, + * and hours/minutes/seconds separately since the elapsed time spanned is + * unknown until instantiated relative to an absolute time. + * + * Note that Postgres uses "time interval" to mean a bounded interval, + * consisting of a beginning and ending time, not a time span - thomas 97/03/20 + * + * Timestamps, as well as the h/m/s fields of intervals, are stored as + * int64 values with units of microseconds. (Once upon a time they were + * double values with units of seconds.) + * + * TimeOffset and fsec_t are convenience typedefs for temporary variables. + * Do not use fsec_t in values stored on-disk. + * Also, fsec_t is only meant for *fractional* seconds; beware of overflow + * if the value you need to store could be many seconds. + */ + +typedef int64 Timestamp; +typedef int64 TimestampTz; +typedef int64 TimeOffset; +typedef int32 fsec_t; /* fractional seconds (in microseconds) */ + + +/* + * Storage format for type interval. + */ +typedef struct +{ + TimeOffset time; /* all time units other than days, months and + * years */ + int32 day; /* days, after time for alignment */ + int32 month; /* months and years, after time for alignment */ +} Interval; + +/* + * Data structure representing a broken-down interval. + * + * For historical reasons, this is modeled on struct pg_tm for timestamps. + * Unlike the situation for timestamps, there's no magic interpretation + * needed for months or years: they're just zero or not. Note that fields + * can be negative; however, because of the divisions done while converting + * from struct Interval, only tm_mday could be INT_MIN. This is important + * because we may need to negate the values in some code paths. + */ +struct pg_itm +{ + int tm_usec; + int tm_sec; + int tm_min; + int64 tm_hour; /* needs to be wide */ + int tm_mday; + int tm_mon; + int tm_year; +}; + +/* + * Data structure for decoding intervals. We could just use struct pg_itm, + * but then the requirement for tm_usec to be 64 bits would propagate to + * places where it's not really needed. Also, omitting the fields that + * aren't used during decoding seems like a good error-prevention measure. + */ +struct pg_itm_in +{ + int64 tm_usec; /* needs to be wide */ + int tm_mday; + int tm_mon; + int tm_year; +}; + + +/* Limits on the "precision" option (typmod) for these data types */ +#define MAX_TIMESTAMP_PRECISION 6 +#define MAX_INTERVAL_PRECISION 6 + +/* + * Round off to MAX_TIMESTAMP_PRECISION decimal places. + * Note: this is also used for rounding off intervals. + */ +#define TS_PREC_INV 1000000.0 +#define TSROUND(j) (rint(((double) (j)) * TS_PREC_INV) / TS_PREC_INV) + + +/* + * Assorted constants for datetime-related calculations + */ + +#define DAYS_PER_YEAR 365.25 /* assumes leap year every four years */ +#define MONTHS_PER_YEAR 12 +/* + * DAYS_PER_MONTH is very imprecise. The more accurate value is + * 365.2425/12 = 30.436875, or '30 days 10:29:06'. Right now we only + * return an integral number of days, but someday perhaps we should + * also return a 'time' value to be used as well. ISO 8601 suggests + * 30 days. + */ +#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */ +#define DAYS_PER_WEEK 7 +#define HOURS_PER_DAY 24 /* assume no daylight savings time changes */ + +/* + * This doesn't adjust for uneven daylight savings time intervals or leap + * seconds, and it crudely estimates leap years. A more accurate value + * for days per years is 365.2422. + */ +#define SECS_PER_YEAR (36525 * 864) /* avoid floating-point computation */ +#define SECS_PER_DAY 86400 +#define SECS_PER_HOUR 3600 +#define SECS_PER_MINUTE 60 +#define MINS_PER_HOUR 60 + +#define USECS_PER_DAY INT64CONST(86400000000) +#define USECS_PER_HOUR INT64CONST(3600000000) +#define USECS_PER_MINUTE INT64CONST(60000000) +#define USECS_PER_SEC INT64CONST(1000000) + +/* + * We allow numeric timezone offsets up to 15:59:59 either way from Greenwich. + * Currently, the record holders for wackiest offsets in actual use are zones + * Asia/Manila, at -15:56:08 until 1844, and America/Metlakatla, at +15:13:42 + * until 1867. If we were to reject such values we would fail to dump and + * restore old timestamptz values with these zone settings. + */ +#define MAX_TZDISP_HOUR 15 /* maximum allowed hour part */ +#define TZDISP_LIMIT ((MAX_TZDISP_HOUR + 1) * SECS_PER_HOUR) + +/* + * We reserve the minimum and maximum integer values to represent + * timestamp (or timestamptz) -infinity and +infinity. + */ +#define TIMESTAMP_MINUS_INFINITY PG_INT64_MIN +#define TIMESTAMP_INFINITY PG_INT64_MAX + +/* + * Historically these aliases for infinity have been used. + */ +#define DT_NOBEGIN TIMESTAMP_MINUS_INFINITY +#define DT_NOEND TIMESTAMP_INFINITY + +#define TIMESTAMP_NOBEGIN(j) \ + do {(j) = DT_NOBEGIN;} while (0) + +#define TIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN) + +#define TIMESTAMP_NOEND(j) \ + do {(j) = DT_NOEND;} while (0) + +#define TIMESTAMP_IS_NOEND(j) ((j) == DT_NOEND) + +#define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j)) + +/* + * Infinite intervals are represented by setting all fields to the minimum or + * maximum integer values. + */ +#define INTERVAL_NOBEGIN(i) \ + do { \ + (i)->time = PG_INT64_MIN; \ + (i)->day = PG_INT32_MIN; \ + (i)->month = PG_INT32_MIN; \ + } while (0) + +#define INTERVAL_IS_NOBEGIN(i) \ + ((i)->month == PG_INT32_MIN && (i)->day == PG_INT32_MIN && (i)->time == PG_INT64_MIN) + +#define INTERVAL_NOEND(i) \ + do { \ + (i)->time = PG_INT64_MAX; \ + (i)->day = PG_INT32_MAX; \ + (i)->month = PG_INT32_MAX; \ + } while (0) + +#define INTERVAL_IS_NOEND(i) \ + ((i)->month == PG_INT32_MAX && (i)->day == PG_INT32_MAX && (i)->time == PG_INT64_MAX) + +#define INTERVAL_NOT_FINITE(i) (INTERVAL_IS_NOBEGIN(i) || INTERVAL_IS_NOEND(i)) + +/* + * Julian date support. + * + * date2j() and j2date() nominally handle the Julian date range 0..INT_MAX, + * or 4714-11-24 BC to 5874898-06-03 AD. In practice, date2j() will work and + * give correct negative Julian dates for dates before 4714-11-24 BC as well. + * We rely on it to do so back to 4714-11-01 BC. Allowing at least one day's + * slop is necessary so that timestamp rotation doesn't produce dates that + * would be rejected on input. For example, '4714-11-24 00:00 GMT BC' is a + * legal timestamptz value, but in zones east of Greenwich it would print as + * sometime in the afternoon of 4714-11-23 BC; if we couldn't process such a + * date we'd have a dump/reload failure. So the idea is for IS_VALID_JULIAN + * to accept a slightly wider range of dates than we really support, and + * then we apply the exact checks in IS_VALID_DATE or IS_VALID_TIMESTAMP, + * after timezone rotation if any. To save a few cycles, we can make + * IS_VALID_JULIAN check only to the month boundary, since its exact cutoffs + * are not very critical in this scheme. + * + * It is correct that JULIAN_MINYEAR is -4713, not -4714; it is defined to + * allow easy comparison to tm_year values, in which we follow the convention + * that tm_year <= 0 represents abs(tm_year)+1 BC. + */ + +#define JULIAN_MINYEAR (-4713) +#define JULIAN_MINMONTH (11) +#define JULIAN_MINDAY (24) +#define JULIAN_MAXYEAR (5874898) +#define JULIAN_MAXMONTH (6) +#define JULIAN_MAXDAY (3) + +#define IS_VALID_JULIAN(y,m,d) \ + (((y) > JULIAN_MINYEAR || \ + ((y) == JULIAN_MINYEAR && ((m) >= JULIAN_MINMONTH))) && \ + ((y) < JULIAN_MAXYEAR || \ + ((y) == JULIAN_MAXYEAR && ((m) < JULIAN_MAXMONTH)))) + +/* Julian-date equivalents of Day 0 in Unix and Postgres reckoning */ +#define UNIX_EPOCH_JDATE 2440588 /* == date2j(1970, 1, 1) */ +#define POSTGRES_EPOCH_JDATE 2451545 /* == date2j(2000, 1, 1) */ + +/* + * Range limits for dates and timestamps. + * + * We have traditionally allowed Julian day zero as a valid datetime value, + * so that is the lower bound for both dates and timestamps. + * + * The upper limit for dates is 5874897-12-31, which is a bit less than what + * the Julian-date code can allow. For timestamps, the upper limit is + * 294276-12-31. The int64 overflow limit would be a few days later; again, + * leaving some slop avoids worries about corner-case overflow, and provides + * a simpler user-visible definition. + */ + +/* First allowed date, and first disallowed date, in Julian-date form */ +#define DATETIME_MIN_JULIAN (0) +#define DATE_END_JULIAN (2147483494) /* == date2j(JULIAN_MAXYEAR, 1, 1) */ +#define TIMESTAMP_END_JULIAN (109203528) /* == date2j(294277, 1, 1) */ + +/* Timestamp limits */ +#define MIN_TIMESTAMP INT64CONST(-211813488000000000) +/* == (DATETIME_MIN_JULIAN - POSTGRES_EPOCH_JDATE) * USECS_PER_DAY */ +#define END_TIMESTAMP INT64CONST(9223371331200000000) +/* == (TIMESTAMP_END_JULIAN - POSTGRES_EPOCH_JDATE) * USECS_PER_DAY */ + +/* Range-check a date (given in Postgres, not Julian, numbering) */ +#define IS_VALID_DATE(d) \ + ((DATETIME_MIN_JULIAN - POSTGRES_EPOCH_JDATE) <= (d) && \ + (d) < (DATE_END_JULIAN - POSTGRES_EPOCH_JDATE)) + +/* Range-check a timestamp */ +#define IS_VALID_TIMESTAMP(t) (MIN_TIMESTAMP <= (t) && (t) < END_TIMESTAMP) + +#endif /* DATATYPE_TIMESTAMP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execAsync.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execAsync.h new file mode 100644 index 0000000..d8e8ea7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execAsync.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * execAsync.h + * Support functions for asynchronous execution + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/executor/execAsync.h + *------------------------------------------------------------------------- + */ + +#ifndef EXECASYNC_H +#define EXECASYNC_H + +#include "nodes/execnodes.h" + +extern void ExecAsyncRequest(AsyncRequest *areq); +extern void ExecAsyncConfigureWait(AsyncRequest *areq); +extern void ExecAsyncNotify(AsyncRequest *areq); +extern void ExecAsyncResponse(AsyncRequest *areq); +extern void ExecAsyncRequestDone(AsyncRequest *areq, TupleTableSlot *result); +extern void ExecAsyncRequestPending(AsyncRequest *areq); + +#endif /* EXECASYNC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execExpr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execExpr.h new file mode 100644 index 0000000..7536620 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execExpr.h @@ -0,0 +1,920 @@ +/*------------------------------------------------------------------------- + * + * execExpr.h + * Low level infrastructure related to expression evaluation + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/execExpr.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXEC_EXPR_H +#define EXEC_EXPR_H + +#include "executor/nodeAgg.h" +#include "nodes/execnodes.h" +#include "nodes/miscnodes.h" + +/* forward references to avoid circularity */ +struct ExprEvalStep; +struct SubscriptingRefState; +struct ScalarArrayOpExprHashTable; +struct JsonConstructorExprState; + +/* Bits in ExprState->flags (see also execnodes.h for public flag bits): */ +/* expression's interpreter has been initialized */ +#define EEO_FLAG_INTERPRETER_INITIALIZED (1 << 5) +/* jump-threading is in use */ +#define EEO_FLAG_DIRECT_THREADED (1 << 6) + +/* Typical API for out-of-line evaluation subroutines */ +typedef void (*ExecEvalSubroutine) (ExprState *state, + struct ExprEvalStep *op, + ExprContext *econtext); + +/* API for out-of-line evaluation subroutines returning bool */ +typedef bool (*ExecEvalBoolSubroutine) (ExprState *state, + struct ExprEvalStep *op, + ExprContext *econtext); + +/* ExprEvalSteps that cache a composite type's tupdesc need one of these */ +/* (it fits in-line in some step types, otherwise allocate out-of-line) */ +typedef struct ExprEvalRowtypeCache +{ + /* + * cacheptr points to composite type's TypeCacheEntry if tupdesc_id is not + * 0; or for an anonymous RECORD type, it points directly at the cached + * tupdesc for the type, and tupdesc_id is 0. (We'd use separate fields + * if space were not at a premium.) Initial state is cacheptr == NULL. + */ + void *cacheptr; + uint64 tupdesc_id; /* last-seen tupdesc identifier, or 0 */ +} ExprEvalRowtypeCache; + +/* + * Discriminator for ExprEvalSteps. + * + * Identifies the operation to be executed and which member in the + * ExprEvalStep->d union is valid. + * + * The order of entries needs to be kept in sync with the dispatch_table[] + * array in execExprInterp.c:ExecInterpExpr(). + */ +typedef enum ExprEvalOp +{ + /* entire expression has been evaluated, return value */ + EEOP_DONE_RETURN, + + /* entire expression has been evaluated, no return value */ + EEOP_DONE_NO_RETURN, + + /* apply slot_getsomeattrs on corresponding tuple slot */ + EEOP_INNER_FETCHSOME, + EEOP_OUTER_FETCHSOME, + EEOP_SCAN_FETCHSOME, + EEOP_OLD_FETCHSOME, + EEOP_NEW_FETCHSOME, + + /* compute non-system Var value */ + EEOP_INNER_VAR, + EEOP_OUTER_VAR, + EEOP_SCAN_VAR, + EEOP_OLD_VAR, + EEOP_NEW_VAR, + + /* compute system Var value */ + EEOP_INNER_SYSVAR, + EEOP_OUTER_SYSVAR, + EEOP_SCAN_SYSVAR, + EEOP_OLD_SYSVAR, + EEOP_NEW_SYSVAR, + + /* compute wholerow Var */ + EEOP_WHOLEROW, + + /* + * Compute non-system Var value, assign it into ExprState's resultslot. + * These are not used if a CheckVarSlotCompatibility() check would be + * needed. + */ + EEOP_ASSIGN_INNER_VAR, + EEOP_ASSIGN_OUTER_VAR, + EEOP_ASSIGN_SCAN_VAR, + EEOP_ASSIGN_OLD_VAR, + EEOP_ASSIGN_NEW_VAR, + + /* assign ExprState's resvalue/resnull to a column of its resultslot */ + EEOP_ASSIGN_TMP, + /* ditto, applying MakeExpandedObjectReadOnly() */ + EEOP_ASSIGN_TMP_MAKE_RO, + + /* evaluate Const value */ + EEOP_CONST, + + /* + * Evaluate function call (including OpExprs etc). For speed, we + * distinguish in the opcode whether the function is strict with 1, 2, or + * more arguments and/or requires usage stats tracking. + */ + EEOP_FUNCEXPR, + EEOP_FUNCEXPR_STRICT, + EEOP_FUNCEXPR_STRICT_1, + EEOP_FUNCEXPR_STRICT_2, + EEOP_FUNCEXPR_FUSAGE, + EEOP_FUNCEXPR_STRICT_FUSAGE, + + /* + * Evaluate boolean AND expression, one step per subexpression. FIRST/LAST + * subexpressions are special-cased for performance. Since AND always has + * at least two subexpressions, FIRST and LAST never apply to the same + * subexpression. + */ + EEOP_BOOL_AND_STEP_FIRST, + EEOP_BOOL_AND_STEP, + EEOP_BOOL_AND_STEP_LAST, + + /* similarly for boolean OR expression */ + EEOP_BOOL_OR_STEP_FIRST, + EEOP_BOOL_OR_STEP, + EEOP_BOOL_OR_STEP_LAST, + + /* evaluate boolean NOT expression */ + EEOP_BOOL_NOT_STEP, + + /* simplified version of BOOL_AND_STEP for use by ExecQual() */ + EEOP_QUAL, + + /* unconditional jump to another step */ + EEOP_JUMP, + + /* conditional jumps based on current result value */ + EEOP_JUMP_IF_NULL, + EEOP_JUMP_IF_NOT_NULL, + EEOP_JUMP_IF_NOT_TRUE, + + /* perform NULL tests for scalar values */ + EEOP_NULLTEST_ISNULL, + EEOP_NULLTEST_ISNOTNULL, + + /* perform NULL tests for row values */ + EEOP_NULLTEST_ROWISNULL, + EEOP_NULLTEST_ROWISNOTNULL, + + /* evaluate a BooleanTest expression */ + EEOP_BOOLTEST_IS_TRUE, + EEOP_BOOLTEST_IS_NOT_TRUE, + EEOP_BOOLTEST_IS_FALSE, + EEOP_BOOLTEST_IS_NOT_FALSE, + + /* evaluate PARAM_EXEC/EXTERN parameters */ + EEOP_PARAM_EXEC, + EEOP_PARAM_EXTERN, + EEOP_PARAM_CALLBACK, + /* set PARAM_EXEC value */ + EEOP_PARAM_SET, + + /* return CaseTestExpr value */ + EEOP_CASE_TESTVAL, + EEOP_CASE_TESTVAL_EXT, + + /* apply MakeExpandedObjectReadOnly() to target value */ + EEOP_MAKE_READONLY, + + /* evaluate assorted special-purpose expression types */ + EEOP_IOCOERCE, + EEOP_IOCOERCE_SAFE, + EEOP_DISTINCT, + EEOP_NOT_DISTINCT, + EEOP_NULLIF, + EEOP_SQLVALUEFUNCTION, + EEOP_CURRENTOFEXPR, + EEOP_NEXTVALUEEXPR, + EEOP_RETURNINGEXPR, + EEOP_ARRAYEXPR, + EEOP_ARRAYCOERCE, + EEOP_ROW, + + /* + * Compare two individual elements of each of two compared ROW() + * expressions. Skip to ROWCOMPARE_FINAL if elements are not equal. + */ + EEOP_ROWCOMPARE_STEP, + + /* evaluate boolean value based on previous ROWCOMPARE_STEP operations */ + EEOP_ROWCOMPARE_FINAL, + + /* evaluate GREATEST() or LEAST() */ + EEOP_MINMAX, + + /* evaluate FieldSelect expression */ + EEOP_FIELDSELECT, + + /* + * Deform tuple before evaluating new values for individual fields in a + * FieldStore expression. + */ + EEOP_FIELDSTORE_DEFORM, + + /* + * Form the new tuple for a FieldStore expression. Individual fields will + * have been evaluated into columns of the tuple deformed by the preceding + * DEFORM step. + */ + EEOP_FIELDSTORE_FORM, + + /* Process container subscripts; possibly short-circuit result to NULL */ + EEOP_SBSREF_SUBSCRIPTS, + + /* + * Compute old container element/slice when a SubscriptingRef assignment + * expression contains SubscriptingRef/FieldStore subexpressions. Value is + * accessed using the CaseTest mechanism. + */ + EEOP_SBSREF_OLD, + + /* compute new value for SubscriptingRef assignment expression */ + EEOP_SBSREF_ASSIGN, + + /* compute element/slice for SubscriptingRef fetch expression */ + EEOP_SBSREF_FETCH, + + /* evaluate value for CoerceToDomainValue */ + EEOP_DOMAIN_TESTVAL, + EEOP_DOMAIN_TESTVAL_EXT, + + /* evaluate a domain's NOT NULL constraint */ + EEOP_DOMAIN_NOTNULL, + + /* evaluate a single domain CHECK constraint */ + EEOP_DOMAIN_CHECK, + + /* evaluation steps for hashing */ + EEOP_HASHDATUM_SET_INITVAL, + EEOP_HASHDATUM_FIRST, + EEOP_HASHDATUM_FIRST_STRICT, + EEOP_HASHDATUM_NEXT32, + EEOP_HASHDATUM_NEXT32_STRICT, + + /* evaluate assorted special-purpose expression types */ + EEOP_CONVERT_ROWTYPE, + EEOP_SCALARARRAYOP, + EEOP_HASHED_SCALARARRAYOP, + EEOP_XMLEXPR, + EEOP_JSON_CONSTRUCTOR, + EEOP_IS_JSON, + EEOP_JSONEXPR_PATH, + EEOP_JSONEXPR_COERCION, + EEOP_JSONEXPR_COERCION_FINISH, + EEOP_AGGREF, + EEOP_GROUPING_FUNC, + EEOP_WINDOW_FUNC, + EEOP_MERGE_SUPPORT_FUNC, + EEOP_SUBPLAN, + + /* aggregation related nodes */ + EEOP_AGG_STRICT_DESERIALIZE, + EEOP_AGG_DESERIALIZE, + EEOP_AGG_STRICT_INPUT_CHECK_ARGS, + EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1, + EEOP_AGG_STRICT_INPUT_CHECK_NULLS, + EEOP_AGG_PLAIN_PERGROUP_NULLCHECK, + EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL, + EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL, + EEOP_AGG_PLAIN_TRANS_BYVAL, + EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF, + EEOP_AGG_PLAIN_TRANS_STRICT_BYREF, + EEOP_AGG_PLAIN_TRANS_BYREF, + EEOP_AGG_PRESORTED_DISTINCT_SINGLE, + EEOP_AGG_PRESORTED_DISTINCT_MULTI, + EEOP_AGG_ORDERED_TRANS_DATUM, + EEOP_AGG_ORDERED_TRANS_TUPLE, + + /* non-existent operation, used e.g. to check array lengths */ + EEOP_LAST +} ExprEvalOp; + + +typedef struct ExprEvalStep +{ + /* + * Instruction to be executed. During instruction preparation this is an + * enum ExprEvalOp, but later it can be changed to some other type, e.g. a + * pointer for computed goto (that's why it's an intptr_t). + */ + intptr_t opcode; + + /* where to store the result of this step */ + Datum *resvalue; + bool *resnull; + + /* + * Inline data for the operation. Inline data is faster to access, but + * also bloats the size of all instructions. The union should be kept to + * no more than 40 bytes on 64-bit systems (so that the entire struct is + * no more than 64 bytes, a single cacheline on common systems). + */ + union + { + /* for EEOP_INNER/OUTER/SCAN/OLD/NEW_FETCHSOME */ + struct + { + /* attribute number up to which to fetch (inclusive) */ + int last_var; + /* will the type of slot be the same for every invocation */ + bool fixed; + /* tuple descriptor, if known */ + TupleDesc known_desc; + /* type of slot, can only be relied upon if fixed is set */ + const TupleTableSlotOps *kind; + } fetch; + + /* for EEOP_INNER/OUTER/SCAN/OLD/NEW_[SYS]VAR */ + struct + { + /* attnum is attr number - 1 for regular VAR ... */ + /* but it's just the normal (negative) attr number for SYSVAR */ + int attnum; + Oid vartype; /* type OID of variable */ + VarReturningType varreturningtype; /* return old/new/default */ + } var; + + /* for EEOP_WHOLEROW */ + struct + { + Var *var; /* original Var node in plan tree */ + bool first; /* first time through, need to initialize? */ + bool slow; /* need runtime check for nulls? */ + TupleDesc tupdesc; /* descriptor for resulting tuples */ + JunkFilter *junkFilter; /* JunkFilter to remove resjunk cols */ + } wholerow; + + /* for EEOP_ASSIGN_*_VAR */ + struct + { + /* target index in ExprState->resultslot->tts_values/nulls */ + int resultnum; + /* source attribute number - 1 */ + int attnum; + } assign_var; + + /* for EEOP_ASSIGN_TMP[_MAKE_RO] */ + struct + { + /* target index in ExprState->resultslot->tts_values/nulls */ + int resultnum; + } assign_tmp; + + /* for EEOP_RETURNINGEXPR */ + struct + { + uint8 nullflag; /* flag to test if OLD/NEW row is NULL */ + int jumpdone; /* jump here if OLD/NEW row is NULL */ + } returningexpr; + + /* for EEOP_CONST */ + struct + { + /* constant's value */ + Datum value; + bool isnull; + } constval; + + /* for EEOP_FUNCEXPR_* / NULLIF / DISTINCT */ + struct + { + FmgrInfo *finfo; /* function's lookup data */ + FunctionCallInfo fcinfo_data; /* arguments etc */ + /* faster to access without additional indirection: */ + PGFunction fn_addr; /* actual call address */ + int nargs; /* number of arguments */ + bool make_ro; /* make arg0 R/O (used only for NULLIF) */ + } func; + + /* for EEOP_BOOL_*_STEP */ + struct + { + bool *anynull; /* track if any input was NULL */ + int jumpdone; /* jump here if result determined */ + } boolexpr; + + /* for EEOP_QUAL */ + struct + { + int jumpdone; /* jump here on false or null */ + } qualexpr; + + /* for EEOP_JUMP[_CONDITION] */ + struct + { + int jumpdone; /* target instruction's index */ + } jump; + + /* for EEOP_NULLTEST_ROWIS[NOT]NULL */ + struct + { + /* cached descriptor for composite type - filled at runtime */ + ExprEvalRowtypeCache rowcache; + } nulltest_row; + + /* for EEOP_PARAM_EXEC/EXTERN and EEOP_PARAM_SET */ + struct + { + int paramid; /* numeric ID for parameter */ + Oid paramtype; /* OID of parameter's datatype */ + } param; + + /* for EEOP_PARAM_CALLBACK */ + struct + { + ExecEvalSubroutine paramfunc; /* add-on evaluation subroutine */ + void *paramarg; /* private data for same */ + void *paramarg2; /* more private data for same */ + int paramid; /* numeric ID for parameter */ + Oid paramtype; /* OID of parameter's datatype */ + } cparam; + + /* for EEOP_CASE_TESTVAL/DOMAIN_TESTVAL */ + struct + { + Datum *value; /* value to return */ + bool *isnull; + } casetest; + + /* for EEOP_MAKE_READONLY */ + struct + { + Datum *value; /* value to coerce to read-only */ + bool *isnull; + } make_readonly; + + /* for EEOP_IOCOERCE */ + struct + { + /* lookup and call info for source type's output function */ + FmgrInfo *finfo_out; + FunctionCallInfo fcinfo_data_out; + /* lookup and call info for result type's input function */ + FmgrInfo *finfo_in; + FunctionCallInfo fcinfo_data_in; + } iocoerce; + + /* for EEOP_SQLVALUEFUNCTION */ + struct + { + SQLValueFunction *svf; + } sqlvaluefunction; + + /* for EEOP_NEXTVALUEEXPR */ + struct + { + Oid seqid; + Oid seqtypid; + } nextvalueexpr; + + /* for EEOP_ARRAYEXPR */ + struct + { + Datum *elemvalues; /* element values get stored here */ + bool *elemnulls; + int nelems; /* length of the above arrays */ + Oid elemtype; /* array element type */ + int16 elemlength; /* typlen of the array element type */ + bool elembyval; /* is the element type pass-by-value? */ + char elemalign; /* typalign of the element type */ + bool multidims; /* is array expression multi-D? */ + } arrayexpr; + + /* for EEOP_ARRAYCOERCE */ + struct + { + ExprState *elemexprstate; /* null if no per-element work */ + Oid resultelemtype; /* element type of result array */ + struct ArrayMapState *amstate; /* workspace for array_map */ + } arraycoerce; + + /* for EEOP_ROW */ + struct + { + TupleDesc tupdesc; /* descriptor for result tuples */ + /* workspace for the values constituting the row: */ + Datum *elemvalues; + bool *elemnulls; + } row; + + /* for EEOP_ROWCOMPARE_STEP */ + struct + { + /* lookup and call data for column comparison function */ + FmgrInfo *finfo; + FunctionCallInfo fcinfo_data; + PGFunction fn_addr; + /* target for comparison resulting in NULL */ + int jumpnull; + /* target for comparison yielding inequality */ + int jumpdone; + } rowcompare_step; + + /* for EEOP_ROWCOMPARE_FINAL */ + struct + { + CompareType cmptype; + } rowcompare_final; + + /* for EEOP_MINMAX */ + struct + { + /* workspace for argument values */ + Datum *values; + bool *nulls; + int nelems; + /* is it GREATEST or LEAST? */ + MinMaxOp op; + /* lookup and call data for comparison function */ + FmgrInfo *finfo; + FunctionCallInfo fcinfo_data; + } minmax; + + /* for EEOP_FIELDSELECT */ + struct + { + AttrNumber fieldnum; /* field number to extract */ + Oid resulttype; /* field's type */ + /* cached descriptor for composite type - filled at runtime */ + ExprEvalRowtypeCache rowcache; + } fieldselect; + + /* for EEOP_FIELDSTORE_DEFORM / FIELDSTORE_FORM */ + struct + { + /* original expression node */ + FieldStore *fstore; + + /* cached descriptor for composite type - filled at runtime */ + /* note that a DEFORM and FORM pair share the same cache */ + ExprEvalRowtypeCache *rowcache; + + /* workspace for column values */ + Datum *values; + bool *nulls; + int ncolumns; + } fieldstore; + + /* for EEOP_SBSREF_SUBSCRIPTS */ + struct + { + ExecEvalBoolSubroutine subscriptfunc; /* evaluation subroutine */ + /* too big to have inline */ + struct SubscriptingRefState *state; + int jumpdone; /* jump here on null */ + } sbsref_subscript; + + /* for EEOP_SBSREF_OLD / ASSIGN / FETCH */ + struct + { + ExecEvalSubroutine subscriptfunc; /* evaluation subroutine */ + /* too big to have inline */ + struct SubscriptingRefState *state; + } sbsref; + + /* for EEOP_DOMAIN_NOTNULL / DOMAIN_CHECK */ + struct + { + /* name of constraint */ + char *constraintname; + /* where the result of a CHECK constraint will be stored */ + Datum *checkvalue; + bool *checknull; + /* OID of domain type */ + Oid resulttype; + ErrorSaveContext *escontext; + } domaincheck; + + /* for EEOP_HASH_SET_INITVAL */ + struct + { + Datum init_value; + + } hashdatum_initvalue; + + /* for EEOP_HASHDATUM_(FIRST|NEXT32)[_STRICT] */ + struct + { + FmgrInfo *finfo; /* function's lookup data */ + FunctionCallInfo fcinfo_data; /* arguments etc */ + /* faster to access without additional indirection: */ + PGFunction fn_addr; /* actual call address */ + int jumpdone; /* jump here on null */ + NullableDatum *iresult; /* intermediate hash result */ + } hashdatum; + + /* for EEOP_CONVERT_ROWTYPE */ + struct + { + Oid inputtype; /* input composite type */ + Oid outputtype; /* output composite type */ + /* these three fields are filled at runtime: */ + ExprEvalRowtypeCache *incache; /* cache for input type */ + ExprEvalRowtypeCache *outcache; /* cache for output type */ + TupleConversionMap *map; /* column mapping */ + } convert_rowtype; + + /* for EEOP_SCALARARRAYOP */ + struct + { + /* element_type/typlen/typbyval/typalign are filled at runtime */ + Oid element_type; /* InvalidOid if not yet filled */ + bool useOr; /* use OR or AND semantics? */ + int16 typlen; /* array element type storage info */ + bool typbyval; + char typalign; + FmgrInfo *finfo; /* function's lookup data */ + FunctionCallInfo fcinfo_data; /* arguments etc */ + /* faster to access without additional indirection: */ + PGFunction fn_addr; /* actual call address */ + } scalararrayop; + + /* for EEOP_HASHED_SCALARARRAYOP */ + struct + { + bool has_nulls; + bool inclause; /* true for IN and false for NOT IN */ + struct ScalarArrayOpExprHashTable *elements_tab; + FmgrInfo *finfo; /* function's lookup data */ + FunctionCallInfo fcinfo_data; /* arguments etc */ + ScalarArrayOpExpr *saop; + } hashedscalararrayop; + + /* for EEOP_XMLEXPR */ + struct + { + XmlExpr *xexpr; /* original expression node */ + /* workspace for evaluating named args, if any */ + Datum *named_argvalue; + bool *named_argnull; + /* workspace for evaluating unnamed args, if any */ + Datum *argvalue; + bool *argnull; + } xmlexpr; + + /* for EEOP_JSON_CONSTRUCTOR */ + struct + { + struct JsonConstructorExprState *jcstate; + } json_constructor; + + /* for EEOP_AGGREF */ + struct + { + int aggno; + } aggref; + + /* for EEOP_GROUPING_FUNC */ + struct + { + List *clauses; /* integer list of column numbers */ + } grouping_func; + + /* for EEOP_WINDOW_FUNC */ + struct + { + /* out-of-line state, modified by nodeWindowAgg.c */ + WindowFuncExprState *wfstate; + } window_func; + + /* for EEOP_SUBPLAN */ + struct + { + /* out-of-line state, created by nodeSubplan.c */ + SubPlanState *sstate; + } subplan; + + /* for EEOP_AGG_*DESERIALIZE */ + struct + { + FunctionCallInfo fcinfo_data; + int jumpnull; + } agg_deserialize; + + /* for EEOP_AGG_STRICT_INPUT_CHECK_NULLS / STRICT_INPUT_CHECK_ARGS */ + struct + { + /* + * For EEOP_AGG_STRICT_INPUT_CHECK_ARGS args contains pointers to + * the NullableDatums that need to be checked for NULLs. + * + * For EEOP_AGG_STRICT_INPUT_CHECK_NULLS nulls contains pointers + * to booleans that need to be checked for NULLs. + * + * Both cases currently need to exist because sometimes the + * to-be-checked nulls are in TupleTableSlot.isnull array, and + * sometimes in FunctionCallInfoBaseData.args[i].isnull. + */ + NullableDatum *args; + bool *nulls; + int nargs; + int jumpnull; + } agg_strict_input_check; + + /* for EEOP_AGG_PLAIN_PERGROUP_NULLCHECK */ + struct + { + int setoff; + int jumpnull; + } agg_plain_pergroup_nullcheck; + + /* for EEOP_AGG_PRESORTED_DISTINCT_{SINGLE,MULTI} */ + struct + { + AggStatePerTrans pertrans; + ExprContext *aggcontext; + int jumpdistinct; + } agg_presorted_distinctcheck; + + /* for EEOP_AGG_PLAIN_TRANS_[INIT_][STRICT_]{BYVAL,BYREF} */ + /* for EEOP_AGG_ORDERED_TRANS_{DATUM,TUPLE} */ + struct + { + AggStatePerTrans pertrans; + ExprContext *aggcontext; + int setno; + int transno; + int setoff; + } agg_trans; + + /* for EEOP_IS_JSON */ + struct + { + JsonIsPredicate *pred; /* original expression node */ + } is_json; + + /* for EEOP_JSONEXPR_PATH */ + struct + { + struct JsonExprState *jsestate; + } jsonexpr; + + /* for EEOP_JSONEXPR_COERCION */ + struct + { + Oid targettype; + int32 targettypmod; + bool omit_quotes; + /* exists_* fields only relevant for JSON_EXISTS_OP. */ + bool exists_coerce; + bool exists_cast_to_int; + bool exists_check_domain; + void *json_coercion_cache; + ErrorSaveContext *escontext; + } jsonexpr_coercion; + } d; +} ExprEvalStep; + +/* Enforce the size rule given in the comment above */ +StaticAssertDecl(sizeof(ExprEvalStep) <= 64, + "size of ExprEvalStep exceeds 64 bytes"); + + +/* Non-inline data for container operations */ +typedef struct SubscriptingRefState +{ + bool isassignment; /* is it assignment, or just fetch? */ + + /* workspace for type-specific subscripting code */ + void *workspace; + + /* numupper and upperprovided[] are filled at expression compile time */ + /* at runtime, subscripts are computed in upperindex[]/upperindexnull[] */ + int numupper; + bool *upperprovided; /* indicates if this position is supplied */ + Datum *upperindex; + bool *upperindexnull; + + /* similarly for lower indexes, if any */ + int numlower; + bool *lowerprovided; + Datum *lowerindex; + bool *lowerindexnull; + + /* for assignment, new value to assign is evaluated into here */ + Datum replacevalue; + bool replacenull; + + /* if we have a nested assignment, sbs_fetch_old puts old value here */ + Datum prevvalue; + bool prevnull; +} SubscriptingRefState; + +/* Execution step methods used for SubscriptingRef */ +typedef struct SubscriptExecSteps +{ + /* See nodes/subscripting.h for more detail about these */ + ExecEvalBoolSubroutine sbs_check_subscripts; /* process subscripts */ + ExecEvalSubroutine sbs_fetch; /* fetch an element */ + ExecEvalSubroutine sbs_assign; /* assign to an element */ + ExecEvalSubroutine sbs_fetch_old; /* fetch old value for assignment */ +} SubscriptExecSteps; + +/* EEOP_JSON_CONSTRUCTOR state, too big to inline */ +typedef struct JsonConstructorExprState +{ + JsonConstructorExpr *constructor; + Datum *arg_values; + bool *arg_nulls; + Oid *arg_types; + struct + { + int category; + Oid outfuncid; + } *arg_type_cache; /* cache for datum_to_json[b]() */ + int nargs; +} JsonConstructorExprState; + + +/* functions in execExpr.c */ +extern void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s); + +/* functions in execExprInterp.c */ +extern void ExecReadyInterpretedExpr(ExprState *state); +extern ExprEvalOp ExecEvalStepOp(ExprState *state, ExprEvalStep *op); + +extern Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull); +extern void CheckExprStillValid(ExprState *state, ExprContext *econtext); + +/* + * Non fast-path execution functions. These are externs instead of statics in + * execExprInterp.c, because that allows them to be used by other methods of + * expression evaluation, reducing code duplication. + */ +extern void ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalParamExec(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalParamSet(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalCoerceViaIOSafe(ExprState *state, ExprEvalStep *op); +extern void ExecEvalSQLValueFunction(ExprState *state, ExprEvalStep *op); +extern void ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op); +extern void ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op); +extern void ExecEvalRowNull(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalRowNotNull(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op); +extern void ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalRow(ExprState *state, ExprEvalStep *op); +extern void ExecEvalMinMax(ExprState *state, ExprEvalStep *op); +extern void ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op); +extern void ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op); +extern void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op); +extern void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op); +extern void ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op); +extern int ExecEvalJsonExprPath(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalJsonCoercion(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalJsonCoercionFinish(ExprState *state, ExprEvalStep *op); +extern void ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op); +extern void ExecEvalMergeSupportFunc(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalSysVar(ExprState *state, ExprEvalStep *op, + ExprContext *econtext, TupleTableSlot *slot); + +extern void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, + ExprContext *aggcontext); +extern Datum ExecAggCopyTransValue(AggState *aggstate, AggStatePerTrans pertrans, + Datum newValue, bool newValueIsNull, + Datum oldValue, bool oldValueIsNull); +extern bool ExecEvalPreOrderedDistinctSingle(AggState *aggstate, + AggStatePerTrans pertrans); +extern bool ExecEvalPreOrderedDistinctMulti(AggState *aggstate, + AggStatePerTrans pertrans); +extern void ExecEvalAggOrderedTransDatum(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalAggOrderedTransTuple(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); + +#endif /* EXEC_EXPR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execParallel.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execParallel.h new file mode 100644 index 0000000..5e7106c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execParallel.h @@ -0,0 +1,51 @@ +/*-------------------------------------------------------------------- + * execParallel.h + * POSTGRES parallel execution interface + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/executor/execParallel.h + *-------------------------------------------------------------------- + */ + +#ifndef EXECPARALLEL_H +#define EXECPARALLEL_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" +#include "nodes/plannodes.h" +#include "utils/dsa.h" + +typedef struct SharedExecutorInstrumentation SharedExecutorInstrumentation; + +typedef struct ParallelExecutorInfo +{ + PlanState *planstate; /* plan subtree we're running in parallel */ + ParallelContext *pcxt; /* parallel context we're using */ + BufferUsage *buffer_usage; /* points to bufusage area in DSM */ + WalUsage *wal_usage; /* walusage area in DSM */ + SharedExecutorInstrumentation *instrumentation; /* optional */ + struct SharedJitInstrumentation *jit_instrumentation; /* optional */ + dsa_area *area; /* points to DSA area in DSM */ + dsa_pointer param_exec; /* serialized PARAM_EXEC parameters */ + bool finished; /* set true by ExecParallelFinish */ + /* These two arrays have pcxt->nworkers_launched entries: */ + shm_mq_handle **tqueue; /* tuple queues for worker output */ + struct TupleQueueReader **reader; /* tuple reader/writer support */ +} ParallelExecutorInfo; + +extern ParallelExecutorInfo *ExecInitParallelPlan(PlanState *planstate, + EState *estate, Bitmapset *sendParams, int nworkers, + int64 tuples_needed); +extern void ExecParallelCreateReaders(ParallelExecutorInfo *pei); +extern void ExecParallelFinish(ParallelExecutorInfo *pei); +extern void ExecParallelCleanup(ParallelExecutorInfo *pei); +extern void ExecParallelReinitialize(PlanState *planstate, + ParallelExecutorInfo *pei, Bitmapset *sendParams); + +extern void ParallelQueryMain(dsm_segment *seg, shm_toc *toc); + +#endif /* EXECPARALLEL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execPartition.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execPartition.h new file mode 100644 index 0000000..3b3f46a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execPartition.h @@ -0,0 +1,143 @@ +/*-------------------------------------------------------------------- + * execPartition.h + * POSTGRES partitioning executor interface + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/executor/execPartition.h + *-------------------------------------------------------------------- + */ + +#ifndef EXECPARTITION_H +#define EXECPARTITION_H + +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" +#include "nodes/plannodes.h" +#include "partitioning/partprune.h" + +/* See execPartition.c for the definitions. */ +typedef struct PartitionDispatchData *PartitionDispatch; +typedef struct PartitionTupleRouting PartitionTupleRouting; + +extern PartitionTupleRouting *ExecSetupPartitionTupleRouting(EState *estate, + Relation rel); +extern ResultRelInfo *ExecFindPartition(ModifyTableState *mtstate, + ResultRelInfo *rootResultRelInfo, + PartitionTupleRouting *proute, + TupleTableSlot *slot, + EState *estate); +extern void ExecCleanupTupleRouting(ModifyTableState *mtstate, + PartitionTupleRouting *proute); + + +/* + * PartitionedRelPruningData - Per-partitioned-table data for run-time pruning + * of partitions. For a multilevel partitioned table, we have one of these + * for the topmost partition plus one for each non-leaf child partition. + * + * subplan_map[] and subpart_map[] have the same definitions as in + * PartitionedRelPruneInfo (see plannodes.h); though note that here, + * subpart_map contains indexes into PartitionPruningData.partrelprunedata[]. + * + * partrel Partitioned table Relation; obtained by + * ExecGetRangeTableRelation(estate, rti, false), + * where rti is PartitionedRelPruneInfo.rtindex. + * nparts Length of subplan_map[] and subpart_map[]. + * subplan_map Subplan index by partition index, or -1. + * subpart_map Subpart index by partition index, or -1. + * leafpart_rti_map RT index by partition index, or 0. + * present_parts A Bitmapset of the partition indexes that we + * have subplans or subparts for. + * initial_pruning_steps List of PartitionPruneSteps used to + * perform executor startup pruning. + * exec_pruning_steps List of PartitionPruneSteps used to + * perform per-scan pruning. + * initial_context If initial_pruning_steps isn't NIL, contains + * the details needed to execute those steps. + * exec_context If exec_pruning_steps isn't NIL, contains + * the details needed to execute those steps. + */ +typedef struct PartitionedRelPruningData +{ + Relation partrel; + int nparts; + int *subplan_map; + int *subpart_map; + int *leafpart_rti_map; + Bitmapset *present_parts; + List *initial_pruning_steps; + List *exec_pruning_steps; + PartitionPruneContext initial_context; + PartitionPruneContext exec_context; +} PartitionedRelPruningData; + +/* + * PartitionPruningData - Holds all the run-time pruning information for + * a single partitioning hierarchy containing one or more partitions. + * partrelprunedata[] is an array ordered such that parents appear before + * their children; in particular, the first entry is the topmost partition, + * which was actually named in the SQL query. + */ +typedef struct PartitionPruningData +{ + int num_partrelprunedata; /* number of array entries */ + PartitionedRelPruningData partrelprunedata[FLEXIBLE_ARRAY_MEMBER]; +} PartitionPruningData; + +/* + * PartitionPruneState - State object required for plan nodes to perform + * run-time partition pruning. + * + * This struct can be attached to plan types which support arbitrary Lists of + * subplans containing partitions, to allow subplans to be eliminated due to + * the clauses being unable to match to any tuple that the subplan could + * possibly produce. + * + * econtext Standalone ExprContext to evaluate expressions in + * the pruning steps + * execparamids Contains paramids of PARAM_EXEC Params found within + * any of the partprunedata structs. Pruning must be + * done again each time the value of one of these + * parameters changes. + * other_subplans Contains indexes of subplans that don't belong to any + * "partprunedata", e.g UNION ALL children that are not + * partitioned tables, or a partitioned table that the + * planner deemed run-time pruning to be useless for. + * These must not be pruned. + * prune_context A short-lived memory context in which to execute the + * partition pruning functions. + * do_initial_prune true if pruning should be performed during executor + * startup (at any hierarchy level). + * do_exec_prune true if pruning should be performed during + * executor run (at any hierarchy level). + * num_partprunedata Number of items in "partprunedata" array. + * partprunedata Array of PartitionPruningData pointers for the plan's + * partitioned relation(s), one for each partitioning + * hierarchy that requires run-time pruning. + */ +typedef struct PartitionPruneState +{ + ExprContext *econtext; + Bitmapset *execparamids; + Bitmapset *other_subplans; + MemoryContext prune_context; + bool do_initial_prune; + bool do_exec_prune; + int num_partprunedata; + PartitionPruningData *partprunedata[FLEXIBLE_ARRAY_MEMBER]; +} PartitionPruneState; + +extern void ExecDoInitialPruning(EState *estate); +extern PartitionPruneState *ExecInitPartitionExecPruning(PlanState *planstate, + int n_total_subplans, + int part_prune_index, + Bitmapset *relids, + Bitmapset **initially_valid_subplans); +extern Bitmapset *ExecFindMatchingSubPlans(PartitionPruneState *prunestate, + bool initial_prune, + Bitmapset **validsubplan_rtis); + +#endif /* EXECPARTITION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execScan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execScan.h new file mode 100644 index 0000000..2003cbc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execScan.h @@ -0,0 +1,254 @@ +/*------------------------------------------------------------------------- + * execScan.h + * Inline-able support functions for Scan nodes + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/executor/execScan.h + *------------------------------------------------------------------------- + */ + +#ifndef EXECSCAN_H +#define EXECSCAN_H + +#include "miscadmin.h" +#include "executor/executor.h" +#include "nodes/execnodes.h" + +/* + * ExecScanFetch -- check interrupts & fetch next potential tuple + * + * This routine substitutes a test tuple if inside an EvalPlanQual recheck. + * Otherwise, it simply executes the access method's next-tuple routine. + * + * The pg_attribute_always_inline attribute allows the compiler to inline + * this function into its caller. When EPQState is NULL, the EvalPlanQual + * logic is completely eliminated at compile time, avoiding unnecessary + * run-time checks and code for cases where EPQ is not required. + */ +static pg_attribute_always_inline TupleTableSlot * +ExecScanFetch(ScanState *node, + EPQState *epqstate, + ExecScanAccessMtd accessMtd, + ExecScanRecheckMtd recheckMtd) +{ + CHECK_FOR_INTERRUPTS(); + + if (epqstate != NULL) + { + /* + * We are inside an EvalPlanQual recheck. Return the test tuple if + * one is available, after rechecking any access-method-specific + * conditions. + */ + Index scanrelid = ((Scan *) node->ps.plan)->scanrelid; + + if (scanrelid == 0) + { + /* + * This is a ForeignScan or CustomScan which has pushed down a + * join to the remote side. If it is a descendant node in the EPQ + * recheck plan tree, run the recheck method function. Otherwise, + * run the access method function below. + */ + if (bms_is_member(epqstate->epqParam, node->ps.plan->extParam)) + { + /* + * The recheck method is responsible not only for rechecking + * the scan/join quals but also for storing the correct tuple + * in the slot. + */ + + TupleTableSlot *slot = node->ss_ScanTupleSlot; + + if (!(*recheckMtd) (node, slot)) + ExecClearTuple(slot); /* would not be returned by scan */ + return slot; + } + } + else if (epqstate->relsubs_done[scanrelid - 1]) + { + /* + * Return empty slot, as either there is no EPQ tuple for this rel + * or we already returned it. + */ + + TupleTableSlot *slot = node->ss_ScanTupleSlot; + + return ExecClearTuple(slot); + } + else if (epqstate->relsubs_slot[scanrelid - 1] != NULL) + { + /* + * Return replacement tuple provided by the EPQ caller. + */ + + TupleTableSlot *slot = epqstate->relsubs_slot[scanrelid - 1]; + + Assert(epqstate->relsubs_rowmark[scanrelid - 1] == NULL); + + /* Mark to remember that we shouldn't return it again */ + epqstate->relsubs_done[scanrelid - 1] = true; + + /* Return empty slot if we haven't got a test tuple */ + if (TupIsNull(slot)) + return NULL; + + /* Check if it meets the access-method conditions */ + if (!(*recheckMtd) (node, slot)) + return ExecClearTuple(slot); /* would not be returned by + * scan */ + return slot; + } + else if (epqstate->relsubs_rowmark[scanrelid - 1] != NULL) + { + /* + * Fetch and return replacement tuple using a non-locking rowmark. + */ + + TupleTableSlot *slot = node->ss_ScanTupleSlot; + + /* Mark to remember that we shouldn't return more */ + epqstate->relsubs_done[scanrelid - 1] = true; + + if (!EvalPlanQualFetchRowMark(epqstate, scanrelid, slot)) + return NULL; + + /* Return empty slot if we haven't got a test tuple */ + if (TupIsNull(slot)) + return NULL; + + /* Check if it meets the access-method conditions */ + if (!(*recheckMtd) (node, slot)) + return ExecClearTuple(slot); /* would not be returned by + * scan */ + return slot; + } + } + + /* + * Run the node-type-specific access method function to get the next tuple + */ + return (*accessMtd) (node); +} + +/* ---------------------------------------------------------------- + * ExecScanExtended + * Scans the relation using the specified 'access method' and returns the + * next tuple. Optionally checks the tuple against 'qual' and applies + * 'projInfo' if provided. + * + * The 'recheck method' validates an arbitrary tuple of the relation against + * conditions enforced by the access method. + * + * This function is an alternative to ExecScan, used when callers may omit + * 'qual' or 'projInfo'. The pg_attribute_always_inline attribute allows the + * compiler to eliminate non-relevant branches at compile time, avoiding + * run-time checks in those cases. + * + * Conditions: + * -- The AMI "cursor" is positioned at the previously returned tuple. + * + * Initial States: + * -- The relation is opened for scanning, with the "cursor" + * positioned before the first qualifying tuple. + * ---------------------------------------------------------------- + */ +static pg_attribute_always_inline TupleTableSlot * +ExecScanExtended(ScanState *node, + ExecScanAccessMtd accessMtd, /* function returning a tuple */ + ExecScanRecheckMtd recheckMtd, + EPQState *epqstate, + ExprState *qual, + ProjectionInfo *projInfo) +{ + ExprContext *econtext = node->ps.ps_ExprContext; + + /* interrupt checks are in ExecScanFetch */ + + /* + * If we have neither a qual to check nor a projection to do, just skip + * all the overhead and return the raw scan tuple. + */ + if (!qual && !projInfo) + { + ResetExprContext(econtext); + return ExecScanFetch(node, epqstate, accessMtd, recheckMtd); + } + + /* + * Reset per-tuple memory context to free any expression evaluation + * storage allocated in the previous tuple cycle. + */ + ResetExprContext(econtext); + + /* + * get a tuple from the access method. Loop until we obtain a tuple that + * passes the qualification. + */ + for (;;) + { + TupleTableSlot *slot; + + slot = ExecScanFetch(node, epqstate, accessMtd, recheckMtd); + + /* + * if the slot returned by the accessMtd contains NULL, then it means + * there is nothing more to scan so we just return an empty slot, + * being careful to use the projection result slot so it has correct + * tupleDesc. + */ + if (TupIsNull(slot)) + { + if (projInfo) + return ExecClearTuple(projInfo->pi_state.resultslot); + else + return slot; + } + + /* + * place the current tuple into the expr context + */ + econtext->ecxt_scantuple = slot; + + /* + * check that the current tuple satisfies the qual-clause + * + * check for non-null qual here to avoid a function call to ExecQual() + * when the qual is null ... saves only a few cycles, but they add up + * ... + */ + if (qual == NULL || ExecQual(qual, econtext)) + { + /* + * Found a satisfactory scan tuple. + */ + if (projInfo) + { + /* + * Form a projection tuple, store it in the result tuple slot + * and return it. + */ + return ExecProject(projInfo); + } + else + { + /* + * Here, we aren't projecting, so just return scan tuple. + */ + return slot; + } + } + else + InstrCountFiltered1(node, 1); + + /* + * Tuple fails qual, so free per-tuple memory and try again. + */ + ResetExprContext(econtext); + } +} + +#endif /* EXECSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execdebug.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execdebug.h new file mode 100644 index 0000000..e5d27fb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execdebug.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * execdebug.h + * #defines governing debugging behaviour in the executor + * + * XXX this is all pretty old and crufty. Newer code tends to use elog() + * for debug printouts, because that's more flexible than printf(). + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/execdebug.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXECDEBUG_H +#define EXECDEBUG_H + +#include "executor/executor.h" +#include "nodes/print.h" + +/* ---------------------------------------------------------------- + * debugging defines. + * + * If you want certain debugging behaviour, then #define + * the variable to 1. No need to explicitly #undef by default, + * since we can use -D compiler options to enable features. + * - thomas 1999-02-20 + * ---------------------------------------------------------------- + */ + +/* ---------------- + * EXEC_NESTLOOPDEBUG is a flag which turns on debugging of the + * nest loop node by NL_printf() and ENL_printf() in nodeNestloop.c + * ---------------- +#undef EXEC_NESTLOOPDEBUG + */ + +/* ---------------- + * EXEC_SORTDEBUG is a flag which turns on debugging of + * the ExecSort() stuff by SO_printf() in nodeSort.c + * ---------------- +#undef EXEC_SORTDEBUG + */ + +/* ---------------- + * EXEC_MERGEJOINDEBUG is a flag which turns on debugging of + * the ExecMergeJoin() stuff by MJ_printf() in nodeMergejoin.c + * ---------------- +#undef EXEC_MERGEJOINDEBUG + */ + +/* ---------------------------------------------------------------- + * #defines controlled by above definitions + * + * Note: most of these are "incomplete" because I didn't + * need the ones not defined. More should be added + * only as necessary -cim 10/26/89 + * ---------------------------------------------------------------- + */ +#define T_OR_F(b) ((b) ? "true" : "false") +#define NULL_OR_TUPLE(slot) (TupIsNull(slot) ? "null" : "a tuple") + +/* ---------------- + * nest loop debugging defines + * ---------------- + */ +#ifdef EXEC_NESTLOOPDEBUG +#define NL_nodeDisplay(l) nodeDisplay(l) +#define NL_printf(s) printf(s) +#define NL1_printf(s, a) printf(s, a) +#define ENL1_printf(message) printf("ExecNestLoop: %s\n", message) +#else +#define NL_nodeDisplay(l) +#define NL_printf(s) +#define NL1_printf(s, a) +#define ENL1_printf(message) +#endif /* EXEC_NESTLOOPDEBUG */ + +/* ---------------- + * sort node debugging defines + * ---------------- + */ +#ifdef EXEC_SORTDEBUG +#define SO_nodeDisplay(l) nodeDisplay(l) +#define SO_printf(s) printf(s) +#define SO1_printf(s, p) printf(s, p) +#define SO2_printf(s, p1, p2) printf(s, p1, p2) +#else +#define SO_nodeDisplay(l) +#define SO_printf(s) +#define SO1_printf(s, p) +#define SO2_printf(s, p1, p2) +#endif /* EXEC_SORTDEBUG */ + +/* ---------------- + * merge join debugging defines + * ---------------- + */ +#ifdef EXEC_MERGEJOINDEBUG + +#define MJ_nodeDisplay(l) nodeDisplay(l) +#define MJ_printf(s) printf(s) +#define MJ1_printf(s, p) printf(s, p) +#define MJ2_printf(s, p1, p2) printf(s, p1, p2) +#define MJ_debugtup(slot) debugtup(slot, NULL) +#define MJ_dump(state) ExecMergeTupleDump(state) +#define MJ_DEBUG_COMPARE(res) \ + MJ1_printf(" MJCompare() returns %d\n", (res)) +#define MJ_DEBUG_QUAL(clause, res) \ + MJ2_printf(" ExecQual(%s, econtext) returns %s\n", \ + CppAsString(clause), T_OR_F(res)) +#define MJ_DEBUG_PROC_NODE(slot) \ + MJ2_printf(" %s = ExecProcNode(...) returns %s\n", \ + CppAsString(slot), NULL_OR_TUPLE(slot)) +#else + +#define MJ_nodeDisplay(l) +#define MJ_printf(s) +#define MJ1_printf(s, p) +#define MJ2_printf(s, p1, p2) +#define MJ_debugtup(slot) +#define MJ_dump(state) +#define MJ_DEBUG_COMPARE(res) +#define MJ_DEBUG_QUAL(clause, res) +#define MJ_DEBUG_PROC_NODE(slot) +#endif /* EXEC_MERGEJOINDEBUG */ + +#endif /* EXECDEBUG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execdesc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execdesc.h new file mode 100644 index 0000000..86db3dc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/execdesc.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * + * execdesc.h + * plan and query descriptor accessor macros used by the executor + * and related modules. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/execdesc.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXECDESC_H +#define EXECDESC_H + +#include "nodes/execnodes.h" +#include "tcop/dest.h" + + +/* ---------------- + * query descriptor: + * + * a QueryDesc encapsulates everything that the executor + * needs to execute the query. + * + * For the convenience of SQL-language functions, we also support QueryDescs + * containing utility statements; these must not be passed to the executor + * however. + * --------------------- + */ +typedef struct QueryDesc +{ + /* These fields are provided by CreateQueryDesc */ + CmdType operation; /* CMD_SELECT, CMD_UPDATE, etc. */ + PlannedStmt *plannedstmt; /* planner's output (could be utility, too) */ + const char *sourceText; /* source text of the query */ + Snapshot snapshot; /* snapshot to use for query */ + Snapshot crosscheck_snapshot; /* crosscheck for RI update/delete */ + DestReceiver *dest; /* the destination for tuple output */ + ParamListInfo params; /* param values being passed in */ + QueryEnvironment *queryEnv; /* query environment passed in */ + int instrument_options; /* OR of InstrumentOption flags */ + + /* These fields are set by ExecutorStart */ + TupleDesc tupDesc; /* descriptor for result tuples */ + EState *estate; /* executor's query-wide state */ + PlanState *planstate; /* tree of per-plan-node state */ + + /* This field is set by ExecutePlan */ + bool already_executed; /* true if previously executed */ + + /* This is always set NULL by the core system, but plugins can change it */ + struct Instrumentation *totaltime; /* total time spent in ExecutorRun */ +} QueryDesc; + +/* in pquery.c */ +extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt, + const char *sourceText, + Snapshot snapshot, + Snapshot crosscheck_snapshot, + DestReceiver *dest, + ParamListInfo params, + QueryEnvironment *queryEnv, + int instrument_options); + +extern void FreeQueryDesc(QueryDesc *qdesc); + +#endif /* EXECDESC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/executor.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/executor.h new file mode 100644 index 0000000..ac5190c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/executor.h @@ -0,0 +1,789 @@ +/*------------------------------------------------------------------------- + * + * executor.h + * support for the POSTGRES executor module + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/executor.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXECUTOR_H +#define EXECUTOR_H + +#include "executor/execdesc.h" +#include "fmgr.h" +#include "nodes/lockoptions.h" +#include "nodes/parsenodes.h" +#include "utils/memutils.h" + + +/* + * The "eflags" argument to ExecutorStart and the various ExecInitNode + * routines is a bitwise OR of the following flag bits, which tell the + * called plan node what to expect. Note that the flags will get modified + * as they are passed down the plan tree, since an upper node may require + * functionality in its subnode not demanded of the plan as a whole + * (example: MergeJoin requires mark/restore capability in its inner input), + * or an upper node may shield its input from some functionality requirement + * (example: Materialize shields its input from needing to do backward scan). + * + * EXPLAIN_ONLY indicates that the plan tree is being initialized just so + * EXPLAIN can print it out; it will not be run. Hence, no side-effects + * of startup should occur. However, error checks (such as permission checks) + * should be performed. + * + * EXPLAIN_GENERIC can only be used together with EXPLAIN_ONLY. It indicates + * that a generic plan is being shown using EXPLAIN (GENERIC_PLAN), which + * means that missing parameter values must be tolerated. Currently, the only + * effect is to suppress execution-time partition pruning. + * + * REWIND indicates that the plan node should try to efficiently support + * rescans without parameter changes. (Nodes must support ExecReScan calls + * in any case, but if this flag was not given, they are at liberty to do it + * through complete recalculation. Note that a parameter change forces a + * full recalculation in any case.) + * + * BACKWARD indicates that the plan node must respect the es_direction flag. + * When this is not passed, the plan node will only be run forwards. + * + * MARK indicates that the plan node must support Mark/Restore calls. + * When this is not passed, no Mark/Restore will occur. + * + * SKIP_TRIGGERS tells ExecutorStart/ExecutorFinish to skip calling + * AfterTriggerBeginQuery/AfterTriggerEndQuery. This does not necessarily + * mean that the plan can't queue any AFTER triggers; just that the caller + * is responsible for there being a trigger context for them to be queued in. + * + * WITH_NO_DATA indicates that we are performing REFRESH MATERIALIZED VIEW + * ... WITH NO DATA. Currently, the only effect is to suppress errors about + * scanning unpopulated materialized views. + */ +#define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */ +#define EXEC_FLAG_EXPLAIN_GENERIC 0x0002 /* EXPLAIN (GENERIC_PLAN) */ +#define EXEC_FLAG_REWIND 0x0004 /* need efficient rescan */ +#define EXEC_FLAG_BACKWARD 0x0008 /* need backward scan */ +#define EXEC_FLAG_MARK 0x0010 /* need mark/restore */ +#define EXEC_FLAG_SKIP_TRIGGERS 0x0020 /* skip AfterTrigger setup */ +#define EXEC_FLAG_WITH_NO_DATA 0x0040 /* REFRESH ... WITH NO DATA */ + + +/* Hook for plugins to get control in ExecutorStart() */ +typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags); +extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook; + +/* Hook for plugins to get control in ExecutorRun() */ +typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc, + ScanDirection direction, + uint64 count); +extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook; + +/* Hook for plugins to get control in ExecutorFinish() */ +typedef void (*ExecutorFinish_hook_type) (QueryDesc *queryDesc); +extern PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook; + +/* Hook for plugins to get control in ExecutorEnd() */ +typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc); +extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook; + +/* Hook for plugins to get control in ExecCheckPermissions() */ +typedef bool (*ExecutorCheckPerms_hook_type) (List *rangeTable, + List *rtePermInfos, + bool ereport_on_violation); +extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook; + + +/* + * prototypes from functions in execAmi.c + */ +struct Path; /* avoid including pathnodes.h here */ + +extern void ExecReScan(PlanState *node); +extern void ExecMarkPos(PlanState *node); +extern void ExecRestrPos(PlanState *node); +extern bool ExecSupportsMarkRestore(struct Path *pathnode); +extern bool ExecSupportsBackwardScan(Plan *node); +extern bool ExecMaterializesOutput(NodeTag plantype); + +/* + * prototypes from functions in execCurrent.c + */ +extern bool execCurrentOf(CurrentOfExpr *cexpr, + ExprContext *econtext, + Oid table_oid, + ItemPointer current_tid); + +/* + * prototypes from functions in execGrouping.c + */ +extern ExprState *execTuplesMatchPrepare(TupleDesc desc, + int numCols, + const AttrNumber *keyColIdx, + const Oid *eqOperators, + const Oid *collations, + PlanState *parent); +extern void execTuplesHashPrepare(int numCols, + const Oid *eqOperators, + Oid **eqFuncOids, + FmgrInfo **hashFunctions); +extern TupleHashTable BuildTupleHashTable(PlanState *parent, + TupleDesc inputDesc, + const TupleTableSlotOps *inputOps, + int numCols, + AttrNumber *keyColIdx, + const Oid *eqfuncoids, + FmgrInfo *hashfunctions, + Oid *collations, + long nbuckets, + Size additionalsize, + MemoryContext metacxt, + MemoryContext tablecxt, + MemoryContext tempcxt, + bool use_variable_hash_iv); +extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable, + TupleTableSlot *slot, + bool *isnew, uint32 *hash); +extern uint32 TupleHashTableHash(TupleHashTable hashtable, + TupleTableSlot *slot); +extern TupleHashEntry LookupTupleHashEntryHash(TupleHashTable hashtable, + TupleTableSlot *slot, + bool *isnew, uint32 hash); +extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, + TupleTableSlot *slot, + ExprState *eqcomp, + ExprState *hashexpr); +extern void ResetTupleHashTable(TupleHashTable hashtable); + +#ifndef FRONTEND +/* + * Return size of the hash bucket. Useful for estimating memory usage. + */ +static inline size_t +TupleHashEntrySize(void) +{ + return sizeof(TupleHashEntryData); +} + +/* + * Return tuple from hash entry. + */ +static inline MinimalTuple +TupleHashEntryGetTuple(TupleHashEntry entry) +{ + return entry->firstTuple; +} + +/* + * Get a pointer into the additional space allocated for this entry. The + * memory will be maxaligned and zeroed. + * + * The amount of space available is the additionalsize requested in the call + * to BuildTupleHashTable(). If additionalsize was specified as zero, return + * NULL. + */ +static inline void * +TupleHashEntryGetAdditional(TupleHashTable hashtable, TupleHashEntry entry) +{ + if (hashtable->additionalsize > 0) + return (char *) entry->firstTuple - hashtable->additionalsize; + else + return NULL; +} +#endif + +/* + * prototypes from functions in execJunk.c + */ +extern JunkFilter *ExecInitJunkFilter(List *targetList, + TupleTableSlot *slot); +extern JunkFilter *ExecInitJunkFilterConversion(List *targetList, + TupleDesc cleanTupType, + TupleTableSlot *slot); +extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter, + const char *attrName); +extern AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, + const char *attrName); +extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter, + TupleTableSlot *slot); + +/* + * ExecGetJunkAttribute + * + * Given a junk filter's input tuple (slot) and a junk attribute's number + * previously found by ExecFindJunkAttribute, extract & return the value and + * isNull flag of the attribute. + */ +#ifndef FRONTEND +static inline Datum +ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull) +{ + Assert(attno > 0); + return slot_getattr(slot, attno, isNull); +} +#endif + +/* + * prototypes from functions in execMain.c + */ +extern void ExecutorStart(QueryDesc *queryDesc, int eflags); +extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags); +extern void ExecutorRun(QueryDesc *queryDesc, + ScanDirection direction, uint64 count); +extern void standard_ExecutorRun(QueryDesc *queryDesc, + ScanDirection direction, uint64 count); +extern void ExecutorFinish(QueryDesc *queryDesc); +extern void standard_ExecutorFinish(QueryDesc *queryDesc); +extern void ExecutorEnd(QueryDesc *queryDesc); +extern void standard_ExecutorEnd(QueryDesc *queryDesc); +extern void ExecutorRewind(QueryDesc *queryDesc); +extern bool ExecCheckPermissions(List *rangeTable, + List *rteperminfos, bool ereport_on_violation); +extern bool ExecCheckOneRelPerms(RTEPermissionInfo *perminfo); +extern void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation, + OnConflictAction onConflictAction, + List *mergeActions); +extern void InitResultRelInfo(ResultRelInfo *resultRelInfo, + Relation resultRelationDesc, + Index resultRelationIndex, + ResultRelInfo *partition_root_rri, + int instrument_options); +extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid, + ResultRelInfo *rootRelInfo); +extern List *ExecGetAncestorResultRels(EState *estate, ResultRelInfo *resultRelInfo); +extern void ExecConstraints(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate); +extern AttrNumber ExecRelGenVirtualNotNull(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, + EState *estate, + List *notnull_virtual_attrs); +extern bool ExecPartitionCheck(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate, bool emitError); +extern void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate); +extern void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate); +extern char *ExecBuildSlotValueDescription(Oid reloid, TupleTableSlot *slot, + TupleDesc tupdesc, + Bitmapset *modifiedCols, + int maxfieldlen); +extern LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo); +extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti, bool missing_ok); +extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist); +extern TupleTableSlot *EvalPlanQual(EPQState *epqstate, Relation relation, + Index rti, TupleTableSlot *inputslot); +extern void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, + Plan *subplan, List *auxrowmarks, + int epqParam, List *resultRelations); +extern void EvalPlanQualSetPlan(EPQState *epqstate, + Plan *subplan, List *auxrowmarks); +extern TupleTableSlot *EvalPlanQualSlot(EPQState *epqstate, + Relation relation, Index rti); + +#define EvalPlanQualSetSlot(epqstate, slot) ((epqstate)->origslot = (slot)) +extern bool EvalPlanQualFetchRowMark(EPQState *epqstate, Index rti, TupleTableSlot *slot); +extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate); +extern void EvalPlanQualBegin(EPQState *epqstate); +extern void EvalPlanQualEnd(EPQState *epqstate); + +/* + * functions in execProcnode.c + */ +extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags); +extern void ExecSetExecProcNode(PlanState *node, ExecProcNodeMtd function); +extern Node *MultiExecProcNode(PlanState *node); +extern void ExecEndNode(PlanState *node); +extern void ExecShutdownNode(PlanState *node); +extern void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node); + + +/* ---------------------------------------------------------------- + * ExecProcNode + * + * Execute the given node to return a(nother) tuple. + * ---------------------------------------------------------------- + */ +#ifndef FRONTEND +static inline TupleTableSlot * +ExecProcNode(PlanState *node) +{ + if (node->chgParam != NULL) /* something changed? */ + ExecReScan(node); /* let ReScan handle this */ + + return node->ExecProcNode(node); +} +#endif + +/* + * prototypes from functions in execExpr.c + */ +extern ExprState *ExecInitExpr(Expr *node, PlanState *parent); +extern ExprState *ExecInitExprWithParams(Expr *node, ParamListInfo ext_params); +extern ExprState *ExecInitQual(List *qual, PlanState *parent); +extern ExprState *ExecInitCheck(List *qual, PlanState *parent); +extern List *ExecInitExprList(List *nodes, PlanState *parent); +extern ExprState *ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase, + bool doSort, bool doHash, bool nullcheck); +extern ExprState *ExecBuildHash32FromAttrs(TupleDesc desc, + const TupleTableSlotOps *ops, + FmgrInfo *hashfunctions, + Oid *collations, + int numCols, + AttrNumber *keyColIdx, + PlanState *parent, + uint32 init_value); +extern ExprState *ExecBuildHash32Expr(TupleDesc desc, + const TupleTableSlotOps *ops, + const Oid *hashfunc_oids, + const List *collations, + const List *hash_exprs, + const bool *opstrict, PlanState *parent, + uint32 init_value, bool keep_nulls); +extern ExprState *ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, + const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, + int numCols, + const AttrNumber *keyColIdx, + const Oid *eqfunctions, + const Oid *collations, + PlanState *parent); +extern ExprState *ExecBuildParamSetEqual(TupleDesc desc, + const TupleTableSlotOps *lops, + const TupleTableSlotOps *rops, + const Oid *eqfunctions, + const Oid *collations, + const List *param_exprs, + PlanState *parent); +extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList, + ExprContext *econtext, + TupleTableSlot *slot, + PlanState *parent, + TupleDesc inputDesc); +extern ProjectionInfo *ExecBuildUpdateProjection(List *targetList, + bool evalTargetList, + List *targetColnos, + TupleDesc relDesc, + ExprContext *econtext, + TupleTableSlot *slot, + PlanState *parent); +extern ExprState *ExecPrepareExpr(Expr *node, EState *estate); +extern ExprState *ExecPrepareQual(List *qual, EState *estate); +extern ExprState *ExecPrepareCheck(List *qual, EState *estate); +extern List *ExecPrepareExprList(List *nodes, EState *estate); + +/* + * ExecEvalExpr + * + * Evaluate expression identified by "state" in the execution context + * given by "econtext". *isNull is set to the is-null flag for the result, + * and the Datum value is the function result. + * + * The caller should already have switched into the temporary memory + * context econtext->ecxt_per_tuple_memory. The convenience entry point + * ExecEvalExprSwitchContext() is provided for callers who don't prefer to + * do the switch in an outer loop. + */ +#ifndef FRONTEND +static inline Datum +ExecEvalExpr(ExprState *state, + ExprContext *econtext, + bool *isNull) +{ + return state->evalfunc(state, econtext, isNull); +} +#endif + +/* + * ExecEvalExprNoReturn + * + * Like ExecEvalExpr(), but for cases where no return value is expected, + * because the side-effects of expression evaluation are what's desired. This + * is e.g. used for projection and aggregate transition computation. + + * Evaluate expression identified by "state" in the execution context + * given by "econtext". + * + * The caller should already have switched into the temporary memory context + * econtext->ecxt_per_tuple_memory. The convenience entry point + * ExecEvalExprNoReturnSwitchContext() is provided for callers who don't + * prefer to do the switch in an outer loop. + */ +#ifndef FRONTEND +static inline void +ExecEvalExprNoReturn(ExprState *state, + ExprContext *econtext) +{ + PG_USED_FOR_ASSERTS_ONLY Datum retDatum; + + retDatum = state->evalfunc(state, econtext, NULL); + + Assert(retDatum == (Datum) 0); +} +#endif + +/* + * ExecEvalExprSwitchContext + * + * Same as ExecEvalExpr, but get into the right allocation context explicitly. + */ +#ifndef FRONTEND +static inline Datum +ExecEvalExprSwitchContext(ExprState *state, + ExprContext *econtext, + bool *isNull) +{ + Datum retDatum; + MemoryContext oldContext; + + oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory); + retDatum = state->evalfunc(state, econtext, isNull); + MemoryContextSwitchTo(oldContext); + return retDatum; +} +#endif + +/* + * ExecEvalExprNoReturnSwitchContext + * + * Same as ExecEvalExprNoReturn, but get into the right allocation context + * explicitly. + */ +#ifndef FRONTEND +static inline void +ExecEvalExprNoReturnSwitchContext(ExprState *state, + ExprContext *econtext) +{ + MemoryContext oldContext; + + oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory); + ExecEvalExprNoReturn(state, econtext); + MemoryContextSwitchTo(oldContext); +} +#endif + +/* + * ExecProject + * + * Projects a tuple based on projection info and stores it in the slot passed + * to ExecBuildProjectionInfo(). + * + * Note: the result is always a virtual tuple; therefore it may reference + * the contents of the exprContext's scan tuples and/or temporary results + * constructed in the exprContext. If the caller wishes the result to be + * valid longer than that data will be valid, he must call ExecMaterializeSlot + * on the result slot. + */ +#ifndef FRONTEND +static inline TupleTableSlot * +ExecProject(ProjectionInfo *projInfo) +{ + ExprContext *econtext = projInfo->pi_exprContext; + ExprState *state = &projInfo->pi_state; + TupleTableSlot *slot = state->resultslot; + + /* + * Clear any former contents of the result slot. This makes it safe for + * us to use the slot's Datum/isnull arrays as workspace. + */ + ExecClearTuple(slot); + + /* Run the expression */ + ExecEvalExprNoReturnSwitchContext(state, econtext); + + /* + * Successfully formed a result row. Mark the result slot as containing a + * valid virtual tuple (inlined version of ExecStoreVirtualTuple()). + */ + slot->tts_flags &= ~TTS_FLAG_EMPTY; + slot->tts_nvalid = slot->tts_tupleDescriptor->natts; + + return slot; +} +#endif + +/* + * ExecQual - evaluate a qual prepared with ExecInitQual (possibly via + * ExecPrepareQual). Returns true if qual is satisfied, else false. + * + * Note: ExecQual used to have a third argument "resultForNull". The + * behavior of this function now corresponds to resultForNull == false. + * If you want the resultForNull == true behavior, see ExecCheck. + */ +#ifndef FRONTEND +static inline bool +ExecQual(ExprState *state, ExprContext *econtext) +{ + Datum ret; + bool isnull; + + /* short-circuit (here and in ExecInitQual) for empty restriction list */ + if (state == NULL) + return true; + + /* verify that expression was compiled using ExecInitQual */ + Assert(state->flags & EEO_FLAG_IS_QUAL); + + ret = ExecEvalExprSwitchContext(state, econtext, &isnull); + + /* EEOP_QUAL should never return NULL */ + Assert(!isnull); + + return DatumGetBool(ret); +} +#endif + +/* + * ExecQualAndReset() - evaluate qual with ExecQual() and reset expression + * context. + */ +#ifndef FRONTEND +static inline bool +ExecQualAndReset(ExprState *state, ExprContext *econtext) +{ + bool ret = ExecQual(state, econtext); + + /* inline ResetExprContext, to avoid ordering issue in this file */ + MemoryContextReset(econtext->ecxt_per_tuple_memory); + return ret; +} +#endif + +extern bool ExecCheck(ExprState *state, ExprContext *econtext); + +/* + * prototypes from functions in execSRF.c + */ +extern SetExprState *ExecInitTableFunctionResult(Expr *expr, + ExprContext *econtext, PlanState *parent); +extern Tuplestorestate *ExecMakeTableFunctionResult(SetExprState *setexpr, + ExprContext *econtext, + MemoryContext argContext, + TupleDesc expectedDesc, + bool randomAccess); +extern SetExprState *ExecInitFunctionResultSet(Expr *expr, + ExprContext *econtext, PlanState *parent); +extern Datum ExecMakeFunctionResultSet(SetExprState *fcache, + ExprContext *econtext, + MemoryContext argContext, + bool *isNull, + ExprDoneCond *isDone); + +/* + * prototypes from functions in execScan.c + */ +typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node); +typedef bool (*ExecScanRecheckMtd) (ScanState *node, TupleTableSlot *slot); + +extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, + ExecScanRecheckMtd recheckMtd); +extern void ExecAssignScanProjectionInfo(ScanState *node); +extern void ExecAssignScanProjectionInfoWithVarno(ScanState *node, int varno); +extern void ExecScanReScan(ScanState *node); + +/* + * prototypes from functions in execTuples.c + */ +extern void ExecInitResultTypeTL(PlanState *planstate); +extern void ExecInitResultSlot(PlanState *planstate, + const TupleTableSlotOps *tts_ops); +extern void ExecInitResultTupleSlotTL(PlanState *planstate, + const TupleTableSlotOps *tts_ops); +extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, + TupleDesc tupledesc, + const TupleTableSlotOps *tts_ops); +extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate, + TupleDesc tupledesc, + const TupleTableSlotOps *tts_ops); +extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate, TupleDesc tupType, + const TupleTableSlotOps *tts_ops); +extern TupleDesc ExecTypeFromTL(List *targetList); +extern TupleDesc ExecCleanTypeFromTL(List *targetList); +extern TupleDesc ExecTypeFromExprList(List *exprList); +extern void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList); +extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg); + +typedef struct TupOutputState +{ + TupleTableSlot *slot; + DestReceiver *dest; +} TupOutputState; + +extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest, + TupleDesc tupdesc, + const TupleTableSlotOps *tts_ops); +extern void do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull); +extern void do_text_output_multiline(TupOutputState *tstate, const char *txt); +extern void end_tup_output(TupOutputState *tstate); + +/* + * Write a single line of text given as a C string. + * + * Should only be used with a single-TEXT-attribute tupdesc. + */ +#define do_text_output_oneline(tstate, str_to_emit) \ + do { \ + Datum values_[1]; \ + bool isnull_[1]; \ + values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \ + isnull_[0] = false; \ + do_tup_output(tstate, values_, isnull_); \ + pfree(DatumGetPointer(values_[0])); \ + } while (0) + + +/* + * prototypes from functions in execUtils.c + */ +extern EState *CreateExecutorState(void); +extern void FreeExecutorState(EState *estate); +extern ExprContext *CreateExprContext(EState *estate); +extern ExprContext *CreateWorkExprContext(EState *estate); +extern ExprContext *CreateStandaloneExprContext(void); +extern void FreeExprContext(ExprContext *econtext, bool isCommit); +extern void ReScanExprContext(ExprContext *econtext); + +#define ResetExprContext(econtext) \ + MemoryContextReset((econtext)->ecxt_per_tuple_memory) + +extern ExprContext *MakePerTupleExprContext(EState *estate); + +/* Get an EState's per-output-tuple exprcontext, making it if first use */ +#define GetPerTupleExprContext(estate) \ + ((estate)->es_per_tuple_exprcontext ? \ + (estate)->es_per_tuple_exprcontext : \ + MakePerTupleExprContext(estate)) + +#define GetPerTupleMemoryContext(estate) \ + (GetPerTupleExprContext(estate)->ecxt_per_tuple_memory) + +/* Reset an EState's per-output-tuple exprcontext, if one's been created */ +#define ResetPerTupleExprContext(estate) \ + do { \ + if ((estate)->es_per_tuple_exprcontext) \ + ResetExprContext((estate)->es_per_tuple_exprcontext); \ + } while (0) + +extern void ExecAssignExprContext(EState *estate, PlanState *planstate); +extern TupleDesc ExecGetResultType(PlanState *planstate); +extern const TupleTableSlotOps *ExecGetResultSlotOps(PlanState *planstate, + bool *isfixed); +extern const TupleTableSlotOps *ExecGetCommonSlotOps(PlanState **planstates, + int nplans); +extern const TupleTableSlotOps *ExecGetCommonChildSlotOps(PlanState *ps); +extern void ExecAssignProjectionInfo(PlanState *planstate, + TupleDesc inputDesc); +extern void ExecConditionalAssignProjectionInfo(PlanState *planstate, + TupleDesc inputDesc, int varno); +extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc); +extern void ExecCreateScanSlotFromOuterPlan(EState *estate, + ScanState *scanstate, + const TupleTableSlotOps *tts_ops); + +extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid); + +extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags); + +extern void ExecInitRangeTable(EState *estate, List *rangeTable, List *permInfos, + Bitmapset *unpruned_relids); +extern void ExecCloseRangeTableRelations(EState *estate); +extern void ExecCloseResultRelations(EState *estate); + +static inline RangeTblEntry * +exec_rt_fetch(Index rti, EState *estate) +{ + return (RangeTblEntry *) list_nth(estate->es_range_table, rti - 1); +} + +extern Relation ExecGetRangeTableRelation(EState *estate, Index rti, + bool isResultRel); +extern void ExecInitResultRelation(EState *estate, ResultRelInfo *resultRelInfo, + Index rti); + +extern int executor_errposition(EState *estate, int location); + +extern void RegisterExprContextCallback(ExprContext *econtext, + ExprContextCallbackFunction function, + Datum arg); +extern void UnregisterExprContextCallback(ExprContext *econtext, + ExprContextCallbackFunction function, + Datum arg); + +extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname, + bool *isNull); +extern Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno, + bool *isNull); + +extern int ExecTargetListLength(List *targetlist); +extern int ExecCleanTargetListLength(List *targetlist); + +extern TupleTableSlot *ExecGetTriggerOldSlot(EState *estate, ResultRelInfo *relInfo); +extern TupleTableSlot *ExecGetTriggerNewSlot(EState *estate, ResultRelInfo *relInfo); +extern TupleTableSlot *ExecGetReturningSlot(EState *estate, ResultRelInfo *relInfo); +extern TupleTableSlot *ExecGetAllNullSlot(EState *estate, ResultRelInfo *relInfo); +extern TupleConversionMap *ExecGetChildToRootMap(ResultRelInfo *resultRelInfo); +extern TupleConversionMap *ExecGetRootToChildMap(ResultRelInfo *resultRelInfo, EState *estate); + +extern Oid ExecGetResultRelCheckAsUser(ResultRelInfo *relInfo, EState *estate); +extern Bitmapset *ExecGetInsertedCols(ResultRelInfo *relinfo, EState *estate); +extern Bitmapset *ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate); +extern Bitmapset *ExecGetExtraUpdatedCols(ResultRelInfo *relinfo, EState *estate); +extern Bitmapset *ExecGetAllUpdatedCols(ResultRelInfo *relinfo, EState *estate); + +/* + * prototypes from functions in execIndexing.c + */ +extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative); +extern void ExecCloseIndices(ResultRelInfo *resultRelInfo); +extern List *ExecInsertIndexTuples(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate, + bool update, + bool noDupErr, + bool *specConflict, List *arbiterIndexes, + bool onlySummarizing); +extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, + EState *estate, ItemPointer conflictTid, + ItemPointer tupleid, + List *arbiterIndexes); +extern void check_exclusion_constraint(Relation heap, Relation index, + IndexInfo *indexInfo, + ItemPointer tupleid, + const Datum *values, const bool *isnull, + EState *estate, bool newIndex); + +/* + * prototypes from functions in execReplication.c + */ +extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid, + LockTupleMode lockmode, + TupleTableSlot *searchslot, + TupleTableSlot *outslot); +extern bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode, + TupleTableSlot *searchslot, TupleTableSlot *outslot); + +extern void ExecSimpleRelationInsert(ResultRelInfo *resultRelInfo, + EState *estate, TupleTableSlot *slot); +extern void ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo, + EState *estate, EPQState *epqstate, + TupleTableSlot *searchslot, TupleTableSlot *slot); +extern void ExecSimpleRelationDelete(ResultRelInfo *resultRelInfo, + EState *estate, EPQState *epqstate, + TupleTableSlot *searchslot); +extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd); + +extern void CheckSubscriptionRelkind(char relkind, const char *nspname, + const char *relname); + +/* + * prototypes from functions in nodeModifyTable.c + */ +extern TupleTableSlot *ExecGetUpdateNewTuple(ResultRelInfo *relinfo, + TupleTableSlot *planSlot, + TupleTableSlot *oldSlot); +extern ResultRelInfo *ExecLookupResultRelByOid(ModifyTableState *node, + Oid resultoid, + bool missing_ok, + bool update_cache); + +#endif /* EXECUTOR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/functions.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/functions.h new file mode 100644 index 0000000..58bdff9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/functions.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------------------- + * + * functions.h + * Declarations for execution of SQL-language functions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/functions.h + * + *------------------------------------------------------------------------- + */ +#ifndef FUNCTIONS_H +#define FUNCTIONS_H + +#include "nodes/execnodes.h" +#include "tcop/dest.h" + +/* + * Data structure needed by the parser callback hooks to resolve parameter + * references during parsing of a SQL function's body. This is separate from + * SQLFunctionCache since we sometimes do parsing separately from execution. + */ +typedef struct SQLFunctionParseInfo +{ + char *fname; /* function's name */ + int nargs; /* number of input arguments */ + Oid *argtypes; /* resolved types of input arguments */ + char **argnames; /* names of input arguments; NULL if none */ + /* Note that argnames[i] can be NULL, if some args are unnamed */ + Oid collation; /* function's input collation, if known */ +} SQLFunctionParseInfo; + +typedef SQLFunctionParseInfo *SQLFunctionParseInfoPtr; + +extern Datum fmgr_sql(PG_FUNCTION_ARGS); + +extern SQLFunctionParseInfoPtr prepare_sql_fn_parse_info(HeapTuple procedureTuple, + Node *call_expr, + Oid inputCollation); + +extern void sql_fn_parser_setup(struct ParseState *pstate, + SQLFunctionParseInfoPtr pinfo); + +extern void check_sql_fn_statements(List *queryTreeLists); + +extern bool check_sql_fn_retval(List *queryTreeLists, + Oid rettype, TupleDesc rettupdesc, + char prokind, + bool insertDroppedCols); + +extern DestReceiver *CreateSQLFunctionDestReceiver(void); + +#endif /* FUNCTIONS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/hashjoin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/hashjoin.h new file mode 100644 index 0000000..ecff484 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/hashjoin.h @@ -0,0 +1,365 @@ +/*------------------------------------------------------------------------- + * + * hashjoin.h + * internal structures for hash joins + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/hashjoin.h + * + *------------------------------------------------------------------------- + */ +#ifndef HASHJOIN_H +#define HASHJOIN_H + +#include "nodes/execnodes.h" +#include "port/atomics.h" +#include "storage/barrier.h" +#include "storage/buffile.h" +#include "storage/lwlock.h" + +/* ---------------------------------------------------------------- + * hash-join hash table structures + * + * Each active hashjoin has a HashJoinTable structure, which is + * palloc'd in the executor's per-query context. Other storage needed for + * each hashjoin is kept in child contexts, three for each hashjoin: + * - HashTableContext (hashCxt): the parent hash table storage context + * - HashSpillContext (spillCxt): storage for temp files buffers + * - HashBatchContext (batchCxt): storage for a batch in serial hash join + * + * The hashtable contexts are made children of the per-query context, ensuring + * that they will be discarded at end of statement even if the join is + * aborted early by an error. (Likewise, any temporary files we make will + * be cleaned up by the virtual file manager in event of an error.) + * + * Storage that should live through the entire join is allocated from the + * "hashCxt" (mainly the hashtable's metadata). Also, the "hashCxt" context is + * the parent of "spillCxt" and "batchCxt". It makes it easy and fast to + * release the storage when we don't need it anymore. + * + * Data associated with temp files is allocated in the "spillCxt" context + * which lives for the duration of the entire join as batch files' + * creation and usage may span batch execution. These files are + * explicitly destroyed by calling BufFileClose() when the code is done + * with them. The aim of this context is to help accounting for the + * memory allocated for temp files and their buffers. + * + * Finally, data used only during a single batch's execution is allocated + * in the "batchCxt". By resetting the batchCxt at the end of each batch, + * we free all the per-batch storage reliably and without tedium. + * + * During first scan of inner relation, we get its tuples from executor. + * If nbatch > 1 then tuples that don't belong in first batch get saved + * into inner-batch temp files. The same statements apply for the + * first scan of the outer relation, except we write tuples to outer-batch + * temp files. After finishing the first scan, we do the following for + * each remaining batch: + * 1. Read tuples from inner batch file, load into hash buckets. + * 2. Read tuples from outer batch file, match to hash buckets and output. + * + * It is possible to increase nbatch on the fly if the in-memory hash table + * gets too big. The hash-value-to-batch computation is arranged so that this + * can only cause a tuple to go into a later batch than previously thought, + * never into an earlier batch. When we increase nbatch, we rescan the hash + * table and dump out any tuples that are now of a later batch to the correct + * inner batch file. Subsequently, while reading either inner or outer batch + * files, we might find tuples that no longer belong to the current batch; + * if so, we just dump them out to the correct batch file. + * ---------------------------------------------------------------- + */ + +/* these are in nodes/execnodes.h: */ +/* typedef struct HashJoinTupleData *HashJoinTuple; */ +/* typedef struct HashJoinTableData *HashJoinTable; */ + +typedef struct HashJoinTupleData +{ + /* link to next tuple in same bucket */ + union + { + struct HashJoinTupleData *unshared; + dsa_pointer shared; + } next; + uint32 hashvalue; /* tuple's hash code */ + /* Tuple data, in MinimalTuple format, follows on a MAXALIGN boundary */ +} HashJoinTupleData; + +#define HJTUPLE_OVERHEAD MAXALIGN(sizeof(HashJoinTupleData)) +#define HJTUPLE_MINTUPLE(hjtup) \ + ((MinimalTuple) ((char *) (hjtup) + HJTUPLE_OVERHEAD)) + +/* + * If the outer relation's distribution is sufficiently nonuniform, we attempt + * to optimize the join by treating the hash values corresponding to the outer + * relation's MCVs specially. Inner relation tuples matching these hash + * values go into the "skew" hashtable instead of the main hashtable, and + * outer relation tuples with these hash values are matched against that + * table instead of the main one. Thus, tuples with these hash values are + * effectively handled as part of the first batch and will never go to disk. + * The skew hashtable is limited to SKEW_HASH_MEM_PERCENT of the total memory + * allowed for the join; while building the hashtables, we decrease the number + * of MCVs being specially treated if needed to stay under this limit. + * + * Note: you might wonder why we look at the outer relation stats for this, + * rather than the inner. One reason is that the outer relation is typically + * bigger, so we get more I/O savings by optimizing for its most common values. + * Also, for similarly-sized relations, the planner prefers to put the more + * uniformly distributed relation on the inside, so we're more likely to find + * interesting skew in the outer relation. + */ +typedef struct HashSkewBucket +{ + uint32 hashvalue; /* common hash value */ + HashJoinTuple tuples; /* linked list of inner-relation tuples */ +} HashSkewBucket; + +#define SKEW_BUCKET_OVERHEAD MAXALIGN(sizeof(HashSkewBucket)) +#define INVALID_SKEW_BUCKET_NO (-1) +#define SKEW_HASH_MEM_PERCENT 2 +#define SKEW_MIN_OUTER_FRACTION 0.01 + +/* + * To reduce palloc overhead, the HashJoinTuples for the current batch are + * packed in 32kB buffers instead of pallocing each tuple individually. + */ +typedef struct HashMemoryChunkData +{ + int ntuples; /* number of tuples stored in this chunk */ + size_t maxlen; /* size of the chunk's tuple buffer */ + size_t used; /* number of buffer bytes already used */ + + /* pointer to the next chunk (linked list) */ + union + { + struct HashMemoryChunkData *unshared; + dsa_pointer shared; + } next; + + /* + * The chunk's tuple buffer starts after the HashMemoryChunkData struct, + * at offset HASH_CHUNK_HEADER_SIZE (which must be maxaligned). Note that + * that offset is not included in "maxlen" or "used". + */ +} HashMemoryChunkData; + +typedef struct HashMemoryChunkData *HashMemoryChunk; + +#define HASH_CHUNK_SIZE ((Size) (32 * 1024)) +#define HASH_CHUNK_HEADER_SIZE MAXALIGN(sizeof(HashMemoryChunkData)) +#define HASH_CHUNK_DATA(hc) (((char *) (hc)) + HASH_CHUNK_HEADER_SIZE) +/* tuples exceeding HASH_CHUNK_THRESHOLD bytes are put in their own chunk */ +#define HASH_CHUNK_THRESHOLD (HASH_CHUNK_SIZE / 4) + +/* + * For each batch of a Parallel Hash Join, we have a ParallelHashJoinBatch + * object in shared memory to coordinate access to it. Since they are + * followed by variable-sized objects, they are arranged in contiguous memory + * but not accessed directly as an array. + */ +typedef struct ParallelHashJoinBatch +{ + dsa_pointer buckets; /* array of hash table buckets */ + Barrier batch_barrier; /* synchronization for joining this batch */ + + dsa_pointer chunks; /* chunks of tuples loaded */ + size_t size; /* size of buckets + chunks in memory */ + size_t estimated_size; /* size of buckets + chunks while writing */ + size_t ntuples; /* number of tuples loaded */ + size_t old_ntuples; /* number of tuples before repartitioning */ + bool space_exhausted; + bool skip_unmatched; /* whether to abandon unmatched scan */ + + /* + * Variable-sized SharedTuplestore objects follow this struct in memory. + * See the accessor macros below. + */ +} ParallelHashJoinBatch; + +/* Accessor for inner batch tuplestore following a ParallelHashJoinBatch. */ +#define ParallelHashJoinBatchInner(batch) \ + ((SharedTuplestore *) \ + ((char *) (batch) + MAXALIGN(sizeof(ParallelHashJoinBatch)))) + +/* Accessor for outer batch tuplestore following a ParallelHashJoinBatch. */ +#define ParallelHashJoinBatchOuter(batch, nparticipants) \ + ((SharedTuplestore *) \ + ((char *) ParallelHashJoinBatchInner(batch) + \ + MAXALIGN(sts_estimate(nparticipants)))) + +/* Total size of a ParallelHashJoinBatch and tuplestores. */ +#define EstimateParallelHashJoinBatch(hashtable) \ + (MAXALIGN(sizeof(ParallelHashJoinBatch)) + \ + MAXALIGN(sts_estimate((hashtable)->parallel_state->nparticipants)) * 2) + +/* Accessor for the nth ParallelHashJoinBatch given the base. */ +#define NthParallelHashJoinBatch(base, n) \ + ((ParallelHashJoinBatch *) \ + ((char *) (base) + \ + EstimateParallelHashJoinBatch(hashtable) * (n))) + +/* + * Each backend requires a small amount of per-batch state to interact with + * each ParallelHashJoinBatch. + */ +typedef struct ParallelHashJoinBatchAccessor +{ + ParallelHashJoinBatch *shared; /* pointer to shared state */ + + /* Per-backend partial counters to reduce contention. */ + size_t preallocated; /* pre-allocated space for this backend */ + size_t ntuples; /* number of tuples */ + size_t size; /* size of partition in memory */ + size_t estimated_size; /* size of partition on disk */ + size_t old_ntuples; /* how many tuples before repartitioning? */ + bool at_least_one_chunk; /* has this backend allocated a chunk? */ + bool outer_eof; /* has this process hit end of batch? */ + bool done; /* flag to remember that a batch is done */ + SharedTuplestoreAccessor *inner_tuples; + SharedTuplestoreAccessor *outer_tuples; +} ParallelHashJoinBatchAccessor; + +/* + * While hashing the inner relation, any participant might determine that it's + * time to increase the number of buckets to reduce the load factor or batches + * to reduce the memory size. This is indicated by setting the growth flag to + * these values. + */ +typedef enum ParallelHashGrowth +{ + /* The current dimensions are sufficient. */ + PHJ_GROWTH_OK, + /* The load factor is too high, so we need to add buckets. */ + PHJ_GROWTH_NEED_MORE_BUCKETS, + /* The memory budget would be exhausted, so we need to repartition. */ + PHJ_GROWTH_NEED_MORE_BATCHES, + /* Repartitioning didn't help last time, so don't try to do that again. */ + PHJ_GROWTH_DISABLED, +} ParallelHashGrowth; + +/* + * The shared state used to coordinate a Parallel Hash Join. This is stored + * in the DSM segment. + */ +typedef struct ParallelHashJoinState +{ + dsa_pointer batches; /* array of ParallelHashJoinBatch */ + dsa_pointer old_batches; /* previous generation during repartition */ + int nbatch; /* number of batches now */ + int old_nbatch; /* previous number of batches */ + int nbuckets; /* number of buckets */ + ParallelHashGrowth growth; /* control batch/bucket growth */ + dsa_pointer chunk_work_queue; /* chunk work queue */ + int nparticipants; + size_t space_allowed; + size_t total_tuples; /* total number of inner tuples */ + LWLock lock; /* lock protecting the above */ + + Barrier build_barrier; /* synchronization for the build phases */ + Barrier grow_batches_barrier; + Barrier grow_buckets_barrier; + pg_atomic_uint32 distributor; /* counter for load balancing */ + + SharedFileSet fileset; /* space for shared temporary files */ +} ParallelHashJoinState; + +/* The phases for building batches, used by build_barrier. */ +#define PHJ_BUILD_ELECT 0 +#define PHJ_BUILD_ALLOCATE 1 +#define PHJ_BUILD_HASH_INNER 2 +#define PHJ_BUILD_HASH_OUTER 3 +#define PHJ_BUILD_RUN 4 +#define PHJ_BUILD_FREE 5 + +/* The phases for probing each batch, used by for batch_barrier. */ +#define PHJ_BATCH_ELECT 0 +#define PHJ_BATCH_ALLOCATE 1 +#define PHJ_BATCH_LOAD 2 +#define PHJ_BATCH_PROBE 3 +#define PHJ_BATCH_SCAN 4 +#define PHJ_BATCH_FREE 5 + +/* The phases of batch growth while hashing, for grow_batches_barrier. */ +#define PHJ_GROW_BATCHES_ELECT 0 +#define PHJ_GROW_BATCHES_REALLOCATE 1 +#define PHJ_GROW_BATCHES_REPARTITION 2 +#define PHJ_GROW_BATCHES_DECIDE 3 +#define PHJ_GROW_BATCHES_FINISH 4 +#define PHJ_GROW_BATCHES_PHASE(n) ((n) % 5) /* circular phases */ + +/* The phases of bucket growth while hashing, for grow_buckets_barrier. */ +#define PHJ_GROW_BUCKETS_ELECT 0 +#define PHJ_GROW_BUCKETS_REALLOCATE 1 +#define PHJ_GROW_BUCKETS_REINSERT 2 +#define PHJ_GROW_BUCKETS_PHASE(n) ((n) % 3) /* circular phases */ + +typedef struct HashJoinTableData +{ + int nbuckets; /* # buckets in the in-memory hash table */ + int log2_nbuckets; /* its log2 (nbuckets must be a power of 2) */ + + int nbuckets_original; /* # buckets when starting the first hash */ + int nbuckets_optimal; /* optimal # buckets (per batch) */ + int log2_nbuckets_optimal; /* log2(nbuckets_optimal) */ + + /* buckets[i] is head of list of tuples in i'th in-memory bucket */ + union + { + /* unshared array is per-batch storage, as are all the tuples */ + struct HashJoinTupleData **unshared; + /* shared array is per-query DSA area, as are all the tuples */ + dsa_pointer_atomic *shared; + } buckets; + + bool skewEnabled; /* are we using skew optimization? */ + HashSkewBucket **skewBucket; /* hashtable of skew buckets */ + int skewBucketLen; /* size of skewBucket array (a power of 2!) */ + int nSkewBuckets; /* number of active skew buckets */ + int *skewBucketNums; /* array indexes of active skew buckets */ + + int nbatch; /* number of batches */ + int curbatch; /* current batch #; 0 during 1st pass */ + + int nbatch_original; /* nbatch when we started inner scan */ + int nbatch_outstart; /* nbatch when we started outer scan */ + + bool growEnabled; /* flag to shut off nbatch increases */ + + double totalTuples; /* # tuples obtained from inner plan */ + double partialTuples; /* # tuples obtained from inner plan by me */ + double skewTuples; /* # tuples inserted into skew tuples */ + + /* + * These arrays are allocated for the life of the hash join, but only if + * nbatch > 1. A file is opened only when we first write a tuple into it + * (otherwise its pointer remains NULL). Note that the zero'th array + * elements never get used, since we will process rather than dump out any + * tuples of batch zero. + */ + BufFile **innerBatchFile; /* buffered virtual temp file per batch */ + BufFile **outerBatchFile; /* buffered virtual temp file per batch */ + + Size spaceUsed; /* memory space currently used by tuples */ + Size spaceAllowed; /* upper limit for space used */ + Size spacePeak; /* peak space used */ + Size spaceUsedSkew; /* skew hash table's current space usage */ + Size spaceAllowedSkew; /* upper limit for skew hashtable */ + + MemoryContext hashCxt; /* context for whole-hash-join storage */ + MemoryContext batchCxt; /* context for this-batch-only storage */ + MemoryContext spillCxt; /* context for spilling to temp files */ + + /* used for dense allocation of tuples (into linked chunks) */ + HashMemoryChunk chunks; /* one list for the whole batch */ + + /* Shared and private state for Parallel Hash. */ + HashMemoryChunk current_chunk; /* this backend's current chunk */ + dsa_area *area; /* DSA area to allocate memory from */ + ParallelHashJoinState *parallel_state; + ParallelHashJoinBatchAccessor *batches; + dsa_pointer current_chunk_shared; +} HashJoinTableData; + +#endif /* HASHJOIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/instrument.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/instrument.h new file mode 100644 index 0000000..03653ab --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/instrument.h @@ -0,0 +1,121 @@ +/*------------------------------------------------------------------------- + * + * instrument.h + * definitions for run-time statistics collection + * + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/executor/instrument.h + * + *------------------------------------------------------------------------- + */ +#ifndef INSTRUMENT_H +#define INSTRUMENT_H + +#include "portability/instr_time.h" + + +/* + * BufferUsage and WalUsage counters keep being incremented infinitely, + * i.e., must never be reset to zero, so that we can calculate how much + * the counters are incremented in an arbitrary period. + */ +typedef struct BufferUsage +{ + int64 shared_blks_hit; /* # of shared buffer hits */ + int64 shared_blks_read; /* # of shared disk blocks read */ + int64 shared_blks_dirtied; /* # of shared blocks dirtied */ + int64 shared_blks_written; /* # of shared disk blocks written */ + int64 local_blks_hit; /* # of local buffer hits */ + int64 local_blks_read; /* # of local disk blocks read */ + int64 local_blks_dirtied; /* # of local blocks dirtied */ + int64 local_blks_written; /* # of local disk blocks written */ + int64 temp_blks_read; /* # of temp blocks read */ + int64 temp_blks_written; /* # of temp blocks written */ + instr_time shared_blk_read_time; /* time spent reading shared blocks */ + instr_time shared_blk_write_time; /* time spent writing shared blocks */ + instr_time local_blk_read_time; /* time spent reading local blocks */ + instr_time local_blk_write_time; /* time spent writing local blocks */ + instr_time temp_blk_read_time; /* time spent reading temp blocks */ + instr_time temp_blk_write_time; /* time spent writing temp blocks */ +} BufferUsage; + +/* + * WalUsage tracks only WAL activity like WAL records generation that + * can be measured per query and is displayed by EXPLAIN command, + * pg_stat_statements extension, etc. It does not track other WAL activity + * like WAL writes that it's not worth measuring per query. That's tracked + * by WAL global statistics counters in WalStats, instead. + */ +typedef struct WalUsage +{ + int64 wal_records; /* # of WAL records produced */ + int64 wal_fpi; /* # of WAL full page images produced */ + uint64 wal_bytes; /* size of WAL records produced */ + int64 wal_buffers_full; /* # of times the WAL buffers became full */ +} WalUsage; + +/* Flag bits included in InstrAlloc's instrument_options bitmask */ +typedef enum InstrumentOption +{ + INSTRUMENT_TIMER = 1 << 0, /* needs timer (and row counts) */ + INSTRUMENT_BUFFERS = 1 << 1, /* needs buffer usage */ + INSTRUMENT_ROWS = 1 << 2, /* needs row count */ + INSTRUMENT_WAL = 1 << 3, /* needs WAL usage */ + INSTRUMENT_ALL = PG_INT32_MAX +} InstrumentOption; + +typedef struct Instrumentation +{ + /* Parameters set at node creation: */ + bool need_timer; /* true if we need timer data */ + bool need_bufusage; /* true if we need buffer usage data */ + bool need_walusage; /* true if we need WAL usage data */ + bool async_mode; /* true if node is in async mode */ + /* Info about current plan cycle: */ + bool running; /* true if we've completed first tuple */ + instr_time starttime; /* start time of current iteration of node */ + instr_time counter; /* accumulated runtime for this node */ + double firsttuple; /* time for first tuple of this cycle */ + double tuplecount; /* # of tuples emitted so far this cycle */ + BufferUsage bufusage_start; /* buffer usage at start */ + WalUsage walusage_start; /* WAL usage at start */ + /* Accumulated statistics across all completed cycles: */ + double startup; /* total startup time (in seconds) */ + double total; /* total time (in seconds) */ + double ntuples; /* total tuples produced */ + double ntuples2; /* secondary node-specific tuple counter */ + double nloops; /* # of run cycles for this node */ + double nfiltered1; /* # of tuples removed by scanqual or joinqual */ + double nfiltered2; /* # of tuples removed by "other" quals */ + BufferUsage bufusage; /* total buffer usage */ + WalUsage walusage; /* total WAL usage */ +} Instrumentation; + +typedef struct WorkerInstrumentation +{ + int num_workers; /* # of structures that follow */ + Instrumentation instrument[FLEXIBLE_ARRAY_MEMBER]; +} WorkerInstrumentation; + +extern PGDLLIMPORT BufferUsage pgBufferUsage; +extern PGDLLIMPORT WalUsage pgWalUsage; + +extern Instrumentation *InstrAlloc(int n, int instrument_options, + bool async_mode); +extern void InstrInit(Instrumentation *instr, int instrument_options); +extern void InstrStartNode(Instrumentation *instr); +extern void InstrStopNode(Instrumentation *instr, double nTuples); +extern void InstrUpdateTupleCount(Instrumentation *instr, double nTuples); +extern void InstrEndLoop(Instrumentation *instr); +extern void InstrAggNode(Instrumentation *dst, Instrumentation *add); +extern void InstrStartParallelQuery(void); +extern void InstrEndParallelQuery(BufferUsage *bufusage, WalUsage *walusage); +extern void InstrAccumParallelQuery(BufferUsage *bufusage, WalUsage *walusage); +extern void BufferUsageAccumDiff(BufferUsage *dst, + const BufferUsage *add, const BufferUsage *sub); +extern void WalUsageAccumDiff(WalUsage *dst, const WalUsage *add, + const WalUsage *sub); + +#endif /* INSTRUMENT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeAgg.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeAgg.h new file mode 100644 index 0000000..6c4891b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeAgg.h @@ -0,0 +1,341 @@ +/*------------------------------------------------------------------------- + * + * nodeAgg.h + * prototypes for nodeAgg.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeAgg.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEAGG_H +#define NODEAGG_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + + +/* + * AggStatePerTransData - per aggregate state value information + * + * Working state for updating the aggregate's state value, by calling the + * transition function with an input row. This struct does not store the + * information needed to produce the final aggregate result from the transition + * state, that's stored in AggStatePerAggData instead. This separation allows + * multiple aggregate results to be produced from a single state value. + */ +typedef struct AggStatePerTransData +{ + /* + * These values are set up during ExecInitAgg() and do not change + * thereafter: + */ + + /* + * Link to an Aggref expr this state value is for. + * + * There can be multiple Aggref's sharing the same state value, so long as + * the inputs and transition functions are identical and the final + * functions are not read-write. This points to the first one of them. + */ + Aggref *aggref; + + /* + * Is this state value actually being shared by more than one Aggref? + */ + bool aggshared; + + /* + * True for ORDER BY and DISTINCT Aggrefs that are not aggpresorted. + */ + bool aggsortrequired; + + /* + * Number of aggregated input columns. This includes ORDER BY expressions + * in both the plain-agg and ordered-set cases. Ordered-set direct args + * are not counted, though. + */ + int numInputs; + + /* + * Number of aggregated input columns to pass to the transfn. This + * includes the ORDER BY columns for ordered-set aggs, but not for plain + * aggs. (This doesn't count the transition state value!) + */ + int numTransInputs; + + /* Oid of the state transition or combine function */ + Oid transfn_oid; + + /* Oid of the serialization function or InvalidOid */ + Oid serialfn_oid; + + /* Oid of the deserialization function or InvalidOid */ + Oid deserialfn_oid; + + /* Oid of state value's datatype */ + Oid aggtranstype; + + /* + * fmgr lookup data for transition function or combine function. Note in + * particular that the fn_strict flag is kept here. + */ + FmgrInfo transfn; + + /* fmgr lookup data for serialization function */ + FmgrInfo serialfn; + + /* fmgr lookup data for deserialization function */ + FmgrInfo deserialfn; + + /* Input collation derived for aggregate */ + Oid aggCollation; + + /* number of sorting columns */ + int numSortCols; + + /* number of sorting columns to consider in DISTINCT comparisons */ + /* (this is either zero or the same as numSortCols) */ + int numDistinctCols; + + /* deconstructed sorting information (arrays of length numSortCols) */ + AttrNumber *sortColIdx; + Oid *sortOperators; + Oid *sortCollations; + bool *sortNullsFirst; + + /* + * Comparators for input columns --- only set/used when aggregate has + * DISTINCT flag. equalfnOne version is used for single-column + * comparisons, equalfnMulti for the case of multiple columns. + */ + FmgrInfo equalfnOne; + ExprState *equalfnMulti; + + /* + * initial value from pg_aggregate entry + */ + Datum initValue; + bool initValueIsNull; + + /* + * We need the len and byval info for the agg's input and transition data + * types in order to know how to copy/delete values. + * + * Note that the info for the input type is used only when handling + * DISTINCT aggs with just one argument, so there is only one input type. + */ + int16 inputtypeLen, + transtypeLen; + bool inputtypeByVal, + transtypeByVal; + + /* + * Slots for holding the evaluated input arguments. These are set up + * during ExecInitAgg() and then used for each input row requiring either + * FILTER or ORDER BY/DISTINCT processing. + */ + TupleTableSlot *sortslot; /* current input tuple */ + TupleTableSlot *uniqslot; /* used for multi-column DISTINCT */ + TupleDesc sortdesc; /* descriptor of input tuples */ + Datum lastdatum; /* used for single-column DISTINCT */ + bool lastisnull; /* used for single-column DISTINCT */ + bool haslast; /* got a last value for DISTINCT check */ + + /* + * These values are working state that is initialized at the start of an + * input tuple group and updated for each input tuple. + * + * For a simple (non DISTINCT/ORDER BY) aggregate, we just feed the input + * values straight to the transition function. If it's DISTINCT or + * requires ORDER BY, we pass the input values into a Tuplesort object; + * then at completion of the input tuple group, we scan the sorted values, + * eliminate duplicates if needed, and run the transition function on the + * rest. + * + * We need a separate tuplesort for each grouping set. + */ + + Tuplesortstate **sortstates; /* sort objects, if DISTINCT or ORDER BY */ + + /* + * This field is a pre-initialized FunctionCallInfo struct used for + * calling this aggregate's transfn. We save a few cycles per row by not + * re-initializing the unchanging fields; which isn't much, but it seems + * worth the extra space consumption. + */ + FunctionCallInfo transfn_fcinfo; + + /* Likewise for serialization and deserialization functions */ + FunctionCallInfo serialfn_fcinfo; + + FunctionCallInfo deserialfn_fcinfo; +} AggStatePerTransData; + +/* + * AggStatePerAggData - per-aggregate information + * + * This contains the information needed to call the final function, to produce + * a final aggregate result from the state value. If there are multiple + * identical Aggrefs in the query, they can all share the same per-agg data. + * + * These values are set up during ExecInitAgg() and do not change thereafter. + */ +typedef struct AggStatePerAggData +{ + /* + * Link to an Aggref expr this state value is for. + * + * There can be multiple identical Aggref's sharing the same per-agg. This + * points to the first one of them. + */ + Aggref *aggref; + + /* index to the state value which this agg should use */ + int transno; + + /* Optional Oid of final function (may be InvalidOid) */ + Oid finalfn_oid; + + /* + * fmgr lookup data for final function --- only valid when finalfn_oid is + * not InvalidOid. + */ + FmgrInfo finalfn; + + /* + * Number of arguments to pass to the finalfn. This is always at least 1 + * (the transition state value) plus any ordered-set direct args. If the + * finalfn wants extra args then we pass nulls corresponding to the + * aggregated input columns. + */ + int numFinalArgs; + + /* ExprStates for any direct-argument expressions */ + List *aggdirectargs; + + /* + * We need the len and byval info for the agg's result data type in order + * to know how to copy/delete values. + */ + int16 resulttypeLen; + bool resulttypeByVal; + + /* + * "shareable" is false if this agg cannot share state values with other + * aggregates because the final function is read-write. + */ + bool shareable; +} AggStatePerAggData; + +/* + * AggStatePerGroupData - per-aggregate-per-group working state + * + * These values are working state that is initialized at the start of + * an input tuple group and updated for each input tuple. + * + * In AGG_PLAIN and AGG_SORTED modes, we have a single array of these + * structs (pointed to by aggstate->pergroup); we re-use the array for + * each input group, if it's AGG_SORTED mode. In AGG_HASHED mode, the + * hash table contains an array of these structs for each tuple group. + * + * Logically, the sortstate field belongs in this struct, but we do not + * keep it here for space reasons: we don't support DISTINCT aggregates + * in AGG_HASHED mode, so there's no reason to use up a pointer field + * in every entry of the hashtable. + */ +typedef struct AggStatePerGroupData +{ +#define FIELDNO_AGGSTATEPERGROUPDATA_TRANSVALUE 0 + Datum transValue; /* current transition value */ +#define FIELDNO_AGGSTATEPERGROUPDATA_TRANSVALUEISNULL 1 + bool transValueIsNull; + +#define FIELDNO_AGGSTATEPERGROUPDATA_NOTRANSVALUE 2 + bool noTransValue; /* true if transValue not set yet */ + + /* + * Note: noTransValue initially has the same value as transValueIsNull, + * and if true both are cleared to false at the same time. They are not + * the same though: if transfn later returns a NULL, we want to keep that + * NULL and not auto-replace it with a later input value. Only the first + * non-NULL input will be auto-substituted. + */ +} AggStatePerGroupData; + +/* + * AggStatePerPhaseData - per-grouping-set-phase state + * + * Grouping sets are divided into "phases", where a single phase can be + * processed in one pass over the input. If there is more than one phase, then + * at the end of input from the current phase, state is reset and another pass + * taken over the data which has been re-sorted in the mean time. + * + * Accordingly, each phase specifies a list of grouping sets and group clause + * information, plus each phase after the first also has a sort order. + */ +typedef struct AggStatePerPhaseData +{ + AggStrategy aggstrategy; /* strategy for this phase */ + int numsets; /* number of grouping sets (or 0) */ + int *gset_lengths; /* lengths of grouping sets */ + Bitmapset **grouped_cols; /* column groupings for rollup */ + ExprState **eqfunctions; /* expression returning equality, indexed by + * nr of cols to compare */ + Agg *aggnode; /* Agg node for phase data */ + Sort *sortnode; /* Sort node for input ordering for phase */ + + ExprState *evaltrans; /* evaluation of transition functions */ + + /*---------- + * Cached variants of the compiled expression. + * first subscript: 0: outerops; 1: TTSOpsMinimalTuple + * second subscript: 0: no NULL check; 1: with NULL check + *---------- + */ + ExprState *evaltrans_cache[2][2]; +} AggStatePerPhaseData; + +/* + * AggStatePerHashData - per-hashtable state + * + * When doing grouping sets with hashing, we have one of these for each + * grouping set. (When doing hashing without grouping sets, we have just one of + * them.) + */ +typedef struct AggStatePerHashData +{ + TupleHashTable hashtable; /* hash table with one entry per group */ + TupleHashIterator hashiter; /* for iterating through hash table */ + TupleTableSlot *hashslot; /* slot for loading hash table */ + FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ + Oid *eqfuncoids; /* per-grouping-field equality fns */ + int numCols; /* number of hash key columns */ + int numhashGrpCols; /* number of columns in hash table */ + int largestGrpColIdx; /* largest col required for hashing */ + AttrNumber *hashGrpColIdxInput; /* hash col indices in input slot */ + AttrNumber *hashGrpColIdxHash; /* indices in hash table tuples */ + Agg *aggnode; /* original Agg node, for numGroups etc. */ +} AggStatePerHashData; + + +extern AggState *ExecInitAgg(Agg *node, EState *estate, int eflags); +extern void ExecEndAgg(AggState *node); +extern void ExecReScanAgg(AggState *node); + +extern Size hash_agg_entry_size(int numTrans, Size tupleWidth, + Size transitionSpace); +extern void hash_agg_set_limits(double hashentrysize, double input_groups, + int used_bits, Size *mem_limit, + uint64 *ngroups_limit, int *num_partitions); + +/* parallel instrumentation support */ +extern void ExecAggEstimate(AggState *node, ParallelContext *pcxt); +extern void ExecAggInitializeDSM(AggState *node, ParallelContext *pcxt); +extern void ExecAggInitializeWorker(AggState *node, ParallelWorkerContext *pwcxt); +extern void ExecAggRetrieveInstrumentation(AggState *node); + +#endif /* NODEAGG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeAppend.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeAppend.h new file mode 100644 index 0000000..3c90847 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeAppend.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * nodeAppend.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeAppend.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEAPPEND_H +#define NODEAPPEND_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern AppendState *ExecInitAppend(Append *node, EState *estate, int eflags); +extern void ExecEndAppend(AppendState *node); +extern void ExecReScanAppend(AppendState *node); +extern void ExecAppendEstimate(AppendState *node, ParallelContext *pcxt); +extern void ExecAppendInitializeDSM(AppendState *node, ParallelContext *pcxt); +extern void ExecAppendReInitializeDSM(AppendState *node, ParallelContext *pcxt); +extern void ExecAppendInitializeWorker(AppendState *node, ParallelWorkerContext *pwcxt); + +extern void ExecAsyncAppendResponse(AsyncRequest *areq); + +#endif /* NODEAPPEND_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapAnd.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapAnd.h new file mode 100644 index 0000000..9951873 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapAnd.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * nodeBitmapAnd.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeBitmapAnd.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEBITMAPAND_H +#define NODEBITMAPAND_H + +#include "nodes/execnodes.h" + +extern BitmapAndState *ExecInitBitmapAnd(BitmapAnd *node, EState *estate, int eflags); +extern Node *MultiExecBitmapAnd(BitmapAndState *node); +extern void ExecEndBitmapAnd(BitmapAndState *node); +extern void ExecReScanBitmapAnd(BitmapAndState *node); + +#endif /* NODEBITMAPAND_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapHeapscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapHeapscan.h new file mode 100644 index 0000000..e241ac0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapHeapscan.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * nodeBitmapHeapscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeBitmapHeapscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEBITMAPHEAPSCAN_H +#define NODEBITMAPHEAPSCAN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern BitmapHeapScanState *ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags); +extern void ExecEndBitmapHeapScan(BitmapHeapScanState *node); +extern void ExecReScanBitmapHeapScan(BitmapHeapScanState *node); +extern void ExecBitmapHeapEstimate(BitmapHeapScanState *node, + ParallelContext *pcxt); +extern void ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node, + ParallelContext *pcxt); +extern void ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node, + ParallelContext *pcxt); +extern void ExecBitmapHeapInitializeWorker(BitmapHeapScanState *node, + ParallelWorkerContext *pwcxt); +extern void ExecBitmapHeapRetrieveInstrumentation(BitmapHeapScanState *node); + +#endif /* NODEBITMAPHEAPSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapIndexscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapIndexscan.h new file mode 100644 index 0000000..b6a5ae2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapIndexscan.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * nodeBitmapIndexscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeBitmapIndexscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEBITMAPINDEXSCAN_H +#define NODEBITMAPINDEXSCAN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern BitmapIndexScanState *ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags); +extern Node *MultiExecBitmapIndexScan(BitmapIndexScanState *node); +extern void ExecEndBitmapIndexScan(BitmapIndexScanState *node); +extern void ExecReScanBitmapIndexScan(BitmapIndexScanState *node); +extern void ExecBitmapIndexScanEstimate(BitmapIndexScanState *node, ParallelContext *pcxt); +extern void ExecBitmapIndexScanInitializeDSM(BitmapIndexScanState *node, ParallelContext *pcxt); +extern void ExecBitmapIndexScanInitializeWorker(BitmapIndexScanState *node, + ParallelWorkerContext *pwcxt); +extern void ExecBitmapIndexScanRetrieveInstrumentation(BitmapIndexScanState *node); + +#endif /* NODEBITMAPINDEXSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapOr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapOr.h new file mode 100644 index 0000000..3ee94d3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeBitmapOr.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * nodeBitmapOr.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeBitmapOr.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEBITMAPOR_H +#define NODEBITMAPOR_H + +#include "nodes/execnodes.h" + +extern BitmapOrState *ExecInitBitmapOr(BitmapOr *node, EState *estate, int eflags); +extern Node *MultiExecBitmapOr(BitmapOrState *node); +extern void ExecEndBitmapOr(BitmapOrState *node); +extern void ExecReScanBitmapOr(BitmapOrState *node); + +#endif /* NODEBITMAPOR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeCtescan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeCtescan.h new file mode 100644 index 0000000..007fede --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeCtescan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeCtescan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeCtescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODECTESCAN_H +#define NODECTESCAN_H + +#include "nodes/execnodes.h" + +extern CteScanState *ExecInitCteScan(CteScan *node, EState *estate, int eflags); +extern void ExecEndCteScan(CteScanState *node); +extern void ExecReScanCteScan(CteScanState *node); + +#endif /* NODECTESCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeCustom.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeCustom.h new file mode 100644 index 0000000..bc0ca51 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeCustom.h @@ -0,0 +1,42 @@ +/* ------------------------------------------------------------------------ + * + * nodeCustom.h + * + * prototypes for CustomScan nodes + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * ------------------------------------------------------------------------ + */ +#ifndef NODECUSTOM_H +#define NODECUSTOM_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +/* + * General executor code + */ +extern CustomScanState *ExecInitCustomScan(CustomScan *cscan, + EState *estate, int eflags); +extern void ExecEndCustomScan(CustomScanState *node); + +extern void ExecReScanCustomScan(CustomScanState *node); +extern void ExecCustomMarkPos(CustomScanState *node); +extern void ExecCustomRestrPos(CustomScanState *node); + +/* + * Parallel execution support + */ +extern void ExecCustomScanEstimate(CustomScanState *node, + ParallelContext *pcxt); +extern void ExecCustomScanInitializeDSM(CustomScanState *node, + ParallelContext *pcxt); +extern void ExecCustomScanReInitializeDSM(CustomScanState *node, + ParallelContext *pcxt); +extern void ExecCustomScanInitializeWorker(CustomScanState *node, + ParallelWorkerContext *pwcxt); +extern void ExecShutdownCustomScan(CustomScanState *node); + +#endif /* NODECUSTOM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeForeignscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeForeignscan.h new file mode 100644 index 0000000..3e55e0f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeForeignscan.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * nodeForeignscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeForeignscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEFOREIGNSCAN_H +#define NODEFOREIGNSCAN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern ForeignScanState *ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags); +extern void ExecEndForeignScan(ForeignScanState *node); +extern void ExecReScanForeignScan(ForeignScanState *node); + +extern void ExecForeignScanEstimate(ForeignScanState *node, + ParallelContext *pcxt); +extern void ExecForeignScanInitializeDSM(ForeignScanState *node, + ParallelContext *pcxt); +extern void ExecForeignScanReInitializeDSM(ForeignScanState *node, + ParallelContext *pcxt); +extern void ExecForeignScanInitializeWorker(ForeignScanState *node, + ParallelWorkerContext *pwcxt); +extern void ExecShutdownForeignScan(ForeignScanState *node); + +extern void ExecAsyncForeignScanRequest(AsyncRequest *areq); +extern void ExecAsyncForeignScanConfigureWait(AsyncRequest *areq); +extern void ExecAsyncForeignScanNotify(AsyncRequest *areq); + +#endif /* NODEFOREIGNSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeFunctionscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeFunctionscan.h new file mode 100644 index 0000000..10b06ad --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeFunctionscan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeFunctionscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeFunctionscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEFUNCTIONSCAN_H +#define NODEFUNCTIONSCAN_H + +#include "nodes/execnodes.h" + +extern FunctionScanState *ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags); +extern void ExecEndFunctionScan(FunctionScanState *node); +extern void ExecReScanFunctionScan(FunctionScanState *node); + +#endif /* NODEFUNCTIONSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeGather.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeGather.h new file mode 100644 index 0000000..2961a9b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeGather.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * nodeGather.h + * prototypes for nodeGather.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeGather.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEGATHER_H +#define NODEGATHER_H + +#include "nodes/execnodes.h" + +extern GatherState *ExecInitGather(Gather *node, EState *estate, int eflags); +extern void ExecEndGather(GatherState *node); +extern void ExecShutdownGather(GatherState *node); +extern void ExecReScanGather(GatherState *node); + +#endif /* NODEGATHER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeGatherMerge.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeGatherMerge.h new file mode 100644 index 0000000..56076f4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeGatherMerge.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * nodeGatherMerge.h + * prototypes for nodeGatherMerge.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeGatherMerge.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEGATHERMERGE_H +#define NODEGATHERMERGE_H + +#include "nodes/execnodes.h" + +extern GatherMergeState *ExecInitGatherMerge(GatherMerge *node, + EState *estate, + int eflags); +extern void ExecEndGatherMerge(GatherMergeState *node); +extern void ExecReScanGatherMerge(GatherMergeState *node); +extern void ExecShutdownGatherMerge(GatherMergeState *node); + +#endif /* NODEGATHERMERGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeGroup.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeGroup.h new file mode 100644 index 0000000..0ead772 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeGroup.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeGroup.h + * prototypes for nodeGroup.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeGroup.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEGROUP_H +#define NODEGROUP_H + +#include "nodes/execnodes.h" + +extern GroupState *ExecInitGroup(Group *node, EState *estate, int eflags); +extern void ExecEndGroup(GroupState *node); +extern void ExecReScanGroup(GroupState *node); + +#endif /* NODEGROUP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeHash.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeHash.h new file mode 100644 index 0000000..3c1a094 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeHash.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * nodeHash.h + * prototypes for nodeHash.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeHash.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEHASH_H +#define NODEHASH_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +struct SharedHashJoinBatch; + +extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags); +extern Node *MultiExecHash(HashState *node); +extern void ExecEndHash(HashState *node); +extern void ExecReScanHash(HashState *node); + +extern HashJoinTable ExecHashTableCreate(HashState *state); +extern void ExecParallelHashTableAlloc(HashJoinTable hashtable, + int batchno); +extern void ExecHashTableDestroy(HashJoinTable hashtable); +extern void ExecHashTableDetach(HashJoinTable hashtable); +extern void ExecHashTableDetachBatch(HashJoinTable hashtable); +extern void ExecParallelHashTableSetCurrentBatch(HashJoinTable hashtable, + int batchno); + +extern void ExecHashTableInsert(HashJoinTable hashtable, + TupleTableSlot *slot, + uint32 hashvalue); +extern void ExecParallelHashTableInsert(HashJoinTable hashtable, + TupleTableSlot *slot, + uint32 hashvalue); +extern void ExecParallelHashTableInsertCurrentBatch(HashJoinTable hashtable, + TupleTableSlot *slot, + uint32 hashvalue); +extern void ExecHashGetBucketAndBatch(HashJoinTable hashtable, + uint32 hashvalue, + int *bucketno, + int *batchno); +extern bool ExecScanHashBucket(HashJoinState *hjstate, ExprContext *econtext); +extern bool ExecParallelScanHashBucket(HashJoinState *hjstate, ExprContext *econtext); +extern void ExecPrepHashTableForUnmatched(HashJoinState *hjstate); +extern bool ExecParallelPrepHashTableForUnmatched(HashJoinState *hjstate); +extern bool ExecScanHashTableForUnmatched(HashJoinState *hjstate, + ExprContext *econtext); +extern bool ExecParallelScanHashTableForUnmatched(HashJoinState *hjstate, + ExprContext *econtext); +extern void ExecHashTableReset(HashJoinTable hashtable); +extern void ExecHashTableResetMatchFlags(HashJoinTable hashtable); +extern void ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew, + bool try_combined_hash_mem, + int parallel_workers, + size_t *space_allowed, + int *numbuckets, + int *numbatches, + int *num_skew_mcvs); +extern int ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue); +extern void ExecHashEstimate(HashState *node, ParallelContext *pcxt); +extern void ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt); +extern void ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt); +extern void ExecHashRetrieveInstrumentation(HashState *node); +extern void ExecShutdownHash(HashState *node); +extern void ExecHashAccumInstrumentation(HashInstrumentation *instrument, + HashJoinTable hashtable); + +#endif /* NODEHASH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeHashjoin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeHashjoin.h new file mode 100644 index 0000000..646095b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeHashjoin.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * nodeHashjoin.h + * prototypes for nodeHashjoin.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeHashjoin.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEHASHJOIN_H +#define NODEHASHJOIN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" +#include "storage/buffile.h" + +extern HashJoinState *ExecInitHashJoin(HashJoin *node, EState *estate, int eflags); +extern void ExecEndHashJoin(HashJoinState *node); +extern void ExecReScanHashJoin(HashJoinState *node); +extern void ExecShutdownHashJoin(HashJoinState *node); +extern void ExecHashJoinEstimate(HashJoinState *state, ParallelContext *pcxt); +extern void ExecHashJoinInitializeDSM(HashJoinState *state, ParallelContext *pcxt); +extern void ExecHashJoinReInitializeDSM(HashJoinState *state, ParallelContext *pcxt); +extern void ExecHashJoinInitializeWorker(HashJoinState *state, + ParallelWorkerContext *pwcxt); + +extern void ExecHashJoinSaveTuple(MinimalTuple tuple, uint32 hashvalue, + BufFile **fileptr, HashJoinTable hashtable); + +#endif /* NODEHASHJOIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeIncrementalSort.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeIncrementalSort.h new file mode 100644 index 0000000..12c16bc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeIncrementalSort.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * nodeIncrementalSort.h + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeIncrementalSort.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEINCREMENTALSORT_H +#define NODEINCREMENTALSORT_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern IncrementalSortState *ExecInitIncrementalSort(IncrementalSort *node, EState *estate, int eflags); +extern void ExecEndIncrementalSort(IncrementalSortState *node); +extern void ExecReScanIncrementalSort(IncrementalSortState *node); + +/* parallel instrumentation support */ +extern void ExecIncrementalSortEstimate(IncrementalSortState *node, ParallelContext *pcxt); +extern void ExecIncrementalSortInitializeDSM(IncrementalSortState *node, ParallelContext *pcxt); +extern void ExecIncrementalSortInitializeWorker(IncrementalSortState *node, ParallelWorkerContext *pwcxt); +extern void ExecIncrementalSortRetrieveInstrumentation(IncrementalSortState *node); + +#endif /* NODEINCREMENTALSORT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeIndexonlyscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeIndexonlyscan.h new file mode 100644 index 0000000..ae85dee --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeIndexonlyscan.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * nodeIndexonlyscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeIndexonlyscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEINDEXONLYSCAN_H +#define NODEINDEXONLYSCAN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern IndexOnlyScanState *ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags); +extern void ExecEndIndexOnlyScan(IndexOnlyScanState *node); +extern void ExecIndexOnlyMarkPos(IndexOnlyScanState *node); +extern void ExecIndexOnlyRestrPos(IndexOnlyScanState *node); +extern void ExecReScanIndexOnlyScan(IndexOnlyScanState *node); + +/* Support functions for parallel index-only scans */ +extern void ExecIndexOnlyScanEstimate(IndexOnlyScanState *node, + ParallelContext *pcxt); +extern void ExecIndexOnlyScanInitializeDSM(IndexOnlyScanState *node, + ParallelContext *pcxt); +extern void ExecIndexOnlyScanReInitializeDSM(IndexOnlyScanState *node, + ParallelContext *pcxt); +extern void ExecIndexOnlyScanInitializeWorker(IndexOnlyScanState *node, + ParallelWorkerContext *pwcxt); +extern void ExecIndexOnlyScanRetrieveInstrumentation(IndexOnlyScanState *node); + +#endif /* NODEINDEXONLYSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeIndexscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeIndexscan.h new file mode 100644 index 0000000..08f0a14 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeIndexscan.h @@ -0,0 +1,48 @@ +/*------------------------------------------------------------------------- + * + * nodeIndexscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeIndexscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEINDEXSCAN_H +#define NODEINDEXSCAN_H + +#include "access/genam.h" +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern IndexScanState *ExecInitIndexScan(IndexScan *node, EState *estate, int eflags); +extern void ExecEndIndexScan(IndexScanState *node); +extern void ExecIndexMarkPos(IndexScanState *node); +extern void ExecIndexRestrPos(IndexScanState *node); +extern void ExecReScanIndexScan(IndexScanState *node); +extern void ExecIndexScanEstimate(IndexScanState *node, ParallelContext *pcxt); +extern void ExecIndexScanInitializeDSM(IndexScanState *node, ParallelContext *pcxt); +extern void ExecIndexScanReInitializeDSM(IndexScanState *node, ParallelContext *pcxt); +extern void ExecIndexScanInitializeWorker(IndexScanState *node, + ParallelWorkerContext *pwcxt); +extern void ExecIndexScanRetrieveInstrumentation(IndexScanState *node); + +/* + * These routines are exported to share code with nodeIndexonlyscan.c and + * nodeBitmapIndexscan.c + */ +extern void ExecIndexBuildScanKeys(PlanState *planstate, Relation index, + List *quals, bool isorderby, + ScanKey *scanKeys, int *numScanKeys, + IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys, + IndexArrayKeyInfo **arrayKeys, int *numArrayKeys); +extern void ExecIndexEvalRuntimeKeys(ExprContext *econtext, + IndexRuntimeKeyInfo *runtimeKeys, int numRuntimeKeys); +extern bool ExecIndexEvalArrayKeys(ExprContext *econtext, + IndexArrayKeyInfo *arrayKeys, int numArrayKeys); +extern bool ExecIndexAdvanceArrayKeys(IndexArrayKeyInfo *arrayKeys, int numArrayKeys); + +#endif /* NODEINDEXSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeLimit.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeLimit.h new file mode 100644 index 0000000..97a472c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeLimit.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeLimit.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeLimit.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODELIMIT_H +#define NODELIMIT_H + +#include "nodes/execnodes.h" + +extern LimitState *ExecInitLimit(Limit *node, EState *estate, int eflags); +extern void ExecEndLimit(LimitState *node); +extern void ExecReScanLimit(LimitState *node); + +#endif /* NODELIMIT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeLockRows.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeLockRows.h new file mode 100644 index 0000000..ad7d63d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeLockRows.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeLockRows.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeLockRows.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODELOCKROWS_H +#define NODELOCKROWS_H + +#include "nodes/execnodes.h" + +extern LockRowsState *ExecInitLockRows(LockRows *node, EState *estate, int eflags); +extern void ExecEndLockRows(LockRowsState *node); +extern void ExecReScanLockRows(LockRowsState *node); + +#endif /* NODELOCKROWS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMaterial.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMaterial.h new file mode 100644 index 0000000..30c7a25 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMaterial.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * nodeMaterial.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeMaterial.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMATERIAL_H +#define NODEMATERIAL_H + +#include "nodes/execnodes.h" + +extern MaterialState *ExecInitMaterial(Material *node, EState *estate, int eflags); +extern void ExecEndMaterial(MaterialState *node); +extern void ExecMaterialMarkPos(MaterialState *node); +extern void ExecMaterialRestrPos(MaterialState *node); +extern void ExecReScanMaterial(MaterialState *node); + +#endif /* NODEMATERIAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMemoize.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMemoize.h new file mode 100644 index 0000000..77a08f9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMemoize.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * nodeMemoize.h + * + * + * + * Portions Copyright (c) 2021-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeMemoize.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMEMOIZE_H +#define NODEMEMOIZE_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern MemoizeState *ExecInitMemoize(Memoize *node, EState *estate, int eflags); +extern void ExecEndMemoize(MemoizeState *node); +extern void ExecReScanMemoize(MemoizeState *node); +extern double ExecEstimateCacheEntryOverheadBytes(double ntuples); +extern void ExecMemoizeEstimate(MemoizeState *node, + ParallelContext *pcxt); +extern void ExecMemoizeInitializeDSM(MemoizeState *node, + ParallelContext *pcxt); +extern void ExecMemoizeInitializeWorker(MemoizeState *node, + ParallelWorkerContext *pwcxt); +extern void ExecMemoizeRetrieveInstrumentation(MemoizeState *node); + +#endif /* NODEMEMOIZE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMergeAppend.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMergeAppend.h new file mode 100644 index 0000000..4eb05dc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMergeAppend.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeMergeAppend.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeMergeAppend.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMERGEAPPEND_H +#define NODEMERGEAPPEND_H + +#include "nodes/execnodes.h" + +extern MergeAppendState *ExecInitMergeAppend(MergeAppend *node, EState *estate, int eflags); +extern void ExecEndMergeAppend(MergeAppendState *node); +extern void ExecReScanMergeAppend(MergeAppendState *node); + +#endif /* NODEMERGEAPPEND_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMergejoin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMergejoin.h new file mode 100644 index 0000000..5e79aca --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeMergejoin.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeMergejoin.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeMergejoin.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMERGEJOIN_H +#define NODEMERGEJOIN_H + +#include "nodes/execnodes.h" + +extern MergeJoinState *ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags); +extern void ExecEndMergeJoin(MergeJoinState *node); +extern void ExecReScanMergeJoin(MergeJoinState *node); + +#endif /* NODEMERGEJOIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeModifyTable.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeModifyTable.h new file mode 100644 index 0000000..bf3b592 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeModifyTable.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * nodeModifyTable.h + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeModifyTable.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMODIFYTABLE_H +#define NODEMODIFYTABLE_H + +#include "nodes/execnodes.h" + +extern void ExecInitGenerated(ResultRelInfo *resultRelInfo, + EState *estate, + CmdType cmdtype); + +extern void ExecComputeStoredGenerated(ResultRelInfo *resultRelInfo, + EState *estate, TupleTableSlot *slot, + CmdType cmdtype); + +extern ModifyTableState *ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags); +extern void ExecEndModifyTable(ModifyTableState *node); +extern void ExecReScanModifyTable(ModifyTableState *node); + +extern void ExecInitMergeTupleSlots(ModifyTableState *mtstate, + ResultRelInfo *resultRelInfo); + +#endif /* NODEMODIFYTABLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeNamedtuplestorescan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeNamedtuplestorescan.h new file mode 100644 index 0000000..abfe4a2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeNamedtuplestorescan.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * nodeNamedtuplestorescan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeNamedtuplestorescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODENAMEDTUPLESTORESCAN_H +#define NODENAMEDTUPLESTORESCAN_H + +#include "nodes/execnodes.h" + +extern NamedTuplestoreScanState *ExecInitNamedTuplestoreScan(NamedTuplestoreScan *node, EState *estate, int eflags); +extern void ExecReScanNamedTuplestoreScan(NamedTuplestoreScanState *node); + +#endif /* NODENAMEDTUPLESTORESCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeNestloop.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeNestloop.h new file mode 100644 index 0000000..5a24cc9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeNestloop.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeNestloop.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeNestloop.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODENESTLOOP_H +#define NODENESTLOOP_H + +#include "nodes/execnodes.h" + +extern NestLoopState *ExecInitNestLoop(NestLoop *node, EState *estate, int eflags); +extern void ExecEndNestLoop(NestLoopState *node); +extern void ExecReScanNestLoop(NestLoopState *node); + +#endif /* NODENESTLOOP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeProjectSet.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeProjectSet.h new file mode 100644 index 0000000..b0c7df0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeProjectSet.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeProjectSet.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeProjectSet.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEPROJECTSET_H +#define NODEPROJECTSET_H + +#include "nodes/execnodes.h" + +extern ProjectSetState *ExecInitProjectSet(ProjectSet *node, EState *estate, int eflags); +extern void ExecEndProjectSet(ProjectSetState *node); +extern void ExecReScanProjectSet(ProjectSetState *node); + +#endif /* NODEPROJECTSET_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeRecursiveunion.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeRecursiveunion.h new file mode 100644 index 0000000..7a5f203 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeRecursiveunion.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeRecursiveunion.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeRecursiveunion.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODERECURSIVEUNION_H +#define NODERECURSIVEUNION_H + +#include "nodes/execnodes.h" + +extern RecursiveUnionState *ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags); +extern void ExecEndRecursiveUnion(RecursiveUnionState *node); +extern void ExecReScanRecursiveUnion(RecursiveUnionState *node); + +#endif /* NODERECURSIVEUNION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeResult.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeResult.h new file mode 100644 index 0000000..575e363 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeResult.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * nodeResult.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeResult.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODERESULT_H +#define NODERESULT_H + +#include "nodes/execnodes.h" + +extern ResultState *ExecInitResult(Result *node, EState *estate, int eflags); +extern void ExecEndResult(ResultState *node); +extern void ExecResultMarkPos(ResultState *node); +extern void ExecResultRestrPos(ResultState *node); +extern void ExecReScanResult(ResultState *node); + +#endif /* NODERESULT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSamplescan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSamplescan.h new file mode 100644 index 0000000..48fa135 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSamplescan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeSamplescan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSamplescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESAMPLESCAN_H +#define NODESAMPLESCAN_H + +#include "nodes/execnodes.h" + +extern SampleScanState *ExecInitSampleScan(SampleScan *node, EState *estate, int eflags); +extern void ExecEndSampleScan(SampleScanState *node); +extern void ExecReScanSampleScan(SampleScanState *node); + +#endif /* NODESAMPLESCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSeqscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSeqscan.h new file mode 100644 index 0000000..3adad8b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSeqscan.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * nodeSeqscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSeqscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESEQSCAN_H +#define NODESEQSCAN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern SeqScanState *ExecInitSeqScan(SeqScan *node, EState *estate, int eflags); +extern void ExecEndSeqScan(SeqScanState *node); +extern void ExecReScanSeqScan(SeqScanState *node); + +/* parallel scan support */ +extern void ExecSeqScanEstimate(SeqScanState *node, ParallelContext *pcxt); +extern void ExecSeqScanInitializeDSM(SeqScanState *node, ParallelContext *pcxt); +extern void ExecSeqScanReInitializeDSM(SeqScanState *node, ParallelContext *pcxt); +extern void ExecSeqScanInitializeWorker(SeqScanState *node, + ParallelWorkerContext *pwcxt); + +#endif /* NODESEQSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSetOp.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSetOp.h new file mode 100644 index 0000000..024c6ba --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSetOp.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeSetOp.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSetOp.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESETOP_H +#define NODESETOP_H + +#include "nodes/execnodes.h" + +extern SetOpState *ExecInitSetOp(SetOp *node, EState *estate, int eflags); +extern void ExecEndSetOp(SetOpState *node); +extern void ExecReScanSetOp(SetOpState *node); + +#endif /* NODESETOP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSort.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSort.h new file mode 100644 index 0000000..f3b7f18 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSort.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * nodeSort.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSort.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESORT_H +#define NODESORT_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern SortState *ExecInitSort(Sort *node, EState *estate, int eflags); +extern void ExecEndSort(SortState *node); +extern void ExecSortMarkPos(SortState *node); +extern void ExecSortRestrPos(SortState *node); +extern void ExecReScanSort(SortState *node); + +/* parallel instrumentation support */ +extern void ExecSortEstimate(SortState *node, ParallelContext *pcxt); +extern void ExecSortInitializeDSM(SortState *node, ParallelContext *pcxt); +extern void ExecSortInitializeWorker(SortState *node, ParallelWorkerContext *pwcxt); +extern void ExecSortRetrieveInstrumentation(SortState *node); + +#endif /* NODESORT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSubplan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSubplan.h new file mode 100644 index 0000000..a1cafbc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSubplan.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * nodeSubplan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSubplan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESUBPLAN_H +#define NODESUBPLAN_H + +#include "nodes/execnodes.h" + +extern SubPlanState *ExecInitSubPlan(SubPlan *subplan, PlanState *parent); + +extern Datum ExecSubPlan(SubPlanState *node, ExprContext *econtext, bool *isNull); + +extern void ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent); + +extern void ExecSetParamPlan(SubPlanState *node, ExprContext *econtext); + +extern void ExecSetParamPlanMulti(const Bitmapset *params, ExprContext *econtext); + +#endif /* NODESUBPLAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSubqueryscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSubqueryscan.h new file mode 100644 index 0000000..8276a72 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeSubqueryscan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeSubqueryscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSubqueryscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESUBQUERYSCAN_H +#define NODESUBQUERYSCAN_H + +#include "nodes/execnodes.h" + +extern SubqueryScanState *ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags); +extern void ExecEndSubqueryScan(SubqueryScanState *node); +extern void ExecReScanSubqueryScan(SubqueryScanState *node); + +#endif /* NODESUBQUERYSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeTableFuncscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeTableFuncscan.h new file mode 100644 index 0000000..eb71a18 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeTableFuncscan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeTableFuncscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeTableFuncscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODETABLEFUNCSCAN_H +#define NODETABLEFUNCSCAN_H + +#include "nodes/execnodes.h" + +extern TableFuncScanState *ExecInitTableFuncScan(TableFuncScan *node, EState *estate, int eflags); +extern void ExecEndTableFuncScan(TableFuncScanState *node); +extern void ExecReScanTableFuncScan(TableFuncScanState *node); + +#endif /* NODETABLEFUNCSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeTidrangescan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeTidrangescan.h new file mode 100644 index 0000000..a831f12 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeTidrangescan.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * nodeTidrangescan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeTidrangescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODETIDRANGESCAN_H +#define NODETIDRANGESCAN_H + +#include "nodes/execnodes.h" + +extern TidRangeScanState *ExecInitTidRangeScan(TidRangeScan *node, + EState *estate, int eflags); +extern void ExecEndTidRangeScan(TidRangeScanState *node); +extern void ExecReScanTidRangeScan(TidRangeScanState *node); + +#endif /* NODETIDRANGESCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeTidscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeTidscan.h new file mode 100644 index 0000000..5ef5781 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeTidscan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeTidscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeTidscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODETIDSCAN_H +#define NODETIDSCAN_H + +#include "nodes/execnodes.h" + +extern TidScanState *ExecInitTidScan(TidScan *node, EState *estate, int eflags); +extern void ExecEndTidScan(TidScanState *node); +extern void ExecReScanTidScan(TidScanState *node); + +#endif /* NODETIDSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeUnique.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeUnique.h new file mode 100644 index 0000000..2964b50 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeUnique.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeUnique.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeUnique.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEUNIQUE_H +#define NODEUNIQUE_H + +#include "nodes/execnodes.h" + +extern UniqueState *ExecInitUnique(Unique *node, EState *estate, int eflags); +extern void ExecEndUnique(UniqueState *node); +extern void ExecReScanUnique(UniqueState *node); + +#endif /* NODEUNIQUE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeValuesscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeValuesscan.h new file mode 100644 index 0000000..4a09fcc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeValuesscan.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * nodeValuesscan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeValuesscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEVALUESSCAN_H +#define NODEVALUESSCAN_H + +#include "nodes/execnodes.h" + +extern ValuesScanState *ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags); +extern void ExecReScanValuesScan(ValuesScanState *node); + +#endif /* NODEVALUESSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeWindowAgg.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeWindowAgg.h new file mode 100644 index 0000000..2e96683 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeWindowAgg.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeWindowAgg.h + * prototypes for nodeWindowAgg.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeWindowAgg.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEWINDOWAGG_H +#define NODEWINDOWAGG_H + +#include "nodes/execnodes.h" + +extern WindowAggState *ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags); +extern void ExecEndWindowAgg(WindowAggState *node); +extern void ExecReScanWindowAgg(WindowAggState *node); + +#endif /* NODEWINDOWAGG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeWorktablescan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeWorktablescan.h new file mode 100644 index 0000000..f21e652 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/nodeWorktablescan.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * nodeWorktablescan.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeWorktablescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEWORKTABLESCAN_H +#define NODEWORKTABLESCAN_H + +#include "nodes/execnodes.h" + +extern WorkTableScanState *ExecInitWorkTableScan(WorkTableScan *node, EState *estate, int eflags); +extern void ExecReScanWorkTableScan(WorkTableScanState *node); + +#endif /* NODEWORKTABLESCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/spi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/spi.h new file mode 100644 index 0000000..d064d1a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/spi.h @@ -0,0 +1,207 @@ +/*------------------------------------------------------------------------- + * + * spi.h + * Server Programming Interface public declarations + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/spi.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPI_H +#define SPI_H + +#include "commands/trigger.h" +#include "lib/ilist.h" +#include "parser/parser.h" +#include "utils/portal.h" + + +typedef struct SPITupleTable +{ + /* Public members */ + TupleDesc tupdesc; /* tuple descriptor */ + HeapTuple *vals; /* array of tuples */ + uint64 numvals; /* number of valid tuples */ + + /* Private members, not intended for external callers */ + uint64 alloced; /* allocated length of vals array */ + MemoryContext tuptabcxt; /* memory context of result table */ + slist_node next; /* link for internal bookkeeping */ + SubTransactionId subid; /* subxact in which tuptable was created */ +} SPITupleTable; + +/* Optional arguments for SPI_prepare_extended */ +typedef struct SPIPrepareOptions +{ + ParserSetupHook parserSetup; + void *parserSetupArg; + RawParseMode parseMode; + int cursorOptions; +} SPIPrepareOptions; + +/* Optional arguments for SPI_execute[_plan]_extended */ +typedef struct SPIExecuteOptions +{ + ParamListInfo params; + bool read_only; + bool allow_nonatomic; + bool must_return_tuples; + uint64 tcount; + DestReceiver *dest; + ResourceOwner owner; +} SPIExecuteOptions; + +/* Optional arguments for SPI_cursor_parse_open */ +typedef struct SPIParseOpenOptions +{ + ParamListInfo params; + int cursorOptions; + bool read_only; +} SPIParseOpenOptions; + +/* Plans are opaque structs for standard users of SPI */ +typedef struct _SPI_plan *SPIPlanPtr; + +#define SPI_ERROR_CONNECT (-1) +#define SPI_ERROR_COPY (-2) +#define SPI_ERROR_OPUNKNOWN (-3) +#define SPI_ERROR_UNCONNECTED (-4) +#define SPI_ERROR_CURSOR (-5) /* not used anymore */ +#define SPI_ERROR_ARGUMENT (-6) +#define SPI_ERROR_PARAM (-7) +#define SPI_ERROR_TRANSACTION (-8) +#define SPI_ERROR_NOATTRIBUTE (-9) +#define SPI_ERROR_NOOUTFUNC (-10) +#define SPI_ERROR_TYPUNKNOWN (-11) +#define SPI_ERROR_REL_DUPLICATE (-12) +#define SPI_ERROR_REL_NOT_FOUND (-13) + +#define SPI_OK_CONNECT 1 +#define SPI_OK_FINISH 2 +#define SPI_OK_FETCH 3 +#define SPI_OK_UTILITY 4 +#define SPI_OK_SELECT 5 +#define SPI_OK_SELINTO 6 +#define SPI_OK_INSERT 7 +#define SPI_OK_DELETE 8 +#define SPI_OK_UPDATE 9 +#define SPI_OK_CURSOR 10 +#define SPI_OK_INSERT_RETURNING 11 +#define SPI_OK_DELETE_RETURNING 12 +#define SPI_OK_UPDATE_RETURNING 13 +#define SPI_OK_REWRITTEN 14 +#define SPI_OK_REL_REGISTER 15 +#define SPI_OK_REL_UNREGISTER 16 +#define SPI_OK_TD_REGISTER 17 +#define SPI_OK_MERGE 18 +#define SPI_OK_MERGE_RETURNING 19 + +#define SPI_OPT_NONATOMIC (1 << 0) + +extern PGDLLIMPORT uint64 SPI_processed; +extern PGDLLIMPORT SPITupleTable *SPI_tuptable; +extern PGDLLIMPORT int SPI_result; + +extern int SPI_connect(void); +extern int SPI_connect_ext(int options); +extern int SPI_finish(void); +extern int SPI_execute(const char *src, bool read_only, long tcount); +extern int SPI_execute_extended(const char *src, + const SPIExecuteOptions *options); +extern int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls, + bool read_only, long tcount); +extern int SPI_execute_plan_extended(SPIPlanPtr plan, + const SPIExecuteOptions *options); +extern int SPI_execute_plan_with_paramlist(SPIPlanPtr plan, + ParamListInfo params, + bool read_only, long tcount); +extern int SPI_exec(const char *src, long tcount); +extern int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls, + long tcount); +extern int SPI_execute_snapshot(SPIPlanPtr plan, + Datum *Values, const char *Nulls, + Snapshot snapshot, + Snapshot crosscheck_snapshot, + bool read_only, bool fire_triggers, long tcount); +extern int SPI_execute_with_args(const char *src, + int nargs, Oid *argtypes, + Datum *Values, const char *Nulls, + bool read_only, long tcount); +extern SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes); +extern SPIPlanPtr SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes, + int cursorOptions); +extern SPIPlanPtr SPI_prepare_extended(const char *src, + const SPIPrepareOptions *options); +extern SPIPlanPtr SPI_prepare_params(const char *src, + ParserSetupHook parserSetup, + void *parserSetupArg, + int cursorOptions); +extern int SPI_keepplan(SPIPlanPtr plan); +extern SPIPlanPtr SPI_saveplan(SPIPlanPtr plan); +extern int SPI_freeplan(SPIPlanPtr plan); + +extern Oid SPI_getargtypeid(SPIPlanPtr plan, int argIndex); +extern int SPI_getargcount(SPIPlanPtr plan); +extern bool SPI_is_cursor_plan(SPIPlanPtr plan); +extern bool SPI_plan_is_valid(SPIPlanPtr plan); +extern const char *SPI_result_code_string(int code); + +extern List *SPI_plan_get_plan_sources(SPIPlanPtr plan); +extern CachedPlan *SPI_plan_get_cached_plan(SPIPlanPtr plan); + +extern HeapTuple SPI_copytuple(HeapTuple tuple); +extern HeapTupleHeader SPI_returntuple(HeapTuple tuple, TupleDesc tupdesc); +extern HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, + int *attnum, Datum *Values, const char *Nulls); +extern int SPI_fnumber(TupleDesc tupdesc, const char *fname); +extern char *SPI_fname(TupleDesc tupdesc, int fnumber); +extern char *SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber); +extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull); +extern char *SPI_gettype(TupleDesc tupdesc, int fnumber); +extern Oid SPI_gettypeid(TupleDesc tupdesc, int fnumber); +extern char *SPI_getrelname(Relation rel); +extern char *SPI_getnspname(Relation rel); +extern void *SPI_palloc(Size size); +extern void *SPI_repalloc(void *pointer, Size size); +extern void SPI_pfree(void *pointer); +extern Datum SPI_datumTransfer(Datum value, bool typByVal, int typLen); +extern void SPI_freetuple(HeapTuple tuple); +extern void SPI_freetuptable(SPITupleTable *tuptable); + +extern Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, + Datum *Values, const char *Nulls, bool read_only); +extern Portal SPI_cursor_open_with_args(const char *name, + const char *src, + int nargs, Oid *argtypes, + Datum *Values, const char *Nulls, + bool read_only, int cursorOptions); +extern Portal SPI_cursor_open_with_paramlist(const char *name, SPIPlanPtr plan, + ParamListInfo params, bool read_only); +extern Portal SPI_cursor_parse_open(const char *name, + const char *src, + const SPIParseOpenOptions *options); +extern Portal SPI_cursor_find(const char *name); +extern void SPI_cursor_fetch(Portal portal, bool forward, long count); +extern void SPI_cursor_move(Portal portal, bool forward, long count); +extern void SPI_scroll_cursor_fetch(Portal, FetchDirection direction, long count); +extern void SPI_scroll_cursor_move(Portal, FetchDirection direction, long count); +extern void SPI_cursor_close(Portal portal); + +extern int SPI_register_relation(EphemeralNamedRelation enr); +extern int SPI_unregister_relation(const char *name); +extern int SPI_register_trigger_data(TriggerData *tdata); + +extern void SPI_start_transaction(void); +extern void SPI_commit(void); +extern void SPI_commit_and_chain(void); +extern void SPI_rollback(void); +extern void SPI_rollback_and_chain(void); + +extern void AtEOXact_SPI(bool isCommit); +extern void AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid); +extern bool SPI_inside_nonatomic_context(void); + +#endif /* SPI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/spi_priv.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/spi_priv.h new file mode 100644 index 0000000..cc6688d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/spi_priv.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * spi_priv.h + * Server Programming Interface private declarations + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/spi_priv.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPI_PRIV_H +#define SPI_PRIV_H + +#include "executor/spi.h" +#include "utils/queryenvironment.h" + + +#define _SPI_PLAN_MAGIC 569278163 + +typedef struct +{ + /* current results */ + uint64 processed; /* by Executor */ + SPITupleTable *tuptable; /* tuptable currently being built */ + + /* subtransaction in which current Executor call was started */ + SubTransactionId execSubid; + + /* resources of this execution context */ + slist_head tuptables; /* list of all live SPITupleTables */ + MemoryContext procCxt; /* procedure context */ + MemoryContext execCxt; /* executor context */ + MemoryContext savedcxt; /* context of SPI_connect's caller */ + SubTransactionId connectSubid; /* ID of connecting subtransaction */ + QueryEnvironment *queryEnv; /* query environment setup for SPI level */ + + /* transaction management support */ + bool atomic; /* atomic execution context, does not allow + * transactions */ + bool internal_xact; /* SPI-managed transaction boundary, skip + * cleanup */ + + /* saved values of API global variables for previous nesting level */ + uint64 outer_processed; + SPITupleTable *outer_tuptable; + int outer_result; +} _SPI_connection; + +/* + * SPI plans have three states: saved, unsaved, or temporary. + * + * Ordinarily, the _SPI_plan struct itself as well as the argtypes array + * are in a dedicated memory context identified by plancxt (which can be + * really small). All the other subsidiary state is in plancache entries + * identified by plancache_list (note: the list cells themselves are in + * plancxt). + * + * In an unsaved plan, the plancxt as well as the plancache entries' contexts + * are children of the SPI procedure context, so they'll all disappear at + * function exit. plancache.c also knows that the plancache entries are + * "unsaved", so it doesn't link them into its global list; hence they do + * not respond to inval events. This is OK since we are presumably holding + * adequate locks to prevent other backends from messing with the tables. + * + * For a saved plan, the plancxt is made a child of CacheMemoryContext + * since it should persist until explicitly destroyed. Likewise, the + * plancache entries will be under CacheMemoryContext since we tell + * plancache.c to save them. We rely on plancache.c to keep the cache + * entries up-to-date as needed in the face of invalidation events. + * + * There are also "temporary" SPI plans, in which the _SPI_plan struct is + * not even palloc'd but just exists in some function's local variable. + * The plancache entries are unsaved and exist under the SPI executor context, + * while additional data such as argtypes and list cells is loose in the SPI + * executor context. Such plans can be identified by having plancxt == NULL. + * + * We can also have "one-shot" SPI plans (which are typically temporary, + * as described above). These are meant to be executed once and discarded, + * and various optimizations are made on the assumption of single use. + * Note in particular that the CachedPlanSources within such an SPI plan + * are not "complete" until execution. + * + * Note: if the original query string contained only whitespace and comments, + * the plancache_list will be NIL and so there is no place to store the + * query string. We don't care about that, but we do care about the + * argument type array, which is why it's seemingly-redundantly stored. + */ +typedef struct _SPI_plan +{ + int magic; /* should equal _SPI_PLAN_MAGIC */ + bool saved; /* saved or unsaved plan? */ + bool oneshot; /* one-shot plan? */ + List *plancache_list; /* one CachedPlanSource per parsetree */ + MemoryContext plancxt; /* Context containing _SPI_plan and data */ + RawParseMode parse_mode; /* raw_parser() mode */ + int cursor_options; /* Cursor options used for planning */ + int nargs; /* number of plan arguments */ + Oid *argtypes; /* Argument types (NULL if nargs is 0) */ + ParserSetupHook parserSetup; /* alternative parameter spec method */ + void *parserSetupArg; +} _SPI_plan; + +#endif /* SPI_PRIV_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tablefunc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tablefunc.h new file mode 100644 index 0000000..2c4498c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tablefunc.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * tablefunc.h + * interface for TableFunc executor node + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/tablefunc.h + * + *------------------------------------------------------------------------- + */ +#ifndef _TABLEFUNC_H +#define _TABLEFUNC_H + +/* Forward-declare this to avoid including execnodes.h here */ +struct TableFuncScanState; + +/* + * TableFuncRoutine holds function pointers used for generating content of + * table-producer functions, such as XMLTABLE. + * + * InitOpaque initializes table builder private objects. The output tuple + * descriptor, input functions for the columns, and typioparams are passed + * from executor state. + * + * SetDocument is called to define the input document. The table builder may + * apply additional transformations not exposed outside the table builder + * context. + * + * SetNamespace is called to pass namespace declarations from the table + * expression. This function may be NULL if namespaces are not supported by + * the table builder. Namespaces must be given before setting the row and + * column filters. If the name is given as NULL, the entry shall be for the + * default namespace. + * + * SetRowFilter is called do define the row-generating filter, which shall be + * used to extract each row from the input document. + * + * SetColumnFilter is called once for each column, to define the column- + * generating filter for the given column. + * + * FetchRow shall be called repeatedly until it returns that no more rows are + * found in the document. On each invocation it shall set state in the table + * builder context such that each subsequent GetValue call returns the values + * for the indicated column for the row being processed. + * + * DestroyOpaque shall release all resources associated with a table builder + * context. It may be called either because all rows have been consumed, or + * because an error occurred while processing the table expression. + */ +typedef struct TableFuncRoutine +{ + void (*InitOpaque) (struct TableFuncScanState *state, int natts); + void (*SetDocument) (struct TableFuncScanState *state, Datum value); + void (*SetNamespace) (struct TableFuncScanState *state, const char *name, + const char *uri); + void (*SetRowFilter) (struct TableFuncScanState *state, const char *path); + void (*SetColumnFilter) (struct TableFuncScanState *state, + const char *path, int colnum); + bool (*FetchRow) (struct TableFuncScanState *state); + Datum (*GetValue) (struct TableFuncScanState *state, int colnum, + Oid typid, int32 typmod, bool *isnull); + void (*DestroyOpaque) (struct TableFuncScanState *state); +} TableFuncRoutine; + +#endif /* _TABLEFUNC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tqueue.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tqueue.h new file mode 100644 index 0000000..57d68a4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tqueue.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * tqueue.h + * Use shm_mq to send & receive tuples between parallel backends + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/tqueue.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TQUEUE_H +#define TQUEUE_H + +#include "storage/shm_mq.h" +#include "tcop/dest.h" + +/* Opaque struct, only known inside tqueue.c. */ +typedef struct TupleQueueReader TupleQueueReader; + +/* Use this to send tuples to a shm_mq. */ +extern DestReceiver *CreateTupleQueueDestReceiver(shm_mq_handle *handle); + +/* Use these to receive tuples from a shm_mq. */ +extern TupleQueueReader *CreateTupleQueueReader(shm_mq_handle *handle); +extern void DestroyTupleQueueReader(TupleQueueReader *reader); +extern MinimalTuple TupleQueueReaderNext(TupleQueueReader *reader, + bool nowait, bool *done); + +#endif /* TQUEUE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tstoreReceiver.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tstoreReceiver.h new file mode 100644 index 0000000..11feca7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tstoreReceiver.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * tstoreReceiver.h + * prototypes for tstoreReceiver.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/tstoreReceiver.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TSTORE_RECEIVER_H +#define TSTORE_RECEIVER_H + +#include "tcop/dest.h" +#include "utils/tuplestore.h" + + +extern DestReceiver *CreateTuplestoreDestReceiver(void); + +extern void SetTuplestoreDestReceiverParams(DestReceiver *self, + Tuplestorestate *tStore, + MemoryContext tContext, + bool detoast, + TupleDesc target_tupdesc, + const char *map_failure_msg); + +#endif /* TSTORE_RECEIVER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tuptable.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tuptable.h new file mode 100644 index 0000000..095e4cc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/executor/tuptable.h @@ -0,0 +1,539 @@ +/*------------------------------------------------------------------------- + * + * tuptable.h + * tuple table support stuff + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/tuptable.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPTABLE_H +#define TUPTABLE_H + +#include "access/htup.h" +#include "access/htup_details.h" +#include "access/sysattr.h" +#include "access/tupdesc.h" +#include "storage/buf.h" + +/*---------- + * The executor stores tuples in a "tuple table" which is a List of + * independent TupleTableSlots. + * + * There's various different types of tuple table slots, each being able to + * store different types of tuples. Additional types of slots can be added + * without modifying core code. The type of a slot is determined by the + * TupleTableSlotOps* passed to the slot creation routine. The builtin types + * of slots are + * + * 1. physical tuple in a disk buffer page (TTSOpsBufferHeapTuple) + * 2. physical tuple constructed in palloc'ed memory (TTSOpsHeapTuple) + * 3. "minimal" physical tuple constructed in palloc'ed memory + * (TTSOpsMinimalTuple) + * 4. "virtual" tuple consisting of Datum/isnull arrays (TTSOpsVirtual) + * + * + * The first two cases are similar in that they both deal with "materialized" + * tuples, but resource management is different. For a tuple in a disk page + * we need to hold a pin on the buffer until the TupleTableSlot's reference + * to the tuple is dropped; while for a palloc'd tuple we usually want the + * tuple pfree'd when the TupleTableSlot's reference is dropped. + * + * A "minimal" tuple is handled similarly to a palloc'd regular tuple. + * At present, minimal tuples never are stored in buffers, so there is no + * parallel to case 1. Note that a minimal tuple has no "system columns". + * + * A "virtual" tuple is an optimization used to minimize physical data copying + * in a nest of plan nodes. Until materialized pass-by-reference Datums in + * the slot point to storage that is not directly associated with the + * TupleTableSlot; generally they will point to part of a tuple stored in a + * lower plan node's output TupleTableSlot, or to a function result + * constructed in a plan node's per-tuple econtext. It is the responsibility + * of the generating plan node to be sure these resources are not released for + * as long as the virtual tuple needs to be valid or is materialized. Note + * also that a virtual tuple does not have any "system columns". + * + * The Datum/isnull arrays of a TupleTableSlot serve double duty. For virtual + * slots they are the authoritative data. For the other builtin slots, + * the arrays contain data extracted from the tuple. (In this state, any + * pass-by-reference Datums point into the physical tuple.) The extracted + * information is built "lazily", ie, only as needed. This serves to avoid + * repeated extraction of data from the physical tuple. + * + * A TupleTableSlot can also be "empty", indicated by flag TTS_FLAG_EMPTY set + * in tts_flags, holding no valid data. This is the only valid state for a + * freshly-created slot that has not yet had a tuple descriptor assigned to + * it. In this state, TTS_FLAG_SHOULDFREE should not be set in tts_flags and + * tts_nvalid should be set to zero. + * + * The tupleDescriptor is simply referenced, not copied, by the TupleTableSlot + * code. The caller of ExecSetSlotDescriptor() is responsible for providing + * a descriptor that will live as long as the slot does. (Typically, both + * slots and descriptors are in per-query memory and are freed by memory + * context deallocation at query end; so it's not worth providing any extra + * mechanism to do more. However, the slot will increment the tupdesc + * reference count if a reference-counted tupdesc is supplied.) + * + * When TTS_FLAG_SHOULDFREE is set in tts_flags, the physical tuple is "owned" + * by the slot and should be freed when the slot's reference to the tuple is + * dropped. + * + * tts_values/tts_isnull are allocated either when the slot is created (when + * the descriptor is provided), or when a descriptor is assigned to the slot; + * they are of length equal to the descriptor's natts. + * + * The TTS_FLAG_SLOW flag is saved state for + * slot_deform_heap_tuple, and should not be touched by any other code. + *---------- + */ + +/* true = slot is empty */ +#define TTS_FLAG_EMPTY (1 << 1) +#define TTS_EMPTY(slot) (((slot)->tts_flags & TTS_FLAG_EMPTY) != 0) + +/* should pfree tuple "owned" by the slot? */ +#define TTS_FLAG_SHOULDFREE (1 << 2) +#define TTS_SHOULDFREE(slot) (((slot)->tts_flags & TTS_FLAG_SHOULDFREE) != 0) + +/* saved state for slot_deform_heap_tuple */ +#define TTS_FLAG_SLOW (1 << 3) +#define TTS_SLOW(slot) (((slot)->tts_flags & TTS_FLAG_SLOW) != 0) + +/* fixed tuple descriptor */ +#define TTS_FLAG_FIXED (1 << 4) +#define TTS_FIXED(slot) (((slot)->tts_flags & TTS_FLAG_FIXED) != 0) + +struct TupleTableSlotOps; +typedef struct TupleTableSlotOps TupleTableSlotOps; + +/* base tuple table slot type */ +typedef struct TupleTableSlot +{ + NodeTag type; +#define FIELDNO_TUPLETABLESLOT_FLAGS 1 + uint16 tts_flags; /* Boolean states */ +#define FIELDNO_TUPLETABLESLOT_NVALID 2 + AttrNumber tts_nvalid; /* # of valid values in tts_values */ + const TupleTableSlotOps *const tts_ops; /* implementation of slot */ +#define FIELDNO_TUPLETABLESLOT_TUPLEDESCRIPTOR 4 + TupleDesc tts_tupleDescriptor; /* slot's tuple descriptor */ +#define FIELDNO_TUPLETABLESLOT_VALUES 5 + Datum *tts_values; /* current per-attribute values */ +#define FIELDNO_TUPLETABLESLOT_ISNULL 6 + bool *tts_isnull; /* current per-attribute isnull flags */ + MemoryContext tts_mcxt; /* slot itself is in this context */ + ItemPointerData tts_tid; /* stored tuple's tid */ + Oid tts_tableOid; /* table oid of tuple */ +} TupleTableSlot; + +/* routines for a TupleTableSlot implementation */ +struct TupleTableSlotOps +{ + /* Minimum size of the slot */ + size_t base_slot_size; + + /* Initialization. */ + void (*init) (TupleTableSlot *slot); + + /* Destruction. */ + void (*release) (TupleTableSlot *slot); + + /* + * Clear the contents of the slot. Only the contents are expected to be + * cleared and not the tuple descriptor. Typically an implementation of + * this callback should free the memory allocated for the tuple contained + * in the slot. + */ + void (*clear) (TupleTableSlot *slot); + + /* + * Fill up first natts entries of tts_values and tts_isnull arrays with + * values from the tuple contained in the slot. The function may be called + * with natts more than the number of attributes available in the tuple, + * in which case it should set tts_nvalid to the number of returned + * columns. + */ + void (*getsomeattrs) (TupleTableSlot *slot, int natts); + + /* + * Returns value of the given system attribute as a datum and sets isnull + * to false, if it's not NULL. Throws an error if the slot type does not + * support system attributes. + */ + Datum (*getsysattr) (TupleTableSlot *slot, int attnum, bool *isnull); + + /* + * Check if the tuple is created by the current transaction. Throws an + * error if the slot doesn't contain the storage tuple. + */ + bool (*is_current_xact_tuple) (TupleTableSlot *slot); + + /* + * Make the contents of the slot solely depend on the slot, and not on + * underlying resources (like another memory context, buffers, etc). + */ + void (*materialize) (TupleTableSlot *slot); + + /* + * Copy the contents of the source slot into the destination slot's own + * context. Invoked using callback of the destination slot. 'dstslot' and + * 'srcslot' can be assumed to have the same number of attributes. + */ + void (*copyslot) (TupleTableSlot *dstslot, TupleTableSlot *srcslot); + + /* + * Return a heap tuple "owned" by the slot. It is slot's responsibility to + * free the memory consumed by the heap tuple. If the slot can not "own" a + * heap tuple, it should not implement this callback and should set it as + * NULL. + */ + HeapTuple (*get_heap_tuple) (TupleTableSlot *slot); + + /* + * Return a minimal tuple "owned" by the slot. It is slot's responsibility + * to free the memory consumed by the minimal tuple. If the slot can not + * "own" a minimal tuple, it should not implement this callback and should + * set it as NULL. + */ + MinimalTuple (*get_minimal_tuple) (TupleTableSlot *slot); + + /* + * Return a copy of heap tuple representing the contents of the slot. The + * copy needs to be palloc'd in the current memory context. The slot + * itself is expected to remain unaffected. It is *not* expected to have + * meaningful "system columns" in the copy. The copy is not be "owned" by + * the slot i.e. the caller has to take responsibility to free memory + * consumed by the slot. + */ + HeapTuple (*copy_heap_tuple) (TupleTableSlot *slot); + + /* + * Return a copy of minimal tuple representing the contents of the slot. + * The copy needs to be palloc'd in the current memory context. The slot + * itself is expected to remain unaffected. It is *not* expected to have + * meaningful "system columns" in the copy. The copy is not be "owned" by + * the slot i.e. the caller has to take responsibility to free memory + * consumed by the slot. + * + * The copy has "extra" bytes (maxaligned and zeroed) available before the + * tuple, which is useful so that some callers may store extra data along + * with the minimal tuple without the need for an additional allocation. + */ + MinimalTuple (*copy_minimal_tuple) (TupleTableSlot *slot, Size extra); +}; + +/* + * Predefined TupleTableSlotOps for various types of TupleTableSlotOps. The + * same are used to identify the type of a given slot. + */ +extern PGDLLIMPORT const TupleTableSlotOps TTSOpsVirtual; +extern PGDLLIMPORT const TupleTableSlotOps TTSOpsHeapTuple; +extern PGDLLIMPORT const TupleTableSlotOps TTSOpsMinimalTuple; +extern PGDLLIMPORT const TupleTableSlotOps TTSOpsBufferHeapTuple; + +#define TTS_IS_VIRTUAL(slot) ((slot)->tts_ops == &TTSOpsVirtual) +#define TTS_IS_HEAPTUPLE(slot) ((slot)->tts_ops == &TTSOpsHeapTuple) +#define TTS_IS_MINIMALTUPLE(slot) ((slot)->tts_ops == &TTSOpsMinimalTuple) +#define TTS_IS_BUFFERTUPLE(slot) ((slot)->tts_ops == &TTSOpsBufferHeapTuple) + + +/* + * Tuple table slot implementations. + */ + +typedef struct VirtualTupleTableSlot +{ + pg_node_attr(abstract) + + TupleTableSlot base; + + char *data; /* data for materialized slots */ +} VirtualTupleTableSlot; + +typedef struct HeapTupleTableSlot +{ + pg_node_attr(abstract) + + TupleTableSlot base; + +#define FIELDNO_HEAPTUPLETABLESLOT_TUPLE 1 + HeapTuple tuple; /* physical tuple */ +#define FIELDNO_HEAPTUPLETABLESLOT_OFF 2 + uint32 off; /* saved state for slot_deform_heap_tuple */ + HeapTupleData tupdata; /* optional workspace for storing tuple */ +} HeapTupleTableSlot; + +/* heap tuple residing in a buffer */ +typedef struct BufferHeapTupleTableSlot +{ + pg_node_attr(abstract) + + HeapTupleTableSlot base; + + /* + * If buffer is not InvalidBuffer, then the slot is holding a pin on the + * indicated buffer page; drop the pin when we release the slot's + * reference to that buffer. (TTS_FLAG_SHOULDFREE should not be set in + * such a case, since presumably base.tuple is pointing into the buffer.) + */ + Buffer buffer; /* tuple's buffer, or InvalidBuffer */ +} BufferHeapTupleTableSlot; + +typedef struct MinimalTupleTableSlot +{ + pg_node_attr(abstract) + + TupleTableSlot base; + + /* + * In a minimal slot tuple points at minhdr and the fields of that struct + * are set correctly for access to the minimal tuple; in particular, + * minhdr.t_data points MINIMAL_TUPLE_OFFSET bytes before mintuple. This + * allows column extraction to treat the case identically to regular + * physical tuples. + */ +#define FIELDNO_MINIMALTUPLETABLESLOT_TUPLE 1 + HeapTuple tuple; /* tuple wrapper */ + MinimalTuple mintuple; /* minimal tuple, or NULL if none */ + HeapTupleData minhdr; /* workspace for minimal-tuple-only case */ +#define FIELDNO_MINIMALTUPLETABLESLOT_OFF 4 + uint32 off; /* saved state for slot_deform_heap_tuple */ +} MinimalTupleTableSlot; + +/* + * TupIsNull -- is a TupleTableSlot empty? + */ +#define TupIsNull(slot) \ + ((slot) == NULL || TTS_EMPTY(slot)) + +/* in executor/execTuples.c */ +extern TupleTableSlot *MakeTupleTableSlot(TupleDesc tupleDesc, + const TupleTableSlotOps *tts_ops); +extern TupleTableSlot *ExecAllocTableSlot(List **tupleTable, TupleDesc desc, + const TupleTableSlotOps *tts_ops); +extern void ExecResetTupleTable(List *tupleTable, bool shouldFree); +extern TupleTableSlot *MakeSingleTupleTableSlot(TupleDesc tupdesc, + const TupleTableSlotOps *tts_ops); +extern void ExecDropSingleTupleTableSlot(TupleTableSlot *slot); +extern void ExecSetSlotDescriptor(TupleTableSlot *slot, TupleDesc tupdesc); +extern TupleTableSlot *ExecStoreHeapTuple(HeapTuple tuple, + TupleTableSlot *slot, + bool shouldFree); +extern void ExecForceStoreHeapTuple(HeapTuple tuple, + TupleTableSlot *slot, + bool shouldFree); +extern TupleTableSlot *ExecStoreBufferHeapTuple(HeapTuple tuple, + TupleTableSlot *slot, + Buffer buffer); +extern TupleTableSlot *ExecStorePinnedBufferHeapTuple(HeapTuple tuple, + TupleTableSlot *slot, + Buffer buffer); +extern TupleTableSlot *ExecStoreMinimalTuple(MinimalTuple mtup, + TupleTableSlot *slot, + bool shouldFree); +extern void ExecForceStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, + bool shouldFree); +extern TupleTableSlot *ExecStoreVirtualTuple(TupleTableSlot *slot); +extern TupleTableSlot *ExecStoreAllNullTuple(TupleTableSlot *slot); +extern void ExecStoreHeapTupleDatum(Datum data, TupleTableSlot *slot); +extern HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree); +extern MinimalTuple ExecFetchSlotMinimalTuple(TupleTableSlot *slot, + bool *shouldFree); +extern Datum ExecFetchSlotHeapTupleDatum(TupleTableSlot *slot); +extern void slot_getmissingattrs(TupleTableSlot *slot, int startAttNum, + int lastAttNum); +extern void slot_getsomeattrs_int(TupleTableSlot *slot, int attnum); + + +#ifndef FRONTEND + +/* + * This function forces the entries of the slot's Datum/isnull arrays to be + * valid at least up through the attnum'th entry. + */ +static inline void +slot_getsomeattrs(TupleTableSlot *slot, int attnum) +{ + if (slot->tts_nvalid < attnum) + slot_getsomeattrs_int(slot, attnum); +} + +/* + * slot_getallattrs + * This function forces all the entries of the slot's Datum/isnull + * arrays to be valid. The caller may then extract data directly + * from those arrays instead of using slot_getattr. + */ +static inline void +slot_getallattrs(TupleTableSlot *slot) +{ + slot_getsomeattrs(slot, slot->tts_tupleDescriptor->natts); +} + + +/* + * slot_attisnull + * + * Detect whether an attribute of the slot is null, without actually fetching + * it. + */ +static inline bool +slot_attisnull(TupleTableSlot *slot, int attnum) +{ + Assert(attnum > 0); + + if (attnum > slot->tts_nvalid) + slot_getsomeattrs(slot, attnum); + + return slot->tts_isnull[attnum - 1]; +} + +/* + * slot_getattr - fetch one attribute of the slot's contents. + */ +static inline Datum +slot_getattr(TupleTableSlot *slot, int attnum, + bool *isnull) +{ + Assert(attnum > 0); + + if (attnum > slot->tts_nvalid) + slot_getsomeattrs(slot, attnum); + + *isnull = slot->tts_isnull[attnum - 1]; + + return slot->tts_values[attnum - 1]; +} + +/* + * slot_getsysattr - fetch a system attribute of the slot's current tuple. + * + * If the slot type does not contain system attributes, this will throw an + * error. Hence before calling this function, callers should make sure that + * the slot type is the one that supports system attributes. + */ +static inline Datum +slot_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull) +{ + Assert(attnum < 0); /* caller error */ + + if (attnum == TableOidAttributeNumber) + { + *isnull = false; + return ObjectIdGetDatum(slot->tts_tableOid); + } + else if (attnum == SelfItemPointerAttributeNumber) + { + *isnull = false; + return PointerGetDatum(&slot->tts_tid); + } + + /* Fetch the system attribute from the underlying tuple. */ + return slot->tts_ops->getsysattr(slot, attnum, isnull); +} + +/* + * slot_is_current_xact_tuple - check if the slot's current tuple is created + * by the current transaction. + * + * If the slot does not contain a storage tuple, this will throw an error. + * Hence before calling this function, callers should make sure that the + * slot type supports storage tuples and that there is currently one inside + * the slot. + */ +static inline bool +slot_is_current_xact_tuple(TupleTableSlot *slot) +{ + return slot->tts_ops->is_current_xact_tuple(slot); +} + +/* + * ExecClearTuple - clear the slot's contents + */ +static inline TupleTableSlot * +ExecClearTuple(TupleTableSlot *slot) +{ + slot->tts_ops->clear(slot); + + return slot; +} + +/* ExecMaterializeSlot - force a slot into the "materialized" state. + * + * This causes the slot's tuple to be a local copy not dependent on any + * external storage (i.e. pointing into a Buffer, or having allocations in + * another memory context). + * + * A typical use for this operation is to prepare a computed tuple for being + * stored on disk. The original data may or may not be virtual, but in any + * case we need a private copy for heap_insert to scribble on. + */ +static inline void +ExecMaterializeSlot(TupleTableSlot *slot) +{ + slot->tts_ops->materialize(slot); +} + +/* + * ExecCopySlotHeapTuple - return HeapTuple allocated in caller's context + */ +static inline HeapTuple +ExecCopySlotHeapTuple(TupleTableSlot *slot) +{ + Assert(!TTS_EMPTY(slot)); + + return slot->tts_ops->copy_heap_tuple(slot); +} + +/* + * ExecCopySlotMinimalTuple - return MinimalTuple allocated in caller's context + */ +static inline MinimalTuple +ExecCopySlotMinimalTuple(TupleTableSlot *slot) +{ + return slot->tts_ops->copy_minimal_tuple(slot, 0); +} + +/* + * ExecCopySlotMinimalTupleExtra - return MinimalTuple allocated in caller's + * context, with extra bytes (maxaligned and zeroed) before the tuple for data + * the caller wishes to store along with the tuple (without requiring the + * caller to make an additional allocation). + */ +static inline MinimalTuple +ExecCopySlotMinimalTupleExtra(TupleTableSlot *slot, Size extra) +{ + return slot->tts_ops->copy_minimal_tuple(slot, extra); +} + +/* + * ExecCopySlot - copy one slot's contents into another. + * + * If a source's system attributes are supposed to be accessed in the target + * slot, the target slot and source slot types need to match. + * + * Currently, 'dstslot' and 'srcslot' must have the same number of attributes. + * Future work could see this relaxed to allow the source to contain + * additional attributes and have the code here only copy over the leading + * attributes. + */ +static inline TupleTableSlot * +ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot) +{ + Assert(!TTS_EMPTY(srcslot)); + Assert(srcslot != dstslot); + Assert(dstslot->tts_tupleDescriptor->natts == + srcslot->tts_tupleDescriptor->natts); + + dstslot->tts_ops->copyslot(dstslot, srcslot); + + return dstslot; +} + +#endif /* FRONTEND */ + +#endif /* TUPTABLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/archive.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/archive.h new file mode 100644 index 0000000..bd744c3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/archive.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * archive.h + * Routines to access WAL archives from frontend + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/archive.h + * + *------------------------------------------------------------------------- + */ +#ifndef FE_ARCHIVE_H +#define FE_ARCHIVE_H + +extern int RestoreArchivedFile(const char *path, + const char *xlogfname, + off_t expectedSize, + const char *restoreCommand); + +#endif /* FE_ARCHIVE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/astreamer.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/astreamer.h new file mode 100644 index 0000000..0e00317 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/astreamer.h @@ -0,0 +1,229 @@ +/*------------------------------------------------------------------------- + * + * astreamer.h + * + * The "archive streamer" interface is intended to allow frontend code + * to stream from possibly-compressed archive files from any source and + * perform arbitrary actions based on the contents of those archives. + * Archive streamers are intended to be composable, and most tasks will + * require two or more archive streamers to complete. For instance, + * if the input is an uncompressed tar stream, a tar parser astreamer + * could be used to interpret it, and then an extractor astreamer could + * be used to write each archive member out to a file. + * + * In general, each archive streamer is relatively free to take whatever + * action it desires in the stream of chunks provided by the caller. It + * may do something simple, like write the archive to a file, perhaps after + * compressing it, but it can also do more complicated things, like + * annotating the byte stream to indicate which parts of the data + * correspond to tar headers or trailing padding, vs. which parts are + * payload data. A subsequent astreamer may use this information to + * make further decisions about how to process the data; for example, + * it might choose to modify the archive contents. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/fe_utils/astreamer.h + *------------------------------------------------------------------------- + */ + +#ifndef ASTREAMER_H +#define ASTREAMER_H + +#include "common/compression.h" +#include "lib/stringinfo.h" +#include "pqexpbuffer.h" + +struct astreamer; +struct astreamer_ops; +typedef struct astreamer astreamer; +typedef struct astreamer_ops astreamer_ops; + +/* + * Each chunk of archive data passed to a astreamer is classified into one + * of these categories. When data is initially passed to an archive streamer, + * each chunk will be categorized as ASTREAMER_UNKNOWN, and the chunks can + * be of whatever size the caller finds convenient. + * + * If the archive is parsed (e.g. see astreamer_tar_parser_new()), then all + * chunks should be labelled as one of the other types listed here. In + * addition, there should be exactly one ASTREAMER_MEMBER_HEADER chunk and + * exactly one ASTREAMER_MEMBER_TRAILER chunk per archive member, even if + * that means a zero-length call. There can be any number of + * ASTREAMER_MEMBER_CONTENTS chunks in between those calls. There + * should exactly ASTREAMER_ARCHIVE_TRAILER chunk, and it should follow the + * last ASTREAMER_MEMBER_TRAILER chunk. + * + * In theory, we could need other classifications here, such as a way of + * indicating an archive header, but the "tar" format doesn't need anything + * else, so for the time being there's no point. + */ +typedef enum +{ + ASTREAMER_UNKNOWN, + ASTREAMER_MEMBER_HEADER, + ASTREAMER_MEMBER_CONTENTS, + ASTREAMER_MEMBER_TRAILER, + ASTREAMER_ARCHIVE_TRAILER, +} astreamer_archive_context; + +/* + * Each chunk of data that is classified as ASTREAMER_MEMBER_HEADER, + * ASTREAMER_MEMBER_CONTENTS, or ASTREAMER_MEMBER_TRAILER should also + * pass a pointer to an instance of this struct. The details are expected + * to be present in the archive header and used to fill the struct, after + * which all subsequent calls for the same archive member are expected to + * pass the same details. + */ +typedef struct +{ + char pathname[MAXPGPATH]; + pgoff_t size; + mode_t mode; + uid_t uid; + gid_t gid; + bool is_directory; + bool is_link; + char linktarget[MAXPGPATH]; +} astreamer_member; + +/* + * Generally, each type of astreamer will define its own struct, but the + * first element should be 'astreamer base'. A astreamer that does not + * require any additional private data could use this structure directly. + * + * bbs_ops is a pointer to the astreamer_ops object which contains the + * function pointers appropriate to this type of astreamer. + * + * bbs_next is a pointer to the successor astreamer, for those types of + * astreamer which forward data to a successor. It need not be used and + * should be set to NULL when not relevant. + * + * bbs_buffer is a buffer for accumulating data for temporary storage. Each + * type of astreamer makes its own decisions about whether and how to use + * this buffer. + */ +struct astreamer +{ + const astreamer_ops *bbs_ops; + astreamer *bbs_next; + StringInfoData bbs_buffer; +}; + +/* + * There are three callbacks for a astreamer. The 'content' callback is + * called repeatedly, as described in the astreamer_archive_context comments. + * Then, the 'finalize' callback is called once at the end, to give the + * astreamer a chance to perform cleanup such as closing files. Finally, + * because this code is running in a frontend environment where, as of this + * writing, there are no memory contexts, the 'free' callback is called to + * release memory. These callbacks should always be invoked using the static + * inline functions defined below. + */ +struct astreamer_ops +{ + void (*content) (astreamer *streamer, astreamer_member *member, + const char *data, int len, + astreamer_archive_context context); + void (*finalize) (astreamer *streamer); + void (*free) (astreamer *streamer); +}; + +/* Send some content to a astreamer. */ +static inline void +astreamer_content(astreamer *streamer, astreamer_member *member, + const char *data, int len, + astreamer_archive_context context) +{ + Assert(streamer != NULL); + streamer->bbs_ops->content(streamer, member, data, len, context); +} + +/* Finalize a astreamer. */ +static inline void +astreamer_finalize(astreamer *streamer) +{ + Assert(streamer != NULL); + streamer->bbs_ops->finalize(streamer); +} + +/* Free a astreamer. */ +static inline void +astreamer_free(astreamer *streamer) +{ + Assert(streamer != NULL); + streamer->bbs_ops->free(streamer); +} + +/* + * This is a convenience method for use when implementing a astreamer; it is + * not for use by outside callers. It adds the amount of data specified by + * 'nbytes' to the astreamer's buffer and adjusts '*len' and '*data' + * accordingly. + */ +static inline void +astreamer_buffer_bytes(astreamer *streamer, const char **data, int *len, + int nbytes) +{ + Assert(nbytes <= *len); + + appendBinaryStringInfo(&streamer->bbs_buffer, *data, nbytes); + *len -= nbytes; + *data += nbytes; +} + +/* + * This is a convenience method for use when implementing a astreamer; it is + * not for use by outsider callers. It attempts to add enough data to the + * astreamer's buffer to reach a length of target_bytes and adjusts '*len' + * and '*data' accordingly. It returns true if the target length has been + * reached and false otherwise. + */ +static inline bool +astreamer_buffer_until(astreamer *streamer, const char **data, int *len, + int target_bytes) +{ + int buflen = streamer->bbs_buffer.len; + + if (buflen >= target_bytes) + { + /* Target length already reached; nothing to do. */ + return true; + } + + if (buflen + *len < target_bytes) + { + /* Not enough data to reach target length; buffer all of it. */ + astreamer_buffer_bytes(streamer, data, len, *len); + return false; + } + + /* Buffer just enough to reach the target length. */ + astreamer_buffer_bytes(streamer, data, len, target_bytes - buflen); + return true; +} + +/* + * Functions for creating astreamer objects of various types. See the header + * comments for each of these functions for details. + */ +extern astreamer *astreamer_plain_writer_new(char *pathname, FILE *file); +extern astreamer *astreamer_gzip_writer_new(char *pathname, FILE *file, + pg_compress_specification *compress); +extern astreamer *astreamer_extractor_new(const char *basepath, + const char *(*link_map) (const char *), + void (*report_output_file) (const char *)); + +extern astreamer *astreamer_gzip_decompressor_new(astreamer *next); +extern astreamer *astreamer_lz4_compressor_new(astreamer *next, + pg_compress_specification *compress); +extern astreamer *astreamer_lz4_decompressor_new(astreamer *next); +extern astreamer *astreamer_zstd_compressor_new(astreamer *next, + pg_compress_specification *compress); +extern astreamer *astreamer_zstd_decompressor_new(astreamer *next); +extern astreamer *astreamer_tar_parser_new(astreamer *next); +extern astreamer *astreamer_tar_terminator_new(astreamer *next); +extern astreamer *astreamer_tar_archiver_new(astreamer *next); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/cancel.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/cancel.h new file mode 100644 index 0000000..977115f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/cancel.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * Query cancellation support for frontend code + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/cancel.h + * + *------------------------------------------------------------------------- + */ + +#ifndef CANCEL_H +#define CANCEL_H + +#include + +#include "libpq-fe.h" + +extern PGDLLIMPORT volatile sig_atomic_t CancelRequested; + +extern void SetCancelConn(PGconn *conn); +extern void ResetCancelConn(void); + +/* + * A callback can be optionally set up to be called at cancellation + * time. + */ +extern void setup_cancel_handler(void (*query_cancel_callback) (void)); + +#endif /* CANCEL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/conditional.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/conditional.h new file mode 100644 index 0000000..435e975 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/conditional.h @@ -0,0 +1,102 @@ +/*------------------------------------------------------------------------- + * A stack of automaton states to handle nested conditionals. + * + * This file describes a stack of automaton states which + * allow a manage nested conditionals. + * + * It is used by: + * - "psql" interpreter for handling \if ... \endif + * - "pgbench" interpreter for handling \if ... \endif + * - "pgbench" syntax checker to test for proper nesting + * + * The stack holds the state of enclosing conditionals (are we in + * a true branch? in a false branch? have we already encountered + * a true branch?) so that the interpreter knows whether to execute + * code and whether to evaluate conditions. + * + * Copyright (c) 2000-2025, PostgreSQL Global Development Group + * + * src/include/fe_utils/conditional.h + * + *------------------------------------------------------------------------- + */ +#ifndef CONDITIONAL_H +#define CONDITIONAL_H + +/* + * Possible states of a single level of \if block. + */ +typedef enum ifState +{ + IFSTATE_NONE = 0, /* not currently in an \if block */ + IFSTATE_TRUE, /* currently in an \if or \elif that is true + * and all parent branches (if any) are true */ + IFSTATE_FALSE, /* currently in an \if or \elif that is false + * but no true branch has yet been seen, and + * all parent branches (if any) are true */ + IFSTATE_IGNORED, /* currently in an \elif that follows a true + * branch, or the whole \if is a child of a + * false parent branch */ + IFSTATE_ELSE_TRUE, /* currently in an \else that is true and all + * parent branches (if any) are true */ + IFSTATE_ELSE_FALSE, /* currently in an \else that is false or + * ignored */ +} ifState; + +/* + * The state of nested \ifs is stored in a stack. + * + * query_len is used to determine what accumulated text to throw away at the + * end of an inactive branch. (We could, perhaps, teach the lexer to not add + * stuff to the query buffer in the first place when inside an inactive branch; + * but that would be very invasive.) We also need to save and restore the + * lexer's parenthesis nesting depth when throwing away text. (We don't need + * to save and restore any of its other state, such as comment nesting depth, + * because a backslash command could never appear inside a comment or SQL + * literal.) + */ +typedef struct IfStackElem +{ + ifState if_state; /* current state, see enum above */ + int query_len; /* length of query_buf at last branch start */ + int paren_depth; /* parenthesis depth at last branch start */ + struct IfStackElem *next; /* next surrounding \if, if any */ +} IfStackElem; + +typedef struct ConditionalStackData +{ + IfStackElem *head; +} ConditionalStackData; + +typedef struct ConditionalStackData *ConditionalStack; + + +extern ConditionalStack conditional_stack_create(void); + +extern void conditional_stack_reset(ConditionalStack cstack); + +extern void conditional_stack_destroy(ConditionalStack cstack); + +extern int conditional_stack_depth(ConditionalStack cstack); + +extern void conditional_stack_push(ConditionalStack cstack, ifState new_state); + +extern bool conditional_stack_pop(ConditionalStack cstack); + +extern ifState conditional_stack_peek(ConditionalStack cstack); + +extern bool conditional_stack_poke(ConditionalStack cstack, ifState new_state); + +extern bool conditional_stack_empty(ConditionalStack cstack); + +extern bool conditional_active(ConditionalStack cstack); + +extern void conditional_stack_set_query_len(ConditionalStack cstack, int len); + +extern int conditional_stack_get_query_len(ConditionalStack cstack); + +extern void conditional_stack_set_paren_depth(ConditionalStack cstack, int depth); + +extern int conditional_stack_get_paren_depth(ConditionalStack cstack); + +#endif /* CONDITIONAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/connect_utils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/connect_utils.h new file mode 100644 index 0000000..26bd506 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/connect_utils.h @@ -0,0 +1,48 @@ +/*------------------------------------------------------------------------- + * + * Facilities for frontend code to connect to and disconnect from databases. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/connect_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef CONNECT_UTILS_H +#define CONNECT_UTILS_H + +#include "libpq-fe.h" + +enum trivalue +{ + TRI_DEFAULT, + TRI_NO, + TRI_YES +}; + +/* Parameters needed by connectDatabase/connectMaintenanceDatabase */ +typedef struct _connParams +{ + /* These fields record the actual command line parameters */ + const char *dbname; /* this may be a connstring! */ + const char *pghost; + const char *pgport; + const char *pguser; + enum trivalue prompt_password; + /* If not NULL, this overrides the dbname obtained from command line */ + /* (but *only* the DB name, not anything else in the connstring) */ + const char *override_dbname; +} ConnParams; + +extern PGconn *connectDatabase(const ConnParams *cparams, + const char *progname, + bool echo, bool fail_ok, + bool allow_password_reuse); + +extern PGconn *connectMaintenanceDatabase(ConnParams *cparams, + const char *progname, bool echo); + +extern void disconnectDatabase(PGconn *conn); + +#endif /* CONNECT_UTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/mbprint.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/mbprint.h new file mode 100644 index 0000000..c8e3796 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/mbprint.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * Multibyte character printing support for frontend code + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/mbprint.h + * + *------------------------------------------------------------------------- + */ +#ifndef MBPRINT_H +#define MBPRINT_H + +struct lineptr +{ + unsigned char *ptr; + int width; +}; + +extern unsigned char *mbvalidate(unsigned char *pwcs, int encoding); +extern int pg_wcswidth(const char *pwcs, size_t len, int encoding); +extern void pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding, + struct lineptr *lines, int count); +extern void pg_wcssize(const unsigned char *pwcs, size_t len, int encoding, + int *result_width, int *result_height, + int *result_format_size); + +#endif /* MBPRINT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/option_utils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/option_utils.h new file mode 100644 index 0000000..4504bbb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/option_utils.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * Command line option processing facilities for frontend code + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/option_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef OPTION_UTILS_H +#define OPTION_UTILS_H + +#include "common/file_utils.h" + +typedef void (*help_handler) (const char *progname); + +extern void handle_help_version_opts(int argc, char *argv[], + const char *fixed_progname, + help_handler hlp); +extern bool option_parse_int(const char *optarg, const char *optname, + int min_range, int max_range, + int *result); +extern bool parse_sync_method(const char *optarg, + DataDirSyncMethod *sync_method); + +#endif /* OPTION_UTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/parallel_slot.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/parallel_slot.h new file mode 100644 index 0000000..7770a20 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/parallel_slot.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------------- + * + * parallel_slot.h + * Parallel support for bin/scripts/ + * + * Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/fe_utils/parallel_slot.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARALLEL_SLOT_H +#define PARALLEL_SLOT_H + +#include "fe_utils/connect_utils.h" +#include "libpq-fe.h" + +typedef bool (*ParallelSlotResultHandler) (PGresult *res, PGconn *conn, + void *context); + +typedef struct ParallelSlot +{ + PGconn *connection; /* One connection */ + bool inUse; /* Is the slot being used? */ + + /* + * Prior to issuing a command or query on 'connection', a handler callback + * function may optionally be registered to be invoked to process the + * results, and context information may optionally be registered for use + * by the handler. If unset, these fields should be NULL. + */ + ParallelSlotResultHandler handler; + void *handler_context; +} ParallelSlot; + +typedef struct ParallelSlotArray +{ + int numslots; + ConnParams *cparams; + const char *progname; + bool echo; + const char *initcmd; + ParallelSlot slots[FLEXIBLE_ARRAY_MEMBER]; +} ParallelSlotArray; + +static inline void +ParallelSlotSetHandler(ParallelSlot *slot, ParallelSlotResultHandler handler, + void *context) +{ + slot->handler = handler; + slot->handler_context = context; +} + +static inline void +ParallelSlotClearHandler(ParallelSlot *slot) +{ + slot->handler = NULL; + slot->handler_context = NULL; +} + +extern ParallelSlot *ParallelSlotsGetIdle(ParallelSlotArray *sa, + const char *dbname); + +extern ParallelSlotArray *ParallelSlotsSetup(int numslots, ConnParams *cparams, + const char *progname, bool echo, + const char *initcmd); + +extern void ParallelSlotsAdoptConn(ParallelSlotArray *sa, PGconn *conn); + +extern void ParallelSlotsTerminate(ParallelSlotArray *sa); + +extern bool ParallelSlotsWaitCompletion(ParallelSlotArray *sa); + +extern bool TableCommandResultHandler(PGresult *res, PGconn *conn, + void *context); + +#endif /* PARALLEL_SLOT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/print.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/print.h new file mode 100644 index 0000000..c99c2ee --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/print.h @@ -0,0 +1,236 @@ +/*------------------------------------------------------------------------- + * + * Query-result printing support for frontend code + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/print.h + * + *------------------------------------------------------------------------- + */ +#ifndef PRINT_H +#define PRINT_H + +#include + +#include "libpq-fe.h" + + +/* This is not a particularly great place for this ... */ +#ifndef __CYGWIN__ +#define DEFAULT_PAGER "more" +#else +#define DEFAULT_PAGER "less" +#endif + +enum printFormat +{ + PRINT_NOTHING = 0, /* to make sure someone initializes this */ + PRINT_ALIGNED, + PRINT_ASCIIDOC, + PRINT_CSV, + PRINT_HTML, + PRINT_LATEX, + PRINT_LATEX_LONGTABLE, + PRINT_TROFF_MS, + PRINT_UNALIGNED, + PRINT_WRAPPED, + /* add your favourite output format here ... */ +}; + +typedef struct printTextLineFormat +{ + /* Line drawing characters to be used in various contexts */ + const char *hrule; /* horizontal line character */ + const char *leftvrule; /* left vertical line (+horizontal) */ + const char *midvrule; /* intra-column vertical line (+horizontal) */ + const char *rightvrule; /* right vertical line (+horizontal) */ +} printTextLineFormat; + +typedef enum printTextRule +{ + /* Additional context for selecting line drawing characters */ + PRINT_RULE_TOP, /* top horizontal line */ + PRINT_RULE_MIDDLE, /* intra-data horizontal line */ + PRINT_RULE_BOTTOM, /* bottom horizontal line */ + PRINT_RULE_DATA, /* data line (hrule is unused here) */ +} printTextRule; + +typedef enum printTextLineWrap +{ + /* Line wrapping conditions */ + PRINT_LINE_WRAP_NONE, /* No wrapping */ + PRINT_LINE_WRAP_WRAP, /* Wraparound due to overlength line */ + PRINT_LINE_WRAP_NEWLINE, /* Newline in data */ +} printTextLineWrap; + +typedef enum printXheaderWidthType +{ + /* Expanded header line width variants */ + PRINT_XHEADER_FULL, /* do not truncate header line (this is the + * default) */ + PRINT_XHEADER_COLUMN, /* only print header line above the first + * column */ + PRINT_XHEADER_PAGE, /* header line must not be longer than + * terminal width */ + PRINT_XHEADER_EXACT_WIDTH, /* explicitly specified width */ +} printXheaderWidthType; + +typedef struct printTextFormat +{ + /* A complete line style */ + const char *name; /* for display purposes */ + printTextLineFormat lrule[4]; /* indexed by enum printTextRule */ + const char *midvrule_nl; /* vertical line for continue after newline */ + const char *midvrule_wrap; /* vertical line for wrapped data */ + const char *midvrule_blank; /* vertical line for blank data */ + const char *header_nl_left; /* left mark after newline */ + const char *header_nl_right; /* right mark for newline */ + const char *nl_left; /* left mark after newline */ + const char *nl_right; /* right mark for newline */ + const char *wrap_left; /* left mark after wrapped data */ + const char *wrap_right; /* right mark for wrapped data */ + bool wrap_right_border; /* use right-hand border for wrap marks + * when border=0? */ +} printTextFormat; + +typedef enum unicode_linestyle +{ + UNICODE_LINESTYLE_SINGLE = 0, + UNICODE_LINESTYLE_DOUBLE, +} unicode_linestyle; + +struct separator +{ + char *separator; + bool separator_zero; +}; + +typedef struct printTableOpt +{ + enum printFormat format; /* see enum above */ + unsigned short int expanded; /* expanded/vertical output (if supported + * by output format); 0=no, 1=yes, 2=auto */ + printXheaderWidthType expanded_header_width_type; /* width type for header + * line in expanded mode */ + int expanded_header_exact_width; /* explicit width for header + * line in expanded mode */ + unsigned short int border; /* Print a border around the table. 0=none, + * 1=dividing lines, 2=full */ + unsigned short int pager; /* use pager for output (if to stdout and + * stdout is a tty) 0=off 1=on 2=always */ + int pager_min_lines; /* don't use pager unless there are at + * least this many lines */ + bool tuples_only; /* don't output headers, row counts, etc. */ + bool start_table; /* print start decoration, eg */ + bool stop_table; /* print stop decoration, eg
*/ + bool default_footer; /* allow "(xx rows)" default footer */ + unsigned long prior_records; /* start offset for record counters */ + const printTextFormat *line_style; /* line style (NULL for default) */ + struct separator fieldSep; /* field separator for unaligned text mode */ + struct separator recordSep; /* record separator for unaligned text mode */ + char csvFieldSep[2]; /* field separator for csv format */ + bool numericLocale; /* locale-aware numeric units separator and + * decimal marker */ + char *tableAttr; /* attributes for HTML */ + int encoding; /* character encoding */ + int env_columns; /* $COLUMNS on psql start, 0 is unset */ + int columns; /* target width for wrapped format */ + unicode_linestyle unicode_border_linestyle; + unicode_linestyle unicode_column_linestyle; + unicode_linestyle unicode_header_linestyle; +} printTableOpt; + +/* + * Table footers are implemented as a singly-linked list. + * + * This is so that you don't need to know the number of footers in order to + * initialise the printTableContent struct, which is very convenient when + * preparing complex footers (as in describeOneTableDetails). + */ +typedef struct printTableFooter +{ + char *data; + struct printTableFooter *next; +} printTableFooter; + +/* + * The table content struct holds all the information which will be displayed + * by printTable(). + */ +typedef struct printTableContent +{ + const printTableOpt *opt; + const char *title; /* May be NULL */ + int ncolumns; /* Specified in Init() */ + int nrows; /* Specified in Init() */ + const char **headers; /* NULL-terminated array of header strings */ + const char **header; /* Pointer to the last added header */ + const char **cells; /* NULL-terminated array of cell content + * strings */ + const char **cell; /* Pointer to the last added cell */ + uint64 cellsadded; /* Number of cells added this far */ + bool *cellmustfree; /* true for cells that need to be free()d */ + printTableFooter *footers; /* Pointer to the first footer */ + printTableFooter *footer; /* Pointer to the last added footer */ + char *aligns; /* Array of alignment specifiers; 'l' or 'r', + * one per column */ + char *align; /* Pointer to the last added alignment */ +} printTableContent; + +typedef struct printQueryOpt +{ + printTableOpt topt; /* the options above */ + char *nullPrint; /* how to print null entities */ + char *title; /* override title */ + char **footers; /* override footer (default is "(xx rows)") */ + bool translate_header; /* do gettext on column headers */ + const bool *translate_columns; /* translate_columns[i-1] => do gettext on + * col i */ + int n_translate_columns; /* length of translate_columns[] */ +} printQueryOpt; + + +extern PGDLLIMPORT volatile sig_atomic_t cancel_pressed; + +extern PGDLLIMPORT const printTextFormat pg_asciiformat; +extern PGDLLIMPORT const printTextFormat pg_asciiformat_old; +extern PGDLLIMPORT printTextFormat pg_utf8format; /* ideally would be const, + * but... */ + + +extern void disable_sigpipe_trap(void); +extern void restore_sigpipe_trap(void); +extern void set_sigpipe_trap_state(bool ignore); + +extern FILE *PageOutput(int lines, const printTableOpt *topt); +extern void ClosePager(FILE *pagerpipe); + +extern void html_escaped_print(const char *in, FILE *fout); + +extern void printTableInit(printTableContent *const content, + const printTableOpt *opt, const char *title, + const int ncolumns, const int nrows); +extern void printTableAddHeader(printTableContent *const content, + char *header, const bool translate, const char align); +extern void printTableAddCell(printTableContent *const content, + char *cell, const bool translate, const bool mustfree); +extern void printTableAddFooter(printTableContent *const content, + const char *footer); +extern void printTableSetFooter(printTableContent *const content, + const char *footer); +extern void printTableCleanup(printTableContent *const content); +extern void printTable(const printTableContent *cont, + FILE *fout, bool is_pager, FILE *flog); +extern void printQuery(const PGresult *result, const printQueryOpt *opt, + FILE *fout, bool is_pager, FILE *flog); + +extern char column_type_alignment(Oid); + +extern void setDecimalLocale(void); +extern const printTextFormat *get_line_style(const printTableOpt *opt); +extern void refresh_utf8format(const printTableOpt *opt); + +#endif /* PRINT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/psqlscan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/psqlscan.h new file mode 100644 index 0000000..39d2065 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/psqlscan.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * psqlscan.h + * lexical scanner for SQL commands + * + * This lexer used to be part of psql, and that heritage is reflected in + * the file name as well as function and typedef names, though it can now + * be used by other frontend programs as well. It's also possible to extend + * this lexer with a compatible add-on lexer to handle program-specific + * backslash commands. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/psqlscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef PSQLSCAN_H +#define PSQLSCAN_H + +#include "pqexpbuffer.h" + + +/* Abstract type for lexer's internal state */ +typedef struct PsqlScanStateData *PsqlScanState; + +/* Termination states for psql_scan() */ +typedef enum +{ + PSCAN_SEMICOLON, /* found command-ending semicolon */ + PSCAN_BACKSLASH, /* found backslash command */ + PSCAN_INCOMPLETE, /* end of line, SQL statement incomplete */ + PSCAN_EOL, /* end of line, SQL possibly complete */ +} PsqlScanResult; + +/* Prompt type returned by psql_scan() */ +typedef enum _promptStatus +{ + PROMPT_READY, + PROMPT_CONTINUE, + PROMPT_COMMENT, + PROMPT_SINGLEQUOTE, + PROMPT_DOUBLEQUOTE, + PROMPT_DOLLARQUOTE, + PROMPT_PAREN, + PROMPT_COPY, +} promptStatus_t; + +/* Quoting request types for get_variable() callback */ +typedef enum +{ + PQUOTE_PLAIN, /* just return the actual value */ + PQUOTE_SQL_LITERAL, /* add quotes to make a valid SQL literal */ + PQUOTE_SQL_IDENT, /* quote if needed to make a SQL identifier */ + PQUOTE_SHELL_ARG, /* quote if needed to be safe in a shell cmd */ +} PsqlScanQuoteType; + +/* Callback functions to be used by the lexer */ +typedef struct PsqlScanCallbacks +{ + /* Fetch value of a variable, as a free'able string; NULL if unknown */ + /* This pointer can be NULL if no variable substitution is wanted */ + char *(*get_variable) (const char *varname, PsqlScanQuoteType quote, + void *passthrough); +} PsqlScanCallbacks; + + +extern PsqlScanState psql_scan_create(const PsqlScanCallbacks *callbacks); +extern void psql_scan_destroy(PsqlScanState state); + +extern void psql_scan_set_passthrough(PsqlScanState state, void *passthrough); + +extern void psql_scan_setup(PsqlScanState state, + const char *line, int line_len, + int encoding, bool std_strings); +extern void psql_scan_finish(PsqlScanState state); + +extern PsqlScanResult psql_scan(PsqlScanState state, + PQExpBuffer query_buf, + promptStatus_t *prompt); + +extern void psql_scan_reset(PsqlScanState state); + +extern void psql_scan_reselect_sql_lexer(PsqlScanState state); + +extern bool psql_scan_in_quote(PsqlScanState state); + +extern void psql_scan_get_location(PsqlScanState state, + int *lineno, int *offset); + +#endif /* PSQLSCAN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/psqlscan_int.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/psqlscan_int.h new file mode 100644 index 0000000..2a3a9d7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/psqlscan_int.h @@ -0,0 +1,161 @@ +/*------------------------------------------------------------------------- + * + * psqlscan_int.h + * lexical scanner internal declarations + * + * This file declares the PsqlScanStateData structure used by psqlscan.l + * and shared by other lexers compatible with it, such as psqlscanslash.l. + * + * One difficult aspect of this code is that we need to work in multibyte + * encodings that are not ASCII-safe. A "safe" encoding is one in which each + * byte of a multibyte character has the high bit set (it's >= 0x80). Since + * all our lexing rules treat all high-bit-set characters alike, we don't + * really need to care whether such a byte is part of a sequence or not. + * In an "unsafe" encoding, we still expect the first byte of a multibyte + * sequence to be >= 0x80, but later bytes might not be. If we scan such + * a sequence as-is, the lexing rules could easily be fooled into matching + * such bytes to ordinary ASCII characters. Our solution for this is to + * substitute 0xFF for each non-first byte within the data presented to flex. + * The flex rules will then pass the FF's through unmolested. The + * psqlscan_emit() subroutine is responsible for looking back to the original + * string and replacing FF's with the corresponding original bytes. + * + * Another interesting thing we do here is scan different parts of the same + * input with physically separate flex lexers (ie, lexers written in separate + * .l files). We can get away with this because the only part of the + * persistent state of a flex lexer that depends on its parsing rule tables + * is the start state number, which is easy enough to manage --- usually, + * in fact, we just need to set it to INITIAL when changing lexers. But to + * make that work at all, we must use re-entrant lexers, so that all the + * relevant state is in the yyscan_t attached to the PsqlScanState; + * if we were using lexers with separate static state we would soon end up + * with dangling buffer pointers in one or the other. Also note that this + * is unlikely to work very nicely if the lexers aren't all built with the + * same flex version, or if they don't use the same flex options. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/psqlscan_int.h + * + *------------------------------------------------------------------------- + */ +#ifndef PSQLSCAN_INT_H +#define PSQLSCAN_INT_H + +#include "fe_utils/psqlscan.h" + +/* + * These are just to allow this file to be compilable standalone for header + * validity checking; in actual use, this file should always be included + * from the body of a flex file, where these symbols are already defined. + */ +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void *yyscan_t; +#endif + +/* + * We use a stack of flex buffers to handle substitution of psql variables. + * Each stacked buffer contains the as-yet-unread text from one psql variable. + * When we pop the stack all the way, we resume reading from the outer buffer + * identified by scanbufhandle. + */ +typedef struct StackElem +{ + YY_BUFFER_STATE buf; /* flex input control structure */ + char *bufstring; /* data actually being scanned by flex */ + char *origstring; /* copy of original data, if needed */ + char *varname; /* name of variable providing data, or NULL */ + struct StackElem *next; +} StackElem; + +/* + * All working state of the lexer must be stored in PsqlScanStateData + * between calls. This allows us to have multiple open lexer operations, + * which is needed for nested include files. The lexer itself is not + * recursive, but it must be re-entrant. + */ +typedef struct PsqlScanStateData +{ + yyscan_t scanner; /* Flex's state for this PsqlScanState */ + + PQExpBuffer output_buf; /* current output buffer */ + + StackElem *buffer_stack; /* stack of variable expansion buffers */ + + /* + * These variables always refer to the outer buffer, never to any stacked + * variable-expansion buffer. + */ + YY_BUFFER_STATE scanbufhandle; + char *scanbuf; /* start of outer-level input buffer */ + const char *scanline; /* current input line at outer level */ + + /* safe_encoding, curline, refline are used by emit() to replace FFs */ + int encoding; /* encoding being used now */ + bool safe_encoding; /* is current encoding "safe"? */ + bool std_strings; /* are string literals standard? */ + const char *curline; /* actual flex input string for cur buf */ + const char *refline; /* original data for cur buffer */ + + /* status for psql_scan_get_location() */ + int cur_line_no; /* current line#, or 0 if no yylex done */ + const char *cur_line_ptr; /* points into cur_line_no'th line in scanbuf */ + + /* + * All this state lives across successive input lines, until explicitly + * reset by psql_scan_reset. start_state is adopted by yylex() on entry, + * and updated with its finishing state on exit. + */ + int start_state; /* yylex's starting/finishing state */ + int state_before_str_stop; /* start cond. before end quote */ + int paren_depth; /* depth of nesting in parentheses */ + int xcdepth; /* depth of nesting in slash-star comments */ + char *dolqstart; /* current $foo$ quote start string */ + + /* + * State to track boundaries of BEGIN ... END blocks in function + * definitions, so that semicolons do not send query too early. + */ + int identifier_count; /* identifiers since start of statement */ + char identifiers[4]; /* records the first few identifiers */ + int begin_depth; /* depth of begin/end pairs */ + + /* + * Callback functions provided by the program making use of the lexer, + * plus a void* callback passthrough argument. + */ + const PsqlScanCallbacks *callbacks; + void *cb_passthrough; +} PsqlScanStateData; + + +/* + * Functions exported by psqlscan.l, but only meant for use within + * compatible lexers. + */ +extern void psqlscan_push_new_buffer(PsqlScanState state, + const char *newstr, const char *varname); +extern void psqlscan_pop_buffer_stack(PsqlScanState state); +extern void psqlscan_select_top_buffer(PsqlScanState state); +extern bool psqlscan_var_is_current_source(PsqlScanState state, + const char *varname); +extern YY_BUFFER_STATE psqlscan_prepare_buffer(PsqlScanState state, + const char *txt, int len, + char **txtcopy); +extern void psqlscan_emit(PsqlScanState state, const char *txt, int len); +extern char *psqlscan_extract_substring(PsqlScanState state, + const char *txt, int len); +extern void psqlscan_escape_variable(PsqlScanState state, + const char *txt, int len, + PsqlScanQuoteType quote); +extern void psqlscan_test_variable(PsqlScanState state, + const char *txt, int len); + +#endif /* PSQLSCAN_INT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/query_utils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/query_utils.h new file mode 100644 index 0000000..4d7f7d6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/query_utils.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * Facilities for frontend code to query a databases. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/query_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef QUERY_UTILS_H +#define QUERY_UTILS_H + +#include "libpq-fe.h" + +extern PGresult *executeQuery(PGconn *conn, const char *query, bool echo); + +extern void executeCommand(PGconn *conn, const char *query, bool echo); + +extern bool executeMaintenanceCommand(PGconn *conn, const char *query, + bool echo); + +#endif /* QUERY_UTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/recovery_gen.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/recovery_gen.h new file mode 100644 index 0000000..c13f226 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/recovery_gen.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * Generator for recovery configuration + * + * Portions Copyright (c) 2011-2025, PostgreSQL Global Development Group + * + * src/include/fe_utils/recovery_gen.h + * + *------------------------------------------------------------------------- + */ +#ifndef RECOVERY_GEN_H +#define RECOVERY_GEN_H + +#include "libpq-fe.h" +#include "pqexpbuffer.h" + +/* + * recovery configuration is part of postgresql.conf in version 12 and up, and + * in recovery.conf before that. + */ +#define MINIMUM_VERSION_FOR_RECOVERY_GUC 120000 + +extern PQExpBuffer GenerateRecoveryConfig(PGconn *pgconn, + const char *replication_slot, + char *dbname); +extern void WriteRecoveryConfig(PGconn *pgconn, const char *target_dir, + PQExpBuffer contents); +extern char *GetDbnameFromConnectionOptions(const char *connstr); + +#endif /* RECOVERY_GEN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/simple_list.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/simple_list.h new file mode 100644 index 0000000..3b8e384 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/simple_list.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------------------- + * + * Simple list facilities for frontend code + * + * Data structures for simple lists of OIDs, strings, and pointers. The + * support for these is very primitive compared to the backend's List + * facilities, but it's all we need in, eg, pg_dump. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/simple_list.h + * + *------------------------------------------------------------------------- + */ +#ifndef SIMPLE_LIST_H +#define SIMPLE_LIST_H + +typedef struct SimpleOidListCell +{ + struct SimpleOidListCell *next; + Oid val; +} SimpleOidListCell; + +typedef struct SimpleOidList +{ + SimpleOidListCell *head; + SimpleOidListCell *tail; +} SimpleOidList; + +typedef struct SimpleStringListCell +{ + struct SimpleStringListCell *next; + bool touched; /* true, when this string was searched and + * touched */ + char val[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string here */ +} SimpleStringListCell; + +typedef struct SimpleStringList +{ + SimpleStringListCell *head; + SimpleStringListCell *tail; +} SimpleStringList; + +typedef struct SimplePtrListCell +{ + struct SimplePtrListCell *next; + void *ptr; +} SimplePtrListCell; + +typedef struct SimplePtrList +{ + SimplePtrListCell *head; + SimplePtrListCell *tail; +} SimplePtrList; + +extern void simple_oid_list_append(SimpleOidList *list, Oid val); +extern bool simple_oid_list_member(SimpleOidList *list, Oid val); +extern void simple_oid_list_destroy(SimpleOidList *list); + +extern void simple_string_list_append(SimpleStringList *list, const char *val); +extern bool simple_string_list_member(SimpleStringList *list, const char *val); +extern void simple_string_list_destroy(SimpleStringList *list); + +extern const char *simple_string_list_not_touched(SimpleStringList *list); + +extern void simple_ptr_list_append(SimplePtrList *list, void *ptr); +extern void simple_ptr_list_destroy(SimplePtrList *list); + +#endif /* SIMPLE_LIST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/string_utils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/string_utils.h new file mode 100644 index 0000000..dc991a9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fe_utils/string_utils.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * String-processing utility routines for frontend code + * + * Utility functions that interpret backend output or quote strings for + * assorted contexts. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/string_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef STRING_UTILS_H +#define STRING_UTILS_H + +#include "libpq-fe.h" +#include "pqexpbuffer.h" + +/* Global variables controlling behavior of fmtId() and fmtQualifiedId() */ +extern PGDLLIMPORT int quote_all_identifiers; +extern PQExpBuffer (*getLocalPQExpBuffer) (void); + +/* Functions */ +extern const char *fmtId(const char *rawid); +extern const char *fmtIdEnc(const char *rawid, int encoding); +extern const char *fmtQualifiedId(const char *schema, const char *id); +extern const char *fmtQualifiedIdEnc(const char *schema, const char *id, int encoding); +extern void setFmtEncoding(int encoding); + +extern char *formatPGVersionNumber(int version_number, bool include_minor, + char *buf, size_t buflen); + +extern void appendStringLiteral(PQExpBuffer buf, const char *str, + int encoding, bool std_strings); +extern void appendStringLiteralConn(PQExpBuffer buf, const char *str, + PGconn *conn); +extern void appendStringLiteralDQ(PQExpBuffer buf, const char *str, + const char *dqprefix); +extern void appendByteaLiteral(PQExpBuffer buf, + const unsigned char *str, size_t length, + bool std_strings); + +extern void appendShellString(PQExpBuffer buf, const char *str); +extern bool appendShellStringNoError(PQExpBuffer buf, const char *str); +extern void appendConnStrVal(PQExpBuffer buf, const char *str); +extern void appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname); + +extern bool parsePGArray(const char *atext, char ***itemarray, int *nitems); +extern void appendPGArray(PQExpBuffer buffer, const char *value); + +extern bool appendReloptionsArray(PQExpBuffer buffer, const char *reloptions, + const char *prefix, int encoding, bool std_strings); + +extern bool processSQLNamePattern(PGconn *conn, PQExpBuffer buf, + const char *pattern, + bool have_where, bool force_escape, + const char *schemavar, const char *namevar, + const char *altnamevar, const char *visibilityrule, + PQExpBuffer dbnamebuf, int *dotcnt); + +extern void patternToSQLRegex(int encoding, PQExpBuffer dbnamebuf, + PQExpBuffer schemabuf, PQExpBuffer namebuf, + const char *pattern, bool force_escape, + bool want_literal_dbname, int *dotcnt); + +#endif /* STRING_UTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/fmgr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/fmgr.h new file mode 100644 index 0000000..0fe7b4e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/fmgr.h @@ -0,0 +1,851 @@ +/*------------------------------------------------------------------------- + * + * fmgr.h + * Definitions for the Postgres function manager and function-call + * interface. + * + * This file must be included by all Postgres modules that either define + * or call fmgr-callable functions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fmgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef FMGR_H +#define FMGR_H + +/* We don't want to include primnodes.h here, so make some stub references */ +typedef struct Node *fmNodePtr; +typedef struct Aggref *fmAggrefPtr; + +/* Likewise, avoid including execnodes.h here */ +typedef void (*fmExprContextCallbackFunction) (Datum arg); + +/* Likewise, avoid including stringinfo.h here */ +typedef struct StringInfoData *fmStringInfo; + + +/* + * All functions that can be called directly by fmgr must have this signature. + * (Other functions can be called by using a handler that does have this + * signature.) + */ + +typedef struct FunctionCallInfoBaseData *FunctionCallInfo; + +typedef Datum (*PGFunction) (FunctionCallInfo fcinfo); + +/* + * This struct holds the system-catalog information that must be looked up + * before a function can be called through fmgr. If the same function is + * to be called multiple times, the lookup need be done only once and the + * info struct saved for re-use. + * + * Note that fn_expr really is parse-time-determined information about the + * arguments, rather than about the function itself. But it's convenient to + * store it here rather than in FunctionCallInfoBaseData, where it might more + * logically belong. + * + * fn_extra is available for use by the called function; all other fields + * should be treated as read-only after the struct is created. + */ +typedef struct FmgrInfo +{ + PGFunction fn_addr; /* pointer to function or handler to be called */ + Oid fn_oid; /* OID of function (NOT of handler, if any) */ + short fn_nargs; /* number of input args (0..FUNC_MAX_ARGS) */ + bool fn_strict; /* function is "strict" (NULL in => NULL out) */ + bool fn_retset; /* function returns a set */ + unsigned char fn_stats; /* collect stats if track_functions > this */ + void *fn_extra; /* extra space for use by handler */ + MemoryContext fn_mcxt; /* memory context to store fn_extra in */ + fmNodePtr fn_expr; /* expression parse tree for call, or NULL */ +} FmgrInfo; + +/* + * This struct is the data actually passed to an fmgr-called function. + * + * The called function is expected to set isnull, and possibly resultinfo or + * fields in whatever resultinfo points to. It should not change any other + * fields. (In particular, scribbling on the argument arrays is a bad idea, + * since some callers assume they can re-call with the same arguments.) + * + * Note that enough space for arguments needs to be provided, either by using + * SizeForFunctionCallInfo() in dynamic allocations, or by using + * LOCAL_FCINFO() for on-stack allocations. + * + * This struct is named *BaseData, rather than *Data, to break pre v12 code + * that allocated FunctionCallInfoData itself, as it'd often silently break + * old code due to no space for arguments being provided. + */ +typedef struct FunctionCallInfoBaseData +{ + FmgrInfo *flinfo; /* ptr to lookup info used for this call */ + fmNodePtr context; /* pass info about context of call */ + fmNodePtr resultinfo; /* pass or return extra info about result */ + Oid fncollation; /* collation for function to use */ +#define FIELDNO_FUNCTIONCALLINFODATA_ISNULL 4 + bool isnull; /* function must set true if result is NULL */ + short nargs; /* # arguments actually passed */ +#define FIELDNO_FUNCTIONCALLINFODATA_ARGS 6 + NullableDatum args[FLEXIBLE_ARRAY_MEMBER]; +} FunctionCallInfoBaseData; + +/* + * Space needed for a FunctionCallInfoBaseData struct with sufficient space + * for `nargs` arguments. + */ +#define SizeForFunctionCallInfo(nargs) \ + (offsetof(FunctionCallInfoBaseData, args) + \ + sizeof(NullableDatum) * (nargs)) + +/* + * This macro ensures that `name` points to a stack-allocated + * FunctionCallInfoBaseData struct with sufficient space for `nargs` arguments. + */ +#define LOCAL_FCINFO(name, nargs) \ + /* use union with FunctionCallInfoBaseData to guarantee alignment */ \ + union \ + { \ + FunctionCallInfoBaseData fcinfo; \ + /* ensure enough space for nargs args is available */ \ + char fcinfo_data[SizeForFunctionCallInfo(nargs)]; \ + } name##data; \ + FunctionCallInfo name = &name##data.fcinfo + +/* + * This routine fills a FmgrInfo struct, given the OID + * of the function to be called. + */ +extern void fmgr_info(Oid functionId, FmgrInfo *finfo); + +/* + * Same, when the FmgrInfo struct is in a memory context longer-lived than + * CurrentMemoryContext. The specified context will be set as fn_mcxt + * and used to hold all subsidiary data of finfo. + */ +extern void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, + MemoryContext mcxt); + +/* Convenience macro for setting the fn_expr field */ +#define fmgr_info_set_expr(expr, finfo) \ + ((finfo)->fn_expr = (expr)) + +/* + * Copy an FmgrInfo struct + */ +extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo, + MemoryContext destcxt); + +extern void fmgr_symbol(Oid functionId, char **mod, char **fn); + +/* + * This macro initializes all the fields of a FunctionCallInfoBaseData except + * for the args[] array. + */ +#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo) \ + do { \ + (Fcinfo).flinfo = (Flinfo); \ + (Fcinfo).context = (Context); \ + (Fcinfo).resultinfo = (Resultinfo); \ + (Fcinfo).fncollation = (Collation); \ + (Fcinfo).isnull = false; \ + (Fcinfo).nargs = (Nargs); \ + } while (0) + +/* + * This macro invokes a function given a filled-in FunctionCallInfoBaseData + * struct. The macro result is the returned Datum --- but note that + * caller must still check fcinfo->isnull! Also, if function is strict, + * it is caller's responsibility to verify that no null arguments are present + * before calling. + * + * Some code performs multiple calls without redoing InitFunctionCallInfoData, + * possibly altering the argument values. This is okay, but be sure to reset + * the fcinfo->isnull flag before each call, since callees are permitted to + * assume that starts out false. + */ +#define FunctionCallInvoke(fcinfo) ((* (fcinfo)->flinfo->fn_addr) (fcinfo)) + + +/*------------------------------------------------------------------------- + * Support macros to ease writing fmgr-compatible functions + * + * A C-coded fmgr-compatible function should be declared as + * + * Datum + * function_name(PG_FUNCTION_ARGS) + * { + * ... + * } + * + * It should access its arguments using appropriate PG_GETARG_xxx macros + * and should return its result using PG_RETURN_xxx. + * + *------------------------------------------------------------------------- + */ + +/* Standard parameter list for fmgr-compatible functions */ +#define PG_FUNCTION_ARGS FunctionCallInfo fcinfo + +/* + * Get collation function should use. + */ +#define PG_GET_COLLATION() (fcinfo->fncollation) + +/* + * Get number of arguments passed to function. + */ +#define PG_NARGS() (fcinfo->nargs) + +/* + * If function is not marked "proisstrict" in pg_proc, it must check for + * null arguments using this macro. Do not try to GETARG a null argument! + */ +#define PG_ARGISNULL(n) (fcinfo->args[n].isnull) + +/* + * Support for fetching detoasted copies of toastable datatypes (all of + * which are varlena types). pg_detoast_datum() gives you either the input + * datum (if not toasted) or a detoasted copy allocated with palloc(). + * pg_detoast_datum_copy() always gives you a palloc'd copy --- use it + * if you need a modifiable copy of the input. Caller is expected to have + * checked for null inputs first, if necessary. + * + * pg_detoast_datum_packed() will return packed (1-byte header) datums + * unmodified. It will still expand an externally toasted or compressed datum. + * The resulting datum can be accessed using VARSIZE_ANY() and VARDATA_ANY() + * (beware of multiple evaluations in those macros!) + * + * In consumers oblivious to data alignment, call PG_DETOAST_DATUM_PACKED(), + * VARDATA_ANY(), VARSIZE_ANY() and VARSIZE_ANY_EXHDR(). Elsewhere, call + * PG_DETOAST_DATUM(), VARDATA() and VARSIZE(). Directly fetching an int16, + * int32 or wider field in the struct representing the datum layout requires + * aligned data. memcpy() is alignment-oblivious, as are most operations on + * datatypes, such as text, whose layout struct contains only char fields. + * + * Note: it'd be nice if these could be macros, but I see no way to do that + * without evaluating the arguments multiple times, which is NOT acceptable. + */ +extern struct varlena *pg_detoast_datum(struct varlena *datum); +extern struct varlena *pg_detoast_datum_copy(struct varlena *datum); +extern struct varlena *pg_detoast_datum_slice(struct varlena *datum, + int32 first, int32 count); +extern struct varlena *pg_detoast_datum_packed(struct varlena *datum); + +#define PG_DETOAST_DATUM(datum) \ + pg_detoast_datum((struct varlena *) DatumGetPointer(datum)) +#define PG_DETOAST_DATUM_COPY(datum) \ + pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum)) +#define PG_DETOAST_DATUM_SLICE(datum,f,c) \ + pg_detoast_datum_slice((struct varlena *) DatumGetPointer(datum), \ + (int32) (f), (int32) (c)) +/* WARNING -- unaligned pointer */ +#define PG_DETOAST_DATUM_PACKED(datum) \ + pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum)) + +/* + * Support for cleaning up detoasted copies of inputs. This must only + * be used for pass-by-ref datatypes, and normally would only be used + * for toastable types. If the given pointer is different from the + * original argument, assume it's a palloc'd detoasted copy, and pfree it. + * NOTE: most functions on toastable types do not have to worry about this, + * but we currently require that support functions for indexes not leak + * memory. + */ +#define PG_FREE_IF_COPY(ptr,n) \ + do { \ + if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \ + pfree(ptr); \ + } while (0) + +/* Macros for fetching arguments of standard types */ + +#define PG_GETARG_DATUM(n) (fcinfo->args[n].value) +#define PG_GETARG_INT32(n) DatumGetInt32(PG_GETARG_DATUM(n)) +#define PG_GETARG_UINT32(n) DatumGetUInt32(PG_GETARG_DATUM(n)) +#define PG_GETARG_INT16(n) DatumGetInt16(PG_GETARG_DATUM(n)) +#define PG_GETARG_UINT16(n) DatumGetUInt16(PG_GETARG_DATUM(n)) +#define PG_GETARG_CHAR(n) DatumGetChar(PG_GETARG_DATUM(n)) +#define PG_GETARG_BOOL(n) DatumGetBool(PG_GETARG_DATUM(n)) +#define PG_GETARG_OID(n) DatumGetObjectId(PG_GETARG_DATUM(n)) +#define PG_GETARG_POINTER(n) DatumGetPointer(PG_GETARG_DATUM(n)) +#define PG_GETARG_CSTRING(n) DatumGetCString(PG_GETARG_DATUM(n)) +#define PG_GETARG_NAME(n) DatumGetName(PG_GETARG_DATUM(n)) +#define PG_GETARG_TRANSACTIONID(n) DatumGetTransactionId(PG_GETARG_DATUM(n)) +/* these macros hide the pass-by-reference-ness of the datatype: */ +#define PG_GETARG_FLOAT4(n) DatumGetFloat4(PG_GETARG_DATUM(n)) +#define PG_GETARG_FLOAT8(n) DatumGetFloat8(PG_GETARG_DATUM(n)) +#define PG_GETARG_INT64(n) DatumGetInt64(PG_GETARG_DATUM(n)) +/* use this if you want the raw, possibly-toasted input datum: */ +#define PG_GETARG_RAW_VARLENA_P(n) ((struct varlena *) PG_GETARG_POINTER(n)) +/* use this if you want the input datum de-toasted: */ +#define PG_GETARG_VARLENA_P(n) PG_DETOAST_DATUM(PG_GETARG_DATUM(n)) +/* and this if you can handle 1-byte-header datums: */ +#define PG_GETARG_VARLENA_PP(n) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(n)) +/* DatumGetFoo macros for varlena types will typically look like this: */ +#define DatumGetByteaPP(X) ((bytea *) PG_DETOAST_DATUM_PACKED(X)) +#define DatumGetTextPP(X) ((text *) PG_DETOAST_DATUM_PACKED(X)) +#define DatumGetBpCharPP(X) ((BpChar *) PG_DETOAST_DATUM_PACKED(X)) +#define DatumGetVarCharPP(X) ((VarChar *) PG_DETOAST_DATUM_PACKED(X)) +#define DatumGetHeapTupleHeader(X) ((HeapTupleHeader) PG_DETOAST_DATUM(X)) +/* And we also offer variants that return an OK-to-write copy */ +#define DatumGetByteaPCopy(X) ((bytea *) PG_DETOAST_DATUM_COPY(X)) +#define DatumGetTextPCopy(X) ((text *) PG_DETOAST_DATUM_COPY(X)) +#define DatumGetBpCharPCopy(X) ((BpChar *) PG_DETOAST_DATUM_COPY(X)) +#define DatumGetVarCharPCopy(X) ((VarChar *) PG_DETOAST_DATUM_COPY(X)) +#define DatumGetHeapTupleHeaderCopy(X) ((HeapTupleHeader) PG_DETOAST_DATUM_COPY(X)) +/* Variants which return n bytes starting at pos. m */ +#define DatumGetByteaPSlice(X,m,n) ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n)) +#define DatumGetTextPSlice(X,m,n) ((text *) PG_DETOAST_DATUM_SLICE(X,m,n)) +#define DatumGetBpCharPSlice(X,m,n) ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n)) +#define DatumGetVarCharPSlice(X,m,n) ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n)) +/* GETARG macros for varlena types will typically look like this: */ +#define PG_GETARG_BYTEA_PP(n) DatumGetByteaPP(PG_GETARG_DATUM(n)) +#define PG_GETARG_TEXT_PP(n) DatumGetTextPP(PG_GETARG_DATUM(n)) +#define PG_GETARG_BPCHAR_PP(n) DatumGetBpCharPP(PG_GETARG_DATUM(n)) +#define PG_GETARG_VARCHAR_PP(n) DatumGetVarCharPP(PG_GETARG_DATUM(n)) +#define PG_GETARG_HEAPTUPLEHEADER(n) DatumGetHeapTupleHeader(PG_GETARG_DATUM(n)) +/* And we also offer variants that return an OK-to-write copy */ +#define PG_GETARG_BYTEA_P_COPY(n) DatumGetByteaPCopy(PG_GETARG_DATUM(n)) +#define PG_GETARG_TEXT_P_COPY(n) DatumGetTextPCopy(PG_GETARG_DATUM(n)) +#define PG_GETARG_BPCHAR_P_COPY(n) DatumGetBpCharPCopy(PG_GETARG_DATUM(n)) +#define PG_GETARG_VARCHAR_P_COPY(n) DatumGetVarCharPCopy(PG_GETARG_DATUM(n)) +#define PG_GETARG_HEAPTUPLEHEADER_COPY(n) DatumGetHeapTupleHeaderCopy(PG_GETARG_DATUM(n)) +/* And a b-byte slice from position a -also OK to write */ +#define PG_GETARG_BYTEA_P_SLICE(n,a,b) DatumGetByteaPSlice(PG_GETARG_DATUM(n),a,b) +#define PG_GETARG_TEXT_P_SLICE(n,a,b) DatumGetTextPSlice(PG_GETARG_DATUM(n),a,b) +#define PG_GETARG_BPCHAR_P_SLICE(n,a,b) DatumGetBpCharPSlice(PG_GETARG_DATUM(n),a,b) +#define PG_GETARG_VARCHAR_P_SLICE(n,a,b) DatumGetVarCharPSlice(PG_GETARG_DATUM(n),a,b) +/* + * Obsolescent variants that guarantee INT alignment for the return value. + * Few operations on these particular types need alignment, mainly operations + * that cast the VARDATA pointer to a type like int16[]. Most code should use + * the ...PP(X) counterpart. Nonetheless, these appear frequently in code + * predating the PostgreSQL 8.3 introduction of the ...PP(X) variants. + */ +#define DatumGetByteaP(X) ((bytea *) PG_DETOAST_DATUM(X)) +#define DatumGetTextP(X) ((text *) PG_DETOAST_DATUM(X)) +#define DatumGetBpCharP(X) ((BpChar *) PG_DETOAST_DATUM(X)) +#define DatumGetVarCharP(X) ((VarChar *) PG_DETOAST_DATUM(X)) +#define PG_GETARG_BYTEA_P(n) DatumGetByteaP(PG_GETARG_DATUM(n)) +#define PG_GETARG_TEXT_P(n) DatumGetTextP(PG_GETARG_DATUM(n)) +#define PG_GETARG_BPCHAR_P(n) DatumGetBpCharP(PG_GETARG_DATUM(n)) +#define PG_GETARG_VARCHAR_P(n) DatumGetVarCharP(PG_GETARG_DATUM(n)) + +/* To access options from opclass support functions use this: */ +#define PG_HAS_OPCLASS_OPTIONS() has_fn_opclass_options(fcinfo->flinfo) +#define PG_GET_OPCLASS_OPTIONS() get_fn_opclass_options(fcinfo->flinfo) + +/* To return a NULL do this: */ +#define PG_RETURN_NULL() \ + do { fcinfo->isnull = true; return (Datum) 0; } while (0) + +/* A few internal functions return void (which is not the same as NULL!) */ +#define PG_RETURN_VOID() return (Datum) 0 + +/* Macros for returning results of standard types */ + +#define PG_RETURN_DATUM(x) return (x) +#define PG_RETURN_INT32(x) return Int32GetDatum(x) +#define PG_RETURN_UINT32(x) return UInt32GetDatum(x) +#define PG_RETURN_INT16(x) return Int16GetDatum(x) +#define PG_RETURN_UINT16(x) return UInt16GetDatum(x) +#define PG_RETURN_CHAR(x) return CharGetDatum(x) +#define PG_RETURN_BOOL(x) return BoolGetDatum(x) +#define PG_RETURN_OID(x) return ObjectIdGetDatum(x) +#define PG_RETURN_POINTER(x) return PointerGetDatum(x) +#define PG_RETURN_CSTRING(x) return CStringGetDatum(x) +#define PG_RETURN_NAME(x) return NameGetDatum(x) +#define PG_RETURN_TRANSACTIONID(x) return TransactionIdGetDatum(x) +/* these macros hide the pass-by-reference-ness of the datatype: */ +#define PG_RETURN_FLOAT4(x) return Float4GetDatum(x) +#define PG_RETURN_FLOAT8(x) return Float8GetDatum(x) +#define PG_RETURN_INT64(x) return Int64GetDatum(x) +#define PG_RETURN_UINT64(x) return UInt64GetDatum(x) +/* RETURN macros for other pass-by-ref types will typically look like this: */ +#define PG_RETURN_BYTEA_P(x) PG_RETURN_POINTER(x) +#define PG_RETURN_TEXT_P(x) PG_RETURN_POINTER(x) +#define PG_RETURN_BPCHAR_P(x) PG_RETURN_POINTER(x) +#define PG_RETURN_VARCHAR_P(x) PG_RETURN_POINTER(x) +#define PG_RETURN_HEAPTUPLEHEADER(x) return HeapTupleHeaderGetDatum(x) + + +/*------------------------------------------------------------------------- + * Support for detecting call convention of dynamically-loaded functions + * + * Dynamically loaded functions currently can only use the version-1 ("new + * style") calling convention. Version-0 ("old style") is not supported + * anymore. Version 1 is the call convention defined in this header file, and + * must be accompanied by the macro call + * + * PG_FUNCTION_INFO_V1(function_name); + * + * Note that internal functions do not need this decoration since they are + * assumed to be version-1. + * + *------------------------------------------------------------------------- + */ + +typedef struct +{ + int api_version; /* specifies call convention version number */ + /* More fields may be added later, for version numbers > 1. */ +} Pg_finfo_record; + +/* Expected signature of an info function */ +typedef const Pg_finfo_record *(*PGFInfoFunction) (void); + +/* + * Macro to build an info function associated with the given function name. + * + * As a convenience, also provide an "extern" declaration for the given + * function name, so that writers of C functions need not write that too. + * + * On Windows, the function and info function must be exported. Our normal + * build processes take care of that via .DEF files or --export-all-symbols. + * Module authors using a different build process might need to manually + * declare the function PGDLLEXPORT. We do that automatically here for the + * info function, since authors shouldn't need to be explicitly aware of it. + */ +#define PG_FUNCTION_INFO_V1(funcname) \ +extern PGDLLEXPORT Datum funcname(PG_FUNCTION_ARGS); \ +extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(void); \ +const Pg_finfo_record * \ +CppConcat(pg_finfo_,funcname) (void) \ +{ \ + static const Pg_finfo_record my_finfo = { 1 }; \ + return &my_finfo; \ +} \ +extern int no_such_variable + + +/* + * Declare _PG_init centrally. Historically each shared library had its own + * declaration; but now that we want to mark these PGDLLEXPORT, using central + * declarations avoids each extension having to add that. Any existing + * declarations in extensions will continue to work if fmgr.h is included + * before them, otherwise compilation for Windows will fail. + */ +extern PGDLLEXPORT void _PG_init(void); + + +/*------------------------------------------------------------------------- + * Support for verifying backend compatibility of loaded modules + * + * We require dynamically-loaded modules to include the macro call + * PG_MODULE_MAGIC; + * so that we can check for obvious incompatibility, such as being compiled + * for a different major PostgreSQL version. Alternatively, write + * PG_MODULE_MAGIC_EXT(...); + * where the optional arguments can specify module name and version, and + * perhaps other values in future. Note that in a multiple-source-file + * module, there should be exactly one such macro call. + * + * You may need an #ifdef test to verify that the version of PostgreSQL + * you are compiling against supports PG_MODULE_MAGIC_EXT(). + * + * The specific items included in the ABI fields are intended to be ones that + * are custom-configurable and especially likely to break dynamically loaded + * modules if they were compiled with other values. Also, the length field + * can be used to detect definition changes. + * + * Note: we compare Pg_abi_values structs with memcmp(), so there had better + * not be any alignment pad bytes in them. + * + * Note: when changing the contents of Pg_abi_values, be sure to adjust the + * incompatible_module_error() function in dfmgr.c. + *------------------------------------------------------------------------- + */ + +/* Definition of the values we check to verify ABI compatibility */ +typedef struct +{ + int version; /* PostgreSQL major version */ + int funcmaxargs; /* FUNC_MAX_ARGS */ + int indexmaxkeys; /* INDEX_MAX_KEYS */ + int namedatalen; /* NAMEDATALEN */ + int float8byval; /* FLOAT8PASSBYVAL */ + char abi_extra[32]; /* see pg_config_manual.h */ +} Pg_abi_values; + +/* Definition of the magic block structure */ +typedef struct +{ + int len; /* sizeof(this struct) */ + Pg_abi_values abi_fields; /* see above */ + /* Remaining fields are zero unless filled via PG_MODULE_MAGIC_EXT */ + const char *name; /* optional module name */ + const char *version; /* optional module version */ +} Pg_magic_struct; + +/* Macro to fill the ABI fields */ +#define PG_MODULE_ABI_DATA \ +{ \ + PG_VERSION_NUM / 100, \ + FUNC_MAX_ARGS, \ + INDEX_MAX_KEYS, \ + NAMEDATALEN, \ + FLOAT8PASSBYVAL, \ + FMGR_ABI_EXTRA, \ +} + +/* + * Macro to fill a magic block. If any arguments are given, they should + * be field initializers. + */ +#define PG_MODULE_MAGIC_DATA(...) \ +{ \ + .len = sizeof(Pg_magic_struct), \ + .abi_fields = PG_MODULE_ABI_DATA, \ + __VA_ARGS__ \ +} + +StaticAssertDecl(sizeof(FMGR_ABI_EXTRA) <= sizeof(((Pg_abi_values *) 0)->abi_extra), + "FMGR_ABI_EXTRA too long"); + +/* + * Declare the module magic function. It needs to be a function as the dlsym + * in the backend is only guaranteed to work on functions, not data + */ +typedef const Pg_magic_struct *(*PGModuleMagicFunction) (void); + +#define PG_MAGIC_FUNCTION_NAME Pg_magic_func +#define PG_MAGIC_FUNCTION_NAME_STRING "Pg_magic_func" + +#define PG_MODULE_MAGIC \ +extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \ +const Pg_magic_struct * \ +PG_MAGIC_FUNCTION_NAME(void) \ +{ \ + static const Pg_magic_struct Pg_magic_data = PG_MODULE_MAGIC_DATA(.name = NULL); \ + return &Pg_magic_data; \ +} \ +extern int no_such_variable + +/* + * Alternate declaration that allows specification of additional fields. + * The additional values should be written as field initializers, for example + * PG_MODULE_MAGIC_EXT( + * .name = "some string", + * .version = "some string" + * ); + */ +#define PG_MODULE_MAGIC_EXT(...) \ +extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \ +const Pg_magic_struct * \ +PG_MAGIC_FUNCTION_NAME(void) \ +{ \ + static const Pg_magic_struct Pg_magic_data = \ + PG_MODULE_MAGIC_DATA(__VA_ARGS__); \ + return &Pg_magic_data; \ +} \ +extern int no_such_variable + + +/*------------------------------------------------------------------------- + * Support routines and macros for callers of fmgr-compatible functions + *------------------------------------------------------------------------- + */ + +/* These are for invocation of a specifically named function with a + * directly-computed parameter list. Note that neither arguments nor result + * are allowed to be NULL. Also, the function cannot be one that needs to + * look at FmgrInfo, since there won't be any. + */ +extern Datum DirectFunctionCall1Coll(PGFunction func, Oid collation, + Datum arg1); +extern Datum DirectFunctionCall2Coll(PGFunction func, Oid collation, + Datum arg1, Datum arg2); +extern Datum DirectFunctionCall3Coll(PGFunction func, Oid collation, + Datum arg1, Datum arg2, + Datum arg3); +extern Datum DirectFunctionCall4Coll(PGFunction func, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4); +extern Datum DirectFunctionCall5Coll(PGFunction func, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5); +extern Datum DirectFunctionCall6Coll(PGFunction func, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6); +extern Datum DirectFunctionCall7Coll(PGFunction func, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6, Datum arg7); +extern Datum DirectFunctionCall8Coll(PGFunction func, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6, Datum arg7, Datum arg8); +extern Datum DirectFunctionCall9Coll(PGFunction func, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6, Datum arg7, Datum arg8, + Datum arg9); + +/* + * These functions work like the DirectFunctionCall functions except that + * they use the flinfo parameter to initialise the fcinfo for the call. + * It's recommended that the callee only use the fn_extra and fn_mcxt + * fields, as other fields will typically describe the calling function + * not the callee. Conversely, the calling function should not have + * used fn_extra, unless its use is known to be compatible with the callee's. + */ +extern Datum CallerFInfoFunctionCall1(PGFunction func, FmgrInfo *flinfo, + Oid collation, Datum arg1); +extern Datum CallerFInfoFunctionCall2(PGFunction func, FmgrInfo *flinfo, + Oid collation, Datum arg1, Datum arg2); + +/* These are for invocation of a previously-looked-up function with a + * directly-computed parameter list. Note that neither arguments nor result + * are allowed to be NULL. + */ +extern Datum FunctionCall0Coll(FmgrInfo *flinfo, Oid collation); +extern Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, + Datum arg1); +extern Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, + Datum arg1, Datum arg2); +extern Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation, + Datum arg1, Datum arg2, + Datum arg3); +extern Datum FunctionCall4Coll(FmgrInfo *flinfo, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4); +extern Datum FunctionCall5Coll(FmgrInfo *flinfo, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5); +extern Datum FunctionCall6Coll(FmgrInfo *flinfo, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6); +extern Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6, Datum arg7); +extern Datum FunctionCall8Coll(FmgrInfo *flinfo, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6, Datum arg7, Datum arg8); +extern Datum FunctionCall9Coll(FmgrInfo *flinfo, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6, Datum arg7, Datum arg8, + Datum arg9); + +/* These are for invocation of a function identified by OID with a + * directly-computed parameter list. Note that neither arguments nor result + * are allowed to be NULL. These are essentially fmgr_info() followed by + * FunctionCallN(). If the same function is to be invoked repeatedly, do the + * fmgr_info() once and then use FunctionCallN(). + */ +extern Datum OidFunctionCall0Coll(Oid functionId, Oid collation); +extern Datum OidFunctionCall1Coll(Oid functionId, Oid collation, + Datum arg1); +extern Datum OidFunctionCall2Coll(Oid functionId, Oid collation, + Datum arg1, Datum arg2); +extern Datum OidFunctionCall3Coll(Oid functionId, Oid collation, + Datum arg1, Datum arg2, + Datum arg3); +extern Datum OidFunctionCall4Coll(Oid functionId, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4); +extern Datum OidFunctionCall5Coll(Oid functionId, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5); +extern Datum OidFunctionCall6Coll(Oid functionId, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6); +extern Datum OidFunctionCall7Coll(Oid functionId, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6, Datum arg7); +extern Datum OidFunctionCall8Coll(Oid functionId, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6, Datum arg7, Datum arg8); +extern Datum OidFunctionCall9Coll(Oid functionId, Oid collation, + Datum arg1, Datum arg2, + Datum arg3, Datum arg4, Datum arg5, + Datum arg6, Datum arg7, Datum arg8, + Datum arg9); + +/* These macros allow the collation argument to be omitted (with a default of + * InvalidOid, ie, no collation). They exist mostly for backwards + * compatibility of source code. + */ +#define DirectFunctionCall1(func, arg1) \ + DirectFunctionCall1Coll(func, InvalidOid, arg1) +#define DirectFunctionCall2(func, arg1, arg2) \ + DirectFunctionCall2Coll(func, InvalidOid, arg1, arg2) +#define DirectFunctionCall3(func, arg1, arg2, arg3) \ + DirectFunctionCall3Coll(func, InvalidOid, arg1, arg2, arg3) +#define DirectFunctionCall4(func, arg1, arg2, arg3, arg4) \ + DirectFunctionCall4Coll(func, InvalidOid, arg1, arg2, arg3, arg4) +#define DirectFunctionCall5(func, arg1, arg2, arg3, arg4, arg5) \ + DirectFunctionCall5Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5) +#define DirectFunctionCall6(func, arg1, arg2, arg3, arg4, arg5, arg6) \ + DirectFunctionCall6Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6) +#define DirectFunctionCall7(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + DirectFunctionCall7Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +#define DirectFunctionCall8(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ + DirectFunctionCall8Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +#define DirectFunctionCall9(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \ + DirectFunctionCall9Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +#define FunctionCall1(flinfo, arg1) \ + FunctionCall1Coll(flinfo, InvalidOid, arg1) +#define FunctionCall2(flinfo, arg1, arg2) \ + FunctionCall2Coll(flinfo, InvalidOid, arg1, arg2) +#define FunctionCall3(flinfo, arg1, arg2, arg3) \ + FunctionCall3Coll(flinfo, InvalidOid, arg1, arg2, arg3) +#define FunctionCall4(flinfo, arg1, arg2, arg3, arg4) \ + FunctionCall4Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4) +#define FunctionCall5(flinfo, arg1, arg2, arg3, arg4, arg5) \ + FunctionCall5Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5) +#define FunctionCall6(flinfo, arg1, arg2, arg3, arg4, arg5, arg6) \ + FunctionCall6Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6) +#define FunctionCall7(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + FunctionCall7Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +#define FunctionCall8(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ + FunctionCall8Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +#define FunctionCall9(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \ + FunctionCall9Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +#define OidFunctionCall0(functionId) \ + OidFunctionCall0Coll(functionId, InvalidOid) +#define OidFunctionCall1(functionId, arg1) \ + OidFunctionCall1Coll(functionId, InvalidOid, arg1) +#define OidFunctionCall2(functionId, arg1, arg2) \ + OidFunctionCall2Coll(functionId, InvalidOid, arg1, arg2) +#define OidFunctionCall3(functionId, arg1, arg2, arg3) \ + OidFunctionCall3Coll(functionId, InvalidOid, arg1, arg2, arg3) +#define OidFunctionCall4(functionId, arg1, arg2, arg3, arg4) \ + OidFunctionCall4Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4) +#define OidFunctionCall5(functionId, arg1, arg2, arg3, arg4, arg5) \ + OidFunctionCall5Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5) +#define OidFunctionCall6(functionId, arg1, arg2, arg3, arg4, arg5, arg6) \ + OidFunctionCall6Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6) +#define OidFunctionCall7(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + OidFunctionCall7Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +#define OidFunctionCall8(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ + OidFunctionCall8Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +#define OidFunctionCall9(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \ + OidFunctionCall9Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) + + +/* Special cases for convenient invocation of datatype I/O functions. */ +extern Datum InputFunctionCall(FmgrInfo *flinfo, char *str, + Oid typioparam, int32 typmod); +extern bool InputFunctionCallSafe(FmgrInfo *flinfo, char *str, + Oid typioparam, int32 typmod, + fmNodePtr escontext, + Datum *result); +extern bool DirectInputFunctionCallSafe(PGFunction func, char *str, + Oid typioparam, int32 typmod, + fmNodePtr escontext, + Datum *result); +extern Datum OidInputFunctionCall(Oid functionId, char *str, + Oid typioparam, int32 typmod); +extern char *OutputFunctionCall(FmgrInfo *flinfo, Datum val); +extern char *OidOutputFunctionCall(Oid functionId, Datum val); +extern Datum ReceiveFunctionCall(FmgrInfo *flinfo, fmStringInfo buf, + Oid typioparam, int32 typmod); +extern Datum OidReceiveFunctionCall(Oid functionId, fmStringInfo buf, + Oid typioparam, int32 typmod); +extern bytea *SendFunctionCall(FmgrInfo *flinfo, Datum val); +extern bytea *OidSendFunctionCall(Oid functionId, Datum val); + + +/* + * Routines in fmgr.c + */ +extern const Pg_finfo_record *fetch_finfo_record(void *filehandle, const char *funcname); +extern Oid fmgr_internal_function(const char *proname); +extern Oid get_fn_expr_rettype(FmgrInfo *flinfo); +extern Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum); +extern Oid get_call_expr_argtype(fmNodePtr expr, int argnum); +extern bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum); +extern bool get_call_expr_arg_stable(fmNodePtr expr, int argnum); +extern bool get_fn_expr_variadic(FmgrInfo *flinfo); +extern bytea *get_fn_opclass_options(FmgrInfo *flinfo); +extern bool has_fn_opclass_options(FmgrInfo *flinfo); +extern void set_fn_opclass_options(FmgrInfo *flinfo, bytea *options); +extern bool CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid); + +/* + * Routines in dfmgr.c + */ +typedef struct DynamicFileList DynamicFileList; /* opaque outside dfmgr.c */ + +extern PGDLLIMPORT char *Dynamic_library_path; + +extern char *substitute_path_macro(const char *str, const char *macro, const char *value); +extern char *find_in_path(const char *basename, const char *path, const char *path_param, + const char *macro, const char *macro_val); +extern void *load_external_function(const char *filename, const char *funcname, + bool signalNotFound, void **filehandle); +extern void *lookup_external_function(void *filehandle, const char *funcname); +extern void load_file(const char *filename, bool restricted); +extern DynamicFileList *get_first_loaded_module(void); +extern DynamicFileList *get_next_loaded_module(DynamicFileList *dfptr); +extern void get_loaded_module_details(DynamicFileList *dfptr, + const char **library_path, + const char **module_name, + const char **module_version); +extern void **find_rendezvous_variable(const char *varName); +extern Size EstimateLibraryStateSpace(void); +extern void SerializeLibraryState(Size maxsize, char *start_address); +extern void RestoreLibraryState(char *start_address); + +/* + * Support for aggregate functions + * + * These are actually in executor/nodeAgg.c, but we declare them here since + * the whole point is for callers to not be overly friendly with nodeAgg. + */ + +/* AggCheckCallContext can return one of the following codes, or 0: */ +#define AGG_CONTEXT_AGGREGATE 1 /* regular aggregate */ +#define AGG_CONTEXT_WINDOW 2 /* window function */ + +extern int AggCheckCallContext(FunctionCallInfo fcinfo, + MemoryContext *aggcontext); +extern fmAggrefPtr AggGetAggref(FunctionCallInfo fcinfo); +extern MemoryContext AggGetTempMemoryContext(FunctionCallInfo fcinfo); +extern bool AggStateIsShared(FunctionCallInfo fcinfo); +extern void AggRegisterCallback(FunctionCallInfo fcinfo, + fmExprContextCallbackFunction func, + Datum arg); + +/* + * We allow plugin modules to hook function entry/exit. This is intended + * as support for loadable security policy modules, which may want to + * perform additional privilege checks on function entry or exit, or to do + * other internal bookkeeping. To make this possible, such modules must be + * able not only to support normal function entry and exit, but also to trap + * the case where we bail out due to an error; and they must also be able to + * prevent inlining. + */ +typedef enum FmgrHookEventType +{ + FHET_START, + FHET_END, + FHET_ABORT, +} FmgrHookEventType; + +typedef bool (*needs_fmgr_hook_type) (Oid fn_oid); + +typedef void (*fmgr_hook_type) (FmgrHookEventType event, + FmgrInfo *flinfo, Datum *arg); + +extern PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook; +extern PGDLLIMPORT fmgr_hook_type fmgr_hook; + +#define FmgrHookIsNeeded(fn_oid) \ + (!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid)) + +#endif /* FMGR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/foreign/fdwapi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/foreign/fdwapi.h new file mode 100644 index 0000000..b4da4e6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/foreign/fdwapi.h @@ -0,0 +1,294 @@ +/*------------------------------------------------------------------------- + * + * fdwapi.h + * API for foreign-data wrappers + * + * Copyright (c) 2010-2025, PostgreSQL Global Development Group + * + * src/include/foreign/fdwapi.h + * + *------------------------------------------------------------------------- + */ +#ifndef FDWAPI_H +#define FDWAPI_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" +#include "nodes/pathnodes.h" + +/* To avoid including explain.h here, reference ExplainState thus: */ +struct ExplainState; + + +/* + * Callback function signatures --- see fdwhandler.sgml for more info. + */ + +typedef void (*GetForeignRelSize_function) (PlannerInfo *root, + RelOptInfo *baserel, + Oid foreigntableid); + +typedef void (*GetForeignPaths_function) (PlannerInfo *root, + RelOptInfo *baserel, + Oid foreigntableid); + +typedef ForeignScan *(*GetForeignPlan_function) (PlannerInfo *root, + RelOptInfo *baserel, + Oid foreigntableid, + ForeignPath *best_path, + List *tlist, + List *scan_clauses, + Plan *outer_plan); + +typedef void (*BeginForeignScan_function) (ForeignScanState *node, + int eflags); + +typedef TupleTableSlot *(*IterateForeignScan_function) (ForeignScanState *node); + +typedef bool (*RecheckForeignScan_function) (ForeignScanState *node, + TupleTableSlot *slot); + +typedef void (*ReScanForeignScan_function) (ForeignScanState *node); + +typedef void (*EndForeignScan_function) (ForeignScanState *node); + +typedef void (*GetForeignJoinPaths_function) (PlannerInfo *root, + RelOptInfo *joinrel, + RelOptInfo *outerrel, + RelOptInfo *innerrel, + JoinType jointype, + JoinPathExtraData *extra); + +typedef void (*GetForeignUpperPaths_function) (PlannerInfo *root, + UpperRelationKind stage, + RelOptInfo *input_rel, + RelOptInfo *output_rel, + void *extra); + +typedef void (*AddForeignUpdateTargets_function) (PlannerInfo *root, + Index rtindex, + RangeTblEntry *target_rte, + Relation target_relation); + +typedef List *(*PlanForeignModify_function) (PlannerInfo *root, + ModifyTable *plan, + Index resultRelation, + int subplan_index); + +typedef void (*BeginForeignModify_function) (ModifyTableState *mtstate, + ResultRelInfo *rinfo, + List *fdw_private, + int subplan_index, + int eflags); + +typedef TupleTableSlot *(*ExecForeignInsert_function) (EState *estate, + ResultRelInfo *rinfo, + TupleTableSlot *slot, + TupleTableSlot *planSlot); + +typedef TupleTableSlot **(*ExecForeignBatchInsert_function) (EState *estate, + ResultRelInfo *rinfo, + TupleTableSlot **slots, + TupleTableSlot **planSlots, + int *numSlots); + +typedef int (*GetForeignModifyBatchSize_function) (ResultRelInfo *rinfo); + +typedef TupleTableSlot *(*ExecForeignUpdate_function) (EState *estate, + ResultRelInfo *rinfo, + TupleTableSlot *slot, + TupleTableSlot *planSlot); + +typedef TupleTableSlot *(*ExecForeignDelete_function) (EState *estate, + ResultRelInfo *rinfo, + TupleTableSlot *slot, + TupleTableSlot *planSlot); + +typedef void (*EndForeignModify_function) (EState *estate, + ResultRelInfo *rinfo); + +typedef void (*BeginForeignInsert_function) (ModifyTableState *mtstate, + ResultRelInfo *rinfo); + +typedef void (*EndForeignInsert_function) (EState *estate, + ResultRelInfo *rinfo); + +typedef int (*IsForeignRelUpdatable_function) (Relation rel); + +typedef bool (*PlanDirectModify_function) (PlannerInfo *root, + ModifyTable *plan, + Index resultRelation, + int subplan_index); + +typedef void (*BeginDirectModify_function) (ForeignScanState *node, + int eflags); + +typedef TupleTableSlot *(*IterateDirectModify_function) (ForeignScanState *node); + +typedef void (*EndDirectModify_function) (ForeignScanState *node); + +typedef RowMarkType (*GetForeignRowMarkType_function) (RangeTblEntry *rte, + LockClauseStrength strength); + +typedef void (*RefetchForeignRow_function) (EState *estate, + ExecRowMark *erm, + Datum rowid, + TupleTableSlot *slot, + bool *updated); + +typedef void (*ExplainForeignScan_function) (ForeignScanState *node, + struct ExplainState *es); + +typedef void (*ExplainForeignModify_function) (ModifyTableState *mtstate, + ResultRelInfo *rinfo, + List *fdw_private, + int subplan_index, + struct ExplainState *es); + +typedef void (*ExplainDirectModify_function) (ForeignScanState *node, + struct ExplainState *es); + +typedef int (*AcquireSampleRowsFunc) (Relation relation, int elevel, + HeapTuple *rows, int targrows, + double *totalrows, + double *totaldeadrows); + +typedef bool (*AnalyzeForeignTable_function) (Relation relation, + AcquireSampleRowsFunc *func, + BlockNumber *totalpages); + +typedef List *(*ImportForeignSchema_function) (ImportForeignSchemaStmt *stmt, + Oid serverOid); + +typedef void (*ExecForeignTruncate_function) (List *rels, + DropBehavior behavior, + bool restart_seqs); + +typedef Size (*EstimateDSMForeignScan_function) (ForeignScanState *node, + ParallelContext *pcxt); +typedef void (*InitializeDSMForeignScan_function) (ForeignScanState *node, + ParallelContext *pcxt, + void *coordinate); +typedef void (*ReInitializeDSMForeignScan_function) (ForeignScanState *node, + ParallelContext *pcxt, + void *coordinate); +typedef void (*InitializeWorkerForeignScan_function) (ForeignScanState *node, + shm_toc *toc, + void *coordinate); +typedef void (*ShutdownForeignScan_function) (ForeignScanState *node); +typedef bool (*IsForeignScanParallelSafe_function) (PlannerInfo *root, + RelOptInfo *rel, + RangeTblEntry *rte); +typedef List *(*ReparameterizeForeignPathByChild_function) (PlannerInfo *root, + List *fdw_private, + RelOptInfo *child_rel); + +typedef bool (*IsForeignPathAsyncCapable_function) (ForeignPath *path); + +typedef void (*ForeignAsyncRequest_function) (AsyncRequest *areq); + +typedef void (*ForeignAsyncConfigureWait_function) (AsyncRequest *areq); + +typedef void (*ForeignAsyncNotify_function) (AsyncRequest *areq); + +/* + * FdwRoutine is the struct returned by a foreign-data wrapper's handler + * function. It provides pointers to the callback functions needed by the + * planner and executor. + * + * More function pointers are likely to be added in the future. Therefore + * it's recommended that the handler initialize the struct with + * makeNode(FdwRoutine) so that all fields are set to NULL. This will + * ensure that no fields are accidentally left undefined. + */ +typedef struct FdwRoutine +{ + NodeTag type; + + /* Functions for scanning foreign tables */ + GetForeignRelSize_function GetForeignRelSize; + GetForeignPaths_function GetForeignPaths; + GetForeignPlan_function GetForeignPlan; + BeginForeignScan_function BeginForeignScan; + IterateForeignScan_function IterateForeignScan; + ReScanForeignScan_function ReScanForeignScan; + EndForeignScan_function EndForeignScan; + + /* + * Remaining functions are optional. Set the pointer to NULL for any that + * are not provided. + */ + + /* Functions for remote-join planning */ + GetForeignJoinPaths_function GetForeignJoinPaths; + + /* Functions for remote upper-relation (post scan/join) planning */ + GetForeignUpperPaths_function GetForeignUpperPaths; + + /* Functions for updating foreign tables */ + AddForeignUpdateTargets_function AddForeignUpdateTargets; + PlanForeignModify_function PlanForeignModify; + BeginForeignModify_function BeginForeignModify; + ExecForeignInsert_function ExecForeignInsert; + ExecForeignBatchInsert_function ExecForeignBatchInsert; + GetForeignModifyBatchSize_function GetForeignModifyBatchSize; + ExecForeignUpdate_function ExecForeignUpdate; + ExecForeignDelete_function ExecForeignDelete; + EndForeignModify_function EndForeignModify; + BeginForeignInsert_function BeginForeignInsert; + EndForeignInsert_function EndForeignInsert; + IsForeignRelUpdatable_function IsForeignRelUpdatable; + PlanDirectModify_function PlanDirectModify; + BeginDirectModify_function BeginDirectModify; + IterateDirectModify_function IterateDirectModify; + EndDirectModify_function EndDirectModify; + + /* Functions for SELECT FOR UPDATE/SHARE row locking */ + GetForeignRowMarkType_function GetForeignRowMarkType; + RefetchForeignRow_function RefetchForeignRow; + RecheckForeignScan_function RecheckForeignScan; + + /* Support functions for EXPLAIN */ + ExplainForeignScan_function ExplainForeignScan; + ExplainForeignModify_function ExplainForeignModify; + ExplainDirectModify_function ExplainDirectModify; + + /* Support functions for ANALYZE */ + AnalyzeForeignTable_function AnalyzeForeignTable; + + /* Support functions for IMPORT FOREIGN SCHEMA */ + ImportForeignSchema_function ImportForeignSchema; + + /* Support functions for TRUNCATE */ + ExecForeignTruncate_function ExecForeignTruncate; + + /* Support functions for parallelism under Gather node */ + IsForeignScanParallelSafe_function IsForeignScanParallelSafe; + EstimateDSMForeignScan_function EstimateDSMForeignScan; + InitializeDSMForeignScan_function InitializeDSMForeignScan; + ReInitializeDSMForeignScan_function ReInitializeDSMForeignScan; + InitializeWorkerForeignScan_function InitializeWorkerForeignScan; + ShutdownForeignScan_function ShutdownForeignScan; + + /* Support functions for path reparameterization. */ + ReparameterizeForeignPathByChild_function ReparameterizeForeignPathByChild; + + /* Support functions for asynchronous execution */ + IsForeignPathAsyncCapable_function IsForeignPathAsyncCapable; + ForeignAsyncRequest_function ForeignAsyncRequest; + ForeignAsyncConfigureWait_function ForeignAsyncConfigureWait; + ForeignAsyncNotify_function ForeignAsyncNotify; +} FdwRoutine; + + +/* Functions in foreign/foreign.c */ +extern FdwRoutine *GetFdwRoutine(Oid fdwhandler); +extern Oid GetForeignServerIdByRelId(Oid relid); +extern FdwRoutine *GetFdwRoutineByServerId(Oid serverid); +extern FdwRoutine *GetFdwRoutineByRelId(Oid relid); +extern FdwRoutine *GetFdwRoutineForRelation(Relation relation, bool makecopy); +extern bool IsImportableForeignTable(const char *tablename, + ImportForeignSchemaStmt *stmt); +extern Path *GetExistingLocalJoinPath(RelOptInfo *joinrel); + +#endif /* FDWAPI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/foreign/foreign.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/foreign/foreign.h new file mode 100644 index 0000000..7e9decd --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/foreign/foreign.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------------------- + * + * foreign.h + * support for foreign-data wrappers, servers and user mappings. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/foreign/foreign.h + * + *------------------------------------------------------------------------- + */ +#ifndef FOREIGN_H +#define FOREIGN_H + +#include "nodes/parsenodes.h" + + +/* Helper for obtaining username for user mapping */ +#define MappingUserName(userid) \ + (OidIsValid(userid) ? GetUserNameFromId(userid, false) : "public") + + +typedef struct ForeignDataWrapper +{ + Oid fdwid; /* FDW Oid */ + Oid owner; /* FDW owner user Oid */ + char *fdwname; /* Name of the FDW */ + Oid fdwhandler; /* Oid of handler function, or 0 */ + Oid fdwvalidator; /* Oid of validator function, or 0 */ + List *options; /* fdwoptions as DefElem list */ +} ForeignDataWrapper; + +typedef struct ForeignServer +{ + Oid serverid; /* server Oid */ + Oid fdwid; /* foreign-data wrapper */ + Oid owner; /* server owner user Oid */ + char *servername; /* name of the server */ + char *servertype; /* server type, optional */ + char *serverversion; /* server version, optional */ + List *options; /* srvoptions as DefElem list */ +} ForeignServer; + +typedef struct UserMapping +{ + Oid umid; /* Oid of user mapping */ + Oid userid; /* local user Oid */ + Oid serverid; /* server Oid */ + List *options; /* useoptions as DefElem list */ +} UserMapping; + +typedef struct ForeignTable +{ + Oid relid; /* relation Oid */ + Oid serverid; /* server Oid */ + List *options; /* ftoptions as DefElem list */ +} ForeignTable; + +/* Flags for GetForeignServerExtended */ +#define FSV_MISSING_OK 0x01 + +/* Flags for GetForeignDataWrapperExtended */ +#define FDW_MISSING_OK 0x01 + + +extern ForeignServer *GetForeignServer(Oid serverid); +extern ForeignServer *GetForeignServerExtended(Oid serverid, + bits16 flags); +extern ForeignServer *GetForeignServerByName(const char *srvname, + bool missing_ok); +extern UserMapping *GetUserMapping(Oid userid, Oid serverid); +extern ForeignDataWrapper *GetForeignDataWrapper(Oid fdwid); +extern ForeignDataWrapper *GetForeignDataWrapperExtended(Oid fdwid, + bits16 flags); +extern ForeignDataWrapper *GetForeignDataWrapperByName(const char *fdwname, + bool missing_ok); +extern ForeignTable *GetForeignTable(Oid relid); + +extern List *GetForeignColumnOptions(Oid relid, AttrNumber attnum); + +extern Oid get_foreign_data_wrapper_oid(const char *fdwname, bool missing_ok); +extern Oid get_foreign_server_oid(const char *servername, bool missing_ok); + +#endif /* FOREIGN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/funcapi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/funcapi.h new file mode 100644 index 0000000..94b89b3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/funcapi.h @@ -0,0 +1,360 @@ +/*------------------------------------------------------------------------- + * + * funcapi.h + * Definitions for functions which return composite type and/or sets + * or work on VARIADIC inputs. + * + * This file must be included by all Postgres modules that either define + * or call FUNCAPI-callable functions or macros. + * + * + * Copyright (c) 2002-2025, PostgreSQL Global Development Group + * + * src/include/funcapi.h + * + *------------------------------------------------------------------------- + */ +#ifndef FUNCAPI_H +#define FUNCAPI_H + +#include "access/tupdesc.h" +#include "executor/executor.h" +#include "executor/tuptable.h" +#include "fmgr.h" + +/*------------------------------------------------------------------------- + * Support to ease writing Functions returning composite types + *------------------------------------------------------------------------- + * + * This struct holds arrays of individual attribute information + * needed to create a tuple from raw C strings. It also requires + * a copy of the TupleDesc. The information carried here + * is derived from the TupleDesc, but it is stored here to + * avoid redundant cpu cycles on each call to an SRF. + */ +typedef struct AttInMetadata +{ + /* full TupleDesc */ + TupleDesc tupdesc; + + /* array of attribute type input function finfo */ + FmgrInfo *attinfuncs; + + /* array of attribute type i/o parameter OIDs */ + Oid *attioparams; + + /* array of attribute typmod */ + int32 *atttypmods; +} AttInMetadata; + +/*------------------------------------------------------------------------- + * Support struct to ease writing Set Returning Functions (SRFs) + *------------------------------------------------------------------------- + * + * This struct holds function context for Set Returning Functions. + * Use fn_extra to hold a pointer to it across calls + */ +typedef struct FuncCallContext +{ + /* + * Number of times we've been called before + * + * call_cntr is initialized to 0 for you by SRF_FIRSTCALL_INIT(), and + * incremented for you every time SRF_RETURN_NEXT() is called. + */ + uint64 call_cntr; + + /* + * OPTIONAL maximum number of calls + * + * max_calls is here for convenience only and setting it is optional. If + * not set, you must provide alternative means to know when the function + * is done. + */ + uint64 max_calls; + + /* + * OPTIONAL pointer to miscellaneous user-provided context information + * + * user_fctx is for use as a pointer to your own struct to retain + * arbitrary context information between calls of your function. + */ + void *user_fctx; + + /* + * OPTIONAL pointer to struct containing attribute type input metadata + * + * attinmeta is for use when returning tuples (i.e. composite data types) + * and is not used when returning base data types. It is only needed if + * you intend to use BuildTupleFromCStrings() to create the return tuple. + */ + AttInMetadata *attinmeta; + + /* + * memory context used for structures that must live for multiple calls + * + * multi_call_memory_ctx is set by SRF_FIRSTCALL_INIT() for you, and used + * by SRF_RETURN_DONE() for cleanup. It is the most appropriate memory + * context for any memory that is to be reused across multiple calls of + * the SRF. + */ + MemoryContext multi_call_memory_ctx; + + /* + * OPTIONAL pointer to struct containing tuple description + * + * tuple_desc is for use when returning tuples (i.e. composite data types) + * and is only needed if you are going to build the tuples with + * heap_form_tuple() rather than with BuildTupleFromCStrings(). Note that + * the TupleDesc pointer stored here should usually have been run through + * BlessTupleDesc() first. + */ + TupleDesc tuple_desc; + +} FuncCallContext; + +/*---------- + * Support to ease writing functions returning composite types + * + * External declarations: + * get_call_result_type: + * Given a function's call info record, determine the kind of datatype + * it is supposed to return. If resultTypeId isn't NULL, *resultTypeId + * receives the actual datatype OID (this is mainly useful for scalar + * result types). If resultTupleDesc isn't NULL, *resultTupleDesc + * receives a pointer to a TupleDesc when the result is of a composite + * type, or NULL when it's a scalar result or the rowtype could not be + * determined. NB: the tupledesc should be copied if it is to be + * accessed over a long period. + * get_expr_result_type: + * Given an expression node, return the same info as for + * get_call_result_type. Note: the cases in which rowtypes cannot be + * determined are different from the cases for get_call_result_type. + * get_func_result_type: + * Given only a function's OID, return the same info as for + * get_call_result_type. Note: the cases in which rowtypes cannot be + * determined are different from the cases for get_call_result_type. + * Do *not* use this if you can use one of the others. + * + * See also get_expr_result_tupdesc(), which is a convenient wrapper around + * get_expr_result_type() for use when the caller only cares about + * determinable-rowtype cases. + *---------- + */ + +/* Type categories for get_call_result_type and siblings */ +typedef enum TypeFuncClass +{ + TYPEFUNC_SCALAR, /* scalar result type */ + TYPEFUNC_COMPOSITE, /* determinable rowtype result */ + TYPEFUNC_COMPOSITE_DOMAIN, /* domain over determinable rowtype result */ + TYPEFUNC_RECORD, /* indeterminate rowtype result */ + TYPEFUNC_OTHER, /* bogus type, eg pseudotype */ +} TypeFuncClass; + +extern TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, + Oid *resultTypeId, + TupleDesc *resultTupleDesc); +extern TypeFuncClass get_expr_result_type(Node *expr, + Oid *resultTypeId, + TupleDesc *resultTupleDesc); +extern TypeFuncClass get_func_result_type(Oid functionId, + Oid *resultTypeId, + TupleDesc *resultTupleDesc); + +extern TupleDesc get_expr_result_tupdesc(Node *expr, bool noError); + +extern bool resolve_polymorphic_argtypes(int numargs, Oid *argtypes, + char *argmodes, + Node *call_expr); + +extern int get_func_arg_info(HeapTuple procTup, + Oid **p_argtypes, char ***p_argnames, + char **p_argmodes); + +extern int get_func_input_arg_names(Datum proargnames, Datum proargmodes, + char ***arg_names); + +extern int get_func_trftypes(HeapTuple procTup, Oid **p_trftypes); +extern char *get_func_result_name(Oid functionId); + +extern TupleDesc build_function_result_tupdesc_d(char prokind, + Datum proallargtypes, + Datum proargmodes, + Datum proargnames); +extern TupleDesc build_function_result_tupdesc_t(HeapTuple procTuple); + + +/*---------- + * Support to ease writing functions returning composite types + * + * External declarations: + * TupleDesc BlessTupleDesc(TupleDesc tupdesc) - "Bless" a completed tuple + * descriptor so that it can be used to return properly labeled tuples. + * You need to call this if you are going to use heap_form_tuple directly. + * TupleDescGetAttInMetadata does it for you, however, so no need to call + * it if you call TupleDescGetAttInMetadata. + * AttInMetadata *TupleDescGetAttInMetadata(TupleDesc tupdesc) - Build an + * AttInMetadata struct based on the given TupleDesc. AttInMetadata can + * be used in conjunction with C strings to produce a properly formed + * tuple. + * HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values) - + * build a HeapTuple given user data in C string form. values is an array + * of C strings, one for each attribute of the return tuple. + * Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple) - convert a + * HeapTupleHeader to a Datum. + * + * Inline declarations: + * HeapTupleGetDatum(HeapTuple tuple) - convert a HeapTuple to a Datum. + * + * Obsolete routines and macros: + * TupleDesc RelationNameGetTupleDesc(const char *relname) - Use to get a + * TupleDesc based on a named relation. + * TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases) - Use to get a + * TupleDesc based on a type OID. + * TupleGetDatum(TupleTableSlot *slot, HeapTuple tuple) - get a Datum + * given a tuple and a slot. + *---------- + */ + +extern TupleDesc RelationNameGetTupleDesc(const char *relname); +extern TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases); + +/* from execTuples.c */ +extern TupleDesc BlessTupleDesc(TupleDesc tupdesc); +extern AttInMetadata *TupleDescGetAttInMetadata(TupleDesc tupdesc); +extern HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values); +extern Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple); + +static inline Datum +HeapTupleGetDatum(const HeapTupleData *tuple) +{ + return HeapTupleHeaderGetDatum(tuple->t_data); +} + +/* obsolete version of above */ +#define TupleGetDatum(_slot, _tuple) HeapTupleGetDatum(_tuple) + + +/*---------- + * Support for Set Returning Functions (SRFs) + * + * The basic API for SRFs using ValuePerCall mode looks something like this: + * + * Datum + * my_Set_Returning_Function(PG_FUNCTION_ARGS) + * { + * FuncCallContext *funcctx; + * Datum result; + * MemoryContext oldcontext; + * + * + * if (SRF_IS_FIRSTCALL()) + * { + * funcctx = SRF_FIRSTCALL_INIT(); + * // switch context when allocating stuff to be used in later calls + * oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); + * + * + * + * + * + * // return to original context when allocating transient memory + * MemoryContextSwitchTo(oldcontext); + * } + * + * funcctx = SRF_PERCALL_SETUP(); + * + * + * if (funcctx->call_cntr < funcctx->max_calls) + * { + * + * + * SRF_RETURN_NEXT(funcctx, result); + * } + * else + * SRF_RETURN_DONE(funcctx); + * } + * + * NOTE: there is no guarantee that a SRF using ValuePerCall mode will be + * run to completion; for example, a query with LIMIT might stop short of + * fetching all the rows. Therefore, do not expect that you can do resource + * cleanup just before SRF_RETURN_DONE(). You need not worry about releasing + * memory allocated in multi_call_memory_ctx, but holding file descriptors or + * other non-memory resources open across calls is a bug. SRFs that need + * such resources should not use these macros, but instead populate a + * tuplestore during a single call, as set up by InitMaterializedSRF() (see + * fmgr/README). Alternatively, set up a callback to release resources + * at query shutdown, using RegisterExprContextCallback(). + * + *---------- + */ + +/* from funcapi.c */ + +/* flag bits for InitMaterializedSRF() */ +#define MAT_SRF_USE_EXPECTED_DESC 0x01 /* use expectedDesc as tupdesc. */ +#define MAT_SRF_BLESS 0x02 /* "Bless" a tuple descriptor with + * BlessTupleDesc(). */ +extern void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags); + +extern FuncCallContext *init_MultiFuncCall(PG_FUNCTION_ARGS); +extern FuncCallContext *per_MultiFuncCall(PG_FUNCTION_ARGS); +extern void end_MultiFuncCall(PG_FUNCTION_ARGS, FuncCallContext *funcctx); + +#define SRF_IS_FIRSTCALL() (fcinfo->flinfo->fn_extra == NULL) + +#define SRF_FIRSTCALL_INIT() init_MultiFuncCall(fcinfo) + +#define SRF_PERCALL_SETUP() per_MultiFuncCall(fcinfo) + +#define SRF_RETURN_NEXT(_funcctx, _result) \ + do { \ + ReturnSetInfo *rsi; \ + (_funcctx)->call_cntr++; \ + rsi = (ReturnSetInfo *) fcinfo->resultinfo; \ + rsi->isDone = ExprMultipleResult; \ + PG_RETURN_DATUM(_result); \ + } while (0) + +#define SRF_RETURN_NEXT_NULL(_funcctx) \ + do { \ + ReturnSetInfo *rsi; \ + (_funcctx)->call_cntr++; \ + rsi = (ReturnSetInfo *) fcinfo->resultinfo; \ + rsi->isDone = ExprMultipleResult; \ + PG_RETURN_NULL(); \ + } while (0) + +#define SRF_RETURN_DONE(_funcctx) \ + do { \ + ReturnSetInfo *rsi; \ + end_MultiFuncCall(fcinfo, _funcctx); \ + rsi = (ReturnSetInfo *) fcinfo->resultinfo; \ + rsi->isDone = ExprEndResult; \ + PG_RETURN_NULL(); \ + } while (0) + +/*---------- + * Support to ease writing of functions dealing with VARIADIC inputs + *---------- + * + * This function extracts a set of argument values, types and NULL markers + * for a given input function. This returns a set of data: + * - **values includes the set of Datum values extracted. + * - **types the data type OID for each element. + * - **nulls tracks if an element is NULL. + * + * variadic_start indicates the argument number where the VARIADIC argument + * starts. + * convert_unknown set to true will enforce the conversion of arguments + * with unknown data type to text. + * + * The return result is the number of elements stored, or -1 in the case of + * "VARIADIC NULL". + */ +extern int extract_variadic_args(FunctionCallInfo fcinfo, int variadic_start, + bool convert_unknown, Datum **args, + Oid **types, bool **nulls); + +#endif /* FUNCAPI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/getopt_long.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/getopt_long.h new file mode 100644 index 0000000..e7bdf90 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/getopt_long.h @@ -0,0 +1,37 @@ +/* + * Portions Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Portions Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/getopt_long.h + */ +/* IWYU pragma: always_keep */ +#ifndef GETOPT_LONG_H +#define GETOPT_LONG_H + +#include "pg_getopt.h" /* IWYU pragma: export */ + +#ifndef HAVE_STRUCT_OPTION + +struct option +{ + const char *name; + int has_arg; + int *flag; + int val; +}; + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 +#endif + +#ifndef HAVE_GETOPT_LONG + +extern int getopt_long(int argc, char *const argv[], + const char *optstring, + const struct option *longopts, int *longindex); +#endif + +#endif /* GETOPT_LONG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/SectionMemoryManager.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/SectionMemoryManager.h new file mode 100644 index 0000000..924a99b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/SectionMemoryManager.h @@ -0,0 +1,226 @@ +/* + * This is a copy LLVM source code modified by the PostgreSQL project. + * See SectionMemoryManager.cpp for notes on provenance and license. + */ + +//===- SectionMemoryManager.h - Memory manager for MCJIT/RtDyld -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains the declaration of a section-based memory manager used by +// the MCJIT execution engine and RuntimeDyld. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_EXECUTIONENGINE_BACKPORT_SECTIONMEMORYMANAGER_H +#define LLVM_EXECUTIONENGINE_BACKPORT_SECTIONMEMORYMANAGER_H + +#include +#include +#include +#include +#include +#include +#include + +namespace llvm { +namespace backport { + +/// This is a simple memory manager which implements the methods called by +/// the RuntimeDyld class to allocate memory for section-based loading of +/// objects, usually those generated by the MCJIT execution engine. +/// +/// This memory manager allocates all section memory as read-write. The +/// RuntimeDyld will copy JITed section memory into these allocated blocks +/// and perform any necessary linking and relocations. +/// +/// Any client using this memory manager MUST ensure that section-specific +/// page permissions have been applied before attempting to execute functions +/// in the JITed object. Permissions can be applied either by calling +/// MCJIT::finalizeObject or by calling SectionMemoryManager::finalizeMemory +/// directly. Clients of MCJIT should call MCJIT::finalizeObject. +class SectionMemoryManager : public RTDyldMemoryManager { +public: + /// This enum describes the various reasons to allocate pages from + /// allocateMappedMemory. + enum class AllocationPurpose { + Code, + ROData, + RWData, + }; + + /// Implementations of this interface are used by SectionMemoryManager to + /// request pages from the operating system. + class MemoryMapper { + public: + /// This method attempts to allocate \p NumBytes bytes of virtual memory for + /// \p Purpose. \p NearBlock may point to an existing allocation, in which + /// case an attempt is made to allocate more memory near the existing block. + /// The actual allocated address is not guaranteed to be near the requested + /// address. \p Flags is used to set the initial protection flags for the + /// block of the memory. \p EC [out] returns an object describing any error + /// that occurs. + /// + /// This method may allocate more than the number of bytes requested. The + /// actual number of bytes allocated is indicated in the returned + /// MemoryBlock. + /// + /// The start of the allocated block must be aligned with the system + /// allocation granularity (64K on Windows, page size on Linux). If the + /// address following \p NearBlock is not so aligned, it will be rounded up + /// to the next allocation granularity boundary. + /// + /// \r a non-null MemoryBlock if the function was successful, otherwise a + /// null MemoryBlock with \p EC describing the error. + virtual sys::MemoryBlock + allocateMappedMemory(AllocationPurpose Purpose, size_t NumBytes, + const sys::MemoryBlock *const NearBlock, + unsigned Flags, std::error_code &EC) = 0; + + /// This method sets the protection flags for a block of memory to the state + /// specified by \p Flags. The behavior is not specified if the memory was + /// not allocated using the allocateMappedMemory method. + /// \p Block describes the memory block to be protected. + /// \p Flags specifies the new protection state to be assigned to the block. + /// + /// If \p Flags is MF_WRITE, the actual behavior varies with the operating + /// system (i.e. MF_READ | MF_WRITE on Windows) and the target architecture + /// (i.e. MF_WRITE -> MF_READ | MF_WRITE on i386). + /// + /// \r error_success if the function was successful, or an error_code + /// describing the failure if an error occurred. + virtual std::error_code protectMappedMemory(const sys::MemoryBlock &Block, + unsigned Flags) = 0; + + /// This method releases a block of memory that was allocated with the + /// allocateMappedMemory method. It should not be used to release any memory + /// block allocated any other way. + /// \p Block describes the memory to be released. + /// + /// \r error_success if the function was successful, or an error_code + /// describing the failure if an error occurred. + virtual std::error_code releaseMappedMemory(sys::MemoryBlock &M) = 0; + + virtual ~MemoryMapper(); + }; + + /// Creates a SectionMemoryManager instance with \p MM as the associated + /// memory mapper. If \p MM is nullptr then a default memory mapper is used + /// that directly calls into the operating system. + /// + /// If \p ReserveAlloc is true all memory will be pre-allocated, and any + /// attempts to allocate beyond pre-allocated memory will fail. + SectionMemoryManager(MemoryMapper *MM = nullptr, bool ReserveAlloc = false); + SectionMemoryManager(const SectionMemoryManager &) = delete; + void operator=(const SectionMemoryManager &) = delete; + ~SectionMemoryManager() override; + + /// Enable reserveAllocationSpace when requested. + bool needsToReserveAllocationSpace() override { return ReserveAllocation; } + + /// Implements allocating all memory in a single block. This is required to + /// limit memory offsets to fit the ARM ABI; large memory systems may + /// otherwise allocate separate sections too far apart. +#if LLVM_VERSION_MAJOR < 16 + virtual void reserveAllocationSpace(uintptr_t CodeSize, uint32_t CodeAlign, + uintptr_t RODataSize, + uint32_t RODataAlign, + uintptr_t RWDataSize, + uint32_t RWDataAlign) override; +#else + void reserveAllocationSpace(uintptr_t CodeSize, Align CodeAlign, + uintptr_t RODataSize, Align RODataAlign, + uintptr_t RWDataSize, Align RWDataAlign) override; +#endif + + /// Allocates a memory block of (at least) the given size suitable for + /// executable code. + /// + /// The value of \p Alignment must be a power of two. If \p Alignment is zero + /// a default alignment of 16 will be used. + uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, + unsigned SectionID, + StringRef SectionName) override; + + /// Allocates a memory block of (at least) the given size suitable for + /// executable code. + /// + /// The value of \p Alignment must be a power of two. If \p Alignment is zero + /// a default alignment of 16 will be used. + uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, + unsigned SectionID, StringRef SectionName, + bool IsReadOnly) override; + + /// Update section-specific memory permissions and other attributes. + /// + /// This method is called when object loading is complete and section page + /// permissions can be applied. It is up to the memory manager implementation + /// to decide whether or not to act on this method. The memory manager will + /// typically allocate all sections as read-write and then apply specific + /// permissions when this method is called. Code sections cannot be executed + /// until this function has been called. In addition, any cache coherency + /// operations needed to reliably use the memory are also performed. + /// + /// \returns true if an error occurred, false otherwise. + bool finalizeMemory(std::string *ErrMsg = nullptr) override; + + /// Invalidate instruction cache for code sections. + /// + /// Some platforms with separate data cache and instruction cache require + /// explicit cache flush, otherwise JIT code manipulations (like resolved + /// relocations) will get to the data cache but not to the instruction cache. + /// + /// This method is called from finalizeMemory. + virtual void invalidateInstructionCache(); + +private: + struct FreeMemBlock { + // The actual block of free memory + sys::MemoryBlock Free; + // If there is a pending allocation from the same reservation right before + // this block, store its index in PendingMem, to be able to update the + // pending region if part of this block is allocated, rather than having to + // create a new one + unsigned PendingPrefixIndex; + }; + + struct MemoryGroup { + // PendingMem contains all blocks of memory (subblocks of AllocatedMem) + // which have not yet had their permissions applied, but have been given + // out to the user. FreeMem contains all block of memory, which have + // neither had their permissions applied, nor been given out to the user. + SmallVector PendingMem; + SmallVector FreeMem; + + // All memory blocks that have been requested from the system + SmallVector AllocatedMem; + + sys::MemoryBlock Near; + }; + + uint8_t *allocateSection(AllocationPurpose Purpose, uintptr_t Size, + unsigned Alignment); + + std::error_code applyMemoryGroupPermissions(MemoryGroup &MemGroup, + unsigned Permissions); + + bool hasSpace(const MemoryGroup &MemGroup, uintptr_t Size) const; + + void anchor() override; + + MemoryGroup CodeMem; + MemoryGroup RWDataMem; + MemoryGroup RODataMem; + MemoryMapper *MMapper; + std::unique_ptr OwnedMMapper; + bool ReserveAllocation; +}; + +} // end namespace backport +} // end namespace llvm + +#endif // LLVM_EXECUTIONENGINE_BACKPORT_SECTIONMEMORYMANAGER_H diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/jit.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/jit.h new file mode 100644 index 0000000..33cb36c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/jit.h @@ -0,0 +1,106 @@ +/*------------------------------------------------------------------------- + * jit.h + * Provider independent JIT infrastructure. + * + * Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/jit/jit.h + * + *------------------------------------------------------------------------- + */ +#ifndef JIT_H +#define JIT_H + +#include "executor/instrument.h" +#include "utils/resowner.h" + + +/* Flags determining what kind of JIT operations to perform */ +#define PGJIT_NONE 0 +#define PGJIT_PERFORM (1 << 0) +#define PGJIT_OPT3 (1 << 1) +#define PGJIT_INLINE (1 << 2) +#define PGJIT_EXPR (1 << 3) +#define PGJIT_DEFORM (1 << 4) + + +typedef struct JitInstrumentation +{ + /* number of emitted functions */ + size_t created_functions; + + /* accumulated time to generate code */ + instr_time generation_counter; + + /* accumulated time to deform tuples, included into generation_counter */ + instr_time deform_counter; + + /* accumulated time for inlining */ + instr_time inlining_counter; + + /* accumulated time for optimization */ + instr_time optimization_counter; + + /* accumulated time for code emission */ + instr_time emission_counter; +} JitInstrumentation; + +/* + * DSM structure for accumulating jit instrumentation of all workers. + */ +typedef struct SharedJitInstrumentation +{ + int num_workers; + JitInstrumentation jit_instr[FLEXIBLE_ARRAY_MEMBER]; +} SharedJitInstrumentation; + +typedef struct JitContext +{ + /* see PGJIT_* above */ + int flags; + + JitInstrumentation instr; +} JitContext; + +typedef struct JitProviderCallbacks JitProviderCallbacks; + +extern PGDLLEXPORT void _PG_jit_provider_init(JitProviderCallbacks *cb); +typedef void (*JitProviderInit) (JitProviderCallbacks *cb); +typedef void (*JitProviderResetAfterErrorCB) (void); +typedef void (*JitProviderReleaseContextCB) (JitContext *context); +struct ExprState; +typedef bool (*JitProviderCompileExprCB) (struct ExprState *state); + +struct JitProviderCallbacks +{ + JitProviderResetAfterErrorCB reset_after_error; + JitProviderReleaseContextCB release_context; + JitProviderCompileExprCB compile_expr; +}; + + +/* GUCs */ +extern PGDLLIMPORT bool jit_enabled; +extern PGDLLIMPORT char *jit_provider; +extern PGDLLIMPORT bool jit_debugging_support; +extern PGDLLIMPORT bool jit_dump_bitcode; +extern PGDLLIMPORT bool jit_expressions; +extern PGDLLIMPORT bool jit_profiling_support; +extern PGDLLIMPORT bool jit_tuple_deforming; +extern PGDLLIMPORT double jit_above_cost; +extern PGDLLIMPORT double jit_inline_above_cost; +extern PGDLLIMPORT double jit_optimize_above_cost; + + +extern void jit_reset_after_error(void); +extern void jit_release_context(JitContext *context); + +/* + * Functions for attempting to JIT code. Callers must accept that these might + * not be able to perform JIT (i.e. return false). + */ +extern bool jit_compile_expr(struct ExprState *state); +extern void InstrJitAgg(JitInstrumentation *dst, JitInstrumentation *add); + + +#endif /* JIT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/llvmjit.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/llvmjit.h new file mode 100644 index 0000000..5038cf3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/llvmjit.h @@ -0,0 +1,152 @@ +/*------------------------------------------------------------------------- + * llvmjit.h + * LLVM JIT provider. + * + * Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/jit/llvmjit.h + * + *------------------------------------------------------------------------- + */ +#ifndef LLVMJIT_H +#define LLVMJIT_H + +/* + * To avoid breaking cpluspluscheck, allow including the file even when LLVM + * is not available. + */ +#ifdef USE_LLVM + +#include "jit/llvmjit_backport.h" + +#include +#ifdef USE_LLVM_BACKPORT_SECTION_MEMORY_MANAGER +#include +#endif + + +/* + * File needs to be includable by both C and C++ code, and include other + * headers doing the same. Therefore wrap C portion in our own extern "C" if + * in C++ mode. + */ +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "access/tupdesc.h" +#include "fmgr.h" +#include "jit/jit.h" +#include "nodes/pg_list.h" + +typedef struct LLVMJitContext +{ + JitContext base; + + /* used to ensure cleanup of context */ + ResourceOwner resowner; + + /* number of modules created */ + size_t module_generation; + + /* + * The LLVM Context used by this JIT context. An LLVM context is reused + * across many compilations, but occasionally reset to prevent it using + * too much memory due to more and more types accumulating. + */ + LLVMContextRef llvm_context; + + /* current, "open for write", module */ + LLVMModuleRef module; + + /* is there any pending code that needs to be emitted */ + bool compiled; + + /* # of objects emitted, used to generate non-conflicting names */ + int counter; + + /* list of handles for code emitted via Orc */ + List *handles; +} LLVMJitContext; + +/* type and struct definitions */ +extern PGDLLIMPORT LLVMTypeRef TypeParamBool; +extern PGDLLIMPORT LLVMTypeRef TypePGFunction; +extern PGDLLIMPORT LLVMTypeRef TypeSizeT; +extern PGDLLIMPORT LLVMTypeRef TypeStorageBool; + +extern PGDLLIMPORT LLVMTypeRef StructNullableDatum; +extern PGDLLIMPORT LLVMTypeRef StructTupleDescData; +extern PGDLLIMPORT LLVMTypeRef StructHeapTupleData; +extern PGDLLIMPORT LLVMTypeRef StructHeapTupleHeaderData; +extern PGDLLIMPORT LLVMTypeRef StructMinimalTupleData; +extern PGDLLIMPORT LLVMTypeRef StructTupleTableSlot; +extern PGDLLIMPORT LLVMTypeRef StructHeapTupleTableSlot; +extern PGDLLIMPORT LLVMTypeRef StructMinimalTupleTableSlot; +extern PGDLLIMPORT LLVMTypeRef StructMemoryContextData; +extern PGDLLIMPORT LLVMTypeRef StructFunctionCallInfoData; +extern PGDLLIMPORT LLVMTypeRef StructExprContext; +extern PGDLLIMPORT LLVMTypeRef StructExprEvalStep; +extern PGDLLIMPORT LLVMTypeRef StructExprState; +extern PGDLLIMPORT LLVMTypeRef StructAggState; +extern PGDLLIMPORT LLVMTypeRef StructAggStatePerTransData; +extern PGDLLIMPORT LLVMTypeRef StructAggStatePerGroupData; +extern PGDLLIMPORT LLVMTypeRef StructPlanState; + +extern PGDLLIMPORT LLVMValueRef AttributeTemplate; +extern PGDLLIMPORT LLVMValueRef ExecEvalBoolSubroutineTemplate; +extern PGDLLIMPORT LLVMValueRef ExecEvalSubroutineTemplate; + + +extern void llvm_enter_fatal_on_oom(void); +extern void llvm_leave_fatal_on_oom(void); +extern bool llvm_in_fatal_on_oom(void); +extern void llvm_reset_after_error(void); +extern void llvm_assert_in_fatal_section(void); + +extern LLVMJitContext *llvm_create_context(int jitFlags); +extern LLVMModuleRef llvm_mutable_module(LLVMJitContext *context); +extern char *llvm_expand_funcname(LLVMJitContext *context, const char *basename); +extern void *llvm_get_function(LLVMJitContext *context, const char *funcname); +extern void llvm_split_symbol_name(const char *name, char **modname, char **funcname); +extern LLVMTypeRef llvm_pg_var_type(const char *varname); +extern LLVMTypeRef llvm_pg_var_func_type(const char *varname); +extern LLVMValueRef llvm_pg_func(LLVMModuleRef mod, const char *funcname); +extern void llvm_copy_attributes(LLVMValueRef from, LLVMValueRef to); +extern LLVMValueRef llvm_function_reference(LLVMJitContext *context, + LLVMBuilderRef builder, + LLVMModuleRef mod, + FunctionCallInfo fcinfo); + +extern void llvm_inline_reset_caches(void); +extern void llvm_inline(LLVMModuleRef mod); + +/* + **************************************************************************** + * Code generation functions. + **************************************************************************** + */ +extern bool llvm_compile_expr(struct ExprState *state); +struct TupleTableSlotOps; +extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDesc desc, + const struct TupleTableSlotOps *ops, int natts); + +/* + **************************************************************************** + * Extensions / Backward compatibility section of the LLVM C API + * Error handling related functions. + **************************************************************************** + */ +extern LLVMTypeRef LLVMGetFunctionReturnType(LLVMValueRef r); +extern LLVMTypeRef LLVMGetFunctionType(LLVMValueRef r); +#ifdef USE_LLVM_BACKPORT_SECTION_MEMORY_MANAGER +extern LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSafeSectionMemoryManager(LLVMOrcExecutionSessionRef ES); +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* USE_LLVM */ +#endif /* LLVMJIT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/llvmjit_backport.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/llvmjit_backport.h new file mode 100644 index 0000000..cba8eaf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/llvmjit_backport.h @@ -0,0 +1,22 @@ +/* + * A small header than can be included by backported LLVM code or PostgreSQL + * code, to control conditional compilation. + */ +#ifndef LLVMJIT_BACKPORT_H +#define LLVMJIT_BACKPORT_H + +#include + +/* + * LLVM's RuntimeDyld can produce code that crashes on larger memory ARM + * systems, because llvm::SectionMemoryManager allocates multiple pieces of + * memory that can be placed too far apart for the generated code. See + * src/backend/jit/llvm/SectionMemoryManager.cpp for the patched replacement + * class llvm::backport::SectionMemoryManager that we use as a workaround. + * This header controls whether we use it. + */ +#if defined(__aarch64__) +#define USE_LLVM_BACKPORT_SECTION_MEMORY_MANAGER +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/llvmjit_emit.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/llvmjit_emit.h new file mode 100644 index 0000000..df5a9fc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/jit/llvmjit_emit.h @@ -0,0 +1,320 @@ +/* + * llvmjit_emit.h + * Helpers to make emitting LLVM IR a bit more concise and pgindent proof. + * + * Copyright (c) 2018-2025, PostgreSQL Global Development Group + * + * src/include/jit/llvmjit_emit.h + */ +#ifndef LLVMJIT_EMIT_H +#define LLVMJIT_EMIT_H + +/* + * To avoid breaking cpluspluscheck, allow including the file even when LLVM + * is not available. + */ +#ifdef USE_LLVM + +#include +#include + +#include "jit/llvmjit.h" + + +/* + * Emit a non-LLVM pointer as an LLVM constant. + */ +static inline LLVMValueRef +l_ptr_const(void *ptr, LLVMTypeRef type) +{ + LLVMValueRef c = LLVMConstInt(TypeSizeT, (uintptr_t) ptr, false); + + return LLVMConstIntToPtr(c, type); +} + +/* + * Emit pointer. + */ +static inline LLVMTypeRef +l_ptr(LLVMTypeRef t) +{ + return LLVMPointerType(t, 0); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_int8_const(LLVMContextRef lc, int8 i) +{ + return LLVMConstInt(LLVMInt8TypeInContext(lc), i, false); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_int16_const(LLVMContextRef lc, int16 i) +{ + return LLVMConstInt(LLVMInt16TypeInContext(lc), i, false); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_int32_const(LLVMContextRef lc, int32 i) +{ + return LLVMConstInt(LLVMInt32TypeInContext(lc), i, false); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_int64_const(LLVMContextRef lc, int64 i) +{ + return LLVMConstInt(LLVMInt64TypeInContext(lc), i, false); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_sizet_const(size_t i) +{ + return LLVMConstInt(TypeSizeT, i, false); +} + +/* + * Emit constant boolean, as used for storage (e.g. global vars, structs). + */ +static inline LLVMValueRef +l_sbool_const(bool i) +{ + return LLVMConstInt(TypeStorageBool, (int) i, false); +} + +/* + * Emit constant boolean, as used for parameters (e.g. function parameters). + */ +static inline LLVMValueRef +l_pbool_const(bool i) +{ + return LLVMConstInt(TypeParamBool, (int) i, false); +} + +static inline LLVMValueRef +l_struct_gep(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, int32 idx, const char *name) +{ + return LLVMBuildStructGEP2(b, t, v, idx, ""); +} + +static inline LLVMValueRef +l_gep(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, LLVMValueRef *indices, int32 nindices, const char *name) +{ + return LLVMBuildGEP2(b, t, v, indices, nindices, name); +} + +static inline LLVMValueRef +l_load(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, const char *name) +{ + return LLVMBuildLoad2(b, t, v, name); +} + +static inline LLVMValueRef +l_call(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef fn, LLVMValueRef *args, int32 nargs, const char *name) +{ + return LLVMBuildCall2(b, t, fn, args, nargs, name); +} + +/* + * Load a pointer member idx from a struct. + */ +static inline LLVMValueRef +l_load_struct_gep(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, int32 idx, const char *name) +{ + return l_load(b, + LLVMStructGetTypeAtIndex(t, idx), + l_struct_gep(b, t, v, idx, ""), + name); +} + +/* + * Load value of a pointer, after applying one index operation. + */ +static inline LLVMValueRef +l_load_gep1(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, LLVMValueRef idx, const char *name) +{ + return l_load(b, t, l_gep(b, t, v, &idx, 1, ""), name); +} + +/* separate, because pg_attribute_printf(2, 3) can't appear in definition */ +static inline LLVMBasicBlockRef l_bb_before_v(LLVMBasicBlockRef r, const char *fmt,...) pg_attribute_printf(2, 3); + +/* + * Insert a new basic block, just before r, the name being determined by fmt + * and arguments. + */ +static inline LLVMBasicBlockRef +l_bb_before_v(LLVMBasicBlockRef r, const char *fmt,...) +{ + char buf[512]; + va_list args; + LLVMContextRef lc; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + lc = LLVMGetTypeContext(LLVMTypeOf(LLVMGetBasicBlockParent(r))); + + return LLVMInsertBasicBlockInContext(lc, r, buf); +} + +/* separate, because pg_attribute_printf(2, 3) can't appear in definition */ +static inline LLVMBasicBlockRef l_bb_append_v(LLVMValueRef f, const char *fmt,...) pg_attribute_printf(2, 3); + +/* + * Insert a new basic block after previous basic blocks, the name being + * determined by fmt and arguments. + */ +static inline LLVMBasicBlockRef +l_bb_append_v(LLVMValueRef f, const char *fmt,...) +{ + char buf[512]; + va_list args; + LLVMContextRef lc; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + lc = LLVMGetTypeContext(LLVMTypeOf(f)); + + return LLVMAppendBasicBlockInContext(lc, f, buf); +} + +/* + * Mark a callsite as readonly. + */ +static inline void +l_callsite_ro(LLVMValueRef f) +{ + const char argname[] = "readonly"; + LLVMAttributeRef ref; + + ref = LLVMCreateStringAttribute(LLVMGetTypeContext(LLVMTypeOf(f)), + argname, + sizeof(argname) - 1, + NULL, 0); + + LLVMAddCallSiteAttribute(f, LLVMAttributeFunctionIndex, ref); +} + +/* + * Mark a callsite as alwaysinline. + */ +static inline void +l_callsite_alwaysinline(LLVMValueRef f) +{ + const char argname[] = "alwaysinline"; + int id; + LLVMAttributeRef attr; + + id = LLVMGetEnumAttributeKindForName(argname, + sizeof(argname) - 1); + attr = LLVMCreateEnumAttribute(LLVMGetTypeContext(LLVMTypeOf(f)), id, 0); + LLVMAddCallSiteAttribute(f, LLVMAttributeFunctionIndex, attr); +} + +/* + * Emit code to switch memory context. + */ +static inline LLVMValueRef +l_mcxt_switch(LLVMModuleRef mod, LLVMBuilderRef b, LLVMValueRef nc) +{ + const char *cmc = "CurrentMemoryContext"; + LLVMValueRef cur; + LLVMValueRef ret; + + if (!(cur = LLVMGetNamedGlobal(mod, cmc))) + cur = LLVMAddGlobal(mod, l_ptr(StructMemoryContextData), cmc); + ret = l_load(b, l_ptr(StructMemoryContextData), cur, cmc); + LLVMBuildStore(b, nc, cur); + + return ret; +} + +/* + * Return pointer to the argno'th argument nullness. + */ +static inline LLVMValueRef +l_funcnullp(LLVMBuilderRef b, LLVMValueRef v_fcinfo, size_t argno) +{ + LLVMValueRef v_args; + LLVMValueRef v_argn; + + v_args = l_struct_gep(b, + StructFunctionCallInfoData, + v_fcinfo, + FIELDNO_FUNCTIONCALLINFODATA_ARGS, + ""); + v_argn = l_struct_gep(b, + LLVMArrayType(StructNullableDatum, 0), + v_args, + argno, + ""); + return l_struct_gep(b, + StructNullableDatum, + v_argn, + FIELDNO_NULLABLE_DATUM_ISNULL, + ""); +} + +/* + * Return pointer to the argno'th argument datum. + */ +static inline LLVMValueRef +l_funcvaluep(LLVMBuilderRef b, LLVMValueRef v_fcinfo, size_t argno) +{ + LLVMValueRef v_args; + LLVMValueRef v_argn; + + v_args = l_struct_gep(b, + StructFunctionCallInfoData, + v_fcinfo, + FIELDNO_FUNCTIONCALLINFODATA_ARGS, + ""); + v_argn = l_struct_gep(b, + LLVMArrayType(StructNullableDatum, 0), + v_args, + argno, + ""); + return l_struct_gep(b, + StructNullableDatum, + v_argn, + FIELDNO_NULLABLE_DATUM_DATUM, + ""); +} + +/* + * Return argno'th argument nullness. + */ +static inline LLVMValueRef +l_funcnull(LLVMBuilderRef b, LLVMValueRef v_fcinfo, size_t argno) +{ + return l_load(b, TypeStorageBool, l_funcnullp(b, v_fcinfo, argno), ""); +} + +/* + * Return argno'th argument datum. + */ +static inline LLVMValueRef +l_funcvalue(LLVMBuilderRef b, LLVMValueRef v_fcinfo, size_t argno) +{ + return l_load(b, TypeSizeT, l_funcvaluep(b, v_fcinfo, argno), ""); +} + +#endif /* USE_LLVM */ +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/binaryheap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/binaryheap.h new file mode 100644 index 0000000..e8a575e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/binaryheap.h @@ -0,0 +1,69 @@ +/* + * binaryheap.h + * + * A simple binary heap implementation + * + * Portions Copyright (c) 2012-2025, PostgreSQL Global Development Group + * + * src/include/lib/binaryheap.h + */ + +#ifndef BINARYHEAP_H +#define BINARYHEAP_H + +/* + * We provide a Datum-based API for backend code and a void *-based API for + * frontend code (since the Datum definitions are not available to frontend + * code). You should typically avoid using bh_node_type directly and instead + * use Datum or void * as appropriate. + */ +#ifdef FRONTEND +typedef void *bh_node_type; +#else +typedef Datum bh_node_type; +#endif + +/* + * For a max-heap, the comparator must return <0 iff a < b, 0 iff a == b, + * and >0 iff a > b. For a min-heap, the conditions are reversed. + */ +typedef int (*binaryheap_comparator) (bh_node_type a, bh_node_type b, void *arg); + +/* + * binaryheap + * + * bh_size how many nodes are currently in "nodes" + * bh_space how many nodes can be stored in "nodes" + * bh_has_heap_property no unordered operations since last heap build + * bh_compare comparison function to define the heap property + * bh_arg user data for comparison function + * bh_nodes variable-length array of "space" nodes + */ +typedef struct binaryheap +{ + int bh_size; + int bh_space; + bool bh_has_heap_property; /* debugging cross-check */ + binaryheap_comparator bh_compare; + void *bh_arg; + bh_node_type bh_nodes[FLEXIBLE_ARRAY_MEMBER]; +} binaryheap; + +extern binaryheap *binaryheap_allocate(int capacity, + binaryheap_comparator compare, + void *arg); +extern void binaryheap_reset(binaryheap *heap); +extern void binaryheap_free(binaryheap *heap); +extern void binaryheap_add_unordered(binaryheap *heap, bh_node_type d); +extern void binaryheap_build(binaryheap *heap); +extern void binaryheap_add(binaryheap *heap, bh_node_type d); +extern bh_node_type binaryheap_first(binaryheap *heap); +extern bh_node_type binaryheap_remove_first(binaryheap *heap); +extern void binaryheap_remove_node(binaryheap *heap, int n); +extern void binaryheap_replace_first(binaryheap *heap, bh_node_type d); + +#define binaryheap_empty(h) ((h)->bh_size == 0) +#define binaryheap_size(h) ((h)->bh_size) +#define binaryheap_get_node(h, n) ((h)->bh_nodes[n]) + +#endif /* BINARYHEAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/bipartite_match.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/bipartite_match.h new file mode 100644 index 0000000..3ad8494 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/bipartite_match.h @@ -0,0 +1,46 @@ +/* + * bipartite_match.h + * + * Copyright (c) 2015-2025, PostgreSQL Global Development Group + * + * src/include/lib/bipartite_match.h + */ +#ifndef BIPARTITE_MATCH_H +#define BIPARTITE_MATCH_H + +/* + * Given a bipartite graph consisting of nodes U numbered 1..nU, nodes V + * numbered 1..nV, and an adjacency map of undirected edges in the form + * adjacency[u] = [k, v1, v2, v3, ... vk], we wish to find a "maximum + * cardinality matching", which is defined as follows: a matching is a subset + * of the original edges such that no node has more than one edge, and a + * matching has maximum cardinality if there exists no other matching with a + * greater number of edges. + * + * This matching has various applications in graph theory, but the motivating + * example here is Dilworth's theorem: a partially-ordered set can be divided + * into the minimum number of chains (i.e. subsets X where x1 < x2 < x3 ...) by + * a bipartite graph construction. This gives us a polynomial-time solution to + * the problem of planning a collection of grouping sets with the provably + * minimal number of sort operations. + */ +typedef struct BipartiteMatchState +{ + /* inputs: */ + int u_size; /* size of U */ + int v_size; /* size of V */ + short **adjacency; /* adjacency[u] = [k, v1,v2,v3,...,vk] */ + /* outputs: */ + int matching; /* number of edges in matching */ + short *pair_uv; /* pair_uv[u] -> v */ + short *pair_vu; /* pair_vu[v] -> u */ + /* private state for matching algorithm: */ + short *distance; /* distance[u] */ + short *queue; /* queue storage for breadth search */ +} BipartiteMatchState; + +extern BipartiteMatchState *BipartiteMatch(int u_size, int v_size, short **adjacency); + +extern void BipartiteMatchFree(BipartiteMatchState *state); + +#endif /* BIPARTITE_MATCH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/bloomfilter.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/bloomfilter.h new file mode 100644 index 0000000..dd9fddd --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/bloomfilter.h @@ -0,0 +1,27 @@ +/*------------------------------------------------------------------------- + * + * bloomfilter.h + * Space-efficient set membership testing + * + * Copyright (c) 2018-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/lib/bloomfilter.h + * + *------------------------------------------------------------------------- + */ +#ifndef BLOOMFILTER_H +#define BLOOMFILTER_H + +typedef struct bloom_filter bloom_filter; + +extern bloom_filter *bloom_create(int64 total_elems, int bloom_work_mem, + uint64 seed); +extern void bloom_free(bloom_filter *filter); +extern void bloom_add_element(bloom_filter *filter, unsigned char *elem, + size_t len); +extern bool bloom_lacks_element(bloom_filter *filter, unsigned char *elem, + size_t len); +extern double bloom_prop_bits_set(bloom_filter *filter); + +#endif /* BLOOMFILTER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/dshash.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/dshash.h new file mode 100644 index 0000000..cf5c291 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/dshash.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * dshash.h + * Concurrent hash tables backed by dynamic shared memory areas. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/lib/dshash.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSHASH_H +#define DSHASH_H + +#include "utils/dsa.h" + +/* The opaque type representing a hash table. */ +struct dshash_table; +typedef struct dshash_table dshash_table; + +/* A handle for a dshash_table which can be shared with other processes. */ +typedef dsa_pointer dshash_table_handle; + +/* Sentinel value to use for invalid dshash_table handles. */ +#define DSHASH_HANDLE_INVALID ((dshash_table_handle) InvalidDsaPointer) + +/* The type for hash values. */ +typedef uint32 dshash_hash; + +/* A function type for comparing keys. */ +typedef int (*dshash_compare_function) (const void *a, const void *b, + size_t size, void *arg); + +/* A function type for computing hash values for keys. */ +typedef dshash_hash (*dshash_hash_function) (const void *v, size_t size, + void *arg); + +/* A function type for copying keys. */ +typedef void (*dshash_copy_function) (void *dest, const void *src, size_t size, + void *arg); + +/* + * The set of parameters needed to create or attach to a hash table. The + * tranche_id member does not need to be initialized when attaching to an + * existing hash table. + * + * Compare, hash, and copy functions must be supplied even when attaching, + * because we can't safely share function pointers between backends in general. + * The user data pointer supplied to the create and attach functions will be + * passed to these functions. + */ +typedef struct dshash_parameters +{ + size_t key_size; /* Size of the key (initial bytes of entry) */ + size_t entry_size; /* Total size of entry */ + dshash_compare_function compare_function; /* Compare function */ + dshash_hash_function hash_function; /* Hash function */ + dshash_copy_function copy_function; /* Copy function */ + int tranche_id; /* The tranche ID to use for locks */ +} dshash_parameters; + +/* Forward declaration of private types for use only by dshash.c. */ +struct dshash_table_item; +typedef struct dshash_table_item dshash_table_item; + +/* + * Sequential scan state. The detail is exposed to let users know the storage + * size but it should be considered as an opaque type by callers. + */ +typedef struct dshash_seq_status +{ + dshash_table *hash_table; /* dshash table working on */ + int curbucket; /* bucket number we are at */ + int nbuckets; /* total number of buckets in the dshash */ + dshash_table_item *curitem; /* item we are currently at */ + dsa_pointer pnextitem; /* dsa-pointer to the next item */ + int curpartition; /* partition number we are at */ + bool exclusive; /* locking mode */ +} dshash_seq_status; + +/* Creating, sharing and destroying from hash tables. */ +extern dshash_table *dshash_create(dsa_area *area, + const dshash_parameters *params, + void *arg); +extern dshash_table *dshash_attach(dsa_area *area, + const dshash_parameters *params, + dshash_table_handle handle, + void *arg); +extern void dshash_detach(dshash_table *hash_table); +extern dshash_table_handle dshash_get_hash_table_handle(dshash_table *hash_table); +extern void dshash_destroy(dshash_table *hash_table); + +/* Finding, creating, deleting entries. */ +extern void *dshash_find(dshash_table *hash_table, + const void *key, bool exclusive); +extern void *dshash_find_or_insert(dshash_table *hash_table, + const void *key, bool *found); +extern bool dshash_delete_key(dshash_table *hash_table, const void *key); +extern void dshash_delete_entry(dshash_table *hash_table, void *entry); +extern void dshash_release_lock(dshash_table *hash_table, void *entry); + +/* seq scan support */ +extern void dshash_seq_init(dshash_seq_status *status, dshash_table *hash_table, + bool exclusive); +extern void *dshash_seq_next(dshash_seq_status *status); +extern void dshash_seq_term(dshash_seq_status *status); +extern void dshash_delete_current(dshash_seq_status *status); + +/* + * Convenience hash, compare, and copy functions wrapping memcmp, tag_hash, and + * memcpy. + */ +extern int dshash_memcmp(const void *a, const void *b, size_t size, void *arg); +extern dshash_hash dshash_memhash(const void *v, size_t size, void *arg); +extern void dshash_memcpy(void *dest, const void *src, size_t size, void *arg); + +/* + * Convenience hash, compare, and copy functions wrapping strcmp, string_hash, + * and strcpy. + */ +extern int dshash_strcmp(const void *a, const void *b, size_t size, void *arg); +extern dshash_hash dshash_strhash(const void *v, size_t size, void *arg); +extern void dshash_strcpy(void *dest, const void *src, size_t size, void *arg); + +/* Debugging support. */ +extern void dshash_dump(dshash_table *hash_table); + +#endif /* DSHASH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/hyperloglog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/hyperloglog.h new file mode 100644 index 0000000..1e9c50f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/hyperloglog.h @@ -0,0 +1,68 @@ +/* + * hyperloglog.h + * + * A simple HyperLogLog cardinality estimator implementation + * + * Portions Copyright (c) 2014-2025, PostgreSQL Global Development Group + * + * Based on Hideaki Ohno's C++ implementation. The copyright terms of Ohno's + * original version (the MIT license) follow. + * + * src/include/lib/hyperloglog.h + */ + +/* + * Copyright (c) 2013 Hideaki Ohno + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the 'Software'), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef HYPERLOGLOG_H +#define HYPERLOGLOG_H + +/* + * HyperLogLog is an approximate technique for computing the number of distinct + * entries in a set. Importantly, it does this by using a fixed amount of + * memory. See the 2007 paper "HyperLogLog: the analysis of a near-optimal + * cardinality estimation algorithm" for more. + * + * hyperLogLogState + * + * registerWidth register width, in bits ("k") + * nRegisters number of registers + * alphaMM alpha * m ^ 2 (see initHyperLogLog()) + * hashesArr array of hashes + * arrSize size of hashesArr + */ +typedef struct hyperLogLogState +{ + uint8 registerWidth; + Size nRegisters; + double alphaMM; + uint8 *hashesArr; + Size arrSize; +} hyperLogLogState; + +extern void initHyperLogLog(hyperLogLogState *cState, uint8 bwidth); +extern void initHyperLogLogError(hyperLogLogState *cState, double error); +extern void addHyperLogLog(hyperLogLogState *cState, uint32 hash); +extern double estimateHyperLogLog(hyperLogLogState *cState); +extern void freeHyperLogLog(hyperLogLogState *cState); + +#endif /* HYPERLOGLOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/ilist.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/ilist.h new file mode 100644 index 0000000..85a641e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/ilist.h @@ -0,0 +1,1159 @@ +/*------------------------------------------------------------------------- + * + * ilist.h + * integrated/inline doubly- and singly-linked lists + * + * These list types are useful when there are only a predetermined set of + * lists that an object could be in. List links are embedded directly into + * the objects, and thus no extra memory management overhead is required. + * (Of course, if only a small proportion of existing objects are in a list, + * the link fields in the remainder would be wasted space. But usually, + * it saves space to not have separately-allocated list nodes.) + * + * The doubly-linked list comes in 2 forms. dlist_head defines a head of a + * doubly-linked list of dlist_nodes, whereas dclist_head defines the head of + * a doubly-linked list of dlist_nodes with an additional 'count' field to + * keep track of how many items are contained within the given list. For + * simplicity, dlist_head and dclist_head share the same node and iterator + * types. The functions to manipulate a dlist_head always have a name + * starting with "dlist", whereas functions to manipulate a dclist_head have a + * name starting with "dclist". dclist_head comes with an additional function + * (dclist_count) to return the number of entries in the list. dclists are + * able to store a maximum of PG_UINT32_MAX elements. It is up to the caller + * to ensure no more than this many items are added to a dclist. + * + * None of the functions here allocate any memory; they just manipulate + * externally managed memory. With the exception doubly-linked count lists + * providing the ability to obtain the number of items in the list, the APIs + * for singly and both doubly linked lists are identical as far as + * capabilities of both allow. + * + * Each list has a list header, which exists even when the list is empty. + * An empty singly-linked list has a NULL pointer in its header. + * + * For both doubly-linked list types, there are two valid ways to represent an + * empty list. The head's 'next' pointer can either be NULL or the head's + * 'next' and 'prev' links can both point back to the list head (circular). + * (If a dlist is modified and then all its elements are deleted, it will be + * in the circular state.). We prefer circular dlists because there are some + * operations that can be done without branches (and thus faster) on lists + * that use circular representation. However, it is often convenient to + * initialize list headers to zeroes rather than setting them up with an + * explicit initialization function, so we also allow the NULL initialization. + * + * EXAMPLES + * + * Here's a simple example demonstrating how this can be used. Let's assume + * we want to store information about the tables contained in a database. + * + * #include "lib/ilist.h" + * + * // Define struct for the databases including a list header that will be + * // used to access the nodes in the table list later on. + * typedef struct my_database + * { + * char *datname; + * dlist_head tables; + * // ... + * } my_database; + * + * // Define struct for the tables. Note the list_node element which stores + * // prev/next list links. The list_node element need not be first. + * typedef struct my_table + * { + * char *tablename; + * dlist_node list_node; + * perm_t permissions; + * // ... + * } my_table; + * + * // create a database + * my_database *db = create_database(); + * + * // and add a few tables to its table list + * dlist_push_head(&db->tables, &create_table(db, "a")->list_node); + * ... + * dlist_push_head(&db->tables, &create_table(db, "b")->list_node); + * + * + * To iterate over the table list, we allocate an iterator variable and use + * a specialized looping construct. Inside a dlist_foreach, the iterator's + * 'cur' field can be used to access the current element. iter.cur points to + * a 'dlist_node', but most of the time what we want is the actual table + * information; dlist_container() gives us that, like so: + * + * dlist_iter iter; + * dlist_foreach(iter, &db->tables) + * { + * my_table *tbl = dlist_container(my_table, list_node, iter.cur); + * printf("we have a table: %s in database %s\n", + * tbl->tablename, db->datname); + * } + * + * + * While a simple iteration is useful, we sometimes also want to manipulate + * the list while iterating. There is a different iterator element and looping + * construct for that. Suppose we want to delete tables that meet a certain + * criterion: + * + * dlist_mutable_iter miter; + * dlist_foreach_modify(miter, &db->tables) + * { + * my_table *tbl = dlist_container(my_table, list_node, miter.cur); + * + * if (!tbl->to_be_deleted) + * continue; // don't touch this one + * + * // unlink the current table from the linked list + * dlist_delete(miter.cur); + * // as these lists never manage memory, we can still access the table + * // after it's been unlinked + * drop_table(db, tbl); + * } + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/lib/ilist.h + *------------------------------------------------------------------------- + */ +#ifndef ILIST_H +#define ILIST_H + +/* + * Enable for extra debugging. This is rather expensive, so it's not enabled by + * default even when USE_ASSERT_CHECKING. + */ +/* #define ILIST_DEBUG */ + +/* + * Node of a doubly linked list. + * + * Embed this in structs that need to be part of a doubly linked list. + */ +typedef struct dlist_node dlist_node; +struct dlist_node +{ + dlist_node *prev; + dlist_node *next; +}; + +/* + * Head of a doubly linked list. + * + * Non-empty lists are internally circularly linked. Circular lists have the + * advantage of not needing any branches in the most common list manipulations. + * An empty list can also be represented as a pair of NULL pointers, making + * initialization easier. + */ +typedef struct dlist_head +{ + /* + * head.next either points to the first element of the list; to &head if + * it's a circular empty list; or to NULL if empty and not circular. + * + * head.prev either points to the last element of the list; to &head if + * it's a circular empty list; or to NULL if empty and not circular. + */ + dlist_node head; +} dlist_head; + + +/* + * Doubly linked list iterator type for dlist_head and dclist_head types. + * + * Used as state in dlist_foreach() and dlist_reverse_foreach() (and the + * dclist variant thereof). + * + * To get the current element of the iteration use the 'cur' member. + * + * Iterations using this are *not* allowed to change the list while iterating! + * + * NB: We use an extra "end" field here to avoid multiple evaluations of + * arguments in the dlist_foreach() and dclist_foreach() macros. + */ +typedef struct dlist_iter +{ + dlist_node *cur; /* current element */ + dlist_node *end; /* last node we'll iterate to */ +} dlist_iter; + +/* + * Doubly linked list iterator for both dlist_head and dclist_head types. + * This iterator type allows some modifications while iterating. + * + * Used as state in dlist_foreach_modify() and dclist_foreach_modify(). + * + * To get the current element of the iteration use the 'cur' member. + * + * Iterations using this are only allowed to change the list at the current + * point of iteration. It is fine to delete the current node, but it is *not* + * fine to insert or delete adjacent nodes. + * + * NB: We need a separate type for mutable iterations so that we can store + * the 'next' node of the current node in case it gets deleted or modified. + */ +typedef struct dlist_mutable_iter +{ + dlist_node *cur; /* current element */ + dlist_node *next; /* next node we'll iterate to */ + dlist_node *end; /* last node we'll iterate to */ +} dlist_mutable_iter; + +/* + * Head of a doubly linked list with a count of the number of items + * + * This internally makes use of a dlist to implement the actual list. When + * items are added or removed from the list the count is updated to reflect + * the current number of items in the list. + */ +typedef struct dclist_head +{ + dlist_head dlist; /* the actual list header */ + uint32 count; /* the number of items in the list */ +} dclist_head; + +/* + * Node of a singly linked list. + * + * Embed this in structs that need to be part of a singly linked list. + */ +typedef struct slist_node slist_node; +struct slist_node +{ + slist_node *next; +}; + +/* + * Head of a singly linked list. + * + * Singly linked lists are not circularly linked, in contrast to doubly linked + * lists; we just set head.next to NULL if empty. This doesn't incur any + * additional branches in the usual manipulations. + */ +typedef struct slist_head +{ + slist_node head; +} slist_head; + +/* + * Singly linked list iterator. + * + * Used as state in slist_foreach(). To get the current element of the + * iteration use the 'cur' member. + * + * It's allowed to modify the list while iterating, with the exception of + * deleting the iterator's current node; deletion of that node requires + * care if the iteration is to be continued afterward. (Doing so and also + * deleting or inserting adjacent list elements might misbehave; also, if + * the user frees the current node's storage, continuing the iteration is + * not safe.) + * + * NB: this wouldn't really need to be an extra struct, we could use an + * slist_node * directly. We prefer a separate type for consistency. + */ +typedef struct slist_iter +{ + slist_node *cur; +} slist_iter; + +/* + * Singly linked list iterator allowing some modifications while iterating. + * + * Used as state in slist_foreach_modify(). To get the current element of the + * iteration use the 'cur' member. + * + * The only list modification allowed while iterating is to remove the current + * node via slist_delete_current() (*not* slist_delete()). Insertion or + * deletion of nodes adjacent to the current node would misbehave. + */ +typedef struct slist_mutable_iter +{ + slist_node *cur; /* current element */ + slist_node *next; /* next node we'll iterate to */ + slist_node *prev; /* prev node, for deletions */ +} slist_mutable_iter; + + +/* Static initializers */ +#define DLIST_STATIC_INIT(name) {{&(name).head, &(name).head}} +#define DCLIST_STATIC_INIT(name) {{{&(name).dlist.head, &(name).dlist.head}}, 0} +#define SLIST_STATIC_INIT(name) {{NULL}} + + +/* Prototypes for functions too big to be inline */ + +/* Caution: this is O(n); consider using slist_delete_current() instead */ +extern void slist_delete(slist_head *head, const slist_node *node); + +#ifdef ILIST_DEBUG +extern void dlist_member_check(const dlist_head *head, const dlist_node *node); +extern void dlist_check(const dlist_head *head); +extern void slist_check(const slist_head *head); +#else +/* + * These seemingly useless casts to void are here to keep the compiler quiet + * about the argument being unused in many functions in a non-debug compile, + * in which functions the only point of passing the list head pointer is to be + * able to run these checks. + */ +#define dlist_member_check(head, node) ((void) (head)) +#define dlist_check(head) ((void) (head)) +#define slist_check(head) ((void) (head)) +#endif /* ILIST_DEBUG */ + +/* doubly linked list implementation */ + +/* + * Initialize a doubly linked list. + * Previous state will be thrown away without any cleanup. + */ +static inline void +dlist_init(dlist_head *head) +{ + head->head.next = head->head.prev = &head->head; +} + +/* + * Initialize a doubly linked list element. + * + * This is only needed when dlist_node_is_detached() may be needed. + */ +static inline void +dlist_node_init(dlist_node *node) +{ + node->next = node->prev = NULL; +} + +/* + * Is the list empty? + * + * An empty list has either its first 'next' pointer set to NULL, or to itself. + */ +static inline bool +dlist_is_empty(const dlist_head *head) +{ + dlist_check(head); + + return head->head.next == NULL || head->head.next == &(head->head); +} + +/* + * Insert a node at the beginning of the list. + */ +static inline void +dlist_push_head(dlist_head *head, dlist_node *node) +{ + if (head->head.next == NULL) /* convert NULL header to circular */ + dlist_init(head); + + node->next = head->head.next; + node->prev = &head->head; + node->next->prev = node; + head->head.next = node; + + dlist_check(head); +} + +/* + * Insert a node at the end of the list. + */ +static inline void +dlist_push_tail(dlist_head *head, dlist_node *node) +{ + if (head->head.next == NULL) /* convert NULL header to circular */ + dlist_init(head); + + node->next = &head->head; + node->prev = head->head.prev; + node->prev->next = node; + head->head.prev = node; + + dlist_check(head); +} + +/* + * Insert a node after another *in the same list* + */ +static inline void +dlist_insert_after(dlist_node *after, dlist_node *node) +{ + node->prev = after; + node->next = after->next; + after->next = node; + node->next->prev = node; +} + +/* + * Insert a node before another *in the same list* + */ +static inline void +dlist_insert_before(dlist_node *before, dlist_node *node) +{ + node->prev = before->prev; + node->next = before; + before->prev = node; + node->prev->next = node; +} + +/* + * Delete 'node' from its list (it must be in one). + */ +static inline void +dlist_delete(dlist_node *node) +{ + node->prev->next = node->next; + node->next->prev = node->prev; +} + +/* + * Like dlist_delete(), but also sets next/prev to NULL to signal not being in + * a list. + */ +static inline void +dlist_delete_thoroughly(dlist_node *node) +{ + node->prev->next = node->next; + node->next->prev = node->prev; + node->next = NULL; + node->prev = NULL; +} + +/* + * Same as dlist_delete, but performs checks in ILIST_DEBUG builds to ensure + * that 'node' belongs to 'head'. + */ +static inline void +dlist_delete_from(dlist_head *head, dlist_node *node) +{ + dlist_member_check(head, node); + dlist_delete(node); +} + +/* + * Like dlist_delete_from, but also sets next/prev to NULL to signal not + * being in a list. + */ +static inline void +dlist_delete_from_thoroughly(dlist_head *head, dlist_node *node) +{ + dlist_member_check(head, node); + dlist_delete_thoroughly(node); +} + +/* + * Remove and return the first node from a list (there must be one). + */ +static inline dlist_node * +dlist_pop_head_node(dlist_head *head) +{ + dlist_node *node; + + Assert(!dlist_is_empty(head)); + node = head->head.next; + dlist_delete(node); + return node; +} + +/* + * Move element from its current position in the list to the head position in + * the same list. + * + * Undefined behaviour if 'node' is not already part of the list. + */ +static inline void +dlist_move_head(dlist_head *head, dlist_node *node) +{ + /* fast path if it's already at the head */ + if (head->head.next == node) + return; + + dlist_delete(node); + dlist_push_head(head, node); + + dlist_check(head); +} + +/* + * Move element from its current position in the list to the tail position in + * the same list. + * + * Undefined behaviour if 'node' is not already part of the list. + */ +static inline void +dlist_move_tail(dlist_head *head, dlist_node *node) +{ + /* fast path if it's already at the tail */ + if (head->head.prev == node) + return; + + dlist_delete(node); + dlist_push_tail(head, node); + + dlist_check(head); +} + +/* + * Check whether 'node' has a following node. + * Caution: unreliable if 'node' is not in the list. + */ +static inline bool +dlist_has_next(const dlist_head *head, const dlist_node *node) +{ + return node->next != &head->head; +} + +/* + * Check whether 'node' has a preceding node. + * Caution: unreliable if 'node' is not in the list. + */ +static inline bool +dlist_has_prev(const dlist_head *head, const dlist_node *node) +{ + return node->prev != &head->head; +} + +/* + * Check if node is detached. A node is only detached if it either has been + * initialized with dlist_init_node(), or deleted with + * dlist_delete_thoroughly() / dlist_delete_from_thoroughly() / + * dclist_delete_from_thoroughly(). + */ +static inline bool +dlist_node_is_detached(const dlist_node *node) +{ + Assert((node->next == NULL && node->prev == NULL) || + (node->next != NULL && node->prev != NULL)); + + return node->next == NULL; +} + +/* + * Return the next node in the list (there must be one). + */ +static inline dlist_node * +dlist_next_node(dlist_head *head, dlist_node *node) +{ + Assert(dlist_has_next(head, node)); + return node->next; +} + +/* + * Return previous node in the list (there must be one). + */ +static inline dlist_node * +dlist_prev_node(dlist_head *head, dlist_node *node) +{ + Assert(dlist_has_prev(head, node)); + return node->prev; +} + +/* internal support function to get address of head element's struct */ +static inline void * +dlist_head_element_off(dlist_head *head, size_t off) +{ + Assert(!dlist_is_empty(head)); + return (char *) head->head.next - off; +} + +/* + * Return the first node in the list (there must be one). + */ +static inline dlist_node * +dlist_head_node(dlist_head *head) +{ + return (dlist_node *) dlist_head_element_off(head, 0); +} + +/* internal support function to get address of tail element's struct */ +static inline void * +dlist_tail_element_off(dlist_head *head, size_t off) +{ + Assert(!dlist_is_empty(head)); + return (char *) head->head.prev - off; +} + +/* + * Return the last node in the list (there must be one). + */ +static inline dlist_node * +dlist_tail_node(dlist_head *head) +{ + return (dlist_node *) dlist_tail_element_off(head, 0); +} + +/* + * Return the containing struct of 'type' where 'membername' is the dlist_node + * pointed at by 'ptr'. + * + * This is used to convert a dlist_node * back to its containing struct. + */ +#define dlist_container(type, membername, ptr) \ + (AssertVariableIsOfTypeMacro(ptr, dlist_node *), \ + AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + ((type *) ((char *) (ptr) - offsetof(type, membername)))) + +/* + * Return the address of the first element in the list. + * + * The list must not be empty. + */ +#define dlist_head_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + (type *) dlist_head_element_off(lhead, offsetof(type, membername))) + +/* + * Return the address of the last element in the list. + * + * The list must not be empty. + */ +#define dlist_tail_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + ((type *) dlist_tail_element_off(lhead, offsetof(type, membername)))) + +/* + * Iterate through the list pointed at by 'lhead' storing the state in 'iter'. + * + * Access the current element with iter.cur. + * + * It is *not* allowed to manipulate the list during iteration. + */ +#define dlist_foreach(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, dlist_iter), \ + AssertVariableIsOfTypeMacro(lhead, dlist_head *), \ + (iter).end = &(lhead)->head, \ + (iter).cur = (iter).end->next ? (iter).end->next : (iter).end; \ + (iter).cur != (iter).end; \ + (iter).cur = (iter).cur->next) + +/* + * Iterate through the list pointed at by 'lhead' storing the state in 'iter'. + * + * Access the current element with iter.cur. + * + * Iterations using this are only allowed to change the list at the current + * point of iteration. It is fine to delete the current node, but it is *not* + * fine to insert or delete adjacent nodes. + */ +#define dlist_foreach_modify(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, dlist_mutable_iter), \ + AssertVariableIsOfTypeMacro(lhead, dlist_head *), \ + (iter).end = &(lhead)->head, \ + (iter).cur = (iter).end->next ? (iter).end->next : (iter).end, \ + (iter).next = (iter).cur->next; \ + (iter).cur != (iter).end; \ + (iter).cur = (iter).next, (iter).next = (iter).cur->next) + +/* + * Iterate through the list in reverse order. + * + * It is *not* allowed to manipulate the list during iteration. + */ +#define dlist_reverse_foreach(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, dlist_iter), \ + AssertVariableIsOfTypeMacro(lhead, dlist_head *), \ + (iter).end = &(lhead)->head, \ + (iter).cur = (iter).end->prev ? (iter).end->prev : (iter).end; \ + (iter).cur != (iter).end; \ + (iter).cur = (iter).cur->prev) + +/* doubly-linked count list implementation */ + +/* + * dclist_init + * Initialize a doubly linked count list. + * + * Previous state will be thrown away without any cleanup. + */ +static inline void +dclist_init(dclist_head *head) +{ + dlist_init(&head->dlist); + head->count = 0; +} + +/* + * dclist_is_empty + * Returns true if the list is empty, otherwise false. + */ +static inline bool +dclist_is_empty(const dclist_head *head) +{ + Assert(dlist_is_empty(&head->dlist) == (head->count == 0)); + return (head->count == 0); +} + +/* + * dclist_push_head + * Insert a node at the beginning of the list. + */ +static inline void +dclist_push_head(dclist_head *head, dlist_node *node) +{ + if (head->dlist.head.next == NULL) /* convert NULL header to circular */ + dclist_init(head); + + dlist_push_head(&head->dlist, node); + head->count++; + + Assert(head->count > 0); /* count overflow check */ +} + +/* + * dclist_push_tail + * Insert a node at the end of the list. + */ +static inline void +dclist_push_tail(dclist_head *head, dlist_node *node) +{ + if (head->dlist.head.next == NULL) /* convert NULL header to circular */ + dclist_init(head); + + dlist_push_tail(&head->dlist, node); + head->count++; + + Assert(head->count > 0); /* count overflow check */ +} + +/* + * dclist_insert_after + * Insert a node after another *in the same list* + * + * Caution: 'after' must be a member of 'head'. + */ +static inline void +dclist_insert_after(dclist_head *head, dlist_node *after, dlist_node *node) +{ + dlist_member_check(&head->dlist, after); + Assert(head->count > 0); /* must be at least 1 already */ + + dlist_insert_after(after, node); + head->count++; + + Assert(head->count > 0); /* count overflow check */ +} + +/* + * dclist_insert_before + * Insert a node before another *in the same list* + * + * Caution: 'before' must be a member of 'head'. + */ +static inline void +dclist_insert_before(dclist_head *head, dlist_node *before, dlist_node *node) +{ + dlist_member_check(&head->dlist, before); + Assert(head->count > 0); /* must be at least 1 already */ + + dlist_insert_before(before, node); + head->count++; + + Assert(head->count > 0); /* count overflow check */ +} + +/* + * dclist_delete_from + * Deletes 'node' from 'head'. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline void +dclist_delete_from(dclist_head *head, dlist_node *node) +{ + Assert(head->count > 0); + + dlist_delete_from(&head->dlist, node); + head->count--; +} + +/* + * Like dclist_delete_from(), but also sets next/prev to NULL to signal not + * being in a list. + */ +static inline void +dclist_delete_from_thoroughly(dclist_head *head, dlist_node *node) +{ + Assert(head->count > 0); + + dlist_delete_from_thoroughly(&head->dlist, node); + head->count--; +} + +/* + * dclist_pop_head_node + * Remove and return the first node from a list (there must be one). + */ +static inline dlist_node * +dclist_pop_head_node(dclist_head *head) +{ + dlist_node *node; + + Assert(head->count > 0); + + node = dlist_pop_head_node(&head->dlist); + head->count--; + return node; +} + +/* + * dclist_move_head + * Move 'node' from its current position in the list to the head position + * in 'head'. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline void +dclist_move_head(dclist_head *head, dlist_node *node) +{ + dlist_member_check(&head->dlist, node); + Assert(head->count > 0); + + dlist_move_head(&head->dlist, node); +} + +/* + * dclist_move_tail + * Move 'node' from its current position in the list to the tail position + * in 'head'. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline void +dclist_move_tail(dclist_head *head, dlist_node *node) +{ + dlist_member_check(&head->dlist, node); + Assert(head->count > 0); + + dlist_move_tail(&head->dlist, node); +} + +/* + * dclist_has_next + * Check whether 'node' has a following node. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline bool +dclist_has_next(const dclist_head *head, const dlist_node *node) +{ + dlist_member_check(&head->dlist, node); + Assert(head->count > 0); + + return dlist_has_next(&head->dlist, node); +} + +/* + * dclist_has_prev + * Check whether 'node' has a preceding node. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline bool +dclist_has_prev(const dclist_head *head, const dlist_node *node) +{ + dlist_member_check(&head->dlist, node); + Assert(head->count > 0); + + return dlist_has_prev(&head->dlist, node); +} + +/* + * dclist_next_node + * Return the next node in the list (there must be one). + */ +static inline dlist_node * +dclist_next_node(dclist_head *head, dlist_node *node) +{ + Assert(head->count > 0); + + return dlist_next_node(&head->dlist, node); +} + +/* + * dclist_prev_node + * Return the prev node in the list (there must be one). + */ +static inline dlist_node * +dclist_prev_node(dclist_head *head, dlist_node *node) +{ + Assert(head->count > 0); + + return dlist_prev_node(&head->dlist, node); +} + +/* internal support function to get address of head element's struct */ +static inline void * +dclist_head_element_off(dclist_head *head, size_t off) +{ + Assert(!dclist_is_empty(head)); + + return (char *) head->dlist.head.next - off; +} + +/* + * dclist_head_node + * Return the first node in the list (there must be one). + */ +static inline dlist_node * +dclist_head_node(dclist_head *head) +{ + Assert(head->count > 0); + + return (dlist_node *) dlist_head_element_off(&head->dlist, 0); +} + +/* internal support function to get address of tail element's struct */ +static inline void * +dclist_tail_element_off(dclist_head *head, size_t off) +{ + Assert(!dclist_is_empty(head)); + + return (char *) head->dlist.head.prev - off; +} + +/* + * Return the last node in the list (there must be one). + */ +static inline dlist_node * +dclist_tail_node(dclist_head *head) +{ + Assert(head->count > 0); + + return (dlist_node *) dlist_tail_element_off(&head->dlist, 0); +} + +/* + * dclist_count + * Returns the stored number of entries in 'head' + */ +static inline uint32 +dclist_count(const dclist_head *head) +{ + Assert(dlist_is_empty(&head->dlist) == (head->count == 0)); + + return head->count; +} + +/* + * Return the containing struct of 'type' where 'membername' is the dlist_node + * pointed at by 'ptr'. + * + * This is used to convert a dlist_node * back to its containing struct. + * + * Note: This is effectively just the same as dlist_container, so reuse that. + */ +#define dclist_container(type, membername, ptr) \ + dlist_container(type, membername, ptr) + + /* + * Return the address of the first element in the list. + * + * The list must not be empty. + */ +#define dclist_head_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + (type *) dclist_head_element_off(lhead, offsetof(type, membername))) + + /* + * Return the address of the last element in the list. + * + * The list must not be empty. + */ +#define dclist_tail_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + ((type *) dclist_tail_element_off(lhead, offsetof(type, membername)))) + + +/* Iterators for dclists */ +#define dclist_foreach(iter, lhead) \ + dlist_foreach(iter, &((lhead)->dlist)) + +#define dclist_foreach_modify(iter, lhead) \ + dlist_foreach_modify(iter, &((lhead)->dlist)) + +#define dclist_reverse_foreach(iter, lhead) \ + dlist_reverse_foreach(iter, &((lhead)->dlist)) + +/* singly linked list implementation */ + +/* + * Initialize a singly linked list. + * Previous state will be thrown away without any cleanup. + */ +static inline void +slist_init(slist_head *head) +{ + head->head.next = NULL; +} + +/* + * Is the list empty? + */ +static inline bool +slist_is_empty(const slist_head *head) +{ + slist_check(head); + + return head->head.next == NULL; +} + +/* + * Insert a node at the beginning of the list. + */ +static inline void +slist_push_head(slist_head *head, slist_node *node) +{ + node->next = head->head.next; + head->head.next = node; + + slist_check(head); +} + +/* + * Insert a node after another *in the same list* + */ +static inline void +slist_insert_after(slist_node *after, slist_node *node) +{ + node->next = after->next; + after->next = node; +} + +/* + * Remove and return the first node from a list (there must be one). + */ +static inline slist_node * +slist_pop_head_node(slist_head *head) +{ + slist_node *node; + + Assert(!slist_is_empty(head)); + node = head->head.next; + head->head.next = node->next; + slist_check(head); + return node; +} + +/* + * Check whether 'node' has a following node. + */ +static inline bool +slist_has_next(const slist_head *head, const slist_node *node) +{ + slist_check(head); + + return node->next != NULL; +} + +/* + * Return the next node in the list (there must be one). + */ +static inline slist_node * +slist_next_node(slist_head *head, slist_node *node) +{ + Assert(slist_has_next(head, node)); + return node->next; +} + +/* internal support function to get address of head element's struct */ +static inline void * +slist_head_element_off(slist_head *head, size_t off) +{ + Assert(!slist_is_empty(head)); + return (char *) head->head.next - off; +} + +/* + * Return the first node in the list (there must be one). + */ +static inline slist_node * +slist_head_node(slist_head *head) +{ + return (slist_node *) slist_head_element_off(head, 0); +} + +/* + * Delete the list element the iterator currently points to. + * + * Caution: this modifies iter->cur, so don't use that again in the current + * loop iteration. + */ +static inline void +slist_delete_current(slist_mutable_iter *iter) +{ + /* + * Update previous element's forward link. If the iteration is at the + * first list element, iter->prev will point to the list header's "head" + * field, so we don't need a special case for that. + */ + iter->prev->next = iter->next; + + /* + * Reset cur to prev, so that prev will continue to point to the prior + * valid list element after slist_foreach_modify() advances to the next. + */ + iter->cur = iter->prev; +} + +/* + * Return the containing struct of 'type' where 'membername' is the slist_node + * pointed at by 'ptr'. + * + * This is used to convert a slist_node * back to its containing struct. + */ +#define slist_container(type, membername, ptr) \ + (AssertVariableIsOfTypeMacro(ptr, slist_node *), \ + AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \ + ((type *) ((char *) (ptr) - offsetof(type, membername)))) + +/* + * Return the address of the first element in the list. + * + * The list must not be empty. + */ +#define slist_head_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \ + (type *) slist_head_element_off(lhead, offsetof(type, membername))) + +/* + * Iterate through the list pointed at by 'lhead' storing the state in 'iter'. + * + * Access the current element with iter.cur. + * + * It's allowed to modify the list while iterating, with the exception of + * deleting the iterator's current node; deletion of that node requires + * care if the iteration is to be continued afterward. (Doing so and also + * deleting or inserting adjacent list elements might misbehave; also, if + * the user frees the current node's storage, continuing the iteration is + * not safe.) + */ +#define slist_foreach(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, slist_iter), \ + AssertVariableIsOfTypeMacro(lhead, slist_head *), \ + (iter).cur = (lhead)->head.next; \ + (iter).cur != NULL; \ + (iter).cur = (iter).cur->next) + +/* + * Iterate through the list pointed at by 'lhead' storing the state in 'iter'. + * + * Access the current element with iter.cur. + * + * The only list modification allowed while iterating is to remove the current + * node via slist_delete_current() (*not* slist_delete()). Insertion or + * deletion of nodes adjacent to the current node would misbehave. + */ +#define slist_foreach_modify(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, slist_mutable_iter), \ + AssertVariableIsOfTypeMacro(lhead, slist_head *), \ + (iter).prev = &(lhead)->head, \ + (iter).cur = (iter).prev->next, \ + (iter).next = (iter).cur ? (iter).cur->next : NULL; \ + (iter).cur != NULL; \ + (iter).prev = (iter).cur, \ + (iter).cur = (iter).next, \ + (iter).next = (iter).next ? (iter).next->next : NULL) + +#endif /* ILIST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/integerset.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/integerset.h new file mode 100644 index 0000000..00626a6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/integerset.h @@ -0,0 +1,24 @@ +/* + * integerset.h + * In-memory data structure to hold a large set of integers efficiently + * + * Portions Copyright (c) 2012-2025, PostgreSQL Global Development Group + * + * src/include/lib/integerset.h + */ +#ifndef INTEGERSET_H +#define INTEGERSET_H + +typedef struct IntegerSet IntegerSet; + +extern IntegerSet *intset_create(void); +extern void intset_add_member(IntegerSet *intset, uint64 x); +extern bool intset_is_member(IntegerSet *intset, uint64 x); + +extern uint64 intset_num_entries(IntegerSet *intset); +extern uint64 intset_memory_usage(IntegerSet *intset); + +extern void intset_begin_iterate(IntegerSet *intset); +extern bool intset_iterate_next(IntegerSet *intset, uint64 *next); + +#endif /* INTEGERSET_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/knapsack.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/knapsack.h new file mode 100644 index 0000000..b870122 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/knapsack.h @@ -0,0 +1,16 @@ +/* + * knapsack.h + * + * Copyright (c) 2017-2025, PostgreSQL Global Development Group + * + * src/include/lib/knapsack.h + */ +#ifndef KNAPSACK_H +#define KNAPSACK_H + +#include "nodes/bitmapset.h" + +extern Bitmapset *DiscreteKnapsack(int max_weight, int num_items, + int *item_weights, double *item_values); + +#endif /* KNAPSACK_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/pairingheap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/pairingheap.h new file mode 100644 index 0000000..3c57d3f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/pairingheap.h @@ -0,0 +1,102 @@ +/* + * pairingheap.h + * + * A Pairing Heap implementation + * + * Portions Copyright (c) 2012-2025, PostgreSQL Global Development Group + * + * src/include/lib/pairingheap.h + */ + +#ifndef PAIRINGHEAP_H +#define PAIRINGHEAP_H + +#include "lib/stringinfo.h" + +/* Enable if you need the pairingheap_dump() debug function */ +/* #define PAIRINGHEAP_DEBUG */ + +/* + * This represents an element stored in the heap. Embed this in a larger + * struct containing the actual data you're storing. + * + * A node can have multiple children, which form a double-linked list. + * first_child points to the node's first child, and the subsequent children + * can be found by following the next_sibling pointers. The last child has + * next_sibling == NULL. The prev_or_parent pointer points to the node's + * previous sibling, or if the node is its parent's first child, to the + * parent. + */ +typedef struct pairingheap_node +{ + struct pairingheap_node *first_child; + struct pairingheap_node *next_sibling; + struct pairingheap_node *prev_or_parent; +} pairingheap_node; + +/* + * Return the containing struct of 'type' where 'membername' is the + * pairingheap_node pointed at by 'ptr'. + * + * This is used to convert a pairingheap_node * back to its containing struct. + */ +#define pairingheap_container(type, membername, ptr) \ + (AssertVariableIsOfTypeMacro(ptr, pairingheap_node *), \ + AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \ + ((type *) ((char *) (ptr) - offsetof(type, membername)))) + +/* + * Like pairingheap_container, but used when the pointer is 'const ptr' + */ +#define pairingheap_const_container(type, membername, ptr) \ + (AssertVariableIsOfTypeMacro(ptr, const pairingheap_node *), \ + AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \ + ((const type *) ((const char *) (ptr) - offsetof(type, membername)))) + +/* + * For a max-heap, the comparator must return <0 iff a < b, 0 iff a == b, + * and >0 iff a > b. For a min-heap, the conditions are reversed. + */ +typedef int (*pairingheap_comparator) (const pairingheap_node *a, + const pairingheap_node *b, + void *arg); + +/* + * A pairing heap. + * + * You can use pairingheap_allocate() to create a new palloc'd heap, or embed + * this in a larger struct, set ph_compare and ph_arg directly and initialize + * ph_root to NULL. + */ +typedef struct pairingheap +{ + pairingheap_comparator ph_compare; /* comparison function */ + void *ph_arg; /* opaque argument to ph_compare */ + pairingheap_node *ph_root; /* current root of the heap */ +} pairingheap; + +extern pairingheap *pairingheap_allocate(pairingheap_comparator compare, + void *arg); +extern void pairingheap_free(pairingheap *heap); +extern void pairingheap_add(pairingheap *heap, pairingheap_node *node); +extern pairingheap_node *pairingheap_first(pairingheap *heap); +extern pairingheap_node *pairingheap_remove_first(pairingheap *heap); +extern void pairingheap_remove(pairingheap *heap, pairingheap_node *node); + +#ifdef PAIRINGHEAP_DEBUG +extern char *pairingheap_dump(pairingheap *heap, + void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque), + void *opaque); +#endif + +/* Resets the heap to be empty. */ +#define pairingheap_reset(h) ((h)->ph_root = NULL) + +/* Is the heap empty? */ +#define pairingheap_is_empty(h) ((h)->ph_root == NULL) + +/* Is there exactly one node in the heap? */ +#define pairingheap_is_singular(h) \ + ((h)->ph_root && (h)->ph_root->first_child == NULL) + +#endif /* PAIRINGHEAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/qunique.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/qunique.h new file mode 100644 index 0000000..c699053 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/qunique.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * qunique.h + * inline array unique functions + * Portions Copyright (c) 2019-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/lib/qunique.h + *------------------------------------------------------------------------- + */ + +#ifndef QUNIQUE_H +#define QUNIQUE_H + +/* + * Remove duplicates from a pre-sorted array, according to a user-supplied + * comparator. Usually the array should have been sorted with qsort() using + * the same arguments. Return the new size. + */ +static inline size_t +qunique(void *array, size_t elements, size_t width, + int (*compare) (const void *, const void *)) +{ + char *bytes = (char *) array; + size_t i, + j; + + if (elements <= 1) + return elements; + + for (i = 1, j = 0; i < elements; ++i) + { + if (compare(bytes + i * width, bytes + j * width) != 0 && + ++j != i) + memcpy(bytes + j * width, bytes + i * width, width); + } + + return j + 1; +} + +/* + * Like qunique(), but takes a comparator with an extra user data argument + * which is passed through, for compatibility with qsort_arg(). + */ +static inline size_t +qunique_arg(void *array, size_t elements, size_t width, + int (*compare) (const void *, const void *, void *), + void *arg) +{ + char *bytes = (char *) array; + size_t i, + j; + + if (elements <= 1) + return elements; + + for (i = 1, j = 0; i < elements; ++i) + { + if (compare(bytes + i * width, bytes + j * width, arg) != 0 && + ++j != i) + memcpy(bytes + j * width, bytes + i * width, width); + } + + return j + 1; +} + +#endif /* QUNIQUE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/radixtree.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/radixtree.h new file mode 100644 index 0000000..a75b772 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/radixtree.h @@ -0,0 +1,3026 @@ +/*------------------------------------------------------------------------- + * + * radixtree.h + * Template for adaptive radix tree. + * + * A template to generate an "adaptive radix tree", specialized for value + * types and for local/shared memory. + * + * The concept originates from the paper "The Adaptive Radix Tree: ARTful + * Indexing for Main-Memory Databases" by Viktor Leis, Alfons Kemper, + * and Thomas Neumann, 2013. + * + * Radix trees have some advantages over hash tables: + * - The keys are logically ordered, allowing efficient sorted iteration + * and range queries + * - Operations using keys that are lexicographically close together + * will have favorable memory locality + * - Memory use grows gradually rather than by doubling + * - The key does not need to be stored with the value, since the key + * is implicitly contained in the path to the value + * + * Some disadvantages are: + * - Point queries (along with insertion and deletion) are slower than + * a linear probing hash table as in simplehash.h + * - Memory usage varies by key distribution, so is difficult to predict + * + * A classic radix tree consists of nodes, each containing an array of + * pointers to child nodes. The size of the array is determined by the + * "span" of the tree, which is the number of bits of the key used to + * index into the array. For example, with a span of 6, a "chunk" + * of 6 bits is extracted from the key at each node traversal, and + * the arrays thus have a "fanout" of 2^6 or 64 entries. A large span + * allows a shorter tree, but requires larger arrays that may be mostly + * wasted space. + * + * The key idea of the adaptive radix tree is to choose different + * data structures based on the number of child nodes. A node will + * start out small when it is first populated, and when it is full, + * it is replaced by the next larger size. Conversely, when a node + * becomes mostly empty, it is replaced by the next smaller node. The + * bulk of the code complexity in this module stems from this dynamic + * switching. One mitigating factor is using a span of 8, since bytes + * are directly addressable. + * + * The ART paper mentions three ways to implement leaves: + * + * "- Single-value leaves: The values are stored using an addi- + * tional leaf node type which stores one value. + * - Multi-value leaves: The values are stored in one of four + * different leaf node types, which mirror the structure of + * inner nodes, but contain values instead of pointers. + * - Combined pointer/value slots: If values fit into point- + * ers, no separate node types are necessary. Instead, each + * pointer storage location in an inner node can either + * store a pointer or a value." + * + * We use a form of "combined pointer/value slots", as recommended. Values + * of size (if fixed at compile time) equal or smaller than the platform's + * pointer type are stored in the child slots of the last level node, + * while larger values are the same as "single-value" leaves above. This + * offers flexibility and efficiency. Variable-length types are currently + * treated as single-value leaves for simplicity, but future work may + * allow those to be stored in the child pointer arrays, when they're + * small enough. + * + * There are two other techniques described in the paper that are not + * implemented here: + * - path compression "...removes all inner nodes that have only a single child." + * - lazy path expansion "...inner nodes are only created if they are required + * to distinguish at least two leaf nodes." + * + * We do have a form of "poor man's path compression", however, enabled by + * only supporting unsigned integer keys (for now assumed to be 64-bit): + * A tree doesn't contain paths where the highest bytes of all keys are + * zero. That way, the tree's height adapts to the distribution of keys. + * + * To handle concurrency, we use a single reader-writer lock for the + * radix tree. If concurrent write operations are possible, the tree + * must be exclusively locked during write operations such as RT_SET() + * and RT_DELETE(), and share locked during read operations such as + * RT_FIND() and RT_BEGIN_ITERATE(). + * + * TODO: The current locking mechanism is not optimized for high + * concurrency with mixed read-write workloads. In the future it might + * be worthwhile to replace it with the Optimistic Lock Coupling or + * ROWEX mentioned in the paper "The ART of Practical Synchronization" + * by the same authors as the ART paper, 2016. + * + * To generate a radix tree and associated functions for a use case + * several macros have to be #define'ed before this file is included. + * Including the file #undef's all those, so a new radix tree can be + * generated afterwards. + * + * The relevant parameters are: + * - RT_PREFIX - prefix for all symbol names generated. A prefix of "foo" + * will result in radix tree type "foo_radix_tree" and functions like + * "foo_create"/"foo_free" and so forth. + * - RT_DECLARE - if defined function prototypes and type declarations are + * generated + * - RT_DEFINE - if defined function definitions are generated + * - RT_SCOPE - in which scope (e.g. extern, static inline) do function + * declarations reside + * - RT_VALUE_TYPE - the type of the value. + * - RT_VARLEN_VALUE_SIZE() - for variable length values, an expression + * involving a pointer to the value type, to calculate size. + * NOTE: implies that the value is in fact variable-length, + * so do not set for fixed-length values. + * - RT_RUNTIME_EMBEDDABLE_VALUE - for variable length values, allows + * storing the value in a child pointer slot, rather than as a single- + * value leaf, if small enough. This requires that the value, when + * read as a child pointer, can be tagged in the lowest bit. + * + * Optional parameters: + * - RT_SHMEM - if defined, the radix tree is created in the DSA area + * so that multiple processes can access it simultaneously. + * - RT_DEBUG - if defined add stats tracking and debugging functions + * + * Interface + * --------- + * + * RT_CREATE - Create a new, empty radix tree + * RT_FREE - Free the radix tree + * RT_FIND - Lookup the value for a given key + * RT_SET - Set a key-value pair + * RT_BEGIN_ITERATE - Begin iterating through all key-value pairs + * RT_ITERATE_NEXT - Return next key-value pair, if any + * RT_END_ITERATE - End iteration + * RT_MEMORY_USAGE - Get the memory as measured by space in memory context blocks + * + * Interface for Shared Memory + * --------- + * + * RT_ATTACH - Attach to the radix tree + * RT_DETACH - Detach from the radix tree + * RT_LOCK_EXCLUSIVE - Lock the radix tree in exclusive mode + * RT_LOCK_SHARE - Lock the radix tree in share mode + * RT_UNLOCK - Unlock the radix tree + * RT_GET_HANDLE - Return the handle of the radix tree + * + * Optional Interface + * --------- + * + * RT_DELETE - Delete a key-value pair. Declared/defined if RT_USE_DELETE is defined + * + * + * Copyright (c) 2024-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/lib/radixtree.h + * + *------------------------------------------------------------------------- + */ + +#include "nodes/bitmapset.h" +#include "port/pg_bitutils.h" +#include "port/simd.h" +#include "utils/dsa.h" +#include "utils/memutils.h" +#ifdef RT_SHMEM +#include "miscadmin.h" +#include "storage/lwlock.h" +#endif + +/* helpers */ +#define RT_MAKE_PREFIX(a) CppConcat(a,_) +#define RT_MAKE_NAME(name) RT_MAKE_NAME_(RT_MAKE_PREFIX(RT_PREFIX),name) +#define RT_MAKE_NAME_(a,b) CppConcat(a,b) +/* + * stringify a macro constant, from https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html + */ +#define RT_STR(s) RT_STR_(s) +#define RT_STR_(s) #s + +/* function declarations */ +#define RT_CREATE RT_MAKE_NAME(create) +#define RT_FREE RT_MAKE_NAME(free) +#define RT_FIND RT_MAKE_NAME(find) +#ifdef RT_SHMEM +#define RT_ATTACH RT_MAKE_NAME(attach) +#define RT_DETACH RT_MAKE_NAME(detach) +#define RT_GET_HANDLE RT_MAKE_NAME(get_handle) +#define RT_LOCK_EXCLUSIVE RT_MAKE_NAME(lock_exclusive) +#define RT_LOCK_SHARE RT_MAKE_NAME(lock_share) +#define RT_UNLOCK RT_MAKE_NAME(unlock) +#endif +#define RT_SET RT_MAKE_NAME(set) +#define RT_BEGIN_ITERATE RT_MAKE_NAME(begin_iterate) +#define RT_ITERATE_NEXT RT_MAKE_NAME(iterate_next) +#define RT_END_ITERATE RT_MAKE_NAME(end_iterate) +#ifdef RT_USE_DELETE +#define RT_DELETE RT_MAKE_NAME(delete) +#endif +#define RT_MEMORY_USAGE RT_MAKE_NAME(memory_usage) +#define RT_DUMP_NODE RT_MAKE_NAME(dump_node) +#define RT_STATS RT_MAKE_NAME(stats) + +/* internal helper functions (no externally visible prototypes) */ +#define RT_CHILDPTR_IS_VALUE RT_MAKE_NAME(childptr_is_value) +#define RT_VALUE_IS_EMBEDDABLE RT_MAKE_NAME(value_is_embeddable) +#define RT_GET_SLOT_RECURSIVE RT_MAKE_NAME(get_slot_recursive) +#define RT_DELETE_RECURSIVE RT_MAKE_NAME(delete_recursive) +#define RT_ALLOC_NODE RT_MAKE_NAME(alloc_node) +#define RT_ALLOC_LEAF RT_MAKE_NAME(alloc_leaf) +#define RT_FREE_NODE RT_MAKE_NAME(free_node) +#define RT_FREE_LEAF RT_MAKE_NAME(free_leaf) +#define RT_FREE_RECURSE RT_MAKE_NAME(free_recurse) +#define RT_EXTEND_UP RT_MAKE_NAME(extend_up) +#define RT_EXTEND_DOWN RT_MAKE_NAME(extend_down) +#define RT_COPY_COMMON RT_MAKE_NAME(copy_common) +#define RT_PTR_SET_LOCAL RT_MAKE_NAME(ptr_set_local) +#define RT_NODE_16_SEARCH_EQ RT_MAKE_NAME(node_16_search_eq) +#define RT_NODE_4_GET_INSERTPOS RT_MAKE_NAME(node_4_get_insertpos) +#define RT_NODE_16_GET_INSERTPOS RT_MAKE_NAME(node_16_get_insertpos) +#define RT_SHIFT_ARRAYS_FOR_INSERT RT_MAKE_NAME(shift_arrays_for_insert) +#define RT_SHIFT_ARRAYS_AND_DELETE RT_MAKE_NAME(shift_arrays_and_delete) +#define RT_COPY_ARRAYS_FOR_INSERT RT_MAKE_NAME(copy_arrays_for_insert) +#define RT_COPY_ARRAYS_AND_DELETE RT_MAKE_NAME(copy_arrays_and_delete) +#define RT_NODE_48_IS_CHUNK_USED RT_MAKE_NAME(node_48_is_chunk_used) +#define RT_NODE_48_GET_CHILD RT_MAKE_NAME(node_48_get_child) +#define RT_NODE_256_IS_CHUNK_USED RT_MAKE_NAME(node_256_is_chunk_used) +#define RT_NODE_256_GET_CHILD RT_MAKE_NAME(node_256_get_child) +#define RT_KEY_GET_SHIFT RT_MAKE_NAME(key_get_shift) +#define RT_SHIFT_GET_MAX_VAL RT_MAKE_NAME(shift_get_max_val) +#define RT_NODE_SEARCH RT_MAKE_NAME(node_search) +#define RT_NODE_DELETE RT_MAKE_NAME(node_delete) +#define RT_NODE_INSERT RT_MAKE_NAME(node_insert) +#define RT_ADD_CHILD_4 RT_MAKE_NAME(add_child_4) +#define RT_ADD_CHILD_16 RT_MAKE_NAME(add_child_16) +#define RT_ADD_CHILD_48 RT_MAKE_NAME(add_child_48) +#define RT_ADD_CHILD_256 RT_MAKE_NAME(add_child_256) +#define RT_GROW_NODE_4 RT_MAKE_NAME(grow_node_4) +#define RT_GROW_NODE_16 RT_MAKE_NAME(grow_node_16) +#define RT_GROW_NODE_48 RT_MAKE_NAME(grow_node_48) +#define RT_REMOVE_CHILD_4 RT_MAKE_NAME(remove_child_4) +#define RT_REMOVE_CHILD_16 RT_MAKE_NAME(remove_child_16) +#define RT_REMOVE_CHILD_48 RT_MAKE_NAME(remove_child_48) +#define RT_REMOVE_CHILD_256 RT_MAKE_NAME(remove_child_256) +#define RT_SHRINK_NODE_16 RT_MAKE_NAME(shrink_child_16) +#define RT_SHRINK_NODE_48 RT_MAKE_NAME(shrink_child_48) +#define RT_SHRINK_NODE_256 RT_MAKE_NAME(shrink_child_256) +#define RT_NODE_ITERATE_NEXT RT_MAKE_NAME(node_iterate_next) +#define RT_VERIFY_NODE RT_MAKE_NAME(verify_node) + +/* type declarations */ +#define RT_RADIX_TREE RT_MAKE_NAME(radix_tree) +#define RT_RADIX_TREE_CONTROL RT_MAKE_NAME(radix_tree_control) +#define RT_ITER RT_MAKE_NAME(iter) +#ifdef RT_SHMEM +#define RT_HANDLE RT_MAKE_NAME(handle) +#endif +#define RT_NODE RT_MAKE_NAME(node) +#define RT_CHILD_PTR RT_MAKE_NAME(child_ptr) +#define RT_NODE_ITER RT_MAKE_NAME(node_iter) +#define RT_NODE_4 RT_MAKE_NAME(node_4) +#define RT_NODE_16 RT_MAKE_NAME(node_16) +#define RT_NODE_48 RT_MAKE_NAME(node_48) +#define RT_NODE_256 RT_MAKE_NAME(node_256) +#define RT_SIZE_CLASS RT_MAKE_NAME(size_class) +#define RT_SIZE_CLASS_ELEM RT_MAKE_NAME(size_class_elem) +#define RT_SIZE_CLASS_INFO RT_MAKE_NAME(size_class_info) +#define RT_CLASS_4 RT_MAKE_NAME(class_4) +#define RT_CLASS_16_LO RT_MAKE_NAME(class_32_min) +#define RT_CLASS_16_HI RT_MAKE_NAME(class_32_max) +#define RT_CLASS_48 RT_MAKE_NAME(class_48) +#define RT_CLASS_256 RT_MAKE_NAME(class_256) + +/* generate forward declarations necessary to use the radix tree */ +#ifdef RT_DECLARE + +typedef struct RT_RADIX_TREE RT_RADIX_TREE; +typedef struct RT_ITER RT_ITER; + +#ifdef RT_SHMEM +typedef dsa_pointer RT_HANDLE; +#endif + +#ifdef RT_SHMEM +RT_SCOPE RT_RADIX_TREE *RT_CREATE(dsa_area *dsa, int tranche_id); +RT_SCOPE RT_RADIX_TREE *RT_ATTACH(dsa_area *dsa, dsa_pointer dp); +RT_SCOPE void RT_DETACH(RT_RADIX_TREE * tree); +RT_SCOPE RT_HANDLE RT_GET_HANDLE(RT_RADIX_TREE * tree); +RT_SCOPE void RT_LOCK_EXCLUSIVE(RT_RADIX_TREE * tree); +RT_SCOPE void RT_LOCK_SHARE(RT_RADIX_TREE * tree); +RT_SCOPE void RT_UNLOCK(RT_RADIX_TREE * tree); +#else +RT_SCOPE RT_RADIX_TREE *RT_CREATE(MemoryContext ctx); +#endif +RT_SCOPE void RT_FREE(RT_RADIX_TREE * tree); + +RT_SCOPE RT_VALUE_TYPE *RT_FIND(RT_RADIX_TREE * tree, uint64 key); +RT_SCOPE bool RT_SET(RT_RADIX_TREE * tree, uint64 key, RT_VALUE_TYPE * value_p); + +#ifdef RT_USE_DELETE +RT_SCOPE bool RT_DELETE(RT_RADIX_TREE * tree, uint64 key); +#endif + +RT_SCOPE RT_ITER *RT_BEGIN_ITERATE(RT_RADIX_TREE * tree); +RT_SCOPE RT_VALUE_TYPE *RT_ITERATE_NEXT(RT_ITER * iter, uint64 *key_p); +RT_SCOPE void RT_END_ITERATE(RT_ITER * iter); + +RT_SCOPE uint64 RT_MEMORY_USAGE(RT_RADIX_TREE * tree); + +#ifdef RT_DEBUG +RT_SCOPE void RT_STATS(RT_RADIX_TREE * tree); +#endif + +#endif /* RT_DECLARE */ + + +/* generate implementation of the radix tree */ +#ifdef RT_DEFINE + +/* The number of bits encoded in one tree level */ +#define RT_SPAN BITS_PER_BYTE + +/* + * The number of possible partial keys, and thus the maximum number of + * child pointers, for a node. + */ +#define RT_NODE_MAX_SLOTS (1 << RT_SPAN) + +/* Mask for extracting a chunk from a key */ +#define RT_CHUNK_MASK ((1 << RT_SPAN) - 1) + +/* Maximum shift needed to extract a chunk from a key */ +#define RT_MAX_SHIFT RT_KEY_GET_SHIFT(UINT64_MAX) + +/* Maximum level a tree can reach for a key */ +#define RT_MAX_LEVEL ((sizeof(uint64) * BITS_PER_BYTE) / RT_SPAN) + +/* Get a chunk from the key */ +#define RT_GET_KEY_CHUNK(key, shift) ((uint8) (((key) >> (shift)) & RT_CHUNK_MASK)) + +/* For accessing bitmaps */ +#define RT_BM_IDX(x) ((x) / BITS_PER_BITMAPWORD) +#define RT_BM_BIT(x) ((x) % BITS_PER_BITMAPWORD) + +/* + * Node kinds + * + * The different node kinds are what make the tree "adaptive". + * + * Each node kind is associated with a different datatype and different + * search/set/delete/iterate algorithms adapted for its size. The largest + * kind, node256 is basically the same as a traditional radix tree, + * and would be most wasteful of memory when sparsely populated. The + * smaller nodes expend some additional CPU time to enable a smaller + * memory footprint. + * + * NOTE: There are 4 node kinds, and this should never be increased, + * for several reasons: + * 1. With 5 or more kinds, gcc tends to use a jump table for switch + * statements. + * 2. The 4 kinds can be represented with 2 bits, so we have the option + * in the future to tag the node pointer with the kind, even on + * platforms with 32-bit pointers. That would touch fewer cache lines + * during traversal and allow faster recovery from branch mispredicts. + * 3. We can have multiple size classes per node kind. + */ +#define RT_NODE_KIND_4 0x00 +#define RT_NODE_KIND_16 0x01 +#define RT_NODE_KIND_48 0x02 +#define RT_NODE_KIND_256 0x03 +#define RT_NODE_KIND_COUNT 4 + +/* + * Calculate the slab block size so that we can allocate at least 32 chunks + * from the block. + */ +#define RT_SLAB_BLOCK_SIZE(size) \ + Max(SLAB_DEFAULT_BLOCK_SIZE, pg_nextpower2_32(size * 32)) + +/* Common header for all nodes */ +typedef struct RT_NODE +{ + /* Node kind, one per search/set algorithm */ + uint8 kind; + + /* + * Max capacity for the current size class. Storing this in the node + * enables multiple size classes per node kind. uint8 is sufficient for + * all node kinds, because we only use this number to test if the node + * needs to grow. Since node256 never needs to grow, we let this overflow + * to zero. + */ + uint8 fanout; + + /* + * Number of children. uint8 is sufficient for all node kinds, because + * nodes shrink when this number gets lower than some threshold. Since + * node256 cannot possibly have zero children, we let the counter overflow + * and we interpret zero as "256" for this node kind. + */ + uint8 count; +} RT_NODE; + + +/* pointer returned by allocation */ +#ifdef RT_SHMEM +#define RT_PTR_ALLOC dsa_pointer +#define RT_INVALID_PTR_ALLOC InvalidDsaPointer +#define RT_PTR_ALLOC_IS_VALID(ptr) DsaPointerIsValid(ptr) +#else +#define RT_PTR_ALLOC RT_NODE * +#define RT_INVALID_PTR_ALLOC NULL +#define RT_PTR_ALLOC_IS_VALID(ptr) PointerIsValid(ptr) +#endif + +/* + * A convenience type used when we need to work with a DSA pointer as well + * as its local pointer. For local memory, both members are the same, so + * we use a union. + */ +#ifdef RT_SHMEM +typedef struct RT_CHILD_PTR +#else +typedef union RT_CHILD_PTR +#endif +{ + RT_PTR_ALLOC alloc; + RT_NODE *local; +} RT_CHILD_PTR; + + +/* + * Helper macros and functions for value storage. + * We either embed values in the child slots of the last level + * node or store pointers to values to the child slots, + * depending on the value size. + */ + +#ifdef RT_VARLEN_VALUE_SIZE +#define RT_GET_VALUE_SIZE(v) RT_VARLEN_VALUE_SIZE(v) +#else +#define RT_GET_VALUE_SIZE(v) sizeof(RT_VALUE_TYPE) +#endif + +/* + * Return true if the value can be stored in the child array + * of the lowest-level node, false otherwise. + */ +static inline bool +RT_VALUE_IS_EMBEDDABLE(RT_VALUE_TYPE * value_p) +{ +#ifdef RT_VARLEN_VALUE_SIZE + +#ifdef RT_RUNTIME_EMBEDDABLE_VALUE + return RT_GET_VALUE_SIZE(value_p) <= sizeof(RT_PTR_ALLOC); +#else + return false; +#endif + +#else + return RT_GET_VALUE_SIZE(value_p) <= sizeof(RT_PTR_ALLOC); +#endif +} + +/* + * Return true if the child pointer contains the value, false + * if the child pointer is a leaf pointer. + */ +static inline bool +RT_CHILDPTR_IS_VALUE(RT_PTR_ALLOC child) +{ +#ifdef RT_VARLEN_VALUE_SIZE + +#ifdef RT_RUNTIME_EMBEDDABLE_VALUE + /* check for pointer tag */ +#ifdef RT_SHMEM + return child & 1; +#else + return ((uintptr_t) child) & 1; +#endif + +#else + return false; +#endif + +#else + return sizeof(RT_VALUE_TYPE) <= sizeof(RT_PTR_ALLOC); +#endif +} + +/* + * Symbols for maximum possible fanout are declared first as they are + * required to declare each node kind. The declarations of other fanout + * values are followed as they need the struct sizes of each node kind. + */ + +/* max possible key chunks without struct padding */ +#define RT_FANOUT_4_MAX (8 - sizeof(RT_NODE)) + +/* equal to two 128-bit SIMD registers, regardless of availability */ +#define RT_FANOUT_16_MAX 32 + +/* + * This also determines the number of bits necessary for the isset array, + * so we need to be mindful of the size of bitmapword. Since bitmapword + * can be 64 bits, the only values that make sense here are 64 and 128. + * The ART paper uses at most 64 for this node kind, and one advantage + * for us is that "isset" is a single bitmapword on most platforms, + * rather than an array, allowing the compiler to get rid of loops. + */ +#define RT_FANOUT_48_MAX 64 + +#define RT_FANOUT_256 RT_NODE_MAX_SLOTS + +/* + * Node structs, one for each "kind" + */ + +/* + * node4 and node16 use one array for key chunks and another + * array of the same length for children. The keys and children + * are stored at corresponding positions, sorted by chunk. + */ + +typedef struct RT_NODE_4 +{ + RT_NODE base; + + uint8 chunks[RT_FANOUT_4_MAX]; + + /* number of children depends on size class */ + RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]; +} RT_NODE_4; + +typedef struct RT_NODE_16 +{ + RT_NODE base; + + uint8 chunks[RT_FANOUT_16_MAX]; + + /* number of children depends on size class */ + RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]; +} RT_NODE_16; + +/* + * node48 uses a 256-element array indexed by key chunks. This array + * stores indexes into a second array containing the children. + */ +typedef struct RT_NODE_48 +{ + RT_NODE base; + + /* bitmap to track which slots are in use */ + bitmapword isset[RT_BM_IDX(RT_FANOUT_48_MAX)]; + + /* + * Lookup table for indexes into the children[] array. We make this the + * last fixed-size member so that it's convenient to memset separately + * from the previous members. + */ + uint8 slot_idxs[RT_NODE_MAX_SLOTS]; + +/* Invalid index */ +#define RT_INVALID_SLOT_IDX 0xFF + + /* number of children depends on size class */ + RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]; +} RT_NODE_48; + +/* + * node256 is the largest node type. This node has an array of + * children directly indexed by chunk. Unlike other node kinds, + * its array size is by definition fixed. + */ +typedef struct RT_NODE_256 +{ + RT_NODE base; + + /* bitmap to track which slots are in use */ + bitmapword isset[RT_BM_IDX(RT_FANOUT_256)]; + + /* slots for 256 children */ + RT_PTR_ALLOC children[RT_FANOUT_256]; +} RT_NODE_256; + +#if defined(RT_SHMEM) +/* + * Make sure the all nodes (except for node256) fit neatly into a DSA + * size class. We assume the RT_FANOUT_4 is in the range where DSA size + * classes increment by 8 (as of PG17 up to 64 bytes), so we just hard + * code that one. + */ + +#if SIZEOF_DSA_POINTER < 8 +#define RT_FANOUT_16_LO ((96 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC)) +#define RT_FANOUT_16_HI Min(RT_FANOUT_16_MAX, (160 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC)) +#define RT_FANOUT_48 Min(RT_FANOUT_48_MAX, (512 - offsetof(RT_NODE_48, children)) / sizeof(RT_PTR_ALLOC)) +#else +#define RT_FANOUT_16_LO ((160 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC)) +#define RT_FANOUT_16_HI Min(RT_FANOUT_16_MAX, (320 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC)) +#define RT_FANOUT_48 Min(RT_FANOUT_48_MAX, (768 - offsetof(RT_NODE_48, children)) / sizeof(RT_PTR_ALLOC)) +#endif /* SIZEOF_DSA_POINTER < 8 */ + +#else /* ! RT_SHMEM */ + +/* doesn't really matter, but may as well use the namesake */ +#define RT_FANOUT_16_LO 16 +/* use maximum possible */ +#define RT_FANOUT_16_HI RT_FANOUT_16_MAX +#define RT_FANOUT_48 RT_FANOUT_48_MAX + +#endif /* RT_SHMEM */ + +/* + * To save memory in trees with sparse keys, it would make sense to have two + * size classes for the smallest kind (perhaps a high class of 5 and a low class + * of 2), but it would be more effective to utilize lazy expansion and + * path compression. + */ +#define RT_FANOUT_4 4 + +StaticAssertDecl(RT_FANOUT_4 <= RT_FANOUT_4_MAX, "watch struct padding"); +StaticAssertDecl(RT_FANOUT_16_LO < RT_FANOUT_16_HI, "LO subclass bigger than HI"); +StaticAssertDecl(RT_FANOUT_48 <= RT_FANOUT_48_MAX, "more slots than isset bits"); + +/* + * Node size classes + * + * Nodes of different kinds necessarily belong to different size classes. + * One innovation in our implementation compared to the ART paper is + * decoupling the notion of size class from kind. + * + * The size classes within a given node kind have the same underlying + * type, but a variable number of children/values. This is possible + * because each type (except node256) contains metadata that work the + * same way regardless of how many child slots there are. The nodes + * can introspect their allocated capacity at runtime. + */ +typedef enum RT_SIZE_CLASS +{ + RT_CLASS_4 = 0, + RT_CLASS_16_LO, + RT_CLASS_16_HI, + RT_CLASS_48, + RT_CLASS_256 +} RT_SIZE_CLASS; + +/* Information for each size class */ +typedef struct RT_SIZE_CLASS_ELEM +{ + const char *name; + int fanout; + size_t allocsize; +} RT_SIZE_CLASS_ELEM; + + +static const RT_SIZE_CLASS_ELEM RT_SIZE_CLASS_INFO[] = { + [RT_CLASS_4] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node4", + .fanout = RT_FANOUT_4, + .allocsize = sizeof(RT_NODE_4) + RT_FANOUT_4 * sizeof(RT_PTR_ALLOC), + }, + [RT_CLASS_16_LO] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node16_lo", + .fanout = RT_FANOUT_16_LO, + .allocsize = sizeof(RT_NODE_16) + RT_FANOUT_16_LO * sizeof(RT_PTR_ALLOC), + }, + [RT_CLASS_16_HI] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node16_hi", + .fanout = RT_FANOUT_16_HI, + .allocsize = sizeof(RT_NODE_16) + RT_FANOUT_16_HI * sizeof(RT_PTR_ALLOC), + }, + [RT_CLASS_48] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node48", + .fanout = RT_FANOUT_48, + .allocsize = sizeof(RT_NODE_48) + RT_FANOUT_48 * sizeof(RT_PTR_ALLOC), + }, + [RT_CLASS_256] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node256", + .fanout = RT_FANOUT_256, + .allocsize = sizeof(RT_NODE_256), + }, +}; + +#define RT_NUM_SIZE_CLASSES lengthof(RT_SIZE_CLASS_INFO) + +#ifdef RT_SHMEM +/* A magic value used to identify our radix tree */ +#define RT_RADIX_TREE_MAGIC 0x54A48167 +#endif + +/* Contains the actual tree, plus ancillary info */ +typedef struct RT_RADIX_TREE_CONTROL +{ +#ifdef RT_SHMEM + RT_HANDLE handle; + uint32 magic; + LWLock lock; +#endif + + RT_PTR_ALLOC root; + uint64 max_val; + int64 num_keys; + int start_shift; + + /* statistics */ +#ifdef RT_DEBUG + int64 num_nodes[RT_NUM_SIZE_CLASSES]; + int64 num_leaves; +#endif +} RT_RADIX_TREE_CONTROL; + +/* Entry point for allocating and accessing the tree */ +struct RT_RADIX_TREE +{ + /* pointing to either local memory or DSA */ + RT_RADIX_TREE_CONTROL *ctl; + +#ifdef RT_SHMEM + dsa_area *dsa; +#else + MemoryContextData *node_slabs[RT_NUM_SIZE_CLASSES]; + + /* leaf_context is used only for single-value leaves */ + MemoryContextData *leaf_context; +#endif +}; + +/* + * Iteration support. + * + * Iterating over the radix tree produces each key/value pair in ascending + * order of the key. + */ + +/* state for iterating over a single node */ +typedef struct RT_NODE_ITER +{ + RT_CHILD_PTR node; + + /* + * The next index of the chunk array in RT_NODE_KIND_4 and RT_NODE_KIND_16 + * nodes, or the next chunk in RT_NODE_KIND_48 and RT_NODE_KIND_256 nodes. + * 0 for the initial value. + */ + int idx; +} RT_NODE_ITER; + +/* state for iterating over the whole radix tree */ +struct RT_ITER +{ + RT_RADIX_TREE *tree; + + /* + * A stack to track iteration for each level. Level 0 is the lowest (or + * leaf) level + */ + RT_NODE_ITER node_iters[RT_MAX_LEVEL]; + int top_level; + int cur_level; + + /* The key constructed during iteration */ + uint64 key; +}; + + +/* verification (available only in assert-enabled builds) */ +static void RT_VERIFY_NODE(RT_NODE * node); + +static inline void +RT_PTR_SET_LOCAL(RT_RADIX_TREE * tree, RT_CHILD_PTR * node) +{ +#ifdef RT_SHMEM + node->local = dsa_get_address(tree->dsa, node->alloc); +#endif +} + +/* Convenience functions for node48 and node256 */ + +/* Return true if there is an entry for "chunk" */ +static inline bool +RT_NODE_48_IS_CHUNK_USED(RT_NODE_48 * node, uint8 chunk) +{ + return node->slot_idxs[chunk] != RT_INVALID_SLOT_IDX; +} + +static inline RT_PTR_ALLOC * +RT_NODE_48_GET_CHILD(RT_NODE_48 * node, uint8 chunk) +{ + return &node->children[node->slot_idxs[chunk]]; +} + +/* Return true if there is an entry for "chunk" */ +static inline bool +RT_NODE_256_IS_CHUNK_USED(RT_NODE_256 * node, uint8 chunk) +{ + int idx = RT_BM_IDX(chunk); + int bitnum = RT_BM_BIT(chunk); + + return (node->isset[idx] & ((bitmapword) 1 << bitnum)) != 0; +} + +static inline RT_PTR_ALLOC * +RT_NODE_256_GET_CHILD(RT_NODE_256 * node, uint8 chunk) +{ + Assert(RT_NODE_256_IS_CHUNK_USED(node, chunk)); + return &node->children[chunk]; +} + +/* + * Return the smallest shift that will allowing storing the given key. + */ +static inline int +RT_KEY_GET_SHIFT(uint64 key) +{ + if (key == 0) + return 0; + else + return (pg_leftmost_one_pos64(key) / RT_SPAN) * RT_SPAN; +} + +/* + * Return the max value that can be stored in the tree with the given shift. + */ +static uint64 +RT_SHIFT_GET_MAX_VAL(int shift) +{ + if (shift == RT_MAX_SHIFT) + return UINT64_MAX; + else + return (UINT64CONST(1) << (shift + RT_SPAN)) - 1; +} + +/* + * Allocate a new node with the given node kind and size class. + */ +static inline RT_CHILD_PTR +RT_ALLOC_NODE(RT_RADIX_TREE * tree, const uint8 kind, const RT_SIZE_CLASS size_class) +{ + RT_CHILD_PTR allocnode; + RT_NODE *node; + size_t allocsize; + + allocsize = RT_SIZE_CLASS_INFO[size_class].allocsize; + +#ifdef RT_SHMEM + allocnode.alloc = dsa_allocate(tree->dsa, allocsize); +#else + allocnode.alloc = (RT_PTR_ALLOC) MemoryContextAlloc(tree->node_slabs[size_class], + allocsize); +#endif + + RT_PTR_SET_LOCAL(tree, &allocnode); + node = allocnode.local; + + /* initialize contents */ + + switch (kind) + { + case RT_NODE_KIND_4: + memset(node, 0, offsetof(RT_NODE_4, children)); + break; + case RT_NODE_KIND_16: + memset(node, 0, offsetof(RT_NODE_16, children)); + break; + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node; + + memset(n48, 0, offsetof(RT_NODE_48, slot_idxs)); + memset(n48->slot_idxs, RT_INVALID_SLOT_IDX, sizeof(n48->slot_idxs)); + break; + } + case RT_NODE_KIND_256: + memset(node, 0, offsetof(RT_NODE_256, children)); + break; + default: + pg_unreachable(); + } + + node->kind = kind; + + /* + * For node256, this will actually overflow to zero, but that's okay + * because that node doesn't need to introspect this value. + */ + node->fanout = RT_SIZE_CLASS_INFO[size_class].fanout; + +#ifdef RT_DEBUG + /* update the statistics */ + tree->ctl->num_nodes[size_class]++; +#endif + + return allocnode; +} + +/* + * Allocate a new leaf. + */ +static RT_CHILD_PTR +RT_ALLOC_LEAF(RT_RADIX_TREE * tree, size_t allocsize) +{ + RT_CHILD_PTR leaf; + +#ifdef RT_SHMEM + leaf.alloc = dsa_allocate(tree->dsa, allocsize); + RT_PTR_SET_LOCAL(tree, &leaf); +#else + leaf.alloc = (RT_PTR_ALLOC) MemoryContextAlloc(tree->leaf_context, allocsize); +#endif + +#ifdef RT_DEBUG + tree->ctl->num_leaves++; +#endif + + return leaf; +} + +/* + * Copy relevant members of the node header. + * This is a separate function in case other fields are added. + */ +static inline void +RT_COPY_COMMON(RT_CHILD_PTR newnode, RT_CHILD_PTR oldnode) +{ + (newnode.local)->count = (oldnode.local)->count; +} + +/* Free the given node */ +static void +RT_FREE_NODE(RT_RADIX_TREE * tree, RT_CHILD_PTR node) +{ +#ifdef RT_DEBUG + int i; + + /* update the statistics */ + + for (i = 0; i < RT_NUM_SIZE_CLASSES; i++) + { + if ((node.local)->fanout == RT_SIZE_CLASS_INFO[i].fanout) + break; + } + + /* + * The fanout of node256 will appear to be zero within the node header + * because of overflow, so we need an extra check here. + */ + if (i == RT_NUM_SIZE_CLASSES) + i = RT_CLASS_256; + + tree->ctl->num_nodes[i]--; + Assert(tree->ctl->num_nodes[i] >= 0); +#endif + +#ifdef RT_SHMEM + dsa_free(tree->dsa, node.alloc); +#else + pfree(node.alloc); +#endif +} + +static inline void +RT_FREE_LEAF(RT_RADIX_TREE * tree, RT_PTR_ALLOC leaf) +{ + Assert(leaf != tree->ctl->root); + +#ifdef RT_DEBUG + /* update the statistics */ + tree->ctl->num_leaves--; + Assert(tree->ctl->num_leaves >= 0); +#endif + +#ifdef RT_SHMEM + dsa_free(tree->dsa, leaf); +#else + pfree(leaf); +#endif +} + +/***************** SEARCH *****************/ + +/* + * Return the address of the child corresponding to "chunk", + * or NULL if there is no such element. + */ +static inline RT_PTR_ALLOC * +RT_NODE_16_SEARCH_EQ(RT_NODE_16 * node, uint8 chunk) +{ + int count = node->base.count; +#ifndef USE_NO_SIMD + Vector8 spread_chunk; + Vector8 haystack1; + Vector8 haystack2; + Vector8 cmp1; + Vector8 cmp2; + uint32 bitfield; + RT_PTR_ALLOC *slot_simd = NULL; +#endif + +#if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING) + RT_PTR_ALLOC *slot = NULL; + + for (int i = 0; i < count; i++) + { + if (node->chunks[i] == chunk) + { + slot = &node->children[i]; + break; + } + } +#endif + +#ifndef USE_NO_SIMD + /* replicate the search key */ + spread_chunk = vector8_broadcast(chunk); + + /* compare to all 32 keys stored in the node */ + vector8_load(&haystack1, &node->chunks[0]); + vector8_load(&haystack2, &node->chunks[sizeof(Vector8)]); + cmp1 = vector8_eq(spread_chunk, haystack1); + cmp2 = vector8_eq(spread_chunk, haystack2); + + /* convert comparison to a bitfield */ + bitfield = vector8_highbit_mask(cmp1) | (vector8_highbit_mask(cmp2) << sizeof(Vector8)); + + /* mask off invalid entries */ + bitfield &= ((UINT64CONST(1) << count) - 1); + + /* convert bitfield to index by counting trailing zeros */ + if (bitfield) + slot_simd = &node->children[pg_rightmost_one_pos32(bitfield)]; + + Assert(slot_simd == slot); + return slot_simd; +#else + return slot; +#endif +} + +/* + * Search for the child pointer corresponding to "key" in the given node. + * + * Return child if the key is found, otherwise return NULL. + */ +static inline RT_PTR_ALLOC * +RT_NODE_SEARCH(RT_NODE * node, uint8 chunk) +{ + /* Make sure we already converted to local pointer */ + Assert(node != NULL); + + switch (node->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) node; + + for (int i = 0; i < n4->base.count; i++) + { + if (n4->chunks[i] == chunk) + return &n4->children[i]; + } + return NULL; + } + case RT_NODE_KIND_16: + return RT_NODE_16_SEARCH_EQ((RT_NODE_16 *) node, chunk); + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node; + int slotpos = n48->slot_idxs[chunk]; + + if (slotpos == RT_INVALID_SLOT_IDX) + return NULL; + + return RT_NODE_48_GET_CHILD(n48, chunk); + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) node; + + if (!RT_NODE_256_IS_CHUNK_USED(n256, chunk)) + return NULL; + + return RT_NODE_256_GET_CHILD(n256, chunk); + } + default: + pg_unreachable(); + } +} + +/* + * Search the given key in the radix tree. Return the pointer to the value if found, + * otherwise return NULL. + * + * Since the function returns a pointer (to support variable-length values), + * the caller is responsible for locking until it's finished with the value. + */ +RT_SCOPE RT_VALUE_TYPE * +RT_FIND(RT_RADIX_TREE * tree, uint64 key) +{ + RT_CHILD_PTR node; + RT_PTR_ALLOC *slot = NULL; + int shift; + +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); +#endif + + if (key > tree->ctl->max_val) + return NULL; + + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + node.alloc = tree->ctl->root; + shift = tree->ctl->start_shift; + + /* Descend the tree */ + while (shift >= 0) + { + RT_PTR_SET_LOCAL(tree, &node); + slot = RT_NODE_SEARCH(node.local, RT_GET_KEY_CHUNK(key, shift)); + if (slot == NULL) + return NULL; + + node.alloc = *slot; + shift -= RT_SPAN; + } + + if (RT_CHILDPTR_IS_VALUE(*slot)) + return (RT_VALUE_TYPE *) slot; + else + { + RT_PTR_SET_LOCAL(tree, &node); + return (RT_VALUE_TYPE *) node.local; + } +} + +/***************** INSERTION *****************/ + +#define RT_NODE_MUST_GROW(node) \ + ((node)->count == (node)->fanout) + +/* + * Return index of the chunk and slot arrays for inserting into the node, + * such that the arrays remain ordered. + */ +static inline int +RT_NODE_4_GET_INSERTPOS(RT_NODE_4 * node, uint8 chunk, int count) +{ + int idx; + + for (idx = 0; idx < count; idx++) + { + if (node->chunks[idx] >= chunk) + break; + } + + return idx; +} + +/* + * Return index of the chunk and slot arrays for inserting into the node, + * such that the arrays remain ordered. + */ +static inline int +RT_NODE_16_GET_INSERTPOS(RT_NODE_16 * node, uint8 chunk) +{ + int count = node->base.count; +#if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING) + int index; +#endif + +#ifndef USE_NO_SIMD + Vector8 spread_chunk; + Vector8 haystack1; + Vector8 haystack2; + Vector8 cmp1; + Vector8 cmp2; + Vector8 min1; + Vector8 min2; + uint32 bitfield; + int index_simd; +#endif + + /* + * First compare the last element. There are two reasons to branch here: + * + * 1) A realistic pattern is inserting ordered keys. In that case, + * non-SIMD platforms must do a linear search to the last chunk to find + * the insert position. This will get slower as the node fills up. + * + * 2) On SIMD platforms, we must branch anyway to make sure we don't bit + * scan an empty bitfield. Doing the branch here eliminates some work that + * we might otherwise throw away. + */ + Assert(count > 0); + if (node->chunks[count - 1] < chunk) + return count; + +#if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING) + + for (index = 0; index < count; index++) + { + if (node->chunks[index] > chunk) + break; + } +#endif + +#ifndef USE_NO_SIMD + + /* + * This is a bit more complicated than RT_NODE_16_SEARCH_EQ(), because no + * unsigned uint8 comparison instruction exists, at least for SSE2. So we + * need to play some trickery using vector8_min() to effectively get >=. + * There'll never be any equal elements in current uses, but that's what + * we get here... + */ + spread_chunk = vector8_broadcast(chunk); + vector8_load(&haystack1, &node->chunks[0]); + vector8_load(&haystack2, &node->chunks[sizeof(Vector8)]); + min1 = vector8_min(spread_chunk, haystack1); + min2 = vector8_min(spread_chunk, haystack2); + cmp1 = vector8_eq(spread_chunk, min1); + cmp2 = vector8_eq(spread_chunk, min2); + bitfield = vector8_highbit_mask(cmp1) | (vector8_highbit_mask(cmp2) << sizeof(Vector8)); + + Assert((bitfield & ((UINT64CONST(1) << count) - 1)) != 0); + index_simd = pg_rightmost_one_pos32(bitfield); + + Assert(index_simd == index); + return index_simd; +#else + return index; +#endif +} + +/* Shift the elements right at "insertpos" by one */ +static inline void +RT_SHIFT_ARRAYS_FOR_INSERT(uint8 *chunks, RT_PTR_ALLOC * children, int count, int insertpos) +{ + /* + * This is basically a memmove, but written in a simple loop for speed on + * small inputs. + */ + for (int i = count - 1; i >= insertpos; i--) + { + /* workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101481 */ +#ifdef __GNUC__ + __asm__(""); +#endif + chunks[i + 1] = chunks[i]; + children[i + 1] = children[i]; + } +} + +/* + * Copy both chunk and slot arrays into the right + * place. The caller is responsible for inserting the new element. + */ +static inline void +RT_COPY_ARRAYS_FOR_INSERT(uint8 *dst_chunks, RT_PTR_ALLOC * dst_children, + uint8 *src_chunks, RT_PTR_ALLOC * src_children, + int count, int insertpos) +{ + for (int i = 0; i < count; i++) + { + int sourceidx = i; + + /* use a branch-free computation to skip the index of the new element */ + int destidx = i + (i >= insertpos); + + dst_chunks[destidx] = src_chunks[sourceidx]; + dst_children[destidx] = src_children[sourceidx]; + } +} + +static inline RT_PTR_ALLOC * +RT_ADD_CHILD_256(RT_RADIX_TREE * tree, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_256 *n256 = (RT_NODE_256 *) node.local; + int idx = RT_BM_IDX(chunk); + int bitnum = RT_BM_BIT(chunk); + + /* Mark the slot used for "chunk" */ + n256->isset[idx] |= ((bitmapword) 1 << bitnum); + + n256->base.count++; + RT_VERIFY_NODE((RT_NODE *) n256); + + return RT_NODE_256_GET_CHILD(n256, chunk); +} + +static pg_noinline RT_PTR_ALLOC * +RT_GROW_NODE_48(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, + uint8 chunk) +{ + RT_NODE_48 *n48 = (RT_NODE_48 *) node.local; + RT_CHILD_PTR newnode; + RT_NODE_256 *new256; + int i = 0; + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_256, RT_CLASS_256); + new256 = (RT_NODE_256 *) newnode.local; + + /* copy over the entries */ + RT_COPY_COMMON(newnode, node); + for (int word_num = 0; word_num < RT_BM_IDX(RT_NODE_MAX_SLOTS); word_num++) + { + bitmapword bitmap = 0; + + /* + * Bit manipulation is a surprisingly large portion of the overhead in + * the naive implementation. Doing stores word-at-a-time removes a lot + * of that overhead. + */ + for (int bit = 0; bit < BITS_PER_BITMAPWORD; bit++) + { + uint8 offset = n48->slot_idxs[i]; + + if (offset != RT_INVALID_SLOT_IDX) + { + bitmap |= ((bitmapword) 1 << bit); + new256->children[i] = n48->children[offset]; + } + + i++; + } + + new256->isset[word_num] = bitmap; + } + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); + + return RT_ADD_CHILD_256(tree, newnode, chunk); +} + +static inline RT_PTR_ALLOC * +RT_ADD_CHILD_48(RT_RADIX_TREE * tree, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_48 *n48 = (RT_NODE_48 *) node.local; + int insertpos; + int idx = 0; + bitmapword w, + inverse; + + /* get the first word with at least one bit not set */ + for (int i = 0; i < RT_BM_IDX(RT_FANOUT_48_MAX); i++) + { + w = n48->isset[i]; + if (w < ~((bitmapword) 0)) + { + idx = i; + break; + } + } + + /* To get the first unset bit in w, get the first set bit in ~w */ + inverse = ~w; + insertpos = idx * BITS_PER_BITMAPWORD; + insertpos += bmw_rightmost_one_pos(inverse); + Assert(insertpos < n48->base.fanout); + + /* mark the slot used by setting the rightmost zero bit */ + n48->isset[idx] |= w + 1; + + /* insert new chunk into place */ + n48->slot_idxs[chunk] = insertpos; + + n48->base.count++; + RT_VERIFY_NODE((RT_NODE *) n48); + + return &n48->children[insertpos]; +} + +static pg_noinline RT_PTR_ALLOC * +RT_GROW_NODE_16(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, + uint8 chunk) +{ + RT_NODE_16 *n16 = (RT_NODE_16 *) node.local; + int insertpos; + + if (n16->base.fanout < RT_FANOUT_16_HI) + { + RT_CHILD_PTR newnode; + RT_NODE_16 *new16; + + Assert(n16->base.fanout == RT_FANOUT_16_LO); + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_16, RT_CLASS_16_HI); + new16 = (RT_NODE_16 *) newnode.local; + + /* copy over existing entries */ + RT_COPY_COMMON(newnode, node); + Assert(n16->base.count == RT_FANOUT_16_LO); + insertpos = RT_NODE_16_GET_INSERTPOS(n16, chunk); + RT_COPY_ARRAYS_FOR_INSERT(new16->chunks, new16->children, + n16->chunks, n16->children, + RT_FANOUT_16_LO, insertpos); + + /* insert new chunk into place */ + new16->chunks[insertpos] = chunk; + + new16->base.count++; + RT_VERIFY_NODE((RT_NODE *) new16); + + /* free old node and update references */ + RT_FREE_NODE(tree, node); + *parent_slot = newnode.alloc; + + return &new16->children[insertpos]; + } + else + { + RT_CHILD_PTR newnode; + RT_NODE_48 *new48; + int idx, + bit; + + Assert(n16->base.fanout == RT_FANOUT_16_HI); + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_48, RT_CLASS_48); + new48 = (RT_NODE_48 *) newnode.local; + + /* copy over the entries */ + RT_COPY_COMMON(newnode, node); + for (int i = 0; i < RT_FANOUT_16_HI; i++) + new48->slot_idxs[n16->chunks[i]] = i; + memcpy(&new48->children[0], &n16->children[0], RT_FANOUT_16_HI * sizeof(new48->children[0])); + + /* + * Since we just copied a dense array, we can fill "isset" using a + * single store, provided the length of that array is at most the + * number of bits in a bitmapword. + */ + Assert(RT_FANOUT_16_HI <= BITS_PER_BITMAPWORD); + new48->isset[0] = (bitmapword) (((uint64) 1 << RT_FANOUT_16_HI) - 1); + + /* put the new child at the end of the copied entries */ + insertpos = RT_FANOUT_16_HI; + idx = RT_BM_IDX(insertpos); + bit = RT_BM_BIT(insertpos); + + /* mark the slot used */ + new48->isset[idx] |= ((bitmapword) 1 << bit); + + /* insert new chunk into place */ + new48->slot_idxs[chunk] = insertpos; + + new48->base.count++; + RT_VERIFY_NODE((RT_NODE *) new48); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); + + return &new48->children[insertpos]; + } +} + +static inline RT_PTR_ALLOC * +RT_ADD_CHILD_16(RT_RADIX_TREE * tree, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_16 *n16 = (RT_NODE_16 *) node.local; + int insertpos = RT_NODE_16_GET_INSERTPOS(n16, chunk); + + /* shift chunks and children */ + RT_SHIFT_ARRAYS_FOR_INSERT(n16->chunks, n16->children, + n16->base.count, insertpos); + + /* insert new chunk into place */ + n16->chunks[insertpos] = chunk; + + n16->base.count++; + RT_VERIFY_NODE((RT_NODE *) n16); + + return &n16->children[insertpos]; +} + +static pg_noinline RT_PTR_ALLOC * +RT_GROW_NODE_4(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, + uint8 chunk) +{ + RT_NODE_4 *n4 = (RT_NODE_4 *) (node.local); + RT_CHILD_PTR newnode; + RT_NODE_16 *new16; + int insertpos; + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_16, RT_CLASS_16_LO); + new16 = (RT_NODE_16 *) newnode.local; + + /* copy over existing entries */ + RT_COPY_COMMON(newnode, node); + Assert(n4->base.count == RT_FANOUT_4); + insertpos = RT_NODE_4_GET_INSERTPOS(n4, chunk, RT_FANOUT_4); + RT_COPY_ARRAYS_FOR_INSERT(new16->chunks, new16->children, + n4->chunks, n4->children, + RT_FANOUT_4, insertpos); + + /* insert new chunk into place */ + new16->chunks[insertpos] = chunk; + + new16->base.count++; + RT_VERIFY_NODE((RT_NODE *) new16); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); + + return &new16->children[insertpos]; +} + +static inline RT_PTR_ALLOC * +RT_ADD_CHILD_4(RT_RADIX_TREE * tree, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_4 *n4 = (RT_NODE_4 *) (node.local); + int count = n4->base.count; + int insertpos = RT_NODE_4_GET_INSERTPOS(n4, chunk, count); + + /* shift chunks and children */ + RT_SHIFT_ARRAYS_FOR_INSERT(n4->chunks, n4->children, + count, insertpos); + + /* insert new chunk into place */ + n4->chunks[insertpos] = chunk; + + n4->base.count++; + RT_VERIFY_NODE((RT_NODE *) n4); + + return &n4->children[insertpos]; +} + +/* + * Reserve slot in "node"'s child array. The caller will populate it + * with the actual child pointer. + * + * "parent_slot" is the address of the parent's child pointer to "node". + * If the node we're inserting into needs to grow, we update the parent's + * child pointer with the pointer to the new larger node. + */ +static inline RT_PTR_ALLOC * +RT_NODE_INSERT(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, + uint8 chunk) +{ + RT_NODE *n = node.local; + + switch (n->kind) + { + case RT_NODE_KIND_4: + { + if (unlikely(RT_NODE_MUST_GROW(n))) + return RT_GROW_NODE_4(tree, parent_slot, node, chunk); + + return RT_ADD_CHILD_4(tree, node, chunk); + } + case RT_NODE_KIND_16: + { + if (unlikely(RT_NODE_MUST_GROW(n))) + return RT_GROW_NODE_16(tree, parent_slot, node, chunk); + + return RT_ADD_CHILD_16(tree, node, chunk); + } + case RT_NODE_KIND_48: + { + if (unlikely(RT_NODE_MUST_GROW(n))) + return RT_GROW_NODE_48(tree, parent_slot, node, chunk); + + return RT_ADD_CHILD_48(tree, node, chunk); + } + case RT_NODE_KIND_256: + return RT_ADD_CHILD_256(tree, node, chunk); + default: + pg_unreachable(); + } +} + +/* + * The radix tree doesn't have sufficient height. Put new node(s) on top, + * and move the old node below it. + */ +static pg_noinline void +RT_EXTEND_UP(RT_RADIX_TREE * tree, uint64 key) +{ + int target_shift = RT_KEY_GET_SHIFT(key); + int shift = tree->ctl->start_shift; + + Assert(shift < target_shift); + + /* Grow tree upwards until start shift can accommodate the key */ + while (shift < target_shift) + { + RT_CHILD_PTR node; + RT_NODE_4 *n4; + + node = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + n4 = (RT_NODE_4 *) node.local; + n4->base.count = 1; + n4->chunks[0] = 0; + n4->children[0] = tree->ctl->root; + + /* Update the root */ + tree->ctl->root = node.alloc; + + shift += RT_SPAN; + } + + tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(target_shift); + tree->ctl->start_shift = target_shift; +} + +/* + * Insert a chain of nodes until we reach the lowest level, + * and return the address of a slot to be filled further up + * the call stack. + */ +static pg_noinline RT_PTR_ALLOC * +RT_EXTEND_DOWN(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, uint64 key, int shift) +{ + RT_CHILD_PTR node, + child; + RT_NODE_4 *n4; + + /* + * The child pointer of the first node in the chain goes in the + * caller-provided slot. + */ + child = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + *parent_slot = child.alloc; + + node = child; + shift -= RT_SPAN; + + while (shift > 0) + { + child = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + + /* We open-code the insertion ourselves, for speed. */ + n4 = (RT_NODE_4 *) node.local; + n4->base.count = 1; + n4->chunks[0] = RT_GET_KEY_CHUNK(key, shift); + n4->children[0] = child.alloc; + + node = child; + shift -= RT_SPAN; + } + Assert(shift == 0); + + /* Reserve slot for the value. */ + n4 = (RT_NODE_4 *) node.local; + n4->chunks[0] = RT_GET_KEY_CHUNK(key, 0); + n4->base.count = 1; + + return &n4->children[0]; +} + +/* + * Workhorse for RT_SET + * + * "parent_slot" is the address of the child pointer we just followed, + * in the parent's array of children, needed if inserting into the + * current node causes it to grow. + */ +static RT_PTR_ALLOC * +RT_GET_SLOT_RECURSIVE(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, uint64 key, int shift, bool *found) +{ + RT_PTR_ALLOC *slot; + RT_CHILD_PTR node; + uint8 chunk = RT_GET_KEY_CHUNK(key, shift); + + node.alloc = *parent_slot; + RT_PTR_SET_LOCAL(tree, &node); + slot = RT_NODE_SEARCH(node.local, chunk); + + if (slot == NULL) + { + *found = false; + + /* reserve slot for the caller to populate */ + + slot = RT_NODE_INSERT(tree, parent_slot, node, chunk); + + if (shift == 0) + return slot; + else + return RT_EXTEND_DOWN(tree, slot, key, shift); + } + else + { + if (shift == 0) + { + *found = true; + return slot; + } + else + return RT_GET_SLOT_RECURSIVE(tree, slot, key, shift - RT_SPAN, found); + } +} + +/* + * Set key to value that value_p points to. If the entry already exists, we + * update its value and return true. Returns false if entry doesn't yet exist. + * + * Taking a lock in exclusive mode is the caller's responsibility. + */ +RT_SCOPE bool +RT_SET(RT_RADIX_TREE * tree, uint64 key, RT_VALUE_TYPE * value_p) +{ + bool found; + RT_PTR_ALLOC *slot; + size_t value_sz = RT_GET_VALUE_SIZE(value_p); + +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); +#endif + + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + + /* Extend the tree if necessary */ + if (unlikely(key > tree->ctl->max_val)) + { + if (tree->ctl->num_keys == 0) + { + RT_CHILD_PTR node; + RT_NODE_4 *n4; + int start_shift = RT_KEY_GET_SHIFT(key); + + /* + * With an empty root node, we don't extend the tree upwards, + * since that would result in orphan empty nodes. Instead we open + * code inserting into the root node and extend downward from + * there. + */ + node.alloc = tree->ctl->root; + RT_PTR_SET_LOCAL(tree, &node); + n4 = (RT_NODE_4 *) node.local; + n4->base.count = 1; + n4->chunks[0] = RT_GET_KEY_CHUNK(key, start_shift); + + slot = RT_EXTEND_DOWN(tree, &n4->children[0], key, start_shift); + found = false; + tree->ctl->start_shift = start_shift; + tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(start_shift); + goto have_slot; + } + else + RT_EXTEND_UP(tree, key); + } + + slot = RT_GET_SLOT_RECURSIVE(tree, &tree->ctl->root, + key, tree->ctl->start_shift, &found); + +have_slot: + Assert(slot != NULL); + + if (RT_VALUE_IS_EMBEDDABLE(value_p)) + { + /* free the existing leaf */ + if (found && !RT_CHILDPTR_IS_VALUE(*slot)) + RT_FREE_LEAF(tree, *slot); + + /* store value directly in child pointer slot */ + memcpy(slot, value_p, value_sz); + +#ifdef RT_RUNTIME_EMBEDDABLE_VALUE + /* tag child pointer */ +#ifdef RT_SHMEM + *slot |= 1; +#else + *((uintptr_t *) slot) |= 1; +#endif +#endif + } + else + { + RT_CHILD_PTR leaf; + + if (found && !RT_CHILDPTR_IS_VALUE(*slot)) + { + Assert(RT_PTR_ALLOC_IS_VALID(*slot)); + leaf.alloc = *slot; + RT_PTR_SET_LOCAL(tree, &leaf); + + if (RT_GET_VALUE_SIZE((RT_VALUE_TYPE *) leaf.local) != value_sz) + { + /* + * different sizes, so first free the existing leaf before + * allocating a new one + */ + RT_FREE_LEAF(tree, *slot); + leaf = RT_ALLOC_LEAF(tree, value_sz); + *slot = leaf.alloc; + } + } + else + { + /* allocate new leaf and store it in the child array */ + leaf = RT_ALLOC_LEAF(tree, value_sz); + *slot = leaf.alloc; + } + + memcpy(leaf.local, value_p, value_sz); + } + + /* Update the statistics */ + if (!found) + tree->ctl->num_keys++; + + return found; +} + +/***************** SETUP / TEARDOWN *****************/ + +/* + * Create the radix tree root in the caller's memory context and return it. + * + * The tree's nodes and leaves are allocated in "ctx" and its children for + * local memory, or in "dsa" for shared memory. + */ +RT_SCOPE RT_RADIX_TREE * +#ifdef RT_SHMEM +RT_CREATE(dsa_area *dsa, int tranche_id) +#else +RT_CREATE(MemoryContext ctx) +#endif +{ + RT_RADIX_TREE *tree; + RT_CHILD_PTR rootnode; +#ifdef RT_SHMEM + dsa_pointer dp; +#endif + + tree = (RT_RADIX_TREE *) palloc0(sizeof(RT_RADIX_TREE)); + +#ifdef RT_SHMEM + tree->dsa = dsa; + dp = dsa_allocate0(dsa, sizeof(RT_RADIX_TREE_CONTROL)); + tree->ctl = (RT_RADIX_TREE_CONTROL *) dsa_get_address(dsa, dp); + tree->ctl->handle = dp; + tree->ctl->magic = RT_RADIX_TREE_MAGIC; + LWLockInitialize(&tree->ctl->lock, tranche_id); +#else + tree->ctl = (RT_RADIX_TREE_CONTROL *) palloc0(sizeof(RT_RADIX_TREE_CONTROL)); + + /* Create a slab context for each size class */ + for (int i = 0; i < RT_NUM_SIZE_CLASSES; i++) + { + RT_SIZE_CLASS_ELEM size_class = RT_SIZE_CLASS_INFO[i]; + size_t inner_blocksize = RT_SLAB_BLOCK_SIZE(size_class.allocsize); + + tree->node_slabs[i] = SlabContextCreate(ctx, + size_class.name, + inner_blocksize, + size_class.allocsize); + } + + tree->leaf_context = ctx; +#endif /* RT_SHMEM */ + + /* add root node now so that RT_SET can assume it exists */ + rootnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + tree->ctl->root = rootnode.alloc; + tree->ctl->start_shift = 0; + tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(0); + + return tree; +} + +#ifdef RT_SHMEM +RT_SCOPE RT_RADIX_TREE * +RT_ATTACH(dsa_area *dsa, RT_HANDLE handle) +{ + RT_RADIX_TREE *tree; + dsa_pointer control; + + tree = (RT_RADIX_TREE *) palloc0(sizeof(RT_RADIX_TREE)); + + /* Find the control object in shared memory */ + control = handle; + + tree->dsa = dsa; + tree->ctl = (RT_RADIX_TREE_CONTROL *) dsa_get_address(dsa, control); + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + + return tree; +} + +RT_SCOPE void +RT_DETACH(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + pfree(tree); +} + +RT_SCOPE RT_HANDLE +RT_GET_HANDLE(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + return tree->ctl->handle; +} + +RT_SCOPE void +RT_LOCK_EXCLUSIVE(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + LWLockAcquire(&tree->ctl->lock, LW_EXCLUSIVE); +} + +RT_SCOPE void +RT_LOCK_SHARE(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + LWLockAcquire(&tree->ctl->lock, LW_SHARED); +} + +RT_SCOPE void +RT_UNLOCK(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + LWLockRelease(&tree->ctl->lock); +} + +/* + * Recursively free all nodes allocated in the DSA area. + */ +static void +RT_FREE_RECURSE(RT_RADIX_TREE * tree, RT_PTR_ALLOC ptr, int shift) +{ + RT_CHILD_PTR node; + + check_stack_depth(); + + node.alloc = ptr; + RT_PTR_SET_LOCAL(tree, &node); + + switch (node.local->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) node.local; + + for (int i = 0; i < n4->base.count; i++) + { + RT_PTR_ALLOC child = n4->children[i]; + + if (shift > 0) + RT_FREE_RECURSE(tree, child, shift - RT_SPAN); + else if (!RT_CHILDPTR_IS_VALUE(child)) + dsa_free(tree->dsa, child); + } + + break; + } + case RT_NODE_KIND_16: + { + RT_NODE_16 *n16 = (RT_NODE_16 *) node.local; + + for (int i = 0; i < n16->base.count; i++) + { + RT_PTR_ALLOC child = n16->children[i]; + + if (shift > 0) + RT_FREE_RECURSE(tree, child, shift - RT_SPAN); + else if (!RT_CHILDPTR_IS_VALUE(child)) + dsa_free(tree->dsa, child); + } + + break; + } + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node.local; + + for (int i = 0; i < RT_NODE_MAX_SLOTS; i++) + { + RT_PTR_ALLOC child; + + if (!RT_NODE_48_IS_CHUNK_USED(n48, i)) + continue; + + child = *RT_NODE_48_GET_CHILD(n48, i); + + if (shift > 0) + RT_FREE_RECURSE(tree, child, shift - RT_SPAN); + else if (!RT_CHILDPTR_IS_VALUE(child)) + dsa_free(tree->dsa, child); + } + + break; + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) node.local; + + for (int i = 0; i < RT_NODE_MAX_SLOTS; i++) + { + RT_PTR_ALLOC child; + + if (!RT_NODE_256_IS_CHUNK_USED(n256, i)) + continue; + + child = *RT_NODE_256_GET_CHILD(n256, i); + + if (shift > 0) + RT_FREE_RECURSE(tree, child, shift - RT_SPAN); + else if (!RT_CHILDPTR_IS_VALUE(child)) + dsa_free(tree->dsa, child); + } + + break; + } + } + + /* Free the inner node */ + dsa_free(tree->dsa, ptr); +} +#endif + +/* + * Free the radix tree, including all nodes and leaves. + */ +RT_SCOPE void +RT_FREE(RT_RADIX_TREE * tree) +{ +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + + /* Free all memory used for radix tree nodes */ + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + RT_FREE_RECURSE(tree, tree->ctl->root, tree->ctl->start_shift); + + /* + * Vandalize the control block to help catch programming error where other + * backends access the memory formerly occupied by this radix tree. + */ + tree->ctl->magic = 0; + dsa_free(tree->dsa, tree->ctl->handle); +#else + /* + * Free all space allocated within the leaf context and delete all child + * contexts such as those used for nodes. + */ + MemoryContextReset(tree->leaf_context); + + pfree(tree->ctl); +#endif + pfree(tree); +} + +/***************** ITERATION *****************/ + +/* + * Create and return an iterator for the given radix tree + * in the caller's memory context. + * + * Taking a lock in shared mode during the iteration is the caller's + * responsibility. + */ +RT_SCOPE RT_ITER * +RT_BEGIN_ITERATE(RT_RADIX_TREE * tree) +{ + RT_ITER *iter; + RT_CHILD_PTR root; + + iter = (RT_ITER *) palloc0(sizeof(RT_ITER)); + iter->tree = tree; + + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + root.alloc = iter->tree->ctl->root; + RT_PTR_SET_LOCAL(tree, &root); + + iter->top_level = iter->tree->ctl->start_shift / RT_SPAN; + + /* Set the root to start */ + iter->cur_level = iter->top_level; + iter->node_iters[iter->cur_level].node = root; + iter->node_iters[iter->cur_level].idx = 0; + + return iter; +} + +/* + * Scan the inner node and return the next child pointer if one exists, otherwise + * return NULL. + */ +static inline RT_PTR_ALLOC * +RT_NODE_ITERATE_NEXT(RT_ITER * iter, int level) +{ + uint8 key_chunk = 0; + RT_NODE_ITER *node_iter; + RT_CHILD_PTR node; + RT_PTR_ALLOC *slot = NULL; + +#ifdef RT_SHMEM + Assert(iter->tree->ctl->magic == RT_RADIX_TREE_MAGIC); +#endif + + node_iter = &(iter->node_iters[level]); + node = node_iter->node; + + Assert(node.local != NULL); + + switch ((node.local)->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) (node.local); + + if (node_iter->idx >= n4->base.count) + return NULL; + + slot = &n4->children[node_iter->idx]; + key_chunk = n4->chunks[node_iter->idx]; + node_iter->idx++; + break; + } + case RT_NODE_KIND_16: + { + RT_NODE_16 *n16 = (RT_NODE_16 *) (node.local); + + if (node_iter->idx >= n16->base.count) + return NULL; + + slot = &n16->children[node_iter->idx]; + key_chunk = n16->chunks[node_iter->idx]; + node_iter->idx++; + break; + } + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) (node.local); + int chunk; + + for (chunk = node_iter->idx; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (RT_NODE_48_IS_CHUNK_USED(n48, chunk)) + break; + } + + if (chunk >= RT_NODE_MAX_SLOTS) + return NULL; + + slot = RT_NODE_48_GET_CHILD(n48, chunk); + + key_chunk = chunk; + node_iter->idx = chunk + 1; + break; + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) (node.local); + int chunk; + + for (chunk = node_iter->idx; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (RT_NODE_256_IS_CHUNK_USED(n256, chunk)) + break; + } + + if (chunk >= RT_NODE_MAX_SLOTS) + return NULL; + + slot = RT_NODE_256_GET_CHILD(n256, chunk); + + key_chunk = chunk; + node_iter->idx = chunk + 1; + break; + } + } + + /* Update the key */ + iter->key &= ~(((uint64) RT_CHUNK_MASK) << (level * RT_SPAN)); + iter->key |= (((uint64) key_chunk) << (level * RT_SPAN)); + + return slot; +} + +/* + * Return pointer to value and set key_p as long as there is a key. Otherwise + * return NULL. + */ +RT_SCOPE RT_VALUE_TYPE * +RT_ITERATE_NEXT(RT_ITER * iter, uint64 *key_p) +{ + RT_PTR_ALLOC *slot = NULL; + + while (iter->cur_level <= iter->top_level) + { + RT_CHILD_PTR node; + + slot = RT_NODE_ITERATE_NEXT(iter, iter->cur_level); + + if (iter->cur_level == 0 && slot != NULL) + { + /* Found a value at the leaf node */ + *key_p = iter->key; + node.alloc = *slot; + + if (RT_CHILDPTR_IS_VALUE(*slot)) + return (RT_VALUE_TYPE *) slot; + else + { + RT_PTR_SET_LOCAL(iter->tree, &node); + return (RT_VALUE_TYPE *) node.local; + } + } + + if (slot != NULL) + { + /* Found the child slot, move down the tree */ + node.alloc = *slot; + RT_PTR_SET_LOCAL(iter->tree, &node); + + iter->cur_level--; + iter->node_iters[iter->cur_level].node = node; + iter->node_iters[iter->cur_level].idx = 0; + } + else + { + /* Not found the child slot, move up the tree */ + iter->cur_level++; + } + } + + /* We've visited all nodes, so the iteration finished */ + return NULL; +} + +/* + * Terminate the iteration. The caller is responsible for releasing any locks. + */ +RT_SCOPE void +RT_END_ITERATE(RT_ITER * iter) +{ + pfree(iter); +} + +/***************** DELETION *****************/ + +#ifdef RT_USE_DELETE + +/* Delete the element at "deletepos" */ +static inline void +RT_SHIFT_ARRAYS_AND_DELETE(uint8 *chunks, RT_PTR_ALLOC * children, int count, int deletepos) +{ + /* + * This is basically a memmove, but written in a simple loop for speed on + * small inputs. + */ + for (int i = deletepos; i < count - 1; i++) + { + /* workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101481 */ +#ifdef __GNUC__ + __asm__(""); +#endif + chunks[i] = chunks[i + 1]; + children[i] = children[i + 1]; + } +} + +/* + * Copy both chunk and slot arrays into the right + * place. The element at "deletepos" is deleted by skipping it. + */ +static inline void +RT_COPY_ARRAYS_AND_DELETE(uint8 *dst_chunks, RT_PTR_ALLOC * dst_children, + uint8 *src_chunks, RT_PTR_ALLOC * src_children, + int count, int deletepos) +{ + for (int i = 0; i < count - 1; i++) + { + /* + * use a branch-free computation to skip the index of the deleted + * element + */ + int sourceidx = i + (i >= deletepos); + int destidx = i; + + dst_chunks[destidx] = src_chunks[sourceidx]; + dst_children[destidx] = src_children[sourceidx]; + } +} + +/* + * Note: While all node-growing functions are called to perform an insertion + * when no more space is available, shrinking is not a hard-and-fast requirement. + * When shrinking nodes, we generally wait until the count is about 3/4 of + * the next lower node's fanout. This prevents ping-ponging between different + * node sizes. + * + * Some shrinking functions delete first and then shrink, either because we + * must or because it's fast and simple that way. Sometimes it's faster to + * delete while shrinking. + */ + +/* + * Move contents of a node256 to a node48. Any deletion should have happened + * in the caller. + */ +static void pg_noinline +RT_SHRINK_NODE_256(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_256 *n256 = (RT_NODE_256 *) node.local; + RT_CHILD_PTR newnode; + RT_NODE_48 *new48; + int slot_idx = 0; + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_48, RT_CLASS_48); + new48 = (RT_NODE_48 *) newnode.local; + + /* copy over the entries */ + RT_COPY_COMMON(newnode, node); + for (int i = 0; i < RT_NODE_MAX_SLOTS; i++) + { + if (RT_NODE_256_IS_CHUNK_USED(n256, i)) + { + new48->slot_idxs[i] = slot_idx; + new48->children[slot_idx] = n256->children[i]; + slot_idx++; + } + } + + /* + * Since we just copied a dense array, we can fill "isset" using a single + * store, provided the length of that array is at most the number of bits + * in a bitmapword. + */ + Assert(n256->base.count <= BITS_PER_BITMAPWORD); + new48->isset[0] = (bitmapword) (((uint64) 1 << n256->base.count) - 1); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); +} + +static inline void +RT_REMOVE_CHILD_256(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk) +{ + int shrink_threshold; + RT_NODE_256 *n256 = (RT_NODE_256 *) node.local; + int idx = RT_BM_IDX(chunk); + int bitnum = RT_BM_BIT(chunk); + + /* Mark the slot free for "chunk" */ + n256->isset[idx] &= ~((bitmapword) 1 << bitnum); + + n256->base.count--; + + /* + * A full node256 will have a count of zero because of overflow, so we + * delete first before checking the shrink threshold. + */ + Assert(n256->base.count > 0); + + /* This simplifies RT_SHRINK_NODE_256() */ + shrink_threshold = BITS_PER_BITMAPWORD; + shrink_threshold = Min(RT_FANOUT_48 / 4 * 3, shrink_threshold); + + if (n256->base.count <= shrink_threshold) + RT_SHRINK_NODE_256(tree, parent_slot, node, chunk); +} + +/* + * Move contents of a node48 to a node16. Any deletion should have happened + * in the caller. + */ +static void pg_noinline +RT_SHRINK_NODE_48(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_48 *n48 = (RT_NODE_48 *) (node.local); + RT_CHILD_PTR newnode; + RT_NODE_16 *new16; + int destidx = 0; + + /* + * Initialize new node. For now we skip the larger node16 size class for + * simplicity. + */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_16, RT_CLASS_16_LO); + new16 = (RT_NODE_16 *) newnode.local; + + /* copy over all existing entries */ + RT_COPY_COMMON(newnode, node); + for (int chunk = 0; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (n48->slot_idxs[chunk] != RT_INVALID_SLOT_IDX) + { + new16->chunks[destidx] = chunk; + new16->children[destidx] = n48->children[n48->slot_idxs[chunk]]; + destidx++; + } + } + + Assert(destidx < new16->base.fanout); + + RT_VERIFY_NODE((RT_NODE *) new16); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); +} + +static inline void +RT_REMOVE_CHILD_48(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_48 *n48 = (RT_NODE_48 *) node.local; + int deletepos = n48->slot_idxs[chunk]; + + /* For now we skip the larger node16 size class for simplicity */ + int shrink_threshold = RT_FANOUT_16_LO / 4 * 3; + int idx; + int bitnum; + + Assert(deletepos != RT_INVALID_SLOT_IDX); + + idx = RT_BM_IDX(deletepos); + bitnum = RT_BM_BIT(deletepos); + n48->isset[idx] &= ~((bitmapword) 1 << bitnum); + n48->slot_idxs[chunk] = RT_INVALID_SLOT_IDX; + + n48->base.count--; + + /* + * To keep shrinking simple, do it after deleting, which is fast for + * node48 anyway. + */ + if (n48->base.count <= shrink_threshold) + RT_SHRINK_NODE_48(tree, parent_slot, node, chunk); +} + +/* + * Move contents of a node16 to a node4, and delete the one at "deletepos". + * By deleting as we move, we can avoid memmove operations in the new + * node. + */ +static void pg_noinline +RT_SHRINK_NODE_16(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 deletepos) +{ + RT_NODE_16 *n16 = (RT_NODE_16 *) (node.local); + RT_CHILD_PTR newnode; + RT_NODE_4 *new4; + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + new4 = (RT_NODE_4 *) newnode.local; + + /* copy over existing entries, except for the one at "deletepos" */ + RT_COPY_COMMON(newnode, node); + RT_COPY_ARRAYS_AND_DELETE(new4->chunks, new4->children, + n16->chunks, n16->children, + n16->base.count, deletepos); + + new4->base.count--; + RT_VERIFY_NODE((RT_NODE *) new4); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); +} + +static inline void +RT_REMOVE_CHILD_16(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk, RT_PTR_ALLOC * slot) +{ + RT_NODE_16 *n16 = (RT_NODE_16 *) node.local; + int deletepos = slot - n16->children; + + /* + * When shrinking to node4, 4 is hard-coded. After shrinking, the new node + * will end up with 3 elements and 3 is the largest count where linear + * search is faster than SIMD, at least on x86-64. + */ + if (n16->base.count <= 4) + { + RT_SHRINK_NODE_16(tree, parent_slot, node, deletepos); + return; + } + + Assert(deletepos >= 0); + Assert(n16->chunks[deletepos] == chunk); + + RT_SHIFT_ARRAYS_AND_DELETE(n16->chunks, n16->children, + n16->base.count, deletepos); + n16->base.count--; +} + +static inline void +RT_REMOVE_CHILD_4(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk, RT_PTR_ALLOC * slot) +{ + RT_NODE_4 *n4 = (RT_NODE_4 *) node.local; + + if (n4->base.count == 1) + { + Assert(n4->chunks[0] == chunk); + + /* + * If we're deleting the last entry from the root child node don't + * free it, but mark both the tree and the root child node empty. That + * way, RT_SET can assume it exists. + */ + if (parent_slot == &tree->ctl->root) + { + n4->base.count = 0; + tree->ctl->start_shift = 0; + tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(0); + } + else + { + /* + * Deleting last entry, so just free the entire node. + * RT_DELETE_RECURSIVE has already freed the value and lower-level + * children. + */ + RT_FREE_NODE(tree, node); + + /* + * Also null out the parent's slot -- this tells the next higher + * level to delete its child pointer + */ + *parent_slot = RT_INVALID_PTR_ALLOC; + } + } + else + { + int deletepos = slot - n4->children; + + Assert(deletepos >= 0); + Assert(n4->chunks[deletepos] == chunk); + + RT_SHIFT_ARRAYS_AND_DELETE(n4->chunks, n4->children, + n4->base.count, deletepos); + + n4->base.count--; + } +} + +/* + * Delete the child pointer corresponding to "key" in the given node. + */ +static inline void +RT_NODE_DELETE(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk, RT_PTR_ALLOC * slot) +{ + switch ((node.local)->kind) + { + case RT_NODE_KIND_4: + { + RT_REMOVE_CHILD_4(tree, parent_slot, node, chunk, slot); + return; + } + case RT_NODE_KIND_16: + { + RT_REMOVE_CHILD_16(tree, parent_slot, node, chunk, slot); + return; + } + case RT_NODE_KIND_48: + { + RT_REMOVE_CHILD_48(tree, parent_slot, node, chunk); + return; + } + case RT_NODE_KIND_256: + { + RT_REMOVE_CHILD_256(tree, parent_slot, node, chunk); + return; + } + default: + pg_unreachable(); + } +} + +/* workhorse for RT_DELETE */ +static bool +RT_DELETE_RECURSIVE(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, uint64 key, int shift) +{ + RT_PTR_ALLOC *slot; + RT_CHILD_PTR node; + uint8 chunk = RT_GET_KEY_CHUNK(key, shift); + + node.alloc = *parent_slot; + RT_PTR_SET_LOCAL(tree, &node); + slot = RT_NODE_SEARCH(node.local, chunk); + + if (slot == NULL) + return false; + + if (shift == 0) + { + if (!RT_CHILDPTR_IS_VALUE(*slot)) + RT_FREE_LEAF(tree, *slot); + + RT_NODE_DELETE(tree, parent_slot, node, chunk, slot); + return true; + } + else + { + bool deleted; + + deleted = RT_DELETE_RECURSIVE(tree, slot, key, shift - RT_SPAN); + + /* Child node was freed, so delete its slot now */ + if (*slot == RT_INVALID_PTR_ALLOC) + { + Assert(deleted); + RT_NODE_DELETE(tree, parent_slot, node, chunk, slot); + } + + return deleted; + } +} + +/* + * Delete the given key from the radix tree. If the key is found delete it + * and return true, otherwise do nothing and return false. + * + * Taking a lock in exclusive mode is the caller's responsibility. + */ +RT_SCOPE bool +RT_DELETE(RT_RADIX_TREE * tree, uint64 key) +{ + bool deleted; + +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); +#endif + + if (key > tree->ctl->max_val) + return false; + + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + deleted = RT_DELETE_RECURSIVE(tree, &tree->ctl->root, + key, tree->ctl->start_shift); + + /* Found the key to delete. Update the statistics */ + if (deleted) + { + tree->ctl->num_keys--; + Assert(tree->ctl->num_keys >= 0); + } + + return deleted; +} + +#endif /* RT_USE_DELETE */ + +/***************** UTILITY FUNCTIONS *****************/ + +/* + * Return the statistics of the amount of memory used by the radix tree. + * + * Since dsa_get_total_size() does appropriate locking, the caller doesn't + * need to take a lock. + */ +RT_SCOPE uint64 +RT_MEMORY_USAGE(RT_RADIX_TREE * tree) +{ + size_t total = 0; + +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + total = dsa_get_total_size(tree->dsa); +#else + total = MemoryContextMemAllocated(tree->leaf_context, true); +#endif + + return total; +} + +/* + * Perform some sanity checks on the given node. + */ +static void +RT_VERIFY_NODE(RT_NODE * node) +{ +#ifdef USE_ASSERT_CHECKING + + switch (node->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) node; + + /* RT_DUMP_NODE(node); */ + + for (int i = 1; i < n4->base.count; i++) + Assert(n4->chunks[i - 1] < n4->chunks[i]); + + break; + } + case RT_NODE_KIND_16: + { + RT_NODE_16 *n16 = (RT_NODE_16 *) node; + + /* RT_DUMP_NODE(node); */ + + for (int i = 1; i < n16->base.count; i++) + Assert(n16->chunks[i - 1] < n16->chunks[i]); + + break; + } + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node; + int cnt = 0; + + /* RT_DUMP_NODE(node); */ + + for (int i = 0; i < RT_NODE_MAX_SLOTS; i++) + { + uint8 slot = n48->slot_idxs[i]; + int idx = RT_BM_IDX(slot); + int bitnum = RT_BM_BIT(slot); + + if (!RT_NODE_48_IS_CHUNK_USED(n48, i)) + continue; + + /* Check if the corresponding slot is used */ + Assert(slot < node->fanout); + Assert((n48->isset[idx] & ((bitmapword) 1 << bitnum)) != 0); + + cnt++; + } + + Assert(n48->base.count == cnt); + + break; + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) node; + int cnt = 0; + + /* RT_DUMP_NODE(node); */ + + for (int i = 0; i < RT_BM_IDX(RT_NODE_MAX_SLOTS); i++) + cnt += bmw_popcount(n256->isset[i]); + + /* + * Check if the number of used chunk matches, accounting for + * overflow + */ + if (cnt == RT_FANOUT_256) + Assert(n256->base.count == 0); + else + Assert(n256->base.count == cnt); + + break; + } + } +#endif +} + +/***************** DEBUG FUNCTIONS *****************/ + +#ifdef RT_DEBUG + +/* + * Print out tree stats, some of which are only collected in debugging builds. + */ +RT_SCOPE void +RT_STATS(RT_RADIX_TREE * tree) +{ + fprintf(stderr, "max_val = " UINT64_FORMAT "\n", tree->ctl->max_val); + fprintf(stderr, "num_keys = %" PRId64 "\n", tree->ctl->num_keys); + +#ifdef RT_SHMEM + fprintf(stderr, "handle = " DSA_POINTER_FORMAT "\n", tree->ctl->handle); +#endif + + fprintf(stderr, "height = %d", tree->ctl->start_shift / RT_SPAN); + + for (int i = 0; i < RT_NUM_SIZE_CLASSES; i++) + { + RT_SIZE_CLASS_ELEM size_class = RT_SIZE_CLASS_INFO[i]; + + fprintf(stderr, ", n%d = %" PRId64, size_class.fanout, tree->ctl->num_nodes[i]); + } + + fprintf(stderr, ", leaves = %" PRId64, tree->ctl->num_leaves); + + fprintf(stderr, "\n"); +} + +/* + * Print out debugging information about the given node. + */ +static void +pg_attribute_unused() +RT_DUMP_NODE(RT_NODE * node) +{ +#ifdef RT_SHMEM +#define RT_CHILD_PTR_FORMAT DSA_POINTER_FORMAT +#else +#define RT_CHILD_PTR_FORMAT "%p" +#endif + + fprintf(stderr, "kind %d, fanout %d, count %u\n", + (node->kind == RT_NODE_KIND_4) ? 4 : + (node->kind == RT_NODE_KIND_16) ? 16 : + (node->kind == RT_NODE_KIND_48) ? 48 : 256, + node->fanout == 0 ? 256 : node->fanout, + node->count == 0 ? 256 : node->count); + + switch (node->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) node; + + fprintf(stderr, "chunks and slots:\n"); + for (int i = 0; i < n4->base.count; i++) + { + fprintf(stderr, " [%d] chunk %x slot " RT_CHILD_PTR_FORMAT "\n", + i, n4->chunks[i], n4->children[i]); + } + + break; + } + case RT_NODE_KIND_16: + { + RT_NODE_16 *n16 = (RT_NODE_16 *) node; + + fprintf(stderr, "chunks and slots:\n"); + for (int i = 0; i < n16->base.count; i++) + { + fprintf(stderr, " [%d] chunk %x slot " RT_CHILD_PTR_FORMAT "\n", + i, n16->chunks[i], n16->children[i]); + } + break; + } + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node; + char *sep = ""; + + fprintf(stderr, "slot_idxs: \n"); + for (int chunk = 0; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (!RT_NODE_48_IS_CHUNK_USED(n48, chunk)) + continue; + + fprintf(stderr, " idx[%d] = %d\n", + chunk, n48->slot_idxs[chunk]); + } + + fprintf(stderr, "isset-bitmap: "); + for (int i = 0; i < (RT_FANOUT_48_MAX / BITS_PER_BYTE); i++) + { + fprintf(stderr, "%s%x", sep, ((uint8 *) n48->isset)[i]); + sep = " "; + } + fprintf(stderr, "\n"); + + fprintf(stderr, "chunks and slots:\n"); + for (int chunk = 0; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (!RT_NODE_48_IS_CHUNK_USED(n48, chunk)) + continue; + + fprintf(stderr, " chunk %x slot " RT_CHILD_PTR_FORMAT "\n", + chunk, + *RT_NODE_48_GET_CHILD(n48, chunk)); + } + break; + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) node; + char *sep = ""; + + fprintf(stderr, "isset-bitmap: "); + for (int i = 0; i < (RT_FANOUT_256 / BITS_PER_BYTE); i++) + { + fprintf(stderr, "%s%x", sep, ((uint8 *) n256->isset)[i]); + sep = " "; + } + fprintf(stderr, "\n"); + + fprintf(stderr, "chunks and slots:\n"); + for (int chunk = 0; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (!RT_NODE_256_IS_CHUNK_USED(n256, chunk)) + continue; + + fprintf(stderr, " chunk %x slot " RT_CHILD_PTR_FORMAT "\n", + chunk, + *RT_NODE_256_GET_CHILD(n256, chunk)); + } + break; + } + } +} +#endif /* RT_DEBUG */ + +#endif /* RT_DEFINE */ + + +/* undefine external parameters, so next radix tree can be defined */ +#undef RT_PREFIX +#undef RT_SCOPE +#undef RT_DECLARE +#undef RT_DEFINE +#undef RT_VALUE_TYPE +#undef RT_VARLEN_VALUE_SIZE +#undef RT_RUNTIME_EMBEDDABLE_VALUE +#undef RT_SHMEM +#undef RT_USE_DELETE +#undef RT_DEBUG + +/* locally declared macros */ +#undef RT_MAKE_PREFIX +#undef RT_MAKE_NAME +#undef RT_MAKE_NAME_ +#undef RT_STR +#undef RT_STR_ +#undef RT_SPAN +#undef RT_NODE_MAX_SLOTS +#undef RT_CHUNK_MASK +#undef RT_MAX_SHIFT +#undef RT_MAX_LEVEL +#undef RT_GET_KEY_CHUNK +#undef RT_BM_IDX +#undef RT_BM_BIT +#undef RT_NODE_MUST_GROW +#undef RT_NODE_KIND_COUNT +#undef RT_NUM_SIZE_CLASSES +#undef RT_INVALID_SLOT_IDX +#undef RT_SLAB_BLOCK_SIZE +#undef RT_RADIX_TREE_MAGIC +#undef RT_CHILD_PTR_FORMAT + +/* type declarations */ +#undef RT_RADIX_TREE +#undef RT_RADIX_TREE_CONTROL +#undef RT_CHILD_PTR +#undef RT_PTR_ALLOC +#undef RT_INVALID_PTR_ALLOC +#undef RT_HANDLE +#undef RT_ITER +#undef RT_NODE +#undef RT_NODE_ITER +#undef RT_NODE_KIND_4 +#undef RT_NODE_KIND_16 +#undef RT_NODE_KIND_48 +#undef RT_NODE_KIND_256 +#undef RT_NODE_4 +#undef RT_NODE_16 +#undef RT_NODE_48 +#undef RT_NODE_256 +#undef RT_SIZE_CLASS +#undef RT_SIZE_CLASS_ELEM +#undef RT_SIZE_CLASS_INFO +#undef RT_CLASS_4 +#undef RT_CLASS_16_LO +#undef RT_CLASS_16_HI +#undef RT_CLASS_48 +#undef RT_CLASS_256 +#undef RT_FANOUT_4 +#undef RT_FANOUT_4_MAX +#undef RT_FANOUT_16_LO +#undef RT_FANOUT_16_HI +#undef RT_FANOUT_16_MAX +#undef RT_FANOUT_48 +#undef RT_FANOUT_48_MAX +#undef RT_FANOUT_256 + +/* function declarations */ +#undef RT_CREATE +#undef RT_FREE +#undef RT_ATTACH +#undef RT_DETACH +#undef RT_LOCK_EXCLUSIVE +#undef RT_LOCK_SHARE +#undef RT_UNLOCK +#undef RT_GET_HANDLE +#undef RT_FIND +#undef RT_SET +#undef RT_BEGIN_ITERATE +#undef RT_ITERATE_NEXT +#undef RT_END_ITERATE +#undef RT_DELETE +#undef RT_MEMORY_USAGE +#undef RT_DUMP_NODE +#undef RT_STATS + +/* internal helper functions */ +#undef RT_GET_VALUE_SIZE +#undef RT_VALUE_IS_EMBEDDABLE +#undef RT_CHILDPTR_IS_VALUE +#undef RT_GET_SLOT_RECURSIVE +#undef RT_DELETE_RECURSIVE +#undef RT_ALLOC_NODE +#undef RT_ALLOC_LEAF +#undef RT_FREE_NODE +#undef RT_FREE_LEAF +#undef RT_FREE_RECURSE +#undef RT_EXTEND_UP +#undef RT_EXTEND_DOWN +#undef RT_COPY_COMMON +#undef RT_PTR_SET_LOCAL +#undef RT_PTR_ALLOC_IS_VALID +#undef RT_NODE_16_SEARCH_EQ +#undef RT_NODE_4_GET_INSERTPOS +#undef RT_NODE_16_GET_INSERTPOS +#undef RT_SHIFT_ARRAYS_FOR_INSERT +#undef RT_SHIFT_ARRAYS_AND_DELETE +#undef RT_COPY_ARRAYS_FOR_INSERT +#undef RT_COPY_ARRAYS_AND_DELETE +#undef RT_NODE_48_IS_CHUNK_USED +#undef RT_NODE_48_GET_CHILD +#undef RT_NODE_256_IS_CHUNK_USED +#undef RT_NODE_256_GET_CHILD +#undef RT_KEY_GET_SHIFT +#undef RT_SHIFT_GET_MAX_VAL +#undef RT_NODE_SEARCH +#undef RT_ADD_CHILD_4 +#undef RT_ADD_CHILD_16 +#undef RT_ADD_CHILD_48 +#undef RT_ADD_CHILD_256 +#undef RT_GROW_NODE_4 +#undef RT_GROW_NODE_16 +#undef RT_GROW_NODE_48 +#undef RT_REMOVE_CHILD_4 +#undef RT_REMOVE_CHILD_16 +#undef RT_REMOVE_CHILD_48 +#undef RT_REMOVE_CHILD_256 +#undef RT_SHRINK_NODE_16 +#undef RT_SHRINK_NODE_48 +#undef RT_SHRINK_NODE_256 +#undef RT_NODE_DELETE +#undef RT_NODE_INSERT +#undef RT_NODE_ITERATE_NEXT +#undef RT_VERIFY_NODE diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/rbtree.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/rbtree.h new file mode 100644 index 0000000..37d6d8e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/rbtree.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------------------- + * + * rbtree.h + * interface for PostgreSQL generic Red-Black binary tree package + * + * Copyright (c) 2009-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/lib/rbtree.h + * + *------------------------------------------------------------------------- + */ +#ifndef RBTREE_H +#define RBTREE_H + +/* + * RBTNode is intended to be used as the first field of a larger struct, + * whose additional fields carry whatever payload data the caller needs + * for a tree entry. (The total size of that larger struct is passed to + * rbt_create.) RBTNode is declared here to support this usage, but + * callers must treat it as an opaque struct. + */ +typedef struct RBTNode +{ + char color; /* node's current color, red or black */ + struct RBTNode *left; /* left child, or RBTNIL if none */ + struct RBTNode *right; /* right child, or RBTNIL if none */ + struct RBTNode *parent; /* parent, or NULL (not RBTNIL!) if none */ +} RBTNode; + +/* Opaque struct representing a whole tree */ +typedef struct RBTree RBTree; + +/* Available tree iteration orderings */ +typedef enum RBTOrderControl +{ + LeftRightWalk, /* inorder: left child, node, right child */ + RightLeftWalk /* reverse inorder: right, node, left */ +} RBTOrderControl; + +/* + * RBTreeIterator holds state while traversing a tree. This is declared + * here so that callers can stack-allocate this, but must otherwise be + * treated as an opaque struct. + */ +typedef struct RBTreeIterator RBTreeIterator; + +struct RBTreeIterator +{ + RBTree *rbt; + RBTNode *(*iterate) (RBTreeIterator *iter); + RBTNode *last_visited; + bool is_over; +}; + +/* Support functions to be provided by caller */ +typedef int (*rbt_comparator) (const RBTNode *a, const RBTNode *b, void *arg); +typedef void (*rbt_combiner) (RBTNode *existing, const RBTNode *newdata, void *arg); +typedef RBTNode *(*rbt_allocfunc) (void *arg); +typedef void (*rbt_freefunc) (RBTNode *x, void *arg); + +extern RBTree *rbt_create(Size node_size, + rbt_comparator comparator, + rbt_combiner combiner, + rbt_allocfunc allocfunc, + rbt_freefunc freefunc, + void *arg); + +extern RBTNode *rbt_find(RBTree *rbt, const RBTNode *data); +extern RBTNode *rbt_find_great(RBTree *rbt, const RBTNode *data, bool equal_match); +extern RBTNode *rbt_find_less(RBTree *rbt, const RBTNode *data, bool equal_match); +extern RBTNode *rbt_leftmost(RBTree *rbt); + +extern RBTNode *rbt_insert(RBTree *rbt, const RBTNode *data, bool *isNew); +extern void rbt_delete(RBTree *rbt, RBTNode *node); + +extern void rbt_begin_iterate(RBTree *rbt, RBTOrderControl ctrl, + RBTreeIterator *iter); +extern RBTNode *rbt_iterate(RBTreeIterator *iter); + +#endif /* RBTREE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/simplehash.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/simplehash.h new file mode 100644 index 0000000..9622131 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/simplehash.h @@ -0,0 +1,1210 @@ +/* + * simplehash.h + * + * When included this file generates a "templated" (by way of macros) + * open-addressing hash table implementation specialized to user-defined + * types. + * + * It's probably not worthwhile to generate such a specialized implementation + * for hash tables that aren't performance or space sensitive. + * + * Compared to dynahash, simplehash has the following benefits: + * + * - Due to the "templated" code generation has known structure sizes and no + * indirect function calls (which show up substantially in dynahash + * profiles). These features considerably increase speed for small + * entries. + * - Open addressing has better CPU cache behavior than dynahash's chained + * hashtables. + * - The generated interface is type-safe and easier to use than dynahash, + * though at the cost of more complex setup. + * - Allocates memory in a MemoryContext or another allocator with a + * malloc/free style interface (which isn't easily usable in a shared + * memory context) + * - Does not require the overhead of a separate memory context. + * + * Usage notes: + * + * To generate a hash-table and associated functions for a use case several + * macros have to be #define'ed before this file is included. Including + * the file #undef's all those, so a new hash table can be generated + * afterwards. + * The relevant parameters are: + * - SH_PREFIX - prefix for all symbol names generated. A prefix of 'foo' + * will result in hash table type 'foo_hash' and functions like + * 'foo_insert'/'foo_lookup' and so forth. + * - SH_ELEMENT_TYPE - type of the contained elements + * - SH_KEY_TYPE - type of the hashtable's key + * - SH_DECLARE - if defined function prototypes and type declarations are + * generated + * - SH_DEFINE - if defined function definitions are generated + * - SH_SCOPE - in which scope (e.g. extern, static inline) do function + * declarations reside + * - SH_RAW_ALLOCATOR - if defined, memory contexts are not used; instead, + * use this to allocate bytes. The allocator must zero the returned space. + * - SH_USE_NONDEFAULT_ALLOCATOR - if defined no element allocator functions + * are defined, so you can supply your own + * The following parameters are only relevant when SH_DEFINE is defined: + * - SH_KEY - name of the element in SH_ELEMENT_TYPE containing the hash key + * - SH_EQUAL(table, a, b) - compare two table keys + * - SH_HASH_KEY(table, key) - generate hash for the key + * - SH_STORE_HASH - if defined the hash is stored in the elements + * - SH_GET_HASH(tb, a) - return the field to store the hash in + * + * The element type is required to contain a "status" member that can store + * the range of values defined in the SH_STATUS enum. + * + * While SH_STORE_HASH (and subsequently SH_GET_HASH) are optional, because + * the hash table implementation needs to compare hashes to move elements + * (particularly when growing the hash), it's preferable, if possible, to + * store the element's hash in the element's data type. If the hash is so + * stored, the hash table will also compare hashes before calling SH_EQUAL + * when comparing two keys. + * + * For convenience the hash table create functions accept a void pointer + * that will be stored in the hash table type's member private_data. This + * allows callbacks to reference caller provided data. + * + * For examples of usage look at tidbitmap.c (file local definition) and + * execnodes.h/execGrouping.c (exposed declaration, file local + * implementation). + * + * Hash table design: + * + * The hash table design chosen is a variant of linear open-addressing. The + * reason for doing so is that linear addressing is CPU cache & pipeline + * friendly. The biggest disadvantage of simple linear addressing schemes + * are highly variable lookup times due to clustering, and deletions + * leaving a lot of tombstones around. To address these issues a variant + * of "robin hood" hashing is employed. Robin hood hashing optimizes + * chaining lengths by moving elements close to their optimal bucket + * ("rich" elements), out of the way if a to-be-inserted element is further + * away from its optimal position (i.e. it's "poor"). While that can make + * insertions slower, the average lookup performance is a lot better, and + * higher fill factors can be used in a still performant manner. To avoid + * tombstones - which normally solve the issue that a deleted node's + * presence is relevant to determine whether a lookup needs to continue + * looking or is done - buckets following a deleted element are shifted + * backwards, unless they're empty or already at their optimal position. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/lib/simplehash.h + */ + +#include "port/pg_bitutils.h" + +/* helpers */ +#define SH_MAKE_PREFIX(a) CppConcat(a,_) +#define SH_MAKE_NAME(name) SH_MAKE_NAME_(SH_MAKE_PREFIX(SH_PREFIX),name) +#define SH_MAKE_NAME_(a,b) CppConcat(a,b) + +/* name macros for: */ + +/* type declarations */ +#define SH_TYPE SH_MAKE_NAME(hash) +#define SH_STATUS SH_MAKE_NAME(status) +#define SH_STATUS_EMPTY SH_MAKE_NAME(SH_EMPTY) +#define SH_STATUS_IN_USE SH_MAKE_NAME(SH_IN_USE) +#define SH_ITERATOR SH_MAKE_NAME(iterator) + +/* function declarations */ +#define SH_CREATE SH_MAKE_NAME(create) +#define SH_DESTROY SH_MAKE_NAME(destroy) +#define SH_RESET SH_MAKE_NAME(reset) +#define SH_INSERT SH_MAKE_NAME(insert) +#define SH_INSERT_HASH SH_MAKE_NAME(insert_hash) +#define SH_DELETE_ITEM SH_MAKE_NAME(delete_item) +#define SH_DELETE SH_MAKE_NAME(delete) +#define SH_LOOKUP SH_MAKE_NAME(lookup) +#define SH_LOOKUP_HASH SH_MAKE_NAME(lookup_hash) +#define SH_GROW SH_MAKE_NAME(grow) +#define SH_START_ITERATE SH_MAKE_NAME(start_iterate) +#define SH_START_ITERATE_AT SH_MAKE_NAME(start_iterate_at) +#define SH_ITERATE SH_MAKE_NAME(iterate) +#define SH_ALLOCATE SH_MAKE_NAME(allocate) +#define SH_FREE SH_MAKE_NAME(free) +#define SH_STAT SH_MAKE_NAME(stat) + +/* internal helper functions (no externally visible prototypes) */ +#define SH_COMPUTE_SIZE SH_MAKE_NAME(compute_size) +#define SH_UPDATE_PARAMETERS SH_MAKE_NAME(update_parameters) +#define SH_NEXT SH_MAKE_NAME(next) +#define SH_PREV SH_MAKE_NAME(prev) +#define SH_DISTANCE_FROM_OPTIMAL SH_MAKE_NAME(distance) +#define SH_INITIAL_BUCKET SH_MAKE_NAME(initial_bucket) +#define SH_ENTRY_HASH SH_MAKE_NAME(entry_hash) +#define SH_INSERT_HASH_INTERNAL SH_MAKE_NAME(insert_hash_internal) +#define SH_LOOKUP_HASH_INTERNAL SH_MAKE_NAME(lookup_hash_internal) + +/* generate forward declarations necessary to use the hash table */ +#ifdef SH_DECLARE + +/* type definitions */ +typedef struct SH_TYPE +{ + /* + * Size of data / bucket array, 64 bits to handle UINT32_MAX sized hash + * tables. Note that the maximum number of elements is lower + * (SH_MAX_FILLFACTOR) + */ + uint64 size; + + /* how many elements have valid contents */ + uint32 members; + + /* mask for bucket and size calculations, based on size */ + uint32 sizemask; + + /* boundary after which to grow hashtable */ + uint32 grow_threshold; + + /* hash buckets */ + SH_ELEMENT_TYPE *data; + +#ifndef SH_RAW_ALLOCATOR + /* memory context to use for allocations */ + MemoryContext ctx; +#endif + + /* user defined data, useful for callbacks */ + void *private_data; +} SH_TYPE; + +typedef enum SH_STATUS +{ + SH_STATUS_EMPTY = 0x00, + SH_STATUS_IN_USE = 0x01 +} SH_STATUS; + +typedef struct SH_ITERATOR +{ + uint32 cur; /* current element */ + uint32 end; + bool done; /* iterator exhausted? */ +} SH_ITERATOR; + +/* externally visible function prototypes */ +#ifdef SH_RAW_ALLOCATOR +/* _hash _create(uint32 nelements, void *private_data) */ +SH_SCOPE SH_TYPE *SH_CREATE(uint32 nelements, void *private_data); +#else +/* + * _hash _create(MemoryContext ctx, uint32 nelements, + * void *private_data) + */ +SH_SCOPE SH_TYPE *SH_CREATE(MemoryContext ctx, uint32 nelements, + void *private_data); +#endif + +/* void _destroy(_hash *tb) */ +SH_SCOPE void SH_DESTROY(SH_TYPE * tb); + +/* void _reset(_hash *tb) */ +SH_SCOPE void SH_RESET(SH_TYPE * tb); + +/* void _grow(_hash *tb, uint64 newsize) */ +SH_SCOPE void SH_GROW(SH_TYPE * tb, uint64 newsize); + +/* *_insert(_hash *tb, key, bool *found) */ +SH_SCOPE SH_ELEMENT_TYPE *SH_INSERT(SH_TYPE * tb, SH_KEY_TYPE key, bool *found); + +/* + * *_insert_hash(_hash *tb, key, uint32 hash, + * bool *found) + */ +SH_SCOPE SH_ELEMENT_TYPE *SH_INSERT_HASH(SH_TYPE * tb, SH_KEY_TYPE key, + uint32 hash, bool *found); + +/* *_lookup(_hash *tb, key) */ +SH_SCOPE SH_ELEMENT_TYPE *SH_LOOKUP(SH_TYPE * tb, SH_KEY_TYPE key); + +/* *_lookup_hash(_hash *tb, key, uint32 hash) */ +SH_SCOPE SH_ELEMENT_TYPE *SH_LOOKUP_HASH(SH_TYPE * tb, SH_KEY_TYPE key, + uint32 hash); + +/* void _delete_item(_hash *tb, *entry) */ +SH_SCOPE void SH_DELETE_ITEM(SH_TYPE * tb, SH_ELEMENT_TYPE * entry); + +/* bool _delete(_hash *tb, key) */ +SH_SCOPE bool SH_DELETE(SH_TYPE * tb, SH_KEY_TYPE key); + +/* void _start_iterate(_hash *tb, _iterator *iter) */ +SH_SCOPE void SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter); + +/* + * void _start_iterate_at(_hash *tb, _iterator *iter, + * uint32 at) + */ +SH_SCOPE void SH_START_ITERATE_AT(SH_TYPE * tb, SH_ITERATOR * iter, uint32 at); + +/* *_iterate(_hash *tb, _iterator *iter) */ +SH_SCOPE SH_ELEMENT_TYPE *SH_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter); + +/* void _stat(_hash *tb */ +SH_SCOPE void SH_STAT(SH_TYPE * tb); + +#endif /* SH_DECLARE */ + + +/* generate implementation of the hash table */ +#ifdef SH_DEFINE + +#ifndef SH_RAW_ALLOCATOR +#include "utils/memutils.h" +#endif + +/* max data array size,we allow up to PG_UINT32_MAX buckets, including 0 */ +#define SH_MAX_SIZE (((uint64) PG_UINT32_MAX) + 1) + +/* normal fillfactor, unless already close to maximum */ +#ifndef SH_FILLFACTOR +#define SH_FILLFACTOR (0.9) +#endif +/* increase fillfactor if we otherwise would error out */ +#define SH_MAX_FILLFACTOR (0.98) +/* grow if actual and optimal location bigger than */ +#ifndef SH_GROW_MAX_DIB +#define SH_GROW_MAX_DIB 25 +#endif +/* grow if more than elements to move when inserting */ +#ifndef SH_GROW_MAX_MOVE +#define SH_GROW_MAX_MOVE 150 +#endif +#ifndef SH_GROW_MIN_FILLFACTOR +/* but do not grow due to SH_GROW_MAX_* if below */ +#define SH_GROW_MIN_FILLFACTOR 0.1 +#endif + +#ifdef SH_STORE_HASH +#define SH_COMPARE_KEYS(tb, ahash, akey, b) (ahash == SH_GET_HASH(tb, b) && SH_EQUAL(tb, b->SH_KEY, akey)) +#else +#define SH_COMPARE_KEYS(tb, ahash, akey, b) (SH_EQUAL(tb, b->SH_KEY, akey)) +#endif + +/* + * Wrap the following definitions in include guards, to avoid multiple + * definition errors if this header is included more than once. The rest of + * the file deliberately has no include guards, because it can be included + * with different parameters to define functions and types with non-colliding + * names. + */ +#ifndef SIMPLEHASH_H +#define SIMPLEHASH_H + +#ifdef FRONTEND +#define sh_error(...) pg_fatal(__VA_ARGS__) +#define sh_log(...) pg_log_info(__VA_ARGS__) +#else +#define sh_error(...) elog(ERROR, __VA_ARGS__) +#define sh_log(...) elog(LOG, __VA_ARGS__) +#endif + +#endif + +/* + * Compute allocation size for hashtable. Result can be passed to + * SH_UPDATE_PARAMETERS. + */ +static inline uint64 +SH_COMPUTE_SIZE(uint64 newsize) +{ + uint64 size; + + /* supporting zero sized hashes would complicate matters */ + size = Max(newsize, 2); + + /* round up size to the next power of 2, that's how bucketing works */ + size = pg_nextpower2_64(size); + Assert(size <= SH_MAX_SIZE); + + /* + * Verify that allocation of ->data is possible on this platform, without + * overflowing Size. + */ + if (unlikely((((uint64) sizeof(SH_ELEMENT_TYPE)) * size) >= SIZE_MAX / 2)) + sh_error("hash table too large"); + + return size; +} + +/* + * Update sizing parameters for hashtable. Called when creating and growing + * the hashtable. + */ +static inline void +SH_UPDATE_PARAMETERS(SH_TYPE * tb, uint64 newsize) +{ + uint64 size = SH_COMPUTE_SIZE(newsize); + + /* now set size */ + tb->size = size; + tb->sizemask = (uint32) (size - 1); + + /* + * Compute the next threshold at which we need to grow the hash table + * again. + */ + if (tb->size == SH_MAX_SIZE) + tb->grow_threshold = ((double) tb->size) * SH_MAX_FILLFACTOR; + else + tb->grow_threshold = ((double) tb->size) * SH_FILLFACTOR; +} + +/* return the optimal bucket for the hash */ +static inline uint32 +SH_INITIAL_BUCKET(SH_TYPE * tb, uint32 hash) +{ + return hash & tb->sizemask; +} + +/* return next bucket after the current, handling wraparound */ +static inline uint32 +SH_NEXT(SH_TYPE * tb, uint32 curelem, uint32 startelem) +{ + curelem = (curelem + 1) & tb->sizemask; + + Assert(curelem != startelem); + + return curelem; +} + +/* return bucket before the current, handling wraparound */ +static inline uint32 +SH_PREV(SH_TYPE * tb, uint32 curelem, uint32 startelem) +{ + curelem = (curelem - 1) & tb->sizemask; + + Assert(curelem != startelem); + + return curelem; +} + +/* return distance between bucket and its optimal position */ +static inline uint32 +SH_DISTANCE_FROM_OPTIMAL(SH_TYPE * tb, uint32 optimal, uint32 bucket) +{ + if (optimal <= bucket) + return bucket - optimal; + else + return (tb->size + bucket) - optimal; +} + +static inline uint32 +SH_ENTRY_HASH(SH_TYPE * tb, SH_ELEMENT_TYPE * entry) +{ +#ifdef SH_STORE_HASH + return SH_GET_HASH(tb, entry); +#else + return SH_HASH_KEY(tb, entry->SH_KEY); +#endif +} + +/* default memory allocator function */ +static inline void *SH_ALLOCATE(SH_TYPE * type, Size size); +static inline void SH_FREE(SH_TYPE * type, void *pointer); + +#ifndef SH_USE_NONDEFAULT_ALLOCATOR + +/* default memory allocator function */ +static inline void * +SH_ALLOCATE(SH_TYPE * type, Size size) +{ +#ifdef SH_RAW_ALLOCATOR + return SH_RAW_ALLOCATOR(size); +#else + return MemoryContextAllocExtended(type->ctx, size, + MCXT_ALLOC_HUGE | MCXT_ALLOC_ZERO); +#endif +} + +/* default memory free function */ +static inline void +SH_FREE(SH_TYPE * type, void *pointer) +{ + pfree(pointer); +} + +#endif + +/* + * Create a hash table with enough space for `nelements` distinct members. + * Memory for the hash table is allocated from the passed-in context. If + * desired, the array of elements can be allocated using a passed-in allocator; + * this could be useful in order to place the array of elements in a shared + * memory, or in a context that will outlive the rest of the hash table. + * Memory other than for the array of elements will still be allocated from + * the passed-in context. + */ +#ifdef SH_RAW_ALLOCATOR +SH_SCOPE SH_TYPE * +SH_CREATE(uint32 nelements, void *private_data) +#else +SH_SCOPE SH_TYPE * +SH_CREATE(MemoryContext ctx, uint32 nelements, void *private_data) +#endif +{ + SH_TYPE *tb; + uint64 size; + +#ifdef SH_RAW_ALLOCATOR + tb = (SH_TYPE *) SH_RAW_ALLOCATOR(sizeof(SH_TYPE)); +#else + tb = (SH_TYPE *) MemoryContextAllocZero(ctx, sizeof(SH_TYPE)); + tb->ctx = ctx; +#endif + tb->private_data = private_data; + + /* increase nelements by fillfactor, want to store nelements elements */ + size = Min((double) SH_MAX_SIZE, ((double) nelements) / SH_FILLFACTOR); + + size = SH_COMPUTE_SIZE(size); + + tb->data = (SH_ELEMENT_TYPE *) SH_ALLOCATE(tb, sizeof(SH_ELEMENT_TYPE) * size); + + SH_UPDATE_PARAMETERS(tb, size); + return tb; +} + +/* destroy a previously created hash table */ +SH_SCOPE void +SH_DESTROY(SH_TYPE * tb) +{ + SH_FREE(tb, tb->data); + pfree(tb); +} + +/* reset the contents of a previously created hash table */ +SH_SCOPE void +SH_RESET(SH_TYPE * tb) +{ + memset(tb->data, 0, sizeof(SH_ELEMENT_TYPE) * tb->size); + tb->members = 0; +} + +/* + * Grow a hash table to at least `newsize` buckets. + * + * Usually this will automatically be called by insertions/deletions, when + * necessary. But resizing to the exact input size can be advantageous + * performance-wise, when known at some point. + */ +SH_SCOPE void +SH_GROW(SH_TYPE * tb, uint64 newsize) +{ + uint64 oldsize = tb->size; + SH_ELEMENT_TYPE *olddata = tb->data; + SH_ELEMENT_TYPE *newdata; + uint32 i; + uint32 startelem = 0; + uint32 copyelem; + + Assert(oldsize == pg_nextpower2_64(oldsize)); + Assert(oldsize != SH_MAX_SIZE); + Assert(oldsize < newsize); + + newsize = SH_COMPUTE_SIZE(newsize); + + tb->data = (SH_ELEMENT_TYPE *) SH_ALLOCATE(tb, sizeof(SH_ELEMENT_TYPE) * newsize); + + /* + * Update parameters for new table after allocation succeeds to avoid + * inconsistent state on OOM. + */ + SH_UPDATE_PARAMETERS(tb, newsize); + + newdata = tb->data; + + /* + * Copy entries from the old data to newdata. We theoretically could use + * SH_INSERT here, to avoid code duplication, but that's more general than + * we need. We neither want tb->members increased, nor do we need to do + * deal with deleted elements, nor do we need to compare keys. So a + * special-cased implementation is lot faster. As resizing can be time + * consuming and frequent, that's worthwhile to optimize. + * + * To be able to simply move entries over, we have to start not at the + * first bucket (i.e olddata[0]), but find the first bucket that's either + * empty, or is occupied by an entry at its optimal position. Such a + * bucket has to exist in any table with a load factor under 1, as not all + * buckets are occupied, i.e. there always has to be an empty bucket. By + * starting at such a bucket we can move the entries to the larger table, + * without having to deal with conflicts. + */ + + /* search for the first element in the hash that's not wrapped around */ + for (i = 0; i < oldsize; i++) + { + SH_ELEMENT_TYPE *oldentry = &olddata[i]; + uint32 hash; + uint32 optimal; + + if (oldentry->status != SH_STATUS_IN_USE) + { + startelem = i; + break; + } + + hash = SH_ENTRY_HASH(tb, oldentry); + optimal = SH_INITIAL_BUCKET(tb, hash); + + if (optimal == i) + { + startelem = i; + break; + } + } + + /* and copy all elements in the old table */ + copyelem = startelem; + for (i = 0; i < oldsize; i++) + { + SH_ELEMENT_TYPE *oldentry = &olddata[copyelem]; + + if (oldentry->status == SH_STATUS_IN_USE) + { + uint32 hash; + uint32 startelem2; + uint32 curelem; + SH_ELEMENT_TYPE *newentry; + + hash = SH_ENTRY_HASH(tb, oldentry); + startelem2 = SH_INITIAL_BUCKET(tb, hash); + curelem = startelem2; + + /* find empty element to put data into */ + while (true) + { + newentry = &newdata[curelem]; + + if (newentry->status == SH_STATUS_EMPTY) + { + break; + } + + curelem = SH_NEXT(tb, curelem, startelem2); + } + + /* copy entry to new slot */ + memcpy(newentry, oldentry, sizeof(SH_ELEMENT_TYPE)); + } + + /* can't use SH_NEXT here, would use new size */ + copyelem++; + if (copyelem >= oldsize) + { + copyelem = 0; + } + } + + SH_FREE(tb, olddata); +} + +/* + * This is a separate static inline function, so it can be reliably be inlined + * into its wrapper functions even if SH_SCOPE is extern. + */ +static inline SH_ELEMENT_TYPE * +SH_INSERT_HASH_INTERNAL(SH_TYPE * tb, SH_KEY_TYPE key, uint32 hash, bool *found) +{ + uint32 startelem; + uint32 curelem; + SH_ELEMENT_TYPE *data; + uint32 insertdist; + +restart: + insertdist = 0; + + /* + * We do the grow check even if the key is actually present, to avoid + * doing the check inside the loop. This also lets us avoid having to + * re-find our position in the hashtable after resizing. + * + * Note that this also reached when resizing the table due to + * SH_GROW_MAX_DIB / SH_GROW_MAX_MOVE. + */ + if (unlikely(tb->members >= tb->grow_threshold)) + { + if (unlikely(tb->size == SH_MAX_SIZE)) + sh_error("hash table size exceeded"); + + /* + * When optimizing, it can be very useful to print these out. + */ + /* SH_STAT(tb); */ + SH_GROW(tb, tb->size * 2); + /* SH_STAT(tb); */ + } + + /* perform insert, start bucket search at optimal location */ + data = tb->data; + startelem = SH_INITIAL_BUCKET(tb, hash); + curelem = startelem; + while (true) + { + uint32 curdist; + uint32 curhash; + uint32 curoptimal; + SH_ELEMENT_TYPE *entry = &data[curelem]; + + /* any empty bucket can directly be used */ + if (entry->status == SH_STATUS_EMPTY) + { + tb->members++; + entry->SH_KEY = key; +#ifdef SH_STORE_HASH + SH_GET_HASH(tb, entry) = hash; +#endif + entry->status = SH_STATUS_IN_USE; + *found = false; + return entry; + } + + /* + * If the bucket is not empty, we either found a match (in which case + * we're done), or we have to decide whether to skip over or move the + * colliding entry. When the colliding element's distance to its + * optimal position is smaller than the to-be-inserted entry's, we + * shift the colliding entry (and its followers) forward by one. + */ + + if (SH_COMPARE_KEYS(tb, hash, key, entry)) + { + Assert(entry->status == SH_STATUS_IN_USE); + *found = true; + return entry; + } + + curhash = SH_ENTRY_HASH(tb, entry); + curoptimal = SH_INITIAL_BUCKET(tb, curhash); + curdist = SH_DISTANCE_FROM_OPTIMAL(tb, curoptimal, curelem); + + if (insertdist > curdist) + { + SH_ELEMENT_TYPE *lastentry = entry; + uint32 emptyelem = curelem; + uint32 moveelem; + int32 emptydist = 0; + + /* find next empty bucket */ + while (true) + { + SH_ELEMENT_TYPE *emptyentry; + + emptyelem = SH_NEXT(tb, emptyelem, startelem); + emptyentry = &data[emptyelem]; + + if (emptyentry->status == SH_STATUS_EMPTY) + { + lastentry = emptyentry; + break; + } + + /* + * To avoid negative consequences from overly imbalanced + * hashtables, grow the hashtable if collisions would require + * us to move a lot of entries. The most likely cause of such + * imbalance is filling a (currently) small table, from a + * currently big one, in hash-table order. Don't grow if the + * hashtable would be too empty, to prevent quick space + * explosion for some weird edge cases. + */ + if (unlikely(++emptydist > SH_GROW_MAX_MOVE) && + ((double) tb->members / tb->size) >= SH_GROW_MIN_FILLFACTOR) + { + tb->grow_threshold = 0; + goto restart; + } + } + + /* shift forward, starting at last occupied element */ + + /* + * TODO: This could be optimized to be one memcpy in many cases, + * excepting wrapping around at the end of ->data. Hasn't shown up + * in profiles so far though. + */ + moveelem = emptyelem; + while (moveelem != curelem) + { + SH_ELEMENT_TYPE *moveentry; + + moveelem = SH_PREV(tb, moveelem, startelem); + moveentry = &data[moveelem]; + + memcpy(lastentry, moveentry, sizeof(SH_ELEMENT_TYPE)); + lastentry = moveentry; + } + + /* and fill the now empty spot */ + tb->members++; + + entry->SH_KEY = key; +#ifdef SH_STORE_HASH + SH_GET_HASH(tb, entry) = hash; +#endif + entry->status = SH_STATUS_IN_USE; + *found = false; + return entry; + } + + curelem = SH_NEXT(tb, curelem, startelem); + insertdist++; + + /* + * To avoid negative consequences from overly imbalanced hashtables, + * grow the hashtable if collisions lead to large runs. The most + * likely cause of such imbalance is filling a (currently) small + * table, from a currently big one, in hash-table order. Don't grow + * if the hashtable would be too empty, to prevent quick space + * explosion for some weird edge cases. + */ + if (unlikely(insertdist > SH_GROW_MAX_DIB) && + ((double) tb->members / tb->size) >= SH_GROW_MIN_FILLFACTOR) + { + tb->grow_threshold = 0; + goto restart; + } + } +} + +/* + * Insert the key into the hash-table, set *found to true if the key already + * exists, false otherwise. Returns the hash-table entry in either case. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_INSERT(SH_TYPE * tb, SH_KEY_TYPE key, bool *found) +{ + uint32 hash = SH_HASH_KEY(tb, key); + + return SH_INSERT_HASH_INTERNAL(tb, key, hash, found); +} + +/* + * Insert the key into the hash-table using an already-calculated hash. Set + * *found to true if the key already exists, false otherwise. Returns the + * hash-table entry in either case. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_INSERT_HASH(SH_TYPE * tb, SH_KEY_TYPE key, uint32 hash, bool *found) +{ + return SH_INSERT_HASH_INTERNAL(tb, key, hash, found); +} + +/* + * This is a separate static inline function, so it can be reliably be inlined + * into its wrapper functions even if SH_SCOPE is extern. + */ +static inline SH_ELEMENT_TYPE * +SH_LOOKUP_HASH_INTERNAL(SH_TYPE * tb, SH_KEY_TYPE key, uint32 hash) +{ + const uint32 startelem = SH_INITIAL_BUCKET(tb, hash); + uint32 curelem = startelem; + + while (true) + { + SH_ELEMENT_TYPE *entry = &tb->data[curelem]; + + if (entry->status == SH_STATUS_EMPTY) + { + return NULL; + } + + Assert(entry->status == SH_STATUS_IN_USE); + + if (SH_COMPARE_KEYS(tb, hash, key, entry)) + return entry; + + /* + * TODO: we could stop search based on distance. If the current + * buckets's distance-from-optimal is smaller than what we've skipped + * already, the entry doesn't exist. Probably only do so if + * SH_STORE_HASH is defined, to avoid re-computing hashes? + */ + + curelem = SH_NEXT(tb, curelem, startelem); + } +} + +/* + * Lookup entry in hash table. Returns NULL if key not present. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_LOOKUP(SH_TYPE * tb, SH_KEY_TYPE key) +{ + uint32 hash = SH_HASH_KEY(tb, key); + + return SH_LOOKUP_HASH_INTERNAL(tb, key, hash); +} + +/* + * Lookup entry in hash table using an already-calculated hash. + * + * Returns NULL if key not present. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_LOOKUP_HASH(SH_TYPE * tb, SH_KEY_TYPE key, uint32 hash) +{ + return SH_LOOKUP_HASH_INTERNAL(tb, key, hash); +} + +/* + * Delete entry from hash table by key. Returns whether to-be-deleted key was + * present. + */ +SH_SCOPE bool +SH_DELETE(SH_TYPE * tb, SH_KEY_TYPE key) +{ + uint32 hash = SH_HASH_KEY(tb, key); + uint32 startelem = SH_INITIAL_BUCKET(tb, hash); + uint32 curelem = startelem; + + while (true) + { + SH_ELEMENT_TYPE *entry = &tb->data[curelem]; + + if (entry->status == SH_STATUS_EMPTY) + return false; + + if (entry->status == SH_STATUS_IN_USE && + SH_COMPARE_KEYS(tb, hash, key, entry)) + { + SH_ELEMENT_TYPE *lastentry = entry; + + tb->members--; + + /* + * Backward shift following elements till either an empty element + * or an element at its optimal position is encountered. + * + * While that sounds expensive, the average chain length is short, + * and deletions would otherwise require tombstones. + */ + while (true) + { + SH_ELEMENT_TYPE *curentry; + uint32 curhash; + uint32 curoptimal; + + curelem = SH_NEXT(tb, curelem, startelem); + curentry = &tb->data[curelem]; + + if (curentry->status != SH_STATUS_IN_USE) + { + lastentry->status = SH_STATUS_EMPTY; + break; + } + + curhash = SH_ENTRY_HASH(tb, curentry); + curoptimal = SH_INITIAL_BUCKET(tb, curhash); + + /* current is at optimal position, done */ + if (curoptimal == curelem) + { + lastentry->status = SH_STATUS_EMPTY; + break; + } + + /* shift */ + memcpy(lastentry, curentry, sizeof(SH_ELEMENT_TYPE)); + + lastentry = curentry; + } + + return true; + } + + /* TODO: return false; if distance too big */ + + curelem = SH_NEXT(tb, curelem, startelem); + } +} + +/* + * Delete entry from hash table by entry pointer + */ +SH_SCOPE void +SH_DELETE_ITEM(SH_TYPE * tb, SH_ELEMENT_TYPE * entry) +{ + SH_ELEMENT_TYPE *lastentry = entry; + uint32 hash = SH_ENTRY_HASH(tb, entry); + uint32 startelem = SH_INITIAL_BUCKET(tb, hash); + uint32 curelem; + + /* Calculate the index of 'entry' */ + curelem = entry - &tb->data[0]; + + tb->members--; + + /* + * Backward shift following elements till either an empty element or an + * element at its optimal position is encountered. + * + * While that sounds expensive, the average chain length is short, and + * deletions would otherwise require tombstones. + */ + while (true) + { + SH_ELEMENT_TYPE *curentry; + uint32 curhash; + uint32 curoptimal; + + curelem = SH_NEXT(tb, curelem, startelem); + curentry = &tb->data[curelem]; + + if (curentry->status != SH_STATUS_IN_USE) + { + lastentry->status = SH_STATUS_EMPTY; + break; + } + + curhash = SH_ENTRY_HASH(tb, curentry); + curoptimal = SH_INITIAL_BUCKET(tb, curhash); + + /* current is at optimal position, done */ + if (curoptimal == curelem) + { + lastentry->status = SH_STATUS_EMPTY; + break; + } + + /* shift */ + memcpy(lastentry, curentry, sizeof(SH_ELEMENT_TYPE)); + + lastentry = curentry; + } +} + +/* + * Initialize iterator. + */ +SH_SCOPE void +SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter) +{ + uint64 startelem = PG_UINT64_MAX; + + /* + * Search for the first empty element. As deletions during iterations are + * supported, we want to start/end at an element that cannot be affected + * by elements being shifted. + */ + for (uint32 i = 0; i < tb->size; i++) + { + SH_ELEMENT_TYPE *entry = &tb->data[i]; + + if (entry->status != SH_STATUS_IN_USE) + { + startelem = i; + break; + } + } + + /* we should have found an empty element */ + Assert(startelem < SH_MAX_SIZE); + + /* + * Iterate backwards, that allows the current element to be deleted, even + * if there are backward shifts + */ + iter->cur = startelem; + iter->end = iter->cur; + iter->done = false; +} + +/* + * Initialize iterator to a specific bucket. That's really only useful for + * cases where callers are partially iterating over the hashspace, and that + * iteration deletes and inserts elements based on visited entries. Doing that + * repeatedly could lead to an unbalanced keyspace when always starting at the + * same position. + */ +SH_SCOPE void +SH_START_ITERATE_AT(SH_TYPE * tb, SH_ITERATOR * iter, uint32 at) +{ + /* + * Iterate backwards, that allows the current element to be deleted, even + * if there are backward shifts. + */ + iter->cur = at & tb->sizemask; /* ensure at is within a valid range */ + iter->end = iter->cur; + iter->done = false; +} + +/* + * Iterate over all entries in the hash-table. Return the next occupied entry, + * or NULL if done. + * + * During iteration the current entry in the hash table may be deleted, + * without leading to elements being skipped or returned twice. Additionally + * the rest of the table may be modified (i.e. there can be insertions or + * deletions), but if so, there's neither a guarantee that all nodes are + * visited at least once, nor a guarantee that a node is visited at most once. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter) +{ + /* validate sanity of the given iterator */ + Assert(iter->cur < tb->size); + Assert(iter->end < tb->size); + + while (!iter->done) + { + SH_ELEMENT_TYPE *elem; + + elem = &tb->data[iter->cur]; + + /* next element in backward direction */ + iter->cur = (iter->cur - 1) & tb->sizemask; + + if ((iter->cur & tb->sizemask) == (iter->end & tb->sizemask)) + iter->done = true; + if (elem->status == SH_STATUS_IN_USE) + { + return elem; + } + } + + return NULL; +} + +/* + * Report some statistics about the state of the hashtable. For + * debugging/profiling purposes only. + */ +SH_SCOPE void +SH_STAT(SH_TYPE * tb) +{ + uint32 max_chain_length = 0; + uint32 total_chain_length = 0; + double avg_chain_length; + double fillfactor; + uint32 i; + + uint32 *collisions = (uint32 *) palloc0(tb->size * sizeof(uint32)); + uint32 total_collisions = 0; + uint32 max_collisions = 0; + double avg_collisions; + + for (i = 0; i < tb->size; i++) + { + uint32 hash; + uint32 optimal; + uint32 dist; + SH_ELEMENT_TYPE *elem; + + elem = &tb->data[i]; + + if (elem->status != SH_STATUS_IN_USE) + continue; + + hash = SH_ENTRY_HASH(tb, elem); + optimal = SH_INITIAL_BUCKET(tb, hash); + dist = SH_DISTANCE_FROM_OPTIMAL(tb, optimal, i); + + if (dist > max_chain_length) + max_chain_length = dist; + total_chain_length += dist; + + collisions[optimal]++; + } + + for (i = 0; i < tb->size; i++) + { + uint32 curcoll = collisions[i]; + + if (curcoll == 0) + continue; + + /* single contained element is not a collision */ + curcoll--; + total_collisions += curcoll; + if (curcoll > max_collisions) + max_collisions = curcoll; + } + + /* large enough to be worth freeing, even if just used for debugging */ + pfree(collisions); + + if (tb->members > 0) + { + fillfactor = tb->members / ((double) tb->size); + avg_chain_length = ((double) total_chain_length) / tb->members; + avg_collisions = ((double) total_collisions) / tb->members; + } + else + { + fillfactor = 0; + avg_chain_length = 0; + avg_collisions = 0; + } + + sh_log("size: " UINT64_FORMAT ", members: %u, filled: %f, total chain: %u, max chain: %u, avg chain: %f, total_collisions: %u, max_collisions: %u, avg_collisions: %f", + tb->size, tb->members, fillfactor, total_chain_length, max_chain_length, avg_chain_length, + total_collisions, max_collisions, avg_collisions); +} + +#endif /* SH_DEFINE */ + + +/* undefine external parameters, so next hash table can be defined */ +#undef SH_PREFIX +#undef SH_KEY_TYPE +#undef SH_KEY +#undef SH_ELEMENT_TYPE +#undef SH_HASH_KEY +#undef SH_SCOPE +#undef SH_DECLARE +#undef SH_DEFINE +#undef SH_GET_HASH +#undef SH_STORE_HASH +#undef SH_USE_NONDEFAULT_ALLOCATOR +#undef SH_EQUAL + +/* undefine locally declared macros */ +#undef SH_MAKE_PREFIX +#undef SH_MAKE_NAME +#undef SH_MAKE_NAME_ +#undef SH_FILLFACTOR +#undef SH_MAX_FILLFACTOR +#undef SH_GROW_MAX_DIB +#undef SH_GROW_MAX_MOVE +#undef SH_GROW_MIN_FILLFACTOR +#undef SH_MAX_SIZE + +/* types */ +#undef SH_TYPE +#undef SH_STATUS +#undef SH_STATUS_EMPTY +#undef SH_STATUS_IN_USE +#undef SH_ITERATOR + +/* external function names */ +#undef SH_CREATE +#undef SH_DESTROY +#undef SH_RESET +#undef SH_INSERT +#undef SH_INSERT_HASH +#undef SH_DELETE_ITEM +#undef SH_DELETE +#undef SH_LOOKUP +#undef SH_LOOKUP_HASH +#undef SH_GROW +#undef SH_START_ITERATE +#undef SH_START_ITERATE_AT +#undef SH_ITERATE +#undef SH_ALLOCATE +#undef SH_FREE +#undef SH_STAT + +/* internal function names */ +#undef SH_COMPUTE_SIZE +#undef SH_UPDATE_PARAMETERS +#undef SH_COMPARE_KEYS +#undef SH_INITIAL_BUCKET +#undef SH_NEXT +#undef SH_PREV +#undef SH_DISTANCE_FROM_OPTIMAL +#undef SH_ENTRY_HASH +#undef SH_INSERT_HASH_INTERNAL +#undef SH_LOOKUP_HASH_INTERNAL diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/sort_template.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/sort_template.h new file mode 100644 index 0000000..11e136c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/sort_template.h @@ -0,0 +1,445 @@ +/*------------------------------------------------------------------------- + * + * sort_template.h + * + * A template for a sort algorithm that supports varying degrees of + * specialization. + * + * Copyright (c) 2021-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1992-1994, Regents of the University of California + * + * Usage notes: + * + * To generate functions specialized for a type, the following parameter + * macros should be #define'd before this file is included. + * + * - ST_SORT - the name of a sort function to be generated + * - ST_ELEMENT_TYPE - type of the referenced elements + * - ST_DECLARE - if defined the functions and types are declared + * - ST_DEFINE - if defined the functions and types are defined + * - ST_SCOPE - scope (e.g. extern, static inline) for functions + * - ST_CHECK_FOR_INTERRUPTS - if defined the sort is interruptible + * + * Instead of ST_ELEMENT_TYPE, ST_ELEMENT_TYPE_VOID can be defined. Then + * the generated functions will automatically gain an "element_size" + * parameter. This allows us to generate a traditional qsort function. + * + * One of the following macros must be defined, to show how to compare + * elements. The first two options are arbitrary expressions depending + * on whether an extra pass-through argument is desired, and the third + * option should be defined if the sort function should receive a + * function pointer at runtime. + * + * - ST_COMPARE(a, b) - a simple comparison expression + * - ST_COMPARE(a, b, arg) - variant that takes an extra argument + * - ST_COMPARE_RUNTIME_POINTER - sort function takes a function pointer + * + * NB: If the comparator function is inlined, some compilers may produce + * worse code with the optimized comparison routines in common/int.h than + * with code with the following form: + * + * if (a < b) + * return -1; + * if (a > b) + * return 1; + * return 0; + * + * To say that the comparator and therefore also sort function should + * receive an extra pass-through argument, specify the type of the + * argument. + * + * - ST_COMPARE_ARG_TYPE - type of extra argument + * + * The prototype of the generated sort function is: + * + * void ST_SORT(ST_ELEMENT_TYPE *data, size_t n, + * [size_t element_size,] + * [ST_SORT_compare_function compare,] + * [ST_COMPARE_ARG_TYPE *arg]); + * + * ST_SORT_compare_function is a function pointer of the following type: + * + * int (*)(const ST_ELEMENT_TYPE *a, const ST_ELEMENT_TYPE *b, + * [ST_COMPARE_ARG_TYPE *arg]) + * + * HISTORY + * + * Modifications from vanilla NetBSD source: + * - Add do ... while() macro fix + * - Remove __inline, _DIAGASSERTs, __P + * - Remove ill-considered "swap_cnt" switch to insertion sort, in favor + * of a simple check for presorted input. + * - Take care to recurse on the smaller partition, to bound stack usage + * - Convert into a header that can generate specialized functions + * + * IDENTIFICATION + * src/include/lib/sort_template.h + * + *------------------------------------------------------------------------- + */ + +/* $NetBSD: qsort.c,v 1.13 2003/08/07 16:43:42 agc Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Qsort routine based on J. L. Bentley and M. D. McIlroy, + * "Engineering a sort function", + * Software--Practice and Experience 23 (1993) 1249-1265. + * + * We have modified their original by adding a check for already-sorted + * input, which seems to be a win per discussions on pgsql-hackers around + * 2006-03-21. + * + * Also, we recurse on the smaller partition and iterate on the larger one, + * which ensures we cannot recurse more than log(N) levels (since the + * partition recursed to is surely no more than half of the input). Bentley + * and McIlroy explicitly rejected doing this on the grounds that it's "not + * worth the effort", but we have seen crashes in the field due to stack + * overrun, so that judgment seems wrong. + */ + +#define ST_MAKE_PREFIX(a) CppConcat(a,_) +#define ST_MAKE_NAME(a,b) ST_MAKE_NAME_(ST_MAKE_PREFIX(a),b) +#define ST_MAKE_NAME_(a,b) CppConcat(a,b) + +/* + * If the element type is void, we'll also need an element_size argument + * because we don't know the size. + */ +#ifdef ST_ELEMENT_TYPE_VOID +#define ST_ELEMENT_TYPE void +#define ST_SORT_PROTO_ELEMENT_SIZE , size_t element_size +#define ST_SORT_INVOKE_ELEMENT_SIZE , element_size +#else +#define ST_SORT_PROTO_ELEMENT_SIZE +#define ST_SORT_INVOKE_ELEMENT_SIZE +#endif + +/* + * If the user wants to be able to pass in compare functions at runtime, + * we'll need to make that an argument of the sort and med3 functions. + */ +#ifdef ST_COMPARE_RUNTIME_POINTER +/* + * The type of the comparator function pointer that ST_SORT will take, unless + * you've already declared a type name manually and want to use that instead of + * having a new one defined. + */ +#ifndef ST_COMPARATOR_TYPE_NAME +#define ST_COMPARATOR_TYPE_NAME ST_MAKE_NAME(ST_SORT, compare_function) +#endif +#define ST_COMPARE compare +#ifndef ST_COMPARE_ARG_TYPE +#define ST_SORT_PROTO_COMPARE , ST_COMPARATOR_TYPE_NAME compare +#define ST_SORT_INVOKE_COMPARE , compare +#else +#define ST_SORT_PROTO_COMPARE , ST_COMPARATOR_TYPE_NAME compare +#define ST_SORT_INVOKE_COMPARE , compare +#endif +#else +#define ST_SORT_PROTO_COMPARE +#define ST_SORT_INVOKE_COMPARE +#endif + +/* + * If the user wants to use a compare function or expression that takes an + * extra argument, we'll need to make that an argument of the sort, compare and + * med3 functions. + */ +#ifdef ST_COMPARE_ARG_TYPE +#define ST_SORT_PROTO_ARG , ST_COMPARE_ARG_TYPE *arg +#define ST_SORT_INVOKE_ARG , arg +#else +#define ST_SORT_PROTO_ARG +#define ST_SORT_INVOKE_ARG +#endif + +#ifdef ST_DECLARE + +#ifdef ST_COMPARE_RUNTIME_POINTER +typedef int (*ST_COMPARATOR_TYPE_NAME) (const ST_ELEMENT_TYPE *, + const ST_ELEMENT_TYPE * ST_SORT_PROTO_ARG); +#endif + +/* Declare the sort function. Note optional arguments at end. */ +ST_SCOPE void ST_SORT(ST_ELEMENT_TYPE * first, size_t n + ST_SORT_PROTO_ELEMENT_SIZE + ST_SORT_PROTO_COMPARE + ST_SORT_PROTO_ARG); + +#endif + +#ifdef ST_DEFINE + +/* sort private helper functions */ +#define ST_MED3 ST_MAKE_NAME(ST_SORT, med3) +#define ST_SWAP ST_MAKE_NAME(ST_SORT, swap) +#define ST_SWAPN ST_MAKE_NAME(ST_SORT, swapn) + +/* Users expecting to run very large sorts may need them to be interruptible. */ +#ifdef ST_CHECK_FOR_INTERRUPTS +#define DO_CHECK_FOR_INTERRUPTS() CHECK_FOR_INTERRUPTS() +#else +#define DO_CHECK_FOR_INTERRUPTS() +#endif + +/* + * Create wrapper macros that know how to invoke compare, med3 and sort with + * the right arguments. + */ +#ifdef ST_COMPARE_RUNTIME_POINTER +#define DO_COMPARE(a_, b_) ST_COMPARE((a_), (b_) ST_SORT_INVOKE_ARG) +#elif defined(ST_COMPARE_ARG_TYPE) +#define DO_COMPARE(a_, b_) ST_COMPARE((a_), (b_), arg) +#else +#define DO_COMPARE(a_, b_) ST_COMPARE((a_), (b_)) +#endif +#define DO_MED3(a_, b_, c_) \ + ST_MED3((a_), (b_), (c_) \ + ST_SORT_INVOKE_COMPARE \ + ST_SORT_INVOKE_ARG) +#define DO_SORT(a_, n_) \ + ST_SORT((a_), (n_) \ + ST_SORT_INVOKE_ELEMENT_SIZE \ + ST_SORT_INVOKE_COMPARE \ + ST_SORT_INVOKE_ARG) + +/* + * If we're working with void pointers, we'll use pointer arithmetic based on + * uint8, and use the runtime element_size to step through the array and swap + * elements. Otherwise we'll work with ST_ELEMENT_TYPE. + */ +#ifndef ST_ELEMENT_TYPE_VOID +#define ST_POINTER_TYPE ST_ELEMENT_TYPE +#define ST_POINTER_STEP 1 +#define DO_SWAPN(a_, b_, n_) ST_SWAPN((a_), (b_), (n_)) +#define DO_SWAP(a_, b_) ST_SWAP((a_), (b_)) +#else +#define ST_POINTER_TYPE uint8 +#define ST_POINTER_STEP element_size +#define DO_SWAPN(a_, b_, n_) ST_SWAPN((a_), (b_), (n_)) +#define DO_SWAP(a_, b_) DO_SWAPN((a_), (b_), element_size) +#endif + +/* + * Find the median of three values. Currently, performance seems to be best + * if the comparator is inlined here, but the med3 function is not inlined + * in the qsort function. + * + * Refer to the comment at the top of this file for known caveats to consider + * when writing inlined comparator functions. + */ +static pg_noinline ST_ELEMENT_TYPE * +ST_MED3(ST_ELEMENT_TYPE * a, + ST_ELEMENT_TYPE * b, + ST_ELEMENT_TYPE * c + ST_SORT_PROTO_COMPARE + ST_SORT_PROTO_ARG) +{ + return DO_COMPARE(a, b) < 0 ? + (DO_COMPARE(b, c) < 0 ? b : (DO_COMPARE(a, c) < 0 ? c : a)) + : (DO_COMPARE(b, c) > 0 ? b : (DO_COMPARE(a, c) < 0 ? a : c)); +} + +static inline void +ST_SWAP(ST_POINTER_TYPE * a, ST_POINTER_TYPE * b) +{ + ST_POINTER_TYPE tmp = *a; + + *a = *b; + *b = tmp; +} + +static inline void +ST_SWAPN(ST_POINTER_TYPE * a, ST_POINTER_TYPE * b, size_t n) +{ + for (size_t i = 0; i < n; ++i) + ST_SWAP(&a[i], &b[i]); +} + +/* + * Sort an array. + */ +ST_SCOPE void +ST_SORT(ST_ELEMENT_TYPE * data, size_t n + ST_SORT_PROTO_ELEMENT_SIZE + ST_SORT_PROTO_COMPARE + ST_SORT_PROTO_ARG) +{ + ST_POINTER_TYPE *a = (ST_POINTER_TYPE *) data, + *pa, + *pb, + *pc, + *pd, + *pl, + *pm, + *pn; + size_t d1, + d2; + int r, + presorted; + +loop: + DO_CHECK_FOR_INTERRUPTS(); + if (n < 7) + { + for (pm = a + ST_POINTER_STEP; pm < a + n * ST_POINTER_STEP; + pm += ST_POINTER_STEP) + for (pl = pm; pl > a && DO_COMPARE(pl - ST_POINTER_STEP, pl) > 0; + pl -= ST_POINTER_STEP) + DO_SWAP(pl, pl - ST_POINTER_STEP); + return; + } + presorted = 1; + for (pm = a + ST_POINTER_STEP; pm < a + n * ST_POINTER_STEP; + pm += ST_POINTER_STEP) + { + DO_CHECK_FOR_INTERRUPTS(); + if (DO_COMPARE(pm - ST_POINTER_STEP, pm) > 0) + { + presorted = 0; + break; + } + } + if (presorted) + return; + pm = a + (n / 2) * ST_POINTER_STEP; + if (n > 7) + { + pl = a; + pn = a + (n - 1) * ST_POINTER_STEP; + if (n > 40) + { + size_t d = (n / 8) * ST_POINTER_STEP; + + pl = DO_MED3(pl, pl + d, pl + 2 * d); + pm = DO_MED3(pm - d, pm, pm + d); + pn = DO_MED3(pn - 2 * d, pn - d, pn); + } + pm = DO_MED3(pl, pm, pn); + } + DO_SWAP(a, pm); + pa = pb = a + ST_POINTER_STEP; + pc = pd = a + (n - 1) * ST_POINTER_STEP; + for (;;) + { + while (pb <= pc && (r = DO_COMPARE(pb, a)) <= 0) + { + if (r == 0) + { + DO_SWAP(pa, pb); + pa += ST_POINTER_STEP; + } + pb += ST_POINTER_STEP; + DO_CHECK_FOR_INTERRUPTS(); + } + while (pb <= pc && (r = DO_COMPARE(pc, a)) >= 0) + { + if (r == 0) + { + DO_SWAP(pc, pd); + pd -= ST_POINTER_STEP; + } + pc -= ST_POINTER_STEP; + DO_CHECK_FOR_INTERRUPTS(); + } + if (pb > pc) + break; + DO_SWAP(pb, pc); + pb += ST_POINTER_STEP; + pc -= ST_POINTER_STEP; + } + pn = a + n * ST_POINTER_STEP; + d1 = Min(pa - a, pb - pa); + DO_SWAPN(a, pb - d1, d1); + d1 = Min(pd - pc, pn - pd - ST_POINTER_STEP); + DO_SWAPN(pb, pn - d1, d1); + d1 = pb - pa; + d2 = pd - pc; + if (d1 <= d2) + { + /* Recurse on left partition, then iterate on right partition */ + if (d1 > ST_POINTER_STEP) + DO_SORT(a, d1 / ST_POINTER_STEP); + if (d2 > ST_POINTER_STEP) + { + /* Iterate rather than recurse to save stack space */ + /* DO_SORT(pn - d2, d2 / ST_POINTER_STEP) */ + a = pn - d2; + n = d2 / ST_POINTER_STEP; + goto loop; + } + } + else + { + /* Recurse on right partition, then iterate on left partition */ + if (d2 > ST_POINTER_STEP) + DO_SORT(pn - d2, d2 / ST_POINTER_STEP); + if (d1 > ST_POINTER_STEP) + { + /* Iterate rather than recurse to save stack space */ + /* DO_SORT(a, d1 / ST_POINTER_STEP) */ + n = d1 / ST_POINTER_STEP; + goto loop; + } + } +} +#endif + +#undef DO_CHECK_FOR_INTERRUPTS +#undef DO_COMPARE +#undef DO_MED3 +#undef DO_SORT +#undef DO_SWAP +#undef DO_SWAPN +#undef ST_CHECK_FOR_INTERRUPTS +#undef ST_COMPARATOR_TYPE_NAME +#undef ST_COMPARE +#undef ST_COMPARE_ARG_TYPE +#undef ST_COMPARE_RUNTIME_POINTER +#undef ST_ELEMENT_TYPE +#undef ST_ELEMENT_TYPE_VOID +#undef ST_MAKE_NAME +#undef ST_MAKE_NAME_ +#undef ST_MAKE_PREFIX +#undef ST_MED3 +#undef ST_POINTER_STEP +#undef ST_POINTER_TYPE +#undef ST_SCOPE +#undef ST_SORT +#undef ST_SORT_INVOKE_ARG +#undef ST_SORT_INVOKE_COMPARE +#undef ST_SORT_INVOKE_ELEMENT_SIZE +#undef ST_SORT_PROTO_ARG +#undef ST_SORT_PROTO_COMPARE +#undef ST_SORT_PROTO_ELEMENT_SIZE +#undef ST_SWAP +#undef ST_SWAPN diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/stringinfo.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/stringinfo.h new file mode 100644 index 0000000..c96df98 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/lib/stringinfo.h @@ -0,0 +1,270 @@ +/*------------------------------------------------------------------------- + * + * stringinfo.h + * Declarations/definitions for "StringInfo" functions. + * + * StringInfo provides an extensible string data type (currently limited to a + * length of 1GB). It can be used to buffer either ordinary C strings + * (null-terminated text) or arbitrary binary data. All storage is allocated + * with palloc() (falling back to malloc in frontend code). + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/lib/stringinfo.h + * + *------------------------------------------------------------------------- + */ +#ifndef STRINGINFO_H +#define STRINGINFO_H + +/*------------------------- + * StringInfoData holds information about an extensible string. + * data is the current buffer for the string. + * len is the current string length. Except in the case of read-only + * strings described below, there is guaranteed to be a + * terminating '\0' at data[len]. + * maxlen is the allocated size in bytes of 'data', i.e. the maximum + * string size (including the terminating '\0' char) that we can + * currently store in 'data' without having to reallocate + * more space. We must always have maxlen > len, except + * in the read-only case described below. + * cursor is initialized to zero by makeStringInfo, initStringInfo, + * initReadOnlyStringInfo and initStringInfoFromString but is not + * otherwise touched by the stringinfo.c routines. Some routines + * use it to scan through a StringInfo. + * + * As a special case, a StringInfoData can be initialized with a read-only + * string buffer. In this case "data" does not necessarily point at a + * palloc'd chunk, and management of the buffer storage is the caller's + * responsibility. maxlen is set to zero to indicate that this is the case. + * Read-only StringInfoDatas cannot be appended to or reset. + * Also, it is caller's option whether a read-only string buffer has a + * terminating '\0' or not. This depends on the intended usage. + *------------------------- + */ +typedef struct StringInfoData +{ + char *data; + int len; + int maxlen; + int cursor; +} StringInfoData; + +typedef StringInfoData *StringInfo; + + +/*------------------------ + * There are six ways to create a StringInfo object initially: + * + * StringInfo stringptr = makeStringInfo(); + * Both the StringInfoData and the data buffer are palloc'd. + * + * StringInfo stringptr = makeStringInfoExt(initsize); + * Same as makeStringInfo except the data buffer is allocated + * with size 'initsize'. + * + * StringInfoData string; + * initStringInfo(&string); + * The data buffer is palloc'd but the StringInfoData is just local. + * This is the easiest approach for a StringInfo object that will + * only live as long as the current routine. + * + * StringInfoData string; + * initStringInfoExt(&string, initsize); + * Same as initStringInfo except the data buffer is allocated + * with size 'initsize'. + * + * StringInfoData string; + * initReadOnlyStringInfo(&string, existingbuf, len); + * The StringInfoData's data field is set to point directly to the + * existing buffer and the StringInfoData's len is set to the given len. + * The given buffer can point to memory that's not managed by palloc or + * is pointing partway through a palloc'd chunk. The maxlen field is set + * to 0. A read-only StringInfo cannot be appended to using any of the + * appendStringInfo functions or reset with resetStringInfo(). The given + * buffer can optionally omit the trailing NUL. + * + * StringInfoData string; + * initStringInfoFromString(&string, palloced_buf, len); + * The StringInfoData's data field is set to point directly to the given + * buffer and the StringInfoData's len is set to the given len. This + * method of initialization is useful when the buffer already exists. + * StringInfos initialized this way can be appended to using the + * appendStringInfo functions and reset with resetStringInfo(). The + * given buffer must be NUL-terminated. The palloc'd buffer is assumed + * to be len + 1 in size. + * + * To destroy a StringInfo, pfree() the data buffer, and then pfree() the + * StringInfoData if it was palloc'd. For StringInfos created with + * makeStringInfo(), destroyStringInfo() is provided for this purpose. + * However, if the StringInfo was initialized using initReadOnlyStringInfo() + * then the caller will need to consider if it is safe to pfree the data + * buffer. + * + * NOTE: some routines build up a string using StringInfo, and then + * release the StringInfoData but return the data string itself to their + * caller. At that point the data string looks like a plain palloc'd + * string. + *------------------------- + */ + +#define STRINGINFO_DEFAULT_SIZE 1024 /* default initial allocation size */ + +/*------------------------ + * makeStringInfo + * Create an empty 'StringInfoData' & return a pointer to it. + */ +extern StringInfo makeStringInfo(void); + +/*------------------------ + * makeStringInfoExt + * Create an empty 'StringInfoData' & return a pointer to it. + * The data buffer is allocated with size 'initsize'. + * The valid range for 'initsize' is 1 to MaxAllocSize. + */ +extern StringInfo makeStringInfoExt(int initsize); + +/*------------------------ + * initStringInfo + * Initialize a StringInfoData struct (with previously undefined contents) + * to describe an empty string. + */ +extern void initStringInfo(StringInfo str); + +/*------------------------ + * initStringInfoExt + * Initialize a StringInfoData struct (with previously undefined contents) to + * describe an empty string. The data buffer is allocated with size + * 'initsize'. The valid range for 'initsize' is 1 to MaxAllocSize. + */ +extern void initStringInfoExt(StringInfo str, int initsize); + +/*------------------------ + * initReadOnlyStringInfo + * Initialize a StringInfoData struct from an existing string without copying + * the string. The caller is responsible for ensuring the given string + * remains valid as long as the StringInfoData does. Calls to this are used + * in performance critical locations where allocating a new buffer and copying + * would be too costly. Read-only StringInfoData's may not be appended to + * using any of the appendStringInfo functions or reset with + * resetStringInfo(). + * + * 'data' does not need to point directly to a palloc'd chunk of memory and may + * omit the NUL termination character at data[len]. + */ +static inline void +initReadOnlyStringInfo(StringInfo str, char *data, int len) +{ + str->data = data; + str->len = len; + str->maxlen = 0; /* read-only */ + str->cursor = 0; +} + +/*------------------------ + * initStringInfoFromString + * Initialize a StringInfoData struct from an existing string without copying + * the string. 'data' must be a valid palloc'd chunk of memory that can have + * repalloc() called should more space be required during a call to any of the + * appendStringInfo functions. + * + * 'data' must be NUL terminated at 'len' bytes. + */ +static inline void +initStringInfoFromString(StringInfo str, char *data, int len) +{ + Assert(data[len] == '\0'); + + str->data = data; + str->len = len; + str->maxlen = len + 1; + str->cursor = 0; +} + +/*------------------------ + * resetStringInfo + * Clears the current content of the StringInfo, if any. The + * StringInfo remains valid. + */ +extern void resetStringInfo(StringInfo str); + +/*------------------------ + * appendStringInfo + * Format text data under the control of fmt (an sprintf-style format string) + * and append it to whatever is already in str. More space is allocated + * to str if necessary. This is sort of like a combination of sprintf and + * strcat. + */ +extern void appendStringInfo(StringInfo str, const char *fmt,...) pg_attribute_printf(2, 3); + +/*------------------------ + * appendStringInfoVA + * Attempt to format text data under the control of fmt (an sprintf-style + * format string) and append it to whatever is already in str. If successful + * return zero; if not (because there's not enough space), return an estimate + * of the space needed, without modifying str. Typically the caller should + * pass the return value to enlargeStringInfo() before trying again; see + * appendStringInfo for standard usage pattern. + */ +extern int appendStringInfoVA(StringInfo str, const char *fmt, va_list args) pg_attribute_printf(2, 0); + +/*------------------------ + * appendStringInfoString + * Append a null-terminated string to str. + * Like appendStringInfo(str, "%s", s) but faster. + */ +extern void appendStringInfoString(StringInfo str, const char *s); + +/*------------------------ + * appendStringInfoChar + * Append a single byte to str. + * Like appendStringInfo(str, "%c", ch) but much faster. + */ +extern void appendStringInfoChar(StringInfo str, char ch); + +/*------------------------ + * appendStringInfoCharMacro + * As above, but a macro for even more speed where it matters. + * Caution: str argument will be evaluated multiple times. + */ +#define appendStringInfoCharMacro(str,ch) \ + (((str)->len + 1 >= (str)->maxlen) ? \ + appendStringInfoChar(str, ch) : \ + (void)((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0')) + +/*------------------------ + * appendStringInfoSpaces + * Append a given number of spaces to str. + */ +extern void appendStringInfoSpaces(StringInfo str, int count); + +/*------------------------ + * appendBinaryStringInfo + * Append arbitrary binary data to a StringInfo, allocating more space + * if necessary. + */ +extern void appendBinaryStringInfo(StringInfo str, + const void *data, int datalen); + +/*------------------------ + * appendBinaryStringInfoNT + * Append arbitrary binary data to a StringInfo, allocating more space + * if necessary. Does not ensure a trailing null-byte exists. + */ +extern void appendBinaryStringInfoNT(StringInfo str, + const void *data, int datalen); + +/*------------------------ + * enlargeStringInfo + * Make sure a StringInfo's buffer can hold at least 'needed' more bytes. + */ +extern void enlargeStringInfo(StringInfo str, int needed); + +/*------------------------ + * destroyStringInfo + * Frees a StringInfo and its buffer (opposite of makeStringInfo()). + */ +extern void destroyStringInfo(StringInfo str); + +#endif /* STRINGINFO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/auth.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/auth.h new file mode 100644 index 0000000..cc9643c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/auth.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * auth.h + * Definitions for network authentication routines + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/auth.h + * + *------------------------------------------------------------------------- + */ +#ifndef AUTH_H +#define AUTH_H + +#include "libpq/libpq-be.h" + +/* + * Maximum accepted size of GSS and SSPI authentication tokens. + * We also use this as a limit on ordinary password packet lengths. + * + * Kerberos tickets are usually quite small, but the TGTs issued by Windows + * domain controllers include an authorization field known as the Privilege + * Attribute Certificate (PAC), which contains the user's Windows permissions + * (group memberships etc.). The PAC is copied into all tickets obtained on + * the basis of this TGT (even those issued by Unix realms which the Windows + * realm trusts), and can be several kB in size. The maximum token size + * accepted by Windows systems is determined by the MaxAuthToken Windows + * registry setting. Microsoft recommends that it is not set higher than + * 65535 bytes, so that seems like a reasonable limit for us as well. + */ +#define PG_MAX_AUTH_TOKEN_LENGTH 65535 + +extern PGDLLIMPORT char *pg_krb_server_keyfile; +extern PGDLLIMPORT bool pg_krb_caseins_users; +extern PGDLLIMPORT bool pg_gss_accept_delegation; + +extern void ClientAuthentication(Port *port); +extern void sendAuthRequest(Port *port, AuthRequest areq, const void *extradata, + int extralen); +extern void set_authn_id(Port *port, const char *id); + +/* Hook for plugins to get control in ClientAuthentication() */ +typedef void (*ClientAuthentication_hook_type) (Port *, int); +extern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook; + +/* hook type for password manglers */ +typedef char *(*auth_password_hook_typ) (char *input); + +/* Default LDAP password mutator hook, can be overridden by a shared library */ +extern PGDLLIMPORT auth_password_hook_typ ldap_password_hook; + +#endif /* AUTH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/be-fsstubs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/be-fsstubs.h new file mode 100644 index 0000000..1b00643 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/be-fsstubs.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * be-fsstubs.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/be-fsstubs.h + * + *------------------------------------------------------------------------- + */ +#ifndef BE_FSSTUBS_H +#define BE_FSSTUBS_H + +/* + * These are not fmgr-callable, but are available to C code. + * Probably these should have had the underscore-free names, + * but too late now... + */ +extern int lo_read(int fd, char *buf, int len); +extern int lo_write(int fd, const char *buf, int len); + +/* + * Cleanup LOs at xact commit/abort + */ +extern void AtEOXact_LargeObject(bool isCommit); +extern void AtEOSubXact_LargeObject(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); + +#endif /* BE_FSSTUBS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/be-gssapi-common.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/be-gssapi-common.h new file mode 100644 index 0000000..bfe8d76 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/be-gssapi-common.h @@ -0,0 +1,27 @@ +/*------------------------------------------------------------------------- + * + * be-gssapi-common.h + * Definitions for GSSAPI authentication and encryption handling + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/be-gssapi-common.h + * + *------------------------------------------------------------------------- + */ + +#ifndef BE_GSSAPI_COMMON_H +#define BE_GSSAPI_COMMON_H + +#ifdef ENABLE_GSS + +#include "libpq/pg-gssapi.h" + +extern void pg_GSS_error(const char *errmsg, + OM_uint32 maj_stat, OM_uint32 min_stat); + +extern void pg_store_delegated_credential(gss_cred_id_t cred); +#endif /* ENABLE_GSS */ + +#endif /* BE_GSSAPI_COMMON_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/crypt.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/crypt.h new file mode 100644 index 0000000..a1b4b36 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/crypt.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * crypt.h + * Interface to libpq/crypt.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/crypt.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CRYPT_H +#define PG_CRYPT_H + +#include "datatype/timestamp.h" + +/* + * Valid password hashes may be very long, but we don't want to store anything + * that might need out-of-line storage, since de-TOASTing won't work during + * authentication because we haven't selected a database yet and cannot read + * pg_class. 512 bytes should be more than enough for all practical use, and + * our own password encryption routines should never produce hashes longer than + * this. + */ +#define MAX_ENCRYPTED_PASSWORD_LEN (512) + +/* Enables deprecation warnings for MD5 passwords. */ +extern PGDLLIMPORT bool md5_password_warnings; + +/* + * Types of password hashes or secrets. + * + * Plaintext passwords can be passed in by the user, in a CREATE/ALTER USER + * command. They will be encrypted to MD5 or SCRAM-SHA-256 format, before + * storing on-disk, so only MD5 and SCRAM-SHA-256 passwords should appear + * in pg_authid.rolpassword. They are also the allowed values for the + * password_encryption GUC. + */ +typedef enum PasswordType +{ + PASSWORD_TYPE_PLAINTEXT = 0, + PASSWORD_TYPE_MD5, + PASSWORD_TYPE_SCRAM_SHA_256, +} PasswordType; + +extern PasswordType get_password_type(const char *shadow_pass); +extern char *encrypt_password(PasswordType target_type, const char *role, + const char *password); + +extern char *get_role_password(const char *role, const char **logdetail); + +extern int md5_crypt_verify(const char *role, const char *shadow_pass, + const char *client_pass, const uint8 *md5_salt, + int md5_salt_len, const char **logdetail); +extern int plain_crypt_verify(const char *role, const char *shadow_pass, + const char *client_pass, + const char **logdetail); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/hba.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/hba.h new file mode 100644 index 0000000..3657f18 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/hba.h @@ -0,0 +1,191 @@ +/*------------------------------------------------------------------------- + * + * hba.h + * Interface to hba.c + * + * + * src/include/libpq/hba.h + * + *------------------------------------------------------------------------- + */ +#ifndef HBA_H +#define HBA_H + +#include "libpq/pqcomm.h" /* needed for NetBSD */ +#include "nodes/pg_list.h" +#include "regex/regex.h" + + +/* + * The following enum represents the authentication methods that + * are supported by PostgreSQL. + * + * Note: keep this in sync with the UserAuthName array in hba.c. + */ +typedef enum UserAuth +{ + uaReject, + uaImplicitReject, /* Not a user-visible option */ + uaTrust, + uaIdent, + uaPassword, + uaMD5, + uaSCRAM, + uaGSS, + uaSSPI, + uaPAM, + uaBSD, + uaLDAP, + uaCert, + uaRADIUS, + uaPeer, + uaOAuth, +#define USER_AUTH_LAST uaOAuth /* Must be last value of this enum */ +} UserAuth; + +/* + * Data structures representing pg_hba.conf entries + */ + +typedef enum IPCompareMethod +{ + ipCmpMask, + ipCmpSameHost, + ipCmpSameNet, + ipCmpAll, +} IPCompareMethod; + +typedef enum ConnType +{ + ctLocal, + ctHost, + ctHostSSL, + ctHostNoSSL, + ctHostGSS, + ctHostNoGSS, +} ConnType; + +typedef enum ClientCertMode +{ + clientCertOff, + clientCertCA, + clientCertFull, +} ClientCertMode; + +typedef enum ClientCertName +{ + clientCertCN, + clientCertDN, +} ClientCertName; + +/* + * A single string token lexed from an authentication configuration file + * (pg_ident.conf or pg_hba.conf), together with whether the token has + * been quoted. If "string" begins with a slash, it may optionally + * contain a regular expression (currently used for pg_ident.conf when + * building IdentLines and for pg_hba.conf when building HbaLines). + */ +typedef struct AuthToken +{ + char *string; + bool quoted; + regex_t *regex; +} AuthToken; + +typedef struct HbaLine +{ + char *sourcefile; + int linenumber; + char *rawline; + ConnType conntype; + List *databases; + List *roles; + struct sockaddr_storage addr; + int addrlen; /* zero if we don't have a valid addr */ + struct sockaddr_storage mask; + int masklen; /* zero if we don't have a valid mask */ + IPCompareMethod ip_cmp_method; + char *hostname; + UserAuth auth_method; + char *usermap; + char *pamservice; + bool pam_use_hostname; + bool ldaptls; + char *ldapscheme; + char *ldapserver; + int ldapport; + char *ldapbinddn; + char *ldapbindpasswd; + char *ldapsearchattribute; + char *ldapsearchfilter; + char *ldapbasedn; + int ldapscope; + char *ldapprefix; + char *ldapsuffix; + ClientCertMode clientcert; + ClientCertName clientcertname; + char *krb_realm; + bool include_realm; + bool compat_realm; + bool upn_username; + List *radiusservers; + char *radiusservers_s; + List *radiussecrets; + char *radiussecrets_s; + List *radiusidentifiers; + char *radiusidentifiers_s; + List *radiusports; + char *radiusports_s; + char *oauth_issuer; + char *oauth_scope; + char *oauth_validator; + bool oauth_skip_usermap; +} HbaLine; + +typedef struct IdentLine +{ + int linenumber; + + char *usermap; + AuthToken *system_user; + AuthToken *pg_user; +} IdentLine; + +/* + * TokenizedAuthLine represents one line lexed from an authentication + * configuration file. Each item in the "fields" list is a sub-list of + * AuthTokens. We don't emit a TokenizedAuthLine for empty or all-comment + * lines, so "fields" is never NIL (nor are any of its sub-lists). + * + * Exception: if an error occurs during tokenization, we might have + * fields == NIL, in which case err_msg != NULL. + */ +typedef struct TokenizedAuthLine +{ + List *fields; /* List of lists of AuthTokens */ + char *file_name; /* File name of origin */ + int line_num; /* Line number */ + char *raw_line; /* Raw line text */ + char *err_msg; /* Error message if any */ +} TokenizedAuthLine; + +/* kluge to avoid including libpq/libpq-be.h here */ +typedef struct Port hbaPort; + +extern bool load_hba(void); +extern bool load_ident(void); +extern const char *hba_authname(UserAuth auth_method); +extern void hba_getauthmethod(hbaPort *port); +extern int check_usermap(const char *usermap_name, + const char *pg_user, const char *system_user, + bool case_insensitive); +extern HbaLine *parse_hba_line(TokenizedAuthLine *tok_line, int elevel); +extern IdentLine *parse_ident_line(TokenizedAuthLine *tok_line, int elevel); +extern bool pg_isblank(const char c); +extern FILE *open_auth_file(const char *filename, int elevel, int depth, + char **err_msg); +extern void free_auth_file(FILE *file, int depth); +extern void tokenize_auth_file(const char *filename, FILE *file, + List **tok_lines, int elevel, int depth); + +#endif /* HBA_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/ifaddr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/ifaddr.h new file mode 100644 index 0000000..846999d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/ifaddr.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * ifaddr.h + * IP netmask calculations, and enumerating network interfaces. + * + * Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/libpq/ifaddr.h + * + *------------------------------------------------------------------------- + */ +#ifndef IFADDR_H +#define IFADDR_H + +#include "libpq/pqcomm.h" + +typedef void (*PgIfAddrCallback) (struct sockaddr *addr, + struct sockaddr *netmask, + void *cb_data); + +extern int pg_range_sockaddr(const struct sockaddr_storage *addr, + const struct sockaddr_storage *netaddr, + const struct sockaddr_storage *netmask); + +extern int pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, + char *numbits, int family); + +extern int pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data); + +#endif /* IFADDR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq-be-fe-helpers.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq-be-fe-helpers.h new file mode 100644 index 0000000..16205b8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq-be-fe-helpers.h @@ -0,0 +1,457 @@ +/*------------------------------------------------------------------------- + * + * libpq-be-fe-helpers.h + * Helper functions for using libpq in extensions + * + * Code built directly into the backend is not allowed to link to libpq + * directly. Extension code is allowed to use libpq however. However, libpq + * used in extensions has to be careful not to block inside libpq, otherwise + * interrupts will not be processed, leading to issues like unresolvable + * deadlocks. Backend code also needs to take care to acquire/release an + * external fd for the connection, otherwise fd.c's accounting of fd's is + * broken. + * + * This file provides helper functions to make it easier to comply with these + * rules. It is a header only library as it needs to be linked into each + * extension using libpq, and it seems too small to be worth adding a + * dedicated static library for. + * + * TODO: For historical reasons the connections established here are not put + * into non-blocking mode. That can lead to blocking even when only the async + * libpq functions are used. This should be fixed. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq-be-fe-helpers.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_BE_FE_HELPERS_H +#define LIBPQ_BE_FE_HELPERS_H + +/* + * Despite the name, BUILDING_DLL is set only when building code directly part + * of the backend. Which also is where libpq isn't allowed to be + * used. Obviously this doesn't protect against libpq-fe.h getting included + * otherwise, but perhaps still protects against a few mistakes... + */ +#ifdef BUILDING_DLL +#error "libpq may not be used code directly built into the backend" +#endif + +#include "libpq-fe.h" +#include "miscadmin.h" +#include "storage/fd.h" +#include "storage/latch.h" +#include "utils/timestamp.h" +#include "utils/wait_event.h" + + +static inline void libpqsrv_connect_prepare(void); +static inline void libpqsrv_connect_internal(PGconn *conn, uint32 wait_event_info); +static inline PGresult *libpqsrv_get_result_last(PGconn *conn, uint32 wait_event_info); +static inline PGresult *libpqsrv_get_result(PGconn *conn, uint32 wait_event_info); + + +/* + * PQconnectdb() wrapper that reserves a file descriptor and processes + * interrupts during connection establishment. + * + * Throws an error if AcquireExternalFD() fails, but does not throw if + * connection establishment itself fails. Callers need to use PQstatus() to + * check if connection establishment succeeded. + */ +static inline PGconn * +libpqsrv_connect(const char *conninfo, uint32 wait_event_info) +{ + PGconn *conn = NULL; + + libpqsrv_connect_prepare(); + + conn = PQconnectStart(conninfo); + + libpqsrv_connect_internal(conn, wait_event_info); + + return conn; +} + +/* + * Like libpqsrv_connect(), except that this is a wrapper for + * PQconnectdbParams(). + */ +static inline PGconn * +libpqsrv_connect_params(const char *const *keywords, + const char *const *values, + int expand_dbname, + uint32 wait_event_info) +{ + PGconn *conn = NULL; + + libpqsrv_connect_prepare(); + + conn = PQconnectStartParams(keywords, values, expand_dbname); + + libpqsrv_connect_internal(conn, wait_event_info); + + return conn; +} + +/* + * PQfinish() wrapper that additionally releases the reserved file descriptor. + * + * It is allowed to call this with a NULL pgconn iff NULL was returned by + * libpqsrv_connect*. + */ +static inline void +libpqsrv_disconnect(PGconn *conn) +{ + /* + * If no connection was established, we haven't reserved an FD for it (or + * already released it). This rule makes it easier to write PG_CATCH() + * handlers for this facility's users. + * + * See also libpqsrv_connect_internal(). + */ + if (conn == NULL) + return; + + ReleaseExternalFD(); + PQfinish(conn); +} + + +/* internal helper functions follow */ + + +/* + * Helper function for all connection establishment functions. + */ +static inline void +libpqsrv_connect_prepare(void) +{ + /* + * We must obey fd.c's limit on non-virtual file descriptors. Assume that + * a PGconn represents one long-lived FD. (Doing this here also ensures + * that VFDs are closed if needed to make room.) + */ + if (!AcquireExternalFD()) + { +#ifndef WIN32 /* can't write #if within ereport() macro */ + ereport(ERROR, + (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), + errmsg("could not establish connection"), + errdetail("There are too many open files on the local server."), + errhint("Raise the server's \"max_files_per_process\" and/or \"ulimit -n\" limits."))); +#else + ereport(ERROR, + (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), + errmsg("could not establish connection"), + errdetail("There are too many open files on the local server."), + errhint("Raise the server's \"max_files_per_process\" setting."))); +#endif + } +} + +/* + * Helper function for all connection establishment functions. + */ +static inline void +libpqsrv_connect_internal(PGconn *conn, uint32 wait_event_info) +{ + /* + * With conn == NULL libpqsrv_disconnect() wouldn't release the FD. So do + * that here. + */ + if (conn == NULL) + { + ReleaseExternalFD(); + return; + } + + /* + * Can't wait without a socket. Note that we don't want to close the libpq + * connection yet, so callers can emit a useful error. + */ + if (PQstatus(conn) == CONNECTION_BAD) + return; + + /* + * WaitLatchOrSocket() can conceivably fail, handle that case here instead + * of requiring all callers to do so. + */ + PG_TRY(); + { + PostgresPollingStatusType status; + + /* + * Poll connection until we have OK or FAILED status. + * + * Per spec for PQconnectPoll, first wait till socket is write-ready. + */ + status = PGRES_POLLING_WRITING; + while (status != PGRES_POLLING_OK && status != PGRES_POLLING_FAILED) + { + int io_flag; + int rc; + + if (status == PGRES_POLLING_READING) + io_flag = WL_SOCKET_READABLE; +#ifdef WIN32 + + /* + * Windows needs a different test while waiting for + * connection-made + */ + else if (PQstatus(conn) == CONNECTION_STARTED) + io_flag = WL_SOCKET_CONNECTED; +#endif + else + io_flag = WL_SOCKET_WRITEABLE; + + rc = WaitLatchOrSocket(MyLatch, + WL_EXIT_ON_PM_DEATH | WL_LATCH_SET | io_flag, + PQsocket(conn), + 0, + wait_event_info); + + /* Interrupted? */ + if (rc & WL_LATCH_SET) + { + ResetLatch(MyLatch); + CHECK_FOR_INTERRUPTS(); + } + + /* If socket is ready, advance the libpq state machine */ + if (rc & io_flag) + status = PQconnectPoll(conn); + } + } + PG_CATCH(); + { + /* + * If an error is thrown here, the callers won't call + * libpqsrv_disconnect() with a conn, so release resources + * immediately. + */ + ReleaseExternalFD(); + PQfinish(conn); + + PG_RE_THROW(); + } + PG_END_TRY(); +} + +/* + * PQexec() wrapper that processes interrupts. + * + * Unless PQsetnonblocking(conn, 1) is in effect, this can't process + * interrupts while pushing the query text to the server. Consider that + * setting if query strings can be long relative to TCP buffer size. + * + * This has the preconditions of PQsendQuery(), not those of PQexec(). Most + * notably, PQexec() would silently discard any prior query results. + */ +static inline PGresult * +libpqsrv_exec(PGconn *conn, const char *query, uint32 wait_event_info) +{ + if (!PQsendQuery(conn, query)) + return NULL; + return libpqsrv_get_result_last(conn, wait_event_info); +} + +/* + * PQexecParams() wrapper that processes interrupts. + * + * See notes at libpqsrv_exec(). + */ +static inline PGresult * +libpqsrv_exec_params(PGconn *conn, + const char *command, + int nParams, + const Oid *paramTypes, + const char *const *paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat, + uint32 wait_event_info) +{ + if (!PQsendQueryParams(conn, command, nParams, paramTypes, paramValues, + paramLengths, paramFormats, resultFormat)) + return NULL; + return libpqsrv_get_result_last(conn, wait_event_info); +} + +/* + * Like PQexec(), loop over PQgetResult() until it returns NULL or another + * terminal state. Return the last non-NULL result or the terminal state. + */ +static inline PGresult * +libpqsrv_get_result_last(PGconn *conn, uint32 wait_event_info) +{ + PGresult *volatile lastResult = NULL; + + /* In what follows, do not leak any PGresults on an error. */ + PG_TRY(); + { + for (;;) + { + /* Wait for, and collect, the next PGresult. */ + PGresult *result; + + result = libpqsrv_get_result(conn, wait_event_info); + if (result == NULL) + break; /* query is complete, or failure */ + + /* + * Emulate PQexec()'s behavior of returning the last result when + * there are many. + */ + PQclear(lastResult); + lastResult = result; + + if (PQresultStatus(lastResult) == PGRES_COPY_IN || + PQresultStatus(lastResult) == PGRES_COPY_OUT || + PQresultStatus(lastResult) == PGRES_COPY_BOTH || + PQstatus(conn) == CONNECTION_BAD) + break; + } + } + PG_CATCH(); + { + PQclear(lastResult); + PG_RE_THROW(); + } + PG_END_TRY(); + + return lastResult; +} + +/* + * Perform the equivalent of PQgetResult(), but watch for interrupts. + */ +static inline PGresult * +libpqsrv_get_result(PGconn *conn, uint32 wait_event_info) +{ + /* + * Collect data until PQgetResult is ready to get the result without + * blocking. + */ + while (PQisBusy(conn)) + { + int rc; + + rc = WaitLatchOrSocket(MyLatch, + WL_EXIT_ON_PM_DEATH | WL_LATCH_SET | + WL_SOCKET_READABLE, + PQsocket(conn), + 0, + wait_event_info); + + /* Interrupted? */ + if (rc & WL_LATCH_SET) + { + ResetLatch(MyLatch); + CHECK_FOR_INTERRUPTS(); + } + + /* Consume whatever data is available from the socket */ + if (PQconsumeInput(conn) == 0) + { + /* trouble; expect PQgetResult() to return NULL */ + break; + } + } + + /* Now we can collect and return the next PGresult */ + return PQgetResult(conn); +} + +/* + * Submit a cancel request to the given connection, waiting only until + * the given time. + * + * We sleep interruptibly until we receive confirmation that the cancel + * request has been accepted, and if it is, return NULL; if the cancel + * request fails, return an error message string (which is not to be + * freed). + * + * For other problems (to wit: OOM when strdup'ing an error message from + * libpq), this function can ereport(ERROR). + * + * Note: this function leaks a string's worth of memory when reporting + * libpq errors. Make sure to call it in a transient memory context. + */ +static inline const char * +libpqsrv_cancel(PGconn *conn, TimestampTz endtime) +{ + PGcancelConn *cancel_conn; + const char *error = NULL; + + cancel_conn = PQcancelCreate(conn); + if (cancel_conn == NULL) + return "out of memory"; + + /* In what follows, do not leak any PGcancelConn on any errors. */ + + PG_TRY(); + { + if (!PQcancelStart(cancel_conn)) + { + error = pchomp(PQcancelErrorMessage(cancel_conn)); + goto exit; + } + + for (;;) + { + PostgresPollingStatusType pollres; + TimestampTz now; + long cur_timeout; + int waitEvents = WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH; + + pollres = PQcancelPoll(cancel_conn); + if (pollres == PGRES_POLLING_OK) + break; /* success! */ + + /* If timeout has expired, give up, else get sleep time. */ + now = GetCurrentTimestamp(); + cur_timeout = TimestampDifferenceMilliseconds(now, endtime); + if (cur_timeout <= 0) + { + error = "cancel request timed out"; + break; + } + + switch (pollres) + { + case PGRES_POLLING_READING: + waitEvents |= WL_SOCKET_READABLE; + break; + case PGRES_POLLING_WRITING: + waitEvents |= WL_SOCKET_WRITEABLE; + break; + default: + error = pchomp(PQcancelErrorMessage(cancel_conn)); + goto exit; + } + + /* Sleep until there's something to do */ + WaitLatchOrSocket(MyLatch, waitEvents, PQcancelSocket(cancel_conn), + cur_timeout, PG_WAIT_CLIENT); + + ResetLatch(MyLatch); + + CHECK_FOR_INTERRUPTS(); + } +exit: ; + } + PG_FINALLY(); + { + PQcancelFinish(cancel_conn); + } + PG_END_TRY(); + + return error; +} + +#endif /* LIBPQ_BE_FE_HELPERS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq-be.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq-be.h new file mode 100644 index 0000000..d6e671a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq-be.h @@ -0,0 +1,370 @@ +/*------------------------------------------------------------------------- + * + * libpq-be.h + * This file contains definitions for structures and externs used + * by the postmaster during client authentication. + * + * Note that this is backend-internal and is NOT exported to clients. + * Structs that need to be client-visible are in pqcomm.h. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq-be.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_BE_H +#define LIBPQ_BE_H + +#include "common/scram-common.h" + +#include +#ifdef USE_OPENSSL +#include +#include +#endif +#include + +#include "libpq/pg-gssapi.h" + +#ifdef ENABLE_SSPI +#define SECURITY_WIN32 +#if defined(WIN32) && !defined(_MSC_VER) +#include +#endif +#include +#undef SECURITY_WIN32 + +#ifndef ENABLE_GSS +/* + * Define a fake structure compatible with GSSAPI on Unix. + */ +typedef struct +{ + void *value; + int length; +} gss_buffer_desc; +#endif +#endif /* ENABLE_SSPI */ + +#include "datatype/timestamp.h" +#include "libpq/hba.h" +#include "libpq/pqcomm.h" + + +/* + * GSSAPI specific state information + */ +#if defined(ENABLE_GSS) | defined(ENABLE_SSPI) +typedef struct +{ + gss_buffer_desc outbuf; /* GSSAPI output token buffer */ +#ifdef ENABLE_GSS + gss_cred_id_t cred; /* GSSAPI connection cred's */ + gss_ctx_id_t ctx; /* GSSAPI connection context */ + gss_name_t name; /* GSSAPI client name */ + char *princ; /* GSSAPI Principal used for auth, NULL if + * GSSAPI auth was not used */ + bool auth; /* GSSAPI Authentication used */ + bool enc; /* GSSAPI encryption in use */ + bool delegated_creds; /* GSSAPI Delegated credentials */ +#endif +} pg_gssinfo; +#endif + +/* + * ClientConnectionInfo includes the fields describing the client connection + * that are copied over to parallel workers as nothing from Port does that. + * The same rules apply for allocations here as for Port (everything must be + * malloc'd or palloc'd in TopMemoryContext). + * + * If you add a struct member here, remember to also handle serialization in + * SerializeClientConnectionInfo() and co. + */ +typedef struct ClientConnectionInfo +{ + /* + * Authenticated identity. The meaning of this identifier is dependent on + * auth_method; it is the identity (if any) that the user presented during + * the authentication cycle, before they were assigned a database role. + * (It is effectively the "SYSTEM-USERNAME" of a pg_ident usermap -- + * though the exact string in use may be different, depending on pg_hba + * options.) + * + * authn_id is NULL if the user has not actually been authenticated, for + * example if the "trust" auth method is in use. + */ + const char *authn_id; + + /* + * The HBA method that determined the above authn_id. This only has + * meaning if authn_id is not NULL; otherwise it's undefined. + */ + UserAuth auth_method; +} ClientConnectionInfo; + +/* + * The Port structure holds state information about a client connection in a + * backend process. It is available in the global variable MyProcPort. The + * struct and all the data it points are kept in TopMemoryContext. + * + * remote_hostname is set if we did a successful reverse lookup of the + * client's IP address during connection setup. + * remote_hostname_resolv tracks the state of hostname verification: + * +1 = remote_hostname is known to resolve to client's IP address + * -1 = remote_hostname is known NOT to resolve to client's IP address + * 0 = we have not done the forward DNS lookup yet + * -2 = there was an error in name resolution + * If reverse lookup of the client IP address fails, remote_hostname will be + * left NULL while remote_hostname_resolv is set to -2. If reverse lookup + * succeeds but forward lookup fails, remote_hostname_resolv is also set to -2 + * (the case is distinguishable because remote_hostname isn't NULL). In + * either of the -2 cases, remote_hostname_errcode saves the lookup return + * code for possible later use with gai_strerror. + */ + +typedef struct Port +{ + pgsocket sock; /* File descriptor */ + bool noblock; /* is the socket in non-blocking mode? */ + ProtocolVersion proto; /* FE/BE protocol version */ + SockAddr laddr; /* local addr (postmaster) */ + SockAddr raddr; /* remote addr (client) */ + char *remote_host; /* name (or ip addr) of remote host */ + char *remote_hostname; /* name (not ip addr) of remote host, if + * available */ + int remote_hostname_resolv; /* see above */ + int remote_hostname_errcode; /* see above */ + char *remote_port; /* text rep of remote port */ + + /* local_host is filled only if needed (see log_status_format) */ + char local_host[64]; /* ip addr of local socket for client conn */ + + /* + * Information that needs to be saved from the startup packet and passed + * into backend execution. "char *" fields are NULL if not set. + * guc_options points to a List of alternating option names and values. + */ + char *database_name; + char *user_name; + char *cmdline_options; + List *guc_options; + + /* + * The startup packet application name, only used here for the "connection + * authorized" log message. We shouldn't use this post-startup, instead + * the GUC should be used as application can change it afterward. + */ + char *application_name; + + /* + * Information that needs to be held during the authentication cycle. + */ + HbaLine *hba; + + /* + * TCP keepalive and user timeout settings. + * + * default values are 0 if AF_UNIX or not yet known; current values are 0 + * if AF_UNIX or using the default. Also, -1 in a default value means we + * were unable to find out the default (getsockopt failed). + */ + int default_keepalives_idle; + int default_keepalives_interval; + int default_keepalives_count; + int default_tcp_user_timeout; + int keepalives_idle; + int keepalives_interval; + int keepalives_count; + int tcp_user_timeout; + + /* + * SCRAM structures. + */ + uint8 scram_ClientKey[SCRAM_MAX_KEY_LEN]; + uint8 scram_ServerKey[SCRAM_MAX_KEY_LEN]; + bool has_scram_keys; /* true if the above two are valid */ + + /* + * GSSAPI structures. + */ +#if defined(ENABLE_GSS) || defined(ENABLE_SSPI) + + /* + * If GSSAPI is supported and used on this connection, store GSSAPI + * information. Even when GSSAPI is not compiled in, store a NULL pointer + * to keep struct offsets the same (for extension ABI compatibility). + */ + pg_gssinfo *gss; +#else + void *gss; +#endif + + /* + * SSL structures. + */ + bool ssl_in_use; + char *peer_cn; + char *peer_dn; + bool peer_cert_valid; + bool alpn_used; + bool last_read_was_eof; + + /* + * OpenSSL structures. As with GSSAPI above, to keep struct offsets + * constant, NULL pointers are stored when SSL support is not enabled. + * (Although extensions should have no business accessing the raw_buf + * fields anyway.) + */ +#ifdef USE_OPENSSL + SSL *ssl; + X509 *peer; +#else + void *ssl; + void *peer; +#endif + + /* + * This is a bit of a hack. raw_buf is data that was previously read and + * buffered in a higher layer but then "unread" and needs to be read again + * while establishing an SSL connection via the SSL library layer. + * + * There's no API to "unread", the upper layer just places the data in the + * Port structure in raw_buf and sets raw_buf_remaining to the amount of + * bytes unread and raw_buf_consumed to 0. + */ + char *raw_buf; + ssize_t raw_buf_consumed, + raw_buf_remaining; +} Port; + +/* + * ClientSocket holds a socket for an accepted connection, along with the + * information about the remote endpoint. This is passed from postmaster to + * the backend process. + */ +typedef struct ClientSocket +{ + pgsocket sock; /* File descriptor */ + SockAddr raddr; /* remote addr (client) */ +} ClientSocket; + +#ifdef USE_SSL +/* + * Hardcoded DH parameters, used in ephemeral DH keying. (See also + * README.SSL for more details on EDH.) + * + * This is the 2048-bit DH parameter from RFC 3526. The generation of the + * prime is specified in RFC 2412 Appendix E, which also discusses the + * design choice of the generator. Note that when loaded with OpenSSL + * this causes DH_check() to fail on DH_NOT_SUITABLE_GENERATOR, where + * leaking a bit is preferred. + */ +#define FILE_DH2048 \ +"-----BEGIN DH PARAMETERS-----\n\ +MIIBCAKCAQEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb\n\ +IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft\n\ +awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT\n\ +mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh\n\ +fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq\n\ +5RXSJhiY+gUQFXKOWoqsqmj//////////wIBAg==\n\ +-----END DH PARAMETERS-----\n" + +/* + * These functions are implemented by the glue code specific to each + * SSL implementation (e.g. be-secure-openssl.c) + */ + +/* + * Initialize global SSL context. + * + * If isServerStart is true, report any errors as FATAL (so we don't return). + * Otherwise, log errors at LOG level and return -1 to indicate trouble, + * preserving the old SSL state if any. Returns 0 if OK. + */ +extern int be_tls_init(bool isServerStart); + +/* + * Destroy global SSL context, if any. + */ +extern void be_tls_destroy(void); + +/* + * Attempt to negotiate SSL connection. + */ +extern int be_tls_open_server(Port *port); + +/* + * Close SSL connection. + */ +extern void be_tls_close(Port *port); + +/* + * Read data from a secure connection. + */ +extern ssize_t be_tls_read(Port *port, void *ptr, size_t len, int *waitfor); + +/* + * Write data to a secure connection. + */ +extern ssize_t be_tls_write(Port *port, const void *ptr, size_t len, int *waitfor); + +/* + * Return information about the SSL connection. + */ +extern int be_tls_get_cipher_bits(Port *port); +extern const char *be_tls_get_version(Port *port); +extern const char *be_tls_get_cipher(Port *port); +extern void be_tls_get_peer_subject_name(Port *port, char *ptr, size_t len); +extern void be_tls_get_peer_issuer_name(Port *port, char *ptr, size_t len); +extern void be_tls_get_peer_serial(Port *port, char *ptr, size_t len); + +/* + * Get the server certificate hash for SCRAM channel binding type + * tls-server-end-point. + * + * The result is a palloc'd hash of the server certificate with its + * size, and NULL if there is no certificate available. + */ +extern char *be_tls_get_certificate_hash(Port *port, size_t *len); + +/* init hook for SSL, the default sets the password callback if appropriate */ +#ifdef USE_OPENSSL +typedef void (*openssl_tls_init_hook_typ) (SSL_CTX *context, bool isServerStart); +extern PGDLLIMPORT openssl_tls_init_hook_typ openssl_tls_init_hook; +#endif + +#endif /* USE_SSL */ + +#ifdef ENABLE_GSS +/* + * Return information about the GSSAPI authenticated connection + */ +extern bool be_gssapi_get_auth(Port *port); +extern bool be_gssapi_get_enc(Port *port); +extern const char *be_gssapi_get_princ(Port *port); +extern bool be_gssapi_get_delegation(Port *port); + +/* Read and write to a GSSAPI-encrypted connection. */ +extern ssize_t be_gssapi_read(Port *port, void *ptr, size_t len); +extern ssize_t be_gssapi_write(Port *port, const void *ptr, size_t len); +#endif /* ENABLE_GSS */ + +extern PGDLLIMPORT ProtocolVersion FrontendProtocol; +extern PGDLLIMPORT ClientConnectionInfo MyClientConnectionInfo; + +/* TCP keepalives configuration. These are no-ops on an AF_UNIX socket. */ + +extern int pq_getkeepalivesidle(Port *port); +extern int pq_getkeepalivesinterval(Port *port); +extern int pq_getkeepalivescount(Port *port); +extern int pq_gettcpusertimeout(Port *port); + +extern int pq_setkeepalivesidle(int idle, Port *port); +extern int pq_setkeepalivesinterval(int interval, Port *port); +extern int pq_setkeepalivescount(int count, Port *port); +extern int pq_settcpusertimeout(int timeout, Port *port); + +#endif /* LIBPQ_BE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq-fs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq-fs.h new file mode 100644 index 0000000..26fa50c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq-fs.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * libpq-fs.h + * definitions for using Inversion file system routines (ie, large objects) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq-fs.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_FS_H +#define LIBPQ_FS_H + +/* + * Read/write mode flags for inversion (large object) calls + */ + +#define INV_WRITE 0x00020000 +#define INV_READ 0x00040000 + +#endif /* LIBPQ_FS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq.h new file mode 100644 index 0000000..aeb66ca --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/libpq.h @@ -0,0 +1,145 @@ +/*------------------------------------------------------------------------- + * + * libpq.h + * POSTGRES LIBPQ buffer structure definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_H +#define LIBPQ_H + +#include + +#include "lib/stringinfo.h" +#include "libpq/libpq-be.h" +#include "storage/latch.h" + + +/* + * Callers of pq_getmessage() must supply a maximum expected message size. + * By convention, if there's not any specific reason to use another value, + * use PQ_SMALL_MESSAGE_LIMIT for messages that shouldn't be too long, and + * PQ_LARGE_MESSAGE_LIMIT for messages that can be long. + */ +#define PQ_SMALL_MESSAGE_LIMIT 10000 +#define PQ_LARGE_MESSAGE_LIMIT (MaxAllocSize - 1) + +typedef struct +{ + void (*comm_reset) (void); + int (*flush) (void); + int (*flush_if_writable) (void); + bool (*is_send_pending) (void); + int (*putmessage) (char msgtype, const char *s, size_t len); + void (*putmessage_noblock) (char msgtype, const char *s, size_t len); +} PQcommMethods; + +extern const PGDLLIMPORT PQcommMethods *PqCommMethods; + +#define pq_comm_reset() (PqCommMethods->comm_reset()) +#define pq_flush() (PqCommMethods->flush()) +#define pq_flush_if_writable() (PqCommMethods->flush_if_writable()) +#define pq_is_send_pending() (PqCommMethods->is_send_pending()) +#define pq_putmessage(msgtype, s, len) \ + (PqCommMethods->putmessage(msgtype, s, len)) +#define pq_putmessage_noblock(msgtype, s, len) \ + (PqCommMethods->putmessage_noblock(msgtype, s, len)) + +/* + * External functions. + */ + +/* + * prototypes for functions in pqcomm.c + */ +extern PGDLLIMPORT WaitEventSet *FeBeWaitSet; + +#define FeBeWaitSetSocketPos 0 +#define FeBeWaitSetLatchPos 1 +#define FeBeWaitSetNEvents 3 + +extern int ListenServerPort(int family, const char *hostName, + unsigned short portNumber, const char *unixSocketDir, + pgsocket ListenSockets[], int *NumListenSockets, int MaxListen); +extern int AcceptConnection(pgsocket server_fd, ClientSocket *client_sock); +extern void TouchSocketFiles(void); +extern void RemoveSocketFiles(void); +extern Port *pq_init(ClientSocket *client_sock); +extern int pq_getbytes(void *b, size_t len); +extern void pq_startmsgread(void); +extern void pq_endmsgread(void); +extern bool pq_is_reading_msg(void); +extern int pq_getmessage(StringInfo s, int maxlen); +extern int pq_getbyte(void); +extern int pq_peekbyte(void); +extern int pq_getbyte_if_available(unsigned char *c); +extern ssize_t pq_buffer_remaining_data(void); +extern int pq_putmessage_v2(char msgtype, const char *s, size_t len); +extern bool pq_check_connection(void); + +/* + * prototypes for functions in be-secure.c + */ +extern int secure_initialize(bool isServerStart); +extern bool secure_loaded_verify_locations(void); +extern void secure_destroy(void); +extern int secure_open_server(Port *port); +extern void secure_close(Port *port); +extern ssize_t secure_read(Port *port, void *ptr, size_t len); +extern ssize_t secure_write(Port *port, const void *ptr, size_t len); +extern ssize_t secure_raw_read(Port *port, void *ptr, size_t len); +extern ssize_t secure_raw_write(Port *port, const void *ptr, size_t len); + +/* + * declarations for variables defined in be-secure.c + */ +extern PGDLLIMPORT char *ssl_library; +extern PGDLLIMPORT char *ssl_ca_file; +extern PGDLLIMPORT char *ssl_cert_file; +extern PGDLLIMPORT char *ssl_crl_file; +extern PGDLLIMPORT char *ssl_crl_dir; +extern PGDLLIMPORT char *ssl_key_file; +extern PGDLLIMPORT int ssl_min_protocol_version; +extern PGDLLIMPORT int ssl_max_protocol_version; +extern PGDLLIMPORT char *ssl_passphrase_command; +extern PGDLLIMPORT bool ssl_passphrase_command_supports_reload; +extern PGDLLIMPORT char *ssl_dh_params_file; +extern PGDLLIMPORT char *SSLCipherSuites; +extern PGDLLIMPORT char *SSLCipherList; +extern PGDLLIMPORT char *SSLECDHCurve; +extern PGDLLIMPORT bool SSLPreferServerCiphers; +#ifdef USE_SSL +extern PGDLLIMPORT bool ssl_loaded_verify_locations; +#endif + +/* + * prototypes for functions in be-secure-gssapi.c + */ +#ifdef ENABLE_GSS +extern ssize_t secure_open_gssapi(Port *port); +#endif + +enum ssl_protocol_versions +{ + PG_TLS_ANY = 0, + PG_TLS1_VERSION, + PG_TLS1_1_VERSION, + PG_TLS1_2_VERSION, + PG_TLS1_3_VERSION, +}; + +/* + * prototypes for functions in be-secure-common.c + */ +extern int run_ssl_passphrase_command(const char *prompt, bool is_server_start, + char *buf, int size); +extern bool check_ssl_key_file_permissions(const char *ssl_key_file, + bool isServerStart); + +#endif /* LIBPQ_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/oauth.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/oauth.h new file mode 100644 index 0000000..f75d2e3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/oauth.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------------------- + * + * oauth.h + * Interface to libpq/auth-oauth.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/oauth.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OAUTH_H +#define PG_OAUTH_H + +#include "libpq/libpq-be.h" +#include "libpq/sasl.h" + +extern PGDLLIMPORT char *oauth_validator_libraries_string; + +typedef struct ValidatorModuleState +{ + /* Holds the server's PG_VERSION_NUM. Reserved for future extensibility. */ + int sversion; + + /* + * Private data pointer for use by a validator module. This can be used to + * store state for the module that will be passed to each of its + * callbacks. + */ + void *private_data; +} ValidatorModuleState; + +typedef struct ValidatorModuleResult +{ + /* + * Should be set to true if the token carries sufficient permissions for + * the bearer to connect. + */ + bool authorized; + + /* + * If the token authenticates the user, this should be set to a palloc'd + * string containing the SYSTEM_USER to use for HBA mapping. Consider + * setting this even if result->authorized is false so that DBAs may use + * the logs to match end users to token failures. + * + * This is required if the module is not configured for ident mapping + * delegation. See the validator module documentation for details. + */ + char *authn_id; +} ValidatorModuleResult; + +/* + * Validator module callbacks + * + * These callback functions should be defined by validator modules and returned + * via _PG_oauth_validator_module_init(). ValidatorValidateCB is the only + * required callback. For more information about the purpose of each callback, + * refer to the OAuth validator modules documentation. + */ +typedef void (*ValidatorStartupCB) (ValidatorModuleState *state); +typedef void (*ValidatorShutdownCB) (ValidatorModuleState *state); +typedef bool (*ValidatorValidateCB) (const ValidatorModuleState *state, + const char *token, const char *role, + ValidatorModuleResult *result); + +/* + * Identifies the compiled ABI version of the validator module. Since the server + * already enforces the PG_MODULE_MAGIC number for modules across major + * versions, this is reserved for emergency use within a stable release line. + * May it never need to change. + */ +#define PG_OAUTH_VALIDATOR_MAGIC 0x20250220 + +typedef struct OAuthValidatorCallbacks +{ + uint32 magic; /* must be set to PG_OAUTH_VALIDATOR_MAGIC */ + + ValidatorStartupCB startup_cb; + ValidatorShutdownCB shutdown_cb; + ValidatorValidateCB validate_cb; +} OAuthValidatorCallbacks; + +/* + * Type of the shared library symbol _PG_oauth_validator_module_init which is + * required for all validator modules. This function will be invoked during + * module loading. + */ +typedef const OAuthValidatorCallbacks *(*OAuthValidatorModuleInit) (void); +extern PGDLLEXPORT const OAuthValidatorCallbacks *_PG_oauth_validator_module_init(void); + +/* Implementation */ +extern PGDLLIMPORT const pg_be_sasl_mech pg_be_oauth_mech; + +/* + * Ensure a validator named in the HBA is permitted by the configuration. + */ +extern bool check_oauth_validator(HbaLine *hbaline, int elevel, char **err_msg); + +#endif /* PG_OAUTH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pg-gssapi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pg-gssapi.h new file mode 100644 index 0000000..f49fad1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pg-gssapi.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * pg-gssapi.h + * Definitions for including GSSAPI headers + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pg-gssapi.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PG_GSSAPI_H +#define PG_GSSAPI_H + +#ifdef ENABLE_GSS + +/* IWYU pragma: begin_exports */ +#if defined(HAVE_GSSAPI_H) +#include +#include +#else +#include +#include +#endif +/* IWYU pragma: end_exports */ + +/* +* On Windows, includes a #define for X509_NAME, which breaks our +* ability to use OpenSSL's version of that symbol if is pulled +* in after ... and, at least on some builds, it is. We +* can't reliably fix that by re-ordering #includes, because libpq/libpq-be.h +* #includes . Instead, just zap the #define again here. +*/ +#ifdef X509_NAME +#undef X509_NAME +#endif + +#endif /* ENABLE_GSS */ + +#endif /* PG_GSSAPI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqcomm.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqcomm.h new file mode 100644 index 0000000..f04ca13 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqcomm.h @@ -0,0 +1,175 @@ +/*------------------------------------------------------------------------- + * + * pqcomm.h + * Definitions common to frontends and backends. + * + * NOTE: for historical reasons, this does not correspond to pqcomm.c. + * pqcomm.c's routines are declared in libpq.h. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pqcomm.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQCOMM_H +#define PQCOMM_H + +#include +#include +#include +#include + +/* + * The definitions for the request/response codes are kept in a separate file + * for ease of use in third party programs. + */ +#include "libpq/protocol.h" + +typedef struct +{ + struct sockaddr_storage addr; + socklen_t salen; +} SockAddr; + +typedef struct +{ + int family; + SockAddr addr; +} AddrInfo; + +/* Configure the UNIX socket location for the well known port. */ + +#define UNIXSOCK_PATH(path, port, sockdir) \ + (AssertMacro(sockdir), \ + AssertMacro(*(sockdir) != '\0'), \ + snprintf(path, sizeof(path), "%s/.s.PGSQL.%d", \ + (sockdir), (port))) + +/* + * The maximum workable length of a socket path is what will fit into + * struct sockaddr_un. This is usually only 100 or so bytes :-(. + * + * For consistency, always pass a MAXPGPATH-sized buffer to UNIXSOCK_PATH(), + * then complain if the resulting string is >= UNIXSOCK_PATH_BUFLEN bytes. + * (Because the standard API for getaddrinfo doesn't allow it to complain in + * a useful way when the socket pathname is too long, we have to test for + * this explicitly, instead of just letting the subroutine return an error.) + */ +#define UNIXSOCK_PATH_BUFLEN sizeof(((struct sockaddr_un *) NULL)->sun_path) + +/* + * A host that looks either like an absolute path or starts with @ is + * interpreted as a Unix-domain socket address. + */ +static inline bool +is_unixsock_path(const char *path) +{ + return is_absolute_path(path) || path[0] == '@'; +} + +/* + * These manipulate the frontend/backend protocol version number. + * + * The major number should be incremented for incompatible changes. The minor + * number should be incremented for compatible changes (eg. additional + * functionality). + * + * If a backend supports version m.n of the protocol it must actually support + * versions m.[0..n]. Backend support for version m-1 can be dropped after a + * `reasonable' length of time. + * + * A frontend isn't required to support anything other than the current + * version. + */ + +#define PG_PROTOCOL_MAJOR(v) ((v) >> 16) +#define PG_PROTOCOL_MINOR(v) ((v) & 0x0000ffff) +#define PG_PROTOCOL_FULL(v) (PG_PROTOCOL_MAJOR(v) * 10000 + PG_PROTOCOL_MINOR(v)) +#define PG_PROTOCOL(m,n) (((m) << 16) | (n)) + +/* + * The earliest and latest frontend/backend protocol version supported. + */ + +#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(3,0) +#define PG_PROTOCOL_LATEST PG_PROTOCOL(3,2) + +typedef uint32 ProtocolVersion; /* FE/BE protocol version number */ + +typedef ProtocolVersion MsgType; + + +/* + * Packet lengths are 4 bytes in network byte order. + * + * The initial length is omitted from the packet layouts appearing below. + */ + +typedef uint32 PacketLen; + +/* + * In protocol 3.0 and later, the startup packet length is not fixed, but + * we set an arbitrary limit on it anyway. This is just to prevent simple + * denial-of-service attacks via sending enough data to run the server + * out of memory. + */ +#define MAX_STARTUP_PACKET_LENGTH 10000 + + +typedef uint32 AuthRequest; + + +/* + * A client can also send a cancel-current-operation request to the postmaster. + * This is uglier than sending it directly to the client's backend, but it + * avoids depending on out-of-band communication facilities. + * + * The cancel request code must not match any protocol version number + * we're ever likely to use. This random choice should do. + * + * Before PostgreSQL v18 and the protocol version bump from 3.0 to 3.2, the + * cancel key was always 4 bytes. With protocol version 3.2, it's variable + * length. + */ + +#define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678) + +typedef struct CancelRequestPacket +{ + /* Note that each field is stored in network byte order! */ + MsgType cancelRequestCode; /* code to identify a cancel request */ + uint32 backendPID; /* PID of client's backend */ + uint8 cancelAuthCode[FLEXIBLE_ARRAY_MEMBER]; /* secret key to + * authorize cancel */ +} CancelRequestPacket; + +/* Application-Layer Protocol Negotiation is required for direct connections + * to avoid protocol confusion attacks (e.g https://alpaca-attack.com/). + * + * ALPN is specified in RFC 7301 + * + * This string should be registered at: + * https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids + * + * OpenSSL uses this wire-format for the list of alpn protocols even in the + * API. Both server and client take the same format parameter but the client + * actually sends it to the server as-is and the server it specifies the + * preference order to use to choose the one selected to send back. + * + * c.f. https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_alpn_select_cb.html + * + * The #define can be used to initialize a char[] vector to use directly in the API + */ +#define PG_ALPN_PROTOCOL "postgresql" +#define PG_ALPN_PROTOCOL_VECTOR { 10, 'p','o','s','t','g','r','e','s','q','l' } + +/* + * A client can also start by sending a SSL or GSSAPI negotiation request to + * get a secure channel. + */ +#define NEGOTIATE_SSL_CODE PG_PROTOCOL(1234,5679) +#define NEGOTIATE_GSS_CODE PG_PROTOCOL(1234,5680) + +#endif /* PQCOMM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqformat.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqformat.h new file mode 100644 index 0000000..9a1534b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqformat.h @@ -0,0 +1,209 @@ +/*------------------------------------------------------------------------- + * + * pqformat.h + * Definitions for formatting and parsing frontend/backend messages + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pqformat.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQFORMAT_H +#define PQFORMAT_H + +#include "lib/stringinfo.h" +#include "mb/pg_wchar.h" +#include "port/pg_bswap.h" + +extern void pq_beginmessage(StringInfo buf, char msgtype); +extern void pq_beginmessage_reuse(StringInfo buf, char msgtype); +extern void pq_endmessage(StringInfo buf); +extern void pq_endmessage_reuse(StringInfo buf); + +extern void pq_sendbytes(StringInfo buf, const void *data, int datalen); +extern void pq_sendcountedtext(StringInfo buf, const char *str, int slen); +extern void pq_sendtext(StringInfo buf, const char *str, int slen); +extern void pq_sendstring(StringInfo buf, const char *str); +extern void pq_send_ascii_string(StringInfo buf, const char *str); +extern void pq_sendfloat4(StringInfo buf, float4 f); +extern void pq_sendfloat8(StringInfo buf, float8 f); + +/* + * Append a [u]int8 to a StringInfo buffer, which already has enough space + * preallocated. + * + * The use of pg_restrict allows the compiler to optimize the code based on + * the assumption that buf, buf->len, buf->data and *buf->data don't + * overlap. Without the annotation buf->len etc cannot be kept in a register + * over subsequent pq_writeintN calls. + * + * The use of StringInfoData * rather than StringInfo is due to MSVC being + * overly picky and demanding a * before a restrict. + */ +static inline void +pq_writeint8(StringInfoData *pg_restrict buf, uint8 i) +{ + uint8 ni = i; + + Assert(buf->len + (int) sizeof(uint8) <= buf->maxlen); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint8)); + buf->len += sizeof(uint8); +} + +/* + * Append a [u]int16 to a StringInfo buffer, which already has enough space + * preallocated. + */ +static inline void +pq_writeint16(StringInfoData *pg_restrict buf, uint16 i) +{ + uint16 ni = pg_hton16(i); + + Assert(buf->len + (int) sizeof(uint16) <= buf->maxlen); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint16)); + buf->len += sizeof(uint16); +} + +/* + * Append a [u]int32 to a StringInfo buffer, which already has enough space + * preallocated. + */ +static inline void +pq_writeint32(StringInfoData *pg_restrict buf, uint32 i) +{ + uint32 ni = pg_hton32(i); + + Assert(buf->len + (int) sizeof(uint32) <= buf->maxlen); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint32)); + buf->len += sizeof(uint32); +} + +/* + * Append a [u]int64 to a StringInfo buffer, which already has enough space + * preallocated. + */ +static inline void +pq_writeint64(StringInfoData *pg_restrict buf, uint64 i) +{ + uint64 ni = pg_hton64(i); + + Assert(buf->len + (int) sizeof(uint64) <= buf->maxlen); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint64)); + buf->len += sizeof(uint64); +} + +/* + * Append a null-terminated text string (with conversion) to a buffer with + * preallocated space. + * + * NB: The pre-allocated space needs to be sufficient for the string after + * converting to client encoding. + * + * NB: passed text string must be null-terminated, and so is the data + * sent to the frontend. + */ +static inline void +pq_writestring(StringInfoData *pg_restrict buf, const char *pg_restrict str) +{ + int slen = strlen(str); + char *p; + + p = pg_server_to_client(str, slen); + if (p != str) /* actual conversion has been done? */ + slen = strlen(p); + + Assert(buf->len + slen + 1 <= buf->maxlen); + + memcpy(((char *pg_restrict) buf->data + buf->len), p, slen + 1); + buf->len += slen + 1; + + if (p != str) + pfree(p); +} + +/* append a binary [u]int8 to a StringInfo buffer */ +static inline void +pq_sendint8(StringInfo buf, uint8 i) +{ + enlargeStringInfo(buf, sizeof(uint8)); + pq_writeint8(buf, i); +} + +/* append a binary [u]int16 to a StringInfo buffer */ +static inline void +pq_sendint16(StringInfo buf, uint16 i) +{ + enlargeStringInfo(buf, sizeof(uint16)); + pq_writeint16(buf, i); +} + +/* append a binary [u]int32 to a StringInfo buffer */ +static inline void +pq_sendint32(StringInfo buf, uint32 i) +{ + enlargeStringInfo(buf, sizeof(uint32)); + pq_writeint32(buf, i); +} + +/* append a binary [u]int64 to a StringInfo buffer */ +static inline void +pq_sendint64(StringInfo buf, uint64 i) +{ + enlargeStringInfo(buf, sizeof(uint64)); + pq_writeint64(buf, i); +} + +/* append a binary byte to a StringInfo buffer */ +static inline void +pq_sendbyte(StringInfo buf, uint8 byt) +{ + pq_sendint8(buf, byt); +} + +/* + * Append a binary integer to a StringInfo buffer + * + * This function is deprecated; prefer use of the functions above. + */ +static inline void +pq_sendint(StringInfo buf, uint32 i, int b) +{ + switch (b) + { + case 1: + pq_sendint8(buf, (uint8) i); + break; + case 2: + pq_sendint16(buf, (uint16) i); + break; + case 4: + pq_sendint32(buf, (uint32) i); + break; + default: + elog(ERROR, "unsupported integer size %d", b); + break; + } +} + + +extern void pq_begintypsend(StringInfo buf); +extern bytea *pq_endtypsend(StringInfo buf); + +extern void pq_puttextmessage(char msgtype, const char *str); +extern void pq_putemptymessage(char msgtype); + +extern int pq_getmsgbyte(StringInfo msg); +extern unsigned int pq_getmsgint(StringInfo msg, int b); +extern int64 pq_getmsgint64(StringInfo msg); +extern float4 pq_getmsgfloat4(StringInfo msg); +extern float8 pq_getmsgfloat8(StringInfo msg); +extern const char *pq_getmsgbytes(StringInfo msg, int datalen); +extern void pq_copymsgbytes(StringInfo msg, void *buf, int datalen); +extern char *pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes); +extern const char *pq_getmsgstring(StringInfo msg); +extern const char *pq_getmsgrawstring(StringInfo msg); +extern void pq_getmsgend(StringInfo msg); + +#endif /* PQFORMAT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqmq.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqmq.h new file mode 100644 index 0000000..348b449 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqmq.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * pqmq.h + * Use the frontend/backend protocol for communication over a shm_mq + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pqmq.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQMQ_H +#define PQMQ_H + +#include "lib/stringinfo.h" +#include "storage/shm_mq.h" + +extern void pq_redirect_to_shm_mq(dsm_segment *seg, shm_mq_handle *mqh); +extern void pq_set_parallel_leader(pid_t pid, ProcNumber procNumber); + +extern void pq_parse_errornotice(StringInfo msg, ErrorData *edata); + +#endif /* PQMQ_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqsignal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqsignal.h new file mode 100644 index 0000000..5be7870 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/pqsignal.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * pqsignal.h + * Backend signal(2) support (see also src/port/pqsignal.c) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pqsignal.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQSIGNAL_H +#define PQSIGNAL_H + +#include + +#ifdef WIN32 +/* Emulate POSIX sigset_t APIs on Windows */ +typedef int sigset_t; + +#define SA_RESTART 1 +#define SA_NODEFER 2 + +struct sigaction +{ + void (*sa_handler) (int); + /* sa_sigaction not yet implemented */ + sigset_t sa_mask; + int sa_flags; +}; + +extern int pqsigprocmask(int how, const sigset_t *set, sigset_t *oset); +extern int pqsigaction(int signum, const struct sigaction *act, + struct sigaction *oldact); + +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 +#define sigprocmask(how, set, oset) pqsigprocmask((how), (set), (oset)) +#define sigaction(signum, act, oldact) pqsigaction((signum), (act), (oldact)) +#define sigemptyset(set) (*(set) = 0) +#define sigfillset(set) (*(set) = ~0) +#define sigaddset(set, signum) (*(set) |= (sigmask(signum))) +#define sigdelset(set, signum) (*(set) &= ~(sigmask(signum))) +#endif /* WIN32 */ + +extern PGDLLIMPORT sigset_t UnBlockSig; +extern PGDLLIMPORT sigset_t BlockSig; +extern PGDLLIMPORT sigset_t StartupBlockSig; + +extern void pqinitmask(void); + +#endif /* PQSIGNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/protocol.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/protocol.h new file mode 100644 index 0000000..b0bcb3c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/protocol.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------- + * + * protocol.h + * Definitions of the request/response codes for the wire protocol. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/protocol.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROTOCOL_H +#define PROTOCOL_H + +/* These are the request codes sent by the frontend. */ + +#define PqMsg_Bind 'B' +#define PqMsg_Close 'C' +#define PqMsg_Describe 'D' +#define PqMsg_Execute 'E' +#define PqMsg_FunctionCall 'F' +#define PqMsg_Flush 'H' +#define PqMsg_Parse 'P' +#define PqMsg_Query 'Q' +#define PqMsg_Sync 'S' +#define PqMsg_Terminate 'X' +#define PqMsg_CopyFail 'f' +#define PqMsg_GSSResponse 'p' +#define PqMsg_PasswordMessage 'p' +#define PqMsg_SASLInitialResponse 'p' +#define PqMsg_SASLResponse 'p' + + +/* These are the response codes sent by the backend. */ + +#define PqMsg_ParseComplete '1' +#define PqMsg_BindComplete '2' +#define PqMsg_CloseComplete '3' +#define PqMsg_NotificationResponse 'A' +#define PqMsg_CommandComplete 'C' +#define PqMsg_DataRow 'D' +#define PqMsg_ErrorResponse 'E' +#define PqMsg_CopyInResponse 'G' +#define PqMsg_CopyOutResponse 'H' +#define PqMsg_EmptyQueryResponse 'I' +#define PqMsg_BackendKeyData 'K' +#define PqMsg_NoticeResponse 'N' +#define PqMsg_AuthenticationRequest 'R' +#define PqMsg_ParameterStatus 'S' +#define PqMsg_RowDescription 'T' +#define PqMsg_FunctionCallResponse 'V' +#define PqMsg_CopyBothResponse 'W' +#define PqMsg_ReadyForQuery 'Z' +#define PqMsg_NoData 'n' +#define PqMsg_PortalSuspended 's' +#define PqMsg_ParameterDescription 't' +#define PqMsg_NegotiateProtocolVersion 'v' + + +/* These are the codes sent by both the frontend and backend. */ + +#define PqMsg_CopyDone 'c' +#define PqMsg_CopyData 'd' + + +/* These are the codes sent by parallel workers to leader processes. */ +#define PqMsg_Progress 'P' + + +/* These are the authentication request codes sent by the backend. */ + +#define AUTH_REQ_OK 0 /* User is authenticated */ +#define AUTH_REQ_KRB4 1 /* Kerberos V4. Not supported any more. */ +#define AUTH_REQ_KRB5 2 /* Kerberos V5. Not supported any more. */ +#define AUTH_REQ_PASSWORD 3 /* Password */ +#define AUTH_REQ_CRYPT 4 /* crypt password. Not supported any more. */ +#define AUTH_REQ_MD5 5 /* md5 password */ +/* 6 is available. It was used for SCM creds, not supported any more. */ +#define AUTH_REQ_GSS 7 /* GSSAPI without wrap() */ +#define AUTH_REQ_GSS_CONT 8 /* Continue GSS exchanges */ +#define AUTH_REQ_SSPI 9 /* SSPI negotiate without wrap() */ +#define AUTH_REQ_SASL 10 /* Begin SASL authentication */ +#define AUTH_REQ_SASL_CONT 11 /* Continue SASL authentication */ +#define AUTH_REQ_SASL_FIN 12 /* Final SASL message */ +#define AUTH_REQ_MAX AUTH_REQ_SASL_FIN /* maximum AUTH_REQ_* value */ + +#endif /* PROTOCOL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/sasl.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/sasl.h new file mode 100644 index 0000000..581e298 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/sasl.h @@ -0,0 +1,147 @@ +/*------------------------------------------------------------------------- + * + * sasl.h + * Defines the SASL mechanism interface for the backend. + * + * Each SASL mechanism defines a frontend and a backend callback structure. + * + * See src/interfaces/libpq/fe-auth-sasl.h for the frontend counterpart. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/sasl.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PG_SASL_H +#define PG_SASL_H + +#include "lib/stringinfo.h" +#include "libpq/libpq-be.h" + +/* Status codes for message exchange */ +#define PG_SASL_EXCHANGE_CONTINUE 0 +#define PG_SASL_EXCHANGE_SUCCESS 1 +#define PG_SASL_EXCHANGE_FAILURE 2 + +/* + * Maximum accepted size of SASL messages. + * + * The messages that the server or libpq generate are much smaller than this, + * but have some headroom. + */ +#define PG_MAX_SASL_MESSAGE_LENGTH 1024 + +/* + * Backend SASL mechanism callbacks and metadata. + * + * To implement a backend mechanism, declare a pg_be_sasl_mech struct with + * appropriate callback implementations. Then pass the mechanism to + * CheckSASLAuth() during ClientAuthentication(), once the server has decided + * which authentication method to use. + */ +typedef struct pg_be_sasl_mech +{ + /*--------- + * get_mechanisms() + * + * Retrieves the list of SASL mechanism names supported by this + * implementation. + * + * Input parameters: + * + * port: The client Port + * + * Output parameters: + * + * buf: A StringInfo buffer that the callback should populate with + * supported mechanism names. The names are appended into this + * StringInfo, each one ending with '\0' bytes. + *--------- + */ + void (*get_mechanisms) (Port *port, StringInfo buf); + + /*--------- + * init() + * + * Initializes mechanism-specific state for a connection. This callback + * must return a pointer to its allocated state, which will be passed + * as-is as the first argument to the other callbacks. + * + * Input parameters: + * + * port: The client Port. + * + * mech: The actual mechanism name in use by the client. + * + * shadow_pass: The stored secret for the role being authenticated, or + * NULL if one does not exist. Mechanisms that do not use + * shadow entries may ignore this parameter. If a + * mechanism uses shadow entries but shadow_pass is NULL, + * the implementation must continue the exchange as if the + * user existed and the password did not match, to avoid + * disclosing valid user names. + *--------- + */ + void *(*init) (Port *port, const char *mech, const char *shadow_pass); + + /*--------- + * exchange() + * + * Produces a server challenge to be sent to the client. The callback + * must return one of the PG_SASL_EXCHANGE_* values, depending on + * whether the exchange continues, has finished successfully, or has + * failed. + * + * Input parameters: + * + * state: The opaque mechanism state returned by init() + * + * input: The response data sent by the client, or NULL if the + * mechanism is client-first but the client did not send an + * initial response. (This can only happen during the first + * message from the client.) This is guaranteed to be + * null-terminated for safety, but SASL allows embedded + * nulls in responses, so mechanisms must be careful to + * check inputlen. + * + * inputlen: The length of the challenge data sent by the server, or + * -1 if the client did not send an initial response + * + * Output parameters, to be set by the callback function: + * + * output: A palloc'd buffer containing either the server's next + * challenge (if PG_SASL_EXCHANGE_CONTINUE is returned) or + * the server's outcome data (if PG_SASL_EXCHANGE_SUCCESS is + * returned and the mechanism requires data to be sent during + * a successful outcome). The callback should set this to + * NULL if the exchange is over and no output should be sent, + * which should correspond to either PG_SASL_EXCHANGE_FAILURE + * or a PG_SASL_EXCHANGE_SUCCESS with no outcome data. + * + * outputlen: The length of the challenge data. Ignored if *output is + * NULL. + * + * logdetail: Set to an optional DETAIL message to be printed to the + * server log, to disambiguate failure modes. (The client + * will only ever see the same generic authentication + * failure message.) Ignored if the exchange is completed + * with PG_SASL_EXCHANGE_SUCCESS. + *--------- + */ + int (*exchange) (void *state, + const char *input, int inputlen, + char **output, int *outputlen, + const char **logdetail); + + /* The maximum size allowed for client SASLResponses. */ + int max_message_length; +} pg_be_sasl_mech; + +/* Common implementation for auth.c */ +extern int CheckSASLAuth(const pg_be_sasl_mech *mech, Port *port, + char *shadow_pass, const char **logdetail); + +#endif /* PG_SASL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/scram.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/scram.h new file mode 100644 index 0000000..c1237d3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/libpq/scram.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * scram.h + * Interface to libpq/scram.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/scram.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SCRAM_H +#define PG_SCRAM_H + +#include "common/cryptohash.h" +#include "lib/stringinfo.h" +#include "libpq/libpq-be.h" +#include "libpq/sasl.h" + +/* Number of iterations when generating new secrets */ +extern PGDLLIMPORT int scram_sha_256_iterations; + +/* SASL implementation callbacks */ +extern PGDLLIMPORT const pg_be_sasl_mech pg_be_scram_mech; + +/* Routines to handle and check SCRAM-SHA-256 secret */ +extern char *pg_be_scram_build_secret(const char *password); +extern bool parse_scram_secret(const char *secret, + int *iterations, + pg_cryptohash_type *hash_type, + int *key_length, char **salt, + uint8 *stored_key, uint8 *server_key); +extern bool scram_verify_plain_password(const char *username, + const char *password, const char *secret); + +#endif /* PG_SCRAM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/mb/pg_wchar.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/mb/pg_wchar.h new file mode 100644 index 0000000..9574483 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/mb/pg_wchar.h @@ -0,0 +1,802 @@ +/*------------------------------------------------------------------------- + * + * pg_wchar.h + * multibyte-character support + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/mb/pg_wchar.h + * + * NOTES + * This is used both by the backend and by frontends, but should not be + * included by libpq client programs. In particular, a libpq client + * should not assume that the encoding IDs used by the version of libpq + * it's linked to match up with the IDs declared here. + * To help prevent mistakes, relevant functions that are exported by + * libpq have a physically different name when being referenced + * statically. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_WCHAR_H +#define PG_WCHAR_H + +/* + * The pg_wchar type + */ +typedef unsigned int pg_wchar; + +/* + * Maximum byte length of multibyte characters in any backend encoding + */ +#define MAX_MULTIBYTE_CHAR_LEN 4 + +/* + * various definitions for EUC + */ +#define SS2 0x8e /* single shift 2 (JIS0201) */ +#define SS3 0x8f /* single shift 3 (JIS0212) */ + +/* + * SJIS validation macros + */ +#define ISSJISHEAD(c) (((c) >= 0x81 && (c) <= 0x9f) || ((c) >= 0xe0 && (c) <= 0xfc)) +#define ISSJISTAIL(c) (((c) >= 0x40 && (c) <= 0x7e) || ((c) >= 0x80 && (c) <= 0xfc)) + +/*---------------------------------------------------- + * MULE Internal Encoding (MIC) + * + * This encoding follows the design used within XEmacs; it is meant to + * subsume many externally-defined character sets. Each character includes + * identification of the character set it belongs to, so the encoding is + * general but somewhat bulky. + * + * Currently PostgreSQL supports 5 types of MULE character sets: + * + * 1) 1-byte ASCII characters. Each byte is below 0x80. + * + * 2) "Official" single byte charsets such as ISO-8859-1 (Latin1). + * Each MULE character consists of 2 bytes: LC1 + C1, where LC1 is + * an identifier for the charset (in the range 0x81 to 0x8d) and C1 + * is the character code (in the range 0xa0 to 0xff). + * + * 3) "Private" single byte charsets such as SISHENG. Each MULE + * character consists of 3 bytes: LCPRV1 + LC12 + C1, where LCPRV1 + * is a private-charset flag, LC12 is an identifier for the charset, + * and C1 is the character code (in the range 0xa0 to 0xff). + * LCPRV1 is either 0x9a (if LC12 is in the range 0xa0 to 0xdf) + * or 0x9b (if LC12 is in the range 0xe0 to 0xef). + * + * 4) "Official" multibyte charsets such as JIS X0208. Each MULE + * character consists of 3 bytes: LC2 + C1 + C2, where LC2 is + * an identifier for the charset (in the range 0x90 to 0x99) and C1 + * and C2 form the character code (each in the range 0xa0 to 0xff). + * + * 5) "Private" multibyte charsets such as CNS 11643-1992 Plane 3. + * Each MULE character consists of 4 bytes: LCPRV2 + LC22 + C1 + C2, + * where LCPRV2 is a private-charset flag, LC22 is an identifier for + * the charset, and C1 and C2 form the character code (each in the range + * 0xa0 to 0xff). LCPRV2 is either 0x9c (if LC22 is in the range 0xf0 + * to 0xf4) or 0x9d (if LC22 is in the range 0xf5 to 0xfe). + * + * "Official" encodings are those that have been assigned code numbers by + * the XEmacs project; "private" encodings have Postgres-specific charset + * identifiers. + * + * See the "XEmacs Internals Manual", available at http://www.xemacs.org, + * for more details. Note that for historical reasons, Postgres' + * private-charset flag values do not match what XEmacs says they should be, + * so this isn't really exactly MULE (not that private charsets would be + * interoperable anyway). + * + * Note that XEmacs's implementation is different from what emacs does. + * We follow emacs's implementation, rather than XEmacs's. + *---------------------------------------------------- + */ + +/* + * Charset identifiers (also called "leading bytes" in the MULE documentation) + */ + +/* + * Charset IDs for official single byte encodings (0x81-0x8e) + */ +#define LC_ISO8859_1 0x81 /* ISO8859 Latin 1 */ +#define LC_ISO8859_2 0x82 /* ISO8859 Latin 2 */ +#define LC_ISO8859_3 0x83 /* ISO8859 Latin 3 */ +#define LC_ISO8859_4 0x84 /* ISO8859 Latin 4 */ +#define LC_TIS620 0x85 /* Thai (not supported yet) */ +#define LC_ISO8859_7 0x86 /* Greek (not supported yet) */ +#define LC_ISO8859_6 0x87 /* Arabic (not supported yet) */ +#define LC_ISO8859_8 0x88 /* Hebrew (not supported yet) */ +#define LC_JISX0201K 0x89 /* Japanese 1 byte kana */ +#define LC_JISX0201R 0x8a /* Japanese 1 byte Roman */ +/* Note that 0x8b seems to be unused as of Emacs 20.7. + * However, there might be a chance that 0x8b could be used + * in later versions of Emacs. + */ +#define LC_KOI8_R 0x8b /* Cyrillic KOI8-R */ +#define LC_ISO8859_5 0x8c /* ISO8859 Cyrillic */ +#define LC_ISO8859_9 0x8d /* ISO8859 Latin 5 (not supported yet) */ +#define LC_ISO8859_15 0x8e /* ISO8859 Latin 15 (not supported yet) */ +/* #define CONTROL_1 0x8f control characters (unused) */ + +/* Is a leading byte for "official" single byte encodings? */ +#define IS_LC1(c) ((unsigned char)(c) >= 0x81 && (unsigned char)(c) <= 0x8d) + +/* + * Charset IDs for official multibyte encodings (0x90-0x99) + * 0x9a-0x9d are free. 0x9e and 0x9f are reserved. + */ +#define LC_JISX0208_1978 0x90 /* Japanese Kanji, old JIS (not supported) */ +#define LC_GB2312_80 0x91 /* Chinese */ +#define LC_JISX0208 0x92 /* Japanese Kanji (JIS X 0208) */ +#define LC_KS5601 0x93 /* Korean */ +#define LC_JISX0212 0x94 /* Japanese Kanji (JIS X 0212) */ +#define LC_CNS11643_1 0x95 /* CNS 11643-1992 Plane 1 */ +#define LC_CNS11643_2 0x96 /* CNS 11643-1992 Plane 2 */ +#define LC_JISX0213_1 0x97 /* Japanese Kanji (JIS X 0213 Plane 1) + * (not supported) */ +#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not + * supported) */ +#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not + * supported) */ + +/* Is a leading byte for "official" multibyte encodings? */ +#define IS_LC2(c) ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99) + +/* + * Postgres-specific prefix bytes for "private" single byte encodings + * (According to the MULE docs, we should be using 0x9e for this) + */ +#define LCPRV1_A 0x9a +#define LCPRV1_B 0x9b +#define IS_LCPRV1(c) ((unsigned char)(c) == LCPRV1_A || (unsigned char)(c) == LCPRV1_B) +#define IS_LCPRV1_A_RANGE(c) \ + ((unsigned char)(c) >= 0xa0 && (unsigned char)(c) <= 0xdf) +#define IS_LCPRV1_B_RANGE(c) \ + ((unsigned char)(c) >= 0xe0 && (unsigned char)(c) <= 0xef) + +/* + * Postgres-specific prefix bytes for "private" multibyte encodings + * (According to the MULE docs, we should be using 0x9f for this) + */ +#define LCPRV2_A 0x9c +#define LCPRV2_B 0x9d +#define IS_LCPRV2(c) ((unsigned char)(c) == LCPRV2_A || (unsigned char)(c) == LCPRV2_B) +#define IS_LCPRV2_A_RANGE(c) \ + ((unsigned char)(c) >= 0xf0 && (unsigned char)(c) <= 0xf4) +#define IS_LCPRV2_B_RANGE(c) \ + ((unsigned char)(c) >= 0xf5 && (unsigned char)(c) <= 0xfe) + +/* + * Charset IDs for private single byte encodings (0xa0-0xef) + */ +#define LC_SISHENG 0xa0 /* Chinese SiSheng characters for + * PinYin/ZhuYin (not supported) */ +#define LC_IPA 0xa1 /* IPA (International Phonetic + * Association) (not supported) */ +#define LC_VISCII_LOWER 0xa2 /* Vietnamese VISCII1.1 lower-case (not + * supported) */ +#define LC_VISCII_UPPER 0xa3 /* Vietnamese VISCII1.1 upper-case (not + * supported) */ +#define LC_ARABIC_DIGIT 0xa4 /* Arabic digit (not supported) */ +#define LC_ARABIC_1_COLUMN 0xa5 /* Arabic 1-column (not supported) */ +#define LC_ASCII_RIGHT_TO_LEFT 0xa6 /* ASCII (left half of ISO8859-1) with + * right-to-left direction (not + * supported) */ +#define LC_LAO 0xa7 /* Lao characters (ISO10646 0E80..0EDF) + * (not supported) */ +#define LC_ARABIC_2_COLUMN 0xa8 /* Arabic 1-column (not supported) */ + +/* + * Charset IDs for private multibyte encodings (0xf0-0xff) + */ +#define LC_INDIAN_1_COLUMN 0xf0 /* Indian charset for 1-column width + * glyphs (not supported) */ +#define LC_TIBETAN_1_COLUMN 0xf1 /* Tibetan 1-column width glyphs (not + * supported) */ +#define LC_UNICODE_SUBSET_2 0xf2 /* Unicode characters of the range + * U+2500..U+33FF. (not supported) */ +#define LC_UNICODE_SUBSET_3 0xf3 /* Unicode characters of the range + * U+E000..U+FFFF. (not supported) */ +#define LC_UNICODE_SUBSET 0xf4 /* Unicode characters of the range + * U+0100..U+24FF. (not supported) */ +#define LC_ETHIOPIC 0xf5 /* Ethiopic characters (not supported) */ +#define LC_CNS11643_3 0xf6 /* CNS 11643-1992 Plane 3 */ +#define LC_CNS11643_4 0xf7 /* CNS 11643-1992 Plane 4 */ +#define LC_CNS11643_5 0xf8 /* CNS 11643-1992 Plane 5 */ +#define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */ +#define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */ +#define LC_INDIAN_2_COLUMN 0xfb /* Indian charset for 2-column width + * glyphs (not supported) */ +#define LC_TIBETAN 0xfc /* Tibetan (not supported) */ +/* #define FREE 0xfd free (unused) */ +/* #define FREE 0xfe free (unused) */ +/* #define FREE 0xff free (unused) */ + +/*---------------------------------------------------- + * end of MULE stuff + *---------------------------------------------------- + */ + +/* + * PostgreSQL encoding identifiers + * + * WARNING: If you add some encoding don't forget to update + * the pg_enc2name_tbl[] array (in src/common/encnames.c), + * the pg_enc2gettext_tbl[] array (in src/common/encnames.c) and + * the pg_wchar_table[] array (in src/common/wchar.c) and to check + * PG_ENCODING_BE_LAST macro. + * + * PG_SQL_ASCII is default encoding and must be = 0. + * + * XXX We must avoid renumbering any backend encoding until libpq's major + * version number is increased beyond 5; it turns out that the backend + * encoding IDs are effectively part of libpq's ABI as far as 8.2 initdb and + * psql are concerned. + */ +typedef enum pg_enc +{ + PG_SQL_ASCII = 0, /* SQL/ASCII */ + PG_EUC_JP, /* EUC for Japanese */ + PG_EUC_CN, /* EUC for Chinese */ + PG_EUC_KR, /* EUC for Korean */ + PG_EUC_TW, /* EUC for Taiwan */ + PG_EUC_JIS_2004, /* EUC-JIS-2004 */ + PG_UTF8, /* Unicode UTF8 */ + PG_MULE_INTERNAL, /* Mule internal code */ + PG_LATIN1, /* ISO-8859-1 Latin 1 */ + PG_LATIN2, /* ISO-8859-2 Latin 2 */ + PG_LATIN3, /* ISO-8859-3 Latin 3 */ + PG_LATIN4, /* ISO-8859-4 Latin 4 */ + PG_LATIN5, /* ISO-8859-9 Latin 5 */ + PG_LATIN6, /* ISO-8859-10 Latin6 */ + PG_LATIN7, /* ISO-8859-13 Latin7 */ + PG_LATIN8, /* ISO-8859-14 Latin8 */ + PG_LATIN9, /* ISO-8859-15 Latin9 */ + PG_LATIN10, /* ISO-8859-16 Latin10 */ + PG_WIN1256, /* windows-1256 */ + PG_WIN1258, /* Windows-1258 */ + PG_WIN866, /* (MS-DOS CP866) */ + PG_WIN874, /* windows-874 */ + PG_KOI8R, /* KOI8-R */ + PG_WIN1251, /* windows-1251 */ + PG_WIN1252, /* windows-1252 */ + PG_ISO_8859_5, /* ISO-8859-5 */ + PG_ISO_8859_6, /* ISO-8859-6 */ + PG_ISO_8859_7, /* ISO-8859-7 */ + PG_ISO_8859_8, /* ISO-8859-8 */ + PG_WIN1250, /* windows-1250 */ + PG_WIN1253, /* windows-1253 */ + PG_WIN1254, /* windows-1254 */ + PG_WIN1255, /* windows-1255 */ + PG_WIN1257, /* windows-1257 */ + PG_KOI8U, /* KOI8-U */ + /* PG_ENCODING_BE_LAST points to the above entry */ + + /* followings are for client encoding only */ + PG_SJIS, /* Shift JIS (Windows-932) */ + PG_BIG5, /* Big5 (Windows-950) */ + PG_GBK, /* GBK (Windows-936) */ + PG_UHC, /* UHC (Windows-949) */ + PG_GB18030, /* GB18030 */ + PG_JOHAB, /* EUC for Korean JOHAB */ + PG_SHIFT_JIS_2004, /* Shift-JIS-2004 */ + _PG_LAST_ENCODING_ /* mark only */ + +} pg_enc; + +#define PG_ENCODING_BE_LAST PG_KOI8U + +/* + * Please use these tests before access to pg_enc2name_tbl[] + * or to other places... + */ +#define PG_VALID_BE_ENCODING(_enc) \ + ((_enc) >= 0 && (_enc) <= PG_ENCODING_BE_LAST) + +#define PG_ENCODING_IS_CLIENT_ONLY(_enc) \ + ((_enc) > PG_ENCODING_BE_LAST && (_enc) < _PG_LAST_ENCODING_) + +#define PG_VALID_ENCODING(_enc) \ + ((_enc) >= 0 && (_enc) < _PG_LAST_ENCODING_) + +/* On FE are possible all encodings */ +#define PG_VALID_FE_ENCODING(_enc) PG_VALID_ENCODING(_enc) + +/* + * When converting strings between different encodings, we assume that space + * for converted result is 4-to-1 growth in the worst case. The rate for + * currently supported encoding pairs are within 3 (SJIS JIS X0201 half width + * kana -> UTF8 is the worst case). So "4" should be enough for the moment. + * + * Note that this is not the same as the maximum character width in any + * particular encoding. + */ +#define MAX_CONVERSION_GROWTH 4 + +/* + * Maximum byte length of a string that's required in any encoding to convert + * at least one character to any other encoding. In other words, if you feed + * MAX_CONVERSION_INPUT_LENGTH bytes to any encoding conversion function, it + * is guaranteed to be able to convert something without needing more input + * (assuming the input is valid). + * + * Currently, the maximum case is the conversion UTF8 -> SJIS JIS X0201 half + * width kana, where a pair of UTF-8 characters is converted into a single + * SHIFT_JIS_2004 character (the reverse of the worst case for + * MAX_CONVERSION_GROWTH). It needs 6 bytes of input. In theory, a + * user-defined conversion function might have more complicated cases, although + * for the reverse mapping you would probably also need to bump up + * MAX_CONVERSION_GROWTH. But there is no need to be stingy here, so make it + * generous. + */ +#define MAX_CONVERSION_INPUT_LENGTH 16 + +/* + * Maximum byte length of the string equivalent to any one Unicode code point, + * in any backend encoding. The current value assumes that a 4-byte UTF-8 + * character might expand by MAX_CONVERSION_GROWTH, which is a huge + * overestimate. But in current usage we don't allocate large multiples of + * this, so there's little point in being stingy. + */ +#define MAX_UNICODE_EQUIVALENT_STRING 16 + +/* + * Table for mapping an encoding number to official encoding name and + * possibly other subsidiary data. Be careful to check encoding number + * before accessing a table entry! + * + * if (PG_VALID_ENCODING(encoding)) + * pg_enc2name_tbl[ encoding ]; + */ +typedef struct pg_enc2name +{ + const char *name; + pg_enc encoding; +#ifdef WIN32 + unsigned codepage; /* codepage for WIN32 */ +#endif +} pg_enc2name; + +extern PGDLLIMPORT const pg_enc2name pg_enc2name_tbl[]; + +/* + * Encoding names for gettext + */ +extern PGDLLIMPORT const char *pg_enc2gettext_tbl[]; + +/* + * pg_wchar stuff + */ +typedef int (*mb2wchar_with_len_converter) (const unsigned char *from, + pg_wchar *to, + int len); + +typedef int (*wchar2mb_with_len_converter) (const pg_wchar *from, + unsigned char *to, + int len); + +typedef int (*mblen_converter) (const unsigned char *mbstr); + +typedef int (*mbdisplaylen_converter) (const unsigned char *mbstr); + +typedef bool (*mbcharacter_incrementer) (unsigned char *mbstr, int len); + +typedef int (*mbchar_verifier) (const unsigned char *mbstr, int len); + +typedef int (*mbstr_verifier) (const unsigned char *mbstr, int len); + +typedef struct +{ + mb2wchar_with_len_converter mb2wchar_with_len; /* convert a multibyte + * string to a wchar */ + wchar2mb_with_len_converter wchar2mb_with_len; /* convert a wchar string + * to a multibyte */ + mblen_converter mblen; /* get byte length of a char */ + mbdisplaylen_converter dsplen; /* get display width of a char */ + mbchar_verifier mbverifychar; /* verify multibyte character */ + mbstr_verifier mbverifystr; /* verify multibyte string */ + int maxmblen; /* max bytes for a char in this encoding */ +} pg_wchar_tbl; + +extern PGDLLIMPORT const pg_wchar_tbl pg_wchar_table[]; + +/* + * Data structures for conversions between UTF-8 and other encodings + * (UtfToLocal() and LocalToUtf()). In these data structures, characters of + * either encoding are represented by uint32 words; hence we can only support + * characters up to 4 bytes long. For example, the byte sequence 0xC2 0x89 + * would be represented by 0x0000C289, and 0xE8 0xA2 0xB4 by 0x00E8A2B4. + * + * There are three possible ways a character can be mapped: + * + * 1. Using a radix tree, from source to destination code. + * 2. Using a sorted array of source -> destination code pairs. This + * method is used for "combining" characters. There are so few of + * them that building a radix tree would be wasteful. + * 3. Using a conversion function. + */ + +/* + * Radix tree for character conversion. + * + * Logically, this is actually four different radix trees, for 1-byte, + * 2-byte, 3-byte and 4-byte inputs. The 1-byte tree is a simple lookup + * table from source to target code. The 2-byte tree consists of two levels: + * one lookup table for the first byte, where the value in the lookup table + * points to a lookup table for the second byte. And so on. + * + * Physically, all the trees are stored in one big array, in 'chars16' or + * 'chars32', depending on the maximum value that needs to be represented. For + * each level in each tree, we also store lower and upper bound of allowed + * values - values outside those bounds are considered invalid, and are left + * out of the tables. + * + * In the intermediate levels of the trees, the values stored are offsets + * into the chars[16|32] array. + * + * In the beginning of the chars[16|32] array, there is always a number of + * zeros, so that you safely follow an index from an intermediate table + * without explicitly checking for a zero. Following a zero any number of + * times will always bring you to the dummy, all-zeros table in the + * beginning. This helps to shave some cycles when looking up values. + */ +typedef struct +{ + /* + * Array containing all the values. Only one of chars16 or chars32 is + * used, depending on how wide the values we need to represent are. + */ + const uint16 *chars16; + const uint32 *chars32; + + /* Radix tree for 1-byte inputs */ + uint32 b1root; /* offset of table in the chars[16|32] array */ + uint8 b1_lower; /* min allowed value for a single byte input */ + uint8 b1_upper; /* max allowed value for a single byte input */ + + /* Radix tree for 2-byte inputs */ + uint32 b2root; /* offset of 1st byte's table */ + uint8 b2_1_lower; /* min/max allowed value for 1st input byte */ + uint8 b2_1_upper; + uint8 b2_2_lower; /* min/max allowed value for 2nd input byte */ + uint8 b2_2_upper; + + /* Radix tree for 3-byte inputs */ + uint32 b3root; /* offset of 1st byte's table */ + uint8 b3_1_lower; /* min/max allowed value for 1st input byte */ + uint8 b3_1_upper; + uint8 b3_2_lower; /* min/max allowed value for 2nd input byte */ + uint8 b3_2_upper; + uint8 b3_3_lower; /* min/max allowed value for 3rd input byte */ + uint8 b3_3_upper; + + /* Radix tree for 4-byte inputs */ + uint32 b4root; /* offset of 1st byte's table */ + uint8 b4_1_lower; /* min/max allowed value for 1st input byte */ + uint8 b4_1_upper; + uint8 b4_2_lower; /* min/max allowed value for 2nd input byte */ + uint8 b4_2_upper; + uint8 b4_3_lower; /* min/max allowed value for 3rd input byte */ + uint8 b4_3_upper; + uint8 b4_4_lower; /* min/max allowed value for 4th input byte */ + uint8 b4_4_upper; + +} pg_mb_radix_tree; + +/* + * UTF-8 to local code conversion map (for combined characters) + */ +typedef struct +{ + uint32 utf1; /* UTF-8 code 1 */ + uint32 utf2; /* UTF-8 code 2 */ + uint32 code; /* local code */ +} pg_utf_to_local_combined; + +/* + * local code to UTF-8 conversion map (for combined characters) + */ +typedef struct +{ + uint32 code; /* local code */ + uint32 utf1; /* UTF-8 code 1 */ + uint32 utf2; /* UTF-8 code 2 */ +} pg_local_to_utf_combined; + +/* + * callback function for algorithmic encoding conversions (in either direction) + * + * if function returns zero, it does not know how to convert the code + */ +typedef uint32 (*utf_local_conversion_func) (uint32 code); + +/* + * Support macro for encoding conversion functions to validate their + * arguments. (This could be made more compact if we included fmgr.h + * here, but we don't want to do that because this header file is also + * used by frontends.) + */ +#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding,destencoding) \ + check_encoding_conversion_args(PG_GETARG_INT32(0), \ + PG_GETARG_INT32(1), \ + PG_GETARG_INT32(4), \ + (srcencoding), \ + (destencoding)) + + +/* + * Some handy functions for Unicode-specific tests. + */ +static inline bool +is_valid_unicode_codepoint(pg_wchar c) +{ + return (c > 0 && c <= 0x10FFFF); +} + +static inline bool +is_utf16_surrogate_first(pg_wchar c) +{ + return (c >= 0xD800 && c <= 0xDBFF); +} + +static inline bool +is_utf16_surrogate_second(pg_wchar c) +{ + return (c >= 0xDC00 && c <= 0xDFFF); +} + +static inline pg_wchar +surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second) +{ + return ((first & 0x3FF) << 10) + 0x10000 + (second & 0x3FF); +} + +/* + * Convert a UTF-8 character to a Unicode code point. + * This is a one-character version of pg_utf2wchar_with_len. + * + * No error checks here, c must point to a long-enough string. + */ +static inline pg_wchar +utf8_to_unicode(const unsigned char *c) +{ + if ((*c & 0x80) == 0) + return (pg_wchar) c[0]; + else if ((*c & 0xe0) == 0xc0) + return (pg_wchar) (((c[0] & 0x1f) << 6) | + (c[1] & 0x3f)); + else if ((*c & 0xf0) == 0xe0) + return (pg_wchar) (((c[0] & 0x0f) << 12) | + ((c[1] & 0x3f) << 6) | + (c[2] & 0x3f)); + else if ((*c & 0xf8) == 0xf0) + return (pg_wchar) (((c[0] & 0x07) << 18) | + ((c[1] & 0x3f) << 12) | + ((c[2] & 0x3f) << 6) | + (c[3] & 0x3f)); + else + /* that is an invalid code on purpose */ + return 0xffffffff; +} + +/* + * Map a Unicode code point to UTF-8. utf8string must have at least + * unicode_utf8len(c) bytes available. + */ +static inline unsigned char * +unicode_to_utf8(pg_wchar c, unsigned char *utf8string) +{ + if (c <= 0x7F) + { + utf8string[0] = c; + } + else if (c <= 0x7FF) + { + utf8string[0] = 0xC0 | ((c >> 6) & 0x1F); + utf8string[1] = 0x80 | (c & 0x3F); + } + else if (c <= 0xFFFF) + { + utf8string[0] = 0xE0 | ((c >> 12) & 0x0F); + utf8string[1] = 0x80 | ((c >> 6) & 0x3F); + utf8string[2] = 0x80 | (c & 0x3F); + } + else + { + utf8string[0] = 0xF0 | ((c >> 18) & 0x07); + utf8string[1] = 0x80 | ((c >> 12) & 0x3F); + utf8string[2] = 0x80 | ((c >> 6) & 0x3F); + utf8string[3] = 0x80 | (c & 0x3F); + } + + return utf8string; +} + +/* + * Number of bytes needed to represent the given char in UTF8. + */ +static inline int +unicode_utf8len(pg_wchar c) +{ + if (c <= 0x7F) + return 1; + else if (c <= 0x7FF) + return 2; + else if (c <= 0xFFFF) + return 3; + else + return 4; +} + +/* + * The functions in this list are exported by libpq, and we need to be sure + * that we know which calls are satisfied by libpq and which are satisfied + * by static linkage to libpgcommon. (This is because we might be using a + * libpq.so that's of a different major version and has encoding IDs that + * differ from the current version's.) The nominal function names are what + * are actually used in and exported by libpq, while the names exported by + * libpgcommon.a and libpgcommon_srv.a end in "_private". + */ +#if defined(USE_PRIVATE_ENCODING_FUNCS) || !defined(FRONTEND) +#define pg_char_to_encoding pg_char_to_encoding_private +#define pg_encoding_to_char pg_encoding_to_char_private +#define pg_valid_server_encoding pg_valid_server_encoding_private +#define pg_valid_server_encoding_id pg_valid_server_encoding_id_private +#define pg_utf_mblen pg_utf_mblen_private +#endif + +/* + * These functions are considered part of libpq's exported API and + * are also declared in libpq-fe.h. + */ +extern int pg_char_to_encoding(const char *name); +extern const char *pg_encoding_to_char(int encoding); +extern int pg_valid_server_encoding_id(int encoding); + +/* + * These functions are available to frontend code that links with libpgcommon + * (in addition to the ones just above). The constant tables declared + * earlier in this file are also available from libpgcommon. + */ +extern void pg_encoding_set_invalid(int encoding, char *dst); +extern int pg_encoding_mblen(int encoding, const char *mbstr); +extern int pg_encoding_mblen_or_incomplete(int encoding, const char *mbstr, + size_t remaining); +extern int pg_encoding_mblen_bounded(int encoding, const char *mbstr); +extern int pg_encoding_dsplen(int encoding, const char *mbstr); +extern int pg_encoding_verifymbchar(int encoding, const char *mbstr, int len); +extern int pg_encoding_verifymbstr(int encoding, const char *mbstr, int len); +extern int pg_encoding_max_length(int encoding); +extern int pg_valid_client_encoding(const char *name); +extern int pg_valid_server_encoding(const char *name); +extern bool is_encoding_supported_by_icu(int encoding); +extern const char *get_encoding_name_for_icu(int encoding); + +extern unsigned char *unicode_to_utf8(pg_wchar c, unsigned char *utf8string); +extern pg_wchar utf8_to_unicode(const unsigned char *c); +extern bool pg_utf8_islegal(const unsigned char *source, int length); +extern int pg_utf_mblen(const unsigned char *s); +extern int pg_mule_mblen(const unsigned char *s); + +/* + * The remaining functions are backend-only. + */ +extern int pg_mb2wchar(const char *from, pg_wchar *to); +extern int pg_mb2wchar_with_len(const char *from, pg_wchar *to, int len); +extern int pg_encoding_mb2wchar_with_len(int encoding, + const char *from, pg_wchar *to, int len); +extern int pg_wchar2mb(const pg_wchar *from, char *to); +extern int pg_wchar2mb_with_len(const pg_wchar *from, char *to, int len); +extern int pg_encoding_wchar2mb_with_len(int encoding, + const pg_wchar *from, char *to, int len); +extern int pg_char_and_wchar_strcmp(const char *s1, const pg_wchar *s2); +extern int pg_wchar_strncmp(const pg_wchar *s1, const pg_wchar *s2, size_t n); +extern int pg_char_and_wchar_strncmp(const char *s1, const pg_wchar *s2, size_t n); +extern size_t pg_wchar_strlen(const pg_wchar *str); +extern int pg_mblen_cstr(const char *mbstr); +extern int pg_mblen_range(const char *mbstr, const char *end); +extern int pg_mblen_with_len(const char *mbstr, int limit); +extern int pg_mblen_unbounded(const char *mbstr); + +/* deprecated */ +extern int pg_mblen(const char *mbstr); + +extern int pg_dsplen(const char *mbstr); +extern int pg_mbstrlen(const char *mbstr); +extern int pg_mbstrlen_with_len(const char *mbstr, int limit); +extern int pg_mbcliplen(const char *mbstr, int len, int limit); +extern int pg_encoding_mbcliplen(int encoding, const char *mbstr, + int len, int limit); +extern int pg_mbcharcliplen(const char *mbstr, int len, int limit); +extern int pg_database_encoding_max_length(void); +extern mbcharacter_incrementer pg_database_encoding_character_incrementer(void); + +extern int PrepareClientEncoding(int encoding); +extern int SetClientEncoding(int encoding); +extern void InitializeClientEncoding(void); +extern int pg_get_client_encoding(void); +extern const char *pg_get_client_encoding_name(void); + +extern void SetDatabaseEncoding(int encoding); +extern int GetDatabaseEncoding(void); +extern const char *GetDatabaseEncodingName(void); +extern void SetMessageEncoding(int encoding); +extern int GetMessageEncoding(void); + +#ifdef ENABLE_NLS +extern int pg_bind_textdomain_codeset(const char *domainname); +#endif + +extern unsigned char *pg_do_encoding_conversion(unsigned char *src, int len, + int src_encoding, + int dest_encoding); +extern int pg_do_encoding_conversion_buf(Oid proc, + int src_encoding, + int dest_encoding, + unsigned char *src, int srclen, + unsigned char *dest, int destlen, + bool noError); + +extern char *pg_client_to_server(const char *s, int len); +extern char *pg_server_to_client(const char *s, int len); +extern char *pg_any_to_server(const char *s, int len, int encoding); +extern char *pg_server_to_any(const char *s, int len, int encoding); + +extern void pg_unicode_to_server(pg_wchar c, unsigned char *s); +extern bool pg_unicode_to_server_noerror(pg_wchar c, unsigned char *s); + +extern unsigned short BIG5toCNS(unsigned short big5, unsigned char *lc); +extern unsigned short CNStoBIG5(unsigned short cns, unsigned char lc); + +extern int UtfToLocal(const unsigned char *utf, int len, + unsigned char *iso, + const pg_mb_radix_tree *map, + const pg_utf_to_local_combined *cmap, int cmapsize, + utf_local_conversion_func conv_func, + int encoding, bool noError); +extern int LocalToUtf(const unsigned char *iso, int len, + unsigned char *utf, + const pg_mb_radix_tree *map, + const pg_local_to_utf_combined *cmap, int cmapsize, + utf_local_conversion_func conv_func, + int encoding, bool noError); + +extern bool pg_verifymbstr(const char *mbstr, int len, bool noError); +extern bool pg_verify_mbstr(int encoding, const char *mbstr, int len, + bool noError); +extern int pg_verify_mbstr_len(int encoding, const char *mbstr, int len, + bool noError); + +extern void check_encoding_conversion_args(int src_encoding, + int dest_encoding, + int len, + int expected_src_encoding, + int expected_dest_encoding); + +pg_noreturn extern void report_invalid_encoding(int encoding, const char *mbstr, int len); +pg_noreturn extern void report_untranslatable_char(int src_encoding, int dest_encoding, + const char *mbstr, int len); + +extern int local2local(const unsigned char *l, unsigned char *p, int len, + int src_encoding, int dest_encoding, + const unsigned char *tab, bool noError); +extern int latin2mic(const unsigned char *l, unsigned char *p, int len, + int lc, int encoding, bool noError); +extern int mic2latin(const unsigned char *mic, unsigned char *p, int len, + int lc, int encoding, bool noError); +extern int latin2mic_with_table(const unsigned char *l, unsigned char *p, + int len, int lc, int encoding, + const unsigned char *tab, bool noError); +extern int mic2latin_with_table(const unsigned char *mic, unsigned char *p, + int len, int lc, int encoding, + const unsigned char *tab, bool noError); + +#ifdef WIN32 +extern WCHAR *pgwin32_message_to_UTF16(const char *str, int len, int *utf16len); +#endif + +#endif /* PG_WCHAR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/mb/stringinfo_mb.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/mb/stringinfo_mb.h new file mode 100644 index 0000000..f682e7b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/mb/stringinfo_mb.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * stringinfo_mb.h + * multibyte support for StringInfo + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/mb/stringinfo_mb.h + *------------------------------------------------------------------------- + */ +#ifndef STRINGINFO_MB_H +#define STRINGINFO_MB_H + + +#include "lib/stringinfo.h" + +/* + * Multibyte-aware StringInfo support function. + */ +extern void appendStringInfoStringQuoted(StringInfo str, + const char *s, int maxlen); + +#endif /* STRINGINFO_MB_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/miscadmin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/miscadmin.h new file mode 100644 index 0000000..9a7d733 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/miscadmin.h @@ -0,0 +1,543 @@ +/*------------------------------------------------------------------------- + * + * miscadmin.h + * This file contains general postgres administration and initialization + * stuff that used to be spread out between the following files: + * globals.h global variables + * pdir.h directory path crud + * pinit.h postgres initialization + * pmod.h processing modes + * Over time, this has also become the preferred place for widely known + * resource-limitation stuff, such as work_mem and check_stack_depth(). + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/miscadmin.h + * + * NOTES + * some of the information in this file should be moved to other files. + * + *------------------------------------------------------------------------- + */ +#ifndef MISCADMIN_H +#define MISCADMIN_H + +#include + +#include "datatype/timestamp.h" /* for TimestampTz */ +#include "pgtime.h" /* for pg_time_t */ + + +#define InvalidPid (-1) + + +/***************************************************************************** + * System interrupt and critical section handling + * + * There are two types of interrupts that a running backend needs to accept + * without messing up its state: QueryCancel (SIGINT) and ProcDie (SIGTERM). + * In both cases, we need to be able to clean up the current transaction + * gracefully, so we can't respond to the interrupt instantaneously --- + * there's no guarantee that internal data structures would be self-consistent + * if the code is interrupted at an arbitrary instant. Instead, the signal + * handlers set flags that are checked periodically during execution. + * + * The CHECK_FOR_INTERRUPTS() macro is called at strategically located spots + * where it is normally safe to accept a cancel or die interrupt. In some + * cases, we invoke CHECK_FOR_INTERRUPTS() inside low-level subroutines that + * might sometimes be called in contexts that do *not* want to allow a cancel + * or die interrupt. The HOLD_INTERRUPTS() and RESUME_INTERRUPTS() macros + * allow code to ensure that no cancel or die interrupt will be accepted, + * even if CHECK_FOR_INTERRUPTS() gets called in a subroutine. The interrupt + * will be held off until CHECK_FOR_INTERRUPTS() is done outside any + * HOLD_INTERRUPTS() ... RESUME_INTERRUPTS() section. + * + * There is also a mechanism to prevent query cancel interrupts, while still + * allowing die interrupts: HOLD_CANCEL_INTERRUPTS() and + * RESUME_CANCEL_INTERRUPTS(). + * + * Note that ProcessInterrupts() has also acquired a number of tasks that + * do not necessarily cause a query-cancel-or-die response. Hence, it's + * possible that it will just clear InterruptPending and return. + * + * INTERRUPTS_PENDING_CONDITION() can be checked to see whether an + * interrupt needs to be serviced, without trying to do so immediately. + * Some callers are also interested in INTERRUPTS_CAN_BE_PROCESSED(), + * which tells whether ProcessInterrupts is sure to clear the interrupt. + * + * Special mechanisms are used to let an interrupt be accepted when we are + * waiting for a lock or when we are waiting for command input (but, of + * course, only if the interrupt holdoff counter is zero). See the + * related code for details. + * + * A lost connection is handled similarly, although the loss of connection + * does not raise a signal, but is detected when we fail to write to the + * socket. If there was a signal for a broken connection, we could make use of + * it by setting ClientConnectionLost in the signal handler. + * + * A related, but conceptually distinct, mechanism is the "critical section" + * mechanism. A critical section not only holds off cancel/die interrupts, + * but causes any ereport(ERROR) or ereport(FATAL) to become ereport(PANIC) + * --- that is, a system-wide reset is forced. Needless to say, only really + * *critical* code should be marked as a critical section! Currently, this + * mechanism is only used for XLOG-related code. + * + *****************************************************************************/ + +/* in globals.c */ +/* these are marked volatile because they are set by signal handlers: */ +extern PGDLLIMPORT volatile sig_atomic_t InterruptPending; +extern PGDLLIMPORT volatile sig_atomic_t QueryCancelPending; +extern PGDLLIMPORT volatile sig_atomic_t ProcDiePending; +extern PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending; +extern PGDLLIMPORT volatile sig_atomic_t TransactionTimeoutPending; +extern PGDLLIMPORT volatile sig_atomic_t IdleSessionTimeoutPending; +extern PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending; +extern PGDLLIMPORT volatile sig_atomic_t LogMemoryContextPending; +extern PGDLLIMPORT volatile sig_atomic_t IdleStatsUpdateTimeoutPending; + +extern PGDLLIMPORT volatile sig_atomic_t CheckClientConnectionPending; +extern PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost; + +/* these are marked volatile because they are examined by signal handlers: */ +extern PGDLLIMPORT volatile uint32 InterruptHoldoffCount; +extern PGDLLIMPORT volatile uint32 QueryCancelHoldoffCount; +extern PGDLLIMPORT volatile uint32 CritSectionCount; + +/* in tcop/postgres.c */ +extern void ProcessInterrupts(void); + +/* Test whether an interrupt is pending */ +#ifndef WIN32 +#define INTERRUPTS_PENDING_CONDITION() \ + (unlikely(InterruptPending)) +#else +#define INTERRUPTS_PENDING_CONDITION() \ + (unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? \ + pgwin32_dispatch_queued_signals() : (void) 0, \ + unlikely(InterruptPending)) +#endif + +/* Service interrupt, if one is pending and it's safe to service it now */ +#define CHECK_FOR_INTERRUPTS() \ +do { \ + if (INTERRUPTS_PENDING_CONDITION()) \ + ProcessInterrupts(); \ +} while(0) + +/* Is ProcessInterrupts() guaranteed to clear InterruptPending? */ +#define INTERRUPTS_CAN_BE_PROCESSED() \ + (InterruptHoldoffCount == 0 && CritSectionCount == 0 && \ + QueryCancelHoldoffCount == 0) + +#define HOLD_INTERRUPTS() (InterruptHoldoffCount++) + +#define RESUME_INTERRUPTS() \ +do { \ + Assert(InterruptHoldoffCount > 0); \ + InterruptHoldoffCount--; \ +} while(0) + +#define HOLD_CANCEL_INTERRUPTS() (QueryCancelHoldoffCount++) + +#define RESUME_CANCEL_INTERRUPTS() \ +do { \ + Assert(QueryCancelHoldoffCount > 0); \ + QueryCancelHoldoffCount--; \ +} while(0) + +#define START_CRIT_SECTION() (CritSectionCount++) + +#define END_CRIT_SECTION() \ +do { \ + Assert(CritSectionCount > 0); \ + CritSectionCount--; \ +} while(0) + + +/***************************************************************************** + * globals.h -- * + *****************************************************************************/ + +/* + * from utils/init/globals.c + */ +extern PGDLLIMPORT pid_t PostmasterPid; +extern PGDLLIMPORT bool IsPostmasterEnvironment; +extern PGDLLIMPORT bool IsUnderPostmaster; +extern PGDLLIMPORT bool IsBinaryUpgrade; + +extern PGDLLIMPORT bool ExitOnAnyError; + +extern PGDLLIMPORT char *DataDir; +extern PGDLLIMPORT int data_directory_mode; + +extern PGDLLIMPORT int NBuffers; +extern PGDLLIMPORT int MaxBackends; +extern PGDLLIMPORT int MaxConnections; +extern PGDLLIMPORT int max_worker_processes; +extern PGDLLIMPORT int max_parallel_workers; + +extern PGDLLIMPORT int commit_timestamp_buffers; +extern PGDLLIMPORT int multixact_member_buffers; +extern PGDLLIMPORT int multixact_offset_buffers; +extern PGDLLIMPORT int notify_buffers; +extern PGDLLIMPORT int serializable_buffers; +extern PGDLLIMPORT int subtransaction_buffers; +extern PGDLLIMPORT int transaction_buffers; + +extern PGDLLIMPORT int MyProcPid; +extern PGDLLIMPORT pg_time_t MyStartTime; +extern PGDLLIMPORT TimestampTz MyStartTimestamp; +extern PGDLLIMPORT struct Port *MyProcPort; +extern PGDLLIMPORT struct Latch *MyLatch; +extern PGDLLIMPORT uint8 MyCancelKey[]; +extern PGDLLIMPORT int MyCancelKeyLength; +extern PGDLLIMPORT int MyPMChildSlot; + +extern PGDLLIMPORT char OutputFileName[]; +extern PGDLLIMPORT char my_exec_path[]; +extern PGDLLIMPORT char pkglib_path[]; + +#ifdef EXEC_BACKEND +extern PGDLLIMPORT char postgres_exec_path[]; +#endif + +extern PGDLLIMPORT Oid MyDatabaseId; + +extern PGDLLIMPORT Oid MyDatabaseTableSpace; + +extern PGDLLIMPORT bool MyDatabaseHasLoginEventTriggers; + +/* + * Date/Time Configuration + * + * DateStyle defines the output formatting choice for date/time types: + * USE_POSTGRES_DATES specifies traditional Postgres format + * USE_ISO_DATES specifies ISO-compliant format + * USE_SQL_DATES specifies Oracle/Ingres-compliant format + * USE_GERMAN_DATES specifies German-style dd.mm/yyyy + * + * DateOrder defines the field order to be assumed when reading an + * ambiguous date (anything not in YYYY-MM-DD format, with a four-digit + * year field first, is taken to be ambiguous): + * DATEORDER_YMD specifies field order yy-mm-dd + * DATEORDER_DMY specifies field order dd-mm-yy ("European" convention) + * DATEORDER_MDY specifies field order mm-dd-yy ("US" convention) + * + * In the Postgres and SQL DateStyles, DateOrder also selects output field + * order: day comes before month in DMY style, else month comes before day. + * + * The user-visible "DateStyle" run-time parameter subsumes both of these. + */ + +/* valid DateStyle values */ +#define USE_POSTGRES_DATES 0 +#define USE_ISO_DATES 1 +#define USE_SQL_DATES 2 +#define USE_GERMAN_DATES 3 +#define USE_XSD_DATES 4 + +/* valid DateOrder values */ +#define DATEORDER_YMD 0 +#define DATEORDER_DMY 1 +#define DATEORDER_MDY 2 + +extern PGDLLIMPORT int DateStyle; +extern PGDLLIMPORT int DateOrder; + +/* + * IntervalStyles + * INTSTYLE_POSTGRES Like Postgres < 8.4 when DateStyle = 'iso' + * INTSTYLE_POSTGRES_VERBOSE Like Postgres < 8.4 when DateStyle != 'iso' + * INTSTYLE_SQL_STANDARD SQL standard interval literals + * INTSTYLE_ISO_8601 ISO-8601-basic formatted intervals + */ +#define INTSTYLE_POSTGRES 0 +#define INTSTYLE_POSTGRES_VERBOSE 1 +#define INTSTYLE_SQL_STANDARD 2 +#define INTSTYLE_ISO_8601 3 + +extern PGDLLIMPORT int IntervalStyle; + +#define MAXTZLEN 10 /* max TZ name len, not counting tr. null */ + +extern PGDLLIMPORT bool enableFsync; +extern PGDLLIMPORT bool allowSystemTableMods; +extern PGDLLIMPORT int work_mem; +extern PGDLLIMPORT double hash_mem_multiplier; +extern PGDLLIMPORT int maintenance_work_mem; +extern PGDLLIMPORT int max_parallel_maintenance_workers; + +/* + * Upper and lower hard limits for the buffer access strategy ring size + * specified by the VacuumBufferUsageLimit GUC and BUFFER_USAGE_LIMIT option + * to VACUUM and ANALYZE. + */ +#define MIN_BAS_VAC_RING_SIZE_KB 128 +#define MAX_BAS_VAC_RING_SIZE_KB (16 * 1024 * 1024) + +extern PGDLLIMPORT int VacuumBufferUsageLimit; +extern PGDLLIMPORT int VacuumCostPageHit; +extern PGDLLIMPORT int VacuumCostPageMiss; +extern PGDLLIMPORT int VacuumCostPageDirty; +extern PGDLLIMPORT int VacuumCostLimit; +extern PGDLLIMPORT double VacuumCostDelay; + +extern PGDLLIMPORT int VacuumCostBalance; +extern PGDLLIMPORT bool VacuumCostActive; + + +/* in utils/misc/stack_depth.c */ + +extern PGDLLIMPORT int max_stack_depth; + +/* Required daylight between max_stack_depth and the kernel limit, in bytes */ +#define STACK_DEPTH_SLOP (512 * 1024) + +typedef char *pg_stack_base_t; + +extern pg_stack_base_t set_stack_base(void); +extern void restore_stack_base(pg_stack_base_t base); +extern void check_stack_depth(void); +extern bool stack_is_too_deep(void); +extern ssize_t get_stack_depth_rlimit(void); + +/* in tcop/utility.c */ +extern void PreventCommandIfReadOnly(const char *cmdname); +extern void PreventCommandIfParallelMode(const char *cmdname); +extern void PreventCommandDuringRecovery(const char *cmdname); + +/***************************************************************************** + * pdir.h -- * + * POSTGRES directory path definitions. * + *****************************************************************************/ + +/* flags to be OR'd to form sec_context */ +#define SECURITY_LOCAL_USERID_CHANGE 0x0001 +#define SECURITY_RESTRICTED_OPERATION 0x0002 +#define SECURITY_NOFORCE_RLS 0x0004 + +extern PGDLLIMPORT char *DatabasePath; + +/* now in utils/init/miscinit.c */ +extern void InitPostmasterChild(void); +extern void InitStandaloneProcess(const char *argv0); +extern void InitProcessLocalLatch(void); +extern void SwitchToSharedLatch(void); +extern void SwitchBackToLocalLatch(void); + +/* + * MyBackendType indicates what kind of a backend this is. + * + * If you add entries, please also update the child_process_kinds array in + * launch_backend.c. + */ +typedef enum BackendType +{ + B_INVALID = 0, + + /* Backends and other backend-like processes */ + B_BACKEND, + B_DEAD_END_BACKEND, + B_AUTOVAC_LAUNCHER, + B_AUTOVAC_WORKER, + B_BG_WORKER, + B_WAL_SENDER, + B_SLOTSYNC_WORKER, + + B_STANDALONE_BACKEND, + + /* + * Auxiliary processes. These have PGPROC entries, but they are not + * attached to any particular database, and cannot run transactions or + * even take heavyweight locks. There can be only one of each of these + * running at a time, except for IO workers. + * + * If you modify these, make sure to update NUM_AUXILIARY_PROCS and the + * glossary in the docs. + */ + B_ARCHIVER, + B_BG_WRITER, + B_CHECKPOINTER, + B_IO_WORKER, + B_STARTUP, + B_WAL_RECEIVER, + B_WAL_SUMMARIZER, + B_WAL_WRITER, + + /* + * Logger is not connected to shared memory and does not have a PGPROC + * entry. + */ + B_LOGGER, +} BackendType; + +#define BACKEND_NUM_TYPES (B_LOGGER + 1) + +extern PGDLLIMPORT BackendType MyBackendType; + +#define AmRegularBackendProcess() (MyBackendType == B_BACKEND) +#define AmAutoVacuumLauncherProcess() (MyBackendType == B_AUTOVAC_LAUNCHER) +#define AmAutoVacuumWorkerProcess() (MyBackendType == B_AUTOVAC_WORKER) +#define AmBackgroundWorkerProcess() (MyBackendType == B_BG_WORKER) +#define AmWalSenderProcess() (MyBackendType == B_WAL_SENDER) +#define AmLogicalSlotSyncWorkerProcess() (MyBackendType == B_SLOTSYNC_WORKER) +#define AmArchiverProcess() (MyBackendType == B_ARCHIVER) +#define AmBackgroundWriterProcess() (MyBackendType == B_BG_WRITER) +#define AmCheckpointerProcess() (MyBackendType == B_CHECKPOINTER) +#define AmStartupProcess() (MyBackendType == B_STARTUP) +#define AmWalReceiverProcess() (MyBackendType == B_WAL_RECEIVER) +#define AmWalSummarizerProcess() (MyBackendType == B_WAL_SUMMARIZER) +#define AmWalWriterProcess() (MyBackendType == B_WAL_WRITER) +#define AmIoWorkerProcess() (MyBackendType == B_IO_WORKER) + +#define AmSpecialWorkerProcess() \ + (AmAutoVacuumLauncherProcess() || \ + AmLogicalSlotSyncWorkerProcess()) + +/* + * Backend types that are spawned by the postmaster to serve a client or + * replication connection. These backend types have in common that they are + * externally initiated. + */ +#define IsExternalConnectionBackend(backend_type) \ + (backend_type == B_BACKEND || backend_type == B_WAL_SENDER) + +extern const char *GetBackendTypeDesc(BackendType backendType); + +extern void SetDatabasePath(const char *path); +extern void checkDataDir(void); +extern void SetDataDir(const char *dir); +extern void ChangeToDataDir(void); + +extern char *GetUserNameFromId(Oid roleid, bool noerr); +extern Oid GetUserId(void); +extern Oid GetOuterUserId(void); +extern Oid GetSessionUserId(void); +extern bool GetSessionUserIsSuperuser(void); +extern Oid GetAuthenticatedUserId(void); +extern void SetAuthenticatedUserId(Oid userid); +extern void GetUserIdAndSecContext(Oid *userid, int *sec_context); +extern void SetUserIdAndSecContext(Oid userid, int sec_context); +extern bool InLocalUserIdChange(void); +extern bool InSecurityRestrictedOperation(void); +extern bool InNoForceRLSOperation(void); +extern void GetUserIdAndContext(Oid *userid, bool *sec_def_context); +extern void SetUserIdAndContext(Oid userid, bool sec_def_context); +extern void InitializeSessionUserId(const char *rolename, Oid roleid, + bool bypass_login_check); +extern void InitializeSessionUserIdStandalone(void); +extern void SetSessionAuthorization(Oid userid, bool is_superuser); +extern Oid GetCurrentRoleId(void); +extern void SetCurrentRoleId(Oid roleid, bool is_superuser); +extern void InitializeSystemUser(const char *authn_id, + const char *auth_method); +extern const char *GetSystemUser(void); + +/* in utils/misc/superuser.c */ +extern bool superuser(void); /* current user is superuser */ +extern bool superuser_arg(Oid roleid); /* given user is superuser */ + + +/***************************************************************************** + * pmod.h -- * + * POSTGRES processing mode definitions. * + *****************************************************************************/ + +/* + * Description: + * There are three processing modes in POSTGRES. They are + * BootstrapProcessing or "bootstrap," InitProcessing or + * "initialization," and NormalProcessing or "normal." + * + * The first two processing modes are used during special times. When the + * system state indicates bootstrap processing, transactions are all given + * transaction id "one" and are consequently guaranteed to commit. This mode + * is used during the initial generation of template databases. + * + * Initialization mode: used while starting a backend, until all normal + * initialization is complete. Some code behaves differently when executed + * in this mode to enable system bootstrapping. + * + * If a POSTGRES backend process is in normal mode, then all code may be + * executed normally. + */ + +typedef enum ProcessingMode +{ + BootstrapProcessing, /* bootstrap creation of template database */ + InitProcessing, /* initializing system */ + NormalProcessing, /* normal processing */ +} ProcessingMode; + +extern PGDLLIMPORT ProcessingMode Mode; + +#define IsBootstrapProcessingMode() (Mode == BootstrapProcessing) +#define IsInitProcessingMode() (Mode == InitProcessing) +#define IsNormalProcessingMode() (Mode == NormalProcessing) + +#define GetProcessingMode() Mode + +#define SetProcessingMode(mode) \ + do { \ + Assert((mode) == BootstrapProcessing || \ + (mode) == InitProcessing || \ + (mode) == NormalProcessing); \ + Mode = (mode); \ + } while(0) + + +/***************************************************************************** + * pinit.h -- * + * POSTGRES initialization and cleanup definitions. * + *****************************************************************************/ + +/* in utils/init/postinit.c */ +/* flags for InitPostgres() */ +#define INIT_PG_LOAD_SESSION_LIBS 0x0001 +#define INIT_PG_OVERRIDE_ALLOW_CONNS 0x0002 +#define INIT_PG_OVERRIDE_ROLE_LOGIN 0x0004 +extern void pg_split_opts(char **argv, int *argcp, const char *optstr); +extern void InitializeMaxBackends(void); +extern void InitializeFastPathLocks(void); +extern void InitPostgres(const char *in_dbname, Oid dboid, + const char *username, Oid useroid, + bits32 flags, + char *out_dbname); +extern void BaseInit(void); + +/* in utils/init/miscinit.c */ +extern PGDLLIMPORT bool IgnoreSystemIndexes; +extern PGDLLIMPORT bool process_shared_preload_libraries_in_progress; +extern PGDLLIMPORT bool process_shared_preload_libraries_done; +extern PGDLLIMPORT bool process_shmem_requests_in_progress; +extern PGDLLIMPORT char *session_preload_libraries_string; +extern PGDLLIMPORT char *shared_preload_libraries_string; +extern PGDLLIMPORT char *local_preload_libraries_string; + +extern void CreateDataDirLockFile(bool amPostmaster); +extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster, + const char *socketDir); +extern void TouchSocketLockFiles(void); +extern void AddToDataDirLockFile(int target_line, const char *str); +extern bool RecheckDataDirLockFile(void); +extern void ValidatePgVersion(const char *path); +extern void process_shared_preload_libraries(void); +extern void process_session_preload_libraries(void); +extern void process_shmem_requests(void); +extern void pg_bindtextdomain(const char *domain); +extern bool has_rolreplication(Oid roleid); + +typedef void (*shmem_request_hook_type) (void); +extern PGDLLIMPORT shmem_request_hook_type shmem_request_hook; + +extern Size EstimateClientConnectionInfoSpace(void); +extern void SerializeClientConnectionInfo(Size maxsize, char *start_address); +extern void RestoreClientConnectionInfo(char *conninfo); + +/* in executor/nodeHash.c */ +extern size_t get_hash_memory_limit(void); + +#endif /* MISCADMIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/bitmapset.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/bitmapset.h new file mode 100644 index 0000000..03faca9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/bitmapset.h @@ -0,0 +1,140 @@ +/*------------------------------------------------------------------------- + * + * bitmapset.h + * PostgreSQL generic bitmap set package + * + * A bitmap set can represent any set of nonnegative integers, although + * it is mainly intended for sets where the maximum value is not large, + * say at most a few hundred. By convention, we always represent the + * empty set by a NULL pointer. + * + * + * Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/nodes/bitmapset.h + * + *------------------------------------------------------------------------- + */ +#ifndef BITMAPSET_H +#define BITMAPSET_H + +#include "nodes/nodes.h" + +/* + * Forward decl to save including pg_list.h + */ +struct List; + +/* + * Data representation + * + * Larger bitmap word sizes generally give better performance, so long as + * they're not wider than the processor can handle efficiently. We use + * 64-bit words if pointers are that large, else 32-bit words. + */ +#if SIZEOF_VOID_P >= 8 + +#define BITS_PER_BITMAPWORD 64 +typedef uint64 bitmapword; /* must be an unsigned type */ +typedef int64 signedbitmapword; /* must be the matching signed type */ + +#else + +#define BITS_PER_BITMAPWORD 32 +typedef uint32 bitmapword; /* must be an unsigned type */ +typedef int32 signedbitmapword; /* must be the matching signed type */ + +#endif + +typedef struct Bitmapset +{ + pg_node_attr(custom_copy_equal, special_read_write, no_query_jumble) + + NodeTag type; + int nwords; /* number of words in array */ + bitmapword words[FLEXIBLE_ARRAY_MEMBER]; /* really [nwords] */ +} Bitmapset; + + +/* result of bms_subset_compare */ +typedef enum +{ + BMS_EQUAL, /* sets are equal */ + BMS_SUBSET1, /* first set is a subset of the second */ + BMS_SUBSET2, /* second set is a subset of the first */ + BMS_DIFFERENT, /* neither set is a subset of the other */ +} BMS_Comparison; + +/* result of bms_membership */ +typedef enum +{ + BMS_EMPTY_SET, /* 0 members */ + BMS_SINGLETON, /* 1 member */ + BMS_MULTIPLE, /* >1 member */ +} BMS_Membership; + +/* Select appropriate bit-twiddling functions for bitmap word size */ +#if BITS_PER_BITMAPWORD == 32 +#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos32(w) +#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos32(w) +#define bmw_popcount(w) pg_popcount32(w) +#elif BITS_PER_BITMAPWORD == 64 +#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos64(w) +#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos64(w) +#define bmw_popcount(w) pg_popcount64(w) +#else +#error "invalid BITS_PER_BITMAPWORD" +#endif + + +/* + * function prototypes in nodes/bitmapset.c + */ + +extern Bitmapset *bms_copy(const Bitmapset *a); +extern bool bms_equal(const Bitmapset *a, const Bitmapset *b); +extern int bms_compare(const Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_make_singleton(int x); +extern void bms_free(Bitmapset *a); + +extern Bitmapset *bms_union(const Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_intersect(const Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_difference(const Bitmapset *a, const Bitmapset *b); +extern bool bms_is_subset(const Bitmapset *a, const Bitmapset *b); +extern BMS_Comparison bms_subset_compare(const Bitmapset *a, const Bitmapset *b); +extern bool bms_is_member(int x, const Bitmapset *a); +extern int bms_member_index(Bitmapset *a, int x); +extern bool bms_overlap(const Bitmapset *a, const Bitmapset *b); +extern bool bms_overlap_list(const Bitmapset *a, const struct List *b); +extern bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b); +extern int bms_singleton_member(const Bitmapset *a); +extern bool bms_get_singleton_member(const Bitmapset *a, int *member); +extern int bms_num_members(const Bitmapset *a); + +/* optimized tests when we don't need to know exact membership count: */ +extern BMS_Membership bms_membership(const Bitmapset *a); + +/* NULL is now the only allowed representation of an empty bitmapset */ +#define bms_is_empty(a) ((a) == NULL) + +/* these routines recycle (modify or free) their non-const inputs: */ + +extern Bitmapset *bms_add_member(Bitmapset *a, int x); +extern Bitmapset *bms_del_member(Bitmapset *a, int x); +extern Bitmapset *bms_add_members(Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_replace_members(Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_add_range(Bitmapset *a, int lower, int upper); +extern Bitmapset *bms_int_members(Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_del_members(Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_join(Bitmapset *a, Bitmapset *b); + +/* support for iterating through the integer elements of a set: */ +extern int bms_next_member(const Bitmapset *a, int prevbit); +extern int bms_prev_member(const Bitmapset *a, int prevbit); + +/* support for hashtables using Bitmapsets as keys: */ +extern uint32 bms_hash_value(const Bitmapset *a); +extern uint32 bitmap_hash(const void *key, Size keysize); +extern int bitmap_match(const void *key1, const void *key2, Size keysize); + +#endif /* BITMAPSET_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/execnodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/execnodes.h new file mode 100644 index 0000000..409e172 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/execnodes.h @@ -0,0 +1,2924 @@ +/*------------------------------------------------------------------------- + * + * execnodes.h + * definitions for executor state nodes + * + * Most plan node types declared in plannodes.h have a corresponding + * execution-state node type declared here. An exception is that + * expression nodes (subtypes of Expr) are usually represented by steps + * of an ExprState, and fully handled within execExpr* - but sometimes + * their state needs to be shared with other parts of the executor, as + * for example with SubPlanState, which nodeSubplan.c has to modify. + * + * Node types declared in this file do not have any copy/equal/out/read + * support. (That is currently hard-wired in gen_node_support.pl, rather + * than being explicitly represented by pg_node_attr decorations here.) + * There is no need for copy, equal, or read support for executor trees. + * Output support could be useful for debugging; but there are a lot of + * specialized fields that would require custom code, so for now it's + * not provided. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/execnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXECNODES_H +#define EXECNODES_H + +#include "access/tupconvert.h" +#include "executor/instrument.h" +#include "fmgr.h" +#include "lib/ilist.h" +#include "lib/pairingheap.h" +#include "nodes/miscnodes.h" +#include "nodes/params.h" +#include "nodes/plannodes.h" +#include "nodes/tidbitmap.h" +#include "partitioning/partdefs.h" +#include "storage/condition_variable.h" +#include "utils/hsearch.h" +#include "utils/queryenvironment.h" +#include "utils/reltrigger.h" +#include "utils/sharedtuplestore.h" +#include "utils/snapshot.h" +#include "utils/sortsupport.h" +#include "utils/tuplesort.h" +#include "utils/tuplestore.h" + +struct PlanState; /* forward references in this file */ +struct ParallelHashJoinState; +struct ExecRowMark; +struct ExprState; +struct ExprContext; +struct RangeTblEntry; /* avoid including parsenodes.h here */ +struct ExprEvalStep; /* avoid including execExpr.h everywhere */ +struct CopyMultiInsertBuffer; +struct LogicalTapeSet; + + +/* ---------------- + * ExprState node + * + * ExprState represents the evaluation state for a whole expression tree. + * It contains instructions (in ->steps) to evaluate the expression. + * ---------------- + */ +typedef Datum (*ExprStateEvalFunc) (struct ExprState *expression, + struct ExprContext *econtext, + bool *isNull); + +/* Bits in ExprState->flags (see also execExpr.h for private flag bits): */ +/* expression is for use with ExecQual() */ +#define EEO_FLAG_IS_QUAL (1 << 0) +/* expression refers to OLD table columns */ +#define EEO_FLAG_HAS_OLD (1 << 1) +/* expression refers to NEW table columns */ +#define EEO_FLAG_HAS_NEW (1 << 2) +/* OLD table row is NULL in RETURNING list */ +#define EEO_FLAG_OLD_IS_NULL (1 << 3) +/* NEW table row is NULL in RETURNING list */ +#define EEO_FLAG_NEW_IS_NULL (1 << 4) + +typedef struct ExprState +{ + NodeTag type; + +#define FIELDNO_EXPRSTATE_FLAGS 1 + uint8 flags; /* bitmask of EEO_FLAG_* bits, see above */ + + /* + * Storage for result value of a scalar expression, or for individual + * column results within expressions built by ExecBuildProjectionInfo(). + */ +#define FIELDNO_EXPRSTATE_RESNULL 2 + bool resnull; +#define FIELDNO_EXPRSTATE_RESVALUE 3 + Datum resvalue; + + /* + * If projecting a tuple result, this slot holds the result; else NULL. + */ +#define FIELDNO_EXPRSTATE_RESULTSLOT 4 + TupleTableSlot *resultslot; + + /* + * Instructions to compute expression's return value. + */ + struct ExprEvalStep *steps; + + /* + * Function that actually evaluates the expression. This can be set to + * different values depending on the complexity of the expression. + */ + ExprStateEvalFunc evalfunc; + + /* original expression tree, for debugging only */ + Expr *expr; + + /* private state for an evalfunc */ + void *evalfunc_private; + + /* + * XXX: following fields only needed during "compilation" (ExecInitExpr); + * could be thrown away afterwards. + */ + + int steps_len; /* number of steps currently */ + int steps_alloc; /* allocated length of steps array */ + +#define FIELDNO_EXPRSTATE_PARENT 11 + struct PlanState *parent; /* parent PlanState node, if any */ + ParamListInfo ext_params; /* for compiling PARAM_EXTERN nodes */ + + Datum *innermost_caseval; + bool *innermost_casenull; + + Datum *innermost_domainval; + bool *innermost_domainnull; + + /* + * For expression nodes that support soft errors. Should be set to NULL if + * the caller wants errors to be thrown. Callers that do not want errors + * thrown should set it to a valid ErrorSaveContext before calling + * ExecInitExprRec(). + */ + ErrorSaveContext *escontext; +} ExprState; + + +/* ---------------- + * IndexInfo information + * + * this struct holds the information needed to construct new index + * entries for a particular index. Used for both index_build and + * retail creation of index entries. + * + * NumIndexAttrs total number of columns in this index + * NumIndexKeyAttrs number of key columns in index + * IndexAttrNumbers underlying-rel attribute numbers used as keys + * (zeroes indicate expressions). It also contains + * info about included columns. + * Expressions expr trees for expression entries, or NIL if none + * ExpressionsState exec state for expressions, or NIL if none + * Predicate partial-index predicate, or NIL if none + * PredicateState exec state for predicate, or NIL if none + * ExclusionOps Per-column exclusion operators, or NULL if none + * ExclusionProcs Underlying function OIDs for ExclusionOps + * ExclusionStrats Opclass strategy numbers for ExclusionOps + * UniqueOps These are like Exclusion*, but for unique indexes + * UniqueProcs + * UniqueStrats + * Unique is it a unique index? + * NullsNotDistinct is NULLS NOT DISTINCT? + * ReadyForInserts is it valid for inserts? + * CheckedUnchanged IndexUnchanged status determined yet? + * IndexUnchanged aminsert hint, cached for retail inserts + * Concurrent are we doing a concurrent index build? + * BrokenHotChain did we detect any broken HOT chains? + * WithoutOverlaps is it a WITHOUT OVERLAPS index? + * Summarizing is it a summarizing index? + * ParallelWorkers # of workers requested (excludes leader) + * Am Oid of index AM + * AmCache private cache area for index AM + * Context memory context holding this IndexInfo + * + * ii_Concurrent, ii_BrokenHotChain, and ii_ParallelWorkers are used only + * during index build; they're conventionally zeroed otherwise. + * ---------------- + */ +typedef struct IndexInfo +{ + NodeTag type; + int ii_NumIndexAttrs; /* total number of columns in index */ + int ii_NumIndexKeyAttrs; /* number of key columns in index */ + AttrNumber ii_IndexAttrNumbers[INDEX_MAX_KEYS]; + List *ii_Expressions; /* list of Expr */ + List *ii_ExpressionsState; /* list of ExprState */ + List *ii_Predicate; /* list of Expr */ + ExprState *ii_PredicateState; + Oid *ii_ExclusionOps; /* array with one entry per column */ + Oid *ii_ExclusionProcs; /* array with one entry per column */ + uint16 *ii_ExclusionStrats; /* array with one entry per column */ + Oid *ii_UniqueOps; /* array with one entry per column */ + Oid *ii_UniqueProcs; /* array with one entry per column */ + uint16 *ii_UniqueStrats; /* array with one entry per column */ + bool ii_Unique; + bool ii_NullsNotDistinct; + bool ii_ReadyForInserts; + bool ii_CheckedUnchanged; + bool ii_IndexUnchanged; + bool ii_Concurrent; + bool ii_BrokenHotChain; + bool ii_Summarizing; + bool ii_WithoutOverlaps; + int ii_ParallelWorkers; + Oid ii_Am; + void *ii_AmCache; + MemoryContext ii_Context; +} IndexInfo; + +/* ---------------- + * ExprContext_CB + * + * List of callbacks to be called at ExprContext shutdown. + * ---------------- + */ +typedef void (*ExprContextCallbackFunction) (Datum arg); + +typedef struct ExprContext_CB +{ + struct ExprContext_CB *next; + ExprContextCallbackFunction function; + Datum arg; +} ExprContext_CB; + +/* ---------------- + * ExprContext + * + * This class holds the "current context" information + * needed to evaluate expressions for doing tuple qualifications + * and tuple projections. For example, if an expression refers + * to an attribute in the current inner tuple then we need to know + * what the current inner tuple is and so we look at the expression + * context. + * + * There are two memory contexts associated with an ExprContext: + * * ecxt_per_query_memory is a query-lifespan context, typically the same + * context the ExprContext node itself is allocated in. This context + * can be used for purposes such as storing function call cache info. + * * ecxt_per_tuple_memory is a short-term context for expression results. + * As the name suggests, it will typically be reset once per tuple, + * before we begin to evaluate expressions for that tuple. Each + * ExprContext normally has its very own per-tuple memory context. + * + * CurrentMemoryContext should be set to ecxt_per_tuple_memory before + * calling ExecEvalExpr() --- see ExecEvalExprSwitchContext(). + * ---------------- + */ +typedef struct ExprContext +{ + NodeTag type; + + /* Tuples that Var nodes in expression may refer to */ +#define FIELDNO_EXPRCONTEXT_SCANTUPLE 1 + TupleTableSlot *ecxt_scantuple; +#define FIELDNO_EXPRCONTEXT_INNERTUPLE 2 + TupleTableSlot *ecxt_innertuple; +#define FIELDNO_EXPRCONTEXT_OUTERTUPLE 3 + TupleTableSlot *ecxt_outertuple; + + /* Memory contexts for expression evaluation --- see notes above */ + MemoryContext ecxt_per_query_memory; + MemoryContext ecxt_per_tuple_memory; + + /* Values to substitute for Param nodes in expression */ + ParamExecData *ecxt_param_exec_vals; /* for PARAM_EXEC params */ + ParamListInfo ecxt_param_list_info; /* for other param types */ + + /* + * Values to substitute for Aggref nodes in the expressions of an Agg + * node, or for WindowFunc nodes within a WindowAgg node. + */ +#define FIELDNO_EXPRCONTEXT_AGGVALUES 8 + Datum *ecxt_aggvalues; /* precomputed values for aggs/windowfuncs */ +#define FIELDNO_EXPRCONTEXT_AGGNULLS 9 + bool *ecxt_aggnulls; /* null flags for aggs/windowfuncs */ + + /* Value to substitute for CaseTestExpr nodes in expression */ +#define FIELDNO_EXPRCONTEXT_CASEDATUM 10 + Datum caseValue_datum; +#define FIELDNO_EXPRCONTEXT_CASENULL 11 + bool caseValue_isNull; + + /* Value to substitute for CoerceToDomainValue nodes in expression */ +#define FIELDNO_EXPRCONTEXT_DOMAINDATUM 12 + Datum domainValue_datum; +#define FIELDNO_EXPRCONTEXT_DOMAINNULL 13 + bool domainValue_isNull; + + /* Tuples that OLD/NEW Var nodes in RETURNING may refer to */ +#define FIELDNO_EXPRCONTEXT_OLDTUPLE 14 + TupleTableSlot *ecxt_oldtuple; +#define FIELDNO_EXPRCONTEXT_NEWTUPLE 15 + TupleTableSlot *ecxt_newtuple; + + /* Link to containing EState (NULL if a standalone ExprContext) */ + struct EState *ecxt_estate; + + /* Functions to call back when ExprContext is shut down or rescanned */ + ExprContext_CB *ecxt_callbacks; +} ExprContext; + +/* + * Set-result status used when evaluating functions potentially returning a + * set. + */ +typedef enum +{ + ExprSingleResult, /* expression does not return a set */ + ExprMultipleResult, /* this result is an element of a set */ + ExprEndResult, /* there are no more elements in the set */ +} ExprDoneCond; + +/* + * Return modes for functions returning sets. Note values must be chosen + * as separate bits so that a bitmask can be formed to indicate supported + * modes. SFRM_Materialize_Random and SFRM_Materialize_Preferred are + * auxiliary flags about SFRM_Materialize mode, rather than separate modes. + */ +typedef enum +{ + SFRM_ValuePerCall = 0x01, /* one value returned per call */ + SFRM_Materialize = 0x02, /* result set instantiated in Tuplestore */ + SFRM_Materialize_Random = 0x04, /* Tuplestore needs randomAccess */ + SFRM_Materialize_Preferred = 0x08, /* caller prefers Tuplestore */ +} SetFunctionReturnMode; + +/* + * When calling a function that might return a set (multiple rows), + * a node of this type is passed as fcinfo->resultinfo to allow + * return status to be passed back. A function returning set should + * raise an error if no such resultinfo is provided. + */ +typedef struct ReturnSetInfo +{ + NodeTag type; + /* values set by caller: */ + ExprContext *econtext; /* context function is being called in */ + TupleDesc expectedDesc; /* tuple descriptor expected by caller */ + int allowedModes; /* bitmask: return modes caller can handle */ + /* result status from function (but pre-initialized by caller): */ + SetFunctionReturnMode returnMode; /* actual return mode */ + ExprDoneCond isDone; /* status for ValuePerCall mode */ + /* fields filled by function in Materialize return mode: */ + Tuplestorestate *setResult; /* holds the complete returned tuple set */ + TupleDesc setDesc; /* actual descriptor for returned tuples */ +} ReturnSetInfo; + +/* ---------------- + * ProjectionInfo node information + * + * This is all the information needed to perform projections --- + * that is, form new tuples by evaluation of targetlist expressions. + * Nodes which need to do projections create one of these. + * + * The target tuple slot is kept in ProjectionInfo->pi_state.resultslot. + * ExecProject() evaluates the tlist, forms a tuple, and stores it + * in the given slot. Note that the result will be a "virtual" tuple + * unless ExecMaterializeSlot() is then called to force it to be + * converted to a physical tuple. The slot must have a tupledesc + * that matches the output of the tlist! + * ---------------- + */ +typedef struct ProjectionInfo +{ + NodeTag type; + /* instructions to evaluate projection */ + ExprState pi_state; + /* expression context in which to evaluate expression */ + ExprContext *pi_exprContext; +} ProjectionInfo; + +/* ---------------- + * JunkFilter + * + * This class is used to store information regarding junk attributes. + * A junk attribute is an attribute in a tuple that is needed only for + * storing intermediate information in the executor, and does not belong + * in emitted tuples. For example, when we do an UPDATE query, + * the planner adds a "junk" entry to the targetlist so that the tuples + * returned to ExecutePlan() contain an extra attribute: the ctid of + * the tuple to be updated. This is needed to do the update, but we + * don't want the ctid to be part of the stored new tuple! So, we + * apply a "junk filter" to remove the junk attributes and form the + * real output tuple. The junkfilter code also provides routines to + * extract the values of the junk attribute(s) from the input tuple. + * + * targetList: the original target list (including junk attributes). + * cleanTupType: the tuple descriptor for the "clean" tuple (with + * junk attributes removed). + * cleanMap: A map with the correspondence between the non-junk + * attribute numbers of the "original" tuple and the + * attribute numbers of the "clean" tuple. + * resultSlot: tuple slot used to hold cleaned tuple. + * ---------------- + */ +typedef struct JunkFilter +{ + NodeTag type; + List *jf_targetList; + TupleDesc jf_cleanTupType; + AttrNumber *jf_cleanMap; + TupleTableSlot *jf_resultSlot; +} JunkFilter; + +/* + * OnConflictSetState + * + * Executor state of an ON CONFLICT DO UPDATE operation. + */ +typedef struct OnConflictSetState +{ + NodeTag type; + + TupleTableSlot *oc_Existing; /* slot to store existing target tuple in */ + TupleTableSlot *oc_ProjSlot; /* CONFLICT ... SET ... projection target */ + ProjectionInfo *oc_ProjInfo; /* for ON CONFLICT DO UPDATE SET */ + ExprState *oc_WhereClause; /* state for the WHERE clause */ +} OnConflictSetState; + +/* ---------------- + * MergeActionState information + * + * Executor state for a MERGE action. + * ---------------- + */ +typedef struct MergeActionState +{ + NodeTag type; + + MergeAction *mas_action; /* associated MergeAction node */ + ProjectionInfo *mas_proj; /* projection of the action's targetlist for + * this rel */ + ExprState *mas_whenqual; /* WHEN [NOT] MATCHED AND conditions */ +} MergeActionState; + +/* + * ResultRelInfo + * + * Whenever we update an existing relation, we have to update indexes on the + * relation, and perhaps also fire triggers. ResultRelInfo holds all the + * information needed about a result relation, including indexes. + * + * Normally, a ResultRelInfo refers to a table that is in the query's range + * table; then ri_RangeTableIndex is the RT index and ri_RelationDesc is + * just a copy of the relevant es_relations[] entry. However, in some + * situations we create ResultRelInfos for relations that are not in the + * range table, namely for targets of tuple routing in a partitioned table, + * and when firing triggers in tables other than the target tables (See + * ExecGetTriggerResultRel). In these situations, ri_RangeTableIndex is 0 + * and ri_RelationDesc is a separately-opened relcache pointer that needs to + * be separately closed. + */ +typedef struct ResultRelInfo +{ + NodeTag type; + + /* result relation's range table index, or 0 if not in range table */ + Index ri_RangeTableIndex; + + /* relation descriptor for result relation */ + Relation ri_RelationDesc; + + /* # of indices existing on result relation */ + int ri_NumIndices; + + /* array of relation descriptors for indices */ + RelationPtr ri_IndexRelationDescs; + + /* array of key/attr info for indices */ + IndexInfo **ri_IndexRelationInfo; + + /* + * For UPDATE/DELETE/MERGE result relations, the attribute number of the + * row identity junk attribute in the source plan's output tuples + */ + AttrNumber ri_RowIdAttNo; + + /* For UPDATE, attnums of generated columns to be computed */ + Bitmapset *ri_extraUpdatedCols; + /* true if the above has been computed */ + bool ri_extraUpdatedCols_valid; + + /* Projection to generate new tuple in an INSERT/UPDATE */ + ProjectionInfo *ri_projectNew; + /* Slot to hold that tuple */ + TupleTableSlot *ri_newTupleSlot; + /* Slot to hold the old tuple being updated */ + TupleTableSlot *ri_oldTupleSlot; + /* Have the projection and the slots above been initialized? */ + bool ri_projectNewInfoValid; + + /* updates do LockTuple() before oldtup read; see README.tuplock */ + bool ri_needLockTagTuple; + + /* triggers to be fired, if any */ + TriggerDesc *ri_TrigDesc; + + /* cached lookup info for trigger functions */ + FmgrInfo *ri_TrigFunctions; + + /* array of trigger WHEN expr states */ + ExprState **ri_TrigWhenExprs; + + /* optional runtime measurements for triggers */ + Instrumentation *ri_TrigInstrument; + + /* On-demand created slots for triggers / returning processing */ + TupleTableSlot *ri_ReturningSlot; /* for trigger output tuples */ + TupleTableSlot *ri_TrigOldSlot; /* for a trigger's old tuple */ + TupleTableSlot *ri_TrigNewSlot; /* for a trigger's new tuple */ + TupleTableSlot *ri_AllNullSlot; /* for RETURNING OLD/NEW */ + + /* FDW callback functions, if foreign table */ + struct FdwRoutine *ri_FdwRoutine; + + /* available to save private state of FDW */ + void *ri_FdwState; + + /* true when modifying foreign table directly */ + bool ri_usesFdwDirectModify; + + /* batch insert stuff */ + int ri_NumSlots; /* number of slots in the array */ + int ri_NumSlotsInitialized; /* number of initialized slots */ + int ri_BatchSize; /* max slots inserted in a single batch */ + TupleTableSlot **ri_Slots; /* input tuples for batch insert */ + TupleTableSlot **ri_PlanSlots; + + /* list of WithCheckOption's to be checked */ + List *ri_WithCheckOptions; + + /* list of WithCheckOption expr states */ + List *ri_WithCheckOptionExprs; + + /* array of expr states for checking check constraints */ + ExprState **ri_CheckConstraintExprs; + + /* + * array of expr states for checking not-null constraints on virtual + * generated columns + */ + ExprState **ri_GenVirtualNotNullConstraintExprs; + + /* + * Arrays of stored generated columns ExprStates for INSERT/UPDATE/MERGE. + */ + ExprState **ri_GeneratedExprsI; + ExprState **ri_GeneratedExprsU; + + /* number of stored generated columns we need to compute */ + int ri_NumGeneratedNeededI; + int ri_NumGeneratedNeededU; + + /* list of RETURNING expressions */ + List *ri_returningList; + + /* for computing a RETURNING list */ + ProjectionInfo *ri_projectReturning; + + /* list of arbiter indexes to use to check conflicts */ + List *ri_onConflictArbiterIndexes; + + /* ON CONFLICT evaluation state */ + OnConflictSetState *ri_onConflict; + + /* for MERGE, lists of MergeActionState (one per MergeMatchKind) */ + List *ri_MergeActions[NUM_MERGE_MATCH_KINDS]; + + /* for MERGE, expr state for checking the join condition */ + ExprState *ri_MergeJoinCondition; + + /* partition check expression state (NULL if not set up yet) */ + ExprState *ri_PartitionCheckExpr; + + /* + * Map to convert child result relation tuples to the format of the table + * actually mentioned in the query (called "root"). Computed only if + * needed. A NULL map value indicates that no conversion is needed, so we + * must have a separate flag to show if the map has been computed. + */ + TupleConversionMap *ri_ChildToRootMap; + bool ri_ChildToRootMapValid; + + /* + * As above, but in the other direction. + */ + TupleConversionMap *ri_RootToChildMap; + bool ri_RootToChildMapValid; + + /* + * Other information needed by child result relations + * + * ri_RootResultRelInfo gives the target relation mentioned in the query. + * Used as the root for tuple routing and/or transition capture. + * + * ri_PartitionTupleSlot is non-NULL if the relation is a partition to + * route tuples into and ri_RootToChildMap conversion is needed. + */ + struct ResultRelInfo *ri_RootResultRelInfo; + TupleTableSlot *ri_PartitionTupleSlot; + + /* for use by copyfrom.c when performing multi-inserts */ + struct CopyMultiInsertBuffer *ri_CopyMultiInsertBuffer; + + /* + * Used when a leaf partition is involved in a cross-partition update of + * one of its ancestors; see ExecCrossPartitionUpdateForeignKey(). + */ + List *ri_ancestorResultRels; +} ResultRelInfo; + +/* ---------------- + * AsyncRequest + * + * State for an asynchronous tuple request. + * ---------------- + */ +typedef struct AsyncRequest +{ + struct PlanState *requestor; /* Node that wants a tuple */ + struct PlanState *requestee; /* Node from which a tuple is wanted */ + int request_index; /* Scratch space for requestor */ + bool callback_pending; /* Callback is needed */ + bool request_complete; /* Request complete, result valid */ + TupleTableSlot *result; /* Result (NULL or an empty slot if no more + * tuples) */ +} AsyncRequest; + +/* ---------------- + * EState information + * + * Working state for an Executor invocation + * ---------------- + */ +typedef struct EState +{ + NodeTag type; + + /* Basic state for all query types: */ + ScanDirection es_direction; /* current scan direction */ + Snapshot es_snapshot; /* time qual to use */ + Snapshot es_crosscheck_snapshot; /* crosscheck time qual for RI */ + List *es_range_table; /* List of RangeTblEntry */ + Index es_range_table_size; /* size of the range table arrays */ + Relation *es_relations; /* Array of per-range-table-entry Relation + * pointers, or NULL if not yet opened */ + struct ExecRowMark **es_rowmarks; /* Array of per-range-table-entry + * ExecRowMarks, or NULL if none */ + List *es_rteperminfos; /* List of RTEPermissionInfo */ + PlannedStmt *es_plannedstmt; /* link to top of plan tree */ + List *es_part_prune_infos; /* List of PartitionPruneInfo */ + List *es_part_prune_states; /* List of PartitionPruneState */ + List *es_part_prune_results; /* List of Bitmapset */ + Bitmapset *es_unpruned_relids; /* PlannedStmt.unprunableRelids + RT + * indexes of leaf partitions that survive + * initial pruning; see + * ExecDoInitialPruning() */ + const char *es_sourceText; /* Source text from QueryDesc */ + + JunkFilter *es_junkFilter; /* top-level junk filter, if any */ + + /* If query can insert/delete tuples, the command ID to mark them with */ + CommandId es_output_cid; + + /* Info about target table(s) for insert/update/delete queries: */ + ResultRelInfo **es_result_relations; /* Array of per-range-table-entry + * ResultRelInfo pointers, or NULL + * if not a target table */ + List *es_opened_result_relations; /* List of non-NULL entries in + * es_result_relations in no + * specific order */ + + PartitionDirectory es_partition_directory; /* for PartitionDesc lookup */ + + /* + * The following list contains ResultRelInfos created by the tuple routing + * code for partitions that aren't found in the es_result_relations array. + */ + List *es_tuple_routing_result_relations; + + /* Stuff used for firing triggers: */ + List *es_trig_target_relations; /* trigger-only ResultRelInfos */ + + /* Parameter info: */ + ParamListInfo es_param_list_info; /* values of external params */ + ParamExecData *es_param_exec_vals; /* values of internal params */ + + QueryEnvironment *es_queryEnv; /* query environment */ + + /* Other working state: */ + MemoryContext es_query_cxt; /* per-query context in which EState lives */ + + List *es_tupleTable; /* List of TupleTableSlots */ + + uint64 es_processed; /* # of tuples processed during one + * ExecutorRun() call. */ + uint64 es_total_processed; /* total # of tuples aggregated across all + * ExecutorRun() calls. */ + + int es_top_eflags; /* eflags passed to ExecutorStart */ + int es_instrument; /* OR of InstrumentOption flags */ + bool es_finished; /* true when ExecutorFinish is done */ + + List *es_exprcontexts; /* List of ExprContexts within EState */ + + List *es_subplanstates; /* List of PlanState for SubPlans */ + + List *es_auxmodifytables; /* List of secondary ModifyTableStates */ + + /* + * this ExprContext is for per-output-tuple operations, such as constraint + * checks and index-value computations. It will be reset for each output + * tuple. Note that it will be created only if needed. + */ + ExprContext *es_per_tuple_exprcontext; + + /* + * If not NULL, this is an EPQState's EState. This is a field in EState + * both to allow EvalPlanQual aware executor nodes to detect that they + * need to perform EPQ related work, and to provide necessary information + * to do so. + */ + struct EPQState *es_epq_active; + + bool es_use_parallel_mode; /* can we use parallel workers? */ + + int es_parallel_workers_to_launch; /* number of workers to + * launch. */ + int es_parallel_workers_launched; /* number of workers actually + * launched. */ + + /* The per-query shared memory area to use for parallel execution. */ + struct dsa_area *es_query_dsa; + + /* + * JIT information. es_jit_flags indicates whether JIT should be performed + * and with which options. es_jit is created on-demand when JITing is + * performed. + * + * es_jit_worker_instr is the combined, on demand allocated, + * instrumentation from all workers. The leader's instrumentation is kept + * separate, and is combined on demand by ExplainPrintJITSummary(). + */ + int es_jit_flags; + struct JitContext *es_jit; + struct JitInstrumentation *es_jit_worker_instr; + + /* + * Lists of ResultRelInfos for foreign tables on which batch-inserts are + * to be executed and owning ModifyTableStates, stored in the same order. + */ + List *es_insert_pending_result_relations; + List *es_insert_pending_modifytables; +} EState; + + +/* + * ExecRowMark - + * runtime representation of FOR [KEY] UPDATE/SHARE clauses + * + * When doing UPDATE/DELETE/MERGE/SELECT FOR [KEY] UPDATE/SHARE, we will have + * an ExecRowMark for each non-target relation in the query (except inheritance + * parent RTEs, which can be ignored at runtime). Virtual relations such as + * subqueries-in-FROM will have an ExecRowMark with relation == NULL. See + * PlanRowMark for details about most of the fields. In addition to fields + * directly derived from PlanRowMark, we store an activity flag (to denote + * inactive children of inheritance trees), curCtid, which is used by the + * WHERE CURRENT OF code, and ermExtra, which is available for use by the plan + * node that sources the relation (e.g., for a foreign table the FDW can use + * ermExtra to hold information). + * + * EState->es_rowmarks is an array of these structs, indexed by RT index, + * with NULLs for irrelevant RT indexes. es_rowmarks itself is NULL if + * there are no rowmarks. + */ +typedef struct ExecRowMark +{ + Relation relation; /* opened and suitably locked relation */ + Oid relid; /* its OID (or InvalidOid, if subquery) */ + Index rti; /* its range table index */ + Index prti; /* parent range table index, if child */ + Index rowmarkId; /* unique identifier for resjunk columns */ + RowMarkType markType; /* see enum in nodes/plannodes.h */ + LockClauseStrength strength; /* LockingClause's strength, or LCS_NONE */ + LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */ + bool ermActive; /* is this mark relevant for current tuple? */ + ItemPointerData curCtid; /* ctid of currently locked tuple, if any */ + void *ermExtra; /* available for use by relation source node */ +} ExecRowMark; + +/* + * ExecAuxRowMark - + * additional runtime representation of FOR [KEY] UPDATE/SHARE clauses + * + * Each LockRows and ModifyTable node keeps a list of the rowmarks it needs to + * deal with. In addition to a pointer to the related entry in es_rowmarks, + * this struct carries the column number(s) of the resjunk columns associated + * with the rowmark (see comments for PlanRowMark for more detail). + */ +typedef struct ExecAuxRowMark +{ + ExecRowMark *rowmark; /* related entry in es_rowmarks */ + AttrNumber ctidAttNo; /* resno of ctid junk attribute, if any */ + AttrNumber toidAttNo; /* resno of tableoid junk attribute, if any */ + AttrNumber wholeAttNo; /* resno of whole-row junk attribute, if any */ +} ExecAuxRowMark; + + +/* ---------------------------------------------------------------- + * Tuple Hash Tables + * + * All-in-memory tuple hash tables are used for a number of purposes. + * + * Note: tab_hash_expr is for hashing the key datatype(s) stored in the table, + * and tab_eq_func is a non-cross-type ExprState for equality checks on those + * types. Normally these are the only ExprStates used, but + * FindTupleHashEntry() supports searching a hashtable using cross-data-type + * hashing. For that, the caller must supply an ExprState to hash the LHS + * datatype as well as the cross-type equality ExprState to use. in_hash_expr + * and cur_eq_func are set to point to the caller's hash and equality + * ExprStates while doing such a search. During LookupTupleHashEntry(), they + * point to tab_hash_expr and tab_eq_func respectively. + * ---------------------------------------------------------------- + */ +typedef struct TupleHashEntryData *TupleHashEntry; +typedef struct TupleHashTableData *TupleHashTable; + +typedef struct TupleHashEntryData +{ + MinimalTuple firstTuple; /* copy of first tuple in this group */ + uint32 status; /* hash status */ + uint32 hash; /* hash value (cached) */ +} TupleHashEntryData; + +/* define parameters necessary to generate the tuple hash table interface */ +#define SH_PREFIX tuplehash +#define SH_ELEMENT_TYPE TupleHashEntryData +#define SH_KEY_TYPE MinimalTuple +#define SH_SCOPE extern +#define SH_DECLARE +#include "lib/simplehash.h" + +typedef struct TupleHashTableData +{ + tuplehash_hash *hashtab; /* underlying hash table */ + int numCols; /* number of columns in lookup key */ + AttrNumber *keyColIdx; /* attr numbers of key columns */ + ExprState *tab_hash_expr; /* ExprState for hashing table datatype(s) */ + ExprState *tab_eq_func; /* comparator for table datatype(s) */ + Oid *tab_collations; /* collations for hash and comparison */ + MemoryContext tablecxt; /* memory context containing table */ + MemoryContext tempcxt; /* context for function evaluations */ + Size additionalsize; /* size of additional data */ + TupleTableSlot *tableslot; /* slot for referencing table entries */ + /* The following fields are set transiently for each table search: */ + TupleTableSlot *inputslot; /* current input tuple's slot */ + ExprState *in_hash_expr; /* ExprState for hashing input datatype(s) */ + ExprState *cur_eq_func; /* comparator for input vs. table */ + ExprContext *exprcontext; /* expression context */ +} TupleHashTableData; + +typedef tuplehash_iterator TupleHashIterator; + +/* + * Use InitTupleHashIterator/TermTupleHashIterator for a read/write scan. + * Use ResetTupleHashIterator if the table can be frozen (in this case no + * explicit scan termination is needed). + */ +#define InitTupleHashIterator(htable, iter) \ + tuplehash_start_iterate(htable->hashtab, iter) +#define TermTupleHashIterator(iter) \ + ((void) 0) +#define ResetTupleHashIterator(htable, iter) \ + InitTupleHashIterator(htable, iter) +#define ScanTupleHashTable(htable, iter) \ + tuplehash_iterate(htable->hashtab, iter) + + +/* ---------------------------------------------------------------- + * Expression State Nodes + * + * Formerly, there was a separate executor expression state node corresponding + * to each node in a planned expression tree. That's no longer the case; for + * common expression node types, all the execution info is embedded into + * step(s) in a single ExprState node. But we still have a few executor state + * node types for selected expression node types, mostly those in which info + * has to be shared with other parts of the execution state tree. + * ---------------------------------------------------------------- + */ + +/* ---------------- + * WindowFuncExprState node + * ---------------- + */ +typedef struct WindowFuncExprState +{ + NodeTag type; + WindowFunc *wfunc; /* expression plan node */ + List *args; /* ExprStates for argument expressions */ + ExprState *aggfilter; /* FILTER expression */ + int wfuncno; /* ID number for wfunc within its plan node */ +} WindowFuncExprState; + + +/* ---------------- + * SetExprState node + * + * State for evaluating a potentially set-returning expression (like FuncExpr + * or OpExpr). In some cases, like some of the expressions in ROWS FROM(...) + * the expression might not be a SRF, but nonetheless it uses the same + * machinery as SRFs; it will be treated as a SRF returning a single row. + * ---------------- + */ +typedef struct SetExprState +{ + NodeTag type; + Expr *expr; /* expression plan node */ + List *args; /* ExprStates for argument expressions */ + + /* + * In ROWS FROM, functions can be inlined, removing the FuncExpr normally + * inside. In such a case this is the compiled expression (which cannot + * return a set), which'll be evaluated using regular ExecEvalExpr(). + */ + ExprState *elidedFuncState; + + /* + * Function manager's lookup info for the target function. If func.fn_oid + * is InvalidOid, we haven't initialized it yet (nor any of the following + * fields, except funcReturnsSet). + */ + FmgrInfo func; + + /* + * For a set-returning function (SRF) that returns a tuplestore, we keep + * the tuplestore here and dole out the result rows one at a time. The + * slot holds the row currently being returned. + */ + Tuplestorestate *funcResultStore; + TupleTableSlot *funcResultSlot; + + /* + * In some cases we need to compute a tuple descriptor for the function's + * output. If so, it's stored here. + */ + TupleDesc funcResultDesc; + bool funcReturnsTuple; /* valid when funcResultDesc isn't NULL */ + + /* + * Remember whether the function is declared to return a set. This is set + * by ExecInitExpr, and is valid even before the FmgrInfo is set up. + */ + bool funcReturnsSet; + + /* + * setArgsValid is true when we are evaluating a set-returning function + * that uses value-per-call mode and we are in the middle of a call + * series; we want to pass the same argument values to the function again + * (and again, until it returns ExprEndResult). This indicates that + * fcinfo_data already contains valid argument data. + */ + bool setArgsValid; + + /* + * Flag to remember whether we have registered a shutdown callback for + * this SetExprState. We do so only if funcResultStore or setArgsValid + * has been set at least once (since all the callback is for is to release + * the tuplestore or clear setArgsValid). + */ + bool shutdown_reg; /* a shutdown callback is registered */ + + /* + * Call parameter structure for the function. This has been initialized + * (by InitFunctionCallInfoData) if func.fn_oid is valid. It also saves + * argument values between calls, when setArgsValid is true. + */ + FunctionCallInfo fcinfo; +} SetExprState; + +/* ---------------- + * SubPlanState node + * ---------------- + */ +typedef struct SubPlanState +{ + NodeTag type; + SubPlan *subplan; /* expression plan node */ + struct PlanState *planstate; /* subselect plan's state tree */ + struct PlanState *parent; /* parent plan node's state tree */ + ExprState *testexpr; /* state of combining expression */ + HeapTuple curTuple; /* copy of most recent tuple from subplan */ + Datum curArray; /* most recent array from ARRAY() subplan */ + /* these are used when hashing the subselect's output: */ + TupleDesc descRight; /* subselect desc after projection */ + ProjectionInfo *projLeft; /* for projecting lefthand exprs */ + ProjectionInfo *projRight; /* for projecting subselect output */ + TupleHashTable hashtable; /* hash table for no-nulls subselect rows */ + TupleHashTable hashnulls; /* hash table for rows with null(s) */ + bool havehashrows; /* true if hashtable is not empty */ + bool havenullrows; /* true if hashnulls is not empty */ + MemoryContext hashtablecxt; /* memory context containing hash tables */ + MemoryContext hashtempcxt; /* temp memory context for hash tables */ + ExprContext *innerecontext; /* econtext for computing inner tuples */ + int numCols; /* number of columns being hashed */ + /* each of the remaining fields is an array of length numCols: */ + AttrNumber *keyColIdx; /* control data for hash tables */ + Oid *tab_eq_funcoids; /* equality func oids for table + * datatype(s) */ + Oid *tab_collations; /* collations for hash and comparison */ + FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */ + ExprState *lhs_hash_expr; /* hash expr for lefthand datatype(s) */ + FmgrInfo *cur_eq_funcs; /* equality functions for LHS vs. table */ + ExprState *cur_eq_comp; /* equality comparator for LHS vs. table */ +} SubPlanState; + +/* + * DomainConstraintState - one item to check during CoerceToDomain + * + * Note: we consider this to be part of an ExprState tree, so we give it + * a name following the xxxState convention. But there's no directly + * associated plan-tree node. + */ +typedef enum DomainConstraintType +{ + DOM_CONSTRAINT_NOTNULL, + DOM_CONSTRAINT_CHECK, +} DomainConstraintType; + +typedef struct DomainConstraintState +{ + NodeTag type; + DomainConstraintType constrainttype; /* constraint type */ + char *name; /* name of constraint (for error msgs) */ + Expr *check_expr; /* for CHECK, a boolean expression */ + ExprState *check_exprstate; /* check_expr's eval state, or NULL */ +} DomainConstraintState; + +/* + * State for JsonExpr evaluation, too big to inline. + * + * This contains the information going into and coming out of the + * EEOP_JSONEXPR_PATH eval step. + */ +typedef struct JsonExprState +{ + /* original expression node */ + JsonExpr *jsexpr; + + /* value/isnull for formatted_expr */ + NullableDatum formatted_expr; + + /* value/isnull for pathspec */ + NullableDatum pathspec; + + /* JsonPathVariable entries for passing_values */ + List *args; + + /* + * Output variables that drive the EEOP_JUMP_IF_NOT_TRUE steps that are + * added for ON ERROR and ON EMPTY expressions, if any. + * + * Reset for each evaluation of EEOP_JSONEXPR_PATH. + */ + + /* Set to true if jsonpath evaluation cause an error. */ + NullableDatum error; + + /* Set to true if the jsonpath evaluation returned 0 items. */ + NullableDatum empty; + + /* + * Addresses of steps that implement the non-ERROR variant of ON EMPTY and + * ON ERROR behaviors, respectively. + */ + int jump_empty; + int jump_error; + + /* + * Address of the step to coerce the result value of jsonpath evaluation + * to the RETURNING type. -1 if no coercion if JsonExpr.use_io_coercion + * is true. + */ + int jump_eval_coercion; + + /* + * Address to jump to when skipping all the steps after performing + * ExecEvalJsonExprPath() so as to return whatever the JsonPath* function + * returned as is, that is, in the cases where there's no error and no + * coercion is necessary. + */ + int jump_end; + + /* + * RETURNING type input function invocation info when + * JsonExpr.use_io_coercion is true. + */ + FunctionCallInfo input_fcinfo; + + /* + * For error-safe evaluation of coercions. When the ON ERROR behavior is + * not ERROR, a pointer to this is passed to ExecInitExprRec() when + * initializing the coercion expressions or to ExecInitJsonCoercion(). + * + * Reset for each evaluation of EEOP_JSONEXPR_PATH. + */ + ErrorSaveContext escontext; +} JsonExprState; + + +/* ---------------------------------------------------------------- + * Executor State Trees + * + * An executing query has a PlanState tree paralleling the Plan tree + * that describes the plan. + * ---------------------------------------------------------------- + */ + +/* ---------------- + * ExecProcNodeMtd + * + * This is the method called by ExecProcNode to return the next tuple + * from an executor node. It returns NULL, or an empty TupleTableSlot, + * if no more tuples are available. + * ---------------- + */ +typedef TupleTableSlot *(*ExecProcNodeMtd) (struct PlanState *pstate); + +/* ---------------- + * PlanState node + * + * We never actually instantiate any PlanState nodes; this is just the common + * abstract superclass for all PlanState-type nodes. + * ---------------- + */ +typedef struct PlanState +{ + pg_node_attr(abstract) + + NodeTag type; + + Plan *plan; /* associated Plan node */ + + EState *state; /* at execution time, states of individual + * nodes point to one EState for the whole + * top-level plan */ + + ExecProcNodeMtd ExecProcNode; /* function to return next tuple */ + ExecProcNodeMtd ExecProcNodeReal; /* actual function, if above is a + * wrapper */ + + Instrumentation *instrument; /* Optional runtime stats for this node */ + WorkerInstrumentation *worker_instrument; /* per-worker instrumentation */ + + /* Per-worker JIT instrumentation */ + struct SharedJitInstrumentation *worker_jit_instrument; + + /* + * Common structural data for all Plan types. These links to subsidiary + * state trees parallel links in the associated plan tree (except for the + * subPlan list, which does not exist in the plan tree). + */ + ExprState *qual; /* boolean qual condition */ + struct PlanState *lefttree; /* input plan tree(s) */ + struct PlanState *righttree; + + List *initPlan; /* Init SubPlanState nodes (un-correlated expr + * subselects) */ + List *subPlan; /* SubPlanState nodes in my expressions */ + + /* + * State for management of parameter-change-driven rescanning + */ + Bitmapset *chgParam; /* set of IDs of changed Params */ + + /* + * Other run-time state needed by most if not all node types. + */ + TupleDesc ps_ResultTupleDesc; /* node's return type */ + TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */ + ExprContext *ps_ExprContext; /* node's expression-evaluation context */ + ProjectionInfo *ps_ProjInfo; /* info for doing tuple projection */ + + bool async_capable; /* true if node is async-capable */ + + /* + * Scanslot's descriptor if known. This is a bit of a hack, but otherwise + * it's hard for expression compilation to optimize based on the + * descriptor, without encoding knowledge about all executor nodes. + */ + TupleDesc scandesc; + + /* + * Define the slot types for inner, outer and scanslots for expression + * contexts with this state as a parent. If *opsset is set, then + * *opsfixed indicates whether *ops is guaranteed to be the type of slot + * used. That means that every slot in the corresponding + * ExprContext.ecxt_*tuple will point to a slot of that type, while + * evaluating the expression. If *opsfixed is false, but *ops is set, + * that indicates the most likely type of slot. + * + * The scan* fields are set by ExecInitScanTupleSlot(). If that's not + * called, nodes can initialize the fields themselves. + * + * If outer/inneropsset is false, the information is inferred on-demand + * using ExecGetResultSlotOps() on ->righttree/lefttree, using the + * corresponding node's resultops* fields. + * + * The result* fields are automatically set when ExecInitResultSlot is + * used (be it directly or when the slot is created by + * ExecAssignScanProjectionInfo() / + * ExecConditionalAssignProjectionInfo()). If no projection is necessary + * ExecConditionalAssignProjectionInfo() defaults those fields to the scan + * operations. + */ + const TupleTableSlotOps *scanops; + const TupleTableSlotOps *outerops; + const TupleTableSlotOps *innerops; + const TupleTableSlotOps *resultops; + bool scanopsfixed; + bool outeropsfixed; + bool inneropsfixed; + bool resultopsfixed; + bool scanopsset; + bool outeropsset; + bool inneropsset; + bool resultopsset; +} PlanState; + +/* ---------------- + * these are defined to avoid confusion problems with "left" + * and "right" and "inner" and "outer". The convention is that + * the "left" plan is the "outer" plan and the "right" plan is + * the inner plan, but these make the code more readable. + * ---------------- + */ +#define innerPlanState(node) (((PlanState *)(node))->righttree) +#define outerPlanState(node) (((PlanState *)(node))->lefttree) + +/* Macros for inline access to certain instrumentation counters */ +#define InstrCountTuples2(node, delta) \ + do { \ + if (((PlanState *)(node))->instrument) \ + ((PlanState *)(node))->instrument->ntuples2 += (delta); \ + } while (0) +#define InstrCountFiltered1(node, delta) \ + do { \ + if (((PlanState *)(node))->instrument) \ + ((PlanState *)(node))->instrument->nfiltered1 += (delta); \ + } while(0) +#define InstrCountFiltered2(node, delta) \ + do { \ + if (((PlanState *)(node))->instrument) \ + ((PlanState *)(node))->instrument->nfiltered2 += (delta); \ + } while(0) + +/* + * EPQState is state for executing an EvalPlanQual recheck on a candidate + * tuples e.g. in ModifyTable or LockRows. + * + * To execute EPQ a separate EState is created (stored in ->recheckestate), + * which shares some resources, like the rangetable, with the main query's + * EState (stored in ->parentestate). The (sub-)tree of the plan that needs to + * be rechecked (in ->plan), is separately initialized (into + * ->recheckplanstate), but shares plan nodes with the corresponding nodes in + * the main query. The scan nodes in that separate executor tree are changed + * to return only the current tuple of interest for the respective + * table. Those tuples are either provided by the caller (using + * EvalPlanQualSlot), and/or found using the rowmark mechanism (non-locking + * rowmarks by the EPQ machinery itself, locking ones by the caller). + * + * While the plan to be checked may be changed using EvalPlanQualSetPlan(), + * all such plans need to share the same EState. + */ +typedef struct EPQState +{ + /* These are initialized by EvalPlanQualInit() and do not change later: */ + EState *parentestate; /* main query's EState */ + int epqParam; /* ID of Param to force scan node re-eval */ + List *resultRelations; /* integer list of RT indexes, or NIL */ + + /* + * relsubs_slot[scanrelid - 1] holds the EPQ test tuple to be returned by + * the scan node for the scanrelid'th RT index, in place of performing an + * actual table scan. Callers should use EvalPlanQualSlot() to fetch + * these slots. + */ + List *tuple_table; /* tuple table for relsubs_slot */ + TupleTableSlot **relsubs_slot; + + /* + * Initialized by EvalPlanQualInit(), may be changed later with + * EvalPlanQualSetPlan(): + */ + + Plan *plan; /* plan tree to be executed */ + List *arowMarks; /* ExecAuxRowMarks (non-locking only) */ + + + /* + * The original output tuple to be rechecked. Set by + * EvalPlanQualSetSlot(), before EvalPlanQualNext() or EvalPlanQual() may + * be called. + */ + TupleTableSlot *origslot; + + + /* Initialized or reset by EvalPlanQualBegin(): */ + + EState *recheckestate; /* EState for EPQ execution, see above */ + + /* + * Rowmarks that can be fetched on-demand using + * EvalPlanQualFetchRowMark(), indexed by scanrelid - 1. Only non-locking + * rowmarks. + */ + ExecAuxRowMark **relsubs_rowmark; + + /* + * relsubs_done[scanrelid - 1] is true if there is no EPQ tuple for this + * target relation or it has already been fetched in the current scan of + * this target relation within the current EvalPlanQual test. + */ + bool *relsubs_done; + + /* + * relsubs_blocked[scanrelid - 1] is true if there is no EPQ tuple for + * this target relation during the current EvalPlanQual test. We keep + * these flags set for all relids listed in resultRelations, but + * transiently clear the one for the relation whose tuple is actually + * passed to EvalPlanQual(). + */ + bool *relsubs_blocked; + + PlanState *recheckplanstate; /* EPQ specific exec nodes, for ->plan */ +} EPQState; + + +/* ---------------- + * ResultState information + * ---------------- + */ +typedef struct ResultState +{ + PlanState ps; /* its first field is NodeTag */ + ExprState *resconstantqual; + bool rs_done; /* are we done? */ + bool rs_checkqual; /* do we need to check the qual? */ +} ResultState; + +/* ---------------- + * ProjectSetState information + * + * Note: at least one of the "elems" will be a SetExprState; the rest are + * regular ExprStates. + * ---------------- + */ +typedef struct ProjectSetState +{ + PlanState ps; /* its first field is NodeTag */ + Node **elems; /* array of expression states */ + ExprDoneCond *elemdone; /* array of per-SRF is-done states */ + int nelems; /* length of elemdone[] array */ + bool pending_srf_tuples; /* still evaluating srfs in tlist? */ + MemoryContext argcontext; /* context for SRF arguments */ +} ProjectSetState; + + +/* flags for mt_merge_subcommands */ +#define MERGE_INSERT 0x01 +#define MERGE_UPDATE 0x02 +#define MERGE_DELETE 0x04 + +/* ---------------- + * ModifyTableState information + * ---------------- + */ +typedef struct ModifyTableState +{ + PlanState ps; /* its first field is NodeTag */ + CmdType operation; /* INSERT, UPDATE, DELETE, or MERGE */ + bool canSetTag; /* do we set the command tag/es_processed? */ + bool mt_done; /* are we done? */ + int mt_nrels; /* number of entries in resultRelInfo[] */ + ResultRelInfo *resultRelInfo; /* info about target relation(s) */ + + /* + * Target relation mentioned in the original statement, used to fire + * statement-level triggers and as the root for tuple routing. (This + * might point to one of the resultRelInfo[] entries, but it can also be a + * distinct struct.) + */ + ResultRelInfo *rootResultRelInfo; + + EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */ + bool fireBSTriggers; /* do we need to fire stmt triggers? */ + + /* + * These fields are used for inherited UPDATE and DELETE, to track which + * target relation a given tuple is from. If there are a lot of target + * relations, we use a hash table to translate table OIDs to + * resultRelInfo[] indexes; otherwise mt_resultOidHash is NULL. + */ + int mt_resultOidAttno; /* resno of "tableoid" junk attr */ + Oid mt_lastResultOid; /* last-seen value of tableoid */ + int mt_lastResultIndex; /* corresponding index in resultRelInfo[] */ + HTAB *mt_resultOidHash; /* optional hash table to speed lookups */ + + /* + * Slot for storing tuples in the root partitioned table's rowtype during + * an UPDATE of a partitioned table. + */ + TupleTableSlot *mt_root_tuple_slot; + + /* Tuple-routing support info */ + struct PartitionTupleRouting *mt_partition_tuple_routing; + + /* controls transition table population for specified operation */ + struct TransitionCaptureState *mt_transition_capture; + + /* controls transition table population for INSERT...ON CONFLICT UPDATE */ + struct TransitionCaptureState *mt_oc_transition_capture; + + /* Flags showing which subcommands are present INS/UPD/DEL/DO NOTHING */ + int mt_merge_subcommands; + + /* For MERGE, the action currently being executed */ + MergeActionState *mt_merge_action; + + /* + * For MERGE, if there is a pending NOT MATCHED [BY TARGET] action to be + * performed, this will be the last tuple read from the subplan; otherwise + * it will be NULL --- see the comments in ExecMerge(). + */ + TupleTableSlot *mt_merge_pending_not_matched; + + /* tuple counters for MERGE */ + double mt_merge_inserted; + double mt_merge_updated; + double mt_merge_deleted; + + /* + * Lists of valid updateColnosLists, mergeActionLists, and + * mergeJoinConditions. These contain only entries for unpruned + * relations, filtered from the corresponding lists in ModifyTable. + */ + List *mt_updateColnosLists; + List *mt_mergeActionLists; + List *mt_mergeJoinConditions; +} ModifyTableState; + +/* ---------------- + * AppendState information + * + * nplans how many plans are in the array + * whichplan which synchronous plan is being executed (0 .. n-1) + * or a special negative value. See nodeAppend.c. + * prune_state details required to allow partitions to be + * eliminated from the scan, or NULL if not possible. + * valid_subplans for runtime pruning, valid synchronous appendplans + * indexes to scan. + * ---------------- + */ + +struct AppendState; +typedef struct AppendState AppendState; +struct ParallelAppendState; +typedef struct ParallelAppendState ParallelAppendState; +struct PartitionPruneState; + +struct AppendState +{ + PlanState ps; /* its first field is NodeTag */ + PlanState **appendplans; /* array of PlanStates for my inputs */ + int as_nplans; + int as_whichplan; + bool as_begun; /* false means need to initialize */ + Bitmapset *as_asyncplans; /* asynchronous plans indexes */ + int as_nasyncplans; /* # of asynchronous plans */ + AsyncRequest **as_asyncrequests; /* array of AsyncRequests */ + TupleTableSlot **as_asyncresults; /* unreturned results of async plans */ + int as_nasyncresults; /* # of valid entries in as_asyncresults */ + bool as_syncdone; /* true if all synchronous plans done in + * asynchronous mode, else false */ + int as_nasyncremain; /* # of remaining asynchronous plans */ + Bitmapset *as_needrequest; /* asynchronous plans needing a new request */ + struct WaitEventSet *as_eventset; /* WaitEventSet used to configure file + * descriptor wait events */ + int as_first_partial_plan; /* Index of 'appendplans' containing + * the first partial plan */ + ParallelAppendState *as_pstate; /* parallel coordination info */ + Size pstate_len; /* size of parallel coordination info */ + struct PartitionPruneState *as_prune_state; + bool as_valid_subplans_identified; /* is as_valid_subplans valid? */ + Bitmapset *as_valid_subplans; + Bitmapset *as_valid_asyncplans; /* valid asynchronous plans indexes */ + bool (*choose_next_subplan) (AppendState *); +}; + +/* ---------------- + * MergeAppendState information + * + * nplans how many plans are in the array + * nkeys number of sort key columns + * sortkeys sort keys in SortSupport representation + * slots current output tuple of each subplan + * heap heap of active tuples + * initialized true if we have fetched first tuple from each subplan + * prune_state details required to allow partitions to be + * eliminated from the scan, or NULL if not possible. + * valid_subplans for runtime pruning, valid mergeplans indexes to + * scan. + * ---------------- + */ +typedef struct MergeAppendState +{ + PlanState ps; /* its first field is NodeTag */ + PlanState **mergeplans; /* array of PlanStates for my inputs */ + int ms_nplans; + int ms_nkeys; + SortSupport ms_sortkeys; /* array of length ms_nkeys */ + TupleTableSlot **ms_slots; /* array of length ms_nplans */ + struct binaryheap *ms_heap; /* binary heap of slot indices */ + bool ms_initialized; /* are subplans started? */ + struct PartitionPruneState *ms_prune_state; + Bitmapset *ms_valid_subplans; +} MergeAppendState; + +/* ---------------- + * RecursiveUnionState information + * + * RecursiveUnionState is used for performing a recursive union. + * + * recursing T when we're done scanning the non-recursive term + * intermediate_empty T if intermediate_table is currently empty + * working_table working table (to be scanned by recursive term) + * intermediate_table current recursive output (next generation of WT) + * ---------------- + */ +typedef struct RecursiveUnionState +{ + PlanState ps; /* its first field is NodeTag */ + bool recursing; + bool intermediate_empty; + Tuplestorestate *working_table; + Tuplestorestate *intermediate_table; + /* Remaining fields are unused in UNION ALL case */ + Oid *eqfuncoids; /* per-grouping-field equality fns */ + FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ + MemoryContext tempContext; /* short-term context for comparisons */ + TupleHashTable hashtable; /* hash table for tuples already seen */ + MemoryContext tableContext; /* memory context containing hash table */ +} RecursiveUnionState; + +/* ---------------- + * BitmapAndState information + * ---------------- + */ +typedef struct BitmapAndState +{ + PlanState ps; /* its first field is NodeTag */ + PlanState **bitmapplans; /* array of PlanStates for my inputs */ + int nplans; /* number of input plans */ +} BitmapAndState; + +/* ---------------- + * BitmapOrState information + * ---------------- + */ +typedef struct BitmapOrState +{ + PlanState ps; /* its first field is NodeTag */ + PlanState **bitmapplans; /* array of PlanStates for my inputs */ + int nplans; /* number of input plans */ +} BitmapOrState; + +/* ---------------------------------------------------------------- + * Scan State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * ScanState information + * + * ScanState extends PlanState for node types that represent + * scans of an underlying relation. It can also be used for nodes + * that scan the output of an underlying plan node --- in that case, + * only ScanTupleSlot is actually useful, and it refers to the tuple + * retrieved from the subplan. + * + * currentRelation relation being scanned (NULL if none) + * currentScanDesc current scan descriptor for scan (NULL if none) + * ScanTupleSlot pointer to slot in tuple table holding scan tuple + * ---------------- + */ +typedef struct ScanState +{ + PlanState ps; /* its first field is NodeTag */ + Relation ss_currentRelation; + struct TableScanDescData *ss_currentScanDesc; + TupleTableSlot *ss_ScanTupleSlot; +} ScanState; + +/* ---------------- + * SeqScanState information + * ---------------- + */ +typedef struct SeqScanState +{ + ScanState ss; /* its first field is NodeTag */ + Size pscan_len; /* size of parallel heap scan descriptor */ +} SeqScanState; + +/* ---------------- + * SampleScanState information + * ---------------- + */ +typedef struct SampleScanState +{ + ScanState ss; + List *args; /* expr states for TABLESAMPLE params */ + ExprState *repeatable; /* expr state for REPEATABLE expr */ + /* use struct pointer to avoid including tsmapi.h here */ + struct TsmRoutine *tsmroutine; /* descriptor for tablesample method */ + void *tsm_state; /* tablesample method can keep state here */ + bool use_bulkread; /* use bulkread buffer access strategy? */ + bool use_pagemode; /* use page-at-a-time visibility checking? */ + bool begun; /* false means need to call BeginSampleScan */ + uint32 seed; /* random seed */ + int64 donetuples; /* number of tuples already returned */ + bool haveblock; /* has a block for sampling been determined */ + bool done; /* exhausted all tuples? */ +} SampleScanState; + +/* + * These structs store information about index quals that don't have simple + * constant right-hand sides. See comments for ExecIndexBuildScanKeys() + * for discussion. + */ +typedef struct +{ + struct ScanKeyData *scan_key; /* scankey to put value into */ + ExprState *key_expr; /* expr to evaluate to get value */ + bool key_toastable; /* is expr's result a toastable datatype? */ +} IndexRuntimeKeyInfo; + +typedef struct +{ + struct ScanKeyData *scan_key; /* scankey to put value into */ + ExprState *array_expr; /* expr to evaluate to get array value */ + int next_elem; /* next array element to use */ + int num_elems; /* number of elems in current array value */ + Datum *elem_values; /* array of num_elems Datums */ + bool *elem_nulls; /* array of num_elems is-null flags */ +} IndexArrayKeyInfo; + +/* ---------------- + * IndexScanState information + * + * indexqualorig execution state for indexqualorig expressions + * indexorderbyorig execution state for indexorderbyorig expressions + * ScanKeys Skey structures for index quals + * NumScanKeys number of ScanKeys + * OrderByKeys Skey structures for index ordering operators + * NumOrderByKeys number of OrderByKeys + * RuntimeKeys info about Skeys that must be evaluated at runtime + * NumRuntimeKeys number of RuntimeKeys + * RuntimeKeysReady true if runtime Skeys have been computed + * RuntimeContext expr context for evaling runtime Skeys + * RelationDesc index relation descriptor + * ScanDesc index scan descriptor + * Instrument local index scan instrumentation + * SharedInfo parallel worker instrumentation (no leader entry) + * + * ReorderQueue tuples that need reordering due to re-check + * ReachedEnd have we fetched all tuples from index already? + * OrderByValues values of ORDER BY exprs of last fetched tuple + * OrderByNulls null flags for OrderByValues + * SortSupport for reordering ORDER BY exprs + * OrderByTypByVals is the datatype of order by expression pass-by-value? + * OrderByTypLens typlens of the datatypes of order by expressions + * PscanLen size of parallel index scan descriptor + * ---------------- + */ +typedef struct IndexScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *indexqualorig; + List *indexorderbyorig; + struct ScanKeyData *iss_ScanKeys; + int iss_NumScanKeys; + struct ScanKeyData *iss_OrderByKeys; + int iss_NumOrderByKeys; + IndexRuntimeKeyInfo *iss_RuntimeKeys; + int iss_NumRuntimeKeys; + bool iss_RuntimeKeysReady; + ExprContext *iss_RuntimeContext; + Relation iss_RelationDesc; + struct IndexScanDescData *iss_ScanDesc; + IndexScanInstrumentation iss_Instrument; + SharedIndexScanInstrumentation *iss_SharedInfo; + + /* These are needed for re-checking ORDER BY expr ordering */ + pairingheap *iss_ReorderQueue; + bool iss_ReachedEnd; + Datum *iss_OrderByValues; + bool *iss_OrderByNulls; + SortSupport iss_SortSupport; + bool *iss_OrderByTypByVals; + int16 *iss_OrderByTypLens; + Size iss_PscanLen; +} IndexScanState; + +/* ---------------- + * IndexOnlyScanState information + * + * recheckqual execution state for recheckqual expressions + * ScanKeys Skey structures for index quals + * NumScanKeys number of ScanKeys + * OrderByKeys Skey structures for index ordering operators + * NumOrderByKeys number of OrderByKeys + * RuntimeKeys info about Skeys that must be evaluated at runtime + * NumRuntimeKeys number of RuntimeKeys + * RuntimeKeysReady true if runtime Skeys have been computed + * RuntimeContext expr context for evaling runtime Skeys + * RelationDesc index relation descriptor + * ScanDesc index scan descriptor + * Instrument local index scan instrumentation + * SharedInfo parallel worker instrumentation (no leader entry) + * TableSlot slot for holding tuples fetched from the table + * VMBuffer buffer in use for visibility map testing, if any + * PscanLen size of parallel index-only scan descriptor + * NameCStringAttNums attnums of name typed columns to pad to NAMEDATALEN + * NameCStringCount number of elements in the NameCStringAttNums array + * ---------------- + */ +typedef struct IndexOnlyScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *recheckqual; + struct ScanKeyData *ioss_ScanKeys; + int ioss_NumScanKeys; + struct ScanKeyData *ioss_OrderByKeys; + int ioss_NumOrderByKeys; + IndexRuntimeKeyInfo *ioss_RuntimeKeys; + int ioss_NumRuntimeKeys; + bool ioss_RuntimeKeysReady; + ExprContext *ioss_RuntimeContext; + Relation ioss_RelationDesc; + struct IndexScanDescData *ioss_ScanDesc; + IndexScanInstrumentation ioss_Instrument; + SharedIndexScanInstrumentation *ioss_SharedInfo; + TupleTableSlot *ioss_TableSlot; + Buffer ioss_VMBuffer; + Size ioss_PscanLen; + AttrNumber *ioss_NameCStringAttNums; + int ioss_NameCStringCount; +} IndexOnlyScanState; + +/* ---------------- + * BitmapIndexScanState information + * + * result bitmap to return output into, or NULL + * ScanKeys Skey structures for index quals + * NumScanKeys number of ScanKeys + * RuntimeKeys info about Skeys that must be evaluated at runtime + * NumRuntimeKeys number of RuntimeKeys + * ArrayKeys info about Skeys that come from ScalarArrayOpExprs + * NumArrayKeys number of ArrayKeys + * RuntimeKeysReady true if runtime Skeys have been computed + * RuntimeContext expr context for evaling runtime Skeys + * RelationDesc index relation descriptor + * ScanDesc index scan descriptor + * Instrument local index scan instrumentation + * SharedInfo parallel worker instrumentation (no leader entry) + * ---------------- + */ +typedef struct BitmapIndexScanState +{ + ScanState ss; /* its first field is NodeTag */ + TIDBitmap *biss_result; + struct ScanKeyData *biss_ScanKeys; + int biss_NumScanKeys; + IndexRuntimeKeyInfo *biss_RuntimeKeys; + int biss_NumRuntimeKeys; + IndexArrayKeyInfo *biss_ArrayKeys; + int biss_NumArrayKeys; + bool biss_RuntimeKeysReady; + ExprContext *biss_RuntimeContext; + Relation biss_RelationDesc; + struct IndexScanDescData *biss_ScanDesc; + IndexScanInstrumentation biss_Instrument; + SharedIndexScanInstrumentation *biss_SharedInfo; +} BitmapIndexScanState; + +/* ---------------- + * BitmapHeapScanInstrumentation information + * + * exact_pages total number of exact pages retrieved + * lossy_pages total number of lossy pages retrieved + * ---------------- + */ +typedef struct BitmapHeapScanInstrumentation +{ + uint64 exact_pages; + uint64 lossy_pages; +} BitmapHeapScanInstrumentation; + +/* ---------------- + * SharedBitmapState information + * + * BM_INITIAL TIDBitmap creation is not yet started, so first worker + * to see this state will set the state to BM_INPROGRESS + * and that process will be responsible for creating + * TIDBitmap. + * BM_INPROGRESS TIDBitmap creation is in progress; workers need to + * sleep until it's finished. + * BM_FINISHED TIDBitmap creation is done, so now all workers can + * proceed to iterate over TIDBitmap. + * ---------------- + */ +typedef enum +{ + BM_INITIAL, + BM_INPROGRESS, + BM_FINISHED, +} SharedBitmapState; + +/* ---------------- + * ParallelBitmapHeapState information + * tbmiterator iterator for scanning current pages + * mutex mutual exclusion for state + * state current state of the TIDBitmap + * cv conditional wait variable + * ---------------- + */ +typedef struct ParallelBitmapHeapState +{ + dsa_pointer tbmiterator; + slock_t mutex; + SharedBitmapState state; + ConditionVariable cv; +} ParallelBitmapHeapState; + +/* ---------------- + * Instrumentation data for a parallel bitmap heap scan. + * + * A shared memory struct that each parallel worker copies its + * BitmapHeapScanInstrumentation information into at executor shutdown to + * allow the leader to display the information in EXPLAIN ANALYZE. + * ---------------- + */ +typedef struct SharedBitmapHeapInstrumentation +{ + int num_workers; + BitmapHeapScanInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedBitmapHeapInstrumentation; + +/* ---------------- + * BitmapHeapScanState information + * + * bitmapqualorig execution state for bitmapqualorig expressions + * tbm bitmap obtained from child index scan(s) + * stats execution statistics + * initialized is node is ready to iterate + * pstate shared state for parallel bitmap scan + * sinstrument statistics for parallel workers + * recheck do current page's tuples need recheck + * ---------------- + */ +typedef struct BitmapHeapScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *bitmapqualorig; + TIDBitmap *tbm; + BitmapHeapScanInstrumentation stats; + bool initialized; + ParallelBitmapHeapState *pstate; + SharedBitmapHeapInstrumentation *sinstrument; + bool recheck; +} BitmapHeapScanState; + +/* ---------------- + * TidScanState information + * + * tidexprs list of TidExpr structs (see nodeTidscan.c) + * isCurrentOf scan has a CurrentOfExpr qual + * NumTids number of tids in this scan + * TidPtr index of currently fetched tid + * TidList evaluated item pointers (array of size NumTids) + * ---------------- + */ +typedef struct TidScanState +{ + ScanState ss; /* its first field is NodeTag */ + List *tss_tidexprs; + bool tss_isCurrentOf; + int tss_NumTids; + int tss_TidPtr; + ItemPointerData *tss_TidList; +} TidScanState; + +/* ---------------- + * TidRangeScanState information + * + * trss_tidexprs list of TidOpExpr structs (see nodeTidrangescan.c) + * trss_mintid the lowest TID in the scan range + * trss_maxtid the highest TID in the scan range + * trss_inScan is a scan currently in progress? + * ---------------- + */ +typedef struct TidRangeScanState +{ + ScanState ss; /* its first field is NodeTag */ + List *trss_tidexprs; + ItemPointerData trss_mintid; + ItemPointerData trss_maxtid; + bool trss_inScan; +} TidRangeScanState; + +/* ---------------- + * SubqueryScanState information + * + * SubqueryScanState is used for scanning a sub-query in the range table. + * ScanTupleSlot references the current output tuple of the sub-query. + * ---------------- + */ +typedef struct SubqueryScanState +{ + ScanState ss; /* its first field is NodeTag */ + PlanState *subplan; +} SubqueryScanState; + +/* ---------------- + * FunctionScanState information + * + * Function nodes are used to scan the results of a + * function appearing in FROM (typically a function returning set). + * + * eflags node's capability flags + * ordinality is this scan WITH ORDINALITY? + * simple true if we have 1 function and no ordinality + * ordinal current ordinal column value + * nfuncs number of functions being executed + * funcstates per-function execution states (private in + * nodeFunctionscan.c) + * argcontext memory context to evaluate function arguments in + * ---------------- + */ +struct FunctionScanPerFuncState; + +typedef struct FunctionScanState +{ + ScanState ss; /* its first field is NodeTag */ + int eflags; + bool ordinality; + bool simple; + int64 ordinal; + int nfuncs; + struct FunctionScanPerFuncState *funcstates; /* array of length nfuncs */ + MemoryContext argcontext; +} FunctionScanState; + +/* ---------------- + * ValuesScanState information + * + * ValuesScan nodes are used to scan the results of a VALUES list + * + * rowcontext per-expression-list context + * exprlists array of expression lists being evaluated + * exprstatelists array of expression state lists, for SubPlans only + * array_len size of above arrays + * curr_idx current array index (0-based) + * + * Note: ss.ps.ps_ExprContext is used to evaluate any qual or projection + * expressions attached to the node. We create a second ExprContext, + * rowcontext, in which to build the executor expression state for each + * Values sublist. Resetting this context lets us get rid of expression + * state for each row, avoiding major memory leakage over a long values list. + * However, that doesn't work for sublists containing SubPlans, because a + * SubPlan has to be connected up to the outer plan tree to work properly. + * Therefore, for only those sublists containing SubPlans, we do expression + * state construction at executor start, and store those pointers in + * exprstatelists[]. NULL entries in that array correspond to simple + * subexpressions that are handled as described above. + * ---------------- + */ +typedef struct ValuesScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprContext *rowcontext; + List **exprlists; + List **exprstatelists; + int array_len; + int curr_idx; +} ValuesScanState; + +/* ---------------- + * TableFuncScanState node + * + * Used in table-expression functions like XMLTABLE. + * ---------------- + */ +typedef struct TableFuncScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *docexpr; /* state for document expression */ + ExprState *rowexpr; /* state for row-generating expression */ + List *colexprs; /* state for column-generating expression */ + List *coldefexprs; /* state for column default expressions */ + List *colvalexprs; /* state for column value expressions */ + List *passingvalexprs; /* state for PASSING argument expressions */ + List *ns_names; /* same as TableFunc.ns_names */ + List *ns_uris; /* list of states of namespace URI exprs */ + Bitmapset *notnulls; /* nullability flag for each output column */ + void *opaque; /* table builder private space */ + const struct TableFuncRoutine *routine; /* table builder methods */ + FmgrInfo *in_functions; /* input function for each column */ + Oid *typioparams; /* typioparam for each column */ + int64 ordinal; /* row number to be output next */ + MemoryContext perTableCxt; /* per-table context */ + Tuplestorestate *tupstore; /* output tuple store */ +} TableFuncScanState; + +/* ---------------- + * CteScanState information + * + * CteScan nodes are used to scan a CommonTableExpr query. + * + * Multiple CteScan nodes can read out from the same CTE query. We use + * a tuplestore to hold rows that have been read from the CTE query but + * not yet consumed by all readers. + * ---------------- + */ +typedef struct CteScanState +{ + ScanState ss; /* its first field is NodeTag */ + int eflags; /* capability flags to pass to tuplestore */ + int readptr; /* index of my tuplestore read pointer */ + PlanState *cteplanstate; /* PlanState for the CTE query itself */ + /* Link to the "leader" CteScanState (possibly this same node) */ + struct CteScanState *leader; + /* The remaining fields are only valid in the "leader" CteScanState */ + Tuplestorestate *cte_table; /* rows already read from the CTE query */ + bool eof_cte; /* reached end of CTE query? */ +} CteScanState; + +/* ---------------- + * NamedTuplestoreScanState information + * + * NamedTuplestoreScan nodes are used to scan a Tuplestore created and + * named prior to execution of the query. An example is a transition + * table for an AFTER trigger. + * + * Multiple NamedTuplestoreScan nodes can read out from the same Tuplestore. + * ---------------- + */ +typedef struct NamedTuplestoreScanState +{ + ScanState ss; /* its first field is NodeTag */ + int readptr; /* index of my tuplestore read pointer */ + TupleDesc tupdesc; /* format of the tuples in the tuplestore */ + Tuplestorestate *relation; /* the rows */ +} NamedTuplestoreScanState; + +/* ---------------- + * WorkTableScanState information + * + * WorkTableScan nodes are used to scan the work table created by + * a RecursiveUnion node. We locate the RecursiveUnion node + * during executor startup. + * ---------------- + */ +typedef struct WorkTableScanState +{ + ScanState ss; /* its first field is NodeTag */ + RecursiveUnionState *rustate; +} WorkTableScanState; + +/* ---------------- + * ForeignScanState information + * + * ForeignScan nodes are used to scan foreign-data tables. + * ---------------- + */ +typedef struct ForeignScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *fdw_recheck_quals; /* original quals not in ss.ps.qual */ + Size pscan_len; /* size of parallel coordination information */ + ResultRelInfo *resultRelInfo; /* result rel info, if UPDATE or DELETE */ + /* use struct pointer to avoid including fdwapi.h here */ + struct FdwRoutine *fdwroutine; + void *fdw_state; /* foreign-data wrapper can keep state here */ +} ForeignScanState; + +/* ---------------- + * CustomScanState information + * + * CustomScan nodes are used to execute custom code within executor. + * + * Core code must avoid assuming that the CustomScanState is only as large as + * the structure declared here; providers are allowed to make it the first + * element in a larger structure, and typically would need to do so. The + * struct is actually allocated by the CreateCustomScanState method associated + * with the plan node. Any additional fields can be initialized there, or in + * the BeginCustomScan method. + * ---------------- + */ +struct CustomExecMethods; + +typedef struct CustomScanState +{ + ScanState ss; + uint32 flags; /* mask of CUSTOMPATH_* flags, see + * nodes/extensible.h */ + List *custom_ps; /* list of child PlanState nodes, if any */ + Size pscan_len; /* size of parallel coordination information */ + const struct CustomExecMethods *methods; + const struct TupleTableSlotOps *slotOps; +} CustomScanState; + +/* ---------------------------------------------------------------- + * Join State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * JoinState information + * + * Superclass for state nodes of join plans. + * ---------------- + */ +typedef struct JoinState +{ + PlanState ps; + JoinType jointype; + bool single_match; /* True if we should skip to next outer tuple + * after finding one inner match */ + ExprState *joinqual; /* JOIN quals (in addition to ps.qual) */ +} JoinState; + +/* ---------------- + * NestLoopState information + * + * NeedNewOuter true if need new outer tuple on next call + * MatchedOuter true if found a join match for current outer tuple + * NullInnerTupleSlot prepared null tuple for left outer joins + * ---------------- + */ +typedef struct NestLoopState +{ + JoinState js; /* its first field is NodeTag */ + bool nl_NeedNewOuter; + bool nl_MatchedOuter; + TupleTableSlot *nl_NullInnerTupleSlot; +} NestLoopState; + +/* ---------------- + * MergeJoinState information + * + * NumClauses number of mergejoinable join clauses + * Clauses info for each mergejoinable clause + * JoinState current state of ExecMergeJoin state machine + * SkipMarkRestore true if we may skip Mark and Restore operations + * ExtraMarks true to issue extra Mark operations on inner scan + * ConstFalseJoin true if we have a constant-false joinqual + * FillOuter true if should emit unjoined outer tuples anyway + * FillInner true if should emit unjoined inner tuples anyway + * MatchedOuter true if found a join match for current outer tuple + * MatchedInner true if found a join match for current inner tuple + * OuterTupleSlot slot in tuple table for cur outer tuple + * InnerTupleSlot slot in tuple table for cur inner tuple + * MarkedTupleSlot slot in tuple table for marked tuple + * NullOuterTupleSlot prepared null tuple for right outer joins + * NullInnerTupleSlot prepared null tuple for left outer joins + * OuterEContext workspace for computing outer tuple's join values + * InnerEContext workspace for computing inner tuple's join values + * ---------------- + */ +/* private in nodeMergejoin.c: */ +typedef struct MergeJoinClauseData *MergeJoinClause; + +typedef struct MergeJoinState +{ + JoinState js; /* its first field is NodeTag */ + int mj_NumClauses; + MergeJoinClause mj_Clauses; /* array of length mj_NumClauses */ + int mj_JoinState; + bool mj_SkipMarkRestore; + bool mj_ExtraMarks; + bool mj_ConstFalseJoin; + bool mj_FillOuter; + bool mj_FillInner; + bool mj_MatchedOuter; + bool mj_MatchedInner; + TupleTableSlot *mj_OuterTupleSlot; + TupleTableSlot *mj_InnerTupleSlot; + TupleTableSlot *mj_MarkedTupleSlot; + TupleTableSlot *mj_NullOuterTupleSlot; + TupleTableSlot *mj_NullInnerTupleSlot; + ExprContext *mj_OuterEContext; + ExprContext *mj_InnerEContext; +} MergeJoinState; + +/* ---------------- + * HashJoinState information + * + * hashclauses original form of the hashjoin condition + * hj_OuterHash ExprState for hashing outer keys + * hj_HashTable hash table for the hashjoin + * (NULL if table not built yet) + * hj_CurHashValue hash value for current outer tuple + * hj_CurBucketNo regular bucket# for current outer tuple + * hj_CurSkewBucketNo skew bucket# for current outer tuple + * hj_CurTuple last inner tuple matched to current outer + * tuple, or NULL if starting search + * (hj_CurXXX variables are undefined if + * OuterTupleSlot is empty!) + * hj_OuterTupleSlot tuple slot for outer tuples + * hj_HashTupleSlot tuple slot for inner (hashed) tuples + * hj_NullOuterTupleSlot prepared null tuple for right/right-anti/full + * outer joins + * hj_NullInnerTupleSlot prepared null tuple for left/full outer joins + * hj_FirstOuterTupleSlot first tuple retrieved from outer plan + * hj_JoinState current state of ExecHashJoin state machine + * hj_MatchedOuter true if found a join match for current outer + * hj_OuterNotEmpty true if outer relation known not empty + * ---------------- + */ + +/* these structs are defined in executor/hashjoin.h: */ +typedef struct HashJoinTupleData *HashJoinTuple; +typedef struct HashJoinTableData *HashJoinTable; + +typedef struct HashJoinState +{ + JoinState js; /* its first field is NodeTag */ + ExprState *hashclauses; + ExprState *hj_OuterHash; + HashJoinTable hj_HashTable; + uint32 hj_CurHashValue; + int hj_CurBucketNo; + int hj_CurSkewBucketNo; + HashJoinTuple hj_CurTuple; + TupleTableSlot *hj_OuterTupleSlot; + TupleTableSlot *hj_HashTupleSlot; + TupleTableSlot *hj_NullOuterTupleSlot; + TupleTableSlot *hj_NullInnerTupleSlot; + TupleTableSlot *hj_FirstOuterTupleSlot; + int hj_JoinState; + bool hj_MatchedOuter; + bool hj_OuterNotEmpty; +} HashJoinState; + + +/* ---------------------------------------------------------------- + * Materialization State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * MaterialState information + * + * materialize nodes are used to materialize the results + * of a subplan into a temporary file. + * + * ss.ss_ScanTupleSlot refers to output of underlying plan. + * ---------------- + */ +typedef struct MaterialState +{ + ScanState ss; /* its first field is NodeTag */ + int eflags; /* capability flags to pass to tuplestore */ + bool eof_underlying; /* reached end of underlying plan? */ + Tuplestorestate *tuplestorestate; +} MaterialState; + +struct MemoizeEntry; +struct MemoizeTuple; +struct MemoizeKey; + +typedef struct MemoizeInstrumentation +{ + uint64 cache_hits; /* number of rescans where we've found the + * scan parameter values to be cached */ + uint64 cache_misses; /* number of rescans where we've not found the + * scan parameter values to be cached. */ + uint64 cache_evictions; /* number of cache entries removed due to + * the need to free memory */ + uint64 cache_overflows; /* number of times we've had to bypass the + * cache when filling it due to not being + * able to free enough space to store the + * current scan's tuples. */ + uint64 mem_peak; /* peak memory usage in bytes */ +} MemoizeInstrumentation; + +/* ---------------- + * Shared memory container for per-worker memoize information + * ---------------- + */ +typedef struct SharedMemoizeInfo +{ + int num_workers; + MemoizeInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedMemoizeInfo; + +/* ---------------- + * MemoizeState information + * + * memoize nodes are used to cache recent and commonly seen results from + * a parameterized scan. + * ---------------- + */ +typedef struct MemoizeState +{ + ScanState ss; /* its first field is NodeTag */ + int mstatus; /* value of ExecMemoize state machine */ + int nkeys; /* number of cache keys */ + struct memoize_hash *hashtable; /* hash table for cache entries */ + TupleDesc hashkeydesc; /* tuple descriptor for cache keys */ + TupleTableSlot *tableslot; /* min tuple slot for existing cache entries */ + TupleTableSlot *probeslot; /* virtual slot used for hash lookups */ + ExprState *cache_eq_expr; /* Compare exec params to hash key */ + ExprState **param_exprs; /* exprs containing the parameters to this + * node */ + FmgrInfo *hashfunctions; /* lookup data for hash funcs nkeys in size */ + Oid *collations; /* collation for comparisons nkeys in size */ + uint64 mem_used; /* bytes of memory used by cache */ + uint64 mem_limit; /* memory limit in bytes for the cache */ + MemoryContext tableContext; /* memory context to store cache data */ + dlist_head lru_list; /* least recently used entry list */ + struct MemoizeTuple *last_tuple; /* Used to point to the last tuple + * returned during a cache hit and the + * tuple we last stored when + * populating the cache. */ + struct MemoizeEntry *entry; /* the entry that 'last_tuple' belongs to or + * NULL if 'last_tuple' is NULL. */ + bool singlerow; /* true if the cache entry is to be marked as + * complete after caching the first tuple. */ + bool binary_mode; /* true when cache key should be compared bit + * by bit, false when using hash equality ops */ + MemoizeInstrumentation stats; /* execution statistics */ + SharedMemoizeInfo *shared_info; /* statistics for parallel workers */ + Bitmapset *keyparamids; /* Param->paramids of expressions belonging to + * param_exprs */ +} MemoizeState; + +/* ---------------- + * When performing sorting by multiple keys, it's possible that the input + * dataset is already sorted on a prefix of those keys. We call these + * "presorted keys". + * PresortedKeyData represents information about one such key. + * ---------------- + */ +typedef struct PresortedKeyData +{ + FmgrInfo flinfo; /* comparison function info */ + FunctionCallInfo fcinfo; /* comparison function call info */ + OffsetNumber attno; /* attribute number in tuple */ +} PresortedKeyData; + +/* ---------------- + * Shared memory container for per-worker sort information + * ---------------- + */ +typedef struct SharedSortInfo +{ + int num_workers; + TuplesortInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedSortInfo; + +/* ---------------- + * SortState information + * ---------------- + */ +typedef struct SortState +{ + ScanState ss; /* its first field is NodeTag */ + bool randomAccess; /* need random access to sort output? */ + bool bounded; /* is the result set bounded? */ + int64 bound; /* if bounded, how many tuples are needed */ + bool sort_Done; /* sort completed yet? */ + bool bounded_Done; /* value of bounded we did the sort with */ + int64 bound_Done; /* value of bound we did the sort with */ + void *tuplesortstate; /* private state of tuplesort.c */ + bool am_worker; /* are we a worker? */ + bool datumSort; /* Datum sort instead of tuple sort? */ + SharedSortInfo *shared_info; /* one entry per worker */ +} SortState; + +/* ---------------- + * Instrumentation information for IncrementalSort + * ---------------- + */ +typedef struct IncrementalSortGroupInfo +{ + int64 groupCount; + int64 maxDiskSpaceUsed; + int64 totalDiskSpaceUsed; + int64 maxMemorySpaceUsed; + int64 totalMemorySpaceUsed; + bits32 sortMethods; /* bitmask of TuplesortMethod */ +} IncrementalSortGroupInfo; + +typedef struct IncrementalSortInfo +{ + IncrementalSortGroupInfo fullsortGroupInfo; + IncrementalSortGroupInfo prefixsortGroupInfo; +} IncrementalSortInfo; + +/* ---------------- + * Shared memory container for per-worker incremental sort information + * ---------------- + */ +typedef struct SharedIncrementalSortInfo +{ + int num_workers; + IncrementalSortInfo sinfo[FLEXIBLE_ARRAY_MEMBER]; +} SharedIncrementalSortInfo; + +/* ---------------- + * IncrementalSortState information + * ---------------- + */ +typedef enum +{ + INCSORT_LOADFULLSORT, + INCSORT_LOADPREFIXSORT, + INCSORT_READFULLSORT, + INCSORT_READPREFIXSORT, +} IncrementalSortExecutionStatus; + +typedef struct IncrementalSortState +{ + ScanState ss; /* its first field is NodeTag */ + bool bounded; /* is the result set bounded? */ + int64 bound; /* if bounded, how many tuples are needed */ + bool outerNodeDone; /* finished fetching tuples from outer node */ + int64 bound_Done; /* value of bound we did the sort with */ + IncrementalSortExecutionStatus execution_status; + int64 n_fullsort_remaining; + Tuplesortstate *fullsort_state; /* private state of tuplesort.c */ + Tuplesortstate *prefixsort_state; /* private state of tuplesort.c */ + /* the keys by which the input path is already sorted */ + PresortedKeyData *presorted_keys; + + IncrementalSortInfo incsort_info; + + /* slot for pivot tuple defining values of presorted keys within group */ + TupleTableSlot *group_pivot; + TupleTableSlot *transfer_tuple; + bool am_worker; /* are we a worker? */ + SharedIncrementalSortInfo *shared_info; /* one entry per worker */ +} IncrementalSortState; + +/* --------------------- + * GroupState information + * --------------------- + */ +typedef struct GroupState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *eqfunction; /* equality function */ + bool grp_done; /* indicates completion of Group scan */ +} GroupState; + +/* --------------------- + * per-worker aggregate information + * --------------------- + */ +typedef struct AggregateInstrumentation +{ + Size hash_mem_peak; /* peak hash table memory usage */ + uint64 hash_disk_used; /* kB of disk space used */ + int hash_batches_used; /* batches used during entire execution */ +} AggregateInstrumentation; + +/* ---------------- + * Shared memory container for per-worker aggregate information + * ---------------- + */ +typedef struct SharedAggInfo +{ + int num_workers; + AggregateInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedAggInfo; + +/* --------------------- + * AggState information + * + * ss.ss_ScanTupleSlot refers to output of underlying plan. + * + * Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and + * ecxt_aggnulls arrays, which hold the computed agg values for the current + * input group during evaluation of an Agg node's output tuple(s). We + * create a second ExprContext, tmpcontext, in which to evaluate input + * expressions and run the aggregate transition functions. + * --------------------- + */ +/* these structs are private in nodeAgg.c: */ +typedef struct AggStatePerAggData *AggStatePerAgg; +typedef struct AggStatePerTransData *AggStatePerTrans; +typedef struct AggStatePerGroupData *AggStatePerGroup; +typedef struct AggStatePerPhaseData *AggStatePerPhase; +typedef struct AggStatePerHashData *AggStatePerHash; + +typedef struct AggState +{ + ScanState ss; /* its first field is NodeTag */ + List *aggs; /* all Aggref nodes in targetlist & quals */ + int numaggs; /* length of list (could be zero!) */ + int numtrans; /* number of pertrans items */ + AggStrategy aggstrategy; /* strategy mode */ + AggSplit aggsplit; /* agg-splitting mode, see nodes.h */ + AggStatePerPhase phase; /* pointer to current phase data */ + int numphases; /* number of phases (including phase 0) */ + int current_phase; /* current phase number */ + AggStatePerAgg peragg; /* per-Aggref information */ + AggStatePerTrans pertrans; /* per-Trans state information */ + ExprContext *hashcontext; /* econtexts for long-lived data (hashtable) */ + ExprContext **aggcontexts; /* econtexts for long-lived data (per GS) */ + ExprContext *tmpcontext; /* econtext for input expressions */ +#define FIELDNO_AGGSTATE_CURAGGCONTEXT 14 + ExprContext *curaggcontext; /* currently active aggcontext */ + AggStatePerAgg curperagg; /* currently active aggregate, if any */ +#define FIELDNO_AGGSTATE_CURPERTRANS 16 + AggStatePerTrans curpertrans; /* currently active trans state, if any */ + bool input_done; /* indicates end of input */ + bool agg_done; /* indicates completion of Agg scan */ + int projected_set; /* The last projected grouping set */ +#define FIELDNO_AGGSTATE_CURRENT_SET 20 + int current_set; /* The current grouping set being evaluated */ + Bitmapset *grouped_cols; /* grouped cols in current projection */ + List *all_grouped_cols; /* list of all grouped cols in DESC order */ + Bitmapset *colnos_needed; /* all columns needed from the outer plan */ + int max_colno_needed; /* highest colno needed from outer plan */ + bool all_cols_needed; /* are all cols from outer plan needed? */ + /* These fields are for grouping set phase data */ + int maxsets; /* The max number of sets in any phase */ + AggStatePerPhase phases; /* array of all phases */ + Tuplesortstate *sort_in; /* sorted input to phases > 1 */ + Tuplesortstate *sort_out; /* input is copied here for next phase */ + TupleTableSlot *sort_slot; /* slot for sort results */ + /* these fields are used in AGG_PLAIN and AGG_SORTED modes: */ + AggStatePerGroup *pergroups; /* grouping set indexed array of per-group + * pointers */ + HeapTuple grp_firstTuple; /* copy of first tuple of current group */ + /* these fields are used in AGG_HASHED and AGG_MIXED modes: */ + bool table_filled; /* hash table filled yet? */ + int num_hashes; + MemoryContext hash_metacxt; /* memory for hash table bucket array */ + MemoryContext hash_tablecxt; /* memory for hash table entries */ + struct LogicalTapeSet *hash_tapeset; /* tape set for hash spill tapes */ + struct HashAggSpill *hash_spills; /* HashAggSpill for each grouping set, + * exists only during first pass */ + TupleTableSlot *hash_spill_rslot; /* for reading spill files */ + TupleTableSlot *hash_spill_wslot; /* for writing spill files */ + List *hash_batches; /* hash batches remaining to be processed */ + bool hash_ever_spilled; /* ever spilled during this execution? */ + bool hash_spill_mode; /* we hit a limit during the current batch + * and we must not create new groups */ + Size hash_mem_limit; /* limit before spilling hash table */ + uint64 hash_ngroups_limit; /* limit before spilling hash table */ + int hash_planned_partitions; /* number of partitions planned + * for first pass */ + double hashentrysize; /* estimate revised during execution */ + Size hash_mem_peak; /* peak hash table memory usage */ + uint64 hash_ngroups_current; /* number of groups currently in + * memory in all hash tables */ + uint64 hash_disk_used; /* kB of disk space used */ + int hash_batches_used; /* batches used during entire execution */ + + AggStatePerHash perhash; /* array of per-hashtable data */ + AggStatePerGroup *hash_pergroup; /* grouping set indexed array of + * per-group pointers */ + + /* support for evaluation of agg input expressions: */ +#define FIELDNO_AGGSTATE_ALL_PERGROUPS 54 + AggStatePerGroup *all_pergroups; /* array of first ->pergroups, than + * ->hash_pergroup */ + SharedAggInfo *shared_info; /* one entry per worker */ +} AggState; + +/* ---------------- + * WindowAggState information + * ---------------- + */ +/* these structs are private in nodeWindowAgg.c: */ +typedef struct WindowStatePerFuncData *WindowStatePerFunc; +typedef struct WindowStatePerAggData *WindowStatePerAgg; + +/* + * WindowAggStatus -- Used to track the status of WindowAggState + */ +typedef enum WindowAggStatus +{ + WINDOWAGG_DONE, /* No more processing to do */ + WINDOWAGG_RUN, /* Normal processing of window funcs */ + WINDOWAGG_PASSTHROUGH, /* Don't eval window funcs */ + WINDOWAGG_PASSTHROUGH_STRICT, /* Pass-through plus don't store new + * tuples during spool */ +} WindowAggStatus; + +typedef struct WindowAggState +{ + ScanState ss; /* its first field is NodeTag */ + + /* these fields are filled in by ExecInitExpr: */ + List *funcs; /* all WindowFunc nodes in targetlist */ + int numfuncs; /* total number of window functions */ + int numaggs; /* number that are plain aggregates */ + + WindowStatePerFunc perfunc; /* per-window-function information */ + WindowStatePerAgg peragg; /* per-plain-aggregate information */ + ExprState *partEqfunction; /* equality funcs for partition columns */ + ExprState *ordEqfunction; /* equality funcs for ordering columns */ + Tuplestorestate *buffer; /* stores rows of current partition */ + int current_ptr; /* read pointer # for current row */ + int framehead_ptr; /* read pointer # for frame head, if used */ + int frametail_ptr; /* read pointer # for frame tail, if used */ + int grouptail_ptr; /* read pointer # for group tail, if used */ + int64 spooled_rows; /* total # of rows in buffer */ + int64 currentpos; /* position of current row in partition */ + int64 frameheadpos; /* current frame head position */ + int64 frametailpos; /* current frame tail position (frame end+1) */ + /* use struct pointer to avoid including windowapi.h here */ + struct WindowObjectData *agg_winobj; /* winobj for aggregate fetches */ + int64 aggregatedbase; /* start row for current aggregates */ + int64 aggregatedupto; /* rows before this one are aggregated */ + WindowAggStatus status; /* run status of WindowAggState */ + + int frameOptions; /* frame_clause options, see WindowDef */ + ExprState *startOffset; /* expression for starting bound offset */ + ExprState *endOffset; /* expression for ending bound offset */ + Datum startOffsetValue; /* result of startOffset evaluation */ + Datum endOffsetValue; /* result of endOffset evaluation */ + + /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */ + FmgrInfo startInRangeFunc; /* in_range function for startOffset */ + FmgrInfo endInRangeFunc; /* in_range function for endOffset */ + Oid inRangeColl; /* collation for in_range tests */ + bool inRangeAsc; /* use ASC sort order for in_range tests? */ + bool inRangeNullsFirst; /* nulls sort first for in_range tests? */ + + /* fields relating to runconditions */ + bool use_pass_through; /* When false, stop execution when + * runcondition is no longer true. Else + * just stop evaluating window funcs. */ + bool top_window; /* true if this is the top-most WindowAgg or + * the only WindowAgg in this query level */ + ExprState *runcondition; /* Condition which must remain true otherwise + * execution of the WindowAgg will finish or + * go into pass-through mode. NULL when there + * is no such condition. */ + + /* these fields are used in GROUPS mode: */ + int64 currentgroup; /* peer group # of current row in partition */ + int64 frameheadgroup; /* peer group # of frame head row */ + int64 frametailgroup; /* peer group # of frame tail row */ + int64 groupheadpos; /* current row's peer group head position */ + int64 grouptailpos; /* " " " " tail position (group end+1) */ + + MemoryContext partcontext; /* context for partition-lifespan data */ + MemoryContext aggcontext; /* shared context for aggregate working data */ + MemoryContext curaggcontext; /* current aggregate's working data */ + ExprContext *tmpcontext; /* short-term evaluation context */ + + bool all_first; /* true if the scan is starting */ + bool partition_spooled; /* true if all tuples in current partition + * have been spooled into tuplestore */ + bool next_partition; /* true if begin_partition needs to be called */ + bool more_partitions; /* true if there's more partitions after + * this one */ + bool framehead_valid; /* true if frameheadpos is known up to + * date for current row */ + bool frametail_valid; /* true if frametailpos is known up to + * date for current row */ + bool grouptail_valid; /* true if grouptailpos is known up to + * date for current row */ + + TupleTableSlot *first_part_slot; /* first tuple of current or next + * partition */ + TupleTableSlot *framehead_slot; /* first tuple of current frame */ + TupleTableSlot *frametail_slot; /* first tuple after current frame */ + + /* temporary slots for tuples fetched back from tuplestore */ + TupleTableSlot *agg_row_slot; + TupleTableSlot *temp_slot_1; + TupleTableSlot *temp_slot_2; +} WindowAggState; + +/* ---------------- + * UniqueState information + * + * Unique nodes are used "on top of" sort nodes to discard + * duplicate tuples returned from the sort phase. Basically + * all it does is compare the current tuple from the subplan + * with the previously fetched tuple (stored in its result slot). + * If the two are identical in all interesting fields, then + * we just fetch another tuple from the sort and try again. + * ---------------- + */ +typedef struct UniqueState +{ + PlanState ps; /* its first field is NodeTag */ + ExprState *eqfunction; /* tuple equality qual */ +} UniqueState; + +/* ---------------- + * GatherState information + * + * Gather nodes launch 1 or more parallel workers, run a subplan + * in those workers, and collect the results. + * ---------------- + */ +typedef struct GatherState +{ + PlanState ps; /* its first field is NodeTag */ + bool initialized; /* workers launched? */ + bool need_to_scan_locally; /* need to read from local plan? */ + int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */ + /* these fields are set up once: */ + TupleTableSlot *funnel_slot; + struct ParallelExecutorInfo *pei; + /* all remaining fields are reinitialized during a rescan: */ + int nworkers_launched; /* original number of workers */ + int nreaders; /* number of still-active workers */ + int nextreader; /* next one to try to read from */ + struct TupleQueueReader **reader; /* array with nreaders active entries */ +} GatherState; + +/* ---------------- + * GatherMergeState information + * + * Gather merge nodes launch 1 or more parallel workers, run a + * subplan which produces sorted output in each worker, and then + * merge the results into a single sorted stream. + * ---------------- + */ +struct GMReaderTupleBuffer; /* private in nodeGatherMerge.c */ + +typedef struct GatherMergeState +{ + PlanState ps; /* its first field is NodeTag */ + bool initialized; /* workers launched? */ + bool gm_initialized; /* gather_merge_init() done? */ + bool need_to_scan_locally; /* need to read from local plan? */ + int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */ + /* these fields are set up once: */ + TupleDesc tupDesc; /* descriptor for subplan result tuples */ + int gm_nkeys; /* number of sort columns */ + SortSupport gm_sortkeys; /* array of length gm_nkeys */ + struct ParallelExecutorInfo *pei; + /* all remaining fields are reinitialized during a rescan */ + /* (but the arrays are not reallocated, just cleared) */ + int nworkers_launched; /* original number of workers */ + int nreaders; /* number of active workers */ + TupleTableSlot **gm_slots; /* array with nreaders+1 entries */ + struct TupleQueueReader **reader; /* array with nreaders active entries */ + struct GMReaderTupleBuffer *gm_tuple_buffers; /* nreaders tuple buffers */ + struct binaryheap *gm_heap; /* binary heap of slot indices */ +} GatherMergeState; + +/* ---------------- + * Values displayed by EXPLAIN ANALYZE + * ---------------- + */ +typedef struct HashInstrumentation +{ + int nbuckets; /* number of buckets at end of execution */ + int nbuckets_original; /* planned number of buckets */ + int nbatch; /* number of batches at end of execution */ + int nbatch_original; /* planned number of batches */ + Size space_peak; /* peak memory usage in bytes */ +} HashInstrumentation; + +/* ---------------- + * Shared memory container for per-worker hash information + * ---------------- + */ +typedef struct SharedHashInfo +{ + int num_workers; + HashInstrumentation hinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedHashInfo; + +/* ---------------- + * HashState information + * ---------------- + */ +typedef struct HashState +{ + PlanState ps; /* its first field is NodeTag */ + HashJoinTable hashtable; /* hash table for the hashjoin */ + ExprState *hash_expr; /* ExprState to get hash value */ + + FmgrInfo *skew_hashfunction; /* lookup data for skew hash function */ + Oid skew_collation; /* collation to call skew_hashfunction with */ + + /* + * In a parallelized hash join, the leader retains a pointer to the + * shared-memory stats area in its shared_info field, and then copies the + * shared-memory info back to local storage before DSM shutdown. The + * shared_info field remains NULL in workers, or in non-parallel joins. + */ + SharedHashInfo *shared_info; + + /* + * If we are collecting hash stats, this points to an initially-zeroed + * collection area, which could be either local storage or in shared + * memory; either way it's for just one process. + */ + HashInstrumentation *hinstrument; + + /* Parallel hash state. */ + struct ParallelHashJoinState *parallel_state; +} HashState; + +/* ---------------- + * SetOpState information + * + * SetOp nodes support either sorted or hashed de-duplication. + * The sorted mode is a bit like MergeJoin, the hashed mode like Agg. + * ---------------- + */ +typedef struct SetOpStatePerInput +{ + TupleTableSlot *firstTupleSlot; /* first tuple of current group */ + int64 numTuples; /* number of tuples in current group */ + TupleTableSlot *nextTupleSlot; /* next input tuple, if already read */ + bool needGroup; /* do we need to load a new group? */ +} SetOpStatePerInput; + +typedef struct SetOpState +{ + PlanState ps; /* its first field is NodeTag */ + bool setop_done; /* indicates completion of output scan */ + int64 numOutput; /* number of dups left to output */ + int numCols; /* number of grouping columns */ + + /* these fields are used in SETOP_SORTED mode: */ + SortSupport sortKeys; /* per-grouping-field sort data */ + SetOpStatePerInput leftInput; /* current outer-relation input state */ + SetOpStatePerInput rightInput; /* current inner-relation input state */ + bool need_init; /* have we read the first tuples yet? */ + + /* these fields are used in SETOP_HASHED mode: */ + Oid *eqfuncoids; /* per-grouping-field equality fns */ + FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ + TupleHashTable hashtable; /* hash table with one entry per group */ + MemoryContext tableContext; /* memory context containing hash table */ + bool table_filled; /* hash table filled yet? */ + TupleHashIterator hashiter; /* for iterating through hash table */ +} SetOpState; + +/* ---------------- + * LockRowsState information + * + * LockRows nodes are used to enforce FOR [KEY] UPDATE/SHARE locking. + * ---------------- + */ +typedef struct LockRowsState +{ + PlanState ps; /* its first field is NodeTag */ + List *lr_arowMarks; /* List of ExecAuxRowMarks */ + EPQState lr_epqstate; /* for evaluating EvalPlanQual rechecks */ +} LockRowsState; + +/* ---------------- + * LimitState information + * + * Limit nodes are used to enforce LIMIT/OFFSET clauses. + * They just select the desired subrange of their subplan's output. + * + * offset is the number of initial tuples to skip (0 does nothing). + * count is the number of tuples to return after skipping the offset tuples. + * If no limit count was specified, count is undefined and noCount is true. + * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet. + * ---------------- + */ +typedef enum +{ + LIMIT_INITIAL, /* initial state for LIMIT node */ + LIMIT_RESCAN, /* rescan after recomputing parameters */ + LIMIT_EMPTY, /* there are no returnable rows */ + LIMIT_INWINDOW, /* have returned a row in the window */ + LIMIT_WINDOWEND_TIES, /* have returned a tied row */ + LIMIT_SUBPLANEOF, /* at EOF of subplan (within window) */ + LIMIT_WINDOWEND, /* stepped off end of window */ + LIMIT_WINDOWSTART, /* stepped off beginning of window */ +} LimitStateCond; + +typedef struct LimitState +{ + PlanState ps; /* its first field is NodeTag */ + ExprState *limitOffset; /* OFFSET parameter, or NULL if none */ + ExprState *limitCount; /* COUNT parameter, or NULL if none */ + LimitOption limitOption; /* limit specification type */ + int64 offset; /* current OFFSET value */ + int64 count; /* current COUNT, if any */ + bool noCount; /* if true, ignore count */ + LimitStateCond lstate; /* state machine status, as above */ + int64 position; /* 1-based index of last tuple returned */ + TupleTableSlot *subSlot; /* tuple last obtained from subplan */ + ExprState *eqfunction; /* tuple equality qual in case of WITH TIES + * option */ + TupleTableSlot *last_slot; /* slot for evaluation of ties */ +} LimitState; + +#endif /* EXECNODES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/extensible.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/extensible.h new file mode 100644 index 0000000..1129c4b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/extensible.h @@ -0,0 +1,164 @@ +/*------------------------------------------------------------------------- + * + * extensible.h + * Definitions for extensible nodes and custom scans + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/extensible.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXTENSIBLE_H +#define EXTENSIBLE_H + +#include "access/parallel.h" +#include "commands/explain_state.h" +#include "nodes/execnodes.h" +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + +/* maximum length of an extensible node identifier */ +#define EXTNODENAME_MAX_LEN 64 + +/* + * An extensible node is a new type of node defined by an extension. The + * type is always T_ExtensibleNode, while the extnodename identifies the + * specific type of node. extnodename can be looked up to find the + * ExtensibleNodeMethods for this node type. + */ +typedef struct ExtensibleNode +{ + pg_node_attr(custom_copy_equal, custom_read_write) + + NodeTag type; + const char *extnodename; /* identifier of ExtensibleNodeMethods */ +} ExtensibleNode; + +/* + * node_size is the size of an extensible node of this type in bytes. + * + * nodeCopy is a function which performs a deep copy from oldnode to newnode. + * It does not need to copy type or extnodename, which are copied by the + * core system. + * + * nodeEqual is a function which performs a deep equality comparison between + * a and b and returns true or false accordingly. It does not need to compare + * type or extnodename, which are compared by the core system. + * + * nodeOut is a serialization function for the node type. It should use the + * output conventions typical for outfuncs.c. It does not need to output + * type or extnodename; the core system handles those. + * + * nodeRead is a deserialization function for the node type. It does not need + * to read type or extnodename; the core system handles those. It should fetch + * the next token using pg_strtok() from the current input stream, and then + * reconstruct the private fields according to the manner in readfuncs.c. + * + * All callbacks are mandatory. + */ +typedef struct ExtensibleNodeMethods +{ + const char *extnodename; + Size node_size; + void (*nodeCopy) (struct ExtensibleNode *newnode, + const struct ExtensibleNode *oldnode); + bool (*nodeEqual) (const struct ExtensibleNode *a, + const struct ExtensibleNode *b); + void (*nodeOut) (struct StringInfoData *str, + const struct ExtensibleNode *node); + void (*nodeRead) (struct ExtensibleNode *node); +} ExtensibleNodeMethods; + +extern void RegisterExtensibleNodeMethods(const ExtensibleNodeMethods *methods); +extern const ExtensibleNodeMethods *GetExtensibleNodeMethods(const char *extnodename, + bool missing_ok); + +/* + * Flags for custom paths, indicating what capabilities the resulting scan + * will have. The flags fields of CustomPath and CustomScan nodes are + * bitmasks of these flags. + */ +#define CUSTOMPATH_SUPPORT_BACKWARD_SCAN 0x0001 +#define CUSTOMPATH_SUPPORT_MARK_RESTORE 0x0002 +#define CUSTOMPATH_SUPPORT_PROJECTION 0x0004 + +/* + * Custom path methods. Mostly, we just need to know how to convert a + * CustomPath to a plan. + */ +typedef struct CustomPathMethods +{ + const char *CustomName; + + /* Convert Path to a Plan */ + struct Plan *(*PlanCustomPath) (PlannerInfo *root, + RelOptInfo *rel, + struct CustomPath *best_path, + List *tlist, + List *clauses, + List *custom_plans); + struct List *(*ReparameterizeCustomPathByChild) (PlannerInfo *root, + List *custom_private, + RelOptInfo *child_rel); +} CustomPathMethods; + +/* + * Custom scan. Here again, there's not much to do: we need to be able to + * generate a ScanState corresponding to the scan. + */ +typedef struct CustomScanMethods +{ + const char *CustomName; + + /* Create execution state (CustomScanState) from a CustomScan plan node */ + Node *(*CreateCustomScanState) (CustomScan *cscan); +} CustomScanMethods; + +/* + * Execution-time methods for a CustomScanState. This is more complex than + * what we need for a custom path or scan. + */ +typedef struct CustomExecMethods +{ + const char *CustomName; + + /* Required executor methods */ + void (*BeginCustomScan) (CustomScanState *node, + EState *estate, + int eflags); + TupleTableSlot *(*ExecCustomScan) (CustomScanState *node); + void (*EndCustomScan) (CustomScanState *node); + void (*ReScanCustomScan) (CustomScanState *node); + + /* Optional methods: needed if mark/restore is supported */ + void (*MarkPosCustomScan) (CustomScanState *node); + void (*RestrPosCustomScan) (CustomScanState *node); + + /* Optional methods: needed if parallel execution is supported */ + Size (*EstimateDSMCustomScan) (CustomScanState *node, + ParallelContext *pcxt); + void (*InitializeDSMCustomScan) (CustomScanState *node, + ParallelContext *pcxt, + void *coordinate); + void (*ReInitializeDSMCustomScan) (CustomScanState *node, + ParallelContext *pcxt, + void *coordinate); + void (*InitializeWorkerCustomScan) (CustomScanState *node, + shm_toc *toc, + void *coordinate); + void (*ShutdownCustomScan) (CustomScanState *node); + + /* Optional: print additional information in EXPLAIN */ + void (*ExplainCustomScan) (CustomScanState *node, + List *ancestors, + ExplainState *es); +} CustomExecMethods; + +extern void RegisterCustomScanMethods(const CustomScanMethods *methods); +extern const CustomScanMethods *GetCustomScanMethods(const char *CustomName, + bool missing_ok); + +#endif /* EXTENSIBLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/lockoptions.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/lockoptions.h new file mode 100644 index 0000000..0b534e3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/lockoptions.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * lockoptions.h + * Common header for some locking-related declarations. + * + * + * Copyright (c) 2014-2025, PostgreSQL Global Development Group + * + * src/include/nodes/lockoptions.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOCKOPTIONS_H +#define LOCKOPTIONS_H + +/* + * This enum represents the different strengths of FOR UPDATE/SHARE clauses. + * The ordering here is important, because the highest numerical value takes + * precedence when a RTE is specified multiple ways. See applyLockingClause. + */ +typedef enum LockClauseStrength +{ + LCS_NONE, /* no such clause - only used in PlanRowMark */ + LCS_FORKEYSHARE, /* FOR KEY SHARE */ + LCS_FORSHARE, /* FOR SHARE */ + LCS_FORNOKEYUPDATE, /* FOR NO KEY UPDATE */ + LCS_FORUPDATE, /* FOR UPDATE */ +} LockClauseStrength; + +/* + * This enum controls how to deal with rows being locked by FOR UPDATE/SHARE + * clauses (i.e., it represents the NOWAIT and SKIP LOCKED options). + * The ordering here is important, because the highest numerical value takes + * precedence when a RTE is specified multiple ways. See applyLockingClause. + */ +typedef enum LockWaitPolicy +{ + /* Wait for the lock to become available (default behavior) */ + LockWaitBlock, + /* Skip rows that can't be locked (SKIP LOCKED) */ + LockWaitSkip, + /* Raise an error if a row cannot be locked (NOWAIT) */ + LockWaitError, +} LockWaitPolicy; + +/* + * Possible lock modes for a tuple. + */ +typedef enum LockTupleMode +{ + /* SELECT FOR KEY SHARE */ + LockTupleKeyShare, + /* SELECT FOR SHARE */ + LockTupleShare, + /* SELECT FOR NO KEY UPDATE, and UPDATEs that don't modify key columns */ + LockTupleNoKeyExclusive, + /* SELECT FOR UPDATE, UPDATEs that modify key columns, and DELETE */ + LockTupleExclusive, +} LockTupleMode; + +#endif /* LOCKOPTIONS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/makefuncs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/makefuncs.h new file mode 100644 index 0000000..5473ce9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/makefuncs.h @@ -0,0 +1,128 @@ +/*------------------------------------------------------------------------- + * + * makefuncs.h + * prototypes for the creator functions of various nodes + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/makefuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef MAKEFUNC_H +#define MAKEFUNC_H + +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" + + +extern A_Expr *makeA_Expr(A_Expr_Kind kind, List *name, + Node *lexpr, Node *rexpr, int location); + +extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, char *name, + Node *lexpr, Node *rexpr, int location); + +extern Var *makeVar(int varno, + AttrNumber varattno, + Oid vartype, + int32 vartypmod, + Oid varcollid, + Index varlevelsup); + +extern Var *makeVarFromTargetEntry(int varno, + TargetEntry *tle); + +extern Var *makeWholeRowVar(RangeTblEntry *rte, + int varno, + Index varlevelsup, + bool allowScalar); + +extern TargetEntry *makeTargetEntry(Expr *expr, + AttrNumber resno, + char *resname, + bool resjunk); + +extern TargetEntry *flatCopyTargetEntry(TargetEntry *src_tle); + +extern FromExpr *makeFromExpr(List *fromlist, Node *quals); + +extern Const *makeConst(Oid consttype, + int32 consttypmod, + Oid constcollid, + int constlen, + Datum constvalue, + bool constisnull, + bool constbyval); + +extern Const *makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid); + +extern Node *makeBoolConst(bool value, bool isnull); + +extern Expr *makeBoolExpr(BoolExprType boolop, List *args, int location); + +extern Alias *makeAlias(const char *aliasname, List *colnames); + +extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, + Oid rcollid, CoercionForm rformat); + +extern RangeVar *makeRangeVar(char *schemaname, char *relname, int location); +extern Constraint *makeNotNullConstraint(String *colname); + +extern TypeName *makeTypeName(char *typnam); +extern TypeName *makeTypeNameFromNameList(List *names); +extern TypeName *makeTypeNameFromOid(Oid typeOid, int32 typmod); + +extern ColumnDef *makeColumnDef(const char *colname, + Oid typeOid, int32 typmod, Oid collOid); + +extern FuncExpr *makeFuncExpr(Oid funcid, Oid rettype, List *args, + Oid funccollid, Oid inputcollid, CoercionForm fformat); + +extern FuncCall *makeFuncCall(List *name, List *args, + CoercionForm funcformat, int location); + +extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset, + Expr *leftop, Expr *rightop, + Oid opcollid, Oid inputcollid); + +extern Expr *make_andclause(List *andclauses); +extern Expr *make_orclause(List *orclauses); +extern Expr *make_notclause(Expr *notclause); + +extern Node *make_and_qual(Node *qual1, Node *qual2); +extern Expr *make_ands_explicit(List *andclauses); +extern List *make_ands_implicit(Expr *clause); + +extern IndexInfo *makeIndexInfo(int numattrs, int numkeyattrs, Oid amoid, + List *expressions, List *predicates, + bool unique, bool nulls_not_distinct, + bool isready, bool concurrent, + bool summarizing, bool withoutoverlaps); + +extern Node *makeStringConst(char *str, int location); +extern DefElem *makeDefElem(char *name, Node *arg, int location); +extern DefElem *makeDefElemExtended(char *nameSpace, char *name, Node *arg, + DefElemAction defaction, int location); + +extern GroupingSet *makeGroupingSet(GroupingSetKind kind, List *content, int location); + +extern VacuumRelation *makeVacuumRelation(RangeVar *relation, Oid oid, List *va_cols); + +extern JsonFormat *makeJsonFormat(JsonFormatType type, JsonEncoding encoding, + int location); +extern JsonValueExpr *makeJsonValueExpr(Expr *raw_expr, Expr *formatted_expr, + JsonFormat *format); +extern Node *makeJsonKeyValue(Node *key, Node *value); +extern Node *makeJsonIsPredicate(Node *expr, JsonFormat *format, + JsonValueType item_type, bool unique_keys, + int location); +extern JsonBehavior *makeJsonBehavior(JsonBehaviorType btype, Node *expr, + int location); +extern JsonTablePath *makeJsonTablePath(Const *pathvalue, char *pathname); +extern JsonTablePathSpec *makeJsonTablePathSpec(char *string, char *name, + int string_location, + int name_location); + +#endif /* MAKEFUNC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/memnodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/memnodes.h new file mode 100644 index 0000000..5807ef8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/memnodes.h @@ -0,0 +1,152 @@ +/*------------------------------------------------------------------------- + * + * memnodes.h + * POSTGRES memory context node definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/memnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef MEMNODES_H +#define MEMNODES_H + +#include "nodes/nodes.h" + +/* + * MemoryContextCounters + * Summarization state for MemoryContextStats collection. + * + * The set of counters in this struct is biased towards AllocSet; if we ever + * add any context types that are based on fundamentally different approaches, + * we might need more or different counters here. A possible API spec then + * would be to print only nonzero counters, but for now we just summarize in + * the format historically used by AllocSet. + */ +typedef struct MemoryContextCounters +{ + Size nblocks; /* Total number of malloc blocks */ + Size freechunks; /* Total number of free chunks */ + Size totalspace; /* Total bytes requested from malloc */ + Size freespace; /* The unused portion of totalspace */ +} MemoryContextCounters; + +/* + * MemoryContext + * A logical context in which memory allocations occur. + * + * MemoryContext itself is an abstract type that can have multiple + * implementations. + * The function pointers in MemoryContextMethods define one specific + * implementation of MemoryContext --- they are a virtual function table + * in C++ terms. + * + * Node types that are actual implementations of memory contexts must + * begin with the same fields as MemoryContextData. + * + * Note: for largely historical reasons, typedef MemoryContext is a pointer + * to the context struct rather than the struct type itself. + */ + +typedef void (*MemoryStatsPrintFunc) (MemoryContext context, void *passthru, + const char *stats_string, + bool print_to_stderr); + +typedef struct MemoryContextMethods +{ + /* + * Function to handle memory allocation requests of 'size' to allocate + * memory into the given 'context'. The function must handle flags + * MCXT_ALLOC_HUGE and MCXT_ALLOC_NO_OOM. MCXT_ALLOC_ZERO is handled by + * the calling function. + */ + void *(*alloc) (MemoryContext context, Size size, int flags); + + /* call this free_p in case someone #define's free() */ + void (*free_p) (void *pointer); + + /* + * Function to handle a size change request for an existing allocation. + * The implementation must handle flags MCXT_ALLOC_HUGE and + * MCXT_ALLOC_NO_OOM. MCXT_ALLOC_ZERO is handled by the calling function. + */ + void *(*realloc) (void *pointer, Size size, int flags); + + /* + * Invalidate all previous allocations in the given memory context and + * prepare the context for a new set of allocations. Implementations may + * optionally free() excess memory back to the OS during this time. + */ + void (*reset) (MemoryContext context); + + /* Free all memory consumed by the given MemoryContext. */ + void (*delete_context) (MemoryContext context); + + /* Return the MemoryContext that the given pointer belongs to. */ + MemoryContext (*get_chunk_context) (void *pointer); + + /* + * Return the number of bytes consumed by the given pointer within its + * memory context, including the overhead of alignment and chunk headers. + */ + Size (*get_chunk_space) (void *pointer); + + /* + * Return true if the given MemoryContext has not had any allocations + * since it was created or last reset. + */ + bool (*is_empty) (MemoryContext context); + void (*stats) (MemoryContext context, + MemoryStatsPrintFunc printfunc, void *passthru, + MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING + + /* + * Perform validation checks on the given context and raise any discovered + * anomalies as WARNINGs. + */ + void (*check) (MemoryContext context); +#endif +} MemoryContextMethods; + + +typedef struct MemoryContextData +{ + pg_node_attr(abstract) /* there are no nodes of this type */ + + NodeTag type; /* identifies exact kind of context */ + /* these two fields are placed here to minimize alignment wastage: */ + bool isReset; /* T = no space alloced since last reset */ + bool allowInCritSection; /* allow palloc in critical section */ + Size mem_allocated; /* track memory allocated for this context */ + const MemoryContextMethods *methods; /* virtual function table */ + MemoryContext parent; /* NULL if no parent (toplevel context) */ + MemoryContext firstchild; /* head of linked list of children */ + MemoryContext prevchild; /* previous child of same parent */ + MemoryContext nextchild; /* next child of same parent */ + const char *name; /* context name */ + const char *ident; /* context ID if any */ + MemoryContextCallback *reset_cbs; /* list of reset/delete callbacks */ +} MemoryContextData; + +/* utils/palloc.h contains typedef struct MemoryContextData *MemoryContext */ + + +/* + * MemoryContextIsValid + * True iff memory context is valid. + * + * Add new context types to the set accepted by this macro. + */ +#define MemoryContextIsValid(context) \ + ((context) != NULL && \ + (IsA((context), AllocSetContext) || \ + IsA((context), SlabContext) || \ + IsA((context), GenerationContext) || \ + IsA((context), BumpContext))) + +#endif /* MEMNODES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/miscnodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/miscnodes.h new file mode 100644 index 0000000..bbd1a43 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/miscnodes.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * miscnodes.h + * Definitions for hard-to-classify node types. + * + * Node types declared here are not part of parse trees, plan trees, + * or execution state trees. We only assign them NodeTag values because + * IsA() tests provide a convenient way to disambiguate what kind of + * structure is being passed through assorted APIs, such as function + * "context" pointers. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/miscnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef MISCNODES_H +#define MISCNODES_H + +#include "nodes/nodes.h" + +/* + * ErrorSaveContext - + * function call context node for handling of "soft" errors + * + * A caller wishing to trap soft errors must initialize a struct like this + * with all fields zero/NULL except for the NodeTag. Optionally, set + * details_wanted = true if more than the bare knowledge that a soft error + * occurred is required. The struct is then passed to a SQL-callable function + * via the FunctionCallInfo.context field; or below the level of SQL calls, + * it could be passed to a subroutine directly. + * + * After calling code that might report an error this way, check + * error_occurred to see if an error happened. If so, and if details_wanted + * is true, error_data has been filled with error details (stored in the + * callee's memory context!). The ErrorData can be modified (e.g. downgraded + * to a WARNING) and reported with ThrowErrorData(). FreeErrorData() can be + * called to release error_data, although that step is typically not necessary + * if the called code was run in a short-lived context. + */ +typedef struct ErrorSaveContext +{ + NodeTag type; + bool error_occurred; /* set to true if we detect a soft error */ + bool details_wanted; /* does caller want more info than that? */ + ErrorData *error_data; /* details of error, if so */ +} ErrorSaveContext; + +/* Often-useful macro for checking if a soft error was reported */ +#define SOFT_ERROR_OCCURRED(escontext) \ + ((escontext) != NULL && IsA(escontext, ErrorSaveContext) && \ + ((ErrorSaveContext *) (escontext))->error_occurred) + +#endif /* MISCNODES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/multibitmapset.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/multibitmapset.h new file mode 100644 index 0000000..a3b2c2a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/multibitmapset.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * multibitmapset.h + * Lists of Bitmapsets + * + * A multibitmapset is useful in situations where members of a set can + * be identified by two small integers; for example, varno and varattno + * of a group of Vars within a query. The implementation is a List of + * Bitmapsets, so that the empty set can be represented by NIL. (But, + * as with Bitmapsets, that's not the only allowed representation.) + * The zero-based index of a List element is the first identifying value, + * and the (also zero-based) index of a bit within that Bitmapset is + * the second identifying value. There is no expectation that the + * Bitmapsets should all be the same size. + * + * The available operations on multibitmapsets are intended to parallel + * those on bitmapsets, for example union and intersection. So far only + * a small fraction of that has been built out; we'll add more as needed. + * + * + * Copyright (c) 2022-2025, PostgreSQL Global Development Group + * + * src/include/nodes/multibitmapset.h + * + *------------------------------------------------------------------------- + */ +#ifndef MULTIBITMAPSET_H +#define MULTIBITMAPSET_H + +#include "nodes/bitmapset.h" +#include "nodes/pg_list.h" + +extern List *mbms_add_member(List *a, int listidx, int bitidx); +extern List *mbms_add_members(List *a, const List *b); +extern List *mbms_int_members(List *a, const List *b); +extern bool mbms_is_member(int listidx, int bitidx, const List *a); +extern Bitmapset *mbms_overlap_sets(const List *a, const List *b); + +#endif /* MULTIBITMAPSET_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/nodeFuncs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/nodeFuncs.h new file mode 100644 index 0000000..5653fec --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/nodeFuncs.h @@ -0,0 +1,224 @@ +/*------------------------------------------------------------------------- + * + * nodeFuncs.h + * Various general-purpose manipulations of Node trees + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/nodeFuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEFUNCS_H +#define NODEFUNCS_H + +#include "nodes/parsenodes.h" + +struct PlanState; /* avoid including execnodes.h too */ + + +/* flags bits for query_tree_walker and query_tree_mutator */ +#define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */ +#define QTW_IGNORE_CTE_SUBQUERIES 0x02 /* subqueries in cteList */ +#define QTW_IGNORE_RC_SUBQUERIES 0x03 /* both of above */ +#define QTW_IGNORE_JOINALIASES 0x04 /* JOIN alias var lists */ +#define QTW_IGNORE_RANGE_TABLE 0x08 /* skip rangetable entirely */ +#define QTW_EXAMINE_RTES_BEFORE 0x10 /* examine RTE nodes before their + * contents */ +#define QTW_EXAMINE_RTES_AFTER 0x20 /* examine RTE nodes after their + * contents */ +#define QTW_DONT_COPY_QUERY 0x40 /* do not copy top Query */ +#define QTW_EXAMINE_SORTGROUP 0x80 /* include SortGroupClause lists */ + +#define QTW_IGNORE_GROUPEXPRS 0x100 /* GROUP expressions list */ + +/* callback function for check_functions_in_node */ +typedef bool (*check_function_callback) (Oid func_id, void *context); + +/* callback functions for tree walkers */ +typedef bool (*tree_walker_callback) (Node *node, void *context); +typedef bool (*planstate_tree_walker_callback) (struct PlanState *planstate, + void *context); + +/* callback functions for tree mutators */ +typedef Node *(*tree_mutator_callback) (Node *node, void *context); + + +extern Oid exprType(const Node *expr); +extern int32 exprTypmod(const Node *expr); +extern bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod); +extern Node *applyRelabelType(Node *arg, Oid rtype, int32 rtypmod, Oid rcollid, + CoercionForm rformat, int rlocation, + bool overwrite_ok); +extern Node *relabel_to_typmod(Node *expr, int32 typmod); +extern Node *strip_implicit_coercions(Node *node); +extern bool expression_returns_set(Node *clause); + +extern Oid exprCollation(const Node *expr); +extern Oid exprInputCollation(const Node *expr); +extern void exprSetCollation(Node *expr, Oid collation); +extern void exprSetInputCollation(Node *expr, Oid inputcollation); + +extern int exprLocation(const Node *expr); + +extern void fix_opfuncids(Node *node); +extern void set_opfuncid(OpExpr *opexpr); +extern void set_sa_opfuncid(ScalarArrayOpExpr *opexpr); + +/* Is clause a FuncExpr clause? */ +static inline bool +is_funcclause(const void *clause) +{ + return clause != NULL && IsA(clause, FuncExpr); +} + +/* Is clause an OpExpr clause? */ +static inline bool +is_opclause(const void *clause) +{ + return clause != NULL && IsA(clause, OpExpr); +} + +/* Extract left arg of a binary opclause, or only arg of a unary opclause */ +static inline Node * +get_leftop(const void *clause) +{ + const OpExpr *expr = (const OpExpr *) clause; + + if (expr->args != NIL) + return (Node *) linitial(expr->args); + else + return NULL; +} + +/* Extract right arg of a binary opclause (NULL if it's a unary opclause) */ +static inline Node * +get_rightop(const void *clause) +{ + const OpExpr *expr = (const OpExpr *) clause; + + if (list_length(expr->args) >= 2) + return (Node *) lsecond(expr->args); + else + return NULL; +} + +/* Is clause an AND clause? */ +static inline bool +is_andclause(const void *clause) +{ + return (clause != NULL && + IsA(clause, BoolExpr) && + ((const BoolExpr *) clause)->boolop == AND_EXPR); +} + +/* Is clause an OR clause? */ +static inline bool +is_orclause(const void *clause) +{ + return (clause != NULL && + IsA(clause, BoolExpr) && + ((const BoolExpr *) clause)->boolop == OR_EXPR); +} + +/* Is clause a NOT clause? */ +static inline bool +is_notclause(const void *clause) +{ + return (clause != NULL && + IsA(clause, BoolExpr) && + ((const BoolExpr *) clause)->boolop == NOT_EXPR); +} + +/* Extract argument from a clause known to be a NOT clause */ +static inline Expr * +get_notclausearg(const void *notclause) +{ + return (Expr *) linitial(((const BoolExpr *) notclause)->args); +} + +extern bool check_functions_in_node(Node *node, check_function_callback checker, + void *context); + +/* + * The following functions are usually passed walker or mutator callbacks + * that are declared like "bool walker(Node *node, my_struct *context)" + * rather than "bool walker(Node *node, void *context)" as a strict reading + * of the C standard would require. Changing the callbacks' declarations + * to "void *" would create serious hazards of passing them the wrong context + * struct type, so we respectfully decline to support the standard's position + * that a pointer to struct is incompatible with "void *". Instead, silence + * related compiler warnings by inserting casts into these macro wrappers. + */ + +#define expression_tree_walker(n, w, c) \ + expression_tree_walker_impl(n, (tree_walker_callback) (w), c) +#define expression_tree_mutator(n, m, c) \ + expression_tree_mutator_impl(n, (tree_mutator_callback) (m), c) + +#define query_tree_walker(q, w, c, f) \ + query_tree_walker_impl(q, (tree_walker_callback) (w), c, f) +#define query_tree_mutator(q, m, c, f) \ + query_tree_mutator_impl(q, (tree_mutator_callback) (m), c, f) + +#define range_table_walker(rt, w, c, f) \ + range_table_walker_impl(rt, (tree_walker_callback) (w), c, f) +#define range_table_mutator(rt, m, c, f) \ + range_table_mutator_impl(rt, (tree_mutator_callback) (m), c, f) + +#define range_table_entry_walker(r, w, c, f) \ + range_table_entry_walker_impl(r, (tree_walker_callback) (w), c, f) + +#define query_or_expression_tree_walker(n, w, c, f) \ + query_or_expression_tree_walker_impl(n, (tree_walker_callback) (w), c, f) +#define query_or_expression_tree_mutator(n, m, c, f) \ + query_or_expression_tree_mutator_impl(n, (tree_mutator_callback) (m), c, f) + +#define raw_expression_tree_walker(n, w, c) \ + raw_expression_tree_walker_impl(n, (tree_walker_callback) (w), c) + +#define planstate_tree_walker(ps, w, c) \ + planstate_tree_walker_impl(ps, (planstate_tree_walker_callback) (w), c) + +extern bool expression_tree_walker_impl(Node *node, + tree_walker_callback walker, + void *context); +extern Node *expression_tree_mutator_impl(Node *node, + tree_mutator_callback mutator, + void *context); + +extern bool query_tree_walker_impl(Query *query, + tree_walker_callback walker, + void *context, int flags); +extern Query *query_tree_mutator_impl(Query *query, + tree_mutator_callback mutator, + void *context, int flags); + +extern bool range_table_walker_impl(List *rtable, + tree_walker_callback walker, + void *context, int flags); +extern List *range_table_mutator_impl(List *rtable, + tree_mutator_callback mutator, + void *context, int flags); + +extern bool range_table_entry_walker_impl(RangeTblEntry *rte, + tree_walker_callback walker, + void *context, int flags); + +extern bool query_or_expression_tree_walker_impl(Node *node, + tree_walker_callback walker, + void *context, int flags); +extern Node *query_or_expression_tree_mutator_impl(Node *node, + tree_mutator_callback mutator, + void *context, int flags); + +extern bool raw_expression_tree_walker_impl(Node *node, + tree_walker_callback walker, + void *context); + +extern bool planstate_tree_walker_impl(struct PlanState *planstate, + planstate_tree_walker_callback walker, + void *context); + +#endif /* NODEFUNCS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/nodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/nodes.h new file mode 100644 index 0000000..fbe333d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/nodes.h @@ -0,0 +1,441 @@ +/*------------------------------------------------------------------------- + * + * nodes.h + * Definitions for tagged nodes. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/nodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODES_H +#define NODES_H + +/* + * The first field of every node is NodeTag. Each node created (with makeNode) + * will have one of the following tags as the value of its first field. + * + * Note that inserting or deleting node types changes the numbers of other + * node types later in the list. This is no problem during development, since + * the node numbers are never stored on disk. But don't do it in a released + * branch, because that would represent an ABI break for extensions. + */ +typedef enum NodeTag +{ + T_Invalid = 0, + +#include "nodes/nodetags.h" +} NodeTag; + +/* + * pg_node_attr() - Used in node definitions to set extra information for + * gen_node_support.pl + * + * Attributes can be attached to a node as a whole (place the attribute + * specification on the first line after the struct's opening brace) + * or to a specific field (place it at the end of that field's line). The + * argument is a comma-separated list of attributes. Unrecognized attributes + * cause an error. + * + * Valid node attributes: + * + * - abstract: Abstract types are types that cannot be instantiated but that + * can be supertypes of other types. We track their fields, so that + * subtypes can use them, but we don't emit a node tag, so you can't + * instantiate them. + * + * - custom_copy_equal: Has custom implementations in copyfuncs.c and + * equalfuncs.c. + * + * - custom_read_write: Has custom implementations in outfuncs.c and + * readfuncs.c. + * + * - custom_query_jumble: Has custom implementation in queryjumblefuncs.c. + * Also available as a node field attribute. + * + * - no_copy: Does not support copyObject() at all. + * + * - no_equal: Does not support equal() at all. + * + * - no_copy_equal: Shorthand for both no_copy and no_equal. + * + * - no_query_jumble: Does not support JumbleQuery() at all. + * + * - no_read: Does not support nodeRead() at all. + * + * - nodetag_only: Does not support copyObject(), equal(), jumbleQuery() + * outNode() or nodeRead(). + * + * - special_read_write: Has special treatment in outNode() and nodeRead(). + * + * - nodetag_number(VALUE): assign the specified nodetag number instead of + * an auto-generated number. Typically this would only be used in stable + * branches, to give a newly-added node type a number without breaking ABI + * by changing the numbers of existing node types. + * + * Node types can be supertypes of other types whether or not they are marked + * abstract: if a node struct appears as the first field of another struct + * type, then it is the supertype of that type. The no_copy, no_equal, + * no_query_jumble and no_read node attributes are automatically inherited + * from the supertype. (Notice that nodetag_only does not inherit, so it's + * not quite equivalent to a combination of other attributes.) + * + * Valid node field attributes: + * + * - array_size(OTHERFIELD): This field is a dynamically allocated array with + * size indicated by the mentioned other field. The other field is either a + * scalar or a list, in which case the length of the list is used. + * + * - copy_as(VALUE): In copyObject(), replace the field's value with VALUE. + * + * - copy_as_scalar: In copyObject(), copy the field as a scalar value + * (e.g. a pointer) even if it is a node-type pointer. + * + * - equal_as_scalar: In equal(), compare the field as a scalar value + * even if it is a node-type pointer. + * + * - equal_ignore: Ignore the field for equality. + * + * - equal_ignore_if_zero: Ignore the field for equality if it is zero. + * (Otherwise, compare normally.) + * + * - custom_query_jumble: Has custom implementation in queryjumblefuncs.c + * for the field of a node. Also available as a node attribute. + * + * - query_jumble_ignore: Ignore the field for the query jumbling. Note + * that typmod and collation information are usually irrelevant for the + * query jumbling. + * + * - query_jumble_squash: Squash multiple values during query jumbling. + * + * - query_jumble_location: Mark the field as a location to track. This is + * only allowed for integer fields that include "location" in their name. + * + * - read_as(VALUE): In nodeRead(), replace the field's value with VALUE. + * + * - read_write_ignore: Ignore the field for read/write. This is only allowed + * if the node type is marked no_read or read_as() is also specified. + * + * - write_only_relids, write_only_nondefault_pathtarget, write_only_req_outer: + * Special handling for Path struct; see there. + * + */ +#define pg_node_attr(...) + +/* + * The first field of a node of any type is guaranteed to be the NodeTag. + * Hence the type of any node can be gotten by casting it to Node. Declaring + * a variable to be of Node * (instead of void *) can also facilitate + * debugging. + */ +typedef struct Node +{ + NodeTag type; +} Node; + +#define nodeTag(nodeptr) (((const Node*)(nodeptr))->type) + +/* + * newNode - + * create a new node of the specified size and tag the node with the + * specified tag. + * + * !WARNING!: Avoid using newNode directly. You should be using the + * macro makeNode. eg. to create a Query node, use makeNode(Query) + */ +static inline Node * +newNode(size_t size, NodeTag tag) +{ + Node *result; + + Assert(size >= sizeof(Node)); /* need the tag, at least */ + result = (Node *) palloc0(size); + result->type = tag; + + return result; +} + +#define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_)) +#define NodeSetTag(nodeptr,t) (((Node*)(nodeptr))->type = (t)) + +#define IsA(nodeptr,_type_) (nodeTag(nodeptr) == T_##_type_) + +/* + * castNode(type, ptr) casts ptr to "type *", and if assertions are enabled, + * verifies that the node has the appropriate type (using its nodeTag()). + * + * Use an inline function when assertions are enabled, to avoid multiple + * evaluations of the ptr argument (which could e.g. be a function call). + */ +#ifdef USE_ASSERT_CHECKING +static inline Node * +castNodeImpl(NodeTag type, void *ptr) +{ + Assert(ptr == NULL || nodeTag(ptr) == type); + return (Node *) ptr; +} +#define castNode(_type_, nodeptr) ((_type_ *) castNodeImpl(T_##_type_, nodeptr)) +#else +#define castNode(_type_, nodeptr) ((_type_ *) (nodeptr)) +#endif /* USE_ASSERT_CHECKING */ + + +/* ---------------------------------------------------------------- + * extern declarations follow + * ---------------------------------------------------------------- + */ + +/* + * nodes/{outfuncs.c,print.c} + */ +struct Bitmapset; /* not to include bitmapset.h here */ +struct StringInfoData; /* not to include stringinfo.h here */ + +extern void outNode(struct StringInfoData *str, const void *obj); +extern void outToken(struct StringInfoData *str, const char *s); +extern void outBitmapset(struct StringInfoData *str, + const struct Bitmapset *bms); +extern void outDatum(struct StringInfoData *str, uintptr_t value, + int typlen, bool typbyval); +extern char *nodeToString(const void *obj); +extern char *nodeToStringWithLocations(const void *obj); +extern char *bmsToString(const struct Bitmapset *bms); + +/* + * nodes/{readfuncs.c,read.c} + */ +extern void *stringToNode(const char *str); +#ifdef DEBUG_NODE_TESTS_ENABLED +extern void *stringToNodeWithLocations(const char *str); +#endif +extern struct Bitmapset *readBitmapset(void); +extern uintptr_t readDatum(bool typbyval); +extern bool *readBoolCols(int numCols); +extern int *readIntCols(int numCols); +extern Oid *readOidCols(int numCols); +extern int16 *readAttrNumberCols(int numCols); + +/* + * nodes/copyfuncs.c + */ +extern void *copyObjectImpl(const void *from); + +/* cast result back to argument type, if supported by compiler */ +#ifdef HAVE_TYPEOF +#define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj)) +#else +#define copyObject(obj) copyObjectImpl(obj) +#endif + +/* + * nodes/equalfuncs.c + */ +extern bool equal(const void *a, const void *b); + + +/* + * Typedef for parse location. This is just an int, but this way + * gen_node_support.pl knows which fields should get special treatment for + * location values. + * + * -1 is used for unknown. + */ +typedef int ParseLoc; + +/* + * Typedefs for identifying qualifier selectivities, plan costs, and row + * counts as such. These are just plain "double"s, but declaring a variable + * as Selectivity, Cost, or Cardinality makes the intent more obvious. + * + * These could have gone into plannodes.h or some such, but many files + * depend on them... + */ +typedef double Selectivity; /* fraction of tuples a qualifier will pass */ +typedef double Cost; /* execution cost (in page-access units) */ +typedef double Cardinality; /* (estimated) number of rows or other integer + * count */ + + +/* + * CmdType - + * enums for type of operation represented by a Query or PlannedStmt + * + * This is needed in both parsenodes.h and plannodes.h, so put it here... + */ +typedef enum CmdType +{ + CMD_UNKNOWN, + CMD_SELECT, /* select stmt */ + CMD_UPDATE, /* update stmt */ + CMD_INSERT, /* insert stmt */ + CMD_DELETE, /* delete stmt */ + CMD_MERGE, /* merge stmt */ + CMD_UTILITY, /* cmds like create, destroy, copy, vacuum, + * etc. */ + CMD_NOTHING, /* dummy command for instead nothing rules + * with qual */ +} CmdType; + + +/* + * JoinType - + * enums for types of relation joins + * + * JoinType determines the exact semantics of joining two relations using + * a matching qualification. For example, it tells what to do with a tuple + * that has no match in the other relation. + * + * This is needed in both parsenodes.h and plannodes.h, so put it here... + */ +typedef enum JoinType +{ + /* + * The canonical kinds of joins according to the SQL JOIN syntax. Only + * these codes can appear in parser output (e.g., JoinExpr nodes). + */ + JOIN_INNER, /* matching tuple pairs only */ + JOIN_LEFT, /* pairs + unmatched LHS tuples */ + JOIN_FULL, /* pairs + unmatched LHS + unmatched RHS */ + JOIN_RIGHT, /* pairs + unmatched RHS tuples */ + + /* + * Semijoins and anti-semijoins (as defined in relational theory) do not + * appear in the SQL JOIN syntax, but there are standard idioms for + * representing them (e.g., using EXISTS). The planner recognizes these + * cases and converts them to joins. So the planner and executor must + * support these codes. NOTE: in JOIN_SEMI output, it is unspecified + * which matching RHS row is joined to. In JOIN_ANTI output, the row is + * guaranteed to be null-extended. + */ + JOIN_SEMI, /* 1 copy of each LHS row that has match(es) */ + JOIN_ANTI, /* 1 copy of each LHS row that has no match */ + JOIN_RIGHT_SEMI, /* 1 copy of each RHS row that has match(es) */ + JOIN_RIGHT_ANTI, /* 1 copy of each RHS row that has no match */ + + /* + * These codes are used internally in the planner, but are not supported + * by the executor (nor, indeed, by most of the planner). + */ + JOIN_UNIQUE_OUTER, /* LHS path must be made unique */ + JOIN_UNIQUE_INNER, /* RHS path must be made unique */ + + /* + * We might need additional join types someday. + */ +} JoinType; + +/* + * OUTER joins are those for which pushed-down quals must behave differently + * from the join's own quals. This is in fact everything except INNER, SEMI + * and RIGHT_SEMI joins. However, this macro must also exclude the + * JOIN_UNIQUE symbols since those are temporary proxies for what will + * eventually be an INNER join. + * + * Note: semijoins are a hybrid case, but we choose to treat them as not + * being outer joins. This is okay principally because the SQL syntax makes + * it impossible to have a pushed-down qual that refers to the inner relation + * of a semijoin; so there is no strong need to distinguish join quals from + * pushed-down quals. This is convenient because for almost all purposes, + * quals attached to a semijoin can be treated the same as innerjoin quals. + */ +#define IS_OUTER_JOIN(jointype) \ + (((1 << (jointype)) & \ + ((1 << JOIN_LEFT) | \ + (1 << JOIN_FULL) | \ + (1 << JOIN_RIGHT) | \ + (1 << JOIN_ANTI) | \ + (1 << JOIN_RIGHT_ANTI))) != 0) + +/* + * AggStrategy - + * overall execution strategies for Agg plan nodes + * + * This is needed in both pathnodes.h and plannodes.h, so put it here... + */ +typedef enum AggStrategy +{ + AGG_PLAIN, /* simple agg across all input rows */ + AGG_SORTED, /* grouped agg, input must be sorted */ + AGG_HASHED, /* grouped agg, use internal hashtable */ + AGG_MIXED, /* grouped agg, hash and sort both used */ +} AggStrategy; + +/* + * AggSplit - + * splitting (partial aggregation) modes for Agg plan nodes + * + * This is needed in both pathnodes.h and plannodes.h, so put it here... + */ + +/* Primitive options supported by nodeAgg.c: */ +#define AGGSPLITOP_COMBINE 0x01 /* substitute combinefn for transfn */ +#define AGGSPLITOP_SKIPFINAL 0x02 /* skip finalfn, return state as-is */ +#define AGGSPLITOP_SERIALIZE 0x04 /* apply serialfn to output */ +#define AGGSPLITOP_DESERIALIZE 0x08 /* apply deserialfn to input */ + +/* Supported operating modes (i.e., useful combinations of these options): */ +typedef enum AggSplit +{ + /* Basic, non-split aggregation: */ + AGGSPLIT_SIMPLE = 0, + /* Initial phase of partial aggregation, with serialization: */ + AGGSPLIT_INITIAL_SERIAL = AGGSPLITOP_SKIPFINAL | AGGSPLITOP_SERIALIZE, + /* Final phase of partial aggregation, with deserialization: */ + AGGSPLIT_FINAL_DESERIAL = AGGSPLITOP_COMBINE | AGGSPLITOP_DESERIALIZE, +} AggSplit; + +/* Test whether an AggSplit value selects each primitive option: */ +#define DO_AGGSPLIT_COMBINE(as) (((as) & AGGSPLITOP_COMBINE) != 0) +#define DO_AGGSPLIT_SKIPFINAL(as) (((as) & AGGSPLITOP_SKIPFINAL) != 0) +#define DO_AGGSPLIT_SERIALIZE(as) (((as) & AGGSPLITOP_SERIALIZE) != 0) +#define DO_AGGSPLIT_DESERIALIZE(as) (((as) & AGGSPLITOP_DESERIALIZE) != 0) + +/* + * SetOpCmd and SetOpStrategy - + * overall semantics and execution strategies for SetOp plan nodes + * + * This is needed in both pathnodes.h and plannodes.h, so put it here... + */ +typedef enum SetOpCmd +{ + SETOPCMD_INTERSECT, + SETOPCMD_INTERSECT_ALL, + SETOPCMD_EXCEPT, + SETOPCMD_EXCEPT_ALL, +} SetOpCmd; + +typedef enum SetOpStrategy +{ + SETOP_SORTED, /* input must be sorted */ + SETOP_HASHED, /* use internal hashtable */ +} SetOpStrategy; + +/* + * OnConflictAction - + * "ON CONFLICT" clause type of query + * + * This is needed in both parsenodes.h and plannodes.h, so put it here... + */ +typedef enum OnConflictAction +{ + ONCONFLICT_NONE, /* No "ON CONFLICT" clause */ + ONCONFLICT_NOTHING, /* ON CONFLICT ... DO NOTHING */ + ONCONFLICT_UPDATE, /* ON CONFLICT ... DO UPDATE */ +} OnConflictAction; + +/* + * LimitOption - + * LIMIT option of query + * + * This is needed in both parsenodes.h and plannodes.h, so put it here... + */ +typedef enum LimitOption +{ + LIMIT_OPTION_COUNT, /* FETCH FIRST... ONLY */ + LIMIT_OPTION_WITH_TIES, /* FETCH FIRST... WITH TIES */ +} LimitOption; + +#endif /* NODES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/nodetags.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/nodetags.h new file mode 100644 index 0000000..3127276 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/nodetags.h @@ -0,0 +1,496 @@ +/*------------------------------------------------------------------------- + * + * nodetags.h + * Generated node infrastructure code + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/nodes/gen_node_support.pl + * + *------------------------------------------------------------------------- + */ + T_List = 1, + T_Alias = 2, + T_RangeVar = 3, + T_TableFunc = 4, + T_IntoClause = 5, + T_Var = 6, + T_Const = 7, + T_Param = 8, + T_Aggref = 9, + T_GroupingFunc = 10, + T_WindowFunc = 11, + T_WindowFuncRunCondition = 12, + T_MergeSupportFunc = 13, + T_SubscriptingRef = 14, + T_FuncExpr = 15, + T_NamedArgExpr = 16, + T_OpExpr = 17, + T_DistinctExpr = 18, + T_NullIfExpr = 19, + T_ScalarArrayOpExpr = 20, + T_BoolExpr = 21, + T_SubLink = 22, + T_SubPlan = 23, + T_AlternativeSubPlan = 24, + T_FieldSelect = 25, + T_FieldStore = 26, + T_RelabelType = 27, + T_CoerceViaIO = 28, + T_ArrayCoerceExpr = 29, + T_ConvertRowtypeExpr = 30, + T_CollateExpr = 31, + T_CaseExpr = 32, + T_CaseWhen = 33, + T_CaseTestExpr = 34, + T_ArrayExpr = 35, + T_RowExpr = 36, + T_RowCompareExpr = 37, + T_CoalesceExpr = 38, + T_MinMaxExpr = 39, + T_SQLValueFunction = 40, + T_XmlExpr = 41, + T_JsonFormat = 42, + T_JsonReturning = 43, + T_JsonValueExpr = 44, + T_JsonConstructorExpr = 45, + T_JsonIsPredicate = 46, + T_JsonBehavior = 47, + T_JsonExpr = 48, + T_JsonTablePath = 49, + T_JsonTablePathScan = 50, + T_JsonTableSiblingJoin = 51, + T_NullTest = 52, + T_BooleanTest = 53, + T_MergeAction = 54, + T_CoerceToDomain = 55, + T_CoerceToDomainValue = 56, + T_SetToDefault = 57, + T_CurrentOfExpr = 58, + T_NextValueExpr = 59, + T_InferenceElem = 60, + T_ReturningExpr = 61, + T_TargetEntry = 62, + T_RangeTblRef = 63, + T_JoinExpr = 64, + T_FromExpr = 65, + T_OnConflictExpr = 66, + T_Query = 67, + T_TypeName = 68, + T_ColumnRef = 69, + T_ParamRef = 70, + T_A_Expr = 71, + T_A_Const = 72, + T_TypeCast = 73, + T_CollateClause = 74, + T_RoleSpec = 75, + T_FuncCall = 76, + T_A_Star = 77, + T_A_Indices = 78, + T_A_Indirection = 79, + T_A_ArrayExpr = 80, + T_ResTarget = 81, + T_MultiAssignRef = 82, + T_SortBy = 83, + T_WindowDef = 84, + T_RangeSubselect = 85, + T_RangeFunction = 86, + T_RangeTableFunc = 87, + T_RangeTableFuncCol = 88, + T_RangeTableSample = 89, + T_ColumnDef = 90, + T_TableLikeClause = 91, + T_IndexElem = 92, + T_DefElem = 93, + T_LockingClause = 94, + T_XmlSerialize = 95, + T_PartitionElem = 96, + T_PartitionSpec = 97, + T_PartitionBoundSpec = 98, + T_PartitionRangeDatum = 99, + T_PartitionCmd = 100, + T_RangeTblEntry = 101, + T_RTEPermissionInfo = 102, + T_RangeTblFunction = 103, + T_TableSampleClause = 104, + T_WithCheckOption = 105, + T_SortGroupClause = 106, + T_GroupingSet = 107, + T_WindowClause = 108, + T_RowMarkClause = 109, + T_WithClause = 110, + T_InferClause = 111, + T_OnConflictClause = 112, + T_CTESearchClause = 113, + T_CTECycleClause = 114, + T_CommonTableExpr = 115, + T_MergeWhenClause = 116, + T_ReturningOption = 117, + T_ReturningClause = 118, + T_TriggerTransition = 119, + T_JsonOutput = 120, + T_JsonArgument = 121, + T_JsonFuncExpr = 122, + T_JsonTablePathSpec = 123, + T_JsonTable = 124, + T_JsonTableColumn = 125, + T_JsonKeyValue = 126, + T_JsonParseExpr = 127, + T_JsonScalarExpr = 128, + T_JsonSerializeExpr = 129, + T_JsonObjectConstructor = 130, + T_JsonArrayConstructor = 131, + T_JsonArrayQueryConstructor = 132, + T_JsonAggConstructor = 133, + T_JsonObjectAgg = 134, + T_JsonArrayAgg = 135, + T_RawStmt = 136, + T_InsertStmt = 137, + T_DeleteStmt = 138, + T_UpdateStmt = 139, + T_MergeStmt = 140, + T_SelectStmt = 141, + T_SetOperationStmt = 142, + T_ReturnStmt = 143, + T_PLAssignStmt = 144, + T_CreateSchemaStmt = 145, + T_AlterTableStmt = 146, + T_AlterTableCmd = 147, + T_ATAlterConstraint = 148, + T_ReplicaIdentityStmt = 149, + T_AlterCollationStmt = 150, + T_AlterDomainStmt = 151, + T_GrantStmt = 152, + T_ObjectWithArgs = 153, + T_AccessPriv = 154, + T_GrantRoleStmt = 155, + T_AlterDefaultPrivilegesStmt = 156, + T_CopyStmt = 157, + T_VariableSetStmt = 158, + T_VariableShowStmt = 159, + T_CreateStmt = 160, + T_Constraint = 161, + T_CreateTableSpaceStmt = 162, + T_DropTableSpaceStmt = 163, + T_AlterTableSpaceOptionsStmt = 164, + T_AlterTableMoveAllStmt = 165, + T_CreateExtensionStmt = 166, + T_AlterExtensionStmt = 167, + T_AlterExtensionContentsStmt = 168, + T_CreateFdwStmt = 169, + T_AlterFdwStmt = 170, + T_CreateForeignServerStmt = 171, + T_AlterForeignServerStmt = 172, + T_CreateForeignTableStmt = 173, + T_CreateUserMappingStmt = 174, + T_AlterUserMappingStmt = 175, + T_DropUserMappingStmt = 176, + T_ImportForeignSchemaStmt = 177, + T_CreatePolicyStmt = 178, + T_AlterPolicyStmt = 179, + T_CreateAmStmt = 180, + T_CreateTrigStmt = 181, + T_CreateEventTrigStmt = 182, + T_AlterEventTrigStmt = 183, + T_CreatePLangStmt = 184, + T_CreateRoleStmt = 185, + T_AlterRoleStmt = 186, + T_AlterRoleSetStmt = 187, + T_DropRoleStmt = 188, + T_CreateSeqStmt = 189, + T_AlterSeqStmt = 190, + T_DefineStmt = 191, + T_CreateDomainStmt = 192, + T_CreateOpClassStmt = 193, + T_CreateOpClassItem = 194, + T_CreateOpFamilyStmt = 195, + T_AlterOpFamilyStmt = 196, + T_DropStmt = 197, + T_TruncateStmt = 198, + T_CommentStmt = 199, + T_SecLabelStmt = 200, + T_DeclareCursorStmt = 201, + T_ClosePortalStmt = 202, + T_FetchStmt = 203, + T_IndexStmt = 204, + T_CreateStatsStmt = 205, + T_StatsElem = 206, + T_AlterStatsStmt = 207, + T_CreateFunctionStmt = 208, + T_FunctionParameter = 209, + T_AlterFunctionStmt = 210, + T_DoStmt = 211, + T_InlineCodeBlock = 212, + T_CallStmt = 213, + T_CallContext = 214, + T_RenameStmt = 215, + T_AlterObjectDependsStmt = 216, + T_AlterObjectSchemaStmt = 217, + T_AlterOwnerStmt = 218, + T_AlterOperatorStmt = 219, + T_AlterTypeStmt = 220, + T_RuleStmt = 221, + T_NotifyStmt = 222, + T_ListenStmt = 223, + T_UnlistenStmt = 224, + T_TransactionStmt = 225, + T_CompositeTypeStmt = 226, + T_CreateEnumStmt = 227, + T_CreateRangeStmt = 228, + T_AlterEnumStmt = 229, + T_ViewStmt = 230, + T_LoadStmt = 231, + T_CreatedbStmt = 232, + T_AlterDatabaseStmt = 233, + T_AlterDatabaseRefreshCollStmt = 234, + T_AlterDatabaseSetStmt = 235, + T_DropdbStmt = 236, + T_AlterSystemStmt = 237, + T_ClusterStmt = 238, + T_VacuumStmt = 239, + T_VacuumRelation = 240, + T_ExplainStmt = 241, + T_CreateTableAsStmt = 242, + T_RefreshMatViewStmt = 243, + T_CheckPointStmt = 244, + T_DiscardStmt = 245, + T_LockStmt = 246, + T_ConstraintsSetStmt = 247, + T_ReindexStmt = 248, + T_CreateConversionStmt = 249, + T_CreateCastStmt = 250, + T_CreateTransformStmt = 251, + T_PrepareStmt = 252, + T_ExecuteStmt = 253, + T_DeallocateStmt = 254, + T_DropOwnedStmt = 255, + T_ReassignOwnedStmt = 256, + T_AlterTSDictionaryStmt = 257, + T_AlterTSConfigurationStmt = 258, + T_PublicationTable = 259, + T_PublicationObjSpec = 260, + T_CreatePublicationStmt = 261, + T_AlterPublicationStmt = 262, + T_CreateSubscriptionStmt = 263, + T_AlterSubscriptionStmt = 264, + T_DropSubscriptionStmt = 265, + T_PlannerGlobal = 266, + T_PlannerInfo = 267, + T_RelOptInfo = 268, + T_IndexOptInfo = 269, + T_ForeignKeyOptInfo = 270, + T_StatisticExtInfo = 271, + T_JoinDomain = 272, + T_EquivalenceClass = 273, + T_EquivalenceMember = 274, + T_PathKey = 275, + T_GroupByOrdering = 276, + T_PathTarget = 277, + T_ParamPathInfo = 278, + T_Path = 279, + T_IndexPath = 280, + T_IndexClause = 281, + T_BitmapHeapPath = 282, + T_BitmapAndPath = 283, + T_BitmapOrPath = 284, + T_TidPath = 285, + T_TidRangePath = 286, + T_SubqueryScanPath = 287, + T_ForeignPath = 288, + T_CustomPath = 289, + T_AppendPath = 290, + T_MergeAppendPath = 291, + T_GroupResultPath = 292, + T_MaterialPath = 293, + T_MemoizePath = 294, + T_UniquePath = 295, + T_GatherPath = 296, + T_GatherMergePath = 297, + T_NestPath = 298, + T_MergePath = 299, + T_HashPath = 300, + T_ProjectionPath = 301, + T_ProjectSetPath = 302, + T_SortPath = 303, + T_IncrementalSortPath = 304, + T_GroupPath = 305, + T_UpperUniquePath = 306, + T_AggPath = 307, + T_GroupingSetData = 308, + T_RollupData = 309, + T_GroupingSetsPath = 310, + T_MinMaxAggPath = 311, + T_WindowAggPath = 312, + T_SetOpPath = 313, + T_RecursiveUnionPath = 314, + T_LockRowsPath = 315, + T_ModifyTablePath = 316, + T_LimitPath = 317, + T_RestrictInfo = 318, + T_PlaceHolderVar = 319, + T_SpecialJoinInfo = 320, + T_OuterJoinClauseInfo = 321, + T_AppendRelInfo = 322, + T_RowIdentityVarInfo = 323, + T_PlaceHolderInfo = 324, + T_MinMaxAggInfo = 325, + T_PlannerParamItem = 326, + T_AggInfo = 327, + T_AggTransInfo = 328, + T_UniqueRelInfo = 329, + T_PlannedStmt = 330, + T_Result = 331, + T_ProjectSet = 332, + T_ModifyTable = 333, + T_Append = 334, + T_MergeAppend = 335, + T_RecursiveUnion = 336, + T_BitmapAnd = 337, + T_BitmapOr = 338, + T_SeqScan = 339, + T_SampleScan = 340, + T_IndexScan = 341, + T_IndexOnlyScan = 342, + T_BitmapIndexScan = 343, + T_BitmapHeapScan = 344, + T_TidScan = 345, + T_TidRangeScan = 346, + T_SubqueryScan = 347, + T_FunctionScan = 348, + T_ValuesScan = 349, + T_TableFuncScan = 350, + T_CteScan = 351, + T_NamedTuplestoreScan = 352, + T_WorkTableScan = 353, + T_ForeignScan = 354, + T_CustomScan = 355, + T_NestLoop = 356, + T_NestLoopParam = 357, + T_MergeJoin = 358, + T_HashJoin = 359, + T_Material = 360, + T_Memoize = 361, + T_Sort = 362, + T_IncrementalSort = 363, + T_Group = 364, + T_Agg = 365, + T_WindowAgg = 366, + T_Unique = 367, + T_Gather = 368, + T_GatherMerge = 369, + T_Hash = 370, + T_SetOp = 371, + T_LockRows = 372, + T_Limit = 373, + T_PlanRowMark = 374, + T_PartitionPruneInfo = 375, + T_PartitionedRelPruneInfo = 376, + T_PartitionPruneStepOp = 377, + T_PartitionPruneStepCombine = 378, + T_PlanInvalItem = 379, + T_ExprState = 380, + T_IndexInfo = 381, + T_ExprContext = 382, + T_ReturnSetInfo = 383, + T_ProjectionInfo = 384, + T_JunkFilter = 385, + T_OnConflictSetState = 386, + T_MergeActionState = 387, + T_ResultRelInfo = 388, + T_EState = 389, + T_WindowFuncExprState = 390, + T_SetExprState = 391, + T_SubPlanState = 392, + T_DomainConstraintState = 393, + T_ResultState = 394, + T_ProjectSetState = 395, + T_ModifyTableState = 396, + T_AppendState = 397, + T_MergeAppendState = 398, + T_RecursiveUnionState = 399, + T_BitmapAndState = 400, + T_BitmapOrState = 401, + T_ScanState = 402, + T_SeqScanState = 403, + T_SampleScanState = 404, + T_IndexScanState = 405, + T_IndexOnlyScanState = 406, + T_BitmapIndexScanState = 407, + T_BitmapHeapScanState = 408, + T_TidScanState = 409, + T_TidRangeScanState = 410, + T_SubqueryScanState = 411, + T_FunctionScanState = 412, + T_ValuesScanState = 413, + T_TableFuncScanState = 414, + T_CteScanState = 415, + T_NamedTuplestoreScanState = 416, + T_WorkTableScanState = 417, + T_ForeignScanState = 418, + T_CustomScanState = 419, + T_JoinState = 420, + T_NestLoopState = 421, + T_MergeJoinState = 422, + T_HashJoinState = 423, + T_MaterialState = 424, + T_MemoizeState = 425, + T_SortState = 426, + T_IncrementalSortState = 427, + T_GroupState = 428, + T_AggState = 429, + T_WindowAggState = 430, + T_UniqueState = 431, + T_GatherState = 432, + T_GatherMergeState = 433, + T_HashState = 434, + T_SetOpState = 435, + T_LockRowsState = 436, + T_LimitState = 437, + T_IndexAmRoutine = 438, + T_TableAmRoutine = 439, + T_TsmRoutine = 440, + T_EventTriggerData = 441, + T_TriggerData = 442, + T_TupleTableSlot = 443, + T_FdwRoutine = 444, + T_Bitmapset = 445, + T_ExtensibleNode = 446, + T_ErrorSaveContext = 447, + T_IdentifySystemCmd = 448, + T_BaseBackupCmd = 449, + T_CreateReplicationSlotCmd = 450, + T_DropReplicationSlotCmd = 451, + T_AlterReplicationSlotCmd = 452, + T_StartReplicationCmd = 453, + T_ReadReplicationSlotCmd = 454, + T_TimeLineHistoryCmd = 455, + T_UploadManifestCmd = 456, + T_SupportRequestSimplify = 457, + T_SupportRequestSelectivity = 458, + T_SupportRequestCost = 459, + T_SupportRequestRows = 460, + T_SupportRequestIndexCondition = 461, + T_SupportRequestWFuncMonotonic = 462, + T_SupportRequestOptimizeWindowClause = 463, + T_SupportRequestModifyInPlace = 464, + T_Integer = 465, + T_Float = 466, + T_Boolean = 467, + T_String = 468, + T_BitString = 469, + T_ForeignKeyCacheInfo = 470, + T_IntList = 471, + T_OidList = 472, + T_XidList = 473, + T_AllocSetContext = 474, + T_GenerationContext = 475, + T_SlabContext = 476, + T_BumpContext = 477, + T_TIDBitmap = 478, + T_WindowObjectData = 479, diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/params.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/params.h new file mode 100644 index 0000000..4321ca6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/params.h @@ -0,0 +1,170 @@ +/*------------------------------------------------------------------------- + * + * params.h + * Support for finding the values associated with Param nodes. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/params.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARAMS_H +#define PARAMS_H + +/* Forward declarations, to avoid including other headers */ +struct Bitmapset; +struct ExprState; +struct Param; +struct ParseState; + + +/* + * ParamListInfo + * + * ParamListInfo structures are used to pass parameters into the executor + * for parameterized plans. We support two basic approaches to supplying + * parameter values, the "static" way and the "dynamic" way. + * + * In the static approach, per-parameter data is stored in an array of + * ParamExternData structs appended to the ParamListInfo struct. + * Each entry in the array defines the value to be substituted for a + * PARAM_EXTERN parameter. The "paramid" of a PARAM_EXTERN Param + * can range from 1 to numParams. + * + * Although parameter numbers are normally consecutive, we allow + * ptype == InvalidOid to signal an unused array entry. + * + * pflags is a flags field. Currently the only used bit is: + * PARAM_FLAG_CONST signals the planner that it may treat this parameter + * as a constant (i.e., generate a plan that works only for this value + * of the parameter). + * + * In the dynamic approach, all access to parameter values is done through + * hook functions found in the ParamListInfo struct. In this case, + * the ParamExternData array is typically unused and not allocated; + * but the legal range of paramid is still 1 to numParams. + * + * Although the data structure is really an array, not a list, we keep + * the old typedef name to avoid unnecessary code changes. + * + * There are 3 hook functions that can be associated with a ParamListInfo + * structure: + * + * If paramFetch isn't null, it is called to fetch the ParamExternData + * for a particular param ID, rather than accessing the relevant element + * of the ParamExternData array. This supports the case where the array + * isn't there at all, as well as cases where the data in the array + * might be obsolete or lazily evaluated. paramFetch must return the + * address of a ParamExternData struct describing the specified param ID; + * the convention above about ptype == InvalidOid signaling an invalid + * param ID still applies. The returned struct can either be placed in + * the "workspace" supplied by the caller, or it can be in storage + * controlled by the paramFetch hook if that's more convenient. + * (In either case, the struct is not expected to be long-lived.) + * If "speculative" is true, the paramFetch hook should not risk errors + * in trying to fetch the parameter value, and should report an invalid + * parameter instead. + * + * If paramCompile isn't null, then it controls what execExpr.c compiles + * for PARAM_EXTERN Param nodes --- typically, this hook would emit a + * EEOP_PARAM_CALLBACK step. This allows unnecessary work to be + * optimized away in compiled expressions. + * + * If parserSetup isn't null, then it is called to re-instantiate the + * original parsing hooks when a query needs to be re-parsed/planned. + * This is especially useful if the types of parameters might change + * from time to time, since it can replace the need to supply a fixed + * list of parameter types to the parser. + * + * Notice that the paramFetch and paramCompile hooks are actually passed + * the ParamListInfo struct's address; they can therefore access all + * three of the "arg" fields, and the distinction between paramFetchArg + * and paramCompileArg is rather arbitrary. + */ + +#define PARAM_FLAG_CONST 0x0001 /* parameter is constant */ + +typedef struct ParamExternData +{ + Datum value; /* parameter value */ + bool isnull; /* is it NULL? */ + uint16 pflags; /* flag bits, see above */ + Oid ptype; /* parameter's datatype, or 0 */ +} ParamExternData; + +typedef struct ParamListInfoData *ParamListInfo; + +typedef ParamExternData *(*ParamFetchHook) (ParamListInfo params, + int paramid, bool speculative, + ParamExternData *workspace); + +typedef void (*ParamCompileHook) (ParamListInfo params, struct Param *param, + struct ExprState *state, + Datum *resv, bool *resnull); + +typedef void (*ParserSetupHook) (struct ParseState *pstate, void *arg); + +typedef struct ParamListInfoData +{ + ParamFetchHook paramFetch; /* parameter fetch hook */ + void *paramFetchArg; + ParamCompileHook paramCompile; /* parameter compile hook */ + void *paramCompileArg; + ParserSetupHook parserSetup; /* parser setup hook */ + void *parserSetupArg; + char *paramValuesStr; /* params as a single string for errors */ + int numParams; /* nominal/maximum # of Params represented */ + + /* + * params[] may be of length zero if paramFetch is supplied; otherwise it + * must be of length numParams. + */ + ParamExternData params[FLEXIBLE_ARRAY_MEMBER]; +} ParamListInfoData; + + +/* ---------------- + * ParamExecData + * + * ParamExecData entries are used for executor internal parameters + * (that is, values being passed into or out of a sub-query). The + * paramid of a PARAM_EXEC Param is a (zero-based) index into an + * array of ParamExecData records, which is referenced through + * es_param_exec_vals or ecxt_param_exec_vals. + * + * If execPlan is not NULL, it points to a SubPlanState node that needs + * to be executed to produce the value. (This is done so that we can have + * lazy evaluation of InitPlans: they aren't executed until/unless a + * result value is needed.) Otherwise the value is assumed to be valid + * when needed. + * ---------------- + */ + +typedef struct ParamExecData +{ + void *execPlan; /* should be "SubPlanState *" */ + Datum value; + bool isnull; +} ParamExecData; + +/* type of argument for ParamsErrorCallback */ +typedef struct ParamsErrorCbData +{ + const char *portalName; + ParamListInfo params; +} ParamsErrorCbData; + +/* Functions found in src/backend/nodes/params.c */ +extern ParamListInfo makeParamList(int numParams); +extern ParamListInfo copyParamList(ParamListInfo from); +extern Size EstimateParamListSpace(ParamListInfo paramLI); +extern void SerializeParamList(ParamListInfo paramLI, char **start_address); +extern ParamListInfo RestoreParamList(char **start_address); +extern char *BuildParamLogString(ParamListInfo params, char **knownTextValues, + int maxlen); +extern void ParamsErrorCallback(void *arg); + +#endif /* PARAMS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/parsenodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/parsenodes.h new file mode 100644 index 0000000..161b09f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/parsenodes.h @@ -0,0 +1,4334 @@ +/*------------------------------------------------------------------------- + * + * parsenodes.h + * definitions for parse tree nodes + * + * Many of the node types used in parsetrees include a "location" field. + * This is a byte (not character) offset in the original source text, to be + * used for positioning an error cursor when there is an error related to + * the node. Access to the original source text is needed to make use of + * the location. At the topmost (statement) level, we also provide a + * statement length, likewise measured in bytes, for convenience in + * identifying statement boundaries in multi-statement source strings. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/parsenodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSENODES_H +#define PARSENODES_H + +#include "common/relpath.h" +#include "nodes/bitmapset.h" +#include "nodes/lockoptions.h" +#include "nodes/primnodes.h" +#include "nodes/value.h" +#include "partitioning/partdefs.h" + + +/* Possible sources of a Query */ +typedef enum QuerySource +{ + QSRC_ORIGINAL, /* original parsetree (explicit query) */ + QSRC_PARSER, /* added by parse analysis (now unused) */ + QSRC_INSTEAD_RULE, /* added by unconditional INSTEAD rule */ + QSRC_QUAL_INSTEAD_RULE, /* added by conditional INSTEAD rule */ + QSRC_NON_INSTEAD_RULE, /* added by non-INSTEAD rule */ +} QuerySource; + +/* Sort ordering options for ORDER BY and CREATE INDEX */ +typedef enum SortByDir +{ + SORTBY_DEFAULT, + SORTBY_ASC, + SORTBY_DESC, + SORTBY_USING, /* not allowed in CREATE INDEX ... */ +} SortByDir; + +typedef enum SortByNulls +{ + SORTBY_NULLS_DEFAULT, + SORTBY_NULLS_FIRST, + SORTBY_NULLS_LAST, +} SortByNulls; + +/* Options for [ ALL | DISTINCT ] */ +typedef enum SetQuantifier +{ + SET_QUANTIFIER_DEFAULT, + SET_QUANTIFIER_ALL, + SET_QUANTIFIER_DISTINCT, +} SetQuantifier; + +/* + * Grantable rights are encoded so that we can OR them together in a bitmask. + * The present representation of AclItem limits us to 32 distinct rights, + * even though AclMode is defined as uint64. See utils/acl.h. + * + * Caution: changing these codes breaks stored ACLs, hence forces initdb. + */ +typedef uint64 AclMode; /* a bitmask of privilege bits */ + +#define ACL_INSERT (1<<0) /* for relations */ +#define ACL_SELECT (1<<1) +#define ACL_UPDATE (1<<2) +#define ACL_DELETE (1<<3) +#define ACL_TRUNCATE (1<<4) +#define ACL_REFERENCES (1<<5) +#define ACL_TRIGGER (1<<6) +#define ACL_EXECUTE (1<<7) /* for functions */ +#define ACL_USAGE (1<<8) /* for various object types */ +#define ACL_CREATE (1<<9) /* for namespaces and databases */ +#define ACL_CREATE_TEMP (1<<10) /* for databases */ +#define ACL_CONNECT (1<<11) /* for databases */ +#define ACL_SET (1<<12) /* for configuration parameters */ +#define ACL_ALTER_SYSTEM (1<<13) /* for configuration parameters */ +#define ACL_MAINTAIN (1<<14) /* for relations */ +#define N_ACL_RIGHTS 15 /* 1 plus the last 1< 0 + */ + List *rteperminfos pg_node_attr(query_jumble_ignore); + FromExpr *jointree; /* table join tree (FROM and WHERE clauses); + * also USING clause for MERGE */ + + List *mergeActionList; /* list of actions for MERGE (only) */ + + /* + * rtable index of target relation for MERGE to pull data. Initially, this + * is the same as resultRelation, but after query rewriting, if the target + * relation is a trigger-updatable view, this is the index of the expanded + * view subquery, whereas resultRelation is the index of the target view. + */ + int mergeTargetRelation pg_node_attr(query_jumble_ignore); + + /* join condition between source and target for MERGE */ + Node *mergeJoinCondition; + + List *targetList; /* target list (of TargetEntry) */ + + /* OVERRIDING clause */ + OverridingKind override pg_node_attr(query_jumble_ignore); + + OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */ + + /* + * The following three fields describe the contents of the RETURNING list + * for INSERT/UPDATE/DELETE/MERGE. returningOldAlias and returningNewAlias + * are the alias names for OLD and NEW, which may be user-supplied values, + * the defaults "old" and "new", or NULL (if the default "old"/"new" is + * already in use as the alias for some other relation). + */ + char *returningOldAlias pg_node_attr(query_jumble_ignore); + char *returningNewAlias pg_node_attr(query_jumble_ignore); + List *returningList; /* return-values list (of TargetEntry) */ + + List *groupClause; /* a list of SortGroupClause's */ + bool groupDistinct; /* is the group by clause distinct? */ + + List *groupingSets; /* a list of GroupingSet's if present */ + + Node *havingQual; /* qualifications applied to groups */ + + List *windowClause; /* a list of WindowClause's */ + + List *distinctClause; /* a list of SortGroupClause's */ + + List *sortClause; /* a list of SortGroupClause's */ + + Node *limitOffset; /* # of result tuples to skip (int8 expr) */ + Node *limitCount; /* # of result tuples to return (int8 expr) */ + LimitOption limitOption; /* limit type */ + + List *rowMarks; /* a list of RowMarkClause's */ + + Node *setOperations; /* set-operation tree if this is top level of + * a UNION/INTERSECT/EXCEPT query */ + + /* + * A list of pg_constraint OIDs that the query depends on to be + * semantically valid + */ + List *constraintDeps pg_node_attr(query_jumble_ignore); + + /* a list of WithCheckOption's (added during rewrite) */ + List *withCheckOptions pg_node_attr(query_jumble_ignore); + + /* + * The following two fields identify the portion of the source text string + * containing this query. They are typically only populated in top-level + * Queries, not in sub-queries. When not set, they might both be zero, or + * both be -1 meaning "unknown". + */ + /* start location, or -1 if unknown */ + ParseLoc stmt_location; + /* length in bytes; 0 means "rest of string" */ + ParseLoc stmt_len pg_node_attr(query_jumble_ignore); +} Query; + + +/**************************************************************************** + * Supporting data structures for Parse Trees + * + * Most of these node types appear in raw parsetrees output by the grammar, + * and get transformed to something else by the analyzer. A few of them + * are used as-is in transformed querytrees. + ****************************************************************************/ + +/* + * TypeName - specifies a type in definitions + * + * For TypeName structures generated internally, it is often easier to + * specify the type by OID than by name. If "names" is NIL then the + * actual type OID is given by typeOid, otherwise typeOid is unused. + * Similarly, if "typmods" is NIL then the actual typmod is expected to + * be prespecified in typemod, otherwise typemod is unused. + * + * If pct_type is true, then names is actually a field name and we look up + * the type of that field. Otherwise (the normal case), names is a type + * name possibly qualified with schema and database name. + */ +typedef struct TypeName +{ + NodeTag type; + List *names; /* qualified name (list of String nodes) */ + Oid typeOid; /* type identified by OID */ + bool setof; /* is a set? */ + bool pct_type; /* %TYPE specified? */ + List *typmods; /* type modifier expression(s) */ + int32 typemod; /* prespecified type modifier */ + List *arrayBounds; /* array bounds */ + ParseLoc location; /* token location, or -1 if unknown */ +} TypeName; + +/* + * ColumnRef - specifies a reference to a column, or possibly a whole tuple + * + * The "fields" list must be nonempty. It can contain String nodes + * (representing names) and A_Star nodes (representing occurrence of a '*'). + * Currently, A_Star must appear only as the last list element --- the grammar + * is responsible for enforcing this! + * + * Note: any container subscripting or selection of fields from composite columns + * is represented by an A_Indirection node above the ColumnRef. However, + * for simplicity in the normal case, initial field selection from a table + * name is represented within ColumnRef and not by adding A_Indirection. + */ +typedef struct ColumnRef +{ + NodeTag type; + List *fields; /* field names (String nodes) or A_Star */ + ParseLoc location; /* token location, or -1 if unknown */ +} ColumnRef; + +/* + * ParamRef - specifies a $n parameter reference + */ +typedef struct ParamRef +{ + NodeTag type; + int number; /* the number of the parameter */ + ParseLoc location; /* token location, or -1 if unknown */ +} ParamRef; + +/* + * A_Expr - infix, prefix, and postfix expressions + */ +typedef enum A_Expr_Kind +{ + AEXPR_OP, /* normal operator */ + AEXPR_OP_ANY, /* scalar op ANY (array) */ + AEXPR_OP_ALL, /* scalar op ALL (array) */ + AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */ + AEXPR_NOT_DISTINCT, /* IS NOT DISTINCT FROM - name must be "=" */ + AEXPR_NULLIF, /* NULLIF - name must be "=" */ + AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */ + AEXPR_LIKE, /* [NOT] LIKE - name must be "~~" or "!~~" */ + AEXPR_ILIKE, /* [NOT] ILIKE - name must be "~~*" or "!~~*" */ + AEXPR_SIMILAR, /* [NOT] SIMILAR - name must be "~" or "!~" */ + AEXPR_BETWEEN, /* name must be "BETWEEN" */ + AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */ + AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */ + AEXPR_NOT_BETWEEN_SYM, /* name must be "NOT BETWEEN SYMMETRIC" */ +} A_Expr_Kind; + +typedef struct A_Expr +{ + pg_node_attr(custom_read_write) + + NodeTag type; + A_Expr_Kind kind; /* see above */ + List *name; /* possibly-qualified name of operator */ + Node *lexpr; /* left argument, or NULL if none */ + Node *rexpr; /* right argument, or NULL if none */ + + /* + * If rexpr is a list of some kind, we separately track its starting and + * ending location; it's not the same as the starting and ending location + * of the token itself. + */ + ParseLoc rexpr_list_start; + ParseLoc rexpr_list_end; + ParseLoc location; /* token location, or -1 if unknown */ +} A_Expr; + +/* + * A_Const - a literal constant + * + * Value nodes are inline for performance. You can treat 'val' as a node, + * as in IsA(&val, Integer). 'val' is not valid if isnull is true. + */ +union ValUnion +{ + Node node; + Integer ival; + Float fval; + Boolean boolval; + String sval; + BitString bsval; +}; + +typedef struct A_Const +{ + pg_node_attr(custom_copy_equal, custom_read_write, custom_query_jumble) + + NodeTag type; + union ValUnion val; + bool isnull; /* SQL NULL constant */ + ParseLoc location; /* token location, or -1 if unknown */ +} A_Const; + +/* + * TypeCast - a CAST expression + */ +typedef struct TypeCast +{ + NodeTag type; + Node *arg; /* the expression being casted */ + TypeName *typeName; /* the target type */ + ParseLoc location; /* token location, or -1 if unknown */ +} TypeCast; + +/* + * CollateClause - a COLLATE expression + */ +typedef struct CollateClause +{ + NodeTag type; + Node *arg; /* input expression */ + List *collname; /* possibly-qualified collation name */ + ParseLoc location; /* token location, or -1 if unknown */ +} CollateClause; + +/* + * RoleSpec - a role name or one of a few special values. + */ +typedef enum RoleSpecType +{ + ROLESPEC_CSTRING, /* role name is stored as a C string */ + ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */ + ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */ + ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */ + ROLESPEC_PUBLIC, /* role name is "public" */ +} RoleSpecType; + +typedef struct RoleSpec +{ + NodeTag type; + RoleSpecType roletype; /* Type of this rolespec */ + char *rolename; /* filled only for ROLESPEC_CSTRING */ + ParseLoc location; /* token location, or -1 if unknown */ +} RoleSpec; + +/* + * FuncCall - a function or aggregate invocation + * + * agg_order (if not NIL) indicates we saw 'foo(... ORDER BY ...)', or if + * agg_within_group is true, it was 'foo(...) WITHIN GROUP (ORDER BY ...)'. + * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct + * indicates we saw 'foo(DISTINCT ...)'. In any of these cases, the + * construct *must* be an aggregate call. Otherwise, it might be either an + * aggregate or some other kind of function. However, if FILTER or OVER is + * present it had better be an aggregate or window function. + * + * Normally, you'd initialize this via makeFuncCall() and then only change the + * parts of the struct its defaults don't match afterwards, as needed. + */ +typedef struct FuncCall +{ + NodeTag type; + List *funcname; /* qualified name of function */ + List *args; /* the arguments (list of exprs) */ + List *agg_order; /* ORDER BY (list of SortBy) */ + Node *agg_filter; /* FILTER clause, if any */ + struct WindowDef *over; /* OVER clause, if any */ + bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */ + bool agg_star; /* argument was really '*' */ + bool agg_distinct; /* arguments were labeled DISTINCT */ + bool func_variadic; /* last argument was labeled VARIADIC */ + CoercionForm funcformat; /* how to display this node */ + ParseLoc location; /* token location, or -1 if unknown */ +} FuncCall; + +/* + * A_Star - '*' representing all columns of a table or compound field + * + * This can appear within ColumnRef.fields, A_Indirection.indirection, and + * ResTarget.indirection lists. + */ +typedef struct A_Star +{ + NodeTag type; +} A_Star; + +/* + * A_Indices - array subscript or slice bounds ([idx] or [lidx:uidx]) + * + * In slice case, either or both of lidx and uidx can be NULL (omitted). + * In non-slice case, uidx holds the single subscript and lidx is always NULL. + */ +typedef struct A_Indices +{ + NodeTag type; + bool is_slice; /* true if slice (i.e., colon present) */ + Node *lidx; /* slice lower bound, if any */ + Node *uidx; /* subscript, or slice upper bound if any */ +} A_Indices; + +/* + * A_Indirection - select a field and/or array element from an expression + * + * The indirection list can contain A_Indices nodes (representing + * subscripting), String nodes (representing field selection --- the + * string value is the name of the field to select), and A_Star nodes + * (representing selection of all fields of a composite type). + * For example, a complex selection operation like + * (foo).field1[42][7].field2 + * would be represented with a single A_Indirection node having a 4-element + * indirection list. + * + * Currently, A_Star must appear only as the last list element --- the grammar + * is responsible for enforcing this! + */ +typedef struct A_Indirection +{ + NodeTag type; + Node *arg; /* the thing being selected from */ + List *indirection; /* subscripts and/or field names and/or * */ +} A_Indirection; + +/* + * A_ArrayExpr - an ARRAY[] construct + */ +typedef struct A_ArrayExpr +{ + NodeTag type; + List *elements; /* array element expressions */ + ParseLoc list_start; /* start of the element list */ + ParseLoc list_end; /* end of the elements list */ + ParseLoc location; /* token location, or -1 if unknown */ +} A_ArrayExpr; + +/* + * ResTarget - + * result target (used in target list of pre-transformed parse trees) + * + * In a SELECT target list, 'name' is the column label from an + * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the + * value expression itself. The 'indirection' field is not used. + * + * INSERT uses ResTarget in its target-column-names list. Here, 'name' is + * the name of the destination column, 'indirection' stores any subscripts + * attached to the destination, and 'val' is not used. + * + * In an UPDATE target list, 'name' is the name of the destination column, + * 'indirection' stores any subscripts attached to the destination, and + * 'val' is the expression to assign. + * + * See A_Indirection for more info about what can appear in 'indirection'. + */ +typedef struct ResTarget +{ + NodeTag type; + char *name; /* column name or NULL */ + List *indirection; /* subscripts, field names, and '*', or NIL */ + Node *val; /* the value expression to compute or assign */ + ParseLoc location; /* token location, or -1 if unknown */ +} ResTarget; + +/* + * MultiAssignRef - element of a row source expression for UPDATE + * + * In an UPDATE target list, when we have SET (a,b,c) = row-valued-expression, + * we generate separate ResTarget items for each of a,b,c. Their "val" trees + * are MultiAssignRef nodes numbered 1..n, linking to a common copy of the + * row-valued-expression (which parse analysis will process only once, when + * handling the MultiAssignRef with colno=1). + */ +typedef struct MultiAssignRef +{ + NodeTag type; + Node *source; /* the row-valued expression */ + int colno; /* column number for this target (1..n) */ + int ncolumns; /* number of targets in the construct */ +} MultiAssignRef; + +/* + * SortBy - for ORDER BY clause + */ +typedef struct SortBy +{ + NodeTag type; + Node *node; /* expression to sort on */ + SortByDir sortby_dir; /* ASC/DESC/USING/default */ + SortByNulls sortby_nulls; /* NULLS FIRST/LAST */ + List *useOp; /* name of op to use, if SORTBY_USING */ + ParseLoc location; /* operator location, or -1 if none/unknown */ +} SortBy; + +/* + * WindowDef - raw representation of WINDOW and OVER clauses + * + * For entries in a WINDOW list, "name" is the window name being defined. + * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname" + * for the "OVER (window)" syntax, which is subtly different --- the latter + * implies overriding the window frame clause. + */ +typedef struct WindowDef +{ + NodeTag type; + char *name; /* window's own name */ + char *refname; /* referenced window name, if any */ + List *partitionClause; /* PARTITION BY expression list */ + List *orderClause; /* ORDER BY (list of SortBy) */ + int frameOptions; /* frame_clause options, see below */ + Node *startOffset; /* expression for starting bound, if any */ + Node *endOffset; /* expression for ending bound, if any */ + ParseLoc location; /* parse location, or -1 if none/unknown */ +} WindowDef; + +/* + * frameOptions is an OR of these bits. The NONDEFAULT and BETWEEN bits are + * used so that ruleutils.c can tell which properties were specified and + * which were defaulted; the correct behavioral bits must be set either way. + * The START_foo and END_foo options must come in pairs of adjacent bits for + * the convenience of gram.y, even though some of them are useless/invalid. + */ +#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */ +#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */ +#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */ +#define FRAMEOPTION_GROUPS 0x00008 /* GROUPS behavior */ +#define FRAMEOPTION_BETWEEN 0x00010 /* BETWEEN given? */ +#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00020 /* start is U. P. */ +#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00040 /* (disallowed) */ +#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00080 /* (disallowed) */ +#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00100 /* end is U. F. */ +#define FRAMEOPTION_START_CURRENT_ROW 0x00200 /* start is C. R. */ +#define FRAMEOPTION_END_CURRENT_ROW 0x00400 /* end is C. R. */ +#define FRAMEOPTION_START_OFFSET_PRECEDING 0x00800 /* start is O. P. */ +#define FRAMEOPTION_END_OFFSET_PRECEDING 0x01000 /* end is O. P. */ +#define FRAMEOPTION_START_OFFSET_FOLLOWING 0x02000 /* start is O. F. */ +#define FRAMEOPTION_END_OFFSET_FOLLOWING 0x04000 /* end is O. F. */ +#define FRAMEOPTION_EXCLUDE_CURRENT_ROW 0x08000 /* omit C.R. */ +#define FRAMEOPTION_EXCLUDE_GROUP 0x10000 /* omit C.R. & peers */ +#define FRAMEOPTION_EXCLUDE_TIES 0x20000 /* omit C.R.'s peers */ + +#define FRAMEOPTION_START_OFFSET \ + (FRAMEOPTION_START_OFFSET_PRECEDING | FRAMEOPTION_START_OFFSET_FOLLOWING) +#define FRAMEOPTION_END_OFFSET \ + (FRAMEOPTION_END_OFFSET_PRECEDING | FRAMEOPTION_END_OFFSET_FOLLOWING) +#define FRAMEOPTION_EXCLUSION \ + (FRAMEOPTION_EXCLUDE_CURRENT_ROW | FRAMEOPTION_EXCLUDE_GROUP | \ + FRAMEOPTION_EXCLUDE_TIES) + +#define FRAMEOPTION_DEFAULTS \ + (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \ + FRAMEOPTION_END_CURRENT_ROW) + +/* + * RangeSubselect - subquery appearing in a FROM clause + */ +typedef struct RangeSubselect +{ + NodeTag type; + bool lateral; /* does it have LATERAL prefix? */ + Node *subquery; /* the untransformed sub-select clause */ + Alias *alias; /* table alias & optional column aliases */ +} RangeSubselect; + +/* + * RangeFunction - function call appearing in a FROM clause + * + * functions is a List because we use this to represent the construct + * ROWS FROM(func1(...), func2(...), ...). Each element of this list is a + * two-element sublist, the first element being the untransformed function + * call tree, and the second element being a possibly-empty list of ColumnDef + * nodes representing any columndef list attached to that function within the + * ROWS FROM() syntax. + * + * alias and coldeflist represent any alias and/or columndef list attached + * at the top level. (We disallow coldeflist appearing both here and + * per-function, but that's checked in parse analysis, not by the grammar.) + */ +typedef struct RangeFunction +{ + NodeTag type; + bool lateral; /* does it have LATERAL prefix? */ + bool ordinality; /* does it have WITH ORDINALITY suffix? */ + bool is_rowsfrom; /* is result of ROWS FROM() syntax? */ + List *functions; /* per-function information, see above */ + Alias *alias; /* table alias & optional column aliases */ + List *coldeflist; /* list of ColumnDef nodes to describe result + * of function returning RECORD */ +} RangeFunction; + +/* + * RangeTableFunc - raw form of "table functions" such as XMLTABLE + * + * Note: JSON_TABLE is also a "table function", but it uses JsonTable node, + * not RangeTableFunc. + */ +typedef struct RangeTableFunc +{ + NodeTag type; + bool lateral; /* does it have LATERAL prefix? */ + Node *docexpr; /* document expression */ + Node *rowexpr; /* row generator expression */ + List *namespaces; /* list of namespaces as ResTarget */ + List *columns; /* list of RangeTableFuncCol */ + Alias *alias; /* table alias & optional column aliases */ + ParseLoc location; /* token location, or -1 if unknown */ +} RangeTableFunc; + +/* + * RangeTableFuncCol - one column in a RangeTableFunc->columns + * + * If for_ordinality is true (FOR ORDINALITY), then the column is an int4 + * column and the rest of the fields are ignored. + */ +typedef struct RangeTableFuncCol +{ + NodeTag type; + char *colname; /* name of generated column */ + TypeName *typeName; /* type of generated column */ + bool for_ordinality; /* does it have FOR ORDINALITY? */ + bool is_not_null; /* does it have NOT NULL? */ + Node *colexpr; /* column filter expression */ + Node *coldefexpr; /* column default value expression */ + ParseLoc location; /* token location, or -1 if unknown */ +} RangeTableFuncCol; + +/* + * RangeTableSample - TABLESAMPLE appearing in a raw FROM clause + * + * This node, appearing only in raw parse trees, represents + * TABLESAMPLE () REPEATABLE () + * Currently, the can only be a RangeVar, but we might in future + * allow RangeSubselect and other options. Note that the RangeTableSample + * is wrapped around the node representing the , rather than being + * a subfield of it. + */ +typedef struct RangeTableSample +{ + NodeTag type; + Node *relation; /* relation to be sampled */ + List *method; /* sampling method name (possibly qualified) */ + List *args; /* argument(s) for sampling method */ + Node *repeatable; /* REPEATABLE expression, or NULL if none */ + ParseLoc location; /* method name location, or -1 if unknown */ +} RangeTableSample; + +/* + * ColumnDef - column definition (used in various creates) + * + * If the column has a default value, we may have the value expression + * in either "raw" form (an untransformed parse tree) or "cooked" form + * (a post-parse-analysis, executable expression tree), depending on + * how this ColumnDef node was created (by parsing, or by inheritance + * from an existing relation). We should never have both in the same node! + * + * Similarly, we may have a COLLATE specification in either raw form + * (represented as a CollateClause with arg==NULL) or cooked form + * (the collation's OID). + * + * The constraints list may contain a CONSTR_DEFAULT item in a raw + * parsetree produced by gram.y, but transformCreateStmt will remove + * the item and set raw_default instead. CONSTR_DEFAULT items + * should not appear in any subsequent processing. + */ +typedef struct ColumnDef +{ + NodeTag type; + char *colname; /* name of column */ + TypeName *typeName; /* type of column */ + char *compression; /* compression method for column */ + int16 inhcount; /* number of times column is inherited */ + bool is_local; /* column has local (non-inherited) def'n */ + bool is_not_null; /* NOT NULL constraint specified? */ + bool is_from_type; /* column definition came from table type */ + char storage; /* attstorage setting, or 0 for default */ + char *storage_name; /* attstorage setting name or NULL for default */ + Node *raw_default; /* default value (untransformed parse tree) */ + Node *cooked_default; /* default value (transformed expr tree) */ + char identity; /* attidentity setting */ + RangeVar *identitySequence; /* to store identity sequence name for + * ALTER TABLE ... ADD COLUMN */ + char generated; /* attgenerated setting */ + CollateClause *collClause; /* untransformed COLLATE spec, if any */ + Oid collOid; /* collation OID (InvalidOid if not set) */ + List *constraints; /* other constraints on column */ + List *fdwoptions; /* per-column FDW options */ + ParseLoc location; /* parse location, or -1 if none/unknown */ +} ColumnDef; + +/* + * TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause + */ +typedef struct TableLikeClause +{ + NodeTag type; + RangeVar *relation; + bits32 options; /* OR of TableLikeOption flags */ + Oid relationOid; /* If table has been looked up, its OID */ +} TableLikeClause; + +typedef enum TableLikeOption +{ + CREATE_TABLE_LIKE_COMMENTS = 1 << 0, + CREATE_TABLE_LIKE_COMPRESSION = 1 << 1, + CREATE_TABLE_LIKE_CONSTRAINTS = 1 << 2, + CREATE_TABLE_LIKE_DEFAULTS = 1 << 3, + CREATE_TABLE_LIKE_GENERATED = 1 << 4, + CREATE_TABLE_LIKE_IDENTITY = 1 << 5, + CREATE_TABLE_LIKE_INDEXES = 1 << 6, + CREATE_TABLE_LIKE_STATISTICS = 1 << 7, + CREATE_TABLE_LIKE_STORAGE = 1 << 8, + CREATE_TABLE_LIKE_ALL = PG_INT32_MAX +} TableLikeOption; + +/* + * IndexElem - index parameters (used in CREATE INDEX, and in ON CONFLICT) + * + * For a plain index attribute, 'name' is the name of the table column to + * index, and 'expr' is NULL. For an index expression, 'name' is NULL and + * 'expr' is the expression tree. + */ +typedef struct IndexElem +{ + NodeTag type; + char *name; /* name of attribute to index, or NULL */ + Node *expr; /* expression to index, or NULL */ + char *indexcolname; /* name for index column; NULL = default */ + List *collation; /* name of collation; NIL = default */ + List *opclass; /* name of desired opclass; NIL = default */ + List *opclassopts; /* opclass-specific options, or NIL */ + SortByDir ordering; /* ASC/DESC/default */ + SortByNulls nulls_ordering; /* FIRST/LAST/default */ +} IndexElem; + +/* + * DefElem - a generic "name = value" option definition + * + * In some contexts the name can be qualified. Also, certain SQL commands + * allow a SET/ADD/DROP action to be attached to option settings, so it's + * convenient to carry a field for that too. (Note: currently, it is our + * practice that the grammar allows namespace and action only in statements + * where they are relevant; C code can just ignore those fields in other + * statements.) + */ +typedef enum DefElemAction +{ + DEFELEM_UNSPEC, /* no action given */ + DEFELEM_SET, + DEFELEM_ADD, + DEFELEM_DROP, +} DefElemAction; + +typedef struct DefElem +{ + NodeTag type; + char *defnamespace; /* NULL if unqualified name */ + char *defname; + Node *arg; /* typically Integer, Float, String, or + * TypeName */ + DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */ + ParseLoc location; /* token location, or -1 if unknown */ +} DefElem; + +/* + * LockingClause - raw representation of FOR [NO KEY] UPDATE/[KEY] SHARE + * options + * + * Note: lockedRels == NIL means "all relations in query". Otherwise it + * is a list of RangeVar nodes. (We use RangeVar mainly because it carries + * a location field --- currently, parse analysis insists on unqualified + * names in LockingClause.) + */ +typedef struct LockingClause +{ + NodeTag type; + List *lockedRels; /* FOR [KEY] UPDATE/SHARE relations */ + LockClauseStrength strength; + LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */ +} LockingClause; + +/* + * XMLSERIALIZE (in raw parse tree only) + */ +typedef struct XmlSerialize +{ + NodeTag type; + XmlOptionType xmloption; /* DOCUMENT or CONTENT */ + Node *expr; + TypeName *typeName; + bool indent; /* [NO] INDENT */ + ParseLoc location; /* token location, or -1 if unknown */ +} XmlSerialize; + +/* Partitioning related definitions */ + +/* + * PartitionElem - parse-time representation of a single partition key + * + * expr can be either a raw expression tree or a parse-analyzed expression. + * We don't store these on-disk, though. + */ +typedef struct PartitionElem +{ + NodeTag type; + char *name; /* name of column to partition on, or NULL */ + Node *expr; /* expression to partition on, or NULL */ + List *collation; /* name of collation; NIL = default */ + List *opclass; /* name of desired opclass; NIL = default */ + ParseLoc location; /* token location, or -1 if unknown */ +} PartitionElem; + +typedef enum PartitionStrategy +{ + PARTITION_STRATEGY_LIST = 'l', + PARTITION_STRATEGY_RANGE = 'r', + PARTITION_STRATEGY_HASH = 'h', +} PartitionStrategy; + +/* + * PartitionSpec - parse-time representation of a partition key specification + * + * This represents the key space we will be partitioning on. + */ +typedef struct PartitionSpec +{ + NodeTag type; + PartitionStrategy strategy; + List *partParams; /* List of PartitionElems */ + ParseLoc location; /* token location, or -1 if unknown */ +} PartitionSpec; + +/* + * PartitionBoundSpec - a partition bound specification + * + * This represents the portion of the partition key space assigned to a + * particular partition. These are stored on disk in pg_class.relpartbound. + */ +struct PartitionBoundSpec +{ + NodeTag type; + + char strategy; /* see PARTITION_STRATEGY codes above */ + bool is_default; /* is it a default partition bound? */ + + /* Partitioning info for HASH strategy: */ + int modulus; + int remainder; + + /* Partitioning info for LIST strategy: */ + List *listdatums; /* List of Consts (or A_Consts in raw tree) */ + + /* Partitioning info for RANGE strategy: */ + List *lowerdatums; /* List of PartitionRangeDatums */ + List *upperdatums; /* List of PartitionRangeDatums */ + + ParseLoc location; /* token location, or -1 if unknown */ +}; + +/* + * PartitionRangeDatum - one of the values in a range partition bound + * + * This can be MINVALUE, MAXVALUE or a specific bounded value. + */ +typedef enum PartitionRangeDatumKind +{ + PARTITION_RANGE_DATUM_MINVALUE = -1, /* less than any other value */ + PARTITION_RANGE_DATUM_VALUE = 0, /* a specific (bounded) value */ + PARTITION_RANGE_DATUM_MAXVALUE = 1, /* greater than any other value */ +} PartitionRangeDatumKind; + +typedef struct PartitionRangeDatum +{ + NodeTag type; + + PartitionRangeDatumKind kind; + Node *value; /* Const (or A_Const in raw tree), if kind is + * PARTITION_RANGE_DATUM_VALUE, else NULL */ + + ParseLoc location; /* token location, or -1 if unknown */ +} PartitionRangeDatum; + +/* + * PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION commands + */ +typedef struct PartitionCmd +{ + NodeTag type; + RangeVar *name; /* name of partition to attach/detach */ + PartitionBoundSpec *bound; /* FOR VALUES, if attaching */ + bool concurrent; +} PartitionCmd; + +/**************************************************************************** + * Nodes for a Query tree + ****************************************************************************/ + +/*-------------------- + * RangeTblEntry - + * A range table is a List of RangeTblEntry nodes. + * + * A range table entry may represent a plain relation, a sub-select in + * FROM, or the result of a JOIN clause. (Only explicit JOIN syntax + * produces an RTE, not the implicit join resulting from multiple FROM + * items. This is because we only need the RTE to deal with SQL features + * like outer joins and join-output-column aliasing.) Other special + * RTE types also exist, as indicated by RTEKind. + * + * Note that we consider RTE_RELATION to cover anything that has a pg_class + * entry. relkind distinguishes the sub-cases. + * + * alias is an Alias node representing the AS alias-clause attached to the + * FROM expression, or NULL if no clause. + * + * eref is the table reference name and column reference names (either + * real or aliases). Note that system columns (OID etc) are not included + * in the column list. + * eref->aliasname is required to be present, and should generally be used + * to identify the RTE for error messages etc. + * + * In RELATION RTEs, the colnames in both alias and eref are indexed by + * physical attribute number; this means there must be colname entries for + * dropped columns. When building an RTE we insert empty strings ("") for + * dropped columns. Note however that a stored rule may have nonempty + * colnames for columns dropped since the rule was created (and for that + * matter the colnames might be out of date due to column renamings). + * The same comments apply to FUNCTION RTEs when a function's return type + * is a named composite type. + * + * In JOIN RTEs, the colnames in both alias and eref are one-to-one with + * joinaliasvars entries. A JOIN RTE will omit columns of its inputs when + * those columns are known to be dropped at parse time. Again, however, + * a stored rule might contain entries for columns dropped since the rule + * was created. (This is only possible for columns not actually referenced + * in the rule.) When loading a stored rule, we replace the joinaliasvars + * items for any such columns with null pointers. (We can't simply delete + * them from the joinaliasvars list, because that would affect the attnums + * of Vars referencing the rest of the list.) + * + * inFromCl marks those range variables that are listed in the FROM clause. + * It's false for RTEs that are added to a query behind the scenes, such + * as the NEW and OLD variables for a rule, or the subqueries of a UNION. + * This flag is not used during parsing (except in transformLockingClause, + * q.v.); the parser now uses a separate "namespace" data structure to + * control visibility. But it is needed by ruleutils.c to determine + * whether RTEs should be shown in decompiled queries. + * + * securityQuals is a list of security barrier quals (boolean expressions), + * to be tested in the listed order before returning a row from the + * relation. It is always NIL in parser output. Entries are added by the + * rewriter to implement security-barrier views and/or row-level security. + * Note that the planner turns each boolean expression into an implicitly + * AND'ed sublist, as is its usual habit with qualification expressions. + *-------------------- + */ +typedef enum RTEKind +{ + RTE_RELATION, /* ordinary relation reference */ + RTE_SUBQUERY, /* subquery in FROM */ + RTE_JOIN, /* join */ + RTE_FUNCTION, /* function in FROM */ + RTE_TABLEFUNC, /* TableFunc(.., column list) */ + RTE_VALUES, /* VALUES (), (), ... */ + RTE_CTE, /* common table expr (WITH list element) */ + RTE_NAMEDTUPLESTORE, /* tuplestore, e.g. for AFTER triggers */ + RTE_RESULT, /* RTE represents an empty FROM clause; such + * RTEs are added by the planner, they're not + * present during parsing or rewriting */ + RTE_GROUP, /* the grouping step */ +} RTEKind; + +typedef struct RangeTblEntry +{ + pg_node_attr(custom_read_write) + + NodeTag type; + + /* + * Fields valid in all RTEs: + * + * put alias + eref first to make dump more legible + */ + /* user-written alias clause, if any */ + Alias *alias pg_node_attr(query_jumble_ignore); + + /* + * Expanded reference names. This uses a custom query jumble function so + * that the table name is included in the computation, but not its list of + * columns. + */ + Alias *eref pg_node_attr(custom_query_jumble); + + RTEKind rtekind; /* see above */ + + /* + * Fields valid for a plain relation RTE (else zero): + * + * inh is true for relation references that should be expanded to include + * inheritance children, if the rel has any. In the parser, this will + * only be true for RTE_RELATION entries. The planner also uses this + * field to mark RTE_SUBQUERY entries that contain UNION ALL queries that + * it has flattened into pulled-up subqueries (creating a structure much + * like the effects of inheritance). + * + * rellockmode is really LOCKMODE, but it's declared int to avoid having + * to include lock-related headers here. It must be RowExclusiveLock if + * the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if + * the RTE is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock. + * + * Note: in some cases, rule expansion may result in RTEs that are marked + * with RowExclusiveLock even though they are not the target of the + * current query; this happens if a DO ALSO rule simply scans the original + * target table. We leave such RTEs with their original lockmode so as to + * avoid getting an additional, lesser lock. + * + * perminfoindex is 1-based index of the RTEPermissionInfo belonging to + * this RTE in the containing struct's list of same; 0 if permissions need + * not be checked for this RTE. + * + * As a special case, relid, relkind, rellockmode, and perminfoindex can + * also be set (nonzero) in an RTE_SUBQUERY RTE. This occurs when we + * convert an RTE_RELATION RTE naming a view into an RTE_SUBQUERY + * containing the view's query. We still need to perform run-time locking + * and permission checks on the view, even though it's not directly used + * in the query anymore, and the most expedient way to do that is to + * retain these fields from the old state of the RTE. + * + * As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate + * that the tuple format of the tuplestore is the same as the referenced + * relation. This allows plans referencing AFTER trigger transition + * tables to be invalidated if the underlying table is altered. + */ + /* OID of the relation */ + Oid relid pg_node_attr(query_jumble_ignore); + /* inheritance requested? */ + bool inh; + /* relation kind (see pg_class.relkind) */ + char relkind pg_node_attr(query_jumble_ignore); + /* lock level that query requires on the rel */ + int rellockmode pg_node_attr(query_jumble_ignore); + /* index of RTEPermissionInfo entry, or 0 */ + Index perminfoindex pg_node_attr(query_jumble_ignore); + /* sampling info, or NULL */ + struct TableSampleClause *tablesample; + + /* + * Fields valid for a subquery RTE (else NULL): + */ + /* the sub-query */ + Query *subquery; + /* is from security_barrier view? */ + bool security_barrier pg_node_attr(query_jumble_ignore); + + /* + * Fields valid for a join RTE (else NULL/zero): + * + * joinaliasvars is a list of (usually) Vars corresponding to the columns + * of the join result. An alias Var referencing column K of the join + * result can be replaced by the K'th element of joinaliasvars --- but to + * simplify the task of reverse-listing aliases correctly, we do not do + * that until planning time. In detail: an element of joinaliasvars can + * be a Var of one of the join's input relations, or such a Var with an + * implicit coercion to the join's output column type, or a COALESCE + * expression containing the two input column Vars (possibly coerced). + * Elements beyond the first joinmergedcols entries are always just Vars, + * and are never referenced from elsewhere in the query (that is, join + * alias Vars are generated only for merged columns). We keep these + * entries only because they're needed in expandRTE() and similar code. + * + * Vars appearing within joinaliasvars are marked with varnullingrels sets + * that describe the nulling effects of this join and lower ones. This is + * essential for FULL JOIN cases, because the COALESCE expression only + * describes the semantics correctly if its inputs have been nulled by the + * join. For other cases, it allows expandRTE() to generate a valid + * representation of the join's output without consulting additional + * parser state. + * + * Within a Query loaded from a stored rule, it is possible for non-merged + * joinaliasvars items to be null pointers, which are placeholders for + * (necessarily unreferenced) columns dropped since the rule was made. + * Also, once planning begins, joinaliasvars items can be almost anything, + * as a result of subquery-flattening substitutions. + * + * joinleftcols is an integer list of physical column numbers of the left + * join input rel that are included in the join; likewise joinrighttcols + * for the right join input rel. (Which rels those are can be determined + * from the associated JoinExpr.) If the join is USING/NATURAL, then the + * first joinmergedcols entries in each list identify the merged columns. + * The merged columns come first in the join output, then remaining + * columns of the left input, then remaining columns of the right. + * + * Note that input columns could have been dropped after creation of a + * stored rule, if they are not referenced in the query (in particular, + * merged columns could not be dropped); this is not accounted for in + * joinleftcols/joinrighttcols. + */ + JoinType jointype; + /* number of merged (JOIN USING) columns */ + int joinmergedcols pg_node_attr(query_jumble_ignore); + /* list of alias-var expansions */ + List *joinaliasvars pg_node_attr(query_jumble_ignore); + /* left-side input column numbers */ + List *joinleftcols pg_node_attr(query_jumble_ignore); + /* right-side input column numbers */ + List *joinrightcols pg_node_attr(query_jumble_ignore); + + /* + * join_using_alias is an alias clause attached directly to JOIN/USING. It + * is different from the alias field (below) in that it does not hide the + * range variables of the tables being joined. + */ + Alias *join_using_alias pg_node_attr(query_jumble_ignore); + + /* + * Fields valid for a function RTE (else NIL/zero): + * + * When funcordinality is true, the eref->colnames list includes an alias + * for the ordinality column. The ordinality column is otherwise + * implicit, and must be accounted for "by hand" in places such as + * expandRTE(). + */ + /* list of RangeTblFunction nodes */ + List *functions; + /* is this called WITH ORDINALITY? */ + bool funcordinality; + + /* + * Fields valid for a TableFunc RTE (else NULL): + */ + TableFunc *tablefunc; + + /* + * Fields valid for a values RTE (else NIL): + */ + /* list of expression lists */ + List *values_lists; + + /* + * Fields valid for a CTE RTE (else NULL/zero): + */ + /* name of the WITH list item */ + char *ctename; + /* number of query levels up */ + Index ctelevelsup; + /* is this a recursive self-reference? */ + bool self_reference pg_node_attr(query_jumble_ignore); + + /* + * Fields valid for CTE, VALUES, ENR, and TableFunc RTEs (else NIL): + * + * We need these for CTE RTEs so that the types of self-referential + * columns are well-defined. For VALUES RTEs, storing these explicitly + * saves having to re-determine the info by scanning the values_lists. For + * ENRs, we store the types explicitly here (we could get the information + * from the catalogs if 'relid' was supplied, but we'd still need these + * for TupleDesc-based ENRs, so we might as well always store the type + * info here). For TableFuncs, these fields are redundant with data in + * the TableFunc node, but keeping them here allows some code sharing with + * the other cases. + * + * For ENRs only, we have to consider the possibility of dropped columns. + * A dropped column is included in these lists, but it will have zeroes in + * all three lists (as well as an empty-string entry in eref). Testing + * for zero coltype is the standard way to detect a dropped column. + */ + /* OID list of column type OIDs */ + List *coltypes pg_node_attr(query_jumble_ignore); + /* integer list of column typmods */ + List *coltypmods pg_node_attr(query_jumble_ignore); + /* OID list of column collation OIDs */ + List *colcollations pg_node_attr(query_jumble_ignore); + + /* + * Fields valid for ENR RTEs (else NULL/zero): + */ + /* name of ephemeral named relation */ + char *enrname; + /* estimated or actual from caller */ + Cardinality enrtuples pg_node_attr(query_jumble_ignore); + + /* + * Fields valid for a GROUP RTE (else NIL): + */ + /* list of grouping expressions */ + List *groupexprs; + + /* + * Fields valid in all RTEs: + */ + /* was LATERAL specified? */ + bool lateral pg_node_attr(query_jumble_ignore); + /* present in FROM clause? */ + bool inFromCl pg_node_attr(query_jumble_ignore); + /* security barrier quals to apply, if any */ + List *securityQuals pg_node_attr(query_jumble_ignore); +} RangeTblEntry; + +/* + * RTEPermissionInfo + * Per-relation information for permission checking. Added to the Query + * node by the parser when adding the corresponding RTE to the query + * range table and subsequently editorialized on by the rewriter if + * needed after rule expansion. + * + * Only the relations directly mentioned in the query are checked for + * access permissions by the core executor, so only their RTEPermissionInfos + * are present in the Query. However, extensions may want to check inheritance + * children too, depending on the value of rte->inh, so it's copied in 'inh' + * for their perusal. + * + * requiredPerms and checkAsUser specify run-time access permissions checks + * to be performed at query startup. The user must have *all* of the + * permissions that are OR'd together in requiredPerms (never 0!). If + * checkAsUser is not zero, then do the permissions checks using the access + * rights of that user, not the current effective user ID. (This allows rules + * to act as setuid gateways.) + * + * For SELECT/INSERT/UPDATE permissions, if the user doesn't have table-wide + * permissions then it is sufficient to have the permissions on all columns + * identified in selectedCols (for SELECT) and/or insertedCols and/or + * updatedCols (INSERT with ON CONFLICT DO UPDATE may have all 3). + * selectedCols, insertedCols and updatedCols are bitmapsets, which cannot have + * negative integer members, so we subtract FirstLowInvalidHeapAttributeNumber + * from column numbers before storing them in these fields. A whole-row Var + * reference is represented by setting the bit for InvalidAttrNumber. + * + * updatedCols is also used in some other places, for example, to determine + * which triggers to fire and in FDWs to know which changed columns they need + * to ship off. + */ +typedef struct RTEPermissionInfo +{ + NodeTag type; + + Oid relid; /* relation OID */ + bool inh; /* separately check inheritance children? */ + AclMode requiredPerms; /* bitmask of required access permissions */ + Oid checkAsUser; /* if valid, check access as this role */ + Bitmapset *selectedCols; /* columns needing SELECT permission */ + Bitmapset *insertedCols; /* columns needing INSERT permission */ + Bitmapset *updatedCols; /* columns needing UPDATE permission */ +} RTEPermissionInfo; + +/* + * RangeTblFunction - + * RangeTblEntry subsidiary data for one function in a FUNCTION RTE. + * + * If the function had a column definition list (required for an + * otherwise-unspecified RECORD result), funccolnames lists the names given + * in the definition list, funccoltypes lists their declared column types, + * funccoltypmods lists their typmods, funccolcollations their collations. + * Otherwise, those fields are NIL. + * + * Notice we don't attempt to store info about the results of functions + * returning named composite types, because those can change from time to + * time. We do however remember how many columns we thought the type had + * (including dropped columns!), so that we can successfully ignore any + * columns added after the query was parsed. + * + * The query jumbling only needs to track the function expression. + */ +typedef struct RangeTblFunction +{ + NodeTag type; + + Node *funcexpr; /* expression tree for func call */ + /* number of columns it contributes to RTE */ + int funccolcount pg_node_attr(query_jumble_ignore); + /* These fields record the contents of a column definition list, if any: */ + /* column names (list of String) */ + List *funccolnames pg_node_attr(query_jumble_ignore); + /* OID list of column type OIDs */ + List *funccoltypes pg_node_attr(query_jumble_ignore); + /* integer list of column typmods */ + List *funccoltypmods pg_node_attr(query_jumble_ignore); + /* OID list of column collation OIDs */ + List *funccolcollations pg_node_attr(query_jumble_ignore); + + /* This is set during planning for use by the executor: */ + /* PARAM_EXEC Param IDs affecting this func */ + Bitmapset *funcparams pg_node_attr(query_jumble_ignore); +} RangeTblFunction; + +/* + * TableSampleClause - TABLESAMPLE appearing in a transformed FROM clause + * + * Unlike RangeTableSample, this is a subnode of the relevant RangeTblEntry. + */ +typedef struct TableSampleClause +{ + NodeTag type; + Oid tsmhandler; /* OID of the tablesample handler function */ + List *args; /* tablesample argument expression(s) */ + Expr *repeatable; /* REPEATABLE expression, or NULL if none */ +} TableSampleClause; + +/* + * WithCheckOption - + * representation of WITH CHECK OPTION checks to be applied to new tuples + * when inserting/updating an auto-updatable view, or RLS WITH CHECK + * policies to be applied when inserting/updating a relation with RLS. + */ +typedef enum WCOKind +{ + WCO_VIEW_CHECK, /* WCO on an auto-updatable view */ + WCO_RLS_INSERT_CHECK, /* RLS INSERT WITH CHECK policy */ + WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */ + WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO UPDATE USING policy */ + WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */ + WCO_RLS_MERGE_DELETE_CHECK, /* RLS MERGE DELETE USING policy */ +} WCOKind; + +typedef struct WithCheckOption +{ + NodeTag type; + WCOKind kind; /* kind of WCO */ + char *relname; /* name of relation that specified the WCO */ + char *polname; /* name of RLS policy being checked */ + Node *qual; /* constraint qual to check */ + bool cascaded; /* true for a cascaded WCO on a view */ +} WithCheckOption; + +/* + * SortGroupClause - + * representation of ORDER BY, GROUP BY, PARTITION BY, + * DISTINCT, DISTINCT ON items + * + * You might think that ORDER BY is only interested in defining ordering, + * and GROUP/DISTINCT are only interested in defining equality. However, + * one way to implement grouping is to sort and then apply a "uniq"-like + * filter. So it's also interesting to keep track of possible sort operators + * for GROUP/DISTINCT, and in particular to try to sort for the grouping + * in a way that will also yield a requested ORDER BY ordering. So we need + * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates + * the decision to give them the same representation. + * + * tleSortGroupRef must match ressortgroupref of exactly one entry of the + * query's targetlist; that is the expression to be sorted or grouped by. + * eqop is the OID of the equality operator. + * sortop is the OID of the ordering operator (a "<" or ">" operator), + * or InvalidOid if not available. + * nulls_first means about what you'd expect. If sortop is InvalidOid + * then nulls_first is meaningless and should be set to false. + * hashable is true if eqop is hashable (note this condition also depends + * on the datatype of the input expression). + * + * In an ORDER BY item, all fields must be valid. (The eqop isn't essential + * here, but it's cheap to get it along with the sortop, and requiring it + * to be valid eases comparisons to grouping items.) Note that this isn't + * actually enough information to determine an ordering: if the sortop is + * collation-sensitive, a collation OID is needed too. We don't store the + * collation in SortGroupClause because it's not available at the time the + * parser builds the SortGroupClause; instead, consult the exposed collation + * of the referenced targetlist expression to find out what it is. + * + * In a grouping item, eqop must be valid. If the eqop is a btree equality + * operator, then sortop should be set to a compatible ordering operator. + * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that + * the query presents for the same tlist item. If there is none, we just + * use the default ordering op for the datatype. + * + * If the tlist item's type has a hash opclass but no btree opclass, then + * we will set eqop to the hash equality operator, sortop to InvalidOid, + * and nulls_first to false. A grouping item of this kind can only be + * implemented by hashing, and of course it'll never match an ORDER BY item. + * + * The hashable flag is provided since we generally have the requisite + * information readily available when the SortGroupClause is constructed, + * and it's relatively expensive to get it again later. Note there is no + * need for a "sortable" flag since OidIsValid(sortop) serves the purpose. + * + * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses. + * In SELECT DISTINCT, the distinctClause list is as long or longer than the + * sortClause list, while in SELECT DISTINCT ON it's typically shorter. + * The two lists must match up to the end of the shorter one --- the parser + * rearranges the distinctClause if necessary to make this true. (This + * restriction ensures that only one sort step is needed to both satisfy the + * ORDER BY and set up for the Unique step. This is semantically necessary + * for DISTINCT ON, and presents no real drawback for DISTINCT.) + */ +typedef struct SortGroupClause +{ + NodeTag type; + Index tleSortGroupRef; /* reference into targetlist */ + Oid eqop; /* the equality operator ('=' op) */ + Oid sortop; /* the ordering operator ('<' op), or 0 */ + bool reverse_sort; /* is sortop a "greater than" operator? */ + bool nulls_first; /* do NULLs come before normal values? */ + /* can eqop be implemented by hashing? */ + bool hashable pg_node_attr(query_jumble_ignore); +} SortGroupClause; + +/* + * GroupingSet - + * representation of CUBE, ROLLUP and GROUPING SETS clauses + * + * In a Query with grouping sets, the groupClause contains a flat list of + * SortGroupClause nodes for each distinct expression used. The actual + * structure of the GROUP BY clause is given by the groupingSets tree. + * + * In the raw parser output, GroupingSet nodes (of all types except SIMPLE + * which is not used) are potentially mixed in with the expressions in the + * groupClause of the SelectStmt. (An expression can't contain a GroupingSet, + * but a list may mix GroupingSet and expression nodes.) At this stage, the + * content of each node is a list of expressions, some of which may be RowExprs + * which represent sublists rather than actual row constructors, and nested + * GroupingSet nodes where legal in the grammar. The structure directly + * reflects the query syntax. + * + * In parse analysis, the transformed expressions are used to build the tlist + * and groupClause list (of SortGroupClause nodes), and the groupingSets tree + * is eventually reduced to a fixed format: + * + * EMPTY nodes represent (), and obviously have no content + * + * SIMPLE nodes represent a list of one or more expressions to be treated as an + * atom by the enclosing structure; the content is an integer list of + * ressortgroupref values (see SortGroupClause) + * + * CUBE and ROLLUP nodes contain a list of one or more SIMPLE nodes. + * + * SETS nodes contain a list of EMPTY, SIMPLE, CUBE or ROLLUP nodes, but after + * parse analysis they cannot contain more SETS nodes; enough of the syntactic + * transforms of the spec have been applied that we no longer have arbitrarily + * deep nesting (though we still preserve the use of cube/rollup). + * + * Note that if the groupingSets tree contains no SIMPLE nodes (only EMPTY + * nodes at the leaves), then the groupClause will be empty, but this is still + * an aggregation query (similar to using aggs or HAVING without GROUP BY). + * + * As an example, the following clause: + * + * GROUP BY GROUPING SETS ((a,b), CUBE(c,(d,e))) + * + * looks like this after raw parsing: + * + * SETS( RowExpr(a,b) , CUBE( c, RowExpr(d,e) ) ) + * + * and parse analysis converts it to: + * + * SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) ) + */ +typedef enum GroupingSetKind +{ + GROUPING_SET_EMPTY, + GROUPING_SET_SIMPLE, + GROUPING_SET_ROLLUP, + GROUPING_SET_CUBE, + GROUPING_SET_SETS, +} GroupingSetKind; + +typedef struct GroupingSet +{ + NodeTag type; + GroupingSetKind kind pg_node_attr(query_jumble_ignore); + List *content; + ParseLoc location; +} GroupingSet; + +/* + * WindowClause - + * transformed representation of WINDOW and OVER clauses + * + * A parsed Query's windowClause list contains these structs. "name" is set + * if the clause originally came from WINDOW, and is NULL if it originally + * was an OVER clause (but note that we collapse out duplicate OVERs). + * partitionClause and orderClause are lists of SortGroupClause structs. + * partitionClause is sanitized by the query planner to remove any columns or + * expressions belonging to redundant PathKeys. + * If we have RANGE with offset PRECEDING/FOLLOWING, the semantics of that are + * specified by startInRangeFunc/inRangeColl/inRangeAsc/inRangeNullsFirst + * for the start offset, or endInRangeFunc/inRange* for the end offset. + * winref is an ID number referenced by WindowFunc nodes; it must be unique + * among the members of a Query's windowClause list. + * When refname isn't null, the partitionClause is always copied from there; + * the orderClause might or might not be copied (see copiedOrder); the framing + * options are never copied, per spec. + * + * The information relevant for the query jumbling is the partition clause + * type and its bounds. + */ +typedef struct WindowClause +{ + NodeTag type; + /* window name (NULL in an OVER clause) */ + char *name pg_node_attr(query_jumble_ignore); + /* referenced window name, if any */ + char *refname pg_node_attr(query_jumble_ignore); + List *partitionClause; /* PARTITION BY list */ + /* ORDER BY list */ + List *orderClause; + int frameOptions; /* frame_clause options, see WindowDef */ + Node *startOffset; /* expression for starting bound, if any */ + Node *endOffset; /* expression for ending bound, if any */ + /* in_range function for startOffset */ + Oid startInRangeFunc pg_node_attr(query_jumble_ignore); + /* in_range function for endOffset */ + Oid endInRangeFunc pg_node_attr(query_jumble_ignore); + /* collation for in_range tests */ + Oid inRangeColl pg_node_attr(query_jumble_ignore); + /* use ASC sort order for in_range tests? */ + bool inRangeAsc pg_node_attr(query_jumble_ignore); + /* nulls sort first for in_range tests? */ + bool inRangeNullsFirst pg_node_attr(query_jumble_ignore); + Index winref; /* ID referenced by window functions */ + /* did we copy orderClause from refname? */ + bool copiedOrder pg_node_attr(query_jumble_ignore); +} WindowClause; + +/* + * RowMarkClause - + * parser output representation of FOR [KEY] UPDATE/SHARE clauses + * + * Query.rowMarks contains a separate RowMarkClause node for each relation + * identified as a FOR [KEY] UPDATE/SHARE target. If one of these clauses + * is applied to a subquery, we generate RowMarkClauses for all normal and + * subquery rels in the subquery, but they are marked pushedDown = true to + * distinguish them from clauses that were explicitly written at this query + * level. Also, Query.hasForUpdate tells whether there were explicit FOR + * UPDATE/SHARE/KEY SHARE clauses in the current query level. + */ +typedef struct RowMarkClause +{ + NodeTag type; + Index rti; /* range table index of target relation */ + LockClauseStrength strength; + LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */ + bool pushedDown; /* pushed down from higher query level? */ +} RowMarkClause; + +/* + * WithClause - + * representation of WITH clause + * + * Note: WithClause does not propagate into the Query representation; + * but CommonTableExpr does. + */ +typedef struct WithClause +{ + NodeTag type; + List *ctes; /* list of CommonTableExprs */ + bool recursive; /* true = WITH RECURSIVE */ + ParseLoc location; /* token location, or -1 if unknown */ +} WithClause; + +/* + * InferClause - + * ON CONFLICT unique index inference clause + * + * Note: InferClause does not propagate into the Query representation. + */ +typedef struct InferClause +{ + NodeTag type; + List *indexElems; /* IndexElems to infer unique index */ + Node *whereClause; /* qualification (partial-index predicate) */ + char *conname; /* Constraint name, or NULL if unnamed */ + ParseLoc location; /* token location, or -1 if unknown */ +} InferClause; + +/* + * OnConflictClause - + * representation of ON CONFLICT clause + * + * Note: OnConflictClause does not propagate into the Query representation. + */ +typedef struct OnConflictClause +{ + NodeTag type; + OnConflictAction action; /* DO NOTHING or UPDATE? */ + InferClause *infer; /* Optional index inference clause */ + List *targetList; /* the target list (of ResTarget) */ + Node *whereClause; /* qualifications */ + ParseLoc location; /* token location, or -1 if unknown */ +} OnConflictClause; + +/* + * CommonTableExpr - + * representation of WITH list element + */ + +typedef enum CTEMaterialize +{ + CTEMaterializeDefault, /* no option specified */ + CTEMaterializeAlways, /* MATERIALIZED */ + CTEMaterializeNever, /* NOT MATERIALIZED */ +} CTEMaterialize; + +typedef struct CTESearchClause +{ + NodeTag type; + List *search_col_list; + bool search_breadth_first; + char *search_seq_column; + ParseLoc location; +} CTESearchClause; + +typedef struct CTECycleClause +{ + NodeTag type; + List *cycle_col_list; + char *cycle_mark_column; + Node *cycle_mark_value; + Node *cycle_mark_default; + char *cycle_path_column; + ParseLoc location; + /* These fields are set during parse analysis: */ + Oid cycle_mark_type; /* common type of _value and _default */ + int cycle_mark_typmod; + Oid cycle_mark_collation; + Oid cycle_mark_neop; /* <> operator for type */ +} CTECycleClause; + +typedef struct CommonTableExpr +{ + NodeTag type; + + /* + * Query name (never qualified). The string name is included in the query + * jumbling because RTE_CTE RTEs need it. + */ + char *ctename; + /* optional list of column names */ + List *aliascolnames pg_node_attr(query_jumble_ignore); + CTEMaterialize ctematerialized; /* is this an optimization fence? */ + /* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */ + Node *ctequery; /* the CTE's subquery */ + CTESearchClause *search_clause pg_node_attr(query_jumble_ignore); + CTECycleClause *cycle_clause pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ + /* These fields are set during parse analysis: */ + /* is this CTE actually recursive? */ + bool cterecursive pg_node_attr(query_jumble_ignore); + + /* + * Number of RTEs referencing this CTE (excluding internal + * self-references), irrelevant for query jumbling. + */ + int cterefcount pg_node_attr(query_jumble_ignore); + /* list of output column names */ + List *ctecolnames pg_node_attr(query_jumble_ignore); + /* OID list of output column type OIDs */ + List *ctecoltypes pg_node_attr(query_jumble_ignore); + /* integer list of output column typmods */ + List *ctecoltypmods pg_node_attr(query_jumble_ignore); + /* OID list of column collation OIDs */ + List *ctecolcollations pg_node_attr(query_jumble_ignore); +} CommonTableExpr; + +/* Convenience macro to get the output tlist of a CTE's query */ +#define GetCTETargetList(cte) \ + (AssertMacro(IsA((cte)->ctequery, Query)), \ + ((Query *) (cte)->ctequery)->commandType == CMD_SELECT ? \ + ((Query *) (cte)->ctequery)->targetList : \ + ((Query *) (cte)->ctequery)->returningList) + +/* + * MergeWhenClause - + * raw parser representation of a WHEN clause in a MERGE statement + * + * This is transformed into MergeAction by parse analysis + */ +typedef struct MergeWhenClause +{ + NodeTag type; + MergeMatchKind matchKind; /* MATCHED/NOT MATCHED BY SOURCE/TARGET */ + CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */ + OverridingKind override; /* OVERRIDING clause */ + Node *condition; /* WHEN conditions (raw parser) */ + List *targetList; /* INSERT/UPDATE targetlist */ + /* the following members are only used in INSERT actions */ + List *values; /* VALUES to INSERT, or NULL */ +} MergeWhenClause; + +/* + * ReturningOptionKind - + * Possible kinds of option in RETURNING WITH(...) list + * + * Currently, this is used only for specifying OLD/NEW aliases. + */ +typedef enum ReturningOptionKind +{ + RETURNING_OPTION_OLD, /* specify alias for OLD in RETURNING */ + RETURNING_OPTION_NEW, /* specify alias for NEW in RETURNING */ +} ReturningOptionKind; + +/* + * ReturningOption - + * An individual option in the RETURNING WITH(...) list + */ +typedef struct ReturningOption +{ + NodeTag type; + ReturningOptionKind option; /* specified option */ + char *value; /* option's value */ + ParseLoc location; /* token location, or -1 if unknown */ +} ReturningOption; + +/* + * ReturningClause - + * List of RETURNING expressions, together with any WITH(...) options + */ +typedef struct ReturningClause +{ + NodeTag type; + List *options; /* list of ReturningOption elements */ + List *exprs; /* list of expressions to return */ +} ReturningClause; + +/* + * TriggerTransition - + * representation of transition row or table naming clause + * + * Only transition tables are initially supported in the syntax, and only for + * AFTER triggers, but other permutations are accepted by the parser so we can + * give a meaningful message from C code. + */ +typedef struct TriggerTransition +{ + NodeTag type; + char *name; + bool isNew; + bool isTable; +} TriggerTransition; + +/* Nodes for SQL/JSON support */ + +/* + * JsonOutput - + * representation of JSON output clause (RETURNING type [FORMAT format]) + */ +typedef struct JsonOutput +{ + NodeTag type; + TypeName *typeName; /* RETURNING type name, if specified */ + JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */ +} JsonOutput; + +/* + * JsonArgument - + * representation of argument from JSON PASSING clause + */ +typedef struct JsonArgument +{ + NodeTag type; + JsonValueExpr *val; /* argument value expression */ + char *name; /* argument name */ +} JsonArgument; + +/* + * JsonQuotes - + * representation of [KEEP|OMIT] QUOTES clause for JSON_QUERY() + */ +typedef enum JsonQuotes +{ + JS_QUOTES_UNSPEC, /* unspecified */ + JS_QUOTES_KEEP, /* KEEP QUOTES */ + JS_QUOTES_OMIT, /* OMIT QUOTES */ +} JsonQuotes; + +/* + * JsonFuncExpr - + * untransformed representation of function expressions for + * SQL/JSON query functions + */ +typedef struct JsonFuncExpr +{ + NodeTag type; + JsonExprOp op; /* expression type */ + char *column_name; /* JSON_TABLE() column name or NULL if this is + * not for a JSON_TABLE() */ + JsonValueExpr *context_item; /* context item expression */ + Node *pathspec; /* JSON path specification expression */ + List *passing; /* list of PASSING clause arguments, if any */ + JsonOutput *output; /* output clause, if specified */ + JsonBehavior *on_empty; /* ON EMPTY behavior */ + JsonBehavior *on_error; /* ON ERROR behavior */ + JsonWrapper wrapper; /* array wrapper behavior (JSON_QUERY only) */ + JsonQuotes quotes; /* omit or keep quotes? (JSON_QUERY only) */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonFuncExpr; + +/* + * JsonTablePathSpec + * untransformed specification of JSON path expression with an optional + * name + */ +typedef struct JsonTablePathSpec +{ + NodeTag type; + + Node *string; + char *name; + ParseLoc name_location; + ParseLoc location; /* location of 'string' */ +} JsonTablePathSpec; + +/* + * JsonTable - + * untransformed representation of JSON_TABLE + */ +typedef struct JsonTable +{ + NodeTag type; + JsonValueExpr *context_item; /* context item expression */ + JsonTablePathSpec *pathspec; /* JSON path specification */ + List *passing; /* list of PASSING clause arguments, if any */ + List *columns; /* list of JsonTableColumn */ + JsonBehavior *on_error; /* ON ERROR behavior */ + Alias *alias; /* table alias in FROM clause */ + bool lateral; /* does it have LATERAL prefix? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonTable; + +/* + * JsonTableColumnType - + * enumeration of JSON_TABLE column types + */ +typedef enum JsonTableColumnType +{ + JTC_FOR_ORDINALITY, + JTC_REGULAR, + JTC_EXISTS, + JTC_FORMATTED, + JTC_NESTED, +} JsonTableColumnType; + +/* + * JsonTableColumn - + * untransformed representation of JSON_TABLE column + */ +typedef struct JsonTableColumn +{ + NodeTag type; + JsonTableColumnType coltype; /* column type */ + char *name; /* column name */ + TypeName *typeName; /* column type name */ + JsonTablePathSpec *pathspec; /* JSON path specification */ + JsonFormat *format; /* JSON format clause, if specified */ + JsonWrapper wrapper; /* WRAPPER behavior for formatted columns */ + JsonQuotes quotes; /* omit or keep quotes on scalar strings? */ + List *columns; /* nested columns */ + JsonBehavior *on_empty; /* ON EMPTY behavior */ + JsonBehavior *on_error; /* ON ERROR behavior */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonTableColumn; + +/* + * JsonKeyValue - + * untransformed representation of JSON object key-value pair for + * JSON_OBJECT() and JSON_OBJECTAGG() + */ +typedef struct JsonKeyValue +{ + NodeTag type; + Expr *key; /* key expression */ + JsonValueExpr *value; /* JSON value expression */ +} JsonKeyValue; + +/* + * JsonParseExpr - + * untransformed representation of JSON() + */ +typedef struct JsonParseExpr +{ + NodeTag type; + JsonValueExpr *expr; /* string expression */ + JsonOutput *output; /* RETURNING clause, if specified */ + bool unique_keys; /* WITH UNIQUE KEYS? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonParseExpr; + +/* + * JsonScalarExpr - + * untransformed representation of JSON_SCALAR() + */ +typedef struct JsonScalarExpr +{ + NodeTag type; + Expr *expr; /* scalar expression */ + JsonOutput *output; /* RETURNING clause, if specified */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonScalarExpr; + +/* + * JsonSerializeExpr - + * untransformed representation of JSON_SERIALIZE() function + */ +typedef struct JsonSerializeExpr +{ + NodeTag type; + JsonValueExpr *expr; /* json value expression */ + JsonOutput *output; /* RETURNING clause, if specified */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonSerializeExpr; + +/* + * JsonObjectConstructor - + * untransformed representation of JSON_OBJECT() constructor + */ +typedef struct JsonObjectConstructor +{ + NodeTag type; + List *exprs; /* list of JsonKeyValue pairs */ + JsonOutput *output; /* RETURNING clause, if specified */ + bool absent_on_null; /* skip NULL values? */ + bool unique; /* check key uniqueness? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonObjectConstructor; + +/* + * JsonArrayConstructor - + * untransformed representation of JSON_ARRAY(element,...) constructor + */ +typedef struct JsonArrayConstructor +{ + NodeTag type; + List *exprs; /* list of JsonValueExpr elements */ + JsonOutput *output; /* RETURNING clause, if specified */ + bool absent_on_null; /* skip NULL elements? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonArrayConstructor; + +/* + * JsonArrayQueryConstructor - + * untransformed representation of JSON_ARRAY(subquery) constructor + */ +typedef struct JsonArrayQueryConstructor +{ + NodeTag type; + Node *query; /* subquery */ + JsonOutput *output; /* RETURNING clause, if specified */ + JsonFormat *format; /* FORMAT clause for subquery, if specified */ + bool absent_on_null; /* skip NULL elements? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonArrayQueryConstructor; + +/* + * JsonAggConstructor - + * common fields of untransformed representation of + * JSON_ARRAYAGG() and JSON_OBJECTAGG() + */ +typedef struct JsonAggConstructor +{ + NodeTag type; + JsonOutput *output; /* RETURNING clause, if any */ + Node *agg_filter; /* FILTER clause, if any */ + List *agg_order; /* ORDER BY clause, if any */ + struct WindowDef *over; /* OVER clause, if any */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonAggConstructor; + +/* + * JsonObjectAgg - + * untransformed representation of JSON_OBJECTAGG() + */ +typedef struct JsonObjectAgg +{ + NodeTag type; + JsonAggConstructor *constructor; /* common fields */ + JsonKeyValue *arg; /* object key-value pair */ + bool absent_on_null; /* skip NULL values? */ + bool unique; /* check key uniqueness? */ +} JsonObjectAgg; + +/* + * JsonArrayAgg - + * untransformed representation of JSON_ARRAYAGG() + */ +typedef struct JsonArrayAgg +{ + NodeTag type; + JsonAggConstructor *constructor; /* common fields */ + JsonValueExpr *arg; /* array element expression */ + bool absent_on_null; /* skip NULL elements? */ +} JsonArrayAgg; + + +/***************************************************************************** + * Raw Grammar Output Statements + *****************************************************************************/ + +/* + * RawStmt --- container for any one statement's raw parse tree + * + * Parse analysis converts a raw parse tree headed by a RawStmt node into + * an analyzed statement headed by a Query node. For optimizable statements, + * the conversion is complex. For utility statements, the parser usually just + * transfers the raw parse tree (sans RawStmt) into the utilityStmt field of + * the Query node, and all the useful work happens at execution time. + * + * stmt_location/stmt_len identify the portion of the source text string + * containing this raw statement (useful for multi-statement strings). + * + * This is irrelevant for query jumbling, as this is not used in parsed + * queries. + */ +typedef struct RawStmt +{ + pg_node_attr(no_query_jumble) + + NodeTag type; + Node *stmt; /* raw parse tree */ + ParseLoc stmt_location; /* start location, or -1 if unknown */ + ParseLoc stmt_len; /* length in bytes; 0 means "rest of string" */ +} RawStmt; + +/***************************************************************************** + * Optimizable Statements + *****************************************************************************/ + +/* ---------------------- + * Insert Statement + * + * The source expression is represented by SelectStmt for both the + * SELECT and VALUES cases. If selectStmt is NULL, then the query + * is INSERT ... DEFAULT VALUES. + * ---------------------- + */ +typedef struct InsertStmt +{ + NodeTag type; + RangeVar *relation; /* relation to insert into */ + List *cols; /* optional: names of the target columns */ + Node *selectStmt; /* the source SELECT/VALUES, or NULL */ + OnConflictClause *onConflictClause; /* ON CONFLICT clause */ + ReturningClause *returningClause; /* RETURNING clause */ + WithClause *withClause; /* WITH clause */ + OverridingKind override; /* OVERRIDING clause */ +} InsertStmt; + +/* ---------------------- + * Delete Statement + * ---------------------- + */ +typedef struct DeleteStmt +{ + NodeTag type; + RangeVar *relation; /* relation to delete from */ + List *usingClause; /* optional using clause for more tables */ + Node *whereClause; /* qualifications */ + ReturningClause *returningClause; /* RETURNING clause */ + WithClause *withClause; /* WITH clause */ +} DeleteStmt; + +/* ---------------------- + * Update Statement + * ---------------------- + */ +typedef struct UpdateStmt +{ + NodeTag type; + RangeVar *relation; /* relation to update */ + List *targetList; /* the target list (of ResTarget) */ + Node *whereClause; /* qualifications */ + List *fromClause; /* optional from clause for more tables */ + ReturningClause *returningClause; /* RETURNING clause */ + WithClause *withClause; /* WITH clause */ +} UpdateStmt; + +/* ---------------------- + * Merge Statement + * ---------------------- + */ +typedef struct MergeStmt +{ + NodeTag type; + RangeVar *relation; /* target relation to merge into */ + Node *sourceRelation; /* source relation */ + Node *joinCondition; /* join condition between source and target */ + List *mergeWhenClauses; /* list of MergeWhenClause(es) */ + ReturningClause *returningClause; /* RETURNING clause */ + WithClause *withClause; /* WITH clause */ +} MergeStmt; + +/* ---------------------- + * Select Statement + * + * A "simple" SELECT is represented in the output of gram.y by a single + * SelectStmt node; so is a VALUES construct. A query containing set + * operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt + * nodes, in which the leaf nodes are component SELECTs and the internal nodes + * represent UNION, INTERSECT, or EXCEPT operators. Using the same node + * type for both leaf and internal nodes allows gram.y to stick ORDER BY, + * LIMIT, etc, clause values into a SELECT statement without worrying + * whether it is a simple or compound SELECT. + * ---------------------- + */ +typedef enum SetOperation +{ + SETOP_NONE = 0, + SETOP_UNION, + SETOP_INTERSECT, + SETOP_EXCEPT, +} SetOperation; + +typedef struct SelectStmt +{ + NodeTag type; + + /* + * These fields are used only in "leaf" SelectStmts. + */ + List *distinctClause; /* NULL, list of DISTINCT ON exprs, or + * lcons(NIL,NIL) for all (SELECT DISTINCT) */ + IntoClause *intoClause; /* target for SELECT INTO */ + List *targetList; /* the target list (of ResTarget) */ + List *fromClause; /* the FROM clause */ + Node *whereClause; /* WHERE qualification */ + List *groupClause; /* GROUP BY clauses */ + bool groupDistinct; /* Is this GROUP BY DISTINCT? */ + Node *havingClause; /* HAVING conditional-expression */ + List *windowClause; /* WINDOW window_name AS (...), ... */ + + /* + * In a "leaf" node representing a VALUES list, the above fields are all + * null, and instead this field is set. Note that the elements of the + * sublists are just expressions, without ResTarget decoration. Also note + * that a list element can be DEFAULT (represented as a SetToDefault + * node), regardless of the context of the VALUES list. It's up to parse + * analysis to reject that where not valid. + */ + List *valuesLists; /* untransformed list of expression lists */ + + /* + * These fields are used in both "leaf" SelectStmts and upper-level + * SelectStmts. + */ + List *sortClause; /* sort clause (a list of SortBy's) */ + Node *limitOffset; /* # of result tuples to skip */ + Node *limitCount; /* # of result tuples to return */ + LimitOption limitOption; /* limit type */ + List *lockingClause; /* FOR UPDATE (list of LockingClause's) */ + WithClause *withClause; /* WITH clause */ + + /* + * These fields are used only in upper-level SelectStmts. + */ + SetOperation op; /* type of set op */ + bool all; /* ALL specified? */ + struct SelectStmt *larg; /* left child */ + struct SelectStmt *rarg; /* right child */ + /* Eventually add fields for CORRESPONDING spec here */ +} SelectStmt; + + +/* ---------------------- + * Set Operation node for post-analysis query trees + * + * After parse analysis, a SELECT with set operations is represented by a + * top-level Query node containing the leaf SELECTs as subqueries in its + * range table. Its setOperations field shows the tree of set operations, + * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal + * nodes replaced by SetOperationStmt nodes. Information about the output + * column types is added, too. (Note that the child nodes do not necessarily + * produce these types directly, but we've checked that their output types + * can be coerced to the output column type.) Also, if it's not UNION ALL, + * information about the types' sort/group semantics is provided in the form + * of a SortGroupClause list (same representation as, eg, DISTINCT). + * The resolved common column collations are provided too; but note that if + * it's not UNION ALL, it's okay for a column to not have a common collation, + * so a member of the colCollations list could be InvalidOid even though the + * column has a collatable type. + * ---------------------- + */ +typedef struct SetOperationStmt +{ + NodeTag type; + SetOperation op; /* type of set op */ + bool all; /* ALL specified? */ + Node *larg; /* left child */ + Node *rarg; /* right child */ + /* Eventually add fields for CORRESPONDING spec here */ + + /* Fields derived during parse analysis (irrelevant for query jumbling): */ + /* OID list of output column type OIDs */ + List *colTypes pg_node_attr(query_jumble_ignore); + /* integer list of output column typmods */ + List *colTypmods pg_node_attr(query_jumble_ignore); + /* OID list of output column collation OIDs */ + List *colCollations pg_node_attr(query_jumble_ignore); + /* a list of SortGroupClause's */ + List *groupClauses pg_node_attr(query_jumble_ignore); + /* groupClauses is NIL if UNION ALL, but must be set otherwise */ +} SetOperationStmt; + + +/* + * RETURN statement (inside SQL function body) + */ +typedef struct ReturnStmt +{ + NodeTag type; + Node *returnval; +} ReturnStmt; + + +/* ---------------------- + * PL/pgSQL Assignment Statement + * + * Like SelectStmt, this is transformed into a SELECT Query. + * However, the targetlist of the result looks more like an UPDATE. + * ---------------------- + */ +typedef struct PLAssignStmt +{ + NodeTag type; + + char *name; /* initial column name */ + List *indirection; /* subscripts and field names, if any */ + int nnames; /* number of names to use in ColumnRef */ + SelectStmt *val; /* the PL/pgSQL expression to assign */ + ParseLoc location; /* name's token location, or -1 if unknown */ +} PLAssignStmt; + + +/***************************************************************************** + * Other Statements (no optimizations required) + * + * These are not touched by parser/analyze.c except to put them into + * the utilityStmt field of a Query. This is eventually passed to + * ProcessUtility (by-passing rewriting and planning). Some of the + * statements do need attention from parse analysis, and this is + * done by routines in parser/parse_utilcmd.c after ProcessUtility + * receives the command for execution. + * DECLARE CURSOR, EXPLAIN, and CREATE TABLE AS are special cases: + * they contain optimizable statements, which get processed normally + * by parser/analyze.c. + *****************************************************************************/ + +/* + * When a command can act on several kinds of objects with only one + * parse structure required, use these constants to designate the + * object type. Note that commands typically don't support all the types. + */ + +typedef enum ObjectType +{ + OBJECT_ACCESS_METHOD, + OBJECT_AGGREGATE, + OBJECT_AMOP, + OBJECT_AMPROC, + OBJECT_ATTRIBUTE, /* type's attribute, when distinct from column */ + OBJECT_CAST, + OBJECT_COLUMN, + OBJECT_COLLATION, + OBJECT_CONVERSION, + OBJECT_DATABASE, + OBJECT_DEFAULT, + OBJECT_DEFACL, + OBJECT_DOMAIN, + OBJECT_DOMCONSTRAINT, + OBJECT_EVENT_TRIGGER, + OBJECT_EXTENSION, + OBJECT_FDW, + OBJECT_FOREIGN_SERVER, + OBJECT_FOREIGN_TABLE, + OBJECT_FUNCTION, + OBJECT_INDEX, + OBJECT_LANGUAGE, + OBJECT_LARGEOBJECT, + OBJECT_MATVIEW, + OBJECT_OPCLASS, + OBJECT_OPERATOR, + OBJECT_OPFAMILY, + OBJECT_PARAMETER_ACL, + OBJECT_POLICY, + OBJECT_PROCEDURE, + OBJECT_PUBLICATION, + OBJECT_PUBLICATION_NAMESPACE, + OBJECT_PUBLICATION_REL, + OBJECT_ROLE, + OBJECT_ROUTINE, + OBJECT_RULE, + OBJECT_SCHEMA, + OBJECT_SEQUENCE, + OBJECT_SUBSCRIPTION, + OBJECT_STATISTIC_EXT, + OBJECT_TABCONSTRAINT, + OBJECT_TABLE, + OBJECT_TABLESPACE, + OBJECT_TRANSFORM, + OBJECT_TRIGGER, + OBJECT_TSCONFIGURATION, + OBJECT_TSDICTIONARY, + OBJECT_TSPARSER, + OBJECT_TSTEMPLATE, + OBJECT_TYPE, + OBJECT_USER_MAPPING, + OBJECT_VIEW, +} ObjectType; + +/* ---------------------- + * Create Schema Statement + * + * NOTE: the schemaElts list contains raw parsetrees for component statements + * of the schema, such as CREATE TABLE, GRANT, etc. These are analyzed and + * executed after the schema itself is created. + * ---------------------- + */ +typedef struct CreateSchemaStmt +{ + NodeTag type; + char *schemaname; /* the name of the schema to create */ + RoleSpec *authrole; /* the owner of the created schema */ + List *schemaElts; /* schema components (list of parsenodes) */ + bool if_not_exists; /* just do nothing if schema already exists? */ +} CreateSchemaStmt; + +typedef enum DropBehavior +{ + DROP_RESTRICT, /* drop fails if any dependent objects */ + DROP_CASCADE, /* remove dependent objects too */ +} DropBehavior; + +/* ---------------------- + * Alter Table + * ---------------------- + */ +typedef struct AlterTableStmt +{ + NodeTag type; + RangeVar *relation; /* table to work on */ + List *cmds; /* list of subcommands */ + ObjectType objtype; /* type of object */ + bool missing_ok; /* skip error if table missing */ +} AlterTableStmt; + +typedef enum AlterTableType +{ + AT_AddColumn, /* add column */ + AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */ + AT_ColumnDefault, /* alter column default */ + AT_CookedColumnDefault, /* add a pre-cooked column default */ + AT_DropNotNull, /* alter column drop not null */ + AT_SetNotNull, /* alter column set not null */ + AT_SetExpression, /* alter column set expression */ + AT_DropExpression, /* alter column drop expression */ + AT_SetStatistics, /* alter column set statistics */ + AT_SetOptions, /* alter column set ( options ) */ + AT_ResetOptions, /* alter column reset ( options ) */ + AT_SetStorage, /* alter column set storage */ + AT_SetCompression, /* alter column set compression */ + AT_DropColumn, /* drop column */ + AT_AddIndex, /* add index */ + AT_ReAddIndex, /* internal to commands/tablecmds.c */ + AT_AddConstraint, /* add constraint */ + AT_ReAddConstraint, /* internal to commands/tablecmds.c */ + AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */ + AT_AlterConstraint, /* alter constraint */ + AT_ValidateConstraint, /* validate constraint */ + AT_AddIndexConstraint, /* add constraint using existing index */ + AT_DropConstraint, /* drop constraint */ + AT_ReAddComment, /* internal to commands/tablecmds.c */ + AT_AlterColumnType, /* alter column type */ + AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */ + AT_ChangeOwner, /* change owner */ + AT_ClusterOn, /* CLUSTER ON */ + AT_DropCluster, /* SET WITHOUT CLUSTER */ + AT_SetLogged, /* SET LOGGED */ + AT_SetUnLogged, /* SET UNLOGGED */ + AT_DropOids, /* SET WITHOUT OIDS */ + AT_SetAccessMethod, /* SET ACCESS METHOD */ + AT_SetTableSpace, /* SET TABLESPACE */ + AT_SetRelOptions, /* SET (...) -- AM specific parameters */ + AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */ + AT_ReplaceRelOptions, /* replace reloption list in its entirety */ + AT_EnableTrig, /* ENABLE TRIGGER name */ + AT_EnableAlwaysTrig, /* ENABLE ALWAYS TRIGGER name */ + AT_EnableReplicaTrig, /* ENABLE REPLICA TRIGGER name */ + AT_DisableTrig, /* DISABLE TRIGGER name */ + AT_EnableTrigAll, /* ENABLE TRIGGER ALL */ + AT_DisableTrigAll, /* DISABLE TRIGGER ALL */ + AT_EnableTrigUser, /* ENABLE TRIGGER USER */ + AT_DisableTrigUser, /* DISABLE TRIGGER USER */ + AT_EnableRule, /* ENABLE RULE name */ + AT_EnableAlwaysRule, /* ENABLE ALWAYS RULE name */ + AT_EnableReplicaRule, /* ENABLE REPLICA RULE name */ + AT_DisableRule, /* DISABLE RULE name */ + AT_AddInherit, /* INHERIT parent */ + AT_DropInherit, /* NO INHERIT parent */ + AT_AddOf, /* OF */ + AT_DropOf, /* NOT OF */ + AT_ReplicaIdentity, /* REPLICA IDENTITY */ + AT_EnableRowSecurity, /* ENABLE ROW SECURITY */ + AT_DisableRowSecurity, /* DISABLE ROW SECURITY */ + AT_ForceRowSecurity, /* FORCE ROW SECURITY */ + AT_NoForceRowSecurity, /* NO FORCE ROW SECURITY */ + AT_GenericOptions, /* OPTIONS (...) */ + AT_AttachPartition, /* ATTACH PARTITION */ + AT_DetachPartition, /* DETACH PARTITION */ + AT_DetachPartitionFinalize, /* DETACH PARTITION FINALIZE */ + AT_AddIdentity, /* ADD IDENTITY */ + AT_SetIdentity, /* SET identity column options */ + AT_DropIdentity, /* DROP IDENTITY */ + AT_ReAddStatistics, /* internal to commands/tablecmds.c */ +} AlterTableType; + +typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */ +{ + NodeTag type; + AlterTableType subtype; /* Type of table alteration to apply */ + char *name; /* column, constraint, or trigger to act on, + * or tablespace, access method */ + int16 num; /* attribute number for columns referenced by + * number */ + RoleSpec *newowner; + Node *def; /* definition of new column, index, + * constraint, or parent table */ + DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */ + bool missing_ok; /* skip error if missing? */ + bool recurse; /* exec-time recursion */ +} AlterTableCmd; + +/* Ad-hoc node for AT_AlterConstraint */ +typedef struct ATAlterConstraint +{ + NodeTag type; + char *conname; /* Constraint name */ + bool alterEnforceability; /* changing enforceability properties? */ + bool is_enforced; /* ENFORCED? */ + bool alterDeferrability; /* changing deferrability properties? */ + bool deferrable; /* DEFERRABLE? */ + bool initdeferred; /* INITIALLY DEFERRED? */ + bool alterInheritability; /* changing inheritability properties */ + bool noinherit; +} ATAlterConstraint; + +/* Ad-hoc node for AT_ReplicaIdentity */ +typedef struct ReplicaIdentityStmt +{ + NodeTag type; + char identity_type; + char *name; +} ReplicaIdentityStmt; + + +/* ---------------------- + * Alter Collation + * ---------------------- + */ +typedef struct AlterCollationStmt +{ + NodeTag type; + List *collname; +} AlterCollationStmt; + + +/* ---------------------- + * Alter Domain + * + * The fields are used in different ways by the different variants of + * this command. + * ---------------------- + */ +typedef struct AlterDomainStmt +{ + NodeTag type; + char subtype; /*------------ + * T = alter column default + * N = alter column drop not null + * O = alter column set not null + * C = add constraint + * X = drop constraint + *------------ + */ + List *typeName; /* domain to work on */ + char *name; /* column or constraint name to act on */ + Node *def; /* definition of default or constraint */ + DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */ + bool missing_ok; /* skip error if missing? */ +} AlterDomainStmt; + + +/* ---------------------- + * Grant|Revoke Statement + * ---------------------- + */ +typedef enum GrantTargetType +{ + ACL_TARGET_OBJECT, /* grant on specific named object(s) */ + ACL_TARGET_ALL_IN_SCHEMA, /* grant on all objects in given schema(s) */ + ACL_TARGET_DEFAULTS, /* ALTER DEFAULT PRIVILEGES */ +} GrantTargetType; + +typedef struct GrantStmt +{ + NodeTag type; + bool is_grant; /* true = GRANT, false = REVOKE */ + GrantTargetType targtype; /* type of the grant target */ + ObjectType objtype; /* kind of object being operated on */ + List *objects; /* list of RangeVar nodes, ObjectWithArgs + * nodes, or plain names (as String values) */ + List *privileges; /* list of AccessPriv nodes */ + /* privileges == NIL denotes ALL PRIVILEGES */ + List *grantees; /* list of RoleSpec nodes */ + bool grant_option; /* grant or revoke grant option */ + RoleSpec *grantor; + DropBehavior behavior; /* drop behavior (for REVOKE) */ +} GrantStmt; + +/* + * ObjectWithArgs represents a function/procedure/operator name plus parameter + * identification. + * + * objargs includes only the types of the input parameters of the object. + * In some contexts, that will be all we have, and it's enough to look up + * objects according to the traditional Postgres rules (i.e., when only input + * arguments matter). + * + * objfuncargs, if not NIL, carries the full specification of the parameter + * list, including parameter mode annotations. + * + * Some grammar productions can set args_unspecified = true instead of + * providing parameter info. In this case, lookup will succeed only if + * the object name is unique. Note that otherwise, NIL parameter lists + * mean zero arguments. + */ +typedef struct ObjectWithArgs +{ + NodeTag type; + List *objname; /* qualified name of function/operator */ + List *objargs; /* list of Typename nodes (input args only) */ + List *objfuncargs; /* list of FunctionParameter nodes */ + bool args_unspecified; /* argument list was omitted? */ +} ObjectWithArgs; + +/* + * An access privilege, with optional list of column names + * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list) + * cols == NIL denotes "all columns" + * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not + * an AccessPriv with both fields null. + */ +typedef struct AccessPriv +{ + NodeTag type; + char *priv_name; /* string name of privilege */ + List *cols; /* list of String */ +} AccessPriv; + +/* ---------------------- + * Grant/Revoke Role Statement + * + * Note: because of the parsing ambiguity with the GRANT + * statement, granted_roles is a list of AccessPriv; the execution code + * should complain if any column lists appear. grantee_roles is a list + * of role names, as String values. + * ---------------------- + */ +typedef struct GrantRoleStmt +{ + NodeTag type; + List *granted_roles; /* list of roles to be granted/revoked */ + List *grantee_roles; /* list of member roles to add/delete */ + bool is_grant; /* true = GRANT, false = REVOKE */ + List *opt; /* options e.g. WITH GRANT OPTION */ + RoleSpec *grantor; /* set grantor to other than current role */ + DropBehavior behavior; /* drop behavior (for REVOKE) */ +} GrantRoleStmt; + +/* ---------------------- + * Alter Default Privileges Statement + * ---------------------- + */ +typedef struct AlterDefaultPrivilegesStmt +{ + NodeTag type; + List *options; /* list of DefElem */ + GrantStmt *action; /* GRANT/REVOKE action (with objects=NIL) */ +} AlterDefaultPrivilegesStmt; + +/* ---------------------- + * Copy Statement + * + * We support "COPY relation FROM file", "COPY relation TO file", and + * "COPY (query) TO file". In any given CopyStmt, exactly one of "relation" + * and "query" must be non-NULL. + * ---------------------- + */ +typedef struct CopyStmt +{ + NodeTag type; + RangeVar *relation; /* the relation to copy */ + Node *query; /* the query (SELECT or DML statement with + * RETURNING) to copy, as a raw parse tree */ + List *attlist; /* List of column names (as Strings), or NIL + * for all columns */ + bool is_from; /* TO or FROM */ + bool is_program; /* is 'filename' a program to popen? */ + char *filename; /* filename, or NULL for STDIN/STDOUT */ + List *options; /* List of DefElem nodes */ + Node *whereClause; /* WHERE condition (or NULL) */ +} CopyStmt; + +/* ---------------------- + * SET Statement (includes RESET) + * + * "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we + * preserve the distinction in VariableSetKind for CreateCommandTag(). + * ---------------------- + */ +typedef enum VariableSetKind +{ + VAR_SET_VALUE, /* SET var = value */ + VAR_SET_DEFAULT, /* SET var TO DEFAULT */ + VAR_SET_CURRENT, /* SET var FROM CURRENT */ + VAR_SET_MULTI, /* special case for SET TRANSACTION ... */ + VAR_RESET, /* RESET var */ + VAR_RESET_ALL, /* RESET ALL */ +} VariableSetKind; + +typedef struct VariableSetStmt +{ + pg_node_attr(custom_query_jumble) + + NodeTag type; + VariableSetKind kind; + /* variable to be set */ + char *name; + /* List of A_Const nodes */ + List *args; + + /* + * True if arguments should be accounted for in query jumbling. We use a + * separate flag rather than query_jumble_ignore on "args" as several + * grammar flavors of SET rely on a list of values that are parsed + * directly from the grammar's keywords. + */ + bool jumble_args; + /* SET LOCAL? */ + bool is_local; + /* token location, or -1 if unknown */ + ParseLoc location pg_node_attr(query_jumble_location); +} VariableSetStmt; + +/* ---------------------- + * Show Statement + * ---------------------- + */ +typedef struct VariableShowStmt +{ + NodeTag type; + char *name; +} VariableShowStmt; + +/* ---------------------- + * Create Table Statement + * + * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are + * intermixed in tableElts, and constraints and nnconstraints are NIL. After + * parse analysis, tableElts contains just ColumnDefs, nnconstraints contains + * Constraint nodes of CONSTR_NOTNULL type from various sources, and + * constraints contains just CONSTR_CHECK Constraint nodes. + * ---------------------- + */ + +typedef struct CreateStmt +{ + NodeTag type; + RangeVar *relation; /* relation to create */ + List *tableElts; /* column definitions (list of ColumnDef) */ + List *inhRelations; /* relations to inherit from (list of + * RangeVar) */ + PartitionBoundSpec *partbound; /* FOR VALUES clause */ + PartitionSpec *partspec; /* PARTITION BY clause */ + TypeName *ofTypename; /* OF typename */ + List *constraints; /* constraints (list of Constraint nodes) */ + List *nnconstraints; /* NOT NULL constraints (ditto) */ + List *options; /* options from WITH clause */ + OnCommitAction oncommit; /* what do we do at COMMIT? */ + char *tablespacename; /* table space to use, or NULL */ + char *accessMethod; /* table access method */ + bool if_not_exists; /* just do nothing if it already exists? */ +} CreateStmt; + +/* ---------- + * Definitions for constraints in CreateStmt + * + * Note that column defaults are treated as a type of constraint, + * even though that's a bit odd semantically. + * + * For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT) + * we may have the expression in either "raw" form (an untransformed + * parse tree) or "cooked" form (the nodeToString representation of + * an executable expression tree), depending on how this Constraint + * node was created (by parsing, or by inheritance from an existing + * relation). We should never have both in the same node! + * + * FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype + * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are + * stored into pg_constraint.confmatchtype. Changing the code values may + * require an initdb! + * + * If skip_validation is true then we skip checking that the existing rows + * in the table satisfy the constraint, and just install the catalog entries + * for the constraint. A new FK constraint is marked as valid iff + * initially_valid is true. (Usually skip_validation and initially_valid + * are inverses, but we can set both true if the table is known empty.) + * + * Constraint attributes (DEFERRABLE etc) are initially represented as + * separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes + * a pass through the constraints list to insert the info into the appropriate + * Constraint node. + * ---------- + */ + +typedef enum ConstrType /* types of constraints */ +{ + CONSTR_NULL, /* not standard SQL, but a lot of people + * expect it */ + CONSTR_NOTNULL, + CONSTR_DEFAULT, + CONSTR_IDENTITY, + CONSTR_GENERATED, + CONSTR_CHECK, + CONSTR_PRIMARY, + CONSTR_UNIQUE, + CONSTR_EXCLUSION, + CONSTR_FOREIGN, + CONSTR_ATTR_DEFERRABLE, /* attributes for previous constraint node */ + CONSTR_ATTR_NOT_DEFERRABLE, + CONSTR_ATTR_DEFERRED, + CONSTR_ATTR_IMMEDIATE, + CONSTR_ATTR_ENFORCED, + CONSTR_ATTR_NOT_ENFORCED, +} ConstrType; + +/* Foreign key action codes */ +#define FKCONSTR_ACTION_NOACTION 'a' +#define FKCONSTR_ACTION_RESTRICT 'r' +#define FKCONSTR_ACTION_CASCADE 'c' +#define FKCONSTR_ACTION_SETNULL 'n' +#define FKCONSTR_ACTION_SETDEFAULT 'd' + +/* Foreign key matchtype codes */ +#define FKCONSTR_MATCH_FULL 'f' +#define FKCONSTR_MATCH_PARTIAL 'p' +#define FKCONSTR_MATCH_SIMPLE 's' + +typedef struct Constraint +{ + NodeTag type; + ConstrType contype; /* see above */ + char *conname; /* Constraint name, or NULL if unnamed */ + bool deferrable; /* DEFERRABLE? */ + bool initdeferred; /* INITIALLY DEFERRED? */ + bool is_enforced; /* enforced constraint? */ + bool skip_validation; /* skip validation of existing rows? */ + bool initially_valid; /* mark the new constraint as valid? */ + bool is_no_inherit; /* is constraint non-inheritable? */ + Node *raw_expr; /* CHECK or DEFAULT expression, as + * untransformed parse tree */ + char *cooked_expr; /* CHECK or DEFAULT expression, as + * nodeToString representation */ + char generated_when; /* ALWAYS or BY DEFAULT */ + char generated_kind; /* STORED or VIRTUAL */ + bool nulls_not_distinct; /* null treatment for UNIQUE constraints */ + List *keys; /* String nodes naming referenced key + * column(s); for UNIQUE/PK/NOT NULL */ + bool without_overlaps; /* WITHOUT OVERLAPS specified */ + List *including; /* String nodes naming referenced nonkey + * column(s); for UNIQUE/PK */ + List *exclusions; /* list of (IndexElem, operator name) pairs; + * for exclusion constraints */ + List *options; /* options from WITH clause */ + char *indexname; /* existing index to use; otherwise NULL */ + char *indexspace; /* index tablespace; NULL for default */ + bool reset_default_tblspc; /* reset default_tablespace prior to + * creating the index */ + char *access_method; /* index access method; NULL for default */ + Node *where_clause; /* partial index predicate */ + + /* Fields used for FOREIGN KEY constraints: */ + RangeVar *pktable; /* Primary key table */ + List *fk_attrs; /* Attributes of foreign key */ + List *pk_attrs; /* Corresponding attrs in PK table */ + bool fk_with_period; /* Last attribute of FK uses PERIOD */ + bool pk_with_period; /* Last attribute of PK uses PERIOD */ + char fk_matchtype; /* FULL, PARTIAL, SIMPLE */ + char fk_upd_action; /* ON UPDATE action */ + char fk_del_action; /* ON DELETE action */ + List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */ + List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */ + Oid old_pktable_oid; /* pg_constraint.confrelid of my former + * self */ + + ParseLoc location; /* token location, or -1 if unknown */ +} Constraint; + +/* ---------------------- + * Create/Drop Table Space Statements + * ---------------------- + */ + +typedef struct CreateTableSpaceStmt +{ + NodeTag type; + char *tablespacename; + RoleSpec *owner; + char *location; + List *options; +} CreateTableSpaceStmt; + +typedef struct DropTableSpaceStmt +{ + NodeTag type; + char *tablespacename; + bool missing_ok; /* skip error if missing? */ +} DropTableSpaceStmt; + +typedef struct AlterTableSpaceOptionsStmt +{ + NodeTag type; + char *tablespacename; + List *options; + bool isReset; +} AlterTableSpaceOptionsStmt; + +typedef struct AlterTableMoveAllStmt +{ + NodeTag type; + char *orig_tablespacename; + ObjectType objtype; /* Object type to move */ + List *roles; /* List of roles to move objects of */ + char *new_tablespacename; + bool nowait; +} AlterTableMoveAllStmt; + +/* ---------------------- + * Create/Alter Extension Statements + * ---------------------- + */ + +typedef struct CreateExtensionStmt +{ + NodeTag type; + char *extname; + bool if_not_exists; /* just do nothing if it already exists? */ + List *options; /* List of DefElem nodes */ +} CreateExtensionStmt; + +/* Only used for ALTER EXTENSION UPDATE; later might need an action field */ +typedef struct AlterExtensionStmt +{ + NodeTag type; + char *extname; + List *options; /* List of DefElem nodes */ +} AlterExtensionStmt; + +typedef struct AlterExtensionContentsStmt +{ + NodeTag type; + char *extname; /* Extension's name */ + int action; /* +1 = add object, -1 = drop object */ + ObjectType objtype; /* Object's type */ + Node *object; /* Qualified name of the object */ +} AlterExtensionContentsStmt; + +/* ---------------------- + * Create/Alter FOREIGN DATA WRAPPER Statements + * ---------------------- + */ + +typedef struct CreateFdwStmt +{ + NodeTag type; + char *fdwname; /* foreign-data wrapper name */ + List *func_options; /* HANDLER/VALIDATOR options */ + List *options; /* generic options to FDW */ +} CreateFdwStmt; + +typedef struct AlterFdwStmt +{ + NodeTag type; + char *fdwname; /* foreign-data wrapper name */ + List *func_options; /* HANDLER/VALIDATOR options */ + List *options; /* generic options to FDW */ +} AlterFdwStmt; + +/* ---------------------- + * Create/Alter FOREIGN SERVER Statements + * ---------------------- + */ + +typedef struct CreateForeignServerStmt +{ + NodeTag type; + char *servername; /* server name */ + char *servertype; /* optional server type */ + char *version; /* optional server version */ + char *fdwname; /* FDW name */ + bool if_not_exists; /* just do nothing if it already exists? */ + List *options; /* generic options to server */ +} CreateForeignServerStmt; + +typedef struct AlterForeignServerStmt +{ + NodeTag type; + char *servername; /* server name */ + char *version; /* optional server version */ + List *options; /* generic options to server */ + bool has_version; /* version specified */ +} AlterForeignServerStmt; + +/* ---------------------- + * Create FOREIGN TABLE Statement + * ---------------------- + */ + +typedef struct CreateForeignTableStmt +{ + CreateStmt base; + char *servername; + List *options; +} CreateForeignTableStmt; + +/* ---------------------- + * Create/Drop USER MAPPING Statements + * ---------------------- + */ + +typedef struct CreateUserMappingStmt +{ + NodeTag type; + RoleSpec *user; /* user role */ + char *servername; /* server name */ + bool if_not_exists; /* just do nothing if it already exists? */ + List *options; /* generic options to server */ +} CreateUserMappingStmt; + +typedef struct AlterUserMappingStmt +{ + NodeTag type; + RoleSpec *user; /* user role */ + char *servername; /* server name */ + List *options; /* generic options to server */ +} AlterUserMappingStmt; + +typedef struct DropUserMappingStmt +{ + NodeTag type; + RoleSpec *user; /* user role */ + char *servername; /* server name */ + bool missing_ok; /* ignore missing mappings */ +} DropUserMappingStmt; + +/* ---------------------- + * Import Foreign Schema Statement + * ---------------------- + */ + +typedef enum ImportForeignSchemaType +{ + FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */ + FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */ + FDW_IMPORT_SCHEMA_EXCEPT, /* exclude listed tables from import */ +} ImportForeignSchemaType; + +typedef struct ImportForeignSchemaStmt +{ + NodeTag type; + char *server_name; /* FDW server name */ + char *remote_schema; /* remote schema name to query */ + char *local_schema; /* local schema to create objects in */ + ImportForeignSchemaType list_type; /* type of table list */ + List *table_list; /* List of RangeVar */ + List *options; /* list of options to pass to FDW */ +} ImportForeignSchemaStmt; + +/*---------------------- + * Create POLICY Statement + *---------------------- + */ +typedef struct CreatePolicyStmt +{ + NodeTag type; + char *policy_name; /* Policy's name */ + RangeVar *table; /* the table name the policy applies to */ + char *cmd_name; /* the command name the policy applies to */ + bool permissive; /* restrictive or permissive policy */ + List *roles; /* the roles associated with the policy */ + Node *qual; /* the policy's condition */ + Node *with_check; /* the policy's WITH CHECK condition. */ +} CreatePolicyStmt; + +/*---------------------- + * Alter POLICY Statement + *---------------------- + */ +typedef struct AlterPolicyStmt +{ + NodeTag type; + char *policy_name; /* Policy's name */ + RangeVar *table; /* the table name the policy applies to */ + List *roles; /* the roles associated with the policy */ + Node *qual; /* the policy's condition */ + Node *with_check; /* the policy's WITH CHECK condition. */ +} AlterPolicyStmt; + +/*---------------------- + * Create ACCESS METHOD Statement + *---------------------- + */ +typedef struct CreateAmStmt +{ + NodeTag type; + char *amname; /* access method name */ + List *handler_name; /* handler function name */ + char amtype; /* type of access method */ +} CreateAmStmt; + +/* ---------------------- + * Create TRIGGER Statement + * ---------------------- + */ +typedef struct CreateTrigStmt +{ + NodeTag type; + bool replace; /* replace trigger if already exists */ + bool isconstraint; /* This is a constraint trigger */ + char *trigname; /* TRIGGER's name */ + RangeVar *relation; /* relation trigger is on */ + List *funcname; /* qual. name of function to call */ + List *args; /* list of String or NIL */ + bool row; /* ROW/STATEMENT */ + /* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */ + int16 timing; /* BEFORE, AFTER, or INSTEAD */ + /* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */ + int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */ + List *columns; /* column names, or NIL for all columns */ + Node *whenClause; /* qual expression, or NULL if none */ + /* explicitly named transition data */ + List *transitionRels; /* TriggerTransition nodes, or NIL if none */ + /* The remaining fields are only used for constraint triggers */ + bool deferrable; /* [NOT] DEFERRABLE */ + bool initdeferred; /* INITIALLY {DEFERRED|IMMEDIATE} */ + RangeVar *constrrel; /* opposite relation, if RI trigger */ +} CreateTrigStmt; + +/* ---------------------- + * Create EVENT TRIGGER Statement + * ---------------------- + */ +typedef struct CreateEventTrigStmt +{ + NodeTag type; + char *trigname; /* TRIGGER's name */ + char *eventname; /* event's identifier */ + List *whenclause; /* list of DefElems indicating filtering */ + List *funcname; /* qual. name of function to call */ +} CreateEventTrigStmt; + +/* ---------------------- + * Alter EVENT TRIGGER Statement + * ---------------------- + */ +typedef struct AlterEventTrigStmt +{ + NodeTag type; + char *trigname; /* TRIGGER's name */ + char tgenabled; /* trigger's firing configuration WRT + * session_replication_role */ +} AlterEventTrigStmt; + +/* ---------------------- + * Create LANGUAGE Statements + * ---------------------- + */ +typedef struct CreatePLangStmt +{ + NodeTag type; + bool replace; /* T => replace if already exists */ + char *plname; /* PL name */ + List *plhandler; /* PL call handler function (qual. name) */ + List *plinline; /* optional inline function (qual. name) */ + List *plvalidator; /* optional validator function (qual. name) */ + bool pltrusted; /* PL is trusted */ +} CreatePLangStmt; + +/* ---------------------- + * Create/Alter/Drop Role Statements + * + * Note: these node types are also used for the backwards-compatible + * Create/Alter/Drop User/Group statements. In the ALTER and DROP cases + * there's really no need to distinguish what the original spelling was, + * but for CREATE we mark the type because the defaults vary. + * ---------------------- + */ +typedef enum RoleStmtType +{ + ROLESTMT_ROLE, + ROLESTMT_USER, + ROLESTMT_GROUP, +} RoleStmtType; + +typedef struct CreateRoleStmt +{ + NodeTag type; + RoleStmtType stmt_type; /* ROLE/USER/GROUP */ + char *role; /* role name */ + List *options; /* List of DefElem nodes */ +} CreateRoleStmt; + +typedef struct AlterRoleStmt +{ + NodeTag type; + RoleSpec *role; /* role */ + List *options; /* List of DefElem nodes */ + int action; /* +1 = add members, -1 = drop members */ +} AlterRoleStmt; + +typedef struct AlterRoleSetStmt +{ + NodeTag type; + RoleSpec *role; /* role */ + char *database; /* database name, or NULL */ + VariableSetStmt *setstmt; /* SET or RESET subcommand */ +} AlterRoleSetStmt; + +typedef struct DropRoleStmt +{ + NodeTag type; + List *roles; /* List of roles to remove */ + bool missing_ok; /* skip error if a role is missing? */ +} DropRoleStmt; + +/* ---------------------- + * {Create|Alter} SEQUENCE Statement + * ---------------------- + */ + +typedef struct CreateSeqStmt +{ + NodeTag type; + RangeVar *sequence; /* the sequence to create */ + List *options; + Oid ownerId; /* ID of owner, or InvalidOid for default */ + bool for_identity; + bool if_not_exists; /* just do nothing if it already exists? */ +} CreateSeqStmt; + +typedef struct AlterSeqStmt +{ + NodeTag type; + RangeVar *sequence; /* the sequence to alter */ + List *options; + bool for_identity; + bool missing_ok; /* skip error if a role is missing? */ +} AlterSeqStmt; + +/* ---------------------- + * Create {Aggregate|Operator|Type} Statement + * ---------------------- + */ +typedef struct DefineStmt +{ + NodeTag type; + ObjectType kind; /* aggregate, operator, type */ + bool oldstyle; /* hack to signal old CREATE AGG syntax */ + List *defnames; /* qualified name (list of String) */ + List *args; /* a list of TypeName (if needed) */ + List *definition; /* a list of DefElem */ + bool if_not_exists; /* just do nothing if it already exists? */ + bool replace; /* replace if already exists? */ +} DefineStmt; + +/* ---------------------- + * Create Domain Statement + * ---------------------- + */ +typedef struct CreateDomainStmt +{ + NodeTag type; + List *domainname; /* qualified name (list of String) */ + TypeName *typeName; /* the base type */ + CollateClause *collClause; /* untransformed COLLATE spec, if any */ + List *constraints; /* constraints (list of Constraint nodes) */ +} CreateDomainStmt; + +/* ---------------------- + * Create Operator Class Statement + * ---------------------- + */ +typedef struct CreateOpClassStmt +{ + NodeTag type; + List *opclassname; /* qualified name (list of String) */ + List *opfamilyname; /* qualified name (ditto); NIL if omitted */ + char *amname; /* name of index AM opclass is for */ + TypeName *datatype; /* datatype of indexed column */ + List *items; /* List of CreateOpClassItem nodes */ + bool isDefault; /* Should be marked as default for type? */ +} CreateOpClassStmt; + +#define OPCLASS_ITEM_OPERATOR 1 +#define OPCLASS_ITEM_FUNCTION 2 +#define OPCLASS_ITEM_STORAGETYPE 3 + +typedef struct CreateOpClassItem +{ + NodeTag type; + int itemtype; /* see codes above */ + ObjectWithArgs *name; /* operator or function name and args */ + int number; /* strategy num or support proc num */ + List *order_family; /* only used for ordering operators */ + List *class_args; /* amproclefttype/amprocrighttype or + * amoplefttype/amoprighttype */ + /* fields used for a storagetype item: */ + TypeName *storedtype; /* datatype stored in index */ +} CreateOpClassItem; + +/* ---------------------- + * Create Operator Family Statement + * ---------------------- + */ +typedef struct CreateOpFamilyStmt +{ + NodeTag type; + List *opfamilyname; /* qualified name (list of String) */ + char *amname; /* name of index AM opfamily is for */ +} CreateOpFamilyStmt; + +/* ---------------------- + * Alter Operator Family Statement + * ---------------------- + */ +typedef struct AlterOpFamilyStmt +{ + NodeTag type; + List *opfamilyname; /* qualified name (list of String) */ + char *amname; /* name of index AM opfamily is for */ + bool isDrop; /* ADD or DROP the items? */ + List *items; /* List of CreateOpClassItem nodes */ +} AlterOpFamilyStmt; + +/* ---------------------- + * Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement + * ---------------------- + */ + +typedef struct DropStmt +{ + NodeTag type; + List *objects; /* list of names */ + ObjectType removeType; /* object type */ + DropBehavior behavior; /* RESTRICT or CASCADE behavior */ + bool missing_ok; /* skip error if object is missing? */ + bool concurrent; /* drop index concurrently? */ +} DropStmt; + +/* ---------------------- + * Truncate Table Statement + * ---------------------- + */ +typedef struct TruncateStmt +{ + NodeTag type; + List *relations; /* relations (RangeVars) to be truncated */ + bool restart_seqs; /* restart owned sequences? */ + DropBehavior behavior; /* RESTRICT or CASCADE behavior */ +} TruncateStmt; + +/* ---------------------- + * Comment On Statement + * ---------------------- + */ +typedef struct CommentStmt +{ + NodeTag type; + ObjectType objtype; /* Object's type */ + Node *object; /* Qualified name of the object */ + char *comment; /* Comment to insert, or NULL to remove */ +} CommentStmt; + +/* ---------------------- + * SECURITY LABEL Statement + * ---------------------- + */ +typedef struct SecLabelStmt +{ + NodeTag type; + ObjectType objtype; /* Object's type */ + Node *object; /* Qualified name of the object */ + char *provider; /* Label provider (or NULL) */ + char *label; /* New security label to be assigned */ +} SecLabelStmt; + +/* ---------------------- + * Declare Cursor Statement + * + * The "query" field is initially a raw parse tree, and is converted to a + * Query node during parse analysis. Note that rewriting and planning + * of the query are always postponed until execution. + * ---------------------- + */ +#define CURSOR_OPT_BINARY 0x0001 /* BINARY */ +#define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */ +#define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */ +#define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */ +#define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */ +#define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */ +/* these planner-control flags do not correspond to any SQL grammar: */ +#define CURSOR_OPT_FAST_PLAN 0x0100 /* prefer fast-start plan */ +#define CURSOR_OPT_GENERIC_PLAN 0x0200 /* force use of generic plan */ +#define CURSOR_OPT_CUSTOM_PLAN 0x0400 /* force use of custom plan */ +#define CURSOR_OPT_PARALLEL_OK 0x0800 /* parallel mode OK */ + +typedef struct DeclareCursorStmt +{ + NodeTag type; + char *portalname; /* name of the portal (cursor) */ + int options; /* bitmask of options (see above) */ + Node *query; /* the query (see comments above) */ +} DeclareCursorStmt; + +/* ---------------------- + * Close Portal Statement + * ---------------------- + */ +typedef struct ClosePortalStmt +{ + NodeTag type; + char *portalname; /* name of the portal (cursor) */ + /* NULL means CLOSE ALL */ +} ClosePortalStmt; + +/* ---------------------- + * Fetch Statement (also Move) + * ---------------------- + */ +typedef enum FetchDirection +{ + /* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */ + FETCH_FORWARD, + FETCH_BACKWARD, + /* for these, howMany indicates a position; only one row is fetched */ + FETCH_ABSOLUTE, + FETCH_RELATIVE, +} FetchDirection; + +#define FETCH_ALL LONG_MAX + +typedef struct FetchStmt +{ + NodeTag type; + FetchDirection direction; /* see above */ + long howMany; /* number of rows, or position argument */ + char *portalname; /* name of portal (cursor) */ + bool ismove; /* true if MOVE */ +} FetchStmt; + +/* ---------------------- + * Create Index Statement + * + * This represents creation of an index and/or an associated constraint. + * If isconstraint is true, we should create a pg_constraint entry along + * with the index. But if indexOid isn't InvalidOid, we are not creating an + * index, just a UNIQUE/PKEY constraint using an existing index. isconstraint + * must always be true in this case, and the fields describing the index + * properties are empty. + * ---------------------- + */ +typedef struct IndexStmt +{ + NodeTag type; + char *idxname; /* name of new index, or NULL for default */ + RangeVar *relation; /* relation to build index on */ + char *accessMethod; /* name of access method (eg. btree) */ + char *tableSpace; /* tablespace, or NULL for default */ + List *indexParams; /* columns to index: a list of IndexElem */ + List *indexIncludingParams; /* additional columns to index: a list + * of IndexElem */ + List *options; /* WITH clause options: a list of DefElem */ + Node *whereClause; /* qualification (partial-index predicate) */ + List *excludeOpNames; /* exclusion operator names, or NIL if none */ + char *idxcomment; /* comment to apply to index, or NULL */ + Oid indexOid; /* OID of an existing index, if any */ + RelFileNumber oldNumber; /* relfilenumber of existing storage, if any */ + SubTransactionId oldCreateSubid; /* rd_createSubid of oldNumber */ + SubTransactionId oldFirstRelfilelocatorSubid; /* rd_firstRelfilelocatorSubid + * of oldNumber */ + bool unique; /* is index unique? */ + bool nulls_not_distinct; /* null treatment for UNIQUE constraints */ + bool primary; /* is index a primary key? */ + bool isconstraint; /* is it for a pkey/unique constraint? */ + bool iswithoutoverlaps; /* is the constraint WITHOUT OVERLAPS? */ + bool deferrable; /* is the constraint DEFERRABLE? */ + bool initdeferred; /* is the constraint INITIALLY DEFERRED? */ + bool transformed; /* true when transformIndexStmt is finished */ + bool concurrent; /* should this be a concurrent index build? */ + bool if_not_exists; /* just do nothing if index already exists? */ + bool reset_default_tblspc; /* reset default_tablespace prior to + * executing */ +} IndexStmt; + +/* ---------------------- + * Create Statistics Statement + * ---------------------- + */ +typedef struct CreateStatsStmt +{ + NodeTag type; + List *defnames; /* qualified name (list of String) */ + List *stat_types; /* stat types (list of String) */ + List *exprs; /* expressions to build statistics on */ + List *relations; /* rels to build stats on (list of RangeVar) */ + char *stxcomment; /* comment to apply to stats, or NULL */ + bool transformed; /* true when transformStatsStmt is finished */ + bool if_not_exists; /* do nothing if stats name already exists */ +} CreateStatsStmt; + +/* + * StatsElem - statistics parameters (used in CREATE STATISTICS) + * + * For a plain attribute, 'name' is the name of the referenced table column + * and 'expr' is NULL. For an expression, 'name' is NULL and 'expr' is the + * expression tree. + */ +typedef struct StatsElem +{ + NodeTag type; + char *name; /* name of attribute to index, or NULL */ + Node *expr; /* expression to index, or NULL */ +} StatsElem; + + +/* ---------------------- + * Alter Statistics Statement + * ---------------------- + */ +typedef struct AlterStatsStmt +{ + NodeTag type; + List *defnames; /* qualified name (list of String) */ + Node *stxstattarget; /* statistics target */ + bool missing_ok; /* skip error if statistics object is missing */ +} AlterStatsStmt; + +/* ---------------------- + * Create Function Statement + * ---------------------- + */ +typedef struct CreateFunctionStmt +{ + NodeTag type; + bool is_procedure; /* it's really CREATE PROCEDURE */ + bool replace; /* T => replace if already exists */ + List *funcname; /* qualified name of function to create */ + List *parameters; /* a list of FunctionParameter */ + TypeName *returnType; /* the return type */ + List *options; /* a list of DefElem */ + Node *sql_body; +} CreateFunctionStmt; + +typedef enum FunctionParameterMode +{ + /* the assigned enum values appear in pg_proc, don't change 'em! */ + FUNC_PARAM_IN = 'i', /* input only */ + FUNC_PARAM_OUT = 'o', /* output only */ + FUNC_PARAM_INOUT = 'b', /* both */ + FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */ + FUNC_PARAM_TABLE = 't', /* table function output column */ + /* this is not used in pg_proc: */ + FUNC_PARAM_DEFAULT = 'd', /* default; effectively same as IN */ +} FunctionParameterMode; + +typedef struct FunctionParameter +{ + NodeTag type; + char *name; /* parameter name, or NULL if not given */ + TypeName *argType; /* TypeName for parameter type */ + FunctionParameterMode mode; /* IN/OUT/etc */ + Node *defexpr; /* raw default expr, or NULL if not given */ + ParseLoc location; /* token location, or -1 if unknown */ +} FunctionParameter; + +typedef struct AlterFunctionStmt +{ + NodeTag type; + ObjectType objtype; + ObjectWithArgs *func; /* name and args of function */ + List *actions; /* list of DefElem */ +} AlterFunctionStmt; + +/* ---------------------- + * DO Statement + * + * DoStmt is the raw parser output, InlineCodeBlock is the execution-time API + * ---------------------- + */ +typedef struct DoStmt +{ + NodeTag type; + List *args; /* List of DefElem nodes */ +} DoStmt; + +typedef struct InlineCodeBlock +{ + pg_node_attr(nodetag_only) /* this is not a member of parse trees */ + + NodeTag type; + char *source_text; /* source text of anonymous code block */ + Oid langOid; /* OID of selected language */ + bool langIsTrusted; /* trusted property of the language */ + bool atomic; /* atomic execution context */ +} InlineCodeBlock; + +/* ---------------------- + * CALL statement + * + * OUT-mode arguments are removed from the transformed funcexpr. The outargs + * list contains copies of the expressions for all output arguments, in the + * order of the procedure's declared arguments. (outargs is never evaluated, + * but is useful to the caller as a reference for what to assign to.) + * The transformed call state is not relevant in the query jumbling, only the + * function call is. + * ---------------------- + */ +typedef struct CallStmt +{ + NodeTag type; + /* from the parser */ + FuncCall *funccall pg_node_attr(query_jumble_ignore); + /* transformed call, with only input args */ + FuncExpr *funcexpr; + /* transformed output-argument expressions */ + List *outargs; +} CallStmt; + +typedef struct CallContext +{ + pg_node_attr(nodetag_only) /* this is not a member of parse trees */ + + NodeTag type; + bool atomic; +} CallContext; + +/* ---------------------- + * Alter Object Rename Statement + * ---------------------- + */ +typedef struct RenameStmt +{ + NodeTag type; + ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */ + ObjectType relationType; /* if column name, associated relation type */ + RangeVar *relation; /* in case it's a table */ + Node *object; /* in case it's some other object */ + char *subname; /* name of contained object (column, rule, + * trigger, etc) */ + char *newname; /* the new name */ + DropBehavior behavior; /* RESTRICT or CASCADE behavior */ + bool missing_ok; /* skip error if missing? */ +} RenameStmt; + +/* ---------------------- + * ALTER object DEPENDS ON EXTENSION extname + * ---------------------- + */ +typedef struct AlterObjectDependsStmt +{ + NodeTag type; + ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */ + RangeVar *relation; /* in case a table is involved */ + Node *object; /* name of the object */ + String *extname; /* extension name */ + bool remove; /* set true to remove dep rather than add */ +} AlterObjectDependsStmt; + +/* ---------------------- + * ALTER object SET SCHEMA Statement + * ---------------------- + */ +typedef struct AlterObjectSchemaStmt +{ + NodeTag type; + ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */ + RangeVar *relation; /* in case it's a table */ + Node *object; /* in case it's some other object */ + char *newschema; /* the new schema */ + bool missing_ok; /* skip error if missing? */ +} AlterObjectSchemaStmt; + +/* ---------------------- + * Alter Object Owner Statement + * ---------------------- + */ +typedef struct AlterOwnerStmt +{ + NodeTag type; + ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */ + RangeVar *relation; /* in case it's a table */ + Node *object; /* in case it's some other object */ + RoleSpec *newowner; /* the new owner */ +} AlterOwnerStmt; + +/* ---------------------- + * Alter Operator Set ( this-n-that ) + * ---------------------- + */ +typedef struct AlterOperatorStmt +{ + NodeTag type; + ObjectWithArgs *opername; /* operator name and argument types */ + List *options; /* List of DefElem nodes */ +} AlterOperatorStmt; + +/* ------------------------ + * Alter Type Set ( this-n-that ) + * ------------------------ + */ +typedef struct AlterTypeStmt +{ + NodeTag type; + List *typeName; /* type name (possibly qualified) */ + List *options; /* List of DefElem nodes */ +} AlterTypeStmt; + +/* ---------------------- + * Create Rule Statement + * ---------------------- + */ +typedef struct RuleStmt +{ + NodeTag type; + RangeVar *relation; /* relation the rule is for */ + char *rulename; /* name of the rule */ + Node *whereClause; /* qualifications */ + CmdType event; /* SELECT, INSERT, etc */ + bool instead; /* is a 'do instead'? */ + List *actions; /* the action statements */ + bool replace; /* OR REPLACE */ +} RuleStmt; + +/* ---------------------- + * Notify Statement + * ---------------------- + */ +typedef struct NotifyStmt +{ + NodeTag type; + char *conditionname; /* condition name to notify */ + char *payload; /* the payload string, or NULL if none */ +} NotifyStmt; + +/* ---------------------- + * Listen Statement + * ---------------------- + */ +typedef struct ListenStmt +{ + NodeTag type; + char *conditionname; /* condition name to listen on */ +} ListenStmt; + +/* ---------------------- + * Unlisten Statement + * ---------------------- + */ +typedef struct UnlistenStmt +{ + NodeTag type; + char *conditionname; /* name to unlisten on, or NULL for all */ +} UnlistenStmt; + +/* ---------------------- + * {Begin|Commit|Rollback} Transaction Statement + * ---------------------- + */ +typedef enum TransactionStmtKind +{ + TRANS_STMT_BEGIN, + TRANS_STMT_START, /* semantically identical to BEGIN */ + TRANS_STMT_COMMIT, + TRANS_STMT_ROLLBACK, + TRANS_STMT_SAVEPOINT, + TRANS_STMT_RELEASE, + TRANS_STMT_ROLLBACK_TO, + TRANS_STMT_PREPARE, + TRANS_STMT_COMMIT_PREPARED, + TRANS_STMT_ROLLBACK_PREPARED, +} TransactionStmtKind; + +typedef struct TransactionStmt +{ + NodeTag type; + TransactionStmtKind kind; /* see above */ + List *options; /* for BEGIN/START commands */ + /* for savepoint commands */ + char *savepoint_name pg_node_attr(query_jumble_ignore); + /* for two-phase-commit related commands */ + char *gid pg_node_attr(query_jumble_ignore); + bool chain; /* AND CHAIN option */ + /* token location, or -1 if unknown */ + ParseLoc location pg_node_attr(query_jumble_location); +} TransactionStmt; + +/* ---------------------- + * Create Type Statement, composite types + * ---------------------- + */ +typedef struct CompositeTypeStmt +{ + NodeTag type; + RangeVar *typevar; /* the composite type to be created */ + List *coldeflist; /* list of ColumnDef nodes */ +} CompositeTypeStmt; + +/* ---------------------- + * Create Type Statement, enum types + * ---------------------- + */ +typedef struct CreateEnumStmt +{ + NodeTag type; + List *typeName; /* qualified name (list of String) */ + List *vals; /* enum values (list of String) */ +} CreateEnumStmt; + +/* ---------------------- + * Create Type Statement, range types + * ---------------------- + */ +typedef struct CreateRangeStmt +{ + NodeTag type; + List *typeName; /* qualified name (list of String) */ + List *params; /* range parameters (list of DefElem) */ +} CreateRangeStmt; + +/* ---------------------- + * Alter Type Statement, enum types + * ---------------------- + */ +typedef struct AlterEnumStmt +{ + NodeTag type; + List *typeName; /* qualified name (list of String) */ + char *oldVal; /* old enum value's name, if renaming */ + char *newVal; /* new enum value's name */ + char *newValNeighbor; /* neighboring enum value, if specified */ + bool newValIsAfter; /* place new enum value after neighbor? */ + bool skipIfNewValExists; /* no error if new already exists? */ +} AlterEnumStmt; + +/* ---------------------- + * Create View Statement + * ---------------------- + */ +typedef enum ViewCheckOption +{ + NO_CHECK_OPTION, + LOCAL_CHECK_OPTION, + CASCADED_CHECK_OPTION, +} ViewCheckOption; + +typedef struct ViewStmt +{ + NodeTag type; + RangeVar *view; /* the view to be created */ + List *aliases; /* target column names */ + Node *query; /* the SELECT query (as a raw parse tree) */ + bool replace; /* replace an existing view? */ + List *options; /* options from WITH clause */ + ViewCheckOption withCheckOption; /* WITH CHECK OPTION */ +} ViewStmt; + +/* ---------------------- + * Load Statement + * ---------------------- + */ +typedef struct LoadStmt +{ + NodeTag type; + char *filename; /* file to load */ +} LoadStmt; + +/* ---------------------- + * Createdb Statement + * ---------------------- + */ +typedef struct CreatedbStmt +{ + NodeTag type; + char *dbname; /* name of database to create */ + List *options; /* List of DefElem nodes */ +} CreatedbStmt; + +/* ---------------------- + * Alter Database + * ---------------------- + */ +typedef struct AlterDatabaseStmt +{ + NodeTag type; + char *dbname; /* name of database to alter */ + List *options; /* List of DefElem nodes */ +} AlterDatabaseStmt; + +typedef struct AlterDatabaseRefreshCollStmt +{ + NodeTag type; + char *dbname; +} AlterDatabaseRefreshCollStmt; + +typedef struct AlterDatabaseSetStmt +{ + NodeTag type; + char *dbname; /* database name */ + VariableSetStmt *setstmt; /* SET or RESET subcommand */ +} AlterDatabaseSetStmt; + +/* ---------------------- + * Dropdb Statement + * ---------------------- + */ +typedef struct DropdbStmt +{ + NodeTag type; + char *dbname; /* database to drop */ + bool missing_ok; /* skip error if db is missing? */ + List *options; /* currently only FORCE is supported */ +} DropdbStmt; + +/* ---------------------- + * Alter System Statement + * ---------------------- + */ +typedef struct AlterSystemStmt +{ + NodeTag type; + VariableSetStmt *setstmt; /* SET subcommand */ +} AlterSystemStmt; + +/* ---------------------- + * Cluster Statement (support pbrown's cluster index implementation) + * ---------------------- + */ +typedef struct ClusterStmt +{ + NodeTag type; + RangeVar *relation; /* relation being indexed, or NULL if all */ + char *indexname; /* original index defined */ + List *params; /* list of DefElem nodes */ +} ClusterStmt; + +/* ---------------------- + * Vacuum and Analyze Statements + * + * Even though these are nominally two statements, it's convenient to use + * just one node type for both. + * ---------------------- + */ +typedef struct VacuumStmt +{ + NodeTag type; + List *options; /* list of DefElem nodes */ + List *rels; /* list of VacuumRelation, or NIL for all */ + bool is_vacuumcmd; /* true for VACUUM, false for ANALYZE */ +} VacuumStmt; + +/* + * Info about a single target table of VACUUM/ANALYZE. + * + * If the OID field is set, it always identifies the table to process. + * Then the relation field can be NULL; if it isn't, it's used only to report + * failure to open/lock the relation. + */ +typedef struct VacuumRelation +{ + NodeTag type; + RangeVar *relation; /* table name to process, or NULL */ + Oid oid; /* table's OID; InvalidOid if not looked up */ + List *va_cols; /* list of column names, or NIL for all */ +} VacuumRelation; + +/* ---------------------- + * Explain Statement + * + * The "query" field is initially a raw parse tree, and is converted to a + * Query node during parse analysis. Note that rewriting and planning + * of the query are always postponed until execution. + * ---------------------- + */ +typedef struct ExplainStmt +{ + NodeTag type; + Node *query; /* the query (see comments above) */ + List *options; /* list of DefElem nodes */ +} ExplainStmt; + +/* ---------------------- + * CREATE TABLE AS Statement (a/k/a SELECT INTO) + * + * A query written as CREATE TABLE AS will produce this node type natively. + * A query written as SELECT ... INTO will be transformed to this form during + * parse analysis. + * A query written as CREATE MATERIALIZED view will produce this node type, + * during parse analysis, since it needs all the same data. + * + * The "query" field is handled similarly to EXPLAIN, though note that it + * can be a SELECT or an EXECUTE, but not other DML statements. + * ---------------------- + */ +typedef struct CreateTableAsStmt +{ + NodeTag type; + Node *query; /* the query (see comments above) */ + IntoClause *into; /* destination table */ + ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */ + bool is_select_into; /* it was written as SELECT INTO */ + bool if_not_exists; /* just do nothing if it already exists? */ +} CreateTableAsStmt; + +/* ---------------------- + * REFRESH MATERIALIZED VIEW Statement + * ---------------------- + */ +typedef struct RefreshMatViewStmt +{ + NodeTag type; + bool concurrent; /* allow concurrent access? */ + bool skipData; /* true for WITH NO DATA */ + RangeVar *relation; /* relation to insert into */ +} RefreshMatViewStmt; + +/* ---------------------- + * Checkpoint Statement + * ---------------------- + */ +typedef struct CheckPointStmt +{ + NodeTag type; +} CheckPointStmt; + +/* ---------------------- + * Discard Statement + * ---------------------- + */ + +typedef enum DiscardMode +{ + DISCARD_ALL, + DISCARD_PLANS, + DISCARD_SEQUENCES, + DISCARD_TEMP, +} DiscardMode; + +typedef struct DiscardStmt +{ + NodeTag type; + DiscardMode target; +} DiscardStmt; + +/* ---------------------- + * LOCK Statement + * ---------------------- + */ +typedef struct LockStmt +{ + NodeTag type; + List *relations; /* relations to lock */ + int mode; /* lock mode */ + bool nowait; /* no wait mode */ +} LockStmt; + +/* ---------------------- + * SET CONSTRAINTS Statement + * ---------------------- + */ +typedef struct ConstraintsSetStmt +{ + NodeTag type; + List *constraints; /* List of names as RangeVars */ + bool deferred; +} ConstraintsSetStmt; + +/* ---------------------- + * REINDEX Statement + * ---------------------- + */ +typedef enum ReindexObjectType +{ + REINDEX_OBJECT_INDEX, /* index */ + REINDEX_OBJECT_TABLE, /* table or materialized view */ + REINDEX_OBJECT_SCHEMA, /* schema */ + REINDEX_OBJECT_SYSTEM, /* system catalogs */ + REINDEX_OBJECT_DATABASE, /* database */ +} ReindexObjectType; + +typedef struct ReindexStmt +{ + NodeTag type; + ReindexObjectType kind; /* REINDEX_OBJECT_INDEX, REINDEX_OBJECT_TABLE, + * etc. */ + RangeVar *relation; /* Table or index to reindex */ + const char *name; /* name of database to reindex */ + List *params; /* list of DefElem nodes */ +} ReindexStmt; + +/* ---------------------- + * CREATE CONVERSION Statement + * ---------------------- + */ +typedef struct CreateConversionStmt +{ + NodeTag type; + List *conversion_name; /* Name of the conversion */ + char *for_encoding_name; /* source encoding name */ + char *to_encoding_name; /* destination encoding name */ + List *func_name; /* qualified conversion function name */ + bool def; /* is this a default conversion? */ +} CreateConversionStmt; + +/* ---------------------- + * CREATE CAST Statement + * ---------------------- + */ +typedef struct CreateCastStmt +{ + NodeTag type; + TypeName *sourcetype; + TypeName *targettype; + ObjectWithArgs *func; + CoercionContext context; + bool inout; +} CreateCastStmt; + +/* ---------------------- + * CREATE TRANSFORM Statement + * ---------------------- + */ +typedef struct CreateTransformStmt +{ + NodeTag type; + bool replace; + TypeName *type_name; + char *lang; + ObjectWithArgs *fromsql; + ObjectWithArgs *tosql; +} CreateTransformStmt; + +/* ---------------------- + * PREPARE Statement + * ---------------------- + */ +typedef struct PrepareStmt +{ + NodeTag type; + char *name; /* Name of plan, arbitrary */ + List *argtypes; /* Types of parameters (List of TypeName) */ + Node *query; /* The query itself (as a raw parsetree) */ +} PrepareStmt; + + +/* ---------------------- + * EXECUTE Statement + * ---------------------- + */ + +typedef struct ExecuteStmt +{ + NodeTag type; + char *name; /* The name of the plan to execute */ + List *params; /* Values to assign to parameters */ +} ExecuteStmt; + + +/* ---------------------- + * DEALLOCATE Statement + * ---------------------- + */ +typedef struct DeallocateStmt +{ + NodeTag type; + /* The name of the plan to remove, NULL if DEALLOCATE ALL */ + char *name pg_node_attr(query_jumble_ignore); + + /* + * True if DEALLOCATE ALL. This is redundant with "name == NULL", but we + * make it a separate field so that exactly this condition (and not the + * precise name) will be accounted for in query jumbling. + */ + bool isall; + /* token location, or -1 if unknown */ + ParseLoc location pg_node_attr(query_jumble_location); +} DeallocateStmt; + +/* + * DROP OWNED statement + */ +typedef struct DropOwnedStmt +{ + NodeTag type; + List *roles; + DropBehavior behavior; +} DropOwnedStmt; + +/* + * REASSIGN OWNED statement + */ +typedef struct ReassignOwnedStmt +{ + NodeTag type; + List *roles; + RoleSpec *newrole; +} ReassignOwnedStmt; + +/* + * TS Dictionary stmts: DefineStmt, RenameStmt and DropStmt are default + */ +typedef struct AlterTSDictionaryStmt +{ + NodeTag type; + List *dictname; /* qualified name (list of String) */ + List *options; /* List of DefElem nodes */ +} AlterTSDictionaryStmt; + +/* + * TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default + */ +typedef enum AlterTSConfigType +{ + ALTER_TSCONFIG_ADD_MAPPING, + ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN, + ALTER_TSCONFIG_REPLACE_DICT, + ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN, + ALTER_TSCONFIG_DROP_MAPPING, +} AlterTSConfigType; + +typedef struct AlterTSConfigurationStmt +{ + NodeTag type; + AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */ + List *cfgname; /* qualified name (list of String) */ + + /* + * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is + * NIL, but tokentype isn't, DROP MAPPING was specified. + */ + List *tokentype; /* list of String */ + List *dicts; /* list of list of String */ + bool override; /* if true - remove old variant */ + bool replace; /* if true - replace dictionary by another */ + bool missing_ok; /* for DROP - skip error if missing? */ +} AlterTSConfigurationStmt; + +typedef struct PublicationTable +{ + NodeTag type; + RangeVar *relation; /* relation to be published */ + Node *whereClause; /* qualifications */ + List *columns; /* List of columns in a publication table */ +} PublicationTable; + +/* + * Publication object type + */ +typedef enum PublicationObjSpecType +{ + PUBLICATIONOBJ_TABLE, /* A table */ + PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */ + PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of + * search_path */ + PUBLICATIONOBJ_CONTINUATION, /* Continuation of previous type */ +} PublicationObjSpecType; + +typedef struct PublicationObjSpec +{ + NodeTag type; + PublicationObjSpecType pubobjtype; /* type of this publication object */ + char *name; + PublicationTable *pubtable; + ParseLoc location; /* token location, or -1 if unknown */ +} PublicationObjSpec; + +typedef struct CreatePublicationStmt +{ + NodeTag type; + char *pubname; /* Name of the publication */ + List *options; /* List of DefElem nodes */ + List *pubobjects; /* Optional list of publication objects */ + bool for_all_tables; /* Special publication for all tables in db */ +} CreatePublicationStmt; + +typedef enum AlterPublicationAction +{ + AP_AddObjects, /* add objects to publication */ + AP_DropObjects, /* remove objects from publication */ + AP_SetObjects, /* set list of objects */ +} AlterPublicationAction; + +typedef struct AlterPublicationStmt +{ + NodeTag type; + char *pubname; /* Name of the publication */ + + /* parameters used for ALTER PUBLICATION ... WITH */ + List *options; /* List of DefElem nodes */ + + /* + * Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication + * objects. + */ + List *pubobjects; /* Optional list of publication objects */ + bool for_all_tables; /* Special publication for all tables in db */ + AlterPublicationAction action; /* What action to perform with the given + * objects */ +} AlterPublicationStmt; + +typedef struct CreateSubscriptionStmt +{ + NodeTag type; + char *subname; /* Name of the subscription */ + char *conninfo; /* Connection string to publisher */ + List *publication; /* One or more publication to subscribe to */ + List *options; /* List of DefElem nodes */ +} CreateSubscriptionStmt; + +typedef enum AlterSubscriptionType +{ + ALTER_SUBSCRIPTION_OPTIONS, + ALTER_SUBSCRIPTION_CONNECTION, + ALTER_SUBSCRIPTION_SET_PUBLICATION, + ALTER_SUBSCRIPTION_ADD_PUBLICATION, + ALTER_SUBSCRIPTION_DROP_PUBLICATION, + ALTER_SUBSCRIPTION_REFRESH, + ALTER_SUBSCRIPTION_ENABLED, + ALTER_SUBSCRIPTION_SKIP, +} AlterSubscriptionType; + +typedef struct AlterSubscriptionStmt +{ + NodeTag type; + AlterSubscriptionType kind; /* ALTER_SUBSCRIPTION_OPTIONS, etc */ + char *subname; /* Name of the subscription */ + char *conninfo; /* Connection string to publisher */ + List *publication; /* One or more publication to subscribe to */ + List *options; /* List of DefElem nodes */ +} AlterSubscriptionStmt; + +typedef struct DropSubscriptionStmt +{ + NodeTag type; + char *subname; /* Name of the subscription */ + bool missing_ok; /* Skip error if missing? */ + DropBehavior behavior; /* RESTRICT or CASCADE behavior */ +} DropSubscriptionStmt; + +#endif /* PARSENODES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/pathnodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/pathnodes.h new file mode 100644 index 0000000..6eef145 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/pathnodes.h @@ -0,0 +1,3609 @@ +/*------------------------------------------------------------------------- + * + * pathnodes.h + * Definitions for planner's internal data structures, especially Paths. + * + * We don't support copying RelOptInfo, IndexOptInfo, or Path nodes. + * There are some subsidiary structs that are useful to copy, though. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/pathnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef PATHNODES_H +#define PATHNODES_H + +#include "access/sdir.h" +#include "lib/stringinfo.h" +#include "nodes/params.h" +#include "nodes/parsenodes.h" +#include "storage/block.h" + + +/* + * Relids + * Set of relation identifiers (indexes into the rangetable). + */ +typedef Bitmapset *Relids; + +/* + * When looking for a "cheapest path", this enum specifies whether we want + * cheapest startup cost or cheapest total cost. + */ +typedef enum CostSelector +{ + STARTUP_COST, TOTAL_COST +} CostSelector; + +/* + * The cost estimate produced by cost_qual_eval() includes both a one-time + * (startup) cost, and a per-tuple cost. + */ +typedef struct QualCost +{ + Cost startup; /* one-time cost */ + Cost per_tuple; /* per-evaluation cost */ +} QualCost; + +/* + * Costing aggregate function execution requires these statistics about + * the aggregates to be executed by a given Agg node. Note that the costs + * include the execution costs of the aggregates' argument expressions as + * well as the aggregate functions themselves. Also, the fields must be + * defined so that initializing the struct to zeroes with memset is correct. + */ +typedef struct AggClauseCosts +{ + QualCost transCost; /* total per-input-row execution costs */ + QualCost finalCost; /* total per-aggregated-row costs */ + Size transitionSpace; /* space for pass-by-ref transition data */ +} AggClauseCosts; + +/* + * This enum identifies the different types of "upper" (post-scan/join) + * relations that we might deal with during planning. + */ +typedef enum UpperRelationKind +{ + UPPERREL_SETOP, /* result of UNION/INTERSECT/EXCEPT, if any */ + UPPERREL_PARTIAL_GROUP_AGG, /* result of partial grouping/aggregation, if + * any */ + UPPERREL_GROUP_AGG, /* result of grouping/aggregation, if any */ + UPPERREL_WINDOW, /* result of window functions, if any */ + UPPERREL_PARTIAL_DISTINCT, /* result of partial "SELECT DISTINCT", if any */ + UPPERREL_DISTINCT, /* result of "SELECT DISTINCT", if any */ + UPPERREL_ORDERED, /* result of ORDER BY, if any */ + UPPERREL_FINAL, /* result of any remaining top-level actions */ + /* NB: UPPERREL_FINAL must be last enum entry; it's used to size arrays */ +} UpperRelationKind; + +/*---------- + * PlannerGlobal + * Global information for planning/optimization + * + * PlannerGlobal holds state for an entire planner invocation; this state + * is shared across all levels of sub-Queries that exist in the command being + * planned. + * + * Not all fields are printed. (In some cases, there is no print support for + * the field type; in others, doing so would lead to infinite recursion.) + *---------- + */ +typedef struct PlannerGlobal +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* Param values provided to planner() */ + ParamListInfo boundParams pg_node_attr(read_write_ignore); + + /* Plans for SubPlan nodes */ + List *subplans; + + /* Paths from which the SubPlan Plans were made */ + List *subpaths; + + /* PlannerInfos for SubPlan nodes */ + List *subroots pg_node_attr(read_write_ignore); + + /* indices of subplans that require REWIND */ + Bitmapset *rewindPlanIDs; + + /* "flat" rangetable for executor */ + List *finalrtable; + + /* + * RT indexes of all relation RTEs in finalrtable (RTE_RELATION and + * RTE_SUBQUERY RTEs of views) + */ + Bitmapset *allRelids; + + /* + * RT indexes of all leaf partitions in nodes that support pruning and are + * subject to runtime pruning at plan initialization time ("initial" + * pruning). + */ + Bitmapset *prunableRelids; + + /* "flat" list of RTEPermissionInfos */ + List *finalrteperminfos; + + /* "flat" list of PlanRowMarks */ + List *finalrowmarks; + + /* "flat" list of integer RT indexes */ + List *resultRelations; + + /* "flat" list of AppendRelInfos */ + List *appendRelations; + + /* "flat" list of PartitionPruneInfos */ + List *partPruneInfos; + + /* OIDs of relations the plan depends on */ + List *relationOids; + + /* other dependencies, as PlanInvalItems */ + List *invalItems; + + /* type OIDs for PARAM_EXEC Params */ + List *paramExecTypes; + + /* highest PlaceHolderVar ID assigned */ + Index lastPHId; + + /* highest PlanRowMark ID assigned */ + Index lastRowMarkId; + + /* highest plan node ID assigned */ + int lastPlanNodeId; + + /* redo plan when TransactionXmin changes? */ + bool transientPlan; + + /* is plan specific to current role? */ + bool dependsOnRole; + + /* parallel mode potentially OK? */ + bool parallelModeOK; + + /* parallel mode actually required? */ + bool parallelModeNeeded; + + /* worst PROPARALLEL hazard level */ + char maxParallelHazard; + + /* partition descriptors */ + PartitionDirectory partition_directory pg_node_attr(read_write_ignore); +} PlannerGlobal; + +/* macro for fetching the Plan associated with a SubPlan node */ +#define planner_subplan_get_plan(root, subplan) \ + ((Plan *) list_nth((root)->glob->subplans, (subplan)->plan_id - 1)) + + +/*---------- + * PlannerInfo + * Per-query information for planning/optimization + * + * This struct is conventionally called "root" in all the planner routines. + * It holds links to all of the planner's working state, in addition to the + * original Query. Note that at present the planner extensively modifies + * the passed-in Query data structure; someday that should stop. + * + * For reasons explained in optimizer/optimizer.h, we define the typedef + * either here or in that header, whichever is read first. + * + * Not all fields are printed. (In some cases, there is no print support for + * the field type; in others, doing so would lead to infinite recursion or + * bloat dump output more than seems useful.) + * + * NOTE: When adding new entries containing relids and relid bitmapsets, + * remember to check that they will be correctly processed by + * the remove_self_join_rel function - relid of removing relation will be + * correctly replaced with the keeping one. + *---------- + */ +#ifndef HAVE_PLANNERINFO_TYPEDEF +typedef struct PlannerInfo PlannerInfo; +#define HAVE_PLANNERINFO_TYPEDEF 1 +#endif + +struct PlannerInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* the Query being planned */ + Query *parse; + + /* global info for current planner run */ + PlannerGlobal *glob; + + /* 1 at the outermost Query */ + Index query_level; + + /* NULL at outermost Query */ + PlannerInfo *parent_root pg_node_attr(read_write_ignore); + + /* + * plan_params contains the expressions that this query level needs to + * make available to a lower query level that is currently being planned. + * outer_params contains the paramIds of PARAM_EXEC Params that outer + * query levels will make available to this query level. + */ + /* list of PlannerParamItems, see below */ + List *plan_params; + Bitmapset *outer_params; + + /* + * simple_rel_array holds pointers to "base rels" and "other rels" (see + * comments for RelOptInfo for more info). It is indexed by rangetable + * index (so entry 0 is always wasted). Entries can be NULL when an RTE + * does not correspond to a base relation, such as a join RTE or an + * unreferenced view RTE; or if the RelOptInfo hasn't been made yet. + */ + struct RelOptInfo **simple_rel_array pg_node_attr(array_size(simple_rel_array_size)); + /* allocated size of array */ + int simple_rel_array_size; + + /* + * simple_rte_array is the same length as simple_rel_array and holds + * pointers to the associated rangetable entries. Using this is a shade + * faster than using rt_fetch(), mostly due to fewer indirections. (Not + * printed because it'd be redundant with parse->rtable.) + */ + RangeTblEntry **simple_rte_array pg_node_attr(read_write_ignore); + + /* + * append_rel_array is the same length as the above arrays, and holds + * pointers to the corresponding AppendRelInfo entry indexed by + * child_relid, or NULL if the rel is not an appendrel child. The array + * itself is not allocated if append_rel_list is empty. (Not printed + * because it'd be redundant with append_rel_list.) + */ + struct AppendRelInfo **append_rel_array pg_node_attr(read_write_ignore); + + /* + * all_baserels is a Relids set of all base relids (but not joins or + * "other" rels) in the query. This is computed in deconstruct_jointree. + */ + Relids all_baserels; + + /* + * outer_join_rels is a Relids set of all outer-join relids in the query. + * This is computed in deconstruct_jointree. + */ + Relids outer_join_rels; + + /* + * all_query_rels is a Relids set of all base relids and outer join relids + * (but not "other" relids) in the query. This is the Relids identifier + * of the final join we need to form. This is computed in + * deconstruct_jointree. + */ + Relids all_query_rels; + + /* + * join_rel_list is a list of all join-relation RelOptInfos we have + * considered in this planning run. For small problems we just scan the + * list to do lookups, but when there are many join relations we build a + * hash table for faster lookups. The hash table is present and valid + * when join_rel_hash is not NULL. Note that we still maintain the list + * even when using the hash table for lookups; this simplifies life for + * GEQO. + */ + List *join_rel_list; + struct HTAB *join_rel_hash pg_node_attr(read_write_ignore); + + /* + * When doing a dynamic-programming-style join search, join_rel_level[k] + * is a list of all join-relation RelOptInfos of level k, and + * join_cur_level is the current level. New join-relation RelOptInfos are + * automatically added to the join_rel_level[join_cur_level] list. + * join_rel_level is NULL if not in use. + * + * Note: we've already printed all baserel and joinrel RelOptInfos above, + * so we don't dump join_rel_level or other lists of RelOptInfos. + */ + /* lists of join-relation RelOptInfos */ + List **join_rel_level pg_node_attr(read_write_ignore); + /* index of list being extended */ + int join_cur_level; + + /* init SubPlans for query */ + List *init_plans; + + /* + * per-CTE-item list of subplan IDs (or -1 if no subplan was made for that + * CTE) + */ + List *cte_plan_ids; + + /* List of Lists of Params for MULTIEXPR subquery outputs */ + List *multiexpr_params; + + /* list of JoinDomains used in the query (higher ones first) */ + List *join_domains; + + /* list of active EquivalenceClasses */ + List *eq_classes; + + /* set true once ECs are canonical */ + bool ec_merging_done; + + /* list of "canonical" PathKeys */ + List *canon_pathkeys; + + /* + * list of OuterJoinClauseInfos for mergejoinable outer join clauses + * w/nonnullable var on left + */ + List *left_join_clauses; + + /* + * list of OuterJoinClauseInfos for mergejoinable outer join clauses + * w/nonnullable var on right + */ + List *right_join_clauses; + + /* + * list of OuterJoinClauseInfos for mergejoinable full join clauses + */ + List *full_join_clauses; + + /* list of SpecialJoinInfos */ + List *join_info_list; + + /* counter for assigning RestrictInfo serial numbers */ + int last_rinfo_serial; + + /* + * all_result_relids is empty for SELECT, otherwise it contains at least + * parse->resultRelation. For UPDATE/DELETE/MERGE across an inheritance + * or partitioning tree, the result rel's child relids are added. When + * using multi-level partitioning, intermediate partitioned rels are + * included. leaf_result_relids is similar except that only actual result + * tables, not partitioned tables, are included in it. + */ + /* set of all result relids */ + Relids all_result_relids; + /* set of all leaf relids */ + Relids leaf_result_relids; + + /* + * list of AppendRelInfos + * + * Note: for AppendRelInfos describing partitions of a partitioned table, + * we guarantee that partitions that come earlier in the partitioned + * table's PartitionDesc will appear earlier in append_rel_list. + */ + List *append_rel_list; + + /* list of RowIdentityVarInfos */ + List *row_identity_vars; + + /* list of PlanRowMarks */ + List *rowMarks; + + /* list of PlaceHolderInfos */ + List *placeholder_list; + + /* array of PlaceHolderInfos indexed by phid */ + struct PlaceHolderInfo **placeholder_array pg_node_attr(read_write_ignore, array_size(placeholder_array_size)); + /* allocated size of array */ + int placeholder_array_size pg_node_attr(read_write_ignore); + + /* list of ForeignKeyOptInfos */ + List *fkey_list; + + /* desired pathkeys for query_planner() */ + List *query_pathkeys; + + /* groupClause pathkeys, if any */ + List *group_pathkeys; + + /* + * The number of elements in the group_pathkeys list which belong to the + * GROUP BY clause. Additional ones belong to ORDER BY / DISTINCT + * aggregates. + */ + int num_groupby_pathkeys; + + /* pathkeys of bottom window, if any */ + List *window_pathkeys; + /* distinctClause pathkeys, if any */ + List *distinct_pathkeys; + /* sortClause pathkeys, if any */ + List *sort_pathkeys; + /* set operator pathkeys, if any */ + List *setop_pathkeys; + + /* Canonicalised partition schemes used in the query. */ + List *part_schemes pg_node_attr(read_write_ignore); + + /* RelOptInfos we are now trying to join */ + List *initial_rels pg_node_attr(read_write_ignore); + + /* + * Upper-rel RelOptInfos. Use fetch_upper_rel() to get any particular + * upper rel. + */ + List *upper_rels[UPPERREL_FINAL + 1] pg_node_attr(read_write_ignore); + + /* Result tlists chosen by grouping_planner for upper-stage processing */ + struct PathTarget *upper_targets[UPPERREL_FINAL + 1] pg_node_attr(read_write_ignore); + + /* + * The fully-processed groupClause is kept here. It differs from + * parse->groupClause in that we remove any items that we can prove + * redundant, so that only the columns named here actually need to be + * compared to determine grouping. Note that it's possible for *all* the + * items to be proven redundant, implying that there is only one group + * containing all the query's rows. Hence, if you want to check whether + * GROUP BY was specified, test for nonempty parse->groupClause, not for + * nonempty processed_groupClause. Optimizer chooses specific order of + * group-by clauses during the upper paths generation process, attempting + * to use different strategies to minimize number of sorts or engage + * incremental sort. See preprocess_groupclause() and + * get_useful_group_keys_orderings() for details. + * + * Currently, when grouping sets are specified we do not attempt to + * optimize the groupClause, so that processed_groupClause will be + * identical to parse->groupClause. + */ + List *processed_groupClause; + + /* + * The fully-processed distinctClause is kept here. It differs from + * parse->distinctClause in that we remove any items that we can prove + * redundant, so that only the columns named here actually need to be + * compared to determine uniqueness. Note that it's possible for *all* + * the items to be proven redundant, implying that there should be only + * one output row. Hence, if you want to check whether DISTINCT was + * specified, test for nonempty parse->distinctClause, not for nonempty + * processed_distinctClause. + */ + List *processed_distinctClause; + + /* + * The fully-processed targetlist is kept here. It differs from + * parse->targetList in that (for INSERT) it's been reordered to match the + * target table, and defaults have been filled in. Also, additional + * resjunk targets may be present. preprocess_targetlist() does most of + * that work, but note that more resjunk targets can get added during + * appendrel expansion. (Hence, upper_targets mustn't get set up till + * after that.) + */ + List *processed_tlist; + + /* + * For UPDATE, this list contains the target table's attribute numbers to + * which the first N entries of processed_tlist are to be assigned. (Any + * additional entries in processed_tlist must be resjunk.) DO NOT use the + * resnos in processed_tlist to identify the UPDATE target columns. + */ + List *update_colnos; + + /* + * Fields filled during create_plan() for use in setrefs.c + */ + /* for GroupingFunc fixup (can't print: array length not known here) */ + AttrNumber *grouping_map pg_node_attr(read_write_ignore); + /* List of MinMaxAggInfos */ + List *minmax_aggs; + + /* context holding PlannerInfo */ + MemoryContext planner_cxt pg_node_attr(read_write_ignore); + + /* # of pages in all non-dummy tables of query */ + Cardinality total_table_pages; + + /* tuple_fraction passed to query_planner */ + Selectivity tuple_fraction; + /* limit_tuples passed to query_planner */ + Cardinality limit_tuples; + + /* + * Minimum security_level for quals. Note: qual_security_level is zero if + * there are no securityQuals. + */ + Index qual_security_level; + + /* true if any RTEs are RTE_JOIN kind */ + bool hasJoinRTEs; + /* true if any RTEs are marked LATERAL */ + bool hasLateralRTEs; + /* true if havingQual was non-null */ + bool hasHavingQual; + /* true if any RestrictInfo has pseudoconstant = true */ + bool hasPseudoConstantQuals; + /* true if we've made any of those */ + bool hasAlternativeSubPlans; + /* true once we're no longer allowed to add PlaceHolderInfos */ + bool placeholdersFrozen; + /* true if planning a recursive WITH item */ + bool hasRecursion; + + /* + * The rangetable index for the RTE_GROUP RTE, or 0 if there is no + * RTE_GROUP RTE. + */ + int group_rtindex; + + /* + * Information about aggregates. Filled by preprocess_aggrefs(). + */ + /* AggInfo structs */ + List *agginfos; + /* AggTransInfo structs */ + List *aggtransinfos; + /* number of aggs with DISTINCT/ORDER BY/WITHIN GROUP */ + int numOrderedAggs; + /* does any agg not support partial mode? */ + bool hasNonPartialAggs; + /* is any partial agg non-serializable? */ + bool hasNonSerialAggs; + + /* + * These fields are used only when hasRecursion is true: + */ + /* PARAM_EXEC ID for the work table */ + int wt_param_id; + /* a path for non-recursive term */ + struct Path *non_recursive_path; + + /* + * These fields are workspace for createplan.c + */ + /* outer rels above current node */ + Relids curOuterRels; + /* not-yet-assigned NestLoopParams */ + List *curOuterParams; + + /* + * These fields are workspace for setrefs.c. Each is an array + * corresponding to glob->subplans. (We could probably teach + * gen_node_support.pl how to determine the array length, but it doesn't + * seem worth the trouble, so just mark them read_write_ignore.) + */ + bool *isAltSubplan pg_node_attr(read_write_ignore); + bool *isUsedSubplan pg_node_attr(read_write_ignore); + + /* optional private data for join_search_hook, e.g., GEQO */ + void *join_search_private pg_node_attr(read_write_ignore); + + /* Does this query modify any partition key columns? */ + bool partColsUpdated; + + /* PartitionPruneInfos added in this query's plan. */ + List *partPruneInfos; +}; + + +/* + * In places where it's known that simple_rte_array[] must have been prepared + * already, we just index into it to fetch RTEs. In code that might be + * executed before or after entering query_planner(), use this macro. + */ +#define planner_rt_fetch(rti, root) \ + ((root)->simple_rte_array ? (root)->simple_rte_array[rti] : \ + rt_fetch(rti, (root)->parse->rtable)) + +/* + * If multiple relations are partitioned the same way, all such partitions + * will have a pointer to the same PartitionScheme. A list of PartitionScheme + * objects is attached to the PlannerInfo. By design, the partition scheme + * incorporates only the general properties of the partition method (LIST vs. + * RANGE, number of partitioning columns and the type information for each) + * and not the specific bounds. + * + * We store the opclass-declared input data types instead of the partition key + * datatypes since the former rather than the latter are used to compare + * partition bounds. Since partition key data types and the opclass declared + * input data types are expected to be binary compatible (per ResolveOpClass), + * both of those should have same byval and length properties. + */ +typedef struct PartitionSchemeData +{ + char strategy; /* partition strategy */ + int16 partnatts; /* number of partition attributes */ + Oid *partopfamily; /* OIDs of operator families */ + Oid *partopcintype; /* OIDs of opclass declared input data types */ + Oid *partcollation; /* OIDs of partitioning collations */ + + /* Cached information about partition key data types. */ + int16 *parttyplen; + bool *parttypbyval; + + /* Cached information about partition comparison functions. */ + struct FmgrInfo *partsupfunc; +} PartitionSchemeData; + +typedef struct PartitionSchemeData *PartitionScheme; + +/*---------- + * RelOptInfo + * Per-relation information for planning/optimization + * + * For planning purposes, a "base rel" is either a plain relation (a table) + * or the output of a sub-SELECT or function that appears in the range table. + * In either case it is uniquely identified by an RT index. A "joinrel" + * is the joining of two or more base rels. A joinrel is identified by + * the set of RT indexes for its component baserels, along with RT indexes + * for any outer joins it has computed. We create RelOptInfo nodes for each + * baserel and joinrel, and store them in the PlannerInfo's simple_rel_array + * and join_rel_list respectively. + * + * Note that there is only one joinrel for any given set of component + * baserels, no matter what order we assemble them in; so an unordered + * set is the right datatype to identify it with. + * + * We also have "other rels", which are like base rels in that they refer to + * single RT indexes; but they are not part of the join tree, and are given + * a different RelOptKind to identify them. + * Currently the only kind of otherrels are those made for member relations + * of an "append relation", that is an inheritance set or UNION ALL subquery. + * An append relation has a parent RTE that is a base rel, which represents + * the entire append relation. The member RTEs are otherrels. The parent + * is present in the query join tree but the members are not. The member + * RTEs and otherrels are used to plan the scans of the individual tables or + * subqueries of the append set; then the parent baserel is given Append + * and/or MergeAppend paths comprising the best paths for the individual + * member rels. (See comments for AppendRelInfo for more information.) + * + * At one time we also made otherrels to represent join RTEs, for use in + * handling join alias Vars. Currently this is not needed because all join + * alias Vars are expanded to non-aliased form during preprocess_expression. + * + * We also have relations representing joins between child relations of + * different partitioned tables. These relations are not added to + * join_rel_level lists as they are not joined directly by the dynamic + * programming algorithm. + * + * There is also a RelOptKind for "upper" relations, which are RelOptInfos + * that describe post-scan/join processing steps, such as aggregation. + * Many of the fields in these RelOptInfos are meaningless, but their Path + * fields always hold Paths showing ways to do that processing step. + * + * Parts of this data structure are specific to various scan and join + * mechanisms. It didn't seem worth creating new node types for them. + * + * relids - Set of relation identifiers (RT indexes). This is a base + * relation if there is just one, a join relation if more; + * in the join case, RT indexes of any outer joins formed + * at or below this join are included along with baserels + * rows - estimated number of tuples in the relation after restriction + * clauses have been applied (ie, output rows of a plan for it) + * consider_startup - true if there is any value in keeping plain paths for + * this rel on the basis of having cheap startup cost + * consider_param_startup - the same for parameterized paths + * reltarget - Default Path output tlist for this rel; normally contains + * Var and PlaceHolderVar nodes for the values we need to + * output from this relation. + * List is in no particular order, but all rels of an + * appendrel set must use corresponding orders. + * NOTE: in an appendrel child relation, may contain + * arbitrary expressions pulled up from a subquery! + * pathlist - List of Path nodes, one for each potentially useful + * method of generating the relation + * ppilist - ParamPathInfo nodes for parameterized Paths, if any + * cheapest_startup_path - the pathlist member with lowest startup cost + * (regardless of ordering) among the unparameterized paths; + * or NULL if there is no unparameterized path + * cheapest_total_path - the pathlist member with lowest total cost + * (regardless of ordering) among the unparameterized paths; + * or if there is no unparameterized path, the path with lowest + * total cost among the paths with minimum parameterization + * cheapest_unique_path - for caching cheapest path to produce unique + * (no duplicates) output from relation; NULL if not yet requested + * cheapest_parameterized_paths - best paths for their parameterizations; + * always includes cheapest_total_path, even if that's unparameterized + * direct_lateral_relids - rels this rel has direct LATERAL references to + * lateral_relids - required outer rels for LATERAL, as a Relids set + * (includes both direct and indirect lateral references) + * + * If the relation is a base relation it will have these fields set: + * + * relid - RTE index (this is redundant with the relids field, but + * is provided for convenience of access) + * rtekind - copy of RTE's rtekind field + * min_attr, max_attr - range of valid AttrNumbers for rel + * attr_needed - array of bitmapsets indicating the highest joinrel + * in which each attribute is needed; if bit 0 is set then + * the attribute is needed as part of final targetlist + * attr_widths - cache space for per-attribute width estimates; + * zero means not computed yet + * nulling_relids - relids of outer joins that can null this rel + * lateral_vars - lateral cross-references of rel, if any (list of + * Vars and PlaceHolderVars) + * lateral_referencers - relids of rels that reference this one laterally + * (includes both direct and indirect lateral references) + * indexlist - list of IndexOptInfo nodes for relation's indexes + * (always NIL if it's not a table or partitioned table) + * pages - number of disk pages in relation (zero if not a table) + * tuples - number of tuples in relation (not considering restrictions) + * allvisfrac - fraction of disk pages that are marked all-visible + * eclass_indexes - EquivalenceClasses that mention this rel (filled + * only after EC merging is complete) + * subroot - PlannerInfo for subquery (NULL if it's not a subquery) + * subplan_params - list of PlannerParamItems to be passed to subquery + * + * Note: for a subquery, tuples and subroot are not set immediately + * upon creation of the RelOptInfo object; they are filled in when + * set_subquery_pathlist processes the object. + * + * For otherrels that are appendrel members, these fields are filled + * in just as for a baserel, except we don't bother with lateral_vars. + * + * If the relation is either a foreign table or a join of foreign tables that + * all belong to the same foreign server and are assigned to the same user to + * check access permissions as (cf checkAsUser), these fields will be set: + * + * serverid - OID of foreign server, if foreign table (else InvalidOid) + * userid - OID of user to check access as (InvalidOid means current user) + * useridiscurrent - we've assumed that userid equals current user + * fdwroutine - function hooks for FDW, if foreign table (else NULL) + * fdw_private - private state for FDW, if foreign table (else NULL) + * + * Two fields are used to cache knowledge acquired during the join search + * about whether this rel is provably unique when being joined to given other + * relation(s), ie, it can have at most one row matching any given row from + * that join relation. Currently we only attempt such proofs, and thus only + * populate these fields, for base rels; but someday they might be used for + * join rels too: + * + * unique_for_rels - list of UniqueRelInfo, each one being a set of other + * rels for which this one has been proven unique + * non_unique_for_rels - list of Relid sets, each one being a set of + * other rels for which we have tried and failed to prove + * this one unique + * + * The presence of the following fields depends on the restrictions + * and joins that the relation participates in: + * + * baserestrictinfo - List of RestrictInfo nodes, containing info about + * each non-join qualification clause in which this relation + * participates (only used for base rels) + * baserestrictcost - Estimated cost of evaluating the baserestrictinfo + * clauses at a single tuple (only used for base rels) + * baserestrict_min_security - Smallest security_level found among + * clauses in baserestrictinfo + * joininfo - List of RestrictInfo nodes, containing info about each + * join clause in which this relation participates (but + * note this excludes clauses that might be derivable from + * EquivalenceClasses) + * has_eclass_joins - flag that EquivalenceClass joins are possible + * + * Note: Keeping a restrictinfo list in the RelOptInfo is useful only for + * base rels, because for a join rel the set of clauses that are treated as + * restrict clauses varies depending on which sub-relations we choose to join. + * (For example, in a 3-base-rel join, a clause relating rels 1 and 2 must be + * treated as a restrictclause if we join {1} and {2 3} to make {1 2 3}; but + * if we join {1 2} and {3} then that clause will be a restrictclause in {1 2} + * and should not be processed again at the level of {1 2 3}.) Therefore, + * the restrictinfo list in the join case appears in individual JoinPaths + * (field joinrestrictinfo), not in the parent relation. But it's OK for + * the RelOptInfo to store the joininfo list, because that is the same + * for a given rel no matter how we form it. + * + * We store baserestrictcost in the RelOptInfo (for base relations) because + * we know we will need it at least once (to price the sequential scan) + * and may need it multiple times to price index scans. + * + * A join relation is considered to be partitioned if it is formed from a + * join of two relations that are partitioned, have matching partitioning + * schemes, and are joined on an equijoin of the partitioning columns. + * Under those conditions we can consider the join relation to be partitioned + * by either relation's partitioning keys, though some care is needed if + * either relation can be forced to null by outer-joining. For example, an + * outer join like (A LEFT JOIN B ON A.a = B.b) may produce rows with B.b + * NULL. These rows may not fit the partitioning conditions imposed on B. + * Hence, strictly speaking, the join is not partitioned by B.b and thus + * partition keys of an outer join should include partition key expressions + * from the non-nullable side only. However, if a subsequent join uses + * strict comparison operators (and all commonly-used equijoin operators are + * strict), the presence of nulls doesn't cause a problem: such rows couldn't + * match anything on the other side and thus they don't create a need to do + * any cross-partition sub-joins. Hence we can treat such values as still + * partitioning the join output for the purpose of additional partitionwise + * joining, so long as a strict join operator is used by the next join. + * + * If the relation is partitioned, these fields will be set: + * + * part_scheme - Partitioning scheme of the relation + * nparts - Number of partitions + * boundinfo - Partition bounds + * partbounds_merged - true if partition bounds are merged ones + * partition_qual - Partition constraint if not the root + * part_rels - RelOptInfos for each partition + * all_partrels - Relids set of all partition relids + * partexprs, nullable_partexprs - Partition key expressions + * + * The partexprs and nullable_partexprs arrays each contain + * part_scheme->partnatts elements. Each of the elements is a list of + * partition key expressions. For partitioned base relations, there is one + * expression in each partexprs element, and nullable_partexprs is empty. + * For partitioned join relations, each base relation within the join + * contributes one partition key expression per partitioning column; + * that expression goes in the partexprs[i] list if the base relation + * is not nullable by this join or any lower outer join, or in the + * nullable_partexprs[i] list if the base relation is nullable. + * Furthermore, FULL JOINs add extra nullable_partexprs expressions + * corresponding to COALESCE expressions of the left and right join columns, + * to simplify matching join clauses to those lists. + * + * Not all fields are printed. (In some cases, there is no print support for + * the field type.) + *---------- + */ + +/* Bitmask of flags supported by table AMs */ +#define AMFLAG_HAS_TID_RANGE (1 << 0) + +typedef enum RelOptKind +{ + RELOPT_BASEREL, + RELOPT_JOINREL, + RELOPT_OTHER_MEMBER_REL, + RELOPT_OTHER_JOINREL, + RELOPT_UPPER_REL, + RELOPT_OTHER_UPPER_REL, +} RelOptKind; + +/* + * Is the given relation a simple relation i.e a base or "other" member + * relation? + */ +#define IS_SIMPLE_REL(rel) \ + ((rel)->reloptkind == RELOPT_BASEREL || \ + (rel)->reloptkind == RELOPT_OTHER_MEMBER_REL) + +/* Is the given relation a join relation? */ +#define IS_JOIN_REL(rel) \ + ((rel)->reloptkind == RELOPT_JOINREL || \ + (rel)->reloptkind == RELOPT_OTHER_JOINREL) + +/* Is the given relation an upper relation? */ +#define IS_UPPER_REL(rel) \ + ((rel)->reloptkind == RELOPT_UPPER_REL || \ + (rel)->reloptkind == RELOPT_OTHER_UPPER_REL) + +/* Is the given relation an "other" relation? */ +#define IS_OTHER_REL(rel) \ + ((rel)->reloptkind == RELOPT_OTHER_MEMBER_REL || \ + (rel)->reloptkind == RELOPT_OTHER_JOINREL || \ + (rel)->reloptkind == RELOPT_OTHER_UPPER_REL) + +typedef struct RelOptInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + RelOptKind reloptkind; + + /* + * all relations included in this RelOptInfo; set of base + OJ relids + * (rangetable indexes) + */ + Relids relids; + + /* + * size estimates generated by planner + */ + /* estimated number of result tuples */ + Cardinality rows; + + /* + * per-relation planner control flags + */ + /* keep cheap-startup-cost paths? */ + bool consider_startup; + /* ditto, for parameterized paths? */ + bool consider_param_startup; + /* consider parallel paths? */ + bool consider_parallel; + + /* + * default result targetlist for Paths scanning this relation; list of + * Vars/Exprs, cost, width + */ + struct PathTarget *reltarget; + + /* + * materialization information + */ + List *pathlist; /* Path structures */ + List *ppilist; /* ParamPathInfos used in pathlist */ + List *partial_pathlist; /* partial Paths */ + struct Path *cheapest_startup_path; + struct Path *cheapest_total_path; + struct Path *cheapest_unique_path; + List *cheapest_parameterized_paths; + + /* + * parameterization information needed for both base rels and join rels + * (see also lateral_vars and lateral_referencers) + */ + /* rels directly laterally referenced */ + Relids direct_lateral_relids; + /* minimum parameterization of rel */ + Relids lateral_relids; + + /* + * information about a base rel (not set for join rels!) + */ + Index relid; + /* containing tablespace */ + Oid reltablespace; + /* RELATION, SUBQUERY, FUNCTION, etc */ + RTEKind rtekind; + /* smallest attrno of rel (often <0) */ + AttrNumber min_attr; + /* largest attrno of rel */ + AttrNumber max_attr; + /* array indexed [min_attr .. max_attr] */ + Relids *attr_needed pg_node_attr(read_write_ignore); + /* array indexed [min_attr .. max_attr] */ + int32 *attr_widths pg_node_attr(read_write_ignore); + + /* + * Zero-based set containing attnums of NOT NULL columns. Not populated + * for rels corresponding to non-partitioned inh==true RTEs. + */ + Bitmapset *notnullattnums; + /* relids of outer joins that can null this baserel */ + Relids nulling_relids; + /* LATERAL Vars and PHVs referenced by rel */ + List *lateral_vars; + /* rels that reference this baserel laterally */ + Relids lateral_referencers; + /* list of IndexOptInfo */ + List *indexlist; + /* list of StatisticExtInfo */ + List *statlist; + /* size estimates derived from pg_class */ + BlockNumber pages; + Cardinality tuples; + double allvisfrac; + /* indexes in PlannerInfo's eq_classes list of ECs that mention this rel */ + Bitmapset *eclass_indexes; + PlannerInfo *subroot; /* if subquery */ + List *subplan_params; /* if subquery */ + /* wanted number of parallel workers */ + int rel_parallel_workers; + /* Bitmask of optional features supported by the table AM */ + uint32 amflags; + + /* + * Information about foreign tables and foreign joins + */ + /* identifies server for the table or join */ + Oid serverid; + /* identifies user to check access as; 0 means to check as current user */ + Oid userid; + /* join is only valid for current user */ + bool useridiscurrent; + /* use "struct FdwRoutine" to avoid including fdwapi.h here */ + struct FdwRoutine *fdwroutine pg_node_attr(read_write_ignore); + void *fdw_private pg_node_attr(read_write_ignore); + + /* + * cache space for remembering if we have proven this relation unique + */ + /* known unique for these other relid set(s) given in UniqueRelInfo(s) */ + List *unique_for_rels; + /* known not unique for these set(s) */ + List *non_unique_for_rels; + + /* + * used by various scans and joins: + */ + /* RestrictInfo structures (if base rel) */ + List *baserestrictinfo; + /* cost of evaluating the above */ + QualCost baserestrictcost; + /* min security_level found in baserestrictinfo */ + Index baserestrict_min_security; + /* RestrictInfo structures for join clauses involving this rel */ + List *joininfo; + /* T means joininfo is incomplete */ + bool has_eclass_joins; + + /* + * used by partitionwise joins: + */ + /* consider partitionwise join paths? (if partitioned rel) */ + bool consider_partitionwise_join; + + /* + * inheritance links, if this is an otherrel (otherwise NULL): + */ + /* Immediate parent relation (dumping it would be too verbose) */ + struct RelOptInfo *parent pg_node_attr(read_write_ignore); + /* Topmost parent relation (dumping it would be too verbose) */ + struct RelOptInfo *top_parent pg_node_attr(read_write_ignore); + /* Relids of topmost parent (redundant, but handy) */ + Relids top_parent_relids; + + /* + * used for partitioned relations: + */ + /* Partitioning scheme */ + PartitionScheme part_scheme pg_node_attr(read_write_ignore); + + /* + * Number of partitions; -1 if not yet set; in case of a join relation 0 + * means it's considered unpartitioned + */ + int nparts; + /* Partition bounds */ + struct PartitionBoundInfoData *boundinfo pg_node_attr(read_write_ignore); + /* True if partition bounds were created by partition_bounds_merge() */ + bool partbounds_merged; + /* Partition constraint, if not the root */ + List *partition_qual; + + /* + * Array of RelOptInfos of partitions, stored in the same order as bounds + * (don't print, too bulky and duplicative) + */ + struct RelOptInfo **part_rels pg_node_attr(read_write_ignore); + + /* + * Bitmap with members acting as indexes into the part_rels[] array to + * indicate which partitions survived partition pruning. + */ + Bitmapset *live_parts; + /* Relids set of all partition relids */ + Relids all_partrels; + + /* + * These arrays are of length partkey->partnatts, which we don't have at + * hand, so don't try to print + */ + + /* Non-nullable partition key expressions */ + List **partexprs pg_node_attr(read_write_ignore); + /* Nullable partition key expressions */ + List **nullable_partexprs pg_node_attr(read_write_ignore); +} RelOptInfo; + +/* + * Is given relation partitioned? + * + * It's not enough to test whether rel->part_scheme is set, because it might + * be that the basic partitioning properties of the input relations matched + * but the partition bounds did not. Also, if we are able to prove a rel + * dummy (empty), we should henceforth treat it as unpartitioned. + */ +#define IS_PARTITIONED_REL(rel) \ + ((rel)->part_scheme && (rel)->boundinfo && (rel)->nparts > 0 && \ + (rel)->part_rels && !IS_DUMMY_REL(rel)) + +/* + * Convenience macro to make sure that a partitioned relation has all the + * required members set. + */ +#define REL_HAS_ALL_PART_PROPS(rel) \ + ((rel)->part_scheme && (rel)->boundinfo && (rel)->nparts > 0 && \ + (rel)->part_rels && (rel)->partexprs && (rel)->nullable_partexprs) + +/* + * IndexOptInfo + * Per-index information for planning/optimization + * + * indexkeys[] and canreturn[] each have ncolumns entries. + * + * indexcollations[], opfamily[], and opcintype[] each have nkeycolumns + * entries. These don't contain any information about INCLUDE columns. + * + * sortopfamily[], reverse_sort[], and nulls_first[] have + * nkeycolumns entries, if the index is ordered; but if it is unordered, + * those pointers are NULL. + * + * Zeroes in the indexkeys[] array indicate index columns that are + * expressions; there is one element in indexprs for each such column. + * + * For an ordered index, reverse_sort[] and nulls_first[] describe the + * sort ordering of a forward indexscan; we can also consider a backward + * indexscan, which will generate the reverse ordering. + * + * The indexprs and indpred expressions have been run through + * prepqual.c and eval_const_expressions() for ease of matching to + * WHERE clauses. indpred is in implicit-AND form. + * + * indextlist is a TargetEntry list representing the index columns. + * It provides an equivalent base-relation Var for each simple column, + * and links to the matching indexprs element for each expression column. + * + * While most of these fields are filled when the IndexOptInfo is created + * (by plancat.c), indrestrictinfo and predOK are set later, in + * check_index_predicates(). + */ +#ifndef HAVE_INDEXOPTINFO_TYPEDEF +typedef struct IndexOptInfo IndexOptInfo; +#define HAVE_INDEXOPTINFO_TYPEDEF 1 +#endif + +struct IndexPath; /* forward declaration */ + +struct IndexOptInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* OID of the index relation */ + Oid indexoid; + /* tablespace of index (not table) */ + Oid reltablespace; + /* back-link to index's table; don't print, else infinite recursion */ + RelOptInfo *rel pg_node_attr(read_write_ignore); + + /* + * index-size statistics (from pg_class and elsewhere) + */ + /* number of disk pages in index */ + BlockNumber pages; + /* number of index tuples in index */ + Cardinality tuples; + /* index tree height, or -1 if unknown */ + int tree_height; + + /* + * index descriptor information + */ + /* number of columns in index */ + int ncolumns; + /* number of key columns in index */ + int nkeycolumns; + + /* + * table column numbers of index's columns (both key and included + * columns), or 0 for expression columns + */ + int *indexkeys pg_node_attr(array_size(ncolumns)); + /* OIDs of collations of index columns */ + Oid *indexcollations pg_node_attr(array_size(nkeycolumns)); + /* OIDs of operator families for columns */ + Oid *opfamily pg_node_attr(array_size(nkeycolumns)); + /* OIDs of opclass declared input data types */ + Oid *opcintype pg_node_attr(array_size(nkeycolumns)); + /* OIDs of btree opfamilies, if orderable. NULL if partitioned index */ + Oid *sortopfamily pg_node_attr(array_size(nkeycolumns)); + /* is sort order descending? or NULL if partitioned index */ + bool *reverse_sort pg_node_attr(array_size(nkeycolumns)); + /* do NULLs come first in the sort order? or NULL if partitioned index */ + bool *nulls_first pg_node_attr(array_size(nkeycolumns)); + /* opclass-specific options for columns */ + bytea **opclassoptions pg_node_attr(read_write_ignore); + /* which index cols can be returned in an index-only scan? */ + bool *canreturn pg_node_attr(array_size(ncolumns)); + /* OID of the access method (in pg_am) */ + Oid relam; + + /* + * expressions for non-simple index columns; redundant to print since we + * print indextlist + */ + List *indexprs pg_node_attr(read_write_ignore); + /* predicate if a partial index, else NIL */ + List *indpred; + + /* targetlist representing index columns */ + List *indextlist; + + /* + * parent relation's baserestrictinfo list, less any conditions implied by + * the index's predicate (unless it's a target rel, see comments in + * check_index_predicates()) + */ + List *indrestrictinfo; + + /* true if index predicate matches query */ + bool predOK; + /* true if a unique index */ + bool unique; + /* true if the index was defined with NULLS NOT DISTINCT */ + bool nullsnotdistinct; + /* is uniqueness enforced immediately? */ + bool immediate; + /* true if index doesn't really exist */ + bool hypothetical; + + /* + * Remaining fields are copied from the index AM's API struct + * (IndexAmRoutine). These fields are not set for partitioned indexes. + */ + bool amcanorderbyop; + bool amoptionalkey; + bool amsearcharray; + bool amsearchnulls; + /* does AM have amgettuple interface? */ + bool amhasgettuple; + /* does AM have amgetbitmap interface? */ + bool amhasgetbitmap; + bool amcanparallel; + /* does AM have ammarkpos interface? */ + bool amcanmarkpos; + /* AM's cost estimator */ + /* Rather than include amapi.h here, we declare amcostestimate like this */ + void (*amcostestimate) (struct PlannerInfo *, struct IndexPath *, double, Cost *, Cost *, Selectivity *, double *, double *) pg_node_attr(read_write_ignore); +}; + +/* + * ForeignKeyOptInfo + * Per-foreign-key information for planning/optimization + * + * The per-FK-column arrays can be fixed-size because we allow at most + * INDEX_MAX_KEYS columns in a foreign key constraint. Each array has + * nkeys valid entries. + */ +typedef struct ForeignKeyOptInfo +{ + pg_node_attr(custom_read_write, no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* + * Basic data about the foreign key (fetched from catalogs): + */ + + /* RT index of the referencing table */ + Index con_relid; + /* RT index of the referenced table */ + Index ref_relid; + /* number of columns in the foreign key */ + int nkeys; + /* cols in referencing table */ + AttrNumber conkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + /* cols in referenced table */ + AttrNumber confkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + /* PK = FK operator OIDs */ + Oid conpfeqop[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + + /* + * Derived info about whether FK's equality conditions match the query: + */ + + /* # of FK cols matched by ECs */ + int nmatched_ec; + /* # of these ECs that are ec_has_const */ + int nconst_ec; + /* # of FK cols matched by non-EC rinfos */ + int nmatched_rcols; + /* total # of non-EC rinfos matched to FK */ + int nmatched_ri; + /* Pointer to eclass matching each column's condition, if there is one */ + struct EquivalenceClass *eclass[INDEX_MAX_KEYS]; + /* Pointer to eclass member for the referencing Var, if there is one */ + struct EquivalenceMember *fk_eclass_member[INDEX_MAX_KEYS]; + /* List of non-EC RestrictInfos matching each column's condition */ + List *rinfos[INDEX_MAX_KEYS]; +} ForeignKeyOptInfo; + +/* + * StatisticExtInfo + * Information about extended statistics for planning/optimization + * + * Each pg_statistic_ext row is represented by one or more nodes of this + * type, or even zero if ANALYZE has not computed them. + */ +typedef struct StatisticExtInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* OID of the statistics row */ + Oid statOid; + + /* includes child relations */ + bool inherit; + + /* back-link to statistic's table; don't print, else infinite recursion */ + RelOptInfo *rel pg_node_attr(read_write_ignore); + + /* statistics kind of this entry */ + char kind; + + /* attnums of the columns covered */ + Bitmapset *keys; + + /* expressions */ + List *exprs; +} StatisticExtInfo; + +/* + * JoinDomains + * + * A "join domain" defines the scope of applicability of deductions made via + * the EquivalenceClass mechanism. Roughly speaking, a join domain is a set + * of base+OJ relations that are inner-joined together. More precisely, it is + * the set of relations at which equalities deduced from an EquivalenceClass + * can be enforced or should be expected to hold. The topmost JoinDomain + * covers the whole query (so its jd_relids should equal all_query_rels). + * An outer join creates a new JoinDomain that includes all base+OJ relids + * within its nullable side, but (by convention) not the OJ's own relid. + * A FULL join creates two new JoinDomains, one for each side. + * + * Notice that a rel that is below outer join(s) will thus appear to belong + * to multiple join domains. However, any of its Vars that appear in + * EquivalenceClasses belonging to higher join domains will have nullingrel + * bits preventing them from being evaluated at the rel's scan level, so that + * we will not be able to derive enforceable-at-the-rel-scan-level clauses + * from such ECs. We define the join domain relid sets this way so that + * domains can be said to be "higher" or "lower" when one domain relid set + * includes another. + * + * The JoinDomains for a query are computed in deconstruct_jointree. + * We do not copy JoinDomain structs once made, so they can be compared + * for equality by simple pointer equality. + */ +typedef struct JoinDomain +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Relids jd_relids; /* all relids contained within the domain */ +} JoinDomain; + +/* + * EquivalenceClasses + * + * Whenever we identify a mergejoinable equality clause A = B that is + * not an outer-join clause, we create an EquivalenceClass containing + * the expressions A and B to record this knowledge. If we later find another + * equivalence B = C, we add C to the existing EquivalenceClass; this may + * require merging two existing EquivalenceClasses. At the end of the qual + * distribution process, we have sets of values that are known all transitively + * equal to each other, where "equal" is according to the rules of the btree + * operator family(s) shown in ec_opfamilies, as well as the collation shown + * by ec_collation. (We restrict an EC to contain only equalities whose + * operators belong to the same set of opfamilies. This could probably be + * relaxed, but for now it's not worth the trouble, since nearly all equality + * operators belong to only one btree opclass anyway. Similarly, we suppose + * that all or none of the input datatypes are collatable, so that a single + * collation value is sufficient.) + * + * Strictly speaking, deductions from an EquivalenceClass hold only within + * a "join domain", that is a set of relations that are innerjoined together + * (see JoinDomain above). For the most part we don't need to account for + * this explicitly, because equality clauses from different join domains + * will contain Vars that are not equal() because they have different + * nullingrel sets, and thus we will never falsely merge ECs from different + * join domains. But Var-free (pseudoconstant) expressions lack that safety + * feature. We handle that by marking "const" EC members with the JoinDomain + * of the clause they came from; two nominally-equal const members will be + * considered different if they came from different JoinDomains. This ensures + * no false EquivalenceClass merges will occur. + * + * We also use EquivalenceClasses as the base structure for PathKeys, letting + * us represent knowledge about different sort orderings being equivalent. + * Since every PathKey must reference an EquivalenceClass, we will end up + * with single-member EquivalenceClasses whenever a sort key expression has + * not been equivalenced to anything else. It is also possible that such an + * EquivalenceClass will contain a volatile expression ("ORDER BY random()"), + * which is a case that can't arise otherwise since clauses containing + * volatile functions are never considered mergejoinable. We mark such + * EquivalenceClasses specially to prevent them from being merged with + * ordinary EquivalenceClasses. Also, for volatile expressions we have + * to be careful to match the EquivalenceClass to the correct targetlist + * entry: consider SELECT random() AS a, random() AS b ... ORDER BY b,a. + * So we record the SortGroupRef of the originating sort clause. + * + * Derived equality clauses are stored in ec_derives_list. For small queries, + * this list is scanned directly during lookup. For larger queries -- e.g., + * with many partitions or joins -- a hash table (ec_derives_hash) is built + * when the list grows beyond a threshold, for faster lookup. When present, + * the hash table contains the same RestrictInfos and is maintained alongside + * the list. We retain the list even when the hash is used to simplify + * serialization (e.g., in _outEquivalenceClass()) and support + * EquivalenceClass merging. + * + * In contrast, ec_sources holds equality clauses that appear directly in the + * query. These are typically few and do not require a hash table for lookup. + * + * 'ec_members' is a List of all !em_is_child EquivalenceMembers in the class. + * EquivalenceMembers for any RELOPT_OTHER_MEMBER_REL and RELOPT_OTHER_JOINREL + * relations are stored in the 'ec_childmembers' array in the index + * corresponding to the relid, or first component relid in the case of + * RELOPT_OTHER_JOINRELs. 'ec_childmembers' is NULL if the class has no child + * EquivalenceMembers. + * + * For code wishing to look at EquivalenceMembers, if only parent-level + * members are needed, then a simple foreach loop over ec_members is + * sufficient. When child members are also required, it is best to use the + * functionality provided by EquivalenceMemberIterator. This visits all + * parent members and only the relevant child members. The reason for this + * is that large numbers of child EquivalenceMembers can exist in queries to + * partitioned tables with many partitions. The functionality provided by + * EquivalenceMemberIterator allows efficient access to EquivalenceMembers + * which belong to specific child relids. See the header comments for + * EquivalenceMemberIterator below for further details. + * + * NB: if ec_merged isn't NULL, this class has been merged into another, and + * should be ignored in favor of using the pointed-to class. + * + * NB: EquivalenceClasses are never copied after creation. Therefore, + * copyObject() copies pointers to them as pointers, and equal() compares + * pointers to EquivalenceClasses via pointer equality. This is implemented + * by putting copy_as_scalar and equal_as_scalar attributes on fields that + * are pointers to EquivalenceClasses. The same goes for EquivalenceMembers. + */ +typedef struct EquivalenceClass +{ + pg_node_attr(custom_read_write, no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + List *ec_opfamilies; /* btree operator family OIDs */ + Oid ec_collation; /* collation, if datatypes are collatable */ + int ec_childmembers_size; /* # elements in ec_childmembers */ + List *ec_members; /* list of EquivalenceMembers */ + List **ec_childmembers; /* array of Lists of child members */ + List *ec_sources; /* list of generating RestrictInfos */ + List *ec_derives_list; /* list of derived RestrictInfos */ + struct derives_hash *ec_derives_hash; /* optional hash table for fast + * lookup; contains same + * RestrictInfos as list */ + Relids ec_relids; /* all relids appearing in ec_members, except + * for child members (see below) */ + bool ec_has_const; /* any pseudoconstants in ec_members? */ + bool ec_has_volatile; /* the (sole) member is a volatile expr */ + bool ec_broken; /* failed to generate needed clauses? */ + Index ec_sortref; /* originating sortclause label, or 0 */ + Index ec_min_security; /* minimum security_level in ec_sources */ + Index ec_max_security; /* maximum security_level in ec_sources */ + struct EquivalenceClass *ec_merged; /* set if merged into another EC */ +} EquivalenceClass; + +/* + * If an EC contains a constant, any PathKey depending on it must be + * redundant, since there's only one possible value of the key. + */ +#define EC_MUST_BE_REDUNDANT(eclass) \ + ((eclass)->ec_has_const) + +/* + * EquivalenceMember - one member expression of an EquivalenceClass + * + * em_is_child signifies that this element was built by transposing a member + * for an appendrel parent relation to represent the corresponding expression + * for an appendrel child. These members are used for determining the + * pathkeys of scans on the child relation and for explicitly sorting the + * child when necessary to build a MergeAppend path for the whole appendrel + * tree. An em_is_child member has no impact on the properties of the EC as a + * whole; in particular the EC's ec_relids field does NOT include the child + * relation. em_is_child members aren't stored in the ec_members List of the + * EC and instead they're stored and indexed by the relids of the child + * relation they represent in ec_childmembers. An em_is_child member + * should never be marked em_is_const nor cause ec_has_const or + * ec_has_volatile to be set, either. Thus, em_is_child members are not + * really full-fledged members of the EC, but just reflections or + * doppelgangers of real members. Most operations on EquivalenceClasses + * should ignore em_is_child members by only inspecting members in the + * ec_members list. Callers that require inspecting child members should do + * so using an EquivalenceMemberIterator and should test em_relids to make + * sure they only consider relevant members. + * + * em_datatype is usually the same as exprType(em_expr), but can be + * different when dealing with a binary-compatible opfamily; in particular + * anyarray_ops would never work without this. Use em_datatype when + * looking up a specific btree operator to work with this expression. + */ +typedef struct EquivalenceMember +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Expr *em_expr; /* the expression represented */ + Relids em_relids; /* all relids appearing in em_expr */ + bool em_is_const; /* expression is pseudoconstant? */ + bool em_is_child; /* derived version for a child relation? */ + Oid em_datatype; /* the "nominal type" used by the opfamily */ + JoinDomain *em_jdomain; /* join domain containing the source clause */ + /* if em_is_child is true, this links to corresponding EM for top parent */ + struct EquivalenceMember *em_parent pg_node_attr(read_write_ignore); +} EquivalenceMember; + +/* + * EquivalenceMemberIterator + * + * EquivalenceMemberIterator allows efficient access to sets of + * EquivalenceMembers for callers which require access to child members. + * Because partitioning workloads can result in large numbers of child + * members, the child members are not stored in the EquivalenceClass's + * ec_members List. Instead, these are stored in the EquivalenceClass's + * ec_childmembers array of Lists. The functionality provided by + * EquivalenceMemberIterator aims to provide efficient access to parent + * members and child members belonging to specific child relids. + * + * Currently, there is only one way to initialize and iterate over an + * EquivalenceMemberIterator and that is via the setup_eclass_member_iterator + * and eclass_member_iterator_next functions. The iterator object is + * generally a local variable which is passed by address to + * setup_eclass_member_iterator. The calling function defines which + * EquivalenceClass the iterator should be looking at and which child + * relids to also return members for. child_relids can be passed as NULL, but + * the caller may as well just perform a foreach loop over ec_members as only + * parent-level members will be returned in that case. + * + * When calling the next function on an EquivalenceMemberIterator, all + * parent-level EquivalenceMembers are returned first, followed by all child + * members for the specified 'child_relids' for all child members which were + * indexed by any of the specified 'child_relids' in add_child_eq_member(). + * + * Code using the iterator method of finding EquivalenceMembers will generally + * always want to ensure the returned member matches their search criteria + * rather than relying on the filtering to be done for them as all parent + * members are returned and for members belonging to RELOPT_OTHER_JOINREL + * rels, the member's em_relids may be a superset of the specified + * 'child_relids', which might not be what the caller wants. + * + * The most common way to use this iterator is as follows: + * ----- + * EquivalenceMemberIterator it; + * EquivalenceMember *em; + * + * setup_eclass_member_iterator(&it, ec, child_relids); + * while ((em = eclass_member_iterator_next(&it)) != NULL) + * { + * ... + * } + * ----- + * It is not valid to call eclass_member_iterator_next() after it has returned + * NULL for any given EquivalenceMemberIterator. Individual fields within + * the EquivalenceMemberIterator struct must not be accessed by callers. + */ +typedef struct +{ + EquivalenceClass *ec; /* The EquivalenceClass to iterate over */ + int current_relid; /* Current relid position within 'relids'. -1 + * when still looping over ec_members and -2 + * at the end of iteration */ + Relids child_relids; /* Relids of child relations of interest. + * Non-child rels are ignored */ + ListCell *current_cell; /* Next cell to return within current_list */ + List *current_list; /* Current list of members being returned */ +} EquivalenceMemberIterator; + +/* + * PathKeys + * + * The sort ordering of a path is represented by a list of PathKey nodes. + * An empty list implies no known ordering. Otherwise the first item + * represents the primary sort key, the second the first secondary sort key, + * etc. The value being sorted is represented by linking to an + * EquivalenceClass containing that value and including pk_opfamily among its + * ec_opfamilies. The EquivalenceClass tells which collation to use, too. + * This is a convenient method because it makes it trivial to detect + * equivalent and closely-related orderings. (See optimizer/README for more + * information.) + * + * Note: pk_cmptype is either COMPARE_LT (for ASC) or COMPARE_GT (for DESC). + */ +typedef struct PathKey +{ + pg_node_attr(no_read, no_query_jumble) + + NodeTag type; + + /* the value that is ordered */ + EquivalenceClass *pk_eclass pg_node_attr(copy_as_scalar, equal_as_scalar); + Oid pk_opfamily; /* index opfamily defining the ordering */ + CompareType pk_cmptype; /* sort direction (ASC or DESC) */ + bool pk_nulls_first; /* do NULLs come before normal values? */ +} PathKey; + +/* + * Contains an order of group-by clauses and the corresponding list of + * pathkeys. + * + * The elements of 'clauses' list should have the same order as the head of + * 'pathkeys' list. The tleSortGroupRef of the clause should be equal to + * ec_sortref of the pathkey equivalence class. If there are redundant + * clauses with the same tleSortGroupRef, they must be grouped together. + */ +typedef struct GroupByOrdering +{ + NodeTag type; + + List *pathkeys; + List *clauses; +} GroupByOrdering; + +/* + * VolatileFunctionStatus -- allows nodes to cache their + * contain_volatile_functions properties. VOLATILITY_UNKNOWN means not yet + * determined. + */ +typedef enum VolatileFunctionStatus +{ + VOLATILITY_UNKNOWN = 0, + VOLATILITY_VOLATILE, + VOLATILITY_NOVOLATILE, +} VolatileFunctionStatus; + +/* + * PathTarget + * + * This struct contains what we need to know during planning about the + * targetlist (output columns) that a Path will compute. Each RelOptInfo + * includes a default PathTarget, which its individual Paths may simply + * reference. However, in some cases a Path may compute outputs different + * from other Paths, and in that case we make a custom PathTarget for it. + * For example, an indexscan might return index expressions that would + * otherwise need to be explicitly calculated. (Note also that "upper" + * relations generally don't have useful default PathTargets.) + * + * exprs contains bare expressions; they do not have TargetEntry nodes on top, + * though those will appear in finished Plans. + * + * sortgrouprefs[] is an array of the same length as exprs, containing the + * corresponding sort/group refnos, or zeroes for expressions not referenced + * by sort/group clauses. If sortgrouprefs is NULL (which it generally is in + * RelOptInfo.reltarget targets; only upper-level Paths contain this info), + * we have not identified sort/group columns in this tlist. This allows us to + * deal with sort/group refnos when needed with less expense than including + * TargetEntry nodes in the exprs list. + */ +typedef struct PathTarget +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* list of expressions to be computed */ + List *exprs; + + /* corresponding sort/group refnos, or 0 */ + Index *sortgrouprefs pg_node_attr(array_size(exprs)); + + /* cost of evaluating the expressions */ + QualCost cost; + + /* estimated avg width of result tuples */ + int width; + + /* indicates if exprs contain any volatile functions */ + VolatileFunctionStatus has_volatile_expr; +} PathTarget; + +/* Convenience macro to get a sort/group refno from a PathTarget */ +#define get_pathtarget_sortgroupref(target, colno) \ + ((target)->sortgrouprefs ? (target)->sortgrouprefs[colno] : (Index) 0) + + +/* + * ParamPathInfo + * + * All parameterized paths for a given relation with given required outer rels + * link to a single ParamPathInfo, which stores common information such as + * the estimated rowcount for this parameterization. We do this partly to + * avoid recalculations, but mostly to ensure that the estimated rowcount + * is in fact the same for every such path. + * + * Note: ppi_clauses is only used in ParamPathInfos for base relation paths; + * in join cases it's NIL because the set of relevant clauses varies depending + * on how the join is formed. The relevant clauses will appear in each + * parameterized join path's joinrestrictinfo list, instead. ParamPathInfos + * for append relations don't bother with this, either. + * + * ppi_serials is the set of rinfo_serial numbers for quals that are enforced + * by this path. As with ppi_clauses, it's only maintained for baserels. + * (We could construct it on-the-fly from ppi_clauses, but it seems better + * to materialize a copy.) + */ +typedef struct ParamPathInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Relids ppi_req_outer; /* rels supplying parameters used by path */ + Cardinality ppi_rows; /* estimated number of result tuples */ + List *ppi_clauses; /* join clauses available from outer rels */ + Bitmapset *ppi_serials; /* set of rinfo_serial for enforced quals */ +} ParamPathInfo; + + +/* + * Type "Path" is used as-is for sequential-scan paths, as well as some other + * simple plan types that we don't need any extra information in the path for. + * For other path types it is the first component of a larger struct. + * + * "pathtype" is the NodeTag of the Plan node we could build from this Path. + * It is partially redundant with the Path's NodeTag, but allows us to use + * the same Path type for multiple Plan types when there is no need to + * distinguish the Plan type during path processing. + * + * "parent" identifies the relation this Path scans, and "pathtarget" + * describes the precise set of output columns the Path would compute. + * In simple cases all Paths for a given rel share the same targetlist, + * which we represent by having path->pathtarget equal to parent->reltarget. + * + * "param_info", if not NULL, links to a ParamPathInfo that identifies outer + * relation(s) that provide parameter values to each scan of this path. + * That means this path can only be joined to those rels by means of nestloop + * joins with this path on the inside. Also note that a parameterized path + * is responsible for testing all "movable" joinclauses involving this rel + * and the specified outer rel(s). + * + * "rows" is the same as parent->rows in simple paths, but in parameterized + * paths and UniquePaths it can be less than parent->rows, reflecting the + * fact that we've filtered by extra join conditions or removed duplicates. + * + * "pathkeys" is a List of PathKey nodes (see above), describing the sort + * ordering of the path's output rows. + * + * We do not support copying Path trees, mainly because the circular linkages + * between RelOptInfo and Path nodes can't be handled easily in a simple + * depth-first traversal. We also don't have read support at the moment. + */ +typedef struct Path +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* tag identifying scan/join method */ + NodeTag pathtype; + + /* + * the relation this path can build + * + * We do NOT print the parent, else we'd be in infinite recursion. We can + * print the parent's relids for identification purposes, though. + */ + RelOptInfo *parent pg_node_attr(write_only_relids); + + /* + * list of Vars/Exprs, cost, width + * + * We print the pathtarget only if it's not the default one for the rel. + */ + PathTarget *pathtarget pg_node_attr(write_only_nondefault_pathtarget); + + /* + * parameterization info, or NULL if none + * + * We do not print the whole of param_info, since it's printed via + * RelOptInfo; it's sufficient and less cluttering to print just the + * required outer relids. + */ + ParamPathInfo *param_info pg_node_attr(write_only_req_outer); + + /* engage parallel-aware logic? */ + bool parallel_aware; + /* OK to use as part of parallel plan? */ + bool parallel_safe; + /* desired # of workers; 0 = not parallel */ + int parallel_workers; + + /* estimated size/costs for path (see costsize.c for more info) */ + Cardinality rows; /* estimated number of result tuples */ + int disabled_nodes; /* count of disabled nodes */ + Cost startup_cost; /* cost expended before fetching any tuples */ + Cost total_cost; /* total cost (assuming all tuples fetched) */ + + /* sort ordering of path's output; a List of PathKey nodes; see above */ + List *pathkeys; +} Path; + +/* Macro for extracting a path's parameterization relids; beware double eval */ +#define PATH_REQ_OUTER(path) \ + ((path)->param_info ? (path)->param_info->ppi_req_outer : (Relids) NULL) + +/*---------- + * IndexPath represents an index scan over a single index. + * + * This struct is used for both regular indexscans and index-only scans; + * path.pathtype is T_IndexScan or T_IndexOnlyScan to show which is meant. + * + * 'indexinfo' is the index to be scanned. + * + * 'indexclauses' is a list of IndexClause nodes, each representing one + * index-checkable restriction, with implicit AND semantics across the list. + * An empty list implies a full index scan. + * + * 'indexorderbys', if not NIL, is a list of ORDER BY expressions that have + * been found to be usable as ordering operators for an amcanorderbyop index. + * The list must match the path's pathkeys, ie, one expression per pathkey + * in the same order. These are not RestrictInfos, just bare expressions, + * since they generally won't yield booleans. It's guaranteed that each + * expression has the index key on the left side of the operator. + * + * 'indexorderbycols' is an integer list of index column numbers (zero-based) + * of the same length as 'indexorderbys', showing which index column each + * ORDER BY expression is meant to be used with. (There is no restriction + * on which index column each ORDER BY can be used with.) + * + * 'indexscandir' is one of: + * ForwardScanDirection: forward scan of an index + * BackwardScanDirection: backward scan of an ordered index + * Unordered indexes will always have an indexscandir of ForwardScanDirection. + * + * 'indextotalcost' and 'indexselectivity' are saved in the IndexPath so that + * we need not recompute them when considering using the same index in a + * bitmap index/heap scan (see BitmapHeapPath). The costs of the IndexPath + * itself represent the costs of an IndexScan or IndexOnlyScan plan type. + *---------- + */ +typedef struct IndexPath +{ + Path path; + IndexOptInfo *indexinfo; + List *indexclauses; + List *indexorderbys; + List *indexorderbycols; + ScanDirection indexscandir; + Cost indextotalcost; + Selectivity indexselectivity; +} IndexPath; + +/* + * Each IndexClause references a RestrictInfo node from the query's WHERE + * or JOIN conditions, and shows how that restriction can be applied to + * the particular index. We support both indexclauses that are directly + * usable by the index machinery, which are typically of the form + * "indexcol OP pseudoconstant", and those from which an indexable qual + * can be derived. The simplest such transformation is that a clause + * of the form "pseudoconstant OP indexcol" can be commuted to produce an + * indexable qual (the index machinery expects the indexcol to be on the + * left always). Another example is that we might be able to extract an + * indexable range condition from a LIKE condition, as in "x LIKE 'foo%bar'" + * giving rise to "x >= 'foo' AND x < 'fop'". Derivation of such lossy + * conditions is done by a planner support function attached to the + * indexclause's top-level function or operator. + * + * indexquals is a list of RestrictInfos for the directly-usable index + * conditions associated with this IndexClause. In the simplest case + * it's a one-element list whose member is iclause->rinfo. Otherwise, + * it contains one or more directly-usable indexqual conditions extracted + * from the given clause. The 'lossy' flag indicates whether the + * indexquals are semantically equivalent to the original clause, or + * represent a weaker condition. + * + * Normally, indexcol is the index of the single index column the clause + * works on, and indexcols is NIL. But if the clause is a RowCompareExpr, + * indexcol is the index of the leading column, and indexcols is a list of + * all the affected columns. (Note that indexcols matches up with the + * columns of the actual indexable RowCompareExpr in indexquals, which + * might be different from the original in rinfo.) + * + * An IndexPath's IndexClause list is required to be ordered by index + * column, i.e. the indexcol values must form a nondecreasing sequence. + * (The order of multiple clauses for the same index column is unspecified.) + */ +typedef struct IndexClause +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + struct RestrictInfo *rinfo; /* original restriction or join clause */ + List *indexquals; /* indexqual(s) derived from it */ + bool lossy; /* are indexquals a lossy version of clause? */ + AttrNumber indexcol; /* index column the clause uses (zero-based) */ + List *indexcols; /* multiple index columns, if RowCompare */ +} IndexClause; + +/* + * BitmapHeapPath represents one or more indexscans that generate TID bitmaps + * instead of directly accessing the heap, followed by AND/OR combinations + * to produce a single bitmap, followed by a heap scan that uses the bitmap. + * Note that the output is always considered unordered, since it will come + * out in physical heap order no matter what the underlying indexes did. + * + * The individual indexscans are represented by IndexPath nodes, and any + * logic on top of them is represented by a tree of BitmapAndPath and + * BitmapOrPath nodes. Notice that we can use the same IndexPath node both + * to represent a regular (or index-only) index scan plan, and as the child + * of a BitmapHeapPath that represents scanning the same index using a + * BitmapIndexScan. The startup_cost and total_cost figures of an IndexPath + * always represent the costs to use it as a regular (or index-only) + * IndexScan. The costs of a BitmapIndexScan can be computed using the + * IndexPath's indextotalcost and indexselectivity. + */ +typedef struct BitmapHeapPath +{ + Path path; + Path *bitmapqual; /* IndexPath, BitmapAndPath, BitmapOrPath */ +} BitmapHeapPath; + +/* + * BitmapAndPath represents a BitmapAnd plan node; it can only appear as + * part of the substructure of a BitmapHeapPath. The Path structure is + * a bit more heavyweight than we really need for this, but for simplicity + * we make it a derivative of Path anyway. + */ +typedef struct BitmapAndPath +{ + Path path; + List *bitmapquals; /* IndexPaths and BitmapOrPaths */ + Selectivity bitmapselectivity; +} BitmapAndPath; + +/* + * BitmapOrPath represents a BitmapOr plan node; it can only appear as + * part of the substructure of a BitmapHeapPath. The Path structure is + * a bit more heavyweight than we really need for this, but for simplicity + * we make it a derivative of Path anyway. + */ +typedef struct BitmapOrPath +{ + Path path; + List *bitmapquals; /* IndexPaths and BitmapAndPaths */ + Selectivity bitmapselectivity; +} BitmapOrPath; + +/* + * TidPath represents a scan by TID + * + * tidquals is an implicitly OR'ed list of qual expressions of the form + * "CTID = pseudoconstant", or "CTID = ANY(pseudoconstant_array)", + * or a CurrentOfExpr for the relation. + */ +typedef struct TidPath +{ + Path path; + List *tidquals; /* qual(s) involving CTID = something */ +} TidPath; + +/* + * TidRangePath represents a scan by a contiguous range of TIDs + * + * tidrangequals is an implicitly AND'ed list of qual expressions of the form + * "CTID relop pseudoconstant", where relop is one of >,>=,<,<=. + */ +typedef struct TidRangePath +{ + Path path; + List *tidrangequals; +} TidRangePath; + +/* + * SubqueryScanPath represents a scan of an unflattened subquery-in-FROM + * + * Note that the subpath comes from a different planning domain; for example + * RTE indexes within it mean something different from those known to the + * SubqueryScanPath. path.parent->subroot is the planning context needed to + * interpret the subpath. + */ +typedef struct SubqueryScanPath +{ + Path path; + Path *subpath; /* path representing subquery execution */ +} SubqueryScanPath; + +/* + * ForeignPath represents a potential scan of a foreign table, foreign join + * or foreign upper-relation. + * + * In the case of a foreign join, fdw_restrictinfo stores the RestrictInfos to + * apply to the join, which are used by createplan.c to get pseudoconstant + * clauses evaluated as one-time quals in a gating Result plan node. + * + * fdw_private stores FDW private data about the scan. While fdw_private is + * not actually touched by the core code during normal operations, it's + * generally a good idea to use a representation that can be dumped by + * nodeToString(), so that you can examine the structure during debugging + * with tools like pprint(). + */ +typedef struct ForeignPath +{ + Path path; + Path *fdw_outerpath; + List *fdw_restrictinfo; + List *fdw_private; +} ForeignPath; + +/* + * CustomPath represents a table scan or a table join done by some out-of-core + * extension. + * + * We provide a set of hooks here - which the provider must take care to set + * up correctly - to allow extensions to supply their own methods of scanning + * a relation or join relations. For example, a provider might provide GPU + * acceleration, a cache-based scan, or some other kind of logic we haven't + * dreamed up yet. + * + * CustomPaths can be injected into the planning process for a base or join + * relation by set_rel_pathlist_hook or set_join_pathlist_hook functions, + * respectively. + * + * In the case of a table join, custom_restrictinfo stores the RestrictInfos + * to apply to the join, which are used by createplan.c to get pseudoconstant + * clauses evaluated as one-time quals in a gating Result plan node. + * + * Core code must avoid assuming that the CustomPath is only as large as + * the structure declared here; providers are allowed to make it the first + * element in a larger structure. (Since the planner never copies Paths, + * this doesn't add any complication.) However, for consistency with the + * FDW case, we provide a "custom_private" field in CustomPath; providers + * may prefer to use that rather than define another struct type. + */ + +struct CustomPathMethods; + +typedef struct CustomPath +{ + Path path; + uint32 flags; /* mask of CUSTOMPATH_* flags, see + * nodes/extensible.h */ + List *custom_paths; /* list of child Path nodes, if any */ + List *custom_restrictinfo; + List *custom_private; + const struct CustomPathMethods *methods; +} CustomPath; + +/* + * AppendPath represents an Append plan, ie, successive execution of + * several member plans. + * + * For partial Append, 'subpaths' contains non-partial subpaths followed by + * partial subpaths. + * + * Note: it is possible for "subpaths" to contain only one, or even no, + * elements. These cases are optimized during create_append_plan. + * In particular, an AppendPath with no subpaths is a "dummy" path that + * is created to represent the case that a relation is provably empty. + * (This is a convenient representation because it means that when we build + * an appendrel and find that all its children have been excluded, no extra + * action is needed to recognize the relation as dummy.) + */ +typedef struct AppendPath +{ + Path path; + List *subpaths; /* list of component Paths */ + /* Index of first partial path in subpaths; list_length(subpaths) if none */ + int first_partial_path; + Cardinality limit_tuples; /* hard limit on output tuples, or -1 */ +} AppendPath; + +#define IS_DUMMY_APPEND(p) \ + (IsA((p), AppendPath) && ((AppendPath *) (p))->subpaths == NIL) + +/* + * A relation that's been proven empty will have one path that is dummy + * (but might have projection paths on top). For historical reasons, + * this is provided as a macro that wraps is_dummy_rel(). + */ +#define IS_DUMMY_REL(r) is_dummy_rel(r) +extern bool is_dummy_rel(RelOptInfo *rel); + +/* + * MergeAppendPath represents a MergeAppend plan, ie, the merging of sorted + * results from several member plans to produce similarly-sorted output. + */ +typedef struct MergeAppendPath +{ + Path path; + List *subpaths; /* list of component Paths */ + Cardinality limit_tuples; /* hard limit on output tuples, or -1 */ +} MergeAppendPath; + +/* + * GroupResultPath represents use of a Result plan node to compute the + * output of a degenerate GROUP BY case, wherein we know we should produce + * exactly one row, which might then be filtered by a HAVING qual. + * + * Note that quals is a list of bare clauses, not RestrictInfos. + */ +typedef struct GroupResultPath +{ + Path path; + List *quals; +} GroupResultPath; + +/* + * MaterialPath represents use of a Material plan node, i.e., caching of + * the output of its subpath. This is used when the subpath is expensive + * and needs to be scanned repeatedly, or when we need mark/restore ability + * and the subpath doesn't have it. + */ +typedef struct MaterialPath +{ + Path path; + Path *subpath; +} MaterialPath; + +/* + * MemoizePath represents a Memoize plan node, i.e., a cache that caches + * tuples from parameterized paths to save the underlying node from having to + * be rescanned for parameter values which are already cached. + */ +typedef struct MemoizePath +{ + Path path; + Path *subpath; /* outerpath to cache tuples from */ + List *hash_operators; /* OIDs of hash equality ops for cache keys */ + List *param_exprs; /* expressions that are cache keys */ + bool singlerow; /* true if the cache entry is to be marked as + * complete after caching the first record. */ + bool binary_mode; /* true when cache key should be compared bit + * by bit, false when using hash equality ops */ + Cardinality calls; /* expected number of rescans */ + uint32 est_entries; /* The maximum number of entries that the + * planner expects will fit in the cache, or 0 + * if unknown */ +} MemoizePath; + +/* + * UniquePath represents elimination of distinct rows from the output of + * its subpath. + * + * This can represent significantly different plans: either hash-based or + * sort-based implementation, or a no-op if the input path can be proven + * distinct already. The decision is sufficiently localized that it's not + * worth having separate Path node types. (Note: in the no-op case, we could + * eliminate the UniquePath node entirely and just return the subpath; but + * it's convenient to have a UniquePath in the path tree to signal upper-level + * routines that the input is known distinct.) + */ +typedef enum UniquePathMethod +{ + UNIQUE_PATH_NOOP, /* input is known unique already */ + UNIQUE_PATH_HASH, /* use hashing */ + UNIQUE_PATH_SORT, /* use sorting */ +} UniquePathMethod; + +typedef struct UniquePath +{ + Path path; + Path *subpath; + UniquePathMethod umethod; + List *in_operators; /* equality operators of the IN clause */ + List *uniq_exprs; /* expressions to be made unique */ +} UniquePath; + +/* + * GatherPath runs several copies of a plan in parallel and collects the + * results. The parallel leader may also execute the plan, unless the + * single_copy flag is set. + */ +typedef struct GatherPath +{ + Path path; + Path *subpath; /* path for each worker */ + bool single_copy; /* don't execute path more than once */ + int num_workers; /* number of workers sought to help */ +} GatherPath; + +/* + * GatherMergePath runs several copies of a plan in parallel and collects + * the results, preserving their common sort order. + */ +typedef struct GatherMergePath +{ + Path path; + Path *subpath; /* path for each worker */ + int num_workers; /* number of workers sought to help */ +} GatherMergePath; + + +/* + * All join-type paths share these fields. + */ + +typedef struct JoinPath +{ + pg_node_attr(abstract) + + Path path; + + JoinType jointype; + + bool inner_unique; /* each outer tuple provably matches no more + * than one inner tuple */ + + Path *outerjoinpath; /* path for the outer side of the join */ + Path *innerjoinpath; /* path for the inner side of the join */ + + List *joinrestrictinfo; /* RestrictInfos to apply to join */ + + /* + * See the notes for RelOptInfo and ParamPathInfo to understand why + * joinrestrictinfo is needed in JoinPath, and can't be merged into the + * parent RelOptInfo. + */ +} JoinPath; + +/* + * A nested-loop path needs no special fields. + */ + +typedef struct NestPath +{ + JoinPath jpath; +} NestPath; + +/* + * A mergejoin path has these fields. + * + * Unlike other path types, a MergePath node doesn't represent just a single + * run-time plan node: it can represent up to four. Aside from the MergeJoin + * node itself, there can be a Sort node for the outer input, a Sort node + * for the inner input, and/or a Material node for the inner input. We could + * represent these nodes by separate path nodes, but considering how many + * different merge paths are investigated during a complex join problem, + * it seems better to avoid unnecessary palloc overhead. + * + * path_mergeclauses lists the clauses (in the form of RestrictInfos) + * that will be used in the merge. + * + * Note that the mergeclauses are a subset of the parent relation's + * restriction-clause list. Any join clauses that are not mergejoinable + * appear only in the parent's restrict list, and must be checked by a + * qpqual at execution time. + * + * outersortkeys (resp. innersortkeys) is NIL if the outer path + * (resp. inner path) is already ordered appropriately for the + * mergejoin. If it is not NIL then it is a PathKeys list describing + * the ordering that must be created by an explicit Sort node. + * + * outer_presorted_keys is the number of presorted keys of the outer + * path that match outersortkeys. It is used to determine whether + * explicit incremental sort can be applied when outersortkeys is not + * NIL. We do not track the number of presorted keys of the inner + * path, as incremental sort currently does not support mark/restore. + * + * skip_mark_restore is true if the executor need not do mark/restore calls. + * Mark/restore overhead is usually required, but can be skipped if we know + * that the executor need find only one match per outer tuple, and that the + * mergeclauses are sufficient to identify a match. In such cases the + * executor can immediately advance the outer relation after processing a + * match, and therefore it need never back up the inner relation. + * + * materialize_inner is true if a Material node should be placed atop the + * inner input. This may appear with or without an inner Sort step. + */ + +typedef struct MergePath +{ + JoinPath jpath; + List *path_mergeclauses; /* join clauses to be used for merge */ + List *outersortkeys; /* keys for explicit sort, if any */ + List *innersortkeys; /* keys for explicit sort, if any */ + int outer_presorted_keys; /* number of presorted keys of the + * outer path */ + bool skip_mark_restore; /* can executor skip mark/restore? */ + bool materialize_inner; /* add Materialize to inner? */ +} MergePath; + +/* + * A hashjoin path has these fields. + * + * The remarks above for mergeclauses apply for hashclauses as well. + * + * Hashjoin does not care what order its inputs appear in, so we have + * no need for sortkeys. + */ + +typedef struct HashPath +{ + JoinPath jpath; + List *path_hashclauses; /* join clauses used for hashing */ + int num_batches; /* number of batches expected */ + Cardinality inner_rows_total; /* total inner rows expected */ +} HashPath; + +/* + * ProjectionPath represents a projection (that is, targetlist computation) + * + * Nominally, this path node represents using a Result plan node to do a + * projection step. However, if the input plan node supports projection, + * we can just modify its output targetlist to do the required calculations + * directly, and not need a Result. In some places in the planner we can just + * jam the desired PathTarget into the input path node (and adjust its cost + * accordingly), so we don't need a ProjectionPath. But in other places + * it's necessary to not modify the input path node, so we need a separate + * ProjectionPath node, which is marked dummy to indicate that we intend to + * assign the work to the input plan node. The estimated cost for the + * ProjectionPath node will account for whether a Result will be used or not. + */ +typedef struct ProjectionPath +{ + Path path; + Path *subpath; /* path representing input source */ + bool dummypp; /* true if no separate Result is needed */ +} ProjectionPath; + +/* + * ProjectSetPath represents evaluation of a targetlist that includes + * set-returning function(s), which will need to be implemented by a + * ProjectSet plan node. + */ +typedef struct ProjectSetPath +{ + Path path; + Path *subpath; /* path representing input source */ +} ProjectSetPath; + +/* + * SortPath represents an explicit sort step + * + * The sort keys are, by definition, the same as path.pathkeys. + * + * Note: the Sort plan node cannot project, so path.pathtarget must be the + * same as the input's pathtarget. + */ +typedef struct SortPath +{ + Path path; + Path *subpath; /* path representing input source */ +} SortPath; + +/* + * IncrementalSortPath represents an incremental sort step + * + * This is like a regular sort, except some leading key columns are assumed + * to be ordered already. + */ +typedef struct IncrementalSortPath +{ + SortPath spath; + int nPresortedCols; /* number of presorted columns */ +} IncrementalSortPath; + +/* + * GroupPath represents grouping (of presorted input) + * + * groupClause represents the columns to be grouped on; the input path + * must be at least that well sorted. + * + * We can also apply a qual to the grouped rows (equivalent of HAVING) + */ +typedef struct GroupPath +{ + Path path; + Path *subpath; /* path representing input source */ + List *groupClause; /* a list of SortGroupClause's */ + List *qual; /* quals (HAVING quals), if any */ +} GroupPath; + +/* + * UpperUniquePath represents adjacent-duplicate removal (in presorted input) + * + * The columns to be compared are the first numkeys columns of the path's + * pathkeys. The input is presumed already sorted that way. + */ +typedef struct UpperUniquePath +{ + Path path; + Path *subpath; /* path representing input source */ + int numkeys; /* number of pathkey columns to compare */ +} UpperUniquePath; + +/* + * AggPath represents generic computation of aggregate functions + * + * This may involve plain grouping (but not grouping sets), using either + * sorted or hashed grouping; for the AGG_SORTED case, the input must be + * appropriately presorted. + */ +typedef struct AggPath +{ + Path path; + Path *subpath; /* path representing input source */ + AggStrategy aggstrategy; /* basic strategy, see nodes.h */ + AggSplit aggsplit; /* agg-splitting mode, see nodes.h */ + Cardinality numGroups; /* estimated number of groups in input */ + uint64 transitionSpace; /* for pass-by-ref transition data */ + List *groupClause; /* a list of SortGroupClause's */ + List *qual; /* quals (HAVING quals), if any */ +} AggPath; + +/* + * Various annotations used for grouping sets in the planner. + */ + +typedef struct GroupingSetData +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + List *set; /* grouping set as list of sortgrouprefs */ + Cardinality numGroups; /* est. number of result groups */ +} GroupingSetData; + +typedef struct RollupData +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + List *groupClause; /* applicable subset of parse->groupClause */ + List *gsets; /* lists of integer indexes into groupClause */ + List *gsets_data; /* list of GroupingSetData */ + Cardinality numGroups; /* est. number of result groups */ + bool hashable; /* can be hashed */ + bool is_hashed; /* to be implemented as a hashagg */ +} RollupData; + +/* + * GroupingSetsPath represents a GROUPING SETS aggregation + */ + +typedef struct GroupingSetsPath +{ + Path path; + Path *subpath; /* path representing input source */ + AggStrategy aggstrategy; /* basic strategy */ + List *rollups; /* list of RollupData */ + List *qual; /* quals (HAVING quals), if any */ + uint64 transitionSpace; /* for pass-by-ref transition data */ +} GroupingSetsPath; + +/* + * MinMaxAggPath represents computation of MIN/MAX aggregates from indexes + */ +typedef struct MinMaxAggPath +{ + Path path; + List *mmaggregates; /* list of MinMaxAggInfo */ + List *quals; /* HAVING quals, if any */ +} MinMaxAggPath; + +/* + * WindowAggPath represents generic computation of window functions + */ +typedef struct WindowAggPath +{ + Path path; + Path *subpath; /* path representing input source */ + WindowClause *winclause; /* WindowClause we'll be using */ + List *qual; /* lower-level WindowAgg runconditions */ + List *runCondition; /* OpExpr List to short-circuit execution */ + bool topwindow; /* false for all apart from the WindowAgg + * that's closest to the root of the plan */ +} WindowAggPath; + +/* + * SetOpPath represents a set-operation, that is INTERSECT or EXCEPT + */ +typedef struct SetOpPath +{ + Path path; + Path *leftpath; /* paths representing input sources */ + Path *rightpath; + SetOpCmd cmd; /* what to do, see nodes.h */ + SetOpStrategy strategy; /* how to do it, see nodes.h */ + List *groupList; /* SortGroupClauses identifying target cols */ + Cardinality numGroups; /* estimated number of groups in left input */ +} SetOpPath; + +/* + * RecursiveUnionPath represents a recursive UNION node + */ +typedef struct RecursiveUnionPath +{ + Path path; + Path *leftpath; /* paths representing input sources */ + Path *rightpath; + List *distinctList; /* SortGroupClauses identifying target cols */ + int wtParam; /* ID of Param representing work table */ + Cardinality numGroups; /* estimated number of groups in input */ +} RecursiveUnionPath; + +/* + * LockRowsPath represents acquiring row locks for SELECT FOR UPDATE/SHARE + */ +typedef struct LockRowsPath +{ + Path path; + Path *subpath; /* path representing input source */ + List *rowMarks; /* a list of PlanRowMark's */ + int epqParam; /* ID of Param for EvalPlanQual re-eval */ +} LockRowsPath; + +/* + * ModifyTablePath represents performing INSERT/UPDATE/DELETE/MERGE + * + * We represent most things that will be in the ModifyTable plan node + * literally, except we have a child Path not Plan. But analysis of the + * OnConflictExpr is deferred to createplan.c, as is collection of FDW data. + */ +typedef struct ModifyTablePath +{ + Path path; + Path *subpath; /* Path producing source data */ + CmdType operation; /* INSERT, UPDATE, DELETE, or MERGE */ + bool canSetTag; /* do we set the command tag/es_processed? */ + Index nominalRelation; /* Parent RT index for use of EXPLAIN */ + Index rootRelation; /* Root RT index, if partitioned/inherited */ + bool partColsUpdated; /* some part key in hierarchy updated? */ + List *resultRelations; /* integer list of RT indexes */ + List *updateColnosLists; /* per-target-table update_colnos lists */ + List *withCheckOptionLists; /* per-target-table WCO lists */ + List *returningLists; /* per-target-table RETURNING tlists */ + List *rowMarks; /* PlanRowMarks (non-locking only) */ + OnConflictExpr *onconflict; /* ON CONFLICT clause, or NULL */ + int epqParam; /* ID of Param for EvalPlanQual re-eval */ + List *mergeActionLists; /* per-target-table lists of actions for + * MERGE */ + List *mergeJoinConditions; /* per-target-table join conditions + * for MERGE */ +} ModifyTablePath; + +/* + * LimitPath represents applying LIMIT/OFFSET restrictions + */ +typedef struct LimitPath +{ + Path path; + Path *subpath; /* path representing input source */ + Node *limitOffset; /* OFFSET parameter, or NULL if none */ + Node *limitCount; /* COUNT parameter, or NULL if none */ + LimitOption limitOption; /* FETCH FIRST with ties or exact number */ +} LimitPath; + + +/* + * Restriction clause info. + * + * We create one of these for each AND sub-clause of a restriction condition + * (WHERE or JOIN/ON clause). Since the restriction clauses are logically + * ANDed, we can use any one of them or any subset of them to filter out + * tuples, without having to evaluate the rest. The RestrictInfo node itself + * stores data used by the optimizer while choosing the best query plan. + * + * If a restriction clause references a single base relation, it will appear + * in the baserestrictinfo list of the RelOptInfo for that base rel. + * + * If a restriction clause references more than one base+OJ relation, it will + * appear in the joininfo list of every RelOptInfo that describes a strict + * subset of the relations mentioned in the clause. The joininfo lists are + * used to drive join tree building by selecting plausible join candidates. + * The clause cannot actually be applied until we have built a join rel + * containing all the relations it references, however. + * + * When we construct a join rel that includes all the relations referenced + * in a multi-relation restriction clause, we place that clause into the + * joinrestrictinfo lists of paths for the join rel, if neither left nor + * right sub-path includes all relations referenced in the clause. The clause + * will be applied at that join level, and will not propagate any further up + * the join tree. (Note: the "predicate migration" code was once intended to + * push restriction clauses up and down the plan tree based on evaluation + * costs, but it's dead code and is unlikely to be resurrected in the + * foreseeable future.) + * + * Note that in the presence of more than two rels, a multi-rel restriction + * might reach different heights in the join tree depending on the join + * sequence we use. So, these clauses cannot be associated directly with + * the join RelOptInfo, but must be kept track of on a per-join-path basis. + * + * RestrictInfos that represent equivalence conditions (i.e., mergejoinable + * equalities that are not outerjoin-delayed) are handled a bit differently. + * Initially we attach them to the EquivalenceClasses that are derived from + * them. When we construct a scan or join path, we look through all the + * EquivalenceClasses and generate derived RestrictInfos representing the + * minimal set of conditions that need to be checked for this particular scan + * or join to enforce that all members of each EquivalenceClass are in fact + * equal in all rows emitted by the scan or join. + * + * The clause_relids field lists the base plus outer-join RT indexes that + * actually appear in the clause. required_relids lists the minimum set of + * relids needed to evaluate the clause; while this is often equal to + * clause_relids, it can be more. We will add relids to required_relids when + * we need to force an outer join ON clause to be evaluated exactly at the + * level of the outer join, which is true except when it is a "degenerate" + * condition that references only Vars from the nullable side of the join. + * + * RestrictInfo nodes contain a flag to indicate whether a qual has been + * pushed down to a lower level than its original syntactic placement in the + * join tree would suggest. If an outer join prevents us from pushing a qual + * down to its "natural" semantic level (the level associated with just the + * base rels used in the qual) then we mark the qual with a "required_relids" + * value including more than just the base rels it actually uses. By + * pretending that the qual references all the rels required to form the outer + * join, we prevent it from being evaluated below the outer join's joinrel. + * When we do form the outer join's joinrel, we still need to distinguish + * those quals that are actually in that join's JOIN/ON condition from those + * that appeared elsewhere in the tree and were pushed down to the join rel + * because they used no other rels. That's what the is_pushed_down flag is + * for; it tells us that a qual is not an OUTER JOIN qual for the set of base + * rels listed in required_relids. A clause that originally came from WHERE + * or an INNER JOIN condition will *always* have its is_pushed_down flag set. + * It's possible for an OUTER JOIN clause to be marked is_pushed_down too, + * if we decide that it can be pushed down into the nullable side of the join. + * In that case it acts as a plain filter qual for wherever it gets evaluated. + * (In short, is_pushed_down is only false for non-degenerate outer join + * conditions. Possibly we should rename it to reflect that meaning? But + * see also the comments for RINFO_IS_PUSHED_DOWN, below.) + * + * There is also an incompatible_relids field, which is a set of outer-join + * relids above which we cannot evaluate the clause (because they might null + * Vars it uses that should not be nulled yet). In principle this could be + * filled in any RestrictInfo as the set of OJ relids that appear above the + * clause and null Vars that it uses. In practice we only bother to populate + * it for "clone" clauses, as it's currently only needed to prevent multiple + * clones of the same clause from being accepted for evaluation at the same + * join level. + * + * There is also an outer_relids field, which is NULL except for outer join + * clauses; for those, it is the set of relids on the outer side of the + * clause's outer join. (These are rels that the clause cannot be applied to + * in parameterized scans, since pushing it into the join's outer side would + * lead to wrong answers.) + * + * To handle security-barrier conditions efficiently, we mark RestrictInfo + * nodes with a security_level field, in which higher values identify clauses + * coming from less-trusted sources. The exact semantics are that a clause + * cannot be evaluated before another clause with a lower security_level value + * unless the first clause is leakproof. As with outer-join clauses, this + * creates a reason for clauses to sometimes need to be evaluated higher in + * the join tree than their contents would suggest; and even at a single plan + * node, this rule constrains the order of application of clauses. + * + * In general, the referenced clause might be arbitrarily complex. The + * kinds of clauses we can handle as indexscan quals, mergejoin clauses, + * or hashjoin clauses are limited (e.g., no volatile functions). The code + * for each kind of path is responsible for identifying the restrict clauses + * it can use and ignoring the rest. Clauses not implemented by an indexscan, + * mergejoin, or hashjoin will be placed in the plan qual or joinqual field + * of the finished Plan node, where they will be enforced by general-purpose + * qual-expression-evaluation code. (But we are still entitled to count + * their selectivity when estimating the result tuple count, if we + * can guess what it is...) + * + * When the referenced clause is an OR clause, we generate a modified copy + * in which additional RestrictInfo nodes are inserted below the top-level + * OR/AND structure. This is a convenience for OR indexscan processing: + * indexquals taken from either the top level or an OR subclause will have + * associated RestrictInfo nodes. + * + * The can_join flag is set true if the clause looks potentially useful as + * a merge or hash join clause, that is if it is a binary opclause with + * nonoverlapping sets of relids referenced in the left and right sides. + * (Whether the operator is actually merge or hash joinable isn't checked, + * however.) + * + * The pseudoconstant flag is set true if the clause contains no Vars of + * the current query level and no volatile functions. Such a clause can be + * pulled out and used as a one-time qual in a gating Result node. We keep + * pseudoconstant clauses in the same lists as other RestrictInfos so that + * the regular clause-pushing machinery can assign them to the correct join + * level, but they need to be treated specially for cost and selectivity + * estimates. Note that a pseudoconstant clause can never be an indexqual + * or merge or hash join clause, so it's of no interest to large parts of + * the planner. + * + * When we generate multiple versions of a clause so as to have versions + * that will work after commuting some left joins per outer join identity 3, + * we mark the one with the fewest nullingrels bits with has_clone = true, + * and the rest with is_clone = true. This allows proper filtering of + * these redundant clauses, so that we apply only one version of them. + * + * When join clauses are generated from EquivalenceClasses, there may be + * several equally valid ways to enforce join equivalence, of which we need + * apply only one. We mark clauses of this kind by setting parent_ec to + * point to the generating EquivalenceClass. Multiple clauses with the same + * parent_ec in the same join are redundant. + * + * Most fields are ignored for equality, since they may not be set yet, and + * should be derivable from the clause anyway. + * + * parent_ec, left_ec, right_ec are not printed, lest it lead to infinite + * recursion in plan tree dump. + */ + +typedef struct RestrictInfo +{ + pg_node_attr(no_read, no_query_jumble) + + NodeTag type; + + /* the represented clause of WHERE or JOIN */ + Expr *clause; + + /* true if clause was pushed down in level */ + bool is_pushed_down; + + /* see comment above */ + bool can_join pg_node_attr(equal_ignore); + + /* see comment above */ + bool pseudoconstant pg_node_attr(equal_ignore); + + /* see comment above */ + bool has_clone; + bool is_clone; + + /* true if known to contain no leaked Vars */ + bool leakproof pg_node_attr(equal_ignore); + + /* indicates if clause contains any volatile functions */ + VolatileFunctionStatus has_volatile pg_node_attr(equal_ignore); + + /* see comment above */ + Index security_level; + + /* number of base rels in clause_relids */ + int num_base_rels pg_node_attr(equal_ignore); + + /* The relids (varnos+varnullingrels) actually referenced in the clause: */ + Relids clause_relids pg_node_attr(equal_ignore); + + /* The set of relids required to evaluate the clause: */ + Relids required_relids; + + /* Relids above which we cannot evaluate the clause (see comment above) */ + Relids incompatible_relids; + + /* If an outer-join clause, the outer-side relations, else NULL: */ + Relids outer_relids; + + /* + * Relids in the left/right side of the clause. These fields are set for + * any binary opclause. + */ + Relids left_relids pg_node_attr(equal_ignore); + Relids right_relids pg_node_attr(equal_ignore); + + /* + * Modified clause with RestrictInfos. This field is NULL unless clause + * is an OR clause. + */ + Expr *orclause pg_node_attr(equal_ignore); + + /*---------- + * Serial number of this RestrictInfo. This is unique within the current + * PlannerInfo context, with a few critical exceptions: + * 1. When we generate multiple clones of the same qual condition to + * cope with outer join identity 3, all the clones get the same serial + * number. This reflects that we only want to apply one of them in any + * given plan. + * 2. If we manufacture a commuted version of a qual to use as an index + * condition, it copies the original's rinfo_serial, since it is in + * practice the same condition. + * 3. If we reduce a qual to constant-FALSE, the new constant-FALSE qual + * copies the original's rinfo_serial, since it is in practice the same + * condition. + * 4. RestrictInfos made for a child relation copy their parent's + * rinfo_serial. Likewise, when an EquivalenceClass makes a derived + * equality clause for a child relation, it copies the rinfo_serial of + * the matching equality clause for the parent. This allows detection + * of redundant pushed-down equality clauses. + *---------- + */ + int rinfo_serial; + + /* + * Generating EquivalenceClass. This field is NULL unless clause is + * potentially redundant. + */ + EquivalenceClass *parent_ec pg_node_attr(copy_as_scalar, equal_ignore, read_write_ignore); + + /* + * cache space for cost and selectivity + */ + + /* eval cost of clause; -1 if not yet set */ + QualCost eval_cost pg_node_attr(equal_ignore); + + /* selectivity for "normal" (JOIN_INNER) semantics; -1 if not yet set */ + Selectivity norm_selec pg_node_attr(equal_ignore); + /* selectivity for outer join semantics; -1 if not yet set */ + Selectivity outer_selec pg_node_attr(equal_ignore); + + /* + * opfamilies containing clause operator; valid if clause is + * mergejoinable, else NIL + */ + List *mergeopfamilies pg_node_attr(equal_ignore); + + /* + * cache space for mergeclause processing; NULL if not yet set + */ + + /* EquivalenceClass containing lefthand */ + EquivalenceClass *left_ec pg_node_attr(copy_as_scalar, equal_ignore, read_write_ignore); + /* EquivalenceClass containing righthand */ + EquivalenceClass *right_ec pg_node_attr(copy_as_scalar, equal_ignore, read_write_ignore); + /* EquivalenceMember for lefthand */ + EquivalenceMember *left_em pg_node_attr(copy_as_scalar, equal_ignore); + /* EquivalenceMember for righthand */ + EquivalenceMember *right_em pg_node_attr(copy_as_scalar, equal_ignore); + + /* + * List of MergeScanSelCache structs. Those aren't Nodes, so hard to + * copy; instead replace with NIL. That has the effect that copying will + * just reset the cache. Likewise, can't compare or print them. + */ + List *scansel_cache pg_node_attr(copy_as(NIL), equal_ignore, read_write_ignore); + + /* + * transient workspace for use while considering a specific join path; T = + * outer var on left, F = on right + */ + bool outer_is_left pg_node_attr(equal_ignore); + + /* + * copy of clause operator; valid if clause is hashjoinable, else + * InvalidOid + */ + Oid hashjoinoperator pg_node_attr(equal_ignore); + + /* + * cache space for hashclause processing; -1 if not yet set + */ + /* avg bucketsize of left side */ + Selectivity left_bucketsize pg_node_attr(equal_ignore); + /* avg bucketsize of right side */ + Selectivity right_bucketsize pg_node_attr(equal_ignore); + /* left side's most common val's freq */ + Selectivity left_mcvfreq pg_node_attr(equal_ignore); + /* right side's most common val's freq */ + Selectivity right_mcvfreq pg_node_attr(equal_ignore); + + /* hash equality operators used for memoize nodes, else InvalidOid */ + Oid left_hasheqoperator pg_node_attr(equal_ignore); + Oid right_hasheqoperator pg_node_attr(equal_ignore); +} RestrictInfo; + +/* + * This macro embodies the correct way to test whether a RestrictInfo is + * "pushed down" to a given outer join, that is, should be treated as a filter + * clause rather than a join clause at that outer join. This is certainly so + * if is_pushed_down is true; but examining that is not sufficient anymore, + * because outer-join clauses will get pushed down to lower outer joins when + * we generate a path for the lower outer join that is parameterized by the + * LHS of the upper one. We can detect such a clause by noting that its + * required_relids exceed the scope of the join. + */ +#define RINFO_IS_PUSHED_DOWN(rinfo, joinrelids) \ + ((rinfo)->is_pushed_down || \ + !bms_is_subset((rinfo)->required_relids, joinrelids)) + +/* + * Since mergejoinscansel() is a relatively expensive function, and would + * otherwise be invoked many times while planning a large join tree, + * we go out of our way to cache its results. Each mergejoinable + * RestrictInfo carries a list of the specific sort orderings that have + * been considered for use with it, and the resulting selectivities. + */ +typedef struct MergeScanSelCache +{ + /* Ordering details (cache lookup key) */ + Oid opfamily; /* index opfamily defining the ordering */ + Oid collation; /* collation for the ordering */ + CompareType cmptype; /* sort direction (ASC or DESC) */ + bool nulls_first; /* do NULLs come before normal values? */ + /* Results */ + Selectivity leftstartsel; /* first-join fraction for clause left side */ + Selectivity leftendsel; /* last-join fraction for clause left side */ + Selectivity rightstartsel; /* first-join fraction for clause right side */ + Selectivity rightendsel; /* last-join fraction for clause right side */ +} MergeScanSelCache; + +/* + * Placeholder node for an expression to be evaluated below the top level + * of a plan tree. This is used during planning to represent the contained + * expression. At the end of the planning process it is replaced by either + * the contained expression or a Var referring to a lower-level evaluation of + * the contained expression. Generally the evaluation occurs below an outer + * join, and Var references above the outer join might thereby yield NULL + * instead of the expression value. + * + * phrels and phlevelsup correspond to the varno/varlevelsup fields of a + * plain Var, except that phrels has to be a relid set since the evaluation + * level of a PlaceHolderVar might be a join rather than a base relation. + * Likewise, phnullingrels corresponds to varnullingrels. + * + * Although the planner treats this as an expression node type, it is not + * recognized by the parser or executor, so we declare it here rather than + * in primnodes.h. + * + * We intentionally do not compare phexpr. Two PlaceHolderVars with the + * same ID and levelsup should be considered equal even if the contained + * expressions have managed to mutate to different states. This will + * happen during final plan construction when there are nested PHVs, since + * the inner PHV will get replaced by a Param in some copies of the outer + * PHV. Another way in which it can happen is that initplan sublinks + * could get replaced by differently-numbered Params when sublink folding + * is done. (The end result of such a situation would be some + * unreferenced initplans, which is annoying but not really a problem.) + * On the same reasoning, there is no need to examine phrels. But we do + * need to compare phnullingrels, as that represents effects that are + * external to the original value of the PHV. + */ + +typedef struct PlaceHolderVar +{ + pg_node_attr(no_query_jumble) + + Expr xpr; + + /* the represented expression */ + Expr *phexpr pg_node_attr(equal_ignore); + + /* base+OJ relids syntactically within expr src */ + Relids phrels pg_node_attr(equal_ignore); + + /* RT indexes of outer joins that can null PHV's value */ + Relids phnullingrels; + + /* ID for PHV (unique within planner run) */ + Index phid; + + /* > 0 if PHV belongs to outer query */ + Index phlevelsup; +} PlaceHolderVar; + +/* + * "Special join" info. + * + * One-sided outer joins constrain the order of joining partially but not + * completely. We flatten such joins into the planner's top-level list of + * relations to join, but record information about each outer join in a + * SpecialJoinInfo struct. These structs are kept in the PlannerInfo node's + * join_info_list. + * + * Similarly, semijoins and antijoins created by flattening IN (subselect) + * and EXISTS(subselect) clauses create partial constraints on join order. + * These are likewise recorded in SpecialJoinInfo structs. + * + * We make SpecialJoinInfos for FULL JOINs even though there is no flexibility + * of planning for them, because this simplifies make_join_rel()'s API. + * + * min_lefthand and min_righthand are the sets of base+OJ relids that must be + * available on each side when performing the special join. + * It is not valid for either min_lefthand or min_righthand to be empty sets; + * if they were, this would break the logic that enforces join order. + * + * syn_lefthand and syn_righthand are the sets of base+OJ relids that are + * syntactically below this special join. (These are needed to help compute + * min_lefthand and min_righthand for higher joins.) + * + * jointype is never JOIN_RIGHT; a RIGHT JOIN is handled by switching + * the inputs to make it a LEFT JOIN. It's never JOIN_RIGHT_SEMI or + * JOIN_RIGHT_ANTI either. So the allowed values of jointype in a + * join_info_list member are only LEFT, FULL, SEMI, or ANTI. + * + * ojrelid is the RT index of the join RTE representing this outer join, + * if there is one. It is zero when jointype is INNER or SEMI, and can be + * zero for jointype ANTI (if the join was transformed from a SEMI join). + * One use for this field is that when constructing the output targetlist of a + * join relation that implements this OJ, we add ojrelid to the varnullingrels + * and phnullingrels fields of nullable (RHS) output columns, so that the + * output Vars and PlaceHolderVars correctly reflect the nulling that has + * potentially happened to them. + * + * commute_above_l is filled with the relids of syntactically-higher outer + * joins that have been found to commute with this one per outer join identity + * 3 (see optimizer/README), when this join is in the LHS of the upper join + * (so, this is the lower join in the first form of the identity). + * + * commute_above_r is filled with the relids of syntactically-higher outer + * joins that have been found to commute with this one per outer join identity + * 3, when this join is in the RHS of the upper join (so, this is the lower + * join in the second form of the identity). + * + * commute_below_l is filled with the relids of syntactically-lower outer + * joins that have been found to commute with this one per outer join identity + * 3 and are in the LHS of this join (so, this is the upper join in the first + * form of the identity). + * + * commute_below_r is filled with the relids of syntactically-lower outer + * joins that have been found to commute with this one per outer join identity + * 3 and are in the RHS of this join (so, this is the upper join in the second + * form of the identity). + * + * lhs_strict is true if the special join's condition cannot succeed when the + * LHS variables are all NULL (this means that an outer join can commute with + * upper-level outer joins even if it appears in their RHS). We don't bother + * to set lhs_strict for FULL JOINs, however. + * + * For a semijoin, we also extract the join operators and their RHS arguments + * and set semi_operators, semi_rhs_exprs, semi_can_btree, and semi_can_hash. + * This is done in support of possibly unique-ifying the RHS, so we don't + * bother unless at least one of semi_can_btree and semi_can_hash can be set + * true. (You might expect that this information would be computed during + * join planning; but it's helpful to have it available during planning of + * parameterized table scans, so we store it in the SpecialJoinInfo structs.) + * + * For purposes of join selectivity estimation, we create transient + * SpecialJoinInfo structures for regular inner joins; so it is possible + * to have jointype == JOIN_INNER in such a structure, even though this is + * not allowed within join_info_list. We also create transient + * SpecialJoinInfos with jointype == JOIN_INNER for outer joins, since for + * cost estimation purposes it is sometimes useful to know the join size under + * plain innerjoin semantics. Note that lhs_strict and the semi_xxx fields + * are not set meaningfully within such structs. + * + * We also create transient SpecialJoinInfos for child joins during + * partitionwise join planning, which are also not present in join_info_list. + */ +#ifndef HAVE_SPECIALJOININFO_TYPEDEF +typedef struct SpecialJoinInfo SpecialJoinInfo; +#define HAVE_SPECIALJOININFO_TYPEDEF 1 +#endif + +struct SpecialJoinInfo +{ + pg_node_attr(no_read, no_query_jumble) + + NodeTag type; + Relids min_lefthand; /* base+OJ relids in minimum LHS for join */ + Relids min_righthand; /* base+OJ relids in minimum RHS for join */ + Relids syn_lefthand; /* base+OJ relids syntactically within LHS */ + Relids syn_righthand; /* base+OJ relids syntactically within RHS */ + JoinType jointype; /* always INNER, LEFT, FULL, SEMI, or ANTI */ + Index ojrelid; /* outer join's RT index; 0 if none */ + Relids commute_above_l; /* commuting OJs above this one, if LHS */ + Relids commute_above_r; /* commuting OJs above this one, if RHS */ + Relids commute_below_l; /* commuting OJs in this one's LHS */ + Relids commute_below_r; /* commuting OJs in this one's RHS */ + bool lhs_strict; /* joinclause is strict for some LHS rel */ + /* Remaining fields are set only for JOIN_SEMI jointype: */ + bool semi_can_btree; /* true if semi_operators are all btree */ + bool semi_can_hash; /* true if semi_operators are all hash */ + List *semi_operators; /* OIDs of equality join operators */ + List *semi_rhs_exprs; /* righthand-side expressions of these ops */ +}; + +/* + * Transient outer-join clause info. + * + * We set aside every outer join ON clause that looks mergejoinable, + * and process it specially at the end of qual distribution. + */ +typedef struct OuterJoinClauseInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + RestrictInfo *rinfo; /* a mergejoinable outer-join clause */ + SpecialJoinInfo *sjinfo; /* the outer join's SpecialJoinInfo */ +} OuterJoinClauseInfo; + +/* + * Append-relation info. + * + * When we expand an inheritable table or a UNION-ALL subselect into an + * "append relation" (essentially, a list of child RTEs), we build an + * AppendRelInfo for each child RTE. The list of AppendRelInfos indicates + * which child RTEs must be included when expanding the parent, and each node + * carries information needed to translate between columns of the parent and + * columns of the child. + * + * These structs are kept in the PlannerInfo node's append_rel_list, with + * append_rel_array[] providing a convenient lookup method for the struct + * associated with a particular child relid (there can be only one, though + * parent rels may have many entries in append_rel_list). + * + * Note: after completion of the planner prep phase, any given RTE is an + * append parent having entries in append_rel_list if and only if its + * "inh" flag is set. We clear "inh" for plain tables that turn out not + * to have inheritance children, and (in an abuse of the original meaning + * of the flag) we set "inh" for subquery RTEs that turn out to be + * flattenable UNION ALL queries. This lets us avoid useless searches + * of append_rel_list. + * + * Note: the data structure assumes that append-rel members are single + * baserels. This is OK for inheritance, but it prevents us from pulling + * up a UNION ALL member subquery if it contains a join. While that could + * be fixed with a more complex data structure, at present there's not much + * point because no improvement in the plan could result. + */ + +typedef struct AppendRelInfo +{ + pg_node_attr(no_query_jumble) + + NodeTag type; + + /* + * These fields uniquely identify this append relationship. There can be + * (in fact, always should be) multiple AppendRelInfos for the same + * parent_relid, but never more than one per child_relid, since a given + * RTE cannot be a child of more than one append parent. + */ + Index parent_relid; /* RT index of append parent rel */ + Index child_relid; /* RT index of append child rel */ + + /* + * For an inheritance appendrel, the parent and child are both regular + * relations, and we store their rowtype OIDs here for use in translating + * whole-row Vars. For a UNION-ALL appendrel, the parent and child are + * both subqueries with no named rowtype, and we store InvalidOid here. + */ + Oid parent_reltype; /* OID of parent's composite type */ + Oid child_reltype; /* OID of child's composite type */ + + /* + * The N'th element of this list is a Var or expression representing the + * child column corresponding to the N'th column of the parent. This is + * used to translate Vars referencing the parent rel into references to + * the child. A list element is NULL if it corresponds to a dropped + * column of the parent (this is only possible for inheritance cases, not + * UNION ALL). The list elements are always simple Vars for inheritance + * cases, but can be arbitrary expressions in UNION ALL cases. + * + * Notice we only store entries for user columns (attno > 0). Whole-row + * Vars are special-cased, and system columns (attno < 0) need no special + * translation since their attnos are the same for all tables. + * + * Caution: the Vars have varlevelsup = 0. Be careful to adjust as needed + * when copying into a subquery. + */ + List *translated_vars; /* Expressions in the child's Vars */ + + /* + * This array simplifies translations in the reverse direction, from + * child's column numbers to parent's. The entry at [ccolno - 1] is the + * 1-based parent column number for child column ccolno, or zero if that + * child column is dropped or doesn't exist in the parent. + */ + int num_child_cols; /* length of array */ + AttrNumber *parent_colnos pg_node_attr(array_size(num_child_cols)); + + /* + * We store the parent table's OID here for inheritance, or InvalidOid for + * UNION ALL. This is only needed to help in generating error messages if + * an attempt is made to reference a dropped parent column. + */ + Oid parent_reloid; /* OID of parent relation */ +} AppendRelInfo; + +/* + * Information about a row-identity "resjunk" column in UPDATE/DELETE/MERGE. + * + * In partitioned UPDATE/DELETE/MERGE it's important for child partitions to + * share row-identity columns whenever possible, so as not to chew up too many + * targetlist columns. We use these structs to track which identity columns + * have been requested. In the finished plan, each of these will give rise + * to one resjunk entry in the targetlist of the ModifyTable's subplan node. + * + * All the Vars stored in RowIdentityVarInfos must have varno ROWID_VAR, for + * convenience of detecting duplicate requests. We'll replace that, in the + * final plan, with the varno of the generating rel. + * + * Outside this list, a Var with varno ROWID_VAR and varattno k is a reference + * to the k-th element of the row_identity_vars list (k counting from 1). + * We add such a reference to root->processed_tlist when creating the entry, + * and it propagates into the plan tree from there. + */ +typedef struct RowIdentityVarInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Var *rowidvar; /* Var to be evaluated (but varno=ROWID_VAR) */ + int32 rowidwidth; /* estimated average width */ + char *rowidname; /* name of the resjunk column */ + Relids rowidrels; /* RTE indexes of target rels using this */ +} RowIdentityVarInfo; + +/* + * For each distinct placeholder expression generated during planning, we + * store a PlaceHolderInfo node in the PlannerInfo node's placeholder_list. + * This stores info that is needed centrally rather than in each copy of the + * PlaceHolderVar. The phid fields identify which PlaceHolderInfo goes with + * each PlaceHolderVar. Note that phid is unique throughout a planner run, + * not just within a query level --- this is so that we need not reassign ID's + * when pulling a subquery into its parent. + * + * The idea is to evaluate the expression at (only) the ph_eval_at join level, + * then allow it to bubble up like a Var until the ph_needed join level. + * ph_needed has the same definition as attr_needed for a regular Var. + * + * The PlaceHolderVar's expression might contain LATERAL references to vars + * coming from outside its syntactic scope. If so, those rels are *not* + * included in ph_eval_at, but they are recorded in ph_lateral. + * + * Notice that when ph_eval_at is a join rather than a single baserel, the + * PlaceHolderInfo may create constraints on join order: the ph_eval_at join + * has to be formed below any outer joins that should null the PlaceHolderVar. + * + * We create a PlaceHolderInfo only after determining that the PlaceHolderVar + * is actually referenced in the plan tree, so that unreferenced placeholders + * don't result in unnecessary constraints on join order. + */ + +typedef struct PlaceHolderInfo +{ + pg_node_attr(no_read, no_query_jumble) + + NodeTag type; + + /* ID for PH (unique within planner run) */ + Index phid; + + /* + * copy of PlaceHolderVar tree (should be redundant for comparison, could + * be ignored) + */ + PlaceHolderVar *ph_var; + + /* lowest level we can evaluate value at */ + Relids ph_eval_at; + + /* relids of contained lateral refs, if any */ + Relids ph_lateral; + + /* highest level the value is needed at */ + Relids ph_needed; + + /* estimated attribute width */ + int32 ph_width; +} PlaceHolderInfo; + +/* + * This struct describes one potentially index-optimizable MIN/MAX aggregate + * function. MinMaxAggPath contains a list of these, and if we accept that + * path, the list is stored into root->minmax_aggs for use during setrefs.c. + */ +typedef struct MinMaxAggInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* pg_proc Oid of the aggregate */ + Oid aggfnoid; + + /* Oid of its sort operator */ + Oid aggsortop; + + /* expression we are aggregating on */ + Expr *target; + + /* + * modified "root" for planning the subquery; not printed, too large, not + * interesting enough + */ + PlannerInfo *subroot pg_node_attr(read_write_ignore); + + /* access path for subquery */ + Path *path; + + /* estimated cost to fetch first row */ + Cost pathcost; + + /* param for subplan's output */ + Param *param; +} MinMaxAggInfo; + +/* + * At runtime, PARAM_EXEC slots are used to pass values around from one plan + * node to another. They can be used to pass values down into subqueries (for + * outer references in subqueries), or up out of subqueries (for the results + * of a subplan), or from a NestLoop plan node into its inner relation (when + * the inner scan is parameterized with values from the outer relation). + * The planner is responsible for assigning nonconflicting PARAM_EXEC IDs to + * the PARAM_EXEC Params it generates. + * + * Outer references are managed via root->plan_params, which is a list of + * PlannerParamItems. While planning a subquery, each parent query level's + * plan_params contains the values required from it by the current subquery. + * During create_plan(), we use plan_params to track values that must be + * passed from outer to inner sides of NestLoop plan nodes. + * + * The item a PlannerParamItem represents can be one of three kinds: + * + * A Var: the slot represents a variable of this level that must be passed + * down because subqueries have outer references to it, or must be passed + * from a NestLoop node to its inner scan. The varlevelsup value in the Var + * will always be zero. + * + * A PlaceHolderVar: this works much like the Var case, except that the + * entry is a PlaceHolderVar node with a contained expression. The PHV + * will have phlevelsup = 0, and the contained expression is adjusted + * to match in level. + * + * An Aggref (with an expression tree representing its argument): the slot + * represents an aggregate expression that is an outer reference for some + * subquery. The Aggref itself has agglevelsup = 0, and its argument tree + * is adjusted to match in level. + * + * Note: we detect duplicate Var and PlaceHolderVar parameters and coalesce + * them into one slot, but we do not bother to do that for Aggrefs. + * The scope of duplicate-elimination only extends across the set of + * parameters passed from one query level into a single subquery, or for + * nestloop parameters across the set of nestloop parameters used in a single + * query level. So there is no possibility of a PARAM_EXEC slot being used + * for conflicting purposes. + * + * In addition, PARAM_EXEC slots are assigned for Params representing outputs + * from subplans (values that are setParam items for those subplans). These + * IDs need not be tracked via PlannerParamItems, since we do not need any + * duplicate-elimination nor later processing of the represented expressions. + * Instead, we just record the assignment of the slot number by appending to + * root->glob->paramExecTypes. + */ +typedef struct PlannerParamItem +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Node *item; /* the Var, PlaceHolderVar, or Aggref */ + int paramId; /* its assigned PARAM_EXEC slot number */ +} PlannerParamItem; + +/* + * When making cost estimates for a SEMI/ANTI/inner_unique join, there are + * some correction factors that are needed in both nestloop and hash joins + * to account for the fact that the executor can stop scanning inner rows + * as soon as it finds a match to the current outer row. These numbers + * depend only on the selected outer and inner join relations, not on the + * particular paths used for them, so it's worthwhile to calculate them + * just once per relation pair not once per considered path. This struct + * is filled by compute_semi_anti_join_factors and must be passed along + * to the join cost estimation functions. + * + * outer_match_frac is the fraction of the outer tuples that are + * expected to have at least one match. + * match_count is the average number of matches expected for + * outer tuples that have at least one match. + */ +typedef struct SemiAntiJoinFactors +{ + Selectivity outer_match_frac; + Selectivity match_count; +} SemiAntiJoinFactors; + +/* + * Struct for extra information passed to subroutines of add_paths_to_joinrel + * + * restrictlist contains all of the RestrictInfo nodes for restriction + * clauses that apply to this join + * mergeclause_list is a list of RestrictInfo nodes for available + * mergejoin clauses in this join + * inner_unique is true if each outer tuple provably matches no more + * than one inner tuple + * sjinfo is extra info about special joins for selectivity estimation + * semifactors is as shown above (only valid for SEMI/ANTI/inner_unique joins) + * param_source_rels are OK targets for parameterization of result paths + */ +typedef struct JoinPathExtraData +{ + List *restrictlist; + List *mergeclause_list; + bool inner_unique; + SpecialJoinInfo *sjinfo; + SemiAntiJoinFactors semifactors; + Relids param_source_rels; +} JoinPathExtraData; + +/* + * Various flags indicating what kinds of grouping are possible. + * + * GROUPING_CAN_USE_SORT should be set if it's possible to perform + * sort-based implementations of grouping. When grouping sets are in use, + * this will be true if sorting is potentially usable for any of the grouping + * sets, even if it's not usable for all of them. + * + * GROUPING_CAN_USE_HASH should be set if it's possible to perform + * hash-based implementations of grouping. + * + * GROUPING_CAN_PARTIAL_AGG should be set if the aggregation is of a type + * for which we support partial aggregation (not, for example, grouping sets). + * It says nothing about parallel-safety or the availability of suitable paths. + */ +#define GROUPING_CAN_USE_SORT 0x0001 +#define GROUPING_CAN_USE_HASH 0x0002 +#define GROUPING_CAN_PARTIAL_AGG 0x0004 + +/* + * What kind of partitionwise aggregation is in use? + * + * PARTITIONWISE_AGGREGATE_NONE: Not used. + * + * PARTITIONWISE_AGGREGATE_FULL: Aggregate each partition separately, and + * append the results. + * + * PARTITIONWISE_AGGREGATE_PARTIAL: Partially aggregate each partition + * separately, append the results, and then finalize aggregation. + */ +typedef enum +{ + PARTITIONWISE_AGGREGATE_NONE, + PARTITIONWISE_AGGREGATE_FULL, + PARTITIONWISE_AGGREGATE_PARTIAL, +} PartitionwiseAggregateType; + +/* + * Struct for extra information passed to subroutines of create_grouping_paths + * + * flags indicating what kinds of grouping are possible. + * partial_costs_set is true if the agg_partial_costs and agg_final_costs + * have been initialized. + * agg_partial_costs gives partial aggregation costs. + * agg_final_costs gives finalization costs. + * target_parallel_safe is true if target is parallel safe. + * havingQual gives list of quals to be applied after aggregation. + * targetList gives list of columns to be projected. + * patype is the type of partitionwise aggregation that is being performed. + */ +typedef struct +{ + /* Data which remains constant once set. */ + int flags; + bool partial_costs_set; + AggClauseCosts agg_partial_costs; + AggClauseCosts agg_final_costs; + + /* Data which may differ across partitions. */ + bool target_parallel_safe; + Node *havingQual; + List *targetList; + PartitionwiseAggregateType patype; +} GroupPathExtraData; + +/* + * Struct for extra information passed to subroutines of grouping_planner + * + * limit_needed is true if we actually need a Limit plan node. + * limit_tuples is an estimated bound on the number of output tuples, + * or -1 if no LIMIT or couldn't estimate. + * count_est and offset_est are the estimated values of the LIMIT and OFFSET + * expressions computed by preprocess_limit() (see comments for + * preprocess_limit() for more information). + */ +typedef struct +{ + bool limit_needed; + Cardinality limit_tuples; + int64 count_est; + int64 offset_est; +} FinalPathExtraData; + +/* + * For speed reasons, cost estimation for join paths is performed in two + * phases: the first phase tries to quickly derive a lower bound for the + * join cost, and then we check if that's sufficient to reject the path. + * If not, we come back for a more refined cost estimate. The first phase + * fills a JoinCostWorkspace struct with its preliminary cost estimates + * and possibly additional intermediate values. The second phase takes + * these values as inputs to avoid repeating work. + * + * (Ideally we'd declare this in cost.h, but it's also needed in pathnode.h, + * so seems best to put it here.) + */ +typedef struct JoinCostWorkspace +{ + /* Preliminary cost estimates --- must not be larger than final ones! */ + int disabled_nodes; + Cost startup_cost; /* cost expended before fetching any tuples */ + Cost total_cost; /* total cost (assuming all tuples fetched) */ + + /* Fields below here should be treated as private to costsize.c */ + Cost run_cost; /* non-startup cost components */ + + /* private for cost_nestloop code */ + Cost inner_run_cost; /* also used by cost_mergejoin code */ + Cost inner_rescan_run_cost; + + /* private for cost_mergejoin code */ + Cardinality outer_rows; + Cardinality inner_rows; + Cardinality outer_skip_rows; + Cardinality inner_skip_rows; + + /* private for cost_hashjoin code */ + int numbuckets; + int numbatches; + Cardinality inner_rows_total; +} JoinCostWorkspace; + +/* + * AggInfo holds information about an aggregate that needs to be computed. + * Multiple Aggrefs in a query can refer to the same AggInfo by having the + * same 'aggno' value, so that the aggregate is computed only once. + */ +typedef struct AggInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* + * List of Aggref exprs that this state value is for. + * + * There will always be at least one, but there can be multiple identical + * Aggref's sharing the same per-agg. + */ + List *aggrefs; + + /* Transition state number for this aggregate */ + int transno; + + /* + * "shareable" is false if this agg cannot share state values with other + * aggregates because the final function is read-write. + */ + bool shareable; + + /* Oid of the final function, or InvalidOid if none */ + Oid finalfn_oid; +} AggInfo; + +/* + * AggTransInfo holds information about transition state that is used by one + * or more aggregates in the query. Multiple aggregates can share the same + * transition state, if they have the same inputs and the same transition + * function. Aggrefs that share the same transition info have the same + * 'aggtransno' value. + */ +typedef struct AggTransInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* Inputs for this transition state */ + List *args; + Expr *aggfilter; + + /* Oid of the state transition function */ + Oid transfn_oid; + + /* Oid of the serialization function, or InvalidOid if none */ + Oid serialfn_oid; + + /* Oid of the deserialization function, or InvalidOid if none */ + Oid deserialfn_oid; + + /* Oid of the combine function, or InvalidOid if none */ + Oid combinefn_oid; + + /* Oid of state value's datatype */ + Oid aggtranstype; + + /* Additional data about transtype */ + int32 aggtranstypmod; + int transtypeLen; + bool transtypeByVal; + + /* Space-consumption estimate */ + int32 aggtransspace; + + /* Initial value from pg_aggregate entry */ + Datum initValue pg_node_attr(read_write_ignore); + bool initValueIsNull; +} AggTransInfo; + +/* + * UniqueRelInfo caches a fact that a relation is unique when being joined + * to other relation(s). + */ +typedef struct UniqueRelInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* + * The relation in consideration is unique when being joined with this set + * of other relation(s). + */ + Relids outerrelids; + + /* + * The relation in consideration is unique when considering only clauses + * suitable for self-join (passed split_selfjoin_quals()). + */ + bool self_join; + + /* + * Additional clauses from a baserestrictinfo list that were used to prove + * the uniqueness. We cache it for the self-join checking procedure: a + * self-join can be removed if the outer relation contains strictly the + * same set of clauses. + */ + List *extra_clauses; +} UniqueRelInfo; + +#endif /* PATHNODES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/pg_list.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/pg_list.h new file mode 100644 index 0000000..4d1cdbb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/pg_list.h @@ -0,0 +1,686 @@ +/*------------------------------------------------------------------------- + * + * pg_list.h + * interface for PostgreSQL generic list package + * + * Once upon a time, parts of Postgres were written in Lisp and used real + * cons-cell lists for major data structures. When that code was rewritten + * in C, we initially had a faithful emulation of cons-cell lists, which + * unsurprisingly was a performance bottleneck. A couple of major rewrites + * later, these data structures are actually simple expansible arrays; + * but the "List" name and a lot of the notation survives. + * + * One important concession to the original implementation is that an empty + * list is always represented by a null pointer (preferentially written NIL). + * Non-empty lists have a header, which will not be relocated as long as the + * list remains non-empty, and an expansible data array. + * + * We support four types of lists: + * + * T_List: lists of pointers + * (in practice usually pointers to Nodes, but not always; + * declared as "void *" to minimize casting annoyances) + * T_IntList: lists of integers + * T_OidList: lists of Oids + * T_XidList: lists of TransactionIds + * (the XidList infrastructure is less complete than the other cases) + * + * (At the moment, ints, Oids, and XIDs are the same size, but they may not + * always be so; be careful to use the appropriate list type for your data.) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/pg_list.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LIST_H +#define PG_LIST_H + +#include "nodes/nodes.h" + + +typedef union ListCell +{ + void *ptr_value; + int int_value; + Oid oid_value; + TransactionId xid_value; +} ListCell; + +typedef struct List +{ + NodeTag type; /* T_List, T_IntList, T_OidList, or T_XidList */ + int length; /* number of elements currently present */ + int max_length; /* allocated length of elements[] */ + ListCell *elements; /* re-allocatable array of cells */ + /* We may allocate some cells along with the List header: */ + ListCell initial_elements[FLEXIBLE_ARRAY_MEMBER]; + /* If elements == initial_elements, it's not a separate allocation */ +} List; + +/* + * The *only* valid representation of an empty list is NIL; in other + * words, a non-NIL list is guaranteed to have length >= 1. + */ +#define NIL ((List *) NULL) + +/* + * State structs for various looping macros below. + */ +typedef struct ForEachState +{ + const List *l; /* list we're looping through */ + int i; /* current element index */ +} ForEachState; + +typedef struct ForBothState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + int i; /* common element index */ +} ForBothState; + +typedef struct ForBothCellState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + int i1; /* current element indexes */ + int i2; +} ForBothCellState; + +typedef struct ForThreeState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + const List *l3; + int i; /* common element index */ +} ForThreeState; + +typedef struct ForFourState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + const List *l3; + const List *l4; + int i; /* common element index */ +} ForFourState; + +typedef struct ForFiveState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + const List *l3; + const List *l4; + const List *l5; + int i; /* common element index */ +} ForFiveState; + +/* + * These routines are small enough, and used often enough, to justify being + * inline. + */ + +/* Fetch address of list's first cell; NULL if empty list */ +static inline ListCell * +list_head(const List *l) +{ + return l ? &l->elements[0] : NULL; +} + +/* Fetch address of list's last cell; NULL if empty list */ +static inline ListCell * +list_tail(const List *l) +{ + return l ? &l->elements[l->length - 1] : NULL; +} + +/* Fetch address of list's second cell, if it has one, else NULL */ +static inline ListCell * +list_second_cell(const List *l) +{ + if (l && l->length >= 2) + return &l->elements[1]; + else + return NULL; +} + +/* Fetch list's length */ +static inline int +list_length(const List *l) +{ + return l ? l->length : 0; +} + +/* + * Macros to access the data values within List cells. + * + * Note that with the exception of the "xxx_node" macros, these are + * lvalues and can be assigned to. + * + * NB: There is an unfortunate legacy from a previous incarnation of + * the List API: the macro lfirst() was used to mean "the data in this + * cons cell". To avoid changing every usage of lfirst(), that meaning + * has been kept. As a result, lfirst() takes a ListCell and returns + * the data it contains; to get the data in the first cell of a + * List, use linitial(). Worse, lsecond() is more closely related to + * linitial() than lfirst(): given a List, lsecond() returns the data + * in the second list cell. + */ +#define lfirst(lc) ((lc)->ptr_value) +#define lfirst_int(lc) ((lc)->int_value) +#define lfirst_oid(lc) ((lc)->oid_value) +#define lfirst_xid(lc) ((lc)->xid_value) +#define lfirst_node(type,lc) castNode(type, lfirst(lc)) + +#define linitial(l) lfirst(list_nth_cell(l, 0)) +#define linitial_int(l) lfirst_int(list_nth_cell(l, 0)) +#define linitial_oid(l) lfirst_oid(list_nth_cell(l, 0)) +#define linitial_node(type,l) castNode(type, linitial(l)) + +#define lsecond(l) lfirst(list_nth_cell(l, 1)) +#define lsecond_int(l) lfirst_int(list_nth_cell(l, 1)) +#define lsecond_oid(l) lfirst_oid(list_nth_cell(l, 1)) +#define lsecond_node(type,l) castNode(type, lsecond(l)) + +#define lthird(l) lfirst(list_nth_cell(l, 2)) +#define lthird_int(l) lfirst_int(list_nth_cell(l, 2)) +#define lthird_oid(l) lfirst_oid(list_nth_cell(l, 2)) +#define lthird_node(type,l) castNode(type, lthird(l)) + +#define lfourth(l) lfirst(list_nth_cell(l, 3)) +#define lfourth_int(l) lfirst_int(list_nth_cell(l, 3)) +#define lfourth_oid(l) lfirst_oid(list_nth_cell(l, 3)) +#define lfourth_node(type,l) castNode(type, lfourth(l)) + +#define llast(l) lfirst(list_last_cell(l)) +#define llast_int(l) lfirst_int(list_last_cell(l)) +#define llast_oid(l) lfirst_oid(list_last_cell(l)) +#define llast_xid(l) lfirst_xid(list_last_cell(l)) +#define llast_node(type,l) castNode(type, llast(l)) + +/* + * Convenience macros for building fixed-length lists + */ +#define list_make_ptr_cell(v) ((ListCell) {.ptr_value = (v)}) +#define list_make_int_cell(v) ((ListCell) {.int_value = (v)}) +#define list_make_oid_cell(v) ((ListCell) {.oid_value = (v)}) +#define list_make_xid_cell(v) ((ListCell) {.xid_value = (v)}) + +#define list_make1(x1) \ + list_make1_impl(T_List, list_make_ptr_cell(x1)) +#define list_make2(x1,x2) \ + list_make2_impl(T_List, list_make_ptr_cell(x1), list_make_ptr_cell(x2)) +#define list_make3(x1,x2,x3) \ + list_make3_impl(T_List, list_make_ptr_cell(x1), list_make_ptr_cell(x2), \ + list_make_ptr_cell(x3)) +#define list_make4(x1,x2,x3,x4) \ + list_make4_impl(T_List, list_make_ptr_cell(x1), list_make_ptr_cell(x2), \ + list_make_ptr_cell(x3), list_make_ptr_cell(x4)) +#define list_make5(x1,x2,x3,x4,x5) \ + list_make5_impl(T_List, list_make_ptr_cell(x1), list_make_ptr_cell(x2), \ + list_make_ptr_cell(x3), list_make_ptr_cell(x4), \ + list_make_ptr_cell(x5)) + +#define list_make1_int(x1) \ + list_make1_impl(T_IntList, list_make_int_cell(x1)) +#define list_make2_int(x1,x2) \ + list_make2_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2)) +#define list_make3_int(x1,x2,x3) \ + list_make3_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2), \ + list_make_int_cell(x3)) +#define list_make4_int(x1,x2,x3,x4) \ + list_make4_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2), \ + list_make_int_cell(x3), list_make_int_cell(x4)) +#define list_make5_int(x1,x2,x3,x4,x5) \ + list_make5_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2), \ + list_make_int_cell(x3), list_make_int_cell(x4), \ + list_make_int_cell(x5)) + +#define list_make1_oid(x1) \ + list_make1_impl(T_OidList, list_make_oid_cell(x1)) +#define list_make2_oid(x1,x2) \ + list_make2_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2)) +#define list_make3_oid(x1,x2,x3) \ + list_make3_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2), \ + list_make_oid_cell(x3)) +#define list_make4_oid(x1,x2,x3,x4) \ + list_make4_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2), \ + list_make_oid_cell(x3), list_make_oid_cell(x4)) +#define list_make5_oid(x1,x2,x3,x4,x5) \ + list_make5_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2), \ + list_make_oid_cell(x3), list_make_oid_cell(x4), \ + list_make_oid_cell(x5)) + +#define list_make1_xid(x1) \ + list_make1_impl(T_XidList, list_make_xid_cell(x1)) +#define list_make2_xid(x1,x2) \ + list_make2_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2)) +#define list_make3_xid(x1,x2,x3) \ + list_make3_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2), \ + list_make_xid_cell(x3)) +#define list_make4_xid(x1,x2,x3,x4) \ + list_make4_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2), \ + list_make_xid_cell(x3), list_make_xid_cell(x4)) +#define list_make5_xid(x1,x2,x3,x4,x5) \ + list_make5_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2), \ + list_make_xid_cell(x3), list_make_xid_cell(x4), \ + list_make_xid_cell(x5)) + +/* + * Locate the n'th cell (counting from 0) of the list. + * It is an assertion failure if there is no such cell. + */ +static inline ListCell * +list_nth_cell(const List *list, int n) +{ + Assert(list != NIL); + Assert(n >= 0 && n < list->length); + return &list->elements[n]; +} + +/* + * Return the last cell in a non-NIL List. + */ +static inline ListCell * +list_last_cell(const List *list) +{ + Assert(list != NIL); + return &list->elements[list->length - 1]; +} + +/* + * Return the pointer value contained in the n'th element of the + * specified list. (List elements begin at 0.) + */ +static inline void * +list_nth(const List *list, int n) +{ + Assert(IsA(list, List)); + return lfirst(list_nth_cell(list, n)); +} + +/* + * Return the integer value contained in the n'th element of the + * specified list. + */ +static inline int +list_nth_int(const List *list, int n) +{ + Assert(IsA(list, IntList)); + return lfirst_int(list_nth_cell(list, n)); +} + +/* + * Return the OID value contained in the n'th element of the specified + * list. + */ +static inline Oid +list_nth_oid(const List *list, int n) +{ + Assert(IsA(list, OidList)); + return lfirst_oid(list_nth_cell(list, n)); +} + +#define list_nth_node(type,list,n) castNode(type, list_nth(list, n)) + +/* + * Get the given ListCell's index (from 0) in the given List. + */ +static inline int +list_cell_number(const List *l, const ListCell *c) +{ + Assert(c >= &l->elements[0] && c < &l->elements[l->length]); + return c - l->elements; +} + +/* + * Get the address of the next cell after "c" within list "l", or NULL if none. + */ +static inline ListCell * +lnext(const List *l, const ListCell *c) +{ + Assert(c >= &l->elements[0] && c < &l->elements[l->length]); + c++; + if (c < &l->elements[l->length]) + return (ListCell *) c; + else + return NULL; +} + +/* + * foreach - + * a convenience macro for looping through a list + * + * "cell" must be the name of a "ListCell *" variable; it's made to point + * to each List element in turn. "cell" will be NULL after normal exit from + * the loop, but an early "break" will leave it pointing at the current + * List element. + * + * Beware of changing the List object while the loop is iterating. + * The current semantics are that we examine successive list indices in + * each iteration, so that insertion or deletion of list elements could + * cause elements to be re-visited or skipped unexpectedly. Previous + * implementations of foreach() behaved differently. However, it's safe + * to append elements to the List (or in general, insert them after the + * current element); such new elements are guaranteed to be visited. + * Also, the current element of the List can be deleted, if you use + * foreach_delete_current() to do so. BUT: either of these actions will + * invalidate the "cell" pointer for the remainder of the current iteration. + */ +#define foreach(cell, lst) \ + for (ForEachState cell##__state = {(lst), 0}; \ + (cell##__state.l != NIL && \ + cell##__state.i < cell##__state.l->length) ? \ + (cell = &cell##__state.l->elements[cell##__state.i], true) : \ + (cell = NULL, false); \ + cell##__state.i++) + +/* + * foreach_delete_current - + * delete the current list element from the List associated with a + * surrounding foreach() or foreach_*() loop, returning the new List + * pointer; pass the name of the iterator variable. + * + * This is similar to list_delete_cell(), but it also adjusts the loop's state + * so that no list elements will be missed. Do not delete elements from an + * active foreach or foreach_* loop's list in any other way! + */ +#define foreach_delete_current(lst, var_or_cell) \ + ((List *) (var_or_cell##__state.l = list_delete_nth_cell(lst, var_or_cell##__state.i--))) + +/* + * foreach_current_index - + * get the zero-based list index of a surrounding foreach() or foreach_*() + * loop's current element; pass the name of the iterator variable. + * + * Beware of using this after foreach_delete_current(); the value will be + * out of sync for the rest of the current loop iteration. Anyway, since + * you just deleted the current element, the value is pretty meaningless. + */ +#define foreach_current_index(var_or_cell) (var_or_cell##__state.i) + +/* + * for_each_from - + * Like foreach(), but start from the N'th (zero-based) list element, + * not necessarily the first one. + * + * It's okay for N to exceed the list length, but not for it to be negative. + * + * The caveats for foreach() apply equally here. + */ +#define for_each_from(cell, lst, N) \ + for (ForEachState cell##__state = for_each_from_setup(lst, N); \ + (cell##__state.l != NIL && \ + cell##__state.i < cell##__state.l->length) ? \ + (cell = &cell##__state.l->elements[cell##__state.i], true) : \ + (cell = NULL, false); \ + cell##__state.i++) + +static inline ForEachState +for_each_from_setup(const List *lst, int N) +{ + ForEachState r = {lst, N}; + + Assert(N >= 0); + return r; +} + +/* + * for_each_cell - + * a convenience macro which loops through a list starting from a + * specified cell + * + * The caveats for foreach() apply equally here. + */ +#define for_each_cell(cell, lst, initcell) \ + for (ForEachState cell##__state = for_each_cell_setup(lst, initcell); \ + (cell##__state.l != NIL && \ + cell##__state.i < cell##__state.l->length) ? \ + (cell = &cell##__state.l->elements[cell##__state.i], true) : \ + (cell = NULL, false); \ + cell##__state.i++) + +static inline ForEachState +for_each_cell_setup(const List *lst, const ListCell *initcell) +{ + ForEachState r = {lst, + initcell ? list_cell_number(lst, initcell) : list_length(lst)}; + + return r; +} + +/* + * Convenience macros that loop through a list without needing a separate + * "ListCell *" variable. Instead, the macros declare a locally-scoped loop + * variable with the provided name and the appropriate type. + * + * Since the variable is scoped to the loop, it's not possible to detect an + * early break by checking its value after the loop completes, as is common + * practice. If you need to do this, you can either use foreach() instead or + * manually track early breaks with a separate variable declared outside of the + * loop. + * + * Note that the caveats described in the comment above the foreach() macro + * also apply to these convenience macros. + */ +#define foreach_ptr(type, var, lst) foreach_internal(type, *, var, lst, lfirst) +#define foreach_int(var, lst) foreach_internal(int, , var, lst, lfirst_int) +#define foreach_oid(var, lst) foreach_internal(Oid, , var, lst, lfirst_oid) +#define foreach_xid(var, lst) foreach_internal(TransactionId, , var, lst, lfirst_xid) + +/* + * The internal implementation of the above macros. Do not use directly. + * + * This macro actually generates two loops in order to declare two variables of + * different types. The outer loop only iterates once, so we expect optimizing + * compilers will unroll it, thereby optimizing it away. + */ +#define foreach_internal(type, pointer, var, lst, func) \ + for (type pointer var = 0, pointer var##__outerloop = (type pointer) 1; \ + var##__outerloop; \ + var##__outerloop = 0) \ + for (ForEachState var##__state = {(lst), 0}; \ + (var##__state.l != NIL && \ + var##__state.i < var##__state.l->length && \ + (var = (type pointer) func(&var##__state.l->elements[var##__state.i]), true)); \ + var##__state.i++) + +/* + * foreach_node - + * The same as foreach_ptr, but asserts that the element is of the specified + * node type. + */ +#define foreach_node(type, var, lst) \ + for (type * var = 0, *var##__outerloop = (type *) 1; \ + var##__outerloop; \ + var##__outerloop = 0) \ + for (ForEachState var##__state = {(lst), 0}; \ + (var##__state.l != NIL && \ + var##__state.i < var##__state.l->length && \ + (var = lfirst_node(type, &var##__state.l->elements[var##__state.i]), true)); \ + var##__state.i++) + +/* + * forboth - + * a convenience macro for advancing through two linked lists + * simultaneously. This macro loops through both lists at the same + * time, stopping when either list runs out of elements. Depending + * on the requirements of the call site, it may also be wise to + * assert that the lengths of the two lists are equal. (But, if they + * are not, some callers rely on the ending cell values being separately + * NULL or non-NULL as defined here; don't try to optimize that.) + * + * The caveats for foreach() apply equally here. + */ +#define forboth(cell1, list1, cell2, list2) \ + for (ForBothState cell1##__state = {(list1), (list2), 0}; \ + multi_for_advance_cell(cell1, cell1##__state, l1, i), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i), \ + (cell1 != NULL && cell2 != NULL); \ + cell1##__state.i++) + +#define multi_for_advance_cell(cell, state, l, i) \ + (cell = (state.l != NIL && state.i < state.l->length) ? \ + &state.l->elements[state.i] : NULL) + +/* + * for_both_cell - + * a convenience macro which loops through two lists starting from the + * specified cells of each. This macro loops through both lists at the same + * time, stopping when either list runs out of elements. Depending on the + * requirements of the call site, it may also be wise to assert that the + * lengths of the two lists are equal, and initcell1 and initcell2 are at + * the same position in the respective lists. + * + * The caveats for foreach() apply equally here. + */ +#define for_both_cell(cell1, list1, initcell1, cell2, list2, initcell2) \ + for (ForBothCellState cell1##__state = \ + for_both_cell_setup(list1, initcell1, list2, initcell2); \ + multi_for_advance_cell(cell1, cell1##__state, l1, i1), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i2), \ + (cell1 != NULL && cell2 != NULL); \ + cell1##__state.i1++, cell1##__state.i2++) + +static inline ForBothCellState +for_both_cell_setup(const List *list1, const ListCell *initcell1, + const List *list2, const ListCell *initcell2) +{ + ForBothCellState r = {list1, list2, + initcell1 ? list_cell_number(list1, initcell1) : list_length(list1), + initcell2 ? list_cell_number(list2, initcell2) : list_length(list2)}; + + return r; +} + +/* + * forthree - + * the same for three lists + */ +#define forthree(cell1, list1, cell2, list2, cell3, list3) \ + for (ForThreeState cell1##__state = {(list1), (list2), (list3), 0}; \ + multi_for_advance_cell(cell1, cell1##__state, l1, i), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i), \ + multi_for_advance_cell(cell3, cell1##__state, l3, i), \ + (cell1 != NULL && cell2 != NULL && cell3 != NULL); \ + cell1##__state.i++) + +/* + * forfour - + * the same for four lists + */ +#define forfour(cell1, list1, cell2, list2, cell3, list3, cell4, list4) \ + for (ForFourState cell1##__state = {(list1), (list2), (list3), (list4), 0}; \ + multi_for_advance_cell(cell1, cell1##__state, l1, i), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i), \ + multi_for_advance_cell(cell3, cell1##__state, l3, i), \ + multi_for_advance_cell(cell4, cell1##__state, l4, i), \ + (cell1 != NULL && cell2 != NULL && cell3 != NULL && cell4 != NULL); \ + cell1##__state.i++) + +/* + * forfive - + * the same for five lists + */ +#define forfive(cell1, list1, cell2, list2, cell3, list3, cell4, list4, cell5, list5) \ + for (ForFiveState cell1##__state = {(list1), (list2), (list3), (list4), (list5), 0}; \ + multi_for_advance_cell(cell1, cell1##__state, l1, i), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i), \ + multi_for_advance_cell(cell3, cell1##__state, l3, i), \ + multi_for_advance_cell(cell4, cell1##__state, l4, i), \ + multi_for_advance_cell(cell5, cell1##__state, l5, i), \ + (cell1 != NULL && cell2 != NULL && cell3 != NULL && \ + cell4 != NULL && cell5 != NULL); \ + cell1##__state.i++) + +/* Functions in src/backend/nodes/list.c */ + +extern List *list_make1_impl(NodeTag t, ListCell datum1); +extern List *list_make2_impl(NodeTag t, ListCell datum1, ListCell datum2); +extern List *list_make3_impl(NodeTag t, ListCell datum1, ListCell datum2, + ListCell datum3); +extern List *list_make4_impl(NodeTag t, ListCell datum1, ListCell datum2, + ListCell datum3, ListCell datum4); +extern List *list_make5_impl(NodeTag t, ListCell datum1, ListCell datum2, + ListCell datum3, ListCell datum4, + ListCell datum5); + +pg_nodiscard extern List *lappend(List *list, void *datum); +pg_nodiscard extern List *lappend_int(List *list, int datum); +pg_nodiscard extern List *lappend_oid(List *list, Oid datum); +pg_nodiscard extern List *lappend_xid(List *list, TransactionId datum); + +pg_nodiscard extern List *list_insert_nth(List *list, int pos, void *datum); +pg_nodiscard extern List *list_insert_nth_int(List *list, int pos, int datum); +pg_nodiscard extern List *list_insert_nth_oid(List *list, int pos, Oid datum); + +pg_nodiscard extern List *lcons(void *datum, List *list); +pg_nodiscard extern List *lcons_int(int datum, List *list); +pg_nodiscard extern List *lcons_oid(Oid datum, List *list); + +pg_nodiscard extern List *list_concat(List *list1, const List *list2); +pg_nodiscard extern List *list_concat_copy(const List *list1, const List *list2); + +pg_nodiscard extern List *list_truncate(List *list, int new_size); + +extern bool list_member(const List *list, const void *datum); +extern bool list_member_ptr(const List *list, const void *datum); +extern bool list_member_int(const List *list, int datum); +extern bool list_member_oid(const List *list, Oid datum); +extern bool list_member_xid(const List *list, TransactionId datum); + +pg_nodiscard extern List *list_delete(List *list, void *datum); +pg_nodiscard extern List *list_delete_ptr(List *list, void *datum); +pg_nodiscard extern List *list_delete_int(List *list, int datum); +pg_nodiscard extern List *list_delete_oid(List *list, Oid datum); +pg_nodiscard extern List *list_delete_first(List *list); +pg_nodiscard extern List *list_delete_last(List *list); +pg_nodiscard extern List *list_delete_first_n(List *list, int n); +pg_nodiscard extern List *list_delete_nth_cell(List *list, int n); +pg_nodiscard extern List *list_delete_cell(List *list, ListCell *cell); + +extern List *list_union(const List *list1, const List *list2); +extern List *list_union_ptr(const List *list1, const List *list2); +extern List *list_union_int(const List *list1, const List *list2); +extern List *list_union_oid(const List *list1, const List *list2); + +extern List *list_intersection(const List *list1, const List *list2); +extern List *list_intersection_int(const List *list1, const List *list2); + +/* currently, there's no need for list_intersection_ptr etc */ + +extern List *list_difference(const List *list1, const List *list2); +extern List *list_difference_ptr(const List *list1, const List *list2); +extern List *list_difference_int(const List *list1, const List *list2); +extern List *list_difference_oid(const List *list1, const List *list2); + +pg_nodiscard extern List *list_append_unique(List *list, void *datum); +pg_nodiscard extern List *list_append_unique_ptr(List *list, void *datum); +pg_nodiscard extern List *list_append_unique_int(List *list, int datum); +pg_nodiscard extern List *list_append_unique_oid(List *list, Oid datum); + +pg_nodiscard extern List *list_concat_unique(List *list1, const List *list2); +pg_nodiscard extern List *list_concat_unique_ptr(List *list1, const List *list2); +pg_nodiscard extern List *list_concat_unique_int(List *list1, const List *list2); +pg_nodiscard extern List *list_concat_unique_oid(List *list1, const List *list2); + +extern void list_deduplicate_oid(List *list); + +extern void list_free(List *list); +extern void list_free_deep(List *list); + +pg_nodiscard extern List *list_copy(const List *oldlist); +pg_nodiscard extern List *list_copy_head(const List *oldlist, int len); +pg_nodiscard extern List *list_copy_tail(const List *oldlist, int nskip); +pg_nodiscard extern List *list_copy_deep(const List *oldlist); + +typedef int (*list_sort_comparator) (const ListCell *a, const ListCell *b); +extern void list_sort(List *list, list_sort_comparator cmp); + +extern int list_int_cmp(const ListCell *p1, const ListCell *p2); +extern int list_oid_cmp(const ListCell *p1, const ListCell *p2); + +#endif /* PG_LIST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/plannodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/plannodes.h new file mode 100644 index 0000000..4f59e30 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/plannodes.h @@ -0,0 +1,1767 @@ +/*------------------------------------------------------------------------- + * + * plannodes.h + * definitions for query plan nodes + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/plannodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANNODES_H +#define PLANNODES_H + +#include "access/sdir.h" +#include "access/stratnum.h" +#include "common/relpath.h" +#include "lib/stringinfo.h" +#include "nodes/bitmapset.h" +#include "nodes/lockoptions.h" +#include "nodes/primnodes.h" + + +/* ---------------------------------------------------------------- + * node definitions + * ---------------------------------------------------------------- + */ + +/* ---------------- + * PlannedStmt node + * + * The output of the planner is a Plan tree headed by a PlannedStmt node. + * PlannedStmt holds the "one time" information needed by the executor. + * + * For simplicity in APIs, we also wrap utility statements in PlannedStmt + * nodes; in such cases, commandType == CMD_UTILITY, the statement itself + * is in the utilityStmt field, and the rest of the struct is mostly dummy. + * (We do use canSetTag, stmt_location, stmt_len, and possibly queryId.) + * + * PlannedStmt, as well as all varieties of Plan, do not support equal(), + * not because it's not sensible but because we currently have no need. + * ---------------- + */ +typedef struct PlannedStmt +{ + pg_node_attr(no_equal, no_query_jumble) + + NodeTag type; + + /* select|insert|update|delete|merge|utility */ + CmdType commandType; + + /* query identifier (copied from Query) */ + int64 queryId; + + /* plan identifier (can be set by plugins) */ + int64 planId; + + /* is it insert|update|delete|merge RETURNING? */ + bool hasReturning; + + /* has insert|update|delete|merge in WITH? */ + bool hasModifyingCTE; + + /* do I set the command result tag? */ + bool canSetTag; + + /* redo plan when TransactionXmin changes? */ + bool transientPlan; + + /* is plan specific to current role? */ + bool dependsOnRole; + + /* parallel mode required to execute? */ + bool parallelModeNeeded; + + /* which forms of JIT should be performed */ + int jitFlags; + + /* tree of Plan nodes */ + struct Plan *planTree; + + /* + * List of PartitionPruneInfo contained in the plan + */ + List *partPruneInfos; + + /* list of RangeTblEntry nodes */ + List *rtable; + + /* + * RT indexes of relations that are not subject to runtime pruning or are + * needed to perform runtime pruning + */ + Bitmapset *unprunableRelids; + + /* + * list of RTEPermissionInfo nodes for rtable entries needing one + */ + List *permInfos; + + /* rtable indexes of target relations for INSERT/UPDATE/DELETE/MERGE */ + /* integer list of RT indexes, or NIL */ + List *resultRelations; + + /* list of AppendRelInfo nodes */ + List *appendRelations; + + /* + * Plan trees for SubPlan expressions; note that some could be NULL + */ + List *subplans; + + /* indices of subplans that require REWIND */ + Bitmapset *rewindPlanIDs; + + /* a list of PlanRowMark's */ + List *rowMarks; + + /* OIDs of relations the plan depends on */ + List *relationOids; + + /* other dependencies, as PlanInvalItems */ + List *invalItems; + + /* type OIDs for PARAM_EXEC Params */ + List *paramExecTypes; + + /* non-null if this is utility stmt */ + Node *utilityStmt; + + /* statement location in source string (copied from Query) */ + /* start location, or -1 if unknown */ + ParseLoc stmt_location; + /* length in bytes; 0 means "rest of string" */ + ParseLoc stmt_len; +} PlannedStmt; + +/* macro for fetching the Plan associated with a SubPlan node */ +#define exec_subplan_get_plan(plannedstmt, subplan) \ + ((Plan *) list_nth((plannedstmt)->subplans, (subplan)->plan_id - 1)) + + +/* ---------------- + * Plan node + * + * All plan nodes "derive" from the Plan structure by having the + * Plan structure as the first field. This ensures that everything works + * when nodes are cast to Plan's. (node pointers are frequently cast to Plan* + * when passed around generically in the executor) + * + * We never actually instantiate any Plan nodes; this is just the common + * abstract superclass for all Plan-type nodes. + * ---------------- + */ +typedef struct Plan +{ + pg_node_attr(abstract, no_equal, no_query_jumble) + + NodeTag type; + + /* + * estimated execution costs for plan (see costsize.c for more info) + */ + /* count of disabled nodes */ + int disabled_nodes; + /* cost expended before fetching any tuples */ + Cost startup_cost; + /* total cost (assuming all tuples fetched) */ + Cost total_cost; + + /* + * planner's estimate of result size of this plan step + */ + /* number of rows plan is expected to emit */ + Cardinality plan_rows; + /* average row width in bytes */ + int plan_width; + + /* + * information needed for parallel query + */ + /* engage parallel-aware logic? */ + bool parallel_aware; + /* OK to use as part of parallel plan? */ + bool parallel_safe; + + /* + * information needed for asynchronous execution + */ + /* engage asynchronous-capable logic? */ + bool async_capable; + + /* + * Common structural data for all Plan types. + */ + /* unique across entire final plan tree */ + int plan_node_id; + /* target list to be computed at this node */ + List *targetlist; + /* implicitly-ANDed qual conditions */ + List *qual; + /* input plan tree(s) */ + struct Plan *lefttree; + struct Plan *righttree; + /* Init Plan nodes (un-correlated expr subselects) */ + List *initPlan; + + /* + * Information for management of parameter-change-driven rescanning + * + * extParam includes the paramIDs of all external PARAM_EXEC params + * affecting this plan node or its children. setParam params from the + * node's initPlans are not included, but their extParams are. + * + * allParam includes all the extParam paramIDs, plus the IDs of local + * params that affect the node (i.e., the setParams of its initplans). + * These are _all_ the PARAM_EXEC params that affect this node. + */ + Bitmapset *extParam; + Bitmapset *allParam; +} Plan; + +/* ---------------- + * these are defined to avoid confusion problems with "left" + * and "right" and "inner" and "outer". The convention is that + * the "left" plan is the "outer" plan and the "right" plan is + * the inner plan, but these make the code more readable. + * ---------------- + */ +#define innerPlan(node) (((Plan *)(node))->righttree) +#define outerPlan(node) (((Plan *)(node))->lefttree) + + +/* ---------------- + * Result node - + * If no outer plan, evaluate a variable-free targetlist. + * If outer plan, return tuples from outer plan (after a level of + * projection as shown by targetlist). + * + * If resconstantqual isn't NULL, it represents a one-time qualification + * test (i.e., one that doesn't depend on any variables from the outer plan, + * so needs to be evaluated only once). + * ---------------- + */ +typedef struct Result +{ + Plan plan; + Node *resconstantqual; +} Result; + +/* ---------------- + * ProjectSet node - + * Apply a projection that includes set-returning functions to the + * output tuples of the outer plan. + * ---------------- + */ +typedef struct ProjectSet +{ + Plan plan; +} ProjectSet; + +/* ---------------- + * ModifyTable node - + * Apply rows produced by outer plan to result table(s), + * by inserting, updating, or deleting. + * + * If the originally named target table is a partitioned table or inheritance + * tree, both nominalRelation and rootRelation contain the RT index of the + * partition root or appendrel RTE, which is not otherwise mentioned in the + * plan. Otherwise rootRelation is zero. However, nominalRelation will + * always be set, as it's the rel that EXPLAIN should claim is the + * INSERT/UPDATE/DELETE/MERGE target. + * + * Note that rowMarks and epqParam are presumed to be valid for all the + * table(s); they can't contain any info that varies across tables. + * ---------------- + */ +typedef struct ModifyTable +{ + Plan plan; + /* INSERT, UPDATE, DELETE, or MERGE */ + CmdType operation; + /* do we set the command tag/es_processed? */ + bool canSetTag; + /* Parent RT index for use of EXPLAIN */ + Index nominalRelation; + /* Root RT index, if partitioned/inherited */ + Index rootRelation; + /* some part key in hierarchy updated? */ + bool partColsUpdated; + /* integer list of RT indexes */ + List *resultRelations; + /* per-target-table update_colnos lists */ + List *updateColnosLists; + /* per-target-table WCO lists */ + List *withCheckOptionLists; + /* alias for OLD in RETURNING lists */ + char *returningOldAlias; + /* alias for NEW in RETURNING lists */ + char *returningNewAlias; + /* per-target-table RETURNING tlists */ + List *returningLists; + /* per-target-table FDW private data lists */ + List *fdwPrivLists; + /* indices of FDW DM plans */ + Bitmapset *fdwDirectModifyPlans; + /* PlanRowMarks (non-locking only) */ + List *rowMarks; + /* ID of Param for EvalPlanQual re-eval */ + int epqParam; + /* ON CONFLICT action */ + OnConflictAction onConflictAction; + /* List of ON CONFLICT arbiter index OIDs */ + List *arbiterIndexes; + /* INSERT ON CONFLICT DO UPDATE targetlist */ + List *onConflictSet; + /* target column numbers for onConflictSet */ + List *onConflictCols; + /* WHERE for ON CONFLICT UPDATE */ + Node *onConflictWhere; + /* RTI of the EXCLUDED pseudo relation */ + Index exclRelRTI; + /* tlist of the EXCLUDED pseudo relation */ + List *exclRelTlist; + /* per-target-table lists of actions for MERGE */ + List *mergeActionLists; + /* per-target-table join conditions for MERGE */ + List *mergeJoinConditions; +} ModifyTable; + +struct PartitionPruneInfo; /* forward reference to struct below */ + +/* ---------------- + * Append node - + * Generate the concatenation of the results of sub-plans. + * ---------------- + */ +typedef struct Append +{ + Plan plan; + /* RTIs of appendrel(s) formed by this node */ + Bitmapset *apprelids; + List *appendplans; + /* # of asynchronous plans */ + int nasyncplans; + + /* + * All 'appendplans' preceding this index are non-partial plans. All + * 'appendplans' from this index onwards are partial plans. + */ + int first_partial_plan; + + /* + * Index into PlannedStmt.partPruneInfos and parallel lists in EState: + * es_part_prune_states and es_part_prune_results. Set to -1 if no + * run-time pruning is used. + */ + int part_prune_index; +} Append; + +/* ---------------- + * MergeAppend node - + * Merge the results of pre-sorted sub-plans to preserve the ordering. + * ---------------- + */ +typedef struct MergeAppend +{ + Plan plan; + + /* RTIs of appendrel(s) formed by this node */ + Bitmapset *apprelids; + + List *mergeplans; + + /* these fields are just like the sort-key info in struct Sort: */ + + /* number of sort-key columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *sortColIdx pg_node_attr(array_size(numCols)); + + /* OIDs of operators to sort them by */ + Oid *sortOperators pg_node_attr(array_size(numCols)); + + /* OIDs of collations */ + Oid *collations pg_node_attr(array_size(numCols)); + + /* NULLS FIRST/LAST directions */ + bool *nullsFirst pg_node_attr(array_size(numCols)); + + /* + * Index into PlannedStmt.partPruneInfos and parallel lists in EState: + * es_part_prune_states and es_part_prune_results. Set to -1 if no + * run-time pruning is used. + */ + int part_prune_index; +} MergeAppend; + +/* ---------------- + * RecursiveUnion node - + * Generate a recursive union of two subplans. + * + * The "outer" subplan is always the non-recursive term, and the "inner" + * subplan is the recursive term. + * ---------------- + */ +typedef struct RecursiveUnion +{ + Plan plan; + + /* ID of Param representing work table */ + int wtParam; + + /* Remaining fields are zero/null in UNION ALL case */ + + /* number of columns to check for duplicate-ness */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *dupColIdx pg_node_attr(array_size(numCols)); + + /* equality operators to compare with */ + Oid *dupOperators pg_node_attr(array_size(numCols)); + Oid *dupCollations pg_node_attr(array_size(numCols)); + + /* estimated number of groups in input */ + long numGroups; +} RecursiveUnion; + +/* ---------------- + * BitmapAnd node - + * Generate the intersection of the results of sub-plans. + * + * The subplans must be of types that yield tuple bitmaps. The targetlist + * and qual fields of the plan are unused and are always NIL. + * ---------------- + */ +typedef struct BitmapAnd +{ + Plan plan; + List *bitmapplans; +} BitmapAnd; + +/* ---------------- + * BitmapOr node - + * Generate the union of the results of sub-plans. + * + * The subplans must be of types that yield tuple bitmaps. The targetlist + * and qual fields of the plan are unused and are always NIL. + * ---------------- + */ +typedef struct BitmapOr +{ + Plan plan; + bool isshared; + List *bitmapplans; +} BitmapOr; + +/* + * ========== + * Scan nodes + * + * Scan is an abstract type that all relation scan plan types inherit from. + * ========== + */ +typedef struct Scan +{ + pg_node_attr(abstract) + + Plan plan; + /* relid is index into the range table */ + Index scanrelid; +} Scan; + +/* ---------------- + * sequential scan node + * ---------------- + */ +typedef struct SeqScan +{ + Scan scan; +} SeqScan; + +/* ---------------- + * table sample scan node + * ---------------- + */ +typedef struct SampleScan +{ + Scan scan; + /* use struct pointer to avoid including parsenodes.h here */ + struct TableSampleClause *tablesample; +} SampleScan; + +/* ---------------- + * index scan node + * + * indexqualorig is an implicitly-ANDed list of index qual expressions, each + * in the same form it appeared in the query WHERE condition. Each should + * be of the form (indexkey OP comparisonval) or (comparisonval OP indexkey). + * The indexkey is a Var or expression referencing column(s) of the index's + * base table. The comparisonval might be any expression, but it won't use + * any columns of the base table. The expressions are ordered by index + * column position (but items referencing the same index column can appear + * in any order). indexqualorig is used at runtime only if we have to recheck + * a lossy indexqual. + * + * indexqual has the same form, but the expressions have been commuted if + * necessary to put the indexkeys on the left, and the indexkeys are replaced + * by Var nodes identifying the index columns (their varno is INDEX_VAR and + * their varattno is the index column number). + * + * indexorderbyorig is similarly the original form of any ORDER BY expressions + * that are being implemented by the index, while indexorderby is modified to + * have index column Vars on the left-hand side. Here, multiple expressions + * must appear in exactly the ORDER BY order, and this is not necessarily the + * index column order. Only the expressions are provided, not the auxiliary + * sort-order information from the ORDER BY SortGroupClauses; it's assumed + * that the sort ordering is fully determinable from the top-level operators. + * indexorderbyorig is used at runtime to recheck the ordering, if the index + * cannot calculate an accurate ordering. It is also needed for EXPLAIN. + * + * indexorderbyops is a list of the OIDs of the operators used to sort the + * ORDER BY expressions. This is used together with indexorderbyorig to + * recheck ordering at run time. (Note that indexorderby, indexorderbyorig, + * and indexorderbyops are used for amcanorderbyop cases, not amcanorder.) + * + * indexorderdir specifies the scan ordering, for indexscans on amcanorder + * indexes (for other indexes it should be "don't care"). + * ---------------- + */ +typedef struct IndexScan +{ + Scan scan; + /* OID of index to scan */ + Oid indexid; + /* list of index quals (usually OpExprs) */ + List *indexqual; + /* the same in original form */ + List *indexqualorig; + /* list of index ORDER BY exprs */ + List *indexorderby; + /* the same in original form */ + List *indexorderbyorig; + /* OIDs of sort ops for ORDER BY exprs */ + List *indexorderbyops; + /* forward or backward or don't care */ + ScanDirection indexorderdir; +} IndexScan; + +/* ---------------- + * index-only scan node + * + * IndexOnlyScan is very similar to IndexScan, but it specifies an + * index-only scan, in which the data comes from the index not the heap. + * Because of this, *all* Vars in the plan node's targetlist, qual, and + * index expressions reference index columns and have varno = INDEX_VAR. + * + * We could almost use indexqual directly against the index's output tuple + * when rechecking lossy index operators, but that won't work for quals on + * index columns that are not retrievable. Hence, recheckqual is needed + * for rechecks: it expresses the same condition as indexqual, but using + * only index columns that are retrievable. (We will not generate an + * index-only scan if this is not possible. An example is that if an + * index has table column "x" in a retrievable index column "ind1", plus + * an expression f(x) in a non-retrievable column "ind2", an indexable + * query on f(x) will use "ind2" in indexqual and f(ind1) in recheckqual. + * Without the "ind1" column, an index-only scan would be disallowed.) + * + * We don't currently need a recheckable equivalent of indexorderby, + * because we don't support lossy operators in index ORDER BY. + * + * To help EXPLAIN interpret the index Vars for display, we provide + * indextlist, which represents the contents of the index as a targetlist + * with one TLE per index column. Vars appearing in this list reference + * the base table, and this is the only field in the plan node that may + * contain such Vars. Also, for the convenience of setrefs.c, TLEs in + * indextlist are marked as resjunk if they correspond to columns that + * the index AM cannot reconstruct. + * ---------------- + */ +typedef struct IndexOnlyScan +{ + Scan scan; + /* OID of index to scan */ + Oid indexid; + /* list of index quals (usually OpExprs) */ + List *indexqual; + /* index quals in recheckable form */ + List *recheckqual; + /* list of index ORDER BY exprs */ + List *indexorderby; + /* TargetEntry list describing index's cols */ + List *indextlist; + /* forward or backward or don't care */ + ScanDirection indexorderdir; +} IndexOnlyScan; + +/* ---------------- + * bitmap index scan node + * + * BitmapIndexScan delivers a bitmap of potential tuple locations; + * it does not access the heap itself. The bitmap is used by an + * ancestor BitmapHeapScan node, possibly after passing through + * intermediate BitmapAnd and/or BitmapOr nodes to combine it with + * the results of other BitmapIndexScans. + * + * The fields have the same meanings as for IndexScan, except we don't + * store a direction flag because direction is uninteresting. + * + * In a BitmapIndexScan plan node, the targetlist and qual fields are + * not used and are always NIL. The indexqualorig field is unused at + * run time too, but is saved for the benefit of EXPLAIN. + * ---------------- + */ +typedef struct BitmapIndexScan +{ + Scan scan; + /* OID of index to scan */ + Oid indexid; + /* Create shared bitmap if set */ + bool isshared; + /* list of index quals (OpExprs) */ + List *indexqual; + /* the same in original form */ + List *indexqualorig; +} BitmapIndexScan; + +/* ---------------- + * bitmap sequential scan node + * + * This needs a copy of the qual conditions being used by the input index + * scans because there are various cases where we need to recheck the quals; + * for example, when the bitmap is lossy about the specific rows on a page + * that meet the index condition. + * ---------------- + */ +typedef struct BitmapHeapScan +{ + Scan scan; + /* index quals, in standard expr form */ + List *bitmapqualorig; +} BitmapHeapScan; + +/* ---------------- + * tid scan node + * + * tidquals is an implicitly OR'ed list of qual expressions of the form + * "CTID = pseudoconstant", or "CTID = ANY(pseudoconstant_array)", + * or a CurrentOfExpr for the relation. + * ---------------- + */ +typedef struct TidScan +{ + Scan scan; + /* qual(s) involving CTID = something */ + List *tidquals; +} TidScan; + +/* ---------------- + * tid range scan node + * + * tidrangequals is an implicitly AND'ed list of qual expressions of the form + * "CTID relop pseudoconstant", where relop is one of >,>=,<,<=. + * ---------------- + */ +typedef struct TidRangeScan +{ + Scan scan; + /* qual(s) involving CTID op something */ + List *tidrangequals; +} TidRangeScan; + +/* ---------------- + * subquery scan node + * + * SubqueryScan is for scanning the output of a sub-query in the range table. + * We often need an extra plan node above the sub-query's plan to perform + * expression evaluations (which we can't push into the sub-query without + * risking changing its semantics). Although we are not scanning a physical + * relation, we make this a descendant of Scan anyway for code-sharing + * purposes. + * + * SubqueryScanStatus caches the trivial_subqueryscan property of the node. + * SUBQUERY_SCAN_UNKNOWN means not yet determined. This is only used during + * planning. + * + * Note: we store the sub-plan in the type-specific subplan field, not in + * the generic lefttree field as you might expect. This is because we do + * not want plan-tree-traversal routines to recurse into the subplan without + * knowing that they are changing Query contexts. + * ---------------- + */ +typedef enum SubqueryScanStatus +{ + SUBQUERY_SCAN_UNKNOWN, + SUBQUERY_SCAN_TRIVIAL, + SUBQUERY_SCAN_NONTRIVIAL, +} SubqueryScanStatus; + +typedef struct SubqueryScan +{ + Scan scan; + Plan *subplan; + SubqueryScanStatus scanstatus; +} SubqueryScan; + +/* ---------------- + * FunctionScan node + * ---------------- + */ +typedef struct FunctionScan +{ + Scan scan; + /* list of RangeTblFunction nodes */ + List *functions; + /* WITH ORDINALITY */ + bool funcordinality; +} FunctionScan; + +/* ---------------- + * ValuesScan node + * ---------------- + */ +typedef struct ValuesScan +{ + Scan scan; + /* list of expression lists */ + List *values_lists; +} ValuesScan; + +/* ---------------- + * TableFunc scan node + * ---------------- + */ +typedef struct TableFuncScan +{ + Scan scan; + /* table function node */ + TableFunc *tablefunc; +} TableFuncScan; + +/* ---------------- + * CteScan node + * ---------------- + */ +typedef struct CteScan +{ + Scan scan; + /* ID of init SubPlan for CTE */ + int ctePlanId; + /* ID of Param representing CTE output */ + int cteParam; +} CteScan; + +/* ---------------- + * NamedTuplestoreScan node + * ---------------- + */ +typedef struct NamedTuplestoreScan +{ + Scan scan; + /* Name given to Ephemeral Named Relation */ + char *enrname; +} NamedTuplestoreScan; + +/* ---------------- + * WorkTableScan node + * ---------------- + */ +typedef struct WorkTableScan +{ + Scan scan; + /* ID of Param representing work table */ + int wtParam; +} WorkTableScan; + +/* ---------------- + * ForeignScan node + * + * fdw_exprs and fdw_private are both under the control of the foreign-data + * wrapper, but fdw_exprs is presumed to contain expression trees and will + * be post-processed accordingly by the planner; fdw_private won't be. + * Note that everything in both lists must be copiable by copyObject(). + * One way to store an arbitrary blob of bytes is to represent it as a bytea + * Const. Usually, though, you'll be better off choosing a representation + * that can be dumped usefully by nodeToString(). + * + * fdw_scan_tlist is a targetlist describing the contents of the scan tuple + * returned by the FDW; it can be NIL if the scan tuple matches the declared + * rowtype of the foreign table, which is the normal case for a simple foreign + * table scan. (If the plan node represents a foreign join, fdw_scan_tlist + * is required since there is no rowtype available from the system catalogs.) + * When fdw_scan_tlist is provided, Vars in the node's tlist and quals must + * have varno INDEX_VAR, and their varattnos correspond to resnos in the + * fdw_scan_tlist (which are also column numbers in the actual scan tuple). + * fdw_scan_tlist is never actually executed; it just holds expression trees + * describing what is in the scan tuple's columns. + * + * fdw_recheck_quals should contain any quals which the core system passed to + * the FDW but which were not added to scan.plan.qual; that is, it should + * contain the quals being checked remotely. This is needed for correct + * behavior during EvalPlanQual rechecks. + * + * When the plan node represents a foreign join, scan.scanrelid is zero and + * fs_relids must be consulted to identify the join relation. (fs_relids + * is valid for simple scans as well, but will always match scan.scanrelid.) + * fs_relids includes outer joins; fs_base_relids does not. + * + * If the FDW's PlanDirectModify() callback decides to repurpose a ForeignScan + * node to perform the UPDATE or DELETE operation directly in the remote + * server, it sets 'operation' and 'resultRelation' to identify the operation + * type and target relation. Note that these fields are only set if the + * modification is performed *fully* remotely; otherwise, the modification is + * driven by a local ModifyTable node and 'operation' is left to CMD_SELECT. + * ---------------- + */ +typedef struct ForeignScan +{ + Scan scan; + /* SELECT/INSERT/UPDATE/DELETE */ + CmdType operation; + /* direct modification target's RT index */ + Index resultRelation; + /* user to perform the scan as; 0 means to check as current user */ + Oid checkAsUser; + /* OID of foreign server */ + Oid fs_server; + /* expressions that FDW may evaluate */ + List *fdw_exprs; + /* private data for FDW */ + List *fdw_private; + /* optional tlist describing scan tuple */ + List *fdw_scan_tlist; + /* original quals not in scan.plan.qual */ + List *fdw_recheck_quals; + /* base+OJ RTIs generated by this scan */ + Bitmapset *fs_relids; + /* base RTIs generated by this scan */ + Bitmapset *fs_base_relids; + /* true if any "system column" is needed */ + bool fsSystemCol; +} ForeignScan; + +/* ---------------- + * CustomScan node + * + * The comments for ForeignScan's fdw_exprs, fdw_private, fdw_scan_tlist, + * and fs_relids fields apply equally to CustomScan's custom_exprs, + * custom_private, custom_scan_tlist, and custom_relids fields. The + * convention of setting scan.scanrelid to zero for joins applies as well. + * + * Note that since Plan trees can be copied, custom scan providers *must* + * fit all plan data they need into those fields; embedding CustomScan in + * a larger struct will not work. + * ---------------- + */ +struct CustomScanMethods; + +typedef struct CustomScan +{ + Scan scan; + /* mask of CUSTOMPATH_* flags, see nodes/extensible.h */ + uint32 flags; + /* list of Plan nodes, if any */ + List *custom_plans; + /* expressions that custom code may evaluate */ + List *custom_exprs; + /* private data for custom code */ + List *custom_private; + /* optional tlist describing scan tuple */ + List *custom_scan_tlist; + /* RTIs generated by this scan */ + Bitmapset *custom_relids; + + /* + * NOTE: The method field of CustomScan is required to be a pointer to a + * static table of callback functions. So we don't copy the table itself, + * just reference the original one. + */ + const struct CustomScanMethods *methods; +} CustomScan; + +/* + * ========== + * Join nodes + * ========== + */ + +/* ---------------- + * Join node + * + * jointype: rule for joining tuples from left and right subtrees + * inner_unique each outer tuple can match to no more than one inner tuple + * joinqual: qual conditions that came from JOIN/ON or JOIN/USING + * (plan.qual contains conditions that came from WHERE) + * + * When jointype is INNER, joinqual and plan.qual are semantically + * interchangeable. For OUTER jointypes, the two are *not* interchangeable; + * only joinqual is used to determine whether a match has been found for + * the purpose of deciding whether to generate null-extended tuples. + * (But plan.qual is still applied before actually returning a tuple.) + * For an outer join, only joinquals are allowed to be used as the merge + * or hash condition of a merge or hash join. + * + * inner_unique is set if the joinquals are such that no more than one inner + * tuple could match any given outer tuple. This allows the executor to + * skip searching for additional matches. (This must be provable from just + * the joinquals, ignoring plan.qual, due to where the executor tests it.) + * ---------------- + */ +typedef struct Join +{ + pg_node_attr(abstract) + + Plan plan; + JoinType jointype; + bool inner_unique; + /* JOIN quals (in addition to plan.qual) */ + List *joinqual; +} Join; + +/* ---------------- + * nest loop join node + * + * The nestParams list identifies any executor Params that must be passed + * into execution of the inner subplan carrying values from the current row + * of the outer subplan. Currently we restrict these values to be simple + * Vars, but perhaps someday that'd be worth relaxing. (Note: during plan + * creation, the paramval can actually be a PlaceHolderVar expression; but it + * must be a Var with varno OUTER_VAR by the time it gets to the executor.) + * ---------------- + */ +typedef struct NestLoop +{ + Join join; + /* list of NestLoopParam nodes */ + List *nestParams; +} NestLoop; + +typedef struct NestLoopParam +{ + pg_node_attr(no_equal, no_query_jumble) + + NodeTag type; + /* number of the PARAM_EXEC Param to set */ + int paramno; + /* outer-relation Var to assign to Param */ + Var *paramval; +} NestLoopParam; + +/* ---------------- + * merge join node + * + * The expected ordering of each mergeable column is described by a btree + * opfamily OID, a collation OID, a direction (BTLessStrategyNumber or + * BTGreaterStrategyNumber) and a nulls-first flag. Note that the two sides + * of each mergeclause may be of different datatypes, but they are ordered the + * same way according to the common opfamily and collation. The operator in + * each mergeclause must be an equality operator of the indicated opfamily. + * ---------------- + */ +typedef struct MergeJoin +{ + Join join; + + /* Can we skip mark/restore calls? */ + bool skip_mark_restore; + + /* mergeclauses as expression trees */ + List *mergeclauses; + + /* these are arrays, but have the same length as the mergeclauses list: */ + + /* per-clause OIDs of btree opfamilies */ + Oid *mergeFamilies pg_node_attr(array_size(mergeclauses)); + + /* per-clause OIDs of collations */ + Oid *mergeCollations pg_node_attr(array_size(mergeclauses)); + + /* per-clause ordering (ASC or DESC) */ + bool *mergeReversals pg_node_attr(array_size(mergeclauses)); + + /* per-clause nulls ordering */ + bool *mergeNullsFirst pg_node_attr(array_size(mergeclauses)); +} MergeJoin; + +/* ---------------- + * hash join node + * ---------------- + */ +typedef struct HashJoin +{ + Join join; + List *hashclauses; + List *hashoperators; + List *hashcollations; + + /* + * List of expressions to be hashed for tuples from the outer plan, to + * perform lookups in the hashtable over the inner plan. + */ + List *hashkeys; +} HashJoin; + +/* ---------------- + * materialization node + * ---------------- + */ +typedef struct Material +{ + Plan plan; +} Material; + +/* ---------------- + * memoize node + * ---------------- + */ +typedef struct Memoize +{ + Plan plan; + + /* size of the two arrays below */ + int numKeys; + + /* hash operators for each key */ + Oid *hashOperators pg_node_attr(array_size(numKeys)); + + /* collations for each key */ + Oid *collations pg_node_attr(array_size(numKeys)); + + /* cache keys in the form of exprs containing parameters */ + List *param_exprs; + + /* + * true if the cache entry should be marked as complete after we store the + * first tuple in it. + */ + bool singlerow; + + /* + * true when cache key should be compared bit by bit, false when using + * hash equality ops + */ + bool binary_mode; + + /* + * The maximum number of entries that the planner expects will fit in the + * cache, or 0 if unknown + */ + uint32 est_entries; + + /* paramids from param_exprs */ + Bitmapset *keyparamids; +} Memoize; + +/* ---------------- + * sort node + * ---------------- + */ +typedef struct Sort +{ + Plan plan; + + /* number of sort-key columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *sortColIdx pg_node_attr(array_size(numCols)); + + /* OIDs of operators to sort them by */ + Oid *sortOperators pg_node_attr(array_size(numCols)); + + /* OIDs of collations */ + Oid *collations pg_node_attr(array_size(numCols)); + + /* NULLS FIRST/LAST directions */ + bool *nullsFirst pg_node_attr(array_size(numCols)); +} Sort; + +/* ---------------- + * incremental sort node + * ---------------- + */ +typedef struct IncrementalSort +{ + Sort sort; + /* number of presorted columns */ + int nPresortedCols; +} IncrementalSort; + +/* --------------- + * group node - + * Used for queries with GROUP BY (but no aggregates) specified. + * The input must be presorted according to the grouping columns. + * --------------- + */ +typedef struct Group +{ + Plan plan; + + /* number of grouping columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *grpColIdx pg_node_attr(array_size(numCols)); + + /* equality operators to compare with */ + Oid *grpOperators pg_node_attr(array_size(numCols)); + Oid *grpCollations pg_node_attr(array_size(numCols)); +} Group; + +/* --------------- + * aggregate node + * + * An Agg node implements plain or grouped aggregation. For grouped + * aggregation, we can work with presorted input or unsorted input; + * the latter strategy uses an internal hashtable. + * + * Notice the lack of any direct info about the aggregate functions to be + * computed. They are found by scanning the node's tlist and quals during + * executor startup. (It is possible that there are no aggregate functions; + * this could happen if they get optimized away by constant-folding, or if + * we are using the Agg node to implement hash-based grouping.) + * --------------- + */ +typedef struct Agg +{ + Plan plan; + + /* basic strategy, see nodes.h */ + AggStrategy aggstrategy; + + /* agg-splitting mode, see nodes.h */ + AggSplit aggsplit; + + /* number of grouping columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *grpColIdx pg_node_attr(array_size(numCols)); + + /* equality operators to compare with */ + Oid *grpOperators pg_node_attr(array_size(numCols)); + Oid *grpCollations pg_node_attr(array_size(numCols)); + + /* estimated number of groups in input */ + long numGroups; + + /* for pass-by-ref transition data */ + uint64 transitionSpace; + + /* IDs of Params used in Aggref inputs */ + Bitmapset *aggParams; + + /* Note: planner provides numGroups & aggParams only in HASHED/MIXED case */ + + /* grouping sets to use */ + List *groupingSets; + + /* chained Agg/Sort nodes */ + List *chain; +} Agg; + +/* ---------------- + * window aggregate node + * ---------------- + */ +typedef struct WindowAgg +{ + Plan plan; + + /* name of WindowClause implemented by this node */ + char *winname; + + /* ID referenced by window functions */ + Index winref; + + /* number of columns in partition clause */ + int partNumCols; + + /* their indexes in the target list */ + AttrNumber *partColIdx pg_node_attr(array_size(partNumCols)); + + /* equality operators for partition columns */ + Oid *partOperators pg_node_attr(array_size(partNumCols)); + + /* collations for partition columns */ + Oid *partCollations pg_node_attr(array_size(partNumCols)); + + /* number of columns in ordering clause */ + int ordNumCols; + + /* their indexes in the target list */ + AttrNumber *ordColIdx pg_node_attr(array_size(ordNumCols)); + + /* equality operators for ordering columns */ + Oid *ordOperators pg_node_attr(array_size(ordNumCols)); + + /* collations for ordering columns */ + Oid *ordCollations pg_node_attr(array_size(ordNumCols)); + + /* frame_clause options, see WindowDef */ + int frameOptions; + + /* expression for starting bound, if any */ + Node *startOffset; + + /* expression for ending bound, if any */ + Node *endOffset; + + /* qual to help short-circuit execution */ + List *runCondition; + + /* runCondition for display in EXPLAIN */ + List *runConditionOrig; + + /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */ + + /* in_range function for startOffset */ + Oid startInRangeFunc; + + /* in_range function for endOffset */ + Oid endInRangeFunc; + + /* collation for in_range tests */ + Oid inRangeColl; + + /* use ASC sort order for in_range tests? */ + bool inRangeAsc; + + /* nulls sort first for in_range tests? */ + bool inRangeNullsFirst; + + /* + * false for all apart from the WindowAgg that's closest to the root of + * the plan + */ + bool topWindow; +} WindowAgg; + +/* ---------------- + * unique node + * ---------------- + */ +typedef struct Unique +{ + Plan plan; + + /* number of columns to check for uniqueness */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *uniqColIdx pg_node_attr(array_size(numCols)); + + /* equality operators to compare with */ + Oid *uniqOperators pg_node_attr(array_size(numCols)); + + /* collations for equality comparisons */ + Oid *uniqCollations pg_node_attr(array_size(numCols)); +} Unique; + +/* ------------ + * gather node + * + * Note: rescan_param is the ID of a PARAM_EXEC parameter slot. That slot + * will never actually contain a value, but the Gather node must flag it as + * having changed whenever it is rescanned. The child parallel-aware scan + * nodes are marked as depending on that parameter, so that the rescan + * machinery is aware that their output is likely to change across rescans. + * In some cases we don't need a rescan Param, so rescan_param is set to -1. + * ------------ + */ +typedef struct Gather +{ + Plan plan; + /* planned number of worker processes */ + int num_workers; + /* ID of Param that signals a rescan, or -1 */ + int rescan_param; + /* don't execute plan more than once */ + bool single_copy; + /* suppress EXPLAIN display (for testing)? */ + bool invisible; + + /* + * param id's of initplans which are referred at gather or one of its + * child nodes + */ + Bitmapset *initParam; +} Gather; + +/* ------------ + * gather merge node + * ------------ + */ +typedef struct GatherMerge +{ + Plan plan; + + /* planned number of worker processes */ + int num_workers; + + /* ID of Param that signals a rescan, or -1 */ + int rescan_param; + + /* remaining fields are just like the sort-key info in struct Sort */ + + /* number of sort-key columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *sortColIdx pg_node_attr(array_size(numCols)); + + /* OIDs of operators to sort them by */ + Oid *sortOperators pg_node_attr(array_size(numCols)); + + /* OIDs of collations */ + Oid *collations pg_node_attr(array_size(numCols)); + + /* NULLS FIRST/LAST directions */ + bool *nullsFirst pg_node_attr(array_size(numCols)); + + /* + * param id's of initplans which are referred at gather merge or one of + * its child nodes + */ + Bitmapset *initParam; +} GatherMerge; + +/* ---------------- + * hash build node + * + * If the executor is supposed to try to apply skew join optimization, then + * skewTable/skewColumn/skewInherit identify the outer relation's join key + * column, from which the relevant MCV statistics can be fetched. + * ---------------- + */ +typedef struct Hash +{ + Plan plan; + + /* + * List of expressions to be hashed for tuples from Hash's outer plan, + * needed to put them into the hashtable. + */ + /* hash keys for the hashjoin condition */ + List *hashkeys; + /* outer join key's table OID, or InvalidOid */ + Oid skewTable; + /* outer join key's column #, or zero */ + AttrNumber skewColumn; + /* is outer join rel an inheritance tree? */ + bool skewInherit; + /* all other info is in the parent HashJoin node */ + /* estimate total rows if parallel_aware */ + Cardinality rows_total; +} Hash; + +/* ---------------- + * setop node + * ---------------- + */ +typedef struct SetOp +{ + Plan plan; + + /* what to do, see nodes.h */ + SetOpCmd cmd; + + /* how to do it, see nodes.h */ + SetOpStrategy strategy; + + /* number of columns to compare */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *cmpColIdx pg_node_attr(array_size(numCols)); + + /* comparison operators (either equality operators or sort operators) */ + Oid *cmpOperators pg_node_attr(array_size(numCols)); + Oid *cmpCollations pg_node_attr(array_size(numCols)); + + /* nulls-first flags if sorting, otherwise not interesting */ + bool *cmpNullsFirst pg_node_attr(array_size(numCols)); + + /* estimated number of groups in left input */ + long numGroups; +} SetOp; + +/* ---------------- + * lock-rows node + * + * rowMarks identifies the rels to be locked by this node; it should be + * a subset of the rowMarks listed in the top-level PlannedStmt. + * epqParam is a Param that all scan nodes below this one must depend on. + * It is used to force re-evaluation of the plan during EvalPlanQual. + * ---------------- + */ +typedef struct LockRows +{ + Plan plan; + /* a list of PlanRowMark's */ + List *rowMarks; + /* ID of Param for EvalPlanQual re-eval */ + int epqParam; +} LockRows; + +/* ---------------- + * limit node + * + * Note: as of Postgres 8.2, the offset and count expressions are expected + * to yield int8, rather than int4 as before. + * ---------------- + */ +typedef struct Limit +{ + Plan plan; + + /* OFFSET parameter, or NULL if none */ + Node *limitOffset; + + /* COUNT parameter, or NULL if none */ + Node *limitCount; + + /* limit type */ + LimitOption limitOption; + + /* number of columns to check for similarity */ + int uniqNumCols; + + /* their indexes in the target list */ + AttrNumber *uniqColIdx pg_node_attr(array_size(uniqNumCols)); + + /* equality operators to compare with */ + Oid *uniqOperators pg_node_attr(array_size(uniqNumCols)); + + /* collations for equality comparisons */ + Oid *uniqCollations pg_node_attr(array_size(uniqNumCols)); +} Limit; + + +/* + * RowMarkType - + * enums for types of row-marking operations + * + * The first four of these values represent different lock strengths that + * we can take on tuples according to SELECT FOR [KEY] UPDATE/SHARE requests. + * We support these on regular tables, as well as on foreign tables whose FDWs + * report support for late locking. For other foreign tables, any locking + * that might be done for such requests must happen during the initial row + * fetch; their FDWs provide no mechanism for going back to lock a row later. + * This means that the semantics will be a bit different than for a local + * table; in particular we are likely to lock more rows than would be locked + * locally, since remote rows will be locked even if they then fail + * locally-checked restriction or join quals. However, the prospect of + * doing a separate remote query to lock each selected row is usually pretty + * unappealing, so early locking remains a credible design choice for FDWs. + * + * When doing UPDATE/DELETE/MERGE/SELECT FOR UPDATE/SHARE, we have to uniquely + * identify all the source rows, not only those from the target relations, so + * that we can perform EvalPlanQual rechecking at need. For plain tables we + * can just fetch the TID, much as for a target relation; this case is + * represented by ROW_MARK_REFERENCE. Otherwise (for example for VALUES or + * FUNCTION scans) we have to copy the whole row value. ROW_MARK_COPY is + * pretty inefficient, since most of the time we'll never need the data; but + * fortunately the overhead is usually not performance-critical in practice. + * By default we use ROW_MARK_COPY for foreign tables, but if the FDW has + * a concept of rowid it can request to use ROW_MARK_REFERENCE instead. + * (Again, this probably doesn't make sense if a physical remote fetch is + * needed, but for FDWs that map to local storage it might be credible.) + */ +typedef enum RowMarkType +{ + ROW_MARK_EXCLUSIVE, /* obtain exclusive tuple lock */ + ROW_MARK_NOKEYEXCLUSIVE, /* obtain no-key exclusive tuple lock */ + ROW_MARK_SHARE, /* obtain shared tuple lock */ + ROW_MARK_KEYSHARE, /* obtain keyshare tuple lock */ + ROW_MARK_REFERENCE, /* just fetch the TID, don't lock it */ + ROW_MARK_COPY, /* physically copy the row value */ +} RowMarkType; + +#define RowMarkRequiresRowShareLock(marktype) ((marktype) <= ROW_MARK_KEYSHARE) + +/* + * PlanRowMark - + * plan-time representation of FOR [KEY] UPDATE/SHARE clauses + * + * When doing UPDATE/DELETE/MERGE/SELECT FOR UPDATE/SHARE, we create a separate + * PlanRowMark node for each non-target relation in the query. Relations that + * are not specified as FOR UPDATE/SHARE are marked ROW_MARK_REFERENCE (if + * regular tables or supported foreign tables) or ROW_MARK_COPY (if not). + * + * Initially all PlanRowMarks have rti == prti and isParent == false. + * When the planner discovers that a relation is the root of an inheritance + * tree, it sets isParent true, and adds an additional PlanRowMark to the + * list for each child relation (including the target rel itself in its role + * as a child, if it is not a partitioned table). Any non-leaf partitioned + * child relations will also have entries with isParent = true. The child + * entries have rti == child rel's RT index and prti == top parent's RT index, + * and can therefore be recognized as children by the fact that prti != rti. + * The parent's allMarkTypes field gets the OR of (1<0 means N levels up + */ + Index varlevelsup; + + /* returning type of this var (see above) */ + VarReturningType varreturningtype; + + /* + * varnosyn/varattnosyn are ignored for equality, because Vars with + * different syntactic identifiers are semantically the same as long as + * their varno/varattno match. + */ + /* syntactic relation index (0 if unknown) */ + Index varnosyn pg_node_attr(equal_ignore, query_jumble_ignore); + /* syntactic attribute number */ + AttrNumber varattnosyn pg_node_attr(equal_ignore, query_jumble_ignore); + + /* token location, or -1 if unknown */ + ParseLoc location; +} Var; + +/* + * Const + * + * Note: for varlena data types, we make a rule that a Const node's value + * must be in non-extended form (4-byte header, no compression or external + * references). This ensures that the Const node is self-contained and makes + * it more likely that equal() will see logically identical values as equal. + * + * Only the constant type OID is relevant for the query jumbling. + */ +typedef struct Const +{ + pg_node_attr(custom_copy_equal, custom_read_write) + + Expr xpr; + /* pg_type OID of the constant's datatype */ + Oid consttype; + /* typmod value, if any */ + int32 consttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid constcollid pg_node_attr(query_jumble_ignore); + /* typlen of the constant's datatype */ + int constlen pg_node_attr(query_jumble_ignore); + /* the constant's value */ + Datum constvalue pg_node_attr(query_jumble_ignore); + /* whether the constant is null (if true, constvalue is undefined) */ + bool constisnull pg_node_attr(query_jumble_ignore); + + /* + * Whether this datatype is passed by value. If true, then all the + * information is stored in the Datum. If false, then the Datum contains + * a pointer to the information. + */ + bool constbyval pg_node_attr(query_jumble_ignore); + + /* + * token location, or -1 if unknown. All constants are tracked as + * locations in query jumbling, to be marked as parameters. + */ + ParseLoc location pg_node_attr(query_jumble_location); +} Const; + +/* + * Param + * + * paramkind specifies the kind of parameter. The possible values + * for this field are: + * + * PARAM_EXTERN: The parameter value is supplied from outside the plan. + * Such parameters are numbered from 1 to n. + * + * PARAM_EXEC: The parameter is an internal executor parameter, used + * for passing values into and out of sub-queries or from + * nestloop joins to their inner scans. + * For historical reasons, such parameters are numbered from 0. + * These numbers are independent of PARAM_EXTERN numbers. + * + * PARAM_SUBLINK: The parameter represents an output column of a SubLink + * node's sub-select. The column number is contained in the + * `paramid' field. (This type of Param is converted to + * PARAM_EXEC during planning.) + * + * PARAM_MULTIEXPR: Like PARAM_SUBLINK, the parameter represents an + * output column of a SubLink node's sub-select, but here, the + * SubLink is always a MULTIEXPR SubLink. The high-order 16 bits + * of the `paramid' field contain the SubLink's subLinkId, and + * the low-order 16 bits contain the column number. (This type + * of Param is also converted to PARAM_EXEC during planning.) + */ +typedef enum ParamKind +{ + PARAM_EXTERN, + PARAM_EXEC, + PARAM_SUBLINK, + PARAM_MULTIEXPR, +} ParamKind; + +typedef struct Param +{ + pg_node_attr(custom_query_jumble) + + Expr xpr; + ParamKind paramkind; /* kind of parameter. See above */ + int paramid; /* numeric ID for parameter */ + Oid paramtype; /* pg_type OID of parameter's datatype */ + /* typmod value, if known */ + int32 paramtypmod; + /* OID of collation, or InvalidOid if none */ + Oid paramcollid; + /* token location, or -1 if unknown */ + ParseLoc location; +} Param; + +/* + * Aggref + * + * The aggregate's args list is a targetlist, ie, a list of TargetEntry nodes. + * + * For a normal (non-ordered-set) aggregate, the non-resjunk TargetEntries + * represent the aggregate's regular arguments (if any) and resjunk TLEs can + * be added at the end to represent ORDER BY expressions that are not also + * arguments. As in a top-level Query, the TLEs can be marked with + * ressortgroupref indexes to let them be referenced by SortGroupClause + * entries in the aggorder and/or aggdistinct lists. This represents ORDER BY + * and DISTINCT operations to be applied to the aggregate input rows before + * they are passed to the transition function. The grammar only allows a + * simple "DISTINCT" specifier for the arguments, but we use the full + * query-level representation to allow more code sharing. + * + * For an ordered-set aggregate, the args list represents the WITHIN GROUP + * (aggregated) arguments, all of which will be listed in the aggorder list. + * DISTINCT is not supported in this case, so aggdistinct will be NIL. + * The direct arguments appear in aggdirectargs (as a list of plain + * expressions, not TargetEntry nodes). + * + * aggtranstype is the data type of the state transition values for this + * aggregate (resolved to an actual type, if agg's transtype is polymorphic). + * This is determined during planning and is InvalidOid before that. + * + * aggargtypes is an OID list of the data types of the direct and regular + * arguments. Normally it's redundant with the aggdirectargs and args lists, + * but in a combining aggregate, it's not because the args list has been + * replaced with a single argument representing the partial-aggregate + * transition values. + * + * aggpresorted is set by the query planner for ORDER BY and DISTINCT + * aggregates where the chosen plan provides presorted input for this + * aggregate during execution. + * + * aggsplit indicates the expected partial-aggregation mode for the Aggref's + * parent plan node. It's always set to AGGSPLIT_SIMPLE in the parser, but + * the planner might change it to something else. We use this mainly as + * a crosscheck that the Aggrefs match the plan; but note that when aggsplit + * indicates a non-final mode, aggtype reflects the transition data type + * not the SQL-level output type of the aggregate. + * + * aggno and aggtransno are -1 in the parse stage, and are set in planning. + * Aggregates with the same 'aggno' represent the same aggregate expression, + * and can share the result. Aggregates with same 'transno' but different + * 'aggno' can share the same transition state, only the final function needs + * to be called separately. + * + * Information related to collations, transition types and internal states + * are irrelevant for the query jumbling. + */ +typedef struct Aggref +{ + Expr xpr; + + /* pg_proc Oid of the aggregate */ + Oid aggfnoid; + + /* type Oid of result of the aggregate */ + Oid aggtype pg_node_attr(query_jumble_ignore); + + /* OID of collation of result */ + Oid aggcollid pg_node_attr(query_jumble_ignore); + + /* OID of collation that function should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + + /* + * type Oid of aggregate's transition value; ignored for equal since it + * might not be set yet + */ + Oid aggtranstype pg_node_attr(equal_ignore, query_jumble_ignore); + + /* type Oids of direct and aggregated args */ + List *aggargtypes pg_node_attr(query_jumble_ignore); + + /* direct arguments, if an ordered-set agg */ + List *aggdirectargs; + + /* aggregated arguments and sort expressions */ + List *args; + + /* ORDER BY (list of SortGroupClause) */ + List *aggorder; + + /* DISTINCT (list of SortGroupClause) */ + List *aggdistinct; + + /* FILTER expression, if any */ + Expr *aggfilter; + + /* true if argument list was really '*' */ + bool aggstar pg_node_attr(query_jumble_ignore); + + /* + * true if variadic arguments have been combined into an array last + * argument + */ + bool aggvariadic pg_node_attr(query_jumble_ignore); + + /* aggregate kind (see pg_aggregate.h) */ + char aggkind pg_node_attr(query_jumble_ignore); + + /* aggregate input already sorted */ + bool aggpresorted pg_node_attr(equal_ignore, query_jumble_ignore); + + /* > 0 if agg belongs to outer query */ + Index agglevelsup pg_node_attr(query_jumble_ignore); + + /* expected agg-splitting mode of parent Agg */ + AggSplit aggsplit pg_node_attr(query_jumble_ignore); + + /* unique ID within the Agg node */ + int aggno pg_node_attr(query_jumble_ignore); + + /* unique ID of transition state in the Agg */ + int aggtransno pg_node_attr(query_jumble_ignore); + + /* token location, or -1 if unknown */ + ParseLoc location; +} Aggref; + +/* + * GroupingFunc + * + * A GroupingFunc is a GROUPING(...) expression, which behaves in many ways + * like an aggregate function (e.g. it "belongs" to a specific query level, + * which might not be the one immediately containing it), but also differs in + * an important respect: it never evaluates its arguments, they merely + * designate expressions from the GROUP BY clause of the query level to which + * it belongs. + * + * The spec defines the evaluation of GROUPING() purely by syntactic + * replacement, but we make it a real expression for optimization purposes so + * that one Agg node can handle multiple grouping sets at once. Evaluating the + * result only needs the column positions to check against the grouping set + * being projected. However, for EXPLAIN to produce meaningful output, we have + * to keep the original expressions around, since expression deparse does not + * give us any feasible way to get at the GROUP BY clause. + * + * Also, we treat two GroupingFunc nodes as equal if they have equal arguments + * lists and agglevelsup, without comparing the refs and cols annotations. + * + * In raw parse output we have only the args list; parse analysis fills in the + * refs list, and the planner fills in the cols list. + * + * All the fields used as information for an internal state are irrelevant + * for the query jumbling. + */ +typedef struct GroupingFunc +{ + Expr xpr; + + /* arguments, not evaluated but kept for benefit of EXPLAIN etc. */ + List *args pg_node_attr(query_jumble_ignore); + + /* ressortgrouprefs of arguments */ + List *refs pg_node_attr(equal_ignore); + + /* actual column positions set by planner */ + List *cols pg_node_attr(equal_ignore, query_jumble_ignore); + + /* same as Aggref.agglevelsup */ + Index agglevelsup; + + /* token location */ + ParseLoc location; +} GroupingFunc; + +/* + * WindowFunc + * + * Collation information is irrelevant for the query jumbling, as is the + * internal state information of the node like "winstar" and "winagg". + */ +typedef struct WindowFunc +{ + Expr xpr; + /* pg_proc Oid of the function */ + Oid winfnoid; + /* type Oid of result of the window function */ + Oid wintype pg_node_attr(query_jumble_ignore); + /* OID of collation of result */ + Oid wincollid pg_node_attr(query_jumble_ignore); + /* OID of collation that function should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + /* arguments to the window function */ + List *args; + /* FILTER expression, if any */ + Expr *aggfilter; + /* List of WindowFuncRunConditions to help short-circuit execution */ + List *runCondition pg_node_attr(query_jumble_ignore); + /* index of associated WindowClause */ + Index winref; + /* true if argument list was really '*' */ + bool winstar pg_node_attr(query_jumble_ignore); + /* is function a simple aggregate? */ + bool winagg pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} WindowFunc; + +/* + * WindowFuncRunCondition + * + * Represents intermediate OpExprs which will be used by WindowAgg to + * short-circuit execution. + */ +typedef struct WindowFuncRunCondition +{ + Expr xpr; + + /* PG_OPERATOR OID of the operator */ + Oid opno; + /* OID of collation that operator should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + + /* + * true of WindowFunc belongs on the left of the resulting OpExpr or false + * if the WindowFunc is on the right. + */ + bool wfunc_left; + + /* + * The Expr being compared to the WindowFunc to use in the OpExpr in the + * WindowAgg's runCondition + */ + Expr *arg; +} WindowFuncRunCondition; + +/* + * MergeSupportFunc + * + * A MergeSupportFunc is a merge support function expression that can only + * appear in the RETURNING list of a MERGE command. It returns information + * about the currently executing merge action. + * + * Currently, the only supported function is MERGE_ACTION(), which returns the + * command executed ("INSERT", "UPDATE", or "DELETE"). + */ +typedef struct MergeSupportFunc +{ + Expr xpr; + /* type Oid of result */ + Oid msftype; + /* OID of collation, or InvalidOid if none */ + Oid msfcollid; + /* token location, or -1 if unknown */ + ParseLoc location; +} MergeSupportFunc; + +/* + * SubscriptingRef: describes a subscripting operation over a container + * (array, etc). + * + * A SubscriptingRef can describe fetching a single element from a container, + * fetching a part of a container (e.g. an array slice), storing a single + * element into a container, or storing a slice. The "store" cases work with + * an initial container value and a source value that is inserted into the + * appropriate part of the container; the result of the operation is an + * entire new modified container value. + * + * If reflowerindexpr = NIL, then we are fetching or storing a single container + * element at the subscripts given by refupperindexpr. Otherwise we are + * fetching or storing a container slice, that is a rectangular subcontainer + * with lower and upper bounds given by the index expressions. + * reflowerindexpr must be the same length as refupperindexpr when it + * is not NIL. + * + * In the slice case, individual expressions in the subscript lists can be + * NULL, meaning "substitute the array's current lower or upper bound". + * (Non-array containers may or may not support this.) + * + * refcontainertype is the actual container type that determines the + * subscripting semantics. (This will generally be either the exposed type of + * refexpr, or the base type if that is a domain.) refelemtype is the type of + * the container's elements; this is saved for the use of the subscripting + * functions, but is not used by the core code. refrestype, reftypmod, and + * refcollid describe the type of the SubscriptingRef's result. In a store + * expression, refrestype will always match refcontainertype; in a fetch, + * it could be refelemtype for an element fetch, or refcontainertype for a + * slice fetch, or possibly something else as determined by type-specific + * subscripting logic. Likewise, reftypmod and refcollid will match the + * container's properties in a store, but could be different in a fetch. + * + * Any internal state data is ignored for the query jumbling. + * + * Note: for the cases where a container is returned, if refexpr yields a R/W + * expanded container, then the implementation is allowed to modify that + * object in-place and return the same object. + */ +typedef struct SubscriptingRef +{ + Expr xpr; + /* type of the container proper */ + Oid refcontainertype pg_node_attr(query_jumble_ignore); + /* the container type's pg_type.typelem */ + Oid refelemtype pg_node_attr(query_jumble_ignore); + /* type of the SubscriptingRef's result */ + Oid refrestype pg_node_attr(query_jumble_ignore); + /* typmod of the result */ + int32 reftypmod pg_node_attr(query_jumble_ignore); + /* collation of result, or InvalidOid if none */ + Oid refcollid pg_node_attr(query_jumble_ignore); + /* expressions that evaluate to upper container indexes */ + List *refupperindexpr; + + /* + * expressions that evaluate to lower container indexes, or NIL for single + * container element. + */ + List *reflowerindexpr; + /* the expression that evaluates to a container value */ + Expr *refexpr; + /* expression for the source value, or NULL if fetch */ + Expr *refassgnexpr; +} SubscriptingRef; + +/* + * CoercionContext - distinguishes the allowed set of type casts + * + * NB: ordering of the alternatives is significant; later (larger) values + * allow more casts than earlier ones. + */ +typedef enum CoercionContext +{ + COERCION_IMPLICIT, /* coercion in context of expression */ + COERCION_ASSIGNMENT, /* coercion in context of assignment */ + COERCION_PLPGSQL, /* if no assignment cast, use CoerceViaIO */ + COERCION_EXPLICIT, /* explicit cast operation */ +} CoercionContext; + +/* + * CoercionForm - how to display a FuncExpr or related node + * + * "Coercion" is a bit of a misnomer, since this value records other + * special syntaxes besides casts, but for now we'll keep this naming. + * + * NB: equal() ignores CoercionForm fields, therefore this *must* not carry + * any semantically significant information. We need that behavior so that + * the planner will consider equivalent implicit and explicit casts to be + * equivalent. In cases where those actually behave differently, the coercion + * function's arguments will be different. + */ +typedef enum CoercionForm +{ + COERCE_EXPLICIT_CALL, /* display as a function call */ + COERCE_EXPLICIT_CAST, /* display as an explicit cast */ + COERCE_IMPLICIT_CAST, /* implicit cast, so hide it */ + COERCE_SQL_SYNTAX, /* display with SQL-mandated special syntax */ +} CoercionForm; + +/* + * FuncExpr - expression node for a function call + * + * Collation information is irrelevant for the query jumbling, only the + * arguments and the function OID matter. + */ +typedef struct FuncExpr +{ + Expr xpr; + /* PG_PROC OID of the function */ + Oid funcid; + /* PG_TYPE OID of result value */ + Oid funcresulttype pg_node_attr(query_jumble_ignore); + /* true if function returns set */ + bool funcretset pg_node_attr(query_jumble_ignore); + + /* + * true if variadic arguments have been combined into an array last + * argument + */ + bool funcvariadic pg_node_attr(query_jumble_ignore); + /* how to display this function call */ + CoercionForm funcformat pg_node_attr(query_jumble_ignore); + /* OID of collation of result */ + Oid funccollid pg_node_attr(query_jumble_ignore); + /* OID of collation that function should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + /* arguments to the function */ + List *args; + /* token location, or -1 if unknown */ + ParseLoc location; +} FuncExpr; + +/* + * NamedArgExpr - a named argument of a function + * + * This node type can only appear in the args list of a FuncCall or FuncExpr + * node. We support pure positional call notation (no named arguments), + * named notation (all arguments are named), and mixed notation (unnamed + * arguments followed by named ones). + * + * Parse analysis sets argnumber to the positional index of the argument, + * but doesn't rearrange the argument list. + * + * The planner will convert argument lists to pure positional notation + * during expression preprocessing, so execution never sees a NamedArgExpr. + */ +typedef struct NamedArgExpr +{ + Expr xpr; + /* the argument expression */ + Expr *arg; + /* the name */ + char *name pg_node_attr(query_jumble_ignore); + /* argument's number in positional notation */ + int argnumber; + /* argument name location, or -1 if unknown */ + ParseLoc location; +} NamedArgExpr; + +/* + * OpExpr - expression node for an operator invocation + * + * Semantically, this is essentially the same as a function call. + * + * Note that opfuncid is not necessarily filled in immediately on creation + * of the node. The planner makes sure it is valid before passing the node + * tree to the executor, but during parsing/planning opfuncid can be 0. + * Therefore, equal() will accept a zero value as being equal to other values. + * + * Internal state information and collation data is irrelevant for the query + * jumbling. + */ +typedef struct OpExpr +{ + Expr xpr; + + /* PG_OPERATOR OID of the operator */ + Oid opno; + + /* PG_PROC OID of underlying function */ + Oid opfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore); + + /* PG_TYPE OID of result value */ + Oid opresulttype pg_node_attr(query_jumble_ignore); + + /* true if operator returns set */ + bool opretset pg_node_attr(query_jumble_ignore); + + /* OID of collation of result */ + Oid opcollid pg_node_attr(query_jumble_ignore); + + /* OID of collation that operator should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + + /* arguments to the operator (1 or 2) */ + List *args; + + /* token location, or -1 if unknown */ + ParseLoc location; +} OpExpr; + +/* + * DistinctExpr - expression node for "x IS DISTINCT FROM y" + * + * Except for the nodetag, this is represented identically to an OpExpr + * referencing the "=" operator for x and y. + * We use "=", not the more obvious "<>", because more datatypes have "=" + * than "<>". This means the executor must invert the operator result. + * Note that the operator function won't be called at all if either input + * is NULL, since then the result can be determined directly. + */ +typedef OpExpr DistinctExpr; + +/* + * NullIfExpr - a NULLIF expression + * + * Like DistinctExpr, this is represented the same as an OpExpr referencing + * the "=" operator for x and y. + */ +typedef OpExpr NullIfExpr; + +/* + * ScalarArrayOpExpr - expression node for "scalar op ANY/ALL (array)" + * + * The operator must yield boolean. It is applied to the left operand + * and each element of the righthand array, and the results are combined + * with OR or AND (for ANY or ALL respectively). The node representation + * is almost the same as for the underlying operator, but we need a useOr + * flag to remember whether it's ANY or ALL, and we don't have to store + * the result type (or the collation) because it must be boolean. + * + * A ScalarArrayOpExpr with a valid hashfuncid is evaluated during execution + * by building a hash table containing the Const values from the RHS arg. + * This table is probed during expression evaluation. The planner will set + * hashfuncid to the hash function which must be used to build and probe the + * hash table. The executor determines if it should use hash-based checks or + * the more traditional means based on if the hashfuncid is set or not. + * + * When performing hashed NOT IN, the negfuncid will also be set to the + * equality function which the hash table must use to build and probe the hash + * table. opno and opfuncid will remain set to the <> operator and its + * corresponding function and won't be used during execution. For + * non-hashtable based NOT INs, negfuncid will be set to InvalidOid. See + * convert_saop_to_hashed_saop(). + * + * Similar to OpExpr, opfuncid, hashfuncid, and negfuncid are not necessarily + * filled in right away, so will be ignored for equality if they are not set + * yet. + * + * OID entries of the internal function types are irrelevant for the query + * jumbling, but the operator OID and the arguments are. + */ +typedef struct ScalarArrayOpExpr +{ + Expr xpr; + + /* PG_OPERATOR OID of the operator */ + Oid opno; + + /* PG_PROC OID of comparison function */ + Oid opfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore); + + /* PG_PROC OID of hash func or InvalidOid */ + Oid hashfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore); + + /* PG_PROC OID of negator of opfuncid function or InvalidOid. See above */ + Oid negfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore); + + /* true for ANY, false for ALL */ + bool useOr; + + /* OID of collation that operator should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + + /* the scalar and array operands */ + List *args; + + /* token location, or -1 if unknown */ + ParseLoc location; +} ScalarArrayOpExpr; + +/* + * BoolExpr - expression node for the basic Boolean operators AND, OR, NOT + * + * Notice the arguments are given as a List. For NOT, of course the list + * must always have exactly one element. For AND and OR, there can be two + * or more arguments. + */ +typedef enum BoolExprType +{ + AND_EXPR, OR_EXPR, NOT_EXPR +} BoolExprType; + +typedef struct BoolExpr +{ + pg_node_attr(custom_read_write) + + Expr xpr; + BoolExprType boolop; + List *args; /* arguments to this expression */ + ParseLoc location; /* token location, or -1 if unknown */ +} BoolExpr; + +/* + * SubLink + * + * A SubLink represents a subselect appearing in an expression, and in some + * cases also the combining operator(s) just above it. The subLinkType + * indicates the form of the expression represented: + * EXISTS_SUBLINK EXISTS(SELECT ...) + * ALL_SUBLINK (lefthand) op ALL (SELECT ...) + * ANY_SUBLINK (lefthand) op ANY (SELECT ...) + * ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...) + * EXPR_SUBLINK (SELECT with single targetlist item ...) + * MULTIEXPR_SUBLINK (SELECT with multiple targetlist items ...) + * ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...) + * CTE_SUBLINK WITH query (never actually part of an expression) + * For ALL, ANY, and ROWCOMPARE, the lefthand is a list of expressions of the + * same length as the subselect's targetlist. ROWCOMPARE will *always* have + * a list with more than one entry; if the subselect has just one target + * then the parser will create an EXPR_SUBLINK instead (and any operator + * above the subselect will be represented separately). + * ROWCOMPARE, EXPR, and MULTIEXPR require the subselect to deliver at most + * one row (if it returns no rows, the result is NULL). + * ALL, ANY, and ROWCOMPARE require the combining operators to deliver boolean + * results. ALL and ANY combine the per-row results using AND and OR + * semantics respectively. + * ARRAY requires just one target column, and creates an array of the target + * column's type using any number of rows resulting from the subselect. + * + * SubLink is classed as an Expr node, but it is not actually executable; + * it must be replaced in the expression tree by a SubPlan node during + * planning. + * + * NOTE: in the raw output of gram.y, testexpr contains just the raw form + * of the lefthand expression (if any), and operName is the String name of + * the combining operator. Also, subselect is a raw parsetree. During parse + * analysis, the parser transforms testexpr into a complete boolean expression + * that compares the lefthand value(s) to PARAM_SUBLINK nodes representing the + * output columns of the subselect. And subselect is transformed to a Query. + * This is the representation seen in saved rules and in the rewriter. + * + * In EXISTS, EXPR, MULTIEXPR, and ARRAY SubLinks, testexpr and operName + * are unused and are always null. + * + * subLinkId is currently used only for MULTIEXPR SubLinks, and is zero in + * other SubLinks. This number identifies different multiple-assignment + * subqueries within an UPDATE statement's SET list. It is unique only + * within a particular targetlist. The output column(s) of the MULTIEXPR + * are referenced by PARAM_MULTIEXPR Params appearing elsewhere in the tlist. + * + * The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used + * in SubPlans generated for WITH subqueries. + */ +typedef enum SubLinkType +{ + EXISTS_SUBLINK, + ALL_SUBLINK, + ANY_SUBLINK, + ROWCOMPARE_SUBLINK, + EXPR_SUBLINK, + MULTIEXPR_SUBLINK, + ARRAY_SUBLINK, + CTE_SUBLINK, /* for SubPlans only */ +} SubLinkType; + + +typedef struct SubLink +{ + Expr xpr; + SubLinkType subLinkType; /* see above */ + int subLinkId; /* ID (1..n); 0 if not MULTIEXPR */ + Node *testexpr; /* outer-query test for ALL/ANY/ROWCOMPARE */ + /* originally specified operator name */ + List *operName pg_node_attr(query_jumble_ignore); + /* subselect as Query* or raw parsetree */ + Node *subselect; + ParseLoc location; /* token location, or -1 if unknown */ +} SubLink; + +/* + * SubPlan - executable expression node for a subplan (sub-SELECT) + * + * The planner replaces SubLink nodes in expression trees with SubPlan + * nodes after it has finished planning the subquery. SubPlan references + * a sub-plantree stored in the subplans list of the toplevel PlannedStmt. + * (We avoid a direct link to make it easier to copy expression trees + * without causing multiple processing of the subplan.) + * + * In an ordinary subplan, testexpr points to an executable expression + * (OpExpr, an AND/OR tree of OpExprs, or RowCompareExpr) for the combining + * operator(s); the left-hand arguments are the original lefthand expressions, + * and the right-hand arguments are PARAM_EXEC Param nodes representing the + * outputs of the sub-select. (NOTE: runtime coercion functions may be + * inserted as well.) This is just the same expression tree as testexpr in + * the original SubLink node, but the PARAM_SUBLINK nodes are replaced by + * suitably numbered PARAM_EXEC nodes. + * + * If the sub-select becomes an initplan rather than a subplan, the executable + * expression is part of the outer plan's expression tree (and the SubPlan + * node itself is not, but rather is found in the outer plan's initPlan + * list). In this case testexpr is NULL to avoid duplication. + * + * The planner also derives lists of the values that need to be passed into + * and out of the subplan. Input values are represented as a list "args" of + * expressions to be evaluated in the outer-query context (currently these + * args are always just Vars, but in principle they could be any expression). + * The values are assigned to the global PARAM_EXEC params indexed by parParam + * (the parParam and args lists must have the same ordering). setParam is a + * list of the PARAM_EXEC params that are computed by the sub-select, if it + * is an initplan or MULTIEXPR plan; they are listed in order by sub-select + * output column position. (parParam and setParam are integer Lists, not + * Bitmapsets, because their ordering is significant.) + * + * Also, the planner computes startup and per-call costs for use of the + * SubPlan. Note that these include the cost of the subquery proper, + * evaluation of the testexpr if any, and any hashtable management overhead. + */ +typedef struct SubPlan +{ + pg_node_attr(no_query_jumble) + + Expr xpr; + /* Fields copied from original SubLink: */ + SubLinkType subLinkType; /* see above */ + /* The combining operators, transformed to an executable expression: */ + Node *testexpr; /* OpExpr or RowCompareExpr expression tree */ + List *paramIds; /* IDs of Params embedded in the above */ + /* Identification of the Plan tree to use: */ + int plan_id; /* Index (from 1) in PlannedStmt.subplans */ + /* Identification of the SubPlan for EXPLAIN and debugging purposes: */ + char *plan_name; /* A name assigned during planning */ + /* Extra data useful for determining subplan's output type: */ + Oid firstColType; /* Type of first column of subplan result */ + int32 firstColTypmod; /* Typmod of first column of subplan result */ + Oid firstColCollation; /* Collation of first column of subplan + * result */ + /* Information about execution strategy: */ + bool useHashTable; /* true to store subselect output in a hash + * table (implies we are doing "IN") */ + bool unknownEqFalse; /* true if it's okay to return FALSE when the + * spec result is UNKNOWN; this allows much + * simpler handling of null values */ + bool parallel_safe; /* is the subplan parallel-safe? */ + /* Note: parallel_safe does not consider contents of testexpr or args */ + /* Information for passing params into and out of the subselect: */ + /* setParam and parParam are lists of integers (param IDs) */ + List *setParam; /* initplan and MULTIEXPR subqueries have to + * set these Params for parent plan */ + List *parParam; /* indices of input Params from parent plan */ + List *args; /* exprs to pass as parParam values */ + /* Estimated execution costs: */ + Cost startup_cost; /* one-time setup cost */ + Cost per_call_cost; /* cost for each subplan evaluation */ +} SubPlan; + +/* + * AlternativeSubPlan - expression node for a choice among SubPlans + * + * This is used only transiently during planning: by the time the plan + * reaches the executor, all AlternativeSubPlan nodes have been removed. + * + * The subplans are given as a List so that the node definition need not + * change if there's ever more than two alternatives. For the moment, + * though, there are always exactly two; and the first one is the fast-start + * plan. + */ +typedef struct AlternativeSubPlan +{ + pg_node_attr(no_query_jumble) + + Expr xpr; + List *subplans; /* SubPlan(s) with equivalent results */ +} AlternativeSubPlan; + +/* ---------------- + * FieldSelect + * + * FieldSelect represents the operation of extracting one field from a tuple + * value. At runtime, the input expression is expected to yield a rowtype + * Datum. The specified field number is extracted and returned as a Datum. + * ---------------- + */ + +typedef struct FieldSelect +{ + Expr xpr; + Expr *arg; /* input expression */ + AttrNumber fieldnum; /* attribute number of field to extract */ + /* type of the field (result type of this node) */ + Oid resulttype pg_node_attr(query_jumble_ignore); + /* output typmod (usually -1) */ + int32 resulttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation of the field */ + Oid resultcollid pg_node_attr(query_jumble_ignore); +} FieldSelect; + +/* ---------------- + * FieldStore + * + * FieldStore represents the operation of modifying one field in a tuple + * value, yielding a new tuple value (the input is not touched!). Like + * the assign case of SubscriptingRef, this is used to implement UPDATE of a + * portion of a column. + * + * resulttype is always a named composite type (not a domain). To update + * a composite domain value, apply CoerceToDomain to the FieldStore. + * + * A single FieldStore can actually represent updates of several different + * fields. The parser only generates FieldStores with single-element lists, + * but the planner will collapse multiple updates of the same base column + * into one FieldStore. + * ---------------- + */ + +typedef struct FieldStore +{ + Expr xpr; + Expr *arg; /* input tuple value */ + List *newvals; /* new value(s) for field(s) */ + /* integer list of field attnums */ + List *fieldnums pg_node_attr(query_jumble_ignore); + /* type of result (same as type of arg) */ + Oid resulttype pg_node_attr(query_jumble_ignore); + /* Like RowExpr, we deliberately omit a typmod and collation here */ +} FieldStore; + +/* ---------------- + * RelabelType + * + * RelabelType represents a "dummy" type coercion between two binary- + * compatible datatypes, such as reinterpreting the result of an OID + * expression as an int4. It is a no-op at runtime; we only need it + * to provide a place to store the correct type to be attributed to + * the expression result during type resolution. (We can't get away + * with just overwriting the type field of the input expression node, + * so we need a separate node to show the coercion's result type.) + * ---------------- + */ + +typedef struct RelabelType +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid resulttype; /* output type of coercion expression */ + /* output typmod (usually -1) */ + int32 resulttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid resultcollid pg_node_attr(query_jumble_ignore); + /* how to display this node */ + CoercionForm relabelformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} RelabelType; + +/* ---------------- + * CoerceViaIO + * + * CoerceViaIO represents a type coercion between two types whose textual + * representations are compatible, implemented by invoking the source type's + * typoutput function then the destination type's typinput function. + * ---------------- + */ + +typedef struct CoerceViaIO +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid resulttype; /* output type of coercion */ + /* output typmod is not stored, but is presumed -1 */ + /* OID of collation, or InvalidOid if none */ + Oid resultcollid pg_node_attr(query_jumble_ignore); + /* how to display this node */ + CoercionForm coerceformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} CoerceViaIO; + +/* ---------------- + * ArrayCoerceExpr + * + * ArrayCoerceExpr represents a type coercion from one array type to another, + * which is implemented by applying the per-element coercion expression + * "elemexpr" to each element of the source array. Within elemexpr, the + * source element is represented by a CaseTestExpr node. Note that even if + * elemexpr is a no-op (that is, just CaseTestExpr + RelabelType), the + * coercion still requires some effort: we have to fix the element type OID + * stored in the array header. + * ---------------- + */ + +typedef struct ArrayCoerceExpr +{ + Expr xpr; + Expr *arg; /* input expression (yields an array) */ + Expr *elemexpr; /* expression representing per-element work */ + Oid resulttype; /* output type of coercion (an array type) */ + /* output typmod (also element typmod) */ + int32 resulttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid resultcollid pg_node_attr(query_jumble_ignore); + /* how to display this node */ + CoercionForm coerceformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} ArrayCoerceExpr; + +/* ---------------- + * ConvertRowtypeExpr + * + * ConvertRowtypeExpr represents a type coercion from one composite type + * to another, where the source type is guaranteed to contain all the columns + * needed for the destination type plus possibly others; the columns need not + * be in the same positions, but are matched up by name. This is primarily + * used to convert a whole-row value of an inheritance child table into a + * valid whole-row value of its parent table's rowtype. Both resulttype + * and the exposed type of "arg" must be named composite types (not domains). + * ---------------- + */ + +typedef struct ConvertRowtypeExpr +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid resulttype; /* output type (always a composite type) */ + /* Like RowExpr, we deliberately omit a typmod and collation here */ + /* how to display this node */ + CoercionForm convertformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} ConvertRowtypeExpr; + +/*---------- + * CollateExpr - COLLATE + * + * The planner replaces CollateExpr with RelabelType during expression + * preprocessing, so execution never sees a CollateExpr. + *---------- + */ +typedef struct CollateExpr +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid collOid; /* collation's OID */ + ParseLoc location; /* token location, or -1 if unknown */ +} CollateExpr; + +/*---------- + * CaseExpr - a CASE expression + * + * We support two distinct forms of CASE expression: + * CASE WHEN boolexpr THEN expr [ WHEN boolexpr THEN expr ... ] + * CASE testexpr WHEN compexpr THEN expr [ WHEN compexpr THEN expr ... ] + * These are distinguishable by the "arg" field being NULL in the first case + * and the testexpr in the second case. + * + * In the raw grammar output for the second form, the condition expressions + * of the WHEN clauses are just the comparison values. Parse analysis + * converts these to valid boolean expressions of the form + * CaseTestExpr '=' compexpr + * where the CaseTestExpr node is a placeholder that emits the correct + * value at runtime. This structure is used so that the testexpr need be + * evaluated only once. Note that after parse analysis, the condition + * expressions always yield boolean. + * + * Note: we can test whether a CaseExpr has been through parse analysis + * yet by checking whether casetype is InvalidOid or not. + *---------- + */ +typedef struct CaseExpr +{ + Expr xpr; + /* type of expression result */ + Oid casetype pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid casecollid pg_node_attr(query_jumble_ignore); + Expr *arg; /* implicit equality comparison argument */ + List *args; /* the arguments (list of WHEN clauses) */ + Expr *defresult; /* the default result (ELSE clause) */ + ParseLoc location; /* token location, or -1 if unknown */ +} CaseExpr; + +/* + * CaseWhen - one arm of a CASE expression + */ +typedef struct CaseWhen +{ + Expr xpr; + Expr *expr; /* condition expression */ + Expr *result; /* substitution result */ + ParseLoc location; /* token location, or -1 if unknown */ +} CaseWhen; + +/* + * Placeholder node for the test value to be processed by a CASE expression. + * This is effectively like a Param, but can be implemented more simply + * since we need only one replacement value at a time. + * + * We also abuse this node type for some other purposes, including: + * * Placeholder for the current array element value in ArrayCoerceExpr; + * see build_coercion_expression(). + * * Nested FieldStore/SubscriptingRef assignment expressions in INSERT/UPDATE; + * see transformAssignmentIndirection(). + * * Placeholder for intermediate results in some SQL/JSON expression nodes, + * such as JsonConstructorExpr. + * + * The uses in CaseExpr and ArrayCoerceExpr are safe only to the extent that + * there is not any other CaseExpr or ArrayCoerceExpr between the value source + * node and its child CaseTestExpr(s). This is true in the parse analysis + * output, but the planner's function-inlining logic has to be careful not to + * break it. + * + * The nested-assignment-expression case is safe because the only node types + * that can be above such CaseTestExprs are FieldStore and SubscriptingRef. + */ +typedef struct CaseTestExpr +{ + Expr xpr; + Oid typeId; /* type for substituted value */ + /* typemod for substituted value */ + int32 typeMod pg_node_attr(query_jumble_ignore); + /* collation for the substituted value */ + Oid collation pg_node_attr(query_jumble_ignore); +} CaseTestExpr; + +/* + * ArrayExpr - an ARRAY[] expression + * + * Note: if multidims is false, the constituent expressions all yield the + * scalar type identified by element_typeid. If multidims is true, the + * constituent expressions all yield arrays of element_typeid (ie, the same + * type as array_typeid); at runtime we must check for compatible subscripts. + */ +typedef struct ArrayExpr +{ + Expr xpr; + /* type of expression result */ + Oid array_typeid pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid array_collid pg_node_attr(query_jumble_ignore); + /* common type of array elements */ + Oid element_typeid pg_node_attr(query_jumble_ignore); + /* the array elements or sub-arrays */ + List *elements pg_node_attr(query_jumble_squash); + /* true if elements are sub-arrays */ + bool multidims pg_node_attr(query_jumble_ignore); + /* location of the start of the elements list */ + ParseLoc list_start; + /* location of the end of the elements list */ + ParseLoc list_end; + /* token location, or -1 if unknown */ + ParseLoc location; +} ArrayExpr; + +/* + * RowExpr - a ROW() expression + * + * Note: the list of fields must have a one-for-one correspondence with + * physical fields of the associated rowtype, although it is okay for it + * to be shorter than the rowtype. That is, the N'th list element must + * match up with the N'th physical field. When the N'th physical field + * is a dropped column (attisdropped) then the N'th list element can just + * be a NULL constant. (This case can only occur for named composite types, + * not RECORD types, since those are built from the RowExpr itself rather + * than vice versa.) It is important not to assume that length(args) is + * the same as the number of columns logically present in the rowtype. + * + * colnames provides field names if the ROW() result is of type RECORD. + * Names *must* be provided if row_typeid is RECORDOID; but if it is a + * named composite type, colnames will be ignored in favor of using the + * type's cataloged field names, so colnames should be NIL. Like the + * args list, colnames is defined to be one-for-one with physical fields + * of the rowtype (although dropped columns shouldn't appear in the + * RECORD case, so this fine point is currently moot). + */ +typedef struct RowExpr +{ + Expr xpr; + List *args; /* the fields */ + + /* RECORDOID or a composite type's ID */ + Oid row_typeid pg_node_attr(query_jumble_ignore); + + /* + * row_typeid cannot be a domain over composite, only plain composite. To + * create a composite domain value, apply CoerceToDomain to the RowExpr. + * + * Note: we deliberately do NOT store a typmod. Although a typmod will be + * associated with specific RECORD types at runtime, it will differ for + * different backends, and so cannot safely be stored in stored + * parsetrees. We must assume typmod -1 for a RowExpr node. + * + * We don't need to store a collation either. The result type is + * necessarily composite, and composite types never have a collation. + */ + + /* how to display this node */ + CoercionForm row_format pg_node_attr(query_jumble_ignore); + + /* list of String, or NIL */ + List *colnames pg_node_attr(query_jumble_ignore); + + ParseLoc location; /* token location, or -1 if unknown */ +} RowExpr; + +/* + * RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2) + * + * We support row comparison for any operator that can be determined to + * act like =, <>, <, <=, >, or >= (we determine this by looking for the + * operator in btree opfamilies). Note that the same operator name might + * map to a different operator for each pair of row elements, since the + * element datatypes can vary. + * + * A RowCompareExpr node is only generated for the < <= > >= cases; + * the = and <> cases are translated to simple AND or OR combinations + * of the pairwise comparisons. + */ +typedef struct RowCompareExpr +{ + Expr xpr; + + /* LT LE GE or GT, never EQ or NE */ + CompareType cmptype; + /* OID list of pairwise comparison ops */ + List *opnos pg_node_attr(query_jumble_ignore); + /* OID list of containing operator families */ + List *opfamilies pg_node_attr(query_jumble_ignore); + /* OID list of collations for comparisons */ + List *inputcollids pg_node_attr(query_jumble_ignore); + /* the left-hand input arguments */ + List *largs; + /* the right-hand input arguments */ + List *rargs; +} RowCompareExpr; + +/* + * CoalesceExpr - a COALESCE expression + */ +typedef struct CoalesceExpr +{ + Expr xpr; + /* type of expression result */ + Oid coalescetype pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid coalescecollid pg_node_attr(query_jumble_ignore); + /* the arguments */ + List *args; + /* token location, or -1 if unknown */ + ParseLoc location; +} CoalesceExpr; + +/* + * MinMaxExpr - a GREATEST or LEAST function + */ +typedef enum MinMaxOp +{ + IS_GREATEST, + IS_LEAST +} MinMaxOp; + +typedef struct MinMaxExpr +{ + Expr xpr; + /* common type of arguments and result */ + Oid minmaxtype pg_node_attr(query_jumble_ignore); + /* OID of collation of result */ + Oid minmaxcollid pg_node_attr(query_jumble_ignore); + /* OID of collation that function should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + /* function to execute */ + MinMaxOp op; + /* the arguments */ + List *args; + /* token location, or -1 if unknown */ + ParseLoc location; +} MinMaxExpr; + +/* + * SQLValueFunction - parameterless functions with special grammar productions + * + * The SQL standard categorizes some of these as + * and others as . We call 'em SQLValueFunctions + * for lack of a better term. We store type and typmod of the result so that + * some code doesn't need to know each function individually, and because + * we would need to store typmod anyway for some of the datetime functions. + * Note that currently, all variants return non-collating datatypes, so we do + * not need a collation field; also, all these functions are stable. + */ +typedef enum SQLValueFunctionOp +{ + SVFOP_CURRENT_DATE, + SVFOP_CURRENT_TIME, + SVFOP_CURRENT_TIME_N, + SVFOP_CURRENT_TIMESTAMP, + SVFOP_CURRENT_TIMESTAMP_N, + SVFOP_LOCALTIME, + SVFOP_LOCALTIME_N, + SVFOP_LOCALTIMESTAMP, + SVFOP_LOCALTIMESTAMP_N, + SVFOP_CURRENT_ROLE, + SVFOP_CURRENT_USER, + SVFOP_USER, + SVFOP_SESSION_USER, + SVFOP_CURRENT_CATALOG, + SVFOP_CURRENT_SCHEMA, +} SQLValueFunctionOp; + +typedef struct SQLValueFunction +{ + Expr xpr; + SQLValueFunctionOp op; /* which function this is */ + + /* + * Result type/typmod. Type is fully determined by "op", so no need to + * include this Oid in the query jumbling. + */ + Oid type pg_node_attr(query_jumble_ignore); + int32 typmod; + ParseLoc location; /* token location, or -1 if unknown */ +} SQLValueFunction; + +/* + * XmlExpr - various SQL/XML functions requiring special grammar productions + * + * 'name' carries the "NAME foo" argument (already XML-escaped). + * 'named_args' and 'arg_names' represent an xml_attribute list. + * 'args' carries all other arguments. + * + * Note: result type/typmod/collation are not stored, but can be deduced + * from the XmlExprOp. The type/typmod fields are just used for display + * purposes, and are NOT necessarily the true result type of the node. + */ +typedef enum XmlExprOp +{ + IS_XMLCONCAT, /* XMLCONCAT(args) */ + IS_XMLELEMENT, /* XMLELEMENT(name, xml_attributes, args) */ + IS_XMLFOREST, /* XMLFOREST(xml_attributes) */ + IS_XMLPARSE, /* XMLPARSE(text, is_doc, preserve_ws) */ + IS_XMLPI, /* XMLPI(name [, args]) */ + IS_XMLROOT, /* XMLROOT(xml, version, standalone) */ + IS_XMLSERIALIZE, /* XMLSERIALIZE(is_document, xmlval, indent) */ + IS_DOCUMENT, /* xmlval IS DOCUMENT */ +} XmlExprOp; + +typedef enum XmlOptionType +{ + XMLOPTION_DOCUMENT, + XMLOPTION_CONTENT, +} XmlOptionType; + +typedef struct XmlExpr +{ + Expr xpr; + /* xml function ID */ + XmlExprOp op; + /* name in xml(NAME foo ...) syntaxes */ + char *name pg_node_attr(query_jumble_ignore); + /* non-XML expressions for xml_attributes */ + List *named_args; + /* parallel list of String values */ + List *arg_names pg_node_attr(query_jumble_ignore); + /* list of expressions */ + List *args; + /* DOCUMENT or CONTENT */ + XmlOptionType xmloption pg_node_attr(query_jumble_ignore); + /* INDENT option for XMLSERIALIZE */ + bool indent; + /* target type/typmod for XMLSERIALIZE */ + Oid type pg_node_attr(query_jumble_ignore); + int32 typmod pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} XmlExpr; + +/* + * JsonEncoding - + * representation of JSON ENCODING clause + */ +typedef enum JsonEncoding +{ + JS_ENC_DEFAULT, /* unspecified */ + JS_ENC_UTF8, + JS_ENC_UTF16, + JS_ENC_UTF32, +} JsonEncoding; + +/* + * JsonFormatType - + * enumeration of JSON formats used in JSON FORMAT clause + */ +typedef enum JsonFormatType +{ + JS_FORMAT_DEFAULT, /* unspecified */ + JS_FORMAT_JSON, /* FORMAT JSON [ENCODING ...] */ + JS_FORMAT_JSONB, /* implicit internal format for RETURNING + * jsonb */ +} JsonFormatType; + +/* + * JsonFormat - + * representation of JSON FORMAT clause + */ +typedef struct JsonFormat +{ + NodeTag type; + JsonFormatType format_type; /* format type */ + JsonEncoding encoding; /* JSON encoding */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonFormat; + +/* + * JsonReturning - + * transformed representation of JSON RETURNING clause + */ +typedef struct JsonReturning +{ + NodeTag type; + JsonFormat *format; /* output JSON format */ + Oid typid; /* target type Oid */ + int32 typmod; /* target type modifier */ +} JsonReturning; + +/* + * JsonValueExpr - + * representation of JSON value expression (expr [FORMAT JsonFormat]) + * + * raw_expr is the user-specified value, while formatted_expr is the value + * obtained by coercing raw_expr to the type required by either the FORMAT + * clause or an enclosing node's RETURNING clause. + * + * When deparsing a JsonValueExpr, get_rule_expr() prints raw_expr. However, + * during the evaluation of a JsonValueExpr, the value of formatted_expr + * takes precedence over that of raw_expr. + */ +typedef struct JsonValueExpr +{ + NodeTag type; + Expr *raw_expr; /* user-specified expression */ + Expr *formatted_expr; /* coerced formatted expression */ + JsonFormat *format; /* FORMAT clause, if specified */ +} JsonValueExpr; + +typedef enum JsonConstructorType +{ + JSCTOR_JSON_OBJECT = 1, + JSCTOR_JSON_ARRAY = 2, + JSCTOR_JSON_OBJECTAGG = 3, + JSCTOR_JSON_ARRAYAGG = 4, + JSCTOR_JSON_PARSE = 5, + JSCTOR_JSON_SCALAR = 6, + JSCTOR_JSON_SERIALIZE = 7, +} JsonConstructorType; + +/* + * JsonConstructorExpr - + * wrapper over FuncExpr/Aggref/WindowFunc for SQL/JSON constructors + */ +typedef struct JsonConstructorExpr +{ + Expr xpr; + JsonConstructorType type; /* constructor type */ + List *args; + Expr *func; /* underlying json[b]_xxx() function call */ + Expr *coercion; /* coercion to RETURNING type */ + JsonReturning *returning; /* RETURNING clause */ + bool absent_on_null; /* ABSENT ON NULL? */ + bool unique; /* WITH UNIQUE KEYS? (JSON_OBJECT[AGG] only) */ + ParseLoc location; +} JsonConstructorExpr; + +/* + * JsonValueType - + * representation of JSON item type in IS JSON predicate + */ +typedef enum JsonValueType +{ + JS_TYPE_ANY, /* IS JSON [VALUE] */ + JS_TYPE_OBJECT, /* IS JSON OBJECT */ + JS_TYPE_ARRAY, /* IS JSON ARRAY */ + JS_TYPE_SCALAR, /* IS JSON SCALAR */ +} JsonValueType; + +/* + * JsonIsPredicate - + * representation of IS JSON predicate + */ +typedef struct JsonIsPredicate +{ + NodeTag type; + Node *expr; /* subject expression */ + JsonFormat *format; /* FORMAT clause, if specified */ + JsonValueType item_type; /* JSON item type */ + bool unique_keys; /* check key uniqueness? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonIsPredicate; + +/* Nodes used in SQL/JSON query functions */ + +/* + * JsonWrapper - + * representation of WRAPPER clause for JSON_QUERY() + */ +typedef enum JsonWrapper +{ + JSW_UNSPEC, + JSW_NONE, + JSW_CONDITIONAL, + JSW_UNCONDITIONAL, +} JsonWrapper; + +/* + * JsonBehaviorType - + * enumeration of behavior types used in SQL/JSON ON ERROR/EMPTY clauses + * + * If enum members are reordered, get_json_behavior() from ruleutils.c + * must be updated accordingly. + */ +typedef enum JsonBehaviorType +{ + JSON_BEHAVIOR_NULL = 0, + JSON_BEHAVIOR_ERROR, + JSON_BEHAVIOR_EMPTY, + JSON_BEHAVIOR_TRUE, + JSON_BEHAVIOR_FALSE, + JSON_BEHAVIOR_UNKNOWN, + JSON_BEHAVIOR_EMPTY_ARRAY, + JSON_BEHAVIOR_EMPTY_OBJECT, + JSON_BEHAVIOR_DEFAULT, +} JsonBehaviorType; + +/* + * JsonBehavior + * Specifications for ON ERROR / ON EMPTY behaviors of SQL/JSON + * query functions specified by a JsonExpr + * + * 'expr' is the expression to emit when a given behavior (EMPTY or ERROR) + * occurs on evaluating the SQL/JSON query function. 'coerce' is set to true + * if 'expr' isn't already of the expected target type given by + * JsonExpr.returning. + */ +typedef struct JsonBehavior +{ + NodeTag type; + + JsonBehaviorType btype; + Node *expr; + bool coerce; + ParseLoc location; /* token location, or -1 if unknown */ +} JsonBehavior; + +/* + * JsonExprOp - + * enumeration of SQL/JSON query function types + */ +typedef enum JsonExprOp +{ + JSON_EXISTS_OP, /* JSON_EXISTS() */ + JSON_QUERY_OP, /* JSON_QUERY() */ + JSON_VALUE_OP, /* JSON_VALUE() */ + JSON_TABLE_OP, /* JSON_TABLE() */ +} JsonExprOp; + +/* + * JsonExpr - + * Transformed representation of JSON_VALUE(), JSON_QUERY(), and + * JSON_EXISTS() + */ +typedef struct JsonExpr +{ + Expr xpr; + + JsonExprOp op; + + char *column_name; /* JSON_TABLE() column name or NULL if this is + * not for a JSON_TABLE() */ + + /* jsonb-valued expression to query */ + Node *formatted_expr; + + /* Format of the above expression needed by ruleutils.c */ + JsonFormat *format; + + /* jsonpath-valued expression containing the query pattern */ + Node *path_spec; + + /* Expected type/format of the output. */ + JsonReturning *returning; + + /* Information about the PASSING argument expressions */ + List *passing_names; + List *passing_values; + + /* User-specified or default ON EMPTY and ON ERROR behaviors */ + JsonBehavior *on_empty; + JsonBehavior *on_error; + + /* + * Information about converting the result of jsonpath functions + * JsonPathQuery() and JsonPathValue() to the RETURNING type. + */ + bool use_io_coercion; + bool use_json_coercion; + + /* WRAPPER specification for JSON_QUERY */ + JsonWrapper wrapper; + + /* KEEP or OMIT QUOTES for singleton scalars returned by JSON_QUERY() */ + bool omit_quotes; + + /* JsonExpr's collation. */ + Oid collation; + + /* Original JsonFuncExpr's location */ + ParseLoc location; +} JsonExpr; + +/* + * JsonTablePath + * A JSON path expression to be computed as part of evaluating + * a JSON_TABLE plan node + */ +typedef struct JsonTablePath +{ + NodeTag type; + + Const *value; + char *name; +} JsonTablePath; + +/* + * JsonTablePlan - + * Abstract class to represent different types of JSON_TABLE "plans". + * A plan is used to generate a "row pattern" value by evaluating a JSON + * path expression against an input JSON document, which is then used for + * populating JSON_TABLE() columns + */ +typedef struct JsonTablePlan +{ + pg_node_attr(abstract) + + NodeTag type; +} JsonTablePlan; + +/* + * JSON_TABLE plan to evaluate a JSON path expression and NESTED paths, if + * any. + */ +typedef struct JsonTablePathScan +{ + JsonTablePlan plan; + + /* JSON path to evaluate */ + JsonTablePath *path; + + /* + * ERROR/EMPTY ON ERROR behavior; only significant in the plan for the + * top-level path. + */ + bool errorOnError; + + /* Plan(s) for nested columns, if any. */ + JsonTablePlan *child; + + /* + * 0-based index in TableFunc.colvalexprs of the 1st and the last column + * covered by this plan. Both are -1 if all columns are nested and thus + * computed by the child plan(s). + */ + int colMin; + int colMax; +} JsonTablePathScan; + +/* + * JsonTableSiblingJoin - + * Plan to join rows of sibling NESTED COLUMNS clauses in the same parent + * COLUMNS clause + */ +typedef struct JsonTableSiblingJoin +{ + JsonTablePlan plan; + + JsonTablePlan *lplan; + JsonTablePlan *rplan; +} JsonTableSiblingJoin; + +/* ---------------- + * NullTest + * + * NullTest represents the operation of testing a value for NULLness. + * The appropriate test is performed and returned as a boolean Datum. + * + * When argisrow is false, this simply represents a test for the null value. + * + * When argisrow is true, the input expression must yield a rowtype, and + * the node implements "row IS [NOT] NULL" per the SQL standard. This + * includes checking individual fields for NULLness when the row datum + * itself isn't NULL. + * + * NOTE: the combination of a rowtype input and argisrow==false does NOT + * correspond to the SQL notation "row IS [NOT] NULL"; instead, this case + * represents the SQL notation "row IS [NOT] DISTINCT FROM NULL". + * ---------------- + */ + +typedef enum NullTestType +{ + IS_NULL, IS_NOT_NULL +} NullTestType; + +typedef struct NullTest +{ + Expr xpr; + Expr *arg; /* input expression */ + NullTestType nulltesttype; /* IS NULL, IS NOT NULL */ + /* T to perform field-by-field null checks */ + bool argisrow pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} NullTest; + +/* + * BooleanTest + * + * BooleanTest represents the operation of determining whether a boolean + * is TRUE, FALSE, or UNKNOWN (ie, NULL). All six meaningful combinations + * are supported. Note that a NULL input does *not* cause a NULL result. + * The appropriate test is performed and returned as a boolean Datum. + */ + +typedef enum BoolTestType +{ + IS_TRUE, IS_NOT_TRUE, IS_FALSE, IS_NOT_FALSE, IS_UNKNOWN, IS_NOT_UNKNOWN +} BoolTestType; + +typedef struct BooleanTest +{ + Expr xpr; + Expr *arg; /* input expression */ + BoolTestType booltesttype; /* test type */ + ParseLoc location; /* token location, or -1 if unknown */ +} BooleanTest; + + +/* + * MergeAction + * + * Transformed representation of a WHEN clause in a MERGE statement + */ + +typedef enum MergeMatchKind +{ + MERGE_WHEN_MATCHED, + MERGE_WHEN_NOT_MATCHED_BY_SOURCE, + MERGE_WHEN_NOT_MATCHED_BY_TARGET +} MergeMatchKind; + +#define NUM_MERGE_MATCH_KINDS (MERGE_WHEN_NOT_MATCHED_BY_TARGET + 1) + +typedef struct MergeAction +{ + NodeTag type; + MergeMatchKind matchKind; /* MATCHED/NOT MATCHED BY SOURCE/TARGET */ + CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */ + /* OVERRIDING clause */ + OverridingKind override pg_node_attr(query_jumble_ignore); + Node *qual; /* transformed WHEN conditions */ + List *targetList; /* the target list (of TargetEntry) */ + /* target attribute numbers of an UPDATE */ + List *updateColnos pg_node_attr(query_jumble_ignore); +} MergeAction; + +/* + * CoerceToDomain + * + * CoerceToDomain represents the operation of coercing a value to a domain + * type. At runtime (and not before) the precise set of constraints to be + * checked will be determined. If the value passes, it is returned as the + * result; if not, an error is raised. Note that this is equivalent to + * RelabelType in the scenario where no constraints are applied. + */ +typedef struct CoerceToDomain +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid resulttype; /* domain type ID (result type) */ + /* output typmod (currently always -1) */ + int32 resulttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid resultcollid pg_node_attr(query_jumble_ignore); + /* how to display this node */ + CoercionForm coercionformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} CoerceToDomain; + +/* + * Placeholder node for the value to be processed by a domain's check + * constraint. This is effectively like a Param, but can be implemented more + * simply since we need only one replacement value at a time. + * + * Note: the typeId/typeMod/collation will be set from the domain's base type, + * not the domain itself. This is because we shouldn't consider the value + * to be a member of the domain if we haven't yet checked its constraints. + */ +typedef struct CoerceToDomainValue +{ + Expr xpr; + /* type for substituted value */ + Oid typeId; + /* typemod for substituted value */ + int32 typeMod pg_node_attr(query_jumble_ignore); + /* collation for the substituted value */ + Oid collation pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} CoerceToDomainValue; + +/* + * Placeholder node for a DEFAULT marker in an INSERT or UPDATE command. + * + * This is not an executable expression: it must be replaced by the actual + * column default expression during rewriting. But it is convenient to + * treat it as an expression node during parsing and rewriting. + */ +typedef struct SetToDefault +{ + Expr xpr; + /* type for substituted value */ + Oid typeId; + /* typemod for substituted value */ + int32 typeMod pg_node_attr(query_jumble_ignore); + /* collation for the substituted value */ + Oid collation pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} SetToDefault; + +/* + * Node representing [WHERE] CURRENT OF cursor_name + * + * CURRENT OF is a bit like a Var, in that it carries the rangetable index + * of the target relation being constrained; this aids placing the expression + * correctly during planning. We can assume however that its "levelsup" is + * always zero, due to the syntactic constraints on where it can appear. + * Also, cvarno will always be a true RT index, never INNER_VAR etc. + * + * The referenced cursor can be represented either as a hardwired string + * or as a reference to a run-time parameter of type REFCURSOR. The latter + * case is for the convenience of plpgsql. + */ +typedef struct CurrentOfExpr +{ + Expr xpr; + Index cvarno; /* RT index of target relation */ + char *cursor_name; /* name of referenced cursor, or NULL */ + int cursor_param; /* refcursor parameter number, or 0 */ +} CurrentOfExpr; + +/* + * NextValueExpr - get next value from sequence + * + * This has the same effect as calling the nextval() function, but it does not + * check permissions on the sequence. This is used for identity columns, + * where the sequence is an implicit dependency without its own permissions. + */ +typedef struct NextValueExpr +{ + Expr xpr; + Oid seqid; + Oid typeId; +} NextValueExpr; + +/* + * InferenceElem - an element of a unique index inference specification + * + * This mostly matches the structure of IndexElems, but having a dedicated + * primnode allows for a clean separation between the use of index parameters + * by utility commands, and this node. + */ +typedef struct InferenceElem +{ + Expr xpr; + Node *expr; /* expression to infer from, or NULL */ + Oid infercollid; /* OID of collation, or InvalidOid */ + Oid inferopclass; /* OID of att opclass, or InvalidOid */ +} InferenceElem; + +/* + * ReturningExpr - return OLD/NEW.(expression) in RETURNING list + * + * This is used when updating an auto-updatable view and returning a view + * column that is not simply a Var referring to the base relation. In such + * cases, OLD/NEW.viewcol can expand to an arbitrary expression, but the + * result is required to be NULL if the OLD/NEW row doesn't exist. To handle + * this, the rewriter wraps the expanded expression in a ReturningExpr, which + * is equivalent to "CASE WHEN (OLD/NEW row exists) THEN (expr) ELSE NULL". + * + * A similar situation can arise when rewriting the RETURNING clause of a + * rule, which may also contain arbitrary expressions. + * + * ReturningExpr nodes never appear in a parsed Query --- they are only ever + * inserted by the rewriter and the planner. + */ +typedef struct ReturningExpr +{ + Expr xpr; + int retlevelsup; /* > 0 if it belongs to outer query */ + bool retold; /* true for OLD, false for NEW */ + Expr *retexpr; /* expression to be returned */ +} ReturningExpr; + +/*-------------------- + * TargetEntry - + * a target entry (used in query target lists) + * + * Strictly speaking, a TargetEntry isn't an expression node (since it can't + * be evaluated by ExecEvalExpr). But we treat it as one anyway, since in + * very many places it's convenient to process a whole query targetlist as a + * single expression tree. + * + * In a SELECT's targetlist, resno should always be equal to the item's + * ordinal position (counting from 1). However, in an INSERT or UPDATE + * targetlist, resno represents the attribute number of the destination + * column for the item; so there may be missing or out-of-order resnos. + * It is even legal to have duplicated resnos; consider + * UPDATE table SET arraycol[1] = ..., arraycol[2] = ..., ... + * In an INSERT, the rewriter and planner will normalize the tlist by + * reordering it into physical column order and filling in default values + * for any columns not assigned values by the original query. In an UPDATE, + * after the rewriter merges multiple assignments for the same column, the + * planner extracts the target-column numbers into a separate "update_colnos" + * list, and then renumbers the tlist elements serially. Thus, tlist resnos + * match ordinal position in all tlists seen by the executor; but it is wrong + * to assume that before planning has happened. + * + * resname is required to represent the correct column name in non-resjunk + * entries of top-level SELECT targetlists, since it will be used as the + * column title sent to the frontend. In most other contexts it is only + * a debugging aid, and may be wrong or even NULL. (In particular, it may + * be wrong in a tlist from a stored rule, if the referenced column has been + * renamed by ALTER TABLE since the rule was made. Also, the planner tends + * to store NULL rather than look up a valid name for tlist entries in + * non-toplevel plan nodes.) In resjunk entries, resname should be either + * a specific system-generated name (such as "ctid") or NULL; anything else + * risks confusing ExecGetJunkAttribute! + * + * ressortgroupref is used in the representation of ORDER BY, GROUP BY, and + * DISTINCT items. Targetlist entries with ressortgroupref=0 are not + * sort/group items. If ressortgroupref>0, then this item is an ORDER BY, + * GROUP BY, and/or DISTINCT target value. No two entries in a targetlist + * may have the same nonzero ressortgroupref --- but there is no particular + * meaning to the nonzero values, except as tags. (For example, one must + * not assume that lower ressortgroupref means a more significant sort key.) + * The order of the associated SortGroupClause lists determine the semantics. + * + * resorigtbl/resorigcol identify the source of the column, if it is a + * simple reference to a column of a base table (or view). If it is not + * a simple reference, these fields are zeroes. + * + * If resjunk is true then the column is a working column (such as a sort key) + * that should be removed from the final output of the query. Resjunk columns + * must have resnos that cannot duplicate any regular column's resno. Also + * note that there are places that assume resjunk columns come after non-junk + * columns. + *-------------------- + */ +typedef struct TargetEntry +{ + Expr xpr; + /* expression to evaluate */ + Expr *expr; + /* attribute number (see notes above) */ + AttrNumber resno; + /* name of the column (could be NULL) */ + char *resname pg_node_attr(query_jumble_ignore); + /* nonzero if referenced by a sort/group clause */ + Index ressortgroupref; + /* OID of column's source table */ + Oid resorigtbl pg_node_attr(query_jumble_ignore); + /* column's number in source table */ + AttrNumber resorigcol pg_node_attr(query_jumble_ignore); + /* set to true to eliminate the attribute from final target list */ + bool resjunk pg_node_attr(query_jumble_ignore); +} TargetEntry; + + +/* ---------------------------------------------------------------- + * node types for join trees + * + * The leaves of a join tree structure are RangeTblRef nodes. Above + * these, JoinExpr nodes can appear to denote a specific kind of join + * or qualified join. Also, FromExpr nodes can appear to denote an + * ordinary cross-product join ("FROM foo, bar, baz WHERE ..."). + * FromExpr is like a JoinExpr of jointype JOIN_INNER, except that it + * may have any number of child nodes, not just two. + * + * NOTE: the top level of a Query's jointree is always a FromExpr. + * Even if the jointree contains no rels, there will be a FromExpr. + * + * NOTE: the qualification expressions present in JoinExpr nodes are + * *in addition to* the query's main WHERE clause, which appears as the + * qual of the top-level FromExpr. The reason for associating quals with + * specific nodes in the jointree is that the position of a qual is critical + * when outer joins are present. (If we enforce a qual too soon or too late, + * that may cause the outer join to produce the wrong set of NULL-extended + * rows.) If all joins are inner joins then all the qual positions are + * semantically interchangeable. + * + * NOTE: in the raw output of gram.y, a join tree contains RangeVar, + * RangeSubselect, and RangeFunction nodes, which are all replaced by + * RangeTblRef nodes during the parse analysis phase. Also, the top-level + * FromExpr is added during parse analysis; the grammar regards FROM and + * WHERE as separate. + * ---------------------------------------------------------------- + */ + +/* + * RangeTblRef - reference to an entry in the query's rangetable + * + * We could use direct pointers to the RT entries and skip having these + * nodes, but multiple pointers to the same node in a querytree cause + * lots of headaches, so it seems better to store an index into the RT. + */ +typedef struct RangeTblRef +{ + NodeTag type; + int rtindex; +} RangeTblRef; + +/*---------- + * JoinExpr - for SQL JOIN expressions + * + * isNatural, usingClause, and quals are interdependent. The user can write + * only one of NATURAL, USING(), or ON() (this is enforced by the grammar). + * If he writes NATURAL then parse analysis generates the equivalent USING() + * list, and from that fills in "quals" with the right equality comparisons. + * If he writes USING() then "quals" is filled with equality comparisons. + * If he writes ON() then only "quals" is set. Note that NATURAL/USING + * are not equivalent to ON() since they also affect the output column list. + * + * alias is an Alias node representing the AS alias-clause attached to the + * join expression, or NULL if no clause. NB: presence or absence of the + * alias has a critical impact on semantics, because a join with an alias + * restricts visibility of the tables/columns inside it. + * + * join_using_alias is an Alias node representing the join correlation + * name that SQL:2016 and later allow to be attached to JOIN/USING. + * Its column alias list includes only the common column names from USING, + * and it does not restrict visibility of the join's input tables. + * + * During parse analysis, an RTE is created for the Join, and its index + * is filled into rtindex. This RTE is present mainly so that Vars can + * be created that refer to the outputs of the join. The planner sometimes + * generates JoinExprs internally; these can have rtindex = 0 if there are + * no join alias variables referencing such joins. + *---------- + */ +typedef struct JoinExpr +{ + NodeTag type; + JoinType jointype; /* type of join */ + bool isNatural; /* Natural join? Will need to shape table */ + Node *larg; /* left subtree */ + Node *rarg; /* right subtree */ + /* USING clause, if any (list of String) */ + List *usingClause pg_node_attr(query_jumble_ignore); + /* alias attached to USING clause, if any */ + Alias *join_using_alias pg_node_attr(query_jumble_ignore); + /* qualifiers on join, if any */ + Node *quals; + /* user-written alias clause, if any */ + Alias *alias pg_node_attr(query_jumble_ignore); + /* RT index assigned for join, or 0 */ + int rtindex; +} JoinExpr; + +/*---------- + * FromExpr - represents a FROM ... WHERE ... construct + * + * This is both more flexible than a JoinExpr (it can have any number of + * children, including zero) and less so --- we don't need to deal with + * aliases and so on. The output column set is implicitly just the union + * of the outputs of the children. + *---------- + */ +typedef struct FromExpr +{ + NodeTag type; + List *fromlist; /* List of join subtrees */ + Node *quals; /* qualifiers on join, if any */ +} FromExpr; + +/*---------- + * OnConflictExpr - represents an ON CONFLICT DO ... expression + * + * The optimizer requires a list of inference elements, and optionally a WHERE + * clause to infer a unique index. The unique index (or, occasionally, + * indexes) inferred are used to arbitrate whether or not the alternative ON + * CONFLICT path is taken. + *---------- + */ +typedef struct OnConflictExpr +{ + NodeTag type; + OnConflictAction action; /* DO NOTHING or UPDATE? */ + + /* Arbiter */ + List *arbiterElems; /* unique index arbiter list (of + * InferenceElem's) */ + Node *arbiterWhere; /* unique index arbiter WHERE clause */ + Oid constraint; /* pg_constraint OID for arbiter */ + + /* ON CONFLICT UPDATE */ + List *onConflictSet; /* List of ON CONFLICT SET TargetEntrys */ + Node *onConflictWhere; /* qualifiers to restrict UPDATE to */ + int exclRelIndex; /* RT index of 'excluded' relation */ + List *exclRelTlist; /* tlist of the EXCLUDED pseudo relation */ +} OnConflictExpr; + +#endif /* PRIMNODES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/print.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/print.h new file mode 100644 index 0000000..cc304da --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/print.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * print.h + * definitions for nodes/print.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/print.h + * + *------------------------------------------------------------------------- + */ +#ifndef PRINT_H +#define PRINT_H + +#include "executor/tuptable.h" + + +#define nodeDisplay(x) pprint(x) + +extern void print(const void *obj); +extern void pprint(const void *obj); +extern void elog_node_display(int lev, const char *title, + const void *obj, bool pretty); +extern char *format_node_dump(const char *dump); +extern char *pretty_format_node_dump(const char *dump); +extern void print_rt(const List *rtable); +extern void print_expr(const Node *expr, const List *rtable); +extern void print_pathkeys(const List *pathkeys, const List *rtable); +extern void print_tl(const List *tlist, const List *rtable); +extern void print_slot(TupleTableSlot *slot); + +#endif /* PRINT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/queryjumble.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/queryjumble.h new file mode 100644 index 0000000..dcb36dc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/queryjumble.h @@ -0,0 +1,113 @@ +/*------------------------------------------------------------------------- + * + * queryjumble.h + * Query normalization and fingerprinting. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/nodes/queryjumble.h + * + *------------------------------------------------------------------------- + */ +#ifndef QUERYJUMBLE_H +#define QUERYJUMBLE_H + +#include "nodes/parsenodes.h" + +/* + * Struct for tracking locations/lengths of constants during normalization + */ +typedef struct LocationLen +{ + int location; /* start offset in query text */ + int length; /* length in bytes, or -1 to ignore */ + + /* Does this location represent a squashed list? */ + bool squashed; + + /* Is this location a PARAM_EXTERN parameter? */ + bool extern_param; +} LocationLen; + +/* + * Working state for computing a query jumble and producing a normalized + * query string + */ +typedef struct JumbleState +{ + /* Jumble of current query tree */ + unsigned char *jumble; + + /* Number of bytes used in jumble[] */ + Size jumble_len; + + /* Array of locations of constants that should be removed */ + LocationLen *clocations; + + /* Allocated length of clocations array */ + int clocations_buf_size; + + /* Current number of valid entries in clocations array */ + int clocations_count; + + /* + * ID of the highest PARAM_EXTERN parameter we've seen in the query; used + * to start normalization correctly. However, if there are any squashed + * lists in the query, we disregard query-supplied parameter numbers and + * renumber everything. This is to avoid possible gaps caused by + * squashing in case any params are in squashed lists. + */ + int highest_extern_param_id; + + /* Whether squashable lists are present */ + bool has_squashed_lists; + + /* + * Count of the number of NULL nodes seen since last appending a value. + * These are flushed out to the jumble buffer before subsequent appends + * and before performing the final jumble hash. + */ + unsigned int pending_nulls; + +#ifdef USE_ASSERT_CHECKING + /* The total number of bytes added to the jumble buffer */ + Size total_jumble_len; +#endif +} JumbleState; + +/* Values for the compute_query_id GUC */ +enum ComputeQueryIdType +{ + COMPUTE_QUERY_ID_OFF, + COMPUTE_QUERY_ID_ON, + COMPUTE_QUERY_ID_AUTO, + COMPUTE_QUERY_ID_REGRESS, +}; + +/* GUC parameters */ +extern PGDLLIMPORT int compute_query_id; + + +extern const char *CleanQuerytext(const char *query, int *location, int *len); +extern JumbleState *JumbleQuery(Query *query); +extern void EnableQueryId(void); + +extern PGDLLIMPORT bool query_id_enabled; + +/* + * Returns whether query identifier computation has been enabled, either + * directly in the GUC or by a module when the setting is 'auto'. + */ +static inline bool +IsQueryIdEnabled(void) +{ + if (compute_query_id == COMPUTE_QUERY_ID_OFF) + return false; + if (compute_query_id == COMPUTE_QUERY_ID_ON) + return true; + return query_id_enabled; +} + +#endif /* QUERYJUMBLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/readfuncs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/readfuncs.h new file mode 100644 index 0000000..dd260c4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/readfuncs.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * readfuncs.h + * header file for read.c and readfuncs.c. These functions are internal + * to the stringToNode interface and should not be used by anyone else. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/readfuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef READFUNCS_H +#define READFUNCS_H + +#include "nodes/nodes.h" + +/* + * variable in read.c that needs to be accessible to readfuncs.c + */ +#ifdef DEBUG_NODE_TESTS_ENABLED +extern PGDLLIMPORT bool restore_location_fields; +#endif + +/* + * prototypes for functions in read.c (the lisp token parser) + */ +extern const char *pg_strtok(int *length); +extern char *debackslash(const char *token, int length); +extern void *nodeRead(const char *token, int tok_len); + +/* + * prototypes for functions in readfuncs.c + */ +extern Node *parseNodeString(void); + +#endif /* READFUNCS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/replnodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/replnodes.h new file mode 100644 index 0000000..87e9389 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/replnodes.h @@ -0,0 +1,132 @@ +/*------------------------------------------------------------------------- + * + * replnodes.h + * definitions for replication grammar parse nodes + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/replnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef REPLNODES_H +#define REPLNODES_H + +#include "access/xlogdefs.h" +#include "nodes/pg_list.h" + +typedef enum ReplicationKind +{ + REPLICATION_KIND_PHYSICAL, + REPLICATION_KIND_LOGICAL, +} ReplicationKind; + + +/* ---------------------- + * IDENTIFY_SYSTEM command + * ---------------------- + */ +typedef struct IdentifySystemCmd +{ + NodeTag type; +} IdentifySystemCmd; + + +/* ---------------------- + * BASE_BACKUP command + * ---------------------- + */ +typedef struct BaseBackupCmd +{ + NodeTag type; + List *options; +} BaseBackupCmd; + + +/* ---------------------- + * CREATE_REPLICATION_SLOT command + * ---------------------- + */ +typedef struct CreateReplicationSlotCmd +{ + NodeTag type; + char *slotname; + ReplicationKind kind; + char *plugin; + bool temporary; + List *options; +} CreateReplicationSlotCmd; + + +/* ---------------------- + * DROP_REPLICATION_SLOT command + * ---------------------- + */ +typedef struct DropReplicationSlotCmd +{ + NodeTag type; + char *slotname; + bool wait; +} DropReplicationSlotCmd; + + +/* ---------------------- + * ALTER_REPLICATION_SLOT command + * ---------------------- + */ +typedef struct AlterReplicationSlotCmd +{ + NodeTag type; + char *slotname; + List *options; +} AlterReplicationSlotCmd; + + +/* ---------------------- + * START_REPLICATION command + * ---------------------- + */ +typedef struct StartReplicationCmd +{ + NodeTag type; + ReplicationKind kind; + char *slotname; + TimeLineID timeline; + XLogRecPtr startpoint; + List *options; +} StartReplicationCmd; + + +/* ---------------------- + * READ_REPLICATION_SLOT command + * ---------------------- + */ +typedef struct ReadReplicationSlotCmd +{ + NodeTag type; + char *slotname; +} ReadReplicationSlotCmd; + + +/* ---------------------- + * TIMELINE_HISTORY command + * ---------------------- + */ +typedef struct TimeLineHistoryCmd +{ + NodeTag type; + TimeLineID timeline; +} TimeLineHistoryCmd; + +/* ---------------------- + * UPLOAD_MANIFEST command + * ---------------------- + */ +typedef struct UploadManifestCmd +{ + NodeTag type; +} UploadManifestCmd; + +#endif /* REPLNODES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/subscripting.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/subscripting.h new file mode 100644 index 0000000..234e8ad --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/subscripting.h @@ -0,0 +1,167 @@ +/*------------------------------------------------------------------------- + * + * subscripting.h + * API for generic type subscripting + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/subscripting.h + * + *------------------------------------------------------------------------- + */ +#ifndef SUBSCRIPTING_H +#define SUBSCRIPTING_H + +#include "nodes/primnodes.h" + +/* Forward declarations, to avoid including other headers */ +struct ParseState; +struct SubscriptingRefState; +struct SubscriptExecSteps; + +/* + * The SQL-visible function that defines a subscripting method is declared + * subscripting_function(internal) returns internal + * but it actually is not passed any parameter. It must return a pointer + * to a "struct SubscriptRoutines" that provides pointers to the individual + * subscript parsing and execution methods. Typically the pointer will point + * to a "static const" variable, but at need it can point to palloc'd space. + * The type (after domain-flattening) of the head variable or expression + * of a subscripting construct determines which subscripting function is + * called for that construct. + * + * In addition to the method pointers, struct SubscriptRoutines includes + * several bool flags that specify properties of the subscripting actions + * this data type can perform: + * + * fetch_strict indicates that a fetch SubscriptRef is strict, i.e., returns + * NULL if any input (either the container or any subscript) is NULL. + * + * fetch_leakproof indicates that a fetch SubscriptRef is leakproof, i.e., + * will not throw any data-value-dependent errors. Typically this requires + * silently returning NULL for invalid subscripts. + * + * store_leakproof similarly indicates whether an assignment SubscriptRef is + * leakproof. (It is common to prefer throwing errors for invalid subscripts + * in assignments; that's fine, but it makes the operation not leakproof. + * In current usage there is no advantage in making assignments leakproof.) + * + * There is no store_strict flag. Such behavior would generally be + * undesirable, since for example a null subscript in an assignment would + * cause the entire container to become NULL. + * + * Regardless of these flags, all SubscriptRefs are expected to be immutable, + * that is they must always give the same results for the same inputs. + * They are expected to always be parallel-safe, as well. + */ + +/* + * The transform method is called during parse analysis of a subscripting + * construct. The SubscriptingRef node has been constructed, but some of + * its fields still need to be filled in, and the subscript expression(s) + * are still in raw form. The transform method is responsible for doing + * parse analysis of each subscript expression (using transformExpr), + * coercing the subscripts to whatever type it needs, and building the + * refupperindexpr and reflowerindexpr lists from those results. The + * reflowerindexpr list must be empty for an element operation, or the + * same length as refupperindexpr for a slice operation. Insert NULLs + * (that is, an empty parse tree, not a null Const node) for any omitted + * subscripts in a slice operation. (Of course, if the transform method + * does not care to support slicing, it can just throw an error if isSlice.) + * See array_subscript_transform() for sample code. + * + * The transform method is also responsible for identifying the result type + * of the subscripting operation. At call, refcontainertype and reftypmod + * describe the container type (this will be a base type not a domain), and + * refelemtype is set to the container type's pg_type.typelem value. The + * transform method must set refrestype and reftypmod to describe the result + * of subscripting. For arrays, refrestype is set to refelemtype for an + * element operation or refcontainertype for a slice, while reftypmod stays + * the same in either case; but other types might use other rules. The + * transform method should ignore refcollid, as that's determined later on + * during parsing. + * + * At call, refassgnexpr has not been filled in, so the SubscriptingRef node + * always looks like a fetch; refrestype should be set as though for a + * fetch, too. (The isAssignment parameter is typically only useful if the + * transform method wishes to throw an error for not supporting assignment.) + * To complete processing of an assignment, the core parser will coerce the + * element/slice source expression to the returned refrestype and reftypmod + * before putting it into refassgnexpr. It will then set refrestype and + * reftypmod to again describe the container type, since that's what an + * assignment must return. + */ +typedef void (*SubscriptTransform) (SubscriptingRef *sbsref, + List *indirection, + struct ParseState *pstate, + bool isSlice, + bool isAssignment); + +/* + * The exec_setup method is called during executor-startup compilation of a + * SubscriptingRef node in an expression. It must fill *methods with pointers + * to functions that can be called for execution of the node. Optionally, + * exec_setup can initialize sbsrefstate->workspace to point to some palloc'd + * workspace for execution. (Typically, such workspace is used to hold + * looked-up catalog data and/or provide space for the check_subscripts step + * to pass data forward to the other step functions.) See executor/execExpr.h + * for the definitions of these structs and other ones used in expression + * execution. + * + * The methods to be provided are: + * + * sbs_check_subscripts: examine the just-computed subscript values available + * in sbsrefstate's arrays, and possibly convert them into another form + * (stored in sbsrefstate->workspace). Return TRUE to continue with + * evaluation of the subscripting construct, or FALSE to skip it and return an + * overall NULL result. If this is a fetch and the data type's fetch_strict + * flag is true, then sbs_check_subscripts must return FALSE if there are any + * NULL subscripts. Otherwise it can choose to throw an error, or return + * FALSE, or let sbs_fetch or sbs_assign deal with the null subscripts. + * + * sbs_fetch: perform a subscripting fetch, using the container value in + * *op->resvalue and the subscripts from sbs_check_subscripts. If + * fetch_strict is true then all these inputs can be assumed non-NULL, + * otherwise sbs_fetch must check for null inputs. Place the result in + * *op->resvalue / *op->resnull. + * + * sbs_assign: perform a subscripting assignment, using the original + * container value in *op->resvalue / *op->resnull, the subscripts from + * sbs_check_subscripts, and the new element/slice value in + * sbsrefstate->replacevalue/replacenull. Any of these inputs might be NULL + * (unless sbs_check_subscripts rejected null subscripts). Place the result + * (an entire new container value) in *op->resvalue / *op->resnull. + * + * sbs_fetch_old: this is only used in cases where an element or slice + * assignment involves an assignment to a sub-field or sub-element + * (i.e., nested containers are involved). It must fetch the existing + * value of the target element or slice. This is exactly the same as + * sbs_fetch except that (a) it must cope with a NULL container, and + * with NULL subscripts if sbs_check_subscripts allows them (typically, + * returning NULL is good enough); and (b) the result must be placed in + * sbsrefstate->prevvalue/prevnull, without overwriting *op->resvalue. + * + * Subscripting implementations that do not support assignment need not + * provide sbs_assign or sbs_fetch_old methods. It might be reasonable + * to also omit sbs_check_subscripts, in which case the sbs_fetch method must + * combine the functionality of sbs_check_subscripts and sbs_fetch. (The + * main reason to have a separate sbs_check_subscripts method is so that + * sbs_fetch_old and sbs_assign need not duplicate subscript processing.) + * Set the relevant pointers to NULL for any omitted methods. + */ +typedef void (*SubscriptExecSetup) (const SubscriptingRef *sbsref, + struct SubscriptingRefState *sbsrefstate, + struct SubscriptExecSteps *methods); + +/* Struct returned by the SQL-visible subscript handler function */ +typedef struct SubscriptRoutines +{ + SubscriptTransform transform; /* parse analysis function */ + SubscriptExecSetup exec_setup; /* expression compilation function */ + bool fetch_strict; /* is fetch SubscriptRef strict? */ + bool fetch_leakproof; /* is fetch SubscriptRef leakproof? */ + bool store_leakproof; /* is assignment SubscriptRef leakproof? */ +} SubscriptRoutines; + +#endif /* SUBSCRIPTING_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/supportnodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/supportnodes.h new file mode 100644 index 0000000..9c047cc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/supportnodes.h @@ -0,0 +1,393 @@ +/*------------------------------------------------------------------------- + * + * supportnodes.h + * Definitions for planner support functions. + * + * This file defines the API for "planner support functions", which + * are SQL functions (normally written in C) that can be attached to + * another "target" function to give the system additional knowledge + * about the target function. The name is now something of a misnomer, + * since some of the call sites are in the executor not the planner, + * but "function support function" would be a confusing name so we + * stick with "planner support function". + * + * A support function must have the SQL signature + * supportfn(internal) returns internal + * The argument is a pointer to one of the Node types defined in this file. + * The result is usually also a Node pointer, though its type depends on + * which capability is being invoked. In all cases, a NULL pointer result + * (that's PG_RETURN_POINTER(NULL), not PG_RETURN_NULL()) indicates that + * the support function cannot do anything useful for the given request. + * Support functions must return a NULL pointer, not fail, if they do not + * recognize the request node type or cannot handle the given case; this + * allows for future extensions of the set of request cases. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/supportnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef SUPPORTNODES_H +#define SUPPORTNODES_H + +#include "nodes/plannodes.h" + +struct PlannerInfo; /* avoid including pathnodes.h here */ +struct IndexOptInfo; +struct SpecialJoinInfo; +struct WindowClause; + +/* + * The Simplify request allows the support function to perform plan-time + * simplification of a call to its target function. For example, a varchar + * length coercion that does not decrease the allowed length of its argument + * could be replaced by a RelabelType node, or "x + 0" could be replaced by + * "x". This is invoked during the planner's constant-folding pass, so the + * function's arguments can be presumed already simplified. + * + * The planner's PlannerInfo "root" is typically not needed, but can be + * consulted if it's necessary to obtain info about Vars present in + * the given node tree. Beware that root could be NULL in some usages. + * + * "fcall" will be a FuncExpr invoking the support function's target + * function. (This is true even if the original parsetree node was an + * operator call; a FuncExpr is synthesized for this purpose.) + * + * The result should be a semantically-equivalent transformed node tree, + * or NULL if no simplification could be performed. Do *not* return or + * modify *fcall, as it isn't really a separately allocated Node. But + * it's okay to use fcall->args, or parts of it, in the result tree. + */ +typedef struct SupportRequestSimplify +{ + NodeTag type; + + struct PlannerInfo *root; /* Planner's infrastructure */ + FuncExpr *fcall; /* Function call to be simplified */ +} SupportRequestSimplify; + +/* + * The Selectivity request allows the support function to provide a + * selectivity estimate for a function appearing at top level of a WHERE + * clause (so it applies only to functions returning boolean). + * + * The input arguments are the same as are supplied to operator restriction + * and join estimators, except that we unify those two APIs into just one + * request type. See clause_selectivity() for the details. + * + * If an estimate can be made, store it into the "selectivity" field and + * return the address of the SupportRequestSelectivity node; the estimate + * must be between 0 and 1 inclusive. Return NULL if no estimate can be + * made (in which case the planner will fall back to a default estimate, + * traditionally 1/3). + * + * If the target function is being used as the implementation of an operator, + * the support function will not be used for this purpose; the operator's + * restriction or join estimator is consulted instead. + */ +typedef struct SupportRequestSelectivity +{ + NodeTag type; + + /* Input fields: */ + struct PlannerInfo *root; /* Planner's infrastructure */ + Oid funcid; /* function we are inquiring about */ + List *args; /* pre-simplified arguments to function */ + Oid inputcollid; /* function's input collation */ + bool is_join; /* is this a join or restriction case? */ + int varRelid; /* if restriction, RTI of target relation */ + JoinType jointype; /* if join, outer join type */ + struct SpecialJoinInfo *sjinfo; /* if outer join, info about join */ + + /* Output fields: */ + Selectivity selectivity; /* returned selectivity estimate */ +} SupportRequestSelectivity; + +/* + * The Cost request allows the support function to provide an execution + * cost estimate for its target function. The cost estimate can include + * both a one-time (query startup) component and a per-execution component. + * The estimate should *not* include the costs of evaluating the target + * function's arguments, only the target function itself. + * + * The "node" argument is normally the parse node that is invoking the + * target function. This is a FuncExpr in the simplest case, but it could + * also be an OpExpr, DistinctExpr, NullIfExpr, or WindowFunc, or possibly + * other cases in future. NULL is passed if the function cannot presume + * its arguments to be equivalent to what the calling node presents as + * arguments; that happens for, e.g., aggregate support functions and + * per-column comparison operators used by RowExprs. + * + * If an estimate can be made, store it into the cost fields and return the + * address of the SupportRequestCost node. Return NULL if no estimate can be + * made, in which case the planner will rely on the target function's procost + * field. (Note: while procost is automatically scaled by cpu_operator_cost, + * this is not the case for the outputs of the Cost request; the support + * function must scale its results appropriately on its own.) + */ +typedef struct SupportRequestCost +{ + NodeTag type; + + /* Input fields: */ + struct PlannerInfo *root; /* Planner's infrastructure (could be NULL) */ + Oid funcid; /* function we are inquiring about */ + Node *node; /* parse node invoking function, or NULL */ + + /* Output fields: */ + Cost startup; /* one-time cost */ + Cost per_tuple; /* per-evaluation cost */ +} SupportRequestCost; + +/* + * The Rows request allows the support function to provide an output rowcount + * estimate for its target function (so it applies only to set-returning + * functions). + * + * The "node" argument is the parse node that is invoking the target function; + * currently this will always be a FuncExpr or OpExpr. + * + * If an estimate can be made, store it into the rows field and return the + * address of the SupportRequestRows node. Return NULL if no estimate can be + * made, in which case the planner will rely on the target function's prorows + * field. + */ +typedef struct SupportRequestRows +{ + NodeTag type; + + /* Input fields: */ + struct PlannerInfo *root; /* Planner's infrastructure (could be NULL) */ + Oid funcid; /* function we are inquiring about */ + Node *node; /* parse node invoking function */ + + /* Output fields: */ + double rows; /* number of rows expected to be returned */ +} SupportRequestRows; + +/* + * The IndexCondition request allows the support function to generate + * a directly-indexable condition based on a target function call that is + * not itself indexable. The target function call must appear at the top + * level of WHERE or JOIN/ON, so this applies only to functions returning + * boolean. + * + * The "node" argument is the parse node that is invoking the target function; + * currently this will always be a FuncExpr or OpExpr. The call is made + * only if at least one function argument matches an index column's variable + * or expression. "indexarg" identifies the matching argument (it's the + * argument's zero-based index in the node's args list). + * + * If the transformation is possible, return a List of directly-indexable + * condition expressions, else return NULL. (A List is used because it's + * sometimes useful to generate more than one indexable condition, such as + * when a LIKE with constant prefix gives rise to both >= and < conditions.) + * + * "Directly indexable" means that the condition must be directly executable + * by the index machinery. Typically this means that it is a binary OpExpr + * with the index column value on the left, a pseudo-constant on the right, + * and an operator that is in the index column's operator family. Other + * possibilities include RowCompareExpr, ScalarArrayOpExpr, and NullTest, + * depending on the index type; but those seem less likely to be useful for + * derived index conditions. "Pseudo-constant" means that the right-hand + * expression must not contain any volatile functions, nor any Vars of the + * table the index is for; use is_pseudo_constant_for_index() to check this. + * (Note: if the passed "node" is an OpExpr, the core planner already verified + * that the non-indexkey operand is pseudo-constant; but when the "node" + * is a FuncExpr, it does not check, since it doesn't know which of the + * function's arguments you might need to use in an index comparison value.) + * + * In many cases, an index condition can be generated but it is weaker than + * the function condition itself; for example, a LIKE with a constant prefix + * can produce an index range check based on the prefix, but we still need + * to execute the LIKE operator to verify the rest of the pattern. We say + * that such an index condition is "lossy". When returning an index condition, + * you should set the "lossy" request field to true if the condition is lossy, + * or false if it is an exact equivalent of the function's result. The core + * code will initialize that field to true, which is the common case. + * + * It is important to verify that the index operator family is the correct + * one for the condition you want to generate. Core support functions tend + * to use the known OID of a built-in opfamily for this, but extensions need + * to work harder, since their OIDs aren't fixed. A possibly workable + * answer for an index on an extension datatype is to verify the index AM's + * OID instead, and then assume that there's only one relevant opclass for + * your datatype so the opfamily must be the right one. Generating OpExpr + * nodes may also require knowing extension datatype OIDs (often you can + * find these out by applying exprType() to a function argument) and + * operator OIDs (which you can look up using get_opfamily_member). + */ +typedef struct SupportRequestIndexCondition +{ + NodeTag type; + + /* Input fields: */ + struct PlannerInfo *root; /* Planner's infrastructure */ + Oid funcid; /* function we are inquiring about */ + Node *node; /* parse node invoking function */ + int indexarg; /* index of function arg matching indexcol */ + struct IndexOptInfo *index; /* planner's info about target index */ + int indexcol; /* index of target index column (0-based) */ + Oid opfamily; /* index column's operator family */ + Oid indexcollation; /* index column's collation */ + + /* Output fields: */ + bool lossy; /* set to false if index condition is an exact + * equivalent of the function call */ +} SupportRequestIndexCondition; + +/* ---------- + * To support more efficient query execution of any monotonically increasing + * and/or monotonically decreasing window functions, we support calling the + * window function's prosupport function passing along this struct whenever + * the planner sees an OpExpr qual directly reference a window function in a + * subquery. When the planner encounters this, we populate this struct and + * pass it along to the window function's prosupport function so that it can + * evaluate if the given WindowFunc is; + * + * a) monotonically increasing, or + * b) monotonically decreasing, or + * c) both monotonically increasing and decreasing, or + * d) none of the above. + * + * A function that is monotonically increasing can never return a value that + * is lower than a value returned in a "previous call". A monotonically + * decreasing function can never return a value higher than a value returned + * in a previous call. A function that is both must return the same value + * each time. + * + * We define "previous call" to mean a previous call to the same WindowFunc + * struct in the same window partition. + * + * row_number() is an example of a monotonically increasing function. The + * return value will be reset back to 1 in each new partition. An example of + * a monotonically increasing and decreasing function is COUNT(*) OVER (). + * Since there is no ORDER BY clause in this example, all rows in the + * partition are peers and all rows within the partition will be within the + * frame bound. Likewise for COUNT(*) OVER(ORDER BY a ROWS BETWEEN UNBOUNDED + * PRECEDING AND UNBOUNDED FOLLOWING). + * + * COUNT(*) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + * is an example of a monotonically decreasing function. + * + * Implementations must only concern themselves with the given WindowFunc + * being monotonic in a single partition. + * + * Inputs: + * 'window_func' is the pointer to the window function being called. + * + * 'window_clause' pointer to the WindowClause data. Support functions can + * use this to check frame bounds, etc. + * + * Outputs: + * 'monotonic' the resulting MonotonicFunction value for the given input + * window function and window clause. + * ---------- + */ +typedef struct SupportRequestWFuncMonotonic +{ + NodeTag type; + + /* Input fields: */ + WindowFunc *window_func; /* Pointer to the window function data */ + struct WindowClause *window_clause; /* Pointer to the window clause data */ + + /* Output fields: */ + MonotonicFunction monotonic; +} SupportRequestWFuncMonotonic; + +/* + * Some WindowFunc behavior might not be affected by certain variations in + * the WindowClause's frameOptions. For example, row_number() is coded in + * such a way that the frame options don't change the returned row number. + * nodeWindowAgg.c will have less work to do if the ROWS option is used + * instead of the RANGE option as no check needs to be done for peer rows. + * Since RANGE is included in the default frame options, window functions + * such as row_number() might want to change that to ROW. + * + * Here we allow a WindowFunc's support function to determine which, if + * anything, can be changed about the WindowClause which the WindowFunc + * belongs to. Currently only the frameOptions can be modified. However, + * we may want to allow more optimizations in the future. + * + * The support function is responsible for ensuring the optimized version of + * the frameOptions doesn't affect the result of the window function. The + * planner is responsible for only changing the frame options when all + * WindowFuncs using this particular WindowClause agree on what the optimized + * version of the frameOptions are. If a particular WindowFunc being used + * does not have a support function then the planner will not make any changes + * to the WindowClause's frameOptions. + * + * 'window_func' and 'window_clause' are set by the planner before calling the + * support function so that the support function has these fields available. + * These may be required in order to determine which optimizations are + * possible. + * + * 'frameOptions' is set by the planner to WindowClause.frameOptions. The + * support function must only adjust this if optimizations are possible for + * the given WindowFunc. + */ +typedef struct SupportRequestOptimizeWindowClause +{ + NodeTag type; + + /* Input fields: */ + WindowFunc *window_func; /* Pointer to the window function data */ + struct WindowClause *window_clause; /* Pointer to the window clause data */ + + /* Input/Output fields: */ + int frameOptions; /* New frameOptions, or left untouched if no + * optimizations are possible. */ +} SupportRequestOptimizeWindowClause; + +/* + * The ModifyInPlace request allows the support function to detect whether + * a call to its target function can be allowed to modify a read/write + * expanded object in-place. The context is that we are considering a + * PL/pgSQL (or similar PL) assignment of the form "x := f(x, ...)" where + * the variable x is of a type that can be represented as an expanded object + * (see utils/expandeddatum.h). If f() can usefully optimize by modifying + * the passed-in object in-place, then this request can be implemented to + * instruct PL/pgSQL to pass a read-write expanded pointer to the variable's + * value. (Note that there is no guarantee that later calls to f() will + * actually do so. If f() receives a read-only pointer, or a pointer to a + * non-expanded object, it must follow the usual convention of not modifying + * the pointed-to object.) There are two requirements that must be met + * to make this safe: + * 1. f() must guarantee that it will not have modified the object if it + * fails. Otherwise the variable's value might change unexpectedly. + * 2. If the other arguments to f() ("..." in the above example) contain + * references to x, f() must be able to cope with that; or if that's not + * safe, the support function must scan the other arguments to verify that + * there are no other references to x. An example of the concern here is + * that in "arr := array_append(arr, arr[1])", if the array element type + * is pass-by-reference then array_append would receive a second argument + * that points into the array object it intends to modify. array_append is + * coded to make that safe, but other functions might not be able to cope. + * + * "args" is a node tree list representing the function's arguments. + * One or more nodes within the node tree will be PARAM_EXTERN Params + * with ID "paramid", which represent the assignment target variable. + * (Note that such references are not necessarily at top level in the list, + * for example we might have "x := f(x, g(x))". Generally it's only safe + * to optimize a reference that is at top level, else we're making promises + * about the behavior of g() as well as f().) + * + * If modify-in-place is safe, the support function should return the + * address of the Param node that is to return a read-write pointer. + * (At most one of the references is allowed to do so.) Otherwise, + * return NULL. + */ +typedef struct SupportRequestModifyInPlace +{ + NodeTag type; + + Oid funcid; /* PG_PROC OID of the target function */ + List *args; /* Arguments to the function */ + int paramid; /* ID of Param(s) representing variable */ +} SupportRequestModifyInPlace; + +#endif /* SUPPORTNODES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/tidbitmap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/tidbitmap.h new file mode 100644 index 0000000..99f795c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/tidbitmap.h @@ -0,0 +1,128 @@ +/*------------------------------------------------------------------------- + * + * tidbitmap.h + * PostgreSQL tuple-id (TID) bitmap package + * + * This module provides bitmap data structures that are spiritually + * similar to Bitmapsets, but are specially adapted to store sets of + * tuple identifiers (TIDs), or ItemPointers. In particular, the division + * of an ItemPointer into BlockNumber and OffsetNumber is catered for. + * Also, since we wish to be able to store very large tuple sets in + * memory with this data structure, we support "lossy" storage, in which + * we no longer remember individual tuple offsets on a page but only the + * fact that a particular page needs to be visited. + * + * + * Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/nodes/tidbitmap.h + * + *------------------------------------------------------------------------- + */ +#ifndef TIDBITMAP_H +#define TIDBITMAP_H + +#include "access/htup_details.h" +#include "storage/itemptr.h" +#include "utils/dsa.h" + +/* + * The maximum number of tuples per page is not large (typically 256 with + * 8K pages, or 1024 with 32K pages). So there's not much point in making + * the per-page bitmaps variable size. We just legislate that the size + * is this: + */ +#define TBM_MAX_TUPLES_PER_PAGE MaxHeapTuplesPerPage + +/* + * Actual bitmap representation is private to tidbitmap.c. Callers can + * do IsA(x, TIDBitmap) on it, but nothing else. + */ +typedef struct TIDBitmap TIDBitmap; + +/* Likewise, TBMPrivateIterator is private */ +typedef struct TBMPrivateIterator TBMPrivateIterator; +typedef struct TBMSharedIterator TBMSharedIterator; + +/* + * Callers with both private and shared implementations can use this unified + * API. + */ +typedef struct TBMIterator +{ + bool shared; + union + { + TBMPrivateIterator *private_iterator; + TBMSharedIterator *shared_iterator; + } i; +} TBMIterator; + +/* Result structure for tbm_iterate */ +typedef struct TBMIterateResult +{ + BlockNumber blockno; /* block number containing tuples */ + + bool lossy; + + /* + * Whether or not the tuples should be rechecked. This is always true if + * the page is lossy but may also be true if the query requires recheck. + */ + bool recheck; + + /* + * Pointer to the page containing the bitmap for this block. It is a void * + * to avoid exposing the details of the tidbitmap PagetableEntry to API + * users. + */ + void *internal_page; +} TBMIterateResult; + +/* function prototypes in nodes/tidbitmap.c */ + +extern TIDBitmap *tbm_create(Size maxbytes, dsa_area *dsa); +extern void tbm_free(TIDBitmap *tbm); +extern void tbm_free_shared_area(dsa_area *dsa, dsa_pointer dp); + +extern void tbm_add_tuples(TIDBitmap *tbm, + const ItemPointer tids, int ntids, + bool recheck); +extern void tbm_add_page(TIDBitmap *tbm, BlockNumber pageno); + +extern void tbm_union(TIDBitmap *a, const TIDBitmap *b); +extern void tbm_intersect(TIDBitmap *a, const TIDBitmap *b); + +extern int tbm_extract_page_tuple(TBMIterateResult *iteritem, + OffsetNumber *offsets, + uint32 max_offsets); + +extern bool tbm_is_empty(const TIDBitmap *tbm); + +extern TBMPrivateIterator *tbm_begin_private_iterate(TIDBitmap *tbm); +extern dsa_pointer tbm_prepare_shared_iterate(TIDBitmap *tbm); +extern bool tbm_private_iterate(TBMPrivateIterator *iterator, TBMIterateResult *tbmres); +extern bool tbm_shared_iterate(TBMSharedIterator *iterator, TBMIterateResult *tbmres); +extern void tbm_end_private_iterate(TBMPrivateIterator *iterator); +extern void tbm_end_shared_iterate(TBMSharedIterator *iterator); +extern TBMSharedIterator *tbm_attach_shared_iterate(dsa_area *dsa, + dsa_pointer dp); +extern int tbm_calculate_entries(Size maxbytes); + +extern TBMIterator tbm_begin_iterate(TIDBitmap *tbm, + dsa_area *dsa, dsa_pointer dsp); +extern void tbm_end_iterate(TBMIterator *iterator); + +extern bool tbm_iterate(TBMIterator *iterator, TBMIterateResult *tbmres); + +static inline bool +tbm_exhausted(TBMIterator *iterator) +{ + /* + * It doesn't matter if we check the private or shared iterator here. If + * tbm_end_iterate() was called, they will be NULL + */ + return !iterator->i.private_iterator; +} + +#endif /* TIDBITMAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/value.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/value.h new file mode 100644 index 0000000..3ee3b97 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/nodes/value.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------------------- + * + * value.h + * interface for value nodes + * + * + * Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/nodes/value.h + * + *------------------------------------------------------------------------- + */ + +#ifndef VALUE_H +#define VALUE_H + +#include "nodes/nodes.h" + +/* + * The node types Integer, Float, String, and BitString are used to represent + * literals in the lexer and are also used to pass constants around in the + * parser. One difference between these node types and, say, a plain int or + * char * is that the nodes can be put into a List. + * + * (There used to be a Value node, which encompassed all these different node types. Hence the name of this file.) + */ + +typedef struct Integer +{ + pg_node_attr(special_read_write) + + NodeTag type; + int ival; +} Integer; + +/* + * Float is internally represented as string. Using T_Float as the node type + * simply indicates that the contents of the string look like a valid numeric + * literal. The value might end up being converted to NUMERIC, so we can't + * store it internally as a C double, since that could lose precision. Since + * these nodes are generally only used in the parsing process, not for runtime + * data, it's better to use the more general representation. + * + * Note that an integer-looking string will get lexed as T_Float if the value + * is too large to fit in an 'int'. + */ +typedef struct Float +{ + pg_node_attr(special_read_write) + + NodeTag type; + char *fval; +} Float; + +typedef struct Boolean +{ + pg_node_attr(special_read_write) + + NodeTag type; + bool boolval; +} Boolean; + +typedef struct String +{ + pg_node_attr(special_read_write) + + NodeTag type; + char *sval; +} String; + +typedef struct BitString +{ + pg_node_attr(special_read_write) + + NodeTag type; + char *bsval; +} BitString; + +#define intVal(v) (castNode(Integer, v)->ival) +#define floatVal(v) atof(castNode(Float, v)->fval) +#define boolVal(v) (castNode(Boolean, v)->boolval) +#define strVal(v) (castNode(String, v)->sval) + +extern Integer *makeInteger(int i); +extern Float *makeFloat(char *numericStr); +extern Boolean *makeBoolean(bool val); +extern String *makeString(char *str); +extern BitString *makeBitString(char *str); + +#endif /* VALUE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/appendinfo.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/appendinfo.h new file mode 100644 index 0000000..d06f93b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/appendinfo.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * appendinfo.h + * Routines for mapping expressions between append rel parent(s) and + * children + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/appendinfo.h + * + *------------------------------------------------------------------------- + */ +#ifndef APPENDINFO_H +#define APPENDINFO_H + +#include "nodes/pathnodes.h" +#include "utils/relcache.h" + +extern AppendRelInfo *make_append_rel_info(Relation parentrel, + Relation childrel, + Index parentRTindex, Index childRTindex); +extern Node *adjust_appendrel_attrs(PlannerInfo *root, Node *node, + int nappinfos, AppendRelInfo **appinfos); +extern Node *adjust_appendrel_attrs_multilevel(PlannerInfo *root, Node *node, + RelOptInfo *childrel, + RelOptInfo *parentrel); +extern Relids adjust_child_relids(Relids relids, int nappinfos, + AppendRelInfo **appinfos); +extern Relids adjust_child_relids_multilevel(PlannerInfo *root, Relids relids, + RelOptInfo *childrel, + RelOptInfo *parentrel); +extern List *adjust_inherited_attnums(List *attnums, AppendRelInfo *context); +extern List *adjust_inherited_attnums_multilevel(PlannerInfo *root, + List *attnums, + Index child_relid, + Index top_parent_relid); +extern void get_translated_update_targetlist(PlannerInfo *root, Index relid, + List **processed_tlist, + List **update_colnos); +extern AppendRelInfo **find_appinfos_by_relids(PlannerInfo *root, + Relids relids, int *nappinfos); +extern void add_row_identity_var(PlannerInfo *root, Var *orig_var, + Index rtindex, const char *rowid_name); +extern void add_row_identity_columns(PlannerInfo *root, Index rtindex, + RangeTblEntry *target_rte, + Relation target_relation); +extern void distribute_row_identity_vars(PlannerInfo *root); + +#endif /* APPENDINFO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/clauses.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/clauses.h new file mode 100644 index 0000000..0dffec0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/clauses.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * clauses.h + * prototypes for clauses.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/clauses.h + * + *------------------------------------------------------------------------- + */ +#ifndef CLAUSES_H +#define CLAUSES_H + +#include "nodes/pathnodes.h" + +typedef struct +{ + int numWindowFuncs; /* total number of WindowFuncs found */ + Index maxWinRef; /* windowFuncs[] is indexed 0 .. maxWinRef */ + List **windowFuncs; /* lists of WindowFuncs for each winref */ +} WindowFuncLists; + +extern bool contain_agg_clause(Node *clause); + +extern bool contain_window_function(Node *clause); +extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef); + +extern double expression_returns_set_rows(PlannerInfo *root, Node *clause); + +extern bool contain_subplans(Node *clause); + +extern char max_parallel_hazard(Query *parse); +extern bool is_parallel_safe(PlannerInfo *root, Node *node); +extern bool contain_nonstrict_functions(Node *clause); +extern bool contain_exec_param(Node *clause, List *param_ids); +extern bool contain_leaked_vars(Node *clause); + +extern Relids find_nonnullable_rels(Node *clause); +extern List *find_nonnullable_vars(Node *clause); +extern List *find_forced_null_vars(Node *node); +extern Var *find_forced_null_var(Node *node); + +extern bool is_pseudo_constant_clause(Node *clause); +extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids); + +extern int NumRelids(PlannerInfo *root, Node *clause); + +extern void CommuteOpExpr(OpExpr *clause); + +extern Query *inline_set_returning_function(PlannerInfo *root, + RangeTblEntry *rte); + +extern Bitmapset *pull_paramids(Expr *expr); + +#endif /* CLAUSES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/cost.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/cost.h new file mode 100644 index 0000000..d397fe2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/cost.h @@ -0,0 +1,226 @@ +/*------------------------------------------------------------------------- + * + * cost.h + * prototypes for costsize.c and clausesel.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/cost.h + * + *------------------------------------------------------------------------- + */ +#ifndef COST_H +#define COST_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + + +/* defaults for costsize.c's Cost parameters */ +/* NB: cost-estimation code should use the variables, not these constants! */ +/* If you change these, update backend/utils/misc/postgresql.conf.sample */ +#define DEFAULT_SEQ_PAGE_COST 1.0 +#define DEFAULT_RANDOM_PAGE_COST 4.0 +#define DEFAULT_CPU_TUPLE_COST 0.01 +#define DEFAULT_CPU_INDEX_TUPLE_COST 0.005 +#define DEFAULT_CPU_OPERATOR_COST 0.0025 +#define DEFAULT_PARALLEL_TUPLE_COST 0.1 +#define DEFAULT_PARALLEL_SETUP_COST 1000.0 + +/* defaults for non-Cost parameters */ +#define DEFAULT_RECURSIVE_WORKTABLE_FACTOR 10.0 +#define DEFAULT_EFFECTIVE_CACHE_SIZE 524288 /* measured in pages */ + +typedef enum +{ + CONSTRAINT_EXCLUSION_OFF, /* do not use c_e */ + CONSTRAINT_EXCLUSION_ON, /* apply c_e to all rels */ + CONSTRAINT_EXCLUSION_PARTITION, /* apply c_e to otherrels only */ +} ConstraintExclusionType; + + +/* + * prototypes for costsize.c + * routines to compute costs and sizes + */ + +/* parameter variables and flags (see also optimizer.h) */ +extern PGDLLIMPORT Cost disable_cost; +extern PGDLLIMPORT int max_parallel_workers_per_gather; +extern PGDLLIMPORT bool enable_seqscan; +extern PGDLLIMPORT bool enable_indexscan; +extern PGDLLIMPORT bool enable_indexonlyscan; +extern PGDLLIMPORT bool enable_bitmapscan; +extern PGDLLIMPORT bool enable_tidscan; +extern PGDLLIMPORT bool enable_sort; +extern PGDLLIMPORT bool enable_incremental_sort; +extern PGDLLIMPORT bool enable_hashagg; +extern PGDLLIMPORT bool enable_nestloop; +extern PGDLLIMPORT bool enable_material; +extern PGDLLIMPORT bool enable_memoize; +extern PGDLLIMPORT bool enable_mergejoin; +extern PGDLLIMPORT bool enable_hashjoin; +extern PGDLLIMPORT bool enable_gathermerge; +extern PGDLLIMPORT bool enable_partitionwise_join; +extern PGDLLIMPORT bool enable_partitionwise_aggregate; +extern PGDLLIMPORT bool enable_parallel_append; +extern PGDLLIMPORT bool enable_parallel_hash; +extern PGDLLIMPORT bool enable_partition_pruning; +extern PGDLLIMPORT bool enable_presorted_aggregate; +extern PGDLLIMPORT bool enable_async_append; +extern PGDLLIMPORT int constraint_exclusion; + +extern double index_pages_fetched(double tuples_fetched, BlockNumber pages, + double index_pages, PlannerInfo *root); +extern void cost_seqscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, + ParamPathInfo *param_info); +extern void cost_samplescan(Path *path, PlannerInfo *root, RelOptInfo *baserel, + ParamPathInfo *param_info); +extern void cost_index(IndexPath *path, PlannerInfo *root, + double loop_count, bool partial_path); +extern void cost_bitmap_heap_scan(Path *path, PlannerInfo *root, RelOptInfo *baserel, + ParamPathInfo *param_info, + Path *bitmapqual, double loop_count); +extern void cost_bitmap_and_node(BitmapAndPath *path, PlannerInfo *root); +extern void cost_bitmap_or_node(BitmapOrPath *path, PlannerInfo *root); +extern void cost_bitmap_tree_node(Path *path, Cost *cost, Selectivity *selec); +extern void cost_tidscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, List *tidquals, ParamPathInfo *param_info); +extern void cost_tidrangescan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, List *tidrangequals, + ParamPathInfo *param_info); +extern void cost_subqueryscan(SubqueryScanPath *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info, + bool trivial_pathtarget); +extern void cost_functionscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_valuesscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_tablefuncscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_ctescan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_namedtuplestorescan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_resultscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_recursive_union(Path *runion, Path *nrterm, Path *rterm); +extern void cost_sort(Path *path, PlannerInfo *root, + List *pathkeys, int input_disabled_nodes, + Cost input_cost, double tuples, int width, + Cost comparison_cost, int sort_mem, + double limit_tuples); +extern void cost_incremental_sort(Path *path, + PlannerInfo *root, List *pathkeys, int presorted_keys, + int input_disabled_nodes, + Cost input_startup_cost, Cost input_total_cost, + double input_tuples, int width, Cost comparison_cost, int sort_mem, + double limit_tuples); +extern void cost_append(AppendPath *apath); +extern void cost_merge_append(Path *path, PlannerInfo *root, + List *pathkeys, int n_streams, + int input_disabled_nodes, + Cost input_startup_cost, Cost input_total_cost, + double tuples); +extern void cost_material(Path *path, + int input_disabled_nodes, + Cost input_startup_cost, Cost input_total_cost, + double tuples, int width); +extern void cost_agg(Path *path, PlannerInfo *root, + AggStrategy aggstrategy, const AggClauseCosts *aggcosts, + int numGroupCols, double numGroups, + List *quals, + int disabled_nodes, + Cost input_startup_cost, Cost input_total_cost, + double input_tuples, double input_width); +extern void cost_windowagg(Path *path, PlannerInfo *root, + List *windowFuncs, WindowClause *winclause, + int input_disabled_nodes, + Cost input_startup_cost, Cost input_total_cost, + double input_tuples); +extern void cost_group(Path *path, PlannerInfo *root, + int numGroupCols, double numGroups, + List *quals, + int input_disabled_nodes, + Cost input_startup_cost, Cost input_total_cost, + double input_tuples); +extern void initial_cost_nestloop(PlannerInfo *root, + JoinCostWorkspace *workspace, + JoinType jointype, + Path *outer_path, Path *inner_path, + JoinPathExtraData *extra); +extern void final_cost_nestloop(PlannerInfo *root, NestPath *path, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra); +extern void initial_cost_mergejoin(PlannerInfo *root, + JoinCostWorkspace *workspace, + JoinType jointype, + List *mergeclauses, + Path *outer_path, Path *inner_path, + List *outersortkeys, List *innersortkeys, + int outer_presorted_keys, + JoinPathExtraData *extra); +extern void final_cost_mergejoin(PlannerInfo *root, MergePath *path, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra); +extern void initial_cost_hashjoin(PlannerInfo *root, + JoinCostWorkspace *workspace, + JoinType jointype, + List *hashclauses, + Path *outer_path, Path *inner_path, + JoinPathExtraData *extra, + bool parallel_hash); +extern void final_cost_hashjoin(PlannerInfo *root, HashPath *path, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra); +extern void cost_gather(GatherPath *path, PlannerInfo *root, + RelOptInfo *rel, ParamPathInfo *param_info, double *rows); +extern void cost_gather_merge(GatherMergePath *path, PlannerInfo *root, + RelOptInfo *rel, ParamPathInfo *param_info, + int input_disabled_nodes, + Cost input_startup_cost, Cost input_total_cost, + double *rows); +extern void cost_subplan(PlannerInfo *root, SubPlan *subplan, Plan *plan); +extern void cost_qual_eval(QualCost *cost, List *quals, PlannerInfo *root); +extern void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root); +extern void compute_semi_anti_join_factors(PlannerInfo *root, + RelOptInfo *joinrel, + RelOptInfo *outerrel, + RelOptInfo *innerrel, + JoinType jointype, + SpecialJoinInfo *sjinfo, + List *restrictlist, + SemiAntiJoinFactors *semifactors); +extern void set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern double get_parameterized_baserel_size(PlannerInfo *root, + RelOptInfo *rel, + List *param_clauses); +extern double get_parameterized_joinrel_size(PlannerInfo *root, + RelOptInfo *rel, + Path *outer_path, + Path *inner_path, + SpecialJoinInfo *sjinfo, + List *restrict_clauses); +extern void set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel, + RelOptInfo *outer_rel, + RelOptInfo *inner_rel, + SpecialJoinInfo *sjinfo, + List *restrictlist); +extern void set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_function_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_values_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_cte_size_estimates(PlannerInfo *root, RelOptInfo *rel, + double cte_rows); +extern void set_tablefunc_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_namedtuplestore_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_result_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern PathTarget *set_pathtarget_cost_width(PlannerInfo *root, PathTarget *target); +extern double compute_bitmap_pages(PlannerInfo *root, RelOptInfo *baserel, + Path *bitmapqual, double loop_count, + Cost *cost_p, double *tuples_p); +extern double compute_gather_rows(Path *path); + +#endif /* COST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo.h new file mode 100644 index 0000000..9f8e0f3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------------------- + * + * geqo.h + * prototypes for various files in optimizer/geqo + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +#ifndef GEQO_H +#define GEQO_H + +#include "common/pg_prng.h" +#include "nodes/pathnodes.h" +#include "optimizer/geqo_gene.h" + + +/* GEQO debug flag */ +/* + #define GEQO_DEBUG + */ + +/* choose one recombination mechanism here */ +/* + #define ERX + #define PMX + #define CX + #define PX + #define OX1 + #define OX2 + */ +#define ERX + + +/* + * Configuration options + * + * If you change these, update backend/utils/misc/postgresql.conf.sample + */ +extern PGDLLIMPORT int Geqo_effort; /* 1 .. 10, knob for adjustment of + * defaults */ + +#define DEFAULT_GEQO_EFFORT 5 +#define MIN_GEQO_EFFORT 1 +#define MAX_GEQO_EFFORT 10 + +extern PGDLLIMPORT int Geqo_pool_size; /* 2 .. inf, or 0 to use default */ + +extern PGDLLIMPORT int Geqo_generations; /* 1 .. inf, or 0 to use default */ + +extern PGDLLIMPORT double Geqo_selection_bias; + +#define DEFAULT_GEQO_SELECTION_BIAS 2.0 +#define MIN_GEQO_SELECTION_BIAS 1.5 +#define MAX_GEQO_SELECTION_BIAS 2.0 + +extern PGDLLIMPORT double Geqo_seed; /* 0 .. 1 */ + + +/* + * Private state for a GEQO run --- accessible via root->join_search_private + */ +typedef struct +{ + List *initial_rels; /* the base relations we are joining */ + pg_prng_state random_state; /* PRNG state */ +} GeqoPrivateData; + + +/* routines in geqo_main.c */ +extern RelOptInfo *geqo(PlannerInfo *root, + int number_of_rels, List *initial_rels); + +/* routines in geqo_eval.c */ +extern Cost geqo_eval(PlannerInfo *root, Gene *tour, int num_gene); +extern RelOptInfo *gimme_tree(PlannerInfo *root, Gene *tour, int num_gene); + +#endif /* GEQO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_copy.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_copy.h new file mode 100644 index 0000000..10e639f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_copy.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * geqo_copy.h + * prototypes for copy functions in optimizer/geqo + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_copy.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +#ifndef GEQO_COPY_H +#define GEQO_COPY_H + +#include "optimizer/geqo.h" + + +extern void geqo_copy(PlannerInfo *root, Chromosome *chromo1, Chromosome *chromo2, int string_length); + +#endif /* GEQO_COPY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_gene.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_gene.h new file mode 100644 index 0000000..9b9bcaa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_gene.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * geqo_gene.h + * genome representation in optimizer/geqo + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_gene.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + + +#ifndef GEQO_GENE_H +#define GEQO_GENE_H + +#include "nodes/nodes.h" + +/* we presume that int instead of Relid + is o.k. for Gene; so don't change it! */ +typedef int Gene; + +typedef struct Chromosome +{ + Gene *string; + Cost worth; +} Chromosome; + +typedef struct Pool +{ + Chromosome *data; + int size; + int string_length; +} Pool; + +#endif /* GEQO_GENE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_misc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_misc.h new file mode 100644 index 0000000..233f7c1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_misc.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * geqo_misc.h + * prototypes for printout routines in optimizer/geqo + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_misc.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +#ifndef GEQO_MISC_H +#define GEQO_MISC_H + +#include "optimizer/geqo_recombination.h" + +#ifdef GEQO_DEBUG + +extern void print_pool(FILE *fp, Pool *pool, int start, int stop); +extern void print_gen(FILE *fp, Pool *pool, int generation); +extern void print_edge_table(FILE *fp, Edge *edge_table, int num_gene); +#endif /* GEQO_DEBUG */ + +#endif /* GEQO_MISC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_mutation.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_mutation.h new file mode 100644 index 0000000..57c8c91 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_mutation.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * geqo_mutation.h + * prototypes for mutation functions in optimizer/geqo + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_mutation.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +#ifndef GEQO_MUTATION_H +#define GEQO_MUTATION_H + +#include "optimizer/geqo.h" + + +extern void geqo_mutation(PlannerInfo *root, Gene *tour, int num_gene); + +#endif /* GEQO_MUTATION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_pool.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_pool.h new file mode 100644 index 0000000..a28324a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_pool.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * geqo_pool.h + * pool representation in optimizer/geqo + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_pool.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + + +#ifndef GEQO_POOL_H +#define GEQO_POOL_H + +#include "optimizer/geqo.h" + + +extern Pool *alloc_pool(PlannerInfo *root, int pool_size, int string_length); +extern void free_pool(PlannerInfo *root, Pool *pool); + +extern void random_init_pool(PlannerInfo *root, Pool *pool); +extern Chromosome *alloc_chromo(PlannerInfo *root, int string_length); +extern void free_chromo(PlannerInfo *root, Chromosome *chromo); + +extern void spread_chromo(PlannerInfo *root, Chromosome *chromo, Pool *pool); + +extern void sort_pool(PlannerInfo *root, Pool *pool); + +#endif /* GEQO_POOL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_random.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_random.h new file mode 100644 index 0000000..8fe28e4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_random.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * geqo_random.h + * random number generator + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_random.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +/* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */ + +#ifndef GEQO_RANDOM_H +#define GEQO_RANDOM_H + +#include "optimizer/geqo.h" + + +extern void geqo_set_seed(PlannerInfo *root, double seed); + +/* geqo_rand returns a random float value in the range [0.0, 1.0) */ +extern double geqo_rand(PlannerInfo *root); + +/* geqo_randint returns integer value between lower and upper inclusive */ +extern int geqo_randint(PlannerInfo *root, int upper, int lower); + +#endif /* GEQO_RANDOM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_recombination.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_recombination.h new file mode 100644 index 0000000..af394a2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_recombination.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------- + * + * geqo_recombination.h + * prototypes for recombination in the genetic query optimizer + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_recombination.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +/* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */ + +#ifndef GEQO_RECOMBINATION_H +#define GEQO_RECOMBINATION_H + +#include "optimizer/geqo.h" + + +extern void init_tour(PlannerInfo *root, Gene *tour, int num_gene); + + +/* edge recombination crossover [ERX] */ + +typedef struct Edge +{ + Gene edge_list[4]; /* list of edges */ + int total_edges; + int unused_edges; +} Edge; + +extern Edge *alloc_edge_table(PlannerInfo *root, int num_gene); +extern void free_edge_table(PlannerInfo *root, Edge *edge_table); + +extern float gimme_edge_table(PlannerInfo *root, Gene *tour1, Gene *tour2, + int num_gene, Edge *edge_table); + +extern int gimme_tour(PlannerInfo *root, Edge *edge_table, Gene *new_gene, + int num_gene); + + +/* partially matched crossover [PMX] */ + +#define DAD 1 /* indicator for gene from dad */ +#define MOM 0 /* indicator for gene from mom */ + +extern void pmx(PlannerInfo *root, + Gene *tour1, Gene *tour2, + Gene *offspring, int num_gene); + + +typedef struct City +{ + int tour2_position; + int tour1_position; + int used; + int select_list; +} City; + +extern City * alloc_city_table(PlannerInfo *root, int num_gene); +extern void free_city_table(PlannerInfo *root, City * city_table); + +/* cycle crossover [CX] */ +extern int cx(PlannerInfo *root, Gene *tour1, Gene *tour2, + Gene *offspring, int num_gene, City * city_table); + +/* position crossover [PX] */ +extern void px(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, + int num_gene, City * city_table); + +/* order crossover [OX1] according to Davis */ +extern void ox1(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring, + int num_gene, City * city_table); + +/* order crossover [OX2] according to Syswerda */ +extern void ox2(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring, + int num_gene, City * city_table); + +#endif /* GEQO_RECOMBINATION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_selection.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_selection.h new file mode 100644 index 0000000..bfe3c22 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/geqo_selection.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * geqo_selection.h + * prototypes for selection routines in optimizer/geqo + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_selection.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + + +#ifndef GEQO_SELECTION_H +#define GEQO_SELECTION_H + +#include "optimizer/geqo.h" + + +extern void geqo_selection(PlannerInfo *root, + Chromosome *momma, Chromosome *daddy, + Pool *pool, double bias); + +#endif /* GEQO_SELECTION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/inherit.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/inherit.h new file mode 100644 index 0000000..5f8df60 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/inherit.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * inherit.h + * prototypes for inherit.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/inherit.h + * + *------------------------------------------------------------------------- + */ +#ifndef INHERIT_H +#define INHERIT_H + +#include "nodes/pathnodes.h" + + +extern void expand_inherited_rtentry(PlannerInfo *root, RelOptInfo *rel, + RangeTblEntry *rte, Index rti); + +extern Bitmapset *get_rel_all_updated_cols(PlannerInfo *root, RelOptInfo *rel); + +extern bool apply_child_basequals(PlannerInfo *root, RelOptInfo *parentrel, + RelOptInfo *childrel, RangeTblEntry *childRTE, + AppendRelInfo *appinfo); + +#endif /* INHERIT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/joininfo.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/joininfo.h new file mode 100644 index 0000000..2aa52c7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/joininfo.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * joininfo.h + * prototypes for joininfo.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/joininfo.h + * + *------------------------------------------------------------------------- + */ +#ifndef JOININFO_H +#define JOININFO_H + +#include "nodes/pathnodes.h" + + +extern bool have_relevant_joinclause(PlannerInfo *root, + RelOptInfo *rel1, RelOptInfo *rel2); + +extern void add_join_clause_to_rels(PlannerInfo *root, + RestrictInfo *restrictinfo, + Relids join_relids); +extern void remove_join_clause_from_rels(PlannerInfo *root, + RestrictInfo *restrictinfo, + Relids join_relids); + +#endif /* JOININFO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/optimizer.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/optimizer.h new file mode 100644 index 0000000..546828b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/optimizer.h @@ -0,0 +1,215 @@ +/*------------------------------------------------------------------------- + * + * optimizer.h + * External API for the Postgres planner. + * + * This header is meant to define everything that the core planner + * exposes for use by non-planner modules. + * + * Note that there are files outside src/backend/optimizer/ that are + * considered planner modules, because they're too much in bed with + * planner operations to be treated otherwise. FDW planning code is an + * example. For the most part, however, code outside the core planner + * should not need to include any optimizer/ header except this one. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/optimizer.h + * + *------------------------------------------------------------------------- + */ +#ifndef OPTIMIZER_H +#define OPTIMIZER_H + +#include "nodes/parsenodes.h" + +/* + * We don't want to include nodes/pathnodes.h here, because non-planner + * code should generally treat PlannerInfo as an opaque typedef. + * But we'd like such code to use that typedef name, so define the + * typedef either here or in pathnodes.h, whichever is read first. + */ +#ifndef HAVE_PLANNERINFO_TYPEDEF +typedef struct PlannerInfo PlannerInfo; +#define HAVE_PLANNERINFO_TYPEDEF 1 +#endif + +/* Likewise for IndexOptInfo and SpecialJoinInfo. */ +#ifndef HAVE_INDEXOPTINFO_TYPEDEF +typedef struct IndexOptInfo IndexOptInfo; +#define HAVE_INDEXOPTINFO_TYPEDEF 1 +#endif +#ifndef HAVE_SPECIALJOININFO_TYPEDEF +typedef struct SpecialJoinInfo SpecialJoinInfo; +#define HAVE_SPECIALJOININFO_TYPEDEF 1 +#endif + +/* It also seems best not to include plannodes.h, params.h, or htup.h here */ +struct PlannedStmt; +struct ParamListInfoData; +struct HeapTupleData; + + +/* in path/clausesel.c: */ + +extern Selectivity clause_selectivity(PlannerInfo *root, + Node *clause, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo); +extern Selectivity clause_selectivity_ext(PlannerInfo *root, + Node *clause, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + bool use_extended_stats); +extern Selectivity clauselist_selectivity(PlannerInfo *root, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo); +extern Selectivity clauselist_selectivity_ext(PlannerInfo *root, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + bool use_extended_stats); + +/* in path/costsize.c: */ + +/* widely used cost parameters */ +extern PGDLLIMPORT double seq_page_cost; +extern PGDLLIMPORT double random_page_cost; +extern PGDLLIMPORT double cpu_tuple_cost; +extern PGDLLIMPORT double cpu_index_tuple_cost; +extern PGDLLIMPORT double cpu_operator_cost; +extern PGDLLIMPORT double parallel_tuple_cost; +extern PGDLLIMPORT double parallel_setup_cost; +extern PGDLLIMPORT double recursive_worktable_factor; +extern PGDLLIMPORT int effective_cache_size; + +extern double clamp_row_est(double nrows); +extern int32 clamp_width_est(int64 tuple_width); +extern long clamp_cardinality_to_long(Cardinality x); + +/* in path/indxpath.c: */ + +extern bool is_pseudo_constant_for_index(PlannerInfo *root, Node *expr, + IndexOptInfo *index); + +/* in plan/planner.c: */ + +/* possible values for debug_parallel_query */ +typedef enum +{ + DEBUG_PARALLEL_OFF, + DEBUG_PARALLEL_ON, + DEBUG_PARALLEL_REGRESS, +} DebugParallelMode; + +/* GUC parameters */ +extern PGDLLIMPORT int debug_parallel_query; +extern PGDLLIMPORT bool parallel_leader_participation; +extern PGDLLIMPORT bool enable_distinct_reordering; + +extern struct PlannedStmt *planner(Query *parse, const char *query_string, + int cursorOptions, + struct ParamListInfoData *boundParams); + +extern Expr *expression_planner(Expr *expr); +extern Expr *expression_planner_with_deps(Expr *expr, + List **relationOids, + List **invalItems); + +extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid); +extern int plan_create_index_workers(Oid tableOid, Oid indexOid); + +/* in plan/setrefs.c: */ + +extern void extract_query_dependencies(Node *query, + List **relationOids, + List **invalItems, + bool *hasRowSecurity); + +/* in prep/prepqual.c: */ + +extern Node *negate_clause(Node *node); +extern Expr *canonicalize_qual(Expr *qual, bool is_check); + +/* in util/clauses.c: */ + +extern bool contain_mutable_functions(Node *clause); +extern bool contain_mutable_functions_after_planning(Expr *expr); +extern bool contain_volatile_functions(Node *clause); +extern bool contain_volatile_functions_after_planning(Expr *expr); +extern bool contain_volatile_functions_not_nextval(Node *clause); + +extern Node *eval_const_expressions(PlannerInfo *root, Node *node); + +extern void convert_saop_to_hashed_saop(Node *node); + +extern Node *estimate_expression_value(PlannerInfo *root, Node *node); + +extern Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod, + Oid result_collation); + +extern List *expand_function_arguments(List *args, bool include_out_arguments, + Oid result_type, + struct HeapTupleData *func_tuple); + +extern ScalarArrayOpExpr *make_SAOP_expr(Oid oper, Node *leftexpr, + Oid coltype, Oid arraycollid, + Oid inputcollid, List *exprs, + bool haveNonConst); + +/* in util/predtest.c: */ + +extern bool predicate_implied_by(List *predicate_list, List *clause_list, + bool weak); +extern bool predicate_refuted_by(List *predicate_list, List *clause_list, + bool weak); + +/* in util/tlist.c: */ + +extern int count_nonjunk_tlist_entries(List *tlist); +extern TargetEntry *get_sortgroupref_tle(Index sortref, + List *targetList); +extern TargetEntry *get_sortgroupclause_tle(SortGroupClause *sgClause, + List *targetList); +extern Node *get_sortgroupclause_expr(SortGroupClause *sgClause, + List *targetList); +extern List *get_sortgrouplist_exprs(List *sgClauses, + List *targetList); +extern SortGroupClause *get_sortgroupref_clause(Index sortref, + List *clauses); +extern SortGroupClause *get_sortgroupref_clause_noerr(Index sortref, + List *clauses); + +/* in util/var.c: */ + +/* Bits that can be OR'd into the flags argument of pull_var_clause() */ +#define PVC_INCLUDE_AGGREGATES 0x0001 /* include Aggrefs in output list */ +#define PVC_RECURSE_AGGREGATES 0x0002 /* recurse into Aggref arguments */ +#define PVC_INCLUDE_WINDOWFUNCS 0x0004 /* include WindowFuncs in output list */ +#define PVC_RECURSE_WINDOWFUNCS 0x0008 /* recurse into WindowFunc arguments */ +#define PVC_INCLUDE_PLACEHOLDERS 0x0010 /* include PlaceHolderVars in + * output list */ +#define PVC_RECURSE_PLACEHOLDERS 0x0020 /* recurse into PlaceHolderVar + * arguments */ +#define PVC_INCLUDE_CONVERTROWTYPES 0x0040 /* include ConvertRowtypeExprs in + * output list */ + +extern Bitmapset *pull_varnos(PlannerInfo *root, Node *node); +extern Bitmapset *pull_varnos_of_level(PlannerInfo *root, Node *node, int levelsup); +extern void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos); +extern List *pull_vars_of_level(Node *node, int levelsup); +extern bool contain_var_clause(Node *node); +extern bool contain_vars_of_level(Node *node, int levelsup); +extern bool contain_vars_returning_old_or_new(Node *node); +extern int locate_var_of_level(Node *node, int levelsup); +extern List *pull_var_clause(Node *node, int flags); +extern Node *flatten_join_alias_vars(PlannerInfo *root, Query *query, Node *node); +extern Node *flatten_group_exprs(PlannerInfo *root, Query *query, Node *node); + +#endif /* OPTIMIZER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/orclauses.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/orclauses.h new file mode 100644 index 0000000..046b08a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/orclauses.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * orclauses.h + * prototypes for orclauses.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/orclauses.h + * + *------------------------------------------------------------------------- + */ +#ifndef ORCLAUSES_H +#define ORCLAUSES_H + +#include "nodes/pathnodes.h" + +extern void extract_restriction_or_clauses(PlannerInfo *root); + +#endif /* ORCLAUSES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/paramassign.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/paramassign.h new file mode 100644 index 0000000..bbf7214 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/paramassign.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * paramassign.h + * Functions for assigning PARAM_EXEC slots during planning. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/paramassign.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARAMASSIGN_H +#define PARAMASSIGN_H + +#include "nodes/pathnodes.h" + +extern Param *replace_outer_var(PlannerInfo *root, Var *var); +extern Param *replace_outer_placeholdervar(PlannerInfo *root, + PlaceHolderVar *phv); +extern Param *replace_outer_agg(PlannerInfo *root, Aggref *agg); +extern Param *replace_outer_grouping(PlannerInfo *root, GroupingFunc *grp); +extern Param *replace_outer_merge_support(PlannerInfo *root, + MergeSupportFunc *msf); +extern Param *replace_outer_returning(PlannerInfo *root, + ReturningExpr *rexpr); +extern Param *replace_nestloop_param_var(PlannerInfo *root, Var *var); +extern Param *replace_nestloop_param_placeholdervar(PlannerInfo *root, + PlaceHolderVar *phv); +extern void process_subquery_nestloop_params(PlannerInfo *root, + List *subplan_params); +extern List *identify_current_nestloop_params(PlannerInfo *root, + Relids leftrelids, + Relids outerrelids); +extern Param *generate_new_exec_param(PlannerInfo *root, Oid paramtype, + int32 paramtypmod, Oid paramcollation); +extern int assign_special_exec_param(PlannerInfo *root); + +#endif /* PARAMASSIGN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/pathnode.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/pathnode.h new file mode 100644 index 0000000..60dcdb7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/pathnode.h @@ -0,0 +1,356 @@ +/*------------------------------------------------------------------------- + * + * pathnode.h + * prototypes for pathnode.c, relnode.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/pathnode.h + * + *------------------------------------------------------------------------- + */ +#ifndef PATHNODE_H +#define PATHNODE_H + +#include "nodes/bitmapset.h" +#include "nodes/pathnodes.h" + + +/* + * prototypes for pathnode.c + */ +extern int compare_path_costs(Path *path1, Path *path2, + CostSelector criterion); +extern int compare_fractional_path_costs(Path *path1, Path *path2, + double fraction); +extern void set_cheapest(RelOptInfo *parent_rel); +extern void add_path(RelOptInfo *parent_rel, Path *new_path); +extern bool add_path_precheck(RelOptInfo *parent_rel, int disabled_nodes, + Cost startup_cost, Cost total_cost, + List *pathkeys, Relids required_outer); +extern void add_partial_path(RelOptInfo *parent_rel, Path *new_path); +extern bool add_partial_path_precheck(RelOptInfo *parent_rel, + int disabled_nodes, + Cost total_cost, List *pathkeys); + +extern Path *create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer, int parallel_workers); +extern Path *create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern IndexPath *create_index_path(PlannerInfo *root, + IndexOptInfo *index, + List *indexclauses, + List *indexorderbys, + List *indexorderbycols, + List *pathkeys, + ScanDirection indexscandir, + bool indexonly, + Relids required_outer, + double loop_count, + bool partial_path); +extern BitmapHeapPath *create_bitmap_heap_path(PlannerInfo *root, + RelOptInfo *rel, + Path *bitmapqual, + Relids required_outer, + double loop_count, + int parallel_degree); +extern BitmapAndPath *create_bitmap_and_path(PlannerInfo *root, + RelOptInfo *rel, + List *bitmapquals); +extern BitmapOrPath *create_bitmap_or_path(PlannerInfo *root, + RelOptInfo *rel, + List *bitmapquals); +extern TidPath *create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, + List *tidquals, Relids required_outer); +extern TidRangePath *create_tidrangescan_path(PlannerInfo *root, + RelOptInfo *rel, + List *tidrangequals, + Relids required_outer); +extern AppendPath *create_append_path(PlannerInfo *root, RelOptInfo *rel, + List *subpaths, List *partial_subpaths, + List *pathkeys, Relids required_outer, + int parallel_workers, bool parallel_aware, + double rows); +extern MergeAppendPath *create_merge_append_path(PlannerInfo *root, + RelOptInfo *rel, + List *subpaths, + List *pathkeys, + Relids required_outer); +extern GroupResultPath *create_group_result_path(PlannerInfo *root, + RelOptInfo *rel, + PathTarget *target, + List *havingqual); +extern MaterialPath *create_material_path(RelOptInfo *rel, Path *subpath); +extern MemoizePath *create_memoize_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *param_exprs, + List *hash_operators, + bool singlerow, + bool binary_mode, + double calls); +extern UniquePath *create_unique_path(PlannerInfo *root, RelOptInfo *rel, + Path *subpath, SpecialJoinInfo *sjinfo); +extern GatherPath *create_gather_path(PlannerInfo *root, + RelOptInfo *rel, Path *subpath, PathTarget *target, + Relids required_outer, double *rows); +extern GatherMergePath *create_gather_merge_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target, + List *pathkeys, + Relids required_outer, + double *rows); +extern SubqueryScanPath *create_subqueryscan_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + bool trivial_pathtarget, + List *pathkeys, + Relids required_outer); +extern Path *create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, + List *pathkeys, Relids required_outer); +extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern Path *create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, + List *pathkeys, Relids required_outer); +extern Path *create_namedtuplestorescan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern Path *create_resultscan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern Path *create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel, + PathTarget *target, + double rows, int disabled_nodes, + Cost startup_cost, Cost total_cost, + List *pathkeys, + Relids required_outer, + Path *fdw_outerpath, + List *fdw_restrictinfo, + List *fdw_private); +extern ForeignPath *create_foreign_join_path(PlannerInfo *root, RelOptInfo *rel, + PathTarget *target, + double rows, int disabled_nodes, + Cost startup_cost, Cost total_cost, + List *pathkeys, + Relids required_outer, + Path *fdw_outerpath, + List *fdw_restrictinfo, + List *fdw_private); +extern ForeignPath *create_foreign_upper_path(PlannerInfo *root, RelOptInfo *rel, + PathTarget *target, + double rows, int disabled_nodes, + Cost startup_cost, Cost total_cost, + List *pathkeys, + Path *fdw_outerpath, + List *fdw_restrictinfo, + List *fdw_private); + +extern Relids calc_nestloop_required_outer(Relids outerrelids, + Relids outer_paramrels, + Relids innerrelids, + Relids inner_paramrels); +extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path); + +extern NestPath *create_nestloop_path(PlannerInfo *root, + RelOptInfo *joinrel, + JoinType jointype, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra, + Path *outer_path, + Path *inner_path, + List *restrict_clauses, + List *pathkeys, + Relids required_outer); + +extern MergePath *create_mergejoin_path(PlannerInfo *root, + RelOptInfo *joinrel, + JoinType jointype, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra, + Path *outer_path, + Path *inner_path, + List *restrict_clauses, + List *pathkeys, + Relids required_outer, + List *mergeclauses, + List *outersortkeys, + List *innersortkeys, + int outer_presorted_keys); + +extern HashPath *create_hashjoin_path(PlannerInfo *root, + RelOptInfo *joinrel, + JoinType jointype, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra, + Path *outer_path, + Path *inner_path, + bool parallel_hash, + List *restrict_clauses, + Relids required_outer, + List *hashclauses); + +extern ProjectionPath *create_projection_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target); +extern Path *apply_projection_to_path(PlannerInfo *root, + RelOptInfo *rel, + Path *path, + PathTarget *target); +extern ProjectSetPath *create_set_projection_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target); +extern SortPath *create_sort_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *pathkeys, + double limit_tuples); +extern IncrementalSortPath *create_incremental_sort_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *pathkeys, + int presorted_keys, + double limit_tuples); +extern GroupPath *create_group_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *groupClause, + List *qual, + double numGroups); +extern UpperUniquePath *create_upper_unique_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + int numCols, + double numGroups); +extern AggPath *create_agg_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target, + AggStrategy aggstrategy, + AggSplit aggsplit, + List *groupClause, + List *qual, + const AggClauseCosts *aggcosts, + double numGroups); +extern GroupingSetsPath *create_groupingsets_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *having_qual, + AggStrategy aggstrategy, + List *rollups, + const AggClauseCosts *agg_costs); +extern MinMaxAggPath *create_minmaxagg_path(PlannerInfo *root, + RelOptInfo *rel, + PathTarget *target, + List *mmaggregates, + List *quals); +extern WindowAggPath *create_windowagg_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target, + List *windowFuncs, + List *runCondition, + WindowClause *winclause, + List *qual, + bool topwindow); +extern SetOpPath *create_setop_path(PlannerInfo *root, + RelOptInfo *rel, + Path *leftpath, + Path *rightpath, + SetOpCmd cmd, + SetOpStrategy strategy, + List *groupList, + double numGroups, + double outputRows); +extern RecursiveUnionPath *create_recursiveunion_path(PlannerInfo *root, + RelOptInfo *rel, + Path *leftpath, + Path *rightpath, + PathTarget *target, + List *distinctList, + int wtParam, + double numGroups); +extern LockRowsPath *create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, + Path *subpath, List *rowMarks, int epqParam); +extern ModifyTablePath *create_modifytable_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + CmdType operation, bool canSetTag, + Index nominalRelation, Index rootRelation, + bool partColsUpdated, + List *resultRelations, + List *updateColnosLists, + List *withCheckOptionLists, List *returningLists, + List *rowMarks, OnConflictExpr *onconflict, + List *mergeActionLists, List *mergeJoinConditions, + int epqParam); +extern LimitPath *create_limit_path(PlannerInfo *root, RelOptInfo *rel, + Path *subpath, + Node *limitOffset, Node *limitCount, + LimitOption limitOption, + int64 offset_est, int64 count_est); +extern void adjust_limit_rows_costs(double *rows, + Cost *startup_cost, Cost *total_cost, + int64 offset_est, int64 count_est); + +extern Path *reparameterize_path(PlannerInfo *root, Path *path, + Relids required_outer, + double loop_count); +extern Path *reparameterize_path_by_child(PlannerInfo *root, Path *path, + RelOptInfo *child_rel); +extern bool path_is_reparameterizable_by_child(Path *path, + RelOptInfo *child_rel); + +/* + * prototypes for relnode.c + */ +extern void setup_simple_rel_arrays(PlannerInfo *root); +extern void expand_planner_arrays(PlannerInfo *root, int add_size); +extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid, + RelOptInfo *parent); +extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid); +extern RelOptInfo *find_base_rel_noerr(PlannerInfo *root, int relid); +extern RelOptInfo *find_base_rel_ignore_join(PlannerInfo *root, int relid); +extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids); +extern RelOptInfo *build_join_rel(PlannerInfo *root, + Relids joinrelids, + RelOptInfo *outer_rel, + RelOptInfo *inner_rel, + SpecialJoinInfo *sjinfo, + List *pushed_down_joins, + List **restrictlist_ptr); +extern Relids min_join_parameterization(PlannerInfo *root, + Relids joinrelids, + RelOptInfo *outer_rel, + RelOptInfo *inner_rel); +extern RelOptInfo *fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, + Relids relids); +extern Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel); +extern ParamPathInfo *get_baserel_parampathinfo(PlannerInfo *root, + RelOptInfo *baserel, + Relids required_outer); +extern ParamPathInfo *get_joinrel_parampathinfo(PlannerInfo *root, + RelOptInfo *joinrel, + Path *outer_path, + Path *inner_path, + SpecialJoinInfo *sjinfo, + Relids required_outer, + List **restrict_clauses); +extern ParamPathInfo *get_appendrel_parampathinfo(RelOptInfo *appendrel, + Relids required_outer); +extern ParamPathInfo *find_param_path_info(RelOptInfo *rel, + Relids required_outer); +extern Bitmapset *get_param_path_clause_serials(Path *path); +extern RelOptInfo *build_child_join_rel(PlannerInfo *root, + RelOptInfo *outer_rel, RelOptInfo *inner_rel, + RelOptInfo *parent_joinrel, List *restrictlist, + SpecialJoinInfo *sjinfo, + int nappinfos, AppendRelInfo **appinfos); + +#endif /* PATHNODE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/paths.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/paths.h new file mode 100644 index 0000000..7038027 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/paths.h @@ -0,0 +1,282 @@ +/*------------------------------------------------------------------------- + * + * paths.h + * prototypes for various files in optimizer/path + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/paths.h + * + *------------------------------------------------------------------------- + */ +#ifndef PATHS_H +#define PATHS_H + +#include "nodes/pathnodes.h" + + +/* + * allpaths.c + */ +extern PGDLLIMPORT bool enable_geqo; +extern PGDLLIMPORT int geqo_threshold; +extern PGDLLIMPORT int min_parallel_table_scan_size; +extern PGDLLIMPORT int min_parallel_index_scan_size; +extern PGDLLIMPORT bool enable_group_by_reordering; + +/* Hook for plugins to get control in set_rel_pathlist() */ +typedef void (*set_rel_pathlist_hook_type) (PlannerInfo *root, + RelOptInfo *rel, + Index rti, + RangeTblEntry *rte); +extern PGDLLIMPORT set_rel_pathlist_hook_type set_rel_pathlist_hook; + +/* Hook for plugins to get control in add_paths_to_joinrel() */ +typedef void (*set_join_pathlist_hook_type) (PlannerInfo *root, + RelOptInfo *joinrel, + RelOptInfo *outerrel, + RelOptInfo *innerrel, + JoinType jointype, + JoinPathExtraData *extra); +extern PGDLLIMPORT set_join_pathlist_hook_type set_join_pathlist_hook; + +/* Hook for plugins to replace standard_join_search() */ +typedef RelOptInfo *(*join_search_hook_type) (PlannerInfo *root, + int levels_needed, + List *initial_rels); +extern PGDLLIMPORT join_search_hook_type join_search_hook; + + +extern RelOptInfo *make_one_rel(PlannerInfo *root, List *joinlist); +extern RelOptInfo *standard_join_search(PlannerInfo *root, int levels_needed, + List *initial_rels); + +extern void generate_gather_paths(PlannerInfo *root, RelOptInfo *rel, + bool override_rows); +extern void generate_useful_gather_paths(PlannerInfo *root, RelOptInfo *rel, + bool override_rows); +extern int compute_parallel_worker(RelOptInfo *rel, double heap_pages, + double index_pages, int max_workers); +extern void create_partial_bitmap_paths(PlannerInfo *root, RelOptInfo *rel, + Path *bitmapqual); +extern void generate_partitionwise_join_paths(PlannerInfo *root, + RelOptInfo *rel); + +/* + * indxpath.c + * routines to generate index paths + */ +extern void create_index_paths(PlannerInfo *root, RelOptInfo *rel); +extern bool relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel, + List *restrictlist, + List *exprlist, List *oprlist); +extern bool relation_has_unique_index_ext(PlannerInfo *root, RelOptInfo *rel, + List *restrictlist, List *exprlist, + List *oprlist, List **extra_clauses); +extern bool indexcol_is_bool_constant_for_query(PlannerInfo *root, + IndexOptInfo *index, + int indexcol); +extern bool match_index_to_operand(Node *operand, int indexcol, + IndexOptInfo *index); +extern Node *strip_phvs_in_index_operand(Node *operand); +extern void check_index_predicates(PlannerInfo *root, RelOptInfo *rel); + +/* + * tidpath.c + * routines to generate tid paths + */ +extern bool create_tidscan_paths(PlannerInfo *root, RelOptInfo *rel); + +/* + * joinpath.c + * routines to create join paths + */ +extern void add_paths_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, + RelOptInfo *outerrel, RelOptInfo *innerrel, + JoinType jointype, SpecialJoinInfo *sjinfo, + List *restrictlist); + +/* + * joinrels.c + * routines to determine which relations to join + */ +extern void join_search_one_level(PlannerInfo *root, int level); +extern RelOptInfo *make_join_rel(PlannerInfo *root, + RelOptInfo *rel1, RelOptInfo *rel2); +extern Relids add_outer_joins_to_relids(PlannerInfo *root, Relids input_relids, + SpecialJoinInfo *sjinfo, + List **pushed_down_joins); +extern bool have_join_order_restriction(PlannerInfo *root, + RelOptInfo *rel1, RelOptInfo *rel2); +extern void mark_dummy_rel(RelOptInfo *rel); +extern void init_dummy_sjinfo(SpecialJoinInfo *sjinfo, Relids left_relids, + Relids right_relids); + +/* + * equivclass.c + * routines for managing EquivalenceClasses + */ +typedef bool (*ec_matches_callback_type) (PlannerInfo *root, + RelOptInfo *rel, + EquivalenceClass *ec, + EquivalenceMember *em, + void *arg); + +extern bool process_equivalence(PlannerInfo *root, + RestrictInfo **p_restrictinfo, + JoinDomain *jdomain); +extern Expr *canonicalize_ec_expression(Expr *expr, + Oid req_type, Oid req_collation); +extern void reconsider_outer_join_clauses(PlannerInfo *root); +extern void rebuild_eclass_attr_needed(PlannerInfo *root); +extern EquivalenceClass *get_eclass_for_sort_expr(PlannerInfo *root, + Expr *expr, + List *opfamilies, + Oid opcintype, + Oid collation, + Index sortref, + Relids rel, + bool create_it); +extern EquivalenceMember *find_ec_member_matching_expr(EquivalenceClass *ec, + Expr *expr, + Relids relids); +extern EquivalenceMember *find_computable_ec_member(PlannerInfo *root, + EquivalenceClass *ec, + List *exprs, + Relids relids, + bool require_parallel_safe); +extern bool relation_can_be_sorted_early(PlannerInfo *root, RelOptInfo *rel, + EquivalenceClass *ec, + bool require_parallel_safe); +extern void generate_base_implied_equalities(PlannerInfo *root); +extern List *generate_join_implied_equalities(PlannerInfo *root, + Relids join_relids, + Relids outer_relids, + RelOptInfo *inner_rel, + SpecialJoinInfo *sjinfo); +extern List *generate_join_implied_equalities_for_ecs(PlannerInfo *root, + List *eclasses, + Relids join_relids, + Relids outer_relids, + RelOptInfo *inner_rel); +extern bool exprs_known_equal(PlannerInfo *root, Node *item1, Node *item2, + Oid opfamily); +extern EquivalenceClass *match_eclasses_to_foreign_key_col(PlannerInfo *root, + ForeignKeyOptInfo *fkinfo, + int colno); +extern RestrictInfo *find_derived_clause_for_ec_member(PlannerInfo *root, + EquivalenceClass *ec, + EquivalenceMember *em); +extern void add_child_rel_equivalences(PlannerInfo *root, + AppendRelInfo *appinfo, + RelOptInfo *parent_rel, + RelOptInfo *child_rel); +extern void add_child_join_rel_equivalences(PlannerInfo *root, + int nappinfos, + AppendRelInfo **appinfos, + RelOptInfo *parent_joinrel, + RelOptInfo *child_joinrel); +extern void add_setop_child_rel_equivalences(PlannerInfo *root, + RelOptInfo *child_rel, + List *child_tlist, + List *setop_pathkeys); +extern void setup_eclass_member_iterator(EquivalenceMemberIterator *it, + EquivalenceClass *ec, + Relids child_relids); +extern EquivalenceMember *eclass_member_iterator_next(EquivalenceMemberIterator *it); +extern List *generate_implied_equalities_for_column(PlannerInfo *root, + RelOptInfo *rel, + ec_matches_callback_type callback, + void *callback_arg, + Relids prohibited_rels); +extern bool have_relevant_eclass_joinclause(PlannerInfo *root, + RelOptInfo *rel1, RelOptInfo *rel2); +extern bool has_relevant_eclass_joinclause(PlannerInfo *root, + RelOptInfo *rel1); +extern bool eclass_useful_for_merging(PlannerInfo *root, + EquivalenceClass *eclass, + RelOptInfo *rel); +extern bool is_redundant_derived_clause(RestrictInfo *rinfo, List *clauselist); +extern bool is_redundant_with_indexclauses(RestrictInfo *rinfo, + List *indexclauses); +extern void ec_clear_derived_clauses(EquivalenceClass *ec); + +/* + * pathkeys.c + * utilities for matching and building path keys + */ +typedef enum +{ + PATHKEYS_EQUAL, /* pathkeys are identical */ + PATHKEYS_BETTER1, /* pathkey 1 is a superset of pathkey 2 */ + PATHKEYS_BETTER2, /* vice versa */ + PATHKEYS_DIFFERENT, /* neither pathkey includes the other */ +} PathKeysComparison; + +extern PathKeysComparison compare_pathkeys(List *keys1, List *keys2); +extern bool pathkeys_contained_in(List *keys1, List *keys2); +extern bool pathkeys_count_contained_in(List *keys1, List *keys2, int *n_common); +extern List *get_useful_group_keys_orderings(PlannerInfo *root, Path *path); +extern Path *get_cheapest_path_for_pathkeys(List *paths, List *pathkeys, + Relids required_outer, + CostSelector cost_criterion, + bool require_parallel_safe); +extern Path *get_cheapest_fractional_path_for_pathkeys(List *paths, + List *pathkeys, + Relids required_outer, + double fraction); +extern Path *get_cheapest_parallel_safe_total_inner(List *paths); +extern List *build_index_pathkeys(PlannerInfo *root, IndexOptInfo *index, + ScanDirection scandir); +extern List *build_partition_pathkeys(PlannerInfo *root, RelOptInfo *partrel, + ScanDirection scandir, bool *partialkeys); +extern List *build_expression_pathkey(PlannerInfo *root, Expr *expr, + Oid opno, + Relids rel, bool create_it); +extern List *convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel, + List *subquery_pathkeys, + List *subquery_tlist); +extern List *build_join_pathkeys(PlannerInfo *root, + RelOptInfo *joinrel, + JoinType jointype, + List *outer_pathkeys); +extern List *make_pathkeys_for_sortclauses(PlannerInfo *root, + List *sortclauses, + List *tlist); +extern List *make_pathkeys_for_sortclauses_extended(PlannerInfo *root, + List **sortclauses, + List *tlist, + bool remove_redundant, + bool remove_group_rtindex, + bool *sortable, + bool set_ec_sortref); +extern void initialize_mergeclause_eclasses(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern void update_mergeclause_eclasses(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern List *find_mergeclauses_for_outer_pathkeys(PlannerInfo *root, + List *pathkeys, + List *restrictinfos); +extern List *select_outer_pathkeys_for_merge(PlannerInfo *root, + List *mergeclauses, + RelOptInfo *joinrel); +extern List *make_inner_pathkeys_for_merge(PlannerInfo *root, + List *mergeclauses, + List *outer_pathkeys); +extern List *trim_mergeclauses_for_inner_pathkeys(PlannerInfo *root, + List *mergeclauses, + List *pathkeys); +extern List *truncate_useless_pathkeys(PlannerInfo *root, + RelOptInfo *rel, + List *pathkeys); +extern bool has_useful_pathkeys(PlannerInfo *root, RelOptInfo *rel); +extern List *append_pathkeys(List *target, List *source); +extern PathKey *make_canonical_pathkey(PlannerInfo *root, + EquivalenceClass *eclass, Oid opfamily, + CompareType cmptype, bool nulls_first); +extern void add_paths_to_append_rel(PlannerInfo *root, RelOptInfo *rel, + List *live_childrels); + +#endif /* PATHS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/placeholder.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/placeholder.h new file mode 100644 index 0000000..db92d88 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/placeholder.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * placeholder.h + * prototypes for optimizer/util/placeholder.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/placeholder.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLACEHOLDER_H +#define PLACEHOLDER_H + +#include "nodes/pathnodes.h" + + +extern PlaceHolderVar *make_placeholder_expr(PlannerInfo *root, Expr *expr, + Relids phrels); +extern PlaceHolderInfo *find_placeholder_info(PlannerInfo *root, + PlaceHolderVar *phv); +extern void find_placeholders_in_jointree(PlannerInfo *root); +extern void fix_placeholder_input_needed_levels(PlannerInfo *root); +extern void rebuild_placeholder_attr_needed(PlannerInfo *root); +extern void add_placeholders_to_base_rels(PlannerInfo *root); +extern void add_placeholders_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, + RelOptInfo *outer_rel, RelOptInfo *inner_rel, + SpecialJoinInfo *sjinfo); +extern bool contain_placeholder_references_to(PlannerInfo *root, Node *clause, + int relid); +extern Relids get_placeholder_nulling_relids(PlannerInfo *root, + PlaceHolderInfo *phinfo); + +#endif /* PLACEHOLDER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/plancat.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/plancat.h new file mode 100644 index 0000000..ac80458 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/plancat.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------------------- + * + * plancat.h + * prototypes for plancat.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/plancat.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANCAT_H +#define PLANCAT_H + +#include "nodes/pathnodes.h" +#include "utils/relcache.h" + +/* Hook for plugins to get control in get_relation_info() */ +typedef void (*get_relation_info_hook_type) (PlannerInfo *root, + Oid relationObjectId, + bool inhparent, + RelOptInfo *rel); +extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook; + + +extern void get_relation_info(PlannerInfo *root, Oid relationObjectId, + bool inhparent, RelOptInfo *rel); + +extern List *infer_arbiter_indexes(PlannerInfo *root); + +extern void estimate_rel_size(Relation rel, int32 *attr_widths, + BlockNumber *pages, double *tuples, double *allvisfrac); + +extern int32 get_rel_data_width(Relation rel, int32 *attr_widths); +extern int32 get_relation_data_width(Oid relid, int32 *attr_widths); + +extern bool relation_excluded_by_constraints(PlannerInfo *root, + RelOptInfo *rel, RangeTblEntry *rte); + +extern List *build_physical_tlist(PlannerInfo *root, RelOptInfo *rel); + +extern bool has_unique_index(RelOptInfo *rel, AttrNumber attno); + +extern Selectivity restriction_selectivity(PlannerInfo *root, + Oid operatorid, + List *args, + Oid inputcollid, + int varRelid); + +extern Selectivity join_selectivity(PlannerInfo *root, + Oid operatorid, + List *args, + Oid inputcollid, + JoinType jointype, + SpecialJoinInfo *sjinfo); + +extern Selectivity function_selectivity(PlannerInfo *root, + Oid funcid, + List *args, + Oid inputcollid, + bool is_join, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo); + +extern void add_function_cost(PlannerInfo *root, Oid funcid, Node *node, + QualCost *cost); + +extern double get_function_rows(PlannerInfo *root, Oid funcid, Node *node); + +extern bool has_row_triggers(PlannerInfo *root, Index rti, CmdType event); + +extern bool has_transition_tables(PlannerInfo *root, Index rti, CmdType event); + +extern bool has_stored_generated_columns(PlannerInfo *root, Index rti); + +extern Bitmapset *get_dependent_generated_columns(PlannerInfo *root, Index rti, + Bitmapset *target_cols); + +#endif /* PLANCAT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/planmain.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/planmain.h new file mode 100644 index 0000000..9d3debc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/planmain.h @@ -0,0 +1,134 @@ +/*------------------------------------------------------------------------- + * + * planmain.h + * prototypes for various files in optimizer/plan + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/planmain.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANMAIN_H +#define PLANMAIN_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + +/* GUC parameters */ +#define DEFAULT_CURSOR_TUPLE_FRACTION 0.1 +extern PGDLLIMPORT double cursor_tuple_fraction; +extern PGDLLIMPORT bool enable_self_join_elimination; + +/* query_planner callback to compute query_pathkeys */ +typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra); + +/* + * prototypes for plan/planmain.c + */ +extern RelOptInfo *query_planner(PlannerInfo *root, + query_pathkeys_callback qp_callback, void *qp_extra); + +/* + * prototypes for plan/planagg.c + */ +extern void preprocess_minmax_aggregates(PlannerInfo *root); + +/* + * prototypes for plan/createplan.c + */ +extern Plan *create_plan(PlannerInfo *root, Path *best_path); +extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual, + Index scanrelid, List *fdw_exprs, List *fdw_private, + List *fdw_scan_tlist, List *fdw_recheck_quals, + Plan *outer_plan); +extern Plan *change_plan_targetlist(Plan *subplan, List *tlist, + bool tlist_parallel_safe); +extern Plan *materialize_finished_plan(Plan *subplan); +extern bool is_projection_capable_path(Path *path); +extern bool is_projection_capable_plan(Plan *plan); + +/* External use of these functions is deprecated: */ +extern Sort *make_sort_from_sortclauses(List *sortcls, Plan *lefttree); +extern Agg *make_agg(List *tlist, List *qual, + AggStrategy aggstrategy, AggSplit aggsplit, + int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, Oid *grpCollations, + List *groupingSets, List *chain, double dNumGroups, + Size transitionSpace, Plan *lefttree); +extern Limit *make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount, + LimitOption limitOption, int uniqNumCols, + AttrNumber *uniqColIdx, Oid *uniqOperators, + Oid *uniqCollations); + +/* + * prototypes for plan/initsplan.c + */ +extern PGDLLIMPORT int from_collapse_limit; +extern PGDLLIMPORT int join_collapse_limit; + +extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode); +extern void add_other_rels_to_query(PlannerInfo *root); +extern void build_base_rel_tlists(PlannerInfo *root, List *final_tlist); +extern void add_vars_to_targetlist(PlannerInfo *root, List *vars, + Relids where_needed); +extern void add_vars_to_attr_needed(PlannerInfo *root, List *vars, + Relids where_needed); +extern void remove_useless_groupby_columns(PlannerInfo *root); +extern void find_lateral_references(PlannerInfo *root); +extern void rebuild_lateral_attr_needed(PlannerInfo *root); +extern void create_lateral_join_info(PlannerInfo *root); +extern List *deconstruct_jointree(PlannerInfo *root); +extern bool restriction_is_always_true(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern bool restriction_is_always_false(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern void distribute_restrictinfo_to_rels(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern RestrictInfo *process_implied_equality(PlannerInfo *root, + Oid opno, + Oid collation, + Expr *item1, + Expr *item2, + Relids qualscope, + Index security_level, + bool both_const); +extern RestrictInfo *build_implied_join_equality(PlannerInfo *root, + Oid opno, + Oid collation, + Expr *item1, + Expr *item2, + Relids qualscope, + Index security_level); +extern void rebuild_joinclause_attr_needed(PlannerInfo *root); +extern void match_foreign_keys_to_quals(PlannerInfo *root); + +/* + * prototypes for plan/analyzejoins.c + */ +extern List *remove_useless_joins(PlannerInfo *root, List *joinlist); +extern void reduce_unique_semijoins(PlannerInfo *root); +extern bool query_supports_distinctness(Query *query); +extern bool query_is_distinct_for(Query *query, List *colnos, List *opids); +extern bool innerrel_is_unique(PlannerInfo *root, + Relids joinrelids, Relids outerrelids, RelOptInfo *innerrel, + JoinType jointype, List *restrictlist, bool force_cache); +extern bool innerrel_is_unique_ext(PlannerInfo *root, Relids joinrelids, + Relids outerrelids, RelOptInfo *innerrel, + JoinType jointype, List *restrictlist, + bool force_cache, List **extra_clauses); +extern List *remove_useless_self_joins(PlannerInfo *root, List *joinlist); + +/* + * prototypes for plan/setrefs.c + */ +extern Plan *set_plan_references(PlannerInfo *root, Plan *plan); +extern bool trivial_subqueryscan(SubqueryScan *plan); +extern Param *find_minmax_agg_replacement_param(PlannerInfo *root, + Aggref *aggref); +extern void record_plan_function_dependency(PlannerInfo *root, Oid funcid); +extern void record_plan_type_dependency(PlannerInfo *root, Oid typid); +extern bool extract_query_dependencies_walker(Node *node, PlannerInfo *context); + +#endif /* PLANMAIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/planner.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/planner.h new file mode 100644 index 0000000..347c582 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/planner.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * planner.h + * prototypes for planner.c. + * + * Note that the primary entry points for planner.c are declared in + * optimizer/optimizer.h, because they're intended to be called from + * non-planner code. Declarations here are meant for use by other + * planner modules. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/planner.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANNER_H +#define PLANNER_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + + +/* Hook for plugins to get control in planner() */ +typedef PlannedStmt *(*planner_hook_type) (Query *parse, + const char *query_string, + int cursorOptions, + ParamListInfo boundParams); +extern PGDLLIMPORT planner_hook_type planner_hook; + +/* Hook for plugins to get control when grouping_planner() plans upper rels */ +typedef void (*create_upper_paths_hook_type) (PlannerInfo *root, + UpperRelationKind stage, + RelOptInfo *input_rel, + RelOptInfo *output_rel, + void *extra); +extern PGDLLIMPORT create_upper_paths_hook_type create_upper_paths_hook; + + +extern PlannedStmt *standard_planner(Query *parse, const char *query_string, + int cursorOptions, + ParamListInfo boundParams); + +extern PlannerInfo *subquery_planner(PlannerGlobal *glob, Query *parse, + PlannerInfo *parent_root, + bool hasRecursion, double tuple_fraction, + SetOperationStmt *setops); + +extern RowMarkType select_rowmark_type(RangeTblEntry *rte, + LockClauseStrength strength); + +extern bool limit_needed(Query *parse); + +extern void mark_partial_aggref(Aggref *agg, AggSplit aggsplit); + +extern Path *get_cheapest_fractional_path(RelOptInfo *rel, + double tuple_fraction); + +extern Expr *preprocess_phv_expression(PlannerInfo *root, Expr *expr); + +#endif /* PLANNER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/prep.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/prep.h new file mode 100644 index 0000000..df56202 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/prep.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * prep.h + * prototypes for files in optimizer/prep/ + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/prep.h + * + *------------------------------------------------------------------------- + */ +#ifndef PREP_H +#define PREP_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + + +/* + * prototypes for prepjointree.c + */ +extern void transform_MERGE_to_join(Query *parse); +extern void replace_empty_jointree(Query *parse); +extern void pull_up_sublinks(PlannerInfo *root); +extern void preprocess_function_rtes(PlannerInfo *root); +extern Query *expand_virtual_generated_columns(PlannerInfo *root); +extern void pull_up_subqueries(PlannerInfo *root); +extern void flatten_simple_union_all(PlannerInfo *root); +extern void reduce_outer_joins(PlannerInfo *root); +extern void remove_useless_result_rtes(PlannerInfo *root); +extern Relids get_relids_in_jointree(Node *jtnode, bool include_outer_joins, + bool include_inner_joins); +extern Relids get_relids_for_join(Query *query, int joinrelid); + +/* + * prototypes for preptlist.c + */ +extern void preprocess_targetlist(PlannerInfo *root); + +extern List *extract_update_targetlist_colnos(List *tlist); + +extern PlanRowMark *get_plan_rowmark(List *rowmarks, Index rtindex); + +/* + * prototypes for prepagg.c + */ +extern void get_agg_clause_costs(PlannerInfo *root, AggSplit aggsplit, + AggClauseCosts *costs); +extern void preprocess_aggrefs(PlannerInfo *root, Node *clause); + +/* + * prototypes for prepunion.c + */ +extern RelOptInfo *plan_set_operations(PlannerInfo *root); + +#endif /* PREP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/restrictinfo.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/restrictinfo.h new file mode 100644 index 0000000..ec91fc9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/restrictinfo.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * restrictinfo.h + * prototypes for restrictinfo.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/restrictinfo.h + * + *------------------------------------------------------------------------- + */ +#ifndef RESTRICTINFO_H +#define RESTRICTINFO_H + +#include "nodes/pathnodes.h" + + +/* Convenience macro for the common case of a valid-everywhere qual */ +#define make_simple_restrictinfo(root, clause) \ + make_restrictinfo(root, clause, true, false, false, false, 0, \ + NULL, NULL, NULL) + +extern RestrictInfo *make_plain_restrictinfo(PlannerInfo *root, + Expr *clause, + Expr *orclause, + bool is_pushed_down, + bool has_clone, + bool is_clone, + bool pseudoconstant, + Index security_level, + Relids required_relids, + Relids incompatible_relids, + Relids outer_relids); +extern RestrictInfo *make_restrictinfo(PlannerInfo *root, + Expr *clause, + bool is_pushed_down, + bool has_clone, + bool is_clone, + bool pseudoconstant, + Index security_level, + Relids required_relids, + Relids incompatible_relids, + Relids outer_relids); +extern RestrictInfo *commute_restrictinfo(RestrictInfo *rinfo, Oid comm_op); +extern bool restriction_is_or_clause(RestrictInfo *restrictinfo); +extern bool restriction_is_securely_promotable(RestrictInfo *restrictinfo, + RelOptInfo *rel); +extern List *get_actual_clauses(List *restrictinfo_list); +extern List *extract_actual_clauses(List *restrictinfo_list, + bool pseudoconstant); +extern void extract_actual_join_clauses(List *restrictinfo_list, + Relids joinrelids, + List **joinquals, + List **otherquals); +extern bool join_clause_is_movable_to(RestrictInfo *rinfo, RelOptInfo *baserel); +extern bool join_clause_is_movable_into(RestrictInfo *rinfo, + Relids currentrelids, + Relids current_and_outer); + +/* + * clause_sides_match_join + * Determine whether a join clause is of the right form to use in this join. + * + * We already know that the clause is a binary opclause referencing only the + * rels in the current join. The point here is to check whether it has the + * form "outerrel_expr op innerrel_expr" or "innerrel_expr op outerrel_expr", + * rather than mixing outer and inner vars on either side. If it matches, + * we set the transient flag outer_is_left to identify which side is which. + */ +static inline bool +clause_sides_match_join(RestrictInfo *rinfo, Relids outerrelids, + Relids innerrelids) +{ + if (bms_is_subset(rinfo->left_relids, outerrelids) && + bms_is_subset(rinfo->right_relids, innerrelids)) + { + /* lefthand side is outer */ + rinfo->outer_is_left = true; + return true; + } + else if (bms_is_subset(rinfo->left_relids, innerrelids) && + bms_is_subset(rinfo->right_relids, outerrelids)) + { + /* righthand side is outer */ + rinfo->outer_is_left = false; + return true; + } + return false; /* no good for these input relations */ +} + +#endif /* RESTRICTINFO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/subselect.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/subselect.h new file mode 100644 index 0000000..48507eb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/subselect.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- + * + * subselect.h + * Planning routines for subselects. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/subselect.h + * + *------------------------------------------------------------------------- + */ +#ifndef SUBSELECT_H +#define SUBSELECT_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + +extern void SS_process_ctes(PlannerInfo *root); +extern ScalarArrayOpExpr *convert_VALUES_to_ANY(PlannerInfo *root, + Node *testexpr, + Query *values); +extern JoinExpr *convert_ANY_sublink_to_join(PlannerInfo *root, + SubLink *sublink, + Relids available_rels); +extern JoinExpr *convert_EXISTS_sublink_to_join(PlannerInfo *root, + SubLink *sublink, + bool under_not, + Relids available_rels); +extern Node *SS_replace_correlation_vars(PlannerInfo *root, Node *expr); +extern Node *SS_process_sublinks(PlannerInfo *root, Node *expr, bool isQual); +extern void SS_identify_outer_params(PlannerInfo *root); +extern void SS_charge_for_initplans(PlannerInfo *root, RelOptInfo *final_rel); +extern void SS_compute_initplan_cost(List *init_plans, + Cost *initplan_cost_p, + bool *unsafe_initplans_p); +extern void SS_attach_initplans(PlannerInfo *root, Plan *plan); +extern void SS_finalize_plan(PlannerInfo *root, Plan *plan); +extern Param *SS_make_initplan_output_param(PlannerInfo *root, + Oid resulttype, int32 resulttypmod, + Oid resultcollation); +extern void SS_make_initplan_from_plan(PlannerInfo *root, + PlannerInfo *subroot, Plan *plan, + Param *prm); + +#endif /* SUBSELECT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/tlist.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/tlist.h new file mode 100644 index 0000000..8d2c1ec --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/optimizer/tlist.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * tlist.h + * prototypes for tlist.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/tlist.h + * + *------------------------------------------------------------------------- + */ +#ifndef TLIST_H +#define TLIST_H + +#include "nodes/pathnodes.h" + + +extern TargetEntry *tlist_member(Expr *node, List *targetlist); + +extern List *add_to_flat_tlist(List *tlist, List *exprs); + +extern List *get_tlist_exprs(List *tlist, bool includeJunk); + +extern bool tlist_same_exprs(List *tlist1, List *tlist2); + +extern bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK); +extern bool tlist_same_collations(List *tlist, List *colCollations, bool junkOK); + +extern void apply_tlist_labeling(List *dest_tlist, List *src_tlist); + +extern Oid *extract_grouping_ops(List *groupClause); +extern Oid *extract_grouping_collations(List *groupClause, List *tlist); +extern AttrNumber *extract_grouping_cols(List *groupClause, List *tlist); +extern bool grouping_is_sortable(List *groupClause); +extern bool grouping_is_hashable(List *groupClause); + +extern PathTarget *make_pathtarget_from_tlist(List *tlist); +extern List *make_tlist_from_pathtarget(PathTarget *target); +extern PathTarget *copy_pathtarget(PathTarget *src); +extern PathTarget *create_empty_pathtarget(void); +extern void add_column_to_pathtarget(PathTarget *target, + Expr *expr, Index sortgroupref); +extern void add_new_column_to_pathtarget(PathTarget *target, Expr *expr); +extern void add_new_columns_to_pathtarget(PathTarget *target, List *exprs); +extern void apply_pathtarget_labeling_to_tlist(List *tlist, PathTarget *target); +extern void split_pathtarget_at_srfs(PlannerInfo *root, + PathTarget *target, PathTarget *input_target, + List **targets, List **targets_contain_srfs); +extern void split_pathtarget_at_srfs_grouping(PlannerInfo *root, + PathTarget *target, + PathTarget *input_target, + List **targets, + List **targets_contain_srfs); + +/* Convenience macro to get a PathTarget with valid cost/width fields */ +#define create_pathtarget(root, tlist) \ + set_pathtarget_cost_width(root, make_pathtarget_from_tlist(tlist)) + +#endif /* TLIST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/analyze.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/analyze.h new file mode 100644 index 0000000..f29ed03 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/analyze.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------------------- + * + * analyze.h + * parse analysis for optimizable statements + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/analyze.h + * + *------------------------------------------------------------------------- + */ +#ifndef ANALYZE_H +#define ANALYZE_H + +#include "nodes/params.h" +#include "nodes/queryjumble.h" +#include "parser/parse_node.h" + +/* Hook for plugins to get control at end of parse analysis */ +typedef void (*post_parse_analyze_hook_type) (ParseState *pstate, + Query *query, + JumbleState *jstate); +extern PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook; + + +extern Query *parse_analyze_fixedparams(RawStmt *parseTree, const char *sourceText, + const Oid *paramTypes, int numParams, QueryEnvironment *queryEnv); +extern Query *parse_analyze_varparams(RawStmt *parseTree, const char *sourceText, + Oid **paramTypes, int *numParams, QueryEnvironment *queryEnv); +extern Query *parse_analyze_withcb(RawStmt *parseTree, const char *sourceText, + ParserSetupHook parserSetup, + void *parserSetupArg, + QueryEnvironment *queryEnv); + +extern Query *parse_sub_analyze(Node *parseTree, ParseState *parentParseState, + CommonTableExpr *parentCTE, + bool locked_from_parent, + bool resolve_unknowns); + +extern List *transformInsertRow(ParseState *pstate, List *exprlist, + List *stmtcols, List *icolumns, List *attrnos, + bool strip_indirection); +extern List *transformUpdateTargetList(ParseState *pstate, + List *origTlist); +extern void transformReturningClause(ParseState *pstate, Query *qry, + ReturningClause *returningClause, + ParseExprKind exprKind); +extern Query *transformTopLevelStmt(ParseState *pstate, RawStmt *parseTree); +extern Query *transformStmt(ParseState *pstate, Node *parseTree); + +extern bool stmt_requires_parse_analysis(RawStmt *parseTree); +extern bool analyze_requires_snapshot(RawStmt *parseTree); +extern bool query_requires_rewrite_plan(Query *query); + +extern const char *LCS_asString(LockClauseStrength strength); +extern void CheckSelectLocking(Query *qry, LockClauseStrength strength); +extern void applyLockingClause(Query *qry, Index rtindex, + LockClauseStrength strength, + LockWaitPolicy waitPolicy, bool pushedDown); + +extern List *BuildOnConflictExcludedTargetlist(Relation targetrel, + Index exclRelIndex); + +extern SortGroupClause *makeSortGroupClauseForSetOp(Oid rescoltype, bool require_hash); + +#endif /* ANALYZE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/kwlist.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/kwlist.h new file mode 100644 index 0000000..a4af3f7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/kwlist.h @@ -0,0 +1,521 @@ +/*------------------------------------------------------------------------- + * + * kwlist.h + * + * The keyword lists are kept in their own source files for use by + * automatic tools. The exact representation of a keyword is determined + * by the PG_KEYWORD macro, which is not defined in this file; it can + * be defined by the caller for special purposes. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/parser/kwlist.h + * + *------------------------------------------------------------------------- + */ + +/* there is deliberately not an #ifndef KWLIST_H here */ + +/* + * List of keyword (name, token-value, category, bare-label-status) entries. + * + * Note: gen_keywordlist.pl requires the entries to appear in ASCII order. + */ + +/* name, value, category, is-bare-label */ +PG_KEYWORD("abort", ABORT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("absent", ABSENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("absolute", ABSOLUTE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("access", ACCESS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("action", ACTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("add", ADD_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("admin", ADMIN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("after", AFTER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("aggregate", AGGREGATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("all", ALL, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("also", ALSO, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("alter", ALTER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("always", ALWAYS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("analyse", ANALYSE, RESERVED_KEYWORD, BARE_LABEL) /* British spelling */ +PG_KEYWORD("analyze", ANALYZE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("and", AND, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("any", ANY, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("array", ARRAY, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("as", AS, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("asc", ASC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("asensitive", ASENSITIVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("assertion", ASSERTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("assignment", ASSIGNMENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("asymmetric", ASYMMETRIC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("at", AT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("atomic", ATOMIC, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("attach", ATTACH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("attribute", ATTRIBUTE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("authorization", AUTHORIZATION, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("backward", BACKWARD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("before", BEFORE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("begin", BEGIN_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("between", BETWEEN, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("bigint", BIGINT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("binary", BINARY, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("bit", BIT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("boolean", BOOLEAN_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("both", BOTH, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("breadth", BREADTH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("by", BY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cache", CACHE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("call", CALL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("called", CALLED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cascade", CASCADE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cascaded", CASCADED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("case", CASE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cast", CAST, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("catalog", CATALOG_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("chain", CHAIN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("char", CHAR_P, COL_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("character", CHARACTER, COL_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("characteristics", CHARACTERISTICS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("check", CHECK, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("checkpoint", CHECKPOINT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("class", CLASS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("close", CLOSE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cluster", CLUSTER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("coalesce", COALESCE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("collate", COLLATE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("collation", COLLATION, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("column", COLUMN, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("columns", COLUMNS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("comment", COMMENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("comments", COMMENTS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("commit", COMMIT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("committed", COMMITTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("compression", COMPRESSION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("concurrently", CONCURRENTLY, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("conditional", CONDITIONAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("configuration", CONFIGURATION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("conflict", CONFLICT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("connection", CONNECTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("constraint", CONSTRAINT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("constraints", CONSTRAINTS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("content", CONTENT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("continue", CONTINUE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("conversion", CONVERSION_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("copy", COPY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cost", COST, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("create", CREATE, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("cross", CROSS, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("csv", CSV, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cube", CUBE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current", CURRENT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_catalog", CURRENT_CATALOG, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_date", CURRENT_DATE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_role", CURRENT_ROLE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_schema", CURRENT_SCHEMA, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_time", CURRENT_TIME, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_timestamp", CURRENT_TIMESTAMP, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_user", CURRENT_USER, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cursor", CURSOR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cycle", CYCLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("data", DATA_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("database", DATABASE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("day", DAY_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("deallocate", DEALLOCATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("dec", DEC, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("decimal", DECIMAL_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("declare", DECLARE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("default", DEFAULT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("defaults", DEFAULTS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("deferrable", DEFERRABLE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("deferred", DEFERRED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("definer", DEFINER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("delete", DELETE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("delimiter", DELIMITER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("delimiters", DELIMITERS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("depends", DEPENDS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("depth", DEPTH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("desc", DESC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("detach", DETACH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("dictionary", DICTIONARY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("disable", DISABLE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("discard", DISCARD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("distinct", DISTINCT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("do", DO, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("document", DOCUMENT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("domain", DOMAIN_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("double", DOUBLE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("drop", DROP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("each", EACH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("else", ELSE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("empty", EMPTY_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("enable", ENABLE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("encoding", ENCODING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("encrypted", ENCRYPTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("end", END_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("enforced", ENFORCED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("enum", ENUM_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("error", ERROR_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("escape", ESCAPE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("event", EVENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("except", EXCEPT, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("exclude", EXCLUDE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("excluding", EXCLUDING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("exclusive", EXCLUSIVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("execute", EXECUTE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("exists", EXISTS, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("explain", EXPLAIN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("expression", EXPRESSION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("extension", EXTENSION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("external", EXTERNAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("extract", EXTRACT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("false", FALSE_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("family", FAMILY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("fetch", FETCH, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("filter", FILTER, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("finalize", FINALIZE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("first", FIRST_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("float", FLOAT_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("following", FOLLOWING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("for", FOR, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("force", FORCE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("foreign", FOREIGN, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("format", FORMAT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("forward", FORWARD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("freeze", FREEZE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("from", FROM, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("full", FULL, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("function", FUNCTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("functions", FUNCTIONS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("generated", GENERATED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("global", GLOBAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("grant", GRANT, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("granted", GRANTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("greatest", GREATEST, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("group", GROUP_P, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("grouping", GROUPING, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("groups", GROUPS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("handler", HANDLER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("having", HAVING, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("header", HEADER_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("hold", HOLD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("hour", HOUR_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("identity", IDENTITY_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("if", IF_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("ilike", ILIKE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("immediate", IMMEDIATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("immutable", IMMUTABLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("implicit", IMPLICIT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("import", IMPORT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("in", IN_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("include", INCLUDE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("including", INCLUDING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("increment", INCREMENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("indent", INDENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("index", INDEX, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("indexes", INDEXES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("inherit", INHERIT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("inherits", INHERITS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("initially", INITIALLY, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("inline", INLINE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("inner", INNER_P, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("inout", INOUT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("input", INPUT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("insensitive", INSENSITIVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("insert", INSERT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("instead", INSTEAD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("int", INT_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("integer", INTEGER, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("intersect", INTERSECT, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("interval", INTERVAL, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("into", INTO, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("invoker", INVOKER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("is", IS, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("isolation", ISOLATION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("join", JOIN, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json", JSON, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_array", JSON_ARRAY, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_arrayagg", JSON_ARRAYAGG, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_exists", JSON_EXISTS, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_object", JSON_OBJECT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_objectagg", JSON_OBJECTAGG, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_query", JSON_QUERY, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_scalar", JSON_SCALAR, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_serialize", JSON_SERIALIZE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_table", JSON_TABLE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_value", JSON_VALUE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("keep", KEEP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("key", KEY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("keys", KEYS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("label", LABEL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("language", LANGUAGE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("large", LARGE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("last", LAST_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("lateral", LATERAL_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("leading", LEADING, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("leakproof", LEAKPROOF, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("least", LEAST, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("left", LEFT, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("level", LEVEL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("like", LIKE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("limit", LIMIT, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("listen", LISTEN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("load", LOAD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("local", LOCAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("localtime", LOCALTIME, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("localtimestamp", LOCALTIMESTAMP, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("location", LOCATION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("lock", LOCK_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("locked", LOCKED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("logged", LOGGED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("mapping", MAPPING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("match", MATCH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("matched", MATCHED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("materialized", MATERIALIZED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("maxvalue", MAXVALUE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("merge", MERGE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("merge_action", MERGE_ACTION, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("method", METHOD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("minute", MINUTE_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("minvalue", MINVALUE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("mode", MODE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("month", MONTH_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("move", MOVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("name", NAME_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("names", NAMES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("national", NATIONAL, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("natural", NATURAL, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("nchar", NCHAR, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("nested", NESTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("new", NEW, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("next", NEXT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nfc", NFC, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nfd", NFD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nfkc", NFKC, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nfkd", NFKD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("no", NO, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("none", NONE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("normalize", NORMALIZE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("normalized", NORMALIZED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("not", NOT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nothing", NOTHING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("notify", NOTIFY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("notnull", NOTNULL, TYPE_FUNC_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("nowait", NOWAIT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("null", NULL_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nullif", NULLIF, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("nulls", NULLS_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("numeric", NUMERIC, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("object", OBJECT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("objects", OBJECTS_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("of", OF, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("off", OFF, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("offset", OFFSET, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("oids", OIDS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("old", OLD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("omit", OMIT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("on", ON, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("only", ONLY, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("operator", OPERATOR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("option", OPTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("options", OPTIONS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("or", OR, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("order", ORDER, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("ordinality", ORDINALITY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("others", OTHERS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("out", OUT_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("outer", OUTER_P, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("over", OVER, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("overlaps", OVERLAPS, TYPE_FUNC_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("overlay", OVERLAY, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("overriding", OVERRIDING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("owned", OWNED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("owner", OWNER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("parallel", PARALLEL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("parameter", PARAMETER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("parser", PARSER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("partial", PARTIAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("partition", PARTITION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("passing", PASSING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("password", PASSWORD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("path", PATH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("period", PERIOD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("placing", PLACING, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("plan", PLAN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("plans", PLANS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("policy", POLICY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("position", POSITION, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("preceding", PRECEDING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("precision", PRECISION, COL_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("prepare", PREPARE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("prepared", PREPARED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("preserve", PRESERVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("primary", PRIMARY, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("prior", PRIOR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("privileges", PRIVILEGES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("procedural", PROCEDURAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("procedure", PROCEDURE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("procedures", PROCEDURES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("program", PROGRAM, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("publication", PUBLICATION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("quote", QUOTE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("quotes", QUOTES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("range", RANGE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("read", READ, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("real", REAL, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("reassign", REASSIGN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("recursive", RECURSIVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("ref", REF_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("references", REFERENCES, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("referencing", REFERENCING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("refresh", REFRESH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("reindex", REINDEX, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("relative", RELATIVE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("release", RELEASE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("rename", RENAME, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("repeatable", REPEATABLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("replace", REPLACE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("replica", REPLICA, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("reset", RESET, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("restart", RESTART, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("restrict", RESTRICT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("return", RETURN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("returning", RETURNING, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("returns", RETURNS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("revoke", REVOKE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("right", RIGHT, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("role", ROLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("rollback", ROLLBACK, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("rollup", ROLLUP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("routine", ROUTINE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("routines", ROUTINES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("row", ROW, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("rows", ROWS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("rule", RULE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("savepoint", SAVEPOINT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("scalar", SCALAR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("schema", SCHEMA, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("schemas", SCHEMAS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("scroll", SCROLL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("search", SEARCH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("second", SECOND_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("security", SECURITY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("select", SELECT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("sequence", SEQUENCE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("sequences", SEQUENCES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("serializable", SERIALIZABLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("server", SERVER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("session", SESSION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("session_user", SESSION_USER, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("set", SET, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("setof", SETOF, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("sets", SETS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("share", SHARE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("show", SHOW, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("similar", SIMILAR, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("simple", SIMPLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("skip", SKIP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("smallint", SMALLINT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("snapshot", SNAPSHOT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("some", SOME, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("source", SOURCE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("sql", SQL_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("stable", STABLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("standalone", STANDALONE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("start", START, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("statement", STATEMENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("statistics", STATISTICS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("stdin", STDIN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("stdout", STDOUT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("storage", STORAGE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("stored", STORED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("strict", STRICT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("string", STRING_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("strip", STRIP_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("subscription", SUBSCRIPTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("substring", SUBSTRING, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("support", SUPPORT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("symmetric", SYMMETRIC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("sysid", SYSID, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("system", SYSTEM_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("system_user", SYSTEM_USER, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("table", TABLE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("tables", TABLES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("tablesample", TABLESAMPLE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("tablespace", TABLESPACE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("target", TARGET, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("temp", TEMP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("template", TEMPLATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("temporary", TEMPORARY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("text", TEXT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("then", THEN, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("ties", TIES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("time", TIME, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("timestamp", TIMESTAMP, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("to", TO, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("trailing", TRAILING, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("transaction", TRANSACTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("transform", TRANSFORM, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("treat", TREAT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("trigger", TRIGGER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("trim", TRIM, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("true", TRUE_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("truncate", TRUNCATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("trusted", TRUSTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("type", TYPE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("types", TYPES_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("uescape", UESCAPE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unbounded", UNBOUNDED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("uncommitted", UNCOMMITTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unconditional", UNCONDITIONAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unencrypted", UNENCRYPTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("union", UNION, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("unique", UNIQUE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unknown", UNKNOWN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unlisten", UNLISTEN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unlogged", UNLOGGED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("until", UNTIL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("update", UPDATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("user", USER, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("using", USING, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("vacuum", VACUUM, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("valid", VALID, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("validate", VALIDATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("validator", VALIDATOR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("value", VALUE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("values", VALUES, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("varchar", VARCHAR, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("variadic", VARIADIC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("varying", VARYING, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("verbose", VERBOSE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("version", VERSION_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("view", VIEW, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("views", VIEWS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("virtual", VIRTUAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("volatile", VOLATILE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("when", WHEN, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("where", WHERE, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("whitespace", WHITESPACE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("window", WINDOW, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("with", WITH, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("within", WITHIN, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("without", WITHOUT, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("work", WORK, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("wrapper", WRAPPER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("write", WRITE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("xml", XML_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlattributes", XMLATTRIBUTES, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlconcat", XMLCONCAT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlelement", XMLELEMENT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlexists", XMLEXISTS, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlforest", XMLFOREST, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlnamespaces", XMLNAMESPACES, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlparse", XMLPARSE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlpi", XMLPI, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlroot", XMLROOT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlserialize", XMLSERIALIZE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmltable", XMLTABLE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("year", YEAR_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("yes", YES_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("zone", ZONE, UNRESERVED_KEYWORD, BARE_LABEL) diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_agg.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_agg.h new file mode 100644 index 0000000..277d45b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_agg.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * parse_agg.h + * handle aggregates and window functions in parser + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_agg.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_AGG_H +#define PARSE_AGG_H + +#include "parser/parse_node.h" + +extern void transformAggregateCall(ParseState *pstate, Aggref *agg, + List *args, List *aggorder, + bool agg_distinct); + +extern Node *transformGroupingFunc(ParseState *pstate, GroupingFunc *p); + +extern void transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc, + WindowDef *windef); + +extern void parseCheckAggregates(ParseState *pstate, Query *qry); + +extern List *expand_grouping_sets(List *groupingSets, bool groupDistinct, int limit); + +extern int get_aggregate_argtypes(Aggref *aggref, Oid *inputTypes); + +extern Oid resolve_aggregate_transtype(Oid aggfuncid, + Oid aggtranstype, + Oid *inputTypes, + int numArguments); + +extern bool agg_args_support_sendreceive(Aggref *aggref); + +extern void build_aggregate_transfn_expr(Oid *agg_input_types, + int agg_num_inputs, + int agg_num_direct_inputs, + bool agg_variadic, + Oid agg_state_type, + Oid agg_input_collation, + Oid transfn_oid, + Oid invtransfn_oid, + Expr **transfnexpr, + Expr **invtransfnexpr); + +extern void build_aggregate_serialfn_expr(Oid serialfn_oid, + Expr **serialfnexpr); + +extern void build_aggregate_deserialfn_expr(Oid deserialfn_oid, + Expr **deserialfnexpr); + +extern void build_aggregate_finalfn_expr(Oid *agg_input_types, + int num_finalfn_inputs, + Oid agg_state_type, + Oid agg_result_type, + Oid agg_input_collation, + Oid finalfn_oid, + Expr **finalfnexpr); + +#endif /* PARSE_AGG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_clause.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_clause.h new file mode 100644 index 0000000..3e98949 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_clause.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * parse_clause.h + * handle clauses in parser + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_clause.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_CLAUSE_H +#define PARSE_CLAUSE_H + +#include "parser/parse_node.h" + +extern void transformFromClause(ParseState *pstate, List *frmList); +extern int setTargetTable(ParseState *pstate, RangeVar *relation, + bool inh, bool alsoSource, AclMode requiredPerms); + +extern Node *transformWhereClause(ParseState *pstate, Node *clause, + ParseExprKind exprKind, const char *constructName); +extern Node *transformLimitClause(ParseState *pstate, Node *clause, + ParseExprKind exprKind, const char *constructName, + LimitOption limitOption); +extern List *transformGroupClause(ParseState *pstate, List *grouplist, + List **groupingSets, + List **targetlist, List *sortClause, + ParseExprKind exprKind, bool useSQL99); +extern List *transformSortClause(ParseState *pstate, List *orderlist, + List **targetlist, ParseExprKind exprKind, + bool useSQL99); + +extern List *transformWindowDefinitions(ParseState *pstate, + List *windowdefs, + List **targetlist); + +extern List *transformDistinctClause(ParseState *pstate, + List **targetlist, List *sortClause, bool is_agg); +extern List *transformDistinctOnClause(ParseState *pstate, List *distinctlist, + List **targetlist, List *sortClause); +extern void transformOnConflictArbiter(ParseState *pstate, + OnConflictClause *onConflictClause, + List **arbiterExpr, Node **arbiterWhere, + Oid *constraint); + +extern List *addTargetToSortList(ParseState *pstate, TargetEntry *tle, + List *sortlist, List *targetlist, SortBy *sortby); +extern Index assignSortGroupRef(TargetEntry *tle, List *tlist); +extern bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList); + +/* functions in parse_jsontable.c */ +extern ParseNamespaceItem *transformJsonTable(ParseState *pstate, JsonTable *jt); + +#endif /* PARSE_CLAUSE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_coerce.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_coerce.h new file mode 100644 index 0000000..8d775c7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_coerce.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * parse_coerce.h + * Routines for type coercion. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_coerce.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_COERCE_H +#define PARSE_COERCE_H + +#include "parser/parse_node.h" + + +/* Type categories (see TYPCATEGORY_xxx symbols in catalog/pg_type.h) */ +typedef char TYPCATEGORY; + +/* Result codes for find_coercion_pathway */ +typedef enum CoercionPathType +{ + COERCION_PATH_NONE, /* failed to find any coercion pathway */ + COERCION_PATH_FUNC, /* apply the specified coercion function */ + COERCION_PATH_RELABELTYPE, /* binary-compatible cast, no function */ + COERCION_PATH_ARRAYCOERCE, /* need an ArrayCoerceExpr node */ + COERCION_PATH_COERCEVIAIO, /* need a CoerceViaIO node */ +} CoercionPathType; + + +extern bool IsBinaryCoercible(Oid srctype, Oid targettype); +extern bool IsBinaryCoercibleWithCast(Oid srctype, Oid targettype, + Oid *castoid); +extern bool IsPreferredType(TYPCATEGORY category, Oid type); +extern TYPCATEGORY TypeCategory(Oid type); + +extern Node *coerce_to_target_type(ParseState *pstate, + Node *expr, Oid exprtype, + Oid targettype, int32 targettypmod, + CoercionContext ccontext, + CoercionForm cformat, + int location); +extern bool can_coerce_type(int nargs, const Oid *input_typeids, const Oid *target_typeids, + CoercionContext ccontext); +extern Node *coerce_type(ParseState *pstate, Node *node, + Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, + CoercionContext ccontext, CoercionForm cformat, int location); +extern Node *coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod, + Oid typeId, + CoercionContext ccontext, CoercionForm cformat, int location, + bool hideInputCoercion); + +extern Node *coerce_to_boolean(ParseState *pstate, Node *node, + const char *constructName); +extern Node *coerce_to_specific_type(ParseState *pstate, Node *node, + Oid targetTypeId, + const char *constructName); + +extern Node *coerce_to_specific_type_typmod(ParseState *pstate, Node *node, + Oid targetTypeId, int32 targetTypmod, + const char *constructName); + +extern Node *coerce_null_to_domain(Oid typid, int32 typmod, Oid collation, + int typlen, bool typbyval); + +extern int parser_coercion_errposition(ParseState *pstate, + int coerce_location, + Node *input_expr); + +extern Oid select_common_type(ParseState *pstate, List *exprs, + const char *context, Node **which_expr); +extern Node *coerce_to_common_type(ParseState *pstate, Node *node, + Oid targetTypeId, + const char *context); +extern bool verify_common_type(Oid common_type, List *exprs); + +extern int32 select_common_typmod(ParseState *pstate, List *exprs, Oid common_type); + +extern bool check_generic_type_consistency(const Oid *actual_arg_types, + const Oid *declared_arg_types, + int nargs); +extern Oid enforce_generic_type_consistency(const Oid *actual_arg_types, + Oid *declared_arg_types, + int nargs, + Oid rettype, + bool allow_poly); + +extern char *check_valid_polymorphic_signature(Oid ret_type, + const Oid *declared_arg_types, + int nargs); +extern char *check_valid_internal_signature(Oid ret_type, + const Oid *declared_arg_types, + int nargs); + +extern CoercionPathType find_coercion_pathway(Oid targetTypeId, + Oid sourceTypeId, + CoercionContext ccontext, + Oid *funcid); +extern CoercionPathType find_typmod_coercion_function(Oid typeId, + Oid *funcid); + +#endif /* PARSE_COERCE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_collate.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_collate.h new file mode 100644 index 0000000..1be6750 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_collate.h @@ -0,0 +1,27 @@ +/*------------------------------------------------------------------------- + * + * parse_collate.h + * Routines for assigning collation information. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_collate.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_COLLATE_H +#define PARSE_COLLATE_H + +#include "parser/parse_node.h" + +extern void assign_query_collations(ParseState *pstate, Query *query); + +extern void assign_list_collations(ParseState *pstate, List *exprs); + +extern void assign_expr_collations(ParseState *pstate, Node *expr); + +extern Oid select_common_collation(ParseState *pstate, List *exprs, bool none_ok); + +#endif /* PARSE_COLLATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_cte.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_cte.h new file mode 100644 index 0000000..28ed837 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_cte.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * parse_cte.h + * handle CTEs (common table expressions) in parser + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_cte.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_CTE_H +#define PARSE_CTE_H + +#include "parser/parse_node.h" + +extern List *transformWithClause(ParseState *pstate, WithClause *withClause); + +extern void analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, + List *tlist); + +#endif /* PARSE_CTE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_enr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_enr.h new file mode 100644 index 0000000..3fe2bd0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_enr.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * parse_enr.h + * Internal definitions for parser + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_enr.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_ENR_H +#define PARSE_ENR_H + +#include "parser/parse_node.h" + +extern bool name_matches_visible_ENR(ParseState *pstate, const char *refname); +extern EphemeralNamedRelationMetadata get_visible_ENR(ParseState *pstate, const char *refname); + +#endif /* PARSE_ENR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_expr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_expr.h new file mode 100644 index 0000000..efbaff8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_expr.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * parse_expr.h + * handle expressions in parser + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_expr.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_EXPR_H +#define PARSE_EXPR_H + +#include "parser/parse_node.h" + +/* GUC parameters */ +extern PGDLLIMPORT bool Transform_null_equals; + +extern Node *transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind); + +extern const char *ParseExprKindName(ParseExprKind exprKind); + +#endif /* PARSE_EXPR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_func.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_func.h new file mode 100644 index 0000000..a6f24b8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_func.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * parse_func.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_func.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_FUNC_H +#define PARSE_FUNC_H + +#include "catalog/namespace.h" +#include "parser/parse_node.h" + + +/* Result codes for func_get_detail */ +typedef enum +{ + FUNCDETAIL_NOTFOUND, /* no matching function */ + FUNCDETAIL_MULTIPLE, /* too many matching functions */ + FUNCDETAIL_NORMAL, /* found a matching regular function */ + FUNCDETAIL_PROCEDURE, /* found a matching procedure */ + FUNCDETAIL_AGGREGATE, /* found a matching aggregate function */ + FUNCDETAIL_WINDOWFUNC, /* found a matching window function */ + FUNCDETAIL_COERCION, /* it's a type coercion request */ +} FuncDetailCode; + + +extern Node *ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, + Node *last_srf, FuncCall *fn, bool proc_call, + int location); + +extern FuncDetailCode func_get_detail(List *funcname, + List *fargs, List *fargnames, + int nargs, Oid *argtypes, + bool expand_variadic, bool expand_defaults, + bool include_out_arguments, + Oid *funcid, Oid *rettype, + bool *retset, int *nvargs, Oid *vatype, + Oid **true_typeids, List **argdefaults); + +extern int func_match_argtypes(int nargs, + Oid *input_typeids, + FuncCandidateList raw_candidates, + FuncCandidateList *candidates); + +extern FuncCandidateList func_select_candidate(int nargs, + Oid *input_typeids, + FuncCandidateList candidates); + +extern void make_fn_arguments(ParseState *pstate, + List *fargs, + Oid *actual_arg_types, + Oid *declared_arg_types); + +extern const char *funcname_signature_string(const char *funcname, int nargs, + List *argnames, const Oid *argtypes); +extern const char *func_signature_string(List *funcname, int nargs, + List *argnames, const Oid *argtypes); + +extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, + bool missing_ok); +extern Oid LookupFuncWithArgs(ObjectType objtype, ObjectWithArgs *func, + bool missing_ok); + +extern void check_srf_call_placement(ParseState *pstate, Node *last_srf, + int location); + +#endif /* PARSE_FUNC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_merge.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_merge.h new file mode 100644 index 0000000..2e0cf0c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_merge.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * parse_merge.h + * handle MERGE statement in parser + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_merge.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_MERGE_H +#define PARSE_MERGE_H + +#include "parser/parse_node.h" + +extern Query *transformMergeStmt(ParseState *pstate, MergeStmt *stmt); + +#endif /* PARSE_MERGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_node.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_node.h new file mode 100644 index 0000000..f7d07c8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_node.h @@ -0,0 +1,368 @@ +/*------------------------------------------------------------------------- + * + * parse_node.h + * Internal definitions for parser + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_node.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_NODE_H +#define PARSE_NODE_H + +#include "nodes/parsenodes.h" +#include "utils/queryenvironment.h" +#include "utils/relcache.h" + + +/* Forward references for some structs declared below */ +typedef struct ParseState ParseState; +typedef struct ParseNamespaceItem ParseNamespaceItem; +typedef struct ParseNamespaceColumn ParseNamespaceColumn; + +/* + * Expression kinds distinguished by transformExpr(). Many of these are not + * semantically distinct so far as expression transformation goes; rather, + * we distinguish them so that context-specific error messages can be printed. + * + * Note: EXPR_KIND_OTHER is not used in the core code, but is left for use + * by extension code that might need to call transformExpr(). The core code + * will not enforce any context-driven restrictions on EXPR_KIND_OTHER + * expressions, so the caller would have to check for sub-selects, aggregates, + * window functions, SRFs, etc if those need to be disallowed. + */ +typedef enum ParseExprKind +{ + EXPR_KIND_NONE = 0, /* "not in an expression" */ + EXPR_KIND_OTHER, /* reserved for extensions */ + EXPR_KIND_JOIN_ON, /* JOIN ON */ + EXPR_KIND_JOIN_USING, /* JOIN USING */ + EXPR_KIND_FROM_SUBSELECT, /* sub-SELECT in FROM clause */ + EXPR_KIND_FROM_FUNCTION, /* function in FROM clause */ + EXPR_KIND_WHERE, /* WHERE */ + EXPR_KIND_HAVING, /* HAVING */ + EXPR_KIND_FILTER, /* FILTER */ + EXPR_KIND_WINDOW_PARTITION, /* window definition PARTITION BY */ + EXPR_KIND_WINDOW_ORDER, /* window definition ORDER BY */ + EXPR_KIND_WINDOW_FRAME_RANGE, /* window frame clause with RANGE */ + EXPR_KIND_WINDOW_FRAME_ROWS, /* window frame clause with ROWS */ + EXPR_KIND_WINDOW_FRAME_GROUPS, /* window frame clause with GROUPS */ + EXPR_KIND_SELECT_TARGET, /* SELECT target list item */ + EXPR_KIND_INSERT_TARGET, /* INSERT target list item */ + EXPR_KIND_UPDATE_SOURCE, /* UPDATE assignment source item */ + EXPR_KIND_UPDATE_TARGET, /* UPDATE assignment target item */ + EXPR_KIND_MERGE_WHEN, /* MERGE WHEN [NOT] MATCHED condition */ + EXPR_KIND_GROUP_BY, /* GROUP BY */ + EXPR_KIND_ORDER_BY, /* ORDER BY */ + EXPR_KIND_DISTINCT_ON, /* DISTINCT ON */ + EXPR_KIND_LIMIT, /* LIMIT */ + EXPR_KIND_OFFSET, /* OFFSET */ + EXPR_KIND_RETURNING, /* RETURNING in INSERT/UPDATE/DELETE */ + EXPR_KIND_MERGE_RETURNING, /* RETURNING in MERGE */ + EXPR_KIND_VALUES, /* VALUES */ + EXPR_KIND_VALUES_SINGLE, /* single-row VALUES (in INSERT only) */ + EXPR_KIND_CHECK_CONSTRAINT, /* CHECK constraint for a table */ + EXPR_KIND_DOMAIN_CHECK, /* CHECK constraint for a domain */ + EXPR_KIND_COLUMN_DEFAULT, /* default value for a table column */ + EXPR_KIND_FUNCTION_DEFAULT, /* default parameter value for function */ + EXPR_KIND_INDEX_EXPRESSION, /* index expression */ + EXPR_KIND_INDEX_PREDICATE, /* index predicate */ + EXPR_KIND_STATS_EXPRESSION, /* extended statistics expression */ + EXPR_KIND_ALTER_COL_TRANSFORM, /* transform expr in ALTER COLUMN TYPE */ + EXPR_KIND_EXECUTE_PARAMETER, /* parameter value in EXECUTE */ + EXPR_KIND_TRIGGER_WHEN, /* WHEN condition in CREATE TRIGGER */ + EXPR_KIND_POLICY, /* USING or WITH CHECK expr in policy */ + EXPR_KIND_PARTITION_BOUND, /* partition bound expression */ + EXPR_KIND_PARTITION_EXPRESSION, /* PARTITION BY expression */ + EXPR_KIND_CALL_ARGUMENT, /* procedure argument in CALL */ + EXPR_KIND_COPY_WHERE, /* WHERE condition in COPY FROM */ + EXPR_KIND_GENERATED_COLUMN, /* generation expression for a column */ + EXPR_KIND_CYCLE_MARK, /* cycle mark value */ +} ParseExprKind; + + +/* + * Function signatures for parser hooks + */ +typedef Node *(*PreParseColumnRefHook) (ParseState *pstate, ColumnRef *cref); +typedef Node *(*PostParseColumnRefHook) (ParseState *pstate, ColumnRef *cref, Node *var); +typedef Node *(*ParseParamRefHook) (ParseState *pstate, ParamRef *pref); +typedef Node *(*CoerceParamHook) (ParseState *pstate, Param *param, + Oid targetTypeId, int32 targetTypeMod, + int location); + + +/* + * State information used during parse analysis + * + * parentParseState: NULL in a top-level ParseState. When parsing a subquery, + * links to current parse state of outer query. + * + * p_sourcetext: source string that generated the raw parsetree being + * analyzed, or NULL if not available. (The string is used only to + * generate cursor positions in error messages: we need it to convert + * byte-wise locations in parse structures to character-wise cursor + * positions.) + * + * p_rtable: list of RTEs that will become the rangetable of the query. + * Note that neither relname nor refname of these entries are necessarily + * unique; searching the rtable by name is a bad idea. + * + * p_rteperminfos: list of RTEPermissionInfo containing an entry corresponding + * to each RTE_RELATION entry in p_rtable. + * + * p_joinexprs: list of JoinExpr nodes associated with p_rtable entries. + * This is one-for-one with p_rtable, but contains NULLs for non-join + * RTEs, and may be shorter than p_rtable if the last RTE(s) aren't joins. + * + * p_nullingrels: list of Bitmapsets associated with p_rtable entries, each + * containing the set of outer-join RTE indexes that can null that relation + * at the current point in the parse tree. This is one-for-one with p_rtable, + * but may be shorter than p_rtable, in which case the missing entries are + * implicitly empty (NULL). That rule allows us to save work when the query + * contains no outer joins. + * + * p_joinlist: list of join items (RangeTblRef and JoinExpr nodes) that + * will become the fromlist of the query's top-level FromExpr node. + * + * p_namespace: list of ParseNamespaceItems that represents the current + * namespace for table and column lookup. (The RTEs listed here may be just + * a subset of the whole rtable. See ParseNamespaceItem comments below.) + * + * p_lateral_active: true if we are currently parsing a LATERAL subexpression + * of this parse level. This makes p_lateral_only namespace items visible, + * whereas they are not visible when p_lateral_active is FALSE. + * + * p_ctenamespace: list of CommonTableExprs (WITH items) that are visible + * at the moment. This is entirely different from p_namespace because a CTE + * is not an RTE, rather "visibility" means you could make an RTE from it. + * + * p_future_ctes: list of CommonTableExprs (WITH items) that are not yet + * visible due to scope rules. This is used to help improve error messages. + * + * p_parent_cte: CommonTableExpr that immediately contains the current query, + * if any. + * + * p_target_relation: target relation, if query is INSERT/UPDATE/DELETE/MERGE + * + * p_target_nsitem: target relation's ParseNamespaceItem. + * + * p_grouping_nsitem: the ParseNamespaceItem that represents the grouping step. + * + * p_is_insert: true to process assignment expressions like INSERT, false + * to process them like UPDATE. (Note this can change intra-statement, for + * cases like INSERT ON CONFLICT UPDATE.) + * + * p_windowdefs: list of WindowDefs representing WINDOW and OVER clauses. + * We collect these while transforming expressions and then transform them + * afterwards (so that any resjunk tlist items needed for the sort/group + * clauses end up at the end of the query tlist). A WindowDef's location in + * this list, counting from 1, is the winref number to use to reference it. + * + * p_expr_kind: kind of expression we're currently parsing, as per enum above; + * EXPR_KIND_NONE when not in an expression. + * + * p_next_resno: next TargetEntry.resno to assign, starting from 1. + * + * p_multiassign_exprs: partially-processed MultiAssignRef source expressions. + * + * p_locking_clause: query's FOR UPDATE/FOR SHARE clause, if any. + * + * p_locked_from_parent: true if parent query level applies FOR UPDATE/SHARE + * to this subquery as a whole. + * + * p_resolve_unknowns: resolve unknown-type SELECT output columns as type TEXT + * (this is true by default). + * + * p_hasAggs, p_hasWindowFuncs, etc: true if we've found any of the indicated + * constructs in the query. + * + * p_last_srf: the set-returning FuncExpr or OpExpr most recently found in + * the query, or NULL if none. + * + * p_pre_columnref_hook, etc: optional parser hook functions for modifying the + * interpretation of ColumnRefs and ParamRefs. + * + * p_ref_hook_state: passthrough state for the parser hook functions. + */ +struct ParseState +{ + ParseState *parentParseState; /* stack link */ + const char *p_sourcetext; /* source text, or NULL if not available */ + List *p_rtable; /* range table so far */ + List *p_rteperminfos; /* list of RTEPermissionInfo nodes for each + * RTE_RELATION entry in rtable */ + List *p_joinexprs; /* JoinExprs for RTE_JOIN p_rtable entries */ + List *p_nullingrels; /* Bitmapsets showing nulling outer joins */ + List *p_joinlist; /* join items so far (will become FromExpr + * node's fromlist) */ + List *p_namespace; /* currently-referenceable RTEs (List of + * ParseNamespaceItem) */ + bool p_lateral_active; /* p_lateral_only items visible? */ + List *p_ctenamespace; /* current namespace for common table exprs */ + List *p_future_ctes; /* common table exprs not yet in namespace */ + CommonTableExpr *p_parent_cte; /* this query's containing CTE */ + Relation p_target_relation; /* INSERT/UPDATE/DELETE/MERGE target rel */ + ParseNamespaceItem *p_target_nsitem; /* target rel's NSItem, or NULL */ + ParseNamespaceItem *p_grouping_nsitem; /* NSItem for grouping, or NULL */ + bool p_is_insert; /* process assignment like INSERT not UPDATE */ + List *p_windowdefs; /* raw representations of window clauses */ + ParseExprKind p_expr_kind; /* what kind of expression we're parsing */ + int p_next_resno; /* next targetlist resno to assign */ + List *p_multiassign_exprs; /* junk tlist entries for multiassign */ + List *p_locking_clause; /* raw FOR UPDATE/FOR SHARE info */ + bool p_locked_from_parent; /* parent has marked this subquery + * with FOR UPDATE/FOR SHARE */ + bool p_resolve_unknowns; /* resolve unknown-type SELECT outputs as + * type text */ + + QueryEnvironment *p_queryEnv; /* curr env, incl refs to enclosing env */ + + /* Flags telling about things found in the query: */ + bool p_hasAggs; + bool p_hasWindowFuncs; + bool p_hasTargetSRFs; + bool p_hasSubLinks; + bool p_hasModifyingCTE; + + Node *p_last_srf; /* most recent set-returning func/op found */ + + /* + * Optional hook functions for parser callbacks. These are null unless + * set up by the caller of make_parsestate. + */ + PreParseColumnRefHook p_pre_columnref_hook; + PostParseColumnRefHook p_post_columnref_hook; + ParseParamRefHook p_paramref_hook; + CoerceParamHook p_coerce_param_hook; + void *p_ref_hook_state; /* common passthrough link for above */ +}; + +/* + * An element of a namespace list. + * + * p_names contains the table name and column names exposed by this nsitem. + * (Typically it's equal to p_rte->eref, but for a JOIN USING alias it's + * equal to p_rte->join_using_alias. Since the USING columns will be the + * join's first N columns, the net effect is just that we expose only those + * join columns via this nsitem.) + * + * p_rte and p_rtindex link to the underlying rangetable entry, and + * p_perminfo to the entry in rteperminfos. + * + * The p_nscolumns array contains info showing how to construct Vars + * referencing the names appearing in the p_names->colnames list. + * + * Namespace items with p_rel_visible set define which RTEs are accessible by + * qualified names, while those with p_cols_visible set define which RTEs are + * accessible by unqualified names. These sets are different because a JOIN + * without an alias does not hide the contained tables (so they must be + * visible for qualified references) but it does hide their columns + * (unqualified references to the columns refer to the JOIN, not the member + * tables, so we must not complain that such a reference is ambiguous). + * Conversely, a subquery without an alias does not hide the columns selected + * by the subquery, but it does hide the auto-generated relation name (so the + * subquery columns are visible for unqualified references only). Various + * special RTEs such as NEW/OLD for rules may also appear with only one flag + * set. + * + * While processing the FROM clause, namespace items may appear with + * p_lateral_only set, meaning they are visible only to LATERAL + * subexpressions. (The pstate's p_lateral_active flag tells whether we are + * inside such a subexpression at the moment.) If p_lateral_ok is not set, + * it's an error to actually use such a namespace item. One might think it + * would be better to just exclude such items from visibility, but the wording + * of SQL:2008 requires us to do it this way. We also use p_lateral_ok to + * forbid LATERAL references to an UPDATE/DELETE target table. + * + * While processing the RETURNING clause, special namespace items are added to + * refer to the OLD and NEW state of the result relation. These namespace + * items have p_returning_type set appropriately, for use when creating Vars. + * For convenience, this information is duplicated on each namespace column. + * + * At no time should a namespace list contain two entries that conflict + * according to the rules in checkNameSpaceConflicts; but note that those + * are more complicated than "must have different alias names", so in practice + * code searching a namespace list has to check for ambiguous references. + */ +struct ParseNamespaceItem +{ + Alias *p_names; /* Table and column names */ + RangeTblEntry *p_rte; /* The relation's rangetable entry */ + int p_rtindex; /* The relation's index in the rangetable */ + RTEPermissionInfo *p_perminfo; /* The relation's rteperminfos entry */ + /* array of same length as p_names->colnames: */ + ParseNamespaceColumn *p_nscolumns; /* per-column data */ + bool p_rel_visible; /* Relation name is visible? */ + bool p_cols_visible; /* Column names visible as unqualified refs? */ + bool p_lateral_only; /* Is only visible to LATERAL expressions? */ + bool p_lateral_ok; /* If so, does join type allow use? */ + VarReturningType p_returning_type; /* Is OLD/NEW for use in RETURNING? */ +}; + +/* + * Data about one column of a ParseNamespaceItem. + * + * We track the info needed to construct a Var referencing the column + * (but only for user-defined columns; system column references and + * whole-row references are handled separately). + * + * p_varno and p_varattno identify the semantic referent, which is a + * base-relation column unless the reference is to a join USING column that + * isn't semantically equivalent to either join input column (because it is a + * FULL join or the input column requires a type coercion). In those cases + * p_varno and p_varattno refer to the JOIN RTE. + * + * p_varnosyn and p_varattnosyn are either identical to p_varno/p_varattno, + * or they specify the column's position in an aliased JOIN RTE that hides + * the semantic referent RTE's refname. (That could be either the JOIN RTE + * in which this ParseNamespaceColumn entry exists, or some lower join level.) + * + * If an RTE contains a dropped column, its ParseNamespaceColumn struct + * is all-zeroes. (Conventionally, test for p_varno == 0 to detect this.) + */ +struct ParseNamespaceColumn +{ + Index p_varno; /* rangetable index */ + AttrNumber p_varattno; /* attribute number of the column */ + Oid p_vartype; /* pg_type OID */ + int32 p_vartypmod; /* type modifier value */ + Oid p_varcollid; /* OID of collation, or InvalidOid */ + VarReturningType p_varreturningtype; /* for RETURNING OLD/NEW */ + Index p_varnosyn; /* rangetable index of syntactic referent */ + AttrNumber p_varattnosyn; /* attribute number of syntactic referent */ + bool p_dontexpand; /* not included in star expansion */ +}; + +/* Support for parser_errposition_callback function */ +typedef struct ParseCallbackState +{ + ParseState *pstate; + int location; + ErrorContextCallback errcallback; +} ParseCallbackState; + + +extern ParseState *make_parsestate(ParseState *parentParseState); +extern void free_parsestate(ParseState *pstate); +extern int parser_errposition(ParseState *pstate, int location); + +extern void setup_parser_errposition_callback(ParseCallbackState *pcbstate, + ParseState *pstate, int location); +extern void cancel_parser_errposition_callback(ParseCallbackState *pcbstate); + +extern void transformContainerType(Oid *containerType, int32 *containerTypmod); + +extern SubscriptingRef *transformContainerSubscripts(ParseState *pstate, + Node *containerBase, + Oid containerType, + int32 containerTypMod, + List *indirection, + bool isAssignment); +extern Const *make_const(ParseState *pstate, A_Const *aconst); + +#endif /* PARSE_NODE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_oper.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_oper.h new file mode 100644 index 0000000..0f27609 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_oper.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------------------- + * + * parse_oper.h + * handle operator things for parser + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_oper.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_OPER_H +#define PARSE_OPER_H + +#include "access/htup.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" + + +typedef HeapTuple Operator; + +/* Routines to look up an operator given name and exact input type(s) */ +extern Oid LookupOperName(ParseState *pstate, List *opername, + Oid oprleft, Oid oprright, + bool noError, int location); +extern Oid LookupOperWithArgs(ObjectWithArgs *oper, bool noError); + +/* Routines to find operators matching a name and given input types */ +/* NB: the selected operator may require coercion of the input types! */ +extern Operator oper(ParseState *pstate, List *opname, Oid ltypeId, + Oid rtypeId, bool noError, int location); +extern Operator left_oper(ParseState *pstate, List *op, Oid arg, + bool noError, int location); + +/* Routines to find operators that DO NOT require coercion --- ie, their */ +/* input types are either exactly as given, or binary-compatible */ +extern Operator compatible_oper(ParseState *pstate, List *op, + Oid arg1, Oid arg2, + bool noError, int location); + +/* currently no need for compatible_left_oper/compatible_right_oper */ + +/* Error reporting support */ +extern const char *op_signature_string(List *op, Oid arg1, Oid arg2); + +/* Routines for identifying "<", "=", ">" operators for a type */ +extern void get_sort_group_operators(Oid argtype, + bool needLT, bool needEQ, bool needGT, + Oid *ltOpr, Oid *eqOpr, Oid *gtOpr, + bool *isHashable); + +/* Convenience routines for common calls on the above */ +extern Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError); + +/* Extract operator OID or underlying-function OID from an Operator tuple */ +extern Oid oprid(Operator op); +extern Oid oprfuncid(Operator op); + +/* Build expression tree for an operator invocation */ +extern Expr *make_op(ParseState *pstate, List *opname, + Node *ltree, Node *rtree, Node *last_srf, int location); +extern Expr *make_scalar_array_op(ParseState *pstate, List *opname, + bool useOr, + Node *ltree, Node *rtree, int location); + +#endif /* PARSE_OPER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_param.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_param.h new file mode 100644 index 0000000..821f896 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_param.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * parse_param.h + * handle parameters in parser + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_param.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_PARAM_H +#define PARSE_PARAM_H + +#include "parser/parse_node.h" + +extern void setup_parse_fixed_parameters(ParseState *pstate, + const Oid *paramTypes, int numParams); +extern void setup_parse_variable_parameters(ParseState *pstate, + Oid **paramTypes, int *numParams); +extern void check_variable_parameters(ParseState *pstate, Query *query); +extern bool query_contains_extern_params(Query *query); + +#endif /* PARSE_PARAM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_relation.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_relation.h new file mode 100644 index 0000000..d59599c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_relation.h @@ -0,0 +1,132 @@ +/*------------------------------------------------------------------------- + * + * parse_relation.h + * prototypes for parse_relation.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_relation.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_RELATION_H +#define PARSE_RELATION_H + +#include "parser/parse_node.h" + + +extern ParseNamespaceItem *refnameNamespaceItem(ParseState *pstate, + const char *schemaname, + const char *refname, + int location, + int *sublevels_up); +extern CommonTableExpr *scanNameSpaceForCTE(ParseState *pstate, + const char *refname, + Index *ctelevelsup); +extern bool scanNameSpaceForENR(ParseState *pstate, const char *refname); +extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1, + List *namespace2); +extern ParseNamespaceItem *GetNSItemByRangeTablePosn(ParseState *pstate, + int varno, + int sublevels_up); +extern RangeTblEntry *GetRTEByRangeTablePosn(ParseState *pstate, + int varno, + int sublevels_up); +extern CommonTableExpr *GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, + int rtelevelsup); +extern Node *scanNSItemForColumn(ParseState *pstate, ParseNamespaceItem *nsitem, + int sublevels_up, const char *colname, + int location); +extern Node *colNameToVar(ParseState *pstate, const char *colname, bool localonly, + int location); +extern void markNullableIfNeeded(ParseState *pstate, Var *var); +extern void markVarForSelectPriv(ParseState *pstate, Var *var); +extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, + int lockmode); +extern ParseNamespaceItem *addRangeTableEntry(ParseState *pstate, + RangeVar *relation, + Alias *alias, + bool inh, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForRelation(ParseState *pstate, + Relation rel, + int lockmode, + Alias *alias, + bool inh, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForSubquery(ParseState *pstate, + Query *subquery, + Alias *alias, + bool lateral, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForFunction(ParseState *pstate, + List *funcnames, + List *funcexprs, + List *coldeflists, + RangeFunction *rangefunc, + bool lateral, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForValues(ParseState *pstate, + List *exprs, + List *coltypes, + List *coltypmods, + List *colcollations, + Alias *alias, + bool lateral, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForTableFunc(ParseState *pstate, + TableFunc *tf, + Alias *alias, + bool lateral, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForJoin(ParseState *pstate, + List *colnames, + ParseNamespaceColumn *nscolumns, + JoinType jointype, + int nummergedcols, + List *aliasvars, + List *leftcols, + List *rightcols, + Alias *join_using_alias, + Alias *alias, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForCTE(ParseState *pstate, + CommonTableExpr *cte, + Index levelsup, + RangeVar *rv, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForENR(ParseState *pstate, + RangeVar *rv, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForGroup(ParseState *pstate, + List *groupClauses); +extern RTEPermissionInfo *addRTEPermissionInfo(List **rteperminfos, + RangeTblEntry *rte); +extern RTEPermissionInfo *getRTEPermissionInfo(List *rteperminfos, + RangeTblEntry *rte); +extern bool isLockedRefname(ParseState *pstate, const char *refname); +extern void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem, + bool addToJoinList, + bool addToRelNameSpace, bool addToVarNameSpace); +pg_noreturn extern void errorMissingRTE(ParseState *pstate, RangeVar *relation); +pg_noreturn extern void errorMissingColumn(ParseState *pstate, + const char *relname, const char *colname, int location); +extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, + VarReturningType returning_type, + int location, bool include_dropped, + List **colnames, List **colvars); +extern List *expandNSItemVars(ParseState *pstate, ParseNamespaceItem *nsitem, + int sublevels_up, int location, + List **colnames); +extern List *expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem, + int sublevels_up, bool require_col_privs, + int location); +extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK); +extern const NameData *attnumAttName(Relation rd, int attid); +extern Oid attnumTypeId(Relation rd, int attid); +extern Oid attnumCollationId(Relation rd, int attid); +extern bool isQueryUsingTempRelation(Query *query); + +#endif /* PARSE_RELATION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_target.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_target.h new file mode 100644 index 0000000..89357f3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_target.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * parse_target.h + * handle target lists + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_target.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_TARGET_H +#define PARSE_TARGET_H + +#include "parser/parse_node.h" + + +extern List *transformTargetList(ParseState *pstate, List *targetlist, + ParseExprKind exprKind); +extern List *transformExpressionList(ParseState *pstate, List *exprlist, + ParseExprKind exprKind, bool allowDefault); +extern void resolveTargetListUnknowns(ParseState *pstate, List *targetlist); +extern void markTargetListOrigins(ParseState *pstate, List *targetlist); +extern TargetEntry *transformTargetEntry(ParseState *pstate, + Node *node, Node *expr, ParseExprKind exprKind, + char *colname, bool resjunk); +extern Expr *transformAssignedExpr(ParseState *pstate, Expr *expr, + ParseExprKind exprKind, + const char *colname, + int attrno, + List *indirection, + int location); +extern void updateTargetListEntry(ParseState *pstate, TargetEntry *tle, + char *colname, int attrno, + List *indirection, + int location); +extern Node *transformAssignmentIndirection(ParseState *pstate, + Node *basenode, + const char *targetName, + bool targetIsSubscripting, + Oid targetTypeId, + int32 targetTypMod, + Oid targetCollation, + List *indirection, + ListCell *indirection_cell, + Node *rhs, + CoercionContext ccontext, + int location); +extern List *checkInsertTargets(ParseState *pstate, List *cols, + List **attrnos); +extern TupleDesc expandRecordVariable(ParseState *pstate, Var *var, + int levelsup); +extern char *FigureColname(Node *node); +extern char *FigureIndexColname(Node *node); + +#endif /* PARSE_TARGET_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_type.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_type.h new file mode 100644 index 0000000..0d919d8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_type.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * parse_type.h + * handle type operations for parser + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_type.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_TYPE_H +#define PARSE_TYPE_H + +#include "access/htup.h" +#include "parser/parse_node.h" + + +typedef HeapTuple Type; + +extern Type LookupTypeName(ParseState *pstate, const TypeName *typeName, + int32 *typmod_p, bool missing_ok); +extern Type LookupTypeNameExtended(ParseState *pstate, + const TypeName *typeName, int32 *typmod_p, + bool temp_ok, bool missing_ok); +extern Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName, + bool missing_ok); +extern Type typenameType(ParseState *pstate, const TypeName *typeName, + int32 *typmod_p); +extern Oid typenameTypeId(ParseState *pstate, const TypeName *typeName); +extern void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, + Oid *typeid_p, int32 *typmod_p); + +extern char *TypeNameToString(const TypeName *typeName); +extern char *TypeNameListToString(List *typenames); + +extern Oid LookupCollation(ParseState *pstate, List *collnames, int location); +extern Oid GetColumnDefCollation(ParseState *pstate, const ColumnDef *coldef, Oid typeOid); + +extern Type typeidType(Oid id); + +extern Oid typeTypeId(Type tp); +extern int16 typeLen(Type t); +extern bool typeByVal(Type t); +extern char *typeTypeName(Type t); +extern Oid typeTypeRelid(Type typ); +extern Oid typeTypeCollation(Type typ); +extern Datum stringTypeDatum(Type tp, char *string, int32 atttypmod); + +extern Oid typeidTypeRelid(Oid type_id); +extern Oid typeOrDomainTypeRelid(Oid type_id); + +extern TypeName *typeStringToTypeName(const char *str, Node *escontext); +extern bool parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, + Node *escontext); + +/* true if typeid is composite, or domain over composite, but not RECORD */ +#define ISCOMPLEX(typeid) (typeOrDomainTypeRelid(typeid) != InvalidOid) + +#endif /* PARSE_TYPE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_utilcmd.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_utilcmd.h new file mode 100644 index 0000000..9f2b58d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parse_utilcmd.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * parse_utilcmd.h + * parse analysis for utility commands + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_utilcmd.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_UTILCMD_H +#define PARSE_UTILCMD_H + +#include "parser/parse_node.h" + +struct AttrMap; /* avoid including attmap.h here */ + + +extern List *transformCreateStmt(CreateStmt *stmt, const char *queryString); +extern AlterTableStmt *transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, + const char *queryString, + List **beforeStmts, + List **afterStmts); +extern IndexStmt *transformIndexStmt(Oid relid, IndexStmt *stmt, + const char *queryString); +extern CreateStatsStmt *transformStatsStmt(Oid relid, CreateStatsStmt *stmt, + const char *queryString); +extern void transformRuleStmt(RuleStmt *stmt, const char *queryString, + List **actions, Node **whereClause); +extern List *transformCreateSchemaStmtElements(List *schemaElts, + const char *schemaName); +extern PartitionBoundSpec *transformPartitionBound(ParseState *pstate, Relation parent, + PartitionBoundSpec *spec); +extern List *expandTableLikeClause(RangeVar *heapRel, + TableLikeClause *table_like_clause); +extern IndexStmt *generateClonedIndexStmt(RangeVar *heapRel, + Relation source_idx, + const struct AttrMap *attmap, + Oid *constraintOid); + +#endif /* PARSE_UTILCMD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parser.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parser.h new file mode 100644 index 0000000..350196c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parser.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------------------- + * + * parser.h + * Definitions for the "raw" parser (flex and bison phases only) + * + * This is the external API for the raw lexing/parsing functions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parser.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSER_H +#define PARSER_H + +#include "nodes/parsenodes.h" + + +/* + * RawParseMode determines the form of the string that raw_parser() accepts: + * + * RAW_PARSE_DEFAULT: parse a semicolon-separated list of SQL commands, + * and return a List of RawStmt nodes. + * + * RAW_PARSE_TYPE_NAME: parse a type name, and return a one-element List + * containing a TypeName node. + * + * RAW_PARSE_PLPGSQL_EXPR: parse a PL/pgSQL expression, and return + * a one-element List containing a RawStmt node. + * + * RAW_PARSE_PLPGSQL_ASSIGNn: parse a PL/pgSQL assignment statement, + * and return a one-element List containing a RawStmt node. "n" + * gives the number of dotted names comprising the target ColumnRef. + */ +typedef enum +{ + RAW_PARSE_DEFAULT = 0, + RAW_PARSE_TYPE_NAME, + RAW_PARSE_PLPGSQL_EXPR, + RAW_PARSE_PLPGSQL_ASSIGN1, + RAW_PARSE_PLPGSQL_ASSIGN2, + RAW_PARSE_PLPGSQL_ASSIGN3, +} RawParseMode; + +/* Values for the backslash_quote GUC */ +typedef enum +{ + BACKSLASH_QUOTE_OFF, + BACKSLASH_QUOTE_ON, + BACKSLASH_QUOTE_SAFE_ENCODING, +} BackslashQuoteType; + +/* GUC variables in scan.l (every one of these is a bad idea :-() */ +extern PGDLLIMPORT int backslash_quote; +extern PGDLLIMPORT bool escape_string_warning; +extern PGDLLIMPORT bool standard_conforming_strings; + + +/* Primary entry point for the raw parsing functions */ +extern List *raw_parser(const char *str, RawParseMode mode); + +/* Utility functions exported by gram.y (perhaps these should be elsewhere) */ +extern List *SystemFuncName(char *name); +extern TypeName *SystemTypeName(char *name); + +#endif /* PARSER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parsetree.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parsetree.h new file mode 100644 index 0000000..17f5c9c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/parsetree.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * parsetree.h + * Routines to access various components and subcomponents of + * parse trees. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parsetree.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSETREE_H +#define PARSETREE_H + +#include "nodes/parsenodes.h" + + +/* ---------------- + * range table operations + * ---------------- + */ + +/* + * rt_fetch + * + * NB: this will crash and burn if handed an out-of-range RT index + */ +#define rt_fetch(rangetable_index, rangetable) \ + ((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1)) + +/* + * Given an RTE and an attribute number, return the appropriate + * variable name or alias for that attribute of that RTE. + */ +extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum); + +/* + * Check whether an attribute of an RTE has been dropped + */ +extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte, + AttrNumber attnum); + + +/* ---------------- + * target list operations + * ---------------- + */ + +extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno); + +/* ---------------- + * FOR UPDATE/SHARE info + * ---------------- + */ + +extern RowMarkClause *get_parse_rowmark(Query *qry, Index rtindex); + +#endif /* PARSETREE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/scanner.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/scanner.h new file mode 100644 index 0000000..8d202d5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/scanner.h @@ -0,0 +1,150 @@ +/*------------------------------------------------------------------------- + * + * scanner.h + * API for the core scanner (flex machine) + * + * The core scanner is also used by PL/pgSQL, so we provide a public API + * for it. However, the rest of the backend is only expected to use the + * higher-level API provided by parser.h. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/scanner.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SCANNER_H +#define SCANNER_H + +#include "common/keywords.h" + +/* + * The scanner returns extra data about scanned tokens in this union type. + * Note that this is a subset of the fields used in YYSTYPE of the bison + * parsers built atop the scanner. + */ +typedef union core_YYSTYPE +{ + int ival; /* for integer literals */ + char *str; /* for identifiers and non-integer literals */ + const char *keyword; /* canonical spelling of keywords */ +} core_YYSTYPE; + +/* + * We track token locations in terms of byte offsets from the start of the + * source string, not the column number/line number representation that + * bison uses by default. Also, to minimize overhead we track only one + * location (usually the first token location) for each construct, not + * the beginning and ending locations as bison does by default. It's + * therefore sufficient to make YYLTYPE an int. + */ +#define YYLTYPE int + +/* + * Another important component of the scanner's API is the token code numbers. + * However, those are not defined in this file, because bison insists on + * defining them for itself. The token codes used by the core scanner are + * the ASCII characters plus these: + * %token IDENT UIDENT FCONST SCONST USCONST BCONST XCONST Op + * %token ICONST PARAM + * %token TYPECAST DOT_DOT COLON_EQUALS EQUALS_GREATER + * %token LESS_EQUALS GREATER_EQUALS NOT_EQUALS + * The above token definitions *must* be the first ones declared in any + * bison parser built atop this scanner, so that they will have consistent + * numbers assigned to them (specifically, IDENT = 258 and so on). + */ + +/* + * The YY_EXTRA data that a flex scanner allows us to pass around. + * Private state needed by the core scanner goes here. Note that the actual + * yy_extra struct may be larger and have this as its first component, thus + * allowing the calling parser to keep some fields of its own in YY_EXTRA. + */ +typedef struct core_yy_extra_type +{ + /* + * The string the scanner is physically scanning. We keep this mainly so + * that we can cheaply compute the offset of the current token (yytext). + */ + char *scanbuf; + Size scanbuflen; + + /* + * The keyword list to use, and the associated grammar token codes. + */ + const ScanKeywordList *keywordlist; + const uint16 *keyword_tokens; + + /* + * Scanner settings to use. These are initialized from the corresponding + * GUC variables by scanner_init(). Callers can modify them after + * scanner_init() if they don't want the scanner's behavior to follow the + * prevailing GUC settings. + */ + int backslash_quote; + bool escape_string_warning; + bool standard_conforming_strings; + + /* + * literalbuf is used to accumulate literal values when multiple rules are + * needed to parse a single literal. Call startlit() to reset buffer to + * empty, addlit() to add text. NOTE: the string in literalbuf is NOT + * necessarily null-terminated, but there always IS room to add a trailing + * null at offset literallen. We store a null only when we need it. + */ + char *literalbuf; /* palloc'd expandable buffer */ + int literallen; /* actual current string length */ + int literalalloc; /* current allocated buffer size */ + + /* + * Random assorted scanner state. + */ + int state_before_str_stop; /* start cond. before end quote */ + int xcdepth; /* depth of nesting in slash-star comments */ + char *dolqstart; /* current $foo$ quote start string */ + YYLTYPE save_yylloc; /* one-element stack for PUSH_YYLLOC() */ + + /* first part of UTF16 surrogate pair for Unicode escapes */ + int32 utf16_first_part; + + /* state variables for literal-lexing warnings */ + bool warn_on_first_escape; + bool saw_non_ascii; +} core_yy_extra_type; + +/* + * The type of yyscanner is opaque outside scan.l. + */ +typedef void *core_yyscan_t; + +/* Support for scanner_errposition_callback function */ +typedef struct ScannerCallbackState +{ + core_yyscan_t yyscanner; + int location; + ErrorContextCallback errcallback; +} ScannerCallbackState; + + +/* Constant data exported from parser/scan.l */ +extern PGDLLIMPORT const uint16 ScanKeywordTokens[]; + +/* Entry points in parser/scan.l */ +extern core_yyscan_t scanner_init(const char *str, + core_yy_extra_type *yyext, + const ScanKeywordList *keywordlist, + const uint16 *keyword_tokens); +extern void scanner_finish(core_yyscan_t yyscanner); +extern int core_yylex(core_YYSTYPE *yylval_param, YYLTYPE *yylloc_param, + core_yyscan_t yyscanner); +extern int scanner_errposition(int location, core_yyscan_t yyscanner); +extern void setup_scanner_errposition_callback(ScannerCallbackState *scbstate, + core_yyscan_t yyscanner, + int location); +extern void cancel_scanner_errposition_callback(ScannerCallbackState *scbstate); +pg_noreturn extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner); + +#endif /* SCANNER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/scansup.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/scansup.h new file mode 100644 index 0000000..8f3a9f4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/parser/scansup.h @@ -0,0 +1,27 @@ +/*------------------------------------------------------------------------- + * + * scansup.h + * scanner support routines used by the core lexer + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/scansup.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SCANSUP_H +#define SCANSUP_H + +extern char *downcase_truncate_identifier(const char *ident, int len, + bool warn); + +extern char *downcase_identifier(const char *ident, int len, + bool warn, bool truncate); + +extern void truncate_identifier(char *ident, int len, bool warn); + +extern bool scanner_isspace(char ch); + +#endif /* SCANSUP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partbounds.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partbounds.h new file mode 100644 index 0000000..65f161f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partbounds.h @@ -0,0 +1,146 @@ +/*------------------------------------------------------------------------- + * + * partbounds.h + * + * Copyright (c) 2007-2025, PostgreSQL Global Development Group + * + * src/include/partitioning/partbounds.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTBOUNDS_H +#define PARTBOUNDS_H + +#include "fmgr.h" +#include "parser/parse_node.h" +#include "partitioning/partdefs.h" + +struct RelOptInfo; /* avoid including pathnodes.h here */ + + +/* + * PartitionBoundInfoData encapsulates a set of partition bounds. It is + * usually associated with partitioned tables as part of its partition + * descriptor, but may also be used to represent a virtual partitioned + * table such as a partitioned joinrel within the planner. + * + * A list partition datum that is known to be NULL is never put into the + * datums array. Instead, it is tracked using the null_index field. + * + * In the case of range partitioning, ndatums will typically be far less than + * 2 * nparts, because a partition's upper bound and the next partition's lower + * bound are the same in most common cases, and we only store one of them (the + * upper bound). In case of hash partitioning, ndatums will be the same as the + * number of partitions. + * + * For range and list partitioned tables, datums is an array of datum-tuples + * with key->partnatts datums each. For hash partitioned tables, it is an array + * of datum-tuples with 2 datums, modulus and remainder, corresponding to a + * given partition. + * + * The datums in datums array are arranged in increasing order as defined by + * functions qsort_partition_rbound_cmp(), qsort_partition_list_value_cmp() and + * qsort_partition_hbound_cmp() for range, list and hash partitioned tables + * respectively. For range and list partitions this simply means that the + * datums in the datums array are arranged in increasing order as defined by + * the partition key's operator classes and collations. + * + * In the case of list partitioning, the indexes array stores one entry for + * each datum-array entry, which is the index of the partition that accepts + * rows matching that datum. So nindexes == ndatums. + * + * In the case of range partitioning, the indexes array stores one entry per + * distinct range datum, which is the index of the partition for which that + * datum is an upper bound (or -1 for a "gap" that has no partition). It is + * convenient to have an extra -1 entry representing values above the last + * range datum, so nindexes == ndatums + 1. + * + * In the case of hash partitioning, the number of entries in the indexes + * array is the same as the greatest modulus amongst all partitions (which + * is a multiple of all partition moduli), so nindexes == greatest modulus. + * The indexes array is indexed according to the hash key's remainder modulo + * the greatest modulus, and it contains either the partition index accepting + * that remainder, or -1 if there is no partition for that remainder. + * + * For LIST partitioned tables, we track the partition indexes of partitions + * which are possibly "interleaved" partitions. A partition is considered + * interleaved if it allows multiple values and there exists at least one + * other partition which could contain a value that lies between those values. + * For example, if a partition exists FOR VALUES IN(3,5) and another partition + * exists FOR VALUES IN (4), then the IN(3,5) partition is an interleaved + * partition. The same is possible with DEFAULT partitions since they can + * contain any value that does not belong in another partition. This field + * only serves as proof that a particular partition is not interleaved, not + * proof that it is interleaved. When we're uncertain, we marked the + * partition as interleaved. The interleaved_parts field is only ever set for + * RELOPT_BASEREL and RELOPT_OTHER_MEMBER_REL, it is always left NULL for join + * relations. + */ +typedef struct PartitionBoundInfoData +{ + PartitionStrategy strategy; /* hash, list or range? */ + int ndatums; /* Length of the datums[] array */ + Datum **datums; + PartitionRangeDatumKind **kind; /* The kind of each range bound datum; + * NULL for hash and list partitioned + * tables */ + Bitmapset *interleaved_parts; /* Partition indexes of partitions which + * may be interleaved. See above. This is + * only set for LIST partitioned tables */ + int nindexes; /* Length of the indexes[] array */ + int *indexes; /* Partition indexes */ + int null_index; /* Index of the null-accepting partition; -1 + * if there isn't one */ + int default_index; /* Index of the default partition; -1 if there + * isn't one */ +} PartitionBoundInfoData; + +#define partition_bound_accepts_nulls(bi) ((bi)->null_index != -1) +#define partition_bound_has_default(bi) ((bi)->default_index != -1) + +extern int get_hash_partition_greatest_modulus(PartitionBoundInfo bound); +extern uint64 compute_partition_hash_value(int partnatts, FmgrInfo *partsupfunc, + const Oid *partcollation, + const Datum *values, const bool *isnull); +extern List *get_qual_from_partbound(Relation parent, + PartitionBoundSpec *spec); +extern PartitionBoundInfo partition_bounds_create(PartitionBoundSpec **boundspecs, + int nparts, PartitionKey key, int **mapping); +extern bool partition_bounds_equal(int partnatts, int16 *parttyplen, + bool *parttypbyval, PartitionBoundInfo b1, + PartitionBoundInfo b2); +extern PartitionBoundInfo partition_bounds_copy(PartitionBoundInfo src, + PartitionKey key); +extern PartitionBoundInfo partition_bounds_merge(int partnatts, + FmgrInfo *partsupfunc, + Oid *partcollation, + struct RelOptInfo *outer_rel, + struct RelOptInfo *inner_rel, + JoinType jointype, + List **outer_parts, + List **inner_parts); +extern bool partitions_are_ordered(PartitionBoundInfo boundinfo, + Bitmapset *live_parts); +extern void check_new_partition_bound(char *relname, Relation parent, + PartitionBoundSpec *spec, + ParseState *pstate); +extern void check_default_partition_contents(Relation parent, + Relation default_rel, + PartitionBoundSpec *new_spec); + +extern int32 partition_rbound_datum_cmp(FmgrInfo *partsupfunc, + Oid *partcollation, + Datum *rb_datums, PartitionRangeDatumKind *rb_kind, + Datum *tuple_datums, int n_tuple_datums); +extern int partition_list_bsearch(FmgrInfo *partsupfunc, + Oid *partcollation, + PartitionBoundInfo boundinfo, + Datum value, bool *is_equal); +extern int partition_range_datum_bsearch(FmgrInfo *partsupfunc, + Oid *partcollation, + PartitionBoundInfo boundinfo, + int nvalues, Datum *values, bool *is_equal); +extern int partition_hash_bsearch(PartitionBoundInfo boundinfo, + int modulus, int remainder); + +#endif /* PARTBOUNDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partdefs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partdefs.h new file mode 100644 index 0000000..6deb24f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partdefs.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * partdefs.h + * Base definitions for partitioned table handling + * + * Copyright (c) 2007-2025, PostgreSQL Global Development Group + * + * src/include/partitioning/partdefs.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTDEFS_H +#define PARTDEFS_H + + +typedef struct PartitionBoundInfoData *PartitionBoundInfo; + +typedef struct PartitionKeyData *PartitionKey; + +typedef struct PartitionBoundSpec PartitionBoundSpec; + +typedef struct PartitionDescData *PartitionDesc; + +typedef struct PartitionDirectoryData *PartitionDirectory; + +#endif /* PARTDEFS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partdesc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partdesc.h new file mode 100644 index 0000000..34533f7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partdesc.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * partdesc.h + * + * Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/partitioning/partdesc.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PARTDESC_H +#define PARTDESC_H + +#include "partitioning/partdefs.h" +#include "utils/relcache.h" + +/* + * Information about partitions of a partitioned table. + * + * For partitioned tables where detached partitions exist, we only cache + * descriptors that include all partitions, including detached; when we're + * requested a descriptor without the detached partitions, we create one + * afresh each time. (The reason for this is that the set of detached + * partitions that are visible to each caller depends on the snapshot it has, + * so it's pretty much impossible to evict a descriptor from cache at the + * right time.) + */ +typedef struct PartitionDescData +{ + int nparts; /* Number of partitions */ + bool detached_exist; /* Are there any detached partitions? */ + Oid *oids; /* Array of 'nparts' elements containing + * partition OIDs in order of their bounds */ + bool *is_leaf; /* Array of 'nparts' elements storing whether + * the corresponding 'oids' element belongs to + * a leaf partition or not */ + PartitionBoundInfo boundinfo; /* collection of partition bounds */ + + /* Caching fields to cache lookups in get_partition_for_tuple() */ + + /* + * Index into the PartitionBoundInfo's datum array for the last found + * partition or -1 if none. + */ + int last_found_datum_index; + + /* + * Partition index of the last found partition or -1 if none has been + * found yet. + */ + int last_found_part_index; + + /* + * For LIST partitioning, this is the number of times in a row that the + * datum we're looking for a partition for matches the datum in the + * last_found_datum_index index of the boundinfo->datums array. For RANGE + * partitioning, this is the number of times in a row we've found that the + * datum we're looking for a partition for falls into the range of the + * partition corresponding to the last_found_datum_index index of the + * boundinfo->datums array. + */ + int last_found_count; +} PartitionDescData; + + +extern PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached); + +extern PartitionDirectory CreatePartitionDirectory(MemoryContext mcxt, bool omit_detached); +extern PartitionDesc PartitionDirectoryLookup(PartitionDirectory, Relation); +extern void DestroyPartitionDirectory(PartitionDirectory pdir); + +extern Oid get_default_oid_from_partdesc(PartitionDesc partdesc); + +#endif /* PARTDESC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partprune.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partprune.h new file mode 100644 index 0000000..c413734 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/partitioning/partprune.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------------------- + * + * partprune.h + * prototypes for partprune.c + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/partitioning/partprune.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTPRUNE_H +#define PARTPRUNE_H + +#include "nodes/execnodes.h" +#include "partitioning/partdefs.h" + +struct PlannerInfo; /* avoid including pathnodes.h here */ +struct RelOptInfo; + + +/* + * PartitionPruneContext + * Stores information needed at runtime for pruning computations + * related to a single partitioned table. + * + * strategy Partition strategy, e.g. LIST, RANGE, HASH. + * partnatts Number of columns in the partition key. + * nparts Number of partitions in this partitioned table. + * boundinfo Partition boundary info for the partitioned table. + * partcollation Array of partnatts elements, storing the collations of the + * partition key columns. + * partsupfunc Array of FmgrInfos for the comparison or hashing functions + * associated with the partition keys (partnatts elements). + * (This points into the partrel's partition key, typically.) + * stepcmpfuncs Array of FmgrInfos for the comparison or hashing function + * for each pruning step and partition key. + * ppccontext Memory context holding this PartitionPruneContext's + * subsidiary data, such as the FmgrInfos. + * planstate Points to the parent plan node's PlanState when called + * during execution; NULL when called from the planner. + * exprcontext ExprContext to use when evaluating pruning expressions + * exprstates Array of ExprStates, indexed as per PruneCxtStateIdx; one + * for each partition key in each pruning step. Allocated if + * planstate is non-NULL, otherwise NULL. + */ +typedef struct PartitionPruneContext +{ + char strategy; + int partnatts; + int nparts; + PartitionBoundInfo boundinfo; + Oid *partcollation; + FmgrInfo *partsupfunc; + FmgrInfo *stepcmpfuncs; + MemoryContext ppccontext; + PlanState *planstate; + ExprContext *exprcontext; + ExprState **exprstates; +} PartitionPruneContext; + +/* + * PruneCxtStateIdx() computes the correct index into the stepcmpfuncs[] + * and exprstates[] arrays for step step_id and partition key column keyno. + * (Note: there is code that assumes the entries for a given step are + * sequential, so this is not chosen freely.) + */ +#define PruneCxtStateIdx(partnatts, step_id, keyno) \ + ((partnatts) * (step_id) + (keyno)) + +extern int make_partition_pruneinfo(struct PlannerInfo *root, + struct RelOptInfo *parentrel, + List *subpaths, + List *prunequal); +extern Bitmapset *prune_append_rel_partitions(struct RelOptInfo *rel); +extern Bitmapset *get_matching_partitions(PartitionPruneContext *context, + List *pruning_steps); + +#endif /* PARTPRUNE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_config.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_config.h new file mode 100644 index 0000000..f13cc7b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_config.h @@ -0,0 +1,348 @@ +/* + * Autogenerated by the Meson build system. + * Do not edit, your changes will be lost. + */ + +#pragma once + +#define ALIGNOF_DOUBLE 8 + +#define ALIGNOF_INT 4 + +#define ALIGNOF_LONG 4 + +#define ALIGNOF_SHORT 2 + +/* Size of a disk block --- this also limits the size of a tuple. You can set + it bigger if you need bigger tuples (although TOAST should reduce the need + to have large tuples, since fields can be spread across multiple tuples). + BLCKSZ must be a power of 2. The maximum possible value of BLCKSZ is + currently 2^15 (32768). This is determined by the 15-bit widths of the + lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h). + Changing BLCKSZ requires an initdb. */ +#define BLCKSZ 8192 + +#define CONFIGURE_ARGS "" + +#define DEF_PGPORT 5432 + +#define DEF_PGPORT_STR "5432" + +#define DLSUFFIX ".dll" + +/* Define to 1 if you have the header file. */ +#undef HAVE_ATOMIC_H + +/* Define to 1 if you have the `backtrace_symbols' function. */ +#undef HAVE_BACKTRACE_SYMBOLS + +/* Define to 1 if you have the `copyfile' function. */ +#undef HAVE_COPYFILE + +/* Define to 1 if you have the header file. */ +#undef HAVE_COPYFILE_H + +/* Define to 1 if you have the `copy_file_range' function. */ +#undef HAVE_COPY_FILE_RANGE + +/* Define to 1 if you have the header file. */ +#define HAVE_CRTDEFS_H 1 + +/* Define to 1 if you have the declaration of `fdatasync', and to 0 if you + don't. */ +#define HAVE_DECL_FDATASYNC 0 + +/* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you + don't. */ +#define HAVE_DECL_F_FULLFSYNC 0 + +/* Define to 1 if you have the declaration of `memset_s', and to 0 if you + don't. */ +#define HAVE_DECL_MEMSET_S 0 + +/* Define to 1 if you have the declaration of `posix_fadvise', and to 0 if you + don't. */ +#define HAVE_DECL_POSIX_FADVISE 0 + +/* Define to 1 if you have the declaration of `preadv', and to 0 if you + don't. */ +#define HAVE_DECL_PREADV 0 + +/* Define to 1 if you have the declaration of `pwritev', and to 0 if you + don't. */ +#define HAVE_DECL_PWRITEV 0 + +/* Define to 1 if you have the declaration of `strchrnul', and to 0 if you + don't. */ +#define HAVE_DECL_STRCHRNUL 0 + +/* Define to 1 if you have the declaration of `strlcat', and to 0 if you + don't. */ +#define HAVE_DECL_STRLCAT 0 + +/* Define to 1 if you have the declaration of `strlcpy', and to 0 if you + don't. */ +#define HAVE_DECL_STRLCPY 0 + +/* Define to 1 if you have the declaration of `strnlen', and to 0 if you + don't. */ +#define HAVE_DECL_STRNLEN 1 + +/* Define to 1 if you have the declaration of `strsep', and to 0 if you + don't. */ +#define HAVE_DECL_STRSEP 0 + +/* Define to 1 if you have the declaration of `timingsafe_bcmp', and to 0 if you + don't. */ +#define HAVE_DECL_TIMINGSAFE_BCMP 0 + +/* Define to 1 if you have the `elf_aux_info' function. */ +#undef HAVE_ELF_AUX_INFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_EXECINFO_H + +/* Define to 1 if you have the `explicit_bzero' function. */ +#undef HAVE_EXPLICIT_BZERO + +#undef HAVE_GCC__ATOMIC_INT32_CAS + +#undef HAVE_GCC__ATOMIC_INT64_CAS + +#undef HAVE_GCC__SYNC_CHAR_TAS + +#undef HAVE_GCC__SYNC_INT32_CAS + +#undef HAVE_GCC__SYNC_INT32_TAS + +#undef HAVE_GCC__SYNC_INT64_CAS + +/* Define to 1 if you have the `getauxval' function. */ +#undef HAVE_GETAUXVAL + +/* Define to 1 if you have the `getifaddrs' function. */ +#undef HAVE_GETIFADDRS + +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `getpeereid' function. */ +#undef HAVE_GETPEEREID + +/* Define to 1 if you have the `getpeerucred' function. */ +#undef HAVE_GETPEERUCRED + +/* Define to 1 if you have the header file. */ +#undef HAVE_IFADDRS_H + +/* Define to 1 if you have the `inet_aton' function. */ +#undef HAVE_INET_ATON + +/* Define to 1 if you have the `inet_pton' function. */ +#undef HAVE_INET_PTON + +#undef HAVE_INT_OPTERR + +#undef HAVE_INT_OPTRESET + +#undef HAVE_INT_TIMEZONE + +/* Define to 1 if you have the `kqueue' function. */ +#undef HAVE_KQUEUE + +#define HAVE_LIBLZ4 1 + +#undef HAVE_LIBSELINUX + +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the `localeconv_l' function. */ +#undef HAVE_LOCALECONV_L + +/* Define to 1 if you have the header file. */ +#undef HAVE_MBARRIER_H + +/* Define to 1 if you have the `mbstowcs_l' function. */ +#undef HAVE_MBSTOWCS_L + +/* Define to 1 if you have the `mkdtemp' function. */ +#undef HAVE_MKDTEMP + +/* Define to 1 if you have the `posix_fadvise' function. */ +#undef HAVE_POSIX_FADVISE + +/* Define to 1 if you have the `posix_fallocate' function. */ +#undef HAVE_POSIX_FALLOCATE + +/* Define to 1 if you have the `ppoll' function. */ +#undef HAVE_PPOLL + +/* Define to 1 if you have the `pthread_barrier_wait' function. */ +#undef HAVE_PTHREAD_BARRIER_WAIT + +/* Define to 1 if you have the `pthread_is_threaded_np' function. */ +#undef HAVE_PTHREAD_IS_THREADED_NP + +/* Define to 1 if you have the `setproctitle' function. */ +#undef HAVE_SETPROCTITLE + +/* Define to 1 if you have the `setproctitle_fast' function. */ +#undef HAVE_SETPROCTITLE_FAST + +#define HAVE_SOCKLEN_T 1 + +#define HAVE_SSL_CTX_SET_CERT_CB 1 + +#define HAVE_SSL_CTX_SET_KEYLOG_CALLBACK 1 + +#define HAVE_SSL_CTX_SET_NUM_TICKETS 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + +/* Define to 1 if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define to 1 if you have the `strnlen' function. */ +#define HAVE_STRNLEN 1 + +/* Define to 1 if you have the `strsep' function. */ +#undef HAVE_STRSEP + +/* Define to 1 if you have the `strsignal' function. */ +#undef HAVE_STRSIGNAL + +/* Define to 1 if you have the `syncfs' function. */ +#undef HAVE_SYNCFS + +/* Define to 1 if you have the `sync_file_range' function. */ +#undef HAVE_SYNC_FILE_RANGE + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PERSONALITY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PRCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PROCCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UCRED_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the `timingsafe_bcmp' function. */ +#undef HAVE_TIMINGSAFE_BCMP + +#define HAVE_TYPEOF 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_UCRED_H + +/* Define to 1 if you have the `uselocale' function. */ +#undef HAVE_USELOCALE + +/* Define to 1 if you have the `wcstombs_l' function. */ +#undef HAVE_WCSTOMBS_L + +#define HAVE_X509_GET_SIGNATURE_INFO 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_XLOCALE_H + +#define HAVE_XSAVE_INTRINSICS 1 + +#define HAVE__CPUID 1 + +#define HAVE__CPUIDEX 1 + +#define MAXIMUM_ALIGNOF 8 + +#define MEMSET_LOOP_LIMIT 1024 + +/* Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions. */ +#define OPENSSL_API_COMPAT 0x10101000L + +#define PACKAGE_BUGREPORT "pgsql-bugs@lists.postgresql.org" + +#define PACKAGE_NAME "PostgreSQL" + +#define PACKAGE_STRING "PostgreSQL 18.3" + +#define PACKAGE_TARNAME "postgresql" + +#define PACKAGE_URL "https://www.postgresql.org/" + +#define PACKAGE_VERSION "18.3" + +#define PG_KRB_SRVNAM "postgres" + +#define PG_MAJORVERSION "18" + +#define PG_MAJORVERSION_NUM 18 + +#define PG_MINORVERSION_NUM 3 + +#define PG_VERSION "18.3" + +#define PG_VERSION_NUM 180003 + +#define PG_VERSION_STR "PostgreSQL 18.3 on x86_64-windows, compiled by msvc-19.50.35730, 64-bit" + +#define RELSEG_SIZE 131072 + +#define SIZEOF_LONG 4 + +#define SIZEOF_LONG_LONG 8 + +#define SIZEOF_SIZE_T 8 + +#define SIZEOF_VOID_P 8 + +#define STRERROR_R_INT 1 + +#undef USE_ASSERT_CHECKING + +#define USE_AVX512_POPCNT_WITH_RUNTIME_CHECK 1 + +#undef USE_INJECTION_POINTS + +#define USE_LZ4 1 + +/* Define to 1 to build with OpenSSL support. (-Dssl=openssl) */ +#define USE_OPENSSL 1 + +#undef USE_SSE42_CRC32C + +#define USE_SSE42_CRC32C_WITH_RUNTIME_CHECK 1 + +#undef USE_SYSTEMD + +#define USE_WIN32_SEMAPHORES 1 + +#define USE_WIN32_SHARED_MEMORY 1 + +#define WIN32_STACK_RLIMIT 4194304 + +#define XLOG_BLCKSZ 8192 + +#define pg_restrict __restrict + +#define typeof __typeof__ + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_config_manual.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_config_manual.h new file mode 100644 index 0000000..125d3eb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_config_manual.h @@ -0,0 +1,363 @@ +/*------------------------------------------------------------------------ + * PostgreSQL manual configuration settings + * + * This file contains various configuration symbols and limits. In + * all cases, changing them is only useful in very rare situations or + * for developers. If you edit any of these, be sure to do a *full* + * rebuild (and an initdb if noted). + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/pg_config_manual.h + *------------------------------------------------------------------------ + */ + +/* + * This is the default value for wal_segment_size to be used when initdb is run + * without the --wal-segsize option. It must be a valid segment size. + */ +#define DEFAULT_XLOG_SEG_SIZE (16*1024*1024) + +/* + * Maximum length for identifiers (e.g. table names, column names, + * function names). Names actually are limited to one fewer byte than this, + * because the length must include a trailing zero byte. + * + * Changing this requires an initdb. + */ +#define NAMEDATALEN 64 + +/* + * Maximum number of arguments to a function. + * + * The minimum value is 8 (GIN indexes use 8-argument support functions). + * The maximum possible value is around 600 (limited by index tuple size in + * pg_proc's index; BLCKSZ larger than 8K would allow more). Values larger + * than needed will waste memory and processing time, but do not directly + * cost disk space. + * + * Changing this does not require an initdb, but it does require a full + * backend recompile (including any user-defined C functions). + */ +#define FUNC_MAX_ARGS 100 + +/* + * When creating a product derived from PostgreSQL with changes that cause + * incompatibilities for loadable modules, it is recommended to change this + * string so that dfmgr.c can refuse to load incompatible modules with a clean + * error message. Typical examples that cause incompatibilities are any + * changes to node tags or node structures. (Note that dfmgr.c already + * detects common sources of incompatibilities due to major version + * differences and due to some changed compile-time constants. This setting + * is for catching anything that cannot be detected in a straightforward way.) + * + * There is no prescribed format for the string. The suggestion is to include + * product or company name, and optionally any internally-relevant ABI + * version. Example: "ACME Postgres/1.2". Note that the string will appear + * in a user-facing error message if an ABI mismatch is detected. + */ +#define FMGR_ABI_EXTRA "PostgreSQL" + +/* + * Maximum number of columns in an index. There is little point in making + * this anything but a multiple of 32, because the main cost is associated + * with index tuple header size (see access/itup.h). + * + * Changing this requires an initdb. + */ +#define INDEX_MAX_KEYS 32 + +/* + * Maximum number of columns in a partition key + */ +#define PARTITION_MAX_KEYS 32 + +/* + * Decide whether built-in 8-byte types, including float8, int8, and + * timestamp, are passed by value. This is on by default if sizeof(Datum) >= + * 8 (that is, on 64-bit platforms). If sizeof(Datum) < 8 (32-bit platforms), + * this must be off. We keep this here as an option so that it is easy to + * test the pass-by-reference code paths on 64-bit platforms. + * + * Changing this requires an initdb. + */ +#if SIZEOF_VOID_P >= 8 +#define USE_FLOAT8_BYVAL 1 +#endif + + +/* + * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence, + * maximum usable pathname length is one less). + * + * We'd use a standard system header symbol for this, if there weren't + * so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all + * defined by different "standards", and often have different values + * on the same platform! So we just punt and use a reasonably + * generous setting here. + */ +#define MAXPGPATH 1024 + +/* + * You can try changing this if you have a machine with bytes of + * another size, but no guarantee... + */ +#define BITS_PER_BYTE 8 + +/* + * Preferred alignment for disk I/O buffers. On some CPUs, copies between + * user space and kernel space are significantly faster if the user buffer + * is aligned on a larger-than-MAXALIGN boundary. Ideally this should be + * a platform-dependent value, but for now we just hard-wire it. + */ +#define ALIGNOF_BUFFER 32 + +/* + * If EXEC_BACKEND is defined, the postmaster uses an alternative method for + * starting subprocesses: Instead of simply using fork(), as is standard on + * Unix platforms, it uses fork()+exec() or something equivalent on Windows, + * as well as lots of extra code to bring the required global state to those + * new processes. This must be enabled on Windows (because there is no + * fork()). On other platforms, it's only useful for verifying those + * otherwise Windows-specific code paths. + */ +#if defined(WIN32) && !defined(__CYGWIN__) +#define EXEC_BACKEND +#endif + +/* + * USE_POSIX_FADVISE controls whether Postgres will attempt to use the + * posix_fadvise() kernel call. Usually the automatic configure tests are + * sufficient, but some older Linux distributions had broken versions of + * posix_fadvise(). If necessary you can remove the #define here. + */ +#if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE) +#define USE_POSIX_FADVISE +#endif + +/* + * USE_PREFETCH code should be compiled only if we have a way to implement + * prefetching. (This is decoupled from USE_POSIX_FADVISE because there + * might in future be support for alternative low-level prefetch APIs, + * as well as platform-specific APIs defined elsewhere.) + */ +#ifdef USE_POSIX_FADVISE +#define USE_PREFETCH +#endif + +/* + * Default and maximum values for backend_flush_after, bgwriter_flush_after + * and checkpoint_flush_after; measured in blocks. Currently, these are + * enabled by default if sync_file_range() exists, ie, only on Linux. Perhaps + * we could also enable by default if we have mmap and msync(MS_ASYNC)? + */ +#ifdef HAVE_SYNC_FILE_RANGE +#define DEFAULT_BACKEND_FLUSH_AFTER 0 /* never enabled by default */ +#define DEFAULT_BGWRITER_FLUSH_AFTER 64 +#define DEFAULT_CHECKPOINT_FLUSH_AFTER 32 +#else +#define DEFAULT_BACKEND_FLUSH_AFTER 0 +#define DEFAULT_BGWRITER_FLUSH_AFTER 0 +#define DEFAULT_CHECKPOINT_FLUSH_AFTER 0 +#endif +/* upper limit for all three variables */ +#define WRITEBACK_MAX_PENDING_FLUSHES 256 + +/* + * USE_SSL code should be compiled only when compiling with an SSL + * implementation. + */ +#ifdef USE_OPENSSL +#define USE_SSL +#endif + +/* + * This is the default directory in which AF_UNIX socket files are + * placed. Caution: changing this risks breaking your existing client + * applications, which are likely to continue to look in the old + * directory. But if you just hate the idea of sockets in /tmp, + * here's where to twiddle it. You can also override this at runtime + * with the postmaster's -k switch. + * + * If set to an empty string, then AF_UNIX sockets are not used by default: A + * server will not create an AF_UNIX socket unless the run-time configuration + * is changed, a client will connect via TCP/IP by default and will only use + * an AF_UNIX socket if one is explicitly specified. + * + * This is done by default on Windows because there is no good standard + * location for AF_UNIX sockets and many installations on Windows don't + * support them yet. + */ +#ifndef WIN32 +#define DEFAULT_PGSOCKET_DIR "/tmp" +#else +#define DEFAULT_PGSOCKET_DIR "" +#endif + +/* + * This is the default event source for Windows event log. + */ +#define DEFAULT_EVENT_SOURCE "PostgreSQL" + +/* + * Assumed cache line size. This doesn't affect correctness, but can be used + * for low-level optimizations. This is mostly used to pad various data + * structures, to ensure that highly-contended fields are on different cache + * lines. Too small a value can hurt performance due to false sharing, while + * the only downside of too large a value is a few bytes of wasted memory. + * The default is 128, which should be large enough for all supported + * platforms. + */ +#define PG_CACHE_LINE_SIZE 128 + +/* + * Assumed alignment requirement for direct I/O. 4K corresponds to common + * sector and memory page size. + */ +#define PG_IO_ALIGN_SIZE 4096 + +/* + *------------------------------------------------------------------------ + * The following symbols are for enabling debugging code, not for + * controlling user-visible features or resource limits. + *------------------------------------------------------------------------ + */ + +/* + * Force use of the non-recursive JSON parser in all cases. This is useful + * to validate the working of the parser, and the regression tests should + * pass except for some different error messages about the stack limit. + */ +/* #define FORCE_JSON_PSTACK */ + +/* + * Include Valgrind "client requests", mostly in the memory allocator, so + * Valgrind understands PostgreSQL memory contexts. This permits detecting + * memory errors that Valgrind would not detect on a vanilla build. It also + * enables detection of buffer accesses that take place without holding a + * buffer pin (or without holding a buffer lock in the case of index access + * methods that superimpose their own custom client requests on top of the + * generic bufmgr.c requests). + * + * "make installcheck" is significantly slower under Valgrind. The client + * requests fall in hot code paths, so USE_VALGRIND slows execution by a few + * percentage points even when not run under Valgrind. + * + * Do not try to test the server under Valgrind without having built the + * server with USE_VALGRIND; else you will get false positives from sinval + * messaging (see comments in AddCatcacheInvalidationMessage). It's also + * important to use the suppression file src/tools/valgrind.supp to + * exclude other known false positives. + * + * You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND; + * instrumentation of repalloc() is inferior without it. + */ +/* #define USE_VALGRIND */ + +/* + * Define this to cause pfree()'d memory to be cleared immediately, to + * facilitate catching bugs that refer to already-freed values. + * Right now, this gets defined automatically if --enable-cassert. + */ +#ifdef USE_ASSERT_CHECKING +#define CLOBBER_FREED_MEMORY +#endif + +/* + * Define this to check memory allocation errors (scribbling on more + * bytes than were allocated). Right now, this gets defined + * automatically if --enable-cassert or USE_VALGRIND. + */ +#if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND) +#define MEMORY_CONTEXT_CHECKING +#endif + +/* + * Define this to cause palloc()'d memory to be filled with random data, to + * facilitate catching code that depends on the contents of uninitialized + * memory. Caution: this is horrendously expensive. + */ +/* #define RANDOMIZE_ALLOCATED_MEMORY */ + +/* + * For cache-invalidation debugging, define DISCARD_CACHES_ENABLED to enable + * use of the debug_discard_caches GUC to aggressively flush + * syscache/relcache/relsynccache entries whenever it's possible to deliver + * invalidations. See AcceptInvalidationMessages() in + * src/backend/utils/cache/inval.c for details. + * + * USE_ASSERT_CHECKING builds default to enabling this. It's possible to use + * DISCARD_CACHES_ENABLED without a cassert build and the implied + * CLOBBER_FREED_MEMORY and MEMORY_CONTEXT_CHECKING options, but it's unlikely + * to be as effective at identifying problems. + */ +/* #define DISCARD_CACHES_ENABLED */ + +#if defined(USE_ASSERT_CHECKING) && !defined(DISCARD_CACHES_ENABLED) +#define DISCARD_CACHES_ENABLED +#endif + +/* + * Backwards compatibility for the older compile-time-only clobber-cache + * macros. + */ +#if !defined(DISCARD_CACHES_ENABLED) && (defined(CLOBBER_CACHE_ALWAYS) || defined(CLOBBER_CACHE_RECURSIVELY)) +#define DISCARD_CACHES_ENABLED +#endif + +/* + * Recover memory used for relcache entries when invalidated. See + * RelationBuildDesc() in src/backend/utils/cache/relcache.c. + * + * This is active automatically for clobber-cache builds when clobbering is + * active, but can be overridden here by explicitly defining + * RECOVER_RELATION_BUILD_MEMORY. Define to 1 to always free relation cache + * memory even when clobber is off, or to 0 to never free relation cache + * memory even when clobbering is on. + */ + /* #define RECOVER_RELATION_BUILD_MEMORY 0 */ /* Force disable */ + /* #define RECOVER_RELATION_BUILD_MEMORY 1 */ /* Force enable */ + +/* + * Define DEBUG_NODE_TESTS_ENABLED to enable use of the GUCs + * debug_copy_parse_plan_trees, debug_write_read_parse_plan_trees, and + * debug_raw_expression_coverage_test, to test coverage of node support + * functions in src/backend/nodes/. + * + * USE_ASSERT_CHECKING builds default to enabling this. + */ +/* #define DEBUG_NODE_TESTS_ENABLED */ + +#if defined(USE_ASSERT_CHECKING) && !defined(DEBUG_NODE_TESTS_ENABLED) +#define DEBUG_NODE_TESTS_ENABLED +#endif + +/* + * Backwards compatibility for the older compile-time-only node-tests macros. + */ +#if !defined(DEBUG_NODE_TESTS_ENABLED) && (defined(COPY_PARSE_PLAN_TREES) || defined(WRITE_READ_PARSE_PLAN_TREES) || defined(RAW_EXPRESSION_COVERAGE_TEST)) +#define DEBUG_NODE_TESTS_ENABLED +#endif + +/* + * Define this to force Bitmapset reallocation on each modification. Helps + * to find dangling pointers to Bitmapset's. + */ +/* #define REALLOCATE_BITMAPSETS */ + +/* + * Enable debugging print statements for lock-related operations. + */ +/* #define LOCK_DEBUG */ + +/* + * Enable debugging print statements for WAL-related operations; see + * also the wal_debug GUC var. + */ +/* #define WAL_DEBUG */ + +/* + * Enable tracing of syncscan operations (see also the trace_syncscan GUC var). + */ +/* #define TRACE_SYNCSCAN */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_config_os.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_config_os.h new file mode 100644 index 0000000..d6c13d0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_config_os.h @@ -0,0 +1,59 @@ +/* src/include/port/win32.h */ + +/* + * We always rely on the WIN32 macro being set by our build system, + * but _WIN32 is the compiler pre-defined macro. So make sure we define + * WIN32 whenever _WIN32 is set, to facilitate standalone building. + */ +#if defined(_WIN32) && !defined(WIN32) +#define WIN32 +#endif + +/* + * Make sure _WIN32_WINNT has the minimum required value. + * Leave a higher value in place. The minimum requirement is Windows 10. + */ +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#endif + +#define _WIN32_WINNT 0x0A00 + +/* + * We need to prevent from defining a symbol conflicting with + * our errcode() function. Since it's likely to get included by standard + * system headers, pre-emptively include it now. + */ +#if defined(_MSC_VER) || defined(HAVE_CRTDEFS_H) +#define errcode __msvc_errcode +#include +#undef errcode +#endif + +/* + * defines for dynamic linking on Win32 platform + */ + +/* + * Variables declared in the core backend and referenced by loadable + * modules need to be marked "dllimport" in the core build, but + * "dllexport" when the declaration is read in a loadable module. + * No special markings should be used when compiling frontend code. + */ +#ifndef FRONTEND +#ifdef BUILDING_DLL +#define PGDLLIMPORT __declspec (dllexport) +#else +#define PGDLLIMPORT __declspec (dllimport) +#endif +#endif + +/* + * Functions exported by a loadable module must be marked "dllexport". + * + * While mingw would otherwise fall back to + * __attribute__((visibility("default"))), that appears to only work as long + * as no symbols are declared with __declspec(dllexport). But we can end up + * with some, e.g. plpython's Py_Init. + */ +#define PGDLLEXPORT __declspec (dllexport) diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_getopt.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_getopt.h new file mode 100644 index 0000000..aad0886 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_getopt.h @@ -0,0 +1,57 @@ +/* + * Postgres files that use getopt(3) always include this file. + * We must cope with three different scenarios: + * 1. We're using the platform's getopt(), and we should just import the + * appropriate declarations. + * 2. The platform lacks getopt(), and we must declare everything. + * 3. The platform has getopt(), but we're not using it because we don't + * like its behavior. The declarations we make here must be compatible + * with both the platform's getopt() and our src/port/getopt.c. + * + * Portions Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Portions Copyright (c) 2003-2025, PostgreSQL Global Development Group + * + * src/include/pg_getopt.h + */ +/* IWYU pragma: always_keep */ +#ifndef PG_GETOPT_H +#define PG_GETOPT_H + +/* POSIX says getopt() is provided by unistd.h */ +#include /* IWYU pragma: export */ + +/* rely on the system's getopt.h if present */ +#ifdef HAVE_GETOPT_H +#include /* IWYU pragma: export */ +#endif + +/* + * If we have , assume it declares these variables, else do that + * ourselves. (We used to just declare them unconditionally, but Cygwin + * doesn't like that.) + */ +#ifndef HAVE_GETOPT_H + +extern PGDLLIMPORT char *optarg; +extern PGDLLIMPORT int optind; +extern PGDLLIMPORT int opterr; +extern PGDLLIMPORT int optopt; + +#endif /* HAVE_GETOPT_H */ + +/* + * Some platforms have optreset but fail to declare it in , so cope. + * Cygwin, however, doesn't like this either. + */ +#if defined(HAVE_INT_OPTRESET) && !defined(__CYGWIN__) +extern PGDLLIMPORT int optreset; +#endif + +/* Provide getopt() declaration if the platform doesn't have it */ +#ifndef HAVE_GETOPT +extern int getopt(int nargc, char *const *nargv, const char *ostr); +#endif + +#endif /* PG_GETOPT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_trace.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_trace.h new file mode 100644 index 0000000..c82f347 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/pg_trace.h @@ -0,0 +1,17 @@ +/* ---------- + * pg_trace.h + * + * Definitions for the PostgreSQL tracing framework + * + * Copyright (c) 2006-2025, PostgreSQL Global Development Group + * + * src/include/pg_trace.h + * ---------- + */ + +#ifndef PG_TRACE_H +#define PG_TRACE_H + +#include "utils/probes.h" /* IWYU pragma: export */ + +#endif /* PG_TRACE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/pgstat.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/pgstat.h new file mode 100644 index 0000000..3a302c2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/pgstat.h @@ -0,0 +1,842 @@ +/* ---------- + * pgstat.h + * + * Definitions for the PostgreSQL cumulative statistics system. + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/pgstat.h + * ---------- + */ +#ifndef PGSTAT_H +#define PGSTAT_H + +#include "access/transam.h" /* for FullTransactionId */ +#include "datatype/timestamp.h" +#include "portability/instr_time.h" +#include "postmaster/pgarch.h" /* for MAX_XFN_CHARS */ +#include "replication/conflict.h" +#include "utils/backend_progress.h" /* for backward compatibility */ /* IWYU pragma: export */ +#include "utils/backend_status.h" /* for backward compatibility */ /* IWYU pragma: export */ +#include "utils/pgstat_kind.h" +#include "utils/relcache.h" +#include "utils/wait_event.h" /* for backward compatibility */ /* IWYU pragma: export */ + + +/* ---------- + * Paths for the statistics files (relative to installation's $PGDATA). + * ---------- + */ +#define PGSTAT_STAT_PERMANENT_DIRECTORY "pg_stat" +#define PGSTAT_STAT_PERMANENT_FILENAME "pg_stat/pgstat.stat" +#define PGSTAT_STAT_PERMANENT_TMPFILE "pg_stat/pgstat.tmp" + +/* Default directory to store temporary statistics data in */ +#define PG_STAT_TMP_DIR "pg_stat_tmp" + +/* Values for track_functions GUC variable --- order is significant! */ +typedef enum TrackFunctionsLevel +{ + TRACK_FUNC_OFF, + TRACK_FUNC_PL, + TRACK_FUNC_ALL, +} TrackFunctionsLevel; + +typedef enum PgStat_FetchConsistency +{ + PGSTAT_FETCH_CONSISTENCY_NONE, + PGSTAT_FETCH_CONSISTENCY_CACHE, + PGSTAT_FETCH_CONSISTENCY_SNAPSHOT, +} PgStat_FetchConsistency; + +/* Values to track the cause of session termination */ +typedef enum SessionEndType +{ + DISCONNECT_NOT_YET, /* still active */ + DISCONNECT_NORMAL, + DISCONNECT_CLIENT_EOF, + DISCONNECT_FATAL, + DISCONNECT_KILLED, +} SessionEndType; + +/* ---------- + * The data type used for counters. + * ---------- + */ +typedef int64 PgStat_Counter; + + +/* ------------------------------------------------------------ + * Structures kept in backend local memory while accumulating counts + * ------------------------------------------------------------ + */ + +/* ---------- + * PgStat_FunctionCounts The actual per-function counts kept by a backend + * + * Note that the time counters are in instr_time format here. We convert to + * microseconds in PgStat_Counter format when flushing out pending statistics. + * ---------- + */ +typedef struct PgStat_FunctionCounts +{ + PgStat_Counter numcalls; + instr_time total_time; + instr_time self_time; +} PgStat_FunctionCounts; + +/* + * Working state needed to accumulate per-function-call timing statistics. + */ +typedef struct PgStat_FunctionCallUsage +{ + /* Link to function's hashtable entry (must still be there at exit!) */ + /* NULL means we are not tracking the current function call */ + PgStat_FunctionCounts *fs; + /* Total time previously charged to function, as of function start */ + instr_time save_f_total_time; + /* Backend-wide total time as of function start */ + instr_time save_total; + /* system clock as of function start */ + instr_time start; +} PgStat_FunctionCallUsage; + +/* ---------- + * PgStat_BackendSubEntry Non-flushed subscription stats. + * ---------- + */ +typedef struct PgStat_BackendSubEntry +{ + PgStat_Counter apply_error_count; + PgStat_Counter sync_error_count; + PgStat_Counter conflict_count[CONFLICT_NUM_TYPES]; +} PgStat_BackendSubEntry; + +/* ---------- + * PgStat_TableCounts The actual per-table counts kept by a backend + * + * This struct should contain only actual event counters, because we make use + * of pg_memory_is_all_zeros() to detect whether there are any stats updates + * to apply. + * + * It is a component of PgStat_TableStatus (within-backend state). + * + * Note: for a table, tuples_returned is the number of tuples successfully + * fetched by heap_getnext, while tuples_fetched is the number of tuples + * successfully fetched by heap_fetch under the control of bitmap indexscans. + * For an index, tuples_returned is the number of index entries returned by + * the index AM, while tuples_fetched is the number of tuples successfully + * fetched by heap_fetch under the control of simple indexscans for this index. + * + * tuples_inserted/updated/deleted/hot_updated/newpage_updated count attempted + * actions, regardless of whether the transaction committed. delta_live_tuples, + * delta_dead_tuples, and changed_tuples are set depending on commit or abort. + * Note that delta_live_tuples and delta_dead_tuples can be negative! + * ---------- + */ +typedef struct PgStat_TableCounts +{ + PgStat_Counter numscans; + + PgStat_Counter tuples_returned; + PgStat_Counter tuples_fetched; + + PgStat_Counter tuples_inserted; + PgStat_Counter tuples_updated; + PgStat_Counter tuples_deleted; + PgStat_Counter tuples_hot_updated; + PgStat_Counter tuples_newpage_updated; + bool truncdropped; + + PgStat_Counter delta_live_tuples; + PgStat_Counter delta_dead_tuples; + PgStat_Counter changed_tuples; + + PgStat_Counter blocks_fetched; + PgStat_Counter blocks_hit; +} PgStat_TableCounts; + +/* ---------- + * PgStat_TableStatus Per-table status within a backend + * + * Many of the event counters are nontransactional, ie, we count events + * in committed and aborted transactions alike. For these, we just count + * directly in the PgStat_TableStatus. However, delta_live_tuples, + * delta_dead_tuples, and changed_tuples must be derived from event counts + * with awareness of whether the transaction or subtransaction committed or + * aborted. Hence, we also keep a stack of per-(sub)transaction status + * records for every table modified in the current transaction. At commit + * or abort, we propagate tuples_inserted/updated/deleted up to the + * parent subtransaction level, or out to the parent PgStat_TableStatus, + * as appropriate. + * ---------- + */ +typedef struct PgStat_TableStatus +{ + Oid id; /* table's OID */ + bool shared; /* is it a shared catalog? */ + struct PgStat_TableXactStatus *trans; /* lowest subxact's counts */ + PgStat_TableCounts counts; /* event counts to be sent */ + Relation relation; /* rel that is using this entry */ +} PgStat_TableStatus; + +/* ---------- + * PgStat_TableXactStatus Per-table, per-subtransaction status + * ---------- + */ +typedef struct PgStat_TableXactStatus +{ + PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */ + PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */ + PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */ + bool truncdropped; /* relation truncated/dropped in this + * (sub)xact */ + /* tuples i/u/d prior to truncate/drop */ + PgStat_Counter inserted_pre_truncdrop; + PgStat_Counter updated_pre_truncdrop; + PgStat_Counter deleted_pre_truncdrop; + int nest_level; /* subtransaction nest level */ + /* links to other structs for same relation: */ + struct PgStat_TableXactStatus *upper; /* next higher subxact if any */ + PgStat_TableStatus *parent; /* per-table status */ + /* structs of same subxact level are linked here: */ + struct PgStat_TableXactStatus *next; /* next of same subxact */ +} PgStat_TableXactStatus; + + +/* ------------------------------------------------------------ + * Data structures on disk and in shared memory follow + * + * PGSTAT_FILE_FORMAT_ID should be changed whenever any of these + * data structures change. + * ------------------------------------------------------------ + */ + +#define PGSTAT_FILE_FORMAT_ID 0x01A5BCB7 + +typedef struct PgStat_ArchiverStats +{ + PgStat_Counter archived_count; /* archival successes */ + char last_archived_wal[MAX_XFN_CHARS + 1]; /* last WAL file + * archived */ + TimestampTz last_archived_timestamp; /* last archival success time */ + PgStat_Counter failed_count; /* failed archival attempts */ + char last_failed_wal[MAX_XFN_CHARS + 1]; /* WAL file involved in + * last failure */ + TimestampTz last_failed_timestamp; /* last archival failure time */ + TimestampTz stat_reset_timestamp; +} PgStat_ArchiverStats; + +/* --------- + * PgStat_BgWriterStats Background Writer statistics + * + * This struct should contain only actual event counters, because we make use + * of pg_memory_is_all_zeros() to detect whether there are any stats updates + * to apply. + * --------- + */ +typedef struct PgStat_BgWriterStats +{ + PgStat_Counter buf_written_clean; + PgStat_Counter maxwritten_clean; + PgStat_Counter buf_alloc; + TimestampTz stat_reset_timestamp; +} PgStat_BgWriterStats; + +/* -------- + * PgStat_CheckpointerStats Checkpoint statistics + * + * This struct should contain only actual event counters, because we make use + * of pg_memory_is_all_zeros() to detect whether there are any stats updates to + * apply. + * --------- + */ +typedef struct PgStat_CheckpointerStats +{ + PgStat_Counter num_timed; + PgStat_Counter num_requested; + PgStat_Counter num_performed; + PgStat_Counter restartpoints_timed; + PgStat_Counter restartpoints_requested; + PgStat_Counter restartpoints_performed; + PgStat_Counter write_time; /* times in milliseconds */ + PgStat_Counter sync_time; + PgStat_Counter buffers_written; + PgStat_Counter slru_written; + TimestampTz stat_reset_timestamp; +} PgStat_CheckpointerStats; + + +/* + * Types related to counting IO operations + */ +typedef enum IOObject +{ + IOOBJECT_RELATION, + IOOBJECT_TEMP_RELATION, + IOOBJECT_WAL, +} IOObject; + +#define IOOBJECT_NUM_TYPES (IOOBJECT_WAL + 1) + +typedef enum IOContext +{ + IOCONTEXT_BULKREAD, + IOCONTEXT_BULKWRITE, + IOCONTEXT_INIT, + IOCONTEXT_NORMAL, + IOCONTEXT_VACUUM, +} IOContext; + +#define IOCONTEXT_NUM_TYPES (IOCONTEXT_VACUUM + 1) + +/* + * Enumeration of IO operations. + * + * This enum categorizes IO operations into two groups, depending on if + * byte operations are supported. + * + * Ensure IOOP_EXTEND is the first and IOOP_WRITE is the last ones in the + * tracked in bytes group and that the groups stay in that order. + */ +typedef enum IOOp +{ + /* IOs not tracked in bytes */ + IOOP_EVICT, + IOOP_FSYNC, + IOOP_HIT, + IOOP_REUSE, + IOOP_WRITEBACK, + + /* IOs tracked in bytes */ + IOOP_EXTEND, + IOOP_READ, + IOOP_WRITE, +} IOOp; + +#define IOOP_NUM_TYPES (IOOP_WRITE + 1) + +#define pgstat_is_ioop_tracked_in_bytes(io_op) \ + (((unsigned int) (io_op)) < IOOP_NUM_TYPES && \ + ((unsigned int) (io_op)) >= IOOP_EXTEND) + +typedef struct PgStat_BktypeIO +{ + uint64 bytes[IOOBJECT_NUM_TYPES][IOCONTEXT_NUM_TYPES][IOOP_NUM_TYPES]; + PgStat_Counter counts[IOOBJECT_NUM_TYPES][IOCONTEXT_NUM_TYPES][IOOP_NUM_TYPES]; + PgStat_Counter times[IOOBJECT_NUM_TYPES][IOCONTEXT_NUM_TYPES][IOOP_NUM_TYPES]; +} PgStat_BktypeIO; + +typedef struct PgStat_PendingIO +{ + uint64 bytes[IOOBJECT_NUM_TYPES][IOCONTEXT_NUM_TYPES][IOOP_NUM_TYPES]; + PgStat_Counter counts[IOOBJECT_NUM_TYPES][IOCONTEXT_NUM_TYPES][IOOP_NUM_TYPES]; + instr_time pending_times[IOOBJECT_NUM_TYPES][IOCONTEXT_NUM_TYPES][IOOP_NUM_TYPES]; +} PgStat_PendingIO; + +typedef struct PgStat_IO +{ + TimestampTz stat_reset_timestamp; + PgStat_BktypeIO stats[BACKEND_NUM_TYPES]; +} PgStat_IO; + +typedef struct PgStat_StatDBEntry +{ + PgStat_Counter xact_commit; + PgStat_Counter xact_rollback; + PgStat_Counter blocks_fetched; + PgStat_Counter blocks_hit; + PgStat_Counter tuples_returned; + PgStat_Counter tuples_fetched; + PgStat_Counter tuples_inserted; + PgStat_Counter tuples_updated; + PgStat_Counter tuples_deleted; + TimestampTz last_autovac_time; + PgStat_Counter conflict_tablespace; + PgStat_Counter conflict_lock; + PgStat_Counter conflict_snapshot; + PgStat_Counter conflict_logicalslot; + PgStat_Counter conflict_bufferpin; + PgStat_Counter conflict_startup_deadlock; + PgStat_Counter temp_files; + PgStat_Counter temp_bytes; + PgStat_Counter deadlocks; + PgStat_Counter checksum_failures; + TimestampTz last_checksum_failure; + PgStat_Counter blk_read_time; /* times in microseconds */ + PgStat_Counter blk_write_time; + PgStat_Counter sessions; + PgStat_Counter session_time; + PgStat_Counter active_time; + PgStat_Counter idle_in_transaction_time; + PgStat_Counter sessions_abandoned; + PgStat_Counter sessions_fatal; + PgStat_Counter sessions_killed; + PgStat_Counter parallel_workers_to_launch; + PgStat_Counter parallel_workers_launched; + + TimestampTz stat_reset_timestamp; +} PgStat_StatDBEntry; + +typedef struct PgStat_StatFuncEntry +{ + PgStat_Counter numcalls; + + PgStat_Counter total_time; /* times in microseconds */ + PgStat_Counter self_time; +} PgStat_StatFuncEntry; + +typedef struct PgStat_StatReplSlotEntry +{ + PgStat_Counter spill_txns; + PgStat_Counter spill_count; + PgStat_Counter spill_bytes; + PgStat_Counter stream_txns; + PgStat_Counter stream_count; + PgStat_Counter stream_bytes; + PgStat_Counter total_txns; + PgStat_Counter total_bytes; + TimestampTz stat_reset_timestamp; +} PgStat_StatReplSlotEntry; + +typedef struct PgStat_SLRUStats +{ + PgStat_Counter blocks_zeroed; + PgStat_Counter blocks_hit; + PgStat_Counter blocks_read; + PgStat_Counter blocks_written; + PgStat_Counter blocks_exists; + PgStat_Counter flush; + PgStat_Counter truncate; + TimestampTz stat_reset_timestamp; +} PgStat_SLRUStats; + +typedef struct PgStat_StatSubEntry +{ + PgStat_Counter apply_error_count; + PgStat_Counter sync_error_count; + PgStat_Counter conflict_count[CONFLICT_NUM_TYPES]; + TimestampTz stat_reset_timestamp; +} PgStat_StatSubEntry; + +typedef struct PgStat_StatTabEntry +{ + PgStat_Counter numscans; + TimestampTz lastscan; + + PgStat_Counter tuples_returned; + PgStat_Counter tuples_fetched; + + PgStat_Counter tuples_inserted; + PgStat_Counter tuples_updated; + PgStat_Counter tuples_deleted; + PgStat_Counter tuples_hot_updated; + PgStat_Counter tuples_newpage_updated; + + PgStat_Counter live_tuples; + PgStat_Counter dead_tuples; + PgStat_Counter mod_since_analyze; + PgStat_Counter ins_since_vacuum; + + PgStat_Counter blocks_fetched; + PgStat_Counter blocks_hit; + + TimestampTz last_vacuum_time; /* user initiated vacuum */ + PgStat_Counter vacuum_count; + TimestampTz last_autovacuum_time; /* autovacuum initiated */ + PgStat_Counter autovacuum_count; + TimestampTz last_analyze_time; /* user initiated */ + PgStat_Counter analyze_count; + TimestampTz last_autoanalyze_time; /* autovacuum initiated */ + PgStat_Counter autoanalyze_count; + + PgStat_Counter total_vacuum_time; /* times in milliseconds */ + PgStat_Counter total_autovacuum_time; + PgStat_Counter total_analyze_time; + PgStat_Counter total_autoanalyze_time; +} PgStat_StatTabEntry; + +/* ------ + * PgStat_WalCounters WAL activity data gathered from WalUsage + * + * This stores all the counters and data gathered from WalUsage for WAL + * activity statistics, separated into its own structure so as this can be + * shared across multiple Stats structures. + * ------ + */ +typedef struct PgStat_WalCounters +{ + PgStat_Counter wal_records; + PgStat_Counter wal_fpi; + uint64 wal_bytes; + PgStat_Counter wal_buffers_full; +} PgStat_WalCounters; + +/* ------- + * PgStat_WalStats WAL statistics + * ------- + */ +typedef struct PgStat_WalStats +{ + PgStat_WalCounters wal_counters; + TimestampTz stat_reset_timestamp; +} PgStat_WalStats; + +/* ------- + * PgStat_Backend Backend statistics + * ------- + */ +typedef struct PgStat_Backend +{ + TimestampTz stat_reset_timestamp; + PgStat_BktypeIO io_stats; + PgStat_WalCounters wal_counters; +} PgStat_Backend; + +/* --------- + * PgStat_BackendPending Non-flushed backend stats. + * --------- + */ +typedef struct PgStat_BackendPending +{ + /* + * Backend statistics store the same amount of IO data as PGSTAT_KIND_IO. + */ + PgStat_PendingIO pending_io; +} PgStat_BackendPending; + +/* + * Functions in pgstat.c + */ + +/* functions called from postmaster */ +extern Size StatsShmemSize(void); +extern void StatsShmemInit(void); + +/* Functions called during server startup / shutdown */ +extern void pgstat_restore_stats(void); +extern void pgstat_discard_stats(void); +extern void pgstat_before_server_shutdown(int code, Datum arg); + +/* Functions for backend initialization */ +extern void pgstat_initialize(void); + +/* Functions called from backends */ +extern long pgstat_report_stat(bool force); +extern void pgstat_force_next_flush(void); + +extern void pgstat_reset_counters(void); +extern void pgstat_reset(PgStat_Kind kind, Oid dboid, uint64 objid); +extern void pgstat_reset_of_kind(PgStat_Kind kind); + +/* stats accessors */ +extern void pgstat_clear_snapshot(void); +extern TimestampTz pgstat_get_stat_snapshot_timestamp(bool *have_snapshot); + +/* helpers */ +extern PgStat_Kind pgstat_get_kind_from_str(char *kind_str); +extern bool pgstat_have_entry(PgStat_Kind kind, Oid dboid, uint64 objid); + + +/* + * Functions in pgstat_archiver.c + */ + +extern void pgstat_report_archiver(const char *xlog, bool failed); +extern PgStat_ArchiverStats *pgstat_fetch_stat_archiver(void); + +/* + * Functions in pgstat_backend.c + */ + +/* used by pgstat_io.c for I/O stats tracked in backends */ +extern void pgstat_count_backend_io_op_time(IOObject io_object, + IOContext io_context, + IOOp io_op, + instr_time io_time); +extern void pgstat_count_backend_io_op(IOObject io_object, + IOContext io_context, + IOOp io_op, uint32 cnt, + uint64 bytes); +extern PgStat_Backend *pgstat_fetch_stat_backend(ProcNumber procNumber); +extern PgStat_Backend *pgstat_fetch_stat_backend_by_pid(int pid, + BackendType *bktype); +extern bool pgstat_tracks_backend_bktype(BackendType bktype); +extern void pgstat_create_backend(ProcNumber procnum); + +/* + * Functions in pgstat_bgwriter.c + */ + +extern void pgstat_report_bgwriter(void); +extern PgStat_BgWriterStats *pgstat_fetch_stat_bgwriter(void); + + +/* + * Functions in pgstat_checkpointer.c + */ + +extern void pgstat_report_checkpointer(void); +extern PgStat_CheckpointerStats *pgstat_fetch_stat_checkpointer(void); + + +/* + * Functions in pgstat_io.c + */ + +extern bool pgstat_bktype_io_stats_valid(PgStat_BktypeIO *backend_io, + BackendType bktype); +extern void pgstat_count_io_op(IOObject io_object, IOContext io_context, + IOOp io_op, uint32 cnt, uint64 bytes); +extern instr_time pgstat_prepare_io_time(bool track_io_guc); +extern void pgstat_count_io_op_time(IOObject io_object, IOContext io_context, + IOOp io_op, instr_time start_time, + uint32 cnt, uint64 bytes); + +extern PgStat_IO *pgstat_fetch_stat_io(void); +extern const char *pgstat_get_io_context_name(IOContext io_context); +extern const char *pgstat_get_io_object_name(IOObject io_object); + +extern bool pgstat_tracks_io_bktype(BackendType bktype); +extern bool pgstat_tracks_io_object(BackendType bktype, + IOObject io_object, IOContext io_context); +extern bool pgstat_tracks_io_op(BackendType bktype, IOObject io_object, + IOContext io_context, IOOp io_op); + + +/* + * Functions in pgstat_database.c + */ + +extern void pgstat_drop_database(Oid databaseid); +extern void pgstat_report_autovac(Oid dboid); +extern void pgstat_report_recovery_conflict(int reason); +extern void pgstat_report_deadlock(void); +extern void pgstat_prepare_report_checksum_failure(Oid dboid); +extern void pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount); +extern void pgstat_report_connect(Oid dboid); +extern void pgstat_update_parallel_workers_stats(PgStat_Counter workers_to_launch, + PgStat_Counter workers_launched); + +#define pgstat_count_buffer_read_time(n) \ + (pgStatBlockReadTime += (n)) +#define pgstat_count_buffer_write_time(n) \ + (pgStatBlockWriteTime += (n)) +#define pgstat_count_conn_active_time(n) \ + (pgStatActiveTime += (n)) +#define pgstat_count_conn_txn_idle_time(n) \ + (pgStatTransactionIdleTime += (n)) + +extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dboid); + + +/* + * Functions in pgstat_function.c + */ + +extern void pgstat_create_function(Oid proid); +extern void pgstat_drop_function(Oid proid); + +struct FunctionCallInfoBaseData; +extern void pgstat_init_function_usage(struct FunctionCallInfoBaseData *fcinfo, + PgStat_FunctionCallUsage *fcu); +extern void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, + bool finalize); + +extern PgStat_StatFuncEntry *pgstat_fetch_stat_funcentry(Oid func_id); +extern PgStat_FunctionCounts *find_funcstat_entry(Oid func_id); + + +/* + * Functions in pgstat_relation.c + */ + +extern void pgstat_create_relation(Relation rel); +extern void pgstat_drop_relation(Relation rel); +extern void pgstat_copy_relation_stats(Relation dst, Relation src); + +extern void pgstat_init_relation(Relation rel); +extern void pgstat_assoc_relation(Relation rel); +extern void pgstat_unlink_relation(Relation rel); + +extern void pgstat_report_vacuum(Oid tableoid, bool shared, + PgStat_Counter livetuples, PgStat_Counter deadtuples, + TimestampTz starttime); +extern void pgstat_report_analyze(Relation rel, + PgStat_Counter livetuples, PgStat_Counter deadtuples, + bool resetcounter, TimestampTz starttime); + +/* + * If stats are enabled, but pending data hasn't been prepared yet, call + * pgstat_assoc_relation() to do so. See its comment for why this is done + * separately from pgstat_init_relation(). + */ +#define pgstat_should_count_relation(rel) \ + (likely((rel)->pgstat_info != NULL) ? true : \ + ((rel)->pgstat_enabled ? pgstat_assoc_relation(rel), true : false)) + +/* nontransactional event counts are simple enough to inline */ + +#define pgstat_count_heap_scan(rel) \ + do { \ + if (pgstat_should_count_relation(rel)) \ + (rel)->pgstat_info->counts.numscans++; \ + } while (0) +#define pgstat_count_heap_getnext(rel) \ + do { \ + if (pgstat_should_count_relation(rel)) \ + (rel)->pgstat_info->counts.tuples_returned++; \ + } while (0) +#define pgstat_count_heap_fetch(rel) \ + do { \ + if (pgstat_should_count_relation(rel)) \ + (rel)->pgstat_info->counts.tuples_fetched++; \ + } while (0) +#define pgstat_count_index_scan(rel) \ + do { \ + if (pgstat_should_count_relation(rel)) \ + (rel)->pgstat_info->counts.numscans++; \ + } while (0) +#define pgstat_count_index_tuples(rel, n) \ + do { \ + if (pgstat_should_count_relation(rel)) \ + (rel)->pgstat_info->counts.tuples_returned += (n); \ + } while (0) +#define pgstat_count_buffer_read(rel) \ + do { \ + if (pgstat_should_count_relation(rel)) \ + (rel)->pgstat_info->counts.blocks_fetched++; \ + } while (0) +#define pgstat_count_buffer_hit(rel) \ + do { \ + if (pgstat_should_count_relation(rel)) \ + (rel)->pgstat_info->counts.blocks_hit++; \ + } while (0) + +extern void pgstat_count_heap_insert(Relation rel, PgStat_Counter n); +extern void pgstat_count_heap_update(Relation rel, bool hot, bool newpage); +extern void pgstat_count_heap_delete(Relation rel); +extern void pgstat_count_truncate(Relation rel); +extern void pgstat_update_heap_dead_tuples(Relation rel, int delta); + +extern void pgstat_twophase_postcommit(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void pgstat_twophase_postabort(TransactionId xid, uint16 info, + void *recdata, uint32 len); + +extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid); +extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry_ext(bool shared, + Oid reloid); +extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id); + + +/* + * Functions in pgstat_replslot.c + */ + +extern void pgstat_reset_replslot(const char *name); +struct ReplicationSlot; +extern void pgstat_report_replslot(struct ReplicationSlot *slot, const PgStat_StatReplSlotEntry *repSlotStat); +extern void pgstat_create_replslot(struct ReplicationSlot *slot); +extern void pgstat_acquire_replslot(struct ReplicationSlot *slot); +extern void pgstat_drop_replslot(struct ReplicationSlot *slot); +extern PgStat_StatReplSlotEntry *pgstat_fetch_replslot(NameData slotname); + + +/* + * Functions in pgstat_slru.c + */ + +extern void pgstat_reset_slru(const char *); +extern void pgstat_count_slru_page_zeroed(int slru_idx); +extern void pgstat_count_slru_page_hit(int slru_idx); +extern void pgstat_count_slru_page_read(int slru_idx); +extern void pgstat_count_slru_page_written(int slru_idx); +extern void pgstat_count_slru_page_exists(int slru_idx); +extern void pgstat_count_slru_flush(int slru_idx); +extern void pgstat_count_slru_truncate(int slru_idx); +extern const char *pgstat_get_slru_name(int slru_idx); +extern int pgstat_get_slru_index(const char *name); +extern PgStat_SLRUStats *pgstat_fetch_slru(void); + + +/* + * Functions in pgstat_subscription.c + */ + +extern void pgstat_report_subscription_error(Oid subid, bool is_apply_error); +extern void pgstat_report_subscription_conflict(Oid subid, ConflictType type); +extern void pgstat_create_subscription(Oid subid); +extern void pgstat_drop_subscription(Oid subid); +extern PgStat_StatSubEntry *pgstat_fetch_stat_subscription(Oid subid); + + +/* + * Functions in pgstat_xact.c + */ + +extern void AtEOXact_PgStat(bool isCommit, bool parallel); +extern void AtEOSubXact_PgStat(bool isCommit, int nestDepth); +extern void AtPrepare_PgStat(void); +extern void PostPrepare_PgStat(void); +struct xl_xact_stats_item; +extern int pgstat_get_transactional_drops(bool isCommit, struct xl_xact_stats_item **items); +extern void pgstat_execute_transactional_drops(int ndrops, struct xl_xact_stats_item *items, bool is_redo); + + +/* + * Functions in pgstat_wal.c + */ + +extern void pgstat_report_wal(bool force); +extern PgStat_WalStats *pgstat_fetch_stat_wal(void); + + +/* + * Variables in pgstat.c + */ + +/* GUC parameters */ +extern PGDLLIMPORT bool pgstat_track_counts; +extern PGDLLIMPORT int pgstat_track_functions; +extern PGDLLIMPORT int pgstat_fetch_consistency; + + +/* + * Variables in pgstat_bgwriter.c + */ + +/* updated directly by bgwriter and bufmgr */ +extern PGDLLIMPORT PgStat_BgWriterStats PendingBgWriterStats; + + +/* + * Variables in pgstat_checkpointer.c + */ + +/* + * Checkpointer statistics counters are updated directly by checkpointer and + * bufmgr. + */ +extern PGDLLIMPORT PgStat_CheckpointerStats PendingCheckpointerStats; + + +/* + * Variables in pgstat_database.c + */ + +/* Updated by pgstat_count_buffer_*_time macros */ +extern PGDLLIMPORT PgStat_Counter pgStatBlockReadTime; +extern PGDLLIMPORT PgStat_Counter pgStatBlockWriteTime; + +/* + * Updated by pgstat_count_conn_*_time macros, called by + * pgstat_report_activity(). + */ +extern PGDLLIMPORT PgStat_Counter pgStatActiveTime; +extern PGDLLIMPORT PgStat_Counter pgStatTransactionIdleTime; + +/* updated by the traffic cop and in errfinish() */ +extern PGDLLIMPORT SessionEndType pgStatSessionEndCause; + +#endif /* PGSTAT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/pgtar.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/pgtar.h new file mode 100644 index 0000000..b267757 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/pgtar.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------------------------- + * + * pgtar.h + * Functions for manipulating tarfile datastructures (src/port/tar.c) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/pgtar.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TAR_H +#define PG_TAR_H + +#define TAR_BLOCK_SIZE 512 + +enum tarError +{ + TAR_OK = 0, + TAR_NAME_TOO_LONG, + TAR_SYMLINK_TOO_LONG, +}; + +/* + * Offsets of fields within a 512-byte tar header. + * + * "tar number" values should be generated using print_tar_number() and can be + * read using read_tar_number(). Fields that contain strings are generally + * both filled and read using strlcpy(). + * + * The value for the checksum field can be computed using tarChecksum(). + * + * Some fields are not used by PostgreSQL; see tarCreateHeader(). + */ +enum tarHeaderOffset +{ + TAR_OFFSET_NAME = 0, /* 100 byte string */ + TAR_OFFSET_MODE = 100, /* 8 byte tar number, excludes S_IFMT */ + TAR_OFFSET_UID = 108, /* 8 byte tar number */ + TAR_OFFSET_GID = 116, /* 8 byte tar number */ + TAR_OFFSET_SIZE = 124, /* 8 byte tar number */ + TAR_OFFSET_MTIME = 136, /* 12 byte tar number */ + TAR_OFFSET_CHECKSUM = 148, /* 8 byte tar number */ + TAR_OFFSET_TYPEFLAG = 156, /* 1 byte file type, see TAR_FILETYPE_* */ + TAR_OFFSET_LINKNAME = 157, /* 100 byte string */ + TAR_OFFSET_MAGIC = 257, /* "ustar" with terminating zero byte */ + TAR_OFFSET_VERSION = 263, /* "00" */ + TAR_OFFSET_UNAME = 265, /* 32 byte string */ + TAR_OFFSET_GNAME = 297, /* 32 byte string */ + TAR_OFFSET_DEVMAJOR = 329, /* 8 byte tar number */ + TAR_OFFSET_DEVMINOR = 337, /* 8 byte tar number */ + TAR_OFFSET_PREFIX = 345, /* 155 byte string */ + /* last 12 bytes of the 512-byte block are unassigned */ +}; + +enum tarFileType +{ + TAR_FILETYPE_PLAIN = '0', + TAR_FILETYPE_SYMLINK = '2', + TAR_FILETYPE_DIRECTORY = '5', +}; + +extern enum tarError tarCreateHeader(char *h, const char *filename, + const char *linktarget, pgoff_t size, + mode_t mode, uid_t uid, gid_t gid, + time_t mtime); +extern uint64 read_tar_number(const char *s, int len); +extern void print_tar_number(char *s, int len, uint64 val); +extern int tarChecksum(char *header); + +/* + * Compute the number of padding bytes required for an entry in a tar + * archive. We must pad out to a multiple of TAR_BLOCK_SIZE. Since that's + * a power of 2, we can use TYPEALIGN(). + */ +static inline size_t +tarPaddingBytesRequired(size_t len) +{ + return TYPEALIGN(TAR_BLOCK_SIZE, len) - len; +} + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/pgtime.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/pgtime.h new file mode 100644 index 0000000..5fc9f22 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/pgtime.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------------------- + * + * pgtime.h + * PostgreSQL internal timezone library + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/pgtime.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PGTIME_H +#define _PGTIME_H + + +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ + +typedef int64 pg_time_t; + +/* + * Data structure representing a broken-down timestamp. + * + * CAUTION: the IANA timezone library (src/timezone/) follows the POSIX + * convention that tm_mon counts from 0 and tm_year is relative to 1900. + * However, Postgres' datetime functions generally treat tm_mon as counting + * from 1 and tm_year as relative to 1 BC. Be sure to make the appropriate + * adjustments when moving from one code domain to the other. + */ +struct pg_tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; /* see above */ + int tm_year; /* see above */ + int tm_wday; + int tm_yday; + int tm_isdst; + long int tm_gmtoff; + const char *tm_zone; +}; + +/* These structs are opaque outside the timezone library */ +typedef struct pg_tz pg_tz; +typedef struct pg_tzenum pg_tzenum; + +/* Maximum length of a timezone name (not including trailing null) */ +#define TZ_STRLEN_MAX 255 + +/* these functions are in localtime.c */ + +extern struct pg_tm *pg_localtime(const pg_time_t *timep, const pg_tz *tz); +extern struct pg_tm *pg_gmtime(const pg_time_t *timep); +extern int pg_next_dst_boundary(const pg_time_t *timep, + long int *before_gmtoff, + int *before_isdst, + pg_time_t *boundary, + long int *after_gmtoff, + int *after_isdst, + const pg_tz *tz); +extern bool pg_interpret_timezone_abbrev(const char *abbrev, + const pg_time_t *timep, + long int *gmtoff, + int *isdst, + const pg_tz *tz); +extern bool pg_timezone_abbrev_is_known(const char *abbrev, + bool *isfixed, + long int *gmtoff, + int *isdst, + const pg_tz *tz); +extern const char *pg_get_next_timezone_abbrev(int *indx, + const pg_tz *tz); +extern bool pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff); +extern const char *pg_get_timezone_name(pg_tz *tz); +extern bool pg_tz_acceptable(pg_tz *tz); + +/* these functions are in strftime.c */ + +extern size_t pg_strftime(char *s, size_t maxsize, const char *format, + const struct pg_tm *t); + +/* these functions and variables are in pgtz.c */ + +extern PGDLLIMPORT pg_tz *session_timezone; +extern PGDLLIMPORT pg_tz *log_timezone; + +extern void pg_timezone_initialize(void); +extern pg_tz *pg_tzset(const char *tzname); +extern pg_tz *pg_tzset_offset(long gmtoffset); + +extern pg_tzenum *pg_tzenumerate_start(void); +extern pg_tz *pg_tzenumerate_next(pg_tzenum *dir); +extern void pg_tzenumerate_end(pg_tzenum *dir); + +#endif /* _PGTIME_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port.h new file mode 100644 index 0000000..caf65ce --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port.h @@ -0,0 +1,564 @@ +/*------------------------------------------------------------------------- + * + * port.h + * Header for src/port/ compatibility functions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PORT_H +#define PG_PORT_H + +#include + +/* + * Windows has enough specialized port stuff that we push most of it off + * into another file. + * Note: Some CYGWIN includes might #define WIN32. + */ +#if defined(WIN32) && !defined(__CYGWIN__) +#include "port/win32_port.h" +#endif + +/* socket has a different definition on WIN32 */ +#ifndef WIN32 +typedef int pgsocket; + +#define PGINVALID_SOCKET (-1) +#else +typedef SOCKET pgsocket; + +#define PGINVALID_SOCKET INVALID_SOCKET +#endif + +/* if platform lacks socklen_t, we assume this will work */ +#ifndef HAVE_SOCKLEN_T +typedef unsigned int socklen_t; +#endif + +/* non-blocking */ +extern bool pg_set_noblock(pgsocket sock); +extern bool pg_set_block(pgsocket sock); + +/* Portable path handling for Unix/Win32 (in path.c) */ + +extern bool has_drive_prefix(const char *path); +extern char *first_dir_separator(const char *filename); +extern char *last_dir_separator(const char *filename); +extern char *first_path_var_separator(const char *pathlist); +extern void join_path_components(char *ret_path, + const char *head, const char *tail); +extern void canonicalize_path(char *path); +extern void canonicalize_path_enc(char *path, int encoding); +extern void make_native_path(char *filename); +extern void cleanup_path(char *path); +extern bool path_contains_parent_reference(const char *path); +extern bool path_is_relative_and_below_cwd(const char *path); +extern bool path_is_prefix_of_path(const char *path1, const char *path2); +extern char *make_absolute_path(const char *path); +extern const char *get_progname(const char *argv0); +extern void get_share_path(const char *my_exec_path, char *ret_path); +extern void get_etc_path(const char *my_exec_path, char *ret_path); +extern void get_include_path(const char *my_exec_path, char *ret_path); +extern void get_pkginclude_path(const char *my_exec_path, char *ret_path); +extern void get_includeserver_path(const char *my_exec_path, char *ret_path); +extern void get_lib_path(const char *my_exec_path, char *ret_path); +extern void get_pkglib_path(const char *my_exec_path, char *ret_path); +extern void get_locale_path(const char *my_exec_path, char *ret_path); +extern void get_doc_path(const char *my_exec_path, char *ret_path); +extern void get_html_path(const char *my_exec_path, char *ret_path); +extern void get_man_path(const char *my_exec_path, char *ret_path); +extern bool get_home_path(char *ret_path); +extern void get_parent_directory(char *path); + +/* common/pgfnames.c */ +extern char **pgfnames(const char *path); +extern void pgfnames_cleanup(char **filenames); + +#define IS_NONWINDOWS_DIR_SEP(ch) ((ch) == '/') +#define is_nonwindows_absolute_path(filename) \ +( \ + IS_NONWINDOWS_DIR_SEP((filename)[0]) \ +) + +#define IS_WINDOWS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\') +/* See path_is_relative_and_below_cwd() for how we handle 'E:abc'. */ +#define is_windows_absolute_path(filename) \ +( \ + IS_WINDOWS_DIR_SEP((filename)[0]) || \ + (isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \ + IS_WINDOWS_DIR_SEP((filename)[2])) \ +) + +/* + * is_absolute_path and IS_DIR_SEP + * + * By using macros here we avoid needing to include path.c in libpq. + */ +#ifndef WIN32 +#define IS_DIR_SEP(ch) IS_NONWINDOWS_DIR_SEP(ch) +#define is_absolute_path(filename) is_nonwindows_absolute_path(filename) +#else +#define IS_DIR_SEP(ch) IS_WINDOWS_DIR_SEP(ch) +#define is_absolute_path(filename) is_windows_absolute_path(filename) +#endif + +/* + * This macro provides a centralized list of all errnos that identify + * hard failure of a previously-established network connection. + * The macro is intended to be used in a switch statement, in the form + * "case ALL_CONNECTION_FAILURE_ERRNOS:". + * + * Note: this groups EPIPE and ECONNRESET, which we take to indicate a + * probable server crash, with other errors that indicate loss of network + * connectivity without proving much about the server's state. Places that + * are actually reporting errors typically single out EPIPE and ECONNRESET, + * while allowing the network failures to be reported generically. + */ +#define ALL_CONNECTION_FAILURE_ERRNOS \ + EPIPE: \ + case ECONNRESET: \ + case ECONNABORTED: \ + case EHOSTDOWN: \ + case EHOSTUNREACH: \ + case ENETDOWN: \ + case ENETRESET: \ + case ENETUNREACH: \ + case ETIMEDOUT + +/* Portable locale initialization (in exec.c) */ +extern void set_pglocale_pgservice(const char *argv0, const char *app); + +/* Portable way to find and execute binaries (in exec.c) */ +extern int validate_exec(const char *path); +extern int find_my_exec(const char *argv0, char *retpath); +extern int find_other_exec(const char *argv0, const char *target, + const char *versionstr, char *retpath); +extern char *pipe_read_line(char *cmd); + +/* Doesn't belong here, but this is used with find_other_exec(), so... */ +#define PG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n" + +#ifdef EXEC_BACKEND +/* Disable ASLR before exec, for developer builds only (in exec.c) */ +extern int pg_disable_aslr(void); +#endif + + +#if defined(WIN32) || defined(__CYGWIN__) +#define EXE ".exe" +#else +#define EXE "" +#endif + +#if defined(WIN32) && !defined(__CYGWIN__) +#define DEVNULL "nul" +#else +#define DEVNULL "/dev/null" +#endif + +/* Portable delay handling */ +extern void pg_usleep(long microsec); + +/* Portable SQL-like case-independent comparisons and conversions */ +extern int pg_strcasecmp(const char *s1, const char *s2); +extern int pg_strncasecmp(const char *s1, const char *s2, size_t n); +extern unsigned char pg_toupper(unsigned char ch); +extern unsigned char pg_tolower(unsigned char ch); +extern unsigned char pg_ascii_toupper(unsigned char ch); +extern unsigned char pg_ascii_tolower(unsigned char ch); + +/* + * Beginning in v12, we always replace snprintf() and friends with our own + * implementation. This symbol is no longer consulted by the core code, + * but keep it defined anyway in case any extensions are looking at it. + */ +#define USE_REPL_SNPRINTF 1 + +/* + * Versions of libintl >= 0.13 try to replace printf() and friends with + * macros to their own versions that understand the %$ format. We do the + * same, so disable their macros, if they exist. + */ +#ifdef vsnprintf +#undef vsnprintf +#endif +#ifdef snprintf +#undef snprintf +#endif +#ifdef vsprintf +#undef vsprintf +#endif +#ifdef sprintf +#undef sprintf +#endif +#ifdef vfprintf +#undef vfprintf +#endif +#ifdef fprintf +#undef fprintf +#endif +#ifdef vprintf +#undef vprintf +#endif +#ifdef printf +#undef printf +#endif + +extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args) pg_attribute_printf(3, 0); +extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4); +extern int pg_vsprintf(char *str, const char *fmt, va_list args) pg_attribute_printf(2, 0); +extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3); +extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args) pg_attribute_printf(2, 0); +extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3); +extern int pg_vprintf(const char *fmt, va_list args) pg_attribute_printf(1, 0); +extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2); + +#ifndef WIN32 +/* + * We add a pg_ prefix as a warning that the Windows implementations have the + * non-standard side-effect of changing the current file position. + */ +#define pg_pread pread +#define pg_pwrite pwrite +#endif + +/* + * We use __VA_ARGS__ for printf to prevent replacing references to + * the "printf" format archetype in format() attribute declarations. + * That unfortunately means that taking a function pointer to printf + * will not do what we'd wish. (If you need to do that, you must name + * pg_printf explicitly.) For printf's sibling functions, use + * parameterless macros so that function pointers will work unsurprisingly. + */ +#define vsnprintf pg_vsnprintf +#define snprintf pg_snprintf +#define vsprintf pg_vsprintf +#define sprintf pg_sprintf +#define vfprintf pg_vfprintf +#define fprintf pg_fprintf +#define vprintf pg_vprintf +#define printf(...) pg_printf(__VA_ARGS__) + +/* This is also provided by snprintf.c */ +extern int pg_strfromd(char *str, size_t count, int precision, double value); + +/* Replace strerror() with our own, somewhat more robust wrapper */ +extern char *pg_strerror(int errnum); +#define strerror pg_strerror + +/* Likewise for strerror_r(); note we prefer the GNU API for that */ +extern char *pg_strerror_r(int errnum, char *buf, size_t buflen); +#define strerror_r pg_strerror_r +#define PG_STRERROR_R_BUFLEN 256 /* Recommended buffer size for strerror_r */ + +/* Wrap strsignal(), or provide our own version if necessary */ +extern const char *pg_strsignal(int signum); + +extern int pclose_check(FILE *stream); + +/* Global variable holding time zone information. */ +#if defined(WIN32) || defined(__CYGWIN__) +#define TIMEZONE_GLOBAL _timezone +#define TZNAME_GLOBAL _tzname +#else +#define TIMEZONE_GLOBAL timezone +#define TZNAME_GLOBAL tzname +#endif + +#if defined(WIN32) || defined(__CYGWIN__) +/* + * Win32 doesn't have reliable rename/unlink during concurrent access. + */ +extern int pgrename(const char *from, const char *to); +extern int pgunlink(const char *path); + +/* Include this first so later includes don't see these defines */ +#ifdef _MSC_VER +#include +#endif + +#define rename(from, to) pgrename(from, to) +#define unlink(path) pgunlink(path) +#endif /* defined(WIN32) || defined(__CYGWIN__) */ + +/* + * Win32 also doesn't have symlinks, but we can emulate them with + * junction points on newer Win32 versions. + * + * Cygwin has its own symlinks which work on Win95/98/ME where + * junction points don't, so use those instead. We have no way of + * knowing what type of system Cygwin binaries will be run on. + * Note: Some CYGWIN includes might #define WIN32. + */ +#if defined(WIN32) && !defined(__CYGWIN__) +extern int pgsymlink(const char *oldpath, const char *newpath); +extern int pgreadlink(const char *path, char *buf, size_t size); + +#define symlink(oldpath, newpath) pgsymlink(oldpath, newpath) +#define readlink(path, buf, size) pgreadlink(path, buf, size) +#endif + +extern bool rmtree(const char *path, bool rmtopdir); + +#if defined(WIN32) && !defined(__CYGWIN__) + +/* + * We want the 64-bit variant of lseek(). + * + * For Visual Studio, this must be after to avoid messing up its + * lseek() and _lseeki64() function declarations. + * + * For MinGW there is already a macro, so we have to undefine it (depending on + * _FILE_OFFSET_BITS, it may point at its own lseek64, but we don't want to + * count on that being set). + */ +#undef lseek +#define lseek(a,b,c) _lseeki64((a),(b),(c)) + +/* + * We want the 64-bit variant of chsize(). It sets errno and also returns it, + * so convert non-zero result to -1 to match POSIX. + * + * Prevent MinGW from declaring functions, and undefine its macro before we + * define our own. + */ +#ifndef _MSC_VER +#define FTRUNCATE_DEFINED +#include +#undef ftruncate +#endif +#define ftruncate(a,b) (_chsize_s((a),(b)) == 0 ? 0 : -1) + +/* + * open() and fopen() replacements to allow deletion of open files and + * passing of other special options. + */ +extern HANDLE pgwin32_open_handle(const char *, int, bool); +extern int pgwin32_open(const char *, int,...); +extern FILE *pgwin32_fopen(const char *, const char *); +#define open(a,b,c) pgwin32_open(a,b,c) +#define fopen(a,b) pgwin32_fopen(a,b) + +/* + * Mingw-w64 headers #define popen and pclose to _popen and _pclose. We want + * to use our popen wrapper, rather than plain _popen, so override that. For + * consistency, use our version of pclose, too. + */ +#ifdef popen +#undef popen +#endif +#ifdef pclose +#undef pclose +#endif + +/* + * system() and popen() replacements to enclose the command in an extra + * pair of quotes. + */ +extern int pgwin32_system(const char *command); +extern FILE *pgwin32_popen(const char *command, const char *type); + +#define system(a) pgwin32_system(a) +#define popen(a,b) pgwin32_popen(a,b) +#define pclose(a) _pclose(a) + +#else /* !WIN32 */ + +/* + * Win32 requires a special close for sockets and pipes, while on Unix + * close() does them all. + */ +#define closesocket close +#endif /* WIN32 */ + +/* + * On Windows, setvbuf() does not support _IOLBF mode, and interprets that + * as _IOFBF. To add insult to injury, setvbuf(file, NULL, _IOFBF, 0) + * crashes outright if "parameter validation" is enabled. Therefore, in + * places where we'd like to select line-buffered mode, we fall back to + * unbuffered mode instead on Windows. Always use PG_IOLBF not _IOLBF + * directly in order to implement this behavior. + */ +#ifndef WIN32 +#define PG_IOLBF _IOLBF +#else +#define PG_IOLBF _IONBF +#endif + +/* + * Default "extern" declarations or macro substitutes for library routines. + * When necessary, these routines are provided by files in src/port/. + */ + +/* Type to use with fseeko/ftello */ +#ifndef WIN32 /* WIN32 is handled in port/win32_port.h */ +#define pgoff_t off_t +#endif + +#ifndef HAVE_GETPEEREID +/* On Windows, Perl might have incompatible definitions of uid_t and gid_t. */ +#ifndef PLPERL_HAVE_UID_GID +extern int getpeereid(int sock, uid_t *uid, gid_t *gid); +#endif +#endif + +/* + * Glibc doesn't use the builtin for clang due to a *gcc* bug in a version + * newer than the gcc compatibility clang claims to have. This would cause a + * *lot* of superfluous function calls, therefore revert when using clang. In + * C++ there's issues with libc++ (not libstdc++), so disable as well. + */ +#if defined(__clang__) && !defined(__cplusplus) +/* needs to be separate to not confuse other compilers */ +#if __has_builtin(__builtin_isinf) +/* need to include before, to avoid getting overwritten */ +#include +#undef isinf +#define isinf __builtin_isinf +#endif /* __has_builtin(isinf) */ +#endif /* __clang__ && !__cplusplus */ + +#ifndef HAVE_EXPLICIT_BZERO +extern void explicit_bzero(void *buf, size_t len); +#endif + +#ifdef HAVE_BUGGY_STRTOF +extern float pg_strtof(const char *nptr, char **endptr); +#define strtof(a,b) (pg_strtof((a),(b))) +#endif + +#ifdef WIN32 +/* src/port/win32link.c */ +extern int link(const char *src, const char *dst); +#endif + +#ifndef HAVE_MKDTEMP +extern char *mkdtemp(char *path); +#endif + +#ifndef HAVE_INET_ATON +#include +#include +extern int inet_aton(const char *cp, struct in_addr *addr); +#endif + +#if !HAVE_DECL_STRLCAT +extern size_t strlcat(char *dst, const char *src, size_t siz); +#endif + +#if !HAVE_DECL_STRLCPY +extern size_t strlcpy(char *dst, const char *src, size_t siz); +#endif + +#if !HAVE_DECL_STRNLEN +extern size_t strnlen(const char *str, size_t maxlen); +#endif + +#if !HAVE_DECL_STRSEP +extern char *strsep(char **stringp, const char *delim); +#endif + +#if !HAVE_DECL_TIMINGSAFE_BCMP +extern int timingsafe_bcmp(const void *b1, const void *b2, size_t len); +#endif + +/* + * Callers should use the qsort() macro defined below instead of calling + * pg_qsort() directly. + */ +extern void pg_qsort(void *base, size_t nel, size_t elsize, + int (*cmp) (const void *, const void *)); +extern int pg_qsort_strcmp(const void *a, const void *b); + +#define qsort(a,b,c,d) pg_qsort(a,b,c,d) + +typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg); + +extern void qsort_arg(void *base, size_t nel, size_t elsize, + qsort_arg_comparator cmp, void *arg); + +extern void qsort_interruptible(void *base, size_t nel, size_t elsize, + qsort_arg_comparator cmp, void *arg); + +extern void *bsearch_arg(const void *key, const void *base0, + size_t nmemb, size_t size, + int (*compar) (const void *, const void *, void *), + void *arg); + +/* port/pg_localeconv_r.c */ +extern int pg_localeconv_r(const char *lc_monetary, + const char *lc_numeric, + struct lconv *output); +extern void pg_localeconv_free(struct lconv *lconv); + +/* port/chklocale.c */ +extern int pg_get_encoding_from_locale(const char *ctype, bool write_message); + +#if defined(WIN32) && !defined(FRONTEND) +extern int pg_codepage_to_encoding(UINT cp); +#endif + +/* port/inet_net_ntop.c */ +extern char *pg_inet_net_ntop(int af, const void *src, int bits, + char *dst, size_t size); + +/* port/pg_strong_random.c */ +extern void pg_strong_random_init(void); +extern bool pg_strong_random(void *buf, size_t len); + +/* + * pg_backend_random used to be a wrapper for pg_strong_random before + * Postgres 12 for the backend code. + */ +#define pg_backend_random pg_strong_random + +/* port/pgcheckdir.c */ +extern int pg_check_dir(const char *dir); + +/* port/pgmkdirp.c */ +extern int pg_mkdir_p(char *path, int omode); + +/* port/pqsignal.c (see also interfaces/libpq/legacy-pqsignal.c) */ +#ifdef FRONTEND +#define pqsignal pqsignal_fe +#else +#define pqsignal pqsignal_be +#endif +typedef void (*pqsigfunc) (SIGNAL_ARGS); +extern void pqsignal(int signo, pqsigfunc func); + +/* port/quotes.c */ +extern char *escape_single_quotes_ascii(const char *src); + +/* common/wait_error.c */ +extern char *wait_result_to_str(int exitstatus); +extern bool wait_result_is_signal(int exit_status, int signum); +extern bool wait_result_is_any_signal(int exit_status, bool include_command_not_found); +extern int wait_result_to_exit_code(int exit_status); + +/* + * Interfaces that we assume all Unix system have. We retain individual macros + * for better documentation. + * + * For symlink-related functions, there is often no need to test these macros, + * because we provided basic support on Windows that can work with absolute + * paths to directories. Code that wants to test for complete symlink support + * (including relative paths and non-directories) should be conditional on + * HAVE_READLINK or HAVE_SYMLINK. + */ +#ifndef WIN32 +#define HAVE_GETRLIMIT 1 +#define HAVE_POLL 1 +#define HAVE_POLL_H 1 +#define HAVE_READLINK 1 +#define HAVE_SETSID 1 +#define HAVE_SHM_OPEN 1 +#define HAVE_SYMLINK 1 +#endif + +#endif /* PG_PORT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics.h new file mode 100644 index 0000000..074136f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics.h @@ -0,0 +1,611 @@ +/*------------------------------------------------------------------------- + * + * atomics.h + * Atomic operations. + * + * Hardware and compiler dependent functions for manipulating memory + * atomically and dealing with cache coherency. Used to implement locking + * facilities and lockless algorithms/data structures. + * + * To bring up postgres on a platform/compiler at the very least + * implementations for the following operations should be provided: + * * pg_compiler_barrier(), pg_write_barrier(), pg_read_barrier() + * * pg_atomic_compare_exchange_u32(), pg_atomic_fetch_add_u32() + * * pg_atomic_test_set_flag(), pg_atomic_init_flag(), pg_atomic_clear_flag() + * * PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY should be defined if appropriate. + * + * There exist generic, hardware independent, implementations for several + * compilers which might be sufficient, although possibly not optimal, for a + * new platform. If no such generic implementation is available spinlocks will + * be used to implement the 64-bit parts of the API. + * + * Implement _u64 atomics if and only if your platform can use them + * efficiently (and obviously correctly). + * + * Use higher level functionality (lwlocks, spinlocks, heavyweight locks) + * whenever possible. Writing correct code using these facilities is hard. + * + * For an introduction to using memory barriers within the PostgreSQL backend, + * see src/backend/storage/lmgr/README.barrier + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/atomics.h + * + *------------------------------------------------------------------------- + */ +#ifndef ATOMICS_H +#define ATOMICS_H + +#ifdef FRONTEND +#error "atomics.h may not be included from frontend code" +#endif + +#define INSIDE_ATOMICS_H + +#include + +/* + * First a set of architecture specific files is included. + * + * These files can provide the full set of atomics or can do pretty much + * nothing if all the compilers commonly used on these platforms provide + * usable generics. + * + * Don't add an inline assembly of the actual atomic operations if all the + * common implementations of your platform provide intrinsics. Intrinsics are + * much easier to understand and potentially support more architectures. + * + * It will often make sense to define memory barrier semantics here, since + * e.g. generic compiler intrinsics for x86 memory barriers can't know that + * postgres doesn't need x86 read/write barriers do anything more than a + * compiler barrier. + * + */ +#if defined(__arm__) || defined(__arm) || defined(__aarch64__) +#include "port/atomics/arch-arm.h" +#elif defined(__i386__) || defined(__i386) || defined(__x86_64__) +#include "port/atomics/arch-x86.h" +#elif defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__) +#include "port/atomics/arch-ppc.h" +#endif + +/* + * Compiler specific, but architecture independent implementations. + * + * Provide architecture independent implementations of the atomic + * facilities. At the very least compiler barriers should be provided, but a + * full implementation of + * * pg_compiler_barrier(), pg_write_barrier(), pg_read_barrier() + * * pg_atomic_compare_exchange_u32(), pg_atomic_fetch_add_u32() + * using compiler intrinsics are a good idea. + */ +/* + * gcc or compatible, including clang and icc. + */ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#include "port/atomics/generic-gcc.h" +#elif defined(_MSC_VER) +#include "port/atomics/generic-msvc.h" +#elif defined(__SUNPRO_C) && !defined(__GNUC__) +#include "port/atomics/generic-sunpro.h" +#else +/* Unknown compiler. */ +#endif + +/* Fail if we couldn't find implementations of required facilities. */ +#if !defined(PG_HAVE_ATOMIC_U32_SUPPORT) +#error "could not find an implementation of pg_atomic_uint32" +#endif +#if !defined(pg_compiler_barrier_impl) +#error "could not find an implementation of pg_compiler_barrier" +#endif +#if !defined(pg_memory_barrier_impl) +#error "could not find an implementation of pg_memory_barrier_impl" +#endif + + +/* + * Provide a spinlock-based implementation of the 64 bit variants, if + * necessary. + */ +#include "port/atomics/fallback.h" + +/* + * Provide additional operations using supported infrastructure. These are + * expected to be efficient if the underlying atomic operations are efficient. + */ +#include "port/atomics/generic.h" + + +/* + * pg_compiler_barrier - prevent the compiler from moving code across + * + * A compiler barrier need not (and preferably should not) emit any actual + * machine code, but must act as an optimization fence: the compiler must not + * reorder loads or stores to main memory around the barrier. However, the + * CPU may still reorder loads or stores at runtime, if the architecture's + * memory model permits this. + */ +#define pg_compiler_barrier() pg_compiler_barrier_impl() + +/* + * pg_memory_barrier - prevent the CPU from reordering memory access + * + * A memory barrier must act as a compiler barrier, and in addition must + * guarantee that all loads and stores issued prior to the barrier are + * completed before any loads or stores issued after the barrier. Unless + * loads and stores are totally ordered (which is not the case on most + * architectures) this requires issuing some sort of memory fencing + * instruction. + */ +#define pg_memory_barrier() pg_memory_barrier_impl() + +/* + * pg_(read|write)_barrier - prevent the CPU from reordering memory access + * + * A read barrier must act as a compiler barrier, and in addition must + * guarantee that any loads issued prior to the barrier are completed before + * any loads issued after the barrier. Similarly, a write barrier acts + * as a compiler barrier, and also orders stores. Read and write barriers + * are thus weaker than a full memory barrier, but stronger than a compiler + * barrier. In practice, on machines with strong memory ordering, read and + * write barriers may require nothing more than a compiler barrier. + */ +#define pg_read_barrier() pg_read_barrier_impl() +#define pg_write_barrier() pg_write_barrier_impl() + +/* + * Spinloop delay - Allow CPU to relax in busy loops + */ +#define pg_spin_delay() pg_spin_delay_impl() + +/* + * pg_atomic_init_flag - initialize atomic flag. + * + * No barrier semantics. + */ +static inline void +pg_atomic_init_flag(volatile pg_atomic_flag *ptr) +{ + pg_atomic_init_flag_impl(ptr); +} + +/* + * pg_atomic_test_set_flag - TAS() + * + * Returns true if the flag has successfully been set, false otherwise. + * + * Acquire (including read barrier) semantics. + */ +static inline bool +pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_test_set_flag_impl(ptr); +} + +/* + * pg_atomic_unlocked_test_flag - Check if the lock is free + * + * Returns true if the flag currently is not set, false otherwise. + * + * No barrier semantics. + */ +static inline bool +pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_unlocked_test_flag_impl(ptr); +} + +/* + * pg_atomic_clear_flag - release lock set by TAS() + * + * Release (including write barrier) semantics. + */ +static inline void +pg_atomic_clear_flag(volatile pg_atomic_flag *ptr) +{ + pg_atomic_clear_flag_impl(ptr); +} + + +/* + * pg_atomic_init_u32 - initialize atomic variable + * + * Has to be done before any concurrent usage.. + * + * No barrier semantics. + */ +static inline void +pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + AssertPointerAlignment(ptr, 4); + + pg_atomic_init_u32_impl(ptr, val); +} + +/* + * pg_atomic_read_u32 - unlocked read from atomic variable. + * + * The read is guaranteed to return a value as it has been written by this or + * another process at some point in the past. There's however no cache + * coherency interaction guaranteeing the value hasn't since been written to + * again. + * + * No barrier semantics. + */ +static inline uint32 +pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_read_u32_impl(ptr); +} + +/* + * pg_atomic_read_membarrier_u32 - read with barrier semantics. + * + * This read is guaranteed to return the current value, provided that the value + * is only ever updated via operations with barrier semantics, such as + * pg_atomic_compare_exchange_u32() and pg_atomic_write_membarrier_u32(). + * While this may be less performant than pg_atomic_read_u32(), it may be + * easier to reason about correctness with this function in less performance- + * sensitive code. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_read_membarrier_u32(volatile pg_atomic_uint32 *ptr) +{ + AssertPointerAlignment(ptr, 4); + + return pg_atomic_read_membarrier_u32_impl(ptr); +} + +/* + * pg_atomic_write_u32 - write to atomic variable. + * + * The write is guaranteed to succeed as a whole, i.e. it's not possible to + * observe a partial write for any reader. Note that this correctly interacts + * with pg_atomic_compare_exchange_u32, in contrast to + * pg_atomic_unlocked_write_u32(). + * + * No barrier semantics. + */ +static inline void +pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + AssertPointerAlignment(ptr, 4); + + pg_atomic_write_u32_impl(ptr, val); +} + +/* + * pg_atomic_unlocked_write_u32 - unlocked write to atomic variable. + * + * The write is guaranteed to succeed as a whole, i.e. it's not possible to + * observe a partial write for any reader. But note that writing this way is + * not guaranteed to correctly interact with read-modify-write operations like + * pg_atomic_compare_exchange_u32. This should only be used in cases where + * minor performance regressions due to atomics emulation are unacceptable. + * + * No barrier semantics. + */ +static inline void +pg_atomic_unlocked_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + AssertPointerAlignment(ptr, 4); + + pg_atomic_unlocked_write_u32_impl(ptr, val); +} + +/* + * pg_atomic_write_membarrier_u32 - write with barrier semantics. + * + * The write is guaranteed to succeed as a whole, i.e., it's not possible to + * observe a partial write for any reader. Note that this correctly interacts + * with both pg_atomic_compare_exchange_u32() and + * pg_atomic_read_membarrier_u32(). While this may be less performant than + * pg_atomic_write_u32(), it may be easier to reason about correctness with + * this function in less performance-sensitive code. + * + * Full barrier semantics. + */ +static inline void +pg_atomic_write_membarrier_u32(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + AssertPointerAlignment(ptr, 4); + + pg_atomic_write_membarrier_u32_impl(ptr, val); +} + +/* + * pg_atomic_exchange_u32 - exchange newval with current value + * + * Returns the old value of 'ptr' before the swap. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval) +{ + AssertPointerAlignment(ptr, 4); + + return pg_atomic_exchange_u32_impl(ptr, newval); +} + +/* + * pg_atomic_compare_exchange_u32 - CAS operation + * + * Atomically compare the current value of ptr with *expected and store newval + * iff ptr and *expected have the same value. The current value of *ptr will + * always be stored in *expected. + * + * Return true if values have been exchanged, false otherwise. + * + * Full barrier semantics. + */ +static inline bool +pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + AssertPointerAlignment(ptr, 4); + AssertPointerAlignment(expected, 4); + + return pg_atomic_compare_exchange_u32_impl(ptr, expected, newval); +} + +/* + * pg_atomic_fetch_add_u32 - atomically add to variable + * + * Returns the value of ptr before the arithmetic operation. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_fetch_add_u32(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_fetch_add_u32_impl(ptr, add_); +} + +/* + * pg_atomic_fetch_sub_u32 - atomically subtract from variable + * + * Returns the value of ptr before the arithmetic operation. Note that sub_ + * may not be INT_MIN due to platform limitations. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_fetch_sub_u32(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + AssertPointerAlignment(ptr, 4); + Assert(sub_ != INT_MIN); + return pg_atomic_fetch_sub_u32_impl(ptr, sub_); +} + +/* + * pg_atomic_fetch_and_u32 - atomically bit-and and_ with variable + * + * Returns the value of ptr before the arithmetic operation. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_fetch_and_u32(volatile pg_atomic_uint32 *ptr, uint32 and_) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_fetch_and_u32_impl(ptr, and_); +} + +/* + * pg_atomic_fetch_or_u32 - atomically bit-or or_ with variable + * + * Returns the value of ptr before the arithmetic operation. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_fetch_or_u32_impl(ptr, or_); +} + +/* + * pg_atomic_add_fetch_u32 - atomically add to variable + * + * Returns the value of ptr after the arithmetic operation. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_add_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_add_fetch_u32_impl(ptr, add_); +} + +/* + * pg_atomic_sub_fetch_u32 - atomically subtract from variable + * + * Returns the value of ptr after the arithmetic operation. Note that sub_ may + * not be INT_MIN due to platform limitations. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_sub_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + AssertPointerAlignment(ptr, 4); + Assert(sub_ != INT_MIN); + return pg_atomic_sub_fetch_u32_impl(ptr, sub_); +} + +/* ---- + * The 64 bit operations have the same semantics as their 32bit counterparts + * if they are available. Check the corresponding 32bit function for + * documentation. + * ---- + */ +static inline void +pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val) +{ + /* + * Can't necessarily enforce alignment - and don't need it - when using + * the spinlock based fallback implementation. Therefore only assert when + * not using it. + */ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + pg_atomic_init_u64_impl(ptr, val); +} + +static inline uint64 +pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_read_u64_impl(ptr); +} + +static inline uint64 +pg_atomic_read_membarrier_u64(volatile pg_atomic_uint64 *ptr) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_read_membarrier_u64_impl(ptr); +} + +static inline void +pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + pg_atomic_write_u64_impl(ptr, val); +} + +static inline void +pg_atomic_write_membarrier_u64(volatile pg_atomic_uint64 *ptr, uint64 val) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + pg_atomic_write_membarrier_u64_impl(ptr, val); +} + +static inline uint64 +pg_atomic_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 newval) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_exchange_u64_impl(ptr, newval); +} + +static inline bool +pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_compare_exchange_u64_impl(ptr, expected, newval); +} + +static inline uint64 +pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_fetch_add_u64_impl(ptr, add_); +} + +static inline uint64 +pg_atomic_fetch_sub_u64(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + Assert(sub_ != PG_INT64_MIN); + return pg_atomic_fetch_sub_u64_impl(ptr, sub_); +} + +static inline uint64 +pg_atomic_fetch_and_u64(volatile pg_atomic_uint64 *ptr, uint64 and_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_fetch_and_u64_impl(ptr, and_); +} + +static inline uint64 +pg_atomic_fetch_or_u64(volatile pg_atomic_uint64 *ptr, uint64 or_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_fetch_or_u64_impl(ptr, or_); +} + +static inline uint64 +pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_add_fetch_u64_impl(ptr, add_); +} + +static inline uint64 +pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + Assert(sub_ != PG_INT64_MIN); + return pg_atomic_sub_fetch_u64_impl(ptr, sub_); +} + +/* + * Monotonically advance the given variable using only atomic operations until + * it's at least the target value. Returns the latest value observed, which + * may or may not be the target value. + * + * Full barrier semantics (even when value is unchanged). + */ +static inline uint64 +pg_atomic_monotonic_advance_u64(volatile pg_atomic_uint64 *ptr, uint64 target) +{ + uint64 currval; + +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + + currval = pg_atomic_read_u64_impl(ptr); + if (currval >= target) + { + pg_memory_barrier(); + return currval; + } + + while (currval < target) + { + if (pg_atomic_compare_exchange_u64(ptr, &currval, target)) + return target; + } + + return currval; +} + +#undef INSIDE_ATOMICS_H + +#endif /* ATOMICS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/arch-arm.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/arch-arm.h new file mode 100644 index 0000000..eb7e0ac --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/arch-arm.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * arch-arm.h + * Atomic operations considerations specific to ARM + * + * Portions Copyright (c) 2013-2025, PostgreSQL Global Development Group + * + * NOTES: + * + * src/include/port/atomics/arch-arm.h + * + *------------------------------------------------------------------------- + */ + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +#error "should be included via atomics.h" +#endif + +/* + * 64 bit atomics on ARM32 are implemented using kernel fallbacks and thus + * might be slow, so disable entirely. On ARM64 that problem doesn't exist. + */ +#if !defined(__aarch64__) +#define PG_DISABLE_64_BIT_ATOMICS +#else +/* + * Architecture Reference Manual for ARMv8 states aligned read/write to/from + * general purpose register is atomic. + */ +#define PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY +#endif /* __aarch64__ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/arch-ppc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/arch-ppc.h new file mode 100644 index 0000000..b93f676 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/arch-ppc.h @@ -0,0 +1,256 @@ +/*------------------------------------------------------------------------- + * + * arch-ppc.h + * Atomic operations considerations specific to PowerPC + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES: + * + * src/include/port/atomics/arch-ppc.h + * + *------------------------------------------------------------------------- + */ + +#if defined(__GNUC__) + +/* + * lwsync orders loads with respect to each other, and similarly with stores. + * But a load can be performed before a subsequent store, so sync must be used + * for a full memory barrier. + */ +#define pg_memory_barrier_impl() __asm__ __volatile__ ("sync" : : : "memory") +#define pg_read_barrier_impl() __asm__ __volatile__ ("lwsync" : : : "memory") +#define pg_write_barrier_impl() __asm__ __volatile__ ("lwsync" : : : "memory") +#endif + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +/* 64bit atomics are only supported in 64bit mode */ +#if SIZEOF_VOID_P >= 8 +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_atomic_uint64 +{ + volatile uint64 value pg_attribute_aligned(8); +} pg_atomic_uint64; + +#endif + +/* + * This mimics gcc __atomic_compare_exchange_n(..., __ATOMIC_SEQ_CST), but + * code generation differs at the end. __atomic_compare_exchange_n(): + * 100: isync + * 104: mfcr r3 + * 108: rlwinm r3,r3,3,31,31 + * 10c: bne 120 <.eb+0x10> + * 110: clrldi r3,r3,63 + * 114: addi r1,r1,112 + * 118: blr + * 11c: nop + * 120: clrldi r3,r3,63 + * 124: stw r9,0(r4) + * 128: addi r1,r1,112 + * 12c: blr + * + * This: + * f0: isync + * f4: mfcr r9 + * f8: rldicl. r3,r9,35,63 + * fc: bne 104 <.eb> + * 100: stw r10,0(r4) + * 104: addi r1,r1,112 + * 108: blr + * + * This implementation may or may not have materially different performance. + * It's not exploiting the fact that cr0 still holds the relevant comparison + * bits, set during the __asm__. One could fix that by moving more code into + * the __asm__. (That would remove the freedom to eliminate dead stores when + * the caller ignores "expected", but few callers do.) + * + * Recognizing constant "newval" would be superfluous, because there's no + * immediate-operand version of stwcx. + */ +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + uint32 found; + uint32 condition_register; + bool ret; + +#ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P + if (__builtin_constant_p(*expected) && + (int32) *expected <= PG_INT16_MAX && + (int32) *expected >= PG_INT16_MIN) + __asm__ __volatile__( + " sync \n" + " lwarx %0,0,%5,1 \n" + " cmpwi %0,%3 \n" + " bne $+12 \n" /* branch to lwsync */ + " stwcx. %4,0,%5 \n" + " bne $-16 \n" /* branch to lwarx */ + " lwsync \n" + " mfcr %1 \n" +: "=&r"(found), "=r"(condition_register), "+m"(ptr->value) +: "i"(*expected), "r"(newval), "r"(&ptr->value) +: "memory", "cc"); + else +#endif + __asm__ __volatile__( + " sync \n" + " lwarx %0,0,%5,1 \n" + " cmpw %0,%3 \n" + " bne $+12 \n" /* branch to lwsync */ + " stwcx. %4,0,%5 \n" + " bne $-16 \n" /* branch to lwarx */ + " lwsync \n" + " mfcr %1 \n" +: "=&r"(found), "=r"(condition_register), "+m"(ptr->value) +: "r"(*expected), "r"(newval), "r"(&ptr->value) +: "memory", "cc"); + + ret = (condition_register >> 29) & 1; /* test eq bit of cr0 */ + if (!ret) + *expected = found; + return ret; +} + +/* + * This mirrors gcc __sync_fetch_and_add(). + * + * Like tas(), use constraint "=&b" to avoid allocating r0. + */ +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + uint32 _t; + uint32 res; + +#ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P + if (__builtin_constant_p(add_) && + add_ <= PG_INT16_MAX && add_ >= PG_INT16_MIN) + __asm__ __volatile__( + " sync \n" + " lwarx %1,0,%4,1 \n" + " addi %0,%1,%3 \n" + " stwcx. %0,0,%4 \n" + " bne $-12 \n" /* branch to lwarx */ + " lwsync \n" +: "=&r"(_t), "=&b"(res), "+m"(ptr->value) +: "i"(add_), "r"(&ptr->value) +: "memory", "cc"); + else +#endif + __asm__ __volatile__( + " sync \n" + " lwarx %1,0,%4,1 \n" + " add %0,%1,%3 \n" + " stwcx. %0,0,%4 \n" + " bne $-12 \n" /* branch to lwarx */ + " lwsync \n" +: "=&r"(_t), "=&r"(res), "+m"(ptr->value) +: "r"(add_), "r"(&ptr->value) +: "memory", "cc"); + + return res; +} + +#ifdef PG_HAVE_ATOMIC_U64_SUPPORT + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + uint64 found; + uint32 condition_register; + bool ret; + + AssertPointerAlignment(expected, 8); + + /* Like u32, but s/lwarx/ldarx/; s/stwcx/stdcx/; s/cmpw/cmpd/ */ +#ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P + if (__builtin_constant_p(*expected) && + (int64) *expected <= PG_INT16_MAX && + (int64) *expected >= PG_INT16_MIN) + __asm__ __volatile__( + " sync \n" + " ldarx %0,0,%5,1 \n" + " cmpdi %0,%3 \n" + " bne $+12 \n" /* branch to lwsync */ + " stdcx. %4,0,%5 \n" + " bne $-16 \n" /* branch to ldarx */ + " lwsync \n" + " mfcr %1 \n" +: "=&r"(found), "=r"(condition_register), "+m"(ptr->value) +: "i"(*expected), "r"(newval), "r"(&ptr->value) +: "memory", "cc"); + else +#endif + __asm__ __volatile__( + " sync \n" + " ldarx %0,0,%5,1 \n" + " cmpd %0,%3 \n" + " bne $+12 \n" /* branch to lwsync */ + " stdcx. %4,0,%5 \n" + " bne $-16 \n" /* branch to ldarx */ + " lwsync \n" + " mfcr %1 \n" +: "=&r"(found), "=r"(condition_register), "+m"(ptr->value) +: "r"(*expected), "r"(newval), "r"(&ptr->value) +: "memory", "cc"); + + ret = (condition_register >> 29) & 1; /* test eq bit of cr0 */ + if (!ret) + *expected = found; + return ret; +} + +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + uint64 _t; + uint64 res; + + /* Like u32, but s/lwarx/ldarx/; s/stwcx/stdcx/ */ +#ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P + if (__builtin_constant_p(add_) && + add_ <= PG_INT16_MAX && add_ >= PG_INT16_MIN) + __asm__ __volatile__( + " sync \n" + " ldarx %1,0,%4,1 \n" + " addi %0,%1,%3 \n" + " stdcx. %0,0,%4 \n" + " bne $-12 \n" /* branch to ldarx */ + " lwsync \n" +: "=&r"(_t), "=&b"(res), "+m"(ptr->value) +: "i"(add_), "r"(&ptr->value) +: "memory", "cc"); + else +#endif + __asm__ __volatile__( + " sync \n" + " ldarx %1,0,%4,1 \n" + " add %0,%1,%3 \n" + " stdcx. %0,0,%4 \n" + " bne $-12 \n" /* branch to ldarx */ + " lwsync \n" +: "=&r"(_t), "=&r"(res), "+m"(ptr->value) +: "r"(add_), "r"(&ptr->value) +: "memory", "cc"); + + return res; +} + +#endif /* PG_HAVE_ATOMIC_U64_SUPPORT */ + +/* per architecture manual doubleword accesses have single copy atomicity */ +#define PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/arch-x86.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/arch-x86.h new file mode 100644 index 0000000..8983dd8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/arch-x86.h @@ -0,0 +1,246 @@ +/*------------------------------------------------------------------------- + * + * arch-x86.h + * Atomic operations considerations specific to intel x86 + * + * Note that we actually require a 486 upwards because the 386 doesn't have + * support for xadd and cmpxchg. Given that the 386 isn't supported anywhere + * anymore that's not much of a restriction luckily. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES: + * + * src/include/port/atomics/arch-x86.h + * + *------------------------------------------------------------------------- + */ + +/* + * Both 32 and 64 bit x86 do not allow loads to be reordered with other loads, + * or stores to be reordered with other stores, but a load can be performed + * before a subsequent store. + * + * Technically, some x86-ish chips support uncached memory access and/or + * special instructions that are weakly ordered. In those cases we'd need + * the read and write barriers to be lfence and sfence. But since we don't + * do those things, a compiler barrier should be enough. + * + * "lock; addl" has worked for longer than "mfence". It's also rumored to be + * faster in many scenarios. + */ + +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#if defined(__i386__) || defined(__i386) +#define pg_memory_barrier_impl() \ + __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory", "cc") +#elif defined(__x86_64__) +#define pg_memory_barrier_impl() \ + __asm__ __volatile__ ("lock; addl $0,0(%%rsp)" : : : "memory", "cc") +#endif +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ + +#define pg_read_barrier_impl() pg_compiler_barrier_impl() +#define pg_write_barrier_impl() pg_compiler_barrier_impl() + +/* + * Provide implementation for atomics using inline assembly on x86 gcc. It's + * nice to support older gcc's and the compare/exchange implementation here is + * actually more efficient than the * __sync variant. + */ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) + +#define PG_HAVE_ATOMIC_FLAG_SUPPORT +typedef struct pg_atomic_flag +{ + volatile char value; +} pg_atomic_flag; + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +/* + * It's too complicated to write inline asm for 64bit types on 32bit and the + * 486 can't do it anyway. + */ +#ifdef __x86_64__ +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_atomic_uint64 +{ + /* alignment guaranteed due to being on a 64bit platform */ + volatile uint64 value; +} pg_atomic_uint64; +#endif /* __x86_64__ */ + +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ + +#if !defined(PG_HAVE_SPIN_DELAY) +/* + * This sequence is equivalent to the PAUSE instruction ("rep" is + * ignored by old IA32 processors if the following instruction is + * not a string operation); the IA-32 Architecture Software + * Developer's Manual, Vol. 3, Section 7.7.2 describes why using + * PAUSE in the inner loop of a spin lock is necessary for good + * performance: + * + * The PAUSE instruction improves the performance of IA-32 + * processors supporting Hyper-Threading Technology when + * executing spin-wait loops and other routines where one + * thread is accessing a shared lock or semaphore in a tight + * polling loop. When executing a spin-wait loop, the + * processor can suffer a severe performance penalty when + * exiting the loop because it detects a possible memory order + * violation and flushes the core processor's pipeline. The + * PAUSE instruction provides a hint to the processor that the + * code sequence is a spin-wait loop. The processor uses this + * hint to avoid the memory order violation and prevent the + * pipeline flush. In addition, the PAUSE instruction + * de-pipelines the spin-wait loop to prevent it from + * consuming execution resources excessively. + */ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#define PG_HAVE_SPIN_DELAY +static __inline__ void +pg_spin_delay_impl(void) +{ + __asm__ __volatile__(" rep; nop \n"); +} +#elif defined(_MSC_VER) && defined(__x86_64__) +#define PG_HAVE_SPIN_DELAY +static __forceinline void +pg_spin_delay_impl(void) +{ + _mm_pause(); +} +#elif defined(_MSC_VER) +#define PG_HAVE_SPIN_DELAY +static __forceinline void +pg_spin_delay_impl(void) +{ + /* See comment for gcc code. Same code, MASM syntax */ + __asm rep nop; +} +#endif +#endif /* !defined(PG_HAVE_SPIN_DELAY) */ + + +#if defined(__GNUC__) || defined(__INTEL_COMPILER) + +#define PG_HAVE_ATOMIC_TEST_SET_FLAG +static inline bool +pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr) +{ + char _res = 1; + + __asm__ __volatile__( + " lock \n" + " xchgb %0,%1 \n" +: "+q"(_res), "+m"(ptr->value) +: +: "memory"); + return _res == 0; +} + +#define PG_HAVE_ATOMIC_CLEAR_FLAG +static inline void +pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr) +{ + /* + * On a TSO architecture like x86 it's sufficient to use a compiler + * barrier to achieve release semantics. + */ + __asm__ __volatile__("" ::: "memory"); + ptr->value = 0; +} + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + char ret; + + /* + * Perform cmpxchg and use the zero flag which it implicitly sets when + * equal to measure the success. + */ + __asm__ __volatile__( + " lock \n" + " cmpxchgl %4,%5 \n" + " setz %2 \n" +: "=a" (*expected), "=m"(ptr->value), "=q" (ret) +: "a" (*expected), "r" (newval), "m"(ptr->value) +: "memory", "cc"); + return (bool) ret; +} + +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + uint32 res; + __asm__ __volatile__( + " lock \n" + " xaddl %0,%1 \n" +: "=q"(res), "=m"(ptr->value) +: "0" (add_), "m"(ptr->value) +: "memory", "cc"); + return res; +} + +#ifdef __x86_64__ + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + char ret; + + AssertPointerAlignment(expected, 8); + + /* + * Perform cmpxchg and use the zero flag which it implicitly sets when + * equal to measure the success. + */ + __asm__ __volatile__( + " lock \n" + " cmpxchgq %4,%5 \n" + " setz %2 \n" +: "=a" (*expected), "=m"(ptr->value), "=q" (ret) +: "a" (*expected), "r" (newval), "m"(ptr->value) +: "memory", "cc"); + return (bool) ret; +} + +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + uint64 res; + __asm__ __volatile__( + " lock \n" + " xaddq %0,%1 \n" +: "=q"(res), "=m"(ptr->value) +: "0" (add_), "m"(ptr->value) +: "memory", "cc"); + return res; +} + +#endif /* __x86_64__ */ + +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ + +/* + * 8 byte reads / writes have single-copy atomicity on 32 bit x86 platforms + * since at least the 586. As well as on all x86-64 cpus. + */ +#if defined(__i568__) || defined(__i668__) || /* gcc i586+ */ \ + (defined(_M_IX86) && _M_IX86 >= 500) || /* msvc i586+ */ \ + defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) /* gcc, sunpro, msvc */ +#define PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY +#endif /* 8 byte single-copy atomicity */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/fallback.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/fallback.h new file mode 100644 index 0000000..d2f1b85 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/fallback.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * fallback.h + * Fallback for platforms without 64 bit atomics support. Slower + * than native atomics support, but not unusably slow. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/atomics/fallback.h + * + *------------------------------------------------------------------------- + */ + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +# error "should be included via atomics.h" +#endif + + +#if !defined(PG_HAVE_ATOMIC_U64_SUPPORT) + +#define PG_HAVE_ATOMIC_U64_SIMULATION + +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_atomic_uint64 +{ + int sema; + volatile uint64 value; +} pg_atomic_uint64; + +#define PG_HAVE_ATOMIC_INIT_U64 +extern void pg_atomic_init_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val_); + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +extern bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval); + +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +extern uint64 pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_); + +#endif /* PG_HAVE_ATOMIC_U64_SUPPORT */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic-gcc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic-gcc.h new file mode 100644 index 0000000..1143c84 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic-gcc.h @@ -0,0 +1,327 @@ +/*------------------------------------------------------------------------- + * + * generic-gcc.h + * Atomic operations, implemented using gcc (or compatible) intrinsics. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES: + * + * Documentation: + * * Legacy __sync Built-in Functions for Atomic Memory Access + * https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/_005f_005fsync-Builtins.html + * * Built-in functions for memory model aware atomic operations + * https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/_005f_005fatomic-Builtins.html + * + * src/include/port/atomics/generic-gcc.h + * + *------------------------------------------------------------------------- + */ + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +#error "should be included via atomics.h" +#endif + +/* + * An empty asm block should be a sufficient compiler barrier. + */ +#define pg_compiler_barrier_impl() __asm__ __volatile__("" ::: "memory") + +/* + * If we're on GCC 4.1.0 or higher, we should be able to get a memory barrier + * out of this compiler built-in. But we prefer to rely on platform specific + * definitions where possible, and use this only as a fallback. + */ +#if !defined(pg_memory_barrier_impl) +# if defined(HAVE_GCC__ATOMIC_INT32_CAS) +# define pg_memory_barrier_impl() __atomic_thread_fence(__ATOMIC_SEQ_CST) +# elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) +# define pg_memory_barrier_impl() __sync_synchronize() +# endif +#endif /* !defined(pg_memory_barrier_impl) */ + +#if !defined(pg_read_barrier_impl) && defined(HAVE_GCC__ATOMIC_INT32_CAS) +/* acquire semantics include read barrier semantics */ +# define pg_read_barrier_impl() do \ +{ \ + pg_compiler_barrier_impl(); \ + __atomic_thread_fence(__ATOMIC_ACQUIRE); \ +} while (0) +#endif + +#if !defined(pg_write_barrier_impl) && defined(HAVE_GCC__ATOMIC_INT32_CAS) +/* release semantics include write barrier semantics */ +# define pg_write_barrier_impl() do \ +{ \ + pg_compiler_barrier_impl(); \ + __atomic_thread_fence(__ATOMIC_RELEASE); \ +} while (0) +#endif + + +/* generic gcc based atomic flag implementation */ +#if !defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) \ + && (defined(HAVE_GCC__SYNC_INT32_TAS) || defined(HAVE_GCC__SYNC_CHAR_TAS)) + +#define PG_HAVE_ATOMIC_FLAG_SUPPORT +typedef struct pg_atomic_flag +{ + /* + * If we have a choice, use int-width TAS, because that is more efficient + * and/or more reliably implemented on most non-Intel platforms. (Note + * that this code isn't used on x86[_64]; see arch-x86.h for that.) + */ +#ifdef HAVE_GCC__SYNC_INT32_TAS + volatile int value; +#else + volatile char value; +#endif +} pg_atomic_flag; + +#endif /* !ATOMIC_FLAG_SUPPORT && SYNC_INT32_TAS */ + +/* generic gcc based atomic uint32 implementation */ +#if !defined(PG_HAVE_ATOMIC_U32_SUPPORT) \ + && (defined(HAVE_GCC__ATOMIC_INT32_CAS) || defined(HAVE_GCC__SYNC_INT32_CAS)) + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +#endif /* defined(HAVE_GCC__ATOMIC_INT32_CAS) || defined(HAVE_GCC__SYNC_INT32_CAS) */ + +/* generic gcc based atomic uint64 implementation */ +#if !defined(PG_HAVE_ATOMIC_U64_SUPPORT) \ + && !defined(PG_DISABLE_64_BIT_ATOMICS) \ + && (defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS)) + +#define PG_HAVE_ATOMIC_U64_SUPPORT + +typedef struct pg_atomic_uint64 +{ + volatile uint64 value pg_attribute_aligned(8); +} pg_atomic_uint64; + +#endif /* defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS) */ + +#ifdef PG_HAVE_ATOMIC_FLAG_SUPPORT + +#if defined(HAVE_GCC__SYNC_CHAR_TAS) || defined(HAVE_GCC__SYNC_INT32_TAS) + +#ifndef PG_HAVE_ATOMIC_TEST_SET_FLAG +#define PG_HAVE_ATOMIC_TEST_SET_FLAG +static inline bool +pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr) +{ + /* NB: only an acquire barrier, not a full one */ + /* some platform only support a 1 here */ + return __sync_lock_test_and_set(&ptr->value, 1) == 0; +} +#endif + +#endif /* defined(HAVE_GCC__SYNC_*_TAS) */ + +#ifndef PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG +#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG +static inline bool +pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr) +{ + return ptr->value == 0; +} +#endif + +#ifndef PG_HAVE_ATOMIC_CLEAR_FLAG +#define PG_HAVE_ATOMIC_CLEAR_FLAG +static inline void +pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr) +{ + __sync_lock_release(&ptr->value); +} +#endif + +#ifndef PG_HAVE_ATOMIC_INIT_FLAG +#define PG_HAVE_ATOMIC_INIT_FLAG +static inline void +pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr) +{ + pg_atomic_clear_flag_impl(ptr); +} +#endif + +#endif /* defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) */ + +/* prefer __atomic, it has a better API */ +#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) && defined(HAVE_GCC__ATOMIC_INT32_CAS) +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + /* FIXME: we can probably use a lower consistency model */ + return __atomic_compare_exchange_n(&ptr->value, expected, newval, false, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + bool ret; + uint32 current; + current = __sync_val_compare_and_swap(&ptr->value, *expected, newval); + ret = current == *expected; + *expected = current; + return ret; +} +#endif + +/* + * __sync_lock_test_and_set() only supports setting the value to 1 on some + * platforms, so we only provide an __atomic implementation for + * pg_atomic_exchange. + * + * We assume the availability of 32-bit __atomic_compare_exchange_n() implies + * the availability of 32-bit __atomic_exchange_n(). + */ +#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U32) && defined(HAVE_GCC__ATOMIC_INT32_CAS) +#define PG_HAVE_ATOMIC_EXCHANGE_U32 +static inline uint32 +pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 newval) +{ + return __atomic_exchange_n(&ptr->value, newval, __ATOMIC_SEQ_CST); +} +#endif + +/* if we have 32-bit __sync_val_compare_and_swap, assume we have these too: */ + +#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + return __sync_fetch_and_add(&ptr->value, add_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_FETCH_SUB_U32 +static inline uint32 +pg_atomic_fetch_sub_u32_impl(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + return __sync_fetch_and_sub(&ptr->value, sub_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_FETCH_AND_U32 +static inline uint32 +pg_atomic_fetch_and_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 and_) +{ + return __sync_fetch_and_and(&ptr->value, and_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_FETCH_OR_U32 +static inline uint32 +pg_atomic_fetch_or_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 or_) +{ + return __sync_fetch_and_or(&ptr->value, or_); +} +#endif + + +#if !defined(PG_DISABLE_64_BIT_ATOMICS) + +#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) && defined(HAVE_GCC__ATOMIC_INT64_CAS) +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + AssertPointerAlignment(expected, 8); + return __atomic_compare_exchange_n(&ptr->value, expected, newval, false, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + bool ret; + uint64 current; + + AssertPointerAlignment(expected, 8); + current = __sync_val_compare_and_swap(&ptr->value, *expected, newval); + ret = current == *expected; + *expected = current; + return ret; +} +#endif + +/* + * __sync_lock_test_and_set() only supports setting the value to 1 on some + * platforms, so we only provide an __atomic implementation for + * pg_atomic_exchange. + * + * We assume the availability of 64-bit __atomic_compare_exchange_n() implies + * the availability of 64-bit __atomic_exchange_n(). + */ +#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U64) && defined(HAVE_GCC__ATOMIC_INT64_CAS) +#define PG_HAVE_ATOMIC_EXCHANGE_U64 +static inline uint64 +pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 newval) +{ + return __atomic_exchange_n(&ptr->value, newval, __ATOMIC_SEQ_CST); +} +#endif + +/* if we have 64-bit __sync_val_compare_and_swap, assume we have these too: */ + +#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + return __sync_fetch_and_add(&ptr->value, add_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_FETCH_SUB_U64 +static inline uint64 +pg_atomic_fetch_sub_u64_impl(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ + return __sync_fetch_and_sub(&ptr->value, sub_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_FETCH_AND_U64 +static inline uint64 +pg_atomic_fetch_and_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 and_) +{ + return __sync_fetch_and_and(&ptr->value, and_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_FETCH_OR_U64 +static inline uint64 +pg_atomic_fetch_or_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 or_) +{ + return __sync_fetch_and_or(&ptr->value, or_); +} +#endif + +#endif /* !defined(PG_DISABLE_64_BIT_ATOMICS) */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic-msvc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic-msvc.h new file mode 100644 index 0000000..a6ea5f1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic-msvc.h @@ -0,0 +1,115 @@ +/*------------------------------------------------------------------------- + * + * generic-msvc.h + * Atomic operations support when using MSVC + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES: + * + * Documentation: + * * Interlocked Variable Access + * http://msdn.microsoft.com/en-us/library/ms684122%28VS.85%29.aspx + * + * src/include/port/atomics/generic-msvc.h + * + *------------------------------------------------------------------------- + */ +#include + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +#error "should be included via atomics.h" +#endif + +#pragma intrinsic(_ReadWriteBarrier) +#define pg_compiler_barrier_impl() _ReadWriteBarrier() + +#ifndef pg_memory_barrier_impl +#define pg_memory_barrier_impl() MemoryBarrier() +#endif + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_attribute_aligned(8) pg_atomic_uint64 +{ + volatile uint64 value; +} pg_atomic_uint64; + + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + bool ret; + uint32 current; + current = InterlockedCompareExchange(&ptr->value, newval, *expected); + ret = current == *expected; + *expected = current; + return ret; +} + +#define PG_HAVE_ATOMIC_EXCHANGE_U32 +static inline uint32 +pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 newval) +{ + return InterlockedExchange(&ptr->value, newval); +} + +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + return InterlockedExchangeAdd(&ptr->value, add_); +} + +/* + * The non-intrinsics versions are only available in vista upwards, so use the + * intrinsic version. Only supported on >486, but we require XP as a minimum + * baseline, which doesn't support the 486, so we don't need to add checks for + * that case. + */ +#pragma intrinsic(_InterlockedCompareExchange64) + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + bool ret; + uint64 current; + current = _InterlockedCompareExchange64(&ptr->value, newval, *expected); + ret = current == *expected; + *expected = current; + return ret; +} + +/* Only implemented on 64bit builds */ +#ifdef _WIN64 + +#pragma intrinsic(_InterlockedExchange64) + +#define PG_HAVE_ATOMIC_EXCHANGE_U64 +static inline uint64 +pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 newval) +{ + return _InterlockedExchange64(&ptr->value, newval); +} + +#pragma intrinsic(_InterlockedExchangeAdd64) + +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + return _InterlockedExchangeAdd64(&ptr->value, add_); +} + +#endif /* _WIN64 */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic-sunpro.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic-sunpro.h new file mode 100644 index 0000000..09bba0b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic-sunpro.h @@ -0,0 +1,113 @@ +/*------------------------------------------------------------------------- + * + * generic-sunpro.h + * Atomic operations for solaris' CC + * + * Portions Copyright (c) 2013-2025, PostgreSQL Global Development Group + * + * NOTES: + * + * Documentation: + * * manpage for atomic_cas(3C) + * http://www.unix.com/man-page/opensolaris/3c/atomic_cas/ + * http://docs.oracle.com/cd/E23824_01/html/821-1465/atomic-cas-3c.html + * + * src/include/port/atomics/generic-sunpro.h + * + * ------------------------------------------------------------------------- + */ + +#ifdef HAVE_MBARRIER_H +#include + +#define pg_compiler_barrier_impl() __compiler_barrier() + +#ifndef pg_memory_barrier_impl +/* + * Despite the name this is actually a full barrier. Expanding to mfence/ + * membar #StoreStore | #LoadStore | #StoreLoad | #LoadLoad on x86/sparc + * respectively. + */ +# define pg_memory_barrier_impl() __machine_rw_barrier() +#endif +#ifndef pg_read_barrier_impl +# define pg_read_barrier_impl() __machine_r_barrier() +#endif +#ifndef pg_write_barrier_impl +# define pg_write_barrier_impl() __machine_w_barrier() +#endif + +#endif /* HAVE_MBARRIER_H */ + +/* Older versions of the compiler don't have atomic.h... */ +#ifdef HAVE_ATOMIC_H + +#include + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_atomic_uint64 +{ + /* + * Syntax to enforce variable alignment should be supported by versions + * supporting atomic.h, but it's hard to find accurate documentation. If + * it proves to be a problem, we'll have to add more version checks for 64 + * bit support. + */ + volatile uint64 value pg_attribute_aligned(8); +} pg_atomic_uint64; + +#endif /* HAVE_ATOMIC_H */ + + +#ifdef HAVE_ATOMIC_H + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + bool ret; + uint32 current; + + current = atomic_cas_32(&ptr->value, *expected, newval); + ret = current == *expected; + *expected = current; + return ret; +} + +#define PG_HAVE_ATOMIC_EXCHANGE_U32 +static inline uint32 +pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 newval) +{ + return atomic_swap_32(&ptr->value, newval); +} + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + bool ret; + uint64 current; + + AssertPointerAlignment(expected, 8); + current = atomic_cas_64(&ptr->value, *expected, newval); + ret = current == *expected; + *expected = current; + return ret; +} + +#define PG_HAVE_ATOMIC_EXCHANGE_U64 +static inline uint64 +pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 newval) +{ + return atomic_swap_64(&ptr->value, newval); +} + +#endif /* HAVE_ATOMIC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic.h new file mode 100644 index 0000000..6b61a7b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/atomics/generic.h @@ -0,0 +1,427 @@ +/*------------------------------------------------------------------------- + * + * generic.h + * Implement higher level operations based on some lower level atomic + * operations. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/atomics/generic.h + * + *------------------------------------------------------------------------- + */ + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +# error "should be included via atomics.h" +#endif + +/* + * If read or write barriers are undefined, we upgrade them to full memory + * barriers. + */ +#if !defined(pg_read_barrier_impl) +# define pg_read_barrier_impl pg_memory_barrier_impl +#endif +#if !defined(pg_write_barrier_impl) +# define pg_write_barrier_impl pg_memory_barrier_impl +#endif + +#ifndef PG_HAVE_SPIN_DELAY +#define PG_HAVE_SPIN_DELAY +#define pg_spin_delay_impl() ((void)0) +#endif + + +/* provide fallback */ +#if !defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) && defined(PG_HAVE_ATOMIC_U32_SUPPORT) +#define PG_HAVE_ATOMIC_FLAG_SUPPORT +typedef pg_atomic_uint32 pg_atomic_flag; +#endif + +#ifndef PG_HAVE_ATOMIC_READ_U32 +#define PG_HAVE_ATOMIC_READ_U32 +static inline uint32 +pg_atomic_read_u32_impl(volatile pg_atomic_uint32 *ptr) +{ + return ptr->value; +} +#endif + +#ifndef PG_HAVE_ATOMIC_WRITE_U32 +#define PG_HAVE_ATOMIC_WRITE_U32 +static inline void +pg_atomic_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + ptr->value = val; +} +#endif + +#ifndef PG_HAVE_ATOMIC_UNLOCKED_WRITE_U32 +#define PG_HAVE_ATOMIC_UNLOCKED_WRITE_U32 +static inline void +pg_atomic_unlocked_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + ptr->value = val; +} +#endif + +/* + * provide fallback for test_and_set using atomic_exchange if available + */ +#if !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && defined(PG_HAVE_ATOMIC_EXCHANGE_U32) + +#define PG_HAVE_ATOMIC_INIT_FLAG +static inline void +pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr) +{ + pg_atomic_write_u32_impl(ptr, 0); +} + +#define PG_HAVE_ATOMIC_TEST_SET_FLAG +static inline bool +pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_exchange_u32_impl(ptr, 1) == 0; +} + +#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG +static inline bool +pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_read_u32_impl(ptr) == 0; +} + + +#define PG_HAVE_ATOMIC_CLEAR_FLAG +static inline void +pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr) +{ + /* XXX: release semantics suffice? */ + pg_memory_barrier_impl(); + pg_atomic_write_u32_impl(ptr, 0); +} + +/* + * provide fallback for test_and_set using atomic_compare_exchange if + * available. + */ +#elif !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) + +#define PG_HAVE_ATOMIC_INIT_FLAG +static inline void +pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr) +{ + pg_atomic_write_u32_impl(ptr, 0); +} + +#define PG_HAVE_ATOMIC_TEST_SET_FLAG +static inline bool +pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr) +{ + uint32 value = 0; + return pg_atomic_compare_exchange_u32_impl(ptr, &value, 1); +} + +#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG +static inline bool +pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_read_u32_impl(ptr) == 0; +} + +#define PG_HAVE_ATOMIC_CLEAR_FLAG +static inline void +pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr) +{ + /* XXX: release semantics suffice? */ + pg_memory_barrier_impl(); + pg_atomic_write_u32_impl(ptr, 0); +} + +#elif !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) +# error "No pg_atomic_test_and_set provided" +#endif /* !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) */ + + +#ifndef PG_HAVE_ATOMIC_INIT_U32 +#define PG_HAVE_ATOMIC_INIT_U32 +static inline void +pg_atomic_init_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val_) +{ + ptr->value = val_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_EXCHANGE_U32 +static inline uint32 +pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 xchg_) +{ + uint32 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u32_impl(ptr, &old, xchg_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + uint32 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u32_impl(ptr, &old, old + add_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_FETCH_SUB_U32 +static inline uint32 +pg_atomic_fetch_sub_u32_impl(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + return pg_atomic_fetch_add_u32_impl(ptr, -sub_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_FETCH_AND_U32 +static inline uint32 +pg_atomic_fetch_and_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 and_) +{ + uint32 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u32_impl(ptr, &old, old & and_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_FETCH_OR_U32 +static inline uint32 +pg_atomic_fetch_or_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 or_) +{ + uint32 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u32_impl(ptr, &old, old | or_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_ADD_FETCH_U32) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) +#define PG_HAVE_ATOMIC_ADD_FETCH_U32 +static inline uint32 +pg_atomic_add_fetch_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + return pg_atomic_fetch_add_u32_impl(ptr, add_) + add_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_SUB_FETCH_U32) && defined(PG_HAVE_ATOMIC_FETCH_SUB_U32) +#define PG_HAVE_ATOMIC_SUB_FETCH_U32 +static inline uint32 +pg_atomic_sub_fetch_u32_impl(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + return pg_atomic_fetch_sub_u32_impl(ptr, sub_) - sub_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_READ_MEMBARRIER_U32) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) +#define PG_HAVE_ATOMIC_READ_MEMBARRIER_U32 +static inline uint32 +pg_atomic_read_membarrier_u32_impl(volatile pg_atomic_uint32 *ptr) +{ + return pg_atomic_fetch_add_u32_impl(ptr, 0); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_WRITE_MEMBARRIER_U32) && defined(PG_HAVE_ATOMIC_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_WRITE_MEMBARRIER_U32 +static inline void +pg_atomic_write_membarrier_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + (void) pg_atomic_exchange_u32_impl(ptr, val); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_EXCHANGE_U64 +static inline uint64 +pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 xchg_) +{ + uint64 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u64_impl(ptr, &old, xchg_)) + /* skip */; + return old; +} +#endif + +#ifndef PG_HAVE_ATOMIC_WRITE_U64 +#define PG_HAVE_ATOMIC_WRITE_U64 + +#if defined(PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY) && \ + !defined(PG_HAVE_ATOMIC_U64_SIMULATION) + +static inline void +pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val) +{ + /* + * On this platform aligned 64bit writes are guaranteed to be atomic, + * except if using the fallback implementation, where can't guarantee the + * required alignment. + */ + AssertPointerAlignment(ptr, 8); + ptr->value = val; +} + +#else + +static inline void +pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val) +{ + /* + * 64 bit writes aren't safe on all platforms. In the generic + * implementation implement them as an atomic exchange. + */ + pg_atomic_exchange_u64_impl(ptr, val); +} + +#endif /* PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY && !PG_HAVE_ATOMIC_U64_SIMULATION */ +#endif /* PG_HAVE_ATOMIC_WRITE_U64 */ + +#ifndef PG_HAVE_ATOMIC_READ_U64 +#define PG_HAVE_ATOMIC_READ_U64 + +#if defined(PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY) && \ + !defined(PG_HAVE_ATOMIC_U64_SIMULATION) + +static inline uint64 +pg_atomic_read_u64_impl(volatile pg_atomic_uint64 *ptr) +{ + /* + * On this platform aligned 64-bit reads are guaranteed to be atomic. + */ + AssertPointerAlignment(ptr, 8); + return ptr->value; +} + +#else + +static inline uint64 +pg_atomic_read_u64_impl(volatile pg_atomic_uint64 *ptr) +{ + uint64 old = 0; + + /* + * 64-bit reads aren't atomic on all platforms. In the generic + * implementation implement them as a compare/exchange with 0. That'll + * fail or succeed, but always return the old value. Possibly might store + * a 0, but only if the previous value also was a 0 - i.e. harmless. + */ + pg_atomic_compare_exchange_u64_impl(ptr, &old, 0); + + return old; +} +#endif /* PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY && !PG_HAVE_ATOMIC_U64_SIMULATION */ +#endif /* PG_HAVE_ATOMIC_READ_U64 */ + +#ifndef PG_HAVE_ATOMIC_INIT_U64 +#define PG_HAVE_ATOMIC_INIT_U64 +static inline void +pg_atomic_init_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val_) +{ + ptr->value = val_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + uint64 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u64_impl(ptr, &old, old + add_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_FETCH_SUB_U64 +static inline uint64 +pg_atomic_fetch_sub_u64_impl(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ + return pg_atomic_fetch_add_u64_impl(ptr, -sub_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_FETCH_AND_U64 +static inline uint64 +pg_atomic_fetch_and_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 and_) +{ + uint64 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u64_impl(ptr, &old, old & and_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_FETCH_OR_U64 +static inline uint64 +pg_atomic_fetch_or_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 or_) +{ + uint64 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u64_impl(ptr, &old, old | or_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_ADD_FETCH_U64) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) +#define PG_HAVE_ATOMIC_ADD_FETCH_U64 +static inline uint64 +pg_atomic_add_fetch_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + return pg_atomic_fetch_add_u64_impl(ptr, add_) + add_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_SUB_FETCH_U64) && defined(PG_HAVE_ATOMIC_FETCH_SUB_U64) +#define PG_HAVE_ATOMIC_SUB_FETCH_U64 +static inline uint64 +pg_atomic_sub_fetch_u64_impl(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ + return pg_atomic_fetch_sub_u64_impl(ptr, sub_) - sub_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_READ_MEMBARRIER_U64) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) +#define PG_HAVE_ATOMIC_READ_MEMBARRIER_U64 +static inline uint64 +pg_atomic_read_membarrier_u64_impl(volatile pg_atomic_uint64 *ptr) +{ + return pg_atomic_fetch_add_u64_impl(ptr, 0); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_WRITE_MEMBARRIER_U64) && defined(PG_HAVE_ATOMIC_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_WRITE_MEMBARRIER_U64 +static inline void +pg_atomic_write_membarrier_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val) +{ + (void) pg_atomic_exchange_u64_impl(ptr, val); +} +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/cygwin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/cygwin.h new file mode 100644 index 0000000..44bf853 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/cygwin.h @@ -0,0 +1,23 @@ +/* src/include/port/cygwin.h */ + +/* + * Variables declared in the core backend and referenced by loadable + * modules need to be marked "dllimport" in the core build, but + * "dllexport" when the declaration is read in a loadable module. + * No special markings should be used when compiling frontend code. + */ +#ifndef FRONTEND +#ifdef BUILDING_DLL +#define PGDLLIMPORT __declspec (dllexport) +#else +#define PGDLLIMPORT __declspec (dllimport) +#endif +#endif + +/* + * Cygwin has a strtof() which is literally just (float)strtod(), which means + * we get misrounding _and_ silent over/underflow. Using our wrapper doesn't + * fix the misrounding but does fix the error checks, which cuts down on the + * number of test variant files needed. + */ +#define HAVE_BUGGY_STRTOF 1 diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/darwin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/darwin.h new file mode 100644 index 0000000..6aa2ea7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/darwin.h @@ -0,0 +1,13 @@ +/* src/include/port/darwin.h */ + +#define __darwin__ 1 + +#if HAVE_DECL_F_FULLFSYNC /* not present before macOS 10.3 */ +#define HAVE_FSYNC_WRITETHROUGH + +#endif + +/* + * macOS has a platform-specific implementation of prefetching. + */ +#define USE_PREFETCH diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/freebsd.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/freebsd.h new file mode 100644 index 0000000..c604187 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/freebsd.h @@ -0,0 +1,8 @@ +/* src/include/port/freebsd.h */ + +/* + * Set the default wal_sync_method to fdatasync. xlogdefs.h's normal rules + * would prefer open_datasync on FreeBSD 13+, but that is not a good choice on + * many systems. + */ +#define PLATFORM_DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_FDATASYNC diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/linux.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/linux.h new file mode 100644 index 0000000..8101af2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/linux.h @@ -0,0 +1,22 @@ +/* src/include/port/linux.h */ + +/* + * As of July 2007, all known versions of the Linux kernel will sometimes + * return EIDRM for a shmctl() operation when EINVAL is correct (it happens + * when the low-order 15 bits of the supplied shm ID match the slot number + * assigned to a newer shmem segment). We deal with this by assuming that + * EIDRM means EINVAL in PGSharedMemoryIsInUse(). This is reasonably safe + * since in fact Linux has no excuse for ever returning EIDRM; it doesn't + * track removed segments in a way that would allow distinguishing them from + * private ones. But someday that code might get upgraded, and we'd have + * to have a kernel version test here. + */ +#define HAVE_LINUX_EIDRM_BUG + +/* + * Set the default wal_sync_method to fdatasync. With recent Linux versions, + * xlogdefs.h's normal rules will prefer open_datasync, which (a) doesn't + * perform better and (b) causes outright failures on ext4 data=journal + * filesystems, because those don't support O_DIRECT. + */ +#define PLATFORM_DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_FDATASYNC diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/netbsd.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/netbsd.h new file mode 100644 index 0000000..590233f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/netbsd.h @@ -0,0 +1 @@ +/* src/include/port/netbsd.h */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/openbsd.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/openbsd.h new file mode 100644 index 0000000..395319b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/openbsd.h @@ -0,0 +1 @@ +/* src/include/port/openbsd.h */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_bitutils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_bitutils.h new file mode 100644 index 0000000..c7901bf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_bitutils.h @@ -0,0 +1,445 @@ +/*------------------------------------------------------------------------- + * + * pg_bitutils.h + * Miscellaneous functions for bit-wise operations. + * + * + * Copyright (c) 2019-2025, PostgreSQL Global Development Group + * + * src/include/port/pg_bitutils.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_BITUTILS_H +#define PG_BITUTILS_H + +#ifdef _MSC_VER +#include +#define HAVE_BITSCAN_FORWARD +#define HAVE_BITSCAN_REVERSE + +#else +#if defined(HAVE__BUILTIN_CTZ) +#define HAVE_BITSCAN_FORWARD +#endif + +#if defined(HAVE__BUILTIN_CLZ) +#define HAVE_BITSCAN_REVERSE +#endif +#endif /* _MSC_VER */ + +extern PGDLLIMPORT const uint8 pg_leftmost_one_pos[256]; +extern PGDLLIMPORT const uint8 pg_rightmost_one_pos[256]; +extern PGDLLIMPORT const uint8 pg_number_of_ones[256]; + +/* + * pg_leftmost_one_pos32 + * Returns the position of the most significant set bit in "word", + * measured from the least significant bit. word must not be 0. + */ +static inline int +pg_leftmost_one_pos32(uint32 word) +{ +#ifdef HAVE__BUILTIN_CLZ + Assert(word != 0); + + return 31 - __builtin_clz(word); +#elif defined(_MSC_VER) + unsigned long result; + bool non_zero; + + Assert(word != 0); + + non_zero = _BitScanReverse(&result, word); + return (int) result; +#else + int shift = 32 - 8; + + Assert(word != 0); + + while ((word >> shift) == 0) + shift -= 8; + + return shift + pg_leftmost_one_pos[(word >> shift) & 255]; +#endif /* HAVE__BUILTIN_CLZ */ +} + +/* + * pg_leftmost_one_pos64 + * As above, but for a 64-bit word. + */ +static inline int +pg_leftmost_one_pos64(uint64 word) +{ +#ifdef HAVE__BUILTIN_CLZ + Assert(word != 0); + +#if SIZEOF_LONG == 8 + return 63 - __builtin_clzl(word); +#elif SIZEOF_LONG_LONG == 8 + return 63 - __builtin_clzll(word); +#else +#error "cannot find integer type of the same size as uint64_t" +#endif + +#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64)) + unsigned long result; + bool non_zero; + + Assert(word != 0); + + non_zero = _BitScanReverse64(&result, word); + return (int) result; +#else + int shift = 64 - 8; + + Assert(word != 0); + + while ((word >> shift) == 0) + shift -= 8; + + return shift + pg_leftmost_one_pos[(word >> shift) & 255]; +#endif /* HAVE__BUILTIN_CLZ */ +} + +/* + * pg_rightmost_one_pos32 + * Returns the position of the least significant set bit in "word", + * measured from the least significant bit. word must not be 0. + */ +static inline int +pg_rightmost_one_pos32(uint32 word) +{ +#ifdef HAVE__BUILTIN_CTZ + Assert(word != 0); + + return __builtin_ctz(word); +#elif defined(_MSC_VER) + unsigned long result; + bool non_zero; + + Assert(word != 0); + + non_zero = _BitScanForward(&result, word); + return (int) result; +#else + int result = 0; + + Assert(word != 0); + + while ((word & 255) == 0) + { + word >>= 8; + result += 8; + } + result += pg_rightmost_one_pos[word & 255]; + return result; +#endif /* HAVE__BUILTIN_CTZ */ +} + +/* + * pg_rightmost_one_pos64 + * As above, but for a 64-bit word. + */ +static inline int +pg_rightmost_one_pos64(uint64 word) +{ +#ifdef HAVE__BUILTIN_CTZ + Assert(word != 0); + +#if SIZEOF_LONG == 8 + return __builtin_ctzl(word); +#elif SIZEOF_LONG_LONG == 8 + return __builtin_ctzll(word); +#else +#error "cannot find integer type of the same size as uint64_t" +#endif + +#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64)) + unsigned long result; + bool non_zero; + + Assert(word != 0); + + non_zero = _BitScanForward64(&result, word); + return (int) result; +#else + int result = 0; + + Assert(word != 0); + + while ((word & 255) == 0) + { + word >>= 8; + result += 8; + } + result += pg_rightmost_one_pos[word & 255]; + return result; +#endif /* HAVE__BUILTIN_CTZ */ +} + +/* + * pg_nextpower2_32 + * Returns the next higher power of 2 above 'num', or 'num' if it's + * already a power of 2. + * + * 'num' mustn't be 0 or be above PG_UINT32_MAX / 2 + 1. + */ +static inline uint32 +pg_nextpower2_32(uint32 num) +{ + Assert(num > 0 && num <= PG_UINT32_MAX / 2 + 1); + + /* + * A power 2 number has only 1 bit set. Subtracting 1 from such a number + * will turn on all previous bits resulting in no common bits being set + * between num and num-1. + */ + if ((num & (num - 1)) == 0) + return num; /* already power 2 */ + + return ((uint32) 1) << (pg_leftmost_one_pos32(num) + 1); +} + +/* + * pg_nextpower2_64 + * Returns the next higher power of 2 above 'num', or 'num' if it's + * already a power of 2. + * + * 'num' mustn't be 0 or be above PG_UINT64_MAX / 2 + 1. + */ +static inline uint64 +pg_nextpower2_64(uint64 num) +{ + Assert(num > 0 && num <= PG_UINT64_MAX / 2 + 1); + + /* + * A power 2 number has only 1 bit set. Subtracting 1 from such a number + * will turn on all previous bits resulting in no common bits being set + * between num and num-1. + */ + if ((num & (num - 1)) == 0) + return num; /* already power 2 */ + + return ((uint64) 1) << (pg_leftmost_one_pos64(num) + 1); +} + +/* + * pg_prevpower2_32 + * Returns the next lower power of 2 below 'num', or 'num' if it's + * already a power of 2. + * + * 'num' mustn't be 0. + */ +static inline uint32 +pg_prevpower2_32(uint32 num) +{ + return ((uint32) 1) << pg_leftmost_one_pos32(num); +} + +/* + * pg_prevpower2_64 + * Returns the next lower power of 2 below 'num', or 'num' if it's + * already a power of 2. + * + * 'num' mustn't be 0. + */ +static inline uint64 +pg_prevpower2_64(uint64 num) +{ + return ((uint64) 1) << pg_leftmost_one_pos64(num); +} + +/* + * pg_ceil_log2_32 + * Returns equivalent of ceil(log2(num)) + */ +static inline uint32 +pg_ceil_log2_32(uint32 num) +{ + if (num < 2) + return 0; + else + return pg_leftmost_one_pos32(num - 1) + 1; +} + +/* + * pg_ceil_log2_64 + * Returns equivalent of ceil(log2(num)) + */ +static inline uint64 +pg_ceil_log2_64(uint64 num) +{ + if (num < 2) + return 0; + else + return pg_leftmost_one_pos64(num - 1) + 1; +} + +/* + * With MSVC on x86_64 builds, try using native popcnt instructions via the + * __popcnt and __popcnt64 intrinsics. These don't work the same as GCC's + * __builtin_popcount* intrinsic functions as they always emit popcnt + * instructions. + */ +#if defined(_MSC_VER) && defined(_M_AMD64) +#define HAVE_X86_64_POPCNTQ +#endif + +/* + * On x86_64, we can use the hardware popcount instruction, but only if + * we can verify that the CPU supports it via the cpuid instruction. + * + * Otherwise, we fall back to a hand-rolled implementation. + */ +#ifdef HAVE_X86_64_POPCNTQ +#if defined(HAVE__GET_CPUID) || defined(HAVE__CPUID) +#define TRY_POPCNT_X86_64 1 +#endif +#endif + +/* + * On AArch64, we can use Neon instructions if the compiler provides access to + * them (as indicated by __ARM_NEON). As in simd.h, we assume that all + * available 64-bit hardware has Neon support. + */ +#if defined(__aarch64__) && defined(__ARM_NEON) +#define POPCNT_AARCH64 1 +#endif + +#ifdef TRY_POPCNT_X86_64 +/* Attempt to use the POPCNT instruction, but perform a runtime check first */ +extern PGDLLIMPORT int (*pg_popcount32) (uint32 word); +extern PGDLLIMPORT int (*pg_popcount64) (uint64 word); +extern PGDLLIMPORT uint64 (*pg_popcount_optimized) (const char *buf, int bytes); +extern PGDLLIMPORT uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, bits8 mask); + +/* + * We can also try to use the AVX-512 popcount instruction on some systems. + * The implementation of that is located in its own file. + */ +#ifdef USE_AVX512_POPCNT_WITH_RUNTIME_CHECK +extern bool pg_popcount_avx512_available(void); +extern uint64 pg_popcount_avx512(const char *buf, int bytes); +extern uint64 pg_popcount_masked_avx512(const char *buf, int bytes, bits8 mask); +#endif + +#elif POPCNT_AARCH64 +/* Use the Neon version of pg_popcount{32,64} without function pointer. */ +extern int pg_popcount32(uint32 word); +extern int pg_popcount64(uint64 word); + +/* + * We can try to use an SVE-optimized pg_popcount() on some systems For that, + * we do use a function pointer. + */ +#ifdef USE_SVE_POPCNT_WITH_RUNTIME_CHECK +extern PGDLLIMPORT uint64 (*pg_popcount_optimized) (const char *buf, int bytes); +extern PGDLLIMPORT uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, bits8 mask); +#else +extern uint64 pg_popcount_optimized(const char *buf, int bytes); +extern uint64 pg_popcount_masked_optimized(const char *buf, int bytes, bits8 mask); +#endif + +#else +/* Use a portable implementation -- no need for a function pointer. */ +extern int pg_popcount32(uint32 word); +extern int pg_popcount64(uint64 word); +extern uint64 pg_popcount_optimized(const char *buf, int bytes); +extern uint64 pg_popcount_masked_optimized(const char *buf, int bytes, bits8 mask); + +#endif /* TRY_POPCNT_X86_64 */ + +/* + * Returns the number of 1-bits in buf. + * + * If there aren't many bytes to process, the function call overhead of the + * optimized versions isn't worth taking, so we inline a loop that consults + * pg_number_of_ones in that case. If there are many bytes to process, we + * accept the function call overhead because the optimized versions are likely + * to be faster. + */ +static inline uint64 +pg_popcount(const char *buf, int bytes) +{ + /* + * We set the threshold to the point at which we'll first use special + * instructions in the optimized version. + */ +#if SIZEOF_VOID_P >= 8 + int threshold = 8; +#else + int threshold = 4; +#endif + + if (bytes < threshold) + { + uint64 popcnt = 0; + + while (bytes--) + popcnt += pg_number_of_ones[(unsigned char) *buf++]; + return popcnt; + } + + return pg_popcount_optimized(buf, bytes); +} + +/* + * Returns the number of 1-bits in buf after applying the mask to each byte. + * + * Similar to pg_popcount(), we only take on the function pointer overhead when + * it's likely to be faster. + */ +static inline uint64 +pg_popcount_masked(const char *buf, int bytes, bits8 mask) +{ + /* + * We set the threshold to the point at which we'll first use special + * instructions in the optimized version. + */ +#if SIZEOF_VOID_P >= 8 + int threshold = 8; +#else + int threshold = 4; +#endif + + if (bytes < threshold) + { + uint64 popcnt = 0; + + while (bytes--) + popcnt += pg_number_of_ones[(unsigned char) *buf++ & mask]; + return popcnt; + } + + return pg_popcount_masked_optimized(buf, bytes, mask); +} + +/* + * Rotate the bits of "word" to the right/left by n bits. + */ +static inline uint32 +pg_rotate_right32(uint32 word, int n) +{ + return (word >> n) | (word << (32 - n)); +} + +static inline uint32 +pg_rotate_left32(uint32 word, int n) +{ + return (word << n) | (word >> (32 - n)); +} + +/* size_t variants of the above, as required */ + +#if SIZEOF_SIZE_T == 4 +#define pg_leftmost_one_pos_size_t pg_leftmost_one_pos32 +#define pg_nextpower2_size_t pg_nextpower2_32 +#define pg_prevpower2_size_t pg_prevpower2_32 +#else +#define pg_leftmost_one_pos_size_t pg_leftmost_one_pos64 +#define pg_nextpower2_size_t pg_nextpower2_64 +#define pg_prevpower2_size_t pg_prevpower2_64 +#endif + +#endif /* PG_BITUTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_bswap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_bswap.h new file mode 100644 index 0000000..3364843 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_bswap.h @@ -0,0 +1,161 @@ +/*------------------------------------------------------------------------- + * + * pg_bswap.h + * Byte swapping. + * + * Macros for reversing the byte order of 16, 32 and 64-bit unsigned integers. + * For example, 0xAABBCCDD becomes 0xDDCCBBAA. These are just wrappers for + * built-in functions provided by the compiler where support exists. + * + * Note that all of these functions accept unsigned integers as arguments and + * return the same. Use caution when using these wrapper macros with signed + * integers. + * + * Copyright (c) 2015-2025, PostgreSQL Global Development Group + * + * src/include/port/pg_bswap.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_BSWAP_H +#define PG_BSWAP_H + + +/* + * In all supported versions msvc provides _byteswap_* functions in stdlib.h, + * already included by c.h. + */ + + +/* implementation of uint16 pg_bswap16(uint16) */ +#if defined(HAVE__BUILTIN_BSWAP16) + +#define pg_bswap16(x) __builtin_bswap16(x) + +#elif defined(_MSC_VER) + +#define pg_bswap16(x) _byteswap_ushort(x) + +#else + +static inline uint16 +pg_bswap16(uint16 x) +{ + return + ((x << 8) & 0xff00) | + ((x >> 8) & 0x00ff); +} + +#endif /* HAVE__BUILTIN_BSWAP16 */ + + +/* implementation of uint32 pg_bswap32(uint32) */ +#if defined(HAVE__BUILTIN_BSWAP32) + +#define pg_bswap32(x) __builtin_bswap32(x) + +#elif defined(_MSC_VER) + +#define pg_bswap32(x) _byteswap_ulong(x) + +#else + +static inline uint32 +pg_bswap32(uint32 x) +{ + return + ((x << 24) & 0xff000000) | + ((x << 8) & 0x00ff0000) | + ((x >> 8) & 0x0000ff00) | + ((x >> 24) & 0x000000ff); +} + +#endif /* HAVE__BUILTIN_BSWAP32 */ + + +/* implementation of uint64 pg_bswap64(uint64) */ +#if defined(HAVE__BUILTIN_BSWAP64) + +#define pg_bswap64(x) __builtin_bswap64(x) + + +#elif defined(_MSC_VER) + +#define pg_bswap64(x) _byteswap_uint64(x) + +#else + +static inline uint64 +pg_bswap64(uint64 x) +{ + return + ((x << 56) & UINT64CONST(0xff00000000000000)) | + ((x << 40) & UINT64CONST(0x00ff000000000000)) | + ((x << 24) & UINT64CONST(0x0000ff0000000000)) | + ((x << 8) & UINT64CONST(0x000000ff00000000)) | + ((x >> 8) & UINT64CONST(0x00000000ff000000)) | + ((x >> 24) & UINT64CONST(0x0000000000ff0000)) | + ((x >> 40) & UINT64CONST(0x000000000000ff00)) | + ((x >> 56) & UINT64CONST(0x00000000000000ff)); +} +#endif /* HAVE__BUILTIN_BSWAP64 */ + + +/* + * Portable and fast equivalents for ntohs, ntohl, htons, htonl, + * additionally extended to 64 bits. + */ +#ifdef WORDS_BIGENDIAN + +#define pg_hton16(x) (x) +#define pg_hton32(x) (x) +#define pg_hton64(x) (x) + +#define pg_ntoh16(x) (x) +#define pg_ntoh32(x) (x) +#define pg_ntoh64(x) (x) + +#else + +#define pg_hton16(x) pg_bswap16(x) +#define pg_hton32(x) pg_bswap32(x) +#define pg_hton64(x) pg_bswap64(x) + +#define pg_ntoh16(x) pg_bswap16(x) +#define pg_ntoh32(x) pg_bswap32(x) +#define pg_ntoh64(x) pg_bswap64(x) + +#endif /* WORDS_BIGENDIAN */ + + +/* + * Rearrange the bytes of a Datum from big-endian order into the native byte + * order. On big-endian machines, this does nothing at all. Note that the C + * type Datum is an unsigned integer type on all platforms. + * + * One possible application of the DatumBigEndianToNative() macro is to make + * bitwise comparisons cheaper. A simple 3-way comparison of Datums + * transformed by the macro (based on native, unsigned comparisons) will return + * the same result as a memcmp() of the corresponding original Datums, but can + * be much cheaper. It's generally safe to do this on big-endian systems + * without any special transformation occurring first. + * + * If SIZEOF_DATUM is not defined, then postgres.h wasn't included and these + * macros probably shouldn't be used, so we define nothing. Note that + * SIZEOF_DATUM == 8 would evaluate as 0 == 8 in that case, potentially + * leading to the wrong implementation being selected and confusing errors, so + * defining nothing is safest. + */ +#ifdef SIZEOF_DATUM +#ifdef WORDS_BIGENDIAN +#define DatumBigEndianToNative(x) (x) +#else /* !WORDS_BIGENDIAN */ +#if SIZEOF_DATUM == 8 +#define DatumBigEndianToNative(x) pg_bswap64(x) +#else /* SIZEOF_DATUM != 8 */ +#define DatumBigEndianToNative(x) pg_bswap32(x) +#endif /* SIZEOF_DATUM == 8 */ +#endif /* WORDS_BIGENDIAN */ +#endif /* SIZEOF_DATUM */ + +#endif /* PG_BSWAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_crc32c.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_crc32c.h new file mode 100644 index 0000000..ae00811 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_crc32c.h @@ -0,0 +1,165 @@ +/*------------------------------------------------------------------------- + * + * pg_crc32c.h + * Routines for computing CRC-32C checksums. + * + * The speed of CRC-32C calculation has a big impact on performance, so we + * jump through some hoops to get the best implementation for each + * platform. Some CPU architectures have special instructions for speeding + * up CRC calculations (e.g. Intel SSE 4.2), on other platforms we use the + * Slicing-by-8 algorithm which uses lookup tables. + * + * The public interface consists of four macros: + * + * INIT_CRC32C(crc) + * Initialize a CRC accumulator + * + * COMP_CRC32C(crc, data, len) + * Accumulate some (more) bytes into a CRC + * + * FIN_CRC32C(crc) + * Finish a CRC calculation + * + * EQ_CRC32C(c1, c2) + * Check for equality of two CRCs. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/pg_crc32c.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CRC32C_H +#define PG_CRC32C_H + +#include "port/pg_bswap.h" + +typedef uint32 pg_crc32c; + +/* The INIT and EQ macros are the same for all implementations. */ +#define INIT_CRC32C(crc) ((crc) = 0xFFFFFFFF) +#define EQ_CRC32C(c1, c2) ((c1) == (c2)) + +#if defined(USE_SSE42_CRC32C) +/* + * Use either Intel SSE 4.2 or AVX-512 instructions. We don't need a runtime check + * for SSE 4.2, so we can inline those in some cases. + */ + +#include + +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c_dispatch((crc), (data), (len))) +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) + +extern pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len); +extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len); +#ifdef USE_AVX512_CRC32C_WITH_RUNTIME_CHECK +extern pg_crc32c pg_comp_crc32c_avx512(pg_crc32c crc, const void *data, size_t len); +#endif + +/* + * We can only get here if the host compiler targets SSE 4.2, but on some + * systems gcc and clang don't have the same built-in targets, so we still + * must use a function attribute here to accommodate "--with-llvm" builds. + */ +pg_attribute_no_sanitize_alignment() +pg_attribute_target("sse4.2") +static inline +pg_crc32c +pg_comp_crc32c_dispatch(pg_crc32c crc, const void *data, size_t len) +{ + if (__builtin_constant_p(len) && len < 32) + { + const unsigned char *p = (const unsigned char *) data; + + /* + * For small constant inputs, inline the computation to avoid a + * function call and allow the compiler to unroll loops. + */ +#if SIZEOF_VOID_P >= 8 + for (; len >= 8; p += 8, len -= 8) + crc = _mm_crc32_u64(crc, *(const uint64 *) p); +#endif + for (; len >= 4; p += 4, len -= 4) + crc = _mm_crc32_u32(crc, *(const uint32 *) p); + for (; len > 0; --len) + crc = _mm_crc32_u8(crc, *p++); + return crc; + } + else + /* Otherwise, use a runtime check for AVX-512 instructions. */ + return pg_comp_crc32c(crc, data, len); +} + +#elif defined(USE_SSE42_CRC32C_WITH_RUNTIME_CHECK) + +/* + * Use Intel SSE 4.2 or AVX-512 instructions, but perform a runtime check first + * to check that they are available. + */ +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c((crc), (data), (len))) +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) + +extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len); +extern PGDLLIMPORT pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len); +extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len); +#ifdef USE_AVX512_CRC32C_WITH_RUNTIME_CHECK +extern pg_crc32c pg_comp_crc32c_avx512(pg_crc32c crc, const void *data, size_t len); +#endif + +#elif defined(USE_ARMV8_CRC32C) +/* Use ARMv8 CRC Extension instructions. */ + +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c_armv8((crc), (data), (len))) +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) + +extern pg_crc32c pg_comp_crc32c_armv8(pg_crc32c crc, const void *data, size_t len); + +#elif defined(USE_LOONGARCH_CRC32C) +/* Use LoongArch CRCC instructions. */ + +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c_loongarch((crc), (data), (len))) +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) + +extern pg_crc32c pg_comp_crc32c_loongarch(pg_crc32c crc, const void *data, size_t len); + +#elif defined(USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK) + +/* + * Use ARMv8 instructions, but perform a runtime check first + * to check that they are available. + */ +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c((crc), (data), (len))) +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) + +extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len); +extern pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len); +extern pg_crc32c pg_comp_crc32c_armv8(pg_crc32c crc, const void *data, size_t len); + +#else +/* + * Use slicing-by-8 algorithm. + * + * On big-endian systems, the intermediate value is kept in reverse byte + * order, to avoid byte-swapping during the calculation. FIN_CRC32C reverses + * the bytes to the final order. + */ +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c_sb8((crc), (data), (len))) +#ifdef WORDS_BIGENDIAN +#define FIN_CRC32C(crc) ((crc) = pg_bswap32(crc) ^ 0xFFFFFFFF) +#else +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) +#endif + +extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len); + +#endif + +#endif /* PG_CRC32C_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_iovec.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_iovec.h new file mode 100644 index 0000000..90be3af --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_iovec.h @@ -0,0 +1,127 @@ +/*------------------------------------------------------------------------- + * + * pg_iovec.h + * Header for vectored I/O functions, to use in place of . + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/pg_iovec.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_IOVEC_H +#define PG_IOVEC_H + +#ifndef WIN32 + +#include +#include /* IWYU pragma: export */ +#include + +#else + +/* Define our own POSIX-compatible iovec struct. */ +struct iovec +{ + void *iov_base; + size_t iov_len; +}; + +#endif + +/* + * If didn't define IOV_MAX, define our own. X/Open requires at + * least 16. (GNU Hurd apparently feel that they're not bound by X/Open, + * because they don't define this symbol at all.) + */ +#ifndef IOV_MAX +#define IOV_MAX 16 +#endif + +/* + * Define a reasonable maximum that is safe to use on the stack in arrays of + * struct iovec and other small types. The operating system could limit us to + * a number as low as 16, but most systems have 1024. + */ +#define PG_IOV_MAX Min(IOV_MAX, 128) + +/* + * Like preadv(), but with a prefix to remind us of a side-effect: on Windows + * this changes the current file position. + */ +static inline ssize_t +pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset) +{ +#if HAVE_DECL_PREADV + /* + * Avoid a small amount of argument copying overhead in the kernel if + * there is only one iovec. + */ + if (iovcnt == 1) + return pread(fd, iov[0].iov_base, iov[0].iov_len, offset); + else + return preadv(fd, iov, iovcnt, offset); +#else + ssize_t sum = 0; + ssize_t part; + + for (int i = 0; i < iovcnt; ++i) + { + part = pg_pread(fd, iov[i].iov_base, iov[i].iov_len, offset); + if (part < 0) + { + if (i == 0) + return -1; + else + return sum; + } + sum += part; + offset += part; + if ((size_t) part < iov[i].iov_len) + return sum; + } + return sum; +#endif +} + +/* + * Like pwritev(), but with a prefix to remind us of a side-effect: on Windows + * this changes the current file position. + */ +static inline ssize_t +pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset) +{ +#if HAVE_DECL_PWRITEV + /* + * Avoid a small amount of argument copying overhead in the kernel if + * there is only one iovec. + */ + if (iovcnt == 1) + return pwrite(fd, iov[0].iov_base, iov[0].iov_len, offset); + else + return pwritev(fd, iov, iovcnt, offset); +#else + ssize_t sum = 0; + ssize_t part; + + for (int i = 0; i < iovcnt; ++i) + { + part = pg_pwrite(fd, iov[i].iov_base, iov[i].iov_len, offset); + if (part < 0) + { + if (i == 0) + return -1; + else + return sum; + } + sum += part; + offset += part; + if ((size_t) part < iov[i].iov_len) + return sum; + } + return sum; +#endif +} + +#endif /* PG_IOVEC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_lfind.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_lfind.h new file mode 100644 index 0000000..20f7497 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_lfind.h @@ -0,0 +1,209 @@ +/*------------------------------------------------------------------------- + * + * pg_lfind.h + * Optimized linear search routines using SIMD intrinsics where + * available. + * + * Copyright (c) 2022-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/port/pg_lfind.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LFIND_H +#define PG_LFIND_H + +#include "port/simd.h" + +/* + * pg_lfind8 + * + * Return true if there is an element in 'base' that equals 'key', otherwise + * return false. + */ +static inline bool +pg_lfind8(uint8 key, uint8 *base, uint32 nelem) +{ + uint32 i; + + /* round down to multiple of vector length */ + uint32 tail_idx = nelem & ~(sizeof(Vector8) - 1); + Vector8 chunk; + + for (i = 0; i < tail_idx; i += sizeof(Vector8)) + { + vector8_load(&chunk, &base[i]); + if (vector8_has(chunk, key)) + return true; + } + + /* Process the remaining elements one at a time. */ + for (; i < nelem; i++) + { + if (key == base[i]) + return true; + } + + return false; +} + +/* + * pg_lfind8_le + * + * Return true if there is an element in 'base' that is less than or equal to + * 'key', otherwise return false. + */ +static inline bool +pg_lfind8_le(uint8 key, uint8 *base, uint32 nelem) +{ + uint32 i; + + /* round down to multiple of vector length */ + uint32 tail_idx = nelem & ~(sizeof(Vector8) - 1); + Vector8 chunk; + + for (i = 0; i < tail_idx; i += sizeof(Vector8)) + { + vector8_load(&chunk, &base[i]); + if (vector8_has_le(chunk, key)) + return true; + } + + /* Process the remaining elements one at a time. */ + for (; i < nelem; i++) + { + if (base[i] <= key) + return true; + } + + return false; +} + +/* + * pg_lfind32_one_by_one_helper + * + * Searches the array of integers one-by-one. The caller is responsible for + * ensuring that there are at least "nelem" integers in the array. + */ +static inline bool +pg_lfind32_one_by_one_helper(uint32 key, const uint32 *base, uint32 nelem) +{ + for (uint32 i = 0; i < nelem; i++) + { + if (key == base[i]) + return true; + } + + return false; +} + +#ifndef USE_NO_SIMD +/* + * pg_lfind32_simd_helper + * + * Searches one 4-register-block of integers. The caller is responsible for + * ensuring that there are at least 4-registers-worth of integers remaining. + */ +static inline bool +pg_lfind32_simd_helper(const Vector32 keys, const uint32 *base) +{ + const uint32 nelem_per_vector = sizeof(Vector32) / sizeof(uint32); + Vector32 vals1, + vals2, + vals3, + vals4, + result1, + result2, + result3, + result4, + tmp1, + tmp2, + result; + + /* load the next block into 4 registers */ + vector32_load(&vals1, base); + vector32_load(&vals2, &base[nelem_per_vector]); + vector32_load(&vals3, &base[nelem_per_vector * 2]); + vector32_load(&vals4, &base[nelem_per_vector * 3]); + + /* compare each value to the key */ + result1 = vector32_eq(keys, vals1); + result2 = vector32_eq(keys, vals2); + result3 = vector32_eq(keys, vals3); + result4 = vector32_eq(keys, vals4); + + /* combine the results into a single variable */ + tmp1 = vector32_or(result1, result2); + tmp2 = vector32_or(result3, result4); + result = vector32_or(tmp1, tmp2); + + /* return whether there was a match */ + return vector32_is_highbit_set(result); +} +#endif /* ! USE_NO_SIMD */ + +/* + * pg_lfind32 + * + * Return true if there is an element in 'base' that equals 'key', otherwise + * return false. + */ +static inline bool +pg_lfind32(uint32 key, const uint32 *base, uint32 nelem) +{ +#ifndef USE_NO_SIMD + uint32 i = 0; + + /* + * For better instruction-level parallelism, each loop iteration operates + * on a block of four registers. + */ + const Vector32 keys = vector32_broadcast(key); /* load copies of key */ + const uint32 nelem_per_vector = sizeof(Vector32) / sizeof(uint32); + const uint32 nelem_per_iteration = 4 * nelem_per_vector; + + /* round down to multiple of elements per iteration */ + const uint32 tail_idx = nelem & ~(nelem_per_iteration - 1); + +#if defined(USE_ASSERT_CHECKING) + bool assert_result = pg_lfind32_one_by_one_helper(key, base, nelem); +#endif + + /* + * If there aren't enough elements for the SIMD code, use the standard + * one-by-one linear search code. + */ + if (nelem < nelem_per_iteration) + return pg_lfind32_one_by_one_helper(key, base, nelem); + + /* + * Process as many elements as possible with a block of 4 registers. + */ + do + { + if (pg_lfind32_simd_helper(keys, &base[i])) + { + Assert(assert_result == true); + return true; + } + + i += nelem_per_iteration; + + } while (i < tail_idx); + + /* + * Process the last 'nelem_per_iteration' elements in the array with a + * 4-register block. This will cause us to check a subset of the elements + * more than once, but that won't affect correctness, and testing has + * demonstrated that this helps more cases than it harms. + */ + Assert(assert_result == pg_lfind32_simd_helper(keys, &base[nelem - nelem_per_iteration])); + return pg_lfind32_simd_helper(keys, &base[nelem - nelem_per_iteration]); +#else + /* Process the elements one at a time. */ + return pg_lfind32_one_by_one_helper(key, base, nelem); +#endif +} + +#endif /* PG_LFIND_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_numa.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_numa.h new file mode 100644 index 0000000..9d1ea6d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_numa.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * pg_numa.h + * Basic NUMA portability routines + * + * + * Copyright (c) 2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/port/pg_numa.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_NUMA_H +#define PG_NUMA_H + +extern PGDLLIMPORT int pg_numa_init(void); +extern PGDLLIMPORT int pg_numa_query_pages(int pid, unsigned long count, void **pages, int *status); +extern PGDLLIMPORT int pg_numa_get_max_node(void); + +#ifdef USE_LIBNUMA + +/* + * This is required on Linux, before pg_numa_query_pages() as we + * need to page-fault before move_pages(2) syscall returns valid results. + */ +static inline void +pg_numa_touch_mem_if_required(void *ptr) +{ + volatile uint64 touch pg_attribute_unused(); + + touch = *(volatile uint64 *) ptr; +} + +#else + +#define pg_numa_touch_mem_if_required(ptr) \ + do {} while(0) + +#endif + +#endif /* PG_NUMA_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_pthread.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_pthread.h new file mode 100644 index 0000000..4dbb3c8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/pg_pthread.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * Declarations for missing POSIX thread components. + * + * Currently this supplies an implementation of pthread_barrier_t for the + * benefit of macOS, which lacks it. These declarations are not in port.h, + * because that'd require to be included by every translation + * unit. + * + *------------------------------------------------------------------------- + */ + +#ifndef PG_PTHREAD_H +#define PG_PTHREAD_H + +#include /* IWYU pragma: export */ + +#ifndef HAVE_PTHREAD_BARRIER_WAIT + +#ifndef PTHREAD_BARRIER_SERIAL_THREAD +#define PTHREAD_BARRIER_SERIAL_THREAD (-1) +#endif + +typedef struct pg_pthread_barrier +{ + bool sense; /* we only need a one bit phase */ + int count; /* number of threads expected */ + int arrived; /* number of threads that have arrived */ + pthread_mutex_t mutex; + pthread_cond_t cond; +} pthread_barrier_t; + +extern int pthread_barrier_init(pthread_barrier_t *barrier, + const void *attr, + int count); +extern int pthread_barrier_wait(pthread_barrier_t *barrier); +extern int pthread_barrier_destroy(pthread_barrier_t *barrier); + +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/simd.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/simd.h new file mode 100644 index 0000000..97c5f35 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/simd.h @@ -0,0 +1,422 @@ +/*------------------------------------------------------------------------- + * + * simd.h + * Support for platform-specific vector operations. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/simd.h + * + * NOTES + * - VectorN in this file refers to a register where the element operands + * are N bits wide. The vector width is platform-specific, so users that care + * about that will need to inspect "sizeof(VectorN)". + * + *------------------------------------------------------------------------- + */ +#ifndef SIMD_H +#define SIMD_H + +#if (defined(__x86_64__) || defined(_M_AMD64)) +/* + * SSE2 instructions are part of the spec for the 64-bit x86 ISA. We assume + * that compilers targeting this architecture understand SSE2 intrinsics. + * + * We use emmintrin.h rather than the comprehensive header immintrin.h in + * order to exclude extensions beyond SSE2. This is because MSVC, at least, + * will allow the use of intrinsics that haven't been enabled at compile + * time. + */ +#include +#define USE_SSE2 +typedef __m128i Vector8; +typedef __m128i Vector32; + +#elif defined(__aarch64__) && defined(__ARM_NEON) +/* + * We use the Neon instructions if the compiler provides access to them (as + * indicated by __ARM_NEON) and we are on aarch64. While Neon support is + * technically optional for aarch64, it appears that all available 64-bit + * hardware does have it. Neon exists in some 32-bit hardware too, but we + * could not realistically use it there without a run-time check, which seems + * not worth the trouble for now. + */ +#include +#define USE_NEON +typedef uint8x16_t Vector8; +typedef uint32x4_t Vector32; + +#else +/* + * If no SIMD instructions are available, we can in some cases emulate vector + * operations using bitwise operations on unsigned integers. Note that many + * of the functions in this file presently do not have non-SIMD + * implementations. In particular, none of the functions involving Vector32 + * are implemented without SIMD since it's likely not worthwhile to represent + * two 32-bit integers using a uint64. + */ +#define USE_NO_SIMD +typedef uint64 Vector8; +#endif + +/* load/store operations */ +static inline void vector8_load(Vector8 *v, const uint8 *s); +#ifndef USE_NO_SIMD +static inline void vector32_load(Vector32 *v, const uint32 *s); +#endif + +/* assignment operations */ +static inline Vector8 vector8_broadcast(const uint8 c); +#ifndef USE_NO_SIMD +static inline Vector32 vector32_broadcast(const uint32 c); +#endif + +/* element-wise comparisons to a scalar */ +static inline bool vector8_has(const Vector8 v, const uint8 c); +static inline bool vector8_has_zero(const Vector8 v); +static inline bool vector8_has_le(const Vector8 v, const uint8 c); +static inline bool vector8_is_highbit_set(const Vector8 v); +#ifndef USE_NO_SIMD +static inline bool vector32_is_highbit_set(const Vector32 v); +static inline uint32 vector8_highbit_mask(const Vector8 v); +#endif + +/* arithmetic operations */ +static inline Vector8 vector8_or(const Vector8 v1, const Vector8 v2); +#ifndef USE_NO_SIMD +static inline Vector32 vector32_or(const Vector32 v1, const Vector32 v2); +static inline Vector8 vector8_ssub(const Vector8 v1, const Vector8 v2); +#endif + +/* + * comparisons between vectors + * + * Note: These return a vector rather than boolean, which is why we don't + * have non-SIMD implementations. + */ +#ifndef USE_NO_SIMD +static inline Vector8 vector8_eq(const Vector8 v1, const Vector8 v2); +static inline Vector8 vector8_min(const Vector8 v1, const Vector8 v2); +static inline Vector32 vector32_eq(const Vector32 v1, const Vector32 v2); +#endif + +/* + * Load a chunk of memory into the given vector. + */ +static inline void +vector8_load(Vector8 *v, const uint8 *s) +{ +#if defined(USE_SSE2) + *v = _mm_loadu_si128((const __m128i *) s); +#elif defined(USE_NEON) + *v = vld1q_u8(s); +#else + memcpy(v, s, sizeof(Vector8)); +#endif +} + +#ifndef USE_NO_SIMD +static inline void +vector32_load(Vector32 *v, const uint32 *s) +{ +#ifdef USE_SSE2 + *v = _mm_loadu_si128((const __m128i *) s); +#elif defined(USE_NEON) + *v = vld1q_u32(s); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Create a vector with all elements set to the same value. + */ +static inline Vector8 +vector8_broadcast(const uint8 c) +{ +#if defined(USE_SSE2) + return _mm_set1_epi8(c); +#elif defined(USE_NEON) + return vdupq_n_u8(c); +#else + return ~UINT64CONST(0) / 0xFF * c; +#endif +} + +#ifndef USE_NO_SIMD +static inline Vector32 +vector32_broadcast(const uint32 c) +{ +#ifdef USE_SSE2 + return _mm_set1_epi32(c); +#elif defined(USE_NEON) + return vdupq_n_u32(c); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return true if any elements in the vector are equal to the given scalar. + */ +static inline bool +vector8_has(const Vector8 v, const uint8 c) +{ + bool result; + + /* pre-compute the result for assert checking */ +#ifdef USE_ASSERT_CHECKING + bool assert_result = false; + + for (Size i = 0; i < sizeof(Vector8); i++) + { + if (((const uint8 *) &v)[i] == c) + { + assert_result = true; + break; + } + } +#endif /* USE_ASSERT_CHECKING */ + +#if defined(USE_NO_SIMD) + /* any bytes in v equal to c will evaluate to zero via XOR */ + result = vector8_has_zero(v ^ vector8_broadcast(c)); +#else + result = vector8_is_highbit_set(vector8_eq(v, vector8_broadcast(c))); +#endif + + Assert(assert_result == result); + return result; +} + +/* + * Convenience function equivalent to vector8_has(v, 0) + */ +static inline bool +vector8_has_zero(const Vector8 v) +{ +#if defined(USE_NO_SIMD) + /* + * We cannot call vector8_has() here, because that would lead to a + * circular definition. + */ + return vector8_has_le(v, 0); +#else + return vector8_has(v, 0); +#endif +} + +/* + * Return true if any elements in the vector are less than or equal to the + * given scalar. + */ +static inline bool +vector8_has_le(const Vector8 v, const uint8 c) +{ + bool result = false; + + /* pre-compute the result for assert checking */ +#ifdef USE_ASSERT_CHECKING + bool assert_result = false; + + for (Size i = 0; i < sizeof(Vector8); i++) + { + if (((const uint8 *) &v)[i] <= c) + { + assert_result = true; + break; + } + } +#endif /* USE_ASSERT_CHECKING */ + +#if defined(USE_NO_SIMD) + + /* + * To find bytes <= c, we can use bitwise operations to find bytes < c+1, + * but it only works if c+1 <= 128 and if the highest bit in v is not set. + * Adapted from + * https://graphics.stanford.edu/~seander/bithacks.html#HasLessInWord + */ + if ((int64) v >= 0 && c < 0x80) + result = (v - vector8_broadcast(c + 1)) & ~v & vector8_broadcast(0x80); + else + { + /* one byte at a time */ + for (Size i = 0; i < sizeof(Vector8); i++) + { + if (((const uint8 *) &v)[i] <= c) + { + result = true; + break; + } + } + } +#else + + /* + * Use saturating subtraction to find bytes <= c, which will present as + * NUL bytes. This approach is a workaround for the lack of unsigned + * comparison instructions on some architectures. + */ + result = vector8_has_zero(vector8_ssub(v, vector8_broadcast(c))); +#endif + + Assert(assert_result == result); + return result; +} + +/* + * Return true if the high bit of any element is set + */ +static inline bool +vector8_is_highbit_set(const Vector8 v) +{ +#ifdef USE_SSE2 + return _mm_movemask_epi8(v) != 0; +#elif defined(USE_NEON) + return vmaxvq_u8(v) > 0x7F; +#else + return v & vector8_broadcast(0x80); +#endif +} + +/* + * Exactly like vector8_is_highbit_set except for the input type, so it + * looks at each byte separately. + * + * XXX x86 uses the same underlying type for 8-bit, 16-bit, and 32-bit + * integer elements, but Arm does not, hence the need for a separate + * function. We could instead adopt the behavior of Arm's vmaxvq_u32(), i.e. + * check each 32-bit element, but that would require an additional mask + * operation on x86. + */ +#ifndef USE_NO_SIMD +static inline bool +vector32_is_highbit_set(const Vector32 v) +{ +#if defined(USE_NEON) + return vector8_is_highbit_set((Vector8) v); +#else + return vector8_is_highbit_set(v); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return a bitmask formed from the high-bit of each element. + */ +#ifndef USE_NO_SIMD +static inline uint32 +vector8_highbit_mask(const Vector8 v) +{ +#ifdef USE_SSE2 + return (uint32) _mm_movemask_epi8(v); +#elif defined(USE_NEON) + /* + * Note: It would be faster to use vget_lane_u64 and vshrn_n_u16, but that + * returns a uint64, making it inconvenient to combine mask values from + * multiple vectors. + */ + static const uint8 mask[16] = { + 1 << 0, 1 << 1, 1 << 2, 1 << 3, + 1 << 4, 1 << 5, 1 << 6, 1 << 7, + 1 << 0, 1 << 1, 1 << 2, 1 << 3, + 1 << 4, 1 << 5, 1 << 6, 1 << 7, + }; + + uint8x16_t masked = vandq_u8(vld1q_u8(mask), (uint8x16_t) vshrq_n_s8((int8x16_t) v, 7)); + uint8x16_t maskedhi = vextq_u8(masked, masked, 8); + + return (uint32) vaddvq_u16((uint16x8_t) vzip1q_u8(masked, maskedhi)); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return the bitwise OR of the inputs + */ +static inline Vector8 +vector8_or(const Vector8 v1, const Vector8 v2) +{ +#ifdef USE_SSE2 + return _mm_or_si128(v1, v2); +#elif defined(USE_NEON) + return vorrq_u8(v1, v2); +#else + return v1 | v2; +#endif +} + +#ifndef USE_NO_SIMD +static inline Vector32 +vector32_or(const Vector32 v1, const Vector32 v2) +{ +#ifdef USE_SSE2 + return _mm_or_si128(v1, v2); +#elif defined(USE_NEON) + return vorrq_u32(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return the result of subtracting the respective elements of the input + * vectors using saturation (i.e., if the operation would yield a value less + * than zero, zero is returned instead). For more information on saturation + * arithmetic, see https://en.wikipedia.org/wiki/Saturation_arithmetic + */ +#ifndef USE_NO_SIMD +static inline Vector8 +vector8_ssub(const Vector8 v1, const Vector8 v2) +{ +#ifdef USE_SSE2 + return _mm_subs_epu8(v1, v2); +#elif defined(USE_NEON) + return vqsubq_u8(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return a vector with all bits set in each lane where the corresponding + * lanes in the inputs are equal. + */ +#ifndef USE_NO_SIMD +static inline Vector8 +vector8_eq(const Vector8 v1, const Vector8 v2) +{ +#ifdef USE_SSE2 + return _mm_cmpeq_epi8(v1, v2); +#elif defined(USE_NEON) + return vceqq_u8(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +#ifndef USE_NO_SIMD +static inline Vector32 +vector32_eq(const Vector32 v1, const Vector32 v2) +{ +#ifdef USE_SSE2 + return _mm_cmpeq_epi32(v1, v2); +#elif defined(USE_NEON) + return vceqq_u32(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Given two vectors, return a vector with the minimum element of each. + */ +#ifndef USE_NO_SIMD +static inline Vector8 +vector8_min(const Vector8 v1, const Vector8 v2) +{ +#ifdef USE_SSE2 + return _mm_min_epu8(v1, v2); +#elif defined(USE_NEON) + return vminq_u8(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +#endif /* SIMD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/solaris.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/solaris.h new file mode 100644 index 0000000..8ff4000 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/solaris.h @@ -0,0 +1,35 @@ +/* src/include/port/solaris.h */ + +/* + * Sort this out for all operating systems some time. The __xxx + * symbols are defined on both GCC and Solaris CC, although GCC + * doesn't document them. The __xxx__ symbols are only on GCC. + */ +#if defined(__i386) && !defined(__i386__) +#define __i386__ +#endif + +#if defined(__amd64) && !defined(__amd64__) +#define __amd64__ +#endif + +#if defined(__x86_64) && !defined(__x86_64__) +#define __x86_64__ +#endif + +#if defined(__sparc) && !defined(__sparc__) +#define __sparc__ +#endif + +#if defined(__i386__) +#include +#endif + +/* + * On original Solaris, PAM conversation procs lack a "const" in their + * declaration; but recent OpenIndiana versions put it there by default. + * The least messy way to deal with this is to define _PAM_LEGACY_NONCONST, + * which causes OpenIndiana to declare pam_conv per the Solaris tradition, + * and also use that symbol to control omitting the "const" in our own code. + */ +#define _PAM_LEGACY_NONCONST 1 diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32.h new file mode 100644 index 0000000..d6c13d0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32.h @@ -0,0 +1,59 @@ +/* src/include/port/win32.h */ + +/* + * We always rely on the WIN32 macro being set by our build system, + * but _WIN32 is the compiler pre-defined macro. So make sure we define + * WIN32 whenever _WIN32 is set, to facilitate standalone building. + */ +#if defined(_WIN32) && !defined(WIN32) +#define WIN32 +#endif + +/* + * Make sure _WIN32_WINNT has the minimum required value. + * Leave a higher value in place. The minimum requirement is Windows 10. + */ +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#endif + +#define _WIN32_WINNT 0x0A00 + +/* + * We need to prevent from defining a symbol conflicting with + * our errcode() function. Since it's likely to get included by standard + * system headers, pre-emptively include it now. + */ +#if defined(_MSC_VER) || defined(HAVE_CRTDEFS_H) +#define errcode __msvc_errcode +#include +#undef errcode +#endif + +/* + * defines for dynamic linking on Win32 platform + */ + +/* + * Variables declared in the core backend and referenced by loadable + * modules need to be marked "dllimport" in the core build, but + * "dllexport" when the declaration is read in a loadable module. + * No special markings should be used when compiling frontend code. + */ +#ifndef FRONTEND +#ifdef BUILDING_DLL +#define PGDLLIMPORT __declspec (dllexport) +#else +#define PGDLLIMPORT __declspec (dllimport) +#endif +#endif + +/* + * Functions exported by a loadable module must be marked "dllexport". + * + * While mingw would otherwise fall back to + * __attribute__((visibility("default"))), that appears to only work as long + * as no symbols are declared with __declspec(dllexport). But we can end up + * with some, e.g. plpython's Py_Init. + */ +#define PGDLLEXPORT __declspec (dllexport) diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/arpa/inet.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/arpa/inet.h new file mode 100644 index 0000000..ad18031 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/arpa/inet.h @@ -0,0 +1,3 @@ +/* src/include/port/win32/arpa/inet.h */ + +#include diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/dlfcn.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/dlfcn.h new file mode 100644 index 0000000..b6e43c0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/dlfcn.h @@ -0,0 +1 @@ +/* src/include/port/win32/dlfcn.h */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/grp.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/grp.h new file mode 100644 index 0000000..8b4f213 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/grp.h @@ -0,0 +1 @@ +/* src/include/port/win32/grp.h */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/netdb.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/netdb.h new file mode 100644 index 0000000..9ed13e4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/netdb.h @@ -0,0 +1,7 @@ +/* src/include/port/win32/netdb.h */ +#ifndef WIN32_NETDB_H +#define WIN32_NETDB_H + +#include + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/netinet/in.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/netinet/in.h new file mode 100644 index 0000000..a4e22f8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/netinet/in.h @@ -0,0 +1,3 @@ +/* src/include/port/win32/netinet/in.h */ + +#include diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/netinet/tcp.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/netinet/tcp.h new file mode 100644 index 0000000..1d377b6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/netinet/tcp.h @@ -0,0 +1,7 @@ +/* src/include/port/win32/netinet/tcp.h */ +#ifndef WIN32_NETINET_TCP_H +#define WIN32_NETINET_TCP_H + +#include + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/pwd.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/pwd.h new file mode 100644 index 0000000..b8c7178 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/pwd.h @@ -0,0 +1,3 @@ +/* + * src/include/port/win32/pwd.h + */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/resource.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/resource.h new file mode 100644 index 0000000..a14feeb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/resource.h @@ -0,0 +1,20 @@ +/* + * Replacement for for Windows. + */ +#ifndef WIN32_SYS_RESOURCE_H +#define WIN32_SYS_RESOURCE_H + +#include /* for struct timeval */ + +#define RUSAGE_SELF 0 +#define RUSAGE_CHILDREN (-1) + +struct rusage +{ + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ +}; + +extern int getrusage(int who, struct rusage *rusage); + +#endif /* WIN32_SYS_RESOURCE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/select.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/select.h new file mode 100644 index 0000000..f8a877a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/select.h @@ -0,0 +1,3 @@ +/* + * src/include/port/win32/sys/select.h + */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/socket.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/socket.h new file mode 100644 index 0000000..f2b475d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/socket.h @@ -0,0 +1,34 @@ +/* + * src/include/port/win32/sys/socket.h + */ +#ifndef WIN32_SYS_SOCKET_H +#define WIN32_SYS_SOCKET_H + +/* + * Unfortunately, of VC++ also defines ERROR. + * To avoid the conflict, we include here and undefine ERROR + * immediately. + * + * Note: Don't include directly. It causes compile errors. + */ +#include +#include +#include + +#undef ERROR +#undef small + +/* Restore old ERROR value */ +#ifdef PGERROR +#define ERROR PGERROR +#endif + +/* + * We don't use the Windows gai_strerror[A] function because it is not + * thread-safe. We define our own in src/port/win32gai_strerror.c. + */ +#undef gai_strerror + +extern const char *gai_strerror(int ecode); + +#endif /* WIN32_SYS_SOCKET_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/un.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/un.h new file mode 100644 index 0000000..4fc13a2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/un.h @@ -0,0 +1,17 @@ +/* + * src/include/port/win32/sys/un.h + */ +#ifndef WIN32_SYS_UN_H +#define WIN32_SYS_UN_H + +/* + * Windows defines this structure in , but not all tool chains have + * the header yet, so we define it here for now. + */ +struct sockaddr_un +{ + unsigned short sun_family; + char sun_path[108]; +}; + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/wait.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/wait.h new file mode 100644 index 0000000..eaeb566 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32/sys/wait.h @@ -0,0 +1,3 @@ +/* + * src/include/port/win32/sys/wait.h + */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/dirent.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/dirent.h new file mode 100644 index 0000000..62799db --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/dirent.h @@ -0,0 +1,34 @@ +/* + * Headers for port/dirent.c, win32 native implementation of dirent functions + * + * src/include/port/win32_msvc/dirent.h + */ + +#ifndef _WIN32VC_DIRENT_H +#define _WIN32VC_DIRENT_H +struct dirent +{ + long d_ino; + unsigned short d_reclen; + unsigned char d_type; + unsigned short d_namlen; + char d_name[MAX_PATH]; +}; + +typedef struct DIR DIR; + +DIR *opendir(const char *); +struct dirent *readdir(DIR *); +int closedir(DIR *); + +/* File types for 'd_type'. */ +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/sys/file.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/sys/file.h new file mode 100644 index 0000000..76be3e7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/sys/file.h @@ -0,0 +1 @@ +/* src/include/port/win32_msvc/sys/file.h */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/sys/param.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/sys/param.h new file mode 100644 index 0000000..160df3b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/sys/param.h @@ -0,0 +1 @@ +/* src/include/port/win32_msvc/sys/param.h */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/sys/time.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/sys/time.h new file mode 100644 index 0000000..9d943ec --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/sys/time.h @@ -0,0 +1 @@ +/* src/include/port/win32_msvc/sys/time.h */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/unistd.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/unistd.h new file mode 100644 index 0000000..b7795ba --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/unistd.h @@ -0,0 +1,9 @@ +/* src/include/port/win32_msvc/unistd.h */ + +/* + * MSVC does not define these, nor does _fileno(stdin) etc reliably work + * (returns -1 if stdin/out/err are closed). + */ +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/utime.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/utime.h new file mode 100644 index 0000000..c78e79c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_msvc/utime.h @@ -0,0 +1,3 @@ +/* src/include/port/win32_msvc/utime.h */ + +#include /* for non-unicode version */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_port.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_port.h new file mode 100644 index 0000000..14f9781 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32_port.h @@ -0,0 +1,589 @@ +/*------------------------------------------------------------------------- + * + * win32_port.h + * Windows-specific compatibility stuff. + * + * Note this is read in MinGW as well as native Windows builds, + * but not in Cygwin builds. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/win32_port.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_WIN32_PORT_H +#define PG_WIN32_PORT_H + +/* + * Always build with SSPI support. Keep it as a #define in case + * we want a switch to disable it sometime in the future. + */ +#define ENABLE_SSPI 1 + +/* undefine and redefine after #include */ +#undef mkdir + +#undef ERROR + +/* + * VS2013 and later issue warnings about using the old Winsock API, + * which we don't really want to hear about. + */ +#ifdef _MSC_VER +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif + +/* + * The MinGW64 headers choke if this is already defined - they + * define it themselves. + */ +#if !defined(__MINGW64_VERSION_MAJOR) || defined(_MSC_VER) +#define _WINSOCKAPI_ +#endif + +/* + * windows.h includes a lot of other headers, slowing down compilation + * significantly. WIN32_LEAN_AND_MEAN reduces that a bit. It'd be better to + * remove the include of windows.h (as well as indirect inclusions of it) from + * such a central place, but until then... + * + * To be able to include ntstatus.h tell windows.h to not declare NTSTATUS by + * temporarily defining UMDF_USING_NTSTATUS, otherwise we'll get warning about + * macro redefinitions, as windows.h also defines NTSTATUS (yuck). That in + * turn requires including ntstatus.h, winternl.h to get common symbols. + */ +#define WIN32_LEAN_AND_MEAN +#define UMDF_USING_NTSTATUS + +#include +#include +#include +#include +#include + +#undef small +#include +#include +#include +#undef near + +/* needed before sys/stat hacking below: */ +#define fstat microsoft_native_fstat +#define stat microsoft_native_stat +#include +#undef fstat +#undef stat + +/* Must be here to avoid conflicting with prototype in windows.h */ +#define mkdir(a,b) mkdir(a) + +/* Windows doesn't have fsync() as such, use _commit() */ +#define fsync(fd) _commit(fd) + +#define USES_WINSOCK + +/* + * IPC defines + */ +#undef HAVE_UNION_SEMUN +#define HAVE_UNION_SEMUN 1 + +#define IPC_RMID 256 +#define IPC_CREAT 512 +#define IPC_EXCL 1024 +#define IPC_PRIVATE 234564 +#define IPC_NOWAIT 2048 +#define IPC_STAT 4096 + +#define EACCESS 2048 +#ifndef EIDRM +#define EIDRM 4096 +#endif + +#define SETALL 8192 +#define GETNCNT 16384 +#define GETVAL 65536 +#define SETVAL 131072 +#define GETPID 262144 + + +/* + * Signal stuff + * + * For WIN32, there is no wait() call so there are no wait() macros + * to interpret the return value of system(). Instead, system() + * return values < 0x100 are used for exit() termination, and higher + * values are used to indicate non-exit() termination, which is + * similar to a unix-style signal exit (think SIGSEGV == + * STATUS_ACCESS_VIOLATION). Return values are broken up into groups: + * + * https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values + * + * NT_SUCCESS 0 - 0x3FFFFFFF + * NT_INFORMATION 0x40000000 - 0x7FFFFFFF + * NT_WARNING 0x80000000 - 0xBFFFFFFF + * NT_ERROR 0xC0000000 - 0xFFFFFFFF + * + * Effectively, we don't care on the severity of the return value from + * system(), we just need to know if it was because of exit() or generated + * by the system, and it seems values >= 0x100 are system-generated. + * See this URL for a list of WIN32 STATUS_* values: + * + * Wine (URL used in our error messages) - + * http://source.winehq.org/source/include/ntstatus.h + * Descriptions - + * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55 + * + * The comprehensive exception list is included in ntstatus.h from the + * Windows Driver Kit (WDK). A subset of the list is also included in + * winnt.h from the Windows SDK. Defining WIN32_NO_STATUS before including + * windows.h helps to avoid any conflicts. + * + * Some day we might want to print descriptions for the most common + * exceptions, rather than printing an include file name. We could use + * RtlNtStatusToDosError() and pass to FormatMessage(), which can print + * the text of error values, but MinGW does not support + * RtlNtStatusToDosError(). + */ +#define WIFEXITED(w) (((w) & 0XFFFFFF00) == 0) +#define WIFSIGNALED(w) (!WIFEXITED(w)) +#define WEXITSTATUS(w) (w) +#define WTERMSIG(w) (w) + +#define sigmask(sig) ( 1 << ((sig)-1) ) + +/* Some extra signals */ +#define SIGHUP 1 +#define SIGQUIT 3 +#define SIGTRAP 5 +#define SIGABRT 22 /* Set to match W32 value -- not UNIX value */ +#define SIGKILL 9 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGSTOP 17 +#define SIGTSTP 18 +#define SIGCONT 19 +#define SIGCHLD 20 +#define SIGWINCH 28 +#define SIGUSR1 30 +#define SIGUSR2 31 + +/* MinGW has gettimeofday(), but MSVC doesn't */ +#ifdef _MSC_VER +/* Last parameter not used */ +extern int gettimeofday(struct timeval *tp, void *tzp); +#endif + +/* for setitimer in backend/port/win32/timer.c */ +#define ITIMER_REAL 0 +struct itimerval +{ + struct timeval it_interval; + struct timeval it_value; +}; + +int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue); + +/* Convenience wrapper for GetFileType() */ +extern DWORD pgwin32_get_file_type(HANDLE hFile); + +/* + * WIN32 does not provide 64-bit off_t, but does provide the functions operating + * with 64-bit offsets. Also, fseek() might not give an error for unseekable + * streams, so harden that function with our version. + */ +#define pgoff_t __int64 + +#ifdef _MSC_VER +extern int _pgfseeko64(FILE *stream, pgoff_t offset, int origin); +extern pgoff_t _pgftello64(FILE *stream); +#define fseeko(stream, offset, origin) _pgfseeko64(stream, offset, origin) +#define ftello(stream) _pgftello64(stream) +#else +#ifndef fseeko +#define fseeko(stream, offset, origin) fseeko64(stream, offset, origin) +#endif +#ifndef ftello +#define ftello(stream) ftello64(stream) +#endif +#endif + +/* + * Win32 also doesn't have symlinks, but we can emulate them with + * junction points on newer Win32 versions. + * + * Cygwin has its own symlinks which work on Win95/98/ME where + * junction points don't, so use those instead. We have no way of + * knowing what type of system Cygwin binaries will be run on. + * Note: Some CYGWIN includes might #define WIN32. + */ +extern int pgsymlink(const char *oldpath, const char *newpath); +extern int pgreadlink(const char *path, char *buf, size_t size); + +#define symlink(oldpath, newpath) pgsymlink(oldpath, newpath) +#define readlink(path, buf, size) pgreadlink(path, buf, size) + +/* + * Supplement to . + * + * Perl already has typedefs for uid_t and gid_t. + */ +#ifndef PLPERL_HAVE_UID_GID +typedef int uid_t; +typedef int gid_t; +#endif +typedef long key_t; + +#ifdef _MSC_VER +typedef int pid_t; +#endif + +/* + * Supplement to . + * + * We must pull in sys/stat.h before this part, else our overrides lose. + * + * stat() is not guaranteed to set the st_size field on win32, so we + * redefine it to our own implementation. See src/port/win32stat.c. + * + * The struct stat is 32 bit in MSVC, so we redefine it as a copy of + * struct __stat64. This also fixes the struct size for MINGW builds. + */ +struct stat /* This should match struct __stat64 */ +{ + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; +}; + +extern int _pgfstat64(int fileno, struct stat *buf); +extern int _pgstat64(const char *name, struct stat *buf); +extern int _pglstat64(const char *name, struct stat *buf); + +#define fstat(fileno, sb) _pgfstat64(fileno, sb) +#define stat(path, sb) _pgstat64(path, sb) +#define lstat(path, sb) _pglstat64(path, sb) + +/* These macros are not provided by older MinGW, nor by MSVC */ +#ifndef S_IRUSR +#define S_IRUSR _S_IREAD +#endif +#ifndef S_IWUSR +#define S_IWUSR _S_IWRITE +#endif +#ifndef S_IXUSR +#define S_IXUSR _S_IEXEC +#endif +#ifndef S_IRWXU +#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +#endif +#ifndef S_IRGRP +#define S_IRGRP 0 +#endif +#ifndef S_IWGRP +#define S_IWGRP 0 +#endif +#ifndef S_IXGRP +#define S_IXGRP 0 +#endif +#ifndef S_IRWXG +#define S_IRWXG 0 +#endif +#ifndef S_IROTH +#define S_IROTH 0 +#endif +#ifndef S_IWOTH +#define S_IWOTH 0 +#endif +#ifndef S_IXOTH +#define S_IXOTH 0 +#endif +#ifndef S_IRWXO +#define S_IRWXO 0 +#endif +#ifndef S_ISDIR +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif +#ifndef S_ISREG +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif + +/* + * In order for lstat() to be able to report junction points as symlinks, we + * need to hijack a bit in st_mode, since neither MSVC nor MinGW provides + * S_ISLNK and there aren't any spare bits. We'll steal the one for character + * devices, because we don't otherwise make use of those. + */ +#ifdef S_ISLNK +#error "S_ISLNK is already defined" +#endif +#ifdef S_IFLNK +#error "S_IFLNK is already defined" +#endif +#define S_IFLNK S_IFCHR +#define S_ISLNK(m) (((m) & S_IFLNK) == S_IFLNK) + +/* + * Supplement to . + * + * We borrow bits from the high end when we have to, to avoid colliding with + * the system-defined values. Our open() replacement in src/port/open.c + * converts these to the equivalent CreateFile() flags, along with the ones + * from fcntl.h. + */ +#define O_CLOEXEC 0x04000000 +#define O_DIRECT 0x80000000 +#define O_DSYNC _O_NOINHERIT + +/* + * Supplement to . + * + * We redefine network-related Berkeley error symbols as the corresponding WSA + * constants. This allows strerror.c to recognize them as being in the Winsock + * error code range and pass them off to win32_socket_strerror(), since + * Windows' version of plain strerror() won't cope. Note that this will break + * if these names are used for anything else besides Windows Sockets errors. + * See TranslateSocketError() when changing this list. + */ +#undef EAGAIN +#define EAGAIN WSAEWOULDBLOCK +#undef EINTR +#define EINTR WSAEINTR +#undef EMSGSIZE +#define EMSGSIZE WSAEMSGSIZE +#undef EAFNOSUPPORT +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#undef EWOULDBLOCK +#define EWOULDBLOCK WSAEWOULDBLOCK +#undef ECONNABORTED +#define ECONNABORTED WSAECONNABORTED +#undef ECONNRESET +#define ECONNRESET WSAECONNRESET +#undef EINPROGRESS +#define EINPROGRESS WSAEINPROGRESS +#undef EISCONN +#define EISCONN WSAEISCONN +#undef ENOBUFS +#define ENOBUFS WSAENOBUFS +#undef EPROTONOSUPPORT +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#undef ECONNREFUSED +#define ECONNREFUSED WSAECONNREFUSED +#undef ENOTSOCK +#define ENOTSOCK WSAENOTSOCK +#undef EOPNOTSUPP +#define EOPNOTSUPP WSAEOPNOTSUPP +#undef EADDRINUSE +#define EADDRINUSE WSAEADDRINUSE +#undef EADDRNOTAVAIL +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#undef EHOSTDOWN +#define EHOSTDOWN WSAEHOSTDOWN +#undef EHOSTUNREACH +#define EHOSTUNREACH WSAEHOSTUNREACH +#undef ENETDOWN +#define ENETDOWN WSAENETDOWN +#undef ENETRESET +#define ENETRESET WSAENETRESET +#undef ENETUNREACH +#define ENETUNREACH WSAENETUNREACH +#undef ENOTCONN +#define ENOTCONN WSAENOTCONN +#undef ETIMEDOUT +#define ETIMEDOUT WSAETIMEDOUT + +/* + * Supplement to . + */ +#define strtok_r strtok_s + +/* + * Supplement to . + */ +#ifdef _MSC_VER +/* + * MinGW has these functions if _POSIX_C_SOURCE is defined. Third-party + * libraries might do that, so to avoid clashes we get ahead of it and define + * it ourselves and use the system functions provided by MinGW. + */ +#define gmtime_r(clock, result) (gmtime_s(result, clock) ? NULL : (result)) +#define localtime_r(clock, result) (localtime_s(result, clock) ? NULL : (result)) +#endif + +/* + * Locale stuff. + * + * Extended locale functions with gratuitous underscore prefixes. + * (These APIs are nevertheless fully documented by Microsoft.) + */ +#define locale_t _locale_t +#define tolower_l _tolower_l +#define toupper_l _toupper_l +#define towlower_l _towlower_l +#define towupper_l _towupper_l +#define isdigit_l _isdigit_l +#define iswdigit_l _iswdigit_l +#define isalpha_l _isalpha_l +#define iswalpha_l _iswalpha_l +#define isalnum_l _isalnum_l +#define iswalnum_l _iswalnum_l +#define isupper_l _isupper_l +#define iswupper_l _iswupper_l +#define islower_l _islower_l +#define iswlower_l _iswlower_l +#define isgraph_l _isgraph_l +#define iswgraph_l _iswgraph_l +#define isprint_l _isprint_l +#define iswprint_l _iswprint_l +#define ispunct_l _ispunct_l +#define iswpunct_l _iswpunct_l +#define isspace_l _isspace_l +#define iswspace_l _iswspace_l +#define strcoll_l _strcoll_l +#define strxfrm_l _strxfrm_l +#define wcscoll_l _wcscoll_l + +/* + * Versions of libintl >= 0.18? try to replace setlocale() with a macro + * to their own versions. Remove the macro, if it exists, because it + * ends up calling the wrong version when the backend and libintl use + * different versions of msvcrt. + */ +#if defined(setlocale) +#undef setlocale +#endif + +/* + * Define our own wrapper macro around setlocale() to work around bugs in + * Windows' native setlocale() function. + */ +extern char *pgwin32_setlocale(int category, const char *locale); + +#define setlocale(a,b) pgwin32_setlocale(a,b) + + +/* In backend/port/win32/signal.c */ +extern PGDLLIMPORT volatile int pg_signal_queue; +extern PGDLLIMPORT int pg_signal_mask; +extern PGDLLIMPORT HANDLE pgwin32_signal_event; +extern PGDLLIMPORT HANDLE pgwin32_initial_signal_pipe; + +#define UNBLOCKED_SIGNAL_QUEUE() (pg_signal_queue & ~pg_signal_mask) +#define PG_SIGNAL_COUNT 32 + +extern void pgwin32_signal_initialize(void); +extern HANDLE pgwin32_create_signal_listener(pid_t pid); +extern void pgwin32_dispatch_queued_signals(void); +extern void pg_queue_signal(int signum); + +/* In src/port/kill.c */ +#define kill(pid,sig) pgkill(pid,sig) +extern int pgkill(int pid, int sig); + +/* In backend/port/win32/socket.c */ +#ifndef FRONTEND +#define socket(af, type, protocol) pgwin32_socket(af, type, protocol) +#define bind(s, addr, addrlen) pgwin32_bind(s, addr, addrlen) +#define listen(s, backlog) pgwin32_listen(s, backlog) +#define accept(s, addr, addrlen) pgwin32_accept(s, addr, addrlen) +#define connect(s, name, namelen) pgwin32_connect(s, name, namelen) +#define select(n, r, w, e, timeout) pgwin32_select(n, r, w, e, timeout) +#define recv(s, buf, len, flags) pgwin32_recv(s, buf, len, flags) +#define send(s, buf, len, flags) pgwin32_send(s, buf, len, flags) + +extern SOCKET pgwin32_socket(int af, int type, int protocol); +extern int pgwin32_bind(SOCKET s, struct sockaddr *addr, int addrlen); +extern int pgwin32_listen(SOCKET s, int backlog); +extern SOCKET pgwin32_accept(SOCKET s, struct sockaddr *addr, int *addrlen); +extern int pgwin32_connect(SOCKET s, const struct sockaddr *name, int namelen); +extern int pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout); +extern int pgwin32_recv(SOCKET s, char *buf, int len, int flags); +extern int pgwin32_send(SOCKET s, const void *buf, int len, int flags); +extern int pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout); + +extern PGDLLIMPORT int pgwin32_noblock; + +#endif /* FRONTEND */ + +/* in backend/port/win32_shmem.c */ +extern int pgwin32_ReserveSharedMemoryRegion(HANDLE); + +/* in backend/port/win32/crashdump.c */ +extern void pgwin32_install_crashdump_handler(void); + +/* in port/win32dlopen.c */ +extern void *dlopen(const char *file, int mode); +extern void *dlsym(void *handle, const char *symbol); +extern int dlclose(void *handle); +extern char *dlerror(void); + +#define RTLD_NOW 1 +#define RTLD_GLOBAL 0 + +/* in port/win32error.c */ +extern void _dosmaperr(unsigned long); + +/* in port/win32env.c */ +extern int pgwin32_putenv(const char *); +extern int pgwin32_setenv(const char *name, const char *value, int overwrite); +extern int pgwin32_unsetenv(const char *name); + +#define putenv(x) pgwin32_putenv(x) +#define setenv(x,y,z) pgwin32_setenv(x,y,z) +#define unsetenv(x) pgwin32_unsetenv(x) + +/* in port/win32security.c */ +extern int pgwin32_is_service(void); +extern int pgwin32_is_admin(void); + +/* Windows security token manipulation (in src/common/exec.c) */ +extern BOOL AddUserToTokenDacl(HANDLE hToken); + +/* Things that exist in MinGW headers, but need to be added to MSVC */ +#ifdef _MSC_VER + +#ifndef _WIN64 +typedef long ssize_t; +#else +typedef __int64 ssize_t; +#endif + +typedef unsigned short mode_t; + +#define F_OK 0 +#define W_OK 2 +#define R_OK 4 + +#endif /* _MSC_VER */ + +#if defined(__MINGW32__) || defined(__MINGW64__) +/* + * Mingw claims to have a strtof, and my reading of its source code suggests + * that it ought to work (and not need this hack), but the regression test + * results disagree with me; whether this is a version issue or not is not + * clear. However, using our wrapper (and the misrounded-input variant file, + * already required for supporting ancient systems) can't make things any + * worse, except for a tiny performance loss when reading zeros. + * + * See also cygwin.h for another instance of this. + */ +#define HAVE_BUGGY_STRTOF 1 +#endif + +/* in port/win32pread.c */ +extern ssize_t pg_pread(int fd, void *buf, size_t nbyte, off_t offset); + +/* in port/win32pwrite.c */ +extern ssize_t pg_pwrite(int fd, const void *buf, size_t nbyte, off_t offset); + +#endif /* PG_WIN32_PORT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32ntdll.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32ntdll.h new file mode 100644 index 0000000..c03fd52 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/port/win32ntdll.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * win32ntdll.h + * Dynamically loaded Windows NT functions. + * + * Portions Copyright (c) 2021-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/win32ntdll.h + * + *------------------------------------------------------------------------- + */ + +#ifndef WIN32NTDLL_H +#define WIN32NTDLL_H + +#include +#include + +#ifndef FLUSH_FLAGS_FILE_DATA_SYNC_ONLY +#define FLUSH_FLAGS_FILE_DATA_SYNC_ONLY 0x4 +#endif + +typedef NTSTATUS (__stdcall * RtlGetLastNtStatus_t) (void); +typedef ULONG (__stdcall * RtlNtStatusToDosError_t) (NTSTATUS); +typedef NTSTATUS (__stdcall * NtFlushBuffersFileEx_t) (HANDLE, ULONG, PVOID, ULONG, PIO_STATUS_BLOCK); + +extern PGDLLIMPORT RtlGetLastNtStatus_t pg_RtlGetLastNtStatus; +extern PGDLLIMPORT RtlNtStatusToDosError_t pg_RtlNtStatusToDosError; +extern PGDLLIMPORT NtFlushBuffersFileEx_t pg_NtFlushBuffersFileEx; + +extern int initialize_ntdll(void); + +#endif /* WIN32NTDLL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/portability/instr_time.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/portability/instr_time.h new file mode 100644 index 0000000..f71a851 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/portability/instr_time.h @@ -0,0 +1,197 @@ +/*------------------------------------------------------------------------- + * + * instr_time.h + * portable high-precision interval timing + * + * This file provides an abstraction layer to hide portability issues in + * interval timing. On Unix we use clock_gettime(), and on Windows we use + * QueryPerformanceCounter(). These macros also give some breathing room to + * use other high-precision-timing APIs. + * + * The basic data type is instr_time, which all callers should treat as an + * opaque typedef. instr_time can store either an absolute time (of + * unspecified reference time) or an interval. The operations provided + * for it are: + * + * INSTR_TIME_IS_ZERO(t) is t equal to zero? + * + * INSTR_TIME_SET_ZERO(t) set t to zero (memset is acceptable too) + * + * INSTR_TIME_SET_CURRENT(t) set t to current time + * + * INSTR_TIME_SET_CURRENT_LAZY(t) set t to current time if t is zero, + * evaluates to whether t changed + * + * INSTR_TIME_ADD(x, y) x += y + * + * INSTR_TIME_SUBTRACT(x, y) x -= y + * + * INSTR_TIME_ACCUM_DIFF(x, y, z) x += (y - z) + * + * INSTR_TIME_GET_DOUBLE(t) convert t to double (in seconds) + * + * INSTR_TIME_GET_MILLISEC(t) convert t to double (in milliseconds) + * + * INSTR_TIME_GET_MICROSEC(t) convert t to int64 (in microseconds) + * + * INSTR_TIME_GET_NANOSEC(t) convert t to int64 (in nanoseconds) + * + * Note that INSTR_TIME_SUBTRACT and INSTR_TIME_ACCUM_DIFF convert + * absolute times to intervals. The INSTR_TIME_GET_xxx operations are + * only useful on intervals. + * + * When summing multiple measurements, it's recommended to leave the + * running sum in instr_time form (ie, use INSTR_TIME_ADD or + * INSTR_TIME_ACCUM_DIFF) and convert to a result format only at the end. + * + * Beware of multiple evaluations of the macro arguments. + * + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/portability/instr_time.h + * + *------------------------------------------------------------------------- + */ +#ifndef INSTR_TIME_H +#define INSTR_TIME_H + + +/* + * We store interval times as an int64 integer on all platforms, as int64 is + * cheap to add/subtract, the most common operation for instr_time. The + * acquisition of time and converting to specific units of time is platform + * specific. + * + * To avoid users of the API relying on the integer representation, we wrap + * the 64bit integer in a struct. + */ +typedef struct instr_time +{ + int64 ticks; /* in platforms specific unit */ +} instr_time; + + +/* helpers macros used in platform specific code below */ + +#define NS_PER_S INT64CONST(1000000000) +#define NS_PER_MS INT64CONST(1000000) +#define NS_PER_US INT64CONST(1000) + + +#ifndef WIN32 + + +/* Use clock_gettime() */ + +#include + +/* + * The best clockid to use according to the POSIX spec is CLOCK_MONOTONIC, + * since that will give reliable interval timing even in the face of changes + * to the system clock. However, POSIX doesn't require implementations to + * provide anything except CLOCK_REALTIME, so fall back to that if we don't + * find CLOCK_MONOTONIC. + * + * Also, some implementations have nonstandard clockids with better properties + * than CLOCK_MONOTONIC. In particular, as of macOS 10.12, Apple provides + * CLOCK_MONOTONIC_RAW which is both faster to read and higher resolution than + * their version of CLOCK_MONOTONIC. + */ +#if defined(__darwin__) && defined(CLOCK_MONOTONIC_RAW) +#define PG_INSTR_CLOCK CLOCK_MONOTONIC_RAW +#elif defined(CLOCK_MONOTONIC) +#define PG_INSTR_CLOCK CLOCK_MONOTONIC +#else +#define PG_INSTR_CLOCK CLOCK_REALTIME +#endif + +/* helper for INSTR_TIME_SET_CURRENT */ +static inline instr_time +pg_clock_gettime_ns(void) +{ + instr_time now; + struct timespec tmp; + + clock_gettime(PG_INSTR_CLOCK, &tmp); + now.ticks = tmp.tv_sec * NS_PER_S + tmp.tv_nsec; + + return now; +} + +#define INSTR_TIME_SET_CURRENT(t) \ + ((t) = pg_clock_gettime_ns()) + +#define INSTR_TIME_GET_NANOSEC(t) \ + ((int64) (t).ticks) + + +#else /* WIN32 */ + + +/* Use QueryPerformanceCounter() */ + +/* helper for INSTR_TIME_SET_CURRENT */ +static inline instr_time +pg_query_performance_counter(void) +{ + instr_time now; + LARGE_INTEGER tmp; + + QueryPerformanceCounter(&tmp); + now.ticks = tmp.QuadPart; + + return now; +} + +static inline double +GetTimerFrequency(void) +{ + LARGE_INTEGER f; + + QueryPerformanceFrequency(&f); + return (double) f.QuadPart; +} + +#define INSTR_TIME_SET_CURRENT(t) \ + ((t) = pg_query_performance_counter()) + +#define INSTR_TIME_GET_NANOSEC(t) \ + ((int64) ((t).ticks * ((double) NS_PER_S / GetTimerFrequency()))) + +#endif /* WIN32 */ + + +/* + * Common macros + */ + +#define INSTR_TIME_IS_ZERO(t) ((t).ticks == 0) + + +#define INSTR_TIME_SET_ZERO(t) ((t).ticks = 0) + +#define INSTR_TIME_SET_CURRENT_LAZY(t) \ + (INSTR_TIME_IS_ZERO(t) ? INSTR_TIME_SET_CURRENT(t), true : false) + + +#define INSTR_TIME_ADD(x,y) \ + ((x).ticks += (y).ticks) + +#define INSTR_TIME_SUBTRACT(x,y) \ + ((x).ticks -= (y).ticks) + +#define INSTR_TIME_ACCUM_DIFF(x,y,z) \ + ((x).ticks += (y).ticks - (z).ticks) + + +#define INSTR_TIME_GET_DOUBLE(t) \ + ((double) INSTR_TIME_GET_NANOSEC(t) / NS_PER_S) + +#define INSTR_TIME_GET_MILLISEC(t) \ + ((double) INSTR_TIME_GET_NANOSEC(t) / NS_PER_MS) + +#define INSTR_TIME_GET_MICROSEC(t) \ + (INSTR_TIME_GET_NANOSEC(t) / NS_PER_US) + +#endif /* INSTR_TIME_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/portability/mem.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/portability/mem.h new file mode 100644 index 0000000..ef98007 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/portability/mem.h @@ -0,0 +1,48 @@ +/*------------------------------------------------------------------------- + * + * mem.h + * portability definitions for various memory operations + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/portability/mem.h + * + *------------------------------------------------------------------------- + */ +#ifndef MEM_H +#define MEM_H + +#define IPCProtection (0600) /* access/modify by user only */ + +#ifdef SHM_SHARE_MMU /* use intimate shared memory on Solaris */ +#define PG_SHMAT_FLAGS SHM_SHARE_MMU +#else +#define PG_SHMAT_FLAGS 0 +#endif + +/* Linux prefers MAP_ANONYMOUS, but the flag is called MAP_ANON on other systems. */ +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + +/* BSD-derived systems have MAP_HASSEMAPHORE, but it's not present (or needed) on Linux. */ +#ifndef MAP_HASSEMAPHORE +#define MAP_HASSEMAPHORE 0 +#endif + +/* + * BSD-derived systems use the MAP_NOSYNC flag to prevent dirty mmap(2) + * pages from being gratuitously flushed to disk. + */ +#ifndef MAP_NOSYNC +#define MAP_NOSYNC 0 +#endif + +#define PG_MMAP_FLAGS (MAP_SHARED|MAP_ANONYMOUS|MAP_HASSEMAPHORE) + +/* Some really old systems don't define MAP_FAILED. */ +#ifndef MAP_FAILED +#define MAP_FAILED ((void *) -1) +#endif + +#endif /* MEM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postgres.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postgres.h new file mode 100644 index 0000000..8a41a66 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postgres.h @@ -0,0 +1,584 @@ +/*------------------------------------------------------------------------- + * + * postgres.h + * Primary include file for PostgreSQL server .c files + * + * This should be the first file included by PostgreSQL backend modules. + * Client-side code should include postgres_fe.h instead. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1995, Regents of the University of California + * + * src/include/postgres.h + * + *------------------------------------------------------------------------- + */ +/* IWYU pragma: always_keep */ +/* + *---------------------------------------------------------------- + * TABLE OF CONTENTS + * + * When adding stuff to this file, please try to put stuff + * into the relevant section, or add new sections as appropriate. + * + * section description + * ------- ------------------------------------------------ + * 1) Datum type + support functions + * 2) miscellaneous + * + * NOTES + * + * In general, this file should contain declarations that are widely needed + * in the backend environment, but are of no interest outside the backend. + * + * Simple type definitions live in c.h, where they are shared with + * postgres_fe.h. We do that since those type definitions are needed by + * frontend modules that want to deal with binary data transmission to or + * from the backend. Type definitions in this file should be for + * representations that never escape the backend, such as Datum. + * + *---------------------------------------------------------------- + */ +#ifndef POSTGRES_H +#define POSTGRES_H + +/* IWYU pragma: begin_exports */ + +#include "c.h" +#include "utils/elog.h" +#include "utils/palloc.h" + +/* IWYU pragma: end_exports */ + +/* ---------------------------------------------------------------- + * Section 1: Datum type + support functions + * ---------------------------------------------------------------- + */ + +/* + * A Datum contains either a value of a pass-by-value type or a pointer to a + * value of a pass-by-reference type. Therefore, we require: + * + * sizeof(Datum) == sizeof(void *) == 4 or 8 + * + * The functions below and the analogous functions for other types should be used to + * convert between a Datum and the appropriate C type. + */ + +typedef uintptr_t Datum; + +/* + * A NullableDatum is used in places where both a Datum and its nullness needs + * to be stored. This can be more efficient than storing datums and nullness + * in separate arrays, due to better spatial locality, even if more space may + * be wasted due to padding. + */ +typedef struct NullableDatum +{ +#define FIELDNO_NULLABLE_DATUM_DATUM 0 + Datum value; +#define FIELDNO_NULLABLE_DATUM_ISNULL 1 + bool isnull; + /* due to alignment padding this could be used for flags for free */ +} NullableDatum; + +#define SIZEOF_DATUM SIZEOF_VOID_P + +/* + * DatumGetBool + * Returns boolean value of a datum. + * + * Note: any nonzero value will be considered true. + */ +static inline bool +DatumGetBool(Datum X) +{ + return (X != 0); +} + +/* + * BoolGetDatum + * Returns datum representation for a boolean. + * + * Note: any nonzero value will be considered true. + */ +static inline Datum +BoolGetDatum(bool X) +{ + return (Datum) (X ? 1 : 0); +} + +/* + * DatumGetChar + * Returns character value of a datum. + */ +static inline char +DatumGetChar(Datum X) +{ + return (char) X; +} + +/* + * CharGetDatum + * Returns datum representation for a character. + */ +static inline Datum +CharGetDatum(char X) +{ + return (Datum) X; +} + +/* + * Int8GetDatum + * Returns datum representation for an 8-bit integer. + */ +static inline Datum +Int8GetDatum(int8 X) +{ + return (Datum) X; +} + +/* + * DatumGetUInt8 + * Returns 8-bit unsigned integer value of a datum. + */ +static inline uint8 +DatumGetUInt8(Datum X) +{ + return (uint8) X; +} + +/* + * UInt8GetDatum + * Returns datum representation for an 8-bit unsigned integer. + */ +static inline Datum +UInt8GetDatum(uint8 X) +{ + return (Datum) X; +} + +/* + * DatumGetInt16 + * Returns 16-bit integer value of a datum. + */ +static inline int16 +DatumGetInt16(Datum X) +{ + return (int16) X; +} + +/* + * Int16GetDatum + * Returns datum representation for a 16-bit integer. + */ +static inline Datum +Int16GetDatum(int16 X) +{ + return (Datum) X; +} + +/* + * DatumGetUInt16 + * Returns 16-bit unsigned integer value of a datum. + */ +static inline uint16 +DatumGetUInt16(Datum X) +{ + return (uint16) X; +} + +/* + * UInt16GetDatum + * Returns datum representation for a 16-bit unsigned integer. + */ +static inline Datum +UInt16GetDatum(uint16 X) +{ + return (Datum) X; +} + +/* + * DatumGetInt32 + * Returns 32-bit integer value of a datum. + */ +static inline int32 +DatumGetInt32(Datum X) +{ + return (int32) X; +} + +/* + * Int32GetDatum + * Returns datum representation for a 32-bit integer. + */ +static inline Datum +Int32GetDatum(int32 X) +{ + return (Datum) X; +} + +/* + * DatumGetUInt32 + * Returns 32-bit unsigned integer value of a datum. + */ +static inline uint32 +DatumGetUInt32(Datum X) +{ + return (uint32) X; +} + +/* + * UInt32GetDatum + * Returns datum representation for a 32-bit unsigned integer. + */ +static inline Datum +UInt32GetDatum(uint32 X) +{ + return (Datum) X; +} + +/* + * DatumGetObjectId + * Returns object identifier value of a datum. + */ +static inline Oid +DatumGetObjectId(Datum X) +{ + return (Oid) X; +} + +/* + * ObjectIdGetDatum + * Returns datum representation for an object identifier. + */ +static inline Datum +ObjectIdGetDatum(Oid X) +{ + return (Datum) X; +} + +/* + * DatumGetTransactionId + * Returns transaction identifier value of a datum. + */ +static inline TransactionId +DatumGetTransactionId(Datum X) +{ + return (TransactionId) X; +} + +/* + * TransactionIdGetDatum + * Returns datum representation for a transaction identifier. + */ +static inline Datum +TransactionIdGetDatum(TransactionId X) +{ + return (Datum) X; +} + +/* + * MultiXactIdGetDatum + * Returns datum representation for a multixact identifier. + */ +static inline Datum +MultiXactIdGetDatum(MultiXactId X) +{ + return (Datum) X; +} + +/* + * DatumGetCommandId + * Returns command identifier value of a datum. + */ +static inline CommandId +DatumGetCommandId(Datum X) +{ + return (CommandId) X; +} + +/* + * CommandIdGetDatum + * Returns datum representation for a command identifier. + */ +static inline Datum +CommandIdGetDatum(CommandId X) +{ + return (Datum) X; +} + +/* + * DatumGetPointer + * Returns pointer value of a datum. + */ +static inline Pointer +DatumGetPointer(Datum X) +{ + return (Pointer) X; +} + +/* + * PointerGetDatum + * Returns datum representation for a pointer. + */ +static inline Datum +PointerGetDatum(const void *X) +{ + return (Datum) X; +} + +/* + * DatumGetCString + * Returns C string (null-terminated string) value of a datum. + * + * Note: C string is not a full-fledged Postgres type at present, + * but type input functions use this conversion for their inputs. + */ +static inline char * +DatumGetCString(Datum X) +{ + return (char *) DatumGetPointer(X); +} + +/* + * CStringGetDatum + * Returns datum representation for a C string (null-terminated string). + * + * Note: C string is not a full-fledged Postgres type at present, + * but type output functions use this conversion for their outputs. + * Note: CString is pass-by-reference; caller must ensure the pointed-to + * value has adequate lifetime. + */ +static inline Datum +CStringGetDatum(const char *X) +{ + return PointerGetDatum(X); +} + +/* + * DatumGetName + * Returns name value of a datum. + */ +static inline Name +DatumGetName(Datum X) +{ + return (Name) DatumGetPointer(X); +} + +/* + * NameGetDatum + * Returns datum representation for a name. + * + * Note: Name is pass-by-reference; caller must ensure the pointed-to + * value has adequate lifetime. + */ +static inline Datum +NameGetDatum(const NameData *X) +{ + return CStringGetDatum(NameStr(*X)); +} + +/* + * DatumGetInt64 + * Returns 64-bit integer value of a datum. + * + * Note: this function hides whether int64 is pass by value or by reference. + */ +static inline int64 +DatumGetInt64(Datum X) +{ +#ifdef USE_FLOAT8_BYVAL + return (int64) X; +#else + return *((int64 *) DatumGetPointer(X)); +#endif +} + +/* + * Int64GetDatum + * Returns datum representation for a 64-bit integer. + * + * Note: if int64 is pass by reference, this function returns a reference + * to palloc'd space. + */ +#ifdef USE_FLOAT8_BYVAL +static inline Datum +Int64GetDatum(int64 X) +{ + return (Datum) X; +} +#else +extern Datum Int64GetDatum(int64 X); +#endif + + +/* + * DatumGetUInt64 + * Returns 64-bit unsigned integer value of a datum. + * + * Note: this function hides whether int64 is pass by value or by reference. + */ +static inline uint64 +DatumGetUInt64(Datum X) +{ +#ifdef USE_FLOAT8_BYVAL + return (uint64) X; +#else + return *((uint64 *) DatumGetPointer(X)); +#endif +} + +/* + * UInt64GetDatum + * Returns datum representation for a 64-bit unsigned integer. + * + * Note: if int64 is pass by reference, this function returns a reference + * to palloc'd space. + */ +static inline Datum +UInt64GetDatum(uint64 X) +{ +#ifdef USE_FLOAT8_BYVAL + return (Datum) X; +#else + return Int64GetDatum((int64) X); +#endif +} + +/* + * Float <-> Datum conversions + * + * These have to be implemented as inline functions rather than macros, when + * passing by value, because many machines pass int and float function + * parameters/results differently; so we need to play weird games with unions. + */ + +/* + * DatumGetFloat4 + * Returns 4-byte floating point value of a datum. + */ +static inline float4 +DatumGetFloat4(Datum X) +{ + union + { + int32 value; + float4 retval; + } myunion; + + myunion.value = DatumGetInt32(X); + return myunion.retval; +} + +/* + * Float4GetDatum + * Returns datum representation for a 4-byte floating point number. + */ +static inline Datum +Float4GetDatum(float4 X) +{ + union + { + float4 value; + int32 retval; + } myunion; + + myunion.value = X; + return Int32GetDatum(myunion.retval); +} + +/* + * DatumGetFloat8 + * Returns 8-byte floating point value of a datum. + * + * Note: this function hides whether float8 is pass by value or by reference. + */ +static inline float8 +DatumGetFloat8(Datum X) +{ +#ifdef USE_FLOAT8_BYVAL + union + { + int64 value; + float8 retval; + } myunion; + + myunion.value = DatumGetInt64(X); + return myunion.retval; +#else + return *((float8 *) DatumGetPointer(X)); +#endif +} + +/* + * Float8GetDatum + * Returns datum representation for an 8-byte floating point number. + * + * Note: if float8 is pass by reference, this function returns a reference + * to palloc'd space. + */ +#ifdef USE_FLOAT8_BYVAL +static inline Datum +Float8GetDatum(float8 X) +{ + union + { + float8 value; + int64 retval; + } myunion; + + myunion.value = X; + return Int64GetDatum(myunion.retval); +} +#else +extern Datum Float8GetDatum(float8 X); +#endif + + +/* + * Int64GetDatumFast + * Float8GetDatumFast + * + * These macros are intended to allow writing code that does not depend on + * whether int64 and float8 are pass-by-reference types, while not + * sacrificing performance when they are. The argument must be a variable + * that will exist and have the same value for as long as the Datum is needed. + * In the pass-by-ref case, the address of the variable is taken to use as + * the Datum. In the pass-by-val case, these are the same as the non-Fast + * functions, except for asserting that the variable is of the correct type. + */ + +#ifdef USE_FLOAT8_BYVAL +#define Int64GetDatumFast(X) \ + (AssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X)) +#define Float8GetDatumFast(X) \ + (AssertVariableIsOfTypeMacro(X, double), Float8GetDatum(X)) +#else +#define Int64GetDatumFast(X) \ + (AssertVariableIsOfTypeMacro(X, int64), PointerGetDatum(&(X))) +#define Float8GetDatumFast(X) \ + (AssertVariableIsOfTypeMacro(X, double), PointerGetDatum(&(X))) +#endif + + +/* ---------------------------------------------------------------- + * Section 2: miscellaneous + * ---------------------------------------------------------------- + */ + +/* + * NON_EXEC_STATIC: It's sometimes useful to define a variable or function + * that is normally static but extern when using EXEC_BACKEND (see + * pg_config_manual.h). There would then typically be some code in + * postmaster.c that uses those extern symbols to transfer state between + * processes or do whatever other things it needs to do in EXEC_BACKEND mode. + */ +#ifdef EXEC_BACKEND +#define NON_EXEC_STATIC +#else +#define NON_EXEC_STATIC static +#endif + +#endif /* POSTGRES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postgres_ext.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postgres_ext.h new file mode 100644 index 0000000..6a8f25a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postgres_ext.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * postgres_ext.h + * + * This file contains declarations of things that are visible everywhere + * in PostgreSQL *and* are visible to clients of frontend interface libraries. + * For example, the Oid type is part of the API of libpq and other libraries. + * + * Declarations which are specific to a particular interface should + * go in the header file for that interface (such as libpq-fe.h). This + * file is only for fundamental Postgres declarations. + * + * User-written C functions don't count as "external to Postgres." + * Those function much as local modifications to the backend itself, and + * use header files that are otherwise internal to Postgres to interface + * with the backend. + * + * src/include/postgres_ext.h + * + *------------------------------------------------------------------------- + */ +/* IWYU pragma: always_keep */ + +#ifndef POSTGRES_EXT_H +#define POSTGRES_EXT_H + +#include + +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +#ifdef __cplusplus +#define InvalidOid (Oid(0)) +#else +#define InvalidOid ((Oid) 0) +#endif + +#define OID_MAX UINT_MAX +/* you will need to include to use the above #define */ + +#define atooid(x) ((Oid) strtoul((x), NULL, 10)) +/* the above needs */ + + +/* deprecated name for int64_t, formerly used in client API declarations */ +typedef int64_t pg_int64; + +/* + * Identifiers of error message fields. Kept here to keep common + * between frontend and backend, and also to export them to libpq + * applications. + */ +#define PG_DIAG_SEVERITY 'S' +#define PG_DIAG_SEVERITY_NONLOCALIZED 'V' +#define PG_DIAG_SQLSTATE 'C' +#define PG_DIAG_MESSAGE_PRIMARY 'M' +#define PG_DIAG_MESSAGE_DETAIL 'D' +#define PG_DIAG_MESSAGE_HINT 'H' +#define PG_DIAG_STATEMENT_POSITION 'P' +#define PG_DIAG_INTERNAL_POSITION 'p' +#define PG_DIAG_INTERNAL_QUERY 'q' +#define PG_DIAG_CONTEXT 'W' +#define PG_DIAG_SCHEMA_NAME 's' +#define PG_DIAG_TABLE_NAME 't' +#define PG_DIAG_COLUMN_NAME 'c' +#define PG_DIAG_DATATYPE_NAME 'd' +#define PG_DIAG_CONSTRAINT_NAME 'n' +#define PG_DIAG_SOURCE_FILE 'F' +#define PG_DIAG_SOURCE_LINE 'L' +#define PG_DIAG_SOURCE_FUNCTION 'R' + +#endif /* POSTGRES_EXT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postgres_fe.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postgres_fe.h new file mode 100644 index 0000000..a3f65b1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postgres_fe.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * postgres_fe.h + * Primary include file for PostgreSQL client-side .c files + * + * This should be the first file included by PostgreSQL client libraries and + * application programs --- but not by backend modules, which should include + * postgres.h. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1995, Regents of the University of California + * + * src/include/postgres_fe.h + * + *------------------------------------------------------------------------- + */ +/* IWYU pragma: always_keep */ +#ifndef POSTGRES_FE_H +#define POSTGRES_FE_H + +#ifndef FRONTEND +#define FRONTEND 1 +#endif + +/* IWYU pragma: begin_exports */ + +#include "c.h" + +#include "common/fe_memutils.h" + +/* IWYU pragma: end_exports */ + +#endif /* POSTGRES_FE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/autovacuum.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/autovacuum.h new file mode 100644 index 0000000..e8135f4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/autovacuum.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------------------- + * + * autovacuum.h + * header file for integrated autovacuum daemon + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/postmaster/autovacuum.h + * + *------------------------------------------------------------------------- + */ +#ifndef AUTOVACUUM_H +#define AUTOVACUUM_H + +#include "storage/block.h" + +/* + * Other processes can request specific work from autovacuum, identified by + * AutoVacuumWorkItem elements. + */ +typedef enum +{ + AVW_BRINSummarizeRange, +} AutoVacuumWorkItemType; + + +/* GUC variables */ +extern PGDLLIMPORT bool autovacuum_start_daemon; +extern PGDLLIMPORT int autovacuum_worker_slots; +extern PGDLLIMPORT int autovacuum_max_workers; +extern PGDLLIMPORT int autovacuum_work_mem; +extern PGDLLIMPORT int autovacuum_naptime; +extern PGDLLIMPORT int autovacuum_vac_thresh; +extern PGDLLIMPORT int autovacuum_vac_max_thresh; +extern PGDLLIMPORT double autovacuum_vac_scale; +extern PGDLLIMPORT int autovacuum_vac_ins_thresh; +extern PGDLLIMPORT double autovacuum_vac_ins_scale; +extern PGDLLIMPORT int autovacuum_anl_thresh; +extern PGDLLIMPORT double autovacuum_anl_scale; +extern PGDLLIMPORT int autovacuum_freeze_max_age; +extern PGDLLIMPORT int autovacuum_multixact_freeze_max_age; +extern PGDLLIMPORT double autovacuum_vac_cost_delay; +extern PGDLLIMPORT int autovacuum_vac_cost_limit; + +/* autovacuum launcher PID, only valid when worker is shutting down */ +extern PGDLLIMPORT int AutovacuumLauncherPid; + +extern PGDLLIMPORT int Log_autovacuum_min_duration; + +/* Status inquiry functions */ +extern bool AutoVacuumingActive(void); + +/* called from postmaster at server startup */ +extern void autovac_init(void); + +/* called from postmaster when a worker could not be forked */ +extern void AutoVacWorkerFailed(void); + +pg_noreturn extern void AutoVacLauncherMain(const void *startup_data, size_t startup_data_len); +pg_noreturn extern void AutoVacWorkerMain(const void *startup_data, size_t startup_data_len); + +extern bool AutoVacuumRequestWork(AutoVacuumWorkItemType type, + Oid relationId, BlockNumber blkno); + +/* shared memory stuff */ +extern Size AutoVacuumShmemSize(void); +extern void AutoVacuumShmemInit(void); + +#endif /* AUTOVACUUM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/auxprocess.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/auxprocess.h new file mode 100644 index 0000000..23d4b2a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/auxprocess.h @@ -0,0 +1,18 @@ +/*------------------------------------------------------------------------- + * auxprocess.h + * include file for functions related to auxiliary processes. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/postmaster/auxprocess.h + *------------------------------------------------------------------------- + */ +#ifndef AUXPROCESS_H +#define AUXPROCESS_H + +extern void AuxiliaryProcessMainCommon(void); + +#endif /* AUXPROCESS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/bgworker.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/bgworker.h new file mode 100644 index 0000000..058667a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/bgworker.h @@ -0,0 +1,164 @@ +/*-------------------------------------------------------------------- + * bgworker.h + * POSTGRES pluggable background workers interface + * + * A background worker is a process able to run arbitrary, user-supplied code, + * including normal transactions. + * + * Any external module loaded via shared_preload_libraries can register a + * worker. Workers can also be registered dynamically at runtime. In either + * case, the worker process is forked from the postmaster and runs the + * user-supplied "main" function. This code may connect to a database and + * run transactions. Workers can remain active indefinitely, but will be + * terminated if a shutdown or crash occurs. + * + * If the fork() call fails in the postmaster, it will try again later. Note + * that the failure can only be transient (fork failure due to high load, + * memory pressure, too many processes, etc); more permanent problems, like + * failure to connect to a database, are detected later in the worker and dealt + * with just by having the worker exit normally. A worker which exits with + * a return code of 0 will never be restarted and will be removed from worker + * list. A worker which exits with a return code of 1 will be restarted after + * the configured restart interval (unless that interval is BGW_NEVER_RESTART). + * The TerminateBackgroundWorker() function can be used to terminate a + * dynamically registered background worker; the worker will be sent a SIGTERM + * and will not be restarted after it exits. Whenever the postmaster knows + * that a worker will not be restarted, it unregisters the worker, freeing up + * that worker's slot for use by a new worker. + * + * Note that there might be more than one worker in a database concurrently, + * and the same module may request more than one worker running the same (or + * different) code. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/postmaster/bgworker.h + *-------------------------------------------------------------------- + */ +#ifndef BGWORKER_H +#define BGWORKER_H + +/*--------------------------------------------------------------------- + * External module API. + *--------------------------------------------------------------------- + */ + +/* + * Pass this flag to have your worker be able to connect to shared memory. + * This flag is required. + */ +#define BGWORKER_SHMEM_ACCESS 0x0001 + +/* + * This flag means the bgworker requires a database connection. The connection + * is not established automatically; the worker must establish it later. + * It requires that BGWORKER_SHMEM_ACCESS was passed too. + */ +#define BGWORKER_BACKEND_DATABASE_CONNECTION 0x0002 + +/* + * This class is used internally for parallel queries, to keep track of the + * number of active parallel workers and make sure we never launch more than + * max_parallel_workers parallel workers at the same time. Third party + * background workers should not use this class. + */ +#define BGWORKER_CLASS_PARALLEL 0x0010 +/* add additional bgworker classes here */ + + +typedef void (*bgworker_main_type) (Datum main_arg); + +/* + * Points in time at which a bgworker can request to be started + */ +typedef enum +{ + BgWorkerStart_PostmasterStart, + BgWorkerStart_ConsistentState, + BgWorkerStart_RecoveryFinished, +} BgWorkerStartTime; + +#define BGW_DEFAULT_RESTART_INTERVAL 60 +#define BGW_NEVER_RESTART -1 +#define BGW_MAXLEN 96 +#define BGW_EXTRALEN 128 + +typedef struct BackgroundWorker +{ + char bgw_name[BGW_MAXLEN]; + char bgw_type[BGW_MAXLEN]; + int bgw_flags; + BgWorkerStartTime bgw_start_time; + int bgw_restart_time; /* in seconds, or BGW_NEVER_RESTART */ + char bgw_library_name[MAXPGPATH]; + char bgw_function_name[BGW_MAXLEN]; + Datum bgw_main_arg; + char bgw_extra[BGW_EXTRALEN]; + pid_t bgw_notify_pid; /* SIGUSR1 this backend on start/stop */ +} BackgroundWorker; + +typedef enum BgwHandleStatus +{ + BGWH_STARTED, /* worker is running */ + BGWH_NOT_YET_STARTED, /* worker hasn't been started yet */ + BGWH_STOPPED, /* worker has exited */ + BGWH_POSTMASTER_DIED, /* postmaster died; worker status unclear */ +} BgwHandleStatus; + +struct BackgroundWorkerHandle; +typedef struct BackgroundWorkerHandle BackgroundWorkerHandle; + +/* Register a new bgworker during shared_preload_libraries */ +extern void RegisterBackgroundWorker(BackgroundWorker *worker); + +/* Register a new bgworker from a regular backend */ +extern bool RegisterDynamicBackgroundWorker(BackgroundWorker *worker, + BackgroundWorkerHandle **handle); + +/* Query the status of a bgworker */ +extern BgwHandleStatus GetBackgroundWorkerPid(BackgroundWorkerHandle *handle, + pid_t *pidp); +extern BgwHandleStatus WaitForBackgroundWorkerStartup(BackgroundWorkerHandle *handle, pid_t *pidp); +extern BgwHandleStatus + WaitForBackgroundWorkerShutdown(BackgroundWorkerHandle *); +extern const char *GetBackgroundWorkerTypeByPid(pid_t pid); + +/* Terminate a bgworker */ +extern void TerminateBackgroundWorker(BackgroundWorkerHandle *handle); + +/* This is valid in a running worker */ +extern PGDLLIMPORT BackgroundWorker *MyBgworkerEntry; + +/* + * Connect to the specified database, as the specified user. Only a worker + * that passed BGWORKER_BACKEND_DATABASE_CONNECTION during registration may + * call this. + * + * If username is NULL, bootstrapping superuser is used. + * If dbname is NULL, connection is made to no specific database; + * only shared catalogs can be accessed. + */ +extern void BackgroundWorkerInitializeConnection(const char *dbname, const char *username, uint32 flags); + +/* Just like the above, but specifying database and user by OID. */ +extern void BackgroundWorkerInitializeConnectionByOid(Oid dboid, Oid useroid, uint32 flags); + +/* + * Flags to BackgroundWorkerInitializeConnection et al + * + * + * Allow bypassing datallowconn restrictions and login check when connecting + * to database + */ +#define BGWORKER_BYPASS_ALLOWCONN 0x0001 +#define BGWORKER_BYPASS_ROLELOGINCHECK 0x0002 + + +/* Block/unblock signals in a background worker process */ +extern void BackgroundWorkerBlockSignals(void); +extern void BackgroundWorkerUnblockSignals(void); + +#endif /* BGWORKER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/bgworker_internals.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/bgworker_internals.h new file mode 100644 index 0000000..26cbc82 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/bgworker_internals.h @@ -0,0 +1,57 @@ +/*-------------------------------------------------------------------- + * bgworker_internals.h + * POSTGRES pluggable background workers internals + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/postmaster/bgworker_internals.h + *-------------------------------------------------------------------- + */ +#ifndef BGWORKER_INTERNALS_H +#define BGWORKER_INTERNALS_H + +#include "datatype/timestamp.h" +#include "lib/ilist.h" +#include "postmaster/bgworker.h" + +/* GUC options */ + +/* + * Maximum possible value of parallel workers. + */ +#define MAX_PARALLEL_WORKER_LIMIT 1024 + +/* + * List of background workers, private to postmaster. + * + * All workers that are currently running will also have an entry in + * ActiveChildList. + */ +typedef struct RegisteredBgWorker +{ + BackgroundWorker rw_worker; /* its registry entry */ + pid_t rw_pid; /* 0 if not running */ + TimestampTz rw_crashed_at; /* if not 0, time it last crashed */ + int rw_shmem_slot; + bool rw_terminate; + dlist_node rw_lnode; /* list link */ +} RegisteredBgWorker; + +extern PGDLLIMPORT dlist_head BackgroundWorkerList; + +extern Size BackgroundWorkerShmemSize(void); +extern void BackgroundWorkerShmemInit(void); +extern void BackgroundWorkerStateChange(bool allow_new_workers); +extern void ForgetBackgroundWorker(RegisteredBgWorker *rw); +extern void ReportBackgroundWorkerPID(RegisteredBgWorker *rw); +extern void ReportBackgroundWorkerExit(RegisteredBgWorker *rw); +extern void BackgroundWorkerStopNotifications(pid_t pid); +extern void ForgetUnstartedBackgroundWorkers(void); +extern void ResetBackgroundWorkerCrashTimes(void); + +/* Entry point for background worker processes */ +pg_noreturn extern void BackgroundWorkerMain(const void *startup_data, size_t startup_data_len); + +#endif /* BGWORKER_INTERNALS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/bgwriter.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/bgwriter.h new file mode 100644 index 0000000..800ecbf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/bgwriter.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * bgwriter.h + * Exports from postmaster/bgwriter.c and postmaster/checkpointer.c. + * + * The bgwriter process used to handle checkpointing duties too. Now + * there is a separate process, but we did not bother to split this header. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/postmaster/bgwriter.h + * + *------------------------------------------------------------------------- + */ +#ifndef _BGWRITER_H +#define _BGWRITER_H + +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "storage/smgr.h" +#include "storage/sync.h" + + +/* GUC options */ +extern PGDLLIMPORT int BgWriterDelay; +extern PGDLLIMPORT int CheckPointTimeout; +extern PGDLLIMPORT int CheckPointWarning; +extern PGDLLIMPORT double CheckPointCompletionTarget; + +pg_noreturn extern void BackgroundWriterMain(const void *startup_data, size_t startup_data_len); +pg_noreturn extern void CheckpointerMain(const void *startup_data, size_t startup_data_len); + +extern void RequestCheckpoint(int flags); +extern void CheckpointWriteDelay(int flags, double progress); + +extern bool ForwardSyncRequest(const FileTag *ftag, SyncRequestType type); + +extern void AbsorbSyncRequests(void); + +extern Size CheckpointerShmemSize(void); +extern void CheckpointerShmemInit(void); + +extern bool FirstCallSinceLastCheckpoint(void); + +#endif /* _BGWRITER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/fork_process.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/fork_process.h new file mode 100644 index 0000000..a1b2031 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/fork_process.h @@ -0,0 +1,17 @@ +/*------------------------------------------------------------------------- + * + * fork_process.h + * Exports from postmaster/fork_process.c. + * + * Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/postmaster/fork_process.h + * + *------------------------------------------------------------------------- + */ +#ifndef FORK_PROCESS_H +#define FORK_PROCESS_H + +extern pid_t fork_process(void); + +#endif /* FORK_PROCESS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/interrupt.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/interrupt.h new file mode 100644 index 0000000..3bf4932 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/interrupt.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * interrupt.h + * Interrupt handling routines. + * + * Responses to interrupts are fairly varied and many types of backends + * have their own implementations, but we provide a few generic things + * here to facilitate code reuse. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/postmaster/interrupt.h + * + *------------------------------------------------------------------------- + */ + +#ifndef INTERRUPT_H +#define INTERRUPT_H + +#include + +extern PGDLLIMPORT volatile sig_atomic_t ConfigReloadPending; +extern PGDLLIMPORT volatile sig_atomic_t ShutdownRequestPending; + +extern void ProcessMainLoopInterrupts(void); +extern void SignalHandlerForConfigReload(SIGNAL_ARGS); +extern void SignalHandlerForCrashExit(SIGNAL_ARGS); +extern void SignalHandlerForShutdownRequest(SIGNAL_ARGS); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/pgarch.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/pgarch.h new file mode 100644 index 0000000..ef7b125 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/pgarch.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pgarch.h + * Exports from postmaster/pgarch.c. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/postmaster/pgarch.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PGARCH_H +#define _PGARCH_H + +/* ---------- + * Archiver control info. + * + * We expect that archivable files within pg_wal will have names between + * MIN_XFN_CHARS and MAX_XFN_CHARS in length, consisting only of characters + * appearing in VALID_XFN_CHARS. The status files in archive_status have + * corresponding names with ".ready" or ".done" appended. + * ---------- + */ +#define MIN_XFN_CHARS 16 +#define MAX_XFN_CHARS 40 +#define VALID_XFN_CHARS "0123456789ABCDEF.history.backup.partial" + +extern Size PgArchShmemSize(void); +extern void PgArchShmemInit(void); +extern bool PgArchCanRestart(void); +pg_noreturn extern void PgArchiverMain(const void *startup_data, size_t startup_data_len); +extern void PgArchWakeup(void); +extern void PgArchForceDirScan(void); + +#endif /* _PGARCH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/postmaster.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/postmaster.h new file mode 100644 index 0000000..7538710 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/postmaster.h @@ -0,0 +1,145 @@ +/*------------------------------------------------------------------------- + * + * postmaster.h + * Exports from postmaster/postmaster.c. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/postmaster/postmaster.h + * + *------------------------------------------------------------------------- + */ +#ifndef _POSTMASTER_H +#define _POSTMASTER_H + +#include "lib/ilist.h" +#include "miscadmin.h" + +/* + * A struct representing an active postmaster child process. This is used + * mainly to keep track of how many children we have and send them appropriate + * signals when necessary. All postmaster child processes are assigned a + * PMChild entry. That includes "normal" client sessions, but also autovacuum + * workers, walsenders, background workers, and aux processes. (Note that at + * the time of launch, walsenders are labeled B_BACKEND; we relabel them to + * B_WAL_SENDER upon noticing they've changed their PMChildFlags entry. Hence + * that check must be done before any operation that needs to distinguish + * walsenders from normal backends.) + * + * "dead-end" children are also allocated a PMChild entry: these are children + * launched just for the purpose of sending a friendly rejection message to a + * would-be client. We must track them because they are attached to shared + * memory, but we know they will never become live backends. + * + * child_slot is an identifier that is unique across all running child + * processes. It is used as an index into the PMChildFlags array. dead-end + * children are not assigned a child_slot and have child_slot == 0 (valid + * child_slot ids start from 1). + */ +typedef struct +{ + pid_t pid; /* process id of backend */ + int child_slot; /* PMChildSlot for this backend, if any */ + BackendType bkend_type; /* child process flavor, see above */ + struct RegisteredBgWorker *rw; /* bgworker info, if this is a bgworker */ + bool bgworker_notify; /* gets bgworker start/stop notifications */ + dlist_node elem; /* list link in ActiveChildList */ +} PMChild; + +#ifdef EXEC_BACKEND +extern PGDLLIMPORT int num_pmchild_slots; +#endif + +/* GUC options */ +extern PGDLLIMPORT bool EnableSSL; +extern PGDLLIMPORT int SuperuserReservedConnections; +extern PGDLLIMPORT int ReservedConnections; +extern PGDLLIMPORT int PostPortNumber; +extern PGDLLIMPORT int Unix_socket_permissions; +extern PGDLLIMPORT char *Unix_socket_group; +extern PGDLLIMPORT char *Unix_socket_directories; +extern PGDLLIMPORT char *ListenAddresses; +extern PGDLLIMPORT bool ClientAuthInProgress; +extern PGDLLIMPORT int PreAuthDelay; +extern PGDLLIMPORT int AuthenticationTimeout; +extern PGDLLIMPORT bool log_hostname; +extern PGDLLIMPORT bool enable_bonjour; +extern PGDLLIMPORT char *bonjour_name; +extern PGDLLIMPORT bool restart_after_crash; +extern PGDLLIMPORT bool remove_temp_files_after_crash; +extern PGDLLIMPORT bool send_abort_for_crash; +extern PGDLLIMPORT bool send_abort_for_kill; + +#ifdef WIN32 +extern PGDLLIMPORT HANDLE PostmasterHandle; +#else +extern PGDLLIMPORT int postmaster_alive_fds[2]; + +/* + * Constants that represent which of postmaster_alive_fds is held by + * postmaster, and which is used in children to check for postmaster death. + */ +#define POSTMASTER_FD_WATCH 0 /* used in children to check for + * postmaster death */ +#define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */ +#endif + +extern PGDLLIMPORT const char *progname; + +extern PGDLLIMPORT bool redirection_done; +extern PGDLLIMPORT bool LoadedSSL; + +pg_noreturn extern void PostmasterMain(int argc, char *argv[]); +extern void ClosePostmasterPorts(bool am_syslogger); +extern void InitProcessGlobals(void); + +extern int MaxLivePostmasterChildren(void); + +extern bool PostmasterMarkPIDForWorkerNotify(int); + +#ifdef WIN32 +extern void pgwin32_register_deadchild_callback(HANDLE procHandle, DWORD procId); +#endif + +/* defined in globals.c */ +extern PGDLLIMPORT struct ClientSocket *MyClientSocket; + +/* prototypes for functions in launch_backend.c */ +extern pid_t postmaster_child_launch(BackendType child_type, + int child_slot, + void *startup_data, + size_t startup_data_len, + struct ClientSocket *client_sock); +const char *PostmasterChildName(BackendType child_type); +#ifdef EXEC_BACKEND +pg_noreturn extern void SubPostmasterMain(int argc, char *argv[]); +#endif + +/* defined in pmchild.c */ +extern PGDLLIMPORT dlist_head ActiveChildList; + +extern void InitPostmasterChildSlots(void); +extern PMChild *AssignPostmasterChildSlot(BackendType btype); +extern PMChild *AllocDeadEndChild(void); +extern bool ReleasePostmasterChildSlot(PMChild *pmchild); +extern PMChild *FindPostmasterChildByPid(int pid); + +/* + * These values correspond to the special must-be-first options for dispatching + * to various subprograms. parse_dispatch_option() can be used to convert an + * option name to one of these values. + */ +typedef enum DispatchOption +{ + DISPATCH_CHECK, + DISPATCH_BOOT, + DISPATCH_FORKCHILD, + DISPATCH_DESCRIBE_CONFIG, + DISPATCH_SINGLE, + DISPATCH_POSTMASTER, /* must be last */ +} DispatchOption; + +extern DispatchOption parse_dispatch_option(const char *name); + +#endif /* _POSTMASTER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/startup.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/startup.h new file mode 100644 index 0000000..ec2c8d3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/startup.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * startup.h + * Exports from postmaster/startup.c. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/postmaster/startup.h + * + *------------------------------------------------------------------------- + */ +#ifndef _STARTUP_H +#define _STARTUP_H + +/* + * Log the startup progress message if a timer has expired. + */ +#define ereport_startup_progress(msg, ...) \ + do { \ + long secs; \ + int usecs; \ + if (has_startup_progress_timeout_expired(&secs, &usecs)) \ + ereport(LOG, errmsg(msg, secs, (usecs / 10000), __VA_ARGS__ )); \ + } while(0) + +extern PGDLLIMPORT int log_startup_progress_interval; + +extern void ProcessStartupProcInterrupts(void); +pg_noreturn extern void StartupProcessMain(const void *startup_data, size_t startup_data_len); +extern void PreRestoreCommand(void); +extern void PostRestoreCommand(void); +extern bool IsPromoteSignaled(void); +extern void ResetPromoteSignaled(void); + +extern void enable_startup_progress_timeout(void); +extern void disable_startup_progress_timeout(void); +extern void begin_startup_progress_phase(void); +extern void startup_progress_timeout_handler(void); +extern bool has_startup_progress_timeout_expired(long *secs, int *usecs); + +#endif /* _STARTUP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/syslogger.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/syslogger.h new file mode 100644 index 0000000..15fca58 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/syslogger.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * syslogger.h + * Exports from postmaster/syslogger.c. + * + * Copyright (c) 2004-2025, PostgreSQL Global Development Group + * + * src/include/postmaster/syslogger.h + * + *------------------------------------------------------------------------- + */ +#ifndef _SYSLOGGER_H +#define _SYSLOGGER_H + +#include /* for PIPE_BUF */ + + +/* + * Primitive protocol structure for writing to syslogger pipe(s). The idea + * here is to divide long messages into chunks that are not more than + * PIPE_BUF bytes long, which according to POSIX spec must be written into + * the pipe atomically. The pipe reader then uses the protocol headers to + * reassemble the parts of a message into a single string. The reader can + * also cope with non-protocol data coming down the pipe, though we cannot + * guarantee long strings won't get split apart. + * + * We use non-nul bytes in is_last to make the protocol a tiny bit + * more robust against finding a false double nul byte prologue. But + * we still might find it in the len and/or pid bytes unless we're careful. + */ + +#ifdef PIPE_BUF +/* Are there any systems with PIPE_BUF > 64K? Unlikely, but ... */ +#if PIPE_BUF > 65536 +#define PIPE_CHUNK_SIZE 65536 +#else +#define PIPE_CHUNK_SIZE ((int) PIPE_BUF) +#endif +#else /* not defined */ +/* POSIX says the value of PIPE_BUF must be at least 512, so use that */ +#define PIPE_CHUNK_SIZE 512 +#endif + +typedef struct +{ + char nuls[2]; /* always \0\0 */ + uint16 len; /* size of this chunk (counts data only) */ + int32 pid; /* writer's pid */ + bits8 flags; /* bitmask of PIPE_PROTO_* */ + char data[FLEXIBLE_ARRAY_MEMBER]; /* data payload starts here */ +} PipeProtoHeader; + +typedef union +{ + PipeProtoHeader proto; + char filler[PIPE_CHUNK_SIZE]; +} PipeProtoChunk; + +#define PIPE_HEADER_SIZE offsetof(PipeProtoHeader, data) +#define PIPE_MAX_PAYLOAD ((int) (PIPE_CHUNK_SIZE - PIPE_HEADER_SIZE)) + +/* flag bits for PipeProtoHeader->flags */ +#define PIPE_PROTO_IS_LAST 0x01 /* last chunk of message? */ +/* log destinations */ +#define PIPE_PROTO_DEST_STDERR 0x10 +#define PIPE_PROTO_DEST_CSVLOG 0x20 +#define PIPE_PROTO_DEST_JSONLOG 0x40 + +/* GUC options */ +extern PGDLLIMPORT bool Logging_collector; +extern PGDLLIMPORT int Log_RotationAge; +extern PGDLLIMPORT int Log_RotationSize; +extern PGDLLIMPORT char *Log_directory; +extern PGDLLIMPORT char *Log_filename; +extern PGDLLIMPORT bool Log_truncate_on_rotation; +extern PGDLLIMPORT int Log_file_mode; + +#ifdef EXEC_BACKEND +extern PGDLLIMPORT pg_time_t first_syslogger_file_time; +#endif + +#ifndef WIN32 +extern PGDLLIMPORT int syslogPipe[2]; +#else +extern PGDLLIMPORT HANDLE syslogPipe[2]; +#endif + + +extern int SysLogger_Start(int child_slot); + +extern void write_syslogger_file(const char *buffer, int count, int destination); + +pg_noreturn extern void SysLoggerMain(const void *startup_data, size_t startup_data_len); + +extern bool CheckLogrotateSignal(void); +extern void RemoveLogrotateSignalFiles(void); + +/* + * Name of files saving meta-data information about the log + * files currently in use by the syslogger + */ +#define LOG_METAINFO_DATAFILE "current_logfiles" +#define LOG_METAINFO_DATAFILE_TMP LOG_METAINFO_DATAFILE ".tmp" + +#endif /* _SYSLOGGER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/walsummarizer.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/walsummarizer.h new file mode 100644 index 0000000..34dda60 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/walsummarizer.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * walsummarizer.h + * + * Header file for background WAL summarization process. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/postmaster/walsummarizer.h + * + *------------------------------------------------------------------------- + */ +#ifndef WALSUMMARIZER_H +#define WALSUMMARIZER_H + +#include "access/xlogdefs.h" + +extern PGDLLIMPORT bool summarize_wal; +extern PGDLLIMPORT int wal_summary_keep_time; + +extern Size WalSummarizerShmemSize(void); +extern void WalSummarizerShmemInit(void); +pg_noreturn extern void WalSummarizerMain(const void *startup_data, size_t startup_data_len); + +extern void GetWalSummarizerState(TimeLineID *summarized_tli, + XLogRecPtr *summarized_lsn, + XLogRecPtr *pending_lsn, + int *summarizer_pid); +extern XLogRecPtr GetOldestUnsummarizedLSN(TimeLineID *tli, + bool *lsn_is_exact); +extern void WakeupWalSummarizer(void); +extern void WaitForWalSummarization(XLogRecPtr lsn); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/walwriter.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/walwriter.h new file mode 100644 index 0000000..58e5c91 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/postmaster/walwriter.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * walwriter.h + * Exports from postmaster/walwriter.c. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/postmaster/walwriter.h + * + *------------------------------------------------------------------------- + */ +#ifndef _WALWRITER_H +#define _WALWRITER_H + +#define DEFAULT_WAL_WRITER_FLUSH_AFTER ((1024 * 1024) / XLOG_BLCKSZ) + +/* GUC options */ +extern PGDLLIMPORT int WalWriterDelay; +extern PGDLLIMPORT int WalWriterFlushAfter; + +pg_noreturn extern void WalWriterMain(const void *startup_data, size_t startup_data_len); + +#endif /* _WALWRITER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regcustom.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regcustom.h new file mode 100644 index 0000000..af0fe97 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regcustom.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. + * + * Development of this software was funded, in part, by Cray Research Inc., + * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics + * Corporation, none of whom are responsible for the results. The author + * thanks all of them. + * + * Redistribution and use in source and binary forms -- with or without + * modification -- are permitted for any purpose, provided that + * redistributions in source form retain this entire copyright notice and + * indicate the origin and nature of any modifications. + * + * I'd appreciate being given credit for this package in the documentation + * of software which uses it, but that is not a requirement. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * src/include/regex/regcustom.h + */ + +/* headers if any */ + +/* + * It's against Postgres coding conventions to include postgres.h in a + * header file, but we allow the violation here because the regexp library + * files specifically intend this file to supply application-dependent + * headers, and are careful to include this file before anything else. + */ +#include "postgres.h" + +#include +#include +#include + +#include "mb/pg_wchar.h" + +#include "miscadmin.h" /* needed by rstacktoodeep */ + + +/* overrides for regguts.h definitions, if any */ +#define FUNCPTR(name, args) (*name) args +#define MALLOC(n) palloc_extended((n), MCXT_ALLOC_NO_OOM) +#define FREE(p) pfree(VS(p)) +#define REALLOC(p,n) repalloc_extended(VS(p),(n), MCXT_ALLOC_NO_OOM) +#define INTERRUPT(re) CHECK_FOR_INTERRUPTS() +#define assert(x) Assert(x) + +/* internal character type and related */ +typedef pg_wchar chr; /* the type itself */ +typedef unsigned uchr; /* unsigned type that will hold a chr */ + +#define CHR(c) ((unsigned char) (c)) /* turn char literal into chr literal */ +#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */ +#define CHRBITS 32 /* bits in a chr; must not use sizeof */ +#define CHR_MIN 0x00000000 /* smallest and largest chr; the value */ +#define CHR_MAX 0x7ffffffe /* CHR_MAX-CHR_MIN+1 must fit in an int, and + * CHR_MAX+1 must fit in a chr variable */ + +/* + * Check if a chr value is in range. Ideally we'd just write this as + * ((c) >= CHR_MIN && (c) <= CHR_MAX) + * However, if chr is unsigned and CHR_MIN is zero, the first part of that + * is a no-op, and certain overly-nannyish compilers give warnings about it. + * So we leave that out here. If you want to make chr signed and/or CHR_MIN + * not zero, redefine this macro as above. Callers should assume that the + * macro may multiply evaluate its argument, even though it does not today. + */ +#define CHR_IS_IN_RANGE(c) ((c) <= CHR_MAX) + +/* + * MAX_SIMPLE_CHR is the cutoff between "simple" and "complicated" processing + * in the color map logic. It should usually be chosen high enough to ensure + * that all common characters are <= MAX_SIMPLE_CHR. However, very large + * values will be counterproductive since they cause more regex setup time. + * Also, small values can be helpful for testing the high-color-map logic + * with plain old ASCII input. + */ +#define MAX_SIMPLE_CHR 0x7FF /* suitable value for Unicode */ + +/* functions operating on chr */ +#define iscalnum(x) pg_wc_isalnum(x) +#define iscalpha(x) pg_wc_isalpha(x) +#define iscdigit(x) pg_wc_isdigit(x) +#define iscspace(x) pg_wc_isspace(x) + +/* and pick up the standard header */ +#include "regex.h" diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regerrs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regerrs.h new file mode 100644 index 0000000..2c8873e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regerrs.h @@ -0,0 +1,83 @@ +/* + * src/include/regex/regerrs.h + */ + +{ + REG_OKAY, "REG_OKAY", "no errors detected" +}, + +{ + REG_NOMATCH, "REG_NOMATCH", "failed to match" +}, + +{ + REG_BADPAT, "REG_BADPAT", "invalid regexp (reg version 0.8)" +}, + +{ + REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" +}, + +{ + REG_ECTYPE, "REG_ECTYPE", "invalid character class" +}, + +{ + REG_EESCAPE, "REG_EESCAPE", "invalid escape \\ sequence" +}, + +{ + REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" +}, + +{ + REG_EBRACK, "REG_EBRACK", "brackets [] not balanced" +}, + +{ + REG_EPAREN, "REG_EPAREN", "parentheses () not balanced" +}, + +{ + REG_EBRACE, "REG_EBRACE", "braces {} not balanced" +}, + +{ + REG_BADBR, "REG_BADBR", "invalid repetition count(s)" +}, + +{ + REG_ERANGE, "REG_ERANGE", "invalid character range" +}, + +{ + REG_ESPACE, "REG_ESPACE", "out of memory" +}, + +{ + REG_BADRPT, "REG_BADRPT", "quantifier operand invalid" +}, + +{ + REG_ASSERT, "REG_ASSERT", "\"cannot happen\" -- you found a bug" +}, + +{ + REG_INVARG, "REG_INVARG", "invalid argument to regex function" +}, + +{ + REG_MIXED, "REG_MIXED", "character widths of regex and string differ" +}, + +{ + REG_BADOPT, "REG_BADOPT", "invalid embedded option" +}, + +{ + REG_ETOOBIG, "REG_ETOOBIG", "regular expression is too complex" +}, + +{ + REG_ECOLORS, "REG_ECOLORS", "too many colors" +}, diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regex.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regex.h new file mode 100644 index 0000000..f34ee3a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regex.h @@ -0,0 +1,272 @@ +#ifndef _PG_REGEX_H_ +#define _PG_REGEX_H_ /* never again */ +/* + * regular expressions + * + * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. + * + * Development of this software was funded, in part, by Cray Research Inc., + * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics + * Corporation, none of whom are responsible for the results. The author + * thanks all of them. + * + * Redistribution and use in source and binary forms -- with or without + * modification -- are permitted for any purpose, provided that + * redistributions in source form retain this entire copyright notice and + * indicate the origin and nature of any modifications. + * + * I'd appreciate being given credit for this package in the documentation + * of software which uses it, but that is not a requirement. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * src/include/regex/regex.h + */ + +/* + * This is an implementation of POSIX regex_t, so it clashes with the + * system-provided header. That header might be unintentionally + * included already, so we force that to happen now on all systems to show that + * we can cope and that we completely replace the system regex interfaces. + * + * Note that we avoided using _REGEX_H_ as an include guard, as that confuses + * matters on BSD family systems including macOS that use the same include + * guard. + */ +#ifndef _WIN32 +#include +#endif + +/* Avoid redefinition errors due to the system header. */ +#undef REG_UBACKREF +#undef REG_ULOOKAROUND +#undef REG_UBOUNDS +#undef REG_UBRACES +#undef REG_UBSALNUM +#undef REG_UPBOTCH +#undef REG_UBBS +#undef REG_UNONPOSIX +#undef REG_UUNSPEC +#undef REG_UUNPORT +#undef REG_ULOCALE +#undef REG_UEMPTYMATCH +#undef REG_UIMPOSSIBLE +#undef REG_USHORTEST +#undef REG_BASIC +#undef REG_EXTENDED +#undef REG_ADVF +#undef REG_ADVANCED +#undef REG_QUOTE +#undef REG_NOSPEC +#undef REG_ICASE +#undef REG_NOSUB +#undef REG_EXPANDED +#undef REG_NLSTOP +#undef REG_NLANCH +#undef REG_NEWLINE +#undef REG_PEND +#undef REG_EXPECT +#undef REG_BOSONLY +#undef REG_DUMP +#undef REG_FAKE +#undef REG_PROGRESS +#undef REG_NOTBOL +#undef REG_NOTEOL +#undef REG_STARTEND +#undef REG_FTRACE +#undef REG_MTRACE +#undef REG_SMALL +#undef REG_OKAY +#undef REG_NOMATCH +#undef REG_BADPAT +#undef REG_ECOLLATE +#undef REG_ECTYPE +#undef REG_EESCAPE +#undef REG_ESUBREG +#undef REG_EBRACK +#undef REG_EPAREN +#undef REG_EBRACE +#undef REG_BADBR +#undef REG_ERANGE +#undef REG_ESPACE +#undef REG_BADRPT +#undef REG_ASSERT +#undef REG_INVARG +#undef REG_MIXED +#undef REG_BADOPT +#undef REG_ETOOBIG +#undef REG_ECOLORS +#undef REG_ATOI +#undef REG_ITOA +#undef REG_PREFIX +#undef REG_EXACT + +/* + * Add your own defines, if needed, here. + */ +#include "mb/pg_wchar.h" + +/* + * interface types etc. + */ + +/* + * regoff_t has to be large enough to hold either off_t or ssize_t, + * and must be signed; it's only a guess that long is suitable. + */ +typedef long pg_regoff_t; + +/* + * other interface types + */ + +/* the biggie, a compiled RE (or rather, a front end to same) */ +typedef struct +{ + int re_magic; /* magic number */ + size_t re_nsub; /* number of subexpressions */ + long re_info; /* bitmask of the following flags: */ +#define REG_UBACKREF 000001 /* has back-reference (\n) */ +#define REG_ULOOKAROUND 000002 /* has lookahead/lookbehind constraint */ +#define REG_UBOUNDS 000004 /* has bounded quantifier ({m,n}) */ +#define REG_UBRACES 000010 /* has { that doesn't begin a quantifier */ +#define REG_UBSALNUM 000020 /* has backslash-alphanumeric in non-ARE */ +#define REG_UPBOTCH 000040 /* has unmatched right paren in ERE (legal + * per spec, but that was a mistake) */ +#define REG_UBBS 000100 /* has backslash within bracket expr */ +#define REG_UNONPOSIX 000200 /* has any construct that extends POSIX */ +#define REG_UUNSPEC 000400 /* has any case disallowed by POSIX, e.g. + * an empty branch */ +#define REG_UUNPORT 001000 /* has numeric character code dependency */ +#define REG_ULOCALE 002000 /* has locale dependency */ +#define REG_UEMPTYMATCH 004000 /* can match a zero-length string */ +#define REG_UIMPOSSIBLE 010000 /* provably cannot match anything */ +#define REG_USHORTEST 020000 /* has non-greedy quantifier */ + int re_csize; /* sizeof(character) */ + char *re_endp; /* backward compatibility kludge */ + Oid re_collation; /* Collation that defines LC_CTYPE behavior */ + /* the rest is opaque pointers to hidden innards */ + char *re_guts; /* `char *' is more portable than `void *' */ + char *re_fns; +} pg_regex_t; + +/* result reporting (may acquire more fields later) */ +typedef struct +{ + pg_regoff_t rm_so; /* start of substring */ + pg_regoff_t rm_eo; /* end of substring */ +} pg_regmatch_t; + +/* supplementary control and reporting */ +typedef struct +{ + pg_regmatch_t rm_extend; /* see REG_EXPECT */ +} rm_detail_t; + + + +/* + * regex compilation flags + */ +#define REG_BASIC 000000 /* BREs (convenience) */ +#define REG_EXTENDED 000001 /* EREs */ +#define REG_ADVF 000002 /* advanced features in EREs */ +#define REG_ADVANCED 000003 /* AREs (which are also EREs) */ +#define REG_QUOTE 000004 /* no special characters, none */ +#define REG_NOSPEC REG_QUOTE /* historical synonym */ +#define REG_ICASE 000010 /* ignore case */ +#define REG_NOSUB 000020 /* caller doesn't need subexpr match data */ +#define REG_EXPANDED 000040 /* expanded format, white space & comments */ +#define REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ +#define REG_NLANCH 000200 /* ^ matches after \n, $ before */ +#define REG_NEWLINE 000300 /* newlines are line terminators */ +#define REG_PEND 000400 /* ugh -- backward-compatibility hack */ +#define REG_EXPECT 001000 /* report details on partial/limited matches */ +#define REG_BOSONLY 002000 /* temporary kludge for BOS-only matches */ +#define REG_DUMP 004000 /* none of your business :-) */ +#define REG_FAKE 010000 /* none of your business :-) */ +#define REG_PROGRESS 020000 /* none of your business :-) */ + + + +/* + * regex execution flags + */ +#define REG_NOTBOL 0001 /* BOS is not BOL */ +#define REG_NOTEOL 0002 /* EOS is not EOL */ +#define REG_STARTEND 0004 /* backward compatibility kludge */ +#define REG_FTRACE 0010 /* none of your business */ +#define REG_MTRACE 0020 /* none of your business */ +#define REG_SMALL 0040 /* none of your business */ + + +/* + * error reporting + * Be careful if modifying the list of error codes -- the table used by + * regerror() is generated automatically from this file! + */ +#define REG_OKAY 0 /* no errors detected */ +#define REG_NOMATCH 1 /* failed to match */ +#define REG_BADPAT 2 /* invalid regexp */ +#define REG_ECOLLATE 3 /* invalid collating element */ +#define REG_ECTYPE 4 /* invalid character class */ +#define REG_EESCAPE 5 /* invalid escape \ sequence */ +#define REG_ESUBREG 6 /* invalid backreference number */ +#define REG_EBRACK 7 /* brackets [] not balanced */ +#define REG_EPAREN 8 /* parentheses () not balanced */ +#define REG_EBRACE 9 /* braces {} not balanced */ +#define REG_BADBR 10 /* invalid repetition count(s) */ +#define REG_ERANGE 11 /* invalid character range */ +#define REG_ESPACE 12 /* out of memory */ +#define REG_BADRPT 13 /* quantifier operand invalid */ +#define REG_ASSERT 15 /* "can't happen" -- you found a bug */ +#define REG_INVARG 16 /* invalid argument to regex function */ +#define REG_MIXED 17 /* character widths of regex and string differ */ +#define REG_BADOPT 18 /* invalid embedded option */ +#define REG_ETOOBIG 19 /* regular expression is too complex */ +#define REG_ECOLORS 20 /* too many colors */ +/* two specials for debugging and testing */ +#define REG_ATOI 101 /* convert error-code name to number */ +#define REG_ITOA 102 /* convert error-code number to name */ +/* non-error result codes for pg_regprefix */ +#define REG_PREFIX (-1) /* identified a common prefix */ +#define REG_EXACT (-2) /* identified an exact match */ + + +/* Redirect the standard typenames to our typenames. */ +#define regoff_t pg_regoff_t +#define regex_t pg_regex_t +#define regmatch_t pg_regmatch_t + + +/* + * the prototypes for exported functions + */ + +/* regcomp.c */ +extern int pg_regcomp(regex_t *re, const pg_wchar *string, size_t len, + int flags, Oid collation); +extern int pg_regexec(regex_t *re, const pg_wchar *string, size_t len, + size_t search_start, rm_detail_t *details, + size_t nmatch, regmatch_t pmatch[], int flags); +extern int pg_regprefix(regex_t *re, pg_wchar **string, size_t *slength); +extern void pg_regfree(regex_t *re); +extern size_t pg_regerror(int errcode, const regex_t *preg, char *errbuf, + size_t errbuf_size); + +/* regexp.c */ +extern regex_t *RE_compile_and_cache(text *text_re, int cflags, Oid collation); +extern bool RE_compile_and_execute(text *text_re, char *dat, int dat_len, + int cflags, Oid collation, + int nmatch, regmatch_t *pmatch); + +#endif /* _PG_REGEX_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regexport.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regexport.h new file mode 100644 index 0000000..fe086d1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regexport.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * regexport.h + * Declarations for exporting info about a regex's NFA (nondeterministic + * finite automaton) + * + * The functions declared here provide accessors to extract the NFA state + * graph and color character sets of a successfully-compiled regex. + * + * An NFA contains one or more states, numbered 0..N-1. There is an initial + * state, as well as a final state --- reaching the final state denotes + * successful matching of an input string. Each state except the final one + * has some out-arcs that lead to successor states, each arc being labeled + * with a color that represents one or more concrete character codes. + * (The colors of a state's out-arcs need not be distinct, since this is an + * NFA not a DFA.) There are also "pseudocolors" representing start/end of + * line and start/end of string. Colors are numbered 0..C-1, but note that + * color 0 is "white" (all unused characters) and can generally be ignored. + * + * Portions Copyright (c) 2013-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1998, 1999 Henry Spencer + * + * IDENTIFICATION + * src/include/regex/regexport.h + * + *------------------------------------------------------------------------- + */ +#ifndef _REGEXPORT_H_ +#define _REGEXPORT_H_ + +#include "regex/regex.h" + +/* These macros must match corresponding ones in regguts.h: */ +#define COLOR_WHITE 0 /* color for chars not appearing in regex */ +#define COLOR_RAINBOW (-2) /* represents all colors except pseudocolors */ + +/* information about one arc of a regex's NFA */ +typedef struct +{ + int co; /* label (character-set color) of arc */ + int to; /* next state number */ +} regex_arc_t; + + +/* Functions for gathering information about NFA states and arcs */ +extern int pg_reg_getnumstates(const regex_t *regex); +extern int pg_reg_getinitialstate(const regex_t *regex); +extern int pg_reg_getfinalstate(const regex_t *regex); +extern int pg_reg_getnumoutarcs(const regex_t *regex, int st); +extern void pg_reg_getoutarcs(const regex_t *regex, int st, + regex_arc_t *arcs, int arcs_len); + +/* Functions for gathering information about colors */ +extern int pg_reg_getnumcolors(const regex_t *regex); +extern int pg_reg_colorisbegin(const regex_t *regex, int co); +extern int pg_reg_colorisend(const regex_t *regex, int co); +extern int pg_reg_getnumcharacters(const regex_t *regex, int co); +extern void pg_reg_getcharacters(const regex_t *regex, int co, + pg_wchar *chars, int chars_len); + +#endif /* _REGEXPORT_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regguts.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regguts.h new file mode 100644 index 0000000..fd69299 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/regex/regguts.h @@ -0,0 +1,550 @@ +/* + * Internal interface definitions, etc., for the reg package + * + * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. + * + * Development of this software was funded, in part, by Cray Research Inc., + * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics + * Corporation, none of whom are responsible for the results. The author + * thanks all of them. + * + * Redistribution and use in source and binary forms -- with or without + * modification -- are permitted for any purpose, provided that + * redistributions in source form retain this entire copyright notice and + * indicate the origin and nature of any modifications. + * + * I'd appreciate being given credit for this package in the documentation + * of software which uses it, but that is not a requirement. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * src/include/regex/regguts.h + */ + + + +/* + * Environmental customization. It should not (I hope) be necessary to + * alter the file you are now reading -- regcustom.h should handle it all, + * given care here and elsewhere. + */ +#include "regcustom.h" + + + +/* + * Things that regcustom.h might override. + */ + +/* assertions */ +#ifndef assert +#ifndef REG_DEBUG +#define NDEBUG /* no assertions */ +#endif +#include +#endif + +/* voids */ +#ifndef DISCARD +#define DISCARD void /* for throwing values away */ +#endif +#ifndef VS +#define VS(x) ((void *)(x)) /* cast something to generic ptr */ +#endif + +/* function-pointer declarator */ +#ifndef FUNCPTR +#define FUNCPTR(name, args) (*(name)) args +#endif + +/* memory allocation */ +#ifndef MALLOC +#define MALLOC(n) malloc(n) +#endif +#ifndef REALLOC +#define REALLOC(p, n) realloc(VS(p), n) +#endif +#ifndef FREE +#define FREE(p) free(VS(p)) +#endif + +/* interruption */ +#ifndef INTERRUPT +#define INTERRUPT(re) +#endif + +/* want size of a char in bits, and max value in bounded quantifiers */ +#ifndef _POSIX2_RE_DUP_MAX +#define _POSIX2_RE_DUP_MAX 255 /* normally from */ +#endif + + + +/* + * misc + */ + +#define NOTREACHED 0 + +#define DUPMAX _POSIX2_RE_DUP_MAX +#define DUPINF (DUPMAX+1) + +#define REMAGIC 0xfed7 /* magic number for main struct */ + +/* Type codes for lookaround constraints */ +#define LATYPE_AHEAD_POS 03 /* positive lookahead */ +#define LATYPE_AHEAD_NEG 02 /* negative lookahead */ +#define LATYPE_BEHIND_POS 01 /* positive lookbehind */ +#define LATYPE_BEHIND_NEG 00 /* negative lookbehind */ +#define LATYPE_IS_POS(la) ((la) & 01) +#define LATYPE_IS_AHEAD(la) ((la) & 02) + + +/* + * debugging facilities + */ +#ifdef REG_DEBUG +/* FDEBUG does finite-state tracing */ +#define FDEBUG(arglist) { if (v->eflags®_FTRACE) printf arglist; } +/* MDEBUG does higher-level tracing */ +#define MDEBUG(arglist) { if (v->eflags®_MTRACE) printf arglist; } +#else +#define FDEBUG(arglist) {} +#define MDEBUG(arglist) {} +#endif + + + +/* + * bitmap manipulation + */ +#define UBITS (CHAR_BIT * sizeof(unsigned)) +#define BSET(uv, sn) ((uv)[(sn)/UBITS] |= (unsigned)1 << ((sn)%UBITS)) +#define ISBSET(uv, sn) ((uv)[(sn)/UBITS] & ((unsigned)1 << ((sn)%UBITS))) + + +/* + * known character classes + */ +enum char_classes +{ + CC_ALNUM, CC_ALPHA, CC_ASCII, CC_BLANK, CC_CNTRL, CC_DIGIT, CC_GRAPH, + CC_LOWER, CC_PRINT, CC_PUNCT, CC_SPACE, CC_UPPER, CC_XDIGIT, CC_WORD +}; + +#define NUM_CCLASSES 14 + + +/* + * As soon as possible, we map chrs into equivalence classes -- "colors" -- + * which are of much more manageable number. + * + * To further reduce the number of arcs in NFAs and DFAs, we also have a + * special RAINBOW "color" that can be assigned to an arc. This is not a + * real color, in that it has no entry in color maps. + */ +typedef short color; /* colors of characters */ + +#define MAX_COLOR 32767 /* max color (must fit in 'color' datatype) */ +#define COLORLESS (-1) /* impossible color */ +#define RAINBOW (-2) /* represents all colors except pseudocolors */ +#define WHITE 0 /* default color, parent of all others */ +/* Note: various places in the code know that WHITE is zero */ + + +/* + * Per-color data structure for the compile-time color machinery + * + * If "sub" is not NOSUB then it is the number of the color's current + * subcolor, i.e. we are in process of dividing this color (character + * equivalence class) into two colors. See src/backend/regex/README for + * discussion of subcolors. + * + * Currently-unused colors have the FREECOL bit set and are linked into a + * freelist using their "sub" fields, but only if their color numbers are + * less than colormap.max. Any array entries beyond "max" are just garbage. + */ +struct colordesc +{ + int nschrs; /* number of simple chars of this color */ + int nuchrs; /* number of upper map entries of this color */ + color sub; /* open subcolor, if any; or free-chain ptr */ +#define NOSUB COLORLESS /* value of "sub" when no open subcolor */ + struct arc *arcs; /* chain of all arcs of this color */ + chr firstchr; /* simple char first assigned to this color */ + int flags; /* bitmask of the following flags: */ +#define FREECOL 01 /* currently free */ +#define PSEUDO 02 /* pseudocolor, no real chars */ +#define COLMARK 04 /* temporary marker used in some functions */ +}; + +#define UNUSEDCOLOR(cd) ((cd)->flags & FREECOL) + +/* + * The color map itself + * + * This struct holds both data used only at compile time, and the chr to + * color mapping information, used at both compile and run time. The latter + * is the bulk of the space, so it's not really worth separating out the + * compile-only portion. + * + * Ideally, the mapping data would just be an array of colors indexed by + * chr codes; but for large character sets that's impractical. Fortunately, + * common characters have smaller codes, so we can use a simple array for chr + * codes up to MAX_SIMPLE_CHR, and do something more complex for codes above + * that, without much loss of performance. The "something more complex" is a + * 2-D array of color entries, where row indexes correspond to individual chrs + * or chr ranges that have been mentioned in the regex (with row zero + * representing all other chrs), and column indexes correspond to different + * sets of locale-dependent character classes such as "isalpha". The + * classbits[k] entry is zero if we do not care about the k'th character class + * in this regex, and otherwise it is the bit to be OR'd into the column index + * if the character in question is a member of that class. We find the color + * of a high-valued chr by identifying which colormaprange it is in to get + * the row index (use row zero if it's in none of them), identifying which of + * the interesting cclasses it's in to get the column index, and then indexing + * into the 2-D hicolormap array. + * + * The colormapranges are required to be nonempty, nonoverlapping, and to + * appear in increasing chr-value order. + */ + +typedef struct colormaprange +{ + chr cmin; /* range represents cmin..cmax inclusive */ + chr cmax; + int rownum; /* row index in hicolormap array (>= 1) */ +} colormaprange; + +struct colormap +{ + int magic; +#define CMMAGIC 0x876 + struct vars *v; /* for compile error reporting */ + size_t ncds; /* allocated length of colordescs array */ + size_t max; /* highest color number currently in use */ + color free; /* beginning of free chain (if non-0) */ + struct colordesc *cd; /* pointer to array of colordescs */ +#define CDEND(cm) (&(cm)->cd[(cm)->max + 1]) + + /* mapping data for chrs <= MAX_SIMPLE_CHR: */ + color *locolormap; /* simple array indexed by chr code */ + + /* mapping data for chrs > MAX_SIMPLE_CHR: */ + int classbits[NUM_CCLASSES]; /* see comment above */ + int numcmranges; /* number of colormapranges */ + colormaprange *cmranges; /* ranges of high chrs */ + color *hicolormap; /* 2-D array of color entries */ + int maxarrayrows; /* number of array rows allocated */ + int hiarrayrows; /* number of array rows in use */ + int hiarraycols; /* number of array columns (2^N) */ + + /* If we need up to NINLINECDS, we store them here to save a malloc */ +#define NINLINECDS ((size_t) 10) + struct colordesc cdspace[NINLINECDS]; +}; + +/* fetch color for chr; beware of multiple evaluation of c argument */ +#define GETCOLOR(cm, c) \ + ((c) <= MAX_SIMPLE_CHR ? (cm)->locolormap[(c) - CHR_MIN] : pg_reg_getcolor(cm, c)) + + +/* + * Interface definitions for locale-interface functions in regc_locale.c. + */ + +/* + * Representation of a set of characters. chrs[] represents individual + * code points, ranges[] represents ranges in the form min..max inclusive. + * + * If the cvec represents a locale-specific character class, eg [[:alpha:]], + * then the chrs[] and ranges[] arrays contain only members of that class + * up to MAX_SIMPLE_CHR (inclusive). cclasscode is set to regc_locale.c's + * code for the class, rather than being -1 as it is in an ordinary cvec. + * + * Note that in cvecs gotten from newcvec() and intended to be freed by + * freecvec(), both arrays of chrs are after the end of the struct, not + * separately malloc'd; so chrspace and rangespace are effectively immutable. + */ +struct cvec +{ + int nchrs; /* number of chrs */ + int chrspace; /* number of chrs allocated in chrs[] */ + chr *chrs; /* pointer to vector of chrs */ + int nranges; /* number of ranges (chr pairs) */ + int rangespace; /* number of ranges allocated in ranges[] */ + chr *ranges; /* pointer to vector of chr pairs */ + int cclasscode; /* value of "enum classes", or -1 */ +}; + + +/* + * definitions for NFA internal representation + */ +struct state; + +struct arc +{ + int type; /* 0 if free, else an NFA arc type code */ + color co; /* color the arc matches (possibly RAINBOW) */ + struct state *from; /* where it's from */ + struct state *to; /* where it's to */ + struct arc *outchain; /* link in *from's outs chain or free chain */ + struct arc *outchainRev; /* back-link in *from's outs chain */ +#define freechain outchain /* we do not maintain "freechainRev" */ + struct arc *inchain; /* link in *to's ins chain */ + struct arc *inchainRev; /* back-link in *to's ins chain */ + /* these fields are not used when co == RAINBOW: */ + struct arc *colorchain; /* link in color's arc chain */ + struct arc *colorchainRev; /* back-link in color's arc chain */ +}; + +struct arcbatch +{ /* for bulk allocation of arcs */ + struct arcbatch *next; /* chain link */ + size_t narcs; /* number of arcs allocated in this arcbatch */ + struct arc a[FLEXIBLE_ARRAY_MEMBER]; +}; +#define ARCBATCHSIZE(n) ((n) * sizeof(struct arc) + offsetof(struct arcbatch, a)) +/* first batch will have FIRSTABSIZE arcs; then double it until MAXABSIZE */ +#define FIRSTABSIZE 64 +#define MAXABSIZE 1024 + +struct state +{ + int no; /* state number, zero and up; or FREESTATE */ +#define FREESTATE (-1) + char flag; /* marks special states */ + int nins; /* number of inarcs */ + int nouts; /* number of outarcs */ + struct arc *ins; /* chain of inarcs */ + struct arc *outs; /* chain of outarcs */ + struct state *tmp; /* temporary for traversal algorithms */ + struct state *next; /* chain for traversing all live states */ + /* the "next" field is also used to chain free states together */ + struct state *prev; /* back-link in chain of all live states */ +}; + +struct statebatch +{ /* for bulk allocation of states */ + struct statebatch *next; /* chain link */ + size_t nstates; /* number of states allocated in this batch */ + struct state s[FLEXIBLE_ARRAY_MEMBER]; +}; +#define STATEBATCHSIZE(n) ((n) * sizeof(struct state) + offsetof(struct statebatch, s)) +/* first batch will have FIRSTSBSIZE states; then double it until MAXSBSIZE */ +#define FIRSTSBSIZE 32 +#define MAXSBSIZE 1024 + +struct nfa +{ + struct state *pre; /* pre-initial state */ + struct state *init; /* initial state */ + struct state *final; /* final state */ + struct state *post; /* post-final state */ + int nstates; /* for numbering states */ + struct state *states; /* chain of live states */ + struct state *slast; /* tail of the chain */ + struct state *freestates; /* chain of free states */ + struct arc *freearcs; /* chain of free arcs */ + struct statebatch *lastsb; /* chain of statebatches */ + struct arcbatch *lastab; /* chain of arcbatches */ + size_t lastsbused; /* number of states consumed from *lastsb */ + size_t lastabused; /* number of arcs consumed from *lastab */ + struct colormap *cm; /* the color map */ + color bos[2]; /* colors, if any, assigned to BOS and BOL */ + color eos[2]; /* colors, if any, assigned to EOS and EOL */ + int flags; /* flags to pass forward to cNFA */ + int minmatchall; /* min number of chrs to match, if matchall */ + int maxmatchall; /* max number of chrs to match, or DUPINF */ + struct vars *v; /* simplifies compile error reporting */ + struct nfa *parent; /* parent NFA, if any */ +}; + + + +/* + * definitions for compacted NFA + * + * The main space savings in a compacted NFA is from making the arcs as small + * as possible. We store only the transition color and next-state number for + * each arc. The list of out arcs for each state is an array beginning at + * cnfa.states[statenumber], and terminated by a dummy carc struct with + * co == COLORLESS. + * + * The non-dummy carc structs are of two types: plain arcs and LACON arcs. + * Plain arcs just store the transition color number as "co". LACON arcs + * store the lookaround constraint number plus cnfa.ncolors as "co". LACON + * arcs can be distinguished from plain by testing for co >= cnfa.ncolors. + * + * Note that in a plain arc, "co" can be RAINBOW; since that's negative, + * it doesn't break the rule about how to recognize LACON arcs. + * + * We have special markings for "trivial" NFAs that can match any string + * (possibly with limits on the number of characters therein). In such a + * case, flags & MATCHALL is set (and HASLACONS can't be set). Then the + * fields minmatchall and maxmatchall give the minimum and maximum numbers + * of characters to match. For example, ".*" produces minmatchall = 0 + * and maxmatchall = DUPINF, while ".+" produces minmatchall = 1 and + * maxmatchall = DUPINF. + */ +struct carc +{ + color co; /* COLORLESS is list terminator */ + int to; /* next-state number */ +}; + +struct cnfa +{ + int nstates; /* number of states */ + int ncolors; /* number of colors (max color in use + 1) */ + int flags; /* bitmask of the following flags: */ +#define HASLACONS 01 /* uses lookaround constraints */ +#define MATCHALL 02 /* matches all strings of a range of lengths */ +#define HASCANTMATCH 04 /* contains CANTMATCH arcs */ + /* Note: HASCANTMATCH appears in nfa structs' flags, but never in cnfas */ + int pre; /* setup state number */ + int post; /* teardown state number */ + color bos[2]; /* colors, if any, assigned to BOS and BOL */ + color eos[2]; /* colors, if any, assigned to EOS and EOL */ + char *stflags; /* vector of per-state flags bytes */ +#define CNFA_NOPROGRESS 01 /* flag bit for a no-progress state */ + struct carc **states; /* vector of pointers to outarc lists */ + /* states[n] are pointers into a single malloc'd array of arcs */ + struct carc *arcs; /* the area for the lists */ + /* these fields are used only in a MATCHALL NFA (else they're -1): */ + int minmatchall; /* min number of chrs to match */ + int maxmatchall; /* max number of chrs to match, or DUPINF */ +}; + +/* + * When debugging, it's helpful if an un-filled CNFA is all-zeroes. + * In production, though, we only require nstates to be zero. + */ +#ifdef REG_DEBUG +#define ZAPCNFA(cnfa) memset(&(cnfa), 0, sizeof(cnfa)) +#else +#define ZAPCNFA(cnfa) ((cnfa).nstates = 0) +#endif +#define NULLCNFA(cnfa) ((cnfa).nstates == 0) + +/* + * This symbol limits the transient heap space used by the regex compiler, + * and thereby also the maximum complexity of NFAs that we'll deal with. + * Currently we only count NFA states and arcs against this; the other + * transient data is generally not large enough to notice compared to those. + * Note that we do not charge anything for the final output data structures + * (the compacted NFA and the colormap). + * The scaling here is based on an empirical measurement that very large + * NFAs tend to have about 4 arcs/state. + */ +#ifndef REG_MAX_COMPILE_SPACE +#define REG_MAX_COMPILE_SPACE \ + (500000 * (sizeof(struct state) + 4 * sizeof(struct arc))) +#endif + +/* + * subexpression tree + * + * "op" is one of: + * '=' plain regex without interesting substructure (implemented as DFA) + * 'b' back-reference (has no substructure either) + * '(' no-op capture node: captures the match of its single child + * '.' concatenation: matches a match for first child, then second child + * '|' alternation: matches a match for any of its children + * '*' iteration: matches some number of matches of its single child + * + * An alternation node can have any number of children (but at least two), + * linked through their sibling fields. + * + * A concatenation node must have exactly two children. It might be useful + * to support more, but that would complicate the executor. Note that it is + * the first child's greediness that determines the node's preference for + * where to split a match. + * + * Note: when a backref is directly quantified, we stick the min/max counts + * into the backref rather than plastering an iteration node on top. This is + * for efficiency: there is no need to search for possible division points. + */ +struct subre +{ + char op; /* see type codes above */ + char flags; +#define LONGER 01 /* prefers longer match */ +#define SHORTER 02 /* prefers shorter match */ +#define MIXED 04 /* mixed preference below */ +#define CAP 010 /* capturing parens here or below */ +#define BACKR 020 /* back reference here or below */ +#define BRUSE 040 /* is referenced by a back reference */ +#define INUSE 0100 /* in use in final tree */ +#define UPPROP (MIXED|CAP|BACKR) /* flags which should propagate up */ +#define LMIX(f) ((f)<<2) /* LONGER -> MIXED */ +#define SMIX(f) ((f)<<1) /* SHORTER -> MIXED */ +#define UP(f) (((f)&UPPROP) | (LMIX(f) & SMIX(f) & MIXED)) +#define MESSY(f) ((f)&(MIXED|CAP|BACKR)) +#define PREF(f) ((f)&(LONGER|SHORTER)) +#define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2)) +#define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2)) + char latype; /* LATYPE code, if lookaround constraint */ + int id; /* ID of subre (1..ntree-1) */ + int capno; /* if capture node, subno to capture into */ + int backno; /* if backref node, subno it refers to */ + short min; /* min repetitions for iteration or backref */ + short max; /* max repetitions for iteration or backref */ + struct subre *child; /* first child, if any (also freelist chain) */ + struct subre *sibling; /* next child of same parent, if any */ + struct state *begin; /* outarcs from here... */ + struct state *end; /* ...ending in inarcs here */ + struct cnfa cnfa; /* compacted NFA, if any */ + struct subre *chain; /* for bookkeeping and error cleanup */ +}; + + + +/* + * table of function pointers for generic manipulation functions + * A regex_t's re_fns points to one of these. + */ +struct fns +{ + void FUNCPTR(free, (regex_t *)); + int FUNCPTR(stack_too_deep, (void)); +}; + +#define STACK_TOO_DEEP(re) \ + ((*((struct fns *) (re)->re_fns)->stack_too_deep) ()) + + +/* + * the insides of a regex_t, hidden behind a void * + */ +struct guts +{ + int magic; +#define GUTSMAGIC 0xfed9 + int cflags; /* copy of compile flags */ + long info; /* copy of re_info */ + size_t nsub; /* copy of re_nsub */ + struct subre *tree; + struct cnfa search; /* for fast preliminary search */ + int ntree; /* number of subre's, plus one */ + struct colormap cmap; + int FUNCPTR(compare, (const chr *, const chr *, size_t)); + struct subre *lacons; /* lookaround-constraint vector */ + int nlacons; /* size of lacons[]; note that only slots + * numbered 1 .. nlacons-1 are used */ +}; + + +/* prototypes for functions that are exported from regcomp.c to regexec.c */ +extern void pg_set_regex_collation(Oid collation); +extern color pg_reg_getcolor(struct colormap *cm, chr c); diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/conflict.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/conflict.h new file mode 100644 index 0000000..4d4e817 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/conflict.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------------------- + * conflict.h + * Exports for conflicts logging. + * + * Copyright (c) 2024-2025, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ +#ifndef CONFLICT_H +#define CONFLICT_H + +#include "access/xlogdefs.h" +#include "nodes/pg_list.h" +#include "utils/timestamp.h" + +/* Avoid including execnodes.h here */ +struct EState; +struct ResultRelInfo; +struct TupleTableSlot; + + +/* + * Conflict types that could occur while applying remote changes. + * + * This enum is used in statistics collection (see + * PgStat_StatSubEntry::conflict_count and + * PgStat_BackendSubEntry::conflict_count) as well, therefore, when adding new + * values or reordering existing ones, ensure to review and potentially adjust + * the corresponding statistics collection codes. + */ +typedef enum +{ + /* The row to be inserted violates unique constraint */ + CT_INSERT_EXISTS, + + /* The row to be updated was modified by a different origin */ + CT_UPDATE_ORIGIN_DIFFERS, + + /* The updated row value violates unique constraint */ + CT_UPDATE_EXISTS, + + /* The row to be updated is missing */ + CT_UPDATE_MISSING, + + /* The row to be deleted was modified by a different origin */ + CT_DELETE_ORIGIN_DIFFERS, + + /* The row to be deleted is missing */ + CT_DELETE_MISSING, + + /* The row to be inserted/updated violates multiple unique constraint */ + CT_MULTIPLE_UNIQUE_CONFLICTS, + + /* + * Other conflicts, such as exclusion constraint violations, involve more + * complex rules than simple equality checks. These conflicts are left for + * future improvements. + */ +} ConflictType; + +#define CONFLICT_NUM_TYPES (CT_MULTIPLE_UNIQUE_CONFLICTS + 1) + +/* + * Information for the existing local row that caused the conflict. + */ +typedef struct ConflictTupleInfo +{ + struct TupleTableSlot *slot; /* tuple slot holding the conflicting + * local tuple */ + Oid indexoid; /* OID of the index where the conflict + * occurred */ + TransactionId xmin; /* transaction ID of the modification causing + * the conflict */ + RepOriginId origin; /* origin identifier of the modification */ + TimestampTz ts; /* timestamp of when the modification on the + * conflicting local row occurred */ +} ConflictTupleInfo; + +extern bool GetTupleTransactionInfo(struct TupleTableSlot *localslot, + TransactionId *xmin, + RepOriginId *localorigin, + TimestampTz *localts); +extern void ReportApplyConflict(struct EState *estate, struct ResultRelInfo *relinfo, + int elevel, ConflictType type, + struct TupleTableSlot *searchslot, + struct TupleTableSlot *remoteslot, + List *conflicttuples); +extern void InitConflictIndexes(struct ResultRelInfo *relInfo); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/decode.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/decode.h new file mode 100644 index 0000000..d6c3fc7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/decode.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * decode.h + * PostgreSQL WAL to logical transformation + * + * Portions Copyright (c) 2012-2025, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ +#ifndef DECODE_H +#define DECODE_H + +#include "access/xlogreader.h" +#include "access/xlogrecord.h" +#include "replication/logical.h" +#include "replication/reorderbuffer.h" + +typedef struct XLogRecordBuffer +{ + XLogRecPtr origptr; + XLogRecPtr endptr; + XLogReaderState *record; +} XLogRecordBuffer; + +extern void xlog_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void heap_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void heap2_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void xact_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void standby_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void logicalmsg_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); + +extern void LogicalDecodingProcessRecord(LogicalDecodingContext *ctx, + XLogReaderState *record); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logical.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logical.h new file mode 100644 index 0000000..2e562be --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logical.h @@ -0,0 +1,155 @@ +/*------------------------------------------------------------------------- + * logical.h + * PostgreSQL logical decoding coordination + * + * Copyright (c) 2012-2025, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICAL_H +#define LOGICAL_H + +#include "access/xlog.h" +#include "access/xlogreader.h" +#include "replication/output_plugin.h" +#include "replication/slot.h" + +struct LogicalDecodingContext; + +typedef void (*LogicalOutputPluginWriterWrite) (struct LogicalDecodingContext *lr, + XLogRecPtr Ptr, + TransactionId xid, + bool last_write +); + +typedef LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite; + +typedef void (*LogicalOutputPluginWriterUpdateProgress) (struct LogicalDecodingContext *lr, + XLogRecPtr Ptr, + TransactionId xid, + bool skipped_xact +); + +typedef struct LogicalDecodingContext +{ + /* memory context this is all allocated in */ + MemoryContext context; + + /* The associated replication slot */ + ReplicationSlot *slot; + + /* infrastructure pieces for decoding */ + XLogReaderState *reader; + struct ReorderBuffer *reorder; + struct SnapBuild *snapshot_builder; + + /* + * Marks the logical decoding context as fast forward decoding one. Such a + * context does not have plugin loaded so most of the following properties + * are unused. + */ + bool fast_forward; + + OutputPluginCallbacks callbacks; + OutputPluginOptions options; + + /* + * User specified options + */ + List *output_plugin_options; + + /* + * User-Provided callback for writing/streaming out data. + */ + LogicalOutputPluginWriterPrepareWrite prepare_write; + LogicalOutputPluginWriterWrite write; + LogicalOutputPluginWriterUpdateProgress update_progress; + + /* + * Output buffer. + */ + StringInfo out; + + /* + * Private data pointer of the output plugin. + */ + void *output_plugin_private; + + /* + * Private data pointer for the data writer. + */ + void *output_writer_private; + + /* + * Does the output plugin support streaming, and is it enabled? + */ + bool streaming; + + /* + * Does the output plugin support two-phase decoding, and is it enabled? + */ + bool twophase; + + /* + * Is two-phase option given by output plugin? + * + * This flag indicates that the plugin passed in the two-phase option as + * part of the START_STREAMING command. We can't rely solely on the + * twophase flag which only tells whether the plugin provided all the + * necessary two-phase callbacks. + */ + bool twophase_opt_given; + + /* + * State for writing output. + */ + bool accept_writes; + bool prepared_write; + XLogRecPtr write_location; + TransactionId write_xid; + /* Are we processing the end LSN of a transaction? */ + bool end_xact; + + /* Do we need to process any change in fast_forward mode? */ + bool processing_required; +} LogicalDecodingContext; + + +extern void CheckLogicalDecodingRequirements(void); + +extern LogicalDecodingContext *CreateInitDecodingContext(const char *plugin, + List *output_plugin_options, + bool need_full_snapshot, + XLogRecPtr restart_lsn, + XLogReaderRoutine *xl_routine, + LogicalOutputPluginWriterPrepareWrite prepare_write, + LogicalOutputPluginWriterWrite do_write, + LogicalOutputPluginWriterUpdateProgress update_progress); +extern LogicalDecodingContext *CreateDecodingContext(XLogRecPtr start_lsn, + List *output_plugin_options, + bool fast_forward, + XLogReaderRoutine *xl_routine, + LogicalOutputPluginWriterPrepareWrite prepare_write, + LogicalOutputPluginWriterWrite do_write, + LogicalOutputPluginWriterUpdateProgress update_progress); +extern void DecodingContextFindStartpoint(LogicalDecodingContext *ctx); +extern bool DecodingContextReady(LogicalDecodingContext *ctx); +extern void FreeDecodingContext(LogicalDecodingContext *ctx); + +extern void LogicalIncreaseXminForSlot(XLogRecPtr current_lsn, + TransactionId xmin); +extern void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, + XLogRecPtr restart_lsn); +extern void LogicalConfirmReceivedLocation(XLogRecPtr lsn); + +extern bool filter_prepare_cb_wrapper(LogicalDecodingContext *ctx, + TransactionId xid, const char *gid); +extern bool filter_by_origin_cb_wrapper(LogicalDecodingContext *ctx, RepOriginId origin_id); +extern void ResetLogicalStreamingState(void); +extern void UpdateDecodingStats(LogicalDecodingContext *ctx); + +extern bool LogicalReplicationSlotHasPendingWal(XLogRecPtr end_of_wal); +extern XLogRecPtr LogicalSlotAdvanceAndCheckSnapState(XLogRecPtr moveto, + bool *found_consistent_snapshot); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicallauncher.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicallauncher.h new file mode 100644 index 0000000..82b202f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicallauncher.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * logicallauncher.h + * Exports for logical replication launcher. + * + * Portions Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/replication/logicallauncher.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICALLAUNCHER_H +#define LOGICALLAUNCHER_H + +extern PGDLLIMPORT int max_logical_replication_workers; +extern PGDLLIMPORT int max_sync_workers_per_subscription; +extern PGDLLIMPORT int max_parallel_apply_workers_per_subscription; + +extern void ApplyLauncherRegister(void); +extern void ApplyLauncherMain(Datum main_arg); + +extern Size ApplyLauncherShmemSize(void); +extern void ApplyLauncherShmemInit(void); + +extern void ApplyLauncherForgetWorkerStartTime(Oid subid); + +extern void ApplyLauncherWakeupAtCommit(void); +extern void AtEOXact_ApplyLauncher(bool isCommit); + +extern bool IsLogicalLauncher(void); + +extern pid_t GetLeaderApplyWorkerPid(pid_t pid); + +#endif /* LOGICALLAUNCHER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicalproto.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicalproto.h new file mode 100644 index 0000000..b261c60 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicalproto.h @@ -0,0 +1,280 @@ +/*------------------------------------------------------------------------- + * + * logicalproto.h + * logical replication protocol + * + * Copyright (c) 2015-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/replication/logicalproto.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICAL_PROTO_H +#define LOGICAL_PROTO_H + +#include "access/xact.h" +#include "executor/tuptable.h" +#include "replication/reorderbuffer.h" +#include "utils/rel.h" + +/* + * Protocol capabilities + * + * LOGICALREP_PROTO_VERSION_NUM is our native protocol. + * LOGICALREP_PROTO_MAX_VERSION_NUM is the greatest version we can support. + * LOGICALREP_PROTO_MIN_VERSION_NUM is the oldest version we + * have backwards compatibility for. The client requests protocol version at + * connect time. + * + * LOGICALREP_PROTO_STREAM_VERSION_NUM is the minimum protocol version with + * support for streaming large transactions. Introduced in PG14. + * + * LOGICALREP_PROTO_TWOPHASE_VERSION_NUM is the minimum protocol version with + * support for two-phase commit decoding (at prepare time). Introduced in PG15. + * + * LOGICALREP_PROTO_STREAM_PARALLEL_VERSION_NUM is the minimum protocol version + * where we support applying large streaming transactions in parallel. + * Introduced in PG16. + */ +#define LOGICALREP_PROTO_MIN_VERSION_NUM 1 +#define LOGICALREP_PROTO_VERSION_NUM 1 +#define LOGICALREP_PROTO_STREAM_VERSION_NUM 2 +#define LOGICALREP_PROTO_TWOPHASE_VERSION_NUM 3 +#define LOGICALREP_PROTO_STREAM_PARALLEL_VERSION_NUM 4 +#define LOGICALREP_PROTO_MAX_VERSION_NUM LOGICALREP_PROTO_STREAM_PARALLEL_VERSION_NUM + +/* + * Logical message types + * + * Used by logical replication wire protocol. + * + * Note: though this is an enum, the values are used to identify message types + * in logical replication protocol, which uses a single byte to identify a + * message type. Hence the values should be single-byte wide and preferably + * human-readable characters. + */ +typedef enum LogicalRepMsgType +{ + LOGICAL_REP_MSG_BEGIN = 'B', + LOGICAL_REP_MSG_COMMIT = 'C', + LOGICAL_REP_MSG_ORIGIN = 'O', + LOGICAL_REP_MSG_INSERT = 'I', + LOGICAL_REP_MSG_UPDATE = 'U', + LOGICAL_REP_MSG_DELETE = 'D', + LOGICAL_REP_MSG_TRUNCATE = 'T', + LOGICAL_REP_MSG_RELATION = 'R', + LOGICAL_REP_MSG_TYPE = 'Y', + LOGICAL_REP_MSG_MESSAGE = 'M', + LOGICAL_REP_MSG_BEGIN_PREPARE = 'b', + LOGICAL_REP_MSG_PREPARE = 'P', + LOGICAL_REP_MSG_COMMIT_PREPARED = 'K', + LOGICAL_REP_MSG_ROLLBACK_PREPARED = 'r', + LOGICAL_REP_MSG_STREAM_START = 'S', + LOGICAL_REP_MSG_STREAM_STOP = 'E', + LOGICAL_REP_MSG_STREAM_COMMIT = 'c', + LOGICAL_REP_MSG_STREAM_ABORT = 'A', + LOGICAL_REP_MSG_STREAM_PREPARE = 'p', +} LogicalRepMsgType; + +/* + * This struct stores a tuple received via logical replication. + * Keep in mind that the columns correspond to the *remote* table. + */ +typedef struct LogicalRepTupleData +{ + /* Array of StringInfos, one per column; some may be unused */ + StringInfoData *colvalues; + /* Array of markers for null/unchanged/text/binary, one per column */ + char *colstatus; + /* Length of above arrays */ + int ncols; +} LogicalRepTupleData; + +/* Possible values for LogicalRepTupleData.colstatus[colnum] */ +/* These values are also used in the on-the-wire protocol */ +#define LOGICALREP_COLUMN_NULL 'n' +#define LOGICALREP_COLUMN_UNCHANGED 'u' +#define LOGICALREP_COLUMN_TEXT 't' +#define LOGICALREP_COLUMN_BINARY 'b' /* added in PG14 */ + +typedef uint32 LogicalRepRelId; + +/* Relation information */ +typedef struct LogicalRepRelation +{ + /* Info coming from the remote side. */ + LogicalRepRelId remoteid; /* unique id of the relation */ + char *nspname; /* schema name */ + char *relname; /* relation name */ + int natts; /* number of columns */ + char **attnames; /* column names */ + Oid *atttyps; /* column types */ + char replident; /* replica identity */ + char relkind; /* remote relation kind */ + Bitmapset *attkeys; /* Bitmap of key columns */ +} LogicalRepRelation; + +/* Type mapping info */ +typedef struct LogicalRepTyp +{ + Oid remoteid; /* unique id of the remote type */ + char *nspname; /* schema name of remote type */ + char *typname; /* name of the remote type */ +} LogicalRepTyp; + +/* Transaction info */ +typedef struct LogicalRepBeginData +{ + XLogRecPtr final_lsn; + TimestampTz committime; + TransactionId xid; +} LogicalRepBeginData; + +typedef struct LogicalRepCommitData +{ + XLogRecPtr commit_lsn; + XLogRecPtr end_lsn; + TimestampTz committime; +} LogicalRepCommitData; + +/* + * Prepared transaction protocol information for begin_prepare, and prepare. + */ +typedef struct LogicalRepPreparedTxnData +{ + XLogRecPtr prepare_lsn; + XLogRecPtr end_lsn; + TimestampTz prepare_time; + TransactionId xid; + char gid[GIDSIZE]; +} LogicalRepPreparedTxnData; + +/* + * Prepared transaction protocol information for commit prepared. + */ +typedef struct LogicalRepCommitPreparedTxnData +{ + XLogRecPtr commit_lsn; + XLogRecPtr end_lsn; + TimestampTz commit_time; + TransactionId xid; + char gid[GIDSIZE]; +} LogicalRepCommitPreparedTxnData; + +/* + * Rollback Prepared transaction protocol information. The prepare information + * prepare_end_lsn and prepare_time are used to check if the downstream has + * received this prepared transaction in which case it can apply the rollback, + * otherwise, it can skip the rollback operation. The gid alone is not + * sufficient because the downstream node can have a prepared transaction with + * same identifier. + */ +typedef struct LogicalRepRollbackPreparedTxnData +{ + XLogRecPtr prepare_end_lsn; + XLogRecPtr rollback_end_lsn; + TimestampTz prepare_time; + TimestampTz rollback_time; + TransactionId xid; + char gid[GIDSIZE]; +} LogicalRepRollbackPreparedTxnData; + +/* + * Transaction protocol information for stream abort. + */ +typedef struct LogicalRepStreamAbortData +{ + TransactionId xid; + TransactionId subxid; + XLogRecPtr abort_lsn; + TimestampTz abort_time; +} LogicalRepStreamAbortData; + +extern void logicalrep_write_begin(StringInfo out, ReorderBufferTXN *txn); +extern void logicalrep_read_begin(StringInfo in, + LogicalRepBeginData *begin_data); +extern void logicalrep_write_commit(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); +extern void logicalrep_read_commit(StringInfo in, + LogicalRepCommitData *commit_data); +extern void logicalrep_write_begin_prepare(StringInfo out, ReorderBufferTXN *txn); +extern void logicalrep_read_begin_prepare(StringInfo in, + LogicalRepPreparedTxnData *begin_data); +extern void logicalrep_write_prepare(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); +extern void logicalrep_read_prepare(StringInfo in, + LogicalRepPreparedTxnData *prepare_data); +extern void logicalrep_write_commit_prepared(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); +extern void logicalrep_read_commit_prepared(StringInfo in, + LogicalRepCommitPreparedTxnData *prepare_data); +extern void logicalrep_write_rollback_prepared(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr prepare_end_lsn, + TimestampTz prepare_time); +extern void logicalrep_read_rollback_prepared(StringInfo in, + LogicalRepRollbackPreparedTxnData *rollback_data); +extern void logicalrep_write_stream_prepare(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); +extern void logicalrep_read_stream_prepare(StringInfo in, + LogicalRepPreparedTxnData *prepare_data); + +extern void logicalrep_write_origin(StringInfo out, const char *origin, + XLogRecPtr origin_lsn); +extern char *logicalrep_read_origin(StringInfo in, XLogRecPtr *origin_lsn); +extern void logicalrep_write_insert(StringInfo out, TransactionId xid, + Relation rel, TupleTableSlot *newslot, + bool binary, Bitmapset *columns, + PublishGencolsType include_gencols_type); +extern LogicalRepRelId logicalrep_read_insert(StringInfo in, LogicalRepTupleData *newtup); +extern void logicalrep_write_update(StringInfo out, TransactionId xid, + Relation rel, TupleTableSlot *oldslot, + TupleTableSlot *newslot, bool binary, + Bitmapset *columns, + PublishGencolsType include_gencols_type); +extern LogicalRepRelId logicalrep_read_update(StringInfo in, + bool *has_oldtuple, LogicalRepTupleData *oldtup, + LogicalRepTupleData *newtup); +extern void logicalrep_write_delete(StringInfo out, TransactionId xid, + Relation rel, TupleTableSlot *oldslot, + bool binary, Bitmapset *columns, + PublishGencolsType include_gencols_type); +extern LogicalRepRelId logicalrep_read_delete(StringInfo in, + LogicalRepTupleData *oldtup); +extern void logicalrep_write_truncate(StringInfo out, TransactionId xid, + int nrelids, Oid relids[], + bool cascade, bool restart_seqs); +extern List *logicalrep_read_truncate(StringInfo in, + bool *cascade, bool *restart_seqs); +extern void logicalrep_write_message(StringInfo out, TransactionId xid, XLogRecPtr lsn, + bool transactional, const char *prefix, Size sz, const char *message); +extern void logicalrep_write_rel(StringInfo out, TransactionId xid, + Relation rel, Bitmapset *columns, + PublishGencolsType include_gencols_type); +extern LogicalRepRelation *logicalrep_read_rel(StringInfo in); +extern void logicalrep_write_typ(StringInfo out, TransactionId xid, + Oid typoid); +extern void logicalrep_read_typ(StringInfo in, LogicalRepTyp *ltyp); +extern void logicalrep_write_stream_start(StringInfo out, TransactionId xid, + bool first_segment); +extern TransactionId logicalrep_read_stream_start(StringInfo in, + bool *first_segment); +extern void logicalrep_write_stream_stop(StringInfo out); +extern void logicalrep_write_stream_commit(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); +extern TransactionId logicalrep_read_stream_commit(StringInfo in, + LogicalRepCommitData *commit_data); +extern void logicalrep_write_stream_abort(StringInfo out, TransactionId xid, + TransactionId subxid, + XLogRecPtr abort_lsn, + TimestampTz abort_time, + bool write_abort_info); +extern void logicalrep_read_stream_abort(StringInfo in, + LogicalRepStreamAbortData *abort_data, + bool read_abort_info); +extern const char *logicalrep_message_type(LogicalRepMsgType action); +extern bool logicalrep_should_publish_column(Form_pg_attribute att, + Bitmapset *columns, + PublishGencolsType include_gencols_type); + +#endif /* LOGICAL_PROTO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicalrelation.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicalrelation.h new file mode 100644 index 0000000..7a561a8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicalrelation.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * logicalrelation.h + * Relation definitions for logical replication relation mapping. + * + * Portions Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/replication/logicalrelation.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICALRELATION_H +#define LOGICALRELATION_H + +#include "access/attmap.h" +#include "catalog/index.h" +#include "replication/logicalproto.h" + +typedef struct LogicalRepRelMapEntry +{ + LogicalRepRelation remoterel; /* key is remoterel.remoteid */ + + /* + * Validity flag -- when false, revalidate all derived info at next + * logicalrep_rel_open. (While the localrel is open, we assume our lock + * on that rel ensures the info remains good.) + */ + bool localrelvalid; + + /* Mapping to local relation. */ + Oid localreloid; /* local relation id */ + Relation localrel; /* relcache entry (NULL when closed) */ + AttrMap *attrmap; /* map of local attributes to remote ones */ + bool updatable; /* Can apply updates/deletes? */ + Oid localindexoid; /* which index to use, or InvalidOid if none */ + + /* Sync state. */ + char state; + XLogRecPtr statelsn; +} LogicalRepRelMapEntry; + +extern void logicalrep_relmap_update(LogicalRepRelation *remoterel); +extern void logicalrep_partmap_reset_relmap(LogicalRepRelation *remoterel); + +extern LogicalRepRelMapEntry *logicalrep_rel_open(LogicalRepRelId remoteid, + LOCKMODE lockmode); +extern LogicalRepRelMapEntry *logicalrep_partition_open(LogicalRepRelMapEntry *root, + Relation partrel, AttrMap *map); +extern void logicalrep_rel_close(LogicalRepRelMapEntry *rel, + LOCKMODE lockmode); +extern bool IsIndexUsableForReplicaIdentityFull(Relation idxrel, AttrMap *attrmap); +extern Oid GetRelationIdentityOrPK(Relation rel); + +#endif /* LOGICALRELATION_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicalworker.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicalworker.h new file mode 100644 index 0000000..8891260 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/logicalworker.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * logicalworker.h + * Exports for logical replication workers. + * + * Portions Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/replication/logicalworker.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICALWORKER_H +#define LOGICALWORKER_H + +#include + +extern PGDLLIMPORT volatile sig_atomic_t ParallelApplyMessagePending; + +extern void ApplyWorkerMain(Datum main_arg); +extern void ParallelApplyWorkerMain(Datum main_arg); +extern void TablesyncWorkerMain(Datum main_arg); + +extern bool IsLogicalWorker(void); +extern bool IsLogicalParallelApplyWorker(void); + +extern void HandleParallelApplyMessageInterrupt(void); +extern void ProcessParallelApplyMessages(void); + +extern void LogicalRepWorkersWakeupAtCommit(Oid subid); + +extern void AtEOXact_LogicalRepWorkers(bool isCommit); + +#endif /* LOGICALWORKER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/message.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/message.h new file mode 100644 index 0000000..8a0893e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/message.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * message.h + * Exports from replication/logical/message.c + * + * Copyright (c) 2013-2025, PostgreSQL Global Development Group + * + * src/include/replication/message.h + *------------------------------------------------------------------------- + */ +#ifndef PG_LOGICAL_MESSAGE_H +#define PG_LOGICAL_MESSAGE_H + +#include "access/xlog.h" +#include "access/xlogdefs.h" +#include "access/xlogreader.h" + +/* + * Generic logical decoding message wal record. + */ +typedef struct xl_logical_message +{ + Oid dbId; /* database Oid emitted from */ + bool transactional; /* is message transactional? */ + Size prefix_size; /* length of prefix */ + Size message_size; /* size of the message */ + /* payload, including null-terminated prefix of length prefix_size */ + char message[FLEXIBLE_ARRAY_MEMBER]; +} xl_logical_message; + +#define SizeOfLogicalMessage (offsetof(xl_logical_message, message)) + +extern XLogRecPtr LogLogicalMessage(const char *prefix, const char *message, + size_t size, bool transactional, + bool flush); + +/* RMGR API */ +#define XLOG_LOGICAL_MESSAGE 0x00 +extern void logicalmsg_redo(XLogReaderState *record); +extern void logicalmsg_desc(StringInfo buf, XLogReaderState *record); +extern const char *logicalmsg_identify(uint8 info); + +#endif /* PG_LOGICAL_MESSAGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/origin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/origin.h new file mode 100644 index 0000000..2a73f6a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/origin.h @@ -0,0 +1,83 @@ +/*------------------------------------------------------------------------- + * origin.h + * Exports from replication/logical/origin.c + * + * Copyright (c) 2013-2025, PostgreSQL Global Development Group + * + * src/include/replication/origin.h + *------------------------------------------------------------------------- + */ +#ifndef PG_ORIGIN_H +#define PG_ORIGIN_H + +#include "access/xlog.h" +#include "access/xlogdefs.h" +#include "access/xlogreader.h" +#include "catalog/pg_replication_origin.h" + +typedef struct xl_replorigin_set +{ + XLogRecPtr remote_lsn; + RepOriginId node_id; + bool force; +} xl_replorigin_set; + +typedef struct xl_replorigin_drop +{ + RepOriginId node_id; +} xl_replorigin_drop; + +#define XLOG_REPLORIGIN_SET 0x00 +#define XLOG_REPLORIGIN_DROP 0x10 + +#define InvalidRepOriginId 0 +#define DoNotReplicateId PG_UINT16_MAX + +/* + * To avoid needing a TOAST table for pg_replication_origin, we limit + * replication origin names to 512 bytes. This should be more than enough for + * all practical use. + */ +#define MAX_RONAME_LEN 512 + +extern PGDLLIMPORT RepOriginId replorigin_session_origin; +extern PGDLLIMPORT XLogRecPtr replorigin_session_origin_lsn; +extern PGDLLIMPORT TimestampTz replorigin_session_origin_timestamp; + +/* GUCs */ +extern PGDLLIMPORT int max_active_replication_origins; + +/* API for querying & manipulating replication origins */ +extern RepOriginId replorigin_by_name(const char *roname, bool missing_ok); +extern RepOriginId replorigin_create(const char *roname); +extern void replorigin_drop_by_name(const char *name, bool missing_ok, bool nowait); +extern bool replorigin_by_oid(RepOriginId roident, bool missing_ok, + char **roname); + +/* API for querying & manipulating replication progress tracking */ +extern void replorigin_advance(RepOriginId node, + XLogRecPtr remote_commit, + XLogRecPtr local_commit, + bool go_backward, bool wal_log); +extern XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush); + +extern void replorigin_session_advance(XLogRecPtr remote_commit, + XLogRecPtr local_commit); +extern void replorigin_session_setup(RepOriginId node, int acquired_by); +extern void replorigin_session_reset(void); +extern XLogRecPtr replorigin_session_get_progress(bool flush); + +/* Checkpoint/Startup integration */ +extern void CheckPointReplicationOrigin(void); +extern void StartupReplicationOrigin(void); + +/* WAL logging */ +extern void replorigin_redo(XLogReaderState *record); +extern void replorigin_desc(StringInfo buf, XLogReaderState *record); +extern const char *replorigin_identify(uint8 info); + +/* shared memory allocation */ +extern Size ReplicationOriginShmemSize(void); +extern void ReplicationOriginShmemInit(void); + +#endif /* PG_ORIGIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/output_plugin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/output_plugin.h new file mode 100644 index 0000000..8d4d5b7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/output_plugin.h @@ -0,0 +1,250 @@ +/*------------------------------------------------------------------------- + * output_plugin.h + * PostgreSQL Logical Decode Plugin Interface + * + * Copyright (c) 2012-2025, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ +#ifndef OUTPUT_PLUGIN_H +#define OUTPUT_PLUGIN_H + +#include "replication/reorderbuffer.h" + +struct LogicalDecodingContext; +struct OutputPluginCallbacks; + +typedef enum OutputPluginOutputType +{ + OUTPUT_PLUGIN_BINARY_OUTPUT, + OUTPUT_PLUGIN_TEXTUAL_OUTPUT, +} OutputPluginOutputType; + +/* + * Options set by the output plugin, in the startup callback. + */ +typedef struct OutputPluginOptions +{ + OutputPluginOutputType output_type; + bool receive_rewrites; +} OutputPluginOptions; + +/* + * Type of the shared library symbol _PG_output_plugin_init that is looked up + * when loading an output plugin shared library. + */ +typedef void (*LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb); + +extern PGDLLEXPORT void _PG_output_plugin_init(struct OutputPluginCallbacks *cb); + +/* + * Callback that gets called in a user-defined plugin. ctx->private_data can + * be set to some private data. + * + * "is_init" will be set to "true" if the decoding slot just got defined. When + * the same slot is used from there one, it will be "false". + */ +typedef void (*LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx, + OutputPluginOptions *options, + bool is_init); + +/* + * Callback called for every (explicit or implicit) BEGIN of a successful + * transaction. + */ +typedef void (*LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn); + +/* + * Callback for every individual change in a successful transaction. + */ +typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); + +/* + * Callback for every TRUNCATE in a successful transaction. + */ +typedef void (*LogicalDecodeTruncateCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + int nrelations, + Relation relations[], + ReorderBufferChange *change); + +/* + * Called for every (explicit or implicit) COMMIT of a successful transaction. + */ +typedef void (*LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* + * Called for the generic logical decoding messages. + */ +typedef void (*LogicalDecodeMessageCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, + Size message_size, + const char *message); + +/* + * Filter changes by origin. + */ +typedef bool (*LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx, + RepOriginId origin_id); + +/* + * Called to shutdown an output plugin. + */ +typedef void (*LogicalDecodeShutdownCB) (struct LogicalDecodingContext *ctx); + +/* + * Called before decoding of PREPARE record to decide whether this + * transaction should be decoded with separate calls to prepare and + * commit_prepared/rollback_prepared callbacks or wait till COMMIT PREPARED + * and sent as usual transaction. + */ +typedef bool (*LogicalDecodeFilterPrepareCB) (struct LogicalDecodingContext *ctx, + TransactionId xid, + const char *gid); + +/* + * Callback called for every BEGIN of a prepared transaction. + */ +typedef void (*LogicalDecodeBeginPrepareCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn); + +/* + * Called for PREPARE record unless it was filtered by filter_prepare() + * callback. + */ +typedef void (*LogicalDecodePrepareCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); + +/* + * Called for COMMIT PREPARED. + */ +typedef void (*LogicalDecodeCommitPreparedCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* + * Called for ROLLBACK PREPARED. + */ +typedef void (*LogicalDecodeRollbackPreparedCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr prepare_end_lsn, + TimestampTz prepare_time); + + +/* + * Called when starting to stream a block of changes from in-progress + * transaction (may be called repeatedly, if it's streamed in multiple + * chunks). + */ +typedef void (*LogicalDecodeStreamStartCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn); + +/* + * Called when stopping to stream a block of changes from in-progress + * transaction to a remote node (may be called repeatedly, if it's streamed + * in multiple chunks). + */ +typedef void (*LogicalDecodeStreamStopCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn); + +/* + * Called to discard changes streamed to remote node from in-progress + * transaction. + */ +typedef void (*LogicalDecodeStreamAbortCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr abort_lsn); + +/* + * Called to prepare changes streamed to remote node from in-progress + * transaction. This is called as part of a two-phase commit. + */ +typedef void (*LogicalDecodeStreamPrepareCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); + +/* + * Called to apply changes streamed to remote node from in-progress + * transaction. + */ +typedef void (*LogicalDecodeStreamCommitCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* + * Callback for streaming individual changes from in-progress transactions. + */ +typedef void (*LogicalDecodeStreamChangeCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); + +/* + * Callback for streaming generic logical decoding messages from in-progress + * transactions. + */ +typedef void (*LogicalDecodeStreamMessageCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, + Size message_size, + const char *message); + +/* + * Callback for streaming truncates from in-progress transactions. + */ +typedef void (*LogicalDecodeStreamTruncateCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + int nrelations, + Relation relations[], + ReorderBufferChange *change); + +/* + * Output plugin callbacks + */ +typedef struct OutputPluginCallbacks +{ + LogicalDecodeStartupCB startup_cb; + LogicalDecodeBeginCB begin_cb; + LogicalDecodeChangeCB change_cb; + LogicalDecodeTruncateCB truncate_cb; + LogicalDecodeCommitCB commit_cb; + LogicalDecodeMessageCB message_cb; + LogicalDecodeFilterByOriginCB filter_by_origin_cb; + LogicalDecodeShutdownCB shutdown_cb; + + /* streaming of changes at prepare time */ + LogicalDecodeFilterPrepareCB filter_prepare_cb; + LogicalDecodeBeginPrepareCB begin_prepare_cb; + LogicalDecodePrepareCB prepare_cb; + LogicalDecodeCommitPreparedCB commit_prepared_cb; + LogicalDecodeRollbackPreparedCB rollback_prepared_cb; + + /* streaming of changes */ + LogicalDecodeStreamStartCB stream_start_cb; + LogicalDecodeStreamStopCB stream_stop_cb; + LogicalDecodeStreamAbortCB stream_abort_cb; + LogicalDecodeStreamPrepareCB stream_prepare_cb; + LogicalDecodeStreamCommitCB stream_commit_cb; + LogicalDecodeStreamChangeCB stream_change_cb; + LogicalDecodeStreamMessageCB stream_message_cb; + LogicalDecodeStreamTruncateCB stream_truncate_cb; +} OutputPluginCallbacks; + +/* Functions in replication/logical/logical.c */ +extern void OutputPluginPrepareWrite(struct LogicalDecodingContext *ctx, bool last_write); +extern void OutputPluginWrite(struct LogicalDecodingContext *ctx, bool last_write); +extern void OutputPluginUpdateProgress(struct LogicalDecodingContext *ctx, bool skipped_xact); + +#endif /* OUTPUT_PLUGIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/pgoutput.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/pgoutput.h new file mode 100644 index 0000000..e53456c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/pgoutput.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * pgoutput.h + * Logical Replication output plugin + * + * Copyright (c) 2015-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/replication/pgoutput.h + * + *------------------------------------------------------------------------- + */ +#ifndef PGOUTPUT_H +#define PGOUTPUT_H + +#include "nodes/pg_list.h" + +typedef struct PGOutputData +{ + MemoryContext context; /* private memory context for transient + * allocations */ + MemoryContext cachectx; /* private memory context for cache data */ + MemoryContext pubctx; /* private memory context for publication data */ + + bool in_streaming; /* true if we are streaming a chunk of + * transaction */ + + /* client-supplied info: */ + uint32 protocol_version; + List *publication_names; + List *publications; + bool binary; + char streaming; + bool messages; + bool two_phase; + bool publish_no_origin; +} PGOutputData; + +#endif /* PGOUTPUT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/reorderbuffer.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/reorderbuffer.h new file mode 100644 index 0000000..fa07455 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/reorderbuffer.h @@ -0,0 +1,783 @@ +/* + * reorderbuffer.h + * PostgreSQL logical replay/reorder buffer management. + * + * Copyright (c) 2012-2025, PostgreSQL Global Development Group + * + * src/include/replication/reorderbuffer.h + */ +#ifndef REORDERBUFFER_H +#define REORDERBUFFER_H + +#include "access/htup_details.h" +#include "lib/ilist.h" +#include "lib/pairingheap.h" +#include "storage/sinval.h" +#include "utils/hsearch.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" +#include "utils/timestamp.h" + +/* paths for logical decoding data (relative to installation's $PGDATA) */ +#define PG_LOGICAL_DIR "pg_logical" +#define PG_LOGICAL_MAPPINGS_DIR PG_LOGICAL_DIR "/mappings" +#define PG_LOGICAL_SNAPSHOTS_DIR PG_LOGICAL_DIR "/snapshots" + +/* GUC variables */ +extern PGDLLIMPORT int logical_decoding_work_mem; +extern PGDLLIMPORT int debug_logical_replication_streaming; + +/* possible values for debug_logical_replication_streaming */ +typedef enum +{ + DEBUG_LOGICAL_REP_STREAMING_BUFFERED, + DEBUG_LOGICAL_REP_STREAMING_IMMEDIATE, +} DebugLogicalRepStreamingMode; + +/* + * Types of the change passed to a 'change' callback. + * + * For efficiency and simplicity reasons we want to keep Snapshots, CommandIds + * and ComboCids in the same list with the user visible INSERT/UPDATE/DELETE + * changes. Users of the decoding facilities will never see changes with + * *_INTERNAL_* actions. + * + * The INTERNAL_SPEC_INSERT and INTERNAL_SPEC_CONFIRM, and INTERNAL_SPEC_ABORT + * changes concern "speculative insertions", their confirmation, and abort + * respectively. They're used by INSERT .. ON CONFLICT .. UPDATE. Users of + * logical decoding don't have to care about these. + */ +typedef enum ReorderBufferChangeType +{ + REORDER_BUFFER_CHANGE_INSERT, + REORDER_BUFFER_CHANGE_UPDATE, + REORDER_BUFFER_CHANGE_DELETE, + REORDER_BUFFER_CHANGE_MESSAGE, + REORDER_BUFFER_CHANGE_INVALIDATION, + REORDER_BUFFER_CHANGE_INTERNAL_SNAPSHOT, + REORDER_BUFFER_CHANGE_INTERNAL_COMMAND_ID, + REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID, + REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT, + REORDER_BUFFER_CHANGE_INTERNAL_SPEC_CONFIRM, + REORDER_BUFFER_CHANGE_INTERNAL_SPEC_ABORT, + REORDER_BUFFER_CHANGE_TRUNCATE, +} ReorderBufferChangeType; + +/* forward declaration */ +struct ReorderBufferTXN; + +/* + * a single 'change', can be an insert (with one tuple), an update (old, new), + * or a delete (old). + * + * The same struct is also used internally for other purposes but that should + * never be visible outside reorderbuffer.c. + */ +typedef struct ReorderBufferChange +{ + XLogRecPtr lsn; + + /* The type of change. */ + ReorderBufferChangeType action; + + /* Transaction this change belongs to. */ + struct ReorderBufferTXN *txn; + + RepOriginId origin_id; + + /* + * Context data for the change. Which part of the union is valid depends + * on action. + */ + union + { + /* Old, new tuples when action == *_INSERT|UPDATE|DELETE */ + struct + { + /* relation that has been changed */ + RelFileLocator rlocator; + + /* no previously reassembled toast chunks are necessary anymore */ + bool clear_toast_afterwards; + + /* valid for DELETE || UPDATE */ + HeapTuple oldtuple; + /* valid for INSERT || UPDATE */ + HeapTuple newtuple; + } tp; + + /* + * Truncate data for REORDER_BUFFER_CHANGE_TRUNCATE representing one + * set of relations to be truncated. + */ + struct + { + Size nrelids; + bool cascade; + bool restart_seqs; + Oid *relids; + } truncate; + + /* Message with arbitrary data. */ + struct + { + char *prefix; + Size message_size; + char *message; + } msg; + + /* New snapshot, set when action == *_INTERNAL_SNAPSHOT */ + Snapshot snapshot; + + /* + * New command id for existing snapshot in a catalog changing tx. Set + * when action == *_INTERNAL_COMMAND_ID. + */ + CommandId command_id; + + /* + * New cid mapping for catalog changing transaction, set when action + * == *_INTERNAL_TUPLECID. + */ + struct + { + RelFileLocator locator; + ItemPointerData tid; + CommandId cmin; + CommandId cmax; + CommandId combocid; + } tuplecid; + + /* Invalidation. */ + struct + { + uint32 ninvalidations; /* Number of messages */ + SharedInvalidationMessage *invalidations; /* invalidation message */ + } inval; + } data; + + /* + * While in use this is how a change is linked into a transactions, + * otherwise it's the preallocated list. + */ + dlist_node node; +} ReorderBufferChange; + +/* ReorderBufferTXN txn_flags */ +#define RBTXN_HAS_CATALOG_CHANGES 0x0001 +#define RBTXN_IS_SUBXACT 0x0002 +#define RBTXN_IS_SERIALIZED 0x0004 +#define RBTXN_IS_SERIALIZED_CLEAR 0x0008 +#define RBTXN_IS_STREAMED 0x0010 +#define RBTXN_HAS_PARTIAL_CHANGE 0x0020 +#define RBTXN_IS_PREPARED 0x0040 +#define RBTXN_SKIPPED_PREPARE 0x0080 +#define RBTXN_HAS_STREAMABLE_CHANGE 0x0100 +#define RBTXN_SENT_PREPARE 0x0200 +#define RBTXN_IS_COMMITTED 0x0400 +#define RBTXN_IS_ABORTED 0x0800 +#define RBTXN_DISTR_INVAL_OVERFLOWED 0x1000 + +#define RBTXN_PREPARE_STATUS_MASK (RBTXN_IS_PREPARED | RBTXN_SKIPPED_PREPARE | RBTXN_SENT_PREPARE) + +/* Does the transaction have catalog changes? */ +#define rbtxn_has_catalog_changes(txn) \ +( \ + ((txn)->txn_flags & RBTXN_HAS_CATALOG_CHANGES) != 0 \ +) + +/* Is the transaction known as a subxact? */ +#define rbtxn_is_known_subxact(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_SUBXACT) != 0 \ +) + +/* Has this transaction been spilled to disk? */ +#define rbtxn_is_serialized(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_SERIALIZED) != 0 \ +) + +/* Has this transaction ever been spilled to disk? */ +#define rbtxn_is_serialized_clear(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_SERIALIZED_CLEAR) != 0 \ +) + +/* Does this transaction contain partial changes? */ +#define rbtxn_has_partial_change(txn) \ +( \ + ((txn)->txn_flags & RBTXN_HAS_PARTIAL_CHANGE) != 0 \ +) + +/* Does this transaction contain streamable changes? */ +#define rbtxn_has_streamable_change(txn) \ +( \ + ((txn)->txn_flags & RBTXN_HAS_STREAMABLE_CHANGE) != 0 \ +) + +/* + * Has this transaction been streamed to downstream? + * + * (It's not possible to deduce this from nentries and nentries_mem for + * various reasons. For example, all changes may be in subtransactions in + * which case we'd have nentries==0 for the toplevel one, which would say + * nothing about the streaming. So we maintain this flag, but only for the + * toplevel transaction.) + */ +#define rbtxn_is_streamed(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_STREAMED) != 0 \ +) + +/* + * Is this a prepared transaction? + * + * Being true means that this transaction should be prepared instead of + * committed. To check whether a prepare or a stream_prepare has already + * been sent for this transaction, we need to use rbtxn_sent_prepare(). + */ +#define rbtxn_is_prepared(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_PREPARED) != 0 \ +) + +/* Has a prepare or stream_prepare already been sent? */ +#define rbtxn_sent_prepare(txn) \ +( \ + ((txn)->txn_flags & RBTXN_SENT_PREPARE) != 0 \ +) + +/* Is this transaction committed? */ +#define rbtxn_is_committed(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_COMMITTED) != 0 \ +) + +/* Is this transaction aborted? */ +#define rbtxn_is_aborted(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_ABORTED) != 0 \ +) + +/* prepare for this transaction skipped? */ +#define rbtxn_skip_prepared(txn) \ +( \ + ((txn)->txn_flags & RBTXN_SKIPPED_PREPARE) != 0 \ +) + +/* Is the array of distributed inval messages overflowed? */ +#define rbtxn_distr_inval_overflowed(txn) \ +( \ + ((txn)->txn_flags & RBTXN_DISTR_INVAL_OVERFLOWED) != 0 \ +) + +/* Is this a top-level transaction? */ +#define rbtxn_is_toptxn(txn) \ +( \ + (txn)->toptxn == NULL \ +) + +/* Is this a subtransaction? */ +#define rbtxn_is_subtxn(txn) \ +( \ + (txn)->toptxn != NULL \ +) + +/* Get the top-level transaction of this (sub)transaction. */ +#define rbtxn_get_toptxn(txn) \ +( \ + rbtxn_is_subtxn(txn) ? (txn)->toptxn : (txn) \ +) + +typedef struct ReorderBufferTXN +{ + /* See above */ + bits32 txn_flags; + + /* The transaction's transaction id, can be a toplevel or sub xid. */ + TransactionId xid; + + /* Xid of top-level transaction, if known */ + TransactionId toplevel_xid; + + /* + * Global transaction id required for identification of prepared + * transactions. + */ + char *gid; + + /* + * LSN of the first data carrying, WAL record with knowledge about this + * xid. This is allowed to *not* be first record adorned with this xid, if + * the previous records aren't relevant for logical decoding. + */ + XLogRecPtr first_lsn; + + /* ---- + * LSN of the record that lead to this xact to be prepared or committed or + * aborted. This can be a + * * plain commit record + * * plain commit record, of a parent transaction + * * prepared transaction + * * prepared transaction commit + * * plain abort record + * * prepared transaction abort + * + * This can also become set to earlier values than transaction end when + * a transaction is spilled to disk; specifically it's set to the LSN of + * the latest change written to disk so far. + * ---- + */ + XLogRecPtr final_lsn; + + /* + * LSN pointing to the end of the commit record + 1. + */ + XLogRecPtr end_lsn; + + /* Toplevel transaction for this subxact (NULL for top-level). */ + struct ReorderBufferTXN *toptxn; + + /* + * LSN of the last lsn at which snapshot information reside, so we can + * restart decoding from there and fully recover this transaction from + * WAL. + */ + XLogRecPtr restart_decoding_lsn; + + /* origin of the change that caused this transaction */ + RepOriginId origin_id; + XLogRecPtr origin_lsn; + + /* + * Commit or Prepare time, only known when we read the actual commit or + * prepare record. + */ + union + { + TimestampTz commit_time; + TimestampTz prepare_time; + TimestampTz abort_time; + } xact_time; + + /* + * The base snapshot is used to decode all changes until either this + * transaction modifies the catalog, or another catalog-modifying + * transaction commits. + */ + Snapshot base_snapshot; + XLogRecPtr base_snapshot_lsn; + dlist_node base_snapshot_node; /* link in txns_by_base_snapshot_lsn */ + + /* + * Snapshot/CID from the previous streaming run. Only valid for already + * streamed transactions (NULL/InvalidCommandId otherwise). + */ + Snapshot snapshot_now; + CommandId command_id; + + /* + * How many ReorderBufferChange's do we have in this txn. + * + * Changes in subtransactions are *not* included but tracked separately. + */ + uint64 nentries; + + /* + * How many of the above entries are stored in memory in contrast to being + * spilled to disk. + */ + uint64 nentries_mem; + + /* + * List of ReorderBufferChange structs, including new Snapshots, new + * CommandIds and command invalidation messages. + */ + dlist_head changes; + + /* + * List of (relation, ctid) => (cmin, cmax) mappings for catalog tuples. + * Those are always assigned to the toplevel transaction. (Keep track of + * #entries to create a hash of the right size) + */ + dlist_head tuplecids; + uint64 ntuplecids; + + /* + * On-demand built hash for looking up the above values. + */ + HTAB *tuplecid_hash; + + /* + * Hash containing (potentially partial) toast entries. NULL if no toast + * tuples have been found for the current change. + */ + HTAB *toast_hash; + + /* + * non-hierarchical list of subtransactions that are *not* aborted. Only + * used in toplevel transactions. + */ + dlist_head subtxns; + uint32 nsubtxns; + + /* + * Stored cache invalidations. This is not a linked list because we get + * all the invalidations at once. + */ + uint32 ninvalidations; + SharedInvalidationMessage *invalidations; + + /* + * Stores cache invalidation messages distributed by other transactions. + */ + uint32 ninvalidations_distributed; + SharedInvalidationMessage *invalidations_distributed; + + /* --- + * Position in one of two lists: + * * list of subtransactions if we are *known* to be subxact + * * list of toplevel xacts (can be an as-yet unknown subxact) + * --- + */ + dlist_node node; + + /* + * A node in the list of catalog modifying transactions + */ + dlist_node catchange_node; + + /* + * A node in txn_heap + */ + pairingheap_node txn_node; + + /* + * Size of this transaction (changes currently in memory, in bytes). + */ + Size size; + + /* Size of top-transaction including sub-transactions. */ + Size total_size; + + /* + * Private data pointer of the output plugin. + */ + void *output_plugin_private; +} ReorderBufferTXN; + +/* so we can define the callbacks used inside struct ReorderBuffer itself */ +typedef struct ReorderBuffer ReorderBuffer; + +/* change callback signature */ +typedef void (*ReorderBufferApplyChangeCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); + +/* truncate callback signature */ +typedef void (*ReorderBufferApplyTruncateCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + int nrelations, + Relation relations[], + ReorderBufferChange *change); + +/* begin callback signature */ +typedef void (*ReorderBufferBeginCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn); + +/* commit callback signature */ +typedef void (*ReorderBufferCommitCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* message callback signature */ +typedef void (*ReorderBufferMessageCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, Size sz, + const char *message); + +/* begin prepare callback signature */ +typedef void (*ReorderBufferBeginPrepareCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn); + +/* prepare callback signature */ +typedef void (*ReorderBufferPrepareCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); + +/* commit prepared callback signature */ +typedef void (*ReorderBufferCommitPreparedCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* rollback prepared callback signature */ +typedef void (*ReorderBufferRollbackPreparedCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr prepare_end_lsn, + TimestampTz prepare_time); + +/* start streaming transaction callback signature */ +typedef void (*ReorderBufferStreamStartCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr first_lsn); + +/* stop streaming transaction callback signature */ +typedef void (*ReorderBufferStreamStopCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr last_lsn); + +/* discard streamed transaction callback signature */ +typedef void (*ReorderBufferStreamAbortCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr abort_lsn); + +/* prepare streamed transaction callback signature */ +typedef void (*ReorderBufferStreamPrepareCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); + +/* commit streamed transaction callback signature */ +typedef void (*ReorderBufferStreamCommitCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* stream change callback signature */ +typedef void (*ReorderBufferStreamChangeCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); + +/* stream message callback signature */ +typedef void (*ReorderBufferStreamMessageCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, Size sz, + const char *message); + +/* stream truncate callback signature */ +typedef void (*ReorderBufferStreamTruncateCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + int nrelations, + Relation relations[], + ReorderBufferChange *change); + +/* update progress txn callback signature */ +typedef void (*ReorderBufferUpdateProgressTxnCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr lsn); + +struct ReorderBuffer +{ + /* + * xid => ReorderBufferTXN lookup table + */ + HTAB *by_txn; + + /* + * Transactions that could be a toplevel xact, ordered by LSN of the first + * record bearing that xid. + */ + dlist_head toplevel_by_lsn; + + /* + * Transactions and subtransactions that have a base snapshot, ordered by + * LSN of the record which caused us to first obtain the base snapshot. + * This is not the same as toplevel_by_lsn, because we only set the base + * snapshot on the first logical-decoding-relevant record (eg. heap + * writes), whereas the initial LSN could be set by other operations. + */ + dlist_head txns_by_base_snapshot_lsn; + + /* + * Transactions and subtransactions that have modified system catalogs. + */ + dclist_head catchange_txns; + + /* + * one-entry sized cache for by_txn. Very frequently the same txn gets + * looked up over and over again. + */ + TransactionId by_txn_last_xid; + ReorderBufferTXN *by_txn_last_txn; + + /* + * Callbacks to be called when a transactions commits. + */ + ReorderBufferBeginCB begin; + ReorderBufferApplyChangeCB apply_change; + ReorderBufferApplyTruncateCB apply_truncate; + ReorderBufferCommitCB commit; + ReorderBufferMessageCB message; + + /* + * Callbacks to be called when streaming a transaction at prepare time. + */ + ReorderBufferBeginCB begin_prepare; + ReorderBufferPrepareCB prepare; + ReorderBufferCommitPreparedCB commit_prepared; + ReorderBufferRollbackPreparedCB rollback_prepared; + + /* + * Callbacks to be called when streaming a transaction. + */ + ReorderBufferStreamStartCB stream_start; + ReorderBufferStreamStopCB stream_stop; + ReorderBufferStreamAbortCB stream_abort; + ReorderBufferStreamPrepareCB stream_prepare; + ReorderBufferStreamCommitCB stream_commit; + ReorderBufferStreamChangeCB stream_change; + ReorderBufferStreamMessageCB stream_message; + ReorderBufferStreamTruncateCB stream_truncate; + + /* + * Callback to be called when updating progress during sending data of a + * transaction (and its subtransactions) to the output plugin. + */ + ReorderBufferUpdateProgressTxnCB update_progress_txn; + + /* + * Pointer that will be passed untouched to the callbacks. + */ + void *private_data; + + /* + * Saved output plugin option + */ + bool output_rewrites; + + /* + * Private memory context. + */ + MemoryContext context; + + /* + * Memory contexts for specific types objects + */ + MemoryContext change_context; + MemoryContext txn_context; + MemoryContext tup_context; + + XLogRecPtr current_restart_decoding_lsn; + + /* buffer for disk<->memory conversions */ + char *outbuf; + Size outbufsize; + + /* memory accounting */ + Size size; + + /* Max-heap for sizes of all top-level and sub transactions */ + pairingheap *txn_heap; + + /* + * Statistics about transactions spilled to disk. + * + * A single transaction may be spilled repeatedly, which is why we keep + * two different counters. For spilling, the transaction counter includes + * both toplevel transactions and subtransactions. + */ + int64 spillTxns; /* number of transactions spilled to disk */ + int64 spillCount; /* spill-to-disk invocation counter */ + int64 spillBytes; /* amount of data spilled to disk */ + + /* Statistics about transactions streamed to the decoding output plugin */ + int64 streamTxns; /* number of transactions streamed */ + int64 streamCount; /* streaming invocation counter */ + int64 streamBytes; /* amount of data decoded */ + + /* + * Statistics about all the transactions sent to the decoding output + * plugin + */ + int64 totalTxns; /* total number of transactions sent */ + int64 totalBytes; /* total amount of data decoded */ +}; + + +extern ReorderBuffer *ReorderBufferAllocate(void); +extern void ReorderBufferFree(ReorderBuffer *rb); + +extern HeapTuple ReorderBufferAllocTupleBuf(ReorderBuffer *rb, Size tuple_len); +extern void ReorderBufferFreeTupleBuf(HeapTuple tuple); + +extern ReorderBufferChange *ReorderBufferAllocChange(ReorderBuffer *rb); +extern void ReorderBufferFreeChange(ReorderBuffer *rb, + ReorderBufferChange *change, bool upd_mem); + +extern Oid *ReorderBufferAllocRelids(ReorderBuffer *rb, int nrelids); +extern void ReorderBufferFreeRelids(ReorderBuffer *rb, Oid *relids); + +extern void ReorderBufferQueueChange(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, ReorderBufferChange *change, + bool toast_insert); +extern void ReorderBufferQueueMessage(ReorderBuffer *rb, TransactionId xid, + Snapshot snap, XLogRecPtr lsn, + bool transactional, const char *prefix, + Size message_size, const char *message); +extern void ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr commit_lsn, XLogRecPtr end_lsn, + TimestampTz commit_time, RepOriginId origin_id, XLogRecPtr origin_lsn); +extern void ReorderBufferFinishPrepared(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr commit_lsn, XLogRecPtr end_lsn, + XLogRecPtr two_phase_at, + TimestampTz commit_time, + RepOriginId origin_id, XLogRecPtr origin_lsn, + char *gid, bool is_commit); +extern void ReorderBufferAssignChild(ReorderBuffer *rb, TransactionId xid, + TransactionId subxid, XLogRecPtr lsn); +extern void ReorderBufferCommitChild(ReorderBuffer *rb, TransactionId xid, + TransactionId subxid, XLogRecPtr commit_lsn, + XLogRecPtr end_lsn); +extern void ReorderBufferAbort(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn, + TimestampTz abort_time); +extern void ReorderBufferAbortOld(ReorderBuffer *rb, TransactionId oldestRunningXid); +extern void ReorderBufferForget(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn); +extern void ReorderBufferInvalidate(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn); + +extern void ReorderBufferSetBaseSnapshot(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, Snapshot snap); +extern void ReorderBufferAddSnapshot(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, Snapshot snap); +extern void ReorderBufferAddNewCommandId(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, CommandId cid); +extern void ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, RelFileLocator locator, + ItemPointerData tid, + CommandId cmin, CommandId cmax, CommandId combocid); +extern void ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn, + Size nmsgs, SharedInvalidationMessage *msgs); +extern void ReorderBufferAddDistributedInvalidations(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, Size nmsgs, + SharedInvalidationMessage *msgs); +extern void ReorderBufferImmediateInvalidation(ReorderBuffer *rb, uint32 ninvalidations, + SharedInvalidationMessage *invalidations); +extern void ReorderBufferProcessXid(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn); + +extern void ReorderBufferXidSetCatalogChanges(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn); +extern bool ReorderBufferXidHasCatalogChanges(ReorderBuffer *rb, TransactionId xid); +extern bool ReorderBufferXidHasBaseSnapshot(ReorderBuffer *rb, TransactionId xid); + +extern bool ReorderBufferRememberPrepareInfo(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr prepare_lsn, XLogRecPtr end_lsn, + TimestampTz prepare_time, + RepOriginId origin_id, XLogRecPtr origin_lsn); +extern void ReorderBufferSkipPrepare(ReorderBuffer *rb, TransactionId xid); +extern void ReorderBufferPrepare(ReorderBuffer *rb, TransactionId xid, char *gid); +extern ReorderBufferTXN *ReorderBufferGetOldestTXN(ReorderBuffer *rb); +extern TransactionId ReorderBufferGetOldestXmin(ReorderBuffer *rb); +extern TransactionId *ReorderBufferGetCatalogChangesXacts(ReorderBuffer *rb); + +extern void ReorderBufferSetRestartPoint(ReorderBuffer *rb, XLogRecPtr ptr); + +extern uint32 ReorderBufferGetInvalidations(ReorderBuffer *rb, + TransactionId xid, + SharedInvalidationMessage **msgs); + +extern void StartupReorderBuffer(void); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/slot.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/slot.h new file mode 100644 index 0000000..d9aab93 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/slot.h @@ -0,0 +1,327 @@ +/*------------------------------------------------------------------------- + * slot.h + * Replication slot management. + * + * Copyright (c) 2012-2025, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ +#ifndef SLOT_H +#define SLOT_H + +#include "access/xlog.h" +#include "access/xlogreader.h" +#include "storage/condition_variable.h" +#include "storage/lwlock.h" +#include "storage/shmem.h" +#include "storage/spin.h" +#include "replication/walreceiver.h" + +/* directory to store replication slot data in */ +#define PG_REPLSLOT_DIR "pg_replslot" + +/* + * Behaviour of replication slots, upon release or crash. + * + * Slots marked as PERSISTENT are crash-safe and will not be dropped when + * released. Slots marked as EPHEMERAL will be dropped when released or after + * restarts. Slots marked TEMPORARY will be dropped at the end of a session + * or on error. + * + * EPHEMERAL is used as a not-quite-ready state when creating persistent + * slots. EPHEMERAL slots can be made PERSISTENT by calling + * ReplicationSlotPersist(). For a slot that goes away at the end of a + * session, TEMPORARY is the appropriate choice. + */ +typedef enum ReplicationSlotPersistency +{ + RS_PERSISTENT, + RS_EPHEMERAL, + RS_TEMPORARY, +} ReplicationSlotPersistency; + +/* + * Slots can be invalidated, e.g. due to max_slot_wal_keep_size. If so, the + * 'invalidated' field is set to a value other than _NONE. + * + * When adding a new invalidation cause here, the value must be powers of 2 + * (e.g., 1, 2, 4...) for proper bitwise operations. Also, remember to update + * RS_INVAL_MAX_CAUSES below, and SlotInvalidationCauses in slot.c. + */ +typedef enum ReplicationSlotInvalidationCause +{ + RS_INVAL_NONE = 0, + /* required WAL has been removed */ + RS_INVAL_WAL_REMOVED = (1 << 0), + /* required rows have been removed */ + RS_INVAL_HORIZON = (1 << 1), + /* wal_level insufficient for slot */ + RS_INVAL_WAL_LEVEL = (1 << 2), + /* idle slot timeout has occurred */ + RS_INVAL_IDLE_TIMEOUT = (1 << 3), +} ReplicationSlotInvalidationCause; + +/* Maximum number of invalidation causes */ +#define RS_INVAL_MAX_CAUSES 4 + +/* + * On-Disk data of a replication slot, preserved across restarts. + */ +typedef struct ReplicationSlotPersistentData +{ + /* The slot's identifier */ + NameData name; + + /* database the slot is active on */ + Oid database; + + /* + * The slot's behaviour when being dropped (or restored after a crash). + */ + ReplicationSlotPersistency persistency; + + /* + * xmin horizon for data + * + * NB: This may represent a value that hasn't been written to disk yet; + * see notes for effective_xmin, below. + */ + TransactionId xmin; + + /* + * xmin horizon for catalog tuples + * + * NB: This may represent a value that hasn't been written to disk yet; + * see notes for effective_xmin, below. + */ + TransactionId catalog_xmin; + + /* oldest LSN that might be required by this replication slot */ + XLogRecPtr restart_lsn; + + /* RS_INVAL_NONE if valid, or the reason for having been invalidated */ + ReplicationSlotInvalidationCause invalidated; + + /* + * Oldest LSN that the client has acked receipt for. This is used as the + * start_lsn point in case the client doesn't specify one, and also as a + * safety measure to jump forwards in case the client specifies a + * start_lsn that's further in the past than this value. + */ + XLogRecPtr confirmed_flush; + + /* + * LSN at which we enabled two_phase commit for this slot or LSN at which + * we found a consistent point at the time of slot creation. + */ + XLogRecPtr two_phase_at; + + /* + * Allow decoding of prepared transactions? + */ + bool two_phase; + + /* plugin name */ + NameData plugin; + + /* + * Was this slot synchronized from the primary server? + */ + char synced; + + /* + * Is this a failover slot (sync candidate for standbys)? Only relevant + * for logical slots on the primary server. + */ + bool failover; +} ReplicationSlotPersistentData; + +/* + * Shared memory state of a single replication slot. + * + * The in-memory data of replication slots follows a locking model based + * on two linked concepts: + * - A replication slot's in_use flag is switched when added or discarded using + * the LWLock ReplicationSlotControlLock, which needs to be hold in exclusive + * mode when updating the flag by the backend owning the slot and doing the + * operation, while readers (concurrent backends not owning the slot) need + * to hold it in shared mode when looking at replication slot data. + * - Individual fields are protected by mutex where only the backend owning + * the slot is authorized to update the fields from its own slot. The + * backend owning the slot does not need to take this lock when reading its + * own fields, while concurrent backends not owning this slot should take the + * lock when reading this slot's data. + */ +typedef struct ReplicationSlot +{ + /* lock, on same cacheline as effective_xmin */ + slock_t mutex; + + /* is this slot defined */ + bool in_use; + + /* Who is streaming out changes for this slot? 0 in unused slots. */ + pid_t active_pid; + + /* any outstanding modifications? */ + bool just_dirtied; + bool dirty; + + /* + * For logical decoding, it's extremely important that we never remove any + * data that's still needed for decoding purposes, even after a crash; + * otherwise, decoding will produce wrong answers. Ordinary streaming + * replication also needs to prevent old row versions from being removed + * too soon, but the worst consequence we might encounter there is + * unwanted query cancellations on the standby. Thus, for logical + * decoding, this value represents the latest xmin that has actually been + * written to disk, whereas for streaming replication, it's just the same + * as the persistent value (data.xmin). + */ + TransactionId effective_xmin; + TransactionId effective_catalog_xmin; + + /* data surviving shutdowns and crashes */ + ReplicationSlotPersistentData data; + + /* is somebody performing io on this slot? */ + LWLock io_in_progress_lock; + + /* Condition variable signaled when active_pid changes */ + ConditionVariable active_cv; + + /* all the remaining data is only used for logical slots */ + + /* + * When the client has confirmed flushes >= candidate_xmin_lsn we can + * advance the catalog xmin. When restart_valid has been passed, + * restart_lsn can be increased. + */ + TransactionId candidate_catalog_xmin; + XLogRecPtr candidate_xmin_lsn; + XLogRecPtr candidate_restart_valid; + XLogRecPtr candidate_restart_lsn; + + /* + * This value tracks the last confirmed_flush LSN flushed which is used + * during a shutdown checkpoint to decide if logical's slot data should be + * forcibly flushed or not. + */ + XLogRecPtr last_saved_confirmed_flush; + + /* + * The time when the slot became inactive. For synced slots on a standby + * server, it represents the time when slot synchronization was most + * recently stopped. + */ + TimestampTz inactive_since; + + /* + * Latest restart_lsn that has been flushed to disk. For persistent slots + * the flushed LSN should be taken into account when calculating the + * oldest LSN for WAL segments removal. + */ + XLogRecPtr last_saved_restart_lsn; + +} ReplicationSlot; + +#define SlotIsPhysical(slot) ((slot)->data.database == InvalidOid) +#define SlotIsLogical(slot) ((slot)->data.database != InvalidOid) + +/* + * Shared memory control area for all of replication slots. + */ +typedef struct ReplicationSlotCtlData +{ + /* + * This array should be declared [FLEXIBLE_ARRAY_MEMBER], but for some + * reason you can't do that in an otherwise-empty struct. + */ + ReplicationSlot replication_slots[1]; +} ReplicationSlotCtlData; + +/* + * Set slot's inactive_since property unless it was previously invalidated. + */ +static inline void +ReplicationSlotSetInactiveSince(ReplicationSlot *s, TimestampTz ts, + bool acquire_lock) +{ + if (acquire_lock) + SpinLockAcquire(&s->mutex); + + if (s->data.invalidated == RS_INVAL_NONE) + s->inactive_since = ts; + + if (acquire_lock) + SpinLockRelease(&s->mutex); +} + +/* + * Pointers to shared memory + */ +extern PGDLLIMPORT ReplicationSlotCtlData *ReplicationSlotCtl; +extern PGDLLIMPORT ReplicationSlot *MyReplicationSlot; + +/* GUCs */ +extern PGDLLIMPORT int max_replication_slots; +extern PGDLLIMPORT char *synchronized_standby_slots; +extern PGDLLIMPORT int idle_replication_slot_timeout_secs; + +/* shmem initialization functions */ +extern Size ReplicationSlotsShmemSize(void); +extern void ReplicationSlotsShmemInit(void); + +/* management of individual slots */ +extern void ReplicationSlotCreate(const char *name, bool db_specific, + ReplicationSlotPersistency persistency, + bool two_phase, bool failover, + bool synced); +extern void ReplicationSlotPersist(void); +extern void ReplicationSlotDrop(const char *name, bool nowait); +extern void ReplicationSlotDropAcquired(void); +extern void ReplicationSlotAlter(const char *name, const bool *failover, + const bool *two_phase); + +extern void ReplicationSlotAcquire(const char *name, bool nowait, + bool error_if_invalid); +extern void ReplicationSlotRelease(void); +extern void ReplicationSlotCleanup(bool synced_only); +extern void ReplicationSlotSave(void); +extern void ReplicationSlotMarkDirty(void); + +/* misc stuff */ +extern void ReplicationSlotInitialize(void); +extern bool ReplicationSlotValidateName(const char *name, int elevel); +extern bool ReplicationSlotValidateNameInternal(const char *name, + int *err_code, char **err_msg, char **err_hint); +extern void ReplicationSlotReserveWal(void); +extern void ReplicationSlotsComputeRequiredXmin(bool already_locked); +extern void ReplicationSlotsComputeRequiredLSN(void); +extern XLogRecPtr ReplicationSlotsComputeLogicalRestartLSN(void); +extern bool ReplicationSlotsCountDBSlots(Oid dboid, int *nslots, int *nactive); +extern void ReplicationSlotsDropDBSlots(Oid dboid); +extern bool InvalidateObsoleteReplicationSlots(uint32 possible_causes, + XLogSegNo oldestSegno, + Oid dboid, + TransactionId snapshotConflictHorizon); +extern ReplicationSlot *SearchNamedReplicationSlot(const char *name, bool need_lock); +extern int ReplicationSlotIndex(ReplicationSlot *slot); +extern bool ReplicationSlotName(int index, Name name); +extern void ReplicationSlotNameForTablesync(Oid suboid, Oid relid, char *syncslotname, Size szslot); +extern void ReplicationSlotDropAtPubNode(WalReceiverConn *wrconn, char *slotname, bool missing_ok); + +extern void StartupReplicationSlots(void); +extern void CheckPointReplicationSlots(bool is_shutdown); + +extern void CheckSlotRequirements(void); +extern void CheckSlotPermissions(void); +extern ReplicationSlotInvalidationCause + GetSlotInvalidationCause(const char *cause_name); +extern const char *GetSlotInvalidationCauseName(ReplicationSlotInvalidationCause cause); + +extern bool SlotExistsInSyncStandbySlots(const char *slot_name); +extern bool StandbySlotsHaveCaughtup(XLogRecPtr wait_for_lsn, int elevel); +extern void WaitForStandbyConfirmation(XLogRecPtr wait_for_lsn); + +#endif /* SLOT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/slotsync.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/slotsync.h new file mode 100644 index 0000000..16b7214 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/slotsync.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * slotsync.h + * Exports for slot synchronization. + * + * Portions Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/replication/slotsync.h + * + *------------------------------------------------------------------------- + */ +#ifndef SLOTSYNC_H +#define SLOTSYNC_H + +#include "replication/walreceiver.h" + +extern PGDLLIMPORT bool sync_replication_slots; + +/* + * GUCs needed by slot sync worker to connect to the primary + * server and carry on with slots synchronization. + */ +extern PGDLLIMPORT char *PrimaryConnInfo; +extern PGDLLIMPORT char *PrimarySlotName; + +extern char *CheckAndGetDbnameFromConninfo(void); +extern bool ValidateSlotSyncParams(int elevel); + +pg_noreturn extern void ReplSlotSyncWorkerMain(const void *startup_data, size_t startup_data_len); + +extern void ShutDownSlotSync(void); +extern bool SlotSyncWorkerCanRestart(void); +extern bool IsSyncingReplicationSlots(void); +extern Size SlotSyncShmemSize(void); +extern void SlotSyncShmemInit(void); +extern void SyncReplicationSlots(WalReceiverConn *wrconn); + +#endif /* SLOTSYNC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/snapbuild.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/snapbuild.h new file mode 100644 index 0000000..44031dc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/snapbuild.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------------------- + * + * snapbuild.h + * Exports from replication/logical/snapbuild.c. + * + * Copyright (c) 2012-2025, PostgreSQL Global Development Group + * + * src/include/replication/snapbuild.h + * + *------------------------------------------------------------------------- + */ +#ifndef SNAPBUILD_H +#define SNAPBUILD_H + +#include "access/xlogdefs.h" +#include "utils/snapmgr.h" + +/* + * Please keep get_snapbuild_state_desc() (located in the pg_logicalinspect + * module) updated if a change needs to be made to SnapBuildState. + */ +typedef enum +{ + /* + * Initial state, we can't do much yet. + */ + SNAPBUILD_START = -1, + + /* + * Collecting committed transactions, to build the initial catalog + * snapshot. + */ + SNAPBUILD_BUILDING_SNAPSHOT = 0, + + /* + * We have collected enough information to decode tuples in transactions + * that started after this. + * + * Once we reached this we start to collect changes. We cannot apply them + * yet, because they might be based on transactions that were still + * running when FULL_SNAPSHOT was reached. + */ + SNAPBUILD_FULL_SNAPSHOT = 1, + + /* + * Found a point after SNAPBUILD_FULL_SNAPSHOT where all transactions that + * were running at that point finished. Till we reach that we hold off + * calling any commit callbacks. + */ + SNAPBUILD_CONSISTENT = 2, +} SnapBuildState; + +/* forward declare so we don't have to include snapbuild_internal.h */ +struct SnapBuild; +typedef struct SnapBuild SnapBuild; + +/* forward declare so we don't have to include reorderbuffer.h */ +struct ReorderBuffer; + +/* forward declare so we don't have to include heapam_xlog.h */ +struct xl_heap_new_cid; +struct xl_running_xacts; + +extern void CheckPointSnapBuild(void); + +extern SnapBuild *AllocateSnapshotBuilder(struct ReorderBuffer *reorder, + TransactionId xmin_horizon, XLogRecPtr start_lsn, + bool need_full_snapshot, + bool in_slot_creation, + XLogRecPtr two_phase_at); +extern void FreeSnapshotBuilder(SnapBuild *builder); + +extern void SnapBuildSnapDecRefcount(Snapshot snap); + +extern Snapshot SnapBuildInitialSnapshot(SnapBuild *builder); +extern const char *SnapBuildExportSnapshot(SnapBuild *builder); +extern void SnapBuildClearExportedSnapshot(void); +extern void SnapBuildResetExportedSnapshotState(void); + +extern SnapBuildState SnapBuildCurrentState(SnapBuild *builder); +extern Snapshot SnapBuildGetOrBuildSnapshot(SnapBuild *builder); + +extern bool SnapBuildXactNeedsSkip(SnapBuild *builder, XLogRecPtr ptr); +extern XLogRecPtr SnapBuildGetTwoPhaseAt(SnapBuild *builder); +extern void SnapBuildSetTwoPhaseAt(SnapBuild *builder, XLogRecPtr ptr); + +extern void SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn, + TransactionId xid, int nsubxacts, + TransactionId *subxacts, uint32 xinfo); +extern bool SnapBuildProcessChange(SnapBuild *builder, TransactionId xid, + XLogRecPtr lsn); +extern void SnapBuildProcessNewCid(SnapBuild *builder, TransactionId xid, + XLogRecPtr lsn, + struct xl_heap_new_cid *xlrec); +extern void SnapBuildProcessRunningXacts(SnapBuild *builder, XLogRecPtr lsn, + struct xl_running_xacts *running); +extern void SnapBuildSerializationPoint(SnapBuild *builder, XLogRecPtr lsn); + +extern bool SnapBuildSnapshotExists(XLogRecPtr lsn); + +#endif /* SNAPBUILD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/snapbuild_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/snapbuild_internal.h new file mode 100644 index 0000000..3b915dc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/snapbuild_internal.h @@ -0,0 +1,199 @@ +/*------------------------------------------------------------------------- + * + * snapbuild_internal.h + * This file contains declarations for logical decoding utility + * functions for internal use. + * + * Copyright (c) 2024-2025, PostgreSQL Global Development Group + * + * src/include/replication/snapbuild_internal.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SNAPBUILD_INTERNAL_H +#define SNAPBUILD_INTERNAL_H + +#include "port/pg_crc32c.h" +#include "replication/reorderbuffer.h" +#include "replication/snapbuild.h" + +/* + * This struct contains the current state of the snapshot building + * machinery. It is exposed to the public, so pay attention when changing its + * contents. + */ +struct SnapBuild +{ + /* how far are we along building our first full snapshot */ + SnapBuildState state; + + /* private memory context used to allocate memory for this module. */ + MemoryContext context; + + /* all transactions < than this have committed/aborted */ + TransactionId xmin; + + /* all transactions >= than this are uncommitted */ + TransactionId xmax; + + /* + * Don't replay commits from an LSN < this LSN. This can be set externally + * but it will also be advanced (never retreat) from within snapbuild.c. + */ + XLogRecPtr start_decoding_at; + + /* + * LSN at which two-phase decoding was enabled or LSN at which we found a + * consistent point at the time of slot creation. + * + * The prepared transactions, that were skipped because previously + * two-phase was not enabled or are not covered by initial snapshot, need + * to be sent later along with commit prepared and they must be before + * this point. + */ + XLogRecPtr two_phase_at; + + /* + * Don't start decoding WAL until the "xl_running_xacts" information + * indicates there are no running xids with an xid smaller than this. + */ + TransactionId initial_xmin_horizon; + + /* Indicates if we are building full snapshot or just catalog one. */ + bool building_full_snapshot; + + /* + * Indicates if we are using the snapshot builder for the creation of a + * logical replication slot. If it's true, the start point for decoding + * changes is not determined yet. So we skip snapshot restores to properly + * find the start point. See SnapBuildFindSnapshot() for details. + */ + bool in_slot_creation; + + /* + * Snapshot that's valid to see the catalog state seen at this moment. + */ + Snapshot snapshot; + + /* + * LSN of the last location we are sure a snapshot has been serialized to. + */ + XLogRecPtr last_serialized_snapshot; + + /* + * The reorderbuffer we need to update with usable snapshots et al. + */ + ReorderBuffer *reorder; + + /* + * TransactionId at which the next phase of initial snapshot building will + * happen. InvalidTransactionId if not known (i.e. SNAPBUILD_START), or + * when no next phase necessary (SNAPBUILD_CONSISTENT). + */ + TransactionId next_phase_at; + + /* + * Array of transactions which could have catalog changes that committed + * between xmin and xmax. + */ + struct + { + /* number of committed transactions */ + size_t xcnt; + + /* available space for committed transactions */ + size_t xcnt_space; + + /* + * Until we reach a CONSISTENT state, we record commits of all + * transactions, not just the catalog changing ones. Record when that + * changes so we know we cannot export a snapshot safely anymore. + */ + bool includes_all_transactions; + + /* + * Array of committed transactions that have modified the catalog. + * + * As this array is frequently modified we do *not* keep it in + * xidComparator order. Instead we sort the array when building & + * distributing a snapshot. + * + * TODO: It's unclear whether that reasoning has much merit. Every + * time we add something here after becoming consistent will also + * require distributing a snapshot. Storing them sorted would + * potentially also make it easier to purge (but more complicated wrt + * wraparound?). Should be improved if sorting while building the + * snapshot shows up in profiles. + */ + TransactionId *xip; + } committed; + + /* + * Array of transactions and subtransactions that had modified catalogs + * and were running when the snapshot was serialized. + * + * We normally rely on some WAL record types such as HEAP2_NEW_CID to know + * if the transaction has changed the catalog. But it could happen that + * the logical decoding decodes only the commit record of the transaction + * after restoring the previously serialized snapshot in which case we + * will miss adding the xid to the snapshot and end up looking at the + * catalogs with the wrong snapshot. + * + * Now to avoid the above problem, we serialize the transactions that had + * modified the catalogs and are still running at the time of snapshot + * serialization. We fill this array while restoring the snapshot and then + * refer it while decoding commit to ensure if the xact has modified the + * catalog. We discard this array when all the xids in the list become old + * enough to matter. See SnapBuildPurgeOlderTxn for details. + */ + struct + { + /* number of transactions */ + size_t xcnt; + + /* This array must be sorted in xidComparator order */ + TransactionId *xip; + } catchange; +}; + +/* ----------------------------------- + * Snapshot serialization support + * ----------------------------------- + */ + +/* + * We store current state of struct SnapBuild on disk in the following manner: + * + * struct SnapBuildOnDisk; + * TransactionId * committed.xcnt; (*not xcnt_space*) + * TransactionId * catchange.xcnt; + * + * Check if the SnapBuildOnDiskConstantSize and SnapBuildOnDiskNotChecksummedSize + * macros need to be updated when modifying the SnapBuildOnDisk struct. + */ +typedef struct SnapBuildOnDisk +{ + /* first part of this struct needs to be version independent */ + + /* data not covered by checksum */ + uint32 magic; + pg_crc32c checksum; + + /* data covered by checksum */ + + /* version, in case we want to support pg_upgrade */ + uint32 version; + /* how large is the on disk data, excluding the constant sized part */ + uint32 length; + + /* version dependent part */ + SnapBuild builder; + + /* variable amount of TransactionIds follows */ +} SnapBuildOnDisk; + +extern bool SnapBuildRestoreSnapshot(SnapBuildOnDisk *ondisk, XLogRecPtr lsn, + MemoryContext context, bool missing_ok); + +#endif /* SNAPBUILD_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/syncrep.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/syncrep.h new file mode 100644 index 0000000..675669a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/syncrep.h @@ -0,0 +1,110 @@ +/*------------------------------------------------------------------------- + * + * syncrep.h + * Exports from replication/syncrep.c. + * + * Portions Copyright (c) 2010-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/replication/syncrep.h + * + *------------------------------------------------------------------------- + */ +#ifndef _SYNCREP_H +#define _SYNCREP_H + +#include "access/xlogdefs.h" + +#define SyncRepRequested() \ + (max_wal_senders > 0 && synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH) + +/* SyncRepWaitMode */ +#define SYNC_REP_NO_WAIT (-1) +#define SYNC_REP_WAIT_WRITE 0 +#define SYNC_REP_WAIT_FLUSH 1 +#define SYNC_REP_WAIT_APPLY 2 + +#define NUM_SYNC_REP_WAIT_MODE 3 + +/* syncRepState */ +#define SYNC_REP_NOT_WAITING 0 +#define SYNC_REP_WAITING 1 +#define SYNC_REP_WAIT_COMPLETE 2 + +/* syncrep_method of SyncRepConfigData */ +#define SYNC_REP_PRIORITY 0 +#define SYNC_REP_QUORUM 1 + +/* + * SyncRepGetCandidateStandbys returns an array of these structs, + * one per candidate synchronous walsender. + */ +typedef struct SyncRepStandbyData +{ + /* Copies of relevant fields from WalSnd shared-memory struct */ + pid_t pid; + XLogRecPtr write; + XLogRecPtr flush; + XLogRecPtr apply; + int sync_standby_priority; + /* Index of this walsender in the WalSnd shared-memory array */ + int walsnd_index; + /* This flag indicates whether this struct is about our own process */ + bool is_me; +} SyncRepStandbyData; + +/* + * Struct for the configuration of synchronous replication. + * + * Note: this must be a flat representation that can be held in a single + * chunk of malloc'd memory, so that it can be stored as the "extra" data + * for the synchronous_standby_names GUC. + */ +typedef struct SyncRepConfigData +{ + int config_size; /* total size of this struct, in bytes */ + int num_sync; /* number of sync standbys that we need to + * wait for */ + uint8 syncrep_method; /* method to choose sync standbys */ + int nmembers; /* number of members in the following list */ + /* member_names contains nmembers consecutive nul-terminated C strings */ + char member_names[FLEXIBLE_ARRAY_MEMBER]; +} SyncRepConfigData; + +extern PGDLLIMPORT SyncRepConfigData *SyncRepConfig; + +/* user-settable parameters for synchronous replication */ +extern PGDLLIMPORT char *SyncRepStandbyNames; + +/* called by user backend */ +extern void SyncRepWaitForLSN(XLogRecPtr lsn, bool commit); + +/* called at backend exit */ +extern void SyncRepCleanupAtProcExit(void); + +/* called by wal sender */ +extern void SyncRepInitConfig(void); +extern void SyncRepReleaseWaiters(void); + +/* called by wal sender and user backend */ +extern int SyncRepGetCandidateStandbys(SyncRepStandbyData **standbys); + +/* called by checkpointer */ +extern void SyncRepUpdateSyncStandbysDefined(void); + +/* + * Internal functions for parsing synchronous_standby_names grammar, + * in syncrep_gram.y and syncrep_scanner.l + */ +union YYSTYPE; +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void *yyscan_t; +#endif +extern int syncrep_yyparse(SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner); +extern int syncrep_yylex(union YYSTYPE *yylval_param, char **syncrep_parse_error_msg_p, yyscan_t yyscanner); +extern void syncrep_yyerror(SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner, const char *str); +extern void syncrep_scanner_init(const char *str, yyscan_t *yyscannerp); +extern void syncrep_scanner_finish(yyscan_t yyscanner); + +#endif /* _SYNCREP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/walreceiver.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/walreceiver.h new file mode 100644 index 0000000..89f63f9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/walreceiver.h @@ -0,0 +1,506 @@ +/*------------------------------------------------------------------------- + * + * walreceiver.h + * Exports from replication/walreceiverfuncs.c. + * + * Portions Copyright (c) 2010-2025, PostgreSQL Global Development Group + * + * src/include/replication/walreceiver.h + * + *------------------------------------------------------------------------- + */ +#ifndef _WALRECEIVER_H +#define _WALRECEIVER_H + +#include + +#include "access/xlog.h" +#include "access/xlogdefs.h" +#include "pgtime.h" +#include "port/atomics.h" +#include "replication/logicalproto.h" +#include "replication/walsender.h" +#include "storage/condition_variable.h" +#include "storage/spin.h" +#include "utils/tuplestore.h" + +/* user-settable parameters */ +extern PGDLLIMPORT int wal_receiver_status_interval; +extern PGDLLIMPORT int wal_receiver_timeout; +extern PGDLLIMPORT bool hot_standby_feedback; + +/* + * MAXCONNINFO: maximum size of a connection string. + * + * XXX: Should this move to pg_config_manual.h? + */ +#define MAXCONNINFO 1024 + +/* Can we allow the standby to accept replication connection from another standby? */ +#define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0) + +/* + * Values for WalRcv->walRcvState. + */ +typedef enum +{ + WALRCV_STOPPED, /* stopped and mustn't start up again */ + WALRCV_STARTING, /* launched, but the process hasn't + * initialized yet */ + WALRCV_STREAMING, /* walreceiver is streaming */ + WALRCV_WAITING, /* stopped streaming, waiting for orders */ + WALRCV_RESTARTING, /* asked to restart streaming */ + WALRCV_STOPPING, /* requested to stop, but still running */ +} WalRcvState; + +/* Shared memory area for management of walreceiver process */ +typedef struct +{ + /* + * Currently active walreceiver process's proc number and PID. + * + * The startup process uses the proc number to wake it up after telling it + * where to start streaming (after setting receiveStart and + * receiveStartTLI), and also to tell it to send apply feedback to the + * primary whenever specially marked commit records are applied. + */ + ProcNumber procno; + pid_t pid; + + /* Its current state */ + WalRcvState walRcvState; + ConditionVariable walRcvStoppedCV; + + /* + * Its start time (actually, the time at which it was requested to be + * started). + */ + pg_time_t startTime; + + /* + * receiveStart and receiveStartTLI indicate the first byte position and + * timeline that will be received. When startup process starts the + * walreceiver, it sets these to the point where it wants the streaming to + * begin. + */ + XLogRecPtr receiveStart; + TimeLineID receiveStartTLI; + + /* + * flushedUpto-1 is the last byte position that has already been received, + * and receivedTLI is the timeline it came from. At the first startup of + * walreceiver, these are set to receiveStart and receiveStartTLI. After + * that, walreceiver updates these whenever it flushes the received WAL to + * disk. + */ + XLogRecPtr flushedUpto; + TimeLineID receivedTLI; + + /* + * latestChunkStart is the starting byte position of the current "batch" + * of received WAL. It's actually the same as the previous value of + * flushedUpto before the last flush to disk. Startup process can use + * this to detect whether it's keeping up or not. + */ + XLogRecPtr latestChunkStart; + + /* + * Time of send and receive of any message received. + */ + TimestampTz lastMsgSendTime; + TimestampTz lastMsgReceiptTime; + + /* + * Latest reported end of WAL on the sender + */ + XLogRecPtr latestWalEnd; + TimestampTz latestWalEndTime; + + /* + * connection string; initially set to connect to the primary, and later + * clobbered to hide security-sensitive fields. + */ + char conninfo[MAXCONNINFO]; + + /* + * Host name (this can be a host name, an IP address, or a directory path) + * and port number of the active replication connection. + */ + char sender_host[NI_MAXHOST]; + int sender_port; + + /* + * replication slot name; is also used for walreceiver to connect with the + * primary + */ + char slotname[NAMEDATALEN]; + + /* + * If it's a temporary replication slot, it needs to be recreated when + * connecting. + */ + bool is_temp_slot; + + /* set true once conninfo is ready to display (obfuscated pwds etc) */ + bool ready_to_display; + + slock_t mutex; /* locks shared variables shown above */ + + /* + * Like flushedUpto, but advanced after writing and before flushing, + * without the need to acquire the spin lock. Data can be read by another + * process up to this point, but shouldn't be used for data integrity + * purposes. + */ + pg_atomic_uint64 writtenUpto; + + /* + * force walreceiver reply? This doesn't need to be locked; memory + * barriers for ordering are sufficient. But we do need atomic fetch and + * store semantics, so use sig_atomic_t. + */ + sig_atomic_t force_reply; /* used as a bool */ +} WalRcvData; + +extern PGDLLIMPORT WalRcvData *WalRcv; + +typedef struct +{ + bool logical; /* True if this is logical replication stream, + * false if physical stream. */ + char *slotname; /* Name of the replication slot or NULL. */ + XLogRecPtr startpoint; /* LSN of starting point. */ + + union + { + struct + { + TimeLineID startpointTLI; /* Starting timeline */ + } physical; + struct + { + uint32 proto_version; /* Logical protocol version */ + List *publication_names; /* String list of publications */ + bool binary; /* Ask publisher to use binary */ + char *streaming_str; /* Streaming of large transactions */ + bool twophase; /* Streaming of two-phase transactions at + * prepare time */ + char *origin; /* Only publish data originating from the + * specified origin */ + } logical; + } proto; +} WalRcvStreamOptions; + +struct WalReceiverConn; +typedef struct WalReceiverConn WalReceiverConn; + +/* + * Status of walreceiver query execution. + * + * We only define statuses that are currently used. + */ +typedef enum +{ + WALRCV_ERROR, /* There was error when executing the query. */ + WALRCV_OK_COMMAND, /* Query executed utility or replication + * command. */ + WALRCV_OK_TUPLES, /* Query returned tuples. */ + WALRCV_OK_COPY_IN, /* Query started COPY FROM. */ + WALRCV_OK_COPY_OUT, /* Query started COPY TO. */ + WALRCV_OK_COPY_BOTH, /* Query started COPY BOTH replication + * protocol. */ +} WalRcvExecStatus; + +/* + * Return value for walrcv_exec, returns the status of the execution and + * tuples if any. + */ +typedef struct WalRcvExecResult +{ + WalRcvExecStatus status; + int sqlstate; + char *err; + Tuplestorestate *tuplestore; + TupleDesc tupledesc; +} WalRcvExecResult; + +/* WAL receiver - libpqwalreceiver hooks */ + +/* + * walrcv_connect_fn + * + * Establish connection to a cluster. 'replication' is true if the + * connection is a replication connection, and false if it is a + * regular connection. If it is a replication connection, it could + * be either logical or physical based on input argument 'logical'. + * 'appname' is a name associated to the connection, to use for example + * with fallback_application_name or application_name. Returns the + * details about the connection established, as defined by + * WalReceiverConn for each WAL receiver module. On error, NULL is + * returned with 'err' including the error generated. + */ +typedef WalReceiverConn *(*walrcv_connect_fn) (const char *conninfo, + bool replication, + bool logical, + bool must_use_password, + const char *appname, + char **err); + +/* + * walrcv_check_conninfo_fn + * + * Parse and validate the connection string given as of 'conninfo'. + */ +typedef void (*walrcv_check_conninfo_fn) (const char *conninfo, + bool must_use_password); + +/* + * walrcv_get_conninfo_fn + * + * Returns a user-displayable conninfo string. Note that any + * security-sensitive fields should be obfuscated. + */ +typedef char *(*walrcv_get_conninfo_fn) (WalReceiverConn *conn); + +/* + * walrcv_get_senderinfo_fn + * + * Provide information of the WAL sender this WAL receiver is connected + * to, as of 'sender_host' for the host of the sender and 'sender_port' + * for its port. + */ +typedef void (*walrcv_get_senderinfo_fn) (WalReceiverConn *conn, + char **sender_host, + int *sender_port); + +/* + * walrcv_identify_system_fn + * + * Run IDENTIFY_SYSTEM on the cluster connected to and validate the + * identity of the cluster. Returns the system ID of the cluster + * connected to. 'primary_tli' is the timeline ID of the sender. + */ +typedef char *(*walrcv_identify_system_fn) (WalReceiverConn *conn, + TimeLineID *primary_tli); + +/* + * walrcv_get_dbname_from_conninfo_fn + * + * Returns the database name from the primary_conninfo + */ +typedef char *(*walrcv_get_dbname_from_conninfo_fn) (const char *conninfo); + +/* + * walrcv_server_version_fn + * + * Returns the version number of the cluster connected to. + */ +typedef int (*walrcv_server_version_fn) (WalReceiverConn *conn); + +/* + * walrcv_readtimelinehistoryfile_fn + * + * Fetch from cluster the timeline history file for timeline 'tli'. + * Returns the name of the timeline history file as of 'filename', its + * contents as of 'content' and its 'size'. + */ +typedef void (*walrcv_readtimelinehistoryfile_fn) (WalReceiverConn *conn, + TimeLineID tli, + char **filename, + char **content, + int *size); + +/* + * walrcv_startstreaming_fn + * + * Start streaming WAL data from given streaming options. Returns true + * if the connection has switched successfully to copy-both mode and false + * if the server received the command and executed it successfully, but + * didn't switch to copy-mode. + */ +typedef bool (*walrcv_startstreaming_fn) (WalReceiverConn *conn, + const WalRcvStreamOptions *options); + +/* + * walrcv_endstreaming_fn + * + * Stop streaming of WAL data. Returns the next timeline ID of the cluster + * connected to in 'next_tli', or 0 if there was no report. + */ +typedef void (*walrcv_endstreaming_fn) (WalReceiverConn *conn, + TimeLineID *next_tli); + +/* + * walrcv_receive_fn + * + * Receive a message available from the WAL stream. 'buffer' is a pointer + * to a buffer holding the message received. Returns the length of the data, + * 0 if no data is available yet ('wait_fd' is a socket descriptor which can + * be waited on before a retry), and -1 if the cluster ended the COPY. + */ +typedef int (*walrcv_receive_fn) (WalReceiverConn *conn, + char **buffer, + pgsocket *wait_fd); + +/* + * walrcv_send_fn + * + * Send a message of size 'nbytes' to the WAL stream with 'buffer' as + * contents. + */ +typedef void (*walrcv_send_fn) (WalReceiverConn *conn, + const char *buffer, + int nbytes); + +/* + * walrcv_create_slot_fn + * + * Create a new replication slot named 'slotname'. 'temporary' defines + * if the slot is temporary. 'snapshot_action' defines the behavior wanted + * for an exported snapshot (see replication protocol for more details). + * 'lsn' includes the LSN position at which the created slot became + * consistent. Returns the name of the exported snapshot for a logical + * slot, or NULL for a physical slot. + */ +typedef char *(*walrcv_create_slot_fn) (WalReceiverConn *conn, + const char *slotname, + bool temporary, + bool two_phase, + bool failover, + CRSSnapshotAction snapshot_action, + XLogRecPtr *lsn); + +/* + * walrcv_alter_slot_fn + * + * Change the definition of a replication slot. Currently, it supports + * changing the failover and two_phase properties of the slot. + */ +typedef void (*walrcv_alter_slot_fn) (WalReceiverConn *conn, + const char *slotname, + const bool *failover, + const bool *two_phase); + + +/* + * walrcv_get_backend_pid_fn + * + * Returns the PID of the remote backend process. + */ +typedef pid_t (*walrcv_get_backend_pid_fn) (WalReceiverConn *conn); + +/* + * walrcv_exec_fn + * + * Send generic queries (and commands) to the remote cluster. 'nRetTypes' + * is the expected number of returned attributes, and 'retTypes' an array + * including their type OIDs. Returns the status of the execution and + * tuples if any. + */ +typedef WalRcvExecResult *(*walrcv_exec_fn) (WalReceiverConn *conn, + const char *query, + const int nRetTypes, + const Oid *retTypes); + +/* + * walrcv_disconnect_fn + * + * Disconnect with the cluster. + */ +typedef void (*walrcv_disconnect_fn) (WalReceiverConn *conn); + +typedef struct WalReceiverFunctionsType +{ + walrcv_connect_fn walrcv_connect; + walrcv_check_conninfo_fn walrcv_check_conninfo; + walrcv_get_conninfo_fn walrcv_get_conninfo; + walrcv_get_senderinfo_fn walrcv_get_senderinfo; + walrcv_identify_system_fn walrcv_identify_system; + walrcv_get_dbname_from_conninfo_fn walrcv_get_dbname_from_conninfo; + walrcv_server_version_fn walrcv_server_version; + walrcv_readtimelinehistoryfile_fn walrcv_readtimelinehistoryfile; + walrcv_startstreaming_fn walrcv_startstreaming; + walrcv_endstreaming_fn walrcv_endstreaming; + walrcv_receive_fn walrcv_receive; + walrcv_send_fn walrcv_send; + walrcv_create_slot_fn walrcv_create_slot; + walrcv_alter_slot_fn walrcv_alter_slot; + walrcv_get_backend_pid_fn walrcv_get_backend_pid; + walrcv_exec_fn walrcv_exec; + walrcv_disconnect_fn walrcv_disconnect; +} WalReceiverFunctionsType; + +extern PGDLLIMPORT WalReceiverFunctionsType *WalReceiverFunctions; + +#define walrcv_connect(conninfo, replication, logical, must_use_password, appname, err) \ + WalReceiverFunctions->walrcv_connect(conninfo, replication, logical, must_use_password, appname, err) +#define walrcv_check_conninfo(conninfo, must_use_password) \ + WalReceiverFunctions->walrcv_check_conninfo(conninfo, must_use_password) +#define walrcv_get_conninfo(conn) \ + WalReceiverFunctions->walrcv_get_conninfo(conn) +#define walrcv_get_senderinfo(conn, sender_host, sender_port) \ + WalReceiverFunctions->walrcv_get_senderinfo(conn, sender_host, sender_port) +#define walrcv_identify_system(conn, primary_tli) \ + WalReceiverFunctions->walrcv_identify_system(conn, primary_tli) +#define walrcv_get_dbname_from_conninfo(conninfo) \ + WalReceiverFunctions->walrcv_get_dbname_from_conninfo(conninfo) +#define walrcv_server_version(conn) \ + WalReceiverFunctions->walrcv_server_version(conn) +#define walrcv_readtimelinehistoryfile(conn, tli, filename, content, size) \ + WalReceiverFunctions->walrcv_readtimelinehistoryfile(conn, tli, filename, content, size) +#define walrcv_startstreaming(conn, options) \ + WalReceiverFunctions->walrcv_startstreaming(conn, options) +#define walrcv_endstreaming(conn, next_tli) \ + WalReceiverFunctions->walrcv_endstreaming(conn, next_tli) +#define walrcv_receive(conn, buffer, wait_fd) \ + WalReceiverFunctions->walrcv_receive(conn, buffer, wait_fd) +#define walrcv_send(conn, buffer, nbytes) \ + WalReceiverFunctions->walrcv_send(conn, buffer, nbytes) +#define walrcv_create_slot(conn, slotname, temporary, two_phase, failover, snapshot_action, lsn) \ + WalReceiverFunctions->walrcv_create_slot(conn, slotname, temporary, two_phase, failover, snapshot_action, lsn) +#define walrcv_alter_slot(conn, slotname, failover, two_phase) \ + WalReceiverFunctions->walrcv_alter_slot(conn, slotname, failover, two_phase) +#define walrcv_get_backend_pid(conn) \ + WalReceiverFunctions->walrcv_get_backend_pid(conn) +#define walrcv_exec(conn, exec, nRetTypes, retTypes) \ + WalReceiverFunctions->walrcv_exec(conn, exec, nRetTypes, retTypes) +#define walrcv_disconnect(conn) \ + WalReceiverFunctions->walrcv_disconnect(conn) + +static inline void +walrcv_clear_result(WalRcvExecResult *walres) +{ + if (!walres) + return; + + if (walres->err) + pfree(walres->err); + + if (walres->tuplestore) + tuplestore_end(walres->tuplestore); + + if (walres->tupledesc) + FreeTupleDesc(walres->tupledesc); + + pfree(walres); +} + +/* prototypes for functions in walreceiver.c */ +pg_noreturn extern void WalReceiverMain(const void *startup_data, size_t startup_data_len); +extern void WalRcvForceReply(void); + +/* prototypes for functions in walreceiverfuncs.c */ +extern Size WalRcvShmemSize(void); +extern void WalRcvShmemInit(void); +extern void ShutdownWalRcv(void); +extern bool WalRcvStreaming(void); +extern bool WalRcvRunning(void); +extern void RequestXLogStreaming(TimeLineID tli, XLogRecPtr recptr, + const char *conninfo, const char *slotname, + bool create_temp_slot); +extern XLogRecPtr GetWalRcvFlushRecPtr(XLogRecPtr *latestChunkStart, TimeLineID *receiveTLI); +extern XLogRecPtr GetWalRcvWriteRecPtr(void); +extern int GetReplicationApplyDelay(void); +extern int GetReplicationTransferLatency(void); + +#endif /* _WALRECEIVER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/walsender.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/walsender.h new file mode 100644 index 0000000..c3e8e19 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/walsender.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * walsender.h + * Exports from replication/walsender.c. + * + * Portions Copyright (c) 2010-2025, PostgreSQL Global Development Group + * + * src/include/replication/walsender.h + * + *------------------------------------------------------------------------- + */ +#ifndef _WALSENDER_H +#define _WALSENDER_H + +#include "access/xlogdefs.h" + +/* + * What to do with a snapshot in create replication slot command. + */ +typedef enum +{ + CRS_EXPORT_SNAPSHOT, + CRS_NOEXPORT_SNAPSHOT, + CRS_USE_SNAPSHOT, +} CRSSnapshotAction; + +/* global state */ +extern PGDLLIMPORT bool am_walsender; +extern PGDLLIMPORT bool am_cascading_walsender; +extern PGDLLIMPORT bool am_db_walsender; +extern PGDLLIMPORT bool wake_wal_senders; + +/* user-settable parameters */ +extern PGDLLIMPORT int max_wal_senders; +extern PGDLLIMPORT int wal_sender_timeout; +extern PGDLLIMPORT bool log_replication_commands; + +extern void InitWalSender(void); +extern bool exec_replication_command(const char *cmd_string); +extern void WalSndErrorCleanup(void); +extern void PhysicalWakeupLogicalWalSnd(void); +extern XLogRecPtr GetStandbyFlushRecPtr(TimeLineID *tli); +extern void WalSndSignals(void); +extern Size WalSndShmemSize(void); +extern void WalSndShmemInit(void); +extern void WalSndWakeup(bool physical, bool logical); +extern void WalSndInitStopping(void); +extern void WalSndWaitStopping(void); +extern void HandleWalSndInitStopping(void); +extern void WalSndRqstFileReload(void); + +/* + * Remember that we want to wakeup walsenders later + * + * This is separated from doing the actual wakeup because the writeout is done + * while holding contended locks. + */ +#define WalSndWakeupRequest() \ + do { wake_wal_senders = true; } while (0) + +/* + * wakeup walsenders if there is work to be done + */ +static inline void +WalSndWakeupProcessRequests(bool physical, bool logical) +{ + if (wake_wal_senders) + { + wake_wal_senders = false; + if (max_wal_senders > 0) + WalSndWakeup(physical, logical); + } +} + +#endif /* _WALSENDER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/walsender_private.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/walsender_private.h new file mode 100644 index 0000000..e987010 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/walsender_private.h @@ -0,0 +1,155 @@ +/*------------------------------------------------------------------------- + * + * walsender_private.h + * Private definitions from replication/walsender.c. + * + * Portions Copyright (c) 2010-2025, PostgreSQL Global Development Group + * + * src/include/replication/walsender_private.h + * + *------------------------------------------------------------------------- + */ +#ifndef _WALSENDER_PRIVATE_H +#define _WALSENDER_PRIVATE_H + +#include "access/xlog.h" +#include "lib/ilist.h" +#include "nodes/nodes.h" +#include "nodes/replnodes.h" +#include "replication/syncrep.h" +#include "storage/condition_variable.h" +#include "storage/shmem.h" +#include "storage/spin.h" + +typedef enum WalSndState +{ + WALSNDSTATE_STARTUP = 0, + WALSNDSTATE_BACKUP, + WALSNDSTATE_CATCHUP, + WALSNDSTATE_STREAMING, + WALSNDSTATE_STOPPING, +} WalSndState; + +/* + * Each walsender has a WalSnd struct in shared memory. + * + * This struct is protected by its 'mutex' spinlock field, except that some + * members are only written by the walsender process itself, and thus that + * process is free to read those members without holding spinlock. pid and + * needreload always require the spinlock to be held for all accesses. + */ +typedef struct WalSnd +{ + pid_t pid; /* this walsender's PID, or 0 if not active */ + + WalSndState state; /* this walsender's state */ + XLogRecPtr sentPtr; /* WAL has been sent up to this point */ + bool needreload; /* does currently-open file need to be + * reloaded? */ + + /* + * The xlog locations that have been written, flushed, and applied by + * standby-side. These may be invalid if the standby-side has not offered + * values yet. + */ + XLogRecPtr write; + XLogRecPtr flush; + XLogRecPtr apply; + + /* Measured lag times, or -1 for unknown/none. */ + TimeOffset writeLag; + TimeOffset flushLag; + TimeOffset applyLag; + + /* + * The priority order of the standby managed by this WALSender, as listed + * in synchronous_standby_names, or 0 if not-listed. + */ + int sync_standby_priority; + + /* Protects shared variables in this structure. */ + slock_t mutex; + + /* + * Timestamp of the last message received from standby. + */ + TimestampTz replyTime; + + ReplicationKind kind; +} WalSnd; + +extern PGDLLIMPORT WalSnd *MyWalSnd; + +/* There is one WalSndCtl struct for the whole database cluster */ +typedef struct +{ + /* + * Synchronous replication queue with one queue per request type. + * Protected by SyncRepLock. + */ + dlist_head SyncRepQueue[NUM_SYNC_REP_WAIT_MODE]; + + /* + * Current location of the head of the queue. All waiters should have a + * waitLSN that follows this value. Protected by SyncRepLock. + */ + XLogRecPtr lsn[NUM_SYNC_REP_WAIT_MODE]; + + /* + * Status of data related to the synchronous standbys. Waiting backends + * can't reload the config file safely, so checkpointer updates this value + * as needed. Protected by SyncRepLock. + */ + bits8 sync_standbys_status; + + /* used as a registry of physical / logical walsenders to wake */ + ConditionVariable wal_flush_cv; + ConditionVariable wal_replay_cv; + + /* + * Used by physical walsenders holding slots specified in + * synchronized_standby_slots to wake up logical walsenders holding + * logical failover slots when a walreceiver confirms the receipt of LSN. + */ + ConditionVariable wal_confirm_rcv_cv; + + WalSnd walsnds[FLEXIBLE_ARRAY_MEMBER]; +} WalSndCtlData; + +/* Flags for WalSndCtlData->sync_standbys_status */ + +/* + * Is the synchronous standby data initialized from the GUC? This is set the + * first time synchronous_standby_names is processed by the checkpointer. + */ +#define SYNC_STANDBY_INIT (1 << 0) + +/* + * Is the synchronous standby data defined? This is set when + * synchronous_standby_names has some data, after being processed by the + * checkpointer. + */ +#define SYNC_STANDBY_DEFINED (1 << 1) + +extern PGDLLIMPORT WalSndCtlData *WalSndCtl; + + +extern void WalSndSetState(WalSndState state); + +/* + * Internal functions for parsing the replication grammar, in repl_gram.y and + * repl_scanner.l + */ +union YYSTYPE; +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void *yyscan_t; +#endif +extern int replication_yyparse(Node **replication_parse_result_p, yyscan_t yyscanner); +extern int replication_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner); +pg_noreturn extern void replication_yyerror(Node **replication_parse_result_p, yyscan_t yyscanner, const char *message); +extern void replication_scanner_init(const char *str, yyscan_t *yyscannerp); +extern void replication_scanner_finish(yyscan_t yyscanner); +extern bool replication_scanner_is_replication_command(yyscan_t yyscanner); + +#endif /* _WALSENDER_PRIVATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/worker_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/worker_internal.h new file mode 100644 index 0000000..30b2775 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/replication/worker_internal.h @@ -0,0 +1,354 @@ +/*------------------------------------------------------------------------- + * + * worker_internal.h + * Internal headers shared by logical replication workers. + * + * Portions Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * src/include/replication/worker_internal.h + * + *------------------------------------------------------------------------- + */ +#ifndef WORKER_INTERNAL_H +#define WORKER_INTERNAL_H + +#include "access/xlogdefs.h" +#include "catalog/pg_subscription.h" +#include "datatype/timestamp.h" +#include "miscadmin.h" +#include "replication/logicalrelation.h" +#include "replication/walreceiver.h" +#include "storage/buffile.h" +#include "storage/fileset.h" +#include "storage/lock.h" +#include "storage/shm_mq.h" +#include "storage/shm_toc.h" +#include "storage/spin.h" + +/* Different types of worker */ +typedef enum LogicalRepWorkerType +{ + WORKERTYPE_UNKNOWN = 0, + WORKERTYPE_TABLESYNC, + WORKERTYPE_APPLY, + WORKERTYPE_PARALLEL_APPLY, +} LogicalRepWorkerType; + +typedef struct LogicalRepWorker +{ + /* What type of worker is this? */ + LogicalRepWorkerType type; + + /* Time at which this worker was launched. */ + TimestampTz launch_time; + + /* Indicates if this slot is used or free. */ + bool in_use; + + /* Increased every time the slot is taken by new worker. */ + uint16 generation; + + /* Pointer to proc array. NULL if not running. */ + PGPROC *proc; + + /* Database id to connect to. */ + Oid dbid; + + /* User to use for connection (will be same as owner of subscription). */ + Oid userid; + + /* Subscription id for the worker. */ + Oid subid; + + /* Used for initial table synchronization. */ + Oid relid; + char relstate; + XLogRecPtr relstate_lsn; + slock_t relmutex; + + /* + * Used to create the changes and subxact files for the streaming + * transactions. Upon the arrival of the first streaming transaction or + * when the first-time leader apply worker times out while sending changes + * to the parallel apply worker, the fileset will be initialized, and it + * will be deleted when the worker exits. Under this, separate buffiles + * would be created for each transaction which will be deleted after the + * transaction is finished. + */ + FileSet *stream_fileset; + + /* + * PID of leader apply worker if this slot is used for a parallel apply + * worker, InvalidPid otherwise. + */ + pid_t leader_pid; + + /* Indicates whether apply can be performed in parallel. */ + bool parallel_apply; + + /* Stats. */ + XLogRecPtr last_lsn; + TimestampTz last_send_time; + TimestampTz last_recv_time; + XLogRecPtr reply_lsn; + TimestampTz reply_time; +} LogicalRepWorker; + +/* + * State of the transaction in parallel apply worker. + * + * The enum values must have the same order as the transaction state + * transitions. + */ +typedef enum ParallelTransState +{ + PARALLEL_TRANS_UNKNOWN, + PARALLEL_TRANS_STARTED, + PARALLEL_TRANS_FINISHED, +} ParallelTransState; + +/* + * State of fileset used to communicate changes from leader to parallel + * apply worker. + * + * FS_EMPTY indicates an initial state where the leader doesn't need to use + * the file to communicate with the parallel apply worker. + * + * FS_SERIALIZE_IN_PROGRESS indicates that the leader is serializing changes + * to the file. + * + * FS_SERIALIZE_DONE indicates that the leader has serialized all changes to + * the file. + * + * FS_READY indicates that it is now ok for a parallel apply worker to + * read the file. + */ +typedef enum PartialFileSetState +{ + FS_EMPTY, + FS_SERIALIZE_IN_PROGRESS, + FS_SERIALIZE_DONE, + FS_READY, +} PartialFileSetState; + +/* + * Struct for sharing information between leader apply worker and parallel + * apply workers. + */ +typedef struct ParallelApplyWorkerShared +{ + slock_t mutex; + + TransactionId xid; + + /* + * State used to ensure commit ordering. + * + * The parallel apply worker will set it to PARALLEL_TRANS_FINISHED after + * handling the transaction finish commands while the apply leader will + * wait for it to become PARALLEL_TRANS_FINISHED before proceeding in + * transaction finish commands (e.g. STREAM_COMMIT/STREAM_PREPARE/ + * STREAM_ABORT). + */ + ParallelTransState xact_state; + + /* Information from the corresponding LogicalRepWorker slot. */ + uint16 logicalrep_worker_generation; + int logicalrep_worker_slot_no; + + /* + * Indicates whether there are pending streaming blocks in the queue. The + * parallel apply worker will check it before starting to wait. + */ + pg_atomic_uint32 pending_stream_count; + + /* + * XactLastCommitEnd from the parallel apply worker. This is required by + * the leader worker so it can update the lsn_mappings. + */ + XLogRecPtr last_commit_end; + + /* + * After entering PARTIAL_SERIALIZE mode, the leader apply worker will + * serialize changes to the file, and share the fileset with the parallel + * apply worker when processing the transaction finish command. Then the + * parallel apply worker will apply all the spooled messages. + * + * FileSet is used here instead of SharedFileSet because we need it to + * survive after releasing the shared memory so that the leader apply + * worker can re-use the same fileset for the next streaming transaction. + */ + PartialFileSetState fileset_state; + FileSet fileset; +} ParallelApplyWorkerShared; + +/* + * Information which is used to manage the parallel apply worker. + */ +typedef struct ParallelApplyWorkerInfo +{ + /* + * This queue is used to send changes from the leader apply worker to the + * parallel apply worker. + */ + shm_mq_handle *mq_handle; + + /* + * This queue is used to transfer error messages from the parallel apply + * worker to the leader apply worker. + */ + shm_mq_handle *error_mq_handle; + + dsm_segment *dsm_seg; + + /* + * Indicates whether the leader apply worker needs to serialize the + * remaining changes to a file due to timeout when attempting to send data + * to the parallel apply worker via shared memory. + */ + bool serialize_changes; + + /* + * True if the worker is being used to process a parallel apply + * transaction. False indicates this worker is available for re-use. + */ + bool in_use; + + ParallelApplyWorkerShared *shared; +} ParallelApplyWorkerInfo; + +/* Main memory context for apply worker. Permanent during worker lifetime. */ +extern PGDLLIMPORT MemoryContext ApplyContext; + +extern PGDLLIMPORT MemoryContext ApplyMessageContext; + +extern PGDLLIMPORT ErrorContextCallback *apply_error_context_stack; + +extern PGDLLIMPORT ParallelApplyWorkerShared *MyParallelShared; + +/* libpqreceiver connection */ +extern PGDLLIMPORT struct WalReceiverConn *LogRepWorkerWalRcvConn; + +/* Worker and subscription objects. */ +extern PGDLLIMPORT Subscription *MySubscription; +extern PGDLLIMPORT LogicalRepWorker *MyLogicalRepWorker; + +extern PGDLLIMPORT bool in_remote_transaction; + +extern PGDLLIMPORT bool InitializingApplyWorker; + +extern void logicalrep_worker_attach(int slot); +extern LogicalRepWorker *logicalrep_worker_find(Oid subid, Oid relid, + bool only_running); +extern List *logicalrep_workers_find(Oid subid, bool only_running, + bool acquire_lock); +extern bool logicalrep_worker_launch(LogicalRepWorkerType wtype, + Oid dbid, Oid subid, const char *subname, + Oid userid, Oid relid, + dsm_handle subworker_dsm); +extern void logicalrep_worker_stop(Oid subid, Oid relid); +extern void logicalrep_pa_worker_stop(ParallelApplyWorkerInfo *winfo); +extern void logicalrep_worker_wakeup(Oid subid, Oid relid); +extern void logicalrep_worker_wakeup_ptr(LogicalRepWorker *worker); + +extern int logicalrep_sync_worker_count(Oid subid); + +extern void ReplicationOriginNameForLogicalRep(Oid suboid, Oid relid, + char *originname, Size szoriginname); + +extern bool AllTablesyncsReady(void); +extern void UpdateTwoPhaseState(Oid suboid, char new_state); + +extern void process_syncing_tables(XLogRecPtr current_lsn); +extern void invalidate_syncing_table_states(Datum arg, int cacheid, + uint32 hashvalue); + +extern void stream_start_internal(TransactionId xid, bool first_segment); +extern void stream_stop_internal(TransactionId xid); + +/* Common streaming function to apply all the spooled messages */ +extern void apply_spooled_messages(FileSet *stream_fileset, TransactionId xid, + XLogRecPtr lsn); + +extern void apply_dispatch(StringInfo s); + +extern void maybe_reread_subscription(void); + +extern void stream_cleanup_files(Oid subid, TransactionId xid); + +extern void set_stream_options(WalRcvStreamOptions *options, + char *slotname, + XLogRecPtr *origin_startpos); + +extern void start_apply(XLogRecPtr origin_startpos); + +extern void InitializeLogRepWorker(void); + +extern void SetupApplyOrSyncWorker(int worker_slot); + +extern void DisableSubscriptionAndExit(void); + +extern void store_flush_position(XLogRecPtr remote_lsn, XLogRecPtr local_lsn); + +/* Function for apply error callback */ +extern void apply_error_callback(void *arg); +extern void set_apply_error_context_origin(char *originname); + +/* Parallel apply worker setup and interactions */ +extern void pa_allocate_worker(TransactionId xid); +extern ParallelApplyWorkerInfo *pa_find_worker(TransactionId xid); +extern void pa_detach_all_error_mq(void); + +extern bool pa_send_data(ParallelApplyWorkerInfo *winfo, Size nbytes, + const void *data); +extern void pa_switch_to_partial_serialize(ParallelApplyWorkerInfo *winfo, + bool stream_locked); + +extern void pa_set_xact_state(ParallelApplyWorkerShared *wshared, + ParallelTransState xact_state); +extern void pa_set_stream_apply_worker(ParallelApplyWorkerInfo *winfo); + +extern void pa_start_subtrans(TransactionId current_xid, + TransactionId top_xid); +extern void pa_reset_subtrans(void); +extern void pa_stream_abort(LogicalRepStreamAbortData *abort_data); +extern void pa_set_fileset_state(ParallelApplyWorkerShared *wshared, + PartialFileSetState fileset_state); + +extern void pa_lock_stream(TransactionId xid, LOCKMODE lockmode); +extern void pa_unlock_stream(TransactionId xid, LOCKMODE lockmode); + +extern void pa_lock_transaction(TransactionId xid, LOCKMODE lockmode); +extern void pa_unlock_transaction(TransactionId xid, LOCKMODE lockmode); + +extern void pa_decr_and_wait_stream_block(void); + +extern void pa_xact_finish(ParallelApplyWorkerInfo *winfo, + XLogRecPtr remote_lsn); + +#define isParallelApplyWorker(worker) ((worker)->in_use && \ + (worker)->type == WORKERTYPE_PARALLEL_APPLY) +#define isTablesyncWorker(worker) ((worker)->in_use && \ + (worker)->type == WORKERTYPE_TABLESYNC) + +static inline bool +am_tablesync_worker(void) +{ + return isTablesyncWorker(MyLogicalRepWorker); +} + +static inline bool +am_leader_apply_worker(void) +{ + Assert(MyLogicalRepWorker->in_use); + return (MyLogicalRepWorker->type == WORKERTYPE_APPLY); +} + +static inline bool +am_parallel_apply_worker(void) +{ + Assert(MyLogicalRepWorker->in_use); + return isParallelApplyWorker(MyLogicalRepWorker); +} + +#endif /* WORKER_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/prs2lock.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/prs2lock.h new file mode 100644 index 0000000..17f468b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/prs2lock.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- + * + * prs2lock.h + * data structures for POSTGRES Rule System II (rewrite rules only) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/prs2lock.h + * + *------------------------------------------------------------------------- + */ +#ifndef PRS2LOCK_H +#define PRS2LOCK_H + +#include "access/attnum.h" +#include "nodes/pg_list.h" + +/* + * RewriteRule - + * holds an info for a rewrite rule + * + */ +typedef struct RewriteRule +{ + Oid ruleId; + CmdType event; + Node *qual; + List *actions; + char enabled; + bool isInstead; +} RewriteRule; + +/* + * RuleLock - + * all rules that apply to a particular relation. Even though we only + * have the rewrite rule system left and these are not really "locks", + * the name is kept for historical reasons. + */ +typedef struct RuleLock +{ + int numLocks; + RewriteRule **rules; +} RuleLock; + +#endif /* PRS2LOCK_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteDefine.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteDefine.h new file mode 100644 index 0000000..63842e0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteDefine.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * rewriteDefine.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteDefine.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITEDEFINE_H +#define REWRITEDEFINE_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" +#include "utils/relcache.h" + +#define RULE_FIRES_ON_ORIGIN 'O' +#define RULE_FIRES_ALWAYS 'A' +#define RULE_FIRES_ON_REPLICA 'R' +#define RULE_DISABLED 'D' + +extern ObjectAddress DefineRule(RuleStmt *stmt, const char *queryString); + +extern ObjectAddress DefineQueryRewrite(const char *rulename, + Oid event_relid, + Node *event_qual, + CmdType event_type, + bool is_instead, + bool replace, + List *action); + +extern ObjectAddress RenameRewriteRule(RangeVar *relation, const char *oldName, + const char *newName); + +extern void setRuleCheckAsUser(Node *node, Oid userid); + +extern void EnableDisableRule(Relation rel, const char *rulename, + char fires_when); + +#endif /* REWRITEDEFINE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteHandler.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteHandler.h new file mode 100644 index 0000000..99cab1a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteHandler.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * rewriteHandler.h + * External interface to query rewriter. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteHandler.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITEHANDLER_H +#define REWRITEHANDLER_H + +#include "nodes/parsenodes.h" +#include "utils/relcache.h" + +extern List *QueryRewrite(Query *parsetree); +extern void AcquireRewriteLocks(Query *parsetree, + bool forExecute, + bool forUpdatePushedDown); + +extern Node *build_column_default(Relation rel, int attrno); + +extern Query *get_view_query(Relation view); +extern bool view_has_instead_trigger(Relation view, CmdType event, + List *mergeActionList); +extern const char *view_query_is_auto_updatable(Query *viewquery, + bool check_cols); +extern int relation_is_updatable(Oid reloid, + List *outer_reloids, + bool include_triggers, + Bitmapset *include_cols); +extern void error_view_not_updatable(Relation view, + CmdType command, + List *mergeActionList, + const char *detail); + +extern Node *expand_generated_columns_in_expr(Node *node, Relation rel, int rt_index); +extern Node *build_generation_expression(Relation rel, int attrno); + +#endif /* REWRITEHANDLER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteManip.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteManip.h new file mode 100644 index 0000000..7c018f2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteManip.h @@ -0,0 +1,122 @@ +/*------------------------------------------------------------------------- + * + * rewriteManip.h + * Querytree manipulation subroutines for query rewriter. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteManip.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITEMANIP_H +#define REWRITEMANIP_H + +#include "nodes/parsenodes.h" +#include "nodes/pathnodes.h" + +struct AttrMap; /* avoid including attmap.h here */ + + +typedef struct replace_rte_variables_context replace_rte_variables_context; + +typedef Node *(*replace_rte_variables_callback) (Var *var, + replace_rte_variables_context *context); + +struct replace_rte_variables_context +{ + replace_rte_variables_callback callback; /* callback function */ + void *callback_arg; /* context data for callback function */ + int target_varno; /* RTE index to search for */ + int sublevels_up; /* (current) nesting depth */ + bool inserted_sublink; /* have we inserted a SubLink? */ +}; + +typedef enum ReplaceVarsNoMatchOption +{ + REPLACEVARS_REPORT_ERROR, /* throw error if no match */ + REPLACEVARS_CHANGE_VARNO, /* change the Var's varno, nothing else */ + REPLACEVARS_SUBSTITUTE_NULL, /* replace with a NULL Const */ +} ReplaceVarsNoMatchOption; + +typedef struct ChangeVarNodes_context ChangeVarNodes_context; + +typedef bool (*ChangeVarNodes_callback) (Node *node, + ChangeVarNodes_context *arg); + +struct ChangeVarNodes_context +{ + int rt_index; + int new_index; + int sublevels_up; + ChangeVarNodes_callback callback; +}; + +extern Relids adjust_relid_set(Relids relids, int oldrelid, int newrelid); +extern void CombineRangeTables(List **dst_rtable, List **dst_perminfos, + List *src_rtable, List *src_perminfos); +extern void OffsetVarNodes(Node *node, int offset, int sublevels_up); +extern void ChangeVarNodes(Node *node, int rt_index, int new_index, + int sublevels_up); +extern void ChangeVarNodesExtended(Node *node, int rt_index, int new_index, + int sublevels_up, + ChangeVarNodes_callback callback); +extern bool ChangeVarNodesWalkExpression(Node *node, + ChangeVarNodes_context *context); +extern void IncrementVarSublevelsUp(Node *node, int delta_sublevels_up, + int min_sublevels_up); +extern void IncrementVarSublevelsUp_rtable(List *rtable, + int delta_sublevels_up, int min_sublevels_up); + +extern bool rangeTableEntry_used(Node *node, int rt_index, + int sublevels_up); + +extern Query *getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr); + +extern void AddQual(Query *parsetree, Node *qual); +extern void AddInvertedQual(Query *parsetree, Node *qual); + +extern bool contain_aggs_of_level(Node *node, int levelsup); +extern int locate_agg_of_level(Node *node, int levelsup); +extern bool contain_windowfuncs(Node *node); +extern int locate_windowfunc(Node *node); +extern bool checkExprHasSubLink(Node *node); + +extern Node *add_nulling_relids(Node *node, + const Bitmapset *target_relids, + const Bitmapset *added_relids); +extern Node *remove_nulling_relids(Node *node, + const Bitmapset *removable_relids, + const Bitmapset *except_relids); + +extern Node *replace_rte_variables(Node *node, + int target_varno, int sublevels_up, + replace_rte_variables_callback callback, + void *callback_arg, + bool *outer_hasSubLinks); +extern Node *replace_rte_variables_mutator(Node *node, + replace_rte_variables_context *context); + +extern Node *map_variable_attnos(Node *node, + int target_varno, int sublevels_up, + const struct AttrMap *attno_map, + Oid to_rowtype, bool *found_whole_row); + +extern Node *ReplaceVarFromTargetList(Var *var, + RangeTblEntry *target_rte, + List *targetlist, + int result_relation, + ReplaceVarsNoMatchOption nomatch_option, + int nomatch_varno); +extern Node *ReplaceVarsFromTargetList(Node *node, + int target_varno, int sublevels_up, + RangeTblEntry *target_rte, + List *targetlist, + int result_relation, + ReplaceVarsNoMatchOption nomatch_option, + int nomatch_varno, + bool *outer_hasSubLinks); + +#endif /* REWRITEMANIP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteRemove.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteRemove.h new file mode 100644 index 0000000..3caa1c4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteRemove.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * rewriteRemove.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteRemove.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITEREMOVE_H +#define REWRITEREMOVE_H + +#include "nodes/parsenodes.h" + +extern void RemoveRewriteRuleById(Oid ruleOid); + +#endif /* REWRITEREMOVE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteSearchCycle.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteSearchCycle.h new file mode 100644 index 0000000..9ed456d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteSearchCycle.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * rewriteSearchCycle.h + * Support for rewriting SEARCH and CYCLE clauses. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteSearchCycle.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITESEARCHCYCLE_H +#define REWRITESEARCHCYCLE_H + +#include "nodes/parsenodes.h" + +extern CommonTableExpr *rewriteSearchAndCycle(CommonTableExpr *cte); + +#endif /* REWRITESEARCHCYCLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteSupport.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteSupport.h new file mode 100644 index 0000000..50f5af2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rewriteSupport.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * rewriteSupport.h + * + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteSupport.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITESUPPORT_H +#define REWRITESUPPORT_H + +/* The ON SELECT rule of a view is always named this: */ +#define ViewSelectRuleName "_RETURN" + +extern bool IsDefinedRewriteRule(Oid owningRel, const char *ruleName); + +extern void SetRelationRuleStatus(Oid relationId, bool relHasRules); + +extern Oid get_rewrite_oid(Oid relid, const char *rulename, bool missing_ok); + +#endif /* REWRITESUPPORT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rowsecurity.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rowsecurity.h new file mode 100644 index 0000000..8f81c40 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/rewrite/rowsecurity.h @@ -0,0 +1,49 @@ +/* ------------------------------------------------------------------------- + * + * rowsecurity.h + * + * prototypes for rewrite/rowsecurity.c and the structures for managing + * the row security policies for relations in relcache. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * ------------------------------------------------------------------------- + */ +#ifndef ROWSECURITY_H +#define ROWSECURITY_H + +#include "nodes/parsenodes.h" +#include "utils/array.h" +#include "utils/relcache.h" + +typedef struct RowSecurityPolicy +{ + char *policy_name; /* Name of the policy */ + char polcmd; /* Type of command policy is for */ + ArrayType *roles; /* Array of roles policy is for */ + bool permissive; /* restrictive or permissive policy */ + Expr *qual; /* Expression to filter rows */ + Expr *with_check_qual; /* Expression to limit rows allowed */ + bool hassublinks; /* If either expression has sublinks */ +} RowSecurityPolicy; + +typedef struct RowSecurityDesc +{ + MemoryContext rscxt; /* row security memory context */ + List *policies; /* list of row security policies */ +} RowSecurityDesc; + +typedef List *(*row_security_policy_hook_type) (CmdType cmdtype, + Relation relation); + +extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_permissive; + +extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_restrictive; + +extern void get_row_security_policies(Query *root, + RangeTblEntry *rte, int rt_index, + List **securityQuals, List **withCheckOptions, + bool *hasRowSecurity, bool *hasSubLinks); + +#endif /* ROWSECURITY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/header.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/header.h new file mode 100644 index 0000000..84dc828 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/header.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * header.h + * Replacement header file for Snowball stemmer modules + * + * The Snowball stemmer modules do #include "header.h", and think they + * are including snowball/libstemmer/header.h. We adjust the CPPFLAGS + * so that this file is found instead, and thereby we can modify the + * headers they see. The main point here is to ensure that pg_config.h + * is included before any system headers such as ; without that, + * we have portability issues on some platforms due to variation in + * largefile options across different modules in the backend. + * + * NOTE: this file should not be included into any non-snowball sources! + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/snowball/header.h + * + *------------------------------------------------------------------------- + */ +#ifndef SNOWBALL_HEADR_H +#define SNOWBALL_HEADR_H + +/* + * It's against Postgres coding conventions to include postgres.h in a + * header file, but we allow the violation here because the alternative is + * to modify the machine-generated .c files provided by the Snowball project. + */ +#include "postgres.h" + +/* Some platforms define MAXINT and/or MININT, causing conflicts */ +#ifdef MAXINT +#undef MAXINT +#endif +#ifdef MININT +#undef MININT +#endif + +/* Now we can include the original Snowball header.h */ +#include "snowball/libstemmer/header.h" + +/* + * Redefine standard memory allocation interface to pgsql's one. + * This allows us to control where the Snowball code allocates stuff. + */ +#ifdef malloc +#undef malloc +#endif +#define malloc(a) palloc(a) + +#ifdef calloc +#undef calloc +#endif +#define calloc(a,b) palloc0((a) * (b)) + +#ifdef realloc +#undef realloc +#endif +#define realloc(a,b) repalloc(a,b) + +#ifdef free +#undef free +#endif +#define free(a) pfree(a) + +#endif /* SNOWBALL_HEADR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/api.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/api.h new file mode 100644 index 0000000..ba9d1c1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/api.h @@ -0,0 +1,32 @@ + +typedef unsigned char symbol; + +/* Or replace 'char' above with 'short' for 16 bit characters. + + More precisely, replace 'char' with whatever type guarantees the + character width you need. Note however that sizeof(symbol) should divide + HEAD, defined in header.h as 2*sizeof(int), without remainder, otherwise + there is an alignment problem. In the unlikely event of a problem here, + consult Martin Porter. + +*/ + +struct SN_env { + symbol * p; + int c; int l; int lb; int bra; int ket; + symbol * * S; + int * I; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * SN_create_env(int S_size, int I_size); +extern void SN_close_env(struct SN_env * z, int S_size); + +extern int SN_set_current(struct SN_env * z, int size, const symbol * s); + +#ifdef __cplusplus +} +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/header.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/header.h new file mode 100644 index 0000000..bf172d5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/header.h @@ -0,0 +1,61 @@ + +#include + +#include "api.h" + +#define MAXINT INT_MAX +#define MININT INT_MIN + +#define HEAD 2*sizeof(int) + +#define SIZE(p) ((int *)(p))[-1] +#define SET_SIZE(p, n) ((int *)(p))[-1] = n +#define CAPACITY(p) ((int *)(p))[-2] + +struct among +{ int s_size; /* number of chars in string */ + const symbol * s; /* search string */ + int substring_i;/* index to longest matching substring */ + int result; /* result of the lookup */ + int (* function)(struct SN_env *); +}; + +extern symbol * create_s(void); +extern void lose_s(symbol * p); + +extern int skip_utf8(const symbol * p, int c, int limit, int n); + +extern int skip_b_utf8(const symbol * p, int c, int limit, int n); + +extern int in_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int in_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); + +extern int in_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int in_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); + +extern int eq_s(struct SN_env * z, int s_size, const symbol * s); +extern int eq_s_b(struct SN_env * z, int s_size, const symbol * s); +extern int eq_v(struct SN_env * z, const symbol * p); +extern int eq_v_b(struct SN_env * z, const symbol * p); + +extern int find_among(struct SN_env * z, const struct among * v, int v_size); +extern int find_among_b(struct SN_env * z, const struct among * v, int v_size); + +extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjustment); +extern int slice_from_s(struct SN_env * z, int s_size, const symbol * s); +extern int slice_from_v(struct SN_env * z, const symbol * p); +extern int slice_del(struct SN_env * z); + +extern int insert_s(struct SN_env * z, int bra, int ket, int s_size, const symbol * s); +extern int insert_v(struct SN_env * z, int bra, int ket, const symbol * p); + +extern symbol * slice_to(struct SN_env * z, symbol * p); +extern symbol * assign_to(struct SN_env * z, symbol * p); + +extern int len_utf8(const symbol * p); + +extern void debug(struct SN_env * z, int number, int line_count); diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_basque.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_basque.h new file mode 100644 index 0000000..bffb6e9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_basque.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * basque_ISO_8859_1_create_env(void); +extern void basque_ISO_8859_1_close_env(struct SN_env * z); + +extern int basque_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_catalan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_catalan.h new file mode 100644 index 0000000..96e97dd --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_catalan.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * catalan_ISO_8859_1_create_env(void); +extern void catalan_ISO_8859_1_close_env(struct SN_env * z); + +extern int catalan_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_danish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_danish.h new file mode 100644 index 0000000..965436d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_danish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * danish_ISO_8859_1_create_env(void); +extern void danish_ISO_8859_1_close_env(struct SN_env * z); + +extern int danish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_dutch.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_dutch.h new file mode 100644 index 0000000..64f1c6d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_dutch.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * dutch_ISO_8859_1_create_env(void); +extern void dutch_ISO_8859_1_close_env(struct SN_env * z); + +extern int dutch_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_english.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_english.h new file mode 100644 index 0000000..ea90984 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_english.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * english_ISO_8859_1_create_env(void); +extern void english_ISO_8859_1_close_env(struct SN_env * z); + +extern int english_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_finnish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_finnish.h new file mode 100644 index 0000000..2c80e4c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_finnish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * finnish_ISO_8859_1_create_env(void); +extern void finnish_ISO_8859_1_close_env(struct SN_env * z); + +extern int finnish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_french.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_french.h new file mode 100644 index 0000000..1febb49 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_french.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * french_ISO_8859_1_create_env(void); +extern void french_ISO_8859_1_close_env(struct SN_env * z); + +extern int french_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_german.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_german.h new file mode 100644 index 0000000..98696bb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_german.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * german_ISO_8859_1_create_env(void); +extern void german_ISO_8859_1_close_env(struct SN_env * z); + +extern int german_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_indonesian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_indonesian.h new file mode 100644 index 0000000..d998b41 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_indonesian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * indonesian_ISO_8859_1_create_env(void); +extern void indonesian_ISO_8859_1_close_env(struct SN_env * z); + +extern int indonesian_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_irish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_irish.h new file mode 100644 index 0000000..d91d231 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_irish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * irish_ISO_8859_1_create_env(void); +extern void irish_ISO_8859_1_close_env(struct SN_env * z); + +extern int irish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_italian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_italian.h new file mode 100644 index 0000000..22950bd --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_italian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * italian_ISO_8859_1_create_env(void); +extern void italian_ISO_8859_1_close_env(struct SN_env * z); + +extern int italian_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_norwegian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_norwegian.h new file mode 100644 index 0000000..5393096 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_norwegian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * norwegian_ISO_8859_1_create_env(void); +extern void norwegian_ISO_8859_1_close_env(struct SN_env * z); + +extern int norwegian_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_porter.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_porter.h new file mode 100644 index 0000000..f504be1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_porter.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * porter_ISO_8859_1_create_env(void); +extern void porter_ISO_8859_1_close_env(struct SN_env * z); + +extern int porter_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_portuguese.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_portuguese.h new file mode 100644 index 0000000..c7b517c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_portuguese.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * portuguese_ISO_8859_1_create_env(void); +extern void portuguese_ISO_8859_1_close_env(struct SN_env * z); + +extern int portuguese_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_spanish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_spanish.h new file mode 100644 index 0000000..b066b4f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_spanish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * spanish_ISO_8859_1_create_env(void); +extern void spanish_ISO_8859_1_close_env(struct SN_env * z); + +extern int spanish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_swedish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_swedish.h new file mode 100644 index 0000000..7b5ec75 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_1_swedish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * swedish_ISO_8859_1_create_env(void); +extern void swedish_ISO_8859_1_close_env(struct SN_env * z); + +extern int swedish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_2_hungarian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_2_hungarian.h new file mode 100644 index 0000000..be6ebf6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_ISO_8859_2_hungarian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * hungarian_ISO_8859_2_create_env(void); +extern void hungarian_ISO_8859_2_close_env(struct SN_env * z); + +extern int hungarian_ISO_8859_2_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_KOI8_R_russian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_KOI8_R_russian.h new file mode 100644 index 0000000..42a8518 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_KOI8_R_russian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * russian_KOI8_R_create_env(void); +extern void russian_KOI8_R_close_env(struct SN_env * z); + +extern int russian_KOI8_R_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_arabic.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_arabic.h new file mode 100644 index 0000000..cad02f3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_arabic.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * arabic_UTF_8_create_env(void); +extern void arabic_UTF_8_close_env(struct SN_env * z); + +extern int arabic_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_armenian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_armenian.h new file mode 100644 index 0000000..793fd09 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_armenian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * armenian_UTF_8_create_env(void); +extern void armenian_UTF_8_close_env(struct SN_env * z); + +extern int armenian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_basque.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_basque.h new file mode 100644 index 0000000..79ddc98 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_basque.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * basque_UTF_8_create_env(void); +extern void basque_UTF_8_close_env(struct SN_env * z); + +extern int basque_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_catalan.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_catalan.h new file mode 100644 index 0000000..58c9995 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_catalan.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * catalan_UTF_8_create_env(void); +extern void catalan_UTF_8_close_env(struct SN_env * z); + +extern int catalan_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_danish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_danish.h new file mode 100644 index 0000000..a5084dc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_danish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * danish_UTF_8_create_env(void); +extern void danish_UTF_8_close_env(struct SN_env * z); + +extern int danish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_dutch.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_dutch.h new file mode 100644 index 0000000..16cb995 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_dutch.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * dutch_UTF_8_create_env(void); +extern void dutch_UTF_8_close_env(struct SN_env * z); + +extern int dutch_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_english.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_english.h new file mode 100644 index 0000000..11fa090 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_english.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * english_UTF_8_create_env(void); +extern void english_UTF_8_close_env(struct SN_env * z); + +extern int english_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_estonian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_estonian.h new file mode 100644 index 0000000..9b9deb1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_estonian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * estonian_UTF_8_create_env(void); +extern void estonian_UTF_8_close_env(struct SN_env * z); + +extern int estonian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_finnish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_finnish.h new file mode 100644 index 0000000..eebaa2d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_finnish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * finnish_UTF_8_create_env(void); +extern void finnish_UTF_8_close_env(struct SN_env * z); + +extern int finnish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_french.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_french.h new file mode 100644 index 0000000..22158b0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_french.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * french_UTF_8_create_env(void); +extern void french_UTF_8_close_env(struct SN_env * z); + +extern int french_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_german.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_german.h new file mode 100644 index 0000000..f276c53 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_german.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * german_UTF_8_create_env(void); +extern void german_UTF_8_close_env(struct SN_env * z); + +extern int german_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_greek.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_greek.h new file mode 100644 index 0000000..77667a3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_greek.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * greek_UTF_8_create_env(void); +extern void greek_UTF_8_close_env(struct SN_env * z); + +extern int greek_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_hindi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_hindi.h new file mode 100644 index 0000000..bbc2e9b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_hindi.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * hindi_UTF_8_create_env(void); +extern void hindi_UTF_8_close_env(struct SN_env * z); + +extern int hindi_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_hungarian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_hungarian.h new file mode 100644 index 0000000..cc29d77 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_hungarian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * hungarian_UTF_8_create_env(void); +extern void hungarian_UTF_8_close_env(struct SN_env * z); + +extern int hungarian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_indonesian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_indonesian.h new file mode 100644 index 0000000..9f51324 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_indonesian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * indonesian_UTF_8_create_env(void); +extern void indonesian_UTF_8_close_env(struct SN_env * z); + +extern int indonesian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_irish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_irish.h new file mode 100644 index 0000000..f06da96 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_irish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * irish_UTF_8_create_env(void); +extern void irish_UTF_8_close_env(struct SN_env * z); + +extern int irish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_italian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_italian.h new file mode 100644 index 0000000..f00dcaa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_italian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * italian_UTF_8_create_env(void); +extern void italian_UTF_8_close_env(struct SN_env * z); + +extern int italian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_lithuanian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_lithuanian.h new file mode 100644 index 0000000..e62ff1c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_lithuanian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * lithuanian_UTF_8_create_env(void); +extern void lithuanian_UTF_8_close_env(struct SN_env * z); + +extern int lithuanian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_nepali.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_nepali.h new file mode 100644 index 0000000..f8f50af --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_nepali.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * nepali_UTF_8_create_env(void); +extern void nepali_UTF_8_close_env(struct SN_env * z); + +extern int nepali_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_norwegian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_norwegian.h new file mode 100644 index 0000000..72aab40 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_norwegian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * norwegian_UTF_8_create_env(void); +extern void norwegian_UTF_8_close_env(struct SN_env * z); + +extern int norwegian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_porter.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_porter.h new file mode 100644 index 0000000..00685b2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_porter.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * porter_UTF_8_create_env(void); +extern void porter_UTF_8_close_env(struct SN_env * z); + +extern int porter_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_portuguese.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_portuguese.h new file mode 100644 index 0000000..7be4335 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_portuguese.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * portuguese_UTF_8_create_env(void); +extern void portuguese_UTF_8_close_env(struct SN_env * z); + +extern int portuguese_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_romanian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_romanian.h new file mode 100644 index 0000000..c93cd33 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_romanian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * romanian_UTF_8_create_env(void); +extern void romanian_UTF_8_close_env(struct SN_env * z); + +extern int romanian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_russian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_russian.h new file mode 100644 index 0000000..ca1d882 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_russian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * russian_UTF_8_create_env(void); +extern void russian_UTF_8_close_env(struct SN_env * z); + +extern int russian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_serbian.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_serbian.h new file mode 100644 index 0000000..1df04f6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_serbian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * serbian_UTF_8_create_env(void); +extern void serbian_UTF_8_close_env(struct SN_env * z); + +extern int serbian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_spanish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_spanish.h new file mode 100644 index 0000000..dfd8dc3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_spanish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * spanish_UTF_8_create_env(void); +extern void spanish_UTF_8_close_env(struct SN_env * z); + +extern int spanish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_swedish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_swedish.h new file mode 100644 index 0000000..ca08a64 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_swedish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * swedish_UTF_8_create_env(void); +extern void swedish_UTF_8_close_env(struct SN_env * z); + +extern int swedish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_tamil.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_tamil.h new file mode 100644 index 0000000..5f5ae35 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_tamil.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * tamil_UTF_8_create_env(void); +extern void tamil_UTF_8_close_env(struct SN_env * z); + +extern int tamil_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_turkish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_turkish.h new file mode 100644 index 0000000..6840592 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_turkish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * turkish_UTF_8_create_env(void); +extern void turkish_UTF_8_close_env(struct SN_env * z); + +extern int turkish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_yiddish.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_yiddish.h new file mode 100644 index 0000000..55b6625 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/snowball/libstemmer/stem_UTF_8_yiddish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * yiddish_UTF_8_create_env(void); +extern void yiddish_UTF_8_close_env(struct SN_env * z); + +extern int yiddish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/statistics/extended_stats_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/statistics/extended_stats_internal.h new file mode 100644 index 0000000..efcb7dc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/statistics/extended_stats_internal.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * extended_stats_internal.h + * POSTGRES extended statistics internal declarations + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/statistics/extended_stats_internal.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXTENDED_STATS_INTERNAL_H +#define EXTENDED_STATS_INTERNAL_H + +#include "statistics/statistics.h" +#include "utils/sortsupport.h" + +typedef struct +{ + Oid eqopr; /* '=' operator for datatype, if any */ + Oid eqfunc; /* and associated function */ + Oid ltopr; /* '<' operator for datatype, if any */ +} StdAnalyzeData; + +typedef struct +{ + Datum value; /* a data value */ + int tupno; /* position index for tuple it came from */ +} ScalarItem; + +/* (de)serialization info */ +typedef struct DimensionInfo +{ + int nvalues; /* number of deduplicated values */ + int nbytes; /* number of bytes (serialized) */ + int nbytes_aligned; /* size of deserialized data with alignment */ + int typlen; /* pg_type.typlen */ + bool typbyval; /* pg_type.typbyval */ +} DimensionInfo; + +/* multi-sort */ +typedef struct MultiSortSupportData +{ + int ndims; /* number of dimensions */ + /* sort support data for each dimension: */ + SortSupportData ssup[FLEXIBLE_ARRAY_MEMBER]; +} MultiSortSupportData; + +typedef MultiSortSupportData *MultiSortSupport; + +typedef struct SortItem +{ + Datum *values; + bool *isnull; + int count; +} SortItem; + +/* a unified representation of the data the statistics is built on */ +typedef struct StatsBuildData +{ + int numrows; + int nattnums; + AttrNumber *attnums; + VacAttrStats **stats; + Datum **values; + bool **nulls; +} StatsBuildData; + + +extern MVNDistinct *statext_ndistinct_build(double totalrows, StatsBuildData *data); +extern bytea *statext_ndistinct_serialize(MVNDistinct *ndistinct); +extern MVNDistinct *statext_ndistinct_deserialize(bytea *data); + +extern MVDependencies *statext_dependencies_build(StatsBuildData *data); +extern bytea *statext_dependencies_serialize(MVDependencies *dependencies); +extern MVDependencies *statext_dependencies_deserialize(bytea *data); + +extern MCVList *statext_mcv_build(StatsBuildData *data, + double totalrows, int stattarget); +extern bytea *statext_mcv_serialize(MCVList *mcvlist, VacAttrStats **stats); +extern MCVList *statext_mcv_deserialize(bytea *data); + +extern MultiSortSupport multi_sort_init(int ndims); +extern void multi_sort_add_dimension(MultiSortSupport mss, int sortdim, + Oid oper, Oid collation); +extern int multi_sort_compare(const void *a, const void *b, void *arg); +extern int multi_sort_compare_dim(int dim, const SortItem *a, + const SortItem *b, MultiSortSupport mss); +extern int multi_sort_compare_dims(int start, int end, const SortItem *a, + const SortItem *b, MultiSortSupport mss); +extern int compare_scalars_simple(const void *a, const void *b, void *arg); +extern int compare_datums_simple(Datum a, Datum b, SortSupport ssup); + +extern AttrNumber *build_attnums_array(Bitmapset *attrs, int nexprs, int *numattrs); + +extern SortItem *build_sorted_items(StatsBuildData *data, int *nitems, + MultiSortSupport mss, + int numattrs, AttrNumber *attnums); + +extern bool examine_opclause_args(List *args, Node **exprp, + Const **cstp, bool *expronleftp); + +extern Selectivity mcv_combine_selectivities(Selectivity simple_sel, + Selectivity mcv_sel, + Selectivity mcv_basesel, + Selectivity mcv_totalsel); + +extern Selectivity mcv_clauselist_selectivity(PlannerInfo *root, + StatisticExtInfo *stat, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + RelOptInfo *rel, + Selectivity *basesel, + Selectivity *totalsel); + +extern Selectivity mcv_clause_selectivity_or(PlannerInfo *root, + StatisticExtInfo *stat, + MCVList *mcv, + Node *clause, + bool **or_matches, + Selectivity *basesel, + Selectivity *overlap_mcvsel, + Selectivity *overlap_basesel, + Selectivity *totalsel); + +#endif /* EXTENDED_STATS_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/statistics/stat_utils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/statistics/stat_utils.h new file mode 100644 index 0000000..4283d2c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/statistics/stat_utils.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * stat_utils.h + * Extended statistics and selectivity estimation functions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/statistics/stat_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef STATS_UTILS_H +#define STATS_UTILS_H + +#include "fmgr.h" + +/* avoid including primnodes.h here */ +struct RangeVar; + +struct StatsArgInfo +{ + const char *argname; + Oid argtype; +}; + +extern void stats_check_required_arg(FunctionCallInfo fcinfo, + struct StatsArgInfo *arginfo, + int argnum); +extern bool stats_check_arg_array(FunctionCallInfo fcinfo, + struct StatsArgInfo *arginfo, int argnum); +extern bool stats_check_arg_pair(FunctionCallInfo fcinfo, + struct StatsArgInfo *arginfo, + int argnum1, int argnum2); + +extern void RangeVarCallbackForStats(const struct RangeVar *relation, + Oid relId, Oid oldRelid, void *arg); + +extern bool stats_fill_fcinfo_from_arg_pairs(FunctionCallInfo pairs_fcinfo, + FunctionCallInfo positional_fcinfo, + struct StatsArgInfo *arginfo); + +#endif /* STATS_UTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/statistics/statistics.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/statistics/statistics.h new file mode 100644 index 0000000..7dd0f97 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/statistics/statistics.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * statistics.h + * Extended statistics and selectivity estimation functions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/statistics/statistics.h + * + *------------------------------------------------------------------------- + */ +#ifndef STATISTICS_H +#define STATISTICS_H + +#include "commands/vacuum.h" +#include "nodes/pathnodes.h" + +#define STATS_MAX_DIMENSIONS 8 /* max number of attributes */ + +/* Multivariate distinct coefficients */ +#define STATS_NDISTINCT_MAGIC 0xA352BFA4 /* struct identifier */ +#define STATS_NDISTINCT_TYPE_BASIC 1 /* struct version */ + +/* MVNDistinctItem represents a single combination of columns */ +typedef struct MVNDistinctItem +{ + double ndistinct; /* ndistinct value for this combination */ + int nattributes; /* number of attributes */ + AttrNumber *attributes; /* attribute numbers */ +} MVNDistinctItem; + +/* A MVNDistinct object, comprising all possible combinations of columns */ +typedef struct MVNDistinct +{ + uint32 magic; /* magic constant marker */ + uint32 type; /* type of ndistinct (BASIC) */ + uint32 nitems; /* number of items in the statistic */ + MVNDistinctItem items[FLEXIBLE_ARRAY_MEMBER]; +} MVNDistinct; + +/* Multivariate functional dependencies */ +#define STATS_DEPS_MAGIC 0xB4549A2C /* marks serialized bytea */ +#define STATS_DEPS_TYPE_BASIC 1 /* basic dependencies type */ + +/* + * Functional dependencies, tracking column-level relationships (values + * in one column determine values in another one). + */ +typedef struct MVDependency +{ + double degree; /* degree of validity (0-1) */ + AttrNumber nattributes; /* number of attributes */ + AttrNumber attributes[FLEXIBLE_ARRAY_MEMBER]; /* attribute numbers */ +} MVDependency; + +typedef struct MVDependencies +{ + uint32 magic; /* magic constant marker */ + uint32 type; /* type of MV Dependencies (BASIC) */ + uint32 ndeps; /* number of dependencies */ + MVDependency *deps[FLEXIBLE_ARRAY_MEMBER]; /* dependencies */ +} MVDependencies; + +/* used to flag stats serialized to bytea */ +#define STATS_MCV_MAGIC 0xE1A651C2 /* marks serialized bytea */ +#define STATS_MCV_TYPE_BASIC 1 /* basic MCV list type */ + +/* max items in MCV list */ +#define STATS_MCVLIST_MAX_ITEMS MAX_STATISTICS_TARGET + +/* + * Multivariate MCV (most-common value) lists + * + * A straightforward extension of MCV items - i.e. a list (array) of + * combinations of attribute values, together with a frequency and null flags. + */ +typedef struct MCVItem +{ + double frequency; /* frequency of this combination */ + double base_frequency; /* frequency if independent */ + bool *isnull; /* NULL flags */ + Datum *values; /* item values */ +} MCVItem; + +/* multivariate MCV list - essentially an array of MCV items */ +typedef struct MCVList +{ + uint32 magic; /* magic constant marker */ + uint32 type; /* type of MCV list (BASIC) */ + uint32 nitems; /* number of MCV items in the array */ + AttrNumber ndimensions; /* number of dimensions */ + Oid types[STATS_MAX_DIMENSIONS]; /* OIDs of data types */ + MCVItem items[FLEXIBLE_ARRAY_MEMBER]; /* array of MCV items */ +} MCVList; + +extern MVNDistinct *statext_ndistinct_load(Oid mvoid, bool inh); +extern MVDependencies *statext_dependencies_load(Oid mvoid, bool inh); +extern MCVList *statext_mcv_load(Oid mvoid, bool inh); + +extern void BuildRelationExtStatistics(Relation onerel, bool inh, double totalrows, + int numrows, HeapTuple *rows, + int natts, VacAttrStats **vacattrstats); +extern int ComputeExtStatisticsRows(Relation onerel, + int natts, VacAttrStats **vacattrstats); +extern bool statext_is_kind_built(HeapTuple htup, char type); +extern Selectivity dependencies_clauselist_selectivity(PlannerInfo *root, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + RelOptInfo *rel, + Bitmapset **estimatedclauses); +extern Selectivity statext_clauselist_selectivity(PlannerInfo *root, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + RelOptInfo *rel, + Bitmapset **estimatedclauses, + bool is_or); +extern bool has_stats_of_kind(List *stats, char requiredkind); +extern StatisticExtInfo *choose_best_statistics(List *stats, char requiredkind, + bool inh, + Bitmapset **clause_attnums, + List **clause_exprs, + int nclauses); +extern HeapTuple statext_expressions_load(Oid stxoid, bool inh, int idx); + +#endif /* STATISTICS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio.h new file mode 100644 index 0000000..2933eea --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio.h @@ -0,0 +1,369 @@ +/*------------------------------------------------------------------------- + * + * aio.h + * Main AIO interface + * + * This is the header to include when actually issuing AIO. When just + * declaring functions involving an AIO related type, it might suffice to + * include aio_types.h. Initialization related functions are in the dedicated + * aio_init.h. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/aio.h + * + *------------------------------------------------------------------------- + */ +#ifndef AIO_H +#define AIO_H + +#include "storage/aio_types.h" +#include "storage/procnumber.h" + + +/* io_uring is incompatible with EXEC_BACKEND */ +#if defined(USE_LIBURING) && !defined(EXEC_BACKEND) +#define IOMETHOD_IO_URING_ENABLED +#endif + + +/* Enum for io_method GUC. */ +typedef enum IoMethod +{ + IOMETHOD_SYNC = 0, + IOMETHOD_WORKER, +#ifdef IOMETHOD_IO_URING_ENABLED + IOMETHOD_IO_URING, +#endif +} IoMethod; + +/* We'll default to worker based execution. */ +#define DEFAULT_IO_METHOD IOMETHOD_WORKER + + +/* + * Flags for an IO that can be set with pgaio_io_set_flag(). + */ +typedef enum PgAioHandleFlags +{ + /* + * The IO references backend local memory. + * + * This needs to be set on an IO whenever the IO references process-local + * memory. Some IO methods do not support executing IO that references + * process local memory and thus need to fall back to executing IO + * synchronously for IOs with this flag set. + * + * Required for correctness. + */ + PGAIO_HF_REFERENCES_LOCAL = 1 << 1, + + /* + * Hint that IO will be executed synchronously. + * + * This can make it a bit cheaper to execute synchronous IO via the AIO + * interface, to avoid needing an AIO and non-AIO version of code. + * + * Advantageous to set, if applicable, but not required for correctness. + */ + PGAIO_HF_SYNCHRONOUS = 1 << 0, + + /* + * IO is using buffered IO, used to control heuristic in some IO methods. + * + * Advantageous to set, if applicable, but not required for correctness. + */ + PGAIO_HF_BUFFERED = 1 << 2, +} PgAioHandleFlags; + +/* + * The IO operations supported by the AIO subsystem. + * + * This could be in aio_internal.h, as it is not publicly referenced, but + * PgAioOpData currently *does* need to be public, therefore keeping this + * public seems to make sense. + */ +typedef enum PgAioOp +{ + /* intentionally the zero value, to help catch zeroed memory etc */ + PGAIO_OP_INVALID = 0, + + PGAIO_OP_READV, + PGAIO_OP_WRITEV, + + /** + * In the near term we'll need at least: + * - fsync / fdatasync + * - flush_range + * + * Eventually we'll additionally want at least: + * - send + * - recv + * - accept + **/ +} PgAioOp; + +#define PGAIO_OP_COUNT (PGAIO_OP_WRITEV + 1) + + +/* + * On what is IO being performed? + * + * PgAioTargetID specific behaviour should be implemented in + * aio_target.c. + */ +typedef enum PgAioTargetID +{ + /* intentionally the zero value, to help catch zeroed memory etc */ + PGAIO_TID_INVALID = 0, + PGAIO_TID_SMGR, +} PgAioTargetID; + +#define PGAIO_TID_COUNT (PGAIO_TID_SMGR + 1) + + +/* + * Data necessary for support IO operations (see PgAioOp). + * + * NB: Note that the FDs in here may *not* be relied upon for re-issuing + * requests (e.g. for partial reads/writes or in an IO worker) - the FD might + * be from another process, or closed since. That's not a problem for staged + * IOs, as all staged IOs are submitted when closing an FD. + */ +typedef union +{ + struct + { + int fd; + uint16 iov_length; + uint64 offset; + } read; + + struct + { + int fd; + uint16 iov_length; + uint64 offset; + } write; +} PgAioOpData; + + +/* + * Information the object that IO is executed on. Mostly callbacks that + * operate on PgAioTargetData. + * + * typedef is in aio_types.h + */ +struct PgAioTargetInfo +{ + /* + * To support executing using worker processes, the file descriptor for an + * IO may need to be reopened in a different process. + */ + void (*reopen) (PgAioHandle *ioh); + + /* describe the target of the IO, used for log messages and views */ + char *(*describe_identity) (const PgAioTargetData *sd); + + /* name of the target, used in log messages / views */ + const char *name; +}; + + +/* + * IDs for callbacks that can be registered on an IO. + * + * Callbacks are identified by an ID rather than a function pointer. There are + * two main reasons: + * + * 1) Memory within PgAioHandle is precious, due to the number of PgAioHandle + * structs in pre-allocated shared memory. + * + * 2) Due to EXEC_BACKEND function pointers are not necessarily stable between + * different backends, therefore function pointers cannot directly be in + * shared memory. + * + * Without 2), we could fairly easily allow to add new callbacks, by filling a + * ID->pointer mapping table on demand. In the presence of 2 that's still + * doable, but harder, because every process has to re-register the pointers + * so that a local ID->"backend local pointer" mapping can be maintained. + */ +typedef enum PgAioHandleCallbackID +{ + PGAIO_HCB_INVALID = 0, + + PGAIO_HCB_MD_READV, + + PGAIO_HCB_SHARED_BUFFER_READV, + + PGAIO_HCB_LOCAL_BUFFER_READV, +} PgAioHandleCallbackID; + +#define PGAIO_HCB_MAX PGAIO_HCB_LOCAL_BUFFER_READV +StaticAssertDecl(PGAIO_HCB_MAX < (1 << PGAIO_RESULT_ID_BITS), + "PGAIO_HCB_MAX is too big for PGAIO_RESULT_ID_BITS"); + + +typedef void (*PgAioHandleCallbackStage) (PgAioHandle *ioh, uint8 cb_flags); +typedef PgAioResult (*PgAioHandleCallbackComplete) (PgAioHandle *ioh, PgAioResult prior_result, uint8 cb_flags); +typedef void (*PgAioHandleCallbackReport) (PgAioResult result, const PgAioTargetData *target_data, int elevel); + +/* typedef is in aio_types.h */ +struct PgAioHandleCallbacks +{ + /* + * Prepare resources affected by the IO for execution. This could e.g. + * include moving ownership of buffer pins to the AIO subsystem. + */ + PgAioHandleCallbackStage stage; + + /* + * Update the state of resources affected by the IO to reflect completion + * of the IO. This could e.g. include updating shared buffer state to + * signal the IO has finished. + * + * The _shared suffix indicates that this is executed by the backend that + * completed the IO, which may or may not be the backend that issued the + * IO. Obviously the callback thus can only modify resources in shared + * memory. + * + * The latest registered callback is called first. This allows + * higher-level code to register callbacks that can rely on callbacks + * registered by lower-level code to already have been executed. + * + * NB: This is called in a critical section. Errors can be signalled by + * the callback's return value, it's the responsibility of the IO's issuer + * to react appropriately. + */ + PgAioHandleCallbackComplete complete_shared; + + /* + * Like complete_shared, except called in the issuing backend. + * + * This variant of the completion callback is useful when backend-local + * state has to be updated to reflect the IO's completion. E.g. a + * temporary buffer's BufferDesc isn't accessible in complete_shared. + * + * Local callbacks are only called after complete_shared for all + * registered callbacks has been called. + */ + PgAioHandleCallbackComplete complete_local; + + /* + * Report the result of an IO operation. This is e.g. used to raise an + * error after an IO failed at the appropriate time (i.e. not when the IO + * failed, but under control of the code that issued the IO). + */ + PgAioHandleCallbackReport report; +}; + + + +/* + * How many callbacks can be registered for one IO handle. Currently we only + * need two, but it's not hard to imagine needing a few more. + */ +#define PGAIO_HANDLE_MAX_CALLBACKS 4 + + + +/* -------------------------------------------------------------------------------- + * IO Handles + * -------------------------------------------------------------------------------- + */ + +/* functions in aio.c */ +struct ResourceOwnerData; +extern PgAioHandle *pgaio_io_acquire(struct ResourceOwnerData *resowner, PgAioReturn *ret); +extern PgAioHandle *pgaio_io_acquire_nb(struct ResourceOwnerData *resowner, PgAioReturn *ret); + +extern void pgaio_io_release(PgAioHandle *ioh); +struct dlist_node; +extern void pgaio_io_release_resowner(struct dlist_node *ioh_node, bool on_error); + +extern void pgaio_io_set_flag(PgAioHandle *ioh, PgAioHandleFlags flag); + +extern int pgaio_io_get_id(PgAioHandle *ioh); +extern ProcNumber pgaio_io_get_owner(PgAioHandle *ioh); + +extern void pgaio_io_get_wref(PgAioHandle *ioh, PgAioWaitRef *iow); + +/* functions in aio_io.c */ +struct iovec; +extern int pgaio_io_get_iovec(PgAioHandle *ioh, struct iovec **iov); + +extern PgAioOp pgaio_io_get_op(PgAioHandle *ioh); +extern PgAioOpData *pgaio_io_get_op_data(PgAioHandle *ioh); + +extern void pgaio_io_start_readv(PgAioHandle *ioh, + int fd, int iovcnt, uint64 offset); +extern void pgaio_io_start_writev(PgAioHandle *ioh, + int fd, int iovcnt, uint64 offset); + +/* functions in aio_target.c */ +extern void pgaio_io_set_target(PgAioHandle *ioh, PgAioTargetID targetid); +extern bool pgaio_io_has_target(PgAioHandle *ioh); +extern PgAioTargetData *pgaio_io_get_target_data(PgAioHandle *ioh); +extern char *pgaio_io_get_target_description(PgAioHandle *ioh); + +/* functions in aio_callback.c */ +extern void pgaio_io_register_callbacks(PgAioHandle *ioh, PgAioHandleCallbackID cb_id, + uint8 cb_data); +extern void pgaio_io_set_handle_data_64(PgAioHandle *ioh, uint64 *data, uint8 len); +extern void pgaio_io_set_handle_data_32(PgAioHandle *ioh, uint32 *data, uint8 len); +extern uint64 *pgaio_io_get_handle_data(PgAioHandle *ioh, uint8 *len); + + + +/* -------------------------------------------------------------------------------- + * IO Wait References + * -------------------------------------------------------------------------------- + */ + +extern void pgaio_wref_clear(PgAioWaitRef *iow); +extern bool pgaio_wref_valid(PgAioWaitRef *iow); +extern int pgaio_wref_get_id(PgAioWaitRef *iow); + +extern void pgaio_wref_wait(PgAioWaitRef *iow); +extern bool pgaio_wref_check_done(PgAioWaitRef *iow); + + + +/* -------------------------------------------------------------------------------- + * IO Result + * -------------------------------------------------------------------------------- + */ + +extern void pgaio_result_report(PgAioResult result, const PgAioTargetData *target_data, + int elevel); + + + +/* -------------------------------------------------------------------------------- + * Actions on multiple IOs. + * -------------------------------------------------------------------------------- + */ + +extern void pgaio_enter_batchmode(void); +extern void pgaio_exit_batchmode(void); +extern void pgaio_submit_staged(void); +extern bool pgaio_have_staged(void); + + + +/* -------------------------------------------------------------------------------- + * Other + * -------------------------------------------------------------------------------- + */ + +extern void pgaio_closing_fd(int fd); + + + +/* GUCs */ +extern PGDLLIMPORT int io_method; +extern PGDLLIMPORT int io_max_concurrency; + + +#endif /* AIO_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio_internal.h new file mode 100644 index 0000000..b4de30f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio_internal.h @@ -0,0 +1,416 @@ +/*------------------------------------------------------------------------- + * + * aio_internal.h + * AIO related declarations that should only be used by the AIO subsystem + * internally. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/aio_internal.h + * + *------------------------------------------------------------------------- + */ +#ifndef AIO_INTERNAL_H +#define AIO_INTERNAL_H + + +#include "lib/ilist.h" +#include "port/pg_iovec.h" +#include "storage/aio.h" +#include "storage/condition_variable.h" + + +/* + * The maximum number of IOs that can be batch submitted at once. + */ +#define PGAIO_SUBMIT_BATCH_SIZE 32 + + + +/* + * State machine for handles. With some exceptions, noted below, handles move + * linearly through all states. + * + * State changes should all go through pgaio_io_update_state(). + * + * Note that the externally visible functions to start IO + * (e.g. FileStartReadV(), via pgaio_io_start_readv()) move an IO from + * PGAIO_HS_HANDED_OUT to at least PGAIO_HS_STAGED and at most + * PGAIO_HS_COMPLETED_LOCAL (at which point the handle will be reused). + */ +typedef enum PgAioHandleState +{ + /* not in use */ + PGAIO_HS_IDLE = 0, + + /* + * Returned by pgaio_io_acquire(). The next state is either DEFINED (if + * pgaio_io_start_*() is called), or IDLE (if pgaio_io_release() is + * called). + */ + PGAIO_HS_HANDED_OUT, + + /* + * pgaio_io_start_*() has been called, but IO is not yet staged. At this + * point the handle has all the information for the IO to be executed. + */ + PGAIO_HS_DEFINED, + + /* + * stage() callbacks have been called, handle ready to be submitted for + * execution. Unless in batchmode (see c.f. pgaio_enter_batchmode()), the + * IO will be submitted immediately after. + */ + PGAIO_HS_STAGED, + + /* IO has been submitted to the IO method for execution */ + PGAIO_HS_SUBMITTED, + + /* IO finished, but result has not yet been processed */ + PGAIO_HS_COMPLETED_IO, + + /* + * IO completed, shared completion has been called. + * + * If the IO completion occurs in the issuing backend, local callbacks + * will immediately be called. Otherwise the handle stays in + * COMPLETED_SHARED until the issuing backend waits for the completion of + * the IO. + */ + PGAIO_HS_COMPLETED_SHARED, + + /* + * IO completed, local completion has been called. + * + * After this the handle will be made reusable and go into IDLE state. + */ + PGAIO_HS_COMPLETED_LOCAL, +} PgAioHandleState; + + +struct ResourceOwnerData; + +/* + * Typedef is in aio_types.h + * + * We don't use the underlying enums for state, target and op to avoid wasting + * space. We tried using bitfields, but several compilers generate rather + * horrid code for that. + */ +struct PgAioHandle +{ + /* all state updates should go through pgaio_io_update_state() */ + uint8 state; + + /* what are we operating on */ + uint8 target; + + /* which IO operation */ + uint8 op; + + /* bitfield of PgAioHandleFlags */ + uint8 flags; + + uint8 num_callbacks; + + /* using the proper type here would use more space */ + uint8 callbacks[PGAIO_HANDLE_MAX_CALLBACKS]; + + /* data forwarded to each callback */ + uint8 callbacks_data[PGAIO_HANDLE_MAX_CALLBACKS]; + + /* + * Length of data associated with handle using + * pgaio_io_set_handle_data_*(). + */ + uint8 handle_data_len; + + /* XXX: could be optimized out with some pointer math */ + int32 owner_procno; + + /* raw result of the IO operation */ + int32 result; + + /** + * In which list the handle is registered, depends on the state: + * - IDLE, in per-backend list + * - HANDED_OUT - not in a list + * - DEFINED - not in a list + * - STAGED - in per-backend staged array + * - SUBMITTED - in issuer's in_flight list + * - COMPLETED_IO - in issuer's in_flight list + * - COMPLETED_SHARED - in issuer's in_flight list + **/ + dlist_node node; + + struct ResourceOwnerData *resowner; + dlist_node resowner_node; + + /* incremented every time the IO handle is reused */ + uint64 generation; + + /* + * To wait for the IO to complete other backends can wait on this CV. Note + * that, if in SUBMITTED state, a waiter first needs to check if it needs + * to do work via IoMethodOps->wait_one(). + */ + ConditionVariable cv; + + /* result of shared callback, passed to issuer callback */ + PgAioResult distilled_result; + + /* + * Index into PgAioCtl->iovecs and PgAioCtl->handle_data. + * + * At the moment there's no need to differentiate between the two, but + * that won't necessarily stay that way. + */ + uint32 iovec_off; + + /* + * If not NULL, this memory location will be updated with information + * about the IOs completion iff the issuing backend learns about the IOs + * completion. + */ + PgAioReturn *report_return; + + /* Data necessary for the IO to be performed */ + PgAioOpData op_data; + + /* + * Data necessary to identify the object undergoing IO to higher-level + * code. Needs to be sufficient to allow another backend to reopen the + * file. + */ + PgAioTargetData target_data; +}; + + +typedef struct PgAioBackend +{ + /* index into PgAioCtl->io_handles */ + uint32 io_handle_off; + + /* IO Handles that currently are not used */ + dclist_head idle_ios; + + /* + * Only one IO may be returned by pgaio_io_acquire()/pgaio_io_acquire_nb() + * without having been either defined (by actually associating it with IO) + * or released (with pgaio_io_release()). This restriction is necessary to + * guarantee that we always can acquire an IO. ->handed_out_io is used to + * enforce that rule. + */ + PgAioHandle *handed_out_io; + + /* Are we currently in batchmode? See pgaio_enter_batchmode(). */ + bool in_batchmode; + + /* + * IOs that are defined, but not yet submitted. + */ + uint16 num_staged_ios; + PgAioHandle *staged_ios[PGAIO_SUBMIT_BATCH_SIZE]; + + /* + * List of in-flight IOs. Also contains IOs that aren't strictly speaking + * in-flight anymore, but have been waited-for and completed by another + * backend. Once this backend sees such an IO it'll be reclaimed. + * + * The list is ordered by submission time, with more recently submitted + * IOs being appended at the end. + */ + dclist_head in_flight_ios; +} PgAioBackend; + + +typedef struct PgAioCtl +{ + int backend_state_count; + PgAioBackend *backend_state; + + /* + * Array of iovec structs. Each iovec is owned by a specific backend. The + * allocation is in PgAioCtl to allow the maximum number of iovecs for + * individual IOs to be configurable with PGC_POSTMASTER GUC. + */ + uint32 iovec_count; + struct iovec *iovecs; + + /* + * For, e.g., an IO covering multiple buffers in shared / temp buffers, we + * need to get Buffer IDs during completion to be able to change the + * BufferDesc state accordingly. This space can be used to store e.g. + * Buffer IDs. Note that the actual iovec might be shorter than this, + * because we combine neighboring pages into one larger iovec entry. + */ + uint64 *handle_data; + + uint32 io_handle_count; + PgAioHandle *io_handles; +} PgAioCtl; + + + +/* + * Callbacks used to implement an IO method. + */ +typedef struct IoMethodOps +{ + /* properties */ + + /* + * If an FD is about to be closed, do we need to wait for all in-flight + * IOs referencing that FD? + */ + bool wait_on_fd_before_close; + + + /* global initialization */ + + /* + * Amount of additional shared memory to reserve for the io_method. Called + * just like a normal ipci.c style *Size() function. Optional. + */ + size_t (*shmem_size) (void); + + /* + * Initialize shared memory. First time is true if AIO's shared memory was + * just initialized, false otherwise. Optional. + */ + void (*shmem_init) (bool first_time); + + /* + * Per-backend initialization. Optional. + */ + void (*init_backend) (void); + + + /* handling of IOs */ + + /* optional */ + bool (*needs_synchronous_execution) (PgAioHandle *ioh); + + /* + * Start executing passed in IOs. + * + * Shall advance state to at least PGAIO_HS_SUBMITTED. (By the time this + * returns, other backends might have advanced the state further.) + * + * Will not be called if ->needs_synchronous_execution() returned true. + * + * num_staged_ios is <= PGAIO_SUBMIT_BATCH_SIZE. + * + * Always called in a critical section. + */ + int (*submit) (uint16 num_staged_ios, PgAioHandle **staged_ios); + + /* --- + * Wait for the IO to complete. Optional. + * + * On return, state shall be on of + * - PGAIO_HS_COMPLETED_IO + * - PGAIO_HS_COMPLETED_SHARED + * - PGAIO_HS_COMPLETED_LOCAL + * + * The callback must not block if the handle is already in one of those + * states, or has been reused (see pgaio_io_was_recycled()). If, on + * return, the state is PGAIO_HS_COMPLETED_IO, state will reach + * PGAIO_HS_COMPLETED_SHARED without further intervention by the IO + * method. + * + * If not provided, it needs to be guaranteed that the IO method calls + * pgaio_io_process_completion() without further interaction by the + * issuing backend. + * --- + */ + void (*wait_one) (PgAioHandle *ioh, + uint64 ref_generation); +} IoMethodOps; + + +/* aio.c */ +extern bool pgaio_io_was_recycled(PgAioHandle *ioh, uint64 ref_generation, PgAioHandleState *state); +extern void pgaio_io_stage(PgAioHandle *ioh, PgAioOp op); +extern void pgaio_io_process_completion(PgAioHandle *ioh, int result); +extern void pgaio_io_prepare_submit(PgAioHandle *ioh); +extern bool pgaio_io_needs_synchronous_execution(PgAioHandle *ioh); +extern const char *pgaio_io_get_state_name(PgAioHandle *ioh); +const char *pgaio_result_status_string(PgAioResultStatus rs); +extern void pgaio_shutdown(int code, Datum arg); + +/* aio_callback.c */ +extern void pgaio_io_call_stage(PgAioHandle *ioh); +extern void pgaio_io_call_complete_shared(PgAioHandle *ioh); +extern PgAioResult pgaio_io_call_complete_local(PgAioHandle *ioh); + +/* aio_io.c */ +extern void pgaio_io_perform_synchronously(PgAioHandle *ioh); +extern const char *pgaio_io_get_op_name(PgAioHandle *ioh); +extern bool pgaio_io_uses_fd(PgAioHandle *ioh, int fd); +extern int pgaio_io_get_iovec_length(PgAioHandle *ioh, struct iovec **iov); + +/* aio_target.c */ +extern bool pgaio_io_can_reopen(PgAioHandle *ioh); +extern void pgaio_io_reopen(PgAioHandle *ioh); +extern const char *pgaio_io_get_target_name(PgAioHandle *ioh); + + +/* + * The AIO subsystem has fairly verbose debug logging support. This can be + * enabled/disabled at build time. The reason for this is that + * a) the verbosity can make debugging things on higher levels hard + * b) even if logging can be skipped due to elevel checks, it still causes a + * measurable slowdown + * + * XXX: This likely should be eventually be disabled by default, at least in + * non-assert builds. + */ +#define PGAIO_VERBOSE 1 + +/* + * Simple ereport() wrapper that only logs if PGAIO_VERBOSE is defined. + * + * This intentionally still compiles the code, guarded by a constant if (0), + * if verbose logging is disabled, to make it less likely that debug logging + * is silently broken. + * + * The current definition requires passing at least one argument. + */ +#define pgaio_debug(elevel, msg, ...) \ + do { \ + if (PGAIO_VERBOSE) \ + ereport(elevel, \ + errhidestmt(true), errhidecontext(true), \ + errmsg_internal(msg, \ + __VA_ARGS__)); \ + } while(0) + +/* + * Simple ereport() wrapper. Note that the definition requires passing at + * least one argument. + */ +#define pgaio_debug_io(elevel, ioh, msg, ...) \ + pgaio_debug(elevel, "io %-10d|op %-5s|target %-4s|state %-16s: " msg, \ + pgaio_io_get_id(ioh), \ + pgaio_io_get_op_name(ioh), \ + pgaio_io_get_target_name(ioh), \ + pgaio_io_get_state_name(ioh), \ + __VA_ARGS__) + +/* Declarations for the tables of function pointers exposed by each IO method. */ +extern PGDLLIMPORT const IoMethodOps pgaio_sync_ops; +extern PGDLLIMPORT const IoMethodOps pgaio_worker_ops; +#ifdef IOMETHOD_IO_URING_ENABLED +extern PGDLLIMPORT const IoMethodOps pgaio_uring_ops; +#endif + +extern PGDLLIMPORT const IoMethodOps *pgaio_method_ops; +extern PGDLLIMPORT PgAioCtl *pgaio_ctl; +extern PGDLLIMPORT PgAioBackend *pgaio_my_backend; + + + +#endif /* AIO_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio_subsys.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio_subsys.h new file mode 100644 index 0000000..0cf36bb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio_subsys.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * aio_subsys.h + * Interaction with AIO as a subsystem, rather than actually issuing AIO + * + * This header is for AIO related functionality that's being called by files + * that don't perform AIO, but interact with the AIO subsystem in some + * form. E.g. postmaster.c and shared memory initialization need to initialize + * AIO but don't perform AIO. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/aio_subsys.h + * + *------------------------------------------------------------------------- + */ +#ifndef AIO_SUBSYS_H +#define AIO_SUBSYS_H + + +/* aio_init.c */ +extern Size AioShmemSize(void); +extern void AioShmemInit(void); + +extern void pgaio_init_backend(void); + + +/* aio.c */ +extern void pgaio_error_cleanup(void); +extern void AtEOXact_Aio(bool is_commit); + + +/* method_worker.c */ +extern bool pgaio_workers_enabled(void); + +#endif /* AIO_SUBSYS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio_types.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio_types.h new file mode 100644 index 0000000..afee85c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/aio_types.h @@ -0,0 +1,137 @@ +/*------------------------------------------------------------------------- + * + * aio_types.h + * AIO related types that are useful to include separately, to reduce the + * "include burden". + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/aio_types.h + * + *------------------------------------------------------------------------- + */ +#ifndef AIO_TYPES_H +#define AIO_TYPES_H + +#include "storage/block.h" +#include "storage/relfilelocator.h" + + +typedef struct PgAioHandle PgAioHandle; +typedef struct PgAioHandleCallbacks PgAioHandleCallbacks; +typedef struct PgAioTargetInfo PgAioTargetInfo; + +/* + * A reference to an IO that can be used to wait for the IO (using + * pgaio_wref_wait()) to complete. + * + * These can be passed across process boundaries. + */ +typedef struct PgAioWaitRef +{ + /* internal ID identifying the specific PgAioHandle */ + uint32 aio_index; + + /* + * IO handles are reused. To detect if a handle was reused, and thereby + * avoid unnecessarily waiting for a newer IO, each time the handle is + * reused a generation number is increased. + * + * To avoid requiring alignment sufficient for an int64, split the + * generation into two. + */ + uint32 generation_upper; + uint32 generation_lower; +} PgAioWaitRef; + + +/* + * Information identifying what the IO is being performed on. + * + * This needs sufficient information to + * + * a) Reopen the file for the IO if the IO is executed in a context that + * cannot use the FD provided initially (e.g. because the IO is executed in + * a worker process). + * + * b) Describe the object the IO is performed on in log / error messages. + */ +typedef union PgAioTargetData +{ + struct + { + RelFileLocator rlocator; /* physical relation identifier */ + BlockNumber blockNum; /* blknum relative to begin of reln */ + BlockNumber nblocks; + ForkNumber forkNum:8; /* don't waste 4 byte for four values */ + bool is_temp:1; /* proc can be inferred by owning AIO */ + bool skip_fsync:1; + } smgr; +} PgAioTargetData; + + +/* + * The status of an AIO operation. + */ +typedef enum PgAioResultStatus +{ + PGAIO_RS_UNKNOWN, /* not yet completed / uninitialized */ + PGAIO_RS_OK, + PGAIO_RS_PARTIAL, /* did not fully succeed, no warning/error */ + PGAIO_RS_WARNING, /* [partially] succeeded, with a warning */ + PGAIO_RS_ERROR, /* failed entirely */ +} PgAioResultStatus; + + +/* + * Result of IO operation, visible only to the initiator of IO. + * + * We need to be careful about the size of PgAioResult, as it is embedded in + * every PgAioHandle, as well as every PgAioReturn. Currently we assume we can + * fit it into one 8 byte value, restricting the space for per-callback error + * data to PGAIO_RESULT_ERROR_BITS. + */ +#define PGAIO_RESULT_ID_BITS 6 +#define PGAIO_RESULT_STATUS_BITS 3 +#define PGAIO_RESULT_ERROR_BITS 23 +typedef struct PgAioResult +{ + /* + * This is of type PgAioHandleCallbackID, but can't use a bitfield of an + * enum, because some compilers treat enums as signed. + */ + uint32 id:PGAIO_RESULT_ID_BITS; + + /* of type PgAioResultStatus, see above */ + uint32 status:PGAIO_RESULT_STATUS_BITS; + + /* meaning defined by callback->report */ + uint32 error_data:PGAIO_RESULT_ERROR_BITS; + + int32 result; +} PgAioResult; + + +StaticAssertDecl(PGAIO_RESULT_ID_BITS + + PGAIO_RESULT_STATUS_BITS + + PGAIO_RESULT_ERROR_BITS == 32, + "PgAioResult bits divided up incorrectly"); +StaticAssertDecl(sizeof(PgAioResult) == 8, + "PgAioResult has unexpected size"); + +/* + * Combination of PgAioResult with minimal metadata about the IO. + * + * Contains sufficient information to be able, in case the IO [partially] + * fails, to log/raise an error under control of the IO issuing code. + */ +typedef struct PgAioReturn +{ + PgAioResult result; + PgAioTargetData target_data; +} PgAioReturn; + + +#endif /* AIO_TYPES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/barrier.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/barrier.h new file mode 100644 index 0000000..4d8a95f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/barrier.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- + * + * barrier.h + * Barriers for synchronizing cooperating processes. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/barrier.h + * + *------------------------------------------------------------------------- + */ +#ifndef BARRIER_H +#define BARRIER_H + +/* + * For the header previously known as "barrier.h", please include + * "port/atomics.h", which deals with atomics, compiler barriers and memory + * barriers. + */ + +#include "storage/condition_variable.h" +#include "storage/spin.h" + +typedef struct Barrier +{ + slock_t mutex; + int phase; /* phase counter */ + int participants; /* the number of participants attached */ + int arrived; /* the number of participants that have + * arrived */ + int elected; /* highest phase elected */ + bool static_party; /* used only for assertions */ + ConditionVariable condition_variable; +} Barrier; + +extern void BarrierInit(Barrier *barrier, int participants); +extern bool BarrierArriveAndWait(Barrier *barrier, uint32 wait_event_info); +extern bool BarrierArriveAndDetach(Barrier *barrier); +extern bool BarrierArriveAndDetachExceptLast(Barrier *barrier); +extern int BarrierAttach(Barrier *barrier); +extern bool BarrierDetach(Barrier *barrier); +extern int BarrierPhase(Barrier *barrier); +extern int BarrierParticipants(Barrier *barrier); + +#endif /* BARRIER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/block.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/block.h new file mode 100644 index 0000000..cee5fcf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/block.h @@ -0,0 +1,108 @@ +/*------------------------------------------------------------------------- + * + * block.h + * POSTGRES disk block definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/block.h + * + *------------------------------------------------------------------------- + */ +#ifndef BLOCK_H +#define BLOCK_H + +/* + * BlockNumber: + * + * each data file (heap or index) is divided into postgres disk blocks + * (which may be thought of as the unit of i/o -- a postgres buffer + * contains exactly one disk block). the blocks are numbered + * sequentially, 0 to 0xFFFFFFFE. + * + * InvalidBlockNumber is the same thing as P_NEW in bufmgr.h. + * + * the access methods, the buffer manager and the storage manager are + * more or less the only pieces of code that should be accessing disk + * blocks directly. + */ +typedef uint32 BlockNumber; + +#define InvalidBlockNumber ((BlockNumber) 0xFFFFFFFF) + +#define MaxBlockNumber ((BlockNumber) 0xFFFFFFFE) + +/* + * BlockId: + * + * this is a storage type for BlockNumber. in other words, this type + * is used for on-disk structures (e.g., in HeapTupleData) whereas + * BlockNumber is the type on which calculations are performed (e.g., + * in access method code). + * + * there doesn't appear to be any reason to have separate types except + * for the fact that BlockIds can be SHORTALIGN'd (and therefore any + * structures that contains them, such as ItemPointerData, can also be + * SHORTALIGN'd). this is an important consideration for reducing the + * space requirements of the line pointer (ItemIdData) array on each + * page and the header of each heap or index tuple, so it doesn't seem + * wise to change this without good reason. + */ +typedef struct BlockIdData +{ + uint16 bi_hi; + uint16 bi_lo; +} BlockIdData; + +typedef BlockIdData *BlockId; /* block identifier */ + +/* ---------------- + * support functions + * ---------------- + */ + +/* + * BlockNumberIsValid + * True iff blockNumber is valid. + */ +static inline bool +BlockNumberIsValid(BlockNumber blockNumber) +{ + return blockNumber != InvalidBlockNumber; +} + +/* + * BlockIdSet + * Sets a block identifier to the specified value. + */ +static inline void +BlockIdSet(BlockIdData *blockId, BlockNumber blockNumber) +{ + blockId->bi_hi = blockNumber >> 16; + blockId->bi_lo = blockNumber & 0xffff; +} + +/* + * BlockIdEquals + * Check for block number equality. + */ +static inline bool +BlockIdEquals(const BlockIdData *blockId1, const BlockIdData *blockId2) +{ + return (blockId1->bi_hi == blockId2->bi_hi && + blockId1->bi_lo == blockId2->bi_lo); +} + +/* + * BlockIdGetBlockNumber + * Retrieve the block number from a block identifier. + */ +static inline BlockNumber +BlockIdGetBlockNumber(const BlockIdData *blockId) +{ + return (((BlockNumber) blockId->bi_hi) << 16) | ((BlockNumber) blockId->bi_lo); +} + +#endif /* BLOCK_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/buf.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/buf.h new file mode 100644 index 0000000..2a209cc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/buf.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- + * + * buf.h + * Basic buffer manager data types. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/buf.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUF_H +#define BUF_H + +/* + * Buffer identifiers. + * + * Zero is invalid, positive is the index of a shared buffer (1..NBuffers), + * negative is the index of a local buffer (-1 .. -NLocBuffer). + */ +typedef int Buffer; + +#define InvalidBuffer 0 + +/* + * BufferIsInvalid + * True iff the buffer is invalid. + */ +#define BufferIsInvalid(buffer) ((buffer) == InvalidBuffer) + +/* + * BufferIsLocal + * True iff the buffer is local (not visible to other backends). + */ +#define BufferIsLocal(buffer) ((buffer) < 0) + +/* + * Buffer access strategy objects. + * + * BufferAccessStrategyData is private to freelist.c + */ +typedef struct BufferAccessStrategyData *BufferAccessStrategy; + +#endif /* BUF_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/buf_internals.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/buf_internals.h new file mode 100644 index 0000000..0dec7d9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/buf_internals.h @@ -0,0 +1,494 @@ +/*------------------------------------------------------------------------- + * + * buf_internals.h + * Internal definitions for buffer manager and the buffer replacement + * strategy. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/buf_internals.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUFMGR_INTERNALS_H +#define BUFMGR_INTERNALS_H + +#include "pgstat.h" +#include "port/atomics.h" +#include "storage/aio_types.h" +#include "storage/buf.h" +#include "storage/bufmgr.h" +#include "storage/condition_variable.h" +#include "storage/lwlock.h" +#include "storage/procnumber.h" +#include "storage/shmem.h" +#include "storage/smgr.h" +#include "storage/spin.h" +#include "utils/relcache.h" +#include "utils/resowner.h" + +/* + * Buffer state is a single 32-bit variable where following data is combined. + * + * - 18 bits refcount + * - 4 bits usage count + * - 10 bits of flags + * + * Combining these values allows to perform some operations without locking + * the buffer header, by modifying them together with a CAS loop. + * + * The definition of buffer state components is below. + */ +#define BUF_REFCOUNT_BITS 18 +#define BUF_USAGECOUNT_BITS 4 +#define BUF_FLAG_BITS 10 + +StaticAssertDecl(BUF_REFCOUNT_BITS + BUF_USAGECOUNT_BITS + BUF_FLAG_BITS == 32, + "parts of buffer state space need to equal 32"); + +#define BUF_REFCOUNT_ONE 1 +#define BUF_REFCOUNT_MASK ((1U << BUF_REFCOUNT_BITS) - 1) +#define BUF_USAGECOUNT_MASK (((1U << BUF_USAGECOUNT_BITS) - 1) << (BUF_REFCOUNT_BITS)) +#define BUF_USAGECOUNT_ONE (1U << BUF_REFCOUNT_BITS) +#define BUF_USAGECOUNT_SHIFT BUF_REFCOUNT_BITS +#define BUF_FLAG_MASK (((1U << BUF_FLAG_BITS) - 1) << (BUF_REFCOUNT_BITS + BUF_USAGECOUNT_BITS)) + +/* Get refcount and usagecount from buffer state */ +#define BUF_STATE_GET_REFCOUNT(state) ((state) & BUF_REFCOUNT_MASK) +#define BUF_STATE_GET_USAGECOUNT(state) (((state) & BUF_USAGECOUNT_MASK) >> BUF_USAGECOUNT_SHIFT) + +/* + * Flags for buffer descriptors + * + * Note: BM_TAG_VALID essentially means that there is a buffer hashtable + * entry associated with the buffer's tag. + */ +#define BM_LOCKED (1U << 22) /* buffer header is locked */ +#define BM_DIRTY (1U << 23) /* data needs writing */ +#define BM_VALID (1U << 24) /* data is valid */ +#define BM_TAG_VALID (1U << 25) /* tag is assigned */ +#define BM_IO_IN_PROGRESS (1U << 26) /* read or write in progress */ +#define BM_IO_ERROR (1U << 27) /* previous I/O failed */ +#define BM_JUST_DIRTIED (1U << 28) /* dirtied since write started */ +#define BM_PIN_COUNT_WAITER (1U << 29) /* have waiter for sole pin */ +#define BM_CHECKPOINT_NEEDED (1U << 30) /* must write for checkpoint */ +#define BM_PERMANENT (1U << 31) /* permanent buffer (not unlogged, + * or init fork) */ +/* + * The maximum allowed value of usage_count represents a tradeoff between + * accuracy and speed of the clock-sweep buffer management algorithm. A + * large value (comparable to NBuffers) would approximate LRU semantics. + * But it can take as many as BM_MAX_USAGE_COUNT+1 complete cycles of + * clock sweeps to find a free buffer, so in practice we don't want the + * value to be very large. + */ +#define BM_MAX_USAGE_COUNT 5 + +StaticAssertDecl(BM_MAX_USAGE_COUNT < (1 << BUF_USAGECOUNT_BITS), + "BM_MAX_USAGE_COUNT doesn't fit in BUF_USAGECOUNT_BITS bits"); +StaticAssertDecl(MAX_BACKENDS_BITS <= BUF_REFCOUNT_BITS, + "MAX_BACKENDS_BITS needs to be <= BUF_REFCOUNT_BITS"); + +/* + * Buffer tag identifies which disk block the buffer contains. + * + * Note: the BufferTag data must be sufficient to determine where to write the + * block, without reference to pg_class or pg_tablespace entries. It's + * possible that the backend flushing the buffer doesn't even believe the + * relation is visible yet (its xact may have started before the xact that + * created the rel). The storage manager must be able to cope anyway. + * + * Note: if there's any pad bytes in the struct, InitBufferTag will have + * to be fixed to zero them, since this struct is used as a hash key. + */ +typedef struct buftag +{ + Oid spcOid; /* tablespace oid */ + Oid dbOid; /* database oid */ + RelFileNumber relNumber; /* relation file number */ + ForkNumber forkNum; /* fork number */ + BlockNumber blockNum; /* blknum relative to begin of reln */ +} BufferTag; + +static inline RelFileNumber +BufTagGetRelNumber(const BufferTag *tag) +{ + return tag->relNumber; +} + +static inline ForkNumber +BufTagGetForkNum(const BufferTag *tag) +{ + return tag->forkNum; +} + +static inline void +BufTagSetRelForkDetails(BufferTag *tag, RelFileNumber relnumber, + ForkNumber forknum) +{ + tag->relNumber = relnumber; + tag->forkNum = forknum; +} + +static inline RelFileLocator +BufTagGetRelFileLocator(const BufferTag *tag) +{ + RelFileLocator rlocator; + + rlocator.spcOid = tag->spcOid; + rlocator.dbOid = tag->dbOid; + rlocator.relNumber = BufTagGetRelNumber(tag); + + return rlocator; +} + +static inline void +ClearBufferTag(BufferTag *tag) +{ + tag->spcOid = InvalidOid; + tag->dbOid = InvalidOid; + BufTagSetRelForkDetails(tag, InvalidRelFileNumber, InvalidForkNumber); + tag->blockNum = InvalidBlockNumber; +} + +static inline void +InitBufferTag(BufferTag *tag, const RelFileLocator *rlocator, + ForkNumber forkNum, BlockNumber blockNum) +{ + tag->spcOid = rlocator->spcOid; + tag->dbOid = rlocator->dbOid; + BufTagSetRelForkDetails(tag, rlocator->relNumber, forkNum); + tag->blockNum = blockNum; +} + +static inline bool +BufferTagsEqual(const BufferTag *tag1, const BufferTag *tag2) +{ + return (tag1->spcOid == tag2->spcOid) && + (tag1->dbOid == tag2->dbOid) && + (tag1->relNumber == tag2->relNumber) && + (tag1->blockNum == tag2->blockNum) && + (tag1->forkNum == tag2->forkNum); +} + +static inline bool +BufTagMatchesRelFileLocator(const BufferTag *tag, + const RelFileLocator *rlocator) +{ + return (tag->spcOid == rlocator->spcOid) && + (tag->dbOid == rlocator->dbOid) && + (BufTagGetRelNumber(tag) == rlocator->relNumber); +} + + +/* + * The shared buffer mapping table is partitioned to reduce contention. + * To determine which partition lock a given tag requires, compute the tag's + * hash code with BufTableHashCode(), then apply BufMappingPartitionLock(). + * NB: NUM_BUFFER_PARTITIONS must be a power of 2! + */ +static inline uint32 +BufTableHashPartition(uint32 hashcode) +{ + return hashcode % NUM_BUFFER_PARTITIONS; +} + +static inline LWLock * +BufMappingPartitionLock(uint32 hashcode) +{ + return &MainLWLockArray[BUFFER_MAPPING_LWLOCK_OFFSET + + BufTableHashPartition(hashcode)].lock; +} + +static inline LWLock * +BufMappingPartitionLockByIndex(uint32 index) +{ + return &MainLWLockArray[BUFFER_MAPPING_LWLOCK_OFFSET + index].lock; +} + +/* + * BufferDesc -- shared descriptor/state data for a single shared buffer. + * + * Note: Buffer header lock (BM_LOCKED flag) must be held to examine or change + * tag, state or wait_backend_pgprocno fields. In general, buffer header lock + * is a spinlock which is combined with flags, refcount and usagecount into + * single atomic variable. This layout allow us to do some operations in a + * single atomic operation, without actually acquiring and releasing spinlock; + * for instance, increase or decrease refcount. buf_id field never changes + * after initialization, so does not need locking. freeNext is protected by + * the buffer_strategy_lock not buffer header lock. The LWLock can take care + * of itself. The buffer header lock is *not* used to control access to the + * data in the buffer! + * + * It's assumed that nobody changes the state field while buffer header lock + * is held. Thus buffer header lock holder can do complex updates of the + * state variable in single write, simultaneously with lock release (cleaning + * BM_LOCKED flag). On the other hand, updating of state without holding + * buffer header lock is restricted to CAS, which ensures that BM_LOCKED flag + * is not set. Atomic increment/decrement, OR/AND etc. are not allowed. + * + * An exception is that if we have the buffer pinned, its tag can't change + * underneath us, so we can examine the tag without locking the buffer header. + * Also, in places we do one-time reads of the flags without bothering to + * lock the buffer header; this is generally for situations where we don't + * expect the flag bit being tested to be changing. + * + * We can't physically remove items from a disk page if another backend has + * the buffer pinned. Hence, a backend may need to wait for all other pins + * to go away. This is signaled by storing its own pgprocno into + * wait_backend_pgprocno and setting flag bit BM_PIN_COUNT_WAITER. At present, + * there can be only one such waiter per buffer. + * + * We use this same struct for local buffer headers, but the locks are not + * used and not all of the flag bits are useful either. To avoid unnecessary + * overhead, manipulations of the state field should be done without actual + * atomic operations (i.e. only pg_atomic_read_u32() and + * pg_atomic_unlocked_write_u32()). + * + * Be careful to avoid increasing the size of the struct when adding or + * reordering members. Keeping it below 64 bytes (the most common CPU + * cache line size) is fairly important for performance. + * + * Per-buffer I/O condition variables are currently kept outside this struct in + * a separate array. They could be moved in here and still fit within that + * limit on common systems, but for now that is not done. + */ +typedef struct BufferDesc +{ + BufferTag tag; /* ID of page contained in buffer */ + int buf_id; /* buffer's index number (from 0) */ + + /* state of the tag, containing flags, refcount and usagecount */ + pg_atomic_uint32 state; + + int wait_backend_pgprocno; /* backend of pin-count waiter */ + int freeNext; /* link in freelist chain */ + + PgAioWaitRef io_wref; /* set iff AIO is in progress */ + LWLock content_lock; /* to lock access to buffer contents */ +} BufferDesc; + +/* + * Concurrent access to buffer headers has proven to be more efficient if + * they're cache line aligned. So we force the start of the BufferDescriptors + * array to be on a cache line boundary and force the elements to be cache + * line sized. + * + * XXX: As this is primarily matters in highly concurrent workloads which + * probably all are 64bit these days, and the space wastage would be a bit + * more noticeable on 32bit systems, we don't force the stride to be cache + * line sized on those. If somebody does actual performance testing, we can + * reevaluate. + * + * Note that local buffer descriptors aren't forced to be aligned - as there's + * no concurrent access to those it's unlikely to be beneficial. + * + * We use a 64-byte cache line size here, because that's the most common + * size. Making it bigger would be a waste of memory. Even if running on a + * platform with either 32 or 128 byte line sizes, it's good to align to + * boundaries and avoid false sharing. + */ +#define BUFFERDESC_PAD_TO_SIZE (SIZEOF_VOID_P == 8 ? 64 : 1) + +typedef union BufferDescPadded +{ + BufferDesc bufferdesc; + char pad[BUFFERDESC_PAD_TO_SIZE]; +} BufferDescPadded; + +/* + * The PendingWriteback & WritebackContext structure are used to keep + * information about pending flush requests to be issued to the OS. + */ +typedef struct PendingWriteback +{ + /* could store different types of pending flushes here */ + BufferTag tag; +} PendingWriteback; + +/* struct forward declared in bufmgr.h */ +typedef struct WritebackContext +{ + /* pointer to the max number of writeback requests to coalesce */ + int *max_pending; + + /* current number of pending writeback requests */ + int nr_pending; + + /* pending requests */ + PendingWriteback pending_writebacks[WRITEBACK_MAX_PENDING_FLUSHES]; +} WritebackContext; + +/* in buf_init.c */ +extern PGDLLIMPORT BufferDescPadded *BufferDescriptors; +extern PGDLLIMPORT ConditionVariableMinimallyPadded *BufferIOCVArray; +extern PGDLLIMPORT WritebackContext BackendWritebackContext; + +/* in localbuf.c */ +extern PGDLLIMPORT BufferDesc *LocalBufferDescriptors; + + +static inline BufferDesc * +GetBufferDescriptor(uint32 id) +{ + return &(BufferDescriptors[id]).bufferdesc; +} + +static inline BufferDesc * +GetLocalBufferDescriptor(uint32 id) +{ + return &LocalBufferDescriptors[id]; +} + +static inline Buffer +BufferDescriptorGetBuffer(const BufferDesc *bdesc) +{ + return (Buffer) (bdesc->buf_id + 1); +} + +static inline ConditionVariable * +BufferDescriptorGetIOCV(const BufferDesc *bdesc) +{ + return &(BufferIOCVArray[bdesc->buf_id]).cv; +} + +static inline LWLock * +BufferDescriptorGetContentLock(const BufferDesc *bdesc) +{ + return (LWLock *) (&bdesc->content_lock); +} + +/* + * The freeNext field is either the index of the next freelist entry, + * or one of these special values: + */ +#define FREENEXT_END_OF_LIST (-1) +#define FREENEXT_NOT_IN_LIST (-2) + +/* + * Functions for acquiring/releasing a shared buffer header's spinlock. Do + * not apply these to local buffers! + */ +extern uint32 LockBufHdr(BufferDesc *desc); + +static inline void +UnlockBufHdr(BufferDesc *desc, uint32 buf_state) +{ + pg_write_barrier(); + pg_atomic_write_u32(&desc->state, buf_state & (~BM_LOCKED)); +} + +/* in bufmgr.c */ + +/* + * Structure to sort buffers per file on checkpoints. + * + * This structure is allocated per buffer in shared memory, so it should be + * kept as small as possible. + */ +typedef struct CkptSortItem +{ + Oid tsId; + RelFileNumber relNumber; + ForkNumber forkNum; + BlockNumber blockNum; + int buf_id; +} CkptSortItem; + +extern PGDLLIMPORT CkptSortItem *CkptBufferIds; + +/* ResourceOwner callbacks to hold buffer I/Os and pins */ +extern PGDLLIMPORT const ResourceOwnerDesc buffer_io_resowner_desc; +extern PGDLLIMPORT const ResourceOwnerDesc buffer_pin_resowner_desc; + +/* Convenience wrappers over ResourceOwnerRemember/Forget */ +static inline void +ResourceOwnerRememberBuffer(ResourceOwner owner, Buffer buffer) +{ + ResourceOwnerRemember(owner, Int32GetDatum(buffer), &buffer_pin_resowner_desc); +} +static inline void +ResourceOwnerForgetBuffer(ResourceOwner owner, Buffer buffer) +{ + ResourceOwnerForget(owner, Int32GetDatum(buffer), &buffer_pin_resowner_desc); +} +static inline void +ResourceOwnerRememberBufferIO(ResourceOwner owner, Buffer buffer) +{ + ResourceOwnerRemember(owner, Int32GetDatum(buffer), &buffer_io_resowner_desc); +} +static inline void +ResourceOwnerForgetBufferIO(ResourceOwner owner, Buffer buffer) +{ + ResourceOwnerForget(owner, Int32GetDatum(buffer), &buffer_io_resowner_desc); +} + +/* + * Internal buffer management routines + */ +/* bufmgr.c */ +extern void WritebackContextInit(WritebackContext *context, int *max_pending); +extern void IssuePendingWritebacks(WritebackContext *wb_context, IOContext io_context); +extern void ScheduleBufferTagForWriteback(WritebackContext *wb_context, + IOContext io_context, BufferTag *tag); + +/* solely to make it easier to write tests */ +extern bool StartBufferIO(BufferDesc *buf, bool forInput, bool nowait); +extern void TerminateBufferIO(BufferDesc *buf, bool clear_dirty, uint32 set_flag_bits, + bool forget_owner, bool release_aio); + + +/* freelist.c */ +extern IOContext IOContextForStrategy(BufferAccessStrategy strategy); +extern BufferDesc *StrategyGetBuffer(BufferAccessStrategy strategy, + uint32 *buf_state, bool *from_ring); +extern void StrategyFreeBuffer(BufferDesc *buf); +extern bool StrategyRejectBuffer(BufferAccessStrategy strategy, + BufferDesc *buf, bool from_ring); + +extern int StrategySyncStart(uint32 *complete_passes, uint32 *num_buf_alloc); +extern void StrategyNotifyBgWriter(int bgwprocno); + +extern Size StrategyShmemSize(void); +extern void StrategyInitialize(bool init); +extern bool have_free_buffer(void); + +/* buf_table.c */ +extern Size BufTableShmemSize(int size); +extern void InitBufTable(int size); +extern uint32 BufTableHashCode(BufferTag *tagPtr); +extern int BufTableLookup(BufferTag *tagPtr, uint32 hashcode); +extern int BufTableInsert(BufferTag *tagPtr, uint32 hashcode, int buf_id); +extern void BufTableDelete(BufferTag *tagPtr, uint32 hashcode); + +/* localbuf.c */ +extern bool PinLocalBuffer(BufferDesc *buf_hdr, bool adjust_usagecount); +extern void UnpinLocalBuffer(Buffer buffer); +extern void UnpinLocalBufferNoOwner(Buffer buffer); +extern PrefetchBufferResult PrefetchLocalBuffer(SMgrRelation smgr, + ForkNumber forkNum, + BlockNumber blockNum); +extern BufferDesc *LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, + BlockNumber blockNum, bool *foundPtr); +extern BlockNumber ExtendBufferedRelLocal(BufferManagerRelation bmr, + ForkNumber fork, + uint32 flags, + uint32 extend_by, + BlockNumber extend_upto, + Buffer *buffers, + uint32 *extended_by); +extern void MarkLocalBufferDirty(Buffer buffer); +extern void TerminateLocalBufferIO(BufferDesc *bufHdr, bool clear_dirty, + uint32 set_flag_bits, bool release_aio); +extern bool StartLocalBufferIO(BufferDesc *bufHdr, bool forInput, bool nowait); +extern void FlushLocalBuffer(BufferDesc *bufHdr, SMgrRelation reln); +extern void InvalidateLocalBuffer(BufferDesc *bufHdr, bool check_unreferenced); +extern void DropRelationLocalBuffers(RelFileLocator rlocator, + ForkNumber forkNum, + BlockNumber firstDelBlock); +extern void DropRelationAllLocalBuffers(RelFileLocator rlocator); +extern void AtEOXact_LocalBuffers(bool isCommit); + +#endif /* BUFMGR_INTERNALS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/buffile.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/buffile.h new file mode 100644 index 0000000..a2f4821 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/buffile.h @@ -0,0 +1,59 @@ +/*------------------------------------------------------------------------- + * + * buffile.h + * Management of large buffered temporary files. + * + * The BufFile routines provide a partial replacement for stdio atop + * virtual file descriptors managed by fd.c. Currently they only support + * buffered access to a virtual file, without any of stdio's formatting + * features. That's enough for immediate needs, but the set of facilities + * could be expanded if necessary. + * + * BufFile also supports working with temporary files that exceed the OS + * file size limit and/or the largest offset representable in an int. + * It might be better to split that out as a separately accessible module, + * but currently we have no need for oversize temp files without buffered + * access. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/buffile.h + * + *------------------------------------------------------------------------- + */ + +#ifndef BUFFILE_H +#define BUFFILE_H + +#include "storage/fileset.h" + +/* BufFile is an opaque type whose details are not known outside buffile.c. */ + +typedef struct BufFile BufFile; + +/* + * prototypes for functions in buffile.c + */ + +extern BufFile *BufFileCreateTemp(bool interXact); +extern void BufFileClose(BufFile *file); +pg_nodiscard extern size_t BufFileRead(BufFile *file, void *ptr, size_t size); +extern void BufFileReadExact(BufFile *file, void *ptr, size_t size); +extern size_t BufFileReadMaybeEOF(BufFile *file, void *ptr, size_t size, bool eofOK); +extern void BufFileWrite(BufFile *file, const void *ptr, size_t size); +extern int BufFileSeek(BufFile *file, int fileno, off_t offset, int whence); +extern void BufFileTell(BufFile *file, int *fileno, off_t *offset); +extern int BufFileSeekBlock(BufFile *file, int64 blknum); +extern int64 BufFileSize(BufFile *file); +extern int64 BufFileAppend(BufFile *target, BufFile *source); + +extern BufFile *BufFileCreateFileSet(FileSet *fileset, const char *name); +extern void BufFileExportFileSet(BufFile *file); +extern BufFile *BufFileOpenFileSet(FileSet *fileset, const char *name, + int mode, bool missing_ok); +extern void BufFileDeleteFileSet(FileSet *fileset, const char *name, + bool missing_ok); +extern void BufFileTruncateFileSet(BufFile *file, int fileno, off_t offset); + +#endif /* BUFFILE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/bufmgr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/bufmgr.h new file mode 100644 index 0000000..41fdc1e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/bufmgr.h @@ -0,0 +1,424 @@ +/*------------------------------------------------------------------------- + * + * bufmgr.h + * POSTGRES buffer manager definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/bufmgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUFMGR_H +#define BUFMGR_H + +#include "port/pg_iovec.h" +#include "storage/aio_types.h" +#include "storage/block.h" +#include "storage/buf.h" +#include "storage/bufpage.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" +#include "utils/snapmgr.h" + +typedef void *Block; + +/* + * Possible arguments for GetAccessStrategy(). + * + * If adding a new BufferAccessStrategyType, also add a new IOContext so + * IO statistics using this strategy are tracked. + */ +typedef enum BufferAccessStrategyType +{ + BAS_NORMAL, /* Normal random access */ + BAS_BULKREAD, /* Large read-only scan (hint bit updates are + * ok) */ + BAS_BULKWRITE, /* Large multi-block write (e.g. COPY IN) */ + BAS_VACUUM, /* VACUUM */ +} BufferAccessStrategyType; + +/* Possible modes for ReadBufferExtended() */ +typedef enum +{ + RBM_NORMAL, /* Normal read */ + RBM_ZERO_AND_LOCK, /* Don't read from disk, caller will + * initialize. Also locks the page. */ + RBM_ZERO_AND_CLEANUP_LOCK, /* Like RBM_ZERO_AND_LOCK, but locks the page + * in "cleanup" mode */ + RBM_ZERO_ON_ERROR, /* Read, but return an all-zeros page on error */ + RBM_NORMAL_NO_LOG, /* Don't log page as invalid during WAL + * replay; otherwise same as RBM_NORMAL */ +} ReadBufferMode; + +/* + * Type returned by PrefetchBuffer(). + */ +typedef struct PrefetchBufferResult +{ + Buffer recent_buffer; /* If valid, a hit (recheck needed!) */ + bool initiated_io; /* If true, a miss resulting in async I/O */ +} PrefetchBufferResult; + +/* + * Flags influencing the behaviour of ExtendBufferedRel* + */ +typedef enum ExtendBufferedFlags +{ + /* + * Don't acquire extension lock. This is safe only if the relation isn't + * shared, an access exclusive lock is held or if this is the startup + * process. + */ + EB_SKIP_EXTENSION_LOCK = (1 << 0), + + /* Is this extension part of recovery? */ + EB_PERFORMING_RECOVERY = (1 << 1), + + /* + * Should the fork be created if it does not currently exist? This likely + * only ever makes sense for relation forks. + */ + EB_CREATE_FORK_IF_NEEDED = (1 << 2), + + /* Should the first (possibly only) return buffer be returned locked? */ + EB_LOCK_FIRST = (1 << 3), + + /* Should the smgr size cache be cleared? */ + EB_CLEAR_SIZE_CACHE = (1 << 4), + + /* internal flags follow */ + EB_LOCK_TARGET = (1 << 5), +} ExtendBufferedFlags; + +/* + * Some functions identify relations either by relation or smgr + + * relpersistence. Used via the BMR_REL()/BMR_SMGR() macros below. This + * allows us to use the same function for both recovery and normal operation. + */ +typedef struct BufferManagerRelation +{ + Relation rel; + struct SMgrRelationData *smgr; + char relpersistence; +} BufferManagerRelation; + +#define BMR_REL(p_rel) ((BufferManagerRelation){.rel = p_rel}) +#define BMR_SMGR(p_smgr, p_relpersistence) ((BufferManagerRelation){.smgr = p_smgr, .relpersistence = p_relpersistence}) + +/* Zero out page if reading fails. */ +#define READ_BUFFERS_ZERO_ON_ERROR (1 << 0) +/* Call smgrprefetch() if I/O necessary. */ +#define READ_BUFFERS_ISSUE_ADVICE (1 << 1) +/* Don't treat page as invalid due to checksum failures. */ +#define READ_BUFFERS_IGNORE_CHECKSUM_FAILURES (1 << 2) +/* IO will immediately be waited for */ +#define READ_BUFFERS_SYNCHRONOUSLY (1 << 3) + + +struct ReadBuffersOperation +{ + /* The following members should be set by the caller. */ + Relation rel; /* optional */ + struct SMgrRelationData *smgr; + char persistence; + ForkNumber forknum; + BufferAccessStrategy strategy; + + /* + * The following private members are private state for communication + * between StartReadBuffers() and WaitReadBuffers(), initialized only if + * an actual read is required, and should not be modified. + */ + Buffer *buffers; + BlockNumber blocknum; + int flags; + int16 nblocks; + int16 nblocks_done; + PgAioWaitRef io_wref; + PgAioReturn io_return; +}; + +typedef struct ReadBuffersOperation ReadBuffersOperation; + +/* forward declared, to avoid having to expose buf_internals.h here */ +struct WritebackContext; + +/* forward declared, to avoid including smgr.h here */ +struct SMgrRelationData; + +/* in globals.c ... this duplicates miscadmin.h */ +extern PGDLLIMPORT int NBuffers; + +/* in bufmgr.c */ +extern PGDLLIMPORT bool zero_damaged_pages; +extern PGDLLIMPORT int bgwriter_lru_maxpages; +extern PGDLLIMPORT double bgwriter_lru_multiplier; +extern PGDLLIMPORT bool track_io_timing; + +#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 16 +#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 16 +extern PGDLLIMPORT int effective_io_concurrency; +extern PGDLLIMPORT int maintenance_io_concurrency; + +#define MAX_IO_COMBINE_LIMIT PG_IOV_MAX +#define DEFAULT_IO_COMBINE_LIMIT Min(MAX_IO_COMBINE_LIMIT, (128 * 1024) / BLCKSZ) +extern PGDLLIMPORT int io_combine_limit; /* min of the two GUCs below */ +extern PGDLLIMPORT int io_combine_limit_guc; +extern PGDLLIMPORT int io_max_combine_limit; + +extern PGDLLIMPORT int checkpoint_flush_after; +extern PGDLLIMPORT int backend_flush_after; +extern PGDLLIMPORT int bgwriter_flush_after; + +extern PGDLLIMPORT const PgAioHandleCallbacks aio_shared_buffer_readv_cb; +extern PGDLLIMPORT const PgAioHandleCallbacks aio_local_buffer_readv_cb; + +/* in buf_init.c */ +extern PGDLLIMPORT char *BufferBlocks; + +/* in localbuf.c */ +extern PGDLLIMPORT int NLocBuffer; +extern PGDLLIMPORT Block *LocalBufferBlockPointers; +extern PGDLLIMPORT int32 *LocalRefCount; + +/* upper limit for effective_io_concurrency */ +#define MAX_IO_CONCURRENCY 1000 + +/* special block number for ReadBuffer() */ +#define P_NEW InvalidBlockNumber /* grow the file to get a new page */ + +/* + * Buffer content lock modes (mode argument for LockBuffer()) + */ +#define BUFFER_LOCK_UNLOCK 0 +#define BUFFER_LOCK_SHARE 1 +#define BUFFER_LOCK_EXCLUSIVE 2 + + +/* + * prototypes for functions in bufmgr.c + */ +extern PrefetchBufferResult PrefetchSharedBuffer(struct SMgrRelationData *smgr_reln, + ForkNumber forkNum, + BlockNumber blockNum); +extern PrefetchBufferResult PrefetchBuffer(Relation reln, ForkNumber forkNum, + BlockNumber blockNum); +extern bool ReadRecentBuffer(RelFileLocator rlocator, ForkNumber forkNum, + BlockNumber blockNum, Buffer recent_buffer); +extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum); +extern Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, + BlockNumber blockNum, ReadBufferMode mode, + BufferAccessStrategy strategy); +extern Buffer ReadBufferWithoutRelcache(RelFileLocator rlocator, + ForkNumber forkNum, BlockNumber blockNum, + ReadBufferMode mode, BufferAccessStrategy strategy, + bool permanent); + +extern bool StartReadBuffer(ReadBuffersOperation *operation, + Buffer *buffer, + BlockNumber blocknum, + int flags); +extern bool StartReadBuffers(ReadBuffersOperation *operation, + Buffer *buffers, + BlockNumber blockNum, + int *nblocks, + int flags); +extern void WaitReadBuffers(ReadBuffersOperation *operation); + +extern void ReleaseBuffer(Buffer buffer); +extern void UnlockReleaseBuffer(Buffer buffer); +extern bool BufferIsExclusiveLocked(Buffer buffer); +extern bool BufferIsDirty(Buffer buffer); +extern void MarkBufferDirty(Buffer buffer); +extern void IncrBufferRefCount(Buffer buffer); +extern void CheckBufferIsPinnedOnce(Buffer buffer); +extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation, + BlockNumber blockNum); + +extern Buffer ExtendBufferedRel(BufferManagerRelation bmr, + ForkNumber forkNum, + BufferAccessStrategy strategy, + uint32 flags); +extern BlockNumber ExtendBufferedRelBy(BufferManagerRelation bmr, + ForkNumber fork, + BufferAccessStrategy strategy, + uint32 flags, + uint32 extend_by, + Buffer *buffers, + uint32 *extended_by); +extern Buffer ExtendBufferedRelTo(BufferManagerRelation bmr, + ForkNumber fork, + BufferAccessStrategy strategy, + uint32 flags, + BlockNumber extend_to, + ReadBufferMode mode); + +extern void InitBufferManagerAccess(void); +extern void AtEOXact_Buffers(bool isCommit); +#ifdef USE_ASSERT_CHECKING +extern void AssertBufferLocksPermitCatalogRead(void); +#endif +extern char *DebugPrintBufferRefcount(Buffer buffer); +extern void CheckPointBuffers(int flags); +extern BlockNumber BufferGetBlockNumber(Buffer buffer); +extern BlockNumber RelationGetNumberOfBlocksInFork(Relation relation, + ForkNumber forkNum); +extern void FlushOneBuffer(Buffer buffer); +extern void FlushRelationBuffers(Relation rel); +extern void FlushRelationsAllBuffers(struct SMgrRelationData **smgrs, int nrels); +extern void CreateAndCopyRelationData(RelFileLocator src_rlocator, + RelFileLocator dst_rlocator, + bool permanent); +extern void FlushDatabaseBuffers(Oid dbid); +extern void DropRelationBuffers(struct SMgrRelationData *smgr_reln, + ForkNumber *forkNum, + int nforks, BlockNumber *firstDelBlock); +extern void DropRelationsAllBuffers(struct SMgrRelationData **smgr_reln, + int nlocators); +extern void DropDatabaseBuffers(Oid dbid); + +#define RelationGetNumberOfBlocks(reln) \ + RelationGetNumberOfBlocksInFork(reln, MAIN_FORKNUM) + +extern bool BufferIsPermanent(Buffer buffer); +extern XLogRecPtr BufferGetLSNAtomic(Buffer buffer); +extern void BufferGetTag(Buffer buffer, RelFileLocator *rlocator, + ForkNumber *forknum, BlockNumber *blknum); + +extern void MarkBufferDirtyHint(Buffer buffer, bool buffer_std); + +extern void UnlockBuffers(void); +extern void LockBuffer(Buffer buffer, int mode); +extern bool ConditionalLockBuffer(Buffer buffer); +extern void LockBufferForCleanup(Buffer buffer); +extern bool ConditionalLockBufferForCleanup(Buffer buffer); +extern bool IsBufferCleanupOK(Buffer buffer); +extern bool HoldingBufferPinThatDelaysRecovery(void); + +extern bool BgBufferSync(struct WritebackContext *wb_context); + +extern uint32 GetPinLimit(void); +extern uint32 GetLocalPinLimit(void); +extern uint32 GetAdditionalPinLimit(void); +extern uint32 GetAdditionalLocalPinLimit(void); +extern void LimitAdditionalPins(uint32 *additional_pins); +extern void LimitAdditionalLocalPins(uint32 *additional_pins); + +extern bool EvictUnpinnedBuffer(Buffer buf, bool *buffer_flushed); +extern void EvictAllUnpinnedBuffers(int32 *buffers_evicted, + int32 *buffers_flushed, + int32 *buffers_skipped); +extern void EvictRelUnpinnedBuffers(Relation rel, + int32 *buffers_evicted, + int32 *buffers_flushed, + int32 *buffers_skipped); + +/* in buf_init.c */ +extern void BufferManagerShmemInit(void); +extern Size BufferManagerShmemSize(void); + +/* in localbuf.c */ +extern void AtProcExit_LocalBuffers(void); + +/* in freelist.c */ + +extern BufferAccessStrategy GetAccessStrategy(BufferAccessStrategyType btype); +extern BufferAccessStrategy GetAccessStrategyWithSize(BufferAccessStrategyType btype, + int ring_size_kb); +extern int GetAccessStrategyBufferCount(BufferAccessStrategy strategy); +extern int GetAccessStrategyPinLimit(BufferAccessStrategy strategy); + +extern void FreeAccessStrategy(BufferAccessStrategy strategy); + + +/* inline functions */ + +/* + * Although this header file is nominally backend-only, certain frontend + * programs like pg_waldump include it. For compilers that emit static + * inline functions even when they're unused, that leads to unsatisfied + * external references; hence hide these with #ifndef FRONTEND. + */ + +#ifndef FRONTEND + +/* + * BufferIsValid + * True iff the given buffer number is valid (either as a shared + * or local buffer). + * + * Note: For a long time this was defined the same as BufferIsPinned, + * that is it would say False if you didn't hold a pin on the buffer. + * I believe this was bogus and served only to mask logic errors. + * Code should always know whether it has a buffer reference, + * independently of the pin state. + * + * Note: For a further long time this was not quite the inverse of the + * BufferIsInvalid() macro, in that it also did sanity checks to verify + * that the buffer number was in range. Most likely, this macro was + * originally intended only to be used in assertions, but its use has + * since expanded quite a bit, and the overhead of making those checks + * even in non-assert-enabled builds can be significant. Thus, we've + * now demoted the range checks to assertions within the macro itself. + */ +static inline bool +BufferIsValid(Buffer bufnum) +{ + Assert(bufnum <= NBuffers); + Assert(bufnum >= -NLocBuffer); + + return bufnum != InvalidBuffer; +} + +/* + * BufferGetBlock + * Returns a reference to a disk page image associated with a buffer. + * + * Note: + * Assumes buffer is valid. + */ +static inline Block +BufferGetBlock(Buffer buffer) +{ + Assert(BufferIsValid(buffer)); + + if (BufferIsLocal(buffer)) + return LocalBufferBlockPointers[-buffer - 1]; + else + return (Block) (BufferBlocks + ((Size) (buffer - 1)) * BLCKSZ); +} + +/* + * BufferGetPageSize + * Returns the page size within a buffer. + * + * Notes: + * Assumes buffer is valid. + * + * The buffer can be a raw disk block and need not contain a valid + * (formatted) disk page. + */ +/* XXX should dig out of buffer descriptor */ +static inline Size +BufferGetPageSize(Buffer buffer) +{ + Assert(BufferIsValid(buffer)); + return (Size) BLCKSZ; +} + +/* + * BufferGetPage + * Returns the page associated with a buffer. + */ +static inline Page +BufferGetPage(Buffer buffer) +{ + return (Page) BufferGetBlock(buffer); +} + +#endif /* FRONTEND */ + +#endif /* BUFMGR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/bufpage.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/bufpage.h new file mode 100644 index 0000000..aeb67c4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/bufpage.h @@ -0,0 +1,511 @@ +/*------------------------------------------------------------------------- + * + * bufpage.h + * Standard POSTGRES buffer page definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/bufpage.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUFPAGE_H +#define BUFPAGE_H + +#include "access/xlogdefs.h" +#include "storage/block.h" +#include "storage/item.h" +#include "storage/off.h" + +/* GUC variable */ +extern PGDLLIMPORT bool ignore_checksum_failure; + +/* + * A postgres disk page is an abstraction layered on top of a postgres + * disk block (which is simply a unit of i/o, see block.h). + * + * specifically, while a disk block can be unformatted, a postgres + * disk page is always a slotted page of the form: + * + * +----------------+---------------------------------+ + * | PageHeaderData | linp1 linp2 linp3 ... | + * +-----------+----+---------------------------------+ + * | ... linpN | | + * +-----------+--------------------------------------+ + * | ^ pd_lower | + * | | + * | v pd_upper | + * +-------------+------------------------------------+ + * | | tupleN ... | + * +-------------+------------------+-----------------+ + * | ... tuple3 tuple2 tuple1 | "special space" | + * +--------------------------------+-----------------+ + * ^ pd_special + * + * a page is full when nothing can be added between pd_lower and + * pd_upper. + * + * all blocks written out by an access method must be disk pages. + * + * EXCEPTIONS: + * + * obviously, a page is not formatted before it is initialized by + * a call to PageInit. + * + * NOTES: + * + * linp1..N form an ItemId (line pointer) array. ItemPointers point + * to a physical block number and a logical offset (line pointer + * number) within that block/page. Note that OffsetNumbers + * conventionally start at 1, not 0. + * + * tuple1..N are added "backwards" on the page. Since an ItemPointer + * offset is used to access an ItemId entry rather than an actual + * byte-offset position, tuples can be physically shuffled on a page + * whenever the need arises. This indirection also keeps crash recovery + * relatively simple, because the low-level details of page space + * management can be controlled by standard buffer page code during + * logging, and during recovery. + * + * AM-generic per-page information is kept in PageHeaderData. + * + * AM-specific per-page data (if any) is kept in the area marked "special + * space"; each AM has an "opaque" structure defined somewhere that is + * stored as the page trailer. An access method should always + * initialize its pages with PageInit and then set its own opaque + * fields. + */ + +typedef char PageData; +typedef PageData *Page; + + +/* + * location (byte offset) within a page. + * + * note that this is actually limited to 2^15 because we have limited + * ItemIdData.lp_off and ItemIdData.lp_len to 15 bits (see itemid.h). + */ +typedef uint16 LocationIndex; + + +/* + * For historical reasons, the 64-bit LSN value is stored as two 32-bit + * values. + */ +typedef struct +{ + uint32 xlogid; /* high bits */ + uint32 xrecoff; /* low bits */ +} PageXLogRecPtr; + +static inline XLogRecPtr +PageXLogRecPtrGet(PageXLogRecPtr val) +{ + return (uint64) val.xlogid << 32 | val.xrecoff; +} + +#define PageXLogRecPtrSet(ptr, lsn) \ + ((ptr).xlogid = (uint32) ((lsn) >> 32), (ptr).xrecoff = (uint32) (lsn)) + +/* + * disk page organization + * + * space management information generic to any page + * + * pd_lsn - identifies xlog record for last change to this page. + * pd_checksum - page checksum, if set. + * pd_flags - flag bits. + * pd_lower - offset to start of free space. + * pd_upper - offset to end of free space. + * pd_special - offset to start of special space. + * pd_pagesize_version - size in bytes and page layout version number. + * pd_prune_xid - oldest XID among potentially prunable tuples on page. + * + * The LSN is used by the buffer manager to enforce the basic rule of WAL: + * "thou shalt write xlog before data". A dirty buffer cannot be dumped + * to disk until xlog has been flushed at least as far as the page's LSN. + * + * pd_checksum stores the page checksum, if it has been set for this page; + * zero is a valid value for a checksum. If a checksum is not in use then + * we leave the field unset. This will typically mean the field is zero + * though non-zero values may also be present if databases have been + * pg_upgraded from releases prior to 9.3, when the same byte offset was + * used to store the current timelineid when the page was last updated. + * Note that there is no indication on a page as to whether the checksum + * is valid or not, a deliberate design choice which avoids the problem + * of relying on the page contents to decide whether to verify it. Hence + * there are no flag bits relating to checksums. + * + * pd_prune_xid is a hint field that helps determine whether pruning will be + * useful. It is currently unused in index pages. + * + * The page version number and page size are packed together into a single + * uint16 field. This is for historical reasons: before PostgreSQL 7.3, + * there was no concept of a page version number, and doing it this way + * lets us pretend that pre-7.3 databases have page version number zero. + * We constrain page sizes to be multiples of 256, leaving the low eight + * bits available for a version number. + * + * Minimum possible page size is perhaps 64B to fit page header, opaque space + * and a minimal tuple; of course, in reality you want it much bigger, so + * the constraint on pagesize mod 256 is not an important restriction. + * On the high end, we can only support pages up to 32KB because lp_off/lp_len + * are 15 bits. + */ + +typedef struct PageHeaderData +{ + /* XXX LSN is member of *any* block, not only page-organized ones */ + PageXLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog + * record for last change to this page */ + uint16 pd_checksum; /* checksum */ + uint16 pd_flags; /* flag bits, see below */ + LocationIndex pd_lower; /* offset to start of free space */ + LocationIndex pd_upper; /* offset to end of free space */ + LocationIndex pd_special; /* offset to start of special space */ + uint16 pd_pagesize_version; + TransactionId pd_prune_xid; /* oldest prunable XID, or zero if none */ + ItemIdData pd_linp[FLEXIBLE_ARRAY_MEMBER]; /* line pointer array */ +} PageHeaderData; + +typedef PageHeaderData *PageHeader; + +/* + * pd_flags contains the following flag bits. Undefined bits are initialized + * to zero and may be used in the future. + * + * PD_HAS_FREE_LINES is set if there are any LP_UNUSED line pointers before + * pd_lower. This should be considered a hint rather than the truth, since + * changes to it are not WAL-logged. + * + * PD_PAGE_FULL is set if an UPDATE doesn't find enough free space in the + * page for its new tuple version; this suggests that a prune is needed. + * Again, this is just a hint. + */ +#define PD_HAS_FREE_LINES 0x0001 /* are there any unused line pointers? */ +#define PD_PAGE_FULL 0x0002 /* not enough free space for new tuple? */ +#define PD_ALL_VISIBLE 0x0004 /* all tuples on page are visible to + * everyone */ + +#define PD_VALID_FLAG_BITS 0x0007 /* OR of all valid pd_flags bits */ + +/* + * Page layout version number 0 is for pre-7.3 Postgres releases. + * Releases 7.3 and 7.4 use 1, denoting a new HeapTupleHeader layout. + * Release 8.0 uses 2; it changed the HeapTupleHeader layout again. + * Release 8.1 uses 3; it redefined HeapTupleHeader infomask bits. + * Release 8.3 uses 4; it changed the HeapTupleHeader layout again, and + * added the pd_flags field (by stealing some bits from pd_tli), + * as well as adding the pd_prune_xid field (which enlarges the header). + * + * As of Release 9.3, the checksum version must also be considered when + * handling pages. + */ +#define PG_PAGE_LAYOUT_VERSION 4 +#define PG_DATA_CHECKSUM_VERSION 1 + +/* ---------------------------------------------------------------- + * page support functions + * ---------------------------------------------------------------- + */ + +/* + * line pointer(s) do not count as part of header + */ +#define SizeOfPageHeaderData (offsetof(PageHeaderData, pd_linp)) + +/* + * PageIsEmpty + * returns true iff no itemid has been allocated on the page + */ +static inline bool +PageIsEmpty(const PageData *page) +{ + return ((const PageHeaderData *) page)->pd_lower <= SizeOfPageHeaderData; +} + +/* + * PageIsNew + * returns true iff page has not been initialized (by PageInit) + */ +static inline bool +PageIsNew(const PageData *page) +{ + return ((const PageHeaderData *) page)->pd_upper == 0; +} + +/* + * PageGetItemId + * Returns an item identifier of a page. + */ +static inline ItemId +PageGetItemId(Page page, OffsetNumber offsetNumber) +{ + return &((PageHeader) page)->pd_linp[offsetNumber - 1]; +} + +/* + * PageGetContents + * To be used in cases where the page does not contain line pointers. + * + * Note: prior to 8.3 this was not guaranteed to yield a MAXALIGN'd result. + * Now it is. Beware of old code that might think the offset to the contents + * is just SizeOfPageHeaderData rather than MAXALIGN(SizeOfPageHeaderData). + */ +static inline char * +PageGetContents(Page page) +{ + return (char *) page + MAXALIGN(SizeOfPageHeaderData); +} + +/* ---------------- + * functions to access page size info + * ---------------- + */ + +/* + * PageGetPageSize + * Returns the page size of a page. + * + * this can only be called on a formatted page (unlike + * BufferGetPageSize, which can be called on an unformatted page). + * however, it can be called on a page that is not stored in a buffer. + */ +static inline Size +PageGetPageSize(const PageData *page) +{ + return (Size) (((const PageHeaderData *) page)->pd_pagesize_version & (uint16) 0xFF00); +} + +/* + * PageGetPageLayoutVersion + * Returns the page layout version of a page. + */ +static inline uint8 +PageGetPageLayoutVersion(const PageData *page) +{ + return (((const PageHeaderData *) page)->pd_pagesize_version & 0x00FF); +} + +/* + * PageSetPageSizeAndVersion + * Sets the page size and page layout version number of a page. + * + * We could support setting these two values separately, but there's + * no real need for it at the moment. + */ +static inline void +PageSetPageSizeAndVersion(Page page, Size size, uint8 version) +{ + Assert((size & 0xFF00) == size); + Assert((version & 0x00FF) == version); + + ((PageHeader) page)->pd_pagesize_version = size | version; +} + +/* ---------------- + * page special data functions + * ---------------- + */ +/* + * PageGetSpecialSize + * Returns size of special space on a page. + */ +static inline uint16 +PageGetSpecialSize(const PageData *page) +{ + return (PageGetPageSize(page) - ((const PageHeaderData *) page)->pd_special); +} + +/* + * Using assertions, validate that the page special pointer is OK. + * + * This is intended to catch use of the pointer before page initialization. + */ +static inline void +PageValidateSpecialPointer(const PageData *page) +{ + Assert(page); + Assert(((const PageHeaderData *) page)->pd_special <= BLCKSZ); + Assert(((const PageHeaderData *) page)->pd_special >= SizeOfPageHeaderData); +} + +/* + * PageGetSpecialPointer + * Returns pointer to special space on a page. + */ +#define PageGetSpecialPointer(page) \ +( \ + PageValidateSpecialPointer(page), \ + ((page) + ((PageHeader) (page))->pd_special) \ +) + +/* + * PageGetItem + * Retrieves an item on the given page. + * + * Note: + * This does not change the status of any of the resources passed. + * The semantics may change in the future. + */ +static inline Item +PageGetItem(const PageData *page, const ItemIdData *itemId) +{ + Assert(page); + Assert(ItemIdHasStorage(itemId)); + + return (Item) (((const char *) page) + ItemIdGetOffset(itemId)); +} + +/* + * PageGetMaxOffsetNumber + * Returns the maximum offset number used by the given page. + * Since offset numbers are 1-based, this is also the number + * of items on the page. + * + * NOTE: if the page is not initialized (pd_lower == 0), we must + * return zero to ensure sane behavior. + */ +static inline OffsetNumber +PageGetMaxOffsetNumber(const PageData *page) +{ + const PageHeaderData *pageheader = (const PageHeaderData *) page; + + if (pageheader->pd_lower <= SizeOfPageHeaderData) + return 0; + else + return (pageheader->pd_lower - SizeOfPageHeaderData) / sizeof(ItemIdData); +} + +/* + * Additional functions for access to page headers. + */ +static inline XLogRecPtr +PageGetLSN(const PageData *page) +{ + return PageXLogRecPtrGet(((const PageHeaderData *) page)->pd_lsn); +} +static inline void +PageSetLSN(Page page, XLogRecPtr lsn) +{ + PageXLogRecPtrSet(((PageHeader) page)->pd_lsn, lsn); +} + +static inline bool +PageHasFreeLinePointers(const PageData *page) +{ + return ((const PageHeaderData *) page)->pd_flags & PD_HAS_FREE_LINES; +} +static inline void +PageSetHasFreeLinePointers(Page page) +{ + ((PageHeader) page)->pd_flags |= PD_HAS_FREE_LINES; +} +static inline void +PageClearHasFreeLinePointers(Page page) +{ + ((PageHeader) page)->pd_flags &= ~PD_HAS_FREE_LINES; +} + +static inline bool +PageIsFull(const PageData *page) +{ + return ((const PageHeaderData *) page)->pd_flags & PD_PAGE_FULL; +} +static inline void +PageSetFull(Page page) +{ + ((PageHeader) page)->pd_flags |= PD_PAGE_FULL; +} +static inline void +PageClearFull(Page page) +{ + ((PageHeader) page)->pd_flags &= ~PD_PAGE_FULL; +} + +static inline bool +PageIsAllVisible(const PageData *page) +{ + return ((const PageHeaderData *) page)->pd_flags & PD_ALL_VISIBLE; +} +static inline void +PageSetAllVisible(Page page) +{ + ((PageHeader) page)->pd_flags |= PD_ALL_VISIBLE; +} +static inline void +PageClearAllVisible(Page page) +{ + ((PageHeader) page)->pd_flags &= ~PD_ALL_VISIBLE; +} + +/* + * These two require "access/transam.h", so left as macros. + */ +#define PageSetPrunable(page, xid) \ +do { \ + Assert(TransactionIdIsNormal(xid)); \ + if (!TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) || \ + TransactionIdPrecedes(xid, ((PageHeader) (page))->pd_prune_xid)) \ + ((PageHeader) (page))->pd_prune_xid = (xid); \ +} while (0) +#define PageClearPrunable(page) \ + (((PageHeader) (page))->pd_prune_xid = InvalidTransactionId) + + +/* ---------------------------------------------------------------- + * extern declarations + * ---------------------------------------------------------------- + */ + +/* flags for PageAddItemExtended() */ +#define PAI_OVERWRITE (1 << 0) +#define PAI_IS_HEAP (1 << 1) + +/* flags for PageIsVerified() */ +#define PIV_LOG_WARNING (1 << 0) +#define PIV_LOG_LOG (1 << 1) +#define PIV_IGNORE_CHECKSUM_FAILURE (1 << 2) + +#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap) \ + PageAddItemExtended(page, item, size, offsetNumber, \ + ((overwrite) ? PAI_OVERWRITE : 0) | \ + ((is_heap) ? PAI_IS_HEAP : 0)) + +/* + * Check that BLCKSZ is a multiple of sizeof(size_t). In PageIsVerified(), it + * is much faster to check if a page is full of zeroes using the native word + * size. Note that this assertion is kept within a header to make sure that + * StaticAssertDecl() works across various combinations of platforms and + * compilers. + */ +StaticAssertDecl(BLCKSZ == ((BLCKSZ / sizeof(size_t)) * sizeof(size_t)), + "BLCKSZ has to be a multiple of sizeof(size_t)"); + +extern void PageInit(Page page, Size pageSize, Size specialSize); +extern bool PageIsVerified(PageData *page, BlockNumber blkno, int flags, + bool *checksum_failure_p); +extern OffsetNumber PageAddItemExtended(Page page, Item item, Size size, + OffsetNumber offsetNumber, int flags); +extern Page PageGetTempPage(const PageData *page); +extern Page PageGetTempPageCopy(const PageData *page); +extern Page PageGetTempPageCopySpecial(const PageData *page); +extern void PageRestoreTempPage(Page tempPage, Page oldPage); +extern void PageRepairFragmentation(Page page); +extern void PageTruncateLinePointerArray(Page page); +extern Size PageGetFreeSpace(const PageData *page); +extern Size PageGetFreeSpaceForMultipleTuples(const PageData *page, int ntups); +extern Size PageGetExactFreeSpace(const PageData *page); +extern Size PageGetHeapFreeSpace(const PageData *page); +extern void PageIndexTupleDelete(Page page, OffsetNumber offnum); +extern void PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems); +extern void PageIndexTupleDeleteNoCompact(Page page, OffsetNumber offnum); +extern bool PageIndexTupleOverwrite(Page page, OffsetNumber offnum, + Item newtup, Size newsize); +extern char *PageSetChecksumCopy(Page page, BlockNumber blkno); +extern void PageSetChecksumInplace(Page page, BlockNumber blkno); + +#endif /* BUFPAGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/bulk_write.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/bulk_write.h new file mode 100644 index 0000000..7885415 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/bulk_write.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * bulk_write.h + * Efficiently and reliably populate a new relation + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/bulk_write.h + * + *------------------------------------------------------------------------- + */ +#ifndef BULK_WRITE_H +#define BULK_WRITE_H + +#include "storage/smgr.h" +#include "utils/rel.h" + +/* Bulk writer state, contents are private to bulk_write.c */ +typedef struct BulkWriteState BulkWriteState; + +/* + * Temporary buffer to hold a page to until it's written out. Use + * smgr_bulk_get_buf() to reserve one of these. This is a separate typedef to + * distinguish it from other block-sized buffers passed around in the system. + */ +typedef PGIOAlignedBlock *BulkWriteBuffer; + +/* forward declared from smgr.h */ +struct SMgrRelationData; + +extern BulkWriteState *smgr_bulk_start_rel(Relation rel, ForkNumber forknum); +extern BulkWriteState *smgr_bulk_start_smgr(struct SMgrRelationData *smgr, ForkNumber forknum, bool use_wal); + +extern BulkWriteBuffer smgr_bulk_get_buf(BulkWriteState *bulkstate); +extern void smgr_bulk_write(BulkWriteState *bulkstate, BlockNumber blocknum, BulkWriteBuffer buf, bool page_std); + +extern void smgr_bulk_finish(BulkWriteState *bulkstate); + +#endif /* BULK_WRITE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/checksum.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/checksum.h new file mode 100644 index 0000000..25d13a7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/checksum.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * checksum.h + * Checksum implementation for data pages. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/checksum.h + * + *------------------------------------------------------------------------- + */ +#ifndef CHECKSUM_H +#define CHECKSUM_H + +#include "storage/block.h" + +/* + * Compute the checksum for a Postgres page. The page must be aligned on a + * 4-byte boundary. + */ +extern uint16 pg_checksum_page(char *page, BlockNumber blkno); + +#endif /* CHECKSUM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/checksum_impl.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/checksum_impl.h new file mode 100644 index 0000000..da87d61 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/checksum_impl.h @@ -0,0 +1,215 @@ +/*------------------------------------------------------------------------- + * + * checksum_impl.h + * Checksum implementation for data pages. + * + * This file exists for the benefit of external programs that may wish to + * check Postgres page checksums. They can #include this to get the code + * referenced by storage/checksum.h. (Note: you may need to redefine + * Assert() as empty to compile this successfully externally.) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/checksum_impl.h + * + *------------------------------------------------------------------------- + */ + +/* + * The algorithm used to checksum pages is chosen for very fast calculation. + * Workloads where the database working set fits into OS file cache but not + * into shared buffers can read in pages at a very fast pace and the checksum + * algorithm itself can become the largest bottleneck. + * + * The checksum algorithm itself is based on the FNV-1a hash (FNV is shorthand + * for Fowler/Noll/Vo). The primitive of a plain FNV-1a hash folds in data 1 + * byte at a time according to the formula: + * + * hash = (hash ^ value) * FNV_PRIME + * + * FNV-1a algorithm is described at http://www.isthe.com/chongo/tech/comp/fnv/ + * + * PostgreSQL doesn't use FNV-1a hash directly because it has bad mixing of + * high bits - high order bits in input data only affect high order bits in + * output data. To resolve this we xor in the value prior to multiplication + * shifted right by 17 bits. The number 17 was chosen because it doesn't + * have common denominator with set bit positions in FNV_PRIME and empirically + * provides the fastest mixing for high order bits of final iterations quickly + * avalanche into lower positions. For performance reasons we choose to combine + * 4 bytes at a time. The actual hash formula used as the basis is: + * + * hash = (hash ^ value) * FNV_PRIME ^ ((hash ^ value) >> 17) + * + * The main bottleneck in this calculation is the multiplication latency. To + * hide the latency and to make use of SIMD parallelism multiple hash values + * are calculated in parallel. The page is treated as a 32 column two + * dimensional array of 32 bit values. Each column is aggregated separately + * into a partial checksum. Each partial checksum uses a different initial + * value (offset basis in FNV terminology). The initial values actually used + * were chosen randomly, as the values themselves don't matter as much as that + * they are different and don't match anything in real data. After initializing + * partial checksums each value in the column is aggregated according to the + * above formula. Finally two more iterations of the formula are performed with + * value 0 to mix the bits of the last value added. + * + * The partial checksums are then folded together using xor to form a single + * 32-bit checksum. The caller can safely reduce the value to 16 bits + * using modulo 2^16-1. That will cause a very slight bias towards lower + * values but this is not significant for the performance of the + * checksum. + * + * The algorithm choice was based on what instructions are available in SIMD + * instruction sets. This meant that a fast and good algorithm needed to use + * multiplication as the main mixing operator. The simplest multiplication + * based checksum primitive is the one used by FNV. The prime used is chosen + * for good dispersion of values. It has no known simple patterns that result + * in collisions. Test of 5-bit differentials of the primitive over 64bit keys + * reveals no differentials with 3 or more values out of 100000 random keys + * colliding. Avalanche test shows that only high order bits of the last word + * have a bias. Tests of 1-4 uncorrelated bit errors, stray 0 and 0xFF bytes, + * overwriting page from random position to end with 0 bytes, and overwriting + * random segments of page with 0x00, 0xFF and random data all show optimal + * 2e-16 false positive rate within margin of error. + * + * Vectorization of the algorithm requires 32bit x 32bit -> 32bit integer + * multiplication instruction. As of 2013 the corresponding instruction is + * available on x86 SSE4.1 extensions (pmulld) and ARM NEON (vmul.i32). + * Vectorization requires a compiler to do the vectorization for us. For recent + * GCC versions the flags -msse4.1 -funroll-loops -ftree-vectorize are enough + * to achieve vectorization. + * + * The optimal amount of parallelism to use depends on CPU specific instruction + * latency, SIMD instruction width, throughput and the amount of registers + * available to hold intermediate state. Generally, more parallelism is better + * up to the point that state doesn't fit in registers and extra load-store + * instructions are needed to swap values in/out. The number chosen is a fixed + * part of the algorithm because changing the parallelism changes the checksum + * result. + * + * The parallelism number 32 was chosen based on the fact that it is the + * largest state that fits into architecturally visible x86 SSE registers while + * leaving some free registers for intermediate values. For future processors + * with 256bit vector registers this will leave some performance on the table. + * When vectorization is not available it might be beneficial to restructure + * the computation to calculate a subset of the columns at a time and perform + * multiple passes to avoid register spilling. This optimization opportunity + * is not used. Current coding also assumes that the compiler has the ability + * to unroll the inner loop to avoid loop overhead and minimize register + * spilling. For less sophisticated compilers it might be beneficial to + * manually unroll the inner loop. + */ + +#include "storage/bufpage.h" + +/* number of checksums to calculate in parallel */ +#define N_SUMS 32 +/* prime multiplier of FNV-1a hash */ +#define FNV_PRIME 16777619 + +/* Use a union so that this code is valid under strict aliasing */ +typedef union +{ + PageHeaderData phdr; + uint32 data[BLCKSZ / (sizeof(uint32) * N_SUMS)][N_SUMS]; +} PGChecksummablePage; + +/* + * Base offsets to initialize each of the parallel FNV hashes into a + * different initial state. + */ +static const uint32 checksumBaseOffsets[N_SUMS] = { + 0x5B1F36E9, 0xB8525960, 0x02AB50AA, 0x1DE66D2A, + 0x79FF467A, 0x9BB9F8A3, 0x217E7CD2, 0x83E13D2C, + 0xF8D4474F, 0xE39EB970, 0x42C6AE16, 0x993216FA, + 0x7B093B5D, 0x98DAFF3C, 0xF718902A, 0x0B1C9CDB, + 0xE58F764B, 0x187636BC, 0x5D7B3BB1, 0xE73DE7DE, + 0x92BEC979, 0xCCA6C0B2, 0x304A0979, 0x85AA43D4, + 0x783125BB, 0x6CA8EAA2, 0xE407EAC6, 0x4B5CFC3E, + 0x9FBF8C76, 0x15CA20BE, 0xF2CA9FD3, 0x959BD756 +}; + +/* + * Calculate one round of the checksum. + */ +#define CHECKSUM_COMP(checksum, value) \ +do { \ + uint32 __tmp = (checksum) ^ (value); \ + (checksum) = __tmp * FNV_PRIME ^ (__tmp >> 17); \ +} while (0) + +/* + * Block checksum algorithm. The page must be adequately aligned + * (at least on 4-byte boundary). + */ +static uint32 +pg_checksum_block(const PGChecksummablePage *page) +{ + uint32 sums[N_SUMS]; + uint32 result = 0; + uint32 i, + j; + + /* ensure that the size is compatible with the algorithm */ + Assert(sizeof(PGChecksummablePage) == BLCKSZ); + + /* initialize partial checksums to their corresponding offsets */ + memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets)); + + /* main checksum calculation */ + for (i = 0; i < (uint32) (BLCKSZ / (sizeof(uint32) * N_SUMS)); i++) + for (j = 0; j < N_SUMS; j++) + CHECKSUM_COMP(sums[j], page->data[i][j]); + + /* finally add in two rounds of zeroes for additional mixing */ + for (i = 0; i < 2; i++) + for (j = 0; j < N_SUMS; j++) + CHECKSUM_COMP(sums[j], 0); + + /* xor fold partial checksums together */ + for (i = 0; i < N_SUMS; i++) + result ^= sums[i]; + + return result; +} + +/* + * Compute the checksum for a Postgres page. + * + * The page must be adequately aligned (at least on a 4-byte boundary). + * Beware also that the checksum field of the page is transiently zeroed. + * + * The checksum includes the block number (to detect the case where a page is + * somehow moved to a different location), the page header (excluding the + * checksum itself), and the page data. + */ +uint16 +pg_checksum_page(char *page, BlockNumber blkno) +{ + PGChecksummablePage *cpage = (PGChecksummablePage *) page; + uint16 save_checksum; + uint32 checksum; + + /* We only calculate the checksum for properly-initialized pages */ + Assert(!PageIsNew((Page) page)); + + /* + * Save pd_checksum and temporarily set it to zero, so that the checksum + * calculation isn't affected by the old checksum stored on the page. + * Restore it after, because actually updating the checksum is NOT part of + * the API of this function. + */ + save_checksum = cpage->phdr.pd_checksum; + cpage->phdr.pd_checksum = 0; + checksum = pg_checksum_block(cpage); + cpage->phdr.pd_checksum = save_checksum; + + /* Mix in the block number to detect transposed pages */ + checksum ^= blkno; + + /* + * Reduce to a uint16 (to fit in the pd_checksum field) with an offset of + * one. That avoids checksums of zero, which seems like a good idea. + */ + return (uint16) ((checksum % 65535) + 1); +} diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/condition_variable.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/condition_variable.h new file mode 100644 index 0000000..526c4ee --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/condition_variable.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------- + * + * condition_variable.h + * Condition variables + * + * A condition variable is a method of waiting until a certain condition + * becomes true. Conventionally, a condition variable supports three + * operations: (1) sleep; (2) signal, which wakes up one process sleeping + * on the condition variable; and (3) broadcast, which wakes up every + * process sleeping on the condition variable. In our implementation, + * condition variables put a process into an interruptible sleep (so it + * can be canceled prior to the fulfillment of the condition) and do not + * use pointers internally (so that they are safe to use within DSMs). + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/condition_variable.h + * + *------------------------------------------------------------------------- + */ +#ifndef CONDITION_VARIABLE_H +#define CONDITION_VARIABLE_H + +#include "storage/proclist_types.h" +#include "storage/spin.h" + +typedef struct +{ + slock_t mutex; /* spinlock protecting the wakeup list */ + proclist_head wakeup; /* list of wake-able processes */ +} ConditionVariable; + +/* + * Pad a condition variable to a power-of-two size so that an array of + * condition variables does not cross a cache line boundary. + */ +#define CV_MINIMAL_SIZE (sizeof(ConditionVariable) <= 16 ? 16 : 32) +typedef union ConditionVariableMinimallyPadded +{ + ConditionVariable cv; + char pad[CV_MINIMAL_SIZE]; +} ConditionVariableMinimallyPadded; + +/* Initialize a condition variable. */ +extern void ConditionVariableInit(ConditionVariable *cv); + +/* + * To sleep on a condition variable, a process should use a loop which first + * checks the condition, exiting the loop if it is met, and then calls + * ConditionVariableSleep. Spurious wakeups are possible, but should be + * infrequent. After exiting the loop, ConditionVariableCancelSleep must + * be called to ensure that the process is no longer in the wait list for + * the condition variable. + */ +extern void ConditionVariableSleep(ConditionVariable *cv, uint32 wait_event_info); +extern bool ConditionVariableTimedSleep(ConditionVariable *cv, long timeout, + uint32 wait_event_info); +extern bool ConditionVariableCancelSleep(void); + +/* + * Optionally, ConditionVariablePrepareToSleep can be called before entering + * the test-and-sleep loop described above. Doing so is more efficient if + * at least one sleep is needed, whereas not doing so is more efficient when + * no sleep is needed because the test condition is true the first time. + */ +extern void ConditionVariablePrepareToSleep(ConditionVariable *cv); + +/* Wake up a single waiter (via signal) or all waiters (via broadcast). */ +extern void ConditionVariableSignal(ConditionVariable *cv); +extern void ConditionVariableBroadcast(ConditionVariable *cv); + +#endif /* CONDITION_VARIABLE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/copydir.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/copydir.h new file mode 100644 index 0000000..f1d7bee --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/copydir.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * copydir.h + * Copy a directory. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/copydir.h + * + *------------------------------------------------------------------------- + */ +#ifndef COPYDIR_H +#define COPYDIR_H + +typedef enum FileCopyMethod +{ + FILE_COPY_METHOD_COPY, + FILE_COPY_METHOD_CLONE, +} FileCopyMethod; + +/* GUC parameters */ +extern PGDLLIMPORT int file_copy_method; + +extern void copydir(const char *fromdir, const char *todir, bool recurse); +extern void copy_file(const char *fromfile, const char *tofile); + +#endif /* COPYDIR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/dsm.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/dsm.h new file mode 100644 index 0000000..2302cc7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/dsm.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * dsm.h + * manage dynamic shared memory segments + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/dsm.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSM_H +#define DSM_H + +#include "storage/dsm_impl.h" + +typedef struct dsm_segment dsm_segment; + +#define DSM_CREATE_NULL_IF_MAXSEGMENTS 0x0001 + +/* Startup and shutdown functions. */ +struct PGShmemHeader; /* avoid including pg_shmem.h */ +extern void dsm_cleanup_using_control_segment(dsm_handle old_control_handle); +extern void dsm_postmaster_startup(struct PGShmemHeader *); +extern void dsm_backend_shutdown(void); +extern void dsm_detach_all(void); + +extern size_t dsm_estimate_size(void); +extern void dsm_shmem_init(void); + +#ifdef EXEC_BACKEND +extern void dsm_set_control_handle(dsm_handle h); +#endif + +/* Functions that create or remove mappings. */ +extern dsm_segment *dsm_create(Size size, int flags); +extern dsm_segment *dsm_attach(dsm_handle h); +extern void dsm_detach(dsm_segment *seg); + +/* Resource management functions. */ +extern void dsm_pin_mapping(dsm_segment *seg); +extern void dsm_unpin_mapping(dsm_segment *seg); +extern void dsm_pin_segment(dsm_segment *seg); +extern void dsm_unpin_segment(dsm_handle handle); +extern dsm_segment *dsm_find_mapping(dsm_handle handle); + +/* Informational functions. */ +extern void *dsm_segment_address(dsm_segment *seg); +extern Size dsm_segment_map_length(dsm_segment *seg); +extern dsm_handle dsm_segment_handle(dsm_segment *seg); + +/* Cleanup hooks. */ +typedef void (*on_dsm_detach_callback) (dsm_segment *, Datum arg); +extern void on_dsm_detach(dsm_segment *seg, + on_dsm_detach_callback function, Datum arg); +extern void cancel_on_dsm_detach(dsm_segment *seg, + on_dsm_detach_callback function, Datum arg); +extern void reset_on_dsm_detach(void); + +#endif /* DSM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/dsm_impl.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/dsm_impl.h new file mode 100644 index 0000000..7248cb1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/dsm_impl.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------------------- + * + * dsm_impl.h + * low-level dynamic shared memory primitives + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/dsm_impl.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSM_IMPL_H +#define DSM_IMPL_H + +/* Dynamic shared memory implementations. */ +#define DSM_IMPL_POSIX 1 +#define DSM_IMPL_SYSV 2 +#define DSM_IMPL_WINDOWS 3 +#define DSM_IMPL_MMAP 4 + +/* + * Determine which dynamic shared memory implementations will be supported + * on this platform, and which one will be the default. + */ +#ifdef WIN32 +#define USE_DSM_WINDOWS +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_WINDOWS +#else +#ifdef HAVE_SHM_OPEN +#define USE_DSM_POSIX +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_POSIX +#endif +#define USE_DSM_SYSV +#ifndef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV +#endif +#define USE_DSM_MMAP +#endif + +/* GUC. */ +extern PGDLLIMPORT int dynamic_shared_memory_type; +extern PGDLLIMPORT int min_dynamic_shared_memory; + +/* + * Directory for on-disk state. + * + * This is used by all implementations for crash recovery and by the mmap + * implementation for storage. + */ +#define PG_DYNSHMEM_DIR "pg_dynshmem" +#define PG_DYNSHMEM_MMAP_FILE_PREFIX "mmap." + +/* A "name" for a dynamic shared memory segment. */ +typedef uint32 dsm_handle; + +/* Sentinel value to use for invalid DSM handles. */ +#define DSM_HANDLE_INVALID ((dsm_handle) 0) + +/* All the shared-memory operations we know about. */ +typedef enum +{ + DSM_OP_CREATE, + DSM_OP_ATTACH, + DSM_OP_DETACH, + DSM_OP_DESTROY, +} dsm_op; + +/* Create, attach to, detach from, resize, or destroy a segment. */ +extern bool dsm_impl_op(dsm_op op, dsm_handle handle, Size request_size, + void **impl_private, void **mapped_address, Size *mapped_size, + int elevel); + +/* Implementation-dependent actions required to keep segment until shutdown. */ +extern void dsm_impl_pin_segment(dsm_handle handle, void *impl_private, + void **impl_private_pm_handle); +extern void dsm_impl_unpin_segment(dsm_handle handle, void **impl_private); + +#endif /* DSM_IMPL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/dsm_registry.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/dsm_registry.h new file mode 100644 index 0000000..b381e44 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/dsm_registry.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * dsm_registry.h + * Functions for interfacing with the dynamic shared memory registry. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/dsm_registry.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSM_REGISTRY_H +#define DSM_REGISTRY_H + +extern void *GetNamedDSMSegment(const char *name, size_t size, + void (*init_callback) (void *ptr), + bool *found); + +extern Size DSMRegistryShmemSize(void); +extern void DSMRegistryShmemInit(void); + +#endif /* DSM_REGISTRY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/fd.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/fd.h new file mode 100644 index 0000000..75aee33 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/fd.h @@ -0,0 +1,233 @@ +/*------------------------------------------------------------------------- + * + * fd.h + * Virtual file descriptor definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/fd.h + * + *------------------------------------------------------------------------- + */ + +/* + * calls: + * + * File {Close, Read, ReadV, Write, WriteV, Size, Sync} + * {Path Name Open, Allocate, Free} File + * + * These are NOT JUST RENAMINGS OF THE UNIX ROUTINES. + * Use them for all file activity... + * + * File fd; + * fd = PathNameOpenFile("foo", O_RDONLY); + * + * AllocateFile(); + * FreeFile(); + * + * Use AllocateFile, not fopen, if you need a stdio file (FILE*); then + * use FreeFile, not fclose, to close it. AVOID using stdio for files + * that you intend to hold open for any length of time, since there is + * no way for them to share kernel file descriptors with other files. + * + * Likewise, use AllocateDir/FreeDir, not opendir/closedir, to allocate + * open directories (DIR*), and OpenTransientFile/CloseTransientFile for an + * unbuffered file descriptor. + * + * If you really can't use any of the above, at least call AcquireExternalFD + * or ReserveExternalFD to report any file descriptors that are held for any + * length of time. Failure to do so risks unnecessary EMFILE errors. + */ +#ifndef FD_H +#define FD_H + +#include "port/pg_iovec.h" + +#include +#include + +typedef int File; + + +#define IO_DIRECT_DATA 0x01 +#define IO_DIRECT_WAL 0x02 +#define IO_DIRECT_WAL_INIT 0x04 + +enum FileExtendMethod +{ +#ifdef HAVE_POSIX_FALLOCATE + FILE_EXTEND_METHOD_POSIX_FALLOCATE, +#endif + FILE_EXTEND_METHOD_WRITE_ZEROS, +}; + +/* Default to the first available file_extend_method. */ +#define DEFAULT_FILE_EXTEND_METHOD 0 + +/* GUC parameter */ +extern PGDLLIMPORT int max_files_per_process; +extern PGDLLIMPORT bool data_sync_retry; +extern PGDLLIMPORT int recovery_init_sync_method; +extern PGDLLIMPORT int io_direct_flags; +extern PGDLLIMPORT int file_extend_method; + +/* + * This is private to fd.c, but exported for save/restore_backend_variables() + */ +extern PGDLLIMPORT int max_safe_fds; + +/* + * On Windows, we have to interpret EACCES as possibly meaning the same as + * ENOENT, because if a file is unlinked-but-not-yet-gone on that platform, + * that's what you get. Ugh. This code is designed so that we don't + * actually believe these cases are okay without further evidence (namely, + * a pending fsync request getting canceled ... see ProcessSyncRequests). + */ +#ifndef WIN32 +#define FILE_POSSIBLY_DELETED(err) ((err) == ENOENT) +#else +#define FILE_POSSIBLY_DELETED(err) ((err) == ENOENT || (err) == EACCES) +#endif + +/* + * O_DIRECT is not standard, but almost every Unix has it. We translate it + * to the appropriate Windows flag in src/port/open.c. We simulate it with + * fcntl(F_NOCACHE) on macOS inside fd.c's open() wrapper. We use the name + * PG_O_DIRECT rather than defining O_DIRECT in that case (probably not a good + * idea on a Unix). We can only use it if the compiler will correctly align + * PGIOAlignedBlock for us, though. + */ +#if defined(O_DIRECT) && defined(pg_attribute_aligned) +#define PG_O_DIRECT O_DIRECT +#elif defined(F_NOCACHE) +#define PG_O_DIRECT 0x80000000 +#define PG_O_DIRECT_USE_F_NOCACHE +#else +#define PG_O_DIRECT 0 +#endif + +/* + * prototypes for functions in fd.c + */ + +struct PgAioHandle; + +/* Operations on virtual Files --- equivalent to Unix kernel file ops */ +extern File PathNameOpenFile(const char *fileName, int fileFlags); +extern File PathNameOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode); +extern File OpenTemporaryFile(bool interXact); +extern void FileClose(File file); +extern int FilePrefetch(File file, off_t offset, off_t amount, uint32 wait_event_info); +extern ssize_t FileReadV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info); +extern ssize_t FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info); +extern int FileStartReadV(struct PgAioHandle *ioh, File file, int iovcnt, off_t offset, uint32 wait_event_info); +extern int FileSync(File file, uint32 wait_event_info); +extern int FileZero(File file, off_t offset, off_t amount, uint32 wait_event_info); +extern int FileFallocate(File file, off_t offset, off_t amount, uint32 wait_event_info); + +extern off_t FileSize(File file); +extern int FileTruncate(File file, off_t offset, uint32 wait_event_info); +extern void FileWriteback(File file, off_t offset, off_t nbytes, uint32 wait_event_info); +extern char *FilePathName(File file); +extern int FileGetRawDesc(File file); +extern int FileGetRawFlags(File file); +extern mode_t FileGetRawMode(File file); + +/* Operations used for sharing named temporary files */ +extern File PathNameCreateTemporaryFile(const char *path, bool error_on_failure); +extern File PathNameOpenTemporaryFile(const char *path, int mode); +extern bool PathNameDeleteTemporaryFile(const char *path, bool error_on_failure); +extern void PathNameCreateTemporaryDir(const char *basedir, const char *directory); +extern void PathNameDeleteTemporaryDir(const char *dirname); +extern void TempTablespacePath(char *path, Oid tablespace); + +/* Operations that allow use of regular stdio --- USE WITH CAUTION */ +extern FILE *AllocateFile(const char *name, const char *mode); +extern int FreeFile(FILE *file); + +/* Operations that allow use of pipe streams (popen/pclose) */ +extern FILE *OpenPipeStream(const char *command, const char *mode); +extern int ClosePipeStream(FILE *file); + +/* Operations to allow use of the library routines */ +extern DIR *AllocateDir(const char *dirname); +extern struct dirent *ReadDir(DIR *dir, const char *dirname); +extern struct dirent *ReadDirExtended(DIR *dir, const char *dirname, + int elevel); +extern int FreeDir(DIR *dir); + +/* Operations to allow use of a plain kernel FD, with automatic cleanup */ +extern int OpenTransientFile(const char *fileName, int fileFlags); +extern int OpenTransientFilePerm(const char *fileName, int fileFlags, mode_t fileMode); +extern int CloseTransientFile(int fd); + +/* If you've really really gotta have a plain kernel FD, use this */ +extern int BasicOpenFile(const char *fileName, int fileFlags); +extern int BasicOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode); + +/* Use these for other cases, and also for long-lived BasicOpenFile FDs */ +extern bool AcquireExternalFD(void); +extern void ReserveExternalFD(void); +extern void ReleaseExternalFD(void); + +/* Make a directory with default permissions */ +extern int MakePGDirectory(const char *directoryName); + +/* Miscellaneous support routines */ +extern void InitFileAccess(void); +extern void InitTemporaryFileAccess(void); +extern void set_max_safe_fds(void); +extern void closeAllVfds(void); +extern void SetTempTablespaces(Oid *tableSpaces, int numSpaces); +extern bool TempTablespacesAreSet(void); +extern int GetTempTablespaces(Oid *tableSpaces, int numSpaces); +extern Oid GetNextTempTableSpace(void); +extern void AtEOXact_Files(bool isCommit); +extern void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); +extern void RemovePgTempFiles(void); +extern void RemovePgTempFilesInDir(const char *tmpdirname, bool missing_ok, + bool unlink_all); +extern bool looks_like_temp_rel_name(const char *name); + +extern int pg_fsync(int fd); +extern int pg_fsync_no_writethrough(int fd); +extern int pg_fsync_writethrough(int fd); +extern int pg_fdatasync(int fd); +extern bool pg_file_exists(const char *name); +extern void pg_flush_data(int fd, off_t offset, off_t nbytes); +extern int pg_truncate(const char *path, off_t length); +extern void fsync_fname(const char *fname, bool isdir); +extern int fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel); +extern int durable_rename(const char *oldfile, const char *newfile, int elevel); +extern int durable_unlink(const char *fname, int elevel); +extern void SyncDataDirectory(void); +extern int data_sync_elevel(int elevel); + +static inline ssize_t +FileRead(File file, void *buffer, size_t amount, off_t offset, + uint32 wait_event_info) +{ + struct iovec iov = { + .iov_base = buffer, + .iov_len = amount + }; + + return FileReadV(file, &iov, 1, offset, wait_event_info); +} + +static inline ssize_t +FileWrite(File file, const void *buffer, size_t amount, off_t offset, + uint32 wait_event_info) +{ + struct iovec iov = { + .iov_base = unconstify(void *, buffer), + .iov_len = amount + }; + + return FileWriteV(file, &iov, 1, offset, wait_event_info); +} + +#endif /* FD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/fileset.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/fileset.h new file mode 100644 index 0000000..8025001 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/fileset.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * fileset.h + * Management of named temporary files. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/fileset.h + * + *------------------------------------------------------------------------- + */ + +#ifndef FILESET_H +#define FILESET_H + +#include "storage/fd.h" + +/* + * A set of temporary files. + */ +typedef struct FileSet +{ + pid_t creator_pid; /* PID of the creating process */ + uint32 number; /* per-PID identifier */ + int ntablespaces; /* number of tablespaces to use */ + Oid tablespaces[8]; /* OIDs of tablespaces to use. Assumes that + * it's rare that there more than temp + * tablespaces. */ +} FileSet; + +extern void FileSetInit(FileSet *fileset); +extern File FileSetCreate(FileSet *fileset, const char *name); +extern File FileSetOpen(FileSet *fileset, const char *name, + int mode); +extern bool FileSetDelete(FileSet *fileset, const char *name, + bool error_on_failure); +extern void FileSetDeleteAll(FileSet *fileset); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/freespace.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/freespace.h new file mode 100644 index 0000000..427cb6a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/freespace.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * freespace.h + * POSTGRES free space map for quickly finding free space in relations + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/freespace.h + * + *------------------------------------------------------------------------- + */ +#ifndef FREESPACE_H_ +#define FREESPACE_H_ + +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" + +/* prototypes for public functions in freespace.c */ +extern Size GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk); +extern BlockNumber GetPageWithFreeSpace(Relation rel, Size spaceNeeded); +extern BlockNumber RecordAndGetPageWithFreeSpace(Relation rel, + BlockNumber oldPage, + Size oldSpaceAvail, + Size spaceNeeded); +extern void RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, + Size spaceAvail); +extern void XLogRecordPageWithFreeSpace(RelFileLocator rlocator, BlockNumber heapBlk, + Size spaceAvail); + +extern BlockNumber FreeSpaceMapPrepareTruncateRel(Relation rel, + BlockNumber nblocks); +extern void FreeSpaceMapVacuum(Relation rel); +extern void FreeSpaceMapVacuumRange(Relation rel, BlockNumber start, + BlockNumber end); + +#endif /* FREESPACE_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/fsm_internals.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/fsm_internals.h new file mode 100644 index 0000000..77b48d1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/fsm_internals.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------------------- + * + * fsm_internals.h + * internal functions for free space map + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/fsm_internals.h + * + *------------------------------------------------------------------------- + */ +#ifndef FSM_INTERNALS_H +#define FSM_INTERNALS_H + +#include "storage/buf.h" +#include "storage/bufpage.h" + +/* + * Structure of a FSM page. See src/backend/storage/freespace/README for + * details. + */ +typedef struct +{ + /* + * fsm_search_avail() tries to spread the load of multiple backends by + * returning different pages to different backends in a round-robin + * fashion. fp_next_slot points to the next slot to be returned (assuming + * there's enough space on it for the request). It's defined as an int, + * because it's updated without an exclusive lock. uint16 would be more + * appropriate, but int is more likely to be atomically + * fetchable/storable. + */ + int fp_next_slot; + + /* + * fp_nodes contains the binary tree, stored in array. The first + * NonLeafNodesPerPage elements are upper nodes, and the following + * LeafNodesPerPage elements are leaf nodes. Unused nodes are zero. + */ + uint8 fp_nodes[FLEXIBLE_ARRAY_MEMBER]; +} FSMPageData; + +typedef FSMPageData *FSMPage; + +/* + * Number of non-leaf and leaf nodes, and nodes in total, on an FSM page. + * These definitions are internal to fsmpage.c. + */ +#define NodesPerPage (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - \ + offsetof(FSMPageData, fp_nodes)) + +#define NonLeafNodesPerPage (BLCKSZ / 2 - 1) +#define LeafNodesPerPage (NodesPerPage - NonLeafNodesPerPage) + +/* + * Number of FSM "slots" on a FSM page. This is what should be used + * outside fsmpage.c. + */ +#define SlotsPerFSMPage LeafNodesPerPage + +/* Prototypes for functions in fsmpage.c */ +extern int fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, + bool exclusive_lock_held); +extern uint8 fsm_get_avail(Page page, int slot); +extern uint8 fsm_get_max_avail(Page page); +extern bool fsm_set_avail(Page page, int slot, uint8 value); +extern bool fsm_truncate_avail(Page page, int nslots); +extern bool fsm_rebuild_page(Page page); + +#endif /* FSM_INTERNALS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/indexfsm.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/indexfsm.h new file mode 100644 index 0000000..39ebb42 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/indexfsm.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * indexfsm.h + * POSTGRES free space map for quickly finding an unused page in index + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/indexfsm.h + * + *------------------------------------------------------------------------- + */ +#ifndef INDEXFSM_H_ +#define INDEXFSM_H_ + +#include "storage/block.h" +#include "utils/relcache.h" + +extern BlockNumber GetFreeIndexPage(Relation rel); +extern void RecordFreeIndexPage(Relation rel, BlockNumber freeBlock); +extern void RecordUsedIndexPage(Relation rel, BlockNumber usedBlock); + +extern void IndexFreeSpaceMapVacuum(Relation rel); + +#endif /* INDEXFSM_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/io_worker.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/io_worker.h new file mode 100644 index 0000000..7bde7e8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/io_worker.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * io_worker.h + * IO worker for implementing AIO "ourselves" + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/io.h + * + *------------------------------------------------------------------------- + */ +#ifndef IO_WORKER_H +#define IO_WORKER_H + + +pg_noreturn extern void IoWorkerMain(const void *startup_data, size_t startup_data_len); + +extern PGDLLIMPORT int io_workers; + +#endif /* IO_WORKER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/ipc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/ipc.h new file mode 100644 index 0000000..3baf418 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/ipc.h @@ -0,0 +1,87 @@ +/*------------------------------------------------------------------------- + * + * ipc.h + * POSTGRES inter-process communication definitions. + * + * This file is misnamed, as it no longer has much of anything directly + * to do with IPC. The functionality here is concerned with managing + * exit-time cleanup for either a postmaster or a backend. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/ipc.h + * + *------------------------------------------------------------------------- + */ +#ifndef IPC_H +#define IPC_H + +typedef void (*pg_on_exit_callback) (int code, Datum arg); +typedef void (*shmem_startup_hook_type) (void); + +/*---------- + * API for handling cleanup that must occur during either ereport(ERROR) + * or ereport(FATAL) exits from a block of code. (Typical examples are + * undoing transient changes to shared-memory state.) + * + * PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg); + * { + * ... code that might throw ereport(ERROR) or ereport(FATAL) ... + * } + * PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg); + * + * where the cleanup code is in a function declared per pg_on_exit_callback. + * The Datum value "arg" can carry any information the cleanup function + * needs. + * + * This construct ensures that cleanup_function() will be called during + * either ERROR or FATAL exits. It will not be called on successful + * exit from the controlled code. (If you want it to happen then too, + * call the function yourself from just after the construct.) + * + * Note: the macro arguments are multiply evaluated, so avoid side-effects. + *---------- + */ +#define PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ + do { \ + before_shmem_exit(cleanup_function, arg); \ + PG_TRY() + +#define PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ + cancel_before_shmem_exit(cleanup_function, arg); \ + PG_CATCH(); \ + { \ + cancel_before_shmem_exit(cleanup_function, arg); \ + cleanup_function (0, arg); \ + PG_RE_THROW(); \ + } \ + PG_END_TRY(); \ + } while (0) + + +/* ipc.c */ +extern PGDLLIMPORT bool proc_exit_inprogress; +extern PGDLLIMPORT bool shmem_exit_inprogress; + +pg_noreturn extern void proc_exit(int code); +extern void shmem_exit(int code); +extern void on_proc_exit(pg_on_exit_callback function, Datum arg); +extern void on_shmem_exit(pg_on_exit_callback function, Datum arg); +extern void before_shmem_exit(pg_on_exit_callback function, Datum arg); +extern void cancel_before_shmem_exit(pg_on_exit_callback function, Datum arg); +extern void on_exit_reset(void); +extern void check_on_shmem_exit_lists_are_empty(void); + +/* ipci.c */ +extern PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook; + +extern Size CalculateShmemSize(int *num_semaphores); +extern void CreateSharedMemoryAndSemaphores(void); +#ifdef EXEC_BACKEND +extern void AttachSharedMemoryStructs(void); +#endif +extern void InitializeShmemGUCs(void); + +#endif /* IPC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/item.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/item.h new file mode 100644 index 0000000..5a4539c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/item.h @@ -0,0 +1,19 @@ +/*------------------------------------------------------------------------- + * + * item.h + * POSTGRES disk item definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/item.h + * + *------------------------------------------------------------------------- + */ +#ifndef ITEM_H +#define ITEM_H + +typedef Pointer Item; + +#endif /* ITEM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/itemid.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/itemid.h new file mode 100644 index 0000000..bfefaca --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/itemid.h @@ -0,0 +1,184 @@ +/*------------------------------------------------------------------------- + * + * itemid.h + * Standard POSTGRES buffer page item identifier/line pointer definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/itemid.h + * + *------------------------------------------------------------------------- + */ +#ifndef ITEMID_H +#define ITEMID_H + +/* + * A line pointer on a buffer page. See buffer page definitions and comments + * for an explanation of how line pointers are used. + * + * In some cases a line pointer is "in use" but does not have any associated + * storage on the page. By convention, lp_len == 0 in every line pointer + * that does not have storage, independently of its lp_flags state. + */ +typedef struct ItemIdData +{ + unsigned lp_off:15, /* offset to tuple (from start of page) */ + lp_flags:2, /* state of line pointer, see below */ + lp_len:15; /* byte length of tuple */ +} ItemIdData; + +typedef ItemIdData *ItemId; + +/* + * lp_flags has these possible states. An UNUSED line pointer is available + * for immediate re-use, the other states are not. + */ +#define LP_UNUSED 0 /* unused (should always have lp_len=0) */ +#define LP_NORMAL 1 /* used (should always have lp_len>0) */ +#define LP_REDIRECT 2 /* HOT redirect (should have lp_len=0) */ +#define LP_DEAD 3 /* dead, may or may not have storage */ + +/* + * Item offsets and lengths are represented by these types when + * they're not actually stored in an ItemIdData. + */ +typedef uint16 ItemOffset; +typedef uint16 ItemLength; + + +/* ---------------- + * support macros + * ---------------- + */ + +/* + * ItemIdGetLength + */ +#define ItemIdGetLength(itemId) \ + ((itemId)->lp_len) + +/* + * ItemIdGetOffset + */ +#define ItemIdGetOffset(itemId) \ + ((itemId)->lp_off) + +/* + * ItemIdGetFlags + */ +#define ItemIdGetFlags(itemId) \ + ((itemId)->lp_flags) + +/* + * ItemIdGetRedirect + * In a REDIRECT pointer, lp_off holds offset number for next line pointer + */ +#define ItemIdGetRedirect(itemId) \ + ((itemId)->lp_off) + +/* + * ItemIdIsValid + * True iff item identifier is valid. + * This is a pretty weak test, probably useful only in Asserts. + */ +#define ItemIdIsValid(itemId) PointerIsValid(itemId) + +/* + * ItemIdIsUsed + * True iff item identifier is in use. + */ +#define ItemIdIsUsed(itemId) \ + ((itemId)->lp_flags != LP_UNUSED) + +/* + * ItemIdIsNormal + * True iff item identifier is in state NORMAL. + */ +#define ItemIdIsNormal(itemId) \ + ((itemId)->lp_flags == LP_NORMAL) + +/* + * ItemIdIsRedirected + * True iff item identifier is in state REDIRECT. + */ +#define ItemIdIsRedirected(itemId) \ + ((itemId)->lp_flags == LP_REDIRECT) + +/* + * ItemIdIsDead + * True iff item identifier is in state DEAD. + */ +#define ItemIdIsDead(itemId) \ + ((itemId)->lp_flags == LP_DEAD) + +/* + * ItemIdHasStorage + * True iff item identifier has associated storage. + */ +#define ItemIdHasStorage(itemId) \ + ((itemId)->lp_len != 0) + +/* + * ItemIdSetUnused + * Set the item identifier to be UNUSED, with no storage. + * Beware of multiple evaluations of itemId! + */ +#define ItemIdSetUnused(itemId) \ +( \ + (itemId)->lp_flags = LP_UNUSED, \ + (itemId)->lp_off = 0, \ + (itemId)->lp_len = 0 \ +) + +/* + * ItemIdSetNormal + * Set the item identifier to be NORMAL, with the specified storage. + * Beware of multiple evaluations of itemId! + */ +#define ItemIdSetNormal(itemId, off, len) \ +( \ + (itemId)->lp_flags = LP_NORMAL, \ + (itemId)->lp_off = (off), \ + (itemId)->lp_len = (len) \ +) + +/* + * ItemIdSetRedirect + * Set the item identifier to be REDIRECT, with the specified link. + * Beware of multiple evaluations of itemId! + */ +#define ItemIdSetRedirect(itemId, link) \ +( \ + (itemId)->lp_flags = LP_REDIRECT, \ + (itemId)->lp_off = (link), \ + (itemId)->lp_len = 0 \ +) + +/* + * ItemIdSetDead + * Set the item identifier to be DEAD, with no storage. + * Beware of multiple evaluations of itemId! + */ +#define ItemIdSetDead(itemId) \ +( \ + (itemId)->lp_flags = LP_DEAD, \ + (itemId)->lp_off = 0, \ + (itemId)->lp_len = 0 \ +) + +/* + * ItemIdMarkDead + * Set the item identifier to be DEAD, keeping its existing storage. + * + * Note: in indexes, this is used as if it were a hint-bit mechanism; + * we trust that multiple processors can do this in parallel and get + * the same result. + */ +#define ItemIdMarkDead(itemId) \ +( \ + (itemId)->lp_flags = LP_DEAD \ +) + +#endif /* ITEMID_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/itemptr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/itemptr.h new file mode 100644 index 0000000..74b87a9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/itemptr.h @@ -0,0 +1,245 @@ +/*------------------------------------------------------------------------- + * + * itemptr.h + * POSTGRES disk item pointer definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/itemptr.h + * + *------------------------------------------------------------------------- + */ +#ifndef ITEMPTR_H +#define ITEMPTR_H + +#include "storage/block.h" +#include "storage/off.h" + +/* + * ItemPointer: + * + * This is a pointer to an item within a disk page of a known file + * (for example, a cross-link from an index to its parent table). + * ip_blkid tells us which block, ip_posid tells us which entry in + * the linp (ItemIdData) array we want. + * + * Note: because there is an item pointer in each tuple header and index + * tuple header on disk, it's very important not to waste space with + * structure padding bytes. The struct is designed to be six bytes long + * (it contains three int16 fields) but a few compilers will pad it to + * eight bytes unless coerced. We apply appropriate persuasion where + * possible. If your compiler can't be made to play along, you'll waste + * lots of space. + */ +typedef struct ItemPointerData +{ + BlockIdData ip_blkid; + OffsetNumber ip_posid; +} + +/* If compiler understands packed and aligned pragmas, use those */ +#if defined(pg_attribute_packed) && defined(pg_attribute_aligned) + pg_attribute_packed() + pg_attribute_aligned(2) +#endif +ItemPointerData; + +typedef ItemPointerData *ItemPointer; + +/* ---------------- + * special values used in heap tuples (t_ctid) + * ---------------- + */ + +/* + * If a heap tuple holds a speculative insertion token rather than a real + * TID, ip_posid is set to SpecTokenOffsetNumber, and the token is stored in + * ip_blkid. SpecTokenOffsetNumber must be higher than MaxOffsetNumber, so + * that it can be distinguished from a valid offset number in a regular item + * pointer. + */ +#define SpecTokenOffsetNumber 0xfffe + +/* + * When a tuple is moved to a different partition by UPDATE, the t_ctid of + * the old tuple version is set to this magic value. + */ +#define MovedPartitionsOffsetNumber 0xfffd +#define MovedPartitionsBlockNumber InvalidBlockNumber + + +/* ---------------- + * support functions + * ---------------- + */ + +/* + * ItemPointerIsValid + * True iff the disk item pointer is not NULL. + */ +static inline bool +ItemPointerIsValid(const ItemPointerData *pointer) +{ + return PointerIsValid(pointer) && pointer->ip_posid != 0; +} + +/* + * ItemPointerGetBlockNumberNoCheck + * Returns the block number of a disk item pointer. + */ +static inline BlockNumber +ItemPointerGetBlockNumberNoCheck(const ItemPointerData *pointer) +{ + return BlockIdGetBlockNumber(&pointer->ip_blkid); +} + +/* + * ItemPointerGetBlockNumber + * As above, but verifies that the item pointer looks valid. + */ +static inline BlockNumber +ItemPointerGetBlockNumber(const ItemPointerData *pointer) +{ + Assert(ItemPointerIsValid(pointer)); + return ItemPointerGetBlockNumberNoCheck(pointer); +} + +/* + * ItemPointerGetOffsetNumberNoCheck + * Returns the offset number of a disk item pointer. + */ +static inline OffsetNumber +ItemPointerGetOffsetNumberNoCheck(const ItemPointerData *pointer) +{ + return pointer->ip_posid; +} + +/* + * ItemPointerGetOffsetNumber + * As above, but verifies that the item pointer looks valid. + */ +static inline OffsetNumber +ItemPointerGetOffsetNumber(const ItemPointerData *pointer) +{ + Assert(ItemPointerIsValid(pointer)); + return ItemPointerGetOffsetNumberNoCheck(pointer); +} + +/* + * ItemPointerSet + * Sets a disk item pointer to the specified block and offset. + */ +static inline void +ItemPointerSet(ItemPointerData *pointer, BlockNumber blockNumber, OffsetNumber offNum) +{ + Assert(PointerIsValid(pointer)); + BlockIdSet(&pointer->ip_blkid, blockNumber); + pointer->ip_posid = offNum; +} + +/* + * ItemPointerSetBlockNumber + * Sets a disk item pointer to the specified block. + */ +static inline void +ItemPointerSetBlockNumber(ItemPointerData *pointer, BlockNumber blockNumber) +{ + Assert(PointerIsValid(pointer)); + BlockIdSet(&pointer->ip_blkid, blockNumber); +} + +/* + * ItemPointerSetOffsetNumber + * Sets a disk item pointer to the specified offset. + */ +static inline void +ItemPointerSetOffsetNumber(ItemPointerData *pointer, OffsetNumber offsetNumber) +{ + Assert(PointerIsValid(pointer)); + pointer->ip_posid = offsetNumber; +} + +/* + * ItemPointerCopy + * Copies the contents of one disk item pointer to another. + * + * Should there ever be padding in an ItemPointer this would need to be handled + * differently as it's used as hash key. + */ +static inline void +ItemPointerCopy(const ItemPointerData *fromPointer, ItemPointerData *toPointer) +{ + Assert(PointerIsValid(toPointer)); + Assert(PointerIsValid(fromPointer)); + *toPointer = *fromPointer; +} + +/* + * ItemPointerSetInvalid + * Sets a disk item pointer to be invalid. + */ +static inline void +ItemPointerSetInvalid(ItemPointerData *pointer) +{ + Assert(PointerIsValid(pointer)); + BlockIdSet(&pointer->ip_blkid, InvalidBlockNumber); + pointer->ip_posid = InvalidOffsetNumber; +} + +/* + * ItemPointerIndicatesMovedPartitions + * True iff the block number indicates the tuple has moved to another + * partition. + */ +static inline bool +ItemPointerIndicatesMovedPartitions(const ItemPointerData *pointer) +{ + return + ItemPointerGetOffsetNumber(pointer) == MovedPartitionsOffsetNumber && + ItemPointerGetBlockNumberNoCheck(pointer) == MovedPartitionsBlockNumber; +} + +/* + * ItemPointerSetMovedPartitions + * Indicate that the item referenced by the itempointer has moved into a + * different partition. + */ +static inline void +ItemPointerSetMovedPartitions(ItemPointerData *pointer) +{ + ItemPointerSet(pointer, MovedPartitionsBlockNumber, MovedPartitionsOffsetNumber); +} + +/* ---------------- + * externs + * ---------------- + */ + +extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2); +extern int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2); +extern void ItemPointerInc(ItemPointer pointer); +extern void ItemPointerDec(ItemPointer pointer); + +/* ---------------- + * Datum conversion functions + * ---------------- + */ + +static inline ItemPointer +DatumGetItemPointer(Datum X) +{ + return (ItemPointer) DatumGetPointer(X); +} + +static inline Datum +ItemPointerGetDatum(const ItemPointerData *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_ITEMPOINTER(n) DatumGetItemPointer(PG_GETARG_DATUM(n)) +#define PG_RETURN_ITEMPOINTER(x) return ItemPointerGetDatum(x) + +#endif /* ITEMPTR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/large_object.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/large_object.h new file mode 100644 index 0000000..6fecf44 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/large_object.h @@ -0,0 +1,100 @@ +/*------------------------------------------------------------------------- + * + * large_object.h + * Declarations for PostgreSQL large objects. POSTGRES 4.2 supported + * zillions of large objects (internal, external, jaquith, inversion). + * Now we only support inversion. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/large_object.h + * + *------------------------------------------------------------------------- + */ +#ifndef LARGE_OBJECT_H +#define LARGE_OBJECT_H + +#include "utils/snapshot.h" + + +/*---------- + * Data about a currently-open large object. + * + * id is the logical OID of the large object + * snapshot is the snapshot to use for read/write operations + * subid is the subtransaction that opened the desc (or currently owns it) + * offset is the current seek offset within the LO + * flags contains some flag bits + * + * NOTE: as of v11, permission checks are made when the large object is + * opened; therefore IFS_RDLOCK/IFS_WRLOCK indicate that read or write mode + * has been requested *and* the corresponding permission has been checked. + * + * NOTE: before 7.1, we also had to store references to the separate table + * and index of a specific large object. Now they all live in pg_largeobject + * and are accessed via a common relation descriptor. + *---------- + */ +typedef struct LargeObjectDesc +{ + Oid id; /* LO's identifier */ + Snapshot snapshot; /* snapshot to use */ + SubTransactionId subid; /* owning subtransaction ID */ + uint64 offset; /* current seek pointer */ + int flags; /* see flag bits below */ + +/* bits in flags: */ +#define IFS_RDLOCK (1 << 0) /* LO was opened for reading */ +#define IFS_WRLOCK (1 << 1) /* LO was opened for writing */ + +} LargeObjectDesc; + + +/* + * Each "page" (tuple) of a large object can hold this much data + * + * We could set this as high as BLCKSZ less some overhead, but it seems + * better to make it a smaller value, so that not as much space is used + * up when a page-tuple is updated. Note that the value is deliberately + * chosen large enough to trigger the tuple toaster, so that we will + * attempt to compress page tuples in-line. (But they won't be moved off + * unless the user creates a toast-table for pg_largeobject...) + * + * Also, it seems to be a smart move to make the page size be a power of 2, + * since clients will often be written to send data in power-of-2 blocks. + * This avoids unnecessary tuple updates caused by partial-page writes. + * + * NB: Changing LOBLKSIZE requires an initdb. + */ +#define LOBLKSIZE (BLCKSZ / 4) + +/* + * Maximum length in bytes for a large object. To make this larger, we'd + * have to widen pg_largeobject.pageno as well as various internal variables. + */ +#define MAX_LARGE_OBJECT_SIZE ((int64) INT_MAX * LOBLKSIZE) + + +/* + * GUC: backwards-compatibility flag to suppress LO permission checks + */ +extern PGDLLIMPORT bool lo_compat_privileges; + +/* + * Function definitions... + */ + +/* inversion stuff in inv_api.c */ +extern void close_lo_relation(bool isCommit); +extern Oid inv_create(Oid lobjId); +extern LargeObjectDesc *inv_open(Oid lobjId, int flags, MemoryContext mcxt); +extern void inv_close(LargeObjectDesc *obj_desc); +extern int inv_drop(Oid lobjId); +extern int64 inv_seek(LargeObjectDesc *obj_desc, int64 offset, int whence); +extern int64 inv_tell(LargeObjectDesc *obj_desc); +extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes); +extern int inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes); +extern void inv_truncate(LargeObjectDesc *obj_desc, int64 len); + +#endif /* LARGE_OBJECT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/latch.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/latch.h new file mode 100644 index 0000000..e41dc70 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/latch.h @@ -0,0 +1,140 @@ +/*------------------------------------------------------------------------- + * + * latch.h + * Routines for interprocess latches + * + * A latch is a boolean variable, with operations that let processes sleep + * until it is set. A latch can be set from another process, or a signal + * handler within the same process. + * + * The latch interface is a reliable replacement for the common pattern of + * using pg_usleep() or select() to wait until a signal arrives, where the + * signal handler sets a flag variable. Because on some platforms an + * incoming signal doesn't interrupt sleep, and even on platforms where it + * does there is a race condition if the signal arrives just before + * entering the sleep, the common pattern must periodically wake up and + * poll the flag variable. The pselect() system call was invented to solve + * this problem, but it is not portable enough. Latches are designed to + * overcome these limitations, allowing you to sleep without polling and + * ensuring quick response to signals from other processes. + * + * There are two kinds of latches: local and shared. A local latch is + * initialized by InitLatch, and can only be set from the same process. + * A local latch can be used to wait for a signal to arrive, by calling + * SetLatch in the signal handler. A shared latch resides in shared memory, + * and must be initialized at postmaster startup by InitSharedLatch. Before + * a shared latch can be waited on, it must be associated with a process + * with OwnLatch. Only the process owning the latch can wait on it, but any + * process can set it. + * + * There are three basic operations on a latch: + * + * SetLatch - Sets the latch + * ResetLatch - Clears the latch, allowing it to be set again + * WaitLatch - Waits for the latch to become set + * + * WaitLatch includes a provision for timeouts (which should be avoided + * when possible, as they incur extra overhead) and a provision for + * postmaster child processes to wake up immediately on postmaster death. + * See latch.c for detailed specifications for the exported functions. + * + * The correct pattern to wait for event(s) is: + * + * for (;;) + * { + * ResetLatch(); + * if (work to do) + * Do Stuff(); + * WaitLatch(); + * } + * + * It's important to reset the latch *before* checking if there's work to + * do. Otherwise, if someone sets the latch between the check and the + * ResetLatch call, you will miss it and Wait will incorrectly block. + * + * Another valid coding pattern looks like: + * + * for (;;) + * { + * if (work to do) + * Do Stuff(); // in particular, exit loop if some condition satisfied + * WaitLatch(); + * ResetLatch(); + * } + * + * This is useful to reduce latch traffic if it's expected that the loop's + * termination condition will often be satisfied in the first iteration; + * the cost is an extra loop iteration before blocking when it is not. + * What must be avoided is placing any checks for asynchronous events after + * WaitLatch and before ResetLatch, as that creates a race condition. + * + * To wake up the waiter, you must first set a global flag or something + * else that the wait loop tests in the "if (work to do)" part, and call + * SetLatch *after* that. SetLatch is designed to return quickly if the + * latch is already set. + * + * On some platforms, signals will not interrupt the latch wait primitive + * by themselves. Therefore, it is critical that any signal handler that + * is meant to terminate a WaitLatch wait calls SetLatch. + * + * Note that use of the process latch (PGPROC.procLatch) is generally better + * than an ad-hoc shared latch for signaling auxiliary processes. This is + * because generic signal handlers will call SetLatch on the process latch + * only, so using any latch other than the process latch effectively precludes + * use of any generic handler. + * + * + * See also WaitEventSets in waiteventset.h. They allow to wait for latches + * being set and additional events - postmaster dying and socket readiness of + * several sockets currently - at the same time. On many platforms using a + * long lived event set is more efficient than using WaitLatch or + * WaitLatchOrSocket. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/latch.h + * + *------------------------------------------------------------------------- + */ +#ifndef LATCH_H +#define LATCH_H + +#include + +#include "storage/waiteventset.h" /* for WL_* arguments to WaitLatch */ + +/* + * Latch structure should be treated as opaque and only accessed through + * the public functions. It is defined here to allow embedding Latches as + * part of bigger structs. + */ +typedef struct Latch +{ + sig_atomic_t is_set; + sig_atomic_t maybe_sleeping; + bool is_shared; + int owner_pid; +#ifdef WIN32 + HANDLE event; +#endif +} Latch; + +/* + * prototypes for functions in latch.c + */ +extern void InitLatch(Latch *latch); +extern void InitSharedLatch(Latch *latch); +extern void OwnLatch(Latch *latch); +extern void DisownLatch(Latch *latch); +extern void SetLatch(Latch *latch); +extern void ResetLatch(Latch *latch); + +extern int WaitLatch(Latch *latch, int wakeEvents, long timeout, + uint32 wait_event_info); +extern int WaitLatchOrSocket(Latch *latch, int wakeEvents, + pgsocket sock, long timeout, uint32 wait_event_info); +extern void InitializeLatchWaitSet(void); + +#endif /* LATCH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lmgr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lmgr.h new file mode 100644 index 0000000..58eee4e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lmgr.h @@ -0,0 +1,127 @@ +/*------------------------------------------------------------------------- + * + * lmgr.h + * POSTGRES lock manager definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/lmgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef LMGR_H +#define LMGR_H + +#include "lib/stringinfo.h" +#include "storage/itemptr.h" +#include "storage/lock.h" +#include "utils/rel.h" + + +/* XactLockTableWait operations */ +typedef enum XLTW_Oper +{ + XLTW_None, + XLTW_Update, + XLTW_Delete, + XLTW_Lock, + XLTW_LockUpdated, + XLTW_InsertIndex, + XLTW_InsertIndexUnique, + XLTW_FetchUpdated, + XLTW_RecheckExclusionConstr, +} XLTW_Oper; + +extern void RelationInitLockInfo(Relation relation); + +/* Lock a relation */ +extern void LockRelationOid(Oid relid, LOCKMODE lockmode); +extern void LockRelationId(LockRelId *relid, LOCKMODE lockmode); +extern bool ConditionalLockRelationOid(Oid relid, LOCKMODE lockmode); +extern void UnlockRelationId(LockRelId *relid, LOCKMODE lockmode); +extern void UnlockRelationOid(Oid relid, LOCKMODE lockmode); + +extern void LockRelation(Relation relation, LOCKMODE lockmode); +extern bool ConditionalLockRelation(Relation relation, LOCKMODE lockmode); +extern void UnlockRelation(Relation relation, LOCKMODE lockmode); +extern bool CheckRelationLockedByMe(Relation relation, LOCKMODE lockmode, + bool orstronger); +extern bool CheckRelationOidLockedByMe(Oid relid, LOCKMODE lockmode, + bool orstronger); +extern bool LockHasWaitersRelation(Relation relation, LOCKMODE lockmode); + +extern void LockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode); +extern void UnlockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode); + +/* Lock a relation for extension */ +extern void LockRelationForExtension(Relation relation, LOCKMODE lockmode); +extern void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode); +extern bool ConditionalLockRelationForExtension(Relation relation, + LOCKMODE lockmode); +extern int RelationExtensionLockWaiterCount(Relation relation); + +/* Lock to recompute pg_database.datfrozenxid in the current database */ +extern void LockDatabaseFrozenIds(LOCKMODE lockmode); + +/* Lock a page (currently only used within indexes) */ +extern void LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); +extern bool ConditionalLockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); +extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); + +/* Lock a tuple (see heap_lock_tuple before assuming you understand this) */ +extern void LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); +extern bool ConditionalLockTuple(Relation relation, ItemPointer tid, + LOCKMODE lockmode, bool logLockFailure); +extern void UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); + +/* Lock an XID (used to wait for a transaction to finish) */ +extern void XactLockTableInsert(TransactionId xid); +extern void XactLockTableDelete(TransactionId xid); +extern void XactLockTableWait(TransactionId xid, Relation rel, + ItemPointer ctid, XLTW_Oper oper); +extern bool ConditionalXactLockTableWait(TransactionId xid, + bool logLockFailure); + +/* Lock VXIDs, specified by conflicting locktags */ +extern void WaitForLockers(LOCKTAG heaplocktag, LOCKMODE lockmode, bool progress); +extern void WaitForLockersMultiple(List *locktags, LOCKMODE lockmode, bool progress); + +/* Lock an XID for tuple insertion (used to wait for an insertion to finish) */ +extern uint32 SpeculativeInsertionLockAcquire(TransactionId xid); +extern void SpeculativeInsertionLockRelease(TransactionId xid); +extern void SpeculativeInsertionWait(TransactionId xid, uint32 token); + +/* Lock a general object (other than a relation) of the current database */ +extern void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); +extern bool ConditionalLockDatabaseObject(Oid classid, Oid objid, + uint16 objsubid, LOCKMODE lockmode); +extern void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); + +/* Lock a shared-across-databases object (other than a relation) */ +extern void LockSharedObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); +extern bool ConditionalLockSharedObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); +extern void UnlockSharedObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); + +extern void LockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); +extern void UnlockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); + +extern void LockApplyTransactionForSession(Oid suboid, TransactionId xid, uint16 objid, + LOCKMODE lockmode); +extern void UnlockApplyTransactionForSession(Oid suboid, TransactionId xid, uint16 objid, + LOCKMODE lockmode); + +/* Describe a locktag for error messages */ +extern void DescribeLockTag(StringInfo buf, const LOCKTAG *tag); + +extern const char *GetLockNameFromTagType(uint16 locktag_type); + +#endif /* LMGR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lock.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lock.h new file mode 100644 index 0000000..4862b80 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lock.h @@ -0,0 +1,630 @@ +/*------------------------------------------------------------------------- + * + * lock.h + * POSTGRES low-level lock mechanism + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/lock.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOCK_H_ +#define LOCK_H_ + +#ifdef FRONTEND +#error "lock.h may not be included from frontend code" +#endif + +#include "lib/ilist.h" +#include "storage/lockdefs.h" +#include "storage/lwlock.h" +#include "storage/procnumber.h" +#include "storage/shmem.h" +#include "utils/timestamp.h" + +/* struct PGPROC is declared in proc.h, but must forward-reference it */ +typedef struct PGPROC PGPROC; + +/* GUC variables */ +extern PGDLLIMPORT int max_locks_per_xact; +extern PGDLLIMPORT bool log_lock_failures; + +#ifdef LOCK_DEBUG +extern PGDLLIMPORT int Trace_lock_oidmin; +extern PGDLLIMPORT bool Trace_locks; +extern PGDLLIMPORT bool Trace_userlocks; +extern PGDLLIMPORT int Trace_lock_table; +extern PGDLLIMPORT bool Debug_deadlocks; +#endif /* LOCK_DEBUG */ + + +/* + * Top-level transactions are identified by VirtualTransactionIDs comprising + * PGPROC fields procNumber and lxid. For recovered prepared transactions, the + * LocalTransactionId is an ordinary XID; LOCKTAG_VIRTUALTRANSACTION never + * refers to that kind. These are guaranteed unique over the short term, but + * will be reused after a database restart or XID wraparound; hence they + * should never be stored on disk. + * + * Note that struct VirtualTransactionId can not be assumed to be atomically + * assignable as a whole. However, type LocalTransactionId is assumed to + * be atomically assignable, and the proc number doesn't change often enough + * to be a problem, so we can fetch or assign the two fields separately. + * We deliberately refrain from using the struct within PGPROC, to prevent + * coding errors from trying to use struct assignment with it; instead use + * GET_VXID_FROM_PGPROC(). + */ +typedef struct +{ + ProcNumber procNumber; /* proc number of the PGPROC */ + LocalTransactionId localTransactionId; /* lxid from PGPROC */ +} VirtualTransactionId; + +#define InvalidLocalTransactionId 0 +#define LocalTransactionIdIsValid(lxid) ((lxid) != InvalidLocalTransactionId) +#define VirtualTransactionIdIsValid(vxid) \ + (LocalTransactionIdIsValid((vxid).localTransactionId)) +#define VirtualTransactionIdIsRecoveredPreparedXact(vxid) \ + ((vxid).procNumber == INVALID_PROC_NUMBER) +#define VirtualTransactionIdEquals(vxid1, vxid2) \ + ((vxid1).procNumber == (vxid2).procNumber && \ + (vxid1).localTransactionId == (vxid2).localTransactionId) +#define SetInvalidVirtualTransactionId(vxid) \ + ((vxid).procNumber = INVALID_PROC_NUMBER, \ + (vxid).localTransactionId = InvalidLocalTransactionId) +#define GET_VXID_FROM_PGPROC(vxid_dst, proc) \ + ((vxid_dst).procNumber = (proc).vxid.procNumber, \ + (vxid_dst).localTransactionId = (proc).vxid.lxid) + +/* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */ +#define MAX_LOCKMODES 10 + +#define LOCKBIT_ON(lockmode) (1 << (lockmode)) +#define LOCKBIT_OFF(lockmode) (~(1 << (lockmode))) + + +/* + * This data structure defines the locking semantics associated with a + * "lock method". The semantics specify the meaning of each lock mode + * (by defining which lock modes it conflicts with). + * All of this data is constant and is kept in const tables. + * + * numLockModes -- number of lock modes (READ,WRITE,etc) that + * are defined in this lock method. Must be less than MAX_LOCKMODES. + * + * conflictTab -- this is an array of bitmasks showing lock + * mode conflicts. conflictTab[i] is a mask with the j-th bit + * turned on if lock modes i and j conflict. Lock modes are + * numbered 1..numLockModes; conflictTab[0] is unused. + * + * lockModeNames -- ID strings for debug printouts. + * + * trace_flag -- pointer to GUC trace flag for this lock method. (The + * GUC variable is not constant, but we use "const" here to denote that + * it can't be changed through this reference.) + */ +typedef struct LockMethodData +{ + int numLockModes; + const LOCKMASK *conflictTab; + const char *const *lockModeNames; + const bool *trace_flag; +} LockMethodData; + +typedef const LockMethodData *LockMethod; + +/* + * Lock methods are identified by LOCKMETHODID. (Despite the declaration as + * uint16, we are constrained to 256 lockmethods by the layout of LOCKTAG.) + */ +typedef uint16 LOCKMETHODID; + +/* These identify the known lock methods */ +#define DEFAULT_LOCKMETHOD 1 +#define USER_LOCKMETHOD 2 + +/* + * LOCKTAG is the key information needed to look up a LOCK item in the + * lock hashtable. A LOCKTAG value uniquely identifies a lockable object. + * + * The LockTagType enum defines the different kinds of objects we can lock. + * We can handle up to 256 different LockTagTypes. + */ +typedef enum LockTagType +{ + LOCKTAG_RELATION, /* whole relation */ + LOCKTAG_RELATION_EXTEND, /* the right to extend a relation */ + LOCKTAG_DATABASE_FROZEN_IDS, /* pg_database.datfrozenxid */ + LOCKTAG_PAGE, /* one page of a relation */ + LOCKTAG_TUPLE, /* one physical tuple */ + LOCKTAG_TRANSACTION, /* transaction (for waiting for xact done) */ + LOCKTAG_VIRTUALTRANSACTION, /* virtual transaction (ditto) */ + LOCKTAG_SPECULATIVE_TOKEN, /* speculative insertion Xid and token */ + LOCKTAG_OBJECT, /* non-relation database object */ + LOCKTAG_USERLOCK, /* reserved for old contrib/userlock code */ + LOCKTAG_ADVISORY, /* advisory user locks */ + LOCKTAG_APPLY_TRANSACTION, /* transaction being applied on a logical + * replication subscriber */ +} LockTagType; + +#define LOCKTAG_LAST_TYPE LOCKTAG_APPLY_TRANSACTION + +extern PGDLLIMPORT const char *const LockTagTypeNames[]; + +/* + * The LOCKTAG struct is defined with malice aforethought to fit into 16 + * bytes with no padding. Note that this would need adjustment if we were + * to widen Oid, BlockNumber, or TransactionId to more than 32 bits. + * + * We include lockmethodid in the locktag so that a single hash table in + * shared memory can store locks of different lockmethods. + */ +typedef struct LOCKTAG +{ + uint32 locktag_field1; /* a 32-bit ID field */ + uint32 locktag_field2; /* a 32-bit ID field */ + uint32 locktag_field3; /* a 32-bit ID field */ + uint16 locktag_field4; /* a 16-bit ID field */ + uint8 locktag_type; /* see enum LockTagType */ + uint8 locktag_lockmethodid; /* lockmethod indicator */ +} LOCKTAG; + +/* + * These macros define how we map logical IDs of lockable objects into + * the physical fields of LOCKTAG. Use these to set up LOCKTAG values, + * rather than accessing the fields directly. Note multiple eval of target! + */ + +/* ID info for a relation is DB OID + REL OID; DB OID = 0 if shared */ +#define SET_LOCKTAG_RELATION(locktag,dboid,reloid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_RELATION, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* same ID info as RELATION */ +#define SET_LOCKTAG_RELATION_EXTEND(locktag,dboid,reloid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_RELATION_EXTEND, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for frozen IDs is DB OID */ +#define SET_LOCKTAG_DATABASE_FROZEN_IDS(locktag,dboid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = 0, \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_DATABASE_FROZEN_IDS, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for a page is RELATION info + BlockNumber */ +#define SET_LOCKTAG_PAGE(locktag,dboid,reloid,blocknum) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = (blocknum), \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_PAGE, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for a tuple is PAGE info + OffsetNumber */ +#define SET_LOCKTAG_TUPLE(locktag,dboid,reloid,blocknum,offnum) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = (blocknum), \ + (locktag).locktag_field4 = (offnum), \ + (locktag).locktag_type = LOCKTAG_TUPLE, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for a transaction is its TransactionId */ +#define SET_LOCKTAG_TRANSACTION(locktag,xid) \ + ((locktag).locktag_field1 = (xid), \ + (locktag).locktag_field2 = 0, \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_TRANSACTION, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for a virtual transaction is its VirtualTransactionId */ +#define SET_LOCKTAG_VIRTUALTRANSACTION(locktag,vxid) \ + ((locktag).locktag_field1 = (vxid).procNumber, \ + (locktag).locktag_field2 = (vxid).localTransactionId, \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_VIRTUALTRANSACTION, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* + * ID info for a speculative insert is TRANSACTION info + + * its speculative insert counter. + */ +#define SET_LOCKTAG_SPECULATIVE_INSERTION(locktag,xid,token) \ + ((locktag).locktag_field1 = (xid), \ + (locktag).locktag_field2 = (token), \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_SPECULATIVE_TOKEN, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* + * ID info for an object is DB OID + CLASS OID + OBJECT OID + SUBID + * + * Note: object ID has same representation as in pg_depend and + * pg_description, but notice that we are constraining SUBID to 16 bits. + * Also, we use DB OID = 0 for shared objects such as tablespaces. + */ +#define SET_LOCKTAG_OBJECT(locktag,dboid,classoid,objoid,objsubid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (classoid), \ + (locktag).locktag_field3 = (objoid), \ + (locktag).locktag_field4 = (objsubid), \ + (locktag).locktag_type = LOCKTAG_OBJECT, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +#define SET_LOCKTAG_ADVISORY(locktag,id1,id2,id3,id4) \ + ((locktag).locktag_field1 = (id1), \ + (locktag).locktag_field2 = (id2), \ + (locktag).locktag_field3 = (id3), \ + (locktag).locktag_field4 = (id4), \ + (locktag).locktag_type = LOCKTAG_ADVISORY, \ + (locktag).locktag_lockmethodid = USER_LOCKMETHOD) + +/* + * ID info for a remote transaction on a logical replication subscriber is: DB + * OID + SUBSCRIPTION OID + TRANSACTION ID + OBJID + */ +#define SET_LOCKTAG_APPLY_TRANSACTION(locktag,dboid,suboid,xid,objid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (suboid), \ + (locktag).locktag_field3 = (xid), \ + (locktag).locktag_field4 = (objid), \ + (locktag).locktag_type = LOCKTAG_APPLY_TRANSACTION, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* + * Per-locked-object lock information: + * + * tag -- uniquely identifies the object being locked + * grantMask -- bitmask for all lock types currently granted on this object. + * waitMask -- bitmask for all lock types currently awaited on this object. + * procLocks -- list of PROCLOCK objects for this lock. + * waitProcs -- queue of processes waiting for this lock. + * requested -- count of each lock type currently requested on the lock + * (includes requests already granted!!). + * nRequested -- total requested locks of all types. + * granted -- count of each lock type currently granted on the lock. + * nGranted -- total granted locks of all types. + * + * Note: these counts count 1 for each backend. Internally to a backend, + * there may be multiple grabs on a particular lock, but this is not reflected + * into shared memory. + */ +typedef struct LOCK +{ + /* hash key */ + LOCKTAG tag; /* unique identifier of lockable object */ + + /* data */ + LOCKMASK grantMask; /* bitmask for lock types already granted */ + LOCKMASK waitMask; /* bitmask for lock types awaited */ + dlist_head procLocks; /* list of PROCLOCK objects assoc. with lock */ + dclist_head waitProcs; /* list of PGPROC objects waiting on lock */ + int requested[MAX_LOCKMODES]; /* counts of requested locks */ + int nRequested; /* total of requested[] array */ + int granted[MAX_LOCKMODES]; /* counts of granted locks */ + int nGranted; /* total of granted[] array */ +} LOCK; + +#define LOCK_LOCKMETHOD(lock) ((LOCKMETHODID) (lock).tag.locktag_lockmethodid) +#define LOCK_LOCKTAG(lock) ((LockTagType) (lock).tag.locktag_type) + + +/* + * We may have several different backends holding or awaiting locks + * on the same lockable object. We need to store some per-holder/waiter + * information for each such holder (or would-be holder). This is kept in + * a PROCLOCK struct. + * + * PROCLOCKTAG is the key information needed to look up a PROCLOCK item in the + * proclock hashtable. A PROCLOCKTAG value uniquely identifies the combination + * of a lockable object and a holder/waiter for that object. (We can use + * pointers here because the PROCLOCKTAG need only be unique for the lifespan + * of the PROCLOCK, and it will never outlive the lock or the proc.) + * + * Internally to a backend, it is possible for the same lock to be held + * for different purposes: the backend tracks transaction locks separately + * from session locks. However, this is not reflected in the shared-memory + * state: we only track which backend(s) hold the lock. This is OK since a + * backend can never block itself. + * + * The holdMask field shows the already-granted locks represented by this + * proclock. Note that there will be a proclock object, possibly with + * zero holdMask, for any lock that the process is currently waiting on. + * Otherwise, proclock objects whose holdMasks are zero are recycled + * as soon as convenient. + * + * releaseMask is workspace for LockReleaseAll(): it shows the locks due + * to be released during the current call. This must only be examined or + * set by the backend owning the PROCLOCK. + * + * Each PROCLOCK object is linked into lists for both the associated LOCK + * object and the owning PGPROC object. Note that the PROCLOCK is entered + * into these lists as soon as it is created, even if no lock has yet been + * granted. A PGPROC that is waiting for a lock to be granted will also be + * linked into the lock's waitProcs queue. + */ +typedef struct PROCLOCKTAG +{ + /* NB: we assume this struct contains no padding! */ + LOCK *myLock; /* link to per-lockable-object information */ + PGPROC *myProc; /* link to PGPROC of owning backend */ +} PROCLOCKTAG; + +typedef struct PROCLOCK +{ + /* tag */ + PROCLOCKTAG tag; /* unique identifier of proclock object */ + + /* data */ + PGPROC *groupLeader; /* proc's lock group leader, or proc itself */ + LOCKMASK holdMask; /* bitmask for lock types currently held */ + LOCKMASK releaseMask; /* bitmask for lock types to be released */ + dlist_node lockLink; /* list link in LOCK's list of proclocks */ + dlist_node procLink; /* list link in PGPROC's list of proclocks */ +} PROCLOCK; + +#define PROCLOCK_LOCKMETHOD(proclock) \ + LOCK_LOCKMETHOD(*((proclock).tag.myLock)) + +/* + * Each backend also maintains a local hash table with information about each + * lock it is currently interested in. In particular the local table counts + * the number of times that lock has been acquired. This allows multiple + * requests for the same lock to be executed without additional accesses to + * shared memory. We also track the number of lock acquisitions per + * ResourceOwner, so that we can release just those locks belonging to a + * particular ResourceOwner. + * + * When holding a lock taken "normally", the lock and proclock fields always + * point to the associated objects in shared memory. However, if we acquired + * the lock via the fast-path mechanism, the lock and proclock fields are set + * to NULL, since there probably aren't any such objects in shared memory. + * (If the lock later gets promoted to normal representation, we may eventually + * update our locallock's lock/proclock fields after finding the shared + * objects.) + * + * Caution: a locallock object can be left over from a failed lock acquisition + * attempt. In this case its lock/proclock fields are untrustworthy, since + * the shared lock object is neither held nor awaited, and hence is available + * to be reclaimed. If nLocks > 0 then these pointers must either be valid or + * NULL, but when nLocks == 0 they should be considered garbage. + */ +typedef struct LOCALLOCKTAG +{ + LOCKTAG lock; /* identifies the lockable object */ + LOCKMODE mode; /* lock mode for this table entry */ +} LOCALLOCKTAG; + +typedef struct LOCALLOCKOWNER +{ + /* + * Note: if owner is NULL then the lock is held on behalf of the session; + * otherwise it is held on behalf of my current transaction. + * + * Must use a forward struct reference to avoid circularity. + */ + struct ResourceOwnerData *owner; + int64 nLocks; /* # of times held by this owner */ +} LOCALLOCKOWNER; + +typedef struct LOCALLOCK +{ + /* tag */ + LOCALLOCKTAG tag; /* unique identifier of locallock entry */ + + /* data */ + uint32 hashcode; /* copy of LOCKTAG's hash value */ + LOCK *lock; /* associated LOCK object, if any */ + PROCLOCK *proclock; /* associated PROCLOCK object, if any */ + int64 nLocks; /* total number of times lock is held */ + int numLockOwners; /* # of relevant ResourceOwners */ + int maxLockOwners; /* allocated size of array */ + LOCALLOCKOWNER *lockOwners; /* dynamically resizable array */ + bool holdsStrongLockCount; /* bumped FastPathStrongRelationLocks */ + bool lockCleared; /* we read all sinval msgs for lock */ +} LOCALLOCK; + +#define LOCALLOCK_LOCKMETHOD(llock) ((llock).tag.lock.locktag_lockmethodid) +#define LOCALLOCK_LOCKTAG(llock) ((LockTagType) (llock).tag.lock.locktag_type) + + +/* + * These structures hold information passed from lmgr internals to the lock + * listing user-level functions (in lockfuncs.c). + */ + +typedef struct LockInstanceData +{ + LOCKTAG locktag; /* tag for locked object */ + LOCKMASK holdMask; /* locks held by this PGPROC */ + LOCKMODE waitLockMode; /* lock awaited by this PGPROC, if any */ + VirtualTransactionId vxid; /* virtual transaction ID of this PGPROC */ + TimestampTz waitStart; /* time at which this PGPROC started waiting + * for lock */ + int pid; /* pid of this PGPROC */ + int leaderPid; /* pid of group leader; = pid if no group */ + bool fastpath; /* taken via fastpath? */ +} LockInstanceData; + +typedef struct LockData +{ + int nelements; /* The length of the array */ + LockInstanceData *locks; /* Array of per-PROCLOCK information */ +} LockData; + +typedef struct BlockedProcData +{ + int pid; /* pid of a blocked PGPROC */ + /* Per-PROCLOCK information about PROCLOCKs of the lock the pid awaits */ + /* (these fields refer to indexes in BlockedProcsData.locks[]) */ + int first_lock; /* index of first relevant LockInstanceData */ + int num_locks; /* number of relevant LockInstanceDatas */ + /* PIDs of PGPROCs that are ahead of "pid" in the lock's wait queue */ + /* (these fields refer to indexes in BlockedProcsData.waiter_pids[]) */ + int first_waiter; /* index of first preceding waiter */ + int num_waiters; /* number of preceding waiters */ +} BlockedProcData; + +typedef struct BlockedProcsData +{ + BlockedProcData *procs; /* Array of per-blocked-proc information */ + LockInstanceData *locks; /* Array of per-PROCLOCK information */ + int *waiter_pids; /* Array of PIDs of other blocked PGPROCs */ + int nprocs; /* # of valid entries in procs[] array */ + int maxprocs; /* Allocated length of procs[] array */ + int nlocks; /* # of valid entries in locks[] array */ + int maxlocks; /* Allocated length of locks[] array */ + int npids; /* # of valid entries in waiter_pids[] array */ + int maxpids; /* Allocated length of waiter_pids[] array */ +} BlockedProcsData; + + +/* Result codes for LockAcquire() */ +typedef enum +{ + LOCKACQUIRE_NOT_AVAIL, /* lock not available, and dontWait=true */ + LOCKACQUIRE_OK, /* lock successfully acquired */ + LOCKACQUIRE_ALREADY_HELD, /* incremented count for lock already held */ + LOCKACQUIRE_ALREADY_CLEAR, /* incremented count for lock already clear */ +} LockAcquireResult; + +/* Deadlock states identified by DeadLockCheck() */ +typedef enum +{ + DS_NOT_YET_CHECKED, /* no deadlock check has run yet */ + DS_NO_DEADLOCK, /* no deadlock detected */ + DS_SOFT_DEADLOCK, /* deadlock avoided by queue rearrangement */ + DS_HARD_DEADLOCK, /* deadlock, no way out but ERROR */ + DS_BLOCKED_BY_AUTOVACUUM, /* no deadlock; queue blocked by autovacuum + * worker */ +} DeadLockState; + +/* + * The lockmgr's shared hash tables are partitioned to reduce contention. + * To determine which partition a given locktag belongs to, compute the tag's + * hash code with LockTagHashCode(), then apply one of these macros. + * NB: NUM_LOCK_PARTITIONS must be a power of 2! + */ +#define LockHashPartition(hashcode) \ + ((hashcode) % NUM_LOCK_PARTITIONS) +#define LockHashPartitionLock(hashcode) \ + (&MainLWLockArray[LOCK_MANAGER_LWLOCK_OFFSET + \ + LockHashPartition(hashcode)].lock) +#define LockHashPartitionLockByIndex(i) \ + (&MainLWLockArray[LOCK_MANAGER_LWLOCK_OFFSET + (i)].lock) + +/* + * The deadlock detector needs to be able to access lockGroupLeader and + * related fields in the PGPROC, so we arrange for those fields to be protected + * by one of the lock hash partition locks. Since the deadlock detector + * acquires all such locks anyway, this makes it safe for it to access these + * fields without doing anything extra. To avoid contention as much as + * possible, we map different PGPROCs to different partition locks. The lock + * used for a given lock group is determined by the group leader's pgprocno. + */ +#define LockHashPartitionLockByProc(leader_pgproc) \ + LockHashPartitionLock(GetNumberFromPGProc(leader_pgproc)) + +/* + * function prototypes + */ +extern void LockManagerShmemInit(void); +extern Size LockManagerShmemSize(void); +extern void InitLockManagerAccess(void); +extern LockMethod GetLocksMethodTable(const LOCK *lock); +extern LockMethod GetLockTagsMethodTable(const LOCKTAG *locktag); +extern uint32 LockTagHashCode(const LOCKTAG *locktag); +extern bool DoLockModesConflict(LOCKMODE mode1, LOCKMODE mode2); +extern LockAcquireResult LockAcquire(const LOCKTAG *locktag, + LOCKMODE lockmode, + bool sessionLock, + bool dontWait); +extern LockAcquireResult LockAcquireExtended(const LOCKTAG *locktag, + LOCKMODE lockmode, + bool sessionLock, + bool dontWait, + bool reportMemoryError, + LOCALLOCK **locallockp, + bool logLockFailure); +extern void AbortStrongLockAcquire(void); +extern void MarkLockClear(LOCALLOCK *locallock); +extern bool LockRelease(const LOCKTAG *locktag, + LOCKMODE lockmode, bool sessionLock); +extern void LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks); +extern void LockReleaseSession(LOCKMETHODID lockmethodid); +extern void LockReleaseCurrentOwner(LOCALLOCK **locallocks, int nlocks); +extern void LockReassignCurrentOwner(LOCALLOCK **locallocks, int nlocks); +extern bool LockHeldByMe(const LOCKTAG *locktag, + LOCKMODE lockmode, bool orstronger); +#ifdef USE_ASSERT_CHECKING +extern HTAB *GetLockMethodLocalHash(void); +#endif +extern bool LockHasWaiters(const LOCKTAG *locktag, + LOCKMODE lockmode, bool sessionLock); +extern VirtualTransactionId *GetLockConflicts(const LOCKTAG *locktag, + LOCKMODE lockmode, int *countp); +extern void AtPrepare_Locks(void); +extern void PostPrepare_Locks(TransactionId xid); +extern bool LockCheckConflicts(LockMethod lockMethodTable, + LOCKMODE lockmode, + LOCK *lock, PROCLOCK *proclock); +extern void GrantLock(LOCK *lock, PROCLOCK *proclock, LOCKMODE lockmode); +extern void GrantAwaitedLock(void); +extern LOCALLOCK *GetAwaitedLock(void); +extern void ResetAwaitedLock(void); + +extern void RemoveFromWaitQueue(PGPROC *proc, uint32 hashcode); +extern LockData *GetLockStatusData(void); +extern BlockedProcsData *GetBlockerStatusData(int blocked_pid); + +extern xl_standby_lock *GetRunningTransactionLocks(int *nlocks); +extern const char *GetLockmodeName(LOCKMETHODID lockmethodid, LOCKMODE mode); + +extern void lock_twophase_recover(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void lock_twophase_postcommit(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void lock_twophase_postabort(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void lock_twophase_standby_recover(TransactionId xid, uint16 info, + void *recdata, uint32 len); + +extern DeadLockState DeadLockCheck(PGPROC *proc); +extern PGPROC *GetBlockingAutoVacuumPgproc(void); +pg_noreturn extern void DeadLockReport(void); +extern void RememberSimpleDeadLock(PGPROC *proc1, + LOCKMODE lockmode, + LOCK *lock, + PGPROC *proc2); +extern void InitDeadLockChecking(void); + +extern int LockWaiterCount(const LOCKTAG *locktag); + +#ifdef LOCK_DEBUG +extern void DumpLocks(PGPROC *proc); +extern void DumpAllLocks(void); +#endif + +/* Lock a VXID (used to wait for a transaction to finish) */ +extern void VirtualXactLockTableInsert(VirtualTransactionId vxid); +extern void VirtualXactLockTableCleanup(void); +extern bool VirtualXactLock(VirtualTransactionId vxid, bool wait); + +#endif /* LOCK_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lockdefs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lockdefs.h new file mode 100644 index 0000000..7f3ba03 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lockdefs.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * lockdefs.h + * Frontend exposed parts of postgres' low level lock mechanism + * + * The split between lockdefs.h and lock.h is not very principled. This file + * contains definition that have to (indirectly) be available when included by + * FRONTEND code. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/lockdefs.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOCKDEFS_H_ +#define LOCKDEFS_H_ + +/* + * LOCKMODE is an integer (1..N) indicating a lock type. LOCKMASK is a bit + * mask indicating a set of held or requested lock types (the bit 1<lwWaitMode, + * when waiting for lock to become free. Not + * to be used as LWLockAcquire argument */ +} LWLockMode; + + +#ifdef LOCK_DEBUG +extern PGDLLIMPORT bool Trace_lwlocks; +#endif + +extern bool LWLockAcquire(LWLock *lock, LWLockMode mode); +extern bool LWLockConditionalAcquire(LWLock *lock, LWLockMode mode); +extern bool LWLockAcquireOrWait(LWLock *lock, LWLockMode mode); +extern void LWLockRelease(LWLock *lock); +extern void LWLockReleaseClearVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64 val); +extern void LWLockReleaseAll(void); +extern void LWLockDisown(LWLock *lock); +extern void LWLockReleaseDisowned(LWLock *lock, LWLockMode mode); +extern void ForEachLWLockHeldByMe(void (*callback) (LWLock *, LWLockMode, void *), + void *context); +extern bool LWLockHeldByMe(LWLock *lock); +extern bool LWLockAnyHeldByMe(LWLock *lock, int nlocks, size_t stride); +extern bool LWLockHeldByMeInMode(LWLock *lock, LWLockMode mode); + +extern bool LWLockWaitForVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64 oldval, uint64 *newval); +extern void LWLockUpdateVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64 val); + +extern Size LWLockShmemSize(void); +extern void CreateLWLocks(void); +extern void InitLWLockAccess(void); + +extern const char *GetLWLockIdentifier(uint32 classId, uint16 eventId); + +/* + * Extensions (or core code) can obtain an LWLocks by calling + * RequestNamedLWLockTranche() during postmaster startup. Subsequently, + * call GetNamedLWLockTranche() to obtain a pointer to an array containing + * the number of LWLocks requested. + */ +extern void RequestNamedLWLockTranche(const char *tranche_name, int num_lwlocks); +extern LWLockPadded *GetNamedLWLockTranche(const char *tranche_name); + +/* + * There is another, more flexible method of obtaining lwlocks. First, call + * LWLockNewTrancheId just once to obtain a tranche ID; this allocates from + * a shared counter. Next, each individual process using the tranche should + * call LWLockRegisterTranche() to associate that tranche ID with a name. + * Finally, LWLockInitialize should be called just once per lwlock, passing + * the tranche ID as an argument. + * + * It may seem strange that each process using the tranche must register it + * separately, but dynamic shared memory segments aren't guaranteed to be + * mapped at the same address in all coordinating backends, so storing the + * registration in the main shared memory segment wouldn't work for that case. + */ +extern int LWLockNewTrancheId(void); +extern void LWLockRegisterTranche(int tranche_id, const char *tranche_name); +extern void LWLockInitialize(LWLock *lock, int tranche_id); + +/* + * Every tranche ID less than NUM_INDIVIDUAL_LWLOCKS is reserved; also, + * we reserve additional tranche IDs for builtin tranches not included in + * the set of individual LWLocks. A call to LWLockNewTrancheId will never + * return a value less than LWTRANCHE_FIRST_USER_DEFINED. + */ +typedef enum BuiltinTrancheIds +{ + LWTRANCHE_XACT_BUFFER = NUM_INDIVIDUAL_LWLOCKS, + LWTRANCHE_COMMITTS_BUFFER, + LWTRANCHE_SUBTRANS_BUFFER, + LWTRANCHE_MULTIXACTOFFSET_BUFFER, + LWTRANCHE_MULTIXACTMEMBER_BUFFER, + LWTRANCHE_NOTIFY_BUFFER, + LWTRANCHE_SERIAL_BUFFER, + LWTRANCHE_WAL_INSERT, + LWTRANCHE_BUFFER_CONTENT, + LWTRANCHE_REPLICATION_ORIGIN_STATE, + LWTRANCHE_REPLICATION_SLOT_IO, + LWTRANCHE_LOCK_FASTPATH, + LWTRANCHE_BUFFER_MAPPING, + LWTRANCHE_LOCK_MANAGER, + LWTRANCHE_PREDICATE_LOCK_MANAGER, + LWTRANCHE_PARALLEL_HASH_JOIN, + LWTRANCHE_PARALLEL_BTREE_SCAN, + LWTRANCHE_PARALLEL_QUERY_DSA, + LWTRANCHE_PER_SESSION_DSA, + LWTRANCHE_PER_SESSION_RECORD_TYPE, + LWTRANCHE_PER_SESSION_RECORD_TYPMOD, + LWTRANCHE_SHARED_TUPLESTORE, + LWTRANCHE_SHARED_TIDBITMAP, + LWTRANCHE_PARALLEL_APPEND, + LWTRANCHE_PER_XACT_PREDICATE_LIST, + LWTRANCHE_PGSTATS_DSA, + LWTRANCHE_PGSTATS_HASH, + LWTRANCHE_PGSTATS_DATA, + LWTRANCHE_LAUNCHER_DSA, + LWTRANCHE_LAUNCHER_HASH, + LWTRANCHE_DSM_REGISTRY_DSA, + LWTRANCHE_DSM_REGISTRY_HASH, + LWTRANCHE_COMMITTS_SLRU, + LWTRANCHE_MULTIXACTMEMBER_SLRU, + LWTRANCHE_MULTIXACTOFFSET_SLRU, + LWTRANCHE_NOTIFY_SLRU, + LWTRANCHE_SERIAL_SLRU, + LWTRANCHE_SUBTRANS_SLRU, + LWTRANCHE_XACT_SLRU, + LWTRANCHE_PARALLEL_VACUUM_DSA, + LWTRANCHE_AIO_URING_COMPLETION, + LWTRANCHE_FIRST_USER_DEFINED, +} BuiltinTrancheIds; + +/* + * Prior to PostgreSQL 9.4, we used an enum type called LWLockId to refer + * to LWLocks. New code should instead use LWLock *. However, for the + * convenience of third-party code, we include the following typedef. + */ +typedef LWLock *LWLockId; + +#endif /* LWLOCK_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lwlocklist.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lwlocklist.h new file mode 100644 index 0000000..932024b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lwlocklist.h @@ -0,0 +1,86 @@ +/*------------------------------------------------------------------------- + * + * lwlocklist.h + * + * The predefined LWLock list is kept in its own source file for use by + * automatic tools. The exact representation of a keyword is determined by + * the PG_LWLOCK macro, which is not defined in this file; it can be + * defined by the caller for special purposes. + * + * Also, generate-lwlocknames.pl processes this file to create lwlocknames.h. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/storage/lwlocklist.h + * + *------------------------------------------------------------------------- + */ + +/* + * Some commonly-used locks have predefined positions within MainLWLockArray; + * these are defined here. If you add a lock, add it to the end to avoid + * renumbering the existing locks; if you remove a lock, consider leaving a gap + * in the numbering sequence for the benefit of DTrace and other external + * debugging scripts. Also, do not forget to update the section + * WaitEventLWLock of src/backend/utils/activity/wait_event_names.txt. + * + * Note that the names here don't include the Lock suffix, to appease the + * C preprocessor; it's added elsewhere. + */ + +/* 0 is available; was formerly BufFreelistLock */ +PG_LWLOCK(1, ShmemIndex) +PG_LWLOCK(2, OidGen) +PG_LWLOCK(3, XidGen) +PG_LWLOCK(4, ProcArray) +PG_LWLOCK(5, SInvalRead) +PG_LWLOCK(6, SInvalWrite) +PG_LWLOCK(7, WALBufMapping) +PG_LWLOCK(8, WALWrite) +PG_LWLOCK(9, ControlFile) +/* 10 was CheckpointLock */ +/* 11 was XactSLRULock */ +/* 12 was SubtransSLRULock */ +PG_LWLOCK(13, MultiXactGen) +/* 14 was MultiXactOffsetSLRULock */ +/* 15 was MultiXactMemberSLRULock */ +PG_LWLOCK(16, RelCacheInit) +PG_LWLOCK(17, CheckpointerComm) +PG_LWLOCK(18, TwoPhaseState) +PG_LWLOCK(19, TablespaceCreate) +PG_LWLOCK(20, BtreeVacuum) +PG_LWLOCK(21, AddinShmemInit) +PG_LWLOCK(22, Autovacuum) +PG_LWLOCK(23, AutovacuumSchedule) +PG_LWLOCK(24, SyncScan) +PG_LWLOCK(25, RelationMapping) +/* 26 was NotifySLRULock */ +PG_LWLOCK(27, NotifyQueue) +PG_LWLOCK(28, SerializableXactHash) +PG_LWLOCK(29, SerializableFinishedList) +PG_LWLOCK(30, SerializablePredicateList) +/* 31 was SerialSLRULock */ +PG_LWLOCK(32, SyncRep) +PG_LWLOCK(33, BackgroundWorker) +PG_LWLOCK(34, DynamicSharedMemoryControl) +PG_LWLOCK(35, AutoFile) +PG_LWLOCK(36, ReplicationSlotAllocation) +PG_LWLOCK(37, ReplicationSlotControl) +/* 38 was CommitTsSLRULock */ +PG_LWLOCK(39, CommitTs) +PG_LWLOCK(40, ReplicationOrigin) +PG_LWLOCK(41, MultiXactTruncation) +/* 42 was OldSnapshotTimeMapLock */ +PG_LWLOCK(43, LogicalRepWorker) +PG_LWLOCK(44, XactTruncation) +/* 45 was XactTruncationLock until removal of BackendRandomLock */ +PG_LWLOCK(46, WrapLimitsVacuum) +PG_LWLOCK(47, NotifyQueueTail) +PG_LWLOCK(48, WaitEventCustom) +PG_LWLOCK(49, WALSummarizer) +PG_LWLOCK(50, DSMRegistry) +PG_LWLOCK(51, InjectionPoint) +PG_LWLOCK(52, SerialControl) +PG_LWLOCK(53, AioWorkerSubmissionQueue) diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lwlocknames.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lwlocknames.h new file mode 100644 index 0000000..1763ca5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/lwlocknames.h @@ -0,0 +1,48 @@ +/* autogenerated from src/include/storage/lwlocklist.h, do not edit */ +/* there is deliberately not an #ifndef LWLOCKNAMES_H here */ + +#define ShmemIndexLock (&MainLWLockArray[1].lock) +#define OidGenLock (&MainLWLockArray[2].lock) +#define XidGenLock (&MainLWLockArray[3].lock) +#define ProcArrayLock (&MainLWLockArray[4].lock) +#define SInvalReadLock (&MainLWLockArray[5].lock) +#define SInvalWriteLock (&MainLWLockArray[6].lock) +#define WALBufMappingLock (&MainLWLockArray[7].lock) +#define WALWriteLock (&MainLWLockArray[8].lock) +#define ControlFileLock (&MainLWLockArray[9].lock) +#define MultiXactGenLock (&MainLWLockArray[13].lock) +#define RelCacheInitLock (&MainLWLockArray[16].lock) +#define CheckpointerCommLock (&MainLWLockArray[17].lock) +#define TwoPhaseStateLock (&MainLWLockArray[18].lock) +#define TablespaceCreateLock (&MainLWLockArray[19].lock) +#define BtreeVacuumLock (&MainLWLockArray[20].lock) +#define AddinShmemInitLock (&MainLWLockArray[21].lock) +#define AutovacuumLock (&MainLWLockArray[22].lock) +#define AutovacuumScheduleLock (&MainLWLockArray[23].lock) +#define SyncScanLock (&MainLWLockArray[24].lock) +#define RelationMappingLock (&MainLWLockArray[25].lock) +#define NotifyQueueLock (&MainLWLockArray[27].lock) +#define SerializableXactHashLock (&MainLWLockArray[28].lock) +#define SerializableFinishedListLock (&MainLWLockArray[29].lock) +#define SerializablePredicateListLock (&MainLWLockArray[30].lock) +#define SyncRepLock (&MainLWLockArray[32].lock) +#define BackgroundWorkerLock (&MainLWLockArray[33].lock) +#define DynamicSharedMemoryControlLock (&MainLWLockArray[34].lock) +#define AutoFileLock (&MainLWLockArray[35].lock) +#define ReplicationSlotAllocationLock (&MainLWLockArray[36].lock) +#define ReplicationSlotControlLock (&MainLWLockArray[37].lock) +#define CommitTsLock (&MainLWLockArray[39].lock) +#define ReplicationOriginLock (&MainLWLockArray[40].lock) +#define MultiXactTruncationLock (&MainLWLockArray[41].lock) +#define LogicalRepWorkerLock (&MainLWLockArray[43].lock) +#define XactTruncationLock (&MainLWLockArray[44].lock) +#define WrapLimitsVacuumLock (&MainLWLockArray[46].lock) +#define NotifyQueueTailLock (&MainLWLockArray[47].lock) +#define WaitEventCustomLock (&MainLWLockArray[48].lock) +#define WALSummarizerLock (&MainLWLockArray[49].lock) +#define DSMRegistryLock (&MainLWLockArray[50].lock) +#define InjectionPointLock (&MainLWLockArray[51].lock) +#define SerialControlLock (&MainLWLockArray[52].lock) +#define AioWorkerSubmissionQueueLock (&MainLWLockArray[53].lock) + +#define NUM_INDIVIDUAL_LWLOCKS 54 diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/md.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/md.h new file mode 100644 index 0000000..b563c27 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/md.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * md.h + * magnetic disk storage manager public interface declarations. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/md.h + * + *------------------------------------------------------------------------- + */ +#ifndef MD_H +#define MD_H + +#include "storage/aio_types.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "storage/smgr.h" +#include "storage/sync.h" + +extern PGDLLIMPORT const PgAioHandleCallbacks aio_md_readv_cb; + +/* md storage manager functionality */ +extern void mdinit(void); +extern void mdopen(SMgrRelation reln); +extern void mdclose(SMgrRelation reln, ForkNumber forknum); +extern void mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo); +extern bool mdexists(SMgrRelation reln, ForkNumber forknum); +extern void mdunlink(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo); +extern void mdextend(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, const void *buffer, bool skipFsync); +extern void mdzeroextend(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, int nblocks, bool skipFsync); +extern bool mdprefetch(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, int nblocks); +extern uint32 mdmaxcombine(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum); +extern void mdreadv(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, + void **buffers, BlockNumber nblocks); +extern void mdstartreadv(PgAioHandle *ioh, + SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, + void **buffers, BlockNumber nblocks); +extern void mdwritev(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, + const void **buffers, BlockNumber nblocks, bool skipFsync); +extern void mdwriteback(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, BlockNumber nblocks); +extern BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum); +extern void mdtruncate(SMgrRelation reln, ForkNumber forknum, + BlockNumber curnblk, BlockNumber nblocks); +extern void mdimmedsync(SMgrRelation reln, ForkNumber forknum); +extern void mdregistersync(SMgrRelation reln, ForkNumber forknum); +extern int mdfd(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, uint32 *off); + +extern void ForgetDatabaseSyncRequests(Oid dbid); +extern void DropRelationFiles(RelFileLocator *delrels, int ndelrels, bool isRedo); + +/* md sync callbacks */ +extern int mdsyncfiletag(const FileTag *ftag, char *path); +extern int mdunlinkfiletag(const FileTag *ftag, char *path); +extern bool mdfiletagmatches(const FileTag *ftag, const FileTag *candidate); + +#endif /* MD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/off.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/off.h new file mode 100644 index 0000000..b0bcd37 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/off.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * off.h + * POSTGRES disk "offset" definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/off.h + * + *------------------------------------------------------------------------- + */ +#ifndef OFF_H +#define OFF_H + +#include "storage/itemid.h" +/* + * OffsetNumber: + * + * this is a 1-based index into the linp (ItemIdData) array in the + * header of each disk page. + */ +typedef uint16 OffsetNumber; + +#define InvalidOffsetNumber ((OffsetNumber) 0) +#define FirstOffsetNumber ((OffsetNumber) 1) +#define MaxOffsetNumber ((OffsetNumber) (BLCKSZ / sizeof(ItemIdData))) + +/* ---------------- + * support macros + * ---------------- + */ + +/* + * OffsetNumberIsValid + * True iff the offset number is valid. + */ +#define OffsetNumberIsValid(offsetNumber) \ + ((bool) ((offsetNumber != InvalidOffsetNumber) && \ + (offsetNumber <= MaxOffsetNumber))) + +/* + * OffsetNumberNext + * OffsetNumberPrev + * Increments/decrements the argument. These macros look pointless + * but they help us disambiguate the different manipulations on + * OffsetNumbers (e.g., sometimes we subtract one from an + * OffsetNumber to move back, and sometimes we do so to form a + * real C array index). + */ +#define OffsetNumberNext(offsetNumber) \ + ((OffsetNumber) (1 + (offsetNumber))) +#define OffsetNumberPrev(offsetNumber) \ + ((OffsetNumber) (-1 + (offsetNumber))) + +#endif /* OFF_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/pg_sema.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/pg_sema.h new file mode 100644 index 0000000..fa6ca35 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/pg_sema.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_sema.h + * Platform-independent API for semaphores. + * + * PostgreSQL requires counting semaphores (the kind that keep track of + * multiple unlock operations, and will allow an equal number of subsequent + * lock operations before blocking). The underlying implementation is + * not the same on every platform. This file defines the API that must + * be provided by each port. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/pg_sema.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SEMA_H +#define PG_SEMA_H + +/* + * struct PGSemaphoreData and pointer type PGSemaphore are the data structure + * representing an individual semaphore. The contents of PGSemaphoreData vary + * across implementations and must never be touched by platform-independent + * code; hence, PGSemaphoreData is declared as an opaque struct here. + * + * However, Windows is sufficiently unlike our other ports that it doesn't + * seem worth insisting on ABI compatibility for Windows too. Hence, on + * that platform just define PGSemaphore as HANDLE. + */ +#ifndef USE_WIN32_SEMAPHORES +typedef struct PGSemaphoreData *PGSemaphore; +#else +typedef HANDLE PGSemaphore; +#endif + + +/* Report amount of shared memory needed */ +extern Size PGSemaphoreShmemSize(int maxSemas); + +/* Module initialization (called during postmaster start or shmem reinit) */ +extern void PGReserveSemaphores(int maxSemas); + +/* Allocate a PGSemaphore structure with initial count 1 */ +extern PGSemaphore PGSemaphoreCreate(void); + +/* Reset a previously-initialized PGSemaphore to have count 0 */ +extern void PGSemaphoreReset(PGSemaphore sema); + +/* Lock a semaphore (decrement count), blocking if count would be < 0 */ +extern void PGSemaphoreLock(PGSemaphore sema); + +/* Unlock a semaphore (increment count) */ +extern void PGSemaphoreUnlock(PGSemaphore sema); + +/* Lock a semaphore only if able to do so without blocking */ +extern bool PGSemaphoreTryLock(PGSemaphore sema); + +#endif /* PG_SEMA_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/pg_shmem.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/pg_shmem.h new file mode 100644 index 0000000..5f7d4b8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/pg_shmem.h @@ -0,0 +1,94 @@ +/*------------------------------------------------------------------------- + * + * pg_shmem.h + * Platform-independent API for shared memory support. + * + * Every port is expected to support shared memory with approximately + * SysV-ish semantics; in particular, a memory block is not anonymous + * but has an ID, and we must be able to tell whether there are any + * remaining processes attached to a block of a specified ID. + * + * To simplify life for the SysV implementation, the ID is assumed to + * consist of two unsigned long values (these are key and ID in SysV + * terms). Other platforms may ignore the second value if they need + * only one ID number. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/pg_shmem.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHMEM_H +#define PG_SHMEM_H + +#include "storage/dsm_impl.h" + +typedef struct PGShmemHeader /* standard header for all Postgres shmem */ +{ + int32 magic; /* magic # to identify Postgres segments */ +#define PGShmemMagic 679834894 + pid_t creatorPID; /* PID of creating process (set but unread) */ + Size totalsize; /* total size of segment */ + Size freeoffset; /* offset to first free space */ + dsm_handle dsm_control; /* ID of dynamic shared memory control seg */ + void *index; /* pointer to ShmemIndex table */ +#ifndef WIN32 /* Windows doesn't have useful inode#s */ + dev_t device; /* device data directory is on */ + ino_t inode; /* inode number of data directory */ +#endif +} PGShmemHeader; + +/* GUC variables */ +extern PGDLLIMPORT int shared_memory_type; +extern PGDLLIMPORT int huge_pages; +extern PGDLLIMPORT int huge_page_size; +extern PGDLLIMPORT int huge_pages_status; + +/* Possible values for huge_pages and huge_pages_status */ +typedef enum +{ + HUGE_PAGES_OFF, + HUGE_PAGES_ON, + HUGE_PAGES_TRY, /* only for huge_pages */ + HUGE_PAGES_UNKNOWN, /* only for huge_pages_status */ +} HugePagesType; + +/* Possible values for shared_memory_type */ +typedef enum +{ + SHMEM_TYPE_WINDOWS, + SHMEM_TYPE_SYSV, + SHMEM_TYPE_MMAP, +} PGShmemType; + +#ifndef WIN32 +extern PGDLLIMPORT unsigned long UsedShmemSegID; +#else +extern PGDLLIMPORT HANDLE UsedShmemSegID; +extern PGDLLIMPORT void *ShmemProtectiveRegion; +#endif +extern PGDLLIMPORT void *UsedShmemSegAddr; + +#if !defined(WIN32) && !defined(EXEC_BACKEND) +#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_MMAP +#elif !defined(WIN32) +#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV +#else +#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_WINDOWS +#endif + +#ifdef EXEC_BACKEND +extern void PGSharedMemoryReAttach(void); +extern void PGSharedMemoryNoReAttach(void); +#endif + +extern PGShmemHeader *PGSharedMemoryCreate(Size size, + PGShmemHeader **shim); +extern bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2); +extern void PGSharedMemoryDetach(void); +extern void GetHugePageSize(Size *hugepagesize, int *mmap_flags); + +#endif /* PG_SHMEM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/pmsignal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/pmsignal.h new file mode 100644 index 0000000..428aa3f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/pmsignal.h @@ -0,0 +1,110 @@ +/*------------------------------------------------------------------------- + * + * pmsignal.h + * routines for signaling between the postmaster and its child processes + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/pmsignal.h + * + *------------------------------------------------------------------------- + */ +#ifndef PMSIGNAL_H +#define PMSIGNAL_H + +#include + +#ifdef HAVE_SYS_PRCTL_H +#include +#endif + +#ifdef HAVE_SYS_PROCCTL_H +#include +#endif + +/* + * Reasons for signaling the postmaster. We can cope with simultaneous + * signals for different reasons. If the same reason is signaled multiple + * times in quick succession, however, the postmaster is likely to observe + * only one notification of it. This is okay for the present uses. + */ +typedef enum +{ + PMSIGNAL_RECOVERY_STARTED, /* recovery has started */ + PMSIGNAL_RECOVERY_CONSISTENT, /* recovery has reached consistent state */ + PMSIGNAL_BEGIN_HOT_STANDBY, /* begin Hot Standby */ + PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */ + PMSIGNAL_START_AUTOVAC_LAUNCHER, /* start an autovacuum launcher */ + PMSIGNAL_START_AUTOVAC_WORKER, /* start an autovacuum worker */ + PMSIGNAL_BACKGROUND_WORKER_CHANGE, /* background worker state change */ + PMSIGNAL_START_WALRECEIVER, /* start a walreceiver */ + PMSIGNAL_ADVANCE_STATE_MACHINE, /* advance postmaster's state machine */ + PMSIGNAL_XLOG_IS_SHUTDOWN, /* ShutdownXLOG() completed */ +} PMSignalReason; + +#define NUM_PMSIGNALS (PMSIGNAL_XLOG_IS_SHUTDOWN+1) + +/* + * Reasons why the postmaster would send SIGQUIT to its children. + */ +typedef enum +{ + PMQUIT_NOT_SENT = 0, /* postmaster hasn't sent SIGQUIT */ + PMQUIT_FOR_CRASH, /* some other backend bought the farm */ + PMQUIT_FOR_STOP, /* immediate stop was commanded */ +} QuitSignalReason; + +/* PMSignalData is an opaque struct, details known only within pmsignal.c */ +typedef struct PMSignalData PMSignalData; + +#ifdef EXEC_BACKEND +extern PGDLLIMPORT volatile PMSignalData *PMSignalState; +#endif + +/* + * prototypes for functions in pmsignal.c + */ +extern Size PMSignalShmemSize(void); +extern void PMSignalShmemInit(void); +extern void SendPostmasterSignal(PMSignalReason reason); +extern bool CheckPostmasterSignal(PMSignalReason reason); +extern void SetQuitSignalReason(QuitSignalReason reason); +extern QuitSignalReason GetQuitSignalReason(void); +extern void MarkPostmasterChildSlotAssigned(int slot); +extern bool MarkPostmasterChildSlotUnassigned(int slot); +extern bool IsPostmasterChildWalSender(int slot); +extern void RegisterPostmasterChildActive(void); +extern void MarkPostmasterChildWalSender(void); +extern bool PostmasterIsAliveInternal(void); +extern void PostmasterDeathSignalInit(void); + + +/* + * Do we have a way to ask for a signal on parent death? + * + * If we do, pmsignal.c will set up a signal handler, that sets a flag when + * the parent dies. Checking the flag first makes PostmasterIsAlive() a lot + * cheaper in usual case that the postmaster is alive. + */ +#if (defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_PDEATHSIG)) || \ + (defined(HAVE_SYS_PROCCTL_H) && defined(PROC_PDEATHSIG_CTL)) +#define USE_POSTMASTER_DEATH_SIGNAL +#endif + +#ifdef USE_POSTMASTER_DEATH_SIGNAL +extern PGDLLIMPORT volatile sig_atomic_t postmaster_possibly_dead; + +static inline bool +PostmasterIsAlive(void) +{ + if (likely(!postmaster_possibly_dead)) + return true; + return PostmasterIsAliveInternal(); +} +#else +#define PostmasterIsAlive() PostmasterIsAliveInternal() +#endif + +#endif /* PMSIGNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/predicate.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/predicate.h new file mode 100644 index 0000000..267d5d9 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/predicate.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------------------------- + * + * predicate.h + * POSTGRES public predicate locking definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/predicate.h + * + *------------------------------------------------------------------------- + */ +#ifndef PREDICATE_H +#define PREDICATE_H + +#include "storage/itemptr.h" +#include "storage/lock.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + + +/* + * GUC variables + */ +extern PGDLLIMPORT int max_predicate_locks_per_xact; +extern PGDLLIMPORT int max_predicate_locks_per_relation; +extern PGDLLIMPORT int max_predicate_locks_per_page; + +/* + * A handle used for sharing SERIALIZABLEXACT objects between the participants + * in a parallel query. + */ +typedef void *SerializableXactHandle; + +/* + * function prototypes + */ + +/* housekeeping for shared memory predicate lock structures */ +extern void PredicateLockShmemInit(void); +extern Size PredicateLockShmemSize(void); + +extern void CheckPointPredicate(void); + +/* predicate lock reporting */ +extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno); + +/* predicate lock maintenance */ +extern Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot); +extern void SetSerializableTransactionSnapshot(Snapshot snapshot, + VirtualTransactionId *sourcevxid, + int sourcepid); +extern void RegisterPredicateLockingXid(TransactionId xid); +extern void PredicateLockRelation(Relation relation, Snapshot snapshot); +extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot); +extern void PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot, + TransactionId tuple_xid); +extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); +extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); +extern void TransferPredicateLocksToHeapRelation(Relation relation); +extern void ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe); + +/* conflict detection (may also trigger rollback) */ +extern bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot); +extern void CheckForSerializableConflictOut(Relation relation, TransactionId xid, Snapshot snapshot); +extern void CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno); +extern void CheckTableForSerializableConflictIn(Relation relation); + +/* final rollback checking */ +extern void PreCommit_CheckForSerializationFailure(void); + +/* two-phase commit support */ +extern void AtPrepare_PredicateLocks(void); +extern void PostPrepare_PredicateLocks(TransactionId xid); +extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit); +extern void predicatelock_twophase_recover(TransactionId xid, uint16 info, + void *recdata, uint32 len); + +/* parallel query support */ +extern SerializableXactHandle ShareSerializableXact(void); +extern void AttachSerializableXact(SerializableXactHandle handle); + +#endif /* PREDICATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/predicate_internals.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/predicate_internals.h new file mode 100644 index 0000000..5c3ea37 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/predicate_internals.h @@ -0,0 +1,478 @@ +/*------------------------------------------------------------------------- + * + * predicate_internals.h + * POSTGRES internal predicate locking definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/predicate_internals.h + * + *------------------------------------------------------------------------- + */ +#ifndef PREDICATE_INTERNALS_H +#define PREDICATE_INTERNALS_H + +#include "lib/ilist.h" +#include "storage/lock.h" +#include "storage/lwlock.h" + +/* + * Commit number. + */ +typedef uint64 SerCommitSeqNo; + +/* + * Reserved commit sequence numbers: + * - 0 is reserved to indicate a non-existent SLRU entry; it cannot be + * used as a SerCommitSeqNo, even an invalid one + * - InvalidSerCommitSeqNo is used to indicate a transaction that + * hasn't committed yet, so use a number greater than all valid + * ones to make comparison do the expected thing + * - RecoverySerCommitSeqNo is used to refer to transactions that + * happened before a crash/recovery, since we restart the sequence + * at that point. It's earlier than all normal sequence numbers, + * and is only used by recovered prepared transactions + */ +#define InvalidSerCommitSeqNo ((SerCommitSeqNo) PG_UINT64_MAX) +#define RecoverySerCommitSeqNo ((SerCommitSeqNo) 1) +#define FirstNormalSerCommitSeqNo ((SerCommitSeqNo) 2) + +/* + * The SERIALIZABLEXACT struct contains information needed for each + * serializable database transaction to support SSI techniques. + * + * A home-grown list is maintained in shared memory to manage these. + * An entry is used when the serializable transaction acquires a snapshot. + * Unless the transaction is rolled back, this entry must generally remain + * until all concurrent transactions have completed. (There are special + * optimizations for READ ONLY transactions which often allow them to be + * cleaned up earlier.) A transaction which is rolled back is cleaned up + * as soon as possible. + * + * Eligibility for cleanup of committed transactions is generally determined + * by comparing the transaction's finishedBefore field to + * SxactGlobalXmin. + */ +typedef struct SERIALIZABLEXACT +{ + VirtualTransactionId vxid; /* The executing process always has one of + * these. */ + + /* + * We use two numbers to track the order that transactions commit. Before + * commit, a transaction is marked as prepared, and prepareSeqNo is set. + * Shortly after commit, it's marked as committed, and commitSeqNo is set. + * This doesn't give a strict commit order, but these two values together + * are good enough for us, as we can always err on the safe side and + * assume that there's a conflict, if we can't be sure of the exact + * ordering of two commits. + * + * Note that a transaction is marked as prepared for a short period during + * commit processing, even if two-phase commit is not used. But with + * two-phase commit, a transaction can stay in prepared state for some + * time. + */ + SerCommitSeqNo prepareSeqNo; + SerCommitSeqNo commitSeqNo; + + /* these values are not both interesting at the same time */ + union + { + SerCommitSeqNo earliestOutConflictCommit; /* when committed with + * conflict out */ + SerCommitSeqNo lastCommitBeforeSnapshot; /* when not committed or + * no conflict out */ + } SeqNo; + dlist_head outConflicts; /* list of write transactions whose data we + * couldn't read. */ + dlist_head inConflicts; /* list of read transactions which couldn't + * see our write. */ + dlist_head predicateLocks; /* list of associated PREDICATELOCK objects */ + dlist_node finishedLink; /* list link in + * FinishedSerializableTransactions */ + dlist_node xactLink; /* PredXact->activeList/availableList */ + + /* + * perXactPredicateListLock is only used in parallel queries: it protects + * this SERIALIZABLEXACT's predicate lock list against other workers of + * the same session. + */ + LWLock perXactPredicateListLock; + + /* + * for r/o transactions: list of concurrent r/w transactions that we could + * potentially have conflicts with, and vice versa for r/w transactions + */ + dlist_head possibleUnsafeConflicts; + + TransactionId topXid; /* top level xid for the transaction, if one + * exists; else invalid */ + TransactionId finishedBefore; /* invalid means still running; else the + * struct expires when no serializable + * xids are before this. */ + TransactionId xmin; /* the transaction's snapshot xmin */ + uint32 flags; /* OR'd combination of values defined below */ + int pid; /* pid of associated process */ + int pgprocno; /* pgprocno of associated process */ +} SERIALIZABLEXACT; + +#define SXACT_FLAG_COMMITTED 0x00000001 /* already committed */ +#define SXACT_FLAG_PREPARED 0x00000002 /* about to commit */ +#define SXACT_FLAG_ROLLED_BACK 0x00000004 /* already rolled back */ +#define SXACT_FLAG_DOOMED 0x00000008 /* will roll back */ +/* + * The following flag actually means that the flagged transaction has a + * conflict out *to a transaction which committed ahead of it*. It's hard + * to get that into a name of a reasonable length. + */ +#define SXACT_FLAG_CONFLICT_OUT 0x00000010 +#define SXACT_FLAG_READ_ONLY 0x00000020 +#define SXACT_FLAG_DEFERRABLE_WAITING 0x00000040 +#define SXACT_FLAG_RO_SAFE 0x00000080 +#define SXACT_FLAG_RO_UNSAFE 0x00000100 +#define SXACT_FLAG_SUMMARY_CONFLICT_IN 0x00000200 +#define SXACT_FLAG_SUMMARY_CONFLICT_OUT 0x00000400 +/* + * The following flag means the transaction has been partially released + * already, but is being preserved because parallel workers might have a + * reference to it. It'll be recycled by the leader at end-of-transaction. + */ +#define SXACT_FLAG_PARTIALLY_RELEASED 0x00000800 + +typedef struct PredXactListData +{ + dlist_head availableList; + dlist_head activeList; + + /* + * These global variables are maintained when registering and cleaning up + * serializable transactions. They must be global across all backends, + * but are not needed outside the predicate.c source file. Protected by + * SerializableXactHashLock. + */ + TransactionId SxactGlobalXmin; /* global xmin for active serializable + * transactions */ + int SxactGlobalXminCount; /* how many active serializable + * transactions have this xmin */ + int WritableSxactCount; /* how many non-read-only serializable + * transactions are active */ + SerCommitSeqNo LastSxactCommitSeqNo; /* a strictly monotonically + * increasing number for commits + * of serializable transactions */ + /* Protected by SerializableXactHashLock. */ + SerCommitSeqNo CanPartialClearThrough; /* can clear predicate locks and + * inConflicts for committed + * transactions through this seq + * no */ + /* Protected by SerializableFinishedListLock. */ + SerCommitSeqNo HavePartialClearedThrough; /* have cleared through this + * seq no */ + SERIALIZABLEXACT *OldCommittedSxact; /* shared copy of dummy sxact */ + + SERIALIZABLEXACT *element; +} PredXactListData; + +typedef struct PredXactListData *PredXactList; + +#define PredXactListDataSize \ + ((Size)MAXALIGN(sizeof(PredXactListData))) + + +/* + * The following types are used to provide lists of rw-conflicts between + * pairs of transactions. Since exactly the same information is needed, + * they are also used to record possible unsafe transaction relationships + * for purposes of identifying safe snapshots for read-only transactions. + * + * When a RWConflictData is not in use to record either type of relationship + * between a pair of transactions, it is kept on an "available" list. The + * outLink field is used for maintaining that list. + */ +typedef struct RWConflictData +{ + dlist_node outLink; /* link for list of conflicts out from a sxact */ + dlist_node inLink; /* link for list of conflicts in to a sxact */ + SERIALIZABLEXACT *sxactOut; + SERIALIZABLEXACT *sxactIn; +} RWConflictData; + +typedef struct RWConflictData *RWConflict; + +#define RWConflictDataSize \ + ((Size)MAXALIGN(sizeof(RWConflictData))) + +typedef struct RWConflictPoolHeaderData +{ + dlist_head availableList; + RWConflict element; +} RWConflictPoolHeaderData; + +typedef struct RWConflictPoolHeaderData *RWConflictPoolHeader; + +#define RWConflictPoolHeaderDataSize \ + ((Size)MAXALIGN(sizeof(RWConflictPoolHeaderData))) + + +/* + * The SERIALIZABLEXIDTAG struct identifies an xid assigned to a serializable + * transaction or any of its subtransactions. + */ +typedef struct SERIALIZABLEXIDTAG +{ + TransactionId xid; +} SERIALIZABLEXIDTAG; + +/* + * The SERIALIZABLEXID struct provides a link from a TransactionId for a + * serializable transaction to the related SERIALIZABLEXACT record, even if + * the transaction has completed and its connection has been closed. + * + * These are created as new top level transaction IDs are first assigned to + * transactions which are participating in predicate locking. This may + * never happen for a particular transaction if it doesn't write anything. + * They are removed with their related serializable transaction objects. + * + * The SubTransGetTopmostTransaction method is used where necessary to get + * from an XID which might be from a subtransaction to the top level XID. + */ +typedef struct SERIALIZABLEXID +{ + /* hash key */ + SERIALIZABLEXIDTAG tag; + + /* data */ + SERIALIZABLEXACT *myXact; /* pointer to the top level transaction data */ +} SERIALIZABLEXID; + + +/* + * The PREDICATELOCKTARGETTAG struct identifies a database object which can + * be the target of predicate locks. + * + * Note that the hash function being used doesn't properly respect tag + * length -- if the length of the structure isn't a multiple of four bytes it + * will go to a four byte boundary past the end of the tag. If you change + * this struct, make sure any slack space is initialized, so that any random + * bytes in the middle or at the end are not included in the hash. + * + * TODO SSI: If we always use the same fields for the same type of value, we + * should rename these. Holding off until it's clear there are no exceptions. + * Since indexes are relations with blocks and tuples, it's looking likely that + * the rename will be possible. If not, we may need to divide the last field + * and use part of it for a target type, so that we know how to interpret the + * data.. + */ +typedef struct PREDICATELOCKTARGETTAG +{ + uint32 locktag_field1; /* a 32-bit ID field */ + uint32 locktag_field2; /* a 32-bit ID field */ + uint32 locktag_field3; /* a 32-bit ID field */ + uint32 locktag_field4; /* a 32-bit ID field */ +} PREDICATELOCKTARGETTAG; + +/* + * The PREDICATELOCKTARGET struct represents a database object on which there + * are predicate locks. + * + * A hash list of these objects is maintained in shared memory. An entry is + * added when a predicate lock is requested on an object which doesn't + * already have one. An entry is removed when the last lock is removed from + * its list. + */ +typedef struct PREDICATELOCKTARGET +{ + /* hash key */ + PREDICATELOCKTARGETTAG tag; /* unique identifier of lockable object */ + + /* data */ + dlist_head predicateLocks; /* list of PREDICATELOCK objects assoc. with + * predicate lock target */ +} PREDICATELOCKTARGET; + + +/* + * The PREDICATELOCKTAG struct identifies an individual predicate lock. + * + * It is the combination of predicate lock target (which is a lockable + * object) and a serializable transaction which has acquired a lock on that + * target. + */ +typedef struct PREDICATELOCKTAG +{ + PREDICATELOCKTARGET *myTarget; + SERIALIZABLEXACT *myXact; +} PREDICATELOCKTAG; + +/* + * The PREDICATELOCK struct represents an individual lock. + * + * An entry can be created here when the related database object is read, or + * by promotion of multiple finer-grained targets. All entries related to a + * serializable transaction are removed when that serializable transaction is + * cleaned up. Entries can also be removed when they are combined into a + * single coarser-grained lock entry. + */ +typedef struct PREDICATELOCK +{ + /* hash key */ + PREDICATELOCKTAG tag; /* unique identifier of lock */ + + /* data */ + dlist_node targetLink; /* list link in PREDICATELOCKTARGET's list of + * predicate locks */ + dlist_node xactLink; /* list link in SERIALIZABLEXACT's list of + * predicate locks */ + SerCommitSeqNo commitSeqNo; /* only used for summarized predicate locks */ +} PREDICATELOCK; + + +/* + * The LOCALPREDICATELOCK struct represents a local copy of data which is + * also present in the PREDICATELOCK table, organized for fast access without + * needing to acquire a LWLock. It is strictly for optimization. + * + * Each serializable transaction creates its own local hash table to hold a + * collection of these. This information is used to determine when a number + * of fine-grained locks should be promoted to a single coarser-grained lock. + * The information is maintained more-or-less in parallel to the + * PREDICATELOCK data, but because this data is not protected by locks and is + * only used in an optimization heuristic, it is allowed to drift in a few + * corner cases where maintaining exact data would be expensive. + * + * The hash table is created when the serializable transaction acquires its + * snapshot, and its memory is released upon completion of the transaction. + */ +typedef struct LOCALPREDICATELOCK +{ + /* hash key */ + PREDICATELOCKTARGETTAG tag; /* unique identifier of lockable object */ + + /* data */ + bool held; /* is lock held, or just its children? */ + int childLocks; /* number of child locks currently held */ +} LOCALPREDICATELOCK; + + +/* + * The types of predicate locks which can be acquired. + */ +typedef enum PredicateLockTargetType +{ + PREDLOCKTAG_RELATION, + PREDLOCKTAG_PAGE, + PREDLOCKTAG_TUPLE, + /* TODO SSI: Other types may be needed for index locking */ +} PredicateLockTargetType; + + +/* + * This structure is used to quickly capture a copy of all predicate + * locks. This is currently used only by the pg_lock_status function, + * which in turn is used by the pg_locks view. + */ +typedef struct PredicateLockData +{ + int nelements; + PREDICATELOCKTARGETTAG *locktags; + SERIALIZABLEXACT *xacts; +} PredicateLockData; + + +/* + * These macros define how we map logical IDs of lockable objects into the + * physical fields of PREDICATELOCKTARGETTAG. Use these to set up values, + * rather than accessing the fields directly. Note multiple eval of target! + */ +#define SET_PREDICATELOCKTARGETTAG_RELATION(locktag,dboid,reloid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = InvalidBlockNumber, \ + (locktag).locktag_field4 = InvalidOffsetNumber) + +#define SET_PREDICATELOCKTARGETTAG_PAGE(locktag,dboid,reloid,blocknum) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = (blocknum), \ + (locktag).locktag_field4 = InvalidOffsetNumber) + +#define SET_PREDICATELOCKTARGETTAG_TUPLE(locktag,dboid,reloid,blocknum,offnum) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = (blocknum), \ + (locktag).locktag_field4 = (offnum)) + +#define GET_PREDICATELOCKTARGETTAG_DB(locktag) \ + ((Oid) (locktag).locktag_field1) +#define GET_PREDICATELOCKTARGETTAG_RELATION(locktag) \ + ((Oid) (locktag).locktag_field2) +#define GET_PREDICATELOCKTARGETTAG_PAGE(locktag) \ + ((BlockNumber) (locktag).locktag_field3) +#define GET_PREDICATELOCKTARGETTAG_OFFSET(locktag) \ + ((OffsetNumber) (locktag).locktag_field4) +#define GET_PREDICATELOCKTARGETTAG_TYPE(locktag) \ + (((locktag).locktag_field4 != InvalidOffsetNumber) ? PREDLOCKTAG_TUPLE : \ + (((locktag).locktag_field3 != InvalidBlockNumber) ? PREDLOCKTAG_PAGE : \ + PREDLOCKTAG_RELATION)) + +/* + * Two-phase commit statefile records. There are two types: for each + * transaction, we generate one per-transaction record and a variable + * number of per-predicate-lock records. + */ +typedef enum TwoPhasePredicateRecordType +{ + TWOPHASEPREDICATERECORD_XACT, + TWOPHASEPREDICATERECORD_LOCK, +} TwoPhasePredicateRecordType; + +/* + * Per-transaction information to reconstruct a SERIALIZABLEXACT. Not + * much is needed because most of it not meaningful for a recovered + * prepared transaction. + * + * In particular, we do not record the in and out conflict lists for a + * prepared transaction because the associated SERIALIZABLEXACTs will + * not be available after recovery. Instead, we simply record the + * existence of each type of conflict by setting the transaction's + * summary conflict in/out flag. + */ +typedef struct TwoPhasePredicateXactRecord +{ + TransactionId xmin; + uint32 flags; +} TwoPhasePredicateXactRecord; + +/* Per-lock state */ +typedef struct TwoPhasePredicateLockRecord +{ + PREDICATELOCKTARGETTAG target; + uint32 filler; /* to avoid length change in back-patched fix */ +} TwoPhasePredicateLockRecord; + +typedef struct TwoPhasePredicateRecord +{ + TwoPhasePredicateRecordType type; + union + { + TwoPhasePredicateXactRecord xactRecord; + TwoPhasePredicateLockRecord lockRecord; + } data; +} TwoPhasePredicateRecord; + +/* + * Define a macro to use for an "empty" SERIALIZABLEXACT reference. + */ +#define InvalidSerializableXact ((SERIALIZABLEXACT *) NULL) + + +/* + * Function definitions for functions needing awareness of predicate + * locking internals. + */ +extern PredicateLockData *GetPredicateLockStatusData(void); +extern int GetSafeSnapshotBlockingPids(int blocked_pid, + int *output, int output_size); + +#endif /* PREDICATE_INTERNALS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/proc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/proc.h new file mode 100644 index 0000000..9f9b3fc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/proc.h @@ -0,0 +1,515 @@ +/*------------------------------------------------------------------------- + * + * proc.h + * per-process shared memory data structures + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/proc.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PROC_H_ +#define _PROC_H_ + +#include "access/clog.h" +#include "access/xlogdefs.h" +#include "lib/ilist.h" +#include "storage/latch.h" +#include "storage/lock.h" +#include "storage/pg_sema.h" +#include "storage/proclist_types.h" +#include "storage/procnumber.h" + +/* + * Each backend advertises up to PGPROC_MAX_CACHED_SUBXIDS TransactionIds + * for non-aborted subtransactions of its current top transaction. These + * have to be treated as running XIDs by other backends. + * + * We also keep track of whether the cache overflowed (ie, the transaction has + * generated at least one subtransaction that didn't fit in the cache). + * If none of the caches have overflowed, we can assume that an XID that's not + * listed anywhere in the PGPROC array is not a running transaction. Else we + * have to look at pg_subtrans. + * + * See src/test/isolation/specs/subxid-overflow.spec if you change this. + */ +#define PGPROC_MAX_CACHED_SUBXIDS 64 /* XXX guessed-at value */ + +typedef struct XidCacheStatus +{ + /* number of cached subxids, never more than PGPROC_MAX_CACHED_SUBXIDS */ + uint8 count; + /* has PGPROC->subxids overflowed */ + bool overflowed; +} XidCacheStatus; + +struct XidCache +{ + TransactionId xids[PGPROC_MAX_CACHED_SUBXIDS]; +}; + +/* + * Flags for PGPROC->statusFlags and PROC_HDR->statusFlags[] + */ +#define PROC_IS_AUTOVACUUM 0x01 /* is it an autovac worker? */ +#define PROC_IN_VACUUM 0x02 /* currently running lazy vacuum */ +#define PROC_IN_SAFE_IC 0x04 /* currently running CREATE INDEX + * CONCURRENTLY or REINDEX + * CONCURRENTLY on non-expressional, + * non-partial index */ +#define PROC_VACUUM_FOR_WRAPAROUND 0x08 /* set by autovac only */ +#define PROC_IN_LOGICAL_DECODING 0x10 /* currently doing logical + * decoding outside xact */ +#define PROC_AFFECTS_ALL_HORIZONS 0x20 /* this proc's xmin must be + * included in vacuum horizons + * in all databases */ + +/* flags reset at EOXact */ +#define PROC_VACUUM_STATE_MASK \ + (PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND) + +/* + * Xmin-related flags. Make sure any flags that affect how the process' Xmin + * value is interpreted by VACUUM are included here. + */ +#define PROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC) + +/* + * We allow a limited number of "weak" relation locks (AccessShareLock, + * RowShareLock, RowExclusiveLock) to be recorded in the PGPROC structure + * (or rather in shared memory referenced from PGPROC) rather than the main + * lock table. This eases contention on the lock manager LWLocks. See + * storage/lmgr/README for additional details. + */ +extern PGDLLIMPORT int FastPathLockGroupsPerBackend; + +/* + * Define the maximum number of fast-path locking groups per backend. + * This must be a power-of-two value. The actual number of fast-path + * lock groups is calculated in InitializeFastPathLocks() based on + * max_locks_per_transaction. 1024 is an arbitrary upper limit (matching + * max_locks_per_transaction = 16k). Values over 1024 are unlikely to be + * beneficial as there are bottlenecks we'll hit way before that. + */ +#define FP_LOCK_GROUPS_PER_BACKEND_MAX 1024 +#define FP_LOCK_SLOTS_PER_GROUP 16 /* don't change */ +#define FastPathLockSlotsPerBackend() \ + (FP_LOCK_SLOTS_PER_GROUP * FastPathLockGroupsPerBackend) + +/* + * Flags for PGPROC.delayChkptFlags + * + * These flags can be used to delay the start or completion of a checkpoint + * for short periods. A flag is in effect if the corresponding bit is set in + * the PGPROC of any backend. + * + * For our purposes here, a checkpoint has three phases: (1) determine the + * location to which the redo pointer will be moved, (2) write all the + * data durably to disk, and (3) WAL-log the checkpoint. + * + * Setting DELAY_CHKPT_START prevents the system from moving from phase 1 + * to phase 2. This is useful when we are performing a WAL-logged modification + * of data that will be flushed to disk in phase 2. By setting this flag + * before writing WAL and clearing it after we've both written WAL and + * performed the corresponding modification, we ensure that if the WAL record + * is inserted prior to the new redo point, the corresponding data changes will + * also be flushed to disk before the checkpoint can complete. (In the + * extremely common case where the data being modified is in shared buffers + * and we acquire an exclusive content lock and MarkBufferDirty() on the + * relevant buffers before writing WAL, this mechanism is not needed, because + * phase 2 will block until we release the content lock and then flush the + * modified data to disk. See transam/README and SyncOneBuffer().) + * + * Setting DELAY_CHKPT_COMPLETE prevents the system from moving from phase 2 + * to phase 3. This is useful if we are performing a WAL-logged operation that + * might invalidate buffers, such as relation truncation. In this case, we need + * to ensure that any buffers which were invalidated and thus not flushed by + * the checkpoint are actually destroyed on disk. Replay can cope with a file + * or block that doesn't exist, but not with a block that has the wrong + * contents. + */ +#define DELAY_CHKPT_START (1<<0) +#define DELAY_CHKPT_COMPLETE (1<<1) + +typedef enum +{ + PROC_WAIT_STATUS_OK, + PROC_WAIT_STATUS_WAITING, + PROC_WAIT_STATUS_ERROR, +} ProcWaitStatus; + +/* + * Each backend has a PGPROC struct in shared memory. There is also a list of + * currently-unused PGPROC structs that will be reallocated to new backends. + * + * links: list link for any list the PGPROC is in. When waiting for a lock, + * the PGPROC is linked into that lock's waitProcs queue. A recycled PGPROC + * is linked into ProcGlobal's freeProcs list. + * + * Note: twophase.c also sets up a dummy PGPROC struct for each currently + * prepared transaction. These PGPROCs appear in the ProcArray data structure + * so that the prepared transactions appear to be still running and are + * correctly shown as holding locks. A prepared transaction PGPROC can be + * distinguished from a real one at need by the fact that it has pid == 0. + * The semaphore and lock-activity fields in a prepared-xact PGPROC are unused, + * but its myProcLocks[] lists are valid. + * + * We allow many fields of this struct to be accessed without locks, such as + * delayChkptFlags and isRegularBackend. However, keep in mind that writing + * mirrored ones (see below) requires holding ProcArrayLock or XidGenLock in + * at least shared mode, so that pgxactoff does not change concurrently. + * + * Mirrored fields: + * + * Some fields in PGPROC (see "mirrored in ..." comment) are mirrored into an + * element of more densely packed ProcGlobal arrays. These arrays are indexed + * by PGPROC->pgxactoff. Both copies need to be maintained coherently. + * + * NB: The pgxactoff indexed value can *never* be accessed without holding + * locks. + * + * See PROC_HDR for details. + */ +struct PGPROC +{ + dlist_node links; /* list link if process is in a list */ + dlist_head *procgloballist; /* procglobal list that owns this PGPROC */ + + PGSemaphore sem; /* ONE semaphore to sleep on */ + ProcWaitStatus waitStatus; + + Latch procLatch; /* generic latch for process */ + + + TransactionId xid; /* id of top-level transaction currently being + * executed by this proc, if running and XID + * is assigned; else InvalidTransactionId. + * mirrored in ProcGlobal->xids[pgxactoff] */ + + TransactionId xmin; /* minimal running XID as it was when we were + * starting our xact, excluding LAZY VACUUM: + * vacuum must not remove tuples deleted by + * xid >= xmin ! */ + + int pid; /* Backend's process ID; 0 if prepared xact */ + + int pgxactoff; /* offset into various ProcGlobal->arrays with + * data mirrored from this PGPROC */ + + /* + * Currently running top-level transaction's virtual xid. Together these + * form a VirtualTransactionId, but we don't use that struct because this + * is not atomically assignable as whole, and we want to enforce code to + * consider both parts separately. See comments at VirtualTransactionId. + */ + struct + { + ProcNumber procNumber; /* For regular backends, equal to + * GetNumberFromPGProc(proc). For prepared + * xacts, ID of the original backend that + * processed the transaction. For unused + * PGPROC entries, INVALID_PROC_NUMBER. */ + LocalTransactionId lxid; /* local id of top-level transaction + * currently * being executed by this + * proc, if running; else + * InvalidLocalTransactionId */ + } vxid; + + /* These fields are zero while a backend is still starting up: */ + Oid databaseId; /* OID of database this backend is using */ + Oid roleId; /* OID of role using this backend */ + + Oid tempNamespaceId; /* OID of temp schema this backend is + * using */ + + bool isRegularBackend; /* true if it's a regular backend. */ + + /* + * While in hot standby mode, shows that a conflict signal has been sent + * for the current transaction. Set/cleared while holding ProcArrayLock, + * though not required. Accessed without lock, if needed. + */ + bool recoveryConflictPending; + + /* Info about LWLock the process is currently waiting for, if any. */ + uint8 lwWaiting; /* see LWLockWaitState */ + uint8 lwWaitMode; /* lwlock mode being waited for */ + proclist_node lwWaitLink; /* position in LW lock wait list */ + + /* Support for condition variables. */ + proclist_node cvWaitLink; /* position in CV wait list */ + + /* Info about lock the process is currently waiting for, if any. */ + /* waitLock and waitProcLock are NULL if not currently waiting. */ + LOCK *waitLock; /* Lock object we're sleeping on ... */ + PROCLOCK *waitProcLock; /* Per-holder info for awaited lock */ + LOCKMODE waitLockMode; /* type of lock we're waiting for */ + LOCKMASK heldLocks; /* bitmask for lock types already held on this + * lock object by this backend */ + pg_atomic_uint64 waitStart; /* time at which wait for lock acquisition + * started */ + + int delayChkptFlags; /* for DELAY_CHKPT_* flags */ + + uint8 statusFlags; /* this backend's status flags, see PROC_* + * above. mirrored in + * ProcGlobal->statusFlags[pgxactoff] */ + + /* + * Info to allow us to wait for synchronous replication, if needed. + * waitLSN is InvalidXLogRecPtr if not waiting; set only by user backend. + * syncRepState must not be touched except by owning process or WALSender. + * syncRepLinks used only while holding SyncRepLock. + */ + XLogRecPtr waitLSN; /* waiting for this LSN or higher */ + int syncRepState; /* wait state for sync rep */ + dlist_node syncRepLinks; /* list link if process is in syncrep queue */ + + /* + * All PROCLOCK objects for locks held or awaited by this backend are + * linked into one of these lists, according to the partition number of + * their lock. + */ + dlist_head myProcLocks[NUM_LOCK_PARTITIONS]; + + XidCacheStatus subxidStatus; /* mirrored with + * ProcGlobal->subxidStates[i] */ + struct XidCache subxids; /* cache for subtransaction XIDs */ + + /* Support for group XID clearing. */ + /* true, if member of ProcArray group waiting for XID clear */ + bool procArrayGroupMember; + /* next ProcArray group member waiting for XID clear */ + pg_atomic_uint32 procArrayGroupNext; + + /* + * latest transaction id among the transaction's main XID and + * subtransactions + */ + TransactionId procArrayGroupMemberXid; + + uint32 wait_event_info; /* proc's wait information */ + + /* Support for group transaction status update. */ + bool clogGroupMember; /* true, if member of clog group */ + pg_atomic_uint32 clogGroupNext; /* next clog group member */ + TransactionId clogGroupMemberXid; /* transaction id of clog group member */ + XidStatus clogGroupMemberXidStatus; /* transaction status of clog + * group member */ + int64 clogGroupMemberPage; /* clog page corresponding to + * transaction id of clog group member */ + XLogRecPtr clogGroupMemberLsn; /* WAL location of commit record for clog + * group member */ + + /* Lock manager data, recording fast-path locks taken by this backend. */ + LWLock fpInfoLock; /* protects per-backend fast-path state */ + uint64 *fpLockBits; /* lock modes held for each fast-path slot */ + Oid *fpRelId; /* slots for rel oids */ + bool fpVXIDLock; /* are we holding a fast-path VXID lock? */ + LocalTransactionId fpLocalTransactionId; /* lxid for fast-path VXID + * lock */ + + /* + * Support for lock groups. Use LockHashPartitionLockByProc on the group + * leader to get the LWLock protecting these fields. + */ + PGPROC *lockGroupLeader; /* lock group leader, if I'm a member */ + dlist_head lockGroupMembers; /* list of members, if I'm a leader */ + dlist_node lockGroupLink; /* my member link, if I'm a member */ +}; + +/* NOTE: "typedef struct PGPROC PGPROC" appears in storage/lock.h. */ + + +extern PGDLLIMPORT PGPROC *MyProc; + +/* + * There is one ProcGlobal struct for the whole database cluster. + * + * Adding/Removing an entry into the procarray requires holding *both* + * ProcArrayLock and XidGenLock in exclusive mode (in that order). Both are + * needed because the dense arrays (see below) are accessed from + * GetNewTransactionId() and GetSnapshotData(), and we don't want to add + * further contention by both using the same lock. Adding/Removing a procarray + * entry is much less frequent. + * + * Some fields in PGPROC are mirrored into more densely packed arrays (e.g. + * xids), with one entry for each backend. These arrays only contain entries + * for PGPROCs that have been added to the shared array with ProcArrayAdd() + * (in contrast to PGPROC array which has unused PGPROCs interspersed). + * + * The dense arrays are indexed by PGPROC->pgxactoff. Any concurrent + * ProcArrayAdd() / ProcArrayRemove() can lead to pgxactoff of a procarray + * member to change. Therefore it is only safe to use PGPROC->pgxactoff to + * access the dense array while holding either ProcArrayLock or XidGenLock. + * + * As long as a PGPROC is in the procarray, the mirrored values need to be + * maintained in both places in a coherent manner. + * + * The denser separate arrays are beneficial for three main reasons: First, to + * allow for as tight loops accessing the data as possible. Second, to prevent + * updates of frequently changing data (e.g. xmin) from invalidating + * cachelines also containing less frequently changing data (e.g. xid, + * statusFlags). Third to condense frequently accessed data into as few + * cachelines as possible. + * + * There are two main reasons to have the data mirrored between these dense + * arrays and PGPROC. First, as explained above, a PGPROC's array entries can + * only be accessed with either ProcArrayLock or XidGenLock held, whereas the + * PGPROC entries do not require that (obviously there may still be locking + * requirements around the individual field, separate from the concerns + * here). That is particularly important for a backend to efficiently checks + * it own values, which it often can safely do without locking. Second, the + * PGPROC fields allow to avoid unnecessary accesses and modification to the + * dense arrays. A backend's own PGPROC is more likely to be in a local cache, + * whereas the cachelines for the dense array will be modified by other + * backends (often removing it from the cache for other cores/sockets). At + * commit/abort time a check of the PGPROC value can avoid accessing/dirtying + * the corresponding array value. + * + * Basically it makes sense to access the PGPROC variable when checking a + * single backend's data, especially when already looking at the PGPROC for + * other reasons already. It makes sense to look at the "dense" arrays if we + * need to look at many / most entries, because we then benefit from the + * reduced indirection and better cross-process cache-ability. + * + * When entering a PGPROC for 2PC transactions with ProcArrayAdd(), the data + * in the dense arrays is initialized from the PGPROC while it already holds + * ProcArrayLock. + */ +typedef struct PROC_HDR +{ + /* Array of PGPROC structures (not including dummies for prepared txns) */ + PGPROC *allProcs; + + /* Array mirroring PGPROC.xid for each PGPROC currently in the procarray */ + TransactionId *xids; + + /* + * Array mirroring PGPROC.subxidStatus for each PGPROC currently in the + * procarray. + */ + XidCacheStatus *subxidStates; + + /* + * Array mirroring PGPROC.statusFlags for each PGPROC currently in the + * procarray. + */ + uint8 *statusFlags; + + /* Length of allProcs array */ + uint32 allProcCount; + /* Head of list of free PGPROC structures */ + dlist_head freeProcs; + /* Head of list of autovacuum & special worker free PGPROC structures */ + dlist_head autovacFreeProcs; + /* Head of list of bgworker free PGPROC structures */ + dlist_head bgworkerFreeProcs; + /* Head of list of walsender free PGPROC structures */ + dlist_head walsenderFreeProcs; + /* First pgproc waiting for group XID clear */ + pg_atomic_uint32 procArrayGroupFirst; + /* First pgproc waiting for group transaction status update */ + pg_atomic_uint32 clogGroupFirst; + + /* + * Current slot numbers of some auxiliary processes. There can be only one + * of each of these running at a time. + */ + ProcNumber walwriterProc; + ProcNumber checkpointerProc; + + /* Current shared estimate of appropriate spins_per_delay value */ + int spins_per_delay; + /* Buffer id of the buffer that Startup process waits for pin on, or -1 */ + int startupBufferPinWaitBufId; +} PROC_HDR; + +extern PGDLLIMPORT PROC_HDR *ProcGlobal; + +extern PGDLLIMPORT PGPROC *PreparedXactProcs; + +/* + * Accessors for getting PGPROC given a ProcNumber and vice versa. + */ +#define GetPGProcByNumber(n) (&ProcGlobal->allProcs[(n)]) +#define GetNumberFromPGProc(proc) ((proc) - &ProcGlobal->allProcs[0]) + +/* + * We set aside some extra PGPROC structures for "special worker" processes, + * which are full-fledged backends (they can run transactions) + * but are unique animals that there's never more than one of. + * Currently there are two such processes: the autovacuum launcher + * and the slotsync worker. + */ +#define NUM_SPECIAL_WORKER_PROCS 2 + +/* + * We set aside some extra PGPROC structures for auxiliary processes, + * ie things that aren't full-fledged backends (they cannot run transactions + * or take heavyweight locks) but need shmem access. + * + * Background writer, checkpointer, WAL writer, WAL summarizer, and archiver + * run during normal operation. Startup process and WAL receiver also consume + * 2 slots, but WAL writer is launched only after startup has exited, so we + * only need 6 slots. + */ +#define MAX_IO_WORKERS 32 +#define NUM_AUXILIARY_PROCS (6 + MAX_IO_WORKERS) + + +/* configurable options */ +extern PGDLLIMPORT int DeadlockTimeout; +extern PGDLLIMPORT int StatementTimeout; +extern PGDLLIMPORT int LockTimeout; +extern PGDLLIMPORT int IdleInTransactionSessionTimeout; +extern PGDLLIMPORT int TransactionTimeout; +extern PGDLLIMPORT int IdleSessionTimeout; +extern PGDLLIMPORT bool log_lock_waits; + +#ifdef EXEC_BACKEND +extern PGDLLIMPORT slock_t *ProcStructLock; +extern PGDLLIMPORT PGPROC *AuxiliaryProcs; +#endif + + +/* + * Function Prototypes + */ +extern int ProcGlobalSemas(void); +extern Size ProcGlobalShmemSize(void); +extern void InitProcGlobal(void); +extern void InitProcess(void); +extern void InitProcessPhase2(void); +extern void InitAuxiliaryProcess(void); + +extern void SetStartupBufferPinWaitBufId(int bufid); +extern int GetStartupBufferPinWaitBufId(void); + +extern bool HaveNFreeProcs(int n, int *nfree); +extern void ProcReleaseLocks(bool isCommit); + +extern ProcWaitStatus JoinWaitQueue(LOCALLOCK *locallock, + LockMethod lockMethodTable, bool dontWait); +extern ProcWaitStatus ProcSleep(LOCALLOCK *locallock); +extern void ProcWakeup(PGPROC *proc, ProcWaitStatus waitStatus); +extern void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock); +extern void CheckDeadLockAlert(void); +extern void LockErrorCleanup(void); +extern void GetLockHoldersAndWaiters(LOCALLOCK *locallock, + StringInfo lock_holders_sbuf, + StringInfo lock_waiters_sbuf, + int *lockHoldersNum); + +extern void ProcWaitForSignal(uint32 wait_event_info); +extern void ProcSendSignal(ProcNumber procNumber); + +extern PGPROC *AuxiliaryPidGetProc(int pid); + +extern void BecomeLockGroupLeader(void); +extern bool BecomeLockGroupMember(PGPROC *leader, int pid); + +#endif /* _PROC_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/procarray.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/procarray.h new file mode 100644 index 0000000..ef0b733 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/procarray.h @@ -0,0 +1,103 @@ +/*------------------------------------------------------------------------- + * + * procarray.h + * POSTGRES process array definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/procarray.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROCARRAY_H +#define PROCARRAY_H + +#include "storage/lock.h" +#include "storage/standby.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + + +extern Size ProcArrayShmemSize(void); +extern void ProcArrayShmemInit(void); +extern void ProcArrayAdd(PGPROC *proc); +extern void ProcArrayRemove(PGPROC *proc, TransactionId latestXid); + +extern void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid); +extern void ProcArrayClearTransaction(PGPROC *proc); + +extern void ProcArrayInitRecovery(TransactionId initializedUptoXID); +extern void ProcArrayApplyRecoveryInfo(RunningTransactions running); +extern void ProcArrayApplyXidAssignment(TransactionId topxid, + int nsubxids, TransactionId *subxids); + +extern void RecordKnownAssignedTransactionIds(TransactionId xid); +extern void ExpireTreeKnownAssignedTransactionIds(TransactionId xid, + int nsubxids, TransactionId *subxids, + TransactionId max_xid); +extern void ExpireAllKnownAssignedTransactionIds(void); +extern void ExpireOldKnownAssignedTransactionIds(TransactionId xid); +extern void KnownAssignedTransactionIdsIdleMaintenance(void); + +extern int GetMaxSnapshotXidCount(void); +extern int GetMaxSnapshotSubxidCount(void); + +extern Snapshot GetSnapshotData(Snapshot snapshot); + +extern bool ProcArrayInstallImportedXmin(TransactionId xmin, + VirtualTransactionId *sourcevxid); +extern bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc); + +extern RunningTransactions GetRunningTransactionData(void); + +extern bool TransactionIdIsInProgress(TransactionId xid); +extern bool TransactionIdIsActive(TransactionId xid); +extern TransactionId GetOldestNonRemovableTransactionId(Relation rel); +extern TransactionId GetOldestTransactionIdConsideredRunning(void); +extern TransactionId GetOldestActiveTransactionId(void); +extern TransactionId GetOldestSafeDecodingTransactionId(bool catalogOnly); +extern void GetReplicationHorizons(TransactionId *xmin, TransactionId *catalog_xmin); + +extern VirtualTransactionId *GetVirtualXIDsDelayingChkpt(int *nvxids, int type); +extern bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, + int nvxids, int type); + +extern PGPROC *ProcNumberGetProc(int procNumber); +extern void ProcNumberGetTransactionIds(int procNumber, TransactionId *xid, + TransactionId *xmin, int *nsubxid, + bool *overflowed); +extern PGPROC *BackendPidGetProc(int pid); +extern PGPROC *BackendPidGetProcWithLock(int pid); +extern int BackendXidGetPid(TransactionId xid); +extern bool IsBackendPid(int pid); + +extern VirtualTransactionId *GetCurrentVirtualXIDs(TransactionId limitXmin, + bool excludeXmin0, bool allDbs, int excludeVacuum, + int *nvxids); +extern VirtualTransactionId *GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid); +extern pid_t CancelVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode); +extern pid_t SignalVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode, + bool conflictPending); + +extern bool MinimumActiveBackends(int min); +extern int CountDBBackends(Oid databaseid); +extern int CountDBConnections(Oid databaseid); +extern void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending); +extern int CountUserBackends(Oid roleid); +extern bool CountOtherDBBackends(Oid databaseId, + int *nbackends, int *nprepared); +extern void TerminateOtherDBBackends(Oid databaseId); + +extern void XidCacheRemoveRunningXids(TransactionId xid, + int nxids, const TransactionId *xids, + TransactionId latestXid); + +extern void ProcArraySetReplicationSlotXmin(TransactionId xmin, + TransactionId catalog_xmin, bool already_locked); + +extern void ProcArrayGetReplicationSlotXmin(TransactionId *xmin, + TransactionId *catalog_xmin); + +#endif /* PROCARRAY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/proclist.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/proclist.h new file mode 100644 index 0000000..a157f8d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/proclist.h @@ -0,0 +1,219 @@ +/*------------------------------------------------------------------------- + * + * proclist.h + * operations on doubly-linked lists of pgprocnos + * + * The interface is similar to dlist from ilist.h, but uses pgprocno instead + * of pointers. This allows proclist_head to be mapped at different addresses + * in different backends. + * + * See proclist_types.h for the structs that these functions operate on. They + * are separated to break a header dependency cycle with proc.h. + * + * Portions Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/storage/proclist.h + *------------------------------------------------------------------------- + */ +#ifndef PROCLIST_H +#define PROCLIST_H + +#include "storage/proc.h" +#include "storage/proclist_types.h" + +/* + * Initialize a proclist. + */ +static inline void +proclist_init(proclist_head *list) +{ + list->head = list->tail = INVALID_PROC_NUMBER; +} + +/* + * Is the list empty? + */ +static inline bool +proclist_is_empty(const proclist_head *list) +{ + return list->head == INVALID_PROC_NUMBER; +} + +/* + * Get a pointer to a proclist_node inside a given PGPROC, given a procno and + * the proclist_node field's offset within struct PGPROC. + */ +static inline proclist_node * +proclist_node_get(int procno, size_t node_offset) +{ + char *entry = (char *) GetPGProcByNumber(procno); + + return (proclist_node *) (entry + node_offset); +} + +/* + * Insert a process at the beginning of a list. + */ +static inline void +proclist_push_head_offset(proclist_head *list, int procno, size_t node_offset) +{ + proclist_node *node = proclist_node_get(procno, node_offset); + + Assert(node->next == 0 && node->prev == 0); + + if (list->head == INVALID_PROC_NUMBER) + { + Assert(list->tail == INVALID_PROC_NUMBER); + node->next = node->prev = INVALID_PROC_NUMBER; + list->head = list->tail = procno; + } + else + { + Assert(list->tail != INVALID_PROC_NUMBER); + Assert(list->head != procno); + Assert(list->tail != procno); + node->next = list->head; + proclist_node_get(node->next, node_offset)->prev = procno; + node->prev = INVALID_PROC_NUMBER; + list->head = procno; + } +} + +/* + * Insert a process at the end of a list. + */ +static inline void +proclist_push_tail_offset(proclist_head *list, int procno, size_t node_offset) +{ + proclist_node *node = proclist_node_get(procno, node_offset); + + Assert(node->next == 0 && node->prev == 0); + + if (list->tail == INVALID_PROC_NUMBER) + { + Assert(list->head == INVALID_PROC_NUMBER); + node->next = node->prev = INVALID_PROC_NUMBER; + list->head = list->tail = procno; + } + else + { + Assert(list->head != INVALID_PROC_NUMBER); + Assert(list->head != procno); + Assert(list->tail != procno); + node->prev = list->tail; + proclist_node_get(node->prev, node_offset)->next = procno; + node->next = INVALID_PROC_NUMBER; + list->tail = procno; + } +} + +/* + * Delete a process from a list --- it must be in the list! + */ +static inline void +proclist_delete_offset(proclist_head *list, int procno, size_t node_offset) +{ + proclist_node *node = proclist_node_get(procno, node_offset); + + Assert(node->next != 0 || node->prev != 0); + + if (node->prev == INVALID_PROC_NUMBER) + { + Assert(list->head == procno); + list->head = node->next; + } + else + proclist_node_get(node->prev, node_offset)->next = node->next; + + if (node->next == INVALID_PROC_NUMBER) + { + Assert(list->tail == procno); + list->tail = node->prev; + } + else + proclist_node_get(node->next, node_offset)->prev = node->prev; + + node->next = node->prev = 0; +} + +/* + * Check if a process is currently in a list. It must be known that the + * process is not in any _other_ proclist that uses the same proclist_node, + * so that the only possibilities are that it is in this list or none. + */ +static inline bool +proclist_contains_offset(const proclist_head *list, int procno, + size_t node_offset) +{ + const proclist_node *node = proclist_node_get(procno, node_offset); + + /* If it's not in any list, it's definitely not in this one. */ + if (node->prev == 0 && node->next == 0) + return false; + + /* + * It must, in fact, be in this list. Ideally, in assert-enabled builds, + * we'd verify that. But since this function is typically used while + * holding a spinlock, crawling the whole list is unacceptable. However, + * we can verify matters in O(1) time when the node is a list head or + * tail, and that seems worth doing, since in practice that should often + * be enough to catch mistakes. + */ + Assert(node->prev != INVALID_PROC_NUMBER || list->head == procno); + Assert(node->next != INVALID_PROC_NUMBER || list->tail == procno); + + return true; +} + +/* + * Remove and return the first process from a list (there must be one). + */ +static inline PGPROC * +proclist_pop_head_node_offset(proclist_head *list, size_t node_offset) +{ + PGPROC *proc; + + Assert(!proclist_is_empty(list)); + proc = GetPGProcByNumber(list->head); + proclist_delete_offset(list, list->head, node_offset); + return proc; +} + +/* + * Helper macros to avoid repetition of offsetof(PGPROC, ). + * 'link_member' is the name of a proclist_node member in PGPROC. + */ +#define proclist_delete(list, procno, link_member) \ + proclist_delete_offset((list), (procno), offsetof(PGPROC, link_member)) +#define proclist_push_head(list, procno, link_member) \ + proclist_push_head_offset((list), (procno), offsetof(PGPROC, link_member)) +#define proclist_push_tail(list, procno, link_member) \ + proclist_push_tail_offset((list), (procno), offsetof(PGPROC, link_member)) +#define proclist_pop_head_node(list, link_member) \ + proclist_pop_head_node_offset((list), offsetof(PGPROC, link_member)) +#define proclist_contains(list, procno, link_member) \ + proclist_contains_offset((list), (procno), offsetof(PGPROC, link_member)) + +/* + * Iterate through the list pointed at by 'lhead', storing the current + * position in 'iter'. 'link_member' is the name of a proclist_node member in + * PGPROC. Access the current position with iter.cur. + * + * The only list modification allowed while iterating is deleting the current + * node with proclist_delete(list, iter.cur, node_offset). + */ +#define proclist_foreach_modify(iter, lhead, link_member) \ + for (AssertVariableIsOfTypeMacro(iter, proclist_mutable_iter), \ + AssertVariableIsOfTypeMacro(lhead, proclist_head *), \ + (iter).cur = (lhead)->head, \ + (iter).next = (iter).cur == INVALID_PROC_NUMBER ? INVALID_PROC_NUMBER : \ + proclist_node_get((iter).cur, \ + offsetof(PGPROC, link_member))->next; \ + (iter).cur != INVALID_PROC_NUMBER; \ + (iter).cur = (iter).next, \ + (iter).next = (iter).cur == INVALID_PROC_NUMBER ? INVALID_PROC_NUMBER : \ + proclist_node_get((iter).cur, \ + offsetof(PGPROC, link_member))->next) + +#endif /* PROCLIST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/proclist_types.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/proclist_types.h new file mode 100644 index 0000000..f314a6c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/proclist_types.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * proclist_types.h + * doubly-linked lists of pgprocnos + * + * See proclist.h for functions that operate on these types. + * + * Portions Copyright (c) 2016-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/storage/proclist_types.h + *------------------------------------------------------------------------- + */ + +#ifndef PROCLIST_TYPES_H +#define PROCLIST_TYPES_H + +#include "storage/procnumber.h" + +/* + * A node in a doubly-linked list of processes. The link fields contain + * the 0-based PGPROC indexes of the next and previous process, or + * INVALID_PROC_NUMBER in the next-link of the last node and the prev-link + * of the first node. A node that is currently not in any list + * should have next == prev == 0; this is not a possible state for a node + * that is in a list, because we disallow circularity. + */ +typedef struct proclist_node +{ + ProcNumber next; /* pgprocno of the next PGPROC */ + ProcNumber prev; /* pgprocno of the prev PGPROC */ +} proclist_node; + +/* + * Header of a doubly-linked list of PGPROCs, identified by pgprocno. + * An empty list is represented by head == tail == INVALID_PROC_NUMBER. + */ +typedef struct proclist_head +{ + ProcNumber head; /* pgprocno of the head PGPROC */ + ProcNumber tail; /* pgprocno of the tail PGPROC */ +} proclist_head; + +/* + * List iterator allowing some modifications while iterating. + */ +typedef struct proclist_mutable_iter +{ + ProcNumber cur; /* pgprocno of the current PGPROC */ + ProcNumber next; /* pgprocno of the next PGPROC */ +} proclist_mutable_iter; + +#endif /* PROCLIST_TYPES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/procnumber.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/procnumber.h new file mode 100644 index 0000000..2ddaaf0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/procnumber.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * procnumber.h + * definition of process number + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/procnumber.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROCNUMBER_H +#define PROCNUMBER_H + +/* + * ProcNumber uniquely identifies an active backend or auxiliary process. + * It's assigned at backend startup after authentication, when the process + * adds itself to the proc array. It is an index into the proc array, + * starting from 0. Note that a ProcNumber can be reused for a different + * backend immediately after a backend exits. + */ +typedef int ProcNumber; + +#define INVALID_PROC_NUMBER (-1) + +/* + * Note: MAX_BACKENDS_BITS is 18 as that is the space available for buffer + * refcounts in buf_internals.h. This limitation could be lifted by using a + * 64bit state; but it's unlikely to be worthwhile as 2^18-1 backends exceed + * currently realistic configurations. Even if that limitation were removed, + * we still could not a) exceed 2^23-1 because inval.c stores the ProcNumber + * as a 3-byte signed integer, b) INT_MAX/4 because some places compute + * 4*MaxBackends without any overflow check. We check that the configured + * number of backends does not exceed MAX_BACKENDS in InitializeMaxBackends(). + */ +#define MAX_BACKENDS_BITS 18 +#define MAX_BACKENDS ((1U << MAX_BACKENDS_BITS)-1) + +/* + * Proc number of this backend (same as GetNumberFromPGProc(MyProc)) + */ +extern PGDLLIMPORT ProcNumber MyProcNumber; + +/* proc number of our parallel session leader, or INVALID_PROC_NUMBER if none */ +extern PGDLLIMPORT ProcNumber ParallelLeaderProcNumber; + +/* + * The ProcNumber to use for our session's temp relations is normally our own, + * but parallel workers should use their leader's proc number. + */ +#define ProcNumberForTempRelations() \ + (ParallelLeaderProcNumber == INVALID_PROC_NUMBER ? MyProcNumber : ParallelLeaderProcNumber) + +#endif /* PROCNUMBER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/procsignal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/procsignal.h new file mode 100644 index 0000000..afeeb1c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/procsignal.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * procsignal.h + * Routines for interprocess signaling + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/procsignal.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROCSIGNAL_H +#define PROCSIGNAL_H + +#include "storage/procnumber.h" + + +/* + * Reasons for signaling a Postgres child process (a backend or an auxiliary + * process, like checkpointer). We can cope with concurrent signals for different + * reasons. However, if the same reason is signaled multiple times in quick + * succession, the process is likely to observe only one notification of it. + * This is okay for the present uses. + * + * Also, because of race conditions, it's important that all the signals be + * defined so that no harm is done if a process mistakenly receives one. + */ +typedef enum +{ + PROCSIG_CATCHUP_INTERRUPT, /* sinval catchup interrupt */ + PROCSIG_NOTIFY_INTERRUPT, /* listen/notify interrupt */ + PROCSIG_PARALLEL_MESSAGE, /* message from cooperating parallel backend */ + PROCSIG_WALSND_INIT_STOPPING, /* ask walsenders to prepare for shutdown */ + PROCSIG_BARRIER, /* global barrier interrupt */ + PROCSIG_LOG_MEMORY_CONTEXT, /* ask backend to log the memory contexts */ + PROCSIG_PARALLEL_APPLY_MESSAGE, /* Message from parallel apply workers */ + + /* Recovery conflict reasons */ + PROCSIG_RECOVERY_CONFLICT_FIRST, + PROCSIG_RECOVERY_CONFLICT_DATABASE = PROCSIG_RECOVERY_CONFLICT_FIRST, + PROCSIG_RECOVERY_CONFLICT_TABLESPACE, + PROCSIG_RECOVERY_CONFLICT_LOCK, + PROCSIG_RECOVERY_CONFLICT_SNAPSHOT, + PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT, + PROCSIG_RECOVERY_CONFLICT_BUFFERPIN, + PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK, + PROCSIG_RECOVERY_CONFLICT_LAST = PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK, +} ProcSignalReason; + +#define NUM_PROCSIGNALS (PROCSIG_RECOVERY_CONFLICT_LAST + 1) + +typedef enum +{ + PROCSIGNAL_BARRIER_SMGRRELEASE, /* ask smgr to close files */ +} ProcSignalBarrierType; + +/* + * Length of query cancel keys generated. + * + * Note that the protocol allows for longer keys, or shorter, but this is the + * length we actually generate. Client code, and the server code that handles + * incoming cancellation packets from clients, mustn't use this hardcoded + * length. + */ +#define MAX_CANCEL_KEY_LENGTH 32 + +/* + * prototypes for functions in procsignal.c + */ +extern Size ProcSignalShmemSize(void); +extern void ProcSignalShmemInit(void); + +extern void ProcSignalInit(const uint8 *cancel_key, int cancel_key_len); +extern int SendProcSignal(pid_t pid, ProcSignalReason reason, + ProcNumber procNumber); +extern void SendCancelRequest(int backendPID, const uint8 *cancel_key, int cancel_key_len); + +extern uint64 EmitProcSignalBarrier(ProcSignalBarrierType type); +extern void WaitForProcSignalBarrier(uint64 generation); +extern void ProcessProcSignalBarrier(void); + +extern void procsignal_sigusr1_handler(SIGNAL_ARGS); + +/* ProcSignalHeader is an opaque struct, details known only within procsignal.c */ +typedef struct ProcSignalHeader ProcSignalHeader; + +#ifdef EXEC_BACKEND +extern PGDLLIMPORT ProcSignalHeader *ProcSignal; +#endif + +#endif /* PROCSIGNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/read_stream.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/read_stream.h new file mode 100644 index 0000000..9b0d651 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/read_stream.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * read_stream.h + * Mechanism for accessing buffered relation data with look-ahead + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/read_stream.h + * + *------------------------------------------------------------------------- + */ +#ifndef READ_STREAM_H +#define READ_STREAM_H + +#include "storage/bufmgr.h" +#include "storage/smgr.h" + +/* Default tuning, reasonable for many users. */ +#define READ_STREAM_DEFAULT 0x00 + +/* + * I/O streams that are performing maintenance work on behalf of potentially + * many users, and thus should be governed by maintenance_io_concurrency + * instead of effective_io_concurrency. For example, VACUUM or CREATE INDEX. + */ +#define READ_STREAM_MAINTENANCE 0x01 + +/* + * We usually avoid issuing prefetch advice automatically when sequential + * access is detected, but this flag explicitly disables it, for cases that + * might not be correctly detected. Explicit advice is known to perform worse + * than letting the kernel (at least Linux) detect sequential access. + */ +#define READ_STREAM_SEQUENTIAL 0x02 + +/* + * We usually ramp up from smaller reads to larger ones, to support users who + * don't know if it's worth reading lots of buffers yet. This flag disables + * that, declaring ahead of time that we'll be reading all available buffers. + */ +#define READ_STREAM_FULL 0x04 + +/* --- + * Opt-in to using AIO batchmode. + * + * Submitting IO in larger batches can be more efficient than doing so + * one-by-one, particularly for many small reads. It does, however, require + * the ReadStreamBlockNumberCB callback to abide by the restrictions of AIO + * batching (c.f. pgaio_enter_batchmode()). Basically, the callback may not: + * + * a) block without first calling pgaio_submit_staged(), unless a + * to-be-waited-on lock cannot be part of a deadlock, e.g. because it is + * never held while waiting for IO. + * + * b) start another batch (without first exiting batchmode and re-entering + * before returning) + * + * As this requires care and is nontrivial in some cases, batching is only + * used with explicit opt-in. + * --- + */ +#define READ_STREAM_USE_BATCHING 0x08 + +struct ReadStream; +typedef struct ReadStream ReadStream; + +/* for block_range_read_stream_cb */ +typedef struct BlockRangeReadStreamPrivate +{ + BlockNumber current_blocknum; + BlockNumber last_exclusive; +} BlockRangeReadStreamPrivate; + +/* Callback that returns the next block number to read. */ +typedef BlockNumber (*ReadStreamBlockNumberCB) (ReadStream *stream, + void *callback_private_data, + void *per_buffer_data); + +extern BlockNumber block_range_read_stream_cb(ReadStream *stream, + void *callback_private_data, + void *per_buffer_data); +extern ReadStream *read_stream_begin_relation(int flags, + BufferAccessStrategy strategy, + Relation rel, + ForkNumber forknum, + ReadStreamBlockNumberCB callback, + void *callback_private_data, + size_t per_buffer_data_size); +extern Buffer read_stream_next_buffer(ReadStream *stream, void **per_buffer_data); +extern BlockNumber read_stream_next_block(ReadStream *stream, + BufferAccessStrategy *strategy); +extern ReadStream *read_stream_begin_smgr_relation(int flags, + BufferAccessStrategy strategy, + SMgrRelation smgr, + char smgr_persistence, + ForkNumber forknum, + ReadStreamBlockNumberCB callback, + void *callback_private_data, + size_t per_buffer_data_size); +extern void read_stream_reset(ReadStream *stream); +extern void read_stream_end(ReadStream *stream); + +#endif /* READ_STREAM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/reinit.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/reinit.h new file mode 100644 index 0000000..37fcbb1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/reinit.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * reinit.h + * Reinitialization of unlogged relations + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/reinit.h + * + *------------------------------------------------------------------------- + */ + +#ifndef REINIT_H +#define REINIT_H + +#include "common/relpath.h" + + +extern void ResetUnloggedRelations(int op); +extern bool parse_filename_for_nontemp_relation(const char *name, + RelFileNumber *relnumber, + ForkNumber *fork, + unsigned *segno); + +#define UNLOGGED_RELATION_CLEANUP 0x0001 +#define UNLOGGED_RELATION_INIT 0x0002 + +#endif /* REINIT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/relfilelocator.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/relfilelocator.h new file mode 100644 index 0000000..0f841e3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/relfilelocator.h @@ -0,0 +1,100 @@ +/*------------------------------------------------------------------------- + * + * relfilelocator.h + * Physical access information for relations. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/relfilelocator.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELFILELOCATOR_H +#define RELFILELOCATOR_H + +#include "common/relpath.h" +#include "storage/procnumber.h" + +/* + * RelFileLocator must provide all that we need to know to physically access + * a relation, with the exception of the backend's proc number, which can be + * provided separately. Note, however, that a "physical" relation is + * comprised of multiple files on the filesystem, as each fork is stored as + * a separate file, and each fork can be divided into multiple segments. See + * md.c. + * + * spcOid identifies the tablespace of the relation. It corresponds to + * pg_tablespace.oid. + * + * dbOid identifies the database of the relation. It is zero for + * "shared" relations (those common to all databases of a cluster). + * Nonzero dbOid values correspond to pg_database.oid. + * + * relNumber identifies the specific relation. relNumber corresponds to + * pg_class.relfilenode (NOT pg_class.oid, because we need to be able + * to assign new physical files to relations in some situations). + * Notice that relNumber is only unique within a database in a particular + * tablespace. + * + * Note: spcOid must be GLOBALTABLESPACE_OID if and only if dbOid is + * zero. We support shared relations only in the "global" tablespace. + * + * Note: in pg_class we allow reltablespace == 0 to denote that the + * relation is stored in its database's "default" tablespace (as + * identified by pg_database.dattablespace). However this shorthand + * is NOT allowed in RelFileLocator structs --- the real tablespace ID + * must be supplied when setting spcOid. + * + * Note: in pg_class, relfilenode can be zero to denote that the relation + * is a "mapped" relation, whose current true filenode number is available + * from relmapper.c. Again, this case is NOT allowed in RelFileLocators. + * + * Note: various places use RelFileLocator in hashtable keys. Therefore, + * there *must not* be any unused padding bytes in this struct. That + * should be safe as long as all the fields are of type Oid. + */ +typedef struct RelFileLocator +{ + Oid spcOid; /* tablespace */ + Oid dbOid; /* database */ + RelFileNumber relNumber; /* relation */ +} RelFileLocator; + +/* + * Augmenting a relfilelocator with the backend's proc number provides all the + * information we need to locate the physical storage. 'backend' is + * INVALID_PROC_NUMBER for regular relations (those accessible to more than + * one backend), or the owning backend's proc number for backend-local + * relations. Backend-local relations are always transient and removed in + * case of a database crash; they are never WAL-logged or fsync'd. + */ +typedef struct RelFileLocatorBackend +{ + RelFileLocator locator; + ProcNumber backend; +} RelFileLocatorBackend; + +#define RelFileLocatorBackendIsTemp(rlocator) \ + ((rlocator).backend != INVALID_PROC_NUMBER) + +/* + * Note: RelFileLocatorEquals and RelFileLocatorBackendEquals compare relNumber + * first since that is most likely to be different in two unequal + * RelFileLocators. It is probably redundant to compare spcOid if the other + * fields are found equal, but do it anyway to be sure. Likewise for checking + * the backend number in RelFileLocatorBackendEquals. + */ +#define RelFileLocatorEquals(locator1, locator2) \ + ((locator1).relNumber == (locator2).relNumber && \ + (locator1).dbOid == (locator2).dbOid && \ + (locator1).spcOid == (locator2).spcOid) + +#define RelFileLocatorBackendEquals(locator1, locator2) \ + ((locator1).locator.relNumber == (locator2).locator.relNumber && \ + (locator1).locator.dbOid == (locator2).locator.dbOid && \ + (locator1).backend == (locator2).backend && \ + (locator1).locator.spcOid == (locator2).locator.spcOid) + +#endif /* RELFILELOCATOR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/s_lock.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/s_lock.h new file mode 100644 index 0000000..4971c78 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/s_lock.h @@ -0,0 +1,761 @@ +/*------------------------------------------------------------------------- + * + * s_lock.h + * Implementation of spinlocks. + * + * NOTE: none of the macros in this file are intended to be called directly. + * Call them through the macros in spin.h. + * + * The following hardware-dependent macros must be provided for each + * supported platform: + * + * void S_INIT_LOCK(slock_t *lock) + * Initialize a spinlock (to the unlocked state). + * + * int S_LOCK(slock_t *lock) + * Acquire a spinlock, waiting if necessary. + * Time out and abort() if unable to acquire the lock in a + * "reasonable" amount of time --- typically ~ 1 minute. + * Should return number of "delays"; see s_lock.c + * + * void S_UNLOCK(slock_t *lock) + * Unlock a previously acquired lock. + * + * bool S_LOCK_FREE(slock_t *lock) + * Tests if the lock is free. Returns true if free, false if locked. + * This does *not* change the state of the lock. + * + * void SPIN_DELAY(void) + * Delay operation to occur inside spinlock wait loop. + * + * Note to implementors: there are default implementations for all these + * macros at the bottom of the file. Check if your platform can use + * these or needs to override them. + * + * Usually, S_LOCK() is implemented in terms of even lower-level macros + * TAS() and TAS_SPIN(): + * + * int TAS(slock_t *lock) + * Atomic test-and-set instruction. Attempt to acquire the lock, + * but do *not* wait. Returns 0 if successful, nonzero if unable + * to acquire the lock. + * + * int TAS_SPIN(slock_t *lock) + * Like TAS(), but this version is used when waiting for a lock + * previously found to be contended. By default, this is the + * same as TAS(), but on some architectures it's better to poll a + * contended lock using an unlocked instruction and retry the + * atomic test-and-set only when it appears free. + * + * TAS() and TAS_SPIN() are NOT part of the API, and should never be called + * directly. + * + * CAUTION: on some platforms TAS() and/or TAS_SPIN() may sometimes report + * failure to acquire a lock even when the lock is not locked. For example, + * on Alpha TAS() will "fail" if interrupted. Therefore a retry loop must + * always be used, even if you are certain the lock is free. + * + * It is the responsibility of these macros to make sure that the compiler + * does not re-order accesses to shared memory to precede the actual lock + * acquisition, or follow the lock release. Prior to PostgreSQL 9.5, this + * was the caller's responsibility, which meant that callers had to use + * volatile-qualified pointers to refer to both the spinlock itself and the + * shared data being accessed within the spinlocked critical section. This + * was notationally awkward, easy to forget (and thus error-prone), and + * prevented some useful compiler optimizations. For these reasons, we + * now require that the macros themselves prevent compiler re-ordering, + * so that the caller doesn't need to take special precautions. + * + * On platforms with weak memory ordering, the TAS(), TAS_SPIN(), and + * S_UNLOCK() macros must further include hardware-level memory fence + * instructions to prevent similar re-ordering at the hardware level. + * TAS() and TAS_SPIN() must guarantee that loads and stores issued after + * the macro are not executed until the lock has been obtained. Conversely, + * S_UNLOCK() must guarantee that loads and stores issued before the macro + * have been executed before the lock is released. + * + * On most supported platforms, TAS() uses a tas() function written + * in assembly language to execute a hardware atomic-test-and-set + * instruction. Equivalent OS-supplied mutex routines could be used too. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/s_lock.h + * + *------------------------------------------------------------------------- + */ +#ifndef S_LOCK_H +#define S_LOCK_H + +#ifdef FRONTEND +#error "s_lock.h may not be included from frontend code" +#endif + +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +/************************************************************************* + * All the gcc inlines + * Gcc consistently defines the CPU as __cpu__. + * Other compilers use __cpu or __cpu__ so we test for both in those cases. + */ + +/*---------- + * Standard gcc asm format (assuming "volatile slock_t *lock"): + + __asm__ __volatile__( + " instruction \n" + " instruction \n" + " instruction \n" +: "=r"(_res), "+m"(*lock) // return register, in/out lock value +: "r"(lock) // lock pointer, in input register +: "memory", "cc"); // show clobbered registers here + + * The output-operands list (after first colon) should always include + * "+m"(*lock), whether or not the asm code actually refers to this + * operand directly. This ensures that gcc believes the value in the + * lock variable is used and set by the asm code. Also, the clobbers + * list (after third colon) should always include "memory"; this prevents + * gcc from thinking it can cache the values of shared-memory fields + * across the asm code. Add "cc" if your asm code changes the condition + * code register, and also list any temp registers the code uses. + *---------- + */ + + +#ifdef __i386__ /* 32-bit i386 */ +#define HAS_TEST_AND_SET + +typedef unsigned char slock_t; + +#define TAS(lock) tas(lock) + +static __inline__ int +tas(volatile slock_t *lock) +{ + slock_t _res = 1; + + /* + * Use a non-locking test before asserting the bus lock. Note that the + * extra test appears to be a small loss on some x86 platforms and a small + * win on others; it's by no means clear that we should keep it. + * + * When this was last tested, we didn't have separate TAS() and TAS_SPIN() + * macros. Nowadays it probably would be better to do a non-locking test + * in TAS_SPIN() but not in TAS(), like on x86_64, but no-one's done the + * testing to verify that. Without some empirical evidence, better to + * leave it alone. + */ + __asm__ __volatile__( + " cmpb $0,%1 \n" + " jne 1f \n" + " lock \n" + " xchgb %0,%1 \n" + "1: \n" +: "+q"(_res), "+m"(*lock) +: /* no inputs */ +: "memory", "cc"); + return (int) _res; +} + +#define SPIN_DELAY() spin_delay() + +static __inline__ void +spin_delay(void) +{ + /* + * This sequence is equivalent to the PAUSE instruction ("rep" is + * ignored by old IA32 processors if the following instruction is + * not a string operation); the IA-32 Architecture Software + * Developer's Manual, Vol. 3, Section 7.7.2 describes why using + * PAUSE in the inner loop of a spin lock is necessary for good + * performance: + * + * The PAUSE instruction improves the performance of IA-32 + * processors supporting Hyper-Threading Technology when + * executing spin-wait loops and other routines where one + * thread is accessing a shared lock or semaphore in a tight + * polling loop. When executing a spin-wait loop, the + * processor can suffer a severe performance penalty when + * exiting the loop because it detects a possible memory order + * violation and flushes the core processor's pipeline. The + * PAUSE instruction provides a hint to the processor that the + * code sequence is a spin-wait loop. The processor uses this + * hint to avoid the memory order violation and prevent the + * pipeline flush. In addition, the PAUSE instruction + * de-pipelines the spin-wait loop to prevent it from + * consuming execution resources excessively. + */ + __asm__ __volatile__( + " rep; nop \n"); +} + +#endif /* __i386__ */ + + +#ifdef __x86_64__ /* AMD Opteron, Intel EM64T */ +#define HAS_TEST_AND_SET + +typedef unsigned char slock_t; + +#define TAS(lock) tas(lock) + +/* + * On Intel EM64T, it's a win to use a non-locking test before the xchg proper, + * but only when spinning. + * + * See also Implementing Scalable Atomic Locks for Multi-Core Intel(tm) EM64T + * and IA32, by Michael Chynoweth and Mary R. Lee. As of this writing, it is + * available at: + * http://software.intel.com/en-us/articles/implementing-scalable-atomic-locks-for-multi-core-intel-em64t-and-ia32-architectures + */ +#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock)) + +static __inline__ int +tas(volatile slock_t *lock) +{ + slock_t _res = 1; + + __asm__ __volatile__( + " lock \n" + " xchgb %0,%1 \n" +: "+q"(_res), "+m"(*lock) +: /* no inputs */ +: "memory", "cc"); + return (int) _res; +} + +#define SPIN_DELAY() spin_delay() + +static __inline__ void +spin_delay(void) +{ + /* + * Adding a PAUSE in the spin delay loop is demonstrably a no-op on + * Opteron, but it may be of some use on EM64T, so we keep it. + */ + __asm__ __volatile__( + " rep; nop \n"); +} + +#endif /* __x86_64__ */ + + +/* + * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available. + * + * We use the int-width variant of the builtin because it works on more chips + * than other widths. + */ +#if defined(__arm__) || defined(__arm) || defined(__aarch64__) +#ifdef HAVE_GCC__SYNC_INT32_TAS +#define HAS_TEST_AND_SET + +#define TAS(lock) tas(lock) + +typedef int slock_t; + +static __inline__ int +tas(volatile slock_t *lock) +{ + return __sync_lock_test_and_set(lock, 1); +} + +#define S_UNLOCK(lock) __sync_lock_release(lock) + +#if defined(__aarch64__) + +/* + * On ARM64, it's a win to use a non-locking test before the TAS proper. It + * may be a win on 32-bit ARM, too, but nobody's tested it yet. + */ +#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock)) + +#define SPIN_DELAY() spin_delay() + +static __inline__ void +spin_delay(void) +{ + /* + * Using an ISB instruction to delay in spinlock loops appears beneficial + * on high-core-count ARM64 processors. It seems mostly a wash for smaller + * gear, and ISB doesn't exist at all on pre-v7 ARM chips. + */ + __asm__ __volatile__( + " isb; \n"); +} + +#endif /* __aarch64__ */ +#endif /* HAVE_GCC__SYNC_INT32_TAS */ +#endif /* __arm__ || __arm || __aarch64__ */ + + +/* S/390 and S/390x Linux (32- and 64-bit zSeries) */ +#if defined(__s390__) || defined(__s390x__) +#define HAS_TEST_AND_SET + +typedef unsigned int slock_t; + +#define TAS(lock) tas(lock) + +static __inline__ int +tas(volatile slock_t *lock) +{ + int _res = 0; + + __asm__ __volatile__( + " cs %0,%3,0(%2) \n" +: "+d"(_res), "+m"(*lock) +: "a"(lock), "d"(1) +: "memory", "cc"); + return _res; +} + +#endif /* __s390__ || __s390x__ */ + + +#if defined(__sparc__) /* Sparc */ +/* + * Solaris has always run sparc processors in TSO (total store) mode, but + * linux didn't use to and the *BSDs still don't. So, be careful about + * acquire/release semantics. The CPU will treat superfluous members as + * NOPs, so it's just code space. + */ +#define HAS_TEST_AND_SET + +typedef unsigned char slock_t; + +#define TAS(lock) tas(lock) + +static __inline__ int +tas(volatile slock_t *lock) +{ + slock_t _res; + + /* + * See comment in src/backend/port/tas/sunstudio_sparc.s for why this + * uses "ldstub", and that file uses "cas". gcc currently generates + * sparcv7-targeted binaries, so "cas" use isn't possible. + */ + __asm__ __volatile__( + " ldstub [%2], %0 \n" +: "=r"(_res), "+m"(*lock) +: "r"(lock) +: "memory"); +#if defined(__sparcv7) || defined(__sparc_v7__) + /* + * No stbar or membar available, luckily no actually produced hardware + * requires a barrier. + */ +#elif defined(__sparcv8) || defined(__sparc_v8__) + /* stbar is available (and required for both PSO, RMO), membar isn't */ + __asm__ __volatile__ ("stbar \n":::"memory"); +#else + /* + * #LoadStore (RMO) | #LoadLoad (RMO) together are the appropriate acquire + * barrier for sparcv8+ upwards. + */ + __asm__ __volatile__ ("membar #LoadStore | #LoadLoad \n":::"memory"); +#endif + return (int) _res; +} + +#if defined(__sparcv7) || defined(__sparc_v7__) +/* + * No stbar or membar available, luckily no actually produced hardware + * requires a barrier. We fall through to the default gcc definition of + * S_UNLOCK in this case. + */ +#elif defined(__sparcv8) || defined(__sparc_v8__) +/* stbar is available (and required for both PSO, RMO), membar isn't */ +#define S_UNLOCK(lock) \ +do \ +{ \ + __asm__ __volatile__ ("stbar \n":::"memory"); \ + *((volatile slock_t *) (lock)) = 0; \ +} while (0) +#else +/* + * #LoadStore (RMO) | #StoreStore (RMO, PSO) together are the appropriate + * release barrier for sparcv8+ upwards. + */ +#define S_UNLOCK(lock) \ +do \ +{ \ + __asm__ __volatile__ ("membar #LoadStore | #StoreStore \n":::"memory"); \ + *((volatile slock_t *) (lock)) = 0; \ +} while (0) +#endif + +#endif /* __sparc__ */ + + +/* PowerPC */ +#if defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__) +#define HAS_TEST_AND_SET + +typedef unsigned int slock_t; + +#define TAS(lock) tas(lock) + +/* On PPC, it's a win to use a non-locking test before the lwarx */ +#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock)) + +/* + * The second operand of addi can hold a constant zero or a register number, + * hence constraint "=&b" to avoid allocating r0. "b" stands for "address + * base register"; most operands having this register-or-zero property are + * address bases, e.g. the second operand of lwax. + * + * NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002, + * an isync is a sufficient synchronization barrier after a lwarx/stwcx loop. + * But if the spinlock is in ordinary memory, we can use lwsync instead for + * better performance. + */ +static __inline__ int +tas(volatile slock_t *lock) +{ + slock_t _t; + int _res; + + __asm__ __volatile__( +" lwarx %0,0,%3,1 \n" +" cmpwi %0,0 \n" +" bne 1f \n" +" addi %0,%0,1 \n" +" stwcx. %0,0,%3 \n" +" beq 2f \n" +"1: \n" +" li %1,1 \n" +" b 3f \n" +"2: \n" +" lwsync \n" +" li %1,0 \n" +"3: \n" +: "=&b"(_t), "=r"(_res), "+m"(*lock) +: "r"(lock) +: "memory", "cc"); + return _res; +} + +/* + * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction. + * But we can use lwsync instead for better performance. + */ +#define S_UNLOCK(lock) \ +do \ +{ \ + __asm__ __volatile__ (" lwsync \n" ::: "memory"); \ + *((volatile slock_t *) (lock)) = 0; \ +} while (0) + +#endif /* powerpc */ + + +#if defined(__mips__) && !defined(__sgi) /* non-SGI MIPS */ +#define HAS_TEST_AND_SET + +typedef unsigned int slock_t; + +#define TAS(lock) tas(lock) + +/* + * Original MIPS-I processors lacked the LL/SC instructions, but if we are + * so unfortunate as to be running on one of those, we expect that the kernel + * will handle the illegal-instruction traps and emulate them for us. On + * anything newer (and really, MIPS-I is extinct) LL/SC is the only sane + * choice because any other synchronization method must involve a kernel + * call. Unfortunately, many toolchains still default to MIPS-I as the + * codegen target; if the symbol __mips shows that that's the case, we + * have to force the assembler to accept LL/SC. + * + * R10000 and up processors require a separate SYNC, which has the same + * issues as LL/SC. + */ +#if __mips < 2 +#define MIPS_SET_MIPS2 " .set mips2 \n" +#else +#define MIPS_SET_MIPS2 +#endif + +static __inline__ int +tas(volatile slock_t *lock) +{ + volatile slock_t *_l = lock; + int _res; + int _tmp; + + __asm__ __volatile__( + " .set push \n" + MIPS_SET_MIPS2 + " .set noreorder \n" + " .set nomacro \n" + " ll %0, %2 \n" + " or %1, %0, 1 \n" + " sc %1, %2 \n" + " xori %1, 1 \n" + " or %0, %0, %1 \n" + " sync \n" + " .set pop " +: "=&r" (_res), "=&r" (_tmp), "+R" (*_l) +: /* no inputs */ +: "memory"); + return _res; +} + +/* MIPS S_UNLOCK is almost standard but requires a "sync" instruction */ +#define S_UNLOCK(lock) \ +do \ +{ \ + __asm__ __volatile__( \ + " .set push \n" \ + MIPS_SET_MIPS2 \ + " .set noreorder \n" \ + " .set nomacro \n" \ + " sync \n" \ + " .set pop " \ +: /* no outputs */ \ +: /* no inputs */ \ +: "memory"); \ + *((volatile slock_t *) (lock)) = 0; \ +} while (0) + +#endif /* __mips__ && !__sgi */ + + + +/* + * If we have no platform-specific knowledge, but we found that the compiler + * provides __sync_lock_test_and_set(), use that. Prefer the int-width + * version over the char-width version if we have both, on the rather dubious + * grounds that that's known to be more likely to work in the ARM ecosystem. + * (But we dealt with ARM above.) + */ +#if !defined(HAS_TEST_AND_SET) + +#if defined(HAVE_GCC__SYNC_INT32_TAS) +#define HAS_TEST_AND_SET + +#define TAS(lock) tas(lock) + +typedef int slock_t; + +static __inline__ int +tas(volatile slock_t *lock) +{ + return __sync_lock_test_and_set(lock, 1); +} + +#define S_UNLOCK(lock) __sync_lock_release(lock) + +#elif defined(HAVE_GCC__SYNC_CHAR_TAS) +#define HAS_TEST_AND_SET + +#define TAS(lock) tas(lock) + +typedef char slock_t; + +static __inline__ int +tas(volatile slock_t *lock) +{ + return __sync_lock_test_and_set(lock, 1); +} + +#define S_UNLOCK(lock) __sync_lock_release(lock) + +#endif /* HAVE_GCC__SYNC_INT32_TAS */ + +#endif /* !defined(HAS_TEST_AND_SET) */ + + +/* + * Default implementation of S_UNLOCK() for gcc/icc. + * + * Note that this implementation is unsafe for any platform that can reorder + * a memory access (either load or store) after a following store. That + * happens not to be possible on x86 and most legacy architectures (some are + * single-processor!), but many modern systems have weaker memory ordering. + * Those that do must define their own version of S_UNLOCK() rather than + * relying on this one. + */ +#if !defined(S_UNLOCK) +#define S_UNLOCK(lock) \ + do { __asm__ __volatile__("" : : : "memory"); *(lock) = 0; } while (0) +#endif + +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ + + +/* + * --------------------------------------------------------------------- + * Platforms that use non-gcc inline assembly: + * --------------------------------------------------------------------- + */ + +#if !defined(HAS_TEST_AND_SET) /* We didn't trigger above, let's try here */ + +/* These are in sunstudio_(sparc|x86).s */ + +#if defined(__SUNPRO_C) && (defined(__i386) || defined(__x86_64__) || defined(__sparc__) || defined(__sparc)) +#define HAS_TEST_AND_SET + +#if defined(__i386) || defined(__x86_64__) || defined(__sparcv9) || defined(__sparcv8plus) +typedef unsigned int slock_t; +#else +typedef unsigned char slock_t; +#endif + +extern slock_t pg_atomic_cas(volatile slock_t *lock, slock_t with, + slock_t cmp); + +#define TAS(a) (pg_atomic_cas((a), 1, 0) != 0) +#endif + + +#ifdef _MSC_VER +typedef LONG slock_t; + +#define HAS_TEST_AND_SET +#define TAS(lock) (InterlockedCompareExchange(lock, 1, 0)) + +#define SPIN_DELAY() spin_delay() + +/* If using Visual C++ on Win64, inline assembly is unavailable. + * Use a _mm_pause intrinsic instead of rep nop. + */ +#if defined(_M_X64) && !defined(_M_ARM64EC) +static __forceinline void +spin_delay(void) +{ + _mm_pause(); +} +#elif defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) +static __forceinline void +spin_delay(void) +{ + __yield(); +} +#else +static __forceinline void +spin_delay(void) +{ + /* See comment for gcc code. Same code, MASM syntax */ + __asm rep nop; +} +#endif + +#include +#pragma intrinsic(_ReadWriteBarrier) + +#define S_UNLOCK(lock) \ + do { _ReadWriteBarrier(); (*(lock)) = 0; } while (0) + +#endif + + +#endif /* !defined(HAS_TEST_AND_SET) */ + + +/* Blow up if we didn't have any way to do spinlocks */ +#ifndef HAS_TEST_AND_SET +#error PostgreSQL does not have spinlock support on this platform. Please report this to pgsql-bugs@lists.postgresql.org. +#endif + + +/* + * Default Definitions - override these above as needed. + */ + +#if !defined(S_LOCK) +#define S_LOCK(lock) \ + (TAS(lock) ? s_lock((lock), __FILE__, __LINE__, __func__) : 0) +#endif /* S_LOCK */ + +#if !defined(S_LOCK_FREE) +#define S_LOCK_FREE(lock) (*(lock) == 0) +#endif /* S_LOCK_FREE */ + +#if !defined(S_UNLOCK) +/* + * Our default implementation of S_UNLOCK is essentially *(lock) = 0. This + * is unsafe if the platform can reorder a memory access (either load or + * store) after a following store; platforms where this is possible must + * define their own S_UNLOCK. But CPU reordering is not the only concern: + * if we simply defined S_UNLOCK() as an inline macro, the compiler might + * reorder instructions from inside the critical section to occur after the + * lock release. Since the compiler probably can't know what the external + * function s_unlock is doing, putting the same logic there should be adequate. + * A sufficiently-smart globally optimizing compiler could break that + * assumption, though, and the cost of a function call for every spinlock + * release may hurt performance significantly, so we use this implementation + * only for platforms where we don't know of a suitable intrinsic. For the + * most part, those are relatively obscure platform/compiler combinations to + * which the PostgreSQL project does not have access. + */ +#define USE_DEFAULT_S_UNLOCK +extern void s_unlock(volatile slock_t *lock); +#define S_UNLOCK(lock) s_unlock(lock) +#endif /* S_UNLOCK */ + +#if !defined(S_INIT_LOCK) +#define S_INIT_LOCK(lock) S_UNLOCK(lock) +#endif /* S_INIT_LOCK */ + +#if !defined(SPIN_DELAY) +#define SPIN_DELAY() ((void) 0) +#endif /* SPIN_DELAY */ + +#if !defined(TAS) +extern int tas(volatile slock_t *lock); /* in port/.../tas.s, or + * s_lock.c */ + +#define TAS(lock) tas(lock) +#endif /* TAS */ + +#if !defined(TAS_SPIN) +#define TAS_SPIN(lock) TAS(lock) +#endif /* TAS_SPIN */ + + +/* + * Platform-independent out-of-line support routines + */ +extern int s_lock(volatile slock_t *lock, const char *file, int line, const char *func); + +/* Support for dynamic adjustment of spins_per_delay */ +#define DEFAULT_SPINS_PER_DELAY 100 + +extern void set_spins_per_delay(int shared_spins_per_delay); +extern int update_spins_per_delay(int shared_spins_per_delay); + +/* + * Support for spin delay which is useful in various places where + * spinlock-like procedures take place. + */ +typedef struct +{ + int spins; + int delays; + int cur_delay; + const char *file; + int line; + const char *func; +} SpinDelayStatus; + +static inline void +init_spin_delay(SpinDelayStatus *status, + const char *file, int line, const char *func) +{ + status->spins = 0; + status->delays = 0; + status->cur_delay = 0; + status->file = file; + status->line = line; + status->func = func; +} + +#define init_local_spin_delay(status) init_spin_delay(status, __FILE__, __LINE__, __func__) +extern void perform_spin_delay(SpinDelayStatus *status); +extern void finish_spin_delay(SpinDelayStatus *status); + +#endif /* S_LOCK_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sharedfileset.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sharedfileset.h new file mode 100644 index 0000000..71a2167 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sharedfileset.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * sharedfileset.h + * Shared temporary file management. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/sharedfileset.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SHAREDFILESET_H +#define SHAREDFILESET_H + +#include "storage/dsm.h" +#include "storage/fd.h" +#include "storage/fileset.h" +#include "storage/spin.h" + +/* + * A set of temporary files that can be shared by multiple backends. + */ +typedef struct SharedFileSet +{ + FileSet fs; + slock_t mutex; /* mutex protecting the reference count */ + int refcnt; /* number of attached backends */ +} SharedFileSet; + +extern void SharedFileSetInit(SharedFileSet *fileset, dsm_segment *seg); +extern void SharedFileSetAttach(SharedFileSet *fileset, dsm_segment *seg); +extern void SharedFileSetDeleteAll(SharedFileSet *fileset); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/shm_mq.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/shm_mq.h new file mode 100644 index 0000000..4e58e66 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/shm_mq.h @@ -0,0 +1,86 @@ +/*------------------------------------------------------------------------- + * + * shm_mq.h + * single-reader, single-writer shared memory message queue + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/shm_mq.h + * + *------------------------------------------------------------------------- + */ +#ifndef SHM_MQ_H +#define SHM_MQ_H + +#include "postmaster/bgworker.h" +#include "storage/dsm.h" +#include "storage/proc.h" + +/* The queue itself, in shared memory. */ +struct shm_mq; +typedef struct shm_mq shm_mq; + +/* Backend-private state. */ +struct shm_mq_handle; +typedef struct shm_mq_handle shm_mq_handle; + +/* Descriptors for a single write spanning multiple locations. */ +typedef struct +{ + const char *data; + Size len; +} shm_mq_iovec; + +/* Possible results of a send or receive operation. */ +typedef enum +{ + SHM_MQ_SUCCESS, /* Sent or received a message. */ + SHM_MQ_WOULD_BLOCK, /* Not completed; retry later. */ + SHM_MQ_DETACHED, /* Other process has detached queue. */ +} shm_mq_result; + +/* + * Primitives to create a queue and set the sender and receiver. + * + * Both the sender and the receiver must be set before any messages are read + * or written, but they need not be set by the same process. Each must be + * set exactly once. + */ +extern shm_mq *shm_mq_create(void *address, Size size); +extern void shm_mq_set_receiver(shm_mq *mq, PGPROC *); +extern void shm_mq_set_sender(shm_mq *mq, PGPROC *); + +/* Accessor methods for sender and receiver. */ +extern PGPROC *shm_mq_get_receiver(shm_mq *); +extern PGPROC *shm_mq_get_sender(shm_mq *); + +/* Set up backend-local queue state. */ +extern shm_mq_handle *shm_mq_attach(shm_mq *mq, dsm_segment *seg, + BackgroundWorkerHandle *handle); + +/* Associate worker handle with shm_mq. */ +extern void shm_mq_set_handle(shm_mq_handle *, BackgroundWorkerHandle *); + +/* Break connection, release handle resources. */ +extern void shm_mq_detach(shm_mq_handle *mqh); + +/* Get the shm_mq from handle. */ +extern shm_mq *shm_mq_get_queue(shm_mq_handle *mqh); + +/* Send or receive messages. */ +extern shm_mq_result shm_mq_send(shm_mq_handle *mqh, + Size nbytes, const void *data, bool nowait, + bool force_flush); +extern shm_mq_result shm_mq_sendv(shm_mq_handle *mqh, shm_mq_iovec *iov, + int iovcnt, bool nowait, bool force_flush); +extern shm_mq_result shm_mq_receive(shm_mq_handle *mqh, + Size *nbytesp, void **datap, bool nowait); + +/* Wait for our counterparty to attach to the queue. */ +extern shm_mq_result shm_mq_wait_for_attach(shm_mq_handle *mqh); + +/* Smallest possible queue. */ +extern PGDLLIMPORT const Size shm_mq_minimum_size; + +#endif /* SHM_MQ_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/shm_toc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/shm_toc.h new file mode 100644 index 0000000..8003634 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/shm_toc.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * shm_toc.h + * shared memory segment table of contents + * + * This is intended to provide a simple way to divide a chunk of shared + * memory (probably dynamic shared memory allocated via dsm_create) into + * a number of regions and keep track of the addresses of those regions or + * key data structures within those regions. This is not intended to + * scale to a large number of keys and will perform poorly if used that + * way; if you need a large number of pointers, store them within some + * other data structure within the segment and only put the pointer to + * the data structure itself in the table of contents. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/shm_toc.h + * + *------------------------------------------------------------------------- + */ +#ifndef SHM_TOC_H +#define SHM_TOC_H + +#include "storage/shmem.h" /* for add_size() */ + +/* shm_toc is an opaque type known only within shm_toc.c */ +typedef struct shm_toc shm_toc; + +extern shm_toc *shm_toc_create(uint64 magic, void *address, Size nbytes); +extern shm_toc *shm_toc_attach(uint64 magic, void *address); +extern void *shm_toc_allocate(shm_toc *toc, Size nbytes); +extern Size shm_toc_freespace(shm_toc *toc); +extern void shm_toc_insert(shm_toc *toc, uint64 key, void *address); +extern void *shm_toc_lookup(shm_toc *toc, uint64 key, bool noError); + +/* + * Tools for estimating how large a chunk of shared memory will be needed + * to store a TOC and its dependent objects. Note: we don't really support + * large numbers of keys, but it's convenient to declare number_of_keys + * as a Size anyway. + */ +typedef struct +{ + Size space_for_chunks; + Size number_of_keys; +} shm_toc_estimator; + +#define shm_toc_initialize_estimator(e) \ + ((e)->space_for_chunks = 0, (e)->number_of_keys = 0) +#define shm_toc_estimate_chunk(e, sz) \ + ((e)->space_for_chunks = add_size((e)->space_for_chunks, BUFFERALIGN(sz))) +#define shm_toc_estimate_keys(e, cnt) \ + ((e)->number_of_keys = add_size((e)->number_of_keys, cnt)) + +extern Size shm_toc_estimate(shm_toc_estimator *e); + +#endif /* SHM_TOC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/shmem.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/shmem.h new file mode 100644 index 0000000..c1f668d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/shmem.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * shmem.h + * shared memory management structures + * + * Historical note: + * A long time ago, Postgres' shared memory region was allowed to be mapped + * at a different address in each process, and shared memory "pointers" were + * passed around as offsets relative to the start of the shared memory region. + * That is no longer the case: each process must map the shared memory region + * at the same address. This means shared memory pointers can be passed + * around directly between different processes. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/shmem.h + * + *------------------------------------------------------------------------- + */ +#ifndef SHMEM_H +#define SHMEM_H + +#include "storage/spin.h" +#include "utils/hsearch.h" + + +/* shmem.c */ +extern PGDLLIMPORT slock_t *ShmemLock; +struct PGShmemHeader; /* avoid including storage/pg_shmem.h here */ +extern void InitShmemAccess(struct PGShmemHeader *seghdr); +extern void InitShmemAllocation(void); +extern void *ShmemAlloc(Size size); +extern void *ShmemAllocNoError(Size size); +extern void *ShmemAllocUnlocked(Size size); +extern bool ShmemAddrIsValid(const void *addr); +extern void InitShmemIndex(void); +extern HTAB *ShmemInitHash(const char *name, long init_size, long max_size, + HASHCTL *infoP, int hash_flags); +extern void *ShmemInitStruct(const char *name, Size size, bool *foundPtr); +extern Size add_size(Size s1, Size s2); +extern Size mul_size(Size s1, Size s2); + +extern PGDLLIMPORT Size pg_get_shmem_pagesize(void); + +/* ipci.c */ +extern void RequestAddinShmemSpace(Size size); + +/* size constants for the shmem index table */ + /* max size of data structure string name */ +#define SHMEM_INDEX_KEYSIZE (48) + /* estimated size of the shmem index table (not a hard limit) */ +#define SHMEM_INDEX_SIZE (64) + +/* this is a hash bucket in the shmem index table */ +typedef struct +{ + char key[SHMEM_INDEX_KEYSIZE]; /* string name */ + void *location; /* location in shared mem */ + Size size; /* # bytes requested for the structure */ + Size allocated_size; /* # bytes actually allocated */ +} ShmemIndexEnt; + +#endif /* SHMEM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sinval.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sinval.h new file mode 100644 index 0000000..845a585 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sinval.h @@ -0,0 +1,167 @@ +/*------------------------------------------------------------------------- + * + * sinval.h + * POSTGRES shared cache invalidation communication definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/sinval.h + * + *------------------------------------------------------------------------- + */ +#ifndef SINVAL_H +#define SINVAL_H + +#include + +#include "storage/relfilelocator.h" + +/* + * We support several types of shared-invalidation messages: + * * invalidate a specific tuple in a specific catcache + * * invalidate all catcache entries from a given system catalog + * * invalidate a relcache entry for a specific logical relation + * * invalidate all relcache entries + * * invalidate an smgr cache entry for a specific physical relation + * * invalidate the mapped-relation mapping for a given database + * * invalidate any saved snapshot that might be used to scan a given relation + * * invalidate a RelationSyncCache entry for a specific relation + * More types could be added if needed. The message type is identified by + * the first "int8" field of the message struct. Zero or positive means a + * specific-catcache inval message (and also serves as the catcache ID field). + * Negative values identify the other message types, as per codes below. + * + * Catcache inval events are initially driven by detecting tuple inserts, + * updates and deletions in system catalogs (see CacheInvalidateHeapTuple). + * An update can generate two inval events, one for the old tuple and one for + * the new, but this is reduced to one event if the tuple's hash key doesn't + * change. Note that the inval events themselves don't actually say whether + * the tuple is being inserted or deleted. Also, since we transmit only a + * hash key, there is a small risk of unnecessary invalidations due to chance + * matches of hash keys. + * + * Note that some system catalogs have multiple caches on them (with different + * indexes). On detecting a tuple invalidation in such a catalog, separate + * catcache inval messages must be generated for each of its caches, since + * the hash keys will generally be different. + * + * Catcache, relcache, relsynccache, and snapshot invalidations are + * transactional, and so are sent to other backends upon commit. Internally + * to the generating backend, they are also processed at + * CommandCounterIncrement so that later commands in the same transaction see + * the new state. The generating backend also has to process them at abort, + * to flush out any cache state it's loaded from no-longer-valid entries. + * + * smgr and relation mapping invalidations are non-transactional: they are + * sent immediately when the underlying file change is made. + */ + +typedef struct +{ + int8 id; /* cache ID --- must be first */ + Oid dbId; /* database ID, or 0 if a shared relation */ + uint32 hashValue; /* hash value of key for this catcache */ +} SharedInvalCatcacheMsg; + +#define SHAREDINVALCATALOG_ID (-1) + +typedef struct +{ + int8 id; /* type field --- must be first */ + Oid dbId; /* database ID, or 0 if a shared catalog */ + Oid catId; /* ID of catalog whose contents are invalid */ +} SharedInvalCatalogMsg; + +#define SHAREDINVALRELCACHE_ID (-2) + +typedef struct +{ + int8 id; /* type field --- must be first */ + Oid dbId; /* database ID, or 0 if a shared relation */ + Oid relId; /* relation ID, or 0 if whole relcache */ +} SharedInvalRelcacheMsg; + +#define SHAREDINVALSMGR_ID (-3) + +typedef struct +{ + /* note: field layout chosen to pack into 16 bytes */ + int8 id; /* type field --- must be first */ + int8 backend_hi; /* high bits of backend procno, if temprel */ + uint16 backend_lo; /* low bits of backend procno, if temprel */ + RelFileLocator rlocator; /* spcOid, dbOid, relNumber */ +} SharedInvalSmgrMsg; + +#define SHAREDINVALRELMAP_ID (-4) + +typedef struct +{ + int8 id; /* type field --- must be first */ + Oid dbId; /* database ID, or 0 for shared catalogs */ +} SharedInvalRelmapMsg; + +#define SHAREDINVALSNAPSHOT_ID (-5) + +typedef struct +{ + int8 id; /* type field --- must be first */ + Oid dbId; /* database ID, or 0 if a shared relation */ + Oid relId; /* relation ID */ +} SharedInvalSnapshotMsg; + +#define SHAREDINVALRELSYNC_ID (-6) + +typedef struct +{ + int8 id; /* type field --- must be first */ + Oid dbId; /* database ID */ + Oid relid; /* relation ID, or 0 if whole + * RelationSyncCache */ +} SharedInvalRelSyncMsg; + +typedef union +{ + int8 id; /* type field --- must be first */ + SharedInvalCatcacheMsg cc; + SharedInvalCatalogMsg cat; + SharedInvalRelcacheMsg rc; + SharedInvalSmgrMsg sm; + SharedInvalRelmapMsg rm; + SharedInvalSnapshotMsg sn; + SharedInvalRelSyncMsg rs; +} SharedInvalidationMessage; + + +/* Counter of messages processed; don't worry about overflow. */ +extern PGDLLIMPORT uint64 SharedInvalidMessageCounter; + +extern PGDLLIMPORT volatile sig_atomic_t catchupInterruptPending; + +extern void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, + int n); +extern void ReceiveSharedInvalidMessages(void (*invalFunction) (SharedInvalidationMessage *msg), + void (*resetFunction) (void)); + +/* signal handler for catchup events (PROCSIG_CATCHUP_INTERRUPT) */ +extern void HandleCatchupInterrupt(void); + +/* + * enable/disable processing of catchup events directly from signal handler. + * The enable routine first performs processing of any catchup events that + * have occurred since the last disable. + */ +extern void ProcessCatchupInterrupt(void); + +extern int xactGetCommittedInvalidationMessages(SharedInvalidationMessage **msgs, + bool *RelcacheInitFileInval); +extern int inplaceGetInvalidationMessages(SharedInvalidationMessage **msgs, + bool *RelcacheInitFileInval); +extern void ProcessCommittedInvalidationMessages(SharedInvalidationMessage *msgs, + int nmsgs, bool RelcacheInitFileInval, + Oid dbid, Oid tsid); + +extern void LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg); + +#endif /* SINVAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sinvaladt.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sinvaladt.h new file mode 100644 index 0000000..ea71cea --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sinvaladt.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * sinvaladt.h + * POSTGRES shared cache invalidation data manager. + * + * The shared cache invalidation manager is responsible for transmitting + * invalidation messages between backends. Any message sent by any backend + * must be delivered to all already-running backends before it can be + * forgotten. (If we run out of space, we instead deliver a "RESET" + * message to backends that have fallen too far behind.) + * + * The struct type SharedInvalidationMessage, defining the contents of + * a single message, is defined in sinval.h. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/sinvaladt.h + * + *------------------------------------------------------------------------- + */ +#ifndef SINVALADT_H +#define SINVALADT_H + +#include "storage/lock.h" +#include "storage/sinval.h" + +/* + * prototypes for functions in sinvaladt.c + */ +extern Size SharedInvalShmemSize(void); +extern void SharedInvalShmemInit(void); +extern void SharedInvalBackendInit(bool sendOnly); + +extern void SIInsertDataEntries(const SharedInvalidationMessage *data, int n); +extern int SIGetDataEntries(SharedInvalidationMessage *data, int datasize); +extern void SICleanupQueue(bool callerHasWriteLock, int minFree); + +extern LocalTransactionId GetNextLocalTransactionId(void); + +#endif /* SINVALADT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/smgr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/smgr.h new file mode 100644 index 0000000..3964d93 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/smgr.h @@ -0,0 +1,144 @@ +/*------------------------------------------------------------------------- + * + * smgr.h + * storage manager switch public interface declarations. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/smgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef SMGR_H +#define SMGR_H + +#include "lib/ilist.h" +#include "storage/aio_types.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" + +/* + * smgr.c maintains a table of SMgrRelation objects, which are essentially + * cached file handles. An SMgrRelation is created (if not already present) + * by smgropen(), and destroyed by smgrdestroy(). Note that neither of these + * operations imply I/O, they just create or destroy a hashtable entry. (But + * smgrdestroy() may release associated resources, such as OS-level file + * descriptors.) + * + * An SMgrRelation may be "pinned", to prevent it from being destroyed while + * it's in use. We use this to prevent pointers in relcache to smgr from being + * invalidated. SMgrRelations that are not pinned are deleted at end of + * transaction. + */ +typedef struct SMgrRelationData +{ + /* rlocator is the hashtable lookup key, so it must be first! */ + RelFileLocatorBackend smgr_rlocator; /* relation physical identifier */ + + /* + * The following fields are reset to InvalidBlockNumber upon a cache flush + * event, and hold the last known size for each fork. This information is + * currently only reliable during recovery, since there is no cache + * invalidation for fork extension. + */ + BlockNumber smgr_targblock; /* current insertion target block */ + BlockNumber smgr_cached_nblocks[MAX_FORKNUM + 1]; /* last known size */ + + /* additional public fields may someday exist here */ + + /* + * Fields below here are intended to be private to smgr.c and its + * submodules. Do not touch them from elsewhere. + */ + int smgr_which; /* storage manager selector */ + + /* + * for md.c; per-fork arrays of the number of open segments + * (md_num_open_segs) and the segments themselves (md_seg_fds). + */ + int md_num_open_segs[MAX_FORKNUM + 1]; + struct _MdfdVec *md_seg_fds[MAX_FORKNUM + 1]; + + /* + * Pinning support. If unpinned (ie. pincount == 0), 'node' is a list + * link in list of all unpinned SMgrRelations. + */ + int pincount; + dlist_node node; +} SMgrRelationData; + +typedef SMgrRelationData *SMgrRelation; + +#define SmgrIsTemp(smgr) \ + RelFileLocatorBackendIsTemp((smgr)->smgr_rlocator) + +extern PGDLLIMPORT const PgAioTargetInfo aio_smgr_target_info; + +extern void smgrinit(void); +extern SMgrRelation smgropen(RelFileLocator rlocator, ProcNumber backend); +extern bool smgrexists(SMgrRelation reln, ForkNumber forknum); +extern void smgrpin(SMgrRelation reln); +extern void smgrunpin(SMgrRelation reln); +extern void smgrclose(SMgrRelation reln); +extern void smgrdestroyall(void); +extern void smgrrelease(SMgrRelation reln); +extern void smgrreleaseall(void); +extern void smgrreleaserellocator(RelFileLocatorBackend rlocator); +extern void smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo); +extern void smgrdosyncall(SMgrRelation *rels, int nrels); +extern void smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo); +extern void smgrextend(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, const void *buffer, bool skipFsync); +extern void smgrzeroextend(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, int nblocks, bool skipFsync); +extern bool smgrprefetch(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, int nblocks); +extern uint32 smgrmaxcombine(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum); +extern void smgrreadv(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, + void **buffers, BlockNumber nblocks); +extern void smgrstartreadv(PgAioHandle *ioh, + SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, + void **buffers, BlockNumber nblocks); +extern void smgrwritev(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, + const void **buffers, BlockNumber nblocks, + bool skipFsync); +extern void smgrwriteback(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, BlockNumber nblocks); +extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum); +extern BlockNumber smgrnblocks_cached(SMgrRelation reln, ForkNumber forknum); +extern void smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks, + BlockNumber *old_nblocks, + BlockNumber *nblocks); +extern void smgrimmedsync(SMgrRelation reln, ForkNumber forknum); +extern void smgrregistersync(SMgrRelation reln, ForkNumber forknum); +extern void AtEOXact_SMgr(void); +extern bool ProcessBarrierSmgrRelease(void); + +static inline void +smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, + void *buffer) +{ + smgrreadv(reln, forknum, blocknum, &buffer, 1); +} + +static inline void +smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, + const void *buffer, bool skipFsync) +{ + smgrwritev(reln, forknum, blocknum, &buffer, 1, skipFsync); +} + +extern void pgaio_io_set_target_smgr(PgAioHandle *ioh, + SMgrRelationData *smgr, + ForkNumber forknum, + BlockNumber blocknum, + int nblocks, + bool skip_fsync); + +#endif /* SMGR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/spin.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/spin.h new file mode 100644 index 0000000..33e2ab8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/spin.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * spin.h + * API for spinlocks. + * + * + * The interface to spinlocks is defined by the typedef "slock_t" and + * these macros: + * + * void SpinLockInit(volatile slock_t *lock) + * Initialize a spinlock (to the unlocked state). + * + * void SpinLockAcquire(volatile slock_t *lock) + * Acquire a spinlock, waiting if necessary. + * Time out and abort() if unable to acquire the lock in a + * "reasonable" amount of time --- typically ~ 1 minute. + * + * void SpinLockRelease(volatile slock_t *lock) + * Unlock a previously acquired lock. + * + * bool SpinLockFree(slock_t *lock) + * Tests if the lock is free. Returns true if free, false if locked. + * This does *not* change the state of the lock. + * + * Callers must beware that the macro argument may be evaluated multiple + * times! + * + * Load and store operations in calling code are guaranteed not to be + * reordered with respect to these operations, because they include a + * compiler barrier. (Before PostgreSQL 9.5, callers needed to use a + * volatile qualifier to access data protected by spinlocks.) + * + * Keep in mind the coding rule that spinlocks must not be held for more + * than a few instructions. In particular, we assume it is not possible + * for a CHECK_FOR_INTERRUPTS() to occur while holding a spinlock, and so + * it is not necessary to do HOLD/RESUME_INTERRUPTS() in these macros. + * + * These macros are implemented in terms of hardware-dependent macros + * supplied by s_lock.h. There is not currently any extra functionality + * added by this header, but there has been in the past and may someday + * be again. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/spin.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPIN_H +#define SPIN_H + +#include "storage/s_lock.h" + + +#define SpinLockInit(lock) S_INIT_LOCK(lock) + +#define SpinLockAcquire(lock) S_LOCK(lock) + +#define SpinLockRelease(lock) S_UNLOCK(lock) + +#define SpinLockFree(lock) S_LOCK_FREE(lock) + +#endif /* SPIN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/standby.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/standby.h new file mode 100644 index 0000000..24e2f50 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/standby.h @@ -0,0 +1,109 @@ +/*------------------------------------------------------------------------- + * + * standby.h + * Definitions for hot standby mode. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/standby.h + * + *------------------------------------------------------------------------- + */ +#ifndef STANDBY_H +#define STANDBY_H + +#include "datatype/timestamp.h" +#include "storage/lock.h" +#include "storage/procsignal.h" +#include "storage/relfilelocator.h" +#include "storage/standbydefs.h" + +/* User-settable GUC parameters */ +extern PGDLLIMPORT int max_standby_archive_delay; +extern PGDLLIMPORT int max_standby_streaming_delay; +extern PGDLLIMPORT bool log_recovery_conflict_waits; + +extern void InitRecoveryTransactionEnvironment(void); +extern void ShutdownRecoveryTransactionEnvironment(void); + +extern void ResolveRecoveryConflictWithSnapshot(TransactionId snapshotConflictHorizon, + bool isCatalogRel, + RelFileLocator locator); +extern void ResolveRecoveryConflictWithSnapshotFullXid(FullTransactionId snapshotConflictHorizon, + bool isCatalogRel, + RelFileLocator locator); +extern void ResolveRecoveryConflictWithTablespace(Oid tsid); +extern void ResolveRecoveryConflictWithDatabase(Oid dbid); + +extern void ResolveRecoveryConflictWithLock(LOCKTAG locktag, bool logging_conflict); +extern void ResolveRecoveryConflictWithBufferPin(void); +extern void CheckRecoveryConflictDeadlock(void); +extern void StandbyDeadLockHandler(void); +extern void StandbyTimeoutHandler(void); +extern void StandbyLockTimeoutHandler(void); +extern void LogRecoveryConflict(ProcSignalReason reason, TimestampTz wait_start, + TimestampTz now, VirtualTransactionId *wait_list, + bool still_waiting); + +/* + * Standby Rmgr (RM_STANDBY_ID) + * + * Standby recovery manager exists to perform actions that are required + * to make hot standby work. That includes logging AccessExclusiveLocks taken + * by transactions and running-xacts snapshots. + */ +extern void StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid); +extern void StandbyReleaseLockTree(TransactionId xid, + int nsubxids, TransactionId *subxids); +extern void StandbyReleaseAllLocks(void); +extern void StandbyReleaseOldLocks(TransactionId oldxid); + +#define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids) + + +/* + * Declarations for GetRunningTransactionData(). Similar to Snapshots, but + * not quite. This has nothing at all to do with visibility on this server, + * so this is completely separate from snapmgr.c and snapmgr.h. + * This data is important for creating the initial snapshot state on a + * standby server. We need lots more information than a normal snapshot, + * hence we use a specific data structure for our needs. This data + * is written to WAL as a separate record immediately after each + * checkpoint. That means that wherever we start a standby from we will + * almost immediately see the data we need to begin executing queries. + */ + +typedef enum +{ + SUBXIDS_IN_ARRAY, /* xids array includes all running subxids */ + SUBXIDS_MISSING, /* snapshot overflowed, subxids are missing */ + SUBXIDS_IN_SUBTRANS, /* subxids are not included in 'xids', but + * pg_subtrans is fully up-to-date */ +} subxids_array_status; + +typedef struct RunningTransactionsData +{ + int xcnt; /* # of xact ids in xids[] */ + int subxcnt; /* # of subxact ids in xids[] */ + subxids_array_status subxid_status; + TransactionId nextXid; /* xid from TransamVariables->nextXid */ + TransactionId oldestRunningXid; /* *not* oldestXmin */ + TransactionId oldestDatabaseRunningXid; /* same as above, but within the + * current database */ + TransactionId latestCompletedXid; /* so we can set xmax */ + + TransactionId *xids; /* array of (sub)xids still running */ +} RunningTransactionsData; + +typedef RunningTransactionsData *RunningTransactions; + +extern void LogAccessExclusiveLock(Oid dbOid, Oid relOid); +extern void LogAccessExclusiveLockPrepare(void); + +extern XLogRecPtr LogStandbySnapshot(void); +extern void LogStandbyInvalidations(int nmsgs, SharedInvalidationMessage *msgs, + bool relcacheInitFileInval); + +#endif /* STANDBY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/standbydefs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/standbydefs.h new file mode 100644 index 0000000..71e5ae8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/standbydefs.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * standbydefs.h + * Frontend exposed definitions for hot standby mode. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/standbydefs.h + * + *------------------------------------------------------------------------- + */ +#ifndef STANDBYDEFS_H +#define STANDBYDEFS_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/lockdefs.h" +#include "storage/sinval.h" + +/* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */ +extern void standby_redo(XLogReaderState *record); +extern void standby_desc(StringInfo buf, XLogReaderState *record); +extern const char *standby_identify(uint8 info); +extern void standby_desc_invalidations(StringInfo buf, + int nmsgs, SharedInvalidationMessage *msgs, + Oid dbId, Oid tsId, + bool relcacheInitFileInval); + +/* + * XLOG message types + */ +#define XLOG_STANDBY_LOCK 0x00 +#define XLOG_RUNNING_XACTS 0x10 +#define XLOG_INVALIDATIONS 0x20 + +typedef struct xl_standby_locks +{ + int nlocks; /* number of entries in locks array */ + xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER]; +} xl_standby_locks; + +/* + * When we write running xact data to WAL, we use this structure. + */ +typedef struct xl_running_xacts +{ + int xcnt; /* # of xact ids in xids[] */ + int subxcnt; /* # of subxact ids in xids[] */ + bool subxid_overflow; /* snapshot overflowed, subxids missing */ + TransactionId nextXid; /* xid from TransamVariables->nextXid */ + TransactionId oldestRunningXid; /* *not* oldestXmin */ + TransactionId latestCompletedXid; /* so we can set xmax */ + + TransactionId xids[FLEXIBLE_ARRAY_MEMBER]; +} xl_running_xacts; + +/* + * Invalidations for standby, currently only when transactions without an + * assigned xid commit. + */ +typedef struct xl_invalidations +{ + Oid dbId; /* MyDatabaseId */ + Oid tsId; /* MyDatabaseTableSpace */ + bool relcacheInitFileInval; /* invalidate relcache init files */ + int nmsgs; /* number of shared inval msgs */ + SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]; +} xl_invalidations; + +#define MinSizeOfInvalidations offsetof(xl_invalidations, msgs) + +#endif /* STANDBYDEFS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sync.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sync.h new file mode 100644 index 0000000..c2272d1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/sync.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * + * sync.h + * File synchronization management code. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/sync.h + * + *------------------------------------------------------------------------- + */ +#ifndef SYNC_H +#define SYNC_H + +#include "storage/relfilelocator.h" + +/* + * Type of sync request. These are used to manage the set of pending + * requests to call a sync handler's sync or unlink functions at the next + * checkpoint. + */ +typedef enum SyncRequestType +{ + SYNC_REQUEST, /* schedule a call of sync function */ + SYNC_UNLINK_REQUEST, /* schedule a call of unlink function */ + SYNC_FORGET_REQUEST, /* forget all calls for a tag */ + SYNC_FILTER_REQUEST, /* forget all calls satisfying match fn */ +} SyncRequestType; + +/* + * Which set of functions to use to handle a given request. The values of + * the enumerators must match the indexes of the function table in sync.c. + */ +typedef enum SyncRequestHandler +{ + SYNC_HANDLER_MD = 0, + SYNC_HANDLER_CLOG, + SYNC_HANDLER_COMMIT_TS, + SYNC_HANDLER_MULTIXACT_OFFSET, + SYNC_HANDLER_MULTIXACT_MEMBER, + SYNC_HANDLER_NONE, +} SyncRequestHandler; + +/* + * A tag identifying a file. Currently it has the members required for md.c's + * usage, but sync.c has no knowledge of the internal structure, and it is + * liable to change as required by future handlers. + */ +typedef struct FileTag +{ + int16 handler; /* SyncRequestHandler value, saving space */ + int16 forknum; /* ForkNumber, saving space */ + RelFileLocator rlocator; + uint64 segno; +} FileTag; + +extern void InitSync(void); +extern void SyncPreCheckpoint(void); +extern void SyncPostCheckpoint(void); +extern void ProcessSyncRequests(void); +extern void RememberSyncRequest(const FileTag *ftag, SyncRequestType type); +extern bool RegisterSyncRequest(const FileTag *ftag, SyncRequestType type, + bool retryOnError); + +#endif /* SYNC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/waiteventset.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/waiteventset.h new file mode 100644 index 0000000..dd514d5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/storage/waiteventset.h @@ -0,0 +1,98 @@ +/*------------------------------------------------------------------------- + * + * waiteventset.h + * ppoll() / pselect() like interface for waiting for events + * + * WaitEventSets allow to wait for latches being set and additional events - + * postmaster dying and socket readiness of several sockets currently - at the + * same time. On many platforms using a long lived event set is more + * efficient than using WaitLatch or WaitLatchOrSocket. + * + * WaitEventSetWait includes a provision for timeouts (which should be avoided + * when possible, as they incur extra overhead) and a provision for postmaster + * child processes to wake up immediately on postmaster death. See + * storage/ipc/waiteventset.c for detailed specifications for the exported + * functions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/waiteventset.h + * + *------------------------------------------------------------------------- + */ +#ifndef WAITEVENTSET_H +#define WAITEVENTSET_H + +#include "utils/resowner.h" + +/* + * Bitmasks for events that may wake-up WaitLatch(), WaitLatchOrSocket(), or + * WaitEventSetWait(). + */ +#define WL_LATCH_SET (1 << 0) +#define WL_SOCKET_READABLE (1 << 1) +#define WL_SOCKET_WRITEABLE (1 << 2) +#define WL_TIMEOUT (1 << 3) /* not for WaitEventSetWait() */ +#define WL_POSTMASTER_DEATH (1 << 4) +#define WL_EXIT_ON_PM_DEATH (1 << 5) +#ifdef WIN32 +#define WL_SOCKET_CONNECTED (1 << 6) +#else +/* avoid having to deal with case on platforms not requiring it */ +#define WL_SOCKET_CONNECTED WL_SOCKET_WRITEABLE +#endif +#define WL_SOCKET_CLOSED (1 << 7) +#ifdef WIN32 +#define WL_SOCKET_ACCEPT (1 << 8) +#else +/* avoid having to deal with case on platforms not requiring it */ +#define WL_SOCKET_ACCEPT WL_SOCKET_READABLE +#endif +#define WL_SOCKET_MASK (WL_SOCKET_READABLE | \ + WL_SOCKET_WRITEABLE | \ + WL_SOCKET_CONNECTED | \ + WL_SOCKET_ACCEPT | \ + WL_SOCKET_CLOSED) + +typedef struct WaitEvent +{ + int pos; /* position in the event data structure */ + uint32 events; /* triggered events */ + pgsocket fd; /* socket fd associated with event */ + void *user_data; /* pointer provided in AddWaitEventToSet */ +#ifdef WIN32 + bool reset; /* Is reset of the event required? */ +#endif +} WaitEvent; + +/* forward declarations to avoid exposing waiteventset.c implementation details */ +typedef struct WaitEventSet WaitEventSet; + +struct Latch; + +/* + * prototypes for functions in waiteventset.c + */ +extern void InitializeWaitEventSupport(void); + +extern WaitEventSet *CreateWaitEventSet(ResourceOwner resowner, int nevents); +extern void FreeWaitEventSet(WaitEventSet *set); +extern void FreeWaitEventSetAfterFork(WaitEventSet *set); +extern int AddWaitEventToSet(WaitEventSet *set, uint32 events, pgsocket fd, + struct Latch *latch, void *user_data); +extern void ModifyWaitEvent(WaitEventSet *set, int pos, uint32 events, + struct Latch *latch); +extern int WaitEventSetWait(WaitEventSet *set, long timeout, + WaitEvent *occurred_events, int nevents, + uint32 wait_event_info); +extern int GetNumRegisteredWaitEvents(WaitEventSet *set); +extern bool WaitEventSetCanReportClosed(void); + +#ifndef WIN32 +extern void WakeupMyProc(void); +extern void WakeupOtherProc(int pid); +#endif + +#endif /* WAITEVENTSET_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/backend_startup.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/backend_startup.h new file mode 100644 index 0000000..e863968 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/backend_startup.h @@ -0,0 +1,122 @@ +/*------------------------------------------------------------------------- + * + * backend_startup.h + * prototypes for backend_startup.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/backend_startup.h + * + *------------------------------------------------------------------------- + */ +#ifndef BACKEND_STARTUP_H +#define BACKEND_STARTUP_H + +#include "utils/timestamp.h" + +/* GUCs */ +extern PGDLLIMPORT bool Trace_connection_negotiation; +extern PGDLLIMPORT uint32 log_connections; +extern PGDLLIMPORT char *log_connections_string; + +/* Other globals */ +extern PGDLLIMPORT struct ConnectionTiming conn_timing; + +/* + * CAC_state is passed from postmaster to the backend process, to indicate + * whether the connection should be accepted, or if the process should just + * send an error to the client and close the connection. Note that the + * connection can fail for various reasons even if postmaster passed CAC_OK. + */ +typedef enum CAC_state +{ + CAC_OK, + CAC_STARTUP, + CAC_SHUTDOWN, + CAC_RECOVERY, + CAC_NOTHOTSTANDBY, + CAC_TOOMANY, +} CAC_state; + +/* Information passed from postmaster to backend process in 'startup_data' */ +typedef struct BackendStartupData +{ + CAC_state canAcceptConnections; + + /* + * Time at which the connection client socket is created. Only used for + * client and wal sender connections. + */ + TimestampTz socket_created; + + /* + * Time at which the postmaster initiates process creation -- either + * through fork or otherwise. Only used for client and wal sender + * connections. + */ + TimestampTz fork_started; +} BackendStartupData; + +/* + * Granular control over which messages to log for the log_connections GUC. + * + * RECEIPT, AUTHENTICATION, AUTHORIZATION, and SETUP_DURATIONS are different + * aspects of connection establishment and backend setup for which we may emit + * a log message. + * + * ALL is a convenience alias equivalent to all of the above aspects. + * + * ON is backwards compatibility alias for the connection aspects that were + * logged in Postgres versions < 18. + */ +typedef enum LogConnectionOption +{ + LOG_CONNECTION_RECEIPT = (1 << 0), + LOG_CONNECTION_AUTHENTICATION = (1 << 1), + LOG_CONNECTION_AUTHORIZATION = (1 << 2), + LOG_CONNECTION_SETUP_DURATIONS = (1 << 3), + LOG_CONNECTION_ON = + LOG_CONNECTION_RECEIPT | + LOG_CONNECTION_AUTHENTICATION | + LOG_CONNECTION_AUTHORIZATION, + LOG_CONNECTION_ALL = + LOG_CONNECTION_RECEIPT | + LOG_CONNECTION_AUTHENTICATION | + LOG_CONNECTION_AUTHORIZATION | + LOG_CONNECTION_SETUP_DURATIONS, +} LogConnectionOption; + +/* + * A collection of timings of various stages of connection establishment and + * setup for client backends and WAL senders. + * + * Used to emit the setup_durations log message for the log_connections GUC. + */ +typedef struct ConnectionTiming +{ + /* + * The time at which the client socket is created and the time at which + * the connection is fully set up and first ready for query. Together + * these represent the total connection establishment and setup time. + */ + TimestampTz socket_create; + TimestampTz ready_for_use; + + /* Time at which process creation was initiated */ + TimestampTz fork_start; + + /* Time at which process creation was completed */ + TimestampTz fork_end; + + /* Time at which authentication started */ + TimestampTz auth_start; + + /* Time at which authentication was finished */ + TimestampTz auth_end; +} ConnectionTiming; + +pg_noreturn extern void BackendMain(const void *startup_data, size_t startup_data_len); + +#endif /* BACKEND_STARTUP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/cmdtag.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/cmdtag.h new file mode 100644 index 0000000..8d027fc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/cmdtag.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * cmdtag.h + * Declarations for commandtag names and enumeration. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/cmdtag.h + * + *------------------------------------------------------------------------- + */ +#ifndef CMDTAG_H +#define CMDTAG_H + +/* buffer size required for command completion tags */ +#define COMPLETION_TAG_BUFSIZE 64 + +#define PG_CMDTAG(tag, name, evtrgok, rwrok, rowcnt) \ + tag, + +typedef enum CommandTag +{ +#include "tcop/cmdtaglist.h" +} CommandTag; + +#undef PG_CMDTAG + +typedef struct QueryCompletion +{ + CommandTag commandTag; + uint64 nprocessed; +} QueryCompletion; + + +static inline void +SetQueryCompletion(QueryCompletion *qc, CommandTag commandTag, + uint64 nprocessed) +{ + qc->commandTag = commandTag; + qc->nprocessed = nprocessed; +} + +static inline void +CopyQueryCompletion(QueryCompletion *dst, const QueryCompletion *src) +{ + dst->commandTag = src->commandTag; + dst->nprocessed = src->nprocessed; +} + + +extern void InitializeQueryCompletion(QueryCompletion *qc); +extern const char *GetCommandTagName(CommandTag commandTag); +extern const char *GetCommandTagNameAndLen(CommandTag commandTag, Size *len); +extern bool command_tag_display_rowcount(CommandTag commandTag); +extern bool command_tag_event_trigger_ok(CommandTag commandTag); +extern bool command_tag_table_rewrite_ok(CommandTag commandTag); +extern CommandTag GetCommandTagEnum(const char *commandname); +extern Size BuildQueryCompletionString(char *buff, const QueryCompletion *qc, + bool nameonly); + +#endif /* CMDTAG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/cmdtaglist.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/cmdtaglist.h new file mode 100644 index 0000000..d250a71 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/cmdtaglist.h @@ -0,0 +1,219 @@ +/*---------------------------------------------------------------------- + * + * cmdtaglist.h + * Command tags + * + * The command tag list is kept in its own source file for possible use + * by automatic tools. The exact representation of a command tag is + * determined by the PG_CMDTAG macro, which is not defined in this file; + * it can be defined by the caller for special purposes. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/cmdtaglist.h + * + *---------------------------------------------------------------------- + */ + +/* there is deliberately not an #ifndef CMDTAGLIST_H here */ + +/* + * List of command tags. The entries must be sorted alphabetically on their + * textual name, so that we can bsearch on it; see GetCommandTagEnum(). + */ + +/* symbol name, textual name, event_trigger_ok, table_rewrite_ok, rowcount */ +PG_CMDTAG(CMDTAG_UNKNOWN, "???", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_ACCESS_METHOD, "ALTER ACCESS METHOD", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_AGGREGATE, "ALTER AGGREGATE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_CAST, "ALTER CAST", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_COLLATION, "ALTER COLLATION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_CONSTRAINT, "ALTER CONSTRAINT", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_CONVERSION, "ALTER CONVERSION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_DATABASE, "ALTER DATABASE", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_DEFAULT_PRIVILEGES, "ALTER DEFAULT PRIVILEGES", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_DOMAIN, "ALTER DOMAIN", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_EVENT_TRIGGER, "ALTER EVENT TRIGGER", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_EXTENSION, "ALTER EXTENSION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_FOREIGN_DATA_WRAPPER, "ALTER FOREIGN DATA WRAPPER", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_FOREIGN_TABLE, "ALTER FOREIGN TABLE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_FUNCTION, "ALTER FUNCTION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_INDEX, "ALTER INDEX", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_LANGUAGE, "ALTER LANGUAGE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_LARGE_OBJECT, "ALTER LARGE OBJECT", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_MATERIALIZED_VIEW, "ALTER MATERIALIZED VIEW", true, true, false) +PG_CMDTAG(CMDTAG_ALTER_OPERATOR, "ALTER OPERATOR", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_OPERATOR_CLASS, "ALTER OPERATOR CLASS", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_OPERATOR_FAMILY, "ALTER OPERATOR FAMILY", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_POLICY, "ALTER POLICY", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_PROCEDURE, "ALTER PROCEDURE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_PUBLICATION, "ALTER PUBLICATION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_ROLE, "ALTER ROLE", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_ROUTINE, "ALTER ROUTINE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_RULE, "ALTER RULE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SCHEMA, "ALTER SCHEMA", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SEQUENCE, "ALTER SEQUENCE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SERVER, "ALTER SERVER", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_STATISTICS, "ALTER STATISTICS", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SUBSCRIPTION, "ALTER SUBSCRIPTION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SYSTEM, "ALTER SYSTEM", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_TABLE, "ALTER TABLE", true, true, false) +PG_CMDTAG(CMDTAG_ALTER_TABLESPACE, "ALTER TABLESPACE", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_CONFIGURATION, "ALTER TEXT SEARCH CONFIGURATION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_DICTIONARY, "ALTER TEXT SEARCH DICTIONARY", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_PARSER, "ALTER TEXT SEARCH PARSER", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_TEMPLATE, "ALTER TEXT SEARCH TEMPLATE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TRANSFORM, "ALTER TRANSFORM", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TRIGGER, "ALTER TRIGGER", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TYPE, "ALTER TYPE", true, true, false) +PG_CMDTAG(CMDTAG_ALTER_USER_MAPPING, "ALTER USER MAPPING", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_VIEW, "ALTER VIEW", true, false, false) +PG_CMDTAG(CMDTAG_ANALYZE, "ANALYZE", false, false, false) +PG_CMDTAG(CMDTAG_BEGIN, "BEGIN", false, false, false) +PG_CMDTAG(CMDTAG_CALL, "CALL", false, false, false) +PG_CMDTAG(CMDTAG_CHECKPOINT, "CHECKPOINT", false, false, false) +PG_CMDTAG(CMDTAG_CLOSE, "CLOSE", false, false, false) +PG_CMDTAG(CMDTAG_CLOSE_CURSOR, "CLOSE CURSOR", false, false, false) +PG_CMDTAG(CMDTAG_CLOSE_CURSOR_ALL, "CLOSE CURSOR ALL", false, false, false) +PG_CMDTAG(CMDTAG_CLUSTER, "CLUSTER", false, false, false) +PG_CMDTAG(CMDTAG_COMMENT, "COMMENT", true, false, false) +PG_CMDTAG(CMDTAG_COMMIT, "COMMIT", false, false, false) +PG_CMDTAG(CMDTAG_COMMIT_PREPARED, "COMMIT PREPARED", false, false, false) +PG_CMDTAG(CMDTAG_COPY, "COPY", false, false, true) +PG_CMDTAG(CMDTAG_COPY_FROM, "COPY FROM", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_ACCESS_METHOD, "CREATE ACCESS METHOD", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_AGGREGATE, "CREATE AGGREGATE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_CAST, "CREATE CAST", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_COLLATION, "CREATE COLLATION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_CONSTRAINT, "CREATE CONSTRAINT", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_CONVERSION, "CREATE CONVERSION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_DATABASE, "CREATE DATABASE", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_DOMAIN, "CREATE DOMAIN", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_EVENT_TRIGGER, "CREATE EVENT TRIGGER", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_EXTENSION, "CREATE EXTENSION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_FOREIGN_DATA_WRAPPER, "CREATE FOREIGN DATA WRAPPER", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_FOREIGN_TABLE, "CREATE FOREIGN TABLE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_FUNCTION, "CREATE FUNCTION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_INDEX, "CREATE INDEX", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_LANGUAGE, "CREATE LANGUAGE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_MATERIALIZED_VIEW, "CREATE MATERIALIZED VIEW", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_OPERATOR, "CREATE OPERATOR", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_OPERATOR_CLASS, "CREATE OPERATOR CLASS", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_OPERATOR_FAMILY, "CREATE OPERATOR FAMILY", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_POLICY, "CREATE POLICY", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_PROCEDURE, "CREATE PROCEDURE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_PUBLICATION, "CREATE PUBLICATION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_ROLE, "CREATE ROLE", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_ROUTINE, "CREATE ROUTINE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_RULE, "CREATE RULE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_SCHEMA, "CREATE SCHEMA", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_SEQUENCE, "CREATE SEQUENCE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_SERVER, "CREATE SERVER", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_STATISTICS, "CREATE STATISTICS", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_SUBSCRIPTION, "CREATE SUBSCRIPTION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TABLE, "CREATE TABLE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TABLE_AS, "CREATE TABLE AS", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TABLESPACE, "CREATE TABLESPACE", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_CONFIGURATION, "CREATE TEXT SEARCH CONFIGURATION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_DICTIONARY, "CREATE TEXT SEARCH DICTIONARY", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_PARSER, "CREATE TEXT SEARCH PARSER", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_TEMPLATE, "CREATE TEXT SEARCH TEMPLATE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TRANSFORM, "CREATE TRANSFORM", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TRIGGER, "CREATE TRIGGER", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TYPE, "CREATE TYPE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_USER_MAPPING, "CREATE USER MAPPING", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_VIEW, "CREATE VIEW", true, false, false) +PG_CMDTAG(CMDTAG_DEALLOCATE, "DEALLOCATE", false, false, false) +PG_CMDTAG(CMDTAG_DEALLOCATE_ALL, "DEALLOCATE ALL", false, false, false) +PG_CMDTAG(CMDTAG_DECLARE_CURSOR, "DECLARE CURSOR", false, false, false) +PG_CMDTAG(CMDTAG_DELETE, "DELETE", false, false, true) +PG_CMDTAG(CMDTAG_DISCARD, "DISCARD", false, false, false) +PG_CMDTAG(CMDTAG_DISCARD_ALL, "DISCARD ALL", false, false, false) +PG_CMDTAG(CMDTAG_DISCARD_PLANS, "DISCARD PLANS", false, false, false) +PG_CMDTAG(CMDTAG_DISCARD_SEQUENCES, "DISCARD SEQUENCES", false, false, false) +PG_CMDTAG(CMDTAG_DISCARD_TEMP, "DISCARD TEMP", false, false, false) +PG_CMDTAG(CMDTAG_DO, "DO", false, false, false) +PG_CMDTAG(CMDTAG_DROP_ACCESS_METHOD, "DROP ACCESS METHOD", true, false, false) +PG_CMDTAG(CMDTAG_DROP_AGGREGATE, "DROP AGGREGATE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_CAST, "DROP CAST", true, false, false) +PG_CMDTAG(CMDTAG_DROP_COLLATION, "DROP COLLATION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_CONSTRAINT, "DROP CONSTRAINT", true, false, false) +PG_CMDTAG(CMDTAG_DROP_CONVERSION, "DROP CONVERSION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_DATABASE, "DROP DATABASE", false, false, false) +PG_CMDTAG(CMDTAG_DROP_DOMAIN, "DROP DOMAIN", true, false, false) +PG_CMDTAG(CMDTAG_DROP_EVENT_TRIGGER, "DROP EVENT TRIGGER", false, false, false) +PG_CMDTAG(CMDTAG_DROP_EXTENSION, "DROP EXTENSION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_FOREIGN_DATA_WRAPPER, "DROP FOREIGN DATA WRAPPER", true, false, false) +PG_CMDTAG(CMDTAG_DROP_FOREIGN_TABLE, "DROP FOREIGN TABLE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_FUNCTION, "DROP FUNCTION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_INDEX, "DROP INDEX", true, false, false) +PG_CMDTAG(CMDTAG_DROP_LANGUAGE, "DROP LANGUAGE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_MATERIALIZED_VIEW, "DROP MATERIALIZED VIEW", true, false, false) +PG_CMDTAG(CMDTAG_DROP_OPERATOR, "DROP OPERATOR", true, false, false) +PG_CMDTAG(CMDTAG_DROP_OPERATOR_CLASS, "DROP OPERATOR CLASS", true, false, false) +PG_CMDTAG(CMDTAG_DROP_OPERATOR_FAMILY, "DROP OPERATOR FAMILY", true, false, false) +PG_CMDTAG(CMDTAG_DROP_OWNED, "DROP OWNED", true, false, false) +PG_CMDTAG(CMDTAG_DROP_POLICY, "DROP POLICY", true, false, false) +PG_CMDTAG(CMDTAG_DROP_PROCEDURE, "DROP PROCEDURE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_PUBLICATION, "DROP PUBLICATION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_ROLE, "DROP ROLE", false, false, false) +PG_CMDTAG(CMDTAG_DROP_ROUTINE, "DROP ROUTINE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_RULE, "DROP RULE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_SCHEMA, "DROP SCHEMA", true, false, false) +PG_CMDTAG(CMDTAG_DROP_SEQUENCE, "DROP SEQUENCE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_SERVER, "DROP SERVER", true, false, false) +PG_CMDTAG(CMDTAG_DROP_STATISTICS, "DROP STATISTICS", true, false, false) +PG_CMDTAG(CMDTAG_DROP_SUBSCRIPTION, "DROP SUBSCRIPTION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TABLE, "DROP TABLE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TABLESPACE, "DROP TABLESPACE", false, false, false) +PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_CONFIGURATION, "DROP TEXT SEARCH CONFIGURATION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_DICTIONARY, "DROP TEXT SEARCH DICTIONARY", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_PARSER, "DROP TEXT SEARCH PARSER", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_TEMPLATE, "DROP TEXT SEARCH TEMPLATE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TRANSFORM, "DROP TRANSFORM", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TRIGGER, "DROP TRIGGER", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TYPE, "DROP TYPE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_USER_MAPPING, "DROP USER MAPPING", true, false, false) +PG_CMDTAG(CMDTAG_DROP_VIEW, "DROP VIEW", true, false, false) +PG_CMDTAG(CMDTAG_EXECUTE, "EXECUTE", false, false, false) +PG_CMDTAG(CMDTAG_EXPLAIN, "EXPLAIN", false, false, false) +PG_CMDTAG(CMDTAG_FETCH, "FETCH", false, false, true) +PG_CMDTAG(CMDTAG_GRANT, "GRANT", true, false, false) +PG_CMDTAG(CMDTAG_GRANT_ROLE, "GRANT ROLE", false, false, false) +PG_CMDTAG(CMDTAG_IMPORT_FOREIGN_SCHEMA, "IMPORT FOREIGN SCHEMA", true, false, false) +PG_CMDTAG(CMDTAG_INSERT, "INSERT", false, false, true) +PG_CMDTAG(CMDTAG_LISTEN, "LISTEN", false, false, false) +PG_CMDTAG(CMDTAG_LOAD, "LOAD", false, false, false) +PG_CMDTAG(CMDTAG_LOCK_TABLE, "LOCK TABLE", false, false, false) +PG_CMDTAG(CMDTAG_LOGIN, "LOGIN", true, false, false) +PG_CMDTAG(CMDTAG_MERGE, "MERGE", false, false, true) +PG_CMDTAG(CMDTAG_MOVE, "MOVE", false, false, true) +PG_CMDTAG(CMDTAG_NOTIFY, "NOTIFY", false, false, false) +PG_CMDTAG(CMDTAG_PREPARE, "PREPARE", false, false, false) +PG_CMDTAG(CMDTAG_PREPARE_TRANSACTION, "PREPARE TRANSACTION", false, false, false) +PG_CMDTAG(CMDTAG_REASSIGN_OWNED, "REASSIGN OWNED", false, false, false) +PG_CMDTAG(CMDTAG_REFRESH_MATERIALIZED_VIEW, "REFRESH MATERIALIZED VIEW", true, false, false) +PG_CMDTAG(CMDTAG_REINDEX, "REINDEX", true, false, false) +PG_CMDTAG(CMDTAG_RELEASE, "RELEASE", false, false, false) +PG_CMDTAG(CMDTAG_RESET, "RESET", false, false, false) +PG_CMDTAG(CMDTAG_REVOKE, "REVOKE", true, false, false) +PG_CMDTAG(CMDTAG_REVOKE_ROLE, "REVOKE ROLE", false, false, false) +PG_CMDTAG(CMDTAG_ROLLBACK, "ROLLBACK", false, false, false) +PG_CMDTAG(CMDTAG_ROLLBACK_PREPARED, "ROLLBACK PREPARED", false, false, false) +PG_CMDTAG(CMDTAG_SAVEPOINT, "SAVEPOINT", false, false, false) +PG_CMDTAG(CMDTAG_SECURITY_LABEL, "SECURITY LABEL", true, false, false) +PG_CMDTAG(CMDTAG_SELECT, "SELECT", false, false, true) +PG_CMDTAG(CMDTAG_SELECT_FOR_KEY_SHARE, "SELECT FOR KEY SHARE", false, false, false) +PG_CMDTAG(CMDTAG_SELECT_FOR_NO_KEY_UPDATE, "SELECT FOR NO KEY UPDATE", false, false, false) +PG_CMDTAG(CMDTAG_SELECT_FOR_SHARE, "SELECT FOR SHARE", false, false, false) +PG_CMDTAG(CMDTAG_SELECT_FOR_UPDATE, "SELECT FOR UPDATE", false, false, false) +PG_CMDTAG(CMDTAG_SELECT_INTO, "SELECT INTO", true, false, false) +PG_CMDTAG(CMDTAG_SET, "SET", false, false, false) +PG_CMDTAG(CMDTAG_SET_CONSTRAINTS, "SET CONSTRAINTS", false, false, false) +PG_CMDTAG(CMDTAG_SHOW, "SHOW", false, false, false) +PG_CMDTAG(CMDTAG_START_TRANSACTION, "START TRANSACTION", false, false, false) +PG_CMDTAG(CMDTAG_TRUNCATE_TABLE, "TRUNCATE TABLE", false, false, false) +PG_CMDTAG(CMDTAG_UNLISTEN, "UNLISTEN", false, false, false) +PG_CMDTAG(CMDTAG_UPDATE, "UPDATE", false, false, true) +PG_CMDTAG(CMDTAG_VACUUM, "VACUUM", false, false, false) diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/deparse_utility.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/deparse_utility.h new file mode 100644 index 0000000..3651045 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/deparse_utility.h @@ -0,0 +1,108 @@ +/*------------------------------------------------------------------------- + * + * deparse_utility.h + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/deparse_utility.h + * + *------------------------------------------------------------------------- + */ +#ifndef DEPARSE_UTILITY_H +#define DEPARSE_UTILITY_H + +#include "access/attnum.h" +#include "catalog/objectaddress.h" +#include "nodes/nodes.h" +#include "utils/aclchk_internal.h" + + +/* + * Support for keeping track of collected commands. + */ +typedef enum CollectedCommandType +{ + SCT_Simple, + SCT_AlterTable, + SCT_Grant, + SCT_AlterOpFamily, + SCT_AlterDefaultPrivileges, + SCT_CreateOpClass, + SCT_AlterTSConfig, +} CollectedCommandType; + +/* + * For ALTER TABLE commands, we keep a list of the subcommands therein. + */ +typedef struct CollectedATSubcmd +{ + ObjectAddress address; /* affected column, constraint, index, ... */ + Node *parsetree; +} CollectedATSubcmd; + +typedef struct CollectedCommand +{ + CollectedCommandType type; + + bool in_extension; + Node *parsetree; + + union + { + /* most commands */ + struct + { + ObjectAddress address; + ObjectAddress secondaryObject; + } simple; + + /* ALTER TABLE, and internal uses thereof */ + struct + { + Oid objectId; + Oid classId; + List *subcmds; + } alterTable; + + /* GRANT / REVOKE */ + struct + { + InternalGrant *istmt; + } grant; + + /* ALTER OPERATOR FAMILY */ + struct + { + ObjectAddress address; + List *operators; + List *procedures; + } opfam; + + /* CREATE OPERATOR CLASS */ + struct + { + ObjectAddress address; + List *operators; + List *procedures; + } createopc; + + /* ALTER TEXT SEARCH CONFIGURATION ADD/ALTER/DROP MAPPING */ + struct + { + ObjectAddress address; + Oid *dictIds; + int ndicts; + } atscfg; + + /* ALTER DEFAULT PRIVILEGES */ + struct + { + ObjectType objtype; + } defprivs; + } d; + + struct CollectedCommand *parent; /* when nested */ +} CollectedCommand; + +#endif /* DEPARSE_UTILITY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/dest.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/dest.h new file mode 100644 index 0000000..00c092e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/dest.h @@ -0,0 +1,148 @@ +/*------------------------------------------------------------------------- + * + * dest.h + * support for communication destinations + * + * Whenever the backend executes a query that returns tuples, the results + * have to go someplace. For example: + * + * - stdout is the destination only when we are running a + * standalone backend (no postmaster) and are returning results + * back to an interactive user. + * + * - a remote process is the destination when we are + * running a backend with a frontend and the frontend executes + * PQexec() or PQfn(). In this case, the results are sent + * to the frontend via the functions in backend/libpq. + * + * - DestNone is the destination when the system executes + * a query internally. The results are discarded. + * + * dest.c defines three functions that implement destination management: + * + * BeginCommand: initialize the destination at start of command. + * CreateDestReceiver: return a pointer to a struct of destination-specific + * receiver functions. + * EndCommand: clean up the destination at end of command. + * + * BeginCommand/EndCommand are executed once per received SQL query. + * + * CreateDestReceiver returns a receiver object appropriate to the specified + * destination. The executor, as well as utility statements that can return + * tuples, are passed the resulting DestReceiver* pointer. Each executor run + * or utility execution calls the receiver's rStartup method, then the + * receiveSlot method (zero or more times), then the rShutdown method. + * The same receiver object may be re-used multiple times; eventually it is + * destroyed by calling its rDestroy method. + * + * In some cases, receiver objects require additional parameters that must + * be passed to them after calling CreateDestReceiver. Since the set of + * parameters varies for different receiver types, this is not handled by + * this module, but by direct calls from the calling code to receiver type + * specific functions. + * + * The DestReceiver object returned by CreateDestReceiver may be a statically + * allocated object (for destination types that require no local state), + * in which case rDestroy is a no-op. Alternatively it can be a palloc'd + * object that has DestReceiver as its first field and contains additional + * fields (see printtup.c for an example). These additional fields are then + * accessible to the DestReceiver functions by casting the DestReceiver* + * pointer passed to them. The palloc'd object is pfree'd by the rDestroy + * method. Note that the caller of CreateDestReceiver should take care to + * do so in a memory context that is long-lived enough for the receiver + * object not to disappear while still needed. + * + * Special provision: None_Receiver is a permanently available receiver + * object for the DestNone destination. This avoids useless creation/destroy + * calls in portal and cursor manipulations. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/dest.h + * + *------------------------------------------------------------------------- + */ +#ifndef DEST_H +#define DEST_H + +#include "executor/tuptable.h" +#include "tcop/cmdtag.h" + + + + +/* ---------------- + * CommandDest is a simplistic means of identifying the desired + * destination. Someday this will probably need to be improved. + * + * Note: only the values DestNone, DestDebug, DestRemote are legal for the + * global variable whereToSendOutput. The other values may be used + * as the destination for individual commands. + * ---------------- + */ +typedef enum +{ + DestNone, /* results are discarded */ + DestDebug, /* results go to debugging output */ + DestRemote, /* results sent to frontend process */ + DestRemoteExecute, /* sent to frontend, in Execute command */ + DestRemoteSimple, /* sent to frontend, w/no catalog access */ + DestSPI, /* results sent to SPI manager */ + DestTuplestore, /* results sent to Tuplestore */ + DestIntoRel, /* results sent to relation (SELECT INTO) */ + DestCopyOut, /* results sent to COPY TO code */ + DestSQLFunction, /* results sent to SQL-language func mgr */ + DestTransientRel, /* results sent to transient relation */ + DestTupleQueue, /* results sent to tuple queue */ + DestExplainSerialize, /* results are serialized and discarded */ +} CommandDest; + +/* ---------------- + * DestReceiver is a base type for destination-specific local state. + * In the simplest cases, there is no state info, just the function + * pointers that the executor must call. + * + * Note: the receiveSlot routine must be passed a slot containing a TupleDesc + * identical to the one given to the rStartup routine. It returns bool where + * a "true" value means "continue processing" and a "false" value means + * "stop early, just as if we'd reached the end of the scan". + * ---------------- + */ +typedef struct _DestReceiver DestReceiver; + +struct _DestReceiver +{ + /* Called for each tuple to be output: */ + bool (*receiveSlot) (TupleTableSlot *slot, + DestReceiver *self); + /* Per-executor-run initialization and shutdown: */ + void (*rStartup) (DestReceiver *self, + int operation, + TupleDesc typeinfo); + void (*rShutdown) (DestReceiver *self); + /* Destroy the receiver object itself (if dynamically allocated) */ + void (*rDestroy) (DestReceiver *self); + /* CommandDest code for this receiver */ + CommandDest mydest; + /* Private fields might appear beyond this point... */ +}; + +extern PGDLLIMPORT DestReceiver *None_Receiver; /* permanent receiver for + * DestNone */ + +/* The primary destination management functions */ + +extern void BeginCommand(CommandTag commandTag, CommandDest dest); +extern DestReceiver *CreateDestReceiver(CommandDest dest); +extern void EndCommand(const QueryCompletion *qc, CommandDest dest, + bool force_undecorated_output); +extern void EndReplicationCommand(const char *commandTag); + +/* Additional functions that go with destination management, more or less. */ + +extern void NullCommand(CommandDest dest); +extern void ReadyForQuery(CommandDest dest); + +#endif /* DEST_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/fastpath.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/fastpath.h new file mode 100644 index 0000000..3a94ec4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/fastpath.h @@ -0,0 +1,20 @@ +/*------------------------------------------------------------------------- + * + * fastpath.h + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/fastpath.h + * + *------------------------------------------------------------------------- + */ +#ifndef FASTPATH_H +#define FASTPATH_H + +#include "lib/stringinfo.h" + +extern void HandleFunctionRequest(StringInfo msgBuf); + +#endif /* FASTPATH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/pquery.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/pquery.h new file mode 100644 index 0000000..fa3cc5f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/pquery.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pquery.h + * prototypes for pquery.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/pquery.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQUERY_H +#define PQUERY_H + +#include "nodes/parsenodes.h" +#include "utils/portal.h" + +struct PlannedStmt; /* avoid including plannodes.h here */ + + +extern PGDLLIMPORT Portal ActivePortal; + + +extern PortalStrategy ChoosePortalStrategy(List *stmts); + +extern List *FetchPortalTargetList(Portal portal); + +extern List *FetchStatementTargetList(Node *stmt); + +extern void PortalStart(Portal portal, ParamListInfo params, + int eflags, Snapshot snapshot); + +extern void PortalSetResultFormat(Portal portal, int nFormats, + int16 *formats); + +extern bool PortalRun(Portal portal, long count, bool isTopLevel, + DestReceiver *dest, DestReceiver *altdest, + QueryCompletion *qc); + +extern uint64 PortalRunFetch(Portal portal, + FetchDirection fdirection, + long count, + DestReceiver *dest); + +extern bool PlannedStmtRequiresSnapshot(struct PlannedStmt *pstmt); + +extern void EnsurePortalSnapshotExists(void); + +#endif /* PQUERY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/tcopprot.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/tcopprot.h new file mode 100644 index 0000000..a83cc4f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/tcopprot.h @@ -0,0 +1,94 @@ +/*------------------------------------------------------------------------- + * + * tcopprot.h + * prototypes for postgres.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/tcopprot.h + * + *------------------------------------------------------------------------- + */ +#ifndef TCOPPROT_H +#define TCOPPROT_H + +#include "nodes/params.h" +#include "nodes/plannodes.h" +#include "storage/procsignal.h" +#include "utils/guc.h" +#include "utils/queryenvironment.h" + + +extern PGDLLIMPORT CommandDest whereToSendOutput; +extern PGDLLIMPORT const char *debug_query_string; +extern PGDLLIMPORT int PostAuthDelay; +extern PGDLLIMPORT int client_connection_check_interval; + +/* GUC-configurable parameters */ + +typedef enum +{ + LOGSTMT_NONE, /* log no statements */ + LOGSTMT_DDL, /* log data definition statements */ + LOGSTMT_MOD, /* log modification statements, plus DDL */ + LOGSTMT_ALL, /* log all statements */ +} LogStmtLevel; + +extern PGDLLIMPORT bool Log_disconnections; +extern PGDLLIMPORT int log_statement; + +/* Flags for restrict_nonsystem_relation_kind value */ +#define RESTRICT_RELKIND_VIEW 0x01 +#define RESTRICT_RELKIND_FOREIGN_TABLE 0x02 + +extern PGDLLIMPORT int restrict_nonsystem_relation_kind; + +extern List *pg_parse_query(const char *query_string); +extern List *pg_rewrite_query(Query *query); +extern List *pg_analyze_and_rewrite_fixedparams(RawStmt *parsetree, + const char *query_string, + const Oid *paramTypes, int numParams, + QueryEnvironment *queryEnv); +extern List *pg_analyze_and_rewrite_varparams(RawStmt *parsetree, + const char *query_string, + Oid **paramTypes, + int *numParams, + QueryEnvironment *queryEnv); +extern List *pg_analyze_and_rewrite_withcb(RawStmt *parsetree, + const char *query_string, + ParserSetupHook parserSetup, + void *parserSetupArg, + QueryEnvironment *queryEnv); +extern PlannedStmt *pg_plan_query(Query *querytree, const char *query_string, + int cursorOptions, + ParamListInfo boundParams); +extern List *pg_plan_queries(List *querytrees, const char *query_string, + int cursorOptions, + ParamListInfo boundParams); + +extern void die(SIGNAL_ARGS); +pg_noreturn extern void quickdie(SIGNAL_ARGS); +extern void StatementCancelHandler(SIGNAL_ARGS); +pg_noreturn extern void FloatExceptionHandler(SIGNAL_ARGS); +extern void HandleRecoveryConflictInterrupt(ProcSignalReason reason); +extern void ProcessClientReadInterrupt(bool blocked); +extern void ProcessClientWriteInterrupt(bool blocked); + +extern void process_postgres_switches(int argc, char *argv[], + GucContext ctx, const char **dbname); +pg_noreturn extern void PostgresSingleUserMain(int argc, char *argv[], + const char *username); +pg_noreturn extern void PostgresMain(const char *dbname, + const char *username); +extern void ResetUsage(void); +extern void ShowUsage(const char *title); +extern int check_log_duration(char *msec_str, bool was_logged); +extern void set_debug_options(int debug_flag, + GucContext context, GucSource source); +extern bool set_plan_disabling_options(const char *arg, + GucContext context, GucSource source); +extern const char *get_stats_option_name(const char *arg); + +#endif /* TCOPPROT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/utility.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/utility.h new file mode 100644 index 0000000..2f05dd5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tcop/utility.h @@ -0,0 +1,112 @@ +/*------------------------------------------------------------------------- + * + * utility.h + * prototypes for utility.c. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/utility.h + * + *------------------------------------------------------------------------- + */ +#ifndef UTILITY_H +#define UTILITY_H + +#include "tcop/cmdtag.h" +#include "tcop/tcopprot.h" + +typedef enum +{ + PROCESS_UTILITY_TOPLEVEL, /* toplevel interactive command */ + PROCESS_UTILITY_QUERY, /* a complete query, but not toplevel */ + PROCESS_UTILITY_QUERY_NONATOMIC, /* a complete query, nonatomic + * execution context */ + PROCESS_UTILITY_SUBCOMMAND, /* a portion of a query */ +} ProcessUtilityContext; + +/* Info needed when recursing from ALTER TABLE */ +typedef struct AlterTableUtilityContext +{ + PlannedStmt *pstmt; /* PlannedStmt for outer ALTER TABLE command */ + const char *queryString; /* its query string */ + Oid relid; /* OID of ALTER's target table */ + ParamListInfo params; /* any parameters available to ALTER TABLE */ + QueryEnvironment *queryEnv; /* execution environment for ALTER TABLE */ +} AlterTableUtilityContext; + +/* + * These constants are used to describe the extent to which a particular + * command is read-only. + * + * COMMAND_OK_IN_READ_ONLY_TXN means that the command is permissible even when + * XactReadOnly is set. This bit should be set for commands that don't change + * the state of the database (data or schema) in a way that would affect the + * output of pg_dump. + * + * COMMAND_OK_IN_PARALLEL_MODE means that the command is permissible even + * when in parallel mode. Writing tuples is forbidden, as is anything that + * might confuse cooperating processes. + * + * COMMAND_OK_IN_RECOVERY means that the command is permissible even when in + * recovery. It can't write WAL, nor can it do things that would imperil + * replay of future WAL received from the primary. + */ +#define COMMAND_OK_IN_READ_ONLY_TXN 0x0001 +#define COMMAND_OK_IN_PARALLEL_MODE 0x0002 +#define COMMAND_OK_IN_RECOVERY 0x0004 + +/* + * We say that a command is strictly read-only if it is sufficiently read-only + * for all purposes. For clarity, we also have a constant for commands that are + * in no way read-only. + */ +#define COMMAND_IS_STRICTLY_READ_ONLY \ + (COMMAND_OK_IN_READ_ONLY_TXN | COMMAND_OK_IN_RECOVERY | \ + COMMAND_OK_IN_PARALLEL_MODE) +#define COMMAND_IS_NOT_READ_ONLY 0 + +/* Hook for plugins to get control in ProcessUtility() */ +typedef void (*ProcessUtility_hook_type) (PlannedStmt *pstmt, + const char *queryString, + bool readOnlyTree, + ProcessUtilityContext context, + ParamListInfo params, + QueryEnvironment *queryEnv, + DestReceiver *dest, QueryCompletion *qc); +extern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook; + +extern void ProcessUtility(PlannedStmt *pstmt, const char *queryString, + bool readOnlyTree, + ProcessUtilityContext context, ParamListInfo params, + QueryEnvironment *queryEnv, + DestReceiver *dest, QueryCompletion *qc); +extern void standard_ProcessUtility(PlannedStmt *pstmt, const char *queryString, + bool readOnlyTree, + ProcessUtilityContext context, ParamListInfo params, + QueryEnvironment *queryEnv, + DestReceiver *dest, QueryCompletion *qc); + +extern void ProcessUtilityForAlterTable(Node *stmt, + AlterTableUtilityContext *context); + +extern bool UtilityReturnsTuples(Node *parsetree); + +extern TupleDesc UtilityTupleDescriptor(Node *parsetree); + +extern Query *UtilityContainsQuery(Node *parsetree); + +extern CommandTag CreateCommandTag(Node *parsetree); + +static inline const char * +CreateCommandName(Node *parsetree) +{ + return GetCommandTagName(CreateCommandTag(parsetree)); +} + +extern LogStmtLevel GetCommandLogLevel(Node *parsetree); + +extern bool CommandIsReadOnly(PlannedStmt *pstmt); + +#endif /* UTILITY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/dicts/regis.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/dicts/regis.h new file mode 100644 index 0000000..3f40cdc --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/dicts/regis.h @@ -0,0 +1,49 @@ +/*------------------------------------------------------------------------- + * + * regis.h + * + * Declarations for fast regex subset, used by ISpell + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/tsearch/dicts/regis.h + * + *------------------------------------------------------------------------- + */ + +#ifndef __REGIS_H__ +#define __REGIS_H__ + +typedef struct RegisNode +{ + uint32 + type:2, + len:16, + unused:14; + struct RegisNode *next; + unsigned char data[FLEXIBLE_ARRAY_MEMBER]; +} RegisNode; + +#define RNHDRSZ (offsetof(RegisNode,data)) + +#define RSF_ONEOF 1 +#define RSF_NONEOF 2 + +typedef struct Regis +{ + RegisNode *node; + uint32 + issuffix:1, + nchar:16, + unused:15; +} Regis; + +extern bool RS_isRegis(const char *str); + +extern void RS_compile(Regis *r, bool issuffix, const char *str); +extern void RS_free(Regis *r); + +/*returns true if matches */ +extern bool RS_execute(Regis *r, char *str); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/dicts/spell.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/dicts/spell.h new file mode 100644 index 0000000..919b7df --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/dicts/spell.h @@ -0,0 +1,241 @@ +/*------------------------------------------------------------------------- + * + * spell.h + * + * Declarations for ISpell dictionary + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/tsearch/dicts/spell.h + * + *------------------------------------------------------------------------- + */ + +#ifndef __SPELL_H__ +#define __SPELL_H__ + +#include "regex/regex.h" +#include "tsearch/dicts/regis.h" +#include "tsearch/ts_public.h" + +/* + * SPNode and SPNodeData are used to represent prefix tree (Trie) to store + * a words list. + */ +struct SPNode; + +typedef struct +{ + uint32 val:8, + isword:1, + /* Stores compound flags listed below */ + compoundflag:4, + /* Reference to an entry of the AffixData field */ + affix:19; + struct SPNode *node; +} SPNodeData; + +/* + * Names of FF_ are correlated with Hunspell options in affix file + * https://hunspell.github.io/ + */ +#define FF_COMPOUNDONLY 0x01 +#define FF_COMPOUNDBEGIN 0x02 +#define FF_COMPOUNDMIDDLE 0x04 +#define FF_COMPOUNDLAST 0x08 +#define FF_COMPOUNDFLAG ( FF_COMPOUNDBEGIN | FF_COMPOUNDMIDDLE | \ + FF_COMPOUNDLAST ) +#define FF_COMPOUNDFLAGMASK 0x0f + +typedef struct SPNode +{ + uint32 length; + SPNodeData data[FLEXIBLE_ARRAY_MEMBER]; +} SPNode; + +#define SPNHDRSZ (offsetof(SPNode,data)) + +/* + * Represents an entry in a words list. + */ +typedef struct spell_struct +{ + union + { + /* + * flag is filled in by NIImportDictionary(). After + * NISortDictionary(), d is used instead of flag. + */ + const char *flag; + /* d is used in mkSPNode() */ + struct + { + /* Reference to an entry of the AffixData field */ + int affix; + /* Length of the word */ + int len; + } d; + } p; + char word[FLEXIBLE_ARRAY_MEMBER]; +} SPELL; + +#define SPELLHDRSZ (offsetof(SPELL, word)) + +/* + * Represents an entry in an affix list. + */ +typedef struct aff_struct +{ + const char *flag; + /* FF_SUFFIX or FF_PREFIX */ + uint32 type:1, + flagflags:7, + issimple:1, + isregis:1, + replen:14; + const char *find; + const char *repl; + union + { + /* + * Arrays of AFFIX are moved and sorted. We'll use a pointer to + * regex_t to keep this struct small, and avoid assuming that regex_t + * is movable. + */ + regex_t *pregex; + Regis regis; + } reg; +} AFFIX; + +/* + * affixes use dictionary flags too + */ +#define FF_COMPOUNDPERMITFLAG 0x10 +#define FF_COMPOUNDFORBIDFLAG 0x20 +#define FF_CROSSPRODUCT 0x40 + +/* + * Don't change the order of these. Initialization sorts by these, + * and expects prefixes to come first after sorting. + */ +#define FF_SUFFIX 1 +#define FF_PREFIX 0 + +/* + * AffixNode and AffixNodeData are used to represent prefix tree (Trie) to store + * an affix list. + */ +struct AffixNode; + +typedef struct +{ + uint32 val:8, + naff:24; + AFFIX **aff; + struct AffixNode *node; +} AffixNodeData; + +typedef struct AffixNode +{ + uint32 isvoid:1, + length:31; + AffixNodeData data[FLEXIBLE_ARRAY_MEMBER]; +} AffixNode; + +#define ANHRDSZ (offsetof(AffixNode, data)) + +typedef struct +{ + const char *affix; + int len; + bool issuffix; +} CMPDAffix; + +/* + * Type of encoding affix flags in Hunspell dictionaries + */ +typedef enum +{ + FM_CHAR, /* one character (like ispell) */ + FM_LONG, /* two characters */ + FM_NUM, /* number, >= 0 and < 65536 */ +} FlagMode; + +/* + * Structure to store Hunspell options. Flag representation depends on flag + * type. These flags are about support of compound words. + */ +typedef struct CompoundAffixFlag +{ + union + { + /* Flag name if flagMode is FM_CHAR or FM_LONG */ + const char *s; + /* Flag name if flagMode is FM_NUM */ + uint32 i; + } flag; + /* we don't have a bsearch_arg version, so, copy FlagMode */ + FlagMode flagMode; + uint32 value; +} CompoundAffixFlag; + +#define FLAGNUM_MAXSIZE (1 << 16) + +typedef struct +{ + int maffixes; + int naffixes; + AFFIX *Affix; + + AffixNode *Suffix; + AffixNode *Prefix; + + SPNode *Dictionary; + /* Array of sets of affixes */ + const char **AffixData; + int lenAffixData; + int nAffixData; + bool useFlagAliases; + + CMPDAffix *CompoundAffix; + + bool usecompound; + FlagMode flagMode; + + /* + * All follow fields are actually needed only for initialization + */ + + /* Array of Hunspell options in affix file */ + CompoundAffixFlag *CompoundAffixFlags; + /* number of entries in CompoundAffixFlags array */ + int nCompoundAffixFlag; + /* allocated length of CompoundAffixFlags array */ + int mCompoundAffixFlag; + + /* + * Remaining fields are only used during dictionary construction; they are + * set up by NIStartBuild and cleared by NIFinishBuild. + */ + MemoryContext buildCxt; /* temp context for construction */ + + /* Temporary array of all words in the dict file */ + SPELL **Spell; + int nspell; /* number of valid entries in Spell array */ + int mspell; /* allocated length of Spell array */ + + /* These are used to allocate "compact" data without palloc overhead */ + char *firstfree; /* first free address (always maxaligned) */ + size_t avail; /* free space remaining at firstfree */ +} IspellDict; + +extern TSLexeme *NINormalizeWord(IspellDict *Conf, const char *word); + +extern void NIStartBuild(IspellDict *Conf); +extern void NIImportAffixes(IspellDict *Conf, const char *filename); +extern void NIImportDictionary(IspellDict *Conf, const char *filename); +extern void NISortDictionary(IspellDict *Conf); +extern void NISortAffixes(IspellDict *Conf); +extern void NIFinishBuild(IspellDict *Conf); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_cache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_cache.h new file mode 100644 index 0000000..ed7527b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_cache.h @@ -0,0 +1,96 @@ +/*------------------------------------------------------------------------- + * + * ts_cache.h + * Tsearch related object caches. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tsearch/ts_cache.h + * + *------------------------------------------------------------------------- + */ +#ifndef TS_CACHE_H +#define TS_CACHE_H + +#include "fmgr.h" + + +/* + * All TS*CacheEntry structs must share this common header + * (see InvalidateTSCacheCallBack) + */ +typedef struct TSAnyCacheEntry +{ + Oid objId; + bool isvalid; +} TSAnyCacheEntry; + + +typedef struct TSParserCacheEntry +{ + /* prsId is the hash lookup key and MUST BE FIRST */ + Oid prsId; /* OID of the parser */ + bool isvalid; + + Oid startOid; + Oid tokenOid; + Oid endOid; + Oid headlineOid; + Oid lextypeOid; + + /* + * Pre-set-up fmgr call of most needed parser's methods + */ + FmgrInfo prsstart; + FmgrInfo prstoken; + FmgrInfo prsend; + FmgrInfo prsheadline; +} TSParserCacheEntry; + +typedef struct TSDictionaryCacheEntry +{ + /* dictId is the hash lookup key and MUST BE FIRST */ + Oid dictId; + bool isvalid; + + /* most frequent fmgr call */ + Oid lexizeOid; + FmgrInfo lexize; + + MemoryContext dictCtx; /* memory context to store private data */ + void *dictData; +} TSDictionaryCacheEntry; + +typedef struct +{ + int len; + Oid *dictIds; +} ListDictionary; + +typedef struct +{ + /* cfgId is the hash lookup key and MUST BE FIRST */ + Oid cfgId; + bool isvalid; + + Oid prsId; + + int lenmap; + ListDictionary *map; +} TSConfigCacheEntry; + + +/* + * GUC variable for current configuration + */ +extern PGDLLIMPORT char *TSCurrentConfig; + + +extern TSParserCacheEntry *lookup_ts_parser_cache(Oid prsId); +extern TSDictionaryCacheEntry *lookup_ts_dictionary_cache(Oid dictId); +extern TSConfigCacheEntry *lookup_ts_config_cache(Oid cfgId); + +extern Oid getTSCurrentConfig(bool emitError); + +#endif /* TS_CACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_locale.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_locale.h new file mode 100644 index 0000000..378d9ba --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_locale.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * ts_locale.h + * locale compatibility layer for tsearch + * + * Copyright (c) 1998-2025, PostgreSQL Global Development Group + * + * src/include/tsearch/ts_locale.h + * + *------------------------------------------------------------------------- + */ +#ifndef __TSLOCALE_H__ +#define __TSLOCALE_H__ + +#include +#include +#include + +#include "lib/stringinfo.h" +#include "mb/pg_wchar.h" +#include "utils/pg_locale.h" + +/* working state for tsearch_readline (should be a local var in caller) */ +typedef struct +{ + FILE *fp; + const char *filename; + int lineno; + StringInfoData buf; /* current input line, in UTF-8 */ + char *curline; /* current input line, in DB's encoding */ + /* curline may be NULL, or equal to buf.data, or a palloc'd string */ + ErrorContextCallback cb; +} tsearch_readline_state; + +#define TOUCHAR(x) (*((const unsigned char *) (x))) + +/* The second argument of t_iseq() must be a plain ASCII character */ +#define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c)) + +/* Copy multibyte character of known byte length, return byte length. */ +static inline int +ts_copychar_with_len(void *dest, const void *src, int length) +{ + memcpy(dest, src, length); + return length; +} + +/* Copy multibyte character from null-terminated string, return byte length. */ +static inline int +ts_copychar_cstr(void *dest, const void *src) +{ + return ts_copychar_with_len(dest, src, pg_mblen_cstr((const char *) src)); +} + +/* Historical macro for the above. */ +#define COPYCHAR ts_copychar_cstr + +#define GENERATE_T_ISCLASS_DECL(character_class) \ +extern int t_is##character_class##_with_len(const char *ptr, int len); \ +extern int t_is##character_class##_cstr(const char *ptr); \ +extern int t_is##character_class##_unbounded(const char *ptr); \ +\ +/* deprecated */ \ +extern int t_is##character_class(const char *ptr); + +GENERATE_T_ISCLASS_DECL(alnum); +GENERATE_T_ISCLASS_DECL(alpha); + +extern bool tsearch_readline_begin(tsearch_readline_state *stp, + const char *filename); +extern char *tsearch_readline(tsearch_readline_state *stp); +extern void tsearch_readline_end(tsearch_readline_state *stp); + +#endif /* __TSLOCALE_H__ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_public.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_public.h new file mode 100644 index 0000000..52e8bde --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_public.h @@ -0,0 +1,159 @@ +/*------------------------------------------------------------------------- + * + * ts_public.h + * Public interface to various tsearch modules, such as + * parsers and dictionaries. + * + * Copyright (c) 1998-2025, PostgreSQL Global Development Group + * + * src/include/tsearch/ts_public.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PG_TS_PUBLIC_H_ +#define _PG_TS_PUBLIC_H_ + +#include "tsearch/ts_type.h" + +/* + * Parser's framework + */ + +/* + * returning type for prslextype method of parser + */ +typedef struct +{ + int lexid; + char *alias; + char *descr; +} LexDescr; + +/* + * Interface to headline generator (tsparser's prsheadline function) + * + * HeadlineParsedText describes the text that is to be highlighted. + * Some fields are passed from the core code to the prsheadline function, + * while others are output from the prsheadline function. + * + * The principal data is words[], an array of HeadlineWordEntry, + * one entry per token, of length curwords. + * The fields of HeadlineWordEntry are: + * + * in, selected, replace, skip: these flags are initially zero + * and may be set by the prsheadline function. A consecutive group + * of tokens marked "in" form a "fragment" to be output. + * Such tokens may additionally be marked selected, replace, or skip + * to modify how they are shown. (If you set more than one of those + * bits, you get an unspecified one of those behaviors.) + * + * type, len, pos, word: filled by core code to describe the token. + * + * item: if the token matches any operand of the tsquery of interest, + * a pointer to such an operand. (If there are multiple matching + * operands, we generate extra copies of the HeadlineWordEntry to hold + * all the pointers. The extras are marked with repeated = 1 and should + * be ignored except for checking the item pointer.) + */ +typedef struct +{ + uint32 selected:1, /* token is to be highlighted */ + in:1, /* token is part of headline */ + replace:1, /* token is to be replaced with a space */ + repeated:1, /* duplicate entry to hold item pointer */ + skip:1, /* token is to be skipped (not output) */ + unused:3, /* available bits */ + type:8, /* parser's token category */ + len:16; /* length of token */ + WordEntryPos pos; /* position of token */ + char *word; /* text of token (not null-terminated) */ + QueryOperand *item; /* a matching query operand, or NULL if none */ +} HeadlineWordEntry; + +typedef struct +{ + /* Fields filled by core code before calling prsheadline function: */ + HeadlineWordEntry *words; + int32 lenwords; /* allocated length of words[] */ + int32 curwords; /* current number of valid entries */ + int32 vectorpos; /* used by ts_parse.c in filling pos fields */ + + /* The prsheadline function must fill these fields: */ + /* Strings for marking selected tokens and separating fragments: */ + char *startsel; /* palloc'd strings */ + char *stopsel; + char *fragdelim; + int16 startsellen; /* lengths of strings */ + int16 stopsellen; + int16 fragdelimlen; +} HeadlineParsedText; + +/* + * Common useful things for tsearch subsystem + */ +extern char *get_tsearch_config_filename(const char *basename, + const char *extension); + +/* + * Often useful stopword list management + */ +typedef struct +{ + int len; + char **stop; +} StopList; + +extern void readstoplist(const char *fname, StopList *s, + char *(*wordop) (const char *, size_t, Oid)); +extern bool searchstoplist(StopList *s, char *key); + +/* + * Interface with dictionaries + */ + +/* return struct for any lexize function */ +typedef struct +{ + /*---------- + * Number of current variant of split word. For example the Norwegian + * word 'fotballklubber' has two variants to split: ( fotball, klubb ) + * and ( fot, ball, klubb ). So, dictionary should return: + * + * nvariant lexeme + * 1 fotball + * 1 klubb + * 2 fot + * 2 ball + * 2 klubb + * + * In general, a TSLexeme will be considered to belong to the same split + * variant as the previous one if they have the same nvariant value. + * The exact values don't matter, only changes from one lexeme to next. + *---------- + */ + uint16 nvariant; + + uint16 flags; /* See flag bits below */ + + char *lexeme; /* C string */ +} TSLexeme; + +/* Flag bits that can appear in TSLexeme.flags */ +#define TSL_ADDPOS 0x01 +#define TSL_PREFIX 0x02 +#define TSL_FILTER 0x04 + +/* + * Struct for supporting complex dictionaries like thesaurus. + * 4th argument for dictlexize method is a pointer to this + */ +typedef struct +{ + bool isend; /* in: marks for lexize_info about text end is + * reached */ + bool getnext; /* out: dict wants next lexeme */ + void *private_state; /* internal dict state between calls with + * getnext == true */ +} DictSubState; + +#endif /* _PG_TS_PUBLIC_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_type.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_type.h new file mode 100644 index 0000000..d9d5334 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_type.h @@ -0,0 +1,272 @@ +/*------------------------------------------------------------------------- + * + * ts_type.h + * Definitions for the tsvector and tsquery types + * + * Copyright (c) 1998-2025, PostgreSQL Global Development Group + * + * src/include/tsearch/ts_type.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PG_TSTYPE_H_ +#define _PG_TSTYPE_H_ + +#include "fmgr.h" +#include "utils/memutils.h" + + +/* + * TSVector type. + * + * Structure of tsvector datatype: + * 1) standard varlena header + * 2) int32 size - number of lexemes (WordEntry array entries) + * 3) Array of WordEntry - one per lexeme; must be sorted according to + * tsCompareString() (ie, memcmp of lexeme strings). + * WordEntry->pos gives the number of bytes from end of WordEntry + * array to start of lexeme's string, which is of length len. + * 4) Per-lexeme data storage: + * lexeme string (not null-terminated) + * if haspos is true: + * padding byte if necessary to make the position data 2-byte aligned + * uint16 number of positions that follow + * WordEntryPos[] positions + * + * The positions for each lexeme must be sorted. + * + * Note, tsvectorsend/recv believe that sizeof(WordEntry) == 4 + */ + +typedef struct +{ + uint32 + haspos:1, + len:11, /* MAX 2Kb */ + pos:20; /* MAX 1Mb */ +} WordEntry; + +#define MAXSTRLEN ( (1<<11) - 1) +#define MAXSTRPOS ( (1<<20) - 1) + +extern int compareWordEntryPos(const void *a, const void *b); + +/* + * Equivalent to + * typedef struct { + * uint16 + * weight:2, + * pos:14; + * } + */ + +typedef uint16 WordEntryPos; + +typedef struct +{ + uint16 npos; + WordEntryPos pos[FLEXIBLE_ARRAY_MEMBER]; +} WordEntryPosVector; + +/* WordEntryPosVector with exactly 1 entry */ +typedef struct +{ + uint16 npos; + WordEntryPos pos[1]; +} WordEntryPosVector1; + + +#define WEP_GETWEIGHT(x) ( (x) >> 14 ) +#define WEP_GETPOS(x) ( (x) & 0x3fff ) + +#define WEP_SETWEIGHT(x,v) ( (x) = ( (v) << 14 ) | ( (x) & 0x3fff ) ) +#define WEP_SETPOS(x,v) ( (x) = ( (x) & 0xc000 ) | ( (v) & 0x3fff ) ) + +#define MAXENTRYPOS (1<<14) +#define MAXNUMPOS (256) +#define LIMITPOS(x) ( ( (x) >= MAXENTRYPOS ) ? (MAXENTRYPOS-1) : (x) ) + +/* This struct represents a complete tsvector datum */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 size; + WordEntry entries[FLEXIBLE_ARRAY_MEMBER]; + /* lexemes follow the entries[] array */ +} TSVectorData; + +typedef TSVectorData *TSVector; + +#define DATAHDRSIZE (offsetof(TSVectorData, entries)) +#define CALCDATASIZE(nentries, lenstr) (DATAHDRSIZE + (nentries) * sizeof(WordEntry) + (lenstr) ) + +/* pointer to start of a tsvector's WordEntry array */ +#define ARRPTR(x) ( (x)->entries ) + +/* pointer to start of a tsvector's lexeme storage */ +#define STRPTR(x) ( (char *) &(x)->entries[(x)->size] ) + +#define _POSVECPTR(x, e) ((WordEntryPosVector *)(STRPTR(x) + SHORTALIGN((e)->pos + (e)->len))) +#define POSDATALEN(x,e) ( ( (e)->haspos ) ? (_POSVECPTR(x,e)->npos) : 0 ) +#define POSDATAPTR(x,e) (_POSVECPTR(x,e)->pos) + +/* + * fmgr interface functions + */ + +static inline TSVector +DatumGetTSVector(Datum X) +{ + return (TSVector) PG_DETOAST_DATUM(X); +} + +static inline TSVector +DatumGetTSVectorCopy(Datum X) +{ + return (TSVector) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +TSVectorGetDatum(const TSVectorData *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_TSVECTOR(n) DatumGetTSVector(PG_GETARG_DATUM(n)) +#define PG_GETARG_TSVECTOR_COPY(n) DatumGetTSVectorCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_TSVECTOR(x) return TSVectorGetDatum(x) + + +/* + * TSQuery + * + * + */ + +typedef int8 QueryItemType; + +/* Valid values for QueryItemType: */ +#define QI_VAL 1 +#define QI_OPR 2 +#define QI_VALSTOP 3 /* This is only used in an intermediate stack + * representation in parse_tsquery. It's not a + * legal type elsewhere. */ + +/* + * QueryItem is one node in tsquery - operator or operand. + */ +typedef struct +{ + QueryItemType type; /* operand or kind of operator (ts_tokentype) */ + uint8 weight; /* weights of operand to search. It's a + * bitmask of allowed weights. if it =0 then + * any weight are allowed. Weights and bit + * map: A: 1<<3 B: 1<<2 C: 1<<1 D: 1<<0 */ + bool prefix; /* true if it's a prefix search */ + int32 valcrc; /* XXX: pg_crc32 would be a more appropriate + * data type, but we use comparisons to signed + * integers in the code. They would need to be + * changed as well. */ + + /* pointer to text value of operand, must correlate with WordEntry */ + uint32 + length:12, + distance:20; +} QueryOperand; + + +/* + * Legal values for QueryOperator.operator. + */ +#define OP_NOT 1 +#define OP_AND 2 +#define OP_OR 3 +#define OP_PHRASE 4 /* highest code, tsquery_cleanup.c */ +#define OP_COUNT 4 + +extern PGDLLIMPORT const int tsearch_op_priority[OP_COUNT]; + +/* get operation priority by its code */ +#define OP_PRIORITY(x) ( tsearch_op_priority[(x) - 1] ) +/* get QueryOperator priority */ +#define QO_PRIORITY(x) OP_PRIORITY(((QueryOperator *) (x))->oper) + +typedef struct +{ + QueryItemType type; + int8 oper; /* see above */ + int16 distance; /* distance between agrs for OP_PHRASE */ + uint32 left; /* pointer to left operand. Right operand is + * item + 1, left operand is placed + * item+item->left */ +} QueryOperator; + +/* + * Note: TSQuery is 4-bytes aligned, so make sure there's no fields + * inside QueryItem requiring 8-byte alignment, like int64. + */ +typedef union +{ + QueryItemType type; + QueryOperator qoperator; + QueryOperand qoperand; +} QueryItem; + +/* + * Storage: + * (len)(size)(array of QueryItem)(operands as '\0'-terminated c-strings) + */ + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 size; /* number of QueryItems */ + char data[FLEXIBLE_ARRAY_MEMBER]; /* data starts here */ +} TSQueryData; + +typedef TSQueryData *TSQuery; + +#define HDRSIZETQ ( VARHDRSZ + sizeof(int32) ) + +/* Computes the size of header and all QueryItems. size is the number of + * QueryItems, and lenofoperand is the total length of all operands + */ +#define COMPUTESIZE(size, lenofoperand) ( HDRSIZETQ + (size) * sizeof(QueryItem) + (lenofoperand) ) +#define TSQUERY_TOO_BIG(size, lenofoperand) \ + ((size) > (MaxAllocSize - HDRSIZETQ - (lenofoperand)) / sizeof(QueryItem)) + +/* Returns a pointer to the first QueryItem in a TSQuery */ +#define GETQUERY(x) ((QueryItem*)( (char*)(x)+HDRSIZETQ )) + +/* Returns a pointer to the beginning of operands in a TSQuery */ +#define GETOPERAND(x) ( (char*)GETQUERY(x) + ((TSQuery)(x))->size * sizeof(QueryItem) ) + +/* + * fmgr interface functions + * Note, TSQuery type marked as plain storage, so it can't be toasted + * but PG_DETOAST_DATUM_COPY is used for simplicity + */ + +static inline TSQuery +DatumGetTSQuery(Datum X) +{ + return (TSQuery) DatumGetPointer(X); +} + +static inline TSQuery +DatumGetTSQueryCopy(Datum X) +{ + return (TSQuery) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +TSQueryGetDatum(const TSQueryData *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_TSQUERY(n) DatumGetTSQuery(PG_GETARG_DATUM(n)) +#define PG_GETARG_TSQUERY_COPY(n) DatumGetTSQueryCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_TSQUERY(x) return TSQueryGetDatum(x) + +#endif /* _PG_TSTYPE_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_utils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_utils.h new file mode 100644 index 0000000..80ba533 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/tsearch/ts_utils.h @@ -0,0 +1,281 @@ +/*------------------------------------------------------------------------- + * + * ts_utils.h + * helper utilities for tsearch + * + * Copyright (c) 1998-2025, PostgreSQL Global Development Group + * + * src/include/tsearch/ts_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PG_TS_UTILS_H_ +#define _PG_TS_UTILS_H_ + +#include "nodes/pg_list.h" +#include "tsearch/ts_public.h" +#include "tsearch/ts_type.h" + +/* + * Common parse definitions for tsvector and tsquery + */ + +/* tsvector parser support. */ + +struct TSVectorParseStateData; /* opaque struct in tsvector_parser.c */ +typedef struct TSVectorParseStateData *TSVectorParseState; + +/* flag bits that can be passed to init_tsvector_parser: */ +#define P_TSV_OPR_IS_DELIM (1 << 0) +#define P_TSV_IS_TSQUERY (1 << 1) +#define P_TSV_IS_WEB (1 << 2) + +extern TSVectorParseState init_tsvector_parser(char *input, int flags, + Node *escontext); +extern void reset_tsvector_parser(TSVectorParseState state, char *input); +extern bool gettoken_tsvector(TSVectorParseState state, + char **strval, int *lenval, + WordEntryPos **pos_ptr, int *poslen, + char **endptr); +extern void close_tsvector_parser(TSVectorParseState state); + +/* phrase operator begins with '<' */ +#define ISOPERATOR(x) (*(x) == '!' || \ + *(x) == '&' || \ + *(x) == '|' || \ + *(x) == '(' || \ + *(x) == ')' || \ + *(x) == '<') + +/* parse_tsquery */ + +struct TSQueryParserStateData; /* private in backend/utils/adt/tsquery.c */ +typedef struct TSQueryParserStateData *TSQueryParserState; + +typedef void (*PushFunction) (Datum opaque, TSQueryParserState state, + char *token, int tokenlen, + int16 tokenweights, /* bitmap as described in + * QueryOperand struct */ + bool prefix); + +/* flag bits that can be passed to parse_tsquery: */ +#define P_TSQ_PLAIN (1 << 0) +#define P_TSQ_WEB (1 << 1) + +extern TSQuery parse_tsquery(char *buf, + PushFunction pushval, + Datum opaque, + int flags, + Node *escontext); + +/* Functions for use by PushFunction implementations */ +extern void pushValue(TSQueryParserState state, + char *strval, int lenval, int16 weight, bool prefix); +extern void pushStop(TSQueryParserState state); +extern void pushOperator(TSQueryParserState state, int8 oper, int16 distance); + +/* + * parse plain text and lexize words + */ +typedef struct +{ + uint16 flags; /* currently, only TSL_PREFIX */ + uint16 len; + uint16 nvariant; + uint16 alen; + union + { + uint16 pos; + + /* + * When apos array is used, apos[0] is the number of elements in the + * array (excluding apos[0]), and alen is the allocated size of the + * array. We do not allow more than MAXNUMPOS array elements. + */ + uint16 *apos; + } pos; + char *word; +} ParsedWord; + +typedef struct +{ + ParsedWord *words; + int32 lenwords; + int32 curwords; + int32 pos; +} ParsedText; + +extern void parsetext(Oid cfgId, ParsedText *prs, char *buf, int32 buflen); + +/* + * headline framework, flow in common to generate: + * 1 parse text with hlparsetext + * 2 parser-specific function to find part + * 3 generateHeadline to generate result text + */ + +extern void hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query, + char *buf, int32 buflen); +extern text *generateHeadline(HeadlineParsedText *prs); + +/* + * TSQuery execution support + * + * TS_execute() executes a tsquery against data that can be represented in + * various forms. The TSExecuteCallback callback function is called to check + * whether a given primitive tsquery value is matched in the data. + */ + +/* TS_execute requires ternary logic to handle NOT with phrase matches */ +typedef enum +{ + TS_NO, /* definitely no match */ + TS_YES, /* definitely does match */ + TS_MAYBE, /* can't verify match for lack of pos data */ +} TSTernaryValue; + +/* + * struct ExecPhraseData is passed to a TSExecuteCallback function if we need + * lexeme position data (because of a phrase-match operator in the tsquery). + * The callback should fill in position data when it returns TS_YES (success). + * If it cannot return position data, it should leave "data" unchanged and + * return TS_MAYBE. The caller of TS_execute() must then arrange for a later + * recheck with position data available. + * + * The reported lexeme positions must be sorted and unique. Callers must only + * consult the position bits of the pos array, ie, WEP_GETPOS(data->pos[i]). + * This allows the returned "pos" to point directly to the WordEntryPos + * portion of a tsvector value. If "allocated" is true then the pos array + * is palloc'd workspace and caller may free it when done. + * + * "negate" means that the pos array contains positions where the query does + * not match, rather than positions where it does. "width" is positive when + * the match is wider than one lexeme. Neither of these fields normally need + * to be touched by TSExecuteCallback functions; they are used for + * phrase-search processing within TS_execute. + * + * All fields of the ExecPhraseData struct are initially zeroed by caller. + */ +typedef struct ExecPhraseData +{ + int npos; /* number of positions reported */ + bool allocated; /* pos points to palloc'd data? */ + bool negate; /* positions are where query is NOT matched */ + WordEntryPos *pos; /* ordered, non-duplicate lexeme positions */ + int width; /* width of match in lexemes, less 1 */ +} ExecPhraseData; + +/* + * Signature for TSQuery lexeme check functions + * + * arg: opaque value passed through from caller of TS_execute + * val: lexeme to test for presence of + * data: to be filled with lexeme positions; NULL if position data not needed + * + * Return TS_YES if lexeme is present in data, TS_MAYBE if it might be + * present, TS_NO if it definitely is not present. If data is not NULL, + * it must be filled with lexeme positions if available. If position data + * is not available, leave *data as zeroes and return TS_MAYBE, never TS_YES. + */ +typedef TSTernaryValue (*TSExecuteCallback) (void *arg, QueryOperand *val, + ExecPhraseData *data); + +/* + * Flag bits for TS_execute + */ +#define TS_EXEC_EMPTY (0x00) +/* + * If TS_EXEC_SKIP_NOT is set, then NOT sub-expressions are automatically + * evaluated to be true. This was formerly the default behavior. It's now + * deprecated because it tends to give silly answers, but some applications + * might still have a use for it. + */ +#define TS_EXEC_SKIP_NOT (0x01) +/* + * If TS_EXEC_PHRASE_NO_POS is set, allow OP_PHRASE to be executed lossily + * in the absence of position information: a true result indicates that the + * phrase might be present. Without this flag, OP_PHRASE always returns + * false if lexeme position information is not available. + */ +#define TS_EXEC_PHRASE_NO_POS (0x02) + +extern bool TS_execute(QueryItem *curitem, void *arg, uint32 flags, + TSExecuteCallback chkcond); +extern TSTernaryValue TS_execute_ternary(QueryItem *curitem, void *arg, + uint32 flags, + TSExecuteCallback chkcond); +extern List *TS_execute_locations(QueryItem *curitem, void *arg, + uint32 flags, + TSExecuteCallback chkcond); +extern bool tsquery_requires_match(QueryItem *curitem); + +/* + * to_ts* - text transformation to tsvector, tsquery + */ +extern TSVector make_tsvector(ParsedText *prs); +extern int32 tsCompareString(char *a, int lena, char *b, int lenb, bool prefix); + +/* + * Possible strategy numbers for indexes + * TSearchStrategyNumber - (tsvector|text) @@ tsquery + * TSearchWithClassStrategyNumber - tsvector @@@ tsquery + */ +#define TSearchStrategyNumber 1 +#define TSearchWithClassStrategyNumber 2 + +/* + * TSQuery Utilities + */ +extern QueryItem *clean_NOT(QueryItem *ptr, int32 *len); +extern TSQuery cleanup_tsquery_stopwords(TSQuery in, bool noisy); + +typedef struct QTNode +{ + QueryItem *valnode; + uint32 flags; + int32 nchild; + char *word; + uint32 sign; + struct QTNode **child; +} QTNode; + +/* bits in QTNode.flags */ +#define QTN_NEEDFREE 0x01 +#define QTN_NOCHANGE 0x02 +#define QTN_WORDFREE 0x04 + +typedef uint64 TSQuerySign; + +#define TSQS_SIGLEN (sizeof(TSQuerySign)*BITS_PER_BYTE) + +static inline Datum +TSQuerySignGetDatum(TSQuerySign X) +{ + return Int64GetDatum((int64) X); +} + +static inline TSQuerySign +DatumGetTSQuerySign(Datum X) +{ + return (TSQuerySign) DatumGetInt64(X); +} + +#define PG_RETURN_TSQUERYSIGN(X) return TSQuerySignGetDatum(X) +#define PG_GETARG_TSQUERYSIGN(n) DatumGetTSQuerySign(PG_GETARG_DATUM(n)) + + +extern QTNode *QT2QTN(QueryItem *in, char *operand); +extern TSQuery QTN2QT(QTNode *in); +extern void QTNFree(QTNode *in); +extern void QTNSort(QTNode *in); +extern void QTNTernary(QTNode *in); +extern void QTNBinary(QTNode *in); +extern int QTNodeCompare(QTNode *an, QTNode *bn); +extern QTNode *QTNCopy(QTNode *in); +extern void QTNClearFlags(QTNode *in, uint32 flags); +extern bool QTNEq(QTNode *a, QTNode *b); +extern TSQuerySign makeTSQuerySign(TSQuery a); +extern QTNode *findsubquery(QTNode *root, QTNode *ex, QTNode *subs, + bool *isfind); + +#endif /* _PG_TS_UTILS_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/acl.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/acl.h new file mode 100644 index 0000000..01ae5b7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/acl.h @@ -0,0 +1,290 @@ +/*------------------------------------------------------------------------- + * + * acl.h + * Definition of (and support for) access control list data structures. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/acl.h + * + * NOTES + * An ACL array is simply an array of AclItems, representing the union + * of the privileges represented by the individual items. A zero-length + * array represents "no privileges". + * + * The order of items in the array is important as client utilities (in + * particular, pg_dump, though possibly other clients) expect to be able + * to issue GRANTs in the ordering of the items in the array. The reason + * this matters is that GRANTs WITH GRANT OPTION must be before any GRANTs + * which depend on it. This happens naturally in the backend during + * operations as we update ACLs in-place, new items are appended, and + * existing entries are only removed if there's no dependency on them (no + * GRANT can been based on it, or, if there was, those GRANTs are also + * removed). + * + * For backward-compatibility purposes we have to allow null ACL entries + * in system catalogs. A null ACL will be treated as meaning "default + * protection" (i.e., whatever acldefault() returns). + *------------------------------------------------------------------------- + */ +#ifndef ACL_H +#define ACL_H + +#include "access/htup.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "utils/snapshot.h" + + +/* + * typedef AclMode is declared in parsenodes.h, also the individual privilege + * bit meanings are defined there + */ + +#define ACL_ID_PUBLIC 0 /* placeholder for id in a PUBLIC acl item */ + +/* + * AclItem + * + * Note: must be same size on all platforms, because the size is hardcoded + * in the pg_type.h entry for aclitem. + */ +typedef struct AclItem +{ + Oid ai_grantee; /* ID that this item grants privs to */ + Oid ai_grantor; /* grantor of privs */ + AclMode ai_privs; /* privilege bits */ +} AclItem; + +/* + * The upper 32 bits of the ai_privs field of an AclItem are the grant option + * bits, and the lower 32 bits are the actual privileges. We use "rights" + * to mean the combined grant option and privilege bits fields. + */ +#define ACLITEM_GET_PRIVS(item) ((item).ai_privs & 0xFFFFFFFF) +#define ACLITEM_GET_GOPTIONS(item) (((item).ai_privs >> 32) & 0xFFFFFFFF) +#define ACLITEM_GET_RIGHTS(item) ((item).ai_privs) + +#define ACL_GRANT_OPTION_FOR(privs) (((AclMode) (privs) & 0xFFFFFFFF) << 32) +#define ACL_OPTION_TO_PRIVS(privs) (((AclMode) (privs) >> 32) & 0xFFFFFFFF) + +#define ACLITEM_SET_PRIVS(item,privs) \ + ((item).ai_privs = ((item).ai_privs & ~((AclMode) 0xFFFFFFFF)) | \ + ((AclMode) (privs) & 0xFFFFFFFF)) +#define ACLITEM_SET_GOPTIONS(item,goptions) \ + ((item).ai_privs = ((item).ai_privs & ~(((AclMode) 0xFFFFFFFF) << 32)) | \ + (((AclMode) (goptions) & 0xFFFFFFFF) << 32)) +#define ACLITEM_SET_RIGHTS(item,rights) \ + ((item).ai_privs = (AclMode) (rights)) + +#define ACLITEM_SET_PRIVS_GOPTIONS(item,privs,goptions) \ + ((item).ai_privs = ((AclMode) (privs) & 0xFFFFFFFF) | \ + (((AclMode) (goptions) & 0xFFFFFFFF) << 32)) + + +#define ACLITEM_ALL_PRIV_BITS ((AclMode) 0xFFFFFFFF) +#define ACLITEM_ALL_GOPTION_BITS ((AclMode) 0xFFFFFFFF << 32) + +/* + * Definitions for convenient access to Acl (array of AclItem). + * These are standard PostgreSQL arrays, but are restricted to have one + * dimension and no nulls. We also ignore the lower bound when reading, + * and set it to one when writing. + * + * CAUTION: as of PostgreSQL 7.1, these arrays are toastable (just like all + * other array types). Therefore, be careful to detoast them with the + * macros provided, unless you know for certain that a particular array + * can't have been toasted. + */ + + +/* + * Acl a one-dimensional array of AclItem + */ +typedef struct ArrayType Acl; + +#define ACL_NUM(ACL) (ARR_DIMS(ACL)[0]) +#define ACL_DAT(ACL) ((AclItem *) ARR_DATA_PTR(ACL)) +#define ACL_N_SIZE(N) (ARR_OVERHEAD_NONULLS(1) + ((N) * sizeof(AclItem))) +#define ACL_SIZE(ACL) ARR_SIZE(ACL) + +/* + * fmgr macros for these types + */ +#define DatumGetAclItemP(X) ((AclItem *) DatumGetPointer(X)) +#define PG_GETARG_ACLITEM_P(n) DatumGetAclItemP(PG_GETARG_DATUM(n)) +#define PG_RETURN_ACLITEM_P(x) PG_RETURN_POINTER(x) + +#define DatumGetAclP(X) ((Acl *) PG_DETOAST_DATUM(X)) +#define DatumGetAclPCopy(X) ((Acl *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_ACL_P(n) DatumGetAclP(PG_GETARG_DATUM(n)) +#define PG_GETARG_ACL_P_COPY(n) DatumGetAclPCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_ACL_P(x) PG_RETURN_POINTER(x) + +/* + * ACL modification opcodes for aclupdate + */ +#define ACL_MODECHG_ADD 1 +#define ACL_MODECHG_DEL 2 +#define ACL_MODECHG_EQL 3 + +/* + * External representations of the privilege bits --- aclitemin/aclitemout + * represent each possible privilege bit with a distinct 1-character code + */ +#define ACL_INSERT_CHR 'a' /* formerly known as "append" */ +#define ACL_SELECT_CHR 'r' /* formerly known as "read" */ +#define ACL_UPDATE_CHR 'w' /* formerly known as "write" */ +#define ACL_DELETE_CHR 'd' +#define ACL_TRUNCATE_CHR 'D' /* super-delete, as it were */ +#define ACL_REFERENCES_CHR 'x' +#define ACL_TRIGGER_CHR 't' +#define ACL_EXECUTE_CHR 'X' +#define ACL_USAGE_CHR 'U' +#define ACL_CREATE_CHR 'C' +#define ACL_CREATE_TEMP_CHR 'T' +#define ACL_CONNECT_CHR 'c' +#define ACL_SET_CHR 's' +#define ACL_ALTER_SYSTEM_CHR 'A' +#define ACL_MAINTAIN_CHR 'm' + +/* string holding all privilege code chars, in order by bitmask position */ +#define ACL_ALL_RIGHTS_STR "arwdDxtXUCTcsAm" + +/* + * Bitmasks defining "all rights" for each supported object type + */ +#define ACL_ALL_RIGHTS_COLUMN (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_REFERENCES) +#define ACL_ALL_RIGHTS_RELATION (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_DELETE|ACL_TRUNCATE|ACL_REFERENCES|ACL_TRIGGER|ACL_MAINTAIN) +#define ACL_ALL_RIGHTS_SEQUENCE (ACL_USAGE|ACL_SELECT|ACL_UPDATE) +#define ACL_ALL_RIGHTS_DATABASE (ACL_CREATE|ACL_CREATE_TEMP|ACL_CONNECT) +#define ACL_ALL_RIGHTS_FDW (ACL_USAGE) +#define ACL_ALL_RIGHTS_FOREIGN_SERVER (ACL_USAGE) +#define ACL_ALL_RIGHTS_FUNCTION (ACL_EXECUTE) +#define ACL_ALL_RIGHTS_LANGUAGE (ACL_USAGE) +#define ACL_ALL_RIGHTS_LARGEOBJECT (ACL_SELECT|ACL_UPDATE) +#define ACL_ALL_RIGHTS_PARAMETER_ACL (ACL_SET|ACL_ALTER_SYSTEM) +#define ACL_ALL_RIGHTS_SCHEMA (ACL_USAGE|ACL_CREATE) +#define ACL_ALL_RIGHTS_TABLESPACE (ACL_CREATE) +#define ACL_ALL_RIGHTS_TYPE (ACL_USAGE) + +/* operation codes for pg_*_aclmask */ +typedef enum +{ + ACLMASK_ALL, /* normal case: compute all bits */ + ACLMASK_ANY, /* return when result is known nonzero */ +} AclMaskHow; + +/* result codes for pg_*_aclcheck */ +typedef enum +{ + ACLCHECK_OK = 0, + ACLCHECK_NO_PRIV, + ACLCHECK_NOT_OWNER, +} AclResult; + + +/* + * routines used internally + */ +extern Acl *acldefault(ObjectType objtype, Oid ownerId); +extern Acl *get_user_default_acl(ObjectType objtype, Oid ownerId, + Oid nsp_oid); +extern void recordDependencyOnNewAcl(Oid classId, Oid objectId, int32 objsubId, + Oid ownerId, Acl *acl); + +extern Acl *aclupdate(const Acl *old_acl, const AclItem *mod_aip, + int modechg, Oid ownerId, DropBehavior behavior); +extern Acl *aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId); +extern Acl *make_empty_acl(void); +extern Acl *aclcopy(const Acl *orig_acl); +extern Acl *aclconcat(const Acl *left_acl, const Acl *right_acl); +extern Acl *aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId); +extern void aclitemsort(Acl *acl); +extern bool aclequal(const Acl *left_acl, const Acl *right_acl); + +extern AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId, + AclMode mask, AclMaskHow how); +extern int aclmembers(const Acl *acl, Oid **roleids); + +extern bool has_privs_of_role(Oid member, Oid role); +extern bool member_can_set_role(Oid member, Oid role); +extern void check_can_set_role(Oid member, Oid role); +extern bool is_member_of_role(Oid member, Oid role); +extern bool is_member_of_role_nosuper(Oid member, Oid role); +extern bool is_admin_of_role(Oid member, Oid role); +extern Oid select_best_admin(Oid member, Oid role); +extern Oid get_role_oid(const char *rolname, bool missing_ok); +extern Oid get_role_oid_or_public(const char *rolname); +extern Oid get_rolespec_oid(const RoleSpec *role, bool missing_ok); +extern void check_rolespec_name(const RoleSpec *role, const char *detail_msg); +extern HeapTuple get_rolespec_tuple(const RoleSpec *role); +extern char *get_rolespec_name(const RoleSpec *role); + +extern void select_best_grantor(Oid roleId, AclMode privileges, + const Acl *acl, Oid ownerId, + Oid *grantorId, AclMode *grantOptions); + +extern void initialize_acl(void); + +/* + * prototypes for functions in aclchk.c + */ +extern void ExecuteGrantStmt(GrantStmt *stmt); +extern void ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *stmt); + +extern void RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid); + +extern AclMode pg_class_aclmask(Oid table_oid, Oid roleid, + AclMode mask, AclMaskHow how); + +/* generic functions */ +extern AclResult object_aclcheck(Oid classid, Oid objectid, + Oid roleid, AclMode mode); +extern AclResult object_aclcheck_ext(Oid classid, Oid objectid, + Oid roleid, AclMode mode, + bool *is_missing); + +/* special cases */ +extern AclResult pg_attribute_aclcheck(Oid table_oid, AttrNumber attnum, + Oid roleid, AclMode mode); +extern AclResult pg_attribute_aclcheck_ext(Oid table_oid, AttrNumber attnum, + Oid roleid, AclMode mode, + bool *is_missing); +extern AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, + AclMode mode, AclMaskHow how); +extern AclResult pg_attribute_aclcheck_all_ext(Oid table_oid, Oid roleid, + AclMode mode, AclMaskHow how, + bool *is_missing); +extern AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode); +extern AclResult pg_class_aclcheck_ext(Oid table_oid, Oid roleid, + AclMode mode, bool *is_missing); +extern AclResult pg_parameter_aclcheck(const char *name, Oid roleid, + AclMode mode); +extern AclResult pg_largeobject_aclcheck_snapshot(Oid lobj_oid, Oid roleid, + AclMode mode, Snapshot snapshot); + +extern void aclcheck_error(AclResult aclerr, ObjectType objtype, + const char *objectname); + +extern void aclcheck_error_col(AclResult aclerr, ObjectType objtype, + const char *objectname, const char *colname); + +extern void aclcheck_error_type(AclResult aclerr, Oid typeOid); + +extern void recordExtObjInitPriv(Oid objoid, Oid classoid); +extern void removeExtObjInitPriv(Oid objoid, Oid classoid); +extern void ReplaceRoleInInitPriv(Oid oldroleid, Oid newroleid, + Oid classid, Oid objid, int32 objsubid); +extern void RemoveRoleFromInitPriv(Oid roleid, + Oid classid, Oid objid, int32 objsubid); + + +/* ownercheck routines just return true (owner) or false (not) */ +extern bool object_ownercheck(Oid classid, Oid objectid, Oid roleid); +extern bool has_createrole_privilege(Oid roleid); +extern bool has_bypassrls_privilege(Oid roleid); + +#endif /* ACL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/aclchk_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/aclchk_internal.h new file mode 100644 index 0000000..62af290 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/aclchk_internal.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * aclchk_internal.h + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/aclchk_internal.h + * + *------------------------------------------------------------------------- + */ +#ifndef ACLCHK_INTERNAL_H +#define ACLCHK_INTERNAL_H + +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" + +/* + * The information about one Grant/Revoke statement, in internal format: object + * and grantees names have been turned into Oids, the privilege list is an + * AclMode bitmask. If 'privileges' is ACL_NO_RIGHTS (the 0 value) and + * all_privs is true, 'privileges' will be internally set to the right kind of + * ACL_ALL_RIGHTS_*, depending on the object type (NB - this will modify the + * InternalGrant struct!) + * + * Note: 'all_privs' and 'privileges' represent object-level privileges only. + * There might also be column-level privilege specifications, which are + * represented in col_privs (this is a list of untransformed AccessPriv nodes). + * Column privileges are only valid for objtype OBJECT_TABLE. + */ +typedef struct +{ + bool is_grant; + ObjectType objtype; + List *objects; + bool all_privs; + AclMode privileges; + List *col_privs; + List *grantees; + bool grant_option; + DropBehavior behavior; +} InternalGrant; + + +#endif /* ACLCHK_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/array.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/array.h new file mode 100644 index 0000000..52f1fbf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/array.h @@ -0,0 +1,481 @@ +/*------------------------------------------------------------------------- + * + * array.h + * Declarations for Postgres arrays. + * + * A standard varlena array has the following internal structure: + * - standard varlena header word + * - number of dimensions of the array + * - offset to stored data, or 0 if no nulls bitmap + * - element type OID + * - length of each array axis (C array of int) + * - lower boundary of each dimension (C array of int) + * - bitmap showing locations of nulls (OPTIONAL) + * - whatever is the stored data + * + * The and arrays each have ndim elements. + * + * The may be omitted if the array contains no NULL elements. + * If it is absent, the field is zero and the offset to the + * stored data must be computed on-the-fly. If the bitmap is present, + * is nonzero and is equal to the offset from the array start + * to the first data element (including any alignment padding). The bitmap + * follows the same conventions as tuple null bitmaps, ie, a 1 indicates + * a non-null entry and the LSB of each bitmap byte is used first. + * + * The actual data starts on a MAXALIGN boundary. Individual items in the + * array are aligned as specified by the array element type. They are + * stored in row-major order (last subscript varies most rapidly). + * + * NOTE: it is important that array elements of toastable datatypes NOT be + * toasted, since the tupletoaster won't know they are there. (We could + * support compressed toasted items; only out-of-line items are dangerous. + * However, it seems preferable to store such items uncompressed and allow + * the toaster to compress the whole array as one input.) + * + * + * The OIDVECTOR and INT2VECTOR datatypes are storage-compatible with + * generic arrays, but they support only one-dimensional arrays with no + * nulls (and no null bitmap). They don't support being toasted, either. + * + * There are also some "fixed-length array" datatypes, such as NAME and + * POINT. These are simply a sequence of a fixed number of items each + * of a fixed-length datatype, with no overhead; the item size must be + * a multiple of its alignment requirement, because we do no padding. + * We support subscripting on these types, but array_in() and array_out() + * only work with varlena arrays. + * + * In addition, arrays are a major user of the "expanded object" TOAST + * infrastructure. This allows a varlena array to be converted to a + * separate representation that may include "deconstructed" Datum/isnull + * arrays holding the elements. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/array.h + * + *------------------------------------------------------------------------- + */ +#ifndef ARRAY_H +#define ARRAY_H + +#include "fmgr.h" +#include "utils/expandeddatum.h" + +/* avoid including execnodes.h here */ +struct ExprState; +struct ExprContext; + + +/* + * Maximum number of array subscripts (arbitrary limit) + */ +#define MAXDIM 6 + +/* + * Maximum number of elements in an array. We limit this to at most about a + * quarter billion elements, so that it's not necessary to check for overflow + * in quite so many places --- for instance when palloc'ing Datum arrays. + */ +#define MaxArraySize ((Size) (MaxAllocSize / sizeof(Datum))) + +/* + * Arrays are varlena objects, so must meet the varlena convention that + * the first int32 of the object contains the total object size in bytes. + * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though! + * + * CAUTION: if you change the header for ordinary arrays you will also + * need to change the headers for oidvector and int2vector! + */ +typedef struct ArrayType +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int ndim; /* # of dimensions */ + int32 dataoffset; /* offset to data, or 0 if no bitmap */ + Oid elemtype; /* element type OID */ +} ArrayType; + +/* + * An expanded array is contained within a private memory context (as + * all expanded objects must be) and has a control structure as below. + * + * The expanded array might contain a regular "flat" array if that was the + * original input and we've not modified it significantly. Otherwise, the + * contents are represented by Datum/isnull arrays plus dimensionality and + * type information. We could also have both forms, if we've deconstructed + * the original array for access purposes but not yet changed it. For pass- + * by-reference element types, the Datums would point into the flat array in + * this situation. Once we start modifying array elements, new pass-by-ref + * elements are separately palloc'd within the memory context. + */ +#define EA_MAGIC 689375833 /* ID for debugging crosschecks */ + +typedef struct ExpandedArrayHeader +{ + /* Standard header for expanded objects */ + ExpandedObjectHeader hdr; + + /* Magic value identifying an expanded array (for debugging only) */ + int ea_magic; + + /* Dimensionality info (always valid) */ + int ndims; /* # of dimensions */ + int *dims; /* array dimensions */ + int *lbound; /* index lower bounds for each dimension */ + + /* Element type info (always valid) */ + Oid element_type; /* element type OID */ + int16 typlen; /* needed info about element datatype */ + bool typbyval; + char typalign; + + /* + * If we have a Datum-array representation of the array, it's kept here; + * else dvalues/dnulls are NULL. The dvalues and dnulls arrays are always + * palloc'd within the object private context, but may change size from + * time to time. For pass-by-ref element types, dvalues entries might + * point either into the fstartptr..fendptr area, or to separately + * palloc'd chunks. Elements should always be fully detoasted, as they + * are in the standard flat representation. + * + * Even when dvalues is valid, dnulls can be NULL if there are no null + * elements. + */ + Datum *dvalues; /* array of Datums */ + bool *dnulls; /* array of is-null flags for Datums */ + int dvalueslen; /* allocated length of above arrays */ + int nelems; /* number of valid entries in above arrays */ + + /* + * flat_size is the current space requirement for the flat equivalent of + * the expanded array, if known; otherwise it's 0. We store this to make + * consecutive calls of get_flat_size cheap. + */ + Size flat_size; + + /* + * fvalue points to the flat representation if it is valid, else it is + * NULL. If we have or ever had a flat representation then + * fstartptr/fendptr point to the start and end+1 of its data area; this + * is so that we can tell which Datum pointers point into the flat + * representation rather than being pointers to separately palloc'd data. + */ + ArrayType *fvalue; /* must be a fully detoasted array */ + char *fstartptr; /* start of its data area */ + char *fendptr; /* end+1 of its data area */ +} ExpandedArrayHeader; + +/* + * Functions that can handle either a "flat" varlena array or an expanded + * array use this union to work with their input. Don't refer to "flt"; + * instead, cast to ArrayType. This struct nominally requires 8-byte + * alignment on 64-bit, but it's often used for an ArrayType having 4-byte + * alignment. UBSan complains about referencing "flt" in such cases. + */ +typedef union AnyArrayType +{ + ArrayType flt; + ExpandedArrayHeader xpn; +} AnyArrayType; + +/* + * working state for accumArrayResult() and friends + * note that the input must be scalars (legal array elements) + */ +typedef struct ArrayBuildState +{ + MemoryContext mcontext; /* where all the temp stuff is kept */ + Datum *dvalues; /* array of accumulated Datums */ + bool *dnulls; /* array of is-null flags for Datums */ + int alen; /* allocated length of above arrays */ + int nelems; /* number of valid entries in above arrays */ + Oid element_type; /* data type of the Datums */ + int16 typlen; /* needed info about datatype */ + bool typbyval; + char typalign; + bool private_cxt; /* use private memory context */ +} ArrayBuildState; + +/* + * working state for accumArrayResultArr() and friends + * note that the input must be arrays, and the same array type is returned + */ +typedef struct ArrayBuildStateArr +{ + MemoryContext mcontext; /* where all the temp stuff is kept */ + char *data; /* accumulated data */ + bits8 *nullbitmap; /* bitmap of is-null flags, or NULL if none */ + int abytes; /* allocated length of "data" */ + int nbytes; /* number of bytes used so far */ + int aitems; /* allocated length of bitmap (in elements) */ + int nitems; /* total number of elements in result */ + int ndims; /* current dimensions of result */ + int dims[MAXDIM]; + int lbs[MAXDIM]; + Oid array_type; /* data type of the arrays */ + Oid element_type; /* data type of the array elements */ + bool private_cxt; /* use private memory context */ +} ArrayBuildStateArr; + +/* + * working state for accumArrayResultAny() and friends + * these functions handle both cases + */ +typedef struct ArrayBuildStateAny +{ + /* Exactly one of these is not NULL: */ + ArrayBuildState *scalarstate; + ArrayBuildStateArr *arraystate; +} ArrayBuildStateAny; + +/* + * structure to cache type metadata needed for array manipulation + */ +typedef struct ArrayMetaState +{ + Oid element_type; + int16 typlen; + bool typbyval; + char typalign; + char typdelim; + Oid typioparam; + Oid typiofunc; + FmgrInfo proc; +} ArrayMetaState; + +/* + * private state needed by array_map (here because caller must provide it) + */ +typedef struct ArrayMapState +{ + ArrayMetaState inp_extra; + ArrayMetaState ret_extra; +} ArrayMapState; + +/* ArrayIteratorData is private in arrayfuncs.c */ +typedef struct ArrayIteratorData *ArrayIterator; + +/* fmgr macros for regular varlena array objects */ +#define DatumGetArrayTypeP(X) ((ArrayType *) PG_DETOAST_DATUM(X)) +#define DatumGetArrayTypePCopy(X) ((ArrayType *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_ARRAYTYPE_P(n) DatumGetArrayTypeP(PG_GETARG_DATUM(n)) +#define PG_GETARG_ARRAYTYPE_P_COPY(n) DatumGetArrayTypePCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_ARRAYTYPE_P(x) PG_RETURN_POINTER(x) + +/* fmgr macros for expanded array objects */ +#define PG_GETARG_EXPANDED_ARRAY(n) DatumGetExpandedArray(PG_GETARG_DATUM(n)) +#define PG_GETARG_EXPANDED_ARRAYX(n, metacache) \ + DatumGetExpandedArrayX(PG_GETARG_DATUM(n), metacache) +#define PG_RETURN_EXPANDED_ARRAY(x) PG_RETURN_DATUM(EOHPGetRWDatum(&(x)->hdr)) + +/* fmgr macros for AnyArrayType (ie, get either varlena or expanded form) */ +#define PG_GETARG_ANY_ARRAY_P(n) DatumGetAnyArrayP(PG_GETARG_DATUM(n)) + +/* + * Access macros for varlena array header fields. + * + * ARR_DIMS returns a pointer to an array of array dimensions (number of + * elements along the various array axes). + * + * ARR_LBOUND returns a pointer to an array of array lower bounds. + * + * That is: if the third axis of an array has elements 5 through 8, then + * ARR_DIMS(a)[2] == 4 and ARR_LBOUND(a)[2] == 5. + * + * Unlike C, the default lower bound is 1. + */ +#define ARR_SIZE(a) VARSIZE(a) +#define ARR_NDIM(a) ((a)->ndim) +#define ARR_HASNULL(a) ((a)->dataoffset != 0) +#define ARR_ELEMTYPE(a) ((a)->elemtype) + +#define ARR_DIMS(a) \ + ((int *) (((char *) (a)) + sizeof(ArrayType))) +#define ARR_LBOUND(a) \ + ((int *) (((char *) (a)) + sizeof(ArrayType) + \ + sizeof(int) * ARR_NDIM(a))) + +#define ARR_NULLBITMAP(a) \ + (ARR_HASNULL(a) ? \ + (bits8 *) (((char *) (a)) + sizeof(ArrayType) + \ + 2 * sizeof(int) * ARR_NDIM(a)) \ + : (bits8 *) NULL) + +/* + * The total array header size (in bytes) for an array with the specified + * number of dimensions and total number of items. + */ +#define ARR_OVERHEAD_NONULLS(ndims) \ + MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims)) +#define ARR_OVERHEAD_WITHNULLS(ndims, nitems) \ + MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims) + \ + ((nitems) + 7) / 8) + +#define ARR_DATA_OFFSET(a) \ + (ARR_HASNULL(a) ? (a)->dataoffset : ARR_OVERHEAD_NONULLS(ARR_NDIM(a))) + +/* + * Returns a pointer to the actual array data. + */ +#define ARR_DATA_PTR(a) \ + (((char *) (a)) + ARR_DATA_OFFSET(a)) + +/* + * Macros for working with AnyArrayType inputs. Beware multiple references! + */ +#define AARR_NDIM(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + (a)->xpn.ndims : ARR_NDIM((ArrayType *) (a))) +#define AARR_HASNULL(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + ((a)->xpn.dvalues != NULL ? (a)->xpn.dnulls != NULL : ARR_HASNULL((a)->xpn.fvalue)) : \ + ARR_HASNULL((ArrayType *) (a))) +#define AARR_ELEMTYPE(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + (a)->xpn.element_type : ARR_ELEMTYPE((ArrayType *) (a))) +#define AARR_DIMS(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + (a)->xpn.dims : ARR_DIMS((ArrayType *) (a))) +#define AARR_LBOUND(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + (a)->xpn.lbound : ARR_LBOUND((ArrayType *) (a))) + + +/* + * GUC parameter + */ +extern PGDLLIMPORT bool Array_nulls; + +/* + * prototypes for functions defined in arrayfuncs.c + */ +extern void CopyArrayEls(ArrayType *array, + Datum *values, + bool *nulls, + int nitems, + int typlen, + bool typbyval, + char typalign, + bool freedata); + +extern Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx, + int arraytyplen, int elmlen, bool elmbyval, char elmalign, + bool *isNull); +extern Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx, + Datum dataValue, bool isNull, + int arraytyplen, int elmlen, bool elmbyval, char elmalign); +extern Datum array_get_slice(Datum arraydatum, int nSubscripts, + int *upperIndx, int *lowerIndx, + bool *upperProvided, bool *lowerProvided, + int arraytyplen, int elmlen, bool elmbyval, char elmalign); +extern Datum array_set_slice(Datum arraydatum, int nSubscripts, + int *upperIndx, int *lowerIndx, + bool *upperProvided, bool *lowerProvided, + Datum srcArrayDatum, bool isNull, + int arraytyplen, int elmlen, bool elmbyval, char elmalign); + +extern Datum array_ref(ArrayType *array, int nSubscripts, int *indx, + int arraytyplen, int elmlen, bool elmbyval, char elmalign, + bool *isNull); +extern ArrayType *array_set(ArrayType *array, int nSubscripts, int *indx, + Datum dataValue, bool isNull, + int arraytyplen, int elmlen, bool elmbyval, char elmalign); + +extern Datum array_map(Datum arrayd, + struct ExprState *exprstate, struct ExprContext *econtext, + Oid retType, ArrayMapState *amstate); + +extern void array_bitmap_copy(bits8 *destbitmap, int destoffset, + const bits8 *srcbitmap, int srcoffset, + int nitems); + +extern ArrayType *construct_array(Datum *elems, int nelems, + Oid elmtype, + int elmlen, bool elmbyval, char elmalign); +extern ArrayType *construct_array_builtin(Datum *elems, int nelems, Oid elmtype); +extern ArrayType *construct_md_array(Datum *elems, + bool *nulls, + int ndims, + int *dims, + int *lbs, + Oid elmtype, int elmlen, bool elmbyval, char elmalign); +extern ArrayType *construct_empty_array(Oid elmtype); +extern ExpandedArrayHeader *construct_empty_expanded_array(Oid element_type, + MemoryContext parentcontext, + ArrayMetaState *metacache); +extern void deconstruct_array(ArrayType *array, + Oid elmtype, + int elmlen, bool elmbyval, char elmalign, + Datum **elemsp, bool **nullsp, int *nelemsp); +extern void deconstruct_array_builtin(ArrayType *array, + Oid elmtype, + Datum **elemsp, bool **nullsp, int *nelemsp); +extern bool array_contains_nulls(ArrayType *array); + +extern ArrayBuildState *initArrayResult(Oid element_type, + MemoryContext rcontext, bool subcontext); +extern ArrayBuildState *initArrayResultWithSize(Oid element_type, + MemoryContext rcontext, + bool subcontext, int initsize); +extern ArrayBuildState *accumArrayResult(ArrayBuildState *astate, + Datum dvalue, bool disnull, + Oid element_type, + MemoryContext rcontext); +extern Datum makeArrayResult(ArrayBuildState *astate, + MemoryContext rcontext); +extern Datum makeMdArrayResult(ArrayBuildState *astate, int ndims, + int *dims, int *lbs, MemoryContext rcontext, bool release); + +extern ArrayBuildStateArr *initArrayResultArr(Oid array_type, Oid element_type, + MemoryContext rcontext, bool subcontext); +extern ArrayBuildStateArr *accumArrayResultArr(ArrayBuildStateArr *astate, + Datum dvalue, bool disnull, + Oid array_type, + MemoryContext rcontext); +extern Datum makeArrayResultArr(ArrayBuildStateArr *astate, + MemoryContext rcontext, bool release); + +extern ArrayBuildStateAny *initArrayResultAny(Oid input_type, + MemoryContext rcontext, bool subcontext); +extern ArrayBuildStateAny *accumArrayResultAny(ArrayBuildStateAny *astate, + Datum dvalue, bool disnull, + Oid input_type, + MemoryContext rcontext); +extern Datum makeArrayResultAny(ArrayBuildStateAny *astate, + MemoryContext rcontext, bool release); + +extern ArrayIterator array_create_iterator(ArrayType *arr, int slice_ndim, ArrayMetaState *mstate); +extern bool array_iterate(ArrayIterator iterator, Datum *value, bool *isnull); +extern void array_free_iterator(ArrayIterator iterator); + +/* + * prototypes for functions defined in arrayutils.c + */ + +extern int ArrayGetOffset(int n, const int *dim, const int *lb, const int *indx); +extern int ArrayGetNItems(int ndim, const int *dims); +extern int ArrayGetNItemsSafe(int ndim, const int *dims, + struct Node *escontext); +extern void ArrayCheckBounds(int ndim, const int *dims, const int *lb); +extern bool ArrayCheckBoundsSafe(int ndim, const int *dims, const int *lb, + struct Node *escontext); +extern void mda_get_range(int n, int *span, const int *st, const int *endp); +extern void mda_get_prod(int n, const int *range, int *prod); +extern void mda_get_offset_values(int n, int *dist, const int *prod, const int *span); +extern int mda_next_tuple(int n, int *curr, const int *span); +extern int32 *ArrayGetIntegerTypmods(ArrayType *arr, int *n); + +/* + * prototypes for functions defined in array_expanded.c + */ +extern Datum expand_array(Datum arraydatum, MemoryContext parentcontext, + ArrayMetaState *metacache); +extern ExpandedArrayHeader *DatumGetExpandedArray(Datum d); +extern ExpandedArrayHeader *DatumGetExpandedArrayX(Datum d, + ArrayMetaState *metacache); +extern AnyArrayType *DatumGetAnyArrayP(Datum d); +extern void deconstruct_expanded_array(ExpandedArrayHeader *eah); + +#endif /* ARRAY_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/arrayaccess.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/arrayaccess.h new file mode 100644 index 0000000..0e48ee0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/arrayaccess.h @@ -0,0 +1,118 @@ +/*------------------------------------------------------------------------- + * + * arrayaccess.h + * Declarations for element-by-element access to Postgres arrays. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/arrayaccess.h + * + *------------------------------------------------------------------------- + */ +#ifndef ARRAYACCESS_H +#define ARRAYACCESS_H + +#include "access/tupmacs.h" +#include "utils/array.h" + + +/* + * Functions for iterating through elements of a flat or expanded array. + * These require a state struct "array_iter iter". + * + * Use "array_iter_setup(&iter, arrayptr);" to prepare to iterate, and + * "datumvar = array_iter_next(&iter, &isnullvar, index, ...);" to fetch + * the next element into datumvar/isnullvar. + * "index" must be the zero-origin element number; we make caller provide + * this since caller is generally counting the elements anyway. Despite + * that, these functions can only fetch elements sequentially. + */ + +typedef struct array_iter +{ + /* datumptr being NULL or not tells if we have flat or expanded array */ + + /* Fields used when we have an expanded array */ + Datum *datumptr; /* Pointer to Datum array */ + bool *isnullptr; /* Pointer to isnull array */ + + /* Fields used when we have a flat array */ + char *dataptr; /* Current spot in the data area */ + bits8 *bitmapptr; /* Current byte of the nulls bitmap, or NULL */ + int bitmask; /* mask for current bit in nulls bitmap */ +} array_iter; + + +static inline void +array_iter_setup(array_iter *it, AnyArrayType *a) +{ + if (VARATT_IS_EXPANDED_HEADER(a)) + { + if (a->xpn.dvalues) + { + it->datumptr = a->xpn.dvalues; + it->isnullptr = a->xpn.dnulls; + /* we must fill all fields to prevent compiler warnings */ + it->dataptr = NULL; + it->bitmapptr = NULL; + } + else + { + /* Work with flat array embedded in the expanded datum */ + it->datumptr = NULL; + it->isnullptr = NULL; + it->dataptr = ARR_DATA_PTR(a->xpn.fvalue); + it->bitmapptr = ARR_NULLBITMAP(a->xpn.fvalue); + } + } + else + { + it->datumptr = NULL; + it->isnullptr = NULL; + it->dataptr = ARR_DATA_PTR((ArrayType *) a); + it->bitmapptr = ARR_NULLBITMAP((ArrayType *) a); + } + it->bitmask = 1; +} + +static inline Datum +array_iter_next(array_iter *it, bool *isnull, int i, + int elmlen, bool elmbyval, char elmalign) +{ + Datum ret; + + if (it->datumptr) + { + ret = it->datumptr[i]; + *isnull = it->isnullptr ? it->isnullptr[i] : false; + } + else + { + if (it->bitmapptr && (*(it->bitmapptr) & it->bitmask) == 0) + { + *isnull = true; + ret = (Datum) 0; + } + else + { + *isnull = false; + ret = fetch_att(it->dataptr, elmbyval, elmlen); + it->dataptr = att_addlength_pointer(it->dataptr, elmlen, + it->dataptr); + it->dataptr = (char *) att_align_nominal(it->dataptr, elmalign); + } + it->bitmask <<= 1; + if (it->bitmask == 0x100) + { + if (it->bitmapptr) + it->bitmapptr++; + it->bitmask = 1; + } + } + + return ret; +} + +#endif /* ARRAYACCESS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/ascii.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/ascii.h new file mode 100644 index 0000000..02d45d5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/ascii.h @@ -0,0 +1,84 @@ +/*----------------------------------------------------------------------- + * ascii.h + * + * Portions Copyright (c) 1999-2025, PostgreSQL Global Development Group + * + * src/include/utils/ascii.h + * + *----------------------------------------------------------------------- + */ + +#ifndef _ASCII_H_ +#define _ASCII_H_ + +#include "port/simd.h" + +extern void ascii_safe_strlcpy(char *dest, const char *src, size_t destsiz); + +/* + * Verify a chunk of bytes for valid ASCII. + * + * Returns false if the input contains any zero bytes or bytes with the + * high-bit set. Input len must be a multiple of the chunk size (8 or 16). + */ +static inline bool +is_valid_ascii(const unsigned char *s, int len) +{ + const unsigned char *const s_end = s + len; + Vector8 chunk; + Vector8 highbit_cum = vector8_broadcast(0); +#ifdef USE_NO_SIMD + Vector8 zero_cum = vector8_broadcast(0x80); +#endif + + Assert(len % sizeof(chunk) == 0); + + while (s < s_end) + { + vector8_load(&chunk, s); + + /* Capture any zero bytes in this chunk. */ +#ifdef USE_NO_SIMD + + /* + * First, add 0x7f to each byte. This sets the high bit in each byte, + * unless it was a zero. If any resulting high bits are zero, the + * corresponding high bits in the zero accumulator will be cleared. + * + * If none of the bytes in the chunk had the high bit set, the max + * value each byte can have after the addition is 0x7f + 0x7f = 0xfe, + * and we don't need to worry about carrying over to the next byte. If + * any input bytes did have the high bit set, it doesn't matter + * because we check for those separately. + */ + zero_cum &= (chunk + vector8_broadcast(0x7F)); +#else + + /* + * Set all bits in each lane of the highbit accumulator where input + * bytes are zero. + */ + highbit_cum = vector8_or(highbit_cum, + vector8_eq(chunk, vector8_broadcast(0))); +#endif + + /* Capture all set bits in this chunk. */ + highbit_cum = vector8_or(highbit_cum, chunk); + + s += sizeof(chunk); + } + + /* Check if any high bits in the high bit accumulator got set. */ + if (vector8_is_highbit_set(highbit_cum)) + return false; + +#ifdef USE_NO_SIMD + /* Check if any high bits in the zero accumulator got cleared. */ + if (zero_cum != vector8_broadcast(0x80)) + return false; +#endif + + return true; +} + +#endif /* _ASCII_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/attoptcache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/attoptcache.h new file mode 100644 index 0000000..f684a77 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/attoptcache.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * attoptcache.h + * Attribute options cache. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/attoptcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef ATTOPTCACHE_H +#define ATTOPTCACHE_H + +/* + * Attribute options. + */ +typedef struct AttributeOpts +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + float8 n_distinct; + float8 n_distinct_inherited; +} AttributeOpts; + +extern AttributeOpts *get_attribute_options(Oid attrelid, int attnum); + +#endif /* ATTOPTCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/backend_progress.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/backend_progress.h new file mode 100644 index 0000000..dda813a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/backend_progress.h @@ -0,0 +1,46 @@ +/* ---------- + * backend_progress.h + * Command progress reporting definition. + * + * Note that this file provides the infrastructure for storing a single + * backend's command progress counters, without ascribing meaning to the + * individual fields. See commands/progress.h and system_views.sql for that. + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/utils/backend_progress.h + * ---------- + */ +#ifndef BACKEND_PROGRESS_H +#define BACKEND_PROGRESS_H + + +/* ---------- + * Command type for progress reporting purposes + * ---------- + */ +typedef enum ProgressCommandType +{ + PROGRESS_COMMAND_INVALID, + PROGRESS_COMMAND_VACUUM, + PROGRESS_COMMAND_ANALYZE, + PROGRESS_COMMAND_CLUSTER, + PROGRESS_COMMAND_CREATE_INDEX, + PROGRESS_COMMAND_BASEBACKUP, + PROGRESS_COMMAND_COPY, +} ProgressCommandType; + +#define PGSTAT_NUM_PROGRESS_PARAM 20 + + +extern void pgstat_progress_start_command(ProgressCommandType cmdtype, + Oid relid); +extern void pgstat_progress_update_param(int index, int64 val); +extern void pgstat_progress_incr_param(int index, int64 incr); +extern void pgstat_progress_parallel_incr_param(int index, int64 incr); +extern void pgstat_progress_update_multi_param(int nparam, const int *index, + const int64 *val); +extern void pgstat_progress_end_command(void); + + +#endif /* BACKEND_PROGRESS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/backend_status.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/backend_status.h new file mode 100644 index 0000000..3016501 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/backend_status.h @@ -0,0 +1,349 @@ +/* ---------- + * backend_status.h + * Definitions related to backend status reporting + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/utils/backend_status.h + * ---------- + */ +#ifndef BACKEND_STATUS_H +#define BACKEND_STATUS_H + +#include "datatype/timestamp.h" +#include "libpq/pqcomm.h" +#include "miscadmin.h" /* for BackendType */ +#include "storage/procnumber.h" +#include "utils/backend_progress.h" + + +/* ---------- + * Backend states + * ---------- + */ +typedef enum BackendState +{ + STATE_UNDEFINED, + STATE_STARTING, + STATE_IDLE, + STATE_RUNNING, + STATE_IDLEINTRANSACTION, + STATE_FASTPATH, + STATE_IDLEINTRANSACTION_ABORTED, + STATE_DISABLED, +} BackendState; + + +/* ---------- + * Shared-memory data structures + * ---------- + */ + +/* + * PgBackendSSLStatus + * + * For each backend, we keep the SSL status in a separate struct, that + * is only filled in if SSL is enabled. + * + * All char arrays must be null-terminated. + */ +typedef struct PgBackendSSLStatus +{ + /* Information about SSL connection */ + int ssl_bits; + char ssl_version[NAMEDATALEN]; + char ssl_cipher[NAMEDATALEN]; + char ssl_client_dn[NAMEDATALEN]; + + /* + * serial number is max "20 octets" per RFC 5280, so this size should be + * fine + */ + char ssl_client_serial[NAMEDATALEN]; + + char ssl_issuer_dn[NAMEDATALEN]; +} PgBackendSSLStatus; + +/* + * PgBackendGSSStatus + * + * For each backend, we keep the GSS status in a separate struct, that + * is only filled in if GSS is enabled. + * + * All char arrays must be null-terminated. + */ +typedef struct PgBackendGSSStatus +{ + /* Information about GSSAPI connection */ + char gss_princ[NAMEDATALEN]; /* GSSAPI Principal used to auth */ + bool gss_auth; /* If GSSAPI authentication was used */ + bool gss_enc; /* If encryption is being used */ + bool gss_delegation; /* If credentials delegated */ + +} PgBackendGSSStatus; + + +/* ---------- + * PgBackendStatus + * + * Each live backend maintains a PgBackendStatus struct in shared memory + * showing its current activity. (The structs are allocated according to + * ProcNumber, but that is not critical.) Note that this is unrelated to the + * cumulative stats system (i.e. pgstat.c et al). + * + * Each auxiliary process also maintains a PgBackendStatus struct in shared + * memory. + * ---------- + */ +typedef struct PgBackendStatus +{ + /* + * To avoid locking overhead, we use the following protocol: a backend + * increments st_changecount before modifying its entry, and again after + * finishing a modification. A would-be reader should note the value of + * st_changecount, copy the entry into private memory, then check + * st_changecount again. If the value hasn't changed, and if it's even, + * the copy is valid; otherwise start over. This makes updates cheap + * while reads are potentially expensive, but that's the tradeoff we want. + * + * The above protocol needs memory barriers to ensure that the apparent + * order of execution is as it desires. Otherwise, for example, the CPU + * might rearrange the code so that st_changecount is incremented twice + * before the modification on a machine with weak memory ordering. Hence, + * use the macros defined below for manipulating st_changecount, rather + * than touching it directly. + */ + int st_changecount; + + /* The entry is valid iff st_procpid > 0, unused if st_procpid == 0 */ + int st_procpid; + + /* Type of backends */ + BackendType st_backendType; + + /* Times when current backend, transaction, and activity started */ + TimestampTz st_proc_start_timestamp; + TimestampTz st_xact_start_timestamp; + TimestampTz st_activity_start_timestamp; + TimestampTz st_state_start_timestamp; + + /* Database OID, owning user's OID, connection client address */ + Oid st_databaseid; + Oid st_userid; + SockAddr st_clientaddr; + char *st_clienthostname; /* MUST be null-terminated */ + + /* Information about SSL connection */ + bool st_ssl; + PgBackendSSLStatus *st_sslstatus; + + /* Information about GSSAPI connection */ + bool st_gss; + PgBackendGSSStatus *st_gssstatus; + + /* current state */ + BackendState st_state; + + /* application name; MUST be null-terminated */ + char *st_appname; + + /* + * Current command string; MUST be null-terminated. Note that this string + * possibly is truncated in the middle of a multi-byte character. As + * activity strings are stored more frequently than read, that allows to + * move the cost of correct truncation to the display side. Use + * pgstat_clip_activity() to truncate correctly. + */ + char *st_activity_raw; + + /* + * Command progress reporting. Any command which wishes can advertise + * that it is running by setting st_progress_command, + * st_progress_command_target, and st_progress_param[]. + * st_progress_command_target should be the OID of the relation which the + * command targets (we assume there's just one, as this is meant for + * utility commands), but the meaning of each element in the + * st_progress_param array is command-specific. + */ + ProgressCommandType st_progress_command; + Oid st_progress_command_target; + int64 st_progress_param[PGSTAT_NUM_PROGRESS_PARAM]; + + /* query identifier, optionally computed using post_parse_analyze_hook */ + int64 st_query_id; + + /* plan identifier, optionally computed using planner_hook */ + int64 st_plan_id; +} PgBackendStatus; + + +/* + * Macros to load and store st_changecount with appropriate memory barriers. + * + * Use PGSTAT_BEGIN_WRITE_ACTIVITY() before, and PGSTAT_END_WRITE_ACTIVITY() + * after, modifying the current process's PgBackendStatus data. Note that, + * since there is no mechanism for cleaning up st_changecount after an error, + * THESE MACROS FORM A CRITICAL SECTION. Any error between them will be + * promoted to PANIC, causing a database restart to clean up shared memory! + * Hence, keep the critical section as short and straight-line as possible. + * Aside from being safer, that minimizes the window in which readers will + * have to loop. + * + * Reader logic should follow this sketch: + * + * for (;;) + * { + * int before_ct, after_ct; + * + * pgstat_begin_read_activity(beentry, before_ct); + * ... copy beentry data to local memory ... + * pgstat_end_read_activity(beentry, after_ct); + * if (pgstat_read_activity_complete(before_ct, after_ct)) + * break; + * CHECK_FOR_INTERRUPTS(); + * } + * + * For extra safety, we generally use volatile beentry pointers, although + * the memory barriers should theoretically be sufficient. + */ +#define PGSTAT_BEGIN_WRITE_ACTIVITY(beentry) \ + do { \ + START_CRIT_SECTION(); \ + (beentry)->st_changecount++; \ + pg_write_barrier(); \ + } while (0) + +#define PGSTAT_END_WRITE_ACTIVITY(beentry) \ + do { \ + pg_write_barrier(); \ + (beentry)->st_changecount++; \ + Assert(((beentry)->st_changecount & 1) == 0); \ + END_CRIT_SECTION(); \ + } while (0) + +#define pgstat_begin_read_activity(beentry, before_changecount) \ + do { \ + (before_changecount) = (beentry)->st_changecount; \ + pg_read_barrier(); \ + } while (0) + +#define pgstat_end_read_activity(beentry, after_changecount) \ + do { \ + pg_read_barrier(); \ + (after_changecount) = (beentry)->st_changecount; \ + } while (0) + +#define pgstat_read_activity_complete(before_changecount, after_changecount) \ + ((before_changecount) == (after_changecount) && \ + ((before_changecount) & 1) == 0) + + +/* ---------- + * LocalPgBackendStatus + * + * When we build the backend status array, we use LocalPgBackendStatus to be + * able to add new values to the struct when needed without adding new fields + * to the shared memory. It contains the backend status as a first member. + * ---------- + */ +typedef struct LocalPgBackendStatus +{ + /* + * Local version of the backend status entry. + */ + PgBackendStatus backendStatus; + + /* + * The proc number. + */ + ProcNumber proc_number; + + /* + * The xid of the current transaction if available, InvalidTransactionId + * if not. + */ + TransactionId backend_xid; + + /* + * The xmin of the current session if available, InvalidTransactionId if + * not. + */ + TransactionId backend_xmin; + + /* + * Number of cached subtransactions in the current session. + */ + int backend_subxact_count; + + /* + * The number of subtransactions in the current session which exceeded the + * cached subtransaction limit. + */ + bool backend_subxact_overflowed; +} LocalPgBackendStatus; + + +/* ---------- + * GUC parameters + * ---------- + */ +extern PGDLLIMPORT bool pgstat_track_activities; +extern PGDLLIMPORT int pgstat_track_activity_query_size; + + +/* ---------- + * Other global variables + * ---------- + */ +extern PGDLLIMPORT PgBackendStatus *MyBEEntry; + + +/* ---------- + * Functions called from postmaster + * ---------- + */ +extern Size BackendStatusShmemSize(void); +extern void BackendStatusShmemInit(void); + + +/* ---------- + * Functions called from backends + * ---------- + */ + +/* Initialization functions */ +extern void pgstat_beinit(void); +extern void pgstat_bestart_initial(void); +extern void pgstat_bestart_security(void); +extern void pgstat_bestart_final(void); + +extern void pgstat_clear_backend_activity_snapshot(void); + +/* Activity reporting functions */ +extern void pgstat_report_activity(BackendState state, const char *cmd_str); +extern void pgstat_report_query_id(int64 query_id, bool force); +extern void pgstat_report_plan_id(int64 plan_id, bool force); +extern void pgstat_report_tempfile(size_t filesize); +extern void pgstat_report_appname(const char *appname); +extern void pgstat_report_xact_timestamp(TimestampTz tstamp); +extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser); +extern const char *pgstat_get_crashed_backend_activity(int pid, char *buffer, + int buflen); +extern int64 pgstat_get_my_query_id(void); +extern int64 pgstat_get_my_plan_id(void); +extern BackendType pgstat_get_backend_type_by_proc_number(ProcNumber procNumber); + + +/* ---------- + * Support functions for the SQL-callable functions to + * generate the pgstat* views. + * ---------- + */ +extern int pgstat_fetch_stat_numbackends(void); +extern PgBackendStatus *pgstat_get_beentry_by_proc_number(ProcNumber procNumber); +extern LocalPgBackendStatus *pgstat_get_local_beentry_by_proc_number(ProcNumber procNumber); +extern LocalPgBackendStatus *pgstat_get_local_beentry_by_index(int idx); +extern char *pgstat_clip_activity(const char *raw_activity); + + +#endif /* BACKEND_STATUS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/builtins.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/builtins.h new file mode 100644 index 0000000..64b3f53 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/builtins.h @@ -0,0 +1,140 @@ +/*------------------------------------------------------------------------- + * + * builtins.h + * Declarations for operations on built-in types. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/builtins.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUILTINS_H +#define BUILTINS_H + +#include "fmgr.h" +#include "nodes/nodes.h" +#include "utils/fmgrprotos.h" + +/* Sign + the most decimal digits an 8-byte number could have */ +#define MAXINT8LEN 20 + +/* bool.c */ +extern bool parse_bool(const char *value, bool *result); +extern bool parse_bool_with_len(const char *value, size_t len, bool *result); + +/* domains.c */ +extern void domain_check(Datum value, bool isnull, Oid domainType, + void **extra, MemoryContext mcxt); +extern bool domain_check_safe(Datum value, bool isnull, Oid domainType, + void **extra, MemoryContext mcxt, + Node *escontext); +extern int errdatatype(Oid datatypeOid); +extern int errdomainconstraint(Oid datatypeOid, const char *conname); + +/* encode.c */ +extern uint64 hex_encode(const char *src, size_t len, char *dst); +extern uint64 hex_decode(const char *src, size_t len, char *dst); +extern uint64 hex_decode_safe(const char *src, size_t len, char *dst, + Node *escontext); + +/* int.c */ +extern int2vector *buildint2vector(const int16 *int2s, int n); + +/* name.c */ +extern void namestrcpy(Name name, const char *str); +extern int namestrcmp(Name name, const char *str); + +/* numutils.c */ +extern int16 pg_strtoint16(const char *s); +extern int16 pg_strtoint16_safe(const char *s, Node *escontext); +extern int32 pg_strtoint32(const char *s); +extern int32 pg_strtoint32_safe(const char *s, Node *escontext); +extern int64 pg_strtoint64(const char *s); +extern int64 pg_strtoint64_safe(const char *s, Node *escontext); +extern uint32 uint32in_subr(const char *s, char **endloc, + const char *typname, Node *escontext); +extern uint64 uint64in_subr(const char *s, char **endloc, + const char *typname, Node *escontext); +extern int pg_itoa(int16 i, char *a); +extern int pg_ultoa_n(uint32 value, char *a); +extern int pg_ulltoa_n(uint64 value, char *a); +extern int pg_ltoa(int32 value, char *a); +extern int pg_lltoa(int64 value, char *a); +extern char *pg_ultostr_zeropad(char *str, uint32 value, int32 minwidth); +extern char *pg_ultostr(char *str, uint32 value); + +/* oid.c */ +extern oidvector *buildoidvector(const Oid *oids, int n); +extern void check_valid_oidvector(const oidvector *oidArray); +extern Oid oidparse(Node *node); +extern int oid_cmp(const void *p1, const void *p2); + +/* regexp.c */ +extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive, + Oid collation, bool *exact); + +/* ruleutils.c */ +extern PGDLLIMPORT bool quote_all_identifiers; +extern const char *quote_identifier(const char *ident); +extern char *quote_qualified_identifier(const char *qualifier, + const char *ident); +extern void generate_operator_clause(fmStringInfo buf, + const char *leftop, Oid leftoptype, + Oid opoid, + const char *rightop, Oid rightoptype); + +/* varchar.c */ +extern int bpchartruelen(char *s, int len); + +/* popular functions from varlena.c */ +extern text *cstring_to_text(const char *s); +extern text *cstring_to_text_with_len(const char *s, int len); +extern char *text_to_cstring(const text *t); +extern void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len); + +#define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s)) +#define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d)) + +/* xid.c */ +extern int xidComparator(const void *arg1, const void *arg2); +extern int xidLogicalComparator(const void *arg1, const void *arg2); + +/* inet_cidr_ntop.c */ +extern char *pg_inet_cidr_ntop(int af, const void *src, int bits, + char *dst, size_t size); + +/* inet_net_pton.c */ +extern int pg_inet_net_pton(int af, const char *src, + void *dst, size_t size); + +/* network.c */ +extern double convert_network_to_scalar(Datum value, Oid typid, bool *failure); +extern Datum network_scan_first(Datum in); +extern Datum network_scan_last(Datum in); +extern void clean_ipv6_addr(int addr_family, char *addr); + +/* numeric.c */ +extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS); + +/* format_type.c */ + +/* Control flags for format_type_extended */ +#define FORMAT_TYPE_TYPEMOD_GIVEN 0x01 /* typemod defined by caller */ +#define FORMAT_TYPE_ALLOW_INVALID 0x02 /* allow invalid types */ +#define FORMAT_TYPE_FORCE_QUALIFY 0x04 /* force qualification of type */ +#define FORMAT_TYPE_INVALID_AS_NULL 0x08 /* NULL if undefined */ +extern char *format_type_extended(Oid type_oid, int32 typemod, bits16 flags); + +extern char *format_type_be(Oid type_oid); +extern char *format_type_be_qualified(Oid type_oid); +extern char *format_type_with_typemod(Oid type_oid, int32 typemod); + +extern int32 type_maximum_size(Oid type_oid, int32 typemod); + +/* quote.c */ +extern char *quote_literal_cstr(const char *rawstr); + +#endif /* BUILTINS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/bytea.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/bytea.h new file mode 100644 index 0000000..7b31fc8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/bytea.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * bytea.h + * Declarations for BYTEA data type support. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/bytea.h + * + *------------------------------------------------------------------------- + */ +#ifndef BYTEA_H +#define BYTEA_H + + + +typedef enum +{ + BYTEA_OUTPUT_ESCAPE, + BYTEA_OUTPUT_HEX, +} ByteaOutputType; + +extern PGDLLIMPORT int bytea_output; /* ByteaOutputType, but int for GUC + * enum */ + +#endif /* BYTEA_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/cash.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/cash.h new file mode 100644 index 0000000..55d45fa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/cash.h @@ -0,0 +1,35 @@ +/* + * src/include/utils/cash.h + * + * + * cash.h + * Written by D'Arcy J.M. Cain + * + * Functions to allow input and output of money normally but store + * and handle it as 64 bit integer. + */ + +#ifndef CASH_H +#define CASH_H + +#include "fmgr.h" + +typedef int64 Cash; + +/* Cash is pass-by-reference if and only if int64 is */ +static inline Cash +DatumGetCash(Datum X) +{ + return DatumGetInt64(X); +} + +static inline Datum +CashGetDatum(Cash X) +{ + return Int64GetDatum(X); +} + +#define PG_GETARG_CASH(n) DatumGetCash(PG_GETARG_DATUM(n)) +#define PG_RETURN_CASH(x) return CashGetDatum(x) + +#endif /* CASH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/catcache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/catcache.h new file mode 100644 index 0000000..277ec33 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/catcache.h @@ -0,0 +1,232 @@ +/*------------------------------------------------------------------------- + * + * catcache.h + * Low-level catalog cache definitions. + * + * NOTE: every catalog cache must have a corresponding unique index on + * the system table that it caches --- ie, the index must match the keys + * used to do lookups in this cache. All cache fetches are done with + * indexscans (under normal conditions). The index should be unique to + * guarantee that there can only be one matching row for a key combination. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/catcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef CATCACHE_H +#define CATCACHE_H + +#include "access/htup.h" +#include "access/skey.h" +#include "lib/ilist.h" +#include "utils/relcache.h" + +/* + * struct catctup: individual tuple in the cache. + * struct catclist: list of tuples matching a partial key. + * struct catcache: information for managing a cache. + * struct catcacheheader: information for managing all the caches. + */ + +#define CATCACHE_MAXKEYS 4 + + +/* function computing a datum's hash */ +typedef uint32 (*CCHashFN) (Datum datum); + +/* function computing equality of two datums */ +typedef bool (*CCFastEqualFN) (Datum a, Datum b); + +typedef struct catcache +{ + int id; /* cache identifier --- see syscache.h */ + int cc_nbuckets; /* # of hash buckets in this cache */ + TupleDesc cc_tupdesc; /* tuple descriptor (copied from reldesc) */ + dlist_head *cc_bucket; /* hash buckets */ + CCHashFN cc_hashfunc[CATCACHE_MAXKEYS]; /* hash function for each key */ + CCFastEqualFN cc_fastequal[CATCACHE_MAXKEYS]; /* fast equal function for + * each key */ + int cc_keyno[CATCACHE_MAXKEYS]; /* AttrNumber of each key */ + int cc_nkeys; /* # of keys (1..CATCACHE_MAXKEYS) */ + int cc_ntup; /* # of tuples currently in this cache */ + int cc_nlist; /* # of CatCLists currently in this cache */ + int cc_nlbuckets; /* # of CatCList hash buckets in this cache */ + dlist_head *cc_lbucket; /* hash buckets for CatCLists */ + const char *cc_relname; /* name of relation the tuples come from */ + Oid cc_reloid; /* OID of relation the tuples come from */ + Oid cc_indexoid; /* OID of index matching cache keys */ + bool cc_relisshared; /* is relation shared across databases? */ + slist_node cc_next; /* list link */ + ScanKeyData cc_skey[CATCACHE_MAXKEYS]; /* precomputed key info for heap + * scans */ + + /* + * Keep these at the end, so that compiling catcache.c with CATCACHE_STATS + * doesn't break ABI for other modules + */ +#ifdef CATCACHE_STATS + long cc_searches; /* total # searches against this cache */ + long cc_hits; /* # of matches against existing entry */ + long cc_neg_hits; /* # of matches against negative entry */ + long cc_newloads; /* # of successful loads of new entry */ + + /* + * cc_searches - (cc_hits + cc_neg_hits + cc_newloads) is number of failed + * searches, each of which will result in loading a negative entry + */ + long cc_invals; /* # of entries invalidated from cache */ + long cc_lsearches; /* total # list-searches */ + long cc_lhits; /* # of matches against existing lists */ +#endif +} CatCache; + + +typedef struct catctup +{ + int ct_magic; /* for identifying CatCTup entries */ +#define CT_MAGIC 0x57261502 + + uint32 hash_value; /* hash value for this tuple's keys */ + + /* + * Lookup keys for the entry. By-reference datums point into the tuple for + * positive cache entries, and are separately allocated for negative ones. + */ + Datum keys[CATCACHE_MAXKEYS]; + + /* + * Each tuple in a cache is a member of a dlist that stores the elements + * of its hash bucket. We keep each dlist in LRU order to speed repeated + * lookups. + */ + dlist_node cache_elem; /* list member of per-bucket list */ + + /* + * A tuple marked "dead" must not be returned by subsequent searches. + * However, it won't be physically deleted from the cache until its + * refcount goes to zero. (If it's a member of a CatCList, the list's + * refcount must go to zero, too; also, remember to mark the list dead at + * the same time the tuple is marked.) + * + * A negative cache entry is an assertion that there is no tuple matching + * a particular key. This is just as useful as a normal entry so far as + * avoiding catalog searches is concerned. Management of positive and + * negative entries is identical. + */ + int refcount; /* number of active references */ + bool dead; /* dead but not yet removed? */ + bool negative; /* negative cache entry? */ + HeapTupleData tuple; /* tuple management header */ + + /* + * The tuple may also be a member of at most one CatCList. (If a single + * catcache is list-searched with varying numbers of keys, we may have to + * make multiple entries for the same tuple because of this restriction. + * Currently, that's not expected to be common, so we accept the potential + * inefficiency.) + */ + struct catclist *c_list; /* containing CatCList, or NULL if none */ + + CatCache *my_cache; /* link to owning catcache */ + /* properly aligned tuple data follows, unless a negative entry */ +} CatCTup; + + +/* + * A CatCList describes the result of a partial search, ie, a search using + * only the first K key columns of an N-key cache. We store the keys used + * into the keys attribute to represent the stored key set. The CatCList + * object contains links to cache entries for all the table rows satisfying + * the partial key. (Note: none of these will be negative cache entries.) + * + * A CatCList is only a member of a per-cache list; we do not currently + * divide them into hash buckets. + * + * A list marked "dead" must not be returned by subsequent searches. + * However, it won't be physically deleted from the cache until its + * refcount goes to zero. (A list should be marked dead if any of its + * member entries are dead.) + * + * If "ordered" is true then the member tuples appear in the order of the + * cache's underlying index. This will be true in normal operation, but + * might not be true during bootstrap or recovery operations. (namespace.c + * is able to save some cycles when it is true.) + */ +typedef struct catclist +{ + int cl_magic; /* for identifying CatCList entries */ +#define CL_MAGIC 0x52765103 + + uint32 hash_value; /* hash value for lookup keys */ + + dlist_node cache_elem; /* list member of per-catcache list */ + + /* + * Lookup keys for the entry, with the first nkeys elements being valid. + * All by-reference are separately allocated. + */ + Datum keys[CATCACHE_MAXKEYS]; + + int refcount; /* number of active references */ + bool dead; /* dead but not yet removed? */ + bool ordered; /* members listed in index order? */ + short nkeys; /* number of lookup keys specified */ + int n_members; /* number of member tuples */ + CatCache *my_cache; /* link to owning catcache */ + CatCTup *members[FLEXIBLE_ARRAY_MEMBER]; /* members */ +} CatCList; + + +typedef struct catcacheheader +{ + slist_head ch_caches; /* head of list of CatCache structs */ + int ch_ntup; /* # of tuples in all caches */ +} CatCacheHeader; + + +/* this extern duplicates utils/memutils.h... */ +extern PGDLLIMPORT MemoryContext CacheMemoryContext; + +extern void CreateCacheMemoryContext(void); + +extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid, + int nkeys, const int *key, + int nbuckets); +extern void InitCatCachePhase2(CatCache *cache, bool touch_index); + +extern HeapTuple SearchCatCache(CatCache *cache, + Datum v1, Datum v2, Datum v3, Datum v4); +extern HeapTuple SearchCatCache1(CatCache *cache, + Datum v1); +extern HeapTuple SearchCatCache2(CatCache *cache, + Datum v1, Datum v2); +extern HeapTuple SearchCatCache3(CatCache *cache, + Datum v1, Datum v2, Datum v3); +extern HeapTuple SearchCatCache4(CatCache *cache, + Datum v1, Datum v2, Datum v3, Datum v4); +extern void ReleaseCatCache(HeapTuple tuple); + +extern uint32 GetCatCacheHashValue(CatCache *cache, + Datum v1, Datum v2, + Datum v3, Datum v4); + +extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys, + Datum v1, Datum v2, + Datum v3); +extern void ReleaseCatCacheList(CatCList *list); + +extern void ResetCatalogCaches(void); +extern void ResetCatalogCachesExt(bool debug_discard); +extern void CatalogCacheFlushCatalog(Oid catId); +extern void CatCacheInvalidate(CatCache *cache, uint32 hashValue); +extern void PrepareToInvalidateCacheTuple(Relation relation, + HeapTuple tuple, + HeapTuple newtuple, + void (*function) (int, uint32, Oid, void *), + void *context); + +#endif /* CATCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/combocid.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/combocid.h new file mode 100644 index 0000000..4a2069b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/combocid.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * combocid.h + * Combo command ID support routines + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/combocid.h + * + *------------------------------------------------------------------------- + */ +#ifndef COMBOCID_H +#define COMBOCID_H + +/* + * HeapTupleHeaderGetCmin and HeapTupleHeaderGetCmax function prototypes + * are in access/htup.h, because that's where the macro definitions that + * those functions replaced used to be. + */ + +extern void AtEOXact_ComboCid(void); +extern void RestoreComboCIDState(char *comboCIDstate); +extern void SerializeComboCIDState(Size maxsize, char *start_address); +extern Size EstimateComboCIDStateSpace(void); + +#endif /* COMBOCID_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/conffiles.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/conffiles.h new file mode 100644 index 0000000..799abb4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/conffiles.h @@ -0,0 +1,27 @@ +/*-------------------------------------------------------------------- + * conffiles.h + * + * Utilities related to configuration files. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/conffiles.h + * + *-------------------------------------------------------------------- + */ +#ifndef CONFFILES_H +#define CONFFILES_H + +/* recursion nesting depth for configuration files */ +#define CONF_FILE_START_DEPTH 0 +#define CONF_FILE_MAX_DEPTH 10 + +extern char *AbsoluteConfigLocation(const char *location, + const char *calling_file); +extern char **GetConfFilesInDir(const char *includedir, + const char *calling_file, + int elevel, int *num_filenames, + char **err_msg); + +#endif /* CONFFILES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/date.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/date.h new file mode 100644 index 0000000..bb5c1e5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/date.h @@ -0,0 +1,118 @@ +/*------------------------------------------------------------------------- + * + * date.h + * Definitions for the SQL "date" and "time" types. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/date.h + * + *------------------------------------------------------------------------- + */ +#ifndef DATE_H +#define DATE_H + +#include + +#include "datatype/timestamp.h" +#include "fmgr.h" +#include "pgtime.h" + +typedef int32 DateADT; + +typedef int64 TimeADT; + +typedef struct +{ + TimeADT time; /* all time units other than months and years */ + int32 zone; /* numeric time zone, in seconds */ +} TimeTzADT; + +/* + * Infinity and minus infinity must be the max and min values of DateADT. + */ +#define DATEVAL_NOBEGIN ((DateADT) PG_INT32_MIN) +#define DATEVAL_NOEND ((DateADT) PG_INT32_MAX) + +#define DATE_NOBEGIN(j) ((j) = DATEVAL_NOBEGIN) +#define DATE_IS_NOBEGIN(j) ((j) == DATEVAL_NOBEGIN) +#define DATE_NOEND(j) ((j) = DATEVAL_NOEND) +#define DATE_IS_NOEND(j) ((j) == DATEVAL_NOEND) +#define DATE_NOT_FINITE(j) (DATE_IS_NOBEGIN(j) || DATE_IS_NOEND(j)) + +#define MAX_TIME_PRECISION 6 + +/* + * Functions for fmgr-callable functions. + * + * For TimeADT, we make use of the same support routines as for int64. + * Therefore TimeADT is pass-by-reference if and only if int64 is! + */ +static inline DateADT +DatumGetDateADT(Datum X) +{ + return (DateADT) DatumGetInt32(X); +} + +static inline TimeADT +DatumGetTimeADT(Datum X) +{ + return (TimeADT) DatumGetInt64(X); +} + +static inline TimeTzADT * +DatumGetTimeTzADTP(Datum X) +{ + return (TimeTzADT *) DatumGetPointer(X); +} + +static inline Datum +DateADTGetDatum(DateADT X) +{ + return Int32GetDatum(X); +} + +static inline Datum +TimeADTGetDatum(TimeADT X) +{ + return Int64GetDatum(X); +} + +static inline Datum +TimeTzADTPGetDatum(const TimeTzADT *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n)) +#define PG_GETARG_TIMEADT(n) DatumGetTimeADT(PG_GETARG_DATUM(n)) +#define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n)) + +#define PG_RETURN_DATEADT(x) return DateADTGetDatum(x) +#define PG_RETURN_TIMEADT(x) return TimeADTGetDatum(x) +#define PG_RETURN_TIMETZADT_P(x) return TimeTzADTPGetDatum(x) + + +/* date.c */ +extern int32 anytime_typmod_check(bool istz, int32 typmod); +extern double date2timestamp_no_overflow(DateADT dateVal); +extern Timestamp date2timestamp_opt_overflow(DateADT dateVal, int *overflow); +extern TimestampTz date2timestamptz_opt_overflow(DateADT dateVal, int *overflow); +extern int32 date_cmp_timestamp_internal(DateADT dateVal, Timestamp dt2); +extern int32 date_cmp_timestamptz_internal(DateADT dateVal, TimestampTz dt2); + +extern void EncodeSpecialDate(DateADT dt, char *str); +extern DateADT GetSQLCurrentDate(void); +extern TimeTzADT *GetSQLCurrentTime(int32 typmod); +extern TimeADT GetSQLLocalTime(int32 typmod); +extern int time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec); +extern int timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp); +extern int tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result); +extern int tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result); +extern bool time_overflows(int hour, int min, int sec, fsec_t fsec); +extern bool float_time_overflows(int hour, int min, double sec); +extern void AdjustTimeForTypmod(TimeADT *time, int32 typmod); + +#endif /* DATE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/datetime.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/datetime.h new file mode 100644 index 0000000..53a1c69 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/datetime.h @@ -0,0 +1,369 @@ +/*------------------------------------------------------------------------- + * + * datetime.h + * Definitions for date/time support code. + * The support code is shared with other date data types, + * including date, and time. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/datetime.h + * + *------------------------------------------------------------------------- + */ +#ifndef DATETIME_H +#define DATETIME_H + +#include "utils/timestamp.h" + +/* this struct is declared in utils/tzparser.h: */ +struct tzEntry; + + +/* ---------------------------------------------------------------- + * time types + support macros + * + * String definitions for standard time quantities. + * + * These strings are the defaults used to form output time strings. + * Other alternative forms are hardcoded into token tables in datetime.c. + * ---------------------------------------------------------------- + */ + +#define DAGO "ago" +#define DCURRENT "current" +#define EPOCH "epoch" +#define INVALID "invalid" +#define EARLY "-infinity" +#define LATE "infinity" +#define NOW "now" +#define TODAY "today" +#define TOMORROW "tomorrow" +#define YESTERDAY "yesterday" +#define ZULU "zulu" + +#define DMICROSEC "usecond" +#define DMILLISEC "msecond" +#define DSECOND "second" +#define DMINUTE "minute" +#define DHOUR "hour" +#define DDAY "day" +#define DWEEK "week" +#define DMONTH "month" +#define DQUARTER "quarter" +#define DYEAR "year" +#define DDECADE "decade" +#define DCENTURY "century" +#define DMILLENNIUM "millennium" +#define DA_D "ad" +#define DB_C "bc" +#define DTIMEZONE "timezone" + +/* + * Fundamental time field definitions for parsing. + * + * Meridian: am, pm, or 24-hour style. + * Millennium: ad, bc + */ + +#define AM 0 +#define PM 1 +#define HR24 2 + +#define AD 0 +#define BC 1 + +/* + * Field types for time decoding. + * + * Can't have more of these than there are bits in an unsigned int + * since these are turned into bit masks during parsing and decoding. + * + * Furthermore, the values for YEAR, MONTH, DAY, HOUR, MINUTE, SECOND + * must be in the range 0..14 so that the associated bitmasks can fit + * into the left half of an INTERVAL's typmod value. Since those bits + * are stored in typmods, you can't change them without initdb! + */ + +#define RESERV 0 +#define MONTH 1 +#define YEAR 2 +#define DAY 3 +#define JULIAN 4 +#define TZ 5 /* fixed-offset timezone abbreviation */ +#define DTZ 6 /* fixed-offset timezone abbrev, DST */ +#define DYNTZ 7 /* dynamic timezone abbreviation */ +#define IGNORE_DTF 8 +#define AMPM 9 +#define HOUR 10 +#define MINUTE 11 +#define SECOND 12 +#define MILLISECOND 13 +#define MICROSECOND 14 +#define DOY 15 +#define DOW 16 +#define UNITS 17 +#define ADBC 18 +/* these are only for relative dates */ +#define AGO 19 +#define ABS_BEFORE 20 +#define ABS_AFTER 21 +/* generic fields to help with parsing */ +#define ISODATE 22 +#define ISOTIME 23 +/* these are only for parsing intervals */ +#define WEEK 24 +#define DECADE 25 +#define CENTURY 26 +#define MILLENNIUM 27 +/* hack for parsing two-word timezone specs "MET DST" etc */ +#define DTZMOD 28 /* "DST" as a separate word */ +/* reserved for unrecognized string values */ +#define UNKNOWN_FIELD 31 + +/* + * Token field definitions for time parsing and decoding. + * + * Some field type codes (see above) use these as the "value" in datetktbl[]. + * These are also used for bit masks in DecodeDateTime and friends + * so actually restrict them to within [0,31] for now. + * - thomas 97/06/19 + * Not all of these fields are used for masks in DecodeDateTime + * so allow some larger than 31. - thomas 1997-11-17 + * + * Caution: there are undocumented assumptions in the code that most of these + * values are not equal to IGNORE_DTF nor RESERV. Be very careful when + * renumbering values in either of these apparently-independent lists :-( + */ + +#define DTK_NUMBER 0 +#define DTK_STRING 1 + +#define DTK_DATE 2 +#define DTK_TIME 3 +#define DTK_TZ 4 +#define DTK_AGO 5 + +#define DTK_SPECIAL 6 +#define DTK_EARLY 9 +#define DTK_LATE 10 +#define DTK_EPOCH 11 +#define DTK_NOW 12 +#define DTK_YESTERDAY 13 +#define DTK_TODAY 14 +#define DTK_TOMORROW 15 +#define DTK_ZULU 16 + +#define DTK_DELTA 17 +#define DTK_SECOND 18 +#define DTK_MINUTE 19 +#define DTK_HOUR 20 +#define DTK_DAY 21 +#define DTK_WEEK 22 +#define DTK_MONTH 23 +#define DTK_QUARTER 24 +#define DTK_YEAR 25 +#define DTK_DECADE 26 +#define DTK_CENTURY 27 +#define DTK_MILLENNIUM 28 +#define DTK_MILLISEC 29 +#define DTK_MICROSEC 30 +#define DTK_JULIAN 31 + +#define DTK_DOW 32 +#define DTK_DOY 33 +#define DTK_TZ_HOUR 34 +#define DTK_TZ_MINUTE 35 +#define DTK_ISOYEAR 36 +#define DTK_ISODOW 37 + + +/* + * Bit mask definitions for time parsing. + */ + +#define DTK_M(t) (0x01 << (t)) + +/* Convenience: a second, plus any fractional component */ +#define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) +#define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY)) +#define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M) + +/* + * Working buffer size for input and output of interval, timestamp, etc. + * Inputs that need more working space will be rejected early. Longer outputs + * will overrun buffers, so this must suffice for all possible output. As of + * this writing, interval_out() needs the most space at ~90 bytes. + */ +#define MAXDATELEN 128 +/* maximum possible number of fields in a date string */ +#define MAXDATEFIELDS 25 +/* only this many chars are stored in datetktbl */ +#define TOKMAXLEN 10 + +/* keep this struct small; it gets used a lot */ +typedef struct +{ + char token[TOKMAXLEN + 1]; /* always NUL-terminated */ + char type; /* see field type codes above */ + int32 value; /* meaning depends on type */ +} datetkn; + +/* one of its uses is in tables of time zone abbreviations */ +typedef struct TimeZoneAbbrevTable +{ + Size tblsize; /* size in bytes of TimeZoneAbbrevTable */ + int numabbrevs; /* number of entries in abbrevs[] array */ + datetkn abbrevs[FLEXIBLE_ARRAY_MEMBER]; + /* DynamicZoneAbbrev(s) may follow the abbrevs[] array */ +} TimeZoneAbbrevTable; + +/* auxiliary data for a dynamic time zone abbreviation (non-fixed-offset) */ +typedef struct DynamicZoneAbbrev +{ + pg_tz *tz; /* NULL if not yet looked up */ + char zone[FLEXIBLE_ARRAY_MEMBER]; /* NUL-terminated zone name */ +} DynamicZoneAbbrev; + + +/* FMODULO() + * Macro to replace modf(), which is broken on some platforms. + * t = input and remainder + * q = integer part + * u = divisor + */ +#define FMODULO(t,q,u) \ +do { \ + (q) = (((t) < 0) ? ceil((t) / (u)) : floor((t) / (u))); \ + if ((q) != 0) (t) -= rint((q) * (u)); \ +} while(0) + +/* TMODULO() + * Like FMODULO(), but work on the timestamp datatype (now always int64). + * We assume that int64 follows the C99 semantics for division (negative + * quotients truncate towards zero). + */ +#define TMODULO(t,q,u) \ +do { \ + (q) = ((t) / (u)); \ + if ((q) != 0) (t) -= ((q) * (u)); \ +} while(0) + +/* + * Date/time validation + * Include check for leap year. + */ + +extern PGDLLIMPORT const char *const months[]; /* months (3-char + * abbreviations) */ +extern PGDLLIMPORT const char *const days[]; /* days (full names) */ +extern PGDLLIMPORT const int day_tab[2][13]; + +/* + * These are the rules for the Gregorian calendar, which was adopted in 1582. + * However, we use this calculation for all prior years as well because the + * SQL standard specifies use of the Gregorian calendar. This prevents the + * date 1500-02-29 from being stored, even though it is valid in the Julian + * calendar. + */ +#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) + + +/* + * Datetime input parsing routines (ParseDateTime, DecodeDateTime, etc) + * return zero or a positive value on success. On failure, they return + * one of these negative code values. DateTimeParseError may be used to + * produce a suitable error report. For some of these codes, + * DateTimeParseError requires additional information, which is carried + * in struct DateTimeErrorExtra. + */ +#define DTERR_BAD_FORMAT (-1) +#define DTERR_FIELD_OVERFLOW (-2) +#define DTERR_MD_FIELD_OVERFLOW (-3) /* triggers hint about DateStyle */ +#define DTERR_INTERVAL_OVERFLOW (-4) +#define DTERR_TZDISP_OVERFLOW (-5) +#define DTERR_BAD_TIMEZONE (-6) +#define DTERR_BAD_ZONE_ABBREV (-7) + +typedef struct DateTimeErrorExtra +{ + /* Needed for DTERR_BAD_TIMEZONE and DTERR_BAD_ZONE_ABBREV: */ + const char *dtee_timezone; /* incorrect time zone name */ + /* Needed for DTERR_BAD_ZONE_ABBREV: */ + const char *dtee_abbrev; /* relevant time zone abbreviation */ +} DateTimeErrorExtra; + +/* Result codes for DecodeTimezoneName() */ +#define TZNAME_FIXED_OFFSET 0 +#define TZNAME_DYNTZ 1 +#define TZNAME_ZONE 2 + + +extern void GetCurrentDateTime(struct pg_tm *tm); +extern void GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp); +extern void j2date(int jd, int *year, int *month, int *day); +extern int date2j(int year, int month, int day); + +extern int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, + char **field, int *ftype, + int maxfields, int *numfields); +extern int DecodeDateTime(char **field, int *ftype, int nf, + int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, + DateTimeErrorExtra *extra); +extern int DecodeTimezone(const char *str, int *tzp); +extern int DecodeTimeOnly(char **field, int *ftype, int nf, + int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, + DateTimeErrorExtra *extra); +extern int DecodeInterval(char **field, int *ftype, int nf, int range, + int *dtype, struct pg_itm_in *itm_in); +extern int DecodeISO8601Interval(char *str, + int *dtype, struct pg_itm_in *itm_in); + +extern void DateTimeParseError(int dterr, DateTimeErrorExtra *extra, + const char *str, const char *datatype, + struct Node *escontext); + +extern int DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp); +extern int DetermineTimeZoneAbbrevOffset(struct pg_tm *tm, const char *abbr, pg_tz *tzp); +extern int DetermineTimeZoneAbbrevOffsetTS(TimestampTz ts, const char *abbr, + pg_tz *tzp, int *isdst); + +extern void EncodeDateOnly(struct pg_tm *tm, int style, char *str); +extern void EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, int style, char *str); +extern void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str); +extern void EncodeInterval(struct pg_itm *itm, int style, char *str); +extern void EncodeSpecialTimestamp(Timestamp dt, char *str); + +extern int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, + struct pg_tm *tm); + +extern int DecodeTimezoneAbbrev(int field, const char *lowtoken, + int *ftype, int *offset, pg_tz **tz, + DateTimeErrorExtra *extra); +extern int DecodeSpecial(int field, const char *lowtoken, int *val); +extern int DecodeUnits(int field, const char *lowtoken, int *val); + +extern int DecodeTimezoneName(const char *tzname, int *offset, pg_tz **tz); +extern pg_tz *DecodeTimezoneNameToTz(const char *tzname); + +extern int DecodeTimezoneAbbrevPrefix(const char *str, + int *offset, pg_tz **tz); + +extern void ClearTimeZoneAbbrevCache(void); + +extern int j2day(int date); + +extern struct Node *TemporalSimplify(int32 max_precis, struct Node *node); + +extern bool CheckDateTokenTables(void); + +extern TimeZoneAbbrevTable *ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, + int n); +extern void InstallTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl); + +extern bool AdjustTimestampForTypmod(Timestamp *time, int32 typmod, + struct Node *escontext); + +#endif /* DATETIME_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/datum.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/datum.h new file mode 100644 index 0000000..fce048e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/datum.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------------------- + * + * datum.h + * POSTGRES Datum (abstract data type) manipulation routines. + * + * These routines are driven by the 'typbyval' and 'typlen' information, + * which must previously have been obtained by the caller for the datatype + * of the Datum. (We do it this way because in most situations the caller + * can look up the info just once and use it for many per-datum operations.) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/datum.h + * + *------------------------------------------------------------------------- + */ +#ifndef DATUM_H +#define DATUM_H + +/* + * datumGetSize - find the "real" length of a datum + */ +extern Size datumGetSize(Datum value, bool typByVal, int typLen); + +/* + * datumCopy - make a copy of a non-NULL datum. + * + * If the datatype is pass-by-reference, memory is obtained with palloc(). + */ +extern Datum datumCopy(Datum value, bool typByVal, int typLen); + +/* + * datumTransfer - transfer a non-NULL datum into the current memory context. + * + * Differs from datumCopy() in its handling of read-write expanded objects. + */ +extern Datum datumTransfer(Datum value, bool typByVal, int typLen); + +/* + * datumIsEqual + * return true if two datums of the same type are equal, false otherwise. + * + * XXX : See comments in the code for restrictions! + */ +extern bool datumIsEqual(Datum value1, Datum value2, + bool typByVal, int typLen); + +/* + * datum_image_eq + * + * Compares two datums for identical contents, based on byte images. Return + * true if the two datums are equal, false otherwise. + */ +extern bool datum_image_eq(Datum value1, Datum value2, + bool typByVal, int typLen); + +/* + * datum_image_hash + * + * Generates hash value for 'value' based on its bits rather than logical + * value. + */ +extern uint32 datum_image_hash(Datum value, bool typByVal, int typLen); + +/* + * Serialize and restore datums so that we can transfer them to parallel + * workers. + */ +extern Size datumEstimateSpace(Datum value, bool isnull, bool typByVal, + int typLen); +extern void datumSerialize(Datum value, bool isnull, bool typByVal, + int typLen, char **start_address); +extern Datum datumRestore(char **start_address, bool *isnull); + +#endif /* DATUM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/dsa.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/dsa.h new file mode 100644 index 0000000..9eca878 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/dsa.h @@ -0,0 +1,166 @@ +/*------------------------------------------------------------------------- + * + * dsa.h + * Dynamic shared memory areas. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/utils/dsa.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSA_H +#define DSA_H + +#include "port/atomics.h" +#include "storage/dsm.h" + +/* The opaque type used for an area. */ +struct dsa_area; +typedef struct dsa_area dsa_area; + +/* + * If this system only uses a 32-bit value for size_t, then use the 32-bit + * implementation of DSA. This limits the amount of DSA that can be created + * to something significantly less than the entire 4GB address space because + * the DSA pointer must encode both a segment identifier and an offset, but + * that shouldn't be a significant limitation in practice. + * + * If this system doesn't support atomic operations on 64-bit values, then + * we fall back to 32-bit dsa_pointer for lack of other options. + * + * For testing purposes, USE_SMALL_DSA_POINTER can be defined to force the use + * of 32-bit dsa_pointer even on systems capable of supporting a 64-bit + * dsa_pointer. + */ +#if SIZEOF_SIZE_T == 4 || !defined(PG_HAVE_ATOMIC_U64_SUPPORT) || \ + defined(USE_SMALL_DSA_POINTER) +#define SIZEOF_DSA_POINTER 4 +#else +#define SIZEOF_DSA_POINTER 8 +#endif + +/* + * The type of 'relative pointers' to memory allocated by a dynamic shared + * area. dsa_pointer values can be shared with other processes, but must be + * converted to backend-local pointers before they can be dereferenced. See + * dsa_get_address. Also, an atomic version and appropriately sized atomic + * operations. + */ +#if SIZEOF_DSA_POINTER == 4 +typedef uint32 dsa_pointer; +typedef pg_atomic_uint32 dsa_pointer_atomic; +#define dsa_pointer_atomic_init pg_atomic_init_u32 +#define dsa_pointer_atomic_read pg_atomic_read_u32 +#define dsa_pointer_atomic_write pg_atomic_write_u32 +#define dsa_pointer_atomic_fetch_add pg_atomic_fetch_add_u32 +#define dsa_pointer_atomic_compare_exchange pg_atomic_compare_exchange_u32 +#define DSA_POINTER_FORMAT "%08x" +#else +typedef uint64 dsa_pointer; +typedef pg_atomic_uint64 dsa_pointer_atomic; +#define dsa_pointer_atomic_init pg_atomic_init_u64 +#define dsa_pointer_atomic_read pg_atomic_read_u64 +#define dsa_pointer_atomic_write pg_atomic_write_u64 +#define dsa_pointer_atomic_fetch_add pg_atomic_fetch_add_u64 +#define dsa_pointer_atomic_compare_exchange pg_atomic_compare_exchange_u64 +#define DSA_POINTER_FORMAT "%016" PRIx64 +#endif + +/* Flags for dsa_allocate_extended. */ +#define DSA_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) */ +#define DSA_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */ +#define DSA_ALLOC_ZERO 0x04 /* zero allocated memory */ + +/* A sentinel value for dsa_pointer used to indicate failure to allocate. */ +#define InvalidDsaPointer ((dsa_pointer) 0) + +/* + * The number of bits used to represent the offset part of a dsa_pointer. + * This controls the maximum size of a segment, the maximum possible + * allocation size and also the maximum number of segments per area. + */ +#if SIZEOF_DSA_POINTER == 4 +#define DSA_OFFSET_WIDTH 27 /* 32 segments of size up to 128MB */ +#else +#define DSA_OFFSET_WIDTH 40 /* 1024 segments of size up to 1TB */ +#endif + +/* + * The default size of the initial DSM segment that backs a dsa_area created + * by dsa_create. After creating some number of segments of the initial size + * we'll double this size, and so on. Larger segments may be created if + * necessary to satisfy large requests. + */ +#define DSA_DEFAULT_INIT_SEGMENT_SIZE ((size_t) (1 * 1024 * 1024)) + +/* The minimum size of a DSM segment. */ +#define DSA_MIN_SEGMENT_SIZE ((size_t) (256 * 1024)) + +/* The maximum size of a DSM segment. */ +#define DSA_MAX_SEGMENT_SIZE ((size_t) 1 << DSA_OFFSET_WIDTH) + +/* Check if a dsa_pointer value is valid. */ +#define DsaPointerIsValid(x) ((x) != InvalidDsaPointer) + +/* Allocate uninitialized memory with error on out-of-memory. */ +#define dsa_allocate(area, size) \ + dsa_allocate_extended(area, size, 0) + +/* Allocate zero-initialized memory with error on out-of-memory. */ +#define dsa_allocate0(area, size) \ + dsa_allocate_extended(area, size, DSA_ALLOC_ZERO) + +/* Create dsa_area with default segment sizes */ +#define dsa_create(tranch_id) \ + dsa_create_ext(tranch_id, DSA_DEFAULT_INIT_SEGMENT_SIZE, \ + DSA_MAX_SEGMENT_SIZE) + +/* Create dsa_area with default segment sizes in an existing share memory space */ +#define dsa_create_in_place(place, size, tranch_id, segment) \ + dsa_create_in_place_ext(place, size, tranch_id, segment, \ + DSA_DEFAULT_INIT_SEGMENT_SIZE, \ + DSA_MAX_SEGMENT_SIZE) + +/* + * The type used for dsa_area handles. dsa_handle values can be shared with + * other processes, so that they can attach to them. This provides a way to + * share allocated storage with other processes. + * + * The handle for a dsa_area is currently implemented as the dsm_handle + * for the first DSM segment backing this dynamic storage area, but client + * code shouldn't assume that is true. + */ +typedef dsm_handle dsa_handle; + +/* Sentinel value to use for invalid dsa_handles. */ +#define DSA_HANDLE_INVALID ((dsa_handle) DSM_HANDLE_INVALID) + +extern dsa_area *dsa_create_ext(int tranche_id, size_t init_segment_size, + size_t max_segment_size); +extern dsa_area *dsa_create_in_place_ext(void *place, size_t size, + int tranche_id, dsm_segment *segment, + size_t init_segment_size, + size_t max_segment_size); +extern dsa_area *dsa_attach(dsa_handle handle); +extern dsa_area *dsa_attach_in_place(void *place, dsm_segment *segment); +extern void dsa_release_in_place(void *place); +extern void dsa_on_dsm_detach_release_in_place(dsm_segment *, Datum); +extern void dsa_on_shmem_exit_release_in_place(int, Datum); +extern void dsa_pin_mapping(dsa_area *area); +extern void dsa_detach(dsa_area *area); +extern void dsa_pin(dsa_area *area); +extern void dsa_unpin(dsa_area *area); +extern void dsa_set_size_limit(dsa_area *area, size_t limit); +extern size_t dsa_minimum_size(void); +extern dsa_handle dsa_get_handle(dsa_area *area); +extern dsa_pointer dsa_allocate_extended(dsa_area *area, size_t size, int flags); +extern void dsa_free(dsa_area *area, dsa_pointer dp); +extern void *dsa_get_address(dsa_area *area, dsa_pointer dp); +extern size_t dsa_get_total_size(dsa_area *area); +extern void dsa_trim(dsa_area *area); +extern void dsa_dump(dsa_area *area); + +#endif /* DSA_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/dynahash.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/dynahash.h new file mode 100644 index 0000000..8a31d95 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/dynahash.h @@ -0,0 +1,20 @@ +/*------------------------------------------------------------------------- + * + * dynahash.h + * POSTGRES dynahash.h file definitions + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/utils/dynahash.h + * + *------------------------------------------------------------------------- + */ +#ifndef DYNAHASH_H +#define DYNAHASH_H + +extern int my_log2(long num); + +#endif /* DYNAHASH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/elog.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/elog.h new file mode 100644 index 0000000..581b390 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/elog.h @@ -0,0 +1,532 @@ +/*------------------------------------------------------------------------- + * + * elog.h + * POSTGRES error reporting/logging definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/elog.h + * + *------------------------------------------------------------------------- + */ +#ifndef ELOG_H +#define ELOG_H + +#include + +#include "lib/stringinfo.h" + +/* We cannot include nodes.h yet, so forward-declare struct Node */ +struct Node; + + +/* Error level codes */ +#define DEBUG5 10 /* Debugging messages, in categories of + * decreasing detail. */ +#define DEBUG4 11 +#define DEBUG3 12 +#define DEBUG2 13 +#define DEBUG1 14 /* used by GUC debug_* variables */ +#define LOG 15 /* Server operational messages; sent only to + * server log by default. */ +#define LOG_SERVER_ONLY 16 /* Same as LOG for server reporting, but never + * sent to client. */ +#define COMMERROR LOG_SERVER_ONLY /* Client communication problems; same as + * LOG for server reporting, but never + * sent to client. */ +#define INFO 17 /* Messages specifically requested by user (eg + * VACUUM VERBOSE output); always sent to + * client regardless of client_min_messages, + * but by default not sent to server log. */ +#define NOTICE 18 /* Helpful messages to users about query + * operation; sent to client and not to server + * log by default. */ +#define WARNING 19 /* Warnings. NOTICE is for expected messages + * like implicit sequence creation by SERIAL. + * WARNING is for unexpected messages. */ +#define PGWARNING 19 /* Must equal WARNING; see NOTE below. */ +#define WARNING_CLIENT_ONLY 20 /* Warnings to be sent to client as usual, but + * never to the server log. */ +#define ERROR 21 /* user error - abort transaction; return to + * known state */ +#define PGERROR 21 /* Must equal ERROR; see NOTE below. */ +#define FATAL 22 /* fatal error - abort process */ +#define PANIC 23 /* take down the other backends with me */ + +/* + * NOTE: the alternate names PGWARNING and PGERROR are useful for dealing + * with third-party headers that make other definitions of WARNING and/or + * ERROR. One can, for example, re-define ERROR as PGERROR after including + * such a header. + */ + + +/* macros for representing SQLSTATE strings compactly */ +#define PGSIXBIT(ch) (((ch) - '0') & 0x3F) +#define PGUNSIXBIT(val) (((val) & 0x3F) + '0') + +#define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) \ + (PGSIXBIT(ch1) + (PGSIXBIT(ch2) << 6) + (PGSIXBIT(ch3) << 12) + \ + (PGSIXBIT(ch4) << 18) + (PGSIXBIT(ch5) << 24)) + +/* These macros depend on the fact that '0' becomes a zero in PGSIXBIT */ +#define ERRCODE_TO_CATEGORY(ec) ((ec) & ((1 << 12) - 1)) +#define ERRCODE_IS_CATEGORY(ec) (((ec) & ~((1 << 12) - 1)) == 0) + +/* SQLSTATE codes for errors are defined in a separate file */ +#include "utils/errcodes.h" + +/* + * Provide a way to prevent "errno" from being accidentally used inside an + * elog() or ereport() invocation. Since we know that some operating systems + * define errno as something involving a function call, we'll put a local + * variable of the same name as that function in the local scope to force a + * compile error. On platforms that don't define errno in that way, nothing + * happens, so we get no warning ... but we can live with that as long as it + * happens on some popular platforms. + */ +#if defined(errno) && defined(__linux__) +#define pg_prevent_errno_in_scope() int __errno_location pg_attribute_unused() +#elif defined(errno) && (defined(__darwin__) || defined(__FreeBSD__)) +#define pg_prevent_errno_in_scope() int __error pg_attribute_unused() +#else +#define pg_prevent_errno_in_scope() +#endif + + +/*---------- + * New-style error reporting API: to be used in this way: + * ereport(ERROR, + * errcode(ERRCODE_UNDEFINED_CURSOR), + * errmsg("portal \"%s\" not found", stmt->portalname), + * ... other errxxx() fields as needed ...); + * + * The error level is required, and so is a primary error message (errmsg + * or errmsg_internal). All else is optional. errcode() defaults to + * ERRCODE_INTERNAL_ERROR if elevel is ERROR or more, ERRCODE_WARNING + * if elevel is WARNING, or ERRCODE_SUCCESSFUL_COMPLETION if elevel is + * NOTICE or below. + * + * Before Postgres v12, extra parentheses were required around the + * list of auxiliary function calls; that's now optional. + * + * ereport_domain() allows a message domain to be specified, for modules that + * wish to use a different message catalog from the backend's. To avoid having + * one copy of the default text domain per .o file, we define it as NULL here + * and have errstart insert the default text domain. Modules can either use + * ereport_domain() directly, or preferably they can override the TEXTDOMAIN + * macro. + * + * When __builtin_constant_p is available and elevel >= ERROR we make a call + * to errstart_cold() instead of errstart(). This version of the function is + * marked with pg_attribute_cold which will coax supporting compilers into + * generating code which is more optimized towards non-ERROR cases. Because + * we use __builtin_constant_p() in the condition, when elevel is not a + * compile-time constant, or if it is, but it's < ERROR, the compiler has no + * need to generate any code for this branch. It can simply call errstart() + * unconditionally. + * + * If elevel >= ERROR, the call will not return; we try to inform the compiler + * of that via pg_unreachable(). However, no useful optimization effect is + * obtained unless the compiler sees elevel as a compile-time constant, else + * we're just adding code bloat. So, if __builtin_constant_p is available, + * use that to cause the second if() to vanish completely for non-constant + * cases. We avoid using a local variable because it's not necessary and + * prevents gcc from making the unreachability deduction at optlevel -O0. + *---------- + */ +#ifdef HAVE__BUILTIN_CONSTANT_P +#define ereport_domain(elevel, domain, ...) \ + do { \ + pg_prevent_errno_in_scope(); \ + if (__builtin_constant_p(elevel) && (elevel) >= ERROR ? \ + errstart_cold(elevel, domain) : \ + errstart(elevel, domain)) \ + __VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \ + if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \ + pg_unreachable(); \ + } while(0) +#else /* !HAVE__BUILTIN_CONSTANT_P */ +#define ereport_domain(elevel, domain, ...) \ + do { \ + const int elevel_ = (elevel); \ + pg_prevent_errno_in_scope(); \ + if (errstart(elevel_, domain)) \ + __VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \ + if (elevel_ >= ERROR) \ + pg_unreachable(); \ + } while(0) +#endif /* HAVE__BUILTIN_CONSTANT_P */ + +#define ereport(elevel, ...) \ + ereport_domain(elevel, TEXTDOMAIN, __VA_ARGS__) + +#define TEXTDOMAIN NULL + +extern bool message_level_is_interesting(int elevel); + +extern bool errstart(int elevel, const char *domain); +extern pg_attribute_cold bool errstart_cold(int elevel, const char *domain); +extern void errfinish(const char *filename, int lineno, const char *funcname); + +extern int errcode(int sqlerrcode); + +extern int errcode_for_file_access(void); +extern int errcode_for_socket_access(void); + +extern int errmsg(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errmsg_internal(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errmsg_plural(const char *fmt_singular, const char *fmt_plural, + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + +extern int errdetail(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errdetail_internal(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errdetail_log(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errdetail_log_plural(const char *fmt_singular, + const char *fmt_plural, + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + +extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural, + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + +extern int errhint(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errhint_internal(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errhint_plural(const char *fmt_singular, const char *fmt_plural, + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + +/* + * errcontext() is typically called in error context callback functions, not + * within an ereport() invocation. The callback function can be in a different + * module than the ereport() call, so the message domain passed in errstart() + * is not usually the correct domain for translating the context message. + * set_errcontext_domain() first sets the domain to be used, and + * errcontext_msg() passes the actual message. + */ +#define errcontext set_errcontext_domain(TEXTDOMAIN), errcontext_msg + +extern int set_errcontext_domain(const char *domain); + +extern int errcontext_msg(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errhidestmt(bool hide_stmt); +extern int errhidecontext(bool hide_ctx); + +extern int errbacktrace(void); + +extern int errposition(int cursorpos); + +extern int internalerrposition(int cursorpos); +extern int internalerrquery(const char *query); + +extern int err_generic_string(int field, const char *str); + +extern int geterrcode(void); +extern int geterrposition(void); +extern int getinternalerrposition(void); + + +/*---------- + * Old-style error reporting API: to be used in this way: + * elog(ERROR, "portal \"%s\" not found", stmt->portalname); + *---------- + */ +#define elog(elevel, ...) \ + ereport(elevel, errmsg_internal(__VA_ARGS__)) + + +/*---------- + * Support for reporting "soft" errors that don't require a full transaction + * abort to clean up. This is to be used in this way: + * errsave(context, + * errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + * errmsg("invalid input syntax for type %s: \"%s\"", + * "boolean", in_str), + * ... other errxxx() fields as needed ...); + * + * "context" is a node pointer or NULL, and the remaining auxiliary calls + * provide the same error details as in ereport(). If context is not a + * pointer to an ErrorSaveContext node, then errsave(context, ...) + * behaves identically to ereport(ERROR, ...). If context is a pointer + * to an ErrorSaveContext node, then the information provided by the + * auxiliary calls is stored in the context node and control returns + * normally. The caller of errsave() must then do any required cleanup + * and return control back to its caller. That caller must check the + * ErrorSaveContext node to see whether an error occurred before + * it can trust the function's result to be meaningful. + * + * errsave_domain() allows a message domain to be specified; it is + * precisely analogous to ereport_domain(). + *---------- + */ +#define errsave_domain(context, domain, ...) \ + do { \ + struct Node *context_ = (context); \ + pg_prevent_errno_in_scope(); \ + if (errsave_start(context_, domain)) \ + __VA_ARGS__, errsave_finish(context_, __FILE__, __LINE__, __func__); \ + } while(0) + +#define errsave(context, ...) \ + errsave_domain(context, TEXTDOMAIN, __VA_ARGS__) + +/* + * "ereturn(context, dummy_value, ...);" is exactly the same as + * "errsave(context, ...); return dummy_value;". This saves a bit + * of typing in the common case where a function has no cleanup + * actions to take after reporting a soft error. "dummy_value" + * can be empty if the function returns void. + */ +#define ereturn_domain(context, dummy_value, domain, ...) \ + do { \ + errsave_domain(context, domain, __VA_ARGS__); \ + return dummy_value; \ + } while(0) + +#define ereturn(context, dummy_value, ...) \ + ereturn_domain(context, dummy_value, TEXTDOMAIN, __VA_ARGS__) + +extern bool errsave_start(struct Node *context, const char *domain); +extern void errsave_finish(struct Node *context, + const char *filename, int lineno, + const char *funcname); + + +/* Support for constructing error strings separately from ereport() calls */ + +extern void pre_format_elog_string(int errnumber, const char *domain); +extern char *format_elog_string(const char *fmt,...) pg_attribute_printf(1, 2); + + +/* Support for attaching context information to error reports */ + +typedef struct ErrorContextCallback +{ + struct ErrorContextCallback *previous; + void (*callback) (void *arg); + void *arg; +} ErrorContextCallback; + +extern PGDLLIMPORT ErrorContextCallback *error_context_stack; + + +/*---------- + * API for catching ereport(ERROR) exits. Use these macros like so: + * + * PG_TRY(); + * { + * ... code that might throw ereport(ERROR) ... + * } + * PG_CATCH(); + * { + * ... error recovery code ... + * } + * PG_END_TRY(); + * + * (The braces are not actually necessary, but are recommended so that + * pgindent will indent the construct nicely.) The error recovery code + * can either do PG_RE_THROW to propagate the error outwards, or do a + * (sub)transaction abort. Failure to do so may leave the system in an + * inconsistent state for further processing. + * + * For the common case that the error recovery code and the cleanup in the + * normal code path are identical, the following can be used instead: + * + * PG_TRY(); + * { + * ... code that might throw ereport(ERROR) ... + * } + * PG_FINALLY(); + * { + * ... cleanup code ... + * } + * PG_END_TRY(); + * + * The cleanup code will be run in either case, and any error will be rethrown + * afterwards. + * + * You cannot use both PG_CATCH() and PG_FINALLY() in the same + * PG_TRY()/PG_END_TRY() block. + * + * Note: while the system will correctly propagate any new ereport(ERROR) + * occurring in the recovery section, there is a small limit on the number + * of levels this will work for. It's best to keep the error recovery + * section simple enough that it can't generate any new errors, at least + * not before popping the error stack. + * + * Note: an ereport(FATAL) will not be caught by this construct; control will + * exit straight through proc_exit(). Therefore, do NOT put any cleanup + * of non-process-local resources into the error recovery section, at least + * not without taking thought for what will happen during ereport(FATAL). + * The PG_ENSURE_ERROR_CLEANUP macros provided by storage/ipc.h may be + * helpful in such cases. + * + * Note: if a local variable of the function containing PG_TRY is modified + * in the PG_TRY section and used in the PG_CATCH section, that variable + * must be declared "volatile" for POSIX compliance. This is not mere + * pedantry; we have seen bugs from compilers improperly optimizing code + * away when such a variable was not marked. Beware that gcc's -Wclobbered + * warnings are just about entirely useless for catching such oversights. + * + * Each of these macros accepts an optional argument which can be specified + * to apply a suffix to the variables declared within the macros. This suffix + * can be used to avoid the compiler emitting warnings about shadowed + * variables when compiling with -Wshadow in situations where nested PG_TRY() + * statements are required. The optional suffix may contain any character + * that's allowed in a variable name. The suffix, if specified, must be the + * same within each component macro of the given PG_TRY() statement. + *---------- + */ +#define PG_TRY(...) \ + do { \ + sigjmp_buf *_save_exception_stack##__VA_ARGS__ = PG_exception_stack; \ + ErrorContextCallback *_save_context_stack##__VA_ARGS__ = error_context_stack; \ + sigjmp_buf _local_sigjmp_buf##__VA_ARGS__; \ + bool _do_rethrow##__VA_ARGS__ = false; \ + if (sigsetjmp(_local_sigjmp_buf##__VA_ARGS__, 0) == 0) \ + { \ + PG_exception_stack = &_local_sigjmp_buf##__VA_ARGS__ + +#define PG_CATCH(...) \ + } \ + else \ + { \ + PG_exception_stack = _save_exception_stack##__VA_ARGS__; \ + error_context_stack = _save_context_stack##__VA_ARGS__ + +#define PG_FINALLY(...) \ + } \ + else \ + _do_rethrow##__VA_ARGS__ = true; \ + { \ + PG_exception_stack = _save_exception_stack##__VA_ARGS__; \ + error_context_stack = _save_context_stack##__VA_ARGS__ + +#define PG_END_TRY(...) \ + } \ + if (_do_rethrow##__VA_ARGS__) \ + PG_RE_THROW(); \ + PG_exception_stack = _save_exception_stack##__VA_ARGS__; \ + error_context_stack = _save_context_stack##__VA_ARGS__; \ + } while (0) + +#define PG_RE_THROW() \ + pg_re_throw() + +extern PGDLLIMPORT sigjmp_buf *PG_exception_stack; + + +/* Stuff that error handlers might want to use */ + +/* + * ErrorData holds the data accumulated during any one ereport() cycle. + * Any non-NULL pointers must point to palloc'd data. + * (The const pointers are an exception; we assume they point at non-freeable + * constant strings.) + */ +typedef struct ErrorData +{ + int elevel; /* error level */ + bool output_to_server; /* will report to server log? */ + bool output_to_client; /* will report to client? */ + bool hide_stmt; /* true to prevent STATEMENT: inclusion */ + bool hide_ctx; /* true to prevent CONTEXT: inclusion */ + const char *filename; /* __FILE__ of ereport() call */ + int lineno; /* __LINE__ of ereport() call */ + const char *funcname; /* __func__ of ereport() call */ + const char *domain; /* message domain */ + const char *context_domain; /* message domain for context message */ + int sqlerrcode; /* encoded ERRSTATE */ + char *message; /* primary error message (translated) */ + char *detail; /* detail error message */ + char *detail_log; /* detail error message for server log only */ + char *hint; /* hint message */ + char *context; /* context message */ + char *backtrace; /* backtrace */ + const char *message_id; /* primary message's id (original string) */ + char *schema_name; /* name of schema */ + char *table_name; /* name of table */ + char *column_name; /* name of column */ + char *datatype_name; /* name of datatype */ + char *constraint_name; /* name of constraint */ + int cursorpos; /* cursor index into query string */ + int internalpos; /* cursor index into internalquery */ + char *internalquery; /* text of internally-generated query */ + int saved_errno; /* errno at entry */ + + /* context containing associated non-constant strings */ + struct MemoryContextData *assoc_context; +} ErrorData; + +extern void EmitErrorReport(void); +extern ErrorData *CopyErrorData(void); +extern void FreeErrorData(ErrorData *edata); +extern void FlushErrorState(void); +pg_noreturn extern void ReThrowError(ErrorData *edata); +extern void ThrowErrorData(ErrorData *edata); +pg_noreturn extern void pg_re_throw(void); + +extern char *GetErrorContextStack(void); + +/* Hook for intercepting messages before they are sent to the server log */ +typedef void (*emit_log_hook_type) (ErrorData *edata); +extern PGDLLIMPORT emit_log_hook_type emit_log_hook; + + +/* GUC-configurable parameters */ + +typedef enum +{ + PGERROR_TERSE, /* single-line error messages */ + PGERROR_DEFAULT, /* recommended style */ + PGERROR_VERBOSE, /* all the facts, ma'am */ +} PGErrorVerbosity; + +extern PGDLLIMPORT int Log_error_verbosity; +extern PGDLLIMPORT char *Log_line_prefix; +extern PGDLLIMPORT int Log_destination; +extern PGDLLIMPORT char *Log_destination_string; +extern PGDLLIMPORT bool syslog_sequence_numbers; +extern PGDLLIMPORT bool syslog_split_messages; + +/* Log destination bitmap */ +#define LOG_DESTINATION_STDERR 1 +#define LOG_DESTINATION_SYSLOG 2 +#define LOG_DESTINATION_EVENTLOG 4 +#define LOG_DESTINATION_CSVLOG 8 +#define LOG_DESTINATION_JSONLOG 16 + +/* Other exported functions */ +extern void log_status_format(StringInfo buf, const char *format, + ErrorData *edata); +extern void DebugFileOpen(void); +extern char *unpack_sql_state(int sql_state); +extern bool in_error_recursion_trouble(void); + +/* Common functions shared across destinations */ +extern void reset_formatted_start_time(void); +extern char *get_formatted_start_time(void); +extern char *get_formatted_log_time(void); +extern const char *get_backend_type_for_log(void); +extern bool check_log_of_query(ErrorData *edata); +extern const char *error_severity(int elevel); +extern void write_pipe_chunks(char *data, int len, int dest); + +/* Destination-specific functions */ +extern void write_csvlog(ErrorData *edata); +extern void write_jsonlog(ErrorData *edata); + +/* + * Write errors to stderr (or by equal means when stderr is + * not available). Used before ereport/elog can be used + * safely (memory context, GUC load etc) + */ +extern void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2); +extern void vwrite_stderr(const char *fmt, va_list ap) pg_attribute_printf(1, 0); + +#endif /* ELOG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/errcodes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/errcodes.h new file mode 100644 index 0000000..01ed270 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/errcodes.h @@ -0,0 +1,356 @@ +/* autogenerated from src/backend/utils/errcodes.txt, do not edit */ +/* there is deliberately not an #ifndef ERRCODES_H here */ + +/* Class 00 - Successful Completion */ +#define ERRCODE_SUCCESSFUL_COMPLETION MAKE_SQLSTATE('0','0','0','0','0') + +/* Class 01 - Warning */ +#define ERRCODE_WARNING MAKE_SQLSTATE('0','1','0','0','0') +#define ERRCODE_WARNING_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','1','0','0','C') +#define ERRCODE_WARNING_IMPLICIT_ZERO_BIT_PADDING MAKE_SQLSTATE('0','1','0','0','8') +#define ERRCODE_WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION MAKE_SQLSTATE('0','1','0','0','3') +#define ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED MAKE_SQLSTATE('0','1','0','0','7') +#define ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED MAKE_SQLSTATE('0','1','0','0','6') +#define ERRCODE_WARNING_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('0','1','0','0','4') +#define ERRCODE_WARNING_DEPRECATED_FEATURE MAKE_SQLSTATE('0','1','P','0','1') + +/* Class 02 - No Data (this is also a warning class per the SQL standard) */ +#define ERRCODE_NO_DATA MAKE_SQLSTATE('0','2','0','0','0') +#define ERRCODE_NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','2','0','0','1') + +/* Class 03 - SQL Statement Not Yet Complete */ +#define ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE MAKE_SQLSTATE('0','3','0','0','0') + +/* Class 08 - Connection Exception */ +#define ERRCODE_CONNECTION_EXCEPTION MAKE_SQLSTATE('0','8','0','0','0') +#define ERRCODE_CONNECTION_DOES_NOT_EXIST MAKE_SQLSTATE('0','8','0','0','3') +#define ERRCODE_CONNECTION_FAILURE MAKE_SQLSTATE('0','8','0','0','6') +#define ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','1') +#define ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','4') +#define ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN MAKE_SQLSTATE('0','8','0','0','7') +#define ERRCODE_PROTOCOL_VIOLATION MAKE_SQLSTATE('0','8','P','0','1') + +/* Class 09 - Triggered Action Exception */ +#define ERRCODE_TRIGGERED_ACTION_EXCEPTION MAKE_SQLSTATE('0','9','0','0','0') + +/* Class 0A - Feature Not Supported */ +#define ERRCODE_FEATURE_NOT_SUPPORTED MAKE_SQLSTATE('0','A','0','0','0') + +/* Class 0B - Invalid Transaction Initiation */ +#define ERRCODE_INVALID_TRANSACTION_INITIATION MAKE_SQLSTATE('0','B','0','0','0') + +/* Class 0F - Locator Exception */ +#define ERRCODE_LOCATOR_EXCEPTION MAKE_SQLSTATE('0','F','0','0','0') +#define ERRCODE_L_E_INVALID_SPECIFICATION MAKE_SQLSTATE('0','F','0','0','1') + +/* Class 0L - Invalid Grantor */ +#define ERRCODE_INVALID_GRANTOR MAKE_SQLSTATE('0','L','0','0','0') +#define ERRCODE_INVALID_GRANT_OPERATION MAKE_SQLSTATE('0','L','P','0','1') + +/* Class 0P - Invalid Role Specification */ +#define ERRCODE_INVALID_ROLE_SPECIFICATION MAKE_SQLSTATE('0','P','0','0','0') + +/* Class 0Z - Diagnostics Exception */ +#define ERRCODE_DIAGNOSTICS_EXCEPTION MAKE_SQLSTATE('0','Z','0','0','0') +#define ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER MAKE_SQLSTATE('0','Z','0','0','2') + +/* Class 10 - XQuery Error */ +#define ERRCODE_INVALID_ARGUMENT_FOR_XQUERY MAKE_SQLSTATE('1','0','6','0','8') + +/* Class 20 - Case Not Found */ +#define ERRCODE_CASE_NOT_FOUND MAKE_SQLSTATE('2','0','0','0','0') + +/* Class 21 - Cardinality Violation */ +#define ERRCODE_CARDINALITY_VIOLATION MAKE_SQLSTATE('2','1','0','0','0') + +/* Class 22 - Data Exception */ +#define ERRCODE_DATA_EXCEPTION MAKE_SQLSTATE('2','2','0','0','0') +#define ERRCODE_ARRAY_ELEMENT_ERROR MAKE_SQLSTATE('2','2','0','2','E') +#define ERRCODE_ARRAY_SUBSCRIPT_ERROR MAKE_SQLSTATE('2','2','0','2','E') +#define ERRCODE_CHARACTER_NOT_IN_REPERTOIRE MAKE_SQLSTATE('2','2','0','2','1') +#define ERRCODE_DATETIME_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','0','8') +#define ERRCODE_DATETIME_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','8') +#define ERRCODE_DIVISION_BY_ZERO MAKE_SQLSTATE('2','2','0','1','2') +#define ERRCODE_ERROR_IN_ASSIGNMENT MAKE_SQLSTATE('2','2','0','0','5') +#define ERRCODE_ESCAPE_CHARACTER_CONFLICT MAKE_SQLSTATE('2','2','0','0','B') +#define ERRCODE_INDICATOR_OVERFLOW MAKE_SQLSTATE('2','2','0','2','2') +#define ERRCODE_INTERVAL_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','1','5') +#define ERRCODE_INVALID_ARGUMENT_FOR_LOG MAKE_SQLSTATE('2','2','0','1','E') +#define ERRCODE_INVALID_ARGUMENT_FOR_NTILE MAKE_SQLSTATE('2','2','0','1','4') +#define ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE MAKE_SQLSTATE('2','2','0','1','6') +#define ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION MAKE_SQLSTATE('2','2','0','1','F') +#define ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION MAKE_SQLSTATE('2','2','0','1','G') +#define ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST MAKE_SQLSTATE('2','2','0','1','8') +#define ERRCODE_INVALID_DATETIME_FORMAT MAKE_SQLSTATE('2','2','0','0','7') +#define ERRCODE_INVALID_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','1','9') +#define ERRCODE_INVALID_ESCAPE_OCTET MAKE_SQLSTATE('2','2','0','0','D') +#define ERRCODE_INVALID_ESCAPE_SEQUENCE MAKE_SQLSTATE('2','2','0','2','5') +#define ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','P','0','6') +#define ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','1','0') +#define ERRCODE_INVALID_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','2','3') +#define ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE MAKE_SQLSTATE('2','2','0','1','3') +#define ERRCODE_INVALID_REGULAR_EXPRESSION MAKE_SQLSTATE('2','2','0','1','B') +#define ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE MAKE_SQLSTATE('2','2','0','1','W') +#define ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE MAKE_SQLSTATE('2','2','0','1','X') +#define ERRCODE_INVALID_TABLESAMPLE_ARGUMENT MAKE_SQLSTATE('2','2','0','2','H') +#define ERRCODE_INVALID_TABLESAMPLE_REPEAT MAKE_SQLSTATE('2','2','0','2','G') +#define ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE MAKE_SQLSTATE('2','2','0','0','9') +#define ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','0','C') +#define ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH MAKE_SQLSTATE('2','2','0','0','G') +#define ERRCODE_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('2','2','0','0','4') +#define ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER MAKE_SQLSTATE('2','2','0','0','2') +#define ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','3') +#define ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED MAKE_SQLSTATE('2','2','0','0','H') +#define ERRCODE_STRING_DATA_LENGTH_MISMATCH MAKE_SQLSTATE('2','2','0','2','6') +#define ERRCODE_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('2','2','0','0','1') +#define ERRCODE_SUBSTRING_ERROR MAKE_SQLSTATE('2','2','0','1','1') +#define ERRCODE_TRIM_ERROR MAKE_SQLSTATE('2','2','0','2','7') +#define ERRCODE_UNTERMINATED_C_STRING MAKE_SQLSTATE('2','2','0','2','4') +#define ERRCODE_ZERO_LENGTH_CHARACTER_STRING MAKE_SQLSTATE('2','2','0','0','F') +#define ERRCODE_FLOATING_POINT_EXCEPTION MAKE_SQLSTATE('2','2','P','0','1') +#define ERRCODE_INVALID_TEXT_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','2') +#define ERRCODE_INVALID_BINARY_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','3') +#define ERRCODE_BAD_COPY_FILE_FORMAT MAKE_SQLSTATE('2','2','P','0','4') +#define ERRCODE_UNTRANSLATABLE_CHARACTER MAKE_SQLSTATE('2','2','P','0','5') +#define ERRCODE_NOT_AN_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','L') +#define ERRCODE_INVALID_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','M') +#define ERRCODE_INVALID_XML_CONTENT MAKE_SQLSTATE('2','2','0','0','N') +#define ERRCODE_INVALID_XML_COMMENT MAKE_SQLSTATE('2','2','0','0','S') +#define ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION MAKE_SQLSTATE('2','2','0','0','T') +#define ERRCODE_DUPLICATE_JSON_OBJECT_KEY_VALUE MAKE_SQLSTATE('2','2','0','3','0') +#define ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION MAKE_SQLSTATE('2','2','0','3','1') +#define ERRCODE_INVALID_JSON_TEXT MAKE_SQLSTATE('2','2','0','3','2') +#define ERRCODE_INVALID_SQL_JSON_SUBSCRIPT MAKE_SQLSTATE('2','2','0','3','3') +#define ERRCODE_MORE_THAN_ONE_SQL_JSON_ITEM MAKE_SQLSTATE('2','2','0','3','4') +#define ERRCODE_NO_SQL_JSON_ITEM MAKE_SQLSTATE('2','2','0','3','5') +#define ERRCODE_NON_NUMERIC_SQL_JSON_ITEM MAKE_SQLSTATE('2','2','0','3','6') +#define ERRCODE_NON_UNIQUE_KEYS_IN_A_JSON_OBJECT MAKE_SQLSTATE('2','2','0','3','7') +#define ERRCODE_SINGLETON_SQL_JSON_ITEM_REQUIRED MAKE_SQLSTATE('2','2','0','3','8') +#define ERRCODE_SQL_JSON_ARRAY_NOT_FOUND MAKE_SQLSTATE('2','2','0','3','9') +#define ERRCODE_SQL_JSON_MEMBER_NOT_FOUND MAKE_SQLSTATE('2','2','0','3','A') +#define ERRCODE_SQL_JSON_NUMBER_NOT_FOUND MAKE_SQLSTATE('2','2','0','3','B') +#define ERRCODE_SQL_JSON_OBJECT_NOT_FOUND MAKE_SQLSTATE('2','2','0','3','C') +#define ERRCODE_TOO_MANY_JSON_ARRAY_ELEMENTS MAKE_SQLSTATE('2','2','0','3','D') +#define ERRCODE_TOO_MANY_JSON_OBJECT_MEMBERS MAKE_SQLSTATE('2','2','0','3','E') +#define ERRCODE_SQL_JSON_SCALAR_REQUIRED MAKE_SQLSTATE('2','2','0','3','F') +#define ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE MAKE_SQLSTATE('2','2','0','3','G') + +/* Class 23 - Integrity Constraint Violation */ +#define ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('2','3','0','0','0') +#define ERRCODE_RESTRICT_VIOLATION MAKE_SQLSTATE('2','3','0','0','1') +#define ERRCODE_NOT_NULL_VIOLATION MAKE_SQLSTATE('2','3','5','0','2') +#define ERRCODE_FOREIGN_KEY_VIOLATION MAKE_SQLSTATE('2','3','5','0','3') +#define ERRCODE_UNIQUE_VIOLATION MAKE_SQLSTATE('2','3','5','0','5') +#define ERRCODE_CHECK_VIOLATION MAKE_SQLSTATE('2','3','5','1','4') +#define ERRCODE_EXCLUSION_VIOLATION MAKE_SQLSTATE('2','3','P','0','1') + +/* Class 24 - Invalid Cursor State */ +#define ERRCODE_INVALID_CURSOR_STATE MAKE_SQLSTATE('2','4','0','0','0') + +/* Class 25 - Invalid Transaction State */ +#define ERRCODE_INVALID_TRANSACTION_STATE MAKE_SQLSTATE('2','5','0','0','0') +#define ERRCODE_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','1') +#define ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE MAKE_SQLSTATE('2','5','0','0','2') +#define ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL MAKE_SQLSTATE('2','5','0','0','8') +#define ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','3') +#define ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','4') +#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','5') +#define ERRCODE_READ_ONLY_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','6') +#define ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED MAKE_SQLSTATE('2','5','0','0','7') +#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','1') +#define ERRCODE_IN_FAILED_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','2') +#define ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT MAKE_SQLSTATE('2','5','P','0','3') +#define ERRCODE_TRANSACTION_TIMEOUT MAKE_SQLSTATE('2','5','P','0','4') + +/* Class 26 - Invalid SQL Statement Name */ +#define ERRCODE_INVALID_SQL_STATEMENT_NAME MAKE_SQLSTATE('2','6','0','0','0') + +/* Class 27 - Triggered Data Change Violation */ +#define ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION MAKE_SQLSTATE('2','7','0','0','0') + +/* Class 28 - Invalid Authorization Specification */ +#define ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION MAKE_SQLSTATE('2','8','0','0','0') +#define ERRCODE_INVALID_PASSWORD MAKE_SQLSTATE('2','8','P','0','1') + +/* Class 2B - Dependent Privilege Descriptors Still Exist */ +#define ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST MAKE_SQLSTATE('2','B','0','0','0') +#define ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST MAKE_SQLSTATE('2','B','P','0','1') + +/* Class 2D - Invalid Transaction Termination */ +#define ERRCODE_INVALID_TRANSACTION_TERMINATION MAKE_SQLSTATE('2','D','0','0','0') + +/* Class 2F - SQL Routine Exception */ +#define ERRCODE_SQL_ROUTINE_EXCEPTION MAKE_SQLSTATE('2','F','0','0','0') +#define ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT MAKE_SQLSTATE('2','F','0','0','5') +#define ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','2') +#define ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('2','F','0','0','3') +#define ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','4') + +/* Class 34 - Invalid Cursor Name */ +#define ERRCODE_INVALID_CURSOR_NAME MAKE_SQLSTATE('3','4','0','0','0') + +/* Class 38 - External Routine Exception */ +#define ERRCODE_EXTERNAL_ROUTINE_EXCEPTION MAKE_SQLSTATE('3','8','0','0','0') +#define ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','1') +#define ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','2') +#define ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('3','8','0','0','3') +#define ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','4') + +/* Class 39 - External Routine Invocation Exception */ +#define ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION MAKE_SQLSTATE('3','9','0','0','0') +#define ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED MAKE_SQLSTATE('3','9','0','0','1') +#define ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('3','9','0','0','4') +#define ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','1') +#define ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','2') +#define ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','3') + +/* Class 3B - Savepoint Exception */ +#define ERRCODE_SAVEPOINT_EXCEPTION MAKE_SQLSTATE('3','B','0','0','0') +#define ERRCODE_S_E_INVALID_SPECIFICATION MAKE_SQLSTATE('3','B','0','0','1') + +/* Class 3D - Invalid Catalog Name */ +#define ERRCODE_INVALID_CATALOG_NAME MAKE_SQLSTATE('3','D','0','0','0') + +/* Class 3F - Invalid Schema Name */ +#define ERRCODE_INVALID_SCHEMA_NAME MAKE_SQLSTATE('3','F','0','0','0') + +/* Class 40 - Transaction Rollback */ +#define ERRCODE_TRANSACTION_ROLLBACK MAKE_SQLSTATE('4','0','0','0','0') +#define ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('4','0','0','0','2') +#define ERRCODE_T_R_SERIALIZATION_FAILURE MAKE_SQLSTATE('4','0','0','0','1') +#define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN MAKE_SQLSTATE('4','0','0','0','3') +#define ERRCODE_T_R_DEADLOCK_DETECTED MAKE_SQLSTATE('4','0','P','0','1') + +/* Class 42 - Syntax Error or Access Rule Violation */ +#define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION MAKE_SQLSTATE('4','2','0','0','0') +#define ERRCODE_SYNTAX_ERROR MAKE_SQLSTATE('4','2','6','0','1') +#define ERRCODE_INSUFFICIENT_PRIVILEGE MAKE_SQLSTATE('4','2','5','0','1') +#define ERRCODE_CANNOT_COERCE MAKE_SQLSTATE('4','2','8','4','6') +#define ERRCODE_GROUPING_ERROR MAKE_SQLSTATE('4','2','8','0','3') +#define ERRCODE_WINDOWING_ERROR MAKE_SQLSTATE('4','2','P','2','0') +#define ERRCODE_INVALID_RECURSION MAKE_SQLSTATE('4','2','P','1','9') +#define ERRCODE_INVALID_FOREIGN_KEY MAKE_SQLSTATE('4','2','8','3','0') +#define ERRCODE_INVALID_NAME MAKE_SQLSTATE('4','2','6','0','2') +#define ERRCODE_NAME_TOO_LONG MAKE_SQLSTATE('4','2','6','2','2') +#define ERRCODE_RESERVED_NAME MAKE_SQLSTATE('4','2','9','3','9') +#define ERRCODE_DATATYPE_MISMATCH MAKE_SQLSTATE('4','2','8','0','4') +#define ERRCODE_INDETERMINATE_DATATYPE MAKE_SQLSTATE('4','2','P','1','8') +#define ERRCODE_COLLATION_MISMATCH MAKE_SQLSTATE('4','2','P','2','1') +#define ERRCODE_INDETERMINATE_COLLATION MAKE_SQLSTATE('4','2','P','2','2') +#define ERRCODE_WRONG_OBJECT_TYPE MAKE_SQLSTATE('4','2','8','0','9') +#define ERRCODE_GENERATED_ALWAYS MAKE_SQLSTATE('4','2','8','C','9') +#define ERRCODE_UNDEFINED_COLUMN MAKE_SQLSTATE('4','2','7','0','3') +#define ERRCODE_UNDEFINED_CURSOR MAKE_SQLSTATE('3','4','0','0','0') +#define ERRCODE_UNDEFINED_DATABASE MAKE_SQLSTATE('3','D','0','0','0') +#define ERRCODE_UNDEFINED_FUNCTION MAKE_SQLSTATE('4','2','8','8','3') +#define ERRCODE_UNDEFINED_PSTATEMENT MAKE_SQLSTATE('2','6','0','0','0') +#define ERRCODE_UNDEFINED_SCHEMA MAKE_SQLSTATE('3','F','0','0','0') +#define ERRCODE_UNDEFINED_TABLE MAKE_SQLSTATE('4','2','P','0','1') +#define ERRCODE_UNDEFINED_PARAMETER MAKE_SQLSTATE('4','2','P','0','2') +#define ERRCODE_UNDEFINED_OBJECT MAKE_SQLSTATE('4','2','7','0','4') +#define ERRCODE_DUPLICATE_COLUMN MAKE_SQLSTATE('4','2','7','0','1') +#define ERRCODE_DUPLICATE_CURSOR MAKE_SQLSTATE('4','2','P','0','3') +#define ERRCODE_DUPLICATE_DATABASE MAKE_SQLSTATE('4','2','P','0','4') +#define ERRCODE_DUPLICATE_FUNCTION MAKE_SQLSTATE('4','2','7','2','3') +#define ERRCODE_DUPLICATE_PSTATEMENT MAKE_SQLSTATE('4','2','P','0','5') +#define ERRCODE_DUPLICATE_SCHEMA MAKE_SQLSTATE('4','2','P','0','6') +#define ERRCODE_DUPLICATE_TABLE MAKE_SQLSTATE('4','2','P','0','7') +#define ERRCODE_DUPLICATE_ALIAS MAKE_SQLSTATE('4','2','7','1','2') +#define ERRCODE_DUPLICATE_OBJECT MAKE_SQLSTATE('4','2','7','1','0') +#define ERRCODE_AMBIGUOUS_COLUMN MAKE_SQLSTATE('4','2','7','0','2') +#define ERRCODE_AMBIGUOUS_FUNCTION MAKE_SQLSTATE('4','2','7','2','5') +#define ERRCODE_AMBIGUOUS_PARAMETER MAKE_SQLSTATE('4','2','P','0','8') +#define ERRCODE_AMBIGUOUS_ALIAS MAKE_SQLSTATE('4','2','P','0','9') +#define ERRCODE_INVALID_COLUMN_REFERENCE MAKE_SQLSTATE('4','2','P','1','0') +#define ERRCODE_INVALID_COLUMN_DEFINITION MAKE_SQLSTATE('4','2','6','1','1') +#define ERRCODE_INVALID_CURSOR_DEFINITION MAKE_SQLSTATE('4','2','P','1','1') +#define ERRCODE_INVALID_DATABASE_DEFINITION MAKE_SQLSTATE('4','2','P','1','2') +#define ERRCODE_INVALID_FUNCTION_DEFINITION MAKE_SQLSTATE('4','2','P','1','3') +#define ERRCODE_INVALID_PSTATEMENT_DEFINITION MAKE_SQLSTATE('4','2','P','1','4') +#define ERRCODE_INVALID_SCHEMA_DEFINITION MAKE_SQLSTATE('4','2','P','1','5') +#define ERRCODE_INVALID_TABLE_DEFINITION MAKE_SQLSTATE('4','2','P','1','6') +#define ERRCODE_INVALID_OBJECT_DEFINITION MAKE_SQLSTATE('4','2','P','1','7') + +/* Class 44 - WITH CHECK OPTION Violation */ +#define ERRCODE_WITH_CHECK_OPTION_VIOLATION MAKE_SQLSTATE('4','4','0','0','0') + +/* Class 53 - Insufficient Resources */ +#define ERRCODE_INSUFFICIENT_RESOURCES MAKE_SQLSTATE('5','3','0','0','0') +#define ERRCODE_DISK_FULL MAKE_SQLSTATE('5','3','1','0','0') +#define ERRCODE_OUT_OF_MEMORY MAKE_SQLSTATE('5','3','2','0','0') +#define ERRCODE_TOO_MANY_CONNECTIONS MAKE_SQLSTATE('5','3','3','0','0') +#define ERRCODE_CONFIGURATION_LIMIT_EXCEEDED MAKE_SQLSTATE('5','3','4','0','0') + +/* Class 54 - Program Limit Exceeded */ +#define ERRCODE_PROGRAM_LIMIT_EXCEEDED MAKE_SQLSTATE('5','4','0','0','0') +#define ERRCODE_STATEMENT_TOO_COMPLEX MAKE_SQLSTATE('5','4','0','0','1') +#define ERRCODE_TOO_MANY_COLUMNS MAKE_SQLSTATE('5','4','0','1','1') +#define ERRCODE_TOO_MANY_ARGUMENTS MAKE_SQLSTATE('5','4','0','2','3') + +/* Class 55 - Object Not In Prerequisite State */ +#define ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE MAKE_SQLSTATE('5','5','0','0','0') +#define ERRCODE_OBJECT_IN_USE MAKE_SQLSTATE('5','5','0','0','6') +#define ERRCODE_CANT_CHANGE_RUNTIME_PARAM MAKE_SQLSTATE('5','5','P','0','2') +#define ERRCODE_LOCK_NOT_AVAILABLE MAKE_SQLSTATE('5','5','P','0','3') +#define ERRCODE_UNSAFE_NEW_ENUM_VALUE_USAGE MAKE_SQLSTATE('5','5','P','0','4') + +/* Class 57 - Operator Intervention */ +#define ERRCODE_OPERATOR_INTERVENTION MAKE_SQLSTATE('5','7','0','0','0') +#define ERRCODE_QUERY_CANCELED MAKE_SQLSTATE('5','7','0','1','4') +#define ERRCODE_ADMIN_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','1') +#define ERRCODE_CRASH_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','2') +#define ERRCODE_CANNOT_CONNECT_NOW MAKE_SQLSTATE('5','7','P','0','3') +#define ERRCODE_DATABASE_DROPPED MAKE_SQLSTATE('5','7','P','0','4') +#define ERRCODE_IDLE_SESSION_TIMEOUT MAKE_SQLSTATE('5','7','P','0','5') + +/* Class 58 - System Error (errors external to PostgreSQL itself) */ +#define ERRCODE_SYSTEM_ERROR MAKE_SQLSTATE('5','8','0','0','0') +#define ERRCODE_IO_ERROR MAKE_SQLSTATE('5','8','0','3','0') +#define ERRCODE_UNDEFINED_FILE MAKE_SQLSTATE('5','8','P','0','1') +#define ERRCODE_DUPLICATE_FILE MAKE_SQLSTATE('5','8','P','0','2') +#define ERRCODE_FILE_NAME_TOO_LONG MAKE_SQLSTATE('5','8','P','0','3') + +/* Class F0 - Configuration File Error */ +#define ERRCODE_CONFIG_FILE_ERROR MAKE_SQLSTATE('F','0','0','0','0') +#define ERRCODE_LOCK_FILE_EXISTS MAKE_SQLSTATE('F','0','0','0','1') + +/* Class HV - Foreign Data Wrapper Error (SQL/MED) */ +#define ERRCODE_FDW_ERROR MAKE_SQLSTATE('H','V','0','0','0') +#define ERRCODE_FDW_COLUMN_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','5') +#define ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED MAKE_SQLSTATE('H','V','0','0','2') +#define ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR MAKE_SQLSTATE('H','V','0','1','0') +#define ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION MAKE_SQLSTATE('H','V','0','2','1') +#define ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE MAKE_SQLSTATE('H','V','0','2','4') +#define ERRCODE_FDW_INVALID_COLUMN_NAME MAKE_SQLSTATE('H','V','0','0','7') +#define ERRCODE_FDW_INVALID_COLUMN_NUMBER MAKE_SQLSTATE('H','V','0','0','8') +#define ERRCODE_FDW_INVALID_DATA_TYPE MAKE_SQLSTATE('H','V','0','0','4') +#define ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS MAKE_SQLSTATE('H','V','0','0','6') +#define ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER MAKE_SQLSTATE('H','V','0','9','1') +#define ERRCODE_FDW_INVALID_HANDLE MAKE_SQLSTATE('H','V','0','0','B') +#define ERRCODE_FDW_INVALID_OPTION_INDEX MAKE_SQLSTATE('H','V','0','0','C') +#define ERRCODE_FDW_INVALID_OPTION_NAME MAKE_SQLSTATE('H','V','0','0','D') +#define ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH MAKE_SQLSTATE('H','V','0','9','0') +#define ERRCODE_FDW_INVALID_STRING_FORMAT MAKE_SQLSTATE('H','V','0','0','A') +#define ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER MAKE_SQLSTATE('H','V','0','0','9') +#define ERRCODE_FDW_TOO_MANY_HANDLES MAKE_SQLSTATE('H','V','0','1','4') +#define ERRCODE_FDW_OUT_OF_MEMORY MAKE_SQLSTATE('H','V','0','0','1') +#define ERRCODE_FDW_NO_SCHEMAS MAKE_SQLSTATE('H','V','0','0','P') +#define ERRCODE_FDW_OPTION_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','J') +#define ERRCODE_FDW_REPLY_HANDLE MAKE_SQLSTATE('H','V','0','0','K') +#define ERRCODE_FDW_SCHEMA_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','Q') +#define ERRCODE_FDW_TABLE_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','R') +#define ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION MAKE_SQLSTATE('H','V','0','0','L') +#define ERRCODE_FDW_UNABLE_TO_CREATE_REPLY MAKE_SQLSTATE('H','V','0','0','M') +#define ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION MAKE_SQLSTATE('H','V','0','0','N') + +/* Class P0 - PL/pgSQL Error */ +#define ERRCODE_PLPGSQL_ERROR MAKE_SQLSTATE('P','0','0','0','0') +#define ERRCODE_RAISE_EXCEPTION MAKE_SQLSTATE('P','0','0','0','1') +#define ERRCODE_NO_DATA_FOUND MAKE_SQLSTATE('P','0','0','0','2') +#define ERRCODE_TOO_MANY_ROWS MAKE_SQLSTATE('P','0','0','0','3') +#define ERRCODE_ASSERT_FAILURE MAKE_SQLSTATE('P','0','0','0','4') + +/* Class XX - Internal Error */ +#define ERRCODE_INTERNAL_ERROR MAKE_SQLSTATE('X','X','0','0','0') +#define ERRCODE_DATA_CORRUPTED MAKE_SQLSTATE('X','X','0','0','1') +#define ERRCODE_INDEX_CORRUPTED MAKE_SQLSTATE('X','X','0','0','2') diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/evtcache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/evtcache.h new file mode 100644 index 0000000..9d9fcb8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/evtcache.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * evtcache.h + * Special-purpose cache for event trigger data. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/utils/evtcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef EVTCACHE_H +#define EVTCACHE_H + +#include "nodes/bitmapset.h" +#include "nodes/pg_list.h" + +typedef enum +{ + EVT_DDLCommandStart, + EVT_DDLCommandEnd, + EVT_SQLDrop, + EVT_TableRewrite, + EVT_Login, +} EventTriggerEvent; + +typedef struct +{ + Oid fnoid; /* function to be called */ + char enabled; /* as SESSION_REPLICATION_ROLE_* */ + Bitmapset *tagset; /* command tags, or NULL if empty */ +} EventTriggerCacheItem; + +extern List *EventCacheLookup(EventTriggerEvent event); + +#endif /* EVTCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/expandeddatum.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/expandeddatum.h new file mode 100644 index 0000000..cde9a0c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/expandeddatum.h @@ -0,0 +1,170 @@ +/*------------------------------------------------------------------------- + * + * expandeddatum.h + * Declarations for access to "expanded" value representations. + * + * Complex data types, particularly container types such as arrays and + * records, usually have on-disk representations that are compact but not + * especially convenient to modify. What's more, when we do modify them, + * having to recopy all the rest of the value can be extremely inefficient. + * Therefore, we provide a notion of an "expanded" representation that is used + * only in memory and is optimized more for computation than storage. + * The format appearing on disk is called the data type's "flattened" + * representation, since it is required to be a contiguous blob of bytes -- + * but the type can have an expanded representation that is not. Data types + * must provide means to translate an expanded representation back to + * flattened form. + * + * An expanded object is meant to survive across multiple operations, but + * not to be enormously long-lived; for example it might be a local variable + * in a PL/pgSQL procedure. So its extra bulk compared to the on-disk format + * is a worthwhile trade-off. + * + * References to expanded objects are a type of TOAST pointer. + * Because of longstanding conventions in Postgres, this means that the + * flattened form of such an object must always be a varlena object. + * Fortunately that's no restriction in practice. + * + * There are actually two kinds of TOAST pointers for expanded objects: + * read-only and read-write pointers. Possession of one of the latter + * authorizes a function to modify the value in-place rather than copying it + * as would normally be required. Functions should always return a read-write + * pointer to any new expanded object they create. Functions that modify an + * argument value in-place must take care that they do not corrupt the old + * value if they fail partway through. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/expandeddatum.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPANDEDDATUM_H +#define EXPANDEDDATUM_H + +#include "varatt.h" + +/* Size of an EXTERNAL datum that contains a pointer to an expanded object */ +#define EXPANDED_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(varatt_expanded)) + +/* + * "Methods" that must be provided for any expanded object. + * + * get_flat_size: compute space needed for flattened representation (total, + * including header). + * + * flatten_into: construct flattened representation in the caller-allocated + * space at *result, of size allocated_size (which will always be the result + * of a preceding get_flat_size call; it's passed for cross-checking). + * + * The flattened representation must be a valid in-line, non-compressed, + * 4-byte-header varlena object. + * + * Note: construction of a heap tuple from an expanded datum calls + * get_flat_size twice, so it's worthwhile to make sure that that doesn't + * incur too much overhead. + */ +typedef Size (*EOM_get_flat_size_method) (ExpandedObjectHeader *eohptr); +typedef void (*EOM_flatten_into_method) (ExpandedObjectHeader *eohptr, + void *result, Size allocated_size); + +/* Struct of function pointers for an expanded object's methods */ +typedef struct ExpandedObjectMethods +{ + EOM_get_flat_size_method get_flat_size; + EOM_flatten_into_method flatten_into; +} ExpandedObjectMethods; + +/* + * Every expanded object must contain this header; typically the header + * is embedded in some larger struct that adds type-specific fields. + * + * It is presumed that the header object and all subsidiary data are stored + * in eoh_context, so that the object can be freed by deleting that context, + * or its storage lifespan can be altered by reparenting the context. + * (In principle the object could own additional resources, such as malloc'd + * storage, and use a memory context reset callback to free them upon reset or + * deletion of eoh_context.) + * + * We set up two TOAST pointers within the standard header, one read-write + * and one read-only. This allows functions to return either kind of pointer + * without making an additional allocation, and in particular without worrying + * whether a separately palloc'd object would have sufficient lifespan. + * But note that these pointers are just a convenience; a pointer object + * appearing somewhere else would still be legal. + * + * The typedef declaration for this appears in postgres.h. + */ +struct ExpandedObjectHeader +{ + /* Phony varlena header */ + int32 vl_len_; /* always EOH_HEADER_MAGIC, see below */ + + /* Pointer to methods required for object type */ + const ExpandedObjectMethods *eoh_methods; + + /* Memory context containing this header and subsidiary data */ + MemoryContext eoh_context; + + /* Standard R/W TOAST pointer for this object is kept here */ + char eoh_rw_ptr[EXPANDED_POINTER_SIZE]; + + /* Standard R/O TOAST pointer for this object is kept here */ + char eoh_ro_ptr[EXPANDED_POINTER_SIZE]; +}; + +/* + * Particularly for read-only functions, it is handy to be able to work with + * either regular "flat" varlena inputs or expanded inputs of the same data + * type. To allow determining which case an argument-fetching function has + * returned, the first int32 of an ExpandedObjectHeader always contains -1 + * (EOH_HEADER_MAGIC to the code). This works since no 4-byte-header varlena + * could have that as its first 4 bytes. Caution: we could not reliably tell + * the difference between an ExpandedObjectHeader and a short-header object + * with this trick. However, it works fine if the argument fetching code + * always returns either a 4-byte-header flat object or an expanded object. + */ +#define EOH_HEADER_MAGIC (-1) +#define VARATT_IS_EXPANDED_HEADER(PTR) \ + (((varattrib_4b *) (PTR))->va_4byte.va_header == (uint32) EOH_HEADER_MAGIC) + +/* + * Generic support functions for expanded objects. + * (More of these might be worth inlining later.) + */ + +static inline Datum +EOHPGetRWDatum(const struct ExpandedObjectHeader *eohptr) +{ + return PointerGetDatum(eohptr->eoh_rw_ptr); +} + +static inline Datum +EOHPGetRODatum(const struct ExpandedObjectHeader *eohptr) +{ + return PointerGetDatum(eohptr->eoh_ro_ptr); +} + +/* Does the Datum represent a writable expanded object? */ +#define DatumIsReadWriteExpandedObject(d, isnull, typlen) \ + (((isnull) || (typlen) != -1) ? false : \ + VARATT_IS_EXTERNAL_EXPANDED_RW(DatumGetPointer(d))) + +#define MakeExpandedObjectReadOnly(d, isnull, typlen) \ + (((isnull) || (typlen) != -1) ? (d) : \ + MakeExpandedObjectReadOnlyInternal(d)) + +extern ExpandedObjectHeader *DatumGetEOHP(Datum d); +extern void EOH_init_header(ExpandedObjectHeader *eohptr, + const ExpandedObjectMethods *methods, + MemoryContext obj_context); +extern Size EOH_get_flat_size(ExpandedObjectHeader *eohptr); +extern void EOH_flatten_into(ExpandedObjectHeader *eohptr, + void *result, Size allocated_size); +extern Datum MakeExpandedObjectReadOnlyInternal(Datum d); +extern Datum TransferExpandedObject(Datum d, MemoryContext new_parent); +extern void DeleteExpandedObject(Datum d); + +#endif /* EXPANDEDDATUM_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/expandedrecord.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/expandedrecord.h new file mode 100644 index 0000000..4e5cbc4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/expandedrecord.h @@ -0,0 +1,241 @@ +/*------------------------------------------------------------------------- + * + * expandedrecord.h + * Declarations for composite expanded objects. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/expandedrecord.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPANDEDRECORD_H +#define EXPANDEDRECORD_H + +#include "access/htup.h" +#include "access/tupdesc.h" +#include "fmgr.h" +#include "utils/expandeddatum.h" + + +/* + * An expanded record is contained within a private memory context (as + * all expanded objects must be) and has a control structure as below. + * + * The expanded record might contain a regular "flat" tuple if that was the + * original input and we've not modified it. Otherwise, the contents are + * represented by Datum/isnull arrays plus type information. We could also + * have both forms, if we've deconstructed the original tuple for access + * purposes but not yet changed it. For pass-by-reference field types, the + * Datums would point into the flat tuple in this situation. Once we start + * modifying tuple fields, new pass-by-ref fields are separately palloc'd + * within the memory context. + * + * It's possible to build an expanded record that references a "flat" tuple + * stored externally, if the caller can guarantee that that tuple will not + * change for the lifetime of the expanded record. (This frammish is mainly + * meant to avoid unnecessary data copying in trigger functions.) + */ +#define ER_MAGIC 1384727874 /* ID for debugging crosschecks */ + +typedef struct ExpandedRecordHeader +{ + /* Standard header for expanded objects */ + ExpandedObjectHeader hdr; + + /* Magic value identifying an expanded record (for debugging only) */ + int er_magic; + + /* Assorted flag bits */ + int flags; +#define ER_FLAG_FVALUE_VALID 0x0001 /* fvalue is up to date? */ +#define ER_FLAG_FVALUE_ALLOCED 0x0002 /* fvalue is local storage? */ +#define ER_FLAG_DVALUES_VALID 0x0004 /* dvalues/dnulls are up to date? */ +#define ER_FLAG_DVALUES_ALLOCED 0x0008 /* any field values local storage? */ +#define ER_FLAG_HAVE_EXTERNAL 0x0010 /* any field values are external? */ +#define ER_FLAG_TUPDESC_ALLOCED 0x0020 /* tupdesc is local storage? */ +#define ER_FLAG_IS_DOMAIN 0x0040 /* er_decltypeid is domain? */ +#define ER_FLAG_IS_DUMMY 0x0080 /* this header is dummy (see below) */ +/* flag bits that are not to be cleared when replacing tuple data: */ +#define ER_FLAGS_NON_DATA \ + (ER_FLAG_TUPDESC_ALLOCED | ER_FLAG_IS_DOMAIN | ER_FLAG_IS_DUMMY) + + /* Declared type of the record variable (could be a domain type) */ + Oid er_decltypeid; + + /* + * Actual composite type/typmod; never a domain (if ER_FLAG_IS_DOMAIN, + * these identify the composite base type). These will match + * er_tupdesc->tdtypeid/tdtypmod, as well as the header fields of + * composite datums made from or stored in this expanded record. + */ + Oid er_typeid; /* type OID of the composite type */ + int32 er_typmod; /* typmod of the composite type */ + + /* + * Tuple descriptor, if we have one, else NULL. This may point to a + * reference-counted tupdesc originally belonging to the typcache, in + * which case we use a memory context reset callback to release the + * refcount. It can also be locally allocated in this object's private + * context (in which case ER_FLAG_TUPDESC_ALLOCED is set). + */ + TupleDesc er_tupdesc; + + /* + * Unique-within-process identifier for the tupdesc (see typcache.h). This + * field will never be equal to INVALID_TUPLEDESC_IDENTIFIER. + */ + uint64 er_tupdesc_id; + + /* + * If we have a Datum-array representation of the record, it's kept here; + * else ER_FLAG_DVALUES_VALID is not set, and dvalues/dnulls may be NULL + * if they've not yet been allocated. If allocated, the dvalues and + * dnulls arrays are palloc'd within the object private context, and are + * of length matching er_tupdesc->natts. For pass-by-ref field types, + * dvalues entries might point either into the fstartptr..fendptr area, or + * to separately palloc'd chunks. + */ + Datum *dvalues; /* array of Datums */ + bool *dnulls; /* array of is-null flags for Datums */ + int nfields; /* length of above arrays */ + + /* + * flat_size is the current space requirement for the flat equivalent of + * the expanded record, if known; otherwise it's 0. We store this to make + * consecutive calls of get_flat_size cheap. If flat_size is not 0, the + * component values data_len, hoff, and hasnull must be valid too. + */ + Size flat_size; + + Size data_len; /* data len within flat_size */ + int hoff; /* header offset */ + bool hasnull; /* null bitmap needed? */ + + /* + * fvalue points to the flat representation if we have one, else it is + * NULL. If the flat representation is valid (up to date) then + * ER_FLAG_FVALUE_VALID is set. Even if we've outdated the flat + * representation due to changes of user fields, it can still be used to + * fetch system column values. If we have a flat representation then + * fstartptr/fendptr point to the start and end+1 of its data area; this + * is so that we can tell which Datum pointers point into the flat + * representation rather than being pointers to separately palloc'd data. + */ + HeapTuple fvalue; /* might or might not be private storage */ + char *fstartptr; /* start of its data area */ + char *fendptr; /* end+1 of its data area */ + + /* Some operations on the expanded record need a short-lived context */ + MemoryContext er_short_term_cxt; /* short-term memory context */ + + /* Working state for domain checking, used if ER_FLAG_IS_DOMAIN is set */ + struct ExpandedRecordHeader *er_dummy_header; /* dummy record header */ + void *er_domaininfo; /* cache space for domain_check() */ + + /* Callback info (it's active if er_mcb.arg is not NULL) */ + MemoryContextCallback er_mcb; +} ExpandedRecordHeader; + +/* fmgr functions and macros for expanded record objects */ +static inline Datum +ExpandedRecordGetDatum(const ExpandedRecordHeader *erh) +{ + return EOHPGetRWDatum(&erh->hdr); +} + +static inline Datum +ExpandedRecordGetRODatum(const ExpandedRecordHeader *erh) +{ + return EOHPGetRODatum(&erh->hdr); +} + +#define PG_GETARG_EXPANDED_RECORD(n) DatumGetExpandedRecord(PG_GETARG_DATUM(n)) +#define PG_RETURN_EXPANDED_RECORD(x) PG_RETURN_DATUM(ExpandedRecordGetDatum(x)) + +/* assorted other macros */ +#define ExpandedRecordIsEmpty(erh) \ + (((erh)->flags & (ER_FLAG_DVALUES_VALID | ER_FLAG_FVALUE_VALID)) == 0) +#define ExpandedRecordIsDomain(erh) \ + (((erh)->flags & ER_FLAG_IS_DOMAIN) != 0) + +/* this can substitute for TransferExpandedObject() when we already have erh */ +#define TransferExpandedRecord(erh, cxt) \ + MemoryContextSetParent((erh)->hdr.eoh_context, cxt) + +/* information returned by expanded_record_lookup_field() */ +typedef struct ExpandedRecordFieldInfo +{ + int fnumber; /* field's attr number in record */ + Oid ftypeid; /* field's type/typmod info */ + int32 ftypmod; + Oid fcollation; /* field's collation if any */ +} ExpandedRecordFieldInfo; + +/* + * prototypes for functions defined in expandedrecord.c + */ +extern ExpandedRecordHeader *make_expanded_record_from_typeid(Oid type_id, int32 typmod, + MemoryContext parentcontext); +extern ExpandedRecordHeader *make_expanded_record_from_tupdesc(TupleDesc tupdesc, + MemoryContext parentcontext); +extern ExpandedRecordHeader *make_expanded_record_from_exprecord(ExpandedRecordHeader *olderh, + MemoryContext parentcontext); +extern void expanded_record_set_tuple(ExpandedRecordHeader *erh, + HeapTuple tuple, bool copy, bool expand_external); +extern Datum make_expanded_record_from_datum(Datum recorddatum, + MemoryContext parentcontext); +extern TupleDesc expanded_record_fetch_tupdesc(ExpandedRecordHeader *erh); +extern HeapTuple expanded_record_get_tuple(ExpandedRecordHeader *erh); +extern ExpandedRecordHeader *DatumGetExpandedRecord(Datum d); +extern void deconstruct_expanded_record(ExpandedRecordHeader *erh); +extern bool expanded_record_lookup_field(ExpandedRecordHeader *erh, + const char *fieldname, + ExpandedRecordFieldInfo *finfo); +extern Datum expanded_record_fetch_field(ExpandedRecordHeader *erh, int fnumber, + bool *isnull); +extern void expanded_record_set_field_internal(ExpandedRecordHeader *erh, + int fnumber, + Datum newValue, bool isnull, + bool expand_external, + bool check_constraints); +extern void expanded_record_set_fields(ExpandedRecordHeader *erh, + const Datum *newValues, const bool *isnulls, + bool expand_external); + +/* outside code should never call expanded_record_set_field_internal as such */ +#define expanded_record_set_field(erh, fnumber, newValue, isnull, expand_external) \ + expanded_record_set_field_internal(erh, fnumber, newValue, isnull, expand_external, true) + +/* + * Inline-able fast cases. The expanded_record_fetch_xxx functions above + * handle the general cases. + */ + +/* Get the tupdesc for the expanded record's actual type */ +static inline TupleDesc +expanded_record_get_tupdesc(ExpandedRecordHeader *erh) +{ + if (likely(erh->er_tupdesc != NULL)) + return erh->er_tupdesc; + else + return expanded_record_fetch_tupdesc(erh); +} + +/* Get value of record field */ +static inline Datum +expanded_record_get_field(ExpandedRecordHeader *erh, int fnumber, + bool *isnull) +{ + if ((erh->flags & ER_FLAG_DVALUES_VALID) && + likely(fnumber > 0 && fnumber <= erh->nfields)) + { + *isnull = erh->dnulls[fnumber - 1]; + return erh->dvalues[fnumber - 1]; + } + else + return expanded_record_fetch_field(erh, fnumber, isnull); +} + +#endif /* EXPANDEDRECORD_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/float.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/float.h new file mode 100644 index 0000000..0e2e9ec --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/float.h @@ -0,0 +1,357 @@ +/*------------------------------------------------------------------------- + * + * float.h + * Definitions for the built-in floating-point types + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * + * IDENTIFICATION + * src/include/utils/float.h + * + *------------------------------------------------------------------------- + */ +#ifndef FLOAT_H +#define FLOAT_H + +#include + +/* X/Open (XSI) requires to provide M_PI, but core POSIX does not */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +/* Radians per degree, a.k.a. PI / 180 */ +#define RADIANS_PER_DEGREE 0.0174532925199432957692 + +/* Visual C++ etc lacks NAN, and won't accept 0.0/0.0. */ +#if defined(WIN32) && !defined(NAN) +static const uint32 nan[2] = {0xffffffff, 0x7fffffff}; + +#define NAN (*(const float8 *) nan) +#endif + +extern PGDLLIMPORT int extra_float_digits; + +/* + * Utility functions in float.c + */ +pg_noreturn extern void float_overflow_error(void); +pg_noreturn extern void float_underflow_error(void); +pg_noreturn extern void float_zero_divide_error(void); +extern int is_infinite(float8 val); +extern float8 float8in_internal(char *num, char **endptr_p, + const char *type_name, const char *orig_string, + struct Node *escontext); +extern float4 float4in_internal(char *num, char **endptr_p, + const char *type_name, const char *orig_string, + struct Node *escontext); +extern char *float8out_internal(float8 num); +extern int float4_cmp_internal(float4 a, float4 b); +extern int float8_cmp_internal(float8 a, float8 b); + +/* + * Routines to provide reasonably platform-independent handling of + * infinity and NaN + * + * We assume that isinf() and isnan() are available and work per spec. + * (On some platforms, we have to supply our own; see src/port.) However, + * generating an Infinity or NaN in the first place is less well standardized; + * pre-C99 systems tend not to have C99's INFINITY and NaN macros. We + * centralize our workarounds for this here. + */ + +/* + * The funny placements of the two #pragmas is necessary because of a + * long lived bug in the Microsoft compilers. + * See http://support.microsoft.com/kb/120968/en-us for details + */ +#ifdef _MSC_VER +#pragma warning(disable:4756) +#endif +static inline float4 +get_float4_infinity(void) +{ +#ifdef INFINITY + /* C99 standard way */ + return (float4) INFINITY; +#else +#ifdef _MSC_VER +#pragma warning(default:4756) +#endif + + /* + * On some platforms, HUGE_VAL is an infinity, elsewhere it's just the + * largest normal float8. We assume forcing an overflow will get us a + * true infinity. + */ + return (float4) (HUGE_VAL * HUGE_VAL); +#endif +} + +static inline float8 +get_float8_infinity(void) +{ +#ifdef INFINITY + /* C99 standard way */ + return (float8) INFINITY; +#else + + /* + * On some platforms, HUGE_VAL is an infinity, elsewhere it's just the + * largest normal float8. We assume forcing an overflow will get us a + * true infinity. + */ + return (float8) (HUGE_VAL * HUGE_VAL); +#endif +} + +static inline float4 +get_float4_nan(void) +{ +#ifdef NAN + /* C99 standard way */ + return (float4) NAN; +#else + /* Assume we can get a NAN via zero divide */ + return (float4) (0.0 / 0.0); +#endif +} + +static inline float8 +get_float8_nan(void) +{ + /* (float8) NAN doesn't work on some NetBSD/MIPS releases */ +#if defined(NAN) && !(defined(__NetBSD__) && defined(__mips__)) + /* C99 standard way */ + return (float8) NAN; +#else + /* Assume we can get a NaN via zero divide */ + return (float8) (0.0 / 0.0); +#endif +} + +/* + * Floating-point arithmetic with overflow/underflow reported as errors + * + * There isn't any way to check for underflow of addition/subtraction + * because numbers near the underflow value have already been rounded to + * the point where we can't detect that the two values were originally + * different, e.g. on x86, '1e-45'::float4 == '2e-45'::float4 == + * 1.4013e-45. + */ + +static inline float4 +float4_pl(const float4 val1, const float4 val2) +{ + float4 result; + + result = val1 + val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + + return result; +} + +static inline float8 +float8_pl(const float8 val1, const float8 val2) +{ + float8 result; + + result = val1 + val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + + return result; +} + +static inline float4 +float4_mi(const float4 val1, const float4 val2) +{ + float4 result; + + result = val1 - val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + + return result; +} + +static inline float8 +float8_mi(const float8 val1, const float8 val2) +{ + float8 result; + + result = val1 - val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + + return result; +} + +static inline float4 +float4_mul(const float4 val1, const float4 val2) +{ + float4 result; + + result = val1 * val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + if (unlikely(result == 0.0f) && val1 != 0.0f && val2 != 0.0f) + float_underflow_error(); + + return result; +} + +static inline float8 +float8_mul(const float8 val1, const float8 val2) +{ + float8 result; + + result = val1 * val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + if (unlikely(result == 0.0) && val1 != 0.0 && val2 != 0.0) + float_underflow_error(); + + return result; +} + +static inline float4 +float4_div(const float4 val1, const float4 val2) +{ + float4 result; + + if (unlikely(val2 == 0.0f) && !isnan(val1)) + float_zero_divide_error(); + result = val1 / val2; + if (unlikely(isinf(result)) && !isinf(val1)) + float_overflow_error(); + if (unlikely(result == 0.0f) && val1 != 0.0f && !isinf(val2)) + float_underflow_error(); + + return result; +} + +static inline float8 +float8_div(const float8 val1, const float8 val2) +{ + float8 result; + + if (unlikely(val2 == 0.0) && !isnan(val1)) + float_zero_divide_error(); + result = val1 / val2; + if (unlikely(isinf(result)) && !isinf(val1)) + float_overflow_error(); + if (unlikely(result == 0.0) && val1 != 0.0 && !isinf(val2)) + float_underflow_error(); + + return result; +} + +/* + * Routines for NaN-aware comparisons + * + * We consider all NaNs to be equal and larger than any non-NaN. This is + * somewhat arbitrary; the important thing is to have a consistent sort + * order. + */ + +static inline bool +float4_eq(const float4 val1, const float4 val2) +{ + return isnan(val1) ? isnan(val2) : !isnan(val2) && val1 == val2; +} + +static inline bool +float8_eq(const float8 val1, const float8 val2) +{ + return isnan(val1) ? isnan(val2) : !isnan(val2) && val1 == val2; +} + +static inline bool +float4_ne(const float4 val1, const float4 val2) +{ + return isnan(val1) ? !isnan(val2) : isnan(val2) || val1 != val2; +} + +static inline bool +float8_ne(const float8 val1, const float8 val2) +{ + return isnan(val1) ? !isnan(val2) : isnan(val2) || val1 != val2; +} + +static inline bool +float4_lt(const float4 val1, const float4 val2) +{ + return !isnan(val1) && (isnan(val2) || val1 < val2); +} + +static inline bool +float8_lt(const float8 val1, const float8 val2) +{ + return !isnan(val1) && (isnan(val2) || val1 < val2); +} + +static inline bool +float4_le(const float4 val1, const float4 val2) +{ + return isnan(val2) || (!isnan(val1) && val1 <= val2); +} + +static inline bool +float8_le(const float8 val1, const float8 val2) +{ + return isnan(val2) || (!isnan(val1) && val1 <= val2); +} + +static inline bool +float4_gt(const float4 val1, const float4 val2) +{ + return !isnan(val2) && (isnan(val1) || val1 > val2); +} + +static inline bool +float8_gt(const float8 val1, const float8 val2) +{ + return !isnan(val2) && (isnan(val1) || val1 > val2); +} + +static inline bool +float4_ge(const float4 val1, const float4 val2) +{ + return isnan(val1) || (!isnan(val2) && val1 >= val2); +} + +static inline bool +float8_ge(const float8 val1, const float8 val2) +{ + return isnan(val1) || (!isnan(val2) && val1 >= val2); +} + +static inline float4 +float4_min(const float4 val1, const float4 val2) +{ + return float4_lt(val1, val2) ? val1 : val2; +} + +static inline float8 +float8_min(const float8 val1, const float8 val2) +{ + return float8_lt(val1, val2) ? val1 : val2; +} + +static inline float4 +float4_max(const float4 val1, const float4 val2) +{ + return float4_gt(val1, val2) ? val1 : val2; +} + +static inline float8 +float8_max(const float8 val1, const float8 val2) +{ + return float8_gt(val1, val2) ? val1 : val2; +} + +#endif /* FLOAT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/fmgroids.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/fmgroids.h new file mode 100644 index 0000000..856a685 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/fmgroids.h @@ -0,0 +1,3430 @@ +/*------------------------------------------------------------------------- + * + * fmgroids.h + * Macros that define the OIDs of built-in functions. + * + * These macros can be used to avoid a catalog lookup when a specific + * fmgr-callable function needs to be referenced. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/utils/Gen_fmgrtab.pl + * + *------------------------------------------------------------------------- + */ +#ifndef FMGROIDS_H +#define FMGROIDS_H + +/* + * Constant macros for the OIDs of entries in pg_proc. + * + * F_XXX macros are named after the proname field; if that is not unique, + * we append the proargtypes field, replacing spaces with underscores. + * For example, we have F_OIDEQ because that proname is unique, but + * F_POW_FLOAT8_FLOAT8 (among others) because that proname is not. + */ +#define F_HEAP_TABLEAM_HANDLER 3 +#define F_BYTEAOUT 31 +#define F_CHAROUT 33 +#define F_NAMEIN 34 +#define F_NAMEOUT 35 +#define F_INT2IN 38 +#define F_INT2OUT 39 +#define F_INT2VECTORIN 40 +#define F_INT2VECTOROUT 41 +#define F_INT4IN 42 +#define F_INT4OUT 43 +#define F_REGPROCIN 44 +#define F_REGPROCOUT 45 +#define F_TEXTIN 46 +#define F_TEXTOUT 47 +#define F_TIDIN 48 +#define F_TIDOUT 49 +#define F_XIDIN 50 +#define F_XIDOUT 51 +#define F_CIDIN 52 +#define F_CIDOUT 53 +#define F_OIDVECTORIN 54 +#define F_OIDVECTOROUT 55 +#define F_BOOLLT 56 +#define F_BOOLGT 57 +#define F_BOOLEQ 60 +#define F_CHAREQ 61 +#define F_NAMEEQ 62 +#define F_INT2EQ 63 +#define F_INT2LT 64 +#define F_INT4EQ 65 +#define F_INT4LT 66 +#define F_TEXTEQ 67 +#define F_XIDEQ 68 +#define F_CIDEQ 69 +#define F_CHARNE 70 +#define F_CHARLE 72 +#define F_CHARGT 73 +#define F_CHARGE 74 +#define F_INT4_CHAR 77 +#define F_CHAR_INT4 78 +#define F_NAMEREGEXEQ 79 +#define F_BOOLNE 84 +#define F_PG_DDL_COMMAND_IN 86 +#define F_PG_DDL_COMMAND_OUT 87 +#define F_PG_DDL_COMMAND_RECV 88 +#define F_VERSION 89 +#define F_PG_DDL_COMMAND_SEND 90 +#define F_EQSEL 101 +#define F_NEQSEL 102 +#define F_SCALARLTSEL 103 +#define F_SCALARGTSEL 104 +#define F_EQJOINSEL 105 +#define F_NEQJOINSEL 106 +#define F_SCALARLTJOINSEL 107 +#define F_SCALARGTJOINSEL 108 +#define F_UNKNOWNIN 109 +#define F_UNKNOWNOUT 110 +#define F_BOX_ABOVE_EQ 115 +#define F_BOX_BELOW_EQ 116 +#define F_POINT_IN 117 +#define F_POINT_OUT 118 +#define F_LSEG_IN 119 +#define F_LSEG_OUT 120 +#define F_PATH_IN 121 +#define F_PATH_OUT 122 +#define F_BOX_IN 123 +#define F_BOX_OUT 124 +#define F_BOX_OVERLAP 125 +#define F_BOX_GE 126 +#define F_BOX_GT 127 +#define F_BOX_EQ 128 +#define F_BOX_LT 129 +#define F_BOX_LE 130 +#define F_POINT_ABOVE 131 +#define F_POINT_LEFT 132 +#define F_POINT_RIGHT 133 +#define F_POINT_BELOW 134 +#define F_POINT_EQ 135 +#define F_ON_PB 136 +#define F_ON_PPATH 137 +#define F_BOX_CENTER 138 +#define F_AREASEL 139 +#define F_AREAJOINSEL 140 +#define F_INT4MUL 141 +#define F_INT4NE 144 +#define F_INT2NE 145 +#define F_INT2GT 146 +#define F_INT4GT 147 +#define F_INT2LE 148 +#define F_INT4LE 149 +#define F_INT4GE 150 +#define F_INT2GE 151 +#define F_INT2MUL 152 +#define F_INT2DIV 153 +#define F_INT4DIV 154 +#define F_INT2MOD 155 +#define F_INT4MOD 156 +#define F_TEXTNE 157 +#define F_INT24EQ 158 +#define F_INT42EQ 159 +#define F_INT24LT 160 +#define F_INT42LT 161 +#define F_INT24GT 162 +#define F_INT42GT 163 +#define F_INT24NE 164 +#define F_INT42NE 165 +#define F_INT24LE 166 +#define F_INT42LE 167 +#define F_INT24GE 168 +#define F_INT42GE 169 +#define F_INT24MUL 170 +#define F_INT42MUL 171 +#define F_INT24DIV 172 +#define F_INT42DIV 173 +#define F_INT2PL 176 +#define F_INT4PL 177 +#define F_INT24PL 178 +#define F_INT42PL 179 +#define F_INT2MI 180 +#define F_INT4MI 181 +#define F_INT24MI 182 +#define F_INT42MI 183 +#define F_OIDEQ 184 +#define F_OIDNE 185 +#define F_BOX_SAME 186 +#define F_BOX_CONTAIN 187 +#define F_BOX_LEFT 188 +#define F_BOX_OVERLEFT 189 +#define F_BOX_OVERRIGHT 190 +#define F_BOX_RIGHT 191 +#define F_BOX_CONTAINED 192 +#define F_BOX_CONTAIN_PT 193 +#define F_PG_NODE_TREE_IN 195 +#define F_PG_NODE_TREE_OUT 196 +#define F_PG_NODE_TREE_RECV 197 +#define F_PG_NODE_TREE_SEND 198 +#define F_FLOAT4IN 200 +#define F_FLOAT4OUT 201 +#define F_FLOAT4MUL 202 +#define F_FLOAT4DIV 203 +#define F_FLOAT4PL 204 +#define F_FLOAT4MI 205 +#define F_FLOAT4UM 206 +#define F_FLOAT4ABS 207 +#define F_FLOAT4_ACCUM 208 +#define F_FLOAT4LARGER 209 +#define F_FLOAT4SMALLER 211 +#define F_INT4UM 212 +#define F_INT2UM 213 +#define F_FLOAT8IN 214 +#define F_FLOAT8OUT 215 +#define F_FLOAT8MUL 216 +#define F_FLOAT8DIV 217 +#define F_FLOAT8PL 218 +#define F_FLOAT8MI 219 +#define F_FLOAT8UM 220 +#define F_FLOAT8ABS 221 +#define F_FLOAT8_ACCUM 222 +#define F_FLOAT8LARGER 223 +#define F_FLOAT8SMALLER 224 +#define F_LSEG_CENTER 225 +#define F_POLY_CENTER 227 +#define F_DROUND 228 +#define F_DTRUNC 229 +#define F_DSQRT 230 +#define F_DCBRT 231 +#define F_DPOW 232 +#define F_DEXP 233 +#define F_DLOG1 234 +#define F_FLOAT8_INT2 235 +#define F_FLOAT4_INT2 236 +#define F_INT2_FLOAT8 237 +#define F_INT2_FLOAT4 238 +#define F_LINE_DISTANCE 239 +#define F_NAMEEQTEXT 240 +#define F_NAMELTTEXT 241 +#define F_NAMELETEXT 242 +#define F_NAMEGETEXT 243 +#define F_NAMEGTTEXT 244 +#define F_NAMENETEXT 245 +#define F_BTNAMETEXTCMP 246 +#define F_TEXTEQNAME 247 +#define F_TEXTLTNAME 248 +#define F_TEXTLENAME 249 +#define F_TEXTGENAME 250 +#define F_TEXTGTNAME 251 +#define F_TEXTNENAME 252 +#define F_BTTEXTNAMECMP 253 +#define F_NAMECONCATOID 266 +#define F_TABLE_AM_HANDLER_IN 267 +#define F_TABLE_AM_HANDLER_OUT 268 +#define F_TIMEOFDAY 274 +#define F_PG_NEXTOID 275 +#define F_FLOAT8_COMBINE 276 +#define F_INTER_SL 277 +#define F_INTER_LB 278 +#define F_FLOAT48MUL 279 +#define F_FLOAT48DIV 280 +#define F_FLOAT48PL 281 +#define F_FLOAT48MI 282 +#define F_FLOAT84MUL 283 +#define F_FLOAT84DIV 284 +#define F_FLOAT84PL 285 +#define F_FLOAT84MI 286 +#define F_FLOAT4EQ 287 +#define F_FLOAT4NE 288 +#define F_FLOAT4LT 289 +#define F_FLOAT4LE 290 +#define F_FLOAT4GT 291 +#define F_FLOAT4GE 292 +#define F_FLOAT8EQ 293 +#define F_FLOAT8NE 294 +#define F_FLOAT8LT 295 +#define F_FLOAT8LE 296 +#define F_FLOAT8GT 297 +#define F_FLOAT8GE 298 +#define F_FLOAT48EQ 299 +#define F_FLOAT48NE 300 +#define F_FLOAT48LT 301 +#define F_FLOAT48LE 302 +#define F_FLOAT48GT 303 +#define F_FLOAT48GE 304 +#define F_FLOAT84EQ 305 +#define F_FLOAT84NE 306 +#define F_FLOAT84LT 307 +#define F_FLOAT84LE 308 +#define F_FLOAT84GT 309 +#define F_FLOAT84GE 310 +#define F_FLOAT8_FLOAT4 311 +#define F_FLOAT4_FLOAT8 312 +#define F_INT4_INT2 313 +#define F_INT2_INT4 314 +#define F_PG_JIT_AVAILABLE 315 +#define F_FLOAT8_INT4 316 +#define F_INT4_FLOAT8 317 +#define F_FLOAT4_INT4 318 +#define F_INT4_FLOAT4 319 +#define F_WIDTH_BUCKET_FLOAT8_FLOAT8_FLOAT8_INT4 320 +#define F_JSON_IN 321 +#define F_JSON_OUT 322 +#define F_JSON_RECV 323 +#define F_JSON_SEND 324 +#define F_INDEX_AM_HANDLER_IN 326 +#define F_INDEX_AM_HANDLER_OUT 327 +#define F_HASHMACADDR8 328 +#define F_HASH_ACLITEM 329 +#define F_BTHANDLER 330 +#define F_HASHHANDLER 331 +#define F_GISTHANDLER 332 +#define F_GINHANDLER 333 +#define F_SPGHANDLER 334 +#define F_BRINHANDLER 335 +#define F_SCALARLESEL 336 +#define F_SCALARGESEL 337 +#define F_AMVALIDATE 338 +#define F_POLY_SAME 339 +#define F_POLY_CONTAIN 340 +#define F_POLY_LEFT 341 +#define F_POLY_OVERLEFT 342 +#define F_POLY_OVERRIGHT 343 +#define F_POLY_RIGHT 344 +#define F_POLY_CONTAINED 345 +#define F_POLY_OVERLAP 346 +#define F_POLY_IN 347 +#define F_POLY_OUT 348 +#define F_BTINT2CMP 350 +#define F_BTINT4CMP 351 +#define F_BTFLOAT4CMP 354 +#define F_BTFLOAT8CMP 355 +#define F_BTOIDCMP 356 +#define F_DIST_BP 357 +#define F_BTCHARCMP 358 +#define F_BTNAMECMP 359 +#define F_BTTEXTCMP 360 +#define F_LSEG_DISTANCE 361 +#define F_LSEG_INTERPT 362 +#define F_DIST_PS 363 +#define F_DIST_PB 364 +#define F_DIST_SB 365 +#define F_CLOSE_PS 366 +#define F_CLOSE_PB 367 +#define F_CLOSE_SB 368 +#define F_ON_PS 369 +#define F_PATH_DISTANCE 370 +#define F_DIST_PPATH 371 +#define F_ON_SB 372 +#define F_INTER_SB 373 +#define F_STRING_TO_ARRAY_TEXT_TEXT_TEXT 376 +#define F_CASH_CMP 377 +#define F_ARRAY_APPEND 378 +#define F_ARRAY_PREPEND 379 +#define F_DIST_SP 380 +#define F_DIST_BS 381 +#define F_BTARRAYCMP 382 +#define F_ARRAY_CAT 383 +#define F_ARRAY_TO_STRING_ANYARRAY_TEXT_TEXT 384 +#define F_SCALARLEJOINSEL 386 +#define F_ARRAY_NE 390 +#define F_ARRAY_LT 391 +#define F_ARRAY_GT 392 +#define F_ARRAY_LE 393 +#define F_STRING_TO_ARRAY_TEXT_TEXT 394 +#define F_ARRAY_TO_STRING_ANYARRAY_TEXT 395 +#define F_ARRAY_GE 396 +#define F_SCALARGEJOINSEL 398 +#define F_HASHMACADDR 399 +#define F_HASHTEXT 400 +#define F_TEXT_BPCHAR 401 +#define F_BTOIDVECTORCMP 404 +#define F_TEXT_NAME 406 +#define F_NAME_TEXT 407 +#define F_BPCHAR_NAME 408 +#define F_NAME_BPCHAR 409 +#define F_DIST_PATHP 421 +#define F_HASHINET 422 +#define F_HASHINT4EXTENDED 425 +#define F_HASH_NUMERIC 432 +#define F_MACADDR_IN 436 +#define F_MACADDR_OUT 437 +#define F_NUM_NULLS 438 +#define F_NUM_NONNULLS 440 +#define F_HASHINT2EXTENDED 441 +#define F_HASHINT8EXTENDED 442 +#define F_HASHFLOAT4EXTENDED 443 +#define F_HASHFLOAT8EXTENDED 444 +#define F_HASHOIDEXTENDED 445 +#define F_HASHCHAREXTENDED 446 +#define F_HASHNAMEEXTENDED 447 +#define F_HASHTEXTEXTENDED 448 +#define F_HASHINT2 449 +#define F_HASHINT4 450 +#define F_HASHFLOAT4 451 +#define F_HASHFLOAT8 452 +#define F_HASHOID 453 +#define F_HASHCHAR 454 +#define F_HASHNAME 455 +#define F_HASHVARLENA 456 +#define F_HASHOIDVECTOR 457 +#define F_TEXT_LARGER 458 +#define F_TEXT_SMALLER 459 +#define F_INT8IN 460 +#define F_INT8OUT 461 +#define F_INT8UM 462 +#define F_INT8PL 463 +#define F_INT8MI 464 +#define F_INT8MUL 465 +#define F_INT8DIV 466 +#define F_INT8EQ 467 +#define F_INT8NE 468 +#define F_INT8LT 469 +#define F_INT8GT 470 +#define F_INT8LE 471 +#define F_INT8GE 472 +#define F_INT84EQ 474 +#define F_INT84NE 475 +#define F_INT84LT 476 +#define F_INT84GT 477 +#define F_INT84LE 478 +#define F_INT84GE 479 +#define F_INT4_INT8 480 +#define F_INT8_INT4 481 +#define F_FLOAT8_INT8 482 +#define F_INT8_FLOAT8 483 +#define F_ARRAY_LARGER 515 +#define F_ARRAY_SMALLER 516 +#define F_ABBREV_INET 598 +#define F_ABBREV_CIDR 599 +#define F_SET_MASKLEN_INET_INT4 605 +#define F_OIDVECTORNE 619 +#define F_HASH_ARRAY 626 +#define F_SET_MASKLEN_CIDR_INT4 635 +#define F_PG_INDEXAM_HAS_PROPERTY 636 +#define F_PG_INDEX_HAS_PROPERTY 637 +#define F_PG_INDEX_COLUMN_HAS_PROPERTY 638 +#define F_FLOAT4_INT8 652 +#define F_INT8_FLOAT4 653 +#define F_NAMELT 655 +#define F_NAMELE 656 +#define F_NAMEGT 657 +#define F_NAMEGE 658 +#define F_NAMENE 659 +#define F_BPCHAR_BPCHAR_INT4_BOOL 668 +#define F_VARCHAR_VARCHAR_INT4_BOOL 669 +#define F_PG_INDEXAM_PROGRESS_PHASENAME 676 +#define F_OIDVECTORLT 677 +#define F_OIDVECTORLE 678 +#define F_OIDVECTOREQ 679 +#define F_OIDVECTORGE 680 +#define F_OIDVECTORGT 681 +#define F_NETWORK 683 +#define F_NETMASK 696 +#define F_MASKLEN 697 +#define F_BROADCAST 698 +#define F_HOST 699 +#define F_DIST_LP 702 +#define F_DIST_LS 704 +#define F_GETPGUSERNAME 710 +#define F_FAMILY 711 +#define F_INT2_INT8 714 +#define F_LO_CREATE 715 +#define F_OIDLT 716 +#define F_OIDLE 717 +#define F_OCTET_LENGTH_BYTEA 720 +#define F_GET_BYTE 721 +#define F_SET_BYTE 722 +#define F_GET_BIT_BYTEA_INT8 723 +#define F_SET_BIT_BYTEA_INT8_INT4 724 +#define F_DIST_PL 725 +#define F_DIST_SL 727 +#define F_DIST_CPOLY 728 +#define F_POLY_DISTANCE 729 +#define F_TEXT_INET 730 +#define F_TEXT_LT 740 +#define F_TEXT_LE 741 +#define F_TEXT_GT 742 +#define F_TEXT_GE 743 +#define F_ARRAY_EQ 744 +#define F_CURRENT_USER 745 +#define F_SESSION_USER 746 +#define F_ARRAY_DIMS 747 +#define F_ARRAY_NDIMS 748 +#define F_OVERLAY_BYTEA_BYTEA_INT4_INT4 749 +#define F_ARRAY_IN 750 +#define F_ARRAY_OUT 751 +#define F_OVERLAY_BYTEA_BYTEA_INT4 752 +#define F_TRUNC_MACADDR 753 +#define F_INT8_INT2 754 +#define F_LO_IMPORT_TEXT 764 +#define F_LO_EXPORT 765 +#define F_INT4INC 766 +#define F_LO_IMPORT_TEXT_OID 767 +#define F_INT4LARGER 768 +#define F_INT4SMALLER 769 +#define F_INT2LARGER 770 +#define F_INT2SMALLER 771 +#define F_HASHVARLENAEXTENDED 772 +#define F_HASHOIDVECTOREXTENDED 776 +#define F_HASH_ACLITEM_EXTENDED 777 +#define F_HASHMACADDREXTENDED 778 +#define F_HASHINETEXTENDED 779 +#define F_HASH_NUMERIC_EXTENDED 780 +#define F_HASHMACADDR8EXTENDED 781 +#define F_HASH_ARRAY_EXTENDED 782 +#define F_DIST_POLYC 785 +#define F_PG_CLIENT_ENCODING 810 +#define F_CURRENT_QUERY 817 +#define F_MACADDR_EQ 830 +#define F_MACADDR_LT 831 +#define F_MACADDR_LE 832 +#define F_MACADDR_GT 833 +#define F_MACADDR_GE 834 +#define F_MACADDR_NE 835 +#define F_MACADDR_CMP 836 +#define F_INT82PL 837 +#define F_INT82MI 838 +#define F_INT82MUL 839 +#define F_INT82DIV 840 +#define F_INT28PL 841 +#define F_BTINT8CMP 842 +#define F_CASH_MUL_FLT4 846 +#define F_CASH_DIV_FLT4 847 +#define F_FLT4_MUL_CASH 848 +#define F_POSITION_TEXT_TEXT 849 +#define F_TEXTLIKE 850 +#define F_TEXTNLIKE 851 +#define F_INT48EQ 852 +#define F_INT48NE 853 +#define F_INT48LT 854 +#define F_INT48GT 855 +#define F_INT48LE 856 +#define F_INT48GE 857 +#define F_NAMELIKE 858 +#define F_NAMENLIKE 859 +#define F_BPCHAR_CHAR 860 +#define F_CURRENT_DATABASE 861 +#define F_INT4_MUL_CASH 862 +#define F_INT2_MUL_CASH 863 +#define F_CASH_MUL_INT4 864 +#define F_CASH_DIV_INT4 865 +#define F_CASH_MUL_INT2 866 +#define F_CASH_DIV_INT2 867 +#define F_STRPOS 868 +#define F_LOWER_TEXT 870 +#define F_UPPER_TEXT 871 +#define F_INITCAP 872 +#define F_LPAD_TEXT_INT4_TEXT 873 +#define F_RPAD_TEXT_INT4_TEXT 874 +#define F_LTRIM_TEXT_TEXT 875 +#define F_RTRIM_TEXT_TEXT 876 +#define F_SUBSTR_TEXT_INT4_INT4 877 +#define F_TRANSLATE 878 +#define F_LPAD_TEXT_INT4 879 +#define F_RPAD_TEXT_INT4 880 +#define F_LTRIM_TEXT 881 +#define F_RTRIM_TEXT 882 +#define F_SUBSTR_TEXT_INT4 883 +#define F_BTRIM_TEXT_TEXT 884 +#define F_BTRIM_TEXT 885 +#define F_CASH_IN 886 +#define F_CASH_OUT 887 +#define F_CASH_EQ 888 +#define F_CASH_NE 889 +#define F_CASH_LT 890 +#define F_CASH_LE 891 +#define F_CASH_GT 892 +#define F_CASH_GE 893 +#define F_CASH_PL 894 +#define F_CASH_MI 895 +#define F_CASH_MUL_FLT8 896 +#define F_CASH_DIV_FLT8 897 +#define F_CASHLARGER 898 +#define F_CASHSMALLER 899 +#define F_INET_IN 910 +#define F_INET_OUT 911 +#define F_FLT8_MUL_CASH 919 +#define F_NETWORK_EQ 920 +#define F_NETWORK_LT 921 +#define F_NETWORK_LE 922 +#define F_NETWORK_GT 923 +#define F_NETWORK_GE 924 +#define F_NETWORK_NE 925 +#define F_NETWORK_CMP 926 +#define F_NETWORK_SUB 927 +#define F_NETWORK_SUBEQ 928 +#define F_NETWORK_SUP 929 +#define F_NETWORK_SUPEQ 930 +#define F_CASH_WORDS 935 +#define F_SUBSTRING_TEXT_INT4_INT4 936 +#define F_SUBSTRING_TEXT_INT4 937 +#define F_GENERATE_SERIES_TIMESTAMP_TIMESTAMP_INTERVAL 938 +#define F_GENERATE_SERIES_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL 939 +#define F_MOD_INT2_INT2 940 +#define F_MOD_INT4_INT4 941 +#define F_INT28MI 942 +#define F_INT28MUL 943 +#define F_CHAR_TEXT 944 +#define F_INT8MOD 945 +#define F_TEXT_CHAR 946 +#define F_MOD_INT8_INT8 947 +#define F_INT28DIV 948 +#define F_HASHINT8 949 +#define F_LO_OPEN 952 +#define F_LO_CLOSE 953 +#define F_LOREAD 954 +#define F_LOWRITE 955 +#define F_LO_LSEEK 956 +#define F_LO_CREAT 957 +#define F_LO_TELL 958 +#define F_ON_PL 959 +#define F_ON_SL 960 +#define F_CLOSE_PL 961 +#define F_LO_UNLINK 964 +#define F_HASHBPCHAREXTENDED 972 +#define F_PATH_INTER 973 +#define F_AREA_BOX 975 +#define F_WIDTH 976 +#define F_HEIGHT 977 +#define F_BOX_DISTANCE 978 +#define F_AREA_PATH 979 +#define F_BOX_INTERSECT 980 +#define F_DIAGONAL 981 +#define F_PATH_N_LT 982 +#define F_PATH_N_GT 983 +#define F_PATH_N_EQ 984 +#define F_PATH_N_LE 985 +#define F_PATH_N_GE 986 +#define F_PATH_LENGTH 987 +#define F_POINT_NE 988 +#define F_POINT_VERT 989 +#define F_POINT_HORIZ 990 +#define F_POINT_DISTANCE 991 +#define F_SLOPE 992 +#define F_LSEG_POINT_POINT 993 +#define F_LSEG_INTERSECT 994 +#define F_LSEG_PARALLEL 995 +#define F_LSEG_PERP 996 +#define F_LSEG_VERTICAL 997 +#define F_LSEG_HORIZONTAL 998 +#define F_LSEG_EQ 999 +#define F_LO_TRUNCATE 1004 +#define F_TEXTLIKE_SUPPORT 1023 +#define F_TEXTICREGEXEQ_SUPPORT 1024 +#define F_TEXTICLIKE_SUPPORT 1025 +#define F_TIMEZONE_INTERVAL_TIMESTAMPTZ 1026 +#define F_GIST_POINT_COMPRESS 1030 +#define F_ACLITEMIN 1031 +#define F_ACLITEMOUT 1032 +#define F_ACLINSERT 1035 +#define F_ACLREMOVE 1036 +#define F_ACLCONTAINS 1037 +#define F_GETDATABASEENCODING 1039 +#define F_BPCHARIN 1044 +#define F_BPCHAROUT 1045 +#define F_VARCHARIN 1046 +#define F_VARCHAROUT 1047 +#define F_BPCHAREQ 1048 +#define F_BPCHARLT 1049 +#define F_BPCHARLE 1050 +#define F_BPCHARGT 1051 +#define F_BPCHARGE 1052 +#define F_BPCHARNE 1053 +#define F_ACLITEMEQ 1062 +#define F_BPCHAR_LARGER 1063 +#define F_BPCHAR_SMALLER 1064 +#define F_PG_PREPARED_XACT 1065 +#define F_GENERATE_SERIES_INT4_INT4_INT4 1066 +#define F_GENERATE_SERIES_INT4_INT4 1067 +#define F_GENERATE_SERIES_INT8_INT8_INT8 1068 +#define F_GENERATE_SERIES_INT8_INT8 1069 +#define F_BPCHARCMP 1078 +#define F_REGCLASS 1079 +#define F_HASHBPCHAR 1080 +#define F_FORMAT_TYPE 1081 +#define F_DATE_IN 1084 +#define F_DATE_OUT 1085 +#define F_DATE_EQ 1086 +#define F_DATE_LT 1087 +#define F_DATE_LE 1088 +#define F_DATE_GT 1089 +#define F_DATE_GE 1090 +#define F_DATE_NE 1091 +#define F_DATE_CMP 1092 +#define F_TIME_LT 1102 +#define F_TIME_LE 1103 +#define F_TIME_GT 1104 +#define F_TIME_GE 1105 +#define F_TIME_NE 1106 +#define F_TIME_CMP 1107 +#define F_PG_STAT_GET_WAL 1136 +#define F_PG_GET_WAL_REPLAY_PAUSE_STATE 1137 +#define F_DATE_LARGER 1138 +#define F_DATE_SMALLER 1139 +#define F_DATE_MI 1140 +#define F_DATE_PLI 1141 +#define F_DATE_MII 1142 +#define F_TIME_IN 1143 +#define F_TIME_OUT 1144 +#define F_TIME_EQ 1145 +#define F_CIRCLE_ADD_PT 1146 +#define F_CIRCLE_SUB_PT 1147 +#define F_CIRCLE_MUL_PT 1148 +#define F_CIRCLE_DIV_PT 1149 +#define F_TIMESTAMPTZ_IN 1150 +#define F_TIMESTAMPTZ_OUT 1151 +#define F_TIMESTAMPTZ_EQ 1152 +#define F_TIMESTAMPTZ_NE 1153 +#define F_TIMESTAMPTZ_LT 1154 +#define F_TIMESTAMPTZ_LE 1155 +#define F_TIMESTAMPTZ_GE 1156 +#define F_TIMESTAMPTZ_GT 1157 +#define F_TO_TIMESTAMP_FLOAT8 1158 +#define F_TIMEZONE_TEXT_TIMESTAMPTZ 1159 +#define F_INTERVAL_IN 1160 +#define F_INTERVAL_OUT 1161 +#define F_INTERVAL_EQ 1162 +#define F_INTERVAL_NE 1163 +#define F_INTERVAL_LT 1164 +#define F_INTERVAL_LE 1165 +#define F_INTERVAL_GE 1166 +#define F_INTERVAL_GT 1167 +#define F_INTERVAL_UM 1168 +#define F_INTERVAL_PL 1169 +#define F_INTERVAL_MI 1170 +#define F_DATE_PART_TEXT_TIMESTAMPTZ 1171 +#define F_DATE_PART_TEXT_INTERVAL 1172 +#define F_NETWORK_SUBSET_SUPPORT 1173 +#define F_TIMESTAMPTZ_DATE 1174 +#define F_JUSTIFY_HOURS 1175 +#define F_TIMESTAMPTZ_DATE_TIME 1176 +#define F_JSONB_PATH_EXISTS_TZ 1177 +#define F_DATE_TIMESTAMPTZ 1178 +#define F_JSONB_PATH_QUERY_TZ 1179 +#define F_JSONB_PATH_QUERY_ARRAY_TZ 1180 +#define F_AGE_XID 1181 +#define F_TIMESTAMPTZ_MI 1188 +#define F_TIMESTAMPTZ_PL_INTERVAL 1189 +#define F_TIMESTAMPTZ_MI_INTERVAL 1190 +#define F_GENERATE_SUBSCRIPTS_ANYARRAY_INT4_BOOL 1191 +#define F_GENERATE_SUBSCRIPTS_ANYARRAY_INT4 1192 +#define F_ARRAY_FILL_ANYELEMENT__INT4 1193 +#define F_LOG10_FLOAT8 1194 +#define F_TIMESTAMPTZ_SMALLER 1195 +#define F_TIMESTAMPTZ_LARGER 1196 +#define F_INTERVAL_SMALLER 1197 +#define F_INTERVAL_LARGER 1198 +#define F_AGE_TIMESTAMPTZ_TIMESTAMPTZ 1199 +#define F_INTERVAL_INTERVAL_INT4 1200 +#define F_OBJ_DESCRIPTION_OID_NAME 1215 +#define F_COL_DESCRIPTION 1216 +#define F_DATE_TRUNC_TEXT_TIMESTAMPTZ 1217 +#define F_DATE_TRUNC_TEXT_INTERVAL 1218 +#define F_INT8INC 1219 +#define F_INT8ABS 1230 +#define F_INT8LARGER 1236 +#define F_INT8SMALLER 1237 +#define F_TEXTICREGEXEQ 1238 +#define F_TEXTICREGEXNE 1239 +#define F_NAMEICREGEXEQ 1240 +#define F_NAMEICREGEXNE 1241 +#define F_BOOLIN 1242 +#define F_BOOLOUT 1243 +#define F_BYTEAIN 1244 +#define F_CHARIN 1245 +#define F_CHARLT 1246 +#define F_UNIQUE_KEY_RECHECK 1250 +#define F_INT4ABS 1251 +#define F_NAMEREGEXNE 1252 +#define F_INT2ABS 1253 +#define F_TEXTREGEXEQ 1254 +#define F_TEXTREGEXNE 1256 +#define F_TEXTLEN 1257 +#define F_TEXTCAT 1258 +#define F_PG_CHAR_TO_ENCODING 1264 +#define F_TIDNE 1265 +#define F_CIDR_IN 1267 +#define F_PARSE_IDENT 1268 +#define F_PG_COLUMN_SIZE 1269 +#define F_OVERLAPS_TIMETZ_TIMETZ_TIMETZ_TIMETZ 1271 +#define F_DATETIME_PL 1272 +#define F_DATE_PART_TEXT_TIMETZ 1273 +#define F_INT84PL 1274 +#define F_INT84MI 1275 +#define F_INT84MUL 1276 +#define F_INT84DIV 1277 +#define F_INT48PL 1278 +#define F_INT48MI 1279 +#define F_INT48MUL 1280 +#define F_INT48DIV 1281 +#define F_QUOTE_IDENT 1282 +#define F_QUOTE_LITERAL_TEXT 1283 +#define F_DATE_TRUNC_TEXT_TIMESTAMPTZ_TEXT 1284 +#define F_QUOTE_LITERAL_ANYELEMENT 1285 +#define F_ARRAY_FILL_ANYELEMENT__INT4__INT4 1286 +#define F_OID 1287 +#define F_INT8_OID 1288 +#define F_QUOTE_NULLABLE_TEXT 1289 +#define F_QUOTE_NULLABLE_ANYELEMENT 1290 +#define F_SUPPRESS_REDUNDANT_UPDATES_TRIGGER 1291 +#define F_TIDEQ 1292 +#define F_UNNEST_ANYMULTIRANGE 1293 +#define F_CURRTID2 1294 +#define F_JUSTIFY_DAYS 1295 +#define F_TIMEDATE_PL 1296 +#define F_DATETIMETZ_PL 1297 +#define F_TIMETZDATE_PL 1298 +#define F_NOW 1299 +#define F_POSITIONSEL 1300 +#define F_POSITIONJOINSEL 1301 +#define F_CONTSEL 1302 +#define F_CONTJOINSEL 1303 +#define F_OVERLAPS_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ 1304 +#define F_OVERLAPS_TIMESTAMPTZ_INTERVAL_TIMESTAMPTZ_INTERVAL 1305 +#define F_OVERLAPS_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL 1306 +#define F_OVERLAPS_TIMESTAMPTZ_INTERVAL_TIMESTAMPTZ_TIMESTAMPTZ 1307 +#define F_OVERLAPS_TIME_TIME_TIME_TIME 1308 +#define F_OVERLAPS_TIME_INTERVAL_TIME_INTERVAL 1309 +#define F_OVERLAPS_TIME_TIME_TIME_INTERVAL 1310 +#define F_OVERLAPS_TIME_INTERVAL_TIME_TIME 1311 +#define F_TIMESTAMP_IN 1312 +#define F_TIMESTAMP_OUT 1313 +#define F_TIMESTAMPTZ_CMP 1314 +#define F_INTERVAL_CMP 1315 +#define F_TIME_TIMESTAMP 1316 +#define F_LENGTH_TEXT 1317 +#define F_LENGTH_BPCHAR 1318 +#define F_XIDEQINT4 1319 +#define F_INTERVAL_DIV 1326 +#define F_DLOG10 1339 +#define F_LOG_FLOAT8 1340 +#define F_LN_FLOAT8 1341 +#define F_ROUND_FLOAT8 1342 +#define F_TRUNC_FLOAT8 1343 +#define F_SQRT_FLOAT8 1344 +#define F_CBRT 1345 +#define F_POW_FLOAT8_FLOAT8 1346 +#define F_EXP_FLOAT8 1347 +#define F_OBJ_DESCRIPTION_OID 1348 +#define F_OIDVECTORTYPES 1349 +#define F_TIMETZ_IN 1350 +#define F_TIMETZ_OUT 1351 +#define F_TIMETZ_EQ 1352 +#define F_TIMETZ_NE 1353 +#define F_TIMETZ_LT 1354 +#define F_TIMETZ_LE 1355 +#define F_TIMETZ_GE 1356 +#define F_TIMETZ_GT 1357 +#define F_TIMETZ_CMP 1358 +#define F_TIMESTAMPTZ_DATE_TIMETZ 1359 +#define F_HOSTMASK 1362 +#define F_TEXTREGEXEQ_SUPPORT 1364 +#define F_MAKEACLITEM 1365 +#define F_CHARACTER_LENGTH_BPCHAR 1367 +#define F_POWER_FLOAT8_FLOAT8 1368 +#define F_CHARACTER_LENGTH_TEXT 1369 +#define F_INTERVAL_TIME 1370 +#define F_PG_LOCK_STATUS 1371 +#define F_CHAR_LENGTH_BPCHAR 1372 +#define F_ISFINITE_DATE 1373 +#define F_OCTET_LENGTH_TEXT 1374 +#define F_OCTET_LENGTH_BPCHAR 1375 +#define F_FACTORIAL 1376 +#define F_TIME_LARGER 1377 +#define F_TIME_SMALLER 1378 +#define F_TIMETZ_LARGER 1379 +#define F_TIMETZ_SMALLER 1380 +#define F_CHAR_LENGTH_TEXT 1381 +#define F_DATE_PART_TEXT_DATE 1384 +#define F_DATE_PART_TEXT_TIME 1385 +#define F_AGE_TIMESTAMPTZ 1386 +#define F_PG_GET_CONSTRAINTDEF_OID 1387 +#define F_TIMETZ_TIMESTAMPTZ 1388 +#define F_ISFINITE_TIMESTAMPTZ 1389 +#define F_ISFINITE_INTERVAL 1390 +#define F_PG_STAT_GET_BACKEND_START 1391 +#define F_PG_STAT_GET_BACKEND_CLIENT_ADDR 1392 +#define F_PG_STAT_GET_BACKEND_CLIENT_PORT 1393 +#define F_ABS_FLOAT4 1394 +#define F_ABS_FLOAT8 1395 +#define F_ABS_INT8 1396 +#define F_ABS_INT4 1397 +#define F_ABS_INT2 1398 +#define F_NAME_VARCHAR 1400 +#define F_VARCHAR_NAME 1401 +#define F_CURRENT_SCHEMA 1402 +#define F_CURRENT_SCHEMAS 1403 +#define F_OVERLAY_TEXT_TEXT_INT4_INT4 1404 +#define F_OVERLAY_TEXT_TEXT_INT4 1405 +#define F_ISVERTICAL_POINT_POINT 1406 +#define F_ISHORIZONTAL_POINT_POINT 1407 +#define F_ISPARALLEL_LSEG_LSEG 1408 +#define F_ISPERP_LSEG_LSEG 1409 +#define F_ISVERTICAL_LSEG 1410 +#define F_ISHORIZONTAL_LSEG 1411 +#define F_ISPARALLEL_LINE_LINE 1412 +#define F_ISPERP_LINE_LINE 1413 +#define F_ISVERTICAL_LINE 1414 +#define F_ISHORIZONTAL_LINE 1415 +#define F_POINT_CIRCLE 1416 +#define F_TIME_INTERVAL 1419 +#define F_BOX_POINT_POINT 1421 +#define F_BOX_ADD 1422 +#define F_BOX_SUB 1423 +#define F_BOX_MUL 1424 +#define F_BOX_DIV 1425 +#define F_PATH_CONTAIN_PT 1426 +#define F_CIDR_OUT 1427 +#define F_POLY_CONTAIN_PT 1428 +#define F_PT_CONTAINED_POLY 1429 +#define F_ISCLOSED 1430 +#define F_ISOPEN 1431 +#define F_PATH_NPOINTS 1432 +#define F_PCLOSE 1433 +#define F_POPEN 1434 +#define F_PATH_ADD 1435 +#define F_PATH_ADD_PT 1436 +#define F_PATH_SUB_PT 1437 +#define F_PATH_MUL_PT 1438 +#define F_PATH_DIV_PT 1439 +#define F_POINT_FLOAT8_FLOAT8 1440 +#define F_POINT_ADD 1441 +#define F_POINT_SUB 1442 +#define F_POINT_MUL 1443 +#define F_POINT_DIV 1444 +#define F_POLY_NPOINTS 1445 +#define F_BOX_POLYGON 1446 +#define F_PATH 1447 +#define F_POLYGON_BOX 1448 +#define F_POLYGON_PATH 1449 +#define F_CIRCLE_IN 1450 +#define F_CIRCLE_OUT 1451 +#define F_CIRCLE_SAME 1452 +#define F_CIRCLE_CONTAIN 1453 +#define F_CIRCLE_LEFT 1454 +#define F_CIRCLE_OVERLEFT 1455 +#define F_CIRCLE_OVERRIGHT 1456 +#define F_CIRCLE_RIGHT 1457 +#define F_CIRCLE_CONTAINED 1458 +#define F_CIRCLE_OVERLAP 1459 +#define F_CIRCLE_BELOW 1460 +#define F_CIRCLE_ABOVE 1461 +#define F_CIRCLE_EQ 1462 +#define F_CIRCLE_NE 1463 +#define F_CIRCLE_LT 1464 +#define F_CIRCLE_GT 1465 +#define F_CIRCLE_LE 1466 +#define F_CIRCLE_GE 1467 +#define F_AREA_CIRCLE 1468 +#define F_DIAMETER 1469 +#define F_RADIUS 1470 +#define F_CIRCLE_DISTANCE 1471 +#define F_CIRCLE_CENTER 1472 +#define F_CIRCLE_POINT_FLOAT8 1473 +#define F_CIRCLE_POLYGON 1474 +#define F_POLYGON_INT4_CIRCLE 1475 +#define F_DIST_PC 1476 +#define F_CIRCLE_CONTAIN_PT 1477 +#define F_PT_CONTAINED_CIRCLE 1478 +#define F_CIRCLE_BOX 1479 +#define F_BOX_CIRCLE 1480 +#define F_LOG10_NUMERIC 1481 +#define F_LSEG_NE 1482 +#define F_LSEG_LT 1483 +#define F_LSEG_LE 1484 +#define F_LSEG_GT 1485 +#define F_LSEG_GE 1486 +#define F_LSEG_LENGTH 1487 +#define F_CLOSE_LS 1488 +#define F_CLOSE_LSEG 1489 +#define F_LINE_IN 1490 +#define F_LINE_OUT 1491 +#define F_LINE_EQ 1492 +#define F_LINE 1493 +#define F_LINE_INTERPT 1494 +#define F_LINE_INTERSECT 1495 +#define F_LINE_PARALLEL 1496 +#define F_LINE_PERP 1497 +#define F_LINE_VERTICAL 1498 +#define F_LINE_HORIZONTAL 1499 +#define F_LENGTH_LSEG 1530 +#define F_LENGTH_PATH 1531 +#define F_POINT_LSEG 1532 +#define F_POINT_BOX 1534 +#define F_POINT_POLYGON 1540 +#define F_LSEG_BOX 1541 +#define F_CENTER_BOX 1542 +#define F_CENTER_CIRCLE 1543 +#define F_POLYGON_CIRCLE 1544 +#define F_NPOINTS_PATH 1545 +#define F_NPOINTS_POLYGON 1556 +#define F_BIT_IN 1564 +#define F_BIT_OUT 1565 +#define F_LIKE_TEXT_TEXT 1569 +#define F_NOTLIKE_TEXT_TEXT 1570 +#define F_LIKE_NAME_TEXT 1571 +#define F_NOTLIKE_NAME_TEXT 1572 +#define F_PG_GET_RULEDEF_OID 1573 +#define F_NEXTVAL 1574 +#define F_CURRVAL 1575 +#define F_SETVAL_REGCLASS_INT8 1576 +#define F_VARBIT_IN 1579 +#define F_VARBIT_OUT 1580 +#define F_BITEQ 1581 +#define F_BITNE 1582 +#define F_BITGE 1592 +#define F_BITGT 1593 +#define F_BITLE 1594 +#define F_BITLT 1595 +#define F_BITCMP 1596 +#define F_PG_ENCODING_TO_CHAR 1597 +#define F_RANDOM_ 1598 +#define F_SETSEED 1599 +#define F_ASIN 1600 +#define F_ACOS 1601 +#define F_ATAN 1602 +#define F_ATAN2 1603 +#define F_SIN 1604 +#define F_COS 1605 +#define F_TAN 1606 +#define F_COT 1607 +#define F_DEGREES 1608 +#define F_RADIANS 1609 +#define F_PI 1610 +#define F_INTERVAL_MUL 1618 +#define F_PG_TYPEOF 1619 +#define F_ASCII 1620 +#define F_CHR 1621 +#define F_REPEAT 1622 +#define F_SIMILAR_ESCAPE 1623 +#define F_MUL_D_INTERVAL 1624 +#define F_BPCHARLIKE 1631 +#define F_BPCHARNLIKE 1632 +#define F_TEXTICLIKE 1633 +#define F_TEXTICNLIKE 1634 +#define F_NAMEICLIKE 1635 +#define F_NAMEICNLIKE 1636 +#define F_LIKE_ESCAPE_TEXT_TEXT 1637 +#define F_OIDGT 1638 +#define F_OIDGE 1639 +#define F_PG_GET_VIEWDEF_TEXT 1640 +#define F_PG_GET_VIEWDEF_OID 1641 +#define F_PG_GET_USERBYID 1642 +#define F_PG_GET_INDEXDEF_OID 1643 +#define F_RI_FKEY_CHECK_INS 1644 +#define F_RI_FKEY_CHECK_UPD 1645 +#define F_RI_FKEY_CASCADE_DEL 1646 +#define F_RI_FKEY_CASCADE_UPD 1647 +#define F_RI_FKEY_RESTRICT_DEL 1648 +#define F_RI_FKEY_RESTRICT_UPD 1649 +#define F_RI_FKEY_SETNULL_DEL 1650 +#define F_RI_FKEY_SETNULL_UPD 1651 +#define F_RI_FKEY_SETDEFAULT_DEL 1652 +#define F_RI_FKEY_SETDEFAULT_UPD 1653 +#define F_RI_FKEY_NOACTION_DEL 1654 +#define F_RI_FKEY_NOACTION_UPD 1655 +#define F_BPCHARICREGEXEQ 1656 +#define F_BPCHARICREGEXNE 1657 +#define F_BPCHARREGEXEQ 1658 +#define F_BPCHARREGEXNE 1659 +#define F_BPCHARICLIKE 1660 +#define F_BPCHARICNLIKE 1661 +#define F_PG_GET_TRIGGERDEF_OID 1662 +#define F_PG_GET_SERIAL_SEQUENCE 1665 +#define F_VARBITEQ 1666 +#define F_VARBITNE 1667 +#define F_VARBITGE 1668 +#define F_VARBITGT 1669 +#define F_VARBITLE 1670 +#define F_VARBITLT 1671 +#define F_VARBITCMP 1672 +#define F_BITAND 1673 +#define F_BITOR 1674 +#define F_BITXOR 1675 +#define F_BITNOT 1676 +#define F_BITSHIFTLEFT 1677 +#define F_BITSHIFTRIGHT 1678 +#define F_BITCAT 1679 +#define F_SUBSTRING_BIT_INT4_INT4 1680 +#define F_LENGTH_BIT 1681 +#define F_OCTET_LENGTH_BIT 1682 +#define F_BIT_INT4_INT4 1683 +#define F_INT4_BIT 1684 +#define F_BIT_BIT_INT4_BOOL 1685 +#define F_PG_GET_KEYWORDS 1686 +#define F_VARBIT 1687 +#define F_TIME_HASH 1688 +#define F_ACLEXPLODE 1689 +#define F_TIME_MI_TIME 1690 +#define F_BOOLLE 1691 +#define F_BOOLGE 1692 +#define F_BTBOOLCMP 1693 +#define F_TIMETZ_HASH 1696 +#define F_INTERVAL_HASH 1697 +#define F_POSITION_BIT_BIT 1698 +#define F_SUBSTRING_BIT_INT4 1699 +#define F_NUMERIC_IN 1701 +#define F_NUMERIC_OUT 1702 +#define F_NUMERIC_NUMERIC_INT4 1703 +#define F_NUMERIC_ABS 1704 +#define F_ABS_NUMERIC 1705 +#define F_SIGN_NUMERIC 1706 +#define F_ROUND_NUMERIC_INT4 1707 +#define F_ROUND_NUMERIC 1708 +#define F_TRUNC_NUMERIC_INT4 1709 +#define F_TRUNC_NUMERIC 1710 +#define F_CEIL_NUMERIC 1711 +#define F_FLOOR_NUMERIC 1712 +#define F_LENGTH_BYTEA_NAME 1713 +#define F_CONVERT_FROM 1714 +#define F_CIDR 1715 +#define F_PG_GET_EXPR_PG_NODE_TREE_OID 1716 +#define F_CONVERT_TO 1717 +#define F_NUMERIC_EQ 1718 +#define F_NUMERIC_NE 1719 +#define F_NUMERIC_GT 1720 +#define F_NUMERIC_GE 1721 +#define F_NUMERIC_LT 1722 +#define F_NUMERIC_LE 1723 +#define F_NUMERIC_ADD 1724 +#define F_NUMERIC_SUB 1725 +#define F_NUMERIC_MUL 1726 +#define F_NUMERIC_DIV 1727 +#define F_MOD_NUMERIC_NUMERIC 1728 +#define F_NUMERIC_MOD 1729 +#define F_SQRT_NUMERIC 1730 +#define F_NUMERIC_SQRT 1731 +#define F_EXP_NUMERIC 1732 +#define F_NUMERIC_EXP 1733 +#define F_LN_NUMERIC 1734 +#define F_NUMERIC_LN 1735 +#define F_LOG_NUMERIC_NUMERIC 1736 +#define F_NUMERIC_LOG 1737 +#define F_POW_NUMERIC_NUMERIC 1738 +#define F_NUMERIC_POWER 1739 +#define F_NUMERIC_INT4 1740 +#define F_LOG_NUMERIC 1741 +#define F_NUMERIC_FLOAT4 1742 +#define F_NUMERIC_FLOAT8 1743 +#define F_INT4_NUMERIC 1744 +#define F_FLOAT4_NUMERIC 1745 +#define F_FLOAT8_NUMERIC 1746 +#define F_TIME_PL_INTERVAL 1747 +#define F_TIME_MI_INTERVAL 1748 +#define F_TIMETZ_PL_INTERVAL 1749 +#define F_TIMETZ_MI_INTERVAL 1750 +#define F_NUMERIC_INC 1764 +#define F_SETVAL_REGCLASS_INT8_BOOL 1765 +#define F_NUMERIC_SMALLER 1766 +#define F_NUMERIC_LARGER 1767 +#define F_TO_CHAR_INTERVAL_TEXT 1768 +#define F_NUMERIC_CMP 1769 +#define F_TO_CHAR_TIMESTAMPTZ_TEXT 1770 +#define F_NUMERIC_UMINUS 1771 +#define F_TO_CHAR_NUMERIC_TEXT 1772 +#define F_TO_CHAR_INT4_TEXT 1773 +#define F_TO_CHAR_INT8_TEXT 1774 +#define F_TO_CHAR_FLOAT4_TEXT 1775 +#define F_TO_CHAR_FLOAT8_TEXT 1776 +#define F_TO_NUMBER 1777 +#define F_TO_TIMESTAMP_TEXT_TEXT 1778 +#define F_INT8_NUMERIC 1779 +#define F_TO_DATE 1780 +#define F_NUMERIC_INT8 1781 +#define F_NUMERIC_INT2 1782 +#define F_INT2_NUMERIC 1783 +#define F_OIDIN 1798 +#define F_OIDOUT 1799 +#define F_BIT_LENGTH_BYTEA 1810 +#define F_BIT_LENGTH_TEXT 1811 +#define F_BIT_LENGTH_BIT 1812 +#define F_CONVERT 1813 +#define F_ICLIKESEL 1814 +#define F_ICNLIKESEL 1815 +#define F_ICLIKEJOINSEL 1816 +#define F_ICNLIKEJOINSEL 1817 +#define F_REGEXEQSEL 1818 +#define F_LIKESEL 1819 +#define F_ICREGEXEQSEL 1820 +#define F_REGEXNESEL 1821 +#define F_NLIKESEL 1822 +#define F_ICREGEXNESEL 1823 +#define F_REGEXEQJOINSEL 1824 +#define F_LIKEJOINSEL 1825 +#define F_ICREGEXEQJOINSEL 1826 +#define F_REGEXNEJOINSEL 1827 +#define F_NLIKEJOINSEL 1828 +#define F_ICREGEXNEJOINSEL 1829 +#define F_FLOAT8_AVG 1830 +#define F_FLOAT8_VAR_SAMP 1831 +#define F_FLOAT8_STDDEV_SAMP 1832 +#define F_NUMERIC_ACCUM 1833 +#define F_INT2_ACCUM 1834 +#define F_INT4_ACCUM 1835 +#define F_INT8_ACCUM 1836 +#define F_NUMERIC_AVG 1837 +#define F_NUMERIC_VAR_SAMP 1838 +#define F_NUMERIC_STDDEV_SAMP 1839 +#define F_INT2_SUM 1840 +#define F_INT4_SUM 1841 +#define F_INT8_SUM 1842 +#define F_INTERVAL_AVG_ACCUM 1843 +#define F_INTERVAL_AVG 1844 +#define F_TO_ASCII_TEXT 1845 +#define F_TO_ASCII_TEXT_INT4 1846 +#define F_TO_ASCII_TEXT_NAME 1847 +#define F_INTERVAL_PL_TIME 1848 +#define F_INT28EQ 1850 +#define F_INT28NE 1851 +#define F_INT28LT 1852 +#define F_INT28GT 1853 +#define F_INT28LE 1854 +#define F_INT28GE 1855 +#define F_INT82EQ 1856 +#define F_INT82NE 1857 +#define F_INT82LT 1858 +#define F_INT82GT 1859 +#define F_INT82LE 1860 +#define F_INT82GE 1861 +#define F_INT2AND 1892 +#define F_INT2OR 1893 +#define F_INT2XOR 1894 +#define F_INT2NOT 1895 +#define F_INT2SHL 1896 +#define F_INT2SHR 1897 +#define F_INT4AND 1898 +#define F_INT4OR 1899 +#define F_INT4XOR 1900 +#define F_INT4NOT 1901 +#define F_INT4SHL 1902 +#define F_INT4SHR 1903 +#define F_INT8AND 1904 +#define F_INT8OR 1905 +#define F_INT8XOR 1906 +#define F_INT8NOT 1907 +#define F_INT8SHL 1908 +#define F_INT8SHR 1909 +#define F_INT8UP 1910 +#define F_INT2UP 1911 +#define F_INT4UP 1912 +#define F_FLOAT4UP 1913 +#define F_FLOAT8UP 1914 +#define F_NUMERIC_UPLUS 1915 +#define F_HAS_TABLE_PRIVILEGE_NAME_TEXT_TEXT 1922 +#define F_HAS_TABLE_PRIVILEGE_NAME_OID_TEXT 1923 +#define F_HAS_TABLE_PRIVILEGE_OID_TEXT_TEXT 1924 +#define F_HAS_TABLE_PRIVILEGE_OID_OID_TEXT 1925 +#define F_HAS_TABLE_PRIVILEGE_TEXT_TEXT 1926 +#define F_HAS_TABLE_PRIVILEGE_OID_TEXT 1927 +#define F_PG_STAT_GET_NUMSCANS 1928 +#define F_PG_STAT_GET_TUPLES_RETURNED 1929 +#define F_PG_STAT_GET_TUPLES_FETCHED 1930 +#define F_PG_STAT_GET_TUPLES_INSERTED 1931 +#define F_PG_STAT_GET_TUPLES_UPDATED 1932 +#define F_PG_STAT_GET_TUPLES_DELETED 1933 +#define F_PG_STAT_GET_BLOCKS_FETCHED 1934 +#define F_PG_STAT_GET_BLOCKS_HIT 1935 +#define F_PG_STAT_GET_BACKEND_IDSET 1936 +#define F_PG_STAT_GET_BACKEND_PID 1937 +#define F_PG_STAT_GET_BACKEND_DBID 1938 +#define F_PG_STAT_GET_BACKEND_USERID 1939 +#define F_PG_STAT_GET_BACKEND_ACTIVITY 1940 +#define F_PG_STAT_GET_DB_NUMBACKENDS 1941 +#define F_PG_STAT_GET_DB_XACT_COMMIT 1942 +#define F_PG_STAT_GET_DB_XACT_ROLLBACK 1943 +#define F_PG_STAT_GET_DB_BLOCKS_FETCHED 1944 +#define F_PG_STAT_GET_DB_BLOCKS_HIT 1945 +#define F_ENCODE 1946 +#define F_DECODE 1947 +#define F_BYTEAEQ 1948 +#define F_BYTEALT 1949 +#define F_BYTEALE 1950 +#define F_BYTEAGT 1951 +#define F_BYTEAGE 1952 +#define F_BYTEANE 1953 +#define F_BYTEACMP 1954 +#define F_TIMESTAMP_TIMESTAMP_INT4 1961 +#define F_INT2_AVG_ACCUM 1962 +#define F_INT4_AVG_ACCUM 1963 +#define F_INT8_AVG 1964 +#define F_OIDLARGER 1965 +#define F_OIDSMALLER 1966 +#define F_TIMESTAMPTZ_TIMESTAMPTZ_INT4 1967 +#define F_TIME_TIME_INT4 1968 +#define F_TIMETZ_TIMETZ_INT4 1969 +#define F_PG_STAT_GET_TUPLES_HOT_UPDATED 1972 +#define F_DIV 1973 +#define F_NUMERIC_DIV_TRUNC 1980 +#define F_SIMILAR_TO_ESCAPE_TEXT_TEXT 1986 +#define F_SIMILAR_TO_ESCAPE_TEXT 1987 +#define F_SHOBJ_DESCRIPTION 1993 +#define F_TEXTANYCAT 2003 +#define F_ANYTEXTCAT 2004 +#define F_BYTEALIKE 2005 +#define F_BYTEANLIKE 2006 +#define F_LIKE_BYTEA_BYTEA 2007 +#define F_NOTLIKE_BYTEA_BYTEA 2008 +#define F_LIKE_ESCAPE_BYTEA_BYTEA 2009 +#define F_LENGTH_BYTEA 2010 +#define F_BYTEACAT 2011 +#define F_SUBSTRING_BYTEA_INT4_INT4 2012 +#define F_SUBSTRING_BYTEA_INT4 2013 +#define F_POSITION_BYTEA_BYTEA 2014 +#define F_BTRIM_BYTEA_BYTEA 2015 +#define F_TIME_TIMESTAMPTZ 2019 +#define F_DATE_TRUNC_TEXT_TIMESTAMP 2020 +#define F_DATE_PART_TEXT_TIMESTAMP 2021 +#define F_PG_STAT_GET_ACTIVITY 2022 +#define F_JSONB_PATH_QUERY_FIRST_TZ 2023 +#define F_TIMESTAMP_DATE 2024 +#define F_TIMESTAMP_DATE_TIME 2025 +#define F_PG_BACKEND_PID 2026 +#define F_TIMESTAMP_TIMESTAMPTZ 2027 +#define F_TIMESTAMPTZ_TIMESTAMP 2028 +#define F_DATE_TIMESTAMP 2029 +#define F_JSONB_PATH_MATCH_TZ 2030 +#define F_TIMESTAMP_MI 2031 +#define F_TIMESTAMP_PL_INTERVAL 2032 +#define F_TIMESTAMP_MI_INTERVAL 2033 +#define F_PG_CONF_LOAD_TIME 2034 +#define F_TIMESTAMP_SMALLER 2035 +#define F_TIMESTAMP_LARGER 2036 +#define F_TIMEZONE_TEXT_TIMETZ 2037 +#define F_TIMEZONE_INTERVAL_TIMETZ 2038 +#define F_TIMESTAMP_HASH 2039 +#define F_OVERLAPS_TIMESTAMP_TIMESTAMP_TIMESTAMP_TIMESTAMP 2041 +#define F_OVERLAPS_TIMESTAMP_INTERVAL_TIMESTAMP_INTERVAL 2042 +#define F_OVERLAPS_TIMESTAMP_TIMESTAMP_TIMESTAMP_INTERVAL 2043 +#define F_OVERLAPS_TIMESTAMP_INTERVAL_TIMESTAMP_TIMESTAMP 2044 +#define F_TIMESTAMP_CMP 2045 +#define F_TIME_TIMETZ 2046 +#define F_TIMETZ_TIME 2047 +#define F_ISFINITE_TIMESTAMP 2048 +#define F_TO_CHAR_TIMESTAMP_TEXT 2049 +#define F_MAX_ANYARRAY 2050 +#define F_MIN_ANYARRAY 2051 +#define F_TIMESTAMP_EQ 2052 +#define F_TIMESTAMP_NE 2053 +#define F_TIMESTAMP_LT 2054 +#define F_TIMESTAMP_LE 2055 +#define F_TIMESTAMP_GE 2056 +#define F_TIMESTAMP_GT 2057 +#define F_AGE_TIMESTAMP_TIMESTAMP 2058 +#define F_AGE_TIMESTAMP 2059 +#define F_TIMEZONE_TEXT_TIMESTAMP 2069 +#define F_TIMEZONE_INTERVAL_TIMESTAMP 2070 +#define F_DATE_PL_INTERVAL 2071 +#define F_DATE_MI_INTERVAL 2072 +#define F_SUBSTRING_TEXT_TEXT 2073 +#define F_SUBSTRING_TEXT_TEXT_TEXT 2074 +#define F_BIT_INT8_INT4 2075 +#define F_INT8_BIT 2076 +#define F_CURRENT_SETTING_TEXT 2077 +#define F_SET_CONFIG 2078 +#define F_PG_TABLE_IS_VISIBLE 2079 +#define F_PG_TYPE_IS_VISIBLE 2080 +#define F_PG_FUNCTION_IS_VISIBLE 2081 +#define F_PG_OPERATOR_IS_VISIBLE 2082 +#define F_PG_OPCLASS_IS_VISIBLE 2083 +#define F_PG_SHOW_ALL_SETTINGS 2084 +#define F_SUBSTR_BYTEA_INT4_INT4 2085 +#define F_SUBSTR_BYTEA_INT4 2086 +#define F_REPLACE 2087 +#define F_SPLIT_PART 2088 +#define F_TO_HEX_INT4 2089 +#define F_TO_HEX_INT8 2090 +#define F_ARRAY_LOWER 2091 +#define F_ARRAY_UPPER 2092 +#define F_PG_CONVERSION_IS_VISIBLE 2093 +#define F_PG_STAT_GET_BACKEND_ACTIVITY_START 2094 +#define F_PG_TERMINATE_BACKEND 2096 +#define F_PG_GET_FUNCTIONDEF 2098 +#define F_AVG_INT8 2100 +#define F_AVG_INT4 2101 +#define F_AVG_INT2 2102 +#define F_AVG_NUMERIC 2103 +#define F_AVG_FLOAT4 2104 +#define F_AVG_FLOAT8 2105 +#define F_AVG_INTERVAL 2106 +#define F_SUM_INT8 2107 +#define F_SUM_INT4 2108 +#define F_SUM_INT2 2109 +#define F_SUM_FLOAT4 2110 +#define F_SUM_FLOAT8 2111 +#define F_SUM_MONEY 2112 +#define F_SUM_INTERVAL 2113 +#define F_SUM_NUMERIC 2114 +#define F_MAX_INT8 2115 +#define F_MAX_INT4 2116 +#define F_MAX_INT2 2117 +#define F_MAX_OID 2118 +#define F_MAX_FLOAT4 2119 +#define F_MAX_FLOAT8 2120 +#define F_PG_COLUMN_COMPRESSION 2121 +#define F_MAX_DATE 2122 +#define F_MAX_TIME 2123 +#define F_MAX_TIMETZ 2124 +#define F_MAX_MONEY 2125 +#define F_MAX_TIMESTAMP 2126 +#define F_MAX_TIMESTAMPTZ 2127 +#define F_MAX_INTERVAL 2128 +#define F_MAX_TEXT 2129 +#define F_MAX_NUMERIC 2130 +#define F_MIN_INT8 2131 +#define F_MIN_INT4 2132 +#define F_MIN_INT2 2133 +#define F_MIN_OID 2134 +#define F_MIN_FLOAT4 2135 +#define F_MIN_FLOAT8 2136 +#define F_PG_STAT_FORCE_NEXT_FLUSH 2137 +#define F_MIN_DATE 2138 +#define F_MIN_TIME 2139 +#define F_MIN_TIMETZ 2140 +#define F_MIN_MONEY 2141 +#define F_MIN_TIMESTAMP 2142 +#define F_MIN_TIMESTAMPTZ 2143 +#define F_MIN_INTERVAL 2144 +#define F_MIN_TEXT 2145 +#define F_MIN_NUMERIC 2146 +#define F_COUNT_ANY 2147 +#define F_VARIANCE_INT8 2148 +#define F_VARIANCE_INT4 2149 +#define F_VARIANCE_INT2 2150 +#define F_VARIANCE_FLOAT4 2151 +#define F_VARIANCE_FLOAT8 2152 +#define F_VARIANCE_NUMERIC 2153 +#define F_STDDEV_INT8 2154 +#define F_STDDEV_INT4 2155 +#define F_STDDEV_INT2 2156 +#define F_STDDEV_FLOAT4 2157 +#define F_STDDEV_FLOAT8 2158 +#define F_STDDEV_NUMERIC 2159 +#define F_TEXT_PATTERN_LT 2160 +#define F_TEXT_PATTERN_LE 2161 +#define F_PG_GET_FUNCTION_ARGUMENTS 2162 +#define F_TEXT_PATTERN_GE 2163 +#define F_TEXT_PATTERN_GT 2164 +#define F_PG_GET_FUNCTION_RESULT 2165 +#define F_BTTEXT_PATTERN_CMP 2166 +#define F_CEILING_NUMERIC 2167 +#define F_PG_DATABASE_SIZE_NAME 2168 +#define F_POWER_NUMERIC_NUMERIC 2169 +#define F_WIDTH_BUCKET_NUMERIC_NUMERIC_NUMERIC_INT4 2170 +#define F_PG_CANCEL_BACKEND 2171 +#define F_PG_BACKUP_START 2172 +#define F_BPCHAR_PATTERN_LT 2174 +#define F_BPCHAR_PATTERN_LE 2175 +#define F_ARRAY_LENGTH 2176 +#define F_BPCHAR_PATTERN_GE 2177 +#define F_BPCHAR_PATTERN_GT 2178 +#define F_GIST_POINT_CONSISTENT 2179 +#define F_BTBPCHAR_PATTERN_CMP 2180 +#define F_HAS_SEQUENCE_PRIVILEGE_NAME_TEXT_TEXT 2181 +#define F_HAS_SEQUENCE_PRIVILEGE_NAME_OID_TEXT 2182 +#define F_HAS_SEQUENCE_PRIVILEGE_OID_TEXT_TEXT 2183 +#define F_HAS_SEQUENCE_PRIVILEGE_OID_OID_TEXT 2184 +#define F_HAS_SEQUENCE_PRIVILEGE_TEXT_TEXT 2185 +#define F_HAS_SEQUENCE_PRIVILEGE_OID_TEXT 2186 +#define F_BTINT48CMP 2188 +#define F_BTINT84CMP 2189 +#define F_BTINT24CMP 2190 +#define F_BTINT42CMP 2191 +#define F_BTINT28CMP 2192 +#define F_BTINT82CMP 2193 +#define F_BTFLOAT48CMP 2194 +#define F_BTFLOAT84CMP 2195 +#define F_INET_CLIENT_ADDR 2196 +#define F_INET_CLIENT_PORT 2197 +#define F_INET_SERVER_ADDR 2198 +#define F_INET_SERVER_PORT 2199 +#define F_REGPROCEDUREIN 2212 +#define F_REGPROCEDUREOUT 2213 +#define F_REGOPERIN 2214 +#define F_REGOPEROUT 2215 +#define F_REGOPERATORIN 2216 +#define F_REGOPERATOROUT 2217 +#define F_REGCLASSIN 2218 +#define F_REGCLASSOUT 2219 +#define F_REGTYPEIN 2220 +#define F_REGTYPEOUT 2221 +#define F_PG_STAT_CLEAR_SNAPSHOT 2230 +#define F_PG_GET_FUNCTION_IDENTITY_ARGUMENTS 2232 +#define F_HASHTID 2233 +#define F_HASHTIDEXTENDED 2234 +#define F_BIT_AND_INT2 2236 +#define F_BIT_OR_INT2 2237 +#define F_BIT_AND_INT4 2238 +#define F_BIT_OR_INT4 2239 +#define F_BIT_AND_INT8 2240 +#define F_BIT_OR_INT8 2241 +#define F_BIT_AND_BIT 2242 +#define F_BIT_OR_BIT 2243 +#define F_MAX_BPCHAR 2244 +#define F_MIN_BPCHAR 2245 +#define F_FMGR_INTERNAL_VALIDATOR 2246 +#define F_FMGR_C_VALIDATOR 2247 +#define F_FMGR_SQL_VALIDATOR 2248 +#define F_HAS_DATABASE_PRIVILEGE_NAME_TEXT_TEXT 2250 +#define F_HAS_DATABASE_PRIVILEGE_NAME_OID_TEXT 2251 +#define F_HAS_DATABASE_PRIVILEGE_OID_TEXT_TEXT 2252 +#define F_HAS_DATABASE_PRIVILEGE_OID_OID_TEXT 2253 +#define F_HAS_DATABASE_PRIVILEGE_TEXT_TEXT 2254 +#define F_HAS_DATABASE_PRIVILEGE_OID_TEXT 2255 +#define F_HAS_FUNCTION_PRIVILEGE_NAME_TEXT_TEXT 2256 +#define F_HAS_FUNCTION_PRIVILEGE_NAME_OID_TEXT 2257 +#define F_HAS_FUNCTION_PRIVILEGE_OID_TEXT_TEXT 2258 +#define F_HAS_FUNCTION_PRIVILEGE_OID_OID_TEXT 2259 +#define F_HAS_FUNCTION_PRIVILEGE_TEXT_TEXT 2260 +#define F_HAS_FUNCTION_PRIVILEGE_OID_TEXT 2261 +#define F_HAS_LANGUAGE_PRIVILEGE_NAME_TEXT_TEXT 2262 +#define F_HAS_LANGUAGE_PRIVILEGE_NAME_OID_TEXT 2263 +#define F_HAS_LANGUAGE_PRIVILEGE_OID_TEXT_TEXT 2264 +#define F_HAS_LANGUAGE_PRIVILEGE_OID_OID_TEXT 2265 +#define F_HAS_LANGUAGE_PRIVILEGE_TEXT_TEXT 2266 +#define F_HAS_LANGUAGE_PRIVILEGE_OID_TEXT 2267 +#define F_HAS_SCHEMA_PRIVILEGE_NAME_TEXT_TEXT 2268 +#define F_HAS_SCHEMA_PRIVILEGE_NAME_OID_TEXT 2269 +#define F_HAS_SCHEMA_PRIVILEGE_OID_TEXT_TEXT 2270 +#define F_HAS_SCHEMA_PRIVILEGE_OID_OID_TEXT 2271 +#define F_HAS_SCHEMA_PRIVILEGE_TEXT_TEXT 2272 +#define F_HAS_SCHEMA_PRIVILEGE_OID_TEXT 2273 +#define F_PG_STAT_RESET 2274 +#define F_PG_GET_BACKEND_MEMORY_CONTEXTS 2282 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT 2284 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT_TEXT 2285 +#define F_PG_TOTAL_RELATION_SIZE 2286 +#define F_PG_SIZE_PRETTY_INT8 2288 +#define F_PG_OPTIONS_TO_TABLE 2289 +#define F_RECORD_IN 2290 +#define F_RECORD_OUT 2291 +#define F_CSTRING_IN 2292 +#define F_CSTRING_OUT 2293 +#define F_ANY_IN 2294 +#define F_ANY_OUT 2295 +#define F_ANYARRAY_IN 2296 +#define F_ANYARRAY_OUT 2297 +#define F_VOID_IN 2298 +#define F_VOID_OUT 2299 +#define F_TRIGGER_IN 2300 +#define F_TRIGGER_OUT 2301 +#define F_LANGUAGE_HANDLER_IN 2302 +#define F_LANGUAGE_HANDLER_OUT 2303 +#define F_INTERNAL_IN 2304 +#define F_INTERNAL_OUT 2305 +#define F_PG_STAT_GET_SLRU 2306 +#define F_PG_STAT_RESET_SLRU 2307 +#define F_CEIL_FLOAT8 2308 +#define F_FLOOR_FLOAT8 2309 +#define F_SIGN_FLOAT8 2310 +#define F_MD5_TEXT 2311 +#define F_ANYELEMENT_IN 2312 +#define F_ANYELEMENT_OUT 2313 +#define F_POSTGRESQL_FDW_VALIDATOR 2316 +#define F_PG_ENCODING_MAX_LENGTH 2319 +#define F_CEILING_FLOAT8 2320 +#define F_MD5_BYTEA 2321 +#define F_PG_TABLESPACE_SIZE_OID 2322 +#define F_PG_TABLESPACE_SIZE_NAME 2323 +#define F_PG_DATABASE_SIZE_OID 2324 +#define F_PG_RELATION_SIZE_REGCLASS 2325 +#define F_UNNEST_ANYARRAY 2331 +#define F_PG_RELATION_SIZE_REGCLASS_TEXT 2332 +#define F_ARRAY_AGG_TRANSFN 2333 +#define F_ARRAY_AGG_FINALFN 2334 +#define F_ARRAY_AGG_ANYNONARRAY 2335 +#define F_DATE_LT_TIMESTAMP 2338 +#define F_DATE_LE_TIMESTAMP 2339 +#define F_DATE_EQ_TIMESTAMP 2340 +#define F_DATE_GT_TIMESTAMP 2341 +#define F_DATE_GE_TIMESTAMP 2342 +#define F_DATE_NE_TIMESTAMP 2343 +#define F_DATE_CMP_TIMESTAMP 2344 +#define F_DATE_LT_TIMESTAMPTZ 2351 +#define F_DATE_LE_TIMESTAMPTZ 2352 +#define F_DATE_EQ_TIMESTAMPTZ 2353 +#define F_DATE_GT_TIMESTAMPTZ 2354 +#define F_DATE_GE_TIMESTAMPTZ 2355 +#define F_DATE_NE_TIMESTAMPTZ 2356 +#define F_DATE_CMP_TIMESTAMPTZ 2357 +#define F_TIMESTAMP_LT_DATE 2364 +#define F_TIMESTAMP_LE_DATE 2365 +#define F_TIMESTAMP_EQ_DATE 2366 +#define F_TIMESTAMP_GT_DATE 2367 +#define F_TIMESTAMP_GE_DATE 2368 +#define F_TIMESTAMP_NE_DATE 2369 +#define F_TIMESTAMP_CMP_DATE 2370 +#define F_TIMESTAMPTZ_LT_DATE 2377 +#define F_TIMESTAMPTZ_LE_DATE 2378 +#define F_TIMESTAMPTZ_EQ_DATE 2379 +#define F_TIMESTAMPTZ_GT_DATE 2380 +#define F_TIMESTAMPTZ_GE_DATE 2381 +#define F_TIMESTAMPTZ_NE_DATE 2382 +#define F_TIMESTAMPTZ_CMP_DATE 2383 +#define F_HAS_TABLESPACE_PRIVILEGE_NAME_TEXT_TEXT 2390 +#define F_HAS_TABLESPACE_PRIVILEGE_NAME_OID_TEXT 2391 +#define F_HAS_TABLESPACE_PRIVILEGE_OID_TEXT_TEXT 2392 +#define F_HAS_TABLESPACE_PRIVILEGE_OID_OID_TEXT 2393 +#define F_HAS_TABLESPACE_PRIVILEGE_TEXT_TEXT 2394 +#define F_HAS_TABLESPACE_PRIVILEGE_OID_TEXT 2395 +#define F_SHELL_IN 2398 +#define F_SHELL_OUT 2399 +#define F_ARRAY_RECV 2400 +#define F_ARRAY_SEND 2401 +#define F_RECORD_RECV 2402 +#define F_RECORD_SEND 2403 +#define F_INT2RECV 2404 +#define F_INT2SEND 2405 +#define F_INT4RECV 2406 +#define F_INT4SEND 2407 +#define F_INT8RECV 2408 +#define F_INT8SEND 2409 +#define F_INT2VECTORRECV 2410 +#define F_INT2VECTORSEND 2411 +#define F_BYTEARECV 2412 +#define F_BYTEASEND 2413 +#define F_TEXTRECV 2414 +#define F_TEXTSEND 2415 +#define F_UNKNOWNRECV 2416 +#define F_UNKNOWNSEND 2417 +#define F_OIDRECV 2418 +#define F_OIDSEND 2419 +#define F_OIDVECTORRECV 2420 +#define F_OIDVECTORSEND 2421 +#define F_NAMERECV 2422 +#define F_NAMESEND 2423 +#define F_FLOAT4RECV 2424 +#define F_FLOAT4SEND 2425 +#define F_FLOAT8RECV 2426 +#define F_FLOAT8SEND 2427 +#define F_POINT_RECV 2428 +#define F_POINT_SEND 2429 +#define F_BPCHARRECV 2430 +#define F_BPCHARSEND 2431 +#define F_VARCHARRECV 2432 +#define F_VARCHARSEND 2433 +#define F_CHARRECV 2434 +#define F_CHARSEND 2435 +#define F_BOOLRECV 2436 +#define F_BOOLSEND 2437 +#define F_TIDRECV 2438 +#define F_TIDSEND 2439 +#define F_XIDRECV 2440 +#define F_XIDSEND 2441 +#define F_CIDRECV 2442 +#define F_CIDSEND 2443 +#define F_REGPROCRECV 2444 +#define F_REGPROCSEND 2445 +#define F_REGPROCEDURERECV 2446 +#define F_REGPROCEDURESEND 2447 +#define F_REGOPERRECV 2448 +#define F_REGOPERSEND 2449 +#define F_REGOPERATORRECV 2450 +#define F_REGOPERATORSEND 2451 +#define F_REGCLASSRECV 2452 +#define F_REGCLASSSEND 2453 +#define F_REGTYPERECV 2454 +#define F_REGTYPESEND 2455 +#define F_BIT_RECV 2456 +#define F_BIT_SEND 2457 +#define F_VARBIT_RECV 2458 +#define F_VARBIT_SEND 2459 +#define F_NUMERIC_RECV 2460 +#define F_NUMERIC_SEND 2461 +#define F_SINH 2462 +#define F_COSH 2463 +#define F_TANH 2464 +#define F_ASINH 2465 +#define F_ACOSH 2466 +#define F_ATANH 2467 +#define F_DATE_RECV 2468 +#define F_DATE_SEND 2469 +#define F_TIME_RECV 2470 +#define F_TIME_SEND 2471 +#define F_TIMETZ_RECV 2472 +#define F_TIMETZ_SEND 2473 +#define F_TIMESTAMP_RECV 2474 +#define F_TIMESTAMP_SEND 2475 +#define F_TIMESTAMPTZ_RECV 2476 +#define F_TIMESTAMPTZ_SEND 2477 +#define F_INTERVAL_RECV 2478 +#define F_INTERVAL_SEND 2479 +#define F_LSEG_RECV 2480 +#define F_LSEG_SEND 2481 +#define F_PATH_RECV 2482 +#define F_PATH_SEND 2483 +#define F_BOX_RECV 2484 +#define F_BOX_SEND 2485 +#define F_POLY_RECV 2486 +#define F_POLY_SEND 2487 +#define F_LINE_RECV 2488 +#define F_LINE_SEND 2489 +#define F_CIRCLE_RECV 2490 +#define F_CIRCLE_SEND 2491 +#define F_CASH_RECV 2492 +#define F_CASH_SEND 2493 +#define F_MACADDR_RECV 2494 +#define F_MACADDR_SEND 2495 +#define F_INET_RECV 2496 +#define F_INET_SEND 2497 +#define F_CIDR_RECV 2498 +#define F_CIDR_SEND 2499 +#define F_CSTRING_RECV 2500 +#define F_CSTRING_SEND 2501 +#define F_ANYARRAY_RECV 2502 +#define F_ANYARRAY_SEND 2503 +#define F_PG_GET_RULEDEF_OID_BOOL 2504 +#define F_PG_GET_VIEWDEF_TEXT_BOOL 2505 +#define F_PG_GET_VIEWDEF_OID_BOOL 2506 +#define F_PG_GET_INDEXDEF_OID_INT4_BOOL 2507 +#define F_PG_GET_CONSTRAINTDEF_OID_BOOL 2508 +#define F_PG_GET_EXPR_PG_NODE_TREE_OID_BOOL 2509 +#define F_PG_PREPARED_STATEMENT 2510 +#define F_PG_CURSOR 2511 +#define F_FLOAT8_VAR_POP 2512 +#define F_FLOAT8_STDDEV_POP 2513 +#define F_NUMERIC_VAR_POP 2514 +#define F_BOOLAND_STATEFUNC 2515 +#define F_BOOLOR_STATEFUNC 2516 +#define F_BOOL_AND 2517 +#define F_BOOL_OR 2518 +#define F_EVERY 2519 +#define F_TIMESTAMP_LT_TIMESTAMPTZ 2520 +#define F_TIMESTAMP_LE_TIMESTAMPTZ 2521 +#define F_TIMESTAMP_EQ_TIMESTAMPTZ 2522 +#define F_TIMESTAMP_GT_TIMESTAMPTZ 2523 +#define F_TIMESTAMP_GE_TIMESTAMPTZ 2524 +#define F_TIMESTAMP_NE_TIMESTAMPTZ 2525 +#define F_TIMESTAMP_CMP_TIMESTAMPTZ 2526 +#define F_TIMESTAMPTZ_LT_TIMESTAMP 2527 +#define F_TIMESTAMPTZ_LE_TIMESTAMP 2528 +#define F_TIMESTAMPTZ_EQ_TIMESTAMP 2529 +#define F_TIMESTAMPTZ_GT_TIMESTAMP 2530 +#define F_TIMESTAMPTZ_GE_TIMESTAMP 2531 +#define F_TIMESTAMPTZ_NE_TIMESTAMP 2532 +#define F_TIMESTAMPTZ_CMP_TIMESTAMP 2533 +#define F_INTERVAL_PL_DATE 2546 +#define F_INTERVAL_PL_TIMETZ 2547 +#define F_INTERVAL_PL_TIMESTAMP 2548 +#define F_INTERVAL_PL_TIMESTAMPTZ 2549 +#define F_INTEGER_PL_DATE 2550 +#define F_PG_TABLESPACE_DATABASES 2556 +#define F_BOOL_INT4 2557 +#define F_INT4_BOOL 2558 +#define F_LASTVAL 2559 +#define F_PG_POSTMASTER_START_TIME 2560 +#define F_PG_BLOCKING_PIDS 2561 +#define F_BOX_BELOW 2562 +#define F_BOX_OVERBELOW 2563 +#define F_BOX_OVERABOVE 2564 +#define F_BOX_ABOVE 2565 +#define F_POLY_BELOW 2566 +#define F_POLY_OVERBELOW 2567 +#define F_POLY_OVERABOVE 2568 +#define F_POLY_ABOVE 2569 +#define F_GIST_BOX_CONSISTENT 2578 +#define F_FLOAT8_JSONB 2580 +#define F_GIST_BOX_PENALTY 2581 +#define F_GIST_BOX_PICKSPLIT 2582 +#define F_GIST_BOX_UNION 2583 +#define F_GIST_BOX_SAME 2584 +#define F_GIST_POLY_CONSISTENT 2585 +#define F_GIST_POLY_COMPRESS 2586 +#define F_CIRCLE_OVERBELOW 2587 +#define F_CIRCLE_OVERABOVE 2588 +#define F_GIST_CIRCLE_CONSISTENT 2591 +#define F_GIST_CIRCLE_COMPRESS 2592 +#define F_NUMERIC_STDDEV_POP 2596 +#define F_DOMAIN_IN 2597 +#define F_DOMAIN_RECV 2598 +#define F_PG_TIMEZONE_ABBREVS_ABBREVS 2599 +#define F_XMLEXISTS 2614 +#define F_PG_RELOAD_CONF 2621 +#define F_PG_ROTATE_LOGFILE 2622 +#define F_PG_STAT_FILE_TEXT 2623 +#define F_PG_READ_FILE_TEXT_INT8_INT8 2624 +#define F_PG_LS_DIR_TEXT 2625 +#define F_PG_SLEEP 2626 +#define F_INETNOT 2627 +#define F_INETAND 2628 +#define F_INETOR 2629 +#define F_INETPL 2630 +#define F_INT8PL_INET 2631 +#define F_INETMI_INT8 2632 +#define F_INETMI 2633 +#define F_VAR_SAMP_INT8 2641 +#define F_VAR_SAMP_INT4 2642 +#define F_VAR_SAMP_INT2 2643 +#define F_VAR_SAMP_FLOAT4 2644 +#define F_VAR_SAMP_FLOAT8 2645 +#define F_VAR_SAMP_NUMERIC 2646 +#define F_TRANSACTION_TIMESTAMP 2647 +#define F_STATEMENT_TIMESTAMP 2648 +#define F_CLOCK_TIMESTAMP 2649 +#define F_GIN_CMP_PREFIX 2700 +#define F_PG_HAS_ROLE_NAME_NAME_TEXT 2705 +#define F_PG_HAS_ROLE_NAME_OID_TEXT 2706 +#define F_PG_HAS_ROLE_OID_NAME_TEXT 2707 +#define F_PG_HAS_ROLE_OID_OID_TEXT 2708 +#define F_PG_HAS_ROLE_NAME_TEXT 2709 +#define F_PG_HAS_ROLE_OID_TEXT 2710 +#define F_JUSTIFY_INTERVAL 2711 +#define F_STDDEV_SAMP_INT8 2712 +#define F_STDDEV_SAMP_INT4 2713 +#define F_STDDEV_SAMP_INT2 2714 +#define F_STDDEV_SAMP_FLOAT4 2715 +#define F_STDDEV_SAMP_FLOAT8 2716 +#define F_STDDEV_SAMP_NUMERIC 2717 +#define F_VAR_POP_INT8 2718 +#define F_VAR_POP_INT4 2719 +#define F_VAR_POP_INT2 2720 +#define F_VAR_POP_FLOAT4 2721 +#define F_VAR_POP_FLOAT8 2722 +#define F_VAR_POP_NUMERIC 2723 +#define F_STDDEV_POP_INT8 2724 +#define F_STDDEV_POP_INT4 2725 +#define F_STDDEV_POP_INT2 2726 +#define F_STDDEV_POP_FLOAT4 2727 +#define F_STDDEV_POP_FLOAT8 2728 +#define F_STDDEV_POP_NUMERIC 2729 +#define F_PG_GET_TRIGGERDEF_OID_BOOL 2730 +#define F_ASIND 2731 +#define F_ACOSD 2732 +#define F_ATAND 2733 +#define F_ATAN2D 2734 +#define F_SIND 2735 +#define F_COSD 2736 +#define F_TAND 2737 +#define F_COTD 2738 +#define F_PG_BACKUP_STOP 2739 +#define F_NUMERIC_AVG_SERIALIZE 2740 +#define F_NUMERIC_AVG_DESERIALIZE 2741 +#define F_GINARRAYEXTRACT_ANYARRAY_INTERNAL_INTERNAL 2743 +#define F_GINARRAYCONSISTENT 2744 +#define F_INT8_AVG_ACCUM 2746 +#define F_ARRAYOVERLAP 2747 +#define F_ARRAYCONTAINS 2748 +#define F_ARRAYCONTAINED 2749 +#define F_PG_STAT_GET_DB_TUPLES_RETURNED 2758 +#define F_PG_STAT_GET_DB_TUPLES_FETCHED 2759 +#define F_PG_STAT_GET_DB_TUPLES_INSERTED 2760 +#define F_PG_STAT_GET_DB_TUPLES_UPDATED 2761 +#define F_PG_STAT_GET_DB_TUPLES_DELETED 2762 +#define F_REGEXP_MATCHES_TEXT_TEXT 2763 +#define F_REGEXP_MATCHES_TEXT_TEXT_TEXT 2764 +#define F_REGEXP_SPLIT_TO_TABLE_TEXT_TEXT 2765 +#define F_REGEXP_SPLIT_TO_TABLE_TEXT_TEXT_TEXT 2766 +#define F_REGEXP_SPLIT_TO_ARRAY_TEXT_TEXT 2767 +#define F_REGEXP_SPLIT_TO_ARRAY_TEXT_TEXT_TEXT 2768 +#define F_PG_STAT_GET_CHECKPOINTER_NUM_TIMED 2769 +#define F_PG_STAT_GET_CHECKPOINTER_NUM_REQUESTED 2770 +#define F_PG_STAT_GET_CHECKPOINTER_BUFFERS_WRITTEN 2771 +#define F_PG_STAT_GET_BGWRITER_BUF_WRITTEN_CLEAN 2772 +#define F_PG_STAT_GET_BGWRITER_MAXWRITTEN_CLEAN 2773 +#define F_GINQUERYARRAYEXTRACT 2774 +#define F_ANYNONARRAY_IN 2777 +#define F_ANYNONARRAY_OUT 2778 +#define F_PG_STAT_GET_LAST_VACUUM_TIME 2781 +#define F_PG_STAT_GET_LAST_AUTOVACUUM_TIME 2782 +#define F_PG_STAT_GET_LAST_ANALYZE_TIME 2783 +#define F_PG_STAT_GET_LAST_AUTOANALYZE_TIME 2784 +#define F_INT8_AVG_COMBINE 2785 +#define F_INT8_AVG_SERIALIZE 2786 +#define F_INT8_AVG_DESERIALIZE 2787 +#define F_PG_STAT_GET_BACKEND_WAIT_EVENT_TYPE 2788 +#define F_TIDGT 2790 +#define F_TIDLT 2791 +#define F_TIDGE 2792 +#define F_TIDLE 2793 +#define F_BTTIDCMP 2794 +#define F_TIDLARGER 2795 +#define F_TIDSMALLER 2796 +#define F_MAX_TID 2797 +#define F_MIN_TID 2798 +#define F_COUNT_ 2803 +#define F_INT8INC_ANY 2804 +#define F_INT8INC_FLOAT8_FLOAT8 2805 +#define F_FLOAT8_REGR_ACCUM 2806 +#define F_FLOAT8_REGR_SXX 2807 +#define F_FLOAT8_REGR_SYY 2808 +#define F_FLOAT8_REGR_SXY 2809 +#define F_FLOAT8_REGR_AVGX 2810 +#define F_FLOAT8_REGR_AVGY 2811 +#define F_FLOAT8_REGR_R2 2812 +#define F_FLOAT8_REGR_SLOPE 2813 +#define F_FLOAT8_REGR_INTERCEPT 2814 +#define F_FLOAT8_COVAR_POP 2815 +#define F_FLOAT8_COVAR_SAMP 2816 +#define F_FLOAT8_CORR 2817 +#define F_REGR_COUNT 2818 +#define F_REGR_SXX 2819 +#define F_REGR_SYY 2820 +#define F_REGR_SXY 2821 +#define F_REGR_AVGX 2822 +#define F_REGR_AVGY 2823 +#define F_REGR_R2 2824 +#define F_REGR_SLOPE 2825 +#define F_REGR_INTERCEPT 2826 +#define F_COVAR_POP 2827 +#define F_COVAR_SAMP 2828 +#define F_CORR 2829 +#define F_PG_STAT_GET_DB_BLK_READ_TIME 2844 +#define F_PG_STAT_GET_DB_BLK_WRITE_TIME 2845 +#define F_PG_SWITCH_WAL 2848 +#define F_PG_CURRENT_WAL_LSN 2849 +#define F_PG_WALFILE_NAME_OFFSET 2850 +#define F_PG_WALFILE_NAME 2851 +#define F_PG_CURRENT_WAL_INSERT_LSN 2852 +#define F_PG_STAT_GET_BACKEND_WAIT_EVENT 2853 +#define F_PG_MY_TEMP_SCHEMA 2854 +#define F_PG_IS_OTHER_TEMP_SCHEMA 2855 +#define F_PG_TIMEZONE_NAMES 2856 +#define F_PG_STAT_GET_BACKEND_XACT_START 2857 +#define F_NUMERIC_AVG_ACCUM 2858 +#define F_PG_STAT_GET_BUF_ALLOC 2859 +#define F_PG_STAT_GET_LIVE_TUPLES 2878 +#define F_PG_STAT_GET_DEAD_TUPLES 2879 +#define F_PG_ADVISORY_LOCK_INT8 2880 +#define F_PG_ADVISORY_LOCK_SHARED_INT8 2881 +#define F_PG_TRY_ADVISORY_LOCK_INT8 2882 +#define F_PG_TRY_ADVISORY_LOCK_SHARED_INT8 2883 +#define F_PG_ADVISORY_UNLOCK_INT8 2884 +#define F_PG_ADVISORY_UNLOCK_SHARED_INT8 2885 +#define F_PG_ADVISORY_LOCK_INT4_INT4 2886 +#define F_PG_ADVISORY_LOCK_SHARED_INT4_INT4 2887 +#define F_PG_TRY_ADVISORY_LOCK_INT4_INT4 2888 +#define F_PG_TRY_ADVISORY_LOCK_SHARED_INT4_INT4 2889 +#define F_PG_ADVISORY_UNLOCK_INT4_INT4 2890 +#define F_PG_ADVISORY_UNLOCK_SHARED_INT4_INT4 2891 +#define F_PG_ADVISORY_UNLOCK_ALL 2892 +#define F_XML_IN 2893 +#define F_XML_OUT 2894 +#define F_XMLCOMMENT 2895 +#define F_XML 2896 +#define F_XMLVALIDATE 2897 +#define F_XML_RECV 2898 +#define F_XML_SEND 2899 +#define F_XMLCONCAT2 2900 +#define F_XMLAGG 2901 +#define F_VARBITTYPMODIN 2902 +#define F_INTERVALTYPMODIN 2903 +#define F_INTERVALTYPMODOUT 2904 +#define F_TIMESTAMPTYPMODIN 2905 +#define F_TIMESTAMPTYPMODOUT 2906 +#define F_TIMESTAMPTZTYPMODIN 2907 +#define F_TIMESTAMPTZTYPMODOUT 2908 +#define F_TIMETYPMODIN 2909 +#define F_TIMETYPMODOUT 2910 +#define F_TIMETZTYPMODIN 2911 +#define F_TIMETZTYPMODOUT 2912 +#define F_BPCHARTYPMODIN 2913 +#define F_BPCHARTYPMODOUT 2914 +#define F_VARCHARTYPMODIN 2915 +#define F_VARCHARTYPMODOUT 2916 +#define F_NUMERICTYPMODIN 2917 +#define F_NUMERICTYPMODOUT 2918 +#define F_BITTYPMODIN 2919 +#define F_BITTYPMODOUT 2920 +#define F_VARBITTYPMODOUT 2921 +#define F_TEXT_XML 2922 +#define F_TABLE_TO_XML 2923 +#define F_QUERY_TO_XML 2924 +#define F_CURSOR_TO_XML 2925 +#define F_TABLE_TO_XMLSCHEMA 2926 +#define F_QUERY_TO_XMLSCHEMA 2927 +#define F_CURSOR_TO_XMLSCHEMA 2928 +#define F_TABLE_TO_XML_AND_XMLSCHEMA 2929 +#define F_QUERY_TO_XML_AND_XMLSCHEMA 2930 +#define F_XPATH_TEXT_XML__TEXT 2931 +#define F_XPATH_TEXT_XML 2932 +#define F_SCHEMA_TO_XML 2933 +#define F_SCHEMA_TO_XMLSCHEMA 2934 +#define F_SCHEMA_TO_XML_AND_XMLSCHEMA 2935 +#define F_DATABASE_TO_XML 2936 +#define F_DATABASE_TO_XMLSCHEMA 2937 +#define F_DATABASE_TO_XML_AND_XMLSCHEMA 2938 +#define F_TXID_SNAPSHOT_IN 2939 +#define F_TXID_SNAPSHOT_OUT 2940 +#define F_TXID_SNAPSHOT_RECV 2941 +#define F_TXID_SNAPSHOT_SEND 2942 +#define F_TXID_CURRENT 2943 +#define F_TXID_CURRENT_SNAPSHOT 2944 +#define F_TXID_SNAPSHOT_XMIN 2945 +#define F_TXID_SNAPSHOT_XMAX 2946 +#define F_TXID_SNAPSHOT_XIP 2947 +#define F_TXID_VISIBLE_IN_SNAPSHOT 2948 +#define F_UUID_IN 2952 +#define F_UUID_OUT 2953 +#define F_UUID_LT 2954 +#define F_UUID_LE 2955 +#define F_UUID_EQ 2956 +#define F_UUID_GE 2957 +#define F_UUID_GT 2958 +#define F_UUID_NE 2959 +#define F_UUID_CMP 2960 +#define F_UUID_RECV 2961 +#define F_UUID_SEND 2962 +#define F_UUID_HASH 2963 +#define F_TEXT_BOOL 2971 +#define F_PG_STAT_GET_FUNCTION_CALLS 2978 +#define F_PG_STAT_GET_FUNCTION_TOTAL_TIME 2979 +#define F_PG_STAT_GET_FUNCTION_SELF_TIME 2980 +#define F_RECORD_EQ 2981 +#define F_RECORD_NE 2982 +#define F_RECORD_LT 2983 +#define F_RECORD_GT 2984 +#define F_RECORD_LE 2985 +#define F_RECORD_GE 2986 +#define F_BTRECORDCMP 2987 +#define F_PG_TABLE_SIZE 2997 +#define F_PG_INDEXES_SIZE 2998 +#define F_PG_RELATION_FILENODE 2999 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME_TEXT_TEXT 3000 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME_OID_TEXT 3001 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_OID_TEXT_TEXT 3002 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_OID_OID_TEXT 3003 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_TEXT_TEXT 3004 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_OID_TEXT 3005 +#define F_HAS_SERVER_PRIVILEGE_NAME_TEXT_TEXT 3006 +#define F_HAS_SERVER_PRIVILEGE_NAME_OID_TEXT 3007 +#define F_HAS_SERVER_PRIVILEGE_OID_TEXT_TEXT 3008 +#define F_HAS_SERVER_PRIVILEGE_OID_OID_TEXT 3009 +#define F_HAS_SERVER_PRIVILEGE_TEXT_TEXT 3010 +#define F_HAS_SERVER_PRIVILEGE_OID_TEXT 3011 +#define F_HAS_COLUMN_PRIVILEGE_NAME_TEXT_TEXT_TEXT 3012 +#define F_HAS_COLUMN_PRIVILEGE_NAME_TEXT_INT2_TEXT 3013 +#define F_HAS_COLUMN_PRIVILEGE_NAME_OID_TEXT_TEXT 3014 +#define F_HAS_COLUMN_PRIVILEGE_NAME_OID_INT2_TEXT 3015 +#define F_HAS_COLUMN_PRIVILEGE_OID_TEXT_TEXT_TEXT 3016 +#define F_HAS_COLUMN_PRIVILEGE_OID_TEXT_INT2_TEXT 3017 +#define F_HAS_COLUMN_PRIVILEGE_OID_OID_TEXT_TEXT 3018 +#define F_HAS_COLUMN_PRIVILEGE_OID_OID_INT2_TEXT 3019 +#define F_HAS_COLUMN_PRIVILEGE_TEXT_TEXT_TEXT 3020 +#define F_HAS_COLUMN_PRIVILEGE_TEXT_INT2_TEXT 3021 +#define F_HAS_COLUMN_PRIVILEGE_OID_TEXT_TEXT 3022 +#define F_HAS_COLUMN_PRIVILEGE_OID_INT2_TEXT 3023 +#define F_HAS_ANY_COLUMN_PRIVILEGE_NAME_TEXT_TEXT 3024 +#define F_HAS_ANY_COLUMN_PRIVILEGE_NAME_OID_TEXT 3025 +#define F_HAS_ANY_COLUMN_PRIVILEGE_OID_TEXT_TEXT 3026 +#define F_HAS_ANY_COLUMN_PRIVILEGE_OID_OID_TEXT 3027 +#define F_HAS_ANY_COLUMN_PRIVILEGE_TEXT_TEXT 3028 +#define F_HAS_ANY_COLUMN_PRIVILEGE_OID_TEXT 3029 +#define F_OVERLAY_BIT_BIT_INT4_INT4 3030 +#define F_OVERLAY_BIT_BIT_INT4 3031 +#define F_GET_BIT_BIT_INT4 3032 +#define F_SET_BIT_BIT_INT4_INT4 3033 +#define F_PG_RELATION_FILEPATH 3034 +#define F_PG_LISTENING_CHANNELS 3035 +#define F_PG_NOTIFY 3036 +#define F_PG_STAT_GET_XACT_NUMSCANS 3037 +#define F_PG_STAT_GET_XACT_TUPLES_RETURNED 3038 +#define F_PG_STAT_GET_XACT_TUPLES_FETCHED 3039 +#define F_PG_STAT_GET_XACT_TUPLES_INSERTED 3040 +#define F_PG_STAT_GET_XACT_TUPLES_UPDATED 3041 +#define F_PG_STAT_GET_XACT_TUPLES_DELETED 3042 +#define F_PG_STAT_GET_XACT_TUPLES_HOT_UPDATED 3043 +#define F_PG_STAT_GET_XACT_BLOCKS_FETCHED 3044 +#define F_PG_STAT_GET_XACT_BLOCKS_HIT 3045 +#define F_PG_STAT_GET_XACT_FUNCTION_CALLS 3046 +#define F_PG_STAT_GET_XACT_FUNCTION_TOTAL_TIME 3047 +#define F_PG_STAT_GET_XACT_FUNCTION_SELF_TIME 3048 +#define F_XPATH_EXISTS_TEXT_XML__TEXT 3049 +#define F_XPATH_EXISTS_TEXT_XML 3050 +#define F_XML_IS_WELL_FORMED 3051 +#define F_XML_IS_WELL_FORMED_DOCUMENT 3052 +#define F_XML_IS_WELL_FORMED_CONTENT 3053 +#define F_PG_STAT_GET_VACUUM_COUNT 3054 +#define F_PG_STAT_GET_AUTOVACUUM_COUNT 3055 +#define F_PG_STAT_GET_ANALYZE_COUNT 3056 +#define F_PG_STAT_GET_AUTOANALYZE_COUNT 3057 +#define F_CONCAT 3058 +#define F_CONCAT_WS 3059 +#define F_LEFT 3060 +#define F_RIGHT 3061 +#define F_REVERSE_TEXT 3062 +#define F_GIST_POINT_DISTANCE 3064 +#define F_PG_STAT_GET_DB_CONFLICT_TABLESPACE 3065 +#define F_PG_STAT_GET_DB_CONFLICT_LOCK 3066 +#define F_PG_STAT_GET_DB_CONFLICT_SNAPSHOT 3067 +#define F_PG_STAT_GET_DB_CONFLICT_BUFFERPIN 3068 +#define F_PG_STAT_GET_DB_CONFLICT_STARTUP_DEADLOCK 3069 +#define F_PG_STAT_GET_DB_CONFLICT_ALL 3070 +#define F_PG_WAL_REPLAY_PAUSE 3071 +#define F_PG_WAL_REPLAY_RESUME 3072 +#define F_PG_IS_WAL_REPLAY_PAUSED 3073 +#define F_PG_STAT_GET_DB_STAT_RESET_TIME 3074 +#define F_PG_STAT_GET_BGWRITER_STAT_RESET_TIME 3075 +#define F_GINARRAYEXTRACT_ANYARRAY_INTERNAL 3076 +#define F_GIN_EXTRACT_TSVECTOR_TSVECTOR_INTERNAL 3077 +#define F_PG_SEQUENCE_PARAMETERS 3078 +#define F_PG_AVAILABLE_EXTENSIONS 3082 +#define F_PG_AVAILABLE_EXTENSION_VERSIONS 3083 +#define F_PG_EXTENSION_UPDATE_PATHS 3084 +#define F_PG_EXTENSION_CONFIG_DUMP 3086 +#define F_GIN_EXTRACT_TSQUERY_TSQUERY_INTERNAL_INT2_INTERNAL_INTERNAL 3087 +#define F_GIN_TSQUERY_CONSISTENT_INTERNAL_INT2_TSQUERY_INT4_INTERNAL_INTERNAL 3088 +#define F_PG_ADVISORY_XACT_LOCK_INT8 3089 +#define F_PG_ADVISORY_XACT_LOCK_SHARED_INT8 3090 +#define F_PG_TRY_ADVISORY_XACT_LOCK_INT8 3091 +#define F_PG_TRY_ADVISORY_XACT_LOCK_SHARED_INT8 3092 +#define F_PG_ADVISORY_XACT_LOCK_INT4_INT4 3093 +#define F_PG_ADVISORY_XACT_LOCK_SHARED_INT4_INT4 3094 +#define F_PG_TRY_ADVISORY_XACT_LOCK_INT4_INT4 3095 +#define F_PG_TRY_ADVISORY_XACT_LOCK_SHARED_INT4_INT4 3096 +#define F_VARCHAR_SUPPORT 3097 +#define F_PG_CREATE_RESTORE_POINT 3098 +#define F_PG_STAT_GET_WAL_SENDERS 3099 +#define F_ROW_NUMBER 3100 +#define F_RANK_ 3101 +#define F_DENSE_RANK_ 3102 +#define F_PERCENT_RANK_ 3103 +#define F_CUME_DIST_ 3104 +#define F_NTILE 3105 +#define F_LAG_ANYELEMENT 3106 +#define F_LAG_ANYELEMENT_INT4 3107 +#define F_LAG_ANYCOMPATIBLE_INT4_ANYCOMPATIBLE 3108 +#define F_LEAD_ANYELEMENT 3109 +#define F_LEAD_ANYELEMENT_INT4 3110 +#define F_LEAD_ANYCOMPATIBLE_INT4_ANYCOMPATIBLE 3111 +#define F_FIRST_VALUE 3112 +#define F_LAST_VALUE 3113 +#define F_NTH_VALUE 3114 +#define F_FDW_HANDLER_IN 3116 +#define F_FDW_HANDLER_OUT 3117 +#define F_VOID_RECV 3120 +#define F_VOID_SEND 3121 +#define F_BTINT2SORTSUPPORT 3129 +#define F_BTINT4SORTSUPPORT 3130 +#define F_BTINT8SORTSUPPORT 3131 +#define F_BTFLOAT4SORTSUPPORT 3132 +#define F_BTFLOAT8SORTSUPPORT 3133 +#define F_BTOIDSORTSUPPORT 3134 +#define F_BTNAMESORTSUPPORT 3135 +#define F_DATE_SORTSUPPORT 3136 +#define F_TIMESTAMP_SORTSUPPORT 3137 +#define F_HAS_TYPE_PRIVILEGE_NAME_TEXT_TEXT 3138 +#define F_HAS_TYPE_PRIVILEGE_NAME_OID_TEXT 3139 +#define F_HAS_TYPE_PRIVILEGE_OID_TEXT_TEXT 3140 +#define F_HAS_TYPE_PRIVILEGE_OID_OID_TEXT 3141 +#define F_HAS_TYPE_PRIVILEGE_TEXT_TEXT 3142 +#define F_HAS_TYPE_PRIVILEGE_OID_TEXT 3143 +#define F_MACADDR_NOT 3144 +#define F_MACADDR_AND 3145 +#define F_MACADDR_OR 3146 +#define F_PG_STAT_GET_DB_TEMP_FILES 3150 +#define F_PG_STAT_GET_DB_TEMP_BYTES 3151 +#define F_PG_STAT_GET_DB_DEADLOCKS 3152 +#define F_ARRAY_TO_JSON_ANYARRAY 3153 +#define F_ARRAY_TO_JSON_ANYARRAY_BOOL 3154 +#define F_ROW_TO_JSON_RECORD 3155 +#define F_ROW_TO_JSON_RECORD_BOOL 3156 +#define F_NUMERIC_SUPPORT 3157 +#define F_VARBIT_SUPPORT 3158 +#define F_PG_GET_VIEWDEF_OID_INT4 3159 +#define F_PG_STAT_GET_CHECKPOINTER_WRITE_TIME 3160 +#define F_PG_STAT_GET_CHECKPOINTER_SYNC_TIME 3161 +#define F_PG_COLLATION_FOR 3162 +#define F_PG_TRIGGER_DEPTH 3163 +#define F_PG_WAL_LSN_DIFF 3165 +#define F_PG_SIZE_PRETTY_NUMERIC 3166 +#define F_ARRAY_REMOVE 3167 +#define F_ARRAY_REPLACE 3168 +#define F_RANGESEL 3169 +#define F_LO_LSEEK64 3170 +#define F_LO_TELL64 3171 +#define F_LO_TRUNCATE64 3172 +#define F_JSON_AGG_TRANSFN 3173 +#define F_JSON_AGG_FINALFN 3174 +#define F_JSON_AGG 3175 +#define F_TO_JSON 3176 +#define F_PG_STAT_GET_MOD_SINCE_ANALYZE 3177 +#define F_NUMERIC_SUM 3178 +#define F_CARDINALITY 3179 +#define F_JSON_OBJECT_AGG_TRANSFN 3180 +#define F_RECORD_IMAGE_EQ 3181 +#define F_RECORD_IMAGE_NE 3182 +#define F_RECORD_IMAGE_LT 3183 +#define F_RECORD_IMAGE_GT 3184 +#define F_RECORD_IMAGE_LE 3185 +#define F_RECORD_IMAGE_GE 3186 +#define F_BTRECORDIMAGECMP 3187 +#define F_PG_STAT_GET_ARCHIVER 3195 +#define F_JSON_OBJECT_AGG_FINALFN 3196 +#define F_JSON_OBJECT_AGG 3197 +#define F_JSON_BUILD_ARRAY_ANY 3198 +#define F_JSON_BUILD_ARRAY_ 3199 +#define F_JSON_BUILD_OBJECT_ANY 3200 +#define F_JSON_BUILD_OBJECT_ 3201 +#define F_JSON_OBJECT__TEXT 3202 +#define F_JSON_OBJECT__TEXT__TEXT 3203 +#define F_JSON_TO_RECORD 3204 +#define F_JSON_TO_RECORDSET 3205 +#define F_JSONB_ARRAY_LENGTH 3207 +#define F_JSONB_EACH 3208 +#define F_JSONB_POPULATE_RECORD 3209 +#define F_JSONB_TYPEOF 3210 +#define F_JSONB_OBJECT_FIELD_TEXT 3214 +#define F_JSONB_ARRAY_ELEMENT 3215 +#define F_JSONB_ARRAY_ELEMENT_TEXT 3216 +#define F_JSONB_EXTRACT_PATH 3217 +#define F_WIDTH_BUCKET_ANYCOMPATIBLE_ANYCOMPATIBLEARRAY 3218 +#define F_JSONB_ARRAY_ELEMENTS 3219 +#define F_PG_LSN_IN 3229 +#define F_PG_LSN_OUT 3230 +#define F_PG_LSN_LT 3231 +#define F_PG_LSN_LE 3232 +#define F_PG_LSN_EQ 3233 +#define F_PG_LSN_GE 3234 +#define F_PG_LSN_GT 3235 +#define F_PG_LSN_NE 3236 +#define F_PG_LSN_MI 3237 +#define F_PG_LSN_RECV 3238 +#define F_PG_LSN_SEND 3239 +#define F_PG_LSN_CMP 3251 +#define F_PG_LSN_HASH 3252 +#define F_BTTEXTSORTSUPPORT 3255 +#define F_GENERATE_SERIES_NUMERIC_NUMERIC_NUMERIC 3259 +#define F_GENERATE_SERIES_NUMERIC_NUMERIC 3260 +#define F_JSON_STRIP_NULLS 3261 +#define F_JSONB_STRIP_NULLS 3262 +#define F_JSONB_OBJECT__TEXT 3263 +#define F_JSONB_OBJECT__TEXT__TEXT 3264 +#define F_JSONB_AGG_TRANSFN 3265 +#define F_JSONB_AGG_FINALFN 3266 +#define F_JSONB_AGG 3267 +#define F_JSONB_OBJECT_AGG_TRANSFN 3268 +#define F_JSONB_OBJECT_AGG_FINALFN 3269 +#define F_JSONB_OBJECT_AGG 3270 +#define F_JSONB_BUILD_ARRAY_ANY 3271 +#define F_JSONB_BUILD_ARRAY_ 3272 +#define F_JSONB_BUILD_OBJECT_ANY 3273 +#define F_JSONB_BUILD_OBJECT_ 3274 +#define F_DIST_PPOLY 3275 +#define F_ARRAY_POSITION_ANYCOMPATIBLEARRAY_ANYCOMPATIBLE 3277 +#define F_ARRAY_POSITION_ANYCOMPATIBLEARRAY_ANYCOMPATIBLE_INT4 3278 +#define F_ARRAY_POSITIONS 3279 +#define F_GIST_CIRCLE_DISTANCE 3280 +#define F_SCALE 3281 +#define F_GIST_POINT_FETCH 3282 +#define F_NUMERIC_SORTSUPPORT 3283 +#define F_GIST_POLY_DISTANCE 3288 +#define F_DIST_CPOINT 3290 +#define F_DIST_POLYP 3292 +#define F_PG_READ_FILE_TEXT_INT8_INT8_BOOL 3293 +#define F_CURRENT_SETTING_TEXT_BOOL 3294 +#define F_PG_READ_BINARY_FILE_TEXT_INT8_INT8_BOOL 3295 +#define F_PG_NOTIFICATION_QUEUE_USAGE 3296 +#define F_PG_LS_DIR_TEXT_BOOL_BOOL 3297 +#define F_ROW_SECURITY_ACTIVE_OID 3298 +#define F_ROW_SECURITY_ACTIVE_TEXT 3299 +#define F_UUID_SORTSUPPORT 3300 +#define F_JSONB_CONCAT 3301 +#define F_JSONB_DELETE_JSONB_TEXT 3302 +#define F_JSONB_DELETE_JSONB_INT4 3303 +#define F_JSONB_DELETE_PATH 3304 +#define F_JSONB_SET 3305 +#define F_JSONB_PRETTY 3306 +#define F_PG_STAT_FILE_TEXT_BOOL 3307 +#define F_XIDNEQ 3308 +#define F_XIDNEQINT4 3309 +#define F_TSM_HANDLER_IN 3311 +#define F_TSM_HANDLER_OUT 3312 +#define F_BERNOULLI 3313 +#define F_SYSTEM 3314 +#define F_PG_STAT_GET_WAL_RECEIVER 3317 +#define F_PG_STAT_GET_PROGRESS_INFO 3318 +#define F_TS_FILTER 3319 +#define F_SETWEIGHT_TSVECTOR_CHAR__TEXT 3320 +#define F_TS_DELETE_TSVECTOR_TEXT 3321 +#define F_UNNEST_TSVECTOR 3322 +#define F_TS_DELETE_TSVECTOR__TEXT 3323 +#define F_INT4_AVG_COMBINE 3324 +#define F_INTERVAL_AVG_COMBINE 3325 +#define F_TSVECTOR_TO_ARRAY 3326 +#define F_ARRAY_TO_TSVECTOR 3327 +#define F_BPCHAR_SORTSUPPORT 3328 +#define F_PG_SHOW_ALL_FILE_SETTINGS 3329 +#define F_PG_CURRENT_WAL_FLUSH_LSN 3330 +#define F_BYTEA_SORTSUPPORT 3331 +#define F_BTTEXT_PATTERN_SORTSUPPORT 3332 +#define F_BTBPCHAR_PATTERN_SORTSUPPORT 3333 +#define F_PG_SIZE_BYTES 3334 +#define F_NUMERIC_SERIALIZE 3335 +#define F_NUMERIC_DESERIALIZE 3336 +#define F_NUMERIC_AVG_COMBINE 3337 +#define F_NUMERIC_POLY_COMBINE 3338 +#define F_NUMERIC_POLY_SERIALIZE 3339 +#define F_NUMERIC_POLY_DESERIALIZE 3340 +#define F_NUMERIC_COMBINE 3341 +#define F_FLOAT8_REGR_COMBINE 3342 +#define F_JSONB_DELETE_JSONB__TEXT 3343 +#define F_CASH_MUL_INT8 3344 +#define F_CASH_DIV_INT8 3345 +#define F_TXID_CURRENT_IF_ASSIGNED 3348 +#define F_PG_GET_PARTKEYDEF 3352 +#define F_PG_LS_LOGDIR 3353 +#define F_PG_LS_WALDIR 3354 +#define F_PG_NDISTINCT_IN 3355 +#define F_PG_NDISTINCT_OUT 3356 +#define F_PG_NDISTINCT_RECV 3357 +#define F_PG_NDISTINCT_SEND 3358 +#define F_MACADDR_SORTSUPPORT 3359 +#define F_TXID_STATUS 3360 +#define F_PG_SAFE_SNAPSHOT_BLOCKING_PIDS 3376 +#define F_PG_ISOLATION_TEST_SESSION_IS_BLOCKED 3378 +#define F_PG_IDENTIFY_OBJECT_AS_ADDRESS 3382 +#define F_BRIN_MINMAX_OPCINFO 3383 +#define F_BRIN_MINMAX_ADD_VALUE 3384 +#define F_BRIN_MINMAX_CONSISTENT 3385 +#define F_BRIN_MINMAX_UNION 3386 +#define F_INT8_AVG_ACCUM_INV 3387 +#define F_NUMERIC_POLY_SUM 3388 +#define F_NUMERIC_POLY_AVG 3389 +#define F_NUMERIC_POLY_VAR_POP 3390 +#define F_NUMERIC_POLY_VAR_SAMP 3391 +#define F_NUMERIC_POLY_STDDEV_POP 3392 +#define F_NUMERIC_POLY_STDDEV_SAMP 3393 +#define F_REGEXP_MATCH_TEXT_TEXT 3396 +#define F_REGEXP_MATCH_TEXT_TEXT_TEXT 3397 +#define F_INT8_MUL_CASH 3399 +#define F_PG_CONFIG 3400 +#define F_PG_HBA_FILE_RULES 3401 +#define F_PG_STATISTICS_OBJ_IS_VISIBLE 3403 +#define F_PG_DEPENDENCIES_IN 3404 +#define F_PG_DEPENDENCIES_OUT 3405 +#define F_PG_DEPENDENCIES_RECV 3406 +#define F_PG_DEPENDENCIES_SEND 3407 +#define F_PG_GET_PARTITION_CONSTRAINTDEF 3408 +#define F_TIME_HASH_EXTENDED 3409 +#define F_TIMETZ_HASH_EXTENDED 3410 +#define F_TIMESTAMP_HASH_EXTENDED 3411 +#define F_UUID_HASH_EXTENDED 3412 +#define F_PG_LSN_HASH_EXTENDED 3413 +#define F_HASHENUMEXTENDED 3414 +#define F_PG_GET_STATISTICSOBJDEF 3415 +#define F_JSONB_HASH_EXTENDED 3416 +#define F_HASH_RANGE_EXTENDED 3417 +#define F_INTERVAL_HASH_EXTENDED 3418 +#define F_SHA224 3419 +#define F_SHA256 3420 +#define F_SHA384 3421 +#define F_SHA512 3422 +#define F_PG_PARTITION_TREE 3423 +#define F_PG_PARTITION_ROOT 3424 +#define F_PG_PARTITION_ANCESTORS 3425 +#define F_PG_STAT_GET_DB_CHECKSUM_FAILURES 3426 +#define F_PG_MCV_LIST_ITEMS 3427 +#define F_PG_STAT_GET_DB_CHECKSUM_LAST_FAILURE 3428 +#define F_GEN_RANDOM_UUID 3432 +#define F_GTSVECTOR_OPTIONS 3434 +#define F_GIST_POINT_SORTSUPPORT 3435 +#define F_PG_PROMOTE 3436 +#define F_PREFIXSEL 3437 +#define F_PREFIXJOINSEL 3438 +#define F_PG_CONTROL_SYSTEM 3441 +#define F_PG_CONTROL_CHECKPOINT 3442 +#define F_PG_CONTROL_RECOVERY 3443 +#define F_PG_CONTROL_INIT 3444 +#define F_PG_IMPORT_SYSTEM_COLLATIONS 3445 +#define F_MACADDR8_RECV 3446 +#define F_MACADDR8_SEND 3447 +#define F_PG_COLLATION_ACTUAL_VERSION 3448 +#define F_NUMERIC_JSONB 3449 +#define F_INT2_JSONB 3450 +#define F_INT4_JSONB 3451 +#define F_INT8_JSONB 3452 +#define F_FLOAT4_JSONB 3453 +#define F_PG_FILENODE_RELATION 3454 +#define F_LO_FROM_BYTEA 3457 +#define F_LO_GET_OID 3458 +#define F_LO_GET_OID_INT8_INT4 3459 +#define F_LO_PUT 3460 +#define F_MAKE_TIMESTAMP 3461 +#define F_MAKE_TIMESTAMPTZ_INT4_INT4_INT4_INT4_INT4_FLOAT8 3462 +#define F_MAKE_TIMESTAMPTZ_INT4_INT4_INT4_INT4_INT4_FLOAT8_TEXT 3463 +#define F_MAKE_INTERVAL 3464 +#define F_JSONB_ARRAY_ELEMENTS_TEXT 3465 +#define F_SPG_RANGE_QUAD_CONFIG 3469 +#define F_SPG_RANGE_QUAD_CHOOSE 3470 +#define F_SPG_RANGE_QUAD_PICKSPLIT 3471 +#define F_SPG_RANGE_QUAD_INNER_CONSISTENT 3472 +#define F_SPG_RANGE_QUAD_LEAF_CONSISTENT 3473 +#define F_JSONB_POPULATE_RECORDSET 3475 +#define F_TO_REGOPERATOR 3476 +#define F_JSONB_OBJECT_FIELD 3478 +#define F_TO_REGPROCEDURE 3479 +#define F_GIN_COMPARE_JSONB 3480 +#define F_GIN_EXTRACT_JSONB 3482 +#define F_GIN_EXTRACT_JSONB_QUERY 3483 +#define F_GIN_CONSISTENT_JSONB 3484 +#define F_GIN_EXTRACT_JSONB_PATH 3485 +#define F_GIN_EXTRACT_JSONB_QUERY_PATH 3486 +#define F_GIN_CONSISTENT_JSONB_PATH 3487 +#define F_GIN_TRICONSISTENT_JSONB 3488 +#define F_GIN_TRICONSISTENT_JSONB_PATH 3489 +#define F_JSONB_TO_RECORD 3490 +#define F_JSONB_TO_RECORDSET 3491 +#define F_TO_REGOPER 3492 +#define F_TO_REGTYPE 3493 +#define F_TO_REGPROC 3494 +#define F_TO_REGCLASS 3495 +#define F_BOOL_ACCUM 3496 +#define F_BOOL_ACCUM_INV 3497 +#define F_BOOL_ALLTRUE 3498 +#define F_BOOL_ANYTRUE 3499 +#define F_ANYENUM_IN 3504 +#define F_ANYENUM_OUT 3505 +#define F_ENUM_IN 3506 +#define F_ENUM_OUT 3507 +#define F_ENUM_EQ 3508 +#define F_ENUM_NE 3509 +#define F_ENUM_LT 3510 +#define F_ENUM_GT 3511 +#define F_ENUM_LE 3512 +#define F_ENUM_GE 3513 +#define F_ENUM_CMP 3514 +#define F_HASHENUM 3515 +#define F_ENUM_SMALLER 3524 +#define F_ENUM_LARGER 3525 +#define F_MAX_ANYENUM 3526 +#define F_MIN_ANYENUM 3527 +#define F_ENUM_FIRST 3528 +#define F_ENUM_LAST 3529 +#define F_ENUM_RANGE_ANYENUM_ANYENUM 3530 +#define F_ENUM_RANGE_ANYENUM 3531 +#define F_ENUM_RECV 3532 +#define F_ENUM_SEND 3533 +#define F_STRING_AGG_TRANSFN 3535 +#define F_STRING_AGG_FINALFN 3536 +#define F_PG_DESCRIBE_OBJECT 3537 +#define F_STRING_AGG_TEXT_TEXT 3538 +#define F_FORMAT_TEXT_ANY 3539 +#define F_FORMAT_TEXT 3540 +#define F_BYTEA_STRING_AGG_TRANSFN 3543 +#define F_BYTEA_STRING_AGG_FINALFN 3544 +#define F_STRING_AGG_BYTEA_BYTEA 3545 +#define F_INT8DEC 3546 +#define F_INT8DEC_ANY 3547 +#define F_NUMERIC_ACCUM_INV 3548 +#define F_INTERVAL_AVG_ACCUM_INV 3549 +#define F_NETWORK_OVERLAP 3551 +#define F_INET_GIST_CONSISTENT 3553 +#define F_INET_GIST_UNION 3554 +#define F_INET_GIST_COMPRESS 3555 +#define F_BOOL_JSONB 3556 +#define F_INET_GIST_PENALTY 3557 +#define F_INET_GIST_PICKSPLIT 3558 +#define F_INET_GIST_SAME 3559 +#define F_NETWORKSEL 3560 +#define F_NETWORKJOINSEL 3561 +#define F_NETWORK_LARGER 3562 +#define F_NETWORK_SMALLER 3563 +#define F_MAX_INET 3564 +#define F_MIN_INET 3565 +#define F_PG_EVENT_TRIGGER_DROPPED_OBJECTS 3566 +#define F_INT2_ACCUM_INV 3567 +#define F_INT4_ACCUM_INV 3568 +#define F_INT8_ACCUM_INV 3569 +#define F_INT2_AVG_ACCUM_INV 3570 +#define F_INT4_AVG_ACCUM_INV 3571 +#define F_INT2INT4_SUM 3572 +#define F_INET_GIST_FETCH 3573 +#define F_PG_LOGICAL_EMIT_MESSAGE_BOOL_TEXT_TEXT_BOOL 3577 +#define F_PG_LOGICAL_EMIT_MESSAGE_BOOL_TEXT_BYTEA_BOOL 3578 +#define F_JSONB_INSERT 3579 +#define F_PG_XACT_COMMIT_TIMESTAMP 3581 +#define F_BINARY_UPGRADE_SET_NEXT_PG_TYPE_OID 3582 +#define F_PG_LAST_COMMITTED_XACT 3583 +#define F_BINARY_UPGRADE_SET_NEXT_ARRAY_PG_TYPE_OID 3584 +#define F_BINARY_UPGRADE_SET_NEXT_HEAP_PG_CLASS_OID 3586 +#define F_BINARY_UPGRADE_SET_NEXT_INDEX_PG_CLASS_OID 3587 +#define F_BINARY_UPGRADE_SET_NEXT_TOAST_PG_CLASS_OID 3588 +#define F_BINARY_UPGRADE_SET_NEXT_PG_ENUM_OID 3589 +#define F_BINARY_UPGRADE_SET_NEXT_PG_AUTHID_OID 3590 +#define F_BINARY_UPGRADE_CREATE_EMPTY_EXTENSION 3591 +#define F_EVENT_TRIGGER_IN 3594 +#define F_EVENT_TRIGGER_OUT 3595 +#define F_TSVECTORIN 3610 +#define F_TSVECTOROUT 3611 +#define F_TSQUERYIN 3612 +#define F_TSQUERYOUT 3613 +#define F_TSVECTOR_LT 3616 +#define F_TSVECTOR_LE 3617 +#define F_TSVECTOR_EQ 3618 +#define F_TSVECTOR_NE 3619 +#define F_TSVECTOR_GE 3620 +#define F_TSVECTOR_GT 3621 +#define F_TSVECTOR_CMP 3622 +#define F_STRIP 3623 +#define F_SETWEIGHT_TSVECTOR_CHAR 3624 +#define F_TSVECTOR_CONCAT 3625 +#define F_TS_MATCH_VQ 3634 +#define F_TS_MATCH_QV 3635 +#define F_TSVECTORSEND 3638 +#define F_TSVECTORRECV 3639 +#define F_TSQUERYSEND 3640 +#define F_TSQUERYRECV 3641 +#define F_GTSVECTORIN 3646 +#define F_GTSVECTOROUT 3647 +#define F_GTSVECTOR_COMPRESS 3648 +#define F_GTSVECTOR_DECOMPRESS 3649 +#define F_GTSVECTOR_PICKSPLIT 3650 +#define F_GTSVECTOR_UNION 3651 +#define F_GTSVECTOR_SAME 3652 +#define F_GTSVECTOR_PENALTY 3653 +#define F_GTSVECTOR_CONSISTENT_INTERNAL_TSVECTOR_INT2_OID_INTERNAL 3654 +#define F_GIN_EXTRACT_TSVECTOR_TSVECTOR_INTERNAL_INTERNAL 3656 +#define F_GIN_EXTRACT_TSQUERY_TSVECTOR_INTERNAL_INT2_INTERNAL_INTERNAL_INTERNAL_INTERNAL 3657 +#define F_GIN_TSQUERY_CONSISTENT_INTERNAL_INT2_TSVECTOR_INT4_INTERNAL_INTERNAL_INTERNAL_INTERNAL 3658 +#define F_TSQUERY_LT 3662 +#define F_TSQUERY_LE 3663 +#define F_TSQUERY_EQ 3664 +#define F_TSQUERY_NE 3665 +#define F_TSQUERY_GE 3666 +#define F_TSQUERY_GT 3667 +#define F_TSQUERY_CMP 3668 +#define F_TSQUERY_AND 3669 +#define F_TSQUERY_OR 3670 +#define F_TSQUERY_NOT 3671 +#define F_NUMNODE 3672 +#define F_QUERYTREE 3673 +#define F_TS_REWRITE_TSQUERY_TSQUERY_TSQUERY 3684 +#define F_TS_REWRITE_TSQUERY_TEXT 3685 +#define F_TSMATCHSEL 3686 +#define F_TSMATCHJOINSEL 3687 +#define F_TS_TYPANALYZE 3688 +#define F_TS_STAT_TEXT 3689 +#define F_TS_STAT_TEXT_TEXT 3690 +#define F_TSQ_MCONTAINS 3691 +#define F_TSQ_MCONTAINED 3692 +#define F_GTSQUERY_COMPRESS 3695 +#define F_STARTS_WITH 3696 +#define F_GTSQUERY_PICKSPLIT 3697 +#define F_GTSQUERY_UNION 3698 +#define F_GTSQUERY_SAME 3699 +#define F_GTSQUERY_PENALTY 3700 +#define F_GTSQUERY_CONSISTENT_INTERNAL_TSQUERY_INT2_OID_INTERNAL 3701 +#define F_TS_RANK__FLOAT4_TSVECTOR_TSQUERY_INT4 3703 +#define F_TS_RANK__FLOAT4_TSVECTOR_TSQUERY 3704 +#define F_TS_RANK_TSVECTOR_TSQUERY_INT4 3705 +#define F_TS_RANK_TSVECTOR_TSQUERY 3706 +#define F_TS_RANK_CD__FLOAT4_TSVECTOR_TSQUERY_INT4 3707 +#define F_TS_RANK_CD__FLOAT4_TSVECTOR_TSQUERY 3708 +#define F_TS_RANK_CD_TSVECTOR_TSQUERY_INT4 3709 +#define F_TS_RANK_CD_TSVECTOR_TSQUERY 3710 +#define F_LENGTH_TSVECTOR 3711 +#define F_TS_TOKEN_TYPE_OID 3713 +#define F_TS_TOKEN_TYPE_TEXT 3714 +#define F_TS_PARSE_OID_TEXT 3715 +#define F_TS_PARSE_TEXT_TEXT 3716 +#define F_PRSD_START 3717 +#define F_PRSD_NEXTTOKEN 3718 +#define F_PRSD_END 3719 +#define F_PRSD_HEADLINE 3720 +#define F_PRSD_LEXTYPE 3721 +#define F_TS_LEXIZE 3723 +#define F_GIN_CMP_TSLEXEME 3724 +#define F_DSIMPLE_INIT 3725 +#define F_DSIMPLE_LEXIZE 3726 +#define F_DSYNONYM_INIT 3728 +#define F_DSYNONYM_LEXIZE 3729 +#define F_DISPELL_INIT 3731 +#define F_DISPELL_LEXIZE 3732 +#define F_REGCONFIGIN 3736 +#define F_REGCONFIGOUT 3737 +#define F_REGCONFIGRECV 3738 +#define F_REGCONFIGSEND 3739 +#define F_THESAURUS_INIT 3740 +#define F_THESAURUS_LEXIZE 3741 +#define F_TS_HEADLINE_REGCONFIG_TEXT_TSQUERY_TEXT 3743 +#define F_TS_HEADLINE_REGCONFIG_TEXT_TSQUERY 3744 +#define F_TO_TSVECTOR_REGCONFIG_TEXT 3745 +#define F_TO_TSQUERY_REGCONFIG_TEXT 3746 +#define F_PLAINTO_TSQUERY_REGCONFIG_TEXT 3747 +#define F_TO_TSVECTOR_TEXT 3749 +#define F_TO_TSQUERY_TEXT 3750 +#define F_PLAINTO_TSQUERY_TEXT 3751 +#define F_TSVECTOR_UPDATE_TRIGGER 3752 +#define F_TSVECTOR_UPDATE_TRIGGER_COLUMN 3753 +#define F_TS_HEADLINE_TEXT_TSQUERY_TEXT 3754 +#define F_TS_HEADLINE_TEXT_TSQUERY 3755 +#define F_PG_TS_PARSER_IS_VISIBLE 3756 +#define F_PG_TS_DICT_IS_VISIBLE 3757 +#define F_PG_TS_CONFIG_IS_VISIBLE 3758 +#define F_GET_CURRENT_TS_CONFIG 3759 +#define F_TS_MATCH_TT 3760 +#define F_TS_MATCH_TQ 3761 +#define F_PG_TS_TEMPLATE_IS_VISIBLE 3768 +#define F_REGDICTIONARYIN 3771 +#define F_REGDICTIONARYOUT 3772 +#define F_REGDICTIONARYRECV 3773 +#define F_REGDICTIONARYSEND 3774 +#define F_PG_STAT_RESET_SHARED 3775 +#define F_PG_STAT_RESET_SINGLE_TABLE_COUNTERS 3776 +#define F_PG_STAT_RESET_SINGLE_FUNCTION_COUNTERS 3777 +#define F_PG_TABLESPACE_LOCATION 3778 +#define F_PG_CREATE_PHYSICAL_REPLICATION_SLOT 3779 +#define F_PG_DROP_REPLICATION_SLOT 3780 +#define F_PG_GET_REPLICATION_SLOTS 3781 +#define F_PG_LOGICAL_SLOT_GET_CHANGES 3782 +#define F_PG_LOGICAL_SLOT_GET_BINARY_CHANGES 3783 +#define F_PG_LOGICAL_SLOT_PEEK_CHANGES 3784 +#define F_PG_LOGICAL_SLOT_PEEK_BINARY_CHANGES 3785 +#define F_PG_CREATE_LOGICAL_REPLICATION_SLOT 3786 +#define F_TO_JSONB 3787 +#define F_PG_STAT_GET_SNAPSHOT_TIMESTAMP 3788 +#define F_GIN_CLEAN_PENDING_LIST 3789 +#define F_GTSVECTOR_CONSISTENT_INTERNAL_GTSVECTOR_INT4_OID_INTERNAL 3790 +#define F_GIN_EXTRACT_TSQUERY_TSQUERY_INTERNAL_INT2_INTERNAL_INTERNAL_INTERNAL_INTERNAL 3791 +#define F_GIN_TSQUERY_CONSISTENT_INTERNAL_INT2_TSQUERY_INT4_INTERNAL_INTERNAL_INTERNAL_INTERNAL 3792 +#define F_GTSQUERY_CONSISTENT_INTERNAL_INTERNAL_INT4_OID_INTERNAL 3793 +#define F_INET_SPG_CONFIG 3795 +#define F_INET_SPG_CHOOSE 3796 +#define F_INET_SPG_PICKSPLIT 3797 +#define F_INET_SPG_INNER_CONSISTENT 3798 +#define F_INET_SPG_LEAF_CONSISTENT 3799 +#define F_PG_CURRENT_LOGFILE_ 3800 +#define F_PG_CURRENT_LOGFILE_TEXT 3801 +#define F_JSONB_SEND 3803 +#define F_JSONB_OUT 3804 +#define F_JSONB_RECV 3805 +#define F_JSONB_IN 3806 +#define F_PG_GET_FUNCTION_ARG_DEFAULT 3808 +#define F_PG_EXPORT_SNAPSHOT 3809 +#define F_PG_IS_IN_RECOVERY 3810 +#define F_MONEY_INT4 3811 +#define F_MONEY_INT8 3812 +#define F_XMLTEXT 3813 +#define F_PG_COLLATION_IS_VISIBLE 3815 +#define F_ARRAY_TYPANALYZE 3816 +#define F_ARRAYCONTSEL 3817 +#define F_ARRAYCONTJOINSEL 3818 +#define F_PG_GET_MULTIXACT_MEMBERS 3819 +#define F_PG_LAST_WAL_RECEIVE_LSN 3820 +#define F_PG_LAST_WAL_REPLAY_LSN 3821 +#define F_CASH_DIV_CASH 3822 +#define F_NUMERIC_MONEY 3823 +#define F_MONEY_NUMERIC 3824 +#define F_PG_READ_FILE_TEXT 3826 +#define F_PG_READ_BINARY_FILE_TEXT_INT8_INT8 3827 +#define F_PG_READ_BINARY_FILE_TEXT 3828 +#define F_PG_OPFAMILY_IS_VISIBLE 3829 +#define F_PG_LAST_XACT_REPLAY_TIMESTAMP 3830 +#define F_ANYRANGE_IN 3832 +#define F_ANYRANGE_OUT 3833 +#define F_RANGE_IN 3834 +#define F_RANGE_OUT 3835 +#define F_RANGE_RECV 3836 +#define F_RANGE_SEND 3837 +#define F_PG_IDENTIFY_OBJECT 3839 +#define F_INT4RANGE_INT4_INT4 3840 +#define F_INT4RANGE_INT4_INT4_TEXT 3841 +#define F_PG_RELATION_IS_UPDATABLE 3842 +#define F_PG_COLUMN_IS_UPDATABLE 3843 +#define F_NUMRANGE_NUMERIC_NUMERIC 3844 +#define F_NUMRANGE_NUMERIC_NUMERIC_TEXT 3845 +#define F_MAKE_DATE 3846 +#define F_MAKE_TIME 3847 +#define F_LOWER_ANYRANGE 3848 +#define F_UPPER_ANYRANGE 3849 +#define F_ISEMPTY_ANYRANGE 3850 +#define F_LOWER_INC_ANYRANGE 3851 +#define F_UPPER_INC_ANYRANGE 3852 +#define F_LOWER_INF_ANYRANGE 3853 +#define F_UPPER_INF_ANYRANGE 3854 +#define F_RANGE_EQ 3855 +#define F_RANGE_NE 3856 +#define F_RANGE_OVERLAPS 3857 +#define F_RANGE_CONTAINS_ELEM 3858 +#define F_RANGE_CONTAINS 3859 +#define F_ELEM_CONTAINED_BY_RANGE 3860 +#define F_RANGE_CONTAINED_BY 3861 +#define F_RANGE_ADJACENT 3862 +#define F_RANGE_BEFORE 3863 +#define F_RANGE_AFTER 3864 +#define F_RANGE_OVERLEFT 3865 +#define F_RANGE_OVERRIGHT 3866 +#define F_RANGE_UNION 3867 +#define F_RANGE_INTERSECT 3868 +#define F_RANGE_MINUS 3869 +#define F_RANGE_CMP 3870 +#define F_RANGE_LT 3871 +#define F_RANGE_LE 3872 +#define F_RANGE_GE 3873 +#define F_RANGE_GT 3874 +#define F_RANGE_GIST_CONSISTENT 3875 +#define F_RANGE_GIST_UNION 3876 +#define F_PG_REPLICATION_SLOT_ADVANCE 3878 +#define F_RANGE_GIST_PENALTY 3879 +#define F_RANGE_GIST_PICKSPLIT 3880 +#define F_RANGE_GIST_SAME 3881 +#define F_HASH_RANGE 3902 +#define F_INT4RANGE_CANONICAL 3914 +#define F_DATERANGE_CANONICAL 3915 +#define F_RANGE_TYPANALYZE 3916 +#define F_TIMESTAMP_SUPPORT 3917 +#define F_INTERVAL_SUPPORT 3918 +#define F_GINARRAYTRICONSISTENT 3920 +#define F_GIN_TSQUERY_TRICONSISTENT 3921 +#define F_INT4RANGE_SUBDIFF 3922 +#define F_INT8RANGE_SUBDIFF 3923 +#define F_NUMRANGE_SUBDIFF 3924 +#define F_DATERANGE_SUBDIFF 3925 +#define F_INT8RANGE_CANONICAL 3928 +#define F_TSRANGE_SUBDIFF 3929 +#define F_TSTZRANGE_SUBDIFF 3930 +#define F_JSONB_OBJECT_KEYS 3931 +#define F_JSONB_EACH_TEXT 3932 +#define F_TSRANGE_TIMESTAMP_TIMESTAMP 3933 +#define F_TSRANGE_TIMESTAMP_TIMESTAMP_TEXT 3934 +#define F_PG_SLEEP_FOR 3935 +#define F_PG_SLEEP_UNTIL 3936 +#define F_TSTZRANGE_TIMESTAMPTZ_TIMESTAMPTZ 3937 +#define F_TSTZRANGE_TIMESTAMPTZ_TIMESTAMPTZ_TEXT 3938 +#define F_MXID_AGE 3939 +#define F_JSONB_EXTRACT_PATH_TEXT 3940 +#define F_DATERANGE_DATE_DATE 3941 +#define F_DATERANGE_DATE_DATE_TEXT 3942 +#define F_ACLDEFAULT 3943 +#define F_TIME_SUPPORT 3944 +#define F_INT8RANGE_INT8_INT8 3945 +#define F_INT8RANGE_INT8_INT8_TEXT 3946 +#define F_JSON_OBJECT_FIELD 3947 +#define F_JSON_OBJECT_FIELD_TEXT 3948 +#define F_JSON_ARRAY_ELEMENT 3949 +#define F_JSON_ARRAY_ELEMENT_TEXT 3950 +#define F_JSON_EXTRACT_PATH 3951 +#define F_BRIN_SUMMARIZE_NEW_VALUES 3952 +#define F_JSON_EXTRACT_PATH_TEXT 3953 +#define F_PG_GET_OBJECT_ADDRESS 3954 +#define F_JSON_ARRAY_ELEMENTS 3955 +#define F_JSON_ARRAY_LENGTH 3956 +#define F_JSON_OBJECT_KEYS 3957 +#define F_JSON_EACH 3958 +#define F_JSON_EACH_TEXT 3959 +#define F_JSON_POPULATE_RECORD 3960 +#define F_JSON_POPULATE_RECORDSET 3961 +#define F_JSON_TYPEOF 3968 +#define F_JSON_ARRAY_ELEMENTS_TEXT 3969 +#define F_ORDERED_SET_TRANSITION 3970 +#define F_ORDERED_SET_TRANSITION_MULTI 3971 +#define F_PERCENTILE_DISC_FLOAT8_ANYELEMENT 3972 +#define F_PERCENTILE_DISC_FINAL 3973 +#define F_PERCENTILE_CONT_FLOAT8_FLOAT8 3974 +#define F_PERCENTILE_CONT_FLOAT8_FINAL 3975 +#define F_PERCENTILE_CONT_FLOAT8_INTERVAL 3976 +#define F_PERCENTILE_CONT_INTERVAL_FINAL 3977 +#define F_PERCENTILE_DISC__FLOAT8_ANYELEMENT 3978 +#define F_PERCENTILE_DISC_MULTI_FINAL 3979 +#define F_PERCENTILE_CONT__FLOAT8_FLOAT8 3980 +#define F_PERCENTILE_CONT_FLOAT8_MULTI_FINAL 3981 +#define F_PERCENTILE_CONT__FLOAT8_INTERVAL 3982 +#define F_PERCENTILE_CONT_INTERVAL_MULTI_FINAL 3983 +#define F_MODE 3984 +#define F_MODE_FINAL 3985 +#define F_RANK_ANY 3986 +#define F_RANK_FINAL 3987 +#define F_PERCENT_RANK_ANY 3988 +#define F_PERCENT_RANK_FINAL 3989 +#define F_CUME_DIST_ANY 3990 +#define F_CUME_DIST_FINAL 3991 +#define F_DENSE_RANK_ANY 3992 +#define F_DENSE_RANK_FINAL 3993 +#define F_GENERATE_SERIES_INT4_SUPPORT 3994 +#define F_GENERATE_SERIES_INT8_SUPPORT 3995 +#define F_ARRAY_UNNEST_SUPPORT 3996 +#define F_GIST_BOX_DISTANCE 3998 +#define F_BRIN_SUMMARIZE_RANGE 3999 +#define F_JSONPATH_IN 4001 +#define F_JSONPATH_RECV 4002 +#define F_JSONPATH_OUT 4003 +#define F_JSONPATH_SEND 4004 +#define F_JSONB_PATH_EXISTS 4005 +#define F_JSONB_PATH_QUERY 4006 +#define F_JSONB_PATH_QUERY_ARRAY 4007 +#define F_JSONB_PATH_QUERY_FIRST 4008 +#define F_JSONB_PATH_MATCH 4009 +#define F_JSONB_PATH_EXISTS_OPR 4010 +#define F_JSONB_PATH_MATCH_OPR 4011 +#define F_BRIN_DESUMMARIZE_RANGE 4014 +#define F_SPG_QUAD_CONFIG 4018 +#define F_SPG_QUAD_CHOOSE 4019 +#define F_SPG_QUAD_PICKSPLIT 4020 +#define F_SPG_QUAD_INNER_CONSISTENT 4021 +#define F_SPG_QUAD_LEAF_CONSISTENT 4022 +#define F_SPG_KD_CONFIG 4023 +#define F_SPG_KD_CHOOSE 4024 +#define F_SPG_KD_PICKSPLIT 4025 +#define F_SPG_KD_INNER_CONSISTENT 4026 +#define F_SPG_TEXT_CONFIG 4027 +#define F_SPG_TEXT_CHOOSE 4028 +#define F_SPG_TEXT_PICKSPLIT 4029 +#define F_SPG_TEXT_INNER_CONSISTENT 4030 +#define F_SPG_TEXT_LEAF_CONSISTENT 4031 +#define F_PG_SEQUENCE_LAST_VALUE 4032 +#define F_JSONB_NE 4038 +#define F_JSONB_LT 4039 +#define F_JSONB_GT 4040 +#define F_JSONB_LE 4041 +#define F_JSONB_GE 4042 +#define F_JSONB_EQ 4043 +#define F_JSONB_CMP 4044 +#define F_JSONB_HASH 4045 +#define F_JSONB_CONTAINS 4046 +#define F_JSONB_EXISTS 4047 +#define F_JSONB_EXISTS_ANY 4048 +#define F_JSONB_EXISTS_ALL 4049 +#define F_JSONB_CONTAINED 4050 +#define F_ARRAY_AGG_ARRAY_TRANSFN 4051 +#define F_ARRAY_AGG_ARRAY_FINALFN 4052 +#define F_ARRAY_AGG_ANYARRAY 4053 +#define F_RANGE_MERGE_ANYRANGE_ANYRANGE 4057 +#define F_INET_MERGE 4063 +#define F_BOUND_BOX 4067 +#define F_INET_SAME_FAMILY 4071 +#define F_BINARY_UPGRADE_SET_RECORD_INIT_PRIVS 4083 +#define F_REGNAMESPACEIN 4084 +#define F_REGNAMESPACEOUT 4085 +#define F_TO_REGNAMESPACE 4086 +#define F_REGNAMESPACERECV 4087 +#define F_REGNAMESPACESEND 4088 +#define F_BOX_POINT 4091 +#define F_REGROLEOUT 4092 +#define F_TO_REGROLE 4093 +#define F_REGROLERECV 4094 +#define F_REGROLESEND 4095 +#define F_REGROLEIN 4098 +#define F_PG_NUMA_AVAILABLE 4099 +#define F_PG_GET_SHMEM_ALLOCATIONS_NUMA 4100 +#define F_BINARY_UPGRADE_SET_MISSING_VALUE 4101 +#define F_BRIN_INCLUSION_OPCINFO 4105 +#define F_BRIN_INCLUSION_ADD_VALUE 4106 +#define F_BRIN_INCLUSION_CONSISTENT 4107 +#define F_BRIN_INCLUSION_UNION 4108 +#define F_MACADDR8_IN 4110 +#define F_MACADDR8_OUT 4111 +#define F_TRUNC_MACADDR8 4112 +#define F_MACADDR8_EQ 4113 +#define F_MACADDR8_LT 4114 +#define F_MACADDR8_LE 4115 +#define F_MACADDR8_GT 4116 +#define F_MACADDR8_GE 4117 +#define F_MACADDR8_NE 4118 +#define F_MACADDR8_CMP 4119 +#define F_MACADDR8_NOT 4120 +#define F_MACADDR8_AND 4121 +#define F_MACADDR8_OR 4122 +#define F_MACADDR8 4123 +#define F_MACADDR 4124 +#define F_MACADDR8_SET7BIT 4125 +#define F_IN_RANGE_INT8_INT8_INT8_BOOL_BOOL 4126 +#define F_IN_RANGE_INT4_INT4_INT8_BOOL_BOOL 4127 +#define F_IN_RANGE_INT4_INT4_INT4_BOOL_BOOL 4128 +#define F_IN_RANGE_INT4_INT4_INT2_BOOL_BOOL 4129 +#define F_IN_RANGE_INT2_INT2_INT8_BOOL_BOOL 4130 +#define F_IN_RANGE_INT2_INT2_INT4_BOOL_BOOL 4131 +#define F_IN_RANGE_INT2_INT2_INT2_BOOL_BOOL 4132 +#define F_IN_RANGE_DATE_DATE_INTERVAL_BOOL_BOOL 4133 +#define F_IN_RANGE_TIMESTAMP_TIMESTAMP_INTERVAL_BOOL_BOOL 4134 +#define F_IN_RANGE_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL_BOOL_BOOL 4135 +#define F_IN_RANGE_INTERVAL_INTERVAL_INTERVAL_BOOL_BOOL 4136 +#define F_IN_RANGE_TIME_TIME_INTERVAL_BOOL_BOOL 4137 +#define F_IN_RANGE_TIMETZ_TIMETZ_INTERVAL_BOOL_BOOL 4138 +#define F_IN_RANGE_FLOAT8_FLOAT8_FLOAT8_BOOL_BOOL 4139 +#define F_IN_RANGE_FLOAT4_FLOAT4_FLOAT8_BOOL_BOOL 4140 +#define F_IN_RANGE_NUMERIC_NUMERIC_NUMERIC_BOOL_BOOL 4141 +#define F_PG_LSN_LARGER 4187 +#define F_PG_LSN_SMALLER 4188 +#define F_MAX_PG_LSN 4189 +#define F_MIN_PG_LSN 4190 +#define F_REGCOLLATIONIN 4193 +#define F_REGCOLLATIONOUT 4194 +#define F_TO_REGCOLLATION 4195 +#define F_REGCOLLATIONRECV 4196 +#define F_REGCOLLATIONSEND 4197 +#define F_TS_HEADLINE_REGCONFIG_JSONB_TSQUERY_TEXT 4201 +#define F_TS_HEADLINE_REGCONFIG_JSONB_TSQUERY 4202 +#define F_TS_HEADLINE_JSONB_TSQUERY_TEXT 4203 +#define F_TS_HEADLINE_JSONB_TSQUERY 4204 +#define F_TS_HEADLINE_REGCONFIG_JSON_TSQUERY_TEXT 4205 +#define F_TS_HEADLINE_REGCONFIG_JSON_TSQUERY 4206 +#define F_TS_HEADLINE_JSON_TSQUERY_TEXT 4207 +#define F_TS_HEADLINE_JSON_TSQUERY 4208 +#define F_TO_TSVECTOR_JSONB 4209 +#define F_TO_TSVECTOR_JSON 4210 +#define F_TO_TSVECTOR_REGCONFIG_JSONB 4211 +#define F_TO_TSVECTOR_REGCONFIG_JSON 4212 +#define F_JSONB_TO_TSVECTOR_JSONB_JSONB 4213 +#define F_JSONB_TO_TSVECTOR_REGCONFIG_JSONB_JSONB 4214 +#define F_JSON_TO_TSVECTOR_JSON_JSONB 4215 +#define F_JSON_TO_TSVECTOR_REGCONFIG_JSON_JSONB 4216 +#define F_PG_COPY_PHYSICAL_REPLICATION_SLOT_NAME_NAME_BOOL 4220 +#define F_PG_COPY_PHYSICAL_REPLICATION_SLOT_NAME_NAME 4221 +#define F_PG_COPY_LOGICAL_REPLICATION_SLOT_NAME_NAME_BOOL_NAME 4222 +#define F_PG_COPY_LOGICAL_REPLICATION_SLOT_NAME_NAME_BOOL 4223 +#define F_PG_COPY_LOGICAL_REPLICATION_SLOT_NAME_NAME 4224 +#define F_ANYCOMPATIBLEMULTIRANGE_IN 4226 +#define F_ANYCOMPATIBLEMULTIRANGE_OUT 4227 +#define F_RANGE_MERGE_ANYMULTIRANGE 4228 +#define F_ANYMULTIRANGE_IN 4229 +#define F_ANYMULTIRANGE_OUT 4230 +#define F_MULTIRANGE_IN 4231 +#define F_MULTIRANGE_OUT 4232 +#define F_MULTIRANGE_RECV 4233 +#define F_MULTIRANGE_SEND 4234 +#define F_LOWER_ANYMULTIRANGE 4235 +#define F_UPPER_ANYMULTIRANGE 4236 +#define F_ISEMPTY_ANYMULTIRANGE 4237 +#define F_LOWER_INC_ANYMULTIRANGE 4238 +#define F_UPPER_INC_ANYMULTIRANGE 4239 +#define F_LOWER_INF_ANYMULTIRANGE 4240 +#define F_UPPER_INF_ANYMULTIRANGE 4241 +#define F_MULTIRANGE_TYPANALYZE 4242 +#define F_MULTIRANGESEL 4243 +#define F_MULTIRANGE_EQ 4244 +#define F_MULTIRANGE_NE 4245 +#define F_RANGE_OVERLAPS_MULTIRANGE 4246 +#define F_MULTIRANGE_OVERLAPS_RANGE 4247 +#define F_MULTIRANGE_OVERLAPS_MULTIRANGE 4248 +#define F_MULTIRANGE_CONTAINS_ELEM 4249 +#define F_MULTIRANGE_CONTAINS_RANGE 4250 +#define F_MULTIRANGE_CONTAINS_MULTIRANGE 4251 +#define F_ELEM_CONTAINED_BY_MULTIRANGE 4252 +#define F_RANGE_CONTAINED_BY_MULTIRANGE 4253 +#define F_MULTIRANGE_CONTAINED_BY_MULTIRANGE 4254 +#define F_RANGE_ADJACENT_MULTIRANGE 4255 +#define F_MULTIRANGE_ADJACENT_MULTIRANGE 4256 +#define F_MULTIRANGE_ADJACENT_RANGE 4257 +#define F_RANGE_BEFORE_MULTIRANGE 4258 +#define F_MULTIRANGE_BEFORE_RANGE 4259 +#define F_MULTIRANGE_BEFORE_MULTIRANGE 4260 +#define F_RANGE_AFTER_MULTIRANGE 4261 +#define F_MULTIRANGE_AFTER_RANGE 4262 +#define F_MULTIRANGE_AFTER_MULTIRANGE 4263 +#define F_RANGE_OVERLEFT_MULTIRANGE 4264 +#define F_MULTIRANGE_OVERLEFT_RANGE 4265 +#define F_MULTIRANGE_OVERLEFT_MULTIRANGE 4266 +#define F_RANGE_OVERRIGHT_MULTIRANGE 4267 +#define F_MULTIRANGE_OVERRIGHT_RANGE 4268 +#define F_MULTIRANGE_OVERRIGHT_MULTIRANGE 4269 +#define F_MULTIRANGE_UNION 4270 +#define F_MULTIRANGE_MINUS 4271 +#define F_MULTIRANGE_INTERSECT 4272 +#define F_MULTIRANGE_CMP 4273 +#define F_MULTIRANGE_LT 4274 +#define F_MULTIRANGE_LE 4275 +#define F_MULTIRANGE_GE 4276 +#define F_MULTIRANGE_GT 4277 +#define F_HASH_MULTIRANGE 4278 +#define F_HASH_MULTIRANGE_EXTENDED 4279 +#define F_INT4MULTIRANGE_ 4280 +#define F_INT4MULTIRANGE_INT4RANGE 4281 +#define F_INT4MULTIRANGE__INT4RANGE 4282 +#define F_NUMMULTIRANGE_ 4283 +#define F_NUMMULTIRANGE_NUMRANGE 4284 +#define F_NUMMULTIRANGE__NUMRANGE 4285 +#define F_TSMULTIRANGE_ 4286 +#define F_TSMULTIRANGE_TSRANGE 4287 +#define F_TSMULTIRANGE__TSRANGE 4288 +#define F_TSTZMULTIRANGE_ 4289 +#define F_TSTZMULTIRANGE_TSTZRANGE 4290 +#define F_TSTZMULTIRANGE__TSTZRANGE 4291 +#define F_DATEMULTIRANGE_ 4292 +#define F_DATEMULTIRANGE_DATERANGE 4293 +#define F_DATEMULTIRANGE__DATERANGE 4294 +#define F_INT8MULTIRANGE_ 4295 +#define F_INT8MULTIRANGE_INT8RANGE 4296 +#define F_INT8MULTIRANGE__INT8RANGE 4297 +#define F_MULTIRANGE 4298 +#define F_RANGE_AGG_TRANSFN 4299 +#define F_RANGE_AGG_FINALFN 4300 +#define F_RANGE_AGG_ANYRANGE 4301 +#define F_KOI8R_TO_MIC 4302 +#define F_MIC_TO_KOI8R 4303 +#define F_ISO_TO_MIC 4304 +#define F_MIC_TO_ISO 4305 +#define F_WIN1251_TO_MIC 4306 +#define F_MIC_TO_WIN1251 4307 +#define F_WIN866_TO_MIC 4308 +#define F_MIC_TO_WIN866 4309 +#define F_KOI8R_TO_WIN1251 4310 +#define F_WIN1251_TO_KOI8R 4311 +#define F_KOI8R_TO_WIN866 4312 +#define F_WIN866_TO_KOI8R 4313 +#define F_WIN866_TO_WIN1251 4314 +#define F_WIN1251_TO_WIN866 4315 +#define F_ISO_TO_KOI8R 4316 +#define F_KOI8R_TO_ISO 4317 +#define F_ISO_TO_WIN1251 4318 +#define F_WIN1251_TO_ISO 4319 +#define F_ISO_TO_WIN866 4320 +#define F_WIN866_TO_ISO 4321 +#define F_EUC_CN_TO_MIC 4322 +#define F_MIC_TO_EUC_CN 4323 +#define F_EUC_JP_TO_SJIS 4324 +#define F_SJIS_TO_EUC_JP 4325 +#define F_EUC_JP_TO_MIC 4326 +#define F_SJIS_TO_MIC 4327 +#define F_MIC_TO_EUC_JP 4328 +#define F_MIC_TO_SJIS 4329 +#define F_EUC_KR_TO_MIC 4330 +#define F_MIC_TO_EUC_KR 4331 +#define F_EUC_TW_TO_BIG5 4332 +#define F_BIG5_TO_EUC_TW 4333 +#define F_EUC_TW_TO_MIC 4334 +#define F_BIG5_TO_MIC 4335 +#define F_MIC_TO_EUC_TW 4336 +#define F_MIC_TO_BIG5 4337 +#define F_LATIN2_TO_MIC 4338 +#define F_MIC_TO_LATIN2 4339 +#define F_WIN1250_TO_MIC 4340 +#define F_MIC_TO_WIN1250 4341 +#define F_LATIN2_TO_WIN1250 4342 +#define F_WIN1250_TO_LATIN2 4343 +#define F_LATIN1_TO_MIC 4344 +#define F_MIC_TO_LATIN1 4345 +#define F_LATIN3_TO_MIC 4346 +#define F_MIC_TO_LATIN3 4347 +#define F_LATIN4_TO_MIC 4348 +#define F_MIC_TO_LATIN4 4349 +#define F_NORMALIZE 4350 +#define F_IS_NORMALIZED 4351 +#define F_BIG5_TO_UTF8 4352 +#define F_UTF8_TO_BIG5 4353 +#define F_UTF8_TO_KOI8R 4354 +#define F_KOI8R_TO_UTF8 4355 +#define F_UTF8_TO_KOI8U 4356 +#define F_KOI8U_TO_UTF8 4357 +#define F_UTF8_TO_WIN 4358 +#define F_WIN_TO_UTF8 4359 +#define F_EUC_CN_TO_UTF8 4360 +#define F_UTF8_TO_EUC_CN 4361 +#define F_EUC_JP_TO_UTF8 4362 +#define F_UTF8_TO_EUC_JP 4363 +#define F_EUC_KR_TO_UTF8 4364 +#define F_UTF8_TO_EUC_KR 4365 +#define F_EUC_TW_TO_UTF8 4366 +#define F_UTF8_TO_EUC_TW 4367 +#define F_GB18030_TO_UTF8 4368 +#define F_UTF8_TO_GB18030 4369 +#define F_GBK_TO_UTF8 4370 +#define F_UTF8_TO_GBK 4371 +#define F_UTF8_TO_ISO8859 4372 +#define F_ISO8859_TO_UTF8 4373 +#define F_ISO8859_1_TO_UTF8 4374 +#define F_UTF8_TO_ISO8859_1 4375 +#define F_JOHAB_TO_UTF8 4376 +#define F_UTF8_TO_JOHAB 4377 +#define F_SJIS_TO_UTF8 4378 +#define F_UTF8_TO_SJIS 4379 +#define F_UHC_TO_UTF8 4380 +#define F_UTF8_TO_UHC 4381 +#define F_EUC_JIS_2004_TO_UTF8 4382 +#define F_UTF8_TO_EUC_JIS_2004 4383 +#define F_SHIFT_JIS_2004_TO_UTF8 4384 +#define F_UTF8_TO_SHIFT_JIS_2004 4385 +#define F_EUC_JIS_2004_TO_SHIFT_JIS_2004 4386 +#define F_SHIFT_JIS_2004_TO_EUC_JIS_2004 4387 +#define F_MULTIRANGE_INTERSECT_AGG_TRANSFN 4388 +#define F_RANGE_INTERSECT_AGG_ANYMULTIRANGE 4389 +#define F_BINARY_UPGRADE_SET_NEXT_MULTIRANGE_PG_TYPE_OID 4390 +#define F_BINARY_UPGRADE_SET_NEXT_MULTIRANGE_ARRAY_PG_TYPE_OID 4391 +#define F_RANGE_INTERSECT_AGG_TRANSFN 4401 +#define F_RANGE_INTERSECT_AGG_ANYRANGE 4450 +#define F_RANGE_CONTAINS_MULTIRANGE 4541 +#define F_MULTIRANGE_CONTAINED_BY_RANGE 4542 +#define F_PG_LOG_BACKEND_MEMORY_CONTEXTS 4543 +#define F_BINARY_UPGRADE_SET_NEXT_HEAP_RELFILENODE 4545 +#define F_BINARY_UPGRADE_SET_NEXT_INDEX_RELFILENODE 4546 +#define F_BINARY_UPGRADE_SET_NEXT_TOAST_RELFILENODE 4547 +#define F_BINARY_UPGRADE_SET_NEXT_PG_TABLESPACE_OID 4548 +#define F_UNICODE_VERSION 4549 +#define F_PG_EVENT_TRIGGER_TABLE_REWRITE_OID 4566 +#define F_PG_EVENT_TRIGGER_TABLE_REWRITE_REASON 4567 +#define F_PG_EVENT_TRIGGER_DDL_COMMANDS 4568 +#define F_BRIN_BLOOM_OPCINFO 4591 +#define F_BRIN_BLOOM_ADD_VALUE 4592 +#define F_BRIN_BLOOM_CONSISTENT 4593 +#define F_BRIN_BLOOM_UNION 4594 +#define F_BRIN_BLOOM_OPTIONS 4595 +#define F_BRIN_BLOOM_SUMMARY_IN 4596 +#define F_BRIN_BLOOM_SUMMARY_OUT 4597 +#define F_BRIN_BLOOM_SUMMARY_RECV 4598 +#define F_BRIN_BLOOM_SUMMARY_SEND 4599 +#define F_BRIN_MINMAX_MULTI_OPCINFO 4616 +#define F_BRIN_MINMAX_MULTI_ADD_VALUE 4617 +#define F_BRIN_MINMAX_MULTI_CONSISTENT 4618 +#define F_BRIN_MINMAX_MULTI_UNION 4619 +#define F_BRIN_MINMAX_MULTI_OPTIONS 4620 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INT2 4621 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INT4 4622 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INT8 4623 +#define F_BRIN_MINMAX_MULTI_DISTANCE_FLOAT4 4624 +#define F_BRIN_MINMAX_MULTI_DISTANCE_FLOAT8 4625 +#define F_BRIN_MINMAX_MULTI_DISTANCE_NUMERIC 4626 +#define F_BRIN_MINMAX_MULTI_DISTANCE_TID 4627 +#define F_BRIN_MINMAX_MULTI_DISTANCE_UUID 4628 +#define F_BRIN_MINMAX_MULTI_DISTANCE_DATE 4629 +#define F_BRIN_MINMAX_MULTI_DISTANCE_TIME 4630 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INTERVAL 4631 +#define F_BRIN_MINMAX_MULTI_DISTANCE_TIMETZ 4632 +#define F_BRIN_MINMAX_MULTI_DISTANCE_PG_LSN 4633 +#define F_BRIN_MINMAX_MULTI_DISTANCE_MACADDR 4634 +#define F_BRIN_MINMAX_MULTI_DISTANCE_MACADDR8 4635 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INET 4636 +#define F_BRIN_MINMAX_MULTI_DISTANCE_TIMESTAMP 4637 +#define F_BRIN_MINMAX_MULTI_SUMMARY_IN 4638 +#define F_BRIN_MINMAX_MULTI_SUMMARY_OUT 4639 +#define F_BRIN_MINMAX_MULTI_SUMMARY_RECV 4640 +#define F_BRIN_MINMAX_MULTI_SUMMARY_SEND 4641 +#define F_PHRASETO_TSQUERY_TEXT 5001 +#define F_TSQUERY_PHRASE_TSQUERY_TSQUERY 5003 +#define F_TSQUERY_PHRASE_TSQUERY_TSQUERY_INT4 5004 +#define F_PHRASETO_TSQUERY_REGCONFIG_TEXT 5006 +#define F_WEBSEARCH_TO_TSQUERY_REGCONFIG_TEXT 5007 +#define F_WEBSEARCH_TO_TSQUERY_TEXT 5009 +#define F_SPG_BBOX_QUAD_CONFIG 5010 +#define F_SPG_POLY_QUAD_COMPRESS 5011 +#define F_SPG_BOX_QUAD_CONFIG 5012 +#define F_SPG_BOX_QUAD_CHOOSE 5013 +#define F_SPG_BOX_QUAD_PICKSPLIT 5014 +#define F_SPG_BOX_QUAD_INNER_CONSISTENT 5015 +#define F_SPG_BOX_QUAD_LEAF_CONSISTENT 5016 +#define F_PG_MCV_LIST_IN 5018 +#define F_PG_MCV_LIST_OUT 5019 +#define F_PG_MCV_LIST_RECV 5020 +#define F_PG_MCV_LIST_SEND 5021 +#define F_PG_LSN_PLI 5022 +#define F_NUMERIC_PL_PG_LSN 5023 +#define F_PG_LSN_MII 5024 +#define F_SATISFIES_HASH_PARTITION 5028 +#define F_PG_LS_TMPDIR_ 5029 +#define F_PG_LS_TMPDIR_OID 5030 +#define F_PG_LS_ARCHIVE_STATUSDIR 5031 +#define F_NETWORK_SORTSUPPORT 5033 +#define F_XID8LT 5034 +#define F_XID8GT 5035 +#define F_XID8LE 5036 +#define F_XID8GE 5037 +#define F_MATCHINGSEL 5040 +#define F_MATCHINGJOINSEL 5041 +#define F_MIN_SCALE 5042 +#define F_TRIM_SCALE 5043 +#define F_GCD_INT4_INT4 5044 +#define F_GCD_INT8_INT8 5045 +#define F_LCM_INT4_INT4 5046 +#define F_LCM_INT8_INT8 5047 +#define F_GCD_NUMERIC_NUMERIC 5048 +#define F_LCM_NUMERIC_NUMERIC 5049 +#define F_BTVARSTREQUALIMAGE 5050 +#define F_BTEQUALIMAGE 5051 +#define F_PG_GET_SHMEM_ALLOCATIONS 5052 +#define F_PG_STAT_GET_INS_SINCE_VACUUM 5053 +#define F_JSONB_SET_LAX 5054 +#define F_PG_SNAPSHOT_IN 5055 +#define F_PG_SNAPSHOT_OUT 5056 +#define F_PG_SNAPSHOT_RECV 5057 +#define F_PG_SNAPSHOT_SEND 5058 +#define F_PG_CURRENT_XACT_ID 5059 +#define F_PG_CURRENT_XACT_ID_IF_ASSIGNED 5060 +#define F_PG_CURRENT_SNAPSHOT 5061 +#define F_PG_SNAPSHOT_XMIN 5062 +#define F_PG_SNAPSHOT_XMAX 5063 +#define F_PG_SNAPSHOT_XIP 5064 +#define F_PG_VISIBLE_IN_SNAPSHOT 5065 +#define F_PG_XACT_STATUS 5066 +#define F_XID8IN 5070 +#define F_XID 5071 +#define F_XID8OUT 5081 +#define F_XID8RECV 5082 +#define F_XID8SEND 5083 +#define F_XID8EQ 5084 +#define F_XID8NE 5085 +#define F_ANYCOMPATIBLE_IN 5086 +#define F_ANYCOMPATIBLE_OUT 5087 +#define F_ANYCOMPATIBLEARRAY_IN 5088 +#define F_ANYCOMPATIBLEARRAY_OUT 5089 +#define F_ANYCOMPATIBLEARRAY_RECV 5090 +#define F_ANYCOMPATIBLEARRAY_SEND 5091 +#define F_ANYCOMPATIBLENONARRAY_IN 5092 +#define F_ANYCOMPATIBLENONARRAY_OUT 5093 +#define F_ANYCOMPATIBLERANGE_IN 5094 +#define F_ANYCOMPATIBLERANGE_OUT 5095 +#define F_XID8CMP 5096 +#define F_XID8_LARGER 5097 +#define F_XID8_SMALLER 5098 +#define F_MAX_XID8 5099 +#define F_MIN_XID8 5100 +#define F_PG_REPLICATION_ORIGIN_CREATE 6003 +#define F_PG_REPLICATION_ORIGIN_DROP 6004 +#define F_PG_REPLICATION_ORIGIN_OID 6005 +#define F_PG_REPLICATION_ORIGIN_SESSION_SETUP 6006 +#define F_PG_REPLICATION_ORIGIN_SESSION_RESET 6007 +#define F_PG_REPLICATION_ORIGIN_SESSION_IS_SETUP 6008 +#define F_PG_REPLICATION_ORIGIN_SESSION_PROGRESS 6009 +#define F_PG_REPLICATION_ORIGIN_XACT_SETUP 6010 +#define F_PG_REPLICATION_ORIGIN_XACT_RESET 6011 +#define F_PG_REPLICATION_ORIGIN_ADVANCE 6012 +#define F_PG_REPLICATION_ORIGIN_PROGRESS 6013 +#define F_PG_SHOW_REPLICATION_ORIGIN_STATUS 6014 +#define F_JSONB_SUBSCRIPT_HANDLER 6098 +#define F_ICU_UNICODE_VERSION 6099 +#define F_PG_LSN 6103 +#define F_UNICODE_ASSIGNED 6105 +#define F_PG_STAT_GET_BACKEND_SUBXACT 6107 +#define F_PG_STAT_GET_SUBSCRIPTION 6118 +#define F_PG_GET_PUBLICATION_TABLES 6119 +#define F_PG_GET_REPLICA_IDENTITY_INDEX 6120 +#define F_PG_RELATION_IS_PUBLISHABLE 6121 +#define F_MULTIRANGE_GIST_CONSISTENT 6154 +#define F_MULTIRANGE_GIST_COMPRESS 6156 +#define F_PG_GET_CATALOG_FOREIGN_KEYS 6159 +#define F_STRING_TO_TABLE_TEXT_TEXT 6160 +#define F_STRING_TO_TABLE_TEXT_TEXT_TEXT 6161 +#define F_BIT_COUNT_BIT 6162 +#define F_BIT_COUNT_BYTEA 6163 +#define F_BIT_XOR_INT2 6164 +#define F_BIT_XOR_INT4 6165 +#define F_BIT_XOR_INT8 6166 +#define F_BIT_XOR_BIT 6167 +#define F_PG_XACT_COMMIT_TIMESTAMP_ORIGIN 6168 +#define F_PG_STAT_GET_REPLICATION_SLOT 6169 +#define F_PG_STAT_RESET_REPLICATION_SLOT 6170 +#define F_TRIM_ARRAY 6172 +#define F_PG_GET_STATISTICSOBJDEF_EXPRESSIONS 6173 +#define F_PG_GET_STATISTICSOBJDEF_COLUMNS 6174 +#define F_DATE_BIN_INTERVAL_TIMESTAMP_TIMESTAMP 6177 +#define F_DATE_BIN_INTERVAL_TIMESTAMPTZ_TIMESTAMPTZ 6178 +#define F_ARRAY_SUBSCRIPT_HANDLER 6179 +#define F_RAW_ARRAY_SUBSCRIPT_HANDLER 6180 +#define F_TS_DEBUG_REGCONFIG_TEXT 6183 +#define F_TS_DEBUG_TEXT 6184 +#define F_PG_STAT_GET_DB_SESSION_TIME 6185 +#define F_PG_STAT_GET_DB_ACTIVE_TIME 6186 +#define F_PG_STAT_GET_DB_IDLE_IN_TRANSACTION_TIME 6187 +#define F_PG_STAT_GET_DB_SESSIONS 6188 +#define F_PG_STAT_GET_DB_SESSIONS_ABANDONED 6189 +#define F_PG_STAT_GET_DB_SESSIONS_FATAL 6190 +#define F_PG_STAT_GET_DB_SESSIONS_KILLED 6191 +#define F_HASH_RECORD 6192 +#define F_HASH_RECORD_EXTENDED 6193 +#define F_LTRIM_BYTEA_BYTEA 6195 +#define F_RTRIM_BYTEA_BYTEA 6196 +#define F_PG_GET_FUNCTION_SQLBODY 6197 +#define F_UNISTR 6198 +#define F_EXTRACT_TEXT_DATE 6199 +#define F_EXTRACT_TEXT_TIME 6200 +#define F_EXTRACT_TEXT_TIMETZ 6201 +#define F_EXTRACT_TEXT_TIMESTAMP 6202 +#define F_EXTRACT_TEXT_TIMESTAMPTZ 6203 +#define F_EXTRACT_TEXT_INTERVAL 6204 +#define F_HAS_PARAMETER_PRIVILEGE_NAME_TEXT_TEXT 6205 +#define F_HAS_PARAMETER_PRIVILEGE_OID_TEXT_TEXT 6206 +#define F_HAS_PARAMETER_PRIVILEGE_TEXT_TEXT 6207 +#define F_PG_READ_FILE_TEXT_BOOL 6208 +#define F_PG_READ_BINARY_FILE_TEXT_BOOL 6209 +#define F_PG_INPUT_IS_VALID 6210 +#define F_PG_INPUT_ERROR_INFO 6211 +#define F_RANDOM_NORMAL 6212 +#define F_PG_SPLIT_WALFILE_NAME 6213 +#define F_PG_STAT_GET_IO 6214 +#define F_ARRAY_SHUFFLE 6215 +#define F_ARRAY_SAMPLE 6216 +#define F_PG_STAT_GET_TUPLES_NEWPAGE_UPDATED 6217 +#define F_PG_STAT_GET_XACT_TUPLES_NEWPAGE_UPDATED 6218 +#define F_ERF 6219 +#define F_ERFC 6220 +#define F_DATE_ADD_TIMESTAMPTZ_INTERVAL 6221 +#define F_DATE_ADD_TIMESTAMPTZ_INTERVAL_TEXT 6222 +#define F_DATE_SUBTRACT_TIMESTAMPTZ_INTERVAL 6223 +#define F_PG_GET_WAL_RESOURCE_MANAGERS 6224 +#define F_MULTIRANGE_AGG_TRANSFN 6225 +#define F_MULTIRANGE_AGG_FINALFN 6226 +#define F_RANGE_AGG_ANYMULTIRANGE 6227 +#define F_PG_STAT_HAVE_STATS 6230 +#define F_PG_STAT_GET_SUBSCRIPTION_STATS 6231 +#define F_PG_STAT_RESET_SUBSCRIPTION_STATS 6232 +#define F_WINDOW_ROW_NUMBER_SUPPORT 6233 +#define F_WINDOW_RANK_SUPPORT 6234 +#define F_WINDOW_DENSE_RANK_SUPPORT 6235 +#define F_INT8INC_SUPPORT 6236 +#define F_PG_SETTINGS_GET_FLAGS 6240 +#define F_PG_STOP_MAKING_PINNED_OBJECTS 6241 +#define F_TEXT_STARTS_WITH_SUPPORT 6242 +#define F_PG_STAT_GET_RECOVERY_PREFETCH 6248 +#define F_PG_DATABASE_COLLATION_ACTUAL_VERSION 6249 +#define F_PG_IDENT_FILE_MAPPINGS 6250 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT_INT4_INT4_TEXT 6251 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT_INT4_INT4 6252 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT_INT4 6253 +#define F_REGEXP_COUNT_TEXT_TEXT 6254 +#define F_REGEXP_COUNT_TEXT_TEXT_INT4 6255 +#define F_REGEXP_COUNT_TEXT_TEXT_INT4_TEXT 6256 +#define F_REGEXP_INSTR_TEXT_TEXT 6257 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4 6258 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4_INT4 6259 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4_INT4_INT4 6260 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4_INT4_INT4_TEXT 6261 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4_INT4_INT4_TEXT_INT4 6262 +#define F_REGEXP_LIKE_TEXT_TEXT 6263 +#define F_REGEXP_LIKE_TEXT_TEXT_TEXT 6264 +#define F_REGEXP_SUBSTR_TEXT_TEXT 6265 +#define F_REGEXP_SUBSTR_TEXT_TEXT_INT4 6266 +#define F_REGEXP_SUBSTR_TEXT_TEXT_INT4_INT4 6267 +#define F_REGEXP_SUBSTR_TEXT_TEXT_INT4_INT4_TEXT 6268 +#define F_REGEXP_SUBSTR_TEXT_TEXT_INT4_INT4_TEXT_INT4 6269 +#define F_PG_LS_LOGICALSNAPDIR 6270 +#define F_PG_LS_LOGICALMAPDIR 6271 +#define F_PG_LS_REPLSLOTDIR 6272 +#define F_DATE_SUBTRACT_TIMESTAMPTZ_INTERVAL_TEXT 6273 +#define F_GENERATE_SERIES_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL_TEXT 6274 +#define F_JSON_AGG_STRICT_TRANSFN 6275 +#define F_JSON_AGG_STRICT 6276 +#define F_JSON_OBJECT_AGG_STRICT_TRANSFN 6277 +#define F_JSON_OBJECT_AGG_UNIQUE_TRANSFN 6278 +#define F_JSON_OBJECT_AGG_UNIQUE_STRICT_TRANSFN 6279 +#define F_JSON_OBJECT_AGG_STRICT 6280 +#define F_JSON_OBJECT_AGG_UNIQUE 6281 +#define F_JSON_OBJECT_AGG_UNIQUE_STRICT 6282 +#define F_JSONB_AGG_STRICT_TRANSFN 6283 +#define F_JSONB_AGG_STRICT 6284 +#define F_JSONB_OBJECT_AGG_STRICT_TRANSFN 6285 +#define F_JSONB_OBJECT_AGG_UNIQUE_TRANSFN 6286 +#define F_JSONB_OBJECT_AGG_UNIQUE_STRICT_TRANSFN 6287 +#define F_JSONB_OBJECT_AGG_STRICT 6288 +#define F_JSONB_OBJECT_AGG_UNIQUE 6289 +#define F_JSONB_OBJECT_AGG_UNIQUE_STRICT 6290 +#define F_ANY_VALUE 6291 +#define F_ANY_VALUE_TRANSFN 6292 +#define F_ARRAY_AGG_COMBINE 6293 +#define F_ARRAY_AGG_SERIALIZE 6294 +#define F_ARRAY_AGG_DESERIALIZE 6295 +#define F_ARRAY_AGG_ARRAY_COMBINE 6296 +#define F_ARRAY_AGG_ARRAY_SERIALIZE 6297 +#define F_ARRAY_AGG_ARRAY_DESERIALIZE 6298 +#define F_STRING_AGG_COMBINE 6299 +#define F_STRING_AGG_SERIALIZE 6300 +#define F_STRING_AGG_DESERIALIZE 6301 +#define F_PG_LOG_STANDBY_SNAPSHOT 6305 +#define F_WINDOW_PERCENT_RANK_SUPPORT 6306 +#define F_WINDOW_CUME_DIST_SUPPORT 6307 +#define F_WINDOW_NTILE_SUPPORT 6308 +#define F_PG_STAT_GET_DB_CONFLICT_LOGICALSLOT 6309 +#define F_PG_STAT_GET_LASTSCAN 6310 +#define F_SYSTEM_USER 6311 +#define F_BINARY_UPGRADE_LOGICAL_SLOT_HAS_CAUGHT_UP 6312 +#define F_PG_STAT_GET_BACKEND_WAL 6313 +#define F_PG_STAT_GET_CHECKPOINTER_STAT_RESET_TIME 6314 +#define F_PG_BASETYPE 6315 +#define F_PG_COLUMN_TOAST_CHUNK_ID 6316 +#define F_TO_REGTYPEMOD 6317 +#define F_PG_GET_WAIT_EVENTS 6318 +#define F_BINARY_UPGRADE_ADD_SUB_REL_STATE 6319 +#define F_BINARY_UPGRADE_REPLORIGIN_ADVANCE 6320 +#define F_PG_AVAILABLE_WAL_SUMMARIES 6321 +#define F_PG_WAL_SUMMARY_CONTENTS 6322 +#define F_PG_GET_WAL_SUMMARIZER_STATE 6323 +#define F_INTERVAL_AVG_SERIALIZE 6324 +#define F_INTERVAL_AVG_DESERIALIZE 6325 +#define F_INTERVAL_SUM 6326 +#define F_PG_STAT_GET_CHECKPOINTER_RESTARTPOINTS_TIMED 6327 +#define F_PG_STAT_GET_CHECKPOINTER_RESTARTPOINTS_REQUESTED 6328 +#define F_PG_STAT_GET_CHECKPOINTER_RESTARTPOINTS_PERFORMED 6329 +#define F_TO_BIN_INT4 6330 +#define F_TO_BIN_INT8 6331 +#define F_TO_OCT_INT4 6332 +#define F_TO_OCT_INT8 6333 +#define F_TIMEZONE_TIMESTAMPTZ 6334 +#define F_TIMEZONE_TIMESTAMP 6335 +#define F_TIMEZONE_TIMETZ 6336 +#define F_JSONB_POPULATE_RECORD_VALID 6338 +#define F_RANDOM_INT4_INT4 6339 +#define F_RANDOM_INT8_INT8 6340 +#define F_RANDOM_NUMERIC_NUMERIC 6341 +#define F_UUID_EXTRACT_TIMESTAMP 6342 +#define F_UUID_EXTRACT_VERSION 6343 +#define F_PG_SYNC_REPLICATION_SLOTS 6344 +#define F_RANGE_CONTAINS_ELEM_SUPPORT 6345 +#define F_ELEM_CONTAINED_BY_RANGE_SUPPORT 6346 +#define F_GIST_TRANSLATE_CMPTYPE_COMMON 6347 +#define F_HAS_LARGEOBJECT_PRIVILEGE_NAME_OID_TEXT 6348 +#define F_HAS_LARGEOBJECT_PRIVILEGE_OID_TEXT 6349 +#define F_HAS_LARGEOBJECT_PRIVILEGE_OID_OID_TEXT 6350 +#define F_PG_GET_LOADED_MODULES 6353 +#define F_GENERATE_SERIES_TIMESTAMP_SUPPORT 6354 +#define F_PG_STAT_GET_DB_PARALLEL_WORKERS_TO_LAUNCH 6355 +#define F_PG_STAT_GET_DB_PARALLEL_WORKERS_LAUNCHED 6356 +#define F_GENERATE_SERIES_NUMERIC_SUPPORT 6357 +#define F_PG_STAT_GET_TOTAL_VACUUM_TIME 6358 +#define F_PG_STAT_GET_TOTAL_AUTOVACUUM_TIME 6359 +#define F_PG_STAT_GET_TOTAL_ANALYZE_TIME 6360 +#define F_PG_STAT_GET_TOTAL_AUTOANALYZE_TIME 6361 +#define F_PG_RESTORE_RELATION_STATS 6362 +#define F_PG_RESTORE_ATTRIBUTE_STATS 6363 +#define F_CRC32 6364 +#define F_CRC32C 6365 +#define F_PG_STAT_GET_CHECKPOINTER_SLRU_WRITTEN 6366 +#define F_BYTEA_INT2 6367 +#define F_BYTEA_INT4 6368 +#define F_BYTEA_INT8 6369 +#define F_INT2_BYTEA 6370 +#define F_INT4_BYTEA 6371 +#define F_INT8_BYTEA 6372 +#define F_MAX_RECORD 6373 +#define F_MIN_RECORD 6374 +#define F_RECORD_LARGER 6375 +#define F_RECORD_SMALLER 6376 +#define F_PG_STAT_GET_CHECKPOINTER_NUM_PERFORMED 6377 +#define F_ARRAY_APPEND_SUPPORT 6378 +#define F_ARRAY_PREPEND_SUPPORT 6379 +#define F_ARRAY_SUBSCRIPT_HANDLER_SUPPORT 6380 +#define F_ARRAY_REVERSE 6381 +#define F_REVERSE_BYTEA 6382 +#define F_GAMMA 6383 +#define F_LGAMMA 6384 +#define F_PG_GET_ACL 6385 +#define F_PG_STAT_GET_BACKEND_IO 6386 +#define F_PG_STAT_RESET_BACKEND_STATS 6387 +#define F_ARRAY_SORT_ANYARRAY 6388 +#define F_ARRAY_SORT_ANYARRAY_BOOL 6389 +#define F_ARRAY_SORT_ANYARRAY_BOOL_BOOL 6390 +#define F_RANGE_SORTSUPPORT 6391 +#define F_BYTEA_LARGER 6393 +#define F_BYTEA_SMALLER 6394 +#define F_MAX_BYTEA 6395 +#define F_MIN_BYTEA 6396 +#define F_PG_CLEAR_RELATION_STATS 6397 +#define F_PG_CLEAR_ATTRIBUTE_STATS 6398 +#define F_PG_GET_AIOS 6399 +#define F_PG_LS_SUMMARIESDIR 6400 +#define F_PG_TIMEZONE_ABBREVS_ZONE 6401 +#define F_BTINT2SKIPSUPPORT 6402 +#define F_BTINT4SKIPSUPPORT 6403 +#define F_BTINT8SKIPSUPPORT 6404 +#define F_BTOIDSKIPSUPPORT 6405 +#define F_BTCHARSKIPSUPPORT 6406 +#define F_DATE_SKIPSUPPORT 6407 +#define F_BTBOOLSKIPSUPPORT 6408 +#define F_TIMESTAMP_SKIPSUPPORT 6409 +#define F_UUID_SKIPSUPPORT 6410 +#define F_CASEFOLD 6412 +#define F_HASHBYTEA 6413 +#define F_HASHBYTEAEXTENDED 6414 +#define F_HASHDATE 6415 +#define F_HASHDATEEXTENDED 6416 +#define F_HASHBOOL 6417 +#define F_HASHBOOLEXTENDED 6418 +#define F_HASHXID 6419 +#define F_HASHXIDEXTENDED 6420 +#define F_HASHXID8 6421 +#define F_HASHXID8EXTENDED 6422 +#define F_HASHCID 6423 +#define F_HASHCIDEXTENDED 6424 +#define F_TIMESTAMPTZ_HASH 6425 +#define F_TIMESTAMPTZ_HASH_EXTENDED 6426 +#define F_PG_GET_SEQUENCE_DATA 6427 +#define F_UUIDV4 6428 +#define F_UUIDV7_ 6429 +#define F_UUIDV7_INTERVAL 6430 + +#endif /* FMGROIDS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/fmgrprotos.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/fmgrprotos.h new file mode 100644 index 0000000..c305d3e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/fmgrprotos.h @@ -0,0 +1,2982 @@ +/*------------------------------------------------------------------------- + * + * fmgrprotos.h + * Prototypes for built-in functions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/utils/Gen_fmgrtab.pl + * + *------------------------------------------------------------------------- + */ + +#ifndef FMGRPROTOS_H +#define FMGRPROTOS_H + +#include "fmgr.h" + +extern Datum heap_tableam_handler(PG_FUNCTION_ARGS); +extern Datum byteaout(PG_FUNCTION_ARGS); +extern Datum charout(PG_FUNCTION_ARGS); +extern Datum namein(PG_FUNCTION_ARGS); +extern Datum nameout(PG_FUNCTION_ARGS); +extern Datum int2in(PG_FUNCTION_ARGS); +extern Datum int2out(PG_FUNCTION_ARGS); +extern Datum int2vectorin(PG_FUNCTION_ARGS); +extern Datum int2vectorout(PG_FUNCTION_ARGS); +extern Datum int4in(PG_FUNCTION_ARGS); +extern Datum int4out(PG_FUNCTION_ARGS); +extern Datum regprocin(PG_FUNCTION_ARGS); +extern Datum regprocout(PG_FUNCTION_ARGS); +extern Datum textin(PG_FUNCTION_ARGS); +extern Datum textout(PG_FUNCTION_ARGS); +extern Datum tidin(PG_FUNCTION_ARGS); +extern Datum tidout(PG_FUNCTION_ARGS); +extern Datum xidin(PG_FUNCTION_ARGS); +extern Datum xidout(PG_FUNCTION_ARGS); +extern Datum cidin(PG_FUNCTION_ARGS); +extern Datum cidout(PG_FUNCTION_ARGS); +extern Datum oidvectorin(PG_FUNCTION_ARGS); +extern Datum oidvectorout(PG_FUNCTION_ARGS); +extern Datum boollt(PG_FUNCTION_ARGS); +extern Datum boolgt(PG_FUNCTION_ARGS); +extern Datum booleq(PG_FUNCTION_ARGS); +extern Datum chareq(PG_FUNCTION_ARGS); +extern Datum nameeq(PG_FUNCTION_ARGS); +extern Datum int2eq(PG_FUNCTION_ARGS); +extern Datum int2lt(PG_FUNCTION_ARGS); +extern Datum int4eq(PG_FUNCTION_ARGS); +extern Datum int4lt(PG_FUNCTION_ARGS); +extern Datum texteq(PG_FUNCTION_ARGS); +extern Datum xideq(PG_FUNCTION_ARGS); +extern Datum cideq(PG_FUNCTION_ARGS); +extern Datum charne(PG_FUNCTION_ARGS); +extern Datum charle(PG_FUNCTION_ARGS); +extern Datum chargt(PG_FUNCTION_ARGS); +extern Datum charge(PG_FUNCTION_ARGS); +extern Datum chartoi4(PG_FUNCTION_ARGS); +extern Datum i4tochar(PG_FUNCTION_ARGS); +extern Datum nameregexeq(PG_FUNCTION_ARGS); +extern Datum boolne(PG_FUNCTION_ARGS); +extern Datum pg_ddl_command_in(PG_FUNCTION_ARGS); +extern Datum pg_ddl_command_out(PG_FUNCTION_ARGS); +extern Datum pg_ddl_command_recv(PG_FUNCTION_ARGS); +extern Datum pgsql_version(PG_FUNCTION_ARGS); +extern Datum pg_ddl_command_send(PG_FUNCTION_ARGS); +extern Datum eqsel(PG_FUNCTION_ARGS); +extern Datum neqsel(PG_FUNCTION_ARGS); +extern Datum scalarltsel(PG_FUNCTION_ARGS); +extern Datum scalargtsel(PG_FUNCTION_ARGS); +extern Datum eqjoinsel(PG_FUNCTION_ARGS); +extern Datum neqjoinsel(PG_FUNCTION_ARGS); +extern Datum scalarltjoinsel(PG_FUNCTION_ARGS); +extern Datum scalargtjoinsel(PG_FUNCTION_ARGS); +extern Datum unknownin(PG_FUNCTION_ARGS); +extern Datum unknownout(PG_FUNCTION_ARGS); +extern Datum box_above_eq(PG_FUNCTION_ARGS); +extern Datum box_below_eq(PG_FUNCTION_ARGS); +extern Datum point_in(PG_FUNCTION_ARGS); +extern Datum point_out(PG_FUNCTION_ARGS); +extern Datum lseg_in(PG_FUNCTION_ARGS); +extern Datum lseg_out(PG_FUNCTION_ARGS); +extern Datum path_in(PG_FUNCTION_ARGS); +extern Datum path_out(PG_FUNCTION_ARGS); +extern Datum box_in(PG_FUNCTION_ARGS); +extern Datum box_out(PG_FUNCTION_ARGS); +extern Datum box_overlap(PG_FUNCTION_ARGS); +extern Datum box_ge(PG_FUNCTION_ARGS); +extern Datum box_gt(PG_FUNCTION_ARGS); +extern Datum box_eq(PG_FUNCTION_ARGS); +extern Datum box_lt(PG_FUNCTION_ARGS); +extern Datum box_le(PG_FUNCTION_ARGS); +extern Datum point_above(PG_FUNCTION_ARGS); +extern Datum point_left(PG_FUNCTION_ARGS); +extern Datum point_right(PG_FUNCTION_ARGS); +extern Datum point_below(PG_FUNCTION_ARGS); +extern Datum point_eq(PG_FUNCTION_ARGS); +extern Datum on_pb(PG_FUNCTION_ARGS); +extern Datum on_ppath(PG_FUNCTION_ARGS); +extern Datum box_center(PG_FUNCTION_ARGS); +extern Datum areasel(PG_FUNCTION_ARGS); +extern Datum areajoinsel(PG_FUNCTION_ARGS); +extern Datum int4mul(PG_FUNCTION_ARGS); +extern Datum int4ne(PG_FUNCTION_ARGS); +extern Datum int2ne(PG_FUNCTION_ARGS); +extern Datum int2gt(PG_FUNCTION_ARGS); +extern Datum int4gt(PG_FUNCTION_ARGS); +extern Datum int2le(PG_FUNCTION_ARGS); +extern Datum int4le(PG_FUNCTION_ARGS); +extern Datum int4ge(PG_FUNCTION_ARGS); +extern Datum int2ge(PG_FUNCTION_ARGS); +extern Datum int2mul(PG_FUNCTION_ARGS); +extern Datum int2div(PG_FUNCTION_ARGS); +extern Datum int4div(PG_FUNCTION_ARGS); +extern Datum int2mod(PG_FUNCTION_ARGS); +extern Datum int4mod(PG_FUNCTION_ARGS); +extern Datum textne(PG_FUNCTION_ARGS); +extern Datum int24eq(PG_FUNCTION_ARGS); +extern Datum int42eq(PG_FUNCTION_ARGS); +extern Datum int24lt(PG_FUNCTION_ARGS); +extern Datum int42lt(PG_FUNCTION_ARGS); +extern Datum int24gt(PG_FUNCTION_ARGS); +extern Datum int42gt(PG_FUNCTION_ARGS); +extern Datum int24ne(PG_FUNCTION_ARGS); +extern Datum int42ne(PG_FUNCTION_ARGS); +extern Datum int24le(PG_FUNCTION_ARGS); +extern Datum int42le(PG_FUNCTION_ARGS); +extern Datum int24ge(PG_FUNCTION_ARGS); +extern Datum int42ge(PG_FUNCTION_ARGS); +extern Datum int24mul(PG_FUNCTION_ARGS); +extern Datum int42mul(PG_FUNCTION_ARGS); +extern Datum int24div(PG_FUNCTION_ARGS); +extern Datum int42div(PG_FUNCTION_ARGS); +extern Datum int2pl(PG_FUNCTION_ARGS); +extern Datum int4pl(PG_FUNCTION_ARGS); +extern Datum int24pl(PG_FUNCTION_ARGS); +extern Datum int42pl(PG_FUNCTION_ARGS); +extern Datum int2mi(PG_FUNCTION_ARGS); +extern Datum int4mi(PG_FUNCTION_ARGS); +extern Datum int24mi(PG_FUNCTION_ARGS); +extern Datum int42mi(PG_FUNCTION_ARGS); +extern Datum oideq(PG_FUNCTION_ARGS); +extern Datum oidne(PG_FUNCTION_ARGS); +extern Datum box_same(PG_FUNCTION_ARGS); +extern Datum box_contain(PG_FUNCTION_ARGS); +extern Datum box_left(PG_FUNCTION_ARGS); +extern Datum box_overleft(PG_FUNCTION_ARGS); +extern Datum box_overright(PG_FUNCTION_ARGS); +extern Datum box_right(PG_FUNCTION_ARGS); +extern Datum box_contained(PG_FUNCTION_ARGS); +extern Datum box_contain_pt(PG_FUNCTION_ARGS); +extern Datum pg_node_tree_in(PG_FUNCTION_ARGS); +extern Datum pg_node_tree_out(PG_FUNCTION_ARGS); +extern Datum pg_node_tree_recv(PG_FUNCTION_ARGS); +extern Datum pg_node_tree_send(PG_FUNCTION_ARGS); +extern Datum float4in(PG_FUNCTION_ARGS); +extern Datum float4out(PG_FUNCTION_ARGS); +extern Datum float4mul(PG_FUNCTION_ARGS); +extern Datum float4div(PG_FUNCTION_ARGS); +extern Datum float4pl(PG_FUNCTION_ARGS); +extern Datum float4mi(PG_FUNCTION_ARGS); +extern Datum float4um(PG_FUNCTION_ARGS); +extern Datum float4abs(PG_FUNCTION_ARGS); +extern Datum float4_accum(PG_FUNCTION_ARGS); +extern Datum float4larger(PG_FUNCTION_ARGS); +extern Datum float4smaller(PG_FUNCTION_ARGS); +extern Datum int4um(PG_FUNCTION_ARGS); +extern Datum int2um(PG_FUNCTION_ARGS); +extern Datum float8in(PG_FUNCTION_ARGS); +extern Datum float8out(PG_FUNCTION_ARGS); +extern Datum float8mul(PG_FUNCTION_ARGS); +extern Datum float8div(PG_FUNCTION_ARGS); +extern Datum float8pl(PG_FUNCTION_ARGS); +extern Datum float8mi(PG_FUNCTION_ARGS); +extern Datum float8um(PG_FUNCTION_ARGS); +extern Datum float8abs(PG_FUNCTION_ARGS); +extern Datum float8_accum(PG_FUNCTION_ARGS); +extern Datum float8larger(PG_FUNCTION_ARGS); +extern Datum float8smaller(PG_FUNCTION_ARGS); +extern Datum lseg_center(PG_FUNCTION_ARGS); +extern Datum poly_center(PG_FUNCTION_ARGS); +extern Datum dround(PG_FUNCTION_ARGS); +extern Datum dtrunc(PG_FUNCTION_ARGS); +extern Datum dsqrt(PG_FUNCTION_ARGS); +extern Datum dcbrt(PG_FUNCTION_ARGS); +extern Datum dpow(PG_FUNCTION_ARGS); +extern Datum dexp(PG_FUNCTION_ARGS); +extern Datum dlog1(PG_FUNCTION_ARGS); +extern Datum i2tod(PG_FUNCTION_ARGS); +extern Datum i2tof(PG_FUNCTION_ARGS); +extern Datum dtoi2(PG_FUNCTION_ARGS); +extern Datum ftoi2(PG_FUNCTION_ARGS); +extern Datum line_distance(PG_FUNCTION_ARGS); +extern Datum nameeqtext(PG_FUNCTION_ARGS); +extern Datum namelttext(PG_FUNCTION_ARGS); +extern Datum nameletext(PG_FUNCTION_ARGS); +extern Datum namegetext(PG_FUNCTION_ARGS); +extern Datum namegttext(PG_FUNCTION_ARGS); +extern Datum namenetext(PG_FUNCTION_ARGS); +extern Datum btnametextcmp(PG_FUNCTION_ARGS); +extern Datum texteqname(PG_FUNCTION_ARGS); +extern Datum textltname(PG_FUNCTION_ARGS); +extern Datum textlename(PG_FUNCTION_ARGS); +extern Datum textgename(PG_FUNCTION_ARGS); +extern Datum textgtname(PG_FUNCTION_ARGS); +extern Datum textnename(PG_FUNCTION_ARGS); +extern Datum bttextnamecmp(PG_FUNCTION_ARGS); +extern Datum nameconcatoid(PG_FUNCTION_ARGS); +extern Datum table_am_handler_in(PG_FUNCTION_ARGS); +extern Datum table_am_handler_out(PG_FUNCTION_ARGS); +extern Datum timeofday(PG_FUNCTION_ARGS); +extern Datum pg_nextoid(PG_FUNCTION_ARGS); +extern Datum float8_combine(PG_FUNCTION_ARGS); +extern Datum inter_sl(PG_FUNCTION_ARGS); +extern Datum inter_lb(PG_FUNCTION_ARGS); +extern Datum float48mul(PG_FUNCTION_ARGS); +extern Datum float48div(PG_FUNCTION_ARGS); +extern Datum float48pl(PG_FUNCTION_ARGS); +extern Datum float48mi(PG_FUNCTION_ARGS); +extern Datum float84mul(PG_FUNCTION_ARGS); +extern Datum float84div(PG_FUNCTION_ARGS); +extern Datum float84pl(PG_FUNCTION_ARGS); +extern Datum float84mi(PG_FUNCTION_ARGS); +extern Datum float4eq(PG_FUNCTION_ARGS); +extern Datum float4ne(PG_FUNCTION_ARGS); +extern Datum float4lt(PG_FUNCTION_ARGS); +extern Datum float4le(PG_FUNCTION_ARGS); +extern Datum float4gt(PG_FUNCTION_ARGS); +extern Datum float4ge(PG_FUNCTION_ARGS); +extern Datum float8eq(PG_FUNCTION_ARGS); +extern Datum float8ne(PG_FUNCTION_ARGS); +extern Datum float8lt(PG_FUNCTION_ARGS); +extern Datum float8le(PG_FUNCTION_ARGS); +extern Datum float8gt(PG_FUNCTION_ARGS); +extern Datum float8ge(PG_FUNCTION_ARGS); +extern Datum float48eq(PG_FUNCTION_ARGS); +extern Datum float48ne(PG_FUNCTION_ARGS); +extern Datum float48lt(PG_FUNCTION_ARGS); +extern Datum float48le(PG_FUNCTION_ARGS); +extern Datum float48gt(PG_FUNCTION_ARGS); +extern Datum float48ge(PG_FUNCTION_ARGS); +extern Datum float84eq(PG_FUNCTION_ARGS); +extern Datum float84ne(PG_FUNCTION_ARGS); +extern Datum float84lt(PG_FUNCTION_ARGS); +extern Datum float84le(PG_FUNCTION_ARGS); +extern Datum float84gt(PG_FUNCTION_ARGS); +extern Datum float84ge(PG_FUNCTION_ARGS); +extern Datum ftod(PG_FUNCTION_ARGS); +extern Datum dtof(PG_FUNCTION_ARGS); +extern Datum i2toi4(PG_FUNCTION_ARGS); +extern Datum i4toi2(PG_FUNCTION_ARGS); +extern Datum pg_jit_available(PG_FUNCTION_ARGS); +extern Datum i4tod(PG_FUNCTION_ARGS); +extern Datum dtoi4(PG_FUNCTION_ARGS); +extern Datum i4tof(PG_FUNCTION_ARGS); +extern Datum ftoi4(PG_FUNCTION_ARGS); +extern Datum width_bucket_float8(PG_FUNCTION_ARGS); +extern Datum json_in(PG_FUNCTION_ARGS); +extern Datum json_out(PG_FUNCTION_ARGS); +extern Datum json_recv(PG_FUNCTION_ARGS); +extern Datum json_send(PG_FUNCTION_ARGS); +extern Datum index_am_handler_in(PG_FUNCTION_ARGS); +extern Datum index_am_handler_out(PG_FUNCTION_ARGS); +extern Datum hashmacaddr8(PG_FUNCTION_ARGS); +extern Datum hash_aclitem(PG_FUNCTION_ARGS); +extern Datum bthandler(PG_FUNCTION_ARGS); +extern Datum hashhandler(PG_FUNCTION_ARGS); +extern Datum gisthandler(PG_FUNCTION_ARGS); +extern Datum ginhandler(PG_FUNCTION_ARGS); +extern Datum spghandler(PG_FUNCTION_ARGS); +extern Datum brinhandler(PG_FUNCTION_ARGS); +extern Datum scalarlesel(PG_FUNCTION_ARGS); +extern Datum scalargesel(PG_FUNCTION_ARGS); +extern Datum amvalidate(PG_FUNCTION_ARGS); +extern Datum poly_same(PG_FUNCTION_ARGS); +extern Datum poly_contain(PG_FUNCTION_ARGS); +extern Datum poly_left(PG_FUNCTION_ARGS); +extern Datum poly_overleft(PG_FUNCTION_ARGS); +extern Datum poly_overright(PG_FUNCTION_ARGS); +extern Datum poly_right(PG_FUNCTION_ARGS); +extern Datum poly_contained(PG_FUNCTION_ARGS); +extern Datum poly_overlap(PG_FUNCTION_ARGS); +extern Datum poly_in(PG_FUNCTION_ARGS); +extern Datum poly_out(PG_FUNCTION_ARGS); +extern Datum btint2cmp(PG_FUNCTION_ARGS); +extern Datum btint4cmp(PG_FUNCTION_ARGS); +extern Datum btfloat4cmp(PG_FUNCTION_ARGS); +extern Datum btfloat8cmp(PG_FUNCTION_ARGS); +extern Datum btoidcmp(PG_FUNCTION_ARGS); +extern Datum dist_bp(PG_FUNCTION_ARGS); +extern Datum btcharcmp(PG_FUNCTION_ARGS); +extern Datum btnamecmp(PG_FUNCTION_ARGS); +extern Datum bttextcmp(PG_FUNCTION_ARGS); +extern Datum lseg_distance(PG_FUNCTION_ARGS); +extern Datum lseg_interpt(PG_FUNCTION_ARGS); +extern Datum dist_ps(PG_FUNCTION_ARGS); +extern Datum dist_pb(PG_FUNCTION_ARGS); +extern Datum dist_sb(PG_FUNCTION_ARGS); +extern Datum close_ps(PG_FUNCTION_ARGS); +extern Datum close_pb(PG_FUNCTION_ARGS); +extern Datum close_sb(PG_FUNCTION_ARGS); +extern Datum on_ps(PG_FUNCTION_ARGS); +extern Datum path_distance(PG_FUNCTION_ARGS); +extern Datum dist_ppath(PG_FUNCTION_ARGS); +extern Datum on_sb(PG_FUNCTION_ARGS); +extern Datum inter_sb(PG_FUNCTION_ARGS); +extern Datum text_to_array_null(PG_FUNCTION_ARGS); +extern Datum cash_cmp(PG_FUNCTION_ARGS); +extern Datum array_append(PG_FUNCTION_ARGS); +extern Datum array_prepend(PG_FUNCTION_ARGS); +extern Datum dist_sp(PG_FUNCTION_ARGS); +extern Datum dist_bs(PG_FUNCTION_ARGS); +extern Datum btarraycmp(PG_FUNCTION_ARGS); +extern Datum array_cat(PG_FUNCTION_ARGS); +extern Datum array_to_text_null(PG_FUNCTION_ARGS); +extern Datum scalarlejoinsel(PG_FUNCTION_ARGS); +extern Datum array_ne(PG_FUNCTION_ARGS); +extern Datum array_lt(PG_FUNCTION_ARGS); +extern Datum array_gt(PG_FUNCTION_ARGS); +extern Datum array_le(PG_FUNCTION_ARGS); +extern Datum text_to_array(PG_FUNCTION_ARGS); +extern Datum array_to_text(PG_FUNCTION_ARGS); +extern Datum array_ge(PG_FUNCTION_ARGS); +extern Datum scalargejoinsel(PG_FUNCTION_ARGS); +extern Datum hashmacaddr(PG_FUNCTION_ARGS); +extern Datum hashtext(PG_FUNCTION_ARGS); +extern Datum rtrim1(PG_FUNCTION_ARGS); +extern Datum btoidvectorcmp(PG_FUNCTION_ARGS); +extern Datum name_text(PG_FUNCTION_ARGS); +extern Datum text_name(PG_FUNCTION_ARGS); +extern Datum name_bpchar(PG_FUNCTION_ARGS); +extern Datum bpchar_name(PG_FUNCTION_ARGS); +extern Datum dist_pathp(PG_FUNCTION_ARGS); +extern Datum hashinet(PG_FUNCTION_ARGS); +extern Datum hashint4extended(PG_FUNCTION_ARGS); +extern Datum hash_numeric(PG_FUNCTION_ARGS); +extern Datum macaddr_in(PG_FUNCTION_ARGS); +extern Datum macaddr_out(PG_FUNCTION_ARGS); +extern Datum pg_num_nulls(PG_FUNCTION_ARGS); +extern Datum pg_num_nonnulls(PG_FUNCTION_ARGS); +extern Datum hashint2extended(PG_FUNCTION_ARGS); +extern Datum hashint8extended(PG_FUNCTION_ARGS); +extern Datum hashfloat4extended(PG_FUNCTION_ARGS); +extern Datum hashfloat8extended(PG_FUNCTION_ARGS); +extern Datum hashoidextended(PG_FUNCTION_ARGS); +extern Datum hashcharextended(PG_FUNCTION_ARGS); +extern Datum hashnameextended(PG_FUNCTION_ARGS); +extern Datum hashtextextended(PG_FUNCTION_ARGS); +extern Datum hashint2(PG_FUNCTION_ARGS); +extern Datum hashint4(PG_FUNCTION_ARGS); +extern Datum hashfloat4(PG_FUNCTION_ARGS); +extern Datum hashfloat8(PG_FUNCTION_ARGS); +extern Datum hashoid(PG_FUNCTION_ARGS); +extern Datum hashchar(PG_FUNCTION_ARGS); +extern Datum hashname(PG_FUNCTION_ARGS); +extern Datum hashvarlena(PG_FUNCTION_ARGS); +extern Datum hashoidvector(PG_FUNCTION_ARGS); +extern Datum text_larger(PG_FUNCTION_ARGS); +extern Datum text_smaller(PG_FUNCTION_ARGS); +extern Datum int8in(PG_FUNCTION_ARGS); +extern Datum int8out(PG_FUNCTION_ARGS); +extern Datum int8um(PG_FUNCTION_ARGS); +extern Datum int8pl(PG_FUNCTION_ARGS); +extern Datum int8mi(PG_FUNCTION_ARGS); +extern Datum int8mul(PG_FUNCTION_ARGS); +extern Datum int8div(PG_FUNCTION_ARGS); +extern Datum int8eq(PG_FUNCTION_ARGS); +extern Datum int8ne(PG_FUNCTION_ARGS); +extern Datum int8lt(PG_FUNCTION_ARGS); +extern Datum int8gt(PG_FUNCTION_ARGS); +extern Datum int8le(PG_FUNCTION_ARGS); +extern Datum int8ge(PG_FUNCTION_ARGS); +extern Datum int84eq(PG_FUNCTION_ARGS); +extern Datum int84ne(PG_FUNCTION_ARGS); +extern Datum int84lt(PG_FUNCTION_ARGS); +extern Datum int84gt(PG_FUNCTION_ARGS); +extern Datum int84le(PG_FUNCTION_ARGS); +extern Datum int84ge(PG_FUNCTION_ARGS); +extern Datum int84(PG_FUNCTION_ARGS); +extern Datum int48(PG_FUNCTION_ARGS); +extern Datum i8tod(PG_FUNCTION_ARGS); +extern Datum dtoi8(PG_FUNCTION_ARGS); +extern Datum array_larger(PG_FUNCTION_ARGS); +extern Datum array_smaller(PG_FUNCTION_ARGS); +extern Datum inet_abbrev(PG_FUNCTION_ARGS); +extern Datum cidr_abbrev(PG_FUNCTION_ARGS); +extern Datum inet_set_masklen(PG_FUNCTION_ARGS); +extern Datum oidvectorne(PG_FUNCTION_ARGS); +extern Datum hash_array(PG_FUNCTION_ARGS); +extern Datum cidr_set_masklen(PG_FUNCTION_ARGS); +extern Datum pg_indexam_has_property(PG_FUNCTION_ARGS); +extern Datum pg_index_has_property(PG_FUNCTION_ARGS); +extern Datum pg_index_column_has_property(PG_FUNCTION_ARGS); +extern Datum i8tof(PG_FUNCTION_ARGS); +extern Datum ftoi8(PG_FUNCTION_ARGS); +extern Datum namelt(PG_FUNCTION_ARGS); +extern Datum namele(PG_FUNCTION_ARGS); +extern Datum namegt(PG_FUNCTION_ARGS); +extern Datum namege(PG_FUNCTION_ARGS); +extern Datum namene(PG_FUNCTION_ARGS); +extern Datum bpchar(PG_FUNCTION_ARGS); +extern Datum varchar(PG_FUNCTION_ARGS); +extern Datum pg_indexam_progress_phasename(PG_FUNCTION_ARGS); +extern Datum oidvectorlt(PG_FUNCTION_ARGS); +extern Datum oidvectorle(PG_FUNCTION_ARGS); +extern Datum oidvectoreq(PG_FUNCTION_ARGS); +extern Datum oidvectorge(PG_FUNCTION_ARGS); +extern Datum oidvectorgt(PG_FUNCTION_ARGS); +extern Datum network_network(PG_FUNCTION_ARGS); +extern Datum network_netmask(PG_FUNCTION_ARGS); +extern Datum network_masklen(PG_FUNCTION_ARGS); +extern Datum network_broadcast(PG_FUNCTION_ARGS); +extern Datum network_host(PG_FUNCTION_ARGS); +extern Datum dist_lp(PG_FUNCTION_ARGS); +extern Datum dist_ls(PG_FUNCTION_ARGS); +extern Datum current_user(PG_FUNCTION_ARGS); +extern Datum network_family(PG_FUNCTION_ARGS); +extern Datum int82(PG_FUNCTION_ARGS); +extern Datum be_lo_create(PG_FUNCTION_ARGS); +extern Datum oidlt(PG_FUNCTION_ARGS); +extern Datum oidle(PG_FUNCTION_ARGS); +extern Datum byteaoctetlen(PG_FUNCTION_ARGS); +extern Datum byteaGetByte(PG_FUNCTION_ARGS); +extern Datum byteaSetByte(PG_FUNCTION_ARGS); +extern Datum byteaGetBit(PG_FUNCTION_ARGS); +extern Datum byteaSetBit(PG_FUNCTION_ARGS); +extern Datum dist_pl(PG_FUNCTION_ARGS); +extern Datum dist_sl(PG_FUNCTION_ARGS); +extern Datum dist_cpoly(PG_FUNCTION_ARGS); +extern Datum poly_distance(PG_FUNCTION_ARGS); +extern Datum network_show(PG_FUNCTION_ARGS); +extern Datum text_lt(PG_FUNCTION_ARGS); +extern Datum text_le(PG_FUNCTION_ARGS); +extern Datum text_gt(PG_FUNCTION_ARGS); +extern Datum text_ge(PG_FUNCTION_ARGS); +extern Datum array_eq(PG_FUNCTION_ARGS); +extern Datum session_user(PG_FUNCTION_ARGS); +extern Datum array_dims(PG_FUNCTION_ARGS); +extern Datum array_ndims(PG_FUNCTION_ARGS); +extern Datum byteaoverlay(PG_FUNCTION_ARGS); +extern Datum array_in(PG_FUNCTION_ARGS); +extern Datum array_out(PG_FUNCTION_ARGS); +extern Datum byteaoverlay_no_len(PG_FUNCTION_ARGS); +extern Datum macaddr_trunc(PG_FUNCTION_ARGS); +extern Datum int28(PG_FUNCTION_ARGS); +extern Datum be_lo_import(PG_FUNCTION_ARGS); +extern Datum be_lo_export(PG_FUNCTION_ARGS); +extern Datum int4inc(PG_FUNCTION_ARGS); +extern Datum be_lo_import_with_oid(PG_FUNCTION_ARGS); +extern Datum int4larger(PG_FUNCTION_ARGS); +extern Datum int4smaller(PG_FUNCTION_ARGS); +extern Datum int2larger(PG_FUNCTION_ARGS); +extern Datum int2smaller(PG_FUNCTION_ARGS); +extern Datum hashvarlenaextended(PG_FUNCTION_ARGS); +extern Datum hashoidvectorextended(PG_FUNCTION_ARGS); +extern Datum hash_aclitem_extended(PG_FUNCTION_ARGS); +extern Datum hashmacaddrextended(PG_FUNCTION_ARGS); +extern Datum hashinetextended(PG_FUNCTION_ARGS); +extern Datum hash_numeric_extended(PG_FUNCTION_ARGS); +extern Datum hashmacaddr8extended(PG_FUNCTION_ARGS); +extern Datum hash_array_extended(PG_FUNCTION_ARGS); +extern Datum dist_polyc(PG_FUNCTION_ARGS); +extern Datum pg_client_encoding(PG_FUNCTION_ARGS); +extern Datum current_query(PG_FUNCTION_ARGS); +extern Datum macaddr_eq(PG_FUNCTION_ARGS); +extern Datum macaddr_lt(PG_FUNCTION_ARGS); +extern Datum macaddr_le(PG_FUNCTION_ARGS); +extern Datum macaddr_gt(PG_FUNCTION_ARGS); +extern Datum macaddr_ge(PG_FUNCTION_ARGS); +extern Datum macaddr_ne(PG_FUNCTION_ARGS); +extern Datum macaddr_cmp(PG_FUNCTION_ARGS); +extern Datum int82pl(PG_FUNCTION_ARGS); +extern Datum int82mi(PG_FUNCTION_ARGS); +extern Datum int82mul(PG_FUNCTION_ARGS); +extern Datum int82div(PG_FUNCTION_ARGS); +extern Datum int28pl(PG_FUNCTION_ARGS); +extern Datum btint8cmp(PG_FUNCTION_ARGS); +extern Datum cash_mul_flt4(PG_FUNCTION_ARGS); +extern Datum cash_div_flt4(PG_FUNCTION_ARGS); +extern Datum flt4_mul_cash(PG_FUNCTION_ARGS); +extern Datum textpos(PG_FUNCTION_ARGS); +extern Datum textlike(PG_FUNCTION_ARGS); +extern Datum textnlike(PG_FUNCTION_ARGS); +extern Datum int48eq(PG_FUNCTION_ARGS); +extern Datum int48ne(PG_FUNCTION_ARGS); +extern Datum int48lt(PG_FUNCTION_ARGS); +extern Datum int48gt(PG_FUNCTION_ARGS); +extern Datum int48le(PG_FUNCTION_ARGS); +extern Datum int48ge(PG_FUNCTION_ARGS); +extern Datum namelike(PG_FUNCTION_ARGS); +extern Datum namenlike(PG_FUNCTION_ARGS); +extern Datum char_bpchar(PG_FUNCTION_ARGS); +extern Datum current_database(PG_FUNCTION_ARGS); +extern Datum int4_mul_cash(PG_FUNCTION_ARGS); +extern Datum int2_mul_cash(PG_FUNCTION_ARGS); +extern Datum cash_mul_int4(PG_FUNCTION_ARGS); +extern Datum cash_div_int4(PG_FUNCTION_ARGS); +extern Datum cash_mul_int2(PG_FUNCTION_ARGS); +extern Datum cash_div_int2(PG_FUNCTION_ARGS); +extern Datum lower(PG_FUNCTION_ARGS); +extern Datum upper(PG_FUNCTION_ARGS); +extern Datum initcap(PG_FUNCTION_ARGS); +extern Datum lpad(PG_FUNCTION_ARGS); +extern Datum rpad(PG_FUNCTION_ARGS); +extern Datum ltrim(PG_FUNCTION_ARGS); +extern Datum rtrim(PG_FUNCTION_ARGS); +extern Datum text_substr(PG_FUNCTION_ARGS); +extern Datum translate(PG_FUNCTION_ARGS); +extern Datum ltrim1(PG_FUNCTION_ARGS); +extern Datum text_substr_no_len(PG_FUNCTION_ARGS); +extern Datum btrim(PG_FUNCTION_ARGS); +extern Datum btrim1(PG_FUNCTION_ARGS); +extern Datum cash_in(PG_FUNCTION_ARGS); +extern Datum cash_out(PG_FUNCTION_ARGS); +extern Datum cash_eq(PG_FUNCTION_ARGS); +extern Datum cash_ne(PG_FUNCTION_ARGS); +extern Datum cash_lt(PG_FUNCTION_ARGS); +extern Datum cash_le(PG_FUNCTION_ARGS); +extern Datum cash_gt(PG_FUNCTION_ARGS); +extern Datum cash_ge(PG_FUNCTION_ARGS); +extern Datum cash_pl(PG_FUNCTION_ARGS); +extern Datum cash_mi(PG_FUNCTION_ARGS); +extern Datum cash_mul_flt8(PG_FUNCTION_ARGS); +extern Datum cash_div_flt8(PG_FUNCTION_ARGS); +extern Datum cashlarger(PG_FUNCTION_ARGS); +extern Datum cashsmaller(PG_FUNCTION_ARGS); +extern Datum inet_in(PG_FUNCTION_ARGS); +extern Datum inet_out(PG_FUNCTION_ARGS); +extern Datum flt8_mul_cash(PG_FUNCTION_ARGS); +extern Datum network_eq(PG_FUNCTION_ARGS); +extern Datum network_lt(PG_FUNCTION_ARGS); +extern Datum network_le(PG_FUNCTION_ARGS); +extern Datum network_gt(PG_FUNCTION_ARGS); +extern Datum network_ge(PG_FUNCTION_ARGS); +extern Datum network_ne(PG_FUNCTION_ARGS); +extern Datum network_cmp(PG_FUNCTION_ARGS); +extern Datum network_sub(PG_FUNCTION_ARGS); +extern Datum network_subeq(PG_FUNCTION_ARGS); +extern Datum network_sup(PG_FUNCTION_ARGS); +extern Datum network_supeq(PG_FUNCTION_ARGS); +extern Datum cash_words(PG_FUNCTION_ARGS); +extern Datum generate_series_timestamp(PG_FUNCTION_ARGS); +extern Datum generate_series_timestamptz(PG_FUNCTION_ARGS); +extern Datum int28mi(PG_FUNCTION_ARGS); +extern Datum int28mul(PG_FUNCTION_ARGS); +extern Datum text_char(PG_FUNCTION_ARGS); +extern Datum int8mod(PG_FUNCTION_ARGS); +extern Datum char_text(PG_FUNCTION_ARGS); +extern Datum int28div(PG_FUNCTION_ARGS); +extern Datum hashint8(PG_FUNCTION_ARGS); +extern Datum be_lo_open(PG_FUNCTION_ARGS); +extern Datum be_lo_close(PG_FUNCTION_ARGS); +extern Datum be_loread(PG_FUNCTION_ARGS); +extern Datum be_lowrite(PG_FUNCTION_ARGS); +extern Datum be_lo_lseek(PG_FUNCTION_ARGS); +extern Datum be_lo_creat(PG_FUNCTION_ARGS); +extern Datum be_lo_tell(PG_FUNCTION_ARGS); +extern Datum on_pl(PG_FUNCTION_ARGS); +extern Datum on_sl(PG_FUNCTION_ARGS); +extern Datum close_pl(PG_FUNCTION_ARGS); +extern Datum be_lo_unlink(PG_FUNCTION_ARGS); +extern Datum hashbpcharextended(PG_FUNCTION_ARGS); +extern Datum path_inter(PG_FUNCTION_ARGS); +extern Datum box_area(PG_FUNCTION_ARGS); +extern Datum box_width(PG_FUNCTION_ARGS); +extern Datum box_height(PG_FUNCTION_ARGS); +extern Datum box_distance(PG_FUNCTION_ARGS); +extern Datum path_area(PG_FUNCTION_ARGS); +extern Datum box_intersect(PG_FUNCTION_ARGS); +extern Datum box_diagonal(PG_FUNCTION_ARGS); +extern Datum path_n_lt(PG_FUNCTION_ARGS); +extern Datum path_n_gt(PG_FUNCTION_ARGS); +extern Datum path_n_eq(PG_FUNCTION_ARGS); +extern Datum path_n_le(PG_FUNCTION_ARGS); +extern Datum path_n_ge(PG_FUNCTION_ARGS); +extern Datum path_length(PG_FUNCTION_ARGS); +extern Datum point_ne(PG_FUNCTION_ARGS); +extern Datum point_vert(PG_FUNCTION_ARGS); +extern Datum point_horiz(PG_FUNCTION_ARGS); +extern Datum point_distance(PG_FUNCTION_ARGS); +extern Datum point_slope(PG_FUNCTION_ARGS); +extern Datum lseg_construct(PG_FUNCTION_ARGS); +extern Datum lseg_intersect(PG_FUNCTION_ARGS); +extern Datum lseg_parallel(PG_FUNCTION_ARGS); +extern Datum lseg_perp(PG_FUNCTION_ARGS); +extern Datum lseg_vertical(PG_FUNCTION_ARGS); +extern Datum lseg_horizontal(PG_FUNCTION_ARGS); +extern Datum lseg_eq(PG_FUNCTION_ARGS); +extern Datum be_lo_truncate(PG_FUNCTION_ARGS); +extern Datum textlike_support(PG_FUNCTION_ARGS); +extern Datum texticregexeq_support(PG_FUNCTION_ARGS); +extern Datum texticlike_support(PG_FUNCTION_ARGS); +extern Datum timestamptz_izone(PG_FUNCTION_ARGS); +extern Datum gist_point_compress(PG_FUNCTION_ARGS); +extern Datum aclitemin(PG_FUNCTION_ARGS); +extern Datum aclitemout(PG_FUNCTION_ARGS); +extern Datum aclinsert(PG_FUNCTION_ARGS); +extern Datum aclremove(PG_FUNCTION_ARGS); +extern Datum aclcontains(PG_FUNCTION_ARGS); +extern Datum getdatabaseencoding(PG_FUNCTION_ARGS); +extern Datum bpcharin(PG_FUNCTION_ARGS); +extern Datum bpcharout(PG_FUNCTION_ARGS); +extern Datum varcharin(PG_FUNCTION_ARGS); +extern Datum varcharout(PG_FUNCTION_ARGS); +extern Datum bpchareq(PG_FUNCTION_ARGS); +extern Datum bpcharlt(PG_FUNCTION_ARGS); +extern Datum bpcharle(PG_FUNCTION_ARGS); +extern Datum bpchargt(PG_FUNCTION_ARGS); +extern Datum bpcharge(PG_FUNCTION_ARGS); +extern Datum bpcharne(PG_FUNCTION_ARGS); +extern Datum aclitem_eq(PG_FUNCTION_ARGS); +extern Datum bpchar_larger(PG_FUNCTION_ARGS); +extern Datum bpchar_smaller(PG_FUNCTION_ARGS); +extern Datum pg_prepared_xact(PG_FUNCTION_ARGS); +extern Datum generate_series_step_int4(PG_FUNCTION_ARGS); +extern Datum generate_series_int4(PG_FUNCTION_ARGS); +extern Datum generate_series_step_int8(PG_FUNCTION_ARGS); +extern Datum generate_series_int8(PG_FUNCTION_ARGS); +extern Datum bpcharcmp(PG_FUNCTION_ARGS); +extern Datum text_regclass(PG_FUNCTION_ARGS); +extern Datum hashbpchar(PG_FUNCTION_ARGS); +extern Datum format_type(PG_FUNCTION_ARGS); +extern Datum date_in(PG_FUNCTION_ARGS); +extern Datum date_out(PG_FUNCTION_ARGS); +extern Datum date_eq(PG_FUNCTION_ARGS); +extern Datum date_lt(PG_FUNCTION_ARGS); +extern Datum date_le(PG_FUNCTION_ARGS); +extern Datum date_gt(PG_FUNCTION_ARGS); +extern Datum date_ge(PG_FUNCTION_ARGS); +extern Datum date_ne(PG_FUNCTION_ARGS); +extern Datum date_cmp(PG_FUNCTION_ARGS); +extern Datum time_lt(PG_FUNCTION_ARGS); +extern Datum time_le(PG_FUNCTION_ARGS); +extern Datum time_gt(PG_FUNCTION_ARGS); +extern Datum time_ge(PG_FUNCTION_ARGS); +extern Datum time_ne(PG_FUNCTION_ARGS); +extern Datum time_cmp(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_wal(PG_FUNCTION_ARGS); +extern Datum pg_get_wal_replay_pause_state(PG_FUNCTION_ARGS); +extern Datum date_larger(PG_FUNCTION_ARGS); +extern Datum date_smaller(PG_FUNCTION_ARGS); +extern Datum date_mi(PG_FUNCTION_ARGS); +extern Datum date_pli(PG_FUNCTION_ARGS); +extern Datum date_mii(PG_FUNCTION_ARGS); +extern Datum time_in(PG_FUNCTION_ARGS); +extern Datum time_out(PG_FUNCTION_ARGS); +extern Datum time_eq(PG_FUNCTION_ARGS); +extern Datum circle_add_pt(PG_FUNCTION_ARGS); +extern Datum circle_sub_pt(PG_FUNCTION_ARGS); +extern Datum circle_mul_pt(PG_FUNCTION_ARGS); +extern Datum circle_div_pt(PG_FUNCTION_ARGS); +extern Datum timestamptz_in(PG_FUNCTION_ARGS); +extern Datum timestamptz_out(PG_FUNCTION_ARGS); +extern Datum timestamp_eq(PG_FUNCTION_ARGS); +extern Datum timestamp_ne(PG_FUNCTION_ARGS); +extern Datum timestamp_lt(PG_FUNCTION_ARGS); +extern Datum timestamp_le(PG_FUNCTION_ARGS); +extern Datum timestamp_ge(PG_FUNCTION_ARGS); +extern Datum timestamp_gt(PG_FUNCTION_ARGS); +extern Datum float8_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamptz_zone(PG_FUNCTION_ARGS); +extern Datum interval_in(PG_FUNCTION_ARGS); +extern Datum interval_out(PG_FUNCTION_ARGS); +extern Datum interval_eq(PG_FUNCTION_ARGS); +extern Datum interval_ne(PG_FUNCTION_ARGS); +extern Datum interval_lt(PG_FUNCTION_ARGS); +extern Datum interval_le(PG_FUNCTION_ARGS); +extern Datum interval_ge(PG_FUNCTION_ARGS); +extern Datum interval_gt(PG_FUNCTION_ARGS); +extern Datum interval_um(PG_FUNCTION_ARGS); +extern Datum interval_pl(PG_FUNCTION_ARGS); +extern Datum interval_mi(PG_FUNCTION_ARGS); +extern Datum timestamptz_part(PG_FUNCTION_ARGS); +extern Datum interval_part(PG_FUNCTION_ARGS); +extern Datum network_subset_support(PG_FUNCTION_ARGS); +extern Datum date_timestamptz(PG_FUNCTION_ARGS); +extern Datum interval_justify_hours(PG_FUNCTION_ARGS); +extern Datum jsonb_path_exists_tz(PG_FUNCTION_ARGS); +extern Datum timestamptz_date(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_tz(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_array_tz(PG_FUNCTION_ARGS); +extern Datum xid_age(PG_FUNCTION_ARGS); +extern Datum timestamp_mi(PG_FUNCTION_ARGS); +extern Datum timestamptz_pl_interval(PG_FUNCTION_ARGS); +extern Datum timestamptz_mi_interval(PG_FUNCTION_ARGS); +extern Datum generate_subscripts(PG_FUNCTION_ARGS); +extern Datum generate_subscripts_nodir(PG_FUNCTION_ARGS); +extern Datum array_fill(PG_FUNCTION_ARGS); +extern Datum dlog10(PG_FUNCTION_ARGS); +extern Datum timestamp_smaller(PG_FUNCTION_ARGS); +extern Datum timestamp_larger(PG_FUNCTION_ARGS); +extern Datum interval_smaller(PG_FUNCTION_ARGS); +extern Datum interval_larger(PG_FUNCTION_ARGS); +extern Datum timestamptz_age(PG_FUNCTION_ARGS); +extern Datum interval_scale(PG_FUNCTION_ARGS); +extern Datum timestamptz_trunc(PG_FUNCTION_ARGS); +extern Datum interval_trunc(PG_FUNCTION_ARGS); +extern Datum int8inc(PG_FUNCTION_ARGS); +extern Datum int8abs(PG_FUNCTION_ARGS); +extern Datum int8larger(PG_FUNCTION_ARGS); +extern Datum int8smaller(PG_FUNCTION_ARGS); +extern Datum texticregexeq(PG_FUNCTION_ARGS); +extern Datum texticregexne(PG_FUNCTION_ARGS); +extern Datum nameicregexeq(PG_FUNCTION_ARGS); +extern Datum nameicregexne(PG_FUNCTION_ARGS); +extern Datum boolin(PG_FUNCTION_ARGS); +extern Datum boolout(PG_FUNCTION_ARGS); +extern Datum byteain(PG_FUNCTION_ARGS); +extern Datum charin(PG_FUNCTION_ARGS); +extern Datum charlt(PG_FUNCTION_ARGS); +extern Datum unique_key_recheck(PG_FUNCTION_ARGS); +extern Datum int4abs(PG_FUNCTION_ARGS); +extern Datum nameregexne(PG_FUNCTION_ARGS); +extern Datum int2abs(PG_FUNCTION_ARGS); +extern Datum textregexeq(PG_FUNCTION_ARGS); +extern Datum textregexne(PG_FUNCTION_ARGS); +extern Datum textlen(PG_FUNCTION_ARGS); +extern Datum textcat(PG_FUNCTION_ARGS); +extern Datum PG_char_to_encoding(PG_FUNCTION_ARGS); +extern Datum tidne(PG_FUNCTION_ARGS); +extern Datum cidr_in(PG_FUNCTION_ARGS); +extern Datum parse_ident(PG_FUNCTION_ARGS); +extern Datum pg_column_size(PG_FUNCTION_ARGS); +extern Datum overlaps_timetz(PG_FUNCTION_ARGS); +extern Datum datetime_timestamp(PG_FUNCTION_ARGS); +extern Datum timetz_part(PG_FUNCTION_ARGS); +extern Datum int84pl(PG_FUNCTION_ARGS); +extern Datum int84mi(PG_FUNCTION_ARGS); +extern Datum int84mul(PG_FUNCTION_ARGS); +extern Datum int84div(PG_FUNCTION_ARGS); +extern Datum int48pl(PG_FUNCTION_ARGS); +extern Datum int48mi(PG_FUNCTION_ARGS); +extern Datum int48mul(PG_FUNCTION_ARGS); +extern Datum int48div(PG_FUNCTION_ARGS); +extern Datum quote_ident(PG_FUNCTION_ARGS); +extern Datum quote_literal(PG_FUNCTION_ARGS); +extern Datum timestamptz_trunc_zone(PG_FUNCTION_ARGS); +extern Datum array_fill_with_lower_bounds(PG_FUNCTION_ARGS); +extern Datum i8tooid(PG_FUNCTION_ARGS); +extern Datum oidtoi8(PG_FUNCTION_ARGS); +extern Datum quote_nullable(PG_FUNCTION_ARGS); +extern Datum suppress_redundant_updates_trigger(PG_FUNCTION_ARGS); +extern Datum tideq(PG_FUNCTION_ARGS); +extern Datum multirange_unnest(PG_FUNCTION_ARGS); +extern Datum currtid_byrelname(PG_FUNCTION_ARGS); +extern Datum interval_justify_days(PG_FUNCTION_ARGS); +extern Datum datetimetz_timestamptz(PG_FUNCTION_ARGS); +extern Datum now(PG_FUNCTION_ARGS); +extern Datum positionsel(PG_FUNCTION_ARGS); +extern Datum positionjoinsel(PG_FUNCTION_ARGS); +extern Datum contsel(PG_FUNCTION_ARGS); +extern Datum contjoinsel(PG_FUNCTION_ARGS); +extern Datum overlaps_timestamp(PG_FUNCTION_ARGS); +extern Datum overlaps_time(PG_FUNCTION_ARGS); +extern Datum timestamp_in(PG_FUNCTION_ARGS); +extern Datum timestamp_out(PG_FUNCTION_ARGS); +extern Datum timestamp_cmp(PG_FUNCTION_ARGS); +extern Datum interval_cmp(PG_FUNCTION_ARGS); +extern Datum timestamp_time(PG_FUNCTION_ARGS); +extern Datum bpcharlen(PG_FUNCTION_ARGS); +extern Datum interval_div(PG_FUNCTION_ARGS); +extern Datum oidvectortypes(PG_FUNCTION_ARGS); +extern Datum timetz_in(PG_FUNCTION_ARGS); +extern Datum timetz_out(PG_FUNCTION_ARGS); +extern Datum timetz_eq(PG_FUNCTION_ARGS); +extern Datum timetz_ne(PG_FUNCTION_ARGS); +extern Datum timetz_lt(PG_FUNCTION_ARGS); +extern Datum timetz_le(PG_FUNCTION_ARGS); +extern Datum timetz_ge(PG_FUNCTION_ARGS); +extern Datum timetz_gt(PG_FUNCTION_ARGS); +extern Datum timetz_cmp(PG_FUNCTION_ARGS); +extern Datum network_hostmask(PG_FUNCTION_ARGS); +extern Datum textregexeq_support(PG_FUNCTION_ARGS); +extern Datum makeaclitem(PG_FUNCTION_ARGS); +extern Datum time_interval(PG_FUNCTION_ARGS); +extern Datum pg_lock_status(PG_FUNCTION_ARGS); +extern Datum date_finite(PG_FUNCTION_ARGS); +extern Datum textoctetlen(PG_FUNCTION_ARGS); +extern Datum bpcharoctetlen(PG_FUNCTION_ARGS); +extern Datum numeric_fac(PG_FUNCTION_ARGS); +extern Datum time_larger(PG_FUNCTION_ARGS); +extern Datum time_smaller(PG_FUNCTION_ARGS); +extern Datum timetz_larger(PG_FUNCTION_ARGS); +extern Datum timetz_smaller(PG_FUNCTION_ARGS); +extern Datum time_part(PG_FUNCTION_ARGS); +extern Datum pg_get_constraintdef(PG_FUNCTION_ARGS); +extern Datum timestamptz_timetz(PG_FUNCTION_ARGS); +extern Datum timestamp_finite(PG_FUNCTION_ARGS); +extern Datum interval_finite(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_start(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_client_addr(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_client_port(PG_FUNCTION_ARGS); +extern Datum current_schema(PG_FUNCTION_ARGS); +extern Datum current_schemas(PG_FUNCTION_ARGS); +extern Datum textoverlay(PG_FUNCTION_ARGS); +extern Datum textoverlay_no_len(PG_FUNCTION_ARGS); +extern Datum line_parallel(PG_FUNCTION_ARGS); +extern Datum line_perp(PG_FUNCTION_ARGS); +extern Datum line_vertical(PG_FUNCTION_ARGS); +extern Datum line_horizontal(PG_FUNCTION_ARGS); +extern Datum circle_center(PG_FUNCTION_ARGS); +extern Datum interval_time(PG_FUNCTION_ARGS); +extern Datum points_box(PG_FUNCTION_ARGS); +extern Datum box_add(PG_FUNCTION_ARGS); +extern Datum box_sub(PG_FUNCTION_ARGS); +extern Datum box_mul(PG_FUNCTION_ARGS); +extern Datum box_div(PG_FUNCTION_ARGS); +extern Datum cidr_out(PG_FUNCTION_ARGS); +extern Datum poly_contain_pt(PG_FUNCTION_ARGS); +extern Datum pt_contained_poly(PG_FUNCTION_ARGS); +extern Datum path_isclosed(PG_FUNCTION_ARGS); +extern Datum path_isopen(PG_FUNCTION_ARGS); +extern Datum path_npoints(PG_FUNCTION_ARGS); +extern Datum path_close(PG_FUNCTION_ARGS); +extern Datum path_open(PG_FUNCTION_ARGS); +extern Datum path_add(PG_FUNCTION_ARGS); +extern Datum path_add_pt(PG_FUNCTION_ARGS); +extern Datum path_sub_pt(PG_FUNCTION_ARGS); +extern Datum path_mul_pt(PG_FUNCTION_ARGS); +extern Datum path_div_pt(PG_FUNCTION_ARGS); +extern Datum construct_point(PG_FUNCTION_ARGS); +extern Datum point_add(PG_FUNCTION_ARGS); +extern Datum point_sub(PG_FUNCTION_ARGS); +extern Datum point_mul(PG_FUNCTION_ARGS); +extern Datum point_div(PG_FUNCTION_ARGS); +extern Datum poly_npoints(PG_FUNCTION_ARGS); +extern Datum poly_box(PG_FUNCTION_ARGS); +extern Datum poly_path(PG_FUNCTION_ARGS); +extern Datum box_poly(PG_FUNCTION_ARGS); +extern Datum path_poly(PG_FUNCTION_ARGS); +extern Datum circle_in(PG_FUNCTION_ARGS); +extern Datum circle_out(PG_FUNCTION_ARGS); +extern Datum circle_same(PG_FUNCTION_ARGS); +extern Datum circle_contain(PG_FUNCTION_ARGS); +extern Datum circle_left(PG_FUNCTION_ARGS); +extern Datum circle_overleft(PG_FUNCTION_ARGS); +extern Datum circle_overright(PG_FUNCTION_ARGS); +extern Datum circle_right(PG_FUNCTION_ARGS); +extern Datum circle_contained(PG_FUNCTION_ARGS); +extern Datum circle_overlap(PG_FUNCTION_ARGS); +extern Datum circle_below(PG_FUNCTION_ARGS); +extern Datum circle_above(PG_FUNCTION_ARGS); +extern Datum circle_eq(PG_FUNCTION_ARGS); +extern Datum circle_ne(PG_FUNCTION_ARGS); +extern Datum circle_lt(PG_FUNCTION_ARGS); +extern Datum circle_gt(PG_FUNCTION_ARGS); +extern Datum circle_le(PG_FUNCTION_ARGS); +extern Datum circle_ge(PG_FUNCTION_ARGS); +extern Datum circle_area(PG_FUNCTION_ARGS); +extern Datum circle_diameter(PG_FUNCTION_ARGS); +extern Datum circle_radius(PG_FUNCTION_ARGS); +extern Datum circle_distance(PG_FUNCTION_ARGS); +extern Datum cr_circle(PG_FUNCTION_ARGS); +extern Datum poly_circle(PG_FUNCTION_ARGS); +extern Datum circle_poly(PG_FUNCTION_ARGS); +extern Datum dist_pc(PG_FUNCTION_ARGS); +extern Datum circle_contain_pt(PG_FUNCTION_ARGS); +extern Datum pt_contained_circle(PG_FUNCTION_ARGS); +extern Datum box_circle(PG_FUNCTION_ARGS); +extern Datum circle_box(PG_FUNCTION_ARGS); +extern Datum lseg_ne(PG_FUNCTION_ARGS); +extern Datum lseg_lt(PG_FUNCTION_ARGS); +extern Datum lseg_le(PG_FUNCTION_ARGS); +extern Datum lseg_gt(PG_FUNCTION_ARGS); +extern Datum lseg_ge(PG_FUNCTION_ARGS); +extern Datum lseg_length(PG_FUNCTION_ARGS); +extern Datum close_ls(PG_FUNCTION_ARGS); +extern Datum close_lseg(PG_FUNCTION_ARGS); +extern Datum line_in(PG_FUNCTION_ARGS); +extern Datum line_out(PG_FUNCTION_ARGS); +extern Datum line_eq(PG_FUNCTION_ARGS); +extern Datum line_construct_pp(PG_FUNCTION_ARGS); +extern Datum line_interpt(PG_FUNCTION_ARGS); +extern Datum line_intersect(PG_FUNCTION_ARGS); +extern Datum bit_in(PG_FUNCTION_ARGS); +extern Datum bit_out(PG_FUNCTION_ARGS); +extern Datum pg_get_ruledef(PG_FUNCTION_ARGS); +extern Datum nextval_oid(PG_FUNCTION_ARGS); +extern Datum currval_oid(PG_FUNCTION_ARGS); +extern Datum setval_oid(PG_FUNCTION_ARGS); +extern Datum varbit_in(PG_FUNCTION_ARGS); +extern Datum varbit_out(PG_FUNCTION_ARGS); +extern Datum biteq(PG_FUNCTION_ARGS); +extern Datum bitne(PG_FUNCTION_ARGS); +extern Datum bitge(PG_FUNCTION_ARGS); +extern Datum bitgt(PG_FUNCTION_ARGS); +extern Datum bitle(PG_FUNCTION_ARGS); +extern Datum bitlt(PG_FUNCTION_ARGS); +extern Datum bitcmp(PG_FUNCTION_ARGS); +extern Datum PG_encoding_to_char(PG_FUNCTION_ARGS); +extern Datum drandom(PG_FUNCTION_ARGS); +extern Datum setseed(PG_FUNCTION_ARGS); +extern Datum dasin(PG_FUNCTION_ARGS); +extern Datum dacos(PG_FUNCTION_ARGS); +extern Datum datan(PG_FUNCTION_ARGS); +extern Datum datan2(PG_FUNCTION_ARGS); +extern Datum dsin(PG_FUNCTION_ARGS); +extern Datum dcos(PG_FUNCTION_ARGS); +extern Datum dtan(PG_FUNCTION_ARGS); +extern Datum dcot(PG_FUNCTION_ARGS); +extern Datum degrees(PG_FUNCTION_ARGS); +extern Datum radians(PG_FUNCTION_ARGS); +extern Datum dpi(PG_FUNCTION_ARGS); +extern Datum interval_mul(PG_FUNCTION_ARGS); +extern Datum pg_typeof(PG_FUNCTION_ARGS); +extern Datum ascii(PG_FUNCTION_ARGS); +extern Datum chr(PG_FUNCTION_ARGS); +extern Datum repeat(PG_FUNCTION_ARGS); +extern Datum similar_escape(PG_FUNCTION_ARGS); +extern Datum mul_d_interval(PG_FUNCTION_ARGS); +extern Datum texticlike(PG_FUNCTION_ARGS); +extern Datum texticnlike(PG_FUNCTION_ARGS); +extern Datum nameiclike(PG_FUNCTION_ARGS); +extern Datum nameicnlike(PG_FUNCTION_ARGS); +extern Datum like_escape(PG_FUNCTION_ARGS); +extern Datum oidgt(PG_FUNCTION_ARGS); +extern Datum oidge(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef_name(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef(PG_FUNCTION_ARGS); +extern Datum pg_get_userbyid(PG_FUNCTION_ARGS); +extern Datum pg_get_indexdef(PG_FUNCTION_ARGS); +extern Datum RI_FKey_check_ins(PG_FUNCTION_ARGS); +extern Datum RI_FKey_check_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_cascade_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_cascade_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_restrict_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_restrict_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_setnull_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_setnull_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_setdefault_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_setdefault_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_noaction_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_noaction_upd(PG_FUNCTION_ARGS); +extern Datum pg_get_triggerdef(PG_FUNCTION_ARGS); +extern Datum pg_get_serial_sequence(PG_FUNCTION_ARGS); +extern Datum bit_and(PG_FUNCTION_ARGS); +extern Datum bit_or(PG_FUNCTION_ARGS); +extern Datum bitxor(PG_FUNCTION_ARGS); +extern Datum bitnot(PG_FUNCTION_ARGS); +extern Datum bitshiftleft(PG_FUNCTION_ARGS); +extern Datum bitshiftright(PG_FUNCTION_ARGS); +extern Datum bitcat(PG_FUNCTION_ARGS); +extern Datum bitsubstr(PG_FUNCTION_ARGS); +extern Datum bitlength(PG_FUNCTION_ARGS); +extern Datum bitoctetlength(PG_FUNCTION_ARGS); +extern Datum bitfromint4(PG_FUNCTION_ARGS); +extern Datum bittoint4(PG_FUNCTION_ARGS); +extern Datum bit(PG_FUNCTION_ARGS); +extern Datum pg_get_keywords(PG_FUNCTION_ARGS); +extern Datum varbit(PG_FUNCTION_ARGS); +extern Datum time_hash(PG_FUNCTION_ARGS); +extern Datum aclexplode(PG_FUNCTION_ARGS); +extern Datum time_mi_time(PG_FUNCTION_ARGS); +extern Datum boolle(PG_FUNCTION_ARGS); +extern Datum boolge(PG_FUNCTION_ARGS); +extern Datum btboolcmp(PG_FUNCTION_ARGS); +extern Datum timetz_hash(PG_FUNCTION_ARGS); +extern Datum interval_hash(PG_FUNCTION_ARGS); +extern Datum bitposition(PG_FUNCTION_ARGS); +extern Datum bitsubstr_no_len(PG_FUNCTION_ARGS); +extern Datum numeric_in(PG_FUNCTION_ARGS); +extern Datum numeric_out(PG_FUNCTION_ARGS); +extern Datum numeric(PG_FUNCTION_ARGS); +extern Datum numeric_abs(PG_FUNCTION_ARGS); +extern Datum numeric_sign(PG_FUNCTION_ARGS); +extern Datum numeric_round(PG_FUNCTION_ARGS); +extern Datum numeric_trunc(PG_FUNCTION_ARGS); +extern Datum numeric_ceil(PG_FUNCTION_ARGS); +extern Datum numeric_floor(PG_FUNCTION_ARGS); +extern Datum length_in_encoding(PG_FUNCTION_ARGS); +extern Datum pg_convert_from(PG_FUNCTION_ARGS); +extern Datum inet_to_cidr(PG_FUNCTION_ARGS); +extern Datum pg_get_expr(PG_FUNCTION_ARGS); +extern Datum pg_convert_to(PG_FUNCTION_ARGS); +extern Datum numeric_eq(PG_FUNCTION_ARGS); +extern Datum numeric_ne(PG_FUNCTION_ARGS); +extern Datum numeric_gt(PG_FUNCTION_ARGS); +extern Datum numeric_ge(PG_FUNCTION_ARGS); +extern Datum numeric_lt(PG_FUNCTION_ARGS); +extern Datum numeric_le(PG_FUNCTION_ARGS); +extern Datum numeric_add(PG_FUNCTION_ARGS); +extern Datum numeric_sub(PG_FUNCTION_ARGS); +extern Datum numeric_mul(PG_FUNCTION_ARGS); +extern Datum numeric_div(PG_FUNCTION_ARGS); +extern Datum numeric_mod(PG_FUNCTION_ARGS); +extern Datum numeric_sqrt(PG_FUNCTION_ARGS); +extern Datum numeric_exp(PG_FUNCTION_ARGS); +extern Datum numeric_ln(PG_FUNCTION_ARGS); +extern Datum numeric_log(PG_FUNCTION_ARGS); +extern Datum numeric_power(PG_FUNCTION_ARGS); +extern Datum int4_numeric(PG_FUNCTION_ARGS); +extern Datum float4_numeric(PG_FUNCTION_ARGS); +extern Datum float8_numeric(PG_FUNCTION_ARGS); +extern Datum numeric_int4(PG_FUNCTION_ARGS); +extern Datum numeric_float4(PG_FUNCTION_ARGS); +extern Datum numeric_float8(PG_FUNCTION_ARGS); +extern Datum time_pl_interval(PG_FUNCTION_ARGS); +extern Datum time_mi_interval(PG_FUNCTION_ARGS); +extern Datum timetz_pl_interval(PG_FUNCTION_ARGS); +extern Datum timetz_mi_interval(PG_FUNCTION_ARGS); +extern Datum numeric_inc(PG_FUNCTION_ARGS); +extern Datum setval3_oid(PG_FUNCTION_ARGS); +extern Datum numeric_smaller(PG_FUNCTION_ARGS); +extern Datum numeric_larger(PG_FUNCTION_ARGS); +extern Datum interval_to_char(PG_FUNCTION_ARGS); +extern Datum numeric_cmp(PG_FUNCTION_ARGS); +extern Datum timestamptz_to_char(PG_FUNCTION_ARGS); +extern Datum numeric_uminus(PG_FUNCTION_ARGS); +extern Datum numeric_to_char(PG_FUNCTION_ARGS); +extern Datum int4_to_char(PG_FUNCTION_ARGS); +extern Datum int8_to_char(PG_FUNCTION_ARGS); +extern Datum float4_to_char(PG_FUNCTION_ARGS); +extern Datum float8_to_char(PG_FUNCTION_ARGS); +extern Datum numeric_to_number(PG_FUNCTION_ARGS); +extern Datum to_timestamp(PG_FUNCTION_ARGS); +extern Datum numeric_int8(PG_FUNCTION_ARGS); +extern Datum to_date(PG_FUNCTION_ARGS); +extern Datum int8_numeric(PG_FUNCTION_ARGS); +extern Datum int2_numeric(PG_FUNCTION_ARGS); +extern Datum numeric_int2(PG_FUNCTION_ARGS); +extern Datum oidin(PG_FUNCTION_ARGS); +extern Datum oidout(PG_FUNCTION_ARGS); +extern Datum pg_convert(PG_FUNCTION_ARGS); +extern Datum iclikesel(PG_FUNCTION_ARGS); +extern Datum icnlikesel(PG_FUNCTION_ARGS); +extern Datum iclikejoinsel(PG_FUNCTION_ARGS); +extern Datum icnlikejoinsel(PG_FUNCTION_ARGS); +extern Datum regexeqsel(PG_FUNCTION_ARGS); +extern Datum likesel(PG_FUNCTION_ARGS); +extern Datum icregexeqsel(PG_FUNCTION_ARGS); +extern Datum regexnesel(PG_FUNCTION_ARGS); +extern Datum nlikesel(PG_FUNCTION_ARGS); +extern Datum icregexnesel(PG_FUNCTION_ARGS); +extern Datum regexeqjoinsel(PG_FUNCTION_ARGS); +extern Datum likejoinsel(PG_FUNCTION_ARGS); +extern Datum icregexeqjoinsel(PG_FUNCTION_ARGS); +extern Datum regexnejoinsel(PG_FUNCTION_ARGS); +extern Datum nlikejoinsel(PG_FUNCTION_ARGS); +extern Datum icregexnejoinsel(PG_FUNCTION_ARGS); +extern Datum float8_avg(PG_FUNCTION_ARGS); +extern Datum float8_var_samp(PG_FUNCTION_ARGS); +extern Datum float8_stddev_samp(PG_FUNCTION_ARGS); +extern Datum numeric_accum(PG_FUNCTION_ARGS); +extern Datum int2_accum(PG_FUNCTION_ARGS); +extern Datum int4_accum(PG_FUNCTION_ARGS); +extern Datum int8_accum(PG_FUNCTION_ARGS); +extern Datum numeric_avg(PG_FUNCTION_ARGS); +extern Datum numeric_var_samp(PG_FUNCTION_ARGS); +extern Datum numeric_stddev_samp(PG_FUNCTION_ARGS); +extern Datum int2_sum(PG_FUNCTION_ARGS); +extern Datum int4_sum(PG_FUNCTION_ARGS); +extern Datum int8_sum(PG_FUNCTION_ARGS); +extern Datum interval_avg_accum(PG_FUNCTION_ARGS); +extern Datum interval_avg(PG_FUNCTION_ARGS); +extern Datum to_ascii_default(PG_FUNCTION_ARGS); +extern Datum to_ascii_enc(PG_FUNCTION_ARGS); +extern Datum to_ascii_encname(PG_FUNCTION_ARGS); +extern Datum int28eq(PG_FUNCTION_ARGS); +extern Datum int28ne(PG_FUNCTION_ARGS); +extern Datum int28lt(PG_FUNCTION_ARGS); +extern Datum int28gt(PG_FUNCTION_ARGS); +extern Datum int28le(PG_FUNCTION_ARGS); +extern Datum int28ge(PG_FUNCTION_ARGS); +extern Datum int82eq(PG_FUNCTION_ARGS); +extern Datum int82ne(PG_FUNCTION_ARGS); +extern Datum int82lt(PG_FUNCTION_ARGS); +extern Datum int82gt(PG_FUNCTION_ARGS); +extern Datum int82le(PG_FUNCTION_ARGS); +extern Datum int82ge(PG_FUNCTION_ARGS); +extern Datum int2and(PG_FUNCTION_ARGS); +extern Datum int2or(PG_FUNCTION_ARGS); +extern Datum int2xor(PG_FUNCTION_ARGS); +extern Datum int2not(PG_FUNCTION_ARGS); +extern Datum int2shl(PG_FUNCTION_ARGS); +extern Datum int2shr(PG_FUNCTION_ARGS); +extern Datum int4and(PG_FUNCTION_ARGS); +extern Datum int4or(PG_FUNCTION_ARGS); +extern Datum int4xor(PG_FUNCTION_ARGS); +extern Datum int4not(PG_FUNCTION_ARGS); +extern Datum int4shl(PG_FUNCTION_ARGS); +extern Datum int4shr(PG_FUNCTION_ARGS); +extern Datum int8and(PG_FUNCTION_ARGS); +extern Datum int8or(PG_FUNCTION_ARGS); +extern Datum int8xor(PG_FUNCTION_ARGS); +extern Datum int8not(PG_FUNCTION_ARGS); +extern Datum int8shl(PG_FUNCTION_ARGS); +extern Datum int8shr(PG_FUNCTION_ARGS); +extern Datum int8up(PG_FUNCTION_ARGS); +extern Datum int2up(PG_FUNCTION_ARGS); +extern Datum int4up(PG_FUNCTION_ARGS); +extern Datum float4up(PG_FUNCTION_ARGS); +extern Datum float8up(PG_FUNCTION_ARGS); +extern Datum numeric_uplus(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_id(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_numscans(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_returned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_inserted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_deleted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_blocks_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_blocks_hit(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_idset(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_pid(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_dbid(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_userid(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_activity(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_numbackends(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_xact_commit(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_xact_rollback(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_blocks_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_blocks_hit(PG_FUNCTION_ARGS); +extern Datum binary_encode(PG_FUNCTION_ARGS); +extern Datum binary_decode(PG_FUNCTION_ARGS); +extern Datum byteaeq(PG_FUNCTION_ARGS); +extern Datum bytealt(PG_FUNCTION_ARGS); +extern Datum byteale(PG_FUNCTION_ARGS); +extern Datum byteagt(PG_FUNCTION_ARGS); +extern Datum byteage(PG_FUNCTION_ARGS); +extern Datum byteane(PG_FUNCTION_ARGS); +extern Datum byteacmp(PG_FUNCTION_ARGS); +extern Datum timestamp_scale(PG_FUNCTION_ARGS); +extern Datum int2_avg_accum(PG_FUNCTION_ARGS); +extern Datum int4_avg_accum(PG_FUNCTION_ARGS); +extern Datum int8_avg(PG_FUNCTION_ARGS); +extern Datum oidlarger(PG_FUNCTION_ARGS); +extern Datum oidsmaller(PG_FUNCTION_ARGS); +extern Datum timestamptz_scale(PG_FUNCTION_ARGS); +extern Datum time_scale(PG_FUNCTION_ARGS); +extern Datum timetz_scale(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_hot_updated(PG_FUNCTION_ARGS); +extern Datum numeric_div_trunc(PG_FUNCTION_ARGS); +extern Datum similar_to_escape_2(PG_FUNCTION_ARGS); +extern Datum similar_to_escape_1(PG_FUNCTION_ARGS); +extern Datum bytealike(PG_FUNCTION_ARGS); +extern Datum byteanlike(PG_FUNCTION_ARGS); +extern Datum like_escape_bytea(PG_FUNCTION_ARGS); +extern Datum byteacat(PG_FUNCTION_ARGS); +extern Datum bytea_substr(PG_FUNCTION_ARGS); +extern Datum bytea_substr_no_len(PG_FUNCTION_ARGS); +extern Datum byteapos(PG_FUNCTION_ARGS); +extern Datum byteatrim(PG_FUNCTION_ARGS); +extern Datum timestamptz_time(PG_FUNCTION_ARGS); +extern Datum timestamp_trunc(PG_FUNCTION_ARGS); +extern Datum timestamp_part(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_activity(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_first_tz(PG_FUNCTION_ARGS); +extern Datum date_timestamp(PG_FUNCTION_ARGS); +extern Datum pg_backend_pid(PG_FUNCTION_ARGS); +extern Datum timestamptz_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamp_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_date(PG_FUNCTION_ARGS); +extern Datum jsonb_path_match_tz(PG_FUNCTION_ARGS); +extern Datum timestamp_pl_interval(PG_FUNCTION_ARGS); +extern Datum timestamp_mi_interval(PG_FUNCTION_ARGS); +extern Datum pg_conf_load_time(PG_FUNCTION_ARGS); +extern Datum timetz_zone(PG_FUNCTION_ARGS); +extern Datum timetz_izone(PG_FUNCTION_ARGS); +extern Datum timestamp_hash(PG_FUNCTION_ARGS); +extern Datum timetz_time(PG_FUNCTION_ARGS); +extern Datum time_timetz(PG_FUNCTION_ARGS); +extern Datum timestamp_to_char(PG_FUNCTION_ARGS); +extern Datum timestamp_age(PG_FUNCTION_ARGS); +extern Datum timestamp_zone(PG_FUNCTION_ARGS); +extern Datum timestamp_izone(PG_FUNCTION_ARGS); +extern Datum date_pl_interval(PG_FUNCTION_ARGS); +extern Datum date_mi_interval(PG_FUNCTION_ARGS); +extern Datum textregexsubstr(PG_FUNCTION_ARGS); +extern Datum bitfromint8(PG_FUNCTION_ARGS); +extern Datum bittoint8(PG_FUNCTION_ARGS); +extern Datum show_config_by_name(PG_FUNCTION_ARGS); +extern Datum set_config_by_name(PG_FUNCTION_ARGS); +extern Datum pg_table_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_type_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_function_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_operator_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_opclass_is_visible(PG_FUNCTION_ARGS); +extern Datum show_all_settings(PG_FUNCTION_ARGS); +extern Datum replace_text(PG_FUNCTION_ARGS); +extern Datum split_part(PG_FUNCTION_ARGS); +extern Datum to_hex32(PG_FUNCTION_ARGS); +extern Datum to_hex64(PG_FUNCTION_ARGS); +extern Datum array_lower(PG_FUNCTION_ARGS); +extern Datum array_upper(PG_FUNCTION_ARGS); +extern Datum pg_conversion_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_activity_start(PG_FUNCTION_ARGS); +extern Datum pg_terminate_backend(PG_FUNCTION_ARGS); +extern Datum pg_get_functiondef(PG_FUNCTION_ARGS); +extern Datum pg_column_compression(PG_FUNCTION_ARGS); +extern Datum pg_stat_force_next_flush(PG_FUNCTION_ARGS); +extern Datum text_pattern_lt(PG_FUNCTION_ARGS); +extern Datum text_pattern_le(PG_FUNCTION_ARGS); +extern Datum pg_get_function_arguments(PG_FUNCTION_ARGS); +extern Datum text_pattern_ge(PG_FUNCTION_ARGS); +extern Datum text_pattern_gt(PG_FUNCTION_ARGS); +extern Datum pg_get_function_result(PG_FUNCTION_ARGS); +extern Datum bttext_pattern_cmp(PG_FUNCTION_ARGS); +extern Datum pg_database_size_name(PG_FUNCTION_ARGS); +extern Datum width_bucket_numeric(PG_FUNCTION_ARGS); +extern Datum pg_cancel_backend(PG_FUNCTION_ARGS); +extern Datum pg_backup_start(PG_FUNCTION_ARGS); +extern Datum bpchar_pattern_lt(PG_FUNCTION_ARGS); +extern Datum bpchar_pattern_le(PG_FUNCTION_ARGS); +extern Datum array_length(PG_FUNCTION_ARGS); +extern Datum bpchar_pattern_ge(PG_FUNCTION_ARGS); +extern Datum bpchar_pattern_gt(PG_FUNCTION_ARGS); +extern Datum gist_point_consistent(PG_FUNCTION_ARGS); +extern Datum btbpchar_pattern_cmp(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_id(PG_FUNCTION_ARGS); +extern Datum btint48cmp(PG_FUNCTION_ARGS); +extern Datum btint84cmp(PG_FUNCTION_ARGS); +extern Datum btint24cmp(PG_FUNCTION_ARGS); +extern Datum btint42cmp(PG_FUNCTION_ARGS); +extern Datum btint28cmp(PG_FUNCTION_ARGS); +extern Datum btint82cmp(PG_FUNCTION_ARGS); +extern Datum btfloat48cmp(PG_FUNCTION_ARGS); +extern Datum btfloat84cmp(PG_FUNCTION_ARGS); +extern Datum inet_client_addr(PG_FUNCTION_ARGS); +extern Datum inet_client_port(PG_FUNCTION_ARGS); +extern Datum inet_server_addr(PG_FUNCTION_ARGS); +extern Datum inet_server_port(PG_FUNCTION_ARGS); +extern Datum regprocedurein(PG_FUNCTION_ARGS); +extern Datum regprocedureout(PG_FUNCTION_ARGS); +extern Datum regoperin(PG_FUNCTION_ARGS); +extern Datum regoperout(PG_FUNCTION_ARGS); +extern Datum regoperatorin(PG_FUNCTION_ARGS); +extern Datum regoperatorout(PG_FUNCTION_ARGS); +extern Datum regclassin(PG_FUNCTION_ARGS); +extern Datum regclassout(PG_FUNCTION_ARGS); +extern Datum regtypein(PG_FUNCTION_ARGS); +extern Datum regtypeout(PG_FUNCTION_ARGS); +extern Datum pg_stat_clear_snapshot(PG_FUNCTION_ARGS); +extern Datum pg_get_function_identity_arguments(PG_FUNCTION_ARGS); +extern Datum hashtid(PG_FUNCTION_ARGS); +extern Datum hashtidextended(PG_FUNCTION_ARGS); +extern Datum fmgr_internal_validator(PG_FUNCTION_ARGS); +extern Datum fmgr_c_validator(PG_FUNCTION_ARGS); +extern Datum fmgr_sql_validator(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_id(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset(PG_FUNCTION_ARGS); +extern Datum pg_get_backend_memory_contexts(PG_FUNCTION_ARGS); +extern Datum textregexreplace_noopt(PG_FUNCTION_ARGS); +extern Datum textregexreplace(PG_FUNCTION_ARGS); +extern Datum pg_total_relation_size(PG_FUNCTION_ARGS); +extern Datum pg_size_pretty(PG_FUNCTION_ARGS); +extern Datum pg_options_to_table(PG_FUNCTION_ARGS); +extern Datum record_in(PG_FUNCTION_ARGS); +extern Datum record_out(PG_FUNCTION_ARGS); +extern Datum cstring_in(PG_FUNCTION_ARGS); +extern Datum cstring_out(PG_FUNCTION_ARGS); +extern Datum any_in(PG_FUNCTION_ARGS); +extern Datum any_out(PG_FUNCTION_ARGS); +extern Datum anyarray_in(PG_FUNCTION_ARGS); +extern Datum anyarray_out(PG_FUNCTION_ARGS); +extern Datum void_in(PG_FUNCTION_ARGS); +extern Datum void_out(PG_FUNCTION_ARGS); +extern Datum trigger_in(PG_FUNCTION_ARGS); +extern Datum trigger_out(PG_FUNCTION_ARGS); +extern Datum language_handler_in(PG_FUNCTION_ARGS); +extern Datum language_handler_out(PG_FUNCTION_ARGS); +extern Datum internal_in(PG_FUNCTION_ARGS); +extern Datum internal_out(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_slru(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_slru(PG_FUNCTION_ARGS); +extern Datum dceil(PG_FUNCTION_ARGS); +extern Datum dfloor(PG_FUNCTION_ARGS); +extern Datum dsign(PG_FUNCTION_ARGS); +extern Datum md5_text(PG_FUNCTION_ARGS); +extern Datum anyelement_in(PG_FUNCTION_ARGS); +extern Datum anyelement_out(PG_FUNCTION_ARGS); +extern Datum postgresql_fdw_validator(PG_FUNCTION_ARGS); +extern Datum pg_encoding_max_length_sql(PG_FUNCTION_ARGS); +extern Datum md5_bytea(PG_FUNCTION_ARGS); +extern Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS); +extern Datum pg_tablespace_size_name(PG_FUNCTION_ARGS); +extern Datum pg_database_size_oid(PG_FUNCTION_ARGS); +extern Datum array_unnest(PG_FUNCTION_ARGS); +extern Datum pg_relation_size(PG_FUNCTION_ARGS); +extern Datum array_agg_transfn(PG_FUNCTION_ARGS); +extern Datum array_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum date_lt_timestamp(PG_FUNCTION_ARGS); +extern Datum date_le_timestamp(PG_FUNCTION_ARGS); +extern Datum date_eq_timestamp(PG_FUNCTION_ARGS); +extern Datum date_gt_timestamp(PG_FUNCTION_ARGS); +extern Datum date_ge_timestamp(PG_FUNCTION_ARGS); +extern Datum date_ne_timestamp(PG_FUNCTION_ARGS); +extern Datum date_cmp_timestamp(PG_FUNCTION_ARGS); +extern Datum date_lt_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_le_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_eq_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_gt_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_ge_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_ne_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_cmp_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_lt_date(PG_FUNCTION_ARGS); +extern Datum timestamp_le_date(PG_FUNCTION_ARGS); +extern Datum timestamp_eq_date(PG_FUNCTION_ARGS); +extern Datum timestamp_gt_date(PG_FUNCTION_ARGS); +extern Datum timestamp_ge_date(PG_FUNCTION_ARGS); +extern Datum timestamp_ne_date(PG_FUNCTION_ARGS); +extern Datum timestamp_cmp_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_lt_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_le_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_eq_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_gt_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_ge_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_ne_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_cmp_date(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_id(PG_FUNCTION_ARGS); +extern Datum shell_in(PG_FUNCTION_ARGS); +extern Datum shell_out(PG_FUNCTION_ARGS); +extern Datum array_recv(PG_FUNCTION_ARGS); +extern Datum array_send(PG_FUNCTION_ARGS); +extern Datum record_recv(PG_FUNCTION_ARGS); +extern Datum record_send(PG_FUNCTION_ARGS); +extern Datum int2recv(PG_FUNCTION_ARGS); +extern Datum int2send(PG_FUNCTION_ARGS); +extern Datum int4recv(PG_FUNCTION_ARGS); +extern Datum int4send(PG_FUNCTION_ARGS); +extern Datum int8recv(PG_FUNCTION_ARGS); +extern Datum int8send(PG_FUNCTION_ARGS); +extern Datum int2vectorrecv(PG_FUNCTION_ARGS); +extern Datum int2vectorsend(PG_FUNCTION_ARGS); +extern Datum bytearecv(PG_FUNCTION_ARGS); +extern Datum byteasend(PG_FUNCTION_ARGS); +extern Datum textrecv(PG_FUNCTION_ARGS); +extern Datum textsend(PG_FUNCTION_ARGS); +extern Datum unknownrecv(PG_FUNCTION_ARGS); +extern Datum unknownsend(PG_FUNCTION_ARGS); +extern Datum oidrecv(PG_FUNCTION_ARGS); +extern Datum oidsend(PG_FUNCTION_ARGS); +extern Datum oidvectorrecv(PG_FUNCTION_ARGS); +extern Datum oidvectorsend(PG_FUNCTION_ARGS); +extern Datum namerecv(PG_FUNCTION_ARGS); +extern Datum namesend(PG_FUNCTION_ARGS); +extern Datum float4recv(PG_FUNCTION_ARGS); +extern Datum float4send(PG_FUNCTION_ARGS); +extern Datum float8recv(PG_FUNCTION_ARGS); +extern Datum float8send(PG_FUNCTION_ARGS); +extern Datum point_recv(PG_FUNCTION_ARGS); +extern Datum point_send(PG_FUNCTION_ARGS); +extern Datum bpcharrecv(PG_FUNCTION_ARGS); +extern Datum bpcharsend(PG_FUNCTION_ARGS); +extern Datum varcharrecv(PG_FUNCTION_ARGS); +extern Datum varcharsend(PG_FUNCTION_ARGS); +extern Datum charrecv(PG_FUNCTION_ARGS); +extern Datum charsend(PG_FUNCTION_ARGS); +extern Datum boolrecv(PG_FUNCTION_ARGS); +extern Datum boolsend(PG_FUNCTION_ARGS); +extern Datum tidrecv(PG_FUNCTION_ARGS); +extern Datum tidsend(PG_FUNCTION_ARGS); +extern Datum xidrecv(PG_FUNCTION_ARGS); +extern Datum xidsend(PG_FUNCTION_ARGS); +extern Datum cidrecv(PG_FUNCTION_ARGS); +extern Datum cidsend(PG_FUNCTION_ARGS); +extern Datum regprocrecv(PG_FUNCTION_ARGS); +extern Datum regprocsend(PG_FUNCTION_ARGS); +extern Datum regprocedurerecv(PG_FUNCTION_ARGS); +extern Datum regproceduresend(PG_FUNCTION_ARGS); +extern Datum regoperrecv(PG_FUNCTION_ARGS); +extern Datum regopersend(PG_FUNCTION_ARGS); +extern Datum regoperatorrecv(PG_FUNCTION_ARGS); +extern Datum regoperatorsend(PG_FUNCTION_ARGS); +extern Datum regclassrecv(PG_FUNCTION_ARGS); +extern Datum regclasssend(PG_FUNCTION_ARGS); +extern Datum regtyperecv(PG_FUNCTION_ARGS); +extern Datum regtypesend(PG_FUNCTION_ARGS); +extern Datum bit_recv(PG_FUNCTION_ARGS); +extern Datum bit_send(PG_FUNCTION_ARGS); +extern Datum varbit_recv(PG_FUNCTION_ARGS); +extern Datum varbit_send(PG_FUNCTION_ARGS); +extern Datum numeric_recv(PG_FUNCTION_ARGS); +extern Datum numeric_send(PG_FUNCTION_ARGS); +extern Datum dsinh(PG_FUNCTION_ARGS); +extern Datum dcosh(PG_FUNCTION_ARGS); +extern Datum dtanh(PG_FUNCTION_ARGS); +extern Datum dasinh(PG_FUNCTION_ARGS); +extern Datum dacosh(PG_FUNCTION_ARGS); +extern Datum datanh(PG_FUNCTION_ARGS); +extern Datum date_recv(PG_FUNCTION_ARGS); +extern Datum date_send(PG_FUNCTION_ARGS); +extern Datum time_recv(PG_FUNCTION_ARGS); +extern Datum time_send(PG_FUNCTION_ARGS); +extern Datum timetz_recv(PG_FUNCTION_ARGS); +extern Datum timetz_send(PG_FUNCTION_ARGS); +extern Datum timestamp_recv(PG_FUNCTION_ARGS); +extern Datum timestamp_send(PG_FUNCTION_ARGS); +extern Datum timestamptz_recv(PG_FUNCTION_ARGS); +extern Datum timestamptz_send(PG_FUNCTION_ARGS); +extern Datum interval_recv(PG_FUNCTION_ARGS); +extern Datum interval_send(PG_FUNCTION_ARGS); +extern Datum lseg_recv(PG_FUNCTION_ARGS); +extern Datum lseg_send(PG_FUNCTION_ARGS); +extern Datum path_recv(PG_FUNCTION_ARGS); +extern Datum path_send(PG_FUNCTION_ARGS); +extern Datum box_recv(PG_FUNCTION_ARGS); +extern Datum box_send(PG_FUNCTION_ARGS); +extern Datum poly_recv(PG_FUNCTION_ARGS); +extern Datum poly_send(PG_FUNCTION_ARGS); +extern Datum line_recv(PG_FUNCTION_ARGS); +extern Datum line_send(PG_FUNCTION_ARGS); +extern Datum circle_recv(PG_FUNCTION_ARGS); +extern Datum circle_send(PG_FUNCTION_ARGS); +extern Datum cash_recv(PG_FUNCTION_ARGS); +extern Datum cash_send(PG_FUNCTION_ARGS); +extern Datum macaddr_recv(PG_FUNCTION_ARGS); +extern Datum macaddr_send(PG_FUNCTION_ARGS); +extern Datum inet_recv(PG_FUNCTION_ARGS); +extern Datum inet_send(PG_FUNCTION_ARGS); +extern Datum cidr_recv(PG_FUNCTION_ARGS); +extern Datum cidr_send(PG_FUNCTION_ARGS); +extern Datum cstring_recv(PG_FUNCTION_ARGS); +extern Datum cstring_send(PG_FUNCTION_ARGS); +extern Datum anyarray_recv(PG_FUNCTION_ARGS); +extern Datum anyarray_send(PG_FUNCTION_ARGS); +extern Datum pg_get_ruledef_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef_name_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_indexdef_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_constraintdef_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_expr_ext(PG_FUNCTION_ARGS); +extern Datum pg_prepared_statement(PG_FUNCTION_ARGS); +extern Datum pg_cursor(PG_FUNCTION_ARGS); +extern Datum float8_var_pop(PG_FUNCTION_ARGS); +extern Datum float8_stddev_pop(PG_FUNCTION_ARGS); +extern Datum numeric_var_pop(PG_FUNCTION_ARGS); +extern Datum booland_statefunc(PG_FUNCTION_ARGS); +extern Datum boolor_statefunc(PG_FUNCTION_ARGS); +extern Datum timestamp_lt_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_le_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_eq_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_gt_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_ge_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_ne_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_cmp_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamptz_lt_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_le_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_eq_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_gt_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_ge_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_ne_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_cmp_timestamp(PG_FUNCTION_ARGS); +extern Datum pg_tablespace_databases(PG_FUNCTION_ARGS); +extern Datum int4_bool(PG_FUNCTION_ARGS); +extern Datum bool_int4(PG_FUNCTION_ARGS); +extern Datum lastval(PG_FUNCTION_ARGS); +extern Datum pg_postmaster_start_time(PG_FUNCTION_ARGS); +extern Datum pg_blocking_pids(PG_FUNCTION_ARGS); +extern Datum box_below(PG_FUNCTION_ARGS); +extern Datum box_overbelow(PG_FUNCTION_ARGS); +extern Datum box_overabove(PG_FUNCTION_ARGS); +extern Datum box_above(PG_FUNCTION_ARGS); +extern Datum poly_below(PG_FUNCTION_ARGS); +extern Datum poly_overbelow(PG_FUNCTION_ARGS); +extern Datum poly_overabove(PG_FUNCTION_ARGS); +extern Datum poly_above(PG_FUNCTION_ARGS); +extern Datum gist_box_consistent(PG_FUNCTION_ARGS); +extern Datum jsonb_float8(PG_FUNCTION_ARGS); +extern Datum gist_box_penalty(PG_FUNCTION_ARGS); +extern Datum gist_box_picksplit(PG_FUNCTION_ARGS); +extern Datum gist_box_union(PG_FUNCTION_ARGS); +extern Datum gist_box_same(PG_FUNCTION_ARGS); +extern Datum gist_poly_consistent(PG_FUNCTION_ARGS); +extern Datum gist_poly_compress(PG_FUNCTION_ARGS); +extern Datum circle_overbelow(PG_FUNCTION_ARGS); +extern Datum circle_overabove(PG_FUNCTION_ARGS); +extern Datum gist_circle_consistent(PG_FUNCTION_ARGS); +extern Datum gist_circle_compress(PG_FUNCTION_ARGS); +extern Datum numeric_stddev_pop(PG_FUNCTION_ARGS); +extern Datum domain_in(PG_FUNCTION_ARGS); +extern Datum domain_recv(PG_FUNCTION_ARGS); +extern Datum pg_timezone_abbrevs_abbrevs(PG_FUNCTION_ARGS); +extern Datum xmlexists(PG_FUNCTION_ARGS); +extern Datum pg_reload_conf(PG_FUNCTION_ARGS); +extern Datum pg_rotate_logfile(PG_FUNCTION_ARGS); +extern Datum pg_stat_file_1arg(PG_FUNCTION_ARGS); +extern Datum pg_read_file_off_len(PG_FUNCTION_ARGS); +extern Datum pg_ls_dir_1arg(PG_FUNCTION_ARGS); +extern Datum pg_sleep(PG_FUNCTION_ARGS); +extern Datum inetnot(PG_FUNCTION_ARGS); +extern Datum inetand(PG_FUNCTION_ARGS); +extern Datum inetor(PG_FUNCTION_ARGS); +extern Datum inetpl(PG_FUNCTION_ARGS); +extern Datum inetmi_int8(PG_FUNCTION_ARGS); +extern Datum inetmi(PG_FUNCTION_ARGS); +extern Datum statement_timestamp(PG_FUNCTION_ARGS); +extern Datum clock_timestamp(PG_FUNCTION_ARGS); +extern Datum gin_cmp_prefix(PG_FUNCTION_ARGS); +extern Datum pg_has_role_name_name(PG_FUNCTION_ARGS); +extern Datum pg_has_role_name_id(PG_FUNCTION_ARGS); +extern Datum pg_has_role_id_name(PG_FUNCTION_ARGS); +extern Datum pg_has_role_id_id(PG_FUNCTION_ARGS); +extern Datum pg_has_role_name(PG_FUNCTION_ARGS); +extern Datum pg_has_role_id(PG_FUNCTION_ARGS); +extern Datum interval_justify_interval(PG_FUNCTION_ARGS); +extern Datum pg_get_triggerdef_ext(PG_FUNCTION_ARGS); +extern Datum dasind(PG_FUNCTION_ARGS); +extern Datum dacosd(PG_FUNCTION_ARGS); +extern Datum datand(PG_FUNCTION_ARGS); +extern Datum datan2d(PG_FUNCTION_ARGS); +extern Datum dsind(PG_FUNCTION_ARGS); +extern Datum dcosd(PG_FUNCTION_ARGS); +extern Datum dtand(PG_FUNCTION_ARGS); +extern Datum dcotd(PG_FUNCTION_ARGS); +extern Datum pg_backup_stop(PG_FUNCTION_ARGS); +extern Datum numeric_avg_serialize(PG_FUNCTION_ARGS); +extern Datum numeric_avg_deserialize(PG_FUNCTION_ARGS); +extern Datum ginarrayextract(PG_FUNCTION_ARGS); +extern Datum ginarrayconsistent(PG_FUNCTION_ARGS); +extern Datum int8_avg_accum(PG_FUNCTION_ARGS); +extern Datum arrayoverlap(PG_FUNCTION_ARGS); +extern Datum arraycontains(PG_FUNCTION_ARGS); +extern Datum arraycontained(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_returned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_inserted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_deleted(PG_FUNCTION_ARGS); +extern Datum regexp_matches_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_matches(PG_FUNCTION_ARGS); +extern Datum regexp_split_to_table_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_split_to_table(PG_FUNCTION_ARGS); +extern Datum regexp_split_to_array_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_split_to_array(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_num_timed(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_num_requested(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_buffers_written(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_bgwriter_buf_written_clean(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_bgwriter_maxwritten_clean(PG_FUNCTION_ARGS); +extern Datum ginqueryarrayextract(PG_FUNCTION_ARGS); +extern Datum anynonarray_in(PG_FUNCTION_ARGS); +extern Datum anynonarray_out(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_last_vacuum_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_last_autovacuum_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_last_analyze_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_last_autoanalyze_time(PG_FUNCTION_ARGS); +extern Datum int8_avg_combine(PG_FUNCTION_ARGS); +extern Datum int8_avg_serialize(PG_FUNCTION_ARGS); +extern Datum int8_avg_deserialize(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_wait_event_type(PG_FUNCTION_ARGS); +extern Datum tidgt(PG_FUNCTION_ARGS); +extern Datum tidlt(PG_FUNCTION_ARGS); +extern Datum tidge(PG_FUNCTION_ARGS); +extern Datum tidle(PG_FUNCTION_ARGS); +extern Datum bttidcmp(PG_FUNCTION_ARGS); +extern Datum tidlarger(PG_FUNCTION_ARGS); +extern Datum tidsmaller(PG_FUNCTION_ARGS); +extern Datum int8inc_any(PG_FUNCTION_ARGS); +extern Datum int8inc_float8_float8(PG_FUNCTION_ARGS); +extern Datum float8_regr_accum(PG_FUNCTION_ARGS); +extern Datum float8_regr_sxx(PG_FUNCTION_ARGS); +extern Datum float8_regr_syy(PG_FUNCTION_ARGS); +extern Datum float8_regr_sxy(PG_FUNCTION_ARGS); +extern Datum float8_regr_avgx(PG_FUNCTION_ARGS); +extern Datum float8_regr_avgy(PG_FUNCTION_ARGS); +extern Datum float8_regr_r2(PG_FUNCTION_ARGS); +extern Datum float8_regr_slope(PG_FUNCTION_ARGS); +extern Datum float8_regr_intercept(PG_FUNCTION_ARGS); +extern Datum float8_covar_pop(PG_FUNCTION_ARGS); +extern Datum float8_covar_samp(PG_FUNCTION_ARGS); +extern Datum float8_corr(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_blk_read_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_blk_write_time(PG_FUNCTION_ARGS); +extern Datum pg_switch_wal(PG_FUNCTION_ARGS); +extern Datum pg_current_wal_lsn(PG_FUNCTION_ARGS); +extern Datum pg_walfile_name_offset(PG_FUNCTION_ARGS); +extern Datum pg_walfile_name(PG_FUNCTION_ARGS); +extern Datum pg_current_wal_insert_lsn(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_wait_event(PG_FUNCTION_ARGS); +extern Datum pg_my_temp_schema(PG_FUNCTION_ARGS); +extern Datum pg_is_other_temp_schema(PG_FUNCTION_ARGS); +extern Datum pg_timezone_names(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_xact_start(PG_FUNCTION_ARGS); +extern Datum numeric_avg_accum(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_buf_alloc(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_live_tuples(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_dead_tuples(PG_FUNCTION_ARGS); +extern Datum pg_advisory_lock_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_lock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_lock_int8(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_lock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_lock_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_lock_shared_int4(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_lock_int4(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_lock_shared_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_shared_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_all(PG_FUNCTION_ARGS); +extern Datum xml_in(PG_FUNCTION_ARGS); +extern Datum xml_out(PG_FUNCTION_ARGS); +extern Datum xmlcomment(PG_FUNCTION_ARGS); +extern Datum texttoxml(PG_FUNCTION_ARGS); +extern Datum xmlvalidate(PG_FUNCTION_ARGS); +extern Datum xml_recv(PG_FUNCTION_ARGS); +extern Datum xml_send(PG_FUNCTION_ARGS); +extern Datum xmlconcat2(PG_FUNCTION_ARGS); +extern Datum varbittypmodin(PG_FUNCTION_ARGS); +extern Datum intervaltypmodin(PG_FUNCTION_ARGS); +extern Datum intervaltypmodout(PG_FUNCTION_ARGS); +extern Datum timestamptypmodin(PG_FUNCTION_ARGS); +extern Datum timestamptypmodout(PG_FUNCTION_ARGS); +extern Datum timestamptztypmodin(PG_FUNCTION_ARGS); +extern Datum timestamptztypmodout(PG_FUNCTION_ARGS); +extern Datum timetypmodin(PG_FUNCTION_ARGS); +extern Datum timetypmodout(PG_FUNCTION_ARGS); +extern Datum timetztypmodin(PG_FUNCTION_ARGS); +extern Datum timetztypmodout(PG_FUNCTION_ARGS); +extern Datum bpchartypmodin(PG_FUNCTION_ARGS); +extern Datum bpchartypmodout(PG_FUNCTION_ARGS); +extern Datum varchartypmodin(PG_FUNCTION_ARGS); +extern Datum varchartypmodout(PG_FUNCTION_ARGS); +extern Datum numerictypmodin(PG_FUNCTION_ARGS); +extern Datum numerictypmodout(PG_FUNCTION_ARGS); +extern Datum bittypmodin(PG_FUNCTION_ARGS); +extern Datum bittypmodout(PG_FUNCTION_ARGS); +extern Datum varbittypmodout(PG_FUNCTION_ARGS); +extern Datum xmltotext(PG_FUNCTION_ARGS); +extern Datum table_to_xml(PG_FUNCTION_ARGS); +extern Datum query_to_xml(PG_FUNCTION_ARGS); +extern Datum cursor_to_xml(PG_FUNCTION_ARGS); +extern Datum table_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum query_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum cursor_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum table_to_xml_and_xmlschema(PG_FUNCTION_ARGS); +extern Datum query_to_xml_and_xmlschema(PG_FUNCTION_ARGS); +extern Datum xpath(PG_FUNCTION_ARGS); +extern Datum schema_to_xml(PG_FUNCTION_ARGS); +extern Datum schema_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum schema_to_xml_and_xmlschema(PG_FUNCTION_ARGS); +extern Datum database_to_xml(PG_FUNCTION_ARGS); +extern Datum database_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum database_to_xml_and_xmlschema(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_in(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_out(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_recv(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_send(PG_FUNCTION_ARGS); +extern Datum pg_current_xact_id(PG_FUNCTION_ARGS); +extern Datum pg_current_snapshot(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_xmin(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_xmax(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_xip(PG_FUNCTION_ARGS); +extern Datum pg_visible_in_snapshot(PG_FUNCTION_ARGS); +extern Datum uuid_in(PG_FUNCTION_ARGS); +extern Datum uuid_out(PG_FUNCTION_ARGS); +extern Datum uuid_lt(PG_FUNCTION_ARGS); +extern Datum uuid_le(PG_FUNCTION_ARGS); +extern Datum uuid_eq(PG_FUNCTION_ARGS); +extern Datum uuid_ge(PG_FUNCTION_ARGS); +extern Datum uuid_gt(PG_FUNCTION_ARGS); +extern Datum uuid_ne(PG_FUNCTION_ARGS); +extern Datum uuid_cmp(PG_FUNCTION_ARGS); +extern Datum uuid_recv(PG_FUNCTION_ARGS); +extern Datum uuid_send(PG_FUNCTION_ARGS); +extern Datum uuid_hash(PG_FUNCTION_ARGS); +extern Datum booltext(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_function_calls(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_function_total_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_function_self_time(PG_FUNCTION_ARGS); +extern Datum record_eq(PG_FUNCTION_ARGS); +extern Datum record_ne(PG_FUNCTION_ARGS); +extern Datum record_lt(PG_FUNCTION_ARGS); +extern Datum record_gt(PG_FUNCTION_ARGS); +extern Datum record_le(PG_FUNCTION_ARGS); +extern Datum record_ge(PG_FUNCTION_ARGS); +extern Datum btrecordcmp(PG_FUNCTION_ARGS); +extern Datum pg_table_size(PG_FUNCTION_ARGS); +extern Datum pg_indexes_size(PG_FUNCTION_ARGS); +extern Datum pg_relation_filenode(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_name_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_name_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_id_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_id_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_name_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_name_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_id_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_id_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_attnum(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_id(PG_FUNCTION_ARGS); +extern Datum bitoverlay(PG_FUNCTION_ARGS); +extern Datum bitoverlay_no_len(PG_FUNCTION_ARGS); +extern Datum bitgetbit(PG_FUNCTION_ARGS); +extern Datum bitsetbit(PG_FUNCTION_ARGS); +extern Datum pg_relation_filepath(PG_FUNCTION_ARGS); +extern Datum pg_listening_channels(PG_FUNCTION_ARGS); +extern Datum pg_notify(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_numscans(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_returned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_inserted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_deleted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_hot_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_blocks_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_blocks_hit(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_function_calls(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_function_total_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_function_self_time(PG_FUNCTION_ARGS); +extern Datum xpath_exists(PG_FUNCTION_ARGS); +extern Datum xml_is_well_formed(PG_FUNCTION_ARGS); +extern Datum xml_is_well_formed_document(PG_FUNCTION_ARGS); +extern Datum xml_is_well_formed_content(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_vacuum_count(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_autovacuum_count(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_analyze_count(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_autoanalyze_count(PG_FUNCTION_ARGS); +extern Datum text_concat(PG_FUNCTION_ARGS); +extern Datum text_concat_ws(PG_FUNCTION_ARGS); +extern Datum text_left(PG_FUNCTION_ARGS); +extern Datum text_right(PG_FUNCTION_ARGS); +extern Datum text_reverse(PG_FUNCTION_ARGS); +extern Datum gist_point_distance(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_tablespace(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_lock(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_snapshot(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_bufferpin(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_startup_deadlock(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_all(PG_FUNCTION_ARGS); +extern Datum pg_wal_replay_pause(PG_FUNCTION_ARGS); +extern Datum pg_wal_replay_resume(PG_FUNCTION_ARGS); +extern Datum pg_is_wal_replay_paused(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_stat_reset_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_bgwriter_stat_reset_time(PG_FUNCTION_ARGS); +extern Datum ginarrayextract_2args(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsvector_2args(PG_FUNCTION_ARGS); +extern Datum pg_sequence_parameters(PG_FUNCTION_ARGS); +extern Datum pg_available_extensions(PG_FUNCTION_ARGS); +extern Datum pg_available_extension_versions(PG_FUNCTION_ARGS); +extern Datum pg_extension_update_paths(PG_FUNCTION_ARGS); +extern Datum pg_extension_config_dump(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsquery_5args(PG_FUNCTION_ARGS); +extern Datum gin_tsquery_consistent_6args(PG_FUNCTION_ARGS); +extern Datum pg_advisory_xact_lock_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_xact_lock_int8(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_xact_lock_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_xact_lock_int4(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS); +extern Datum varchar_support(PG_FUNCTION_ARGS); +extern Datum pg_create_restore_point(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_wal_senders(PG_FUNCTION_ARGS); +extern Datum window_row_number(PG_FUNCTION_ARGS); +extern Datum window_rank(PG_FUNCTION_ARGS); +extern Datum window_dense_rank(PG_FUNCTION_ARGS); +extern Datum window_percent_rank(PG_FUNCTION_ARGS); +extern Datum window_cume_dist(PG_FUNCTION_ARGS); +extern Datum window_ntile(PG_FUNCTION_ARGS); +extern Datum window_lag(PG_FUNCTION_ARGS); +extern Datum window_lag_with_offset(PG_FUNCTION_ARGS); +extern Datum window_lag_with_offset_and_default(PG_FUNCTION_ARGS); +extern Datum window_lead(PG_FUNCTION_ARGS); +extern Datum window_lead_with_offset(PG_FUNCTION_ARGS); +extern Datum window_lead_with_offset_and_default(PG_FUNCTION_ARGS); +extern Datum window_first_value(PG_FUNCTION_ARGS); +extern Datum window_last_value(PG_FUNCTION_ARGS); +extern Datum window_nth_value(PG_FUNCTION_ARGS); +extern Datum fdw_handler_in(PG_FUNCTION_ARGS); +extern Datum fdw_handler_out(PG_FUNCTION_ARGS); +extern Datum void_recv(PG_FUNCTION_ARGS); +extern Datum void_send(PG_FUNCTION_ARGS); +extern Datum btint2sortsupport(PG_FUNCTION_ARGS); +extern Datum btint4sortsupport(PG_FUNCTION_ARGS); +extern Datum btint8sortsupport(PG_FUNCTION_ARGS); +extern Datum btfloat4sortsupport(PG_FUNCTION_ARGS); +extern Datum btfloat8sortsupport(PG_FUNCTION_ARGS); +extern Datum btoidsortsupport(PG_FUNCTION_ARGS); +extern Datum btnamesortsupport(PG_FUNCTION_ARGS); +extern Datum date_sortsupport(PG_FUNCTION_ARGS); +extern Datum timestamp_sortsupport(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_id(PG_FUNCTION_ARGS); +extern Datum macaddr_not(PG_FUNCTION_ARGS); +extern Datum macaddr_and(PG_FUNCTION_ARGS); +extern Datum macaddr_or(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_temp_files(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_temp_bytes(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_deadlocks(PG_FUNCTION_ARGS); +extern Datum array_to_json(PG_FUNCTION_ARGS); +extern Datum array_to_json_pretty(PG_FUNCTION_ARGS); +extern Datum row_to_json(PG_FUNCTION_ARGS); +extern Datum row_to_json_pretty(PG_FUNCTION_ARGS); +extern Datum numeric_support(PG_FUNCTION_ARGS); +extern Datum varbit_support(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef_wrap(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_write_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_sync_time(PG_FUNCTION_ARGS); +extern Datum pg_collation_for(PG_FUNCTION_ARGS); +extern Datum pg_trigger_depth(PG_FUNCTION_ARGS); +extern Datum pg_wal_lsn_diff(PG_FUNCTION_ARGS); +extern Datum pg_size_pretty_numeric(PG_FUNCTION_ARGS); +extern Datum array_remove(PG_FUNCTION_ARGS); +extern Datum array_replace(PG_FUNCTION_ARGS); +extern Datum rangesel(PG_FUNCTION_ARGS); +extern Datum be_lo_lseek64(PG_FUNCTION_ARGS); +extern Datum be_lo_tell64(PG_FUNCTION_ARGS); +extern Datum be_lo_truncate64(PG_FUNCTION_ARGS); +extern Datum json_agg_transfn(PG_FUNCTION_ARGS); +extern Datum json_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum to_json(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_mod_since_analyze(PG_FUNCTION_ARGS); +extern Datum numeric_sum(PG_FUNCTION_ARGS); +extern Datum array_cardinality(PG_FUNCTION_ARGS); +extern Datum json_object_agg_transfn(PG_FUNCTION_ARGS); +extern Datum record_image_eq(PG_FUNCTION_ARGS); +extern Datum record_image_ne(PG_FUNCTION_ARGS); +extern Datum record_image_lt(PG_FUNCTION_ARGS); +extern Datum record_image_gt(PG_FUNCTION_ARGS); +extern Datum record_image_le(PG_FUNCTION_ARGS); +extern Datum record_image_ge(PG_FUNCTION_ARGS); +extern Datum btrecordimagecmp(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_archiver(PG_FUNCTION_ARGS); +extern Datum json_object_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum json_build_array(PG_FUNCTION_ARGS); +extern Datum json_build_array_noargs(PG_FUNCTION_ARGS); +extern Datum json_build_object(PG_FUNCTION_ARGS); +extern Datum json_build_object_noargs(PG_FUNCTION_ARGS); +extern Datum json_object(PG_FUNCTION_ARGS); +extern Datum json_object_two_arg(PG_FUNCTION_ARGS); +extern Datum json_to_record(PG_FUNCTION_ARGS); +extern Datum json_to_recordset(PG_FUNCTION_ARGS); +extern Datum jsonb_array_length(PG_FUNCTION_ARGS); +extern Datum jsonb_each(PG_FUNCTION_ARGS); +extern Datum jsonb_populate_record(PG_FUNCTION_ARGS); +extern Datum jsonb_typeof(PG_FUNCTION_ARGS); +extern Datum jsonb_object_field_text(PG_FUNCTION_ARGS); +extern Datum jsonb_array_element(PG_FUNCTION_ARGS); +extern Datum jsonb_array_element_text(PG_FUNCTION_ARGS); +extern Datum jsonb_extract_path(PG_FUNCTION_ARGS); +extern Datum width_bucket_array(PG_FUNCTION_ARGS); +extern Datum jsonb_array_elements(PG_FUNCTION_ARGS); +extern Datum pg_lsn_in(PG_FUNCTION_ARGS); +extern Datum pg_lsn_out(PG_FUNCTION_ARGS); +extern Datum pg_lsn_lt(PG_FUNCTION_ARGS); +extern Datum pg_lsn_le(PG_FUNCTION_ARGS); +extern Datum pg_lsn_eq(PG_FUNCTION_ARGS); +extern Datum pg_lsn_ge(PG_FUNCTION_ARGS); +extern Datum pg_lsn_gt(PG_FUNCTION_ARGS); +extern Datum pg_lsn_ne(PG_FUNCTION_ARGS); +extern Datum pg_lsn_mi(PG_FUNCTION_ARGS); +extern Datum pg_lsn_recv(PG_FUNCTION_ARGS); +extern Datum pg_lsn_send(PG_FUNCTION_ARGS); +extern Datum pg_lsn_cmp(PG_FUNCTION_ARGS); +extern Datum pg_lsn_hash(PG_FUNCTION_ARGS); +extern Datum bttextsortsupport(PG_FUNCTION_ARGS); +extern Datum generate_series_step_numeric(PG_FUNCTION_ARGS); +extern Datum generate_series_numeric(PG_FUNCTION_ARGS); +extern Datum json_strip_nulls(PG_FUNCTION_ARGS); +extern Datum jsonb_strip_nulls(PG_FUNCTION_ARGS); +extern Datum jsonb_object(PG_FUNCTION_ARGS); +extern Datum jsonb_object_two_arg(PG_FUNCTION_ARGS); +extern Datum jsonb_agg_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum jsonb_build_array(PG_FUNCTION_ARGS); +extern Datum jsonb_build_array_noargs(PG_FUNCTION_ARGS); +extern Datum jsonb_build_object(PG_FUNCTION_ARGS); +extern Datum jsonb_build_object_noargs(PG_FUNCTION_ARGS); +extern Datum dist_ppoly(PG_FUNCTION_ARGS); +extern Datum array_position(PG_FUNCTION_ARGS); +extern Datum array_position_start(PG_FUNCTION_ARGS); +extern Datum array_positions(PG_FUNCTION_ARGS); +extern Datum gist_circle_distance(PG_FUNCTION_ARGS); +extern Datum numeric_scale(PG_FUNCTION_ARGS); +extern Datum gist_point_fetch(PG_FUNCTION_ARGS); +extern Datum numeric_sortsupport(PG_FUNCTION_ARGS); +extern Datum gist_poly_distance(PG_FUNCTION_ARGS); +extern Datum dist_cpoint(PG_FUNCTION_ARGS); +extern Datum dist_polyp(PG_FUNCTION_ARGS); +extern Datum pg_read_file_off_len_missing(PG_FUNCTION_ARGS); +extern Datum show_config_by_name_missing_ok(PG_FUNCTION_ARGS); +extern Datum pg_read_binary_file_off_len_missing(PG_FUNCTION_ARGS); +extern Datum pg_notification_queue_usage(PG_FUNCTION_ARGS); +extern Datum pg_ls_dir(PG_FUNCTION_ARGS); +extern Datum row_security_active(PG_FUNCTION_ARGS); +extern Datum row_security_active_name(PG_FUNCTION_ARGS); +extern Datum uuid_sortsupport(PG_FUNCTION_ARGS); +extern Datum jsonb_concat(PG_FUNCTION_ARGS); +extern Datum jsonb_delete(PG_FUNCTION_ARGS); +extern Datum jsonb_delete_idx(PG_FUNCTION_ARGS); +extern Datum jsonb_delete_path(PG_FUNCTION_ARGS); +extern Datum jsonb_set(PG_FUNCTION_ARGS); +extern Datum jsonb_pretty(PG_FUNCTION_ARGS); +extern Datum pg_stat_file(PG_FUNCTION_ARGS); +extern Datum xidneq(PG_FUNCTION_ARGS); +extern Datum tsm_handler_in(PG_FUNCTION_ARGS); +extern Datum tsm_handler_out(PG_FUNCTION_ARGS); +extern Datum tsm_bernoulli_handler(PG_FUNCTION_ARGS); +extern Datum tsm_system_handler(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_wal_receiver(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_progress_info(PG_FUNCTION_ARGS); +extern Datum tsvector_filter(PG_FUNCTION_ARGS); +extern Datum tsvector_setweight_by_filter(PG_FUNCTION_ARGS); +extern Datum tsvector_delete_str(PG_FUNCTION_ARGS); +extern Datum tsvector_unnest(PG_FUNCTION_ARGS); +extern Datum tsvector_delete_arr(PG_FUNCTION_ARGS); +extern Datum int4_avg_combine(PG_FUNCTION_ARGS); +extern Datum interval_avg_combine(PG_FUNCTION_ARGS); +extern Datum tsvector_to_array(PG_FUNCTION_ARGS); +extern Datum array_to_tsvector(PG_FUNCTION_ARGS); +extern Datum bpchar_sortsupport(PG_FUNCTION_ARGS); +extern Datum show_all_file_settings(PG_FUNCTION_ARGS); +extern Datum pg_current_wal_flush_lsn(PG_FUNCTION_ARGS); +extern Datum bytea_sortsupport(PG_FUNCTION_ARGS); +extern Datum bttext_pattern_sortsupport(PG_FUNCTION_ARGS); +extern Datum btbpchar_pattern_sortsupport(PG_FUNCTION_ARGS); +extern Datum pg_size_bytes(PG_FUNCTION_ARGS); +extern Datum numeric_serialize(PG_FUNCTION_ARGS); +extern Datum numeric_deserialize(PG_FUNCTION_ARGS); +extern Datum numeric_avg_combine(PG_FUNCTION_ARGS); +extern Datum numeric_poly_combine(PG_FUNCTION_ARGS); +extern Datum numeric_poly_serialize(PG_FUNCTION_ARGS); +extern Datum numeric_poly_deserialize(PG_FUNCTION_ARGS); +extern Datum numeric_combine(PG_FUNCTION_ARGS); +extern Datum float8_regr_combine(PG_FUNCTION_ARGS); +extern Datum jsonb_delete_array(PG_FUNCTION_ARGS); +extern Datum cash_mul_int8(PG_FUNCTION_ARGS); +extern Datum cash_div_int8(PG_FUNCTION_ARGS); +extern Datum pg_current_xact_id_if_assigned(PG_FUNCTION_ARGS); +extern Datum pg_get_partkeydef(PG_FUNCTION_ARGS); +extern Datum pg_ls_logdir(PG_FUNCTION_ARGS); +extern Datum pg_ls_waldir(PG_FUNCTION_ARGS); +extern Datum pg_ndistinct_in(PG_FUNCTION_ARGS); +extern Datum pg_ndistinct_out(PG_FUNCTION_ARGS); +extern Datum pg_ndistinct_recv(PG_FUNCTION_ARGS); +extern Datum pg_ndistinct_send(PG_FUNCTION_ARGS); +extern Datum macaddr_sortsupport(PG_FUNCTION_ARGS); +extern Datum pg_xact_status(PG_FUNCTION_ARGS); +extern Datum pg_safe_snapshot_blocking_pids(PG_FUNCTION_ARGS); +extern Datum pg_isolation_test_session_is_blocked(PG_FUNCTION_ARGS); +extern Datum pg_identify_object_as_address(PG_FUNCTION_ARGS); +extern Datum brin_minmax_opcinfo(PG_FUNCTION_ARGS); +extern Datum brin_minmax_add_value(PG_FUNCTION_ARGS); +extern Datum brin_minmax_consistent(PG_FUNCTION_ARGS); +extern Datum brin_minmax_union(PG_FUNCTION_ARGS); +extern Datum int8_avg_accum_inv(PG_FUNCTION_ARGS); +extern Datum numeric_poly_sum(PG_FUNCTION_ARGS); +extern Datum numeric_poly_avg(PG_FUNCTION_ARGS); +extern Datum numeric_poly_var_pop(PG_FUNCTION_ARGS); +extern Datum numeric_poly_var_samp(PG_FUNCTION_ARGS); +extern Datum numeric_poly_stddev_pop(PG_FUNCTION_ARGS); +extern Datum numeric_poly_stddev_samp(PG_FUNCTION_ARGS); +extern Datum regexp_match_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_match(PG_FUNCTION_ARGS); +extern Datum int8_mul_cash(PG_FUNCTION_ARGS); +extern Datum pg_config(PG_FUNCTION_ARGS); +extern Datum pg_hba_file_rules(PG_FUNCTION_ARGS); +extern Datum pg_statistics_obj_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_dependencies_in(PG_FUNCTION_ARGS); +extern Datum pg_dependencies_out(PG_FUNCTION_ARGS); +extern Datum pg_dependencies_recv(PG_FUNCTION_ARGS); +extern Datum pg_dependencies_send(PG_FUNCTION_ARGS); +extern Datum pg_get_partition_constraintdef(PG_FUNCTION_ARGS); +extern Datum time_hash_extended(PG_FUNCTION_ARGS); +extern Datum timetz_hash_extended(PG_FUNCTION_ARGS); +extern Datum timestamp_hash_extended(PG_FUNCTION_ARGS); +extern Datum uuid_hash_extended(PG_FUNCTION_ARGS); +extern Datum pg_lsn_hash_extended(PG_FUNCTION_ARGS); +extern Datum hashenumextended(PG_FUNCTION_ARGS); +extern Datum pg_get_statisticsobjdef(PG_FUNCTION_ARGS); +extern Datum jsonb_hash_extended(PG_FUNCTION_ARGS); +extern Datum hash_range_extended(PG_FUNCTION_ARGS); +extern Datum interval_hash_extended(PG_FUNCTION_ARGS); +extern Datum sha224_bytea(PG_FUNCTION_ARGS); +extern Datum sha256_bytea(PG_FUNCTION_ARGS); +extern Datum sha384_bytea(PG_FUNCTION_ARGS); +extern Datum sha512_bytea(PG_FUNCTION_ARGS); +extern Datum pg_partition_tree(PG_FUNCTION_ARGS); +extern Datum pg_partition_root(PG_FUNCTION_ARGS); +extern Datum pg_partition_ancestors(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_checksum_failures(PG_FUNCTION_ARGS); +extern Datum pg_stats_ext_mcvlist_items(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_checksum_last_failure(PG_FUNCTION_ARGS); +extern Datum gen_random_uuid(PG_FUNCTION_ARGS); +extern Datum gtsvector_options(PG_FUNCTION_ARGS); +extern Datum gist_point_sortsupport(PG_FUNCTION_ARGS); +extern Datum pg_promote(PG_FUNCTION_ARGS); +extern Datum prefixsel(PG_FUNCTION_ARGS); +extern Datum prefixjoinsel(PG_FUNCTION_ARGS); +extern Datum pg_control_system(PG_FUNCTION_ARGS); +extern Datum pg_control_checkpoint(PG_FUNCTION_ARGS); +extern Datum pg_control_recovery(PG_FUNCTION_ARGS); +extern Datum pg_control_init(PG_FUNCTION_ARGS); +extern Datum pg_import_system_collations(PG_FUNCTION_ARGS); +extern Datum macaddr8_recv(PG_FUNCTION_ARGS); +extern Datum macaddr8_send(PG_FUNCTION_ARGS); +extern Datum pg_collation_actual_version(PG_FUNCTION_ARGS); +extern Datum jsonb_numeric(PG_FUNCTION_ARGS); +extern Datum jsonb_int2(PG_FUNCTION_ARGS); +extern Datum jsonb_int4(PG_FUNCTION_ARGS); +extern Datum jsonb_int8(PG_FUNCTION_ARGS); +extern Datum jsonb_float4(PG_FUNCTION_ARGS); +extern Datum pg_filenode_relation(PG_FUNCTION_ARGS); +extern Datum be_lo_from_bytea(PG_FUNCTION_ARGS); +extern Datum be_lo_get(PG_FUNCTION_ARGS); +extern Datum be_lo_get_fragment(PG_FUNCTION_ARGS); +extern Datum be_lo_put(PG_FUNCTION_ARGS); +extern Datum make_timestamp(PG_FUNCTION_ARGS); +extern Datum make_timestamptz(PG_FUNCTION_ARGS); +extern Datum make_timestamptz_at_timezone(PG_FUNCTION_ARGS); +extern Datum make_interval(PG_FUNCTION_ARGS); +extern Datum jsonb_array_elements_text(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_config(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_choose(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum jsonb_populate_recordset(PG_FUNCTION_ARGS); +extern Datum to_regoperator(PG_FUNCTION_ARGS); +extern Datum jsonb_object_field(PG_FUNCTION_ARGS); +extern Datum to_regprocedure(PG_FUNCTION_ARGS); +extern Datum gin_compare_jsonb(PG_FUNCTION_ARGS); +extern Datum gin_extract_jsonb(PG_FUNCTION_ARGS); +extern Datum gin_extract_jsonb_query(PG_FUNCTION_ARGS); +extern Datum gin_consistent_jsonb(PG_FUNCTION_ARGS); +extern Datum gin_extract_jsonb_path(PG_FUNCTION_ARGS); +extern Datum gin_extract_jsonb_query_path(PG_FUNCTION_ARGS); +extern Datum gin_consistent_jsonb_path(PG_FUNCTION_ARGS); +extern Datum gin_triconsistent_jsonb(PG_FUNCTION_ARGS); +extern Datum gin_triconsistent_jsonb_path(PG_FUNCTION_ARGS); +extern Datum jsonb_to_record(PG_FUNCTION_ARGS); +extern Datum jsonb_to_recordset(PG_FUNCTION_ARGS); +extern Datum to_regoper(PG_FUNCTION_ARGS); +extern Datum to_regtype(PG_FUNCTION_ARGS); +extern Datum to_regproc(PG_FUNCTION_ARGS); +extern Datum to_regclass(PG_FUNCTION_ARGS); +extern Datum bool_accum(PG_FUNCTION_ARGS); +extern Datum bool_accum_inv(PG_FUNCTION_ARGS); +extern Datum bool_alltrue(PG_FUNCTION_ARGS); +extern Datum bool_anytrue(PG_FUNCTION_ARGS); +extern Datum anyenum_in(PG_FUNCTION_ARGS); +extern Datum anyenum_out(PG_FUNCTION_ARGS); +extern Datum enum_in(PG_FUNCTION_ARGS); +extern Datum enum_out(PG_FUNCTION_ARGS); +extern Datum enum_eq(PG_FUNCTION_ARGS); +extern Datum enum_ne(PG_FUNCTION_ARGS); +extern Datum enum_lt(PG_FUNCTION_ARGS); +extern Datum enum_gt(PG_FUNCTION_ARGS); +extern Datum enum_le(PG_FUNCTION_ARGS); +extern Datum enum_ge(PG_FUNCTION_ARGS); +extern Datum enum_cmp(PG_FUNCTION_ARGS); +extern Datum hashenum(PG_FUNCTION_ARGS); +extern Datum enum_smaller(PG_FUNCTION_ARGS); +extern Datum enum_larger(PG_FUNCTION_ARGS); +extern Datum enum_first(PG_FUNCTION_ARGS); +extern Datum enum_last(PG_FUNCTION_ARGS); +extern Datum enum_range_bounds(PG_FUNCTION_ARGS); +extern Datum enum_range_all(PG_FUNCTION_ARGS); +extern Datum enum_recv(PG_FUNCTION_ARGS); +extern Datum enum_send(PG_FUNCTION_ARGS); +extern Datum string_agg_transfn(PG_FUNCTION_ARGS); +extern Datum string_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum pg_describe_object(PG_FUNCTION_ARGS); +extern Datum text_format(PG_FUNCTION_ARGS); +extern Datum text_format_nv(PG_FUNCTION_ARGS); +extern Datum bytea_string_agg_transfn(PG_FUNCTION_ARGS); +extern Datum bytea_string_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum int8dec(PG_FUNCTION_ARGS); +extern Datum int8dec_any(PG_FUNCTION_ARGS); +extern Datum numeric_accum_inv(PG_FUNCTION_ARGS); +extern Datum interval_avg_accum_inv(PG_FUNCTION_ARGS); +extern Datum network_overlap(PG_FUNCTION_ARGS); +extern Datum inet_gist_consistent(PG_FUNCTION_ARGS); +extern Datum inet_gist_union(PG_FUNCTION_ARGS); +extern Datum inet_gist_compress(PG_FUNCTION_ARGS); +extern Datum jsonb_bool(PG_FUNCTION_ARGS); +extern Datum inet_gist_penalty(PG_FUNCTION_ARGS); +extern Datum inet_gist_picksplit(PG_FUNCTION_ARGS); +extern Datum inet_gist_same(PG_FUNCTION_ARGS); +extern Datum networksel(PG_FUNCTION_ARGS); +extern Datum networkjoinsel(PG_FUNCTION_ARGS); +extern Datum network_larger(PG_FUNCTION_ARGS); +extern Datum network_smaller(PG_FUNCTION_ARGS); +extern Datum pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS); +extern Datum int2_accum_inv(PG_FUNCTION_ARGS); +extern Datum int4_accum_inv(PG_FUNCTION_ARGS); +extern Datum int8_accum_inv(PG_FUNCTION_ARGS); +extern Datum int2_avg_accum_inv(PG_FUNCTION_ARGS); +extern Datum int4_avg_accum_inv(PG_FUNCTION_ARGS); +extern Datum int2int4_sum(PG_FUNCTION_ARGS); +extern Datum inet_gist_fetch(PG_FUNCTION_ARGS); +extern Datum pg_logical_emit_message_text(PG_FUNCTION_ARGS); +extern Datum pg_logical_emit_message_bytea(PG_FUNCTION_ARGS); +extern Datum jsonb_insert(PG_FUNCTION_ARGS); +extern Datum pg_xact_commit_timestamp(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_pg_type_oid(PG_FUNCTION_ARGS); +extern Datum pg_last_committed_xact(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_array_pg_type_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_heap_pg_class_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_index_pg_class_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_toast_pg_class_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_pg_enum_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_pg_authid_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_create_empty_extension(PG_FUNCTION_ARGS); +extern Datum event_trigger_in(PG_FUNCTION_ARGS); +extern Datum event_trigger_out(PG_FUNCTION_ARGS); +extern Datum tsvectorin(PG_FUNCTION_ARGS); +extern Datum tsvectorout(PG_FUNCTION_ARGS); +extern Datum tsqueryin(PG_FUNCTION_ARGS); +extern Datum tsqueryout(PG_FUNCTION_ARGS); +extern Datum tsvector_lt(PG_FUNCTION_ARGS); +extern Datum tsvector_le(PG_FUNCTION_ARGS); +extern Datum tsvector_eq(PG_FUNCTION_ARGS); +extern Datum tsvector_ne(PG_FUNCTION_ARGS); +extern Datum tsvector_ge(PG_FUNCTION_ARGS); +extern Datum tsvector_gt(PG_FUNCTION_ARGS); +extern Datum tsvector_cmp(PG_FUNCTION_ARGS); +extern Datum tsvector_strip(PG_FUNCTION_ARGS); +extern Datum tsvector_setweight(PG_FUNCTION_ARGS); +extern Datum tsvector_concat(PG_FUNCTION_ARGS); +extern Datum ts_match_vq(PG_FUNCTION_ARGS); +extern Datum ts_match_qv(PG_FUNCTION_ARGS); +extern Datum tsvectorsend(PG_FUNCTION_ARGS); +extern Datum tsvectorrecv(PG_FUNCTION_ARGS); +extern Datum tsquerysend(PG_FUNCTION_ARGS); +extern Datum tsqueryrecv(PG_FUNCTION_ARGS); +extern Datum gtsvectorin(PG_FUNCTION_ARGS); +extern Datum gtsvectorout(PG_FUNCTION_ARGS); +extern Datum gtsvector_compress(PG_FUNCTION_ARGS); +extern Datum gtsvector_decompress(PG_FUNCTION_ARGS); +extern Datum gtsvector_picksplit(PG_FUNCTION_ARGS); +extern Datum gtsvector_union(PG_FUNCTION_ARGS); +extern Datum gtsvector_same(PG_FUNCTION_ARGS); +extern Datum gtsvector_penalty(PG_FUNCTION_ARGS); +extern Datum gtsvector_consistent(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsvector(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsquery(PG_FUNCTION_ARGS); +extern Datum gin_tsquery_consistent(PG_FUNCTION_ARGS); +extern Datum tsquery_lt(PG_FUNCTION_ARGS); +extern Datum tsquery_le(PG_FUNCTION_ARGS); +extern Datum tsquery_eq(PG_FUNCTION_ARGS); +extern Datum tsquery_ne(PG_FUNCTION_ARGS); +extern Datum tsquery_ge(PG_FUNCTION_ARGS); +extern Datum tsquery_gt(PG_FUNCTION_ARGS); +extern Datum tsquery_cmp(PG_FUNCTION_ARGS); +extern Datum tsquery_and(PG_FUNCTION_ARGS); +extern Datum tsquery_or(PG_FUNCTION_ARGS); +extern Datum tsquery_not(PG_FUNCTION_ARGS); +extern Datum tsquery_numnode(PG_FUNCTION_ARGS); +extern Datum tsquerytree(PG_FUNCTION_ARGS); +extern Datum tsquery_rewrite(PG_FUNCTION_ARGS); +extern Datum tsquery_rewrite_query(PG_FUNCTION_ARGS); +extern Datum tsmatchsel(PG_FUNCTION_ARGS); +extern Datum tsmatchjoinsel(PG_FUNCTION_ARGS); +extern Datum ts_typanalyze(PG_FUNCTION_ARGS); +extern Datum ts_stat1(PG_FUNCTION_ARGS); +extern Datum ts_stat2(PG_FUNCTION_ARGS); +extern Datum tsq_mcontains(PG_FUNCTION_ARGS); +extern Datum tsq_mcontained(PG_FUNCTION_ARGS); +extern Datum gtsquery_compress(PG_FUNCTION_ARGS); +extern Datum text_starts_with(PG_FUNCTION_ARGS); +extern Datum gtsquery_picksplit(PG_FUNCTION_ARGS); +extern Datum gtsquery_union(PG_FUNCTION_ARGS); +extern Datum gtsquery_same(PG_FUNCTION_ARGS); +extern Datum gtsquery_penalty(PG_FUNCTION_ARGS); +extern Datum gtsquery_consistent(PG_FUNCTION_ARGS); +extern Datum ts_rank_wttf(PG_FUNCTION_ARGS); +extern Datum ts_rank_wtt(PG_FUNCTION_ARGS); +extern Datum ts_rank_ttf(PG_FUNCTION_ARGS); +extern Datum ts_rank_tt(PG_FUNCTION_ARGS); +extern Datum ts_rankcd_wttf(PG_FUNCTION_ARGS); +extern Datum ts_rankcd_wtt(PG_FUNCTION_ARGS); +extern Datum ts_rankcd_ttf(PG_FUNCTION_ARGS); +extern Datum ts_rankcd_tt(PG_FUNCTION_ARGS); +extern Datum tsvector_length(PG_FUNCTION_ARGS); +extern Datum ts_token_type_byid(PG_FUNCTION_ARGS); +extern Datum ts_token_type_byname(PG_FUNCTION_ARGS); +extern Datum ts_parse_byid(PG_FUNCTION_ARGS); +extern Datum ts_parse_byname(PG_FUNCTION_ARGS); +extern Datum prsd_start(PG_FUNCTION_ARGS); +extern Datum prsd_nexttoken(PG_FUNCTION_ARGS); +extern Datum prsd_end(PG_FUNCTION_ARGS); +extern Datum prsd_headline(PG_FUNCTION_ARGS); +extern Datum prsd_lextype(PG_FUNCTION_ARGS); +extern Datum ts_lexize(PG_FUNCTION_ARGS); +extern Datum gin_cmp_tslexeme(PG_FUNCTION_ARGS); +extern Datum dsimple_init(PG_FUNCTION_ARGS); +extern Datum dsimple_lexize(PG_FUNCTION_ARGS); +extern Datum dsynonym_init(PG_FUNCTION_ARGS); +extern Datum dsynonym_lexize(PG_FUNCTION_ARGS); +extern Datum dispell_init(PG_FUNCTION_ARGS); +extern Datum dispell_lexize(PG_FUNCTION_ARGS); +extern Datum regconfigin(PG_FUNCTION_ARGS); +extern Datum regconfigout(PG_FUNCTION_ARGS); +extern Datum regconfigrecv(PG_FUNCTION_ARGS); +extern Datum regconfigsend(PG_FUNCTION_ARGS); +extern Datum thesaurus_init(PG_FUNCTION_ARGS); +extern Datum thesaurus_lexize(PG_FUNCTION_ARGS); +extern Datum ts_headline_byid_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_byid(PG_FUNCTION_ARGS); +extern Datum to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum to_tsquery_byid(PG_FUNCTION_ARGS); +extern Datum plainto_tsquery_byid(PG_FUNCTION_ARGS); +extern Datum to_tsvector(PG_FUNCTION_ARGS); +extern Datum to_tsquery(PG_FUNCTION_ARGS); +extern Datum plainto_tsquery(PG_FUNCTION_ARGS); +extern Datum tsvector_update_trigger_byid(PG_FUNCTION_ARGS); +extern Datum tsvector_update_trigger_bycolumn(PG_FUNCTION_ARGS); +extern Datum ts_headline_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline(PG_FUNCTION_ARGS); +extern Datum pg_ts_parser_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_ts_dict_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_ts_config_is_visible(PG_FUNCTION_ARGS); +extern Datum get_current_ts_config(PG_FUNCTION_ARGS); +extern Datum ts_match_tt(PG_FUNCTION_ARGS); +extern Datum ts_match_tq(PG_FUNCTION_ARGS); +extern Datum pg_ts_template_is_visible(PG_FUNCTION_ARGS); +extern Datum regdictionaryin(PG_FUNCTION_ARGS); +extern Datum regdictionaryout(PG_FUNCTION_ARGS); +extern Datum regdictionaryrecv(PG_FUNCTION_ARGS); +extern Datum regdictionarysend(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_shared(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_single_table_counters(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_single_function_counters(PG_FUNCTION_ARGS); +extern Datum pg_tablespace_location(PG_FUNCTION_ARGS); +extern Datum pg_create_physical_replication_slot(PG_FUNCTION_ARGS); +extern Datum pg_drop_replication_slot(PG_FUNCTION_ARGS); +extern Datum pg_get_replication_slots(PG_FUNCTION_ARGS); +extern Datum pg_logical_slot_get_changes(PG_FUNCTION_ARGS); +extern Datum pg_logical_slot_get_binary_changes(PG_FUNCTION_ARGS); +extern Datum pg_logical_slot_peek_changes(PG_FUNCTION_ARGS); +extern Datum pg_logical_slot_peek_binary_changes(PG_FUNCTION_ARGS); +extern Datum pg_create_logical_replication_slot(PG_FUNCTION_ARGS); +extern Datum to_jsonb(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_snapshot_timestamp(PG_FUNCTION_ARGS); +extern Datum gin_clean_pending_list(PG_FUNCTION_ARGS); +extern Datum gtsvector_consistent_oldsig(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsquery_oldsig(PG_FUNCTION_ARGS); +extern Datum gin_tsquery_consistent_oldsig(PG_FUNCTION_ARGS); +extern Datum gtsquery_consistent_oldsig(PG_FUNCTION_ARGS); +extern Datum inet_spg_config(PG_FUNCTION_ARGS); +extern Datum inet_spg_choose(PG_FUNCTION_ARGS); +extern Datum inet_spg_picksplit(PG_FUNCTION_ARGS); +extern Datum inet_spg_inner_consistent(PG_FUNCTION_ARGS); +extern Datum inet_spg_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum pg_current_logfile(PG_FUNCTION_ARGS); +extern Datum pg_current_logfile_1arg(PG_FUNCTION_ARGS); +extern Datum jsonb_send(PG_FUNCTION_ARGS); +extern Datum jsonb_out(PG_FUNCTION_ARGS); +extern Datum jsonb_recv(PG_FUNCTION_ARGS); +extern Datum jsonb_in(PG_FUNCTION_ARGS); +extern Datum pg_get_function_arg_default(PG_FUNCTION_ARGS); +extern Datum pg_export_snapshot(PG_FUNCTION_ARGS); +extern Datum pg_is_in_recovery(PG_FUNCTION_ARGS); +extern Datum int4_cash(PG_FUNCTION_ARGS); +extern Datum int8_cash(PG_FUNCTION_ARGS); +extern Datum xmltext(PG_FUNCTION_ARGS); +extern Datum pg_collation_is_visible(PG_FUNCTION_ARGS); +extern Datum array_typanalyze(PG_FUNCTION_ARGS); +extern Datum arraycontsel(PG_FUNCTION_ARGS); +extern Datum arraycontjoinsel(PG_FUNCTION_ARGS); +extern Datum pg_get_multixact_members(PG_FUNCTION_ARGS); +extern Datum pg_last_wal_receive_lsn(PG_FUNCTION_ARGS); +extern Datum pg_last_wal_replay_lsn(PG_FUNCTION_ARGS); +extern Datum cash_div_cash(PG_FUNCTION_ARGS); +extern Datum cash_numeric(PG_FUNCTION_ARGS); +extern Datum numeric_cash(PG_FUNCTION_ARGS); +extern Datum pg_read_file_all(PG_FUNCTION_ARGS); +extern Datum pg_read_binary_file_off_len(PG_FUNCTION_ARGS); +extern Datum pg_read_binary_file_all(PG_FUNCTION_ARGS); +extern Datum pg_opfamily_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_last_xact_replay_timestamp(PG_FUNCTION_ARGS); +extern Datum anyrange_in(PG_FUNCTION_ARGS); +extern Datum anyrange_out(PG_FUNCTION_ARGS); +extern Datum range_in(PG_FUNCTION_ARGS); +extern Datum range_out(PG_FUNCTION_ARGS); +extern Datum range_recv(PG_FUNCTION_ARGS); +extern Datum range_send(PG_FUNCTION_ARGS); +extern Datum pg_identify_object(PG_FUNCTION_ARGS); +extern Datum range_constructor2(PG_FUNCTION_ARGS); +extern Datum range_constructor3(PG_FUNCTION_ARGS); +extern Datum pg_relation_is_updatable(PG_FUNCTION_ARGS); +extern Datum pg_column_is_updatable(PG_FUNCTION_ARGS); +extern Datum make_date(PG_FUNCTION_ARGS); +extern Datum make_time(PG_FUNCTION_ARGS); +extern Datum range_lower(PG_FUNCTION_ARGS); +extern Datum range_upper(PG_FUNCTION_ARGS); +extern Datum range_empty(PG_FUNCTION_ARGS); +extern Datum range_lower_inc(PG_FUNCTION_ARGS); +extern Datum range_upper_inc(PG_FUNCTION_ARGS); +extern Datum range_lower_inf(PG_FUNCTION_ARGS); +extern Datum range_upper_inf(PG_FUNCTION_ARGS); +extern Datum range_eq(PG_FUNCTION_ARGS); +extern Datum range_ne(PG_FUNCTION_ARGS); +extern Datum range_overlaps(PG_FUNCTION_ARGS); +extern Datum range_contains_elem(PG_FUNCTION_ARGS); +extern Datum range_contains(PG_FUNCTION_ARGS); +extern Datum elem_contained_by_range(PG_FUNCTION_ARGS); +extern Datum range_contained_by(PG_FUNCTION_ARGS); +extern Datum range_adjacent(PG_FUNCTION_ARGS); +extern Datum range_before(PG_FUNCTION_ARGS); +extern Datum range_after(PG_FUNCTION_ARGS); +extern Datum range_overleft(PG_FUNCTION_ARGS); +extern Datum range_overright(PG_FUNCTION_ARGS); +extern Datum range_union(PG_FUNCTION_ARGS); +extern Datum range_intersect(PG_FUNCTION_ARGS); +extern Datum range_minus(PG_FUNCTION_ARGS); +extern Datum range_cmp(PG_FUNCTION_ARGS); +extern Datum range_lt(PG_FUNCTION_ARGS); +extern Datum range_le(PG_FUNCTION_ARGS); +extern Datum range_ge(PG_FUNCTION_ARGS); +extern Datum range_gt(PG_FUNCTION_ARGS); +extern Datum range_gist_consistent(PG_FUNCTION_ARGS); +extern Datum range_gist_union(PG_FUNCTION_ARGS); +extern Datum pg_replication_slot_advance(PG_FUNCTION_ARGS); +extern Datum range_gist_penalty(PG_FUNCTION_ARGS); +extern Datum range_gist_picksplit(PG_FUNCTION_ARGS); +extern Datum range_gist_same(PG_FUNCTION_ARGS); +extern Datum hash_range(PG_FUNCTION_ARGS); +extern Datum int4range_canonical(PG_FUNCTION_ARGS); +extern Datum daterange_canonical(PG_FUNCTION_ARGS); +extern Datum range_typanalyze(PG_FUNCTION_ARGS); +extern Datum timestamp_support(PG_FUNCTION_ARGS); +extern Datum interval_support(PG_FUNCTION_ARGS); +extern Datum ginarraytriconsistent(PG_FUNCTION_ARGS); +extern Datum gin_tsquery_triconsistent(PG_FUNCTION_ARGS); +extern Datum int4range_subdiff(PG_FUNCTION_ARGS); +extern Datum int8range_subdiff(PG_FUNCTION_ARGS); +extern Datum numrange_subdiff(PG_FUNCTION_ARGS); +extern Datum daterange_subdiff(PG_FUNCTION_ARGS); +extern Datum int8range_canonical(PG_FUNCTION_ARGS); +extern Datum tsrange_subdiff(PG_FUNCTION_ARGS); +extern Datum tstzrange_subdiff(PG_FUNCTION_ARGS); +extern Datum jsonb_object_keys(PG_FUNCTION_ARGS); +extern Datum jsonb_each_text(PG_FUNCTION_ARGS); +extern Datum mxid_age(PG_FUNCTION_ARGS); +extern Datum jsonb_extract_path_text(PG_FUNCTION_ARGS); +extern Datum acldefault_sql(PG_FUNCTION_ARGS); +extern Datum time_support(PG_FUNCTION_ARGS); +extern Datum json_object_field(PG_FUNCTION_ARGS); +extern Datum json_object_field_text(PG_FUNCTION_ARGS); +extern Datum json_array_element(PG_FUNCTION_ARGS); +extern Datum json_array_element_text(PG_FUNCTION_ARGS); +extern Datum json_extract_path(PG_FUNCTION_ARGS); +extern Datum brin_summarize_new_values(PG_FUNCTION_ARGS); +extern Datum json_extract_path_text(PG_FUNCTION_ARGS); +extern Datum pg_get_object_address(PG_FUNCTION_ARGS); +extern Datum json_array_elements(PG_FUNCTION_ARGS); +extern Datum json_array_length(PG_FUNCTION_ARGS); +extern Datum json_object_keys(PG_FUNCTION_ARGS); +extern Datum json_each(PG_FUNCTION_ARGS); +extern Datum json_each_text(PG_FUNCTION_ARGS); +extern Datum json_populate_record(PG_FUNCTION_ARGS); +extern Datum json_populate_recordset(PG_FUNCTION_ARGS); +extern Datum json_typeof(PG_FUNCTION_ARGS); +extern Datum json_array_elements_text(PG_FUNCTION_ARGS); +extern Datum ordered_set_transition(PG_FUNCTION_ARGS); +extern Datum ordered_set_transition_multi(PG_FUNCTION_ARGS); +extern Datum percentile_disc_final(PG_FUNCTION_ARGS); +extern Datum percentile_cont_float8_final(PG_FUNCTION_ARGS); +extern Datum percentile_cont_interval_final(PG_FUNCTION_ARGS); +extern Datum percentile_disc_multi_final(PG_FUNCTION_ARGS); +extern Datum percentile_cont_float8_multi_final(PG_FUNCTION_ARGS); +extern Datum percentile_cont_interval_multi_final(PG_FUNCTION_ARGS); +extern Datum mode_final(PG_FUNCTION_ARGS); +extern Datum hypothetical_rank_final(PG_FUNCTION_ARGS); +extern Datum hypothetical_percent_rank_final(PG_FUNCTION_ARGS); +extern Datum hypothetical_cume_dist_final(PG_FUNCTION_ARGS); +extern Datum hypothetical_dense_rank_final(PG_FUNCTION_ARGS); +extern Datum generate_series_int4_support(PG_FUNCTION_ARGS); +extern Datum generate_series_int8_support(PG_FUNCTION_ARGS); +extern Datum array_unnest_support(PG_FUNCTION_ARGS); +extern Datum gist_box_distance(PG_FUNCTION_ARGS); +extern Datum brin_summarize_range(PG_FUNCTION_ARGS); +extern Datum jsonpath_in(PG_FUNCTION_ARGS); +extern Datum jsonpath_recv(PG_FUNCTION_ARGS); +extern Datum jsonpath_out(PG_FUNCTION_ARGS); +extern Datum jsonpath_send(PG_FUNCTION_ARGS); +extern Datum jsonb_path_exists(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_array(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_first(PG_FUNCTION_ARGS); +extern Datum jsonb_path_match(PG_FUNCTION_ARGS); +extern Datum jsonb_path_exists_opr(PG_FUNCTION_ARGS); +extern Datum jsonb_path_match_opr(PG_FUNCTION_ARGS); +extern Datum brin_desummarize_range(PG_FUNCTION_ARGS); +extern Datum spg_quad_config(PG_FUNCTION_ARGS); +extern Datum spg_quad_choose(PG_FUNCTION_ARGS); +extern Datum spg_quad_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_quad_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_quad_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum spg_kd_config(PG_FUNCTION_ARGS); +extern Datum spg_kd_choose(PG_FUNCTION_ARGS); +extern Datum spg_kd_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_kd_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_text_config(PG_FUNCTION_ARGS); +extern Datum spg_text_choose(PG_FUNCTION_ARGS); +extern Datum spg_text_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_text_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_text_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum pg_sequence_last_value(PG_FUNCTION_ARGS); +extern Datum jsonb_ne(PG_FUNCTION_ARGS); +extern Datum jsonb_lt(PG_FUNCTION_ARGS); +extern Datum jsonb_gt(PG_FUNCTION_ARGS); +extern Datum jsonb_le(PG_FUNCTION_ARGS); +extern Datum jsonb_ge(PG_FUNCTION_ARGS); +extern Datum jsonb_eq(PG_FUNCTION_ARGS); +extern Datum jsonb_cmp(PG_FUNCTION_ARGS); +extern Datum jsonb_hash(PG_FUNCTION_ARGS); +extern Datum jsonb_contains(PG_FUNCTION_ARGS); +extern Datum jsonb_exists(PG_FUNCTION_ARGS); +extern Datum jsonb_exists_any(PG_FUNCTION_ARGS); +extern Datum jsonb_exists_all(PG_FUNCTION_ARGS); +extern Datum jsonb_contained(PG_FUNCTION_ARGS); +extern Datum array_agg_array_transfn(PG_FUNCTION_ARGS); +extern Datum array_agg_array_finalfn(PG_FUNCTION_ARGS); +extern Datum range_merge(PG_FUNCTION_ARGS); +extern Datum inet_merge(PG_FUNCTION_ARGS); +extern Datum boxes_bound_box(PG_FUNCTION_ARGS); +extern Datum inet_same_family(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_record_init_privs(PG_FUNCTION_ARGS); +extern Datum regnamespacein(PG_FUNCTION_ARGS); +extern Datum regnamespaceout(PG_FUNCTION_ARGS); +extern Datum to_regnamespace(PG_FUNCTION_ARGS); +extern Datum regnamespacerecv(PG_FUNCTION_ARGS); +extern Datum regnamespacesend(PG_FUNCTION_ARGS); +extern Datum point_box(PG_FUNCTION_ARGS); +extern Datum regroleout(PG_FUNCTION_ARGS); +extern Datum to_regrole(PG_FUNCTION_ARGS); +extern Datum regrolerecv(PG_FUNCTION_ARGS); +extern Datum regrolesend(PG_FUNCTION_ARGS); +extern Datum regrolein(PG_FUNCTION_ARGS); +extern Datum pg_numa_available(PG_FUNCTION_ARGS); +extern Datum pg_get_shmem_allocations_numa(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_missing_value(PG_FUNCTION_ARGS); +extern Datum brin_inclusion_opcinfo(PG_FUNCTION_ARGS); +extern Datum brin_inclusion_add_value(PG_FUNCTION_ARGS); +extern Datum brin_inclusion_consistent(PG_FUNCTION_ARGS); +extern Datum brin_inclusion_union(PG_FUNCTION_ARGS); +extern Datum macaddr8_in(PG_FUNCTION_ARGS); +extern Datum macaddr8_out(PG_FUNCTION_ARGS); +extern Datum macaddr8_trunc(PG_FUNCTION_ARGS); +extern Datum macaddr8_eq(PG_FUNCTION_ARGS); +extern Datum macaddr8_lt(PG_FUNCTION_ARGS); +extern Datum macaddr8_le(PG_FUNCTION_ARGS); +extern Datum macaddr8_gt(PG_FUNCTION_ARGS); +extern Datum macaddr8_ge(PG_FUNCTION_ARGS); +extern Datum macaddr8_ne(PG_FUNCTION_ARGS); +extern Datum macaddr8_cmp(PG_FUNCTION_ARGS); +extern Datum macaddr8_not(PG_FUNCTION_ARGS); +extern Datum macaddr8_and(PG_FUNCTION_ARGS); +extern Datum macaddr8_or(PG_FUNCTION_ARGS); +extern Datum macaddrtomacaddr8(PG_FUNCTION_ARGS); +extern Datum macaddr8tomacaddr(PG_FUNCTION_ARGS); +extern Datum macaddr8_set7bit(PG_FUNCTION_ARGS); +extern Datum in_range_int8_int8(PG_FUNCTION_ARGS); +extern Datum in_range_int4_int8(PG_FUNCTION_ARGS); +extern Datum in_range_int4_int4(PG_FUNCTION_ARGS); +extern Datum in_range_int4_int2(PG_FUNCTION_ARGS); +extern Datum in_range_int2_int8(PG_FUNCTION_ARGS); +extern Datum in_range_int2_int4(PG_FUNCTION_ARGS); +extern Datum in_range_int2_int2(PG_FUNCTION_ARGS); +extern Datum in_range_date_interval(PG_FUNCTION_ARGS); +extern Datum in_range_timestamp_interval(PG_FUNCTION_ARGS); +extern Datum in_range_timestamptz_interval(PG_FUNCTION_ARGS); +extern Datum in_range_interval_interval(PG_FUNCTION_ARGS); +extern Datum in_range_time_interval(PG_FUNCTION_ARGS); +extern Datum in_range_timetz_interval(PG_FUNCTION_ARGS); +extern Datum in_range_float8_float8(PG_FUNCTION_ARGS); +extern Datum in_range_float4_float8(PG_FUNCTION_ARGS); +extern Datum in_range_numeric_numeric(PG_FUNCTION_ARGS); +extern Datum pg_lsn_larger(PG_FUNCTION_ARGS); +extern Datum pg_lsn_smaller(PG_FUNCTION_ARGS); +extern Datum regcollationin(PG_FUNCTION_ARGS); +extern Datum regcollationout(PG_FUNCTION_ARGS); +extern Datum to_regcollation(PG_FUNCTION_ARGS); +extern Datum regcollationrecv(PG_FUNCTION_ARGS); +extern Datum regcollationsend(PG_FUNCTION_ARGS); +extern Datum ts_headline_jsonb_byid_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_jsonb_byid(PG_FUNCTION_ARGS); +extern Datum ts_headline_jsonb_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_jsonb(PG_FUNCTION_ARGS); +extern Datum ts_headline_json_byid_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_json_byid(PG_FUNCTION_ARGS); +extern Datum ts_headline_json_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_json(PG_FUNCTION_ARGS); +extern Datum jsonb_string_to_tsvector(PG_FUNCTION_ARGS); +extern Datum json_string_to_tsvector(PG_FUNCTION_ARGS); +extern Datum jsonb_string_to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum json_string_to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum jsonb_to_tsvector(PG_FUNCTION_ARGS); +extern Datum jsonb_to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum json_to_tsvector(PG_FUNCTION_ARGS); +extern Datum json_to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum pg_copy_physical_replication_slot_a(PG_FUNCTION_ARGS); +extern Datum pg_copy_physical_replication_slot_b(PG_FUNCTION_ARGS); +extern Datum pg_copy_logical_replication_slot_a(PG_FUNCTION_ARGS); +extern Datum pg_copy_logical_replication_slot_b(PG_FUNCTION_ARGS); +extern Datum pg_copy_logical_replication_slot_c(PG_FUNCTION_ARGS); +extern Datum anycompatiblemultirange_in(PG_FUNCTION_ARGS); +extern Datum anycompatiblemultirange_out(PG_FUNCTION_ARGS); +extern Datum range_merge_from_multirange(PG_FUNCTION_ARGS); +extern Datum anymultirange_in(PG_FUNCTION_ARGS); +extern Datum anymultirange_out(PG_FUNCTION_ARGS); +extern Datum multirange_in(PG_FUNCTION_ARGS); +extern Datum multirange_out(PG_FUNCTION_ARGS); +extern Datum multirange_recv(PG_FUNCTION_ARGS); +extern Datum multirange_send(PG_FUNCTION_ARGS); +extern Datum multirange_lower(PG_FUNCTION_ARGS); +extern Datum multirange_upper(PG_FUNCTION_ARGS); +extern Datum multirange_empty(PG_FUNCTION_ARGS); +extern Datum multirange_lower_inc(PG_FUNCTION_ARGS); +extern Datum multirange_upper_inc(PG_FUNCTION_ARGS); +extern Datum multirange_lower_inf(PG_FUNCTION_ARGS); +extern Datum multirange_upper_inf(PG_FUNCTION_ARGS); +extern Datum multirange_typanalyze(PG_FUNCTION_ARGS); +extern Datum multirangesel(PG_FUNCTION_ARGS); +extern Datum multirange_eq(PG_FUNCTION_ARGS); +extern Datum multirange_ne(PG_FUNCTION_ARGS); +extern Datum range_overlaps_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_overlaps_range(PG_FUNCTION_ARGS); +extern Datum multirange_overlaps_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_contains_elem(PG_FUNCTION_ARGS); +extern Datum multirange_contains_range(PG_FUNCTION_ARGS); +extern Datum multirange_contains_multirange(PG_FUNCTION_ARGS); +extern Datum elem_contained_by_multirange(PG_FUNCTION_ARGS); +extern Datum range_contained_by_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_contained_by_multirange(PG_FUNCTION_ARGS); +extern Datum range_adjacent_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_adjacent_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_adjacent_range(PG_FUNCTION_ARGS); +extern Datum range_before_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_before_range(PG_FUNCTION_ARGS); +extern Datum multirange_before_multirange(PG_FUNCTION_ARGS); +extern Datum range_after_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_after_range(PG_FUNCTION_ARGS); +extern Datum multirange_after_multirange(PG_FUNCTION_ARGS); +extern Datum range_overleft_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_overleft_range(PG_FUNCTION_ARGS); +extern Datum multirange_overleft_multirange(PG_FUNCTION_ARGS); +extern Datum range_overright_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_overright_range(PG_FUNCTION_ARGS); +extern Datum multirange_overright_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_union(PG_FUNCTION_ARGS); +extern Datum multirange_minus(PG_FUNCTION_ARGS); +extern Datum multirange_intersect(PG_FUNCTION_ARGS); +extern Datum multirange_cmp(PG_FUNCTION_ARGS); +extern Datum multirange_lt(PG_FUNCTION_ARGS); +extern Datum multirange_le(PG_FUNCTION_ARGS); +extern Datum multirange_ge(PG_FUNCTION_ARGS); +extern Datum multirange_gt(PG_FUNCTION_ARGS); +extern Datum hash_multirange(PG_FUNCTION_ARGS); +extern Datum hash_multirange_extended(PG_FUNCTION_ARGS); +extern Datum multirange_constructor0(PG_FUNCTION_ARGS); +extern Datum multirange_constructor1(PG_FUNCTION_ARGS); +extern Datum multirange_constructor2(PG_FUNCTION_ARGS); +extern Datum range_agg_transfn(PG_FUNCTION_ARGS); +extern Datum range_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum unicode_normalize_func(PG_FUNCTION_ARGS); +extern Datum unicode_is_normalized(PG_FUNCTION_ARGS); +extern Datum multirange_intersect_agg_transfn(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_multirange_pg_type_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_multirange_array_pg_type_oid(PG_FUNCTION_ARGS); +extern Datum range_intersect_agg_transfn(PG_FUNCTION_ARGS); +extern Datum range_contains_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_contained_by_range(PG_FUNCTION_ARGS); +extern Datum pg_log_backend_memory_contexts(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_heap_relfilenode(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_index_relfilenode(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_toast_relfilenode(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_pg_tablespace_oid(PG_FUNCTION_ARGS); +extern Datum unicode_version(PG_FUNCTION_ARGS); +extern Datum pg_event_trigger_table_rewrite_oid(PG_FUNCTION_ARGS); +extern Datum pg_event_trigger_table_rewrite_reason(PG_FUNCTION_ARGS); +extern Datum pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS); +extern Datum brin_bloom_opcinfo(PG_FUNCTION_ARGS); +extern Datum brin_bloom_add_value(PG_FUNCTION_ARGS); +extern Datum brin_bloom_consistent(PG_FUNCTION_ARGS); +extern Datum brin_bloom_union(PG_FUNCTION_ARGS); +extern Datum brin_bloom_options(PG_FUNCTION_ARGS); +extern Datum brin_bloom_summary_in(PG_FUNCTION_ARGS); +extern Datum brin_bloom_summary_out(PG_FUNCTION_ARGS); +extern Datum brin_bloom_summary_recv(PG_FUNCTION_ARGS); +extern Datum brin_bloom_summary_send(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_opcinfo(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_add_value(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_consistent(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_union(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_options(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_int2(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_int4(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_int8(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_float4(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_float8(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_numeric(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_tid(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_uuid(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_date(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_time(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_interval(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_timetz(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_pg_lsn(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_macaddr(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_macaddr8(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_inet(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_timestamp(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_summary_in(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_summary_out(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_summary_recv(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_summary_send(PG_FUNCTION_ARGS); +extern Datum phraseto_tsquery(PG_FUNCTION_ARGS); +extern Datum tsquery_phrase(PG_FUNCTION_ARGS); +extern Datum tsquery_phrase_distance(PG_FUNCTION_ARGS); +extern Datum phraseto_tsquery_byid(PG_FUNCTION_ARGS); +extern Datum websearch_to_tsquery_byid(PG_FUNCTION_ARGS); +extern Datum websearch_to_tsquery(PG_FUNCTION_ARGS); +extern Datum spg_bbox_quad_config(PG_FUNCTION_ARGS); +extern Datum spg_poly_quad_compress(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_config(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_choose(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum pg_mcv_list_in(PG_FUNCTION_ARGS); +extern Datum pg_mcv_list_out(PG_FUNCTION_ARGS); +extern Datum pg_mcv_list_recv(PG_FUNCTION_ARGS); +extern Datum pg_mcv_list_send(PG_FUNCTION_ARGS); +extern Datum pg_lsn_pli(PG_FUNCTION_ARGS); +extern Datum pg_lsn_mii(PG_FUNCTION_ARGS); +extern Datum satisfies_hash_partition(PG_FUNCTION_ARGS); +extern Datum pg_ls_tmpdir_noargs(PG_FUNCTION_ARGS); +extern Datum pg_ls_tmpdir_1arg(PG_FUNCTION_ARGS); +extern Datum pg_ls_archive_statusdir(PG_FUNCTION_ARGS); +extern Datum network_sortsupport(PG_FUNCTION_ARGS); +extern Datum xid8lt(PG_FUNCTION_ARGS); +extern Datum xid8gt(PG_FUNCTION_ARGS); +extern Datum xid8le(PG_FUNCTION_ARGS); +extern Datum xid8ge(PG_FUNCTION_ARGS); +extern Datum matchingsel(PG_FUNCTION_ARGS); +extern Datum matchingjoinsel(PG_FUNCTION_ARGS); +extern Datum numeric_min_scale(PG_FUNCTION_ARGS); +extern Datum numeric_trim_scale(PG_FUNCTION_ARGS); +extern Datum int4gcd(PG_FUNCTION_ARGS); +extern Datum int8gcd(PG_FUNCTION_ARGS); +extern Datum int4lcm(PG_FUNCTION_ARGS); +extern Datum int8lcm(PG_FUNCTION_ARGS); +extern Datum numeric_gcd(PG_FUNCTION_ARGS); +extern Datum numeric_lcm(PG_FUNCTION_ARGS); +extern Datum btvarstrequalimage(PG_FUNCTION_ARGS); +extern Datum btequalimage(PG_FUNCTION_ARGS); +extern Datum pg_get_shmem_allocations(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_ins_since_vacuum(PG_FUNCTION_ARGS); +extern Datum jsonb_set_lax(PG_FUNCTION_ARGS); +extern Datum xid8in(PG_FUNCTION_ARGS); +extern Datum xid8toxid(PG_FUNCTION_ARGS); +extern Datum xid8out(PG_FUNCTION_ARGS); +extern Datum xid8recv(PG_FUNCTION_ARGS); +extern Datum xid8send(PG_FUNCTION_ARGS); +extern Datum xid8eq(PG_FUNCTION_ARGS); +extern Datum xid8ne(PG_FUNCTION_ARGS); +extern Datum anycompatible_in(PG_FUNCTION_ARGS); +extern Datum anycompatible_out(PG_FUNCTION_ARGS); +extern Datum anycompatiblearray_in(PG_FUNCTION_ARGS); +extern Datum anycompatiblearray_out(PG_FUNCTION_ARGS); +extern Datum anycompatiblearray_recv(PG_FUNCTION_ARGS); +extern Datum anycompatiblearray_send(PG_FUNCTION_ARGS); +extern Datum anycompatiblenonarray_in(PG_FUNCTION_ARGS); +extern Datum anycompatiblenonarray_out(PG_FUNCTION_ARGS); +extern Datum anycompatiblerange_in(PG_FUNCTION_ARGS); +extern Datum anycompatiblerange_out(PG_FUNCTION_ARGS); +extern Datum xid8cmp(PG_FUNCTION_ARGS); +extern Datum xid8_larger(PG_FUNCTION_ARGS); +extern Datum xid8_smaller(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_create(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_drop(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_oid(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_session_setup(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_session_reset(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_session_is_setup(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_session_progress(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_xact_setup(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_xact_reset(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_advance(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_progress(PG_FUNCTION_ARGS); +extern Datum pg_show_replication_origin_status(PG_FUNCTION_ARGS); +extern Datum jsonb_subscript_handler(PG_FUNCTION_ARGS); +extern Datum icu_unicode_version(PG_FUNCTION_ARGS); +extern Datum numeric_pg_lsn(PG_FUNCTION_ARGS); +extern Datum unicode_assigned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_subxact(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_subscription(PG_FUNCTION_ARGS); +extern Datum pg_get_publication_tables(PG_FUNCTION_ARGS); +extern Datum pg_get_replica_identity_index(PG_FUNCTION_ARGS); +extern Datum pg_relation_is_publishable(PG_FUNCTION_ARGS); +extern Datum multirange_gist_consistent(PG_FUNCTION_ARGS); +extern Datum multirange_gist_compress(PG_FUNCTION_ARGS); +extern Datum pg_get_catalog_foreign_keys(PG_FUNCTION_ARGS); +extern Datum text_to_table(PG_FUNCTION_ARGS); +extern Datum text_to_table_null(PG_FUNCTION_ARGS); +extern Datum bit_bit_count(PG_FUNCTION_ARGS); +extern Datum bytea_bit_count(PG_FUNCTION_ARGS); +extern Datum pg_xact_commit_timestamp_origin(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_replication_slot(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_replication_slot(PG_FUNCTION_ARGS); +extern Datum trim_array(PG_FUNCTION_ARGS); +extern Datum pg_get_statisticsobjdef_expressions(PG_FUNCTION_ARGS); +extern Datum pg_get_statisticsobjdef_columns(PG_FUNCTION_ARGS); +extern Datum timestamp_bin(PG_FUNCTION_ARGS); +extern Datum timestamptz_bin(PG_FUNCTION_ARGS); +extern Datum array_subscript_handler(PG_FUNCTION_ARGS); +extern Datum raw_array_subscript_handler(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_session_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_active_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_idle_in_transaction_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_sessions(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_sessions_abandoned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_sessions_fatal(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_sessions_killed(PG_FUNCTION_ARGS); +extern Datum hash_record(PG_FUNCTION_ARGS); +extern Datum hash_record_extended(PG_FUNCTION_ARGS); +extern Datum bytealtrim(PG_FUNCTION_ARGS); +extern Datum byteartrim(PG_FUNCTION_ARGS); +extern Datum pg_get_function_sqlbody(PG_FUNCTION_ARGS); +extern Datum unistr(PG_FUNCTION_ARGS); +extern Datum extract_date(PG_FUNCTION_ARGS); +extern Datum extract_time(PG_FUNCTION_ARGS); +extern Datum extract_timetz(PG_FUNCTION_ARGS); +extern Datum extract_timestamp(PG_FUNCTION_ARGS); +extern Datum extract_timestamptz(PG_FUNCTION_ARGS); +extern Datum extract_interval(PG_FUNCTION_ARGS); +extern Datum has_parameter_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_parameter_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_parameter_privilege_name(PG_FUNCTION_ARGS); +extern Datum pg_read_file_all_missing(PG_FUNCTION_ARGS); +extern Datum pg_read_binary_file_all_missing(PG_FUNCTION_ARGS); +extern Datum pg_input_is_valid(PG_FUNCTION_ARGS); +extern Datum pg_input_error_info(PG_FUNCTION_ARGS); +extern Datum drandom_normal(PG_FUNCTION_ARGS); +extern Datum pg_split_walfile_name(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_io(PG_FUNCTION_ARGS); +extern Datum array_shuffle(PG_FUNCTION_ARGS); +extern Datum array_sample(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_newpage_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_newpage_updated(PG_FUNCTION_ARGS); +extern Datum derf(PG_FUNCTION_ARGS); +extern Datum derfc(PG_FUNCTION_ARGS); +extern Datum timestamptz_pl_interval_at_zone(PG_FUNCTION_ARGS); +extern Datum pg_get_wal_resource_managers(PG_FUNCTION_ARGS); +extern Datum multirange_agg_transfn(PG_FUNCTION_ARGS); +extern Datum pg_stat_have_stats(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_subscription_stats(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_subscription_stats(PG_FUNCTION_ARGS); +extern Datum window_row_number_support(PG_FUNCTION_ARGS); +extern Datum window_rank_support(PG_FUNCTION_ARGS); +extern Datum window_dense_rank_support(PG_FUNCTION_ARGS); +extern Datum int8inc_support(PG_FUNCTION_ARGS); +extern Datum pg_settings_get_flags(PG_FUNCTION_ARGS); +extern Datum pg_stop_making_pinned_objects(PG_FUNCTION_ARGS); +extern Datum text_starts_with_support(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_recovery_prefetch(PG_FUNCTION_ARGS); +extern Datum pg_database_collation_actual_version(PG_FUNCTION_ARGS); +extern Datum pg_ident_file_mappings(PG_FUNCTION_ARGS); +extern Datum textregexreplace_extended(PG_FUNCTION_ARGS); +extern Datum textregexreplace_extended_no_flags(PG_FUNCTION_ARGS); +extern Datum textregexreplace_extended_no_n(PG_FUNCTION_ARGS); +extern Datum regexp_count_no_start(PG_FUNCTION_ARGS); +extern Datum regexp_count_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_count(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_start(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_n(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_endoption(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_subexpr(PG_FUNCTION_ARGS); +extern Datum regexp_instr(PG_FUNCTION_ARGS); +extern Datum regexp_like_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_like(PG_FUNCTION_ARGS); +extern Datum regexp_substr_no_start(PG_FUNCTION_ARGS); +extern Datum regexp_substr_no_n(PG_FUNCTION_ARGS); +extern Datum regexp_substr_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_substr_no_subexpr(PG_FUNCTION_ARGS); +extern Datum regexp_substr(PG_FUNCTION_ARGS); +extern Datum pg_ls_logicalsnapdir(PG_FUNCTION_ARGS); +extern Datum pg_ls_logicalmapdir(PG_FUNCTION_ARGS); +extern Datum pg_ls_replslotdir(PG_FUNCTION_ARGS); +extern Datum timestamptz_mi_interval_at_zone(PG_FUNCTION_ARGS); +extern Datum generate_series_timestamptz_at_zone(PG_FUNCTION_ARGS); +extern Datum json_agg_strict_transfn(PG_FUNCTION_ARGS); +extern Datum json_object_agg_strict_transfn(PG_FUNCTION_ARGS); +extern Datum json_object_agg_unique_transfn(PG_FUNCTION_ARGS); +extern Datum json_object_agg_unique_strict_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_agg_strict_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_strict_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_unique_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_unique_strict_transfn(PG_FUNCTION_ARGS); +extern Datum any_value_transfn(PG_FUNCTION_ARGS); +extern Datum array_agg_combine(PG_FUNCTION_ARGS); +extern Datum array_agg_serialize(PG_FUNCTION_ARGS); +extern Datum array_agg_deserialize(PG_FUNCTION_ARGS); +extern Datum array_agg_array_combine(PG_FUNCTION_ARGS); +extern Datum array_agg_array_serialize(PG_FUNCTION_ARGS); +extern Datum array_agg_array_deserialize(PG_FUNCTION_ARGS); +extern Datum string_agg_combine(PG_FUNCTION_ARGS); +extern Datum string_agg_serialize(PG_FUNCTION_ARGS); +extern Datum string_agg_deserialize(PG_FUNCTION_ARGS); +extern Datum pg_log_standby_snapshot(PG_FUNCTION_ARGS); +extern Datum window_percent_rank_support(PG_FUNCTION_ARGS); +extern Datum window_cume_dist_support(PG_FUNCTION_ARGS); +extern Datum window_ntile_support(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_logicalslot(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_lastscan(PG_FUNCTION_ARGS); +extern Datum system_user(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_logical_slot_has_caught_up(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_wal(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_stat_reset_time(PG_FUNCTION_ARGS); +extern Datum pg_basetype(PG_FUNCTION_ARGS); +extern Datum pg_column_toast_chunk_id(PG_FUNCTION_ARGS); +extern Datum to_regtypemod(PG_FUNCTION_ARGS); +extern Datum pg_get_wait_events(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_add_sub_rel_state(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_replorigin_advance(PG_FUNCTION_ARGS); +extern Datum pg_available_wal_summaries(PG_FUNCTION_ARGS); +extern Datum pg_wal_summary_contents(PG_FUNCTION_ARGS); +extern Datum pg_get_wal_summarizer_state(PG_FUNCTION_ARGS); +extern Datum interval_avg_serialize(PG_FUNCTION_ARGS); +extern Datum interval_avg_deserialize(PG_FUNCTION_ARGS); +extern Datum interval_sum(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_restartpoints_timed(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_restartpoints_requested(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_restartpoints_performed(PG_FUNCTION_ARGS); +extern Datum to_bin32(PG_FUNCTION_ARGS); +extern Datum to_bin64(PG_FUNCTION_ARGS); +extern Datum to_oct32(PG_FUNCTION_ARGS); +extern Datum to_oct64(PG_FUNCTION_ARGS); +extern Datum timestamptz_at_local(PG_FUNCTION_ARGS); +extern Datum timestamp_at_local(PG_FUNCTION_ARGS); +extern Datum timetz_at_local(PG_FUNCTION_ARGS); +extern Datum jsonb_populate_record_valid(PG_FUNCTION_ARGS); +extern Datum int4random(PG_FUNCTION_ARGS); +extern Datum int8random(PG_FUNCTION_ARGS); +extern Datum numeric_random(PG_FUNCTION_ARGS); +extern Datum uuid_extract_timestamp(PG_FUNCTION_ARGS); +extern Datum uuid_extract_version(PG_FUNCTION_ARGS); +extern Datum pg_sync_replication_slots(PG_FUNCTION_ARGS); +extern Datum range_contains_elem_support(PG_FUNCTION_ARGS); +extern Datum elem_contained_by_range_support(PG_FUNCTION_ARGS); +extern Datum gist_translate_cmptype_common(PG_FUNCTION_ARGS); +extern Datum has_largeobject_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_largeobject_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_largeobject_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum pg_get_loaded_modules(PG_FUNCTION_ARGS); +extern Datum generate_series_timestamp_support(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_parallel_workers_to_launch(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_parallel_workers_launched(PG_FUNCTION_ARGS); +extern Datum generate_series_numeric_support(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_total_vacuum_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_total_autovacuum_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_total_analyze_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_total_autoanalyze_time(PG_FUNCTION_ARGS); +extern Datum pg_restore_relation_stats(PG_FUNCTION_ARGS); +extern Datum pg_restore_attribute_stats(PG_FUNCTION_ARGS); +extern Datum crc32_bytea(PG_FUNCTION_ARGS); +extern Datum crc32c_bytea(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_slru_written(PG_FUNCTION_ARGS); +extern Datum int2_bytea(PG_FUNCTION_ARGS); +extern Datum int4_bytea(PG_FUNCTION_ARGS); +extern Datum int8_bytea(PG_FUNCTION_ARGS); +extern Datum bytea_int2(PG_FUNCTION_ARGS); +extern Datum bytea_int4(PG_FUNCTION_ARGS); +extern Datum bytea_int8(PG_FUNCTION_ARGS); +extern Datum record_larger(PG_FUNCTION_ARGS); +extern Datum record_smaller(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_num_performed(PG_FUNCTION_ARGS); +extern Datum array_append_support(PG_FUNCTION_ARGS); +extern Datum array_prepend_support(PG_FUNCTION_ARGS); +extern Datum array_subscript_handler_support(PG_FUNCTION_ARGS); +extern Datum array_reverse(PG_FUNCTION_ARGS); +extern Datum bytea_reverse(PG_FUNCTION_ARGS); +extern Datum dgamma(PG_FUNCTION_ARGS); +extern Datum dlgamma(PG_FUNCTION_ARGS); +extern Datum pg_get_acl(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_io(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_backend_stats(PG_FUNCTION_ARGS); +extern Datum array_sort(PG_FUNCTION_ARGS); +extern Datum array_sort_order(PG_FUNCTION_ARGS); +extern Datum array_sort_order_nulls_first(PG_FUNCTION_ARGS); +extern Datum range_sortsupport(PG_FUNCTION_ARGS); +extern Datum bytea_larger(PG_FUNCTION_ARGS); +extern Datum bytea_smaller(PG_FUNCTION_ARGS); +extern Datum pg_clear_relation_stats(PG_FUNCTION_ARGS); +extern Datum pg_clear_attribute_stats(PG_FUNCTION_ARGS); +extern Datum pg_get_aios(PG_FUNCTION_ARGS); +extern Datum pg_ls_summariesdir(PG_FUNCTION_ARGS); +extern Datum pg_timezone_abbrevs_zone(PG_FUNCTION_ARGS); +extern Datum btint2skipsupport(PG_FUNCTION_ARGS); +extern Datum btint4skipsupport(PG_FUNCTION_ARGS); +extern Datum btint8skipsupport(PG_FUNCTION_ARGS); +extern Datum btoidskipsupport(PG_FUNCTION_ARGS); +extern Datum btcharskipsupport(PG_FUNCTION_ARGS); +extern Datum date_skipsupport(PG_FUNCTION_ARGS); +extern Datum btboolskipsupport(PG_FUNCTION_ARGS); +extern Datum timestamp_skipsupport(PG_FUNCTION_ARGS); +extern Datum uuid_skipsupport(PG_FUNCTION_ARGS); +extern Datum casefold(PG_FUNCTION_ARGS); +extern Datum hashbytea(PG_FUNCTION_ARGS); +extern Datum hashbyteaextended(PG_FUNCTION_ARGS); +extern Datum hashdate(PG_FUNCTION_ARGS); +extern Datum hashdateextended(PG_FUNCTION_ARGS); +extern Datum hashbool(PG_FUNCTION_ARGS); +extern Datum hashboolextended(PG_FUNCTION_ARGS); +extern Datum hashxid(PG_FUNCTION_ARGS); +extern Datum hashxidextended(PG_FUNCTION_ARGS); +extern Datum hashxid8(PG_FUNCTION_ARGS); +extern Datum hashxid8extended(PG_FUNCTION_ARGS); +extern Datum hashcid(PG_FUNCTION_ARGS); +extern Datum hashcidextended(PG_FUNCTION_ARGS); +extern Datum timestamptz_hash(PG_FUNCTION_ARGS); +extern Datum timestamptz_hash_extended(PG_FUNCTION_ARGS); +extern Datum pg_get_sequence_data(PG_FUNCTION_ARGS); +extern Datum uuidv7(PG_FUNCTION_ARGS); +extern Datum uuidv7_interval(PG_FUNCTION_ARGS); + +#endif /* FMGRPROTOS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/fmgrtab.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/fmgrtab.h new file mode 100644 index 0000000..8d43583 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/fmgrtab.h @@ -0,0 +1,49 @@ +/*------------------------------------------------------------------------- + * + * fmgrtab.h + * The function manager's table of internal functions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/fmgrtab.h + * + *------------------------------------------------------------------------- + */ +#ifndef FMGRTAB_H +#define FMGRTAB_H + +#include "access/transam.h" +#include "fmgr.h" + + +/* + * This table stores info about all the built-in functions (ie, functions + * that are compiled into the Postgres executable). + */ + +typedef struct +{ + Oid foid; /* OID of the function */ + short nargs; /* 0..FUNC_MAX_ARGS, or -1 if variable count */ + bool strict; /* T if function is "strict" */ + bool retset; /* T if function returns a set */ + const char *funcName; /* C name of the function */ + PGFunction func; /* pointer to compiled function */ +} FmgrBuiltin; + +extern PGDLLIMPORT const FmgrBuiltin fmgr_builtins[]; + +extern PGDLLIMPORT const int fmgr_nbuiltins; /* number of entries in table */ + +extern PGDLLIMPORT const Oid fmgr_last_builtin_oid; /* highest function OID in + * table */ + +/* + * Mapping from a builtin function's OID to its index in the fmgr_builtins + * array. This is indexed from 0 through fmgr_last_builtin_oid. + */ +#define InvalidOidBuiltinMapping PG_UINT16_MAX +extern PGDLLIMPORT const uint16 fmgr_builtin_oid_index[]; + +#endif /* FMGRTAB_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/formatting.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/formatting.h new file mode 100644 index 0000000..835307d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/formatting.h @@ -0,0 +1,35 @@ +/* ----------------------------------------------------------------------- + * formatting.h + * + * src/include/utils/formatting.h + * + * + * Portions Copyright (c) 1999-2025, PostgreSQL Global Development Group + * + * The PostgreSQL routines for a DateTime/int/float/numeric formatting, + * inspired by the Oracle TO_CHAR() / TO_DATE() / TO_NUMBER() routines. + * + * Karel Zak + * + * ----------------------------------------------------------------------- + */ + +#ifndef _FORMATTING_H_ +#define _FORMATTING_H_ + + +extern char *str_tolower(const char *buff, size_t nbytes, Oid collid); +extern char *str_toupper(const char *buff, size_t nbytes, Oid collid); +extern char *str_initcap(const char *buff, size_t nbytes, Oid collid); +extern char *str_casefold(const char *buff, size_t nbytes, Oid collid); + +extern char *asc_tolower(const char *buff, size_t nbytes); +extern char *asc_toupper(const char *buff, size_t nbytes); +extern char *asc_initcap(const char *buff, size_t nbytes); + +extern Datum parse_datetime(text *date_txt, text *fmt, Oid collid, bool strict, + Oid *typid, int32 *typmod, int *tz, + struct Node *escontext); +extern bool datetime_format_has_tz(const char *fmt_str); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/freepage.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/freepage.h new file mode 100644 index 0000000..18643a8 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/freepage.h @@ -0,0 +1,99 @@ +/*------------------------------------------------------------------------- + * + * freepage.h + * Management of page-organized free memory. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/freepage.h + * + *------------------------------------------------------------------------- + */ + +#ifndef FREEPAGE_H +#define FREEPAGE_H + +#include "storage/lwlock.h" +#include "utils/relptr.h" + +/* Forward declarations. */ +typedef struct FreePageSpanLeader FreePageSpanLeader; +typedef struct FreePageBtree FreePageBtree; +typedef struct FreePageManager FreePageManager; + +/* + * PostgreSQL normally uses 8kB pages for most things, but many common + * architecture/operating system pairings use a 4kB page size for memory + * allocation, so we do that here also. + */ +#define FPM_PAGE_SIZE 4096 + +/* + * Each freelist except for the last contains only spans of one particular + * size. Everything larger goes on the last one. In some sense this seems + * like a waste since most allocations are in a few common sizes, but it + * means that small allocations can simply pop the head of the relevant list + * without needing to worry about whether the object we find there is of + * precisely the correct size (because we know it must be). + */ +#define FPM_NUM_FREELISTS 129 + +/* Define relative pointer types. */ +relptr_declare(FreePageBtree, RelptrFreePageBtree); +relptr_declare(FreePageManager, RelptrFreePageManager); +relptr_declare(FreePageSpanLeader, RelptrFreePageSpanLeader); + +/* Everything we need in order to manage free pages (see freepage.c) */ +struct FreePageManager +{ + RelptrFreePageManager self; + RelptrFreePageBtree btree_root; + RelptrFreePageSpanLeader btree_recycle; + unsigned btree_depth; + unsigned btree_recycle_count; + Size singleton_first_page; + Size singleton_npages; + Size contiguous_pages; + bool contiguous_pages_dirty; + RelptrFreePageSpanLeader freelist[FPM_NUM_FREELISTS]; +#ifdef FPM_EXTRA_ASSERTS + /* For debugging only, pages put minus pages gotten. */ + Size free_pages; +#endif +}; + +/* Macros to convert between page numbers (expressed as Size) and pointers. */ +#define fpm_page_to_pointer(base, page) \ + (AssertVariableIsOfTypeMacro(page, Size), \ + (base) + FPM_PAGE_SIZE * (page)) +#define fpm_pointer_to_page(base, ptr) \ + (((Size) (((char *) (ptr)) - (base))) / FPM_PAGE_SIZE) + +/* Macro to convert an allocation size to a number of pages. */ +#define fpm_size_to_pages(sz) \ + (((sz) + FPM_PAGE_SIZE - 1) / FPM_PAGE_SIZE) + +/* Macros to check alignment of absolute and relative pointers. */ +#define fpm_pointer_is_page_aligned(base, ptr) \ + (((Size) (((char *) (ptr)) - (base))) % FPM_PAGE_SIZE == 0) +#define fpm_relptr_is_page_aligned(base, relptr) \ + (relptr_offset(relptr) % FPM_PAGE_SIZE == 0) + +/* Macro to find base address of the segment containing a FreePageManager. */ +#define fpm_segment_base(fpm) \ + (((char *) fpm) - relptr_offset(fpm->self)) + +/* Macro to access a FreePageManager's largest consecutive run of pages. */ +#define fpm_largest(fpm) \ + (fpm->contiguous_pages) + +/* Functions to manipulate the free page map. */ +extern void FreePageManagerInitialize(FreePageManager *fpm, char *base); +extern bool FreePageManagerGet(FreePageManager *fpm, Size npages, + Size *first_page); +extern void FreePageManagerPut(FreePageManager *fpm, Size first_page, + Size npages); +extern char *FreePageManagerDump(FreePageManager *fpm); + +#endif /* FREEPAGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/funccache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/funccache.h new file mode 100644 index 0000000..e0112eb --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/funccache.h @@ -0,0 +1,134 @@ +/*------------------------------------------------------------------------- + * + * funccache.h + * Function cache definitions. + * + * See funccache.c for comments. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/funccache.h + * + *------------------------------------------------------------------------- + */ +#ifndef FUNCCACHE_H +#define FUNCCACHE_H + +#include "access/htup_details.h" +#include "fmgr.h" +#include "storage/itemptr.h" + +struct CachedFunctionHashKey; /* forward references */ +struct CachedFunction; + +/* + * Callback that cached_function_compile() invokes when it's necessary to + * compile a cached function. The callback must fill in *function (except + * for the fields of struct CachedFunction), or throw an error if trouble. + * fcinfo: current call information + * procTup: function's pg_proc row from catcache + * hashkey: hash key that will be used for the function + * function: pre-zeroed workspace, of size passed to cached_function_compile() + * forValidator: passed through from cached_function_compile() + */ +typedef void (*CachedFunctionCompileCallback) (FunctionCallInfo fcinfo, + HeapTuple procTup, + const struct CachedFunctionHashKey *hashkey, + struct CachedFunction *function, + bool forValidator); + +/* + * Callback called when discarding a cache entry. Free any free-able + * subsidiary data of cfunc, but not the struct CachedFunction itself. + */ +typedef void (*CachedFunctionDeleteCallback) (struct CachedFunction *cfunc); + +/* + * Hash lookup key for functions. This must account for all aspects + * of a specific call that might lead to different data types or + * collations being used within the function. + */ +typedef struct CachedFunctionHashKey +{ + Oid funcOid; + + bool isTrigger; /* true if called as a DML trigger */ + bool isEventTrigger; /* true if called as an event trigger */ + + /* be careful that pad bytes in this struct get zeroed! */ + + /* + * We include the language-specific size of the function's cache entry in + * the cache key. This covers the case where CREATE OR REPLACE FUNCTION + * is used to change the implementation language, and the new language + * also uses funccache.c but needs a different-sized cache entry. + */ + Size cacheEntrySize; + + /* + * For a trigger function, the OID of the trigger is part of the hash key + * --- we want to compile the trigger function separately for each trigger + * it is used with, in case the rowtype or transition table names are + * different. Zero if not called as a DML trigger. + */ + Oid trigOid; + + /* + * We must include the input collation as part of the hash key too, + * because we have to generate different plans (with different Param + * collations) for different collation settings. + */ + Oid inputCollation; + + /* Number of arguments (counting input arguments only, ie pronargs) */ + int nargs; + + /* If you change anything below here, fix hashing code in funccache.c! */ + + /* + * If relevant, the result descriptor for a function returning composite. + */ + TupleDesc callResultType; + + /* + * Input argument types, with any polymorphic types resolved to actual + * types. Only the first nargs entries are valid. + */ + Oid argtypes[FUNC_MAX_ARGS]; +} CachedFunctionHashKey; + +/* + * Representation of a compiled function. This struct contains just the + * fields that funccache.c needs to deal with. It will typically be + * embedded in a larger struct containing function-language-specific data. + */ +typedef struct CachedFunction +{ + /* back-link to hashtable entry, or NULL if not in hash table */ + CachedFunctionHashKey *fn_hashkey; + /* xmin and ctid of function's pg_proc row; used to detect invalidation */ + TransactionId fn_xmin; + ItemPointerData fn_tid; + /* deletion callback */ + CachedFunctionDeleteCallback dcallback; + + /* this field changes when the function is used: */ + uint64 use_count; +} CachedFunction; + +extern CachedFunction *cached_function_compile(FunctionCallInfo fcinfo, + CachedFunction *function, + CachedFunctionCompileCallback ccallback, + CachedFunctionDeleteCallback dcallback, + Size cacheEntrySize, + bool includeResultType, + bool forValidator); +extern void cfunc_resolve_polymorphic_argtypes(int numargs, + Oid *argtypes, + char *argmodes, + Node *call_expr, + bool forValidator, + const char *proname); + +#endif /* FUNCCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/geo_decls.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/geo_decls.h new file mode 100644 index 0000000..8a9df75 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/geo_decls.h @@ -0,0 +1,285 @@ +/*------------------------------------------------------------------------- + * + * geo_decls.h - Declarations for various 2D constructs. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/geo_decls.h + * + * XXX These routines were not written by a numerical analyst. + * + * XXX I have made some attempt to flesh out the operators + * and data types. There are still some more to do. - tgl 97/04/19 + * + *------------------------------------------------------------------------- + */ +#ifndef GEO_DECLS_H +#define GEO_DECLS_H + +#include + +#include "fmgr.h" + +/*-------------------------------------------------------------------- + * Useful floating point utilities and constants. + *-------------------------------------------------------------------- + * + * "Fuzzy" floating-point comparisons: values within EPSILON of each other + * are considered equal. Beware of normal reasoning about the behavior of + * these comparisons, since for example FPeq does not behave transitively. + * + * Note that these functions are not NaN-aware and will give FALSE for + * any case involving NaN inputs. + * + * Also note that these will give sane answers for infinite inputs, + * where it's important to avoid computing Inf minus Inf; we do so + * by eliminating equality cases before subtracting. + */ + +#define EPSILON 1.0E-06 + +#ifdef EPSILON +#define FPzero(A) (fabs(A) <= EPSILON) + +static inline bool +FPeq(double A, double B) +{ + return A == B || fabs(A - B) <= EPSILON; +} + +static inline bool +FPne(double A, double B) +{ + return A != B && fabs(A - B) > EPSILON; +} + +static inline bool +FPlt(double A, double B) +{ + return A + EPSILON < B; +} + +static inline bool +FPle(double A, double B) +{ + return A <= B + EPSILON; +} + +static inline bool +FPgt(double A, double B) +{ + return A > B + EPSILON; +} + +static inline bool +FPge(double A, double B) +{ + return A + EPSILON >= B; +} +#else +#define FPzero(A) ((A) == 0) +#define FPeq(A,B) ((A) == (B)) +#define FPne(A,B) ((A) != (B)) +#define FPlt(A,B) ((A) < (B)) +#define FPle(A,B) ((A) <= (B)) +#define FPgt(A,B) ((A) > (B)) +#define FPge(A,B) ((A) >= (B)) +#endif + +#define HYPOT(A, B) pg_hypot(A, B) + +/*--------------------------------------------------------------------- + * Point - (x,y) + *-------------------------------------------------------------------*/ +typedef struct +{ + float8 x, + y; +} Point; + + +/*--------------------------------------------------------------------- + * LSEG - A straight line, specified by endpoints. + *-------------------------------------------------------------------*/ +typedef struct +{ + Point p[2]; +} LSEG; + + +/*--------------------------------------------------------------------- + * PATH - Specified by vertex points. + *-------------------------------------------------------------------*/ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 npts; + int32 closed; /* is this a closed polygon? */ + int32 dummy; /* padding to make it double align */ + Point p[FLEXIBLE_ARRAY_MEMBER]; +} PATH; + + +/*--------------------------------------------------------------------- + * LINE - Specified by its general equation (Ax+By+C=0). + *-------------------------------------------------------------------*/ +typedef struct +{ + float8 A, + B, + C; +} LINE; + + +/*--------------------------------------------------------------------- + * BOX - Specified by two corner points, which are + * sorted to save calculation time later. + *-------------------------------------------------------------------*/ +typedef struct +{ + Point high, + low; /* corner POINTs */ +} BOX; + +/*--------------------------------------------------------------------- + * POLYGON - Specified by an array of doubles defining the points, + * keeping the number of points and the bounding box for + * speed purposes. + *-------------------------------------------------------------------*/ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 npts; + BOX boundbox; + Point p[FLEXIBLE_ARRAY_MEMBER]; +} POLYGON; + +/*--------------------------------------------------------------------- + * CIRCLE - Specified by a center point and radius. + *-------------------------------------------------------------------*/ +typedef struct +{ + Point center; + float8 radius; +} CIRCLE; + +/* + * fmgr interface functions + * + * Path and Polygon are toastable varlena types, the others are just + * fixed-size pass-by-reference types. + */ + +static inline Point * +DatumGetPointP(Datum X) +{ + return (Point *) DatumGetPointer(X); +} +static inline Datum +PointPGetDatum(const Point *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_POINT_P(n) DatumGetPointP(PG_GETARG_DATUM(n)) +#define PG_RETURN_POINT_P(x) return PointPGetDatum(x) + +static inline LSEG * +DatumGetLsegP(Datum X) +{ + return (LSEG *) DatumGetPointer(X); +} +static inline Datum +LsegPGetDatum(const LSEG *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_LSEG_P(n) DatumGetLsegP(PG_GETARG_DATUM(n)) +#define PG_RETURN_LSEG_P(x) return LsegPGetDatum(x) + +static inline PATH * +DatumGetPathP(Datum X) +{ + return (PATH *) PG_DETOAST_DATUM(X); +} +static inline PATH * +DatumGetPathPCopy(Datum X) +{ + return (PATH *) PG_DETOAST_DATUM_COPY(X); +} +static inline Datum +PathPGetDatum(const PATH *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_PATH_P(n) DatumGetPathP(PG_GETARG_DATUM(n)) +#define PG_GETARG_PATH_P_COPY(n) DatumGetPathPCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_PATH_P(x) return PathPGetDatum(x) + +static inline LINE * +DatumGetLineP(Datum X) +{ + return (LINE *) DatumGetPointer(X); +} +static inline Datum +LinePGetDatum(const LINE *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_LINE_P(n) DatumGetLineP(PG_GETARG_DATUM(n)) +#define PG_RETURN_LINE_P(x) return LinePGetDatum(x) + +static inline BOX * +DatumGetBoxP(Datum X) +{ + return (BOX *) DatumGetPointer(X); +} +static inline Datum +BoxPGetDatum(const BOX *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_BOX_P(n) DatumGetBoxP(PG_GETARG_DATUM(n)) +#define PG_RETURN_BOX_P(x) return BoxPGetDatum(x) + +static inline POLYGON * +DatumGetPolygonP(Datum X) +{ + return (POLYGON *) PG_DETOAST_DATUM(X); +} +static inline POLYGON * +DatumGetPolygonPCopy(Datum X) +{ + return (POLYGON *) PG_DETOAST_DATUM_COPY(X); +} +static inline Datum +PolygonPGetDatum(const POLYGON *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_POLYGON_P(n) DatumGetPolygonP(PG_GETARG_DATUM(n)) +#define PG_GETARG_POLYGON_P_COPY(n) DatumGetPolygonPCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_POLYGON_P(x) return PolygonPGetDatum(x) + +static inline CIRCLE * +DatumGetCircleP(Datum X) +{ + return (CIRCLE *) DatumGetPointer(X); +} +static inline Datum +CirclePGetDatum(const CIRCLE *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_CIRCLE_P(n) DatumGetCircleP(PG_GETARG_DATUM(n)) +#define PG_RETURN_CIRCLE_P(x) return CirclePGetDatum(x) + + +/* + * in geo_ops.c + */ + +extern float8 pg_hypot(float8 x, float8 y); + +#endif /* GEO_DECLS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/guc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/guc.h new file mode 100644 index 0000000..27f3140 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/guc.h @@ -0,0 +1,489 @@ +/*-------------------------------------------------------------------- + * guc.h + * + * External declarations pertaining to Grand Unified Configuration. + * + * Copyright (c) 2000-2025, PostgreSQL Global Development Group + * Written by Peter Eisentraut . + * + * src/include/utils/guc.h + *-------------------------------------------------------------------- + */ +#ifndef GUC_H +#define GUC_H + +#include "nodes/parsenodes.h" +#include "tcop/dest.h" +#include "utils/array.h" + + +/* + * Maximum for integer GUC variables that are measured in kilobytes of memory. + * This value is chosen to ensure that the corresponding number of bytes fits + * into a variable of type size_t or ssize_t. Be sure to compute the number + * of bytes like "guc_var * (Size) 1024" to avoid int-width overflow. + */ +#if SIZEOF_SIZE_T > 4 +#define MAX_KILOBYTES INT_MAX +#else +#define MAX_KILOBYTES (INT_MAX / 1024) +#endif + +/* + * Automatic configuration file name for ALTER SYSTEM. + * This file will be used to store values of configuration parameters + * set by ALTER SYSTEM command. + */ +#define PG_AUTOCONF_FILENAME "postgresql.auto.conf" + +/* + * Certain options can only be set at certain times. The rules are + * like this: + * + * INTERNAL options cannot be set by the user at all, but only through + * internal processes ("server_version" is an example). These are GUC + * variables only so they can be shown by SHOW, etc. + * + * POSTMASTER options can only be set when the postmaster starts, + * either from the configuration file or the command line. + * + * SIGHUP options can only be set at postmaster startup or by changing + * the configuration file and sending the HUP signal to the postmaster + * or a backend process. (Notice that the signal receipt will not be + * evaluated immediately. The postmaster and the backend check it at a + * certain point in their main loop. It's safer to wait than to read a + * file asynchronously.) + * + * BACKEND and SU_BACKEND options can only be set at postmaster startup, + * from the configuration file, or by client request in the connection + * startup packet (e.g., from libpq's PGOPTIONS variable). SU_BACKEND + * options can be set from the startup packet only when the user is a + * superuser. Furthermore, an already-started backend will ignore changes + * to such an option in the configuration file. The idea is that these + * options are fixed for a given backend once it's started, but they can + * vary across backends. + * + * SUSET options can be set at postmaster startup, with the SIGHUP + * mechanism, or from the startup packet or SQL if you're a superuser. + * + * USERSET options can be set by anyone any time. + */ +typedef enum +{ + PGC_INTERNAL, + PGC_POSTMASTER, + PGC_SIGHUP, + PGC_SU_BACKEND, + PGC_BACKEND, + PGC_SUSET, + PGC_USERSET, +} GucContext; + +/* + * The following type records the source of the current setting. A + * new setting can only take effect if the previous setting had the + * same or lower level. (E.g, changing the config file doesn't + * override the postmaster command line.) Tracking the source allows us + * to process sources in any convenient order without affecting results. + * Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well + * as the current value. + * + * PGC_S_INTERACTIVE isn't actually a source value, but is the + * dividing line between "interactive" and "non-interactive" sources for + * error reporting purposes. + * + * PGC_S_TEST is used when testing values to be used later. For example, + * ALTER DATABASE/ROLE tests proposed per-database or per-user defaults this + * way, and CREATE FUNCTION tests proposed function SET clauses this way. + * This is an interactive case, but it needs its own source value because + * some assign hooks need to make different validity checks in this case. + * In particular, references to nonexistent database objects generally + * shouldn't throw hard errors in this case, at most NOTICEs, since the + * objects might exist by the time the setting is used for real. + * + * When setting the value of a non-compile-time-constant PGC_INTERNAL option, + * source == PGC_S_DYNAMIC_DEFAULT should typically be used so that the value + * will show as "default" in pg_settings. If there is a specific reason not + * to want that, use source == PGC_S_OVERRIDE. + * + * NB: see GucSource_Names in guc_tables.c if you change this. + */ +typedef enum +{ + PGC_S_DEFAULT, /* hard-wired default ("boot_val") */ + PGC_S_DYNAMIC_DEFAULT, /* default computed during initialization */ + PGC_S_ENV_VAR, /* postmaster environment variable */ + PGC_S_FILE, /* postgresql.conf */ + PGC_S_ARGV, /* postmaster command line */ + PGC_S_GLOBAL, /* global in-database setting */ + PGC_S_DATABASE, /* per-database setting */ + PGC_S_USER, /* per-user setting */ + PGC_S_DATABASE_USER, /* per-user-and-database setting */ + PGC_S_CLIENT, /* from client connection request */ + PGC_S_OVERRIDE, /* special case to forcibly set default */ + PGC_S_INTERACTIVE, /* dividing line for error reporting */ + PGC_S_TEST, /* test per-database or per-user setting */ + PGC_S_SESSION, /* SET command */ +} GucSource; + +/* + * Parsing the configuration file(s) will return a list of name-value pairs + * with source location info. We also abuse this data structure to carry + * error reports about the config files. An entry reporting an error will + * have errmsg != NULL, and might have NULLs for name, value, and/or filename. + * + * If "ignore" is true, don't attempt to apply the item (it might be an error + * report, or an item we determined to be duplicate). "applied" is set true + * if we successfully applied, or could have applied, the setting. + */ +typedef struct ConfigVariable +{ + char *name; + char *value; + char *errmsg; + char *filename; + int sourceline; + bool ignore; + bool applied; + struct ConfigVariable *next; +} ConfigVariable; + +typedef struct config_generic config_handle; + +extern bool ParseConfigFile(const char *config_file, bool strict, + const char *calling_file, int calling_lineno, + int depth, int elevel, + ConfigVariable **head_p, ConfigVariable **tail_p); +extern bool ParseConfigFp(FILE *fp, const char *config_file, + int depth, int elevel, + ConfigVariable **head_p, ConfigVariable **tail_p); +extern bool ParseConfigDirectory(const char *includedir, + const char *calling_file, int calling_lineno, + int depth, int elevel, + ConfigVariable **head_p, + ConfigVariable **tail_p); +extern void FreeConfigVariables(ConfigVariable *list); +extern char *DeescapeQuotedString(const char *s); + +/* + * The possible values of an enum variable are specified by an array of + * name-value pairs. The "hidden" flag means the value is accepted but + * won't be displayed when guc.c is asked for a list of acceptable values. + */ +struct config_enum_entry +{ + const char *name; + int val; + bool hidden; +}; + +/* + * Signatures for per-variable check/assign/show hook functions + */ +typedef bool (*GucBoolCheckHook) (bool *newval, void **extra, GucSource source); +typedef bool (*GucIntCheckHook) (int *newval, void **extra, GucSource source); +typedef bool (*GucRealCheckHook) (double *newval, void **extra, GucSource source); +typedef bool (*GucStringCheckHook) (char **newval, void **extra, GucSource source); +typedef bool (*GucEnumCheckHook) (int *newval, void **extra, GucSource source); + +typedef void (*GucBoolAssignHook) (bool newval, void *extra); +typedef void (*GucIntAssignHook) (int newval, void *extra); +typedef void (*GucRealAssignHook) (double newval, void *extra); +typedef void (*GucStringAssignHook) (const char *newval, void *extra); +typedef void (*GucEnumAssignHook) (int newval, void *extra); + +typedef const char *(*GucShowHook) (void); + +/* + * Miscellaneous + */ +typedef enum +{ + /* Types of set_config_option actions */ + GUC_ACTION_SET, /* regular SET command */ + GUC_ACTION_LOCAL, /* SET LOCAL command */ + GUC_ACTION_SAVE, /* function SET option, or temp assignment */ +} GucAction; + +#define GUC_QUALIFIER_SEPARATOR '.' + +/* + * Bit values in "flags" of a GUC variable. Note that these don't appear + * on disk, so we can reassign their values freely. + */ +#define GUC_LIST_INPUT 0x000001 /* input can be list format */ +#define GUC_LIST_QUOTE 0x000002 /* double-quote list elements */ +#define GUC_NO_SHOW_ALL 0x000004 /* exclude from SHOW ALL */ +#define GUC_NO_RESET 0x000008 /* disallow RESET and SAVE */ +#define GUC_NO_RESET_ALL 0x000010 /* exclude from RESET ALL */ +#define GUC_EXPLAIN 0x000020 /* include in EXPLAIN */ +#define GUC_REPORT 0x000040 /* auto-report changes to client */ +#define GUC_NOT_IN_SAMPLE 0x000080 /* not in postgresql.conf.sample */ +#define GUC_DISALLOW_IN_FILE 0x000100 /* can't set in postgresql.conf */ +#define GUC_CUSTOM_PLACEHOLDER 0x000200 /* placeholder for custom variable */ +#define GUC_SUPERUSER_ONLY 0x000400 /* show only to superusers */ +#define GUC_IS_NAME 0x000800 /* limit string to NAMEDATALEN-1 */ +#define GUC_NOT_WHILE_SEC_REST 0x001000 /* can't set if security restricted */ +#define GUC_DISALLOW_IN_AUTO_FILE \ + 0x002000 /* can't set in PG_AUTOCONF_FILENAME */ +#define GUC_RUNTIME_COMPUTED 0x004000 /* delay processing in 'postgres -C' */ +#define GUC_ALLOW_IN_PARALLEL 0x008000 /* allow setting in parallel mode */ + +#define GUC_UNIT_KB 0x01000000 /* value is in kilobytes */ +#define GUC_UNIT_BLOCKS 0x02000000 /* value is in blocks */ +#define GUC_UNIT_XBLOCKS 0x03000000 /* value is in xlog blocks */ +#define GUC_UNIT_MB 0x04000000 /* value is in megabytes */ +#define GUC_UNIT_BYTE 0x05000000 /* value is in bytes */ +#define GUC_UNIT_MEMORY 0x0F000000 /* mask for size-related units */ + +#define GUC_UNIT_MS 0x10000000 /* value is in milliseconds */ +#define GUC_UNIT_S 0x20000000 /* value is in seconds */ +#define GUC_UNIT_MIN 0x30000000 /* value is in minutes */ +#define GUC_UNIT_TIME 0x70000000 /* mask for time-related units */ + +#define GUC_UNIT (GUC_UNIT_MEMORY | GUC_UNIT_TIME) + + +/* GUC vars that are actually defined in guc_tables.c, rather than elsewhere */ +extern PGDLLIMPORT bool Debug_print_plan; +extern PGDLLIMPORT bool Debug_print_parse; +extern PGDLLIMPORT bool Debug_print_rewritten; +extern PGDLLIMPORT bool Debug_pretty_print; + +#ifdef DEBUG_NODE_TESTS_ENABLED +extern PGDLLIMPORT bool Debug_copy_parse_plan_trees; +extern PGDLLIMPORT bool Debug_write_read_parse_plan_trees; +extern PGDLLIMPORT bool Debug_raw_expression_coverage_test; +#endif + +extern PGDLLIMPORT bool log_parser_stats; +extern PGDLLIMPORT bool log_planner_stats; +extern PGDLLIMPORT bool log_executor_stats; +extern PGDLLIMPORT bool log_statement_stats; +extern PGDLLIMPORT bool log_btree_build_stats; +extern PGDLLIMPORT char *event_source; + +extern PGDLLIMPORT bool check_function_bodies; +extern PGDLLIMPORT bool current_role_is_superuser; + +extern PGDLLIMPORT bool AllowAlterSystem; +extern PGDLLIMPORT bool log_duration; +extern PGDLLIMPORT int log_parameter_max_length; +extern PGDLLIMPORT int log_parameter_max_length_on_error; +extern PGDLLIMPORT int log_min_error_statement; +extern PGDLLIMPORT int log_min_messages; +extern PGDLLIMPORT int client_min_messages; +extern PGDLLIMPORT int log_min_duration_sample; +extern PGDLLIMPORT int log_min_duration_statement; +extern PGDLLIMPORT int log_temp_files; +extern PGDLLIMPORT double log_statement_sample_rate; +extern PGDLLIMPORT double log_xact_sample_rate; +extern PGDLLIMPORT char *backtrace_functions; + +extern PGDLLIMPORT int temp_file_limit; + +extern PGDLLIMPORT int num_temp_buffers; + +extern PGDLLIMPORT char *cluster_name; +extern PGDLLIMPORT char *ConfigFileName; +extern PGDLLIMPORT char *HbaFileName; +extern PGDLLIMPORT char *IdentFileName; +extern PGDLLIMPORT char *external_pid_file; + +extern PGDLLIMPORT char *application_name; + +extern PGDLLIMPORT int tcp_keepalives_idle; +extern PGDLLIMPORT int tcp_keepalives_interval; +extern PGDLLIMPORT int tcp_keepalives_count; +extern PGDLLIMPORT int tcp_user_timeout; + +extern PGDLLIMPORT char *role_string; +extern PGDLLIMPORT bool in_hot_standby_guc; +extern PGDLLIMPORT bool trace_sort; + +#ifdef DEBUG_BOUNDED_SORT +extern PGDLLIMPORT bool optimize_bounded_sort; +#endif + +/* + * Declarations for options for enum values + * + * For most parameters, these are defined statically inside guc_tables.c. But + * for some parameters, the definitions require symbols that are not easily + * available inside guc_tables.c, so they are instead defined in their home + * modules. For those, we keep the extern declarations here. (An alternative + * would be to put the extern declarations in the modules' header files, but + * that would then require including the definition of struct + * config_enum_entry into those header files.) + */ +extern PGDLLIMPORT const struct config_enum_entry archive_mode_options[]; +extern PGDLLIMPORT const struct config_enum_entry dynamic_shared_memory_options[]; +extern PGDLLIMPORT const struct config_enum_entry io_method_options[]; +extern PGDLLIMPORT const struct config_enum_entry recovery_target_action_options[]; +extern PGDLLIMPORT const struct config_enum_entry wal_level_options[]; +extern PGDLLIMPORT const struct config_enum_entry wal_sync_method_options[]; + +/* + * Functions exported by guc.c + */ +extern void SetConfigOption(const char *name, const char *value, + GucContext context, GucSource source); + +extern void DefineCustomBoolVariable(const char *name, + const char *short_desc, + const char *long_desc, + bool *valueAddr, + bool bootValue, + GucContext context, + int flags, + GucBoolCheckHook check_hook, + GucBoolAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void DefineCustomIntVariable(const char *name, + const char *short_desc, + const char *long_desc, + int *valueAddr, + int bootValue, + int minValue, + int maxValue, + GucContext context, + int flags, + GucIntCheckHook check_hook, + GucIntAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void DefineCustomRealVariable(const char *name, + const char *short_desc, + const char *long_desc, + double *valueAddr, + double bootValue, + double minValue, + double maxValue, + GucContext context, + int flags, + GucRealCheckHook check_hook, + GucRealAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void DefineCustomStringVariable(const char *name, + const char *short_desc, + const char *long_desc, + char **valueAddr, + const char *bootValue, + GucContext context, + int flags, + GucStringCheckHook check_hook, + GucStringAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void DefineCustomEnumVariable(const char *name, + const char *short_desc, + const char *long_desc, + int *valueAddr, + int bootValue, + const struct config_enum_entry *options, + GucContext context, + int flags, + GucEnumCheckHook check_hook, + GucEnumAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void MarkGUCPrefixReserved(const char *className); + +/* old name for MarkGUCPrefixReserved, for backwards compatibility: */ +#define EmitWarningsOnPlaceholders(className) MarkGUCPrefixReserved(className) + +extern const char *GetConfigOption(const char *name, bool missing_ok, + bool restrict_privileged); +extern const char *GetConfigOptionResetString(const char *name); +extern int GetConfigOptionFlags(const char *name, bool missing_ok); +extern void ProcessConfigFile(GucContext context); +extern char *convert_GUC_name_for_parameter_acl(const char *name); +extern void check_GUC_name_for_parameter_acl(const char *name); +extern void InitializeGUCOptions(void); +extern bool SelectConfigFiles(const char *userDoption, const char *progname); +extern void ResetAllOptions(void); +extern void AtStart_GUC(void); +extern int NewGUCNestLevel(void); +extern void RestrictSearchPath(void); +extern void AtEOXact_GUC(bool isCommit, int nestLevel); +extern void BeginReportingGUCOptions(void); +extern void ReportChangedGUCOptions(void); +extern void ParseLongOption(const char *string, char **name, char **value); +extern const char *get_config_unit_name(int flags); +extern bool parse_int(const char *value, int *result, int flags, + const char **hintmsg); +extern bool parse_real(const char *value, double *result, int flags, + const char **hintmsg); +extern int set_config_option(const char *name, const char *value, + GucContext context, GucSource source, + GucAction action, bool changeVal, int elevel, + bool is_reload); +extern int set_config_option_ext(const char *name, const char *value, + GucContext context, GucSource source, + Oid srole, + GucAction action, bool changeVal, int elevel, + bool is_reload); +extern int set_config_with_handle(const char *name, config_handle *handle, + const char *value, + GucContext context, GucSource source, + Oid srole, + GucAction action, bool changeVal, + int elevel, bool is_reload); +extern config_handle *get_config_handle(const char *name); +extern void AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt); +extern char *GetConfigOptionByName(const char *name, const char **varname, + bool missing_ok); + +extern void TransformGUCArray(ArrayType *array, List **names, + List **values); +extern void ProcessGUCArray(ArrayType *array, + GucContext context, GucSource source, GucAction action); +extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value); +extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name); +extern ArrayType *GUCArrayReset(ArrayType *array); + +extern void *guc_malloc(int elevel, size_t size); +pg_nodiscard extern void *guc_realloc(int elevel, void *old, size_t size); +extern char *guc_strdup(int elevel, const char *src); +extern void guc_free(void *ptr); + +#ifdef EXEC_BACKEND +extern void write_nondefault_variables(GucContext context); +extern void read_nondefault_variables(void); +#endif + +/* GUC serialization */ +extern Size EstimateGUCStateSpace(void); +extern void SerializeGUCState(Size maxsize, char *start_address); +extern void RestoreGUCState(void *gucstate); + +/* Functions exported by guc_funcs.c */ +extern void ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel); +extern char *ExtractSetVariableArgs(VariableSetStmt *stmt); +extern void SetPGVariable(const char *name, List *args, bool is_local); +extern void GetPGVariable(const char *name, DestReceiver *dest); +extern TupleDesc GetPGVariableResultDesc(const char *name); + +/* Support for messages reported from GUC check hooks */ + +extern PGDLLIMPORT char *GUC_check_errmsg_string; +extern PGDLLIMPORT char *GUC_check_errdetail_string; +extern PGDLLIMPORT char *GUC_check_errhint_string; + +extern void GUC_check_errcode(int sqlerrcode); + +#define GUC_check_errmsg \ + pre_format_elog_string(errno, TEXTDOMAIN), \ + GUC_check_errmsg_string = format_elog_string + +#define GUC_check_errdetail \ + pre_format_elog_string(errno, TEXTDOMAIN), \ + GUC_check_errdetail_string = format_elog_string + +#define GUC_check_errhint \ + pre_format_elog_string(errno, TEXTDOMAIN), \ + GUC_check_errhint_string = format_elog_string + +#endif /* GUC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/guc_hooks.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/guc_hooks.h new file mode 100644 index 0000000..82ac864 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/guc_hooks.h @@ -0,0 +1,178 @@ +/*------------------------------------------------------------------------- + * + * guc_hooks.h + * Declarations of per-variable callback functions used by GUC. + * + * These functions are scattered throughout the system, but we + * declare them all here to avoid having to propagate guc.h into + * a lot of unrelated header files. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/utils/guc_hooks.h + * + *------------------------------------------------------------------------- + */ +#ifndef GUC_HOOKS_H +#define GUC_HOOKS_H 1 + +#include "utils/guc.h" + +/* + * See guc.h for the typedefs that these hook functions should match + * (GucBoolCheckHook and so on). + * + * Please keep the declarations in order by GUC variable name. + */ + +extern bool check_application_name(char **newval, void **extra, + GucSource source); +extern void assign_application_name(const char *newval, void *extra); +extern const char *show_archive_command(void); +extern bool check_autovacuum_work_mem(int *newval, void **extra, + GucSource source); +extern bool check_vacuum_buffer_usage_limit(int *newval, void **extra, + GucSource source); +extern bool check_backtrace_functions(char **newval, void **extra, + GucSource source); +extern void assign_backtrace_functions(const char *newval, void *extra); +extern bool check_bonjour(bool *newval, void **extra, GucSource source); +extern bool check_canonical_path(char **newval, void **extra, GucSource source); +extern void assign_checkpoint_completion_target(double newval, void *extra); +extern bool check_client_connection_check_interval(int *newval, void **extra, + GucSource source); +extern bool check_client_encoding(char **newval, void **extra, GucSource source); +extern void assign_client_encoding(const char *newval, void *extra); +extern bool check_cluster_name(char **newval, void **extra, GucSource source); +extern bool check_commit_ts_buffers(int *newval, void **extra, + GucSource source); +extern const char *show_data_directory_mode(void); +extern bool check_datestyle(char **newval, void **extra, GucSource source); +extern void assign_datestyle(const char *newval, void *extra); +extern bool check_debug_io_direct(char **newval, void **extra, GucSource source); +extern void assign_debug_io_direct(const char *newval, void *extra); +extern bool check_log_connections(char **newval, void **extra, GucSource source); +extern void assign_log_connections(const char *newval, void *extra); +extern bool check_default_table_access_method(char **newval, void **extra, + GucSource source); +extern bool check_default_tablespace(char **newval, void **extra, + GucSource source); +extern bool check_default_text_search_config(char **newval, void **extra, GucSource source); +extern void assign_default_text_search_config(const char *newval, void *extra); +extern bool check_default_with_oids(bool *newval, void **extra, + GucSource source); +extern bool check_huge_page_size(int *newval, void **extra, GucSource source); +extern void assign_io_method(int newval, void *extra); +extern bool check_io_max_concurrency(int *newval, void **extra, GucSource source); +extern const char *show_in_hot_standby(void); +extern bool check_locale_messages(char **newval, void **extra, GucSource source); +extern void assign_locale_messages(const char *newval, void *extra); +extern bool check_locale_monetary(char **newval, void **extra, GucSource source); +extern void assign_locale_monetary(const char *newval, void *extra); +extern bool check_locale_numeric(char **newval, void **extra, GucSource source); +extern void assign_locale_numeric(const char *newval, void *extra); +extern bool check_locale_time(char **newval, void **extra, GucSource source); +extern void assign_locale_time(const char *newval, void *extra); +extern bool check_log_destination(char **newval, void **extra, + GucSource source); +extern void assign_log_destination(const char *newval, void *extra); +extern const char *show_log_file_mode(void); +extern bool check_log_stats(bool *newval, void **extra, GucSource source); +extern bool check_log_timezone(char **newval, void **extra, GucSource source); +extern void assign_log_timezone(const char *newval, void *extra); +extern const char *show_log_timezone(void); +extern void assign_maintenance_io_concurrency(int newval, void *extra); +extern void assign_io_max_combine_limit(int newval, void *extra); +extern void assign_io_combine_limit(int newval, void *extra); +extern void assign_max_wal_size(int newval, void *extra); +extern bool check_max_stack_depth(int *newval, void **extra, GucSource source); +extern void assign_max_stack_depth(int newval, void *extra); +extern bool check_multixact_member_buffers(int *newval, void **extra, + GucSource source); +extern bool check_multixact_offset_buffers(int *newval, void **extra, + GucSource source); +extern bool check_notify_buffers(int *newval, void **extra, GucSource source); +extern bool check_primary_slot_name(char **newval, void **extra, + GucSource source); +extern bool check_random_seed(double *newval, void **extra, GucSource source); +extern void assign_random_seed(double newval, void *extra); +extern const char *show_random_seed(void); +extern bool check_recovery_prefetch(int *new_value, void **extra, + GucSource source); +extern void assign_recovery_prefetch(int new_value, void *extra); +extern bool check_recovery_target(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target(const char *newval, void *extra); +extern bool check_recovery_target_lsn(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_lsn(const char *newval, void *extra); +extern bool check_recovery_target_name(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_name(const char *newval, void *extra); +extern bool check_recovery_target_time(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_time(const char *newval, void *extra); +extern bool check_recovery_target_timeline(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_timeline(const char *newval, void *extra); +extern bool check_recovery_target_xid(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_xid(const char *newval, void *extra); +extern bool check_role(char **newval, void **extra, GucSource source); +extern void assign_role(const char *newval, void *extra); +extern const char *show_role(void); +extern bool check_restrict_nonsystem_relation_kind(char **newval, void **extra, + GucSource source); +extern void assign_restrict_nonsystem_relation_kind(const char *newval, void *extra); +extern bool check_search_path(char **newval, void **extra, GucSource source); +extern void assign_search_path(const char *newval, void *extra); +extern bool check_serial_buffers(int *newval, void **extra, GucSource source); +extern bool check_session_authorization(char **newval, void **extra, GucSource source); +extern void assign_session_authorization(const char *newval, void *extra); +extern void assign_session_replication_role(int newval, void *extra); +extern void assign_stats_fetch_consistency(int newval, void *extra); +extern bool check_ssl(bool *newval, void **extra, GucSource source); +extern bool check_stage_log_stats(bool *newval, void **extra, GucSource source); +extern bool check_subtrans_buffers(int *newval, void **extra, + GucSource source); +extern bool check_synchronous_standby_names(char **newval, void **extra, + GucSource source); +extern void assign_synchronous_standby_names(const char *newval, void *extra); +extern void assign_synchronous_commit(int newval, void *extra); +extern void assign_syslog_facility(int newval, void *extra); +extern void assign_syslog_ident(const char *newval, void *extra); +extern void assign_tcp_keepalives_count(int newval, void *extra); +extern const char *show_tcp_keepalives_count(void); +extern void assign_tcp_keepalives_idle(int newval, void *extra); +extern const char *show_tcp_keepalives_idle(void); +extern void assign_tcp_keepalives_interval(int newval, void *extra); +extern const char *show_tcp_keepalives_interval(void); +extern void assign_tcp_user_timeout(int newval, void *extra); +extern const char *show_tcp_user_timeout(void); +extern bool check_temp_buffers(int *newval, void **extra, GucSource source); +extern bool check_temp_tablespaces(char **newval, void **extra, + GucSource source); +extern void assign_temp_tablespaces(const char *newval, void *extra); +extern bool check_timezone(char **newval, void **extra, GucSource source); +extern void assign_timezone(const char *newval, void *extra); +extern const char *show_timezone(void); +extern bool check_timezone_abbreviations(char **newval, void **extra, + GucSource source); +extern void assign_timezone_abbreviations(const char *newval, void *extra); +extern bool check_transaction_buffers(int *newval, void **extra, GucSource source); +extern bool check_transaction_deferrable(bool *newval, void **extra, GucSource source); +extern bool check_transaction_isolation(int *newval, void **extra, GucSource source); +extern bool check_transaction_read_only(bool *newval, void **extra, GucSource source); +extern void assign_transaction_timeout(int newval, void *extra); +extern const char *show_unix_socket_permissions(void); +extern bool check_wal_buffers(int *newval, void **extra, GucSource source); +extern bool check_wal_consistency_checking(char **newval, void **extra, + GucSource source); +extern void assign_wal_consistency_checking(const char *newval, void *extra); +extern bool check_wal_segment_size(int *newval, void **extra, GucSource source); +extern void assign_wal_sync_method(int new_wal_sync_method, void *extra); +extern bool check_synchronized_standby_slots(char **newval, void **extra, + GucSource source); +extern void assign_synchronized_standby_slots(const char *newval, void *extra); + +#endif /* GUC_HOOKS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/guc_tables.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/guc_tables.h new file mode 100644 index 0000000..f72ce94 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/guc_tables.h @@ -0,0 +1,341 @@ +/*------------------------------------------------------------------------- + * + * guc_tables.h + * Declarations of tables used by GUC. + * + * See src/backend/utils/misc/README for design notes. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/utils/guc_tables.h + * + *------------------------------------------------------------------------- + */ +#ifndef GUC_TABLES_H +#define GUC_TABLES_H 1 + +#include "lib/ilist.h" +#include "utils/guc.h" + +/* + * GUC supports these types of variables: + */ +enum config_type +{ + PGC_BOOL, + PGC_INT, + PGC_REAL, + PGC_STRING, + PGC_ENUM, +}; + +union config_var_val +{ + bool boolval; + int intval; + double realval; + char *stringval; + int enumval; +}; + +/* + * The actual value of a GUC variable can include a malloc'd opaque struct + * "extra", which is created by its check_hook and used by its assign_hook. + */ +typedef struct config_var_value +{ + union config_var_val val; + void *extra; +} config_var_value; + +/* + * Groupings to help organize all the run-time options for display. + * Be sure this agrees with the way the options are categorized in config.sgml! + */ +enum config_group +{ + UNGROUPED, /* use for options not shown in pg_settings */ + FILE_LOCATIONS, + CONN_AUTH_SETTINGS, + CONN_AUTH_TCP, + CONN_AUTH_AUTH, + CONN_AUTH_SSL, + RESOURCES_MEM, + RESOURCES_DISK, + RESOURCES_KERNEL, + RESOURCES_BGWRITER, + RESOURCES_IO, + RESOURCES_WORKER_PROCESSES, + WAL_SETTINGS, + WAL_CHECKPOINTS, + WAL_ARCHIVING, + WAL_RECOVERY, + WAL_ARCHIVE_RECOVERY, + WAL_RECOVERY_TARGET, + WAL_SUMMARIZATION, + REPLICATION_SENDING, + REPLICATION_PRIMARY, + REPLICATION_STANDBY, + REPLICATION_SUBSCRIBERS, + QUERY_TUNING_METHOD, + QUERY_TUNING_COST, + QUERY_TUNING_GEQO, + QUERY_TUNING_OTHER, + LOGGING_WHERE, + LOGGING_WHEN, + LOGGING_WHAT, + PROCESS_TITLE, + STATS_MONITORING, + STATS_CUMULATIVE, + VACUUM_AUTOVACUUM, + VACUUM_COST_DELAY, + VACUUM_DEFAULT, + VACUUM_FREEZING, + CLIENT_CONN_STATEMENT, + CLIENT_CONN_LOCALE, + CLIENT_CONN_PRELOAD, + CLIENT_CONN_OTHER, + LOCK_MANAGEMENT, + COMPAT_OPTIONS_PREVIOUS, + COMPAT_OPTIONS_OTHER, + ERROR_HANDLING_OPTIONS, + PRESET_OPTIONS, + CUSTOM_OPTIONS, + DEVELOPER_OPTIONS, +}; + +/* + * Stack entry for saving the state a variable had prior to an uncommitted + * transactional change + */ +typedef enum +{ + /* This is almost GucAction, but we need a fourth state for SET+LOCAL */ + GUC_SAVE, /* entry caused by function SET option */ + GUC_SET, /* entry caused by plain SET command */ + GUC_LOCAL, /* entry caused by SET LOCAL command */ + GUC_SET_LOCAL, /* entry caused by SET then SET LOCAL */ +} GucStackState; + +typedef struct guc_stack +{ + struct guc_stack *prev; /* previous stack item, if any */ + int nest_level; /* nesting depth at which we made entry */ + GucStackState state; /* see enum above */ + GucSource source; /* source of the prior value */ + /* masked value's source must be PGC_S_SESSION, so no need to store it */ + GucContext scontext; /* context that set the prior value */ + GucContext masked_scontext; /* context that set the masked value */ + Oid srole; /* role that set the prior value */ + Oid masked_srole; /* role that set the masked value */ + config_var_value prior; /* previous value of variable */ + config_var_value masked; /* SET value in a GUC_SET_LOCAL entry */ +} GucStack; + +/* + * Generic fields applicable to all types of variables + * + * The short description should be less than 80 chars in length. Some + * applications may use the long description as well, and will append + * it to the short description. (separated by a newline or '. ') + * + * If the GUC accepts a special value like -1 to disable the feature, use a + * system default, etc., it should be mentioned in the long description with + * the following style: + * + * - Special values should be listed at the end of the long description. + * - Descriptions should use numerals (e.g., "0") instead of words (e.g., + * "zero"). + * - Special value mentions should be concise and direct (e.g., "0 disables + * the timeout.", "An empty string means use the operating system + * setting."). + * - Multiple special values should be listed in ascending order. + * + * As an exception, special values should _not_ be mentioned if the description + * would be too complex or if the meaning is sufficiently obvious. + * + * srole is the role that set the current value, or BOOTSTRAP_SUPERUSERID + * if the value came from an internal source or the config file. Similarly + * for reset_srole (which is usually BOOTSTRAP_SUPERUSERID, but not always). + * + * Variables that are currently of active interest for maintenance + * operations are linked into various lists using the xxx_link fields. + * The link fields are unused/garbage in variables not currently having + * the specified properties. + * + * Note that sourcefile/sourceline are kept here, and not pushed into stacked + * values, although in principle they belong with some stacked value if the + * active value is session- or transaction-local. This is to avoid bloating + * stack entries. We know they are only relevant when source == PGC_S_FILE. + */ +struct config_generic +{ + /* constant fields, must be set correctly in initial value: */ + const char *name; /* name of variable - MUST BE FIRST */ + GucContext context; /* context required to set the variable */ + enum config_group group; /* to help organize variables by function */ + const char *short_desc; /* short desc. of this variable's purpose */ + const char *long_desc; /* long desc. of this variable's purpose */ + int flags; /* flag bits, see guc.h */ + /* variable fields, initialized at runtime: */ + enum config_type vartype; /* type of variable (set only at startup) */ + int status; /* status bits, see below */ + GucSource source; /* source of the current actual value */ + GucSource reset_source; /* source of the reset_value */ + GucContext scontext; /* context that set the current value */ + GucContext reset_scontext; /* context that set the reset value */ + Oid srole; /* role that set the current value */ + Oid reset_srole; /* role that set the reset value */ + GucStack *stack; /* stacked prior values */ + void *extra; /* "extra" pointer for current actual value */ + dlist_node nondef_link; /* list link for variables that have source + * different from PGC_S_DEFAULT */ + slist_node stack_link; /* list link for variables that have non-NULL + * stack */ + slist_node report_link; /* list link for variables that have the + * GUC_NEEDS_REPORT bit set in status */ + char *last_reported; /* if variable is GUC_REPORT, value last sent + * to client (NULL if not yet sent) */ + char *sourcefile; /* file current setting is from (NULL if not + * set in config file) */ + int sourceline; /* line in source file */ +}; + +/* bit values in status field */ +#define GUC_IS_IN_FILE 0x0001 /* found it in config file */ +/* + * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile. + * Do not assume that its value represents useful information elsewhere. + */ +#define GUC_PENDING_RESTART 0x0002 /* changed value cannot be applied yet */ +#define GUC_NEEDS_REPORT 0x0004 /* new value must be reported to client */ + + +/* GUC records for specific variable types */ + +struct config_bool +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + bool *variable; + bool boot_val; + GucBoolCheckHook check_hook; + GucBoolAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + bool reset_val; + void *reset_extra; +}; + +struct config_int +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + int *variable; + int boot_val; + int min; + int max; + GucIntCheckHook check_hook; + GucIntAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + int reset_val; + void *reset_extra; +}; + +struct config_real +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + double *variable; + double boot_val; + double min; + double max; + GucRealCheckHook check_hook; + GucRealAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + double reset_val; + void *reset_extra; +}; + +/* + * A note about string GUCs: the boot_val is allowed to be NULL, which leads + * to the reset_val and the actual variable value (*variable) also being NULL. + * However, there is no way to set a NULL value subsequently using + * set_config_option or any other GUC API. Also, GUC APIs such as SHOW will + * display a NULL value as an empty string. Callers that choose to use a NULL + * boot_val should overwrite the setting later in startup, or else be careful + * that NULL doesn't have semantics that are visibly different from an empty + * string. + */ +struct config_string +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + char **variable; + const char *boot_val; + GucStringCheckHook check_hook; + GucStringAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + char *reset_val; + void *reset_extra; +}; + +struct config_enum +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + int *variable; + int boot_val; + const struct config_enum_entry *options; + GucEnumCheckHook check_hook; + GucEnumAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + int reset_val; + void *reset_extra; +}; + +/* constant tables corresponding to enums above and in guc.h */ +extern PGDLLIMPORT const char *const config_group_names[]; +extern PGDLLIMPORT const char *const config_type_names[]; +extern PGDLLIMPORT const char *const GucContext_Names[]; +extern PGDLLIMPORT const char *const GucSource_Names[]; + +/* data arrays defining all the built-in GUC variables */ +extern PGDLLIMPORT struct config_bool ConfigureNamesBool[]; +extern PGDLLIMPORT struct config_int ConfigureNamesInt[]; +extern PGDLLIMPORT struct config_real ConfigureNamesReal[]; +extern PGDLLIMPORT struct config_string ConfigureNamesString[]; +extern PGDLLIMPORT struct config_enum ConfigureNamesEnum[]; + +/* lookup GUC variables, returning config_generic pointers */ +extern struct config_generic *find_option(const char *name, + bool create_placeholders, + bool skip_errors, + int elevel); +extern struct config_generic **get_explain_guc_options(int *num); + +/* get string value of variable */ +extern char *ShowGUCOption(struct config_generic *record, bool use_units); + +/* get whether or not the GUC variable is visible to current user */ +extern bool ConfigOptionIsVisible(struct config_generic *conf); + +/* get the current set of variables */ +extern struct config_generic **get_guc_variables(int *num_vars); + +extern void build_guc_variables(void); + +/* search in enum options */ +extern const char *config_enum_lookup_by_value(struct config_enum *record, int val); +extern bool config_enum_lookup_by_name(struct config_enum *record, + const char *value, int *retval); +extern char *config_enum_get_options(struct config_enum *record, + const char *prefix, + const char *suffix, + const char *separator); + +#endif /* GUC_TABLES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/help_config.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/help_config.h new file mode 100644 index 0000000..4e58f13 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/help_config.h @@ -0,0 +1,17 @@ +/*------------------------------------------------------------------------- + * + * help_config.h + * Interface to the --help-config option of main.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/utils/help_config.h + * + *------------------------------------------------------------------------- + */ +#ifndef HELP_CONFIG_H +#define HELP_CONFIG_H 1 + +pg_noreturn extern void GucInfoMain(void); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/hsearch.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/hsearch.h new file mode 100644 index 0000000..932cc4f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/hsearch.h @@ -0,0 +1,158 @@ +/*------------------------------------------------------------------------- + * + * hsearch.h + * exported definitions for utils/hash/dynahash.c; see notes therein + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/hsearch.h + * + *------------------------------------------------------------------------- + */ +#ifndef HSEARCH_H +#define HSEARCH_H + + +/* + * Hash functions must have this signature. + */ +typedef uint32 (*HashValueFunc) (const void *key, Size keysize); + +/* + * Key comparison functions must have this signature. Comparison functions + * return zero for match, nonzero for no match. (The comparison function + * definition is designed to allow memcmp() and strncmp() to be used directly + * as key comparison functions.) + */ +typedef int (*HashCompareFunc) (const void *key1, const void *key2, + Size keysize); + +/* + * Key copying functions must have this signature. The return value is not + * used. (The definition is set up to allow memcpy() and strlcpy() to be + * used directly.) + */ +typedef void *(*HashCopyFunc) (void *dest, const void *src, Size keysize); + +/* + * Space allocation function for a hashtable --- designed to match malloc(). + * Note: there is no free function API; can't destroy a hashtable unless you + * use the default allocator. + */ +typedef void *(*HashAllocFunc) (Size request); + +/* + * HASHELEMENT is the private part of a hashtable entry. The caller's data + * follows the HASHELEMENT structure (on a MAXALIGN'd boundary). The hash key + * is expected to be at the start of the caller's hash entry data structure. + */ +typedef struct HASHELEMENT +{ + struct HASHELEMENT *link; /* link to next entry in same bucket */ + uint32 hashvalue; /* hash function result for this entry */ +} HASHELEMENT; + +/* Hash table header struct is an opaque type known only within dynahash.c */ +typedef struct HASHHDR HASHHDR; + +/* Hash table control struct is an opaque type known only within dynahash.c */ +typedef struct HTAB HTAB; + +/* Parameter data structure for hash_create */ +/* Only those fields indicated by hash_flags need be set */ +typedef struct HASHCTL +{ + /* Used if HASH_PARTITION flag is set: */ + long num_partitions; /* # partitions (must be power of 2) */ + /* Used if HASH_SEGMENT flag is set: */ + long ssize; /* segment size */ + /* Used if HASH_DIRSIZE flag is set: */ + long dsize; /* (initial) directory size */ + long max_dsize; /* limit to dsize if dir size is limited */ + /* Used if HASH_ELEM flag is set (which is now required): */ + Size keysize; /* hash key length in bytes */ + Size entrysize; /* total user element size in bytes */ + /* Used if HASH_FUNCTION flag is set: */ + HashValueFunc hash; /* hash function */ + /* Used if HASH_COMPARE flag is set: */ + HashCompareFunc match; /* key comparison function */ + /* Used if HASH_KEYCOPY flag is set: */ + HashCopyFunc keycopy; /* key copying function */ + /* Used if HASH_ALLOC flag is set: */ + HashAllocFunc alloc; /* memory allocator */ + /* Used if HASH_CONTEXT flag is set: */ + MemoryContext hcxt; /* memory context to use for allocations */ + /* Used if HASH_SHARED_MEM flag is set: */ + HASHHDR *hctl; /* location of header in shared mem */ +} HASHCTL; + +/* Flag bits for hash_create; most indicate which parameters are supplied */ +#define HASH_PARTITION 0x0001 /* Hashtable is used w/partitioned locking */ +#define HASH_SEGMENT 0x0002 /* Set segment size */ +#define HASH_DIRSIZE 0x0004 /* Set directory size (initial and max) */ +#define HASH_ELEM 0x0008 /* Set keysize and entrysize (now required!) */ +#define HASH_STRINGS 0x0010 /* Select support functions for string keys */ +#define HASH_BLOBS 0x0020 /* Select support functions for binary keys */ +#define HASH_FUNCTION 0x0040 /* Set user defined hash function */ +#define HASH_COMPARE 0x0080 /* Set user defined comparison function */ +#define HASH_KEYCOPY 0x0100 /* Set user defined key-copying function */ +#define HASH_ALLOC 0x0200 /* Set memory allocator */ +#define HASH_CONTEXT 0x0400 /* Set memory allocation context */ +#define HASH_SHARED_MEM 0x0800 /* Hashtable is in shared memory */ +#define HASH_ATTACH 0x1000 /* Do not initialize hctl */ +#define HASH_FIXED_SIZE 0x2000 /* Initial size is a hard limit */ + +/* max_dsize value to indicate expansible directory */ +#define NO_MAX_DSIZE (-1) + +/* hash_search operations */ +typedef enum +{ + HASH_FIND, + HASH_ENTER, + HASH_REMOVE, + HASH_ENTER_NULL, +} HASHACTION; + +/* hash_seq status (should be considered an opaque type by callers) */ +typedef struct +{ + HTAB *hashp; + uint32 curBucket; /* index of current bucket */ + HASHELEMENT *curEntry; /* current entry in bucket */ + bool hasHashvalue; /* true if hashvalue was provided */ + uint32 hashvalue; /* hashvalue to start seqscan over hash */ +} HASH_SEQ_STATUS; + +/* + * prototypes for functions in dynahash.c + */ +extern HTAB *hash_create(const char *tabname, long nelem, + const HASHCTL *info, int flags); +extern void hash_destroy(HTAB *hashp); +extern void hash_stats(const char *where, HTAB *hashp); +extern void *hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, + bool *foundPtr); +extern uint32 get_hash_value(HTAB *hashp, const void *keyPtr); +extern void *hash_search_with_hash_value(HTAB *hashp, const void *keyPtr, + uint32 hashvalue, HASHACTION action, + bool *foundPtr); +extern bool hash_update_hash_key(HTAB *hashp, void *existingEntry, + const void *newKeyPtr); +extern long hash_get_num_entries(HTAB *hashp); +extern void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp); +extern void hash_seq_init_with_hash_value(HASH_SEQ_STATUS *status, + HTAB *hashp, + uint32 hashvalue); +extern void *hash_seq_search(HASH_SEQ_STATUS *status); +extern void hash_seq_term(HASH_SEQ_STATUS *status); +extern void hash_freeze(HTAB *hashp); +extern Size hash_estimate_size(long num_entries, Size entrysize); +extern long hash_select_dirsize(long num_entries); +extern Size hash_get_shared_size(HASHCTL *info, int flags); +extern void AtEOXact_HashTables(bool isCommit); +extern void AtEOSubXact_HashTables(bool isCommit, int nestDepth); + +#endif /* HSEARCH_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/index_selfuncs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/index_selfuncs.h new file mode 100644 index 0000000..6c64db6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/index_selfuncs.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * index_selfuncs.h + * Index cost estimation functions for standard index access methods. + * + * + * Note: this is split out of selfuncs.h mainly to avoid importing all of the + * planner's data structures into the non-planner parts of the index AMs. + * If you make it depend on anything besides access/amapi.h, that's likely + * a mistake. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/index_selfuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef INDEX_SELFUNCS_H +#define INDEX_SELFUNCS_H + +#include "access/amapi.h" + +/* Functions in selfuncs.c */ +extern void brincostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void btcostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void hashcostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void gistcostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void spgcostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void gincostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); + +#endif /* INDEX_SELFUNCS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/inet.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/inet.h new file mode 100644 index 0000000..ace8957 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/inet.h @@ -0,0 +1,184 @@ +/*------------------------------------------------------------------------- + * + * inet.h + * Declarations for operations on INET datatypes. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/inet.h + * + *------------------------------------------------------------------------- + */ +#ifndef INET_H +#define INET_H + +#include "fmgr.h" + +/* + * This is the internal storage format for IP addresses + * (both INET and CIDR datatypes): + */ +typedef struct +{ + unsigned char family; /* PGSQL_AF_INET or PGSQL_AF_INET6 */ + unsigned char bits; /* number of bits in netmask */ + unsigned char ipaddr[16]; /* up to 128 bits of address */ +} inet_struct; + +/* + * We use these values for the "family" field. + * + * Referencing all of the non-AF_INET types to AF_INET lets us work on + * machines which did not have the appropriate address family (like + * inet6 addresses when AF_INET6 wasn't present) but didn't cause a + * dump/reload requirement. Pre-7.4 databases used AF_INET for the family + * type on disk. + */ +#define PGSQL_AF_INET (AF_INET + 0) +#define PGSQL_AF_INET6 (AF_INET + 1) + +/* + * Both INET and CIDR addresses are represented within Postgres as varlena + * objects, ie, there is a varlena header in front of the struct type + * depicted above. This struct depicts what we actually have in memory + * in "uncompressed" cases. Note that since the maximum data size is only + * 18 bytes, INET/CIDR will invariably be stored into tuples using the + * 1-byte-header varlena format. However, we have to be prepared to cope + * with the 4-byte-header format too, because various code may helpfully + * try to "decompress" 1-byte-header datums. + */ +typedef struct +{ + char vl_len_[4]; /* Do not touch this field directly! */ + inet_struct inet_data; +} inet; + +/* + * Access macros. We use VARDATA_ANY so that we can process short-header + * varlena values without detoasting them. This requires a trick: + * VARDATA_ANY assumes the varlena header is already filled in, which is + * not the case when constructing a new value (until SET_INET_VARSIZE is + * called, which we typically can't do till the end). Therefore, we + * always initialize the newly-allocated value to zeroes (using palloc0). + * A zero length word will look like the not-1-byte case to VARDATA_ANY, + * and so we correctly construct an uncompressed value. + * + * Note that ip_addrsize(), ip_maxbits(), and SET_INET_VARSIZE() require + * the family field to be set correctly. + */ +#define ip_family(inetptr) \ + (((inet_struct *) VARDATA_ANY(inetptr))->family) + +#define ip_bits(inetptr) \ + (((inet_struct *) VARDATA_ANY(inetptr))->bits) + +#define ip_addr(inetptr) \ + (((inet_struct *) VARDATA_ANY(inetptr))->ipaddr) + +#define ip_addrsize(inetptr) \ + (ip_family(inetptr) == PGSQL_AF_INET ? 4 : 16) + +#define ip_maxbits(inetptr) \ + (ip_family(inetptr) == PGSQL_AF_INET ? 32 : 128) + +#define SET_INET_VARSIZE(dst) \ + SET_VARSIZE(dst, VARHDRSZ + offsetof(inet_struct, ipaddr) + \ + ip_addrsize(dst)) + + +/* + * This is the internal storage format for MAC addresses: + */ +typedef struct macaddr +{ + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; + unsigned char e; + unsigned char f; +} macaddr; + +/* + * This is the internal storage format for MAC8 addresses: + */ +typedef struct macaddr8 +{ + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; + unsigned char e; + unsigned char f; + unsigned char g; + unsigned char h; +} macaddr8; + +/* + * fmgr interface macros + */ +static inline inet * +DatumGetInetPP(Datum X) +{ + return (inet *) PG_DETOAST_DATUM_PACKED(X); +} + +static inline Datum +InetPGetDatum(const inet *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_INET_PP(n) DatumGetInetPP(PG_GETARG_DATUM(n)) +#define PG_RETURN_INET_P(x) return InetPGetDatum(x) + +/* obsolescent variants */ +static inline inet * +DatumGetInetP(Datum X) +{ + return (inet *) PG_DETOAST_DATUM(X); +} +#define PG_GETARG_INET_P(n) DatumGetInetP(PG_GETARG_DATUM(n)) + +/* macaddr is a fixed-length pass-by-reference datatype */ +static inline macaddr * +DatumGetMacaddrP(Datum X) +{ + return (macaddr *) DatumGetPointer(X); +} + +static inline Datum +MacaddrPGetDatum(const macaddr *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_MACADDR_P(n) DatumGetMacaddrP(PG_GETARG_DATUM(n)) +#define PG_RETURN_MACADDR_P(x) return MacaddrPGetDatum(x) + +/* macaddr8 is a fixed-length pass-by-reference datatype */ +static inline macaddr8 * +DatumGetMacaddr8P(Datum X) +{ + return (macaddr8 *) DatumGetPointer(X); +} + +static inline Datum +Macaddr8PGetDatum(const macaddr8 *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_MACADDR8_P(n) DatumGetMacaddr8P(PG_GETARG_DATUM(n)) +#define PG_RETURN_MACADDR8_P(x) return Macaddr8PGetDatum(x) + +/* + * Support functions in network.c + */ +extern inet *cidr_set_masklen_internal(const inet *src, int bits); +extern int bitncmp(const unsigned char *l, const unsigned char *r, int n); +extern int bitncommon(const unsigned char *l, const unsigned char *r, int n); + +#endif /* INET_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/injection_point.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/injection_point.h new file mode 100644 index 0000000..a37958e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/injection_point.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * injection_point.h + * Definitions related to injection points. + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/utils/injection_point.h + *------------------------------------------------------------------------- + */ + +#ifndef INJECTION_POINT_H +#define INJECTION_POINT_H + +/* + * Injection points require --enable-injection-points. + */ +#ifdef USE_INJECTION_POINTS +#define INJECTION_POINT_LOAD(name) InjectionPointLoad(name) +#define INJECTION_POINT(name, arg) InjectionPointRun(name, arg) +#define INJECTION_POINT_CACHED(name, arg) InjectionPointCached(name, arg) +#define IS_INJECTION_POINT_ATTACHED(name) IsInjectionPointAttached(name) +#else +#define INJECTION_POINT_LOAD(name) ((void) name) +#define INJECTION_POINT(name, arg) ((void) name) +#define INJECTION_POINT_CACHED(name, arg) ((void) name) +#define IS_INJECTION_POINT_ATTACHED(name) (false) +#endif + +/* + * Typedef for callback function launched by an injection point. + */ +typedef void (*InjectionPointCallback) (const char *name, + const void *private_data, + void *arg); + +extern Size InjectionPointShmemSize(void); +extern void InjectionPointShmemInit(void); + +extern void InjectionPointAttach(const char *name, + const char *library, + const char *function, + const void *private_data, + int private_data_size); +extern void InjectionPointLoad(const char *name); +extern void InjectionPointRun(const char *name, void *arg); +extern void InjectionPointCached(const char *name, void *arg); +extern bool IsInjectionPointAttached(const char *name); +extern bool InjectionPointDetach(const char *name); + +#ifdef EXEC_BACKEND +extern PGDLLIMPORT struct InjectionPointsCtl *ActiveInjectionPoints; +#endif + +#endif /* INJECTION_POINT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/inval.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/inval.h new file mode 100644 index 0000000..b5fbd75 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/inval.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------------------------- + * + * inval.h + * POSTGRES cache invalidation dispatcher definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/inval.h + * + *------------------------------------------------------------------------- + */ +#ifndef INVAL_H +#define INVAL_H + +#include "access/htup.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" + +extern PGDLLIMPORT int debug_discard_caches; + +typedef void (*SyscacheCallbackFunction) (Datum arg, int cacheid, uint32 hashvalue); +typedef void (*RelcacheCallbackFunction) (Datum arg, Oid relid); +typedef void (*RelSyncCallbackFunction) (Datum arg, Oid relid); + + +extern void AcceptInvalidationMessages(void); + +extern void AtEOXact_Inval(bool isCommit); + +extern void PreInplace_Inval(void); +extern void AtInplace_Inval(void); +extern void ForgetInplace_Inval(void); + +extern void AtEOSubXact_Inval(bool isCommit); + +extern void PostPrepare_Inval(void); + +extern void CommandEndInvalidationMessages(void); + +extern void CacheInvalidateHeapTuple(Relation relation, + HeapTuple tuple, + HeapTuple newtuple); +extern void CacheInvalidateHeapTupleInplace(Relation relation, + HeapTuple key_equivalent_tuple); + +extern void CacheInvalidateCatalog(Oid catalogId); + +extern void CacheInvalidateRelcache(Relation relation); + +extern void CacheInvalidateRelcacheAll(void); + +extern void CacheInvalidateRelcacheByTuple(HeapTuple classTuple); + +extern void CacheInvalidateRelcacheByRelid(Oid relid); + +extern void CacheInvalidateRelSync(Oid relid); + +extern void CacheInvalidateRelSyncAll(void); + +extern void CacheInvalidateSmgr(RelFileLocatorBackend rlocator); + +extern void CacheInvalidateRelmap(Oid databaseId); + +extern void CacheRegisterSyscacheCallback(int cacheid, + SyscacheCallbackFunction func, + Datum arg); + +extern void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func, + Datum arg); + +extern void CacheRegisterRelSyncCallback(RelSyncCallbackFunction func, + Datum arg); + +extern void CallSyscacheCallbacks(int cacheid, uint32 hashvalue); + +extern void CallRelSyncCallbacks(Oid relid); + +extern void InvalidateSystemCaches(void); +extern void InvalidateSystemCachesExtended(bool debug_discard); + +extern void LogLogicalInvalidations(void); +#endif /* INVAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/json.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/json.h new file mode 100644 index 0000000..49bbda7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/json.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * json.h + * Declarations for JSON data type support. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/json.h + * + *------------------------------------------------------------------------- + */ + +#ifndef JSON_H +#define JSON_H + +#include "lib/stringinfo.h" + +/* functions in json.c */ +extern void escape_json(StringInfo buf, const char *str); +extern void escape_json_with_len(StringInfo buf, const char *str, int len); +extern void escape_json_text(StringInfo buf, const text *txt); +extern char *JsonEncodeDateTime(char *buf, Datum value, Oid typid, + const int *tzp); +extern bool to_json_is_immutable(Oid typoid); +extern Datum json_build_object_worker(int nargs, const Datum *args, const bool *nulls, + const Oid *types, bool absent_on_null, + bool unique_keys); +extern Datum json_build_array_worker(int nargs, const Datum *args, const bool *nulls, + const Oid *types, bool absent_on_null); +extern bool json_validate(text *json, bool check_unique_keys, bool throw_error); + +#endif /* JSON_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/jsonb.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/jsonb.h new file mode 100644 index 0000000..fecb33b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/jsonb.h @@ -0,0 +1,440 @@ +/*------------------------------------------------------------------------- + * + * jsonb.h + * Declarations for jsonb data type support. + * + * Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/utils/jsonb.h + * + *------------------------------------------------------------------------- + */ +#ifndef __JSONB_H__ +#define __JSONB_H__ + +#include "lib/stringinfo.h" +#include "utils/array.h" +#include "utils/numeric.h" + +/* Tokens used when sequentially processing a jsonb value */ +typedef enum +{ + WJB_DONE, + WJB_KEY, + WJB_VALUE, + WJB_ELEM, + WJB_BEGIN_ARRAY, + WJB_END_ARRAY, + WJB_BEGIN_OBJECT, + WJB_END_OBJECT, +} JsonbIteratorToken; + +/* Strategy numbers for GIN index opclasses */ +#define JsonbContainsStrategyNumber 7 +#define JsonbExistsStrategyNumber 9 +#define JsonbExistsAnyStrategyNumber 10 +#define JsonbExistsAllStrategyNumber 11 +#define JsonbJsonpathExistsStrategyNumber 15 +#define JsonbJsonpathPredicateStrategyNumber 16 + + +/* + * In the standard jsonb_ops GIN opclass for jsonb, we choose to index both + * keys and values. The storage format is text. The first byte of the text + * string distinguishes whether this is a key (always a string), null value, + * boolean value, numeric value, or string value. However, array elements + * that are strings are marked as though they were keys; this imprecision + * supports the definition of the "exists" operator, which treats array + * elements like keys. The remainder of the text string is empty for a null + * value, "t" or "f" for a boolean value, a normalized print representation of + * a numeric value, or the text of a string value. However, if the length of + * this text representation would exceed JGIN_MAXLENGTH bytes, we instead hash + * the text representation and store an 8-hex-digit representation of the + * uint32 hash value, marking the prefix byte with an additional bit to + * distinguish that this has happened. Hashing long strings saves space and + * ensures that we won't overrun the maximum entry length for a GIN index. + * (But JGIN_MAXLENGTH is quite a bit shorter than GIN's limit. It's chosen + * to ensure that the on-disk text datum will have a short varlena header.) + * Note that when any hashed item appears in a query, we must recheck index + * matches against the heap tuple; currently, this costs nothing because we + * must always recheck for other reasons. + */ +#define JGINFLAG_KEY 0x01 /* key (or string array element) */ +#define JGINFLAG_NULL 0x02 /* null value */ +#define JGINFLAG_BOOL 0x03 /* boolean value */ +#define JGINFLAG_NUM 0x04 /* numeric value */ +#define JGINFLAG_STR 0x05 /* string value (if not an array element) */ +#define JGINFLAG_HASHED 0x10 /* OR'd into flag if value was hashed */ +#define JGIN_MAXLENGTH 125 /* max length of text part before hashing */ + +typedef struct JsonbPair JsonbPair; +typedef struct JsonbValue JsonbValue; + +/* + * Jsonbs are varlena objects, so must meet the varlena convention that the + * first int32 of the object contains the total object size in bytes. Be sure + * to use VARSIZE() and SET_VARSIZE() to access it, though! + * + * Jsonb is the on-disk representation, in contrast to the in-memory JsonbValue + * representation. Often, JsonbValues are just shims through which a Jsonb + * buffer is accessed, but they can also be deep copied and passed around. + * + * Jsonb is a tree structure. Each node in the tree consists of a JEntry + * header and a variable-length content (possibly of zero size). The JEntry + * header indicates what kind of a node it is, e.g. a string or an array, + * and provides the length of its variable-length portion. + * + * The JEntry and the content of a node are not stored physically together. + * Instead, the container array or object has an array that holds the JEntrys + * of all the child nodes, followed by their variable-length portions. + * + * The root node is an exception; it has no parent array or object that could + * hold its JEntry. Hence, no JEntry header is stored for the root node. It + * is implicitly known that the root node must be an array or an object, + * so we can get away without the type indicator as long as we can distinguish + * the two. For that purpose, both an array and an object begin with a uint32 + * header field, which contains an JB_FOBJECT or JB_FARRAY flag. When a naked + * scalar value needs to be stored as a Jsonb value, what we actually store is + * an array with one element, with the flags in the array's header field set + * to JB_FSCALAR | JB_FARRAY. + * + * Overall, the Jsonb struct requires 4-bytes alignment. Within the struct, + * the variable-length portion of some node types is aligned to a 4-byte + * boundary, while others are not. When alignment is needed, the padding is + * in the beginning of the node that requires it. For example, if a numeric + * node is stored after a string node, so that the numeric node begins at + * offset 3, the variable-length portion of the numeric node will begin with + * one padding byte so that the actual numeric data is 4-byte aligned. + */ + +/* + * JEntry format. + * + * The least significant 28 bits store either the data length of the entry, + * or its end+1 offset from the start of the variable-length portion of the + * containing object. The next three bits store the type of the entry, and + * the high-order bit tells whether the least significant bits store a length + * or an offset. + * + * The reason for the offset-or-length complication is to compromise between + * access speed and data compressibility. In the initial design each JEntry + * always stored an offset, but this resulted in JEntry arrays with horrible + * compressibility properties, so that TOAST compression of a JSONB did not + * work well. Storing only lengths would greatly improve compressibility, + * but it makes random access into large arrays expensive (O(N) not O(1)). + * So what we do is store an offset in every JB_OFFSET_STRIDE'th JEntry and + * a length in the rest. This results in reasonably compressible data (as + * long as the stride isn't too small). We may have to examine as many as + * JB_OFFSET_STRIDE JEntrys in order to find out the offset or length of any + * given item, but that's still O(1) no matter how large the container is. + * + * We could avoid eating a flag bit for this purpose if we were to store + * the stride in the container header, or if we were willing to treat the + * stride as an unchangeable constant. Neither of those options is very + * attractive though. + */ +typedef uint32 JEntry; + +#define JENTRY_OFFLENMASK 0x0FFFFFFF +#define JENTRY_TYPEMASK 0x70000000 +#define JENTRY_HAS_OFF 0x80000000 + +/* values stored in the type bits */ +#define JENTRY_ISSTRING 0x00000000 +#define JENTRY_ISNUMERIC 0x10000000 +#define JENTRY_ISBOOL_FALSE 0x20000000 +#define JENTRY_ISBOOL_TRUE 0x30000000 +#define JENTRY_ISNULL 0x40000000 +#define JENTRY_ISCONTAINER 0x50000000 /* array or object */ + +/* Access macros. Note possible multiple evaluations */ +#define JBE_OFFLENFLD(je_) ((je_) & JENTRY_OFFLENMASK) +#define JBE_HAS_OFF(je_) (((je_) & JENTRY_HAS_OFF) != 0) +#define JBE_ISSTRING(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISSTRING) +#define JBE_ISNUMERIC(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNUMERIC) +#define JBE_ISCONTAINER(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISCONTAINER) +#define JBE_ISNULL(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNULL) +#define JBE_ISBOOL_TRUE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_TRUE) +#define JBE_ISBOOL_FALSE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_FALSE) +#define JBE_ISBOOL(je_) (JBE_ISBOOL_TRUE(je_) || JBE_ISBOOL_FALSE(je_)) + +/* Macro for advancing an offset variable to the next JEntry */ +#define JBE_ADVANCE_OFFSET(offset, je) \ + do { \ + JEntry je_ = (je); \ + if (JBE_HAS_OFF(je_)) \ + (offset) = JBE_OFFLENFLD(je_); \ + else \ + (offset) += JBE_OFFLENFLD(je_); \ + } while(0) + +/* + * We store an offset, not a length, every JB_OFFSET_STRIDE children. + * Caution: this macro should only be referenced when creating a JSONB + * value. When examining an existing value, pay attention to the HAS_OFF + * bits instead. This allows changes in the offset-placement heuristic + * without breaking on-disk compatibility. + */ +#define JB_OFFSET_STRIDE 32 + +/* + * A jsonb array or object node, within a Jsonb Datum. + * + * An array has one child for each element, stored in array order. + * + * An object has two children for each key/value pair. The keys all appear + * first, in key sort order; then the values appear, in an order matching the + * key order. This arrangement keeps the keys compact in memory, making a + * search for a particular key more cache-friendly. + */ +typedef struct JsonbContainer +{ + uint32 header; /* number of elements or key/value pairs, and + * flags */ + JEntry children[FLEXIBLE_ARRAY_MEMBER]; + + /* the data for each child node follows. */ +} JsonbContainer; + +/* flags for the header-field in JsonbContainer */ +#define JB_CMASK 0x0FFFFFFF /* mask for count field */ +#define JB_FSCALAR 0x10000000 /* flag bits */ +#define JB_FOBJECT 0x20000000 +#define JB_FARRAY 0x40000000 + +/* convenience macros for accessing a JsonbContainer struct */ +#define JsonContainerSize(jc) ((jc)->header & JB_CMASK) +#define JsonContainerIsScalar(jc) (((jc)->header & JB_FSCALAR) != 0) +#define JsonContainerIsObject(jc) (((jc)->header & JB_FOBJECT) != 0) +#define JsonContainerIsArray(jc) (((jc)->header & JB_FARRAY) != 0) + +/* The top-level on-disk format for a jsonb datum. */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + JsonbContainer root; +} Jsonb; + +/* convenience macros for accessing the root container in a Jsonb datum */ +#define JB_ROOT_COUNT(jbp_) (*(uint32 *) VARDATA(jbp_) & JB_CMASK) +#define JB_ROOT_IS_SCALAR(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FSCALAR) != 0) +#define JB_ROOT_IS_OBJECT(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FOBJECT) != 0) +#define JB_ROOT_IS_ARRAY(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FARRAY) != 0) + + +enum jbvType +{ + /* Scalar types */ + jbvNull = 0x0, + jbvString, + jbvNumeric, + jbvBool, + /* Composite types */ + jbvArray = 0x10, + jbvObject, + /* Binary (i.e. struct Jsonb) jbvArray/jbvObject */ + jbvBinary, + + /* + * Virtual types. + * + * These types are used only for in-memory JSON processing and serialized + * into JSON strings when outputted to json/jsonb. + */ + jbvDatetime = 0x20, +}; + +/* + * JsonbValue: In-memory representation of Jsonb. This is a convenient + * deserialized representation, that can easily support using the "val" + * union across underlying types during manipulation. The Jsonb on-disk + * representation has various alignment considerations. + */ +struct JsonbValue +{ + enum jbvType type; /* Influences sort order */ + + union + { + Numeric numeric; + bool boolean; + struct + { + int len; + char *val; /* Not necessarily null-terminated */ + } string; /* String primitive type */ + + struct + { + int nElems; + JsonbValue *elems; + bool rawScalar; /* Top-level "raw scalar" array? */ + } array; /* Array container type */ + + struct + { + int nPairs; /* 1 pair, 2 elements */ + JsonbPair *pairs; + } object; /* Associative container type */ + + struct + { + int len; + JsonbContainer *data; + } binary; /* Array or object, in on-disk format */ + + struct + { + Datum value; + Oid typid; + int32 typmod; + int tz; /* Numeric time zone, in seconds, for + * TimestampTz data type */ + } datetime; + } val; +}; + +#define IsAJsonbScalar(jsonbval) (((jsonbval)->type >= jbvNull && \ + (jsonbval)->type <= jbvBool) || \ + (jsonbval)->type == jbvDatetime) + +/* + * Key/value pair within an Object. + * + * This struct type is only used briefly while constructing a Jsonb; it is + * *not* the on-disk representation. + * + * Pairs with duplicate keys are de-duplicated. We store the originally + * observed pair ordering for the purpose of removing duplicates in a + * well-defined way (which is "last observed wins"). + */ +struct JsonbPair +{ + JsonbValue key; /* Must be a jbvString */ + JsonbValue value; /* May be of any type */ + uint32 order; /* Pair's index in original sequence */ +}; + +/* Conversion state used when parsing Jsonb from text, or for type coercion */ +typedef struct JsonbParseState +{ + JsonbValue contVal; + Size size; + struct JsonbParseState *next; + bool unique_keys; /* Check object key uniqueness */ + bool skip_nulls; /* Skip null object fields */ +} JsonbParseState; + +/* + * JsonbIterator holds details of the type for each iteration. It also stores a + * Jsonb varlena buffer, which can be directly accessed in some contexts. + */ +typedef enum +{ + JBI_ARRAY_START, + JBI_ARRAY_ELEM, + JBI_OBJECT_START, + JBI_OBJECT_KEY, + JBI_OBJECT_VALUE, +} JsonbIterState; + +typedef struct JsonbIterator +{ + /* Container being iterated */ + JsonbContainer *container; + uint32 nElems; /* Number of elements in children array (will + * be nPairs for objects) */ + bool isScalar; /* Pseudo-array scalar value? */ + JEntry *children; /* JEntrys for child nodes */ + /* Data proper. This points to the beginning of the variable-length data */ + char *dataProper; + + /* Current item in buffer (up to nElems) */ + int curIndex; + + /* Data offset corresponding to current item */ + uint32 curDataOffset; + + /* + * If the container is an object, we want to return keys and values + * alternately; so curDataOffset points to the current key, and + * curValueOffset points to the current value. + */ + uint32 curValueOffset; + + /* Private state */ + JsonbIterState state; + + struct JsonbIterator *parent; +} JsonbIterator; + + +/* Convenience macros */ +static inline Jsonb * +DatumGetJsonbP(Datum d) +{ + return (Jsonb *) PG_DETOAST_DATUM(d); +} + +static inline Jsonb * +DatumGetJsonbPCopy(Datum d) +{ + return (Jsonb *) PG_DETOAST_DATUM_COPY(d); +} + +static inline Datum +JsonbPGetDatum(const Jsonb *p) +{ + return PointerGetDatum(p); +} + +#define PG_GETARG_JSONB_P(x) DatumGetJsonbP(PG_GETARG_DATUM(x)) +#define PG_GETARG_JSONB_P_COPY(x) DatumGetJsonbPCopy(PG_GETARG_DATUM(x)) +#define PG_RETURN_JSONB_P(x) PG_RETURN_POINTER(x) + +/* Support functions */ +extern uint32 getJsonbOffset(const JsonbContainer *jc, int index); +extern uint32 getJsonbLength(const JsonbContainer *jc, int index); +extern int compareJsonbContainers(JsonbContainer *a, JsonbContainer *b); +extern JsonbValue *findJsonbValueFromContainer(JsonbContainer *container, + uint32 flags, + JsonbValue *key); +extern JsonbValue *getKeyJsonValueFromContainer(JsonbContainer *container, + const char *keyVal, int keyLen, + JsonbValue *res); +extern JsonbValue *getIthJsonbValueFromContainer(JsonbContainer *container, + uint32 i); +extern JsonbValue *pushJsonbValue(JsonbParseState **pstate, + JsonbIteratorToken seq, JsonbValue *jbval); +extern JsonbIterator *JsonbIteratorInit(JsonbContainer *container); +extern JsonbIteratorToken JsonbIteratorNext(JsonbIterator **it, JsonbValue *val, + bool skipNested); +extern void JsonbToJsonbValue(Jsonb *jsonb, JsonbValue *val); +extern Jsonb *JsonbValueToJsonb(JsonbValue *val); +extern bool JsonbDeepContains(JsonbIterator **val, + JsonbIterator **mContained); +extern void JsonbHashScalarValue(const JsonbValue *scalarVal, uint32 *hash); +extern void JsonbHashScalarValueExtended(const JsonbValue *scalarVal, + uint64 *hash, uint64 seed); + +/* jsonb.c support functions */ +extern char *JsonbToCString(StringInfo out, JsonbContainer *in, + int estimated_len); +extern char *JsonbToCStringIndent(StringInfo out, JsonbContainer *in, + int estimated_len); +extern char *JsonbUnquote(Jsonb *jb); +extern bool JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res); +extern const char *JsonbTypeName(JsonbValue *val); + +extern Datum jsonb_set_element(Jsonb *jb, Datum *path, int path_len, + JsonbValue *newval); +extern Datum jsonb_get_element(Jsonb *jb, Datum *path, int npath, + bool *isnull, bool as_text); +extern bool to_jsonb_is_immutable(Oid typoid); +extern Datum jsonb_build_object_worker(int nargs, const Datum *args, const bool *nulls, + const Oid *types, bool absent_on_null, + bool unique_keys); +extern Datum jsonb_build_array_worker(int nargs, const Datum *args, const bool *nulls, + const Oid *types, bool absent_on_null); + +#endif /* __JSONB_H__ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/jsonfuncs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/jsonfuncs.h new file mode 100644 index 0000000..ebbab6f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/jsonfuncs.h @@ -0,0 +1,99 @@ +/*------------------------------------------------------------------------- + * + * jsonfuncs.h + * Functions to process JSON data types. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/jsonfuncs.h + * + *------------------------------------------------------------------------- + */ + +#ifndef JSONFUNCS_H +#define JSONFUNCS_H + +#include "common/jsonapi.h" +#include "nodes/nodes.h" +#include "utils/jsonb.h" + +/* + * Flag types for iterate_json(b)_values to specify what elements from a + * json(b) document we want to iterate. + */ +typedef enum JsonToIndex +{ + jtiKey = 0x01, + jtiString = 0x02, + jtiNumeric = 0x04, + jtiBool = 0x08, + jtiAll = jtiKey | jtiString | jtiNumeric | jtiBool +} JsonToIndex; + +/* an action that will be applied to each value in iterate_json(b)_values functions */ +typedef void (*JsonIterateStringValuesAction) (void *state, char *elem_value, int elem_len); + +/* an action that will be applied to each value in transform_json(b)_values functions */ +typedef text *(*JsonTransformStringValuesAction) (void *state, char *elem_value, int elem_len); + +/* build a JsonLexContext from a text datum; see also freeJsonLexContext */ +extern JsonLexContext *makeJsonLexContext(JsonLexContext *lex, text *json, bool need_escapes); + +/* try to parse json, and errsave(escontext) on failure */ +extern bool pg_parse_json_or_errsave(JsonLexContext *lex, const JsonSemAction *sem, + struct Node *escontext); + +#define pg_parse_json_or_ereport(lex, sem) \ + (void) pg_parse_json_or_errsave(lex, sem, NULL) + +/* save an error during json lexing or parsing */ +extern void json_errsave_error(JsonParseErrorType error, JsonLexContext *lex, + struct Node *escontext); + +/* get first JSON token */ +extern JsonTokenType json_get_first_token(text *json, bool throw_error); + +extern uint32 parse_jsonb_index_flags(Jsonb *jb); +extern void iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state, + JsonIterateStringValuesAction action); +extern void iterate_json_values(text *json, uint32 flags, void *action_state, + JsonIterateStringValuesAction action); +extern Jsonb *transform_jsonb_string_values(Jsonb *jsonb, void *action_state, + JsonTransformStringValuesAction transform_action); +extern text *transform_json_string_values(text *json, void *action_state, + JsonTransformStringValuesAction transform_action); + +/* Type categories returned by json_categorize_type */ +typedef enum +{ + JSONTYPE_NULL, /* null, so we didn't bother to identify */ + JSONTYPE_BOOL, /* boolean (built-in types only) */ + JSONTYPE_NUMERIC, /* numeric (ditto) */ + JSONTYPE_DATE, /* we use special formatting for datetimes */ + JSONTYPE_TIMESTAMP, + JSONTYPE_TIMESTAMPTZ, + JSONTYPE_JSON, /* JSON (and JSONB, if not is_jsonb) */ + JSONTYPE_JSONB, /* JSONB (if is_jsonb) */ + JSONTYPE_ARRAY, /* array */ + JSONTYPE_COMPOSITE, /* composite */ + JSONTYPE_CAST, /* something with an explicit cast to JSON */ + JSONTYPE_OTHER, /* all else */ +} JsonTypeCategory; + +extern void json_categorize_type(Oid typoid, bool is_jsonb, + JsonTypeCategory *tcategory, Oid *outfuncoid); +extern Datum datum_to_json(Datum val, JsonTypeCategory tcategory, + Oid outfuncoid); +extern Datum datum_to_jsonb(Datum val, JsonTypeCategory tcategory, + Oid outfuncoid); +extern Datum jsonb_from_text(text *js, bool unique_keys); + +extern Datum json_populate_type(Datum json_val, Oid json_type, + Oid typid, int32 typmod, + void **cache, MemoryContext mcxt, + bool *isnull, + bool omit_quotes, + Node *escontext); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/jsonpath.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/jsonpath.h new file mode 100644 index 0000000..23a76d2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/jsonpath.h @@ -0,0 +1,310 @@ +/*------------------------------------------------------------------------- + * + * jsonpath.h + * Definitions for jsonpath datatype + * + * Copyright (c) 2019-2025, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/utils/jsonpath.h + * + *------------------------------------------------------------------------- + */ + +#ifndef JSONPATH_H +#define JSONPATH_H + +#include "executor/tablefunc.h" +#include "fmgr.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "utils/jsonb.h" + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint32 header; /* version and flags (see below) */ + char data[FLEXIBLE_ARRAY_MEMBER]; +} JsonPath; + +#define JSONPATH_VERSION (0x01) +#define JSONPATH_LAX (0x80000000) +#define JSONPATH_HDRSZ (offsetof(JsonPath, data)) + +static inline JsonPath * +DatumGetJsonPathP(Datum d) +{ + return (JsonPath *) PG_DETOAST_DATUM(d); +} + +static inline JsonPath * +DatumGetJsonPathPCopy(Datum d) +{ + return (JsonPath *) PG_DETOAST_DATUM_COPY(d); +} + +#define PG_GETARG_JSONPATH_P(x) DatumGetJsonPathP(PG_GETARG_DATUM(x)) +#define PG_GETARG_JSONPATH_P_COPY(x) DatumGetJsonPathPCopy(PG_GETARG_DATUM(x)) +#define PG_RETURN_JSONPATH_P(p) PG_RETURN_POINTER(p) + +#define jspIsScalar(type) ((type) >= jpiNull && (type) <= jpiBool) + +/* + * All node's type of jsonpath expression + * + * These become part of the on-disk representation of the jsonpath type. + * Therefore, to preserve pg_upgradability, the order must not be changed, and + * new values must be added at the end. + * + * It is recommended that switch cases etc. in other parts of the code also + * use this order, to maintain some consistency. + */ +typedef enum JsonPathItemType +{ + jpiNull = jbvNull, /* NULL literal */ + jpiString = jbvString, /* string literal */ + jpiNumeric = jbvNumeric, /* numeric literal */ + jpiBool = jbvBool, /* boolean literal: TRUE or FALSE */ + jpiAnd, /* predicate && predicate */ + jpiOr, /* predicate || predicate */ + jpiNot, /* ! predicate */ + jpiIsUnknown, /* (predicate) IS UNKNOWN */ + jpiEqual, /* expr == expr */ + jpiNotEqual, /* expr != expr */ + jpiLess, /* expr < expr */ + jpiGreater, /* expr > expr */ + jpiLessOrEqual, /* expr <= expr */ + jpiGreaterOrEqual, /* expr >= expr */ + jpiAdd, /* expr + expr */ + jpiSub, /* expr - expr */ + jpiMul, /* expr * expr */ + jpiDiv, /* expr / expr */ + jpiMod, /* expr % expr */ + jpiPlus, /* + expr */ + jpiMinus, /* - expr */ + jpiAnyArray, /* [*] */ + jpiAnyKey, /* .* */ + jpiIndexArray, /* [subscript, ...] */ + jpiAny, /* .** */ + jpiKey, /* .key */ + jpiCurrent, /* @ */ + jpiRoot, /* $ */ + jpiVariable, /* $variable */ + jpiFilter, /* ? (predicate) */ + jpiExists, /* EXISTS (expr) predicate */ + jpiType, /* .type() item method */ + jpiSize, /* .size() item method */ + jpiAbs, /* .abs() item method */ + jpiFloor, /* .floor() item method */ + jpiCeiling, /* .ceiling() item method */ + jpiDouble, /* .double() item method */ + jpiDatetime, /* .datetime() item method */ + jpiKeyValue, /* .keyvalue() item method */ + jpiSubscript, /* array subscript: 'expr' or 'expr TO expr' */ + jpiLast, /* LAST array subscript */ + jpiStartsWith, /* STARTS WITH predicate */ + jpiLikeRegex, /* LIKE_REGEX predicate */ + jpiBigint, /* .bigint() item method */ + jpiBoolean, /* .boolean() item method */ + jpiDate, /* .date() item method */ + jpiDecimal, /* .decimal() item method */ + jpiInteger, /* .integer() item method */ + jpiNumber, /* .number() item method */ + jpiStringFunc, /* .string() item method */ + jpiTime, /* .time() item method */ + jpiTimeTz, /* .time_tz() item method */ + jpiTimestamp, /* .timestamp() item method */ + jpiTimestampTz, /* .timestamp_tz() item method */ +} JsonPathItemType; + +/* XQuery regex mode flags for LIKE_REGEX predicate */ +#define JSP_REGEX_ICASE 0x01 /* i flag, case insensitive */ +#define JSP_REGEX_DOTALL 0x02 /* s flag, dot matches newline */ +#define JSP_REGEX_MLINE 0x04 /* m flag, ^/$ match at newlines */ +#define JSP_REGEX_WSPACE 0x08 /* x flag, ignore whitespace in pattern */ +#define JSP_REGEX_QUOTE 0x10 /* q flag, no special characters */ + +/* + * Support functions to parse/construct binary value. + * Unlike many other representation of expression the first/main + * node is not an operation but left operand of expression. That + * allows to implement cheap follow-path descending in jsonb + * structure and then execute operator with right operand + */ + +typedef struct JsonPathItem +{ + JsonPathItemType type; + + /* position form base to next node */ + int32 nextPos; + + /* + * pointer into JsonPath value to current node, all positions of current + * are relative to this base + */ + char *base; + + union + { + /* classic operator with two operands: and, or etc */ + struct + { + int32 left; + int32 right; + } args; + + /* any unary operation */ + int32 arg; + + /* storage for jpiIndexArray: indexes of array */ + struct + { + int32 nelems; + struct + { + int32 from; + int32 to; + } *elems; + } array; + + /* jpiAny: levels */ + struct + { + uint32 first; + uint32 last; + } anybounds; + + struct + { + char *data; /* for bool, numeric and string/key */ + int32 datalen; /* filled only for string/key */ + } value; + + struct + { + int32 expr; + char *pattern; + int32 patternlen; + uint32 flags; + } like_regex; + } content; +} JsonPathItem; + +#define jspHasNext(jsp) ((jsp)->nextPos > 0) + +extern void jspInit(JsonPathItem *v, JsonPath *js); +extern void jspInitByBuffer(JsonPathItem *v, char *base, int32 pos); +extern bool jspGetNext(JsonPathItem *v, JsonPathItem *a); +extern void jspGetArg(JsonPathItem *v, JsonPathItem *a); +extern void jspGetLeftArg(JsonPathItem *v, JsonPathItem *a); +extern void jspGetRightArg(JsonPathItem *v, JsonPathItem *a); +extern Numeric jspGetNumeric(JsonPathItem *v); +extern bool jspGetBool(JsonPathItem *v); +extern char *jspGetString(JsonPathItem *v, int32 *len); +extern bool jspGetArraySubscript(JsonPathItem *v, JsonPathItem *from, + JsonPathItem *to, int i); +extern bool jspIsMutable(JsonPath *path, List *varnames, List *varexprs); + +extern const char *jspOperationName(JsonPathItemType type); + +/* + * Parsing support data structures. + */ + +typedef struct JsonPathParseItem JsonPathParseItem; + +struct JsonPathParseItem +{ + JsonPathItemType type; + JsonPathParseItem *next; /* next in path */ + + union + { + + /* classic operator with two operands: and, or etc */ + struct + { + JsonPathParseItem *left; + JsonPathParseItem *right; + } args; + + /* any unary operation */ + JsonPathParseItem *arg; + + /* storage for jpiIndexArray: indexes of array */ + struct + { + int nelems; + struct + { + JsonPathParseItem *from; + JsonPathParseItem *to; + } *elems; + } array; + + /* jpiAny: levels */ + struct + { + uint32 first; + uint32 last; + } anybounds; + + struct + { + JsonPathParseItem *expr; + char *pattern; /* could not be not null-terminated */ + uint32 patternlen; + uint32 flags; + } like_regex; + + /* scalars */ + Numeric numeric; + bool boolean; + struct + { + uint32 len; + char *val; /* could not be not null-terminated */ + } string; + } value; +}; + +typedef struct JsonPathParseResult +{ + JsonPathParseItem *expr; + bool lax; +} JsonPathParseResult; + +extern JsonPathParseResult *parsejsonpath(const char *str, int len, + struct Node *escontext); + +extern bool jspConvertRegexFlags(uint32 xflags, int *result, + struct Node *escontext); + +/* + * Struct for details about external variables passed into jsonpath executor + */ +typedef struct JsonPathVariable +{ + char *name; + int namelen; /* strlen(name) as cache for GetJsonPathVar() */ + Oid typid; + int32 typmod; + Datum value; + bool isnull; +} JsonPathVariable; + + +/* SQL/JSON query functions */ +extern bool JsonPathExists(Datum jb, JsonPath *jp, bool *error, List *vars); +extern Datum JsonPathQuery(Datum jb, JsonPath *jp, JsonWrapper wrapper, + bool *empty, bool *error, List *vars, + const char *column_name); +extern JsonbValue *JsonPathValue(Datum jb, JsonPath *jp, bool *empty, + bool *error, List *vars, + const char *column_name); + +/* For JSON_TABLE() */ +extern PGDLLIMPORT const TableFuncRoutine JsonbTableRoutine; + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/logtape.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/logtape.h new file mode 100644 index 0000000..0eedece --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/logtape.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------------- + * + * logtape.h + * Management of "logical tapes" within temporary files. + * + * See logtape.c for explanations. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/logtape.h + * + *------------------------------------------------------------------------- + */ + +#ifndef LOGTAPE_H +#define LOGTAPE_H + +#include "storage/sharedfileset.h" + +/* + * LogicalTapeSet and LogicalTape are opaque types whose details are not + * known outside logtape.c. + */ +typedef struct LogicalTapeSet LogicalTapeSet; +typedef struct LogicalTape LogicalTape; + + +/* + * The approach tuplesort.c takes to parallel external sorts is that workers, + * whose state is almost the same as independent serial sorts, are made to + * produce a final materialized tape of sorted output in all cases. This is + * frozen, just like any case requiring a final materialized tape. However, + * there is one difference, which is that freezing will also export an + * underlying shared fileset BufFile for sharing. Freezing produces TapeShare + * metadata for the worker when this happens, which is passed along through + * shared memory to leader. + * + * The leader process can then pass an array of TapeShare metadata (one per + * worker participant) to LogicalTapeSetCreate(), alongside a handle to a + * shared fileset, which is sufficient to construct a new logical tapeset that + * consists of each of the tapes materialized by workers. + * + * Note that while logtape.c does create an empty leader tape at the end of the + * tapeset in the leader case, it can never be written to due to a restriction + * in the shared buffile infrastructure. + */ +typedef struct TapeShare +{ + /* + * Currently, all the leader process needs is the location of the + * materialized tape's first block. + */ + int64 firstblocknumber; +} TapeShare; + +/* + * prototypes for functions in logtape.c + */ + +extern LogicalTapeSet *LogicalTapeSetCreate(bool preallocate, + SharedFileSet *fileset, int worker); +extern void LogicalTapeClose(LogicalTape *lt); +extern void LogicalTapeSetClose(LogicalTapeSet *lts); +extern LogicalTape *LogicalTapeCreate(LogicalTapeSet *lts); +extern LogicalTape *LogicalTapeImport(LogicalTapeSet *lts, int worker, TapeShare *shared); +extern void LogicalTapeSetForgetFreeSpace(LogicalTapeSet *lts); +extern size_t LogicalTapeRead(LogicalTape *lt, void *ptr, size_t size); +extern void LogicalTapeWrite(LogicalTape *lt, const void *ptr, size_t size); +extern void LogicalTapeRewindForRead(LogicalTape *lt, size_t buffer_size); +extern void LogicalTapeFreeze(LogicalTape *lt, TapeShare *share); +extern size_t LogicalTapeBackspace(LogicalTape *lt, size_t size); +extern void LogicalTapeSeek(LogicalTape *lt, int64 blocknum, int offset); +extern void LogicalTapeTell(LogicalTape *lt, int64 *blocknum, int *offset); +extern int64 LogicalTapeSetBlocks(LogicalTapeSet *lts); + +#endif /* LOGTAPE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/lsyscache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/lsyscache.h new file mode 100644 index 0000000..fa7c7e0 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/lsyscache.h @@ -0,0 +1,220 @@ +/*------------------------------------------------------------------------- + * + * lsyscache.h + * Convenience routines for common queries in the system catalog cache. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/lsyscache.h + * + *------------------------------------------------------------------------- + */ +#ifndef LSYSCACHE_H +#define LSYSCACHE_H + +#include "access/attnum.h" +#include "access/cmptype.h" +#include "access/htup.h" +#include "nodes/pg_list.h" + +/* avoid including subscripting.h here */ +struct SubscriptRoutines; + +/* Result list element for get_op_index_interpretation */ +typedef struct OpIndexInterpretation +{ + Oid opfamily_id; /* opfamily containing operator */ + CompareType cmptype; /* its generic comparison type */ + Oid oplefttype; /* declared left input datatype */ + Oid oprighttype; /* declared right input datatype */ +} OpIndexInterpretation; + +/* I/O function selector for get_type_io_data */ +typedef enum IOFuncSelector +{ + IOFunc_input, + IOFunc_output, + IOFunc_receive, + IOFunc_send, +} IOFuncSelector; + +/* Flag bits for get_attstatsslot */ +#define ATTSTATSSLOT_VALUES 0x01 +#define ATTSTATSSLOT_NUMBERS 0x02 + +/* Result struct for get_attstatsslot */ +typedef struct AttStatsSlot +{ + /* Always filled: */ + Oid staop; /* Actual staop for the found slot */ + Oid stacoll; /* Actual collation for the found slot */ + /* Filled if ATTSTATSSLOT_VALUES is specified: */ + Oid valuetype; /* Actual datatype of the values */ + Datum *values; /* slot's "values" array, or NULL if none */ + int nvalues; /* length of values[], or 0 */ + /* Filled if ATTSTATSSLOT_NUMBERS is specified: */ + float4 *numbers; /* slot's "numbers" array, or NULL if none */ + int nnumbers; /* length of numbers[], or 0 */ + + /* Remaining fields are private to get_attstatsslot/free_attstatsslot */ + void *values_arr; /* palloc'd values array, if any */ + void *numbers_arr; /* palloc'd numbers array, if any */ +} AttStatsSlot; + +/* Hook for plugins to get control in get_attavgwidth() */ +typedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum); +extern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook; + +extern bool op_in_opfamily(Oid opno, Oid opfamily); +extern int get_op_opfamily_strategy(Oid opno, Oid opfamily); +extern Oid get_op_opfamily_sortfamily(Oid opno, Oid opfamily); +extern void get_op_opfamily_properties(Oid opno, Oid opfamily, bool ordering_op, + int *strategy, + Oid *lefttype, + Oid *righttype); +extern Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, + int16 strategy); +extern Oid get_opfamily_member_for_cmptype(Oid opfamily, Oid lefttype, Oid righttype, + CompareType cmptype); +extern bool get_ordering_op_properties(Oid opno, + Oid *opfamily, Oid *opcintype, CompareType *cmptype); +extern Oid get_equality_op_for_ordering_op(Oid opno, bool *reverse); +extern Oid get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type); +extern List *get_mergejoin_opfamilies(Oid opno); +extern bool get_compatible_hash_operators(Oid opno, + Oid *lhs_opno, Oid *rhs_opno); +extern bool get_op_hash_functions(Oid opno, + RegProcedure *lhs_procno, RegProcedure *rhs_procno); +extern List *get_op_index_interpretation(Oid opno); +extern bool equality_ops_are_compatible(Oid opno1, Oid opno2); +extern bool comparison_ops_are_compatible(Oid opno1, Oid opno2); +extern Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, + int16 procnum); +extern char *get_attname(Oid relid, AttrNumber attnum, bool missing_ok); +extern AttrNumber get_attnum(Oid relid, const char *attname); +extern char get_attgenerated(Oid relid, AttrNumber attnum); +extern Oid get_atttype(Oid relid, AttrNumber attnum); +extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum, + Oid *typid, int32 *typmod, Oid *collid); +extern Datum get_attoptions(Oid relid, int16 attnum); +extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok); +extern char *get_collation_name(Oid colloid); +extern bool get_collation_isdeterministic(Oid colloid); +extern char *get_constraint_name(Oid conoid); +extern Oid get_constraint_index(Oid conoid); +extern char get_constraint_type(Oid conoid); + +extern char *get_language_name(Oid langoid, bool missing_ok); +extern Oid get_opclass_family(Oid opclass); +extern Oid get_opclass_input_type(Oid opclass); +extern bool get_opclass_opfamily_and_input_type(Oid opclass, + Oid *opfamily, Oid *opcintype); +extern Oid get_opclass_method(Oid opclass); +extern Oid get_opfamily_method(Oid opfid); +extern char *get_opfamily_name(Oid opfid, bool missing_ok); +extern RegProcedure get_opcode(Oid opno); +extern char *get_opname(Oid opno); +extern Oid get_op_rettype(Oid opno); +extern void op_input_types(Oid opno, Oid *lefttype, Oid *righttype); +extern bool op_mergejoinable(Oid opno, Oid inputtype); +extern bool op_hashjoinable(Oid opno, Oid inputtype); +extern bool op_strict(Oid opno); +extern char op_volatile(Oid opno); +extern Oid get_commutator(Oid opno); +extern Oid get_negator(Oid opno); +extern RegProcedure get_oprrest(Oid opno); +extern RegProcedure get_oprjoin(Oid opno); +extern char *get_func_name(Oid funcid); +extern Oid get_func_namespace(Oid funcid); +extern Oid get_func_rettype(Oid funcid); +extern int get_func_nargs(Oid funcid); +extern Oid get_func_signature(Oid funcid, Oid **argtypes, int *nargs); +extern Oid get_func_variadictype(Oid funcid); +extern bool get_func_retset(Oid funcid); +extern bool func_strict(Oid funcid); +extern char func_volatile(Oid funcid); +extern char func_parallel(Oid funcid); +extern char get_func_prokind(Oid funcid); +extern bool get_func_leakproof(Oid funcid); +extern RegProcedure get_func_support(Oid funcid); +extern Oid get_relname_relid(const char *relname, Oid relnamespace); +extern char *get_rel_name(Oid relid); +extern Oid get_rel_namespace(Oid relid); +extern Oid get_rel_type_id(Oid relid); +extern char get_rel_relkind(Oid relid); +extern bool get_rel_relispartition(Oid relid); +extern Oid get_rel_tablespace(Oid relid); +extern char get_rel_persistence(Oid relid); +extern Oid get_rel_relam(Oid relid); +extern Oid get_transform_fromsql(Oid typid, Oid langid, List *trftypes); +extern Oid get_transform_tosql(Oid typid, Oid langid, List *trftypes); +extern bool get_typisdefined(Oid typid); +extern int16 get_typlen(Oid typid); +extern bool get_typbyval(Oid typid); +extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval); +extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, + char *typalign); +extern Oid getTypeIOParam(HeapTuple typeTuple); +extern void get_type_io_data(Oid typid, + IOFuncSelector which_func, + int16 *typlen, + bool *typbyval, + char *typalign, + char *typdelim, + Oid *typioparam, + Oid *func); +extern char get_typstorage(Oid typid); +extern Node *get_typdefault(Oid typid); +extern char get_typtype(Oid typid); +extern bool type_is_rowtype(Oid typid); +extern bool type_is_enum(Oid typid); +extern bool type_is_range(Oid typid); +extern bool type_is_multirange(Oid typid); +extern void get_type_category_preferred(Oid typid, + char *typcategory, + bool *typispreferred); +extern Oid get_typ_typrelid(Oid typid); +extern Oid get_element_type(Oid typid); +extern Oid get_array_type(Oid typid); +extern Oid get_promoted_array_type(Oid typid); +extern Oid get_base_element_type(Oid typid); +extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam); +extern void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena); +extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam); +extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena); +extern Oid get_typmodin(Oid typid); +extern Oid get_typcollation(Oid typid); +extern bool type_is_collatable(Oid typid); +extern RegProcedure get_typsubscript(Oid typid, Oid *typelemp); +extern const struct SubscriptRoutines *getSubscriptingRoutines(Oid typid, + Oid *typelemp); +extern Oid getBaseType(Oid typid); +extern Oid getBaseTypeAndTypmod(Oid typid, int32 *typmod); +extern int32 get_typavgwidth(Oid typid, int32 typmod); +extern int32 get_attavgwidth(Oid relid, AttrNumber attnum); +extern bool get_attstatsslot(AttStatsSlot *sslot, HeapTuple statstuple, + int reqkind, Oid reqop, int flags); +extern void free_attstatsslot(AttStatsSlot *sslot); +extern char *get_namespace_name(Oid nspid); +extern char *get_namespace_name_or_temp(Oid nspid); +extern Oid get_range_subtype(Oid rangeOid); +extern Oid get_range_collation(Oid rangeOid); +extern Oid get_range_multirange(Oid rangeOid); +extern Oid get_multirange_range(Oid multirangeOid); +extern Oid get_index_column_opclass(Oid index_oid, int attno); +extern bool get_index_isreplident(Oid index_oid); +extern bool get_index_isvalid(Oid index_oid); +extern bool get_index_isclustered(Oid index_oid); +extern Oid get_publication_oid(const char *pubname, bool missing_ok); +extern char *get_publication_name(Oid pubid, bool missing_ok); +extern Oid get_subscription_oid(const char *subname, bool missing_ok); +extern char *get_subscription_name(Oid subid, bool missing_ok); + +#define type_is_array(typid) (get_element_type(typid) != InvalidOid) +/* type_is_array_domain accepts both plain arrays and domains over arrays */ +#define type_is_array_domain(typid) (get_base_element_type(typid) != InvalidOid) + +#define TypeIsToastable(typid) (get_typstorage(typid) != TYPSTORAGE_PLAIN) + +#endif /* LSYSCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memdebug.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memdebug.h new file mode 100644 index 0000000..7309271 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memdebug.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------------------- + * + * memdebug.h + * Memory debugging support. + * + * Currently, this file either wraps or substitutes + * empty definitions for Valgrind client request macros we use. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/memdebug.h + * + *------------------------------------------------------------------------- + */ +#ifndef MEMDEBUG_H +#define MEMDEBUG_H + +#ifdef USE_VALGRIND +#include +#else +#define VALGRIND_CHECK_MEM_IS_DEFINED(addr, size) do {} while (0) +#define VALGRIND_CREATE_MEMPOOL(context, redzones, zeroed) do {} while (0) +#define VALGRIND_DESTROY_MEMPOOL(context) do {} while (0) +#define VALGRIND_MAKE_MEM_DEFINED(addr, size) do {} while (0) +#define VALGRIND_MAKE_MEM_NOACCESS(addr, size) do {} while (0) +#define VALGRIND_MAKE_MEM_UNDEFINED(addr, size) do {} while (0) +#define VALGRIND_MEMPOOL_ALLOC(context, addr, size) do {} while (0) +#define VALGRIND_MEMPOOL_FREE(context, addr) do {} while (0) +#define VALGRIND_MEMPOOL_CHANGE(context, optr, nptr, size) do {} while (0) +#endif + + +#ifdef CLOBBER_FREED_MEMORY + +/* Wipe freed memory for debugging purposes */ +static inline void +wipe_mem(void *ptr, size_t size) +{ + VALGRIND_MAKE_MEM_UNDEFINED(ptr, size); + memset(ptr, 0x7F, size); + VALGRIND_MAKE_MEM_NOACCESS(ptr, size); +} + +#endif /* CLOBBER_FREED_MEMORY */ + +#ifdef MEMORY_CONTEXT_CHECKING + +static inline void +set_sentinel(void *base, Size offset) +{ + char *ptr = (char *) base + offset; + + VALGRIND_MAKE_MEM_UNDEFINED(ptr, 1); + *ptr = 0x7E; + VALGRIND_MAKE_MEM_NOACCESS(ptr, 1); +} + +static inline bool +sentinel_ok(const void *base, Size offset) +{ + const char *ptr = (const char *) base + offset; + bool ret; + + VALGRIND_MAKE_MEM_DEFINED(ptr, 1); + ret = *ptr == 0x7E; + VALGRIND_MAKE_MEM_NOACCESS(ptr, 1); + + return ret; +} + +#endif /* MEMORY_CONTEXT_CHECKING */ + +#ifdef RANDOMIZE_ALLOCATED_MEMORY + +void randomize_mem(char *ptr, size_t size); + +#endif /* RANDOMIZE_ALLOCATED_MEMORY */ + + +#endif /* MEMDEBUG_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memutils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memutils.h new file mode 100644 index 0000000..8abc26a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memutils.h @@ -0,0 +1,322 @@ +/*------------------------------------------------------------------------- + * + * memutils.h + * This file contains declarations for memory allocation utility + * functions. These are functions that are not quite widely used + * enough to justify going in utils/palloc.h, but are still part + * of the API of the memory management subsystem. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/memutils.h + * + *------------------------------------------------------------------------- + */ +#ifndef MEMUTILS_H +#define MEMUTILS_H + +#include "nodes/memnodes.h" + + +/* + * MaxAllocSize, MaxAllocHugeSize + * Quasi-arbitrary limits on size of allocations. + * + * Note: + * There is no guarantee that smaller allocations will succeed, but + * larger requests will be summarily denied. + * + * palloc() enforces MaxAllocSize, chosen to correspond to the limiting size + * of varlena objects under TOAST. See VARSIZE_4B() and related macros in + * postgres.h. Many datatypes assume that any allocatable size can be + * represented in a varlena header. This limit also permits a caller to use + * an "int" variable for an index into or length of an allocation. Callers + * careful to avoid these hazards can access the higher limit with + * MemoryContextAllocHuge(). Both limits permit code to assume that it may + * compute twice an allocation's size without overflow. + */ +#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */ + +#define AllocSizeIsValid(size) ((Size) (size) <= MaxAllocSize) + +/* Must be less than SIZE_MAX */ +#define MaxAllocHugeSize (SIZE_MAX / 2) + +#define InvalidAllocSize SIZE_MAX + +#define AllocHugeSizeIsValid(size) ((Size) (size) <= MaxAllocHugeSize) + + +/* + * Standard top-level memory contexts. + * + * Only TopMemoryContext and ErrorContext are initialized by + * MemoryContextInit() itself. + */ +extern PGDLLIMPORT MemoryContext TopMemoryContext; +extern PGDLLIMPORT MemoryContext ErrorContext; +extern PGDLLIMPORT MemoryContext PostmasterContext; +extern PGDLLIMPORT MemoryContext CacheMemoryContext; +extern PGDLLIMPORT MemoryContext MessageContext; +extern PGDLLIMPORT MemoryContext TopTransactionContext; +extern PGDLLIMPORT MemoryContext CurTransactionContext; + +/* This is a transient link to the active portal's memory context: */ +extern PGDLLIMPORT MemoryContext PortalContext; + + +/* + * Memory-context-type-independent functions in mcxt.c + */ +extern void MemoryContextInit(void); +extern void MemoryContextReset(MemoryContext context); +extern void MemoryContextDelete(MemoryContext context); +extern void MemoryContextResetOnly(MemoryContext context); +extern void MemoryContextResetChildren(MemoryContext context); +extern void MemoryContextDeleteChildren(MemoryContext context); +extern void MemoryContextSetIdentifier(MemoryContext context, const char *id); +extern void MemoryContextSetParent(MemoryContext context, + MemoryContext new_parent); +extern MemoryContext GetMemoryChunkContext(void *pointer); +extern Size GetMemoryChunkSpace(void *pointer); +extern MemoryContext MemoryContextGetParent(MemoryContext context); +extern bool MemoryContextIsEmpty(MemoryContext context); +extern Size MemoryContextMemAllocated(MemoryContext context, bool recurse); +extern void MemoryContextMemConsumed(MemoryContext context, + MemoryContextCounters *consumed); +extern void MemoryContextStats(MemoryContext context); +extern void MemoryContextStatsDetail(MemoryContext context, + int max_level, int max_children, + bool print_to_stderr); +extern void MemoryContextAllowInCriticalSection(MemoryContext context, + bool allow); + +#ifdef MEMORY_CONTEXT_CHECKING +extern void MemoryContextCheck(MemoryContext context); +#endif + +/* Handy macro for copying and assigning context ID ... but note double eval */ +#define MemoryContextCopyAndSetIdentifier(cxt, id) \ + MemoryContextSetIdentifier(cxt, MemoryContextStrdup(cxt, id)) + +extern void HandleLogMemoryContextInterrupt(void); +extern void ProcessLogMemoryContextInterrupt(void); + +/* + * Memory-context-type-specific functions + */ + +/* aset.c */ +extern MemoryContext AllocSetContextCreateInternal(MemoryContext parent, + const char *name, + Size minContextSize, + Size initBlockSize, + Size maxBlockSize); + +/* + * This wrapper macro exists to check for non-constant strings used as context + * names; that's no longer supported. (Use MemoryContextSetIdentifier if you + * want to provide a variable identifier.) + */ +#ifdef HAVE__BUILTIN_CONSTANT_P +#define AllocSetContextCreate(parent, name, ...) \ + (StaticAssertExpr(__builtin_constant_p(name), \ + "memory context names must be constant strings"), \ + AllocSetContextCreateInternal(parent, name, __VA_ARGS__)) +#else +#define AllocSetContextCreate \ + AllocSetContextCreateInternal +#endif + +/* slab.c */ +extern MemoryContext SlabContextCreate(MemoryContext parent, + const char *name, + Size blockSize, + Size chunkSize); + +/* generation.c */ +extern MemoryContext GenerationContextCreate(MemoryContext parent, + const char *name, + Size minContextSize, + Size initBlockSize, + Size maxBlockSize); + +/* bump.c */ +extern MemoryContext BumpContextCreate(MemoryContext parent, + const char *name, + Size minContextSize, + Size initBlockSize, + Size maxBlockSize); + +/* + * Recommended default alloc parameters, suitable for "ordinary" contexts + * that might hold quite a lot of data. + */ +#define ALLOCSET_DEFAULT_MINSIZE 0 +#define ALLOCSET_DEFAULT_INITSIZE (8 * 1024) +#define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024) +#define ALLOCSET_DEFAULT_SIZES \ + ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE + +/* + * Recommended alloc parameters for "small" contexts that are never expected + * to contain much data (for example, a context to contain a query plan). + */ +#define ALLOCSET_SMALL_MINSIZE 0 +#define ALLOCSET_SMALL_INITSIZE (1 * 1024) +#define ALLOCSET_SMALL_MAXSIZE (8 * 1024) +#define ALLOCSET_SMALL_SIZES \ + ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_SMALL_MAXSIZE + +/* + * Recommended alloc parameters for contexts that should start out small, + * but might sometimes grow big. + */ +#define ALLOCSET_START_SMALL_SIZES \ + ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE + + +/* + * Threshold above which a request in an AllocSet context is certain to be + * allocated separately (and thereby have constant allocation overhead). + * Few callers should be interested in this, but tuplesort/tuplestore need + * to know it. + */ +#define ALLOCSET_SEPARATE_THRESHOLD 8192 + +#define SLAB_DEFAULT_BLOCK_SIZE (8 * 1024) +#define SLAB_LARGE_BLOCK_SIZE (8 * 1024 * 1024) + +/* + * pg_memory_is_all_zeros + * + * Test if a memory region starting at "ptr" and of size "len" is full of + * zeroes. + * + * The test is divided into multiple cases for safety reason and multiple + * phases for efficiency. + * + * Case 1: len < sizeof(size_t) bytes, then byte-by-byte comparison. + * Case 2: len < (sizeof(size_t) * 8 - 1) bytes: + * - Phase 1: byte-by-byte comparison, until the pointer is aligned. + * - Phase 2: size_t comparisons, with aligned pointers, up to the last + * location possible. + * - Phase 3: byte-by-byte comparison, until the end location. + * Case 3: len >= (sizeof(size_t) * 8) bytes, same as case 2 except that an + * additional phase is placed between Phase 1 and Phase 2, with + * (8 * sizeof(size_t)) comparisons using bitwise OR to encourage + * compilers to use SIMD instructions if available, up to the last + * aligned location possible. + * + * Case 1 and Case 2 are mandatory to ensure that we won't read beyond the + * memory area. This is portable for 32-bit and 64-bit architectures. + * + * Caller must ensure that "ptr" is not NULL. + */ +static inline bool +pg_memory_is_all_zeros(const void *ptr, size_t len) +{ + const unsigned char *p = (const unsigned char *) ptr; + const unsigned char *end = &p[len]; + const unsigned char *aligned_end = (const unsigned char *) + ((uintptr_t) end & (~(sizeof(size_t) - 1))); + + if (len < sizeof(size_t)) + { + while (p < end) + { + if (*p++ != 0) + return false; + } + return true; + } + + /* "len" in the [sizeof(size_t), sizeof(size_t) * 8 - 1] range */ + if (len < sizeof(size_t) * 8) + { + /* Compare bytes until the pointer "p" is aligned */ + while (((uintptr_t) p & (sizeof(size_t) - 1)) != 0) + { + if (p == end) + return true; + if (*p++ != 0) + return false; + } + + /* + * Compare remaining size_t-aligned chunks. + * + * There is no risk to read beyond the memory area, as "aligned_end" + * cannot be higher than "end". + */ + for (; p < aligned_end; p += sizeof(size_t)) + { + if (*(size_t *) p != 0) + return false; + } + + /* Compare remaining bytes until the end */ + while (p < end) + { + if (*p++ != 0) + return false; + } + return true; + } + + /* "len" in the [sizeof(size_t) * 8, inf) range */ + + /* Compare bytes until the pointer "p" is aligned */ + while (((uintptr_t) p & (sizeof(size_t) - 1)) != 0) + { + if (p == end) + return true; + + if (*p++ != 0) + return false; + } + + /* + * Compare 8 * sizeof(size_t) chunks at once. + * + * For performance reasons, we manually unroll this loop and purposefully + * use bitwise-ORs to combine each comparison. This prevents boolean + * short-circuiting and lets the compiler know that it's safe to access + * all 8 elements regardless of the result of the other comparisons. This + * seems to be enough to coax a few compilers into using SIMD + * instructions. + */ + for (; p < aligned_end - (sizeof(size_t) * 7); p += sizeof(size_t) * 8) + { + if ((((size_t *) p)[0] != 0) | (((size_t *) p)[1] != 0) | + (((size_t *) p)[2] != 0) | (((size_t *) p)[3] != 0) | + (((size_t *) p)[4] != 0) | (((size_t *) p)[5] != 0) | + (((size_t *) p)[6] != 0) | (((size_t *) p)[7] != 0)) + return false; + } + + /* + * Compare remaining size_t-aligned chunks. + * + * There is no risk to read beyond the memory area, as "aligned_end" + * cannot be higher than "end". + */ + for (; p < aligned_end; p += sizeof(size_t)) + { + if (*(size_t *) p != 0) + return false; + } + + /* Compare remaining bytes until the end */ + while (p < end) + { + if (*p++ != 0) + return false; + } + + return true; +} + +#endif /* MEMUTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memutils_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memutils_internal.h new file mode 100644 index 0000000..a6caa63 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memutils_internal.h @@ -0,0 +1,176 @@ +/*------------------------------------------------------------------------- + * + * memutils_internal.h + * This file contains declarations for memory allocation utility + * functions for internal use. + * + * + * Portions Copyright (c) 2022-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/memutils_internal.h + * + *------------------------------------------------------------------------- + */ + +#ifndef MEMUTILS_INTERNAL_H +#define MEMUTILS_INTERNAL_H + +#include "utils/memutils.h" + +/* These functions implement the MemoryContext API for AllocSet context. */ +extern void *AllocSetAlloc(MemoryContext context, Size size, int flags); +extern void AllocSetFree(void *pointer); +extern void *AllocSetRealloc(void *pointer, Size size, int flags); +extern void AllocSetReset(MemoryContext context); +extern void AllocSetDelete(MemoryContext context); +extern MemoryContext AllocSetGetChunkContext(void *pointer); +extern Size AllocSetGetChunkSpace(void *pointer); +extern bool AllocSetIsEmpty(MemoryContext context); +extern void AllocSetStats(MemoryContext context, + MemoryStatsPrintFunc printfunc, void *passthru, + MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING +extern void AllocSetCheck(MemoryContext context); +#endif + +/* These functions implement the MemoryContext API for Generation context. */ +extern void *GenerationAlloc(MemoryContext context, Size size, int flags); +extern void GenerationFree(void *pointer); +extern void *GenerationRealloc(void *pointer, Size size, int flags); +extern void GenerationReset(MemoryContext context); +extern void GenerationDelete(MemoryContext context); +extern MemoryContext GenerationGetChunkContext(void *pointer); +extern Size GenerationGetChunkSpace(void *pointer); +extern bool GenerationIsEmpty(MemoryContext context); +extern void GenerationStats(MemoryContext context, + MemoryStatsPrintFunc printfunc, void *passthru, + MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING +extern void GenerationCheck(MemoryContext context); +#endif + + +/* These functions implement the MemoryContext API for Slab context. */ +extern void *SlabAlloc(MemoryContext context, Size size, int flags); +extern void SlabFree(void *pointer); +extern void *SlabRealloc(void *pointer, Size size, int flags); +extern void SlabReset(MemoryContext context); +extern void SlabDelete(MemoryContext context); +extern MemoryContext SlabGetChunkContext(void *pointer); +extern Size SlabGetChunkSpace(void *pointer); +extern bool SlabIsEmpty(MemoryContext context); +extern void SlabStats(MemoryContext context, + MemoryStatsPrintFunc printfunc, void *passthru, + MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING +extern void SlabCheck(MemoryContext context); +#endif + +/* + * These functions support the implementation of palloc_aligned() and are not + * part of a fully-fledged MemoryContext type. + */ +extern void AlignedAllocFree(void *pointer); +extern void *AlignedAllocRealloc(void *pointer, Size size, int flags); +extern MemoryContext AlignedAllocGetChunkContext(void *pointer); +extern Size AlignedAllocGetChunkSpace(void *pointer); + + /* These functions implement the MemoryContext API for the Bump context. */ +extern void *BumpAlloc(MemoryContext context, Size size, int flags); +extern void BumpFree(void *pointer); +extern void *BumpRealloc(void *pointer, Size size, int flags); +extern void BumpReset(MemoryContext context); +extern void BumpDelete(MemoryContext context); +extern MemoryContext BumpGetChunkContext(void *pointer); +extern Size BumpGetChunkSpace(void *pointer); +extern bool BumpIsEmpty(MemoryContext context); +extern void BumpStats(MemoryContext context, MemoryStatsPrintFunc printfunc, + void *passthru, MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING +extern void BumpCheck(MemoryContext context); +#endif + +/* + * How many extra bytes do we need to request in order to ensure that we can + * align a pointer to 'alignto'. Since palloc'd pointers are already aligned + * to MAXIMUM_ALIGNOF we can subtract that amount. We also need to make sure + * there is enough space for the redirection MemoryChunk. + */ +#define PallocAlignedExtraBytes(alignto) \ + ((alignto) + (sizeof(MemoryChunk) - MAXIMUM_ALIGNOF)) + +/* + * MemoryContextMethodID + * A unique identifier for each MemoryContext implementation which + * indicates the index into the mcxt_methods[] array. See mcxt.c. + * + * For robust error detection, ensure that MemoryContextMethodID has a value + * for each possible bit-pattern of MEMORY_CONTEXT_METHODID_MASK, and make + * dummy entries for unused IDs in the mcxt_methods[] array. We also try + * to avoid using bit-patterns as valid IDs if they are likely to occur in + * garbage data, or if they could falsely match on chunks that are really from + * malloc not palloc. (We can't tell that for most malloc implementations, + * but it happens that glibc stores flag bits in the same place where we put + * the MemoryContextMethodID, so the possible values are predictable for it.) + */ +typedef enum MemoryContextMethodID +{ + MCTX_0_RESERVED_UNUSEDMEM_ID, /* 0000 occurs in never-used memory */ + MCTX_1_RESERVED_GLIBC_ID, /* glibc malloc'd chunks usually match 0001 */ + MCTX_2_RESERVED_GLIBC_ID, /* glibc malloc'd chunks > 128kB match 0010 */ + MCTX_ASET_ID, + MCTX_GENERATION_ID, + MCTX_SLAB_ID, + MCTX_ALIGNED_REDIRECT_ID, + MCTX_BUMP_ID, + MCTX_8_UNUSED_ID, + MCTX_9_UNUSED_ID, + MCTX_10_UNUSED_ID, + MCTX_11_UNUSED_ID, + MCTX_12_UNUSED_ID, + MCTX_13_UNUSED_ID, + MCTX_14_UNUSED_ID, + MCTX_15_RESERVED_WIPEDMEM_ID /* 1111 occurs in wipe_mem'd memory */ +} MemoryContextMethodID; + +/* + * The number of bits that 8-byte memory chunk headers can use to encode the + * MemoryContextMethodID. + */ +#define MEMORY_CONTEXT_METHODID_BITS 4 +#define MEMORY_CONTEXT_METHODID_MASK \ + ((((uint64) 1) << MEMORY_CONTEXT_METHODID_BITS) - 1) + +/* + * This routine handles the context-type-independent part of memory + * context creation. It's intended to be called from context-type- + * specific creation routines, and noplace else. + */ +extern void MemoryContextCreate(MemoryContext node, + NodeTag tag, + MemoryContextMethodID method_id, + MemoryContext parent, + const char *name); + +extern void *MemoryContextAllocationFailure(MemoryContext context, Size size, + int flags); + +pg_noreturn extern void MemoryContextSizeFailure(MemoryContext context, Size size, + int flags); + +static inline void +MemoryContextCheckSize(MemoryContext context, Size size, int flags) +{ + if (unlikely(!AllocSizeIsValid(size))) + { + if (!(flags & MCXT_ALLOC_HUGE) || !AllocHugeSizeIsValid(size)) + MemoryContextSizeFailure(context, size, flags); + } +} + +#endif /* MEMUTILS_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memutils_memorychunk.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memutils_memorychunk.h new file mode 100644 index 0000000..36f9e4d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/memutils_memorychunk.h @@ -0,0 +1,253 @@ +/*------------------------------------------------------------------------- + * + * memutils_memorychunk.h + * Here we define a struct named MemoryChunk which implementations of + * MemoryContexts may use as a header for chunks of memory they allocate. + * + * MemoryChunk provides a lightweight header that a MemoryContext can use to + * store a reference back to the block which the given chunk is allocated on + * and also an additional 30-bits to store another value such as the size of + * the allocated chunk. + * + * Although MemoryChunks are used by each of our MemoryContexts, future + * implementations may choose to implement their own method for storing chunk + * headers. The only requirement is that the header ends with an 8-byte value + * which the least significant 4-bits of are set to the MemoryContextMethodID + * of the given context. + * + * By default, a MemoryChunk is 8 bytes in size, however, when + * MEMORY_CONTEXT_CHECKING is defined the header becomes 16 bytes in size due + * to the additional requested_size field. The MemoryContext may use this + * field for whatever they wish, but it is intended to be used for additional + * checks which are only done in MEMORY_CONTEXT_CHECKING builds. + * + * The MemoryChunk contains a uint64 field named 'hdrmask'. This field is + * used to encode 4 separate pieces of information. Starting with the least + * significant bits of 'hdrmask', the bit space is reserved as follows: + * + * 1. 4-bits to indicate the MemoryContextMethodID as defined by + * MEMORY_CONTEXT_METHODID_MASK + * 2. 1-bit to denote an "external" chunk (see below) + * 3. 30-bits reserved for the MemoryContext to use for anything it + * requires. Most MemoryContexts likely want to store the size of the + * chunk here. + * 4. 30-bits for the number of bytes that must be subtracted from the chunk + * to obtain the address of the block that the chunk is stored on. + * + * If you're paying close attention, you'll notice this adds up to 65 bits + * rather than 64 bits. This is because the highest-order bit of #3 is the + * same bit as the lowest-order bit of #4. We can do this as we insist that + * the chunk and block pointers are both MAXALIGNed, therefore the relative + * offset between those will always be a MAXALIGNed value which means the + * lowest order bit is always 0. When fetching the chunk to block offset we + * mask out the lowest-order bit to ensure it's still zero. + * + * In some cases, for example when memory allocations become large, it's + * possible fields 3 and 4 above are not large enough to store the values + * required for the chunk. In this case, the MemoryContext can choose to mark + * the chunk as "external" by calling the MemoryChunkSetHdrMaskExternal() + * function. When this is done, fields 3 and 4 are unavailable for use by the + * MemoryContext and it's up to the MemoryContext itself to devise its own + * method for getting the reference to the block. + * + * Interface: + * + * MemoryChunkSetHdrMask: + * Used to set up a non-external MemoryChunk. + * + * MemoryChunkSetHdrMaskExternal: + * Used to set up an externally managed MemoryChunk. + * + * MemoryChunkIsExternal: + * Determine if the given MemoryChunk is externally managed, i.e. + * MemoryChunkSetHdrMaskExternal() was called on the chunk. + * + * MemoryChunkGetValue: + * For non-external chunks, return the stored 30-bit value as it was set + * in the call to MemoryChunkSetHdrMask(). + * + * MemoryChunkGetBlock: + * For non-external chunks, return a pointer to the block as it was set + * in the call to MemoryChunkSetHdrMask(). + * + * Also exports: + * MEMORYCHUNK_MAX_VALUE + * MEMORYCHUNK_MAX_BLOCKOFFSET + * PointerGetMemoryChunk + * MemoryChunkGetPointer + * + * Portions Copyright (c) 2022-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/memutils_memorychunk.h + * + *------------------------------------------------------------------------- + */ + +#ifndef MEMUTILS_MEMORYCHUNK_H +#define MEMUTILS_MEMORYCHUNK_H + +#include "utils/memutils_internal.h" + + /* + * The maximum allowed value that MemoryContexts can store in the value + * field. Must be 1 less than a power of 2. + */ +#define MEMORYCHUNK_MAX_VALUE UINT64CONST(0x3FFFFFFF) + +/* + * The maximum distance in bytes that a MemoryChunk can be offset from the + * block that is storing the chunk. Must be 1 less than a power of 2. + */ +#define MEMORYCHUNK_MAX_BLOCKOFFSET UINT64CONST(0x3FFFFFFF) + +/* + * As above, but mask out the lowest-order (always zero) bit as this is shared + * with the MemoryChunkGetValue field. + */ +#define MEMORYCHUNK_BLOCKOFFSET_MASK UINT64CONST(0x3FFFFFFE) + +/* define the least significant base-0 bit of each portion of the hdrmask */ +#define MEMORYCHUNK_EXTERNAL_BASEBIT MEMORY_CONTEXT_METHODID_BITS +#define MEMORYCHUNK_VALUE_BASEBIT (MEMORYCHUNK_EXTERNAL_BASEBIT + 1) +#define MEMORYCHUNK_BLOCKOFFSET_BASEBIT (MEMORYCHUNK_VALUE_BASEBIT + 29) + +/* + * A magic number for storing in the free bits of an external chunk. This + * must mask out the bits used for storing the MemoryContextMethodID and the + * external bit. + */ +#define MEMORYCHUNK_MAGIC (UINT64CONST(0xB1A8DB858EB6EFBA) >> \ + MEMORYCHUNK_VALUE_BASEBIT << \ + MEMORYCHUNK_VALUE_BASEBIT) + +typedef struct MemoryChunk +{ +#ifdef MEMORY_CONTEXT_CHECKING + Size requested_size; +#endif + + /* bitfield for storing details about the chunk */ + uint64 hdrmask; /* must be last */ +} MemoryChunk; + +/* Get the MemoryChunk from the pointer */ +#define PointerGetMemoryChunk(p) \ + ((MemoryChunk *) ((char *) (p) - sizeof(MemoryChunk))) +/* Get the pointer from the MemoryChunk */ +#define MemoryChunkGetPointer(c) \ + ((void *) ((char *) (c) + sizeof(MemoryChunk))) + +/* private macros for making the inline functions below more simple */ +#define HdrMaskIsExternal(hdrmask) \ + ((hdrmask) & (((uint64) 1) << MEMORYCHUNK_EXTERNAL_BASEBIT)) +#define HdrMaskGetValue(hdrmask) \ + (((hdrmask) >> MEMORYCHUNK_VALUE_BASEBIT) & MEMORYCHUNK_MAX_VALUE) + +/* + * Shift the block offset down to the 0th bit position and mask off the single + * bit that's shared with the MemoryChunkGetValue field. + */ +#define HdrMaskBlockOffset(hdrmask) \ + (((hdrmask) >> MEMORYCHUNK_BLOCKOFFSET_BASEBIT) & MEMORYCHUNK_BLOCKOFFSET_MASK) + +/* For external chunks only, check the magic number matches */ +#define HdrMaskCheckMagic(hdrmask) \ + (MEMORYCHUNK_MAGIC == \ + ((hdrmask) >> MEMORYCHUNK_VALUE_BASEBIT << MEMORYCHUNK_VALUE_BASEBIT)) +/* + * MemoryChunkSetHdrMask + * Store the given 'block', 'chunk_size' and 'methodid' in the given + * MemoryChunk. + * + * The number of bytes between 'block' and 'chunk' must be <= + * MEMORYCHUNK_MAX_BLOCKOFFSET. + * 'value' must be <= MEMORYCHUNK_MAX_VALUE. + * Both 'chunk' and 'block' must be MAXALIGNed pointers. + */ +static inline void +MemoryChunkSetHdrMask(MemoryChunk *chunk, void *block, + Size value, MemoryContextMethodID methodid) +{ + Size blockoffset = (char *) chunk - (char *) block; + + Assert((char *) chunk >= (char *) block); + Assert((blockoffset & MEMORYCHUNK_BLOCKOFFSET_MASK) == blockoffset); + Assert(value <= MEMORYCHUNK_MAX_VALUE); + Assert((int) methodid <= MEMORY_CONTEXT_METHODID_MASK); + + chunk->hdrmask = (((uint64) blockoffset) << MEMORYCHUNK_BLOCKOFFSET_BASEBIT) | + (((uint64) value) << MEMORYCHUNK_VALUE_BASEBIT) | + methodid; +} + +/* + * MemoryChunkSetHdrMaskExternal + * Set 'chunk' as an externally managed chunk. Here we only record the + * MemoryContextMethodID and set the external chunk bit. + */ +static inline void +MemoryChunkSetHdrMaskExternal(MemoryChunk *chunk, + MemoryContextMethodID methodid) +{ + Assert((int) methodid <= MEMORY_CONTEXT_METHODID_MASK); + + chunk->hdrmask = MEMORYCHUNK_MAGIC | (((uint64) 1) << MEMORYCHUNK_EXTERNAL_BASEBIT) | + methodid; +} + +/* + * MemoryChunkIsExternal + * Return true if 'chunk' is marked as external. + */ +static inline bool +MemoryChunkIsExternal(MemoryChunk *chunk) +{ + /* + * External chunks should always store MEMORYCHUNK_MAGIC in the upper + * portion of the hdrmask, check that nothing has stomped on that. + */ + Assert(!HdrMaskIsExternal(chunk->hdrmask) || + HdrMaskCheckMagic(chunk->hdrmask)); + + return HdrMaskIsExternal(chunk->hdrmask); +} + +/* + * MemoryChunkGetValue + * For non-external chunks, returns the value field as it was set in + * MemoryChunkSetHdrMask. + */ +static inline Size +MemoryChunkGetValue(MemoryChunk *chunk) +{ + Assert(!HdrMaskIsExternal(chunk->hdrmask)); + + return HdrMaskGetValue(chunk->hdrmask); +} + +/* + * MemoryChunkGetBlock + * For non-external chunks, returns the pointer to the block as was set + * in MemoryChunkSetHdrMask. + */ +static inline void * +MemoryChunkGetBlock(MemoryChunk *chunk) +{ + Assert(!HdrMaskIsExternal(chunk->hdrmask)); + + return (void *) ((char *) chunk - HdrMaskBlockOffset(chunk->hdrmask)); +} + +/* cleanup all internal definitions */ +#undef MEMORYCHUNK_BLOCKOFFSET_MASK +#undef MEMORYCHUNK_EXTERNAL_BASEBIT +#undef MEMORYCHUNK_VALUE_BASEBIT +#undef MEMORYCHUNK_BLOCKOFFSET_BASEBIT +#undef MEMORYCHUNK_MAGIC +#undef HdrMaskIsExternal +#undef HdrMaskGetValue +#undef HdrMaskBlockOffset +#undef HdrMaskCheckMagic + +#endif /* MEMUTILS_MEMORYCHUNK_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/multirangetypes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/multirangetypes.h new file mode 100644 index 0000000..6e33617 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/multirangetypes.h @@ -0,0 +1,150 @@ +/*------------------------------------------------------------------------- + * + * multirangetypes.h + * Declarations for Postgres multirange types. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/multirangetypes.h + * + *------------------------------------------------------------------------- + */ +#ifndef MULTIRANGETYPES_H +#define MULTIRANGETYPES_H + +#include "utils/rangetypes.h" +#include "utils/typcache.h" + + +/* + * Multiranges are varlena objects, so must meet the varlena convention that + * the first int32 of the object contains the total object size in bytes. + * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though! + */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + Oid multirangetypid; /* multirange type's own OID */ + uint32 rangeCount; /* the number of ranges */ + + /* + * Following the count are the range objects themselves, as ShortRangeType + * structs. Note that ranges are varlena too, depending on whether they + * have lower/upper bounds and because even their base types can be + * varlena. So we can't really index into this list. + */ +} MultirangeType; + +/* Use these macros in preference to accessing these fields directly */ +#define MultirangeTypeGetOid(mr) ((mr)->multirangetypid) +#define MultirangeIsEmpty(mr) ((mr)->rangeCount == 0) + +/* + * fmgr functions for multirange type objects + */ +static inline MultirangeType * +DatumGetMultirangeTypeP(Datum X) +{ + return (MultirangeType *) PG_DETOAST_DATUM(X); +} + +static inline MultirangeType * +DatumGetMultirangeTypePCopy(Datum X) +{ + return (MultirangeType *) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +MultirangeTypePGetDatum(const MultirangeType *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_MULTIRANGE_P(n) DatumGetMultirangeTypeP(PG_GETARG_DATUM(n)) +#define PG_GETARG_MULTIRANGE_P_COPY(n) DatumGetMultirangeTypePCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_MULTIRANGE_P(x) return MultirangeTypePGetDatum(x) + +/* + * prototypes for functions defined in multirangetypes.c + */ + +/* internal versions of the above */ +extern bool multirange_eq_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern bool multirange_ne_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern bool multirange_contains_elem_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr, + Datum val); +extern bool multirange_contains_range_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr, + const RangeType *r); +extern bool range_contains_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool multirange_contains_multirange_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern bool range_overlaps_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool multirange_overlaps_multirange_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern bool range_overleft_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool range_overright_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool range_before_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool range_after_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool range_adjacent_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool multirange_before_multirange_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern MultirangeType *multirange_minus_internal(Oid mltrngtypoid, + TypeCacheEntry *rangetyp, + int32 range_count1, + RangeType **ranges1, + int32 range_count2, + RangeType **ranges2); +extern MultirangeType *multirange_intersect_internal(Oid mltrngtypoid, + TypeCacheEntry *rangetyp, + int32 range_count1, + RangeType **ranges1, + int32 range_count2, + RangeType **ranges2); + +/* assorted support functions */ +extern TypeCacheEntry *multirange_get_typcache(FunctionCallInfo fcinfo, + Oid mltrngtypid); +extern void multirange_deserialize(TypeCacheEntry *rangetyp, + const MultirangeType *multirange, + int32 *range_count, + RangeType ***ranges); +extern MultirangeType *make_multirange(Oid mltrngtypoid, + TypeCacheEntry *rangetyp, + int32 range_count, RangeType **ranges); +extern MultirangeType *make_empty_multirange(Oid mltrngtypoid, + TypeCacheEntry *rangetyp); +extern void multirange_get_bounds(TypeCacheEntry *rangetyp, + const MultirangeType *multirange, + uint32 i, + RangeBound *lower, RangeBound *upper); +extern RangeType *multirange_get_range(TypeCacheEntry *rangetyp, + const MultirangeType *multirange, int i); +extern RangeType *multirange_get_union_range(TypeCacheEntry *rangetyp, + const MultirangeType *mr); + +#endif /* MULTIRANGETYPES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/numeric.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/numeric.h new file mode 100644 index 0000000..9e79fc3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/numeric.h @@ -0,0 +1,110 @@ +/*------------------------------------------------------------------------- + * + * numeric.h + * Definitions for the exact numeric data type of Postgres + * + * Original coding 1998, Jan Wieck. Heavily revised 2003, Tom Lane. + * + * Copyright (c) 1998-2025, PostgreSQL Global Development Group + * + * src/include/utils/numeric.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PG_NUMERIC_H_ +#define _PG_NUMERIC_H_ + +#include "common/pg_prng.h" +#include "fmgr.h" + +/* + * Limits on the precision and scale specifiable in a NUMERIC typmod. The + * precision is strictly positive, but the scale may be positive or negative. + * A negative scale implies rounding before the decimal point. + * + * Note that the minimum display scale defined below is zero --- we always + * display all digits before the decimal point, even when the scale is + * negative. + * + * Note that the implementation limits on the precision and display scale of a + * numeric value are much larger --- beware of what you use these for! + */ +#define NUMERIC_MAX_PRECISION 1000 + +#define NUMERIC_MIN_SCALE (-1000) +#define NUMERIC_MAX_SCALE 1000 + +/* + * Internal limits on the scales chosen for calculation results + */ +#define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION +#define NUMERIC_MIN_DISPLAY_SCALE 0 + +#define NUMERIC_MAX_RESULT_SCALE (NUMERIC_MAX_PRECISION * 2) + +/* + * For inherently inexact calculations such as division and square root, + * we try to get at least this many significant digits; the idea is to + * deliver a result no worse than float8 would. + */ +#define NUMERIC_MIN_SIG_DIGITS 16 + +/* The actual contents of Numeric are private to numeric.c */ +struct NumericData; +typedef struct NumericData *Numeric; + +/* + * fmgr interface macros + */ + +static inline Numeric +DatumGetNumeric(Datum X) +{ + return (Numeric) PG_DETOAST_DATUM(X); +} + +static inline Numeric +DatumGetNumericCopy(Datum X) +{ + return (Numeric) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +NumericGetDatum(Numeric X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_NUMERIC(n) DatumGetNumeric(PG_GETARG_DATUM(n)) +#define PG_GETARG_NUMERIC_COPY(n) DatumGetNumericCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_NUMERIC(x) return NumericGetDatum(x) + +/* + * Utility functions in numeric.c + */ +extern bool numeric_is_nan(Numeric num); +extern bool numeric_is_inf(Numeric num); +extern int32 numeric_maximum_size(int32 typmod); +extern char *numeric_out_sci(Numeric num, int scale); +extern char *numeric_normalize(Numeric num); + +extern Numeric int64_to_numeric(int64 val); +extern Numeric int64_div_fast_to_numeric(int64 val1, int log10val2); + +extern Numeric numeric_add_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern Numeric numeric_sub_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern Numeric numeric_mul_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern Numeric numeric_div_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern Numeric numeric_mod_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern int32 numeric_int4_opt_error(Numeric num, bool *have_error); +extern int64 numeric_int8_opt_error(Numeric num, bool *have_error); + +extern Numeric random_numeric(pg_prng_state *state, + Numeric rmin, Numeric rmax); + +#endif /* _PG_NUMERIC_H_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/palloc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/palloc.h new file mode 100644 index 0000000..e1b4226 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/palloc.h @@ -0,0 +1,151 @@ +/*------------------------------------------------------------------------- + * + * palloc.h + * POSTGRES memory allocator definitions. + * + * This file contains the basic memory allocation interface that is + * needed by almost every backend module. It is included directly by + * postgres.h, so the definitions here are automatically available + * everywhere. Keep it lean! + * + * Memory allocation occurs within "contexts". Every chunk obtained from + * palloc()/MemoryContextAlloc() is allocated within a specific context. + * The entire contents of a context can be freed easily and quickly by + * resetting or deleting the context --- this is both faster and less + * prone to memory-leakage bugs than releasing chunks individually. + * We organize contexts into context trees to allow fine-grain control + * over chunk lifetime while preserving the certainty that we will free + * everything that should be freed. See utils/mmgr/README for more info. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/palloc.h + * + *------------------------------------------------------------------------- + */ +#ifndef PALLOC_H +#define PALLOC_H + +/* + * Type MemoryContextData is declared in nodes/memnodes.h. Most users + * of memory allocation should just treat it as an abstract type, so we + * do not provide the struct contents here. + */ +typedef struct MemoryContextData *MemoryContext; + +/* + * A memory context can have callback functions registered on it. Any such + * function will be called once just before the context is next reset or + * deleted. The MemoryContextCallback struct describing such a callback + * typically would be allocated within the context itself, thereby avoiding + * any need to manage it explicitly (the reset/delete action will free it). + */ +typedef void (*MemoryContextCallbackFunction) (void *arg); + +typedef struct MemoryContextCallback +{ + MemoryContextCallbackFunction func; /* function to call */ + void *arg; /* argument to pass it */ + struct MemoryContextCallback *next; /* next in list of callbacks */ +} MemoryContextCallback; + +/* + * CurrentMemoryContext is the default allocation context for palloc(). + * Avoid accessing it directly! Instead, use MemoryContextSwitchTo() + * to change the setting. + */ +extern PGDLLIMPORT MemoryContext CurrentMemoryContext; + +/* + * Flags for MemoryContextAllocExtended. + */ +#define MCXT_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) */ +#define MCXT_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */ +#define MCXT_ALLOC_ZERO 0x04 /* zero allocated memory */ + +/* + * Fundamental memory-allocation operations (more are in utils/memutils.h) + */ +extern void *MemoryContextAlloc(MemoryContext context, Size size); +extern void *MemoryContextAllocZero(MemoryContext context, Size size); +extern void *MemoryContextAllocExtended(MemoryContext context, + Size size, int flags); +extern void *MemoryContextAllocAligned(MemoryContext context, + Size size, Size alignto, int flags); + +extern void *palloc(Size size); +extern void *palloc0(Size size); +extern void *palloc_extended(Size size, int flags); +extern void *palloc_aligned(Size size, Size alignto, int flags); +pg_nodiscard extern void *repalloc(void *pointer, Size size); +pg_nodiscard extern void *repalloc_extended(void *pointer, + Size size, int flags); +pg_nodiscard extern void *repalloc0(void *pointer, Size oldsize, Size size); +extern void pfree(void *pointer); + +/* + * Variants with easier notation and more type safety + */ + +/* + * Allocate space for one object of type "type" + */ +#define palloc_object(type) ((type *) palloc(sizeof(type))) +#define palloc0_object(type) ((type *) palloc0(sizeof(type))) + +/* + * Allocate space for "count" objects of type "type" + */ +#define palloc_array(type, count) ((type *) palloc(sizeof(type) * (count))) +#define palloc0_array(type, count) ((type *) palloc0(sizeof(type) * (count))) + +/* + * Change size of allocation pointed to by "pointer" to have space for "count" + * objects of type "type" + */ +#define repalloc_array(pointer, type, count) ((type *) repalloc(pointer, sizeof(type) * (count))) +#define repalloc0_array(pointer, type, oldcount, count) ((type *) repalloc0(pointer, sizeof(type) * (oldcount), sizeof(type) * (count))) + +/* Higher-limit allocators. */ +extern void *MemoryContextAllocHuge(MemoryContext context, Size size); +pg_nodiscard extern void *repalloc_huge(void *pointer, Size size); + +/* + * Although this header file is nominally backend-only, certain frontend + * programs like pg_controldata include it via postgres.h. For some compilers + * it's necessary to hide the inline definition of MemoryContextSwitchTo in + * this scenario; hence the #ifndef FRONTEND. + */ + +#ifndef FRONTEND +static inline MemoryContext +MemoryContextSwitchTo(MemoryContext context) +{ + MemoryContext old = CurrentMemoryContext; + + CurrentMemoryContext = context; + return old; +} +#endif /* FRONTEND */ + +/* Registration of memory context reset/delete callbacks */ +extern void MemoryContextRegisterResetCallback(MemoryContext context, + MemoryContextCallback *cb); + +/* + * These are like standard strdup() except the copied string is + * allocated in a context, not with malloc(). + */ +extern char *MemoryContextStrdup(MemoryContext context, const char *string); +extern char *pstrdup(const char *in); +extern char *pnstrdup(const char *in, Size len); + +extern char *pchomp(const char *in); + +/* sprintf into a palloc'd buffer --- these are in psprintf.c */ +extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2); +extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0); + +#endif /* PALLOC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/partcache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/partcache.h new file mode 100644 index 0000000..0fb6fc1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/partcache.h @@ -0,0 +1,103 @@ +/*------------------------------------------------------------------------- + * + * partcache.h + * + * Copyright (c) 1996-2025, PostgreSQL Global Development Group + * + * src/include/utils/partcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTCACHE_H +#define PARTCACHE_H + +#include "access/attnum.h" +#include "fmgr.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "partitioning/partdefs.h" +#include "utils/relcache.h" + +/* + * Information about the partition key of a relation + */ +typedef struct PartitionKeyData +{ + PartitionStrategy strategy; /* partitioning strategy */ + int16 partnatts; /* number of columns in the partition key */ + AttrNumber *partattrs; /* attribute numbers of columns in the + * partition key or 0 if it's an expr */ + List *partexprs; /* list of expressions in the partitioning + * key, one for each zero-valued partattrs */ + + Oid *partopfamily; /* OIDs of operator families */ + Oid *partopcintype; /* OIDs of opclass declared input data types */ + FmgrInfo *partsupfunc; /* lookup info for support funcs */ + + /* Partitioning collation per attribute */ + Oid *partcollation; + + /* Type information per attribute */ + Oid *parttypid; + int32 *parttypmod; + int16 *parttyplen; + bool *parttypbyval; + char *parttypalign; + Oid *parttypcoll; +} PartitionKeyData; + + +extern PartitionKey RelationGetPartitionKey(Relation rel); +extern List *RelationGetPartitionQual(Relation rel); +extern Expr *get_partition_qual_relid(Oid relid); + +/* + * PartitionKey inquiry functions + */ +static inline int +get_partition_strategy(PartitionKey key) +{ + return key->strategy; +} + +static inline int +get_partition_natts(PartitionKey key) +{ + return key->partnatts; +} + +static inline List * +get_partition_exprs(PartitionKey key) +{ + return key->partexprs; +} + +/* + * PartitionKey inquiry functions - one column + */ +static inline int16 +get_partition_col_attnum(PartitionKey key, int col) +{ + return key->partattrs[col]; +} + +static inline Oid +get_partition_col_typid(PartitionKey key, int col) +{ + return key->parttypid[col]; +} + +static inline int32 +get_partition_col_typmod(PartitionKey key, int col) +{ + return key->parttypmod[col]; +} + +static inline Oid +get_partition_col_collation(PartitionKey key, int col) +{ + return key->partcollation[col]; +} + +#endif /* PARTCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_crc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_crc.h new file mode 100644 index 0000000..7900147 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_crc.h @@ -0,0 +1,107 @@ +/* + * pg_crc.h + * + * PostgreSQL CRC support + * + * See Ross Williams' excellent introduction + * A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS, available from + * http://ross.net/crc/ or several other net sites. + * + * We have three slightly different variants of a 32-bit CRC calculation: + * CRC-32C (Castagnoli polynomial), CRC-32 (Ethernet polynomial), and a legacy + * CRC-32 version that uses the lookup table in a funny way. They all consist + * of four macros: + * + * INIT_(crc) + * Initialize a CRC accumulator + * + * COMP_(crc, data, len) + * Accumulate some (more) bytes into a CRC + * + * FIN_(crc) + * Finish a CRC calculation + * + * EQ_(c1, c2) + * Check for equality of two CRCs. + * + * The CRC-32C variant is in port/pg_crc32c.h. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/pg_crc.h + */ +#ifndef PG_CRC_H +#define PG_CRC_H + +typedef uint32 pg_crc32; + +/* + * CRC-32, the same used e.g. in Ethernet. + * + * This is currently only used in ltree and hstore contrib modules. It uses + * the same lookup table as the legacy algorithm below. New code should + * use the Castagnoli version instead. + */ +#define INIT_TRADITIONAL_CRC32(crc) ((crc) = 0xFFFFFFFF) +#define FIN_TRADITIONAL_CRC32(crc) ((crc) ^= 0xFFFFFFFF) +#define COMP_TRADITIONAL_CRC32(crc, data, len) \ + COMP_CRC32_NORMAL_TABLE(crc, data, len, pg_crc32_table) +#define EQ_TRADITIONAL_CRC32(c1, c2) ((c1) == (c2)) + +/* Sarwate's algorithm, for use with a "normal" lookup table */ +#define COMP_CRC32_NORMAL_TABLE(crc, data, len, table) \ +do { \ + const unsigned char *__data = (const unsigned char *) (data); \ + uint32 __len = (len); \ +\ + while (__len-- > 0) \ + { \ + int __tab_index = ((int) (crc) ^ *__data++) & 0xFF; \ + (crc) = table[__tab_index] ^ ((crc) >> 8); \ + } \ +} while (0) + +/* + * The CRC algorithm used for WAL et al in pre-9.5 versions. + * + * This closely resembles the normal CRC-32 algorithm, but is subtly + * different. Using Williams' terms, we use the "normal" table, but with + * "reflected" code. That's bogus, but it was like that for years before + * anyone noticed. It does not correspond to any polynomial in a normal CRC + * algorithm, so it's not clear what the error-detection properties of this + * algorithm actually are. + * + * We still need to carry this around because it is used in a few on-disk + * structures that need to be pg_upgradeable. It should not be used in new + * code. + */ +#define INIT_LEGACY_CRC32(crc) ((crc) = 0xFFFFFFFF) +#define FIN_LEGACY_CRC32(crc) ((crc) ^= 0xFFFFFFFF) +#define COMP_LEGACY_CRC32(crc, data, len) \ + COMP_CRC32_REFLECTED_TABLE(crc, data, len, pg_crc32_table) +#define EQ_LEGACY_CRC32(c1, c2) ((c1) == (c2)) + +/* + * Sarwate's algorithm, for use with a "reflected" lookup table (but in the + * legacy algorithm, we actually use it on a "normal" table, see above) + */ +#define COMP_CRC32_REFLECTED_TABLE(crc, data, len, table) \ +do { \ + const unsigned char *__data = (const unsigned char *) (data); \ + uint32 __len = (len); \ +\ + while (__len-- > 0) \ + { \ + int __tab_index = ((int) ((crc) >> 24) ^ *__data++) & 0xFF; \ + (crc) = table[__tab_index] ^ ((crc) << 8); \ + } \ +} while (0) + +/* + * Constant table for the CRC-32 polynomials. The same table is used by both + * the normal and traditional variants. + */ +extern PGDLLIMPORT const uint32 pg_crc32_table[256]; + +#endif /* PG_CRC_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_locale.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_locale.h new file mode 100644 index 0000000..3a75825 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_locale.h @@ -0,0 +1,185 @@ +/*----------------------------------------------------------------------- + * + * PostgreSQL locale utilities + * + * src/include/utils/pg_locale.h + * + * Copyright (c) 2002-2025, PostgreSQL Global Development Group + * + *----------------------------------------------------------------------- + */ + +#ifndef _PG_LOCALE_ +#define _PG_LOCALE_ + +#ifdef USE_ICU +/* only include the C APIs, to avoid errors in cpluspluscheck */ +#undef U_SHOW_CPLUSPLUS_API +#define U_SHOW_CPLUSPLUS_API 0 +#undef U_SHOW_CPLUSPLUS_HEADER_API +#define U_SHOW_CPLUSPLUS_HEADER_API 0 +#include +#endif + +/* use for libc locale names */ +#define LOCALE_NAME_BUFLEN 128 + +/* + * Maximum number of bytes needed to map a single codepoint. Useful for + * mapping and processing a single input codepoint at a time with a + * statically-allocated buffer. + * + * With full case mapping, an input codepoint may be mapped to as many as + * three output codepoints. See Unicode 16.0.0, section 5.18.2, "Change in + * Length": + * + * https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-5/#G29675 + */ +#define UNICODE_CASEMAP_LEN 3 +#define UNICODE_CASEMAP_BUFSZ (UNICODE_CASEMAP_LEN * MAX_MULTIBYTE_CHAR_LEN) + +/* GUC settings */ +extern PGDLLIMPORT char *locale_messages; +extern PGDLLIMPORT char *locale_monetary; +extern PGDLLIMPORT char *locale_numeric; +extern PGDLLIMPORT char *locale_time; +extern PGDLLIMPORT int icu_validation_level; + +/* lc_time localization cache */ +extern PGDLLIMPORT char *localized_abbrev_days[]; +extern PGDLLIMPORT char *localized_full_days[]; +extern PGDLLIMPORT char *localized_abbrev_months[]; +extern PGDLLIMPORT char *localized_full_months[]; + +/* is the databases's LC_CTYPE the C locale? */ +extern PGDLLIMPORT bool database_ctype_is_c; + +extern bool check_locale(int category, const char *locale, char **canonname); +extern char *pg_perm_setlocale(int category, const char *locale); + +/* + * Return the POSIX lconv struct (contains number/money formatting + * information) with locale information for all categories. + */ +extern struct lconv *PGLC_localeconv(void); + +extern void cache_locale_time(void); + + +struct pg_locale_struct; +typedef struct pg_locale_struct *pg_locale_t; + +/* methods that define collation behavior */ +struct collate_methods +{ + /* required */ + int (*strncoll) (const char *arg1, ssize_t len1, + const char *arg2, ssize_t len2, + pg_locale_t locale); + + /* required */ + size_t (*strnxfrm) (char *dest, size_t destsize, + const char *src, ssize_t srclen, + pg_locale_t locale); + + /* optional */ + size_t (*strnxfrm_prefix) (char *dest, size_t destsize, + const char *src, ssize_t srclen, + pg_locale_t locale); + + /* + * If the strnxfrm method is not trusted to return the correct results, + * set strxfrm_is_safe to false. It set to false, the method will not be + * used in most cases, but the planner still expects it to be there for + * estimation purposes (where incorrect results are acceptable). + */ + bool strxfrm_is_safe; +}; + +/* + * We use a discriminated union to hold either a locale_t or an ICU collator. + * pg_locale_t is occasionally checked for truth, so make it a pointer. + * + * Also, hold two flags: whether the collation's LC_COLLATE or LC_CTYPE is C + * (or POSIX), so we can optimize a few code paths in various places. For the + * built-in C and POSIX collations, we can know that without even doing a + * cache lookup, but we want to support aliases for C/POSIX too. For the + * "default" collation, there are separate static cache variables, since + * consulting the pg_collation catalog doesn't tell us what we need. + * + * Note that some code relies on the flags not reporting false negatives + * (that is, saying it's not C when it is). For example, char2wchar() + * could fail if the locale is C, so str_tolower() shouldn't call it + * in that case. + */ +struct pg_locale_struct +{ + char provider; + bool deterministic; + bool collate_is_c; + bool ctype_is_c; + bool is_default; + + const struct collate_methods *collate; /* NULL if collate_is_c */ + + union + { + struct + { + const char *locale; + bool casemap_full; + } builtin; + locale_t lt; +#ifdef USE_ICU + struct + { + const char *locale; + UCollator *ucol; + } icu; +#endif + } info; +}; + +extern void init_database_collation(void); +extern pg_locale_t pg_newlocale_from_collation(Oid collid); + +extern char *get_collation_actual_version(char collprovider, const char *collcollate); +extern size_t pg_strlower(char *dst, size_t dstsize, + const char *src, ssize_t srclen, + pg_locale_t locale); +extern size_t pg_strtitle(char *dst, size_t dstsize, + const char *src, ssize_t srclen, + pg_locale_t locale); +extern size_t pg_strupper(char *dst, size_t dstsize, + const char *src, ssize_t srclen, + pg_locale_t locale); +extern size_t pg_strfold(char *dst, size_t dstsize, + const char *src, ssize_t srclen, + pg_locale_t locale); +extern int pg_strcoll(const char *arg1, const char *arg2, pg_locale_t locale); +extern int pg_strncoll(const char *arg1, ssize_t len1, + const char *arg2, ssize_t len2, pg_locale_t locale); +extern bool pg_strxfrm_enabled(pg_locale_t locale); +extern size_t pg_strxfrm(char *dest, const char *src, size_t destsize, + pg_locale_t locale); +extern size_t pg_strnxfrm(char *dest, size_t destsize, const char *src, + ssize_t srclen, pg_locale_t locale); +extern bool pg_strxfrm_prefix_enabled(pg_locale_t locale); +extern size_t pg_strxfrm_prefix(char *dest, const char *src, size_t destsize, + pg_locale_t locale); +extern size_t pg_strnxfrm_prefix(char *dest, size_t destsize, const char *src, + ssize_t srclen, pg_locale_t locale); + +extern int builtin_locale_encoding(const char *locale); +extern const char *builtin_validate_locale(int encoding, const char *locale); +extern void icu_validate_locale(const char *loc_str); +extern char *icu_language_tag(const char *loc_str, int elevel); +extern void report_newlocale_failure(const char *localename); + +/* These functions convert from/to libc's wchar_t, *not* pg_wchar_t */ +extern size_t wchar2char(char *to, const wchar_t *from, size_t tolen, + pg_locale_t locale); +extern size_t char2wchar(wchar_t *to, size_t tolen, + const char *from, size_t fromlen, pg_locale_t locale); + +#endif /* _PG_LOCALE_ */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_lsn.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_lsn.h new file mode 100644 index 0000000..ae198af --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_lsn.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pg_lsn.h + * Declarations for operations on log sequence numbers (LSNs) of + * PostgreSQL. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/pg_lsn.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LSN_H +#define PG_LSN_H + +#include "access/xlogdefs.h" +#include "fmgr.h" + +static inline XLogRecPtr +DatumGetLSN(Datum X) +{ + return (XLogRecPtr) DatumGetInt64(X); +} + +static inline Datum +LSNGetDatum(XLogRecPtr X) +{ + return Int64GetDatum((int64) X); +} + +#define PG_GETARG_LSN(n) DatumGetLSN(PG_GETARG_DATUM(n)) +#define PG_RETURN_LSN(x) return LSNGetDatum(x) + +extern XLogRecPtr pg_lsn_in_internal(const char *str, bool *have_error); + +#endif /* PG_LSN_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_rusage.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_rusage.h new file mode 100644 index 0000000..31fb532 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pg_rusage.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * pg_rusage.h + * header file for resource usage measurement support routines + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/pg_rusage.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_RUSAGE_H +#define PG_RUSAGE_H + +#include +#include + + +/* State structure for pg_rusage_init/pg_rusage_show */ +typedef struct PGRUsage +{ + struct timeval tv; + struct rusage ru; +} PGRUsage; + + +extern void pg_rusage_init(PGRUsage *ru0); +extern const char *pg_rusage_show(const PGRUsage *ru0); + +#endif /* PG_RUSAGE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pgstat_internal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pgstat_internal.h new file mode 100644 index 0000000..6cf0000 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pgstat_internal.h @@ -0,0 +1,943 @@ +/* ---------- + * pgstat_internal.h + * + * Definitions for the PostgreSQL cumulative statistics system that should + * only be needed by files implementing statistics support (rather than ones + * reporting / querying stats). + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/utils/pgstat_internal.h + * ---------- + */ +#ifndef PGSTAT_INTERNAL_H +#define PGSTAT_INTERNAL_H + + +#include "common/hashfn_unstable.h" +#include "lib/dshash.h" +#include "lib/ilist.h" +#include "pgstat.h" +#include "storage/lwlock.h" +#include "utils/dsa.h" + + +/* + * Types related to shared memory storage of statistics. + * + * Per-object statistics are stored in the "shared stats" hashtable. That + * table's entries (PgStatShared_HashEntry) contain a pointer to the actual stats + * data for the object (the size of the stats data varies depending on the + * kind of stats). The table is keyed by PgStat_HashKey. + * + * Once a backend has a reference to a shared stats entry, it increments the + * entry's refcount. Even after stats data is dropped (e.g., due to a DROP + * TABLE), the entry itself can only be deleted once all references have been + * released. + * + * These refcounts, in combination with a backend local hashtable + * (pgStatEntryRefHash, with entries pointing to PgStat_EntryRef) in front of + * the shared hash table, mean that most stats work can happen without + * touching the shared hash table, reducing contention. + * + * Once there are pending stats updates for a table PgStat_EntryRef->pending + * is allocated to contain a working space for as-of-yet-unapplied stats + * updates. Once the stats are flushed, PgStat_EntryRef->pending is freed. + * + * Each stat kind in the shared hash table has a fixed member + * PgStatShared_Common as the first element. + */ + +/* struct for shared statistics hash entry key. */ +typedef struct PgStat_HashKey +{ + PgStat_Kind kind; /* statistics entry kind */ + Oid dboid; /* database ID. InvalidOid for shared objects. */ + uint64 objid; /* object ID (table, function, etc.), or + * identifier. */ +} PgStat_HashKey; + +/* + * Shared statistics hash entry. Doesn't itself contain any stats, but points + * to them (with ->body). That allows the stats entries themselves to be of + * variable size. + */ +typedef struct PgStatShared_HashEntry +{ + PgStat_HashKey key; /* hash key */ + + /* + * If dropped is set, backends need to release their references so that + * the memory for the entry can be freed. No new references may be made + * once marked as dropped. + */ + bool dropped; + + /* + * Refcount managing lifetime of the entry itself (as opposed to the + * dshash entry pointing to it). The stats lifetime has to be separate + * from the hash table entry lifetime because we allow backends to point + * to a stats entry without holding a hash table lock (and some other + * reasons). + * + * As long as the entry is not dropped, 1 is added to the refcount + * representing that the entry should not be dropped. In addition each + * backend that has a reference to the entry needs to increment the + * refcount as long as it does. + * + * May only be incremented / decremented while holding at least a shared + * lock on the dshash partition containing the entry. It needs to be an + * atomic variable because multiple backends can increment the refcount + * with just a shared lock. + * + * When the refcount reaches 0 the entry needs to be freed. + */ + pg_atomic_uint32 refcount; + + /* + * Counter tracking the number of times the entry has been reused. + * + * Set to 0 when the entry is created, and incremented by one each time + * the shared entry is reinitialized with pgstat_reinit_entry(). + * + * May only be incremented / decremented while holding at least a shared + * lock on the dshash partition containing the entry. Like refcount, it + * needs to be an atomic variable because multiple backends can increment + * the generation with just a shared lock. + */ + pg_atomic_uint32 generation; + + /* + * Pointer to shared stats. The stats entry always starts with + * PgStatShared_Common, embedded in a larger struct containing the + * PgStat_Kind specific stats fields. + */ + dsa_pointer body; +} PgStatShared_HashEntry; + +/* + * Common header struct for PgStatShared_*. + */ +typedef struct PgStatShared_Common +{ + uint32 magic; /* just a validity cross-check */ + /* lock protecting stats contents (i.e. data following the header) */ + LWLock lock; +} PgStatShared_Common; + +/* + * A backend local reference to a shared stats entry. As long as at least one + * such reference exists, the shared stats entry will not be released. + * + * If there are pending stats update to the shared stats, these are stored in + * ->pending. + */ +typedef struct PgStat_EntryRef +{ + /* + * Pointer to the PgStatShared_HashEntry entry in the shared stats + * hashtable. + */ + PgStatShared_HashEntry *shared_entry; + + /* + * Pointer to the stats data (i.e. PgStatShared_HashEntry->body), resolved + * as a local pointer, to avoid repeated dsa_get_address() calls. + */ + PgStatShared_Common *shared_stats; + + /* + * Copy of PgStatShared_HashEntry->generation, keeping locally track of + * the shared stats entry "generation" retrieved (number of times reused). + */ + uint32 generation; + + /* + * Pending statistics data that will need to be flushed to shared memory + * stats eventually. Each stats kind utilizing pending data defines what + * format its pending data has and needs to provide a + * PgStat_KindInfo->flush_pending_cb callback to merge pending entries + * into the shared stats hash table. + */ + void *pending; + dlist_node pending_node; /* membership in pgStatPending list */ +} PgStat_EntryRef; + + +/* + * Some stats changes are transactional. To maintain those, a stack of + * PgStat_SubXactStatus entries is maintained, which contain data pertaining + * to the current transaction and its active subtransactions. + */ +typedef struct PgStat_SubXactStatus +{ + int nest_level; /* subtransaction nest level */ + + struct PgStat_SubXactStatus *prev; /* higher-level subxact if any */ + + /* + * Statistics for transactionally dropped objects need to be + * transactionally dropped as well. Collect the stats dropped in the + * current (sub-)transaction and only execute the stats drop when we know + * if the transaction commits/aborts. To handle replicas and crashes, + * stats drops are included in commit / abort records. + */ + dclist_head pending_drops; + + /* + * Tuple insertion/deletion counts for an open transaction can't be + * propagated into PgStat_TableStatus counters until we know if it is + * going to commit or abort. Hence, we keep these counts in per-subxact + * structs that live in TopTransactionContext. This data structure is + * designed on the assumption that subxacts won't usually modify very many + * tables. + */ + PgStat_TableXactStatus *first; /* head of list for this subxact */ +} PgStat_SubXactStatus; + + +/* + * Metadata for a specific kind of statistics. + */ +typedef struct PgStat_KindInfo +{ + /* + * Do a fixed number of stats objects exist for this kind of stats (e.g. + * bgwriter stats) or not (e.g. tables). + */ + bool fixed_amount:1; + + /* + * Can stats of this kind be accessed from another database? Determines + * whether a stats object gets included in stats snapshots. + */ + bool accessed_across_databases:1; + + /* Should stats be written to the on-disk stats file? */ + bool write_to_file:1; + + /* + * The size of an entry in the shared stats hash table (pointed to by + * PgStatShared_HashEntry->body). For fixed-numbered statistics, this is + * the size of an entry in PgStat_ShmemControl->custom_data. + */ + uint32 shared_size; + + /* + * The offset of the statistics struct in the cached statistics snapshot + * PgStat_Snapshot, for fixed-numbered statistics. + */ + uint32 snapshot_ctl_off; + + /* + * The offset of the statistics struct in the containing shared memory + * control structure PgStat_ShmemControl, for fixed-numbered statistics. + */ + uint32 shared_ctl_off; + + /* + * The offset/size of statistics inside the shared stats entry. Used when + * [de-]serializing statistics to / from disk respectively. Separate from + * shared_size because [de-]serialization may not include in-memory state + * like lwlocks. + */ + uint32 shared_data_off; + uint32 shared_data_len; + + /* + * The size of the pending data for this kind. E.g. how large + * PgStat_EntryRef->pending is. Used for allocations. + * + * 0 signals that an entry of this kind should never have a pending entry. + */ + uint32 pending_size; + + /* + * Perform custom actions when initializing a backend (standalone or under + * postmaster). Optional. + */ + void (*init_backend_cb) (void); + + /* + * For variable-numbered stats: flush pending stats. Required if pending + * data is used. See flush_static_cb when dealing with stats data that + * that cannot use PgStat_EntryRef->pending. + */ + bool (*flush_pending_cb) (PgStat_EntryRef *sr, bool nowait); + + /* + * For variable-numbered stats: delete pending stats. Optional. + */ + void (*delete_pending_cb) (PgStat_EntryRef *sr); + + /* + * For variable-numbered stats: reset the reset timestamp. Optional. + */ + void (*reset_timestamp_cb) (PgStatShared_Common *header, TimestampTz ts); + + /* + * For variable-numbered stats. Optional. + */ + void (*to_serialized_name) (const PgStat_HashKey *key, + const PgStatShared_Common *header, NameData *name); + bool (*from_serialized_name) (const NameData *name, PgStat_HashKey *key); + + /* + * For fixed-numbered statistics: Initialize shared memory state. + * + * "stats" is the pointer to the allocated shared memory area. + */ + void (*init_shmem_cb) (void *stats); + + /* + * For fixed-numbered or variable-numbered statistics: Flush pending stats + * entries, for stats kinds that do not use PgStat_EntryRef->pending. + * + * Returns true if some of the stats could not be flushed, due to lock + * contention for example. Optional. + * + * "pgstat_report_fixed" needs to be set to trigger the flush of pending + * stats. + */ + bool (*flush_static_cb) (bool nowait); + + /* + * For fixed-numbered statistics: Reset All. + */ + void (*reset_all_cb) (TimestampTz ts); + + /* + * For fixed-numbered statistics: Build snapshot for entry + */ + void (*snapshot_cb) (void); + + /* name of the kind of stats */ + const char *const name; +} PgStat_KindInfo; + + +/* + * List of SLRU names that we keep stats for. There is no central registry of + * SLRUs, so we use this fixed list instead. The "other" entry is used for + * all SLRUs without an explicit entry (e.g. SLRUs in extensions). + * + * This is only defined here so that SLRU_NUM_ELEMENTS is known for later type + * definitions. + */ +static const char *const slru_names[] = { + "commit_timestamp", + "multixact_member", + "multixact_offset", + "notify", + "serializable", + "subtransaction", + "transaction", + "other" /* has to be last */ +}; + +#define SLRU_NUM_ELEMENTS lengthof(slru_names) + + +/* ---------- + * Types and definitions for different kinds of fixed-amount stats. + * + * Single-writer stats use the changecount mechanism to achieve low-overhead + * writes - they're obviously more performance critical than reads. Check the + * definition of struct PgBackendStatus for some explanation of the + * changecount mechanism. + * + * Because the obvious implementation of resetting single-writer stats isn't + * compatible with that (another backend needs to write), we don't scribble on + * shared stats while resetting. Instead, just record the current counter + * values in a copy of the stats data, which is protected by ->lock. See + * pgstat_fetch_stat_(archiver|bgwriter|checkpointer) for the reader side. + * + * The only exception to that is the stat_reset_timestamp in these structs, + * which is protected by ->lock, because it has to be written by another + * backend while resetting. + * ---------- + */ + +typedef struct PgStatShared_Archiver +{ + /* lock protects ->reset_offset as well as stats->stat_reset_timestamp */ + LWLock lock; + uint32 changecount; + PgStat_ArchiverStats stats; + PgStat_ArchiverStats reset_offset; +} PgStatShared_Archiver; + +typedef struct PgStatShared_BgWriter +{ + /* lock protects ->reset_offset as well as stats->stat_reset_timestamp */ + LWLock lock; + uint32 changecount; + PgStat_BgWriterStats stats; + PgStat_BgWriterStats reset_offset; +} PgStatShared_BgWriter; + +typedef struct PgStatShared_Checkpointer +{ + /* lock protects ->reset_offset as well as stats->stat_reset_timestamp */ + LWLock lock; + uint32 changecount; + PgStat_CheckpointerStats stats; + PgStat_CheckpointerStats reset_offset; +} PgStatShared_Checkpointer; + +/* Shared-memory ready PgStat_IO */ +typedef struct PgStatShared_IO +{ + /* + * locks[i] protects stats.stats[i]. locks[0] also protects + * stats.stat_reset_timestamp. + */ + LWLock locks[BACKEND_NUM_TYPES]; + PgStat_IO stats; +} PgStatShared_IO; + +typedef struct PgStatShared_SLRU +{ + /* lock protects ->stats */ + LWLock lock; + PgStat_SLRUStats stats[SLRU_NUM_ELEMENTS]; +} PgStatShared_SLRU; + +typedef struct PgStatShared_Wal +{ + /* lock protects ->stats */ + LWLock lock; + PgStat_WalStats stats; +} PgStatShared_Wal; + + + +/* ---------- + * Types and definitions for different kinds of variable-amount stats. + * + * Each struct has to start with PgStatShared_Common, containing information + * common across the different types of stats. Kind-specific data follows. + * ---------- + */ + +typedef struct PgStatShared_Database +{ + PgStatShared_Common header; + PgStat_StatDBEntry stats; +} PgStatShared_Database; + +typedef struct PgStatShared_Relation +{ + PgStatShared_Common header; + PgStat_StatTabEntry stats; +} PgStatShared_Relation; + +typedef struct PgStatShared_Function +{ + PgStatShared_Common header; + PgStat_StatFuncEntry stats; +} PgStatShared_Function; + +typedef struct PgStatShared_Subscription +{ + PgStatShared_Common header; + PgStat_StatSubEntry stats; +} PgStatShared_Subscription; + +typedef struct PgStatShared_ReplSlot +{ + PgStatShared_Common header; + PgStat_StatReplSlotEntry stats; +} PgStatShared_ReplSlot; + +typedef struct PgStatShared_Backend +{ + PgStatShared_Common header; + PgStat_Backend stats; +} PgStatShared_Backend; + +/* + * Central shared memory entry for the cumulative stats system. + * + * Fixed amount stats, the dynamic shared memory hash table for + * non-fixed-amount stats, as well as remaining bits and pieces are all + * reached from here. + */ +typedef struct PgStat_ShmemControl +{ + void *raw_dsa_area; + + /* + * Stats for variable-numbered objects are kept in this shared hash table. + * See comment above PgStat_Kind for details. + */ + dshash_table_handle hash_handle; /* shared dbstat hash */ + + /* Has the stats system already been shut down? Just a debugging check. */ + bool is_shutdown; + + /* + * Whenever statistics for dropped objects could not be freed - because + * backends still have references - the dropping backend calls + * pgstat_request_entry_refs_gc() incrementing this counter. Eventually + * that causes backends to run pgstat_gc_entry_refs(), allowing memory to + * be reclaimed. + */ + pg_atomic_uint64 gc_request_count; + + /* + * Stats data for fixed-numbered objects. + */ + PgStatShared_Archiver archiver; + PgStatShared_BgWriter bgwriter; + PgStatShared_Checkpointer checkpointer; + PgStatShared_IO io; + PgStatShared_SLRU slru; + PgStatShared_Wal wal; + + /* + * Custom stats data with fixed-numbered objects, indexed by (PgStat_Kind + * - PGSTAT_KIND_CUSTOM_MIN). + */ + void *custom_data[PGSTAT_KIND_CUSTOM_SIZE]; + +} PgStat_ShmemControl; + + +/* + * Cached statistics snapshot + */ +typedef struct PgStat_Snapshot +{ + PgStat_FetchConsistency mode; + + /* time at which snapshot was taken */ + TimestampTz snapshot_timestamp; + + bool fixed_valid[PGSTAT_KIND_BUILTIN_SIZE]; + + PgStat_ArchiverStats archiver; + + PgStat_BgWriterStats bgwriter; + + PgStat_CheckpointerStats checkpointer; + + PgStat_IO io; + + PgStat_SLRUStats slru[SLRU_NUM_ELEMENTS]; + + PgStat_WalStats wal; + + /* + * Data in snapshot for custom fixed-numbered statistics, indexed by + * (PgStat_Kind - PGSTAT_KIND_CUSTOM_MIN). Each entry is allocated in + * TopMemoryContext, for a size of PgStat_KindInfo->shared_data_len. + */ + bool custom_valid[PGSTAT_KIND_CUSTOM_SIZE]; + void *custom_data[PGSTAT_KIND_CUSTOM_SIZE]; + + /* to free snapshot in bulk */ + MemoryContext context; + struct pgstat_snapshot_hash *stats; +} PgStat_Snapshot; + + +/* + * Collection of backend-local stats state. + */ +typedef struct PgStat_LocalState +{ + PgStat_ShmemControl *shmem; + dsa_area *dsa; + dshash_table *shared_hash; + + /* the current statistics snapshot */ + PgStat_Snapshot snapshot; +} PgStat_LocalState; + + +/* + * Inline functions defined further below. + */ + +static inline void pgstat_begin_changecount_write(uint32 *cc); +static inline void pgstat_end_changecount_write(uint32 *cc); +static inline uint32 pgstat_begin_changecount_read(uint32 *cc); +static inline bool pgstat_end_changecount_read(uint32 *cc, uint32 cc_before); + +static inline void pgstat_copy_changecounted_stats(void *dst, void *src, size_t len, + uint32 *cc); + +static inline int pgstat_cmp_hash_key(const void *a, const void *b, size_t size, void *arg); +static inline uint32 pgstat_hash_hash_key(const void *d, size_t size, void *arg); +static inline size_t pgstat_get_entry_len(PgStat_Kind kind); +static inline void *pgstat_get_entry_data(PgStat_Kind kind, PgStatShared_Common *entry); +static inline void *pgstat_get_custom_shmem_data(PgStat_Kind kind); +static inline void *pgstat_get_custom_snapshot_data(PgStat_Kind kind); + + +/* + * Functions in pgstat.c + */ + +extern const PgStat_KindInfo *pgstat_get_kind_info(PgStat_Kind kind); +extern void pgstat_register_kind(PgStat_Kind kind, + const PgStat_KindInfo *kind_info); + +#ifdef USE_ASSERT_CHECKING +extern void pgstat_assert_is_up(void); +#else +#define pgstat_assert_is_up() ((void)true) +#endif + +extern void pgstat_delete_pending_entry(PgStat_EntryRef *entry_ref); +extern PgStat_EntryRef *pgstat_prep_pending_entry(PgStat_Kind kind, Oid dboid, + uint64 objid, + bool *created_entry); +extern PgStat_EntryRef *pgstat_fetch_pending_entry(PgStat_Kind kind, + Oid dboid, uint64 objid); + +extern void *pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid); +extern void pgstat_snapshot_fixed(PgStat_Kind kind); + + +/* + * Functions in pgstat_archiver.c + */ + +extern void pgstat_archiver_init_shmem_cb(void *stats); +extern void pgstat_archiver_reset_all_cb(TimestampTz ts); +extern void pgstat_archiver_snapshot_cb(void); + +/* + * Functions in pgstat_backend.c + */ + +/* flags for pgstat_flush_backend() */ +#define PGSTAT_BACKEND_FLUSH_IO (1 << 0) /* Flush I/O statistics */ +#define PGSTAT_BACKEND_FLUSH_WAL (1 << 1) /* Flush WAL statistics */ +#define PGSTAT_BACKEND_FLUSH_ALL (PGSTAT_BACKEND_FLUSH_IO | PGSTAT_BACKEND_FLUSH_WAL) + +extern bool pgstat_flush_backend(bool nowait, bits32 flags); +extern bool pgstat_backend_flush_cb(bool nowait); +extern void pgstat_backend_reset_timestamp_cb(PgStatShared_Common *header, + TimestampTz ts); + +/* + * Functions in pgstat_bgwriter.c + */ + +extern void pgstat_bgwriter_init_shmem_cb(void *stats); +extern void pgstat_bgwriter_reset_all_cb(TimestampTz ts); +extern void pgstat_bgwriter_snapshot_cb(void); + + +/* + * Functions in pgstat_checkpointer.c + */ + +extern void pgstat_checkpointer_init_shmem_cb(void *stats); +extern void pgstat_checkpointer_reset_all_cb(TimestampTz ts); +extern void pgstat_checkpointer_snapshot_cb(void); + + +/* + * Functions in pgstat_database.c + */ + +extern void pgstat_report_disconnect(Oid dboid); +extern void pgstat_update_dbstats(TimestampTz ts); +extern void AtEOXact_PgStat_Database(bool isCommit, bool parallel); + +extern PgStat_StatDBEntry *pgstat_prep_database_pending(Oid dboid); +extern void pgstat_reset_database_timestamp(Oid dboid, TimestampTz ts); +extern bool pgstat_database_flush_cb(PgStat_EntryRef *entry_ref, bool nowait); +extern void pgstat_database_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts); + + +/* + * Functions in pgstat_function.c + */ + +extern bool pgstat_function_flush_cb(PgStat_EntryRef *entry_ref, bool nowait); + + +/* + * Functions in pgstat_io.c + */ + +extern void pgstat_flush_io(bool nowait); + +extern bool pgstat_io_flush_cb(bool nowait); +extern void pgstat_io_init_shmem_cb(void *stats); +extern void pgstat_io_reset_all_cb(TimestampTz ts); +extern void pgstat_io_snapshot_cb(void); + + +/* + * Functions in pgstat_relation.c + */ + +extern void AtEOXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit); +extern void AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, int nestDepth); +extern void AtPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state); +extern void PostPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state); + +extern bool pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait); +extern void pgstat_relation_delete_pending_cb(PgStat_EntryRef *entry_ref); + + +/* + * Functions in pgstat_replslot.c + */ + +extern void pgstat_replslot_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts); +extern void pgstat_replslot_to_serialized_name_cb(const PgStat_HashKey *key, const PgStatShared_Common *header, NameData *name); +extern bool pgstat_replslot_from_serialized_name_cb(const NameData *name, PgStat_HashKey *key); + + +/* + * Functions in pgstat_shmem.c + */ + +extern void pgstat_attach_shmem(void); +extern void pgstat_detach_shmem(void); + +extern PgStat_EntryRef *pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, + bool create, bool *created_entry); +extern bool pgstat_lock_entry(PgStat_EntryRef *entry_ref, bool nowait); +extern bool pgstat_lock_entry_shared(PgStat_EntryRef *entry_ref, bool nowait); +extern void pgstat_unlock_entry(PgStat_EntryRef *entry_ref); +extern bool pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid); +extern void pgstat_drop_all_entries(void); +extern void pgstat_drop_matching_entries(bool (*do_drop) (PgStatShared_HashEntry *, Datum), + Datum match_data); +extern PgStat_EntryRef *pgstat_get_entry_ref_locked(PgStat_Kind kind, Oid dboid, uint64 objid, + bool nowait); +extern void pgstat_reset_entry(PgStat_Kind kind, Oid dboid, uint64 objid, TimestampTz ts); +extern void pgstat_reset_entries_of_kind(PgStat_Kind kind, TimestampTz ts); +extern void pgstat_reset_matching_entries(bool (*do_reset) (PgStatShared_HashEntry *, Datum), + Datum match_data, + TimestampTz ts); + +extern void pgstat_request_entry_refs_gc(void); +extern PgStatShared_Common *pgstat_init_entry(PgStat_Kind kind, + PgStatShared_HashEntry *shhashent); + + +/* + * Functions in pgstat_slru.c + */ + +extern bool pgstat_slru_flush_cb(bool nowait); +extern void pgstat_slru_init_shmem_cb(void *stats); +extern void pgstat_slru_reset_all_cb(TimestampTz ts); +extern void pgstat_slru_snapshot_cb(void); + + +/* + * Functions in pgstat_wal.c + */ + +extern void pgstat_wal_init_backend_cb(void); +extern bool pgstat_wal_flush_cb(bool nowait); +extern void pgstat_wal_init_shmem_cb(void *stats); +extern void pgstat_wal_reset_all_cb(TimestampTz ts); +extern void pgstat_wal_snapshot_cb(void); + + +/* + * Functions in pgstat_subscription.c + */ + +extern bool pgstat_subscription_flush_cb(PgStat_EntryRef *entry_ref, bool nowait); +extern void pgstat_subscription_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts); + + +/* + * Functions in pgstat_xact.c + */ + +extern PgStat_SubXactStatus *pgstat_get_xact_stack_level(int nest_level); +extern void pgstat_drop_transactional(PgStat_Kind kind, Oid dboid, uint64 objid); +extern void pgstat_create_transactional(PgStat_Kind kind, Oid dboid, uint64 objid); + + +/* + * Variables in pgstat.c + */ + +/* + * Track if *any* pending fixed-numbered statistics should be flushed to + * shared memory. + * + * This flag can be switched to true by fixed-numbered statistics to let + * pgstat_report_stat() know if it needs to go through one round of + * reports, calling flush_static_cb for each fixed-numbered statistics + * kind. When this flag is not set, pgstat_report_stat() is able to do + * a fast exit, knowing that there are no pending fixed-numbered statistics. + * + * Statistics callbacks should never reset this flag; pgstat_report_stat() + * is in charge of doing that. + */ +extern PGDLLIMPORT bool pgstat_report_fixed; + +/* Backend-local stats state */ +extern PGDLLIMPORT PgStat_LocalState pgStatLocal; + +/* + * Implementation of inline functions declared above. + */ + +/* + * Helpers for changecount manipulation. See comments around struct + * PgBackendStatus for details. + */ + +static inline void +pgstat_begin_changecount_write(uint32 *cc) +{ + Assert((*cc & 1) == 0); + + START_CRIT_SECTION(); + (*cc)++; + pg_write_barrier(); +} + +static inline void +pgstat_end_changecount_write(uint32 *cc) +{ + Assert((*cc & 1) == 1); + + pg_write_barrier(); + + (*cc)++; + + END_CRIT_SECTION(); +} + +static inline uint32 +pgstat_begin_changecount_read(uint32 *cc) +{ + uint32 before_cc = *cc; + + CHECK_FOR_INTERRUPTS(); + + pg_read_barrier(); + + return before_cc; +} + +/* + * Returns true if the read succeeded, false if it needs to be repeated. + */ +static inline bool +pgstat_end_changecount_read(uint32 *cc, uint32 before_cc) +{ + uint32 after_cc; + + pg_read_barrier(); + + after_cc = *cc; + + /* was a write in progress when we started? */ + if (before_cc & 1) + return false; + + /* did writes start and complete while we read? */ + return before_cc == after_cc; +} + + +/* + * helper function for PgStat_KindInfo->snapshot_cb + * PgStat_KindInfo->reset_all_cb callbacks. + * + * Copies out the specified memory area following change-count protocol. + */ +static inline void +pgstat_copy_changecounted_stats(void *dst, void *src, size_t len, + uint32 *cc) +{ + uint32 cc_before; + + do + { + cc_before = pgstat_begin_changecount_read(cc); + + memcpy(dst, src, len); + } + while (!pgstat_end_changecount_read(cc, cc_before)); +} + +/* helpers for dshash / simplehash hashtables */ +static inline int +pgstat_cmp_hash_key(const void *a, const void *b, size_t size, void *arg) +{ + Assert(size == sizeof(PgStat_HashKey) && arg == NULL); + return memcmp(a, b, sizeof(PgStat_HashKey)); +} + +static inline uint32 +pgstat_hash_hash_key(const void *d, size_t size, void *arg) +{ + const char *key = (const char *) d; + + Assert(size == sizeof(PgStat_HashKey) && arg == NULL); + return fasthash32(key, size, 0); +} + +/* + * The length of the data portion of a shared memory stats entry (i.e. without + * transient data such as refcounts, lwlocks, ...). + */ +static inline size_t +pgstat_get_entry_len(PgStat_Kind kind) +{ + return pgstat_get_kind_info(kind)->shared_data_len; +} + +/* + * Returns a pointer to the data portion of a shared memory stats entry. + */ +static inline void * +pgstat_get_entry_data(PgStat_Kind kind, PgStatShared_Common *entry) +{ + size_t off = pgstat_get_kind_info(kind)->shared_data_off; + + Assert(off != 0 && off < PG_UINT32_MAX); + + return ((char *) (entry)) + off; +} + +/* + * Returns a pointer to the shared memory area of custom stats for + * fixed-numbered statistics. + */ +static inline void * +pgstat_get_custom_shmem_data(PgStat_Kind kind) +{ + int idx = kind - PGSTAT_KIND_CUSTOM_MIN; + + Assert(pgstat_is_kind_custom(kind)); + Assert(pgstat_get_kind_info(kind)->fixed_amount); + + return pgStatLocal.shmem->custom_data[idx]; +} + +/* + * Returns a pointer to the portion of custom data for fixed-numbered + * statistics in the current snapshot. + */ +static inline void * +pgstat_get_custom_snapshot_data(PgStat_Kind kind) +{ + int idx = kind - PGSTAT_KIND_CUSTOM_MIN; + + Assert(pgstat_is_kind_custom(kind)); + Assert(pgstat_get_kind_info(kind)->fixed_amount); + + return pgStatLocal.snapshot.custom_data[idx]; +} + +#endif /* PGSTAT_INTERNAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pgstat_kind.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pgstat_kind.h new file mode 100644 index 0000000..eb5f0b3 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pgstat_kind.h @@ -0,0 +1,72 @@ +/* ---------- + * pgstat_kind.h + * + * Definitions related to the statistics kinds for the PostgreSQL + * cumulative statistics system. Can be included in backend or + * frontend code. + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/utils/pgstat_kind.h + * ---------- + */ +#ifndef PGSTAT_KIND_H +#define PGSTAT_KIND_H + +/* The types of statistics entries */ +#define PgStat_Kind uint32 + +/* Range of IDs allowed, for built-in and custom kinds */ +#define PGSTAT_KIND_MIN 1 /* Minimum ID allowed */ +#define PGSTAT_KIND_MAX 32 /* Maximum ID allowed */ + +/* use 0 for INVALID, to catch zero-initialized data */ +#define PGSTAT_KIND_INVALID 0 + +/* stats for variable-numbered objects */ +#define PGSTAT_KIND_DATABASE 1 /* database-wide statistics */ +#define PGSTAT_KIND_RELATION 2 /* per-table statistics */ +#define PGSTAT_KIND_FUNCTION 3 /* per-function statistics */ +#define PGSTAT_KIND_REPLSLOT 4 /* per-slot statistics */ +#define PGSTAT_KIND_SUBSCRIPTION 5 /* per-subscription statistics */ +#define PGSTAT_KIND_BACKEND 6 /* per-backend statistics */ + +/* stats for fixed-numbered objects */ +#define PGSTAT_KIND_ARCHIVER 7 +#define PGSTAT_KIND_BGWRITER 8 +#define PGSTAT_KIND_CHECKPOINTER 9 +#define PGSTAT_KIND_IO 10 +#define PGSTAT_KIND_SLRU 11 +#define PGSTAT_KIND_WAL 12 + +#define PGSTAT_KIND_BUILTIN_MIN PGSTAT_KIND_DATABASE +#define PGSTAT_KIND_BUILTIN_MAX PGSTAT_KIND_WAL +#define PGSTAT_KIND_BUILTIN_SIZE (PGSTAT_KIND_BUILTIN_MAX + 1) + +/* Custom stats kinds */ + +/* Range of IDs allowed for custom stats kinds */ +#define PGSTAT_KIND_CUSTOM_MIN 24 +#define PGSTAT_KIND_CUSTOM_MAX PGSTAT_KIND_MAX +#define PGSTAT_KIND_CUSTOM_SIZE (PGSTAT_KIND_CUSTOM_MAX - PGSTAT_KIND_CUSTOM_MIN + 1) + +/* + * PgStat_Kind to use for extensions that require an ID, but are still in + * development and have not reserved their own unique kind ID yet. See: + * https://wiki.postgresql.org/wiki/CustomCumulativeStats + */ +#define PGSTAT_KIND_EXPERIMENTAL 24 + +static inline bool +pgstat_is_kind_builtin(PgStat_Kind kind) +{ + return kind >= PGSTAT_KIND_BUILTIN_MIN && kind <= PGSTAT_KIND_BUILTIN_MAX; +} + +static inline bool +pgstat_is_kind_custom(PgStat_Kind kind) +{ + return kind >= PGSTAT_KIND_CUSTOM_MIN && kind <= PGSTAT_KIND_CUSTOM_MAX; +} + +#endif /* PGSTAT_KIND_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pidfile.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pidfile.h new file mode 100644 index 0000000..c8f248f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/pidfile.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * pidfile.h + * Declarations describing the data directory lock file (postmaster.pid) + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/pidfile.h + * + *------------------------------------------------------------------------- + */ +#ifndef UTILS_PIDFILE_H +#define UTILS_PIDFILE_H + +/* + * As of Postgres 10, the contents of the data-directory lock file are: + * + * line # + * 1 postmaster PID (or negative of a standalone backend's PID) + * 2 data directory path + * 3 postmaster start timestamp (time_t representation) + * 4 port number + * 5 first Unix socket directory path (empty if none) + * 6 first listen_address (IP address or "*"; empty if no TCP port) + * 7 shared memory key (empty on Windows) + * 8 postmaster status (see values below) + * + * Lines 6 and up are added via AddToDataDirLockFile() after initial file + * creation; also, line 5 is initially empty and is changed after the first + * Unix socket is opened. Onlookers should not assume that lines 4 and up + * are filled in any particular order. + * + * Socket lock file(s), if used, have the same contents as lines 1-5, with + * line 5 being their own directory. + */ +#define LOCK_FILE_LINE_PID 1 +#define LOCK_FILE_LINE_DATA_DIR 2 +#define LOCK_FILE_LINE_START_TIME 3 +#define LOCK_FILE_LINE_PORT 4 +#define LOCK_FILE_LINE_SOCKET_DIR 5 +#define LOCK_FILE_LINE_LISTEN_ADDR 6 +#define LOCK_FILE_LINE_SHMEM_KEY 7 +#define LOCK_FILE_LINE_PM_STATUS 8 + +/* + * The PM_STATUS line may contain one of these values. All these strings + * must be the same length, per comments for AddToDataDirLockFile(). + * We pad with spaces as needed to make that true. + */ +#define PM_STATUS_STARTING "starting" /* still starting up */ +#define PM_STATUS_STOPPING "stopping" /* in shutdown sequence */ +#define PM_STATUS_READY "ready " /* ready for connections */ +#define PM_STATUS_STANDBY "standby " /* up, won't accept connections */ + +#endif /* UTILS_PIDFILE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/plancache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/plancache.h new file mode 100644 index 0000000..1baa6d5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/plancache.h @@ -0,0 +1,256 @@ +/*------------------------------------------------------------------------- + * + * plancache.h + * Plan cache definitions. + * + * See plancache.c for comments. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/plancache.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANCACHE_H +#define PLANCACHE_H + +#include "access/tupdesc.h" +#include "lib/ilist.h" +#include "nodes/params.h" +#include "tcop/cmdtag.h" +#include "utils/queryenvironment.h" +#include "utils/resowner.h" + + +/* Forward declarations, to avoid including parsenodes.h here */ +struct Query; +struct RawStmt; + +/* possible values for plan_cache_mode */ +typedef enum +{ + PLAN_CACHE_MODE_AUTO, + PLAN_CACHE_MODE_FORCE_GENERIC_PLAN, + PLAN_CACHE_MODE_FORCE_CUSTOM_PLAN, +} PlanCacheMode; + +/* GUC parameter */ +extern PGDLLIMPORT int plan_cache_mode; + +/* Optional callback to editorialize on rewritten parse trees */ +typedef void (*PostRewriteHook) (List *querytree_list, void *arg); + +#define CACHEDPLANSOURCE_MAGIC 195726186 +#define CACHEDPLAN_MAGIC 953717834 +#define CACHEDEXPR_MAGIC 838275847 + +/* + * CachedPlanSource (which might better have been called CachedQuery) + * represents a SQL query that we expect to use multiple times. It stores the + * query source text, the source parse tree, and the analyzed-and-rewritten + * query tree, as well as adjunct data. Cache invalidation can happen as a + * result of DDL affecting objects used by the query. In that case we discard + * the analyzed-and-rewritten query tree, and rebuild it when next needed. + * + * There are two ways in which the source query can be represented: either + * as a raw parse tree, or as an analyzed-but-not-rewritten parse tree. + * In the latter case we expect that cache invalidation need not affect + * the parse-analysis results, only the rewriting and planning steps. + * Only one of raw_parse_tree and analyzed_parse_tree can be non-NULL. + * (If both are NULL, the CachedPlanSource represents an empty query.) + * Note that query_string is typically just an empty string when the + * source query is an analyzed parse tree; also, param_types, num_params, + * parserSetup, and parserSetupArg will not be used. + * + * An actual execution plan, represented by CachedPlan, is derived from the + * CachedPlanSource when we need to execute the query. The plan could be + * either generic (usable with any set of plan parameters) or custom (for a + * specific set of parameters). plancache.c contains the logic that decides + * which way to do it for any particular execution. If we are using a generic + * cached plan then it is meant to be re-used across multiple executions, so + * callers must always treat CachedPlans as read-only. + * + * Once successfully built and "saved", CachedPlanSources typically live + * for the life of the backend, although they can be dropped explicitly. + * CachedPlans are reference-counted and go away automatically when the last + * reference is dropped. A CachedPlan can outlive the CachedPlanSource it + * was created from. + * + * An "unsaved" CachedPlanSource can be used for generating plans, but it + * lives in transient storage and will not be updated in response to sinval + * events. + * + * CachedPlans made from saved CachedPlanSources are likewise in permanent + * storage, so to avoid memory leaks, the reference-counted references to them + * must be held in permanent data structures or ResourceOwners. CachedPlans + * made from unsaved CachedPlanSources are in children of the caller's + * memory context, so references to them should not be longer-lived than + * that context. (Reference counting is somewhat pro forma in that case, + * though it may be useful if the CachedPlan can be discarded early.) + * + * A CachedPlanSource has two associated memory contexts: one that holds the + * struct itself, the query source text and the source parse tree, and another + * context that holds the rewritten query tree and associated data. This + * allows the query tree to be discarded easily when it is invalidated. + * + * Some callers wish to use the CachedPlan API even with one-shot queries + * that have no reason to be saved at all. We therefore support a "oneshot" + * variant that does no data copying or invalidation checking. In this case + * there are no separate memory contexts: the CachedPlanSource struct and + * all subsidiary data live in the caller's CurrentMemoryContext, and there + * is no way to free memory short of clearing that entire context. A oneshot + * plan is always treated as unsaved. + */ +typedef struct CachedPlanSource +{ + int magic; /* should equal CACHEDPLANSOURCE_MAGIC */ + struct RawStmt *raw_parse_tree; /* output of raw_parser(), or NULL */ + struct Query *analyzed_parse_tree; /* analyzed parse tree, or NULL */ + const char *query_string; /* source text of query */ + CommandTag commandTag; /* command tag for query */ + Oid *param_types; /* array of parameter type OIDs, or NULL */ + int num_params; /* length of param_types array */ + ParserSetupHook parserSetup; /* alternative parameter spec method */ + void *parserSetupArg; + PostRewriteHook postRewrite; /* see SetPostRewriteHook */ + void *postRewriteArg; + int cursor_options; /* cursor options used for planning */ + bool fixed_result; /* disallow change in result tupdesc? */ + TupleDesc resultDesc; /* result type; NULL = doesn't return tuples */ + MemoryContext context; /* memory context holding all above */ + /* These fields describe the current analyzed-and-rewritten query tree: */ + List *query_list; /* list of Query nodes, or NIL if not valid */ + List *relationOids; /* OIDs of relations the queries depend on */ + List *invalItems; /* other dependencies, as PlanInvalItems */ + struct SearchPathMatcher *search_path; /* search_path used for parsing + * and planning */ + MemoryContext query_context; /* context holding the above, or NULL */ + Oid rewriteRoleId; /* Role ID we did rewriting for */ + bool rewriteRowSecurity; /* row_security used during rewrite */ + bool dependsOnRLS; /* is rewritten query specific to the above? */ + /* If we have a generic plan, this is a reference-counted link to it: */ + struct CachedPlan *gplan; /* generic plan, or NULL if not valid */ + /* Some state flags: */ + bool is_oneshot; /* is it a "oneshot" plan? */ + bool is_complete; /* has CompleteCachedPlan been done? */ + bool is_saved; /* has CachedPlanSource been "saved"? */ + bool is_valid; /* is the query_list currently valid? */ + int generation; /* increments each time we create a plan */ + /* If CachedPlanSource has been saved, it is a member of a global list */ + dlist_node node; /* list link, if is_saved */ + /* State kept to help decide whether to use custom or generic plans: */ + double generic_cost; /* cost of generic plan, or -1 if not known */ + double total_custom_cost; /* total cost of custom plans so far */ + int64 num_custom_plans; /* # of custom plans included in total */ + int64 num_generic_plans; /* # of generic plans */ +} CachedPlanSource; + +/* + * CachedPlan represents an execution plan derived from a CachedPlanSource. + * The reference count includes both the link from the parent CachedPlanSource + * (if any), and any active plan executions, so the plan can be discarded + * exactly when refcount goes to zero. Both the struct itself and the + * subsidiary data live in the context denoted by the context field. + * This makes it easy to free a no-longer-needed cached plan. (However, + * if is_oneshot is true, the context does not belong solely to the CachedPlan + * so no freeing is possible.) + */ +typedef struct CachedPlan +{ + int magic; /* should equal CACHEDPLAN_MAGIC */ + List *stmt_list; /* list of PlannedStmts */ + bool is_oneshot; /* is it a "oneshot" plan? */ + bool is_saved; /* is CachedPlan in a long-lived context? */ + bool is_valid; /* is the stmt_list currently valid? */ + Oid planRoleId; /* Role ID the plan was created for */ + bool dependsOnRole; /* is plan specific to that role? */ + TransactionId saved_xmin; /* if valid, replan when TransactionXmin + * changes from this value */ + int generation; /* parent's generation number for this plan */ + int refcount; /* count of live references to this struct */ + MemoryContext context; /* context containing this CachedPlan */ +} CachedPlan; + +/* + * CachedExpression is a low-overhead mechanism for caching the planned form + * of standalone scalar expressions. While such expressions are not usually + * subject to cache invalidation events, that can happen, for example because + * of replacement of a SQL function that was inlined into the expression. + * The plancache takes care of storing the expression tree and marking it + * invalid if a cache invalidation occurs, but the caller must notice the + * !is_valid status and discard the obsolete expression without reusing it. + * We do not store the original parse tree, only the planned expression; + * this is an optimization based on the assumption that we usually will not + * need to replan for the life of the session. + */ +typedef struct CachedExpression +{ + int magic; /* should equal CACHEDEXPR_MAGIC */ + Node *expr; /* planned form of expression */ + bool is_valid; /* is the expression still valid? */ + /* remaining fields should be treated as private to plancache.c: */ + List *relationOids; /* OIDs of relations the expr depends on */ + List *invalItems; /* other dependencies, as PlanInvalItems */ + MemoryContext context; /* context containing this CachedExpression */ + dlist_node node; /* link in global list of CachedExpressions */ +} CachedExpression; + + +extern void InitPlanCache(void); +extern void ResetPlanCache(void); + +extern void ReleaseAllPlanCacheRefsInOwner(ResourceOwner owner); + +extern CachedPlanSource *CreateCachedPlan(struct RawStmt *raw_parse_tree, + const char *query_string, + CommandTag commandTag); +extern CachedPlanSource *CreateCachedPlanForQuery(struct Query *analyzed_parse_tree, + const char *query_string, + CommandTag commandTag); +extern CachedPlanSource *CreateOneShotCachedPlan(struct RawStmt *raw_parse_tree, + const char *query_string, + CommandTag commandTag); +extern void CompleteCachedPlan(CachedPlanSource *plansource, + List *querytree_list, + MemoryContext querytree_context, + Oid *param_types, + int num_params, + ParserSetupHook parserSetup, + void *parserSetupArg, + int cursor_options, + bool fixed_result); +extern void SetPostRewriteHook(CachedPlanSource *plansource, + PostRewriteHook postRewrite, + void *postRewriteArg); + +extern void SaveCachedPlan(CachedPlanSource *plansource); +extern void DropCachedPlan(CachedPlanSource *plansource); + +extern void CachedPlanSetParentContext(CachedPlanSource *plansource, + MemoryContext newcontext); + +extern CachedPlanSource *CopyCachedPlan(CachedPlanSource *plansource); + +extern bool CachedPlanIsValid(CachedPlanSource *plansource); + +extern List *CachedPlanGetTargetList(CachedPlanSource *plansource, + QueryEnvironment *queryEnv); + +extern CachedPlan *GetCachedPlan(CachedPlanSource *plansource, + ParamListInfo boundParams, + ResourceOwner owner, + QueryEnvironment *queryEnv); +extern void ReleaseCachedPlan(CachedPlan *plan, ResourceOwner owner); + +extern bool CachedPlanAllowsSimpleValidityCheck(CachedPlanSource *plansource, + CachedPlan *plan, + ResourceOwner owner); +extern bool CachedPlanIsSimplyValid(CachedPlanSource *plansource, + CachedPlan *plan, + ResourceOwner owner); + +extern CachedExpression *GetCachedExpression(Node *expr); +extern void FreeCachedExpression(CachedExpression *cexpr); + +#endif /* PLANCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/portal.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/portal.h new file mode 100644 index 0000000..0b62143 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/portal.h @@ -0,0 +1,251 @@ +/*------------------------------------------------------------------------- + * + * portal.h + * POSTGRES portal definitions. + * + * A portal is an abstraction which represents the execution state of + * a running or runnable query. Portals support both SQL-level CURSORs + * and protocol-level portals. + * + * Scrolling (nonsequential access) and suspension of execution are allowed + * only for portals that contain a single SELECT-type query. We do not want + * to let the client suspend an update-type query partway through! Because + * the query rewriter does not allow arbitrary ON SELECT rewrite rules, + * only queries that were originally update-type could produce multiple + * plan trees; so the restriction to a single query is not a problem + * in practice. + * + * For SQL cursors, we support three kinds of scroll behavior: + * + * (1) Neither NO SCROLL nor SCROLL was specified: to remain backward + * compatible, we allow backward fetches here, unless it would + * impose additional runtime overhead to do so. + * + * (2) NO SCROLL was specified: don't allow any backward fetches. + * + * (3) SCROLL was specified: allow all kinds of backward fetches, even + * if we need to take a performance hit to do so. (The planner sticks + * a Materialize node atop the query plan if needed.) + * + * Case #1 is converted to #2 or #3 by looking at the query itself and + * determining if scrollability can be supported without additional + * overhead. + * + * Protocol-level portals have no nonsequential-fetch API and so the + * distinction doesn't matter for them. They are always initialized + * to look like NO SCROLL cursors. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/portal.h + * + *------------------------------------------------------------------------- + */ +#ifndef PORTAL_H +#define PORTAL_H + +#include "datatype/timestamp.h" +#include "executor/execdesc.h" +#include "tcop/cmdtag.h" +#include "utils/plancache.h" +#include "utils/resowner.h" + +/* + * We have several execution strategies for Portals, depending on what + * query or queries are to be executed. (Note: in all cases, a Portal + * executes just a single source-SQL query, and thus produces just a + * single result from the user's viewpoint. However, the rule rewriter + * may expand the single source query to zero or many actual queries.) + * + * PORTAL_ONE_SELECT: the portal contains one single SELECT query. We run + * the Executor incrementally as results are demanded. This strategy also + * supports holdable cursors (the Executor results can be dumped into a + * tuplestore for access after transaction completion). + * + * PORTAL_ONE_RETURNING: the portal contains a single INSERT/UPDATE/DELETE/ + * MERGE query with a RETURNING clause (plus possibly auxiliary queries added + * by rule rewriting). On first execution, we run the portal to completion + * and dump the primary query's results into the portal tuplestore; the + * results are then returned to the client as demanded. (We can't support + * suspension of the query partway through, because the AFTER TRIGGER code + * can't cope, and also because we don't want to risk failing to execute + * all the auxiliary queries.) + * + * PORTAL_ONE_MOD_WITH: the portal contains one single SELECT query, but + * it has data-modifying CTEs. This is currently treated the same as the + * PORTAL_ONE_RETURNING case because of the possibility of needing to fire + * triggers. It may act more like PORTAL_ONE_SELECT in future. + * + * PORTAL_UTIL_SELECT: the portal contains a utility statement that returns + * a SELECT-like result (for example, EXPLAIN or SHOW). On first execution, + * we run the statement and dump its results into the portal tuplestore; + * the results are then returned to the client as demanded. + * + * PORTAL_MULTI_QUERY: all other cases. Here, we do not support partial + * execution: the portal's queries will be run to completion on first call. + */ +typedef enum PortalStrategy +{ + PORTAL_ONE_SELECT, + PORTAL_ONE_RETURNING, + PORTAL_ONE_MOD_WITH, + PORTAL_UTIL_SELECT, + PORTAL_MULTI_QUERY, +} PortalStrategy; + +/* + * A portal is always in one of these states. It is possible to transit + * from ACTIVE back to READY if the query is not run to completion; + * otherwise we never back up in status. + */ +typedef enum PortalStatus +{ + PORTAL_NEW, /* freshly created */ + PORTAL_DEFINED, /* PortalDefineQuery done */ + PORTAL_READY, /* PortalStart complete, can run it */ + PORTAL_ACTIVE, /* portal is running (can't delete it) */ + PORTAL_DONE, /* portal is finished (don't re-run it) */ + PORTAL_FAILED, /* portal got error (can't re-run it) */ +} PortalStatus; + +typedef struct PortalData *Portal; + +typedef struct PortalData +{ + /* Bookkeeping data */ + const char *name; /* portal's name */ + const char *prepStmtName; /* source prepared statement (NULL if none) */ + MemoryContext portalContext; /* subsidiary memory for portal */ + ResourceOwner resowner; /* resources owned by portal */ + void (*cleanup) (Portal portal); /* cleanup hook */ + + /* + * State data for remembering which subtransaction(s) the portal was + * created or used in. If the portal is held over from a previous + * transaction, both subxids are InvalidSubTransactionId. Otherwise, + * createSubid is the creating subxact and activeSubid is the last subxact + * in which we ran the portal. + */ + SubTransactionId createSubid; /* the creating subxact */ + SubTransactionId activeSubid; /* the last subxact with activity */ + int createLevel; /* creating subxact's nesting level */ + + /* The query or queries the portal will execute */ + const char *sourceText; /* text of query (as of 8.4, never NULL) */ + CommandTag commandTag; /* command tag for original query */ + QueryCompletion qc; /* command completion data for executed query */ + List *stmts; /* list of PlannedStmts */ + CachedPlan *cplan; /* CachedPlan, if stmts are from one */ + + ParamListInfo portalParams; /* params to pass to query */ + QueryEnvironment *queryEnv; /* environment for query */ + + /* Features/options */ + PortalStrategy strategy; /* see above */ + int cursorOptions; /* DECLARE CURSOR option bits */ + + /* Status data */ + PortalStatus status; /* see above */ + bool portalPinned; /* a pinned portal can't be dropped */ + bool autoHeld; /* was automatically converted from pinned to + * held (see HoldPinnedPortals()) */ + + /* If not NULL, Executor is active; call ExecutorEnd eventually: */ + QueryDesc *queryDesc; /* info needed for executor invocation */ + + /* If portal returns tuples, this is their tupdesc: */ + TupleDesc tupDesc; /* descriptor for result tuples */ + /* and these are the format codes to use for the columns: */ + int16 *formats; /* a format code for each column */ + + /* + * Outermost ActiveSnapshot for execution of the portal's queries. For + * all but a few utility commands, we require such a snapshot to exist. + * This ensures that TOAST references in query results can be detoasted, + * and helps to reduce thrashing of the process's exposed xmin. + */ + Snapshot portalSnapshot; /* active snapshot, or NULL if none */ + + /* + * Where we store tuples for a held cursor or a PORTAL_ONE_RETURNING, + * PORTAL_ONE_MOD_WITH, or PORTAL_UTIL_SELECT query. (A cursor held past + * the end of its transaction no longer has any active executor state.) + */ + Tuplestorestate *holdStore; /* store for holdable cursors */ + MemoryContext holdContext; /* memory containing holdStore */ + + /* + * Snapshot under which tuples in the holdStore were read. We must keep a + * reference to this snapshot if there is any possibility that the tuples + * contain TOAST references, because releasing the snapshot could allow + * recently-dead rows to be vacuumed away, along with any toast data + * belonging to them. In the case of a held cursor, we avoid needing to + * keep such a snapshot by forcibly detoasting the data. + */ + Snapshot holdSnapshot; /* registered snapshot, or NULL if none */ + + /* + * atStart, atEnd and portalPos indicate the current cursor position. + * portalPos is zero before the first row, N after fetching N'th row of + * query. After we run off the end, portalPos = # of rows in query, and + * atEnd is true. Note that atStart implies portalPos == 0, but not the + * reverse: we might have backed up only as far as the first row, not to + * the start. Also note that various code inspects atStart and atEnd, but + * only the portal movement routines should touch portalPos. + */ + bool atStart; + bool atEnd; + uint64 portalPos; + + /* Presentation data, primarily used by the pg_cursors system view */ + TimestampTz creation_time; /* time at which this portal was defined */ + bool visible; /* include this portal in pg_cursors? */ +} PortalData; + +/* + * PortalIsValid + * True iff portal is valid. + */ +#define PortalIsValid(p) PointerIsValid(p) + + +/* Prototypes for functions in utils/mmgr/portalmem.c */ +extern void EnablePortalManager(void); +extern bool PreCommit_Portals(bool isPrepare); +extern void AtAbort_Portals(void); +extern void AtCleanup_Portals(void); +extern void PortalErrorCleanup(void); +extern void AtSubCommit_Portals(SubTransactionId mySubid, + SubTransactionId parentSubid, + int parentLevel, + ResourceOwner parentXactOwner); +extern void AtSubAbort_Portals(SubTransactionId mySubid, + SubTransactionId parentSubid, + ResourceOwner myXactOwner, + ResourceOwner parentXactOwner); +extern void AtSubCleanup_Portals(SubTransactionId mySubid); +extern Portal CreatePortal(const char *name, bool allowDup, bool dupSilent); +extern Portal CreateNewPortal(void); +extern void PinPortal(Portal portal); +extern void UnpinPortal(Portal portal); +extern void MarkPortalActive(Portal portal); +extern void MarkPortalDone(Portal portal); +extern void MarkPortalFailed(Portal portal); +extern void PortalDrop(Portal portal, bool isTopCommit); +extern Portal GetPortalByName(const char *name); +extern void PortalDefineQuery(Portal portal, + const char *prepStmtName, + const char *sourceText, + CommandTag commandTag, + List *stmts, + CachedPlan *cplan); +extern PlannedStmt *PortalGetPrimaryStmt(Portal portal); +extern void PortalCreateHoldStore(Portal portal); +extern void PortalHashTableDeleteAll(void); +extern bool ThereAreNoReadyPortals(void); +extern void HoldPinnedPortals(void); +extern void ForgetPortalSnapshots(void); + +#endif /* PORTAL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/probes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/probes.h new file mode 100644 index 0000000..f600a96 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/probes.h @@ -0,0 +1,114 @@ +#define TRACE_POSTGRESQL_TRANSACTION_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_TRANSACTION_START_ENABLED() (0) +#define TRACE_POSTGRESQL_TRANSACTION_COMMIT(INT1) do {} while (0) +#define TRACE_POSTGRESQL_TRANSACTION_COMMIT_ENABLED() (0) +#define TRACE_POSTGRESQL_TRANSACTION_ABORT(INT1) do {} while (0) +#define TRACE_POSTGRESQL_TRANSACTION_ABORT_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_RELEASE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_RELEASE_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_WAIT_START(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_WAIT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_WAIT_DONE(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_WAIT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_FAIL(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_FAIL_ENABLED() (0) +#define TRACE_POSTGRESQL_LOCK_WAIT_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_LOCK_WAIT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_LOCK_WAIT_DONE(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_LOCK_WAIT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_PARSE_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_PARSE_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_PARSE_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_PARSE_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_REWRITE_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_REWRITE_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_REWRITE_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_REWRITE_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_PLAN_START() do {} while (0) +#define TRACE_POSTGRESQL_QUERY_PLAN_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_PLAN_DONE() do {} while (0) +#define TRACE_POSTGRESQL_QUERY_PLAN_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_EXECUTE_START() do {} while (0) +#define TRACE_POSTGRESQL_QUERY_EXECUTE_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_EXECUTE_DONE() do {} while (0) +#define TRACE_POSTGRESQL_QUERY_EXECUTE_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_STATEMENT_STATUS(INT1) do {} while (0) +#define TRACE_POSTGRESQL_STATEMENT_STATUS_ENABLED() (0) +#define TRACE_POSTGRESQL_SORT_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_SORT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_SORT_DONE(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_SORT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_READ_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_READ_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_READ_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_READ_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_FLUSH_START(INT1, INT2, INT3, INT4, INT5) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_FLUSH_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_FLUSH_DONE(INT1, INT2, INT3, INT4, INT5) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_FLUSH_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_EXTEND_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_EXTEND_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_EXTEND_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_EXTEND_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START() do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE() do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_START(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(INT1) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_DONE(INT1, INT2, INT3) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_DEADLOCK_FOUND() do {} while (0) +#define TRACE_POSTGRESQL_DEADLOCK_FOUND_ENABLED() (0) +#define TRACE_POSTGRESQL_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_CHECKPOINT_DONE(INT1, INT2, INT3, INT4, INT5) do {} while (0) +#define TRACE_POSTGRESQL_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START() do {} while (0) +#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE() do {} while (0) +#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_SMGR_MD_READ_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_SMGR_MD_READ_START_ENABLED() (0) +#define TRACE_POSTGRESQL_SMGR_MD_READ_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8) do {} while (0) +#define TRACE_POSTGRESQL_SMGR_MD_READ_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_SMGR_MD_WRITE_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_SMGR_MD_WRITE_START_ENABLED() (0) +#define TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8) do {} while (0) +#define TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_WAL_INSERT(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_WAL_INSERT_ENABLED() (0) +#define TRACE_POSTGRESQL_WAL_SWITCH() do {} while (0) +#define TRACE_POSTGRESQL_WAL_SWITCH_ENABLED() (0) +#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START() do {} while (0) +#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START_ENABLED() (0) +#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE() do {} while (0) +#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE_ENABLED() (0) diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/ps_status.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/ps_status.h new file mode 100644 index 0000000..ff5a2b2 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/ps_status.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * + * ps_status.h + * + * Declarations for backend/utils/misc/ps_status.c + * + * src/include/utils/ps_status.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PS_STATUS_H +#define PS_STATUS_H + +/* disabled on Windows as the performance overhead can be significant */ +#ifdef WIN32 +#define DEFAULT_UPDATE_PROCESS_TITLE false +#else +#define DEFAULT_UPDATE_PROCESS_TITLE true +#endif + +extern PGDLLIMPORT bool update_process_title; + +extern char **save_ps_display_args(int argc, char **argv); + +extern void init_ps_display(const char *fixed_part); + +extern void set_ps_display_suffix(const char *suffix); + +extern void set_ps_display_remove_suffix(void); + +extern void set_ps_display_with_len(const char *activity, size_t len); + +/* + * set_ps_display + * inlined to allow strlen to be evaluated during compilation when + * passing string constants. + */ +static inline void +set_ps_display(const char *activity) +{ + set_ps_display_with_len(activity, strlen(activity)); +} + +extern const char *get_ps_display(int *displen); + +#endif /* PS_STATUS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/queryenvironment.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/queryenvironment.h new file mode 100644 index 0000000..d44b20a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/queryenvironment.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * queryenvironment.h + * Access to functions to mutate the query environment and retrieve the + * actual data related to entries (if any). + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/queryenvironment.h + * + *------------------------------------------------------------------------- + */ +#ifndef QUERYENVIRONMENT_H +#define QUERYENVIRONMENT_H + +#include "access/tupdesc.h" + + +typedef enum EphemeralNameRelationType +{ + ENR_NAMED_TUPLESTORE, /* named tuplestore relation; e.g., deltas */ +} EphemeralNameRelationType; + +/* + * Some ephemeral named relations must match some relation (e.g., trigger + * transition tables), so to properly handle cached plans and DDL, we should + * carry the OID of that relation. In other cases an ENR might be independent + * of any relation which is stored in the system catalogs, so we need to be + * able to directly store the TupleDesc. We never need both. + */ +typedef struct EphemeralNamedRelationMetadataData +{ + char *name; /* name used to identify the relation */ + + /* only one of the next two fields should be used */ + Oid reliddesc; /* oid of relation to get tupdesc */ + TupleDesc tupdesc; /* description of result rows */ + + EphemeralNameRelationType enrtype; /* to identify type of relation */ + double enrtuples; /* estimated number of tuples */ +} EphemeralNamedRelationMetadataData; + +typedef EphemeralNamedRelationMetadataData *EphemeralNamedRelationMetadata; + +/* + * Ephemeral Named Relation data; used for parsing named relations not in the + * catalog, like transition tables in AFTER triggers. + */ +typedef struct EphemeralNamedRelationData +{ + EphemeralNamedRelationMetadataData md; + void *reldata; /* structure for execution-time access to data */ +} EphemeralNamedRelationData; + +typedef EphemeralNamedRelationData *EphemeralNamedRelation; + +/* + * This is an opaque structure outside of queryenvironment.c itself. The + * intention is to be able to change the implementation or add new context + * features without needing to change existing code for use of existing + * features. + */ +typedef struct QueryEnvironment QueryEnvironment; + + +extern QueryEnvironment *create_queryEnv(void); +extern EphemeralNamedRelationMetadata get_visible_ENR_metadata(QueryEnvironment *queryEnv, const char *refname); +extern void register_ENR(QueryEnvironment *queryEnv, EphemeralNamedRelation enr); +extern void unregister_ENR(QueryEnvironment *queryEnv, const char *name); +extern EphemeralNamedRelation get_ENR(QueryEnvironment *queryEnv, const char *name); +extern TupleDesc ENRMetadataGetTupDesc(EphemeralNamedRelationMetadata enrmd); + +#endif /* QUERYENVIRONMENT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/rangetypes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/rangetypes.h new file mode 100644 index 0000000..50adb3c --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/rangetypes.h @@ -0,0 +1,168 @@ +/*------------------------------------------------------------------------- + * + * rangetypes.h + * Declarations for Postgres range types. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/rangetypes.h + * + *------------------------------------------------------------------------- + */ +#ifndef RANGETYPES_H +#define RANGETYPES_H + +#include "utils/typcache.h" + + +/* + * Ranges are varlena objects, so must meet the varlena convention that + * the first int32 of the object contains the total object size in bytes. + * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though! + */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + Oid rangetypid; /* range type's own OID */ + /* Following the OID are zero to two bound values, then a flags byte */ +} RangeType; + +#define RANGE_EMPTY_LITERAL "empty" + +/* Use this macro in preference to fetching rangetypid field directly */ +#define RangeTypeGetOid(r) ((r)->rangetypid) + +/* A range's flags byte contains these bits: */ +#define RANGE_EMPTY 0x01 /* range is empty */ +#define RANGE_LB_INC 0x02 /* lower bound is inclusive */ +#define RANGE_UB_INC 0x04 /* upper bound is inclusive */ +#define RANGE_LB_INF 0x08 /* lower bound is -infinity */ +#define RANGE_UB_INF 0x10 /* upper bound is +infinity */ +#define RANGE_LB_NULL 0x20 /* lower bound is null (NOT USED) */ +#define RANGE_UB_NULL 0x40 /* upper bound is null (NOT USED) */ +#define RANGE_CONTAIN_EMPTY 0x80 /* marks a GiST internal-page entry whose + * subtree contains some empty ranges */ + +#define RANGE_HAS_LBOUND(flags) (!((flags) & (RANGE_EMPTY | \ + RANGE_LB_NULL | \ + RANGE_LB_INF))) + +#define RANGE_HAS_UBOUND(flags) (!((flags) & (RANGE_EMPTY | \ + RANGE_UB_NULL | \ + RANGE_UB_INF))) + +#define RangeIsEmpty(r) ((range_get_flags(r) & RANGE_EMPTY) != 0) +#define RangeIsOrContainsEmpty(r) \ + ((range_get_flags(r) & (RANGE_EMPTY | RANGE_CONTAIN_EMPTY)) != 0) + + +/* Internal representation of either bound of a range (not what's on disk) */ +typedef struct +{ + Datum val; /* the bound value, if any */ + bool infinite; /* bound is +/- infinity */ + bool inclusive; /* bound is inclusive (vs exclusive) */ + bool lower; /* this is the lower (vs upper) bound */ +} RangeBound; + +/* + * fmgr functions for range type objects + */ +static inline RangeType * +DatumGetRangeTypeP(Datum X) +{ + return (RangeType *) PG_DETOAST_DATUM(X); +} + +static inline RangeType * +DatumGetRangeTypePCopy(Datum X) +{ + return (RangeType *) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +RangeTypePGetDatum(const RangeType *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_RANGE_P(n) DatumGetRangeTypeP(PG_GETARG_DATUM(n)) +#define PG_GETARG_RANGE_P_COPY(n) DatumGetRangeTypePCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_RANGE_P(x) return RangeTypePGetDatum(x) + +/* Operator strategy numbers used in the GiST and SP-GiST range opclasses */ +/* Numbers are chosen to match up operator names with existing usages */ +#define RANGESTRAT_BEFORE RTLeftStrategyNumber +#define RANGESTRAT_OVERLEFT RTOverLeftStrategyNumber +#define RANGESTRAT_OVERLAPS RTOverlapStrategyNumber +#define RANGESTRAT_OVERRIGHT RTOverRightStrategyNumber +#define RANGESTRAT_AFTER RTRightStrategyNumber +#define RANGESTRAT_ADJACENT RTSameStrategyNumber +#define RANGESTRAT_CONTAINS RTContainsStrategyNumber +#define RANGESTRAT_CONTAINED_BY RTContainedByStrategyNumber +#define RANGESTRAT_CONTAINS_ELEM RTContainsElemStrategyNumber +#define RANGESTRAT_EQ RTEqualStrategyNumber + +/* + * prototypes for functions defined in rangetypes.c + */ + +extern bool range_contains_elem_internal(TypeCacheEntry *typcache, const RangeType *r, Datum val); + +/* internal versions of the above */ +extern bool range_eq_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_ne_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_contains_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_contained_by_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_before_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_after_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_adjacent_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_overlaps_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_overleft_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_overright_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern RangeType *range_union_internal(TypeCacheEntry *typcache, RangeType *r1, + RangeType *r2, bool strict); +extern RangeType *range_minus_internal(TypeCacheEntry *typcache, RangeType *r1, + RangeType *r2); +extern RangeType *range_intersect_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); + +/* assorted support functions */ +extern TypeCacheEntry *range_get_typcache(FunctionCallInfo fcinfo, + Oid rngtypid); +extern RangeType *range_serialize(TypeCacheEntry *typcache, RangeBound *lower, + RangeBound *upper, bool empty, + struct Node *escontext); +extern void range_deserialize(TypeCacheEntry *typcache, const RangeType *range, + RangeBound *lower, RangeBound *upper, + bool *empty); +extern char range_get_flags(const RangeType *range); +extern void range_set_contain_empty(RangeType *range); +extern RangeType *make_range(TypeCacheEntry *typcache, RangeBound *lower, + RangeBound *upper, bool empty, + struct Node *escontext); +extern int range_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *b1, + const RangeBound *b2); +extern int range_cmp_bound_values(TypeCacheEntry *typcache, const RangeBound *b1, + const RangeBound *b2); +extern int range_compare(const void *key1, const void *key2, void *arg); +extern bool bounds_adjacent(TypeCacheEntry *typcache, RangeBound boundA, + RangeBound boundB); +extern RangeType *make_empty_range(TypeCacheEntry *typcache); +extern bool range_split_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2, RangeType **output1, + RangeType **output2); + +#endif /* RANGETYPES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/regproc.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/regproc.h new file mode 100644 index 0000000..81bf59f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/regproc.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * regproc.h + * Functions for the built-in types regproc, regclass, regtype, etc. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/regproc.h + * + *------------------------------------------------------------------------- + */ +#ifndef REGPROC_H +#define REGPROC_H + +#include "nodes/pg_list.h" + +/* Control flags for format_procedure_extended */ +#define FORMAT_PROC_INVALID_AS_NULL 0x01 /* NULL if undefined */ +#define FORMAT_PROC_FORCE_QUALIFY 0x02 /* force qualification */ +extern char *format_procedure_extended(Oid procedure_oid, bits16 flags); + +/* Control flags for format_operator_extended */ +#define FORMAT_OPERATOR_INVALID_AS_NULL 0x01 /* NULL if undefined */ +#define FORMAT_OPERATOR_FORCE_QUALIFY 0x02 /* force qualification */ +extern char *format_operator_extended(Oid operator_oid, bits16 flags); + +extern List *stringToQualifiedNameList(const char *string, Node *escontext); +extern char *format_procedure(Oid procedure_oid); +extern char *format_procedure_qualified(Oid procedure_oid); +extern void format_procedure_parts(Oid procedure_oid, List **objnames, + List **objargs, bool missing_ok); + +extern char *format_operator(Oid operator_oid); +extern char *format_operator_qualified(Oid operator_oid); +extern void format_operator_parts(Oid operator_oid, List **objnames, + List **objargs, bool missing_ok); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/rel.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/rel.h new file mode 100644 index 0000000..b552359 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/rel.h @@ -0,0 +1,722 @@ +/*------------------------------------------------------------------------- + * + * rel.h + * POSTGRES relation descriptor (a/k/a relcache entry) definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/rel.h + * + *------------------------------------------------------------------------- + */ +#ifndef REL_H +#define REL_H + +#include "access/tupdesc.h" +#include "access/xlog.h" +#include "catalog/catalog.h" +#include "catalog/pg_class.h" +#include "catalog/pg_index.h" +#include "catalog/pg_publication.h" +#include "nodes/bitmapset.h" +#include "partitioning/partdefs.h" +#include "rewrite/prs2lock.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "storage/smgr.h" +#include "utils/relcache.h" +#include "utils/reltrigger.h" + + +/* + * LockRelId and LockInfo really belong to lmgr.h, but it's more convenient + * to declare them here so we can have a LockInfoData field in a Relation. + */ + +typedef struct LockRelId +{ + Oid relId; /* a relation identifier */ + Oid dbId; /* a database identifier */ +} LockRelId; + +typedef struct LockInfoData +{ + LockRelId lockRelId; +} LockInfoData; + +typedef LockInfoData *LockInfo; + +/* + * Here are the contents of a relation cache entry. + */ + +typedef struct RelationData +{ + RelFileLocator rd_locator; /* relation physical identifier */ + SMgrRelation rd_smgr; /* cached file handle, or NULL */ + int rd_refcnt; /* reference count */ + ProcNumber rd_backend; /* owning backend's proc number, if temp rel */ + bool rd_islocaltemp; /* rel is a temp rel of this session */ + bool rd_isnailed; /* rel is nailed in cache */ + bool rd_isvalid; /* relcache entry is valid */ + bool rd_indexvalid; /* is rd_indexlist valid? (also rd_pkindex and + * rd_replidindex) */ + bool rd_statvalid; /* is rd_statlist valid? */ + + /*---------- + * rd_createSubid is the ID of the highest subtransaction the rel has + * survived into or zero if the rel or its storage was created before the + * current top transaction. (IndexStmt.oldNumber leads to the case of a new + * rel with an old rd_locator.) rd_firstRelfilelocatorSubid is the ID of the + * highest subtransaction an rd_locator change has survived into or zero if + * rd_locator matches the value it had at the start of the current top + * transaction. (Rolling back the subtransaction that + * rd_firstRelfilelocatorSubid denotes would restore rd_locator to the value it + * had at the start of the current top transaction. Rolling back any + * lower subtransaction would not.) Their accuracy is critical to + * RelationNeedsWAL(). + * + * rd_newRelfilelocatorSubid is the ID of the highest subtransaction the + * most-recent relfilenumber change has survived into or zero if not changed + * in the current transaction (or we have forgotten changing it). This + * field is accurate when non-zero, but it can be zero when a relation has + * multiple new relfilenumbers within a single transaction, with one of them + * occurring in a subsequently aborted subtransaction, e.g. + * BEGIN; + * TRUNCATE t; + * SAVEPOINT save; + * TRUNCATE t; + * ROLLBACK TO save; + * -- rd_newRelfilelocatorSubid is now forgotten + * + * If every rd_*Subid field is zero, they are read-only outside + * relcache.c. Files that trigger rd_locator changes by updating + * pg_class.reltablespace and/or pg_class.relfilenode call + * RelationAssumeNewRelfilelocator() to update rd_*Subid. + * + * rd_droppedSubid is the ID of the highest subtransaction that a drop of + * the rel has survived into. In entries visible outside relcache.c, this + * is always zero. + */ + SubTransactionId rd_createSubid; /* rel was created in current xact */ + SubTransactionId rd_newRelfilelocatorSubid; /* highest subxact changing + * rd_locator to current value */ + SubTransactionId rd_firstRelfilelocatorSubid; /* highest subxact + * changing rd_locator to + * any value */ + SubTransactionId rd_droppedSubid; /* dropped with another Subid set */ + + Form_pg_class rd_rel; /* RELATION tuple */ + TupleDesc rd_att; /* tuple descriptor */ + Oid rd_id; /* relation's object id */ + LockInfoData rd_lockInfo; /* lock mgr's info for locking relation */ + RuleLock *rd_rules; /* rewrite rules */ + MemoryContext rd_rulescxt; /* private memory cxt for rd_rules, if any */ + TriggerDesc *trigdesc; /* Trigger info, or NULL if rel has none */ + /* use "struct" here to avoid needing to include rowsecurity.h: */ + struct RowSecurityDesc *rd_rsdesc; /* row security policies, or NULL */ + + /* data managed by RelationGetFKeyList: */ + List *rd_fkeylist; /* list of ForeignKeyCacheInfo (see below) */ + bool rd_fkeyvalid; /* true if list has been computed */ + + /* data managed by RelationGetPartitionKey: */ + PartitionKey rd_partkey; /* partition key, or NULL */ + MemoryContext rd_partkeycxt; /* private context for rd_partkey, if any */ + + /* data managed by RelationGetPartitionDesc: */ + PartitionDesc rd_partdesc; /* partition descriptor, or NULL */ + MemoryContext rd_pdcxt; /* private context for rd_partdesc, if any */ + + /* Same as above, for partdescs that omit detached partitions */ + PartitionDesc rd_partdesc_nodetached; /* partdesc w/o detached parts */ + MemoryContext rd_pddcxt; /* for rd_partdesc_nodetached, if any */ + + /* + * pg_inherits.xmin of the partition that was excluded in + * rd_partdesc_nodetached. This informs a future user of that partdesc: + * if this value is not in progress for the active snapshot, then the + * partdesc can be used, otherwise they have to build a new one. (This + * matches what find_inheritance_children_extended would do). + */ + TransactionId rd_partdesc_nodetached_xmin; + + /* data managed by RelationGetPartitionQual: */ + List *rd_partcheck; /* partition CHECK quals */ + bool rd_partcheckvalid; /* true if list has been computed */ + MemoryContext rd_partcheckcxt; /* private cxt for rd_partcheck, if any */ + + /* data managed by RelationGetIndexList: */ + List *rd_indexlist; /* list of OIDs of indexes on relation */ + Oid rd_pkindex; /* OID of (deferrable?) primary key, if any */ + bool rd_ispkdeferrable; /* is rd_pkindex a deferrable PK? */ + Oid rd_replidindex; /* OID of replica identity index, if any */ + + /* data managed by RelationGetStatExtList: */ + List *rd_statlist; /* list of OIDs of extended stats */ + + /* data managed by RelationGetIndexAttrBitmap: */ + bool rd_attrsvalid; /* are bitmaps of attrs valid? */ + Bitmapset *rd_keyattr; /* cols that can be ref'd by foreign keys */ + Bitmapset *rd_pkattr; /* cols included in primary key */ + Bitmapset *rd_idattr; /* included in replica identity index */ + Bitmapset *rd_hotblockingattr; /* cols blocking HOT update */ + Bitmapset *rd_summarizedattr; /* cols indexed by summarizing indexes */ + + PublicationDesc *rd_pubdesc; /* publication descriptor, or NULL */ + + /* + * rd_options is set whenever rd_rel is loaded into the relcache entry. + * Note that you can NOT look into rd_rel for this data. NULL means "use + * defaults". + */ + bytea *rd_options; /* parsed pg_class.reloptions */ + + /* + * Oid of the handler for this relation. For an index this is a function + * returning IndexAmRoutine, for table like relations a function returning + * TableAmRoutine. This is stored separately from rd_indam, rd_tableam as + * its lookup requires syscache access, but during relcache bootstrap we + * need to be able to initialize rd_tableam without syscache lookups. + */ + Oid rd_amhandler; /* OID of index AM's handler function */ + + /* + * Table access method. + */ + const struct TableAmRoutine *rd_tableam; + + /* These are non-NULL only for an index relation: */ + Form_pg_index rd_index; /* pg_index tuple describing this index */ + /* use "struct" here to avoid needing to include htup.h: */ + struct HeapTupleData *rd_indextuple; /* all of pg_index tuple */ + + /* + * index access support info (used only for an index relation) + * + * Note: only default support procs for each opclass are cached, namely + * those with lefttype and righttype equal to the opclass's opcintype. The + * arrays are indexed by support function number, which is a sufficient + * identifier given that restriction. + */ + MemoryContext rd_indexcxt; /* private memory cxt for this stuff */ + /* use "struct" here to avoid needing to include amapi.h: */ + struct IndexAmRoutine *rd_indam; /* index AM's API struct */ + Oid *rd_opfamily; /* OIDs of op families for each index col */ + Oid *rd_opcintype; /* OIDs of opclass declared input data types */ + RegProcedure *rd_support; /* OIDs of support procedures */ + struct FmgrInfo *rd_supportinfo; /* lookup info for support procedures */ + int16 *rd_indoption; /* per-column AM-specific flags */ + List *rd_indexprs; /* index expression trees, if any */ + List *rd_indpred; /* index predicate tree, if any */ + Oid *rd_exclops; /* OIDs of exclusion operators, if any */ + Oid *rd_exclprocs; /* OIDs of exclusion ops' procs, if any */ + uint16 *rd_exclstrats; /* exclusion ops' strategy numbers, if any */ + Oid *rd_indcollation; /* OIDs of index collations */ + bytea **rd_opcoptions; /* parsed opclass-specific options */ + + /* + * rd_amcache is available for index and table AMs to cache private data + * about the relation. This must be just a cache since it may get reset + * at any time (in particular, it will get reset by a relcache inval + * message for the relation). If used, it must point to a single memory + * chunk palloc'd in CacheMemoryContext, or in rd_indexcxt for an index + * relation. A relcache reset will include freeing that chunk and setting + * rd_amcache = NULL. + */ + void *rd_amcache; /* available for use by index/table AM */ + + /* + * foreign-table support + * + * rd_fdwroutine must point to a single memory chunk palloc'd in + * CacheMemoryContext. It will be freed and reset to NULL on a relcache + * reset. + */ + + /* use "struct" here to avoid needing to include fdwapi.h: */ + struct FdwRoutine *rd_fdwroutine; /* cached function pointers, or NULL */ + + /* + * Hack for CLUSTER, rewriting ALTER TABLE, etc: when writing a new + * version of a table, we need to make any toast pointers inserted into it + * have the existing toast table's OID, not the OID of the transient toast + * table. If rd_toastoid isn't InvalidOid, it is the OID to place in + * toast pointers inserted into this rel. (Note it's set on the new + * version of the main heap, not the toast table itself.) This also + * causes toast_save_datum() to try to preserve toast value OIDs. + */ + Oid rd_toastoid; /* Real TOAST table's OID, or InvalidOid */ + + bool pgstat_enabled; /* should relation stats be counted */ + /* use "struct" here to avoid needing to include pgstat.h: */ + struct PgStat_TableStatus *pgstat_info; /* statistics collection area */ +} RelationData; + + +/* + * ForeignKeyCacheInfo + * Information the relcache can cache about foreign key constraints + * + * This is basically just an image of relevant columns from pg_constraint. + * We make it a subclass of Node so that copyObject() can be used on a list + * of these, but we also ensure it is a "flat" object without substructure, + * so that list_free_deep() is sufficient to free such a list. + * The per-FK-column arrays can be fixed-size because we allow at most + * INDEX_MAX_KEYS columns in a foreign key constraint. + * + * Currently, we mostly cache fields of interest to the planner, but the set + * of fields has already grown the constraint OID for other uses. + */ +typedef struct ForeignKeyCacheInfo +{ + pg_node_attr(no_equal, no_read, no_query_jumble) + + NodeTag type; + /* oid of the constraint itself */ + Oid conoid; + /* relation constrained by the foreign key */ + Oid conrelid; + /* relation referenced by the foreign key */ + Oid confrelid; + /* number of columns in the foreign key */ + int nkeys; + + /* Is enforced ? */ + bool conenforced; + + /* + * these arrays each have nkeys valid entries: + */ + /* cols in referencing table */ + AttrNumber conkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + /* cols in referenced table */ + AttrNumber confkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + /* PK = FK operator OIDs */ + Oid conpfeqop[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); +} ForeignKeyCacheInfo; + + +/* + * StdRdOptions + * Standard contents of rd_options for heaps. + * + * RelationGetFillFactor() and RelationGetTargetPageFreeSpace() can only + * be applied to relations that use this format or a superset for + * private options data. + */ + /* autovacuum-related reloptions. */ +typedef struct AutoVacOpts +{ + bool enabled; + int vacuum_threshold; + int vacuum_max_threshold; + int vacuum_ins_threshold; + int analyze_threshold; + int vacuum_cost_limit; + int freeze_min_age; + int freeze_max_age; + int freeze_table_age; + int multixact_freeze_min_age; + int multixact_freeze_max_age; + int multixact_freeze_table_age; + int log_min_duration; + float8 vacuum_cost_delay; + float8 vacuum_scale_factor; + float8 vacuum_ins_scale_factor; + float8 analyze_scale_factor; +} AutoVacOpts; + +/* StdRdOptions->vacuum_index_cleanup values */ +typedef enum StdRdOptIndexCleanup +{ + STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0, + STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF, + STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON, +} StdRdOptIndexCleanup; + +typedef struct StdRdOptions +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int fillfactor; /* page fill factor in percent (0..100) */ + int toast_tuple_target; /* target for tuple toasting */ + AutoVacOpts autovacuum; /* autovacuum-related options */ + bool user_catalog_table; /* use as an additional catalog relation */ + int parallel_workers; /* max number of parallel workers */ + StdRdOptIndexCleanup vacuum_index_cleanup; /* controls index vacuuming */ + bool vacuum_truncate; /* enables vacuum to truncate a relation */ + bool vacuum_truncate_set; /* whether vacuum_truncate is set */ + + /* + * Fraction of pages in a relation that vacuum can eagerly scan and fail + * to freeze. 0 if disabled, -1 if unspecified. + */ + double vacuum_max_eager_freeze_failure_rate; +} StdRdOptions; + +#define HEAP_MIN_FILLFACTOR 10 +#define HEAP_DEFAULT_FILLFACTOR 100 + +/* + * RelationGetToastTupleTarget + * Returns the relation's toast_tuple_target. Note multiple eval of argument! + */ +#define RelationGetToastTupleTarget(relation, defaulttarg) \ + ((relation)->rd_options ? \ + ((StdRdOptions *) (relation)->rd_options)->toast_tuple_target : (defaulttarg)) + +/* + * RelationGetFillFactor + * Returns the relation's fillfactor. Note multiple eval of argument! + */ +#define RelationGetFillFactor(relation, defaultff) \ + ((relation)->rd_options ? \ + ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff)) + +/* + * RelationGetTargetPageUsage + * Returns the relation's desired space usage per page in bytes. + */ +#define RelationGetTargetPageUsage(relation, defaultff) \ + (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100) + +/* + * RelationGetTargetPageFreeSpace + * Returns the relation's desired freespace per page in bytes. + */ +#define RelationGetTargetPageFreeSpace(relation, defaultff) \ + (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100) + +/* + * RelationIsUsedAsCatalogTable + * Returns whether the relation should be treated as a catalog table + * from the pov of logical decoding. Note multiple eval of argument! + */ +#define RelationIsUsedAsCatalogTable(relation) \ + ((relation)->rd_options && \ + ((relation)->rd_rel->relkind == RELKIND_RELATION || \ + (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \ + ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false) + +/* + * RelationGetParallelWorkers + * Returns the relation's parallel_workers reloption setting. + * Note multiple eval of argument! + */ +#define RelationGetParallelWorkers(relation, defaultpw) \ + ((relation)->rd_options ? \ + ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw)) + +/* ViewOptions->check_option values */ +typedef enum ViewOptCheckOption +{ + VIEW_OPTION_CHECK_OPTION_NOT_SET, + VIEW_OPTION_CHECK_OPTION_LOCAL, + VIEW_OPTION_CHECK_OPTION_CASCADED, +} ViewOptCheckOption; + +/* + * ViewOptions + * Contents of rd_options for views + */ +typedef struct ViewOptions +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + bool security_barrier; + bool security_invoker; + ViewOptCheckOption check_option; +} ViewOptions; + +/* + * RelationIsSecurityView + * Returns whether the relation is security view, or not. Note multiple + * eval of argument! + */ +#define RelationIsSecurityView(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options ? \ + ((ViewOptions *) (relation)->rd_options)->security_barrier : false) + +/* + * RelationHasSecurityInvoker + * Returns true if the relation has the security_invoker property set. + * Note multiple eval of argument! + */ +#define RelationHasSecurityInvoker(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options ? \ + ((ViewOptions *) (relation)->rd_options)->security_invoker : false) + +/* + * RelationHasCheckOption + * Returns true if the relation is a view defined with either the local + * or the cascaded check option. Note multiple eval of argument! + */ +#define RelationHasCheckOption(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options && \ + ((ViewOptions *) (relation)->rd_options)->check_option != \ + VIEW_OPTION_CHECK_OPTION_NOT_SET) + +/* + * RelationHasLocalCheckOption + * Returns true if the relation is a view defined with the local check + * option. Note multiple eval of argument! + */ +#define RelationHasLocalCheckOption(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options && \ + ((ViewOptions *) (relation)->rd_options)->check_option == \ + VIEW_OPTION_CHECK_OPTION_LOCAL) + +/* + * RelationHasCascadedCheckOption + * Returns true if the relation is a view defined with the cascaded check + * option. Note multiple eval of argument! + */ +#define RelationHasCascadedCheckOption(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options && \ + ((ViewOptions *) (relation)->rd_options)->check_option == \ + VIEW_OPTION_CHECK_OPTION_CASCADED) + +/* + * RelationIsValid + * True iff relation descriptor is valid. + */ +#define RelationIsValid(relation) PointerIsValid(relation) + +#define InvalidRelation ((Relation) NULL) + +/* + * RelationHasReferenceCountZero + * True iff relation reference count is zero. + * + * Note: + * Assumes relation descriptor is valid. + */ +#define RelationHasReferenceCountZero(relation) \ + ((bool)((relation)->rd_refcnt == 0)) + +/* + * RelationGetForm + * Returns pg_class tuple for a relation. + * + * Note: + * Assumes relation descriptor is valid. + */ +#define RelationGetForm(relation) ((relation)->rd_rel) + +/* + * RelationGetRelid + * Returns the OID of the relation + */ +#define RelationGetRelid(relation) ((relation)->rd_id) + +/* + * RelationGetNumberOfAttributes + * Returns the total number of attributes in a relation. + */ +#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts) + +/* + * IndexRelationGetNumberOfAttributes + * Returns the number of attributes in an index. + */ +#define IndexRelationGetNumberOfAttributes(relation) \ + ((relation)->rd_index->indnatts) + +/* + * IndexRelationGetNumberOfKeyAttributes + * Returns the number of key attributes in an index. + */ +#define IndexRelationGetNumberOfKeyAttributes(relation) \ + ((relation)->rd_index->indnkeyatts) + +/* + * RelationGetDescr + * Returns tuple descriptor for a relation. + */ +#define RelationGetDescr(relation) ((relation)->rd_att) + +/* + * RelationGetRelationName + * Returns the rel's name. + * + * Note that the name is only unique within the containing namespace. + */ +#define RelationGetRelationName(relation) \ + (NameStr((relation)->rd_rel->relname)) + +/* + * RelationGetNamespace + * Returns the rel's namespace OID. + */ +#define RelationGetNamespace(relation) \ + ((relation)->rd_rel->relnamespace) + +/* + * RelationIsMapped + * True if the relation uses the relfilenumber map. Note multiple eval + * of argument! + */ +#define RelationIsMapped(relation) \ + (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \ + ((relation)->rd_rel->relfilenode == InvalidRelFileNumber)) + +#ifndef FRONTEND +/* + * RelationGetSmgr + * Returns smgr file handle for a relation, opening it if needed. + * + * Very little code is authorized to touch rel->rd_smgr directly. Instead + * use this function to fetch its value. + */ +static inline SMgrRelation +RelationGetSmgr(Relation rel) +{ + if (unlikely(rel->rd_smgr == NULL)) + { + rel->rd_smgr = smgropen(rel->rd_locator, rel->rd_backend); + smgrpin(rel->rd_smgr); + } + return rel->rd_smgr; +} + +/* + * RelationCloseSmgr + * Close the relation at the smgr level, if not already done. + */ +static inline void +RelationCloseSmgr(Relation relation) +{ + if (relation->rd_smgr != NULL) + { + smgrunpin(relation->rd_smgr); + smgrclose(relation->rd_smgr); + relation->rd_smgr = NULL; + } +} +#endif /* !FRONTEND */ + +/* + * RelationGetTargetBlock + * Fetch relation's current insertion target block. + * + * Returns InvalidBlockNumber if there is no current target block. Note + * that the target block status is discarded on any smgr-level invalidation, + * so there's no need to re-open the smgr handle if it's not currently open. + */ +#define RelationGetTargetBlock(relation) \ + ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber ) + +/* + * RelationSetTargetBlock + * Set relation's current insertion target block. + */ +#define RelationSetTargetBlock(relation, targblock) \ + do { \ + RelationGetSmgr(relation)->smgr_targblock = (targblock); \ + } while (0) + +/* + * RelationIsPermanent + * True if relation is permanent. + */ +#define RelationIsPermanent(relation) \ + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT) + +/* + * RelationNeedsWAL + * True if relation needs WAL. + * + * Returns false if wal_level = minimal and this relation is created or + * truncated in the current transaction. See "Skipping WAL for New + * RelFileLocator" in src/backend/access/transam/README. + */ +#define RelationNeedsWAL(relation) \ + (RelationIsPermanent(relation) && (XLogIsNeeded() || \ + (relation->rd_createSubid == InvalidSubTransactionId && \ + relation->rd_firstRelfilelocatorSubid == InvalidSubTransactionId))) + +/* + * RelationUsesLocalBuffers + * True if relation's pages are stored in local buffers. + */ +#define RelationUsesLocalBuffers(relation) \ + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP) + +/* + * RELATION_IS_LOCAL + * If a rel is either temp or newly created in the current transaction, + * it can be assumed to be accessible only to the current backend. + * This is typically used to decide that we can skip acquiring locks. + * + * Beware of multiple eval of argument + */ +#define RELATION_IS_LOCAL(relation) \ + ((relation)->rd_islocaltemp || \ + (relation)->rd_createSubid != InvalidSubTransactionId) + +/* + * RELATION_IS_OTHER_TEMP + * Test for a temporary relation that belongs to some other session. + * + * Beware of multiple eval of argument + */ +#define RELATION_IS_OTHER_TEMP(relation) \ + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \ + !(relation)->rd_islocaltemp) + + +/* + * RelationIsScannable + * Currently can only be false for a materialized view which has not been + * populated by its query. This is likely to get more complicated later, + * so use a macro which looks like a function. + */ +#define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated) + +/* + * RelationIsPopulated + * Currently, we don't physically distinguish the "populated" and + * "scannable" properties of matviews, but that may change later. + * Hence, use the appropriate one of these macros in code tests. + */ +#define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated) + +/* + * RelationIsAccessibleInLogicalDecoding + * True if we need to log enough information to have access via + * decoding snapshot. + */ +#define RelationIsAccessibleInLogicalDecoding(relation) \ + (XLogLogicalInfoActive() && \ + RelationNeedsWAL(relation) && \ + (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation))) + +/* + * RelationIsLogicallyLogged + * True if we need to log enough information to extract the data from the + * WAL stream. + * + * We don't log information for unlogged tables (since they don't WAL log + * anyway), for foreign tables (since they don't WAL log, either), + * and for system tables (their content is hard to make sense of, and + * it would complicate decoding slightly for little gain). Note that we *do* + * log information for user defined catalog tables since they presumably are + * interesting to the user... + */ +#define RelationIsLogicallyLogged(relation) \ + (XLogLogicalInfoActive() && \ + RelationNeedsWAL(relation) && \ + (relation)->rd_rel->relkind != RELKIND_FOREIGN_TABLE && \ + !IsCatalogRelation(relation)) + +/* routines in utils/cache/relcache.c */ +extern void RelationIncrementReferenceCount(Relation rel); +extern void RelationDecrementReferenceCount(Relation rel); + +#endif /* REL_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relcache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relcache.h new file mode 100644 index 0000000..3561c6b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relcache.h @@ -0,0 +1,163 @@ +/*------------------------------------------------------------------------- + * + * relcache.h + * Relation descriptor cache definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/relcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELCACHE_H +#define RELCACHE_H + +#include "access/tupdesc.h" +#include "common/relpath.h" +#include "nodes/bitmapset.h" + + +/* + * Name of relcache init file(s), used to speed up backend startup + */ +#define RELCACHE_INIT_FILENAME "pg_internal.init" + +typedef struct RelationData *Relation; + +/* ---------------- + * RelationPtr is used in the executor to support index scans + * where we have to keep track of several index relations in an + * array. -cim 9/10/89 + * ---------------- + */ +typedef Relation *RelationPtr; + +/* + * Routines to open (lookup) and close a relcache entry + */ +#ifdef USE_ASSERT_CHECKING +extern void AssertCouldGetRelation(void); +#else +static inline void +AssertCouldGetRelation(void) +{ +} +#endif +extern Relation RelationIdGetRelation(Oid relationId); +extern void RelationClose(Relation relation); + +/* + * Routines to compute/retrieve additional cached information + */ +extern List *RelationGetFKeyList(Relation relation); +extern List *RelationGetIndexList(Relation relation); +extern List *RelationGetStatExtList(Relation relation); +extern Oid RelationGetPrimaryKeyIndex(Relation relation, bool deferrable_ok); +extern Oid RelationGetReplicaIndex(Relation relation); +extern List *RelationGetIndexExpressions(Relation relation); +extern List *RelationGetDummyIndexExpressions(Relation relation); +extern List *RelationGetIndexPredicate(Relation relation); +extern bytea **RelationGetIndexAttOptions(Relation relation, bool copy); + +/* + * Which set of columns to return by RelationGetIndexAttrBitmap. + */ +typedef enum IndexAttrBitmapKind +{ + INDEX_ATTR_BITMAP_KEY, + INDEX_ATTR_BITMAP_PRIMARY_KEY, + INDEX_ATTR_BITMAP_IDENTITY_KEY, + INDEX_ATTR_BITMAP_HOT_BLOCKING, + INDEX_ATTR_BITMAP_SUMMARIZED, +} IndexAttrBitmapKind; + +extern Bitmapset *RelationGetIndexAttrBitmap(Relation relation, + IndexAttrBitmapKind attrKind); + +extern Bitmapset *RelationGetIdentityKeyBitmap(Relation relation); + +extern void RelationGetExclusionInfo(Relation indexRelation, + Oid **operators, + Oid **procs, + uint16 **strategies); + +extern void RelationInitIndexAccessInfo(Relation relation); + +/* caller must include pg_publication.h */ +struct PublicationDesc; +extern void RelationBuildPublicationDesc(Relation relation, + struct PublicationDesc *pubdesc); + +extern void RelationInitTableAccessMethod(Relation relation); + +/* + * Routines to support ereport() reports of relation-related errors + */ +extern int errtable(Relation rel); +extern int errtablecol(Relation rel, int attnum); +extern int errtablecolname(Relation rel, const char *colname); +extern int errtableconstraint(Relation rel, const char *conname); + +/* + * Routines for backend startup + */ +extern void RelationCacheInitialize(void); +extern void RelationCacheInitializePhase2(void); +extern void RelationCacheInitializePhase3(void); + +/* + * Routine to create a relcache entry for an about-to-be-created relation + */ +extern Relation RelationBuildLocalRelation(const char *relname, + Oid relnamespace, + TupleDesc tupDesc, + Oid relid, + Oid accessmtd, + RelFileNumber relfilenumber, + Oid reltablespace, + bool shared_relation, + bool mapped_relation, + char relpersistence, + char relkind); + +/* + * Routines to manage assignment of new relfilenumber to a relation + */ +extern void RelationSetNewRelfilenumber(Relation relation, char persistence); +extern void RelationAssumeNewRelfilelocator(Relation relation); + +/* + * Routines for flushing/rebuilding relcache entries in various scenarios + */ +extern void RelationForgetRelation(Oid rid); + +extern void RelationCacheInvalidateEntry(Oid relationId); + +extern void RelationCacheInvalidate(bool debug_discard); + +#ifdef USE_ASSERT_CHECKING +extern void AssertPendingSyncs_RelationCache(void); +#else +#define AssertPendingSyncs_RelationCache() do {} while (0) +#endif +extern void AtEOXact_RelationCache(bool isCommit); +extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); + +/* + * Routines to help manage rebuilding of relcache init files + */ +extern bool RelationIdIsInInitFile(Oid relationId); +extern void RelationCacheInitFilePreInvalidate(void); +extern void RelationCacheInitFilePostInvalidate(void); +extern void RelationCacheInitFileRemove(void); + +/* should be used only by relcache.c and catcache.c */ +extern PGDLLIMPORT bool criticalRelcachesBuilt; + +/* should be used only by relcache.c and postinit.c */ +extern PGDLLIMPORT bool criticalSharedRelcachesBuilt; + +#endif /* RELCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relfilenumbermap.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relfilenumbermap.h new file mode 100644 index 0000000..86fadef --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relfilenumbermap.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * relfilenumbermap.h + * relfilenumber to oid mapping cache. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/relfilenumbermap.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELFILENUMBERMAP_H +#define RELFILENUMBERMAP_H + +#include "common/relpath.h" + +extern Oid RelidByRelfilenumber(Oid reltablespace, + RelFileNumber relfilenumber); + +#endif /* RELFILENUMBERMAP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relmapper.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relmapper.h new file mode 100644 index 0000000..ae1a756 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relmapper.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------- + * + * relmapper.h + * Catalog-to-filenumber mapping + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/relmapper.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELMAPPER_H +#define RELMAPPER_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" + +/* ---------------- + * relmap-related XLOG entries + * ---------------- + */ + +#define XLOG_RELMAP_UPDATE 0x00 + +typedef struct xl_relmap_update +{ + Oid dbid; /* database ID, or 0 for shared map */ + Oid tsid; /* database's tablespace, or pg_global */ + int32 nbytes; /* size of relmap data */ + char data[FLEXIBLE_ARRAY_MEMBER]; +} xl_relmap_update; + +#define MinSizeOfRelmapUpdate offsetof(xl_relmap_update, data) + + +extern RelFileNumber RelationMapOidToFilenumber(Oid relationId, bool shared); + +extern Oid RelationMapFilenumberToOid(RelFileNumber filenumber, bool shared); +extern RelFileNumber RelationMapOidToFilenumberForDatabase(char *dbpath, + Oid relationId); +extern void RelationMapCopy(Oid dbid, Oid tsid, char *srcdbpath, + char *dstdbpath); +extern void RelationMapUpdateMap(Oid relationId, RelFileNumber fileNumber, + bool shared, bool immediate); + +extern void RelationMapRemoveMapping(Oid relationId); + +extern void RelationMapInvalidate(bool shared); +extern void RelationMapInvalidateAll(void); + +extern void AtCCI_RelationMap(void); +extern void AtEOXact_RelationMap(bool isCommit, bool isParallelWorker); +extern void AtPrepare_RelationMap(void); + +extern void CheckPointRelationMap(void); + +extern void RelationMapFinishBootstrap(void); + +extern void RelationMapInitialize(void); +extern void RelationMapInitializePhase2(void); +extern void RelationMapInitializePhase3(void); + +extern Size EstimateRelationMapSpace(void); +extern void SerializeRelationMap(Size maxSize, char *startAddress); +extern void RestoreRelationMap(char *startAddress); + +extern void relmap_redo(XLogReaderState *record); +extern void relmap_desc(StringInfo buf, XLogReaderState *record); +extern const char *relmap_identify(uint8 info); + +#endif /* RELMAPPER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relptr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relptr.h new file mode 100644 index 0000000..ea340fe --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/relptr.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * relptr.h + * This file contains basic declarations for relative pointers. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/relptr.h + * + *------------------------------------------------------------------------- + */ + +#ifndef RELPTR_H +#define RELPTR_H + +/* + * Relative pointers are intended to be used when storing an address that may + * be relative either to the base of the process's address space or some + * dynamic shared memory segment mapped therein. + * + * The idea here is that you declare a relative pointer as relptr(type) + * and then use relptr_access to dereference it and relptr_store to change + * it. The use of a union here is a hack, because what's stored in the + * relptr is always a Size, never an actual pointer. But including a pointer + * in the union allows us to use stupid macro tricks to provide some measure + * of type-safety. + */ +#define relptr(type) union { type *relptr_type; Size relptr_off; } + +/* + * pgindent gets confused by declarations that use "relptr(type)" directly, + * so preferred style is to write + * typedef struct ... SomeStruct; + * relptr_declare(SomeStruct, RelptrSomeStruct); + * and then declare pointer variables as "RelptrSomeStruct someptr". + */ +#define relptr_declare(type, relptrtype) \ + typedef relptr(type) relptrtype + +#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P +#define relptr_access(base, rp) \ + (AssertVariableIsOfTypeMacro(base, char *), \ + (__typeof__((rp).relptr_type)) ((rp).relptr_off == 0 ? NULL : \ + (base) + (rp).relptr_off - 1)) +#else +/* + * If we don't have __builtin_types_compatible_p, assume we might not have + * __typeof__ either. + */ +#define relptr_access(base, rp) \ + (AssertVariableIsOfTypeMacro(base, char *), \ + (void *) ((rp).relptr_off == 0 ? NULL : (base) + (rp).relptr_off - 1)) +#endif + +#define relptr_is_null(rp) \ + ((rp).relptr_off == 0) + +#define relptr_offset(rp) \ + ((rp).relptr_off - 1) + +/* We use this inline to avoid double eval of "val" in relptr_store */ +static inline Size +relptr_store_eval(char *base, char *val) +{ + if (val == NULL) + return 0; + else + { + Assert(val >= base); + return val - base + 1; + } +} + +#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P +#define relptr_store(base, rp, val) \ + (AssertVariableIsOfTypeMacro(base, char *), \ + AssertVariableIsOfTypeMacro(val, __typeof__((rp).relptr_type)), \ + (rp).relptr_off = relptr_store_eval((base), (char *) (val))) +#else +/* + * If we don't have __builtin_types_compatible_p, assume we might not have + * __typeof__ either. + */ +#define relptr_store(base, rp, val) \ + (AssertVariableIsOfTypeMacro(base, char *), \ + (rp).relptr_off = relptr_store_eval((base), (char *) (val))) +#endif + +#define relptr_copy(rp1, rp2) \ + ((rp1).relptr_off = (rp2).relptr_off) + +#endif /* RELPTR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/reltrigger.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/reltrigger.h new file mode 100644 index 0000000..5fda290 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/reltrigger.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------------------- + * + * reltrigger.h + * POSTGRES relation trigger definitions. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/reltrigger.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELTRIGGER_H +#define RELTRIGGER_H + + +/* + * These struct really belongs to trigger.h, but we put it separately so that + * it can be cleanly included in rel.h and other places. + */ + +typedef struct Trigger +{ + Oid tgoid; /* OID of trigger (pg_trigger row) */ + /* Remaining fields are copied from pg_trigger, see pg_trigger.h */ + char *tgname; + Oid tgfoid; + int16 tgtype; + char tgenabled; + bool tgisinternal; + bool tgisclone; + Oid tgconstrrelid; + Oid tgconstrindid; + Oid tgconstraint; + bool tgdeferrable; + bool tginitdeferred; + int16 tgnargs; + int16 tgnattr; + int16 *tgattr; + char **tgargs; + char *tgqual; + char *tgoldtable; + char *tgnewtable; +} Trigger; + +typedef struct TriggerDesc +{ + Trigger *triggers; /* array of Trigger structs */ + int numtriggers; /* number of array entries */ + + /* + * These flags indicate whether the array contains at least one of each + * type of trigger. We use these to skip searching the array if not. + */ + bool trig_insert_before_row; + bool trig_insert_after_row; + bool trig_insert_instead_row; + bool trig_insert_before_statement; + bool trig_insert_after_statement; + bool trig_update_before_row; + bool trig_update_after_row; + bool trig_update_instead_row; + bool trig_update_before_statement; + bool trig_update_after_statement; + bool trig_delete_before_row; + bool trig_delete_after_row; + bool trig_delete_instead_row; + bool trig_delete_before_statement; + bool trig_delete_after_statement; + /* there are no row-level truncate triggers */ + bool trig_truncate_before_statement; + bool trig_truncate_after_statement; + /* Is there at least one trigger specifying each transition relation? */ + bool trig_insert_new_table; + bool trig_update_old_table; + bool trig_update_new_table; + bool trig_delete_old_table; +} TriggerDesc; + +#endif /* RELTRIGGER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/resowner.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/resowner.h new file mode 100644 index 0000000..aede4bf --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/resowner.h @@ -0,0 +1,172 @@ +/*------------------------------------------------------------------------- + * + * resowner.h + * POSTGRES resource owner definitions. + * + * Query-lifespan resources are tracked by associating them with + * ResourceOwner objects. This provides a simple mechanism for ensuring + * that such resources are freed at the right time. + * See utils/resowner/README for more info. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/resowner.h + * + *------------------------------------------------------------------------- + */ +#ifndef RESOWNER_H +#define RESOWNER_H + + +/* + * ResourceOwner objects are an opaque data structure known only within + * resowner.c. + */ +typedef struct ResourceOwnerData *ResourceOwner; + + +/* + * Globally known ResourceOwners + */ +extern PGDLLIMPORT ResourceOwner CurrentResourceOwner; +extern PGDLLIMPORT ResourceOwner CurTransactionResourceOwner; +extern PGDLLIMPORT ResourceOwner TopTransactionResourceOwner; +extern PGDLLIMPORT ResourceOwner AuxProcessResourceOwner; + +/* + * Resource releasing is done in three phases: pre-locks, locks, and + * post-locks. The pre-lock phase must release any resources that are visible + * to other backends (such as pinned buffers); this ensures that when we + * release a lock that another backend may be waiting on, it will see us as + * being fully out of our transaction. The post-lock phase should be used for + * backend-internal cleanup. + * + * Within each phase, resources are released in priority order. Priority is + * just an integer specified in ResourceOwnerDesc. The priorities of built-in + * resource types are given below, extensions may use any priority relative to + * those or RELEASE_PRIO_FIRST/LAST. RELEASE_PRIO_FIRST is a fine choice if + * your resource doesn't depend on any other resources. + */ +typedef enum +{ + RESOURCE_RELEASE_BEFORE_LOCKS = 1, + RESOURCE_RELEASE_LOCKS, + RESOURCE_RELEASE_AFTER_LOCKS, +} ResourceReleasePhase; + +typedef uint32 ResourceReleasePriority; + +/* priorities of built-in BEFORE_LOCKS resources */ +#define RELEASE_PRIO_BUFFER_IOS 100 +#define RELEASE_PRIO_BUFFER_PINS 200 +#define RELEASE_PRIO_RELCACHE_REFS 300 +#define RELEASE_PRIO_DSMS 400 +#define RELEASE_PRIO_JIT_CONTEXTS 500 +#define RELEASE_PRIO_CRYPTOHASH_CONTEXTS 600 +#define RELEASE_PRIO_HMAC_CONTEXTS 700 + +/* priorities of built-in AFTER_LOCKS resources */ +#define RELEASE_PRIO_CATCACHE_REFS 100 +#define RELEASE_PRIO_CATCACHE_LIST_REFS 200 +#define RELEASE_PRIO_PLANCACHE_REFS 300 +#define RELEASE_PRIO_TUPDESC_REFS 400 +#define RELEASE_PRIO_SNAPSHOT_REFS 500 +#define RELEASE_PRIO_FILES 600 +#define RELEASE_PRIO_WAITEVENTSETS 700 + +/* 0 is considered invalid */ +#define RELEASE_PRIO_FIRST 1 +#define RELEASE_PRIO_LAST UINT32_MAX + +/* + * In order to track an object, resowner.c needs a few callbacks for it. + * The callbacks for resources of a specific kind are encapsulated in + * ResourceOwnerDesc. + * + * Note that the callbacks occur post-commit or post-abort, so the callback + * functions can only do noncritical cleanup and must not fail. + */ +typedef struct ResourceOwnerDesc +{ + const char *name; /* name for the object kind, for debugging */ + + /* when are these objects released? */ + ResourceReleasePhase release_phase; + ResourceReleasePriority release_priority; + + /* + * Release resource. + * + * This is called for each resource in the resource owner, in the order + * specified by 'release_phase' and 'release_priority' when the whole + * resource owner is been released or when ResourceOwnerReleaseAllOfKind() + * is called. The resource is implicitly removed from the owner, the + * callback function doesn't need to call ResourceOwnerForget. + */ + void (*ReleaseResource) (Datum res); + + /* + * Format a string describing the resource, for debugging purposes. If a + * resource has not been properly released before commit, this is used to + * print a WARNING. + * + * This can be left to NULL, in which case a generic "[resource name]: %p" + * format is used. + */ + char *(*DebugPrint) (Datum res); + +} ResourceOwnerDesc; + +/* + * Dynamically loaded modules can get control during ResourceOwnerRelease + * by providing a callback of this form. + */ +typedef void (*ResourceReleaseCallback) (ResourceReleasePhase phase, + bool isCommit, + bool isTopLevel, + void *arg); + + +/* + * Functions in resowner.c + */ + +/* generic routines */ +extern ResourceOwner ResourceOwnerCreate(ResourceOwner parent, + const char *name); +extern void ResourceOwnerRelease(ResourceOwner owner, + ResourceReleasePhase phase, + bool isCommit, + bool isTopLevel); +extern void ResourceOwnerDelete(ResourceOwner owner); +extern ResourceOwner ResourceOwnerGetParent(ResourceOwner owner); +extern void ResourceOwnerNewParent(ResourceOwner owner, + ResourceOwner newparent); + +extern void ResourceOwnerEnlarge(ResourceOwner owner); +extern void ResourceOwnerRemember(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind); +extern void ResourceOwnerForget(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind); + +extern void ResourceOwnerReleaseAllOfKind(ResourceOwner owner, const ResourceOwnerDesc *kind); + +extern void RegisterResourceReleaseCallback(ResourceReleaseCallback callback, + void *arg); +extern void UnregisterResourceReleaseCallback(ResourceReleaseCallback callback, + void *arg); + +extern void CreateAuxProcessResourceOwner(void); +extern void ReleaseAuxProcessResources(bool isCommit); + +/* special support for local lock management */ +struct LOCALLOCK; +extern void ResourceOwnerRememberLock(ResourceOwner owner, struct LOCALLOCK *locallock); +extern void ResourceOwnerForgetLock(ResourceOwner owner, struct LOCALLOCK *locallock); + +/* special support for AIO */ +struct dlist_node; +extern void ResourceOwnerRememberAioHandle(ResourceOwner owner, struct dlist_node *ioh_node); +extern void ResourceOwnerForgetAioHandle(ResourceOwner owner, struct dlist_node *ioh_node); + +#endif /* RESOWNER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/rls.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/rls.h new file mode 100644 index 0000000..d18ac36 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/rls.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * rls.h + * Header file for Row Level Security (RLS) utility commands to be used + * with the rowsecurity feature. + * + * Copyright (c) 2007-2025, PostgreSQL Global Development Group + * + * src/include/utils/rls.h + * + *------------------------------------------------------------------------- + */ +#ifndef RLS_H +#define RLS_H + +/* GUC variable */ +extern PGDLLIMPORT bool row_security; + +/* + * Used by callers of check_enable_rls. + * + * RLS could be completely disabled on the tables involved in the query, + * which is the simple case, or it may depend on the current environment + * (the role which is running the query or the value of the row_security + * GUC), or it might be simply enabled as usual. + * + * If RLS isn't on the table involved then RLS_NONE is returned to indicate + * that we don't need to worry about invalidating the query plan for RLS + * reasons. If RLS is on the table, but we are bypassing it for now, then + * we return RLS_NONE_ENV to indicate that, if the environment changes, + * we need to invalidate and replan. Finally, if RLS should be turned on + * for the query, then we return RLS_ENABLED, which means we also need to + * invalidate if the environment changes. + * + * Note that RLS_ENABLED will also be returned if noError is true + * (indicating that the caller simply want to know if RLS should be applied + * for this user but doesn't want an error thrown if it is; this is used + * by other error cases where we're just trying to decide if data from the + * table should be passed back to the user or not). + */ +enum CheckEnableRlsResult +{ + RLS_NONE, + RLS_NONE_ENV, + RLS_ENABLED, +}; + +extern int check_enable_rls(Oid relid, Oid checkAsUser, bool noError); + +#endif /* RLS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/ruleutils.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/ruleutils.h new file mode 100644 index 0000000..5f2ea2e --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/ruleutils.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * ruleutils.h + * Declarations for ruleutils.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/ruleutils.h + * + *------------------------------------------------------------------------- + */ +#ifndef RULEUTILS_H +#define RULEUTILS_H + +#include "nodes/nodes.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" + +struct Plan; /* avoid including plannodes.h here */ +struct PlannedStmt; + +/* Flags for pg_get_indexdef_columns_extended() */ +#define RULE_INDEXDEF_PRETTY 0x01 +#define RULE_INDEXDEF_KEYS_ONLY 0x02 /* ignore included attributes */ + +extern char *pg_get_indexdef_string(Oid indexrelid); +extern char *pg_get_indexdef_columns(Oid indexrelid, bool pretty); +extern char *pg_get_indexdef_columns_extended(Oid indexrelid, + bits16 flags); +extern char *pg_get_querydef(Query *query, bool pretty); + +extern char *pg_get_partkeydef_columns(Oid relid, bool pretty); +extern char *pg_get_partconstrdef_string(Oid partitionId, char *aliasname); + +extern char *pg_get_constraintdef_command(Oid constraintId); +extern char *deparse_expression(Node *expr, List *dpcontext, + bool forceprefix, bool showimplicit); +extern List *deparse_context_for(const char *aliasname, Oid relid); +extern List *deparse_context_for_plan_tree(struct PlannedStmt *pstmt, + List *rtable_names); +extern List *set_deparse_context_plan(List *dpcontext, + struct Plan *plan, List *ancestors); +extern List *select_rtable_names_for_explain(List *rtable, + Bitmapset *rels_used); +extern char *get_window_frame_options_for_explain(int frameOptions, + Node *startOffset, + Node *endOffset, + List *dpcontext, + bool forceprefix); +extern char *generate_collation_name(Oid collid); +extern char *generate_opclass_name(Oid opclass); +extern char *get_range_partbound_string(List *bound_datums); + +extern char *pg_get_statisticsobjdef_string(Oid statextid); + +#endif /* RULEUTILS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/sampling.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/sampling.h new file mode 100644 index 0000000..02c550a --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/sampling.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * sampling.h + * definitions for sampling functions + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/sampling.h + * + *------------------------------------------------------------------------- + */ +#ifndef SAMPLING_H +#define SAMPLING_H + +#include "common/pg_prng.h" +#include "storage/block.h" /* for typedef BlockNumber */ + + +/* Random generator for sampling code */ +extern void sampler_random_init_state(uint32 seed, + pg_prng_state *randstate); +extern double sampler_random_fract(pg_prng_state *randstate); + +/* Block sampling methods */ + +/* Data structure for Algorithm S from Knuth 3.4.2 */ +typedef struct +{ + BlockNumber N; /* number of blocks, known in advance */ + int n; /* desired sample size */ + BlockNumber t; /* current block number */ + int m; /* blocks selected so far */ + pg_prng_state randstate; /* random generator state */ +} BlockSamplerData; + +typedef BlockSamplerData *BlockSampler; + +extern BlockNumber BlockSampler_Init(BlockSampler bs, BlockNumber nblocks, + int samplesize, uint32 randseed); +extern bool BlockSampler_HasMore(BlockSampler bs); +extern BlockNumber BlockSampler_Next(BlockSampler bs); + +/* Reservoir sampling methods */ + +typedef struct +{ + double W; + pg_prng_state randstate; /* random generator state */ +} ReservoirStateData; + +typedef ReservoirStateData *ReservoirState; + +extern void reservoir_init_selection_state(ReservoirState rs, int n); +extern double reservoir_get_next_S(ReservoirState rs, double t, int n); + +/* Old API, still in use by assorted FDWs */ +/* For backwards compatibility, these declarations are duplicated in vacuum.h */ + +extern double anl_random_fract(void); +extern double anl_init_selection_state(int n); +extern double anl_get_next_S(double t, int n, double *stateptr); + +#endif /* SAMPLING_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/selfuncs.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/selfuncs.h new file mode 100644 index 0000000..fb4fa53 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/selfuncs.h @@ -0,0 +1,251 @@ +/*------------------------------------------------------------------------- + * + * selfuncs.h + * Selectivity functions for standard operators, and assorted + * infrastructure for selectivity and cost estimation. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/selfuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef SELFUNCS_H +#define SELFUNCS_H + +#include "access/htup.h" +#include "fmgr.h" +#include "nodes/pathnodes.h" + + +/* + * Note: the default selectivity estimates are not chosen entirely at random. + * We want them to be small enough to ensure that indexscans will be used if + * available, for typical table densities of ~100 tuples/page. Thus, for + * example, 0.01 is not quite small enough, since that makes it appear that + * nearly all pages will be hit anyway. Also, since we sometimes estimate + * eqsel as 1/num_distinct, we probably want DEFAULT_NUM_DISTINCT to equal + * 1/DEFAULT_EQ_SEL. + */ + +/* default selectivity estimate for equalities such as "A = b" */ +#define DEFAULT_EQ_SEL 0.005 + +/* default selectivity estimate for inequalities such as "A < b" */ +#define DEFAULT_INEQ_SEL 0.3333333333333333 + +/* default selectivity estimate for range inequalities "A > b AND A < c" */ +#define DEFAULT_RANGE_INEQ_SEL 0.005 + +/* default selectivity estimate for multirange inequalities "A > b AND A < c" */ +#define DEFAULT_MULTIRANGE_INEQ_SEL 0.005 + +/* default selectivity estimate for pattern-match operators such as LIKE */ +#define DEFAULT_MATCH_SEL 0.005 + +/* default selectivity estimate for other matching operators */ +#define DEFAULT_MATCHING_SEL 0.010 + +/* default number of distinct values in a table */ +#define DEFAULT_NUM_DISTINCT 200 + +/* default selectivity estimate for boolean and null test nodes */ +#define DEFAULT_UNK_SEL 0.005 +#define DEFAULT_NOT_UNK_SEL (1.0 - DEFAULT_UNK_SEL) + + +/* + * Clamp a computed probability estimate (which may suffer from roundoff or + * estimation errors) to valid range. Argument must be a float variable. + */ +#define CLAMP_PROBABILITY(p) \ + do { \ + if (p < 0.0) \ + p = 0.0; \ + else if (p > 1.0) \ + p = 1.0; \ + } while (0) + +/* + * A set of flags which some selectivity estimation functions can pass back to + * callers to provide further details about some assumptions which were made + * during the estimation. + */ +#define SELFLAG_USED_DEFAULT (1 << 0) /* Estimation fell back on one + * of the DEFAULTs as defined + * above. */ + +typedef struct EstimationInfo +{ + uint32 flags; /* Flags, as defined above to mark special + * properties of the estimation. */ +} EstimationInfo; + +/* Return data from examine_variable and friends */ +typedef struct VariableStatData +{ + Node *var; /* the Var or expression tree */ + RelOptInfo *rel; /* Relation, or NULL if not identifiable */ + HeapTuple statsTuple; /* pg_statistic tuple, or NULL if none */ + /* NB: if statsTuple!=NULL, it must be freed when caller is done */ + void (*freefunc) (HeapTuple tuple); /* how to free statsTuple */ + Oid vartype; /* exposed type of expression */ + Oid atttype; /* actual type (after stripping relabel) */ + int32 atttypmod; /* actual typmod (after stripping relabel) */ + bool isunique; /* matches unique index, DISTINCT or GROUP-BY + * clause */ + bool acl_ok; /* true if user has SELECT privilege on all + * rows from the table or column */ +} VariableStatData; + +#define ReleaseVariableStats(vardata) \ + do { \ + if (HeapTupleIsValid((vardata).statsTuple)) \ + (vardata).freefunc((vardata).statsTuple); \ + } while(0) + + +/* + * genericcostestimate is a general-purpose estimator that can be used for + * most index types. In some cases we use genericcostestimate as the base + * code and then incorporate additional index-type-specific knowledge in + * the type-specific calling function. To avoid code duplication, we make + * genericcostestimate return a number of intermediate values as well as + * its preliminary estimates of the output cost values. The GenericCosts + * struct includes all these values. + * + * Callers should initialize all fields of GenericCosts to zero. In addition, + * they can set numIndexTuples to some positive value if they have a better + * than default way of estimating the number of leaf index tuples visited. + * Similarly, they can set num_sa_scans to some value >= 1 for an index AM + * that doesn't necessarily perform exactly one primitive index scan per + * distinct combination of ScalarArrayOp array elements. + */ +typedef struct +{ + /* These are the values the cost estimator must return to the planner */ + Cost indexStartupCost; /* index-related startup cost */ + Cost indexTotalCost; /* total index-related scan cost */ + Selectivity indexSelectivity; /* selectivity of index */ + double indexCorrelation; /* order correlation of index */ + + /* Intermediate values we obtain along the way */ + double numIndexPages; /* number of leaf pages visited */ + double numIndexTuples; /* number of leaf tuples visited */ + double spc_random_page_cost; /* relevant random_page_cost value */ + double num_sa_scans; /* # indexscans from ScalarArrayOpExprs */ +} GenericCosts; + +/* Hooks for plugins to get control when we ask for stats */ +typedef bool (*get_relation_stats_hook_type) (PlannerInfo *root, + RangeTblEntry *rte, + AttrNumber attnum, + VariableStatData *vardata); +extern PGDLLIMPORT get_relation_stats_hook_type get_relation_stats_hook; +typedef bool (*get_index_stats_hook_type) (PlannerInfo *root, + Oid indexOid, + AttrNumber indexattnum, + VariableStatData *vardata); +extern PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook; + +/* Functions in selfuncs.c */ + +extern void examine_variable(PlannerInfo *root, Node *node, int varRelid, + VariableStatData *vardata); +extern bool all_rows_selectable(PlannerInfo *root, Index varno, Bitmapset *varattnos); +extern bool statistic_proc_security_check(VariableStatData *vardata, Oid func_oid); +extern bool get_restriction_variable(PlannerInfo *root, List *args, + int varRelid, + VariableStatData *vardata, Node **other, + bool *varonleft); +extern void get_join_variables(PlannerInfo *root, List *args, + SpecialJoinInfo *sjinfo, + VariableStatData *vardata1, + VariableStatData *vardata2, + bool *join_is_reversed); +extern double get_variable_numdistinct(VariableStatData *vardata, + bool *isdefault); +extern double mcv_selectivity(VariableStatData *vardata, + FmgrInfo *opproc, Oid collation, + Datum constval, bool varonleft, + double *sumcommonp); +extern double histogram_selectivity(VariableStatData *vardata, + FmgrInfo *opproc, Oid collation, + Datum constval, bool varonleft, + int min_hist_size, int n_skip, + int *hist_size); +extern double generic_restriction_selectivity(PlannerInfo *root, + Oid oproid, Oid collation, + List *args, int varRelid, + double default_selectivity); +extern double ineq_histogram_selectivity(PlannerInfo *root, + VariableStatData *vardata, + Oid opoid, FmgrInfo *opproc, + bool isgt, bool iseq, + Oid collation, + Datum constval, Oid consttype); +extern double var_eq_const(VariableStatData *vardata, + Oid oproid, Oid collation, + Datum constval, bool constisnull, + bool varonleft, bool negate); +extern double var_eq_non_const(VariableStatData *vardata, + Oid oproid, Oid collation, + Node *other, + bool varonleft, bool negate); + +extern Selectivity boolvarsel(PlannerInfo *root, Node *arg, int varRelid); +extern Selectivity booltestsel(PlannerInfo *root, BoolTestType booltesttype, + Node *arg, int varRelid, + JoinType jointype, SpecialJoinInfo *sjinfo); +extern Selectivity nulltestsel(PlannerInfo *root, NullTestType nulltesttype, + Node *arg, int varRelid, + JoinType jointype, SpecialJoinInfo *sjinfo); +extern Selectivity scalararraysel(PlannerInfo *root, + ScalarArrayOpExpr *clause, + bool is_join_clause, + int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); +extern double estimate_array_length(PlannerInfo *root, Node *arrayexpr); +extern Selectivity rowcomparesel(PlannerInfo *root, + RowCompareExpr *clause, + int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); + +extern void mergejoinscansel(PlannerInfo *root, Node *clause, + Oid opfamily, CompareType cmptype, bool nulls_first, + Selectivity *leftstart, Selectivity *leftend, + Selectivity *rightstart, Selectivity *rightend); + +extern double estimate_num_groups(PlannerInfo *root, List *groupExprs, + double input_rows, List **pgset, + EstimationInfo *estinfo); + +extern List *estimate_multivariate_bucketsize(PlannerInfo *root, + RelOptInfo *inner, + List *hashclauses, + Selectivity *innerbucketsize); +extern void estimate_hash_bucket_stats(PlannerInfo *root, + Node *hashkey, double nbuckets, + Selectivity *mcv_freq, + Selectivity *bucketsize_frac); +extern double estimate_hashagg_tablesize(PlannerInfo *root, Path *path, + const AggClauseCosts *agg_costs, + double dNumGroups); + +extern List *get_quals_from_indexclauses(List *indexclauses); +extern Cost index_other_operands_eval_cost(PlannerInfo *root, + List *indexquals); +extern List *add_predicate_to_index_quals(IndexOptInfo *index, + List *indexQuals); +extern void genericcostestimate(PlannerInfo *root, IndexPath *path, + double loop_count, + GenericCosts *costs); + +/* Functions in array_selfuncs.c */ + +extern Selectivity scalararraysel_containment(PlannerInfo *root, + Node *leftop, Node *rightop, + Oid elemtype, bool isEquality, bool useOr, + int varRelid); + +#endif /* SELFUNCS_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/sharedtuplestore.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/sharedtuplestore.h new file mode 100644 index 0000000..9cc6514 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/sharedtuplestore.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * sharedtuplestore.h + * Simple mechanism for sharing tuples between backends. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/sharedtuplestore.h + * + *------------------------------------------------------------------------- + */ +#ifndef SHAREDTUPLESTORE_H +#define SHAREDTUPLESTORE_H + +#include "access/htup.h" +#include "storage/fd.h" +#include "storage/sharedfileset.h" + +struct SharedTuplestore; +typedef struct SharedTuplestore SharedTuplestore; + +struct SharedTuplestoreAccessor; +typedef struct SharedTuplestoreAccessor SharedTuplestoreAccessor; + +/* + * A flag indicating that the tuplestore will only be scanned once, so backing + * files can be unlinked early. + */ +#define SHARED_TUPLESTORE_SINGLE_PASS 0x01 + +extern size_t sts_estimate(int participants); + +extern SharedTuplestoreAccessor *sts_initialize(SharedTuplestore *sts, + int participants, + int my_participant_number, + size_t meta_data_size, + int flags, + SharedFileSet *fileset, + const char *name); + +extern SharedTuplestoreAccessor *sts_attach(SharedTuplestore *sts, + int my_participant_number, + SharedFileSet *fileset); + +extern void sts_end_write(SharedTuplestoreAccessor *accessor); + +extern void sts_reinitialize(SharedTuplestoreAccessor *accessor); + +extern void sts_begin_parallel_scan(SharedTuplestoreAccessor *accessor); + +extern void sts_end_parallel_scan(SharedTuplestoreAccessor *accessor); + +extern void sts_puttuple(SharedTuplestoreAccessor *accessor, + void *meta_data, + MinimalTuple tuple); + +extern MinimalTuple sts_parallel_scan_next(SharedTuplestoreAccessor *accessor, + void *meta_data); + +#endif /* SHAREDTUPLESTORE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/skipsupport.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/skipsupport.h new file mode 100644 index 0000000..c42be00 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/skipsupport.h @@ -0,0 +1,98 @@ +/*------------------------------------------------------------------------- + * + * skipsupport.h + * Support routines for B-Tree skip scan. + * + * B-Tree operator classes for discrete types can optionally provide a support + * function for skipping. This is used during skip scans. + * + * A B-tree operator class that implements skip support provides B-tree index + * scans with a way of enumerating and iterating through every possible value + * from the domain of indexable values. This gives scans a way to determine + * the next value in line for a given skip array/scan key/skipped attribute. + * Scans request the next (or previous) value whenever they run out of tuples + * matching the skip array's current element value. The next (or previous) + * value can be used to relocate the scan; it is applied in combination with + * at least one additional lower-order non-skip key, taken from the query. + * + * Skip support is used by discrete type (e.g., integer and date) opclasses. + * Indexes with an attribute whose input opclass is of one of these types tend + * to store adjacent values in adjoining groups of index tuples. Each time a + * skip scan with skip support successfully guesses that the next value in the + * index (for a given skipped column) is indeed the value that skip support + * just incremented its skip array to, it will have saved the scan some work. + * The scan will have avoided an index probe that directly finds the next + * value that appears in the index. (When skip support guesses wrong, then it + * won't have saved any work, but it also won't have added any useless work. + * The failed attempt to locate exactly-matching index tuples acts just like + * an explicit probe would; it'll still find the index's true next value.) + * + * It usually isn't feasible to implement skip support for an opclass whose + * input type is continuous. The B-Tree code falls back on next-key sentinel + * values for any opclass that doesn't provide its own skip support function. + * This isn't really an implementation restriction; there is no benefit to + * providing skip support for an opclass where guessing that the next indexed + * value is the next possible indexable value never (or hardly ever) works out. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/skipsupport.h + * + *------------------------------------------------------------------------- + */ +#ifndef SKIPSUPPORT_H +#define SKIPSUPPORT_H + +#include "utils/relcache.h" + +typedef struct SkipSupportData *SkipSupport; +typedef Datum (*SkipSupportIncDec) (Relation rel, + Datum existing, + bool *overflow); + +/* + * State/callbacks used by skip arrays to procedurally generate elements. + * + * A BTSKIPSUPPORT_PROC function must set each and every field when called + * (there are no optional fields). + */ +typedef struct SkipSupportData +{ + /* + * low_elem and high_elem must be set with the lowest and highest possible + * values from the domain of indexable values (assuming ascending order) + */ + Datum low_elem; /* lowest sorting/leftmost non-NULL value */ + Datum high_elem; /* highest sorting/rightmost non-NULL value */ + + /* + * Decrement/increment functions. + * + * Returns a decremented/incremented copy of caller's existing datum, + * allocated in caller's memory context (for pass-by-reference types). + * It's not okay for these functions to leak any memory. + * + * When the decrement function (or increment function) is called with a + * value that already matches low_elem (or high_elem), function must set + * the *overflow argument. The return value is treated as undefined by + * the B-Tree code; it shouldn't need to be (and won't be) pfree'd. + * + * The B-Tree code's "existing" datum argument is often just a straight + * copy of a value from an index tuple. Operator classes must accept + * every possible representational variation within the underlying type. + * On the other hand, opclasses are _not_ required to preserve information + * that doesn't affect how datums are sorted (e.g., skip support for a + * fixed precision numeric type needn't preserve datum display scale). + * Operator class decrement/increment functions will never be called with + * a NULL "existing" argument, either. + */ + SkipSupportIncDec decrement; + SkipSupportIncDec increment; +} SkipSupportData; + +extern SkipSupport PrepareSkipSupportFromOpclass(Oid opfamily, Oid opcintype, + bool reverse); + +#endif /* SKIPSUPPORT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/snapmgr.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/snapmgr.h new file mode 100644 index 0000000..d346be7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/snapmgr.h @@ -0,0 +1,122 @@ +/*------------------------------------------------------------------------- + * + * snapmgr.h + * POSTGRES snapshot manager + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/snapmgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef SNAPMGR_H +#define SNAPMGR_H + +#include "access/transam.h" +#include "utils/relcache.h" +#include "utils/resowner.h" +#include "utils/snapshot.h" + + +extern PGDLLIMPORT bool FirstSnapshotSet; + +extern PGDLLIMPORT TransactionId TransactionXmin; +extern PGDLLIMPORT TransactionId RecentXmin; + +/* Variables representing various special snapshot semantics */ +extern PGDLLIMPORT SnapshotData SnapshotSelfData; +extern PGDLLIMPORT SnapshotData SnapshotAnyData; +extern PGDLLIMPORT SnapshotData SnapshotToastData; + +#define SnapshotSelf (&SnapshotSelfData) +#define SnapshotAny (&SnapshotAnyData) + +/* Use get_toast_snapshot() for the TOAST snapshot */ + +/* + * We don't provide a static SnapshotDirty variable because it would be + * non-reentrant. Instead, users of that snapshot type should declare a + * local variable of type SnapshotData, and initialize it with this macro. + */ +#define InitDirtySnapshot(snapshotdata) \ + ((snapshotdata).snapshot_type = SNAPSHOT_DIRTY) + +/* + * Similarly, some initialization is required for a NonVacuumable snapshot. + * The caller must supply the visibility cutoff state to use (c.f. + * GlobalVisTestFor()). + */ +#define InitNonVacuumableSnapshot(snapshotdata, vistestp) \ + ((snapshotdata).snapshot_type = SNAPSHOT_NON_VACUUMABLE, \ + (snapshotdata).vistest = (vistestp)) + +/* This macro encodes the knowledge of which snapshots are MVCC-safe */ +#define IsMVCCSnapshot(snapshot) \ + ((snapshot)->snapshot_type == SNAPSHOT_MVCC || \ + (snapshot)->snapshot_type == SNAPSHOT_HISTORIC_MVCC) + +extern Snapshot GetTransactionSnapshot(void); +extern Snapshot GetLatestSnapshot(void); +extern void SnapshotSetCommandId(CommandId curcid); + +extern Snapshot GetCatalogSnapshot(Oid relid); +extern Snapshot GetNonHistoricCatalogSnapshot(Oid relid); +extern void InvalidateCatalogSnapshot(void); +extern void InvalidateCatalogSnapshotConditionally(void); + +extern void PushActiveSnapshot(Snapshot snapshot); +extern void PushActiveSnapshotWithLevel(Snapshot snapshot, int snap_level); +extern void PushCopiedSnapshot(Snapshot snapshot); +extern void UpdateActiveSnapshotCommandId(void); +extern void PopActiveSnapshot(void); +extern Snapshot GetActiveSnapshot(void); +extern bool ActiveSnapshotSet(void); + +extern Snapshot RegisterSnapshot(Snapshot snapshot); +extern void UnregisterSnapshot(Snapshot snapshot); +extern Snapshot RegisterSnapshotOnOwner(Snapshot snapshot, ResourceOwner owner); +extern void UnregisterSnapshotFromOwner(Snapshot snapshot, ResourceOwner owner); + +extern void AtSubCommit_Snapshot(int level); +extern void AtSubAbort_Snapshot(int level); +extern void AtEOXact_Snapshot(bool isCommit, bool resetXmin); + +extern void ImportSnapshot(const char *idstr); +extern bool XactHasExportedSnapshots(void); +extern void DeleteAllExportedSnapshotFiles(void); +extern void WaitForOlderSnapshots(TransactionId limitXmin, bool progress); +extern bool ThereAreNoPriorRegisteredSnapshots(void); +extern bool HaveRegisteredOrActiveSnapshot(void); + +extern char *ExportSnapshot(Snapshot snapshot); + +/* + * These live in procarray.c because they're intimately linked to the + * procarray contents, but thematically they better fit into snapmgr.h. + */ +typedef struct GlobalVisState GlobalVisState; +extern GlobalVisState *GlobalVisTestFor(Relation rel); +extern bool GlobalVisTestIsRemovableXid(GlobalVisState *state, TransactionId xid); +extern bool GlobalVisTestIsRemovableFullXid(GlobalVisState *state, FullTransactionId fxid); +extern bool GlobalVisCheckRemovableXid(Relation rel, TransactionId xid); +extern bool GlobalVisCheckRemovableFullXid(Relation rel, FullTransactionId fxid); + +/* + * Utility functions for implementing visibility routines in table AMs. + */ +extern bool XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot); + +/* Support for catalog timetravel for logical decoding */ +struct HTAB; +extern struct HTAB *HistoricSnapshotGetTupleCids(void); +extern void SetupHistoricSnapshot(Snapshot historic_snapshot, struct HTAB *tuplecids); +extern void TeardownHistoricSnapshot(bool is_error); +extern bool HistoricSnapshotActive(void); + +extern Size EstimateSnapshotSpace(Snapshot snapshot); +extern void SerializeSnapshot(Snapshot snapshot, char *start_address); +extern Snapshot RestoreSnapshot(char *start_address); +extern void RestoreTransactionSnapshot(Snapshot snapshot, void *source_pgproc); + +#endif /* SNAPMGR_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/snapshot.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/snapshot.h new file mode 100644 index 0000000..0e546ec --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/snapshot.h @@ -0,0 +1,212 @@ +/*------------------------------------------------------------------------- + * + * snapshot.h + * POSTGRES snapshot definition + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/snapshot.h + * + *------------------------------------------------------------------------- + */ +#ifndef SNAPSHOT_H +#define SNAPSHOT_H + +#include "lib/pairingheap.h" + + +/* + * The different snapshot types. We use SnapshotData structures to represent + * both "regular" (MVCC) snapshots and "special" snapshots that have non-MVCC + * semantics. The specific semantics of a snapshot are encoded by its type. + * + * The behaviour of each type of snapshot should be documented alongside its + * enum value, best in terms that are not specific to an individual table AM. + * + * The reason the snapshot type rather than a callback as it used to be is + * that that allows to use the same snapshot for different table AMs without + * having one callback per AM. + */ +typedef enum SnapshotType +{ + /*------------------------------------------------------------------------- + * A tuple is visible iff the tuple is valid for the given MVCC snapshot. + * + * Here, we consider the effects of: + * - all transactions committed as of the time of the given snapshot + * - previous commands of this transaction + * + * Does _not_ include: + * - transactions shown as in-progress by the snapshot + * - transactions started after the snapshot was taken + * - changes made by the current command + * ------------------------------------------------------------------------- + */ + SNAPSHOT_MVCC = 0, + + /*------------------------------------------------------------------------- + * A tuple is visible iff the tuple is valid "for itself". + * + * Here, we consider the effects of: + * - all committed transactions (as of the current instant) + * - previous commands of this transaction + * - changes made by the current command + * + * Does _not_ include: + * - in-progress transactions (as of the current instant) + * ------------------------------------------------------------------------- + */ + SNAPSHOT_SELF, + + /* + * Any tuple is visible. + */ + SNAPSHOT_ANY, + + /* + * A tuple is visible iff the tuple is valid as a TOAST row. + */ + SNAPSHOT_TOAST, + + /*------------------------------------------------------------------------- + * A tuple is visible iff the tuple is valid including effects of open + * transactions. + * + * Here, we consider the effects of: + * - all committed and in-progress transactions (as of the current instant) + * - previous commands of this transaction + * - changes made by the current command + * + * This is essentially like SNAPSHOT_SELF as far as effects of the current + * transaction and committed/aborted xacts are concerned. However, it + * also includes the effects of other xacts still in progress. + * + * A special hack is that when a snapshot of this type is used to + * determine tuple visibility, the passed-in snapshot struct is used as an + * output argument to return the xids of concurrent xacts that affected + * the tuple. snapshot->xmin is set to the tuple's xmin if that is + * another transaction that's still in progress; or to + * InvalidTransactionId if the tuple's xmin is committed good, committed + * dead, or my own xact. Similarly for snapshot->xmax and the tuple's + * xmax. If the tuple was inserted speculatively, meaning that the + * inserter might still back down on the insertion without aborting the + * whole transaction, the associated token is also returned in + * snapshot->speculativeToken. See also InitDirtySnapshot(). + * ------------------------------------------------------------------------- + */ + SNAPSHOT_DIRTY, + + /* + * A tuple is visible iff it follows the rules of SNAPSHOT_MVCC, but + * supports being called in timetravel context (for decoding catalog + * contents in the context of logical decoding). + */ + SNAPSHOT_HISTORIC_MVCC, + + /* + * A tuple is visible iff the tuple might be visible to some transaction; + * false if it's surely dead to everyone, i.e., vacuumable. + * + * For visibility checks snapshot->min must have been set up with the xmin + * horizon to use. + */ + SNAPSHOT_NON_VACUUMABLE, +} SnapshotType; + +typedef struct SnapshotData *Snapshot; + +#define InvalidSnapshot ((Snapshot) NULL) + +/* + * Struct representing all kind of possible snapshots. + * + * There are several different kinds of snapshots: + * * Normal MVCC snapshots + * * MVCC snapshots taken during recovery (in Hot-Standby mode) + * * Historic MVCC snapshots used during logical decoding + * * snapshots passed to HeapTupleSatisfiesDirty() + * * snapshots passed to HeapTupleSatisfiesNonVacuumable() + * * snapshots used for SatisfiesAny, Toast, Self where no members are + * accessed. + * + * TODO: It's probably a good idea to split this struct using a NodeTag + * similar to how parser and executor nodes are handled, with one type for + * each different kind of snapshot to avoid overloading the meaning of + * individual fields. + */ +typedef struct SnapshotData +{ + SnapshotType snapshot_type; /* type of snapshot */ + + /* + * The remaining fields are used only for MVCC snapshots, and are normally + * just zeroes in special snapshots. (But xmin and xmax are used + * specially by HeapTupleSatisfiesDirty, and xmin is used specially by + * HeapTupleSatisfiesNonVacuumable.) + * + * An MVCC snapshot can never see the effects of XIDs >= xmax. It can see + * the effects of all older XIDs except those listed in the snapshot. xmin + * is stored as an optimization to avoid needing to search the XID arrays + * for most tuples. + */ + TransactionId xmin; /* all XID < xmin are visible to me */ + TransactionId xmax; /* all XID >= xmax are invisible to me */ + + /* + * For normal MVCC snapshot this contains the all xact IDs that are in + * progress, unless the snapshot was taken during recovery in which case + * it's empty. For historic MVCC snapshots, the meaning is inverted, i.e. + * it contains *committed* transactions between xmin and xmax. + * + * note: all ids in xip[] satisfy xmin <= xip[i] < xmax + */ + TransactionId *xip; + uint32 xcnt; /* # of xact ids in xip[] */ + + /* + * For non-historic MVCC snapshots, this contains subxact IDs that are in + * progress (and other transactions that are in progress if taken during + * recovery). For historic snapshot it contains *all* xids assigned to the + * replayed transaction, including the toplevel xid. + * + * note: all ids in subxip[] are >= xmin, but we don't bother filtering + * out any that are >= xmax + */ + TransactionId *subxip; + int32 subxcnt; /* # of xact ids in subxip[] */ + bool suboverflowed; /* has the subxip array overflowed? */ + + bool takenDuringRecovery; /* recovery-shaped snapshot? */ + bool copied; /* false if it's a static snapshot */ + + CommandId curcid; /* in my xact, CID < curcid are visible */ + + /* + * An extra return value for HeapTupleSatisfiesDirty, not used in MVCC + * snapshots. + */ + uint32 speculativeToken; + + /* + * For SNAPSHOT_NON_VACUUMABLE (and hopefully more in the future) this is + * used to determine whether row could be vacuumed. + */ + struct GlobalVisState *vistest; + + /* + * Book-keeping information, used by the snapshot manager + */ + uint32 active_count; /* refcount on ActiveSnapshot stack */ + uint32 regd_count; /* refcount on RegisteredSnapshots */ + pairingheap_node ph_node; /* link in the RegisteredSnapshots heap */ + + /* + * The transaction completion count at the time GetSnapshotData() built + * this snapshot. Allows to avoid re-computing static snapshots when no + * transactions completed since the last GetSnapshotData(). + */ + uint64 snapXactCompletionCount; +} SnapshotData; + +#endif /* SNAPSHOT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/sortsupport.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/sortsupport.h new file mode 100644 index 0000000..b7abaf7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/sortsupport.h @@ -0,0 +1,391 @@ +/*------------------------------------------------------------------------- + * + * sortsupport.h + * Framework for accelerated sorting. + * + * Traditionally, PostgreSQL has implemented sorting by repeatedly invoking + * an SQL-callable comparison function "cmp(x, y) returns int" on pairs of + * values to be compared, where the comparison function is the BTORDER_PROC + * pg_amproc support function of the appropriate btree index opclass. + * + * This file defines alternative APIs that allow sorting to be performed with + * reduced overhead. To support lower-overhead sorting, a btree opclass may + * provide a BTSORTSUPPORT_PROC pg_amproc entry, which must take a single + * argument of type internal and return void. The argument is actually a + * pointer to a SortSupportData struct, which is defined below. + * + * If provided, the BTSORTSUPPORT function will be called during sort setup, + * and it must initialize the provided struct with pointers to function(s) + * that can be called to perform sorting. This API is defined to allow + * multiple acceleration mechanisms to be supported, but no opclass is + * required to provide all of them. The BTSORTSUPPORT function should + * simply not set any function pointers for mechanisms it doesn't support. + * Opclasses that provide BTSORTSUPPORT and don't provide a comparator + * function will have a shim set up by sort support automatically. However, + * opclasses that support the optional additional abbreviated key capability + * must always provide an authoritative comparator used to tie-break + * inconclusive abbreviated comparisons and also used when aborting + * abbreviation. Furthermore, a converter and abort/costing function must be + * provided. + * + * All sort support functions will be passed the address of the + * SortSupportData struct when called, so they can use it to store + * additional private data as needed. In particular, for collation-aware + * datatypes, the ssup_collation field is set before calling BTSORTSUPPORT + * and is available to all support functions. Additional opclass-dependent + * data can be stored using the ssup_extra field. Any such data + * should be allocated in the ssup_cxt memory context. + * + * Note: since pg_amproc functions are indexed by (lefttype, righttype) + * it is possible to associate a BTSORTSUPPORT function with a cross-type + * comparison. This could sensibly be used to provide a fast comparator + * function for such cases, but probably not any other acceleration method. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/sortsupport.h + * + *------------------------------------------------------------------------- + */ +#ifndef SORTSUPPORT_H +#define SORTSUPPORT_H + +#include "access/attnum.h" +#include "utils/relcache.h" + +typedef struct SortSupportData *SortSupport; + +typedef struct SortSupportData +{ + /* + * These fields are initialized before calling the BTSORTSUPPORT function + * and should not be changed later. + */ + MemoryContext ssup_cxt; /* Context containing sort info */ + Oid ssup_collation; /* Collation to use, or InvalidOid */ + + /* + * Additional sorting parameters; but unlike ssup_collation, these can be + * changed after BTSORTSUPPORT is called, so don't use them in selecting + * sort support functions. + */ + bool ssup_reverse; /* descending-order sort? */ + bool ssup_nulls_first; /* sort nulls first? */ + + /* + * These fields are workspace for callers, and should not be touched by + * opclass-specific functions. + */ + AttrNumber ssup_attno; /* column number to sort */ + + /* + * ssup_extra is zeroed before calling the BTSORTSUPPORT function, and is + * not touched subsequently by callers. + */ + void *ssup_extra; /* Workspace for opclass functions */ + + /* + * Function pointers are zeroed before calling the BTSORTSUPPORT function, + * and must be set by it for any acceleration methods it wants to supply. + * The comparator pointer must be set, others are optional. + */ + + /* + * Comparator function has the same API as the traditional btree + * comparison function, ie, return <0, 0, or >0 according as x is less + * than, equal to, or greater than y. Note that x and y are guaranteed + * not null, and there is no way to return null either. + * + * This may be either the authoritative comparator, or the abbreviated + * comparator. Core code may switch this over the initial preference of + * an opclass support function despite originally indicating abbreviation + * was applicable, by assigning the authoritative comparator back. + */ + int (*comparator) (Datum x, Datum y, SortSupport ssup); + + /* + * "Abbreviated key" infrastructure follows. + * + * All callbacks must be set by sortsupport opclasses that make use of + * this optional additional infrastructure (unless for whatever reasons + * the opclass doesn't proceed with abbreviation, in which case + * abbrev_converter must not be set). + * + * This allows opclass authors to supply a conversion routine, used to + * create an alternative representation of the underlying type (an + * "abbreviated key"). This representation must be pass-by-value and + * typically will use some ad-hoc format that only the opclass has + * knowledge of. An alternative comparator, used only with this + * alternative representation must also be provided (which is assigned to + * "comparator"). This representation is a simple approximation of the + * original Datum. It must be possible to compare datums of this + * representation with each other using the supplied alternative + * comparator, and have any non-zero return value be a reliable proxy for + * what a proper comparison would indicate. Returning zero from the + * alternative comparator does not indicate equality, as with a + * conventional support routine 1, though -- it indicates that it wasn't + * possible to determine how the two abbreviated values compared. A + * proper comparison, using "abbrev_full_comparator"/ + * ApplySortAbbrevFullComparator() is therefore required. In many cases + * this results in most or all comparisons only using the cheap + * alternative comparison func, which is typically implemented as code + * that compiles to just a few CPU instructions. CPU cache miss penalties + * are expensive; to get good overall performance, sort infrastructure + * must heavily weigh cache performance. + * + * Opclass authors must consider the final cardinality of abbreviated keys + * when devising an encoding scheme. It's possible for a strategy to work + * better than an alternative strategy with one usage pattern, while the + * reverse might be true for another usage pattern. All of these factors + * must be considered. + */ + + /* + * "abbreviate" concerns whether or not the abbreviated key optimization + * is applicable in principle (that is, the sortsupport routine needs to + * know if its dealing with a key where an abbreviated representation can + * usefully be packed together. Conventionally, this is the leading + * attribute key). Note, however, that in order to determine that + * abbreviation is not in play, the core code always checks whether or not + * the opclass has set abbrev_converter. This is a one way, one time + * message to the opclass. + */ + bool abbreviate; + + /* + * Converter to abbreviated format, from original representation. Core + * code uses this callback to convert from a pass-by-reference "original" + * Datum to a pass-by-value abbreviated key Datum. Note that original is + * guaranteed NOT NULL, because it doesn't make sense to factor NULLness + * into ad-hoc cost model. + * + * abbrev_converter is tested to see if abbreviation is in play. Core + * code may set it to NULL to indicate abbreviation should not be used + * (which is something sortsupport routines need not concern themselves + * with). However, sortsupport routines must not set it when it is + * immediately established that abbreviation should not proceed (e.g., for + * !abbreviate calls, or due to platform-specific impediments to using + * abbreviation). + */ + Datum (*abbrev_converter) (Datum original, SortSupport ssup); + + /* + * abbrev_abort callback allows clients to verify that the current + * strategy is working out, using a sortsupport routine defined ad-hoc + * cost model. If there is a lot of duplicate abbreviated keys in + * practice, it's useful to be able to abandon the strategy before paying + * too high a cost in conversion (perhaps certain opclass-specific + * adaptations are useful too). + */ + bool (*abbrev_abort) (int memtupcount, SortSupport ssup); + + /* + * Full, authoritative comparator for key that an abbreviated + * representation was generated for, used when an abbreviated comparison + * was inconclusive (by calling ApplySortAbbrevFullComparator()), or used + * to replace "comparator" when core system ultimately decides against + * abbreviation. + */ + int (*abbrev_full_comparator) (Datum x, Datum y, SortSupport ssup); +} SortSupportData; + + +/* + * Apply a sort comparator function and return a 3-way comparison result. + * This takes care of handling reverse-sort and NULLs-ordering properly. + */ +static inline int +ApplySortComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = ssup->comparator(datum1, datum2, ssup); + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} + +static inline int +ApplyUnsignedSortComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = datum1 < datum2 ? -1 : datum1 > datum2 ? 1 : 0; + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} + +#if SIZEOF_DATUM >= 8 +static inline int +ApplySignedSortComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = DatumGetInt64(datum1) < DatumGetInt64(datum2) ? -1 : + DatumGetInt64(datum1) > DatumGetInt64(datum2) ? 1 : 0; + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} +#endif + +static inline int +ApplyInt32SortComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = DatumGetInt32(datum1) < DatumGetInt32(datum2) ? -1 : + DatumGetInt32(datum1) > DatumGetInt32(datum2) ? 1 : 0; + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} + +/* + * Apply a sort comparator function and return a 3-way comparison using full, + * authoritative comparator. This takes care of handling reverse-sort and + * NULLs-ordering properly. + */ +static inline int +ApplySortAbbrevFullComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = ssup->abbrev_full_comparator(datum1, datum2, ssup); + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} + +/* + * Datum comparison functions that we have specialized sort routines for. + * Datatypes that install these as their comparator or abbreviated comparator + * are eligible for faster sorting. + */ +extern int ssup_datum_unsigned_cmp(Datum x, Datum y, SortSupport ssup); +#if SIZEOF_DATUM >= 8 +extern int ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup); +#endif +extern int ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup); + +/* Other functions in utils/sort/sortsupport.c */ +extern void PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup); +extern void PrepareSortSupportFromOrderingOp(Oid orderingOp, SortSupport ssup); +extern void PrepareSortSupportFromIndexRel(Relation indexRel, bool reverse, + SortSupport ssup); +extern void PrepareSortSupportFromGistIndexRel(Relation indexRel, SortSupport ssup); + +#endif /* SORTSUPPORT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/spccache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/spccache.h new file mode 100644 index 0000000..d7edd79 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/spccache.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * spccache.h + * Tablespace cache. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/spccache.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPCCACHE_H +#define SPCCACHE_H + +extern void get_tablespace_page_costs(Oid spcid, float8 *spc_random_page_cost, + float8 *spc_seq_page_cost); +extern int get_tablespace_io_concurrency(Oid spcid); +extern int get_tablespace_maintenance_io_concurrency(Oid spcid); + +#endif /* SPCCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/syscache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/syscache.h new file mode 100644 index 0000000..3039713 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/syscache.h @@ -0,0 +1,136 @@ +/*------------------------------------------------------------------------- + * + * syscache.h + * System catalog cache definitions. + * + * See also lsyscache.h, which provides convenience routines for + * common cache-lookup operations. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/syscache.h + * + *------------------------------------------------------------------------- + */ +#ifndef SYSCACHE_H +#define SYSCACHE_H + +#include "access/attnum.h" +#include "access/htup.h" +/* we intentionally do not include utils/catcache.h here */ + +#include "catalog/syscache_ids.h" /* IWYU pragma: export */ + +extern void InitCatalogCache(void); +extern void InitCatalogCachePhase2(void); + +extern HeapTuple SearchSysCache(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); + +/* + * The use of argument specific numbers is encouraged. They're faster, and + * insulates the caller from changes in the maximum number of keys. + */ +extern HeapTuple SearchSysCache1(int cacheId, + Datum key1); +extern HeapTuple SearchSysCache2(int cacheId, + Datum key1, Datum key2); +extern HeapTuple SearchSysCache3(int cacheId, + Datum key1, Datum key2, Datum key3); +extern HeapTuple SearchSysCache4(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); + +extern void ReleaseSysCache(HeapTuple tuple); + +extern HeapTuple SearchSysCacheLocked1(int cacheId, + Datum key1); + +/* convenience routines */ +extern HeapTuple SearchSysCacheCopy(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); +extern HeapTuple SearchSysCacheLockedCopy1(int cacheId, + Datum key1); +extern bool SearchSysCacheExists(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); +extern Oid GetSysCacheOid(int cacheId, AttrNumber oidcol, + Datum key1, Datum key2, Datum key3, Datum key4); + +extern HeapTuple SearchSysCacheAttName(Oid relid, const char *attname); +extern HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname); +extern bool SearchSysCacheExistsAttName(Oid relid, const char *attname); + +extern HeapTuple SearchSysCacheAttNum(Oid relid, int16 attnum); +extern HeapTuple SearchSysCacheCopyAttNum(Oid relid, int16 attnum); + +extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup, + AttrNumber attributeNumber, bool *isNull); + +extern Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, + AttrNumber attributeNumber); + +extern uint32 GetSysCacheHashValue(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); + +/* list-search interface. Users of this must import catcache.h too */ +struct catclist; +extern struct catclist *SearchSysCacheList(int cacheId, int nkeys, + Datum key1, Datum key2, Datum key3); + +extern void SysCacheInvalidate(int cacheId, uint32 hashValue); + +extern bool RelationInvalidatesSnapshotsOnly(Oid relid); +extern bool RelationHasSysCache(Oid relid); +extern bool RelationSupportsSysCache(Oid relid); + +/* + * The use of the macros below rather than direct calls to the corresponding + * functions is encouraged, as it insulates the caller from changes in the + * maximum number of keys. + */ +#define SearchSysCacheCopy1(cacheId, key1) \ + SearchSysCacheCopy(cacheId, key1, 0, 0, 0) +#define SearchSysCacheCopy2(cacheId, key1, key2) \ + SearchSysCacheCopy(cacheId, key1, key2, 0, 0) +#define SearchSysCacheCopy3(cacheId, key1, key2, key3) \ + SearchSysCacheCopy(cacheId, key1, key2, key3, 0) +#define SearchSysCacheCopy4(cacheId, key1, key2, key3, key4) \ + SearchSysCacheCopy(cacheId, key1, key2, key3, key4) + +#define SearchSysCacheExists1(cacheId, key1) \ + SearchSysCacheExists(cacheId, key1, 0, 0, 0) +#define SearchSysCacheExists2(cacheId, key1, key2) \ + SearchSysCacheExists(cacheId, key1, key2, 0, 0) +#define SearchSysCacheExists3(cacheId, key1, key2, key3) \ + SearchSysCacheExists(cacheId, key1, key2, key3, 0) +#define SearchSysCacheExists4(cacheId, key1, key2, key3, key4) \ + SearchSysCacheExists(cacheId, key1, key2, key3, key4) + +#define GetSysCacheOid1(cacheId, oidcol, key1) \ + GetSysCacheOid(cacheId, oidcol, key1, 0, 0, 0) +#define GetSysCacheOid2(cacheId, oidcol, key1, key2) \ + GetSysCacheOid(cacheId, oidcol, key1, key2, 0, 0) +#define GetSysCacheOid3(cacheId, oidcol, key1, key2, key3) \ + GetSysCacheOid(cacheId, oidcol, key1, key2, key3, 0) +#define GetSysCacheOid4(cacheId, oidcol, key1, key2, key3, key4) \ + GetSysCacheOid(cacheId, oidcol, key1, key2, key3, key4) + +#define GetSysCacheHashValue1(cacheId, key1) \ + GetSysCacheHashValue(cacheId, key1, 0, 0, 0) +#define GetSysCacheHashValue2(cacheId, key1, key2) \ + GetSysCacheHashValue(cacheId, key1, key2, 0, 0) +#define GetSysCacheHashValue3(cacheId, key1, key2, key3) \ + GetSysCacheHashValue(cacheId, key1, key2, key3, 0) +#define GetSysCacheHashValue4(cacheId, key1, key2, key3, key4) \ + GetSysCacheHashValue(cacheId, key1, key2, key3, key4) + +#define SearchSysCacheList1(cacheId, key1) \ + SearchSysCacheList(cacheId, 1, key1, 0, 0) +#define SearchSysCacheList2(cacheId, key1, key2) \ + SearchSysCacheList(cacheId, 2, key1, key2, 0) +#define SearchSysCacheList3(cacheId, key1, key2, key3) \ + SearchSysCacheList(cacheId, 3, key1, key2, key3) + +#define ReleaseSysCacheList(x) ReleaseCatCacheList(x) + +#endif /* SYSCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/timeout.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/timeout.h new file mode 100644 index 0000000..7b19bea --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/timeout.h @@ -0,0 +1,96 @@ +/*------------------------------------------------------------------------- + * + * timeout.h + * Routines to multiplex SIGALRM interrupts for multiple timeout reasons. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/timeout.h + * + *------------------------------------------------------------------------- + */ +#ifndef TIMEOUT_H +#define TIMEOUT_H + +#include "datatype/timestamp.h" + +/* + * Identifiers for timeout reasons. Note that in case multiple timeouts + * trigger at the same time, they are serviced in the order of this enum. + */ +typedef enum TimeoutId +{ + /* Predefined timeout reasons */ + STARTUP_PACKET_TIMEOUT, + DEADLOCK_TIMEOUT, + LOCK_TIMEOUT, + STATEMENT_TIMEOUT, + STANDBY_DEADLOCK_TIMEOUT, + STANDBY_TIMEOUT, + STANDBY_LOCK_TIMEOUT, + IDLE_IN_TRANSACTION_SESSION_TIMEOUT, + TRANSACTION_TIMEOUT, + IDLE_SESSION_TIMEOUT, + IDLE_STATS_UPDATE_TIMEOUT, + CLIENT_CONNECTION_CHECK_TIMEOUT, + STARTUP_PROGRESS_TIMEOUT, + /* First user-definable timeout reason */ + USER_TIMEOUT, + /* Maximum number of timeout reasons */ + MAX_TIMEOUTS = USER_TIMEOUT + 10 +} TimeoutId; + +/* callback function signature */ +typedef void (*timeout_handler_proc) (void); + +/* + * Parameter structure for setting multiple timeouts at once + */ +typedef enum TimeoutType +{ + TMPARAM_AFTER, + TMPARAM_AT, + TMPARAM_EVERY, +} TimeoutType; + +typedef struct +{ + TimeoutId id; /* timeout to set */ + TimeoutType type; /* TMPARAM_AFTER or TMPARAM_AT */ + int delay_ms; /* only used for TMPARAM_AFTER/EVERY */ + TimestampTz fin_time; /* only used for TMPARAM_AT */ +} EnableTimeoutParams; + +/* + * Parameter structure for clearing multiple timeouts at once + */ +typedef struct +{ + TimeoutId id; /* timeout to clear */ + bool keep_indicator; /* keep the indicator flag? */ +} DisableTimeoutParams; + +/* timeout setup */ +extern void InitializeTimeouts(void); +extern TimeoutId RegisterTimeout(TimeoutId id, timeout_handler_proc handler); +extern void reschedule_timeouts(void); + +/* timeout operation */ +extern void enable_timeout_after(TimeoutId id, int delay_ms); +extern void enable_timeout_every(TimeoutId id, TimestampTz fin_time, + int delay_ms); +extern void enable_timeout_at(TimeoutId id, TimestampTz fin_time); +extern void enable_timeouts(const EnableTimeoutParams *timeouts, int count); +extern void disable_timeout(TimeoutId id, bool keep_indicator); +extern void disable_timeouts(const DisableTimeoutParams *timeouts, int count); +extern void disable_all_timeouts(bool keep_indicators); + +/* accessors */ +extern bool get_timeout_active(TimeoutId id); +extern bool get_timeout_indicator(TimeoutId id, bool reset_indicator); +extern TimestampTz get_timeout_start_time(TimeoutId id); +extern TimestampTz get_timeout_finish_time(TimeoutId id); + +#endif /* TIMEOUT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/timestamp.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/timestamp.h new file mode 100644 index 0000000..8c20585 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/timestamp.h @@ -0,0 +1,159 @@ +/*------------------------------------------------------------------------- + * + * timestamp.h + * Definitions for the SQL "timestamp" and "interval" types. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/timestamp.h + * + *------------------------------------------------------------------------- + */ +#ifndef TIMESTAMP_H +#define TIMESTAMP_H + +#include "datatype/timestamp.h" +#include "fmgr.h" +#include "pgtime.h" + + +/* + * Functions for fmgr-callable functions. + * + * For Timestamp, we make use of the same support routines as for int64. + * Therefore Timestamp is pass-by-reference if and only if int64 is! + */ +static inline Timestamp +DatumGetTimestamp(Datum X) +{ + return (Timestamp) DatumGetInt64(X); +} + +static inline TimestampTz +DatumGetTimestampTz(Datum X) +{ + return (TimestampTz) DatumGetInt64(X); +} + +static inline Interval * +DatumGetIntervalP(Datum X) +{ + return (Interval *) DatumGetPointer(X); +} + +static inline Datum +TimestampGetDatum(Timestamp X) +{ + return Int64GetDatum(X); +} + +static inline Datum +TimestampTzGetDatum(TimestampTz X) +{ + return Int64GetDatum(X); +} + +static inline Datum +IntervalPGetDatum(const Interval *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_TIMESTAMP(n) DatumGetTimestamp(PG_GETARG_DATUM(n)) +#define PG_GETARG_TIMESTAMPTZ(n) DatumGetTimestampTz(PG_GETARG_DATUM(n)) +#define PG_GETARG_INTERVAL_P(n) DatumGetIntervalP(PG_GETARG_DATUM(n)) + +#define PG_RETURN_TIMESTAMP(x) return TimestampGetDatum(x) +#define PG_RETURN_TIMESTAMPTZ(x) return TimestampTzGetDatum(x) +#define PG_RETURN_INTERVAL_P(x) return IntervalPGetDatum(x) + + +#define TIMESTAMP_MASK(b) (1 << (b)) +#define INTERVAL_MASK(b) (1 << (b)) + +/* Macros to handle packing and unpacking the typmod field for intervals */ +#define INTERVAL_FULL_RANGE (0x7FFF) +#define INTERVAL_RANGE_MASK (0x7FFF) +#define INTERVAL_FULL_PRECISION (0xFFFF) +#define INTERVAL_PRECISION_MASK (0xFFFF) +#define INTERVAL_TYPMOD(p,r) ((((r) & INTERVAL_RANGE_MASK) << 16) | ((p) & INTERVAL_PRECISION_MASK)) +#define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK) +#define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK) + +/* Macros for doing timestamp arithmetic without assuming timestamp's units */ +#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * (int64) 1000)) +#define TimestampTzPlusSeconds(tz,s) ((tz) + ((s) * (int64) 1000000)) + +/* Helper for simple subtraction between two timestamps */ +static inline uint64 +TimestampDifferenceMicroseconds(TimestampTz start_time, + TimestampTz stop_time) +{ + if (start_time >= stop_time) + return 0; + return (uint64) stop_time - start_time; +} + +/* Set at postmaster start */ +extern PGDLLIMPORT TimestampTz PgStartTime; + +/* Set at configuration reload */ +extern PGDLLIMPORT TimestampTz PgReloadTime; + + +/* Internal routines (not fmgr-callable) */ + +extern int32 anytimestamp_typmod_check(bool istz, int32 typmod); + +extern TimestampTz GetCurrentTimestamp(void); +extern TimestampTz GetSQLCurrentTimestamp(int32 typmod); +extern Timestamp GetSQLLocalTimestamp(int32 typmod); +extern void TimestampDifference(TimestampTz start_time, TimestampTz stop_time, + long *secs, int *microsecs); +extern long TimestampDifferenceMilliseconds(TimestampTz start_time, + TimestampTz stop_time); +extern bool TimestampDifferenceExceeds(TimestampTz start_time, + TimestampTz stop_time, + int msec); +extern bool TimestampDifferenceExceedsSeconds(TimestampTz start_time, + TimestampTz stop_time, + int threshold_sec); + +extern TimestampTz time_t_to_timestamptz(pg_time_t tm); +extern pg_time_t timestamptz_to_time_t(TimestampTz t); + +extern const char *timestamptz_to_str(TimestampTz t); + +extern int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result); +extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, + fsec_t *fsec, const char **tzn, pg_tz *attimezone); +extern void dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec); + +extern void interval2itm(Interval span, struct pg_itm *itm); +extern int itm2interval(struct pg_itm *itm, Interval *span); +extern int itmin2interval(struct pg_itm_in *itm_in, Interval *span); + +extern Timestamp SetEpochTimestamp(void); +extern void GetEpochTime(struct pg_tm *tm); + +extern int timestamp_cmp_internal(Timestamp dt1, Timestamp dt2); + +/* timestamp comparison works for timestamptz also */ +#define timestamptz_cmp_internal(dt1,dt2) timestamp_cmp_internal(dt1, dt2) + +extern TimestampTz timestamp2timestamptz_opt_overflow(Timestamp timestamp, + int *overflow); +extern int32 timestamp_cmp_timestamptz_internal(Timestamp timestampVal, + TimestampTz dt2); + +extern int isoweek2j(int year, int week); +extern void isoweek2date(int woy, int *year, int *mon, int *mday); +extern void isoweekdate2date(int isoweek, int wday, int *year, int *mon, int *mday); +extern int date2isoweek(int year, int mon, int mday); +extern int date2isoyear(int year, int mon, int mday); +extern int date2isoyearday(int year, int mon, int mday); + +extern bool TimestampTimestampTzRequiresRewrite(void); + +#endif /* TIMESTAMP_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/tuplesort.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/tuplesort.h new file mode 100644 index 0000000..ef79f25 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/tuplesort.h @@ -0,0 +1,480 @@ +/*------------------------------------------------------------------------- + * + * tuplesort.h + * Generalized tuple sorting routines. + * + * This module handles sorting of heap tuples, index tuples, or single + * Datums (and could easily support other kinds of sortable objects, + * if necessary). It works efficiently for both small and large amounts + * of data. Small amounts are sorted in-memory using qsort(). Large + * amounts are sorted using temporary files and a standard external sort + * algorithm. Parallel sorts use a variant of this external sort + * algorithm, and are typically only used for large amounts of data. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/tuplesort.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPLESORT_H +#define TUPLESORT_H + +#include "access/brin_tuple.h" +#include "access/gin_tuple.h" +#include "access/itup.h" +#include "executor/tuptable.h" +#include "storage/dsm.h" +#include "utils/logtape.h" +#include "utils/relcache.h" +#include "utils/sortsupport.h" + + +/* + * Tuplesortstate and Sharedsort are opaque types whose details are not + * known outside tuplesort.c. + */ +typedef struct Tuplesortstate Tuplesortstate; +typedef struct Sharedsort Sharedsort; + +/* + * Tuplesort parallel coordination state, allocated by each participant in + * local memory. Participant caller initializes everything. See usage notes + * below. + */ +typedef struct SortCoordinateData +{ + /* Worker process? If not, must be leader. */ + bool isWorker; + + /* + * Leader-process-passed number of participants known launched (workers + * set this to -1). Includes state within leader needed for it to + * participate as a worker, if any. + */ + int nParticipants; + + /* Private opaque state (points to shared memory) */ + Sharedsort *sharedsort; +} SortCoordinateData; + +typedef struct SortCoordinateData *SortCoordinate; + +/* + * Data structures for reporting sort statistics. Note that + * TuplesortInstrumentation can't contain any pointers because we + * sometimes put it in shared memory. + * + * The parallel-sort infrastructure relies on having a zero TuplesortMethod + * to indicate that a worker never did anything, so we assign zero to + * SORT_TYPE_STILL_IN_PROGRESS. The other values of this enum can be + * OR'ed together to represent a situation where different workers used + * different methods, so we need a separate bit for each one. Keep the + * NUM_TUPLESORTMETHODS constant in sync with the number of bits! + */ +typedef enum +{ + SORT_TYPE_STILL_IN_PROGRESS = 0, + SORT_TYPE_TOP_N_HEAPSORT = 1 << 0, + SORT_TYPE_QUICKSORT = 1 << 1, + SORT_TYPE_EXTERNAL_SORT = 1 << 2, + SORT_TYPE_EXTERNAL_MERGE = 1 << 3, +} TuplesortMethod; + +#define NUM_TUPLESORTMETHODS 4 + +typedef enum +{ + SORT_SPACE_TYPE_DISK, + SORT_SPACE_TYPE_MEMORY, +} TuplesortSpaceType; + +/* Bitwise option flags for tuple sorts */ +#define TUPLESORT_NONE 0 + +/* specifies whether non-sequential access to the sort result is required */ +#define TUPLESORT_RANDOMACCESS (1 << 0) + +/* specifies if the tuplesort is able to support bounded sorts */ +#define TUPLESORT_ALLOWBOUNDED (1 << 1) + +/* + * For bounded sort, tuples get pfree'd when they fall outside of the bound. + * When bounded sorts are not required, we can use a bump context for tuple + * allocation as there's no risk that pfree will ever be called for a tuple. + * Define a macro to make it easier for code to figure out if we're using a + * bump allocator. + */ +#define TupleSortUseBumpTupleCxt(opt) (((opt) & TUPLESORT_ALLOWBOUNDED) == 0) + +typedef struct TuplesortInstrumentation +{ + TuplesortMethod sortMethod; /* sort algorithm used */ + TuplesortSpaceType spaceType; /* type of space spaceUsed represents */ + int64 spaceUsed; /* space consumption, in kB */ +} TuplesortInstrumentation; + +/* + * The objects we actually sort are SortTuple structs. These contain + * a pointer to the tuple proper (might be a MinimalTuple or IndexTuple), + * which is a separate palloc chunk --- we assume it is just one chunk and + * can be freed by a simple pfree() (except during merge, where we use a + * simple slab allocator, and during a non-bounded sort where we use a bump + * allocator). SortTuples also contain the tuple's first key column in + * Datum/nullflag format, and a source/input tape number that tracks which + * tape each heap element/slot belongs to during merging. + * + * Storing the first key column lets us save heap_getattr or index_getattr + * calls during tuple comparisons. We could extract and save all the key + * columns not just the first, but this would increase code complexity and + * overhead, and wouldn't actually save any comparison cycles in the common + * case where the first key determines the comparison result. Note that + * for a pass-by-reference datatype, datum1 points into the "tuple" storage. + * + * There is one special case: when the sort support infrastructure provides an + * "abbreviated key" representation, where the key is (typically) a pass by + * value proxy for a pass by reference type. In this case, the abbreviated key + * is stored in datum1 in place of the actual first key column. + * + * When sorting single Datums, the data value is represented directly by + * datum1/isnull1 for pass by value types (or null values). If the datatype is + * pass-by-reference and isnull1 is false, then "tuple" points to a separately + * palloc'd data value, otherwise "tuple" is NULL. The value of datum1 is then + * either the same pointer as "tuple", or is an abbreviated key value as + * described above. Accordingly, "tuple" is always used in preference to + * datum1 as the authoritative value for pass-by-reference cases. + */ +typedef struct +{ + void *tuple; /* the tuple itself */ + Datum datum1; /* value of first key column */ + bool isnull1; /* is first key column NULL? */ + int srctape; /* source tape number */ +} SortTuple; + +typedef int (*SortTupleComparator) (const SortTuple *a, const SortTuple *b, + Tuplesortstate *state); + +/* + * The public part of a Tuple sort operation state. This data structure + * contains the definition of sort-variant-specific interface methods and + * the part of Tuple sort operation state required by their implementations. + */ +typedef struct +{ + /* + * These function pointers decouple the routines that must know what kind + * of tuple we are sorting from the routines that don't need to know it. + * They are set up by the tuplesort_begin_xxx routines. + * + * Function to compare two tuples; result is per qsort() convention, ie: + * <0, 0, >0 according as ab. The API must match + * qsort_arg_comparator. + */ + SortTupleComparator comparetup; + + /* + * Fall back to the full tuple for comparison, but only compare the first + * sortkey if it was abbreviated. Otherwise, only compare second and later + * sortkeys. + */ + SortTupleComparator comparetup_tiebreak; + + /* + * Alter datum1 representation in the SortTuple's array back from the + * abbreviated key to the first column value. + */ + void (*removeabbrev) (Tuplesortstate *state, SortTuple *stups, + int count); + + /* + * Function to write a stored tuple onto tape. The representation of the + * tuple on tape need not be the same as it is in memory. + */ + void (*writetup) (Tuplesortstate *state, LogicalTape *tape, + SortTuple *stup); + + /* + * Function to read a stored tuple from tape back into memory. 'len' is + * the already-read length of the stored tuple. The tuple is allocated + * from the slab memory arena, or is palloc'd, see + * tuplesort_readtup_alloc(). + */ + void (*readtup) (Tuplesortstate *state, SortTuple *stup, + LogicalTape *tape, unsigned int len); + + /* + * Function to do some specific release of resources for the sort variant. + * In particular, this function should free everything stored in the "arg" + * field, which wouldn't be cleared on reset of the Tuple sort memory + * contexts. This can be NULL if nothing specific needs to be done. + */ + void (*freestate) (Tuplesortstate *state); + + /* + * The subsequent fields are used in the implementations of the functions + * above. + */ + MemoryContext maincontext; /* memory context for tuple sort metadata that + * persists across multiple batches */ + MemoryContext sortcontext; /* memory context holding most sort data */ + MemoryContext tuplecontext; /* sub-context of sortcontext for tuple data */ + + /* + * Whether SortTuple's datum1 and isnull1 members are maintained by the + * above routines. If not, some sort specializations are disabled. + */ + bool haveDatum1; + + /* + * The sortKeys variable is used by every case other than the hash index + * case; it is set by tuplesort_begin_xxx. tupDesc is only used by the + * MinimalTuple and CLUSTER routines, though. + */ + int nKeys; /* number of columns in sort key */ + SortSupport sortKeys; /* array of length nKeys */ + + /* + * This variable is shared by the single-key MinimalTuple case and the + * Datum case (which both use qsort_ssup()). Otherwise, it's NULL. The + * presence of a value in this field is also checked by various sort + * specialization functions as an optimization when comparing the leading + * key in a tiebreak situation to determine if there are any subsequent + * keys to sort on. + */ + SortSupport onlyKey; + + int sortopt; /* Bitmask of flags used to setup sort */ + + bool tuples; /* Can SortTuple.tuple ever be set? */ + + void *arg; /* Specific information for the sort variant */ +} TuplesortPublic; + +/* Sort parallel code from state for sort__start probes */ +#define PARALLEL_SORT(coordinate) (coordinate == NULL || \ + (coordinate)->sharedsort == NULL ? 0 : \ + (coordinate)->isWorker ? 1 : 2) + +#define TuplesortstateGetPublic(state) ((TuplesortPublic *) state) + +/* When using this macro, beware of double evaluation of len */ +#define LogicalTapeReadExact(tape, ptr, len) \ + do { \ + if (LogicalTapeRead(tape, ptr, len) != (size_t) (len)) \ + elog(ERROR, "unexpected end of data"); \ + } while(0) + +/* + * We provide multiple interfaces to what is essentially the same code, + * since different callers have different data to be sorted and want to + * specify the sort key information differently. There are two APIs for + * sorting HeapTuples and two more for sorting IndexTuples. Yet another + * API supports sorting bare Datums. + * + * Serial sort callers should pass NULL for their coordinate argument. + * + * The "heap" API actually stores/sorts MinimalTuples, which means it doesn't + * preserve the system columns (tuple identity and transaction visibility + * info). The sort keys are specified by column numbers within the tuples + * and sort operator OIDs. We save some cycles by passing and returning the + * tuples in TupleTableSlots, rather than forming actual HeapTuples (which'd + * have to be converted to MinimalTuples). This API works well for sorts + * executed as parts of plan trees. + * + * The "cluster" API stores/sorts full HeapTuples including all visibility + * info. The sort keys are specified by reference to a btree index that is + * defined on the relation to be sorted. Note that putheaptuple/getheaptuple + * go with this API, not the "begin_heap" one! + * + * The "index_btree" API stores/sorts IndexTuples (preserving all their + * header fields). The sort keys are specified by a btree index definition. + * + * The "index_hash" API is similar to index_btree, but the tuples are + * actually sorted by their hash codes not the raw data. + * + * The "index_brin" API is similar to index_btree, but the tuples are + * BrinTuple and are sorted by their block number not the raw data. + * + * Parallel sort callers are required to coordinate multiple tuplesort states + * in a leader process and one or more worker processes. The leader process + * must launch workers, and have each perform an independent "partial" + * tuplesort, typically fed by the parallel heap interface. The leader later + * produces the final output (internally, it merges runs output by workers). + * + * Callers must do the following to perform a sort in parallel using multiple + * worker processes: + * + * 1. Request tuplesort-private shared memory for n workers. Use + * tuplesort_estimate_shared() to get the required size. + * 2. Have leader process initialize allocated shared memory using + * tuplesort_initialize_shared(). Launch workers. + * 3. Initialize a coordinate argument within both the leader process, and + * for each worker process. This has a pointer to the shared + * tuplesort-private structure, as well as some caller-initialized fields. + * Leader's coordinate argument reliably indicates number of workers + * launched (this is unused by workers). + * 4. Begin a tuplesort using some appropriate tuplesort_begin* routine, + * (passing the coordinate argument) within each worker. The workMem + * arguments need not be identical. All other arguments should match + * exactly, though. + * 5. tuplesort_attach_shared() should be called by all workers. Feed tuples + * to each worker, and call tuplesort_performsort() within each when input + * is exhausted. + * 6. Call tuplesort_end() in each worker process. Worker processes can shut + * down once tuplesort_end() returns. + * 7. Begin a tuplesort in the leader using the same tuplesort_begin* + * routine, passing a leader-appropriate coordinate argument (this can + * happen as early as during step 3, actually, since we only need to know + * the number of workers successfully launched). The leader must now wait + * for workers to finish. Caller must use own mechanism for ensuring that + * next step isn't reached until all workers have called and returned from + * tuplesort_performsort(). (Note that it's okay if workers have already + * also called tuplesort_end() by then.) + * 8. Call tuplesort_performsort() in leader. Consume output using the + * appropriate tuplesort_get* routine. Leader can skip this step if + * tuplesort turns out to be unnecessary. + * 9. Call tuplesort_end() in leader. + * + * This division of labor assumes nothing about how input tuples are produced, + * but does require that caller combine the state of multiple tuplesorts for + * any purpose other than producing the final output. For example, callers + * must consider that tuplesort_get_stats() reports on only one worker's role + * in a sort (or the leader's role), and not statistics for the sort as a + * whole. + * + * Note that callers may use the leader process to sort runs as if it was an + * independent worker process (prior to the process performing a leader sort + * to produce the final sorted output). Doing so only requires a second + * "partial" tuplesort within the leader process, initialized like that of a + * worker process. The steps above don't touch on this directly. The only + * difference is that the tuplesort_attach_shared() call is never needed within + * leader process, because the backend as a whole holds the shared fileset + * reference. A worker Tuplesortstate in leader is expected to do exactly the + * same amount of total initial processing work as a worker process + * Tuplesortstate, since the leader process has nothing else to do before + * workers finish. + * + * Note that only a very small amount of memory will be allocated prior to + * the leader state first consuming input, and that workers will free the + * vast majority of their memory upon returning from tuplesort_performsort(). + * Callers can rely on this to arrange for memory to be used in a way that + * respects a workMem-style budget across an entire parallel sort operation. + * + * Callers are responsible for parallel safety in general. However, they + * can at least rely on there being no parallel safety hazards within + * tuplesort, because tuplesort thinks of the sort as several independent + * sorts whose results are combined. Since, in general, the behavior of + * sort operators is immutable, caller need only worry about the parallel + * safety of whatever the process is through which input tuples are + * generated (typically, caller uses a parallel heap scan). + */ + + +extern Tuplesortstate *tuplesort_begin_common(int workMem, + SortCoordinate coordinate, + int sortopt); +extern void tuplesort_set_bound(Tuplesortstate *state, int64 bound); +extern bool tuplesort_used_bound(Tuplesortstate *state); +extern void tuplesort_puttuple_common(Tuplesortstate *state, + SortTuple *tuple, bool useAbbrev, + Size tuplen); +extern void tuplesort_performsort(Tuplesortstate *state); +extern bool tuplesort_gettuple_common(Tuplesortstate *state, bool forward, + SortTuple *stup); +extern bool tuplesort_skiptuples(Tuplesortstate *state, int64 ntuples, + bool forward); +extern void tuplesort_end(Tuplesortstate *state); +extern void tuplesort_reset(Tuplesortstate *state); + +extern void tuplesort_get_stats(Tuplesortstate *state, + TuplesortInstrumentation *stats); +extern const char *tuplesort_method_name(TuplesortMethod m); +extern const char *tuplesort_space_type_name(TuplesortSpaceType t); + +extern int tuplesort_merge_order(int64 allowedMem); + +extern Size tuplesort_estimate_shared(int nWorkers); +extern void tuplesort_initialize_shared(Sharedsort *shared, int nWorkers, + dsm_segment *seg); +extern void tuplesort_attach_shared(Sharedsort *shared, dsm_segment *seg); + +/* + * These routines may only be called if TUPLESORT_RANDOMACCESS was specified + * during tuplesort_begin_*. Additionally backwards scan in gettuple/getdatum + * also require TUPLESORT_RANDOMACCESS. Note that parallel sorts do not + * support random access. + */ +extern void tuplesort_rescan(Tuplesortstate *state); +extern void tuplesort_markpos(Tuplesortstate *state); +extern void tuplesort_restorepos(Tuplesortstate *state); + +extern void *tuplesort_readtup_alloc(Tuplesortstate *state, Size tuplen); + + +/* tuplesortvariants.c */ + +extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc, + int nkeys, AttrNumber *attNums, + Oid *sortOperators, Oid *sortCollations, + bool *nullsFirstFlags, + int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_cluster(TupleDesc tupDesc, + Relation indexRel, int workMem, + SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_index_btree(Relation heapRel, + Relation indexRel, + bool enforceUnique, + bool uniqueNullsNotDistinct, + int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_index_hash(Relation heapRel, + Relation indexRel, + uint32 high_mask, + uint32 low_mask, + uint32 max_buckets, + int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_index_gist(Relation heapRel, + Relation indexRel, + int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_index_brin(int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_index_gin(Relation heapRel, + Relation indexRel, + int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_datum(Oid datumType, + Oid sortOperator, Oid sortCollation, + bool nullsFirstFlag, + int workMem, SortCoordinate coordinate, + int sortopt); + +extern void tuplesort_puttupleslot(Tuplesortstate *state, + TupleTableSlot *slot); +extern void tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup); +extern void tuplesort_putindextuplevalues(Tuplesortstate *state, + Relation rel, ItemPointer self, + const Datum *values, const bool *isnull); +extern void tuplesort_putbrintuple(Tuplesortstate *state, BrinTuple *tuple, Size size); +extern void tuplesort_putgintuple(Tuplesortstate *state, GinTuple *tuple, Size size); +extern void tuplesort_putdatum(Tuplesortstate *state, Datum val, + bool isNull); + +extern bool tuplesort_gettupleslot(Tuplesortstate *state, bool forward, + bool copy, TupleTableSlot *slot, Datum *abbrev); +extern HeapTuple tuplesort_getheaptuple(Tuplesortstate *state, bool forward); +extern IndexTuple tuplesort_getindextuple(Tuplesortstate *state, bool forward); +extern BrinTuple *tuplesort_getbrintuple(Tuplesortstate *state, Size *len, + bool forward); +extern GinTuple *tuplesort_getgintuple(Tuplesortstate *state, Size *len, + bool forward); +extern bool tuplesort_getdatum(Tuplesortstate *state, bool forward, bool copy, + Datum *val, bool *isNull, Datum *abbrev); + + +#endif /* TUPLESORT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/tuplestore.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/tuplestore.h new file mode 100644 index 0000000..865ba7b --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/tuplestore.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------------------- + * + * tuplestore.h + * Generalized routines for temporary tuple storage. + * + * This module handles temporary storage of tuples for purposes such + * as Materialize nodes, hashjoin batch files, etc. It is essentially + * a dumbed-down version of tuplesort.c; it does no sorting of tuples + * but can only store and regurgitate a sequence of tuples. However, + * because no sort is required, it is allowed to start reading the sequence + * before it has all been written. This is particularly useful for cursors, + * because it allows random access within the already-scanned portion of + * a query without having to process the underlying scan to completion. + * Also, it is possible to support multiple independent read pointers. + * + * A temporary file is used to handle the data if it exceeds the + * space limit specified by the caller. + * + * Beginning in Postgres 8.2, what is stored is just MinimalTuples; + * callers cannot expect valid system columns in regurgitated tuples. + * Also, we have changed the API to return tuples in TupleTableSlots, + * so that there is a check to prevent attempted access to system columns. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/tuplestore.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPLESTORE_H +#define TUPLESTORE_H + +#include "executor/tuptable.h" + + +/* Tuplestorestate is an opaque type whose details are not known outside + * tuplestore.c. + */ +typedef struct Tuplestorestate Tuplestorestate; + +/* + * Currently we only need to store MinimalTuples, but it would be easy + * to support the same behavior for IndexTuples and/or bare Datums. + */ + +extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess, + bool interXact, + int maxKBytes); + +extern void tuplestore_set_eflags(Tuplestorestate *state, int eflags); + +extern void tuplestore_puttupleslot(Tuplestorestate *state, + TupleTableSlot *slot); +extern void tuplestore_puttuple(Tuplestorestate *state, HeapTuple tuple); +extern void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, + const Datum *values, const bool *isnull); + +extern int tuplestore_alloc_read_pointer(Tuplestorestate *state, int eflags); + +extern void tuplestore_select_read_pointer(Tuplestorestate *state, int ptr); + +extern void tuplestore_copy_read_pointer(Tuplestorestate *state, + int srcptr, int destptr); + +extern void tuplestore_trim(Tuplestorestate *state); + +extern void tuplestore_get_stats(Tuplestorestate *state, char **max_storage_type, + int64 *max_space); + +extern bool tuplestore_in_memory(Tuplestorestate *state); + +extern bool tuplestore_gettupleslot(Tuplestorestate *state, bool forward, + bool copy, TupleTableSlot *slot); + +extern bool tuplestore_advance(Tuplestorestate *state, bool forward); + +extern bool tuplestore_skiptuples(Tuplestorestate *state, + int64 ntuples, bool forward); + +extern int64 tuplestore_tuple_count(Tuplestorestate *state); + +extern bool tuplestore_ateof(Tuplestorestate *state); + +extern void tuplestore_rescan(Tuplestorestate *state); + +extern void tuplestore_clear(Tuplestorestate *state); + +extern void tuplestore_end(Tuplestorestate *state); + +#endif /* TUPLESTORE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/typcache.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/typcache.h new file mode 100644 index 0000000..1cb30f1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/typcache.h @@ -0,0 +1,215 @@ +/*------------------------------------------------------------------------- + * + * typcache.h + * Type cache definitions. + * + * The type cache exists to speed lookup of certain information about data + * types that is not directly available from a type's pg_type row. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/typcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef TYPCACHE_H +#define TYPCACHE_H + +#include "access/tupdesc.h" +#include "fmgr.h" +#include "storage/dsm.h" +#include "utils/dsa.h" + + +/* DomainConstraintCache is an opaque struct known only within typcache.c */ +typedef struct DomainConstraintCache DomainConstraintCache; + +/* TypeCacheEnumData is an opaque struct known only within typcache.c */ +struct TypeCacheEnumData; + +typedef struct TypeCacheEntry +{ + /* typeId is the hash lookup key and MUST BE FIRST */ + Oid type_id; /* OID of the data type */ + + uint32 type_id_hash; /* hashed value of the OID */ + + /* some subsidiary information copied from the pg_type row */ + int16 typlen; + bool typbyval; + char typalign; + char typstorage; + char typtype; + Oid typrelid; + Oid typsubscript; + Oid typelem; + Oid typarray; + Oid typcollation; + + /* + * Information obtained from opfamily entries + * + * These will be InvalidOid if no match could be found, or if the + * information hasn't yet been requested. Also note that for array and + * composite types, typcache.c checks that the contained types are + * comparable or hashable before allowing eq_opr etc to become set. + */ + Oid btree_opf; /* the default btree opclass' family */ + Oid btree_opintype; /* the default btree opclass' opcintype */ + Oid hash_opf; /* the default hash opclass' family */ + Oid hash_opintype; /* the default hash opclass' opcintype */ + Oid eq_opr; /* the equality operator */ + Oid lt_opr; /* the less-than operator */ + Oid gt_opr; /* the greater-than operator */ + Oid cmp_proc; /* the btree comparison function */ + Oid hash_proc; /* the hash calculation function */ + Oid hash_extended_proc; /* the extended hash calculation function */ + + /* + * Pre-set-up fmgr call info for the equality operator, the btree + * comparison function, and the hash calculation function. These are kept + * in the type cache to avoid problems with memory leaks in repeated calls + * to functions such as array_eq, array_cmp, hash_array. There is not + * currently a need to maintain call info for the lt_opr or gt_opr. + */ + FmgrInfo eq_opr_finfo; + FmgrInfo cmp_proc_finfo; + FmgrInfo hash_proc_finfo; + FmgrInfo hash_extended_proc_finfo; + + /* + * Tuple descriptor if it's a composite type (row type). NULL if not + * composite or information hasn't yet been requested. (NOTE: this is a + * reference-counted tupledesc.) + * + * To simplify caching dependent info, tupDesc_identifier is an identifier + * for this tupledesc that is unique for the life of the process, and + * changes anytime the tupledesc does. Zero if not yet determined. + */ + TupleDesc tupDesc; + uint64 tupDesc_identifier; + + /* + * Fields computed when TYPECACHE_RANGE_INFO is requested. Zeroes if not + * a range type or information hasn't yet been requested. Note that + * rng_cmp_proc_finfo could be different from the element type's default + * btree comparison function. + */ + struct TypeCacheEntry *rngelemtype; /* range's element type */ + Oid rng_opfamily; /* opfamily to use for range comparisons */ + Oid rng_collation; /* collation for comparisons, if any */ + FmgrInfo rng_cmp_proc_finfo; /* comparison function */ + FmgrInfo rng_canonical_finfo; /* canonicalization function, if any */ + FmgrInfo rng_subdiff_finfo; /* difference function, if any */ + + /* + * Fields computed when TYPECACHE_MULTIRANGE_INFO is required. + */ + struct TypeCacheEntry *rngtype; /* multirange's range underlying type */ + + /* + * Domain's base type and typmod if it's a domain type. Zeroes if not + * domain, or if information hasn't been requested. + */ + Oid domainBaseType; + int32 domainBaseTypmod; + + /* + * Domain constraint data if it's a domain type. NULL if not domain, or + * if domain has no constraints, or if information hasn't been requested. + */ + DomainConstraintCache *domainData; + + /* Private data, for internal use of typcache.c only */ + int flags; /* flags about what we've computed */ + + /* + * Private information about an enum type. NULL if not enum or + * information hasn't been requested. + */ + struct TypeCacheEnumData *enumData; + + /* We also maintain a list of all known domain-type cache entries */ + struct TypeCacheEntry *nextDomain; +} TypeCacheEntry; + +/* Bit flags to indicate which fields a given caller needs to have set */ +#define TYPECACHE_EQ_OPR 0x00001 +#define TYPECACHE_LT_OPR 0x00002 +#define TYPECACHE_GT_OPR 0x00004 +#define TYPECACHE_CMP_PROC 0x00008 +#define TYPECACHE_HASH_PROC 0x00010 +#define TYPECACHE_EQ_OPR_FINFO 0x00020 +#define TYPECACHE_CMP_PROC_FINFO 0x00040 +#define TYPECACHE_HASH_PROC_FINFO 0x00080 +#define TYPECACHE_TUPDESC 0x00100 +#define TYPECACHE_BTREE_OPFAMILY 0x00200 +#define TYPECACHE_HASH_OPFAMILY 0x00400 +#define TYPECACHE_RANGE_INFO 0x00800 +#define TYPECACHE_DOMAIN_BASE_INFO 0x01000 +#define TYPECACHE_DOMAIN_CONSTR_INFO 0x02000 +#define TYPECACHE_HASH_EXTENDED_PROC 0x04000 +#define TYPECACHE_HASH_EXTENDED_PROC_FINFO 0x08000 +#define TYPECACHE_MULTIRANGE_INFO 0x10000 + +/* This value will not equal any valid tupledesc identifier, nor 0 */ +#define INVALID_TUPLEDESC_IDENTIFIER ((uint64) 1) + +/* + * Callers wishing to maintain a long-lived reference to a domain's constraint + * set must store it in one of these. Use InitDomainConstraintRef() and + * UpdateDomainConstraintRef() to manage it. Note: DomainConstraintState is + * considered an executable expression type, so it's defined in execnodes.h. + */ +typedef struct DomainConstraintRef +{ + List *constraints; /* list of DomainConstraintState nodes */ + MemoryContext refctx; /* context holding DomainConstraintRef */ + TypeCacheEntry *tcache; /* typcache entry for domain type */ + bool need_exprstate; /* does caller need check_exprstate? */ + + /* Management data --- treat these fields as private to typcache.c */ + DomainConstraintCache *dcc; /* current constraints, or NULL if none */ + MemoryContextCallback callback; /* used to release refcount when done */ +} DomainConstraintRef; + +typedef struct SharedRecordTypmodRegistry SharedRecordTypmodRegistry; + +extern TypeCacheEntry *lookup_type_cache(Oid type_id, int flags); + +extern void InitDomainConstraintRef(Oid type_id, DomainConstraintRef *ref, + MemoryContext refctx, bool need_exprstate); + +extern void UpdateDomainConstraintRef(DomainConstraintRef *ref); + +extern bool DomainHasConstraints(Oid type_id); + +extern TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod); + +extern TupleDesc lookup_rowtype_tupdesc_noerror(Oid type_id, int32 typmod, + bool noError); + +extern TupleDesc lookup_rowtype_tupdesc_copy(Oid type_id, int32 typmod); + +extern TupleDesc lookup_rowtype_tupdesc_domain(Oid type_id, int32 typmod, + bool noError); + +extern void assign_record_type_typmod(TupleDesc tupDesc); + +extern uint64 assign_record_type_identifier(Oid type_id, int32 typmod); + +extern int compare_values_of_enum(TypeCacheEntry *tcache, Oid arg1, Oid arg2); + +extern size_t SharedRecordTypmodRegistryEstimate(void); + +extern void SharedRecordTypmodRegistryInit(SharedRecordTypmodRegistry *, + dsm_segment *segment, dsa_area *area); + +extern void SharedRecordTypmodRegistryAttach(SharedRecordTypmodRegistry *); + +extern void AtEOXact_TypeCache(void); + +extern void AtEOSubXact_TypeCache(void); + +#endif /* TYPCACHE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/tzparser.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/tzparser.h new file mode 100644 index 0000000..6b93fc6 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/tzparser.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * tzparser.h + * Timezone offset file parsing definitions. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/tzparser.h + * + *------------------------------------------------------------------------- + */ +#ifndef TZPARSER_H +#define TZPARSER_H + +#include "utils/datetime.h" + +/* + * The result of parsing a timezone configuration file is an array of + * these structs, in order by abbrev. We export this because datetime.c + * needs it. + */ +typedef struct tzEntry +{ + /* the actual data */ + char *abbrev; /* TZ abbreviation (downcased) */ + char *zone; /* zone name if dynamic abbrev, else NULL */ + /* for a dynamic abbreviation, offset/is_dst are not used */ + int offset; /* offset in seconds from UTC */ + bool is_dst; /* true if a DST abbreviation */ + /* source information (for error messages) */ + int lineno; + const char *filename; +} tzEntry; + + +extern TimeZoneAbbrevTable *load_tzoffsets(const char *filename); + +#endif /* TZPARSER_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/usercontext.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/usercontext.h new file mode 100644 index 0000000..a8195c1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/usercontext.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * usercontext.h + * Convenience functions for running code as a different database user. + * + *------------------------------------------------------------------------- + */ +#ifndef USERCONTEXT_H +#define USERCONTEXT_H + +/* + * When temporarily changing to run as a different user, this structure + * holds the details needed to restore the original state. + */ +typedef struct UserContext +{ + Oid save_userid; + int save_sec_context; + int save_nestlevel; +} UserContext; + +/* Function prototypes. */ +extern void SwitchToUntrustedUser(Oid userid, UserContext *context); +extern void RestoreUserContext(UserContext *context); + +#endif /* USERCONTEXT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/uuid.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/uuid.h new file mode 100644 index 0000000..239f365 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/uuid.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * uuid.h + * Header file for the "uuid" ADT. In C, we use the name pg_uuid_t, + * to avoid conflicts with any uuid_t type that might be defined by + * the system headers. + * + * Copyright (c) 2007-2025, PostgreSQL Global Development Group + * + * src/include/utils/uuid.h + * + *------------------------------------------------------------------------- + */ +#ifndef UUID_H +#define UUID_H + +/* uuid size in bytes */ +#define UUID_LEN 16 + +typedef struct pg_uuid_t +{ + unsigned char data[UUID_LEN]; +} pg_uuid_t; + +/* fmgr interface macros */ +static inline Datum +UUIDPGetDatum(const pg_uuid_t *X) +{ + return PointerGetDatum(X); +} + +#define PG_RETURN_UUID_P(X) return UUIDPGetDatum(X) + +static inline pg_uuid_t * +DatumGetUUIDP(Datum X) +{ + return (pg_uuid_t *) DatumGetPointer(X); +} + +#define PG_GETARG_UUID_P(X) DatumGetUUIDP(PG_GETARG_DATUM(X)) + +#endif /* UUID_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/varbit.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/varbit.h new file mode 100644 index 0000000..2f525aa --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/varbit.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------- + * + * varbit.h + * Functions for the SQL datatypes BIT() and BIT VARYING(). + * + * Code originally contributed by Adriaan Joubert. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/varbit.h + * + *------------------------------------------------------------------------- + */ +#ifndef VARBIT_H +#define VARBIT_H + +#include + +#include "fmgr.h" + +/* + * Modeled on struct varlena from postgres.h, but data type is bits8. + * + * Caution: if bit_len is not a multiple of BITS_PER_BYTE, the low-order + * bits of the last byte of bit_dat[] are unused and MUST be zeroes. + * (This allows bit_cmp() to not bother masking the last byte.) + * Also, there should not be any excess bytes counted in the header length. + */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 bit_len; /* number of valid bits */ + bits8 bit_dat[FLEXIBLE_ARRAY_MEMBER]; /* bit string, most sig. byte + * first */ +} VarBit; + +/* + * fmgr interface macros + * + * BIT and BIT VARYING are toastable varlena types. They are the same + * as far as representation goes, so we just have one set of macros. + */ +static inline VarBit * +DatumGetVarBitP(Datum X) +{ + return (VarBit *) PG_DETOAST_DATUM(X); +} + +static inline VarBit * +DatumGetVarBitPCopy(Datum X) +{ + return (VarBit *) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +VarBitPGetDatum(const VarBit *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_VARBIT_P(n) DatumGetVarBitP(PG_GETARG_DATUM(n)) +#define PG_GETARG_VARBIT_P_COPY(n) DatumGetVarBitPCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_VARBIT_P(x) return VarBitPGetDatum(x) + +/* Header overhead *in addition to* VARHDRSZ */ +#define VARBITHDRSZ sizeof(int32) +/* Number of bits in this bit string */ +#define VARBITLEN(PTR) (((VarBit *) (PTR))->bit_len) +/* Pointer to the first byte containing bit string data */ +#define VARBITS(PTR) (((VarBit *) (PTR))->bit_dat) +/* Number of bytes in the data section of a bit string */ +#define VARBITBYTES(PTR) (VARSIZE(PTR) - VARHDRSZ - VARBITHDRSZ) +/* Padding of the bit string at the end (in bits) */ +#define VARBITPAD(PTR) (VARBITBYTES(PTR)*BITS_PER_BYTE - VARBITLEN(PTR)) +/* Number of bytes needed to store a bit string of a given length */ +#define VARBITTOTALLEN(BITLEN) (((BITLEN) + BITS_PER_BYTE-1)/BITS_PER_BYTE + \ + VARHDRSZ + VARBITHDRSZ) +/* + * Maximum number of bits. Several code sites assume no overflow from + * computing bitlen + X; VARBITTOTALLEN() has the largest such X. + */ +#define VARBITMAXLEN (INT_MAX - BITS_PER_BYTE + 1) +/* pointer beyond the end of the bit string (like end() in STL containers) */ +#define VARBITEND(PTR) (((bits8 *) (PTR)) + VARSIZE(PTR)) +/* Mask that will cover exactly one byte, i.e. BITS_PER_BYTE bits */ +#define BITMASK 0xFF + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/varlena.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/varlena.h new file mode 100644 index 0000000..db9fdf7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/varlena.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * varlena.h + * Functions for the variable-length built-in types. + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/varlena.h + * + *------------------------------------------------------------------------- + */ +#ifndef VARLENA_H +#define VARLENA_H + +#include "nodes/pg_list.h" +#include "utils/sortsupport.h" + +extern int varstr_cmp(const char *arg1, int len1, const char *arg2, int len2, Oid collid); +extern void varstr_sortsupport(SortSupport ssup, Oid typid, Oid collid); +extern int varstr_levenshtein(const char *source, int slen, + const char *target, int tlen, + int ins_c, int del_c, int sub_c, + bool trusted); +extern int varstr_levenshtein_less_equal(const char *source, int slen, + const char *target, int tlen, + int ins_c, int del_c, int sub_c, + int max_d, bool trusted); +extern List *textToQualifiedNameList(text *textval); +extern bool SplitIdentifierString(char *rawstring, char separator, + List **namelist); +extern bool SplitDirectoriesString(char *rawstring, char separator, + List **namelist); +extern bool SplitGUCList(char *rawstring, char separator, + List **namelist); +extern text *replace_text_regexp(text *src_text, text *pattern_text, + text *replace_text, + int cflags, Oid collation, + int search_start, int n); + +typedef struct ClosestMatchState +{ + const char *source; + int min_d; + int max_d; + const char *match; +} ClosestMatchState; + +extern void initClosestMatch(ClosestMatchState *state, const char *source, int max_d); +extern void updateClosestMatch(ClosestMatchState *state, const char *candidate); +extern const char *getClosestMatch(ClosestMatchState *state); + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/wait_classes.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/wait_classes.h new file mode 100644 index 0000000..51ee683 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/wait_classes.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * wait_classes.h + * Definitions related to wait event classes + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/utils/wait_classes.h + * ---------- + */ +#ifndef WAIT_CLASSES_H +#define WAIT_CLASSES_H + + +/* ---------- + * Wait Classes + * ---------- + */ +#define PG_WAIT_LWLOCK 0x01000000U +#define PG_WAIT_LOCK 0x03000000U +#define PG_WAIT_BUFFERPIN 0x04000000U +#define PG_WAIT_ACTIVITY 0x05000000U +#define PG_WAIT_CLIENT 0x06000000U +#define PG_WAIT_EXTENSION 0x07000000U +#define PG_WAIT_IPC 0x08000000U +#define PG_WAIT_TIMEOUT 0x09000000U +#define PG_WAIT_IO 0x0A000000U +#define PG_WAIT_INJECTIONPOINT 0x0B000000U + +#endif /* WAIT_CLASSES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/wait_event.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/wait_event.h new file mode 100644 index 0000000..f5815b4 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/wait_event.h @@ -0,0 +1,92 @@ +/*------------------------------------------------------------------------- + * wait_event.h + * Definitions related to wait event reporting + * + * Copyright (c) 2001-2025, PostgreSQL Global Development Group + * + * src/include/utils/wait_event.h + * ---------- + */ +#ifndef WAIT_EVENT_H +#define WAIT_EVENT_H + +/* enums for wait events */ +#include "utils/wait_event_types.h" + +extern const char *pgstat_get_wait_event(uint32 wait_event_info); +extern const char *pgstat_get_wait_event_type(uint32 wait_event_info); +static inline void pgstat_report_wait_start(uint32 wait_event_info); +static inline void pgstat_report_wait_end(void); +extern void pgstat_set_wait_event_storage(uint32 *wait_event_info); +extern void pgstat_reset_wait_event_storage(void); + +extern PGDLLIMPORT uint32 *my_wait_event_info; + + +/* + * Wait Events - Extension, InjectionPoint + * + * Use InjectionPoint when the server process is waiting in an injection + * point. Use Extension for other cases of the server process waiting for + * some condition defined by an extension module. + * + * Extensions can define their own wait events in these categories. They + * should call one of these functions with a wait event string. If the wait + * event associated to a string is already allocated, it returns the wait + * event information to use. If not, it gets one wait event ID allocated from + * a shared counter, associates the string to the ID in the shared dynamic + * hash and returns the wait event information. + * + * The ID retrieved can be used with pgstat_report_wait_start() or equivalent. + */ +extern uint32 WaitEventExtensionNew(const char *wait_event_name); +extern uint32 WaitEventInjectionPointNew(const char *wait_event_name); + +extern void WaitEventCustomShmemInit(void); +extern Size WaitEventCustomShmemSize(void); +extern char **GetWaitEventCustomNames(uint32 classId, int *nwaitevents); + +/* ---------- + * pgstat_report_wait_start() - + * + * Called from places where server process needs to wait. This is called + * to report wait event information. The wait information is stored + * as 4-bytes where first byte represents the wait event class (type of + * wait, for different types of wait, refer WaitClass) and the next + * 3-bytes represent the actual wait event. Currently 2-bytes are used + * for wait event which is sufficient for current usage, 1-byte is + * reserved for future usage. + * + * Historically we used to make this reporting conditional on + * pgstat_track_activities, but the check for that seems to add more cost + * than it saves. + * + * my_wait_event_info initially points to local memory, making it safe to + * call this before MyProc has been initialized. + * ---------- + */ +static inline void +pgstat_report_wait_start(uint32 wait_event_info) +{ + /* + * Since this is a four-byte field which is always read and written as + * four-bytes, updates are atomic. + */ + *(volatile uint32 *) my_wait_event_info = wait_event_info; +} + +/* ---------- + * pgstat_report_wait_end() - + * + * Called to report end of a wait. + * ---------- + */ +static inline void +pgstat_report_wait_end(void) +{ + /* see pgstat_report_wait_start() */ + *(volatile uint32 *) my_wait_event_info = 0; +} + + +#endif /* WAIT_EVENT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/wait_event_types.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/wait_event_types.h new file mode 100644 index 0000000..d0ed7ff --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/wait_event_types.h @@ -0,0 +1,224 @@ +/*------------------------------------------------------------------------- + * + * wait_event_types.h + * Generated wait events infrastructure code + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/utils/activity/generate-wait_event_types.pl + * + *------------------------------------------------------------------------- + */ + +#ifndef WAIT_EVENT_TYPES_H +#define WAIT_EVENT_TYPES_H + +#include "utils/wait_classes.h" + +typedef enum +{ + WAIT_EVENT_ARCHIVER_MAIN = PG_WAIT_ACTIVITY, + WAIT_EVENT_AUTOVACUUM_MAIN, + WAIT_EVENT_BGWRITER_HIBERNATE, + WAIT_EVENT_BGWRITER_MAIN, + WAIT_EVENT_CHECKPOINTER_MAIN, + WAIT_EVENT_CHECKPOINTER_SHUTDOWN, + WAIT_EVENT_IO_WORKER_MAIN, + WAIT_EVENT_LOGICAL_APPLY_MAIN, + WAIT_EVENT_LOGICAL_LAUNCHER_MAIN, + WAIT_EVENT_LOGICAL_PARALLEL_APPLY_MAIN, + WAIT_EVENT_RECOVERY_WAL_STREAM, + WAIT_EVENT_REPLICATION_SLOTSYNC_MAIN, + WAIT_EVENT_REPLICATION_SLOTSYNC_SHUTDOWN, + WAIT_EVENT_SYSLOGGER_MAIN, + WAIT_EVENT_WAL_RECEIVER_MAIN, + WAIT_EVENT_WAL_SENDER_MAIN, + WAIT_EVENT_WAL_SUMMARIZER_WAL, + WAIT_EVENT_WAL_WRITER_MAIN +} WaitEventActivity; + +typedef enum +{ + WAIT_EVENT_BUFFER_PIN = PG_WAIT_BUFFERPIN +} WaitEventBufferPin; + +typedef enum +{ + WAIT_EVENT_CLIENT_READ = PG_WAIT_CLIENT, + WAIT_EVENT_CLIENT_WRITE, + WAIT_EVENT_GSS_OPEN_SERVER, + WAIT_EVENT_LIBPQWALRECEIVER_CONNECT, + WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE, + WAIT_EVENT_SSL_OPEN_SERVER, + WAIT_EVENT_WAIT_FOR_STANDBY_CONFIRMATION, + WAIT_EVENT_WAL_SENDER_WAIT_FOR_WAL, + WAIT_EVENT_WAL_SENDER_WRITE_DATA +} WaitEventClient; + +typedef enum +{ + WAIT_EVENT_AIO_IO_COMPLETION = PG_WAIT_IO, + WAIT_EVENT_AIO_IO_URING_EXECUTION, + WAIT_EVENT_AIO_IO_URING_SUBMIT, + WAIT_EVENT_BASEBACKUP_READ, + WAIT_EVENT_BASEBACKUP_SYNC, + WAIT_EVENT_BASEBACKUP_WRITE, + WAIT_EVENT_BUFFILE_READ, + WAIT_EVENT_BUFFILE_TRUNCATE, + WAIT_EVENT_BUFFILE_WRITE, + WAIT_EVENT_CONTROL_FILE_READ, + WAIT_EVENT_CONTROL_FILE_SYNC, + WAIT_EVENT_CONTROL_FILE_SYNC_UPDATE, + WAIT_EVENT_CONTROL_FILE_WRITE, + WAIT_EVENT_CONTROL_FILE_WRITE_UPDATE, + WAIT_EVENT_COPY_FILE_COPY, + WAIT_EVENT_COPY_FILE_READ, + WAIT_EVENT_COPY_FILE_WRITE, + WAIT_EVENT_DATA_FILE_EXTEND, + WAIT_EVENT_DATA_FILE_FLUSH, + WAIT_EVENT_DATA_FILE_IMMEDIATE_SYNC, + WAIT_EVENT_DATA_FILE_PREFETCH, + WAIT_EVENT_DATA_FILE_READ, + WAIT_EVENT_DATA_FILE_SYNC, + WAIT_EVENT_DATA_FILE_TRUNCATE, + WAIT_EVENT_DATA_FILE_WRITE, + WAIT_EVENT_DSM_ALLOCATE, + WAIT_EVENT_DSM_FILL_ZERO_WRITE, + WAIT_EVENT_LOCK_FILE_ADDTODATADIR_READ, + WAIT_EVENT_LOCK_FILE_ADDTODATADIR_SYNC, + WAIT_EVENT_LOCK_FILE_ADDTODATADIR_WRITE, + WAIT_EVENT_LOCK_FILE_CREATE_READ, + WAIT_EVENT_LOCK_FILE_CREATE_SYNC, + WAIT_EVENT_LOCK_FILE_CREATE_WRITE, + WAIT_EVENT_LOCK_FILE_RECHECKDATADIR_READ, + WAIT_EVENT_LOGICAL_REWRITE_CHECKPOINT_SYNC, + WAIT_EVENT_LOGICAL_REWRITE_MAPPING_SYNC, + WAIT_EVENT_LOGICAL_REWRITE_MAPPING_WRITE, + WAIT_EVENT_LOGICAL_REWRITE_SYNC, + WAIT_EVENT_LOGICAL_REWRITE_TRUNCATE, + WAIT_EVENT_LOGICAL_REWRITE_WRITE, + WAIT_EVENT_RELATION_MAP_READ, + WAIT_EVENT_RELATION_MAP_REPLACE, + WAIT_EVENT_RELATION_MAP_WRITE, + WAIT_EVENT_REORDER_BUFFER_READ, + WAIT_EVENT_REORDER_BUFFER_WRITE, + WAIT_EVENT_REORDER_LOGICAL_MAPPING_READ, + WAIT_EVENT_REPLICATION_SLOT_READ, + WAIT_EVENT_REPLICATION_SLOT_RESTORE_SYNC, + WAIT_EVENT_REPLICATION_SLOT_SYNC, + WAIT_EVENT_REPLICATION_SLOT_WRITE, + WAIT_EVENT_SLRU_FLUSH_SYNC, + WAIT_EVENT_SLRU_READ, + WAIT_EVENT_SLRU_SYNC, + WAIT_EVENT_SLRU_WRITE, + WAIT_EVENT_SNAPBUILD_READ, + WAIT_EVENT_SNAPBUILD_SYNC, + WAIT_EVENT_SNAPBUILD_WRITE, + WAIT_EVENT_TIMELINE_HISTORY_FILE_SYNC, + WAIT_EVENT_TIMELINE_HISTORY_FILE_WRITE, + WAIT_EVENT_TIMELINE_HISTORY_READ, + WAIT_EVENT_TIMELINE_HISTORY_SYNC, + WAIT_EVENT_TIMELINE_HISTORY_WRITE, + WAIT_EVENT_TWOPHASE_FILE_READ, + WAIT_EVENT_TWOPHASE_FILE_SYNC, + WAIT_EVENT_TWOPHASE_FILE_WRITE, + WAIT_EVENT_VERSION_FILE_SYNC, + WAIT_EVENT_VERSION_FILE_WRITE, + WAIT_EVENT_WALSENDER_TIMELINE_HISTORY_READ, + WAIT_EVENT_WAL_BOOTSTRAP_SYNC, + WAIT_EVENT_WAL_BOOTSTRAP_WRITE, + WAIT_EVENT_WAL_COPY_READ, + WAIT_EVENT_WAL_COPY_SYNC, + WAIT_EVENT_WAL_COPY_WRITE, + WAIT_EVENT_WAL_INIT_SYNC, + WAIT_EVENT_WAL_INIT_WRITE, + WAIT_EVENT_WAL_READ, + WAIT_EVENT_WAL_SUMMARY_READ, + WAIT_EVENT_WAL_SUMMARY_WRITE, + WAIT_EVENT_WAL_SYNC, + WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN, + WAIT_EVENT_WAL_WRITE +} WaitEventIO; + +typedef enum +{ + WAIT_EVENT_APPEND_READY = PG_WAIT_IPC, + WAIT_EVENT_ARCHIVE_CLEANUP_COMMAND, + WAIT_EVENT_ARCHIVE_COMMAND, + WAIT_EVENT_BACKEND_TERMINATION, + WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE, + WAIT_EVENT_BGWORKER_SHUTDOWN, + WAIT_EVENT_BGWORKER_STARTUP, + WAIT_EVENT_BTREE_PAGE, + WAIT_EVENT_BUFFER_IO, + WAIT_EVENT_CHECKPOINT_DELAY_COMPLETE, + WAIT_EVENT_CHECKPOINT_DELAY_START, + WAIT_EVENT_CHECKPOINT_DONE, + WAIT_EVENT_CHECKPOINT_START, + WAIT_EVENT_EXECUTE_GATHER, + WAIT_EVENT_HASH_BATCH_ALLOCATE, + WAIT_EVENT_HASH_BATCH_ELECT, + WAIT_EVENT_HASH_BATCH_LOAD, + WAIT_EVENT_HASH_BUILD_ALLOCATE, + WAIT_EVENT_HASH_BUILD_ELECT, + WAIT_EVENT_HASH_BUILD_HASH_INNER, + WAIT_EVENT_HASH_BUILD_HASH_OUTER, + WAIT_EVENT_HASH_GROW_BATCHES_DECIDE, + WAIT_EVENT_HASH_GROW_BATCHES_ELECT, + WAIT_EVENT_HASH_GROW_BATCHES_FINISH, + WAIT_EVENT_HASH_GROW_BATCHES_REALLOCATE, + WAIT_EVENT_HASH_GROW_BATCHES_REPARTITION, + WAIT_EVENT_HASH_GROW_BUCKETS_ELECT, + WAIT_EVENT_HASH_GROW_BUCKETS_REALLOCATE, + WAIT_EVENT_HASH_GROW_BUCKETS_REINSERT, + WAIT_EVENT_LOGICAL_APPLY_SEND_DATA, + WAIT_EVENT_LOGICAL_PARALLEL_APPLY_STATE_CHANGE, + WAIT_EVENT_LOGICAL_SYNC_DATA, + WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE, + WAIT_EVENT_MESSAGE_QUEUE_INTERNAL, + WAIT_EVENT_MESSAGE_QUEUE_PUT_MESSAGE, + WAIT_EVENT_MESSAGE_QUEUE_RECEIVE, + WAIT_EVENT_MESSAGE_QUEUE_SEND, + WAIT_EVENT_MULTIXACT_CREATION, + WAIT_EVENT_PARALLEL_BITMAP_SCAN, + WAIT_EVENT_PARALLEL_CREATE_INDEX_SCAN, + WAIT_EVENT_PARALLEL_FINISH, + WAIT_EVENT_PROCARRAY_GROUP_UPDATE, + WAIT_EVENT_PROC_SIGNAL_BARRIER, + WAIT_EVENT_PROMOTE, + WAIT_EVENT_RECOVERY_CONFLICT_SNAPSHOT, + WAIT_EVENT_RECOVERY_CONFLICT_TABLESPACE, + WAIT_EVENT_RECOVERY_END_COMMAND, + WAIT_EVENT_RECOVERY_PAUSE, + WAIT_EVENT_REPLICATION_ORIGIN_DROP, + WAIT_EVENT_REPLICATION_SLOT_DROP, + WAIT_EVENT_RESTORE_COMMAND, + WAIT_EVENT_SAFE_SNAPSHOT, + WAIT_EVENT_SYNC_REP, + WAIT_EVENT_WAL_RECEIVER_EXIT, + WAIT_EVENT_WAL_RECEIVER_WAIT_START, + WAIT_EVENT_WAL_SUMMARY_READY, + WAIT_EVENT_XACT_GROUP_UPDATE +} WaitEventIPC; + +typedef enum +{ + WAIT_EVENT_BASE_BACKUP_THROTTLE = PG_WAIT_TIMEOUT, + WAIT_EVENT_CHECKPOINT_WRITE_DELAY, + WAIT_EVENT_PG_SLEEP, + WAIT_EVENT_RECOVERY_APPLY_DELAY, + WAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL, + WAIT_EVENT_REGISTER_SYNC_REQUEST, + WAIT_EVENT_SPIN_DELAY, + WAIT_EVENT_VACUUM_DELAY, + WAIT_EVENT_VACUUM_TRUNCATE, + WAIT_EVENT_WAL_SUMMARIZER_ERROR +} WaitEventTimeout; + +#endif /* WAIT_EVENT_TYPES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/xid8.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/xid8.h new file mode 100644 index 0000000..35399b7 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/xid8.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * xid8.h + * Header file for the "xid8" ADT. + * + * Copyright (c) 2020-2025, PostgreSQL Global Development Group + * + * src/include/utils/xid8.h + * + *------------------------------------------------------------------------- + */ +#ifndef XID8_H +#define XID8_H + +#include "access/transam.h" + +static inline FullTransactionId +DatumGetFullTransactionId(Datum X) +{ + return FullTransactionIdFromU64(DatumGetUInt64(X)); +} + +static inline Datum +FullTransactionIdGetDatum(FullTransactionId X) +{ + return UInt64GetDatum(U64FromFullTransactionId(X)); +} + +#define PG_GETARG_FULLTRANSACTIONID(X) DatumGetFullTransactionId(PG_GETARG_DATUM(X)) +#define PG_RETURN_FULLTRANSACTIONID(X) return FullTransactionIdGetDatum(X) + +#endif /* XID8_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/xml.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/xml.h new file mode 100644 index 0000000..0d7a816 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/utils/xml.h @@ -0,0 +1,94 @@ +/*------------------------------------------------------------------------- + * + * xml.h + * Declarations for XML data type support. + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/xml.h + * + *------------------------------------------------------------------------- + */ + +#ifndef XML_H +#define XML_H + +#include "executor/tablefunc.h" +#include "fmgr.h" +#include "nodes/execnodes.h" +#include "nodes/primnodes.h" + +typedef struct varlena xmltype; + +typedef enum +{ + XML_STANDALONE_YES, + XML_STANDALONE_NO, + XML_STANDALONE_NO_VALUE, + XML_STANDALONE_OMITTED, +} XmlStandaloneType; + +typedef enum +{ + XMLBINARY_BASE64, + XMLBINARY_HEX, +} XmlBinaryType; + +typedef enum +{ + PG_XML_STRICTNESS_LEGACY, /* ignore errors unless function result + * indicates error condition */ + PG_XML_STRICTNESS_WELLFORMED, /* ignore non-parser messages */ + PG_XML_STRICTNESS_ALL, /* report all notices/warnings/errors */ +} PgXmlStrictness; + +/* struct PgXmlErrorContext is private to xml.c */ +typedef struct PgXmlErrorContext PgXmlErrorContext; + +static inline xmltype * +DatumGetXmlP(Datum X) +{ + return (xmltype *) PG_DETOAST_DATUM(X); +} + +static inline Datum +XmlPGetDatum(const xmltype *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_XML_P(n) DatumGetXmlP(PG_GETARG_DATUM(n)) +#define PG_RETURN_XML_P(x) PG_RETURN_POINTER(x) + +extern void pg_xml_init_library(void); +extern PgXmlErrorContext *pg_xml_init(PgXmlStrictness strictness); +extern void pg_xml_done(PgXmlErrorContext *errcxt, bool isError); +extern bool pg_xml_error_occurred(PgXmlErrorContext *errcxt); +extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode, + const char *msg); + +extern xmltype *xmlconcat(List *args); +extern xmltype *xmlelement(XmlExpr *xexpr, + Datum *named_argvalue, bool *named_argnull, + Datum *argvalue, bool *argnull); +extern xmltype *xmlparse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace); +extern xmltype *xmlpi(const char *target, text *arg, bool arg_is_null, bool *result_is_null); +extern xmltype *xmlroot(xmltype *data, text *version, int standalone); +extern bool xml_is_document(xmltype *arg); +extern text *xmltotext_with_options(xmltype *data, XmlOptionType xmloption_arg, + bool indent); +extern char *escape_xml(const char *str); + +extern char *map_sql_identifier_to_xml_name(const char *ident, bool fully_escaped, bool escape_period); +extern char *map_xml_name_to_sql_identifier(const char *name); +extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings); + +extern PGDLLIMPORT int xmlbinary; /* XmlBinaryType, but int for guc enum */ + +extern PGDLLIMPORT int xmloption; /* XmlOptionType, but int for guc enum */ + +extern PGDLLIMPORT const TableFuncRoutine XmlTableRoutine; + +#endif /* XML_H */ diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/varatt.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/varatt.h new file mode 100644 index 0000000..2e8564d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/varatt.h @@ -0,0 +1,358 @@ +/*------------------------------------------------------------------------- + * + * varatt.h + * variable-length datatypes (TOAST support) + * + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1995, Regents of the University of California + * + * src/include/varatt.h + * + *------------------------------------------------------------------------- + */ + +#ifndef VARATT_H +#define VARATT_H + +/* + * struct varatt_external is a traditional "TOAST pointer", that is, the + * information needed to fetch a Datum stored out-of-line in a TOAST table. + * The data is compressed if and only if the external size stored in + * va_extinfo is less than va_rawsize - VARHDRSZ. + * + * This struct must not contain any padding, because we sometimes compare + * these pointers using memcmp. + * + * Note that this information is stored unaligned within actual tuples, so + * you need to memcpy from the tuple into a local struct variable before + * you can look at these fields! (The reason we use memcmp is to avoid + * having to do that just to detect equality of two TOAST pointers...) + */ +typedef struct varatt_external +{ + int32 va_rawsize; /* Original data size (includes header) */ + uint32 va_extinfo; /* External saved size (without header) and + * compression method */ + Oid va_valueid; /* Unique ID of value within TOAST table */ + Oid va_toastrelid; /* RelID of TOAST table containing it */ +} varatt_external; + +/* + * These macros define the "saved size" portion of va_extinfo. Its remaining + * two high-order bits identify the compression method. + */ +#define VARLENA_EXTSIZE_BITS 30 +#define VARLENA_EXTSIZE_MASK ((1U << VARLENA_EXTSIZE_BITS) - 1) + +/* + * struct varatt_indirect is a "TOAST pointer" representing an out-of-line + * Datum that's stored in memory, not in an external toast relation. + * The creator of such a Datum is entirely responsible that the referenced + * storage survives for as long as referencing pointer Datums can exist. + * + * Note that just as for struct varatt_external, this struct is stored + * unaligned within any containing tuple. + */ +typedef struct varatt_indirect +{ + struct varlena *pointer; /* Pointer to in-memory varlena */ +} varatt_indirect; + +/* + * struct varatt_expanded is a "TOAST pointer" representing an out-of-line + * Datum that is stored in memory, in some type-specific, not necessarily + * physically contiguous format that is convenient for computation not + * storage. APIs for this, in particular the definition of struct + * ExpandedObjectHeader, are in src/include/utils/expandeddatum.h. + * + * Note that just as for struct varatt_external, this struct is stored + * unaligned within any containing tuple. + */ +typedef struct ExpandedObjectHeader ExpandedObjectHeader; + +typedef struct varatt_expanded +{ + ExpandedObjectHeader *eohptr; +} varatt_expanded; + +/* + * Type tag for the various sorts of "TOAST pointer" datums. The peculiar + * value for VARTAG_ONDISK comes from a requirement for on-disk compatibility + * with a previous notion that the tag field was the pointer datum's length. + */ +typedef enum vartag_external +{ + VARTAG_INDIRECT = 1, + VARTAG_EXPANDED_RO = 2, + VARTAG_EXPANDED_RW = 3, + VARTAG_ONDISK = 18 +} vartag_external; + +/* this test relies on the specific tag values above */ +#define VARTAG_IS_EXPANDED(tag) \ + (((tag) & ~1) == VARTAG_EXPANDED_RO) + +#define VARTAG_SIZE(tag) \ + ((tag) == VARTAG_INDIRECT ? sizeof(varatt_indirect) : \ + VARTAG_IS_EXPANDED(tag) ? sizeof(varatt_expanded) : \ + (tag) == VARTAG_ONDISK ? sizeof(varatt_external) : \ + (AssertMacro(false), 0)) + +/* + * These structs describe the header of a varlena object that may have been + * TOASTed. Generally, don't reference these structs directly, but use the + * macros below. + * + * We use separate structs for the aligned and unaligned cases because the + * compiler might otherwise think it could generate code that assumes + * alignment while touching fields of a 1-byte-header varlena. + */ +typedef union +{ + struct /* Normal varlena (4-byte length) */ + { + uint32 va_header; + char va_data[FLEXIBLE_ARRAY_MEMBER]; + } va_4byte; + struct /* Compressed-in-line format */ + { + uint32 va_header; + uint32 va_tcinfo; /* Original data size (excludes header) and + * compression method; see va_extinfo */ + char va_data[FLEXIBLE_ARRAY_MEMBER]; /* Compressed data */ + } va_compressed; +} varattrib_4b; + +typedef struct +{ + uint8 va_header; + char va_data[FLEXIBLE_ARRAY_MEMBER]; /* Data begins here */ +} varattrib_1b; + +/* TOAST pointers are a subset of varattrib_1b with an identifying tag byte */ +typedef struct +{ + uint8 va_header; /* Always 0x80 or 0x01 */ + uint8 va_tag; /* Type of datum */ + char va_data[FLEXIBLE_ARRAY_MEMBER]; /* Type-specific data */ +} varattrib_1b_e; + +/* + * Bit layouts for varlena headers on big-endian machines: + * + * 00xxxxxx 4-byte length word, aligned, uncompressed data (up to 1G) + * 01xxxxxx 4-byte length word, aligned, *compressed* data (up to 1G) + * 10000000 1-byte length word, unaligned, TOAST pointer + * 1xxxxxxx 1-byte length word, unaligned, uncompressed data (up to 126b) + * + * Bit layouts for varlena headers on little-endian machines: + * + * xxxxxx00 4-byte length word, aligned, uncompressed data (up to 1G) + * xxxxxx10 4-byte length word, aligned, *compressed* data (up to 1G) + * 00000001 1-byte length word, unaligned, TOAST pointer + * xxxxxxx1 1-byte length word, unaligned, uncompressed data (up to 126b) + * + * The "xxx" bits are the length field (which includes itself in all cases). + * In the big-endian case we mask to extract the length, in the little-endian + * case we shift. Note that in both cases the flag bits are in the physically + * first byte. Also, it is not possible for a 1-byte length word to be zero; + * this lets us disambiguate alignment padding bytes from the start of an + * unaligned datum. (We now *require* pad bytes to be filled with zero!) + * + * In TOAST pointers the va_tag field (see varattrib_1b_e) is used to discern + * the specific type and length of the pointer datum. + */ + +/* + * Endian-dependent macros. These are considered internal --- use the + * external macros below instead of using these directly. + * + * Note: IS_1B is true for external toast records but VARSIZE_1B will return 0 + * for such records. Hence you should usually check for IS_EXTERNAL before + * checking for IS_1B. + */ + +#ifdef WORDS_BIGENDIAN + +#define VARATT_IS_4B(PTR) \ + ((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x00) +#define VARATT_IS_4B_U(PTR) \ + ((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x00) +#define VARATT_IS_4B_C(PTR) \ + ((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x40) +#define VARATT_IS_1B(PTR) \ + ((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x80) +#define VARATT_IS_1B_E(PTR) \ + ((((varattrib_1b *) (PTR))->va_header) == 0x80) +#define VARATT_NOT_PAD_BYTE(PTR) \ + (*((uint8 *) (PTR)) != 0) + +/* VARSIZE_4B() should only be used on known-aligned data */ +#define VARSIZE_4B(PTR) \ + (((varattrib_4b *) (PTR))->va_4byte.va_header & 0x3FFFFFFF) +#define VARSIZE_1B(PTR) \ + (((varattrib_1b *) (PTR))->va_header & 0x7F) +#define VARTAG_1B_E(PTR) \ + (((varattrib_1b_e *) (PTR))->va_tag) + +#define SET_VARSIZE_4B(PTR,len) \ + (((varattrib_4b *) (PTR))->va_4byte.va_header = (len) & 0x3FFFFFFF) +#define SET_VARSIZE_4B_C(PTR,len) \ + (((varattrib_4b *) (PTR))->va_4byte.va_header = ((len) & 0x3FFFFFFF) | 0x40000000) +#define SET_VARSIZE_1B(PTR,len) \ + (((varattrib_1b *) (PTR))->va_header = (len) | 0x80) +#define SET_VARTAG_1B_E(PTR,tag) \ + (((varattrib_1b_e *) (PTR))->va_header = 0x80, \ + ((varattrib_1b_e *) (PTR))->va_tag = (tag)) + +#else /* !WORDS_BIGENDIAN */ + +#define VARATT_IS_4B(PTR) \ + ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x00) +#define VARATT_IS_4B_U(PTR) \ + ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x00) +#define VARATT_IS_4B_C(PTR) \ + ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x02) +#define VARATT_IS_1B(PTR) \ + ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x01) +#define VARATT_IS_1B_E(PTR) \ + ((((varattrib_1b *) (PTR))->va_header) == 0x01) +#define VARATT_NOT_PAD_BYTE(PTR) \ + (*((uint8 *) (PTR)) != 0) + +/* VARSIZE_4B() should only be used on known-aligned data */ +#define VARSIZE_4B(PTR) \ + ((((varattrib_4b *) (PTR))->va_4byte.va_header >> 2) & 0x3FFFFFFF) +#define VARSIZE_1B(PTR) \ + ((((varattrib_1b *) (PTR))->va_header >> 1) & 0x7F) +#define VARTAG_1B_E(PTR) \ + (((varattrib_1b_e *) (PTR))->va_tag) + +#define SET_VARSIZE_4B(PTR,len) \ + (((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2)) +#define SET_VARSIZE_4B_C(PTR,len) \ + (((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2) | 0x02) +#define SET_VARSIZE_1B(PTR,len) \ + (((varattrib_1b *) (PTR))->va_header = (((uint8) (len)) << 1) | 0x01) +#define SET_VARTAG_1B_E(PTR,tag) \ + (((varattrib_1b_e *) (PTR))->va_header = 0x01, \ + ((varattrib_1b_e *) (PTR))->va_tag = (tag)) + +#endif /* WORDS_BIGENDIAN */ + +#define VARDATA_4B(PTR) (((varattrib_4b *) (PTR))->va_4byte.va_data) +#define VARDATA_4B_C(PTR) (((varattrib_4b *) (PTR))->va_compressed.va_data) +#define VARDATA_1B(PTR) (((varattrib_1b *) (PTR))->va_data) +#define VARDATA_1B_E(PTR) (((varattrib_1b_e *) (PTR))->va_data) + +/* + * Externally visible TOAST macros begin here. + */ + +#define VARHDRSZ_EXTERNAL offsetof(varattrib_1b_e, va_data) +#define VARHDRSZ_COMPRESSED offsetof(varattrib_4b, va_compressed.va_data) +#define VARHDRSZ_SHORT offsetof(varattrib_1b, va_data) + +#define VARATT_SHORT_MAX 0x7F +#define VARATT_CAN_MAKE_SHORT(PTR) \ + (VARATT_IS_4B_U(PTR) && \ + (VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT) <= VARATT_SHORT_MAX) +#define VARATT_CONVERTED_SHORT_SIZE(PTR) \ + (VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT) + +/* + * In consumers oblivious to data alignment, call PG_DETOAST_DATUM_PACKED(), + * VARDATA_ANY(), VARSIZE_ANY() and VARSIZE_ANY_EXHDR(). Elsewhere, call + * PG_DETOAST_DATUM(), VARDATA() and VARSIZE(). Directly fetching an int16, + * int32 or wider field in the struct representing the datum layout requires + * aligned data. memcpy() is alignment-oblivious, as are most operations on + * datatypes, such as text, whose layout struct contains only char fields. + * + * Code assembling a new datum should call VARDATA() and SET_VARSIZE(). + * (Datums begin life untoasted.) + * + * Other macros here should usually be used only by tuple assembly/disassembly + * code and code that specifically wants to work with still-toasted Datums. + */ +#define VARDATA(PTR) VARDATA_4B(PTR) +#define VARSIZE(PTR) VARSIZE_4B(PTR) + +#define VARSIZE_SHORT(PTR) VARSIZE_1B(PTR) +#define VARDATA_SHORT(PTR) VARDATA_1B(PTR) + +#define VARTAG_EXTERNAL(PTR) VARTAG_1B_E(PTR) +#define VARSIZE_EXTERNAL(PTR) (VARHDRSZ_EXTERNAL + VARTAG_SIZE(VARTAG_EXTERNAL(PTR))) +#define VARDATA_EXTERNAL(PTR) VARDATA_1B_E(PTR) + +#define VARATT_IS_COMPRESSED(PTR) VARATT_IS_4B_C(PTR) +#define VARATT_IS_EXTERNAL(PTR) VARATT_IS_1B_E(PTR) +#define VARATT_IS_EXTERNAL_ONDISK(PTR) \ + (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_ONDISK) +#define VARATT_IS_EXTERNAL_INDIRECT(PTR) \ + (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_INDIRECT) +#define VARATT_IS_EXTERNAL_EXPANDED_RO(PTR) \ + (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RO) +#define VARATT_IS_EXTERNAL_EXPANDED_RW(PTR) \ + (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RW) +#define VARATT_IS_EXTERNAL_EXPANDED(PTR) \ + (VARATT_IS_EXTERNAL(PTR) && VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR))) +#define VARATT_IS_EXTERNAL_NON_EXPANDED(PTR) \ + (VARATT_IS_EXTERNAL(PTR) && !VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR))) +#define VARATT_IS_SHORT(PTR) VARATT_IS_1B(PTR) +#define VARATT_IS_EXTENDED(PTR) (!VARATT_IS_4B_U(PTR)) + +#define SET_VARSIZE(PTR, len) SET_VARSIZE_4B(PTR, len) +#define SET_VARSIZE_SHORT(PTR, len) SET_VARSIZE_1B(PTR, len) +#define SET_VARSIZE_COMPRESSED(PTR, len) SET_VARSIZE_4B_C(PTR, len) + +#define SET_VARTAG_EXTERNAL(PTR, tag) SET_VARTAG_1B_E(PTR, tag) + +#define VARSIZE_ANY(PTR) \ + (VARATT_IS_1B_E(PTR) ? VARSIZE_EXTERNAL(PTR) : \ + (VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR) : \ + VARSIZE_4B(PTR))) + +/* Size of a varlena data, excluding header */ +#define VARSIZE_ANY_EXHDR(PTR) \ + (VARATT_IS_1B_E(PTR) ? VARSIZE_EXTERNAL(PTR)-VARHDRSZ_EXTERNAL : \ + (VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR)-VARHDRSZ_SHORT : \ + VARSIZE_4B(PTR)-VARHDRSZ)) + +/* caution: this will not work on an external or compressed-in-line Datum */ +/* caution: this will return a possibly unaligned pointer */ +#define VARDATA_ANY(PTR) \ + (VARATT_IS_1B(PTR) ? VARDATA_1B(PTR) : VARDATA_4B(PTR)) + +/* Decompressed size and compression method of a compressed-in-line Datum */ +#define VARDATA_COMPRESSED_GET_EXTSIZE(PTR) \ + (((varattrib_4b *) (PTR))->va_compressed.va_tcinfo & VARLENA_EXTSIZE_MASK) +#define VARDATA_COMPRESSED_GET_COMPRESS_METHOD(PTR) \ + (((varattrib_4b *) (PTR))->va_compressed.va_tcinfo >> VARLENA_EXTSIZE_BITS) + +/* Same for external Datums; but note argument is a struct varatt_external */ +#define VARATT_EXTERNAL_GET_EXTSIZE(toast_pointer) \ + ((toast_pointer).va_extinfo & VARLENA_EXTSIZE_MASK) +#define VARATT_EXTERNAL_GET_COMPRESS_METHOD(toast_pointer) \ + ((toast_pointer).va_extinfo >> VARLENA_EXTSIZE_BITS) + +#define VARATT_EXTERNAL_SET_SIZE_AND_COMPRESS_METHOD(toast_pointer, len, cm) \ + do { \ + Assert((cm) == TOAST_PGLZ_COMPRESSION_ID || \ + (cm) == TOAST_LZ4_COMPRESSION_ID); \ + ((toast_pointer).va_extinfo = \ + (len) | ((uint32) (cm) << VARLENA_EXTSIZE_BITS)); \ + } while (0) + +/* + * Testing whether an externally-stored value is compressed now requires + * comparing size stored in va_extinfo (the actual length of the external data) + * to rawsize (the original uncompressed datum's size). The latter includes + * VARHDRSZ overhead, the former doesn't. We never use compression unless it + * actually saves space, so we expect either equality or less-than. + */ +#define VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer) \ + (VARATT_EXTERNAL_GET_EXTSIZE(toast_pointer) < \ + (toast_pointer).va_rawsize - VARHDRSZ) + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/postgresql/server/windowapi.h b/VCMP-LUA/modules/postgresql/include/postgresql/server/windowapi.h new file mode 100644 index 0000000..cb2ece1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/postgresql/server/windowapi.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * windowapi.h + * API for window functions to extract data from their window + * + * A window function does not receive its arguments in the normal way + * (and therefore the concept of strictness is irrelevant). Instead it + * receives a "WindowObject", which it can fetch with PG_WINDOW_OBJECT() + * (note V1 calling convention must be used). Correct call context can + * be tested with WindowObjectIsValid(). Although argument values are + * not passed, the call is correctly set up so that PG_NARGS() can be + * used and argument type information can be obtained with + * get_fn_expr_argtype(), get_fn_expr_arg_stable(), etc. + * + * Operations on the WindowObject allow the window function to find out + * the current row number, total number of rows in the partition, etc + * and to evaluate its argument expression(s) at various rows in the + * window partition. See the header comments for each WindowObject API + * function in nodeWindowAgg.c for details. + * + * + * Portions Copyright (c) 2000-2025, PostgreSQL Global Development Group + * + * src/include/windowapi.h + * + *------------------------------------------------------------------------- + */ +#ifndef WINDOWAPI_H +#define WINDOWAPI_H + +/* values of "seektype" */ +#define WINDOW_SEEK_CURRENT 0 +#define WINDOW_SEEK_HEAD 1 +#define WINDOW_SEEK_TAIL 2 + +/* this struct is private in nodeWindowAgg.c */ +typedef struct WindowObjectData *WindowObject; + +#define PG_WINDOW_OBJECT() ((WindowObject) fcinfo->context) + +#define WindowObjectIsValid(winobj) \ + ((winobj) != NULL && IsA(winobj, WindowObjectData)) + +extern void *WinGetPartitionLocalMemory(WindowObject winobj, Size sz); + +extern int64 WinGetCurrentPosition(WindowObject winobj); +extern int64 WinGetPartitionRowCount(WindowObject winobj); + +extern void WinSetMarkPosition(WindowObject winobj, int64 markpos); + +extern bool WinRowsArePeers(WindowObject winobj, int64 pos1, int64 pos2); + +extern Datum WinGetFuncArgInPartition(WindowObject winobj, int argno, + int relpos, int seektype, bool set_mark, + bool *isnull, bool *isout); + +extern Datum WinGetFuncArgInFrame(WindowObject winobj, int argno, + int relpos, int seektype, bool set_mark, + bool *isnull, bool *isout); + +extern Datum WinGetFuncArgCurrent(WindowObject winobj, int argno, + bool *isnull); + +#endif /* WINDOWAPI_H */ diff --git a/VCMP-LUA/modules/postgresql/include/sql3types.h b/VCMP-LUA/modules/postgresql/include/sql3types.h new file mode 100644 index 0000000..644b616 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/sql3types.h @@ -0,0 +1,43 @@ +#ifndef _ECPG_SQL3TYPES_H +#define _ECPG_SQL3TYPES_H + +/* SQL3 dynamic type codes */ + +/* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */ + +enum +{ + SQL3_CHARACTER = 1, + SQL3_NUMERIC, + SQL3_DECIMAL, + SQL3_INTEGER, + SQL3_SMALLINT, + SQL3_FLOAT, + SQL3_REAL, + SQL3_DOUBLE_PRECISION, + SQL3_DATE_TIME_TIMESTAMP, + SQL3_INTERVAL, /* 10 */ + SQL3_CHARACTER_VARYING = 12, + SQL3_ENUMERATED, + SQL3_BIT, + SQL3_BIT_VARYING, + SQL3_BOOLEAN, + SQL3_abstract + /* the rest is xLOB stuff */ +}; + +/* chapter 13.1 table 3: Codes associated with datetime data types in Dynamic SQL */ + +enum +{ + SQL3_DDT_DATE = 1, + SQL3_DDT_TIME, + SQL3_DDT_TIMESTAMP, + SQL3_DDT_TIME_WITH_TIME_ZONE, + SQL3_DDT_TIMESTAMP_WITH_TIME_ZONE, + + SQL3_DDT_ILLEGAL /* not a datetime data type (not part of + * standard) */ +}; + +#endif /* !_ECPG_SQL3TYPES_H */ diff --git a/VCMP-LUA/modules/postgresql/include/sqlca.h b/VCMP-LUA/modules/postgresql/include/sqlca.h new file mode 100644 index 0000000..c5f107d --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/sqlca.h @@ -0,0 +1,66 @@ +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/VCMP-LUA/modules/postgresql/include/sqlda-compat.h b/VCMP-LUA/modules/postgresql/include/sqlda-compat.h new file mode 100644 index 0000000..7b0ac45 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/sqlda-compat.h @@ -0,0 +1,47 @@ +/* + * src/interfaces/ecpg/include/sqlda-compat.h + */ + +#ifndef ECPG_SQLDA_COMPAT_H +#define ECPG_SQLDA_COMPAT_H + +struct sqlvar_compat +{ + short sqltype; /* variable type */ + int sqllen; /* length in bytes */ + char *sqldata; /* pointer to data */ + short *sqlind; /* pointer to indicator */ + char *sqlname; /* variable name */ + char *sqlformat; /* reserved for future use */ + short sqlitype; /* ind variable type */ + short sqlilen; /* ind length in bytes */ + char *sqlidata; /* ind data pointer */ + int sqlxid; /* extended id type */ + char *sqltypename; /* extended type name */ + short sqltypelen; /* length of extended type name */ + short sqlownerlen; /* length of owner name */ + short sqlsourcetype; /* source type for distinct of built-ins */ + char *sqlownername; /* owner name */ + int sqlsourceid; /* extended id of source type */ + + /* + * sqlilongdata is new. It supports data that exceeds the 32k limit. + * sqlilen and sqlidata are for backward compatibility and they have + * maximum value of <32K. + */ + char *sqlilongdata; /* for data field beyond 32K */ + int sqlflags; /* for internal use only */ + void *sqlreserved; /* reserved for future use */ +}; + +struct sqlda_compat +{ + short sqld; + struct sqlvar_compat *sqlvar; + char desc_name[19]; /* descriptor name */ + short desc_occ; /* size of sqlda structure */ + struct sqlda_compat *desc_next; /* pointer to next sqlda struct */ + void *reserved; /* reserved for future use */ +}; + +#endif /* ECPG_SQLDA_COMPAT_H */ diff --git a/VCMP-LUA/modules/postgresql/include/sqlda-native.h b/VCMP-LUA/modules/postgresql/include/sqlda-native.h new file mode 100644 index 0000000..9e73f1f --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/sqlda-native.h @@ -0,0 +1,43 @@ +/* + * src/interfaces/ecpg/include/sqlda-native.h + */ + +#ifndef ECPG_SQLDA_NATIVE_H +#define ECPG_SQLDA_NATIVE_H + +/* + * Maximum length for identifiers (e.g. table names, column names, + * function names). Names actually are limited to one fewer byte than this, + * because the length must include a trailing zero byte. + * + * This should be at least as much as NAMEDATALEN of the database the + * applications run against. + */ +#define NAMEDATALEN 64 + +struct sqlname +{ + short length; + char data[NAMEDATALEN]; +}; + +struct sqlvar_struct +{ + short sqltype; + short sqllen; + char *sqldata; + short *sqlind; + struct sqlname sqlname; +}; + +struct sqlda_struct +{ + char sqldaid[8]; + long sqldabc; + short sqln; + short sqld; + struct sqlda_struct *desc_next; + struct sqlvar_struct sqlvar[1]; +}; + +#endif /* ECPG_SQLDA_NATIVE_H */ diff --git a/VCMP-LUA/modules/postgresql/include/sqlda.h b/VCMP-LUA/modules/postgresql/include/sqlda.h new file mode 100644 index 0000000..d810e73 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/sqlda.h @@ -0,0 +1,18 @@ +#ifndef ECPG_SQLDA_H +#define ECPG_SQLDA_H + +#ifdef _ECPG_INFORMIX_H + +#include "sqlda-compat.h" +typedef struct sqlvar_compat sqlvar_t; +typedef struct sqlda_compat sqlda_t; + +#else + +#include "sqlda-native.h" +typedef struct sqlvar_struct sqlvar_t; +typedef struct sqlda_struct sqlda_t; + +#endif + +#endif /* ECPG_SQLDA_H */ diff --git a/VCMP-LUA/modules/postgresql/include/zconf.h b/VCMP-LUA/modules/postgresql/include/zconf.h new file mode 100644 index 0000000..d814fc5 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/zconf.h @@ -0,0 +1,555 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* #undef Z_PREFIX */ +#define HAVE_STDARG_H 1 +/* #undef HAVE_UNISTD_H */ + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET + +/* all linked symbols and init macros */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compress_z z_compress_z +# define compress2_z z_compress2_z +# define compressBound z_compressBound +# define compressBound_z z_compressBound_z +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op +# define crc32_z z_crc32_z +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateBound_z z_deflateBound_z +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflateUsed z_deflateUsed +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary +# define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateValidate z_inflateValidate +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# define inflate_fixed z_inflate_fixed +# ifndef Z_SOLO +# define uncompress z_uncompress +# define uncompress2 z_uncompress2 +# define uncompress_z z_uncompress_z +# define uncompress2_z z_uncompress2_z +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +#ifndef z_const +# ifdef ZLIB_CONST +# define z_const const +# else +# define z_const +# endif +#endif + +#ifdef Z_SOLO +# ifdef _WIN64 + typedef unsigned long long z_size_t; +# else + typedef unsigned long z_size_t; +# endif +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# if 0 +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# if 0 +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#if HAVE_UNISTD_H-0 /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#if HAVE_STDARG_H-0 /* may be set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include /* for off_t */ +# endif +#endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + +#ifdef _WIN32 +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#ifndef Z_HAVE_UNISTD_H +# if defined(__WATCOMC__) || defined(__GO32__) || \ + (defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)) +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +# endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +# define z_off64_t off64_t +#elif defined(__MINGW32__) +# define z_off64_t long long +#elif defined(_WIN32) && !defined(__GNUC__) +# define z_off64_t __int64 +#elif defined(__GO32__) +# define z_off64_t offset_t +#else +# define z_off64_t z_off_t +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/VCMP-LUA/modules/postgresql/include/zlib.h b/VCMP-LUA/modules/postgresql/include/zlib.h new file mode 100644 index 0000000..a57d336 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/include/zlib.h @@ -0,0 +1,2057 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.3.2, February 17th, 2026 + + Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 at https://datatracker.ietf.org/doc/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#ifdef ZLIB_BUILD +# include +#else +# include "zconf.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.3.2" +#define ZLIB_VERNUM 0x1320 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 3 +#define ZLIB_VER_REVISION 2 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip and raw deflate streams in + memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in the case of corrupted input. +*/ + +typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size); +typedef void (*free_func)(voidpf opaque, voidpf address); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total number of input bytes read so far */ + + Bytef *next_out; /* next output byte will go here */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total number of bytes output so far */ + + z_const char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text + for deflate, or the decoding state for inflate */ + uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. In that case, zlib is thread-safe. When zalloc and zfree are + Z_NULL on entry to the initialization function, they are set to internal + routines that use the standard library functions malloc() and free(). + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use by the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field for deflate() */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion(void); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. total_in, total_out, adler, and msg are initialized. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary. Some output may be provided even if + flush is zero. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. See deflatePending(), + which can be used if desired to determine whether or not there is more output + in that case. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed + codes block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six when the flush marker begins, in order to avoid + repeated flush markers upon calling deflate() again when avail_out == 0. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this + function must be called again with Z_FINISH and more output space (updated + avail_out) but no more input data, until it returns with Z_STREAM_END or an + error. After deflate has returned Z_STREAM_END, the only possible operations + on the stream are deflateReset or deflateEnd. + + Z_FINISH can be used in the first deflate call after deflateInit if all the + compression is to be done in a single step. In order to complete in one + call, avail_out must be at least the value returned by deflateBound (see + below). Then deflate is guaranteed to return Z_STREAM_END. If not enough + output space is provided, deflate will not return Z_STREAM_END, and it must + be called again as described above. + + deflate() sets strm->adler to the Adler-32 checksum of all input read + so far (that is, total_in bytes). If a gzip stream is being generated, then + strm->adler will be the CRC-32 checksum of the input read so far. (See + deflateInit2 below.) + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is + considered binary. This field is only for information purposes and does not + affect the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL or the state was inadvertently written over + by the application), or Z_BUF_ERROR if no progress is possible (for example + avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and + deflate() can be called again with more input and more output space to + continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd(z_streamp strm); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit(z_streamp strm); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. In the current version of inflate, the provided input is not + read or consumed. The allocation of a sliding window will be deferred to + the first call of inflate (if the decompression does not complete on the + first call). If zalloc and zfree are set to Z_NULL, inflateInit updates + them to use default allocation functions. total_in, total_out, adler, and + msg are initialized. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression. + Actual decompression will be done by inflate(). So next_in, and avail_in, + next_out, and avail_out are unused and unchanged. The current + implementation of inflateInit() does not process any header information -- + that is deferred until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), then next_in and avail_in are updated + accordingly, and processing will resume at this point for the next call of + inflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. If the + caller of inflate() does not provide both available input and available + output space, it is possible that there will be no progress made. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + To assist in this, on return inflate() always sets strm->data_type to the + number of unused bits in the input taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed Adler-32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained unless inflateGetHeader() is used. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + produced so far. The CRC-32 is checked against the gzip trailer, as is the + uncompressed length, modulo 2^32. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value, in which case strm->msg points to a string with a more specific + error), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL, or the state was inadvertently written over + by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR + if no progress was possible or if there was not enough room in the output + buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is to be attempted. +*/ + + +ZEXTERN int ZEXPORT inflateEnd(z_streamp strm); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state + was inconsistent. +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2(z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy); + + This is another version of deflateInit with more compression options. The + fields zalloc, zfree and opaque must be initialized before by the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + For the current implementation of deflate(), a windowBits value of 8 (a + window size of 256 bytes) is not supported. As a result, a request for 8 + will result in 9 (a 512-byte window). In that case, providing 8 to + inflateInit2() will result in an error when the zlib header with 9 is + checked against the initialization of inflate(). The remedy is to not use 8 + with deflateInit2() with this initialization, or at least in that case use 9 + with inflateInit2(). + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute a check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to the appropriate value, + if the operating system was determined at compile time. If a gzip stream is + being written, strm->adler is a CRC-32 instead of an Adler-32. + + For raw deflate or gzip encoding, a request for a 256-byte window is + rejected as invalid, since only the zlib header provides a means of + transmitting the window size to the decompressor. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_RLE to limit match distances to one (run-length + encoding), or Z_HUFFMAN_ONLY to force Huffman encoding only (no string + matching). Filtered data consists mostly of small values with a somewhat + random distribution, as produced by the PNG filters. In this case, the + compression algorithm is tuned to compress them better. The effect of + Z_FILTERED is to force more Huffman coding and less string matching than the + default; it is intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. + Z_RLE is almost as fast as Z_HUFFMAN_ONLY, but should give better + compression for PNG image data than Huffman only. The degree of string + matching from most to none is: Z_DEFAULT_STRATEGY, Z_FILTERED, Z_RLE, then + Z_HUFFMAN_ONLY. The strategy parameter affects the compression ratio but + never the correctness of the compressed output, even if it is not set + optimally for the given data. Z_FIXED uses the default string matching, but + prevents the use of dynamic Huffman codes, allowing for a simpler decoder + for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the Adler-32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler-32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + Adler-32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); +/* + Returns the sliding dictionary being maintained by deflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If deflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similarly, if dictLength is Z_NULL, then it is not set. + + deflateGetDictionary() may return a length less than the window size, even + when more than the window size in input has been provided. It may return up + to 258 bytes less in that case, due to how zlib's implementation of deflate + manages the sliding window and lookahead for matches, where matches can be + up to 258 bytes long. If the application needs the last window-size bytes of + input, then that would need to be saved by the application outside of zlib. + + deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateCopy(z_streamp dest, + z_streamp source); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset(z_streamp strm); +/* + This function is equivalent to deflateEnd followed by deflateInit, but + does not free and reallocate the internal compression state. The stream + will leave the compression level and any other attributes that may have been + set unchanged. total_in, total_out, adler, and msg are initialized. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams(z_streamp strm, + int level, + int strategy); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2(). This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression approach (which is a function of the level) or the + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). + + If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does + not have enough output space to complete, then the parameter change will not + take effect. In this case, deflateParams() can be called again with the + same parameters and more output space to try again. + + In order to assure a change in the parameters on the first try, the + deflate stream should be flushed using deflate() with Z_BLOCK or other flush + request until strm.avail_out is not zero, before calling deflateParams(). + Then no more input data should be provided before the deflateParams() call. + If this is done, the old level and strategy will be applied to the data + compressed before deflateParams(), and the new level and strategy will be + applied to the data compressed after deflateParams(). + + deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream + state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if + there was not enough output space to complete the compression of the + available input data before a change in the strategy or approach. Note that + in the case of a Z_BUF_ERROR, the parameters are not changed. A return + value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be + retried with more output space. +*/ + +ZEXTERN int ZEXPORT deflateTune(z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen); +ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. + + delfateBound_z() is the same, but takes and returns a size_t length. Note + that a long is 32 bits on Windows. +*/ + +ZEXTERN int ZEXPORT deflatePending(z_streamp strm, + unsigned *pending, + int *bits); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. If an int is 16 bits and memLevel is 9, then + it is possible for the number of pending bytes to not fit in an unsigned. In + that case Z_BUF_ERROR is returned and *pending is set to the maximum value + of an unsigned. + */ + +ZEXTERN int ZEXPORT deflateUsed(z_streamp strm, + int *bits); +/* + deflateUsed() returns in *bits the most recent number of deflate bits used + in the last byte when flushing to a byte boundary. The result is in 1..8, or + 0 if there has not yet been a flush. This helps determine the location of + the last bit of a deflate stream. + + deflateUsed returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + +ZEXTERN int ZEXPORT deflatePrime(z_streamp strm, + int bits, + int value); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm, + gz_headerp head); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to the current operating system, with no + extra, name, or comment fields. The gzip header is returned to the default + state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2(z_streamp strm, + int windowBits); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an Adler-32 or a CRC-32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see + below), inflate() will *not* automatically decode concatenated gzip members. + inflate() will return Z_STREAM_END at the end of the gzip member. The state + would need to be reset to continue decoding a subsequent gzip member. This + *must* be done if there is more data after a gzip member, in order for the + decompression to be compliant with the gzip standard (RFC 1952). + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the Adler-32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect Adler-32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similarly, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateSync(z_streamp strm); +/* + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurrences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, + z_streamp source); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset(z_streamp strm); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + total_in, total_out, adler, and msg are initialized. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2(z_streamp strm, + int windowBits); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. If the window size is changed, then the + memory allocated for the window is freed, and the window will be reallocated + by inflate() if needed. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime(z_streamp strm, + int bits, + int value); +/* + This function inserts bits in the inflate input stream. The intent is to + use inflatePrime() to start inflating at a bit position in the middle of a + byte. The provided bits will be used before any bytes are used from + next_in. This function should be used with raw inflate, before the first + inflate() call, after inflateInit2() or inflateReset(). It can also be used + after an inflate() return indicates the end of a deflate block or header + when using Z_BLOCK. bits must be less than or equal to 16, and that many of + the least significant bits of value will be inserted in the input. The + other bits in value can be non-zero, and will be ignored. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent, or if bits is out of range. If inflate was + in the middle of processing a header, trailer, or stored block lengths, then + it is possible for there to be only eight bits available in the bit buffer. + In that case, bits > 8 is considered out of range. However, when used as + outlined above, there will always be 16 bits available in the buffer for + insertion. As noted in its documentation above, inflate records the number + of bits in the bit buffer on return in data_type. 32 minus that is the + number of bits available for insertion. inflatePrime does not update + data_type with the new number of bits in buffer. +*/ + +ZEXTERN long ZEXPORT inflateMark(z_streamp strm); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above, or -65536 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm, + gz_headerp head); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) The extra, name, and comment pointers + much each be either Z_NULL or point to space to store that information from + the header. If extra is not Z_NULL, then extra_max contains the maximum + number of bytes that can be written to extra. Once done is true, extra_len + contains the actual extra field length, and extra contains the extra field, + or that field truncated if extra_max is less than extra_len. If name is not + Z_NULL, then up to name_max characters, including the terminating zero, are + written there. If comment is not Z_NULL, then up to comm_max characters, + including the terminating zero, are written there. The application can tell + that the name or comment did not fit in the provided space by the absence of + a terminating zero. If any of extra, name, or comment are not present in + the header, then that field's pointer is set to Z_NULL. This allows the use + of deflateSetHeader() with the returned structure to duplicate the header. + Note that if those fields initially pointed to allocated memory, then the + application will need to save them elsewhere so that they can be eventually + freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits, + unsigned char FAR *window); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the parameters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func)(void FAR *, + z_const unsigned char FAR * FAR *); +typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned); + +ZEXTERN int ZEXPORT inflateBack(z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the default + behavior of inflate(), which expects a zlib header and trailer around the + deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero -- buf is ignored in that + case -- and inflateBack() will return a buffer error. inflateBack() will + call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. + out() should return zero on success, or non-zero on failure. If out() + returns non-zero, inflateBack() will return with an error. Neither in() nor + out() are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags(void); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: ZLIB_DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (all zeros is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() is not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + 27: 0 = gzprintf() present, 1 = not -- 1 means gzprintf() returns an error + + Remainder: + 28-31: 0 (reserved) + */ + +#ifndef Z_SOLO + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. The _z versions of the functions use the size_t + type for lengths. Note that a long is 32 bits on Windows. +*/ + +ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); +ZEXTERN int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. compress() is equivalent to compress2() with a level + parameter of Z_DEFAULT_COMPRESSION. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level); +ZEXTERN int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen, + int level); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen); +ZEXTERN z_size_t ZEXPORT compressBound_z(z_size_t sourceLen); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); +ZEXTERN int ZEXPORT uncompress_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. On entry, *destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) On exit, *destLen + is the actual size of the uncompressed data. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. +*/ + +ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong *sourceLen); +ZEXTERN int ZEXPORT uncompress2_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t *sourceLen); +/* + Same as uncompress, except that sourceLen is a pointer, where the + length of the source is *sourceLen. On return, *sourceLen is the number of + source bytes consumed. +*/ + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode); + + Open the gzip (.gz) file at path for reading and decompressing, or + compressing and writing. The mode parameter is as in fopen ("rb" or "wb") + but can also include a compression level ("wb9") or a strategy: 'f' for + filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", + 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression + as in "wb9F". (See the description of deflateInit2 for more information + about the strategy parameter.) 'T' will request transparent writing or + appending with no compression and not using the gzip format. 'T' cannot be + used to force transparent reading. Transparent reading is automatically + performed if there is no gzip header at the start. Transparent reading can + be disabled with the 'G' option, which will instead return an error if there + is no gzip header. 'N' will open the file in non-blocking mode. + + 'a' can be used instead of 'w' to request that the gzip stream that will + be written be appended to the file. '+' will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + 'x' when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of 'e' when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. Note that if 'N' is in mode for non-blocking, the + open() itself can fail in order to not block. In that case gzopen() will + return NULL and errno will be EAGAIN or ENONBLOCK. The call to gzopen() can + then be re-tried. If the application would like to block on opening the + file, then it can use open() without O_NONBLOCK, and then gzdopen() with the + resulting file descriptor and 'N' in the mode, which will set it to non- + blocking. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode); +/* + Associate a gzFile with the file descriptor fd. File descriptors are + obtained from calls like open, dup, creat, pipe or fileno (if the file has + been previously opened with fopen). The mode parameter is as in gzopen. An + 'e' in mode will set fd's flag to close the file on an execve() call. An 'N' + in mode will set fd's non-blocking flag. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size); +/* + Set the internal buffer size used by this library's functions for file to + size. The default buffer size is 8192 bytes. This function must be called + after gzopen() or gzdopen(), and before any other calls that read or write + the file. The buffer memory allocation is always deferred to the first read + or write. Three times that size in buffer space is allocated. A larger + buffer size of, for example, 64K or 128K bytes will noticeably increase the + speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy); +/* + Dynamically update the compression level and strategy for file. See the + description of deflateInit2 for the meaning of these parameters. Previously + provided data is flushed before applying the parameter changes. + + gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not + opened for writing, Z_ERRNO if there is an error writing the flushed data, + or Z_MEM_ERROR if there is a memory allocation error. +*/ + +ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len); +/* + Read and decompress up to len uncompressed bytes from file into buf. If + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. + + gzread can be used to read a gzip file on a non-blocking device. If the + input stalls and there is no uncompressed data to return, then gzread() will + return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be + called again. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. If len is too large to fit in an int, + then nothing is read, -1 is returned, and the error state is set to + Z_STREAM_ERROR. If some data was read before an error, then that data is + returned until exhausted, after which the next call will signal the error. +*/ + +ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, + gzFile file); +/* + Read and decompress up to nitems items of size size from file into buf, + otherwise operating as gzread() does. This duplicates the interface of + stdio's fread(), with size_t request and return types. If the library + defines size_t, then z_size_t is identical to size_t. If not, then z_size_t + is an unsigned integer type that can contain a pointer. + + gzfread() returns the number of full items read of size size, or zero if + the end of the file was reached and a full item could not be read, or if + there was an error. gzerror() must be consulted if zero is returned in + order to determine if there was an error. If the multiplication of size and + nitems overflows, i.e. the product does not fit in a z_size_t, then nothing + is read, zero is returned, and the error state is set to Z_STREAM_ERROR. + + In the event that the end of file is reached and only a partial item is + available at the end, i.e. the remaining uncompressed data length is not a + multiple of size, then the final partial item is nevertheless read into buf + and the end-of-file flag is set. The length of the partial item read is not + provided, but could be inferred from the result of gztell(). This behavior + is the same as that of fread() implementations in common libraries. This + could result in data loss if used with size != 1 when reading a concurrently + written file or a non-blocking file. In that case, use size == 1 or gzread() + instead. +*/ + +ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len); +/* + Compress and write the len uncompressed bytes at buf to file. gzwrite + returns the number of uncompressed bytes written, or 0 in case of error or + if len is 0. If the write destination is non-blocking, then gzwrite() may + return a number of bytes written that is not 0 and less than len. + + If len does not fit in an int, then 0 is returned and nothing is written. +*/ + +ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, + z_size_t nitems, gzFile file); +/* + Compress and write nitems items of size size from buf to file, duplicating + the interface of stdio's fwrite(), with size_t request and return types. If + the library defines size_t, then z_size_t is identical to size_t. If not, + then z_size_t is an unsigned integer type that can contain a pointer. + + gzfwrite() returns the number of full items written of size size, or zero + if there was an error. If the multiplication of size and nitems overflows, + i.e. the product does not fit in a z_size_t, then nothing is written, zero + is returned, and the error state is set to Z_STREAM_ERROR. + + If writing a concurrently read file or a non-blocking file with size != 1, + a partial item could be written, with no way of knowing how much of it was + not written, resulting in data loss. In that case, use size == 1 or + gzwrite() instead. +*/ + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...); +#else +ZEXTERN int ZEXPORTVA gzprintf(); +#endif +/* + Convert, format, compress, and write the arguments (...) to file under + control of the string format, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or a negative zlib error code in case + of error. The number of uncompressed bytes written is limited to 8191, or + one less than the buffer size given to gzbuffer(). The caller should assure + that this limit is not exceeded. If it is exceeded, then gzprintf() will + return an error (0) with nothing written. + + In that last case, there may also be a buffer overflow with unpredictable + consequences, which is possible only if zlib was compiled with the insecure + functions sprintf() or vsprintf(), because the secure snprintf() and + vsnprintf() functions were not available. That would only be the case for + a non-ANSI C compiler. zlib may have been built without gzprintf() because + secure functions were not available and having gzprintf() be insecure was + not an option, in which case, gzprintf() returns Z_STREAM_ERROR. All of + these possibilities can be determined using zlibCompileFlags(). + + If a Z_BUF_ERROR is returned, then nothing was written due to a stall on + the non-blocking write destination. +*/ + +ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s); +/* + Compress and write the given null-terminated string s to file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. + The number of characters written may be less than the length of the string + if the write destination is non-blocking. + + If the length of the string does not fit in an int, then -1 is returned + and nothing is written. +*/ + +ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len); +/* + Read and decompress bytes from file into buf, until len-1 characters are + read, or until a newline character is read and transferred to buf, or an + end-of-file condition is encountered. If any characters are read or if len + is one, the string is terminated with a null character. If no characters + are read due to an end-of-file or len is less than one, then the buffer is + left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If some data was read before an error, + then that data is returned until exhausted, after which the next call will + return NULL to signal the error. + + gzgets can be used on a file being concurrently written, and on a non- + blocking device, both as for gzread(). However lines may be broken in the + middle, leaving it up to the application to reassemble them as needed. +*/ + +ZEXTERN int ZEXPORT gzputc(gzFile file, int c); +/* + Compress and write c, converted to an unsigned char, into file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc(gzFile file); +/* + Read and decompress one byte from file. gzgetc returns this byte or -1 in + case of end of file or error. If some data was read before an error, then + that data is returned until exhausted, after which the next call will return + -1 to signal the error. + + This is implemented as a macro for speed. As such, it does not do all of + the checking the other functions do. I.e. it does not check to see if file + is NULL, nor whether the structure file points to has been clobbered or not. + + gzgetc can be used to read a gzip file on a non-blocking device. If the + input stalls and there is no uncompressed data to return, then gzgetc() will + return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be + called again. +*/ + +ZEXTERN int ZEXPORT gzungetc(int c, gzFile file); +/* + Push c back onto the stream for file to be read as the first character on + the next read. At least one character of push-back is always allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). + + gzungetc(-1, file) will force any pending seek to execute. Then gztell() + will report the position, even if the requested seek reached end of file. + This can be used to determine the number of uncompressed bytes in a gzip + file without having to read it into a buffer. +*/ + +ZEXTERN int ZEXPORT gzflush(gzFile file, int flush); +/* + Flush all pending output to file. The parameter flush is as in the + deflate() function. The return value is the zlib error number (see function + gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatenated gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek(gzFile file, + z_off_t offset, int whence); + + Set the starting position to offset relative to whence for the next gzread + or gzwrite on file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. For reading or writing, any actual seeking is deferred + until the next read or write operation, or close operation when writing. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind(gzFile file); +/* + Rewind file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET). +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell(gzFile file); + + Return the starting position for the next gzread or gzwrite on file. + This position represents a number of bytes in the uncompressed data stream, + and is zero when starting, even if appending or reading a gzip stream from + the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file); + + Return the current compressed (actual) read or write offset of file. This + offset includes the count of bytes that precede the gzip stream, for example + when appending or when using gzdopen() for reading. When reading, the + offset does not include as yet unused buffered input. This information can + be used for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof(gzFile file); +/* + Return true (1) if the end-of-file indicator for file has been set while + reading, false (0) otherwise. Note that the end-of-file indicator is set + only if the read tried to go past the end of the input, but came up short. + Therefore, just like feof(), gzeof() may return false even if there is no + more data to read, in the event that the last read request was for the exact + number of bytes remaining in the input file. This will happen if the input + file size is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect(gzFile file); +/* + Return true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). If the input is being written concurrently or the device is non- + blocking, then gzdirect() may give a different answer once four bytes of + input have been accumulated, which is what is needed to confirm or deny a + gzip header. Before this, gzdirect() will return true (1). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) +*/ + +ZEXTERN int ZEXPORT gzclose(gzFile file); +/* + Flush all pending output for file, if necessary, close file and + deallocate the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r(gzFile file); +ZEXTERN int ZEXPORT gzclose_w(gzFile file); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum); +/* + Return the error message for the last error which occurred on file. + If errnum is not NULL, *errnum is set to zlib error number. If an error + occurred in the file system and not in the compression library, *errnum is + set to Z_ERRNO and the application may consult errno to get the exact error + code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr(gzFile file); +/* + Clear the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + +#endif /* !Z_SOLO */ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. An Adler-32 value is in the range of a 32-bit + unsigned integer. If buf is Z_NULL, this function returns the required + initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, + z_size_t len); +/* + Same as adler32(), but with a size_t length. Note that a long is 32 bits + on Windows. +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, + z_off_t len2); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. +*/ + +ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. + If buf is Z_NULL, this function returns the required initial value for the + crc. Pre- and post-conditioning (one's complement) is performed within this + function so it shouldn't be done by the application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf, + z_size_t len); +/* + Same as crc32(), but with a size_t length. Note that a long is 32 bits on + Windows. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. len2 must be non-negative, otherwise zero is returned. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); + + Return the operator corresponding to length len2, to be used with + crc32_combine_op(). len2 must be non-negative, otherwise zero is returned. +*/ + +ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); +/* + Give the same result as crc32_combine(), using op in place of len2. op is + is generated from len2 by crc32_combine_gen(). This will be faster than + crc32_combine() if the generated op is used more than once. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateInit_(z_streamp strm, + const char *version, int stream_size); +ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size); +ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size); +#ifdef Z_PREFIX_SET +# define z_deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define z_inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#else +# define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#endif + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +struct gzFile_s { + unsigned have; + unsigned char *next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */ +#ifdef Z_PREFIX_SET +# undef z_gzgetc +# define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#else +# define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#endif + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#ifdef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int); + ZEXTERN z_off64_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# define z_crc32_combine_gen z_crc32_combine_gen64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# define crc32_combine_gen crc32_combine_gen64 +# endif +# ifndef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); +#endif + +#else /* Z_SOLO */ + + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); + +#endif /* !Z_SOLO */ + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError(int); +ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void); +ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int); +ZEXTERN int ZEXPORT inflateValidate(z_streamp, int); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp); +ZEXTERN int ZEXPORT inflateResetKeep(z_streamp); +ZEXTERN int ZEXPORT deflateResetKeep(z_streamp); +#if defined(_WIN32) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, + const char *mode); +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, + const char *format, + va_list va); +# endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/VCMP-LUA/modules/postgresql/lib/x86-windows-static/libcrypto.lib b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/libcrypto.lib new file mode 100644 index 0000000..34578d7 Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/libcrypto.lib differ diff --git a/VCMP-LUA/modules/postgresql/lib/x86-windows-static/libssl.lib b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/libssl.lib new file mode 100644 index 0000000..e598272 Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/libssl.lib differ diff --git a/VCMP-LUA/modules/postgresql/lib/x86-windows-static/pgcommon.lib b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/pgcommon.lib new file mode 100644 index 0000000..1a28b3c Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/pgcommon.lib differ diff --git a/VCMP-LUA/modules/postgresql/lib/x86-windows-static/pgport.lib b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/pgport.lib new file mode 100644 index 0000000..424ccfb Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/pgport.lib differ diff --git a/VCMP-LUA/modules/postgresql/lib/x86-windows-static/pq.lib b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/pq.lib new file mode 100644 index 0000000..f2683fa Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86-windows-static/pq.lib differ diff --git a/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/libcrypto.lib b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/libcrypto.lib new file mode 100644 index 0000000..a3d8201 Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/libcrypto.lib differ diff --git a/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/libssl.lib b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/libssl.lib new file mode 100644 index 0000000..a94f169 Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/libssl.lib differ diff --git a/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/pgcommon.lib b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/pgcommon.lib new file mode 100644 index 0000000..034982b Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/pgcommon.lib differ diff --git a/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/pgport.lib b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/pgport.lib new file mode 100644 index 0000000..2ff1c5a Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/pgport.lib differ diff --git a/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/pq.lib b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/pq.lib new file mode 100644 index 0000000..6d84260 Binary files /dev/null and b/VCMP-LUA/modules/postgresql/lib/x86_64-windows-static/pq.lib differ diff --git a/VCMP-LUA/modules/postgresql/premake5.lua b/VCMP-LUA/modules/postgresql/premake5.lua new file mode 100644 index 0000000..4685ea1 --- /dev/null +++ b/VCMP-LUA/modules/postgresql/premake5.lua @@ -0,0 +1,43 @@ +project "PostgreSQL" + kind "StaticLib" + language "C++" + cppdialect "C++17" + staticruntime "on" + + targetname "libpq" + targetextension ".lib" + targetdir "../../bin/%{cfg.buildcfg}" + objdir "../../bin/interm/%{cfg.buildcfg}/PostgreSQL" + + defines { "PG_USE_STATIC" } + + files { + "src/**.cpp", + "src/**.h", + "*.cpp", + "*.h" + } + + includedirs { + "include", + "include/internal", + "../../include" + } + + filter "system:windows" + libdirs { "modules/postgresql/lib/%{cfg.architecture}-windows-static" } + links { "libpq" } + + filter "configurations:Debug" + runtime "Debug" + symbols "on" + + filter "configurations:Release" + runtime "Release" + optimize "on" + + filter { "system:windows", "configurations:Release*" } + local ok = pcall(function() linktimeoptimization "On" end) + if not ok then + flags { "LinkTimeOptimization" } + end \ No newline at end of file diff --git a/VCMP-LUA/modules/requests/Makefile b/VCMP-LUA/modules/requests/Makefile deleted file mode 100644 index 1a388d3..0000000 --- a/VCMP-LUA/modules/requests/Makefile +++ /dev/null @@ -1,194 +0,0 @@ -# GNU Make project makefile autogenerated by Premake - -ifndef config - config=release32 -endif - -ifndef verbose - SILENT = @ -endif - -.PHONY: clean prebuild prelink - -ifeq ($(config),release32) - RESCOMP = windres - TARGETDIR = ../../../bin/Release32-windows-x86/module-cpr - TARGET = $(TARGETDIR)/module-cpr_x86.lib - OBJDIR = ../../../bin/interm/Release32-windows-x86/module-cpr - DEFINES += -D_x32 -DCURL_STATICLIB - INCLUDES += -Icpr/include - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += -lcpr.lib -lmongoose.lib -llibcurl.lib - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -Lcpr/lib -L/usr/lib32 -m32 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -ifeq ($(config),release) - RESCOMP = windres - TARGETDIR = ../../../bin/Release-windows-x86_64/module-cpr - TARGET = $(TARGETDIR)/module-cpr_x64.lib - OBJDIR = ../../../bin/interm/Release-windows-x86_64/module-cpr - DEFINES += -DCURL_STATICLIB - INCLUDES += -Icpr/include - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += -lcpr.lib -lmongoose.lib -llibcurl.lib - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -Lcpr/lib -L/usr/lib64 -m64 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -OBJECTS := \ - $(OBJDIR)/auth.o \ - $(OBJDIR)/bearer.o \ - $(OBJDIR)/cookies.o \ - $(OBJDIR)/cprtypes.o \ - $(OBJDIR)/curl_container.o \ - $(OBJDIR)/curlholder.o \ - $(OBJDIR)/error.o \ - $(OBJDIR)/multipart.o \ - $(OBJDIR)/parameters.o \ - $(OBJDIR)/payload.o \ - $(OBJDIR)/proxies.o \ - $(OBJDIR)/response.o \ - $(OBJDIR)/session.o \ - $(OBJDIR)/timeout.o \ - $(OBJDIR)/unix_socket.o \ - $(OBJDIR)/util.o \ - -RESOURCES := \ - -CUSTOMFILES := \ - -SHELLTYPE := posix -ifeq (.exe,$(findstring .exe,$(ComSpec))) - SHELLTYPE := msdos -endif - -$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR) - @echo Linking module-cpr - $(SILENT) $(LINKCMD) - $(POSTBUILDCMDS) - -$(CUSTOMFILES): | $(OBJDIR) - -$(TARGETDIR): - @echo Creating $(TARGETDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(TARGETDIR) -else - $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) -endif - -$(OBJDIR): - @echo Creating $(OBJDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(OBJDIR) -else - $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) -endif - -clean: - @echo Cleaning module-cpr -ifeq (posix,$(SHELLTYPE)) - $(SILENT) rm -f $(TARGET) - $(SILENT) rm -rf $(OBJDIR) -else - $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) - $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) -endif - -prebuild: - $(PREBUILDCMDS) - -prelink: - $(PRELINKCMDS) - -ifneq (,$(PCH)) -$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) -$(GCH): $(PCH) | $(OBJDIR) - @echo $(notdir $<) - $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" -else -$(OBJECTS): | $(OBJDIR) -endif - -$(OBJDIR)/auth.o: cpr/src/auth.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/bearer.o: cpr/src/bearer.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/cookies.o: cpr/src/cookies.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/cprtypes.o: cpr/src/cprtypes.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/curl_container.o: cpr/src/curl_container.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/curlholder.o: cpr/src/curlholder.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/error.o: cpr/src/error.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/multipart.o: cpr/src/multipart.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/parameters.o: cpr/src/parameters.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/payload.o: cpr/src/payload.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/proxies.o: cpr/src/proxies.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/response.o: cpr/src/response.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/session.o: cpr/src/session.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/timeout.o: cpr/src/timeout.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/unix_socket.o: cpr/src/unix_socket.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/util.o: cpr/src/util.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" - --include $(OBJECTS:%.o=%.d) -ifneq (,$(PCH)) - -include $(OBJDIR)/$(notdir $(PCH)).d -endif \ No newline at end of file diff --git a/VCMP-LUA/modules/requests/cpr/include/zconf.h b/VCMP-LUA/modules/requests/cpr/include/zconf.h new file mode 100644 index 0000000..d814fc5 --- /dev/null +++ b/VCMP-LUA/modules/requests/cpr/include/zconf.h @@ -0,0 +1,555 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* #undef Z_PREFIX */ +#define HAVE_STDARG_H 1 +/* #undef HAVE_UNISTD_H */ + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET + +/* all linked symbols and init macros */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compress_z z_compress_z +# define compress2_z z_compress2_z +# define compressBound z_compressBound +# define compressBound_z z_compressBound_z +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op +# define crc32_z z_crc32_z +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateBound_z z_deflateBound_z +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflateUsed z_deflateUsed +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary +# define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateValidate z_inflateValidate +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# define inflate_fixed z_inflate_fixed +# ifndef Z_SOLO +# define uncompress z_uncompress +# define uncompress2 z_uncompress2 +# define uncompress_z z_uncompress_z +# define uncompress2_z z_uncompress2_z +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +#ifndef z_const +# ifdef ZLIB_CONST +# define z_const const +# else +# define z_const +# endif +#endif + +#ifdef Z_SOLO +# ifdef _WIN64 + typedef unsigned long long z_size_t; +# else + typedef unsigned long z_size_t; +# endif +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# if 0 +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# if 0 +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#if HAVE_UNISTD_H-0 /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#if HAVE_STDARG_H-0 /* may be set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include /* for off_t */ +# endif +#endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + +#ifdef _WIN32 +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#ifndef Z_HAVE_UNISTD_H +# if defined(__WATCOMC__) || defined(__GO32__) || \ + (defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)) +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +# endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +# define z_off64_t off64_t +#elif defined(__MINGW32__) +# define z_off64_t long long +#elif defined(_WIN32) && !defined(__GNUC__) +# define z_off64_t __int64 +#elif defined(__GO32__) +# define z_off64_t offset_t +#else +# define z_off64_t z_off_t +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/VCMP-LUA/modules/requests/cpr/include/zlib.h b/VCMP-LUA/modules/requests/cpr/include/zlib.h new file mode 100644 index 0000000..a57d336 --- /dev/null +++ b/VCMP-LUA/modules/requests/cpr/include/zlib.h @@ -0,0 +1,2057 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.3.2, February 17th, 2026 + + Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 at https://datatracker.ietf.org/doc/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#ifdef ZLIB_BUILD +# include +#else +# include "zconf.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.3.2" +#define ZLIB_VERNUM 0x1320 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 3 +#define ZLIB_VER_REVISION 2 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip and raw deflate streams in + memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in the case of corrupted input. +*/ + +typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size); +typedef void (*free_func)(voidpf opaque, voidpf address); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total number of input bytes read so far */ + + Bytef *next_out; /* next output byte will go here */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total number of bytes output so far */ + + z_const char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text + for deflate, or the decoding state for inflate */ + uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. In that case, zlib is thread-safe. When zalloc and zfree are + Z_NULL on entry to the initialization function, they are set to internal + routines that use the standard library functions malloc() and free(). + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use by the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field for deflate() */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion(void); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. total_in, total_out, adler, and msg are initialized. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary. Some output may be provided even if + flush is zero. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. See deflatePending(), + which can be used if desired to determine whether or not there is more output + in that case. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed + codes block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six when the flush marker begins, in order to avoid + repeated flush markers upon calling deflate() again when avail_out == 0. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this + function must be called again with Z_FINISH and more output space (updated + avail_out) but no more input data, until it returns with Z_STREAM_END or an + error. After deflate has returned Z_STREAM_END, the only possible operations + on the stream are deflateReset or deflateEnd. + + Z_FINISH can be used in the first deflate call after deflateInit if all the + compression is to be done in a single step. In order to complete in one + call, avail_out must be at least the value returned by deflateBound (see + below). Then deflate is guaranteed to return Z_STREAM_END. If not enough + output space is provided, deflate will not return Z_STREAM_END, and it must + be called again as described above. + + deflate() sets strm->adler to the Adler-32 checksum of all input read + so far (that is, total_in bytes). If a gzip stream is being generated, then + strm->adler will be the CRC-32 checksum of the input read so far. (See + deflateInit2 below.) + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is + considered binary. This field is only for information purposes and does not + affect the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL or the state was inadvertently written over + by the application), or Z_BUF_ERROR if no progress is possible (for example + avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and + deflate() can be called again with more input and more output space to + continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd(z_streamp strm); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit(z_streamp strm); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. In the current version of inflate, the provided input is not + read or consumed. The allocation of a sliding window will be deferred to + the first call of inflate (if the decompression does not complete on the + first call). If zalloc and zfree are set to Z_NULL, inflateInit updates + them to use default allocation functions. total_in, total_out, adler, and + msg are initialized. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression. + Actual decompression will be done by inflate(). So next_in, and avail_in, + next_out, and avail_out are unused and unchanged. The current + implementation of inflateInit() does not process any header information -- + that is deferred until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), then next_in and avail_in are updated + accordingly, and processing will resume at this point for the next call of + inflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. If the + caller of inflate() does not provide both available input and available + output space, it is possible that there will be no progress made. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + To assist in this, on return inflate() always sets strm->data_type to the + number of unused bits in the input taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed Adler-32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained unless inflateGetHeader() is used. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + produced so far. The CRC-32 is checked against the gzip trailer, as is the + uncompressed length, modulo 2^32. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value, in which case strm->msg points to a string with a more specific + error), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL, or the state was inadvertently written over + by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR + if no progress was possible or if there was not enough room in the output + buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is to be attempted. +*/ + + +ZEXTERN int ZEXPORT inflateEnd(z_streamp strm); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state + was inconsistent. +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2(z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy); + + This is another version of deflateInit with more compression options. The + fields zalloc, zfree and opaque must be initialized before by the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + For the current implementation of deflate(), a windowBits value of 8 (a + window size of 256 bytes) is not supported. As a result, a request for 8 + will result in 9 (a 512-byte window). In that case, providing 8 to + inflateInit2() will result in an error when the zlib header with 9 is + checked against the initialization of inflate(). The remedy is to not use 8 + with deflateInit2() with this initialization, or at least in that case use 9 + with inflateInit2(). + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute a check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to the appropriate value, + if the operating system was determined at compile time. If a gzip stream is + being written, strm->adler is a CRC-32 instead of an Adler-32. + + For raw deflate or gzip encoding, a request for a 256-byte window is + rejected as invalid, since only the zlib header provides a means of + transmitting the window size to the decompressor. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_RLE to limit match distances to one (run-length + encoding), or Z_HUFFMAN_ONLY to force Huffman encoding only (no string + matching). Filtered data consists mostly of small values with a somewhat + random distribution, as produced by the PNG filters. In this case, the + compression algorithm is tuned to compress them better. The effect of + Z_FILTERED is to force more Huffman coding and less string matching than the + default; it is intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. + Z_RLE is almost as fast as Z_HUFFMAN_ONLY, but should give better + compression for PNG image data than Huffman only. The degree of string + matching from most to none is: Z_DEFAULT_STRATEGY, Z_FILTERED, Z_RLE, then + Z_HUFFMAN_ONLY. The strategy parameter affects the compression ratio but + never the correctness of the compressed output, even if it is not set + optimally for the given data. Z_FIXED uses the default string matching, but + prevents the use of dynamic Huffman codes, allowing for a simpler decoder + for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the Adler-32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler-32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + Adler-32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); +/* + Returns the sliding dictionary being maintained by deflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If deflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similarly, if dictLength is Z_NULL, then it is not set. + + deflateGetDictionary() may return a length less than the window size, even + when more than the window size in input has been provided. It may return up + to 258 bytes less in that case, due to how zlib's implementation of deflate + manages the sliding window and lookahead for matches, where matches can be + up to 258 bytes long. If the application needs the last window-size bytes of + input, then that would need to be saved by the application outside of zlib. + + deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateCopy(z_streamp dest, + z_streamp source); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset(z_streamp strm); +/* + This function is equivalent to deflateEnd followed by deflateInit, but + does not free and reallocate the internal compression state. The stream + will leave the compression level and any other attributes that may have been + set unchanged. total_in, total_out, adler, and msg are initialized. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams(z_streamp strm, + int level, + int strategy); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2(). This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression approach (which is a function of the level) or the + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). + + If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does + not have enough output space to complete, then the parameter change will not + take effect. In this case, deflateParams() can be called again with the + same parameters and more output space to try again. + + In order to assure a change in the parameters on the first try, the + deflate stream should be flushed using deflate() with Z_BLOCK or other flush + request until strm.avail_out is not zero, before calling deflateParams(). + Then no more input data should be provided before the deflateParams() call. + If this is done, the old level and strategy will be applied to the data + compressed before deflateParams(), and the new level and strategy will be + applied to the data compressed after deflateParams(). + + deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream + state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if + there was not enough output space to complete the compression of the + available input data before a change in the strategy or approach. Note that + in the case of a Z_BUF_ERROR, the parameters are not changed. A return + value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be + retried with more output space. +*/ + +ZEXTERN int ZEXPORT deflateTune(z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen); +ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. + + delfateBound_z() is the same, but takes and returns a size_t length. Note + that a long is 32 bits on Windows. +*/ + +ZEXTERN int ZEXPORT deflatePending(z_streamp strm, + unsigned *pending, + int *bits); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. If an int is 16 bits and memLevel is 9, then + it is possible for the number of pending bytes to not fit in an unsigned. In + that case Z_BUF_ERROR is returned and *pending is set to the maximum value + of an unsigned. + */ + +ZEXTERN int ZEXPORT deflateUsed(z_streamp strm, + int *bits); +/* + deflateUsed() returns in *bits the most recent number of deflate bits used + in the last byte when flushing to a byte boundary. The result is in 1..8, or + 0 if there has not yet been a flush. This helps determine the location of + the last bit of a deflate stream. + + deflateUsed returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + +ZEXTERN int ZEXPORT deflatePrime(z_streamp strm, + int bits, + int value); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm, + gz_headerp head); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to the current operating system, with no + extra, name, or comment fields. The gzip header is returned to the default + state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2(z_streamp strm, + int windowBits); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an Adler-32 or a CRC-32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see + below), inflate() will *not* automatically decode concatenated gzip members. + inflate() will return Z_STREAM_END at the end of the gzip member. The state + would need to be reset to continue decoding a subsequent gzip member. This + *must* be done if there is more data after a gzip member, in order for the + decompression to be compliant with the gzip standard (RFC 1952). + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the Adler-32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect Adler-32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similarly, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateSync(z_streamp strm); +/* + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurrences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, + z_streamp source); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset(z_streamp strm); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + total_in, total_out, adler, and msg are initialized. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2(z_streamp strm, + int windowBits); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. If the window size is changed, then the + memory allocated for the window is freed, and the window will be reallocated + by inflate() if needed. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime(z_streamp strm, + int bits, + int value); +/* + This function inserts bits in the inflate input stream. The intent is to + use inflatePrime() to start inflating at a bit position in the middle of a + byte. The provided bits will be used before any bytes are used from + next_in. This function should be used with raw inflate, before the first + inflate() call, after inflateInit2() or inflateReset(). It can also be used + after an inflate() return indicates the end of a deflate block or header + when using Z_BLOCK. bits must be less than or equal to 16, and that many of + the least significant bits of value will be inserted in the input. The + other bits in value can be non-zero, and will be ignored. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent, or if bits is out of range. If inflate was + in the middle of processing a header, trailer, or stored block lengths, then + it is possible for there to be only eight bits available in the bit buffer. + In that case, bits > 8 is considered out of range. However, when used as + outlined above, there will always be 16 bits available in the buffer for + insertion. As noted in its documentation above, inflate records the number + of bits in the bit buffer on return in data_type. 32 minus that is the + number of bits available for insertion. inflatePrime does not update + data_type with the new number of bits in buffer. +*/ + +ZEXTERN long ZEXPORT inflateMark(z_streamp strm); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above, or -65536 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm, + gz_headerp head); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) The extra, name, and comment pointers + much each be either Z_NULL or point to space to store that information from + the header. If extra is not Z_NULL, then extra_max contains the maximum + number of bytes that can be written to extra. Once done is true, extra_len + contains the actual extra field length, and extra contains the extra field, + or that field truncated if extra_max is less than extra_len. If name is not + Z_NULL, then up to name_max characters, including the terminating zero, are + written there. If comment is not Z_NULL, then up to comm_max characters, + including the terminating zero, are written there. The application can tell + that the name or comment did not fit in the provided space by the absence of + a terminating zero. If any of extra, name, or comment are not present in + the header, then that field's pointer is set to Z_NULL. This allows the use + of deflateSetHeader() with the returned structure to duplicate the header. + Note that if those fields initially pointed to allocated memory, then the + application will need to save them elsewhere so that they can be eventually + freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits, + unsigned char FAR *window); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the parameters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func)(void FAR *, + z_const unsigned char FAR * FAR *); +typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned); + +ZEXTERN int ZEXPORT inflateBack(z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the default + behavior of inflate(), which expects a zlib header and trailer around the + deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero -- buf is ignored in that + case -- and inflateBack() will return a buffer error. inflateBack() will + call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. + out() should return zero on success, or non-zero on failure. If out() + returns non-zero, inflateBack() will return with an error. Neither in() nor + out() are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags(void); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: ZLIB_DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (all zeros is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() is not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + 27: 0 = gzprintf() present, 1 = not -- 1 means gzprintf() returns an error + + Remainder: + 28-31: 0 (reserved) + */ + +#ifndef Z_SOLO + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. The _z versions of the functions use the size_t + type for lengths. Note that a long is 32 bits on Windows. +*/ + +ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); +ZEXTERN int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. compress() is equivalent to compress2() with a level + parameter of Z_DEFAULT_COMPRESSION. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level); +ZEXTERN int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen, + int level); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen); +ZEXTERN z_size_t ZEXPORT compressBound_z(z_size_t sourceLen); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); +ZEXTERN int ZEXPORT uncompress_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. On entry, *destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) On exit, *destLen + is the actual size of the uncompressed data. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. +*/ + +ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong *sourceLen); +ZEXTERN int ZEXPORT uncompress2_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t *sourceLen); +/* + Same as uncompress, except that sourceLen is a pointer, where the + length of the source is *sourceLen. On return, *sourceLen is the number of + source bytes consumed. +*/ + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode); + + Open the gzip (.gz) file at path for reading and decompressing, or + compressing and writing. The mode parameter is as in fopen ("rb" or "wb") + but can also include a compression level ("wb9") or a strategy: 'f' for + filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", + 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression + as in "wb9F". (See the description of deflateInit2 for more information + about the strategy parameter.) 'T' will request transparent writing or + appending with no compression and not using the gzip format. 'T' cannot be + used to force transparent reading. Transparent reading is automatically + performed if there is no gzip header at the start. Transparent reading can + be disabled with the 'G' option, which will instead return an error if there + is no gzip header. 'N' will open the file in non-blocking mode. + + 'a' can be used instead of 'w' to request that the gzip stream that will + be written be appended to the file. '+' will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + 'x' when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of 'e' when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. Note that if 'N' is in mode for non-blocking, the + open() itself can fail in order to not block. In that case gzopen() will + return NULL and errno will be EAGAIN or ENONBLOCK. The call to gzopen() can + then be re-tried. If the application would like to block on opening the + file, then it can use open() without O_NONBLOCK, and then gzdopen() with the + resulting file descriptor and 'N' in the mode, which will set it to non- + blocking. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode); +/* + Associate a gzFile with the file descriptor fd. File descriptors are + obtained from calls like open, dup, creat, pipe or fileno (if the file has + been previously opened with fopen). The mode parameter is as in gzopen. An + 'e' in mode will set fd's flag to close the file on an execve() call. An 'N' + in mode will set fd's non-blocking flag. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size); +/* + Set the internal buffer size used by this library's functions for file to + size. The default buffer size is 8192 bytes. This function must be called + after gzopen() or gzdopen(), and before any other calls that read or write + the file. The buffer memory allocation is always deferred to the first read + or write. Three times that size in buffer space is allocated. A larger + buffer size of, for example, 64K or 128K bytes will noticeably increase the + speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy); +/* + Dynamically update the compression level and strategy for file. See the + description of deflateInit2 for the meaning of these parameters. Previously + provided data is flushed before applying the parameter changes. + + gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not + opened for writing, Z_ERRNO if there is an error writing the flushed data, + or Z_MEM_ERROR if there is a memory allocation error. +*/ + +ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len); +/* + Read and decompress up to len uncompressed bytes from file into buf. If + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. + + gzread can be used to read a gzip file on a non-blocking device. If the + input stalls and there is no uncompressed data to return, then gzread() will + return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be + called again. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. If len is too large to fit in an int, + then nothing is read, -1 is returned, and the error state is set to + Z_STREAM_ERROR. If some data was read before an error, then that data is + returned until exhausted, after which the next call will signal the error. +*/ + +ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, + gzFile file); +/* + Read and decompress up to nitems items of size size from file into buf, + otherwise operating as gzread() does. This duplicates the interface of + stdio's fread(), with size_t request and return types. If the library + defines size_t, then z_size_t is identical to size_t. If not, then z_size_t + is an unsigned integer type that can contain a pointer. + + gzfread() returns the number of full items read of size size, or zero if + the end of the file was reached and a full item could not be read, or if + there was an error. gzerror() must be consulted if zero is returned in + order to determine if there was an error. If the multiplication of size and + nitems overflows, i.e. the product does not fit in a z_size_t, then nothing + is read, zero is returned, and the error state is set to Z_STREAM_ERROR. + + In the event that the end of file is reached and only a partial item is + available at the end, i.e. the remaining uncompressed data length is not a + multiple of size, then the final partial item is nevertheless read into buf + and the end-of-file flag is set. The length of the partial item read is not + provided, but could be inferred from the result of gztell(). This behavior + is the same as that of fread() implementations in common libraries. This + could result in data loss if used with size != 1 when reading a concurrently + written file or a non-blocking file. In that case, use size == 1 or gzread() + instead. +*/ + +ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len); +/* + Compress and write the len uncompressed bytes at buf to file. gzwrite + returns the number of uncompressed bytes written, or 0 in case of error or + if len is 0. If the write destination is non-blocking, then gzwrite() may + return a number of bytes written that is not 0 and less than len. + + If len does not fit in an int, then 0 is returned and nothing is written. +*/ + +ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, + z_size_t nitems, gzFile file); +/* + Compress and write nitems items of size size from buf to file, duplicating + the interface of stdio's fwrite(), with size_t request and return types. If + the library defines size_t, then z_size_t is identical to size_t. If not, + then z_size_t is an unsigned integer type that can contain a pointer. + + gzfwrite() returns the number of full items written of size size, or zero + if there was an error. If the multiplication of size and nitems overflows, + i.e. the product does not fit in a z_size_t, then nothing is written, zero + is returned, and the error state is set to Z_STREAM_ERROR. + + If writing a concurrently read file or a non-blocking file with size != 1, + a partial item could be written, with no way of knowing how much of it was + not written, resulting in data loss. In that case, use size == 1 or + gzwrite() instead. +*/ + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...); +#else +ZEXTERN int ZEXPORTVA gzprintf(); +#endif +/* + Convert, format, compress, and write the arguments (...) to file under + control of the string format, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or a negative zlib error code in case + of error. The number of uncompressed bytes written is limited to 8191, or + one less than the buffer size given to gzbuffer(). The caller should assure + that this limit is not exceeded. If it is exceeded, then gzprintf() will + return an error (0) with nothing written. + + In that last case, there may also be a buffer overflow with unpredictable + consequences, which is possible only if zlib was compiled with the insecure + functions sprintf() or vsprintf(), because the secure snprintf() and + vsnprintf() functions were not available. That would only be the case for + a non-ANSI C compiler. zlib may have been built without gzprintf() because + secure functions were not available and having gzprintf() be insecure was + not an option, in which case, gzprintf() returns Z_STREAM_ERROR. All of + these possibilities can be determined using zlibCompileFlags(). + + If a Z_BUF_ERROR is returned, then nothing was written due to a stall on + the non-blocking write destination. +*/ + +ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s); +/* + Compress and write the given null-terminated string s to file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. + The number of characters written may be less than the length of the string + if the write destination is non-blocking. + + If the length of the string does not fit in an int, then -1 is returned + and nothing is written. +*/ + +ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len); +/* + Read and decompress bytes from file into buf, until len-1 characters are + read, or until a newline character is read and transferred to buf, or an + end-of-file condition is encountered. If any characters are read or if len + is one, the string is terminated with a null character. If no characters + are read due to an end-of-file or len is less than one, then the buffer is + left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If some data was read before an error, + then that data is returned until exhausted, after which the next call will + return NULL to signal the error. + + gzgets can be used on a file being concurrently written, and on a non- + blocking device, both as for gzread(). However lines may be broken in the + middle, leaving it up to the application to reassemble them as needed. +*/ + +ZEXTERN int ZEXPORT gzputc(gzFile file, int c); +/* + Compress and write c, converted to an unsigned char, into file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc(gzFile file); +/* + Read and decompress one byte from file. gzgetc returns this byte or -1 in + case of end of file or error. If some data was read before an error, then + that data is returned until exhausted, after which the next call will return + -1 to signal the error. + + This is implemented as a macro for speed. As such, it does not do all of + the checking the other functions do. I.e. it does not check to see if file + is NULL, nor whether the structure file points to has been clobbered or not. + + gzgetc can be used to read a gzip file on a non-blocking device. If the + input stalls and there is no uncompressed data to return, then gzgetc() will + return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be + called again. +*/ + +ZEXTERN int ZEXPORT gzungetc(int c, gzFile file); +/* + Push c back onto the stream for file to be read as the first character on + the next read. At least one character of push-back is always allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). + + gzungetc(-1, file) will force any pending seek to execute. Then gztell() + will report the position, even if the requested seek reached end of file. + This can be used to determine the number of uncompressed bytes in a gzip + file without having to read it into a buffer. +*/ + +ZEXTERN int ZEXPORT gzflush(gzFile file, int flush); +/* + Flush all pending output to file. The parameter flush is as in the + deflate() function. The return value is the zlib error number (see function + gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatenated gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek(gzFile file, + z_off_t offset, int whence); + + Set the starting position to offset relative to whence for the next gzread + or gzwrite on file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. For reading or writing, any actual seeking is deferred + until the next read or write operation, or close operation when writing. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind(gzFile file); +/* + Rewind file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET). +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell(gzFile file); + + Return the starting position for the next gzread or gzwrite on file. + This position represents a number of bytes in the uncompressed data stream, + and is zero when starting, even if appending or reading a gzip stream from + the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file); + + Return the current compressed (actual) read or write offset of file. This + offset includes the count of bytes that precede the gzip stream, for example + when appending or when using gzdopen() for reading. When reading, the + offset does not include as yet unused buffered input. This information can + be used for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof(gzFile file); +/* + Return true (1) if the end-of-file indicator for file has been set while + reading, false (0) otherwise. Note that the end-of-file indicator is set + only if the read tried to go past the end of the input, but came up short. + Therefore, just like feof(), gzeof() may return false even if there is no + more data to read, in the event that the last read request was for the exact + number of bytes remaining in the input file. This will happen if the input + file size is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect(gzFile file); +/* + Return true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). If the input is being written concurrently or the device is non- + blocking, then gzdirect() may give a different answer once four bytes of + input have been accumulated, which is what is needed to confirm or deny a + gzip header. Before this, gzdirect() will return true (1). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) +*/ + +ZEXTERN int ZEXPORT gzclose(gzFile file); +/* + Flush all pending output for file, if necessary, close file and + deallocate the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r(gzFile file); +ZEXTERN int ZEXPORT gzclose_w(gzFile file); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum); +/* + Return the error message for the last error which occurred on file. + If errnum is not NULL, *errnum is set to zlib error number. If an error + occurred in the file system and not in the compression library, *errnum is + set to Z_ERRNO and the application may consult errno to get the exact error + code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr(gzFile file); +/* + Clear the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + +#endif /* !Z_SOLO */ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. An Adler-32 value is in the range of a 32-bit + unsigned integer. If buf is Z_NULL, this function returns the required + initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, + z_size_t len); +/* + Same as adler32(), but with a size_t length. Note that a long is 32 bits + on Windows. +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, + z_off_t len2); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. +*/ + +ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. + If buf is Z_NULL, this function returns the required initial value for the + crc. Pre- and post-conditioning (one's complement) is performed within this + function so it shouldn't be done by the application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf, + z_size_t len); +/* + Same as crc32(), but with a size_t length. Note that a long is 32 bits on + Windows. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. len2 must be non-negative, otherwise zero is returned. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); + + Return the operator corresponding to length len2, to be used with + crc32_combine_op(). len2 must be non-negative, otherwise zero is returned. +*/ + +ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); +/* + Give the same result as crc32_combine(), using op in place of len2. op is + is generated from len2 by crc32_combine_gen(). This will be faster than + crc32_combine() if the generated op is used more than once. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateInit_(z_streamp strm, + const char *version, int stream_size); +ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size); +ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size); +#ifdef Z_PREFIX_SET +# define z_deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define z_inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#else +# define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#endif + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +struct gzFile_s { + unsigned have; + unsigned char *next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */ +#ifdef Z_PREFIX_SET +# undef z_gzgetc +# define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#else +# define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#endif + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#ifdef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int); + ZEXTERN z_off64_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# define z_crc32_combine_gen z_crc32_combine_gen64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# define crc32_combine_gen crc32_combine_gen64 +# endif +# ifndef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); +#endif + +#else /* Z_SOLO */ + + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); + +#endif /* !Z_SOLO */ + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError(int); +ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void); +ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int); +ZEXTERN int ZEXPORT inflateValidate(z_streamp, int); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp); +ZEXTERN int ZEXPORT inflateResetKeep(z_streamp); +ZEXTERN int ZEXPORT deflateResetKeep(z_streamp); +#if defined(_WIN32) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, + const char *mode); +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, + const char *format, + va_list va); +# endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/VCMP-LUA/modules/requests/cpr/lib/cpr.lib b/VCMP-LUA/modules/requests/cpr/lib/cpr.lib deleted file mode 100644 index bae06ba..0000000 Binary files a/VCMP-LUA/modules/requests/cpr/lib/cpr.lib and /dev/null differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/gmock.lib b/VCMP-LUA/modules/requests/cpr/lib/gmock.lib deleted file mode 100644 index 7c9efd0..0000000 Binary files a/VCMP-LUA/modules/requests/cpr/lib/gmock.lib and /dev/null differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/gmock_main.lib b/VCMP-LUA/modules/requests/cpr/lib/gmock_main.lib deleted file mode 100644 index 7655ae6..0000000 Binary files a/VCMP-LUA/modules/requests/cpr/lib/gmock_main.lib and /dev/null differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/gtest.lib b/VCMP-LUA/modules/requests/cpr/lib/gtest.lib deleted file mode 100644 index fbf99ba..0000000 Binary files a/VCMP-LUA/modules/requests/cpr/lib/gtest.lib and /dev/null differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/gtest_main.lib b/VCMP-LUA/modules/requests/cpr/lib/gtest_main.lib deleted file mode 100644 index 8cb29c9..0000000 Binary files a/VCMP-LUA/modules/requests/cpr/lib/gtest_main.lib and /dev/null differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/libcurl.lib b/VCMP-LUA/modules/requests/cpr/lib/libcurl.lib deleted file mode 100644 index f87dace..0000000 Binary files a/VCMP-LUA/modules/requests/cpr/lib/libcurl.lib and /dev/null differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/test_server.lib b/VCMP-LUA/modules/requests/cpr/lib/test_server.lib deleted file mode 100644 index bc32e1d..0000000 Binary files a/VCMP-LUA/modules/requests/cpr/lib/test_server.lib and /dev/null differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/cpr.lib b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/cpr.lib new file mode 100644 index 0000000..5163115 Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/cpr.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/libcrypto.lib b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/libcrypto.lib new file mode 100644 index 0000000..34578d7 Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/libcrypto.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/libcurl.lib b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/libcurl.lib new file mode 100644 index 0000000..b26ab94 Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/libcurl.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/libssl.lib b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/libssl.lib new file mode 100644 index 0000000..e598272 Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/libssl.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/mongoose.lib b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/mongoose.lib new file mode 100644 index 0000000..a014218 Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/mongoose.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/zs.lib b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/zs.lib new file mode 100644 index 0000000..bc9bf53 Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86-windows-static/zs.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/cpr.lib b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/cpr.lib new file mode 100644 index 0000000..ba98ccf Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/cpr.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/libcrypto.lib b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/libcrypto.lib new file mode 100644 index 0000000..b11528c Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/libcrypto.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/libcurl.lib b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/libcurl.lib new file mode 100644 index 0000000..d7c3208 Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/libcurl.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/libssl.lib b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/libssl.lib new file mode 100644 index 0000000..26a383c Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/libssl.lib differ diff --git a/VCMP-LUA/modules/requests/cpr/lib/mongoose.lib b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/mongoose.lib similarity index 100% rename from VCMP-LUA/modules/requests/cpr/lib/mongoose.lib rename to VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/mongoose.lib diff --git a/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/zs.lib b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/zs.lib new file mode 100644 index 0000000..a3d686b Binary files /dev/null and b/VCMP-LUA/modules/requests/cpr/lib/x86_64-windows-static/zs.lib differ diff --git a/VCMP-LUA/modules/requests/premake5.lua b/VCMP-LUA/modules/requests/premake5.lua index fda5917..306f322 100644 --- a/VCMP-LUA/modules/requests/premake5.lua +++ b/VCMP-LUA/modules/requests/premake5.lua @@ -1,28 +1,56 @@ project "module-cpr" - kind "StaticLib" - language "C++" - cppdialect "C++17" - pic "On" + kind "StaticLib" + language "C++" + cppdialect "C++17" + pic "On" - targetdir ("%{wks.location}/bin/" .. outputdir .. "/%{prj.name}") - objdir ("%{wks.location}/bin/interm/" .. outputdir .. "/%{prj.name}") + targetdir ("%{wks.location}/bin/" .. outputdir .. "/%{prj.name}") + objdir ("%{wks.location}/bin/interm/" .. outputdir .. "/%{prj.name}") - files - { - "cpr/include/**.h", - "cpr/src/**.cpp", - } + files + { + "cpr/include/**.h", + "cpr/src/**.cpp", + } - includedirs - { - "cpr/include" - } - - libdirs - { - "cpr/lib" - } + includedirs + { + "cpr/include" + } + + libdirs + { + "cpr/lib/%{cfg.architecture}-windows-static" + } - defines "CURL_STATICLIB" + defines + { + "CURL_STATICLIB" + } - links {"cpr.lib", "mongoose.lib", "libcurl.lib"} \ No newline at end of file + filter "system:windows" + links + { + "cpr", + "libcurl", + "mongoose", + "libssl", + "libcrypto", + "ws2_32", + "wldap32", + "crypt32", + "normaliz", + "advapi32", + "bcrypt" + } + + filter "system:linux" + links + { + "curl", + "pthread", + "ssl", + "crypto" + } + + filter {} \ No newline at end of file diff --git a/VCMP-LUA/modules/sqlite3/module-sqlite3.make b/VCMP-LUA/modules/sqlite3/module-sqlite3.make deleted file mode 100644 index 6858dde..0000000 --- a/VCMP-LUA/modules/sqlite3/module-sqlite3.make +++ /dev/null @@ -1,138 +0,0 @@ -# GNU Make project makefile autogenerated by Premake - -ifndef config - config=release32 -endif - -ifndef verbose - SILENT = @ -endif - -.PHONY: clean prebuild prelink - -ifeq ($(config),release32) - RESCOMP = windres - TARGETDIR = ../../../bin/Release32-windows-x86/module-sqlite3 - TARGET = $(TARGETDIR)/module-sqlite3_x86.lib - OBJDIR = ../../../bin/interm/Release32-windows-x86/module-sqlite3 - DEFINES += -D_x32 - INCLUDES += - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -ifeq ($(config),release) - RESCOMP = windres - TARGETDIR = ../../../bin/Release-windows-x86_64/module-sqlite3 - TARGET = $(TARGETDIR)/module-sqlite3_x64.lib - OBJDIR = ../../../bin/interm/Release-windows-x86_64/module-sqlite3 - DEFINES += - INCLUDES += - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -OBJECTS := \ - $(OBJDIR)/shell.o \ - $(OBJDIR)/sqlite3.o \ - -RESOURCES := \ - -CUSTOMFILES := \ - -SHELLTYPE := posix -ifeq (.exe,$(findstring .exe,$(ComSpec))) - SHELLTYPE := msdos -endif - -$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR) - @echo Linking module-sqlite3 - $(SILENT) $(LINKCMD) - $(POSTBUILDCMDS) - -$(CUSTOMFILES): | $(OBJDIR) - -$(TARGETDIR): - @echo Creating $(TARGETDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(TARGETDIR) -else - $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) -endif - -$(OBJDIR): - @echo Creating $(OBJDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(OBJDIR) -else - $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) -endif - -clean: - @echo Cleaning module-sqlite3 -ifeq (posix,$(SHELLTYPE)) - $(SILENT) rm -f $(TARGET) - $(SILENT) rm -rf $(OBJDIR) -else - $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) - $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) -endif - -prebuild: - $(PREBUILDCMDS) - -prelink: - $(PRELINKCMDS) - -ifneq (,$(PCH)) -$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) -$(GCH): $(PCH) | $(OBJDIR) - @echo $(notdir $<) - $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" -else -$(OBJECTS): | $(OBJDIR) -endif - -$(OBJDIR)/shell.o: sqlite3/shell.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/sqlite3.o: sqlite3/sqlite3.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" - --include $(OBJECTS:%.o=%.d) -ifneq (,$(PCH)) - -include $(OBJDIR)/$(notdir $(PCH)).d -endif \ No newline at end of file diff --git a/VCMP-LUA/modules/sqlite3/module-sqliteCpp.make b/VCMP-LUA/modules/sqlite3/module-sqliteCpp.make deleted file mode 100644 index 45389da..0000000 --- a/VCMP-LUA/modules/sqlite3/module-sqliteCpp.make +++ /dev/null @@ -1,154 +0,0 @@ -# GNU Make project makefile autogenerated by Premake - -ifndef config - config=release32 -endif - -ifndef verbose - SILENT = @ -endif - -.PHONY: clean prebuild prelink - -ifeq ($(config),release32) - RESCOMP = windres - TARGETDIR = ../../../bin/Release32-windows-x86/module-sqliteCpp - TARGET = $(TARGETDIR)/module-sqliteCpp_x86.lib - OBJDIR = ../../../bin/interm/Release32-windows-x86/module-sqliteCpp - DEFINES += -D_x32 - INCLUDES += -Isqlite3 -IsqliteCpp/include - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += ../../../bin/Release32-windows-x86/module-sqlite3/module-sqlite3_x86.lib - LDDEPS += ../../../bin/Release32-windows-x86/module-sqlite3/module-sqlite3_x86.lib - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -ifeq ($(config),release) - RESCOMP = windres - TARGETDIR = ../../../bin/Release-windows-x86_64/module-sqliteCpp - TARGET = $(TARGETDIR)/module-sqliteCpp_x64.lib - OBJDIR = ../../../bin/interm/Release-windows-x86_64/module-sqliteCpp - DEFINES += - INCLUDES += -Isqlite3 -IsqliteCpp/include - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += ../../../bin/Release-windows-x86_64/module-sqlite3/module-sqlite3_x64.lib - LDDEPS += ../../../bin/Release-windows-x86_64/module-sqlite3/module-sqlite3_x64.lib - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -OBJECTS := \ - $(OBJDIR)/Backup.o \ - $(OBJDIR)/Column.o \ - $(OBJDIR)/Database.o \ - $(OBJDIR)/Exception.o \ - $(OBJDIR)/Statement.o \ - $(OBJDIR)/Transaction.o \ - -RESOURCES := \ - -CUSTOMFILES := \ - -SHELLTYPE := posix -ifeq (.exe,$(findstring .exe,$(ComSpec))) - SHELLTYPE := msdos -endif - -$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR) - @echo Linking module-sqliteCpp - $(SILENT) $(LINKCMD) - $(POSTBUILDCMDS) - -$(CUSTOMFILES): | $(OBJDIR) - -$(TARGETDIR): - @echo Creating $(TARGETDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(TARGETDIR) -else - $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) -endif - -$(OBJDIR): - @echo Creating $(OBJDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(OBJDIR) -else - $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) -endif - -clean: - @echo Cleaning module-sqliteCpp -ifeq (posix,$(SHELLTYPE)) - $(SILENT) rm -f $(TARGET) - $(SILENT) rm -rf $(OBJDIR) -else - $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) - $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) -endif - -prebuild: - $(PREBUILDCMDS) - -prelink: - $(PRELINKCMDS) - -ifneq (,$(PCH)) -$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) -$(GCH): $(PCH) | $(OBJDIR) - @echo $(notdir $<) - $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" -else -$(OBJECTS): | $(OBJDIR) -endif - -$(OBJDIR)/Backup.o: sqliteCpp/src/Backup.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Column.o: sqliteCpp/src/Column.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Database.o: sqliteCpp/src/Database.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Exception.o: sqliteCpp/src/Exception.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Statement.o: sqliteCpp/src/Statement.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/Transaction.o: sqliteCpp/src/Transaction.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" - --include $(OBJECTS:%.o=%.d) -ifneq (,$(PCH)) - -include $(OBJDIR)/$(notdir $(PCH)).d -endif \ No newline at end of file diff --git a/VCMP-LUA/modules/sqlite3/sqliteCpp/lib/x86_64-windows-static/SQLiteCpp.lib b/VCMP-LUA/modules/sqlite3/sqliteCpp/lib/x86_64-windows-static/SQLiteCpp.lib new file mode 100644 index 0000000..b6d7b76 Binary files /dev/null and b/VCMP-LUA/modules/sqlite3/sqliteCpp/lib/x86_64-windows-static/SQLiteCpp.lib differ diff --git a/VCMP-LUA/modules/sqlite3/sqliteCpp/lib/x86_64-windows-static/sqlite3.lib b/VCMP-LUA/modules/sqlite3/sqliteCpp/lib/x86_64-windows-static/sqlite3.lib new file mode 100644 index 0000000..d381f8d Binary files /dev/null and b/VCMP-LUA/modules/sqlite3/sqliteCpp/lib/x86_64-windows-static/sqlite3.lib differ diff --git a/VCMP-LUA/pch.h b/VCMP-LUA/pch.h index ebef319..7087649 100644 --- a/VCMP-LUA/pch.h +++ b/VCMP-LUA/pch.h @@ -21,6 +21,7 @@ #define SOL_ALL_SAFETIES_ON 1 +#include #include extern "C" @@ -28,10 +29,8 @@ extern "C" #include } -#include - -#ifdef WIN32 -#include +#ifdef _WIN32 + #include #endif #endif //PCH_H diff --git a/VCMP-LUA/premake5.lua b/VCMP-LUA/premake5.lua index 1019d7a..e672457 100644 --- a/VCMP-LUA/premake5.lua +++ b/VCMP-LUA/premake5.lua @@ -1,78 +1,92 @@ project "LuaPlugin" - kind "SharedLib" - language "C++" - cppdialect "C++17" - pic "On" + kind "SharedLib" + language "C++" + cppdialect "C++17" + staticruntime "on" + pic "On" - targetdir ("%{wks.location}/bin/" .. outputdir .. "/%{prj.name}") - objdir ("%{wks.location}/bin/interm/" .. outputdir .. "/%{prj.name}") - - files - { - "pch.h", + targetdir ("../bin/" .. outputdir .. "/%{prj.name}") + objdir ("../bin/interm/" .. outputdir .. "/%{prj.name}") + + files + { + "pch.h", "pch.cpp", "Core.cpp", - "include/**.h", "include/**.c", - "vcmpWrap/**.h", - "vcmpWrap/**.cpp", + "vcmpWrap/**.cpp", + "modules/crypto/vcmpWrap/**.h", + "modules/crypto/vcmpWrap/**.cpp", } - - includedirs - { - "%{wks.location}/VCMP-LUA/", - "%{wks.location}/VCMP-LUA/include", - "%{wks.location}/VCMP-LUA/vcmpWrap", - "%{wks.location}/VCMP-LUA/vendor", - "%{wks.location}/VCMP-LUA/vendor/Lua", - "%{wks.location}/VCMP-LUA/vendor/sol", - "%{wks.location}/VCMP-LUA/vendor/spdlog/include", - "%{wks.location}/VCMP-LUA/vendor/asyncplusplus/include", - "%{wks.location}/VCMP-LUA/vendor/lanes/src", - } - -- Module(s) files and dirs - files - { - -- crypto - "modules/crypto/vcmpWrap/**.h", - "modules/crypto/vcmpWrap/**.cpp", - } + includedirs + { + "./", + "include", + "vcmpWrap", + "vendor", + "vendor/Lua", + "vendor/sol", + "vendor/spdlog/include", + "vendor/asyncplusplus/include", + "vendor/lanes/src", + "modules/sqlite3/sqliteCpp/include", + "modules/requests/cpr/include", + "modules/postgresql/include" + } + + defines { + "LIBASYNC_STATIC" + } - includedirs - { - -- sqlite - "modules/sqlite3/sqliteCpp/include", - -- cpr - "modules/requests/cpr/include" - } - -- + filter "system:windows" + + defines { + "WIN32", + "CURL_STATICLIB", + "ZLIB_WINAPI", + "WIN32_LEAN_AND_MEAN", + "NOMINMAX" + } + + systemversion "latest" + + linkoptions { + "/FORCE:MULTIPLE", + "/alternatename:__imp_rand=rand", + "/alternatename:__imp__rmdir=_rmdir" + } + + libdirs { + "modules/postgresql/lib/%{cfg.architecture}-windows-static", + "modules/requests/cpr/lib/%{cfg.architecture}-windows-static", + "modules/sqlite3/sqliteCpp/lib/%{cfg.architecture}-windows-static" + } + + links { + "spdlog", "Lua", "asyncplusplus", "LuaLanes", "module-crypto", + "module-cpr", "module-sqliteCpp", + "pq", "pgcommon", "pgport", + "libcrypto", "libssl", + "Ws2_32", "Secur32", "Advapi32", "Crypt32", "Wldap32", "Shell32", "Normaliz", "Iphlpapi" + } - defines { "LIBASYNC_STATIC" } + filter { "system:windows", "configurations:Release*" } + links { "zs" } - filter {} - internalLinks = { "spdlog", "Lua", "asyncplusplus", "LuaLanes" } - -- Links external modules - externalLinks = { "module-crypto", "module-sqliteCpp", "module-cpr" } - - local linksTbl = table.join(internalLinks, externalLinks) - links(linksTbl) + filter { "system:windows", "configurations:Debug*" } + links { "zsd" } - -- Specify internal modules (Not project based) - include "modules/mariadb" + filter "system:linux" + buildoptions { "-fpermissive" } + links { "pq", "module-cpr", "module-sqliteCpp", "ssl", "crypto", "pthread", "dl", "m" } - filter "system:windows" - systemversion "latest" - defines { "WIN32" } - - filter "configurations:Debug" - defines {"_DEBUG"} - runtime "Debug" - symbols "on" + filter "configurations:Debug" + defines {"_DEBUG"} + symbols "on" - filter "configurations:Release" - defines {"_RELEASE"} - runtime "Release" - optimize "on" \ No newline at end of file + filter "configurations:Release*" + defines {"_RELEASE"} + optimize "on" \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Classes/Player.cpp b/VCMP-LUA/vcmpWrap/Classes/Player.cpp index 8f8453d..86578fa 100644 --- a/VCMP-LUA/vcmpWrap/Classes/Player.cpp +++ b/VCMP-LUA/vcmpWrap/Classes/Player.cpp @@ -39,16 +39,31 @@ sol::table Player::getActive(bool spawned) return entities; } +std::string Player::sanitize(const std::string& text) { + std::string safe = text; + size_t pos = 0; + while ((pos = safe.find("%", pos)) != std::string::npos) { + safe.replace(pos, 1, "%%"); + pos += 2; + } + return safe; +} + void Player::msgAll(const std::string& msg, sol::variadic_args args) { - for (auto& player : s_Players) - player.msg(msg, args); + std::string safeMsg = Player::sanitize(msg); + int32_t color = args.size() > 0 ? args[0].as() : 0xFFFFFFFF; + for (auto& player : s_Players) + g_Funcs->SendClientMessage(player.getID(), color, safeMsg.c_str()); } void Player::announceAll(const std::string& msg, sol::variadic_args args) { - for(auto& player : s_Players) - player.announce(msg, args); + std::string safeMsg = Player::sanitize(msg); + for(auto& player : s_Players) + { + player.announce(safeMsg, args); + } } Player::Player(int32_t id) @@ -59,14 +74,18 @@ Player::Player(int32_t id) /*** METHODS ***/ void Player::msg(const std::string& msg, sol::variadic_args args) { - int32_t color = args.size() > 0 ? args[0] : 0xFFFFFFFF; - g_Funcs->SendClientMessage(m_ID, color, msg.c_str()); + std::string safeMsg = Player::sanitize(msg); + + int32_t color = args.size() > 0 ? args[0].as() : 0xFFFFFFFF; + g_Funcs->SendClientMessage(m_ID, color, safeMsg.c_str()); } void Player::announce(const std::string& msg, sol::variadic_args args) { - int32_t type = args.size() > 0 ? args[0] : 0; - g_Funcs->SendGameMessage(m_ID, type, msg.c_str()); + std::string safeMsg = Player::sanitize(msg); + + int32_t type = args.size() > 0 ? args[0].as() : 0; + g_Funcs->SendGameMessage(m_ID, type, safeMsg.c_str()); } int32_t Player::getAlpha() const { diff --git a/VCMP-LUA/vcmpWrap/Classes/Player.h b/VCMP-LUA/vcmpWrap/Classes/Player.h index b857a13..764b7ab 100644 --- a/VCMP-LUA/vcmpWrap/Classes/Player.h +++ b/VCMP-LUA/vcmpWrap/Classes/Player.h @@ -149,4 +149,6 @@ class Player { int32_t m_ID; char m_Name[24]; sol::table m_LuaData; + + static std::string sanitize(const std::string& text); }; \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Modules/Crypto/Hash.h b/VCMP-LUA/vcmpWrap/Modules/Crypto/Hash.h index 2976c39..eb59bd8 100644 --- a/VCMP-LUA/vcmpWrap/Modules/Crypto/Hash.h +++ b/VCMP-LUA/vcmpWrap/Modules/Crypto/Hash.h @@ -8,4 +8,4 @@ class Hash public: static void Init(sol::state*); private: -}; +}; \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQL.cpp b/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQL.cpp deleted file mode 100644 index 8584cc2..0000000 --- a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQL.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "MySQL.h" - -void MySQL::Init(sol::state* Lua) { - MySQLAccount::Init(Lua); - MySQLConnection::Init(Lua); - - sol::usertype userdata = Lua->new_usertype("MySQL"); - userdata["createAccount"] = sol::overload(&MySQL::createAccount, &MySQL::createAccountEx, &MySQL::createAccountEx2); - userdata["createConnection"] = &MySQL::createConnection; -} - -MySQLAccount* MySQL::createAccount(const std::string& host, const std::string& user, const std::string& password, const std::string& database) { - return new MySQLAccount(host, user, password, database); -} - -MySQLAccount* MySQL::createAccountEx2(const std::string& host, const std::string& user, const std::string& password, const std::string& database, mariadb::u32 port, const std::string& unix_socket) { - return new MySQLAccount(host, user, password, database, port, unix_socket); -} - -MySQLAccount* MySQL::createAccountEx(const std::string& host, const std::string& user, const std::string& password, const std::string& database, mariadb::u32 port) { - return new MySQLAccount(host, user, password, database, port); -} - -MySQLConnection* MySQL::createConnection(MySQLAccount* account) { - return new MySQLConnection(account); -} \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQL.h b/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQL.h deleted file mode 100644 index dd38e89..0000000 --- a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQL.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "pch.h" - -#include "MySQLAccount.h" -#include "MySQLConnection.h" - -class MySQL { -public: - static void Init(sol::state* Lua); - static inline void LogError() { - mariadb::last_error error; - if (error.error_no() == 0) return; - spdlog::error("MySQL Error: [{}] {}", error.error_no(), error.error()); - } - - /*** METHODS ***/ - static MySQLAccount* createAccount(const std::string& host, const std::string& user, const std::string& password, const std::string& database); - static MySQLAccount* createAccountEx(const std::string& host, const std::string& user, const std::string& password, const std::string& database, mariadb::u32 port); - static MySQLAccount* createAccountEx2(const std::string& host, const std::string& user, const std::string& password, const std::string& database, mariadb::u32 port, const std::string& unix_socket); - static MySQLConnection* createConnection(MySQLAccount* account); -}; \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLAccount.cpp b/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLAccount.cpp deleted file mode 100644 index 01c0539..0000000 --- a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLAccount.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "MySQLAccount.h" - -void MySQLAccount::Init(sol::state* Lua) { - sol::usertype userdata = Lua->new_usertype("__INTERNAL__MYSQLACCOUNT"); -} - -MySQLAccount::MySQLAccount(const std::string& host, const std::string& user, const std::string& password, const std::string& database, mariadb::u32 port, const std::string& unix_socket) { - m_AccountRef = mariadb::account::create(host, user, password, database, port, unix_socket); -} \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLAccount.h b/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLAccount.h deleted file mode 100644 index 0c84017..0000000 --- a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLAccount.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include "pch.h" - -class MySQLAccount { -public: - static void Init(sol::state* Lua); - - static inline void LogError() { - mariadb::last_error error; - if (error.error_no() == 0) return; - spdlog::error("MySQLAccount Error: [{}] {}", error.error_no(), error.error()); - } - - MySQLAccount(const std::string& host, const std::string& user, const std::string& password, const std::string& database, mariadb::u32 port = 3306U, const std::string& unix_socket = ""); - - inline mariadb::account_ref getRef() { return this->m_AccountRef; } -private: - mariadb::account_ref m_AccountRef = nullptr; - -public: - - /*** METHODS ***/ - -}; - diff --git a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLConnection.cpp b/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLConnection.cpp deleted file mode 100644 index 84533be..0000000 --- a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLConnection.cpp +++ /dev/null @@ -1,302 +0,0 @@ -#include "MySQLConnection.h" - -extern sol::state Lua; - -void MySQLConnection::Init(sol::state* Lua) { - sol::usertype userdata = Lua->new_usertype("__INTERNAL__MYSQLCONNECTION"); - - userdata["execute"] = sol::overload(&MySQLConnection::execute, &MySQLConnection::executeCallback, &MySQLConnection::executePrepare, &MySQLConnection::executePrepareCallback); - userdata["query"] = sol::overload(&MySQLConnection::query, &MySQLConnection::queryCallback, &MySQLConnection::queryPrepare, &MySQLConnection::queryPrepareCallback); - userdata["insert"] = sol::overload(&MySQLConnection::insert, &MySQLConnection::insertCallback, &MySQLConnection::insertPrepare, &MySQLConnection::insertPrepareCallback); -} - -std::variant MySQLConnection::execute(const std::string& query) { - try { - auto rows_affected = m_Connection->execute(query); - if (!rows_affected) { - LogError(); - return false; - } - return rows_affected; - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::execute: {}", e.what()); - return false; - } -} - -void MySQLConnection::executeCallback(const sol::function& callback, const std::string& query) { - try { - if (!Lua.get_or("__experimental__", false)) - { - spdlog::critical("Experimental feature call while experimental mode is off"); - return; - } - - if (callback.valid()) { - async::spawn([this, callback, query] { - auto result = this->execute(query); - callback.call(result); - }); - } - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::executeCallback: {}", e.what()); - } -} - -std::variant MySQLConnection::executePrepare(const std::string& query, sol::table args) { - try { - mariadb::statement_ref statement = m_Connection->create_statement(query); - for (const auto& pair : args) { - int key = pair.first.as(); - sol::object value = pair.second; - switch (value.get_type()) { - case sol::type::string: - statement->set_string(key - 1, value.as()); - break; - case sol::type::number: - statement->set_float(key - 1, value.as()); - break; - case sol::type::nil: - default: - statement->set_null(key - 1); - break; - } - } - auto rows_affected = statement->execute(); - if (!rows_affected) { - LogError(); - return false; - } - return rows_affected; - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::executePrepare: {}", e.what()); - return false; - } -} - -void MySQLConnection::executePrepareCallback(const sol::function& callback, const std::string& query, sol::table args) { - try { - if (!Lua.get_or("__experimental__", false)) - { - spdlog::critical("Experimental feature call while experimental mode is off"); - return; - } - - if (callback.valid()) { - async::spawn([this, callback, query, args] { - auto result = this->executePrepare(query, args); - callback.call(result); - }); - } - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::executePrepareCallback: {}", e.what()); - } -} - -sol::table MySQLConnection::query(const std::string& query) { - try { - mariadb::result_set_ref result_set = m_Connection->query(query); - sol::table result = Lua.create_table(); - int row_id = 0; - while (result_set->next()) { - row_id++; - auto column_count = result_set->column_count(); - auto row = Lua.create_table(); - for (mariadb::u32 i = 0; i < column_count; i++) { - auto column_name = result_set->column_name(i); - row[column_name] = GetLuaData(result_set, i); - } - result[row_id] = row; - } - return result; - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::query: {}", e.what()); - return sol::nil; - } -} - -void MySQLConnection::queryCallback(const sol::function& callback, const std::string& query) { - try { - if (!Lua.get_or("__experimental__", false)) - { - spdlog::critical("Experimental feature call while experimental mode is off"); - return; - } - - if (callback.valid()) { - async::spawn([&, callback, query] { - auto result = this->query(query); - callback.call(result); - }); - } - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::queryCallback: {}", e.what()); - } -} - -sol::table MySQLConnection::queryPrepare(const std::string& query, sol::table args) { - try { - // Prepare the statement - mariadb::statement_ref statement = m_Connection->create_statement(query); - for (const auto& pair : args) { - int key = pair.first.as(); - sol::object value = pair.second; - switch (value.get_type()) { - case sol::type::string: - statement->set_string(key - 1, value.as()); - break; - case sol::type::number: - statement->set_float(key - 1, value.as()); - break; - case sol::type::nil: - default: - statement->set_null(key - 1); - break; - } - } - - // Query it - mariadb::result_set_ref result_set = statement->query(); - sol::table result = Lua.create_table(); - int row_id = 0; - while (result_set->next()) { - row_id++; - auto column_count = result_set->column_count(); - auto row = Lua.create_table(); - for (mariadb::u32 i = 0; i < column_count; i++) { - auto column_name = result_set->column_name(i); - row[column_name] = GetLuaData(result_set, i); - } - result[row_id] = row; - } - return result; - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::queryPrepare: {}", e.what()); - return sol::nil; - } -} - -void MySQLConnection::queryPrepareCallback(const sol::function& callback, const std::string& query, sol::table args) { - try { - if (!Lua.get_or("__experimental__", false)) - { - spdlog::critical("Experimental feature call while experimental mode is off"); - return; - } - - if (callback.valid()) { - async::spawn([this, callback, query, args] { - auto result = this->queryPrepare(query, args); - callback.call(result); - }); - } - } - catch (std::exception e) { - spdlog::error("MySQL::queryPrepareCallback: {}", e.what()); - } -} - -std::variant MySQLConnection::insert(const std::string& query) { - try { - auto last_row_id = m_Connection->insert(query); - if (!last_row_id) { - LogError(); - return false; - } - return last_row_id; - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::insert: {}", e.what()); - return false; - } -} - -void MySQLConnection::insertCallback(const sol::function& callback, const std::string& query) { - try { - if (!Lua.get_or("__experimental__", false)) - { - spdlog::critical("Experimental feature call while experimental mode is off"); - return; - } - - if (callback.valid()) { - async::spawn([this, callback, query] { - auto result = this->insert(query); - callback.call(result); - }); - } - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::insertCallback: {}", e.what()); - } -} - -std::variant MySQLConnection::insertPrepare(const std::string& query, sol::table args) { - try { - mariadb::statement_ref statement = m_Connection->create_statement(query); - for (const auto& pair : args) { - int key = pair.first.as(); - sol::object value = pair.second; - switch (value.get_type()) { - case sol::type::string: - statement->set_string(key - 1, value.as()); - break; - case sol::type::number: - statement->set_float(key - 1, value.as()); - break; - case sol::type::nil: - default: - statement->set_null(key - 1); - break; - } - } - auto last_row_id = statement->insert(); - if (!last_row_id) { - LogError(); - return false; - } - return last_row_id; - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::insertPrepare: {}", e.what()); - return false; - } -} - -void MySQLConnection::insertPrepareCallback(const sol::function& callback, const std::string& query, sol::table args) { - try { - if (!Lua.get_or("__experimental__", false)) - { - spdlog::critical("Experimental feature call while experimental mode is off"); - return; - } - - if (callback.valid()) { - async::spawn([&] { - auto result = this->insertPrepare(query, args); - callback.call(result); - }); - } - } - catch (std::exception e) { - LogError(); - spdlog::error("MySQL::insertPrepareCallback: {}", e.what()); - } -} \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLConnection.h b/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLConnection.h deleted file mode 100644 index ff40dfe..0000000 --- a/VCMP-LUA/vcmpWrap/Modules/MariaDB/MySQLConnection.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once -#include "pch.h" -#include "MySQLAccount.h" -#include - -class MySQLConnection { -public: - static void Init(sol::state* Lua); - - static inline void LogError() { - mariadb::last_error error; - if (error.error_no() == 0) return; - spdlog::error("MySQLConnection Error: [{}] {}", error.error_no(), error.error()); - } - - MySQLConnection(MySQLAccount* account) : m_AccountHandle(account) - { - m_Connection = mariadb::connection::create(m_AccountHandle->getRef()); - } - -private: - MySQLAccount* m_AccountHandle = nullptr; - mariadb::connection_ref m_Connection = nullptr; - bool m_ReadyForTask = true; - -public: - /*** METHODS ***/ - std::variant execute(const std::string& query); - void executeCallback(const sol::function& callback, const std::string& query); - std::variant executePrepare(const std::string& query, sol::table args); - void executePrepareCallback(const sol::function& callback, const std::string& query, sol::table args); - - sol::table query(const std::string& query); - void queryCallback(const sol::function& callback, const std::string& query); - sol::table queryPrepare(const std::string& query, sol::table args); - void queryPrepareCallback(const sol::function& callback, const std::string& query, sol::table args); - - std::variant insert(const std::string& query); - void insertCallback(const sol::function& callback, const std::string& query); - std::variant insertPrepare(const std::string& query, sol::table args); - void insertPrepareCallback(const sol::function& callback, const std::string& query, sol::table args); -private: - std::variant GetLuaData(mariadb::result_set_ref result_set, mariadb::u32 index) { - using namespace mariadb; - std::variant data; - switch (result_set->column_type(index)) - { - case value::signed8: - data = int(result_set->get_signed8(index)); - return std::get(data); - case value::unsigned8: - data = int(result_set->get_unsigned8(index)); - return std::get(data); - case value::signed16: - data = int(result_set->get_signed16(index)); - return std::get(data); - case value::unsigned16: - data = int(result_set->get_unsigned16(index)); - return std::get(data); - case value::signed32: - data = int(result_set->get_signed32(index)); - return std::get(data); - case value::unsigned32: - data = int(result_set->get_unsigned32(index)); - return std::get(data); - case value::signed64: - data = int(result_set->get_signed64(index)); - return std::get(data); - case value::unsigned64: - data = int(result_set->get_unsigned64(index)); - return std::get(data); - case value::float32: - data = float(result_set->get_float(index)); - return std::get(data); - case value::blob: - case value::string: - case value::data: - data = result_set->get_string(index); - return std::get(data); - default: - data = sol::nil; - return std::get(data); - } - } -}; \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Modules/PostgreSQL/PostgreSQL.cpp b/VCMP-LUA/vcmpWrap/Modules/PostgreSQL/PostgreSQL.cpp new file mode 100644 index 0000000..44e0b23 --- /dev/null +++ b/VCMP-LUA/vcmpWrap/Modules/PostgreSQL/PostgreSQL.cpp @@ -0,0 +1,506 @@ +#include "pch.h" +#include "PostgreSQL.h" + +#include +#include + +using json = nlohmann::json; + +// ============================================================ +// JSON -> LUA +// ============================================================ + +static sol::object JsonToLua(sol::state_view lua, const json& j) +{ + if (j.is_null()) + return sol::make_object(lua, sol::lua_nil); + + if (j.is_boolean()) + return sol::make_object(lua, j.get()); + + if (j.is_number_integer()) + { + return sol::make_object( + lua, + static_cast( + j.get())); + } + + if (j.is_number_unsigned()) + { + return sol::make_object( + lua, + static_cast( + j.get())); + } + + if (j.is_number_float()) + return sol::make_object(lua, j.get()); + + if (j.is_string()) + { + return sol::make_object( + lua, + j.get()); + } + + if (j.is_array()) + { + sol::table tbl = lua.create_table(); + int index = 1; + for (const auto& item : j) + tbl[index++] = JsonToLua(lua, item); + return sol::make_object(lua, tbl); + } + + if (j.is_object()) + { + sol::table tbl = lua.create_table(); + for (auto it = j.begin(); it != j.end(); ++it) + tbl[it.key()] = JsonToLua(lua, it.value()); + return sol::make_object(lua, tbl); + } + + return sol::make_object(lua, sol::lua_nil); +} + +// ============================================================ +// LUA -> JSON +// ============================================================ + +static bool IsLuaArray(const sol::table& tbl) +{ + lua_Integer expectedIndex = 1; + for (const auto& kv : tbl) + { + sol::object key = kv.first; + if (!key.is()) + return false; + if (key.as() != expectedIndex) + return false; + expectedIndex++; + } + return true; +} + +static json LuaToJson(const sol::object& obj) +{ + switch (obj.get_type()) + { + case sol::type::nil: + return nullptr; + + case sol::type::boolean: + return obj.as(); + + case sol::type::number: + { + double num = obj.as(); + if (std::floor(num) == num) + return static_cast(num); + return num; + } + + case sol::type::string: + return obj.as(); + + case sol::type::table: + { + sol::table tbl = obj.as(); + + if (IsLuaArray(tbl)) + { + json arr = json::array(); + for (const auto& kv : tbl) + arr.push_back(LuaToJson(kv.second)); + return arr; + } + + json object = json::object(); + for (const auto& kv : tbl) + { + std::string key; + if (kv.first.is()) + key = kv.first.as(); + else if (kv.first.is()) + key = std::to_string(kv.first.as()); + else + continue; + object[key] = LuaToJson(kv.second); + } + return object; + } + + default: + return nullptr; + } +} + +// ============================================================ +// HELPERS: escape conninfo value +// ============================================================ + +static std::string EscapeConnValue(const std::string& val) +{ + std::string out; + out.reserve(val.size() + 2); + out += '\''; + for (char c : val) + { + if (c == '\'' || c == '\\') + out += '\\'; + out += c; + } + out += '\''; + return out; +} + +// ============================================================ +// CONNECTION IMPLEMENTATION +// ============================================================ + +PgConnection::PgConnection() + : conn(nullptr) +{ +} + +PgConnection::~PgConnection() +{ + disconnect(); +} + +bool PgConnection::connect(const PgAccount& acc) +{ + disconnect(); + + lastAccount = acc; + + std::string conninfo = + "host=" + EscapeConnValue(acc.host) + + " user=" + EscapeConnValue(acc.user) + + " password="+ EscapeConnValue(acc.password) + + " dbname=" + EscapeConnValue(acc.database) + + " port=" + std::to_string(acc.port); + + conn = PQconnectdb(conninfo.c_str()); + + return (PQstatus(conn) == CONNECTION_OK); +} + +void PgConnection::disconnect() +{ + if (conn) + { + PQfinish(conn); + conn = nullptr; + } +} + +bool PgConnection::reconnect() +{ + return connect(lastAccount); +} + +bool PgConnection::ping() +{ + if (!conn) + return false; + + PGresult* res = PQexec(conn, "SELECT 1"); + if (!res) + return false; + + bool ok = (PQresultStatus(res) == PGRES_TUPLES_OK); + PQclear(res); + return ok; +} + +bool PgConnection::ensureConnected() +{ + if (ping()) + return true; + + return reconnect(); +} + +// ============================================================ +// EXECUTE WITH PARAMS +// ============================================================ + +static PGresult* ExecuteWithParams(PGconn* conn, const std::string& sql, sol::variadic_args args) +{ + std::vector holders; + + std::vector nullFlags; + + for (auto arg : args) + { + try + { + // NIL -> SQL NULL real + if (arg.get_type() == sol::type::nil) + { + holders.push_back(""); + nullFlags.push_back(true); + } + // BOOLEAN + else if (arg.is()) + { + holders.push_back(arg.as() ? "true" : "false"); + nullFlags.push_back(false); + } + // INTEGER + else if (arg.is()) + { + holders.push_back(std::to_string(arg.as())); + nullFlags.push_back(false); + } + // FLOAT + else if (arg.is()) + { + holders.push_back(std::to_string(arg.as())); + nullFlags.push_back(false); + } + // STRING + else if (arg.is()) + { + holders.push_back(arg.as()); + nullFlags.push_back(false); + } + // TABLE -> JSON + else if (arg.get_type() == sol::type::table) + { + json j = LuaToJson(sol::object(arg)); + holders.push_back(j.dump()); + nullFlags.push_back(false); + } + // FALLBACK + else + { + holders.push_back(arg.as()); + nullFlags.push_back(false); + } + } + catch (...) + { + holders.push_back(""); + nullFlags.push_back(false); + } + } + + std::vector values; + values.reserve(holders.size()); + + for (size_t i = 0; i < holders.size(); i++) + values.push_back(nullFlags[i] ? nullptr : holders[i].c_str()); + + return PQexecParams( + conn, + sql.c_str(), + static_cast(values.size()), + nullptr, + values.data(), + nullptr, + nullptr, + 0 + ); +} + +// ============================================================ +// EXECUTE +// ============================================================ + +bool PgConnection::execute(const std::string& sql, sol::variadic_args args) +{ + + if (!ensureConnected()) + return false; + + PGresult* res = ExecuteWithParams(conn, sql, args); + + if (!res) + return false; + + ExecStatusType status = PQresultStatus(res); + PQclear(res); + + return ( + status == PGRES_COMMAND_OK || + status == PGRES_TUPLES_OK + ); +} + +// ============================================================ +// QUERY +// ============================================================ + +sol::table PgConnection::query(sol::this_state ts, const std::string& sql, sol::variadic_args args) +{ + sol::state_view lua(ts); + sol::table results = lua.create_table(); + + if (!ensureConnected()) + return results; + + PGresult* res = ExecuteWithParams(conn, sql, args); + + if (!res) + return results; + + if (PQresultStatus(res) == PGRES_TUPLES_OK) + { + int rows = PQntuples(res); + int cols = PQnfields(res); + + for (int i = 0; i < rows; i++) + { + sol::table row = lua.create_table(); + + for (int j = 0; j < cols; j++) + { + const char* colName = PQfname(res, j); + + if (PQgetisnull(res, i, j)) + { + row[colName] = sol::lua_nil; + continue; + } + + Oid type = PQftype(res, j); + const char* value = PQgetvalue(res, i, j); + + try + { + switch (type) + { + // BOOLEAN + case 16: + row[colName] = (value[0] == 't'); + break; + + // INTEGERS (int8, int2, int4) + case 20: + case 21: + case 23: + row[colName] = static_cast(std::stoll(value)); + break; + + // FLOATS (float4, float8, numeric) + case 700: + case 701: + case 1700: + row[colName] = std::stod(value); + break; + + // JSON / JSONB + case 114: + case 3802: + { + json parsed = json::parse(value); + row[colName] = JsonToLua(lua, parsed); + break; + } + + // DEFAULT STRING + default: + row[colName] = std::string(value); + break; + } + } + catch (...) + { + row[colName] = std::string(value); + } + } + + results.add(row); + } + } + + PQclear(res); + return results; +} + +// ============================================================ +// ESCAPE +// ============================================================ + +std::string PgConnection::escape(const std::string& str) +{ + if (!conn) + return str; + + char* escaped = PQescapeLiteral( + conn, + str.c_str(), + str.length()); + + if (escaped) + { + std::string result(escaped); + PQfreemem(escaped); + return result; + } + + return str; +} + +// ============================================================ +// FACTORIES +// ============================================================ + +static PgAccount CreateAccount( + std::string h, + std::string u, + std::string p, + std::string d, + sol::optional port) +{ + PgAccount acc; + acc.host = h; + acc.user = u; + acc.password = p; + acc.database = d; + acc.port = port.value_or(5432); + return acc; +} + +static std::shared_ptr +CreateConnection(PgAccount& acc) +{ + auto conn = std::make_shared(); + if (!conn->connect(acc)) + return nullptr; + return conn; +} + +// ============================================================ +// LUA MODULE INIT +// ============================================================ + +void PgConnection::Init(sol::state* L) +{ + L->new_usertype( + "PgAccount", + sol::constructors(), + "host", &PgAccount::host, + "user", &PgAccount::user, + "password", &PgAccount::password, + "database", &PgAccount::database, + "port", &PgAccount::port); + + L->new_usertype( + "PgConnection", + sol::constructors(), + "connect", &PgConnection::connect, + "disconnect", &PgConnection::disconnect, + "reconnect", &PgConnection::reconnect, + "execute", &PgConnection::execute, + "query", &PgConnection::query, + "escape", &PgConnection::escape, + "ping", &PgConnection::ping); + + sol::table pgTable = L->create_named_table("PostgreSQL"); + pgTable["createAccount"] = &CreateAccount; + pgTable["createConnection"] = &CreateConnection; +} \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Modules/PostgreSQL/PostgreSQL.h b/VCMP-LUA/vcmpWrap/Modules/PostgreSQL/PostgreSQL.h new file mode 100644 index 0000000..f550aef --- /dev/null +++ b/VCMP-LUA/vcmpWrap/Modules/PostgreSQL/PostgreSQL.h @@ -0,0 +1,107 @@ +#pragma once + +#include +#include +#include +#include + +// PostgreSQL C API (libpq) +#include + +// Lua bridge library +#include + +/** + * @struct PgAccount + * @brief Holds connection credentials and server information. + */ +struct PgAccount { + std::string host; + std::string user; + std::string password; + std::string database; + int port = 5432; // Default PostgreSQL port +}; + +/** + * @class PgConnection + * @brief Manages a single PostgreSQL connection and provides an interface for Lua. + */ +class PgConnection { +public: + /** + * @brief Registers the PgConnection class and its methods into the Lua state. + * @param L Pointer to the sol::state (Lua environment). + */ + static void Init(sol::state* L); + + PgConnection(); + ~PgConnection(); + + /** + * @brief Establishes a connection to the database using the provided credentials. + * @param acc A PgAccount struct containing host, user, password, etc. + * @return True if connection is successful, false otherwise. + */ + bool connect(const PgAccount& acc); + + /** + * @brief Safely closes the active PostgreSQL connection. + */ + void disconnect(); + + /** + * @brief Attempts to reconnect using the last stored credentials. + * @return True if reconnection succeeds. + */ + bool reconnect(); + + /** + * @brief Executes a SQL command (INSERT, UPDATE, DELETE) that does not return rows. + * @param sql The SQL statement string. + * @param args Variable arguments passed from Lua to be used as parameters. + * @return True if execution was successful. + */ + bool execute( + const std::string& sql, + sol::variadic_args args + ); + + /** + * @brief Executes a SQL query (SELECT) and returns the result set as a Lua table. + * @param ts The current Lua state context. + * @param sql The SQL query string. + * @param args Variable arguments passed from Lua for parameterized queries. + * @return A sol::table containing the rows and columns from the result set. + */ + sol::table query( + sol::this_state ts, + const std::string& sql, + sol::variadic_args args + ); + + /** + * @brief Escapes a string to prevent SQL injection. + * @param str The raw input string. + * @return The sanitized/escaped string. + */ + std::string escape(const std::string& str); + + /** + * @brief Performs a real round-trip to the server to check if the connection is alive. + * Useful for detecting "zombie" or dropped connections. + * @return True if the server responds, false otherwise. + */ + bool ping(); + +private: + PGconn* conn = nullptr; // Internal libpq connection handle + PgAccount lastAccount; // Stores credentials for automatic reconnection + + /** + * @brief Internal helper to verify connection health before running commands. + * Tries to reconnect once if the connection is lost. + * @return True if the connection is active or successfully restored. + */ + bool ensureConnected(); +}; \ No newline at end of file diff --git a/VCMP-LUA/vcmpWrap/Modules/SqLite3/SqLite.cpp b/VCMP-LUA/vcmpWrap/Modules/SqLite3/SqLite.cpp index d005c06..e6fa359 100644 --- a/VCMP-LUA/vcmpWrap/Modules/SqLite3/SqLite.cpp +++ b/VCMP-LUA/vcmpWrap/Modules/SqLite3/SqLite.cpp @@ -71,10 +71,10 @@ int SqLiteDatabase::execPrepare(const std::string& query, sol::table args) statement.bind(pair.first.as(), value.as()); break; case sol::type::number: - if (pair.first.is()) - statement.bind(pair.first.as(), value.as()); + if (pair.first.is()) + statement.bind(pair.first.as(), value.as()); else - statement.bind(pair.first.as(), value.as()); + statement.bind(pair.first.as(), value.as()); break; case sol::type::nil: default: @@ -139,10 +139,10 @@ std::variant SqLiteDatabase::queryPrepare(const std::string& q statement.bind(pair.first.as(), value.as()); break; case sol::type::number: - if (pair.first.is()) - statement.bind(pair.first.as(), value.as()); + if (pair.first.is()) + statement.bind(pair.first.as(), value.as()); else - statement.bind(pair.first.as(), value.as()); + statement.bind(pair.first.as(), value.as()); break; case sol::type::nil: default: diff --git a/VCMP-LUA/vcmpWrap/globalTables.h b/VCMP-LUA/vcmpWrap/globalTables.h index 258c0ac..60103d1 100644 --- a/VCMP-LUA/vcmpWrap/globalTables.h +++ b/VCMP-LUA/vcmpWrap/globalTables.h @@ -14,9 +14,9 @@ #include "Classes/Checkpoint.h" #include "Classes/Pickup.h" -#include "Modules/MariaDB/MySQL.h" #include "Modules/Crypto/Hash.h" #include "Modules/SqLite3/SqLite.h" +#include "Modules/PostgreSQL/PostgreSQL.h" #include "Modules/CPR/Remote.h" #include "Modules/Thread/Thread.h" @@ -38,9 +38,9 @@ void RegisterClasses(sol::state* Lua) { Bind::Init(Lua); // Modules - MySQL::Init(Lua); Hash::Init(Lua); SqLite::Init(Lua); + PgConnection::Init(Lua); Remote::Init(Lua); Thread::Init(Lua); diff --git a/VCMP-LUA/vcmpWrap/vcmpCallbacks.h b/VCMP-LUA/vcmpWrap/vcmpCallbacks.h index 029f21c..7f2c64f 100644 --- a/VCMP-LUA/vcmpWrap/vcmpCallbacks.h +++ b/VCMP-LUA/vcmpWrap/vcmpCallbacks.h @@ -704,8 +704,16 @@ void RegisterVCMPCallbacks() { uint8_t ret = 1; try { Player* player = Player::Get(playerId); + + std::string rawData(message); + std::string safeMessage; + for (char c : rawData) { + if (c == '%') safeMessage += "%%"; + else safeMessage += c; + } + for (auto fn : handlers) { - sol::function_result r = fn(player, message); + sol::function_result r = fn(player, safeMessage); if (!r.valid()) { sol::error e = r; spdlog::error("Event callback error: {}", e.what()); @@ -736,7 +744,17 @@ void RegisterVCMPCallbacks() { throw("Critical failure"); return 0; } - std::string data(message); + + // ---------------------------------------------------- + std::string rawData(message); + std::string data; + // Escape all '%' to '%%' before splitting, because '%' is used for string formatting in Lua and can cause issues if not escaped + for (char c : rawData) { + if (c == '%') data += "%%"; + else data += c; + } + // ---------------------------------------------------- + std::vector args = std::split(data, ' '); std::string command; if (args.size() > 0) @@ -800,8 +818,16 @@ void RegisterVCMPCallbacks() { try { Player* player = Player::Get(playerId); Player* targetPlayer = Player::Get(targetPlayerId); + + std::string rawData(message); + std::string safeMessage; + for (char c : rawData) { + if (c == '%') safeMessage += "%%"; + else safeMessage += c; + } + for (auto fn : handlers) { - sol::function_result r = fn(player, targetPlayer, message); + sol::function_result r = fn(player, targetPlayer, safeMessage); if (!r.valid()) { sol::error e = r; spdlog::error("Event callback error: {}", e.what()); diff --git a/VCMP-LUA/vendor/Lua/Makefile b/VCMP-LUA/vendor/Lua/Makefile deleted file mode 100644 index 2479e29..0000000 --- a/VCMP-LUA/vendor/Lua/Makefile +++ /dev/null @@ -1,270 +0,0 @@ -# GNU Make project makefile autogenerated by Premake - -ifndef config - config=release32 -endif - -ifndef verbose - SILENT = @ -endif - -.PHONY: clean prebuild prelink - -ifeq ($(config),release32) - RESCOMP = windres - TARGETDIR = ../../../bin/Release32-windows-x86/Lua - TARGET = $(TARGETDIR)/Lua_x86.lib - OBJDIR = ../../../bin/interm/Release32-windows-x86/Lua - DEFINES += -D_x32 - INCLUDES += - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -ifeq ($(config),release) - RESCOMP = windres - TARGETDIR = ../../../bin/Release-windows-x86_64/Lua - TARGET = $(TARGETDIR)/Lua_x64.lib - OBJDIR = ../../../bin/interm/Release-windows-x86_64/Lua - DEFINES += - INCLUDES += - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC -std=c++17 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -OBJECTS := \ - $(OBJDIR)/lapi.o \ - $(OBJDIR)/lauxlib.o \ - $(OBJDIR)/lbaselib.o \ - $(OBJDIR)/lbitlib.o \ - $(OBJDIR)/lcode.o \ - $(OBJDIR)/lcorolib.o \ - $(OBJDIR)/lctype.o \ - $(OBJDIR)/ldblib.o \ - $(OBJDIR)/ldebug.o \ - $(OBJDIR)/ldo.o \ - $(OBJDIR)/ldump.o \ - $(OBJDIR)/lfunc.o \ - $(OBJDIR)/lgc.o \ - $(OBJDIR)/linit.o \ - $(OBJDIR)/liolib.o \ - $(OBJDIR)/llex.o \ - $(OBJDIR)/lmathlib.o \ - $(OBJDIR)/lmem.o \ - $(OBJDIR)/loadlib.o \ - $(OBJDIR)/lobject.o \ - $(OBJDIR)/lopcodes.o \ - $(OBJDIR)/loslib.o \ - $(OBJDIR)/lparser.o \ - $(OBJDIR)/lstate.o \ - $(OBJDIR)/lstring.o \ - $(OBJDIR)/lstrlib.o \ - $(OBJDIR)/ltable.o \ - $(OBJDIR)/ltablib.o \ - $(OBJDIR)/ltm.o \ - $(OBJDIR)/lua.o \ - $(OBJDIR)/luac.o \ - $(OBJDIR)/lundump.o \ - $(OBJDIR)/lutf8lib.o \ - $(OBJDIR)/lvm.o \ - $(OBJDIR)/lzio.o \ - -RESOURCES := \ - -CUSTOMFILES := \ - -SHELLTYPE := posix -ifeq (.exe,$(findstring .exe,$(ComSpec))) - SHELLTYPE := msdos -endif - -$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR) - @echo Linking Lua - $(SILENT) $(LINKCMD) - $(POSTBUILDCMDS) - -$(CUSTOMFILES): | $(OBJDIR) - -$(TARGETDIR): - @echo Creating $(TARGETDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(TARGETDIR) -else - $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) -endif - -$(OBJDIR): - @echo Creating $(OBJDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(OBJDIR) -else - $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) -endif - -clean: - @echo Cleaning Lua -ifeq (posix,$(SHELLTYPE)) - $(SILENT) rm -f $(TARGET) - $(SILENT) rm -rf $(OBJDIR) -else - $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) - $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) -endif - -prebuild: - $(PREBUILDCMDS) - -prelink: - $(PRELINKCMDS) - -ifneq (,$(PCH)) -$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) -$(GCH): $(PCH) | $(OBJDIR) - @echo $(notdir $<) - $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" -else -$(OBJECTS): | $(OBJDIR) -endif - -$(OBJDIR)/lapi.o: lapi.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lauxlib.o: lauxlib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lbaselib.o: lbaselib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lbitlib.o: lbitlib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lcode.o: lcode.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lcorolib.o: lcorolib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lctype.o: lctype.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/ldblib.o: ldblib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/ldebug.o: ldebug.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/ldo.o: ldo.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/ldump.o: ldump.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lfunc.o: lfunc.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lgc.o: lgc.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/linit.o: linit.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/liolib.o: liolib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/llex.o: llex.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lmathlib.o: lmathlib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lmem.o: lmem.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/loadlib.o: loadlib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lobject.o: lobject.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lopcodes.o: lopcodes.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/loslib.o: loslib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lparser.o: lparser.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lstate.o: lstate.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lstring.o: lstring.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lstrlib.o: lstrlib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/ltable.o: ltable.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/ltablib.o: ltablib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/ltm.o: ltm.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lua.o: lua.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/luac.o: luac.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lundump.o: lundump.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lutf8lib.o: lutf8lib.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lvm.o: lvm.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/lzio.o: lzio.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" - --include $(OBJECTS:%.o=%.d) -ifneq (,$(PCH)) - -include $(OBJDIR)/$(notdir $(PCH)).d -endif \ No newline at end of file diff --git a/VCMP-LUA/vendor/Lua/premake5.lua b/VCMP-LUA/vendor/Lua/premake5.lua index 6cbe75b..e578942 100644 --- a/VCMP-LUA/vendor/Lua/premake5.lua +++ b/VCMP-LUA/vendor/Lua/premake5.lua @@ -12,4 +12,9 @@ project "Lua" "**.h", "**.c" } - + + removefiles + { + "lua.c", + "luac.c" + } \ No newline at end of file diff --git a/VCMP-LUA/vendor/asyncplusplus/Makefile b/VCMP-LUA/vendor/asyncplusplus/Makefile deleted file mode 100644 index 23724d5..0000000 --- a/VCMP-LUA/vendor/asyncplusplus/Makefile +++ /dev/null @@ -1,138 +0,0 @@ -# GNU Make project makefile autogenerated by Premake - -ifndef config - config=release32 -endif - -ifndef verbose - SILENT = @ -endif - -.PHONY: clean prebuild prelink - -ifeq ($(config),release32) - RESCOMP = windres - TARGETDIR = ../../../bin/Release32-windows-x86/asyncplusplus - TARGET = $(TARGETDIR)/asyncplusplus_x86.lib - OBJDIR = ../../../bin/interm/Release32-windows-x86/asyncplusplus - DEFINES += -D_x32 -DLIBASYNC_STATIC - INCLUDES += -Iinclude - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC -std=c++11 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -ifeq ($(config),release) - RESCOMP = windres - TARGETDIR = ../../../bin/Release-windows-x86_64/asyncplusplus - TARGET = $(TARGETDIR)/asyncplusplus_x64.lib - OBJDIR = ../../../bin/interm/Release-windows-x86_64/asyncplusplus - DEFINES += -DLIBASYNC_STATIC - INCLUDES += -Iinclude - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fPIC -std=c++11 - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s - LINKCMD = $(AR) -rcs "$@" $(OBJECTS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -all: prebuild prelink $(TARGET) - @: - -endif - -OBJECTS := \ - $(OBJDIR)/scheduler.o \ - $(OBJDIR)/threadpool_scheduler.o \ - -RESOURCES := \ - -CUSTOMFILES := \ - -SHELLTYPE := posix -ifeq (.exe,$(findstring .exe,$(ComSpec))) - SHELLTYPE := msdos -endif - -$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR) - @echo Linking asyncplusplus - $(SILENT) $(LINKCMD) - $(POSTBUILDCMDS) - -$(CUSTOMFILES): | $(OBJDIR) - -$(TARGETDIR): - @echo Creating $(TARGETDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(TARGETDIR) -else - $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) -endif - -$(OBJDIR): - @echo Creating $(OBJDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(OBJDIR) -else - $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) -endif - -clean: - @echo Cleaning asyncplusplus -ifeq (posix,$(SHELLTYPE)) - $(SILENT) rm -f $(TARGET) - $(SILENT) rm -rf $(OBJDIR) -else - $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) - $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) -endif - -prebuild: - $(PREBUILDCMDS) - -prelink: - $(PRELINKCMDS) - -ifneq (,$(PCH)) -$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) -$(GCH): $(PCH) | $(OBJDIR) - @echo $(notdir $<) - $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" -else -$(OBJECTS): | $(OBJDIR) -endif - -$(OBJDIR)/scheduler.o: src/scheduler.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/threadpool_scheduler.o: src/threadpool_scheduler.cpp - @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" - --include $(OBJECTS:%.o=%.d) -ifneq (,$(PCH)) - -include $(OBJDIR)/$(notdir $(PCH)).d -endif \ No newline at end of file diff --git a/VCMP-LUA/vendor/nlohmann/json.hpp b/VCMP-LUA/vendor/nlohmann/json.hpp new file mode 100644 index 0000000..e2bb851 --- /dev/null +++ b/VCMP-LUA/vendor/nlohmann/json.hpp @@ -0,0 +1,25830 @@ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + +/****************************************************************************\ + * Note on documentation: The source files contain links to the online * + * documentation of the public API at https://json.nlohmann.me. This URL * + * contains the most recent documentation and should also be applicable to * + * previous versions; documentation for deprecated functions is not * + * removed, but marked deprecated. See "Generate documentation" section in * + * file docs/README.md. * +\****************************************************************************/ + +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ + +#include // all_of, find, for_each +#include // nullptr_t, ptrdiff_t, size_t +#include // hash, less +#include // initializer_list +#ifndef JSON_NO_IO + #include // istream, ostream +#endif // JSON_NO_IO +#include // random_access_iterator_tag +#include // unique_ptr +#include // string, stoi, to_string +#include // declval, forward, move, pair, swap +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// This file contains all macro definitions affecting or depending on the ABI + +#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK + #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) + #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 12 || NLOHMANN_JSON_VERSION_PATCH != 0 + #warning "Already included a different version of the library!" + #endif + #endif +#endif + +#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_MINOR 12 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_PATCH 0 // NOLINT(modernize-macro-to-enum) + +#ifndef JSON_DIAGNOSTICS + #define JSON_DIAGNOSTICS 0 +#endif + +#ifndef JSON_DIAGNOSTIC_POSITIONS + #define JSON_DIAGNOSTIC_POSITIONS 0 +#endif + +#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 +#endif + +#if JSON_DIAGNOSTICS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS +#endif + +#if JSON_DIAGNOSTIC_POSITIONS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS _dp +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS +#endif + +#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp +#else + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 +#endif + +// Construct the namespace ABI tags component +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c) json_abi ## a ## b ## c +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b, c) \ + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c) + +#define NLOHMANN_JSON_ABI_TAGS \ + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ + NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON, \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS) + +// Construct the namespace version component +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ + _v ## major ## _ ## minor ## _ ## patch +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) + +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION +#define NLOHMANN_JSON_NAMESPACE_VERSION +#else +#define NLOHMANN_JSON_NAMESPACE_VERSION \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ + NLOHMANN_JSON_VERSION_MINOR, \ + NLOHMANN_JSON_VERSION_PATCH) +#endif + +// Combine namespace components +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) + +#ifndef NLOHMANN_JSON_NAMESPACE +#define NLOHMANN_JSON_NAMESPACE \ + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ + namespace nlohmann \ + { \ + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) \ + { +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_END +#define NLOHMANN_JSON_NAMESPACE_END \ + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ + } // namespace nlohmann +#endif + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // transform +#include // array +#include // forward_list +#include // inserter, front_inserter, end +#include // map +#include // string +#include // tuple, make_tuple +#include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible +#include // unordered_map +#include // pair, declval +#include // valarray + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // nullptr_t +#include // exception +#if JSON_DIAGNOSTICS + #include // accumulate +#endif +#include // runtime_error +#include // to_string +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // uint8_t +#include // string + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // declval, pair +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template struct make_void +{ + using type = void; +}; +template using void_t = typename make_void::type; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +// https://en.cppreference.com/w/cpp/experimental/is_detected +struct nonesuch +{ + nonesuch() = delete; + ~nonesuch() = delete; + nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; + void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; +}; + +template class Op, + class... Args> +struct detector +{ + using value_t = std::false_type; + using type = Default; +}; + +template class Op, class... Args> +struct detector>, Op, Args...> +{ + using value_t = std::true_type; + using type = Op; +}; + +template class Op, class... Args> +using is_detected = typename detector::value_t; + +template class Op, class... Args> +struct is_detected_lazy : is_detected { }; + +template class Op, class... Args> +using detected_t = typename detector::type; + +template class Op, class... Args> +using detected_or = detector; + +template class Op, class... Args> +using detected_or_t = typename detected_or::type; + +template class Op, class... Args> +using is_detected_exact = std::is_same>; + +template class Op, class... Args> +using is_detected_convertible = + std::is_convertible, To>; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + + +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-FileCopyrightText: 2016-2021 Evan Nemerson +// SPDX-License-Identifier: MIT + +/* Hedley - https://nemequ.github.io/hedley + * Created by Evan Nemerson + * SPDX-License-Identifier: CC0-1.0 + */ + +#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) +#if defined(JSON_HEDLEY_VERSION) + #undef JSON_HEDLEY_VERSION +#endif +#define JSON_HEDLEY_VERSION 15 + +#if defined(JSON_HEDLEY_STRINGIFY_EX) + #undef JSON_HEDLEY_STRINGIFY_EX +#endif +#define JSON_HEDLEY_STRINGIFY_EX(x) #x + +#if defined(JSON_HEDLEY_STRINGIFY) + #undef JSON_HEDLEY_STRINGIFY +#endif +#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) + +#if defined(JSON_HEDLEY_CONCAT_EX) + #undef JSON_HEDLEY_CONCAT_EX +#endif +#define JSON_HEDLEY_CONCAT_EX(a,b) a##b + +#if defined(JSON_HEDLEY_CONCAT) + #undef JSON_HEDLEY_CONCAT +#endif +#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) + +#if defined(JSON_HEDLEY_CONCAT3_EX) + #undef JSON_HEDLEY_CONCAT3_EX +#endif +#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c + +#if defined(JSON_HEDLEY_CONCAT3) + #undef JSON_HEDLEY_CONCAT3 +#endif +#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) + +#if defined(JSON_HEDLEY_VERSION_ENCODE) + #undef JSON_HEDLEY_VERSION_ENCODE +#endif +#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) + #undef JSON_HEDLEY_VERSION_DECODE_MAJOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) + #undef JSON_HEDLEY_VERSION_DECODE_MINOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) + #undef JSON_HEDLEY_VERSION_DECODE_REVISION +#endif +#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) + +#if defined(JSON_HEDLEY_GNUC_VERSION) + #undef JSON_HEDLEY_GNUC_VERSION +#endif +#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) +#elif defined(__GNUC__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) +#endif + +#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) + #undef JSON_HEDLEY_GNUC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GNUC_VERSION) + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION) + #undef JSON_HEDLEY_MSVC_VERSION +#endif +#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) +#elif defined(_MSC_FULL_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) +#elif defined(_MSC_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) + #undef JSON_HEDLEY_MSVC_VERSION_CHECK +#endif +#if !defined(JSON_HEDLEY_MSVC_VERSION) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) +#elif defined(_MSC_VER) && (_MSC_VER >= 1200) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) +#else + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION) + #undef JSON_HEDLEY_INTEL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) +#elif defined(__INTEL_COMPILER) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_VERSION) + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #undef JSON_HEDLEY_INTEL_CL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) + #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION) + #undef JSON_HEDLEY_PGI_VERSION +#endif +#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) + #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION_CHECK) + #undef JSON_HEDLEY_PGI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PGI_VERSION) + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #undef JSON_HEDLEY_SUNPRO_VERSION +#endif +#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) +#elif defined(__SUNPRO_C) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) +#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) +#elif defined(__SUNPRO_CC) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) + #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION +#endif +#if defined(__EMSCRIPTEN__) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION) + #undef JSON_HEDLEY_ARM_VERSION +#endif +#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) +#elif defined(__CC_ARM) && defined(__ARMCC_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION_CHECK) + #undef JSON_HEDLEY_ARM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_ARM_VERSION) + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION) + #undef JSON_HEDLEY_IBM_VERSION +#endif +#if defined(__ibmxl__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) +#elif defined(__xlC__) && defined(__xlC_ver__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) +#elif defined(__xlC__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION_CHECK) + #undef JSON_HEDLEY_IBM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IBM_VERSION) + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_VERSION) + #undef JSON_HEDLEY_TI_VERSION +#endif +#if \ + defined(__TI_COMPILER_VERSION__) && \ + ( \ + defined(__TMS470__) || defined(__TI_ARM__) || \ + defined(__MSP430__) || \ + defined(__TMS320C2000__) \ + ) +#if (__TI_COMPILER_VERSION__ >= 16000000) + #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif +#endif + +#if defined(JSON_HEDLEY_TI_VERSION_CHECK) + #undef JSON_HEDLEY_TI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_VERSION) + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #undef JSON_HEDLEY_TI_CL2000_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) + #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #undef JSON_HEDLEY_TI_CL430_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) + #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #undef JSON_HEDLEY_TI_ARMCL_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) + #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) + #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #undef JSON_HEDLEY_TI_CL6X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) + #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #undef JSON_HEDLEY_TI_CL7X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) + #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #undef JSON_HEDLEY_TI_CLPRU_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) + #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION) + #undef JSON_HEDLEY_CRAY_VERSION +#endif +#if defined(_CRAYC) + #if defined(_RELEASE_PATCHLEVEL) + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) + #else + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) + #undef JSON_HEDLEY_CRAY_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_CRAY_VERSION) + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION) + #undef JSON_HEDLEY_IAR_VERSION +#endif +#if defined(__IAR_SYSTEMS_ICC__) + #if __VER__ > 1000 + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) + #else + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION_CHECK) + #undef JSON_HEDLEY_IAR_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IAR_VERSION) + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION) + #undef JSON_HEDLEY_TINYC_VERSION +#endif +#if defined(__TINYC__) + #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) + #undef JSON_HEDLEY_TINYC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION) + #undef JSON_HEDLEY_DMC_VERSION +#endif +#if defined(__DMC__) + #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION_CHECK) + #undef JSON_HEDLEY_DMC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_DMC_VERSION) + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #undef JSON_HEDLEY_COMPCERT_VERSION +#endif +#if defined(__COMPCERT_VERSION__) + #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) + #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION) + #undef JSON_HEDLEY_PELLES_VERSION +#endif +#if defined(__POCC__) + #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) + #undef JSON_HEDLEY_PELLES_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PELLES_VERSION) + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #undef JSON_HEDLEY_MCST_LCC_VERSION +#endif +#if defined(__LCC__) && defined(__LCC_MINOR__) + #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) + #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION) + #undef JSON_HEDLEY_GCC_VERSION +#endif +#if \ + defined(JSON_HEDLEY_GNUC_VERSION) && \ + !defined(__clang__) && \ + !defined(JSON_HEDLEY_INTEL_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_ARM_VERSION) && \ + !defined(JSON_HEDLEY_CRAY_VERSION) && \ + !defined(JSON_HEDLEY_TI_VERSION) && \ + !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ + !defined(__COMPCERT__) && \ + !defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_ATTRIBUTE +#endif +#if \ + defined(__has_attribute) && \ + ( \ + (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ + ) +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) +#else +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE +#endif +#if \ + defined(__has_cpp_attribute) && \ + defined(__cplusplus) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS +#endif +#if !defined(__cplusplus) || !defined(__has_cpp_attribute) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#elif \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ + (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_BUILTIN) + #undef JSON_HEDLEY_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) +#else + #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) + #undef JSON_HEDLEY_GNUC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) + #undef JSON_HEDLEY_GCC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_FEATURE) + #undef JSON_HEDLEY_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) +#else + #define JSON_HEDLEY_HAS_FEATURE(feature) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) + #undef JSON_HEDLEY_GNUC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_FEATURE) + #undef JSON_HEDLEY_GCC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_EXTENSION) + #undef JSON_HEDLEY_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) +#else + #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) + #undef JSON_HEDLEY_GNUC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) + #undef JSON_HEDLEY_GCC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_WARNING) + #undef JSON_HEDLEY_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) +#else + #define JSON_HEDLEY_HAS_WARNING(warning) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_WARNING) + #undef JSON_HEDLEY_GNUC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_WARNING) + #undef JSON_HEDLEY_GCC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + defined(__clang__) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ + (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) + #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_PRAGMA(value) __pragma(value) +#else + #define JSON_HEDLEY_PRAGMA(value) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) + #undef JSON_HEDLEY_DIAGNOSTIC_PUSH +#endif +#if defined(JSON_HEDLEY_DIAGNOSTIC_POP) + #undef JSON_HEDLEY_DIAGNOSTIC_POP +#endif +#if defined(__clang__) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) + #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) +#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_PUSH + #define JSON_HEDLEY_DIAGNOSTIC_POP +#endif + +/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") +# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") +# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# endif +#endif +#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x +#endif + +#if defined(JSON_HEDLEY_CONST_CAST) + #undef JSON_HEDLEY_CONST_CAST +#endif +#if defined(__cplusplus) +# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) +#elif \ + JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_REINTERPRET_CAST) + #undef JSON_HEDLEY_REINTERPRET_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) +#else + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_STATIC_CAST) + #undef JSON_HEDLEY_STATIC_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) +#else + #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_CPP_CAST) + #undef JSON_HEDLEY_CPP_CAST +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ + ((T) (expr)) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("diag_suppress=Pe137") \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) +# endif +#else +# define JSON_HEDLEY_CPP_CAST(T, expr) (expr) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunused-function") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif + +#if defined(JSON_HEDLEY_DEPRECATED) + #undef JSON_HEDLEY_DEPRECATED +#endif +#if defined(JSON_HEDLEY_DEPRECATED_FOR) + #undef JSON_HEDLEY_DEPRECATED_FOR +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) +#elif \ + (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) +#elif defined(__cplusplus) && (__cplusplus >= 201402L) + #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") +#else + #define JSON_HEDLEY_DEPRECATED(since) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) +#endif + +#if defined(JSON_HEDLEY_UNAVAILABLE) + #undef JSON_HEDLEY_UNAVAILABLE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) +#else + #define JSON_HEDLEY_UNAVAILABLE(available_since) +#endif + +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT +#endif +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) +#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) +#elif defined(_Check_return_) /* SAL */ + #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ +#else + #define JSON_HEDLEY_WARN_UNUSED_RESULT + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) +#endif + +#if defined(JSON_HEDLEY_SENTINEL) + #undef JSON_HEDLEY_SENTINEL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) +#else + #define JSON_HEDLEY_SENTINEL(position) +#endif + +#if defined(JSON_HEDLEY_NO_RETURN) + #undef JSON_HEDLEY_NO_RETURN +#endif +#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NO_RETURN __noreturn +#elif \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + #define JSON_HEDLEY_NO_RETURN _Noreturn +#elif defined(__cplusplus) && (__cplusplus >= 201103L) + #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#else + #define JSON_HEDLEY_NO_RETURN +#endif + +#if defined(JSON_HEDLEY_NO_ESCAPE) + #undef JSON_HEDLEY_NO_ESCAPE +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) + #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) +#else + #define JSON_HEDLEY_NO_ESCAPE +#endif + +#if defined(JSON_HEDLEY_UNREACHABLE) + #undef JSON_HEDLEY_UNREACHABLE +#endif +#if defined(JSON_HEDLEY_UNREACHABLE_RETURN) + #undef JSON_HEDLEY_UNREACHABLE_RETURN +#endif +#if defined(JSON_HEDLEY_ASSUME) + #undef JSON_HEDLEY_ASSUME +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_ASSUME(expr) __assume(expr) +#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) + #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) +#elif \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #if defined(__cplusplus) + #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) + #else + #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) + #endif +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() +#elif defined(JSON_HEDLEY_ASSUME) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif +#if !defined(JSON_HEDLEY_ASSUME) + #if defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) + #else + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) + #endif +#endif +#if defined(JSON_HEDLEY_UNREACHABLE) + #if \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) + #else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() + #endif +#else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) +#endif +#if !defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif + +JSON_HEDLEY_DIAGNOSTIC_PUSH +#if JSON_HEDLEY_HAS_WARNING("-Wpedantic") + #pragma clang diagnostic ignored "-Wpedantic" +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) + #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#endif +#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) + #if defined(__clang__) + #pragma clang diagnostic ignored "-Wvariadic-macros" + #elif defined(JSON_HEDLEY_GCC_VERSION) + #pragma GCC diagnostic ignored "-Wvariadic-macros" + #endif +#endif +#if defined(JSON_HEDLEY_NON_NULL) + #undef JSON_HEDLEY_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) +#else + #define JSON_HEDLEY_NON_NULL(...) +#endif +JSON_HEDLEY_DIAGNOSTIC_POP + +#if defined(JSON_HEDLEY_PRINTF_FORMAT) + #undef JSON_HEDLEY_PRINTF_FORMAT +#endif +#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) +#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) +#else + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) +#endif + +#if defined(JSON_HEDLEY_CONSTEXPR) + #undef JSON_HEDLEY_CONSTEXPR +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) + #endif +#endif +#if !defined(JSON_HEDLEY_CONSTEXPR) + #define JSON_HEDLEY_CONSTEXPR +#endif + +#if defined(JSON_HEDLEY_PREDICT) + #undef JSON_HEDLEY_PREDICT +#endif +#if defined(JSON_HEDLEY_LIKELY) + #undef JSON_HEDLEY_LIKELY +#endif +#if defined(JSON_HEDLEY_UNLIKELY) + #undef JSON_HEDLEY_UNLIKELY +#endif +#if defined(JSON_HEDLEY_UNPREDICTABLE) + #undef JSON_HEDLEY_UNPREDICTABLE +#endif +#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) + #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) +#elif \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, expected, probability) \ + (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ + })) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ + })) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) +#else +# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_LIKELY(expr) (!!(expr)) +# define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) +#endif +#if !defined(JSON_HEDLEY_UNPREDICTABLE) + #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) +#endif + +#if defined(JSON_HEDLEY_MALLOC) + #undef JSON_HEDLEY_MALLOC +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_MALLOC __declspec(restrict) +#else + #define JSON_HEDLEY_MALLOC +#endif + +#if defined(JSON_HEDLEY_PURE) + #undef JSON_HEDLEY_PURE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PURE __attribute__((__pure__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ + ) +# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") +#else +# define JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_CONST) + #undef JSON_HEDLEY_CONST +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_CONST __attribute__((__const__)) +#elif \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_CONST _Pragma("no_side_effect") +#else + #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_RESTRICT) + #undef JSON_HEDLEY_RESTRICT +#endif +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT restrict +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + defined(__clang__) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RESTRICT __restrict +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT _Restrict +#else + #define JSON_HEDLEY_RESTRICT +#endif + +#if defined(JSON_HEDLEY_INLINE) + #undef JSON_HEDLEY_INLINE +#endif +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + (defined(__cplusplus) && (__cplusplus >= 199711L)) + #define JSON_HEDLEY_INLINE inline +#elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) + #define JSON_HEDLEY_INLINE __inline__ +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_INLINE __inline +#else + #define JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_ALWAYS_INLINE) + #undef JSON_HEDLEY_ALWAYS_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_ALWAYS_INLINE __forceinline +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ + ) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") +#else +# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_NEVER_INLINE) + #undef JSON_HEDLEY_NEVER_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#else + #define JSON_HEDLEY_NEVER_INLINE +#endif + +#if defined(JSON_HEDLEY_PRIVATE) + #undef JSON_HEDLEY_PRIVATE +#endif +#if defined(JSON_HEDLEY_PUBLIC) + #undef JSON_HEDLEY_PUBLIC +#endif +#if defined(JSON_HEDLEY_IMPORT) + #undef JSON_HEDLEY_IMPORT +#endif +#if defined(_WIN32) || defined(__CYGWIN__) +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC __declspec(dllexport) +# define JSON_HEDLEY_IMPORT __declspec(dllimport) +#else +# if \ + JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + ( \ + defined(__TI_EABI__) && \ + ( \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ + ) \ + ) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) +# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) +# else +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC +# endif +# define JSON_HEDLEY_IMPORT extern +#endif + +#if defined(JSON_HEDLEY_NO_THROW) + #undef JSON_HEDLEY_NO_THROW +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NO_THROW __declspec(nothrow) +#else + #define JSON_HEDLEY_NO_THROW +#endif + +#if defined(JSON_HEDLEY_FALL_THROUGH) + #undef JSON_HEDLEY_FALL_THROUGH +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) +#elif defined(__fallthrough) /* SAL */ + #define JSON_HEDLEY_FALL_THROUGH __fallthrough +#else + #define JSON_HEDLEY_FALL_THROUGH +#endif + +#if defined(JSON_HEDLEY_RETURNS_NON_NULL) + #undef JSON_HEDLEY_RETURNS_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) +#elif defined(_Ret_notnull_) /* SAL */ + #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ +#else + #define JSON_HEDLEY_RETURNS_NON_NULL +#endif + +#if defined(JSON_HEDLEY_ARRAY_PARAM) + #undef JSON_HEDLEY_ARRAY_PARAM +#endif +#if \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__STDC_NO_VLA__) && \ + !defined(__cplusplus) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_ARRAY_PARAM(name) (name) +#else + #define JSON_HEDLEY_ARRAY_PARAM(name) +#endif + +#if defined(JSON_HEDLEY_IS_CONSTANT) + #undef JSON_HEDLEY_IS_CONSTANT +#endif +#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) + #undef JSON_HEDLEY_REQUIRE_CONSTEXPR +#endif +/* JSON_HEDLEY_IS_CONSTEXPR_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #undef JSON_HEDLEY_IS_CONSTEXPR_ +#endif +#if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) +#endif +#if !defined(__cplusplus) +# if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) +#endif +# elif \ + ( \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION)) || \ + (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) +#endif +# elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + defined(JSON_HEDLEY_INTEL_VERSION) || \ + defined(JSON_HEDLEY_TINYC_VERSION) || \ + defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ + defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ + defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ + defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ + defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ + defined(__clang__) +# define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ + sizeof(void) != \ + sizeof(*( \ + 1 ? \ + ((void*) ((expr) * 0L) ) : \ +((struct { char v[sizeof(void) * 2]; } *) 1) \ + ) \ + ) \ + ) +# endif +#endif +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) +#else + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) (0) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) +#endif + +#if defined(JSON_HEDLEY_BEGIN_C_DECLS) + #undef JSON_HEDLEY_BEGIN_C_DECLS +#endif +#if defined(JSON_HEDLEY_END_C_DECLS) + #undef JSON_HEDLEY_END_C_DECLS +#endif +#if defined(JSON_HEDLEY_C_DECL) + #undef JSON_HEDLEY_C_DECL +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { + #define JSON_HEDLEY_END_C_DECLS } + #define JSON_HEDLEY_C_DECL extern "C" +#else + #define JSON_HEDLEY_BEGIN_C_DECLS + #define JSON_HEDLEY_END_C_DECLS + #define JSON_HEDLEY_C_DECL +#endif + +#if defined(JSON_HEDLEY_STATIC_ASSERT) + #undef JSON_HEDLEY_STATIC_ASSERT +#endif +#if \ + !defined(__cplusplus) && ( \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ + (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + defined(_Static_assert) \ + ) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) +#elif \ + (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) +#else +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) +#endif + +#if defined(JSON_HEDLEY_NULL) + #undef JSON_HEDLEY_NULL +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) + #elif defined(NULL) + #define JSON_HEDLEY_NULL NULL + #else + #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) + #endif +#elif defined(NULL) + #define JSON_HEDLEY_NULL NULL +#else + #define JSON_HEDLEY_NULL ((void*) 0) +#endif + +#if defined(JSON_HEDLEY_MESSAGE) + #undef JSON_HEDLEY_MESSAGE +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_MESSAGE(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(message msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) +#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_WARNING) + #undef JSON_HEDLEY_WARNING +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_WARNING(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(clang warning msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_REQUIRE) + #undef JSON_HEDLEY_REQUIRE +#endif +#if defined(JSON_HEDLEY_REQUIRE_MSG) + #undef JSON_HEDLEY_REQUIRE_MSG +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) +# if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") +# define JSON_HEDLEY_REQUIRE(expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), #expr, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), msg, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) +# endif +#else +# define JSON_HEDLEY_REQUIRE(expr) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) +#endif + +#if defined(JSON_HEDLEY_FLAGS) + #undef JSON_HEDLEY_FLAGS +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) + #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) +#else + #define JSON_HEDLEY_FLAGS +#endif + +#if defined(JSON_HEDLEY_FLAGS_CAST) + #undef JSON_HEDLEY_FLAGS_CAST +#endif +#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) +# define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("warning(disable:188)") \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) +#endif + +#if defined(JSON_HEDLEY_EMPTY_BASES) + #undef JSON_HEDLEY_EMPTY_BASES +#endif +#if \ + (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) +#else + #define JSON_HEDLEY_EMPTY_BASES +#endif + +/* Remaining macros are deprecated. */ + +#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK +#endif +#if defined(__clang__) + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) +#else + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) + #undef JSON_HEDLEY_CLANG_HAS_BUILTIN +#endif +#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) + +#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) + #undef JSON_HEDLEY_CLANG_HAS_FEATURE +#endif +#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) + +#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) + #undef JSON_HEDLEY_CLANG_HAS_EXTENSION +#endif +#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) + +#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_WARNING) + #undef JSON_HEDLEY_CLANG_HAS_WARNING +#endif +#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) + +#endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ + + +// This file contains all internal macro definitions (except those affecting ABI) +// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them + +// #include + + +// exclude unsupported compilers +#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) + #if defined(__clang__) + #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #endif +#endif + +// C++ language standard detection +// if the user manually specified the used C++ version, this is skipped +#if !defined(JSON_HAS_CPP_26) && !defined(JSON_HAS_CPP_23) && !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) + #if (defined(__cplusplus) && __cplusplus > 202302L) || (defined(_MSVC_LANG) && _MSVC_LANG > 202302L) + #define JSON_HAS_CPP_26 + #define JSON_HAS_CPP_23 + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus > 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG > 202002L) + #define JSON_HAS_CPP_23 + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus > 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG > 201703L) + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus > 201402L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus > 201103L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 + #endif + // the cpp 11 flag is always specified because it is the minimal required version + #define JSON_HAS_CPP_11 +#endif + +#ifdef __has_include + #if __has_include() + #include + #endif +#endif + +#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) + #ifdef JSON_HAS_CPP_17 + #if defined(__cpp_lib_filesystem) + #define JSON_HAS_FILESYSTEM 1 + #elif defined(__cpp_lib_experimental_filesystem) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif !defined(__has_include) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #endif + + // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ + #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__clang_major__) && __clang_major__ < 7 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support + #if defined(_MSC_VER) && _MSC_VER < 1914 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before iOS 13 + #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before macOS Catalina + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + #endif +#endif + +#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_FILESYSTEM + #define JSON_HAS_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_THREE_WAY_COMPARISON + #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ + && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L + #define JSON_HAS_THREE_WAY_COMPARISON 1 + #else + #define JSON_HAS_THREE_WAY_COMPARISON 0 + #endif +#endif + +#ifndef JSON_HAS_RANGES + // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has a syntax error + #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 + #define JSON_HAS_RANGES 0 + #elif defined(__cpp_lib_ranges) + #define JSON_HAS_RANGES 1 + #else + #define JSON_HAS_RANGES 0 + #endif +#endif + +#ifndef JSON_HAS_STATIC_RTTI + #if !defined(_HAS_STATIC_RTTI) || _HAS_STATIC_RTTI != 0 + #define JSON_HAS_STATIC_RTTI 1 + #else + #define JSON_HAS_STATIC_RTTI 0 + #endif +#endif + +#ifdef JSON_HAS_CPP_17 + #define JSON_INLINE_VARIABLE inline +#else + #define JSON_INLINE_VARIABLE +#endif + +#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) + #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else + #define JSON_NO_UNIQUE_ADDRESS +#endif + +// disable documentation warnings on clang +#if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdocumentation" + #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +#endif + +// allow disabling exceptions +#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) + #define JSON_THROW(exception) throw exception + #define JSON_TRY try + #define JSON_CATCH(exception) catch(exception) + #define JSON_INTERNAL_CATCH(exception) catch(exception) +#else + #include + #define JSON_THROW(exception) std::abort() + #define JSON_TRY if(true) + #define JSON_CATCH(exception) if(false) + #define JSON_INTERNAL_CATCH(exception) if(false) +#endif + +// override exception macros +#if defined(JSON_THROW_USER) + #undef JSON_THROW + #define JSON_THROW JSON_THROW_USER +#endif +#if defined(JSON_TRY_USER) + #undef JSON_TRY + #define JSON_TRY JSON_TRY_USER +#endif +#if defined(JSON_CATCH_USER) + #undef JSON_CATCH + #define JSON_CATCH JSON_CATCH_USER + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_CATCH_USER +#endif +#if defined(JSON_INTERNAL_CATCH_USER) + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER +#endif + +// allow overriding assert +#if !defined(JSON_ASSERT) + #include // assert + #define JSON_ASSERT(x) assert(x) +#endif + +// allow accessing some private functions (needed by the test suite) +#if defined(JSON_TESTS_PRIVATE) + #define JSON_PRIVATE_UNLESS_TESTED public +#else + #define JSON_PRIVATE_UNLESS_TESTED private +#endif + +/*! +@brief macro to briefly define a mapping between an enum and JSON +@def NLOHMANN_JSON_SERIALIZE_ENUM +@since version 3.4.0 +*/ +#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ + template \ + inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ + { \ + /* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + /* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on */ \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [e](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.first == e; \ + }); \ + j = ((it != std::end(m)) ? it : std::begin(m))->second; \ + } \ + template \ + inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ + { \ + /* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + /* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on */ \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [&j](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.second == j; \ + }); \ + e = ((it != std::end(m)) ? it : std::begin(m))->first; \ + } + +// Ugly macros to avoid uglier copy-paste when specializing basic_json. They +// may be removed in the future once the class is split. + +#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ + template class ObjectType, \ + template class ArrayType, \ + class StringType, class BooleanType, class NumberIntegerType, \ + class NumberUnsignedType, class NumberFloatType, \ + template class AllocatorType, \ + template class JSONSerializer, \ + class BinaryType, \ + class CustomBaseClass> + +#define NLOHMANN_BASIC_JSON_TPL \ + basic_json + +// Macros to simplify conversion from/to types + +#define NLOHMANN_JSON_EXPAND( x ) x +#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME +#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ + NLOHMANN_JSON_PASTE64, \ + NLOHMANN_JSON_PASTE63, \ + NLOHMANN_JSON_PASTE62, \ + NLOHMANN_JSON_PASTE61, \ + NLOHMANN_JSON_PASTE60, \ + NLOHMANN_JSON_PASTE59, \ + NLOHMANN_JSON_PASTE58, \ + NLOHMANN_JSON_PASTE57, \ + NLOHMANN_JSON_PASTE56, \ + NLOHMANN_JSON_PASTE55, \ + NLOHMANN_JSON_PASTE54, \ + NLOHMANN_JSON_PASTE53, \ + NLOHMANN_JSON_PASTE52, \ + NLOHMANN_JSON_PASTE51, \ + NLOHMANN_JSON_PASTE50, \ + NLOHMANN_JSON_PASTE49, \ + NLOHMANN_JSON_PASTE48, \ + NLOHMANN_JSON_PASTE47, \ + NLOHMANN_JSON_PASTE46, \ + NLOHMANN_JSON_PASTE45, \ + NLOHMANN_JSON_PASTE44, \ + NLOHMANN_JSON_PASTE43, \ + NLOHMANN_JSON_PASTE42, \ + NLOHMANN_JSON_PASTE41, \ + NLOHMANN_JSON_PASTE40, \ + NLOHMANN_JSON_PASTE39, \ + NLOHMANN_JSON_PASTE38, \ + NLOHMANN_JSON_PASTE37, \ + NLOHMANN_JSON_PASTE36, \ + NLOHMANN_JSON_PASTE35, \ + NLOHMANN_JSON_PASTE34, \ + NLOHMANN_JSON_PASTE33, \ + NLOHMANN_JSON_PASTE32, \ + NLOHMANN_JSON_PASTE31, \ + NLOHMANN_JSON_PASTE30, \ + NLOHMANN_JSON_PASTE29, \ + NLOHMANN_JSON_PASTE28, \ + NLOHMANN_JSON_PASTE27, \ + NLOHMANN_JSON_PASTE26, \ + NLOHMANN_JSON_PASTE25, \ + NLOHMANN_JSON_PASTE24, \ + NLOHMANN_JSON_PASTE23, \ + NLOHMANN_JSON_PASTE22, \ + NLOHMANN_JSON_PASTE21, \ + NLOHMANN_JSON_PASTE20, \ + NLOHMANN_JSON_PASTE19, \ + NLOHMANN_JSON_PASTE18, \ + NLOHMANN_JSON_PASTE17, \ + NLOHMANN_JSON_PASTE16, \ + NLOHMANN_JSON_PASTE15, \ + NLOHMANN_JSON_PASTE14, \ + NLOHMANN_JSON_PASTE13, \ + NLOHMANN_JSON_PASTE12, \ + NLOHMANN_JSON_PASTE11, \ + NLOHMANN_JSON_PASTE10, \ + NLOHMANN_JSON_PASTE9, \ + NLOHMANN_JSON_PASTE8, \ + NLOHMANN_JSON_PASTE7, \ + NLOHMANN_JSON_PASTE6, \ + NLOHMANN_JSON_PASTE5, \ + NLOHMANN_JSON_PASTE4, \ + NLOHMANN_JSON_PASTE3, \ + NLOHMANN_JSON_PASTE2, \ + NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) +#define NLOHMANN_JSON_PASTE2(func, v1) func(v1) +#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) +#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) +#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) +#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) +#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) +#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) +#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) +#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) +#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) +#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) +#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) +#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) +#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) +#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) +#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) +#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) +#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) +#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) +#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) +#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) +#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) +#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) +#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) +#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) +#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) +#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) +#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) +#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) +#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) +#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) +#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) +#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) +#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) +#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) +#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) +#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) +#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) +#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) +#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) +#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) +#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) +#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) +#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) +#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) +#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) +#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) +#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) +#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) +#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) +#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) +#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) +#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) +#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) +#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) +#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) +#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) +#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) +#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) +#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) +#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) +#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) +#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) + +#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; +#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); +#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = !nlohmann_json_j.is_null() ? nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1) : nlohmann_json_default_obj.v1; + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE +@since version 3.9.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT +@since version 3.11.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE +@since version 3.11.3 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE +@since version 3.9.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_non_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT +@since version 3.11.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_non_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE +@since version 3.11.3 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_non_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Type, BaseType, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(Type, BaseType, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +// inspired from https://stackoverflow.com/a/26745591 +// allows calling any std function as if (e.g., with begin): +// using std::begin; begin(x); +// +// it allows using the detected idiom to retrieve the return type +// of such an expression +#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ + namespace detail { \ + using std::std_name; \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + } \ + \ + namespace detail2 { \ + struct std_name##_tag \ + { \ + }; \ + \ + template \ + std_name##_tag std_name(T&&...); \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + \ + template \ + struct would_call_std_##std_name \ + { \ + static constexpr auto const value = ::nlohmann::detail:: \ + is_detected_exact::value; \ + }; \ + } /* namespace detail2 */ \ + \ + template \ + struct would_call_std_##std_name : detail2::would_call_std_##std_name \ + { \ + } + +#ifndef JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_USE_IMPLICIT_CONVERSIONS 1 +#endif + +#if JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_EXPLICIT +#else + #define JSON_EXPLICIT explicit +#endif + +#ifndef JSON_DISABLE_ENUM_SERIALIZATION + #define JSON_DISABLE_ENUM_SERIALIZATION 0 +#endif + +#ifndef JSON_USE_GLOBAL_UDLS + #define JSON_USE_GLOBAL_UDLS 1 +#endif + +#if JSON_HAS_THREE_WAY_COMPARISON + #include // partial_ordering +#endif + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/////////////////////////// +// JSON type enumeration // +/////////////////////////// + +/*! +@brief the JSON type enumeration + +This enumeration collects the different JSON types. It is internally used to +distinguish the stored values, and the functions @ref basic_json::is_null(), +@ref basic_json::is_object(), @ref basic_json::is_array(), +@ref basic_json::is_string(), @ref basic_json::is_boolean(), +@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), +@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), +@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and +@ref basic_json::is_structured() rely on it. + +@note There are three enumeration entries (number_integer, number_unsigned, and +number_float), because the library distinguishes these three types for numbers: +@ref basic_json::number_unsigned_t is used for unsigned integers, +@ref basic_json::number_integer_t is used for signed integers, and +@ref basic_json::number_float_t is used for floating-point numbers or to +approximate integers which do not fit in the limits of their respective type. + +@sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON +value with the default value for a given type + +@since version 1.0.0 +*/ +enum class value_t : std::uint8_t +{ + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (signed integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + binary, ///< binary array (ordered collection of bytes) + discarded ///< discarded by the parser callback function +}; + +/*! +@brief comparison operator for JSON types + +Returns an ordering that is similar to Python: +- order: null < boolean < number < object < array < string < binary +- furthermore, each type is not smaller than itself +- discarded values are not comparable +- binary is represented as a b"" string in python and directly comparable to a + string; however, making a binary array directly comparable with a string would + be surprising behavior in a JSON file. + +@since version 1.0.0 +*/ +#if JSON_HAS_THREE_WAY_COMPARISON + inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* +#else + inline bool operator<(const value_t lhs, const value_t rhs) noexcept +#endif +{ + static constexpr std::array order = {{ + 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, + 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, + 6 /* binary */ + } + }; + + const auto l_index = static_cast(lhs); + const auto r_index = static_cast(rhs); +#if JSON_HAS_THREE_WAY_COMPARISON + if (l_index < order.size() && r_index < order.size()) + { + return order[l_index] <=> order[r_index]; // *NOPAD* + } + return std::partial_ordering::unordered; +#else + return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; +#endif +} + +// GCC selects the built-in operator< over an operator rewritten from +// a user-defined spaceship operator +// Clang, MSVC, and ICC select the rewritten candidate +// (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) +#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) +inline bool operator<(const value_t lhs, const value_t rhs) noexcept +{ + return std::is_lt(lhs <=> rhs); // *NOPAD* +} +#endif + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/*! +@brief replace all occurrences of a substring by another string + +@param[in,out] s the string to manipulate; changed so that all + occurrences of @a f are replaced with @a t +@param[in] f the substring to replace with @a t +@param[in] t the string to replace @a f + +@pre The search string @a f must not be empty. **This precondition is +enforced with an assertion.** + +@since version 2.0.0 +*/ +template +inline void replace_substring(StringType& s, const StringType& f, + const StringType& t) +{ + JSON_ASSERT(!f.empty()); + for (auto pos = s.find(f); // find the first occurrence of f + pos != StringType::npos; // make sure f was found + s.replace(pos, f.size(), t), // replace with t, and + pos = s.find(f, pos + t.size())) // find the next occurrence of f + {} +} + +/*! + * @brief string escaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to escape + * @return escaped string + * + * Note the order of escaping "~" to "~0" and "/" to "~1" is important. + */ +template +inline StringType escape(StringType s) +{ + replace_substring(s, StringType{"~"}, StringType{"~0"}); + replace_substring(s, StringType{"/"}, StringType{"~1"}); + return s; +} + +/*! + * @brief string unescaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to unescape + * @return unescaped string + * + * Note the order of escaping "~1" to "/" and "~0" to "~" is important. + */ +template +inline void unescape(StringType& s) +{ + replace_substring(s, StringType{"~1"}, StringType{"/"}); + replace_substring(s, StringType{"~0"}, StringType{"~"}); +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // size_t + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/// struct to capture the start position of the current token +struct position_t +{ + /// the total number of characters read + std::size_t chars_read_total = 0; + /// the number of characters read in the current line + std::size_t chars_read_current_line = 0; + /// the number of lines read + std::size_t lines_read = 0; + + /// conversion to size_t to preserve SAX interface + constexpr operator size_t() const + { + return chars_read_total; + } +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-FileCopyrightText: 2018 The Abseil Authors +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type +#include // index_sequence, make_index_sequence, index_sequence_for + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +using uncvref_t = typename std::remove_cv::type>::type; + +#ifdef JSON_HAS_CPP_14 + +// the following utilities are natively available in C++14 +using std::enable_if_t; +using std::index_sequence; +using std::make_index_sequence; +using std::index_sequence_for; + +#else + +// alias templates to reduce boilerplate +template +using enable_if_t = typename std::enable_if::type; + +// The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h +// which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. + +//// START OF CODE FROM GOOGLE ABSEIL + +// integer_sequence +// +// Class template representing a compile-time integer sequence. An instantiation +// of `integer_sequence` has a sequence of integers encoded in its +// type through its template arguments (which is a common need when +// working with C++11 variadic templates). `absl::integer_sequence` is designed +// to be a drop-in replacement for C++14's `std::integer_sequence`. +// +// Example: +// +// template< class T, T... Ints > +// void user_function(integer_sequence); +// +// int main() +// { +// // user_function's `T` will be deduced to `int` and `Ints...` +// // will be deduced to `0, 1, 2, 3, 4`. +// user_function(make_integer_sequence()); +// } +template +struct integer_sequence +{ + using value_type = T; + static constexpr std::size_t size() noexcept + { + return sizeof...(Ints); + } +}; + +// index_sequence +// +// A helper template for an `integer_sequence` of `size_t`, +// `absl::index_sequence` is designed to be a drop-in replacement for C++14's +// `std::index_sequence`. +template +using index_sequence = integer_sequence; + +namespace utility_internal +{ + +template +struct Extend; + +// Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. +template +struct Extend, SeqSize, 0> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; +}; + +template +struct Extend, SeqSize, 1> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; +}; + +// Recursion helper for 'make_integer_sequence'. +// 'Gen::type' is an alias for 'integer_sequence'. +template +struct Gen +{ + using type = + typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; +}; + +template +struct Gen +{ + using type = integer_sequence; +}; + +} // namespace utility_internal + +// Compile-time sequences of integers + +// make_integer_sequence +// +// This template alias is equivalent to +// `integer_sequence`, and is designed to be a drop-in +// replacement for C++14's `std::make_integer_sequence`. +template +using make_integer_sequence = typename utility_internal::Gen::type; + +// make_index_sequence +// +// This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, +// and is designed to be a drop-in replacement for C++14's +// `std::make_index_sequence`. +template +using make_index_sequence = make_integer_sequence; + +// index_sequence_for +// +// Converts a typename pack into an index sequence of the same length, and +// is designed to be a drop-in replacement for C++14's +// `std::index_sequence_for()` +template +using index_sequence_for = make_index_sequence; + +//// END OF CODE FROM GOOGLE ABSEIL + +#endif + +// dispatch utility (taken from ranges-v3) +template struct priority_tag : priority_tag < N - 1 > {}; +template<> struct priority_tag<0> {}; + +// taken from ranges-v3 +template +struct static_const +{ + static JSON_INLINE_VARIABLE constexpr T value{}; +}; + +#ifndef JSON_HAS_CPP_17 + template + constexpr T static_const::value; +#endif + +template +constexpr std::array make_array(Args&& ... args) +{ + return std::array {{static_cast(std::forward(args))...}}; +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // numeric_limits +#include // char_traits +#include // tuple +#include // false_type, is_constructible, is_integral, is_same, true_type +#include // declval +#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L + #include // byte +#endif +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // random_access_iterator_tag + +// #include + +// #include + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +struct iterator_types {}; + +template +struct iterator_types < + It, + void_t> +{ + using difference_type = typename It::difference_type; + using value_type = typename It::value_type; + using pointer = typename It::pointer; + using reference = typename It::reference; + using iterator_category = typename It::iterator_category; +}; + +// This is required as some compilers implement std::iterator_traits in a way that +// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. +template +struct iterator_traits +{ +}; + +template +struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> + : iterator_types +{ +}; + +template +struct iterator_traits::value>> +{ + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); + +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); + +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann +// SPDX-License-Identifier: MIT + +#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ + #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + #include // int64_t, uint64_t + #include // map + #include // allocator + #include // string + #include // vector + + // #include + + + /*! + @brief namespace for Niels Lohmann + @see https://github.com/nlohmann + @since version 1.0.0 + */ + NLOHMANN_JSON_NAMESPACE_BEGIN + + /*! + @brief default JSONSerializer template argument + + This serializer ignores the template arguments and uses ADL + ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) + for serialization. + */ + template + struct adl_serializer; + + /// a class to store JSON values + /// @sa https://json.nlohmann.me/api/basic_json/ + template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer, + class BinaryType = std::vector, // cppcheck-suppress syntaxError + class CustomBaseClass = void> + class basic_json; + + /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document + /// @sa https://json.nlohmann.me/api/json_pointer/ + template + class json_pointer; + + /*! + @brief default specialization + @sa https://json.nlohmann.me/api/json/ + */ + using json = basic_json<>; + + /// @brief a minimal map-like container that preserves insertion order + /// @sa https://json.nlohmann.me/api/ordered_map/ + template + struct ordered_map; + + /// @brief specialization that maintains the insertion order of object keys + /// @sa https://json.nlohmann.me/api/ordered_json/ + using ordered_json = basic_json; + + NLOHMANN_JSON_NAMESPACE_END + +#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + +NLOHMANN_JSON_NAMESPACE_BEGIN +/*! +@brief detail namespace with internal helper functions + +This namespace collects functions that should not be exposed, +implementations of some @ref basic_json methods, and meta-programming helpers. + +@since version 2.1.0 +*/ +namespace detail +{ + +///////////// +// helpers // +///////////// + +// Note to maintainers: +// +// Every trait in this file expects a non-CV-qualified type. +// The only exceptions are in the 'aliases for detected' section +// (i.e., those of the form: decltype(T::member_function(std::declval()))) +// +// In this case, T has to be properly CV-qualified to constraint the function arguments +// (e.g., to_json(BasicJsonType&, const T&)) + +template struct is_basic_json : std::false_type {}; + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +struct is_basic_json : std::true_type {}; + +// used by exceptions create() member functions +// true_type for the pointer to possibly cv-qualified basic_json or std::nullptr_t +// false_type otherwise +template +struct is_basic_json_context : + std::integral_constant < bool, + is_basic_json::type>::type>::value + || std::is_same::value > +{}; + +////////////////////// +// json_ref helpers // +////////////////////// + +template +class json_ref; + +template +struct is_json_ref : std::false_type {}; + +template +struct is_json_ref> : std::true_type {}; + +////////////////////////// +// aliases for detected // +////////////////////////// + +template +using mapped_type_t = typename T::mapped_type; + +template +using key_type_t = typename T::key_type; + +template +using value_type_t = typename T::value_type; + +template +using difference_type_t = typename T::difference_type; + +template +using pointer_t = typename T::pointer; + +template +using reference_t = typename T::reference; + +template +using iterator_category_t = typename T::iterator_category; + +template +using to_json_function = decltype(T::to_json(std::declval()...)); + +template +using from_json_function = decltype(T::from_json(std::declval()...)); + +template +using get_template_function = decltype(std::declval().template get()); + +// trait checking if JSONSerializer::from_json(json const&, udt&) exists +template +struct has_from_json : std::false_type {}; + +// trait checking if j.get is valid +// use this trait instead of std::is_constructible or std::is_convertible, +// both rely on, or make use of implicit conversions, and thus fail when T +// has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) +template +struct is_getable +{ + static constexpr bool value = is_detected::value; +}; + +template +struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if JSONSerializer::from_json(json const&) exists +// this overload is used for non-default-constructible user-defined-types +template +struct has_non_default_from_json : std::false_type {}; + +template +struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if BasicJsonType::json_serializer::to_json exists +// Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. +template +struct has_to_json : std::false_type {}; + +template +struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +template +using detect_key_compare = typename T::key_compare; + +template +struct has_key_compare : std::integral_constant::value> {}; + +// obtains the actual object key comparator +template +struct actual_object_comparator +{ + using object_t = typename BasicJsonType::object_t; + using object_comparator_t = typename BasicJsonType::default_object_comparator_t; + using type = typename std::conditional < has_key_compare::value, + typename object_t::key_compare, object_comparator_t>::type; +}; + +template +using actual_object_comparator_t = typename actual_object_comparator::type; + +///////////////// +// char_traits // +///////////////// + +// Primary template of char_traits calls std char_traits +template +struct char_traits : std::char_traits +{}; + +// Explicitly define char traits for unsigned char since it is not standard +template<> +struct char_traits : std::char_traits +{ + using char_type = unsigned char; + using int_type = uint64_t; + + // Redefine to_int_type function + static int_type to_int_type(char_type c) noexcept + { + return static_cast(c); + } + + static char_type to_char_type(int_type i) noexcept + { + return static_cast(i); + } + + static constexpr int_type eof() noexcept + { + return static_cast(std::char_traits::eof()); + } +}; + +// Explicitly define char traits for signed char since it is not standard +template<> +struct char_traits : std::char_traits +{ + using char_type = signed char; + using int_type = uint64_t; + + // Redefine to_int_type function + static int_type to_int_type(char_type c) noexcept + { + return static_cast(c); + } + + static char_type to_char_type(int_type i) noexcept + { + return static_cast(i); + } + + static constexpr int_type eof() noexcept + { + return static_cast(std::char_traits::eof()); + } +}; + +#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L +template<> +struct char_traits : std::char_traits +{ + using char_type = std::byte; + using int_type = uint64_t; + + static int_type to_int_type(char_type c) noexcept + { + return static_cast(std::to_integer(c)); + } + + static char_type to_char_type(int_type i) noexcept + { + return std::byte(static_cast(i)); + } + + static constexpr int_type eof() noexcept + { + return static_cast(std::char_traits::eof()); + } +}; +#endif + +/////////////////// +// is_ functions // +/////////////////// + +// https://en.cppreference.com/w/cpp/types/conjunction +template struct conjunction : std::true_type { }; +template struct conjunction : B { }; +template +struct conjunction +: std::conditional(B::value), conjunction, B>::type {}; + +// https://en.cppreference.com/w/cpp/types/negation +template struct negation : std::integral_constant < bool, !B::value > { }; + +// Reimplementation of is_constructible and is_default_constructible, due to them being broken for +// std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). +// This causes compile errors in e.g., Clang 3.5 or GCC 4.9. +template +struct is_default_constructible : std::is_default_constructible {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_constructible : std::is_constructible {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_iterator_traits : std::false_type {}; + +template +struct is_iterator_traits> +{ + private: + using traits = iterator_traits; + + public: + static constexpr auto value = + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value; +}; + +template +struct is_range +{ + private: + using t_ref = typename std::add_lvalue_reference::type; + + using iterator = detected_t; + using sentinel = detected_t; + + // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator + // and https://en.cppreference.com/w/cpp/iterator/sentinel_for + // but reimplementing these would be too much work, as a lot of other concepts are used underneath + static constexpr auto is_iterator_begin = + is_iterator_traits>::value; + + public: + static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; +}; + +template +using iterator_t = enable_if_t::value, result_of_begin())>>; + +template +using range_value_t = value_type_t>>; + +// The following implementation of is_complete_type is taken from +// https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ +// and is written by Xiang Fan who agreed to use it in this library. + +template +struct is_complete_type : std::false_type {}; + +template +struct is_complete_type : std::true_type {}; + +template +struct is_compatible_object_type_impl : std::false_type {}; + +template +struct is_compatible_object_type_impl < + BasicJsonType, CompatibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + // macOS's is_constructible does not play well with nonesuch... + static constexpr bool value = + is_constructible::value && + is_constructible::value; +}; + +template +struct is_compatible_object_type + : is_compatible_object_type_impl {}; + +template +struct is_constructible_object_type_impl : std::false_type {}; + +template +struct is_constructible_object_type_impl < + BasicJsonType, ConstructibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + static constexpr bool value = + (is_default_constructible::value && + (std::is_move_assignable::value || + std::is_copy_assignable::value) && + (is_constructible::value && + std::is_same < + typename object_t::mapped_type, + typename ConstructibleObjectType::mapped_type >::value)) || + (has_from_json::value || + has_non_default_from_json < + BasicJsonType, + typename ConstructibleObjectType::mapped_type >::value); +}; + +template +struct is_constructible_object_type + : is_constructible_object_type_impl {}; + +template +struct is_compatible_string_type +{ + static constexpr auto value = + is_constructible::value; +}; + +template +struct is_constructible_string_type +{ + // launder type through decltype() to fix compilation failure on ICPC +#ifdef __INTEL_COMPILER + using laundered_type = decltype(std::declval()); +#else + using laundered_type = ConstructibleStringType; +#endif + + static constexpr auto value = + conjunction < + is_constructible, + is_detected_exact>::value; +}; + +template +struct is_compatible_array_type_impl : std::false_type {}; + +template +struct is_compatible_array_type_impl < + BasicJsonType, CompatibleArrayType, + enable_if_t < + is_detected::value&& + is_iterator_traits>>::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 + !std::is_same>::value >> +{ + static constexpr bool value = + is_constructible>::value; +}; + +template +struct is_compatible_array_type + : is_compatible_array_type_impl {}; + +template +struct is_constructible_array_type_impl : std::false_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t::value >> + : std::true_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t < !std::is_same::value&& + !is_compatible_string_type::value&& + is_default_constructible::value&& +(std::is_move_assignable::value || + std::is_copy_assignable::value)&& +is_detected::value&& +is_iterator_traits>>::value&& +is_detected::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 +!std::is_same>::value&& +is_complete_type < +detected_t>::value >> +{ + using value_type = range_value_t; + + static constexpr bool value = + std::is_same::value || + has_from_json::value || + has_non_default_from_json < + BasicJsonType, + value_type >::value; +}; + +template +struct is_constructible_array_type + : is_constructible_array_type_impl {}; + +template +struct is_compatible_integer_type_impl : std::false_type {}; + +template +struct is_compatible_integer_type_impl < + RealIntegerType, CompatibleNumberIntegerType, + enable_if_t < std::is_integral::value&& + std::is_integral::value&& + !std::is_same::value >> +{ + // is there an assert somewhere on overflows? + using RealLimits = std::numeric_limits; + using CompatibleLimits = std::numeric_limits; + + static constexpr auto value = + is_constructible::value && + CompatibleLimits::is_integer && + RealLimits::is_signed == CompatibleLimits::is_signed; +}; + +template +struct is_compatible_integer_type + : is_compatible_integer_type_impl {}; + +template +struct is_compatible_type_impl: std::false_type {}; + +template +struct is_compatible_type_impl < + BasicJsonType, CompatibleType, + enable_if_t::value >> +{ + static constexpr bool value = + has_to_json::value; +}; + +template +struct is_compatible_type + : is_compatible_type_impl {}; + +template +struct is_compatible_reference_type_impl +{ + using JsonType = uncvref_t; + using CVType = typename std::remove_reference::type; + using Type = typename std::remove_cv::type; + constexpr static bool value = std::is_reference::value && + (!std::is_const::type>::value || std::is_const::value) && + (std::is_same::value || + std::is_same::value || + std::is_same::value || + std::is_same::value || + std::is_same::value || + std::is_same::value || + std::is_same::value || + std::is_same::value); +}; + +template +struct is_compatible_reference_type + : is_compatible_reference_type_impl {}; + +template +struct is_constructible_tuple : std::false_type {}; + +template +struct is_constructible_tuple> : conjunction...> {}; + +template +struct is_json_iterator_of : std::false_type {}; + +template +struct is_json_iterator_of : std::true_type {}; + +template +struct is_json_iterator_of : std::true_type +{}; + +// checks if a given type T is a template specialization of Primary +template